]> code.delx.au - gnu-emacs/commitdiff
merge changes in emacs-23 branch
authorKenichi Handa <handa@m17n.org>
Wed, 1 Sep 2010 07:13:21 +0000 (16:13 +0900)
committerKenichi Handa <handa@m17n.org>
Wed, 1 Sep 2010 07:13:21 +0000 (16:13 +0900)
1156 files changed:
.arch-inventory [deleted file]
.dir-locals.el
.gitignore
ChangeLog
INSTALL
Makefile.in
README
README.imagemagick [new file with mode: 0644]
admin/CPP-DEFINES
admin/ChangeLog
admin/MAINTAINERS
admin/admin.el
admin/charsets/.arch-inventory [deleted file]
admin/make-tarball.txt
admin/notes/BRANCH
admin/notes/bugtracker
admin/notes/bzr [new file with mode: 0644]
admin/notes/cpp [deleted file]
admin/notes/font-backend
admin/notes/newfile
admin/nt/makedist.bat [deleted file]
admin/quick-install-emacs
admin/unidata/.arch-inventory [deleted file]
admin/unidata/BidiMirroring.txt [new file with mode: 0644]
admin/unidata/Makefile.in
admin/unidata/UnicodeData.txt
admin/unidata/bidimirror.awk [new file with mode: 0644]
admin/unidata/biditype.awk [new file with mode: 0644]
admin/unidata/makefile.w32-in
config.bat
configure
configure.in
doc/emacs/ChangeLog
doc/emacs/ack.texi
doc/emacs/basic.texi
doc/emacs/building.texi
doc/emacs/cmdargs.texi
doc/emacs/dired.texi
doc/emacs/display.texi
doc/emacs/emacs.texi
doc/emacs/files.texi
doc/emacs/frames.texi
doc/emacs/mule.texi
doc/emacs/search.texi
doc/emacs/xresources.texi
doc/lispintro/ChangeLog
doc/lispref/.arch-inventory [deleted file]
doc/lispref/ChangeLog
doc/lispref/anti.texi
doc/lispref/book-spine.texinfo
doc/lispref/commands.texi
doc/lispref/compile.texi
doc/lispref/display.texi
doc/lispref/elisp.texi
doc/lispref/frames.texi
doc/lispref/internals.texi
doc/lispref/loading.texi
doc/lispref/locals.texi
doc/lispref/nonascii.texi
doc/lispref/os.texi
doc/lispref/package.texi [new file with mode: 0644]
doc/lispref/processes.texi
doc/lispref/tips.texi
doc/lispref/vol1.texi
doc/lispref/vol2.texi
doc/man/ChangeLog
doc/man/emacs.1
doc/misc/ChangeLog
doc/misc/auth.texi
doc/misc/calc.texi
doc/misc/cc-mode.texi
doc/misc/cl.texi
doc/misc/dbus.texi
doc/misc/emacs-mime.texi
doc/misc/eshell.texi
doc/misc/faq.texi
doc/misc/gnus.texi
doc/misc/message.texi
doc/misc/org.texi
etc/.arch-inventory [deleted file]
etc/AUTHORS
etc/ChangeLog
etc/DEBUG
etc/HELLO
etc/MACHINES
etc/NEWS
etc/NEWS.23 [new file with mode: 0644]
etc/PROBLEMS
etc/TODO
etc/compilation.txt
etc/gnus/gnus-setup.ast
etc/gnus/news-server.ast
etc/images/custom/down.xpm
etc/images/custom/right.xpm
etc/refcards/orgcard.tex
etc/tutorials/TUTORIAL.he [new file with mode: 0644]
etc/tutorials/TUTORIAL.translators
info/.arch-inventory [deleted file]
leim/.arch-inventory [deleted file]
leim/ChangeLog
leim/Makefile.in
leim/makefile.w32-in
leim/quail/.arch-inventory [deleted file]
lib-src/.arch-inventory [deleted file]
lib-src/ChangeLog
lib-src/Makefile.in
lib-src/b2m.c
lib-src/digest-doc.c
lib-src/ebrowse.c
lib-src/emacsclient.c
lib-src/etags.c
lib-src/fakemail.c
lib-src/hexl.c
lib-src/make-docfile.c
lib-src/makefile.w32-in
lib-src/movemail.c
lib-src/ntlib.c
lib-src/ntlib.h
lib-src/pop.c
lib-src/pop.h
lib-src/profile.c
lib-src/sorted-doc.c
lib-src/test-distrib.c
lib-src/update-game-score.c
lisp/.arch-inventory [deleted file]
lisp/ChangeLog
lisp/ChangeLog.1
lisp/ChangeLog.10
lisp/ChangeLog.11
lisp/ChangeLog.12
lisp/ChangeLog.13
lisp/ChangeLog.14
lisp/ChangeLog.2
lisp/ChangeLog.3
lisp/ChangeLog.5
lisp/ChangeLog.6
lisp/ChangeLog.7
lisp/ChangeLog.8
lisp/ChangeLog.9
lisp/Makefile.in
lisp/abbrev.el
lisp/abbrevlist.el
lisp/allout.el
lisp/apropos.el
lisp/arc-mode.el
lisp/autoinsert.el
lisp/bindings.el
lisp/bookmark.el
lisp/bs.el
lisp/buff-menu.el
lisp/button.el
lisp/calc/.arch-inventory [deleted file]
lisp/calc/README
lisp/calc/calc-aent.el
lisp/calc/calc-bin.el
lisp/calc/calc-ext.el
lisp/calc/calc-frac.el
lisp/calc/calc-graph.el
lisp/calc/calc-help.el
lisp/calc/calc-incom.el
lisp/calc/calc-lang.el
lisp/calc/calc-misc.el
lisp/calc/calc-poly.el
lisp/calc/calc-sel.el
lisp/calc/calc-store.el
lisp/calc/calc-trail.el
lisp/calc/calc-units.el
lisp/calc/calc-vec.el
lisp/calc/calc.el
lisp/calc/calccomp.el
lisp/calculator.el
lisp/calendar/.arch-inventory [deleted file]
lisp/calendar/appt.el
lisp/calendar/cal-bahai.el
lisp/calendar/cal-china.el
lisp/calendar/cal-coptic.el
lisp/calendar/cal-dst.el
lisp/calendar/cal-french.el
lisp/calendar/cal-hebrew.el
lisp/calendar/cal-html.el
lisp/calendar/cal-islam.el
lisp/calendar/cal-iso.el
lisp/calendar/cal-julian.el
lisp/calendar/cal-mayan.el
lisp/calendar/cal-menu.el
lisp/calendar/cal-move.el
lisp/calendar/cal-persia.el
lisp/calendar/cal-tex.el
lisp/calendar/cal-x.el
lisp/calendar/holidays.el
lisp/calendar/icalendar.el
lisp/calendar/lunar.el
lisp/calendar/solar.el
lisp/calendar/todo-mode.el
lisp/case-table.el
lisp/cedet/cedet-cscope.el
lisp/cedet/cedet-files.el
lisp/cedet/cedet-global.el
lisp/cedet/cedet-idutils.el
lisp/cedet/cedet.el
lisp/cedet/data-debug.el
lisp/cedet/ede.el
lisp/cedet/ede/dired.el
lisp/cedet/ede/project-am.el
lisp/cedet/semantic.el
lisp/cedet/semantic/bovine/c.el
lisp/cedet/semantic/decorate/mode.el
lisp/cedet/semantic/ia.el
lisp/cedet/semantic/idle.el
lisp/cedet/semantic/mru-bookmark.el
lisp/cedet/semantic/util-modes.el
lisp/cedet/srecode.el
lisp/cedet/srecode/mode.el
lisp/comint.el
lisp/composite.el
lisp/cus-dep.el
lisp/cus-edit.el
lisp/cus-face.el
lisp/cus-start.el
lisp/cus-theme.el
lisp/custom.el
lisp/descr-text.el
lisp/desktop.el
lisp/dired-aux.el
lisp/dired-x.el
lisp/dired.el
lisp/dirtrack.el
lisp/disp-table.el
lisp/dnd.el
lisp/doc-view.el
lisp/dos-fns.el
lisp/dos-vars.el
lisp/dos-w32.el
lisp/dynamic-setting.el [moved from lisp/font-setting.el with 75% similarity]
lisp/ebuff-menu.el
lisp/ehelp.el
lisp/electric.el
lisp/emacs-lisp/advice.el
lisp/emacs-lisp/authors.el
lisp/emacs-lisp/autoload.el
lisp/emacs-lisp/backquote.el
lisp/emacs-lisp/byte-opt.el
lisp/emacs-lisp/byte-run.el
lisp/emacs-lisp/bytecomp.el
lisp/emacs-lisp/cl-compat.el
lisp/emacs-lisp/cl-extra.el
lisp/emacs-lisp/cl-indent.el
lisp/emacs-lisp/cl-loaddefs.el
lisp/emacs-lisp/cl-macs.el
lisp/emacs-lisp/cl-seq.el
lisp/emacs-lisp/cl-specs.el
lisp/emacs-lisp/copyright.el
lisp/emacs-lisp/debug.el
lisp/emacs-lisp/derived.el
lisp/emacs-lisp/easy-mmode.el
lisp/emacs-lisp/easymenu.el
lisp/emacs-lisp/edebug.el
lisp/emacs-lisp/eieio-base.el
lisp/emacs-lisp/eieio-comp.el
lisp/emacs-lisp/eieio-custom.el
lisp/emacs-lisp/eieio-datadebug.el
lisp/emacs-lisp/eieio-opt.el
lisp/emacs-lisp/eieio-speedbar.el
lisp/emacs-lisp/eieio.el
lisp/emacs-lisp/eldoc.el
lisp/emacs-lisp/find-gc.el
lisp/emacs-lisp/float-sup.el
lisp/emacs-lisp/generic.el
lisp/emacs-lisp/helper.el
lisp/emacs-lisp/lisp-mnt.el
lisp/emacs-lisp/lisp-mode.el
lisp/emacs-lisp/lisp.el
lisp/emacs-lisp/macroexp.el
lisp/emacs-lisp/package-x.el [new file with mode: 0644]
lisp/emacs-lisp/package.el [new file with mode: 0644]
lisp/emacs-lisp/pcase.el [new file with mode: 0644]
lisp/emacs-lisp/re-builder.el
lisp/emacs-lisp/smie.el [new file with mode: 0644]
lisp/emacs-lisp/tcover-ses.el
lisp/emacs-lisp/tcover-unsafep.el
lisp/emacs-lisp/timer.el
lisp/emulation/cua-base.el
lisp/emulation/cua-gmrk.el
lisp/emulation/cua-rect.el
lisp/emulation/edt-lk201.el
lisp/emulation/edt-mapper.el
lisp/emulation/edt-pc.el
lisp/emulation/edt-vt100.el
lisp/emulation/edt.el
lisp/emulation/pc-select.el
lisp/emulation/tpu-edt.el
lisp/emulation/tpu-extras.el
lisp/emulation/tpu-mapper.el
lisp/emulation/viper-cmd.el
lisp/emulation/viper-ex.el
lisp/emulation/viper-init.el
lisp/emulation/viper-keym.el
lisp/emulation/viper-macs.el
lisp/emulation/viper-mous.el
lisp/emulation/viper-util.el
lisp/emulation/viper.el
lisp/emulation/ws-mode.el
lisp/env.el
lisp/epa-dired.el
lisp/epa-file.el
lisp/epa-hook.el
lisp/epa-mail.el
lisp/epg-config.el
lisp/epg.el
lisp/erc/ChangeLog
lisp/erc/ChangeLog.03
lisp/erc/ChangeLog.04
lisp/erc/erc-backend.el
lisp/erc/erc-join.el
lisp/erc/erc.el
lisp/eshell/.arch-inventory [deleted file]
lisp/eshell/esh-test.el
lisp/eshell/eshell.el
lisp/expand.el
lisp/face-remap.el
lisp/facemenu.el
lisp/faces.el
lisp/files-x.el
lisp/files.el
lisp/find-dired.el
lisp/finder.el
lisp/foldout.el
lisp/font-core.el
lisp/font-lock.el
lisp/format.el
lisp/forms.el
lisp/frame.el
lisp/fringe.el
lisp/generic-x.el
lisp/gnus/ChangeLog
lisp/gnus/ChangeLog.1
lisp/gnus/ChangeLog.2
lisp/gnus/auth-source.el
lisp/gnus/gmm-utils.el
lisp/gnus/gnus-agent.el
lisp/gnus/gnus-art.el
lisp/gnus/gnus-async.el
lisp/gnus/gnus-cite.el
lisp/gnus/gnus-dired.el
lisp/gnus/gnus-draft.el
lisp/gnus/gnus-ems.el
lisp/gnus/gnus-group.el
lisp/gnus/gnus-html.el [new file with mode: 0644]
lisp/gnus/gnus-ml.el
lisp/gnus/gnus-move.el [deleted file]
lisp/gnus/gnus-registry.el
lisp/gnus/gnus-salt.el
lisp/gnus/gnus-score.el
lisp/gnus/gnus-soup.el [deleted file]
lisp/gnus/gnus-start.el
lisp/gnus/gnus-sum.el
lisp/gnus/gnus-sync.el [new file with mode: 0644]
lisp/gnus/gnus-topic.el
lisp/gnus/gnus-undo.el
lisp/gnus/gnus-util.el
lisp/gnus/gnus-uu.el
lisp/gnus/gnus.el
lisp/gnus/ietf-drums.el
lisp/gnus/mail-source.el
lisp/gnus/mailcap.el
lisp/gnus/message.el
lisp/gnus/mm-decode.el
lisp/gnus/mm-encode.el
lisp/gnus/mm-extern.el
lisp/gnus/mm-url.el
lisp/gnus/mm-util.el
lisp/gnus/mml-sec.el
lisp/gnus/mml-smime.el
lisp/gnus/mml.el
lisp/gnus/mml1991.el
lisp/gnus/mml2015.el
lisp/gnus/nndoc.el
lisp/gnus/nneething.el
lisp/gnus/nnheader.el
lisp/gnus/nnimap.el
lisp/gnus/nnir.el
lisp/gnus/nnmail.el
lisp/gnus/nnml.el
lisp/gnus/nnrss.el
lisp/gnus/nnslashdot.el [deleted file]
lisp/gnus/nnsoup.el [deleted file]
lisp/gnus/nntp.el
lisp/gnus/nnultimate.el [deleted file]
lisp/gnus/nnwarchive.el [deleted file]
lisp/gnus/nnweb.el
lisp/gnus/pop3.el
lisp/gnus/rfc2047.el
lisp/gnus/sieve-manage.el
lisp/gnus/sieve-mode.el
lisp/gnus/smiley.el
lisp/gnus/spam-stat.el
lisp/gnus/utf7.el
lisp/gnus/yenc.el
lisp/help-fns.el
lisp/help-macro.el
lisp/help-mode.el
lisp/help.el
lisp/hfy-cmap.el
lisp/hl-line.el
lisp/htmlfontify.el
lisp/ibuf-ext.el
lisp/ibuf-macs.el
lisp/ibuffer.el
lisp/icomplete.el
lisp/ido.el
lisp/iimage.el
lisp/image-dired.el
lisp/image-mode.el
lisp/image.el
lisp/indent.el
lisp/info.el
lisp/international/charprop.el
lisp/international/fontset.el
lisp/international/iso-ascii.el
lisp/international/mule-cmds.el
lisp/international/mule.el
lisp/international/quail.el
lisp/international/uni-bidi.el
lisp/international/uni-category.el
lisp/international/uni-combining.el
lisp/international/uni-comment.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-old-name.el
lisp/international/uni-titlecase.el
lisp/international/uni-uppercase.el
lisp/international/utf-7.el
lisp/isearch.el
lisp/jit-lock.el
lisp/jka-cmpr-hook.el
lisp/jka-compr.el
lisp/kmacro.el
lisp/language/ethio-util.el
lisp/language/hebrew.el
lisp/language/misc-lang.el
lisp/language/tai-viet.el
lisp/language/tv-util.el
lisp/ldefs-boot.el
lisp/linum.el
lisp/loadup.el
lisp/locate.el
lisp/lpr.el
lisp/ls-lisp.el
lisp/macros.el
lisp/mail/binhex.el
lisp/mail/blessmail.el
lisp/mail/emacsbug.el
lisp/mail/hashcash.el
lisp/mail/mail-extr.el
lisp/mail/mail-hist.el
lisp/mail/mailheader.el
lisp/mail/metamail.el
lisp/mail/rmail-spam-filter.el
lisp/mail/rmail.el
lisp/mail/rmailedit.el
lisp/mail/rmailkwd.el
lisp/mail/rmailmm.el
lisp/mail/rmailmsc.el
lisp/mail/rmailout.el
lisp/mail/rmailsort.el
lisp/mail/rmailsum.el
lisp/mail/supercite.el
lisp/mail/uudecode.el
lisp/makefile.w32-in
lisp/man.el
lisp/menu-bar.el
lisp/mh-e/.arch-inventory [deleted file]
lisp/mh-e/ChangeLog
lisp/mh-e/ChangeLog.1
lisp/mh-e/mh-alias.el
lisp/mh-e/mh-comp.el
lisp/mh-e/mh-e.el
lisp/mh-e/mh-mime.el
lisp/mh-e/mh-search.el
lisp/mh-e/mh-show.el
lisp/midnight.el
lisp/minibuffer.el
lisp/misc.el
lisp/mouse-sel.el
lisp/mouse.el
lisp/mpc.el
lisp/mwheel.el
lisp/net/ange-ftp.el
lisp/net/browse-url.el
lisp/net/dbus.el
lisp/net/dns.el
lisp/net/eudc-bob.el
lisp/net/eudc-export.el
lisp/net/eudc-hotlist.el
lisp/net/eudc-vars.el
lisp/net/eudcb-bbdb.el
lisp/net/eudcb-ldap.el
lisp/net/eudcb-mab.el
lisp/net/eudcb-ph.el
lisp/net/goto-addr.el
lisp/net/hmac-def.el
lisp/net/hmac-md5.el
lisp/net/imap.el
lisp/net/netrc.el
lisp/net/newst-backend.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/rcirc.el
lisp/net/rlogin.el
lisp/net/sasl-cram.el
lisp/net/sasl-digest.el
lisp/net/sasl-ntlm.el
lisp/net/secrets.el [new file with mode: 0644]
lisp/net/tramp-cache.el
lisp/net/tramp-cmds.el
lisp/net/tramp-compat.el
lisp/net/tramp-fish.el
lisp/net/tramp-ftp.el
lisp/net/tramp-gvfs.el
lisp/net/tramp-gw.el
lisp/net/tramp-imap.el
lisp/net/tramp-smb.el
lisp/net/tramp-uu.el
lisp/net/trampver.el
lisp/net/xesam.el
lisp/newcomment.el
lisp/notifications.el [new file with mode: 0644]
lisp/nxml/nxml-mode.el
lisp/obsolete/complete.el [moved from lisp/complete.el with 99% similarity]
lisp/obsolete/s-region.el [moved from lisp/s-region.el with 99% similarity]
lisp/org/ChangeLog
lisp/org/ob-C.el [new file with mode: 0644]
lisp/org/ob-R.el [new file with mode: 0644]
lisp/org/ob-asymptote.el [new file with mode: 0644]
lisp/org/ob-clojure.el [new file with mode: 0644]
lisp/org/ob-comint.el [new file with mode: 0644]
lisp/org/ob-css.el [new file with mode: 0644]
lisp/org/ob-ditaa.el [new file with mode: 0644]
lisp/org/ob-dot.el [new file with mode: 0644]
lisp/org/ob-emacs-lisp.el [new file with mode: 0644]
lisp/org/ob-eval.el [new file with mode: 0644]
lisp/org/ob-exp.el [new file with mode: 0644]
lisp/org/ob-gnuplot.el [new file with mode: 0644]
lisp/org/ob-haskell.el [new file with mode: 0644]
lisp/org/ob-keys.el [new file with mode: 0644]
lisp/org/ob-latex.el [new file with mode: 0644]
lisp/org/ob-lob.el [new file with mode: 0644]
lisp/org/ob-matlab.el [new file with mode: 0644]
lisp/org/ob-mscgen.el [new file with mode: 0644]
lisp/org/ob-ocaml.el [new file with mode: 0644]
lisp/org/ob-octave.el [new file with mode: 0644]
lisp/org/ob-perl.el [new file with mode: 0644]
lisp/org/ob-python.el [new file with mode: 0644]
lisp/org/ob-ref.el [new file with mode: 0644]
lisp/org/ob-ruby.el [new file with mode: 0644]
lisp/org/ob-sass.el [new file with mode: 0644]
lisp/org/ob-screen.el [new file with mode: 0644]
lisp/org/ob-sh.el [new file with mode: 0644]
lisp/org/ob-sql.el [new file with mode: 0644]
lisp/org/ob-sqlite.el [new file with mode: 0644]
lisp/org/ob-table.el [new file with mode: 0644]
lisp/org/ob-tangle.el [new file with mode: 0644]
lisp/org/ob.el [new file with mode: 0644]
lisp/org/org-agenda.el
lisp/org/org-archive.el
lisp/org/org-ascii.el
lisp/org/org-attach.el
lisp/org/org-bbdb.el
lisp/org/org-beamer.el [new file with mode: 0644]
lisp/org/org-bibtex.el
lisp/org/org-capture.el [new file with mode: 0644]
lisp/org/org-clock.el
lisp/org/org-colview.el
lisp/org/org-compat.el
lisp/org/org-crypt.el
lisp/org/org-ctags.el [new file with mode: 0644]
lisp/org/org-datetree.el
lisp/org/org-docbook.el
lisp/org/org-docview.el [new file with mode: 0644]
lisp/org/org-entities.el [new file with mode: 0644]
lisp/org/org-exp-blocks.el
lisp/org/org-exp.el
lisp/org/org-faces.el
lisp/org/org-feed.el
lisp/org/org-footnote.el
lisp/org/org-freemind.el
lisp/org/org-gnus.el
lisp/org/org-habit.el
lisp/org/org-html.el
lisp/org/org-icalendar.el
lisp/org/org-id.el
lisp/org/org-indent.el
lisp/org/org-info.el
lisp/org/org-inlinetask.el
lisp/org/org-irc.el
lisp/org/org-jsinfo.el
lisp/org/org-latex.el
lisp/org/org-list.el
lisp/org/org-mac-message.el
lisp/org/org-macs.el
lisp/org/org-mew.el
lisp/org/org-mhe.el
lisp/org/org-mks.el [new file with mode: 0644]
lisp/org/org-mobile.el
lisp/org/org-mouse.el
lisp/org/org-plot.el
lisp/org/org-protocol.el
lisp/org/org-publish.el
lisp/org/org-remember.el
lisp/org/org-rmail.el
lisp/org/org-src.el
lisp/org/org-table.el
lisp/org/org-taskjuggler.el [new file with mode: 0644]
lisp/org/org-timer.el
lisp/org/org-vm.el
lisp/org/org-w3m.el
lisp/org/org-wl.el
lisp/org/org-xoxo.el
lisp/org/org.el
lisp/outline.el
lisp/password-cache.el
lisp/paths.el
lisp/pcmpl-cvs.el
lisp/pcmpl-gnu.el
lisp/pcmpl-linux.el
lisp/pcmpl-rpm.el
lisp/pcmpl-unix.el
lisp/pcomplete.el
lisp/pgg-def.el
lisp/pgg-gpg.el
lisp/pgg-parse.el
lisp/pgg-pgp.el
lisp/pgg-pgp5.el
lisp/pgg.el
lisp/play/decipher.el
lisp/play/gomoku.el
lisp/play/tetris.el
lisp/play/zone.el
lisp/progmodes/ada-mode.el
lisp/progmodes/ada-prj.el
lisp/progmodes/ada-stmt.el
lisp/progmodes/ada-xref.el
lisp/progmodes/antlr-mode.el
lisp/progmodes/asm-mode.el
lisp/progmodes/bug-reference.el
lisp/progmodes/cc-align.el
lisp/progmodes/cc-awk.el
lisp/progmodes/cc-bytecomp.el
lisp/progmodes/cc-cmds.el
lisp/progmodes/cc-compat.el
lisp/progmodes/cc-defs.el
lisp/progmodes/cc-engine.el
lisp/progmodes/cc-fonts.el
lisp/progmodes/cc-langs.el
lisp/progmodes/cc-menus.el
lisp/progmodes/cc-mode.el
lisp/progmodes/cc-styles.el
lisp/progmodes/cc-vars.el
lisp/progmodes/compile.el
lisp/progmodes/cperl-mode.el
lisp/progmodes/cwarn.el
lisp/progmodes/dcl-mode.el
lisp/progmodes/delphi.el
lisp/progmodes/ebnf-abn.el
lisp/progmodes/ebnf-bnf.el
lisp/progmodes/ebnf-dtd.el
lisp/progmodes/ebnf-ebx.el
lisp/progmodes/ebnf-iso.el
lisp/progmodes/ebnf-otz.el
lisp/progmodes/ebnf-yac.el
lisp/progmodes/etags.el
lisp/progmodes/f90.el
lisp/progmodes/fortran.el
lisp/progmodes/gdb-mi.el [new file with mode: 0644]
lisp/progmodes/gdb-ui.el [deleted file]
lisp/progmodes/grep.el
lisp/progmodes/gud.el
lisp/progmodes/idlw-complete-structtag.el
lisp/progmodes/idlw-help.el
lisp/progmodes/idlw-shell.el
lisp/progmodes/idlw-toolbar.el
lisp/progmodes/idlwave.el
lisp/progmodes/js.el
lisp/progmodes/make-mode.el
lisp/progmodes/mixal-mode.el
lisp/progmodes/octave-inf.el
lisp/progmodes/octave-mod.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/subword.el
lisp/progmodes/tcl.el
lisp/progmodes/verilog-mode.el
lisp/progmodes/vhdl-mode.el
lisp/ps-bdf.el
lisp/ps-def.el
lisp/ps-mule.el
lisp/ps-print.el
lisp/ps-samp.el
lisp/rect.el
lisp/register.el
lisp/repeat.el
lisp/replace.el
lisp/reveal.el
lisp/rfn-eshadow.el
lisp/ruler-mode.el
lisp/savehist.el
lisp/scroll-all.el
lisp/scroll-bar.el
lisp/server.el
lisp/sha1.el
lisp/shell.el
lisp/simple.el
lisp/skeleton.el
lisp/speedbar.el
lisp/startup.el
lisp/subr.el
lisp/tabify.el
lisp/tar-mode.el
lisp/term.el
lisp/term/common-win.el
lisp/term/ns-win.el
lisp/term/tvi970.el
lisp/term/vt100.el
lisp/term/x-win.el
lisp/textmodes/bibtex.el
lisp/textmodes/css-mode.el
lisp/textmodes/dns-mode.el
lisp/textmodes/fill.el
lisp/textmodes/flyspell.el
lisp/textmodes/ispell.el
lisp/textmodes/nroff-mode.el
lisp/textmodes/page.el
lisp/textmodes/paragraphs.el
lisp/textmodes/picture.el
lisp/textmodes/reftex-auc.el
lisp/textmodes/reftex-cite.el
lisp/textmodes/reftex-dcr.el
lisp/textmodes/reftex-global.el
lisp/textmodes/reftex-index.el
lisp/textmodes/reftex-parse.el
lisp/textmodes/reftex-ref.el
lisp/textmodes/reftex-sel.el
lisp/textmodes/reftex-toc.el
lisp/textmodes/reftex-vars.el
lisp/textmodes/reftex.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/text-mode.el
lisp/time.el
lisp/tool-bar.el
lisp/tooltip.el
lisp/tutorial.el
lisp/type-break.el
lisp/uniquify.el
lisp/url/ChangeLog
lisp/url/url-dired.el
lisp/url/url-http.el
lisp/url/url-parse.el
lisp/url/url-vars.el
lisp/url/url.el
lisp/vc/add-log.el [moved from lisp/add-log.el with 98% similarity]
lisp/vc/compare-w.el [moved from lisp/compare-w.el with 99% similarity]
lisp/vc/cvs-status.el [moved from lisp/cvs-status.el with 98% similarity]
lisp/vc/diff-mode.el [moved from lisp/diff-mode.el with 99% similarity]
lisp/vc/diff.el [moved from lisp/diff.el with 99% similarity]
lisp/vc/ediff-diff.el [moved from lisp/ediff-diff.el with 99% similarity]
lisp/vc/ediff-help.el [moved from lisp/ediff-help.el with 99% similarity]
lisp/vc/ediff-hook.el [moved from lisp/ediff-hook.el with 99% similarity]
lisp/vc/ediff-init.el [moved from lisp/ediff-init.el with 99% similarity]
lisp/vc/ediff-merg.el [moved from lisp/ediff-merg.el with 99% similarity]
lisp/vc/ediff-mult.el [moved from lisp/ediff-mult.el with 99% similarity]
lisp/vc/ediff-ptch.el [moved from lisp/ediff-ptch.el with 99% similarity]
lisp/vc/ediff-util.el [moved from lisp/ediff-util.el with 99% similarity]
lisp/vc/ediff-vers.el [moved from lisp/ediff-vers.el with 99% similarity]
lisp/vc/ediff-wind.el [moved from lisp/ediff-wind.el with 99% similarity]
lisp/vc/ediff.el [moved from lisp/ediff.el with 99% similarity]
lisp/vc/emerge.el [moved from lisp/emerge.el with 99% similarity]
lisp/vc/log-edit.el [moved from lisp/log-edit.el with 80% similarity]
lisp/vc/log-view.el [moved from lisp/log-view.el with 99% similarity]
lisp/vc/pcvs-defs.el [moved from lisp/pcvs-defs.el with 99% similarity]
lisp/vc/pcvs-info.el [moved from lisp/pcvs-info.el with 99% similarity]
lisp/vc/pcvs-parse.el [moved from lisp/pcvs-parse.el with 99% similarity]
lisp/vc/pcvs-util.el [moved from lisp/pcvs-util.el with 99% similarity]
lisp/vc/pcvs.el [moved from lisp/pcvs.el with 99% similarity]
lisp/vc/smerge-mode.el [moved from lisp/smerge-mode.el with 98% similarity]
lisp/vc/vc-annotate.el [moved from lisp/vc-annotate.el with 99% similarity]
lisp/vc/vc-arch.el [moved from lisp/vc-arch.el with 99% similarity]
lisp/vc/vc-bzr.el [moved from lisp/vc-bzr.el with 92% similarity]
lisp/vc/vc-cvs.el [moved from lisp/vc-cvs.el with 99% similarity]
lisp/vc/vc-dav.el [moved from lisp/vc-dav.el with 99% similarity]
lisp/vc/vc-dir.el [moved from lisp/vc-dir.el with 97% similarity]
lisp/vc/vc-dispatcher.el [moved from lisp/vc-dispatcher.el with 93% similarity]
lisp/vc/vc-git.el [moved from lisp/vc-git.el with 95% similarity]
lisp/vc/vc-hg.el [moved from lisp/vc-hg.el with 91% similarity]
lisp/vc/vc-hooks.el [moved from lisp/vc-hooks.el with 97% similarity]
lisp/vc/vc-mtn.el [moved from lisp/vc-mtn.el with 97% similarity]
lisp/vc/vc-rcs.el [moved from lisp/vc-rcs.el with 99% similarity]
lisp/vc/vc-sccs.el [moved from lisp/vc-sccs.el with 99% similarity]
lisp/vc/vc-svn.el [moved from lisp/vc-svn.el with 99% similarity]
lisp/vc/vc.el [moved from lisp/vc.el with 89% similarity]
lisp/vcursor.el
lisp/version.el
lisp/view.el
lisp/w32-fns.el
lisp/w32-vars.el
lisp/whitespace.el
lisp/wid-browse.el
lisp/wid-edit.el
lisp/widget.el
lisp/window.el
lisp/woman.el
lisp/x-dnd.el
lwlib/ChangeLog
lwlib/Makefile.in
lwlib/lwlib-Xaw.c
lwlib/lwlib-Xaw.h
lwlib/lwlib-Xlw.c
lwlib/lwlib-Xlw.h
lwlib/lwlib-Xm.c
lwlib/lwlib-Xm.h
lwlib/lwlib-int.h
lwlib/lwlib-utils.c
lwlib/lwlib-utils.h
lwlib/lwlib.c
lwlib/lwlib.h
lwlib/xlwmenu.c
lwlib/xlwmenu.h
lwlib/xlwmenuP.h
make-dist
msdos/ChangeLog
msdos/mainmake [deleted file]
msdos/mainmake.v2
msdos/sed1.inp [deleted file]
msdos/sed1v2.inp
msdos/sed1x.inp
msdos/sed2.inp [deleted file]
msdos/sed2v2.inp
msdos/sed2x.inp
msdos/sed3.inp [deleted file]
msdos/sed3v2.inp
msdos/sed3x.inp [new file with mode: 0644]
msdos/sed5x.inp
msdos/sedleim.inp
msdos/sedlisp.inp
nextstep/ChangeLog
nextstep/Cocoa/Emacs.base/Contents/Info.plist
nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj/InfoPlist.strings
nextstep/DEV-NOTES
nextstep/GNUstep/Emacs.base/Resources/Emacs.desktop
nextstep/GNUstep/Emacs.base/Resources/Info-gnustep.plist
nt/.arch-inventory [deleted file]
nt/ChangeLog
nt/INSTALL
nt/README.W32 [moved from admin/nt/README.W32 with 100% similarity]
nt/addpm.c
nt/cmdproxy.c
nt/config.nt
nt/configure.bat
nt/ddeclient.c
nt/emacs.manifest
nt/emacs.rc
nt/emacsclient.rc
nt/gmake.defs
nt/makefile.w32-in
nt/nmake.defs
nt/runemacs.c
nt/zipdist.bat [new file with mode: 0644]
oldXMenu/Activate.c
oldXMenu/AddPane.c
oldXMenu/AddSel.c
oldXMenu/ChangeLog
oldXMenu/ChgPane.c
oldXMenu/ChgSel.c
oldXMenu/Create.c
oldXMenu/DelPane.c
oldXMenu/DelSel.c
oldXMenu/Destroy.c
oldXMenu/Error.c
oldXMenu/EvHand.c
oldXMenu/FindPane.c
oldXMenu/FindSel.c
oldXMenu/InsPane.c
oldXMenu/InsSel.c
oldXMenu/Internal.c
oldXMenu/Locate.c
oldXMenu/Makefile.in
oldXMenu/Post.c
oldXMenu/Recomp.c
oldXMenu/SetAEQ.c
oldXMenu/SetFrz.c
oldXMenu/SetPane.c
oldXMenu/SetSel.c
oldXMenu/X10.h
oldXMenu/XCrAssoc.c
oldXMenu/XDelAssoc.c
oldXMenu/XDestAssoc.c
oldXMenu/XLookAssoc.c
oldXMenu/XMakeAssoc.c
oldXMenu/XMenu.h
oldXMenu/XMenuInt.h
oldXMenu/insque.c
src/.arch-inventory [deleted file]
src/.gdbinit
src/ChangeLog
src/ChangeLog.1
src/ChangeLog.10
src/ChangeLog.2
src/ChangeLog.3
src/ChangeLog.4
src/ChangeLog.5
src/ChangeLog.6
src/ChangeLog.8
src/ChangeLog.9
src/Makefile.in
src/README
src/alloc.c
src/atimer.c
src/atimer.h
src/autodeps.mk [new file with mode: 0644]
src/bidi.c [new file with mode: 0644]
src/bidimirror.h [new file with mode: 0644]
src/biditype.h [new file with mode: 0644]
src/blockinput.h
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/cm.c
src/cm.h
src/cmds.c
src/coding.c
src/coding.h
src/composite.c
src/composite.h
src/config.in
src/data.c
src/dbusbind.c
src/deps.mk [new file with mode: 0644]
src/dired.c
src/dispextern.h
src/dispnew.c
src/disptab.h
src/doc.c
src/doprnt.c
src/dosfns.c
src/dosfns.h
src/ecrt0.c [deleted file]
src/editfns.c
src/emacs-icon.h
src/emacs.c
src/eval.c
src/fileio.c
src/filelock.c
src/filemode.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/ftfont.h
src/ftxfont.c
src/getloadavg.c
src/gmalloc.c
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/lread.c
src/m/alpha.h
src/m/amdx86-64.h
src/m/arm.h
src/m/hp800.h
src/m/ia64.h
src/m/ibmrs6000.h
src/m/ibmrs6000.inp [deleted file]
src/m/ibms390.h
src/m/ibms390x.h
src/m/intel386.h
src/m/iris4d.h
src/m/m68k.h
src/m/macppc.h
src/m/mips.h
src/m/sh3.h
src/m/sparc.h
src/m/template.h
src/m/vax.h
src/m/xtensa.h
src/macros.c
src/macros.h
src/makefile.w32-in
src/marker.c
src/md5.c
src/md5.h
src/mem-limits.h
src/menu.c
src/menu.h
src/minibuf.c
src/mktime.c
src/msdos.c
src/msdos.h
src/ndir.h
src/ns.mk [new file with mode: 0644]
src/nsfns.m
src/nsfont.m
src/nsimage.m
src/nsmenu.m
src/nsselect.m
src/nsterm.h
src/nsterm.m
src/prefix-args.c [deleted file]
src/print.c
src/process.c
src/process.h
src/puresize.h
src/ralloc.c
src/regex.c
src/region-cache.c
src/region-cache.h
src/s/aix4-2.h
src/s/bsd-common.h
src/s/cygwin.h
src/s/darwin.h
src/s/freebsd.h
src/s/gnu-linux.h
src/s/gnu.h
src/s/hpux10-20.h
src/s/hpux11.h
src/s/irix6-5.h
src/s/lynxos.h [deleted file]
src/s/ms-w32.h
src/s/msdos.h
src/s/netbsd.h
src/s/openbsd.h
src/s/sol2-10.h
src/s/sol2-3.h [deleted file]
src/s/sol2-4.h [deleted file]
src/s/sol2-5.h [deleted file]
src/s/sol2-6.h
src/s/template.h
src/s/unixware.h
src/s/usg5-4-2.h [deleted file]
src/s/usg5-4-common.h [new file with mode: 0644]
src/s/usg5-4.h [deleted file]
src/scroll.c
src/search.c
src/sound.c
src/strftime.c
src/syntax.c
src/syntax.h
src/sysdep.c
src/sysselect.h
src/syssignal.h
src/systime.h
src/systty.h
src/term.c
src/termcap.c
src/termhooks.h
src/terminal.c
src/terminfo.c
src/textprop.c
src/tparam.c
src/undo.c
src/unexaix.c
src/unexalpha.c [deleted file]
src/unexcoff.c [moved from src/unexec.c with 75% similarity]
src/unexelf.c
src/unexmacosx.c
src/vm-limit.c
src/w16select.c
src/w32.c
src/w32console.c
src/w32fns.c
src/w32font.c
src/w32font.h
src/w32gui.h
src/w32heap.c
src/w32heap.h
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/w32xfns.c
src/widget.c
src/widget.h
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/xrdb.c
src/xselect.c
src/xsettings.c
src/xsettings.h
src/xsmfns.c
src/xterm.c
src/xterm.h
test/ChangeLog
test/comint-testsuite.el [new file with mode: 0644]
test/icalendar-testsuite.el
test/indent/Makefile [new file with mode: 0644]
test/indent/octave.m [new file with mode: 0644]
test/indent/prolog.prolog [new file with mode: 0644]
test/occur-testsuite.el [new file with mode: 0644]
test/redisplay-testsuite.el

diff --git a/.arch-inventory b/.arch-inventory
deleted file mode 100644 (file)
index 66aae85..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-# Generated files
-precious ^(config\.status|config\.cache)$
-
-# Install-in-place makes these directories, so just ignore them
-backup ^(bin|data|lock|site-lisp)$
-
-# arch-tag: 6eeeaa4e-cc7e-4b22-b3d7-1089e155da14
index 1d934e8e66f8b2b64ddfce267f99ad0169aded77..12b85561ee8630fb8de63f12e81fd00fc6b0d62c 100644 (file)
@@ -4,6 +4,7 @@
  (change-log-mode . ((add-log-time-zone-rule . t)
                     (fill-column . 74)
                     (bug-reference-url-format . "http://debbugs.gnu.org/%s")
-                    (mode . bug-reference))))
+                    (mode . bug-reference)))
+ (diff-mode . ((mode . whitespace))))
 
 ;; arch-tag: fb93c160-e9fe-4184-aad1-e4f5daa11cbd
index 760c452aab16bf21077fb08098d6bf9452d00523..57537b8a50354cd59c51c0332508dc428b5a967b 100644 (file)
@@ -1,6 +1,7 @@
 autom4te.cache
 makefile
 *~
+/README.W32
 
 /bin/
 /site-lisp/
index c51dced40ef1f656df1228e4905a947730469d7d..842a167e818ca709cdf742acbee077fa6ad7e47e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
+2010-08-23  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * configure.in: Fix check for librsvg, imagemagick and
+       MagickExportImagePixels.
+
+2010-08-18  Joakim Verona  <joakim@verona.se>
+
+       * Makefile.in, configure.in: Checks for ImageMagick.
+
+2010-08-10  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * configure.in (AC_PREREQ): Require autoconf 2.65.
+
+2010-08-09  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * configure.in (AC_PREREQ): Require autoconf 2.66 to stop version churn.
+
+2010-08-09  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * configure.in: Add AC_C_BIGENDIAN.
+
+2010-08-09  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * configure.in (ORDINARY_LINK): Use on hpux* too.
+
+2010-08-06  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * configure.in: Check for util.h.
+       Use -Wimplicit-function-declaration if compiler supports it.
+
+2010-08-05  Eli Zaretskii  <eliz@gnu.org>
+
+       * configure.in (UNEXEC_OBJ): Rename unexec.o => unexcoff.o.
+
+2010-08-04  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * configure.in: Restore accidentally removed use of
+       GCC_TEST_OPTIONS/NON_GCC_TEST_OPTIONS.
+
+2010-07-29  Chad Brown  <yandros@mit.edu>
+
+       * configure.in: Check for dirent.h.
+
+2010-07-29  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * configure.in: Remove reference to usg5-4, unused.
+
+2010-07-25  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * configure.in: Check for __executable_start.
+
+2010-07-24  Ken Brown  <kbrown@cornell.edu>
+
+       * configure.in (LINKER, LIB_GCC): Remove cygwin special cases (Bug#6715)
+
+2010-07-24  Juanma Barranquero  <lekktu@gmail.com>
+
+       * .bzrignore, .gitignore: Ignore README.W32 on the root directory.
+
+2010-07-24  Ken Brown  <kbrown@cornell.edu>  (tiny change)
+
+       * configure.in (START_FILES) [cygwin]: Set to pre-crt0.o (Bug#6715).
+
+2010-07-12  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * configure.in (C_WARNINGS_SWITCH, PROFILING_CFLAGS)
+       (PROFILING_LDFLAGS): Substitute, don't add them to CFLAGS/LDFLAGS.
+       (C_OPTIMIZE_SWITCH): Remove.
+       (TEMACS_LDFLAGS2): Add ${PROFILING_LDFLAGS}.
+
+2010-07-11  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * configure.in: Don't check for index and rindex, check for strchr
+       and strrchr.  Define strchr and strrchr as index and rindex,
+       resp., in src/config.h if not available.
+
+2010-07-08  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * configure.in: Use -Wold-style-definition if available.
+       This helps with the transition to standard C code, it can be
+       removed when done.
+
+       * configure.in (PRE_EDIT_LDFLAGS, POST_EDIT_LDFLAGS): Remove.
+
+       * configure.in (UNEXEC_OBJ): Add comment about values for MSDOS
+       and MSWindows.
+
+2010-07-07  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * configure.in: Don't check for bcopy, bcmp, bzero.  Don't include
+       <strings.h> and don't define bcopy, bzero, BCMP in config.h.
+
+2010-07-07  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * configure.in (getenv): Remove K&R declaration.
+
+2010-07-02  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * configure.in: Remove define __P.
+
+2010-07-02  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * configure.in (--enable-use-lisp-union-type): New flag.
+
+2010-06-30  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       Fix CFLAGS for non-GCC compilers.
+       * configure.in (CFLAGS): Always use -g like it was done before the
+       2010-03-30 change.
+       (REAL_CFLAGS): Use CFLAGS for non-GCC to get optimization flags.
+       (Bug#6538)
+
+2010-06-30  Glenn Morris  <rgm@gnu.org>
+
+       * configure.in (HAVE_SOUND, HAVE_X_I18N, HAVE_X11R6_XIM):
+       Set with AC_DEFINE rather than AH_BOTTOM.
+
+       * configure.in (C_OPTIMIZE_SWITCH, CANNOT_DUMP, SYSTEM_MALLOC):
+       (USE_MMAP_FOR_BUFFERS, C_WARNING_SWITCH, CFLAGS, REAL_CFLAGS):
+       Set with shell, not cpp.
+       (LIBX): Remove, just use -lX11 in the one place this was used.
+       (cannot_dump): Replace with CANNOT_DUMP.
+
+2010-06-28  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * configure.in: Add --with-x-toolkit=gtk3. Remove HAVE_GTK_MULTIDISPLAY,
+       check for gtk_file_chooser_dialog_new, and HAVE_GTK_FILE_BOTH (implied
+       by minimum required Gtk+ 2.6).  Add checks for functions introduced
+       in Gtk+ 2.14 or newer (bug#6505).
+
+2010-06-26  Eli Zaretskii  <eliz@gnu.org>
+
+       * config.bat: Remove white space around "+" in COPY commands.
+
 2010-06-23  Glenn Morris  <rgm@gnu.org>
 
        * info/dir: Start descriptions in column 32, per Texinfo convention.
 
-2010-06-12  Chong Yidong  <cyd@stupidchicken.com>
+2010-06-16  Chong Yidong  <cyd@stupidchicken.com>
 
        * INSTALL: Update font information (Bug#6389).
 
-2010-06-10  Glenn Morris  <rgm@gnu.org>
+2010-06-16  Glenn Morris  <rgm@gnu.org>
 
        * INSTALL: General update.
 
+2010-06-12  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (install-arch-indep): Delete any old info .gz files first.
+
+2010-06-11  Glenn Morris  <rgm@gnu.org>
+
+       * configure.in (--without-compress-info): New option.
+       (GZIP_INFO): New output variable.
+
+       * Makefile.in (GZIP_INFO): New, set by configure.
+       (install-arch-indep): Don't gzip info pages if GZIP_INFO is nil.
+       Handle man pages in the same way.
+
+2010-06-10  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (install-arch-indep): Gzip the info files too.
+
+       * make-dist: Remove references to non-existent directories and files.
+
+2010-06-08  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * configure.in: Include <strings.h> and <string.h> instead of
+       "strings.h" and "string.h".
+
+2010-06-06  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * configure.in: Remove code dealing with BSTRING.
+
+2010-06-03  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * configure.in (AC_PREREQ): Require autoconf 2.65.
+
+       * configure.in (unxec): Do not define and substitute.
+       (UNEXEC_OBJ): New output variable, replaces cpp UNEXEC.
+
+2010-06-03  Glenn Morris  <rgm@gnu.org>
+
+       * configure.in (AH_BOTTOM): Remove NOT_C_CODE test, it is always true.
+
+2010-06-02  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       Fix alloca definition when using gcc on non-gnu systems.
+       * configure.in: Use the code sequence indicated by "info autoconf"
+       for alloca (bug#6170).
+
 2010-05-30  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * .bzrignore: Ignore new files from trunk, which appear if you use
        colocated branches (i.e. "bzr switch").
 
-2010-05-10  Miles Bader  <miles@gnu.org>
+2010-05-28  Glenn Morris  <rgm@gnu.org>
 
-       * configure.in: Get rid of "unix" pre-defined macro when
-       preprocessing Makefile.  (Bug#5857)  [Backport from trunk]
+       * configure.in: Simplify some of the $canonical tests.
 
-2010-05-07  Chong Yidong  <cyd@stupidchicken.com>
+2010-05-27  Glenn Morris  <rgm@gnu.org>
 
-       * Version 23.2 released.
+       * config.bat: Do not preprocess src/Makefile.in.
+
+       * configure.in: Do not preprocess src/Makefile.in.
+       (cpp_undefs, CPP_NEED_TRADITIONAL): Remove.
+       (AC_EGREP_CPP): Test no longer needed.
+
+       * make-dist: No more Makefile.c files.
+
+2010-05-26  Glenn Morris  <rgm@gnu.org>
+
+       * configure.in (YMF_PASS_LDFLAGS): Remove.
+       (PRE_EDIT_LDFLAGS, POST_EDIT_LDFLAGS): New output variables.
+
+       * configure.in (CPPFLAGS, CFLAGS, REAL_CFLAGS):
+       Add $GNUSTEP_LOCAL_HEADERS.
+       (LDFLAGS, LD_SWITCH_SYSTEM_TEMACS): Add $GNUSTEP_LOCAL_LIBRARIES.
+
+       * configure.in (NS_IMPL_GNUSTEP_INC, NS_IMPL_GNUSTEP_TEMACS_LDFLAGS)
+       (GNUSTEP_MAKEFILES): Remove.
+       (LD_SWITCH_SYSTEM_TEMACS): Move NS_IMPL_GNUSTEP_TEMACS_LDFLAGS
+       stuff to here.
+
+2010-05-25  Glenn Morris  <rgm@gnu.org>
+
+       * configure.in (LD_SWITCH_SYSTEM): Move some gnu-linux stuff...
+       (LD_SWITCH_SYSTEM_TEMACS): ... to here.
+
+       * configure.in (LD_SWITCH_SYSTEM_EXTRA): Remove.
+       (LD_SWITCH_SYSTEM_TEMACS): Put darwin stuff from LD_SWITCH_SYSTEM_EXTRA
+       here instead.
+
+2010-05-24  Romain Francoise  <romain@orebokech.com>
+
+       * make-dist: Look for version in src/emacs.c.
+       Use lisp/subr.el rather than lisp/version.el for location check.
+
+2010-05-21  Glenn Morris  <rgm@gnu.org>
+
+       * configure.in (MKDEPDIR): Parallel build tweak.
+
+       * configure.in (ns_frag): New output file.
+
+       * configure.in (OLDXMENU): Set to "nothing" if !HAVE_X11 || USE_GTK.
+       (OLDXMENU_TARGET): Set to empty if USE_GTK.
+
+       * configure.in (cannot_dump): New output variable.
+
+2010-05-20  enami tsugutomo  <tsugutomo.enami@jp.sony.com>
+
+       * configure.in: On NetBSD, if terminfo is found, use it in
+       preference to termcap.  (Bug#6190)
+
+2010-05-20  Glenn Morris  <rgm@gnu.org>
+
+       * make-dist (src): Include *.mk.
+       * config.bat: Concatenate deps.mk onto the end of src/Makefile.
+       * configure.in (DEPFLAGS, MKDEPDIR): New output variables.
+       (deps_frag): New output file.
+       (AUTO_DEPEND): Remove this definition.
+
+       * configure.in (--with-gtk, --with-gcc): Remove option stubs.
+
+2010-05-19  Glenn Morris  <rgm@gnu.org>
+
+       * configure.in (LINKER, YMF_PASS_LDFLAGS): New output variables.
+       (ORDINARY_LINK): New AC_DEFINE.
+       (LIB_GCC): No need to set if ORDINARY_LINK.
+
+2010-05-18  Glenn Morris  <rgm@gnu.org>
+
+       * configure.in (POST_ALLOC_OBJ) [cygwin]: Omit vm-limit.o.
+       (POST_ALLOC_OBJ) [!cygwin]: Set to empty.
+
+       * config.bat (RALLOC_OBJ): Edit to empty if sys_malloc.
+       * configure.in (REL_ALLOC): Unset on gnu, gnu-linux if DOUG_LEA_MALLOC.
+       (RALLOC_OBJ): New output variable.
+
+       * config.bat (GMALLOC_OBJ, VMLIMIT_OBJ): Edit to empty if sys_malloc.
+       * configure.in (GMALLOC_OBJ, VMLIMIT_OBJ): New output variables.
+
+2010-05-17  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * Makefile.in (src): Provide the name of the VCS file that witnesses
+       a pull.
+       ($(srcdir)/src/config.in): Handle accidental removal of src/config.in.
+
+2010-05-17  Glenn Morris  <rgm@gnu.org>
+
+       * configure.in (OLDXMENU_DEPS): New output variable.
+
+2010-05-16  Glenn Morris  <rgm@gnu.org>
+
+       * configure.in (ns_appbindir, ns_appresdir): Set using $ns_appdir.
+
+       * configure.in (ns_appdir, ns_appbindir): Add trailing "/" to value.
+       * Makefile.in (install-arch-dep): Update for above change.
+
+       * Makefile.in (ns_appdir): Remove.
+       (install-arch-dep): Test $ns_appresdir instead of $ns_appdir.
+
+       * configure.in (TEMACS_LDFLAGS2): New output variable.
+
+       * configure.in (NS_IMPL_GNUSTEP_TEMACS_LDFLAGS): New output variable.
+       (START_FILES): Set to empty if NS_IMPL_GNUSTEP.
+       (GNUSTEP_SYSTEM_HEADERS, GNUSTEP_SYSTEM_LIBRARIES): Do not output,
+       nothing uses.
+
+2010-05-16  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * configure.in: Remove references to usg5-4 and bsd-common, $opsys
+       does not use them.
+       (X11R5_INHIBIT_I18N): Remove, unused.
+
+2010-05-15  Glenn Morris  <rgm@gnu.org>
+
+       * configure.in (LIBXMENU): Set to empty if !HAVE_X_WINDOWS.
+
+       * configure.in (FONT_OBJ): Set to empty if !HAVE_X_WINDOWS.
+
+2010-05-15  Ken Raeburn  <raeburn@raeburn.org>
 
-2010-05-03  Štěpán Němec  <stepnem@gmail.com>  (tiny change)
+       * configure.in: Look for version string in its new location.
+
+2010-05-15  Eli Zaretskii  <eliz@gnu.org>
+
+       * config.bat: Remove support for DJGPP v1.x.
+
+2010-05-15  Glenn Morris  <rgm@gnu.org>
+
+       * configure.in (OLDXMENU_TARGET): New output variable.
+
+       * Makefile.in (install-arch-dep): Update odd NS rule for Emacs version.
+
+       * Makefile.in (install-arch-indep): Remove references to RCS, CVS,
+       and other files that no longer exist.
+
+2010-05-14  Glenn Morris  <rgm@gnu.org>
+
+       * configure.in (cpp_undefs): Add mktime, register, X11.
+
+       * configure.in (GPM_MOUSE_SUPPORT): Remove.
+       (MOUSE_SUPPORT, TOOLTIP_SUPPORT, WINDOW_SUPPORT): New output variables.
+       (HAVE_WINDOW_SYSTEM, HAVE_MOUSE): Move out of AC_BOTTOM.
+
+       * configure.in (NS_IMPL_GNUSTEP_INC): New output variable.
+       (GNUSTEP_MAKEFILES): Do not output.
+
+2010-05-13  Glenn Morris  <rgm@gnu.org>
+
+       * configure.in: Fix some paren typos.
+
+       * configure.in (OLDXMENU, LIBXMENU): Set to empty if !HAVE_MENUS.
+
+       * configure.in (LD_SWITCH_X_SITE, C_SWITCH_X_SITE): Do not define.
+
+2010-05-12  Glenn Morris  <rgm@gnu.org>
+
+       * configure.in (LIB_SRC_EXTRA_INSTALLABLES): Remove, unused.
+
+       * configure.in (LIB_GCC): New output variable.
+
+2010-05-11  Glenn Morris  <rgm@gnu.org>
+
+       * make-dist (msdos): No more mainmake.
+
+       * configure.in: Generate lib-src/Makefile directly, do not run cpp.
+       * config.bat: Do not run cpp on lib-src/Makefile.in.
+
+       * config.bat [HAVE_X11]: Run sed3x.inp on lib-src/Makefile.
+
+2010-05-10  Glenn Morris  <rgm@gnu.org>
+
+       * configure.in (LIBS_SYSTEM): New output variable, replacing cpp.
+
+       * configure.in (MAIL_USE_FLOCK, MAIL_USE_LOCKF): New AC_DEFINEs.
+       (BLESSMAIL_TARGET): New output variable.
+
+2010-05-08  Štěpán Němec  <stepnem@gmail.com>  (tiny change)
 
        * INSTALL: Fix typos.
 
-2010-05-03  Chong Yidong  <cyd@stupidchicken.com>
+2010-05-08  Chong Yidong  <cyd@stupidchicken.com>
 
        * configure.in: Add check for buggy version of GCC (Bug#6031).
 
+2010-05-08  Glenn Morris  <rgm@gnu.org>
+
+       * configure.in (HAVE_LIBNCURSES): New local variable.
+       (TERMINFO, LIBS_TERMCAP, TERMCAP_OBJ): New output variables,
+       replacing cpp in src/s/*.h and src/Makefile.in.
+
+2010-05-07  Chong Yidong  <cyd@stupidchicken.com>
+
+       * Version 23.2 released.
+
+2010-05-07  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * configure.in: Add tests for `isnan' and `copysign'.
+
+2010-05-07  Eli Zaretskii  <eliz@gnu.org>
+
+       * config.bat: Allow for 2 leading `#'s in comments in
+       src/Makefile.in.
+
+2010-05-07  Glenn Morris  <rgm@gnu.org>
+
+       * configure.in (LD_SWITCH_SYSTEM): Set with configure, not cpp.
+       Merges logic from src/s/* and src/Makefile.in.
+       (LD_SWITCH_SYSTEM_TEMACS): New output variable.
+
+2010-05-07  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       Define START_FILES and LIB_STANDARD using autoconf.
+       * configure.in (START_FILES, LIB_STANDARD): New definitions, moved
+       here from src/s/*.h.
+       (HAVE_CRTIN): Remove, inline logic in the netbsd
+       START_FILES/LIB_STANDARD computation.
+
+2010-05-06  Glenn Morris  <rgm@gnu.org>
+
+       * configure.in (AC_PROG_LN_S): Remove test, nothing uses @LN_S@.
+
+       * Makefile.in (CPP, C_SWITCH_SYSTEM, ALLOCA, LN_S, C_SWITCH_X_SITE)
+       (LD_SWITCH_X_SITE): Remove unused variables.
+
+2010-05-04  Glenn Morris  <rgm@gnu.org>
+
+       * configure.in (LD_SWITCH_X_SITE_AUX): Use AC_SUBST only, not AC_DEFINE
+       as well.
+       (LD_SWITCH_X_SITE_AUX_RPATH): New output variable.
+
+       * configure.in (LD_SWITCH_SYSTEM_TEMACS): New output variable.
+
+       * configure.in (C_SWITCH_MACHINE, C_SWITCH_SYSTEM): New output
+       variables, replacing c_switch_machine, c_switch_system.
+       * Makefile.in (C_SWITCH_SYSTEM): Use @C_SWITCH_SYSTEM@ rather than
+       @c_switch_system@.
+
+2010-05-03  Glenn Morris  <rgm@gnu.org>
+
+       * configure.in (LIBXT_OTHER, LIBX_OTHER): New output variables.
+
+       * make-dist: There are no more src/m/*.inp files.
+
+2010-05-01  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * configure.in (LD_SWITCH_MACHINE, ld_switch_machine): Remove, unused.
+       (ac_link): Do not use ld_switch_machine.
+
+2010-05-01  Glenn Morris  <rgm@gnu.org>
+
+       * configure.in (OTHER_OBJ): Remove.
+       (PRE_ALLOC_OBJ, POST_ALLOC_OBJ): New output variables.
+
+2010-04-30  Glenn Morris  <rgm@gnu.org>
+
+       * configure.in (OTHER_OBJ): Always include vm-limit.o on Cygwin.
+       Elsewhere, maybe include it.
+
+       * configure.in (TOOLKIT_LIBW) [HAVE_GTK]: Set to $GTK_LIBS.
+       (OLDXMENU, LIBXMENU): New output variables.
+
+       * configure.in (OTHER_OBJ): New output variable.
+
+2010-04-28  Glenn Morris  <rgm@gnu.org>
+
+       * configure.in (CYGWIN_OBJ): New output variable.
+
+       * configure.in (GPM_MOUSE_SUPPORT): New output variable.
+
+       * configure.in (FONT_OBJ): New output variable.
+
+       * configure.in (LIBXMU): New output variable.
+
+       * configure.in (NS_OBJ, NS_SUPPORT): New output variables.
+
+       * configure.in (machine, canonical): On amdx86-64, check for a 32-bit
+       userland and maybe change values to i386 (move test from s/amdx86-64.h).
+
+2010-04-27  Glenn Morris  <rgm@gnu.org>
+
+       * configure.in (LIBXTR6): New output variable.  Move unixware special
+       case here from src/s/unixware.h.
+
+       * configure.in (LUCID_LIBW, MOTIF_LIBW): No longer substitute
+       in Makefiles.
+       (TOOLKIT_LIBW): New output variable, replacing LUCID_LIBW/MOTIF_LIBW.
+
+       * configure.in (HAVE_MOTIF_2_1): Remove unused variable.
+       (LIBXP): No longer substitute in Makefiles.
+       (MOTIF_LIBW): New output variable.  Move system-specific settings here
+       from src/s files.
+
+2010-04-27  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       Reduce CPP usage.
+       * configure.in (LIB_X11_LIB): Remove, inline in the only user.
+       (unexec): Define unconditionally, all platforms define
+       UNEXEC.  AC_SUBST it.
+       (UNEXEC_SRC): Remove, unused.
+       (C_SWITCH_X_SYSTEM): Define using autoconf, not cpp.
+
+2010-04-27  Glenn Morris  <rgm@gnu.org>
+
+       * configure.in (HAVE_MOTIF_2_1, HAVE_LIBXP): Remove unused AC_DEFINEs,
+       replaced by LIBXP.
+
+       * configure.in (--with-crt-dir): Doc fix (now valid for all platforms).
+       (CRT_DIR): On (powerpc64|sparc64)-*-linux-gnu*, default to /usr/lib64.
+       On hpux10-20, default to /lib.
+
+       * configure.in (LUCID_LIBW, LIBXP, WIDGET_OBJ): New output variables.
+
+2010-04-26  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * configure.in (LIBS_MACHINE): Remove, unused.
+
+       * configure.in (LIB_MATH): New output variable.  Set it for some systems.
+
+2010-04-24  Glenn Morris  <rgm@gnu.org>
+
+       * configure.in (CRT_DIR): New output variable.
+       (--with-crt-dir): New option.  (Bug#5655)
+       (HAVE_LIB64_DIR): Remove.
+
+2010-04-22  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * configure.in (REAL_CFLAGS, CFLAGS): Restore -g for gcc.
+
+2010-04-22  Miles Bader  <miles@gnu.org>
+
+       * configure.in: Get rid of "unix" pre-defined macro when
+       preprocessing Makefile.  (Bug#5857)
+
+2010-04-21  Andreas Schwab  <schwab@linux-m68k.org>
+
+       Avoid non-portable shell command negation
+       * configure.in: Revert last change.
+
+2010-04-21  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * configure.in: Change "if test ! -f" to "if ! test -f".
+
+2010-04-21  Glenn Morris  <rgm@gnu.org>
+
+       * configure.in (LIBSELINUX_LIBS): Always substitute in Makefiles.
+       (GTK_OBJ, DBUS_OBJ, LIBXSM, XMENU_OBJ, XOBJ): New output variables.
+
+2010-04-21  Karel Klíč  <kklic@redhat.com>
+
+       * configure.in: New option: --with(out)-selinux, on by default.
+       Set HAVE_LIBSELINUX if we find libselinux, and substitute
+       LIBSELINUX_LIBS in Makefiles.
+
+2010-04-01  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * configure.in: Remove all references to LIBX11_SYSTEM.
+
+2010-03-30  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * configure.in: Remove all references to C_DEBUG_SWITCH.
+
+2010-03-27  Eli Zaretskii  <eliz@gnu.org>
+
+       * config.bat <lib-src>: Edit out lines that begin with several #
+       characters.
+
+2010-03-20  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * configure.in: Remove support for old UNIX System V systems and
+       for Unixware on non-x86 machines.
+
+       * configure.in: Remove support for Solaris on PPC and for old versions.
+
+       * configure.in: Remove non-working lynxos port.
+
+2010-03-19  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * .dir-locals.el (c-mode): Turn on whitespace-mode for diff-mode.
+
+2010-03-19  Glenn Morris  <rgm@gnu.org>
+
+       * configure.in (HAVE_LIBNCURSES): Add a description to make autoheader
+       happy.
+
+2010-03-18  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * configure.in: Check for tputs and friends, abort if not
+       found (bug#5735).
+
+2010-03-18  Glenn Morris  <rgm@gnu.org>
+
+       * configure.in (--with-x-toolkit): In the help text, say which options
+       are synonyms.
+
+       * configure.in (--with-mmdf, --with-mail-unlink):
+       New options, off by default.
+       (--with-mailhost): New option to set default POP host.
+       (LIBXPM, LIBJPEG, LIBPNG, LIBTIFF, LIBGIF, LIBGPM, LIBS_MAIL)
+       (LIBHESIOD, LIBRESOLV, COM_ERRLIB, CRYPTOLIB, KRB5LIB, DESLIB, KRB4LIB):
+       New variables, substituted in Makefiles.
+       (try_libungif, ac_gif_lib_name): Replace with HAVE_GIF=maybe, LIBGIF.
+       (LIBGIF): Use AC_SUBST rather than AC_DEFINE.
+       (HAVE_LIBMAIL, HAVE_LIBLOCKFILE, HAVE_LIBCOM_ERR, HAVE_LIBCRYPTO)
+       (HAVE_LIBK5CRYPTO, HAVE_LIBKRB5, HAVE_LIBDES425, HAVE_LIBDES)
+       (HAVE_LIBKRB4, HAVE_LIBKRB): New AC_DEFINEs.
+
+2010-03-18  Tetsurou Okazaki  <okazaki@be.to>  (tiny change)
+
+       * Makefile.in (uninstall): Handle the case where archlibdir does not
+       exist.  (Bug#5720)
+
+2010-03-12  Eli Zaretskii  <eliz@gnu.org>
+
+       These changes remove termcap.c from the build on Posix platforms.
+       * configure.in <AC_CHECK_HEADERS>: Remove termcap.h.
+
+       * configure: Regenerated.
+
+2010-03-10  Chong Yidong  <cyd@stupidchicken.com>
+
+       * Branch for 23.2.
+
 2010-01-31  Juri Linkov  <juri@jurta.org>
 
        * .bzrignore: Add TAGS-LISP.
 
        Update copyright year(s) in many files.
 
+2006-04-01  Eli Zaretskii  <eliz@gnu.org>
+
+       * configure: Regenerated.
+
 2006-04-01  Emanuele Giaquinta  <emanuele.giaquinta@gmail.com>  (tiny change)
 
        * configure.in (HAVE_XAW3D): Disable Xaw3d check if
        * make-dist: Unset EMACS_UNIBYTE, so Emacs runs in its default state.
        Quote $EMACS, in case it's a program with args.
 
+1999-06-15  Gerd Moellmann  <gerd@gnu.org>
+
+       * configure.in (HAVE_GIF): Use libungif instead of libgif
+       because the former doesn't contain patented compression code.
+
 1999-05-29  Richard M. Stallman  <rms@gnu.org>
 
        * configure.in: Delete the Kerberos stuff.
 1994-05-09  David J. MacKenzie  (djm@nutrimat.gnu.ai.mit.edu)
 
        * configure.in: Remove AC_LANG_C call.  Not needed with Autoconf
-        version > 1.8.
+       version > 1.8.
 
 1994-05-08  Morten Welinder  (terra@diku.dk)
 
        (EMACSROOT): New variable, giving the directory under which all of
        Emacs's libraries should be installed.  Changed rest of file to
        use it.
-       (LIBDIR): Now denotes only architecture-dependent dir - relevant cha
+       (LIBDIR): Now denotes only architecture-dependent dir.
        (DATADIR): New variable, denoting architecture-independent dir.
        (LOCKDIR): New variable, for completeness.
        (SUBDIR): No more etc, new lib-src.
diff --git a/INSTALL b/INSTALL
index 005aac08d87f82248da9ac00091d15bed83eb7cc..5f4b9e54d050b7291a0e2d11240245e1c77e5071 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -105,8 +105,7 @@ sections if you need to.
 
   Note that the install automatically saves space by compressing
   (provided you have the `gzip' program) those installed Lisp source (.el)
-  files that have corresponding .elc versions.  You may also wish
-  to compress the installed Info files.
+  files that have corresponding .elc versions, as well as the Info files.
 
 
 ADDITIONAL DISTRIBUTION FILES
@@ -659,13 +658,7 @@ you need to override any of the definitions in the s/*.h and m/*.h
 files for your system and machine, do so by editing config.h, not by
 changing the s/*.h and m/*.h files.
 
-3) Create src/Makefile and lib-src/Makefile from the corresponding
-`Makefile.in' files.  First copy `Makefile.in' to `Makefile.c',
-then edit in appropriate substitutions for the @...@ constructs,
-and then copy the shell commands near the end of `configure'
-that run cpp to construct `Makefile'.
-
-4) Create `Makefile' files in various other directories from the
+3) Create `Makefile' files in various directories from the
 corresponding `Makefile.in' files.  This isn't so hard, just a matter
 of editing in appropriate substitutions for the @...@ constructs.
 
index 4c869cebf8367b40c990d779b4b07102d0bef47f..d7e08a2328f948e62e006196673a785089c92fd1 100644 (file)
@@ -69,15 +69,9 @@ CDPATH=
 # ==================== Things `configure' Might Edit ====================
 
 CC=@CC@
-CPP=@CPP@
-C_SWITCH_SYSTEM=@c_switch_system@
-ALLOCA=@ALLOCA@
-LN_S=@LN_S@
 CFLAGS=@CFLAGS@
 LDFLAGS=@LDFLAGS@
 CPPFLAGS=@CPPFLAGS@
-C_SWITCH_X_SITE=@C_SWITCH_X_SITE@
-LD_SWITCH_X_SITE=@LD_SWITCH_X_SITE@
 EXEEXT=@EXEEXT@
 MAKEINFO=@MAKEINFO@
 
@@ -170,7 +164,6 @@ VPATH=@srcdir@
 x_default_search_path=@x_default_search_path@
 
 # Location to install Emacs.app under NeXT/Open/GNUstep / Cocoa
-ns_appdir=@ns_appdir@
 ns_appbindir=@ns_appbindir@
 ns_appresdir=@ns_appresdir@
 
@@ -250,6 +243,8 @@ INSTALL_STRIP =
 
 # We use gzip to compress installed .el files.
 GZIP_PROG = @GZIP_PROG@
+# If non-nil, gzip the installed Info and man pages.
+GZIP_INFO = @GZIP_INFO@
 
 # ============================= Targets ==============================
 
@@ -286,6 +281,9 @@ all: ${SUBDIR} leim
 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
+# 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}` ;            \
          buildlisppath=`echo ${buildlisppath} | ${removenullpaths}` ;  \
@@ -342,9 +340,13 @@ src: Makefile FRC
              CC='${CC}' CFLAGS='${CFLAGS}' CPPFLAGS='${CPPFLAGS}'         \
              LDFLAGS='${LDFLAGS}' MAKE='${MAKE}' BOOTSTRAPEMACS="$$boot"; \
        fi;
+       if [ -r .bzr/checkout/dirstate ]; then                  \
+           vcswitness="$$(pwd)/.bzr/checkout/dirstate";        \
+       fi;                                                     \
        cd $@; $(MAKE) all $(MFLAGS)                           \
          CC='${CC}' CFLAGS='${CFLAGS}' CPPFLAGS='${CPPFLAGS}' \
-         LDFLAGS='${LDFLAGS}' MAKE='${MAKE}' BOOTSTRAPEMACS=""
+         LDFLAGS='${LDFLAGS}' MAKE='${MAKE}' BOOTSTRAPEMACS="" \
+         VCSWITNESS="$$vcswitness"
 
 blessmail: Makefile src FRC
        cd lib-src; $(MAKE) maybe-blessmail $(MFLAGS) \
@@ -376,7 +378,11 @@ $(srcdir)/configure: $(AUTOCONF_INPUTS)
        cd ${srcdir} && autoconf
 
 $(srcdir)/src/config.in: $(srcdir)/src/stamp-h.in
-       @true
+       @ # Usually, there's no need to rebuild src/config.in just
+       @ # because stamp-h.in has changed (since building stamp-h.in
+       @ # refreshes config.in as well), but if config.in is missing
+       @ # then we really need to do something more.
+       [ -r "$@" ] || ( cd ${srcdir} && autoheader )
 $(srcdir)/src/stamp-h.in: $(AUTOCONF_INPUTS)
        cd ${srcdir} && autoheader
        rm -f $(srcdir)/src/stamp-h.in
@@ -424,17 +430,22 @@ install-arch-dep: mkdir
            ${INSTALL_DATA} lib-src/$$f $(DESTDIR)${archlibdir}/$$f; \
          else true; fi ; \
        done
-       if test "${ns_appdir}" != ""; then \
+       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}/libexec ; dir=emacs/*/*/* ; $(MV_DIRS); \
+         ( cd ${ns_appbindir}libexec ; dir=emacs/*/*/* ; $(MV_DIRS); \
            rm -fr emacs ) ; \
-         ( cd ${ns_appbindir}/bin ; rm -f emacs emacs-23* ; \
+         ( cd ${ns_appbindir}bin ; rm -f emacs emacs-24* ; \
            ln -sf ../libexec/* .) ; \
        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.
+
 ## 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.
 set_installuser=for installuser in $${LOGNAME} $${USERNAME} $${USER} \
@@ -482,11 +493,8 @@ install-arch-indep: mkdir info install-etc
                | (cd $${dest}; umask 022; \
                    tar -xvf - && cat > /dev/null) || exit 1; \
              find $${dest} -exec chown $${installuser} {} ';' ;\
-             for subdir in `find $${dest} -type d ! -name RCS ! -name CVS -print` ; do \
+             for subdir in `find $${dest} -type d -print` ; do \
                chmod a+rx $${subdir} ; \
-               rm -rf $${subdir}/RCS ; \
-               rm -rf $${subdir}/CVS ; \
-               rm -f  $${subdir}/.cvsignore ; \
                rm -f  $${subdir}/.gitignore ; \
                rm -f  $${subdir}/.arch-inventory ; \
                rm -f  $${subdir}/.DS_Store ; \
@@ -498,7 +506,6 @@ install-arch-indep: mkdir info install-etc
                 rm -f $${subdir}/[mM]akefile*.c $${subdir}/[mM]akefile*[.-]in \
                   $${subdir}/[mM]akefile ; \
                rm -f  $${subdir}/ChangeLog* ; \
-               rm -f  $${subdir}/dired.todo ; \
              done) ; \
        done
        -rm -f $(DESTDIR)${lispdir}/subdirs.el
@@ -575,6 +582,10 @@ install-arch-indep: mkdir info install-etc
              for f in `ls $$elt $$elt-[1-9] $$elt-[1-9][0-9] 2>/dev/null`; do \
                ${INSTALL_DATA} $$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; \
              done; \
           done); \
        else true; fi
@@ -594,7 +605,11 @@ install-arch-indep: mkdir info install-etc
        for page in ${MAN_PAGES}; do \
          (cd $${thisdir}; \
           ${INSTALL_DATA} ${mansrcdir}/$${page} $(DESTDIR)${man1dir}/$${page}; \
-          chmod a+r $(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 ); \
        done
 
 ## Install those items from etc/ that need to end up elsewhere.
@@ -667,7 +682,9 @@ uninstall:
            esac ;                                      \
          fi ;                                          \
        done
-       (cd $(DESTDIR)${archlibdir} && rm -f fns-*)
+       if [ -d $(DESTDIR)${archlibdir} ]; then \
+         (cd $(DESTDIR)${archlibdir} && rm -f fns-*) \
+       fi
        -rm -rf $(DESTDIR)${libexecdir}/emacs/${version}
        (cd $(DESTDIR)${infodir} && \
          for elt in $(INFO_FILES); do \
diff --git a/README b/README
index 7c48684c6dcc46873aa45498db64b989cdda2a05..2ccd5d7cb0db74a8926ccd54350c0256c44ccaf0 100644 (file)
--- a/README
+++ b/README
@@ -3,7 +3,7 @@ Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
 See the end of the file for license conditions.
 
 
-This directory tree holds version 23.2.50 of GNU Emacs, the extensible,
+This directory tree holds version 24.0.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
diff --git a/README.imagemagick b/README.imagemagick
new file mode 100644 (file)
index 0000000..792e9fd
--- /dev/null
@@ -0,0 +1,151 @@
+* README for the ImageMagick Emacs branch
+
+This is the imagemagick branch of Emacs. Imagemagick can now be used
+to load many new image formats, and also do useful transforms like
+scaling and rotation.
+
+This file will attempt to contain draft NEWS, Changelog and manual
+entries for the new functionality. 
+
+You might need to regenerate the configure scripts:
+aclocal
+automake
+autoheader
+autoconf
+./configure --with-imagemagick
+
+
+* TODO  image-type-header-regexps priorities the jpeg loader over the
+imagemagick one. This is not wrong, but how should a user go about
+prefering the imagemagick loader? The user might like zooming etc in
+jpegs. 
+
+try (setq image-type-header-regexps nil) for a quick hack to prefer
+imagemagick over the jpg loader.
+
+* TODO  For some reason its unbearably slow to look at a page in a large
+  image bundle using the :index feature. The imagemagick "display"
+  command is also a bit slow, but nowhere near as slow as the emacs
+  code. It seems imagemagick tries to unpack every page when loading
+  the bundle. This feature is not the primary usecase for the
+  imagemagick patch though.
+
+  ImageMagick 6.6.2-9 introduced a bugfix for single page djvu load.
+  It is now way faster to use the :index feature, but its still not
+  very fast.
+
+** DONE optimize number of pages calculation for bundles as suggested by
+  imagemagick forum: "set the density to something low like 2 and use
+  MagickPingImage()"
+  
+** TODO try to cache the num pages calculation. it can take a while to
+  calculate the number of pages, and if you need to do it for each
+  page view, page-flipping becomes uselessly slow.
+
+* TODO integrate with image-dired
+
+* TODO integrate with docview. 
+  
+* TODO integrate with image-mode
+Some work has been done, M-x image-transform-fit-to-height will fit
+the image to the height of the Emacs window for instance.
+
+* TODO look for optimizations for handling images with low depth
+Currently the code seems to default to 24 bit RGB which is costly for
+images with lower bit depth.
+
+* TODO complete documentation drafts below
+
+* DONE fix inconsistencys with spelling of imagemagick in the src
+* DONE report number of images in image bundle types somehow
+Works like for "gif" support. Thanks to Juri Linkov.
+* DONE probably add pdf to inhibited types
+* DONE inhibit types is defconst should probably be defcustom
+* TODO decide what to do with some uncommitted imagemagick support
+  functions for image size etc.
+* TODO Test with more systems
+Tested on Fedora 12, Fedora 14 so far, and the libmagick that ships with it.
+Ubuntu 8.04 was also tested, but it seems it ships a broken
+ImageMagick.
+
+I also tried using an imagemagick compiled from their SVN, in
+parallell with the one packaged by Fedora, it worked well.
+
+* DONE Also need some way to handle render methods that only work on newer ImageMagicks
+Is handled by configure now
+
+* Some nits from Stefan Monnier
+I just took a quick look at the code and I see the following nits to fix:
+
+** DONE obviously a merge will have to come with a good ChangeLog.
+** DONE also the merge will need to come with documentation.  Maybe not in the
+   Texinfo form yet, but at least in the etc/NEWS with enough info that
+   describes the `scale' and other such arguments that someone can start
+   using them.
+** DONE the README talks about naming inconsistencies, I think these should be
+  fixed before a first commit (should be straightforward).
+
+** DONE the "let" in image.el should not be followed by a line break and the while
+   should be replaced by a dolist.
+
+** DONE the prototype of imagemagick_load_image has some odd indentation in ([[2010.06.14]])
+   its args, not sure what happened.
+** DONE a few lines in the C code break the 80columns limit.
+** DONE please use ANSI style function declarations rather than K&R for new code. ([[2010.06.14]])
+** DONE you can get rid of the prototypes by reordering the code. ([[2010.06.14]])
+** DONE the docstrings in DEFUN should not be indented (they'll display ([[2010.06.14]])
+   weirdly otherwise in C-h f).
+** DONE Some "{" are at the end of a for/if rather than on their own line. ([[2010.06.14]])
+** DONE why use "*( imtypes + i)" rather than "imtypes[i]"? ([[2010.06.14]])
+** DONE some "," lack a space after them. ([[2010.06.14]])
+** DONE several "=" and "==" lack spaces around them. ([[2010.06.14]])
+  
+
+* NEWS entry
+** ImageMagick support
+It is now possible to use the Imagemagick library to load many new
+image formats in Emacs.
+
+To enable, use the following configure option:
+--with-imagemagick
+
+The new function (imagemagick-types) returns a list of image file
+extensions that your installation of imagemagick supports.
+
+The function (imagemagick-register-types) will enable the imagemagick
+support for the extensions in imagemagick-types minus the types listed
+in imagemagick-types-inhibit.
+
+imagemagick-types-inhibit has the value  '(C HTML HTM TXT PDF) by default.
+This means imagemagick will be used also to load jpeg files, if you
+have both jpeg and imagemagick libraries linked. Add 'JPG to
+imagemagick-types-inhibit if you do not want this.
+
+imagemagick-render-type is a new variable which can be set to choose
+between screen render methods.
+
+- 0 is a conservative metod which works with older ImageMagick
+  versions. It is a bit slow, but robust.
+
+- 1 utilizes a newer ImageMagick method   
+
+
+Images loaded with imagemagick will support a couple of new display
+specification behaviours:
+
+- if the :width and :height keywords are specified, these values are
+used for scaling the image. If only one of :width or :height is
+specified, the other one will be calculated so as to preserve the
+aspect ratio.If both :width and :height are specified, aspect ratio
+will not be preserved.
+
+- :rotation specifies a rotation angle in degrees.
+
+- :index specifies which image inside an image bundle file format, such
+as TIFF or DJVM, to view.
+
+The image-metadata function can be used to retrieve the total number
+of images in an image bundle. This is simmilar to how GIF files work.
+
+* Manual entry
+nothing yet, but the NEWS entry could be adapted.
index 9e656c39aa16d94cfa5f49e63c09cad20ad3c49c..b5f4d555ad429cd52126ec87aa6af28f273b3c8e 100644 (file)
@@ -7,9 +7,7 @@ CYGWIN          Compiling the Cygwin port.
 __CYGWIN__     Ditto
 MSDOS          Compiling the MS-DOS port.
 __MSDOS__      Ditto.
-__DJGPP__      Major version number of the DJGPP library for the DOS port.
-__DJGPP_MINOR__ Minor version number of the DJGPP library.
-__GO32__       Compiling the DOS port with DJGPP v1.x (obsolete).
+__DJGPP_MINOR__ Minor version number of the DJGPP library; used only in msdos.c and dosfns.c.
 DOS_NT         Compiling for either the MS-DOS or native MS-Windows port.
 WINDOWSNT      Compiling the native MS-Windows (W32) port.
 __MINGW32__    Compiling the W32 port with the MinGW port of GCC.
@@ -24,7 +22,9 @@ NS_IMPL_GNUSTEP       Compile support for GNUstep implementation of NS GUI API.
 NS_IMPL_COCOA  Compile support for Cocoa (Apple) implementation of NS GUI API.
 HAVE_X11       Compile support for the X11 GUI.
 HAVE_X_WINDOWS Compile support for X Window system
-X11            ??  Makefile.in suggests it's equivalent to HAVE_X11
+  (It looks like, nowadays, if HAVE_X11 is set, HAVE_X_WINDOWS must
+   be, and vice versa.  At least, this is true for configure, and
+   msdos; not sure about nt.)
 USE_LUCID      Use the Lucid toolkit for menus&scrollbars.  Requires HAVE_X11.
 USE_MOTIF      Use the Motif toolkit for menus&scrollbars.  Requires HAVE_X11.
 USE_GTK                Use the Gtk   toolkit for menus&scrollbars.  Requires HAVE_X11.
@@ -49,7 +49,6 @@ subprocesses    System can use subprocesses (for M-x shell for example).  Define
 USE_LISP_UNION_TYPE Define it in lisp.h to make Lisp_Object be a union type instead of the default int.
 
 ** System specific macros, decribed in detail in src/s/template.h
-BSTRING
 CLASH_DETECTION
 COFF
 FIRST_PTY_LETTER
@@ -57,26 +56,16 @@ HAVE_PTYS
 HAVE_TERMIO
 HAVE_TERMIOS
 INTERRUPT_INPUT
-MAIL_USE_FLOCK
 NARROWPROTO
-NOMULTIPLEJOBS
 SEPCHAR
 SIGTYPE
 SYSTEM_TYPE
-USE_MMAP_FOR_BUFFERS
 
 ** Machine specific macros, decribed in detail in src/m/template.h
-CANNOT_DUMP
 EXPLICIT_SIGN_EXTEND
 LOAD_AVE_CVT
 LOAD_AVE_TYPE
-NO_ARG_ARRAY
-NO_REMAP
 VIRT_ADDR_VARIES
-WORDS_BIG_ENDIAN
-
-** Not used anymore by any port, can be cleaned up
-NO_SOCK_SIGIO
 
 ** Misc macros
 USER_FULL_NAME   If defined, overrides the default pw->pw_gecos for getting at the full user name.  Only MSDOS overrides the default.
@@ -88,10 +77,11 @@ USER_FULL_NAME   If defined, overrides the default pw->pw_gecos for getting at t
 
 AIX
 AMPERSAND_FULL_NAME
-BCOPY_DOWNWARD_SAFE
-BCOPY_UPWARD_SAFE
 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
@@ -104,20 +94,11 @@ BROKEN_SIGPOLL
 BROKEN_SIGPTY
 BSD4_2
 BSD4_3
-BSD_PGRPS
 BSD_SYSTEM
 CLASH_DETECTION
-COFF_BSD_SYMBOLS
-CRT0_DUMMIES
-C_DEBUG_SWITCH
-C_SWITCH_MACHINE
-C_SWITCH_SYSTEM
-C_SWITCH_SYSTEM_TEMACS
-C_SWITCH_X_SYSTEM
 DATA_SEG_BITS
 DATA_START
 DBL_MIN_REPLACEMENT
-DECLARE_GETPWUID_WITH_UID_T
 DEFAULT_SOUND_DEVICE
 DEVICE_SEP
 DIRECTORY_SEP
@@ -129,11 +110,9 @@ EMACS_CONFIGURATION
 EMACS_CONFIG_OPTIONS
 EMACS_INT
 EMACS_UINT
-END_FILES_1
 FILE_SYSTEM_CASE
 FLOAT_CHECK_DOMAIN
 FSCALE
-GAP_USE_BCOPY
 GC_LISP_OBJECT_ALIGNMENT
 GC_MARK_SECONDARY_STACK
 GC_MARK_STACK
@@ -143,12 +122,8 @@ GNU_LIBRARY_PENDING_OUTPUT_COUNT
 GNU_LINUX
 GNU_MALLOC
 HAVE_AIX_SMT_EXP
-HAVE_ALLOCA
-HAVE_BCMP
-HAVE_BCOPY
 HAVE_CBRT
 HAVE_CLOSEDIR
-HAVE_CRTIN
 HAVE_DUP2
 HAVE_EUIDACCESS
 HAVE_FMOD
@@ -165,14 +140,9 @@ HAVE_GETPT
 HAVE_GETTIMEOFDAY
 HAVE_GETWD
 HAVE_H_ERRNO
-HAVE_INDEX
 HAVE_INET_SOCKETS
 HAVE_INVERSE_HYPERBOLIC
-HAVE_LIB64_DIR
 HAVE_LIBKSTAT
-HAVE_LIBNCURSES
-HAVE_LIBPTHREADS
-HAVE_LIBXMU
 HAVE_LIMITS_H
 HAVE_LINUX_VERSION_H
 HAVE_LOGB
@@ -188,7 +158,6 @@ HAVE_PWD_H
 HAVE_RANDOM
 HAVE_RENAME
 HAVE_RES_INIT
-HAVE_RINDEX
 HAVE_RINT
 HAVE_RMDIR
 HAVE_SELECT
@@ -212,46 +181,27 @@ HAVE_SYS_TIMEB_H
 HAVE_SYS_TIME_H
 HAVE_TCATTR
 HAVE_TERMIOS_H
-HAVE_TEXT_START
 HAVE_TIMEVAL
 HAVE_TM_ZONE
 HAVE_TZSET
 HAVE_UNISTD_H
 HAVE_UTIMES
 HAVE_UTIME_H
-HAVE_VOLATILE
 HAVE_WINDOW_SYSTEM
 HAVE_WORKING_VFORK
 HAVE_XRMSETDATABASE
 HPUX
-IBMR2AIX
-INHIBIT_X11R6_XIM
 INTERNAL_TERMINAL
 IS_ANY_SEP
 IS_DIRECTORY_SEP
 KERNEL_FILE
 LDAV_SYMBOL
-LD_SWITCH_MACHINE
-LD_SWITCH_MACHINE_TEMACS
-LD_SWITCH_SYSTEM
-LD_SWITCH_SYSTEM_TEMACS
-LD_SWITCH_SYSTEM_tmp
-LD_SWITCH_X_DEFAULT
-LIBS_DEBUG
-LIBS_MACHINE
-LIBS_SYSTEM
-LIBS_TERMCAP
-LIBX11_SYSTEM
-LIBXMU
-LIB_GCC
-LIB_MATH
-LIB_MOTIF
-LIB_STANDARD
 LINKER
 LINUX_VERSION_CODE
 LISP_FLOAT_TYPE
 LNOFLSH
 LOCALTIME_CACHE
+MAIL_USE_FLOCK
 MAIL_USE_LOCKF
 MAIL_USE_POP
 MAIL_USE_SYSTEM_LOCK
@@ -259,38 +209,22 @@ MAXPATHLEN
 MIN_PTY_KERNEL_VERSION -- only used on Mac
 MODE_LINE_BINARY_TEXT
 MUST_UNDEF__STDC__
-NEED_BSDTTY
-NEED_ERRNO
-NEED_LIBW
-NEED_UNISTD_H
 NLIST_STRUCT
-NOT_C_CODE
-NOT_USING_MOTIF
 NO_ABORT
-NO_DIR_LIBRARY
 NO_EDITRES
 NO_MATHERR
-NO_SHARED_LIBS
 NO_TERMIO
 NSIG
 NSIG_MINIMUM
 NULL
 NULL_DEVICE
 ORDINARY_LINK
-OTHER_FILES
 O_APPEND
-O_BINARY
-O_CREAT
-O_EXCL
 O_RDONLY
 O_RDWR
-O_TEXT
-O_TRUNC
-O_WRONLY
 PAGESIZE
 PENDING_OUTPUT_COUNT
 POSIX
-POSIX_SIGNALS
 PREFER_VSUSP
 PTY_ITERATION
 PTY_NAME_SPRINTF
@@ -299,7 +233,6 @@ PTY_TTY_NAME_SPRINTF
 PURESIZE
 RUN_TIME_REMAP
 SA_RESTART
-SECTION_ALIGNMENT
 SEGMENT_MASK
 SETPGRP_RELEASES_CTTY
 SETUP_SLAVE_PTY
@@ -313,36 +246,25 @@ SIGQUIT
 SIGTRAP
 SIGTYPE
 SOLARIS2
-START_FILES
-START_FILES_1
 STDC_HEADERS
-SYMS_SYSTEM
 SYSTEM_PURESIZE_EXTRA
 SYSTEM_MALLOC
 SYSV_SYSTEM_DIR
-Srandom
 TAB3
 TABDLY
 TERM
-TERMINFO
-TEXT_START
-THIS_IS_CONFIGURE
-THIS_IS_MAKEFILE
 TIME_WITH_SYS_TIME
 TIOCSIGSEND
 TM_IN_SYS_TIME
 ULIMIT_BREAK_VALUE
-UNEXEC
 UNIX98_PTYS
 USE_CRT_DLL
-USE_MAC_IMAGE_IO
 USE_TOOLKIT_SCROLL_BARS
 USG
 USG5
 USG5_4
 USG_SUBTTY_WORKS
 VALBITS
-WORDS_BIG_ENDIAN
 WRETCODE
 XINT
 XOS_NEEDS_TIME_H
@@ -361,7 +283,6 @@ _WINSOCKAPI_
 _WINSOCK_H
 __ELF__
 __FreeBSD__
-__FreeBSD_version
 __GNUC__
 __GNU_LIBRARY__
 __GNUC_MINOR__
@@ -381,10 +302,7 @@ _start
 abort
 access
 alloca
-bcmp
-bcopy
 brk
-bzero
 calloc
 chdir
 chmod
index 56166ffa7ce98da9d44e9db3a80bbd7746f4d2ec..2277767437313a69b83e2f0c5cdc5f09e72c19ec 100644 (file)
@@ -1,7 +1,91 @@
+2010-08-09  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * CPP-DEFINES (WORDS_BIG_ENDIAN): Remove.
+
+2010-08-05  Eli Zaretskii  <eliz@gnu.org>
+
+       * MAINTAINERS: Rename src/unexec.c => src/unexcoff.c.
+
+2010-07-24  Christoph Scholtes  <cschol2112@gmail.com>
+
+       * admin.el: Write version number to nt/makefile.w32-in.
+       * nt/makedist.bat: Remove; replaced with `zipdist.bat'
+       in the nt/ directory.
+       * nt/README.W32: Relocate to nt/ directory.
+
+2010-07-11  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * CPP-DEFINES (HAVE_INDEX, HAVE_RINDEX): Remove.
+
+2010-07-08  Eli Zaretskii  <eliz@gnu.org>
+
+       * MAINTAINERS: Update my responsibilities.
+
+2010-07-07  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * CPP-DEFINES (BCOPY_DOWNWARD_SAFE, BCOPY_UPWARD_SAFE)
+       (GAP_USE_BCOPY, HAVE_BCMP, HAVE_BCOPY, bcmp, bcopy, bzero):
+       Remove.
+
+2010-06-12  Eli Zaretskii  <eliz@gnu.org>
+
+       * unidata/bidimirror.awk: New file.
+
+       * unidata/BidiMirroring.txt: New file from
+       http://www.unicode.org/Public/6.0.0/ucd/BidiMirroring-6.0.0d1.txt.
+
+       * unidata/Makefile.in: (../../src/bidimirror.h): New target.
+       (all): Depend on ../../src/biditype.h and ../../src/bidimirror.h.
+
+       * unidata/makefile.w32-in (../../src/bidimirror.h): New target.
+       (all): Depend on ../../src/biditype.h and ../../src/bidimirror.h.
+
+       * unidata/biditype.awk: New file.
+
+       * unidata/Makefile.in (../../src/biditype.h): New target.
+
+       * unidata/makefile.w32-in (../../src/biditype.h): New target.
+
+2010-06-09  Juanma Barranquero  <lekktu@gmail.com>
+
+       * unidata/UnicodeData.txt: Update from
+       http://www.unicode.org/Public/6.0.0/ucd/UnicodeData-6.0.0d5.txt
+
+2010-05-27  Glenn Morris  <rgm@gnu.org>
+
+       * quick-install-emacs (AVOID): No more Makefile.c files.
+
+       * notes/cpp: Remove file.
+
+2010-05-15  Ken Raeburn  <raeburn@raeburn.org>
+
+       * admin.el (set-version, set-copyright): Update emacs.c instead of
+       version.el.
+
+       * make-tarball.txt: Update filename list in step 6.
+
+       * quick-install-emacs: Scan emacs.c instead of version.el for
+       version string.
+
 2010-05-07  Chong Yidong  <cyd@stupidchicken.com>
 
        * Version 23.2 released.
 
+2010-04-01  Eli Zaretskii  <eliz@gnu.org>
+
+       * CPP-DEFINES (__DJGPP__, __GO32__): Remove, no longer used.
+
+2010-03-10  Chong Yidong  <cyd@stupidchicken.com>
+
+       * Branch for 23.2.
+
+2010-03-10  Miles Bader  <miles@gnu.org>
+
+       * quick-install-emacs: Use more portable shell syntax.
+
+       * quick-install-emacs: (AVOID): Be more picky about files we avoid
+       installing.
+
 2010-02-14  Juanma Barranquero  <lekktu@gmail.com>
 
        * quick-install-emacs (PRUNED): Fix typo in message.
 
        * charsets/mapconv: Handle UNICODE2.
 
-       * charsets/Makefile (CJK): Include CP932-2BYTE.map
+       * charsets/Makefile (CJK): Include CP932-2BYTE.map.
        (CP932-2BYTE.map): New target.
 
 2008-02-01  Kenichi Handa  <handa@m17n.org>
 
 2004-08-28  Jan Djärv  <jan.h.d@swipnet.se>
 
-       * FOR-RELEASE (Indications): Remove entry about GTK and geometry,
+       * FOR-RELEASE (Indications): Remove entry about GTK and geometry
        (now behaves as well as other ports).
 
 2004-06-28  Jan Djärv  <jan.h.d@swipnet.se>
index 0e8c9b323250438a369766b1b4ce7ed5c61e9c30..432e4f5cf9f5eeedfe77d0262929277cd3a9c5a3 100644 (file)
@@ -23,6 +23,11 @@ Jason Rumney
        W32
 
 Eli Zaretskii
+
+       src/bidi.c
+       bidirectional editing support in xdisp.c and elsewhere
+       lisp/term/tty-colors.el
+
        The MS-DOS (a.k.a. DJGPP) port:
            config.bat
            msdos/*
@@ -35,11 +40,7 @@ Eli Zaretskii
            lisp/dos-fns.el
            lisp/dos-w32.el
            lisp/dos-vars.el
-
-       lisp/term/tty-colors.el
-       lisp/international/codepage.el
-
-       doc/emacs/msdog.texi
+           doc/emacs/msdog.texi
 
 Kenichi Handa
        Mule
@@ -91,6 +92,7 @@ Eli Zaretskii
        info/dir
 
        src/xfaces.c
+       src/xdisp.c
        src/term.c
        src/frame.c
        src/dired.c
@@ -189,7 +191,7 @@ src/tparam.c
 src/undo.c
 src/unexaix.c
 src/unexalpha.c
-src/unexec.c
+src/unexcoff.c
 src/unexelf.c
 src/unexhp9k800.c
 src/unexw32.c
index 984f3649b2c0839ef38769c024ceaec53c4b84a0..51bbecf4c575c49928a15d609a82048add98cdd8 100644 (file)
@@ -60,8 +60,8 @@ Root must be the root of an Emacs source tree."
   (interactive "DEmacs root directory: \nsVersion number: ")
   (unless (file-exists-p (expand-file-name "src/emacs.c" root))
     (error "%s doesn't seem to be the root of an Emacs source tree" root))
-  (set-version-in-file root "lisp/version.el" version
-                      (rx (and "emacs-version" (0+ space)
+  (set-version-in-file root "src/emacs.c" version
+                      (rx (and "emacs_version" (0+ (not (in ?\")))
                                ?\" (submatch (1+ (not (in ?\")))) ?\")))
   (set-version-in-file root "README" version
                       (rx (and "version" (1+ space)
@@ -95,6 +95,9 @@ Root must be the root of an Emacs source tree."
   (set-version-in-file root "lib-src/makefile.w32-in" version
                       (rx (and "VERSION" (0+ space) "=" (0+ space)
                                (submatch (1+ (in "0-9."))))))
+  (set-version-in-file root "nt/makefile.w32-in" version
+                      (rx (and "VERSION" (0+ space) "=" (0+ space)
+                               (submatch (1+ (in "0-9."))))))
   ;; nt/emacs.rc also contains the version number, but in an awkward
   ;; format. It must contain four components, separated by commas, and
   ;; in two places those commas are followed by space, in two other
@@ -184,8 +187,8 @@ Root must be the root of an Emacs source tree."
                          (format-time-string "%Y")))))
   (unless (file-exists-p (expand-file-name "src/emacs.c" root))
     (error "%s doesn't seem to be the root of an Emacs source tree" root))
-  (set-version-in-file root "lisp/version.el" copyright
-                      (rx (and "emacs-copyright" (0+ space)
+  (set-version-in-file root "src/emacs.c" copyright
+                      (rx (and "emacs_copyright" (0+ (not (in ?\")))
                                ?\" (submatch (1+ (not (in ?\")))) ?\")))
   (set-version-in-file root "lib-src/ebrowse.c" copyright
                        (rx (and "emacs_copyright" (0+ (not (in ?\")))
diff --git a/admin/charsets/.arch-inventory b/admin/charsets/.arch-inventory
deleted file mode 100644 (file)
index 0924093..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-# Unlike most emacs dirs, admin/charsets has a simple non-autoconf-generated makefile
-source ^(Makefile)$
-
-# arch-tag: ee36cfe3-96f8-4e91-aec4-008c80a85e6b
index 9979aa03ca65e8464e6bc263dcae55b9b1ea0767..f685dd5e50fc8c2812548fe4b811555df8e49963 100644 (file)
@@ -31,7 +31,7 @@ For each step, check for possible errors.
      make bootstrap
 
 6.  Commit configure, README, doc/emacs/emacs.texi,
-    doc/lispref/elisp.texi, etc/AUTHORS, lisp/version.el, nt/emacs.rc,
+    doc/lispref/elisp.texi, etc/AUTHORS, src/emacs.c, nt/emacs.rc,
     and lisp/cus-edit.el (if modified).  Copy lisp/loaddefs.el to
     lisp/ldefs-boot.el and commit lisp/ldefs-boot.el.  For a release,
     also commit the ChangeLog files in all directories.
index 258fcd955663ddcc1ddd352bc687081f46b3c27a..53f3d9603ca0b1ff64e8099f68b68abc4204b210 100644 (file)
@@ -1,29 +1,25 @@
-This file describes the bzr branch in which it is maintained.
-Everything below the line is branch-specific.
-________________________________________________________________________
+You can view the available Emacs branches at
+
+http://bzr.savannah.gnu.org/r/emacs/
 
-This is the trunk (sometimes mistakenly called "HEAD").
-When people say "use the development version of Emacs" or the
-"bzr version of Emacs", this is the branch they are talking about.
+Development normally takes places on the trunk.
+Sometimes specialized features are developed on separate branches
+before possibly being merged to the trunk.
 
-Emacs development takes place on the trunk.  Most of the time, Emacs
-hackers add to it relatively free of constraint (aside from proper
-legal / accounting practices), although sometimes there is related
-discussion on the emacs-devel mailing list.
+Development is discussed on the emacs-devel mailing list.
 
-Sometime before the release of a new major version of Emacs (eg 22.1),
+Sometime before the release of a new major version of Emacs (eg 23.2),
 a "feature freeze" is imposed on the trunk.  No new features may be
-added after this point.  This is usually many months before the release.
-During this time, there is no official place for development of new features.
+added after this point.  This is usually some months before the release.
 
-Shortly before the release, a release branch is created.  For example,
-EMACS_22_BASE or EMACS_21_1_RC for Emacs 22.x and 21.x, respectively.
-(Unfortunately the naming scheme has not always been consistent.)
+Shortly before the release, a release branch is created, and the
+trunk is then free for development.
+For example, "emacs-23" for Emacs 23.2 and later, "EMACS_23_1_RC" for
+23.1, "EMACS_22_BASE" for 22.x, and "EMACS_21_1_RC" for 21.x.
 
-The release branch is used to make the release (22.1), and all later
-members of the series (22.2, 22.3, etc).  Generally, only bug-fixes have
-been allowed in the minor releases, although in 22.x, self-contained
-new features were allowed on a case-by-case basis.
+Consult emacs-devel for exactly what kinds of changes are allowed
+on what branch at any time.
 
-From the point that a release branch is created, the trunk is free for
-development for the next major version.
+If you are looking at this file in a branch other than the trunk,
+there may be some branch-specific documentation below this line.
+________________________________________________________________________
index 5936eead85ae0129091ec798eb1042d00b014eac..5b3af5e242cd0984be3a357ae5cc50c746fe97fc 100644 (file)
@@ -149,6 +149,23 @@ Discard mails matching:
 
 ^X-GNU-PR-Message: (transcript|closed)
 
+** Not receiving messages in response to your control commands?
+The messages debbugs sends out in response to control-server commands
+always have headers To: your@email, and Cc: tracker@debbugs.gnu.org
+(the latter is an alias for the emacs-bug-tracker mailing list).
+These are also the addresses to which a copy of the response is sent.
+(In general, there need not be any relation between the To: and Cc:
+headers visible in a message and where debbugs actually sends it.)
+If you used an X-Debbugs-No-Ack header, however, a copy is _not_ sent
+to you, but the To: header is unchanged.  If you are subscribed to the
+emacs-bug-tracker mailing list and have duplicate suppression turned
+on, the presence of your address in the To: header will cause Mailman
+to not send you a list copy, because it thinks you have received a
+direct copy.  If you used X-Debbugs-No-Ack, this is not the case, and
+you won't get any copy at all.  If this bothers you, don't use both
+X-Debbugs-No-Ack and Mailman duplicate suppression for the
+emacs-bug-tracker mailing list, just pick one or the other.
+
 ** How to avoid multiple copies of mails.
 If you reply to reports in the normal way, this should work fine.
 Basically, reply only to the numbered bug address (and any individual
@@ -553,9 +570,13 @@ All discarded messages are stored in /var/lib/mailman/spam.
 If a non-spam message accidentally gets discarded, just do:
 
 cat /var/lib/mailman/spam/not-really-spam.msg | /usr/lib/debbugs/receive
+chown Debian-debbugs:Debian-debbugs /var/lib/debbugs/spool/incoming/*
 ... check it works ...
 mv /var/lib/mailman/spam/not-really-spam.msg /var/lib/mailman/not-spam/
 
+Also check that the sender was not added to the auto-discard/reject list
+in the debbugs-submit Mailman interface.
+
 ** Administrivia
 
 The debbugs-submit list should have the administrivia option off,
diff --git a/admin/notes/bzr b/admin/notes/bzr
new file mode 100644 (file)
index 0000000..c66cdd9
--- /dev/null
@@ -0,0 +1,40 @@
+NOTES ON COMMITTING TO EMACS'S BAZAAR REPO    -*- outline -*-
+
+* Install changes only on one branch, let them get merged elsewhere if needed.
+In particular, install bug-fixes only on the release branch (if there
+is one) and let them get synced to the trunk; do not install them by
+hand on the trunk as well.  E.g. if there is an active "emacs-23" branch
+and you have a bug-fix appropriate for the next Emacs-23.x release,
+install it only on the emacs-23 branch, not on the trunk as well.
+
+Installing things manually into more than one branch makes merges more
+difficult.
+
+http://lists.gnu.org/archive/html/emacs-devel/2010-03/msg01124.html
+
+* Backporting a bug-fix from the trunk to a branch (e.g. "emacs-23").
+Label the commit as a backport, e.g. by starting the commit message with
+"Backport:".  This is helpful for the person merging the release branch
+to the trunk.
+
+http://lists.gnu.org/archive/html/emacs-devel/2010-05/msg00262.html
+
+* Installing changes from your personal branches.
+If your branch has only a single commit, or many different real
+commits, it is fine to do a merge.  If your branch has only a very
+small number of "real" commits, but several "merge from trunks", it is
+preferred that you take your branch's diff, apply it to the trunk, and
+commit directly, not merge.  This keeps the history cleaner.
+
+In general, when working on some feature in a separate branch, it is
+preferable not to merge from trunk until you are done with the
+feature.  Unless you really need some change that was done on the
+trunk while you were developing on the branch, you don't really need
+those merges; just merge once, when you are done with the feature, and
+Bazaar will take care of the rest.  Bazaar is much better in this than
+CVS, so interim merges are unnecessary.
+
+Or use shelves; or rebase; or do something else.  See the thread for
+yet another fun excursion into the exciting world of version control.
+
+http://lists.gnu.org/archive/html/emacs-devel/2010-04/msg00086.html
diff --git a/admin/notes/cpp b/admin/notes/cpp
deleted file mode 100644 (file)
index 2750013..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-ttn 2003-04-09
-
-we use a C preprocesor not only in the normal compilation of .c files
-into object files, but also for creating
-
-       src/Makefile
-       lib-src/Makefile
-
-(delimited by comment "start of cpp stuff").  some cpp implementations
-insert whitespace in between tokens.
-
-during makefile creation, the preprocessor symbol NOT_C_CODE is defined.
-this should not be defined for normal .c file compilation.
-
-there has been discussion on eliminating this use of cpp and relying
-solely on autoconf processing.  rms says to leave it be.
-
-;;; arch-tag: d654291e-9fc8-41b7-ab0c-d3cde842a8e0
index c6d56cd0cc2516f56afc931c4dfc6a9e58eac973..d3fb56a2ba4846b07dcc7b93e0d9c66aebfacfce 100644 (file)
@@ -6,11 +6,6 @@ See the end of the file for license conditions.
 New font handling mechanism with font backend method
 ----------------------------------------------------
 
-The configure script, if invoked with "--enable-font-backend", checks
-if libraries freetype and fontconfig exist.  If they are both
-available, macro "USE_FONT_BACKEND" is defined in src/config.h.  In
-that case, the existence of Xft library is checked too.
-
 The new files are:
        font.h -- header providing font-backend related structures
                (most important ones are "struct font" and "struct
@@ -44,10 +39,6 @@ Fontconfig are also available on w32, what we need may be:
        ftw32font.c -- font-driver on w32 directly using FreeType fonts
                utilizing methods provided by ftfont.c.
 
-And, for those to work, macterm.c and macfns.c must be changed by the
-similar way as xterm.c and xfns.c (the parts "#ifdef USE_FONT_BACKEND"
-... "#endif" should be checked).
-
 It may be interesting if Emacs supports a frame buffer directly and
 has these font driver.
        ftfbfont.c -- font-driver on FB for FreeType fonts.
index acba327072b2530bed68473de44689bf1313e4c3..0b66b8054bbfdd8bcff5b489f1655797fdafd017 100644 (file)
@@ -17,8 +17,6 @@ not include any files that end up in the release tarball.
 
 ** Make the ChangeLog entry in the name of the author(s), not your own name.
 
-** If appropriate, add an entry to lisp/Makefile.in ELCFILES.
-
 ** If appropriate, check that the file compiles OK and that Emacs
 builds fine with it.  Address any compilation warnings.
 
diff --git a/admin/nt/makedist.bat b/admin/nt/makedist.bat
deleted file mode 100755 (executable)
index 6546e6e..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-@echo off\r
-\r
-rem Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010\r
-rem   Free Software Foundation, Inc.\r
-\r
-rem Cannot use brackets in andrewi's email below because\r
-rem older Windows shells will treat that as redirection.\r
-\r
-rem Author: Andrew Innes andrewi@gnu.org\r
-\r
-rem This file is part of GNU Emacs.\r
-\r
-rem GNU Emacs is free software: you can redistribute it and/or modify\r
-rem it under the terms of the GNU General Public License as published by\r
-rem the Free Software Foundation, either version 3 of the License, or\r
-rem (at your option) any later version.\r
-\r
-rem GNU Emacs is distributed in the hope that it will be useful,\r
-rem but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-rem GNU General Public License for more details.\r
-\r
-rem You should have received a copy of the GNU General Public License\r
-rem along with GNU Emacs.  If not, see http://www.gnu.org/licenses/.\r
-\r
-\r
-if (%3) == () goto usage\r
-if not (%4) == () goto %4\r
-\r
-:bin\r
-\r
-echo Create full bin distribution\r
-copy %3\README.W32 emacs-%1\README.W32\r
-rem Info-ZIP zip seems to be broken on Windows.\r
-rem It always writes to zip.zip and treats the zipfile argument as one\r
-rem of the files to go in it.\r
-rem zip -9 -r %2-bin-i386 emacs-%1/BUGS emacs-%1/COPYING emacs-%1/README emacs-%1/README.W32 emacs-%1/INSTALL emacs-%1/bin emacs-%1/etc emacs-%1/info emacs-%1/lisp emacs-%1/leim -x emacs.mdp *.pdb *.opt *~ CVS\r
-7z a -tZIP -mx=9 -xr!emacs.mdp -xr!*.pdb -xr!*.opt -xr!*~ -xr!CVS -xr!.arch-inventory %2-bin-i386.zip emacs-%1/BUGS emacs-%1/COPYING emacs-%1/README emacs-%1/README.W32 emacs-%1/INSTALL emacs-%1/bin emacs-%1/etc emacs-%1/info emacs-%1/lisp emacs-%1/leim emacs-%1/site-lisp\r
-del emacs-%1\README.W32\r
-if not (%4) == () goto end\r
-\r
-:barebin\r
-echo Create archive with just the basic binaries and generated files\r
-echo (the user needs to unpack the full source distribution for\r
-echo  everything else)\r
-copy %3\README.W32 emacs-%1\README.W32\r
-rem Info-ZIP zip seems to be broken on Windows.\r
-rem It always writes to zip.zip and treats the zipfile argument as one\r
-rem of the files to go in it.\r
-rem zip -9 -r %2-barebin-i386.zip emacs-%1/README.W32 emacs-%1/bin emacs-%1/etc/DOC-X emacs-%1/COPYING\r
-7z a -tZIP -mx=9 %2-barebin-i386.zip emacs-%1/README.W32 emacs-%1/bin emacs-%1/etc/DOC-X emacs-%1/COPYING\r
-del emacs-%1\README.W32\r
-if not (%4) == () goto end\r
-\r
-goto end\r
-\r
-:usage\r
-echo Generate source and binary distributions of emacs.\r
-echo Usage: %0 emacs-version dist-basename distfiles [bin,barebin]\r
-echo   (e.g., %0 19.34 emacs-19.34.5 d:\andrewi\distfiles)\r
-:end\r
-\r
-goto skipArchTag\r
-   arch-tag: 6e2ddd92-c1c9-4992-b6b5-207aaab72f68\r
-:skipArchTag\r
index 2fda74b0832623d1faf2c2e73ce9cdffc063fb54..39b200b510261aa7247920876d9eefce1a7f5604 100755 (executable)
@@ -1,8 +1,8 @@
 #!/bin/sh
 ### quick-install-emacs --- do a halfway-decent job of installing emacs quickly
 
-## Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
-##   Free Software Foundation, Inc.
+## Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
+##   2010  Free Software Foundation, Inc.
 
 ## Author: Miles Bader <miles@gnu.org>
 
@@ -31,7 +31,7 @@
 PUBLIC_LIBSRC_BINARIES='b2m emacsclient etags ctags ebrowse'
 PUBLIC_LIBSRC_SCRIPTS='grep-changelog rcs-checkin'
 
-AVOID="CVS -DIC README COPYING ChangeLog ~ [.]orig$ [.]rej$ Makefile makefile stamp-subdir [.]cvsignore [.]arch-ids [{]arch[}] [.][cho]$ make-docfile testfile test-distrib"
+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"
 
 # Prune old binaries lying around in the source tree
 PRUNE=no
@@ -120,7 +120,7 @@ Written by Miles Bader <miles@gnu.org>
 EOF
       exit 0
       ;;
-    -[^-]?*)
+    -[!-]?*)
       # split concatenated single-letter options apart
       FIRST="$1"; shift
       set -- `echo $FIRST | sed 's/-\(.\)\(.*\)/-\1 -\2/'` "$@"
@@ -171,7 +171,7 @@ test x"$SRC" = x && { SRC="`get_config_var srcdir`" || exit 4 ; }
 test x"$prefix" = x && { prefix="`get_config_var prefix`" || exit 4 ; }
 test x"$ARCH" = x && { ARCH="`get_config_var host`" || exit 4 ; }
 
-VERSION=`grep 'defconst[        ]*emacs-version' $SRC/lisp/version.el \
+VERSION=`grep 'char emacs_version' $SRC/src/emacs.c \
          | sed -e 's/^[^"]*"\([^"]*\)".*$/\1/'`
 
 DST_SHARE="$prefix/share/emacs/$VERSION"
diff --git a/admin/unidata/.arch-inventory b/admin/unidata/.arch-inventory
deleted file mode 100644 (file)
index 6dbe37a..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-# Generated at compile time
-precious ^unidata\.txt$
-
-# arch-tag: 7640ff84-9e72-45e6-a7c7-b7b307b73959
diff --git a/admin/unidata/BidiMirroring.txt b/admin/unidata/BidiMirroring.txt
new file mode 100644 (file)
index 0000000..761ddf0
--- /dev/null
@@ -0,0 +1,597 @@
+# BidiMirroring-6.0.0.txt
+# Date: 2009-11-10, 17:09:00 PST [KW]
+#
+# Bidi_Mirroring_Glyph Property
+# 
+# This file is an informative contributory data file in the
+# Unicode Character Database.
+#
+# Copyright (c) 1991-2009 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
+# 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 file contains a list of lines with mappings from one code point
+# to another one for character-based mirroring.
+# Note that for "real" mirroring, a rendering engine needs to select
+# appropriate alternative glyphs, and that many Unicode characters do not
+# have a mirror-image Unicode character.
+# 
+# Each mapping line contains two fields, separated by a semicolon (';').
+# Each of the two fields contains a code point represented as a
+# 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 
+# characters exist with mirrored glyphs, are
+# listed as comments at the end of the file.
+#
+# 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
+# point has the default value for the Bidi_Mirroring_Glyph property,
+# that means that no other character exists whose glyph is suitable
+# for character-based mirroring.
+# 
+# For information on bidi mirroring, see UAX #9: Bidirectional Algorithm,
+# 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.
+# 
+# ############################################################
+
+0028; 0029 # LEFT PARENTHESIS
+0029; 0028 # RIGHT PARENTHESIS
+003C; 003E # LESS-THAN SIGN
+003E; 003C # GREATER-THAN SIGN
+005B; 005D # LEFT SQUARE BRACKET
+005D; 005B # RIGHT SQUARE BRACKET
+007B; 007D # LEFT CURLY BRACKET
+007D; 007B # RIGHT CURLY BRACKET
+00AB; 00BB # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+00BB; 00AB # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+0F3A; 0F3B # TIBETAN MARK GUG RTAGS GYON
+0F3B; 0F3A # TIBETAN MARK GUG RTAGS GYAS
+0F3C; 0F3D # TIBETAN MARK ANG KHANG GYON
+0F3D; 0F3C # TIBETAN MARK ANG KHANG GYAS
+169B; 169C # OGHAM FEATHER MARK
+169C; 169B # OGHAM REVERSED FEATHER MARK
+2039; 203A # SINGLE LEFT-POINTING ANGLE QUOTATION MARK
+203A; 2039 # SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
+2045; 2046 # LEFT SQUARE BRACKET WITH QUILL
+2046; 2045 # RIGHT SQUARE BRACKET WITH QUILL
+207D; 207E # SUPERSCRIPT LEFT PARENTHESIS
+207E; 207D # SUPERSCRIPT RIGHT PARENTHESIS
+208D; 208E # SUBSCRIPT LEFT PARENTHESIS
+208E; 208D # SUBSCRIPT RIGHT PARENTHESIS
+2208; 220B # ELEMENT OF
+2209; 220C # NOT AN ELEMENT OF
+220A; 220D # SMALL ELEMENT OF
+220B; 2208 # CONTAINS AS MEMBER
+220C; 2209 # DOES NOT CONTAIN AS MEMBER
+220D; 220A # SMALL CONTAINS AS MEMBER
+2215; 29F5 # DIVISION SLASH
+223C; 223D # TILDE OPERATOR
+223D; 223C # REVERSED TILDE
+2243; 22CD # ASYMPTOTICALLY EQUAL TO
+2252; 2253 # APPROXIMATELY EQUAL TO OR THE IMAGE OF
+2253; 2252 # IMAGE OF OR APPROXIMATELY EQUAL TO
+2254; 2255 # COLON EQUALS
+2255; 2254 # EQUALS COLON
+2264; 2265 # LESS-THAN OR EQUAL TO
+2265; 2264 # GREATER-THAN OR EQUAL TO
+2266; 2267 # LESS-THAN OVER EQUAL TO
+2267; 2266 # GREATER-THAN OVER EQUAL TO
+2268; 2269 # [BEST FIT] LESS-THAN BUT NOT EQUAL TO
+2269; 2268 # [BEST FIT] GREATER-THAN BUT NOT EQUAL TO
+226A; 226B # MUCH LESS-THAN
+226B; 226A # MUCH GREATER-THAN
+226E; 226F # [BEST FIT] NOT LESS-THAN
+226F; 226E # [BEST FIT] NOT GREATER-THAN
+2270; 2271 # [BEST FIT] NEITHER LESS-THAN NOR EQUAL TO
+2271; 2270 # [BEST FIT] NEITHER GREATER-THAN NOR EQUAL TO
+2272; 2273 # [BEST FIT] LESS-THAN OR EQUIVALENT TO
+2273; 2272 # [BEST FIT] GREATER-THAN OR EQUIVALENT TO
+2274; 2275 # [BEST FIT] NEITHER LESS-THAN NOR EQUIVALENT TO
+2275; 2274 # [BEST FIT] NEITHER GREATER-THAN NOR EQUIVALENT TO
+2276; 2277 # LESS-THAN OR GREATER-THAN
+2277; 2276 # GREATER-THAN OR LESS-THAN
+2278; 2279 # [BEST FIT] NEITHER LESS-THAN NOR GREATER-THAN
+2279; 2278 # [BEST FIT] NEITHER GREATER-THAN NOR LESS-THAN
+227A; 227B # PRECEDES
+227B; 227A # SUCCEEDS
+227C; 227D # PRECEDES OR EQUAL TO
+227D; 227C # SUCCEEDS OR EQUAL TO
+227E; 227F # [BEST FIT] PRECEDES OR EQUIVALENT TO
+227F; 227E # [BEST FIT] SUCCEEDS OR EQUIVALENT TO
+2280; 2281 # [BEST FIT] DOES NOT PRECEDE
+2281; 2280 # [BEST FIT] DOES NOT SUCCEED
+2282; 2283 # SUBSET OF
+2283; 2282 # SUPERSET OF
+2284; 2285 # [BEST FIT] NOT A SUBSET OF
+2285; 2284 # [BEST FIT] NOT A SUPERSET OF
+2286; 2287 # SUBSET OF OR EQUAL TO
+2287; 2286 # SUPERSET OF OR EQUAL TO
+2288; 2289 # [BEST FIT] NEITHER A SUBSET OF NOR EQUAL TO
+2289; 2288 # [BEST FIT] NEITHER A SUPERSET OF NOR EQUAL TO
+228A; 228B # [BEST FIT] SUBSET OF WITH NOT EQUAL TO
+228B; 228A # [BEST FIT] SUPERSET OF WITH NOT EQUAL TO
+228F; 2290 # SQUARE IMAGE OF
+2290; 228F # SQUARE ORIGINAL OF
+2291; 2292 # SQUARE IMAGE OF OR EQUAL TO
+2292; 2291 # SQUARE ORIGINAL OF OR EQUAL TO
+2298; 29B8 # CIRCLED DIVISION SLASH
+22A2; 22A3 # RIGHT TACK
+22A3; 22A2 # LEFT TACK
+22A6; 2ADE # ASSERTION
+22A8; 2AE4 # TRUE
+22A9; 2AE3 # FORCES
+22AB; 2AE5 # DOUBLE VERTICAL BAR DOUBLE RIGHT TURNSTILE
+22B0; 22B1 # PRECEDES UNDER RELATION
+22B1; 22B0 # SUCCEEDS UNDER RELATION
+22B2; 22B3 # NORMAL SUBGROUP OF
+22B3; 22B2 # CONTAINS AS NORMAL SUBGROUP
+22B4; 22B5 # NORMAL SUBGROUP OF OR EQUAL TO
+22B5; 22B4 # CONTAINS AS NORMAL SUBGROUP OR EQUAL TO
+22B6; 22B7 # ORIGINAL OF
+22B7; 22B6 # IMAGE OF
+22C9; 22CA # LEFT NORMAL FACTOR SEMIDIRECT PRODUCT
+22CA; 22C9 # RIGHT NORMAL FACTOR SEMIDIRECT PRODUCT
+22CB; 22CC # LEFT SEMIDIRECT PRODUCT
+22CC; 22CB # RIGHT SEMIDIRECT PRODUCT
+22CD; 2243 # REVERSED TILDE EQUALS
+22D0; 22D1 # DOUBLE SUBSET
+22D1; 22D0 # DOUBLE SUPERSET
+22D6; 22D7 # LESS-THAN WITH DOT
+22D7; 22D6 # GREATER-THAN WITH DOT
+22D8; 22D9 # VERY MUCH LESS-THAN
+22D9; 22D8 # VERY MUCH GREATER-THAN
+22DA; 22DB # LESS-THAN EQUAL TO OR GREATER-THAN
+22DB; 22DA # GREATER-THAN EQUAL TO OR LESS-THAN
+22DC; 22DD # EQUAL TO OR LESS-THAN
+22DD; 22DC # EQUAL TO OR GREATER-THAN
+22DE; 22DF # EQUAL TO OR PRECEDES
+22DF; 22DE # EQUAL TO OR SUCCEEDS
+22E0; 22E1 # [BEST FIT] DOES NOT PRECEDE OR EQUAL
+22E1; 22E0 # [BEST FIT] DOES NOT SUCCEED OR EQUAL
+22E2; 22E3 # [BEST FIT] NOT SQUARE IMAGE OF OR EQUAL TO
+22E3; 22E2 # [BEST FIT] NOT SQUARE ORIGINAL OF OR EQUAL TO
+22E4; 22E5 # [BEST FIT] SQUARE IMAGE OF OR NOT EQUAL TO
+22E5; 22E4 # [BEST FIT] SQUARE ORIGINAL OF OR NOT EQUAL TO
+22E6; 22E7 # [BEST FIT] LESS-THAN BUT NOT EQUIVALENT TO
+22E7; 22E6 # [BEST FIT] GREATER-THAN BUT NOT EQUIVALENT TO
+22E8; 22E9 # [BEST FIT] PRECEDES BUT NOT EQUIVALENT TO
+22E9; 22E8 # [BEST FIT] SUCCEEDS BUT NOT EQUIVALENT TO
+22EA; 22EB # [BEST FIT] NOT NORMAL SUBGROUP OF
+22EB; 22EA # [BEST FIT] DOES NOT CONTAIN AS NORMAL SUBGROUP
+22EC; 22ED # [BEST FIT] NOT NORMAL SUBGROUP OF OR EQUAL TO
+22ED; 22EC # [BEST FIT] DOES NOT CONTAIN AS NORMAL SUBGROUP OR EQUAL
+22F0; 22F1 # UP RIGHT DIAGONAL ELLIPSIS
+22F1; 22F0 # DOWN RIGHT DIAGONAL ELLIPSIS
+22F2; 22FA # ELEMENT OF WITH LONG HORIZONTAL STROKE
+22F3; 22FB # ELEMENT OF WITH VERTICAL BAR AT END OF HORIZONTAL STROKE
+22F4; 22FC # SMALL ELEMENT OF WITH VERTICAL BAR AT END OF HORIZONTAL STROKE
+22F6; 22FD # ELEMENT OF WITH OVERBAR
+22F7; 22FE # SMALL ELEMENT OF WITH OVERBAR
+22FA; 22F2 # CONTAINS WITH LONG HORIZONTAL STROKE
+22FB; 22F3 # CONTAINS WITH VERTICAL BAR AT END OF HORIZONTAL STROKE
+22FC; 22F4 # SMALL CONTAINS WITH VERTICAL BAR AT END OF HORIZONTAL STROKE
+22FD; 22F6 # CONTAINS WITH OVERBAR
+22FE; 22F7 # SMALL CONTAINS WITH OVERBAR
+2308; 2309 # LEFT CEILING
+2309; 2308 # RIGHT CEILING
+230A; 230B # LEFT FLOOR
+230B; 230A # RIGHT FLOOR
+2329; 232A # LEFT-POINTING ANGLE BRACKET
+232A; 2329 # RIGHT-POINTING ANGLE BRACKET
+2768; 2769 # MEDIUM LEFT PARENTHESIS ORNAMENT
+2769; 2768 # MEDIUM RIGHT PARENTHESIS ORNAMENT
+276A; 276B # MEDIUM FLATTENED LEFT PARENTHESIS ORNAMENT
+276B; 276A # MEDIUM FLATTENED RIGHT PARENTHESIS ORNAMENT
+276C; 276D # MEDIUM LEFT-POINTING ANGLE BRACKET ORNAMENT
+276D; 276C # MEDIUM RIGHT-POINTING ANGLE BRACKET ORNAMENT
+276E; 276F # HEAVY LEFT-POINTING ANGLE QUOTATION MARK ORNAMENT
+276F; 276E # HEAVY RIGHT-POINTING ANGLE QUOTATION MARK ORNAMENT
+2770; 2771 # HEAVY LEFT-POINTING ANGLE BRACKET ORNAMENT
+2771; 2770 # HEAVY RIGHT-POINTING ANGLE BRACKET ORNAMENT
+2772; 2773 # LIGHT LEFT TORTOISE SHELL BRACKET
+2773; 2772 # LIGHT RIGHT TORTOISE SHELL BRACKET
+2774; 2775 # MEDIUM LEFT CURLY BRACKET ORNAMENT
+2775; 2774 # MEDIUM RIGHT CURLY BRACKET ORNAMENT
+27C3; 27C4 # OPEN SUBSET
+27C4; 27C3 # OPEN SUPERSET
+27C5; 27C6 # LEFT S-SHAPED BAG DELIMITER
+27C6; 27C5 # RIGHT S-SHAPED BAG DELIMITER
+27C8; 27C9 # REVERSE SOLIDUS PRECEDING SUBSET
+27C9; 27C8 # SUPERSET PRECEDING SOLIDUS
+27D5; 27D6 # LEFT OUTER JOIN
+27D6; 27D5 # RIGHT OUTER JOIN
+27DD; 27DE # LONG RIGHT TACK
+27DE; 27DD # LONG LEFT TACK
+27E2; 27E3 # WHITE CONCAVE-SIDED DIAMOND WITH LEFTWARDS TICK
+27E3; 27E2 # WHITE CONCAVE-SIDED DIAMOND WITH RIGHTWARDS TICK
+27E4; 27E5 # WHITE SQUARE WITH LEFTWARDS TICK
+27E5; 27E4 # WHITE SQUARE WITH RIGHTWARDS TICK
+27E6; 27E7 # MATHEMATICAL LEFT WHITE SQUARE BRACKET
+27E7; 27E6 # MATHEMATICAL RIGHT WHITE SQUARE BRACKET
+27E8; 27E9 # MATHEMATICAL LEFT ANGLE BRACKET
+27E9; 27E8 # MATHEMATICAL RIGHT ANGLE BRACKET
+27EA; 27EB # MATHEMATICAL LEFT DOUBLE ANGLE BRACKET
+27EB; 27EA # MATHEMATICAL RIGHT DOUBLE ANGLE BRACKET
+27EC; 27ED # MATHEMATICAL LEFT WHITE TORTOISE SHELL BRACKET
+27ED; 27EC # MATHEMATICAL RIGHT WHITE TORTOISE SHELL BRACKET
+27EE; 27EF # MATHEMATICAL LEFT FLATTENED PARENTHESIS
+27EF; 27EE # MATHEMATICAL RIGHT FLATTENED PARENTHESIS
+2983; 2984 # LEFT WHITE CURLY BRACKET
+2984; 2983 # RIGHT WHITE CURLY BRACKET
+2985; 2986 # LEFT WHITE PARENTHESIS
+2986; 2985 # RIGHT WHITE PARENTHESIS
+2987; 2988 # Z NOTATION LEFT IMAGE BRACKET
+2988; 2987 # Z NOTATION RIGHT IMAGE BRACKET
+2989; 298A # Z NOTATION LEFT BINDING BRACKET
+298A; 2989 # Z NOTATION RIGHT BINDING BRACKET
+298B; 298C # LEFT SQUARE BRACKET WITH UNDERBAR
+298C; 298B # RIGHT SQUARE BRACKET WITH UNDERBAR
+298D; 2990 # LEFT SQUARE BRACKET WITH TICK IN TOP CORNER
+298E; 298F # RIGHT SQUARE BRACKET WITH TICK IN BOTTOM CORNER
+298F; 298E # LEFT SQUARE BRACKET WITH TICK IN BOTTOM CORNER
+2990; 298D # RIGHT SQUARE BRACKET WITH TICK IN TOP CORNER
+2991; 2992 # LEFT ANGLE BRACKET WITH DOT
+2992; 2991 # RIGHT ANGLE BRACKET WITH DOT
+2993; 2994 # LEFT ARC LESS-THAN BRACKET
+2994; 2993 # RIGHT ARC GREATER-THAN BRACKET
+2995; 2996 # DOUBLE LEFT ARC GREATER-THAN BRACKET
+2996; 2995 # DOUBLE RIGHT ARC LESS-THAN BRACKET
+2997; 2998 # LEFT BLACK TORTOISE SHELL BRACKET
+2998; 2997 # RIGHT BLACK TORTOISE SHELL BRACKET
+29B8; 2298 # CIRCLED REVERSE SOLIDUS
+29C0; 29C1 # CIRCLED LESS-THAN
+29C1; 29C0 # CIRCLED GREATER-THAN
+29C4; 29C5 # SQUARED RISING DIAGONAL SLASH
+29C5; 29C4 # SQUARED FALLING DIAGONAL SLASH
+29CF; 29D0 # LEFT TRIANGLE BESIDE VERTICAL BAR
+29D0; 29CF # VERTICAL BAR BESIDE RIGHT TRIANGLE
+29D1; 29D2 # BOWTIE WITH LEFT HALF BLACK
+29D2; 29D1 # BOWTIE WITH RIGHT HALF BLACK
+29D4; 29D5 # TIMES WITH LEFT HALF BLACK
+29D5; 29D4 # TIMES WITH RIGHT HALF BLACK
+29D8; 29D9 # LEFT WIGGLY FENCE
+29D9; 29D8 # RIGHT WIGGLY FENCE
+29DA; 29DB # LEFT DOUBLE WIGGLY FENCE
+29DB; 29DA # RIGHT DOUBLE WIGGLY FENCE
+29F5; 2215 # REVERSE SOLIDUS OPERATOR
+29F8; 29F9 # BIG SOLIDUS
+29F9; 29F8 # BIG REVERSE SOLIDUS
+29FC; 29FD # LEFT-POINTING CURVED ANGLE BRACKET
+29FD; 29FC # RIGHT-POINTING CURVED ANGLE BRACKET
+2A2B; 2A2C # MINUS SIGN WITH FALLING DOTS
+2A2C; 2A2B # MINUS SIGN WITH RISING DOTS
+2A2D; 2A2E # PLUS SIGN IN LEFT HALF CIRCLE
+2A2E; 2A2D # PLUS SIGN IN RIGHT HALF CIRCLE
+2A34; 2A35 # MULTIPLICATION SIGN IN LEFT HALF CIRCLE
+2A35; 2A34 # MULTIPLICATION SIGN IN RIGHT HALF CIRCLE
+2A3C; 2A3D # INTERIOR PRODUCT
+2A3D; 2A3C # RIGHTHAND INTERIOR PRODUCT
+2A64; 2A65 # Z NOTATION DOMAIN ANTIRESTRICTION
+2A65; 2A64 # Z NOTATION RANGE ANTIRESTRICTION
+2A79; 2A7A # LESS-THAN WITH CIRCLE INSIDE
+2A7A; 2A79 # GREATER-THAN WITH CIRCLE INSIDE
+2A7D; 2A7E # LESS-THAN OR SLANTED EQUAL TO
+2A7E; 2A7D # GREATER-THAN OR SLANTED EQUAL TO
+2A7F; 2A80 # LESS-THAN OR SLANTED EQUAL TO WITH DOT INSIDE
+2A80; 2A7F # GREATER-THAN OR SLANTED EQUAL TO WITH DOT INSIDE
+2A81; 2A82 # LESS-THAN OR SLANTED EQUAL TO WITH DOT ABOVE
+2A82; 2A81 # GREATER-THAN OR SLANTED EQUAL TO WITH DOT ABOVE
+2A83; 2A84 # LESS-THAN OR SLANTED EQUAL TO WITH DOT ABOVE RIGHT
+2A84; 2A83 # GREATER-THAN OR SLANTED EQUAL TO WITH DOT ABOVE LEFT
+2A8B; 2A8C # LESS-THAN ABOVE DOUBLE-LINE EQUAL ABOVE GREATER-THAN
+2A8C; 2A8B # GREATER-THAN ABOVE DOUBLE-LINE EQUAL ABOVE LESS-THAN
+2A91; 2A92 # LESS-THAN ABOVE GREATER-THAN ABOVE DOUBLE-LINE EQUAL
+2A92; 2A91 # GREATER-THAN ABOVE LESS-THAN ABOVE DOUBLE-LINE EQUAL
+2A93; 2A94 # LESS-THAN ABOVE SLANTED EQUAL ABOVE GREATER-THAN ABOVE SLANTED EQUAL
+2A94; 2A93 # GREATER-THAN ABOVE SLANTED EQUAL ABOVE LESS-THAN ABOVE SLANTED EQUAL
+2A95; 2A96 # SLANTED EQUAL TO OR LESS-THAN
+2A96; 2A95 # SLANTED EQUAL TO OR GREATER-THAN
+2A97; 2A98 # SLANTED EQUAL TO OR LESS-THAN WITH DOT INSIDE
+2A98; 2A97 # SLANTED EQUAL TO OR GREATER-THAN WITH DOT INSIDE
+2A99; 2A9A # DOUBLE-LINE EQUAL TO OR LESS-THAN
+2A9A; 2A99 # DOUBLE-LINE EQUAL TO OR GREATER-THAN
+2A9B; 2A9C # DOUBLE-LINE SLANTED EQUAL TO OR LESS-THAN
+2A9C; 2A9B # DOUBLE-LINE SLANTED EQUAL TO OR GREATER-THAN
+2AA1; 2AA2 # DOUBLE NESTED LESS-THAN
+2AA2; 2AA1 # DOUBLE NESTED GREATER-THAN
+2AA6; 2AA7 # LESS-THAN CLOSED BY CURVE
+2AA7; 2AA6 # GREATER-THAN CLOSED BY CURVE
+2AA8; 2AA9 # LESS-THAN CLOSED BY CURVE ABOVE SLANTED EQUAL
+2AA9; 2AA8 # GREATER-THAN CLOSED BY CURVE ABOVE SLANTED EQUAL
+2AAA; 2AAB # SMALLER THAN
+2AAB; 2AAA # LARGER THAN
+2AAC; 2AAD # SMALLER THAN OR EQUAL TO
+2AAD; 2AAC # LARGER THAN OR EQUAL TO
+2AAF; 2AB0 # PRECEDES ABOVE SINGLE-LINE EQUALS SIGN
+2AB0; 2AAF # SUCCEEDS ABOVE SINGLE-LINE EQUALS SIGN
+2AB3; 2AB4 # PRECEDES ABOVE EQUALS SIGN
+2AB4; 2AB3 # SUCCEEDS ABOVE EQUALS SIGN
+2ABB; 2ABC # DOUBLE PRECEDES
+2ABC; 2ABB # DOUBLE SUCCEEDS
+2ABD; 2ABE # SUBSET WITH DOT
+2ABE; 2ABD # SUPERSET WITH DOT
+2ABF; 2AC0 # SUBSET WITH PLUS SIGN BELOW
+2AC0; 2ABF # SUPERSET WITH PLUS SIGN BELOW
+2AC1; 2AC2 # SUBSET WITH MULTIPLICATION SIGN BELOW
+2AC2; 2AC1 # SUPERSET WITH MULTIPLICATION SIGN BELOW
+2AC3; 2AC4 # SUBSET OF OR EQUAL TO WITH DOT ABOVE
+2AC4; 2AC3 # SUPERSET OF OR EQUAL TO WITH DOT ABOVE
+2AC5; 2AC6 # SUBSET OF ABOVE EQUALS SIGN
+2AC6; 2AC5 # SUPERSET OF ABOVE EQUALS SIGN
+2ACD; 2ACE # SQUARE LEFT OPEN BOX OPERATOR
+2ACE; 2ACD # SQUARE RIGHT OPEN BOX OPERATOR
+2ACF; 2AD0 # CLOSED SUBSET
+2AD0; 2ACF # CLOSED SUPERSET
+2AD1; 2AD2 # CLOSED SUBSET OR EQUAL TO
+2AD2; 2AD1 # CLOSED SUPERSET OR EQUAL TO
+2AD3; 2AD4 # SUBSET ABOVE SUPERSET
+2AD4; 2AD3 # SUPERSET ABOVE SUBSET
+2AD5; 2AD6 # SUBSET ABOVE SUBSET
+2AD6; 2AD5 # SUPERSET ABOVE SUPERSET
+2ADE; 22A6 # SHORT LEFT TACK
+2AE3; 22A9 # DOUBLE VERTICAL BAR LEFT TURNSTILE
+2AE4; 22A8 # VERTICAL BAR DOUBLE LEFT TURNSTILE
+2AE5; 22AB # DOUBLE VERTICAL BAR DOUBLE LEFT TURNSTILE
+2AEC; 2AED # DOUBLE STROKE NOT SIGN
+2AED; 2AEC # REVERSED DOUBLE STROKE NOT SIGN
+2AF7; 2AF8 # TRIPLE NESTED LESS-THAN
+2AF8; 2AF7 # TRIPLE NESTED GREATER-THAN
+2AF9; 2AFA # DOUBLE-LINE SLANTED LESS-THAN OR EQUAL TO
+2AFA; 2AF9 # DOUBLE-LINE SLANTED GREATER-THAN OR EQUAL TO
+2E02; 2E03 # LEFT SUBSTITUTION BRACKET
+2E03; 2E02 # RIGHT SUBSTITUTION BRACKET
+2E04; 2E05 # LEFT DOTTED SUBSTITUTION BRACKET
+2E05; 2E04 # RIGHT DOTTED SUBSTITUTION BRACKET
+2E09; 2E0A # LEFT TRANSPOSITION BRACKET
+2E0A; 2E09 # RIGHT TRANSPOSITION BRACKET
+2E0C; 2E0D # LEFT RAISED OMISSION BRACKET
+2E0D; 2E0C # RIGHT RAISED OMISSION BRACKET
+2E1C; 2E1D # LEFT LOW PARAPHRASE BRACKET
+2E1D; 2E1C # RIGHT LOW PARAPHRASE BRACKET
+2E20; 2E21 # LEFT VERTICAL BAR WITH QUILL
+2E21; 2E20 # RIGHT VERTICAL BAR WITH QUILL
+2E22; 2E23 # TOP LEFT HALF BRACKET
+2E23; 2E22 # TOP RIGHT HALF BRACKET
+2E24; 2E25 # BOTTOM LEFT HALF BRACKET
+2E25; 2E24 # BOTTOM RIGHT HALF BRACKET
+2E26; 2E27 # LEFT SIDEWAYS U BRACKET
+2E27; 2E26 # RIGHT SIDEWAYS U BRACKET
+2E28; 2E29 # LEFT DOUBLE PARENTHESIS
+2E29; 2E28 # RIGHT DOUBLE PARENTHESIS
+3008; 3009 # LEFT ANGLE BRACKET
+3009; 3008 # RIGHT ANGLE BRACKET
+300A; 300B # LEFT DOUBLE ANGLE BRACKET
+300B; 300A # RIGHT DOUBLE ANGLE BRACKET
+300C; 300D # [BEST FIT] LEFT CORNER BRACKET
+300D; 300C # [BEST FIT] RIGHT CORNER BRACKET
+300E; 300F # [BEST FIT] LEFT WHITE CORNER BRACKET
+300F; 300E # [BEST FIT] RIGHT WHITE CORNER BRACKET
+3010; 3011 # LEFT BLACK LENTICULAR BRACKET
+3011; 3010 # RIGHT BLACK LENTICULAR BRACKET
+3014; 3015 # LEFT TORTOISE SHELL BRACKET
+3015; 3014 # RIGHT TORTOISE SHELL BRACKET
+3016; 3017 # LEFT WHITE LENTICULAR BRACKET
+3017; 3016 # RIGHT WHITE LENTICULAR BRACKET
+3018; 3019 # LEFT WHITE TORTOISE SHELL BRACKET
+3019; 3018 # RIGHT WHITE TORTOISE SHELL BRACKET
+301A; 301B # LEFT WHITE SQUARE BRACKET
+301B; 301A # RIGHT WHITE SQUARE BRACKET
+FE59; FE5A # SMALL LEFT PARENTHESIS
+FE5A; FE59 # SMALL RIGHT PARENTHESIS
+FE5B; FE5C # SMALL LEFT CURLY BRACKET
+FE5C; FE5B # SMALL RIGHT CURLY BRACKET
+FE5D; FE5E # SMALL LEFT TORTOISE SHELL BRACKET
+FE5E; FE5D # SMALL RIGHT TORTOISE SHELL BRACKET
+FE64; FE65 # SMALL LESS-THAN SIGN
+FE65; FE64 # SMALL GREATER-THAN SIGN
+FF08; FF09 # FULLWIDTH LEFT PARENTHESIS
+FF09; FF08 # FULLWIDTH RIGHT PARENTHESIS
+FF1C; FF1E # FULLWIDTH LESS-THAN SIGN
+FF1E; FF1C # FULLWIDTH GREATER-THAN SIGN
+FF3B; FF3D # FULLWIDTH LEFT SQUARE BRACKET
+FF3D; FF3B # FULLWIDTH RIGHT SQUARE BRACKET
+FF5B; FF5D # FULLWIDTH LEFT CURLY BRACKET
+FF5D; FF5B # FULLWIDTH RIGHT CURLY BRACKET
+FF5F; FF60 # FULLWIDTH LEFT WHITE PARENTHESIS
+FF60; FF5F # FULLWIDTH RIGHT WHITE PARENTHESIS
+FF62; FF63 # [BEST FIT] HALFWIDTH LEFT CORNER BRACKET
+FF63; FF62 # [BEST FIT] HALFWIDTH RIGHT CORNER BRACKET
+
+# The following characters have no appropriate mirroring character.
+# For these characters it is up to the rendering system
+#   to provide mirrored glyphs.
+
+# 2140; DOUBLE-STRUCK N-ARY SUMMATION
+# 2201; COMPLEMENT
+# 2202; PARTIAL DIFFERENTIAL
+# 2203; THERE EXISTS
+# 2204; THERE DOES NOT EXIST
+# 2211; N-ARY SUMMATION
+# 2216; SET MINUS
+# 221A; SQUARE ROOT
+# 221B; CUBE ROOT
+# 221C; FOURTH ROOT
+# 221D; PROPORTIONAL TO
+# 221F; RIGHT ANGLE
+# 2220; ANGLE
+# 2221; MEASURED ANGLE
+# 2222; SPHERICAL ANGLE
+# 2224; DOES NOT DIVIDE
+# 2226; NOT PARALLEL TO
+# 222B; INTEGRAL
+# 222C; DOUBLE INTEGRAL
+# 222D; TRIPLE INTEGRAL
+# 222E; CONTOUR INTEGRAL
+# 222F; SURFACE INTEGRAL
+# 2230; VOLUME INTEGRAL
+# 2231; CLOCKWISE INTEGRAL
+# 2232; CLOCKWISE CONTOUR INTEGRAL
+# 2233; ANTICLOCKWISE CONTOUR INTEGRAL
+# 2239; EXCESS
+# 223B; HOMOTHETIC
+# 223E; INVERTED LAZY S
+# 223F; SINE WAVE
+# 2240; WREATH PRODUCT
+# 2241; NOT TILDE
+# 2242; MINUS TILDE
+# 2244; NOT ASYMPTOTICALLY EQUAL TO
+# 2245; APPROXIMATELY EQUAL TO
+# 2246; APPROXIMATELY BUT NOT ACTUALLY EQUAL TO
+# 2247; NEITHER APPROXIMATELY NOR ACTUALLY EQUAL TO
+# 2248; ALMOST EQUAL TO
+# 2249; NOT ALMOST EQUAL TO
+# 224A; ALMOST EQUAL OR EQUAL TO
+# 224B; TRIPLE TILDE
+# 224C; ALL EQUAL TO
+# 225F; QUESTIONED EQUAL TO
+# 2260; NOT EQUAL TO
+# 2262; NOT IDENTICAL TO
+# 228C; MULTISET
+# 22A7; MODELS
+# 22AA; TRIPLE VERTICAL BAR RIGHT TURNSTILE
+# 22AC; DOES NOT PROVE
+# 22AD; NOT TRUE
+# 22AE; DOES NOT FORCE
+# 22AF; NEGATED DOUBLE VERTICAL BAR DOUBLE RIGHT TURNSTILE
+# 22B8; MULTIMAP
+# 22BE; RIGHT ANGLE WITH ARC
+# 22BF; RIGHT TRIANGLE
+# 22F5; ELEMENT OF WITH DOT ABOVE
+# 22F8; ELEMENT OF WITH UNDERBAR
+# 22F9; ELEMENT OF WITH TWO HORIZONTAL STROKES
+# 22FF; Z NOTATION BAG MEMBERSHIP
+# 2320; TOP HALF INTEGRAL
+# 2321; BOTTOM HALF INTEGRAL
+# 27CC; LONG DIVISION
+# 27C0; THREE DIMENSIONAL ANGLE
+# 27D3; LOWER RIGHT CORNER WITH DOT
+# 27D4; UPPER LEFT CORNER WITH DOT
+# 27DC; LEFT MULTIMAP
+# 299B; MEASURED ANGLE OPENING LEFT
+# 299C; RIGHT ANGLE VARIANT WITH SQUARE
+# 299D; MEASURED RIGHT ANGLE WITH DOT
+# 299E; ANGLE WITH S INSIDE
+# 299F; ACUTE ANGLE
+# 29A0; SPHERICAL ANGLE OPENING LEFT
+# 29A1; SPHERICAL ANGLE OPENING UP
+# 29A2; TURNED ANGLE
+# 29A3; REVERSED ANGLE
+# 29A4; ANGLE WITH UNDERBAR
+# 29A5; REVERSED ANGLE WITH UNDERBAR
+# 29A6; OBLIQUE ANGLE OPENING UP
+# 29A7; OBLIQUE ANGLE OPENING DOWN
+# 29A8; MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING UP AND RIGHT
+# 29A9; MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING UP AND LEFT
+# 29AA; MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING DOWN AND RIGHT
+# 29AB; MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING DOWN AND LEFT
+# 29AC; MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING RIGHT AND UP
+# 29AD; MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING LEFT AND UP
+# 29AE; MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING RIGHT AND DOWN
+# 29AF; MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING LEFT AND DOWN
+# 29C2; CIRCLE WITH SMALL CIRCLE TO THE RIGHT
+# 29C3; CIRCLE WITH TWO HORIZONTAL STROKES TO THE RIGHT
+# 29C9; TWO JOINED SQUARES
+# 29CE; RIGHT TRIANGLE ABOVE LEFT TRIANGLE
+# 29DC; INCOMPLETE INFINITY
+# 29E1; INCREASES AS
+# 29E3; EQUALS SIGN AND SLANTED PARALLEL
+# 29E4; EQUALS SIGN AND SLANTED PARALLEL WITH TILDE ABOVE
+# 29E5; IDENTICAL TO AND SLANTED PARALLEL
+# 29E8; DOWN-POINTING TRIANGLE WITH LEFT HALF BLACK
+# 29E9; DOWN-POINTING TRIANGLE WITH RIGHT HALF BLACK
+# 29F4; RULE-DELAYED
+# 29F6; SOLIDUS WITH OVERBAR
+# 29F7; REVERSE SOLIDUS WITH HORIZONTAL STROKE
+# 2A0A; MODULO TWO SUM
+# 2A0B; SUMMATION WITH INTEGRAL
+# 2A0C; QUADRUPLE INTEGRAL OPERATOR
+# 2A0D; FINITE PART INTEGRAL
+# 2A0E; INTEGRAL WITH DOUBLE STROKE
+# 2A0F; INTEGRAL AVERAGE WITH SLASH
+# 2A10; CIRCULATION FUNCTION
+# 2A11; ANTICLOCKWISE INTEGRATION
+# 2A12; LINE INTEGRATION WITH RECTANGULAR PATH AROUND POLE
+# 2A13; LINE INTEGRATION WITH SEMICIRCULAR PATH AROUND POLE
+# 2A14; LINE INTEGRATION NOT INCLUDING THE POLE
+# 2A15; INTEGRAL AROUND A POINT OPERATOR
+# 2A16; QUATERNION INTEGRAL OPERATOR
+# 2A17; INTEGRAL WITH LEFTWARDS ARROW WITH HOOK
+# 2A18; INTEGRAL WITH TIMES SIGN
+# 2A19; INTEGRAL WITH INTERSECTION
+# 2A1A; INTEGRAL WITH UNION
+# 2A1B; INTEGRAL WITH OVERBAR
+# 2A1C; INTEGRAL WITH UNDERBAR
+# 2A1E; LARGE LEFT TRIANGLE OPERATOR
+# 2A1F; Z NOTATION SCHEMA COMPOSITION
+# 2A20; Z NOTATION SCHEMA PIPING
+# 2A21; Z NOTATION SCHEMA PROJECTION
+# 2A24; PLUS SIGN WITH TILDE ABOVE
+# 2A26; PLUS SIGN WITH TILDE BELOW
+# 2A29; MINUS SIGN WITH COMMA ABOVE
+# 2A3E; Z NOTATION RELATIONAL COMPOSITION
+# 2A57; SLOPING LARGE OR
+# 2A58; SLOPING LARGE AND
+# 2A6A; TILDE OPERATOR WITH DOT ABOVE
+# 2A6B; TILDE OPERATOR WITH RISING DOTS
+# 2A6C; SIMILAR MINUS SIMILAR
+# 2A6D; CONGRUENT WITH DOT ABOVE
+# 2A6F; ALMOST EQUAL TO WITH CIRCUMFLEX ACCENT
+# 2A70; APPROXIMATELY EQUAL OR EQUAL TO
+# 2A73; EQUALS SIGN ABOVE TILDE OPERATOR
+# 2A74; DOUBLE COLON EQUAL
+# 2A7B; LESS-THAN WITH QUESTION MARK ABOVE
+# 2A7C; GREATER-THAN WITH QUESTION MARK ABOVE
+# 2A85; LESS-THAN OR APPROXIMATE
+# 2A86; GREATER-THAN OR APPROXIMATE
+# 2A87; LESS-THAN AND SINGLE-LINE NOT EQUAL TO
+# 2A88; GREATER-THAN AND SINGLE-LINE NOT EQUAL TO
+# 2A89; LESS-THAN AND NOT APPROXIMATE
+# 2A8A; GREATER-THAN AND NOT APPROXIMATE
+# 2A8D; LESS-THAN ABOVE SIMILAR OR EQUAL
+# 2A8E; GREATER-THAN ABOVE SIMILAR OR EQUAL
+# 2A8F; LESS-THAN ABOVE SIMILAR ABOVE GREATER-THAN
+# 2A90; GREATER-THAN ABOVE SIMILAR ABOVE LESS-THAN
+# 2A9D; SIMILAR OR LESS-THAN
+# 2A9E; SIMILAR OR GREATER-THAN
+# 2A9F; SIMILAR ABOVE LESS-THAN ABOVE EQUALS SIGN
+# 2AA0; SIMILAR ABOVE GREATER-THAN ABOVE EQUALS SIGN
+# 2AA3; DOUBLE NESTED LESS-THAN WITH UNDERBAR
+# 2AB1; PRECEDES ABOVE SINGLE-LINE NOT EQUAL TO
+# 2AB2; SUCCEEDS ABOVE SINGLE-LINE NOT EQUAL TO
+# 2AB5; PRECEDES ABOVE NOT EQUAL TO
+# 2AB6; SUCCEEDS ABOVE NOT EQUAL TO
+# 2AB7; PRECEDES ABOVE ALMOST EQUAL TO
+# 2AB8; SUCCEEDS ABOVE ALMOST EQUAL TO
+# 2AB9; PRECEDES ABOVE NOT ALMOST EQUAL TO
+# 2ABA; SUCCEEDS ABOVE NOT ALMOST EQUAL TO
+# 2AC7; SUBSET OF ABOVE TILDE OPERATOR
+# 2AC8; SUPERSET OF ABOVE TILDE OPERATOR
+# 2AC9; SUBSET OF ABOVE ALMOST EQUAL TO
+# 2ACA; SUPERSET OF ABOVE ALMOST EQUAL TO
+# 2ACB; SUBSET OF ABOVE NOT EQUAL TO
+# 2ACC; SUPERSET OF ABOVE NOT EQUAL TO
+# 2ADC; FORKING
+# 2AE2; VERTICAL BAR TRIPLE RIGHT TURNSTILE
+# 2AE6; LONG DASH FROM LEFT MEMBER OF DOUBLE VERTICAL
+# 2AEE; DOES NOT DIVIDE WITH REVERSED NEGATION SLASH
+# 2AF3; PARALLEL WITH TILDE OPERATOR
+# 2AFB; TRIPLE SOLIDUS BINARY RELATION
+# 2AFD; DOUBLE SOLIDUS OPERATOR
+# 1D6DB; MATHEMATICAL BOLD PARTIAL DIFFERENTIAL
+# 1D715; MATHEMATICAL ITALIC PARTIAL DIFFERENTIAL
+# 1D74F; MATHEMATICAL BOLD ITALIC PARTIAL DIFFERENTIAL
+# 1D789; MATHEMATICAL SANS-SERIF BOLD PARTIAL DIFFERENTIAL
+# 1D7C3; MATHEMATICAL SANS-SERIF BOLD ITALIC PARTIAL DIFFERENTIAL
+
+# EOF
index 2b31e6ed94908a29a4ca28366b719dfa2d39f6bd..e7b0fbe4bf9a9e672cb54875ea730a50c20fd8b6 100644 (file)
@@ -21,9 +21,9 @@
 
 EMACS = ../../src/emacs
 DSTDIR = ../../lisp/international
-RUNEMACS = ${EMACS} -Q --multibyte -batch
+RUNEMACS = ${EMACS} -Q -batch
 
-all: ${DSTDIR}/charprop.el
+all: ${DSTDIR}/charprop.el ../../src/biditype.h ../../src/bidimirror.h
 
 .el.elc:
        ${RUNEMACS} -batch -f batch-byte-compile $<
@@ -37,6 +37,12 @@ ${DSTDIR}/charprop.el: unidata-gen.elc unidata.txt
        cd ${DSTDIR}; \
        ${RUNEMACS} -batch --load $${ELC} -f unidata-gen-files $${DATA}
 
+../../src/biditype.h: UnicodeData.txt
+       gawk -F";" -f biditype.awk $< > $@
+
+../../src/bidimirror.h: BidiMirroring.txt
+       gawk -F"[; ]+" -f bidimirror.awk $< > $@
+
 install: charprop.el
        cp charprop.el ${DSTDIR}
        cp `sed -n 's/^;; FILE: //p' < charprop.el` ${DSTDIR}
index 6b01d90a7710202db88ff7a450f37c6c5af93b4a..95cff5311b3c0097a3d845b71d355577478dda05 100644 (file)
 0262;LATIN LETTER SMALL CAPITAL G;Ll;0;L;;;;;N;;;;;
 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;;;;;
+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;;;;
 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
 0523;CYRILLIC SMALL LETTER EN WITH MIDDLE HOOK;Ll;0;L;;;;;N;;;0522;;0522
 0524;CYRILLIC CAPITAL LETTER PE WITH DESCENDER;Lu;0;L;;;;;N;;;;0525;
 0525;CYRILLIC SMALL LETTER PE WITH DESCENDER;Ll;0;L;;;;;N;;;0524;;0524
+0526;CYRILLIC CAPITAL LETTER SHHA WITH DESCENDER;Lu;0;L;;;;;N;;;;0527;
+0527;CYRILLIC SMALL LETTER SHHA WITH DESCENDER;Ll;0;L;;;;;N;;;0526;;0526
 0531;ARMENIAN CAPITAL LETTER AYB;Lu;0;L;;;;;N;;;;0561;
 0532;ARMENIAN CAPITAL LETTER BEN;Lu;0;L;;;;;N;;;;0562;
 0533;ARMENIAN CAPITAL LETTER GIM;Lu;0;L;;;;;N;;;;0563;
 061B;ARABIC SEMICOLON;Po;0;AL;;;;;N;;;;;
 061E;ARABIC TRIPLE DOT PUNCTUATION MARK;Po;0;AL;;;;;N;;;;;
 061F;ARABIC QUESTION MARK;Po;0;AL;;;;;N;;;;;
+0620;ARABIC LETTER KASHMIRI YEH;Lo;0;AL;;;;;N;;;;;
 0621;ARABIC LETTER HAMZA;Lo;0;AL;;;;;N;ARABIC LETTER HAMZAH;;;;
 0622;ARABIC LETTER ALEF WITH MADDA ABOVE;Lo;0;AL;0627 0653;;;;N;ARABIC LETTER MADDAH ON ALEF;;;;
 0623;ARABIC LETTER ALEF WITH HAMZA ABOVE;Lo;0;AL;0627 0654;;;;N;ARABIC LETTER HAMZAH ON ALEF;;;;
 065C;ARABIC VOWEL SIGN DOT BELOW;Mn;220;NSM;;;;;N;;;;;
 065D;ARABIC REVERSED DAMMA;Mn;230;NSM;;;;;N;;;;;
 065E;ARABIC FATHA WITH TWO DOTS;Mn;230;NSM;;;;;N;;;;;
+065F;ARABIC WAVY HAMZA BELOW;Mn;220;NSM;;;;;N;;;;;
 0660;ARABIC-INDIC DIGIT ZERO;Nd;0;AN;;0;0;0;N;;;;;
 0661;ARABIC-INDIC DIGIT ONE;Nd;0;AN;;1;1;1;N;;;;;
 0662;ARABIC-INDIC DIGIT TWO;Nd;0;AN;;2;2;2;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;BN;;;;;N;;;;;
+070F;SYRIAC ABBREVIATION MARK;Cf;0;AN;;;;;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;;;;;
 083C;SAMARITAN PUNCTUATION ARKAANU;Po;0;R;;;;;N;;;;;
 083D;SAMARITAN PUNCTUATION SOF MASHFAAT;Po;0;R;;;;;N;;;;;
 083E;SAMARITAN PUNCTUATION ANNAAU;Po;0;R;;;;;N;;;;;
+0840;MANDAIC LETTER HALQA;Lo;0;R;;;;;N;;;;;
+0841;MANDAIC LETTER AB;Lo;0;R;;;;;N;;;;;
+0842;MANDAIC LETTER AG;Lo;0;R;;;;;N;;;;;
+0843;MANDAIC LETTER AD;Lo;0;R;;;;;N;;;;;
+0844;MANDAIC LETTER AH;Lo;0;R;;;;;N;;;;;
+0845;MANDAIC LETTER USHENNA;Lo;0;R;;;;;N;;;;;
+0846;MANDAIC LETTER AZ;Lo;0;R;;;;;N;;;;;
+0847;MANDAIC LETTER IT;Lo;0;R;;;;;N;;;;;
+0848;MANDAIC LETTER ATT;Lo;0;R;;;;;N;;;;;
+0849;MANDAIC LETTER AKSA;Lo;0;R;;;;;N;;;;;
+084A;MANDAIC LETTER AK;Lo;0;R;;;;;N;;;;;
+084B;MANDAIC LETTER AL;Lo;0;R;;;;;N;;;;;
+084C;MANDAIC LETTER AM;Lo;0;R;;;;;N;;;;;
+084D;MANDAIC LETTER AN;Lo;0;R;;;;;N;;;;;
+084E;MANDAIC LETTER AS;Lo;0;R;;;;;N;;;;;
+084F;MANDAIC LETTER IN;Lo;0;R;;;;;N;;;;;
+0850;MANDAIC LETTER AP;Lo;0;R;;;;;N;;;;;
+0851;MANDAIC LETTER ASZ;Lo;0;R;;;;;N;;;;;
+0852;MANDAIC LETTER AQ;Lo;0;R;;;;;N;;;;;
+0853;MANDAIC LETTER AR;Lo;0;R;;;;;N;;;;;
+0854;MANDAIC LETTER ASH;Lo;0;R;;;;;N;;;;;
+0855;MANDAIC LETTER AT;Lo;0;R;;;;;N;;;;;
+0856;MANDAIC LETTER DUSHENNA;Lo;0;R;;;;;N;;;;;
+0857;MANDAIC LETTER KAD;Lo;0;R;;;;;N;;;;;
+0858;MANDAIC LETTER AIN;Lo;0;R;;;;;N;;;;;
+0859;MANDAIC AFFRICATION MARK;Mn;220;NSM;;;;;N;;;;;
+085A;MANDAIC VOCALIZATION MARK;Mn;220;NSM;;;;;N;;;;;
+085B;MANDAIC GEMINATION MARK;Mn;220;NSM;;;;;N;;;;;
+085E;MANDAIC PUNCTUATION;Po;0;R;;;;;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;;;;;
 0937;DEVANAGARI LETTER SSA;Lo;0;L;;;;;N;;;;;
 0938;DEVANAGARI LETTER SA;Lo;0;L;;;;;N;;;;;
 0939;DEVANAGARI LETTER HA;Lo;0;L;;;;;N;;;;;
+093A;DEVANAGARI VOWEL SIGN OE;Mn;0;NSM;;;;;N;;;;;
+093B;DEVANAGARI VOWEL SIGN OOE;Mc;0;L;;;;;N;;;;;
 093C;DEVANAGARI SIGN NUKTA;Mn;7;NSM;;;;;N;;;;;
 093D;DEVANAGARI SIGN AVAGRAHA;Lo;0;L;;;;;N;;;;;
 093E;DEVANAGARI VOWEL SIGN AA;Mc;0;L;;;;;N;;;;;
 094C;DEVANAGARI VOWEL SIGN AU;Mc;0;L;;;;;N;;;;;
 094D;DEVANAGARI SIGN VIRAMA;Mn;9;NSM;;;;;N;;;;;
 094E;DEVANAGARI VOWEL SIGN PRISHTHAMATRA E;Mc;0;L;;;;;N;;;;;
+094F;DEVANAGARI VOWEL SIGN AW;Mc;0;L;;;;;N;;;;;
 0950;DEVANAGARI OM;Lo;0;L;;;;;N;;;;;
 0951;DEVANAGARI STRESS SIGN UDATTA;Mn;230;NSM;;;;;N;;;;;
 0952;DEVANAGARI STRESS SIGN ANUDATTA;Mn;220;NSM;;;;;N;;;;;
 0953;DEVANAGARI GRAVE ACCENT;Mn;230;NSM;;;;;N;;;;;
 0954;DEVANAGARI ACUTE ACCENT;Mn;230;NSM;;;;;N;;;;;
 0955;DEVANAGARI VOWEL SIGN CANDRA LONG E;Mn;0;NSM;;;;;N;;;;;
+0956;DEVANAGARI VOWEL SIGN UE;Mn;0;NSM;;;;;N;;;;;
+0957;DEVANAGARI VOWEL SIGN UUE;Mn;0;NSM;;;;;N;;;;;
 0958;DEVANAGARI LETTER QA;Lo;0;L;0915 093C;;;;N;;;;;
 0959;DEVANAGARI LETTER KHHA;Lo;0;L;0916 093C;;;;N;;;;;
 095A;DEVANAGARI LETTER GHHA;Lo;0;L;0917 093C;;;;N;;;;;
 0970;DEVANAGARI ABBREVIATION SIGN;Po;0;L;;;;;N;;;;;
 0971;DEVANAGARI SIGN HIGH SPACING DOT;Lm;0;L;;;;;N;;;;;
 0972;DEVANAGARI LETTER CANDRA A;Lo;0;L;;;;;N;;;;;
+0973;DEVANAGARI LETTER OE;Lo;0;L;;;;;N;;;;;
+0974;DEVANAGARI LETTER OOE;Lo;0;L;;;;;N;;;;;
+0975;DEVANAGARI LETTER AW;Lo;0;L;;;;;N;;;;;
+0976;DEVANAGARI LETTER UE;Lo;0;L;;;;;N;;;;;
+0977;DEVANAGARI LETTER UUE;Lo;0;L;;;;;N;;;;;
 0979;DEVANAGARI LETTER ZHA;Lo;0;L;;;;;N;;;;;
 097A;DEVANAGARI LETTER HEAVY YA;Lo;0;L;;;;;N;;;;;
 097B;DEVANAGARI LETTER GGA;Lo;0;L;;;;;N;;;;;
 0B6F;ORIYA DIGIT NINE;Nd;0;L;;9;9;9;N;;;;;
 0B70;ORIYA ISSHAR;So;0;L;;;;;N;;;;;
 0B71;ORIYA LETTER WA;Lo;0;L;;;;;N;;;;;
+0B72;ORIYA FRACTION ONE QUARTER;No;0;L;;;;1/4;N;;;;;
+0B73;ORIYA FRACTION ONE HALF;No;0;L;;;;1/2;N;;;;;
+0B74;ORIYA FRACTION THREE QUARTERS;No;0;L;;;;3/4;N;;;;;
+0B75;ORIYA FRACTION ONE SIXTEENTH;No;0;L;;;;1/16;N;;;;;
+0B76;ORIYA FRACTION ONE EIGHTH;No;0;L;;;;1/8;N;;;;;
+0B77;ORIYA FRACTION THREE SIXTEENTHS;No;0;L;;;;3/16;N;;;;;
 0B82;TAMIL SIGN ANUSVARA;Mn;0;NSM;;;;;N;;;;;
 0B83;TAMIL SIGN VISARGA;Lo;0;L;;;;;N;;;;;
 0B85;TAMIL LETTER A;Lo;0;L;;;;;N;;;;;
 0CED;KANNADA DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;;
 0CEE;KANNADA DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;;
 0CEF;KANNADA DIGIT NINE;Nd;0;L;;9;9;9;N;;;;;
-0CF1;KANNADA SIGN JIHVAMULIYA;So;0;ON;;;;;N;;;;;
-0CF2;KANNADA SIGN UPADHMANIYA;So;0;ON;;;;;N;;;;;
+0CF1;KANNADA SIGN JIHVAMULIYA;Lo;0;L;;;;;N;;;;;
+0CF2;KANNADA SIGN UPADHMANIYA;Lo;0;L;;;;;N;;;;;
 0D02;MALAYALAM SIGN ANUSVARA;Mc;0;L;;;;;N;;;;;
 0D03;MALAYALAM SIGN VISARGA;Mc;0;L;;;;;N;;;;;
 0D05;MALAYALAM LETTER A;Lo;0;L;;;;;N;;;;;
 0D26;MALAYALAM LETTER DA;Lo;0;L;;;;;N;;;;;
 0D27;MALAYALAM LETTER DHA;Lo;0;L;;;;;N;;;;;
 0D28;MALAYALAM LETTER NA;Lo;0;L;;;;;N;;;;;
+0D29;MALAYALAM LETTER NNNA;Lo;0;L;;;;;N;;;;;
 0D2A;MALAYALAM LETTER PA;Lo;0;L;;;;;N;;;;;
 0D2B;MALAYALAM LETTER PHA;Lo;0;L;;;;;N;;;;;
 0D2C;MALAYALAM LETTER BA;Lo;0;L;;;;;N;;;;;
 0D37;MALAYALAM LETTER SSA;Lo;0;L;;;;;N;;;;;
 0D38;MALAYALAM LETTER SA;Lo;0;L;;;;;N;;;;;
 0D39;MALAYALAM LETTER HA;Lo;0;L;;;;;N;;;;;
+0D3A;MALAYALAM LETTER TTTA;Lo;0;L;;;;;N;;;;;
 0D3D;MALAYALAM SIGN AVAGRAHA;Lo;0;L;;;;;N;;;;;
 0D3E;MALAYALAM VOWEL SIGN AA;Mc;0;L;;;;;N;;;;;
 0D3F;MALAYALAM VOWEL SIGN I;Mc;0;L;;;;;N;;;;;
 0D4B;MALAYALAM VOWEL SIGN OO;Mc;0;L;0D47 0D3E;;;;N;;;;;
 0D4C;MALAYALAM VOWEL SIGN AU;Mc;0;L;0D46 0D57;;;;N;;;;;
 0D4D;MALAYALAM SIGN VIRAMA;Mn;9;NSM;;;;;N;;;;;
+0D4E;MALAYALAM LETTER DOT REPH;Lo;0;L;;;;;N;;;;;
 0D57;MALAYALAM AU LENGTH MARK;Mc;0;L;;;;;N;;;;;
 0D60;MALAYALAM LETTER VOCALIC RR;Lo;0;L;;;;;N;;;;;
 0D61;MALAYALAM LETTER VOCALIC LL;Lo;0;L;;;;;N;;;;;
 0F89;TIBETAN SIGN MCHU CAN;Lo;0;L;;;;;N;;;;;
 0F8A;TIBETAN SIGN GRU CAN RGYINGS;Lo;0;L;;;;;N;;;;;
 0F8B;TIBETAN SIGN GRU MED RGYINGS;Lo;0;L;;;;;N;;;;;
+0F8C;TIBETAN SIGN INVERTED MCHU CAN;Lo;0;L;;;;;N;;;;;
+0F8D;TIBETAN SUBJOINED SIGN LCE TSA CAN;Mn;0;NSM;;;;;N;;;;;
+0F8E;TIBETAN SUBJOINED SIGN MCHU CAN;Mn;0;NSM;;;;;N;;;;;
+0F8F;TIBETAN SUBJOINED SIGN INVERTED MCHU CAN;Mn;0;NSM;;;;;N;;;;;
 0F90;TIBETAN SUBJOINED LETTER KA;Mn;0;NSM;;;;;N;;;;;
 0F91;TIBETAN SUBJOINED LETTER KHA;Mn;0;NSM;;;;;N;;;;;
 0F92;TIBETAN SUBJOINED LETTER GA;Mn;0;NSM;;;;;N;;;;;
 0FD6;LEFT-FACING SVASTI SIGN;So;0;L;;;;;N;;;;;
 0FD7;RIGHT-FACING SVASTI SIGN WITH DOTS;So;0;L;;;;;N;;;;;
 0FD8;LEFT-FACING SVASTI SIGN WITH DOTS;So;0;L;;;;;N;;;;;
+0FD9;TIBETAN MARK LEADING MCHAN RTAGS;Po;0;L;;;;;N;;;;;
+0FDA;TIBETAN MARK TRAILING MCHAN RTAGS;Po;0;L;;;;;N;;;;;
 1000;MYANMAR LETTER KA;Lo;0;L;;;;;N;;;;;
 1001;MYANMAR LETTER KHA;Lo;0;L;;;;;N;;;;;
 1002;MYANMAR LETTER GA;Lo;0;L;;;;;N;;;;;
 1358;ETHIOPIC SYLLABLE RYA;Lo;0;L;;;;;N;;;;;
 1359;ETHIOPIC SYLLABLE MYA;Lo;0;L;;;;;N;;;;;
 135A;ETHIOPIC SYLLABLE FYA;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;;;;;
 1361;ETHIOPIC WORDSPACE;Po;0;L;;;;;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;;;;;
+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;;;;;
+1BC3;BATAK LETTER SIMALUNGUN HA;Lo;0;L;;;;;N;;;;;
+1BC4;BATAK LETTER MANDAILING HA;Lo;0;L;;;;;N;;;;;
+1BC5;BATAK LETTER BA;Lo;0;L;;;;;N;;;;;
+1BC6;BATAK LETTER KARO BA;Lo;0;L;;;;;N;;;;;
+1BC7;BATAK LETTER PA;Lo;0;L;;;;;N;;;;;
+1BC8;BATAK LETTER SIMALUNGUN PA;Lo;0;L;;;;;N;;;;;
+1BC9;BATAK LETTER NA;Lo;0;L;;;;;N;;;;;
+1BCA;BATAK LETTER MANDAILING NA;Lo;0;L;;;;;N;;;;;
+1BCB;BATAK LETTER WA;Lo;0;L;;;;;N;;;;;
+1BCC;BATAK LETTER SIMALUNGUN WA;Lo;0;L;;;;;N;;;;;
+1BCD;BATAK LETTER PAKPAK WA;Lo;0;L;;;;;N;;;;;
+1BCE;BATAK LETTER GA;Lo;0;L;;;;;N;;;;;
+1BCF;BATAK LETTER SIMALUNGUN GA;Lo;0;L;;;;;N;;;;;
+1BD0;BATAK LETTER JA;Lo;0;L;;;;;N;;;;;
+1BD1;BATAK LETTER DA;Lo;0;L;;;;;N;;;;;
+1BD2;BATAK LETTER RA;Lo;0;L;;;;;N;;;;;
+1BD3;BATAK LETTER SIMALUNGUN RA;Lo;0;L;;;;;N;;;;;
+1BD4;BATAK LETTER MA;Lo;0;L;;;;;N;;;;;
+1BD5;BATAK LETTER SIMALUNGUN MA;Lo;0;L;;;;;N;;;;;
+1BD6;BATAK LETTER SOUTHERN TA;Lo;0;L;;;;;N;;;;;
+1BD7;BATAK LETTER NORTHERN TA;Lo;0;L;;;;;N;;;;;
+1BD8;BATAK LETTER SA;Lo;0;L;;;;;N;;;;;
+1BD9;BATAK LETTER SIMALUNGUN SA;Lo;0;L;;;;;N;;;;;
+1BDA;BATAK LETTER MANDAILING SA;Lo;0;L;;;;;N;;;;;
+1BDB;BATAK LETTER YA;Lo;0;L;;;;;N;;;;;
+1BDC;BATAK LETTER SIMALUNGUN YA;Lo;0;L;;;;;N;;;;;
+1BDD;BATAK LETTER NGA;Lo;0;L;;;;;N;;;;;
+1BDE;BATAK LETTER LA;Lo;0;L;;;;;N;;;;;
+1BDF;BATAK LETTER SIMALUNGUN LA;Lo;0;L;;;;;N;;;;;
+1BE0;BATAK LETTER NYA;Lo;0;L;;;;;N;;;;;
+1BE1;BATAK LETTER CA;Lo;0;L;;;;;N;;;;;
+1BE2;BATAK LETTER NDA;Lo;0;L;;;;;N;;;;;
+1BE3;BATAK LETTER MBA;Lo;0;L;;;;;N;;;;;
+1BE4;BATAK LETTER I;Lo;0;L;;;;;N;;;;;
+1BE5;BATAK LETTER U;Lo;0;L;;;;;N;;;;;
+1BE6;BATAK SIGN TOMPI;Mn;7;NSM;;;;;N;;;;;
+1BE7;BATAK VOWEL SIGN E;Mc;0;L;;;;;N;;;;;
+1BE8;BATAK VOWEL SIGN PAKPAK E;Mn;0;NSM;;;;;N;;;;;
+1BE9;BATAK VOWEL SIGN EE;Mn;0;NSM;;;;;N;;;;;
+1BEA;BATAK VOWEL SIGN I;Mc;0;L;;;;;N;;;;;
+1BEB;BATAK VOWEL SIGN KARO I;Mc;0;L;;;;;N;;;;;
+1BEC;BATAK VOWEL SIGN O;Mc;0;L;;;;;N;;;;;
+1BED;BATAK VOWEL SIGN KARO O;Mn;0;NSM;;;;;N;;;;;
+1BEE;BATAK VOWEL SIGN U;Mc;0;L;;;;;N;;;;;
+1BEF;BATAK VOWEL SIGN U FOR SIMALUNGUN SA;Mn;0;NSM;;;;;N;;;;;
+1BF0;BATAK CONSONANT SIGN NG;Mn;0;NSM;;;;;N;;;;;
+1BF1;BATAK CONSONANT SIGN H;Mn;0;NSM;;;;;N;;;;;
+1BF2;BATAK PANGOLAT;Mc;9;L;;;;;N;;;;;
+1BF3;BATAK PANONGONAN;Mc;9;L;;;;;N;;;;;
+1BFC;BATAK SYMBOL BINDU NA METEK;Po;0;L;;;;;N;;;;;
+1BFD;BATAK SYMBOL BINDU PINARBORAS;Po;0;L;;;;;N;;;;;
+1BFE;BATAK SYMBOL BINDU JUDUL;Po;0;L;;;;;N;;;;;
+1BFF;BATAK SYMBOL BINDU PANGOLAT;Po;0;L;;;;;N;;;;;
 1C00;LEPCHA LETTER KA;Lo;0;L;;;;;N;;;;;
 1C01;LEPCHA LETTER KLA;Lo;0;L;;;;;N;;;;;
 1C02;LEPCHA LETTER KHA;Lo;0;L;;;;;N;;;;;
 1DE4;COMBINING LATIN SMALL LETTER S;Mn;230;NSM;;;;;N;;;;;
 1DE5;COMBINING LATIN SMALL LETTER LONG S;Mn;230;NSM;;;;;N;;;;;
 1DE6;COMBINING LATIN SMALL LETTER Z;Mn;230;NSM;;;;;N;;;;;
+1DFC;COMBINING DOUBLE INVERTED BREVE BELOW;Mn;233;NSM;;;;;N;;;;;
 1DFD;COMBINING ALMOST EQUAL TO BELOW;Mn;220;NSM;;;;;N;;;;;
 1DFE;COMBINING LEFT ARROWHEAD ABOVE;Mn;230;NSM;;;;;N;;;;;
 1DFF;COMBINING RIGHT ARROWHEAD AND DOWN ARROWHEAD BELOW;Mn;220;NSM;;;;;N;;;;;
 2092;LATIN SUBSCRIPT SMALL LETTER O;Lm;0;L;<sub> 006F;;;;N;;;;;
 2093;LATIN SUBSCRIPT SMALL LETTER X;Lm;0;L;<sub> 0078;;;;N;;;;;
 2094;LATIN SUBSCRIPT SMALL LETTER SCHWA;Lm;0;L;<sub> 0259;;;;N;;;;;
+2095;LATIN SUBSCRIPT SMALL LETTER H;Lm;0;L;<sub> 0068;;;;N;;;;;
+2096;LATIN SUBSCRIPT SMALL LETTER K;Lm;0;L;<sub> 006B;;;;N;;;;;
+2097;LATIN SUBSCRIPT SMALL LETTER L;Lm;0;L;<sub> 006C;;;;N;;;;;
+2098;LATIN SUBSCRIPT SMALL LETTER M;Lm;0;L;<sub> 006D;;;;N;;;;;
+2099;LATIN SUBSCRIPT SMALL LETTER N;Lm;0;L;<sub> 006E;;;;N;;;;;
+209A;LATIN SUBSCRIPT SMALL LETTER P;Lm;0;L;<sub> 0070;;;;N;;;;;
+209B;LATIN SUBSCRIPT SMALL LETTER S;Lm;0;L;<sub> 0073;;;;N;;;;;
+209C;LATIN SUBSCRIPT SMALL LETTER T;Lm;0;L;<sub> 0074;;;;N;;;;;
 20A0;EURO-CURRENCY SIGN;Sc;0;ET;;;;;N;;;;;
 20A1;COLON SIGN;Sc;0;ET;;;;;N;;;;;
 20A2;CRUZEIRO SIGN;Sc;0;ET;;;;;N;;;;;
 23E6;AC CURRENT;So;0;ON;;;;;N;;;;;
 23E7;ELECTRICAL INTERSECTION;So;0;ON;;;;;N;;;;;
 23E8;DECIMAL EXPONENT SYMBOL;So;0;ON;;;;;N;;;;;
+23E9;BLACK RIGHT-POINTING DOUBLE TRIANGLE;So;0;ON;;;;;N;;;;;
+23EA;BLACK LEFT-POINTING DOUBLE TRIANGLE;So;0;ON;;;;;N;;;;;
+23EB;BLACK UP-POINTING DOUBLE TRIANGLE;So;0;ON;;;;;N;;;;;
+23EC;BLACK DOWN-POINTING DOUBLE TRIANGLE;So;0;ON;;;;;N;;;;;
+23ED;BLACK RIGHT-POINTING DOUBLE TRIANGLE WITH VERTICAL BAR;So;0;ON;;;;;N;;;;;
+23EE;BLACK LEFT-POINTING DOUBLE TRIANGLE WITH VERTICAL BAR;So;0;ON;;;;;N;;;;;
+23EF;BLACK RIGHT-POINTING TRIANGLE WITH DOUBLE VERTICAL BAR;So;0;ON;;;;;N;;;;;
+23F0;ALARM CLOCK;So;0;ON;;;;;N;;;;;
+23F1;STOPWATCH;So;0;ON;;;;;N;;;;;
+23F2;TIMER CLOCK;So;0;ON;;;;;N;;;;;
+23F3;HOURGLASS WITH FLOWING SAND;So;0;ON;;;;;N;;;;;
 2400;SYMBOL FOR NULL;So;0;ON;;;;;N;GRAPHIC FOR NULL;;;;
 2401;SYMBOL FOR START OF HEADING;So;0;ON;;;;;N;GRAPHIC FOR START OF HEADING;;;;
 2402;SYMBOL FOR START OF TEXT;So;0;ON;;;;;N;GRAPHIC FOR START OF TEXT;;;;
 26CB;WHITE DIAMOND IN SQUARE;So;0;ON;;;;;N;;;;;
 26CC;CROSSING LANES;So;0;ON;;;;;N;;;;;
 26CD;DISABLED CAR;So;0;ON;;;;;N;;;;;
+26CE;OPHIUCHUS;So;0;ON;;;;;N;;;;;
 26CF;PICK;So;0;ON;;;;;N;;;;;
 26D0;CAR SLIDING;So;0;ON;;;;;N;;;;;
 26D1;HELMET WITH WHITE CROSS;So;0;ON;;;;;N;;;;;
 26DF;BLACK TRUCK;So;0;ON;;;;;N;;;;;
 26E0;RESTRICTED LEFT ENTRY-1;So;0;ON;;;;;N;;;;;
 26E1;RESTRICTED LEFT ENTRY-2;So;0;ON;;;;;N;;;;;
+26E2;ASTRONOMICAL SYMBOL FOR URANUS;So;0;ON;;;;;N;;;;;
 26E3;HEAVY CIRCLE WITH STROKE AND TWO DOTS ABOVE;So;0;ON;;;;;N;;;;;
+26E4;PENTAGRAM;So;0;ON;;;;;N;;;;;
+26E5;RIGHT-HANDED INTERLACED PENTAGRAM;So;0;ON;;;;;N;;;;;
+26E6;LEFT-HANDED INTERLACED PENTAGRAM;So;0;ON;;;;;N;;;;;
+26E7;INVERTED PENTAGRAM;So;0;ON;;;;;N;;;;;
 26E8;BLACK CROSS ON SHIELD;So;0;ON;;;;;N;;;;;
 26E9;SHINTO SHRINE;So;0;ON;;;;;N;;;;;
 26EA;CHURCH;So;0;ON;;;;;N;;;;;
 2702;BLACK SCISSORS;So;0;ON;;;;;N;;;;;
 2703;LOWER BLADE SCISSORS;So;0;ON;;;;;N;;;;;
 2704;WHITE SCISSORS;So;0;ON;;;;;N;;;;;
+2705;WHITE HEAVY CHECK MARK;So;0;ON;;;;;N;;;;;
 2706;TELEPHONE LOCATION SIGN;So;0;ON;;;;;N;;;;;
 2707;TAPE DRIVE;So;0;ON;;;;;N;;;;;
 2708;AIRPLANE;So;0;ON;;;;;N;;;;;
 2709;ENVELOPE;So;0;ON;;;;;N;;;;;
+270A;RAISED FIST;So;0;ON;;;;;N;;;;;
+270B;RAISED HAND;So;0;ON;;;;;N;;;;;
 270C;VICTORY HAND;So;0;ON;;;;;N;;;;;
 270D;WRITING HAND;So;0;ON;;;;;N;;;;;
 270E;LOWER RIGHT PENCIL;So;0;ON;;;;;N;;;;;
 2725;FOUR CLUB-SPOKED ASTERISK;So;0;ON;;;;;N;;;;;
 2726;BLACK FOUR POINTED STAR;So;0;ON;;;;;N;;;;;
 2727;WHITE FOUR POINTED STAR;So;0;ON;;;;;N;;;;;
+2728;SPARKLES;So;0;ON;;;;;N;;;;;
 2729;STRESS OUTLINED WHITE STAR;So;0;ON;;;;;N;;;;;
 272A;CIRCLED WHITE STAR;So;0;ON;;;;;N;;;;;
 272B;OPEN CENTRE BLACK STAR;So;0;ON;;;;;N;OPEN CENTER BLACK STAR;;;;
 2749;BALLOON-SPOKED ASTERISK;So;0;ON;;;;;N;;;;;
 274A;EIGHT TEARDROP-SPOKED PROPELLER ASTERISK;So;0;ON;;;;;N;;;;;
 274B;HEAVY EIGHT TEARDROP-SPOKED PROPELLER ASTERISK;So;0;ON;;;;;N;;;;;
+274C;CROSS MARK;So;0;ON;;;;;N;;;;;
 274D;SHADOWED WHITE CIRCLE;So;0;ON;;;;;N;;;;;
+274E;NEGATIVE SQUARED CROSS MARK;So;0;ON;;;;;N;;;;;
 274F;LOWER RIGHT DROP-SHADOWED WHITE SQUARE;So;0;ON;;;;;N;;;;;
 2750;UPPER RIGHT DROP-SHADOWED WHITE SQUARE;So;0;ON;;;;;N;;;;;
 2751;LOWER RIGHT SHADOWED WHITE SQUARE;So;0;ON;;;;;N;;;;;
 2752;UPPER RIGHT SHADOWED WHITE SQUARE;So;0;ON;;;;;N;;;;;
+2753;BLACK QUESTION MARK ORNAMENT;So;0;ON;;;;;N;;;;;
+2754;WHITE QUESTION MARK ORNAMENT;So;0;ON;;;;;N;;;;;
+2755;WHITE EXCLAMATION MARK ORNAMENT;So;0;ON;;;;;N;;;;;
 2756;BLACK DIAMOND MINUS WHITE X;So;0;ON;;;;;N;;;;;
 2757;HEAVY EXCLAMATION MARK SYMBOL;So;0;ON;;;;;N;;;;;
 2758;LIGHT VERTICAL BAR;So;0;ON;;;;;N;;;;;
 275C;HEAVY SINGLE COMMA QUOTATION MARK ORNAMENT;So;0;ON;;;;;N;;;;;
 275D;HEAVY DOUBLE TURNED COMMA QUOTATION MARK ORNAMENT;So;0;ON;;;;;N;;;;;
 275E;HEAVY DOUBLE COMMA QUOTATION MARK ORNAMENT;So;0;ON;;;;;N;;;;;
+275F;HEAVY LOW SINGLE COMMA QUOTATION MARK ORNAMENT;So;0;ON;;;;;N;;;;;
+2760;HEAVY LOW DOUBLE COMMA QUOTATION MARK ORNAMENT;So;0;ON;;;;;N;;;;;
 2761;CURVED STEM PARAGRAPH SIGN ORNAMENT;So;0;ON;;;;;N;;;;;
 2762;HEAVY EXCLAMATION MARK ORNAMENT;So;0;ON;;;;;N;;;;;
 2763;HEAVY HEART EXCLAMATION MARK ORNAMENT;So;0;ON;;;;;N;;;;;
 2792;DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT NINE;No;0;ON;;;9;9;N;INVERSE CIRCLED SANS-SERIF DIGIT NINE;;;;
 2793;DINGBAT NEGATIVE CIRCLED SANS-SERIF NUMBER TEN;No;0;ON;;;;10;N;INVERSE CIRCLED SANS-SERIF NUMBER TEN;;;;
 2794;HEAVY WIDE-HEADED RIGHTWARDS ARROW;So;0;ON;;;;;N;HEAVY WIDE-HEADED RIGHT ARROW;;;;
+2795;HEAVY PLUS SIGN;So;0;ON;;;;;N;;;;;
+2796;HEAVY MINUS SIGN;So;0;ON;;;;;N;;;;;
+2797;HEAVY DIVISION SIGN;So;0;ON;;;;;N;;;;;
 2798;HEAVY SOUTH EAST ARROW;So;0;ON;;;;;N;HEAVY LOWER RIGHT ARROW;;;;
 2799;HEAVY RIGHTWARDS ARROW;So;0;ON;;;;;N;HEAVY RIGHT ARROW;;;;
 279A;HEAVY NORTH EAST ARROW;So;0;ON;;;;;N;HEAVY UPPER RIGHT ARROW;;;;
 27AD;HEAVY LOWER RIGHT-SHADOWED WHITE RIGHTWARDS ARROW;So;0;ON;;;;;N;HEAVY LOWER RIGHT-SHADOWED WHITE RIGHT ARROW;;;;
 27AE;HEAVY UPPER RIGHT-SHADOWED WHITE RIGHTWARDS ARROW;So;0;ON;;;;;N;HEAVY UPPER RIGHT-SHADOWED WHITE RIGHT ARROW;;;;
 27AF;NOTCHED LOWER RIGHT-SHADOWED WHITE RIGHTWARDS ARROW;So;0;ON;;;;;N;NOTCHED LOWER RIGHT-SHADOWED WHITE RIGHT ARROW;;;;
+27B0;CURLY LOOP;So;0;ON;;;;;N;;;;;
 27B1;NOTCHED UPPER RIGHT-SHADOWED WHITE RIGHTWARDS ARROW;So;0;ON;;;;;N;NOTCHED UPPER RIGHT-SHADOWED WHITE RIGHT ARROW;;;;
 27B2;CIRCLED HEAVY WHITE RIGHTWARDS ARROW;So;0;ON;;;;;N;CIRCLED HEAVY WHITE RIGHT ARROW;;;;
 27B3;WHITE-FEATHERED RIGHTWARDS ARROW;So;0;ON;;;;;N;WHITE-FEATHERED RIGHT ARROW;;;;
 27BC;WEDGE-TAILED RIGHTWARDS ARROW;So;0;ON;;;;;N;WEDGE-TAILED RIGHT ARROW;;;;
 27BD;HEAVY WEDGE-TAILED RIGHTWARDS ARROW;So;0;ON;;;;;N;HEAVY WEDGE-TAILED RIGHT ARROW;;;;
 27BE;OPEN-OUTLINED RIGHTWARDS ARROW;So;0;ON;;;;;N;OPEN-OUTLINED RIGHT ARROW;;;;
+27BF;DOUBLE CURLY LOOP;So;0;ON;;;;;N;;;;;
 27C0;THREE DIMENSIONAL ANGLE;Sm;0;ON;;;;;Y;;;;;
 27C1;WHITE TRIANGLE CONTAINING SMALL WHITE TRIANGLE;Sm;0;ON;;;;;N;;;;;
 27C2;PERPENDICULAR;Sm;0;ON;;;;;N;;;;;
 27C9;SUPERSET PRECEDING SOLIDUS;Sm;0;ON;;;;;Y;;;;;
 27CA;VERTICAL BAR WITH HORIZONTAL STROKE;Sm;0;ON;;;;;N;;;;;
 27CC;LONG DIVISION;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;;;;;
 27D1;AND WITH DOT;Sm;0;ON;;;;;N;;;;;
 27D2;ELEMENT OF OPENING UPWARDS;Sm;0;ON;;;;;N;;;;;
 2D64;TIFINAGH LETTER TAWELLEMET YAZ;Lo;0;L;;;;;N;;;;;
 2D65;TIFINAGH LETTER YAZZ;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;;;;;
 2D80;ETHIOPIC SYLLABLE LOA;Lo;0;L;;;;;N;;;;;
 2D81;ETHIOPIC SYLLABLE MOA;Lo;0;L;;;;;N;;;;;
 2D82;ETHIOPIC SYLLABLE ROA;Lo;0;L;;;;;N;;;;;
 31B5;BOPOMOFO FINAL LETTER T;Lo;0;L;;;;;N;;;;;
 31B6;BOPOMOFO FINAL LETTER K;Lo;0;L;;;;;N;;;;;
 31B7;BOPOMOFO FINAL LETTER H;Lo;0;L;;;;;N;;;;;
+31B8;BOPOMOFO LETTER GH;Lo;0;L;;;;;N;;;;;
+31B9;BOPOMOFO LETTER LH;Lo;0;L;;;;;N;;;;;
+31BA;BOPOMOFO LETTER ZY;Lo;0;L;;;;;N;;;;;
 31C0;CJK STROKE T;So;0;ON;;;;;N;;;;;
 31C1;CJK STROKE WG;So;0;ON;;;;;N;;;;;
 31C2;CJK STROKE XG;So;0;ON;;;;;N;;;;;
@@ -13072,6 +13237,8 @@ A65C;CYRILLIC CAPITAL LETTER IOTIFIED CLOSED LITTLE YUS;Lu;0;L;;;;;N;;;;A65D;
 A65D;CYRILLIC SMALL LETTER IOTIFIED CLOSED LITTLE YUS;Ll;0;L;;;;;N;;;A65C;;A65C
 A65E;CYRILLIC CAPITAL LETTER YN;Lu;0;L;;;;;N;;;;A65F;
 A65F;CYRILLIC SMALL LETTER YN;Ll;0;L;;;;;N;;;A65E;;A65E
+A660;CYRILLIC CAPITAL LETTER REVERSED TSE;Lu;0;L;;;;;N;;;;A661;
+A661;CYRILLIC SMALL LETTER REVERSED TSE;Ll;0;L;;;;;N;;;A660;;A660
 A662;CYRILLIC CAPITAL LETTER SOFT DE;Lu;0;L;;;;;N;;;;A663;
 A663;CYRILLIC SMALL LETTER SOFT DE;Ll;0;L;;;;;N;;;A662;;A662
 A664;CYRILLIC CAPITAL LETTER SOFT EL;Lu;0;L;;;;;N;;;;A665;
@@ -13347,6 +13514,21 @@ A789;MODIFIER LETTER COLON;Sk;0;L;;;;;N;;;;;
 A78A;MODIFIER LETTER SHORT EQUALS SIGN;Sk;0;L;;;;;N;;;;;
 A78B;LATIN CAPITAL LETTER SALTILLO;Lu;0;L;;;;;N;;;;A78C;
 A78C;LATIN SMALL LETTER SALTILLO;Ll;0;L;;;;;N;;;A78B;;A78B
+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
+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;
+A7A3;LATIN SMALL LETTER K WITH OBLIQUE STROKE;Ll;0;L;;;;;N;;;A7A2;;A7A2
+A7A4;LATIN CAPITAL LETTER N WITH OBLIQUE STROKE;Lu;0;L;;;;;N;;;;A7A5;
+A7A5;LATIN SMALL LETTER N WITH OBLIQUE STROKE;Ll;0;L;;;;;N;;;A7A4;;A7A4
+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
+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;;;;;
 A7FD;LATIN EPIGRAPHIC LETTER INVERTED M;Lo;0;L;;;;;N;;;;;
@@ -13959,6 +14141,38 @@ 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;;;;;
+AB01;ETHIOPIC SYLLABLE TTHU;Lo;0;L;;;;;N;;;;;
+AB02;ETHIOPIC SYLLABLE TTHI;Lo;0;L;;;;;N;;;;;
+AB03;ETHIOPIC SYLLABLE TTHAA;Lo;0;L;;;;;N;;;;;
+AB04;ETHIOPIC SYLLABLE TTHEE;Lo;0;L;;;;;N;;;;;
+AB05;ETHIOPIC SYLLABLE TTHE;Lo;0;L;;;;;N;;;;;
+AB06;ETHIOPIC SYLLABLE TTHO;Lo;0;L;;;;;N;;;;;
+AB09;ETHIOPIC SYLLABLE DDHU;Lo;0;L;;;;;N;;;;;
+AB0A;ETHIOPIC SYLLABLE DDHI;Lo;0;L;;;;;N;;;;;
+AB0B;ETHIOPIC SYLLABLE DDHAA;Lo;0;L;;;;;N;;;;;
+AB0C;ETHIOPIC SYLLABLE DDHEE;Lo;0;L;;;;;N;;;;;
+AB0D;ETHIOPIC SYLLABLE DDHE;Lo;0;L;;;;;N;;;;;
+AB0E;ETHIOPIC SYLLABLE DDHO;Lo;0;L;;;;;N;;;;;
+AB11;ETHIOPIC SYLLABLE DZU;Lo;0;L;;;;;N;;;;;
+AB12;ETHIOPIC SYLLABLE DZI;Lo;0;L;;;;;N;;;;;
+AB13;ETHIOPIC SYLLABLE DZAA;Lo;0;L;;;;;N;;;;;
+AB14;ETHIOPIC SYLLABLE DZEE;Lo;0;L;;;;;N;;;;;
+AB15;ETHIOPIC SYLLABLE DZE;Lo;0;L;;;;;N;;;;;
+AB16;ETHIOPIC SYLLABLE DZO;Lo;0;L;;;;;N;;;;;
+AB20;ETHIOPIC SYLLABLE CCHHA;Lo;0;L;;;;;N;;;;;
+AB21;ETHIOPIC SYLLABLE CCHHU;Lo;0;L;;;;;N;;;;;
+AB22;ETHIOPIC SYLLABLE CCHHI;Lo;0;L;;;;;N;;;;;
+AB23;ETHIOPIC SYLLABLE CCHHAA;Lo;0;L;;;;;N;;;;;
+AB24;ETHIOPIC SYLLABLE CCHHEE;Lo;0;L;;;;;N;;;;;
+AB25;ETHIOPIC SYLLABLE CCHHE;Lo;0;L;;;;;N;;;;;
+AB26;ETHIOPIC SYLLABLE CCHHO;Lo;0;L;;;;;N;;;;;
+AB28;ETHIOPIC SYLLABLE BBA;Lo;0;L;;;;;N;;;;;
+AB29;ETHIOPIC SYLLABLE BBU;Lo;0;L;;;;;N;;;;;
+AB2A;ETHIOPIC SYLLABLE BBI;Lo;0;L;;;;;N;;;;;
+AB2B;ETHIOPIC SYLLABLE BBAA;Lo;0;L;;;;;N;;;;;
+AB2C;ETHIOPIC SYLLABLE BBEE;Lo;0;L;;;;;N;;;;;
+AB2D;ETHIOPIC SYLLABLE BBE;Lo;0;L;;;;;N;;;;;
+AB2E;ETHIOPIC SYLLABLE BBO;Lo;0;L;;;;;N;;;;;
 ABC0;MEETEI MAYEK LETTER KOK;Lo;0;L;;;;;N;;;;;
 ABC1;MEETEI MAYEK LETTER SAM;Lo;0;L;;;;;N;;;;;
 ABC2;MEETEI MAYEK LETTER LAI;Lo;0;L;;;;;N;;;;;
@@ -14723,6 +14937,22 @@ FBAE;ARABIC LETTER YEH BARREE ISOLATED FORM;Lo;0;AL;<isolated> 06D2;;;;N;;;;;
 FBAF;ARABIC LETTER YEH BARREE FINAL FORM;Lo;0;AL;<final> 06D2;;;;N;;;;;
 FBB0;ARABIC LETTER YEH BARREE WITH HAMZA ABOVE ISOLATED FORM;Lo;0;AL;<isolated> 06D3;;;;N;;;;;
 FBB1;ARABIC LETTER YEH BARREE WITH HAMZA ABOVE FINAL FORM;Lo;0;AL;<final> 06D3;;;;N;;;;;
+FBB2;ARABIC SYMBOL DOT ABOVE;Sk;0;AL;;;;;N;;;;;
+FBB3;ARABIC SYMBOL DOT BELOW;Sk;0;AL;;;;;N;;;;;
+FBB4;ARABIC SYMBOL TWO DOTS ABOVE;Sk;0;AL;;;;;N;;;;;
+FBB5;ARABIC SYMBOL TWO DOTS BELOW;Sk;0;AL;;;;;N;;;;;
+FBB6;ARABIC SYMBOL THREE DOTS ABOVE;Sk;0;AL;;;;;N;;;;;
+FBB7;ARABIC SYMBOL THREE DOTS BELOW;Sk;0;AL;;;;;N;;;;;
+FBB8;ARABIC SYMBOL THREE DOTS POINTING DOWNWARDS ABOVE;Sk;0;AL;;;;;N;;;;;
+FBB9;ARABIC SYMBOL THREE DOTS POINTING DOWNWARDS BELOW;Sk;0;AL;;;;;N;;;;;
+FBBA;ARABIC SYMBOL FOUR DOTS ABOVE;Sk;0;AL;;;;;N;;;;;
+FBBB;ARABIC SYMBOL FOUR DOTS BELOW;Sk;0;AL;;;;;N;;;;;
+FBBC;ARABIC SYMBOL DOUBLE VERTICAL BAR BELOW;Sk;0;AL;;;;;N;;;;;
+FBBD;ARABIC SYMBOL TWO DOTS VERTICALLY ABOVE;Sk;0;AL;;;;;N;;;;;
+FBBE;ARABIC SYMBOL TWO DOTS VERTICALLY BELOW;Sk;0;AL;;;;;N;;;;;
+FBBF;ARABIC SYMBOL RING;Sk;0;AL;;;;;N;;;;;
+FBC0;ARABIC SYMBOL SMALL TAH ABOVE;Sk;0;AL;;;;;N;;;;;
+FBC1;ARABIC SYMBOL SMALL TAH BELOW;Sk;0;AL;;;;;N;;;;;
 FBD3;ARABIC LETTER NG ISOLATED FORM;Lo;0;AL;<isolated> 06AD;;;;N;;;;;
 FBD4;ARABIC LETTER NG FINAL FORM;Lo;0;AL;<final> 06AD;;;;N;;;;;
 FBD5;ARABIC LETTER NG INITIAL FORM;Lo;0;AL;<initial> 06AD;;;;N;;;;;
@@ -16933,6 +17163,114 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;;
 10E7C;RUMI FRACTION ONE QUARTER;No;0;AN;;;;1/4;N;;;;;
 10E7D;RUMI FRACTION ONE THIRD;No;0;AN;;;;1/3;N;;;;;
 10E7E;RUMI FRACTION TWO THIRDS;No;0;AN;;;;2/3;N;;;;;
+11000;BRAHMI SIGN CANDRABINDU;Mc;0;L;;;;;N;;;;;
+11001;BRAHMI SIGN ANUSVARA;Mn;0;NSM;;;;;N;;;;;
+11002;BRAHMI SIGN VISARGA;Mc;0;L;;;;;N;;;;;
+11003;BRAHMI SIGN JIHVAMULIYA;Lo;0;L;;;;;N;;;;;
+11004;BRAHMI SIGN UPADHMANIYA;Lo;0;L;;;;;N;;;;;
+11005;BRAHMI LETTER A;Lo;0;L;;;;;N;;;;;
+11006;BRAHMI LETTER AA;Lo;0;L;;;;;N;;;;;
+11007;BRAHMI LETTER I;Lo;0;L;;;;;N;;;;;
+11008;BRAHMI LETTER II;Lo;0;L;;;;;N;;;;;
+11009;BRAHMI LETTER U;Lo;0;L;;;;;N;;;;;
+1100A;BRAHMI LETTER UU;Lo;0;L;;;;;N;;;;;
+1100B;BRAHMI LETTER VOCALIC R;Lo;0;L;;;;;N;;;;;
+1100C;BRAHMI LETTER VOCALIC RR;Lo;0;L;;;;;N;;;;;
+1100D;BRAHMI LETTER VOCALIC L;Lo;0;L;;;;;N;;;;;
+1100E;BRAHMI LETTER VOCALIC LL;Lo;0;L;;;;;N;;;;;
+1100F;BRAHMI LETTER E;Lo;0;L;;;;;N;;;;;
+11010;BRAHMI LETTER AI;Lo;0;L;;;;;N;;;;;
+11011;BRAHMI LETTER O;Lo;0;L;;;;;N;;;;;
+11012;BRAHMI LETTER AU;Lo;0;L;;;;;N;;;;;
+11013;BRAHMI LETTER KA;Lo;0;L;;;;;N;;;;;
+11014;BRAHMI LETTER KHA;Lo;0;L;;;;;N;;;;;
+11015;BRAHMI LETTER GA;Lo;0;L;;;;;N;;;;;
+11016;BRAHMI LETTER GHA;Lo;0;L;;;;;N;;;;;
+11017;BRAHMI LETTER NGA;Lo;0;L;;;;;N;;;;;
+11018;BRAHMI LETTER CA;Lo;0;L;;;;;N;;;;;
+11019;BRAHMI LETTER CHA;Lo;0;L;;;;;N;;;;;
+1101A;BRAHMI LETTER JA;Lo;0;L;;;;;N;;;;;
+1101B;BRAHMI LETTER JHA;Lo;0;L;;;;;N;;;;;
+1101C;BRAHMI LETTER NYA;Lo;0;L;;;;;N;;;;;
+1101D;BRAHMI LETTER TTA;Lo;0;L;;;;;N;;;;;
+1101E;BRAHMI LETTER TTHA;Lo;0;L;;;;;N;;;;;
+1101F;BRAHMI LETTER DDA;Lo;0;L;;;;;N;;;;;
+11020;BRAHMI LETTER DDHA;Lo;0;L;;;;;N;;;;;
+11021;BRAHMI LETTER NNA;Lo;0;L;;;;;N;;;;;
+11022;BRAHMI LETTER TA;Lo;0;L;;;;;N;;;;;
+11023;BRAHMI LETTER THA;Lo;0;L;;;;;N;;;;;
+11024;BRAHMI LETTER DA;Lo;0;L;;;;;N;;;;;
+11025;BRAHMI LETTER DHA;Lo;0;L;;;;;N;;;;;
+11026;BRAHMI LETTER NA;Lo;0;L;;;;;N;;;;;
+11027;BRAHMI LETTER PA;Lo;0;L;;;;;N;;;;;
+11028;BRAHMI LETTER PHA;Lo;0;L;;;;;N;;;;;
+11029;BRAHMI LETTER BA;Lo;0;L;;;;;N;;;;;
+1102A;BRAHMI LETTER BHA;Lo;0;L;;;;;N;;;;;
+1102B;BRAHMI LETTER MA;Lo;0;L;;;;;N;;;;;
+1102C;BRAHMI LETTER YA;Lo;0;L;;;;;N;;;;;
+1102D;BRAHMI LETTER RA;Lo;0;L;;;;;N;;;;;
+1102E;BRAHMI LETTER LA;Lo;0;L;;;;;N;;;;;
+1102F;BRAHMI LETTER VA;Lo;0;L;;;;;N;;;;;
+11030;BRAHMI LETTER SHA;Lo;0;L;;;;;N;;;;;
+11031;BRAHMI LETTER SSA;Lo;0;L;;;;;N;;;;;
+11032;BRAHMI LETTER SA;Lo;0;L;;;;;N;;;;;
+11033;BRAHMI LETTER HA;Lo;0;L;;;;;N;;;;;
+11034;BRAHMI LETTER LLA;Lo;0;L;;;;;N;;;;;
+11035;BRAHMI LETTER OLD TAMIL LLLA;Lo;0;L;;;;;N;;;;;
+11036;BRAHMI LETTER OLD TAMIL RRA;Lo;0;L;;;;;N;;;;;
+11037;BRAHMI LETTER OLD TAMIL NNNA;Lo;0;L;;;;;N;;;;;
+11038;BRAHMI VOWEL SIGN AA;Mn;0;NSM;;;;;N;;;;;
+11039;BRAHMI VOWEL SIGN BHATTIPROLU AA;Mn;0;NSM;;;;;N;;;;;
+1103A;BRAHMI VOWEL SIGN I;Mn;0;NSM;;;;;N;;;;;
+1103B;BRAHMI VOWEL SIGN II;Mn;0;NSM;;;;;N;;;;;
+1103C;BRAHMI VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;;
+1103D;BRAHMI VOWEL SIGN UU;Mn;0;NSM;;;;;N;;;;;
+1103E;BRAHMI VOWEL SIGN VOCALIC R;Mn;0;NSM;;;;;N;;;;;
+1103F;BRAHMI VOWEL SIGN VOCALIC RR;Mn;0;NSM;;;;;N;;;;;
+11040;BRAHMI VOWEL SIGN VOCALIC L;Mn;0;NSM;;;;;N;;;;;
+11041;BRAHMI VOWEL SIGN VOCALIC LL;Mn;0;NSM;;;;;N;;;;;
+11042;BRAHMI VOWEL SIGN E;Mn;0;NSM;;;;;N;;;;;
+11043;BRAHMI VOWEL SIGN AI;Mn;0;NSM;;;;;N;;;;;
+11044;BRAHMI VOWEL SIGN O;Mn;0;NSM;;;;;N;;;;;
+11045;BRAHMI VOWEL SIGN AU;Mn;0;NSM;;;;;N;;;;;
+11046;BRAHMI VIRAMA;Mn;9;NSM;;;;;N;;;;;
+11047;BRAHMI DANDA;Po;0;L;;;;;N;;;;;
+11048;BRAHMI DOUBLE DANDA;Po;0;L;;;;;N;;;;;
+11049;BRAHMI PUNCTUATION DOT;Po;0;L;;;;;N;;;;;
+1104A;BRAHMI PUNCTUATION DOUBLE DOT;Po;0;L;;;;;N;;;;;
+1104B;BRAHMI PUNCTUATION LINE;Po;0;L;;;;;N;;;;;
+1104C;BRAHMI PUNCTUATION CRESCENT BAR;Po;0;L;;;;;N;;;;;
+1104D;BRAHMI PUNCTUATION LOTUS;Po;0;L;;;;;N;;;;;
+11052;BRAHMI NUMBER ONE;No;0;ON;;;1;1;N;;;;;
+11053;BRAHMI NUMBER TWO;No;0;ON;;;2;2;N;;;;;
+11054;BRAHMI NUMBER THREE;No;0;ON;;;3;3;N;;;;;
+11055;BRAHMI NUMBER FOUR;No;0;ON;;;4;4;N;;;;;
+11056;BRAHMI NUMBER FIVE;No;0;ON;;;5;5;N;;;;;
+11057;BRAHMI NUMBER SIX;No;0;ON;;;6;6;N;;;;;
+11058;BRAHMI NUMBER SEVEN;No;0;ON;;;7;7;N;;;;;
+11059;BRAHMI NUMBER EIGHT;No;0;ON;;;8;8;N;;;;;
+1105A;BRAHMI NUMBER NINE;No;0;ON;;;9;9;N;;;;;
+1105B;BRAHMI NUMBER TEN;No;0;ON;;;;10;N;;;;;
+1105C;BRAHMI NUMBER TWENTY;No;0;ON;;;;20;N;;;;;
+1105D;BRAHMI NUMBER THIRTY;No;0;ON;;;;30;N;;;;;
+1105E;BRAHMI NUMBER FORTY;No;0;ON;;;;40;N;;;;;
+1105F;BRAHMI NUMBER FIFTY;No;0;ON;;;;50;N;;;;;
+11060;BRAHMI NUMBER SIXTY;No;0;ON;;;;60;N;;;;;
+11061;BRAHMI NUMBER SEVENTY;No;0;ON;;;;70;N;;;;;
+11062;BRAHMI NUMBER EIGHTY;No;0;ON;;;;80;N;;;;;
+11063;BRAHMI NUMBER NINETY;No;0;ON;;;;90;N;;;;;
+11064;BRAHMI NUMBER ONE HUNDRED;No;0;ON;;;;100;N;;;;;
+11065;BRAHMI NUMBER ONE THOUSAND;No;0;ON;;;;1000;N;;;;;
+11066;BRAHMI DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;;
+11067;BRAHMI DIGIT ONE;Nd;0;L;;1;1;1;N;;;;;
+11068;BRAHMI DIGIT TWO;Nd;0;L;;2;2;2;N;;;;;
+11069;BRAHMI DIGIT THREE;Nd;0;L;;3;3;3;N;;;;;
+1106A;BRAHMI DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;;
+1106B;BRAHMI DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;;
+1106C;BRAHMI DIGIT SIX;Nd;0;L;;6;6;6;N;;;;;
+1106D;BRAHMI DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;;
+1106E;BRAHMI DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;;
+1106F;BRAHMI DIGIT NINE;Nd;0;L;;9;9;9;N;;;;;
 11080;KAITHI SIGN CANDRABINDU;Mn;0;NSM;;;;;N;;;;;
 11081;KAITHI SIGN ANUSVARA;Mn;0;NSM;;;;;N;;;;;
 11082;KAITHI SIGN VISARGA;Mc;0;L;;;;;N;;;;;
@@ -19052,6 +19390,577 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;;
 1342C;EGYPTIAN HIEROGLYPH AA030;Lo;0;L;;;;;N;;;;;
 1342D;EGYPTIAN HIEROGLYPH AA031;Lo;0;L;;;;;N;;;;;
 1342E;EGYPTIAN HIEROGLYPH AA032;Lo;0;L;;;;;N;;;;;
+16800;BAMUM LETTER PHASE-A NGKUE MFON;Lo;0;L;;;;;N;;;;;
+16801;BAMUM LETTER PHASE-A GBIEE FON;Lo;0;L;;;;;N;;;;;
+16802;BAMUM LETTER PHASE-A PON MFON PIPAEMGBIEE;Lo;0;L;;;;;N;;;;;
+16803;BAMUM LETTER PHASE-A PON MFON PIPAEMBA;Lo;0;L;;;;;N;;;;;
+16804;BAMUM LETTER PHASE-A NAA MFON;Lo;0;L;;;;;N;;;;;
+16805;BAMUM LETTER PHASE-A SHUENSHUET;Lo;0;L;;;;;N;;;;;
+16806;BAMUM LETTER PHASE-A TITA MFON;Lo;0;L;;;;;N;;;;;
+16807;BAMUM LETTER PHASE-A NZA MFON;Lo;0;L;;;;;N;;;;;
+16808;BAMUM LETTER PHASE-A SHINDA PA NJI;Lo;0;L;;;;;N;;;;;
+16809;BAMUM LETTER PHASE-A PON PA NJI PIPAEMGBIEE;Lo;0;L;;;;;N;;;;;
+1680A;BAMUM LETTER PHASE-A PON PA NJI PIPAEMBA;Lo;0;L;;;;;N;;;;;
+1680B;BAMUM LETTER PHASE-A MAEMBGBIEE;Lo;0;L;;;;;N;;;;;
+1680C;BAMUM LETTER PHASE-A TU MAEMBA;Lo;0;L;;;;;N;;;;;
+1680D;BAMUM LETTER PHASE-A NGANGU;Lo;0;L;;;;;N;;;;;
+1680E;BAMUM LETTER PHASE-A MAEMVEUX;Lo;0;L;;;;;N;;;;;
+1680F;BAMUM LETTER PHASE-A MANSUAE;Lo;0;L;;;;;N;;;;;
+16810;BAMUM LETTER PHASE-A MVEUAENGAM;Lo;0;L;;;;;N;;;;;
+16811;BAMUM LETTER PHASE-A SEUNYAM;Lo;0;L;;;;;N;;;;;
+16812;BAMUM LETTER PHASE-A NTOQPEN;Lo;0;L;;;;;N;;;;;
+16813;BAMUM LETTER PHASE-A KEUKEUTNDA;Lo;0;L;;;;;N;;;;;
+16814;BAMUM LETTER PHASE-A NKINDI;Lo;0;L;;;;;N;;;;;
+16815;BAMUM LETTER PHASE-A SUU;Lo;0;L;;;;;N;;;;;
+16816;BAMUM LETTER PHASE-A NGKUENZEUM;Lo;0;L;;;;;N;;;;;
+16817;BAMUM LETTER PHASE-A LAPAQ;Lo;0;L;;;;;N;;;;;
+16818;BAMUM LETTER PHASE-A LET KUT;Lo;0;L;;;;;N;;;;;
+16819;BAMUM LETTER PHASE-A NTAP MFAA;Lo;0;L;;;;;N;;;;;
+1681A;BAMUM LETTER PHASE-A MAEKEUP;Lo;0;L;;;;;N;;;;;
+1681B;BAMUM LETTER PHASE-A PASHAE;Lo;0;L;;;;;N;;;;;
+1681C;BAMUM LETTER PHASE-A GHEUAERAE;Lo;0;L;;;;;N;;;;;
+1681D;BAMUM LETTER PHASE-A PAMSHAE;Lo;0;L;;;;;N;;;;;
+1681E;BAMUM LETTER PHASE-A MON NGGEUAET;Lo;0;L;;;;;N;;;;;
+1681F;BAMUM LETTER PHASE-A NZUN MEUT;Lo;0;L;;;;;N;;;;;
+16820;BAMUM LETTER PHASE-A U YUQ NAE;Lo;0;L;;;;;N;;;;;
+16821;BAMUM LETTER PHASE-A GHEUAEGHEUAE;Lo;0;L;;;;;N;;;;;
+16822;BAMUM LETTER PHASE-A NTAP NTAA;Lo;0;L;;;;;N;;;;;
+16823;BAMUM LETTER PHASE-A SISA;Lo;0;L;;;;;N;;;;;
+16824;BAMUM LETTER PHASE-A MGBASA;Lo;0;L;;;;;N;;;;;
+16825;BAMUM LETTER PHASE-A MEUNJOMNDEUQ;Lo;0;L;;;;;N;;;;;
+16826;BAMUM LETTER PHASE-A MOOMPUQ;Lo;0;L;;;;;N;;;;;
+16827;BAMUM LETTER PHASE-A KAFA;Lo;0;L;;;;;N;;;;;
+16828;BAMUM LETTER PHASE-A PA LEERAEWA;Lo;0;L;;;;;N;;;;;
+16829;BAMUM LETTER PHASE-A NDA LEERAEWA;Lo;0;L;;;;;N;;;;;
+1682A;BAMUM LETTER PHASE-A PET;Lo;0;L;;;;;N;;;;;
+1682B;BAMUM LETTER PHASE-A MAEMKPEN;Lo;0;L;;;;;N;;;;;
+1682C;BAMUM LETTER PHASE-A NIKA;Lo;0;L;;;;;N;;;;;
+1682D;BAMUM LETTER PHASE-A PUP;Lo;0;L;;;;;N;;;;;
+1682E;BAMUM LETTER PHASE-A TUAEP;Lo;0;L;;;;;N;;;;;
+1682F;BAMUM LETTER PHASE-A LUAEP;Lo;0;L;;;;;N;;;;;
+16830;BAMUM LETTER PHASE-A SONJAM;Lo;0;L;;;;;N;;;;;
+16831;BAMUM LETTER PHASE-A TEUTEUWEN;Lo;0;L;;;;;N;;;;;
+16832;BAMUM LETTER PHASE-A MAENYI;Lo;0;L;;;;;N;;;;;
+16833;BAMUM LETTER PHASE-A KET;Lo;0;L;;;;;N;;;;;
+16834;BAMUM LETTER PHASE-A NDAANGGEUAET;Lo;0;L;;;;;N;;;;;
+16835;BAMUM LETTER PHASE-A KUOQ;Lo;0;L;;;;;N;;;;;
+16836;BAMUM LETTER PHASE-A MOOMEUT;Lo;0;L;;;;;N;;;;;
+16837;BAMUM LETTER PHASE-A SHUM;Lo;0;L;;;;;N;;;;;
+16838;BAMUM LETTER PHASE-A LOMMAE;Lo;0;L;;;;;N;;;;;
+16839;BAMUM LETTER PHASE-A FIRI;Lo;0;L;;;;;N;;;;;
+1683A;BAMUM LETTER PHASE-A ROM;Lo;0;L;;;;;N;;;;;
+1683B;BAMUM LETTER PHASE-A KPOQ;Lo;0;L;;;;;N;;;;;
+1683C;BAMUM LETTER PHASE-A SOQ;Lo;0;L;;;;;N;;;;;
+1683D;BAMUM LETTER PHASE-A MAP PIEET;Lo;0;L;;;;;N;;;;;
+1683E;BAMUM LETTER PHASE-A SHIRAE;Lo;0;L;;;;;N;;;;;
+1683F;BAMUM LETTER PHASE-A NTAP;Lo;0;L;;;;;N;;;;;
+16840;BAMUM LETTER PHASE-A SHOQ NSHUT YUM;Lo;0;L;;;;;N;;;;;
+16841;BAMUM LETTER PHASE-A NYIT MONGKEUAEQ;Lo;0;L;;;;;N;;;;;
+16842;BAMUM LETTER PHASE-A PAARAE;Lo;0;L;;;;;N;;;;;
+16843;BAMUM LETTER PHASE-A NKAARAE;Lo;0;L;;;;;N;;;;;
+16844;BAMUM LETTER PHASE-A UNKNOWN;Lo;0;L;;;;;N;;;;;
+16845;BAMUM LETTER PHASE-A NGGEN;Lo;0;L;;;;;N;;;;;
+16846;BAMUM LETTER PHASE-A MAESI;Lo;0;L;;;;;N;;;;;
+16847;BAMUM LETTER PHASE-A NJAM;Lo;0;L;;;;;N;;;;;
+16848;BAMUM LETTER PHASE-A MBANYI;Lo;0;L;;;;;N;;;;;
+16849;BAMUM LETTER PHASE-A NYET;Lo;0;L;;;;;N;;;;;
+1684A;BAMUM LETTER PHASE-A TEUAEN;Lo;0;L;;;;;N;;;;;
+1684B;BAMUM LETTER PHASE-A SOT;Lo;0;L;;;;;N;;;;;
+1684C;BAMUM LETTER PHASE-A PAAM;Lo;0;L;;;;;N;;;;;
+1684D;BAMUM LETTER PHASE-A NSHIEE;Lo;0;L;;;;;N;;;;;
+1684E;BAMUM LETTER PHASE-A MAEM;Lo;0;L;;;;;N;;;;;
+1684F;BAMUM LETTER PHASE-A NYI;Lo;0;L;;;;;N;;;;;
+16850;BAMUM LETTER PHASE-A KAQ;Lo;0;L;;;;;N;;;;;
+16851;BAMUM LETTER PHASE-A NSHA;Lo;0;L;;;;;N;;;;;
+16852;BAMUM LETTER PHASE-A VEE;Lo;0;L;;;;;N;;;;;
+16853;BAMUM LETTER PHASE-A LU;Lo;0;L;;;;;N;;;;;
+16854;BAMUM LETTER PHASE-A NEN;Lo;0;L;;;;;N;;;;;
+16855;BAMUM LETTER PHASE-A NAQ;Lo;0;L;;;;;N;;;;;
+16856;BAMUM LETTER PHASE-A MBAQ;Lo;0;L;;;;;N;;;;;
+16857;BAMUM LETTER PHASE-B NSHUET;Lo;0;L;;;;;N;;;;;
+16858;BAMUM LETTER PHASE-B TU MAEMGBIEE;Lo;0;L;;;;;N;;;;;
+16859;BAMUM LETTER PHASE-B SIEE;Lo;0;L;;;;;N;;;;;
+1685A;BAMUM LETTER PHASE-B SET TU;Lo;0;L;;;;;N;;;;;
+1685B;BAMUM LETTER PHASE-B LOM NTEUM;Lo;0;L;;;;;N;;;;;
+1685C;BAMUM LETTER PHASE-B MBA MAELEE;Lo;0;L;;;;;N;;;;;
+1685D;BAMUM LETTER PHASE-B KIEEM;Lo;0;L;;;;;N;;;;;
+1685E;BAMUM LETTER PHASE-B YEURAE;Lo;0;L;;;;;N;;;;;
+1685F;BAMUM LETTER PHASE-B MBAARAE;Lo;0;L;;;;;N;;;;;
+16860;BAMUM LETTER PHASE-B KAM;Lo;0;L;;;;;N;;;;;
+16861;BAMUM LETTER PHASE-B PEESHI;Lo;0;L;;;;;N;;;;;
+16862;BAMUM LETTER PHASE-B YAFU LEERAEWA;Lo;0;L;;;;;N;;;;;
+16863;BAMUM LETTER PHASE-B LAM NSHUT NYAM;Lo;0;L;;;;;N;;;;;
+16864;BAMUM LETTER PHASE-B NTIEE SHEUOQ;Lo;0;L;;;;;N;;;;;
+16865;BAMUM LETTER PHASE-B NDU NJAA;Lo;0;L;;;;;N;;;;;
+16866;BAMUM LETTER PHASE-B GHEUGHEUAEM;Lo;0;L;;;;;N;;;;;
+16867;BAMUM LETTER PHASE-B PIT;Lo;0;L;;;;;N;;;;;
+16868;BAMUM LETTER PHASE-B TU NSIEE;Lo;0;L;;;;;N;;;;;
+16869;BAMUM LETTER PHASE-B SHET NJAQ;Lo;0;L;;;;;N;;;;;
+1686A;BAMUM LETTER PHASE-B SHEUAEQTU;Lo;0;L;;;;;N;;;;;
+1686B;BAMUM LETTER PHASE-B MFON TEUAEQ;Lo;0;L;;;;;N;;;;;
+1686C;BAMUM LETTER PHASE-B MBIT MBAAKET;Lo;0;L;;;;;N;;;;;
+1686D;BAMUM LETTER PHASE-B NYI NTEUM;Lo;0;L;;;;;N;;;;;
+1686E;BAMUM LETTER PHASE-B KEUPUQ;Lo;0;L;;;;;N;;;;;
+1686F;BAMUM LETTER PHASE-B GHEUGHEN;Lo;0;L;;;;;N;;;;;
+16870;BAMUM LETTER PHASE-B KEUYEUX;Lo;0;L;;;;;N;;;;;
+16871;BAMUM LETTER PHASE-B LAANAE;Lo;0;L;;;;;N;;;;;
+16872;BAMUM LETTER PHASE-B PARUM;Lo;0;L;;;;;N;;;;;
+16873;BAMUM LETTER PHASE-B VEUM;Lo;0;L;;;;;N;;;;;
+16874;BAMUM LETTER PHASE-B NGKINDI MVOP;Lo;0;L;;;;;N;;;;;
+16875;BAMUM LETTER PHASE-B NGGEU MBU;Lo;0;L;;;;;N;;;;;
+16876;BAMUM LETTER PHASE-B WUAET;Lo;0;L;;;;;N;;;;;
+16877;BAMUM LETTER PHASE-B SAKEUAE;Lo;0;L;;;;;N;;;;;
+16878;BAMUM LETTER PHASE-B TAAM;Lo;0;L;;;;;N;;;;;
+16879;BAMUM LETTER PHASE-B MEUQ;Lo;0;L;;;;;N;;;;;
+1687A;BAMUM LETTER PHASE-B NGGUOQ;Lo;0;L;;;;;N;;;;;
+1687B;BAMUM LETTER PHASE-B NGGUOQ LARGE;Lo;0;L;;;;;N;;;;;
+1687C;BAMUM LETTER PHASE-B MFIYAQ;Lo;0;L;;;;;N;;;;;
+1687D;BAMUM LETTER PHASE-B SUE;Lo;0;L;;;;;N;;;;;
+1687E;BAMUM LETTER PHASE-B MBEURI;Lo;0;L;;;;;N;;;;;
+1687F;BAMUM LETTER PHASE-B MONTIEEN;Lo;0;L;;;;;N;;;;;
+16880;BAMUM LETTER PHASE-B NYAEMAE;Lo;0;L;;;;;N;;;;;
+16881;BAMUM LETTER PHASE-B PUNGAAM;Lo;0;L;;;;;N;;;;;
+16882;BAMUM LETTER PHASE-B MEUT NGGEET;Lo;0;L;;;;;N;;;;;
+16883;BAMUM LETTER PHASE-B FEUX;Lo;0;L;;;;;N;;;;;
+16884;BAMUM LETTER PHASE-B MBUOQ;Lo;0;L;;;;;N;;;;;
+16885;BAMUM LETTER PHASE-B FEE;Lo;0;L;;;;;N;;;;;
+16886;BAMUM LETTER PHASE-B KEUAEM;Lo;0;L;;;;;N;;;;;
+16887;BAMUM LETTER PHASE-B MA NJEUAENA;Lo;0;L;;;;;N;;;;;
+16888;BAMUM LETTER PHASE-B MA NJUQA;Lo;0;L;;;;;N;;;;;
+16889;BAMUM LETTER PHASE-B LET;Lo;0;L;;;;;N;;;;;
+1688A;BAMUM LETTER PHASE-B NGGAAM;Lo;0;L;;;;;N;;;;;
+1688B;BAMUM LETTER PHASE-B NSEN;Lo;0;L;;;;;N;;;;;
+1688C;BAMUM LETTER PHASE-B MA;Lo;0;L;;;;;N;;;;;
+1688D;BAMUM LETTER PHASE-B KIQ;Lo;0;L;;;;;N;;;;;
+1688E;BAMUM LETTER PHASE-B NGOM;Lo;0;L;;;;;N;;;;;
+1688F;BAMUM LETTER PHASE-C NGKUE MAEMBA;Lo;0;L;;;;;N;;;;;
+16890;BAMUM LETTER PHASE-C NZA;Lo;0;L;;;;;N;;;;;
+16891;BAMUM LETTER PHASE-C YUM;Lo;0;L;;;;;N;;;;;
+16892;BAMUM LETTER PHASE-C WANGKUOQ;Lo;0;L;;;;;N;;;;;
+16893;BAMUM LETTER PHASE-C NGGEN;Lo;0;L;;;;;N;;;;;
+16894;BAMUM LETTER PHASE-C NDEUAEREE;Lo;0;L;;;;;N;;;;;
+16895;BAMUM LETTER PHASE-C NGKAQ;Lo;0;L;;;;;N;;;;;
+16896;BAMUM LETTER PHASE-C GHARAE;Lo;0;L;;;;;N;;;;;
+16897;BAMUM LETTER PHASE-C MBEEKEET;Lo;0;L;;;;;N;;;;;
+16898;BAMUM LETTER PHASE-C GBAYI;Lo;0;L;;;;;N;;;;;
+16899;BAMUM LETTER PHASE-C NYIR MKPARAQ MEUN;Lo;0;L;;;;;N;;;;;
+1689A;BAMUM LETTER PHASE-C NTU MBIT;Lo;0;L;;;;;N;;;;;
+1689B;BAMUM LETTER PHASE-C MBEUM;Lo;0;L;;;;;N;;;;;
+1689C;BAMUM LETTER PHASE-C PIRIEEN;Lo;0;L;;;;;N;;;;;
+1689D;BAMUM LETTER PHASE-C NDOMBU;Lo;0;L;;;;;N;;;;;
+1689E;BAMUM LETTER PHASE-C MBAA CABBAGE-TREE;Lo;0;L;;;;;N;;;;;
+1689F;BAMUM LETTER PHASE-C KEUSHEUAEP;Lo;0;L;;;;;N;;;;;
+168A0;BAMUM LETTER PHASE-C GHAP;Lo;0;L;;;;;N;;;;;
+168A1;BAMUM LETTER PHASE-C KEUKAQ;Lo;0;L;;;;;N;;;;;
+168A2;BAMUM LETTER PHASE-C YU MUOMAE;Lo;0;L;;;;;N;;;;;
+168A3;BAMUM LETTER PHASE-C NZEUM;Lo;0;L;;;;;N;;;;;
+168A4;BAMUM LETTER PHASE-C MBUE;Lo;0;L;;;;;N;;;;;
+168A5;BAMUM LETTER PHASE-C NSEUAEN;Lo;0;L;;;;;N;;;;;
+168A6;BAMUM LETTER PHASE-C MBIT;Lo;0;L;;;;;N;;;;;
+168A7;BAMUM LETTER PHASE-C YEUQ;Lo;0;L;;;;;N;;;;;
+168A8;BAMUM LETTER PHASE-C KPARAQ;Lo;0;L;;;;;N;;;;;
+168A9;BAMUM LETTER PHASE-C KAA;Lo;0;L;;;;;N;;;;;
+168AA;BAMUM LETTER PHASE-C SEUX;Lo;0;L;;;;;N;;;;;
+168AB;BAMUM LETTER PHASE-C NDIDA;Lo;0;L;;;;;N;;;;;
+168AC;BAMUM LETTER PHASE-C TAASHAE;Lo;0;L;;;;;N;;;;;
+168AD;BAMUM LETTER PHASE-C NJUEQ;Lo;0;L;;;;;N;;;;;
+168AE;BAMUM LETTER PHASE-C TITA YUE;Lo;0;L;;;;;N;;;;;
+168AF;BAMUM LETTER PHASE-C SUAET;Lo;0;L;;;;;N;;;;;
+168B0;BAMUM LETTER PHASE-C NGGUAEN NYAM;Lo;0;L;;;;;N;;;;;
+168B1;BAMUM LETTER PHASE-C VEUX;Lo;0;L;;;;;N;;;;;
+168B2;BAMUM LETTER PHASE-C NANSANAQ;Lo;0;L;;;;;N;;;;;
+168B3;BAMUM LETTER PHASE-C MA KEUAERI;Lo;0;L;;;;;N;;;;;
+168B4;BAMUM LETTER PHASE-C NTAA;Lo;0;L;;;;;N;;;;;
+168B5;BAMUM LETTER PHASE-C NGGUON;Lo;0;L;;;;;N;;;;;
+168B6;BAMUM LETTER PHASE-C LAP;Lo;0;L;;;;;N;;;;;
+168B7;BAMUM LETTER PHASE-C MBIRIEEN;Lo;0;L;;;;;N;;;;;
+168B8;BAMUM LETTER PHASE-C MGBASAQ;Lo;0;L;;;;;N;;;;;
+168B9;BAMUM LETTER PHASE-C NTEUNGBA;Lo;0;L;;;;;N;;;;;
+168BA;BAMUM LETTER PHASE-C TEUTEUX;Lo;0;L;;;;;N;;;;;
+168BB;BAMUM LETTER PHASE-C NGGUM;Lo;0;L;;;;;N;;;;;
+168BC;BAMUM LETTER PHASE-C FUE;Lo;0;L;;;;;N;;;;;
+168BD;BAMUM LETTER PHASE-C NDEUT;Lo;0;L;;;;;N;;;;;
+168BE;BAMUM LETTER PHASE-C NSA;Lo;0;L;;;;;N;;;;;
+168BF;BAMUM LETTER PHASE-C NSHAQ;Lo;0;L;;;;;N;;;;;
+168C0;BAMUM LETTER PHASE-C BUNG;Lo;0;L;;;;;N;;;;;
+168C1;BAMUM LETTER PHASE-C VEUAEPEN;Lo;0;L;;;;;N;;;;;
+168C2;BAMUM LETTER PHASE-C MBERAE;Lo;0;L;;;;;N;;;;;
+168C3;BAMUM LETTER PHASE-C RU;Lo;0;L;;;;;N;;;;;
+168C4;BAMUM LETTER PHASE-C NJAEM;Lo;0;L;;;;;N;;;;;
+168C5;BAMUM LETTER PHASE-C LAM;Lo;0;L;;;;;N;;;;;
+168C6;BAMUM LETTER PHASE-C TITUAEP;Lo;0;L;;;;;N;;;;;
+168C7;BAMUM LETTER PHASE-C NSUOT NGOM;Lo;0;L;;;;;N;;;;;
+168C8;BAMUM LETTER PHASE-C NJEEEE;Lo;0;L;;;;;N;;;;;
+168C9;BAMUM LETTER PHASE-C KET;Lo;0;L;;;;;N;;;;;
+168CA;BAMUM LETTER PHASE-C NGGU;Lo;0;L;;;;;N;;;;;
+168CB;BAMUM LETTER PHASE-C MAESI;Lo;0;L;;;;;N;;;;;
+168CC;BAMUM LETTER PHASE-C MBUAEM;Lo;0;L;;;;;N;;;;;
+168CD;BAMUM LETTER PHASE-C LU;Lo;0;L;;;;;N;;;;;
+168CE;BAMUM LETTER PHASE-C KUT;Lo;0;L;;;;;N;;;;;
+168CF;BAMUM LETTER PHASE-C NJAM;Lo;0;L;;;;;N;;;;;
+168D0;BAMUM LETTER PHASE-C NGOM;Lo;0;L;;;;;N;;;;;
+168D1;BAMUM LETTER PHASE-C WUP;Lo;0;L;;;;;N;;;;;
+168D2;BAMUM LETTER PHASE-C NGGUEET;Lo;0;L;;;;;N;;;;;
+168D3;BAMUM LETTER PHASE-C NSOM;Lo;0;L;;;;;N;;;;;
+168D4;BAMUM LETTER PHASE-C NTEN;Lo;0;L;;;;;N;;;;;
+168D5;BAMUM LETTER PHASE-C KUOP NKAARAE;Lo;0;L;;;;;N;;;;;
+168D6;BAMUM LETTER PHASE-C NSUN;Lo;0;L;;;;;N;;;;;
+168D7;BAMUM LETTER PHASE-C NDAM;Lo;0;L;;;;;N;;;;;
+168D8;BAMUM LETTER PHASE-C MA NSIEE;Lo;0;L;;;;;N;;;;;
+168D9;BAMUM LETTER PHASE-C YAA;Lo;0;L;;;;;N;;;;;
+168DA;BAMUM LETTER PHASE-C NDAP;Lo;0;L;;;;;N;;;;;
+168DB;BAMUM LETTER PHASE-C SHUEQ;Lo;0;L;;;;;N;;;;;
+168DC;BAMUM LETTER PHASE-C SETFON;Lo;0;L;;;;;N;;;;;
+168DD;BAMUM LETTER PHASE-C MBI;Lo;0;L;;;;;N;;;;;
+168DE;BAMUM LETTER PHASE-C MAEMBA;Lo;0;L;;;;;N;;;;;
+168DF;BAMUM LETTER PHASE-C MBANYI;Lo;0;L;;;;;N;;;;;
+168E0;BAMUM LETTER PHASE-C KEUSEUX;Lo;0;L;;;;;N;;;;;
+168E1;BAMUM LETTER PHASE-C MBEUX;Lo;0;L;;;;;N;;;;;
+168E2;BAMUM LETTER PHASE-C KEUM;Lo;0;L;;;;;N;;;;;
+168E3;BAMUM LETTER PHASE-C MBAA PICKET;Lo;0;L;;;;;N;;;;;
+168E4;BAMUM LETTER PHASE-C YUWOQ;Lo;0;L;;;;;N;;;;;
+168E5;BAMUM LETTER PHASE-C NJEUX;Lo;0;L;;;;;N;;;;;
+168E6;BAMUM LETTER PHASE-C MIEE;Lo;0;L;;;;;N;;;;;
+168E7;BAMUM LETTER PHASE-C MUAE;Lo;0;L;;;;;N;;;;;
+168E8;BAMUM LETTER PHASE-C SHIQ;Lo;0;L;;;;;N;;;;;
+168E9;BAMUM LETTER PHASE-C KEN LAW;Lo;0;L;;;;;N;;;;;
+168EA;BAMUM LETTER PHASE-C KEN FATIGUE;Lo;0;L;;;;;N;;;;;
+168EB;BAMUM LETTER PHASE-C NGAQ;Lo;0;L;;;;;N;;;;;
+168EC;BAMUM LETTER PHASE-C NAQ;Lo;0;L;;;;;N;;;;;
+168ED;BAMUM LETTER PHASE-C LIQ;Lo;0;L;;;;;N;;;;;
+168EE;BAMUM LETTER PHASE-C PIN;Lo;0;L;;;;;N;;;;;
+168EF;BAMUM LETTER PHASE-C PEN;Lo;0;L;;;;;N;;;;;
+168F0;BAMUM LETTER PHASE-C TET;Lo;0;L;;;;;N;;;;;
+168F1;BAMUM LETTER PHASE-D MBUO;Lo;0;L;;;;;N;;;;;
+168F2;BAMUM LETTER PHASE-D WAP;Lo;0;L;;;;;N;;;;;
+168F3;BAMUM LETTER PHASE-D NJI;Lo;0;L;;;;;N;;;;;
+168F4;BAMUM LETTER PHASE-D MFON;Lo;0;L;;;;;N;;;;;
+168F5;BAMUM LETTER PHASE-D NJIEE;Lo;0;L;;;;;N;;;;;
+168F6;BAMUM LETTER PHASE-D LIEE;Lo;0;L;;;;;N;;;;;
+168F7;BAMUM LETTER PHASE-D NJEUT;Lo;0;L;;;;;N;;;;;
+168F8;BAMUM LETTER PHASE-D NSHEE;Lo;0;L;;;;;N;;;;;
+168F9;BAMUM LETTER PHASE-D NGGAAMAE;Lo;0;L;;;;;N;;;;;
+168FA;BAMUM LETTER PHASE-D NYAM;Lo;0;L;;;;;N;;;;;
+168FB;BAMUM LETTER PHASE-D WUAEN;Lo;0;L;;;;;N;;;;;
+168FC;BAMUM LETTER PHASE-D NGKUN;Lo;0;L;;;;;N;;;;;
+168FD;BAMUM LETTER PHASE-D SHEE;Lo;0;L;;;;;N;;;;;
+168FE;BAMUM LETTER PHASE-D NGKAP;Lo;0;L;;;;;N;;;;;
+168FF;BAMUM LETTER PHASE-D KEUAETMEUN;Lo;0;L;;;;;N;;;;;
+16900;BAMUM LETTER PHASE-D TEUT;Lo;0;L;;;;;N;;;;;
+16901;BAMUM LETTER PHASE-D SHEUAE;Lo;0;L;;;;;N;;;;;
+16902;BAMUM LETTER PHASE-D NJAP;Lo;0;L;;;;;N;;;;;
+16903;BAMUM LETTER PHASE-D SUE;Lo;0;L;;;;;N;;;;;
+16904;BAMUM LETTER PHASE-D KET;Lo;0;L;;;;;N;;;;;
+16905;BAMUM LETTER PHASE-D YAEMMAE;Lo;0;L;;;;;N;;;;;
+16906;BAMUM LETTER PHASE-D KUOM;Lo;0;L;;;;;N;;;;;
+16907;BAMUM LETTER PHASE-D SAP;Lo;0;L;;;;;N;;;;;
+16908;BAMUM LETTER PHASE-D MFEUT;Lo;0;L;;;;;N;;;;;
+16909;BAMUM LETTER PHASE-D NDEUX;Lo;0;L;;;;;N;;;;;
+1690A;BAMUM LETTER PHASE-D MALEERI;Lo;0;L;;;;;N;;;;;
+1690B;BAMUM LETTER PHASE-D MEUT;Lo;0;L;;;;;N;;;;;
+1690C;BAMUM LETTER PHASE-D SEUAEQ;Lo;0;L;;;;;N;;;;;
+1690D;BAMUM LETTER PHASE-D YEN;Lo;0;L;;;;;N;;;;;
+1690E;BAMUM LETTER PHASE-D NJEUAEM;Lo;0;L;;;;;N;;;;;
+1690F;BAMUM LETTER PHASE-D KEUOT MBUAE;Lo;0;L;;;;;N;;;;;
+16910;BAMUM LETTER PHASE-D NGKEURI;Lo;0;L;;;;;N;;;;;
+16911;BAMUM LETTER PHASE-D TU;Lo;0;L;;;;;N;;;;;
+16912;BAMUM LETTER PHASE-D GHAA;Lo;0;L;;;;;N;;;;;
+16913;BAMUM LETTER PHASE-D NGKYEE;Lo;0;L;;;;;N;;;;;
+16914;BAMUM LETTER PHASE-D FEUFEUAET;Lo;0;L;;;;;N;;;;;
+16915;BAMUM LETTER PHASE-D NDEE;Lo;0;L;;;;;N;;;;;
+16916;BAMUM LETTER PHASE-D MGBOFUM;Lo;0;L;;;;;N;;;;;
+16917;BAMUM LETTER PHASE-D LEUAEP;Lo;0;L;;;;;N;;;;;
+16918;BAMUM LETTER PHASE-D NDON;Lo;0;L;;;;;N;;;;;
+16919;BAMUM LETTER PHASE-D MONI;Lo;0;L;;;;;N;;;;;
+1691A;BAMUM LETTER PHASE-D MGBEUN;Lo;0;L;;;;;N;;;;;
+1691B;BAMUM LETTER PHASE-D PUUT;Lo;0;L;;;;;N;;;;;
+1691C;BAMUM LETTER PHASE-D MGBIEE;Lo;0;L;;;;;N;;;;;
+1691D;BAMUM LETTER PHASE-D MFO;Lo;0;L;;;;;N;;;;;
+1691E;BAMUM LETTER PHASE-D LUM;Lo;0;L;;;;;N;;;;;
+1691F;BAMUM LETTER PHASE-D NSIEEP;Lo;0;L;;;;;N;;;;;
+16920;BAMUM LETTER PHASE-D MBAA;Lo;0;L;;;;;N;;;;;
+16921;BAMUM LETTER PHASE-D KWAET;Lo;0;L;;;;;N;;;;;
+16922;BAMUM LETTER PHASE-D NYET;Lo;0;L;;;;;N;;;;;
+16923;BAMUM LETTER PHASE-D TEUAEN;Lo;0;L;;;;;N;;;;;
+16924;BAMUM LETTER PHASE-D SOT;Lo;0;L;;;;;N;;;;;
+16925;BAMUM LETTER PHASE-D YUWOQ;Lo;0;L;;;;;N;;;;;
+16926;BAMUM LETTER PHASE-D KEUM;Lo;0;L;;;;;N;;;;;
+16927;BAMUM LETTER PHASE-D RAEM;Lo;0;L;;;;;N;;;;;
+16928;BAMUM LETTER PHASE-D TEEEE;Lo;0;L;;;;;N;;;;;
+16929;BAMUM LETTER PHASE-D NGKEUAEQ;Lo;0;L;;;;;N;;;;;
+1692A;BAMUM LETTER PHASE-D MFEUAE;Lo;0;L;;;;;N;;;;;
+1692B;BAMUM LETTER PHASE-D NSIEET;Lo;0;L;;;;;N;;;;;
+1692C;BAMUM LETTER PHASE-D KEUP;Lo;0;L;;;;;N;;;;;
+1692D;BAMUM LETTER PHASE-D PIP;Lo;0;L;;;;;N;;;;;
+1692E;BAMUM LETTER PHASE-D PEUTAE;Lo;0;L;;;;;N;;;;;
+1692F;BAMUM LETTER PHASE-D NYUE;Lo;0;L;;;;;N;;;;;
+16930;BAMUM LETTER PHASE-D LET;Lo;0;L;;;;;N;;;;;
+16931;BAMUM LETTER PHASE-D NGGAAM;Lo;0;L;;;;;N;;;;;
+16932;BAMUM LETTER PHASE-D MFIEE;Lo;0;L;;;;;N;;;;;
+16933;BAMUM LETTER PHASE-D NGGWAEN;Lo;0;L;;;;;N;;;;;
+16934;BAMUM LETTER PHASE-D YUOM;Lo;0;L;;;;;N;;;;;
+16935;BAMUM LETTER PHASE-D PAP;Lo;0;L;;;;;N;;;;;
+16936;BAMUM LETTER PHASE-D YUOP;Lo;0;L;;;;;N;;;;;
+16937;BAMUM LETTER PHASE-D NDAM;Lo;0;L;;;;;N;;;;;
+16938;BAMUM LETTER PHASE-D NTEUM;Lo;0;L;;;;;N;;;;;
+16939;BAMUM LETTER PHASE-D SUAE;Lo;0;L;;;;;N;;;;;
+1693A;BAMUM LETTER PHASE-D KUN;Lo;0;L;;;;;N;;;;;
+1693B;BAMUM LETTER PHASE-D NGGEUX;Lo;0;L;;;;;N;;;;;
+1693C;BAMUM LETTER PHASE-D NGKIEE;Lo;0;L;;;;;N;;;;;
+1693D;BAMUM LETTER PHASE-D TUOT;Lo;0;L;;;;;N;;;;;
+1693E;BAMUM LETTER PHASE-D MEUN;Lo;0;L;;;;;N;;;;;
+1693F;BAMUM LETTER PHASE-D KUQ;Lo;0;L;;;;;N;;;;;
+16940;BAMUM LETTER PHASE-D NSUM;Lo;0;L;;;;;N;;;;;
+16941;BAMUM LETTER PHASE-D TEUN;Lo;0;L;;;;;N;;;;;
+16942;BAMUM LETTER PHASE-D MAENJET;Lo;0;L;;;;;N;;;;;
+16943;BAMUM LETTER PHASE-D NGGAP;Lo;0;L;;;;;N;;;;;
+16944;BAMUM LETTER PHASE-D LEUM;Lo;0;L;;;;;N;;;;;
+16945;BAMUM LETTER PHASE-D NGGUOM;Lo;0;L;;;;;N;;;;;
+16946;BAMUM LETTER PHASE-D NSHUT;Lo;0;L;;;;;N;;;;;
+16947;BAMUM LETTER PHASE-D NJUEQ;Lo;0;L;;;;;N;;;;;
+16948;BAMUM LETTER PHASE-D GHEUAE;Lo;0;L;;;;;N;;;;;
+16949;BAMUM LETTER PHASE-D KU;Lo;0;L;;;;;N;;;;;
+1694A;BAMUM LETTER PHASE-D REN OLD;Lo;0;L;;;;;N;;;;;
+1694B;BAMUM LETTER PHASE-D TAE;Lo;0;L;;;;;N;;;;;
+1694C;BAMUM LETTER PHASE-D TOQ;Lo;0;L;;;;;N;;;;;
+1694D;BAMUM LETTER PHASE-D NYI;Lo;0;L;;;;;N;;;;;
+1694E;BAMUM LETTER PHASE-D RII;Lo;0;L;;;;;N;;;;;
+1694F;BAMUM LETTER PHASE-D LEEEE;Lo;0;L;;;;;N;;;;;
+16950;BAMUM LETTER PHASE-D MEEEE;Lo;0;L;;;;;N;;;;;
+16951;BAMUM LETTER PHASE-D M;Lo;0;L;;;;;N;;;;;
+16952;BAMUM LETTER PHASE-D SUU;Lo;0;L;;;;;N;;;;;
+16953;BAMUM LETTER PHASE-D MU;Lo;0;L;;;;;N;;;;;
+16954;BAMUM LETTER PHASE-D SHII;Lo;0;L;;;;;N;;;;;
+16955;BAMUM LETTER PHASE-D SHEUX;Lo;0;L;;;;;N;;;;;
+16956;BAMUM LETTER PHASE-D KYEE;Lo;0;L;;;;;N;;;;;
+16957;BAMUM LETTER PHASE-D NU;Lo;0;L;;;;;N;;;;;
+16958;BAMUM LETTER PHASE-D SHU;Lo;0;L;;;;;N;;;;;
+16959;BAMUM LETTER PHASE-D NTEE;Lo;0;L;;;;;N;;;;;
+1695A;BAMUM LETTER PHASE-D PEE;Lo;0;L;;;;;N;;;;;
+1695B;BAMUM LETTER PHASE-D NI;Lo;0;L;;;;;N;;;;;
+1695C;BAMUM LETTER PHASE-D SHOQ;Lo;0;L;;;;;N;;;;;
+1695D;BAMUM LETTER PHASE-D PUQ;Lo;0;L;;;;;N;;;;;
+1695E;BAMUM LETTER PHASE-D MVOP;Lo;0;L;;;;;N;;;;;
+1695F;BAMUM LETTER PHASE-D LOQ;Lo;0;L;;;;;N;;;;;
+16960;BAMUM LETTER PHASE-D REN MUCH;Lo;0;L;;;;;N;;;;;
+16961;BAMUM LETTER PHASE-D TI;Lo;0;L;;;;;N;;;;;
+16962;BAMUM LETTER PHASE-D NTUU;Lo;0;L;;;;;N;;;;;
+16963;BAMUM LETTER PHASE-D MBAA SEVEN;Lo;0;L;;;;;N;;;;;
+16964;BAMUM LETTER PHASE-D SAQ;Lo;0;L;;;;;N;;;;;
+16965;BAMUM LETTER PHASE-D FAA;Lo;0;L;;;;;N;;;;;
+16966;BAMUM LETTER PHASE-E NDAP;Lo;0;L;;;;;N;;;;;
+16967;BAMUM LETTER PHASE-E TOON;Lo;0;L;;;;;N;;;;;
+16968;BAMUM LETTER PHASE-E MBEUM;Lo;0;L;;;;;N;;;;;
+16969;BAMUM LETTER PHASE-E LAP;Lo;0;L;;;;;N;;;;;
+1696A;BAMUM LETTER PHASE-E VOM;Lo;0;L;;;;;N;;;;;
+1696B;BAMUM LETTER PHASE-E LOON;Lo;0;L;;;;;N;;;;;
+1696C;BAMUM LETTER PHASE-E PAA;Lo;0;L;;;;;N;;;;;
+1696D;BAMUM LETTER PHASE-E SOM;Lo;0;L;;;;;N;;;;;
+1696E;BAMUM LETTER PHASE-E RAQ;Lo;0;L;;;;;N;;;;;
+1696F;BAMUM LETTER PHASE-E NSHUOP;Lo;0;L;;;;;N;;;;;
+16970;BAMUM LETTER PHASE-E NDUN;Lo;0;L;;;;;N;;;;;
+16971;BAMUM LETTER PHASE-E PUAE;Lo;0;L;;;;;N;;;;;
+16972;BAMUM LETTER PHASE-E TAM;Lo;0;L;;;;;N;;;;;
+16973;BAMUM LETTER PHASE-E NGKA;Lo;0;L;;;;;N;;;;;
+16974;BAMUM LETTER PHASE-E KPEUX;Lo;0;L;;;;;N;;;;;
+16975;BAMUM LETTER PHASE-E WUO;Lo;0;L;;;;;N;;;;;
+16976;BAMUM LETTER PHASE-E SEE;Lo;0;L;;;;;N;;;;;
+16977;BAMUM LETTER PHASE-E NGGEUAET;Lo;0;L;;;;;N;;;;;
+16978;BAMUM LETTER PHASE-E PAAM;Lo;0;L;;;;;N;;;;;
+16979;BAMUM LETTER PHASE-E TOO;Lo;0;L;;;;;N;;;;;
+1697A;BAMUM LETTER PHASE-E KUOP;Lo;0;L;;;;;N;;;;;
+1697B;BAMUM LETTER PHASE-E LOM;Lo;0;L;;;;;N;;;;;
+1697C;BAMUM LETTER PHASE-E NSHIEE;Lo;0;L;;;;;N;;;;;
+1697D;BAMUM LETTER PHASE-E NGOP;Lo;0;L;;;;;N;;;;;
+1697E;BAMUM LETTER PHASE-E MAEM;Lo;0;L;;;;;N;;;;;
+1697F;BAMUM LETTER PHASE-E NGKEUX;Lo;0;L;;;;;N;;;;;
+16980;BAMUM LETTER PHASE-E NGOQ;Lo;0;L;;;;;N;;;;;
+16981;BAMUM LETTER PHASE-E NSHUE;Lo;0;L;;;;;N;;;;;
+16982;BAMUM LETTER PHASE-E RIMGBA;Lo;0;L;;;;;N;;;;;
+16983;BAMUM LETTER PHASE-E NJEUX;Lo;0;L;;;;;N;;;;;
+16984;BAMUM LETTER PHASE-E PEEM;Lo;0;L;;;;;N;;;;;
+16985;BAMUM LETTER PHASE-E SAA;Lo;0;L;;;;;N;;;;;
+16986;BAMUM LETTER PHASE-E NGGURAE;Lo;0;L;;;;;N;;;;;
+16987;BAMUM LETTER PHASE-E MGBA;Lo;0;L;;;;;N;;;;;
+16988;BAMUM LETTER PHASE-E GHEUX;Lo;0;L;;;;;N;;;;;
+16989;BAMUM LETTER PHASE-E NGKEUAEM;Lo;0;L;;;;;N;;;;;
+1698A;BAMUM LETTER PHASE-E NJAEMLI;Lo;0;L;;;;;N;;;;;
+1698B;BAMUM LETTER PHASE-E MAP;Lo;0;L;;;;;N;;;;;
+1698C;BAMUM LETTER PHASE-E LOOT;Lo;0;L;;;;;N;;;;;
+1698D;BAMUM LETTER PHASE-E NGGEEEE;Lo;0;L;;;;;N;;;;;
+1698E;BAMUM LETTER PHASE-E NDIQ;Lo;0;L;;;;;N;;;;;
+1698F;BAMUM LETTER PHASE-E TAEN NTEUM;Lo;0;L;;;;;N;;;;;
+16990;BAMUM LETTER PHASE-E SET;Lo;0;L;;;;;N;;;;;
+16991;BAMUM LETTER PHASE-E PUM;Lo;0;L;;;;;N;;;;;
+16992;BAMUM LETTER PHASE-E NDAA SOFTNESS;Lo;0;L;;;;;N;;;;;
+16993;BAMUM LETTER PHASE-E NGGUAESHAE NYAM;Lo;0;L;;;;;N;;;;;
+16994;BAMUM LETTER PHASE-E YIEE;Lo;0;L;;;;;N;;;;;
+16995;BAMUM LETTER PHASE-E GHEUN;Lo;0;L;;;;;N;;;;;
+16996;BAMUM LETTER PHASE-E TUAE;Lo;0;L;;;;;N;;;;;
+16997;BAMUM LETTER PHASE-E YEUAE;Lo;0;L;;;;;N;;;;;
+16998;BAMUM LETTER PHASE-E PO;Lo;0;L;;;;;N;;;;;
+16999;BAMUM LETTER PHASE-E TUMAE;Lo;0;L;;;;;N;;;;;
+1699A;BAMUM LETTER PHASE-E KEUAE;Lo;0;L;;;;;N;;;;;
+1699B;BAMUM LETTER PHASE-E SUAEN;Lo;0;L;;;;;N;;;;;
+1699C;BAMUM LETTER PHASE-E TEUAEQ;Lo;0;L;;;;;N;;;;;
+1699D;BAMUM LETTER PHASE-E VEUAE;Lo;0;L;;;;;N;;;;;
+1699E;BAMUM LETTER PHASE-E WEUX;Lo;0;L;;;;;N;;;;;
+1699F;BAMUM LETTER PHASE-E LAAM;Lo;0;L;;;;;N;;;;;
+169A0;BAMUM LETTER PHASE-E PU;Lo;0;L;;;;;N;;;;;
+169A1;BAMUM LETTER PHASE-E TAAQ;Lo;0;L;;;;;N;;;;;
+169A2;BAMUM LETTER PHASE-E GHAAMAE;Lo;0;L;;;;;N;;;;;
+169A3;BAMUM LETTER PHASE-E NGEUREUT;Lo;0;L;;;;;N;;;;;
+169A4;BAMUM LETTER PHASE-E SHEUAEQ;Lo;0;L;;;;;N;;;;;
+169A5;BAMUM LETTER PHASE-E MGBEN;Lo;0;L;;;;;N;;;;;
+169A6;BAMUM LETTER PHASE-E MBEE;Lo;0;L;;;;;N;;;;;
+169A7;BAMUM LETTER PHASE-E NZAQ;Lo;0;L;;;;;N;;;;;
+169A8;BAMUM LETTER PHASE-E NKOM;Lo;0;L;;;;;N;;;;;
+169A9;BAMUM LETTER PHASE-E GBET;Lo;0;L;;;;;N;;;;;
+169AA;BAMUM LETTER PHASE-E TUM;Lo;0;L;;;;;N;;;;;
+169AB;BAMUM LETTER PHASE-E KUET;Lo;0;L;;;;;N;;;;;
+169AC;BAMUM LETTER PHASE-E YAP;Lo;0;L;;;;;N;;;;;
+169AD;BAMUM LETTER PHASE-E NYI CLEAVER;Lo;0;L;;;;;N;;;;;
+169AE;BAMUM LETTER PHASE-E YIT;Lo;0;L;;;;;N;;;;;
+169AF;BAMUM LETTER PHASE-E MFEUQ;Lo;0;L;;;;;N;;;;;
+169B0;BAMUM LETTER PHASE-E NDIAQ;Lo;0;L;;;;;N;;;;;
+169B1;BAMUM LETTER PHASE-E PIEEQ;Lo;0;L;;;;;N;;;;;
+169B2;BAMUM LETTER PHASE-E YUEQ;Lo;0;L;;;;;N;;;;;
+169B3;BAMUM LETTER PHASE-E LEUAEM;Lo;0;L;;;;;N;;;;;
+169B4;BAMUM LETTER PHASE-E FUE;Lo;0;L;;;;;N;;;;;
+169B5;BAMUM LETTER PHASE-E GBEUX;Lo;0;L;;;;;N;;;;;
+169B6;BAMUM LETTER PHASE-E NGKUP;Lo;0;L;;;;;N;;;;;
+169B7;BAMUM LETTER PHASE-E KET;Lo;0;L;;;;;N;;;;;
+169B8;BAMUM LETTER PHASE-E MAE;Lo;0;L;;;;;N;;;;;
+169B9;BAMUM LETTER PHASE-E NGKAAMI;Lo;0;L;;;;;N;;;;;
+169BA;BAMUM LETTER PHASE-E GHET;Lo;0;L;;;;;N;;;;;
+169BB;BAMUM LETTER PHASE-E FA;Lo;0;L;;;;;N;;;;;
+169BC;BAMUM LETTER PHASE-E NTUM;Lo;0;L;;;;;N;;;;;
+169BD;BAMUM LETTER PHASE-E PEUT;Lo;0;L;;;;;N;;;;;
+169BE;BAMUM LETTER PHASE-E YEUM;Lo;0;L;;;;;N;;;;;
+169BF;BAMUM LETTER PHASE-E NGGEUAE;Lo;0;L;;;;;N;;;;;
+169C0;BAMUM LETTER PHASE-E NYI BETWEEN;Lo;0;L;;;;;N;;;;;
+169C1;BAMUM LETTER PHASE-E NZUQ;Lo;0;L;;;;;N;;;;;
+169C2;BAMUM LETTER PHASE-E POON;Lo;0;L;;;;;N;;;;;
+169C3;BAMUM LETTER PHASE-E MIEE;Lo;0;L;;;;;N;;;;;
+169C4;BAMUM LETTER PHASE-E FUET;Lo;0;L;;;;;N;;;;;
+169C5;BAMUM LETTER PHASE-E NAE;Lo;0;L;;;;;N;;;;;
+169C6;BAMUM LETTER PHASE-E MUAE;Lo;0;L;;;;;N;;;;;
+169C7;BAMUM LETTER PHASE-E GHEUAE;Lo;0;L;;;;;N;;;;;
+169C8;BAMUM LETTER PHASE-E FU I;Lo;0;L;;;;;N;;;;;
+169C9;BAMUM LETTER PHASE-E MVI;Lo;0;L;;;;;N;;;;;
+169CA;BAMUM LETTER PHASE-E PUAQ;Lo;0;L;;;;;N;;;;;
+169CB;BAMUM LETTER PHASE-E NGKUM;Lo;0;L;;;;;N;;;;;
+169CC;BAMUM LETTER PHASE-E KUT;Lo;0;L;;;;;N;;;;;
+169CD;BAMUM LETTER PHASE-E PIET;Lo;0;L;;;;;N;;;;;
+169CE;BAMUM LETTER PHASE-E NTAP;Lo;0;L;;;;;N;;;;;
+169CF;BAMUM LETTER PHASE-E YEUAET;Lo;0;L;;;;;N;;;;;
+169D0;BAMUM LETTER PHASE-E NGGUP;Lo;0;L;;;;;N;;;;;
+169D1;BAMUM LETTER PHASE-E PA PEOPLE;Lo;0;L;;;;;N;;;;;
+169D2;BAMUM LETTER PHASE-E FU CALL;Lo;0;L;;;;;N;;;;;
+169D3;BAMUM LETTER PHASE-E FOM;Lo;0;L;;;;;N;;;;;
+169D4;BAMUM LETTER PHASE-E NJEE;Lo;0;L;;;;;N;;;;;
+169D5;BAMUM LETTER PHASE-E A;Lo;0;L;;;;;N;;;;;
+169D6;BAMUM LETTER PHASE-E TOQ;Lo;0;L;;;;;N;;;;;
+169D7;BAMUM LETTER PHASE-E O;Lo;0;L;;;;;N;;;;;
+169D8;BAMUM LETTER PHASE-E I;Lo;0;L;;;;;N;;;;;
+169D9;BAMUM LETTER PHASE-E LAQ;Lo;0;L;;;;;N;;;;;
+169DA;BAMUM LETTER PHASE-E PA PLURAL;Lo;0;L;;;;;N;;;;;
+169DB;BAMUM LETTER PHASE-E TAA;Lo;0;L;;;;;N;;;;;
+169DC;BAMUM LETTER PHASE-E TAQ;Lo;0;L;;;;;N;;;;;
+169DD;BAMUM LETTER PHASE-E NDAA MY HOUSE;Lo;0;L;;;;;N;;;;;
+169DE;BAMUM LETTER PHASE-E SHIQ;Lo;0;L;;;;;N;;;;;
+169DF;BAMUM LETTER PHASE-E YEUX;Lo;0;L;;;;;N;;;;;
+169E0;BAMUM LETTER PHASE-E NGUAE;Lo;0;L;;;;;N;;;;;
+169E1;BAMUM LETTER PHASE-E YUAEN;Lo;0;L;;;;;N;;;;;
+169E2;BAMUM LETTER PHASE-E YOQ SWIMMING;Lo;0;L;;;;;N;;;;;
+169E3;BAMUM LETTER PHASE-E YOQ COVER;Lo;0;L;;;;;N;;;;;
+169E4;BAMUM LETTER PHASE-E YUQ;Lo;0;L;;;;;N;;;;;
+169E5;BAMUM LETTER PHASE-E YUN;Lo;0;L;;;;;N;;;;;
+169E6;BAMUM LETTER PHASE-E KEUX;Lo;0;L;;;;;N;;;;;
+169E7;BAMUM LETTER PHASE-E PEUX;Lo;0;L;;;;;N;;;;;
+169E8;BAMUM LETTER PHASE-E NJEE EPOCH;Lo;0;L;;;;;N;;;;;
+169E9;BAMUM LETTER PHASE-E PUE;Lo;0;L;;;;;N;;;;;
+169EA;BAMUM LETTER PHASE-E WUE;Lo;0;L;;;;;N;;;;;
+169EB;BAMUM LETTER PHASE-E FEE;Lo;0;L;;;;;N;;;;;
+169EC;BAMUM LETTER PHASE-E VEE;Lo;0;L;;;;;N;;;;;
+169ED;BAMUM LETTER PHASE-E LU;Lo;0;L;;;;;N;;;;;
+169EE;BAMUM LETTER PHASE-E MI;Lo;0;L;;;;;N;;;;;
+169EF;BAMUM LETTER PHASE-E REUX;Lo;0;L;;;;;N;;;;;
+169F0;BAMUM LETTER PHASE-E RAE;Lo;0;L;;;;;N;;;;;
+169F1;BAMUM LETTER PHASE-E NGUAET;Lo;0;L;;;;;N;;;;;
+169F2;BAMUM LETTER PHASE-E NGA;Lo;0;L;;;;;N;;;;;
+169F3;BAMUM LETTER PHASE-E SHO;Lo;0;L;;;;;N;;;;;
+169F4;BAMUM LETTER PHASE-E SHOQ;Lo;0;L;;;;;N;;;;;
+169F5;BAMUM LETTER PHASE-E FU REMEDY;Lo;0;L;;;;;N;;;;;
+169F6;BAMUM LETTER PHASE-E NA;Lo;0;L;;;;;N;;;;;
+169F7;BAMUM LETTER PHASE-E PI;Lo;0;L;;;;;N;;;;;
+169F8;BAMUM LETTER PHASE-E LOQ;Lo;0;L;;;;;N;;;;;
+169F9;BAMUM LETTER PHASE-E KO;Lo;0;L;;;;;N;;;;;
+169FA;BAMUM LETTER PHASE-E MEN;Lo;0;L;;;;;N;;;;;
+169FB;BAMUM LETTER PHASE-E MA;Lo;0;L;;;;;N;;;;;
+169FC;BAMUM LETTER PHASE-E MAQ;Lo;0;L;;;;;N;;;;;
+169FD;BAMUM LETTER PHASE-E TEU;Lo;0;L;;;;;N;;;;;
+169FE;BAMUM LETTER PHASE-E KI;Lo;0;L;;;;;N;;;;;
+169FF;BAMUM LETTER PHASE-E MON;Lo;0;L;;;;;N;;;;;
+16A00;BAMUM LETTER PHASE-E TEN;Lo;0;L;;;;;N;;;;;
+16A01;BAMUM LETTER PHASE-E FAQ;Lo;0;L;;;;;N;;;;;
+16A02;BAMUM LETTER PHASE-E GHOM;Lo;0;L;;;;;N;;;;;
+16A03;BAMUM LETTER PHASE-F KA;Lo;0;L;;;;;N;;;;;
+16A04;BAMUM LETTER PHASE-F U;Lo;0;L;;;;;N;;;;;
+16A05;BAMUM LETTER PHASE-F KU;Lo;0;L;;;;;N;;;;;
+16A06;BAMUM LETTER PHASE-F EE;Lo;0;L;;;;;N;;;;;
+16A07;BAMUM LETTER PHASE-F REE;Lo;0;L;;;;;N;;;;;
+16A08;BAMUM LETTER PHASE-F TAE;Lo;0;L;;;;;N;;;;;
+16A09;BAMUM LETTER PHASE-F NYI;Lo;0;L;;;;;N;;;;;
+16A0A;BAMUM LETTER PHASE-F LA;Lo;0;L;;;;;N;;;;;
+16A0B;BAMUM LETTER PHASE-F RII;Lo;0;L;;;;;N;;;;;
+16A0C;BAMUM LETTER PHASE-F RIEE;Lo;0;L;;;;;N;;;;;
+16A0D;BAMUM LETTER PHASE-F MEEEE;Lo;0;L;;;;;N;;;;;
+16A0E;BAMUM LETTER PHASE-F TAA;Lo;0;L;;;;;N;;;;;
+16A0F;BAMUM LETTER PHASE-F NDAA;Lo;0;L;;;;;N;;;;;
+16A10;BAMUM LETTER PHASE-F NJAEM;Lo;0;L;;;;;N;;;;;
+16A11;BAMUM LETTER PHASE-F M;Lo;0;L;;;;;N;;;;;
+16A12;BAMUM LETTER PHASE-F SUU;Lo;0;L;;;;;N;;;;;
+16A13;BAMUM LETTER PHASE-F SHII;Lo;0;L;;;;;N;;;;;
+16A14;BAMUM LETTER PHASE-F SI;Lo;0;L;;;;;N;;;;;
+16A15;BAMUM LETTER PHASE-F SEUX;Lo;0;L;;;;;N;;;;;
+16A16;BAMUM LETTER PHASE-F KYEE;Lo;0;L;;;;;N;;;;;
+16A17;BAMUM LETTER PHASE-F KET;Lo;0;L;;;;;N;;;;;
+16A18;BAMUM LETTER PHASE-F NUAE;Lo;0;L;;;;;N;;;;;
+16A19;BAMUM LETTER PHASE-F NU;Lo;0;L;;;;;N;;;;;
+16A1A;BAMUM LETTER PHASE-F NJUAE;Lo;0;L;;;;;N;;;;;
+16A1B;BAMUM LETTER PHASE-F YOQ;Lo;0;L;;;;;N;;;;;
+16A1C;BAMUM LETTER PHASE-F SHU;Lo;0;L;;;;;N;;;;;
+16A1D;BAMUM LETTER PHASE-F YA;Lo;0;L;;;;;N;;;;;
+16A1E;BAMUM LETTER PHASE-F NSHA;Lo;0;L;;;;;N;;;;;
+16A1F;BAMUM LETTER PHASE-F PEUX;Lo;0;L;;;;;N;;;;;
+16A20;BAMUM LETTER PHASE-F NTEE;Lo;0;L;;;;;N;;;;;
+16A21;BAMUM LETTER PHASE-F WUE;Lo;0;L;;;;;N;;;;;
+16A22;BAMUM LETTER PHASE-F PEE;Lo;0;L;;;;;N;;;;;
+16A23;BAMUM LETTER PHASE-F RU;Lo;0;L;;;;;N;;;;;
+16A24;BAMUM LETTER PHASE-F NI;Lo;0;L;;;;;N;;;;;
+16A25;BAMUM LETTER PHASE-F REUX;Lo;0;L;;;;;N;;;;;
+16A26;BAMUM LETTER PHASE-F KEN;Lo;0;L;;;;;N;;;;;
+16A27;BAMUM LETTER PHASE-F NGKWAEN;Lo;0;L;;;;;N;;;;;
+16A28;BAMUM LETTER PHASE-F NGGA;Lo;0;L;;;;;N;;;;;
+16A29;BAMUM LETTER PHASE-F SHO;Lo;0;L;;;;;N;;;;;
+16A2A;BAMUM LETTER PHASE-F PUAE;Lo;0;L;;;;;N;;;;;
+16A2B;BAMUM LETTER PHASE-F FOM;Lo;0;L;;;;;N;;;;;
+16A2C;BAMUM LETTER PHASE-F WA;Lo;0;L;;;;;N;;;;;
+16A2D;BAMUM LETTER PHASE-F LI;Lo;0;L;;;;;N;;;;;
+16A2E;BAMUM LETTER PHASE-F LOQ;Lo;0;L;;;;;N;;;;;
+16A2F;BAMUM LETTER PHASE-F KO;Lo;0;L;;;;;N;;;;;
+16A30;BAMUM LETTER PHASE-F MBEN;Lo;0;L;;;;;N;;;;;
+16A31;BAMUM LETTER PHASE-F REN;Lo;0;L;;;;;N;;;;;
+16A32;BAMUM LETTER PHASE-F MA;Lo;0;L;;;;;N;;;;;
+16A33;BAMUM LETTER PHASE-F MO;Lo;0;L;;;;;N;;;;;
+16A34;BAMUM LETTER PHASE-F MBAA;Lo;0;L;;;;;N;;;;;
+16A35;BAMUM LETTER PHASE-F TET;Lo;0;L;;;;;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;;;;;
+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;;;;;
 1D001;BYZANTINE MUSICAL SYMBOL DASEIA;So;0;L;;;;;N;;;;;
 1D002;BYZANTINE MUSICAL SYMBOL PERISPOMENI;So;0;L;;;;;N;;;;;
@@ -20833,6 +21742,65 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;;
 1F091;DOMINO TILE VERTICAL-06-04;So;0;ON;;;;;N;;;;;
 1F092;DOMINO TILE VERTICAL-06-05;So;0;ON;;;;;N;;;;;
 1F093;DOMINO TILE VERTICAL-06-06;So;0;ON;;;;;N;;;;;
+1F0A0;PLAYING CARD BACK;So;0;ON;;;;;N;;;;;
+1F0A1;PLAYING CARD ACE OF SPADES;So;0;ON;;;;;N;;;;;
+1F0A2;PLAYING CARD TWO OF SPADES;So;0;ON;;;;;N;;;;;
+1F0A3;PLAYING CARD THREE OF SPADES;So;0;ON;;;;;N;;;;;
+1F0A4;PLAYING CARD FOUR OF SPADES;So;0;ON;;;;;N;;;;;
+1F0A5;PLAYING CARD FIVE OF SPADES;So;0;ON;;;;;N;;;;;
+1F0A6;PLAYING CARD SIX OF SPADES;So;0;ON;;;;;N;;;;;
+1F0A7;PLAYING CARD SEVEN OF SPADES;So;0;ON;;;;;N;;;;;
+1F0A8;PLAYING CARD EIGHT OF SPADES;So;0;ON;;;;;N;;;;;
+1F0A9;PLAYING CARD NINE OF SPADES;So;0;ON;;;;;N;;;;;
+1F0AA;PLAYING CARD TEN OF SPADES;So;0;ON;;;;;N;;;;;
+1F0AB;PLAYING CARD JACK OF SPADES;So;0;ON;;;;;N;;;;;
+1F0AC;PLAYING CARD KNIGHT OF SPADES;So;0;ON;;;;;N;;;;;
+1F0AD;PLAYING CARD QUEEN OF SPADES;So;0;ON;;;;;N;;;;;
+1F0AE;PLAYING CARD KING OF SPADES;So;0;ON;;;;;N;;;;;
+1F0B1;PLAYING CARD ACE OF HEARTS;So;0;ON;;;;;N;;;;;
+1F0B2;PLAYING CARD TWO OF HEARTS;So;0;ON;;;;;N;;;;;
+1F0B3;PLAYING CARD THREE OF HEARTS;So;0;ON;;;;;N;;;;;
+1F0B4;PLAYING CARD FOUR OF HEARTS;So;0;ON;;;;;N;;;;;
+1F0B5;PLAYING CARD FIVE OF HEARTS;So;0;ON;;;;;N;;;;;
+1F0B6;PLAYING CARD SIX OF HEARTS;So;0;ON;;;;;N;;;;;
+1F0B7;PLAYING CARD SEVEN OF HEARTS;So;0;ON;;;;;N;;;;;
+1F0B8;PLAYING CARD EIGHT OF HEARTS;So;0;ON;;;;;N;;;;;
+1F0B9;PLAYING CARD NINE OF HEARTS;So;0;ON;;;;;N;;;;;
+1F0BA;PLAYING CARD TEN OF HEARTS;So;0;ON;;;;;N;;;;;
+1F0BB;PLAYING CARD JACK OF HEARTS;So;0;ON;;;;;N;;;;;
+1F0BC;PLAYING CARD KNIGHT OF HEARTS;So;0;ON;;;;;N;;;;;
+1F0BD;PLAYING CARD QUEEN OF HEARTS;So;0;ON;;;;;N;;;;;
+1F0BE;PLAYING CARD KING OF HEARTS;So;0;ON;;;;;N;;;;;
+1F0C1;PLAYING CARD ACE OF DIAMONDS;So;0;ON;;;;;N;;;;;
+1F0C2;PLAYING CARD TWO OF DIAMONDS;So;0;ON;;;;;N;;;;;
+1F0C3;PLAYING CARD THREE OF DIAMONDS;So;0;ON;;;;;N;;;;;
+1F0C4;PLAYING CARD FOUR OF DIAMONDS;So;0;ON;;;;;N;;;;;
+1F0C5;PLAYING CARD FIVE OF DIAMONDS;So;0;ON;;;;;N;;;;;
+1F0C6;PLAYING CARD SIX OF DIAMONDS;So;0;ON;;;;;N;;;;;
+1F0C7;PLAYING CARD SEVEN OF DIAMONDS;So;0;ON;;;;;N;;;;;
+1F0C8;PLAYING CARD EIGHT OF DIAMONDS;So;0;ON;;;;;N;;;;;
+1F0C9;PLAYING CARD NINE OF DIAMONDS;So;0;ON;;;;;N;;;;;
+1F0CA;PLAYING CARD TEN OF DIAMONDS;So;0;ON;;;;;N;;;;;
+1F0CB;PLAYING CARD JACK OF DIAMONDS;So;0;ON;;;;;N;;;;;
+1F0CC;PLAYING CARD KNIGHT OF DIAMONDS;So;0;ON;;;;;N;;;;;
+1F0CD;PLAYING CARD QUEEN OF DIAMONDS;So;0;ON;;;;;N;;;;;
+1F0CE;PLAYING CARD KING OF DIAMONDS;So;0;ON;;;;;N;;;;;
+1F0CF;PLAYING CARD BLACK JOKER;So;0;ON;;;;;N;;;;;
+1F0D1;PLAYING CARD ACE OF CLUBS;So;0;ON;;;;;N;;;;;
+1F0D2;PLAYING CARD TWO OF CLUBS;So;0;ON;;;;;N;;;;;
+1F0D3;PLAYING CARD THREE OF CLUBS;So;0;ON;;;;;N;;;;;
+1F0D4;PLAYING CARD FOUR OF CLUBS;So;0;ON;;;;;N;;;;;
+1F0D5;PLAYING CARD FIVE OF CLUBS;So;0;ON;;;;;N;;;;;
+1F0D6;PLAYING CARD SIX OF CLUBS;So;0;ON;;;;;N;;;;;
+1F0D7;PLAYING CARD SEVEN OF CLUBS;So;0;ON;;;;;N;;;;;
+1F0D8;PLAYING CARD EIGHT OF CLUBS;So;0;ON;;;;;N;;;;;
+1F0D9;PLAYING CARD NINE OF CLUBS;So;0;ON;;;;;N;;;;;
+1F0DA;PLAYING CARD TEN OF CLUBS;So;0;ON;;;;;N;;;;;
+1F0DB;PLAYING CARD JACK OF CLUBS;So;0;ON;;;;;N;;;;;
+1F0DC;PLAYING CARD KNIGHT OF CLUBS;So;0;ON;;;;;N;;;;;
+1F0DD;PLAYING CARD QUEEN OF CLUBS;So;0;ON;;;;;N;;;;;
+1F0DE;PLAYING CARD KING OF CLUBS;So;0;ON;;;;;N;;;;;
+1F0DF;PLAYING CARD WHITE JOKER;So;0;ON;;;;;N;;;;;
 1F100;DIGIT ZERO FULL STOP;No;0;EN;<compat> 0030 002E;;0;0;N;;;;;
 1F101;DIGIT ZERO COMMA;No;0;EN;<compat> 0030 002C;;0;0;N;;;;;
 1F102;DIGIT ONE COMMA;No;0;EN;<compat> 0031 002C;;1;1;N;;;;;
@@ -20875,28 +21843,136 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;;
 1F12C;CIRCLED ITALIC LATIN CAPITAL LETTER R;So;0;L;<circle> 0052;;;;N;;;;;
 1F12D;CIRCLED CD;So;0;L;<circle> 0043 0044;;;;N;;;;;
 1F12E;CIRCLED WZ;So;0;L;<circle> 0057 005A;;;;N;;;;;
+1F130;SQUARED LATIN CAPITAL LETTER A;So;0;L;<square> 0041;;;;N;;;;;
 1F131;SQUARED LATIN CAPITAL LETTER B;So;0;L;<square> 0042;;;;N;;;;;
+1F132;SQUARED LATIN CAPITAL LETTER C;So;0;L;<square> 0043;;;;N;;;;;
+1F133;SQUARED LATIN CAPITAL LETTER D;So;0;L;<square> 0044;;;;N;;;;;
+1F134;SQUARED LATIN CAPITAL LETTER E;So;0;L;<square> 0045;;;;N;;;;;
+1F135;SQUARED LATIN CAPITAL LETTER F;So;0;L;<square> 0046;;;;N;;;;;
+1F136;SQUARED LATIN CAPITAL LETTER G;So;0;L;<square> 0047;;;;N;;;;;
+1F137;SQUARED LATIN CAPITAL LETTER H;So;0;L;<square> 0048;;;;N;;;;;
+1F138;SQUARED LATIN CAPITAL LETTER I;So;0;L;<square> 0049;;;;N;;;;;
+1F139;SQUARED LATIN CAPITAL LETTER J;So;0;L;<square> 004A;;;;N;;;;;
+1F13A;SQUARED LATIN CAPITAL LETTER K;So;0;L;<square> 004B;;;;N;;;;;
+1F13B;SQUARED LATIN CAPITAL LETTER L;So;0;L;<square> 004C;;;;N;;;;;
+1F13C;SQUARED LATIN CAPITAL LETTER M;So;0;L;<square> 004D;;;;N;;;;;
 1F13D;SQUARED LATIN CAPITAL LETTER N;So;0;L;<square> 004E;;;;N;;;;;
+1F13E;SQUARED LATIN CAPITAL LETTER O;So;0;L;<square> 004F;;;;N;;;;;
 1F13F;SQUARED LATIN CAPITAL LETTER P;So;0;L;<square> 0050;;;;N;;;;;
+1F140;SQUARED LATIN CAPITAL LETTER Q;So;0;L;<square> 0051;;;;N;;;;;
+1F141;SQUARED LATIN CAPITAL LETTER R;So;0;L;<square> 0052;;;;N;;;;;
 1F142;SQUARED LATIN CAPITAL LETTER S;So;0;L;<square> 0053;;;;N;;;;;
+1F143;SQUARED LATIN CAPITAL LETTER T;So;0;L;<square> 0054;;;;N;;;;;
+1F144;SQUARED LATIN CAPITAL LETTER U;So;0;L;<square> 0055;;;;N;;;;;
+1F145;SQUARED LATIN CAPITAL LETTER V;So;0;L;<square> 0056;;;;N;;;;;
 1F146;SQUARED LATIN CAPITAL LETTER W;So;0;L;<square> 0057;;;;N;;;;;
+1F147;SQUARED LATIN CAPITAL LETTER X;So;0;L;<square> 0058;;;;N;;;;;
+1F148;SQUARED LATIN CAPITAL LETTER Y;So;0;L;<square> 0059;;;;N;;;;;
+1F149;SQUARED LATIN CAPITAL LETTER Z;So;0;L;<square> 005A;;;;N;;;;;
 1F14A;SQUARED HV;So;0;L;<square> 0048 0056;;;;N;;;;;
 1F14B;SQUARED MV;So;0;L;<square> 004D 0056;;;;N;;;;;
 1F14C;SQUARED SD;So;0;L;<square> 0053 0044;;;;N;;;;;
 1F14D;SQUARED SS;So;0;L;<square> 0053 0053;;;;N;;;;;
 1F14E;SQUARED PPV;So;0;L;<square> 0050 0050 0056;;;;N;;;;;
+1F14F;SQUARED WC;So;0;L;<square> 0057 0043;;;;N;;;;;
+1F150;NEGATIVE CIRCLED LATIN CAPITAL LETTER A;So;0;L;;;;;N;;;;;
+1F151;NEGATIVE CIRCLED LATIN CAPITAL LETTER B;So;0;L;;;;;N;;;;;
+1F152;NEGATIVE CIRCLED LATIN CAPITAL LETTER C;So;0;L;;;;;N;;;;;
+1F153;NEGATIVE CIRCLED LATIN CAPITAL LETTER D;So;0;L;;;;;N;;;;;
+1F154;NEGATIVE CIRCLED LATIN CAPITAL LETTER E;So;0;L;;;;;N;;;;;
+1F155;NEGATIVE CIRCLED LATIN CAPITAL LETTER F;So;0;L;;;;;N;;;;;
+1F156;NEGATIVE CIRCLED LATIN CAPITAL LETTER G;So;0;L;;;;;N;;;;;
 1F157;NEGATIVE CIRCLED LATIN CAPITAL LETTER H;So;0;L;;;;;N;;;;;
+1F158;NEGATIVE CIRCLED LATIN CAPITAL LETTER I;So;0;L;;;;;N;;;;;
+1F159;NEGATIVE CIRCLED LATIN CAPITAL LETTER J;So;0;L;;;;;N;;;;;
+1F15A;NEGATIVE CIRCLED LATIN CAPITAL LETTER K;So;0;L;;;;;N;;;;;
+1F15B;NEGATIVE CIRCLED LATIN CAPITAL LETTER L;So;0;L;;;;;N;;;;;
+1F15C;NEGATIVE CIRCLED LATIN CAPITAL LETTER M;So;0;L;;;;;N;;;;;
+1F15D;NEGATIVE CIRCLED LATIN CAPITAL LETTER N;So;0;L;;;;;N;;;;;
+1F15E;NEGATIVE CIRCLED LATIN CAPITAL LETTER O;So;0;L;;;;;N;;;;;
 1F15F;NEGATIVE CIRCLED LATIN CAPITAL LETTER P;So;0;L;;;;;N;;;;;
+1F160;NEGATIVE CIRCLED LATIN CAPITAL LETTER Q;So;0;L;;;;;N;;;;;
+1F161;NEGATIVE CIRCLED LATIN CAPITAL LETTER R;So;0;L;;;;;N;;;;;
+1F162;NEGATIVE CIRCLED LATIN CAPITAL LETTER S;So;0;L;;;;;N;;;;;
+1F163;NEGATIVE CIRCLED LATIN CAPITAL LETTER T;So;0;L;;;;;N;;;;;
+1F164;NEGATIVE CIRCLED LATIN CAPITAL LETTER U;So;0;L;;;;;N;;;;;
+1F165;NEGATIVE CIRCLED LATIN CAPITAL LETTER V;So;0;L;;;;;N;;;;;
+1F166;NEGATIVE CIRCLED LATIN CAPITAL LETTER W;So;0;L;;;;;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;;;;;
+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;;;;;
+1F173;NEGATIVE SQUARED LATIN CAPITAL LETTER D;So;0;L;;;;;N;;;;;
+1F174;NEGATIVE SQUARED LATIN CAPITAL LETTER E;So;0;L;;;;;N;;;;;
+1F175;NEGATIVE SQUARED LATIN CAPITAL LETTER F;So;0;L;;;;;N;;;;;
+1F176;NEGATIVE SQUARED LATIN CAPITAL LETTER G;So;0;L;;;;;N;;;;;
+1F177;NEGATIVE SQUARED LATIN CAPITAL LETTER H;So;0;L;;;;;N;;;;;
+1F178;NEGATIVE SQUARED LATIN CAPITAL LETTER I;So;0;L;;;;;N;;;;;
 1F179;NEGATIVE SQUARED LATIN CAPITAL LETTER J;So;0;L;;;;;N;;;;;
+1F17A;NEGATIVE SQUARED LATIN CAPITAL LETTER K;So;0;L;;;;;N;;;;;
 1F17B;NEGATIVE SQUARED LATIN CAPITAL LETTER L;So;0;L;;;;;N;;;;;
 1F17C;NEGATIVE SQUARED LATIN CAPITAL LETTER M;So;0;L;;;;;N;;;;;
+1F17D;NEGATIVE SQUARED LATIN CAPITAL LETTER N;So;0;L;;;;;N;;;;;
+1F17E;NEGATIVE SQUARED LATIN CAPITAL LETTER O;So;0;L;;;;;N;;;;;
 1F17F;NEGATIVE SQUARED LATIN CAPITAL LETTER P;So;0;L;;;;;N;;;;;
+1F180;NEGATIVE SQUARED LATIN CAPITAL LETTER Q;So;0;L;;;;;N;;;;;
+1F181;NEGATIVE SQUARED LATIN CAPITAL LETTER R;So;0;L;;;;;N;;;;;
+1F182;NEGATIVE SQUARED LATIN CAPITAL LETTER S;So;0;L;;;;;N;;;;;
+1F183;NEGATIVE SQUARED LATIN CAPITAL LETTER T;So;0;L;;;;;N;;;;;
+1F184;NEGATIVE SQUARED LATIN CAPITAL LETTER U;So;0;L;;;;;N;;;;;
+1F185;NEGATIVE SQUARED LATIN CAPITAL LETTER V;So;0;L;;;;;N;;;;;
+1F186;NEGATIVE SQUARED LATIN CAPITAL LETTER W;So;0;L;;;;;N;;;;;
+1F187;NEGATIVE SQUARED LATIN CAPITAL LETTER X;So;0;L;;;;;N;;;;;
+1F188;NEGATIVE SQUARED LATIN CAPITAL LETTER Y;So;0;L;;;;;N;;;;;
+1F189;NEGATIVE SQUARED LATIN CAPITAL LETTER Z;So;0;L;;;;;N;;;;;
 1F18A;CROSSED NEGATIVE SQUARED LATIN CAPITAL LETTER P;So;0;L;;;;;N;;;;;
 1F18B;NEGATIVE SQUARED IC;So;0;L;;;;;N;;;;;
 1F18C;NEGATIVE SQUARED PA;So;0;L;;;;;N;;;;;
 1F18D;NEGATIVE SQUARED SA;So;0;L;;;;;N;;;;;
+1F18E;NEGATIVE SQUARED AB;So;0;L;;;;;N;;;;;
+1F18F;NEGATIVE SQUARED WC;So;0;L;;;;;N;;;;;
 1F190;SQUARE DJ;So;0;L;<square> 0044 004A;;;;N;;;;;
+1F191;SQUARED CL;So;0;L;;;;;N;;;;;
+1F192;SQUARED COOL;So;0;L;;;;;N;;;;;
+1F193;SQUARED FREE;So;0;L;;;;;N;;;;;
+1F194;SQUARED ID;So;0;L;;;;;N;;;;;
+1F195;SQUARED NEW;So;0;L;;;;;N;;;;;
+1F196;SQUARED NG;So;0;L;;;;;N;;;;;
+1F197;SQUARED OK;So;0;L;;;;;N;;;;;
+1F198;SQUARED SOS;So;0;L;;;;;N;;;;;
+1F199;SQUARED UP WITH EXCLAMATION MARK;So;0;L;;;;;N;;;;;
+1F19A;SQUARED VS;So;0;L;;;;;N;;;;;
+1F1E6;REGIONAL INDICATOR SYMBOL LETTER A;So;0;L;;;;;N;;;;;
+1F1E7;REGIONAL INDICATOR SYMBOL LETTER B;So;0;L;;;;;N;;;;;
+1F1E8;REGIONAL INDICATOR SYMBOL LETTER C;So;0;L;;;;;N;;;;;
+1F1E9;REGIONAL INDICATOR SYMBOL LETTER D;So;0;L;;;;;N;;;;;
+1F1EA;REGIONAL INDICATOR SYMBOL LETTER E;So;0;L;;;;;N;;;;;
+1F1EB;REGIONAL INDICATOR SYMBOL LETTER F;So;0;L;;;;;N;;;;;
+1F1EC;REGIONAL INDICATOR SYMBOL LETTER G;So;0;L;;;;;N;;;;;
+1F1ED;REGIONAL INDICATOR SYMBOL LETTER H;So;0;L;;;;;N;;;;;
+1F1EE;REGIONAL INDICATOR SYMBOL LETTER I;So;0;L;;;;;N;;;;;
+1F1EF;REGIONAL INDICATOR SYMBOL LETTER J;So;0;L;;;;;N;;;;;
+1F1F0;REGIONAL INDICATOR SYMBOL LETTER K;So;0;L;;;;;N;;;;;
+1F1F1;REGIONAL INDICATOR SYMBOL LETTER L;So;0;L;;;;;N;;;;;
+1F1F2;REGIONAL INDICATOR SYMBOL LETTER M;So;0;L;;;;;N;;;;;
+1F1F3;REGIONAL INDICATOR SYMBOL LETTER N;So;0;L;;;;;N;;;;;
+1F1F4;REGIONAL INDICATOR SYMBOL LETTER O;So;0;L;;;;;N;;;;;
+1F1F5;REGIONAL INDICATOR SYMBOL LETTER P;So;0;L;;;;;N;;;;;
+1F1F6;REGIONAL INDICATOR SYMBOL LETTER Q;So;0;L;;;;;N;;;;;
+1F1F7;REGIONAL INDICATOR SYMBOL LETTER R;So;0;L;;;;;N;;;;;
+1F1F8;REGIONAL INDICATOR SYMBOL LETTER S;So;0;L;;;;;N;;;;;
+1F1F9;REGIONAL INDICATOR SYMBOL LETTER T;So;0;L;;;;;N;;;;;
+1F1FA;REGIONAL INDICATOR SYMBOL LETTER U;So;0;L;;;;;N;;;;;
+1F1FB;REGIONAL INDICATOR SYMBOL LETTER V;So;0;L;;;;;N;;;;;
+1F1FC;REGIONAL INDICATOR SYMBOL LETTER W;So;0;L;;;;;N;;;;;
+1F1FD;REGIONAL INDICATOR SYMBOL LETTER X;So;0;L;;;;;N;;;;;
+1F1FE;REGIONAL INDICATOR SYMBOL LETTER Y;So;0;L;;;;;N;;;;;
+1F1FF;REGIONAL INDICATOR SYMBOL LETTER Z;So;0;L;;;;;N;;;;;
 1F200;SQUARE HIRAGANA HOKA;So;0;L;<square> 307B 304B;;;;N;;;;;
+1F201;SQUARED KATAKANA KOKO;So;0;L;<square> 30B3 30B3;;;;N;;;;;
+1F202;SQUARED KATAKANA SA;So;0;L;<square> 30B5;;;;N;;;;;
 1F210;SQUARED CJK UNIFIED IDEOGRAPH-624B;So;0;L;<square> 624B;;;;N;;;;;
 1F211;SQUARED CJK UNIFIED IDEOGRAPH-5B57;So;0;L;<square> 5B57;;;;N;;;;;
 1F212;SQUARED CJK UNIFIED IDEOGRAPH-53CC;So;0;L;<square> 53CC;;;;N;;;;;
@@ -20931,6 +22007,15 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;;
 1F22F;SQUARED CJK UNIFIED IDEOGRAPH-6307;So;0;L;<square> 6307;;;;N;;;;;
 1F230;SQUARED CJK UNIFIED IDEOGRAPH-8D70;So;0;L;<square> 8D70;;;;N;;;;;
 1F231;SQUARED CJK UNIFIED IDEOGRAPH-6253;So;0;L;<square> 6253;;;;N;;;;;
+1F232;SQUARED CJK UNIFIED IDEOGRAPH-7981;So;0;L;<square> 7981;;;;N;;;;;
+1F233;SQUARED CJK UNIFIED IDEOGRAPH-7A7A;So;0;L;<square> 7A7A;;;;N;;;;;
+1F234;SQUARED CJK UNIFIED IDEOGRAPH-5408;So;0;L;<square> 5408;;;;N;;;;;
+1F235;SQUARED CJK UNIFIED IDEOGRAPH-6E80;So;0;L;<square> 6E80;;;;N;;;;;
+1F236;SQUARED CJK UNIFIED IDEOGRAPH-6709;So;0;L;<square> 6709;;;;N;;;;;
+1F237;SQUARED CJK UNIFIED IDEOGRAPH-6708;So;0;L;<square> 6708;;;;N;;;;;
+1F238;SQUARED CJK UNIFIED IDEOGRAPH-7533;So;0;L;<square> 7533;;;;N;;;;;
+1F239;SQUARED CJK UNIFIED IDEOGRAPH-5272;So;0;L;<square> 5272;;;;N;;;;;
+1F23A;SQUARED CJK UNIFIED IDEOGRAPH-55B6;So;0;L;<square> 55B6;;;;N;;;;;
 1F240;TORTOISE SHELL BRACKETED CJK UNIFIED IDEOGRAPH-672C;So;0;L;<compat> 3014 672C 3015;;;;N;;;;;
 1F241;TORTOISE SHELL BRACKETED CJK UNIFIED IDEOGRAPH-4E09;So;0;L;<compat> 3014 4E09 3015;;;;N;;;;;
 1F242;TORTOISE SHELL BRACKETED CJK UNIFIED IDEOGRAPH-4E8C;So;0;L;<compat> 3014 4E8C 3015;;;;N;;;;;
@@ -20940,10 +22025,792 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;;
 1F246;TORTOISE SHELL BRACKETED CJK UNIFIED IDEOGRAPH-76D7;So;0;L;<compat> 3014 76D7 3015;;;;N;;;;;
 1F247;TORTOISE SHELL BRACKETED CJK UNIFIED IDEOGRAPH-52DD;So;0;L;<compat> 3014 52DD 3015;;;;N;;;;;
 1F248;TORTOISE SHELL BRACKETED CJK UNIFIED IDEOGRAPH-6557;So;0;L;<compat> 3014 6557 3015;;;;N;;;;;
+1F250;CIRCLED IDEOGRAPH ADVANTAGE;So;0;L;<circle> 5F97;;;;N;;;;;
+1F251;CIRCLED IDEOGRAPH ACCEPT;So;0;L;<circle> 53EF;;;;N;;;;;
+1F300;CYCLONE;So;0;ON;;;;;N;;;;;
+1F301;FOGGY;So;0;ON;;;;;N;;;;;
+1F302;CLOSED UMBRELLA;So;0;ON;;;;;N;;;;;
+1F303;NIGHT WITH STARS;So;0;ON;;;;;N;;;;;
+1F304;SUNRISE OVER MOUNTAINS;So;0;ON;;;;;N;;;;;
+1F305;SUNRISE;So;0;ON;;;;;N;;;;;
+1F306;CITYSCAPE AT DUSK;So;0;ON;;;;;N;;;;;
+1F307;SUNSET OVER BUILDINGS;So;0;ON;;;;;N;;;;;
+1F308;RAINBOW;So;0;ON;;;;;N;;;;;
+1F309;BRIDGE AT NIGHT;So;0;ON;;;;;N;;;;;
+1F30A;WATER WAVE;So;0;ON;;;;;N;;;;;
+1F30B;VOLCANO;So;0;ON;;;;;N;;;;;
+1F30C;MILKY WAY;So;0;ON;;;;;N;;;;;
+1F30D;EARTH GLOBE EUROPE-AFRICA;So;0;ON;;;;;N;;;;;
+1F30E;EARTH GLOBE AMERICAS;So;0;ON;;;;;N;;;;;
+1F30F;EARTH GLOBE ASIA-AUSTRALIA;So;0;ON;;;;;N;;;;;
+1F310;GLOBE WITH MERIDIANS;So;0;ON;;;;;N;;;;;
+1F311;NEW MOON SYMBOL;So;0;ON;;;;;N;;;;;
+1F312;WAXING CRESCENT MOON SYMBOL;So;0;ON;;;;;N;;;;;
+1F313;FIRST QUARTER MOON SYMBOL;So;0;ON;;;;;N;;;;;
+1F314;WAXING GIBBOUS MOON SYMBOL;So;0;ON;;;;;N;;;;;
+1F315;FULL MOON SYMBOL;So;0;ON;;;;;N;;;;;
+1F316;WANING GIBBOUS MOON SYMBOL;So;0;ON;;;;;N;;;;;
+1F317;LAST QUARTER MOON SYMBOL;So;0;ON;;;;;N;;;;;
+1F318;WANING CRESCENT MOON SYMBOL;So;0;ON;;;;;N;;;;;
+1F319;CRESCENT MOON;So;0;ON;;;;;N;;;;;
+1F31A;NEW MOON WITH FACE;So;0;ON;;;;;N;;;;;
+1F31B;FIRST QUARTER MOON WITH FACE;So;0;ON;;;;;N;;;;;
+1F31C;LAST QUARTER MOON WITH FACE;So;0;ON;;;;;N;;;;;
+1F31D;FULL MOON WITH FACE;So;0;ON;;;;;N;;;;;
+1F31E;SUN WITH FACE;So;0;ON;;;;;N;;;;;
+1F31F;GLOWING STAR;So;0;ON;;;;;N;;;;;
+1F320;SHOOTING STAR;So;0;ON;;;;;N;;;;;
+1F330;CHESTNUT;So;0;ON;;;;;N;;;;;
+1F331;SEEDLING;So;0;ON;;;;;N;;;;;
+1F332;EVERGREEN TREE;So;0;ON;;;;;N;;;;;
+1F333;DECIDUOUS TREE;So;0;ON;;;;;N;;;;;
+1F334;PALM TREE;So;0;ON;;;;;N;;;;;
+1F335;CACTUS;So;0;ON;;;;;N;;;;;
+1F337;TULIP;So;0;ON;;;;;N;;;;;
+1F338;CHERRY BLOSSOM;So;0;ON;;;;;N;;;;;
+1F339;ROSE;So;0;ON;;;;;N;;;;;
+1F33A;HIBISCUS;So;0;ON;;;;;N;;;;;
+1F33B;SUNFLOWER;So;0;ON;;;;;N;;;;;
+1F33C;BLOSSOM;So;0;ON;;;;;N;;;;;
+1F33D;EAR OF MAIZE;So;0;ON;;;;;N;;;;;
+1F33E;EAR OF RICE;So;0;ON;;;;;N;;;;;
+1F33F;HERB;So;0;ON;;;;;N;;;;;
+1F340;FOUR LEAF CLOVER;So;0;ON;;;;;N;;;;;
+1F341;MAPLE LEAF;So;0;ON;;;;;N;;;;;
+1F342;FALLEN LEAF;So;0;ON;;;;;N;;;;;
+1F343;LEAF FLUTTERING IN WIND;So;0;ON;;;;;N;;;;;
+1F344;MUSHROOM;So;0;ON;;;;;N;;;;;
+1F345;TOMATO;So;0;ON;;;;;N;;;;;
+1F346;AUBERGINE;So;0;ON;;;;;N;;;;;
+1F347;GRAPES;So;0;ON;;;;;N;;;;;
+1F348;MELON;So;0;ON;;;;;N;;;;;
+1F349;WATERMELON;So;0;ON;;;;;N;;;;;
+1F34A;TANGERINE;So;0;ON;;;;;N;;;;;
+1F34B;LEMON;So;0;ON;;;;;N;;;;;
+1F34C;BANANA;So;0;ON;;;;;N;;;;;
+1F34D;PINEAPPLE;So;0;ON;;;;;N;;;;;
+1F34E;RED APPLE;So;0;ON;;;;;N;;;;;
+1F34F;GREEN APPLE;So;0;ON;;;;;N;;;;;
+1F350;PEAR;So;0;ON;;;;;N;;;;;
+1F351;PEACH;So;0;ON;;;;;N;;;;;
+1F352;CHERRIES;So;0;ON;;;;;N;;;;;
+1F353;STRAWBERRY;So;0;ON;;;;;N;;;;;
+1F354;HAMBURGER;So;0;ON;;;;;N;;;;;
+1F355;SLICE OF PIZZA;So;0;ON;;;;;N;;;;;
+1F356;MEAT ON BONE;So;0;ON;;;;;N;;;;;
+1F357;POULTRY LEG;So;0;ON;;;;;N;;;;;
+1F358;RICE CRACKER;So;0;ON;;;;;N;;;;;
+1F359;RICE BALL;So;0;ON;;;;;N;;;;;
+1F35A;COOKED RICE;So;0;ON;;;;;N;;;;;
+1F35B;CURRY AND RICE;So;0;ON;;;;;N;;;;;
+1F35C;STEAMING BOWL;So;0;ON;;;;;N;;;;;
+1F35D;SPAGHETTI;So;0;ON;;;;;N;;;;;
+1F35E;BREAD;So;0;ON;;;;;N;;;;;
+1F35F;FRENCH FRIES;So;0;ON;;;;;N;;;;;
+1F360;ROASTED SWEET POTATO;So;0;ON;;;;;N;;;;;
+1F361;DANGO;So;0;ON;;;;;N;;;;;
+1F362;ODEN;So;0;ON;;;;;N;;;;;
+1F363;SUSHI;So;0;ON;;;;;N;;;;;
+1F364;FRIED SHRIMP;So;0;ON;;;;;N;;;;;
+1F365;FISH CAKE WITH SWIRL DESIGN;So;0;ON;;;;;N;;;;;
+1F366;SOFT ICE CREAM;So;0;ON;;;;;N;;;;;
+1F367;SHAVED ICE;So;0;ON;;;;;N;;;;;
+1F368;ICE CREAM;So;0;ON;;;;;N;;;;;
+1F369;DOUGHNUT;So;0;ON;;;;;N;;;;;
+1F36A;COOKIE;So;0;ON;;;;;N;;;;;
+1F36B;CHOCOLATE BAR;So;0;ON;;;;;N;;;;;
+1F36C;CANDY;So;0;ON;;;;;N;;;;;
+1F36D;LOLLIPOP;So;0;ON;;;;;N;;;;;
+1F36E;CUSTARD;So;0;ON;;;;;N;;;;;
+1F36F;HONEY POT;So;0;ON;;;;;N;;;;;
+1F370;SHORTCAKE;So;0;ON;;;;;N;;;;;
+1F371;BENTO BOX;So;0;ON;;;;;N;;;;;
+1F372;POT OF FOOD;So;0;ON;;;;;N;;;;;
+1F373;COOKING;So;0;ON;;;;;N;;;;;
+1F374;FORK AND KNIFE;So;0;ON;;;;;N;;;;;
+1F375;TEACUP WITHOUT HANDLE;So;0;ON;;;;;N;;;;;
+1F376;SAKE BOTTLE AND CUP;So;0;ON;;;;;N;;;;;
+1F377;WINE GLASS;So;0;ON;;;;;N;;;;;
+1F378;COCKTAIL GLASS;So;0;ON;;;;;N;;;;;
+1F379;TROPICAL DRINK;So;0;ON;;;;;N;;;;;
+1F37A;BEER MUG;So;0;ON;;;;;N;;;;;
+1F37B;CLINKING BEER MUGS;So;0;ON;;;;;N;;;;;
+1F37C;BABY BOTTLE;So;0;ON;;;;;N;;;;;
+1F380;RIBBON;So;0;ON;;;;;N;;;;;
+1F381;WRAPPED PRESENT;So;0;ON;;;;;N;;;;;
+1F382;BIRTHDAY CAKE;So;0;ON;;;;;N;;;;;
+1F383;JACK-O-LANTERN;So;0;ON;;;;;N;;;;;
+1F384;CHRISTMAS TREE;So;0;ON;;;;;N;;;;;
+1F385;FATHER CHRISTMAS;So;0;ON;;;;;N;;;;;
+1F386;FIREWORKS;So;0;ON;;;;;N;;;;;
+1F387;FIREWORK SPARKLER;So;0;ON;;;;;N;;;;;
+1F388;BALLOON;So;0;ON;;;;;N;;;;;
+1F389;PARTY POPPER;So;0;ON;;;;;N;;;;;
+1F38A;CONFETTI BALL;So;0;ON;;;;;N;;;;;
+1F38B;TANABATA TREE;So;0;ON;;;;;N;;;;;
+1F38C;CROSSED FLAGS;So;0;ON;;;;;N;;;;;
+1F38D;PINE DECORATION;So;0;ON;;;;;N;;;;;
+1F38E;JAPANESE DOLLS;So;0;ON;;;;;N;;;;;
+1F38F;CARP STREAMER;So;0;ON;;;;;N;;;;;
+1F390;WIND CHIME;So;0;ON;;;;;N;;;;;
+1F391;MOON VIEWING CEREMONY;So;0;ON;;;;;N;;;;;
+1F392;SCHOOL SATCHEL;So;0;ON;;;;;N;;;;;
+1F393;GRADUATION CAP;So;0;ON;;;;;N;;;;;
+1F3A0;CAROUSEL HORSE;So;0;ON;;;;;N;;;;;
+1F3A1;FERRIS WHEEL;So;0;ON;;;;;N;;;;;
+1F3A2;ROLLER COASTER;So;0;ON;;;;;N;;;;;
+1F3A3;FISHING POLE AND FISH;So;0;ON;;;;;N;;;;;
+1F3A4;MICROPHONE;So;0;ON;;;;;N;;;;;
+1F3A5;MOVIE CAMERA;So;0;ON;;;;;N;;;;;
+1F3A6;CINEMA;So;0;ON;;;;;N;;;;;
+1F3A7;HEADPHONE;So;0;ON;;;;;N;;;;;
+1F3A8;ARTIST PALETTE;So;0;ON;;;;;N;;;;;
+1F3A9;TOP HAT;So;0;ON;;;;;N;;;;;
+1F3AA;CIRCUS TENT;So;0;ON;;;;;N;;;;;
+1F3AB;TICKET;So;0;ON;;;;;N;;;;;
+1F3AC;CLAPPER BOARD;So;0;ON;;;;;N;;;;;
+1F3AD;PERFORMING ARTS;So;0;ON;;;;;N;;;;;
+1F3AE;VIDEO GAME;So;0;ON;;;;;N;;;;;
+1F3AF;DIRECT HIT;So;0;ON;;;;;N;;;;;
+1F3B0;SLOT MACHINE;So;0;ON;;;;;N;;;;;
+1F3B1;BILLIARDS;So;0;ON;;;;;N;;;;;
+1F3B2;GAME DIE;So;0;ON;;;;;N;;;;;
+1F3B3;BOWLING;So;0;ON;;;;;N;;;;;
+1F3B4;FLOWER PLAYING CARDS;So;0;ON;;;;;N;;;;;
+1F3B5;MUSICAL NOTE;So;0;ON;;;;;N;;;;;
+1F3B6;MULTIPLE MUSICAL NOTES;So;0;ON;;;;;N;;;;;
+1F3B7;SAXOPHONE;So;0;ON;;;;;N;;;;;
+1F3B8;GUITAR;So;0;ON;;;;;N;;;;;
+1F3B9;MUSICAL KEYBOARD;So;0;ON;;;;;N;;;;;
+1F3BA;TRUMPET;So;0;ON;;;;;N;;;;;
+1F3BB;VIOLIN;So;0;ON;;;;;N;;;;;
+1F3BC;MUSICAL SCORE;So;0;ON;;;;;N;;;;;
+1F3BD;RUNNING SHIRT WITH SASH;So;0;ON;;;;;N;;;;;
+1F3BE;TENNIS RACQUET AND BALL;So;0;ON;;;;;N;;;;;
+1F3BF;SKI AND SKI BOOT;So;0;ON;;;;;N;;;;;
+1F3C0;BASKETBALL AND HOOP;So;0;ON;;;;;N;;;;;
+1F3C1;CHEQUERED FLAG;So;0;ON;;;;;N;;;;;
+1F3C2;SNOWBOARDER;So;0;ON;;;;;N;;;;;
+1F3C3;RUNNER;So;0;ON;;;;;N;;;;;
+1F3C4;SURFER;So;0;ON;;;;;N;;;;;
+1F3C6;TROPHY;So;0;ON;;;;;N;;;;;
+1F3C7;HORSE RACING;So;0;ON;;;;;N;;;;;
+1F3C8;AMERICAN FOOTBALL;So;0;ON;;;;;N;;;;;
+1F3C9;RUGBY FOOTBALL;So;0;ON;;;;;N;;;;;
+1F3CA;SWIMMER;So;0;ON;;;;;N;;;;;
+1F3E0;HOUSE BUILDING;So;0;ON;;;;;N;;;;;
+1F3E1;HOUSE WITH GARDEN;So;0;ON;;;;;N;;;;;
+1F3E2;OFFICE BUILDING;So;0;ON;;;;;N;;;;;
+1F3E3;JAPANESE POST OFFICE;So;0;ON;;;;;N;;;;;
+1F3E4;EUROPEAN POST OFFICE;So;0;ON;;;;;N;;;;;
+1F3E5;HOSPITAL;So;0;ON;;;;;N;;;;;
+1F3E6;BANK;So;0;ON;;;;;N;;;;;
+1F3E7;AUTOMATED TELLER MACHINE;So;0;ON;;;;;N;;;;;
+1F3E8;HOTEL;So;0;ON;;;;;N;;;;;
+1F3E9;LOVE HOTEL;So;0;ON;;;;;N;;;;;
+1F3EA;CONVENIENCE STORE;So;0;ON;;;;;N;;;;;
+1F3EB;SCHOOL;So;0;ON;;;;;N;;;;;
+1F3EC;DEPARTMENT STORE;So;0;ON;;;;;N;;;;;
+1F3ED;FACTORY;So;0;ON;;;;;N;;;;;
+1F3EE;IZAKAYA LANTERN;So;0;ON;;;;;N;;;;;
+1F3EF;JAPANESE CASTLE;So;0;ON;;;;;N;;;;;
+1F3F0;EUROPEAN CASTLE;So;0;ON;;;;;N;;;;;
+1F400;RAT;So;0;ON;;;;;N;;;;;
+1F401;MOUSE;So;0;ON;;;;;N;;;;;
+1F402;OX;So;0;ON;;;;;N;;;;;
+1F403;WATER BUFFALO;So;0;ON;;;;;N;;;;;
+1F404;COW;So;0;ON;;;;;N;;;;;
+1F405;TIGER;So;0;ON;;;;;N;;;;;
+1F406;LEOPARD;So;0;ON;;;;;N;;;;;
+1F407;RABBIT;So;0;ON;;;;;N;;;;;
+1F408;CAT;So;0;ON;;;;;N;;;;;
+1F409;DRAGON;So;0;ON;;;;;N;;;;;
+1F40A;CROCODILE;So;0;ON;;;;;N;;;;;
+1F40B;WHALE;So;0;ON;;;;;N;;;;;
+1F40C;SNAIL;So;0;ON;;;;;N;;;;;
+1F40D;SNAKE;So;0;ON;;;;;N;;;;;
+1F40E;HORSE;So;0;ON;;;;;N;;;;;
+1F40F;RAM;So;0;ON;;;;;N;;;;;
+1F410;GOAT;So;0;ON;;;;;N;;;;;
+1F411;SHEEP;So;0;ON;;;;;N;;;;;
+1F412;MONKEY;So;0;ON;;;;;N;;;;;
+1F413;ROOSTER;So;0;ON;;;;;N;;;;;
+1F414;CHICKEN;So;0;ON;;;;;N;;;;;
+1F415;DOG;So;0;ON;;;;;N;;;;;
+1F416;PIG;So;0;ON;;;;;N;;;;;
+1F417;BOAR;So;0;ON;;;;;N;;;;;
+1F418;ELEPHANT;So;0;ON;;;;;N;;;;;
+1F419;OCTOPUS;So;0;ON;;;;;N;;;;;
+1F41A;SPIRAL SHELL;So;0;ON;;;;;N;;;;;
+1F41B;BUG;So;0;ON;;;;;N;;;;;
+1F41C;ANT;So;0;ON;;;;;N;;;;;
+1F41D;HONEYBEE;So;0;ON;;;;;N;;;;;
+1F41E;LADY BEETLE;So;0;ON;;;;;N;;;;;
+1F41F;FISH;So;0;ON;;;;;N;;;;;
+1F420;TROPICAL FISH;So;0;ON;;;;;N;;;;;
+1F421;BLOWFISH;So;0;ON;;;;;N;;;;;
+1F422;TURTLE;So;0;ON;;;;;N;;;;;
+1F423;HATCHING CHICK;So;0;ON;;;;;N;;;;;
+1F424;BABY CHICK;So;0;ON;;;;;N;;;;;
+1F425;FRONT-FACING BABY CHICK;So;0;ON;;;;;N;;;;;
+1F426;BIRD;So;0;ON;;;;;N;;;;;
+1F427;PENGUIN;So;0;ON;;;;;N;;;;;
+1F428;KOALA;So;0;ON;;;;;N;;;;;
+1F429;POODLE;So;0;ON;;;;;N;;;;;
+1F42A;DROMEDARY CAMEL;So;0;ON;;;;;N;;;;;
+1F42B;BACTRIAN CAMEL;So;0;ON;;;;;N;;;;;
+1F42C;DOLPHIN;So;0;ON;;;;;N;;;;;
+1F42D;MOUSE FACE;So;0;ON;;;;;N;;;;;
+1F42E;COW FACE;So;0;ON;;;;;N;;;;;
+1F42F;TIGER FACE;So;0;ON;;;;;N;;;;;
+1F430;RABBIT FACE;So;0;ON;;;;;N;;;;;
+1F431;CAT FACE;So;0;ON;;;;;N;;;;;
+1F432;DRAGON FACE;So;0;ON;;;;;N;;;;;
+1F433;SPOUTING WHALE;So;0;ON;;;;;N;;;;;
+1F434;HORSE FACE;So;0;ON;;;;;N;;;;;
+1F435;MONKEY FACE;So;0;ON;;;;;N;;;;;
+1F436;DOG FACE;So;0;ON;;;;;N;;;;;
+1F437;PIG FACE;So;0;ON;;;;;N;;;;;
+1F438;FROG FACE;So;0;ON;;;;;N;;;;;
+1F439;HAMSTER FACE;So;0;ON;;;;;N;;;;;
+1F43A;WOLF FACE;So;0;ON;;;;;N;;;;;
+1F43B;BEAR FACE;So;0;ON;;;;;N;;;;;
+1F43C;PANDA FACE;So;0;ON;;;;;N;;;;;
+1F43D;PIG NOSE;So;0;ON;;;;;N;;;;;
+1F43E;PAW PRINTS;So;0;ON;;;;;N;;;;;
+1F440;EYES;So;0;ON;;;;;N;;;;;
+1F442;EAR;So;0;ON;;;;;N;;;;;
+1F443;NOSE;So;0;ON;;;;;N;;;;;
+1F444;MOUTH;So;0;ON;;;;;N;;;;;
+1F445;TONGUE;So;0;ON;;;;;N;;;;;
+1F446;WHITE UP POINTING BACKHAND INDEX;So;0;ON;;;;;N;;;;;
+1F447;WHITE DOWN POINTING BACKHAND INDEX;So;0;ON;;;;;N;;;;;
+1F448;WHITE LEFT POINTING BACKHAND INDEX;So;0;ON;;;;;N;;;;;
+1F449;WHITE RIGHT POINTING BACKHAND INDEX;So;0;ON;;;;;N;;;;;
+1F44A;FISTED HAND SIGN;So;0;ON;;;;;N;;;;;
+1F44B;WAVING HAND SIGN;So;0;ON;;;;;N;;;;;
+1F44C;OK HAND SIGN;So;0;ON;;;;;N;;;;;
+1F44D;THUMBS UP SIGN;So;0;ON;;;;;N;;;;;
+1F44E;THUMBS DOWN SIGN;So;0;ON;;;;;N;;;;;
+1F44F;CLAPPING HANDS SIGN;So;0;ON;;;;;N;;;;;
+1F450;OPEN HANDS SIGN;So;0;ON;;;;;N;;;;;
+1F451;CROWN;So;0;ON;;;;;N;;;;;
+1F452;WOMANS HAT;So;0;ON;;;;;N;;;;;
+1F453;EYEGLASSES;So;0;ON;;;;;N;;;;;
+1F454;NECKTIE;So;0;ON;;;;;N;;;;;
+1F455;T-SHIRT;So;0;ON;;;;;N;;;;;
+1F456;JEANS;So;0;ON;;;;;N;;;;;
+1F457;DRESS;So;0;ON;;;;;N;;;;;
+1F458;KIMONO;So;0;ON;;;;;N;;;;;
+1F459;BIKINI;So;0;ON;;;;;N;;;;;
+1F45A;WOMANS CLOTHES;So;0;ON;;;;;N;;;;;
+1F45B;PURSE;So;0;ON;;;;;N;;;;;
+1F45C;HANDBAG;So;0;ON;;;;;N;;;;;
+1F45D;POUCH;So;0;ON;;;;;N;;;;;
+1F45E;MANS SHOE;So;0;ON;;;;;N;;;;;
+1F45F;ATHLETIC SHOE;So;0;ON;;;;;N;;;;;
+1F460;HIGH-HEELED SHOE;So;0;ON;;;;;N;;;;;
+1F461;WOMANS SANDAL;So;0;ON;;;;;N;;;;;
+1F462;WOMANS BOOTS;So;0;ON;;;;;N;;;;;
+1F463;FOOTPRINTS;So;0;ON;;;;;N;;;;;
+1F464;BUST IN SILHOUETTE;So;0;ON;;;;;N;;;;;
+1F465;BUSTS IN SILHOUETTE;So;0;ON;;;;;N;;;;;
+1F466;BOY;So;0;ON;;;;;N;;;;;
+1F467;GIRL;So;0;ON;;;;;N;;;;;
+1F468;MAN;So;0;ON;;;;;N;;;;;
+1F469;WOMAN;So;0;ON;;;;;N;;;;;
+1F46A;FAMILY;So;0;ON;;;;;N;;;;;
+1F46B;MAN AND WOMAN HOLDING HANDS;So;0;ON;;;;;N;;;;;
+1F46C;TWO MEN HOLDING HANDS;So;0;ON;;;;;N;;;;;
+1F46D;TWO WOMEN HOLDING HANDS;So;0;ON;;;;;N;;;;;
+1F46E;POLICE OFFICER;So;0;ON;;;;;N;;;;;
+1F46F;WOMAN WITH BUNNY EARS;So;0;ON;;;;;N;;;;;
+1F470;BRIDE WITH VEIL;So;0;ON;;;;;N;;;;;
+1F471;PERSON WITH BLOND HAIR;So;0;ON;;;;;N;;;;;
+1F472;MAN WITH GUA PI MAO;So;0;ON;;;;;N;;;;;
+1F473;MAN WITH TURBAN;So;0;ON;;;;;N;;;;;
+1F474;OLDER MAN;So;0;ON;;;;;N;;;;;
+1F475;OLDER WOMAN;So;0;ON;;;;;N;;;;;
+1F476;BABY;So;0;ON;;;;;N;;;;;
+1F477;CONSTRUCTION WORKER;So;0;ON;;;;;N;;;;;
+1F478;PRINCESS;So;0;ON;;;;;N;;;;;
+1F479;JAPANESE OGRE;So;0;ON;;;;;N;;;;;
+1F47A;JAPANESE GOBLIN;So;0;ON;;;;;N;;;;;
+1F47B;GHOST;So;0;ON;;;;;N;;;;;
+1F47C;BABY ANGEL;So;0;ON;;;;;N;;;;;
+1F47D;EXTRATERRESTRIAL ALIEN;So;0;ON;;;;;N;;;;;
+1F47E;ALIEN MONSTER;So;0;ON;;;;;N;;;;;
+1F47F;IMP;So;0;ON;;;;;N;;;;;
+1F480;SKULL;So;0;ON;;;;;N;;;;;
+1F481;INFORMATION DESK PERSON;So;0;ON;;;;;N;;;;;
+1F482;GUARDSMAN;So;0;ON;;;;;N;;;;;
+1F483;DANCER;So;0;ON;;;;;N;;;;;
+1F484;LIPSTICK;So;0;ON;;;;;N;;;;;
+1F485;NAIL POLISH;So;0;ON;;;;;N;;;;;
+1F486;FACE MASSAGE;So;0;ON;;;;;N;;;;;
+1F487;HAIRCUT;So;0;ON;;;;;N;;;;;
+1F488;BARBER POLE;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;;;;;
+1F48D;RING;So;0;ON;;;;;N;;;;;
+1F48E;GEM STONE;So;0;ON;;;;;N;;;;;
+1F48F;KISS;So;0;ON;;;;;N;;;;;
+1F490;BOUQUET;So;0;ON;;;;;N;;;;;
+1F491;COUPLE WITH HEART;So;0;ON;;;;;N;;;;;
+1F492;WEDDING;So;0;ON;;;;;N;;;;;
+1F493;BEATING HEART;So;0;ON;;;;;N;;;;;
+1F494;BROKEN HEART;So;0;ON;;;;;N;;;;;
+1F495;TWO HEARTS;So;0;ON;;;;;N;;;;;
+1F496;SPARKLING HEART;So;0;ON;;;;;N;;;;;
+1F497;GROWING HEART;So;0;ON;;;;;N;;;;;
+1F498;HEART WITH ARROW;So;0;ON;;;;;N;;;;;
+1F499;BLUE HEART;So;0;ON;;;;;N;;;;;
+1F49A;GREEN HEART;So;0;ON;;;;;N;;;;;
+1F49B;YELLOW HEART;So;0;ON;;;;;N;;;;;
+1F49C;PURPLE HEART;So;0;ON;;;;;N;;;;;
+1F49D;HEART WITH RIBBON;So;0;ON;;;;;N;;;;;
+1F49E;REVOLVING HEARTS;So;0;ON;;;;;N;;;;;
+1F49F;HEART DECORATION;So;0;ON;;;;;N;;;;;
+1F4A0;DIAMOND SHAPE WITH A DOT INSIDE;So;0;ON;;;;;N;;;;;
+1F4A1;ELECTRIC LIGHT BULB;So;0;ON;;;;;N;;;;;
+1F4A2;ANGER SYMBOL;So;0;ON;;;;;N;;;;;
+1F4A3;BOMB;So;0;ON;;;;;N;;;;;
+1F4A4;SLEEPING SYMBOL;So;0;ON;;;;;N;;;;;
+1F4A5;COLLISION SYMBOL;So;0;ON;;;;;N;;;;;
+1F4A6;SPLASHING SWEAT SYMBOL;So;0;ON;;;;;N;;;;;
+1F4A7;DROPLET;So;0;ON;;;;;N;;;;;
+1F4A8;DASH SYMBOL;So;0;ON;;;;;N;;;;;
+1F4A9;PILE OF POO;So;0;ON;;;;;N;;;;;
+1F4AA;FLEXED BICEPS;So;0;ON;;;;;N;;;;;
+1F4AB;DIZZY SYMBOL;So;0;ON;;;;;N;;;;;
+1F4AC;SPEECH BALLOON;So;0;ON;;;;;N;;;;;
+1F4AD;THOUGHT BALLOON;So;0;ON;;;;;N;;;;;
+1F4AE;WHITE FLOWER;So;0;ON;;;;;N;;;;;
+1F4AF;HUNDRED POINTS SYMBOL;So;0;ON;;;;;N;;;;;
+1F4B0;MONEY BAG;So;0;ON;;;;;N;;;;;
+1F4B1;CURRENCY EXCHANGE;So;0;ON;;;;;N;;;;;
+1F4B2;HEAVY DOLLAR SIGN;So;0;ON;;;;;N;;;;;
+1F4B3;CREDIT CARD;So;0;ON;;;;;N;;;;;
+1F4B4;BANKNOTE WITH YEN SIGN;So;0;ON;;;;;N;;;;;
+1F4B5;BANKNOTE WITH DOLLAR SIGN;So;0;ON;;;;;N;;;;;
+1F4B6;BANKNOTE WITH EURO SIGN;So;0;ON;;;;;N;;;;;
+1F4B7;BANKNOTE WITH POUND SIGN;So;0;ON;;;;;N;;;;;
+1F4B8;MONEY WITH WINGS;So;0;ON;;;;;N;;;;;
+1F4B9;CHART WITH UPWARDS TREND AND YEN SIGN;So;0;ON;;;;;N;;;;;
+1F4BA;SEAT;So;0;ON;;;;;N;;;;;
+1F4BB;PERSONAL COMPUTER;So;0;ON;;;;;N;;;;;
+1F4BC;BRIEFCASE;So;0;ON;;;;;N;;;;;
+1F4BD;MINIDISC;So;0;ON;;;;;N;;;;;
+1F4BE;FLOPPY DISK;So;0;ON;;;;;N;;;;;
+1F4BF;OPTICAL DISC;So;0;ON;;;;;N;;;;;
+1F4C0;DVD;So;0;ON;;;;;N;;;;;
+1F4C1;FILE FOLDER;So;0;ON;;;;;N;;;;;
+1F4C2;OPEN FILE FOLDER;So;0;ON;;;;;N;;;;;
+1F4C3;PAGE WITH CURL;So;0;ON;;;;;N;;;;;
+1F4C4;PAGE FACING UP;So;0;ON;;;;;N;;;;;
+1F4C5;CALENDAR;So;0;ON;;;;;N;;;;;
+1F4C6;TEAR-OFF CALENDAR;So;0;ON;;;;;N;;;;;
+1F4C7;CARD INDEX;So;0;ON;;;;;N;;;;;
+1F4C8;CHART WITH UPWARDS TREND;So;0;ON;;;;;N;;;;;
+1F4C9;CHART WITH DOWNWARDS TREND;So;0;ON;;;;;N;;;;;
+1F4CA;BAR CHART;So;0;ON;;;;;N;;;;;
+1F4CB;CLIPBOARD;So;0;ON;;;;;N;;;;;
+1F4CC;PUSHPIN;So;0;ON;;;;;N;;;;;
+1F4CD;ROUND PUSHPIN;So;0;ON;;;;;N;;;;;
+1F4CE;PAPERCLIP;So;0;ON;;;;;N;;;;;
+1F4CF;STRAIGHT RULER;So;0;ON;;;;;N;;;;;
+1F4D0;TRIANGULAR RULER;So;0;ON;;;;;N;;;;;
+1F4D1;BOOKMARK TABS;So;0;ON;;;;;N;;;;;
+1F4D2;LEDGER;So;0;ON;;;;;N;;;;;
+1F4D3;NOTEBOOK;So;0;ON;;;;;N;;;;;
+1F4D4;NOTEBOOK WITH DECORATIVE COVER;So;0;ON;;;;;N;;;;;
+1F4D5;CLOSED BOOK;So;0;ON;;;;;N;;;;;
+1F4D6;OPEN BOOK;So;0;ON;;;;;N;;;;;
+1F4D7;GREEN BOOK;So;0;ON;;;;;N;;;;;
+1F4D8;BLUE BOOK;So;0;ON;;;;;N;;;;;
+1F4D9;ORANGE BOOK;So;0;ON;;;;;N;;;;;
+1F4DA;BOOKS;So;0;ON;;;;;N;;;;;
+1F4DB;NAME BADGE;So;0;ON;;;;;N;;;;;
+1F4DC;SCROLL;So;0;ON;;;;;N;;;;;
+1F4DD;MEMO;So;0;ON;;;;;N;;;;;
+1F4DE;TELEPHONE RECEIVER;So;0;ON;;;;;N;;;;;
+1F4DF;PAGER;So;0;ON;;;;;N;;;;;
+1F4E0;FAX MACHINE;So;0;ON;;;;;N;;;;;
+1F4E1;SATELLITE ANTENNA;So;0;ON;;;;;N;;;;;
+1F4E2;PUBLIC ADDRESS LOUDSPEAKER;So;0;ON;;;;;N;;;;;
+1F4E3;CHEERING MEGAPHONE;So;0;ON;;;;;N;;;;;
+1F4E4;OUTBOX TRAY;So;0;ON;;;;;N;;;;;
+1F4E5;INBOX TRAY;So;0;ON;;;;;N;;;;;
+1F4E6;PACKAGE;So;0;ON;;;;;N;;;;;
+1F4E7;E-MAIL SYMBOL;So;0;ON;;;;;N;;;;;
+1F4E8;INCOMING ENVELOPE;So;0;ON;;;;;N;;;;;
+1F4E9;ENVELOPE WITH DOWNWARDS ARROW ABOVE;So;0;ON;;;;;N;;;;;
+1F4EA;CLOSED MAILBOX WITH LOWERED FLAG;So;0;ON;;;;;N;;;;;
+1F4EB;CLOSED MAILBOX WITH RAISED FLAG;So;0;ON;;;;;N;;;;;
+1F4EC;OPEN MAILBOX WITH RAISED FLAG;So;0;ON;;;;;N;;;;;
+1F4ED;OPEN MAILBOX WITH LOWERED FLAG;So;0;ON;;;;;N;;;;;
+1F4EE;POSTBOX;So;0;ON;;;;;N;;;;;
+1F4EF;POSTAL HORN;So;0;ON;;;;;N;;;;;
+1F4F0;NEWSPAPER;So;0;ON;;;;;N;;;;;
+1F4F1;MOBILE PHONE;So;0;ON;;;;;N;;;;;
+1F4F2;MOBILE PHONE WITH RIGHTWARDS ARROW AT LEFT;So;0;ON;;;;;N;;;;;
+1F4F3;VIBRATION MODE;So;0;ON;;;;;N;;;;;
+1F4F4;MOBILE PHONE OFF;So;0;ON;;;;;N;;;;;
+1F4F5;NO MOBILE PHONES;So;0;ON;;;;;N;;;;;
+1F4F6;ANTENNA WITH BARS;So;0;ON;;;;;N;;;;;
+1F4F7;CAMERA;So;0;ON;;;;;N;;;;;
+1F4F9;VIDEO CAMERA;So;0;ON;;;;;N;;;;;
+1F4FA;TELEVISION;So;0;ON;;;;;N;;;;;
+1F4FB;RADIO;So;0;ON;;;;;N;;;;;
+1F4FC;VIDEOCASSETTE;So;0;ON;;;;;N;;;;;
+1F500;TWISTED RIGHTWARDS ARROWS;So;0;ON;;;;;N;;;;;
+1F501;CLOCKWISE RIGHTWARDS AND LEFTWARDS OPEN CIRCLE ARROWS;So;0;ON;;;;;N;;;;;
+1F502;CLOCKWISE RIGHTWARDS AND LEFTWARDS OPEN CIRCLE ARROWS WITH CIRCLED ONE OVERLAY;So;0;ON;;;;;N;;;;;
+1F503;CLOCKWISE DOWNWARDS AND UPWARDS OPEN CIRCLE ARROWS;So;0;ON;;;;;N;;;;;
+1F504;ANTICLOCKWISE DOWNWARDS AND UPWARDS OPEN CIRCLE ARROWS;So;0;ON;;;;;N;;;;;
+1F505;LOW BRIGHTNESS SYMBOL;So;0;ON;;;;;N;;;;;
+1F506;HIGH BRIGHTNESS SYMBOL;So;0;ON;;;;;N;;;;;
+1F507;SPEAKER WITH CANCELLATION STROKE;So;0;ON;;;;;N;;;;;
+1F508;SPEAKER;So;0;ON;;;;;N;;;;;
+1F509;SPEAKER WITH ONE SOUND WAVE;So;0;ON;;;;;N;;;;;
+1F50A;SPEAKER WITH THREE SOUND WAVES;So;0;ON;;;;;N;;;;;
+1F50B;BATTERY;So;0;ON;;;;;N;;;;;
+1F50C;ELECTRIC PLUG;So;0;ON;;;;;N;;;;;
+1F50D;LEFT-POINTING MAGNIFYING GLASS;So;0;ON;;;;;N;;;;;
+1F50E;RIGHT-POINTING MAGNIFYING GLASS;So;0;ON;;;;;N;;;;;
+1F50F;LOCK WITH INK PEN;So;0;ON;;;;;N;;;;;
+1F510;CLOSED LOCK WITH KEY;So;0;ON;;;;;N;;;;;
+1F511;KEY;So;0;ON;;;;;N;;;;;
+1F512;LOCK;So;0;ON;;;;;N;;;;;
+1F513;OPEN LOCK;So;0;ON;;;;;N;;;;;
+1F514;BELL;So;0;ON;;;;;N;;;;;
+1F515;BELL WITH CANCELLATION STROKE;So;0;ON;;;;;N;;;;;
+1F516;BOOKMARK;So;0;ON;;;;;N;;;;;
+1F517;LINK SYMBOL;So;0;ON;;;;;N;;;;;
+1F518;RADIO BUTTON;So;0;ON;;;;;N;;;;;
+1F519;BACK WITH LEFTWARDS ARROW ABOVE;So;0;ON;;;;;N;;;;;
+1F51A;END WITH LEFTWARDS ARROW ABOVE;So;0;ON;;;;;N;;;;;
+1F51B;ON WITH EXCLAMATION MARK WITH LEFT RIGHT ARROW ABOVE;So;0;ON;;;;;N;;;;;
+1F51C;SOON WITH RIGHTWARDS ARROW ABOVE;So;0;ON;;;;;N;;;;;
+1F51D;TOP WITH UPWARDS ARROW ABOVE;So;0;ON;;;;;N;;;;;
+1F51E;NO ONE UNDER EIGHTEEN SYMBOL;So;0;ON;;;;;N;;;;;
+1F51F;KEYCAP TEN;So;0;ON;;;;;N;;;;;
+1F520;INPUT SYMBOL FOR LATIN CAPITAL LETTERS;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;;;;;
+1F525;FIRE;So;0;ON;;;;;N;;;;;
+1F526;ELECTRIC TORCH;So;0;ON;;;;;N;;;;;
+1F527;WRENCH;So;0;ON;;;;;N;;;;;
+1F528;HAMMER;So;0;ON;;;;;N;;;;;
+1F529;NUT AND BOLT;So;0;ON;;;;;N;;;;;
+1F52A;HOCHO;So;0;ON;;;;;N;;;;;
+1F52B;PISTOL;So;0;ON;;;;;N;;;;;
+1F52C;MICROSCOPE;So;0;ON;;;;;N;;;;;
+1F52D;TELESCOPE;So;0;ON;;;;;N;;;;;
+1F52E;CRYSTAL BALL;So;0;ON;;;;;N;;;;;
+1F52F;SIX POINTED STAR WITH MIDDLE DOT;So;0;ON;;;;;N;;;;;
+1F530;JAPANESE SYMBOL FOR BEGINNER;So;0;ON;;;;;N;;;;;
+1F531;TRIDENT EMBLEM;So;0;ON;;;;;N;;;;;
+1F532;BLACK SQUARE BUTTON;So;0;ON;;;;;N;;;;;
+1F533;WHITE SQUARE BUTTON;So;0;ON;;;;;N;;;;;
+1F534;LARGE RED CIRCLE;So;0;ON;;;;;N;;;;;
+1F535;LARGE BLUE CIRCLE;So;0;ON;;;;;N;;;;;
+1F536;LARGE ORANGE DIAMOND;So;0;ON;;;;;N;;;;;
+1F537;LARGE BLUE DIAMOND;So;0;ON;;;;;N;;;;;
+1F538;SMALL ORANGE DIAMOND;So;0;ON;;;;;N;;;;;
+1F539;SMALL BLUE DIAMOND;So;0;ON;;;;;N;;;;;
+1F53A;UP-POINTING RED TRIANGLE;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;;;;;
+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;;;;;
+1F553;CLOCK FACE FOUR OCLOCK;So;0;ON;;;;;N;;;;;
+1F554;CLOCK FACE FIVE OCLOCK;So;0;ON;;;;;N;;;;;
+1F555;CLOCK FACE SIX OCLOCK;So;0;ON;;;;;N;;;;;
+1F556;CLOCK FACE SEVEN OCLOCK;So;0;ON;;;;;N;;;;;
+1F557;CLOCK FACE EIGHT OCLOCK;So;0;ON;;;;;N;;;;;
+1F558;CLOCK FACE NINE OCLOCK;So;0;ON;;;;;N;;;;;
+1F559;CLOCK FACE TEN OCLOCK;So;0;ON;;;;;N;;;;;
+1F55A;CLOCK FACE ELEVEN OCLOCK;So;0;ON;;;;;N;;;;;
+1F55B;CLOCK FACE TWELVE OCLOCK;So;0;ON;;;;;N;;;;;
+1F55C;CLOCK FACE ONE-THIRTY;So;0;ON;;;;;N;;;;;
+1F55D;CLOCK FACE TWO-THIRTY;So;0;ON;;;;;N;;;;;
+1F55E;CLOCK FACE THREE-THIRTY;So;0;ON;;;;;N;;;;;
+1F55F;CLOCK FACE FOUR-THIRTY;So;0;ON;;;;;N;;;;;
+1F560;CLOCK FACE FIVE-THIRTY;So;0;ON;;;;;N;;;;;
+1F561;CLOCK FACE SIX-THIRTY;So;0;ON;;;;;N;;;;;
+1F562;CLOCK FACE SEVEN-THIRTY;So;0;ON;;;;;N;;;;;
+1F563;CLOCK FACE EIGHT-THIRTY;So;0;ON;;;;;N;;;;;
+1F564;CLOCK FACE NINE-THIRTY;So;0;ON;;;;;N;;;;;
+1F565;CLOCK FACE TEN-THIRTY;So;0;ON;;;;;N;;;;;
+1F566;CLOCK FACE ELEVEN-THIRTY;So;0;ON;;;;;N;;;;;
+1F567;CLOCK FACE TWELVE-THIRTY;So;0;ON;;;;;N;;;;;
+1F5FB;MOUNT FUJI;So;0;ON;;;;;N;;;;;
+1F5FC;TOKYO TOWER;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;;;;;
+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;;;;;
+1F604;SMILING FACE WITH OPEN MOUTH AND SMILING EYES;So;0;ON;;;;;N;;;;;
+1F605;SMILING FACE WITH OPEN MOUTH AND COLD SWEAT;So;0;ON;;;;;N;;;;;
+1F606;SMILING FACE WITH OPEN MOUTH AND TIGHTLY-CLOSED EYES;So;0;ON;;;;;N;;;;;
+1F607;SMILING FACE WITH HALO;So;0;ON;;;;;N;;;;;
+1F608;SMILING FACE WITH HORNS;So;0;ON;;;;;N;;;;;
+1F609;WINKING FACE;So;0;ON;;;;;N;;;;;
+1F60A;SMILING FACE WITH SMILING EYES;So;0;ON;;;;;N;;;;;
+1F60B;FACE SAVOURING DELICIOUS FOOD;So;0;ON;;;;;N;;;;;
+1F60C;RELIEVED FACE;So;0;ON;;;;;N;;;;;
+1F60D;SMILING FACE WITH HEART-SHAPED EYES;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;;;;;
+1F612;UNAMUSED FACE;So;0;ON;;;;;N;;;;;
+1F613;FACE WITH COLD SWEAT;So;0;ON;;;;;N;;;;;
+1F614;PENSIVE FACE;So;0;ON;;;;;N;;;;;
+1F616;CONFOUNDED FACE;So;0;ON;;;;;N;;;;;
+1F618;FACE THROWING A KISS;So;0;ON;;;;;N;;;;;
+1F61A;KISSING FACE WITH CLOSED EYES;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;;;;;
+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;;;;;
+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;;;;;
+1F62D;LOUDLY CRYING 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;;;;;
+1F635;DIZZY FACE;So;0;ON;;;;;N;;;;;
+1F636;FACE WITHOUT MOUTH;So;0;ON;;;;;N;;;;;
+1F637;FACE WITH MEDICAL MASK;So;0;ON;;;;;N;;;;;
+1F638;GRINNING CAT FACE WITH SMILING EYES;So;0;ON;;;;;N;;;;;
+1F639;CAT FACE WITH TEARS OF JOY;So;0;ON;;;;;N;;;;;
+1F63A;SMILING CAT FACE WITH OPEN MOUTH;So;0;ON;;;;;N;;;;;
+1F63B;SMILING CAT FACE WITH HEART-SHAPED EYES;So;0;ON;;;;;N;;;;;
+1F63C;CAT FACE WITH WRY SMILE;So;0;ON;;;;;N;;;;;
+1F63D;KISSING CAT FACE WITH CLOSED EYES;So;0;ON;;;;;N;;;;;
+1F63E;POUTING CAT FACE;So;0;ON;;;;;N;;;;;
+1F63F;CRYING CAT FACE;So;0;ON;;;;;N;;;;;
+1F640;WEARY CAT FACE;So;0;ON;;;;;N;;;;;
+1F645;FACE WITH NO GOOD GESTURE;So;0;ON;;;;;N;;;;;
+1F646;FACE WITH OK GESTURE;So;0;ON;;;;;N;;;;;
+1F647;PERSON BOWING DEEPLY;So;0;ON;;;;;N;;;;;
+1F648;SEE-NO-EVIL MONKEY;So;0;ON;;;;;N;;;;;
+1F649;HEAR-NO-EVIL MONKEY;So;0;ON;;;;;N;;;;;
+1F64A;SPEAK-NO-EVIL MONKEY;So;0;ON;;;;;N;;;;;
+1F64B;HAPPY PERSON RAISING ONE HAND;So;0;ON;;;;;N;;;;;
+1F64C;PERSON RAISING BOTH HANDS IN CELEBRATION;So;0;ON;;;;;N;;;;;
+1F64D;PERSON FROWNING;So;0;ON;;;;;N;;;;;
+1F64E;PERSON WITH POUTING FACE;So;0;ON;;;;;N;;;;;
+1F64F;PERSON WITH FOLDED HANDS;So;0;ON;;;;;N;;;;;
+1F680;ROCKET;So;0;ON;;;;;N;;;;;
+1F681;HELICOPTER;So;0;ON;;;;;N;;;;;
+1F682;STEAM LOCOMOTIVE;So;0;ON;;;;;N;;;;;
+1F683;RAILWAY CAR;So;0;ON;;;;;N;;;;;
+1F684;HIGH-SPEED TRAIN;So;0;ON;;;;;N;;;;;
+1F685;HIGH-SPEED TRAIN WITH BULLET NOSE;So;0;ON;;;;;N;;;;;
+1F686;TRAIN;So;0;ON;;;;;N;;;;;
+1F687;METRO;So;0;ON;;;;;N;;;;;
+1F688;LIGHT RAIL;So;0;ON;;;;;N;;;;;
+1F689;STATION;So;0;ON;;;;;N;;;;;
+1F68A;TRAM;So;0;ON;;;;;N;;;;;
+1F68B;TRAM CAR;So;0;ON;;;;;N;;;;;
+1F68C;BUS;So;0;ON;;;;;N;;;;;
+1F68D;ONCOMING BUS;So;0;ON;;;;;N;;;;;
+1F68E;TROLLEYBUS;So;0;ON;;;;;N;;;;;
+1F68F;BUS STOP;So;0;ON;;;;;N;;;;;
+1F690;MINIBUS;So;0;ON;;;;;N;;;;;
+1F691;AMBULANCE;So;0;ON;;;;;N;;;;;
+1F692;FIRE ENGINE;So;0;ON;;;;;N;;;;;
+1F693;POLICE CAR;So;0;ON;;;;;N;;;;;
+1F694;ONCOMING POLICE CAR;So;0;ON;;;;;N;;;;;
+1F695;TAXI;So;0;ON;;;;;N;;;;;
+1F696;ONCOMING TAXI;So;0;ON;;;;;N;;;;;
+1F697;AUTOMOBILE;So;0;ON;;;;;N;;;;;
+1F698;ONCOMING AUTOMOBILE;So;0;ON;;;;;N;;;;;
+1F699;RECREATIONAL VEHICLE;So;0;ON;;;;;N;;;;;
+1F69A;DELIVERY TRUCK;So;0;ON;;;;;N;;;;;
+1F69B;ARTICULATED LORRY;So;0;ON;;;;;N;;;;;
+1F69C;TRACTOR;So;0;ON;;;;;N;;;;;
+1F69D;MONORAIL;So;0;ON;;;;;N;;;;;
+1F69E;MOUNTAIN RAILWAY;So;0;ON;;;;;N;;;;;
+1F69F;SUSPENSION RAILWAY;So;0;ON;;;;;N;;;;;
+1F6A0;MOUNTAIN CABLEWAY;So;0;ON;;;;;N;;;;;
+1F6A1;AERIAL TRAMWAY;So;0;ON;;;;;N;;;;;
+1F6A2;SHIP;So;0;ON;;;;;N;;;;;
+1F6A3;ROWBOAT;So;0;ON;;;;;N;;;;;
+1F6A4;SPEEDBOAT;So;0;ON;;;;;N;;;;;
+1F6A5;HORIZONTAL TRAFFIC LIGHT;So;0;ON;;;;;N;;;;;
+1F6A6;VERTICAL TRAFFIC LIGHT;So;0;ON;;;;;N;;;;;
+1F6A7;CONSTRUCTION SIGN;So;0;ON;;;;;N;;;;;
+1F6A8;POLICE CARS REVOLVING LIGHT;So;0;ON;;;;;N;;;;;
+1F6A9;TRIANGULAR FLAG ON POST;So;0;ON;;;;;N;;;;;
+1F6AA;DOOR;So;0;ON;;;;;N;;;;;
+1F6AB;NO ENTRY SIGN;So;0;ON;;;;;N;;;;;
+1F6AC;SMOKING SYMBOL;So;0;ON;;;;;N;;;;;
+1F6AD;NO SMOKING SYMBOL;So;0;ON;;;;;N;;;;;
+1F6AE;PUT LITTER IN ITS PLACE SYMBOL;So;0;ON;;;;;N;;;;;
+1F6AF;DO NOT LITTER SYMBOL;So;0;ON;;;;;N;;;;;
+1F6B0;POTABLE WATER SYMBOL;So;0;ON;;;;;N;;;;;
+1F6B1;NON-POTABLE WATER SYMBOL;So;0;ON;;;;;N;;;;;
+1F6B2;BICYCLE;So;0;ON;;;;;N;;;;;
+1F6B3;NO BICYCLES;So;0;ON;;;;;N;;;;;
+1F6B4;BICYCLIST;So;0;ON;;;;;N;;;;;
+1F6B5;MOUNTAIN BICYCLIST;So;0;ON;;;;;N;;;;;
+1F6B6;PEDESTRIAN;So;0;ON;;;;;N;;;;;
+1F6B7;NO PEDESTRIANS;So;0;ON;;;;;N;;;;;
+1F6B8;CHILDREN CROSSING;So;0;ON;;;;;N;;;;;
+1F6B9;MENS SYMBOL;So;0;ON;;;;;N;;;;;
+1F6BA;WOMENS SYMBOL;So;0;ON;;;;;N;;;;;
+1F6BB;RESTROOM;So;0;ON;;;;;N;;;;;
+1F6BC;BABY SYMBOL;So;0;ON;;;;;N;;;;;
+1F6BD;TOILET;So;0;ON;;;;;N;;;;;
+1F6BE;WATER CLOSET;So;0;ON;;;;;N;;;;;
+1F6BF;SHOWER;So;0;ON;;;;;N;;;;;
+1F6C0;BATH;So;0;ON;;;;;N;;;;;
+1F6C1;BATHTUB;So;0;ON;;;;;N;;;;;
+1F6C2;PASSPORT CONTROL;So;0;ON;;;;;N;;;;;
+1F6C3;CUSTOMS;So;0;ON;;;;;N;;;;;
+1F6C4;BAGGAGE CLAIM;So;0;ON;;;;;N;;;;;
+1F6C5;LEFT LUGGAGE;So;0;ON;;;;;N;;;;;
+1F700;ALCHEMICAL SYMBOL FOR QUINTESSENCE;So;0;ON;;;;;N;;;;;
+1F701;ALCHEMICAL SYMBOL FOR AIR;So;0;ON;;;;;N;;;;;
+1F702;ALCHEMICAL SYMBOL FOR FIRE;So;0;ON;;;;;N;;;;;
+1F703;ALCHEMICAL SYMBOL FOR EARTH;So;0;ON;;;;;N;;;;;
+1F704;ALCHEMICAL SYMBOL FOR WATER;So;0;ON;;;;;N;;;;;
+1F705;ALCHEMICAL SYMBOL FOR AQUAFORTIS;So;0;ON;;;;;N;;;;;
+1F706;ALCHEMICAL SYMBOL FOR AQUA REGIA;So;0;ON;;;;;N;;;;;
+1F707;ALCHEMICAL SYMBOL FOR AQUA REGIA-2;So;0;ON;;;;;N;;;;;
+1F708;ALCHEMICAL SYMBOL FOR AQUA VITAE;So;0;ON;;;;;N;;;;;
+1F709;ALCHEMICAL SYMBOL FOR AQUA VITAE-2;So;0;ON;;;;;N;;;;;
+1F70A;ALCHEMICAL SYMBOL FOR VINEGAR;So;0;ON;;;;;N;;;;;
+1F70B;ALCHEMICAL SYMBOL FOR VINEGAR-2;So;0;ON;;;;;N;;;;;
+1F70C;ALCHEMICAL SYMBOL FOR VINEGAR-3;So;0;ON;;;;;N;;;;;
+1F70D;ALCHEMICAL SYMBOL FOR SULFUR;So;0;ON;;;;;N;;;;;
+1F70E;ALCHEMICAL SYMBOL FOR PHILOSOPHERS SULFUR;So;0;ON;;;;;N;;;;;
+1F70F;ALCHEMICAL SYMBOL FOR BLACK SULFUR;So;0;ON;;;;;N;;;;;
+1F710;ALCHEMICAL SYMBOL FOR MERCURY SUBLIMATE;So;0;ON;;;;;N;;;;;
+1F711;ALCHEMICAL SYMBOL FOR MERCURY SUBLIMATE-2;So;0;ON;;;;;N;;;;;
+1F712;ALCHEMICAL SYMBOL FOR MERCURY SUBLIMATE-3;So;0;ON;;;;;N;;;;;
+1F713;ALCHEMICAL SYMBOL FOR CINNABAR;So;0;ON;;;;;N;;;;;
+1F714;ALCHEMICAL SYMBOL FOR SALT;So;0;ON;;;;;N;;;;;
+1F715;ALCHEMICAL SYMBOL FOR NITRE;So;0;ON;;;;;N;;;;;
+1F716;ALCHEMICAL SYMBOL FOR VITRIOL;So;0;ON;;;;;N;;;;;
+1F717;ALCHEMICAL SYMBOL FOR VITRIOL-2;So;0;ON;;;;;N;;;;;
+1F718;ALCHEMICAL SYMBOL FOR ROCK SALT;So;0;ON;;;;;N;;;;;
+1F719;ALCHEMICAL SYMBOL FOR ROCK SALT-2;So;0;ON;;;;;N;;;;;
+1F71A;ALCHEMICAL SYMBOL FOR GOLD;So;0;ON;;;;;N;;;;;
+1F71B;ALCHEMICAL SYMBOL FOR SILVER;So;0;ON;;;;;N;;;;;
+1F71C;ALCHEMICAL SYMBOL FOR IRON ORE;So;0;ON;;;;;N;;;;;
+1F71D;ALCHEMICAL SYMBOL FOR IRON ORE-2;So;0;ON;;;;;N;;;;;
+1F71E;ALCHEMICAL SYMBOL FOR CROCUS OF IRON;So;0;ON;;;;;N;;;;;
+1F71F;ALCHEMICAL SYMBOL FOR REGULUS OF IRON;So;0;ON;;;;;N;;;;;
+1F720;ALCHEMICAL SYMBOL FOR COPPER ORE;So;0;ON;;;;;N;;;;;
+1F721;ALCHEMICAL SYMBOL FOR IRON-COPPER ORE;So;0;ON;;;;;N;;;;;
+1F722;ALCHEMICAL SYMBOL FOR SUBLIMATE OF COPPER;So;0;ON;;;;;N;;;;;
+1F723;ALCHEMICAL SYMBOL FOR CROCUS OF COPPER;So;0;ON;;;;;N;;;;;
+1F724;ALCHEMICAL SYMBOL FOR CROCUS OF COPPER-2;So;0;ON;;;;;N;;;;;
+1F725;ALCHEMICAL SYMBOL FOR COPPER ANTIMONIATE;So;0;ON;;;;;N;;;;;
+1F726;ALCHEMICAL SYMBOL FOR SALT OF COPPER ANTIMONIATE;So;0;ON;;;;;N;;;;;
+1F727;ALCHEMICAL SYMBOL FOR SUBLIMATE OF SALT OF COPPER;So;0;ON;;;;;N;;;;;
+1F728;ALCHEMICAL SYMBOL FOR VERDIGRIS;So;0;ON;;;;;N;;;;;
+1F729;ALCHEMICAL SYMBOL FOR TIN ORE;So;0;ON;;;;;N;;;;;
+1F72A;ALCHEMICAL SYMBOL FOR LEAD ORE;So;0;ON;;;;;N;;;;;
+1F72B;ALCHEMICAL SYMBOL FOR ANTIMONY ORE;So;0;ON;;;;;N;;;;;
+1F72C;ALCHEMICAL SYMBOL FOR SUBLIMATE OF ANTIMONY;So;0;ON;;;;;N;;;;;
+1F72D;ALCHEMICAL SYMBOL FOR SALT OF ANTIMONY;So;0;ON;;;;;N;;;;;
+1F72E;ALCHEMICAL SYMBOL FOR SUBLIMATE OF SALT OF ANTIMONY;So;0;ON;;;;;N;;;;;
+1F72F;ALCHEMICAL SYMBOL FOR VINEGAR OF ANTIMONY;So;0;ON;;;;;N;;;;;
+1F730;ALCHEMICAL SYMBOL FOR REGULUS OF ANTIMONY;So;0;ON;;;;;N;;;;;
+1F731;ALCHEMICAL SYMBOL FOR REGULUS OF ANTIMONY-2;So;0;ON;;;;;N;;;;;
+1F732;ALCHEMICAL SYMBOL FOR REGULUS;So;0;ON;;;;;N;;;;;
+1F733;ALCHEMICAL SYMBOL FOR REGULUS-2;So;0;ON;;;;;N;;;;;
+1F734;ALCHEMICAL SYMBOL FOR REGULUS-3;So;0;ON;;;;;N;;;;;
+1F735;ALCHEMICAL SYMBOL FOR REGULUS-4;So;0;ON;;;;;N;;;;;
+1F736;ALCHEMICAL SYMBOL FOR ALKALI;So;0;ON;;;;;N;;;;;
+1F737;ALCHEMICAL SYMBOL FOR ALKALI-2;So;0;ON;;;;;N;;;;;
+1F738;ALCHEMICAL SYMBOL FOR MARCASITE;So;0;ON;;;;;N;;;;;
+1F739;ALCHEMICAL SYMBOL FOR SAL-AMMONIAC;So;0;ON;;;;;N;;;;;
+1F73A;ALCHEMICAL SYMBOL FOR ARSENIC;So;0;ON;;;;;N;;;;;
+1F73B;ALCHEMICAL SYMBOL FOR REALGAR;So;0;ON;;;;;N;;;;;
+1F73C;ALCHEMICAL SYMBOL FOR REALGAR-2;So;0;ON;;;;;N;;;;;
+1F73D;ALCHEMICAL SYMBOL FOR AURIPIGMENT;So;0;ON;;;;;N;;;;;
+1F73E;ALCHEMICAL SYMBOL FOR BISMUTH ORE;So;0;ON;;;;;N;;;;;
+1F73F;ALCHEMICAL SYMBOL FOR TARTAR;So;0;ON;;;;;N;;;;;
+1F740;ALCHEMICAL SYMBOL FOR TARTAR-2;So;0;ON;;;;;N;;;;;
+1F741;ALCHEMICAL SYMBOL FOR QUICK LIME;So;0;ON;;;;;N;;;;;
+1F742;ALCHEMICAL SYMBOL FOR BORAX;So;0;ON;;;;;N;;;;;
+1F743;ALCHEMICAL SYMBOL FOR BORAX-2;So;0;ON;;;;;N;;;;;
+1F744;ALCHEMICAL SYMBOL FOR BORAX-3;So;0;ON;;;;;N;;;;;
+1F745;ALCHEMICAL SYMBOL FOR ALUM;So;0;ON;;;;;N;;;;;
+1F746;ALCHEMICAL SYMBOL FOR OIL;So;0;ON;;;;;N;;;;;
+1F747;ALCHEMICAL SYMBOL FOR SPIRIT;So;0;ON;;;;;N;;;;;
+1F748;ALCHEMICAL SYMBOL FOR TINCTURE;So;0;ON;;;;;N;;;;;
+1F749;ALCHEMICAL SYMBOL FOR GUM;So;0;ON;;;;;N;;;;;
+1F74A;ALCHEMICAL SYMBOL FOR WAX;So;0;ON;;;;;N;;;;;
+1F74B;ALCHEMICAL SYMBOL FOR POWDER;So;0;ON;;;;;N;;;;;
+1F74C;ALCHEMICAL SYMBOL FOR CALX;So;0;ON;;;;;N;;;;;
+1F74D;ALCHEMICAL SYMBOL FOR TUTTY;So;0;ON;;;;;N;;;;;
+1F74E;ALCHEMICAL SYMBOL FOR CAPUT MORTUUM;So;0;ON;;;;;N;;;;;
+1F74F;ALCHEMICAL SYMBOL FOR SCEPTER OF JOVE;So;0;ON;;;;;N;;;;;
+1F750;ALCHEMICAL SYMBOL FOR CADUCEUS;So;0;ON;;;;;N;;;;;
+1F751;ALCHEMICAL SYMBOL FOR TRIDENT;So;0;ON;;;;;N;;;;;
+1F752;ALCHEMICAL SYMBOL FOR STARRED TRIDENT;So;0;ON;;;;;N;;;;;
+1F753;ALCHEMICAL SYMBOL FOR LODESTONE;So;0;ON;;;;;N;;;;;
+1F754;ALCHEMICAL SYMBOL FOR SOAP;So;0;ON;;;;;N;;;;;
+1F755;ALCHEMICAL SYMBOL FOR URINE;So;0;ON;;;;;N;;;;;
+1F756;ALCHEMICAL SYMBOL FOR HORSE DUNG;So;0;ON;;;;;N;;;;;
+1F757;ALCHEMICAL SYMBOL FOR ASHES;So;0;ON;;;;;N;;;;;
+1F758;ALCHEMICAL SYMBOL FOR POT ASHES;So;0;ON;;;;;N;;;;;
+1F759;ALCHEMICAL SYMBOL FOR BRICK;So;0;ON;;;;;N;;;;;
+1F75A;ALCHEMICAL SYMBOL FOR POWDERED BRICK;So;0;ON;;;;;N;;;;;
+1F75B;ALCHEMICAL SYMBOL FOR AMALGAM;So;0;ON;;;;;N;;;;;
+1F75C;ALCHEMICAL SYMBOL FOR STRATUM SUPER STRATUM;So;0;ON;;;;;N;;;;;
+1F75D;ALCHEMICAL SYMBOL FOR STRATUM SUPER STRATUM-2;So;0;ON;;;;;N;;;;;
+1F75E;ALCHEMICAL SYMBOL FOR SUBLIMATION;So;0;ON;;;;;N;;;;;
+1F75F;ALCHEMICAL SYMBOL FOR PRECIPITATE;So;0;ON;;;;;N;;;;;
+1F760;ALCHEMICAL SYMBOL FOR DISTILL;So;0;ON;;;;;N;;;;;
+1F761;ALCHEMICAL SYMBOL FOR DISSOLVE;So;0;ON;;;;;N;;;;;
+1F762;ALCHEMICAL SYMBOL FOR DISSOLVE-2;So;0;ON;;;;;N;;;;;
+1F763;ALCHEMICAL SYMBOL FOR PURIFY;So;0;ON;;;;;N;;;;;
+1F764;ALCHEMICAL SYMBOL FOR PUTREFACTION;So;0;ON;;;;;N;;;;;
+1F765;ALCHEMICAL SYMBOL FOR CRUCIBLE;So;0;ON;;;;;N;;;;;
+1F766;ALCHEMICAL SYMBOL FOR CRUCIBLE-2;So;0;ON;;;;;N;;;;;
+1F767;ALCHEMICAL SYMBOL FOR CRUCIBLE-3;So;0;ON;;;;;N;;;;;
+1F768;ALCHEMICAL SYMBOL FOR CRUCIBLE-4;So;0;ON;;;;;N;;;;;
+1F769;ALCHEMICAL SYMBOL FOR CRUCIBLE-5;So;0;ON;;;;;N;;;;;
+1F76A;ALCHEMICAL SYMBOL FOR ALEMBIC;So;0;ON;;;;;N;;;;;
+1F76B;ALCHEMICAL SYMBOL FOR BATH OF MARY;So;0;ON;;;;;N;;;;;
+1F76C;ALCHEMICAL SYMBOL FOR BATH OF VAPOURS;So;0;ON;;;;;N;;;;;
+1F76D;ALCHEMICAL SYMBOL FOR RETORT;So;0;ON;;;;;N;;;;;
+1F76E;ALCHEMICAL SYMBOL FOR HOUR;So;0;ON;;;;;N;;;;;
+1F76F;ALCHEMICAL SYMBOL FOR NIGHT;So;0;ON;;;;;N;;;;;
+1F770;ALCHEMICAL SYMBOL FOR DAY-NIGHT;So;0;ON;;;;;N;;;;;
+1F771;ALCHEMICAL SYMBOL FOR MONTH;So;0;ON;;;;;N;;;;;
+1F772;ALCHEMICAL SYMBOL FOR HALF DRAM;So;0;ON;;;;;N;;;;;
+1F773;ALCHEMICAL SYMBOL FOR HALF OUNCE;So;0;ON;;;;;N;;;;;
 20000;<CJK Ideograph Extension B, First>;Lo;0;L;;;;;N;;;;;
 2A6D6;<CJK Ideograph Extension B, Last>;Lo;0;L;;;;;N;;;;;
 2A700;<CJK Ideograph Extension C, First>;Lo;0;L;;;;;N;;;;;
 2B734;<CJK Ideograph Extension C, Last>;Lo;0;L;;;;;N;;;;;
+2B740;<CJK Ideograph Extension D, First>;Lo;0;L;;;;;N;;;;;
+2B81D;<CJK Ideograph Extension D, Last>;Lo;0;L;;;;;N;;;;;
 2F800;CJK COMPATIBILITY IDEOGRAPH-2F800;Lo;0;L;4E3D;;;;N;;;;;
 2F801;CJK COMPATIBILITY IDEOGRAPH-2F801;Lo;0;L;4E38;;;;N;;;;;
 2F802;CJK COMPATIBILITY IDEOGRAPH-2F802;Lo;0;L;4E41;;;;N;;;;;
diff --git a/admin/unidata/bidimirror.awk b/admin/unidata/bidimirror.awk
new file mode 100644 (file)
index 0000000..7965f36
--- /dev/null
@@ -0,0 +1,37 @@
+# Generate data for bidi_mirroring_table, see src/bidi.c:bidi_initialize.
+
+# Copyright (C) 2010, 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 Eli Zaretskii <eliz@gnu.org>
+
+BEGIN {
+     printf "  struct {\n    int from, to;\n  } bidi_mirror[] = {\n";
+     first = 1;
+ }
+
+$1 !~ /^#/ && NF >= 2 {
+     if (!first)
+        printf ",\n";
+     else
+        first = 0;
+     printf "\t{ 0x%s, 0x%s }", $1, $2;
+ }
+
+END {
+     printf " };\n";
+ }
diff --git a/admin/unidata/biditype.awk b/admin/unidata/biditype.awk
new file mode 100644 (file)
index 0000000..6e57884
--- /dev/null
@@ -0,0 +1,93 @@
+# Generate data for filling bidi_type_table, see src/bidi.c:bidi_initialize.
+
+# Copyright (C) 2010, 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 Eli Zaretskii <eliz@gnu.org>
+
+function trtype(type)
+{
+    # Types are listed in the order of decresing use in UnicodeData.txt:
+    if (type == "ON")
+       return "NEUTRAL_ON";
+    else if (type == "NSM")
+       return "WEAK_NSM";
+    else if (type == "AL")
+       return "STRONG_AL";
+    else if (type == "R")
+       return "STRONG_R";
+    else if (type == "BN")
+       return "WEAK_BN";
+    else if (type == "EN")
+       return "WEAK_EN";
+    else if (type == "ET")
+       return "WEAK_ET";
+    else if (type == "AN")
+       return "WEAK_AN";
+    else if (type == "WS")
+       return "NEUTRAL_WS";
+    else if (type == "CS")
+       return "WEAK_CS";
+    else if (type == "ES")
+       return "WEAK_ES";
+    else if (type == "B")
+       return "NEUTRAL_B";
+    else if (type == "S")
+       return "NEUTRAL_S";
+    else if (type == "LRE" || type == "RLE" || type == "LRO" || type == "RLO" || type == "PDF")
+       return type;
+    else if (type == "L")
+       return "STRONG_L";
+    else
+    {
+       printf "Unknown type: %s\n", type > "/dev/stderr";
+       exit 1;
+    }
+}
+
+BEGIN {
+     otype = "";
+     startcode = "";
+     endcode = "";
+     printf "  struct {\n    int from, to;\n    bidi_type_t type;\n  } bidi_type[] = {\n";
+     first = 1;
+ }
+
+ {   code = $1;
+     ntype = $5;
+     if (ntype != otype)
+     {
+        # Don't output data for L, as that's the default value, see bidi.c.
+        if (otype != "L" && startcode != "")
+        {
+            if (!first)
+                printf ",\n";
+            else
+                first = 0;
+            printf "\t{ 0x%s, 0x%s, %s }", startcode, endcode, trtype(otype);
+        }
+        otype = ntype;
+        startcode = code;
+        endcode = code;
+     }
+     else
+        endcode = code;
+ }
+
+END {
+     printf " };\n";
+ }
index 29562283bcbe9e0e60937e6090b292a7def1e2d2..58cea29db8b72e5aa8d0111bd7797ef59f4f0689 100644 (file)
@@ -27,9 +27,9 @@ lisp = $(CURDIR)/../../lisp
 # lisp/subdirs.el is not generated yet when the commands below run.
 EMACSLOADPATH = $(lisp);$(lisp)/international;$(lisp)/emacs-lisp
 # Quote EMACS so it could be a file name with embedded whitespace
-RUNEMACS = "$(EMACS)" -Q --multibyte -batch
+RUNEMACS = "$(EMACS)" -Q -batch
 
-all: $(DSTDIR)/charprop.el
+all: $(DSTDIR)/charprop.el ../../src/biditype.h ../../src/bidimirror.h
 
 .el.elc:
        $(RUNEMACS) -f batch-byte-compile $<
@@ -50,6 +50,16 @@ charprop-CMD: unidata-gen.elc unidata.txt
 
 ${DSTDIR}/charprop.el: charprop-$(SHELLTYPE)
 
+../../src/biditype.h: UnicodeData.txt
+       gawk -F";" -f biditype.awk -v BINMODE=2 $< > biditype.h
+       $(CP) biditype.h $@
+       $(DEL) biditype.h
+
+../../src/bidimirror.h: BidiMirroring.txt
+       gawk -F"[; ]+" -f bidimirror.awk -v BINMODE=2 $< > bidimirror.h
+       $(CP) bidimirror.h $@
+       $(DEL) bidimirror.h
+
 clean:
-       - $(DEL) unidata-gen.elc unidata.txt
+       - $(DEL) unidata-gen.elc unidata.txt biditype.h bidimirror.h
 
index f2eb0262e6029a824a20eeb76791a2d4e6e5a0ef..aac4e108b09a39caa04eacda0ae68138fb13e238 100644 (file)
@@ -23,7 +23,7 @@ rem   ----------------------------------------------------------------------
 rem   YOU'LL NEED THE FOLLOWING UTILITIES TO MAKE EMACS:\r
 rem\r
 rem   + msdos version 3 or better.\r
-rem   + DJGPP version 1.12maint1 or later (version 2.03 or later recommended).\r
+rem   + DJGPP version 2.0 or later (version 2.03 or later recommended).\r
 rem   + make utility that allows breaking of the 128 chars limit on\r
 rem     command lines.  ndmake (as of version 4.5) won't work due to a\r
 rem     line length limit.  The make that comes with DJGPP does work (and is\r
@@ -125,11 +125,10 @@ rm -f junk.c junk junk.exe
 Echo To compile 'Emacs' under MS-DOS you MUST have DJGPP installed!\r
 Goto End\r
 :go32Ok\r
-set djgpp_ver=1\r
-If ErrorLevel 20 set djgpp_ver=2\r
+set djgpp_ver=2\r
+If Not ErrorLevel 20 Echo To build 'Emacs' you need DJGPP v2.0 or later!\r
+If Not ErrorLevel 20 Goto End\r
 rm -f junk.c junk junk.exe\r
-rem The v1.x build does not need djecho\r
-if "%DJGPP_VER%" == "1" Goto djechoOk\r
 rem DJECHO is used by the top-level Makefile in the v2.x build\r
 Echo Checking whether 'djecho' is available...\r
 redir -o Nul -eo djecho -o junk.$$$ foo\r
@@ -159,12 +158,7 @@ sed -e '' config.in > config.tmp
 if "%X11%" == "" goto src4\r
 sed -f ../msdos/sed2x.inp <config.in >config.tmp\r
 :src4\r
-if "%DJGPP_VER%" == "2" Goto src41\r
-sed -f ../msdos/sed2.inp <config.tmp >config.h2\r
-goto src42\r
-:src41\r
 sed -f ../msdos/sed2v2.inp <config.tmp >config.h2\r
-:src42\r
 Rem See if DECL_ALIGN can be supported with this GCC\r
 rm -f junk.c junk.o junk junk.exe\r
 echo struct { int i; char *p; } __attribute__((__aligned__(8))) foo;  >junk.c\r
@@ -196,15 +190,10 @@ rem   On my system dir.h gets in the way.  It's a VMS file so who cares.
 if exist dir.h ren dir.h vmsdir.h\r
 \r
 rem   Create "makefile" from "makefile.in".\r
-rm -f Makefile junk.c\r
-sed -e "1,/== start of cpp stuff ==/s@^# .*$@@" <Makefile.in >junk.c\r
-If "%DJGPP_VER%" == "1" Goto mfV1\r
-gcc -E -traditional junk.c | sed -f ../msdos/sed1v2.inp >Makefile\r
-goto mfDone\r
-:mfV1\r
-gcc -E -traditional junk.c | sed -f ../msdos/sed1.inp >Makefile\r
-:mfDone\r
-rm -f junk.c\r
+rm -f Makefile makefile.tmp\r
+copy Makefile.in+deps.mk makefile.tmp\r
+sed -f ../msdos/sed1v2.inp <makefile.tmp >Makefile\r
+rm -f makefile.tmp\r
 \r
 if "%X11%" == "" goto src5\r
 mv Makefile makefile.tmp\r
@@ -212,6 +201,13 @@ sed -f ../msdos/sed1x.inp <makefile.tmp >Makefile
 rm -f makefile.tmp\r
 :src5\r
 \r
+if "%sys_malloc%" == "" goto src5a\r
+sed -e "/^GMALLOC_OBJ *=/s/gmalloc.o//" <Makefile >makefile.tmp\r
+sed -e "/^VMLIMIT_OBJ *=/s/vm-limit.o//" <makefile.tmp >makefile.tmp2\r
+sed -e "/^RALLOC_OBJ *=/s/ralloc.o//" <makefile.tmp2 >Makefile\r
+rm -f makefile.tmp makefile.tmp2\r
+:src5a\r
+\r
 if "%nodebug%" == "" goto src6\r
 sed -e "/^CFLAGS *=/s/ *-gcoff//" <Makefile >makefile.tmp\r
 sed -e "/^LDFLAGS *=/s/=/=-s/" <makefile.tmp >Makefile\r
@@ -221,16 +217,12 @@ cd ..
 rem   ----------------------------------------------------------------------\r
 Echo Configuring the library source directory...\r
 cd lib-src\r
-rem   Create "makefile" from "makefile.in".\r
-sed -e "1,/== start of cpp stuff ==/s@^#[      ].*$@@" <Makefile.in >junk.c\r
-gcc -E -traditional -I. -I../src junk.c | sed -e "s/^ /        /" -e "/^#/d" -e "/^[   \f]*$/d" >makefile.new\r
-If "%DJGPP_VER%" == "2" goto libsrc-v2\r
-sed -f ../msdos/sed3.inp <makefile.new >Makefile\r
-Goto libsrc2\r
-:libsrc-v2\r
-sed -f ../msdos/sed3v2.inp <makefile.new >Makefile\r
-:libsrc2\r
-rm -f makefile.new junk.c\r
+sed -f ../msdos/sed3v2.inp <Makefile.in >Makefile\r
+if "%X11%" == "" goto libsrc2a\r
+mv Makefile makefile.tmp\r
+sed -f ../msdos/sed3x.inp <makefile.tmp >Makefile\r
+rm -f makefile.tmp\r
+:libsrc2a\r
 if "%nodebug%" == "" goto libsrc3\r
 sed -e "/^CFLAGS *=/s/ *-gcoff//" <Makefile >makefile.tmp\r
 sed -e "/^ALL_CFLAGS *=/s/=/= -s/" <makefile.tmp >Makefile\r
@@ -271,7 +263,6 @@ rem   ----------------------------------------------------------------------
 Echo Configuring the main directory...\r
 If Exist .dir-locals.el update .dir-locals.el _dir-locals.el\r
 If Exist src\.dbxinit update src/.dbxinit src/_dbxinit\r
-If "%DJGPP_VER%" == "1" goto mainv1\r
 Echo Looking for the GDB init file...\r
 If Exist src\.gdbinit update src/.gdbinit src/_gdbinit\r
 If Exist src\_gdbinit goto gdbinitOk\r
@@ -286,8 +277,6 @@ goto End
 :gdbinitOk\r
 Echo Looking for the GDB init file...found\r
 copy msdos\mainmake.v2 Makefile >nul\r
-:mainv1\r
-If "%DJGPP_VER%" == "1" copy msdos\mainmake Makefile >nul\r
 rem   ----------------------------------------------------------------------\r
 goto End\r
 :SmallEnv\r
index d6ee074415ef2bb0b6af84f0f75598ae63f611cc..527c53690bdcdc862dd2ba37ba5b37069b461a62 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,18 +1,22 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.62 for emacs 23.2.
+# Generated by GNU Autoconf 2.65 for emacs 24.0.50.
+#
 #
 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+#
+#
 # This configure script is free software; the Free Software Foundation
 # gives unlimited permission to copy, distribute and modify it.
-## --------------------- ##
-## M4sh Initialization.  ##
-## --------------------- ##
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
 
 # Be more Bourne compatible
 DUALCASE=1; export DUALCASE # for MKS sh
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
   emulate sh
   NULLCMD=:
   # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
@@ -20,23 +24,15 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
   alias -g '${1+"$@"}'='"$@"'
   setopt NO_GLOB_SUBST
 else
-  case `(set -o) 2>/dev/null` in
-  *posix*) set -o posix ;;
+  case `(set -o) 2>/dev/null` in #(
+  *posix*) :
+    set -o posix ;; #(
+  *) :
+     ;;
 esac
-
 fi
 
 
-
-
-# PATH needs CR
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
 as_nl='
 '
 export as_nl
@@ -44,7 +40,13 @@ export as_nl
 as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
 as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
 as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
-if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='print -r --'
+  as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
   as_echo='printf %s\n'
   as_echo_n='printf %s'
 else
@@ -55,7 +57,7 @@ else
     as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
     as_echo_n_body='eval
       arg=$1;
-      case $arg in
+      case $arg in #(
       *"$as_nl"*)
        expr "X$arg" : "X\\(.*\\)$as_nl";
        arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
@@ -78,13 +80,6 @@ if test "${PATH_SEPARATOR+set}" != set; then
   }
 fi
 
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
-  as_unset=unset
-else
-  as_unset=false
-fi
-
 
 # IFS
 # We need space, tab and new line, in precisely that order.  Quoting is
@@ -94,15 +89,15 @@ fi
 IFS=" ""       $as_nl"
 
 # Find who we are.  Look in the path if we contain no directory separator.
-case $0 in
+case $0 in #((
   *[\\/]* ) as_myself=$0 ;;
   *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
+    test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+  done
 IFS=$as_save_IFS
 
      ;;
@@ -114,12 +109,16 @@ if test "x$as_myself" = x; then
 fi
 if test ! -f "$as_myself"; then
   $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
-  { (exit 1); exit 1; }
+  exit 1
 fi
 
-# Work around bugs in pre-3.0 UWIN ksh.
-for as_var in ENV MAIL MAILPATH
-do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there.  '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
 done
 PS1='$ '
 PS2='> '
@@ -131,7 +130,248 @@ export LC_ALL
 LANGUAGE=C
 export LANGUAGE
 
-# Required to use basename.
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+if test "x$CONFIG_SHELL" = x; then
+  as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
+  emulate sh
+  NULLCMD=:
+  # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '\${1+\"\$@\"}'='\"\$@\"'
+  setopt NO_GLOB_SUBST
+else
+  case \`(set -o) 2>/dev/null\` in #(
+  *posix*) :
+    set -o posix ;; #(
+  *) :
+     ;;
+esac
+fi
+"
+  as_required="as_fn_return () { (exit \$1); }
+as_fn_success () { as_fn_return 0; }
+as_fn_failure () { as_fn_return 1; }
+as_fn_ret_success () { return 0; }
+as_fn_ret_failure () { return 1; }
+
+exitcode=0
+as_fn_success || { exitcode=1; echo as_fn_success failed.; }
+as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
+as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
+as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
+if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
+
+else
+  exitcode=1; echo positional parameters were not saved.
+fi
+test x\$exitcode = x0 || exit 1"
+  as_suggested="  as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
+  as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
+  eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
+  test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
+test \$(( 1 + 1 )) = 2 || exit 1"
+  if (eval "$as_required") 2>/dev/null; then :
+  as_have_required=yes
+else
+  as_have_required=no
+fi
+  if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
+
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_found=false
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  as_found=:
+  case $as_dir in #(
+        /*)
+          for as_base in sh bash ksh sh5; do
+            # Try only shells that exist, to save several forks.
+            as_shell=$as_dir/$as_base
+            if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+                   { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
+  CONFIG_SHELL=$as_shell as_have_required=yes
+                  if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
+  break 2
+fi
+fi
+          done;;
+       esac
+  as_found=false
+done
+$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
+             { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
+  CONFIG_SHELL=$SHELL as_have_required=yes
+fi; }
+IFS=$as_save_IFS
+
+
+      if test "x$CONFIG_SHELL" != x; then :
+  # We cannot yet assume a decent shell, so we have to provide a
+       # neutralization value for shells without unset; and this also
+       # works around shells that cannot unset nonexistent variables.
+       BASH_ENV=/dev/null
+       ENV=/dev/null
+       (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+       export CONFIG_SHELL
+       exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
+fi
+
+    if test x$as_have_required = xno; then :
+  $as_echo "$0: This script requires a shell more modern than all"
+  $as_echo "$0: the shells that I found on your system."
+  if test x${ZSH_VERSION+set} = xset ; then
+    $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
+    $as_echo "$0: be upgraded to zsh 4.3.4 or later."
+  else
+    $as_echo "$0: Please tell bug-autoconf@gnu.org about your system,
+$0: including any error possibly output before this
+$0: message. Then install a modern shell, or manually run
+$0: the script under such a shell if you do have one."
+  fi
+  exit 1
+fi
+fi
+fi
+SHELL=${CONFIG_SHELL-/bin/sh}
+export SHELL
+# Unset more variables known to interfere with behavior of common tools.
+CLICOLOR_FORCE= GREP_OPTIONS=
+unset CLICOLOR_FORCE GREP_OPTIONS
+
+## --------------------- ##
+## M4sh Shell Functions. ##
+## --------------------- ##
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+  { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+  return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+  set +e
+  as_fn_set_status $1
+  exit $1
+} # as_fn_exit
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+  case $as_dir in #(
+  -*) as_dir=./$as_dir;;
+  esac
+  test -d "$as_dir" || eval $as_mkdir_p || {
+    as_dirs=
+    while :; do
+      case $as_dir in #(
+      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+      *) as_qdir=$as_dir;;
+      esac
+      as_dirs="'$as_qdir' $as_dirs"
+      as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$as_dir" : 'X\(//\)[^/]' \| \
+        X"$as_dir" : 'X\(//\)$' \| \
+        X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)[^/].*/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`
+      test -d "$as_dir" && break
+    done
+    test -z "$as_dirs" || eval "mkdir $as_dirs"
+  } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+  eval 'as_fn_append ()
+  {
+    eval $1+=\$2
+  }'
+else
+  as_fn_append ()
+  {
+    eval $1=\$$1\$2
+  }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+  eval 'as_fn_arith ()
+  {
+    as_val=$(( $* ))
+  }'
+else
+  as_fn_arith ()
+  {
+    as_val=`expr "$@" || test $? -eq 1`
+  }
+fi # as_fn_arith
+
+
+# as_fn_error ERROR [LINENO LOG_FD]
+# ---------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with status $?, using 1 if that was 0.
+as_fn_error ()
+{
+  as_status=$?; test $as_status -eq 0 && as_status=1
+  if test "$3"; then
+    as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+    $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3
+  fi
+  $as_echo "$as_me: error: $1" >&2
+  as_fn_exit $as_status
+} # as_fn_error
+
 if expr a : '\(a\)' >/dev/null 2>&1 &&
    test "X`expr 00001 : '.*\(...\)'`" = X001; then
   as_expr=expr
@@ -145,8 +385,12 @@ else
   as_basename=false
 fi
 
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
+else
+  as_dirname=false
+fi
 
-# Name of the executable.
 as_me=`$as_basename -- "$0" ||
 $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
         X"$0" : 'X\(//\)$' \| \
@@ -166,412 +410,124 @@ $as_echo X/"$0" |
          }
          s/.*/./; q'`
 
-# CDPATH.
-$as_unset CDPATH
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
 
 
-if test "x$CONFIG_SHELL" = x; then
-  if (eval ":") 2>/dev/null; then
-  as_have_required=yes
-else
-  as_have_required=no
-fi
+  as_lineno_1=$LINENO as_lineno_1a=$LINENO
+  as_lineno_2=$LINENO as_lineno_2a=$LINENO
+  eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
+  test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
+  # Blame Lee E. McMahon (1931-1989) for sed's syntax.  :-)
+  sed -n '
+    p
+    /[$]LINENO/=
+  ' <$as_myself |
+    sed '
+      s/[$]LINENO.*/&-/
+      t lineno
+      b
+      :lineno
+      N
+      :loop
+      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+      t loop
+      s/-\n.*//
+    ' >$as_me.lineno &&
+  chmod +x "$as_me.lineno" ||
+    { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
 
-  if test $as_have_required = yes &&    (eval ":
-(as_func_return () {
-  (exit \$1)
-}
-as_func_success () {
-  as_func_return 0
-}
-as_func_failure () {
-  as_func_return 1
-}
-as_func_ret_success () {
-  return 0
-}
-as_func_ret_failure () {
-  return 1
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensitive to this).
+  . "./$as_me.lineno"
+  # Exit status is that of the last command.
+  exit
 }
 
-exitcode=0
-if as_func_success; then
-  :
-else
-  exitcode=1
-  echo as_func_success failed.
-fi
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+  case `echo 'xy\c'` in
+  *c*) ECHO_T='        ';;     # ECHO_T is single tab character.
+  xy)  ECHO_C='\c';;
+  *)   echo `echo ksh88 bug on AIX 6.1` > /dev/null
+       ECHO_T='        ';;
+  esac;;
+*)
+  ECHO_N='-n';;
+esac
 
-if as_func_failure; then
-  exitcode=1
-  echo as_func_failure succeeded.
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+  rm -f conf$$.dir/conf$$.file
+else
+  rm -f conf$$.dir
+  mkdir conf$$.dir 2>/dev/null
 fi
-
-if as_func_ret_success; then
-  :
+if (echo >conf$$.file) 2>/dev/null; then
+  if ln -s conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s='ln -s'
+    # ... but there are two gotchas:
+    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+    # In both cases, we have to default to `cp -p'.
+    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+      as_ln_s='cp -p'
+  elif ln conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s=ln
+  else
+    as_ln_s='cp -p'
+  fi
 else
-  exitcode=1
-  echo as_func_ret_success failed.
+  as_ln_s='cp -p'
 fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
 
-if as_func_ret_failure; then
-  exitcode=1
-  echo as_func_ret_failure succeeded.
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p='mkdir -p "$as_dir"'
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
 fi
 
-if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
-  :
+if test -x / >/dev/null 2>&1; then
+  as_test_x='test -x'
 else
-  exitcode=1
-  echo positional parameters were not saved.
+  if ls -dL / >/dev/null 2>&1; then
+    as_ls_L_option=L
+  else
+    as_ls_L_option=
+  fi
+  as_test_x='
+    eval sh -c '\''
+      if test -d "$1"; then
+       test -d "$1/.";
+      else
+       case $1 in #(
+       -*)set "./$1";;
+       esac;
+       case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
+       ???[sx]*):;;*)false;;esac;fi
+    '\'' sh
+  '
 fi
+as_executable_p=$as_test_x
 
-test \$exitcode = 0) || { (exit 1); exit 1; }
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
 
-(
-  as_lineno_1=\$LINENO
-  as_lineno_2=\$LINENO
-  test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" &&
-  test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; }
-") 2> /dev/null; then
-  :
-else
-  as_candidate_shells=
-    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  case $as_dir in
-        /*)
-          for as_base in sh bash ksh sh5; do
-            as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
-          done;;
-       esac
-done
-IFS=$as_save_IFS
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
 
 
-      for as_shell in $as_candidate_shells $SHELL; do
-        # Try only shells that exist, to save several forks.
-        if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
-               { ("$as_shell") 2> /dev/null <<\_ASEOF
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
-  emulate sh
-  NULLCMD=:
-  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
-  # is contrary to our usage.  Disable this feature.
-  alias -g '${1+"$@"}'='"$@"'
-  setopt NO_GLOB_SUBST
-else
-  case `(set -o) 2>/dev/null` in
-  *posix*) set -o posix ;;
-esac
-
-fi
-
-
-:
-_ASEOF
-}; then
-  CONFIG_SHELL=$as_shell
-              as_have_required=yes
-              if { "$as_shell" 2> /dev/null <<\_ASEOF
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
-  emulate sh
-  NULLCMD=:
-  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
-  # is contrary to our usage.  Disable this feature.
-  alias -g '${1+"$@"}'='"$@"'
-  setopt NO_GLOB_SUBST
-else
-  case `(set -o) 2>/dev/null` in
-  *posix*) set -o posix ;;
-esac
-
-fi
-
-
-:
-(as_func_return () {
-  (exit $1)
-}
-as_func_success () {
-  as_func_return 0
-}
-as_func_failure () {
-  as_func_return 1
-}
-as_func_ret_success () {
-  return 0
-}
-as_func_ret_failure () {
-  return 1
-}
-
-exitcode=0
-if as_func_success; then
-  :
-else
-  exitcode=1
-  echo as_func_success failed.
-fi
-
-if as_func_failure; then
-  exitcode=1
-  echo as_func_failure succeeded.
-fi
-
-if as_func_ret_success; then
-  :
-else
-  exitcode=1
-  echo as_func_ret_success failed.
-fi
-
-if as_func_ret_failure; then
-  exitcode=1
-  echo as_func_ret_failure succeeded.
-fi
-
-if ( set x; as_func_ret_success y && test x = "$1" ); then
-  :
-else
-  exitcode=1
-  echo positional parameters were not saved.
-fi
-
-test $exitcode = 0) || { (exit 1); exit 1; }
-
-(
-  as_lineno_1=$LINENO
-  as_lineno_2=$LINENO
-  test "x$as_lineno_1" != "x$as_lineno_2" &&
-  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; }
-
-_ASEOF
-}; then
-  break
-fi
-
-fi
-
-      done
-
-      if test "x$CONFIG_SHELL" != x; then
-  for as_var in BASH_ENV ENV
-       do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
-       done
-       export CONFIG_SHELL
-       exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
-fi
-
-
-    if test $as_have_required = no; then
-  echo This script requires a shell more modern than all the
-      echo shells that I found on your system.  Please install a
-      echo modern shell, or manually run the script under such a
-      echo shell if you do have one.
-      { (exit 1); exit 1; }
-fi
-
-
-fi
-
-fi
-
-
-
-(eval "as_func_return () {
-  (exit \$1)
-}
-as_func_success () {
-  as_func_return 0
-}
-as_func_failure () {
-  as_func_return 1
-}
-as_func_ret_success () {
-  return 0
-}
-as_func_ret_failure () {
-  return 1
-}
-
-exitcode=0
-if as_func_success; then
-  :
-else
-  exitcode=1
-  echo as_func_success failed.
-fi
-
-if as_func_failure; then
-  exitcode=1
-  echo as_func_failure succeeded.
-fi
-
-if as_func_ret_success; then
-  :
-else
-  exitcode=1
-  echo as_func_ret_success failed.
-fi
-
-if as_func_ret_failure; then
-  exitcode=1
-  echo as_func_ret_failure succeeded.
-fi
-
-if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
-  :
-else
-  exitcode=1
-  echo positional parameters were not saved.
-fi
-
-test \$exitcode = 0") || {
-  echo No shell found that supports shell functions.
-  echo Please tell bug-autoconf@gnu.org about your system,
-  echo including any error possibly output before this message.
-  echo This can help us improve future autoconf versions.
-  echo Configuration will now proceed without shell functions.
-}
-
-
-
-  as_lineno_1=$LINENO
-  as_lineno_2=$LINENO
-  test "x$as_lineno_1" != "x$as_lineno_2" &&
-  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
-
-  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
-  # uniformly replaced by the line number.  The first 'sed' inserts a
-  # line-number line after each line using $LINENO; the second 'sed'
-  # does the real work.  The second script uses 'N' to pair each
-  # line-number line with the line containing $LINENO, and appends
-  # trailing '-' during substitution so that $LINENO is not a special
-  # case at line end.
-  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
-  # scripts with optimization help from Paolo Bonzini.  Blame Lee
-  # E. McMahon (1931-1989) for sed's syntax.  :-)
-  sed -n '
-    p
-    /[$]LINENO/=
-  ' <$as_myself |
-    sed '
-      s/[$]LINENO.*/&-/
-      t lineno
-      b
-      :lineno
-      N
-      :loop
-      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
-      t loop
-      s/-\n.*//
-    ' >$as_me.lineno &&
-  chmod +x "$as_me.lineno" ||
-    { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
-   { (exit 1); exit 1; }; }
-
-  # Don't try to exec as it changes $[0], causing all sort of problems
-  # (the dirname of $[0] is not the place where we might find the
-  # original and so on.  Autoconf is especially sensitive to this).
-  . "./$as_me.lineno"
-  # Exit status is that of the last command.
-  exit
-}
-
-
-if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
-  as_dirname=dirname
-else
-  as_dirname=false
-fi
-
-ECHO_C= ECHO_N= ECHO_T=
-case `echo -n x` in
--n*)
-  case `echo 'x\c'` in
-  *c*) ECHO_T='        ';;     # ECHO_T is single tab character.
-  *)   ECHO_C='\c';;
-  esac;;
-*)
-  ECHO_N='-n';;
-esac
-if expr a : '\(a\)' >/dev/null 2>&1 &&
-   test "X`expr 00001 : '.*\(...\)'`" = X001; then
-  as_expr=expr
-else
-  as_expr=false
-fi
-
-rm -f conf$$ conf$$.exe conf$$.file
-if test -d conf$$.dir; then
-  rm -f conf$$.dir/conf$$.file
-else
-  rm -f conf$$.dir
-  mkdir conf$$.dir 2>/dev/null
-fi
-if (echo >conf$$.file) 2>/dev/null; then
-  if ln -s conf$$.file conf$$ 2>/dev/null; then
-    as_ln_s='ln -s'
-    # ... but there are two gotchas:
-    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
-    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
-    # In both cases, we have to default to `cp -p'.
-    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
-      as_ln_s='cp -p'
-  elif ln conf$$.file conf$$ 2>/dev/null; then
-    as_ln_s=ln
-  else
-    as_ln_s='cp -p'
-  fi
-else
-  as_ln_s='cp -p'
-fi
-rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
-rmdir conf$$.dir 2>/dev/null
-
-if mkdir -p . 2>/dev/null; then
-  as_mkdir_p=:
-else
-  test -d ./-p && rmdir ./-p
-  as_mkdir_p=false
-fi
-
-if test -x / >/dev/null 2>&1; then
-  as_test_x='test -x'
-else
-  if ls -dL / >/dev/null 2>&1; then
-    as_ls_L_option=L
-  else
-    as_ls_L_option=
-  fi
-  as_test_x='
-    eval sh -c '\''
-      if test -d "$1"; then
-       test -d "$1/.";
-      else
-       case $1 in
-       -*)set "./$1";;
-       esac;
-       case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
-       ???[sx]*):;;*)false;;esac;fi
-    '\'' sh
-  '
-fi
-as_executable_p=$as_test_x
-
-# Sed expression to map a string onto a valid CPP name.
-as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
-
-# Sed expression to map a string onto a valid variable name.
-as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
-
-
-
-exec 7<&0 </dev/null 6>&1
+test -n "$DJDIR" || exec 7<&0 </dev/null
+exec 6>&1
 
 # Name of the host.
 # hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
@@ -589,14 +545,14 @@ cross_compiling=no
 subdirs=
 MFLAGS=
 MAKEFLAGS=
-SHELL=${CONFIG_SHELL-/bin/sh}
 
 # Identity of this package.
 PACKAGE_NAME='emacs'
 PACKAGE_TARNAME='emacs'
-PACKAGE_VERSION='23.2'
-PACKAGE_STRING='emacs 23.2'
+PACKAGE_VERSION='24.0.50'
+PACKAGE_STRING='emacs 24.0.50'
 PACKAGE_BUGREPORT=''
+PACKAGE_URL=''
 
 ac_unique_file="src/lisp.h"
 # Factoring default headers for most tests.
@@ -638,143 +594,210 @@ ac_includes_default="\
 ac_config_libobj_dir=src
 ac_header_list=
 ac_func_list=
-ac_subst_vars='SHELL
-PATH_SEPARATOR
-PACKAGE_NAME
-PACKAGE_TARNAME
-PACKAGE_VERSION
-PACKAGE_STRING
-PACKAGE_BUGREPORT
-exec_prefix
-prefix
-program_transform_name
-bindir
-sbindir
-libexecdir
-datarootdir
-datadir
-sysconfdir
-sharedstatedir
-localstatedir
-includedir
-oldincludedir
-docdir
-infodir
-htmldir
-dvidir
-pdfdir
-psdir
-libdir
-localedir
-mandir
-DEFS
-ECHO_C
-ECHO_N
-ECHO_T
-LIBS
-build_alias
-host_alias
-target_alias
-MAINT
-build
-build_cpu
-build_vendor
-build_os
-host
-host_cpu
-host_vendor
-host_os
-CC
-CFLAGS
-LDFLAGS
-CPPFLAGS
-ac_ct_CC
-EXEEXT
-OBJEXT
-CPP
-GREP
-EGREP
-LN_S
-INSTALL_PROGRAM
-INSTALL_SCRIPT
-INSTALL_DATA
-RANLIB
-INSTALL_INFO
-GZIP_PROG
-MAKEINFO
-LIBSOUND
-PKG_CONFIG
-ALSA_CFLAGS
-ALSA_LIBS
-CFLAGS_SOUND
-SET_MAKE
-XMKMF
-HAVE_XSERVER
-RSVG_CFLAGS
-RSVG_LIBS
-GTK_CFLAGS
-GTK_LIBS
-DBUS_CFLAGS
-DBUS_LIBS
-GCONF_CFLAGS
-GCONF_LIBS
-FONTCONFIG_CFLAGS
-FONTCONFIG_LIBS
-XFT_CFLAGS
-XFT_LIBS
-LIBOTF_CFLAGS
-LIBOTF_LIBS
-M17N_FLT_CFLAGS
-M17N_FLT_LIBS
-FREETYPE_CFLAGS
-FREETYPE_LIBS
-ALLOCA
-liblockfile
-LIBOBJS
-NEED_SETGID
-KMEM_GROUP
-GETLOADAVG_LIBS
-GETOPT_H
-GETOPTOBJS
-version
-configuration
-canonical
-srcdir
-lispdir
-locallisppath
-lisppath
-x_default_search_path
-etcdir
-archlibdir
-bitmapdir
-gamedir
-gameuser
-c_switch_system
-c_switch_machine
+ac_subst_vars='LTLIBOBJS
+WINDOW_SUPPORT
+TOOLTIP_SUPPORT
+MOUSE_SUPPORT
+LIB_GCC
+LINKER
+LD_SWITCH_SYSTEM_TEMACS
+POST_ALLOC_OBJ
+PRE_ALLOC_OBJ
+CYGWIN_OBJ
+RALLOC_OBJ
+OLDXMENU_DEPS
+LIBX_OTHER
+LIBXMENU
+OLDXMENU
+OLDXMENU_TARGET
+LIBXT_OTHER
+TOOLKIT_LIBW
+WIDGET_OBJ
+XOBJ
+XMENU_OBJ
+FONT_OBJ
+OTHER_FILES
+GNU_OBJC_CFLAGS
+ns_appsrc
+ns_appresdir
+ns_appbindir
+ns_appdir
+opsysfile
+machfile
+X_TOOLKIT_TYPE
+C_SWITCH_X_SYSTEM
+C_SWITCH_X_SITE
 LD_SWITCH_X_SITE
+gameuser
+gamedir
+bitmapdir
+archlibdir
+etcdir
+x_default_search_path
+lisppath
+locallisppath
+lispdir
+srcdir
+canonical
+configuration
+version
+KRB4LIB
+DESLIB
+KRB5LIB
+CRYPTOLIB
+COM_ERRLIB
+LIBRESOLV
+LIBHESIOD
+TERMCAP_OBJ
+LIBS_TERMCAP
+GETOPTOBJS
+GETOPT_H
+GETLOADAVG_LIBS
+KMEM_GROUP
+NEED_SETGID
+LIBOBJS
+BLESSMAIL_TARGET
+LIBS_MAIL
+liblockfile
+ALLOCA
+LIBXSM
+LIBGPM
+LIBGIF
+LIBTIFF
+LIBPNG
+LIBJPEG
+LIBXPM
+FREETYPE_LIBS
+FREETYPE_CFLAGS
+M17N_FLT_LIBS
+M17N_FLT_CFLAGS
+LIBOTF_LIBS
+LIBOTF_CFLAGS
+XFT_LIBS
+XFT_CFLAGS
+FONTCONFIG_LIBS
+FONTCONFIG_CFLAGS
+LIBXMU
+LIBXTR6
+LIBSELINUX_LIBS
+GCONF_LIBS
+GCONF_CFLAGS
+DBUS_OBJ
+DBUS_LIBS
+DBUS_CFLAGS
+GTK_OBJ
+GTK_LIBS
+GTK_CFLAGS
+IMAGEMAGICK_LIBS
+IMAGEMAGICK_CFLAGS
+RSVG_LIBS
+RSVG_CFLAGS
+VMLIMIT_OBJ
+GMALLOC_OBJ
+HAVE_XSERVER
+LIB_STANDARD
+NS_SUPPORT
+NS_OBJ
+TEMACS_LDFLAGS2
+LD_SWITCH_X_SITE_AUX_RPATH
 LD_SWITCH_X_SITE_AUX
-C_SWITCH_X_SITE
-X_TOOLKIT_TYPE
-machfile
-opsysfile
-ns_appdir
-ns_appbindir
-ns_appresdir
-ns_appsrc
-GNUSTEP_MAKEFILES
-GNUSTEP_SYSTEM_HEADERS
-GNUSTEP_SYSTEM_LIBRARIES
-GNU_OBJC_CFLAGS
-LIB_SRC_EXTRA_INSTALLABLES
-OTHER_FILES
-LTLIBOBJS'
-ac_subst_files=''
+XMKMF
+DEPFLAGS
+MKDEPDIR
+SET_MAKE
+CFLAGS_SOUND
+ALSA_LIBS
+ALSA_CFLAGS
+PKG_CONFIG
+LIBSOUND
+START_FILES
+LIB_MATH
+CRT_DIR
+LIBS_SYSTEM
+C_SWITCH_SYSTEM
+UNEXEC_OBJ
+C_SWITCH_MACHINE
+LD_SWITCH_SYSTEM
+CANNOT_DUMP
+MAKEINFO
+GZIP_PROG
+INSTALL_INFO
+RANLIB
+INSTALL_DATA
+INSTALL_SCRIPT
+INSTALL_PROGRAM
+C_WARNINGS_SWITCH
+EGREP
+GREP
+CPP
+OBJEXT
+EXEEXT
+ac_ct_CC
+CPPFLAGS
+LDFLAGS
+CFLAGS
+CC
+host_os
+host_vendor
+host_cpu
+host
+build_os
+build_vendor
+build_cpu
+build
+PROFILING_LDFLAGS
+PROFILING_CFLAGS
+MAINT
+GZIP_INFO
+target_alias
+host_alias
+build_alias
+LIBS
+ECHO_T
+ECHO_N
+ECHO_C
+DEFS
+mandir
+localedir
+libdir
+psdir
+pdfdir
+dvidir
+htmldir
+infodir
+docdir
+oldincludedir
+includedir
+localstatedir
+sharedstatedir
+sysconfdir
+datadir
+datarootdir
+libexecdir
+sbindir
+bindir
+program_transform_name
+prefix
+exec_prefix
+PACKAGE_URL
+PACKAGE_BUGREPORT
+PACKAGE_STRING
+PACKAGE_VERSION
+PACKAGE_TARNAME
+PACKAGE_NAME
+PATH_SEPARATOR
+SHELL'
+ac_subst_files='deps_frag
+ns_frag'
 ac_user_opts='
 enable_option_checking
 with_pop
 with_kerberos
 with_kerberos5
 with_hesiod
+with_mmdf
+with_mail_unlink
+with_mailhost
 with_sound
 with_sync_input
 with_x_toolkit
@@ -784,6 +807,7 @@ with_tiff
 with_gif
 with_png
 with_rsvg
+with_imagemagick
 with_xft
 with_libotf
 with_m17n_flt
@@ -794,16 +818,18 @@ with_ns
 with_gpm
 with_dbus
 with_gconf
+with_selinux
 with_makeinfo
-with_gtk
-with_gcc
+with_compress_info
 with_pkg_config_prog
+with_crt_dir
 with_gnustep_conf
 enable_ns_self_contained
 enable_asserts
 enable_maintainer_mode
 enable_locallisppath
 enable_checking
+enable_use_lisp_union_type
 enable_profiling
 enable_autodepend
 enable_largefile
@@ -927,8 +953,7 @@ do
     ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
     # Reject names that are not valid shell variable names.
     expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2
-   { (exit 1); exit 1; }; }
+      as_fn_error "invalid feature name: $ac_useropt"
     ac_useropt_orig=$ac_useropt
     ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
     case $ac_user_opts in
@@ -954,8 +979,7 @@ do
     ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
     # Reject names that are not valid shell variable names.
     expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2
-   { (exit 1); exit 1; }; }
+      as_fn_error "invalid feature name: $ac_useropt"
     ac_useropt_orig=$ac_useropt
     ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
     case $ac_user_opts in
@@ -1159,8 +1183,7 @@ do
     ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
     # Reject names that are not valid shell variable names.
     expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2
-   { (exit 1); exit 1; }; }
+      as_fn_error "invalid package name: $ac_useropt"
     ac_useropt_orig=$ac_useropt
     ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
     case $ac_user_opts in
@@ -1176,8 +1199,7 @@ do
     ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
     # Reject names that are not valid shell variable names.
     expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2
-   { (exit 1); exit 1; }; }
+      as_fn_error "invalid package name: $ac_useropt"
     ac_useropt_orig=$ac_useropt
     ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
     case $ac_user_opts in
@@ -1207,17 +1229,17 @@ do
   | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
     x_libraries=$ac_optarg ;;
 
-  -*) { $as_echo "$as_me: error: unrecognized option: $ac_option
-Try \`$0 --help' for more information." >&2
-   { (exit 1); exit 1; }; }
+  -*) as_fn_error "unrecognized option: \`$ac_option'
+Try \`$0 --help' for more information."
     ;;
 
   *=*)
     ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
     # Reject names that are not valid shell variable names.
-    expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
-      { $as_echo "$as_me: error: invalid variable name: $ac_envvar" >&2
-   { (exit 1); exit 1; }; }
+    case $ac_envvar in #(
+      '' | [0-9]* | *[!_$as_cr_alnum]* )
+      as_fn_error "invalid variable name: \`$ac_envvar'" ;;
+    esac
     eval $ac_envvar=\$ac_optarg
     export $ac_envvar ;;
 
@@ -1234,16 +1256,14 @@ done
 
 if test -n "$ac_prev"; then
   ac_option=--`echo $ac_prev | sed 's/_/-/g'`
-  { $as_echo "$as_me: error: missing argument to $ac_option" >&2
-   { (exit 1); exit 1; }; }
+  as_fn_error "missing argument to $ac_option"
 fi
 
 if test -n "$ac_unrecognized_opts"; then
   case $enable_option_checking in
     no) ;;
-    fatal) { $as_echo "$as_me: error: Unrecognized options: $ac_unrecognized_opts" >&2
-   { (exit 1); exit 1; }; } ;;
-    *)     $as_echo "$as_me: WARNING: Unrecognized options: $ac_unrecognized_opts" >&2 ;;
+    fatal) as_fn_error "unrecognized options: $ac_unrecognized_opts" ;;
+    *)     $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
   esac
 fi
 
@@ -1265,8 +1285,7 @@ do
     [\\/$]* | ?:[\\/]* )  continue;;
     NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
   esac
-  { $as_echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
-   { (exit 1); exit 1; }; }
+  as_fn_error "expected an absolute directory name for --$ac_var: $ac_val"
 done
 
 # There might be people who depend on the old broken behavior: `$host'
@@ -1296,11 +1315,9 @@ test "$silent" = yes && exec 6>/dev/null
 ac_pwd=`pwd` && test -n "$ac_pwd" &&
 ac_ls_di=`ls -di .` &&
 ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
-  { $as_echo "$as_me: error: Working directory cannot be determined" >&2
-   { (exit 1); exit 1; }; }
+  as_fn_error "working directory cannot be determined"
 test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
-  { $as_echo "$as_me: error: pwd does not report name of working directory" >&2
-   { (exit 1); exit 1; }; }
+  as_fn_error "pwd does not report name of working directory"
 
 
 # Find the source files, if location was not specified.
@@ -1339,13 +1356,11 @@ else
 fi
 if test ! -r "$srcdir/$ac_unique_file"; then
   test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
-  { $as_echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
-   { (exit 1); exit 1; }; }
+  as_fn_error "cannot find sources ($ac_unique_file) in $srcdir"
 fi
 ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
 ac_abs_confdir=`(
-       cd "$srcdir" && test -r "./$ac_unique_file" || { $as_echo "$as_me: error: $ac_msg" >&2
-   { (exit 1); exit 1; }; }
+       cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error "$ac_msg"
        pwd)`
 # When building in place, set srcdir=.
 if test "$ac_abs_confdir" = "$ac_pwd"; then
@@ -1371,7 +1386,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 23.2 to adapt to many kinds of systems.
+\`configure' configures emacs 24.0.50 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1445,7 +1460,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of emacs 23.2:";;
+     short | recursive ) echo "Configuration of emacs 24.0.50:";;
    esac
   cat <<\_ACEOF
 
@@ -1467,6 +1482,10 @@ Optional Features:
                           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.
   --enable-profiling      build emacs with profiling support. This might not
                           work on all platforms
   --enable-autodepend     automatically generate dependencies to .h-files.
@@ -1481,16 +1500,21 @@ Optional Packages:
   --with-kerberos         support Kerberos-authenticated POP
   --with-kerberos5        support Kerberos version 5 authenticated POP
   --with-hesiod           support Hesiod to get the POP server host
+  --with-mmdf             support MMDF mailboxes
+  --with-mail-unlink      unlink, rather than empty, mail spool after reading
+  --with-mailhost=HOSTNAME
+                          string giving default POP mail host
   --without-sound         don't compile with sound support
   --without-sync-input    process async input synchronously
-  --with-x-toolkit=KIT    use an X toolkit (KIT one of: yes, lucid, athena,
-                          motif, gtk, no)
+  --with-x-toolkit=KIT    use an X toolkit (KIT one of: yes or gtk, gtk3,
+                          lucid or athena, motif, no)
   --without-xpm           don't compile with XPM image support
   --without-jpeg          don't compile with JPEG image support
   --without-tiff          don't compile with TIFF image support
   --without-gif           don't compile with GIF image support
   --without-png           don't compile with PNG image support
   --without-rsvg          don't compile with SVG image support
+  --with-imagemagick      compile with ImageMagick image support
   --without-xft           don't use XFT for anti aliased fonts
   --without-libotf        don't use libotf for OpenType font support
   --without-m17n-flt      don't use m17n-flt for text shaping
@@ -1503,10 +1527,13 @@ Optional Packages:
                           console
   --without-dbus          don't compile with D-Bus support
   --without-gconf         don't compile with GConf support
+  --without-selinux       don't compile with SELinux support
   --without-makeinfo      don't require makeinfo for building manuals
-
+  --without-compress-info don't compress the installed Info pages
   --with-pkg-config-prog=PATH
                           path to pkg-config for finding GTK and librsvg
+  --with-crt-dir=DIR      directory containing crtn.o etc. The default is
+                          /usr/lib, or /usr/lib64 on some platforms.
   --with-gnustep-conf=PATH
                           path to GNUstep.conf; default $GNUSTEP_CONFIG_FILE,
                           or /etc/GNUstep/GNUstep.conf
@@ -1518,7 +1545,7 @@ Some influential environment variables:
   LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
               nonstandard directory <lib dir>
   LIBS        libraries to pass to the linker, e.g. -l<library>
-  CPPFLAGS    C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
+  CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
               you have headers in a nonstandard directory <include dir>
   CPP         C preprocessor
   XMKMF       Path to xmkmf, Makefile generator for X Window System
@@ -1526,6 +1553,7 @@ Some influential environment variables:
 Use these variables to override the choices made by `configure' or to help
 it to find libraries and programs with nonstandard names/locations.
 
+Report bugs to the package provider.
 _ACEOF
 ac_status=$?
 fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-emacs configure 23.2
-generated by GNU Autoconf 2.62
+emacs configure 24.0.50
+generated by GNU Autoconf 2.65
 
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+Copyright (C) 2009 Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it.
 _ACEOF
   exit
 fi
-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 23.2, which was
-generated by GNU Autoconf 2.62.  Invocation command line was
 
-  $ $0 $@
+## ------------------------ ##
+## Autoconf initialization. ##
+## ------------------------ ##
 
-_ACEOF
-exec 5>>config.log
+# ac_fn_c_try_compile LINENO
+# --------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_compile ()
 {
-cat <<_ASUNAME
-## --------- ##
-## Platform. ##
-## --------- ##
-
-hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
-uname -m = `(uname -m) 2>/dev/null || echo unknown`
-uname -r = `(uname -r) 2>/dev/null || echo unknown`
-uname -s = `(uname -s) 2>/dev/null || echo unknown`
-uname -v = `(uname -v) 2>/dev/null || echo unknown`
-
-/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
-/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
-
-/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
-/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
-/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
-/usr/bin/hostinfo      = `(/usr/bin/hostinfo) 2>/dev/null      || echo unknown`
-/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
-/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
-/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext
+  if { { ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compile") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
 
-_ASUNAME
+       ac_retval=1
+fi
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  as_fn_set_status $ac_retval
 
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  $as_echo "PATH: $as_dir"
-done
-IFS=$as_save_IFS
+} # ac_fn_c_try_compile
 
-} >&5
+# ac_fn_c_try_link LINENO
+# -----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_link ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext conftest$ac_exeext
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
 
-cat >&5 <<_ACEOF
+       ac_retval=1
+fi
+  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+  # interfere with the next link command; also delete a directory that is
+  # left behind by Apple's compiler.  We do this before executing the actions.
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  as_fn_set_status $ac_retval
 
+} # ac_fn_c_try_link
 
-## ----------- ##
-## Core tests. ##
-## ----------- ##
-
-_ACEOF
-
-
-# Keep a trace of the command line.
-# Strip out --no-create and --no-recursion so they do not pile up.
-# Strip out --silent because we don't want to record it for future runs.
-# Also quote any args containing shell meta-characters.
-# Make two passes to allow for proper duplicate-argument suppression.
-ac_configure_args=
-ac_configure_args0=
-ac_configure_args1=
-ac_must_keep_next=false
-for ac_pass in 1 2
-do
-  for ac_arg
-  do
-    case $ac_arg in
-    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
-    -q | -quiet | --quiet | --quie | --qui | --qu | --q \
-    | -silent | --silent | --silen | --sile | --sil)
-      continue ;;
-    *\'*)
-      ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
-    esac
-    case $ac_pass in
-    1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
-    2)
-      ac_configure_args1="$ac_configure_args1 '$ac_arg'"
-      if test $ac_must_keep_next = true; then
-       ac_must_keep_next=false # Got value, back to normal.
-      else
-       case $ac_arg in
-         *=* | --config-cache | -C | -disable-* | --disable-* \
-         | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
-         | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
-         | -with-* | --with-* | -without-* | --without-* | --x)
-           case "$ac_configure_args0 " in
-             "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
-           esac
-           ;;
-         -* ) ac_must_keep_next=true ;;
-       esac
-      fi
-      ac_configure_args="$ac_configure_args '$ac_arg'"
-      ;;
-    esac
-  done
-done
-$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
-$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
+# ac_fn_c_try_cpp LINENO
+# ----------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_cpp ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { { ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } >/dev/null && {
+        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
 
-# When interrupted or exit'd, cleanup temporary files, and complete
-# config.log.  We remove comments because anyway the quotes in there
-# would cause problems or look ugly.
-# WARNING: Use '\'' to represent an apostrophe within the trap.
-# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
-trap 'exit_status=$?
-  # Save into config.log some information that might help in debugging.
-  {
-    echo
+    ac_retval=1
+fi
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  as_fn_set_status $ac_retval
 
-    cat <<\_ASBOX
-## ---------------- ##
-## Cache variables. ##
-## ---------------- ##
-_ASBOX
-    echo
-    # The following way of writing the cache mishandles newlines in values,
-(
-  for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
-    eval ac_val=\$$ac_var
-    case $ac_val in #(
-    *${as_nl}*)
-      case $ac_var in #(
-      *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
-$as_echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
-      esac
-      case $ac_var in #(
-      _ | IFS | as_nl) ;; #(
-      BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
-      *) $as_unset $ac_var ;;
-      esac ;;
-    esac
-  done
-  (set) 2>&1 |
-    case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
-    *${as_nl}ac_space=\ *)
-      sed -n \
-       "s/'\''/'\''\\\\'\'''\''/g;
-         s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
-      ;; #(
-    *)
-      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
-      ;;
-    esac |
-    sort
-)
-    echo
+} # ac_fn_c_try_cpp
 
-    cat <<\_ASBOX
-## ----------------- ##
-## Output variables. ##
-## ----------------- ##
-_ASBOX
-    echo
-    for ac_var in $ac_subst_vars
-    do
-      eval ac_val=\$$ac_var
-      case $ac_val in
-      *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
-      esac
-      $as_echo "$ac_var='\''$ac_val'\''"
-    done | sort
-    echo
+# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists, giving a warning if it cannot be compiled using
+# the include files in INCLUDES and setting the cache variable VAR
+# accordingly.
+ac_fn_c_check_header_mongrel ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+  $as_echo_n "(cached) " >&6
+fi
+eval ac_res=\$$3
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
+$as_echo_n "checking $2 usability... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_header_compiler=yes
+else
+  ac_header_compiler=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
 
-    if test -n "$ac_subst_files"; then
-      cat <<\_ASBOX
-## ------------------- ##
-## File substitutions. ##
-## ------------------- ##
-_ASBOX
-      echo
-      for ac_var in $ac_subst_files
-      do
-       eval ac_val=\$$ac_var
-       case $ac_val in
-       *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
-       esac
-       $as_echo "$ac_var='\''$ac_val'\''"
-      done | sort
-      echo
-    fi
+# Is the header present?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
+$as_echo_n "checking $2 presence... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <$2>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  ac_header_preproc=yes
+else
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
 
-    if test -s confdefs.h; then
-      cat <<\_ASBOX
-## ----------- ##
-## confdefs.h. ##
-## ----------- ##
-_ASBOX
-      echo
-      cat confdefs.h
-      echo
-    fi
-    test "$ac_signal" != 0 &&
-      $as_echo "$as_me: caught signal $ac_signal"
-    $as_echo "$as_me: exit $exit_status"
-  } >&5
-  rm -f core *.core core.conftest.* &&
-    rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
-    exit $exit_status
-' 0
-for ac_signal in 1 2 13 15; do
-  trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
-done
-ac_signal=0
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
+  yes:no: )
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+    ;;
+  no:yes:* )
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $2:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+    ;;
+esac
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+  $as_echo_n "(cached) " >&6
+else
+  eval "$3=\$ac_header_compiler"
+fi
+eval ac_res=\$$3
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+fi
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
 
-# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -f -r conftest* confdefs.h
+} # ac_fn_c_check_header_mongrel
 
-# Predefined preprocessor variables.
+# ac_fn_c_try_run LINENO
+# ----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
+# that executables *can* be run.
+ac_fn_c_try_run ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
+  { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+       $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
 
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_NAME "$PACKAGE_NAME"
-_ACEOF
+       ac_retval=$ac_status
+fi
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  as_fn_set_status $ac_retval
 
+} # ac_fn_c_try_run
 
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists and can be compiled using the include files in
+# INCLUDES, setting the cache variable VAR accordingly.
+ac_fn_c_check_header_compile ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#include <$2>
 _ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$3=yes"
+else
+  eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+              { $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_header_compile
 
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_VERSION "$PACKAGE_VERSION"
-_ACEOF
-
+# ac_fn_c_check_decl LINENO SYMBOL VAR
+# ------------------------------------
+# Tests whether SYMBOL is declared, setting cache variable VAR accordingly.
+ac_fn_c_check_decl ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $2 is declared" >&5
+$as_echo_n "checking whether $2 is declared... " >&6; }
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+#ifndef $2
+  (void) $2;
+#endif
 
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_STRING "$PACKAGE_STRING"
+  ;
+  return 0;
+}
 _ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$3=yes"
+else
+  eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+              { $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_decl
 
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+# ac_fn_c_check_header_preproc LINENO HEADER VAR
+# ----------------------------------------------
+# Tests whether HEADER is present, setting the cache variable VAR accordingly.
+ac_fn_c_check_header_preproc ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <$2>
 _ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  eval "$3=yes"
+else
+  eval "$3=no"
+fi
+rm -f conftest.err conftest.$ac_ext
+fi
+eval ac_res=\$$3
+              { $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_header_preproc
 
-# Let the site file select an alternate cache file if it wants to.
-# Prefer an explicitly selected file to automatically selected ones.
-ac_site_file1=NONE
-ac_site_file2=NONE
-if test -n "$CONFIG_SITE"; then
-  ac_site_file1=$CONFIG_SITE
-elif test "x$prefix" != xNONE; then
-  ac_site_file1=$prefix/share/config.site
-  ac_site_file2=$prefix/etc/config.site
+# 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
-  ac_site_file1=$ac_default_prefix/share/config.site
-  ac_site_file2=$ac_default_prefix/etc/config.site
-fi
-for ac_site_file in "$ac_site_file1" "$ac_site_file2"
-do
-  test "x$ac_site_file" = xNONE && continue
-  if test -r "$ac_site_file"; then
-    { $as_echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
-$as_echo "$as_me: loading site script $ac_site_file" >&6;}
-    sed 's/^/| /' "$ac_site_file" >&5
-    . "$ac_site_file"
-  fi
-done
-
-if test -r "$cache_file"; then
-  # Some versions of bash will fail to source /dev/null (special
-  # files actually), so we avoid doing that.
-  if test -f "$cache_file"; then
-    { $as_echo "$as_me:$LINENO: loading cache $cache_file" >&5
-$as_echo "$as_me: loading cache $cache_file" >&6;}
-    case $cache_file in
-      [\\/]* | ?:[\\/]* ) . "$cache_file";;
-      *)                      . "./$cache_file";;
-    esac
-  fi
+  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
-  { $as_echo "$as_me:$LINENO: creating cache $cache_file" >&5
-$as_echo "$as_me: creating cache $cache_file" >&6;}
-  >$cache_file
+  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
-
-ac_header_list="$ac_header_list sys/time.h"
-ac_header_list="$ac_header_list unistd.h"
-ac_func_list="$ac_func_list alarm"
-# Check that the precious variables saved in the cache have kept the same
-# value.
-ac_cache_corrupted=false
-for ac_var in $ac_precious_vars; do
-  eval ac_old_set=\$ac_cv_env_${ac_var}_set
-  eval ac_new_set=\$ac_env_${ac_var}_set
-  eval ac_old_val=\$ac_cv_env_${ac_var}_value
-  eval ac_new_val=\$ac_env_${ac_var}_value
-  case $ac_old_set,$ac_new_set in
-    set,)
-      { $as_echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
-$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
-      ac_cache_corrupted=: ;;
-    ,set)
-      { $as_echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
-$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
-      ac_cache_corrupted=: ;;
-    ,);;
-    *)
-      if test "x$ac_old_val" != "x$ac_new_val"; then
-       # differences in whitespace do not lead to failure.
-       ac_old_val_w=`echo x $ac_old_val`
-       ac_new_val_w=`echo x $ac_new_val`
-       if test "$ac_old_val_w" != "$ac_new_val_w"; then
-         { $as_echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
-$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
-         ac_cache_corrupted=:
-       else
-         { $as_echo "$as_me:$LINENO: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
-$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
-         eval $ac_var=\$ac_old_val
-       fi
-       { $as_echo "$as_me:$LINENO:   former value:  \`$ac_old_val'" >&5
-$as_echo "$as_me:   former value:  \`$ac_old_val'" >&2;}
-       { $as_echo "$as_me:$LINENO:   current value: \`$ac_new_val'" >&5
-$as_echo "$as_me:   current value: \`$ac_new_val'" >&2;}
-      fi;;
-  esac
-  # Pass precious variables to config.status.
-  if test "$ac_new_set" = set; then
-    case $ac_new_val in
-    *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
-    *) ac_arg=$ac_var=$ac_new_val ;;
-    esac
-    case " $ac_configure_args " in
-      *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
-      *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
-    esac
-  fi
-done
-if $ac_cache_corrupted; then
-  { $as_echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
-$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
-  { { $as_echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
-$as_echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
-   { (exit 1); exit 1; }; }
+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
+ac_fn_c_check_func ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $2 innocuous_$2
 
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $2 (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
 
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
 
+#undef $2
 
+/* 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 $2 ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined __stub_$2 || defined __stub___$2
+choke me
+#endif
 
+int
+main ()
+{
+return $2 ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  eval "$3=yes"
+else
+  eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+              { $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_func
 
+# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
+# -------------------------------------------
+# Tests whether TYPE exists after having included INCLUDES, setting cache
+# variable VAR accordingly.
+ac_fn_c_check_type ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+  $as_echo_n "(cached) " >&6
+else
+  eval "$3=no"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+if (sizeof ($2))
+        return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+if (sizeof (($2)))
+           return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
 
+else
+  eval "$3=yes"
+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=\$$3
+              { $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_type
+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.0.50, which was
+generated by GNU Autoconf 2.65.  Invocation command line was
 
+  $ $0 $@
 
+_ACEOF
+exec 5>>config.log
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
 
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
 
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
 
+/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo      = `(/usr/bin/hostinfo) 2>/dev/null      || echo unknown`
+/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
+/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
 
+_ASUNAME
 
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    $as_echo "PATH: $as_dir"
+  done
+IFS=$as_save_IFS
 
+} >&5
 
+cat >&5 <<_ACEOF
 
 
+## ----------- ##
+## Core tests. ##
+## ----------- ##
 
-
-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
-
-
-ac_config_headers="$ac_config_headers src/config.h:src/config.in"
-
-
-
-test "$program_prefix" != NONE &&
-  program_transform_name="s&^&$program_prefix&;$program_transform_name"
-# Use a double $ so make ignores it.
-test "$program_suffix" != NONE &&
-  program_transform_name="s&\$&$program_suffix&;$program_transform_name"
-# Double any \ or $.
-# By default was `s,x,x', remove it if useless.
-ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
-program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
-
-
-lispdir='${datadir}/emacs/${version}/lisp'
-locallisppath='${datadir}/emacs/${version}/site-lisp:'\
-'${datadir}/emacs/site-lisp'
-lisppath='${locallisppath}:${lispdir}:${datadir}/emacs/${version}/leim'
-etcdir='${datadir}/emacs/${version}/etc'
-archlibdir='${libexecdir}/emacs/${version}/${configuration}'
-docdir='${datadir}/emacs/${version}/etc'
-gamedir='${localstatedir}/games/emacs'
-
-gameuser=games
-
-
-
-
-# Check whether --with-pop was given.
-if test "${with_pop+set}" = set; then
-  withval=$with_pop;
-else
-     with_pop=yes
-fi
-
-if test "$with_pop" = yes; then
-   cat >>confdefs.h <<\_ACEOF
-#define MAIL_USE_POP 1
 _ACEOF
 
-fi
-
-
-
-# Check whether --with-kerberos was given.
-if test "${with_kerberos+set}" = set; then
-  withval=$with_kerberos;
-else
-      with_kerberos=no
-fi
-
-if test "$with_kerberos" != no; then
-   cat >>confdefs.h <<\_ACEOF
-#define KERBEROS 1
-_ACEOF
-
-fi
-
 
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+  for ac_arg
+  do
+    case $ac_arg in
+    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+    -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+    | -silent | --silent | --silen | --sile | --sil)
+      continue ;;
+    *\'*)
+      ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    esac
+    case $ac_pass in
+    1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
+    2)
+      as_fn_append ac_configure_args1 " '$ac_arg'"
+      if test $ac_must_keep_next = true; then
+       ac_must_keep_next=false # Got value, back to normal.
+      else
+       case $ac_arg in
+         *=* | --config-cache | -C | -disable-* | --disable-* \
+         | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+         | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+         | -with-* | --with-* | -without-* | --without-* | --x)
+           case "$ac_configure_args0 " in
+             "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+           esac
+           ;;
+         -* ) ac_must_keep_next=true ;;
+       esac
+      fi
+      as_fn_append ac_configure_args " '$ac_arg'"
+      ;;
+    esac
+  done
+done
+{ ac_configure_args0=; unset ac_configure_args0;}
+{ ac_configure_args1=; unset ac_configure_args1;}
 
-# Check whether --with-kerberos5 was given.
-if test "${with_kerberos5+set}" = set; then
-  withval=$with_kerberos5;
-else
-      with_kerberos5=no
-fi
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log.  We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
+trap 'exit_status=$?
+  # Save into config.log some information that might help in debugging.
+  {
+    echo
 
-if test "${with_kerberos5}" != no; then
-  if test "${with_kerberos}" = no; then
-    with_kerberos=yes
-    cat >>confdefs.h <<\_ACEOF
-#define KERBEROS 1
-_ACEOF
+    cat <<\_ASBOX
+## ---------------- ##
+## Cache variables. ##
+## ---------------- ##
+_ASBOX
+    echo
+    # The following way of writing the cache mishandles newlines in values,
+(
+  for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+    eval ac_val=\$$ac_var
+    case $ac_val in #(
+    *${as_nl}*)
+      case $ac_var in #(
+      *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+      esac
+      case $ac_var in #(
+      _ | IFS | as_nl) ;; #(
+      BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+      *) { eval $ac_var=; unset $ac_var;} ;;
+      esac ;;
+    esac
+  done
+  (set) 2>&1 |
+    case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+    *${as_nl}ac_space=\ *)
+      sed -n \
+       "s/'\''/'\''\\\\'\'''\''/g;
+         s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+      ;; #(
+    *)
+      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+      ;;
+    esac |
+    sort
+)
+    echo
 
-  fi
+    cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+    echo
+    for ac_var in $ac_subst_vars
+    do
+      eval ac_val=\$$ac_var
+      case $ac_val in
+      *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+      esac
+      $as_echo "$ac_var='\''$ac_val'\''"
+    done | sort
+    echo
 
-cat >>confdefs.h <<\_ACEOF
-#define KERBEROS5 1
-_ACEOF
+    if test -n "$ac_subst_files"; then
+      cat <<\_ASBOX
+## ------------------- ##
+## File substitutions. ##
+## ------------------- ##
+_ASBOX
+      echo
+      for ac_var in $ac_subst_files
+      do
+       eval ac_val=\$$ac_var
+       case $ac_val in
+       *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+       esac
+       $as_echo "$ac_var='\''$ac_val'\''"
+      done | sort
+      echo
+    fi
 
-fi
+    if test -s confdefs.h; then
+      cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+      echo
+      cat confdefs.h
+      echo
+    fi
+    test "$ac_signal" != 0 &&
+      $as_echo "$as_me: caught signal $ac_signal"
+    $as_echo "$as_me: exit $exit_status"
+  } >&5
+  rm -f core *.core core.conftest.* &&
+    rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
+    exit $exit_status
+' 0
+for ac_signal in 1 2 13 15; do
+  trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
+done
+ac_signal=0
 
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -f -r conftest* confdefs.h
 
-# Check whether --with-hesiod was given.
-if test "${with_hesiod+set}" = set; then
-  withval=$with_hesiod;
-else
-      with_hesiod=no
-fi
+$as_echo "/* confdefs.h */" > confdefs.h
 
-if test "$with_hesiod" != no; then
+# Predefined preprocessor variables.
 
-cat >>confdefs.h <<\_ACEOF
-#define HESIOD 1
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
 _ACEOF
 
-fi
-
-
-# Check whether --with-sound was given.
-if test "${with_sound+set}" = set; then
-  withval=$with_sound;
-else
-     with_sound=yes
-fi
-
-
-
-# Check whether --with-sync-input was given.
-if test "${with_sync_input+set}" = set; then
-  withval=$with_sync_input;
-else
-     with_sync_input=yes
-fi
-
-if test "$with_sync_input" = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define SYNC_INPUT 1
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
 _ACEOF
 
-fi
-
-
-# Check whether --with-x-toolkit was given.
-if test "${with_x_toolkit+set}" = set; then
-  withval=$with_x_toolkit;       case "${withval}" in
-           y | ye | yes )      val=gtk ;;
-           n | no )            val=no  ;;
-           l | lu | luc | luci | lucid )       val=lucid ;;
-           a | at | ath | athe | athen | athena )      val=athena ;;
-           m | mo | mot | moti | motif )       val=motif ;;
-           g | gt | gtk  )     val=gtk ;;
-           * )
-{ { $as_echo "$as_me:$LINENO: error: \`--with-x-toolkit=$withval' is invalid;
-this option's value should be \`yes', \`no', \`lucid', \`athena', \`motif' or \`gtk'.
-\`yes' and \`gtk' are synonyms. \`athena' and \`lucid' are synonyms." >&5
-$as_echo "$as_me: error: \`--with-x-toolkit=$withval' is invalid;
-this option's value should be \`yes', \`no', \`lucid', \`athena', \`motif' or \`gtk'.
-\`yes' and \`gtk' are synonyms. \`athena' and \`lucid' are synonyms." >&2;}
-   { (exit 1); exit 1; }; }
-           ;;
-         esac
-         with_x_toolkit=$val
-
-fi
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
 
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
 
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
 
-# Check whether --with-xpm was given.
-if test "${with_xpm+set}" = set; then
-  withval=$with_xpm;
-else
-     with_xpm=yes
-fi
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_URL "$PACKAGE_URL"
+_ACEOF
 
 
-# Check whether --with-jpeg was given.
-if test "${with_jpeg+set}" = set; then
-  withval=$with_jpeg;
+# Let the site file select an alternate cache file if it wants to.
+# Prefer an explicitly selected file to automatically selected ones.
+ac_site_file1=NONE
+ac_site_file2=NONE
+if test -n "$CONFIG_SITE"; then
+  ac_site_file1=$CONFIG_SITE
+elif test "x$prefix" != xNONE; then
+  ac_site_file1=$prefix/share/config.site
+  ac_site_file2=$prefix/etc/config.site
 else
-     with_jpeg=yes
+  ac_site_file1=$ac_default_prefix/share/config.site
+  ac_site_file2=$ac_default_prefix/etc/config.site
 fi
+for ac_site_file in "$ac_site_file1" "$ac_site_file2"
+do
+  test "x$ac_site_file" = xNONE && continue
+  if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
+$as_echo "$as_me: loading site script $ac_site_file" >&6;}
+    sed 's/^/| /' "$ac_site_file" >&5
+    . "$ac_site_file"
+  fi
+done
 
-
-# Check whether --with-tiff was given.
-if test "${with_tiff+set}" = set; then
-  withval=$with_tiff;
+if test -r "$cache_file"; then
+  # Some versions of bash will fail to source /dev/null (special files
+  # actually), so we avoid doing that.  DJGPP emulates it as a regular file.
+  if test /dev/null != "$cache_file" && test -f "$cache_file"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
+$as_echo "$as_me: loading cache $cache_file" >&6;}
+    case $cache_file in
+      [\\/]* | ?:[\\/]* ) . "$cache_file";;
+      *)                      . "./$cache_file";;
+    esac
+  fi
 else
-     with_tiff=yes
+  { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
+$as_echo "$as_me: creating cache $cache_file" >&6;}
+  >$cache_file
 fi
 
-
-# Check whether --with-gif was given.
-if test "${with_gif+set}" = set; then
-  withval=$with_gif;
+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 " sys/time.h"
+as_fn_append ac_func_list " alarm"
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in $ac_precious_vars; do
+  eval ac_old_set=\$ac_cv_env_${ac_var}_set
+  eval ac_new_set=\$ac_env_${ac_var}_set
+  eval ac_old_val=\$ac_cv_env_${ac_var}_value
+  eval ac_new_val=\$ac_env_${ac_var}_value
+  case $ac_old_set,$ac_new_set in
+    set,)
+      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,set)
+      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,);;
+    *)
+      if test "x$ac_old_val" != "x$ac_new_val"; then
+       # differences in whitespace do not lead to failure.
+       ac_old_val_w=`echo x $ac_old_val`
+       ac_new_val_w=`echo x $ac_new_val`
+       if test "$ac_old_val_w" != "$ac_new_val_w"; then
+         { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
+$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+         ac_cache_corrupted=:
+       else
+         { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
+$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
+         eval $ac_var=\$ac_old_val
+       fi
+       { $as_echo "$as_me:${as_lineno-$LINENO}:   former value:  \`$ac_old_val'" >&5
+$as_echo "$as_me:   former value:  \`$ac_old_val'" >&2;}
+       { $as_echo "$as_me:${as_lineno-$LINENO}:   current value: \`$ac_new_val'" >&5
+$as_echo "$as_me:   current value: \`$ac_new_val'" >&2;}
+      fi;;
+  esac
+  # Pass precious variables to config.status.
+  if test "$ac_new_set" = set; then
+    case $ac_new_val in
+    *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+    *) ac_arg=$ac_var=$ac_new_val ;;
+    esac
+    case " $ac_configure_args " in
+      *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
+      *) as_fn_append ac_configure_args " '$ac_arg'" ;;
+    esac
+  fi
+done
+if $ac_cache_corrupted; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+  { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
+$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+  as_fn_error "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
+fi
+## -------------------- ##
+## Main body of script. ##
+## -------------------- ##
+
+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
+
+
+ac_config_headers="$ac_config_headers src/config.h:src/config.in"
+
+
+
+test "$program_prefix" != NONE &&
+  program_transform_name="s&^&$program_prefix&;$program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+  program_transform_name="s&\$&$program_suffix&;$program_transform_name"
+# Double any \ or $.
+# By default was `s,x,x', remove it if useless.
+ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
+program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
+
+
+lispdir='${datadir}/emacs/${version}/lisp'
+locallisppath='${datadir}/emacs/${version}/site-lisp:'\
+'${datadir}/emacs/site-lisp'
+lisppath='${locallisppath}:${lispdir}:${datadir}/emacs/${version}/leim'
+etcdir='${datadir}/emacs/${version}/etc'
+archlibdir='${libexecdir}/emacs/${version}/${configuration}'
+docdir='${datadir}/emacs/${version}/etc'
+gamedir='${localstatedir}/games/emacs'
+
+gameuser=games
+
+
+
+
+# Check whether --with-pop was given.
+if test "${with_pop+set}" = set; then :
+  withval=$with_pop;
+else
+     with_pop=yes
+fi
+
+if test "$with_pop" = yes; then
+   $as_echo "#define MAIL_USE_POP 1" >>confdefs.h
+
+fi
+
+
+# Check whether --with-kerberos was given.
+if test "${with_kerberos+set}" = set; then :
+  withval=$with_kerberos;
+else
+      with_kerberos=no
+fi
+
+if test "$with_kerberos" != no; then
+   $as_echo "#define KERBEROS 1" >>confdefs.h
+
+fi
+
+
+# Check whether --with-kerberos5 was given.
+if test "${with_kerberos5+set}" = set; then :
+  withval=$with_kerberos5;
+else
+      with_kerberos5=no
+fi
+
+if test "${with_kerberos5}" != no; then
+  if test "${with_kerberos}" = no; then
+    with_kerberos=yes
+    $as_echo "#define KERBEROS 1" >>confdefs.h
+
+  fi
+
+$as_echo "#define KERBEROS5 1" >>confdefs.h
+
+fi
+
+
+# Check whether --with-hesiod was given.
+if test "${with_hesiod+set}" = set; then :
+  withval=$with_hesiod;
+else
+      with_hesiod=no
+fi
+
+if test "$with_hesiod" != no; then
+
+$as_echo "#define HESIOD 1" >>confdefs.h
+
+fi
+
+
+# Check whether --with-mmdf was given.
+if test "${with_mmdf+set}" = set; then :
+  withval=$with_mmdf;
+else
+      with_mmdf=no
+fi
+
+if test "$with_mmdf" != no; then
+
+$as_echo "#define MAIL_USE_MMDF 1" >>confdefs.h
+
+fi
+
+
+# Check whether --with-mail-unlink was given.
+if test "${with_mail_unlink+set}" = set; then :
+  withval=$with_mail_unlink;
+else
+      with_mail_unlink=no
+fi
+
+if test "$with_mail_unlink" != no; then
+
+$as_echo "#define MAIL_UNLINK_SPOOL 1" >>confdefs.h
+
+fi
+
+
+# Check whether --with-mailhost was given.
+if test "${with_mailhost+set}" = set; then :
+  withval=$with_mailhost;
+cat >>confdefs.h <<_ACEOF
+#define MAILHOST "$withval"
+_ACEOF
+
+fi
+
+
+
+# Check whether --with-sound was given.
+if test "${with_sound+set}" = set; then :
+  withval=$with_sound;
+else
+     with_sound=yes
+fi
+
+
+
+# Check whether --with-sync-input was given.
+if test "${with_sync_input+set}" = set; then :
+  withval=$with_sync_input;
+else
+     with_sync_input=yes
+fi
+
+if test "$with_sync_input" = yes; then
+
+$as_echo "#define SYNC_INPUT 1" >>confdefs.h
+
+fi
+
+
+# Check whether --with-x-toolkit was given.
+if test "${with_x_toolkit+set}" = set; then :
+  withval=$with_x_toolkit;       case "${withval}" in
+           y | ye | yes )      val=gtk ;;
+           n | no )            val=no  ;;
+           l | lu | luc | luci | lucid )       val=lucid ;;
+           a | at | ath | athe | athen | athena )      val=athena ;;
+           m | mo | mot | moti | motif )       val=motif ;;
+           g | gt | gtk  )     val=gtk ;;
+           gtk3  )     val=gtk3 ;;
+           * )
+as_fn_error "\`--with-x-toolkit=$withval' is invalid;
+this option's value should be \`yes', \`no', \`lucid', \`athena', \`motif', \`gtk' or
+\`gtk3'.  \`yes' and \`gtk' are synonyms. \`athena' and \`lucid' are synonyms." "$LINENO" 5
+           ;;
+         esac
+         with_x_toolkit=$val
+
+fi
+
+
+
+# Check whether --with-xpm was given.
+if test "${with_xpm+set}" = set; then :
+  withval=$with_xpm;
+else
+     with_xpm=yes
+fi
+
+
+# Check whether --with-jpeg was given.
+if test "${with_jpeg+set}" = set; then :
+  withval=$with_jpeg;
+else
+     with_jpeg=yes
+fi
+
+
+# Check whether --with-tiff was given.
+if test "${with_tiff+set}" = set; then :
+  withval=$with_tiff;
+else
+     with_tiff=yes
+fi
+
+
+# Check whether --with-gif was given.
+if test "${with_gif+set}" = set; then :
+  withval=$with_gif;
 else
      with_gif=yes
 fi
 
 
 # Check whether --with-png was given.
-if test "${with_png+set}" = set; then
+if test "${with_png+set}" = set; then :
   withval=$with_png;
 else
      with_png=yes
@@ -2162,16 +2725,24 @@ fi
 
 
 # Check whether --with-rsvg was given.
-if test "${with_rsvg+set}" = set; then
+if test "${with_rsvg+set}" = set; then :
   withval=$with_rsvg;
 else
      with_rsvg=yes
 fi
 
 
+# Check whether --with-imagemagick was given.
+if test "${with_imagemagick+set}" = set; then :
+  withval=$with_imagemagick;
+else
+      with_imagemagick=no
+fi
+
+
 
 # Check whether --with-xft was given.
-if test "${with_xft+set}" = set; then
+if test "${with_xft+set}" = set; then :
   withval=$with_xft;
 else
      with_xft=yes
@@ -2179,7 +2750,7 @@ fi
 
 
 # Check whether --with-libotf was given.
-if test "${with_libotf+set}" = set; then
+if test "${with_libotf+set}" = set; then :
   withval=$with_libotf;
 else
      with_libotf=yes
@@ -2187,7 +2758,7 @@ fi
 
 
 # Check whether --with-m17n-flt was given.
-if test "${with_m17n_flt+set}" = set; then
+if test "${with_m17n_flt+set}" = set; then :
   withval=$with_m17n_flt;
 else
      with_m17n_flt=yes
@@ -2196,7 +2767,7 @@ fi
 
 
 # Check whether --with-toolkit-scroll-bars was given.
-if test "${with_toolkit_scroll_bars+set}" = set; then
+if test "${with_toolkit_scroll_bars+set}" = set; then :
   withval=$with_toolkit_scroll_bars;
 else
      with_toolkit_scroll_bars=yes
@@ -2204,7 +2775,7 @@ fi
 
 
 # Check whether --with-xaw3d was given.
-if test "${with_xaw3d+set}" = set; then
+if test "${with_xaw3d+set}" = set; then :
   withval=$with_xaw3d;
 else
      with_xaw3d=yes
@@ -2212,7 +2783,7 @@ fi
 
 
 # Check whether --with-xim was given.
-if test "${with_xim+set}" = set; then
+if test "${with_xim+set}" = set; then :
   withval=$with_xim;
 else
      with_xim=yes
@@ -2220,7 +2791,7 @@ fi
 
 
 # Check whether --with-ns was given.
-if test "${with_ns+set}" = set; then
+if test "${with_ns+set}" = set; then :
   withval=$with_ns;
 else
       with_ns=no
@@ -2229,7 +2800,7 @@ fi
 
 
 # Check whether --with-gpm was given.
-if test "${with_gpm+set}" = set; then
+if test "${with_gpm+set}" = set; then :
   withval=$with_gpm;
 else
      with_gpm=yes
@@ -2237,7 +2808,7 @@ fi
 
 
 # Check whether --with-dbus was given.
-if test "${with_dbus+set}" = set; then
+if test "${with_dbus+set}" = set; then :
   withval=$with_dbus;
 else
      with_dbus=yes
@@ -2245,49 +2816,52 @@ fi
 
 
 # Check whether --with-gconf was given.
-if test "${with_gconf+set}" = set; then
+if test "${with_gconf+set}" = set; then :
   withval=$with_gconf;
 else
      with_gconf=yes
 fi
 
 
+# Check whether --with-selinux was given.
+if test "${with_selinux+set}" = set; then :
+  withval=$with_selinux;
+else
+     with_selinux=yes
+fi
+
+
 ## For the times when you want to build Emacs but don't have
 ## a suitable makeinfo, and can live without the manuals.
 
 # Check whether --with-makeinfo was given.
-if test "${with_makeinfo+set}" = set; then
+if test "${with_makeinfo+set}" = set; then :
   withval=$with_makeinfo;
 else
      with_makeinfo=yes
 fi
 
 
+## This is an option because I do not know if all info/man support
+## compressed files, nor how to test if they do so.
 
-# Check whether --with-gtk was given.
-if test "${with_gtk+set}" = set; then
-  withval=$with_gtk; { { $as_echo "$as_me:$LINENO: error: --with-gtk has been removed.  Use --with-x-toolkit to
-specify a toolkit." >&5
-$as_echo "$as_me: error: --with-gtk has been removed.  Use --with-x-toolkit to
-specify a toolkit." >&2;}
-   { (exit 1); exit 1; }; }
+# Check whether --with-compress-info was given.
+if test "${with_compress_info+set}" = set; then :
+  withval=$with_compress_info;
+else
+     with_compress_info=yes
 fi
 
-
-
-# Check whether --with-gcc was given.
-if test "${with_gcc+set}" = set; then
-  withval=$with_gcc; { { $as_echo "$as_me:$LINENO: error: --with-gcc has been removed.  Set the \`CC' environment
-variable to specify a compiler." >&5
-$as_echo "$as_me: error: --with-gcc has been removed.  Set the \`CC' environment
-variable to specify a compiler." >&2;}
-   { (exit 1); exit 1; }; }
+if test $with_compress_info = yes; then
+   GZIP_INFO=yes
+else
+   GZIP_INFO=
 fi
 
 
 
 # Check whether --with-pkg-config-prog was given.
-if test "${with_pkg_config_prog+set}" = set; then
+if test "${with_pkg_config_prog+set}" = set; then :
   withval=$with_pkg_config_prog;
 fi
 
@@ -2297,9 +2871,18 @@ if test "X${with_pkg_config_prog}" != X; then
    fi
 fi
 
+CRT_DIR=
+
+# Check whether --with-crt-dir was given.
+if test "${with_crt_dir+set}" = set; then :
+  withval=$with_crt_dir;
+fi
+
+CRT_DIR="${with_crt_dir}"
+
 
 # Check whether --with-gnustep-conf was given.
-if test "${with_gnustep_conf+set}" = set; then
+if test "${with_gnustep_conf+set}" = set; then :
   withval=$with_gnustep_conf;
 fi
 
@@ -2309,7 +2892,7 @@ test "X$GNUSTEP_CONFIG_FILE" = "X" && \
      GNUSTEP_CONFIG_FILE=/etc/GNUstep/GNUstep.conf
 
 # Check whether --enable-ns-self-contained was given.
-if test "${enable_ns_self_contained+set}" = set; then
+if test "${enable_ns_self_contained+set}" = set; then :
   enableval=$enable_ns_self_contained; EN_NS_SELF_CONTAINED=$enableval
 else
   EN_NS_SELF_CONTAINED=yes
@@ -2317,7 +2900,7 @@ fi
 
 
 # Check whether --enable-asserts was given.
-if test "${enable_asserts+set}" = set; then
+if test "${enable_asserts+set}" = set; then :
   enableval=$enable_asserts; USE_XASSERTS=$enableval
 else
   USE_XASSERTS=no
@@ -2325,7 +2908,7 @@ fi
 
 
 # Check whether --enable-maintainer-mode was given.
-if test "${enable_maintainer_mode+set}" = set; then
+if test "${enable_maintainer_mode+set}" = set; then :
   enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval
 else
   USE_MAINTAINER_MODE=no
@@ -2339,7 +2922,7 @@ fi
 
 
 # Check whether --enable-locallisppath was given.
-if test "${enable_locallisppath+set}" = set; then
+if test "${enable_locallisppath+set}" = set; then :
   enableval=$enable_locallisppath; if test "${enableval}" = "no"; then
   locallisppath=
 elif test "${enableval}" != "yes"; then
@@ -2349,7 +2932,7 @@ fi
 
 
 # Check whether --enable-checking was given.
-if test "${enable_checking+set}" = set; then
+if test "${enable_checking+set}" = set; then :
   enableval=$enable_checking; ac_checking_flags="${enableval}"
 fi
 
@@ -2377,58 +2960,55 @@ do
        stringfreelist) ac_gc_check_string_free_list=1 ;;
        xmallocoverrun) ac_xmalloc_overrun=1 ;;
        conslist)       ac_gc_check_cons_list=1 ;;
-       *)      { { $as_echo "$as_me:$LINENO: error: unknown check category $check" >&5
-$as_echo "$as_me: error: unknown check category $check" >&2;}
-   { (exit 1); exit 1; }; } ;;
+       *)      as_fn_error "unknown check category $check" "$LINENO" 5 ;;
        esac
 done
 IFS="$ac_save_IFS"
 
 if test x$ac_enable_checking != x ; then
 
-cat >>confdefs.h <<\_ACEOF
-#define ENABLE_CHECKING 1
-_ACEOF
+$as_echo "#define ENABLE_CHECKING 1" >>confdefs.h
 
 fi
 if test x$ac_gc_check_stringbytes != x ; then
 
-cat >>confdefs.h <<\_ACEOF
-#define GC_CHECK_STRING_BYTES 1
-_ACEOF
+$as_echo "#define GC_CHECK_STRING_BYTES 1" >>confdefs.h
 
 fi
 if test x$ac_gc_check_stringoverrun != x ; then
 
-cat >>confdefs.h <<\_ACEOF
-#define GC_CHECK_STRING_OVERRUN 1
-_ACEOF
+$as_echo "#define GC_CHECK_STRING_OVERRUN 1" >>confdefs.h
 
 fi
 if test x$ac_gc_check_string_free_list != x ; then
 
-cat >>confdefs.h <<\_ACEOF
-#define GC_CHECK_STRING_FREE_LIST 1
-_ACEOF
+$as_echo "#define GC_CHECK_STRING_FREE_LIST 1" >>confdefs.h
 
 fi
 if test x$ac_xmalloc_overrun != x ; then
 
-cat >>confdefs.h <<\_ACEOF
-#define XMALLOC_OVERRUN_CHECK 1
-_ACEOF
+$as_echo "#define XMALLOC_OVERRUN_CHECK 1" >>confdefs.h
 
 fi
 if test x$ac_gc_check_cons_list != x ; then
 
-cat >>confdefs.h <<\_ACEOF
-#define GC_CHECK_CONS_LIST 1
-_ACEOF
+$as_echo "#define GC_CHECK_CONS_LIST 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
+
+$as_echo "#define USE_LISP_UNION_TYPE 1" >>confdefs.h
 
 fi
+fi
+
+
 
 # Check whether --enable-profiling was given.
-if test "${enable_profiling+set}" = set; then
+if test "${enable_profiling+set}" = set; then :
   enableval=$enable_profiling; ac_enable_profiling="${enableval}"
 fi
 
@@ -2440,8 +3020,10 @@ else
    PROFILING_LDFLAGS=
 fi
 
+
+
 # Check whether --enable-autodepend was given.
-if test "${enable_autodepend+set}" = set; then
+if test "${enable_autodepend+set}" = set; then :
   enableval=$enable_autodepend; ac_enable_autodepend="${enableval}"
 else
   ac_enable_autodepend=yes
@@ -2475,7 +3057,7 @@ esac
 #### Check if the source directory already has a configured system in it.
 if test `pwd` != `(cd ${srcdir} && pwd)` \
    && test -f "${srcdir}/src/config.h" ; then
-  { $as_echo "$as_me:$LINENO: WARNING: The directory tree \`${srcdir}' is being used
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: The directory tree \`${srcdir}' is being used
    as a build directory right now; it has been configured in its own
    right.  To configure in another directory as well, you MUST
    use GNU make.  If you do not have GNU make, then you must
@@ -2496,24 +3078,16 @@ fi
 
 ac_aux_dir=
 for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
-  if test -f "$ac_dir/install-sh"; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/install-sh -c"
-    break
-  elif test -f "$ac_dir/install.sh"; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/install.sh -c"
-    break
-  elif test -f "$ac_dir/shtool"; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/shtool install -c"
-    break
-  fi
+  for ac_t in install-sh install.sh shtool; do
+    if test -f "$ac_dir/$ac_t"; then
+      ac_aux_dir=$ac_dir
+      ac_install_sh="$ac_aux_dir/$ac_t -c"
+      break 2
+    fi
+  done
 done
 if test -z "$ac_aux_dir"; then
-  { { $as_echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5
-$as_echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
 fi
 
 # These three variables are undocumented and unsupported,
@@ -2527,35 +3101,27 @@ ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
 
 # Make sure we can run config.sub.
 $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
-  { { $as_echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5
-$as_echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
 
-{ $as_echo "$as_me:$LINENO: checking build system type" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
 $as_echo_n "checking build system type... " >&6; }
-if test "${ac_cv_build+set}" = set; then
+if test "${ac_cv_build+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_build_alias=$build_alias
 test "x$ac_build_alias" = x &&
   ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
 test "x$ac_build_alias" = x &&
-  { { $as_echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
-$as_echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "cannot guess build type; you must specify one" "$LINENO" 5
 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
-  { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5
-$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_build" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
 $as_echo "$ac_cv_build" >&6; }
 case $ac_cv_build in
 *-*-*) ;;
-*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical build" >&5
-$as_echo "$as_me: error: invalid value of canonical build" >&2;}
-   { (exit 1); exit 1; }; };;
+*) as_fn_error "invalid value of canonical build" "$LINENO" 5;;
 esac
 build=$ac_cv_build
 ac_save_IFS=$IFS; IFS='-'
@@ -2571,28 +3137,24 @@ IFS=$ac_save_IFS
 case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
 
 
-{ $as_echo "$as_me:$LINENO: checking host system type" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
 $as_echo_n "checking host system type... " >&6; }
-if test "${ac_cv_host+set}" = set; then
+if test "${ac_cv_host+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test "x$host_alias" = x; then
   ac_cv_host=$ac_cv_build
 else
   ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
-    { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5
-$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;}
-   { (exit 1); exit 1; }; }
+    as_fn_error "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
 fi
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_host" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
 $as_echo "$ac_cv_host" >&6; }
 case $ac_cv_host in
 *-*-*) ;;
-*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical host" >&5
-$as_echo "$as_me: error: invalid value of canonical host" >&2;}
-   { (exit 1); exit 1; }; };;
+*) as_fn_error "invalid value of canonical host" "$LINENO" 5;;
 esac
 host=$ac_cv_host
 ac_save_IFS=$IFS; IFS='-'
@@ -2618,7 +3180,7 @@ configuration=${host_alias-${build_alias-$host}}
 ### the appropriate operating system and machine description files.
 
 ### 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-
+### based on the machine portion of the configuration name, and 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
@@ -2630,10 +3192,6 @@ configuration=${host_alias-${build_alias-$host}}
 ### /etc/MACHINES doesn't say anything about version numbers, be
 ### prepared to handle anything reasonably.  If version numbers
 ### matter, be sure /etc/MACHINES says something about it.
-###
-### Eric Raymond says we should accept strings like "sysvr4" to mean
-### "System V Release 4"; he writes, "The old convention encouraged
-### confusion between `system' and `release' levels'."
 
 machine='' opsys='' unported=no
 case "${canonical}" in
@@ -2642,14 +3200,14 @@ case "${canonical}" in
   *-*-freebsd* )
     opsys=freebsd
     case "${canonical}" in
-      alpha*-*-freebsd*)       machine=alpha ;;
-      arm*-*-freebsd*)          machine=arm ;;
-      ia64-*-freebsd*)         machine=ia64 ;;
-      sparc-*-freebsd*)         machine=sparc ;;
-      sparc64-*-freebsd*)      machine=sparc ;;
-      powerpc-*-freebsd*)      machine=macppc ;;
-      i[3456]86-*-freebsd*)    machine=intel386 ;;
-      amd64-*-freebsd*|x86_64-*-freebsd*) machine=amdx86-64 ;;
+      alpha*)           machine=alpha ;;
+      amd64-*|x86_64-*) machine=amdx86-64 ;;
+      arm*)             machine=arm ;;
+      ia64-*)           machine=ia64 ;;
+      i[3456]86-*)      machine=intel386 ;;
+      powerpc-*)        machine=macppc ;;
+      sparc-*)          machine=sparc ;;
+      sparc64-*)        machine=sparc ;;
     esac
   ;;
 
@@ -2657,40 +3215,31 @@ case "${canonical}" in
   *-*-kfreebsd*gnu* )
     opsys=gnu-kfreebsd
     case "${canonical}" in
-      alpha*-*-kfreebsd*)      machine=alpha ;;
-      ia64-*-kfreebsd*)                machine=ia64 ;;
-      sparc-*-kfreebsd*)       machine=sparc ;;
-      sparc64-*-kfreebsd*)     machine=sparc ;;
-      powerpc-*-kfreebsd*)     machine=macppc ;;
-      i[3456]86-*-kfreebsd*)   machine=intel386 ;;
-      amd64-*-kfreebsd*|x86_64-*-kfreebsd*) machine=amdx86-64 ;;
+      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
-    if test -f /usr/lib/crti.o; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_CRTIN /**/
-_ACEOF
-
-   fi
-
     case "${canonical}" in
-      alpha*-*-netbsd*)        machine=alpha ;;
-      i[3456]86-*-netbsd*) machine=intel386 ;;
-      mips-*-netbsd*)  machine=mips ;;
-      mipsel-*-netbsd*)        machine=mips ;;
-      mipseb-*-netbsd*)        machine=mips ;;
-      powerpc-*-netbsd*) machine=macppc ;;
-      sparc*-*-netbsd*)        machine=sparc ;;
-      vax-*-netbsd*)   machine=vax ;;
-      arm-*-netbsd*)   machine=arm ;;
-      x86_64-*-netbsd*)        machine=amdx86-64 ;;
-      hppa-*-netbsd*)  machine=hp800 ;;
-      m68k-*-netbsd*)  machine=m68k ;;
+      alpha*)      machine=alpha ;;
+      x86_64-*)    machine=amdx86-64 ;;
+      arm-*)       machine=arm ;;
+      hppa-*)      machine=hp800 ;;
+      i[3456]86-*) machine=intel386 ;;
+      m68k-*)      machine=m68k ;;
+      powerpc-*)   machine=macppc ;;
+      mips-*)      machine=mips ;;
+      mipse[bl]-*) machine=mips ;;
+      sparc*-)     machine=sparc ;;
+      vax-*)       machine=vax ;;
     esac
   ;;
 
@@ -2698,23 +3247,14 @@ _ACEOF
   *-*-openbsd* )
     opsys=openbsd
     case "${canonical}" in
-      alpha*-*-openbsd*)       machine=alpha ;;
-      arm-*-openbsd*)          machine=arm ;;
-      i386-*-openbsd*)         machine=intel386 ;;
-      powerpc-*-openbsd*)      machine=macppc ;;
-      sparc*-*-openbsd*)       machine=sparc ;;
-      vax-*-openbsd*)          machine=vax ;;
-      x86_64-*-openbsd*)       machine=amdx86-64 ;;
-      hppa-*-openbsd*)         machine=hp800 ;;
-    esac
-  ;;
-
-  ## LynxOS ports
-  *-*-lynxos* )
-    opsys=lynxos
-    case "${canonical}" in
-      i[3456]86-*-lynxos*) machine=intel386 ;;
-      powerpc-*-lynxos*) machine=powerpc ;;
+      alpha*)    machine=alpha ;;
+      x86_64-*)  machine=amdx86-64 ;;
+      arm-*)     machine=arm ;;
+      hppa-*)    machine=hp800 ;;
+      i386-*)    machine=intel386 ;;
+      powerpc-*) machine=macppc ;;
+      sparc*)    machine=sparc ;;
+      vax-*)     machine=vax ;;
     esac
   ;;
 
@@ -2765,16 +3305,16 @@ _ACEOF
   s390x-*-linux-gnu* )
     machine=ibms390x opsys=gnu-linux
   ;;
-  rs6000-ibm-aix4.2* | powerpc-ibm-aix4.2*  )
+  rs6000-ibm-aix4.[23]* )
     machine=ibmrs6000 opsys=aix4-2
   ;;
-  rs6000-ibm-aix4.3* | powerpc-ibm-aix4.3*  )
+  powerpc-ibm-aix4.[23]*  )
     machine=ibmrs6000 opsys=aix4-2
   ;;
-  rs6000-ibm-aix5* | powerpc-ibm-aix5*  )
+  rs6000-ibm-aix[56]* )
     machine=ibmrs6000 opsys=aix4-2
   ;;
-  rs6000-ibm-aix6* | powerpc-ibm-aix6*  )
+  powerpc-ibm-aix[56]*  )
     machine=ibmrs6000 opsys=aix4-2
   ;;
 
@@ -2801,30 +3341,14 @@ _ACEOF
 
   *-sun-solaris* \
     | i[3456]86-*-solaris2* | i[3456]86-*-sunos5* \
-    | x86_64-*-solaris2*    | x86_64-*-sunos5*    \
-    | powerpc*-*-solaris2*  | rs6000-*-solaris2*)
+    | x86_64-*-solaris2*    | x86_64-*-sunos5*)
     case "${canonical}" in
       i[3456]86-*-* )     machine=intel386 ;;
       amd64-*-*|x86_64-*-*)    machine=amdx86-64 ;;
-      powerpc* | rs6000* )  machine=ibmrs6000 ;;
       sparc* )         machine=sparc ;;
       * )              unported=yes ;;
     esac
     case "${canonical}" in
-      *-sunos5.3* | *-solaris2.3* )
-               opsys=sol2-3
-               NON_GNU_CPP=/usr/ccs/lib/cpp
-               ;;
-      *-sunos5.4* | *-solaris2.4* )
-               opsys=sol2-4
-               NON_GNU_CPP=/usr/ccs/lib/cpp
-               RANLIB="ar -ts"
-               ;;
-      *-sunos5.5* | *-solaris2.5* )
-               opsys=sol2-5
-               NON_GNU_CPP=/usr/ccs/lib/cpp
-               RANLIB="ar -ts"
-               ;;
       *-sunos5.6* | *-solaris2.6* )
                opsys=sol2-6
                NON_GNU_CPP=/usr/ccs/lib/cpp
@@ -2859,7 +3383,7 @@ _ACEOF
     machine=ia64 opsys=gnu-linux
   ;;
 
-  ## Intel 386 machines where we don't care about the manufacturer
+  ## Intel 386 machines where we don't care about the manufacturer.
   i[3456]86-*-* )
     machine=intel386
     case "${canonical}" in
@@ -2915,22 +3439,6 @@ esac
 if test x"${opsys}" = x; then
   case "${canonical}" in
     *-gnu* )                           opsys=gnu ;;
-    *-sysv4.2uw* )                     opsys=unixware ;;
-    *-sysv5uw* )                       opsys=unixware ;;
-    *-sysv5OpenUNIX* )                 opsys=unixware ;;
-    *-sysv4.1* | *-sysvr4.1* )
-       NON_GNU_CPP=/usr/lib/cpp
-       opsys=usg5-4 ;;
-    *-sysv4.[2-9]* | *-sysvr4.[2-9]* )
-       if [ x$NON_GNU_CPP = x ]; then
-         if [ -f /usr/ccs/lib/cpp ]; then
-           NON_GNU_CPP=/usr/ccs/lib/cpp
-         else
-           NON_GNU_CPP=/lib/cpp
-         fi
-       fi
-       opsys=usg5-4-2 ;;
-    *-sysv4* | *-sysvr4* )             opsys=usg5-4 ;;
     * )
       unported=yes
     ;;
 
 
 
-if test $unported = yes; then
-  { { $as_echo "$as_me:$LINENO: error: Emacs hasn't been ported to \`${canonical}' systems.
-Check \`etc/MACHINES' for recognized configuration names." >&5
-$as_echo "$as_me: error: Emacs hasn't been ported to \`${canonical}' systems.
-Check \`etc/MACHINES' for recognized configuration names." >&2;}
-   { (exit 1); exit 1; }; }
-fi
-
-machfile="m/${machine}.h"
-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'
-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
-if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}gcc; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # 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_CC="${ac_tool_prefix}gcc"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  { $as_echo "$as_me:$LINENO: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_CC"; then
-  ac_ct_CC=$CC
-  # Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_CC"; then
-  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # 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_CC="gcc"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-$as_echo "$ac_ct_CC" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-  if test "x$ac_ct_CC" = x; then
-    CC=""
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
-    CC=$ac_ct_CC
-  fi
-else
-  CC="$ac_cv_prog_CC"
-fi
-
-if test -z "$CC"; then
-          if test -n "$ac_tool_prefix"; then
-    # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}cc; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # 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_CC="${ac_tool_prefix}cc"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  { $as_echo "$as_me:$LINENO: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-  fi
-fi
-if test -z "$CC"; then
-  # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-  ac_prog_rejected=no
-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
-    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
-       ac_prog_rejected=yes
-       continue
-     fi
-    ac_cv_prog_CC="cc"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-if test $ac_prog_rejected = yes; then
-  # We found a bogon in the path, so make sure we never use it.
-  set dummy $ac_cv_prog_CC
-  shift
-  if test $# != 0; then
-    # We chose a different compiler from the bogus one.
-    # However, it has the same basename, so the bogon will be chosen
-    # first if we set CC to just the basename; use the full file name.
-    shift
-    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
-  fi
-fi
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  { $as_echo "$as_me:$LINENO: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$CC"; then
-  if test -n "$ac_tool_prefix"; then
-  for ac_prog in cl.exe
-  do
-    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
-set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # 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_CC="$ac_tool_prefix$ac_prog"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  { $as_echo "$as_me:$LINENO: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-    test -n "$CC" && break
-  done
-fi
-if test -z "$CC"; then
-  ac_ct_CC=$CC
-  for ac_prog in cl.exe
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_CC"; then
-  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # 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_CC="$ac_prog"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-$as_echo "$ac_ct_CC" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-  test -n "$ac_ct_CC" && break
-done
-
-  if test "x$ac_ct_CC" = x; then
-    CC=""
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
-    CC=$ac_ct_CC
-  fi
-fi
-
-fi
-
-
-test -z "$CC" && { { $as_echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
-
-# Provide some information about the compiler.
-$as_echo "$as_me:$LINENO: checking for C compiler version" >&5
-set X $ac_compile
-ac_compiler=$2
-{ (ac_try="$ac_compiler --version >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compiler --version >&5") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-{ (ac_try="$ac_compiler -v >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compiler -v >&5") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-{ (ac_try="$ac_compiler -V >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compiler -V >&5") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
-# Try to create an executable without -o first, disregard a.out.
-# It will help us diagnose broken compilers, and finding out an intuition
-# of exeext.
-{ $as_echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
-$as_echo_n "checking for C compiler default output file name... " >&6; }
-ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
-
-# The possible output files:
-ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
-
-ac_rmfiles=
-for ac_file in $ac_files
-do
-  case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
-    * ) ac_rmfiles="$ac_rmfiles $ac_file";;
-  esac
-done
-rm -f $ac_rmfiles
-
-if { (ac_try="$ac_link_default"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link_default") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
-  # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
-# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
-# in a Makefile.  We should not override ac_cv_exeext if it was cached,
-# so that the user can short-circuit this test for compilers unknown to
-# Autoconf.
-for ac_file in $ac_files ''
-do
-  test -f "$ac_file" || continue
-  case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
-       ;;
-    [ab].out )
-       # We found the default executable, but exeext='' is most
-       # certainly right.
-       break;;
-    *.* )
-        if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
-       then :; else
-          ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
-       fi
-       # We set ac_cv_exeext here because the later test for it is not
-       # safe: cross compilers may not add the suffix if given an `-o'
-       # argument, so we may need to know it at that point already.
-       # Even if this section looks crufty: it has the advantage of
-       # actually working.
-       break;;
-    * )
-       break;;
-  esac
-done
-test "$ac_cv_exeext" = no && ac_cv_exeext=
-
-else
-  ac_file=''
-fi
-
-{ $as_echo "$as_me:$LINENO: result: $ac_file" >&5
-$as_echo "$ac_file" >&6; }
-if test -z "$ac_file"; then
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-{ { $as_echo "$as_me:$LINENO: error: C compiler cannot create executables
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: C compiler cannot create executables
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }
-fi
-
-ac_exeext=$ac_cv_exeext
-
-# Check that the compiler produces executables we can run.  If not, either
-# the compiler is broken, or we cross compile.
-{ $as_echo "$as_me:$LINENO: checking whether the C compiler works" >&5
-$as_echo_n "checking whether the C compiler works... " >&6; }
-# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
-# If not cross compiling, check that we can run a simple program.
-if test "$cross_compiling" != yes; then
-  if { ac_try='./$ac_file'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-    cross_compiling=no
-  else
-    if test "$cross_compiling" = maybe; then
-       cross_compiling=yes
-    else
-       { { $as_echo "$as_me:$LINENO: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
-    fi
-  fi
-fi
-{ $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-
-rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
-ac_clean_files=$ac_clean_files_save
-# Check that the compiler produces executables we can run.  If not, either
-# the compiler is broken, or we cross compile.
-{ $as_echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
-$as_echo_n "checking whether we are cross compiling... " >&6; }
-{ $as_echo "$as_me:$LINENO: result: $cross_compiling" >&5
-$as_echo "$cross_compiling" >&6; }
-
-{ $as_echo "$as_me:$LINENO: checking for suffix of executables" >&5
-$as_echo_n "checking for suffix of executables... " >&6; }
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
-  # If both `conftest.exe' and `conftest' are `present' (well, observable)
-# catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
-# work properly (i.e., refer to `conftest.exe'), while it won't with
-# `rm'.
-for ac_file in conftest.exe conftest conftest.*; do
-  test -f "$ac_file" || continue
-  case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
-    *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
-         break;;
-    * ) break;;
-  esac
-done
-else
-  { { $as_echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
-fi
-
-rm -f conftest$ac_cv_exeext
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
-$as_echo "$ac_cv_exeext" >&6; }
-
-rm -f conftest.$ac_ext
-EXEEXT=$ac_cv_exeext
-ac_exeext=$EXEEXT
-{ $as_echo "$as_me:$LINENO: checking for suffix of object files" >&5
-$as_echo_n "checking for suffix of object files... " >&6; }
-if test "${ac_cv_objext+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.o conftest.obj
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
-  for ac_file in conftest.o conftest.obj conftest.*; do
-  test -f "$ac_file" || continue;
-  case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
-    *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
-       break;;
-  esac
-done
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
-fi
-
-rm -f conftest.$ac_cv_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
-$as_echo "$ac_cv_objext" >&6; }
-OBJEXT=$ac_cv_objext
-ac_objext=$OBJEXT
-{ $as_echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
-$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
-if test "${ac_cv_c_compiler_gnu+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-#ifndef __GNUC__
-       choke me
-#endif
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_compiler_gnu=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_compiler_gnu=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-ac_cv_c_compiler_gnu=$ac_compiler_gnu
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
-$as_echo "$ac_cv_c_compiler_gnu" >&6; }
-if test $ac_compiler_gnu = yes; then
-  GCC=yes
-else
-  GCC=
-fi
-ac_test_CFLAGS=${CFLAGS+set}
-ac_save_CFLAGS=$CFLAGS
-{ $as_echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
-$as_echo_n "checking whether $CC accepts -g... " >&6; }
-if test "${ac_cv_prog_cc_g+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_save_c_werror_flag=$ac_c_werror_flag
-   ac_c_werror_flag=yes
-   ac_cv_prog_cc_g=no
-   CFLAGS="-g"
-   cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_prog_cc_g=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       CFLAGS=""
-      cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  :
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_c_werror_flag=$ac_save_c_werror_flag
-        CFLAGS="-g"
-        cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_prog_cc_g=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-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
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-   ac_c_werror_flag=$ac_save_c_werror_flag
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
-$as_echo "$ac_cv_prog_cc_g" >&6; }
-if test "$ac_test_CFLAGS" = set; then
-  CFLAGS=$ac_save_CFLAGS
-elif test $ac_cv_prog_cc_g = yes; then
-  if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
-  else
-    CFLAGS="-g"
-  fi
-else
-  if test "$GCC" = yes; then
-    CFLAGS="-O2"
-  else
-    CFLAGS=
-  fi
-fi
-{ $as_echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
-$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
-if test "${ac_cv_prog_cc_c89+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_prog_cc_c89=no
-ac_save_CC=$CC
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <stdarg.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
-struct buf { int x; };
-FILE * (*rcsopen) (struct buf *, struct stat *, int);
-static char *e (p, i)
-     char **p;
-     int i;
-{
-  return p[i];
-}
-static char *f (char * (*g) (char **, int), char **p, ...)
-{
-  char *s;
-  va_list v;
-  va_start (v,p);
-  s = g (p, va_arg (v,int));
-  va_end (v);
-  return s;
-}
-
-/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
-   function prototypes and stuff, but not '\xHH' hex character constants.
-   These don't provoke an error unfortunately, instead are silently treated
-   as 'x'.  The following induces an error, until -std is added to get
-   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
-   array size at least.  It's necessary to write '\x00'==0 to get something
-   that's true only with -std.  */
-int osf4_cc_array ['\x00' == 0 ? 1 : -1];
-
-/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
-   inside strings and character constants.  */
-#define FOO(x) 'x'
-int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
-
-int test (int i, double x);
-struct s1 {int (*f) (int a);};
-struct s2 {int (*f) (double a);};
-int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
-int argc;
-char **argv;
-int
-main ()
-{
-return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
-  ;
-  return 0;
-}
-_ACEOF
-for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
-       -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
-do
-  CC="$ac_save_CC $ac_arg"
-  rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_prog_cc_c89=$ac_arg
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext
-  test "x$ac_cv_prog_cc_c89" != "xno" && break
-done
-rm -f conftest.$ac_ext
-CC=$ac_save_CC
-
-fi
-# AC_CACHE_VAL
-case "x$ac_cv_prog_cc_c89" in
-  x)
-    { $as_echo "$as_me:$LINENO: result: none needed" >&5
-$as_echo "none needed" >&6; } ;;
-  xno)
-    { $as_echo "$as_me:$LINENO: result: unsupported" >&5
-$as_echo "unsupported" >&6; } ;;
-  *)
-    CC="$CC $ac_cv_prog_cc_c89"
-    { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
-$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
-esac
-
-
-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
-
-
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
-  CPP=
-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:$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 >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-#ifndef __SUNPRO_C
-fail;
-#endif
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  emacs_cv_sunpro_c=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       emacs_cv_sunpro_c=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-
-  { $as_echo "$as_me:$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
-
-#### 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
-
-if test x$GCC = xyes && test "x$GCC_TEST_OPTIONS" != x
-then
-  CC="$CC $GCC_TEST_OPTIONS"
-fi
-
-if test x$GCC = x && test "x$NON_GCC_TEST_OPTIONS" != x
-then
-  CC="$CC $NON_GCC_TEST_OPTIONS"
-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
-{ $as_echo "$as_me:$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
-  $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.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-                    Syntax error
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  :
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  # Broken: fails on valid input.
-continue
-fi
-
-rm -f conftest.err conftest.$ac_ext
-
-  # OK, works on sane cases.  Now check whether nonexistent headers
-  # can be detected and how.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <ac_nonexistent.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  # Broken: success on invalid input.
-continue
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-
-rm -f conftest.err conftest.$ac_ext
-
-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
-
-    done
-    ac_cv_prog_CPP=$CPP
-
-fi
-  CPP=$ac_cv_prog_CPP
-else
-  ac_cv_prog_CPP=$CPP
-fi
-{ $as_echo "$as_me:$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.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-                    Syntax error
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  :
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  # Broken: fails on valid input.
-continue
-fi
-
-rm -f conftest.err conftest.$ac_ext
-
-  # OK, works on sane cases.  Now check whether nonexistent headers
-  # can be detected and how.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <ac_nonexistent.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  # Broken: success on invalid input.
-continue
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-
-rm -f conftest.err conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
-  :
-else
-  { { $as_echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
-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
-
-
-{ $as_echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5
-$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
-if test "${ac_cv_path_GREP+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -z "$GREP"; then
-  ac_path_GREP_found=false
-  # Loop through the user's path and test for each of PROGNAME-LIST
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_prog in grep ggrep; do
-    for ac_exec_ext in '' $ac_executable_extensions; do
-      ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
-      { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
-# Check for GNU ac_path_GREP and select it if it is found.
-  # Check for GNU $ac_path_GREP
-case `"$ac_path_GREP" --version 2>&1` in
-*GNU*)
-  ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
-*)
-  ac_count=0
-  $as_echo_n 0123456789 >"conftest.in"
-  while :
-  do
-    cat "conftest.in" "conftest.in" >"conftest.tmp"
-    mv "conftest.tmp" "conftest.in"
-    cp "conftest.in" "conftest.nl"
-    $as_echo 'GREP' >> "conftest.nl"
-    "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
-    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
-    ac_count=`expr $ac_count + 1`
-    if test $ac_count -gt ${ac_path_GREP_max-0}; then
-      # Best one so far, save it but keep looking for a better one
-      ac_cv_path_GREP="$ac_path_GREP"
-      ac_path_GREP_max=$ac_count
-    fi
-    # 10*(2^10) chars as input seems more than enough
-    test $ac_count -gt 10 && break
-  done
-  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
-
-      $ac_path_GREP_found && break 3
-    done
-  done
-done
-IFS=$as_save_IFS
-  if test -z "$ac_cv_path_GREP"; then
-    { { $as_echo "$as_me:$LINENO: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
-$as_echo "$as_me: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
-   { (exit 1); exit 1; }; }
-  fi
-else
-  ac_cv_path_GREP=$GREP
-fi
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5
-$as_echo "$ac_cv_path_GREP" >&6; }
- GREP="$ac_cv_path_GREP"
-
-
-{ $as_echo "$as_me:$LINENO: checking for egrep" >&5
-$as_echo_n "checking for egrep... " >&6; }
-if test "${ac_cv_path_EGREP+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
-   then ac_cv_path_EGREP="$GREP -E"
-   else
-     if test -z "$EGREP"; then
-  ac_path_EGREP_found=false
-  # Loop through the user's path and test for each of PROGNAME-LIST
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_prog in egrep; do
-    for ac_exec_ext in '' $ac_executable_extensions; do
-      ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
-      { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
-# Check for GNU ac_path_EGREP and select it if it is found.
-  # Check for GNU $ac_path_EGREP
-case `"$ac_path_EGREP" --version 2>&1` in
-*GNU*)
-  ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
-*)
-  ac_count=0
-  $as_echo_n 0123456789 >"conftest.in"
-  while :
-  do
-    cat "conftest.in" "conftest.in" >"conftest.tmp"
-    mv "conftest.tmp" "conftest.in"
-    cp "conftest.in" "conftest.nl"
-    $as_echo 'EGREP' >> "conftest.nl"
-    "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
-    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
-    ac_count=`expr $ac_count + 1`
-    if test $ac_count -gt ${ac_path_EGREP_max-0}; then
-      # Best one so far, save it but keep looking for a better one
-      ac_cv_path_EGREP="$ac_path_EGREP"
-      ac_path_EGREP_max=$ac_count
-    fi
-    # 10*(2^10) chars as input seems more than enough
-    test $ac_count -gt 10 && break
-  done
-  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
-
-      $ac_path_EGREP_found && break 3
-    done
-  done
-done
-IFS=$as_save_IFS
-  if test -z "$ac_cv_path_EGREP"; then
-    { { $as_echo "$as_me:$LINENO: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
-$as_echo "$as_me: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
-   { (exit 1); exit 1; }; }
-  fi
-else
-  ac_cv_path_EGREP=$EGREP
-fi
-
-   fi
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5
-$as_echo "$ac_cv_path_EGREP" >&6; }
- EGREP="$ac_cv_path_EGREP"
-
-
-{ $as_echo "$as_me:$LINENO: checking for ANSI C header files" >&5
-$as_echo_n "checking for ANSI C header files... " >&6; }
-if test "${ac_cv_header_stdc+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_header_stdc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_header_stdc=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-if test $ac_cv_header_stdc = yes; then
-  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <string.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "memchr" >/dev/null 2>&1; then
-  :
-else
-  ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
-  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <stdlib.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "free" >/dev/null 2>&1; then
-  :
-else
-  ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
-  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
-  if test "$cross_compiling" = yes; then
-  :
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <ctype.h>
-#include <stdlib.h>
-#if ((' ' & 0x0FF) == 0x020)
-# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#else
-# define ISLOWER(c) \
-                  (('a' <= (c) && (c) <= 'i') \
-                    || ('j' <= (c) && (c) <= 'r') \
-                    || ('s' <= (c) && (c) <= 'z'))
-# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
-#endif
-
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int
-main ()
-{
-  int i;
-  for (i = 0; i < 256; i++)
-    if (XOR (islower (i), ISLOWER (i))
-       || toupper (i) != TOUPPER (i))
-      return 2;
-  return 0;
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  :
-else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-ac_cv_header_stdc=no
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-
-
-fi
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
-$as_echo "$ac_cv_header_stdc" >&6; }
-if test $ac_cv_header_stdc = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define STDC_HEADERS 1
-_ACEOF
-
-fi
-
-# On IRIX 5.3, sys/types and inttypes.h are conflicting.
-
-
-
-
-
-
-
-
-
-for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
-                 inttypes.h stdint.h unistd.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  eval "$as_ac_Header=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Header=no"
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if test `eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-
-  if test "${ac_cv_header_minix_config_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for minix/config.h" >&5
-$as_echo_n "checking for minix/config.h... " >&6; }
-if test "${ac_cv_header_minix_config_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_minix_config_h" >&5
-$as_echo "$ac_cv_header_minix_config_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking minix/config.h usability" >&5
-$as_echo_n "checking minix/config.h usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <minix/config.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking minix/config.h presence" >&5
-$as_echo_n "checking minix/config.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <minix/config.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: minix/config.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: minix/config.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: minix/config.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: minix/config.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: minix/config.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: minix/config.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: minix/config.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: minix/config.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: minix/config.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: minix/config.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for minix/config.h" >&5
-$as_echo_n "checking for minix/config.h... " >&6; }
-if test "${ac_cv_header_minix_config_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_minix_config_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_minix_config_h" >&5
-$as_echo "$ac_cv_header_minix_config_h" >&6; }
-
-fi
-if test $ac_cv_header_minix_config_h = yes; then
-  MINIX=yes
-else
-  MINIX=
-fi
-
-
-  if test "$MINIX" = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define _POSIX_SOURCE 1
-_ACEOF
-
-
-cat >>confdefs.h <<\_ACEOF
-#define _POSIX_1_SOURCE 2
-_ACEOF
-
-
-cat >>confdefs.h <<\_ACEOF
-#define _MINIX 1
-_ACEOF
-
-  fi
-
-
-
-  { $as_echo "$as_me:$LINENO: checking whether it is safe to define __EXTENSIONS__" >&5
-$as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; }
-if test "${ac_cv_safe_to_define___extensions__+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-#        define __EXTENSIONS__ 1
-         $ac_includes_default
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_safe_to_define___extensions__=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_safe_to_define___extensions__=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_safe_to_define___extensions__" >&5
-$as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
-  test $ac_cv_safe_to_define___extensions__ = yes &&
-    cat >>confdefs.h <<\_ACEOF
-#define __EXTENSIONS__ 1
-_ACEOF
-
-  cat >>confdefs.h <<\_ACEOF
-#define _ALL_SOURCE 1
-_ACEOF
-
-  cat >>confdefs.h <<\_ACEOF
-#define _GNU_SOURCE 1
-_ACEOF
-
-  cat >>confdefs.h <<\_ACEOF
-#define _POSIX_PTHREAD_SEMANTICS 1
-_ACEOF
-
-  cat >>confdefs.h <<\_ACEOF
-#define _TANDEM_SOURCE 1
-_ACEOF
-
-
-
-### Use -Wno-pointer-sign if the compiler supports it
-{ $as_echo "$as_me:$LINENO: checking whether gcc understands -Wno-pointer-sign" >&5
-$as_echo_n "checking whether gcc understands -Wno-pointer-sign... " >&6; }
-SAVE_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS -Wno-pointer-sign"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  has_option=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       has_option=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-if test $has_option = yes; then
-   C_WARNINGS_SWITCH="-Wno-pointer-sign $C_WARNINGS_SWITCH"
-fi
-{ $as_echo "$as_me:$LINENO: result: $has_option" >&5
-$as_echo "$has_option" >&6; }
-CFLAGS="$SAVE_CFLAGS"
-unset has_option
-unset SAVE_CFLAGS
-
-### Use -Wdeclaration-after-statement if the compiler supports it
-{ $as_echo "$as_me:$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 >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  has_option=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       has_option=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:$LINENO: result: $has_option" >&5
-$as_echo "$has_option" >&6; }
-CFLAGS="$SAVE_CFLAGS"
-unset has_option
-unset SAVE_CFLAGS
-
-#### Some other nice autoconf tests.
-
-{ $as_echo "$as_me:$LINENO: checking whether ln -s works" >&5
-$as_echo_n "checking whether ln -s works... " >&6; }
-LN_S=$as_ln_s
-if test "$LN_S" = "ln -s"; then
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no, using $LN_S" >&5
-$as_echo "no, using $LN_S" >&6; }
-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
-{ $as_echo "$as_me:$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
-  $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.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-                    Syntax error
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  :
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  # Broken: fails on valid input.
-continue
-fi
-
-rm -f conftest.err conftest.$ac_ext
-
-  # OK, works on sane cases.  Now check whether nonexistent headers
-  # can be detected and how.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <ac_nonexistent.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  # Broken: success on invalid input.
-continue
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-
-rm -f conftest.err conftest.$ac_ext
-
-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
-
-    done
-    ac_cv_prog_CPP=$CPP
-
-fi
-  CPP=$ac_cv_prog_CPP
-else
-  ac_cv_prog_CPP=$CPP
-fi
-{ $as_echo "$as_me:$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.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-                    Syntax error
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  :
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  # Broken: fails on valid input.
-continue
-fi
-
-rm -f conftest.err conftest.$ac_ext
-
-  # OK, works on sane cases.  Now check whether nonexistent headers
-  # can be detected and how.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <ac_nonexistent.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  # Broken: success on invalid input.
-continue
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-
-rm -f conftest.err conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
-  :
-else
-  { { $as_echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
-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
-
-# Find a good install program.  We prefer a C program (faster),
-# so one script is as good as another.  But avoid the broken or
-# incompatible versions:
-# SysV /etc/install, /usr/sbin/install
-# SunOS /usr/etc/install
-# IRIX /sbin/install
-# AIX /bin/install
-# AmigaOS /C/install, which installs bootblocks on floppy discs
-# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
-# AFS /usr/afsws/bin/install, which mishandles nonexistent args
-# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
-# OS/2's system install, which has a completely different semantic
-# ./install, which can be erroneously created by make from ./install.sh.
-# Reject install programs that cannot install multiple files.
-{ $as_echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
-$as_echo_n "checking for a BSD-compatible install... " >&6; }
-if test -z "$INSTALL"; then
-if test "${ac_cv_path_install+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  # Account for people who put trailing slashes in PATH elements.
-case $as_dir/ in
-  ./ | .// | /cC/* | \
-  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
-  ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
-  /usr/ucb/* ) ;;
-  *)
-    # OSF1 and SCO ODT 3.0 have their own names for install.
-    # Don't use installbsd from OSF since it installs stuff as root
-    # by default.
-    for ac_prog in ginstall scoinst install; do
-      for ac_exec_ext in '' $ac_executable_extensions; do
-       if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
-         if test $ac_prog = install &&
-           grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
-           # AIX install.  It has an incompatible calling convention.
-           :
-         elif test $ac_prog = install &&
-           grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
-           # program-specific install script used by HP pwplus--don't use.
-           :
-         else
-           rm -rf conftest.one conftest.two conftest.dir
-           echo one > conftest.one
-           echo two > conftest.two
-           mkdir conftest.dir
-           if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
-             test -s conftest.one && test -s conftest.two &&
-             test -s conftest.dir/conftest.one &&
-             test -s conftest.dir/conftest.two
-           then
-             ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
-             break 3
-           fi
-         fi
-       fi
-      done
-    done
-    ;;
-esac
-
-done
-IFS=$as_save_IFS
-
-rm -rf conftest.one conftest.two conftest.dir
-
-fi
-  if test "${ac_cv_path_install+set}" = set; then
-    INSTALL=$ac_cv_path_install
-  else
-    # As a last resort, use the slow shell script.  Don't cache a
-    # value for INSTALL within a source directory, because that will
-    # break other packages using the cache if that directory is
-    # removed, or if the value is a relative name.
-    INSTALL=$ac_install_sh
-  fi
-fi
-{ $as_echo "$as_me:$LINENO: result: $INSTALL" >&5
-$as_echo "$INSTALL" >&6; }
-
-# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
-# It thinks the first close brace ends the variable substitution.
-test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
-
-test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
-
-test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-
-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:$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.
-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:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-RANLIB=$ac_cv_prog_RANLIB
-if test -n "$RANLIB"; then
-  { $as_echo "$as_me:$LINENO: result: $RANLIB" >&5
-$as_echo "$RANLIB" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-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:$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
-  $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:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
-if test -n "$ac_ct_RANLIB"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
-$as_echo "$ac_ct_RANLIB" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-  if test "x$ac_ct_RANLIB" = x; then
-    RANLIB=":"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
-    RANLIB=$ac_ct_RANLIB
-  fi
-else
-  RANLIB="$ac_cv_prog_RANLIB"
-fi
-
-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:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_INSTALL_INFO+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:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-  ;;
-esac
-fi
-INSTALL_INFO=$ac_cv_path_INSTALL_INFO
-if test -n "$INSTALL_INFO"; then
-  { $as_echo "$as_me:$LINENO: result: $INSTALL_INFO" >&5
-$as_echo "$INSTALL_INFO" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$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
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_INSTALL_INFO+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 /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_INSTALL_INFO="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-  ;;
-esac
-fi
-INSTALL_INFO=$ac_cv_path_INSTALL_INFO
-if test -n "$INSTALL_INFO"; then
-  { $as_echo "$as_me:$LINENO: result: $INSTALL_INFO" >&5
-$as_echo "$INSTALL_INFO" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$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
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_INSTALL_INFO+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 /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_INSTALL_INFO="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-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:$LINENO: result: $INSTALL_INFO" >&5
-$as_echo "$INSTALL_INFO" >&6; }
-else
-  { $as_echo "$as_me:$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
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_GZIP_PROG+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  case $GZIP_PROG in
-  [\\/]* | ?:[\\/]*)
-  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 $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_GZIP_PROG="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-  ;;
-esac
-fi
-GZIP_PROG=$ac_cv_path_GZIP_PROG
-if test -n "$GZIP_PROG"; then
-  { $as_echo "$as_me:$LINENO: result: $GZIP_PROG" >&5
-$as_echo "$GZIP_PROG" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-
-
-## Need makeinfo >= 4.6 (?) 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:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_MAKEINFO+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  case $MAKEINFO in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_MAKEINFO="$MAKEINFO" # 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_MAKEINFO="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-  test -z "$ac_cv_path_MAKEINFO" && ac_cv_path_MAKEINFO="no"
-  ;;
-esac
-fi
-MAKEINFO=$ac_cv_path_MAKEINFO
-if test -n "$MAKEINFO"; then
-  { $as_echo "$as_me:$LINENO: result: $MAKEINFO" >&5
-$as_echo "$MAKEINFO" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-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
-   MAKEINFO=no
-fi
-
-## Makeinfo is unusual.  For a released Emacs, the manuals are
-## pre-built, and not deleted by the normal clean rules.  makeinfo is
-## therefore in the category of "special tools" not normally required, which
-## configure does not have to check for (eg autoconf itself).
-## In a Bazaar checkout on the other hand, the manuals are not included.
-## So makeinfo is a requirement to build from Bazaar, and configure
-## should test for it as it does for any other build requirement.
-## We use the presence of $srcdir/info/emacs to distinguish a release,
-## with pre-built manuals, from a Bazaar checkout.
-if test "$MAKEINFO" = "no"; then
-  if test "x${with_makeinfo}" = "xno"; then
-    MAKEINFO=off
-  elif ! test -e $srcdir/info/emacs; then
-    { { $as_echo "$as_me:$LINENO: error: You do not seem to have makeinfo >= 4.6, 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. " >&5
-$as_echo "$as_me: error: You do not seem to have makeinfo >= 4.6, 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. " >&2;}
-   { (exit 1); exit 1; }; }
-  fi
-fi
-
-
-if test x$GCC = xyes && test "x$GCC_LINK_TEST_OPTIONS" != x
-then
-  ac_link="$ac_link $GCC_LINK_TEST_OPTIONS"
-fi
-
-if test x$GCC = x && test "x$NON_GCC_LINK_TEST_OPTIONS" != x
-then
-  ac_link="$ac_link $NON_GCC_LINK_TEST_OPTIONS"
-fi
-
-
-late_LDFLAGS=$LDFLAGS
-if test "$GCC" = yes; then
-  LDFLAGS="$LDFLAGS -Wl,-znocombreloc"
-else
-  LDFLAGS="$LDFLAGS -znocombreloc"
-fi
-
-{ $as_echo "$as_me:$LINENO: checking for -znocombreloc" >&5
-$as_echo_n "checking for -znocombreloc... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-main(){return 0;}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       LDFLAGS=$late_LDFLAGS
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-
-#### Extract some information from the operating system and machine files.
-
-{ $as_echo "$as_me:$LINENO: checking the machine- and system-dependent files to find out
- - which libraries the lib-src programs will want, and
- - whether the GNU malloc routines are usable..." >&5
-$as_echo "$as_me: checking the machine- and system-dependent files to find out
- - which libraries the lib-src programs will want, and
- - whether the GNU malloc routines are usable..." >&6;}
-
-### First figure out CFLAGS (which we use for running the compiler here)
-### and REAL_CFLAGS (which we use for real compilation).
-### The two are the same except on a few systems, where they are made
-### different to work around various lossages.  For example,
-### GCC 2.5 on GNU/Linux needs them to be different because it treats -g
-### as implying static linking.
-
-### If the CFLAGS env var is specified, we use that value
-### instead of the default.
-
-### It's not important that this name contain the PID; you can't run
-### two configures in the same directory and have anything work
-### anyway.
-tempcname="conftest.c"
-
-echo '
-#include "'${srcdir}'/src/'${opsysfile}'"
-#include "'${srcdir}'/src/'${machfile}'"
-#ifndef LIBS_MACHINE
-#define LIBS_MACHINE
-#endif
-#ifndef LIBS_SYSTEM
-#define LIBS_SYSTEM
-#endif
-#ifndef C_SWITCH_SYSTEM
-#define C_SWITCH_SYSTEM
-#endif
-#ifndef C_SWITCH_MACHINE
-#define C_SWITCH_MACHINE
-#endif
-configure___ libsrc_libs=LIBS_MACHINE LIBS_SYSTEM
-configure___ c_switch_system=C_SWITCH_SYSTEM
-configure___ c_switch_machine=C_SWITCH_MACHINE
-
-#ifndef LIB_X11_LIB
-#define LIB_X11_LIB -lX11
-#endif
-
-#ifndef LIBX11_SYSTEM
-#define LIBX11_SYSTEM
-#endif
-configure___ LIBX=LIB_X11_LIB LIBX11_SYSTEM
-
-#ifdef UNEXEC
-configure___ unexec=UNEXEC
-#else
-configure___ unexec=unexec.o
-#endif
-
-#ifdef SYSTEM_MALLOC
-configure___ system_malloc=yes
-#else
-configure___ system_malloc=no
-#endif
-
-#ifdef USE_MMAP_FOR_BUFFERS
-configure___ use_mmap_for_buffers=yes
-#else
-configure___ use_mmap_for_buffers=no
-#endif
-
-#ifndef C_DEBUG_SWITCH
-#define C_DEBUG_SWITCH -g
-#endif
-
-#ifndef C_OPTIMIZE_SWITCH
-#ifdef __GNUC__
-#define C_OPTIMIZE_SWITCH -O2
-#else
-#define C_OPTIMIZE_SWITCH -O
-#endif
-#endif
-
-#ifndef C_WARNINGS_SWITCH
-#define C_WARNINGS_SWITCH ${C_WARNINGS_SWITCH}
-#endif
-
-#ifndef LD_SWITCH_MACHINE
-#define LD_SWITCH_MACHINE
-#endif
-
-#ifndef LD_SWITCH_SYSTEM
-#define LD_SWITCH_SYSTEM
-#endif
-
-#ifndef LD_SWITCH_X_SITE_AUX
-#define LD_SWITCH_X_SITE_AUX
-#endif
-
-configure___ ld_switch_system=LD_SWITCH_SYSTEM
-configure___ ld_switch_machine=LD_SWITCH_MACHINE
-
-#ifdef THIS_IS_CONFIGURE
-
-/* Get the CFLAGS for tests in configure.  */
-#ifdef __GNUC__
-configure___ CFLAGS=C_DEBUG_SWITCH C_OPTIMIZE_SWITCH '${SPECIFIED_CFLAGS}'
-#else
-configure___ CFLAGS=C_DEBUG_SWITCH '${SPECIFIED_CFLAGS}'
-#endif
-
-#else /* not THIS_IS_CONFIGURE */
-
-/* Get the CFLAGS for real compilation.  */
-#ifdef __GNUC__
-configure___ REAL_CFLAGS=C_DEBUG_SWITCH C_OPTIMIZE_SWITCH C_WARNINGS_SWITCH ${PROFILING_CFLAGS} '${SPECIFIED_CFLAGS}'
-#else
-configure___ REAL_CFLAGS=C_DEBUG_SWITCH '${SPECIFIED_CFLAGS}'
-#endif
-
-#endif /* not THIS_IS_CONFIGURE */
-' > ${tempcname}
-
-LDFLAGS="${LDFLAGS} ${PROFILING_LDFLAGS}"
-
-# The value of CPP is a quoted variable reference, so we need to do this
-# to get its actual value...
-CPP=`eval "echo $CPP"`
-eval `${CPP} -Isrc ${tempcname} \
-       | sed -n -e 's/^configure___ \([^=]*=\)\(.*\)$/\1"\2"/p'`
-if test "x$SPECIFIED_CFLAGS" = x; then
-  eval `${CPP} -Isrc -DTHIS_IS_CONFIGURE ${tempcname} \
-        | sed -n -e 's/^configure___ \([^=]*=\)\(.*\)$/\1"\2"/p'`
-else
-  REAL_CFLAGS="$CFLAGS"
-fi
-rm ${tempcname}
-
-ac_link="$ac_link $ld_switch_machine $ld_switch_system"
-
-### Make sure subsequent tests use flags consistent with the build flags.
-
-if test x"${OVERRIDE_CPPFLAGS}" != x; then
-  CPPFLAGS="${OVERRIDE_CPPFLAGS}"
-else
-  CPPFLAGS="$c_switch_system $c_switch_machine $CPPFLAGS"
-fi
-
-
-
-# Check whether --enable-largefile was given.
-if test "${enable_largefile+set}" = set; then
-  enableval=$enable_largefile;
-fi
-
-if test "$enable_largefile" != no; then
-
-  { $as_echo "$as_me:$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 >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* 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
-        rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  break
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext
-        CC="$CC -n32"
-        rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_sys_largefile_CC=' -n32'; break
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-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:$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:$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 >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* 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
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_sys_file_offset_bits=no; break
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* 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
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_sys_file_offset_bits=64; break
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-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:$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:$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 >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* 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
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_sys_large_files=no; break
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* 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
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_sys_large_files=1; break
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-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:$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
-
-
-
-### The standard library on x86-64 and s390x GNU/Linux distributions can
-### be located in either /usr/lib64 or /usr/lib.
-### In some rare cases, /usr/lib64 exists but does not contain the
-### relevant files (bug#1287).  Hence test for crtn.o.
-case "${canonical}" in
-  x86_64-*-linux-gnu* | s390x-*-linux-gnu* )
-    if test -e /usr/lib64/crtn.o; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_LIB64_DIR 1
-_ACEOF
-
-fi
-esac
-
-
-
-
-if test "${with_sound}" != "no"; then
-  # Sound support for GNU/Linux and the free BSDs.
-
-
-
-for ac_header in machine/soundcard.h sys/soundcard.h soundcard.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-if test `eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-  # Emulation library used on NetBSD.
-  { $as_echo "$as_me:$LINENO: checking for _oss_ioctl in -lossaudio" >&5
-$as_echo_n "checking for _oss_ioctl in -lossaudio... " >&6; }
-if test "${ac_cv_lib_ossaudio__oss_ioctl+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lossaudio  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* 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 _oss_ioctl ();
-int
-main ()
-{
-return _oss_ioctl ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_ossaudio__oss_ioctl=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_lib_ossaudio__oss_ioctl=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_ossaudio__oss_ioctl" >&5
-$as_echo "$ac_cv_lib_ossaudio__oss_ioctl" >&6; }
-if test $ac_cv_lib_ossaudio__oss_ioctl = yes; then
-  LIBSOUND=-lossaudio
-else
-  LIBSOUND=
-fi
-
-
-
-  ALSA_REQUIRED=1.0.0
-  ALSA_MODULES="alsa >= $ALSA_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:$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:$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:$LINENO: result: $PKG_CONFIG" >&5
-$as_echo "$PKG_CONFIG" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-
-  if test "$PKG_CONFIG" = "no" ; then
-     HAVE_ALSA=no
-  else
-     PKG_CONFIG_MIN_VERSION=0.9.0
-     if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
-        { $as_echo "$as_me:$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:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-            succeeded=yes
-
-            { $as_echo "$as_me:$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:$LINENO: result: $ALSA_CFLAGS" >&5
-$as_echo "$ALSA_CFLAGS" >&6; }
-
-            { $as_echo "$as_me:$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:$LINENO: result: $ALSA_LIBS" >&5
-$as_echo "$ALSA_LIBS" >&6; }
-        else
-            { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-            ALSA_CFLAGS=""
-            ALSA_LIBS=""
-            ## If we have a custom action on failure, don't print errors, but
-            ## do set a variable so people can do so.
-            ALSA_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$ALSA_MODULES"`
-
-        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_ALSA=yes
-  else
-     HAVE_ALSA=no
-  fi
-
-  if test $HAVE_ALSA = yes; then
-    SAVE_CFLAGS="$CFLAGS"
-    SAVE_LDFLAGS="$LDFLAGS"
-    CFLAGS="$ALSA_CFLAGS $CFLAGS"
-    LDFLAGS="$ALSA_LIBS $LDFLAGS"
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <asoundlib.h>
-int
-main ()
-{
-snd_lib_error_set_handler (0);
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  emacs_alsa_normal=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       emacs_alsa_normal=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-    if test "$emacs_alsa_normal" != yes; then
-      cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <alsa/asoundlib.h>
-int
-main ()
-{
-snd_lib_error_set_handler (0);
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  emacs_alsa_subdir=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       emacs_alsa_subdir=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-      if test "$emacs_alsa_subdir" != yes; then
-        { { $as_echo "$as_me:$LINENO: error: pkg-config found alsa, but it does not compile.  See config.log for error messages." >&5
-$as_echo "$as_me: error: pkg-config found alsa, but it does not compile.  See config.log for error messages." >&2;}
-   { (exit 1); exit 1; }; }
-      fi
-      ALSA_CFLAGS="$ALSA_CFLAGS -DALSA_SUBDIR_INCLUDE"
-    fi
-
-    CFLAGS="$SAVE_CFLAGS"
-    LDFLAGS="$SAVE_LDFLAGS"
-    LIBSOUND="$LIBSOUND $ALSA_LIBS"
-    CFLAGS_SOUND="$CFLAGS_SOUND $ALSA_CFLAGS"
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_ALSA 1
-_ACEOF
-
-  fi
-
-fi
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-for ac_header in sys/select.h sys/timeb.h sys/time.h unistd.h utime.h \
-  linux/version.h sys/systeminfo.h termios.h limits.h string.h stdlib.h \
-  termcap.h stdio_ext.h fcntl.h strings.h coff.h pty.h sys/mman.h \
-  sys/param.h sys/vlimit.h sys/resource.h locale.h sys/_mbstate_t.h \
-  sys/utsname.h pwd.h utmp.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-if test `eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-{ $as_echo "$as_me:$LINENO: checking if personality LINUX32 can be set" >&5
-$as_echo_n "checking if personality LINUX32 can be set... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/personality.h>
-int
-main ()
-{
-personality (PER_LINUX32)
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  emacs_cv_personality_linux32=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       emacs_cv_personality_linux32=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $emacs_cv_personality_linux32" >&5
-$as_echo "$emacs_cv_personality_linux32" >&6; }
-
-if test $emacs_cv_personality_linux32 = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_PERSONALITY_LINUX32 1
-_ACEOF
-
-fi
-
-
-for ac_header in term.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  eval "$as_ac_Header=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  eval "$as_ac_Header=no"
-fi
-
-rm -f conftest.err conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if test `eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-{ $as_echo "$as_me:$LINENO: checking for ANSI C header files" >&5
-$as_echo_n "checking for ANSI C header files... " >&6; }
-if test "${ac_cv_header_stdc+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_header_stdc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_header_stdc=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-if test $ac_cv_header_stdc = yes; then
-  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <string.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "memchr" >/dev/null 2>&1; then
-  :
-else
-  ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
-  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <stdlib.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "free" >/dev/null 2>&1; then
-  :
-else
-  ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
-  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
-  if test "$cross_compiling" = yes; then
-  :
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <ctype.h>
-#include <stdlib.h>
-#if ((' ' & 0x0FF) == 0x020)
-# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#else
-# define ISLOWER(c) \
-                  (('a' <= (c) && (c) <= 'i') \
-                    || ('j' <= (c) && (c) <= 'r') \
-                    || ('s' <= (c) && (c) <= 'z'))
-# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
-#endif
-
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int
-main ()
-{
-  int i;
-  for (i = 0; i < 256; i++)
-    if (XOR (islower (i), ISLOWER (i))
-       || toupper (i) != TOUPPER (i))
-      return 2;
-  return 0;
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  :
-else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-ac_cv_header_stdc=no
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-
-
-fi
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
-$as_echo "$ac_cv_header_stdc" >&6; }
-if test $ac_cv_header_stdc = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define STDC_HEADERS 1
-_ACEOF
-
-fi
-
-{ $as_echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5
-$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; }
-if test "${ac_cv_header_time+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/types.h>
-#include <sys/time.h>
-#include <time.h>
-
-int
-main ()
-{
-if ((struct tm *) 0)
-return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_header_time=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_header_time=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5
-$as_echo "$ac_cv_header_time" >&6; }
-if test $ac_cv_header_time = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define TIME_WITH_SYS_TIME 1
-_ACEOF
-
-fi
-
-{ $as_echo "$as_me:$LINENO: checking whether sys_siglist is declared" >&5
-$as_echo_n "checking whether sys_siglist is declared... " >&6; }
-if test "${ac_cv_have_decl_sys_siglist+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-#ifndef sys_siglist
-  (void) sys_siglist;
-#endif
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_have_decl_sys_siglist=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_have_decl_sys_siglist=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_sys_siglist" >&5
-$as_echo "$ac_cv_have_decl_sys_siglist" >&6; }
-if test $ac_cv_have_decl_sys_siglist = yes; then
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_SYS_SIGLIST 1
-_ACEOF
-
-
-else
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_SYS_SIGLIST 0
-_ACEOF
-
-
-fi
-
-
-if test $ac_cv_have_decl_sys_siglist != yes; then
-  # For Tru64, at least:
-  { $as_echo "$as_me:$LINENO: checking whether __sys_siglist is declared" >&5
-$as_echo_n "checking whether __sys_siglist is declared... " >&6; }
-if test "${ac_cv_have_decl___sys_siglist+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-#ifndef __sys_siglist
-  (void) __sys_siglist;
-#endif
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_have_decl___sys_siglist=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_have_decl___sys_siglist=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl___sys_siglist" >&5
-$as_echo "$ac_cv_have_decl___sys_siglist" >&6; }
-if test $ac_cv_have_decl___sys_siglist = yes; then
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL___SYS_SIGLIST 1
-_ACEOF
-
-
-else
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL___SYS_SIGLIST 0
-_ACEOF
-
-
-fi
-
-
-  if test $ac_cv_have_decl___sys_siglist = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define sys_siglist __sys_siglist
-_ACEOF
-
-  fi
-fi
-{ $as_echo "$as_me:$LINENO: checking for sys/wait.h that is POSIX.1 compatible" >&5
-$as_echo_n "checking for sys/wait.h that is POSIX.1 compatible... " >&6; }
-if test "${ac_cv_header_sys_wait_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/types.h>
-#include <sys/wait.h>
-#ifndef WEXITSTATUS
-# define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8)
-#endif
-#ifndef WIFEXITED
-# define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
-#endif
-
-int
-main ()
-{
-  int s;
-  wait (&s);
-  s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_header_sys_wait_h=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_header_sys_wait_h=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5
-$as_echo "$ac_cv_header_sys_wait_h" >&6; }
-if test $ac_cv_header_sys_wait_h = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_SYS_WAIT_H 1
-_ACEOF
-
-fi
-
-
-{ $as_echo "$as_me:$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 >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* 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
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  emacs_cv_struct_utimbuf=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       emacs_cv_struct_utimbuf=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $emacs_cv_struct_utimbuf" >&5
-$as_echo "$emacs_cv_struct_utimbuf" >&6; }
-if test $emacs_cv_struct_utimbuf = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_STRUCT_UTIMBUF 1
-_ACEOF
-
-fi
-
-{ $as_echo "$as_me:$LINENO: checking return type of signal handlers" >&5
-$as_echo_n "checking return type of signal handlers... " >&6; }
-if test "${ac_cv_type_signal+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/types.h>
-#include <signal.h>
-
-int
-main ()
-{
-return *(signal (0, 0)) (0) == 1;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_type_signal=int
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_type_signal=void
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5
-$as_echo "$ac_cv_type_signal" >&6; }
-
-cat >>confdefs.h <<_ACEOF
-#define RETSIGTYPE $ac_cv_type_signal
-_ACEOF
-
-
-
-{ $as_echo "$as_me:$LINENO: checking for speed_t" >&5
-$as_echo_n "checking for speed_t... " >&6; }
-if test "${emacs_cv_speed_t+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <termios.h>
-int
-main ()
-{
-speed_t x = 1;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  emacs_cv_speed_t=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       emacs_cv_speed_t=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $emacs_cv_speed_t" >&5
-$as_echo "$emacs_cv_speed_t" >&6; }
-if test $emacs_cv_speed_t = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_SPEED_T 1
-_ACEOF
-
-fi
-
-{ $as_echo "$as_me:$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 >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* 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
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  emacs_cv_struct_timeval=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       emacs_cv_struct_timeval=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$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
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_TIMEVAL 1
-_ACEOF
-
-fi
-
-{ $as_echo "$as_me:$LINENO: checking for struct exception" >&5
-$as_echo_n "checking for struct exception... " >&6; }
-if test "${emacs_cv_struct_exception+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <math.h>
-int
-main ()
-{
-static struct exception x; x.arg1 = x.arg2 = x.retval; x.name = ""; x.type = 1;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  emacs_cv_struct_exception=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       emacs_cv_struct_exception=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$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
-
-cat >>confdefs.h <<\_ACEOF
-#define NO_MATHERR 1
-_ACEOF
-
-fi
-
-
-for ac_header in sys/socket.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-if test `eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-for ac_header in net/if.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#if HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  eval "$as_ac_Header=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Header=no"
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if test `eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-{ $as_echo "$as_me:$LINENO: checking whether struct tm is in sys/time.h or time.h" >&5
-$as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; }
-if test "${ac_cv_struct_tm+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/types.h>
-#include <time.h>
-
-int
-main ()
-{
-struct tm tm;
-                                    int *p = &tm.tm_sec;
-                                    return !p;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_struct_tm=time.h
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_struct_tm=sys/time.h
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_struct_tm" >&5
-$as_echo "$ac_cv_struct_tm" >&6; }
-if test $ac_cv_struct_tm = sys/time.h; then
-
-cat >>confdefs.h <<\_ACEOF
-#define TM_IN_SYS_TIME 1
-_ACEOF
-
-fi
-
-{ $as_echo "$as_me:$LINENO: checking for struct tm.tm_zone" >&5
-$as_echo_n "checking for struct tm.tm_zone... " >&6; }
-if test "${ac_cv_member_struct_tm_tm_zone+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/types.h>
-#include <$ac_cv_struct_tm>
-
-
-int
-main ()
-{
-static struct tm ac_aggr;
-if (ac_aggr.tm_zone)
-return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_member_struct_tm_tm_zone=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/types.h>
-#include <$ac_cv_struct_tm>
-
-
-int
-main ()
-{
-static struct tm ac_aggr;
-if (sizeof ac_aggr.tm_zone)
-return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_member_struct_tm_tm_zone=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_member_struct_tm_tm_zone=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:$LINENO: result: $ac_cv_member_struct_tm_tm_zone" >&5
-$as_echo "$ac_cv_member_struct_tm_tm_zone" >&6; }
-if test $ac_cv_member_struct_tm_tm_zone = yes; then
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_STRUCT_TM_TM_ZONE 1
-_ACEOF
-
-
-fi
-
-if test "$ac_cv_member_struct_tm_tm_zone" = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_TM_ZONE 1
-_ACEOF
-
-else
-  { $as_echo "$as_me:$LINENO: checking whether tzname is declared" >&5
-$as_echo_n "checking whether tzname is declared... " >&6; }
-if test "${ac_cv_have_decl_tzname+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <time.h>
-
-int
-main ()
-{
-#ifndef tzname
-  (void) tzname;
-#endif
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_have_decl_tzname=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_have_decl_tzname=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_tzname" >&5
-$as_echo "$ac_cv_have_decl_tzname" >&6; }
-if test $ac_cv_have_decl_tzname = yes; then
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_TZNAME 1
-_ACEOF
-
-
-else
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_TZNAME 0
-_ACEOF
-
-
-fi
-
-
-  { $as_echo "$as_me:$LINENO: checking for tzname" >&5
-$as_echo_n "checking for tzname... " >&6; }
-if test "${ac_cv_var_tzname+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <time.h>
-#if !HAVE_DECL_TZNAME
-extern char *tzname[];
-#endif
-
-int
-main ()
-{
-return tzname[0][0];
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_var_tzname=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_var_tzname=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_var_tzname" >&5
-$as_echo "$ac_cv_var_tzname" >&6; }
-  if test $ac_cv_var_tzname = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_TZNAME 1
-_ACEOF
-
-  fi
-fi
-
-{ $as_echo "$as_me:$LINENO: checking for struct tm.tm_gmtoff" >&5
-$as_echo_n "checking for struct tm.tm_gmtoff... " >&6; }
-if test "${ac_cv_member_struct_tm_tm_gmtoff+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <time.h>
-
-int
-main ()
-{
-static struct tm ac_aggr;
-if (ac_aggr.tm_gmtoff)
-return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_member_struct_tm_tm_gmtoff=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <time.h>
-
-int
-main ()
-{
-static struct tm ac_aggr;
-if (sizeof ac_aggr.tm_gmtoff)
-return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_member_struct_tm_tm_gmtoff=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_member_struct_tm_tm_gmtoff=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:$LINENO: result: $ac_cv_member_struct_tm_tm_gmtoff" >&5
-$as_echo "$ac_cv_member_struct_tm_tm_gmtoff" >&6; }
-if test $ac_cv_member_struct_tm_tm_gmtoff = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_TM_GMTOFF 1
-_ACEOF
-
-fi
-
-{ $as_echo "$as_me:$LINENO: checking for struct ifreq.ifr_flags" >&5
-$as_echo_n "checking for struct ifreq.ifr_flags... " >&6; }
-if test "${ac_cv_member_struct_ifreq_ifr_flags+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#if HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#if HAVE_NET_IF_H
-#include <net/if.h>
-#endif
-
-int
-main ()
-{
-static struct ifreq ac_aggr;
-if (ac_aggr.ifr_flags)
-return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_member_struct_ifreq_ifr_flags=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#if HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#if HAVE_NET_IF_H
-#include <net/if.h>
-#endif
-
-int
-main ()
-{
-static struct ifreq ac_aggr;
-if (sizeof ac_aggr.ifr_flags)
-return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_member_struct_ifreq_ifr_flags=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_member_struct_ifreq_ifr_flags=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:$LINENO: result: $ac_cv_member_struct_ifreq_ifr_flags" >&5
-$as_echo "$ac_cv_member_struct_ifreq_ifr_flags" >&6; }
-if test $ac_cv_member_struct_ifreq_ifr_flags = yes; then
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_STRUCT_IFREQ_IFR_FLAGS 1
-_ACEOF
-
-
-fi
-{ $as_echo "$as_me:$LINENO: checking for struct ifreq.ifr_hwaddr" >&5
-$as_echo_n "checking for struct ifreq.ifr_hwaddr... " >&6; }
-if test "${ac_cv_member_struct_ifreq_ifr_hwaddr+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#if HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#if HAVE_NET_IF_H
-#include <net/if.h>
-#endif
-
-int
-main ()
-{
-static struct ifreq ac_aggr;
-if (ac_aggr.ifr_hwaddr)
-return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_member_struct_ifreq_ifr_hwaddr=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#if HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#if HAVE_NET_IF_H
-#include <net/if.h>
-#endif
-
-int
-main ()
-{
-static struct ifreq ac_aggr;
-if (sizeof ac_aggr.ifr_hwaddr)
-return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_member_struct_ifreq_ifr_hwaddr=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_member_struct_ifreq_ifr_hwaddr=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:$LINENO: result: $ac_cv_member_struct_ifreq_ifr_hwaddr" >&5
-$as_echo "$ac_cv_member_struct_ifreq_ifr_hwaddr" >&6; }
-if test $ac_cv_member_struct_ifreq_ifr_hwaddr = yes; then
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_STRUCT_IFREQ_IFR_HWADDR 1
-_ACEOF
-
-
-fi
-{ $as_echo "$as_me:$LINENO: checking for struct ifreq.ifr_netmask" >&5
-$as_echo_n "checking for struct ifreq.ifr_netmask... " >&6; }
-if test "${ac_cv_member_struct_ifreq_ifr_netmask+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#if HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#if HAVE_NET_IF_H
-#include <net/if.h>
-#endif
-
-int
-main ()
-{
-static struct ifreq ac_aggr;
-if (ac_aggr.ifr_netmask)
-return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_member_struct_ifreq_ifr_netmask=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#if HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#if HAVE_NET_IF_H
-#include <net/if.h>
-#endif
-
-int
-main ()
-{
-static struct ifreq ac_aggr;
-if (sizeof ac_aggr.ifr_netmask)
-return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_member_struct_ifreq_ifr_netmask=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_member_struct_ifreq_ifr_netmask=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:$LINENO: result: $ac_cv_member_struct_ifreq_ifr_netmask" >&5
-$as_echo "$ac_cv_member_struct_ifreq_ifr_netmask" >&6; }
-if test $ac_cv_member_struct_ifreq_ifr_netmask = yes; then
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_STRUCT_IFREQ_IFR_NETMASK 1
-_ACEOF
-
-
-fi
-{ $as_echo "$as_me:$LINENO: checking for struct ifreq.ifr_broadaddr" >&5
-$as_echo_n "checking for struct ifreq.ifr_broadaddr... " >&6; }
-if test "${ac_cv_member_struct_ifreq_ifr_broadaddr+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#if HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#if HAVE_NET_IF_H
-#include <net/if.h>
-#endif
-
-int
-main ()
-{
-static struct ifreq ac_aggr;
-if (ac_aggr.ifr_broadaddr)
-return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_member_struct_ifreq_ifr_broadaddr=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#if HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#if HAVE_NET_IF_H
-#include <net/if.h>
-#endif
-
-int
-main ()
-{
-static struct ifreq ac_aggr;
-if (sizeof ac_aggr.ifr_broadaddr)
-return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_member_struct_ifreq_ifr_broadaddr=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_member_struct_ifreq_ifr_broadaddr=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:$LINENO: result: $ac_cv_member_struct_ifreq_ifr_broadaddr" >&5
-$as_echo "$ac_cv_member_struct_ifreq_ifr_broadaddr" >&6; }
-if test $ac_cv_member_struct_ifreq_ifr_broadaddr = yes; then
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_STRUCT_IFREQ_IFR_BROADADDR 1
-_ACEOF
-
-
-fi
-{ $as_echo "$as_me:$LINENO: checking for struct ifreq.ifr_addr" >&5
-$as_echo_n "checking for struct ifreq.ifr_addr... " >&6; }
-if test "${ac_cv_member_struct_ifreq_ifr_addr+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#if HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#if HAVE_NET_IF_H
-#include <net/if.h>
-#endif
-
-int
-main ()
-{
-static struct ifreq ac_aggr;
-if (ac_aggr.ifr_addr)
-return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_member_struct_ifreq_ifr_addr=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#if HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#if HAVE_NET_IF_H
-#include <net/if.h>
-#endif
-
-int
-main ()
-{
-static struct ifreq ac_aggr;
-if (sizeof ac_aggr.ifr_addr)
-return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_member_struct_ifreq_ifr_addr=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_member_struct_ifreq_ifr_addr=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:$LINENO: result: $ac_cv_member_struct_ifreq_ifr_addr" >&5
-$as_echo "$ac_cv_member_struct_ifreq_ifr_addr" >&6; }
-if test $ac_cv_member_struct_ifreq_ifr_addr = yes; then
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_STRUCT_IFREQ_IFR_ADDR 1
-_ACEOF
-
-
-fi
-
-
-
-{ $as_echo "$as_me:$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:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-
-cat >>confdefs.h <<\_ACEOF
-#define PROTOTYPES 1
-_ACEOF
-
-
-cat >>confdefs.h <<\_ACEOF
-#define __PROTOTYPES 1
-_ACEOF
-
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-{ $as_echo "$as_me:$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_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-volatile int x;
-int * volatile y = (int *) 0;
-return !x && !y;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_c_volatile=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_c_volatile=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_volatile" >&5
-$as_echo "$ac_cv_c_volatile" >&6; }
-if test $ac_cv_c_volatile = no; then
-
-cat >>confdefs.h <<\_ACEOF
-#define volatile /**/
-_ACEOF
-
-fi
-
-{ $as_echo "$as_me:$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 >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* 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
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_c_const=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_c_const=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
-$as_echo "$ac_cv_c_const" >&6; }
-if test $ac_cv_c_const = no; then
-
-cat >>confdefs.h <<\_ACEOF
-#define const /**/
-_ACEOF
-
-fi
-
-{ $as_echo "$as_me:$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 >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-void * foo;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  emacs_cv_void_star=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       emacs_cv_void_star=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $emacs_cv_void_star" >&5
-$as_echo "$emacs_cv_void_star" >&6; }
-if test $emacs_cv_void_star = yes; then
-  cat >>confdefs.h <<\_ACEOF
-#define POINTER_TYPE void
-_ACEOF
-
-else
-  cat >>confdefs.h <<\_ACEOF
-#define POINTER_TYPE char
-_ACEOF
-
-fi
-
-
-
-
-
-{ $as_echo "$as_me:$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:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-  SET_MAKE=
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-  SET_MAKE="MAKE=${MAKE-make}"
-fi
-
-
-if test "$GCC" = yes && test "$ac_enable_autodepend" = yes; then
-   { $as_echo "$as_me:$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 --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:$LINENO: result: $HAVE_GNU_MAKE" >&5
-$as_echo "$HAVE_GNU_MAKE" >&6; }
-   if test $HAVE_GNU_MAKE = yes; then
-      { $as_echo "$as_me:$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"
-      cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  :
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       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:$LINENO: result: $ac_enable_autodepend" >&5
-$as_echo "$ac_enable_autodepend" >&6; }
-   fi
-   if test $ac_enable_autodepend = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define AUTO_DEPEND 1
-_ACEOF
-
-   fi
-fi
-
-{ $as_echo "$as_me:$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
-# Test for long file names in all the places we know might matter:
-#      .               the current directory, where building will happen
-#      $prefix/lib     where we will be installing things
-#      $exec_prefix/lib        likewise
-#      $TMPDIR         if set, where it might want to write temporary files
-#      /tmp            where it might want to write temporary files
-#      /var/tmp                likewise
-#      /usr/tmp                likewise
-for ac_dir in . "$TMPDIR" /tmp /var/tmp /usr/tmp "$prefix/lib" "$exec_prefix/lib"; do
-  # Skip $TMPDIR if it is empty or bogus, and skip $exec_prefix/lib
-  # in the usual case where exec_prefix is '${prefix}'.
-  case $ac_dir in #(
-    . | /* | ?:[\\/]*) ;; #(
-    *) continue;;
-  esac
-  test -w "$ac_dir/." || continue # It is less confusing to not echo anything here.
-  ac_xdir=$ac_dir/cf$$
-  (umask 077 && mkdir "$ac_xdir" 2>/dev/null) || continue
-  ac_tf1=$ac_xdir/conftest9012345
-  ac_tf2=$ac_xdir/conftest9012346
-  touch "$ac_tf1" 2>/dev/null && test -f "$ac_tf1" && test ! -f "$ac_tf2" ||
-    ac_cv_sys_long_file_names=no
-  rm -f -r "$ac_xdir" 2>/dev/null
-  test $ac_cv_sys_long_file_names = no && break
-done
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sys_long_file_names" >&5
-$as_echo "$ac_cv_sys_long_file_names" >&6; }
-if test $ac_cv_sys_long_file_names = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_LONG_FILE_NAMES 1
-_ACEOF
-
-fi
-
-
-#### Choose a window system.
-
-{ $as_echo "$as_me:$LINENO: checking for X" >&5
-$as_echo_n "checking for X... " >&6; }
-
-
-# Check whether --with-x was given.
-if test "${with_x+set}" = set; then
-  withval=$with_x;
-fi
-
-# $have_x is `yes', `no', `disabled', or empty when we do not yet know.
-if test "x$with_x" = xno; then
-  # The user explicitly disabled X.
-  have_x=disabled
-else
-  case $x_includes,$x_libraries in #(
-    *\'*) { { $as_echo "$as_me:$LINENO: error: Cannot use X directory names containing '" >&5
-$as_echo "$as_me: error: Cannot use X directory names containing '" >&2;}
-   { (exit 1); exit 1; }; };; #(
-    *,NONE | NONE,*) if test "${ac_cv_have_x+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  # One or both of the vars are not set, and there is no cached value.
-ac_x_includes=no ac_x_libraries=no
-rm -f -r conftest.dir
-if mkdir conftest.dir; then
-  cd conftest.dir
-  cat >Imakefile <<'_ACEOF'
-incroot:
-       @echo incroot='${INCROOT}'
-usrlibdir:
-       @echo usrlibdir='${USRLIBDIR}'
-libdir:
-       @echo libdir='${LIBDIR}'
-_ACEOF
-  if (export CC; ${XMKMF-xmkmf}) >/dev/null 2>/dev/null && test -f Makefile; then
-    # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
-    for ac_var in incroot usrlibdir libdir; do
-      eval "ac_im_$ac_var=\`\${MAKE-make} $ac_var 2>/dev/null | sed -n 's/^$ac_var=//p'\`"
-    done
-    # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR.
-    for ac_extension in a so sl dylib la dll; do
-      if test ! -f "$ac_im_usrlibdir/libX11.$ac_extension" &&
-        test -f "$ac_im_libdir/libX11.$ac_extension"; then
-       ac_im_usrlibdir=$ac_im_libdir; break
-      fi
-    done
-    # Screen out bogus values from the imake configuration.  They are
-    # bogus both because they are the default anyway, and because
-    # using them would break gcc on systems where it needs fixed includes.
-    case $ac_im_incroot in
-       /usr/include) ac_x_includes= ;;
-       *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;;
-    esac
-    case $ac_im_usrlibdir in
-       /usr/lib | /lib) ;;
-       *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;;
-    esac
-  fi
-  cd ..
-  rm -f -r conftest.dir
-fi
-
-# Standard set of common directories for X headers.
-# Check X11 before X11Rn because it is often a symlink to the current release.
-ac_x_header_dirs='
-/usr/X11/include
-/usr/X11R6/include
-/usr/X11R5/include
-/usr/X11R4/include
-
-/usr/include/X11
-/usr/include/X11R6
-/usr/include/X11R5
-/usr/include/X11R4
-
-/usr/local/X11/include
-/usr/local/X11R6/include
-/usr/local/X11R5/include
-/usr/local/X11R4/include
-
-/usr/local/include/X11
-/usr/local/include/X11R6
-/usr/local/include/X11R5
-/usr/local/include/X11R4
-
-/usr/X386/include
-/usr/x386/include
-/usr/XFree86/include/X11
-
-/usr/include
-/usr/local/include
-/usr/unsupported/include
-/usr/athena/include
-/usr/local/x11r5/include
-/usr/lpp/Xamples/include
-
-/usr/openwin/include
-/usr/openwin/share/include'
-
-if test "$ac_x_includes" = no; then
-  # Guess where to find include files, by looking for Xlib.h.
-  # First, try using that file with no special directory specified.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <X11/Xlib.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  # We can compile using X headers with no special include directory.
-ac_x_includes=
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  for ac_dir in $ac_x_header_dirs; do
-  if test -r "$ac_dir/X11/Xlib.h"; then
-    ac_x_includes=$ac_dir
-    break
-  fi
-done
-fi
-
-rm -f conftest.err conftest.$ac_ext
-fi # $ac_x_includes = no
-
-if test "$ac_x_libraries" = no; then
-  # Check for the libraries.
-  # See if we find them without any special options.
-  # Don't add to $LIBS permanently.
-  ac_save_LIBS=$LIBS
-  LIBS="-lX11 $LIBS"
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <X11/Xlib.h>
-int
-main ()
-{
-XrmInitialize ()
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  LIBS=$ac_save_LIBS
-# We can link X programs with no special library path.
-ac_x_libraries=
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       LIBS=$ac_save_LIBS
-for ac_dir in `$as_echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g`
-do
-  # Don't even attempt the hair of trying to link an X program!
-  for ac_extension in a so sl dylib la dll; do
-    if test -r "$ac_dir/libX11.$ac_extension"; then
-      ac_x_libraries=$ac_dir
-      break 2
-    fi
-  done
-done
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi # $ac_x_libraries = no
-
-case $ac_x_includes,$ac_x_libraries in #(
-  no,* | *,no | *\'*)
-    # Didn't find X, or a directory has "'" in its name.
-    ac_cv_have_x="have_x=no";; #(
-  *)
-    # Record where we found X for the cache.
-    ac_cv_have_x="have_x=yes\
-       ac_x_includes='$ac_x_includes'\
-       ac_x_libraries='$ac_x_libraries'"
-esac
-fi
-;; #(
-    *) have_x=yes;;
-  esac
-  eval "$ac_cv_have_x"
-fi # $with_x != no
-
-if test "$have_x" != yes; then
-  { $as_echo "$as_me:$LINENO: result: $have_x" >&5
-$as_echo "$have_x" >&6; }
-  no_x=yes
-else
-  # If each of the values was on the command line, it overrides each guess.
-  test "x$x_includes" = xNONE && x_includes=$ac_x_includes
-  test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries
-  # Update the cache value to reflect the command line values.
-  ac_cv_have_x="have_x=yes\
-       ac_x_includes='$x_includes'\
-       ac_x_libraries='$x_libraries'"
-  { $as_echo "$as_me:$LINENO: result: libraries $x_libraries, headers $x_includes" >&5
-$as_echo "libraries $x_libraries, headers $x_includes" >&6; }
-fi
-
-if test "$no_x" = yes; then
-  window_system=none
-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.
-## This is an experiment, take it out if it causes problems.
-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
-
-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"`
-  fi
-  x_default_search_path=""
-  x_search_path=${x_libraries}
-  if test -z "${x_search_path}"; then
-    x_search_path=/usr/lib
-  fi
-  for x_library in `echo ${x_search_path}: | \
-                   sed -e "s/:/ /g" -e p -e "s:/lib[^ /]* :/share :g"`; do
-    x_search_path="\
-${x_library}/X11/%L/%T/%N%C%S:\
-${x_library}/X11/%l/%T/%N%C%S:\
-${x_library}/X11/%T/%N%C%S:\
-${x_library}/X11/%L/%T/%N%S:\
-${x_library}/X11/%l/%T/%N%S:\
-${x_library}/X11/%T/%N%S"
-    if test x"${x_default_search_path}" = x; then
-      x_default_search_path=${x_search_path}
-    else
-      x_default_search_path="${x_search_path}:${x_default_search_path}"
-    fi
-  done
-fi
-if test "${x_includes}" != NONE && test -n "${x_includes}"; then
-  C_SWITCH_X_SITE=-I`echo ${x_includes} | sed -e "s/:/ -I/g"`
-fi
-
-if test x"${x_includes}" = x; then
-  bitmapdir=/usr/include/X11/bitmaps
-else
-  # accumulate include directories that have X11 bitmap subdirectories
-  bmd_acc="dummyval"
-  for bmd in `echo ${x_includes} | sed -e "s/:/ /g"`; do
-    if test -d "${bmd}/X11/bitmaps"; then
-      bmd_acc="${bmd_acc}:${bmd}/X11/bitmaps"
-    fi
-    if test -d "${bmd}/bitmaps"; then
-      bmd_acc="${bmd_acc}:${bmd}/bitmaps"
-    fi
-  done
-  if test ${bmd_acc} != "dummyval"; then
-    bitmapdir=`echo ${bmd_acc} | sed -e "s/^dummyval://"`
-  fi
-fi
-
-HAVE_NS=no
-NS_IMPL_COCOA=no
-NS_IMPL_GNUSTEP=no
-tmp_CPPFLAGS="$CPPFLAGS"
-tmp_CFLAGS="$CFLAGS"
-CPPFLAGS="$CPPFLAGS -x objective-c"
-CFLAGS="$CFLAGS -x objective-c"
-if test "${with_ns}" != no; then
-  if test "${opsys}" = darwin; then
-     NS_IMPL_COCOA=yes
-     ns_appdir=`pwd`/nextstep/Emacs.app
-     ns_appbindir=`pwd`/nextstep/Emacs.app/Contents/MacOS
-     ns_appresdir=`pwd`/nextstep/Emacs.app/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=`pwd`/nextstep/Emacs.app
-     ns_appresdir=`pwd`/nextstep/Emacs.app/Resources
-     ns_appsrc=${srcdir}/nextstep/GNUstep/Emacs.base
-          GNUSTEP_MAKEFILES="$(. $GNUSTEP_CONFIG_FILE; echo $GNUSTEP_MAKEFILES)"
-     GNUSTEP_SYSTEM_HEADERS="$(. $GNUSTEP_CONFIG_FILE; echo $GNUSTEP_SYSTEM_HEADERS)"
-     GNUSTEP_SYSTEM_LIBRARIES="$(. $GNUSTEP_CONFIG_FILE; echo $GNUSTEP_SYSTEM_LIBRARIES)"
-     CPPFLAGS="$CPPFLAGS -I${GNUSTEP_SYSTEM_HEADERS}"
-     CFLAGS="$CFLAGS -I${GNUSTEP_SYSTEM_HEADERS}"
-     REAL_CFLAGS="$REAL_CFLAGS -I${GNUSTEP_SYSTEM_HEADERS}"
-     LDFLAGS="$LDFLAGS -L${GNUSTEP_SYSTEM_LIBRARIES}"
-  fi
-  if test "${ac_cv_header_AppKit_AppKit_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for AppKit/AppKit.h" >&5
-$as_echo_n "checking for AppKit/AppKit.h... " >&6; }
-if test "${ac_cv_header_AppKit_AppKit_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_AppKit_AppKit_h" >&5
-$as_echo "$ac_cv_header_AppKit_AppKit_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking AppKit/AppKit.h usability" >&5
-$as_echo_n "checking AppKit/AppKit.h usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <AppKit/AppKit.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking AppKit/AppKit.h presence" >&5
-$as_echo_n "checking AppKit/AppKit.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <AppKit/AppKit.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: AppKit/AppKit.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: AppKit/AppKit.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: AppKit/AppKit.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: AppKit/AppKit.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: AppKit/AppKit.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: AppKit/AppKit.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: AppKit/AppKit.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: AppKit/AppKit.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: AppKit/AppKit.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: AppKit/AppKit.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: AppKit/AppKit.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: AppKit/AppKit.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: AppKit/AppKit.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: AppKit/AppKit.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: AppKit/AppKit.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: AppKit/AppKit.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for AppKit/AppKit.h" >&5
-$as_echo_n "checking for AppKit/AppKit.h... " >&6; }
-if test "${ac_cv_header_AppKit_AppKit_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_AppKit_AppKit_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_AppKit_AppKit_h" >&5
-$as_echo "$ac_cv_header_AppKit_AppKit_h" >&6; }
-
-fi
-if test $ac_cv_header_AppKit_AppKit_h = yes; then
-  HAVE_NS=yes
-else
-  { { $as_echo "$as_me:$LINENO: error: \`--with-ns' was specified, but the include
-  files are missing or cannot be compiled." >&5
-$as_echo "$as_me: error: \`--with-ns' was specified, but the include
-  files are missing or cannot be compiled." >&2;}
-   { (exit 1); exit 1; }; }
-fi
-
-
-  NS_HAVE_NSINTEGER=yes
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <Foundation/NSObjCRuntime.h>
-int
-main ()
-{
-NSInteger i;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ns_have_nsinteger=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       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
-  fi
-fi
-if test "${HAVE_NS}" = yes; then
-  window_system=nextstep
-  with_xft=no
-  # set up packaging dirs
-  exec_prefix=${ns_appbindir}
-  libexecdir=${ns_appbindir}/libexec
-  if test "${EN_NS_SELF_CONTAINED}" = yes; then
-     prefix=${ns_appresdir}
-  fi
-fi
-CFLAGS="$tmp_CFLAGS"
-CPPFLAGS="$tmp_CPPFLAGS"
-
-case "${window_system}" in
-  x11 )
-    HAVE_X_WINDOWS=yes
-    HAVE_X11=yes
-    case "${with_x_toolkit}" in
-      athena | lucid ) USE_X_TOOLKIT=LUCID ;;
-      motif ) USE_X_TOOLKIT=MOTIF ;;
-      gtk ) with_gtk=yes
-            USE_X_TOOLKIT=none ;;
-      no ) USE_X_TOOLKIT=none ;;
-      * ) USE_X_TOOLKIT=maybe ;;
-    esac
-  ;;
-  nextstep | none )
-    HAVE_X_WINDOWS=no
-    HAVE_X11=no
-    USE_X_TOOLKIT=none
-  ;;
-esac
-
-if test "$window_system" = none && test "X$with_x" != "Xno"; then
-   # Extract the first word of "X", so it can be a program name with args.
-set dummy X; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_HAVE_XSERVER+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$HAVE_XSERVER"; then
-  ac_cv_prog_HAVE_XSERVER="$HAVE_XSERVER" # 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_HAVE_XSERVER="true"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-  test -z "$ac_cv_prog_HAVE_XSERVER" && ac_cv_prog_HAVE_XSERVER="false"
-fi
-fi
-HAVE_XSERVER=$ac_cv_prog_HAVE_XSERVER
-if test -n "$HAVE_XSERVER"; then
-  { $as_echo "$as_me:$LINENO: result: $HAVE_XSERVER" >&5
-$as_echo "$HAVE_XSERVER" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-   if test "$HAVE_XSERVER" = true ||
-      test -n "$DISPLAY" ||
-      test "`echo /usr/lib/libX11.*`" != "/usr/lib/libX11.*"; then
-        { { $as_echo "$as_me:$LINENO: error: You seem to be running X, but no X development libraries
-were found.  You should install the relevant development files for X
-and for the toolkit you want, such as Gtk+, Lesstif or Motif.  Also make
-sure you have development files for image handling, i.e.
-tiff, gif, jpeg, png and xpm.
-If you are sure you want Emacs compiled without X window support, pass
-  --without-x
-to configure." >&5
-$as_echo "$as_me: error: You seem to be running X, but no X development libraries
-were found.  You should install the relevant development files for X
-and for the toolkit you want, such as Gtk+, Lesstif or Motif.  Also make
-sure you have development files for image handling, i.e.
-tiff, gif, jpeg, png and xpm.
-If you are sure you want Emacs compiled without X window support, pass
-  --without-x
-to configure." >&2;}
-   { (exit 1); exit 1; }; }
-   fi
-fi
-
-### If we're using X11, we should use the X menu package.
-HAVE_MENUS=no
-case ${HAVE_X11} in
-  yes ) HAVE_MENUS=yes ;;
-esac
-
-# Do the opsystem or machine files prohibit the use of the GNU malloc?
-# Assume not, until told otherwise.
-GNU_MALLOC=yes
-doug_lea_malloc=yes
-{ $as_echo "$as_me:$LINENO: checking for malloc_get_state" >&5
-$as_echo_n "checking for malloc_get_state... " >&6; }
-if test "${ac_cv_func_malloc_get_state+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define malloc_get_state to an innocuous variant, in case <limits.h> declares malloc_get_state.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define malloc_get_state innocuous_malloc_get_state
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char malloc_get_state (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef malloc_get_state
-
-/* 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 malloc_get_state ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_malloc_get_state || defined __stub___malloc_get_state
-choke me
-#endif
-
-int
-main ()
-{
-return malloc_get_state ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_func_malloc_get_state=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_func_malloc_get_state=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_malloc_get_state" >&5
-$as_echo "$ac_cv_func_malloc_get_state" >&6; }
-if test $ac_cv_func_malloc_get_state = yes; then
-  :
-else
-  doug_lea_malloc=no
-fi
-
-{ $as_echo "$as_me:$LINENO: checking for malloc_set_state" >&5
-$as_echo_n "checking for malloc_set_state... " >&6; }
-if test "${ac_cv_func_malloc_set_state+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define malloc_set_state to an innocuous variant, in case <limits.h> declares malloc_set_state.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define malloc_set_state innocuous_malloc_set_state
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char malloc_set_state (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef malloc_set_state
-
-/* 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 malloc_set_state ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_malloc_set_state || defined __stub___malloc_set_state
-choke me
-#endif
-
-int
-main ()
-{
-return malloc_set_state ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_func_malloc_set_state=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_func_malloc_set_state=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_malloc_set_state" >&5
-$as_echo "$ac_cv_func_malloc_set_state" >&6; }
-if test $ac_cv_func_malloc_set_state = yes; then
-  :
-else
-  doug_lea_malloc=no
-fi
-
-{ $as_echo "$as_me:$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_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-extern void (* __after_morecore_hook)();
-int
-main ()
-{
-__after_morecore_hook = 0
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  emacs_cv_var___after_morecore_hook=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       emacs_cv_var___after_morecore_hook=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$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
-if test "${system_malloc}" = "yes"; then
-  GNU_MALLOC=no
-  GNU_MALLOC_reason="
-    (The GNU allocators don't work with this system configuration.)"
-fi
-if test "$doug_lea_malloc" = "yes" ; then
-  if test "$GNU_MALLOC" = yes ; then
-    GNU_MALLOC_reason="
-      (Using Doug Lea's new malloc from the GNU C Library.)"
-  fi
-
-cat >>confdefs.h <<\_ACEOF
-#define DOUG_LEA_MALLOC 1
-_ACEOF
-
-fi
-
-if test x"${REL_ALLOC}" = x; then
-  REL_ALLOC=${GNU_MALLOC}
-fi
-
-
-
-
-for ac_header in stdlib.h unistd.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-if test `eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-for ac_func in getpagesize
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* 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 $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_var=no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if test `eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-{ $as_echo "$as_me:$LINENO: checking for working mmap" >&5
-$as_echo_n "checking for working mmap... " >&6; }
-if test "${ac_cv_func_mmap_fixed_mapped+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test "$cross_compiling" = yes; then
-  ac_cv_func_mmap_fixed_mapped=no
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-/* malloc might have been renamed as rpl_malloc. */
-#undef malloc
-
-/* Thanks to Mike Haertel and Jim Avera for this test.
-   Here is a matrix of mmap possibilities:
-       mmap private not fixed
-       mmap private fixed at somewhere currently unmapped
-       mmap private fixed at somewhere already mapped
-       mmap shared not fixed
-       mmap shared fixed at somewhere currently unmapped
-       mmap shared fixed at somewhere already mapped
-   For private mappings, we should verify that changes cannot be read()
-   back from the file, nor mmap's back from the file at a different
-   address.  (There have been systems where private was not correctly
-   implemented like the infamous i386 svr4.0, and systems where the
-   VM page cache was not coherent with the file system buffer cache
-   like early versions of FreeBSD and possibly contemporary NetBSD.)
-   For shared mappings, we should conversely verify that changes get
-   propagated back to all the places they're supposed to be.
-
-   Grep wants private fixed already mapped.
-   The main things grep needs to know about mmap are:
-   * does it exist and is it safe to write into the mmap'd area
-   * how to use it (BSD variants)  */
-
-#include <fcntl.h>
-#include <sys/mman.h>
-
-#if !defined STDC_HEADERS && !defined HAVE_STDLIB_H
-char *malloc ();
-#endif
-
-/* This mess was copied from the GNU getpagesize.h.  */
-#ifndef HAVE_GETPAGESIZE
-/* Assume that all systems that can run configure have sys/param.h.  */
-# ifndef HAVE_SYS_PARAM_H
-#  define HAVE_SYS_PARAM_H 1
-# endif
-
-# ifdef _SC_PAGESIZE
-#  define getpagesize() sysconf(_SC_PAGESIZE)
-# else /* no _SC_PAGESIZE */
-#  ifdef HAVE_SYS_PARAM_H
-#   include <sys/param.h>
-#   ifdef EXEC_PAGESIZE
-#    define getpagesize() EXEC_PAGESIZE
-#   else /* no EXEC_PAGESIZE */
-#    ifdef NBPG
-#     define getpagesize() NBPG * CLSIZE
-#     ifndef CLSIZE
-#      define CLSIZE 1
-#     endif /* no CLSIZE */
-#    else /* no NBPG */
-#     ifdef NBPC
-#      define getpagesize() NBPC
-#     else /* no NBPC */
-#      ifdef PAGESIZE
-#       define getpagesize() PAGESIZE
-#      endif /* PAGESIZE */
-#     endif /* no NBPC */
-#    endif /* no NBPG */
-#   endif /* no EXEC_PAGESIZE */
-#  else /* no HAVE_SYS_PARAM_H */
-#   define getpagesize() 8192  /* punt totally */
-#  endif /* no HAVE_SYS_PARAM_H */
-# endif /* no _SC_PAGESIZE */
-
-#endif /* no HAVE_GETPAGESIZE */
-
-int
-main ()
-{
-  char *data, *data2, *data3;
-  int i, pagesize;
-  int fd;
-
-  pagesize = getpagesize ();
-
-  /* First, make a file with some known garbage in it. */
-  data = (char *) malloc (pagesize);
-  if (!data)
-    return 1;
-  for (i = 0; i < pagesize; ++i)
-    *(data + i) = rand ();
-  umask (0);
-  fd = creat ("conftest.mmap", 0600);
-  if (fd < 0)
-    return 1;
-  if (write (fd, data, pagesize) != pagesize)
-    return 1;
-  close (fd);
-
-  /* Next, try to mmap the file at a fixed address which already has
-     something else allocated at it.  If we can, also make sure that
-     we see the same garbage.  */
-  fd = open ("conftest.mmap", O_RDWR);
-  if (fd < 0)
-    return 1;
-  data2 = (char *) malloc (2 * pagesize);
-  if (!data2)
-    return 1;
-  data2 += (pagesize - ((long int) data2 & (pagesize - 1))) & (pagesize - 1);
-  if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE,
-                    MAP_PRIVATE | MAP_FIXED, fd, 0L))
-    return 1;
-  for (i = 0; i < pagesize; ++i)
-    if (*(data + i) != *(data2 + i))
-      return 1;
-
-  /* Finally, make sure that changes to the mapped area do not
-     percolate back to the file as seen by read().  (This is a bug on
-     some variants of i386 svr4.0.)  */
-  for (i = 0; i < pagesize; ++i)
-    *(data2 + i) = *(data2 + i) + 1;
-  data3 = (char *) malloc (pagesize);
-  if (!data3)
-    return 1;
-  if (read (fd, data3, pagesize) != pagesize)
-    return 1;
-  for (i = 0; i < pagesize; ++i)
-    if (*(data + i) != *(data3 + i))
-      return 1;
-  close (fd);
-  return 0;
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_func_mmap_fixed_mapped=yes
-else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-ac_cv_func_mmap_fixed_mapped=no
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_mmap_fixed_mapped" >&5
-$as_echo "$ac_cv_func_mmap_fixed_mapped" >&6; }
-if test $ac_cv_func_mmap_fixed_mapped = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_MMAP 1
-_ACEOF
-
-fi
-rm -f conftest.mmap
-
-if test $use_mmap_for_buffers = yes; then
-  REL_ALLOC=no
-fi
-
-LIBS="$libsrc_libs $LIBS"
-
-
-{ $as_echo "$as_me:$LINENO: checking for dnet_ntoa in -ldnet" >&5
-$as_echo_n "checking for dnet_ntoa in -ldnet... " >&6; }
-if test "${ac_cv_lib_dnet_dnet_ntoa+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldnet  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* 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 dnet_ntoa ();
-int
-main ()
-{
-return dnet_ntoa ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_dnet_dnet_ntoa=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_lib_dnet_dnet_ntoa=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dnet_dnet_ntoa" >&5
-$as_echo "$ac_cv_lib_dnet_dnet_ntoa" >&6; }
-if test $ac_cv_lib_dnet_dnet_ntoa = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBDNET 1
-_ACEOF
-
-  LIBS="-ldnet $LIBS"
-
-fi
-
-
-{ $as_echo "$as_me:$LINENO: checking for main in -lXbsd" >&5
-$as_echo_n "checking for main in -lXbsd... " >&6; }
-if test "${ac_cv_lib_Xbsd_main+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lXbsd  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-
-int
-main ()
-{
-return main ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_Xbsd_main=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_lib_Xbsd_main=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_Xbsd_main" >&5
-$as_echo "$ac_cv_lib_Xbsd_main" >&6; }
-if test $ac_cv_lib_Xbsd_main = yes; then
-  LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE -lXbsd"
-fi
-
-
-
-{ $as_echo "$as_me:$LINENO: checking for cma_open in -lpthreads" >&5
-$as_echo_n "checking for cma_open in -lpthreads... " >&6; }
-if test "${ac_cv_lib_pthreads_cma_open+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpthreads  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* 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 cma_open ();
-int
-main ()
-{
-return cma_open ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_pthreads_cma_open=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_lib_pthreads_cma_open=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_pthreads_cma_open" >&5
-$as_echo "$ac_cv_lib_pthreads_cma_open" >&6; }
-if test $ac_cv_lib_pthreads_cma_open = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBPTHREADS 1
-_ACEOF
-
-  LIBS="-lpthreads $LIBS"
-
-fi
-
-
-
-case ${host_os} in
-aix*)
-  { $as_echo "$as_me:$LINENO: checking for -bbigtoc option" >&5
-$as_echo_n "checking for -bbigtoc option... " >&6; }
-if test "${gdb_cv_bigtoc+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-
-    case $GCC in
-    yes) gdb_cv_bigtoc=-Wl,-bbigtoc ;;
-    *) gdb_cv_bigtoc=-bbigtoc ;;
-    esac
-
-    LDFLAGS=$LDFLAGS\ $gdb_cv_bigtoc
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-int i;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  :
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       gdb_cv_bigtoc=
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $gdb_cv_bigtoc" >&5
-$as_echo "$gdb_cv_bigtoc" >&6; }
-  ;;
-esac
-
-# Change CFLAGS and CPPFLAGS temporarily so that C_SWITCH_X_SITE gets
-# used for the tests that follow.  We set them back to REAL_CFLAGS and
-# REAL_CPPFLAGS later on.
-
-REAL_CPPFLAGS="$CPPFLAGS"
-
-if test "${HAVE_X11}" = "yes"; then
-  DEFS="$C_SWITCH_X_SITE $DEFS"
-  LDFLAGS="$LDFLAGS $LD_SWITCH_X_SITE"
-  LIBS="$LIBX $LIBS"
-  CFLAGS="$C_SWITCH_X_SITE $CFLAGS"
-  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.
-  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
-  fi
-
-  if test "${opsys}" = "gnu-linux"; then
-    { $as_echo "$as_me:$LINENO: checking whether X on GNU/Linux needs -b to link" >&5
-$as_echo_n "checking whether X on GNU/Linux needs -b to link... " >&6; }
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-XOpenDisplay ("foo");
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  xlinux_first_failure=no
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       xlinux_first_failure=yes
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-    if test "${xlinux_first_failure}" = "yes"; then
-      OLD_LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE"
-      OLD_C_SWITCH_X_SITE="$C_SWITCH_X_SITE"
-      OLD_CPPFLAGS="$CPPFLAGS"
-      OLD_LIBS="$LIBS"
-      LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE -b i486-linuxaout"
-      C_SWITCH_X_SITE="$C_SWITCH_X_SITE -b i486-linuxaout"
-      CPPFLAGS="$CPPFLAGS -b i486-linuxaout"
-      LIBS="$LIBS -b i486-linuxaout"
-      cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-XOpenDisplay ("foo");
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  xlinux_second_failure=no
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       xlinux_second_failure=yes
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-      if test "${xlinux_second_failure}" = "yes"; then
-       # If we get the same failure with -b, there is no use adding -b.
-       # So take it out.  This plays safe.
-       LD_SWITCH_X_SITE="$OLD_LD_SWITCH_X_SITE"
-       C_SWITCH_X_SITE="$OLD_C_SWITCH_X_SITE"
-       CPPFLAGS="$OLD_CPPFLAGS"
-       LIBS="$OLD_LIBS"
-        { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-      else
-        { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-      fi
-    else
-      { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-    fi
-  fi
-
-  # Reportedly, some broken Solaris systems have XKBlib.h but are missing
-  # header files included from there.
-  { $as_echo "$as_me:$LINENO: checking for Xkb" >&5
-$as_echo_n "checking for Xkb... " >&6; }
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <X11/Xlib.h>
-#include <X11/XKBlib.h>
-int
-main ()
-{
-XkbDescPtr kb = XkbGetKeyboard (0, XkbAllComponentsMask, XkbUseCoreKbd);
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  emacs_xkb=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       emacs_xkb=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-  { $as_echo "$as_me:$LINENO: result: $emacs_xkb" >&5
-$as_echo "$emacs_xkb" >&6; }
-  if test $emacs_xkb = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_XKBGETKEYBOARD 1
-_ACEOF
-
-  fi
-
-
-
-
-
-for ac_func in XrmSetDatabase XScreenResourceString \
-XScreenNumberOfScreen XSetWMProtocols
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* 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 $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_var=no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if test `eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-fi
-
-if test "${window_system}" = "x11"; then
-  { $as_echo "$as_me:$LINENO: checking X11 version 6" >&5
-$as_echo_n "checking X11 version 6... " >&6; }
-  if test "${emacs_cv_x11_version_6+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <X11/Xlib.h>
-int
-main ()
-{
-#if XlibSpecificationRelease < 6
-fail;
-#endif
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  emacs_cv_x11_version_6=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       emacs_cv_x11_version_6=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-
-  if test $emacs_cv_x11_version_6 = yes; then
-    { $as_echo "$as_me:$LINENO: result: 6 or newer" >&5
-$as_echo "6 or newer" >&6; }
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_X11R6 1
-_ACEOF
-
-  else
-    { $as_echo "$as_me:$LINENO: result: before 6" >&5
-$as_echo "before 6" >&6; }
-  fi
-fi
-
-
-### Use -lrsvg-2 if available, unless `--with-rsvg=no' is specified.
-HAVE_RSVG=no
-if test "${HAVE_X11}" = "yes" || test "${NS_IMPL_GNUSTEP}" = "yes"; then
-  if test "${with_rsvg}" != "no"; then
-    RSVG_REQUIRED=2.11.0
-    RSVG_MODULE="librsvg-2.0 >= $RSVG_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:$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:$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:$LINENO: result: $PKG_CONFIG" >&5
-$as_echo "$PKG_CONFIG" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-
-  if test "$PKG_CONFIG" = "no" ; then
-     :
-  else
-     PKG_CONFIG_MIN_VERSION=0.9.0
-     if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
-        { $as_echo "$as_me:$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:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-            succeeded=yes
-
-            { $as_echo "$as_me:$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:$LINENO: result: $RSVG_CFLAGS" >&5
-$as_echo "$RSVG_CFLAGS" >&6; }
-
-            { $as_echo "$as_me:$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:$LINENO: result: $RSVG_LIBS" >&5
-$as_echo "$RSVG_LIBS" >&6; }
-        else
-            { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-            RSVG_CFLAGS=""
-            RSVG_LIBS=""
-            ## If we have a custom action on failure, don't print errors, but
-            ## do set a variable so people can do so.
-            RSVG_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$RSVG_MODULE"`
-
-        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
-     :
-  fi
-
-
-
-
-    if test ".${RSVG_CFLAGS}" != "."; then
-      HAVE_RSVG=yes
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_RSVG 1
-_ACEOF
-
-      CFLAGS="$CFLAGS $RSVG_CFLAGS"
-      LIBS="$RSVG_LIBS $LIBS"
-    fi
-  fi
-fi
-
-
-HAVE_GTK=no
-if test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "maybe"; then
-  GLIB_REQUIRED=2.6
-  GTK_REQUIRED=2.6
-  GTK_MODULES="gtk+-2.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:$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:$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:$LINENO: result: $PKG_CONFIG" >&5
-$as_echo "$PKG_CONFIG" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-
-  if test "$PKG_CONFIG" = "no" ; then
-     pkg_check_gtk=no
-  else
-     PKG_CONFIG_MIN_VERSION=0.9.0
-     if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
-        { $as_echo "$as_me:$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:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-            succeeded=yes
-
-            { $as_echo "$as_me:$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:$LINENO: result: $GTK_CFLAGS" >&5
-$as_echo "$GTK_CFLAGS" >&6; }
-
-            { $as_echo "$as_me:$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:$LINENO: result: $GTK_LIBS" >&5
-$as_echo "$GTK_LIBS" >&6; }
-        else
-            { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-            GTK_CFLAGS=""
-            GTK_LIBS=""
-            ## If we have a custom action on failure, don't print errors, but
-            ## do set a variable so people can do so.
-            GTK_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$GTK_MODULES"`
-
-        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
-     pkg_check_gtk=yes
-  else
-     pkg_check_gtk=no
-  fi
-
-  if test "$pkg_check_gtk" = "no" && test "$USE_X_TOOLKIT" != "maybe"; then
-     { { $as_echo "$as_me:$LINENO: error: $GTK_PKG_ERRORS" >&5
-$as_echo "$as_me: error: $GTK_PKG_ERRORS" >&2;}
-   { (exit 1); exit 1; }; }
-  fi
-fi
-
-
-if test x"$pkg_check_gtk" = xyes; then
-
-
-
-  C_SWITCH_X_SITE="$C_SWITCH_X_SITE $GTK_CFLAGS"
-  CFLAGS="$CFLAGS $GTK_CFLAGS"
-  LIBS="$GTK_LIBS $LIBS"
-    GTK_COMPILES=no
-
-for ac_func in gtk_main
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* 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 $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_var=no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if test `eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
- GTK_COMPILES=yes
-fi
-done
-
-  if test "${GTK_COMPILES}" != "yes"; then
-    if test "$USE_X_TOOLKIT" != "maybe"; then
-      { { $as_echo "$as_me:$LINENO: error: Gtk+ wanted, but it does not compile, see config.log.  Maybe some x11-devel files missing?" >&5
-$as_echo "$as_me: error: Gtk+ wanted, but it does not compile, see config.log.  Maybe some x11-devel files missing?" >&2;}
-   { (exit 1); exit 1; }; };
-    fi
-  else
-    HAVE_GTK=yes
-
-cat >>confdefs.h <<\_ACEOF
-#define USE_GTK 1
-_ACEOF
-
-    USE_X_TOOLKIT=none
-    if $PKG_CONFIG --atleast-version=2.10 gtk+-2.0; then
-      :
-    else
-      { $as_echo "$as_me:$LINENO: WARNING: Your version of Gtk+ will have problems with
-       closing open displays.  This is no problem if you just use
-       one display, but if you use more than one and close one of them
-       Emacs may crash." >&5
-$as_echo "$as_me: WARNING: Your version of Gtk+ will have problems with
-       closing open displays.  This is no problem if you just use
-       one display, but if you use more than one and close one of them
-       Emacs may crash." >&2;}
-      sleep 3
-    fi
-  fi
-
-fi
-
-
-if test "${HAVE_GTK}" = "yes"; then
-
-      if test "$with_toolkit_scroll_bars" != no; then
-    with_toolkit_scroll_bars=yes
-  fi
-
-      HAVE_GTK_MULTIDISPLAY=no
-
-for ac_func in gdk_display_open
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* 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 $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_var=no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if test `eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
- HAVE_GTK_MULTIDISPLAY=yes
-fi
-done
-
-  if test "${HAVE_GTK_MULTIDISPLAY}" = "yes"; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_GTK_MULTIDISPLAY 1
-_ACEOF
-
-  fi
-
-          HAVE_GTK_FILE_SELECTION=no
-  { $as_echo "$as_me:$LINENO: checking whether GTK_TYPE_FILE_SELECTION is declared" >&5
-$as_echo_n "checking whether GTK_TYPE_FILE_SELECTION is declared... " >&6; }
-if test "${ac_cv_have_decl_GTK_TYPE_FILE_SELECTION+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <gtk/gtk.h>
-
-int
-main ()
-{
-#ifndef GTK_TYPE_FILE_SELECTION
-  (void) GTK_TYPE_FILE_SELECTION;
-#endif
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_have_decl_GTK_TYPE_FILE_SELECTION=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_have_decl_GTK_TYPE_FILE_SELECTION=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_GTK_TYPE_FILE_SELECTION" >&5
-$as_echo "$ac_cv_have_decl_GTK_TYPE_FILE_SELECTION" >&6; }
-if test $ac_cv_have_decl_GTK_TYPE_FILE_SELECTION = yes; then
-  HAVE_GTK_FILE_SELECTION=yes
-else
-  HAVE_GTK_FILE_SELECTION=no
-fi
-
-  if test "$HAVE_GTK_FILE_SELECTION" = yes; then
-
-for ac_func in gtk_file_selection_new
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* 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 $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_var=no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if test `eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
- HAVE_GTK_FILE_SELECTION=yes
-else
-  HAVE_GTK_FILE_SELECTION=no
-fi
-done
-
-  fi
-
-    HAVE_GTK_FILE_CHOOSER=no
-  { $as_echo "$as_me:$LINENO: checking whether GTK_TYPE_FILE_CHOOSER is declared" >&5
-$as_echo_n "checking whether GTK_TYPE_FILE_CHOOSER is declared... " >&6; }
-if test "${ac_cv_have_decl_GTK_TYPE_FILE_CHOOSER+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <gtk/gtk.h>
-
-int
-main ()
-{
-#ifndef GTK_TYPE_FILE_CHOOSER
-  (void) GTK_TYPE_FILE_CHOOSER;
-#endif
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_have_decl_GTK_TYPE_FILE_CHOOSER=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_have_decl_GTK_TYPE_FILE_CHOOSER=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_GTK_TYPE_FILE_CHOOSER" >&5
-$as_echo "$ac_cv_have_decl_GTK_TYPE_FILE_CHOOSER" >&6; }
-if test $ac_cv_have_decl_GTK_TYPE_FILE_CHOOSER = yes; then
-  HAVE_GTK_FILE_CHOOSER=yes
-else
-  HAVE_GTK_FILE_CHOOSER=no
-fi
-
-  if test "$HAVE_GTK_FILE_CHOOSER" = yes; then
-
-for ac_func in gtk_file_chooser_dialog_new
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* 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 $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_var=no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if test `eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
- HAVE_GTK_FILE_CHOOSER=yes
-else
-  HAVE_GTK_FILE_CHOOSER=no
-fi
-done
-
-  fi
-
-  if test "$HAVE_GTK_FILE_SELECTION" = yes \
-     && test "$HAVE_GTK_FILE_CHOOSER" = yes;  then
+if test $unported = yes; then
+  as_fn_error "Emacs hasn't been ported to \`${canonical}' systems.
+Check \`etc/MACHINES' for recognized configuration names." "$LINENO" 5
+fi
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_GTK_FILE_BOTH 1
-_ACEOF
+machfile="m/${machine}.h"
+opsysfile="s/${opsys}.h"
 
-  fi
 
-      if test "$HAVE_GTK_FILE_CHOOSER" = yes; then
-    HAVE_GTK_AND_PTHREAD=no
+#### Choose a compiler.
+test -n "$CC" && cc_specified=yes
+
+# Save the value of CFLAGS that the user specified.
+SPECIFIED_CFLAGS="$CFLAGS"
 
-for ac_header in pthread.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+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
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; 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_CC+set}" = set; then :
   $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
 else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+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_CC="${ac_tool_prefix}gcc"
+    $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_header_compiler=no
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
 
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; 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_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # 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_CC="gcc"
+    $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_header_preproc=no
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-
-    ;;
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  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
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
+    CC=$ac_ct_CC
+  fi
 else
-  eval "$as_ac_Header=\$ac_header_preproc"
+  CC="$ac_cv_prog_CC"
 fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
 
-fi
-if test `eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
+if test -z "$CC"; then
+          if test -n "$ac_tool_prefix"; then
+    # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; 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_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # 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_CC="${ac_tool_prefix}cc"
+    $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
 
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
-done
 
-    if test "$ac_cv_header_pthread_h"; then
-      { $as_echo "$as_me:$LINENO: checking for pthread_self in -lpthread" >&5
-$as_echo_n "checking for pthread_self in -lpthread... " >&6; }
-if test "${ac_cv_lib_pthread_pthread_self+set}" = set; then
+  fi
+fi
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; 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_CC+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpthread  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  ac_prog_rejected=no
+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
+    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+       ac_prog_rejected=yes
+       continue
+     fi
+    ac_cv_prog_CC="cc"
+    $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
 
-/* 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 pthread_self ();
-int
-main ()
-{
-return pthread_self ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_pthread_pthread_self=yes
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# != 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+  fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  for ac_prog in cl.exe
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; 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_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # 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_CC="$ac_tool_prefix$ac_prog"
+    $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_cv_lib_pthread_pthread_self=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_self" >&5
-$as_echo "$ac_cv_lib_pthread_pthread_self" >&6; }
-if test $ac_cv_lib_pthread_pthread_self = yes; then
-  HAVE_GTK_AND_PTHREAD=yes
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
-    fi
-    if test "$HAVE_GTK_AND_PTHREAD" = yes; then
-      case "${canonical}" in
-        *-hpux*) ;;
-        *) GTK_LIBS="$GTK_LIBS -lpthread" ;;
-      esac
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_GTK_AND_PTHREAD 1
-_ACEOF
 
-    fi
-  fi
+    test -n "$CC" && break
+  done
 fi
-
-HAVE_DBUS=no
-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:$LINENO: checking for $ac_word" >&5
+if test -z "$CC"; then
+  ac_ct_CC=$CC
+  for ac_prog in cl.exe
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; 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 "${ac_cv_prog_ac_ct_CC+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
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # 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
+    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:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    ac_cv_prog_ac_ct_CC="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-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:$LINENO: result: $PKG_CONFIG" >&5
-$as_echo "$PKG_CONFIG" >&6; }
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
+  test -n "$ac_ct_CC" && break
+done
 
-  if test "$PKG_CONFIG" = "no" ; then
-     HAVE_DBUS=no
+  if test "x$ac_ct_CC" = x; then
+    CC=""
   else
-     PKG_CONFIG_MIN_VERSION=0.9.0
-     if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
-        { $as_echo "$as_me:$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:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-            succeeded=yes
-
-            { $as_echo "$as_me:$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:$LINENO: result: $DBUS_CFLAGS" >&5
-$as_echo "$DBUS_CFLAGS" >&6; }
-
-            { $as_echo "$as_me:$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:$LINENO: result: $DBUS_LIBS" >&5
-$as_echo "$DBUS_LIBS" >&6; }
-        else
-            { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-            DBUS_CFLAGS=""
-            DBUS_LIBS=""
-            ## If we have a custom action on failure, don't print errors, but
-            ## do set a variable so people can do so.
-            DBUS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "dbus-1 >= 1.0"`
+    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
+    CC=$ac_ct_CC
+  fi
+fi
 
-        fi
+fi
 
 
+test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error "no acceptable C compiler found in \$PATH
+See \`config.log' for more details." "$LINENO" 5; }
 
-     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
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+  { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    sed '10a\
+... rest of stderr output deleted ...
+         10q' conftest.err >conftest.er1
+    cat conftest.er1 >&5
   fi
+  rm -f conftest.er1 conftest.err
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+done
 
-  if test $succeeded = yes; then
-     HAVE_DBUS=yes
-  else
-     HAVE_DBUS=no
-  fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-   if test "$HAVE_DBUS" = yes; then
-     LIBS="$LIBS $DBUS_LIBS"
+int
+main ()
+{
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_DBUS 1
+  ;
+  return 0;
+}
 _ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
+$as_echo_n "checking whether the C compiler works... " >&6; }
+ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
 
+# The possible output files:
+ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
 
-for ac_func in dbus_watch_get_unix_fd
+ac_rmfiles=
+for ac_file in $ac_files
 do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+    * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+  esac
+done
+rm -f $ac_rmfiles
 
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
+if { { ac_try="$ac_link_default"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link_default") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
+  # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile.  We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files ''
+do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
+       ;;
+    [ab].out )
+       # We found the default executable, but exeext='' is most
+       # certainly right.
+       break;;
+    *.* )
+       if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+       then :; else
+          ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+       fi
+       # We set ac_cv_exeext here because the later test for it is not
+       # safe: cross compilers may not add the suffix if given an `-o'
+       # argument, so we may need to know it at that point already.
+       # Even if this section looks crufty: it has the advantage of
+       # actually working.
+       break;;
+    * )
+       break;;
+  esac
+done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
 
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
+else
+  ac_file=''
+fi
+if test -z "$ac_file"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
 
-#undef $ac_func
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ as_fn_set_status 77
+as_fn_error "C compiler cannot create executables
+See \`config.log' for more details." "$LINENO" 5; }; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
+$as_echo_n "checking for C compiler default output file name... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
+$as_echo "$ac_file" >&6; }
+ac_exeext=$ac_cv_exeext
 
-/* 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 $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
+rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
+$as_echo_n "checking for suffix of executables... " >&6; }
+if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
+  # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+    *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+         break;;
+    * ) break;;
+  esac
+done
+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 "cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." "$LINENO" 5; }
+fi
+rm -f conftest conftest$ac_cv_exeext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
+$as_echo "$ac_cv_exeext" >&6; }
 
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdio.h>
 int
 main ()
 {
-return $ac_func ();
+FILE *f = fopen ("conftest.out", "w");
+ return ferror (f) || fclose (f) != 0;
+
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
+ac_clean_files="$ac_clean_files conftest.out"
+# Check that the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
+$as_echo_n "checking whether we are cross compiling... " >&6; }
+if test "$cross_compiling" != yes; then
+  { { ac_try="$ac_link"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
   ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_var=no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if test `eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-   fi
-fi
-
-HAVE_GCONF=no
-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:$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:$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"
-  ;;
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+  if { ac_try='./conftest$ac_cv_exeext'
+  { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
 esac
-fi
-PKG_CONFIG=$ac_cv_path_PKG_CONFIG
-if test -n "$PKG_CONFIG"; then
-  { $as_echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5
-$as_echo "$PKG_CONFIG" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-
-  if test "$PKG_CONFIG" = "no" ; then
-     HAVE_GCONF=no
-  else
-     PKG_CONFIG_MIN_VERSION=0.9.0
-     if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
-        { $as_echo "$as_me:$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:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-            succeeded=yes
-
-            { $as_echo "$as_me:$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:$LINENO: result: $GCONF_CFLAGS" >&5
-$as_echo "$GCONF_CFLAGS" >&6; }
-
-            { $as_echo "$as_me:$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:$LINENO: result: $GCONF_LIBS" >&5
-$as_echo "$GCONF_LIBS" >&6; }
-        else
-            { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-            GCONF_CFLAGS=""
-            GCONF_LIBS=""
-            ## If we have a custom action on failure, don't print errors, but
-            ## do set a variable so people can do so.
-            GCONF_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "gconf-2.0 >= 2.13"`
-
-        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_GCONF=yes
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then
+    cross_compiling=no
   else
-     HAVE_GCONF=no
+    if test "$cross_compiling" = maybe; then
+       cross_compiling=yes
+    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 "cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." "$LINENO" 5; }
+    fi
   fi
-
-   if test "$HAVE_GCONF" = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_GCONF 1
-_ACEOF
-
-   fi
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
+$as_echo "$cross_compiling" >&6; }
 
-HAVE_XAW3D=no
-if test x"${USE_X_TOOLKIT}" = xmaybe || test x"${USE_X_TOOLKIT}" = xLUCID; then
-  if test "$with_xaw3d" != no; then
-    { $as_echo "$as_me:$LINENO: checking for xaw3d" >&5
-$as_echo_n "checking for xaw3d... " >&6; }
-    if test "${emacs_cv_xaw3d+set}" = set; then
+rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
+$as_echo_n "checking for suffix of object files... " >&6; }
+if test "${ac_cv_objext+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-#include <X11/Intrinsic.h>
-#include <X11/Xaw3d/Simple.h>
 int
 main ()
 {
@@ -12718,2658 +4006,1984 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
+rm -f conftest.o conftest.obj
+if { { ac_try="$ac_compile"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compile") 2>&5
   ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  emacs_cv_xaw3d=yes
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
+  for ac_file in conftest.o conftest.obj conftest.*; do
+  test -f "$ac_file" || continue;
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
+    *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+       break;;
+  esac
+done
 else
   $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-       emacs_cv_xaw3d=no
+{ { $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 compute suffix of object files: cannot compile
+See \`config.log' for more details." "$LINENO" 5; }
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
 fi
-
-  else
-    emacs_cv_xaw3d=no
-  fi
-  if test $emacs_cv_xaw3d = yes; then
-    { $as_echo "$as_me:$LINENO: result: yes; using Lucid toolkit" >&5
-$as_echo "yes; using Lucid toolkit" >&6; }
-    USE_X_TOOLKIT=LUCID
-    HAVE_XAW3D=yes
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_XAW3D 1
-_ACEOF
-
-  else
-    { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-    { $as_echo "$as_me:$LINENO: checking for libXaw" >&5
-$as_echo_n "checking for libXaw... " >&6; }
-    if test "${emacs_cv_xaw+set}" = set; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
+$as_echo "$ac_cv_objext" >&6; }
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
+$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
+if test "${ac_cv_c_compiler_gnu+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-#include <X11/Intrinsic.h>
-#include <X11/Xaw/Simple.h>
 int
 main ()
 {
+#ifndef __GNUC__
+       choke me
+#endif
 
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  emacs_cv_xaw=yes
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_compiler_gnu=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       emacs_cv_xaw=no
+  ac_compiler_gnu=no
 fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
 fi
-
-    if test $emacs_cv_xaw = yes; then
-      { $as_echo "$as_me:$LINENO: result: yes; using Lucid toolkit" >&5
-$as_echo "yes; using Lucid toolkit" >&6; }
-      USE_X_TOOLKIT=LUCID
-    elif test x"${USE_X_TOOLKIT}" = xLUCID; then
-      { { $as_echo "$as_me:$LINENO: error: Lucid toolkit requires X11/Xaw include files" >&5
-$as_echo "$as_me: error: Lucid toolkit requires X11/Xaw include files" >&2;}
-   { (exit 1); exit 1; }; }
-    else
-      { $as_echo "$as_me:$LINENO: result: no; do not use toolkit by default" >&5
-$as_echo "no; do not use toolkit by default" >&6; }
-      USE_X_TOOLKIT=none
-    fi
-  fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
+$as_echo "$ac_cv_c_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+  GCC=yes
+else
+  GCC=
 fi
-
-X_TOOLKIT_TYPE=$USE_X_TOOLKIT
-
-if test "${USE_X_TOOLKIT}" != "none"; then
-  { $as_echo "$as_me:$LINENO: checking X11 toolkit version" >&5
-$as_echo_n "checking X11 toolkit version... " >&6; }
-  if test "${emacs_cv_x11_toolkit_version_6+set}" = set; then
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
+$as_echo_n "checking whether $CC accepts -g... " >&6; }
+if test "${ac_cv_prog_cc_g+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  ac_save_c_werror_flag=$ac_c_werror_flag
+   ac_c_werror_flag=yes
+   ac_cv_prog_cc_g=no
+   CFLAGS="-g"
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <X11/Intrinsic.h>
+
 int
 main ()
 {
-#if XtSpecificationRelease < 6
-fail;
-#endif
 
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  emacs_cv_x11_toolkit_version_6=yes
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_g=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  CFLAGS=""
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-       emacs_cv_x11_toolkit_version_6=no
-fi
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
+else
+  ac_c_werror_flag=$ac_save_c_werror_flag
+        CFLAGS="-g"
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-  HAVE_X11XTR6=$emacs_cv_x11_toolkit_version_6
-  if test $emacs_cv_x11_toolkit_version_6 = yes; then
-    { $as_echo "$as_me:$LINENO: result: 6 or newer" >&5
-$as_echo "6 or newer" >&6; }
+int
+main ()
+{
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_X11XTR6 1
+  ;
+  return 0;
+}
 _ACEOF
-
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_g=yes
+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
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
+$as_echo "$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
+    CFLAGS="-g -O2"
   else
-    { $as_echo "$as_me:$LINENO: result: before 6" >&5
-$as_echo "before 6" >&6; }
+    CFLAGS="-g"
   fi
-
-  OLDLIBS="$LIBS"
-  if test x$HAVE_X11XTR6 = xyes; then
-    LIBS="-lXt -lSM -lICE $LIBS"
+else
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
   else
-    LIBS="-lXt $LIBS"
+    CFLAGS=
   fi
-
-{ $as_echo "$as_me:$LINENO: checking for XmuConvertStandardSelection in -lXmu" >&5
-$as_echo_n "checking for XmuConvertStandardSelection in -lXmu... " >&6; }
-if test "${ac_cv_lib_Xmu_XmuConvertStandardSelection+set}" = set; then
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
+$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
+if test "${ac_cv_prog_cc_c89+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lXmu  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+     char **p;
+     int i;
+{
+  return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+  char *s;
+  va_list v;
+  va_start (v,p);
+  s = g (p, va_arg (v,int));
+  va_end (v);
+  return s;
+}
 
-/* 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 XmuConvertStandardSelection ();
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
+   function prototypes and stuff, but not '\xHH' hex character constants.
+   These don't provoke an error unfortunately, instead are silently treated
+   as 'x'.  The following induces an error, until -std is added to get
+   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
+   array size at least.  It's necessary to write '\x00'==0 to get something
+   that's true only with -std.  */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+   inside strings and character constants.  */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
 int
 main ()
 {
-return XmuConvertStandardSelection ();
+return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_Xmu_XmuConvertStandardSelection=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+       -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+  CC="$ac_save_CC $ac_arg"
+  if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_c89=$ac_arg
+fi
+rm -f core conftest.err conftest.$ac_objext
+  test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
 
-       ac_cv_lib_Xmu_XmuConvertStandardSelection=no
 fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+  x)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+  xno)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+  *)
+    CC="$CC $ac_cv_prog_cc_c89"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+if test "x$ac_cv_prog_cc_c89" != xno; then :
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_Xmu_XmuConvertStandardSelection" >&5
-$as_echo "$ac_cv_lib_Xmu_XmuConvertStandardSelection" >&6; }
-if test $ac_cv_lib_Xmu_XmuConvertStandardSelection = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBXMU 1
-_ACEOF
 
-  LIBS="-lXmu $LIBS"
+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
 
-fi
 
-  test $ac_cv_lib_Xmu_XmuConvertStandardSelection = no && LIBS="$OLDLIBS"
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+  CPP=
 fi
 
-# On Irix 6.5, at least, we need XShapeQueryExtension from -lXext for Xaw3D.
-if test "${HAVE_X11}" = "yes"; then
-  if test "${USE_X_TOOLKIT}" != "none"; then
+## 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; }
 
-{ $as_echo "$as_me:$LINENO: checking for XShapeQueryExtension in -lXext" >&5
-$as_echo_n "checking for XShapeQueryExtension in -lXext... " >&6; }
-if test "${ac_cv_lib_Xext_XShapeQueryExtension+set}" = set; then
+if test "${emacs_cv_sunpro_c+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lXext  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  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 XShapeQueryExtension ();
 int
 main ()
 {
-return XShapeQueryExtension ();
+#ifndef __SUNPRO_C
+fail;
+#endif
+
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_Xext_XShapeQueryExtension=yes
+if ac_fn_c_try_link "$LINENO"; then :
+  emacs_cv_sunpro_c=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_lib_Xext_XShapeQueryExtension=no
+  emacs_cv_sunpro_c=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+  { $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
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_Xext_XShapeQueryExtension" >&5
-$as_echo "$ac_cv_lib_Xext_XShapeQueryExtension" >&6; }
-if test $ac_cv_lib_Xext_XShapeQueryExtension = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBXEXT 1
-_ACEOF
 
-  LIBS="-lXext $LIBS"
+#### 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
 
-  fi
+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
 
-if test "${USE_X_TOOLKIT}" = "MOTIF"; then
-  { $as_echo "$as_me:$LINENO: checking for Motif version 2.1" >&5
-$as_echo_n "checking for Motif version 2.1... " >&6; }
-if test "${emacs_cv_motif_version_2_1+set}" = set; then
+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 :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+      # 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.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <Xm/Xm.h>
-int
-main ()
-{
-#if XmVERSION > 2 || (XmVERSION == 2 && XmREVISION >= 1)
-int x = 5;
+#ifdef __STDC__
+# include <limits.h>
 #else
-Motif version prior to 2.1.
+# include <assert.h>
 #endif
-  ;
-  return 0;
-}
+                    Syntax error
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  emacs_cv_motif_version_2_1=yes
+if ac_fn_c_try_cpp "$LINENO"; then :
+
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
 
-       emacs_cv_motif_version_2_1=no
+  # 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>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  # Broken: success on invalid input.
+continue
+else
+  # Passes both tests.
+ac_preproc_ok=:
+break
 fi
+rm -f conftest.err conftest.$ac_ext
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+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
-{ $as_echo "$as_me:$LINENO: result: $emacs_cv_motif_version_2_1" >&5
-$as_echo "$emacs_cv_motif_version_2_1" >&6; }
-  HAVE_MOTIF_2_1=$emacs_cv_motif_version_2_1
-  if test $emacs_cv_motif_version_2_1 = yes; then
-    HAVE_LIBXP=no
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_MOTIF_2_1 1
-_ACEOF
+    done
+    ac_cv_prog_CPP=$CPP
 
-    { $as_echo "$as_me:$LINENO: checking for XpCreateContext in -lXp" >&5
-$as_echo_n "checking for XpCreateContext in -lXp... " >&6; }
-if test "${ac_cv_lib_Xp_XpCreateContext+set}" = set; then
-  $as_echo_n "(cached) " >&6
+fi
+  CPP=$ac_cv_prog_CPP
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lXp  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  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.
+  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"
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
 #endif
-char XpCreateContext ();
-int
-main ()
-{
-return XpCreateContext ();
-  ;
-  return 0;
-}
+                    Syntax error
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_Xp_XpCreateContext=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+if ac_fn_c_try_cpp "$LINENO"; then :
 
-       ac_cv_lib_Xp_XpCreateContext=no
+else
+  # Broken: fails on valid input.
+continue
 fi
+rm -f conftest.err conftest.$ac_ext
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+  # 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>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  # Broken: success on invalid input.
+continue
+else
+  # Passes both tests.
+ac_preproc_ok=:
+break
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_Xp_XpCreateContext" >&5
-$as_echo "$ac_cv_lib_Xp_XpCreateContext" >&6; }
-if test $ac_cv_lib_Xp_XpCreateContext = yes; then
-  HAVE_LIBXP=yes
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+
+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
 
-    if test ${HAVE_LIBXP} = yes; then
+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
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_LIBXP 1
-_ACEOF
 
-    fi
-  else
-    { $as_echo "$as_me:$LINENO: checking for LessTif where some systems put it" >&5
-$as_echo_n "checking for LessTif where some systems put it... " >&6; }
-if test "${emacs_cv_lesstif+set}" = set; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
+$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+if test "${ac_cv_path_GREP+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  # We put this in CFLAGS temporarily to precede other -I options
-    # that might be in CFLAGS temporarily.
-    # We put this in CPPFLAGS where it precedes the other -I options.
-    OLD_CPPFLAGS=$CPPFLAGS
-    OLD_CFLAGS=$CFLAGS
-    CPPFLAGS="-I/usr/X11R6/LessTif/Motif1.2/include $CPPFLAGS"
-    CFLAGS="-I/usr/X11R6/LessTif/Motif1.2/include $CFLAGS"
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include </usr/X11R6/LessTif/Motif1.2/include/Xm/Xm.h>
-int
-main ()
-{
-int x = 5;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
+  if test -z "$GREP"; then
+  ac_path_GREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in grep ggrep; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+      { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+# Check for GNU ac_path_GREP and select it if it is found.
+  # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo 'GREP' >> "conftest.nl"
+    "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_GREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_GREP="$ac_path_GREP"
+      ac_path_GREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  emacs_cv_lesstif=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       emacs_cv_lesstif=no
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $emacs_cv_lesstif" >&5
-$as_echo "$emacs_cv_lesstif" >&6; }
-    if test $emacs_cv_lesstif = yes; then
-      # Make sure this -I option remains in CPPFLAGS after it is set
-      # back to REAL_CPPFLAGS.
-      # There is no need to change REAL_CFLAGS, because REAL_CFLAGS does not
-      # have those other -I options anyway.  Ultimately, having this
-      # directory ultimately in CPPFLAGS will be enough.
-      REAL_CPPFLAGS="-I/usr/X11R6/LessTif/Motif1.2/include $REAL_CPPFLAGS"
-      LDFLAGS="-L/usr/X11R6/LessTif/Motif1.2/lib $LDFLAGS"
-    else
-      CFLAGS=$OLD_CFLAGS
-      CPPFLAGS=$OLD_CPPFLAGS
-    fi
+      $ac_path_GREP_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_GREP"; then
+    as_fn_error "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
   fi
+else
+  ac_cv_path_GREP=$GREP
 fi
 
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
+$as_echo "$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
 
 
-USE_TOOLKIT_SCROLL_BARS=no
-if test "${with_toolkit_scroll_bars}" != "no"; then
-  if test "${USE_X_TOOLKIT}" != "none"; then
-    if test "${USE_X_TOOLKIT}" = "MOTIF"; then
-      cat >>confdefs.h <<\_ACEOF
-#define USE_TOOLKIT_SCROLL_BARS 1
-_ACEOF
-
-      HAVE_XAW3D=no
-      USE_TOOLKIT_SCROLL_BARS=yes
-    elif test "${HAVE_XAW3D}" = "yes"; then
-      cat >>confdefs.h <<\_ACEOF
-#define USE_TOOLKIT_SCROLL_BARS 1
-_ACEOF
-
-      USE_TOOLKIT_SCROLL_BARS=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
+$as_echo_n "checking for egrep... " >&6; }
+if test "${ac_cv_path_EGREP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+   then ac_cv_path_EGREP="$GREP -E"
+   else
+     if test -z "$EGREP"; then
+  ac_path_EGREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in egrep; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+      { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+# Check for GNU ac_path_EGREP and select it if it is found.
+  # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo 'EGREP' >> "conftest.nl"
+    "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_EGREP="$ac_path_EGREP"
+      ac_path_EGREP_max=$ac_count
     fi
-  elif test "${HAVE_GTK}" = "yes"; then
-    cat >>confdefs.h <<\_ACEOF
-#define USE_TOOLKIT_SCROLL_BARS 1
-_ACEOF
-
-    USE_TOOLKIT_SCROLL_BARS=yes
-  elif test "${HAVE_NS}" = "yes"; then
-    cat >>confdefs.h <<\_ACEOF
-#define USE_TOOLKIT_SCROLL_BARS 1
-_ACEOF
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
 
-    USE_TOOLKIT_SCROLL_BARS=yes
+      $ac_path_EGREP_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_EGREP"; then
+    as_fn_error "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
   fi
+else
+  ac_cv_path_EGREP=$EGREP
 fi
 
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+   fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
+$as_echo "$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if test "${ac_cv_header_stdc+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
 
-         #include <X11/Xlib.h>
-         #include <X11/Xresource.h>
 int
 main ()
 {
-XIMProc  callback;
+
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  HAVE_XIM=yes
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_header_stdc=yes
+else
+  ac_cv_header_stdc=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <string.h>
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_XIM 1
 _ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "memchr" >/dev/null 2>&1; then :
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       HAVE_XIM=no
+  ac_cv_header_stdc=no
 fi
+rm -f conftest*
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
+fi
 
-if test "${with_xim}" != "no"; then
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdlib.h>
 
-cat >>confdefs.h <<\_ACEOF
-#define USE_XIM 1
 _ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "free" >/dev/null 2>&1; then :
 
+else
+  ac_cv_header_stdc=no
 fi
+rm -f conftest*
 
+fi
 
-if test "${HAVE_XIM}" != "no"; then
-  late_CFLAGS=$CFLAGS
-  if test "$GCC" = yes; then
-    CFLAGS="$CFLAGS --pedantic-errors"
-  fi
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+  if test "$cross_compiling" = yes; then :
+  :
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+                  (('a' <= (c) && (c) <= 'i') \
+                    || ('j' <= (c) && (c) <= 'r') \
+                    || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
 
-#include <X11/Xlib.h>
-#include <X11/Xresource.h>
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
 int
 main ()
 {
-Display *display;
-XrmDatabase db;
-char *res_name;
-char *res_class;
-XIMProc  callback;
-XPointer *client_data;
-#ifndef __GNUC__
-/* If we're not using GCC, it's probably not XFree86, and this is
-   probably right, but we can't use something like --pedantic-errors.  */
-extern Bool XRegisterIMInstantiateCallback(Display*, XrmDatabase, char*,
-                                           char*, XIMProc, XPointer*);
-#endif
-(void)XRegisterIMInstantiateCallback(display, db, res_name, res_class, callback,
-   client_data);
-  ;
+  int i;
+  for (i = 0; i < 256; i++)
+    if (XOR (islower (i), ISLOWER (i))
+       || toupper (i) != TOUPPER (i))
+      return 2;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  emacs_cv_arg6_star=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
+if ac_fn_c_try_run "$LINENO"; then :
 
+else
+  ac_cv_header_stdc=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-  if test "$emacs_cv_arg6_star" = yes; then
-    cat >>confdefs.h <<\_ACEOF
-#define XRegisterIMInstantiateCallback_arg6 XPointer*
-_ACEOF
-
-  else
-    cat >>confdefs.h <<\_ACEOF
-#define XRegisterIMInstantiateCallback_arg6 XPointer
-_ACEOF
-
-  fi
-  CFLAGS=$late_CFLAGS
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-### Start of font-backend (under any platform) section.
-# (nothing here yet -- this is a placeholder)
-### End of font-backend (under any platform) section.
-
-### Start of font-backend (under X11) section.
-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:$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:$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:$LINENO: result: $PKG_CONFIG" >&5
-$as_echo "$PKG_CONFIG" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
 
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
 
+fi
 
-  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:$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; then
-            { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-            succeeded=yes
-
-            { $as_echo "$as_me:$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:$LINENO: result: $FONTCONFIG_CFLAGS" >&5
-$as_echo "$FONTCONFIG_CFLAGS" >&6; }
-
-            { $as_echo "$as_me:$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:$LINENO: result: $FONTCONFIG_LIBS" >&5
-$as_echo "$FONTCONFIG_LIBS" >&6; }
-        else
-            { $as_echo "$as_me:$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
-
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+                 inttypes.h stdint.h unistd.h
+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
 
-  succeeded=no
+fi
 
-  # 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:$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:$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:$LINENO: result: $PKG_CONFIG" >&5
-$as_echo "$PKG_CONFIG" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
 
 
+  ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default"
+if test "x$ac_cv_header_minix_config_h" = x""yes; then :
+  MINIX=yes
+else
+  MINIX=
+fi
 
-  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:$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; then
-            { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-            succeeded=yes
+  if test "$MINIX" = yes; then
 
-            { $as_echo "$as_me:$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:$LINENO: result: $XFT_CFLAGS" >&5
-$as_echo "$XFT_CFLAGS" >&6; }
+$as_echo "#define _POSIX_SOURCE 1" >>confdefs.h
 
-            { $as_echo "$as_me:$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:$LINENO: result: $XFT_LIBS" >&5
-$as_echo "$XFT_LIBS" >&6; }
-        else
-            { $as_echo "$as_me:$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
+$as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h
 
 
+$as_echo "#define _MINIX 1" >>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
 
-  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:$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 "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5
+$as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; }
+if test "${ac_cv_safe_to_define___extensions__+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lXrender  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  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 ();
+#        define __EXTENSIONS__ 1
+         $ac_includes_default
 int
 main ()
 {
-return XRenderQueryExtension ();
+
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_Xrender_XRenderQueryExtension=yes
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_safe_to_define___extensions__=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_lib_Xrender_XRenderQueryExtension=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+  ac_cv_safe_to_define___extensions__=no
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_Xrender_XRenderQueryExtension" >&5
-$as_echo "$ac_cv_lib_Xrender_XRenderQueryExtension" >&6; }
-if test $ac_cv_lib_Xrender_XRenderQueryExtension = yes; then
-  HAVE_XRENDER=yes
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5
+$as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
+  test $ac_cv_safe_to_define___extensions__ = yes &&
+    $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h
 
-      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"
-       if test "${ac_cv_header_X11_Xft_Xft_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for X11/Xft/Xft.h" >&5
-$as_echo_n "checking for X11/Xft/Xft.h... " >&6; }
-if test "${ac_cv_header_X11_Xft_Xft_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_X11_Xft_Xft_h" >&5
-$as_echo "$ac_cv_header_X11_Xft_Xft_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking X11/Xft/Xft.h usability" >&5
-$as_echo_n "checking X11/Xft/Xft.h usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <X11/Xft/Xft.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  $as_echo "#define _ALL_SOURCE 1" >>confdefs.h
 
-       ac_header_compiler=no
-fi
+  $as_echo "#define _GNU_SOURCE 1" >>confdefs.h
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
+  $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h
 
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking X11/Xft/Xft.h presence" >&5
-$as_echo_n "checking X11/Xft/Xft.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h
+
+
+
+### Use -Wno-pointer-sign if the compiler supports it
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gcc understands -Wno-pointer-sign" >&5
+$as_echo_n "checking whether gcc understands -Wno-pointer-sign... " >&6; }
+SAVE_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -Wno-pointer-sign"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <X11/Xft/Xft.h>
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
 _ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
+if ac_fn_c_try_compile "$LINENO"; then :
+  has_option=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
+  has_option=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+if test $has_option = yes; then
+   C_WARNINGS_SWITCH="-Wno-pointer-sign $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
 
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
+### 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
+/* end confdefs.h.  */
 
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: X11/Xft/Xft.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: X11/Xft/Xft.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: X11/Xft/Xft.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: X11/Xft/Xft.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: X11/Xft/Xft.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: X11/Xft/Xft.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: X11/Xft/Xft.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: X11/Xft/Xft.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: X11/Xft/Xft.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: X11/Xft/Xft.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: X11/Xft/Xft.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: X11/Xft/Xft.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: X11/Xft/Xft.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: X11/Xft/Xft.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: X11/Xft/Xft.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: X11/Xft/Xft.h: in the future, the compiler will take precedence" >&2;}
+int
+main ()
+{
 
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for X11/Xft/Xft.h" >&5
-$as_echo_n "checking for X11/Xft/Xft.h... " >&6; }
-if test "${ac_cv_header_X11_Xft_Xft_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  has_option=yes
 else
-  ac_cv_header_X11_Xft_Xft_h=$ac_header_preproc
+  has_option=no
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_X11_Xft_Xft_h" >&5
-$as_echo "$ac_cv_header_X11_Xft_Xft_h" >&6; }
-
+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
-if test $ac_cv_header_X11_Xft_Xft_h = yes; then
-  { $as_echo "$as_me:$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 >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+{ $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
 /* 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
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_Xft_XftFontOpen=yes
+if ac_fn_c_try_compile "$LINENO"; then :
+  has_option=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_lib_Xft_XftFontOpen=no
+  has_option=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
+/* end confdefs.h.  */
+
+int
+main ()
+{
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  has_option=yes
+else
+  has_option=no
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_Xft_XftFontOpen" >&5
-$as_echo "$ac_cv_lib_Xft_XftFontOpen" >&6; }
-if test $ac_cv_lib_Xft_XftFontOpen = yes; then
-  HAVE_XFT=yes
+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"
 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
 
-fi
 
 
 
-       if test "${HAVE_XFT}" = "yes"; then
+#### Some other nice autoconf tests.
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_XFT 1
+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 :
+  $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.
+  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
 
-         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"
+  # 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>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  # Broken: success on invalid input.
+continue
+else
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
 
-        if test "$HAVE_XFT" != "yes"; then
-       HAVE_XFT=no
-    fi
+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
 
+    done
+    ac_cv_prog_CPP=$CPP
 
-    HAVE_FREETYPE=no
-    ## 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_FREETYPE=yes
-      FONTCONFIG_CFLAGS=
-      FONTCONFIG_LIBS=
-    fi
+fi
+  CPP=$ac_cv_prog_CPP
+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.
+  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 :
 
-    HAVE_LIBOTF=no
-    if test "${HAVE_FREETYPE}" = "yes"; then
+else
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_FREETYPE 1
+  # 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>
 _ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  # Broken: success on invalid input.
+continue
+else
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
 
-      if test "${with_libotf}" != "no"; then
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
 
-  succeeded=no
+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
 
-  # 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:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_PKG_CONFIG+set}" = set; then
+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
+
+# Find a good install program.  We prefer a C program (faster),
+# so one script is as good as another.  But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+# Reject install programs that cannot install multiple files.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
+$as_echo_n "checking for a BSD-compatible install... " >&6; }
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+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:$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:$LINENO: result: $PKG_CONFIG" >&5
-$as_echo "$PKG_CONFIG" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-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:$LINENO: checking for libotf" >&5
-$as_echo_n "checking for libotf... " >&6; }
-
-        if $PKG_CONFIG --exists "libotf" 2>&5; then
-            { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-            succeeded=yes
-
-            { $as_echo "$as_me:$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:$LINENO: result: $LIBOTF_CFLAGS" >&5
-$as_echo "$LIBOTF_CFLAGS" >&6; }
-
-            { $as_echo "$as_me:$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:$LINENO: result: $LIBOTF_LIBS" >&5
-$as_echo "$LIBOTF_LIBS" >&6; }
-        else
-            { $as_echo "$as_me:$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
-
+    # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in #((
+  ./ | .// | /[cC]/* | \
+  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+  ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
+  /usr/ucb/* ) ;;
+  *)
+    # OSF1 and SCO ODT 3.0 have their own names for install.
+    # Don't use installbsd from OSF since it installs stuff as root
+    # by default.
+    for ac_prog in ginstall scoinst install; do
+      for ac_exec_ext in '' $ac_executable_extensions; do
+       if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+         if test $ac_prog = install &&
+           grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+           # AIX install.  It has an incompatible calling convention.
+           :
+         elif test $ac_prog = install &&
+           grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+           # program-specific install script used by HP pwplus--don't use.
+           :
+         else
+           rm -rf conftest.one conftest.two conftest.dir
+           echo one > conftest.one
+           echo two > conftest.two
+           mkdir conftest.dir
+           if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
+             test -s conftest.one && test -s conftest.two &&
+             test -s conftest.dir/conftest.one &&
+             test -s conftest.dir/conftest.two
+           then
+             ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+             break 3
+           fi
+         fi
+       fi
+      done
+    done
+    ;;
+esac
 
+  done
+IFS=$as_save_IFS
 
-     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
+rm -rf conftest.one conftest.two conftest.dir
 
-  if test $succeeded = yes; then
-     HAVE_LIBOTF=yes
+fi
+  if test "${ac_cv_path_install+set}" = set; then
+    INSTALL=$ac_cv_path_install
   else
-     HAVE_LIBOTF=no
+    # As a last resort, use the slow shell script.  Don't cache a
+    # value for INSTALL within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the value is a relative name.
+    INSTALL=$ac_install_sh
   fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
+$as_echo "$INSTALL" >&6; }
 
-       if test "$HAVE_LIBOTF" = "yes"; then
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_LIBOTF 1
-_ACEOF
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
 
-         { $as_echo "$as_me:$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
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+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
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lotf  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* 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 OTF_get_variation_glyphs ();
-int
-main ()
-{
-return OTF_get_variation_glyphs ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_otf_OTF_get_variation_glyphs=yes
+  if test -n "$RANLIB"; then
+  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+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
 
-       ac_cv_lib_otf_OTF_get_variation_glyphs=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_otf_OTF_get_variation_glyphs" >&5
-$as_echo "$ac_cv_lib_otf_OTF_get_variation_glyphs" >&6; }
-if test $ac_cv_lib_otf_OTF_get_variation_glyphs = yes; then
-  HAVE_OTF_GET_VARIATION_GLYPHS=yes
+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
-  HAVE_OTF_GET_VARIATION_GLYPHS=no
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
-         if test "${HAVE_OTF_GET_VARIATION_GLYPHS}" = "yes"; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_OTF_GET_VARIATION_GLYPHS 1
-_ACEOF
-
-         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:$LINENO: checking for $ac_word" >&5
+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_path_PKG_CONFIG+set}" = set; then
+if test "${ac_cv_prog_ac_ct_RANLIB+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
+  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
+    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:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    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
+  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:$LINENO: result: $PKG_CONFIG" >&5
-$as_echo "$PKG_CONFIG" >&6; }
+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:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
-
-
-  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:$LINENO: checking for m17n-flt" >&5
-$as_echo_n "checking for m17n-flt... " >&6; }
-
-        if $PKG_CONFIG --exists "m17n-flt" 2>&5; then
-            { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-            succeeded=yes
-
-            { $as_echo "$as_me:$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:$LINENO: result: $M17N_FLT_CFLAGS" >&5
-$as_echo "$M17N_FLT_CFLAGS" >&6; }
-
-            { $as_echo "$as_me:$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:$LINENO: result: $M17N_FLT_LIBS" >&5
-$as_echo "$M17N_FLT_LIBS" >&6; }
-        else
-            { $as_echo "$as_me:$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"`
-
-        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_M17N_FLT=yes
+  if test "x$ac_ct_RANLIB" = x; then
+    RANLIB=":"
   else
-     HAVE_M17N_FLT=no
+    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
-
-       if test "$HAVE_M17N_FLT" = "yes"; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_M17N_FLT 1
-_ACEOF
-
-       fi
-      fi
-    fi
 else
-    HAVE_XFT=no
-    HAVE_FREETYPE=no
-    HAVE_LIBOTF=no
-    HAVE_M17N_FLT=no
+  RANLIB="$ac_cv_prog_RANLIB"
 fi
-### End of font-backend (under X11) section.
-
-
-
-
-
-
-
 
+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_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 :
 
-### Use -lXpm if available, unless `--with-xpm=no'.
-HAVE_XPM=no
-if test "${HAVE_X11}" = "yes"; then
-  if test "${with_xpm}" != "no"; then
-    if test "${ac_cv_header_X11_xpm_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for X11/xpm.h" >&5
-$as_echo_n "checking for X11/xpm.h... " >&6; }
-if test "${ac_cv_header_X11_xpm_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_X11_xpm_h" >&5
-$as_echo "$ac_cv_header_X11_xpm_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking X11/xpm.h usability" >&5
-$as_echo_n "checking X11/xpm.h usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <X11/xpm.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-       ac_header_compiler=no
+  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
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
+# 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 :
+  $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
 
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking X11/xpm.h presence" >&5
-$as_echo_n "checking X11/xpm.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <X11/xpm.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
+  ;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
+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; }
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
 
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: X11/xpm.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: X11/xpm.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: X11/xpm.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: X11/xpm.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: X11/xpm.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: X11/xpm.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: X11/xpm.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: X11/xpm.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: X11/xpm.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: X11/xpm.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: X11/xpm.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: X11/xpm.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: X11/xpm.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: X11/xpm.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: X11/xpm.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: X11/xpm.h: in the future, the compiler will take precedence" >&2;}
+# 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 :
+  $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 /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_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
-{ $as_echo "$as_me:$LINENO: checking for X11/xpm.h" >&5
-$as_echo_n "checking for X11/xpm.h... " >&6; }
-if test "${ac_cv_header_X11_xpm_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
+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; }
 else
-  ac_cv_header_X11_xpm_h=$ac_header_preproc
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_X11_xpm_h" >&5
-$as_echo "$ac_cv_header_X11_xpm_h" >&6; }
 
-fi
-if test $ac_cv_header_X11_xpm_h = yes; then
-  { $as_echo "$as_me:$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
+
+# 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 :
   $as_echo_n "(cached) " >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lXpm -lX11 $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
+  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 /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_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
 
-/* 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 XpmReadFileToPixmap ();
-int
-main ()
-{
-return XpmReadFileToPixmap ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
+  test -z "$ac_cv_path_INSTALL_INFO" && ac_cv_path_INSTALL_INFO=":"
+  ;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_Xpm_XpmReadFileToPixmap=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_lib_Xpm_XpmReadFileToPixmap=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_Xpm_XpmReadFileToPixmap" >&5
-$as_echo "$ac_cv_lib_Xpm_XpmReadFileToPixmap" >&6; }
-if test $ac_cv_lib_Xpm_XpmReadFileToPixmap = yes; then
-  HAVE_XPM=yes
 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; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
-    if test "${HAVE_XPM}" = "yes"; then
-      { $as_echo "$as_me:$LINENO: checking for XpmReturnAllocPixels preprocessor define" >&5
-$as_echo_n "checking for XpmReturnAllocPixels preprocessor define... " >&6; }
-      cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* 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
+# 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_GZIP_PROG+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  HAVE_XPM=yes
-fi
-rm -f conftest*
-
+  case $GZIP_PROG in
+  [\\/]* | ?:[\\/]*)
+  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 $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_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
+done
+  done
+IFS=$as_save_IFS
 
-      if test "${HAVE_XPM}" = "yes"; then
-       { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-      else
-       { $as_echo "$as_me:$LINENO: result: no" >&5
+  ;;
+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; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
-      fi
-    fi
-  fi
+fi
 
-  if test "${HAVE_XPM}" = "yes"; then
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_XPM 1
-_ACEOF
 
-  fi
-fi
 
-### Use -ljpeg if available, unless `--with-jpeg=no'.
-HAVE_JPEG=no
-if test "${HAVE_X11}" = "yes"; then
-  if test "${with_jpeg}" != "no"; then
-            if test "${ac_cv_header_jerror_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for jerror.h" >&5
-$as_echo_n "checking for jerror.h... " >&6; }
-if test "${ac_cv_header_jerror_h+set}" = set; then
+## Need makeinfo >= 4.6 (?) 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
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_MAKEINFO+set}" = set; then :
   $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_jerror_h" >&5
-$as_echo "$ac_cv_header_jerror_h" >&6; }
 else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking jerror.h usability" >&5
-$as_echo_n "checking jerror.h usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <jerror.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
+  case $MAKEINFO in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_MAKEINFO="$MAKEINFO" # 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_MAKEINFO="$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_MAKEINFO" && ac_cv_path_MAKEINFO="no"
+  ;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
+fi
+MAKEINFO=$ac_cv_path_MAKEINFO
+if test -n "$MAKEINFO"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAKEINFO" >&5
+$as_echo "$MAKEINFO" >&6; }
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
-       ac_header_compiler=no
+
+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
+   MAKEINFO=no
+fi
+
+## Makeinfo is unusual.  For a released Emacs, the manuals are
+## pre-built, and not deleted by the normal clean rules.  makeinfo is
+## therefore in the category of "special tools" not normally required, which
+## configure does not have to check for (eg autoconf itself).
+## In a Bazaar checkout on the other hand, the manuals are not included.
+## So makeinfo is a requirement to build from Bazaar, and configure
+## should test for it as it does for any other build requirement.
+## We use the presence of $srcdir/info/emacs to distinguish a release,
+## with pre-built manuals, from a Bazaar checkout.
+if test "$MAKEINFO" = "no"; then
+  if test "x${with_makeinfo}" = "xno"; then
+    MAKEINFO=off
+  elif test ! -e $srcdir/info/emacs; then
+    as_fn_error "You do not seem to have makeinfo >= 4.6, 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
+  fi
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking jerror.h presence" >&5
-$as_echo_n "checking jerror.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <jerror.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-  ac_header_preproc=no
+if test x$GCC = xyes && test "x$GCC_LINK_TEST_OPTIONS" != x
+then
+  ac_link="$ac_link $GCC_LINK_TEST_OPTIONS"
 fi
 
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
+if test x$GCC = x && test "x$NON_GCC_LINK_TEST_OPTIONS" != x
+then
+  ac_link="$ac_link $NON_GCC_LINK_TEST_OPTIONS"
+fi
 
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: jerror.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: jerror.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: jerror.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: jerror.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: jerror.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: jerror.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: jerror.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: jerror.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: jerror.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: jerror.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: jerror.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: jerror.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: jerror.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: jerror.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: jerror.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: jerror.h: in the future, the compiler will take precedence" >&2;}
 
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for jerror.h" >&5
-$as_echo_n "checking for jerror.h... " >&6; }
-if test "${ac_cv_header_jerror_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
+late_LDFLAGS=$LDFLAGS
+if test "$GCC" = yes; then
+  LDFLAGS="$LDFLAGS -Wl,-znocombreloc"
 else
-  ac_cv_header_jerror_h=$ac_header_preproc
+  LDFLAGS="$LDFLAGS -znocombreloc"
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_jerror_h" >&5
-$as_echo "$ac_cv_header_jerror_h" >&6; }
 
-fi
-if test $ac_cv_header_jerror_h = yes; then
-  { $as_echo "$as_me:$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="-ljpeg  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -znocombreloc" >&5
+$as_echo_n "checking for -znocombreloc... " >&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 jpeg_destroy_compress ();
-int
-main ()
-{
-return jpeg_destroy_compress ();
-  ;
-  return 0;
-}
+main(){return 0;}
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_jpeg_jpeg_destroy_compress=yes
+if ac_fn_c_try_link "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_lib_jpeg_jpeg_destroy_compress=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_jpeg_jpeg_destroy_compress" >&5
-$as_echo "$ac_cv_lib_jpeg_jpeg_destroy_compress" >&6; }
-if test $ac_cv_lib_jpeg_jpeg_destroy_compress = yes; then
-  HAVE_JPEG=yes
+  LDFLAGS=$late_LDFLAGS
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 
-fi
 
+# The value of CPP is a quoted variable reference, so we need to do this
+# to get its actual value...
+CPP=`eval "echo $CPP"`
 
-  fi
 
+CANNOT_DUMP=no
+case "$opsys" in
+  your-opsys-here)
+   CANNOT_DUMP=yes
 
-  if test "${HAVE_JPEG}" = "yes"; then
-    cat >>confdefs.h <<\_ACEOF
-#define HAVE_JPEG 1
-_ACEOF
+$as_echo "#define CANNOT_DUMP 1" >>confdefs.h
 
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <jpeglib.h>
-        version=JPEG_LIB_VERSION
+  ;;
+esac
 
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "version= *(6[2-9]|[7-9][0-9])" >/dev/null 2>&1; then
-  cat >>confdefs.h <<\_ACEOF
-#define HAVE_JPEG 1
-_ACEOF
 
-else
-  { $as_echo "$as_me:$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*
 
+UNEXEC_OBJ=unexelf.o
+case "$opsys" in
+  # MSDOS uses unexcoff.o
+  # MSWindows uses unexw32.o
+  aix4-2)
+   UNEXEC_OBJ=unexaix.o
+   ;;
+  cygwin)
+   UNEXEC_OBJ=unexcw.o
+   ;;
+  darwin)
+   UNEXEC_OBJ=unexmacosx.o
+   ;;
+  hpux10-20 | hpux11)
+   UNEXEC_OBJ=unexhp9k800.o
+   ;;
+  sol2-10)
+   # Use the Solaris dldump() function, called from unexsol.c, to dump
+   # emacs, instead of the generic ELF dump code found in unexelf.c.
+   # The resulting binary has a complete symbol table, and is better
+   # for debugging and other observability tools (debuggers, pstack, etc).
+   #
+   # If you encounter a problem using dldump(), please consider sending
+   # a message to the OpenSolaris tools-linking mailing list:
+   #      http://mail.opensolaris.org/mailman/listinfo/tools-linking
+   #
+   # It is likely that dldump() works with older Solaris too, but this has
+   # not been tested, so for now this change is for Solaris 10 or newer.
+   UNEXEC_OBJ=unexsol.o
+   ;;
+esac
+
+LD_SWITCH_SYSTEM=
+case "$opsys" in
+  freebsd)
+   ## 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
+   ;;
+
+  gnu-linux)
+   ## cpp test was "ifdef __mips__", but presumably this is equivalent...
+   test "$machine" = "mips" && LD_SWITCH_SYSTEM="-G 0"
+   ;;
+
+  netbsd)
+   LD_SWITCH_SYSTEM="-Wl,-rpath,/usr/pkg/lib -L/usr/pkg/lib -Wl,-rpath,/usr/local/lib -L/usr/local/lib"
+   ;;
+
+  openbsd)
+   ## Han Boetes <han@mijncomputer.nl> says this is necessary,
+   ## otherwise Emacs dumps core on elf systems.
+   LD_SWITCH_SYSTEM="-Z"
+   ;;
+esac
+
+
+ac_link="$ac_link $LD_SWITCH_SYSTEM"
+
+## This setting of LD_SWITCH_SYSTEM references LD_SWITCH_X_SITE_AUX,
+## 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.
+## FIXME it would be cleaner to put this in LD_SWITCH_SYSTEM_TEMACS
+## (or somesuch), but because it is supposed to go at the _front_
+## of LD_SWITCH_SYSTEM, we cannot do that in exactly the same way.
+## Compare with the gnu-linux case below, which added to the end
+## of LD_SWITCH_SYSTEM, and so can instead go at the front of
+## 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" ;;
+esac
+
+
+C_SWITCH_MACHINE=
+if test "$machine" = "alpha"; then
+  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 :
+
+fi
+
+  if test "$ac_cv_have_decl___ELF__" = "yes"; then
+    ## With ELF, make sure that all common symbols get allocated to in the
+    ## data section.  Otherwise, the dump of temacs may miss variables in
+    ## the shared library that have been initialized.  For example, with
+    ## GNU libc, __malloc_initialized would normally be resolved to the
+    ## shared library's .bss section, which is fatal.
+    if test "x$GCC" = "xyes"; then
+      C_SWITCH_MACHINE="-fno-common"
+    else
+      as_fn_error "What gives?  Fix me if DEC Unix supports ELF now." "$LINENO" 5
+    fi
+  else
+    UNEXEC_OBJ=unexalpha.o
   fi
 fi
 
-### Use -lpng if available, unless `--with-png=no'.
-HAVE_PNG=no
-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`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-       ac_header_compiler=no
-fi
+C_SWITCH_SYSTEM=
+## Some programs in src produce warnings saying certain subprograms
+## are too complex and need a MAXMEM value greater than 2000 for
+## additional optimization.  --nils@exp-math.uni-essen.de
+test "$opsys" = "aix4.2" && test "x$GCC" != "xyes" && \
+  C_SWITCH_SYSTEM="-ma -qmaxmem=4000"
+## gnu-linux might need -D_BSD_SOURCE on old libc5 systems.
+## It is redundant in glibc2, since we define _GNU_SOURCE.
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
 
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-  ac_header_preproc=no
-fi
+LIBS_SYSTEM=
+case "$opsys" in
+  ## IBM's X11R5 uses -lIM and -liconv in AIX 3.2.2.
+  aix4-2) LIBS_SYSTEM="-lrts -lIM -liconv" ;;
 
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
+  freebsd) LIBS_SYSTEM="-lutil" ;;
 
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+  hpux*) LIBS_SYSTEM="-l:libdld.sl" ;;
 
-    ;;
+  sol2*) LIBS_SYSTEM="-lsocket -lnsl -lkstat" ;;
+
+  ## Motif needs -lgen.
+  unixware) LIBS_SYSTEM="-lsocket -lnsl -lelf -lgen" ;;
 esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
+
+
+
+### Make sure subsequent tests use flags consistent with the build flags.
+
+if test x"${OVERRIDE_CPPFLAGS}" != x; then
+  CPPFLAGS="${OVERRIDE_CPPFLAGS}"
 else
-  eval "$as_ac_Header=\$ac_header_preproc"
+  CPPFLAGS="$C_SWITCH_SYSTEM $C_SWITCH_MACHINE $CPPFLAGS"
 fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
 
-fi
-if test `eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
 
+
+# Check whether --enable-largefile was given.
+if test "${enable_largefile+set}" = set; then :
+  enableval=$enable_largefile;
 fi
 
-done
+if test "$enable_largefile" != no; then
 
-    if test "$ac_cv_header_png_h" = yes || test "$ac_cv_header_libpng_png_h" = yes ; then
-      { $as_echo "$as_me:$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 "$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_check_lib_save_LIBS=$LIBS
-LIBS="-lpng -lz -lm $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  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.  */
-
-/* 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 png_get_channels ();
+#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 png_get_channels ();
+
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_png_png_get_channels=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_lib_png_png_get_channels=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+        if ac_fn_c_try_compile "$LINENO"; then :
+  break
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_png_png_get_channels" >&5
-$as_echo "$ac_cv_lib_png_png_get_channels" >&6; }
-if test $ac_cv_lib_png_png_get_channels = yes; then
-  HAVE_PNG=yes
+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
 
-  if test "${HAVE_PNG}" = "yes"; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_PNG 1
-_ACEOF
-
-  fi
-fi
-
-### Use -ltiff if available, unless `--with-tiff=no'.
-HAVE_TIFF=no
-if test "${HAVE_X11}" = "yes"; then
-  if test "${with_tiff}" != "no"; then
-    if test "${ac_cv_header_tiffio_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for tiffio.h" >&5
-$as_echo_n "checking for tiffio.h... " >&6; }
-if test "${ac_cv_header_tiffio_h+set}" = set; then
+  { $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
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_tiffio_h" >&5
-$as_echo "$ac_cv_header_tiffio_h" >&6; }
 else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking tiffio.h usability" >&5
-$as_echo_n "checking tiffio.h usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  while :; do
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
-#include <tiffio.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+#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 ()
+{
 
-       ac_header_compiler=no
+  ;
+  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
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking tiffio.h presence" >&5
-$as_echo_n "checking tiffio.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <tiffio.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+#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 ()
+{
 
-  ac_header_preproc=no
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_sys_file_offset_bits=64; break
 fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: tiffio.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: tiffio.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: tiffio.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: tiffio.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: tiffio.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: tiffio.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: tiffio.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: tiffio.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: tiffio.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: tiffio.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: tiffio.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: tiffio.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: tiffio.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: tiffio.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: tiffio.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: tiffio.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
+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
-{ $as_echo "$as_me:$LINENO: checking for tiffio.h" >&5
-$as_echo_n "checking for tiffio.h... " >&6; }
-if test "${ac_cv_header_tiffio_h+set}" = set; then
+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
-  ac_cv_header_tiffio_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_tiffio_h" >&5
-$as_echo "$ac_cv_header_tiffio_h" >&6; }
+  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 ()
+{
 
-fi
-if test $ac_cv_header_tiffio_h = 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:$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 >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+  ;
+  return 0;
+}
 _ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_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.  */
-
-/* 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 ();
+#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 TIFFGetVersion ();
+
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_tiff_TIFFGetVersion=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_lib_tiff_TIFFGetVersion=no
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_sys_large_files=1; break
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  ac_cv_sys_large_files=unknown
+  break
+done
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_tiff_TIFFGetVersion" >&5
-$as_echo "$ac_cv_lib_tiff_TIFFGetVersion" >&6; }
-if test $ac_cv_lib_tiff_TIFFGetVersion = yes; then
-  HAVE_TIFF=yes
+{ $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
 
-fi
 
 
-  fi
+## If user specified a crt-dir, use that unconditionally.
+if test "X$CRT_DIR" = "X"; then
 
-  if test "${HAVE_TIFF}" = "yes"; then
+  case "$canonical" in
+    x86_64-*-linux-gnu* | s390x-*-linux-gnu*)
+    ## On x86-64 and s390x GNU/Linux distributions, the standard library
+    ## can be in a variety of places.  We only try /usr/lib64 and /usr/lib.
+    ## For anything else (eg /usr/lib32), it is up the user to specify
+    ## the location (bug#5655).
+    ## Test for crtn.o, not just the directory, because sometimes the
+    ## directory exists but does not have the relevant files (bug#1287).
+    ## FIXME better to test for binary compatibility somehow.
+    test -e /usr/lib64/crtn.o && CRT_DIR=/usr/lib64
+    ;;
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_TIFF 1
-_ACEOF
+    powerpc64-*-linux-gnu* | sparc64-*-linux-gnu*) CRT_DIR=/usr/lib64 ;;
+  esac
 
-  fi
-fi
+  case "$opsys" in
+    hpux10-20) CRT_DIR=/lib ;;
+  esac
+
+  ## Default is /usr/lib.
+  test "X$CRT_DIR" = "X" && CRT_DIR=/usr/lib
 
-### Use -lgif or -lungif if available, unless `--with-gif=no'.
-HAVE_GIF=no
-if test "${HAVE_X11}" = "yes" && test "${with_gif}" != "no"; then
-  if test "${ac_cv_header_gif_lib_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for gif_lib.h" >&5
-$as_echo_n "checking for gif_lib.h... " >&6; }
-if test "${ac_cv_header_gif_lib_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_gif_lib_h" >&5
-$as_echo "$ac_cv_header_gif_lib_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking gif_lib.h usability" >&5
-$as_echo_n "checking gif_lib.h usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <gif_lib.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-       ac_header_compiler=no
+  ## Some platforms don't use any of these files, so it is not
+  ## appropriate to put this test outside the if block.
+  test -e $CRT_DIR/crtn.o || test -e $CRT_DIR/crt0.o || \
+    as_fn_error "crt*.o not found in specified location." "$LINENO" 5
+
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
 
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking gif_lib.h presence" >&5
-$as_echo_n "checking gif_lib.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <gif_lib.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
+
+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 )
+    if test -f $CRT_DIR/crti.o; then
+       LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtend.o $(CRT_DIR)/crtn.o'
+        START_FILES='pre-crt0.o $(CRT_DIR)/crt0.o $(CRT_DIR)/crti.o $(CRT_DIR)/crtbegin.o'
+    else
+       LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtend.o'
+       START_FILES='pre-crt0.o $(CRT_DIR)/crt0.o $(CRT_DIR)/crtbegin.o'
+    fi
+    ;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-  ac_header_preproc=no
-fi
 
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
 
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: gif_lib.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: gif_lib.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: gif_lib.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: gif_lib.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: gif_lib.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: gif_lib.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: gif_lib.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: gif_lib.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: gif_lib.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: gif_lib.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: gif_lib.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: gif_lib.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: gif_lib.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: gif_lib.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: gif_lib.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: gif_lib.h: in the future, the compiler will take precedence" >&2;}
 
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for gif_lib.h" >&5
-$as_echo_n "checking for gif_lib.h... " >&6; }
-if test "${ac_cv_header_gif_lib_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_gif_lib_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_gif_lib_h" >&5
-$as_echo "$ac_cv_header_gif_lib_h" >&6; }
 
+
+
+if test "${with_sound}" != "no"; then
+  # Sound support for GNU/Linux and the free BSDs.
+  for ac_header in machine/soundcard.h sys/soundcard.h soundcard.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
+ have_sound_header=yes
 fi
-if test $ac_cv_header_gif_lib_h = yes; then
-  # EGifPutExtensionLast only exists from version libungif-4.1.0b1.
-# Earlier versions can crash Emacs.
-    { $as_echo "$as_me:$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
+
+done
+
+  # Emulation library used on NetBSD.
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _oss_ioctl in -lossaudio" >&5
+$as_echo_n "checking for _oss_ioctl in -lossaudio... " >&6; }
+if test "${ac_cv_lib_ossaudio__oss_ioctl+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lgif  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+LIBS="-lossaudio  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -15378,1808 +5992,1950 @@ cat >>conftest.$ac_ext <<_ACEOF
 #ifdef __cplusplus
 extern "C"
 #endif
-char EGifPutExtensionLast ();
+char _oss_ioctl ();
 int
 main ()
 {
-return EGifPutExtensionLast ();
+return _oss_ioctl ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_gif_EGifPutExtensionLast=yes
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_ossaudio__oss_ioctl=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_lib_gif_EGifPutExtensionLast=no
+  ac_cv_lib_ossaudio__oss_ioctl=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+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:$LINENO: result: $ac_cv_lib_gif_EGifPutExtensionLast" >&5
-$as_echo "$ac_cv_lib_gif_EGifPutExtensionLast" >&6; }
-if test $ac_cv_lib_gif_EGifPutExtensionLast = yes; then
-  HAVE_GIF=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ossaudio__oss_ioctl" >&5
+$as_echo "$ac_cv_lib_ossaudio__oss_ioctl" >&6; }
+if test "x$ac_cv_lib_ossaudio__oss_ioctl" = x""yes; then :
+  LIBSOUND=-lossaudio
 else
-  try_libungif=yes
+  LIBSOUND=
 fi
 
-fi
 
 
+  ALSA_REQUIRED=1.0.0
+  ALSA_MODULES="alsa >= $ALSA_REQUIRED"
 
-  if test "$HAVE_GIF" = yes; then
-      ac_gif_lib_name="-lgif"
-  fi
+  succeeded=no
 
-# If gif_lib.h but no libgif, try libungif.
-  if test x"$try_libungif" = xyes; then
-    { $as_echo "$as_me:$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
+  # 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
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lungif  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+  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
+     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 $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; }
+            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; }
+            ALSA_CFLAGS=""
+            ALSA_LIBS=""
+            ## If we have a custom action on failure, don't print errors, but
+            ## do set a variable so people can do so.
+            ALSA_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$ALSA_MODULES"`
+
+        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_ALSA=yes
+  else
+     HAVE_ALSA=no
+  fi
+
+  if test $HAVE_ALSA = yes; then
+    SAVE_CFLAGS="$CFLAGS"
+    SAVE_LDFLAGS="$LDFLAGS"
+    CFLAGS="$ALSA_CFLAGS $CFLAGS"
+    LDFLAGS="$ALSA_LIBS $LDFLAGS"
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <asoundlib.h>
+int
+main ()
+{
+snd_lib_error_set_handler (0);
+  ;
+  return 0;
+}
 _ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  emacs_alsa_normal=yes
+else
+  emacs_alsa_normal=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+    if test "$emacs_alsa_normal" != 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 EGifPutExtensionLast ();
+#include <alsa/asoundlib.h>
 int
 main ()
 {
-return EGifPutExtensionLast ();
+snd_lib_error_set_handler (0);
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_ungif_EGifPutExtensionLast=yes
+if ac_fn_c_try_compile "$LINENO"; then :
+  emacs_alsa_subdir=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_lib_ungif_EGifPutExtensionLast=no
+  emacs_alsa_subdir=no
 fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+      if test "$emacs_alsa_subdir" != yes; then
+        as_fn_error "pkg-config found alsa, but it does not compile.  See config.log for error messages." "$LINENO" 5
+      fi
+      ALSA_CFLAGS="$ALSA_CFLAGS -DALSA_SUBDIR_INCLUDE"
+    fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_ungif_EGifPutExtensionLast" >&5
-$as_echo "$ac_cv_lib_ungif_EGifPutExtensionLast" >&6; }
-if test $ac_cv_lib_ungif_EGifPutExtensionLast = yes; then
-  HAVE_GIF=yes
-fi
+    CFLAGS="$SAVE_CFLAGS"
+    LDFLAGS="$SAVE_LDFLAGS"
+    LIBSOUND="$LIBSOUND $ALSA_LIBS"
+    CFLAGS_SOUND="$CFLAGS_SOUND $ALSA_CFLAGS"
 
+$as_echo "#define HAVE_ALSA 1" >>confdefs.h
 
-    if test "$HAVE_GIF" = yes; then
+  fi
 
-cat >>confdefs.h <<\_ACEOF
-#define LIBGIF -lungif
-_ACEOF
+        if test x$have_sound_header = xyes || test $HAVE_ALSA = yes; then
+     case "$opsys" in
+              gnu-linux|freebsd|netbsd)
 
-      ac_gif_lib_name="-lungif"
-    fi
+$as_echo "#define HAVE_SOUND 1" >>confdefs.h
+
+         ;;
+     esac
   fi
 
-  if test "${HAVE_GIF}" = "yes"; then
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_GIF 1
+fi
+
+for ac_header in sys/select.h sys/timeb.h sys/time.h unistd.h utime.h \
+  linux/version.h sys/systeminfo.h termios.h limits.h string.h stdlib.h \
+  stdio_ext.h fcntl.h strings.h coff.h pty.h sys/mman.h \
+  sys/param.h sys/vlimit.h sys/resource.h locale.h sys/_mbstate_t.h \
+  sys/utsname.h pwd.h utmp.h dirent.h util.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
 
-  fi
 fi
 
-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"
+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
+/* end confdefs.h.  */
+#include <sys/personality.h>
+int
+main ()
+{
+personality (PER_LINUX32)
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  emacs_cv_personality_linux32=yes
+else
+  emacs_cv_personality_linux32=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_personality_linux32" >&5
+$as_echo "$emacs_cv_personality_linux32" >&6; }
+
+if test $emacs_cv_personality_linux32 = yes; then
+
+$as_echo "#define HAVE_PERSONALITY_LINUX32 1" >>confdefs.h
+
+fi
+
+for ac_header in term.h
+do :
+  ac_fn_c_check_header_preproc "$LINENO" "term.h" "ac_cv_header_term_h"
+if test "x$ac_cv_header_term_h" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_TERM_H 1
+_ACEOF
 
-  if test "X${MISSING}" != X; then
-    { { $as_echo "$as_me:$LINENO: 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" >&5
-$as_echo "$as_me: 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" >&2;}
-   { (exit 1); exit 1; }; }
-  fi
 fi
 
-### Use -lgpm if available, unless `--with-gpm=no'.
-HAVE_GPM=no
-if test "${with_gpm}" != "no"; then
-  if test "${ac_cv_header_gpm_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for gpm.h" >&5
-$as_echo_n "checking for gpm.h... " >&6; }
-if test "${ac_cv_header_gpm_h+set}" = set; then
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if test "${ac_cv_header_stdc+set}" = set; then :
   $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_gpm_h" >&5
-$as_echo "$ac_cv_header_gpm_h" >&6; }
 else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking gpm.h usability" >&5
-$as_echo_n "checking gpm.h usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
-#include <gpm.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_header_stdc=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
+  ac_cv_header_stdc=no
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
 
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking gpm.h presence" >&5
-$as_echo_n "checking gpm.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <gpm.h>
+#include <string.h>
+
 _ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "memchr" >/dev/null 2>&1; then :
+
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
 
-  ac_header_preproc=no
 fi
 
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdlib.h>
 
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: gpm.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: gpm.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: gpm.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: gpm.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: gpm.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: gpm.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: gpm.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: gpm.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: gpm.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: gpm.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: gpm.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: gpm.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: gpm.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: gpm.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: gpm.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: gpm.h: in the future, the compiler will take precedence" >&2;}
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "free" >/dev/null 2>&1; then :
 
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for gpm.h" >&5
-$as_echo_n "checking for gpm.h... " >&6; }
-if test "${ac_cv_header_gpm_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
 else
-  ac_cv_header_gpm_h=$ac_header_preproc
+  ac_cv_header_stdc=no
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_gpm_h" >&5
-$as_echo "$ac_cv_header_gpm_h" >&6; }
+rm -f conftest*
 
 fi
-if test $ac_cv_header_gpm_h = yes; then
-  { $as_echo "$as_me:$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
+
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+  if test "$cross_compiling" = yes; then :
+  :
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lgpm  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  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"
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+                  (('a' <= (c) && (c) <= 'i') \
+                    || ('j' <= (c) && (c) <= 'r') \
+                    || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
 #endif
-char Gpm_Open ();
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
 int
 main ()
 {
-return Gpm_Open ();
-  ;
+  int i;
+  for (i = 0; i < 256; i++)
+    if (XOR (islower (i), ISLOWER (i))
+       || toupper (i) != TOUPPER (i))
+      return 2;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_gpm_Gpm_Open=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+if ac_fn_c_try_run "$LINENO"; then :
 
-       ac_cv_lib_gpm_Gpm_Open=no
+else
+  ac_cv_header_stdc=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 -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_gpm_Gpm_Open" >&5
-$as_echo "$ac_cv_lib_gpm_Gpm_Open" >&6; }
-if test $ac_cv_lib_gpm_Gpm_Open = yes; then
-  HAVE_GPM=yes
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5
+$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; }
+if test "${ac_cv_header_time+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/time.h>
+#include <time.h>
 
+int
+main ()
+{
+if ((struct tm *) 0)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_header_time=yes
+else
+  ac_cv_header_time=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5
+$as_echo "$ac_cv_header_time" >&6; }
+if test $ac_cv_header_time = yes; then
 
+$as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h
 
 fi
 
-if test "${HAVE_GPM}" = "yes"; then
+ac_fn_c_check_decl "$LINENO" "sys_siglist" "ac_cv_have_decl_sys_siglist" "$ac_includes_default"
+if test "x$ac_cv_have_decl_sys_siglist" = x""yes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_GPM 1
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_SYS_SIGLIST $ac_have_decl
 _ACEOF
 
+if test $ac_cv_have_decl_sys_siglist != yes; then
+  # For Tru64, at least:
+  ac_fn_c_check_decl "$LINENO" "__sys_siglist" "ac_cv_have_decl___sys_siglist" "$ac_includes_default"
+if test "x$ac_cv_have_decl___sys_siglist" = x""yes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
 fi
 
-if test "${ac_cv_header_malloc_malloc_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for malloc/malloc.h" >&5
-$as_echo_n "checking for malloc/malloc.h... " >&6; }
-if test "${ac_cv_header_malloc_malloc_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL___SYS_SIGLIST $ac_have_decl
+_ACEOF
+
+  if test $ac_cv_have_decl___sys_siglist = yes; then
+
+$as_echo "#define sys_siglist __sys_siglist" >>confdefs.h
+
+  fi
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_malloc_malloc_h" >&5
-$as_echo "$ac_cv_header_malloc_malloc_h" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sys/wait.h that is POSIX.1 compatible" >&5
+$as_echo_n "checking for sys/wait.h that is POSIX.1 compatible... " >&6; }
+if test "${ac_cv_header_sys_wait_h+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking malloc/malloc.h usability" >&5
-$as_echo_n "checking malloc/malloc.h usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
-#include <malloc/malloc.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#ifndef WEXITSTATUS
+# define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8)
+#endif
+#ifndef WIFEXITED
+# define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
+#endif
+
+int
+main ()
+{
+  int s;
+  wait (&s);
+  s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
+  ;
+  return 0;
+}
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_header_sys_wait_h=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  ac_cv_header_sys_wait_h=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_sys_wait_h" >&5
+$as_echo "$ac_cv_header_sys_wait_h" >&6; }
+if test $ac_cv_header_sys_wait_h = yes; then
+
+$as_echo "#define HAVE_SYS_WAIT_H 1" >>confdefs.h
 
-       ac_header_compiler=no
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
 
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking malloc/malloc.h presence" >&5
-$as_echo_n "checking malloc/malloc.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <malloc/malloc.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
+{ $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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
+  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
 
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
+$as_echo "#define HAVE_STRUCT_UTIMBUF 1" >>confdefs.h
 
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: malloc/malloc.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: malloc/malloc.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: malloc/malloc.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: malloc/malloc.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: malloc/malloc.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: malloc/malloc.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: malloc/malloc.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: malloc/malloc.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: malloc/malloc.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: malloc/malloc.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: malloc/malloc.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: malloc/malloc.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: malloc/malloc.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: malloc/malloc.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: malloc/malloc.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: malloc/malloc.h: in the future, the compiler will take precedence" >&2;}
+fi
 
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for malloc/malloc.h" >&5
-$as_echo_n "checking for malloc/malloc.h... " >&6; }
-if test "${ac_cv_header_malloc_malloc_h+set}" = set; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5
+$as_echo_n "checking return type of signal handlers... " >&6; }
+if test "${ac_cv_type_signal+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  ac_cv_header_malloc_malloc_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_malloc_malloc_h" >&5
-$as_echo "$ac_cv_header_malloc_malloc_h" >&6; }
-
-fi
-if test $ac_cv_header_malloc_malloc_h = yes; then
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h>
+#include <signal.h>
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_MALLOC_MALLOC_H 1
+int
+main ()
+{
+return *(signal (0, 0)) (0) == 1;
+  ;
+  return 0;
+}
 _ACEOF
-
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_type_signal=int
+else
+  ac_cv_type_signal=void
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_signal" >&5
+$as_echo "$ac_cv_type_signal" >&6; }
 
+cat >>confdefs.h <<_ACEOF
+#define RETSIGTYPE $ac_cv_type_signal
+_ACEOF
 
 
-### Use NeXTstep API to implement GUI.
-if test "${HAVE_NS}" = "yes"; then
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_NS 1
+{ $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 :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <termios.h>
+int
+main ()
+{
+speed_t x = 1;
+  ;
+  return 0;
+}
 _ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  emacs_cv_speed_t=yes
+else
+  emacs_cv_speed_t=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_speed_t" >&5
+$as_echo "$emacs_cv_speed_t" >&6; }
+if test $emacs_cv_speed_t = yes; then
 
-  if test "${NS_IMPL_COCOA}" = "yes"; then
-
-cat >>confdefs.h <<\_ACEOF
-#define NS_IMPL_COCOA 1
-_ACEOF
+$as_echo "#define HAVE_SPEED_T 1" >>confdefs.h
 
-    GNU_OBJC_CFLAGS=
-  fi
-  if test "${NS_IMPL_GNUSTEP}" = "yes"; then
+fi
 
-cat >>confdefs.h <<\_ACEOF
-#define NS_IMPL_GNUSTEP 1
+{ $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
 
-    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
-
-cat >>confdefs.h <<\_ACEOF
-#define NS_HAVE_NSINTEGER 1
-_ACEOF
+$as_echo "#define HAVE_TIMEVAL 1" >>confdefs.h
 
-  fi
-  # We also have mouse menus.
-  HAVE_MENUS=yes
-  OTHER_FILES=ns-app
 fi
 
-
-### Use session management (-lSM -lICE) if available
-HAVE_X_SM=no
-if test "${HAVE_X11}" = "yes"; then
-  if test "${ac_cv_header_X11_SM_SMlib_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for X11/SM/SMlib.h" >&5
-$as_echo_n "checking for X11/SM/SMlib.h... " >&6; }
-if test "${ac_cv_header_X11_SM_SMlib_h+set}" = set; then
+{ $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 :
   $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_X11_SM_SMlib_h" >&5
-$as_echo "$ac_cv_header_X11_SM_SMlib_h" >&6; }
 else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking X11/SM/SMlib.h usability" >&5
-$as_echo_n "checking X11/SM/SMlib.h usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
-#include <X11/SM/SMlib.h>
+#include <math.h>
+int
+main ()
+{
+static struct exception x; x.arg1 = x.arg2 = x.retval; x.name = ""; x.type = 1;
+  ;
+  return 0;
+}
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
+if ac_fn_c_try_compile "$LINENO"; then :
+  emacs_cv_struct_exception=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
+  emacs_cv_struct_exception=no
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
+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
 
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking X11/SM/SMlib.h presence" >&5
-$as_echo_n "checking X11/SM/SMlib.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <X11/SM/SMlib.h>
+$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
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-  ac_header_preproc=no
 fi
 
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
+done
 
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: X11/SM/SMlib.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: X11/SM/SMlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: X11/SM/SMlib.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: X11/SM/SMlib.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: X11/SM/SMlib.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: X11/SM/SMlib.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: X11/SM/SMlib.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: X11/SM/SMlib.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: X11/SM/SMlib.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: X11/SM/SMlib.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: X11/SM/SMlib.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: X11/SM/SMlib.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: X11/SM/SMlib.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: X11/SM/SMlib.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: X11/SM/SMlib.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: X11/SM/SMlib.h: in the future, the compiler will take precedence" >&2;}
+for ac_header in net/if.h
+do :
+  ac_fn_c_check_header_compile "$LINENO" "net/if.h" "ac_cv_header_net_if_h" "$ac_includes_default
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+"
+if test "x$ac_cv_header_net_if_h" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_NET_IF_H 1
+_ACEOF
 
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for X11/SM/SMlib.h" >&5
-$as_echo_n "checking for X11/SM/SMlib.h... " >&6; }
-if test "${ac_cv_header_X11_SM_SMlib_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_X11_SM_SMlib_h=$ac_header_preproc
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_X11_SM_SMlib_h" >&5
-$as_echo "$ac_cv_header_X11_SM_SMlib_h" >&6; }
 
-fi
-if test $ac_cv_header_X11_SM_SMlib_h = yes; then
-  { $as_echo "$as_me:$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
+done
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct tm is in sys/time.h or time.h" >&5
+$as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; }
+if test "${ac_cv_struct_tm+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lSM -lICE $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
+#include <sys/types.h>
+#include <time.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 ();
+struct tm tm;
+                                    int *p = &tm.tm_sec;
+                                    return !p;
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_SM_SmcOpenConnection=yes
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_struct_tm=time.h
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_lib_SM_SmcOpenConnection=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+  ac_cv_struct_tm=sys/time.h
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_SM_SmcOpenConnection" >&5
-$as_echo "$ac_cv_lib_SM_SmcOpenConnection" >&6; }
-if test $ac_cv_lib_SM_SmcOpenConnection = yes; then
-  HAVE_X_SM=yes
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_struct_tm" >&5
+$as_echo "$ac_cv_struct_tm" >&6; }
+if test $ac_cv_struct_tm = sys/time.h; then
 
-fi
+$as_echo "#define TM_IN_SYS_TIME 1" >>confdefs.h
 
+fi
 
+ac_fn_c_check_member "$LINENO" "struct tm" "tm_zone" "ac_cv_member_struct_tm_tm_zone" "#include <sys/types.h>
+#include <$ac_cv_struct_tm>
 
-  if test "${HAVE_X_SM}" = "yes"; then
+"
+if test "x$ac_cv_member_struct_tm_tm_zone" = x""yes; then :
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_X_SM 1
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_TM_TM_ZONE 1
 _ACEOF
 
-    case "$LIBS" in
-      *-lSM*) ;;
-      *)      LIBS="-lSM -lICE $LIBS" ;;
-    esac
-  fi
+
 fi
 
-# If netdb.h doesn't declare h_errno, we must declare it by hand.
-{ $as_echo "$as_me:$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
+if test "$ac_cv_member_struct_tm_tm_zone" = yes; then
+
+$as_echo "#define HAVE_TM_ZONE 1" >>confdefs.h
+
+else
+  ac_fn_c_check_decl "$LINENO" "tzname" "ac_cv_have_decl_tzname" "#include <time.h>
+"
+if test "x$ac_cv_have_decl_tzname" = x""yes; then :
+  ac_have_decl=1
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_TZNAME $ac_have_decl
 _ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tzname" >&5
+$as_echo_n "checking for tzname... " >&6; }
+if test "${ac_cv_var_tzname+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <netdb.h>
+#include <time.h>
+#if !HAVE_DECL_TZNAME
+extern char *tzname[];
+#endif
+
 int
 main ()
 {
-return h_errno;
+return tzname[0][0];
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  emacs_cv_netdb_declares_h_errno=yes
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_var_tzname=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  ac_cv_var_tzname=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: $ac_cv_var_tzname" >&5
+$as_echo "$ac_cv_var_tzname" >&6; }
+  if test $ac_cv_var_tzname = yes; then
 
-       emacs_cv_netdb_declares_h_errno=no
+$as_echo "#define HAVE_TZNAME 1" >>confdefs.h
+
+  fi
 fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+ac_fn_c_check_member "$LINENO" "struct tm" "tm_gmtoff" "ac_cv_member_struct_tm_tm_gmtoff" "#include <time.h>
+"
+if test "x$ac_cv_member_struct_tm_tm_gmtoff" = x""yes; then :
+
+$as_echo "#define HAVE_TM_GMTOFF 1" >>confdefs.h
+
 fi
-{ $as_echo "$as_me:$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
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_H_ERRNO 1
+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
+#include <sys/socket.h>
+#endif
+#if HAVE_NET_IF_H
+#include <net/if.h>
+#endif
+"
+if test "x$ac_cv_member_struct_ifreq_ifr_flags" = x""yes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_IFREQ_IFR_FLAGS 1
 _ACEOF
 
+
 fi
+ac_fn_c_check_member "$LINENO" "struct ifreq" "ifr_hwaddr" "ac_cv_member_struct_ifreq_ifr_hwaddr" "$ac_includes_default
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#if HAVE_NET_IF_H
+#include <net/if.h>
+#endif
+"
+if test "x$ac_cv_member_struct_ifreq_ifr_hwaddr" = x""yes; then :
 
-# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
-# for constant arguments.  Useless!
-{ $as_echo "$as_me:$LINENO: checking for working alloca.h" >&5
-$as_echo_n "checking for working alloca.h... " >&6; }
-if test "${ac_cv_working_alloca_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_IFREQ_IFR_HWADDR 1
 _ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <alloca.h>
-int
-main ()
-{
-char *p = (char *) alloca (2 * sizeof (int));
-                         if (p) return 0;
-  ;
-  return 0;
-}
+
+
+fi
+ac_fn_c_check_member "$LINENO" "struct ifreq" "ifr_netmask" "ac_cv_member_struct_ifreq_ifr_netmask" "$ac_includes_default
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#if HAVE_NET_IF_H
+#include <net/if.h>
+#endif
+"
+if test "x$ac_cv_member_struct_ifreq_ifr_netmask" = x""yes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_IFREQ_IFR_NETMASK 1
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_working_alloca_h=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-       ac_cv_working_alloca_h=no
+
 fi
+ac_fn_c_check_member "$LINENO" "struct ifreq" "ifr_broadaddr" "ac_cv_member_struct_ifreq_ifr_broadaddr" "$ac_includes_default
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#if HAVE_NET_IF_H
+#include <net/if.h>
+#endif
+"
+if test "x$ac_cv_member_struct_ifreq_ifr_broadaddr" = x""yes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_IFREQ_IFR_BROADADDR 1
+_ACEOF
+
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_working_alloca_h" >&5
-$as_echo "$ac_cv_working_alloca_h" >&6; }
-if test $ac_cv_working_alloca_h = yes; then
+ac_fn_c_check_member "$LINENO" "struct ifreq" "ifr_addr" "ac_cv_member_struct_ifreq_ifr_addr" "$ac_includes_default
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#if HAVE_NET_IF_H
+#include <net/if.h>
+#endif
+"
+if test "x$ac_cv_member_struct_ifreq_ifr_addr" = x""yes; then :
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_ALLOCA_H 1
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_IFREQ_IFR_ADDR 1
 _ACEOF
 
+
 fi
 
-{ $as_echo "$as_me:$LINENO: checking for alloca" >&5
-$as_echo_n "checking for alloca... " >&6; }
-if test "${ac_cv_func_alloca_works+set}" = set; then
+
+
+{ $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_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#ifdef __GNUC__
-# define alloca __builtin_alloca
-#else
-# ifdef _MSC_VER
-#  include <malloc.h>
-#  define alloca _alloca
-# else
-#  ifdef HAVE_ALLOCA_H
-#   include <alloca.h>
-#  else
-#   ifdef _AIX
- #pragma alloca
-#   else
-#    ifndef alloca /* predefined by HP cc +Olibcalls */
-char *alloca ();
-#    endif
-#   endif
-#  endif
-# endif
-#endif
 
 int
 main ()
 {
-char *p = (char *) alloca (1);
-                                   if (p) return 0;
+
+volatile int x;
+int * volatile y = (int *) 0;
+return !x && !y;
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_func_alloca_works=yes
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_c_volatile=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_func_alloca_works=no
+  ac_cv_c_volatile=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_alloca_works" >&5
-$as_echo "$ac_cv_func_alloca_works" >&6; }
-
-if test $ac_cv_func_alloca_works = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_ALLOCA 1
-_ACEOF
-
-else
-  # The SVR3 libPW and SVR4 libucb both contain incompatible functions
-# that cause trouble.  Some versions do not even contain alloca or
-# contain a buggy version.  If you still want to use their alloca,
-# use ar to extract alloca.o from them instead of compiling alloca.c.
-
-ALLOCA=\${LIBOBJDIR}alloca.$ac_objext
+{ $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
 
-cat >>confdefs.h <<\_ACEOF
-#define C_ALLOCA 1
-_ACEOF
+$as_echo "#define volatile /**/" >>confdefs.h
 
+fi
 
-{ $as_echo "$as_me:$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 "$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 >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#if defined CRAY && ! defined CRAY2
-webecray
-#else
-wenotbecray
+
+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 (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "webecray" >/dev/null 2>&1; then
-  ac_cv_os_cray=yes
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_c_const=yes
 else
-  ac_cv_os_cray=no
+  ac_cv_c_const=no
 fi
-rm -f conftest*
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+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
+
+$as_echo "#define const /**/" >>confdefs.h
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_os_cray" >&5
-$as_echo "$ac_cv_os_cray" >&6; }
-if test $ac_cv_os_cray = yes; then
-  for ac_func in _getb67 GETB67 getb67; do
-    as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+
+{ $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 >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* 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 $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
 
 int
 main ()
 {
-return $ac_func ();
+void * foo;
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
+if ac_fn_c_try_compile "$LINENO"; then :
+  emacs_cv_void_star=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_var=no"
+  emacs_cv_void_star=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if test `eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'` = yes; then
-
-cat >>confdefs.h <<_ACEOF
-#define CRAY_STACKSEG_END $ac_func
-_ACEOF
+{ $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
 
-    break
-fi
+else
+  $as_echo "#define POINTER_TYPE char" >>confdefs.h
 
-  done
 fi
 
-{ $as_echo "$as_me:$LINENO: checking stack direction for C alloca" >&5
-$as_echo_n "checking stack direction for C alloca... " >&6; }
-if test "${ac_cv_c_stack_direction+set}" = set; then
+ { $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
-  if test "$cross_compiling" = yes; then
-  ac_cv_c_stack_direction=0
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+  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
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_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.  */
-$ac_includes_default
+#include <sys/types.h>
+            #include <sys/param.h>
+
 int
-find_stack_direction ()
+main ()
 {
-  static char *addr = 0;
-  auto char dummy;
-  if (addr == 0)
-    {
-      addr = &dummy;
-      return find_stack_direction ();
-    }
-  else
-    return (&dummy > addr) ? 1 : -1;
+#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 ()
 {
-  return find_stack_direction () < 0;
+#if BYTE_ORDER != BIG_ENDIAN
+                not big endian
+               #endif
+
+  ;
+  return 0;
 }
 _ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_c_stack_direction=1
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_c_bigendian=yes
 else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-ac_cv_c_stack_direction=-1
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-
-
-fi
-{ $as_echo "$as_me:$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
-
-
+  ac_cv_c_bigendian=no
 fi
-
-
-if test x"$ac_cv_func_alloca_works" != xyes; then
-   { { $as_echo "$as_me:$LINENO: error: a system implementation of alloca is required " >&5
-$as_echo "$as_me: error: a system implementation of alloca is required " >&2;}
-   { (exit 1); exit 1; }; }
+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>
 
-# fmod, logb, and frexp are found in -lm on most systems.
-# On HPUX 9.01, -lm does not contain logb, so check for sqrt.
+int
+main ()
+{
+#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN)
+             bogus endian macros
+            #endif
 
-{ $as_echo "$as_me:$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 >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+  ;
+  return 0;
+}
 _ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_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>
 
-/* 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 ();
 int
 main ()
 {
-return sqrt ();
+#ifndef _BIG_ENDIAN
+                not big endian
+               #endif
+
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_m_sqrt=yes
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_c_bigendian=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_lib_m_sqrt=no
+  ac_cv_c_bigendian=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      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:$LINENO: result: $ac_cv_lib_m_sqrt" >&5
-$as_echo "$ac_cv_lib_m_sqrt" >&6; }
-if test $ac_cv_lib_m_sqrt = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBM 1
-_ACEOF
-
-  LIBS="-lm $LIBS"
+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
-
-
-# Check for mail-locking functions in a "mail" library.  Probably this should
-# have the same check as for liblockfile below.
-
-{ $as_echo "$as_me:$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
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lmail  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  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 ();
+$ac_includes_default
 int
 main ()
 {
-return maillock ();
+
+            /* 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
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_mail_maillock=yes
+if ac_fn_c_try_run "$LINENO"; then :
+  ac_cv_c_bigendian=no
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_lib_mail_maillock=no
+  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
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+    fi
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_mail_maillock" >&5
-$as_echo "$ac_cv_lib_mail_maillock" >&6; }
-if test $ac_cv_lib_mail_maillock = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBMAIL 1
-_ACEOF
+{ $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
 
-  LIBS="-lmail $LIBS"
+     ;; #(
+   *)
+     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 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
 
 
-{ $as_echo "$as_me:$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="-llockfile  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+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 --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"
+      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 ();
 int
 main ()
 {
-return maillock ();
+
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_lockfile_maillock=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+if ac_fn_c_try_compile "$LINENO"; then :
 
-       ac_cv_lib_lockfile_maillock=no
+else
+  ac_enable_autodepend=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+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'
+      ## In parallel builds, another make might create depdir between
+      ## the first test and mkdir, so stick another test on the end.
+      ## Or use mkinstalldirs?  mkdir -p is not portable.
+      MKDEPDIR='test -d ${DEPDIR} || mkdir ${DEPDIR} || test -d ${DEPDIR}'
+      deps_frag=autodeps.mk
+   fi
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_lockfile_maillock" >&5
-$as_echo "$ac_cv_lib_lockfile_maillock" >&6; }
-if test $ac_cv_lib_lockfile_maillock = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBLOCKFILE 1
-_ACEOF
+deps_frag=$srcdir/src/$deps_frag
 
-  LIBS="-llockfile $LIBS"
 
-fi
 
-# 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.
-if test "$ac_cv_lib_lockfile_maillock" = no; then
-      # 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:$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 "$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
-  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:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
+  ac_cv_sys_long_file_names=yes
+# Test for long file names in all the places we know might matter:
+#      .               the current directory, where building will happen
+#      $prefix/lib     where we will be installing things
+#      $exec_prefix/lib        likewise
+#      $TMPDIR         if set, where it might want to write temporary files
+#      /tmp            where it might want to write temporary files
+#      /var/tmp                likewise
+#      /usr/tmp                likewise
+for ac_dir in . "$TMPDIR" /tmp /var/tmp /usr/tmp "$prefix/lib" "$exec_prefix/lib"; do
+  # Skip $TMPDIR if it is empty or bogus, and skip $exec_prefix/lib
+  # in the usual case where exec_prefix is '${prefix}'.
+  case $ac_dir in #(
+    . | /* | ?:[\\/]*) ;; #(
+    *) continue;;
+  esac
+  test -w "$ac_dir/." || continue # It is less confusing to not echo anything here.
+  ac_xdir=$ac_dir/cf$$
+  (umask 077 && mkdir "$ac_xdir" 2>/dev/null) || continue
+  ac_tf1=$ac_xdir/conftest9012345
+  ac_tf2=$ac_xdir/conftest9012346
+  touch "$ac_tf1" 2>/dev/null && test -f "$ac_tf1" && test ! -f "$ac_tf2" ||
+    ac_cv_sys_long_file_names=no
+  rm -f -r "$ac_xdir" 2>/dev/null
+  test $ac_cv_sys_long_file_names = no && break
 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:$LINENO: result: $liblockfile" >&5
-$as_echo "$liblockfile" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_long_file_names" >&5
+$as_echo "$ac_cv_sys_long_file_names" >&6; }
+if test $ac_cv_sys_long_file_names = yes; then
+
+$as_echo "#define HAVE_LONG_FILE_NAMES 1" >>confdefs.h
+
 fi
 
 
-  if test $ac_cv_prog_liblockfile = yes; then
-    { { $as_echo "$as_me:$LINENO: 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." >&5
-$as_echo "$as_me: 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." >&2;}
-   { (exit 1); exit 1; }; }
-  else :
-  fi
+#### Choose a window system.
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for X" >&5
+$as_echo_n "checking for X... " >&6; }
+
+
+# Check whether --with-x was given.
+if test "${with_x+set}" = set; then :
+  withval=$with_x;
 fi
 
-for ac_func in touchlock
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+# $have_x is `yes', `no', `disabled', or empty when we do not yet know.
+if test "x$with_x" = xno; then
+  # The user explicitly disabled X.
+  have_x=disabled
+else
+  case $x_includes,$x_libraries in #(
+    *\'*) as_fn_error "cannot use X directory names containing '" "$LINENO" 5;; #(
+    *,NONE | NONE,*) if test "${ac_cv_have_x+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+  # One or both of the vars are not set, and there is no cached value.
+ac_x_includes=no ac_x_libraries=no
+rm -f -r conftest.dir
+if mkdir conftest.dir; then
+  cd conftest.dir
+  cat >Imakefile <<'_ACEOF'
+incroot:
+       @echo incroot='${INCROOT}'
+usrlibdir:
+       @echo usrlibdir='${USRLIBDIR}'
+libdir:
+       @echo libdir='${LIBDIR}'
 _ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
+  if (export CC; ${XMKMF-xmkmf}) >/dev/null 2>/dev/null && test -f Makefile; then
+    # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+    for ac_var in incroot usrlibdir libdir; do
+      eval "ac_im_$ac_var=\`\${MAKE-make} $ac_var 2>/dev/null | sed -n 's/^$ac_var=//p'\`"
+    done
+    # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR.
+    for ac_extension in a so sl dylib la dll; do
+      if test ! -f "$ac_im_usrlibdir/libX11.$ac_extension" &&
+        test -f "$ac_im_libdir/libX11.$ac_extension"; then
+       ac_im_usrlibdir=$ac_im_libdir; break
+      fi
+    done
+    # Screen out bogus values from the imake configuration.  They are
+    # bogus both because they are the default anyway, and because
+    # using them would break gcc on systems where it needs fixed includes.
+    case $ac_im_incroot in
+       /usr/include) ac_x_includes= ;;
+       *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;;
+    esac
+    case $ac_im_usrlibdir in
+       /usr/lib | /usr/lib64 | /lib | /lib64) ;;
+       *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;;
+    esac
+  fi
+  cd ..
+  rm -f -r conftest.dir
+fi
 
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
+# Standard set of common directories for X headers.
+# Check X11 before X11Rn because it is often a symlink to the current release.
+ac_x_header_dirs='
+/usr/X11/include
+/usr/X11R7/include
+/usr/X11R6/include
+/usr/X11R5/include
+/usr/X11R4/include
 
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
+/usr/include/X11
+/usr/include/X11R7
+/usr/include/X11R6
+/usr/include/X11R5
+/usr/include/X11R4
 
-#undef $ac_func
+/usr/local/X11/include
+/usr/local/X11R7/include
+/usr/local/X11R6/include
+/usr/local/X11R5/include
+/usr/local/X11R4/include
 
-/* 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 $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
+/usr/local/include/X11
+/usr/local/include/X11R7
+/usr/local/include/X11R6
+/usr/local/include/X11R5
+/usr/local/include/X11R4
+
+/usr/X386/include
+/usr/x386/include
+/usr/XFree86/include/X11
+
+/usr/include
+/usr/local/include
+/usr/unsupported/include
+/usr/athena/include
+/usr/local/x11r5/include
+/usr/lpp/Xamples/include
+
+/usr/openwin/include
+/usr/openwin/share/include'
+
+if test "$ac_x_includes" = no; then
+  # Guess where to find include files, by looking for Xlib.h.
+  # First, try using that file with no special directory specified.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <X11/Xlib.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  # We can compile using X headers with no special include directory.
+ac_x_includes=
+else
+  for ac_dir in $ac_x_header_dirs; do
+  if test -r "$ac_dir/X11/Xlib.h"; then
+    ac_x_includes=$ac_dir
+    break
+  fi
+done
+fi
+rm -f conftest.err conftest.$ac_ext
+fi # $ac_x_includes = no
 
+if test "$ac_x_libraries" = no; then
+  # Check for the libraries.
+  # See if we find them without any special options.
+  # Don't add to $LIBS permanently.
+  ac_save_LIBS=$LIBS
+  LIBS="-lX11 $LIBS"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <X11/Xlib.h>
 int
 main ()
 {
-return $ac_func ();
+XrmInitialize ()
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
+if ac_fn_c_try_link "$LINENO"; then :
+  LIBS=$ac_save_LIBS
+# We can link X programs with no special library path.
+ac_x_libraries=
+else
+  LIBS=$ac_save_LIBS
+for ac_dir in `$as_echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g`
+do
+  # Don't even attempt the hair of trying to link an X program!
+  for ac_extension in a so sl dylib la dll; do
+    if test -r "$ac_dir/libX11.$ac_extension"; then
+      ac_x_libraries=$ac_dir
+      break 2
+    fi
+  done
+done
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi # $ac_x_libraries = no
+
+case $ac_x_includes,$ac_x_libraries in #(
+  no,* | *,no | *\'*)
+    # Didn't find X, or a directory has "'" in its name.
+    ac_cv_have_x="have_x=no";; #(
+  *)
+    # Record where we found X for the cache.
+    ac_cv_have_x="have_x=yes\
+       ac_x_includes='$ac_x_includes'\
+       ac_x_libraries='$ac_x_libraries'"
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
+fi
+;; #(
+    *) have_x=yes;;
+  esac
+  eval "$ac_cv_have_x"
+fi # $with_x != no
+
+if test "$have_x" != yes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_x" >&5
+$as_echo "$have_x" >&6; }
+  no_x=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  # If each of the values was on the command line, it overrides each guess.
+  test "x$x_includes" = xNONE && x_includes=$ac_x_includes
+  test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries
+  # Update the cache value to reflect the command line values.
+  ac_cv_have_x="have_x=yes\
+       ac_x_includes='$x_includes'\
+       ac_x_libraries='$x_libraries'"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: libraries $x_libraries, headers $x_includes" >&5
+$as_echo "libraries $x_libraries, headers $x_includes" >&6; }
+fi
 
-       eval "$as_ac_var=no"
+if test "$no_x" = yes; then
+  window_system=none
+else
+  window_system=x11
 fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+## 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
-ac_res=`eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if test `eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
 
+LD_SWITCH_X_SITE_AUX=
+LD_SWITCH_X_SITE_AUX_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,/'`
+  fi
+  x_default_search_path=""
+  x_search_path=${x_libraries}
+  if test -z "${x_search_path}"; then
+    x_search_path=/usr/lib
+  fi
+  for x_library in `echo ${x_search_path}: | \
+                   sed -e "s/:/ /g" -e p -e "s:/lib[^ /]* :/share :g"`; do
+    x_search_path="\
+${x_library}/X11/%L/%T/%N%C%S:\
+${x_library}/X11/%l/%T/%N%C%S:\
+${x_library}/X11/%T/%N%C%S:\
+${x_library}/X11/%L/%T/%N%S:\
+${x_library}/X11/%l/%T/%N%S:\
+${x_library}/X11/%T/%N%S"
+    if test x"${x_default_search_path}" = x; then
+      x_default_search_path=${x_search_path}
+    else
+      x_default_search_path="${x_search_path}:${x_default_search_path}"
+    fi
+  done
 fi
-done
 
 
-for ac_header in maillock.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
+
+if test "${x_includes}" != NONE && test -n "${x_includes}"; then
+  C_SWITCH_X_SITE=-I`echo ${x_includes} | sed -e "s/:/ -I/g"`
 fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
+
+if test x"${x_includes}" = x; then
+  bitmapdir=/usr/include/X11/bitmaps
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  # accumulate include directories that have X11 bitmap subdirectories
+  bmd_acc="dummyval"
+  for bmd in `echo ${x_includes} | sed -e "s/:/ /g"`; do
+    if test -d "${bmd}/X11/bitmaps"; then
+      bmd_acc="${bmd_acc}:${bmd}/X11/bitmaps"
+    fi
+    if test -d "${bmd}/bitmaps"; then
+      bmd_acc="${bmd_acc}:${bmd}/bitmaps"
+    fi
+  done
+  if test ${bmd_acc} != "dummyval"; then
+    bitmapdir=`echo ${bmd_acc} | sed -e "s/^dummyval://"`
+  fi
+fi
 
-       ac_header_compiler=no
+HAVE_NS=no
+NS_IMPL_COCOA=no
+NS_IMPL_GNUSTEP=no
+tmp_CPPFLAGS="$CPPFLAGS"
+tmp_CFLAGS="$CFLAGS"
+CPPFLAGS="$CPPFLAGS -x objective-c"
+CFLAGS="$CFLAGS -x objective-c"
+TEMACS_LDFLAGS2="\${LDFLAGS} \${PROFILING_LDFLAGS}"
+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_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_appresdir=${ns_appdir}Resources
+     ns_appsrc=${srcdir}/nextstep/GNUstep/Emacs.base
+          GNUSTEP_SYSTEM_HEADERS="$(. $GNUSTEP_CONFIG_FILE; echo $GNUSTEP_SYSTEM_HEADERS)"
+     GNUSTEP_SYSTEM_LIBRARIES="$(. $GNUSTEP_CONFIG_FILE; echo $GNUSTEP_SYSTEM_LIBRARIES)"
+          GNUSTEP_LOCAL_HEADERS="$(. $GNUSTEP_CONFIG_FILE; echo $GNUSTEP_LOCAL_HEADERS)"
+     GNUSTEP_LOCAL_LIBRARIES="$(. $GNUSTEP_CONFIG_FILE; echo $GNUSTEP_LOCAL_LIBRARIES)"
+     test "x${GNUSTEP_LOCAL_HEADERS}" != "x" && \
+       GNUSTEP_LOCAL_HEADERS="-I${GNUSTEP_LOCAL_HEADERS}"
+     test "x${GNUSTEP_LOCAL_LIBRARIES}" != "x" && \
+       GNUSTEP_LOCAL_LIBRARIES="-L${GNUSTEP_LOCAL_LIBRARIES}"
+     CPPFLAGS="$CPPFLAGS -I${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}"
+     CFLAGS="$CFLAGS -I${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}"
+     LDFLAGS="$LDFLAGS -L${GNUSTEP_SYSTEM_LIBRARIES} ${GNUSTEP_LOCAL_LIBRARIES}"
+     LIB_STANDARD=
+     START_FILES=
+     TEMACS_LDFLAGS2=
+  fi
+  ac_fn_c_check_header_mongrel "$LINENO" "AppKit/AppKit.h" "ac_cv_header_AppKit_AppKit_h" "$ac_includes_default"
+if test "x$ac_cv_header_AppKit_AppKit_h" = x""yes; then :
+  HAVE_NS=yes
+else
+  as_fn_error "\`--with-ns' was specified, but the include
+  files are missing or cannot be compiled." "$LINENO" 5
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
 
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  NS_HAVE_NSINTEGER=yes
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <$ac_header>
+#include <Foundation/NSObjCRuntime.h>
+int
+main ()
+{
+NSInteger i;
+  ;
+  return 0;
+}
 _ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
+if ac_fn_c_try_compile "$LINENO"; then :
+  ns_have_nsinteger=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  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
+  fi
+fi
 
-  ac_header_preproc=no
+
+ns_frag=/dev/null
+NS_OBJ=
+NS_SUPPORT=
+if test "${HAVE_NS}" = yes; then
+  window_system=nextstep
+  with_xft=no
+  # set up packaging dirs
+  exec_prefix=${ns_appbindir}
+  libexecdir=${ns_appbindir}/libexec
+  if test "${EN_NS_SELF_CONTAINED}" = yes; then
+     prefix=${ns_appresdir}
+  fi
+  ns_frag=$srcdir/src/ns.mk
+  NS_OBJ="nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o fontset.o fringe.o image.o"
+  NS_SUPPORT="\${lispsource}emacs-lisp/easymenu.elc \${lispsource}term/ns-win.elc"
 fi
+CFLAGS="$tmp_CFLAGS"
+CPPFLAGS="$tmp_CPPFLAGS"
 
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
 
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
 
-    ;;
+
+
+case "${window_system}" in
+  x11 )
+    HAVE_X_WINDOWS=yes
+    HAVE_X11=yes
+    case "${with_x_toolkit}" in
+      athena | lucid ) USE_X_TOOLKIT=LUCID ;;
+      motif ) USE_X_TOOLKIT=MOTIF ;;
+      gtk ) with_gtk=yes
+            USE_X_TOOLKIT=none ;;
+      gtk3 ) with_gtk3=yes
+             USE_X_TOOLKIT=none ;;
+      no ) USE_X_TOOLKIT=none ;;
+      * ) USE_X_TOOLKIT=maybe ;;
+    esac
+  ;;
+  nextstep | none )
+    HAVE_X_WINDOWS=no
+    HAVE_X11=no
+    USE_X_TOOLKIT=none
+  ;;
 esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+
+if test "$window_system" = none && test "X$with_x" != "Xno"; then
+   # Extract the first word of "X", so it can be a program name with args.
+set dummy X; 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_HAVE_XSERVER+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
+  if test -n "$HAVE_XSERVER"; then
+  ac_cv_prog_HAVE_XSERVER="$HAVE_XSERVER" # 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_HAVE_XSERVER="true"
+    $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_HAVE_XSERVER" && ac_cv_prog_HAVE_XSERVER="false"
 fi
-if test `eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
 fi
-
-done
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+HAVE_XSERVER=$ac_cv_prog_HAVE_XSERVER
+if test -n "$HAVE_XSERVER"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HAVE_XSERVER" >&5
+$as_echo "$HAVE_XSERVER" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
 
+   if test "$HAVE_XSERVER" = true ||
+      test -n "$DISPLAY" ||
+      test "`echo /usr/lib/libX11.*`" != "/usr/lib/libX11.*"; then
+        as_fn_error "You seem to be running X, but no X development libraries
+were found.  You should install the relevant development files for X
+and for the toolkit you want, such as Gtk+, Lesstif or Motif.  Also make
+sure you have development files for image handling, i.e.
+tiff, gif, jpeg, png and xpm.
+If you are sure you want Emacs compiled without X window support, pass
+  --without-x
+to configure." "$LINENO" 5
+   fi
+fi
 
+### If we're using X11, we should use the X menu package.
+HAVE_MENUS=no
+case ${HAVE_X11} in
+  yes ) HAVE_MENUS=yes ;;
+esac
 
+# Do the opsystem or machine files 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_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+extern void (* __after_morecore_hook)();
+int
+main ()
+{
+__after_morecore_hook = 0
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  emacs_cv_var___after_morecore_hook=yes
+else
+  emacs_cv_var___after_morecore_hook=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
 
 
+system_malloc=no
+case "$opsys" in
+  ## darwin ld insists on the use of malloc routines in the System framework.
+  darwin|sol2-10) system_malloc=yes ;;
+esac
 
+if test "${system_malloc}" = "yes"; then
 
+$as_echo "#define SYSTEM_MALLOC 1" >>confdefs.h
 
+  GNU_MALLOC=no
+  GNU_MALLOC_reason="
+    (The GNU allocators don't work with this system configuration.)"
+  GMALLOC_OBJ=
+  VMLIMIT_OBJ=
+else
+  test "$doug_lea_malloc" != "yes" && GMALLOC_OBJ=gmalloc.o
+  VMLIMIT_OBJ=vm-limit.o
+fi
 
 
 
+if test "$doug_lea_malloc" = "yes" ; then
+  if test "$GNU_MALLOC" = yes ; then
+    GNU_MALLOC_reason="
+      (Using Doug Lea's new malloc from the GNU C Library.)"
+  fi
 
+$as_echo "#define DOUG_LEA_MALLOC 1" >>confdefs.h
 
 
+  ## Use mmap directly for allocating larger buffers.
+  ## FIXME this comes from src/s/{gnu,gnu-linux}.h:
+  ## #ifdef DOUG_LEA_MALLOC; #undef REL_ALLOC; #endif
+  ## Does the AC_FUNC_MMAP test below make this check unecessary?
+  case "$opsys" in
+    gnu*) REL_ALLOC=no ;;
+  esac
+fi
 
+if test x"${REL_ALLOC}" = x; then
+  REL_ALLOC=${GNU_MALLOC}
+fi
 
+use_mmap_for_buffers=no
+case "$opsys" in
+  freebsd|irix6-5) use_mmap_for_buffers=yes ;;
+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
 
 
 
@@ -17188,531 +7944,499 @@ done
 
 
 
+for ac_func in getpagesize
+do :
+  ac_fn_c_check_func "$LINENO" "getpagesize" "ac_cv_func_getpagesize"
+if test "x$ac_cv_func_getpagesize" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_GETPAGESIZE 1
+_ACEOF
 
+fi
+done
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working mmap" >&5
+$as_echo_n "checking for working mmap... " >&6; }
+if test "${ac_cv_func_mmap_fixed_mapped+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "$cross_compiling" = yes; then :
+  ac_cv_func_mmap_fixed_mapped=no
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$ac_includes_default
+/* malloc might have been renamed as rpl_malloc. */
+#undef malloc
 
+/* Thanks to Mike Haertel and Jim Avera for this test.
+   Here is a matrix of mmap possibilities:
+       mmap private not fixed
+       mmap private fixed at somewhere currently unmapped
+       mmap private fixed at somewhere already mapped
+       mmap shared not fixed
+       mmap shared fixed at somewhere currently unmapped
+       mmap shared fixed at somewhere already mapped
+   For private mappings, we should verify that changes cannot be read()
+   back from the file, nor mmap's back from the file at a different
+   address.  (There have been systems where private was not correctly
+   implemented like the infamous i386 svr4.0, and systems where the
+   VM page cache was not coherent with the file system buffer cache
+   like early versions of FreeBSD and possibly contemporary NetBSD.)
+   For shared mappings, we should conversely verify that changes get
+   propagated back to all the places they're supposed to be.
 
+   Grep wants private fixed already mapped.
+   The main things grep needs to know about mmap are:
+   * does it exist and is it safe to write into the mmap'd area
+   * how to use it (BSD variants)  */
 
+#include <fcntl.h>
+#include <sys/mman.h>
 
+#if !defined STDC_HEADERS && !defined HAVE_STDLIB_H
+char *malloc ();
+#endif
 
+/* This mess was copied from the GNU getpagesize.h.  */
+#ifndef HAVE_GETPAGESIZE
+# ifdef _SC_PAGESIZE
+#  define getpagesize() sysconf(_SC_PAGESIZE)
+# else /* no _SC_PAGESIZE */
+#  ifdef HAVE_SYS_PARAM_H
+#   include <sys/param.h>
+#   ifdef EXEC_PAGESIZE
+#    define getpagesize() EXEC_PAGESIZE
+#   else /* no EXEC_PAGESIZE */
+#    ifdef NBPG
+#     define getpagesize() NBPG * CLSIZE
+#     ifndef CLSIZE
+#      define CLSIZE 1
+#     endif /* no CLSIZE */
+#    else /* no NBPG */
+#     ifdef NBPC
+#      define getpagesize() NBPC
+#     else /* no NBPC */
+#      ifdef PAGESIZE
+#       define getpagesize() PAGESIZE
+#      endif /* PAGESIZE */
+#     endif /* no NBPC */
+#    endif /* no NBPG */
+#   endif /* no EXEC_PAGESIZE */
+#  else /* no HAVE_SYS_PARAM_H */
+#   define getpagesize() 8192  /* punt totally */
+#  endif /* no HAVE_SYS_PARAM_H */
+# endif /* no _SC_PAGESIZE */
 
+#endif /* no HAVE_GETPAGESIZE */
 
+int
+main ()
+{
+  char *data, *data2, *data3;
+  const char *cdata2;
+  int i, pagesize;
+  int fd, fd2;
 
+  pagesize = getpagesize ();
 
+  /* First, make a file with some known garbage in it. */
+  data = (char *) malloc (pagesize);
+  if (!data)
+    return 1;
+  for (i = 0; i < pagesize; ++i)
+    *(data + i) = rand ();
+  umask (0);
+  fd = creat ("conftest.mmap", 0600);
+  if (fd < 0)
+    return 2;
+  if (write (fd, data, pagesize) != pagesize)
+    return 3;
+  close (fd);
 
+  /* Next, check that the tail of a page is zero-filled.  File must have
+     non-zero length, otherwise we risk SIGBUS for entire page.  */
+  fd2 = open ("conftest.txt", O_RDWR | O_CREAT | O_TRUNC, 0600);
+  if (fd2 < 0)
+    return 4;
+  cdata2 = "";
+  if (write (fd2, cdata2, 1) != 1)
+    return 5;
+  data2 = (char *) mmap (0, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd2, 0L);
+  if (data2 == MAP_FAILED)
+    return 6;
+  for (i = 0; i < pagesize; ++i)
+    if (*(data2 + i))
+      return 7;
+  close (fd2);
+  if (munmap (data2, pagesize))
+    return 8;
 
+  /* Next, try to mmap the file at a fixed address which already has
+     something else allocated at it.  If we can, also make sure that
+     we see the same garbage.  */
+  fd = open ("conftest.mmap", O_RDWR);
+  if (fd < 0)
+    return 9;
+  if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE,
+                    MAP_PRIVATE | MAP_FIXED, fd, 0L))
+    return 10;
+  for (i = 0; i < pagesize; ++i)
+    if (*(data + i) != *(data2 + i))
+      return 11;
 
+  /* Finally, make sure that changes to the mapped area do not
+     percolate back to the file as seen by read().  (This is a bug on
+     some variants of i386 svr4.0.)  */
+  for (i = 0; i < pagesize; ++i)
+    *(data2 + i) = *(data2 + i) + 1;
+  data3 = (char *) malloc (pagesize);
+  if (!data3)
+    return 12;
+  if (read (fd, data3, pagesize) != pagesize)
+    return 13;
+  for (i = 0; i < pagesize; ++i)
+    if (*(data + i) != *(data3 + i))
+      return 14;
+  close (fd);
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  ac_cv_func_mmap_fixed_mapped=yes
+else
+  ac_cv_func_mmap_fixed_mapped=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: $ac_cv_func_mmap_fixed_mapped" >&5
+$as_echo "$ac_cv_func_mmap_fixed_mapped" >&6; }
+if test $ac_cv_func_mmap_fixed_mapped = yes; then
 
+$as_echo "#define HAVE_MMAP 1" >>confdefs.h
 
+fi
+rm -f conftest.mmap conftest.txt
 
+if test $use_mmap_for_buffers = yes; then
 
+$as_echo "#define USE_MMAP_FOR_BUFFERS 1" >>confdefs.h
 
+  REL_ALLOC=no
+fi
 
+LIBS="$LIBS_SYSTEM $LIBS"
 
-for ac_func in gethostname getdomainname dup2 \
-rename closedir mkdir rmdir sysinfo getrusage get_current_dir_name \
-random lrand48 bcopy bcmp logb frexp fmod rint cbrt ftime setsid \
-strerror fpathconf select mktime euidaccess getpagesize tzset setlocale \
-utimes getrlimit setrlimit setpgid getcwd getwd shutdown getaddrinfo \
-__fpending mblen mbrlen mbsinit strsignal setitimer ualarm index rindex \
-sendto recvfrom getsockopt setsockopt getsockname getpeername \
-gai_strerror mkstemp getline getdelim mremap memmove fsync sync bzero \
-memset memcmp difftime memcpy mempcpy mblen mbrlen posix_memalign \
-cfmakeraw cfsetspeed
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dnet_ntoa in -ldnet" >&5
+$as_echo_n "checking for dnet_ntoa in -ldnet... " >&6; }
+if test "${ac_cv_lib_dnet_dnet_ntoa+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldnet  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
 
 /* 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 $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
+   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 dnet_ntoa ();
 int
 main ()
 {
-return $ac_func ();
+return dnet_ntoa ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_dnet_dnet_ntoa=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_var=no"
+  ac_cv_lib_dnet_dnet_ntoa=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
 fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if test `eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'` = yes; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dnet_dnet_ntoa" >&5
+$as_echo "$ac_cv_lib_dnet_dnet_ntoa" >&6; }
+if test "x$ac_cv_lib_dnet_dnet_ntoa" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define HAVE_LIBDNET 1
 _ACEOF
 
-fi
-done
+  LIBS="-ldnet $LIBS"
 
+fi
 
 
-for ac_header in sys/un.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lXbsd" >&5
+$as_echo_n "checking for main in -lXbsd... " >&6; }
+if test "${ac_cv_lib_Xbsd_main+set}" = set; then :
   $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
 else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lXbsd  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
 
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
+int
+main ()
+{
+return main ();
+  ;
+  return 0;
+}
 _ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_Xbsd_main=yes
 else
-  eval "$as_ac_Header=\$ac_header_preproc"
+  ac_cv_lib_Xbsd_main=no
 fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
 fi
-if test `eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xbsd_main" >&5
+$as_echo "$ac_cv_lib_Xbsd_main" >&6; }
+if test "x$ac_cv_lib_Xbsd_main" = x""yes; then :
+  LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE -lXbsd"
 fi
 
-done
-
-
-
-
 
-
-for ac_header in $ac_header_list
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for cma_open in -lpthreads" >&5
+$as_echo_n "checking for cma_open in -lpthreads... " >&6; }
+if test "${ac_cv_lib_pthreads_cma_open+set}" = set; then :
   $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
 else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lpthreads  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
+/* 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 cma_open ();
+int
+main ()
+{
+return cma_open ();
+  ;
+  return 0;
+}
 _ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_pthreads_cma_open=yes
 else
-  eval "$as_ac_Header=\$ac_header_preproc"
+  ac_cv_lib_pthreads_cma_open=no
 fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
 fi
-if test `eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'` = yes; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthreads_cma_open" >&5
+$as_echo "$ac_cv_lib_pthreads_cma_open" >&6; }
+if test "x$ac_cv_lib_pthreads_cma_open" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define HAVE_LIBPTHREADS 1
 _ACEOF
 
+  LIBS="-lpthreads $LIBS"
+
 fi
 
-done
 
+## Note: when using cpp in s/aix4.2.h, this definition depended on
+## HAVE_LIBPTHREADS.  That was not defined earlier in configure when
+## the system file was sourced.  Hence the value of LIBS_SYSTEM
+## added to LIBS in configure would never contain the pthreads part,
+## but the value used in Makefiles might.  FIXME?
+##
+## -lpthreads seems to be necessary for Xlib in X11R6, and should
+## be harmless on older versions of X where it happens to exist.
+test "$opsys" = "aix4-2" && \
+  test $ac_cv_lib_pthreads_cma_open = yes && \
+  LIBS_SYSTEM="$LIBS_SYSTEM -lpthreads"
 
 
+case ${host_os} in
+aix*)
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -bbigtoc option" >&5
+$as_echo_n "checking for -bbigtoc option... " >&6; }
+if test "${gdb_cv_bigtoc+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
 
+    case $GCC in
+    yes) gdb_cv_bigtoc=-Wl,-bbigtoc ;;
+    *) gdb_cv_bigtoc=-bbigtoc ;;
+    esac
 
+    LDFLAGS=$LDFLAGS\ $gdb_cv_bigtoc
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
+int
+main ()
+{
+int i;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
 
+else
+  gdb_cv_bigtoc=
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gdb_cv_bigtoc" >&5
+$as_echo "$gdb_cv_bigtoc" >&6; }
+  ;;
+esac
 
-for ac_func in $ac_func_list
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
+# Change CFLAGS and CPPFLAGS temporarily so that C_SWITCH_X_SITE gets
+# used for the tests that follow.  We set them back to REAL_CFLAGS and
+# REAL_CPPFLAGS later on.
 
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
+REAL_CFLAGS="$CFLAGS"
+REAL_CPPFLAGS="$CPPFLAGS"
 
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
+if test "${HAVE_X11}" = "yes"; then
+  DEFS="$C_SWITCH_X_SITE $DEFS"
+  LDFLAGS="$LDFLAGS $LD_SWITCH_X_SITE"
+  LIBS="-lX11 $LIBS"
+  CFLAGS="$C_SWITCH_X_SITE $CFLAGS"
+  CPPFLAGS="$C_SWITCH_X_SITE $CPPFLAGS"
 
-#undef $ac_func
+  # 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.
+  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
+  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 $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
+  if test "${opsys}" = "gnu-linux"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether X on GNU/Linux needs -b to link" >&5
+$as_echo_n "checking whether X on GNU/Linux needs -b to link... " >&6; }
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
 int
 main ()
 {
-return $ac_func ();
+XOpenDisplay ("foo");
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
+if ac_fn_c_try_link "$LINENO"; then :
+  xlinux_first_failure=no
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  xlinux_first_failure=yes
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+    if test "${xlinux_first_failure}" = "yes"; then
+      OLD_LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE"
+      OLD_C_SWITCH_X_SITE="$C_SWITCH_X_SITE"
+      OLD_CPPFLAGS="$CPPFLAGS"
+      OLD_LIBS="$LIBS"
+      LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE -b i486-linuxaout"
+      C_SWITCH_X_SITE="$C_SWITCH_X_SITE -b i486-linuxaout"
+      CPPFLAGS="$CPPFLAGS -b i486-linuxaout"
+      LIBS="$LIBS -b i486-linuxaout"
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-       eval "$as_ac_var=no"
+int
+main ()
+{
+XOpenDisplay ("foo");
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  xlinux_second_failure=no
+else
+  xlinux_second_failure=yes
 fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+      if test "${xlinux_second_failure}" = "yes"; then
+       # If we get the same failure with -b, there is no use adding -b.
+       # So take it out.  This plays safe.
+       LD_SWITCH_X_SITE="$OLD_LD_SWITCH_X_SITE"
+       C_SWITCH_X_SITE="$OLD_C_SWITCH_X_SITE"
+       CPPFLAGS="$OLD_CPPFLAGS"
+       LIBS="$OLD_LIBS"
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+      else
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+      fi
+    else
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+    fi
+  fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+  # Reportedly, some broken Solaris systems have XKBlib.h but are missing
+  # header files included from there.
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Xkb" >&5
+$as_echo_n "checking for Xkb... " >&6; }
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <X11/Xlib.h>
+#include <X11/XKBlib.h>
+int
+main ()
+{
+XkbDescPtr kb = XkbGetKeyboard (0, XkbAllComponentsMask, XkbUseCoreKbd);
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  emacs_xkb=yes
+else
+  emacs_xkb=no
 fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if test `eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'` = yes; then
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_xkb" >&5
+$as_echo "$emacs_xkb" >&6; }
+  if test $emacs_xkb = yes; then
+
+$as_echo "#define HAVE_XKBGETKEYBOARD 1" >>confdefs.h
+
+  fi
+
+  for ac_func in XrmSetDatabase XScreenResourceString \
+XScreenNumberOfScreen XSetWMProtocols
+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
@@ -17720,1125 +8444,611 @@ _ACEOF
 fi
 done
 
+fi
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-{ $as_echo "$as_me:$LINENO: checking for working mktime" >&5
-$as_echo_n "checking for working mktime... " >&6; }
-if test "${ac_cv_func_working_mktime+set}" = set; then
+if test "${window_system}" = "x11"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking X11 version 6" >&5
+$as_echo_n "checking X11 version 6... " >&6; }
+  if test "${emacs_cv_x11_version_6+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  if test "$cross_compiling" = yes; then
-  ac_cv_func_working_mktime=no
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-/* Test program from Paul Eggert and Tony Leneis.  */
-#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 <limits.h>
-#include <stdlib.h>
-
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#ifndef HAVE_ALARM
-# define alarm(X) /* empty */
-#endif
-
-/* Work around redefinition to rpl_putenv by other config tests.  */
-#undef putenv
-
-static time_t time_t_max;
-static time_t time_t_min;
-
-/* Values we'll use to set the TZ environment variable.  */
-static char *tz_strings[] = {
-  (char *) 0, "TZ=GMT0", "TZ=JST-9",
-  "TZ=EST+3EDT+2,M10.1.0/00:00:00,M2.3.0/00:00:00"
-};
-#define N_STRINGS (sizeof (tz_strings) / sizeof (tz_strings[0]))
-
-/* Return 0 if mktime fails to convert a date in the spring-forward gap.
-   Based on a problem report from Andreas Jaeger.  */
-static int
-spring_forward_gap ()
-{
-  /* glibc (up to about 1998-10-07) failed this test. */
-  struct tm tm;
-
-  /* Use the portable POSIX.1 specification "TZ=PST8PDT,M4.1.0,M10.5.0"
-     instead of "TZ=America/Vancouver" in order to detect the bug even
-     on systems that don't support the Olson extension, or don't have the
-     full zoneinfo tables installed.  */
-  putenv ("TZ=PST8PDT,M4.1.0,M10.5.0");
-
-  tm.tm_year = 98;
-  tm.tm_mon = 3;
-  tm.tm_mday = 5;
-  tm.tm_hour = 2;
-  tm.tm_min = 0;
-  tm.tm_sec = 0;
-  tm.tm_isdst = -1;
-  return mktime (&tm) != (time_t) -1;
-}
-
-static int
-mktime_test1 (now)
-     time_t now;
-{
-  struct tm *lt;
-  return ! (lt = localtime (&now)) || mktime (lt) == now;
-}
-
-static int
-mktime_test (now)
-     time_t now;
-{
-  return (mktime_test1 (now)
-         && mktime_test1 ((time_t) (time_t_max - now))
-         && mktime_test1 ((time_t) (time_t_min + now)));
-}
-
-static int
-irix_6_4_bug ()
+#include <X11/Xlib.h>
+int
+main ()
 {
-  /* Based on code from Ariel Faigon.  */
-  struct tm tm;
-  tm.tm_year = 96;
-  tm.tm_mon = 3;
-  tm.tm_mday = 0;
-  tm.tm_hour = 0;
-  tm.tm_min = 0;
-  tm.tm_sec = 0;
-  tm.tm_isdst = -1;
-  mktime (&tm);
-  return tm.tm_mon == 2 && tm.tm_mday == 31;
-}
+#if XlibSpecificationRelease < 6
+fail;
+#endif
 
-static int
-bigtime_test (j)
-     int j;
-{
-  struct tm tm;
-  time_t now;
-  tm.tm_year = tm.tm_mon = tm.tm_mday = tm.tm_hour = tm.tm_min = tm.tm_sec = j;
-  now = mktime (&tm);
-  if (now != (time_t) -1)
-    {
-      struct tm *lt = localtime (&now);
-      if (! (lt
-            && lt->tm_year == tm.tm_year
-            && lt->tm_mon == tm.tm_mon
-            && lt->tm_mday == tm.tm_mday
-            && lt->tm_hour == tm.tm_hour
-            && lt->tm_min == tm.tm_min
-            && lt->tm_sec == tm.tm_sec
-            && lt->tm_yday == tm.tm_yday
-            && lt->tm_wday == tm.tm_wday
-            && ((lt->tm_isdst < 0 ? -1 : 0 < lt->tm_isdst)
-                 == (tm.tm_isdst < 0 ? -1 : 0 < tm.tm_isdst))))
-       return 0;
-    }
-  return 1;
+  ;
+  return 0;
 }
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  emacs_cv_x11_version_6=yes
+else
+  emacs_cv_x11_version_6=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
 
-static int
-year_2050_test ()
-{
-  /* The correct answer for 2050-02-01 00:00:00 in Pacific time,
-     ignoring leap seconds.  */
-  unsigned long int answer = 2527315200UL;
-
-  struct tm tm;
-  time_t t;
-  tm.tm_year = 2050 - 1900;
-  tm.tm_mon = 2 - 1;
-  tm.tm_mday = 1;
-  tm.tm_hour = tm.tm_min = tm.tm_sec = 0;
-  tm.tm_isdst = -1;
+  if test $emacs_cv_x11_version_6 = yes; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: 6 or newer" >&5
+$as_echo "6 or newer" >&6; }
 
-  /* Use the portable POSIX.1 specification "TZ=PST8PDT,M4.1.0,M10.5.0"
-     instead of "TZ=America/Vancouver" in order to detect the bug even
-     on systems that don't support the Olson extension, or don't have the
-     full zoneinfo tables installed.  */
-  putenv ("TZ=PST8PDT,M4.1.0,M10.5.0");
+$as_echo "#define HAVE_X11R6 1" >>confdefs.h
 
-  t = mktime (&tm);
 
-  /* Check that the result is either a failure, or close enough
-     to the correct answer that we can assume the discrepancy is
-     due to leap seconds.  */
-  return (t == (time_t) -1
-         || (0 < t && answer - 120 <= t && t <= answer + 120));
-}
+$as_echo "#define HAVE_X_I18N 1" >>confdefs.h
 
-int
-main ()
-{
-  time_t t, delta;
-  int i, j;
+    ## inoue@ainet.or.jp says Solaris has a bug related to X11R6-style
+    ## XIM support.
+    case "$opsys" in
+      sol2-*) : ;;
+      *)
+$as_echo "#define HAVE_X11R6_XIM 1" >>confdefs.h
 
-  /* This test makes some buggy mktime implementations loop.
-     Give up after 60 seconds; a mktime slower than that
-     isn't worth using anyway.  */
-  alarm (60);
+         ;;
+    esac
+  else
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: before 6" >&5
+$as_echo "before 6" >&6; }
+  fi
+fi
 
-  for (;;)
-    {
-      t = (time_t_max << 1) + 1;
-      if (t <= time_t_max)
-       break;
-      time_t_max = t;
-    }
-  time_t_min = - ((time_t) ~ (time_t) 0 == (time_t) -1) - time_t_max;
 
-  delta = time_t_max / 997; /* a suitable prime number */
-  for (i = 0; i < N_STRINGS; i++)
-    {
-      if (tz_strings[i])
-       putenv (tz_strings[i]);
+### Use -lrsvg-2 if available, unless `--with-rsvg=no' is specified.
+HAVE_RSVG=no
+if test "${HAVE_X11}" = "yes" || test "${NS_IMPL_GNUSTEP}" = "yes"; then
+  if test "${with_rsvg}" != "no"; then
+    RSVG_REQUIRED=2.11.0
+    RSVG_MODULE="librsvg-2.0 >= $RSVG_REQUIRED"
 
-      for (t = 0; t <= time_t_max - delta; t += delta)
-       if (! mktime_test (t))
-         return 1;
-      if (! (mktime_test ((time_t) 1)
-            && mktime_test ((time_t) (60 * 60))
-            && mktime_test ((time_t) (60 * 60 * 24))))
-       return 1;
 
-      for (j = 1; ; j <<= 1)
-       if (! bigtime_test (j))
-         return 1;
-       else if (INT_MAX / 2 < j)
-         break;
-      if (! bigtime_test (INT_MAX))
-       return 1;
-    }
-  return ! (irix_6_4_bug () && spring_forward_gap () && year_2050_test ());
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_func_working_mktime=yes
+  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
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  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
 
-( exit $ac_status )
-ac_cv_func_working_mktime=no
+  test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no"
+  ;;
+esac
 fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+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
 
 
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_working_mktime" >&5
-$as_echo "$ac_cv_func_working_mktime" >&6; }
-if test $ac_cv_func_working_mktime = no; then
-  case " $LIBOBJS " in
-  *" mktime.$ac_objext "* ) ;;
-  *) LIBOBJS="$LIBOBJS mktime.$ac_objext"
- ;;
-esac
 
-fi
+  if test "$PKG_CONFIG" = "no" ; then
+     :
+  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 $RSVG_MODULE" >&5
+$as_echo_n "checking for $RSVG_MODULE... " >&6; }
 
-if test "$ac_cv_func_working_mktime" = no; then
+        if $PKG_CONFIG --exists "$RSVG_MODULE" 2>&5; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+            succeeded=yes
 
-cat >>confdefs.h <<\_ACEOF
-#define BROKEN_MKTIME 1
-_ACEOF
+            { $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; }
 
-fi
+            { $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; }
+            RSVG_CFLAGS=""
+            RSVG_LIBS=""
+            ## If we have a custom action on failure, don't print errors, but
+            ## do set a variable so people can do so.
+            RSVG_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$RSVG_MODULE"`
 
-ac_have_func=no # yes means we've found a way to get the load average.
+        fi
 
-# Make sure getloadavg.c is where it belongs, at configure-time.
-test -f "$srcdir/$ac_config_libobj_dir/getloadavg.c" ||
-  { { $as_echo "$as_me:$LINENO: error: $srcdir/$ac_config_libobj_dir/getloadavg.c is missing" >&5
-$as_echo "$as_me: error: $srcdir/$ac_config_libobj_dir/getloadavg.c is missing" >&2;}
-   { (exit 1); exit 1; }; }
 
-ac_save_LIBS=$LIBS
 
-# Check for getloadavg, but be sure not to touch the cache variable.
-({ $as_echo "$as_me:$LINENO: checking for getloadavg" >&5
-$as_echo_n "checking for getloadavg... " >&6; }
-if test "${ac_cv_func_getloadavg+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define getloadavg to an innocuous variant, in case <limits.h> declares getloadavg.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define getloadavg innocuous_getloadavg
+     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
 
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char getloadavg (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
+  if test $succeeded = yes; then
+     HAVE_RSVG=yes
+  else
+     :
+  fi
 
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
 
-#undef getloadavg
 
-/* 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 getloadavg ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_getloadavg || defined __stub___getloadavg
-choke me
-#endif
 
-int
-main ()
-{
-return getloadavg ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_func_getloadavg=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+    if test $HAVE_RSVG = yes; then
+
+$as_echo "#define HAVE_RSVG 1" >>confdefs.h
 
-       ac_cv_func_getloadavg=no
+      CFLAGS="$CFLAGS $RSVG_CFLAGS"
+      LIBS="$RSVG_LIBS $LIBS"
+    fi
+  fi
 fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+HAVE_IMAGEMAGICK=no
+if test "${with_imagemagick}" != "no"; then
+  IMAGEMAGICK_MODULE="Wand"
+
+  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
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_getloadavg" >&5
-$as_echo "$ac_cv_func_getloadavg" >&6; }
-if test $ac_cv_func_getloadavg = yes; then
-  exit 0
+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
-  exit 1
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
-) && ac_have_func=yes
 
-# On HPUX9, an unprivileged user can get load averages through this function.
 
-for ac_func in pstat_getdynamic
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
 
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
+  if test "$PKG_CONFIG" = "no" ; then
+     :
+  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 $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; }
+            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; }
+            IMAGEMAGICK_CFLAGS=""
+            IMAGEMAGICK_LIBS=""
+            ## If we have a custom action on failure, don't print errors, but
+            ## do set a variable so people can do so.
+            IMAGEMAGICK_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$IMAGEMAGICK_MODULE"`
 
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
+        fi
 
-#undef $ac_func
 
-/* 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 $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
 
-int
-main ()
-{
-return $ac_func ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+     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
 
-       eval "$as_ac_var=no"
-fi
+  if test $succeeded = yes; then
+     HAVE_IMAGEMAGICK=yes
+  else
+     :
+  fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if test `eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
 
-fi
-done
 
 
-# Solaris has libkstat which does not require root.
+  if test $HAVE_IMAGEMAGICK = yes; then
 
-{ $as_echo "$as_me:$LINENO: checking for kstat_open in -lkstat" >&5
-$as_echo_n "checking for kstat_open in -lkstat... " >&6; }
-if test "${ac_cv_lib_kstat_kstat_open+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lkstat  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
+$as_echo "#define HAVE_IMAGEMAGICK 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 kstat_open ();
-int
-main ()
-{
-return kstat_open ();
-  ;
-  return 0;
-}
+    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
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_kstat_kstat_open=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-       ac_cv_lib_kstat_kstat_open=no
 fi
+done
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+  fi
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_kstat_kstat_open" >&5
-$as_echo "$ac_cv_lib_kstat_kstat_open" >&6; }
-if test $ac_cv_lib_kstat_kstat_open = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBKSTAT 1
-_ACEOF
 
-  LIBS="-lkstat $LIBS"
 
-fi
+HAVE_GTK=no
+if test "${with_gtk3}" = "yes"; then
+  GLIB_REQUIRED=2.6
+  GTK_REQUIRED=2.90
+  GTK_MODULES="gtk+-3.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED"
 
-test $ac_cv_lib_kstat_kstat_open = yes && ac_have_func=yes
 
-# Some systems with -lutil have (and need) -lkvm as well, some do not.
-# On Solaris, -lkvm requires nlist from -lelf, so check that first
-# to get the right answer into the cache.
-# For kstat on solaris, we need libelf to force the definition of SVR4 below.
-if test $ac_have_func = no; then
-  { $as_echo "$as_me:$LINENO: checking for elf_begin in -lelf" >&5
-$as_echo_n "checking for elf_begin in -lelf... " >&6; }
-if test "${ac_cv_lib_elf_elf_begin+set}" = set; 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
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lelf  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
+  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
 
-/* 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 elf_begin ();
-int
-main ()
-{
-return elf_begin ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
+  test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no"
+  ;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_elf_elf_begin=yes
+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: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_lib_elf_elf_begin=no
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_elf_elf_begin" >&5
-$as_echo "$ac_cv_lib_elf_elf_begin" >&6; }
-if test $ac_cv_lib_elf_elf_begin = yes; then
-  LIBS="-lelf $LIBS"
-fi
 
-fi
-if test $ac_have_func = no; then
-  { $as_echo "$as_me:$LINENO: checking for kvm_open in -lkvm" >&5
-$as_echo_n "checking for kvm_open in -lkvm... " >&6; }
-if test "${ac_cv_lib_kvm_kvm_open+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lkvm  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* 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 kvm_open ();
-int
-main ()
-{
-return kvm_open ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_kvm_kvm_open=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  if test "$PKG_CONFIG" = "no" ; then
+     pkg_check_gtk=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 $GTK_MODULES" >&5
+$as_echo_n "checking for $GTK_MODULES... " >&6; }
 
-       ac_cv_lib_kvm_kvm_open=no
-fi
+        if $PKG_CONFIG --exists "$GTK_MODULES" 2>&5; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+            succeeded=yes
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_kvm_kvm_open" >&5
-$as_echo "$ac_cv_lib_kvm_kvm_open" >&6; }
-if test $ac_cv_lib_kvm_kvm_open = yes; then
-  LIBS="-lkvm $LIBS"
-fi
+            { $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; }
+            GTK_CFLAGS=""
+            GTK_LIBS=""
+            ## If we have a custom action on failure, don't print errors, but
+            ## do set a variable so people can do so.
+            GTK_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$GTK_MODULES"`
+
+        fi
 
-  # Check for the 4.4BSD definition of getloadavg.
-  { $as_echo "$as_me:$LINENO: checking for getloadavg in -lutil" >&5
-$as_echo_n "checking for getloadavg in -lutil... " >&6; }
-if test "${ac_cv_lib_util_getloadavg+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lutil  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* 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 getloadavg ();
-int
-main ()
-{
-return getloadavg ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_util_getloadavg=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-       ac_cv_lib_util_getloadavg=no
-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
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_util_getloadavg" >&5
-$as_echo "$ac_cv_lib_util_getloadavg" >&6; }
-if test $ac_cv_lib_util_getloadavg = yes; then
-  LIBS="-lutil $LIBS" ac_have_func=yes ac_cv_func_getloadavg_setgid=yes
-fi
+  if test $succeeded = yes; then
+     pkg_check_gtk=yes
+  else
+     pkg_check_gtk=no
+  fi
 
+  if test "$pkg_check_gtk" = "no" && test "$USE_X_TOOLKIT" != "maybe"; then
+     as_fn_error "$GTK_PKG_ERRORS" "$LINENO" 5
+  fi
 fi
 
-if test $ac_have_func = no; then
-  # There is a commonly available library for RS/6000 AIX.
-  # Since it is not a standard part of AIX, it might be installed locally.
-  ac_getloadavg_LIBS=$LIBS
-  LIBS="-L/usr/local/lib $LIBS"
-  { $as_echo "$as_me:$LINENO: checking for getloadavg in -lgetloadavg" >&5
-$as_echo_n "checking for getloadavg in -lgetloadavg... " >&6; }
-if test "${ac_cv_lib_getloadavg_getloadavg+set}" = set; then
+if test "$pkg_check_gtk" != "yes"; then
+  HAVE_GTK=no
+if test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "maybe"; then
+  GLIB_REQUIRED=2.6
+  GTK_REQUIRED=2.6
+  GTK_MODULES="gtk+-2.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
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lgetloadavg  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
+  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
 
-/* 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 getloadavg ();
-int
-main ()
-{
-return getloadavg ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
+  test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no"
+  ;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_getloadavg_getloadavg=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_lib_getloadavg_getloadavg=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_getloadavg_getloadavg" >&5
-$as_echo "$ac_cv_lib_getloadavg_getloadavg" >&6; }
-if test $ac_cv_lib_getloadavg_getloadavg = yes; then
-  LIBS="-lgetloadavg $LIBS"
+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
-  LIBS=$ac_getloadavg_LIBS
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
-fi
 
-# Make sure it is really in the library, if we think we found it,
-# otherwise set up the replacement function.
 
-for ac_func in getloadavg
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
+  if test "$PKG_CONFIG" = "no" ; then
+     pkg_check_gtk=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 $GTK_MODULES" >&5
+$as_echo_n "checking for $GTK_MODULES... " >&6; }
 
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
+        if $PKG_CONFIG --exists "$GTK_MODULES" 2>&5; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+            succeeded=yes
 
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
+            { $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; }
 
-#undef $ac_func
+            { $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; }
+            GTK_CFLAGS=""
+            GTK_LIBS=""
+            ## If we have a custom action on failure, don't print errors, but
+            ## do set a variable so people can do so.
+            GTK_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$GTK_MODULES"`
 
-/* 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 $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
+        fi
 
-int
-main ()
-{
-return $ac_func ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-       eval "$as_ac_var=no"
-fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+     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
+     pkg_check_gtk=yes
+  else
+     pkg_check_gtk=no
+  fi
+
+  if test "$pkg_check_gtk" = "no" && test "$USE_X_TOOLKIT" != "maybe"; then
+     as_fn_error "$GTK_PKG_ERRORS" "$LINENO" 5
+  fi
+fi
 fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if test `eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
 
-else
-  case " $LIBOBJS " in
-  *" getloadavg.$ac_objext "* ) ;;
-  *) LIBOBJS="$LIBOBJS getloadavg.$ac_objext"
- ;;
-esac
+GTK_OBJ=
+if test x"$pkg_check_gtk" = xyes; then
 
 
-cat >>confdefs.h <<\_ACEOF
-#define C_GETLOADAVG 1
-_ACEOF
 
-# Figure out what our getloadavg.c needs.
-ac_have_func=no
-if test "${ac_cv_header_sys_dg_sys_info_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for sys/dg_sys_info.h" >&5
-$as_echo_n "checking for sys/dg_sys_info.h... " >&6; }
-if test "${ac_cv_header_sys_dg_sys_info_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_dg_sys_info_h" >&5
-$as_echo "$ac_cv_header_sys_dg_sys_info_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking sys/dg_sys_info.h usability" >&5
-$as_echo_n "checking sys/dg_sys_info.h usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <sys/dg_sys_info.h>
+  C_SWITCH_X_SITE="$C_SWITCH_X_SITE $GTK_CFLAGS"
+  CFLAGS="$CFLAGS $GTK_CFLAGS"
+  LIBS="$GTK_LIBS $LIBS"
+    GTK_COMPILES=no
+  for ac_func in gtk_main
+do :
+  ac_fn_c_check_func "$LINENO" "gtk_main" "ac_cv_func_gtk_main"
+if test "x$ac_cv_func_gtk_main" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_GTK_MAIN 1
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
+ GTK_COMPILES=yes
 fi
+done
+
+  if test "${GTK_COMPILES}" != "yes"; then
+    if test "$USE_X_TOOLKIT" != "maybe"; then
+      as_fn_error "Gtk+ wanted, but it does not compile, see config.log.  Maybe some x11-devel files missing?" "$LINENO" 5;
+    fi
+  else
+    HAVE_GTK=yes
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
+$as_echo "#define USE_GTK 1" >>confdefs.h
 
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking sys/dg_sys_info.h presence" >&5
-$as_echo_n "checking sys/dg_sys_info.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/dg_sys_info.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+    GTK_OBJ=gtkutil.o
+    USE_X_TOOLKIT=none
+    if $PKG_CONFIG --atleast-version=2.10 gtk+-2.0; then
+      :
+    else
+      { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Your version of Gtk+ will have problems with
+       closing open displays.  This is no problem if you just use
+       one display, but if you use more than one and close one of them
+       Emacs may crash." >&5
+$as_echo "$as_me: WARNING: Your version of Gtk+ will have problems with
+       closing open displays.  This is no problem if you just use
+       one display, but if you use more than one and close one of them
+       Emacs may crash." >&2;}
+      sleep 3
+    fi
+  fi
 
-  ac_header_preproc=no
 fi
 
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
 
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: sys/dg_sys_info.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: sys/dg_sys_info.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/dg_sys_info.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: sys/dg_sys_info.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: sys/dg_sys_info.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: sys/dg_sys_info.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/dg_sys_info.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: sys/dg_sys_info.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/dg_sys_info.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: sys/dg_sys_info.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/dg_sys_info.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: sys/dg_sys_info.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/dg_sys_info.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: sys/dg_sys_info.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/dg_sys_info.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: sys/dg_sys_info.h: in the future, the compiler will take precedence" >&2;}
 
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for sys/dg_sys_info.h" >&5
-$as_echo_n "checking for sys/dg_sys_info.h... " >&6; }
-if test "${ac_cv_header_sys_dg_sys_info_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
+if test "${HAVE_GTK}" = "yes"; then
+
+      if test "$with_toolkit_scroll_bars" != no; then
+    with_toolkit_scroll_bars=yes
+  fi
+
+          HAVE_GTK_FILE_SELECTION=no
+  ac_fn_c_check_decl "$LINENO" "GTK_TYPE_FILE_SELECTION" "ac_cv_have_decl_GTK_TYPE_FILE_SELECTION" "$ac_includes_default
+#include <gtk/gtk.h>
+"
+if test "x$ac_cv_have_decl_GTK_TYPE_FILE_SELECTION" = x""yes; then :
+  HAVE_GTK_FILE_SELECTION=yes
 else
-  ac_cv_header_sys_dg_sys_info_h=$ac_header_preproc
+  HAVE_GTK_FILE_SELECTION=no
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_dg_sys_info_h" >&5
-$as_echo "$ac_cv_header_sys_dg_sys_info_h" >&6; }
+
+  if test "$HAVE_GTK_FILE_SELECTION" = yes; then
+    for ac_func in gtk_file_selection_new
+do :
+  ac_fn_c_check_func "$LINENO" "gtk_file_selection_new" "ac_cv_func_gtk_file_selection_new"
+if test "x$ac_cv_func_gtk_file_selection_new" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_GTK_FILE_SELECTION_NEW 1
+_ACEOF
 
 fi
-if test $ac_cv_header_sys_dg_sys_info_h = yes; then
-  ac_have_func=yes
+done
+
+  fi
 
-cat >>confdefs.h <<\_ACEOF
-#define DGUX 1
+        HAVE_GTK_AND_PTHREAD=no
+    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
 
-{ $as_echo "$as_me:$LINENO: checking for dg_sys_info in -ldgc" >&5
-$as_echo_n "checking for dg_sys_info in -ldgc... " >&6; }
-if test "${ac_cv_lib_dgc_dg_sys_info+set}" = set; then
+done
+
+    if test "$ac_cv_header_pthread_h"; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_self in -lpthread" >&5
+$as_echo_n "checking for pthread_self in -lpthread... " >&6; }
+if test "${ac_cv_lib_pthread_pthread_self+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldgc  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+LIBS="-lpthread  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -18847,224 +9057,293 @@ cat >>conftest.$ac_ext <<_ACEOF
 #ifdef __cplusplus
 extern "C"
 #endif
-char dg_sys_info ();
+char pthread_self ();
 int
 main ()
 {
-return dg_sys_info ();
+return pthread_self ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_dgc_dg_sys_info=yes
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_pthread_pthread_self=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_lib_dgc_dg_sys_info=no
+  ac_cv_lib_pthread_pthread_self=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+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:$LINENO: result: $ac_cv_lib_dgc_dg_sys_info" >&5
-$as_echo "$ac_cv_lib_dgc_dg_sys_info" >&6; }
-if test $ac_cv_lib_dgc_dg_sys_info = yes; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_self" >&5
+$as_echo "$ac_cv_lib_pthread_pthread_self" >&6; }
+if test "x$ac_cv_lib_pthread_pthread_self" = x""yes; then :
+  HAVE_GTK_AND_PTHREAD=yes
+fi
+
+    fi
+    if test "$HAVE_GTK_AND_PTHREAD" = yes; then
+      case "${canonical}" in
+        *-hpux*) ;;
+        *) GTK_LIBS="$GTK_LIBS -lpthread" ;;
+      esac
+
+$as_echo "#define HAVE_GTK_AND_PTHREAD 1" >>confdefs.h
+
+    fi
+
+    for ac_func in gtk_widget_get_window gtk_widget_set_has_window \
+                 gtk_dialog_get_action_area gtk_widget_get_sensitive \
+                 gtk_widget_get_mapped gtk_adjustment_get_page_size \
+                 gtk_orientable_set_orientation
+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 HAVE_LIBDGC 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
 
-  LIBS="-ldgc $LIBS"
-
 fi
+done
+
 
 fi
 
+HAVE_DBUS=no
+DBUS_OBJ=
+if test "${with_dbus}" = "yes"; then
 
+  succeeded=no
 
-if test "${ac_cv_header_locale_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for locale.h" >&5
-$as_echo_n "checking for locale.h... " >&6; }
-if test "${ac_cv_header_locale_h+set}" = set; then
+  # 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
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_locale_h" >&5
-$as_echo "$ac_cv_header_locale_h" >&6; }
+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
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking locale.h usability" >&5
-$as_echo_n "checking locale.h usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <locale.h>
+  { $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
+     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 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; }
+            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; }
+            DBUS_CFLAGS=""
+            DBUS_LIBS=""
+            ## If we have a custom action on failure, don't print errors, but
+            ## do set a variable so people can do so.
+            DBUS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "dbus-1 >= 1.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_DBUS=yes
+  else
+     HAVE_DBUS=no
+  fi
+
+   if test "$HAVE_DBUS" = yes; then
+     LIBS="$LIBS $DBUS_LIBS"
+
+$as_echo "#define HAVE_DBUS 1" >>confdefs.h
+
+     for ac_func in dbus_watch_get_unix_fd
+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 :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_DBUS_WATCH_GET_UNIX_FD 1
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
+
+fi
+done
+
+     DBUS_OBJ=dbusbind.o
+   fi
+fi
+
+
+HAVE_GCONF=no
+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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  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_header_compiler=no
+  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
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
 
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking locale.h presence" >&5
-$as_echo_n "checking locale.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <locale.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-  ac_header_preproc=no
-fi
+  if test "$PKG_CONFIG" = "no" ; then
+     HAVE_GCONF=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 gconf-2.0 >= 2.13" >&5
+$as_echo_n "checking for gconf-2.0 >= 2.13... " >&6; }
 
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&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; }
+            succeeded=yes
 
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: locale.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: locale.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: locale.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: locale.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: locale.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: locale.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: locale.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: locale.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: locale.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: locale.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: locale.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: locale.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: locale.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: locale.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: locale.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: locale.h: in the future, the compiler will take precedence" >&2;}
+            { $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; }
 
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for locale.h" >&5
-$as_echo_n "checking for locale.h... " >&6; }
-if test "${ac_cv_header_locale_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_locale_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_locale_h" >&5
-$as_echo "$ac_cv_header_locale_h" >&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; }
+            GCONF_CFLAGS=""
+            GCONF_LIBS=""
+            ## If we have a custom action on failure, don't print errors, but
+            ## do set a variable so people can do so.
+            GCONF_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "gconf-2.0 >= 2.13"`
 
-fi
+        fi
 
 
 
-for ac_func in setlocale
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
+     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
 
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
+  if test $succeeded = yes; then
+     HAVE_GCONF=yes
+  else
+     HAVE_GCONF=no
+  fi
 
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
+   if test "$HAVE_GCONF" = yes; then
+
+$as_echo "#define HAVE_GCONF 1" >>confdefs.h
+
+   fi
+fi
 
-#undef $ac_func
+HAVE_LIBSELINUX=no
+LIBSELINUX_LIBS=
+if test "${with_selinux}" = "yes"; then
+   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lgetfilecon in -lselinux" >&5
+$as_echo_n "checking for lgetfilecon in -lselinux... " >&6; }
+if test "${ac_cv_lib_selinux_lgetfilecon+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lselinux  $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
@@ -19072,1554 +9351,1379 @@ cat >>conftest.$ac_ext <<_ACEOF
 #ifdef __cplusplus
 extern "C"
 #endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
+char lgetfilecon ();
 int
 main ()
 {
-return $ac_func ();
+return lgetfilecon ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_selinux_lgetfilecon=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_var=no"
+  ac_cv_lib_selinux_lgetfilecon=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
 fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if test `eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_selinux_lgetfilecon" >&5
+$as_echo "$ac_cv_lib_selinux_lgetfilecon" >&6; }
+if test "x$ac_cv_lib_selinux_lgetfilecon" = x""yes; then :
+  HAVE_LIBSELINUX=yes
+else
+  HAVE_LIBSELINUX=no
 fi
-done
 
+   if test "$HAVE_LIBSELINUX" = yes; then
 
-# We cannot check for <dwarf.h>, because Solaris 2 does not use dwarf (it
-# uses stabs), but it is still SVR4.  We cannot check for <elf.h> because
-# Irix 4.0.5F has the header but not the library.
-if test $ac_have_func = no && test "$ac_cv_lib_elf_elf_begin" = yes; then
-  ac_have_func=yes
-
-cat >>confdefs.h <<\_ACEOF
-#define SVR4 1
-_ACEOF
+$as_echo "#define HAVE_LIBSELINUX 1" >>confdefs.h
 
+      LIBSELINUX_LIBS=-lselinux
+   fi
 fi
 
-if test $ac_have_func = no; then
-  if test "${ac_cv_header_inq_stats_cpustats_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for inq_stats/cpustats.h" >&5
-$as_echo_n "checking for inq_stats/cpustats.h... " >&6; }
-if test "${ac_cv_header_inq_stats_cpustats_h+set}" = set; then
+
+HAVE_XAW3D=no
+LUCID_LIBW=
+if test x"${USE_X_TOOLKIT}" = xmaybe || test x"${USE_X_TOOLKIT}" = xLUCID; then
+  if test "$with_xaw3d" != no; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for xaw3d" >&5
+$as_echo_n "checking for xaw3d... " >&6; }
+    if test "${emacs_cv_xaw3d+set}" = set; then :
   $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_inq_stats_cpustats_h" >&5
-$as_echo "$ac_cv_header_inq_stats_cpustats_h" >&6; }
 else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking inq_stats/cpustats.h usability" >&5
-$as_echo_n "checking inq_stats/cpustats.h usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
-#include <inq_stats/cpustats.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
+#include <X11/Intrinsic.h>
+#include <X11/Xaw3d/Simple.h>
+int
+main ()
+{
 
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking inq_stats/cpustats.h presence" >&5
-$as_echo_n "checking inq_stats/cpustats.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <inq_stats/cpustats.h>
+  ;
+  return 0;
+}
 _ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: inq_stats/cpustats.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: inq_stats/cpustats.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: inq_stats/cpustats.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: inq_stats/cpustats.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: inq_stats/cpustats.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: inq_stats/cpustats.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: inq_stats/cpustats.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: inq_stats/cpustats.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: inq_stats/cpustats.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: inq_stats/cpustats.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: inq_stats/cpustats.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: inq_stats/cpustats.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: inq_stats/cpustats.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: inq_stats/cpustats.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: inq_stats/cpustats.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: inq_stats/cpustats.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for inq_stats/cpustats.h" >&5
-$as_echo_n "checking for inq_stats/cpustats.h... " >&6; }
-if test "${ac_cv_header_inq_stats_cpustats_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
+if ac_fn_c_try_link "$LINENO"; then :
+  emacs_cv_xaw3d=yes
 else
-  ac_cv_header_inq_stats_cpustats_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_inq_stats_cpustats_h" >&5
-$as_echo "$ac_cv_header_inq_stats_cpustats_h" >&6; }
-
+  emacs_cv_xaw3d=no
 fi
-if test $ac_cv_header_inq_stats_cpustats_h = yes; then
-  ac_have_func=yes
-
-cat >>confdefs.h <<\_ACEOF
-#define UMAX 1
-_ACEOF
-
-
-cat >>confdefs.h <<\_ACEOF
-#define UMAX4_3 1
-_ACEOF
-
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 fi
 
+  else
+    emacs_cv_xaw3d=no
+  fi
+  if test $emacs_cv_xaw3d = yes; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes; using Lucid toolkit" >&5
+$as_echo "yes; using Lucid toolkit" >&6; }
+    USE_X_TOOLKIT=LUCID
+    HAVE_XAW3D=yes
+    LUCID_LIBW=-lXaw3d
 
-fi
+$as_echo "#define HAVE_XAW3D 1" >>confdefs.h
 
-if test $ac_have_func = no; then
-  if test "${ac_cv_header_sys_cpustats_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for sys/cpustats.h" >&5
-$as_echo_n "checking for sys/cpustats.h... " >&6; }
-if test "${ac_cv_header_sys_cpustats_h+set}" = set; then
+  else
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libXaw" >&5
+$as_echo_n "checking for libXaw... " >&6; }
+    if test "${emacs_cv_xaw+set}" = set; then :
   $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_cpustats_h" >&5
-$as_echo "$ac_cv_header_sys_cpustats_h" >&6; }
 else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking sys/cpustats.h usability" >&5
-$as_echo_n "checking sys/cpustats.h usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
-#include <sys/cpustats.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
+#include <X11/Intrinsic.h>
+#include <X11/Xaw/Simple.h>
+int
+main ()
+{
 
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking sys/cpustats.h presence" >&5
-$as_echo_n "checking sys/cpustats.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/cpustats.h>
+  ;
+  return 0;
+}
 _ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
+if ac_fn_c_try_link "$LINENO"; then :
+  emacs_cv_xaw=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
+  emacs_cv_xaw=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 fi
 
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
+    if test $emacs_cv_xaw = yes; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes; using Lucid toolkit" >&5
+$as_echo "yes; using Lucid toolkit" >&6; }
+      USE_X_TOOLKIT=LUCID
+      LUCID_LIBW=-lXaw
+    elif test x"${USE_X_TOOLKIT}" = xLUCID; then
+      as_fn_error "Lucid toolkit requires X11/Xaw include files" "$LINENO" 5
+    else
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: no; do not use toolkit by default" >&5
+$as_echo "no; do not use toolkit by default" >&6; }
+      USE_X_TOOLKIT=none
+    fi
+  fi
+fi
 
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: sys/cpustats.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: sys/cpustats.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/cpustats.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: sys/cpustats.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: sys/cpustats.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: sys/cpustats.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/cpustats.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: sys/cpustats.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/cpustats.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: sys/cpustats.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/cpustats.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: sys/cpustats.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/cpustats.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: sys/cpustats.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/cpustats.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: sys/cpustats.h: in the future, the compiler will take precedence" >&2;}
+X_TOOLKIT_TYPE=$USE_X_TOOLKIT
 
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for sys/cpustats.h" >&5
-$as_echo_n "checking for sys/cpustats.h... " >&6; }
-if test "${ac_cv_header_sys_cpustats_h+set}" = set; then
+LIBXTR6=
+if test "${USE_X_TOOLKIT}" != "none"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking X11 toolkit version" >&5
+$as_echo_n "checking X11 toolkit version... " >&6; }
+  if test "${emacs_cv_x11_toolkit_version_6+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  ac_cv_header_sys_cpustats_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_cpustats_h" >&5
-$as_echo "$ac_cv_header_sys_cpustats_h" >&6; }
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <X11/Intrinsic.h>
+int
+main ()
+{
+#if XtSpecificationRelease < 6
+fail;
+#endif
 
-fi
-if test $ac_cv_header_sys_cpustats_h = yes; then
-  ac_have_func=yes; cat >>confdefs.h <<\_ACEOF
-#define UMAX 1
+  ;
+  return 0;
+}
 _ACEOF
-
+if ac_fn_c_try_link "$LINENO"; then :
+  emacs_cv_x11_toolkit_version_6=yes
+else
+  emacs_cv_x11_toolkit_version_6=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 fi
 
+  HAVE_X11XTR6=$emacs_cv_x11_toolkit_version_6
+  if test $emacs_cv_x11_toolkit_version_6 = yes; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: 6 or newer" >&5
+$as_echo "6 or newer" >&6; }
 
-fi
+$as_echo "#define HAVE_X11XTR6 1" >>confdefs.h
 
-if test $ac_have_func = no; then
+    LIBXTR6="-lSM -lICE"
+    case "$opsys" in
+      ## Use libw.a along with X11R6 Xt.
+      unixware) LIBXTR6="$LIBXTR6 -lw" ;;
+    esac
+  else
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: before 6" >&5
+$as_echo "before 6" >&6; }
+  fi
 
-for ac_header in mach/mach.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  OLDLIBS="$LIBS"
+  if test x$HAVE_X11XTR6 = xyes; then
+    LIBS="-lXt -lSM -lICE $LIBS"
+  else
+    LIBS="-lXt $LIBS"
+  fi
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XmuConvertStandardSelection in -lXmu" >&5
+$as_echo_n "checking for XmuConvertStandardSelection in -lXmu... " >&6; }
+if test "${ac_cv_lib_Xmu_XmuConvertStandardSelection+set}" = set; then :
   $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
 else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lXmu  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
+
+/* 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 XmuConvertStandardSelection ();
+int
+main ()
+{
+return XmuConvertStandardSelection ();
+  ;
+  return 0;
+}
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_Xmu_XmuConvertStandardSelection=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
+  ac_cv_lib_Xmu_XmuConvertStandardSelection=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
+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_Xmu_XmuConvertStandardSelection" >&5
+$as_echo "$ac_cv_lib_Xmu_XmuConvertStandardSelection" >&6; }
+if test "x$ac_cv_lib_Xmu_XmuConvertStandardSelection" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBXMU 1
 _ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-  ac_header_preproc=no
+  LIBS="-lXmu $LIBS"
+
 fi
 
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
+  test $ac_cv_lib_Xmu_XmuConvertStandardSelection = no && LIBS="$OLDLIBS"
+fi
 
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
 
+LIBXMU=-lXmu
+case "$machine" in
+  ## These machines don't supply Xmu.
+  hpux* | aix4-2 )
+    test "X$ac_cv_lib_Xmu_XmuConvertStandardSelection" != "Xyes" && LIBXMU=
     ;;
 esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+
+
+# On Irix 6.5, at least, we need XShapeQueryExtension from -lXext for Xaw3D.
+if test "${HAVE_X11}" = "yes"; then
+  if test "${USE_X_TOOLKIT}" != "none"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XShapeQueryExtension in -lXext" >&5
+$as_echo_n "checking for XShapeQueryExtension in -lXext... " >&6; }
+if test "${ac_cv_lib_Xext_XShapeQueryExtension+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lXext  $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 XShapeQueryExtension ();
+int
+main ()
+{
+return XShapeQueryExtension ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_Xext_XShapeQueryExtension=yes
+else
+  ac_cv_lib_Xext_XShapeQueryExtension=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 `eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'` = yes; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xext_XShapeQueryExtension" >&5
+$as_echo "$ac_cv_lib_Xext_XShapeQueryExtension" >&6; }
+if test "x$ac_cv_lib_Xext_XShapeQueryExtension" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define HAVE_LIBXEXT 1
 _ACEOF
 
-fi
-
-done
+  LIBS="-lXext $LIBS"
 
 fi
 
+  fi
+fi
 
-for ac_header in nlist.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+LIBXP=
+if test "${USE_X_TOOLKIT}" = "MOTIF"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Motif version 2.1" >&5
+$as_echo_n "checking for Motif version 2.1... " >&6; }
+if test "${emacs_cv_motif_version_2_1+set}" = set; then :
   $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
 else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <Xm/Xm.h>
+int
+main ()
+{
+#if XmVERSION > 2 || (XmVERSION == 2 && XmREVISION >= 1)
+int x = 5;
+#else
+Motif version prior to 2.1.
+#endif
+  ;
+  return 0;
+}
 _ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  emacs_cv_motif_version_2_1=yes
+else
+  emacs_cv_motif_version_2_1=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_motif_version_2_1" >&5
+$as_echo "$emacs_cv_motif_version_2_1" >&6; }
+  if test $emacs_cv_motif_version_2_1 = yes; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XpCreateContext in -lXp" >&5
+$as_echo_n "checking for XpCreateContext in -lXp... " >&6; }
+if test "${ac_cv_lib_Xp_XpCreateContext+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lXp  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
+
+/* 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 XpCreateContext ();
+int
+main ()
+{
+return XpCreateContext ();
+  ;
+  return 0;
+}
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_Xp_XpCreateContext=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  ac_cv_lib_Xp_XpCreateContext=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_Xp_XpCreateContext" >&5
+$as_echo "$ac_cv_lib_Xp_XpCreateContext" >&6; }
+if test "x$ac_cv_lib_Xp_XpCreateContext" = x""yes; then :
+  LIBXP=-lXp
+fi
 
-       ac_header_compiler=no
+  else
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LessTif where some systems put it" >&5
+$as_echo_n "checking for LessTif where some systems put it... " >&6; }
+if test "${emacs_cv_lesstif+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  # We put this in CFLAGS temporarily to precede other -I options
+    # that might be in CFLAGS temporarily.
+    # We put this in CPPFLAGS where it precedes the other -I options.
+    OLD_CPPFLAGS=$CPPFLAGS
+    OLD_CFLAGS=$CFLAGS
+    CPPFLAGS="-I/usr/X11R6/LessTif/Motif1.2/include $CPPFLAGS"
+    CFLAGS="-I/usr/X11R6/LessTif/Motif1.2/include $CFLAGS"
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include </usr/X11R6/LessTif/Motif1.2/include/Xm/Xm.h>
+int
+main ()
+{
+int x = 5;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  emacs_cv_lesstif=yes
+else
+  emacs_cv_lesstif=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_lesstif" >&5
+$as_echo "$emacs_cv_lesstif" >&6; }
+    if test $emacs_cv_lesstif = yes; then
+      # Make sure this -I option remains in CPPFLAGS after it is set
+      # back to REAL_CPPFLAGS.
+      # There is no need to change REAL_CFLAGS, because REAL_CFLAGS does not
+      # have those other -I options anyway.  Ultimately, having this
+      # directory ultimately in CPPFLAGS will be enough.
+      REAL_CPPFLAGS="-I/usr/X11R6/LessTif/Motif1.2/include $REAL_CPPFLAGS"
+      LDFLAGS="-L/usr/X11R6/LessTif/Motif1.2/lib $LDFLAGS"
+    else
+      CFLAGS=$OLD_CFLAGS
+      CPPFLAGS=$OLD_CPPFLAGS
+    fi
+  fi
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
 
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+USE_TOOLKIT_SCROLL_BARS=no
+if test "${with_toolkit_scroll_bars}" != "no"; then
+  if test "${USE_X_TOOLKIT}" != "none"; then
+    if test "${USE_X_TOOLKIT}" = "MOTIF"; then
+      $as_echo "#define USE_TOOLKIT_SCROLL_BARS 1" >>confdefs.h
 
-  ac_header_preproc=no
-fi
+      HAVE_XAW3D=no
+      USE_TOOLKIT_SCROLL_BARS=yes
+    elif test "${HAVE_XAW3D}" = "yes"; then
+      $as_echo "#define USE_TOOLKIT_SCROLL_BARS 1" >>confdefs.h
 
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
+      USE_TOOLKIT_SCROLL_BARS=yes
+    fi
+  elif test "${HAVE_GTK}" = "yes"; then
+    $as_echo "#define USE_TOOLKIT_SCROLL_BARS 1" >>confdefs.h
 
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    USE_TOOLKIT_SCROLL_BARS=yes
+  elif test "${HAVE_NS}" = "yes"; then
+    $as_echo "#define USE_TOOLKIT_SCROLL_BARS 1" >>confdefs.h
 
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
+    USE_TOOLKIT_SCROLL_BARS=yes
+  fi
 fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
 
-fi
-if test `eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
- { $as_echo "$as_me:$LINENO: checking for struct nlist.n_un.n_name" >&5
-$as_echo_n "checking for struct nlist.n_un.n_name... " >&6; }
-if test "${ac_cv_member_struct_nlist_n_un_n_name+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <nlist.h>
 
+         #include <X11/Xlib.h>
+         #include <X11/Xresource.h>
 int
 main ()
 {
-static struct nlist ac_aggr;
-if (ac_aggr.n_un.n_name)
-return 0;
+XIMProc  callback;
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_member_struct_nlist_n_un_n_name=yes
+if ac_fn_c_try_compile "$LINENO"; then :
+  HAVE_XIM=yes
+
+$as_echo "#define HAVE_XIM 1" >>confdefs.h
+
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  HAVE_XIM=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
-       cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+
+if test "${with_xim}" != "no"; then
+
+$as_echo "#define USE_XIM 1" >>confdefs.h
+
+fi
+
+
+if test "${HAVE_XIM}" != "no"; then
+  late_CFLAGS=$CFLAGS
+  if test "$GCC" = yes; then
+    CFLAGS="$CFLAGS --pedantic-errors"
+  fi
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <nlist.h>
 
+#include <X11/Xlib.h>
+#include <X11/Xresource.h>
 int
 main ()
 {
-static struct nlist ac_aggr;
-if (sizeof ac_aggr.n_un.n_name)
-return 0;
+Display *display;
+XrmDatabase db;
+char *res_name;
+char *res_class;
+XIMProc  callback;
+XPointer *client_data;
+#ifndef __GNUC__
+/* If we're not using GCC, it's probably not XFree86, and this is
+   probably right, but we can't use something like --pedantic-errors.  */
+extern Bool XRegisterIMInstantiateCallback(Display*, XrmDatabase, char*,
+                                           char*, XIMProc, XPointer*);
+#endif
+(void)XRegisterIMInstantiateCallback(display, db, res_name, res_class, callback,
+   client_data);
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_member_struct_nlist_n_un_n_name=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_member_struct_nlist_n_un_n_name=no
+if ac_fn_c_try_compile "$LINENO"; then :
+  emacs_cv_arg6_star=yes
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
+    if test "$emacs_cv_arg6_star" = yes; then
+    $as_echo "#define XRegisterIMInstantiateCallback_arg6 XPointer*" >>confdefs.h
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  else
+    $as_echo "#define XRegisterIMInstantiateCallback_arg6 XPointer" >>confdefs.h
+
+  fi
+  CFLAGS=$late_CFLAGS
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_nlist_n_un_n_name" >&5
-$as_echo "$ac_cv_member_struct_nlist_n_un_n_name" >&6; }
-if test $ac_cv_member_struct_nlist_n_un_n_name = yes; then
 
-cat >>confdefs.h <<_ACEOF
-#define HAVE_STRUCT_NLIST_N_UN_N_NAME 1
-_ACEOF
+### Start of font-backend (under any platform) section.
+# (nothing here yet -- this is a placeholder)
+### End of font-backend (under any platform) section.
+
+### Start of font-backend (under X11) section.
+if test "${HAVE_X11}" = "yes"; then
 
+  succeeded=no
 
-cat >>confdefs.h <<\_ACEOF
-#define NLIST_NAME_UNION 1
-_ACEOF
+  # 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
 
 
-fi
 
-done
+  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; }
 
-fi
-done
+        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; }
+            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; }
 
-# Some definitions of getloadavg require that the program be installed setgid.
-{ $as_echo "$as_me:$LINENO: checking whether getloadavg requires setgid" >&5
-$as_echo_n "checking whether getloadavg requires setgid... " >&6; }
-if test "${ac_cv_func_getloadavg_setgid+set}" = set; then
+            { $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=""
+            ## 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
+
+  # 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
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include "$srcdir/$ac_config_libobj_dir/getloadavg.c"
-#ifdef LDAV_PRIVILEGED
-Yowza Am I SETGID yet
-#endif
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "Yowza Am I SETGID yet" >/dev/null 2>&1; then
-  ac_cv_func_getloadavg_setgid=yes
+  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
-  ac_cv_func_getloadavg_setgid=no
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
-rm -f conftest*
 
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_getloadavg_setgid" >&5
-$as_echo "$ac_cv_func_getloadavg_setgid" >&6; }
-if test $ac_cv_func_getloadavg_setgid = yes; then
-  NEED_SETGID=true
 
-cat >>confdefs.h <<\_ACEOF
-#define GETLOADAVG_PRIVILEGED 1
-_ACEOF
 
-else
-  NEED_SETGID=false
-fi
+  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 test $ac_cv_func_getloadavg_setgid = yes; then
-  { $as_echo "$as_me:$LINENO: checking group of /dev/kmem" >&5
-$as_echo_n "checking group of /dev/kmem... " >&6; }
-if test "${ac_cv_group_kmem+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-   # On Solaris, /dev/kmem is a symlink.  Get info on the real file.
-  ac_ls_output=`ls -lgL /dev/kmem 2>/dev/null`
-  # If we got an error (system does not support symlinks), try without -L.
-  test -z "$ac_ls_output" && ac_ls_output=`ls -lg /dev/kmem`
-  ac_cv_group_kmem=`$as_echo "$ac_ls_output" \
-    | sed -ne 's/[      ][      ]*/ /g;
-              s/^.[sSrwx-]* *[0-9]* *\([^0-9]*\)  *.*/\1/;
-              / /s/.* //;p;'`
+        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; }
+            succeeded=yes
 
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_group_kmem" >&5
-$as_echo "$ac_cv_group_kmem" >&6; }
-  KMEM_GROUP=$ac_cv_group_kmem
-fi
-if test "x$ac_save_LIBS" = x; then
-  GETLOADAVG_LIBS=$LIBS
-else
-  GETLOADAVG_LIBS=`$as_echo "$LIBS" | sed "s|$ac_save_LIBS||"`
-fi
-LIBS=$ac_save_LIBS
+            { $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=""
+            ## 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
 
 
 
-{ $as_echo "$as_me:$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
+        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
-  while :; do
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lXrender  $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 XRenderQueryExtension ();
 int
 main ()
 {
-int (*fp) (FILE *, off_t, int) = fseeko;
-     return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);
+return XRenderQueryExtension ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_sys_largefile_source=no; break
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_Xrender_XRenderQueryExtension=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
+  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
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+      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.  */
-#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 XftFontOpen ();
 int
 main ()
 {
-int (*fp) (FILE *, off_t, int) = fseeko;
-     return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);
+return XftFontOpen ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_sys_largefile_source=1; break
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_Xft_XftFontOpen=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
+  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
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-  ac_cv_sys_largefile_source=unknown
-  break
-done
 fi
-{ $as_echo "$as_me:$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
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_FSEEKO 1
-_ACEOF
 
-fi
+       if test "${HAVE_XFT}" = "yes"; then
 
+$as_echo "#define HAVE_XFT 1" >>confdefs.h
 
-# Configure getopt.
-# getopt.m4 serial 10
 
-# The getopt module assume you want GNU getopt, with getopt_long etc,
-# rather than vanilla POSIX getopt.  This means your your code should
-# always include <getopt.h> for the getopt prototypes.
+         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"
+
+        if test "$HAVE_XFT" != "yes"; then
+       HAVE_XFT=no
+    fi
+
+
+    HAVE_FREETYPE=no
+    ## 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_FREETYPE=yes
+      FONTCONFIG_CFLAGS=
+      FONTCONFIG_LIBS=
+    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
+  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_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
 
 
-# Prerequisites of lib/getopt*.
 
+     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
 
-  GETOPT_H=
+$as_echo "#define HAVE_LIBOTF 1" >>confdefs.h
 
-for ac_header in getopt.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+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
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
 else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lotf  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
+
+/* 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
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_otf_OTF_get_variation_glyphs=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
+  ac_cv_lib_otf_OTF_get_variation_glyphs=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
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
+         if test "${HAVE_OTF_GET_VARIATION_GLYPHS}" = "yes"; then
 
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+$as_echo "#define HAVE_OTF_GET_VARIATION_GLYPHS 1" >>confdefs.h
 
-  ac_header_preproc=no
-fi
+         fi
+       fi
+      fi
+            fi
 
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
+    HAVE_M17N_FLT=no
+    if test "${HAVE_LIBOTF}" = yes; then
+      if test "${with_m17n_flt}" != "no"; then
 
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+  succeeded=no
 
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  # 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
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
+  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
-if test `eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
+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
-  GETOPT_H=getopt.h
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
-done
 
-  if test -z "$GETOPT_H"; then
 
-for ac_func in getopt_long_only
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
+  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; }
 
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
+        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
 
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
+            { $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; }
 
-#undef $ac_func
+            { $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"`
 
-/* 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 $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
+        fi
 
-int
-main ()
-{
-return $ac_func ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-       eval "$as_ac_var=no"
-fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+     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_M17N_FLT=yes
+  else
+     HAVE_M17N_FLT=no
+  fi
+
+       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
-ac_res=`eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if test `eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
 
-else
-  GETOPT_H=getopt.h
-fi
-done
+### End of font-backend (under X11) section.
+
+
+
+
 
-  fi
 
-      if test -z "$GETOPT_H"; then
-    { $as_echo "$as_me:$LINENO: checking whether optreset is declared" >&5
-$as_echo_n "checking whether optreset is declared... " >&6; }
-if test "${ac_cv_have_decl_optreset+set}" = set; then
+
+
+
+
+### 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
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lXpm -lX11 $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <getopt.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 XpmReadFileToPixmap ();
 int
 main ()
 {
-#ifndef optreset
-  (void) optreset;
-#endif
-
+return XpmReadFileToPixmap ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_have_decl_optreset=yes
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_Xpm_XpmReadFileToPixmap=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_have_decl_optreset=no
+  ac_cv_lib_Xpm_XpmReadFileToPixmap=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+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:$LINENO: result: $ac_cv_have_decl_optreset" >&5
-$as_echo "$ac_cv_have_decl_optreset" >&6; }
-if test $ac_cv_have_decl_optreset = yes; then
-  GETOPT_H=getopt.h
+{ $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
 
-  fi
+fi
 
-      if test -z "$GETOPT_H"; then
-    { $as_echo "$as_me:$LINENO: checking for working GNU getopt function" >&5
-$as_echo_n "checking for working GNU getopt function... " >&6; }
-if test "${gl_cv_func_gnu_getopt+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test "$cross_compiling" = yes; then
-                        { $as_echo "$as_me:$LINENO: checking whether getopt_clip is declared" >&5
-$as_echo_n "checking whether getopt_clip is declared... " >&6; }
-if test "${ac_cv_have_decl_getopt_clip+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <getopt.h>
 
-int
-main ()
-{
-#ifndef getopt_clip
-  (void) getopt_clip;
+    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
 
-  ;
-  return 0;
-}
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_have_decl_getopt_clip=yes
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "no_return_alloc_pixels" >/dev/null 2>&1; then :
+  HAVE_XPM=no
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_have_decl_getopt_clip=no
+  HAVE_XPM=yes
 fi
+rm -f conftest*
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_getopt_clip" >&5
-$as_echo "$ac_cv_have_decl_getopt_clip" >&6; }
-if test $ac_cv_have_decl_getopt_clip = yes; then
-  gl_cv_func_gnu_getopt=no
-else
-  gl_cv_func_gnu_getopt=yes
+
+      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
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ljpeg  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <getopt.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 jpeg_destroy_compress ();
 int
 main ()
 {
-
-            char *myargv[3];
-            myargv[0] = "conftest";
-            myargv[1] = "-+";
-            myargv[2] = 0;
-            return getopt (2, myargv, "+a") != '?';
-
+return jpeg_destroy_compress ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  gl_cv_func_gnu_getopt=yes
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_jpeg_jpeg_destroy_compress=yes
 else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-gl_cv_func_gnu_getopt=no
+  ac_cv_lib_jpeg_jpeg_destroy_compress=no
 fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+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
 fi
-{ $as_echo "$as_me:$LINENO: result: $gl_cv_func_gnu_getopt" >&5
-$as_echo "$gl_cv_func_gnu_getopt" >&6; }
-    if test "$gl_cv_func_gnu_getopt" = "no"; then
-      GETOPT_H=getopt.h
-    fi
-  fi
 
+fi
 
 
-  if test -n "$GETOPT_H"; then
+  fi
 
+    if test "${HAVE_JPEG}" = "yes"; then
+    $as_echo "#define HAVE_JPEG 1" >>confdefs.h
 
-  GETOPT_H=getopt.h
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <jpeglib.h>
+        version=JPEG_LIB_VERSION
 
-cat >>confdefs.h <<\_ACEOF
-#define __GETOPT_PREFIX rpl_
 _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*
 
-
-  :
-  GETOPTOBJS='getopt.o getopt1.o'
-
+  fi
+  if test "${HAVE_JPEG}" = "yes"; then
+    LIBJPEG=-ljpeg
+  fi
 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
+
+fi
 
+done
 
-{ $as_echo "$as_me:$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
+    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
-  # Use it with a single arg.
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lpng -lz -lm $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 png_get_channels ();
 int
 main ()
 {
-getpgrp (0);
+return png_get_channels ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_func_getpgrp_void=no
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_png_png_get_channels=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_func_getpgrp_void=yes
+  ac_cv_lib_png_png_get_channels=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
+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:$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
-
-cat >>confdefs.h <<\_ACEOF
-#define GETPGRP_VOID 1
-_ACEOF
-
+{ $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
 
+    fi
+  fi
 
+  if test "${HAVE_PNG}" = "yes"; then
 
-for ac_func in strftime
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
+$as_echo "#define HAVE_PNG 1" >>confdefs.h
 
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
+    LIBPNG="-lpng -lz -lm"
+  fi
+fi
 
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
 
-#undef $ac_func
+### 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.  */
 
 /* Override any GCC internal prototype to avoid an error.
    Use char because int might match the return type of a GCC
@@ -20627,79 +10731,60 @@ cat >>conftest.$ac_ext <<_ACEOF
 #ifdef __cplusplus
 extern "C"
 #endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
+char TIFFGetVersion ();
 int
 main ()
 {
-return $ac_func ();
+return TIFFGetVersion ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_tiff_TIFFGetVersion=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  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
 
-       eval "$as_ac_var=no"
 fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+
+  fi
+
+  if test "${HAVE_TIFF}" = "yes"; then
+
+$as_echo "#define HAVE_TIFF 1" >>confdefs.h
+
+        LIBTIFF=-ltiff
+  fi
 fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if test `eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
 
-else
-  # strftime is in -lintl on SCO UNIX.
-{ $as_echo "$as_me:$LINENO: checking for strftime in -lintl" >&5
-$as_echo_n "checking for strftime in -lintl... " >&6; }
-if test "${ac_cv_lib_intl_strftime+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="-lintl  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+LIBS="-lgif  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -20708,95 +10793,49 @@ cat >>conftest.$ac_ext <<_ACEOF
 #ifdef __cplusplus
 extern "C"
 #endif
-char strftime ();
+char EGifPutExtensionLast ();
 int
 main ()
 {
-return strftime ();
+return EGifPutExtensionLast ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_intl_strftime=yes
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_gif_EGifPutExtensionLast=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_lib_intl_strftime=no
+  ac_cv_lib_gif_EGifPutExtensionLast=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+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:$LINENO: result: $ac_cv_lib_intl_strftime" >&5
-$as_echo "$ac_cv_lib_intl_strftime" >&6; }
-if test $ac_cv_lib_intl_strftime = yes; then
-  cat >>confdefs.h <<\_ACEOF
-#define HAVE_STRFTIME 1
-_ACEOF
-
-LIBS="-lintl $LIBS"
+{ $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
-done
 
 
-# UNIX98 PTYs.
 
-for ac_func in grantpt
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+  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
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lungif  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
 
 /* Override any GCC internal prototype to avoid an error.
    Use char because int might match the return type of a GCC
@@ -20804,101 +10843,83 @@ cat >>conftest.$ac_ext <<_ACEOF
 #ifdef __cplusplus
 extern "C"
 #endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
+char EGifPutExtensionLast ();
 int
 main ()
 {
-return $ac_func ();
+return EGifPutExtensionLast ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_ungif_EGifPutExtensionLast=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_var=no"
+  ac_cv_lib_ungif_EGifPutExtensionLast=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
 fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if test `eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
+{ $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_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
 fi
-done
 
 
-# PTY-related GNU extensions.
+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"
 
-for ac_func in getpt
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+  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=
+MOUSE_SUPPORT=
+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
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lgpm  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
 
 /* Override any GCC internal prototype to avoid an error.
    Use char because int might match the return type of a GCC
@@ -20906,86 +10927,100 @@ cat >>conftest.$ac_ext <<_ACEOF
 #ifdef __cplusplus
 extern "C"
 #endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
+char Gpm_Open ();
 int
 main ()
 {
-return $ac_func ();
+return Gpm_Open ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_gpm_Gpm_Open=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  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_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
 
-       eval "$as_ac_var=no"
 fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+
+
+  if test "${HAVE_GPM}" = "yes"; then
+
+$as_echo "#define HAVE_GPM 1" >>confdefs.h
+
+    LIBGPM=-lgpm
+    ## May be reset below.
+    MOUSE_SUPPORT="\$(GPM_MOUSE_SUPPORT)"
+  fi
 fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if test `eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
+
+
+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 :
+
+$as_echo "#define HAVE_MALLOC_MALLOC_H 1" >>confdefs.h
 
 fi
-done
 
 
-# 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.
 
-{ $as_echo "$as_me:$LINENO: checking for tparm in -lncurses" >&5
-$as_echo_n "checking for tparm in -lncurses... " >&6; }
-if test "${ac_cv_lib_ncurses_tparm+set}" = set; then
+C_SWITCH_X_SYSTEM=
+### Use NeXTstep API to implement GUI.
+if test "${HAVE_NS}" = "yes"; then
+
+$as_echo "#define HAVE_NS 1" >>confdefs.h
+
+  if test "${NS_IMPL_COCOA}" = "yes"; then
+
+$as_echo "#define NS_IMPL_COCOA 1" >>confdefs.h
+
+    GNU_OBJC_CFLAGS=
+  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.  */
+    C_SWITCH_X_SYSTEM="-D_REENTRANT -fPIC -fno-strict-aliasing"
+    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
+
+$as_echo "#define NS_HAVE_NSINTEGER 1" >>confdefs.h
+
+  fi
+  # We also have mouse menus.
+  HAVE_MENUS=yes
+  OTHER_FILES=ns-app
+fi
+
+
+### 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="-lncurses  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+LIBS="-lSM -lICE $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -20994,374 +11029,285 @@ cat >>conftest.$ac_ext <<_ACEOF
 #ifdef __cplusplus
 extern "C"
 #endif
-char tparm ();
+char SmcOpenConnection ();
 int
 main ()
 {
-return tparm ();
+return SmcOpenConnection ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_ncurses_tparm=yes
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_SM_SmcOpenConnection=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_lib_ncurses_tparm=no
+  ac_cv_lib_SM_SmcOpenConnection=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+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:$LINENO: result: $ac_cv_lib_ncurses_tparm" >&5
-$as_echo "$ac_cv_lib_ncurses_tparm" >&6; }
-if test $ac_cv_lib_ncurses_tparm = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBNCURSES 1
-_ACEOF
-
-  LIBS="-lncurses $LIBS"
+{ $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
 
 
-# Do we have res_init, for detecting changes in /etc/resolv.conf?
 
-resolv=no
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  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
+
+
+# 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 <netinet/in.h>
-#include <arpa/nameser.h>
-#include <resolv.h>
+#include <netdb.h>
 int
 main ()
 {
-return res_init();
+return h_errno;
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  have_res_init=yes
+if ac_fn_c_try_link "$LINENO"; then :
+  emacs_cv_netdb_declares_h_errno=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  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
 
-       have_res_init=no
 fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-if test "$have_res_init" = no; then
-  OLIBS="$LIBS"
-  LIBS="$LIBS -lresolv"
-  { $as_echo "$as_me:$LINENO: checking for res_init with -lresolv" >&5
-$as_echo_n "checking for res_init with -lresolv... " >&6; }
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
+# for constant arguments.  Useless!
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5
+$as_echo_n "checking for working alloca.h... " >&6; }
+if test "${ac_cv_working_alloca_h+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <netinet/in.h>
-#include <arpa/nameser.h>
-#include <resolv.h>
+#include <alloca.h>
 int
 main ()
 {
-return res_init();
+char *p = (char *) alloca (2 * sizeof (int));
+                         if (p) return 0;
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  have_res_init=yes
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_working_alloca_h=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       have_res_init=no
+  ac_cv_working_alloca_h=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-  { $as_echo "$as_me:$LINENO: result: $have_res_init" >&5
-$as_echo "$have_res_init" >&6; }
-  if test "$have_res_init" = yes ; then
-    resolv=yes
-  fi
-  LIBS="$OLIBS"
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5
+$as_echo "$ac_cv_working_alloca_h" >&6; }
+if test $ac_cv_working_alloca_h = yes; then
 
-if test "$have_res_init" = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_RES_INIT 1
-_ACEOF
+$as_echo "#define HAVE_ALLOCA_H 1" >>confdefs.h
 
 fi
 
-# Do we need the Hesiod library to provide the support routines?
-if test "$with_hesiod" != no ; then
-  # Don't set $LIBS here -- see comments above.
-  { $as_echo "$as_me:$LINENO: checking for res_send" >&5
-$as_echo_n "checking for res_send... " >&6; }
-if test "${ac_cv_func_res_send+set}" = set; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5
+$as_echo_n "checking for alloca... " >&6; }
+if test "${ac_cv_func_alloca_works+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-/* Define res_send to an innocuous variant, in case <limits.h> declares res_send.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define res_send innocuous_res_send
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char res_send (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
+#ifdef __GNUC__
+# define alloca __builtin_alloca
 #else
-# include <assert.h>
-#endif
-
-#undef res_send
-
-/* 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 ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_res_send || defined __stub___res_send
-choke me
+# ifdef _MSC_VER
+#  include <malloc.h>
+#  define alloca _alloca
+# else
+#  ifdef HAVE_ALLOCA_H
+#   include <alloca.h>
+#  else
+#   ifdef _AIX
+ #pragma alloca
+#   else
+#    ifndef alloca /* predefined by HP cc +Olibcalls */
+char *alloca ();
+#    endif
+#   endif
+#  endif
+# endif
 #endif
 
 int
 main ()
 {
-return res_send ();
+char *p = (char *) alloca (1);
+                                   if (p) return 0;
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_func_res_send=yes
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_func_alloca_works=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_func_res_send=no
+  ac_cv_func_alloca_works=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_res_send" >&5
-$as_echo "$ac_cv_func_res_send" >&6; }
-if test $ac_cv_func_res_send = yes; then
-  :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5
+$as_echo "$ac_cv_func_alloca_works" >&6; }
+
+if test $ac_cv_func_alloca_works = yes; then
+
+$as_echo "#define HAVE_ALLOCA 1" >>confdefs.h
+
 else
-  { $as_echo "$as_me:$LINENO: checking for __res_send" >&5
-$as_echo_n "checking for __res_send... " >&6; }
-if test "${ac_cv_func___res_send+set}" = set; then
+  # The SVR3 libPW and SVR4 libucb both contain incompatible functions
+# that cause trouble.  Some versions do not even contain alloca or
+# contain a buggy version.  If you still want to use their alloca,
+# use ar to extract alloca.o from them instead of compiling alloca.c.
+
+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; }
+if test "${ac_cv_os_cray+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-/* Define __res_send to an innocuous variant, in case <limits.h> declares __res_send.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define __res_send innocuous___res_send
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char __res_send (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
+#if defined CRAY && ! defined CRAY2
+webecray
 #else
-# include <assert.h>
+wenotbecray
 #endif
 
-#undef __res_send
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "webecray" >/dev/null 2>&1; then :
+  ac_cv_os_cray=yes
+else
+  ac_cv_os_cray=no
+fi
+rm -f conftest*
 
-/* 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 ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub___res_send || defined __stub_____res_send
-choke me
-#endif
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_os_cray" >&5
+$as_echo "$ac_cv_os_cray" >&6; }
+if test $ac_cv_os_cray = yes; then
+  for ac_func in _getb67 GETB67 getb67; 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 CRAY_STACKSEG_END $ac_func
+_ACEOF
+
+    break
+fi
+
+  done
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5
+$as_echo_n "checking stack direction for C alloca... " >&6; }
+if test "${ac_cv_c_stack_direction+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "$cross_compiling" = yes; then :
+  ac_cv_c_stack_direction=0
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$ac_includes_default
+int
+find_stack_direction ()
+{
+  static char *addr = 0;
+  auto char dummy;
+  if (addr == 0)
+    {
+      addr = &dummy;
+      return find_stack_direction ();
+    }
+  else
+    return (&dummy > addr) ? 1 : -1;
+}
 
 int
 main ()
 {
-return __res_send ();
-  ;
-  return 0;
+  return find_stack_direction () < 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_func___res_send=yes
+if ac_fn_c_try_run "$LINENO"; then :
+  ac_cv_c_stack_direction=1
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  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
 
-       ac_cv_func___res_send=no
 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
+
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_func___res_send" >&5
-$as_echo "$ac_cv_func___res_send" >&6; }
-if test $ac_cv_func___res_send = yes; then
-  :
-else
-  { $as_echo "$as_me:$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
+
+
+if test x"$ac_cv_func_alloca_works" != xyes; then
+   as_fn_error "a system implementation of alloca is required " "$LINENO" 5
+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="-lresolv  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+LIBS="-lm  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -21370,66 +11316,46 @@ cat >>conftest.$ac_ext <<_ACEOF
 #ifdef __cplusplus
 extern "C"
 #endif
-char res_send ();
+char sqrt ();
 int
 main ()
 {
-return res_send ();
+return sqrt ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_resolv_res_send=yes
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_m_sqrt=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_lib_resolv_res_send=no
+  ac_cv_lib_m_sqrt=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+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:$LINENO: result: $ac_cv_lib_resolv_res_send" >&5
-$as_echo "$ac_cv_lib_resolv_res_send" >&6; }
-if test $ac_cv_lib_resolv_res_send = yes; then
-  resolv=yes
-else
-  { $as_echo "$as_me:$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 "$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="-lresolv  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+LIBS="-lmail  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -21438,93 +11364,50 @@ cat >>conftest.$ac_ext <<_ACEOF
 #ifdef __cplusplus
 extern "C"
 #endif
-char __res_send ();
+char maillock ();
 int
 main ()
 {
-return __res_send ();
+return maillock ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_resolv___res_send=yes
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_mail_maillock=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_lib_resolv___res_send=no
+  ac_cv_lib_mail_maillock=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+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:$LINENO: result: $ac_cv_lib_resolv___res_send" >&5
-$as_echo "$ac_cv_lib_resolv___res_send" >&6; }
-if test $ac_cv_lib_resolv___res_send = yes; then
-  resolv=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_mail=no
 fi
 
-fi
+if test $have_mail = yes; then
+  LIBS_MAIL=-lmail
+  LIBS="$LIBS_MAIL $LIBS"
 
-fi
+$as_echo "#define HAVE_LIBMAIL 1" >>confdefs.h
 
+else
+  LIBS_MAIL=
 fi
-
-  if test "$resolv" = yes ; then
-    RESOLVLIB=-lresolv
-  else
-    RESOLVLIB=
-  fi
-  { $as_echo "$as_me:$LINENO: checking for hes_getmailhost" >&5
-$as_echo_n "checking for hes_getmailhost... " >&6; }
-if test "${ac_cv_func_hes_getmailhost+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
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-llockfile  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-/* Define hes_getmailhost to an innocuous variant, in case <limits.h> declares hes_getmailhost.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define hes_getmailhost innocuous_hes_getmailhost
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char hes_getmailhost (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef hes_getmailhost
 
 /* Override any GCC internal prototype to avoid an error.
    Use char because int might match the return type of a GCC
@@ -21532,313 +11415,487 @@ cat >>conftest.$ac_ext <<_ACEOF
 #ifdef __cplusplus
 extern "C"
 #endif
-char hes_getmailhost ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_hes_getmailhost || defined __stub___hes_getmailhost
-choke me
-#endif
-
+char maillock ();
 int
 main ()
 {
-return hes_getmailhost ();
+return maillock ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_func_hes_getmailhost=yes
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_lockfile_maillock=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_func_hes_getmailhost=no
+  ac_cv_lib_lockfile_maillock=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+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:$LINENO: result: $ac_cv_func_hes_getmailhost" >&5
-$as_echo "$ac_cv_func_hes_getmailhost" >&6; }
-if test $ac_cv_func_hes_getmailhost = yes; then
-  :
+{ $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
-  { $as_echo "$as_me:$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
+  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
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lhesiod $RESOLVLIB $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+  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
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* 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 hes_getmailhost ();
-int
-main ()
-{
-return hes_getmailhost ();
-  ;
-  return 0;
-}
+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 dup2 \
+rename closedir mkdir rmdir sysinfo getrusage get_current_dir_name \
+random lrand48 logb frexp fmod rint cbrt ftime setsid \
+strerror fpathconf select mktime euidaccess getpagesize tzset setlocale \
+utimes getrlimit setrlimit setpgid getcwd getwd shutdown getaddrinfo \
+__fpending mblen mbrlen mbsinit strsignal setitimer ualarm strchr strrchr \
+sendto recvfrom getsockopt setsockopt getsockname getpeername \
+gai_strerror mkstemp getline getdelim mremap memmove fsync sync \
+memset memcmp difftime memcpy mempcpy mblen mbrlen posix_memalign \
+cfmakeraw cfsetspeed isnan 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
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_hesiod_hes_getmailhost=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-       ac_cv_lib_hesiod_hes_getmailhost=no
 fi
+done
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_hesiod_hes_getmailhost" >&5
-$as_echo "$ac_cv_lib_hesiod_hes_getmailhost" >&6; }
-if test $ac_cv_lib_hesiod_hes_getmailhost = yes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_LIBHESIOD 1
+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
 
-else
-  :
 fi
 
-fi
+done
+
+
+
 
-fi
 
-# Do we need libresolv (due to res_init or Hesiod)?
-if test "$resolv" = yes ; then
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_LIBRESOLV 1
+
+  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
+done
 
-# These tell us which Kerberos-related libraries to use.
-if test "${with_kerberos}" != no; then
 
-{ $as_echo "$as_me:$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 "$as_me:${as_lineno-$LINENO}: checking for working mktime" >&5
+$as_echo_n "checking for working mktime... " >&6; }
+if test "${ac_cv_func_working_mktime+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lcom_err  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  if test "$cross_compiling" = yes; then :
+  ac_cv_func_working_mktime=no
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
+/* Test program from Paul Eggert and Tony Leneis.  */
+#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
 
-/* 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"
+#include <limits.h>
+#include <stdlib.h>
+
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
 #endif
-char com_err ();
+
+#ifndef HAVE_ALARM
+# define alarm(X) /* empty */
+#endif
+
+/* Work around redefinition to rpl_putenv by other config tests.  */
+#undef putenv
+
+static time_t time_t_max;
+static time_t time_t_min;
+
+/* Values we'll use to set the TZ environment variable.  */
+static char *tz_strings[] = {
+  (char *) 0, "TZ=GMT0", "TZ=JST-9",
+  "TZ=EST+3EDT+2,M10.1.0/00:00:00,M2.3.0/00:00:00"
+};
+#define N_STRINGS (sizeof (tz_strings) / sizeof (tz_strings[0]))
+
+/* Return 0 if mktime fails to convert a date in the spring-forward gap.
+   Based on a problem report from Andreas Jaeger.  */
+static int
+spring_forward_gap ()
+{
+  /* glibc (up to about 1998-10-07) failed this test. */
+  struct tm tm;
+
+  /* Use the portable POSIX.1 specification "TZ=PST8PDT,M4.1.0,M10.5.0"
+     instead of "TZ=America/Vancouver" in order to detect the bug even
+     on systems that don't support the Olson extension, or don't have the
+     full zoneinfo tables installed.  */
+  putenv ("TZ=PST8PDT,M4.1.0,M10.5.0");
+
+  tm.tm_year = 98;
+  tm.tm_mon = 3;
+  tm.tm_mday = 5;
+  tm.tm_hour = 2;
+  tm.tm_min = 0;
+  tm.tm_sec = 0;
+  tm.tm_isdst = -1;
+  return mktime (&tm) != (time_t) -1;
+}
+
+static int
+mktime_test1 (now)
+     time_t now;
+{
+  struct tm *lt;
+  return ! (lt = localtime (&now)) || mktime (lt) == now;
+}
+
+static int
+mktime_test (now)
+     time_t now;
+{
+  return (mktime_test1 (now)
+         && mktime_test1 ((time_t) (time_t_max - now))
+         && mktime_test1 ((time_t) (time_t_min + now)));
+}
+
+static int
+irix_6_4_bug ()
+{
+  /* Based on code from Ariel Faigon.  */
+  struct tm tm;
+  tm.tm_year = 96;
+  tm.tm_mon = 3;
+  tm.tm_mday = 0;
+  tm.tm_hour = 0;
+  tm.tm_min = 0;
+  tm.tm_sec = 0;
+  tm.tm_isdst = -1;
+  mktime (&tm);
+  return tm.tm_mon == 2 && tm.tm_mday == 31;
+}
+
+static int
+bigtime_test (j)
+     int j;
+{
+  struct tm tm;
+  time_t now;
+  tm.tm_year = tm.tm_mon = tm.tm_mday = tm.tm_hour = tm.tm_min = tm.tm_sec = j;
+  now = mktime (&tm);
+  if (now != (time_t) -1)
+    {
+      struct tm *lt = localtime (&now);
+      if (! (lt
+            && lt->tm_year == tm.tm_year
+            && lt->tm_mon == tm.tm_mon
+            && lt->tm_mday == tm.tm_mday
+            && lt->tm_hour == tm.tm_hour
+            && lt->tm_min == tm.tm_min
+            && lt->tm_sec == tm.tm_sec
+            && lt->tm_yday == tm.tm_yday
+            && lt->tm_wday == tm.tm_wday
+            && ((lt->tm_isdst < 0 ? -1 : 0 < lt->tm_isdst)
+                 == (tm.tm_isdst < 0 ? -1 : 0 < tm.tm_isdst))))
+       return 0;
+    }
+  return 1;
+}
+
+static int
+year_2050_test ()
+{
+  /* The correct answer for 2050-02-01 00:00:00 in Pacific time,
+     ignoring leap seconds.  */
+  unsigned long int answer = 2527315200UL;
+
+  struct tm tm;
+  time_t t;
+  tm.tm_year = 2050 - 1900;
+  tm.tm_mon = 2 - 1;
+  tm.tm_mday = 1;
+  tm.tm_hour = tm.tm_min = tm.tm_sec = 0;
+  tm.tm_isdst = -1;
+
+  /* Use the portable POSIX.1 specification "TZ=PST8PDT,M4.1.0,M10.5.0"
+     instead of "TZ=America/Vancouver" in order to detect the bug even
+     on systems that don't support the Olson extension, or don't have the
+     full zoneinfo tables installed.  */
+  putenv ("TZ=PST8PDT,M4.1.0,M10.5.0");
+
+  t = mktime (&tm);
+
+  /* Check that the result is either a failure, or close enough
+     to the correct answer that we can assume the discrepancy is
+     due to leap seconds.  */
+  return (t == (time_t) -1
+         || (0 < t && answer - 120 <= t && t <= answer + 120));
+}
+
 int
 main ()
 {
-return com_err ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_com_err_com_err=yes
+  time_t t, delta;
+  int i, j;
+
+  /* This test makes some buggy mktime implementations loop.
+     Give up after 60 seconds; a mktime slower than that
+     isn't worth using anyway.  */
+  alarm (60);
+
+  for (;;)
+    {
+      t = (time_t_max << 1) + 1;
+      if (t <= time_t_max)
+       break;
+      time_t_max = t;
+    }
+  time_t_min = - ((time_t) ~ (time_t) 0 == (time_t) -1) - time_t_max;
+
+  delta = time_t_max / 997; /* a suitable prime number */
+  for (i = 0; i < N_STRINGS; i++)
+    {
+      if (tz_strings[i])
+       putenv (tz_strings[i]);
+
+      for (t = 0; t <= time_t_max - delta; t += delta)
+       if (! mktime_test (t))
+         return 1;
+      if (! (mktime_test ((time_t) 1)
+            && mktime_test ((time_t) (60 * 60))
+            && mktime_test ((time_t) (60 * 60 * 24))))
+       return 1;
+
+      for (j = 1; ; j <<= 1)
+       if (! bigtime_test (j))
+         return 1;
+       else if (INT_MAX / 2 < j)
+         break;
+      if (! bigtime_test (INT_MAX))
+       return 1;
+    }
+  return ! (irix_6_4_bug () && spring_forward_gap () && year_2050_test ());
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  ac_cv_func_working_mktime=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  ac_cv_func_working_mktime=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
 
-       ac_cv_lib_com_err_com_err=no
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_working_mktime" >&5
+$as_echo "$ac_cv_func_working_mktime" >&6; }
+if test $ac_cv_func_working_mktime = no; then
+  case " $LIBOBJS " in
+  *" mktime.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS mktime.$ac_objext"
+ ;;
+esac
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_com_err_com_err" >&5
-$as_echo "$ac_cv_lib_com_err_com_err" >&6; }
-if test $ac_cv_lib_com_err_com_err = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBCOM_ERR 1
-_ACEOF
 
-  LIBS="-lcom_err $LIBS"
+if test "$ac_cv_func_working_mktime" = no; then
+
+$as_echo "#define BROKEN_MKTIME 1" >>confdefs.h
 
 fi
 
+ac_have_func=no # yes means we've found a way to get the load average.
 
-{ $as_echo "$as_me:$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 >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
+# Make sure getloadavg.c is where it belongs, at configure-time.
+test -f "$srcdir/$ac_config_libobj_dir/getloadavg.c" ||
+  as_fn_error "$srcdir/$ac_config_libobj_dir/getloadavg.c is missing" "$LINENO" 5
 
-/* 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
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_k5crypto_mit_des_cbc_encrypt=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+ac_save_LIBS=$LIBS
 
-       ac_cv_lib_k5crypto_mit_des_cbc_encrypt=no
+# Check for getloadavg, but be sure not to touch the cache variable.
+(ac_fn_c_check_func "$LINENO" "getloadavg" "ac_cv_func_getloadavg"
+if test "x$ac_cv_func_getloadavg" = x""yes; then :
+  exit 0
+else
+  exit 1
 fi
+) && ac_have_func=yes
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_k5crypto_mit_des_cbc_encrypt" >&5
-$as_echo "$ac_cv_lib_k5crypto_mit_des_cbc_encrypt" >&6; }
-if test $ac_cv_lib_k5crypto_mit_des_cbc_encrypt = yes; then
+# On HPUX9, an unprivileged user can get load averages through this function.
+for ac_func in pstat_getdynamic
+do :
+  ac_fn_c_check_func "$LINENO" "pstat_getdynamic" "ac_cv_func_pstat_getdynamic"
+if test "x$ac_cv_func_pstat_getdynamic" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBK5CRYPTO 1
+#define HAVE_PSTAT_GETDYNAMIC 1
 _ACEOF
 
-  LIBS="-lk5crypto $LIBS"
-
 fi
+done
 
 
-{ $as_echo "$as_me:$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
+# Solaris has libkstat which does not require root.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for kstat_open in -lkstat" >&5
+$as_echo_n "checking for kstat_open in -lkstat... " >&6; }
+if test "${ac_cv_lib_kstat_kstat_open+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lcrypto  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+LIBS="-lkstat  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -21847,73 +11904,50 @@ cat >>conftest.$ac_ext <<_ACEOF
 #ifdef __cplusplus
 extern "C"
 #endif
-char mit_des_cbc_encrypt ();
+char kstat_open ();
 int
 main ()
 {
-return mit_des_cbc_encrypt ();
+return kstat_open ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_crypto_mit_des_cbc_encrypt=yes
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_kstat_kstat_open=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_lib_crypto_mit_des_cbc_encrypt=no
+  ac_cv_lib_kstat_kstat_open=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+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:$LINENO: result: $ac_cv_lib_crypto_mit_des_cbc_encrypt" >&5
-$as_echo "$ac_cv_lib_crypto_mit_des_cbc_encrypt" >&6; }
-if test $ac_cv_lib_crypto_mit_des_cbc_encrypt = yes; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_kstat_kstat_open" >&5
+$as_echo "$ac_cv_lib_kstat_kstat_open" >&6; }
+if test "x$ac_cv_lib_kstat_kstat_open" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBCRYPTO 1
+#define HAVE_LIBKSTAT 1
 _ACEOF
 
-  LIBS="-lcrypto $LIBS"
+  LIBS="-lkstat $LIBS"
 
 fi
 
+test $ac_cv_lib_kstat_kstat_open = yes && ac_have_func=yes
 
-{ $as_echo "$as_me:$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
+# Some systems with -lutil have (and need) -lkvm as well, some do not.
+# On Solaris, -lkvm requires nlist from -lelf, so check that first
+# to get the right answer into the cache.
+# For kstat on solaris, we need libelf to force the definition of SVR4 below.
+if test $ac_have_func = no; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for elf_begin in -lelf" >&5
+$as_echo_n "checking for elf_begin in -lelf... " >&6; }
+if test "${ac_cv_lib_elf_elf_begin+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lkrb5  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+LIBS="-lelf  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -21922,74 +11956,40 @@ cat >>conftest.$ac_ext <<_ACEOF
 #ifdef __cplusplus
 extern "C"
 #endif
-char krb5_init_context ();
+char elf_begin ();
 int
 main ()
 {
-return krb5_init_context ();
+return elf_begin ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_krb5_krb5_init_context=yes
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_elf_elf_begin=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_lib_krb5_krb5_init_context=no
+  ac_cv_lib_elf_elf_begin=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+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:$LINENO: result: $ac_cv_lib_krb5_krb5_init_context" >&5
-$as_echo "$ac_cv_lib_krb5_krb5_init_context" >&6; }
-if test $ac_cv_lib_krb5_krb5_init_context = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBKRB5 1
-_ACEOF
-
-  LIBS="-lkrb5 $LIBS"
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_elf_elf_begin" >&5
+$as_echo "$ac_cv_lib_elf_elf_begin" >&6; }
+if test "x$ac_cv_lib_elf_elf_begin" = x""yes; then :
+  LIBS="-lelf $LIBS"
 fi
 
-  if test "${with_kerberos5}" = no; then
-
-{ $as_echo "$as_me:$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
+if test $ac_have_func = no; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for kvm_open in -lkvm" >&5
+$as_echo_n "checking for kvm_open in -lkvm... " >&6; }
+if test "${ac_cv_lib_kvm_kvm_open+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldes425  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+LIBS="-lkvm  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -21998,72 +11998,39 @@ cat >>conftest.$ac_ext <<_ACEOF
 #ifdef __cplusplus
 extern "C"
 #endif
-char des_cbc_encrypt ();
+char kvm_open ();
 int
 main ()
 {
-return des_cbc_encrypt ();
+return kvm_open ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_des425_des_cbc_encrypt=yes
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_kvm_kvm_open=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_lib_des425_des_cbc_encrypt=no
+  ac_cv_lib_kvm_kvm_open=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+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:$LINENO: result: $ac_cv_lib_des425_des_cbc_encrypt" >&5
-$as_echo "$ac_cv_lib_des425_des_cbc_encrypt" >&6; }
-if test $ac_cv_lib_des425_des_cbc_encrypt = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBDES425 1
-_ACEOF
-
-  LIBS="-ldes425 $LIBS"
-
-else
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_kvm_kvm_open" >&5
+$as_echo "$ac_cv_lib_kvm_kvm_open" >&6; }
+if test "x$ac_cv_lib_kvm_kvm_open" = x""yes; then :
+  LIBS="-lkvm $LIBS"
+fi
 
-{ $as_echo "$as_me:$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
+  # Check for the 4.4BSD definition of getloadavg.
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getloadavg in -lutil" >&5
+$as_echo_n "checking for getloadavg in -lutil... " >&6; }
+if test "${ac_cv_lib_util_getloadavg+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldes  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+LIBS="-lutil  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -22072,75 +12039,45 @@ cat >>conftest.$ac_ext <<_ACEOF
 #ifdef __cplusplus
 extern "C"
 #endif
-char des_cbc_encrypt ();
+char getloadavg ();
 int
 main ()
 {
-return des_cbc_encrypt ();
+return getloadavg ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_des_des_cbc_encrypt=yes
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_util_getloadavg=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_lib_des_des_cbc_encrypt=no
+  ac_cv_lib_util_getloadavg=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+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:$LINENO: result: $ac_cv_lib_des_des_cbc_encrypt" >&5
-$as_echo "$ac_cv_lib_des_des_cbc_encrypt" >&6; }
-if test $ac_cv_lib_des_des_cbc_encrypt = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBDES 1
-_ACEOF
-
-  LIBS="-ldes $LIBS"
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_util_getloadavg" >&5
+$as_echo "$ac_cv_lib_util_getloadavg" >&6; }
+if test "x$ac_cv_lib_util_getloadavg" = x""yes; then :
+  LIBS="-lutil $LIBS" ac_have_func=yes ac_cv_func_getloadavg_setgid=yes
 fi
 
 fi
 
-
-{ $as_echo "$as_me:$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
+if test $ac_have_func = no; then
+  # There is a commonly available library for RS/6000 AIX.
+  # Since it is not a standard part of AIX, it might be installed locally.
+  ac_getloadavg_LIBS=$LIBS
+  LIBS="-L/usr/local/lib $LIBS"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getloadavg in -lgetloadavg" >&5
+$as_echo_n "checking for getloadavg in -lgetloadavg... " >&6; }
+if test "${ac_cv_lib_getloadavg_getloadavg+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lkrb4  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+LIBS="-lgetloadavg  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -22149,72 +12086,70 @@ cat >>conftest.$ac_ext <<_ACEOF
 #ifdef __cplusplus
 extern "C"
 #endif
-char krb_get_cred ();
+char getloadavg ();
 int
 main ()
 {
-return krb_get_cred ();
+return getloadavg ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_krb4_krb_get_cred=yes
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_getloadavg_getloadavg=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_lib_krb4_krb_get_cred=no
+  ac_cv_lib_getloadavg_getloadavg=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+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:$LINENO: result: $ac_cv_lib_krb4_krb_get_cred" >&5
-$as_echo "$ac_cv_lib_krb4_krb_get_cred" >&6; }
-if test $ac_cv_lib_krb4_krb_get_cred = yes; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_getloadavg_getloadavg" >&5
+$as_echo "$ac_cv_lib_getloadavg_getloadavg" >&6; }
+if test "x$ac_cv_lib_getloadavg_getloadavg" = x""yes; then :
+  LIBS="-lgetloadavg $LIBS"
+else
+  LIBS=$ac_getloadavg_LIBS
+fi
+
+fi
+
+# Make sure it is really in the library, if we think we found it,
+# otherwise set up the replacement function.
+for ac_func in getloadavg
+do :
+  ac_fn_c_check_func "$LINENO" "getloadavg" "ac_cv_func_getloadavg"
+if test "x$ac_cv_func_getloadavg" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBKRB4 1
+#define HAVE_GETLOADAVG 1
 _ACEOF
 
-  LIBS="-lkrb4 $LIBS"
-
 else
+  case " $LIBOBJS " in
+  *" getloadavg.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS getloadavg.$ac_objext"
+ ;;
+esac
 
-{ $as_echo "$as_me:$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 "#define C_GETLOADAVG 1" >>confdefs.h
+
+# Figure out what our getloadavg.c needs.
+ac_have_func=no
+ac_fn_c_check_header_mongrel "$LINENO" "sys/dg_sys_info.h" "ac_cv_header_sys_dg_sys_info_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_dg_sys_info_h" = x""yes; then :
+  ac_have_func=yes
+
+$as_echo "#define DGUX 1" >>confdefs.h
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dg_sys_info in -ldgc" >&5
+$as_echo_n "checking for dg_sys_info in -ldgc... " >&6; }
+if test "${ac_cv_lib_dgc_dg_sys_info+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lkrb  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+LIBS="-ldgc  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -22223,1458 +12158,1040 @@ cat >>conftest.$ac_ext <<_ACEOF
 #ifdef __cplusplus
 extern "C"
 #endif
-char krb_get_cred ();
+char dg_sys_info ();
 int
 main ()
 {
-return krb_get_cred ();
+return dg_sys_info ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_krb_krb_get_cred=yes
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_dgc_dg_sys_info=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_lib_krb_krb_get_cred=no
+  ac_cv_lib_dgc_dg_sys_info=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+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:$LINENO: result: $ac_cv_lib_krb_krb_get_cred" >&5
-$as_echo "$ac_cv_lib_krb_krb_get_cred" >&6; }
-if test $ac_cv_lib_krb_krb_get_cred = yes; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dgc_dg_sys_info" >&5
+$as_echo "$ac_cv_lib_dgc_dg_sys_info" >&6; }
+if test "x$ac_cv_lib_dgc_dg_sys_info" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBKRB 1
+#define HAVE_LIBDGC 1
 _ACEOF
 
-  LIBS="-lkrb $LIBS"
+  LIBS="-ldgc $LIBS"
 
 fi
 
 fi
 
-  fi
 
-  if test "${with_kerberos5}" != no; then
 
-for ac_header in krb5.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
+ac_fn_c_check_header_mongrel "$LINENO" "locale.h" "ac_cv_header_locale_h" "$ac_includes_default"
+if test "x$ac_cv_header_locale_h" = x""yes; then :
+
 fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
+
+
+for ac_func in setlocale
+do :
+  ac_fn_c_check_func "$LINENO" "setlocale" "ac_cv_func_setlocale"
+if test "x$ac_cv_func_setlocale" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_SETLOCALE 1
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-       ac_header_compiler=no
 fi
+done
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
 
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+# We cannot check for <dwarf.h>, because Solaris 2 does not use dwarf (it
+# uses stabs), but it is still SVR4.  We cannot check for <elf.h> because
+# Irix 4.0.5F has the header but not the library.
+if test $ac_have_func = no && test "$ac_cv_lib_elf_elf_begin" = yes; then
+  ac_have_func=yes
+
+$as_echo "#define SVR4 1" >>confdefs.h
 
-  ac_header_preproc=no
 fi
 
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
+if test $ac_have_func = no; then
+  ac_fn_c_check_header_mongrel "$LINENO" "inq_stats/cpustats.h" "ac_cv_header_inq_stats_cpustats_h" "$ac_includes_default"
+if test "x$ac_cv_header_inq_stats_cpustats_h" = x""yes; then :
+  ac_have_func=yes
 
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+$as_echo "#define UMAX 1" >>confdefs.h
+
+
+$as_echo "#define UMAX4_3 1" >>confdefs.h
 
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
 fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
+
+
+fi
+
+if test $ac_have_func = no; then
+  ac_fn_c_check_header_mongrel "$LINENO" "sys/cpustats.h" "ac_cv_header_sys_cpustats_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_cpustats_h" = x""yes; then :
+  ac_have_func=yes; $as_echo "#define UMAX 1" >>confdefs.h
+
+fi
+
 
 fi
-if test `eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'` = yes; then
+
+if test $ac_have_func = no; then
+  for ac_header in mach/mach.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "mach/mach.h" "ac_cv_header_mach_mach_h" "$ac_includes_default"
+if test "x$ac_cv_header_mach_mach_h" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
- { $as_echo "$as_me:$LINENO: checking for krb5_error.text" >&5
-$as_echo_n "checking for krb5_error.text... " >&6; }
-if test "${ac_cv_member_krb5_error_text+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+#define HAVE_MACH_MACH_H 1
 _ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <krb5.h>
 
-int
-main ()
-{
-static krb5_error ac_aggr;
-if (ac_aggr.text)
-return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_member_krb5_error_text=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+fi
+
+done
 
-       cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+fi
+
+for ac_header in nlist.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "nlist.h" "ac_cv_header_nlist_h" "$ac_includes_default"
+if test "x$ac_cv_header_nlist_h" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_NLIST_H 1
 _ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <krb5.h>
+ ac_fn_c_check_member "$LINENO" "struct nlist" "n_un.n_name" "ac_cv_member_struct_nlist_n_un_n_name" "#include <nlist.h>
+"
+if test "x$ac_cv_member_struct_nlist_n_un_n_name" = x""yes; then :
 
-int
-main ()
-{
-static krb5_error ac_aggr;
-if (sizeof ac_aggr.text)
-return 0;
-  ;
-  return 0;
-}
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_NLIST_N_UN_N_NAME 1
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_member_krb5_error_text=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-       ac_cv_member_krb5_error_text=no
+
+$as_echo "#define NLIST_NAME_UNION 1" >>confdefs.h
+
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_member_krb5_error_text" >&5
-$as_echo "$ac_cv_member_krb5_error_text" >&6; }
-if test $ac_cv_member_krb5_error_text = yes; then
+done
 
-cat >>confdefs.h <<_ACEOF
-#define HAVE_KRB5_ERROR_TEXT 1
+
+# Some definitions of getloadavg require that the program be installed setgid.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether getloadavg requires setgid" >&5
+$as_echo_n "checking whether getloadavg requires setgid... " >&6; }
+if test "${ac_cv_func_getloadavg_setgid+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include "$srcdir/$ac_config_libobj_dir/getloadavg.c"
+#ifdef LDAV_PRIVILEGED
+Yowza Am I SETGID yet
+#endif
 _ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "Yowza Am I SETGID yet" >/dev/null 2>&1; then :
+  ac_cv_func_getloadavg_setgid=yes
+else
+  ac_cv_func_getloadavg_setgid=no
+fi
+rm -f conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_getloadavg_setgid" >&5
+$as_echo "$ac_cv_func_getloadavg_setgid" >&6; }
+if test $ac_cv_func_getloadavg_setgid = yes; then
+  NEED_SETGID=true
 
+$as_echo "#define GETLOADAVG_PRIVILEGED 1" >>confdefs.h
 
+else
+  NEED_SETGID=false
 fi
-{ $as_echo "$as_me:$LINENO: checking for krb5_error.e_text" >&5
-$as_echo_n "checking for krb5_error.e_text... " >&6; }
-if test "${ac_cv_member_krb5_error_e_text+set}" = set; then
+
+if test $ac_cv_func_getloadavg_setgid = yes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking group of /dev/kmem" >&5
+$as_echo_n "checking group of /dev/kmem... " >&6; }
+if test "${ac_cv_group_kmem+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <krb5.h>
+   # On Solaris, /dev/kmem is a symlink.  Get info on the real file.
+  ac_ls_output=`ls -lgL /dev/kmem 2>/dev/null`
+  # If we got an error (system does not support symlinks), try without -L.
+  test -z "$ac_ls_output" && ac_ls_output=`ls -lg /dev/kmem`
+  ac_cv_group_kmem=`$as_echo "$ac_ls_output" \
+    | sed -ne 's/[      ][      ]*/ /g;
+              s/^.[sSrwx-]* *[0-9]* *\([^0-9]*\)  *.*/\1/;
+              / /s/.* //;p;'`
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_group_kmem" >&5
+$as_echo "$ac_cv_group_kmem" >&6; }
+  KMEM_GROUP=$ac_cv_group_kmem
+fi
+if test "x$ac_save_LIBS" = x; then
+  GETLOADAVG_LIBS=$LIBS
+else
+  GETLOADAVG_LIBS=`$as_echo "$LIBS" | sed "s|$ac_save_LIBS||"`
+fi
+LIBS=$ac_save_LIBS
+
+
 
+{ $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
+  while :; do
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h> /* for off_t */
+     #include <stdio.h>
 int
 main ()
 {
-static krb5_error ac_aggr;
-if (ac_aggr.e_text)
-return 0;
+int (*fp) (FILE *, off_t, int) = fseeko;
+     return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_member_krb5_error_e_text=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_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.  */
-#include <krb5.h>
-
+#define _LARGEFILE_SOURCE 1
+#include <sys/types.h> /* for off_t */
+     #include <stdio.h>
 int
 main ()
 {
-static krb5_error ac_aggr;
-if (sizeof ac_aggr.e_text)
-return 0;
+int (*fp) (FILE *, off_t, int) = fseeko;
+     return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
+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
+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
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_member_krb5_error_e_text=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+rm -rf conftest*
 
-       ac_cv_member_krb5_error_e_text=no
-fi
+# 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
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
+$as_echo "#define HAVE_FSEEKO 1" >>confdefs.h
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_member_krb5_error_e_text" >&5
-$as_echo "$ac_cv_member_krb5_error_e_text" >&6; }
-if test $ac_cv_member_krb5_error_e_text = yes; then
 
-cat >>confdefs.h <<_ACEOF
-#define HAVE_KRB5_ERROR_E_TEXT 1
-_ACEOF
 
+# Configure getopt.
+# getopt.m4 serial 10
 
-fi
+# The getopt module assume you want GNU getopt, with getopt_long etc,
+# rather than vanilla POSIX getopt.  This means your your code should
+# always include <getopt.h> for the getopt prototypes.
 
-fi
 
-done
 
-  else
 
-for ac_header in des.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-       ac_header_compiler=no
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
 
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-  ac_header_preproc=no
-fi
 
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
 
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
 
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
+# Prerequisites of lib/getopt*.
+
+
+
+
+  GETOPT_H=
+  for ac_header in getopt.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "getopt.h" "ac_cv_header_getopt_h" "$ac_includes_default"
+if test "x$ac_cv_header_getopt_h" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_GETOPT_H 1
+_ACEOF
+
 else
-  eval "$as_ac_Header=\$ac_header_preproc"
+  GETOPT_H=getopt.h
 fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
 
-fi
-if test `eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'` = yes; then
+done
+
+  if test -z "$GETOPT_H"; then
+    for ac_func in getopt_long_only
+do :
+  ac_fn_c_check_func "$LINENO" "getopt_long_only" "ac_cv_func_getopt_long_only"
+if test "x$ac_cv_func_getopt_long_only" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define HAVE_GETOPT_LONG_ONLY 1
 _ACEOF
 
 else
+  GETOPT_H=getopt.h
+fi
+done
 
-for ac_header in kerberosIV/des.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  fi
+
+      if test -z "$GETOPT_H"; then
+    ac_fn_c_check_decl "$LINENO" "optreset" "ac_cv_have_decl_optreset" "#include <getopt.h>
+"
+if test "x$ac_cv_have_decl_optreset" = x""yes; then :
+  GETOPT_H=getopt.h
+fi
+
+  fi
+
+      if test -z "$GETOPT_H"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working GNU getopt function" >&5
+$as_echo_n "checking for working GNU getopt function... " >&6; }
+if test "${gl_cv_func_gnu_getopt+set}" = set; then :
   $as_echo_n "(cached) " >&6
+else
+  if test "$cross_compiling" = yes; then :
+                        ac_fn_c_check_decl "$LINENO" "getopt_clip" "ac_cv_have_decl_getopt_clip" "#include <getopt.h>
+"
+if test "x$ac_cv_have_decl_getopt_clip" = x""yes; then :
+  gl_cv_func_gnu_getopt=no
+else
+  gl_cv_func_gnu_getopt=yes
 fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
+
 else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
+#include <getopt.h>
+int
+main ()
+{
+
+            char *myargv[3];
+            myargv[0] = "conftest";
+            myargv[1] = "-+";
+            myargv[2] = 0;
+            return getopt (2, myargv, "+a") != '?';
+
+  ;
+  return 0;
+}
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
+if ac_fn_c_try_run "$LINENO"; then :
+  gl_cv_func_gnu_getopt=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  gl_cv_func_gnu_getopt=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
 
-       ac_header_compiler=no
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_gnu_getopt" >&5
+$as_echo "$gl_cv_func_gnu_getopt" >&6; }
+    if test "$gl_cv_func_gnu_getopt" = "no"; then
+      GETOPT_H=getopt.h
+    fi
+  fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
 
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-  ac_header_preproc=no
-fi
+  if test -n "$GETOPT_H"; then :
 
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
 
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+  GETOPT_H=getopt.h
 
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
+$as_echo "#define __GETOPT_PREFIX rpl_" >>confdefs.h
 
-fi
-if test `eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
 
-else
 
-for ac_header in kerberos/des.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  :
+  GETOPTOBJS='getopt.o getopt1.o'
 
-       ac_header_compiler=no
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
 
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+
+{ $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
+  # Use it with a single arg.
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <$ac_header>
+$ac_includes_default
+int
+main ()
+{
+getpgrp (0);
+  ;
+  return 0;
+}
 _ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_func_getpgrp_void=no
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  ac_cv_func_getpgrp_void=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
-  ac_header_preproc=no
 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
 
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
+$as_echo "#define GETPGRP_VOID 1" >>confdefs.h
 
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+fi
 
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+
+for ac_func in strftime
+do :
+  ac_fn_c_check_func "$LINENO" "strftime" "ac_cv_func_strftime"
+if test "x$ac_cv_func_strftime" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_STRFTIME 1
+_ACEOF
+
+else
+  # strftime is in -lintl on SCO UNIX.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for strftime in -lintl" >&5
+$as_echo_n "checking for strftime in -lintl... " >&6; }
+if test "${ac_cv_lib_intl_strftime+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  eval "$as_ac_Header=\$ac_header_preproc"
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lintl  $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 strftime ();
+int
+main ()
+{
+return strftime ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_intl_strftime=yes
+else
+  ac_cv_lib_intl_strftime=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_intl_strftime" >&5
+$as_echo "$ac_cv_lib_intl_strftime" >&6; }
+if test "x$ac_cv_lib_intl_strftime" = x""yes; then :
+  $as_echo "#define HAVE_STRFTIME 1" >>confdefs.h
+
+LIBS="-lintl $LIBS"
 fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
 
 fi
-if test `eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'` = yes; then
+done
+
+
+# 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 `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define HAVE_GRANTPT 1
 _ACEOF
 
 fi
-
 done
 
-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
 
 fi
-
 done
 
 
-for ac_header in krb.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+# 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.
+have_tputs_et_al=true
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing tputs" >&5
+$as_echo_n "checking for library containing tputs... " >&6; }
+if test "${ac_cv_search_tputs+set}" = set; then :
   $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
 else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
+
+/* 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 tputs ();
+int
+main ()
+{
+return tputs ();
+  ;
+  return 0;
+}
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
+for ac_lib in '' ncurses terminfo termcap; 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_tputs=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if test "${ac_cv_search_tputs+set}" = set; then :
+  break
+fi
+done
+if test "${ac_cv_search_tputs+set}" = set; then :
+
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  ac_cv_search_tputs=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_tputs" >&5
+$as_echo "$ac_cv_search_tputs" >&6; }
+ac_res=$ac_cv_search_tputs
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
 
-       ac_header_compiler=no
+else
+  have_tputs_et_al=false
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
+if test "$have_tputs_et_al" != true; then
+  as_fn_error "I couldn't find termcap functions (tputs and friends).
+Maybe some development libraries/packages are missing?  Try installing
+libncurses-dev(el), libterminfo-dev(el) or similar." "$LINENO" 5
+fi
+# Must define this when any termcap library is found.
 
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+$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
+LIBS_TERMCAP=
+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 ;;
+
+  ## 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
+    ;;
+
+  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 <$ac_header>
+#include <osreldate.h>
+int
+main ()
+{
+#if __FreeBSD_version < 400000
+fail;
+#endif
+
+  ;
+  return 0;
+}
 _ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
+if ac_fn_c_try_link "$LINENO"; then :
+  emacs_cv_freebsd_terminfo=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
+  emacs_cv_freebsd_terminfo=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 fi
 
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
 
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
+    { $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
     ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
 
+  netbsd)
+    if test $ac_cv_search_tputs = -lterminfo; then
+      TERMINFO=yes
+      LIBS_TERMCAP="-lterminfo"
+    else
+      LIBS_TERMCAP="-ltermcap"
+    fi
     ;;
+
 esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
 
-fi
-if test `eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
+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" ;;
 
-else
+  openbsd) LIBS_TERMCAP="-lncurses" ;;
 
-for ac_header in kerberosIV/krb.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
+  ## Must use system termcap, if we use any termcap.  It does special things.
+  sol2*) test "$TERMINFO" != yes && LIBS_TERMCAP="-ltermcap" ;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-       ac_header_compiler=no
-fi
+TERMCAP_OBJ=tparam.o
+if test $TERMINFO = yes; then
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
+$as_echo "#define TERMINFO 1" >>confdefs.h
 
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-  ac_header_preproc=no
+  ## Default used to be -ltermcap.  Add a case above if need something else.
+  test "x$LIBS_TERMCAP" = "x" && LIBS_TERMCAP="-lcurses"
+
+  TERMCAP_OBJ=terminfo.o
 fi
 
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
 
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
 
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
+
+# Do we have res_init, for detecting changes in /etc/resolv.conf?
+resolv=no
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <resolv.h>
+int
+main ()
+{
+return res_init();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  have_res_init=yes
+else
+  have_res_init=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
+/* end confdefs.h.  */
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <resolv.h>
+int
+main ()
+{
+return res_init();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  have_res_init=yes
 else
-  eval "$as_ac_Header=\$ac_header_preproc"
+  have_res_init=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"
 fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
+
+if test "$have_res_init" = yes; then
+
+$as_echo "#define HAVE_RES_INIT 1" >>confdefs.h
 
 fi
-if test `eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
+
+# 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 :
 
-for ac_header in kerberos/krb.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; 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
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
 else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lresolv  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
+
+/* 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 ()
+{
+return res_send ();
+  ;
+  return 0;
+}
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_resolv_res_send=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
+  ac_cv_lib_resolv_res_send=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+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
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lresolv  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <$ac_header>
+
+/* 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 ()
+{
+return __res_send ();
+  ;
+  return 0;
+}
 _ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_resolv___res_send=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  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: $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
 
-  ac_header_preproc=no
 fi
 
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
+fi
 
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+fi
 
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  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 :
+
+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
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lhesiod $RESOLVLIB $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-fi
-if test `eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+/* 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
+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
+else
+  :
+fi
 
 fi
 
-done
 
+  if test x"$hesiod" = xyes; then
+
+$as_echo "#define HAVE_LIBHESIOD 1" >>confdefs.h
+
+    LIBHESIOD=-lhesiod
+  fi
 fi
 
-done
 
+# Do we need libresolv (due to res_init or Hesiod)?
+if test "$resolv" = yes ; then
+
+$as_echo "#define HAVE_LIBRESOLV 1" >>confdefs.h
+
+  LIBRESOLV=-lresolv
+else
+  LIBRESOLV=
 fi
 
-done
 
-  fi
+# These tell us which Kerberos-related libraries to use.
+COM_ERRLIB=
+CRYPTOLIB=
+KRB5LIB=
+DESLIB=
+KRB4LIB=
 
-for ac_header in com_err.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+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
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
 else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lcom_err  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
+
+/* 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;
+}
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_com_err_com_err=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
+  ac_cv_lib_com_err_com_err=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
+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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
+  have_com_err=no
 fi
 
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
+  if test $have_com_err = yes; then
+    COM_ERRLIB=-lcom_err
+    LIBS="$COM_ERRLIB $LIBS"
 
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+$as_echo "#define HAVE_LIBCOM_ERR 1" >>confdefs.h
 
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  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
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lcrypto  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-fi
-if test `eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+/* 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_crypto_mit_des_cbc_encrypt=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
+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
 fi
 
-done
-
-fi
+  if test $have_crypto = yes; then
+    CRYPTOLIB=-lcrypto
+    LIBS="$CRYPTOLIB $LIBS"
 
-# Solaris requires -lintl if you want strerror (which calls dgettext)
-# to return localized messages.
+$as_echo "#define HAVE_LIBCRYPTO 1" >>confdefs.h
 
-{ $as_echo "$as_me:$LINENO: checking for dgettext in -lintl" >&5
-$as_echo_n "checking for dgettext in -lintl... " >&6; }
-if test "${ac_cv_lib_intl_dgettext+set}" = set; then
+  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 :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lintl  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+LIBS="-lk5crypto  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -23683,191 +13200,98 @@ cat >>conftest.$ac_ext <<_ACEOF
 #ifdef __cplusplus
 extern "C"
 #endif
-char dgettext ();
+char mit_des_cbc_encrypt ();
 int
 main ()
 {
-return dgettext ();
+return mit_des_cbc_encrypt ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_intl_dgettext=yes
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_k5crypto_mit_des_cbc_encrypt=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_lib_intl_dgettext=no
+  ac_cv_lib_k5crypto_mit_des_cbc_encrypt=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+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:$LINENO: result: $ac_cv_lib_intl_dgettext" >&5
-$as_echo "$ac_cv_lib_intl_dgettext" >&6; }
-if test $ac_cv_lib_intl_dgettext = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBINTL 1
-_ACEOF
-
-  LIBS="-lintl $LIBS"
-
+{ $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
 
+  if test $have_k5crypto = yes; then
+    CRYPTOLIB=-lk5crypto
+    LIBS="$CRYPTOLIB $LIBS"
 
-{ $as_echo "$as_me:$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 "#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
-  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 >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lkrb5  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <time.h>
-extern char **environ;
-unset_TZ ()
-{
-  char **from, **to;
-  for (to = from = environ; (*to = *from); from++)
-    if (! (to[0][0] == 'T' && to[0][1] == 'Z' && to[0][2] == '='))
-      to++;
-}
-char TZ_GMT0[] = "TZ=GMT0";
-char TZ_PST8[] = "TZ=PST8";
-main()
+
+/* 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 ()
 {
-  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;
-  unset_TZ ();
-  hour_unset = localtime (&now)->tm_hour;
-  if (putenv (TZ_PST8) != 0)
-    exit (1);
-  if (localtime (&now)->tm_hour == hour_GMT0)
-    exit (1);
-  unset_TZ ();
-  if (localtime (&now)->tm_hour != hour_unset)
-    exit (1);
-  exit (0);
+return krb5_init_context ();
+  ;
+  return 0;
 }
 _ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  emacs_cv_localtime_cache=no
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_krb5_krb5_init_context=yes
 else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-emacs_cv_localtime_cache=yes
+  ac_cv_lib_krb5_krb5_init_context=no
 fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+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_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
-       # 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
+  have_krb5=no
 fi
-fi
-{ $as_echo "$as_me:$LINENO: result: $emacs_cv_localtime_cache" >&5
-$as_echo "$emacs_cv_localtime_cache" >&6; }
-if test $emacs_cv_localtime_cache = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define LOCALTIME_CACHE 1
-_ACEOF
 
-fi
+  if test $have_krb5=yes; then
+    KRB5LIB=-lkrb5
+    LIBS="$KRB5LIB $LIBS"
 
-if test "x$HAVE_TIMEVAL" = xyes; then
+$as_echo "#define HAVE_LIBKRB5 1" >>confdefs.h
 
-for ac_func in gettimeofday
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+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 >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldes425  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
 
 /* Override any GCC internal prototype to avoid an error.
    Use char because int might match the return type of a GCC
@@ -23875,168 +13299,147 @@ cat >>conftest.$ac_ext <<_ACEOF
 #ifdef __cplusplus
 extern "C"
 #endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
+char des_cbc_encrypt ();
 int
 main ()
 {
-return $ac_func ();
+return des_cbc_encrypt ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_des425_des_cbc_encrypt=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_var=no"
+  ac_cv_lib_des425_des_cbc_encrypt=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
 fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if test `eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
+{ $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
-done
 
-  if test $ac_cv_func_gettimeofday = yes; then
-    { $as_echo "$as_me:$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
+    if test $have_des425 = yes; then
+      DESLIB=-ldes425
+      LIBS="$DESLIB $LIBS"
+
+$as_echo "#define HAVE_LIBDES425 1" >>confdefs.h
+
+    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
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldes  $LIBS"
+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
+/* 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 ()
 {
-struct timeval time;
-       gettimeofday (&time, 0);
+return des_cbc_encrypt ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  emacs_cv_gettimeofday_two_arguments=yes
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_des_des_cbc_encrypt=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       emacs_cv_gettimeofday_two_arguments=no
+  ac_cv_lib_des_des_cbc_encrypt=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+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_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
-{ $as_echo "$as_me:$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
 
-cat >>confdefs.h <<\_ACEOF
-#define GETTIMEOFDAY_ONE_ARGUMENT 1
-_ACEOF
+      if test $have_des = yes; then
+        DESLIB=-ldes
+        LIBS="$DESLIB $LIBS"
 
-    fi
-  fi
-fi
+$as_echo "#define HAVE_LIBDES 1" >>confdefs.h
 
-ok_so_far=yes
-{ $as_echo "$as_me:$LINENO: checking for socket" >&5
-$as_echo_n "checking for socket... " >&6; }
-if test "${ac_cv_func_socket+set}" = set; then
+      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
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define socket to an innocuous variant, in case <limits.h> declares socket.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define socket innocuous_socket
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lkrb4  $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 krb_get_cred ();
+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
+else
+  ac_cv_lib_krb4_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_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
 
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char socket (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
+    if test $have_krb4 = yes; then
+      KRB4LIB=-lkrb4
+      LIBS="$KRB4LIB $LIBS"
 
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
+$as_echo "#define HAVE_LIBKRB4 1" >>confdefs.h
 
-#undef socket
+    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.  */
 
 /* Override any GCC internal prototype to avoid an error.
    Use char because int might match the return type of a GCC
@@ -24044,755 +13447,383 @@ cat >>conftest.$ac_ext <<_ACEOF
 #ifdef __cplusplus
 extern "C"
 #endif
-char socket ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_socket || defined __stub___socket
-choke me
-#endif
-
+char krb_get_cred ();
 int
 main ()
 {
-return socket ();
+return krb_get_cred ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_func_socket=yes
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_krb_krb_get_cred=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_func_socket=no
+  ac_cv_lib_krb_krb_get_cred=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+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:$LINENO: result: $ac_cv_func_socket" >&5
-$as_echo "$ac_cv_func_socket" >&6; }
-if test $ac_cv_func_socket = yes; then
-  :
+{ $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
-  ok_so_far=no
+  have_krb=no
 fi
 
-if test $ok_so_far = yes; then
-  if test "${ac_cv_header_netinet_in_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for netinet/in.h" >&5
-$as_echo_n "checking for netinet/in.h... " >&6; }
-if test "${ac_cv_header_netinet_in_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_netinet_in_h" >&5
-$as_echo "$ac_cv_header_netinet_in_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking netinet/in.h usability" >&5
-$as_echo_n "checking netinet/in.h usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <netinet/in.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+      if test $have_krb = yes; then
+        KRB4LIB=-lkrb
+        LIBS="$KRB4LIB $LIBS"
 
-       ac_header_compiler=no
-fi
+$as_echo "#define HAVE_LIBKRB 1" >>confdefs.h
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
+      fi
+    fi
+  fi
 
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking netinet/in.h presence" >&5
-$as_echo_n "checking netinet/in.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+  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
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <netinet/in.h>
+ 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
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-  ac_header_preproc=no
+
 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 :
 
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
+cat >>confdefs.h <<_ACEOF
+#define HAVE_KRB5_ERROR_E_TEXT 1
+_ACEOF
 
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: netinet/in.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: netinet/in.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: netinet/in.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: netinet/in.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: netinet/in.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: netinet/in.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: netinet/in.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: netinet/in.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: netinet/in.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: netinet/in.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: netinet/in.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: netinet/in.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: netinet/in.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: netinet/in.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: netinet/in.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: netinet/in.h: in the future, the compiler will take precedence" >&2;}
 
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for netinet/in.h" >&5
-$as_echo_n "checking for netinet/in.h... " >&6; }
-if test "${ac_cv_header_netinet_in_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_netinet_in_h=$ac_header_preproc
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_netinet_in_h" >&5
-$as_echo "$ac_cv_header_netinet_in_h" >&6; }
 
 fi
-if test $ac_cv_header_netinet_in_h = yes; then
-  :
-else
-  ok_so_far=no
-fi
 
+done
 
-fi
-if test $ok_so_far = yes; then
-  if test "${ac_cv_header_arpa_inet_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for arpa/inet.h" >&5
-$as_echo_n "checking for arpa/inet.h... " >&6; }
-if test "${ac_cv_header_arpa_inet_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_arpa_inet_h" >&5
-$as_echo "$ac_cv_header_arpa_inet_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking arpa/inet.h usability" >&5
-$as_echo_n "checking arpa/inet.h usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+  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
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <arpa/inet.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
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
+
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  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
 
-       ac_header_compiler=no
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
+done
 
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking arpa/inet.h presence" >&5
-$as_echo_n "checking arpa/inet.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <arpa/inet.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+fi
+
+done
 
-  ac_header_preproc=no
 fi
 
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
+done
 
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: arpa/inet.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: arpa/inet.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: arpa/inet.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: arpa/inet.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: arpa/inet.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: arpa/inet.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: arpa/inet.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: arpa/inet.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: arpa/inet.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: arpa/inet.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: arpa/inet.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: arpa/inet.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: arpa/inet.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: arpa/inet.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: arpa/inet.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: arpa/inet.h: in the future, the compiler will take precedence" >&2;}
+    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
 
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for arpa/inet.h" >&5
-$as_echo_n "checking for arpa/inet.h... " >&6; }
-if test "${ac_cv_header_arpa_inet_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
 else
-  ac_cv_header_arpa_inet_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_arpa_inet_h" >&5
-$as_echo "$ac_cv_header_arpa_inet_h" >&6; }
+  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
 
-fi
-if test $ac_cv_header_arpa_inet_h = yes; then
-  :
 else
-  ok_so_far=no
+  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
-if test $ok_so_far = yes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_INET_SOCKETS 1
-_ACEOF
+done
 
 fi
 
+done
 
-for ac_header in sys/ioctl.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
+  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
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-       ac_header_compiler=no
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+done
 
-  ac_header_preproc=no
 fi
 
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
 
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
 
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+
+
+
+
+# Solaris requires -lintl if you want strerror (which calls dgettext)
+# to return localized messages.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dgettext in -lintl" >&5
+$as_echo_n "checking for dgettext in -lintl... " >&6; }
+if test "${ac_cv_lib_intl_dgettext+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  eval "$as_ac_Header=\$ac_header_preproc"
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lintl  $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 dgettext ();
+int
+main ()
+{
+return dgettext ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_intl_dgettext=yes
+else
+  ac_cv_lib_intl_dgettext=no
 fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
 fi
-if test `eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'` = yes; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_dgettext" >&5
+$as_echo "$ac_cv_lib_intl_dgettext" >&6; }
+if test "x$ac_cv_lib_intl_dgettext" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define HAVE_LIBINTL 1
 _ACEOF
 
-fi
-
-done
+  LIBS="-lintl $LIBS"
 
+fi
 
-if test -f /usr/lpp/X11/bin/smt.exp; then
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_AIX_SMT_EXP 1
+{ $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
+/* end confdefs.h.  */
+#include <time.h>
+extern char **environ;
+unset_TZ ()
+{
+  char **from, **to;
+  for (to = from = environ; (*to = *from); from++)
+    if (! (to[0][0] == 'T' && to[0][1] == 'Z' && to[0][2] == '='))
+      to++;
+}
+char TZ_GMT0[] = "TZ=GMT0";
+char TZ_PST8[] = "TZ=PST8";
+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;
+  unset_TZ ();
+  hour_unset = localtime (&now)->tm_hour;
+  if (putenv (TZ_PST8) != 0)
+    exit (1);
+  if (localtime (&now)->tm_hour == hour_GMT0)
+    exit (1);
+  unset_TZ ();
+  if (localtime (&now)->tm_hour != hour_unset)
+    exit (1);
+  exit (0);
+}
 _ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  emacs_cv_localtime_cache=no
+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
+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 "$as_me:$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:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
+$as_echo "#define LOCALTIME_CACHE 1" >>confdefs.h
+
+fi
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_DEV_PTMX 1
+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
 
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
 fi
+done
 
-{ $as_echo "$as_me:$LINENO: checking for pid_t" >&5
-$as_echo_n "checking for pid_t... " >&6; }
-if test "${ac_cv_type_pid_t+set}" = set; then
+  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
-  ac_cv_type_pid_t=no
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof (pid_t))
-       return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
+
+#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 ()
 {
-if (sizeof ((pid_t)))
-         return 0;
+struct timeval time;
+       gettimeofday (&time, 0);
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  :
+if ac_fn_c_try_compile "$LINENO"; then :
+  emacs_cv_gettimeofday_two_arguments=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_type_pid_t=yes
+  emacs_cv_gettimeofday_two_arguments=no
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+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
 
+$as_echo "#define GETTIMEOFDAY_ONE_ARGUMENT 1" >>confdefs.h
 
+    fi
+  fi
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5
-$as_echo "$ac_cv_type_pid_t" >&6; }
-if test $ac_cv_type_pid_t = 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
+  ok_so_far=no
+fi
 
-cat >>confdefs.h <<_ACEOF
-#define pid_t int
-_ACEOF
+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 :
 
+else
+  ok_so_far=no
 fi
 
 
-for ac_header in vfork.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
 fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+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 :
 
-       ac_header_compiler=no
+else
+  ok_so_far=no
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-  ac_header_preproc=no
 fi
+if test $ok_so_far = yes; then
 
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+$as_echo "#define HAVE_INET_SOCKETS 1" >>confdefs.h
 
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
 fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
 
-fi
-if test `eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'` = yes; then
+for ac_header in sys/ioctl.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "sys/ioctl.h" "ac_cv_header_sys_ioctl_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_ioctl_h" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define HAVE_SYS_IOCTL_H 1
 _ACEOF
 
 fi
 done
 
 
+if test -f /usr/lpp/X11/bin/smt.exp; then
 
-for ac_func in fork vfork
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
+$as_echo "#define HAVE_AIX_SMT_EXP 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 $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
+fi
+
+{ $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_DEV_PTMX 1" >>confdefs.h
 
-int
-main ()
-{
-return $ac_func ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  { $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 :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define pid_t int
+_ACEOF
 
-       eval "$as_ac_var=no"
 fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+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
-ac_res=`eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if test `eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'` = yes; then
+
+done
+
+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
 done
 
 if test "x$ac_cv_func_fork" = xyes; then
-  { $as_echo "$as_me:$LINENO: checking for working fork" >&5
+  { $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
+if test "${ac_cv_func_fork_works+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  if test "$cross_compiling" = yes; then
+  if test "$cross_compiling" = yes; then :
   ac_cv_func_fork_works=cross
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 $ac_includes_default
 int
@@ -24927,44 +13909,17 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+if ac_fn_c_try_run "$LINENO"; then :
   ac_cv_func_fork_works=yes
 else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-ac_cv_func_fork_works=no
+  ac_cv_func_fork_works=no
 fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext 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
 
-
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_fork_works" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_fork_works" >&5
 $as_echo "$ac_cv_func_fork_works" >&6; }
 
 else
@@ -24980,24 +13935,20 @@ if test "x$ac_cv_func_fork_works" = xcross; then
       ac_cv_func_fork_works=yes
       ;;
   esac
-  { $as_echo "$as_me:$LINENO: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5
+  { $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:$LINENO: checking for working vfork" >&5
+  { $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
+if test "${ac_cv_func_vfork_works+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  if test "$cross_compiling" = yes; then
+  if test "$cross_compiling" = yes; then :
   ac_cv_func_vfork_works=cross
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 /* Thanks to Paul Eggert for this test.  */
 $ac_includes_default
@@ -25089,85 +14040,48 @@ main ()
   }
 }
 _ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+if ac_fn_c_try_run "$LINENO"; then :
   ac_cv_func_vfork_works=yes
 else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-ac_cv_func_vfork_works=no
+  ac_cv_func_vfork_works=no
 fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext 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
 
-
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_vfork_works" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_vfork_works" >&5
 $as_echo "$ac_cv_func_vfork_works" >&6; }
 
 fi;
 if test "x$ac_cv_func_fork_works" = xcross; then
   ac_cv_func_vfork_works=$ac_cv_func_vfork
-  { $as_echo "$as_me:$LINENO: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5
+  { $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
 
 if test "x$ac_cv_func_vfork_works" = xyes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_WORKING_VFORK 1
-_ACEOF
+$as_echo "#define HAVE_WORKING_VFORK 1" >>confdefs.h
 
 else
 
-cat >>confdefs.h <<\_ACEOF
-#define vfork fork
-_ACEOF
+$as_echo "#define vfork fork" >>confdefs.h
 
 fi
 if test "x$ac_cv_func_fork_works" = xyes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_WORKING_FORK 1
-_ACEOF
+$as_echo "#define HAVE_WORKING_FORK 1" >>confdefs.h
 
 fi
 
 
-{ $as_echo "$as_me:$LINENO: checking for nl_langinfo and CODESET" >&5
+{ $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
+if test "${emacs_cv_langinfo_codeset+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <langinfo.h>
 int
@@ -25178,145 +14092,25 @@ char* cs = nl_langinfo(CODESET);
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   emacs_cv_langinfo_codeset=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       emacs_cv_langinfo_codeset=no
+  emacs_cv_langinfo_codeset=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $emacs_cv_langinfo_codeset" >&5
+{ $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
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_LANGINFO_CODESET 1
-_ACEOF
-
-fi
-
-{ $as_echo "$as_me:$LINENO: checking for size_t" >&5
-$as_echo_n "checking for size_t... " >&6; }
-if test "${ac_cv_type_size_t+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_type_size_t=no
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof (size_t))
-       return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof ((size_t)))
-         return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  :
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_type_size_t=yes
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
+$as_echo "#define HAVE_LANGINFO_CODESET 1" >>confdefs.h
 
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5
-$as_echo "$ac_cv_type_size_t" >&6; }
-if test $ac_cv_type_size_t = yes; then
+ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
+if test "x$ac_cv_type_size_t" = x""yes; then :
 
 cat >>confdefs.h <<_ACEOF
 #define HAVE_SIZE_T 1
@@ -25326,16 +14120,12 @@ _ACEOF
 fi
 
 
-{ $as_echo "$as_me:$LINENO: checking for mbstate_t" >&5
+{ $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
+if test "${ac_cv_type_mbstate_t+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 $ac_includes_default
 #          include <wchar.h>
@@ -25347,60 +14137,31 @@ mbstate_t x; return sizeof x;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
   ac_cv_type_mbstate_t=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_type_mbstate_t=no
+  ac_cv_type_mbstate_t=no
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_mbstate_t" >&5
+{ $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
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_MBSTATE_T 1
-_ACEOF
+$as_echo "#define HAVE_MBSTATE_T 1" >>confdefs.h
 
    else
 
-cat >>confdefs.h <<\_ACEOF
-#define mbstate_t int
-_ACEOF
+$as_echo "#define mbstate_t int" >>confdefs.h
 
    fi
 
-{ $as_echo "$as_me:$LINENO: checking for C restrict keyword" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C restrict keyword" >&5
 $as_echo_n "checking for C restrict keyword... " >&6; }
-if test "${emacs_cv_c_restrict+set}" = set; then
+if test "${emacs_cv_c_restrict+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 void fred (int *restrict x);
 int
@@ -25411,34 +14172,10 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
   emacs_cv_c_restrict=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 void fred (int *__restrict x);
 int
@@ -25449,38 +14186,16 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
   emacs_cv_c_restrict=__restrict
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       emacs_cv_c_restrict=no
+  emacs_cv_c_restrict=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:$LINENO: result: $emacs_cv_c_restrict" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_c_restrict" >&5
 $as_echo "$emacs_cv_c_restrict" >&6; }
 case "$emacs_cv_c_restrict" in
   yes) emacs_restrict=restrict;;
@@ -25495,16 +14210,12 @@ _ACEOF
 
 fi
 
-{ $as_echo "$as_me:$LINENO: checking for C restricted array declarations" >&5
+{ $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
+if test "${emacs_cv_c_restrict_arr+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 void fred (int x[__restrict]);
 int
@@ -25515,41 +14226,18 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
   emacs_cv_c_restrict_arr=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       emacs_cv_c_restrict_arr=no
+  emacs_cv_c_restrict_arr=no
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ $as_echo "$as_me:$LINENO: result: $emacs_cv_c_restrict_arr" >&5
+{ $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
 
-cat >>confdefs.h <<\_ACEOF
-#define __restrict_arr __restrict
-_ACEOF
+$as_echo "#define __restrict_arr __restrict" >>confdefs.h
 
 fi
 
@@ -25564,28 +14252,35 @@ if test "x$GCC" = xyes \
    && test x"`$CC --version 2> /dev/null | grep 'gcc.* 4.5.0'`" != x \
    && test x"`echo $CFLAGS | grep '\-O[23]'`" != x \
    && test x"`echo $CFLAGS | grep '\-fno-optimize-sibling-calls'`" = x; then
-   { { $as_echo "$as_me:$LINENO: error: GCC 4.5.0 has problems compiling Emacs; see etc/PROBLEMS'." >&5
-$as_echo "$as_me: error: GCC 4.5.0 has problems compiling Emacs; see etc/PROBLEMS'." >&2;}
-   { (exit 1); exit 1; }; }
+   as_fn_error "GCC 4.5.0 has problems compiling Emacs; see etc/PROBLEMS'." "$LINENO" 5
 fi
 
 #### Find out which version of Emacs this is.
-version=`grep 'defconst[        ]*emacs-version' ${srcdir}/lisp/version.el \
+version=`grep 'const char emacs_version' ${srcdir}/src/emacs.c \
         | sed -e 's/^[^"]*"\([^"]*\)".*$/\1/'`
 if test x"${version}" = x; then
-  { { $as_echo "$as_me:$LINENO: error: can't find current emacs version in \`${srcdir}/lisp/version.el'." >&5
-$as_echo "$as_me: error: can't find current emacs version in \`${srcdir}/lisp/version.el'." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "can't find current emacs version in \`${srcdir}/src/emacs.c'." "$LINENO" 5
 fi
 if test x"${version}" != x"$PACKAGE_VERSION"; then
-  { $as_echo "$as_me:$LINENO: WARNING: version mismatch between \`${srcdir}/configure.in' and \`${srcdir}/lisp/version.el'." >&5
-$as_echo "$as_me: WARNING: version mismatch between \`${srcdir}/configure.in' and \`${srcdir}/lisp/version.el'." >&2;}
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: version mismatch between \`${srcdir}/configure.in' and \`${srcdir}/src/emacs.c'." >&5
+$as_echo "$as_me: WARNING: version mismatch between \`${srcdir}/configure.in' and \`${srcdir}/src/emacs.c'." >&2;}
 fi
 
 ### Specify what sort of things we'll be editing into Makefile and config.h.
 ### Use configuration here uncanonicalized to avoid exceeding size limits.
 
 
+## Unused?
+
+
+
+
+
+
+
+
+
+
 
 
 
 
 
 
+## FIXME? Nothing uses @LD_SWITCH_X_SITE@.
+## src/Makefile.in did add LD_SWITCH_X_SITE (as a cpp define) to the
+## end of LIBX_BASE, but nothing ever set it.
 
 
 
 
+## Used in lwlib/Makefile.in.
 
 
 
 
 
 
+cat >>confdefs.h <<_ACEOF
+#define EMACS_CONFIGURATION "${canonical}"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define EMACS_CONFIG_OPTIONS "${ac_configure_args}"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define config_machfile "${machfile}"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define config_opsysfile "${opsysfile}"
+_ACEOF
+
+
+XMENU_OBJ=
+XOBJ=
+FONT_OBJ=
+if test "${HAVE_X_WINDOWS}" = "yes" ; then
+
+$as_echo "#define HAVE_X_WINDOWS 1" >>confdefs.h
+
+  XMENU_OBJ=xmenu.o
+  XOBJ="xterm.o xfns.o xselect.o xrdb.o fontset.o xsmfns.o fringe.o image.o xsettings.o xgselect.o"
+  FONT_OBJ=xfont.o
+  if test "$HAVE_XFT" = "yes"; then
+    FONT_OBJ="$FONT_OBJ ftfont.o xftfont.o ftxfont.o"
+  elif test "$HAVE_FREETYPE" = "yes"; then
+    FONT_OBJ="$FONT_OBJ ftfont.o ftxfont.o"
+  fi
+
+fi
+
+
+
+
+WIDGET_OBJ=
+MOTIF_LIBW=
+if test "${USE_X_TOOLKIT}" != "none" ; then
+  WIDGET_OBJ=widget.o
+
+$as_echo "#define USE_X_TOOLKIT 1" >>confdefs.h
+
+  if test "${USE_X_TOOLKIT}" = "LUCID"; then
+
+$as_echo "#define USE_LUCID 1" >>confdefs.h
+
+  elif test "${USE_X_TOOLKIT}" = "MOTIF"; then
+
+$as_echo "#define USE_MOTIF 1" >>confdefs.h
+
+    MOTIF_LIBW=-lXm
+    case "$opsys" in
+      gnu-linux)
+        ## Paul Abrahams <abrahams at equinox.shaysnet.com> says this is needed.
+        MOTIF_LIBW="$MOTIF_LIBW -lXpm"
+        ;;
+
+      unixware)
+        ## Richard Anthony Ryan <ryanr at ellingtn.ftc.nrcs.usda.gov>
+        ## says -lXimp is needed in UNIX_SV ... 4.2 1.1.2.
+        MOTIF_LIBW="MOTIF_LIBW -lXimp"
+        ;;
+
+      aix4-2)
+        ## olson@mcs.anl.gov says -li18n is needed by -lXm.
+        MOTIF_LIBW="$MOTIF_LIBW -li18n"
+        ;;
+    esac
+    MOTIF_LIBW="$MOTIF_LIBW $LIBXP"
+  fi
+fi
+
+
+TOOLKIT_LIBW=
+case "$USE_X_TOOLKIT" in
+  MOTIF) TOOLKIT_LIBW="$MOTIF_LIBW" ;;
+  LUCID) TOOLKIT_LIBW="$LUCID_LIBW" ;;
+  none) test "x$HAVE_GTK" = "xyes" && TOOLKIT_LIBW="$GTK_LIBS" ;;
+esac
+
+
+if test "$USE_X_TOOLKIT" = "none"; then
+  LIBXT_OTHER="\$(LIBXSM)"
+  OLDXMENU_TARGET="really-oldXMenu"
+else
+  LIBXT_OTHER="\$(LIBXMU) -lXt \$(LIBXTR6) -lXext"
+  OLDXMENU_TARGET="really-lwlib"
+fi
 
 
+## The X Menu stuff is present in the X10 distribution, but missing
+## from X11.  If we have X10, just use the installed library;
+## otherwise, use our own copy.
+if test "${HAVE_X11}" = "yes" ; then
+
+$as_echo "#define HAVE_X11 1" >>confdefs.h
+
+
+  if test "$USE_X_TOOLKIT" = "none"; then
+    OLDXMENU="\${oldXMenudir}libXMenu11.a"
+  else
+    OLDXMENU="\${lwlibdir}liblw.a"
+  fi
+  LIBXMENU="\$(OLDXMENU)"
+  LIBX_OTHER="\$(LIBXT) \$(LIBX_EXTRA)"
+  OLDXMENU_DEPS="\${OLDXMENU} ../src/\${OLDXMENU}"
+else
+  ## For a syntactically valid Makefile; not actually used for anything.
+  ## See comments in src/Makefile.in.
+  OLDXMENU=nothing
+  ## FIXME This case (!HAVE_X11 && HAVE_X_WINDOWS) is no longer possible(?).
+  if test "${HAVE_X_WINDOWS}" = "yes"; then
+    LIBXMENU="-lXMenu"
+  else
+    LIBXMENU=
+  fi
+  LIBX_OTHER=
+  OLDXMENU_DEPS=
+fi
+
+if test "$HAVE_GTK" = "yes" || test "$HAVE_MENUS" != "yes"; then
+  OLDXMENU_TARGET=
+  OLDXMENU=nothing
+  LIBXMENU=
+  OLDXMENU_DEPS=
+fi
 
 
 
 
 
 
+if test "${HAVE_MENUS}" = "yes" ; then
+
+$as_echo "#define HAVE_MENUS 1" >>confdefs.h
 
+fi
 
+if test "${GNU_MALLOC}" = "yes" ; then
 
+$as_echo "#define GNU_MALLOC 1" >>confdefs.h
 
+fi
 
+RALLOC_OBJ=
+if test "${REL_ALLOC}" = "yes" ; then
 
+$as_echo "#define REL_ALLOC 1" >>confdefs.h
 
-cat >>confdefs.h <<_ACEOF
-#define EMACS_CONFIGURATION "${canonical}"
-_ACEOF
 
+  test "$system_malloc" != "yes" && RALLOC_OBJ=ralloc.o
+fi
 
-cat >>confdefs.h <<_ACEOF
-#define EMACS_CONFIG_OPTIONS "${ac_configure_args}"
-_ACEOF
 
+if test "$opsys" = "cygwin"; then
+  CYGWIN_OBJ="sheap.o"
+  ## Cygwin differs because of its unexec().
+  PRE_ALLOC_OBJ=
+  POST_ALLOC_OBJ=lastfile.o
+else
+  CYGWIN_OBJ=
+  PRE_ALLOC_OBJ=lastfile.o
+  POST_ALLOC_OBJ=
+fi
 
-cat >>confdefs.h <<_ACEOF
-#define config_machfile "${machfile}"
-_ACEOF
 
 
-cat >>confdefs.h <<_ACEOF
-#define config_opsysfile "${opsysfile}"
-_ACEOF
 
 
-cat >>confdefs.h <<_ACEOF
-#define LD_SWITCH_X_SITE ${LD_SWITCH_X_SITE}
-_ACEOF
+case "$opsys" in
+  aix4-2) LD_SWITCH_SYSTEM_TEMACS="-Wl,-bnodelcsect" ;;
 
+  darwin)
+   ## The -headerpad option tells ld (see man page) to leave room at the
+   ## end of the header for adding load commands.  Needed for dumping.
+   ## 0x690 is the total size of 30 segment load commands (at 56
+   ## each); under Cocoa 31 commands are required.
+   if test "$HAVE_NS" = "yes"; then
+     libs_nsgui="-framework AppKit"
+     headerpad_extra=6C8
+   else
+     libs_nsgui=
+     headerpad_extra=690
+   fi
+   LD_SWITCH_SYSTEM_TEMACS="-prebind $libs_nsgui -Xlinker -headerpad -Xlinker $headerpad_extra"
+
+   ## This is here because src/Makefile.in did some extra fiddling around
+   ## with LD_SWITCH_SYSTEM.  The cpp logic was:
+   ##   #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).
+   ## 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,
+   ## rather than LD_SWITCH_SYSTEM.
+   test "x$LD_SWITCH_SYSTEM" = "x" && test "x$GCC" != "xyes" && \
+     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
+  ## 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-linux) LD_SWITCH_SYSTEM_TEMACS="\$(LD_SWITCH_X_SITE_AUX)" ;;
+
+  *) LD_SWITCH_SYSTEM_TEMACS= ;;
+esac
+
+if test "$NS_IMPL_GNUSTEP" = "yes"; then
+  LD_SWITCH_SYSTEM_TEMACS="${LD_SWITCH_SYSTEM_TEMACS} -L${GNUSTEP_SYSTEM_LIBRARIES} ${GNUSTEP_LOCAL_LIBRARIES} -lgnustep-gui -lgnustep-base -lobjc -lpthread"
+fi
+
+
+
+
+LINKER=
+ORDINARY_LINK=
+case "$opsys" in
+  ## gnu: GNU needs its own crt0.
+  aix4-2|cygwin|darwin|gnu|hpux*|irix6-5|sol2*|unixware) ORDINARY_LINK=yes ;;
+
+  ## On post 1.3 releases of NetBSD, gcc -nostdlib also clears the
+  ## library search parth, i.e. it won't search /usr/lib for libc and
+  ## friends.  Using -nostartfiles instead avoids this problem, and
+  ## will also work on earlier NetBSD releases.
+  netbsd|openbsd) LINKER="\$(CC) -nostartfiles" ;;
+
+  ## macpcc: NAKAJI Hiroyuki <nakaji@tutrp.tut.ac.jp> says
+  ##   MkLinux/LinuxPPC needs this.
+  ## ibms390x only supports opsys = gnu-linux so it can be added here.
+  gnu-*)
+    case "$machine" in
+      macppc|ibms390x) LINKER="\$(CC) -nostdlib" ;;
+    esac
+    ;;
+esac
 
-cat >>confdefs.h <<_ACEOF
-#define LD_SWITCH_X_SITE_AUX ${LD_SWITCH_X_SITE_AUX}
-_ACEOF
 
+if test "x$ORDINARY_LINK" = "xyes"; then
 
-cat >>confdefs.h <<_ACEOF
-#define C_SWITCH_X_SITE ${C_SWITCH_X_SITE}
-_ACEOF
+  LINKER="\$(CC)"
 
+$as_echo "#define ORDINARY_LINK 1" >>confdefs.h
 
-cat >>confdefs.h <<_ACEOF
-#define UNEXEC_SRC ${UNEXEC_SRC}
-_ACEOF
 
+## The system files defining neither ORDINARY_LINK nor LINKER are:
+## freebsd, gnu-* not on macppc|ibms390x.
+elif test "x$GCC" = "xyes" && test "x$LINKER" = "x"; then
 
-if test "${HAVE_X_WINDOWS}" = "yes" ; then
+  ## Versions of GCC >= 2.0 put their library, libgcc.a, in obscure
+  ## places that are difficult to figure out at make time.  Fortunately,
+  ## these same versions allow you to pass arbitrary flags on to the
+  ## linker, so there is no reason not to use it as a linker.
+  ##
+  ## Well, it is not quite perfect.  The "-nostdlib" keeps GCC from
+  ## searching for libraries in its internal directories, so we have to
+  ## ask GCC explicitly where to find libgcc.a (LIB_GCC below).
+  LINKER="\$(CC) -nostdlib"
+fi
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_X_WINDOWS 1
-_ACEOF
+test "x$LINKER" = "x" && LINKER=ld
+## FIXME? What setting of EDIT_LDFLAGS should this have?
+test "$NS_IMPL_GNUSTEP" = "yes" && LINKER="\$(CC) -rdynamic"
 
-fi
-if test "${USE_X_TOOLKIT}" != "none" ; then
 
-cat >>confdefs.h <<\_ACEOF
-#define USE_X_TOOLKIT 1
-_ACEOF
 
-  if test "${USE_X_TOOLKIT}" = "LUCID"; then
 
-cat >>confdefs.h <<\_ACEOF
-#define USE_LUCID 1
-_ACEOF
+## FIXME? The logic here is not precisely the same as that above.
+## There is no check here for a pre-defined LINKER.
+## Should we only be setting LIB_GCC if LD ~ -nostdlib?
+LIB_GCC=
+if test "x$GCC" = "xyes" && test "x$ORDINARY_LINK" != "xyes"; then
 
-  elif test "${USE_X_TOOLKIT}" = "MOTIF"; then
+  case "$opsys" in
+    freebsd|netbsd|openbsd) LIB_GCC= ;;
 
-cat >>confdefs.h <<\_ACEOF
-#define USE_MOTIF 1
-_ACEOF
+    gnu-*)
+      ## armin76@gentoo.org reported that the lgcc_s flag is necessary to
+      ## build on ARM EABI under GNU/Linux.  (Bug#5518)
+      ## Note that m/arm.h never bothered to undefine LIB_GCC first.
+      if test "$machine" = "arm"; then
+        LIB_GCC="-lgcc_s"
+      else
+        ## FIXME? s/gnu-linux.h used to define LIB_GCC as below, then
+        ## immediately undefine it again and redefine it to empty.
+        ## Was the C_SWITCH_X_SITE part really necessary?
+##      LIB_GCC=`$CC $C_SWITCH_X_SITE -print-libgcc-file-name`
+        LIB_GCC=
+      fi
+      ;;
 
-  fi
+    ## Ask GCC where to find libgcc.a.
+    *) LIB_GCC=`$CC -print-libgcc-file-name 2> /dev/null` ;;
+  esac
 fi
-if test "${HAVE_X11}" = "yes" ; then
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_X11 1
-_ACEOF
 
-fi
-if test "${HAVE_MENUS}" = "yes" ; then
+TOOLTIP_SUPPORT=
+WINDOW_SUPPORT=
+## If we're using X11/GNUstep, define some consequences.
+if test "$HAVE_X_WINDOWS" = "yes" || test "$HAVE_NS" = "yes"; then
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_MENUS 1
-_ACEOF
+$as_echo "#define HAVE_WINDOW_SYSTEM 1" >>confdefs.h
 
-fi
-if test "${GNU_MALLOC}" = "yes" ; then
 
-cat >>confdefs.h <<\_ACEOF
-#define GNU_MALLOC 1
-_ACEOF
+$as_echo "#define HAVE_MOUSE 1" >>confdefs.h
 
-fi
-if test "${REL_ALLOC}" = "yes" ; then
+  MOUSE_SUPPORT="\$(REAL_MOUSE_SUPPORT)"
+  TOOLTIP_SUPPORT="\${lispsource}mouse.elc"
 
-cat >>confdefs.h <<\_ACEOF
-#define REL_ALLOC 1
-_ACEOF
+  WINDOW_SUPPORT="\$(BASE_WINDOW_SUPPORT)"
+  test "$HAVE_X_WINDOWS" = "yes" && \
+    WINDOW_SUPPORT="$WINDOW_SUPPORT \$(X_WINDOW_SUPPORT)"
 
 fi
 
@@ -25729,6 +14643,7 @@ fi
 
 
 
+
 #### Report on what we decided to do.
 #### Report GTK as a toolkit, even if it doesn't use Xt.
 #### It makes printing result more understandable as using GTK sets
@@ -25765,12 +14680,14 @@ echo "  Does Emacs use -lXaw3d?                                 ${HAVE_XAW3D}"
 echo "  Does Emacs use -lXpm?                                   ${HAVE_XPM}"
 echo "  Does Emacs use -ljpeg?                                  ${HAVE_JPEG}"
 echo "  Does Emacs use -ltiff?                                  ${HAVE_TIFF}"
-echo "  Does Emacs use a gif library?                           ${HAVE_GIF} $ac_gif_lib_name"
+echo "  Does Emacs use a gif library?                           ${HAVE_GIF} $LIBGIF"
 echo "  Does Emacs use -lpng?                                   ${HAVE_PNG}"
 echo "  Does Emacs use -lrsvg-2?                                ${HAVE_RSVG}"
+echo "  Does Emacs use imagemagick?                             ${HAVE_IMAGEMAGICK}"
 echo "  Does Emacs use -lgpm?                                   ${HAVE_GPM}"
 echo "  Does Emacs use -ldbus?                                  ${HAVE_DBUS}"
 echo "  Does Emacs use -lgconf?                                 ${HAVE_GCONF}"
+echo "  Does Emacs use -lselinux?                               ${HAVE_LIBSELINUX}"
 
 echo "  Does Emacs use -lfreetype?                              ${HAVE_FREETYPE}"
 echo "  Does Emacs use -lm17n-flt?                              ${HAVE_M17N_FLT}"
@@ -25814,39 +14731,7 @@ test "${prefix}" != NONE &&
 test "${exec_prefix}" != NONE &&
   exec_prefix=`echo "${exec_prefix}" | sed 's,\([^/]\)/*$,\1,'`
 
-# Now get this: Some word that is part of the ${srcdir} directory name
-# or the ${configuration} value might, just might, happen to be an
-# identifier like `sun4' or `i386' or something, and be predefined by
-# the C preprocessor to some helpful value like 1, or maybe the empty
-# string.  Needless to say consequent macro substitutions are less
-# than conducive to the makefile finding the correct directory.
-cpp_undefs="`echo $srcdir $configuration $canonical |
-  sed -e 's/[^a-zA-Z0-9_]/ /g' -e 's/^/ /' -e 's/  *$//' \
-  -e 's/  */ -U/g' -e 's/-U[0-9][^ ]*//g'`"
-
-## Check if the C preprocessor will convert `..' to `. .'.  If so, set
-## CPP_NEED_TRADITIONAL to `yes' so that the code to generate Makefile
-## from Makefile.c can correctly provide the arg `-traditional' to the
-## C preprocessor.
-
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-yes..yes
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "yes..yes" >/dev/null 2>&1; then
-  CPP_NEED_TRADITIONAL=no
-else
-  CPP_NEED_TRADITIONAL=yes
-fi
-rm -f conftest*
-
-
-ac_config_files="$ac_config_files Makefile lib-src/Makefile.c:lib-src/Makefile.in oldXMenu/Makefile doc/emacs/Makefile doc/misc/Makefile doc/lispintro/Makefile doc/lispref/Makefile src/Makefile.c:src/Makefile.in lwlib/Makefile lisp/Makefile leim/Makefile"
+ac_config_files="$ac_config_files Makefile lib-src/Makefile oldXMenu/Makefile doc/emacs/Makefile doc/misc/Makefile doc/lispintro/Makefile doc/lispref/Makefile src/Makefile lwlib/Makefile lisp/Makefile leim/Makefile"
 
 ac_config_commands="$ac_config_commands default"
 
@@ -25877,13 +14762,13 @@ _ACEOF
     case $ac_val in #(
     *${as_nl}*)
       case $ac_var in #(
-      *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
-$as_echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
+      *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
       esac
       case $ac_var in #(
       _ | IFS | as_nl) ;; #(
       BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
-      *) $as_unset $ac_var ;;
+      *) { eval $ac_var=; unset $ac_var;} ;;
       esac ;;
     esac
   done
@@ -25891,8 +14776,8 @@ $as_echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
   (set) 2>&1 |
     case $as_nl`(ac_space=' '; set) 2>&1` in #(
     *${as_nl}ac_space=\ *)
-      # `set' does not quote correctly, so add quotes (double-quote
-      # substitution turns \\\\ into \\, and sed turns \\ into \).
+      # `set' does not quote correctly, so add quotesdouble-quote
+      # substitution turns \\\\ into \\, and sed turns \\ into \.
       sed -n \
        "s/'/'\\\\''/g;
          s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
@@ -25915,11 +14800,11 @@ $as_echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
 if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
   if test -w "$cache_file"; then
     test "x$cache_file" != "x/dev/null" &&
-      { $as_echo "$as_me:$LINENO: updating cache $cache_file" >&5
+      { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
 $as_echo "$as_me: updating cache $cache_file" >&6;}
     cat confcache >$cache_file
   else
-    { $as_echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
   fi
 fi
@@ -25939,8 +14824,8 @@ for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
   ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
   # 2. Prepend LIBOBJDIR.  When used with automake>=1.10 LIBOBJDIR
   #    will be set to the directory where LIBOBJS objects are built.
-  ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
-  ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo'
+  as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+  as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
 done
 LIBOBJS=$ac_libobjs
 
@@ -25948,13 +14833,15 @@ LTLIBOBJS=$ac_ltlibobjs
 
 
 
+
 : ${CONFIG_STATUS=./config.status}
 ac_write_fail=0
 ac_clean_files_save=$ac_clean_files
 ac_clean_files="$ac_clean_files $CONFIG_STATUS"
-{ $as_echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
-cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+as_write_fail=0
+cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
 #! $SHELL
 # Generated by $as_me.
 # Run this file to recreate the current configuration.
@@ -25964,17 +14851,18 @@ cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 debug=false
 ac_cs_recheck=false
 ac_cs_silent=false
-SHELL=\${CONFIG_SHELL-$SHELL}
-_ACEOF
 
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-## --------------------- ##
-## M4sh Initialization.  ##
-## --------------------- ##
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
 
 # Be more Bourne compatible
 DUALCASE=1; export DUALCASE # for MKS sh
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
   emulate sh
   NULLCMD=:
   # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
@@ -25982,23 +14870,15 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
   alias -g '${1+"$@"}'='"$@"'
   setopt NO_GLOB_SUBST
 else
-  case `(set -o) 2>/dev/null` in
-  *posix*) set -o posix ;;
+  case `(set -o) 2>/dev/null` in #(
+  *posix*) :
+    set -o posix ;; #(
+  *) :
+     ;;
 esac
-
 fi
 
 
-
-
-# PATH needs CR
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
 as_nl='
 '
 export as_nl
@@ -26006,7 +14886,13 @@ export as_nl
 as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
 as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
 as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
-if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='print -r --'
+  as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
   as_echo='printf %s\n'
   as_echo_n='printf %s'
 else
@@ -26017,7 +14903,7 @@ else
     as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
     as_echo_n_body='eval
       arg=$1;
-      case $arg in
+      case $arg in #(
       *"$as_nl"*)
        expr "X$arg" : "X\\(.*\\)$as_nl";
        arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
@@ -26040,13 +14926,6 @@ if test "${PATH_SEPARATOR+set}" != set; then
   }
 fi
 
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
-  as_unset=unset
-else
-  as_unset=false
-fi
-
 
 # IFS
 # We need space, tab and new line, in precisely that order.  Quoting is
 IFS=" ""       $as_nl"
 
 # Find who we are.  Look in the path if we contain no directory separator.
-case $0 in
+case $0 in #((
   *[\\/]* ) as_myself=$0 ;;
   *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
+    test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+  done
 IFS=$as_save_IFS
 
      ;;
@@ -26076,12 +14955,16 @@ if test "x$as_myself" = x; then
 fi
 if test ! -f "$as_myself"; then
   $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
-  { (exit 1); exit 1; }
+  exit 1
 fi
 
-# Work around bugs in pre-3.0 UWIN ksh.
-for as_var in ENV MAIL MAILPATH
-do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there.  '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
 done
 PS1='$ '
 PS2='> '
@@ -26093,7 +14976,89 @@ export LC_ALL
 LANGUAGE=C
 export LANGUAGE
 
-# Required to use basename.
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+
+# as_fn_error ERROR [LINENO LOG_FD]
+# ---------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with status $?, using 1 if that was 0.
+as_fn_error ()
+{
+  as_status=$?; test $as_status -eq 0 && as_status=1
+  if test "$3"; then
+    as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+    $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3
+  fi
+  $as_echo "$as_me: error: $1" >&2
+  as_fn_exit $as_status
+} # as_fn_error
+
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+  return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+  set +e
+  as_fn_set_status $1
+  exit $1
+} # as_fn_exit
+
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+  { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+  eval 'as_fn_append ()
+  {
+    eval $1+=\$2
+  }'
+else
+  as_fn_append ()
+  {
+    eval $1=\$$1\$2
+  }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+  eval 'as_fn_arith ()
+  {
+    as_val=$(( $* ))
+  }'
+else
+  as_fn_arith ()
+  {
+    as_val=`expr "$@" || test $? -eq 1`
+  }
+fi # as_fn_arith
+
+
 if expr a : '\(a\)' >/dev/null 2>&1 &&
    test "X`expr 00001 : '.*\(...\)'`" = X001; then
   as_expr=expr
@@ -26107,8 +15072,12 @@ else
   as_basename=false
 fi
 
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
+else
+  as_dirname=false
+fi
 
-# Name of the executable.
 as_me=`$as_basename -- "$0" ||
 $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
         X"$0" : 'X\(//\)$' \| \
@@ -26128,76 +15097,25 @@ $as_echo X/"$0" |
          }
          s/.*/./; q'`
 
-# CDPATH.
-$as_unset CDPATH
-
-
-
-  as_lineno_1=$LINENO
-  as_lineno_2=$LINENO
-  test "x$as_lineno_1" != "x$as_lineno_2" &&
-  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
-
-  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
-  # uniformly replaced by the line number.  The first 'sed' inserts a
-  # line-number line after each line using $LINENO; the second 'sed'
-  # does the real work.  The second script uses 'N' to pair each
-  # line-number line with the line containing $LINENO, and appends
-  # trailing '-' during substitution so that $LINENO is not a special
-  # case at line end.
-  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
-  # scripts with optimization help from Paolo Bonzini.  Blame Lee
-  # E. McMahon (1931-1989) for sed's syntax.  :-)
-  sed -n '
-    p
-    /[$]LINENO/=
-  ' <$as_myself |
-    sed '
-      s/[$]LINENO.*/&-/
-      t lineno
-      b
-      :lineno
-      N
-      :loop
-      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
-      t loop
-      s/-\n.*//
-    ' >$as_me.lineno &&
-  chmod +x "$as_me.lineno" ||
-    { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
-   { (exit 1); exit 1; }; }
-
-  # Don't try to exec as it changes $[0], causing all sort of problems
-  # (the dirname of $[0] is not the place where we might find the
-  # original and so on.  Autoconf is especially sensitive to this).
-  . "./$as_me.lineno"
-  # Exit status is that of the last command.
-  exit
-}
-
-
-if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
-  as_dirname=dirname
-else
-  as_dirname=false
-fi
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
 
 ECHO_C= ECHO_N= ECHO_T=
-case `echo -n x` in
+case `echo -n x` in #(((((
 -n*)
-  case `echo 'x\c'` in
+  case `echo 'xy\c'` in
   *c*) ECHO_T='        ';;     # ECHO_T is single tab character.
-  *)   ECHO_C='\c';;
+  xy)  ECHO_C='\c';;
+  *)   echo `echo ksh88 bug on AIX 6.1` > /dev/null
+       ECHO_T='        ';;
   esac;;
 *)
   ECHO_N='-n';;
 esac
-if expr a : '\(a\)' >/dev/null 2>&1 &&
-   test "X`expr 00001 : '.*\(...\)'`" = X001; then
-  as_expr=expr
-else
-  as_expr=false
-fi
 
 rm -f conf$$ conf$$.exe conf$$.file
 if test -d conf$$.dir; then
 rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
 rmdir conf$$.dir 2>/dev/null
 
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+  case $as_dir in #(
+  -*) as_dir=./$as_dir;;
+  esac
+  test -d "$as_dir" || eval $as_mkdir_p || {
+    as_dirs=
+    while :; do
+      case $as_dir in #(
+      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+      *) as_qdir=$as_dir;;
+      esac
+      as_dirs="'$as_qdir' $as_dirs"
+      as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$as_dir" : 'X\(//\)[^/]' \| \
+        X"$as_dir" : 'X\(//\)$' \| \
+        X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)[^/].*/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`
+      test -d "$as_dir" && break
+    done
+    test -z "$as_dirs" || eval "mkdir $as_dirs"
+  } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
 if mkdir -p . 2>/dev/null; then
-  as_mkdir_p=:
+  as_mkdir_p='mkdir -p "$as_dir"'
 else
   test -d ./-p && rmdir ./-p
   as_mkdir_p=false
@@ -26246,10 +15212,10 @@ else
       if test -d "$1"; then
        test -d "$1/.";
       else
-       case $1 in
+       case $1 in #(
        -*)set "./$1";;
        esac;
-       case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
+       case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
        ???[sx]*):;;*)false;;esac;fi
     '\'' sh
   '
@@ -26264,13 +15230,19 @@ as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
 
 
 exec 6>&1
+## ----------------------------------- ##
+## Main body of $CONFIG_STATUS script. ##
+## ----------------------------------- ##
+_ASEOF
+test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
 
-# Save the log message, to keep $[0] and so on meaningful, and to
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# Save the log message, to keep $0 and so on meaningful, and to
 # 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 23.2, which was
-generated by GNU Autoconf 2.62.  Invocation command line was
+This file was extended by emacs $as_me 24.0.50, which was
+generated by GNU Autoconf 2.65.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
@@ -26283,6 +15255,15 @@ on `(hostname || uname -n) 2>/dev/null | sed 1q`
 
 _ACEOF
 
+case $ac_config_files in *"
+"*) set x $ac_config_files; shift; ac_config_files=$*;;
+esac
+
+case $ac_config_headers in *"
+"*) set x $ac_config_headers; shift; ac_config_headers=$*;;
+esac
+
+
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 # Files that config.status was made for.
 config_files="$ac_config_files"
@@ -26293,19 +15274,22 @@ _ACEOF
 
 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 ac_cs_usage="\
-\`$as_me' instantiates files from templates according to the
-current configuration.
+\`$as_me' instantiates files and other configuration actions
+from templates according to the current configuration.  Unless the files
+and actions are specified as TAGs, all are instantiated by default.
 
-Usage: $0 [OPTIONS] [FILE]...
+Usage: $0 [OPTION]... [TAG]...
 
   -h, --help       print this help, then exit
   -V, --version    print version number and configuration settings, then exit
-  -q, --quiet      do not print progress messages
+      --config     print configuration, then exit
+  -q, --quiet, --silent
+                   do not print progress messages
   -d, --debug      don't remove temporary files
       --recheck    update $as_me by reconfiguring in the same conditions
-  --file=FILE[:TEMPLATE]
+      --file=FILE[:TEMPLATE]
                    instantiate the configuration file FILE
-  --header=FILE[:TEMPLATE]
+      --header=FILE[:TEMPLATE]
                    instantiate the configuration header FILE
 
 Configuration files:
@@ -26317,16 +15301,17 @@ $config_headers
 Configuration commands:
 $config_commands
 
-Report bugs to <bug-autoconf@gnu.org>."
+Report bugs to the package provider."
 
 _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 23.2
-configured by $0, generated by GNU Autoconf 2.62,
-  with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+emacs config.status 24.0.50
+configured by $0, generated by GNU Autoconf 2.65,
+  with options \\"\$ac_cs_config\\"
 
-Copyright (C) 2008 Free Software Foundation, Inc.
+Copyright (C) 2009 Free Software Foundation, Inc.
 This config.status script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it."
 
@@ -26360,6 +15345,8 @@ do
     ac_cs_recheck=: ;;
   --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
     $as_echo "$ac_cs_version"; exit ;;
+  --config | --confi | --conf | --con | --co | --c )
+    $as_echo "$ac_cs_config"; exit ;;
   --debug | --debu | --deb | --de | --d | -d )
     debug=: ;;
   --file | --fil | --fi | --f )
     case $ac_optarg in
     *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
     esac
-    CONFIG_FILES="$CONFIG_FILES '$ac_optarg'"
+    as_fn_append CONFIG_FILES " '$ac_optarg'"
     ac_need_defaults=false;;
   --header | --heade | --head | --hea )
     $ac_shift
     case $ac_optarg in
     *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
     esac
-    CONFIG_HEADERS="$CONFIG_HEADERS '$ac_optarg'"
+    as_fn_append CONFIG_HEADERS " '$ac_optarg'"
     ac_need_defaults=false;;
   --he | --h)
     # Conflict between --help and --header
-    { $as_echo "$as_me: error: ambiguous option: $1
-Try \`$0 --help' for more information." >&2
-   { (exit 1); exit 1; }; };;
+    as_fn_error "ambiguous option: \`$1'
+Try \`$0 --help' for more information.";;
   --help | --hel | -h )
     $as_echo "$ac_cs_usage"; exit ;;
   -q | -quiet | --quiet | --quie | --qui | --qu | --q \
@@ -26388,11 +15374,10 @@ Try \`$0 --help' for more information." >&2
     ac_cs_silent=: ;;
 
   # This is an error.
-  -*) { $as_echo "$as_me: error: unrecognized option: $1
-Try \`$0 --help' for more information." >&2
-   { (exit 1); exit 1; }; } ;;
+  -*) as_fn_error "unrecognized option: \`$1'
+Try \`$0 --help' for more information." ;;
 
-  *) ac_config_targets="$ac_config_targets $1"
+  *) as_fn_append ac_config_targets " $1"
      ac_need_defaults=false ;;
 
   esac
@@ -26433,7 +15418,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 #
 # INIT-COMMANDS
 #
-GCC="$GCC" NON_GNU_CPP="$NON_GNU_CPP" CPP="$CPP" CPP_NEED_TRADITIONAL="$CPP_NEED_TRADITIONAL" CPPFLAGS="$CPPFLAGS" cpp_undefs="$cpp_undefs"
+GCC="$GCC" NON_GNU_CPP="$NON_GNU_CPP" CPP="$CPP" CPPFLAGS="$CPPFLAGS"
 
 _ACEOF
 
   case $ac_config_target in
     "src/config.h") CONFIG_HEADERS="$CONFIG_HEADERS src/config.h:src/config.in" ;;
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
-    "lib-src/Makefile.c") CONFIG_FILES="$CONFIG_FILES lib-src/Makefile.c:lib-src/Makefile.in" ;;
+    "lib-src/Makefile") CONFIG_FILES="$CONFIG_FILES lib-src/Makefile" ;;
     "oldXMenu/Makefile") CONFIG_FILES="$CONFIG_FILES oldXMenu/Makefile" ;;
     "doc/emacs/Makefile") CONFIG_FILES="$CONFIG_FILES doc/emacs/Makefile" ;;
     "doc/misc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/misc/Makefile" ;;
     "doc/lispintro/Makefile") CONFIG_FILES="$CONFIG_FILES doc/lispintro/Makefile" ;;
     "doc/lispref/Makefile") CONFIG_FILES="$CONFIG_FILES doc/lispref/Makefile" ;;
-    "src/Makefile.c") CONFIG_FILES="$CONFIG_FILES src/Makefile.c:src/Makefile.in" ;;
+    "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
     "lwlib/Makefile") CONFIG_FILES="$CONFIG_FILES lwlib/Makefile" ;;
     "lisp/Makefile") CONFIG_FILES="$CONFIG_FILES lisp/Makefile" ;;
     "leim/Makefile") CONFIG_FILES="$CONFIG_FILES leim/Makefile" ;;
     "default") CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;;
 
-  *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
-$as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
-   { (exit 1); exit 1; }; };;
+  *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
   esac
 done
 
@@ -26486,7 +15469,7 @@ $debug ||
   trap 'exit_status=$?
   { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
 ' 0
-  trap '{ (exit 1); exit 1; }' 1 2 13 15
+  trap 'as_fn_exit 1' 1 2 13 15
 }
 # Create a (secure) tmp directory for tmp files.
 
@@ -26497,22 +15480,41 @@ $debug ||
 {
   tmp=./conf$$-$RANDOM
   (umask 077 && mkdir "$tmp")
-} ||
-{
-   $as_echo "$as_me: cannot create a temporary directory in ." >&2
-   { (exit 1); exit 1; }
-}
+} || as_fn_error "cannot create a temporary directory in ." "$LINENO" 5
 
 # Set up the scripts for CONFIG_FILES section.
 # No need to generate them if there are no CONFIG_FILES.
 # This happens for instance with `./config.status config.h'.
 if test -n "$CONFIG_FILES"; then
 
-
-ac_cr='\r'
+if $AWK 'BEGIN { getline <"/dev/null" }' </dev/null 2>/dev/null; then
+  ac_cs_awk_getline=:
+  ac_cs_awk_pipe_init=
+  ac_cs_awk_read_file='
+      while ((getline aline < (F[key])) > 0)
+       print(aline)
+      close(F[key])'
+  ac_cs_awk_pipe_fini=
+else
+  ac_cs_awk_getline=false
+  ac_cs_awk_pipe_init="print \"cat <<'|#_!!_#|' &&\""
+  ac_cs_awk_read_file='
+      print "|#_!!_#|"
+      print "cat " F[key] " &&"
+      '$ac_cs_awk_pipe_init
+  # The final `:' finishes the AND list.
+  ac_cs_awk_pipe_fini='END { print "|#_!!_#|"; print ":" }'
+fi
+ac_cr=`echo X | tr X '\015'`
+# On cygwin, bash can eat \r inside `` if the user requested igncr.
+# But we know of no other shell where ac_cr would be empty at this
+# point, so we can use a bashism as a fallback.
+if test "x$ac_cr" = x; then
+  eval ac_cr=\$\'\\r\'
+fi
 ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
 if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
-  ac_cs_awk_cr='\\r'
+  ac_cs_awk_cr='\r'
 else
   ac_cs_awk_cr=$ac_cr
 fi
 echo 'BEGIN {' >"$tmp/subs1.awk" &&
 _ACEOF
 
+# Create commands to substitute file output variables.
+{
+  echo "cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1" &&
+  echo 'cat >>"\$tmp/subs1.awk" <<\\_ACAWK &&' &&
+  echo "$ac_subst_files" | sed 's/.*/F["&"]="$&"/' &&
+  echo "_ACAWK" &&
+  echo "_ACEOF"
+} >conf$$files.sh &&
+. ./conf$$files.sh ||
+  as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
+rm -f conf$$files.sh
 
 {
   echo "cat >conf$$subs.awk <<_ACEOF" &&
   echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
   echo "_ACEOF"
 } >conf$$subs.sh ||
-  { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
-$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
 ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'`
 ac_delim='%!_!# '
 for ac_last_try in false false false false false :; do
   . ./conf$$subs.sh ||
-    { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
-$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
-   { (exit 1); exit 1; }; }
+    as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
 
-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` = $ac_delim_num; then
+  ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
+  if test $ac_delim_n = $ac_delim_num; then
     break
   elif $ac_last_try; then
-    { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
-$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
-   { (exit 1); exit 1; }; }
+    as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
   else
     ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
   fi
@@ -26564,7 +15572,7 @@ s/'"$ac_delim"'$//
 t delim
 :nl
 h
-s/\(.\{148\}\).*/\1/
+s/\(.\{148\}\)..*/\1/
 t more1
 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
 p
@@ -26578,7 +15586,7 @@ s/.\{148\}//
 t nl
 :delim
 h
-s/\(.\{148\}\).*/\1/
+s/\(.\{148\}\)..*/\1/
 t more2
 s/["\\]/\\&/g; s/^/"/; s/$/"/
 p
@@ -26601,7 +15609,7 @@ _ACAWK
 cat >>"\$tmp/subs1.awk" <<_ACAWK &&
   for (key in S) S_is_set[key] = 1
   FS = "\a"
-
+  \$ac_cs_awk_pipe_init
 }
 {
   line = $ 0
@@ -26619,10 +15627,16 @@ cat >>"\$tmp/subs1.awk" <<_ACAWK &&
     } else
       len += 1 + keylen
   }
-
+  if (nfields == 3 && !substed) {
+    key = field[2]
+    if (F[key] != "" && line ~ /^[      ]*@.*@[         ]*$/) {
+      \$ac_cs_awk_read_file
+      next
+    }
+  }
   print line
 }
-
+\$ac_cs_awk_pipe_fini
 _ACAWK
 _ACEOF
 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
@@ -26631,9 +15645,7 @@ if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
 else
   cat
 fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \
-  || { { $as_echo "$as_me:$LINENO: error: could not setup config files machinery" >&5
-$as_echo "$as_me: error: could not setup config files machinery" >&2;}
-   { (exit 1); exit 1; }; }
+  || as_fn_error "could not setup config files machinery" "$LINENO" 5
 _ACEOF
 
 # VPATH may cause trouble with some makes, so we remove $(srcdir),
@@ -26674,9 +15686,7 @@ for ac_last_try in false false :; do
   if test -z "$ac_t"; then
     break
   elif $ac_last_try; then
-    { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_HEADERS" >&5
-$as_echo "$as_me: error: could not make $CONFIG_HEADERS" >&2;}
-   { (exit 1); exit 1; }; }
+    as_fn_error "could not make $CONFIG_HEADERS" "$LINENO" 5
   else
     ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
   fi
@@ -26742,9 +15752,9 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
   }
   split(mac1, mac2, "(") #)
   macro = mac2[1]
+  prefix = substr(line, 1, index(line, defundef) - 1)
   if (D_is_set[macro]) {
     # Preserve the white space surrounding the "#".
-    prefix = substr(line, 1, index(line, defundef) - 1)
     print prefix "define", macro P[macro] D[macro]
     next
   } else {
@@ -26752,7 +15762,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
     # in the case of _POSIX_SOURCE, which is predefined and required
     # on some systems where configure will not decide to define it.
     if (defundef == "undef") {
-      print "/*", line, "*/"
+      print "/*", prefix defundef, macro, "*/"
       next
     }
   }
@@ -26761,9 +15771,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 _ACAWK
 _ACEOF
 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-  { { $as_echo "$as_me:$LINENO: error: could not setup config headers machinery" >&5
-$as_echo "$as_me: error: could not setup config headers machinery" >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "could not setup config headers machinery" "$LINENO" 5
 fi # test -n "$CONFIG_HEADERS"
 
 
@@ -26776,9 +15784,7 @@ do
   esac
   case $ac_mode$ac_tag in
   :[FHL]*:*);;
-  :L* | :C*:*) { { $as_echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5
-$as_echo "$as_me: error: Invalid tag $ac_tag." >&2;}
-   { (exit 1); exit 1; }; };;
+  :L* | :C*:*) as_fn_error "invalid tag \`$ac_tag'" "$LINENO" 5;;
   :[FH]-) ac_tag=-:-;;
   :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
   esac
@@ -26806,12 +15812,10 @@ $as_echo "$as_me: error: Invalid tag $ac_tag." >&2;}
           [\\/$]*) false;;
           *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
           esac ||
-          { { $as_echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
-$as_echo "$as_me: error: cannot find input file: $ac_f" >&2;}
-   { (exit 1); exit 1; }; };;
+          as_fn_error "cannot find input file: \`$ac_f'" "$LINENO" 5;;
       esac
       case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
-      ac_file_inputs="$ac_file_inputs '$ac_f'"
+      as_fn_append ac_file_inputs " '$ac_f'"
     done
 
     # Let's still pretend it is `configure' which instantiates (i.e., don't
@@ -26822,7 +15826,7 @@ $as_echo "$as_me: error: cannot find input file: $ac_f" >&2;}
        `' by configure.'
     if test x"$ac_file" != x-; then
       configure_input="$ac_file.  $configure_input"
-      { $as_echo "$as_me:$LINENO: creating $ac_file" >&5
+      { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
 $as_echo "$as_me: creating $ac_file" >&6;}
     fi
     # Neutralize special characters interpreted by sed in replacement strings.
@@ -26835,9 +15839,7 @@ $as_echo "$as_me: creating $ac_file" >&6;}
 
     case $ac_tag in
     *:-:* | *:-) cat >"$tmp/stdin" \
-      || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
-$as_echo "$as_me: error: could not create $ac_file" >&2;}
-   { (exit 1); exit 1; }; } ;;
+      || as_fn_error "could not create $ac_file" "$LINENO" 5 ;;
     esac
     ;;
   esac
@@ -26865,47 +15867,7 @@ $as_echo X"$ac_file" |
            q
          }
          s/.*/./; q'`
-  { as_dir="$ac_dir"
-  case $as_dir in #(
-  -*) as_dir=./$as_dir;;
-  esac
-  test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
-    as_dirs=
-    while :; do
-      case $as_dir in #(
-      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
-      *) as_qdir=$as_dir;;
-      esac
-      as_dirs="'$as_qdir' $as_dirs"
-      as_dir=`$as_dirname -- "$as_dir" ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-        X"$as_dir" : 'X\(//\)[^/]' \| \
-        X"$as_dir" : 'X\(//\)$' \| \
-        X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$as_dir" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-           s//\1/
-           q
-         }
-         /^X\(\/\/\)[^/].*/{
-           s//\1/
-           q
-         }
-         /^X\(\/\/\)$/{
-           s//\1/
-           q
-         }
-         /^X\(\/\).*/{
-           s//\1/
-           q
-         }
-         s/.*/./; q'`
-      test -d "$as_dir" && break
-    done
-    test -z "$as_dirs" || eval "mkdir $as_dirs"
-  } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
-$as_echo "$as_me: error: cannot create directory $as_dir" >&2;}
-   { (exit 1); exit 1; }; }; }
+  as_dir="$ac_dir"; as_fn_mkdir_p
   ac_builddir=.
 
 case "$ac_dir" in
@@ -26957,7 +15919,6 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # If the template does not know about datarootdir, expand it.
 # FIXME: This hack should be removed a few years after 2.60.
 ac_datarootdir_hack=; ac_datarootdir_seen=
-
 ac_sed_dataroot='
 /datarootdir/ {
   p
@@ -26967,12 +15928,11 @@ ac_sed_dataroot='
 /@docdir@/p
 /@infodir@/p
 /@localedir@/p
-/@mandir@/p
-'
+/@mandir@/p'
 case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
 *datarootdir*) ac_datarootdir_seen=yes;;
 *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
-  { $as_echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
@@ -26982,7 +15942,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
   s&@infodir@&$infodir&g
   s&@localedir@&$localedir&g
   s&@mandir@&$mandir&g
-    s&\\\${datarootdir}&$datarootdir&g' ;;
+  s&\\\${datarootdir}&$datarootdir&g' ;;
 esac
 _ACEOF
 
@@ -27009,15 +15969,18 @@ s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
 s&@INSTALL@&$ac_INSTALL&;t t
 $ac_datarootdir_hack
 "
-eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \
-  || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
-$as_echo "$as_me: error: could not create $ac_file" >&2;}
-   { (exit 1); exit 1; }; }
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" |
+if $ac_cs_awk_getline; then
+  $AWK -f "$tmp/subs.awk"
+else
+  $AWK -f "$tmp/subs.awk" | $SHELL
+fi >$tmp/out \
+  || as_fn_error "could not create $ac_file" "$LINENO" 5
 
 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
   { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
   { ac_out=`sed -n '/^[         ]*datarootdir[  ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
-  { $as_echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
 which seems to be undefined.  Please make sure it is defined." >&5
 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
 which seems to be undefined.  Please make sure it is defined." >&2;}
@@ -27027,9 +15990,7 @@ which seems to be undefined.  Please make sure it is defined." >&2;}
   -) cat "$tmp/out" && rm -f "$tmp/out";;
   *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";;
   esac \
-  || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
-$as_echo "$as_me: error: could not create $ac_file" >&2;}
-   { (exit 1); exit 1; }; }
+  || as_fn_error "could not create $ac_file" "$LINENO" 5
  ;;
   :H)
   #
@@ -27040,29 +16001,23 @@ $as_echo "$as_me: error: could not create $ac_file" >&2;}
       $as_echo "/* $configure_input  */" \
       && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs"
     } >"$tmp/config.h" \
-      || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
-$as_echo "$as_me: error: could not create $ac_file" >&2;}
-   { (exit 1); exit 1; }; }
+      || as_fn_error "could not create $ac_file" "$LINENO" 5
     if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then
-      { $as_echo "$as_me:$LINENO: $ac_file is unchanged" >&5
+      { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
 $as_echo "$as_me: $ac_file is unchanged" >&6;}
     else
       rm -f "$ac_file"
       mv "$tmp/config.h" "$ac_file" \
-       || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
-$as_echo "$as_me: error: could not create $ac_file" >&2;}
-   { (exit 1); exit 1; }; }
+       || as_fn_error "could not create $ac_file" "$LINENO" 5
     fi
   else
     $as_echo "/* $configure_input  */" \
       && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \
-      || { { $as_echo "$as_me:$LINENO: error: could not create -" >&5
-$as_echo "$as_me: error: could not create -" >&2;}
-   { (exit 1); exit 1; }; }
+      || as_fn_error "could not create -" "$LINENO" 5
   fi
  ;;
 
-  :C)  { $as_echo "$as_me:$LINENO: executing $ac_file commands" >&5
+  :C)  { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5
 $as_echo "$as_me: executing $ac_file commands" >&6;}
  ;;
   esac
@@ -27076,52 +16031,9 @@ for dir in etc lisp ; do
   test -d ${dir} || mkdir ${dir}
 done
 
-# Build src/Makefile from ${srcdir}/src/Makefile.c
-# and lib-src/Makefile from ${srcdir}/lib-src/Makefile.c
-# This must be done after src/config.h is built, since we rely on that file.
-
 echo creating src/epaths.h
 ${MAKE-make} epaths-force
 
-# As of 2000-11-19, newest development versions of GNU cpp preprocess
-# `..' to `. .'  unless invoked with -traditional
-
-if test "x$GCC" = xyes && test "x$CPP_NEED_TRADITIONAL" = xyes; then
-  CPPFLAGS="$CPPFLAGS -traditional"
-fi
-
-echo creating lib-src/Makefile
-( cd lib-src
-  rm -f junk.c junk1.c junk2.c
-  sed -e '/start of cpp stuff/q' \
-      < Makefile.c > junk1.c
-  sed -e '1,/start of cpp stuff/d'\
-      -e 's,/\*\*/#\(.*\)$,/* \1 */,' \
-      < Makefile.c > junk.c
-  $CPP -P $cpp_undefs -I. -I$srcdir/src $CPPFLAGS junk.c | \
-      sed -e 's/^ /    /' -e '/^#/d' -e '/^[   \f]*$/d' > junk2.c
-  cat junk1.c junk2.c > Makefile.new
-  rm -f junk.c junk1.c junk2.c
-  chmod 444 Makefile.new
-  mv -f Makefile.new Makefile
-)
-
-echo creating src/Makefile
-( cd src
-  rm -f junk.c junk1.c junk2.c
-  sed -e '/start of cpp stuff/q' \
-      < Makefile.c > junk1.c
-  sed -e '1,/start of cpp stuff/d'\
-      -e 's,/\*\*/#\(.*\)$,/* \1 */,' \
-      < Makefile.c > junk.c
-  $CPP -P $cpp_undefs -I. -I$srcdir/src $CPPFLAGS junk.c | \
-      sed -e 's/^ /    /' -e '/^#/d' -e '/^[   \f]*$/d' > junk2.c
-  cat junk1.c junk2.c > Makefile.new
-  rm -f junk.c junk1.c junk2.c
-  chmod 444 Makefile.new
-  mv -f Makefile.new Makefile
-)
-
 if test ! -f src/.gdbinit && test -f $srcdir/src/.gdbinit; then
   echo creating src/.gdbinit
   echo source $srcdir/src/.gdbinit > src/.gdbinit
 done # for ac_tag
 
 
-{ (exit 0); exit 0; }
+as_fn_exit 0
 _ACEOF
-chmod +x $CONFIG_STATUS
 ac_clean_files=$ac_clean_files_save
 
 test $ac_write_fail = 0 ||
-  { { $as_echo "$as_me:$LINENO: error: write failure creating $CONFIG_STATUS" >&5
-$as_echo "$as_me: error: write failure creating $CONFIG_STATUS" >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "write failure creating $CONFIG_STATUS" "$LINENO" 5
 
 
 # configure is writing to config.log, and then calls config.status.
@@ -27162,11 +16071,11 @@ if test "$no_create" != yes; then
   exec 5>>config.log
   # Use ||, not &&, to avoid exiting from the if with $? = 1, which
   # would make configure fail if this is the last instruction.
-  $ac_cs_success || { (exit 1); exit 1; }
+  $ac_cs_success || as_fn_exit $?
 fi
 if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
-  { $as_echo "$as_me:$LINENO: WARNING: Unrecognized options: $ac_unrecognized_opts" >&5
-$as_echo "$as_me: WARNING: Unrecognized options: $ac_unrecognized_opts" >&2;}
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
+$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
 fi
 
 
index 304f6ab2f91cb69c2e209afaef787f44d5e33810..e69ce064c0c7830db65bd06deea67cd2514849fa 100644 (file)
@@ -2,9 +2,11 @@ dnl  Autoconf script for GNU Emacs
 dnl To rebuild the `configure' script from this, execute the command
 dnl    autoconf
 dnl in the directory containing this script.
+dnl If you changed any AC_DEFINES, also run autoheader.
 dnl
-dnl  Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2003,
-dnl    2004, 2005, 2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
+dnl  Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2003, 2004,
+dnl    2005, 2006, 2007, 2008, 2009, 2010
+dnl    Free Software Foundation, Inc.
 dnl
 dnl  This file is part of GNU Emacs.
 dnl
@@ -21,8 +23,8 @@ dnl
 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.62)
-AC_INIT(emacs, 23.2.50)
+AC_PREREQ(2.65)
+AC_INIT(emacs, 24.0.50)
 AC_CONFIG_HEADER(src/config.h:src/config.in)
 AC_CONFIG_SRCDIR(src/lisp.h)
 
@@ -30,6 +32,10 @@ dnl Support for --program-prefix, --program-suffix and
 dnl --program-transform-name options
 AC_ARG_PROGRAM
 
+dnl It is important that variables on the RHS not be expanded here,
+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'
 locallisppath='${datadir}/emacs/${version}/site-lisp:'\
 '${datadir}/emacs/site-lisp'
@@ -91,10 +97,26 @@ if test "${with_kerberos5}" != no; then
 fi
 
 OPTION_DEFAULT_OFF([hesiod],[support Hesiod to get the POP server host])
+dnl FIXME hesiod support may not be present, so it seems like an error
+dnl to define, or at least use, this unconditionally.
 if test "$with_hesiod" != no; then
   AC_DEFINE(HESIOD, 1, [Define to support using a Hesiod database to find the POP server.])
 fi
 
+OPTION_DEFAULT_OFF([mmdf],[support MMDF mailboxes])
+if test "$with_mmdf" != no; then
+   AC_DEFINE(MAIL_USE_MMDF, 1, [Define to support MMDF mailboxes in movemail.])
+fi
+
+OPTION_DEFAULT_OFF([mail-unlink],[unlink, rather than empty, mail spool after reading])
+if test "$with_mail_unlink" != no; then
+   AC_DEFINE(MAIL_UNLINK_SPOOL, 1, [Define to unlink, rather than empty, mail spool after reading.])
+fi
+
+AC_ARG_WITH([mailhost],[AS_HELP_STRING([--with-mailhost=HOSTNAME],
+    [string giving default POP mail host])],
+    AC_DEFINE_UNQUOTED(MAILHOST, ["$withval"], [String giving fallback POP mail host.]))
+
 OPTION_DEFAULT_ON([sound],[don't compile with sound support])
 
 OPTION_DEFAULT_ON([sync-input],[process async input synchronously])
@@ -107,7 +129,7 @@ dnl This should be the last --with option, because --with-x is
 dnl added later on when we find the path of X, and it's best to
 dnl keep them together visually.
 AC_ARG_WITH([x-toolkit],[AS_HELP_STRING([--with-x-toolkit=KIT],
- [use an X toolkit (KIT one of: yes, lucid, athena, motif, gtk, no)])],
+ [use an X toolkit (KIT one of: yes or gtk, gtk3, lucid or athena, motif, no)])],
 [        case "${withval}" in
            y | ye | yes )      val=gtk ;;
            n | no )            val=no  ;;
@@ -115,10 +137,11 @@ AC_ARG_WITH([x-toolkit],[AS_HELP_STRING([--with-x-toolkit=KIT],
            a | at | ath | athe | athen | athena )      val=athena ;;
            m | mo | mot | moti | motif )       val=motif ;;
            g | gt | gtk  )     val=gtk ;;
+           gtk3  )     val=gtk3 ;;
            * )
 AC_MSG_ERROR([`--with-x-toolkit=$withval' is invalid;
-this option's value should be `yes', `no', `lucid', `athena', `motif' or `gtk'.
-`yes' and `gtk' are synonyms. `athena' and `lucid' are synonyms.])
+this option's value should be `yes', `no', `lucid', `athena', `motif', `gtk' or
+`gtk3'.  `yes' and `gtk' are synonyms. `athena' and `lucid' are synonyms.])
            ;;
          esac
          with_x_toolkit=$val
@@ -132,6 +155,7 @@ OPTION_DEFAULT_ON([tiff],[don't compile with TIFF image support])
 OPTION_DEFAULT_ON([gif],[don't compile with GIF image support])
 OPTION_DEFAULT_ON([png],[don't compile with PNG image support])
 OPTION_DEFAULT_ON([rsvg],[don't compile with SVG image support])
+OPTION_DEFAULT_OFF([imagemagick],[compile with ImageMagick image support])
 
 OPTION_DEFAULT_ON([xft],[don't use XFT for anti aliased fonts])
 OPTION_DEFAULT_ON([libotf],[don't use libotf for OpenType font support])
@@ -145,20 +169,22 @@ OPTION_DEFAULT_OFF([ns],[use nextstep (Cocoa or GNUstep) windowing system])
 OPTION_DEFAULT_ON([gpm],[don't use -lgpm for mouse support on a GNU/Linux console])
 OPTION_DEFAULT_ON([dbus],[don't compile with D-Bus support])
 OPTION_DEFAULT_ON([gconf],[don't compile with GConf support])
+OPTION_DEFAULT_ON([selinux],[don't compile with SELinux support])
 
 ## For the times when you want to build Emacs but don't have
 ## a suitable makeinfo, and can live without the manuals.
 dnl http://lists.gnu.org/archive/html/emacs-devel/2008-04/msg01844.html
 OPTION_DEFAULT_ON([makeinfo],[don't require makeinfo for building manuals])
 
-dnl Can remove these in Emacs 24.
-AC_ARG_WITH([gtk],,
-  [AC_MSG_ERROR([--with-gtk has been removed.  Use --with-x-toolkit to
-specify a toolkit.])],,)
-
-AC_ARG_WITH([gcc],,
-  [AC_MSG_ERROR([--with-gcc has been removed.  Set the `CC' environment
-variable to specify a compiler.])],,)
+## This is an option because I do not know if all info/man support
+## compressed files, nor how to test if they do so.
+OPTION_DEFAULT_ON([compress-info],[don't compress the installed Info pages])
+if test $with_compress_info = yes; then
+   GZIP_INFO=yes
+else
+   GZIP_INFO=
+fi
+AC_SUBST(GZIP_INFO)
 
 AC_ARG_WITH([pkg-config-prog],dnl
 [AS_HELP_STRING([--with-pkg-config-prog=PATH],
@@ -169,6 +195,12 @@ if test "X${with_pkg_config_prog}" != X; then
    fi
 fi
 
+CRT_DIR=
+AC_ARG_WITH([crt-dir],dnl
+[AS_HELP_STRING([--with-crt-dir=DIR],[directory containing crtn.o etc.
+The default is /usr/lib, or /usr/lib64 on some platforms.])])
+CRT_DIR="${with_crt_dir}"
+
 AC_ARG_WITH([gnustep-conf],dnl
 [AS_HELP_STRING([--with-gnustep-conf=PATH],[path to GNUstep.conf; default $GNUSTEP_CONFIG_FILE, or /etc/GNUstep/GNUstep.conf])])
 test "X${with_gnustep_conf}" != X && test "${with_gnustep_conf}" != yes && \
@@ -274,6 +306,16 @@ if test x$ac_gc_check_cons_list != x ; then
 [Define this to check for errors in cons list.])
 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.])],
+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.])
+fi)
+
+
 AC_ARG_ENABLE(profiling,
 [AS_HELP_STRING([--enable-profiling],
                [build emacs with profiling support.
@@ -286,6 +328,8 @@ else
    PROFILING_CFLAGS=
    PROFILING_LDFLAGS=
 fi
+AC_SUBST(PROFILING_CFLAGS)
+AC_SUBST(PROFILING_LDFLAGS)
 
 AC_ARG_ENABLE(autodepend,
 [AS_HELP_STRING([--enable-autodepend],
@@ -353,7 +397,7 @@ dnl quotation begins
 ### the appropriate operating system and machine description files.
 
 ### 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-
+### based on the machine portion of the configuration name, and 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
@@ -365,10 +409,6 @@ dnl quotation begins
 ### /etc/MACHINES doesn't say anything about version numbers, be
 ### prepared to handle anything reasonably.  If version numbers
 ### matter, be sure /etc/MACHINES says something about it.
-###
-### Eric Raymond says we should accept strings like "sysvr4" to mean
-### "System V Release 4"; he writes, "The old convention encouraged
-### confusion between `system' and `release' levels'."
 
 machine='' opsys='' unported=no
 case "${canonical}" in
@@ -377,14 +417,14 @@ case "${canonical}" in
   *-*-freebsd* )
     opsys=freebsd
     case "${canonical}" in
-      alpha*-*-freebsd*)       machine=alpha ;;
-      arm*-*-freebsd*)          machine=arm ;;
-      ia64-*-freebsd*)         machine=ia64 ;;
-      sparc-*-freebsd*)         machine=sparc ;;
-      sparc64-*-freebsd*)      machine=sparc ;;
-      powerpc-*-freebsd*)      machine=macppc ;;
-      i[3456]86-*-freebsd*)    machine=intel386 ;;
-      amd64-*-freebsd*|x86_64-*-freebsd*) machine=amdx86-64 ;;
+      alpha*)           machine=alpha ;;
+      amd64-*|x86_64-*) machine=amdx86-64 ;;
+      arm*)             machine=arm ;;
+      ia64-*)           machine=ia64 ;;
+      i[3456]86-*)      machine=intel386 ;;
+      powerpc-*)        machine=macppc ;;
+      sparc-*)          machine=sparc ;;
+      sparc64-*)        machine=sparc ;;
     esac
   ;;
 
@@ -392,38 +432,31 @@ case "${canonical}" in
   *-*-kfreebsd*gnu* )
     opsys=gnu-kfreebsd
     case "${canonical}" in
-      alpha*-*-kfreebsd*)      machine=alpha ;;
-      ia64-*-kfreebsd*)                machine=ia64 ;;
-      sparc-*-kfreebsd*)       machine=sparc ;;
-      sparc64-*-kfreebsd*)     machine=sparc ;;
-      powerpc-*-kfreebsd*)     machine=macppc ;;
-      i[3456]86-*-kfreebsd*)   machine=intel386 ;;
-      amd64-*-kfreebsd*|x86_64-*-kfreebsd*) machine=amdx86-64 ;;
+      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
-    if test -f /usr/lib/crti.o; then]
-dnl The close and open brackets here are because this section is quoted --
-dnl see the `changequote' comment above.
-      AC_DEFINE(HAVE_CRTIN, [], [Define to 1 if you have /usr/lib/crti.o.])
-[   fi
-
     case "${canonical}" in
-      alpha*-*-netbsd*)        machine=alpha ;;
-      i[3456]86-*-netbsd*) machine=intel386 ;;
-      mips-*-netbsd*)  machine=mips ;;
-      mipsel-*-netbsd*)        machine=mips ;;
-      mipseb-*-netbsd*)        machine=mips ;;
-      powerpc-*-netbsd*) machine=macppc ;;
-      sparc*-*-netbsd*)        machine=sparc ;;
-      vax-*-netbsd*)   machine=vax ;;
-      arm-*-netbsd*)   machine=arm ;;
-      x86_64-*-netbsd*)        machine=amdx86-64 ;;
-      hppa-*-netbsd*)  machine=hp800 ;;
-      m68k-*-netbsd*)  machine=m68k ;;
+      alpha*)      machine=alpha ;;
+      x86_64-*)    machine=amdx86-64 ;;
+      arm-*)       machine=arm ;;
+      hppa-*)      machine=hp800 ;;
+      i[3456]86-*) machine=intel386 ;;
+      m68k-*)      machine=m68k ;;
+      powerpc-*)   machine=macppc ;;
+      mips-*)      machine=mips ;;
+      mipse[bl]-*) machine=mips ;;
+      sparc*-)     machine=sparc ;;
+      vax-*)       machine=vax ;;
     esac
   ;;
 
@@ -431,23 +464,14 @@ dnl see the `changequote' comment above.
   *-*-openbsd* )
     opsys=openbsd
     case "${canonical}" in
-      alpha*-*-openbsd*)       machine=alpha ;;
-      arm-*-openbsd*)          machine=arm ;;
-      i386-*-openbsd*)         machine=intel386 ;;
-      powerpc-*-openbsd*)      machine=macppc ;;
-      sparc*-*-openbsd*)       machine=sparc ;;
-      vax-*-openbsd*)          machine=vax ;;
-      x86_64-*-openbsd*)       machine=amdx86-64 ;;
-      hppa-*-openbsd*)         machine=hp800 ;;
-    esac
-  ;;
-
-  ## LynxOS ports
-  *-*-lynxos* )
-    opsys=lynxos
-    case "${canonical}" in
-      i[3456]86-*-lynxos*) machine=intel386 ;;
-      powerpc-*-lynxos*) machine=powerpc ;;
+      alpha*)    machine=alpha ;;
+      x86_64-*)  machine=amdx86-64 ;;
+      arm-*)     machine=arm ;;
+      hppa-*)    machine=hp800 ;;
+      i386-*)    machine=intel386 ;;
+      powerpc-*) machine=macppc ;;
+      sparc*)    machine=sparc ;;
+      vax-*)     machine=vax ;;
     esac
   ;;
 
@@ -498,16 +522,16 @@ dnl see the `changequote' comment above.
   s390x-*-linux-gnu* )
     machine=ibms390x opsys=gnu-linux
   ;;
-  rs6000-ibm-aix4.2* | powerpc-ibm-aix4.2*  )
+  rs6000-ibm-aix4.[23]* )
     machine=ibmrs6000 opsys=aix4-2
   ;;
-  rs6000-ibm-aix4.3* | powerpc-ibm-aix4.3*  )
+  powerpc-ibm-aix4.[23]*  )
     machine=ibmrs6000 opsys=aix4-2
   ;;
-  rs6000-ibm-aix5* | powerpc-ibm-aix5*  )
+  rs6000-ibm-aix[56]* )
     machine=ibmrs6000 opsys=aix4-2
   ;;
-  rs6000-ibm-aix6* | powerpc-ibm-aix6*  )
+  powerpc-ibm-aix[56]*  )
     machine=ibmrs6000 opsys=aix4-2
   ;;
 
@@ -534,30 +558,14 @@ dnl see the `changequote' comment above.
 
   *-sun-solaris* \
     | i[3456]86-*-solaris2* | i[3456]86-*-sunos5* \
-    | x86_64-*-solaris2*    | x86_64-*-sunos5*    \
-    | powerpc*-*-solaris2*  | rs6000-*-solaris2*)
+    | x86_64-*-solaris2*    | x86_64-*-sunos5*)
     case "${canonical}" in
       i[3456]86-*-* )     machine=intel386 ;;
       amd64-*-*|x86_64-*-*)    machine=amdx86-64 ;;
-      powerpc* | rs6000* )  machine=ibmrs6000 ;;
       sparc* )         machine=sparc ;;
       * )              unported=yes ;;
     esac
     case "${canonical}" in
-      *-sunos5.3* | *-solaris2.3* )
-               opsys=sol2-3
-               NON_GNU_CPP=/usr/ccs/lib/cpp
-               ;;
-      *-sunos5.4* | *-solaris2.4* )
-               opsys=sol2-4
-               NON_GNU_CPP=/usr/ccs/lib/cpp
-               RANLIB="ar -ts"
-               ;;
-      *-sunos5.5* | *-solaris2.5* )
-               opsys=sol2-5
-               NON_GNU_CPP=/usr/ccs/lib/cpp
-               RANLIB="ar -ts"
-               ;;
       *-sunos5.6* | *-solaris2.6* )
                opsys=sol2-6
                NON_GNU_CPP=/usr/ccs/lib/cpp
@@ -592,7 +600,7 @@ dnl see the `changequote' comment above.
     machine=ia64 opsys=gnu-linux
   ;;
 
-  ## Intel 386 machines where we don't care about the manufacturer
+  ## Intel 386 machines where we don't care about the manufacturer.
   i[3456]86-*-* )
     machine=intel386
     case "${canonical}" in
@@ -648,22 +656,6 @@ esac
 if test x"${opsys}" = x; then
   case "${canonical}" in
     *-gnu* )                           opsys=gnu ;;
-    *-sysv4.2uw* )                     opsys=unixware ;;
-    *-sysv5uw* )                       opsys=unixware ;;
-    *-sysv5OpenUNIX* )                 opsys=unixware ;;
-    *-sysv4.1* | *-sysvr4.1* )
-       NON_GNU_CPP=/usr/lib/cpp
-       opsys=usg5-4 ;;
-    *-sysv4.[2-9]* | *-sysvr4.[2-9]* )
-       if [ x$NON_GNU_CPP = x ]; then
-         if [ -f /usr/ccs/lib/cpp ]; then
-           NON_GNU_CPP=/usr/ccs/lib/cpp
-         else
-           NON_GNU_CPP=/lib/cpp
-         fi
-       fi
-       opsys=usg5-4-2 ;;
-    *-sysv4* | *-sysvr4* )             opsys=usg5-4 ;;
     * )
       unported=yes
     ;;
@@ -731,14 +723,10 @@ then
   CC="$NON_GNU_CC"
 fi
 
-if test x$GCC = xyes && test "x$GCC_TEST_OPTIONS" != x
-then
-  CC="$CC $GCC_TEST_OPTIONS"
-fi
-
-if test x$GCC = x && test "x$NON_GCC_TEST_OPTIONS" != x
-then
-  CC="$CC $NON_GCC_TEST_OPTIONS"
+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
 
 dnl checks for Unix variants
@@ -770,15 +758,58 @@ 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_TRY_COMPILE([], [], 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_TRY_COMPILE([], [], 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_LN_S
 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
+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)
@@ -807,7 +838,7 @@ fi
 if test "$MAKEINFO" = "no"; then
   if test "x${with_makeinfo}" = "xno"; then
     MAKEINFO=off
-  elif ! test -e $srcdir/info/emacs; then
+  elif test ! -e $srcdir/info/emacs; then
     AC_MSG_ERROR( [You do not seem to have makeinfo >= 4.6, 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
@@ -846,148 +877,158 @@ AC_LINK_IFELSE([main(){return 0;}],
   LDFLAGS=$late_LDFLAGS
   [AC_MSG_RESULT(no)])
 
-#### Extract some information from the operating system and machine files.
-
-AC_CHECKING([the machine- and system-dependent files to find out
- - which libraries the lib-src programs will want, and
- - whether the GNU malloc routines are usable])
-
-### First figure out CFLAGS (which we use for running the compiler here)
-### and REAL_CFLAGS (which we use for real compilation).
-### The two are the same except on a few systems, where they are made
-### different to work around various lossages.  For example,
-### GCC 2.5 on GNU/Linux needs them to be different because it treats -g
-### as implying static linking.
-
-### If the CFLAGS env var is specified, we use that value
-### instead of the default.
-
-### It's not important that this name contain the PID; you can't run
-### two configures in the same directory and have anything work
-### anyway.
-tempcname="conftest.c"
-
-echo '
-#include "'${srcdir}'/src/'${opsysfile}'"
-#include "'${srcdir}'/src/'${machfile}'"
-#ifndef LIBS_MACHINE
-#define LIBS_MACHINE
-#endif
-#ifndef LIBS_SYSTEM
-#define LIBS_SYSTEM
-#endif
-#ifndef C_SWITCH_SYSTEM
-#define C_SWITCH_SYSTEM
-#endif
-#ifndef C_SWITCH_MACHINE
-#define C_SWITCH_MACHINE
-#endif
-configure___ libsrc_libs=LIBS_MACHINE LIBS_SYSTEM
-configure___ c_switch_system=C_SWITCH_SYSTEM
-configure___ c_switch_machine=C_SWITCH_MACHINE
-
-#ifndef LIB_X11_LIB
-#define LIB_X11_LIB -lX11
-#endif
 
-#ifndef LIBX11_SYSTEM
-#define LIBX11_SYSTEM
-#endif
-configure___ LIBX=LIB_X11_LIB LIBX11_SYSTEM
-
-#ifdef UNEXEC
-configure___ unexec=UNEXEC
-#else
-configure___ unexec=unexec.o
-#endif
-
-#ifdef SYSTEM_MALLOC
-configure___ system_malloc=yes
-#else
-configure___ system_malloc=no
-#endif
-
-#ifdef USE_MMAP_FOR_BUFFERS
-configure___ use_mmap_for_buffers=yes
-#else
-configure___ use_mmap_for_buffers=no
-#endif
-
-#ifndef C_DEBUG_SWITCH
-#define C_DEBUG_SWITCH -g
-#endif
+# The value of CPP is a quoted variable reference, so we need to do this
+# to get its actual value...
+CPP=`eval "echo $CPP"`
 
-#ifndef C_OPTIMIZE_SWITCH
-#ifdef __GNUC__
-#define C_OPTIMIZE_SWITCH -O2
-#else
-#define C_OPTIMIZE_SWITCH -O
-#endif
-#endif
 
-#ifndef C_WARNINGS_SWITCH
-#define C_WARNINGS_SWITCH ${C_WARNINGS_SWITCH}
-#endif
+dnl Not used by any currently supported platform.
+dnl The function dump-emacs will not be defined and temacs will do
+dnl (load "loadup") automatically unless told otherwise.
+CANNOT_DUMP=no
+case "$opsys" in
+  your-opsys-here)
+   CANNOT_DUMP=yes
+   AC_DEFINE(CANNOT_DUMP, 1, [Define if Emacs cannot be dumped on your system.])
+  ;;
+esac
+AC_SUBST(CANNOT_DUMP)
+
+
+UNEXEC_OBJ=unexelf.o
+case "$opsys" in
+  # MSDOS uses unexcoff.o
+  # MSWindows uses unexw32.o
+  aix4-2)
+   UNEXEC_OBJ=unexaix.o
+   ;;
+  cygwin)
+   UNEXEC_OBJ=unexcw.o
+   ;;
+  darwin)
+   UNEXEC_OBJ=unexmacosx.o
+   ;;
+  hpux10-20 | hpux11)
+   UNEXEC_OBJ=unexhp9k800.o
+   ;;
+  sol2-10)
+   # Use the Solaris dldump() function, called from unexsol.c, to dump
+   # emacs, instead of the generic ELF dump code found in unexelf.c.
+   # The resulting binary has a complete symbol table, and is better
+   # for debugging and other observability tools (debuggers, pstack, etc).
+   # 
+   # If you encounter a problem using dldump(), please consider sending
+   # a message to the OpenSolaris tools-linking mailing list:
+   #      http://mail.opensolaris.org/mailman/listinfo/tools-linking
+   # 
+   # It is likely that dldump() works with older Solaris too, but this has
+   # not been tested, so for now this change is for Solaris 10 or newer.
+   UNEXEC_OBJ=unexsol.o
+   ;;
+esac
 
-#ifndef LD_SWITCH_MACHINE
-#define LD_SWITCH_MACHINE
-#endif
+LD_SWITCH_SYSTEM=
+case "$opsys" in
+  freebsd)
+   ## 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
+   ;;
+
+  gnu-linux)
+   ## cpp test was "ifdef __mips__", but presumably this is equivalent...
+   test "$machine" = "mips" && LD_SWITCH_SYSTEM="-G 0"
+   ;;
+
+  netbsd)
+   LD_SWITCH_SYSTEM="-Wl,-rpath,/usr/pkg/lib -L/usr/pkg/lib -Wl,-rpath,/usr/local/lib -L/usr/local/lib"
+   ;;
+
+  openbsd)
+   ## Han Boetes <han@mijncomputer.nl> says this is necessary,
+   ## otherwise Emacs dumps core on elf systems.
+   LD_SWITCH_SYSTEM="-Z"
+   ;;
+esac
+AC_SUBST(LD_SWITCH_SYSTEM)
+
+ac_link="$ac_link $LD_SWITCH_SYSTEM"
+
+## This setting of LD_SWITCH_SYSTEM references LD_SWITCH_X_SITE_AUX,
+## 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.
+## FIXME it would be cleaner to put this in LD_SWITCH_SYSTEM_TEMACS
+## (or somesuch), but because it is supposed to go at the _front_
+## of LD_SWITCH_SYSTEM, we cannot do that in exactly the same way.
+## Compare with the gnu-linux case below, which added to the end
+## of LD_SWITCH_SYSTEM, and so can instead go at the front of
+## 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" ;;
+esac
 
-#ifndef LD_SWITCH_SYSTEM
-#define LD_SWITCH_SYSTEM
-#endif
 
-#ifndef LD_SWITCH_X_SITE_AUX
-#define LD_SWITCH_X_SITE_AUX
-#endif
+C_SWITCH_MACHINE=
+if test "$machine" = "alpha"; then
+  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
+    ## data section.  Otherwise, the dump of temacs may miss variables in
+    ## the shared library that have been initialized.  For example, with
+    ## GNU libc, __malloc_initialized would normally be resolved to the
+    ## shared library's .bss section, which is fatal.
+    if test "x$GCC" = "xyes"; then
+      C_SWITCH_MACHINE="-fno-common"
+    else
+      AC_MSG_ERROR([What gives?  Fix me if DEC Unix supports ELF now.])
+    fi
+  else
+    UNEXEC_OBJ=unexalpha.o 
+  fi
+fi
+AC_SUBST(C_SWITCH_MACHINE)
 
-configure___ ld_switch_system=LD_SWITCH_SYSTEM
-configure___ ld_switch_machine=LD_SWITCH_MACHINE
+AC_SUBST(UNEXEC_OBJ)
 
-#ifdef THIS_IS_CONFIGURE
+C_SWITCH_SYSTEM=
+## Some programs in src produce warnings saying certain subprograms
+## are too complex and need a MAXMEM value greater than 2000 for
+## additional optimization.  --nils@exp-math.uni-essen.de
+test "$opsys" = "aix4.2" && test "x$GCC" != "xyes" && \
+  C_SWITCH_SYSTEM="-ma -qmaxmem=4000"
+## gnu-linux might need -D_BSD_SOURCE on old libc5 systems.
+## It is redundant in glibc2, since we define _GNU_SOURCE.
+AC_SUBST(C_SWITCH_SYSTEM)
 
-/* Get the CFLAGS for tests in configure.  */
-#ifdef __GNUC__
-configure___ CFLAGS=C_DEBUG_SWITCH C_OPTIMIZE_SWITCH '${SPECIFIED_CFLAGS}'
-#else
-configure___ CFLAGS=C_DEBUG_SWITCH '${SPECIFIED_CFLAGS}'
-#endif
 
-#else /* not THIS_IS_CONFIGURE */
+LIBS_SYSTEM=
+case "$opsys" in
+  ## IBM's X11R5 uses -lIM and -liconv in AIX 3.2.2.
+  aix4-2) LIBS_SYSTEM="-lrts -lIM -liconv" ;;
 
-/* Get the CFLAGS for real compilation.  */
-#ifdef __GNUC__
-configure___ REAL_CFLAGS=C_DEBUG_SWITCH C_OPTIMIZE_SWITCH C_WARNINGS_SWITCH ${PROFILING_CFLAGS} '${SPECIFIED_CFLAGS}'
-#else
-configure___ REAL_CFLAGS=C_DEBUG_SWITCH '${SPECIFIED_CFLAGS}'
-#endif
+  freebsd) LIBS_SYSTEM="-lutil" ;;
 
-#endif /* not THIS_IS_CONFIGURE */
-' > ${tempcname}
+  hpux*) LIBS_SYSTEM="-l:libdld.sl" ;;
 
-LDFLAGS="${LDFLAGS} ${PROFILING_LDFLAGS}"
+  sol2*) LIBS_SYSTEM="-lsocket -lnsl -lkstat" ;;
 
-# The value of CPP is a quoted variable reference, so we need to do this
-# to get its actual value...
-CPP=`eval "echo $CPP"`
-[eval `${CPP} -Isrc ${tempcname} \
-       | sed -n -e 's/^configure___ \([^=]*=\)\(.*\)$/\1"\2"/p'`
-if test "x$SPECIFIED_CFLAGS" = x; then
-  eval `${CPP} -Isrc -DTHIS_IS_CONFIGURE ${tempcname} \
-        | sed -n -e 's/^configure___ \([^=]*=\)\(.*\)$/\1"\2"/p'`
-else
-  REAL_CFLAGS="$CFLAGS"
-fi]
-rm ${tempcname}
+  ## Motif needs -lgen.
+  unixware) LIBS_SYSTEM="-lsocket -lnsl -lelf -lgen" ;;
+esac
+AC_SUBST(LIBS_SYSTEM)
 
-ac_link="$ac_link $ld_switch_machine $ld_switch_system"
 
 ### Make sure subsequent tests use flags consistent with the build flags.
 
 if test x"${OVERRIDE_CPPFLAGS}" != x; then
   CPPFLAGS="${OVERRIDE_CPPFLAGS}"
 else
-  CPPFLAGS="$c_switch_system $c_switch_machine $CPPFLAGS"
+  CPPFLAGS="$C_SWITCH_SYSTEM $C_SWITCH_MACHINE $CPPFLAGS"
 fi
 
 dnl For AC_FUNC_GETLOADAVG, at least:
@@ -997,19 +1038,83 @@ dnl Do this early because it can frob feature test macros for Unix-98 &c.
 AC_SYS_LARGEFILE
 
 
-### The standard library on x86-64 and s390x GNU/Linux distributions can
-### be located in either /usr/lib64 or /usr/lib.
-### In some rare cases, /usr/lib64 exists but does not contain the
-### relevant files (bug#1287).  Hence test for crtn.o.
-case "${canonical}" in
-  x86_64-*-linux-gnu* | s390x-*-linux-gnu* )
-    if test -e /usr/lib64/crtn.o; then
-      AC_DEFINE(HAVE_LIB64_DIR, 1,
-        [Define to 1 if the directory /usr/lib64 exists.])
+## If user specified a crt-dir, use that unconditionally.
+if test "X$CRT_DIR" = "X"; then
+
+  case "$canonical" in
+    x86_64-*-linux-gnu* | s390x-*-linux-gnu*)
+    ## On x86-64 and s390x GNU/Linux distributions, the standard library
+    ## can be in a variety of places.  We only try /usr/lib64 and /usr/lib.
+    ## For anything else (eg /usr/lib32), it is up the user to specify
+    ## the location (bug#5655).
+    ## Test for crtn.o, not just the directory, because sometimes the
+    ## directory exists but does not have the relevant files (bug#1287).
+    ## FIXME better to test for binary compatibility somehow.
+    test -e /usr/lib64/crtn.o && CRT_DIR=/usr/lib64
+    ;;
+
+    powerpc64-*-linux-gnu* | sparc64-*-linux-gnu*) CRT_DIR=/usr/lib64 ;;
+  esac
+
+  case "$opsys" in
+    hpux10-20) CRT_DIR=/lib ;;
+  esac
+
+  ## Default is /usr/lib.
+  test "X$CRT_DIR" = "X" && CRT_DIR=/usr/lib
+
+else
+
+  ## Some platforms don't use any of these files, so it is not
+  ## appropriate to put this test outside the if block.
+  test -e $CRT_DIR/crtn.o || test -e $CRT_DIR/crt0.o || \
+    AC_MSG_ERROR([crt*.o not found in specified location.])
+
 fi
+
+AC_SUBST(CRT_DIR)
+
+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 )
+    if test -f $CRT_DIR/crti.o; then
+       LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtend.o $(CRT_DIR)/crtn.o'
+        START_FILES='pre-crt0.o $(CRT_DIR)/crt0.o $(CRT_DIR)/crti.o $(CRT_DIR)/crtbegin.o'
+    else
+       LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtend.o'
+       START_FILES='pre-crt0.o $(CRT_DIR)/crt0.o $(CRT_DIR)/crtbegin.o'
+    fi
+    ;;
 esac
 
-dnl This function defintion taken from Gnome 2.0
+AC_SUBST(LIB_MATH)
+AC_SUBST(START_FILES)
+
+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
 dnl also defines GSTUFF_PKG_ERRORS on error
@@ -1065,7 +1170,8 @@ AC_DEFUN([PKG_CHECK_MODULES], [
 
 if test "${with_sound}" != "no"; then
   # Sound support for GNU/Linux and the free BSDs.
-  AC_CHECK_HEADERS(machine/soundcard.h sys/soundcard.h soundcard.h)
+  AC_CHECK_HEADERS(machine/soundcard.h sys/soundcard.h soundcard.h, 
+    have_sound_header=yes)
   # Emulation library used on NetBSD.
   AC_CHECK_LIB(ossaudio, _oss_ioctl, LIBSOUND=-lossaudio, LIBSOUND=)
   AC_SUBST(LIBSOUND)
@@ -1098,15 +1204,28 @@ if test "${with_sound}" != "no"; then
     CFLAGS_SOUND="$CFLAGS_SOUND $ALSA_CFLAGS"
     AC_DEFINE(HAVE_ALSA, 1, [Define to 1 if ALSA is available.])
   fi
+
+  dnl Define HAVE_SOUND if we have sound support.  We know it works and
+  dnl compiles only on the specified platforms.  For others, it
+  dnl probably doesn't make sense to try.
+  if test x$have_sound_header = xyes || test $HAVE_ALSA = yes; then
+     case "$opsys" in
+       dnl defined __FreeBSD__ || defined __NetBSD__ || defined __linux__
+       gnu-linux|freebsd|netbsd)
+         AC_DEFINE(HAVE_SOUND, 1, [Define to 1 if you have sound support.])
+         ;;
+     esac
+  fi
+
   AC_SUBST(CFLAGS_SOUND)
 fi
 
 dnl checks for header files
 AC_CHECK_HEADERS(sys/select.h sys/timeb.h sys/time.h unistd.h utime.h \
   linux/version.h sys/systeminfo.h termios.h limits.h string.h stdlib.h \
-  termcap.h stdio_ext.h fcntl.h strings.h coff.h pty.h sys/mman.h \
+  stdio_ext.h fcntl.h strings.h coff.h pty.h sys/mman.h \
   sys/param.h sys/vlimit.h sys/resource.h locale.h sys/_mbstate_t.h \
-  sys/utsname.h pwd.h utmp.h)
+  sys/utsname.h pwd.h utmp.h dirent.h util.h)
 
 AC_MSG_CHECKING(if personality LINUX32 can be set)
 AC_TRY_COMPILE([#include <sys/personality.h>], [personality (PER_LINUX32)],
@@ -1241,15 +1360,15 @@ AH_TEMPLATE(POINTER_TYPE,
            [Define as `void' if your compiler accepts `void *'; otherwise
             define as `char'.])dnl
 
-
-
-dnl This could be used for targets which can have both byte sexes.
-dnl We could presumably replace the hardwired WORDS_BIG_ENDIAN generally.
-dnl AC_C_BIGENDIAN
+dnl Check for endianess
+AC_C_BIGENDIAN
 
 dnl check for Make feature
 AC_PROG_MAKE_SET
 
+DEPFLAGS=
+MKDEPDIR=":"
+deps_frag=deps.mk
 dnl check for GNU Make if we have GCC and autodepend is on.
 if test "$GCC" = yes && test "$ac_enable_autodepend" = yes; then
    AC_MSG_CHECKING([whether we are using GNU Make])
@@ -1272,9 +1391,19 @@ if test "$GCC" = yes && test "$ac_enable_autodepend" = yes; then
       AC_MSG_RESULT([$ac_enable_autodepend])
    fi
    if test $ac_enable_autodepend = yes; then
-      AC_DEFINE(AUTO_DEPEND, 1, [Generate dependencies with gcc.])
+      DEPFLAGS='-MMD -MF ${DEPDIR}/$*.d'
+      ## In parallel builds, another make might create depdir between
+      ## the first test and mkdir, so stick another test on the end.
+      ## Or use mkinstalldirs?  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
+AC_SUBST(MKDEPDIR)
+AC_SUBST(DEPFLAGS)
+AC_SUBST_FILE(deps_frag)
+
 
 dnl checks for operating system services
 AC_SYS_LONG_FILE_NAMES
@@ -1291,17 +1420,19 @@ 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.
-## This is an experiment, take it out if it causes problems.
 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=
 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,/'`
   fi
   x_default_search_path=""
   x_search_path=${x_libraries}
@@ -1324,6 +1455,9 @@ ${x_library}/X11/%T/%N%S"
     fi
   done
 fi
+AC_SUBST(LD_SWITCH_X_SITE_AUX)
+AC_SUBST(LD_SWITCH_X_SITE_AUX_RPATH)
+
 if test "${x_includes}" != NONE && test -n "${x_includes}"; then
   C_SWITCH_X_SITE=-I`echo ${x_includes} | sed -e "s/:/ -I/g"`
 fi
@@ -1353,27 +1487,39 @@ tmp_CPPFLAGS="$CPPFLAGS"
 tmp_CFLAGS="$CFLAGS"
 CPPFLAGS="$CPPFLAGS -x objective-c"
 CFLAGS="$CFLAGS -x objective-c"
+TEMACS_LDFLAGS2="\${LDFLAGS} \${PROFILING_LDFLAGS}"
+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=`pwd`/nextstep/Emacs.app/Contents/MacOS
-     ns_appresdir=`pwd`/nextstep/Emacs.app/Contents/Resources
+     ns_appdir=`pwd`/nextstep/Emacs.app/
+     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=`pwd`/nextstep/Emacs.app
-     ns_appresdir=`pwd`/nextstep/Emacs.app/Resources
+     ns_appdir=`pwd`/nextstep/Emacs.app/
+     ns_appbindir=${ns_appdir}
+     ns_appresdir=${ns_appdir}Resources
      ns_appsrc=${srcdir}/nextstep/GNUstep/Emacs.base
-     dnl FIXME sourcing this 3 times in subshells seems inefficient.
-     GNUSTEP_MAKEFILES="$(. $GNUSTEP_CONFIG_FILE; echo $GNUSTEP_MAKEFILES)"
+     dnl FIXME sourcing this several times in subshells seems inefficient.
      GNUSTEP_SYSTEM_HEADERS="$(. $GNUSTEP_CONFIG_FILE; echo $GNUSTEP_SYSTEM_HEADERS)"
      GNUSTEP_SYSTEM_LIBRARIES="$(. $GNUSTEP_CONFIG_FILE; echo $GNUSTEP_SYSTEM_LIBRARIES)"
-     CPPFLAGS="$CPPFLAGS -I${GNUSTEP_SYSTEM_HEADERS}"
-     CFLAGS="$CFLAGS -I${GNUSTEP_SYSTEM_HEADERS}"
-     REAL_CFLAGS="$REAL_CFLAGS -I${GNUSTEP_SYSTEM_HEADERS}"
-     LDFLAGS="$LDFLAGS -L${GNUSTEP_SYSTEM_LIBRARIES}"
+     dnl I seemed to need these as well with GNUstep-startup 0.25.
+     GNUSTEP_LOCAL_HEADERS="$(. $GNUSTEP_CONFIG_FILE; echo $GNUSTEP_LOCAL_HEADERS)"
+     GNUSTEP_LOCAL_LIBRARIES="$(. $GNUSTEP_CONFIG_FILE; echo $GNUSTEP_LOCAL_LIBRARIES)"
+     test "x${GNUSTEP_LOCAL_HEADERS}" != "x" && \
+       GNUSTEP_LOCAL_HEADERS="-I${GNUSTEP_LOCAL_HEADERS}"
+     test "x${GNUSTEP_LOCAL_LIBRARIES}" != "x" && \
+       GNUSTEP_LOCAL_LIBRARIES="-L${GNUSTEP_LOCAL_LIBRARIES}"
+     CPPFLAGS="$CPPFLAGS -I${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}"
+     CFLAGS="$CFLAGS -I${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}"
+     LDFLAGS="$LDFLAGS -L${GNUSTEP_SYSTEM_LIBRARIES} ${GNUSTEP_LOCAL_LIBRARIES}"
+     LIB_STANDARD=
+     START_FILES=
+     TEMACS_LDFLAGS2=
   fi
   AC_CHECK_HEADER([AppKit/AppKit.h], [HAVE_NS=yes],
                  [AC_MSG_ERROR([`--with-ns' was specified, but the include
@@ -1387,6 +1533,11 @@ if test "${with_ns}" != no; then
     NS_HAVE_NSINTEGER=no
   fi
 fi
+AC_SUBST(TEMACS_LDFLAGS2)
+
+ns_frag=/dev/null
+NS_OBJ=
+NS_SUPPORT=
 if test "${HAVE_NS}" = yes; then
   window_system=nextstep
   with_xft=no
@@ -1396,9 +1547,16 @@ if test "${HAVE_NS}" = yes; then
   if test "${EN_NS_SELF_CONTAINED}" = yes; then
      prefix=${ns_appresdir}
   fi
+  ns_frag=$srcdir/src/ns.mk
+  NS_OBJ="nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o fontset.o fringe.o image.o"
+  NS_SUPPORT="\${lispsource}emacs-lisp/easymenu.elc \${lispsource}term/ns-win.elc"
 fi
 CFLAGS="$tmp_CFLAGS"
 CPPFLAGS="$tmp_CPPFLAGS"
+AC_SUBST(NS_OBJ)
+AC_SUBST(NS_SUPPORT)
+AC_SUBST(LIB_STANDARD)
+AC_SUBST_FILE(ns_frag)
 
 case "${window_system}" in
   x11 )
@@ -1411,6 +1569,8 @@ case "${window_system}" in
 dnl Dont set this for GTK.  A lot of tests below assumes Xt when
 dnl USE_X_TOOLKIT is set.
             USE_X_TOOLKIT=none ;;
+      gtk3 ) with_gtk3=yes
+             USE_X_TOOLKIT=none ;;
       no ) USE_X_TOOLKIT=none ;;
 dnl If user did not say whether to use a toolkit, make this decision later:
 dnl use the toolkit if we have gtk, or X11R5 or newer.
@@ -1460,11 +1620,29 @@ AC_CACHE_CHECK(whether __after_morecore_hook exists,
 if test $emacs_cv_var___after_morecore_hook = no; then
   doug_lea_malloc=no
 fi
+
+
+dnl See comments in aix4-2.h about maybe using system malloc there.
+system_malloc=no
+case "$opsys" in
+  ## darwin ld insists on the use of malloc routines in the System framework.
+  darwin|sol2-10) system_malloc=yes ;;
+esac
+
 if test "${system_malloc}" = "yes"; then
+  AC_DEFINE(SYSTEM_MALLOC, 1, [Define to use system malloc.])
   GNU_MALLOC=no
   GNU_MALLOC_reason="
     (The GNU allocators don't work with this system configuration.)"
+  GMALLOC_OBJ=
+  VMLIMIT_OBJ=
+else
+  test "$doug_lea_malloc" != "yes" && GMALLOC_OBJ=gmalloc.o
+  VMLIMIT_OBJ=vm-limit.o
 fi
+AC_SUBST(GMALLOC_OBJ)
+AC_SUBST(VMLIMIT_OBJ)
+
 if test "$doug_lea_malloc" = "yes" ; then
   if test "$GNU_MALLOC" = yes ; then
     GNU_MALLOC_reason="
@@ -1472,22 +1650,32 @@ if test "$doug_lea_malloc" = "yes" ; then
   fi
   AC_DEFINE(DOUG_LEA_MALLOC, 1,
            [Define to 1 if you are using the GNU C Library.])
+
+  ## Use mmap directly for allocating larger buffers.
+  ## FIXME this comes from src/s/{gnu,gnu-linux}.h:
+  ## #ifdef DOUG_LEA_MALLOC; #undef REL_ALLOC; #endif
+  ## Does the AC_FUNC_MMAP test below make this check unecessary?
+  case "$opsys" in
+    gnu*) REL_ALLOC=no ;;
+  esac
 fi
 
 if test x"${REL_ALLOC}" = x; then
   REL_ALLOC=${GNU_MALLOC}
 fi
 
-dnl For now, need to use an explicit `#define USE_MMAP_FOR_BUFFERS 1'
-dnl the system configuration file (s/*.h) to turn the use of mmap
-dnl in the relocating allocator on.
+use_mmap_for_buffers=no
+case "$opsys" in
+  freebsd|irix6-5) use_mmap_for_buffers=yes ;;
+esac
 
 AC_FUNC_MMAP
 if test $use_mmap_for_buffers = yes; then
+  AC_DEFINE(USE_MMAP_FOR_BUFFERS, 1, [Define to use mmap to allocate buffer text.])
   REL_ALLOC=no
 fi
 
-LIBS="$libsrc_libs $LIBS"
+LIBS="$LIBS_SYSTEM $LIBS"
 
 dnl If found, this defines HAVE_LIBDNET, which m/pmax.h checks,
 dnl and also adds -ldnet to LIBS, which Autoconf uses for checks.
@@ -1501,6 +1689,18 @@ AC_CHECK_LIB(Xbsd, main, LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE -lXbsd")
 
 AC_CHECK_LIB(pthreads, cma_open)
 
+## Note: when using cpp in s/aix4.2.h, this definition depended on
+## HAVE_LIBPTHREADS.  That was not defined earlier in configure when
+## the system file was sourced.  Hence the value of LIBS_SYSTEM
+## added to LIBS in configure would never contain the pthreads part,
+## but the value used in Makefiles might.  FIXME?
+##
+## -lpthreads seems to be necessary for Xlib in X11R6, and should
+## be harmless on older versions of X where it happens to exist.
+test "$opsys" = "aix4-2" && \
+  test $ac_cv_lib_pthreads_cma_open = yes && \
+  LIBS_SYSTEM="$LIBS_SYSTEM -lpthreads"
+
 dnl Check for need for bigtoc support on IBM AIX
 
 case ${host_os} in
@@ -1521,12 +1721,13 @@ esac
 # used for the tests that follow.  We set them back to REAL_CFLAGS and
 # REAL_CPPFLAGS later on.
 
+REAL_CFLAGS="$CFLAGS"
 REAL_CPPFLAGS="$CPPFLAGS"
 
 if test "${HAVE_X11}" = "yes"; then
   DEFS="$C_SWITCH_X_SITE $DEFS"
   LDFLAGS="$LDFLAGS $LD_SWITCH_X_SITE"
-  LIBS="$LIBX $LIBS"
+  LIBS="-lX11 $LIBS"
   CFLAGS="$C_SWITCH_X_SITE $CFLAGS"
   CPPFLAGS="$C_SWITCH_X_SITE $CPPFLAGS"
 
@@ -1602,6 +1803,15 @@ fail;
     AC_MSG_RESULT(6 or newer)
     AC_DEFINE(HAVE_X11R6, 1,
              [Define to 1 if you have the X11R6 or newer version of Xlib.])
+    AC_DEFINE(HAVE_X_I18N, 1, [Define if you have usable i18n support.])
+    ## inoue@ainet.or.jp says Solaris has a bug related to X11R6-style
+    ## XIM support.
+    case "$opsys" in
+      sol2-*) : ;;
+      *) AC_DEFINE(HAVE_X11R6_XIM, 1,
+           [Define if you have usable X11R6-style XIM support.])
+         ;;
+    esac
   else
     AC_MSG_RESULT(before 6)
   fi
@@ -1615,12 +1825,11 @@ if test "${HAVE_X11}" = "yes" || test "${NS_IMPL_GNUSTEP}" = "yes"; then
     RSVG_REQUIRED=2.11.0
     RSVG_MODULE="librsvg-2.0 >= $RSVG_REQUIRED"
 
-    PKG_CHECK_MODULES(RSVG, $RSVG_MODULE, :, :)
+    PKG_CHECK_MODULES(RSVG, $RSVG_MODULE, HAVE_RSVG=yes, :)
     AC_SUBST(RSVG_CFLAGS)
     AC_SUBST(RSVG_LIBS)
 
-    if test ".${RSVG_CFLAGS}" != "."; then
-      HAVE_RSVG=yes
+    if test $HAVE_RSVG = yes; then
       AC_DEFINE(HAVE_RSVG, 1, [Define to 1 if using librsvg.])
       CFLAGS="$CFLAGS $RSVG_CFLAGS"
       LIBS="$RSVG_LIBS $LIBS"
@@ -1628,8 +1837,37 @@ if test "${HAVE_X11}" = "yes" || test "${NS_IMPL_GNUSTEP}" = "yes"; then
   fi
 fi
 
+HAVE_IMAGEMAGICK=no
+if test "${with_imagemagick}" != "no"; then
+  IMAGEMAGICK_MODULE="Wand"
+  PKG_CHECK_MODULES(IMAGEMAGICK, $IMAGEMAGICK_MODULE, HAVE_IMAGEMAGICK=yes, :)
+  AC_SUBST(IMAGEMAGICK_CFLAGS)
+  AC_SUBST(IMAGEMAGICK_LIBS)
+
+  if test $HAVE_IMAGEMAGICK = 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)
+  fi
+fi
+
 
 HAVE_GTK=no
+if test "${with_gtk3}" = "yes"; then
+  GLIB_REQUIRED=2.6
+  GTK_REQUIRED=2.90
+  GTK_MODULES="gtk+-3.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED"
+
+  dnl Checks for libraries.
+  PKG_CHECK_MODULES(GTK, $GTK_MODULES, pkg_check_gtk=yes, pkg_check_gtk=no)
+  if test "$pkg_check_gtk" = "no" && test "$USE_X_TOOLKIT" != "maybe"; then
+     AC_MSG_ERROR($GTK_PKG_ERRORS)
+  fi
+fi
+
+if test "$pkg_check_gtk" != "yes"; then
+  HAVE_GTK=no
 if test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "maybe"; then
   GLIB_REQUIRED=2.6
   GTK_REQUIRED=2.6
@@ -1641,8 +1879,9 @@ if test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "maybe"; then
      AC_MSG_ERROR($GTK_PKG_ERRORS)
   fi
 fi
+fi
 
-
+GTK_OBJ=
 if test x"$pkg_check_gtk" = xyes; then
 
   AC_SUBST(GTK_CFLAGS)
@@ -1660,6 +1899,7 @@ if test x"$pkg_check_gtk" = xyes; then
   else
     HAVE_GTK=yes
     AC_DEFINE(USE_GTK, 1, [Define to 1 if using GTK.])
+    GTK_OBJ=gtkutil.o
     USE_X_TOOLKIT=none
     if $PKG_CONFIG --atleast-version=2.10 gtk+-2.0; then
       :
@@ -1673,6 +1913,7 @@ if test x"$pkg_check_gtk" = xyes; then
   fi
 
 fi
+AC_SUBST(GTK_OBJ)
 
 
 if test "${HAVE_GTK}" = "yes"; then
@@ -1683,15 +1924,6 @@ if test "${HAVE_GTK}" = "yes"; then
     with_toolkit_scroll_bars=yes
   fi
 
-  dnl  Check if we can use multiple displays with this GTK version.
-  dnl  If gdk_display_open exists, assume all others are there also.
-  HAVE_GTK_MULTIDISPLAY=no
-  AC_CHECK_FUNCS(gdk_display_open, HAVE_GTK_MULTIDISPLAY=yes)
-  if test "${HAVE_GTK_MULTIDISPLAY}" = "yes"; then
-    AC_DEFINE(HAVE_GTK_MULTIDISPLAY, 1,
-              [Define to 1 if GTK can handle more than one display.])
-  fi
-
   dnl  Check if we have the old file selection dialog declared and
   dnl  in the link library.  In 2.x it may be in the library,
   dnl  but not declared if deprecated featured has been selected out.
@@ -1701,29 +1933,11 @@ if test "${HAVE_GTK}" = "yes"; then
                    HAVE_GTK_FILE_SELECTION=no, [AC_INCLUDES_DEFAULT
 #include <gtk/gtk.h>])
   if test "$HAVE_GTK_FILE_SELECTION" = yes; then
-    AC_CHECK_FUNCS(gtk_file_selection_new, HAVE_GTK_FILE_SELECTION=yes,
-                   HAVE_GTK_FILE_SELECTION=no)
-  fi
-
-  dnl  Check if we have the new file chooser dialog
-  HAVE_GTK_FILE_CHOOSER=no
-  AC_CHECK_DECL(GTK_TYPE_FILE_CHOOSER, HAVE_GTK_FILE_CHOOSER=yes,
-                HAVE_GTK_FILE_CHOOSER=no, [AC_INCLUDES_DEFAULT
-#include <gtk/gtk.h>])
-  if test "$HAVE_GTK_FILE_CHOOSER" = yes; then
-    AC_CHECK_FUNCS(gtk_file_chooser_dialog_new, HAVE_GTK_FILE_CHOOSER=yes,
-                   HAVE_GTK_FILE_CHOOSER=no)
-  fi
-
-  if test "$HAVE_GTK_FILE_SELECTION" = yes \
-     && test "$HAVE_GTK_FILE_CHOOSER" = yes;  then
-    AC_DEFINE(HAVE_GTK_FILE_BOTH, 1,
-              [Define to 1 if GTK has both file selection and chooser dialog.])
+    AC_CHECK_FUNCS(gtk_file_selection_new)
   fi
 
   dnl Check if pthreads are available.  Emacs only needs this when using
   dnl gtk_file_chooser under Gnome.
-  if test "$HAVE_GTK_FILE_CHOOSER" = yes; then
     HAVE_GTK_AND_PTHREAD=no
     AC_CHECK_HEADERS(pthread.h)
     if test "$ac_cv_header_pthread_h"; then
@@ -1737,21 +1951,30 @@ if test "${HAVE_GTK}" = "yes"; then
       AC_DEFINE(HAVE_GTK_AND_PTHREAD, 1,
                [Define to 1 if you have GTK and pthread (-lpthread).])
     fi
-  fi
+
+  dnl Check for functions introduced in 2.14 and later.
+  AC_CHECK_FUNCS(gtk_widget_get_window gtk_widget_set_has_window \
+                 gtk_dialog_get_action_area gtk_widget_get_sensitive \
+                 gtk_widget_get_mapped gtk_adjustment_get_page_size \
+                 gtk_orientable_set_orientation)
+
 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.
 HAVE_DBUS=no
+DBUS_OBJ=
 if test "${with_dbus}" = "yes"; then
    PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.0, HAVE_DBUS=yes, HAVE_DBUS=no)
    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])
+     DBUS_OBJ=dbusbind.o
    fi
 fi
+AC_SUBST(DBUS_OBJ)
 
 dnl GConf has been tested under GNU/Linux only.
 dnl The version is really arbitrary, it is about the same age as Gtk+ 2.6.
@@ -1763,9 +1986,22 @@ if test "${HAVE_X11}" = "yes" && test "${with_gconf}" = "yes"; then
    fi
 fi
 
+dnl SELinux is available for GNU/Linux only.
+HAVE_LIBSELINUX=no
+LIBSELINUX_LIBS=
+if test "${with_selinux}" = "yes"; then
+   AC_CHECK_LIB([selinux], [lgetfilecon], HAVE_LIBSELINUX=yes, HAVE_LIBSELINUX=no)
+   if test "$HAVE_LIBSELINUX" = yes; then
+      AC_DEFINE(HAVE_LIBSELINUX, 1, [Define to 1 if using SELinux.])
+      LIBSELINUX_LIBS=-lselinux
+   fi
+fi
+AC_SUBST(LIBSELINUX_LIBS)
+
 dnl Do not put whitespace before the #include statements below.
 dnl Older compilers (eg sunos4 cc) choke on it.
 HAVE_XAW3D=no
+LUCID_LIBW=
 if test x"${USE_X_TOOLKIT}" = xmaybe || test x"${USE_X_TOOLKIT}" = xLUCID; then
   if test "$with_xaw3d" != no; then
     AC_MSG_CHECKING(for xaw3d)
@@ -1783,6 +2019,7 @@ if test x"${USE_X_TOOLKIT}" = xmaybe || test x"${USE_X_TOOLKIT}" = xLUCID; then
     AC_MSG_RESULT([yes; using Lucid toolkit])
     USE_X_TOOLKIT=LUCID
     HAVE_XAW3D=yes
+    LUCID_LIBW=-lXaw3d
     AC_DEFINE(HAVE_XAW3D, 1,
               [Define to 1 if you have the Xaw3d library (-lXaw3d).])
   else
@@ -1798,6 +2035,7 @@ if test x"${USE_X_TOOLKIT}" = xmaybe || test x"${USE_X_TOOLKIT}" = xLUCID; then
     if test $emacs_cv_xaw = yes; then
       AC_MSG_RESULT([yes; using Lucid toolkit])
       USE_X_TOOLKIT=LUCID
+      LUCID_LIBW=-lXaw
     elif test x"${USE_X_TOOLKIT}" = xLUCID; then
       AC_MSG_ERROR([Lucid toolkit requires X11/Xaw include files])
     else
@@ -1809,6 +2047,7 @@ fi
 
 X_TOOLKIT_TYPE=$USE_X_TOOLKIT
 
+LIBXTR6=
 if test "${USE_X_TOOLKIT}" != "none"; then
   AC_MSG_CHECKING(X11 toolkit version)
   AC_CACHE_VAL(emacs_cv_x11_toolkit_version_6,
@@ -1822,6 +2061,11 @@ fail;
     AC_MSG_RESULT(6 or newer)
     AC_DEFINE(HAVE_X11XTR6, 1,
              [Define to 1 if you have the X11R6 or newer version of Xt.])
+    LIBXTR6="-lSM -lICE"
+    case "$opsys" in
+      ## Use libw.a along with X11R6 Xt.
+      unixware) LIBXTR6="$LIBXTR6 -lw" ;;
+    esac
   else
     AC_MSG_RESULT(before 6)
   fi
@@ -1837,6 +2081,18 @@ dnl tranle@intellicorp.com says libXmu.a can need XtMalloc in libXt.a to link.
   AC_CHECK_LIB(Xmu, XmuConvertStandardSelection)
   test $ac_cv_lib_Xmu_XmuConvertStandardSelection = no && LIBS="$OLDLIBS"
 fi
+AC_SUBST(LIBXTR6)
+
+dnl FIXME the logic here seems weird, but this is what cpp was doing.
+dnl Why not just test for libxmu in the normal way?
+LIBXMU=-lXmu
+case "$machine" in
+  ## These machines don't supply Xmu.
+  hpux* | aix4-2 )
+    test "X$ac_cv_lib_Xmu_XmuConvertStandardSelection" != "Xyes" && LIBXMU=
+    ;;
+esac
+AC_SUBST(LIBXMU)
 
 # On Irix 6.5, at least, we need XShapeQueryExtension from -lXext for Xaw3D.
 if test "${HAVE_X11}" = "yes"; then
@@ -1845,6 +2101,7 @@ if test "${HAVE_X11}" = "yes"; then
   fi
 fi
 
+LIBXP=
 if test "${USE_X_TOOLKIT}" = "MOTIF"; then
   AC_CACHE_CHECK(for Motif version 2.1, emacs_cv_motif_version_2_1,
   [AC_TRY_COMPILE([#include <Xm/Xm.h>],
@@ -1854,16 +2111,8 @@ int x = 5;
 Motif version prior to 2.1.
 #endif],
     emacs_cv_motif_version_2_1=yes, emacs_cv_motif_version_2_1=no)])
-  HAVE_MOTIF_2_1=$emacs_cv_motif_version_2_1
   if test $emacs_cv_motif_version_2_1 = yes; then
-    HAVE_LIBXP=no
-    AC_DEFINE(HAVE_MOTIF_2_1, 1,
-             [Define to 1 if you have Motif 2.1 or newer.])
-    AC_CHECK_LIB(Xp, XpCreateContext, HAVE_LIBXP=yes)
-    if test ${HAVE_LIBXP} = yes; then
-      AC_DEFINE(HAVE_LIBXP, 1,
-               [Define to 1 if you have the Xp library (-lXp).])
-    fi
+    AC_CHECK_LIB(Xp, XpCreateContext, LIBXP=-lXp)
   else
     AC_CACHE_CHECK(for LessTif where some systems put it, emacs_cv_lesstif,
     # We put this in CFLAGS temporarily to precede other -I options
@@ -2065,6 +2314,7 @@ else
     HAVE_LIBOTF=no
     HAVE_M17N_FLT=no
 fi
+
 ### End of font-backend (under X11) section.
 
 AC_SUBST(FREETYPE_CFLAGS)
@@ -2078,6 +2328,7 @@ AC_SUBST(M17N_FLT_LIBS)
 
 ### 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_CHECK_HEADER(X11/xpm.h,
@@ -2101,11 +2352,14 @@ no_return_alloc_pixels
 
   if test "${HAVE_XPM}" = "yes"; then
     AC_DEFINE(HAVE_XPM, 1, [Define to 1 if you have the Xpm libary (-lXpm).])
+    LIBXPM=-lXpm
   fi
 fi
+AC_SUBST(LIBXPM)
 
 ### Use -ljpeg if available, unless `--with-jpeg=no'.
 HAVE_JPEG=no
+LIBJPEG=
 if test "${HAVE_X11}" = "yes"; then
   if test "${with_jpeg}" != "no"; then
     dnl Checking for jpeglib.h can lose because of a redefinition of
@@ -2125,10 +2379,15 @@ if test "${HAVE_X11}" = "yes"; then
         [AC_MSG_WARN([libjpeg found, but not version 6b or later])
         HAVE_JPEG=no])
   fi
+  if test "${HAVE_JPEG}" = "yes"; then
+    LIBJPEG=-ljpeg
+  fi
 fi
+AC_SUBST(LIBJPEG)
 
 ### 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
@@ -2141,11 +2400,14 @@ 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"
   fi
 fi
+AC_SUBST(LIBPNG)
 
 ### 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_CHECK_HEADER(tiffio.h,
@@ -2157,35 +2419,34 @@ if test "${HAVE_X11}" = "yes"; then
 
   if test "${HAVE_TIFF}" = "yes"; then
     AC_DEFINE(HAVE_TIFF, 1, [Define to 1 if you have the tiff library (-ltiff).])
+    dnl FIXME -lz -lm, as per libpng?
+    LIBTIFF=-ltiff
   fi
 fi
+AC_SUBST(LIBTIFF)
 
 ### 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_CHECK_HEADER(gif_lib.h,
 # EGifPutExtensionLast only exists from version libungif-4.1.0b1.
 # Earlier versions can crash Emacs.
-    [AC_CHECK_LIB(gif, EGifPutExtensionLast, HAVE_GIF=yes, try_libungif=yes)])
+    [AC_CHECK_LIB(gif, EGifPutExtensionLast, HAVE_GIF=yes, HAVE_GIF=maybe)])
 
   if test "$HAVE_GIF" = yes; then
-      ac_gif_lib_name="-lgif"
-  fi
-
+    LIBGIF=-lgif
+  elif test "$HAVE_GIF" = maybe; then
 # If gif_lib.h but no libgif, try libungif.
-  if test x"$try_libungif" = xyes; then
-    AC_CHECK_LIB(ungif, EGifPutExtensionLast, HAVE_GIF=yes)
-
-    if test "$HAVE_GIF" = yes; then
-      AC_DEFINE(LIBGIF, -lungif, [Compiler option to link with the gif library (if not -lgif).])
-      ac_gif_lib_name="-lungif"
-    fi
+    AC_CHECK_LIB(ungif, EGifPutExtensionLast, HAVE_GIF=yes, HAVE_GIF=no)
+    test "$HAVE_GIF" = yes && LIBGIF=-lungif
   fi
 
   if test "${HAVE_GIF}" = "yes"; then
-    AC_DEFINE(HAVE_GIF, 1, [Define to 1 if you have a gif library (default -lgif; otherwise specify with LIBGIF).])
+    AC_DEFINE(HAVE_GIF, 1, [Define to 1 if you have a gif (or ungif) library.])
   fi
 fi
+AC_SUBST(LIBGIF)
 
 dnl Check for required libraries.
 if test "${HAVE_X11}" = "yes"; then
@@ -2214,18 +2475,25 @@ fi
 
 ### Use -lgpm if available, unless `--with-gpm=no'.
 HAVE_GPM=no
+LIBGPM=
+MOUSE_SUPPORT=
 if test "${with_gpm}" != "no"; then
   AC_CHECK_HEADER(gpm.h,
     [AC_CHECK_LIB(gpm, Gpm_Open, HAVE_GPM=yes)])
-fi
 
-if test "${HAVE_GPM}" = "yes"; then
-  AC_DEFINE(HAVE_GPM, 1, [Define to 1 if you have the gpm library (-lgpm).])
+  if test "${HAVE_GPM}" = "yes"; then
+    AC_DEFINE(HAVE_GPM, 1, [Define to 1 if you have the gpm library (-lgpm).])
+    LIBGPM=-lgpm
+    ## May be reset below.
+    MOUSE_SUPPORT="\$(GPM_MOUSE_SUPPORT)"
+  fi
 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.])])
 
+C_SWITCH_X_SYSTEM=
 ### 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.])
@@ -2235,6 +2503,9 @@ if test "${HAVE_NS}" = "yes"; then
   fi
   if test "${NS_IMPL_GNUSTEP}" = "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.  */
+    C_SWITCH_X_SYSTEM="-D_REENTRANT -fPIC -fno-strict-aliasing"
     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
@@ -2248,18 +2519,21 @@ fi
 
 ### Use session management (-lSM -lICE) if available
 HAVE_X_SM=no
+LIBXSM=
 if test "${HAVE_X11}" = "yes"; then
   AC_CHECK_HEADER(X11/SM/SMlib.h,
     [AC_CHECK_LIB(SM, SmcOpenConnection, HAVE_X_SM=yes, , -lICE)])
 
   if test "${HAVE_X_SM}" = "yes"; then
     AC_DEFINE(HAVE_X_SM, 1, [Define to 1 if you have the SM library (-lSM).])
+    LIBXSM="-lSM -lICE"
     case "$LIBS" in
       *-lSM*) ;;
-      *)      LIBS="-lSM -lICE $LIBS" ;;
+      *)      LIBS="$LIBXSM $LIBS" ;;
     esac
   fi
 fi
+AC_SUBST(LIBXSM)
 
 # If netdb.h doesn't declare h_errno, we must declare it by hand.
 AC_CACHE_CHECK(whether netdb declares h_errno,
@@ -2286,13 +2560,24 @@ AC_CHECK_LIB(m, sqrt)
 
 # Check for mail-locking functions in a "mail" library.  Probably this should
 # have the same check as for liblockfile below.
-AC_CHECK_LIB(mail, maillock)
+AC_CHECK_LIB(mail, maillock, have_mail=yes, have_mail=no)
+if test $have_mail = yes; then
+  LIBS_MAIL=-lmail
+  LIBS="$LIBS_MAIL $LIBS"
+  AC_DEFINE(HAVE_LIBMAIL, 1, [Define to 1 if you have the `mail' library (-lmail).])
+else
+  LIBS_MAIL=
+fi
 dnl Debian, at least:
-AC_CHECK_LIB(lockfile, maillock)
+AC_CHECK_LIB(lockfile, maillock, have_lockfile=yes, have_lockfile=no)
+if test $have_lockfile = yes; then
+   LIBS_MAIL=-llockfile
+   LIBS="$LIBS_MAIL $LIBS"
+   AC_DEFINE(HAVE_LIBLOCKFILE, 1, [Define to 1 if you have the `lockfile' library (-llockfile).])
+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.
-if test "$ac_cv_lib_lockfile_maillock" = no; then
   dnl This works for files generally, not just executables.
   dnl Should we look elsewhere for it?  Maybe examine /etc/ld.so.conf?
   AC_CHECK_PROG(liblockfile, liblockfile.so, yes, no,
@@ -2301,22 +2586,64 @@ if test "$ac_cv_lib_lockfile_maillock" = no; then
     AC_MSG_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.])
-  else :
   fi
 fi
 AC_CHECK_FUNCS(touchlock)
 AC_CHECK_HEADERS(maillock.h)
+AC_SUBST(LIBS_MAIL)
+
+## 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) AC_DEFINE(MAIL_USE_FLOCK, 1, [Define if the mailer uses flock to interlock the mail spool.]) ;;
+
+  lockf) AC_DEFINE(MAIL_USE_LOCKF, 1, [Define if the mailer uses lockf to interlock the mail spool.]) ;;
+
+  *) BLESSMAIL_TARGET="need-blessmail" ;;
+esac
+AC_SUBST(BLESSMAIL_TARGET)
+
 
 AC_CHECK_FUNCS(gethostname getdomainname dup2 \
 rename closedir mkdir rmdir sysinfo getrusage get_current_dir_name \
-random lrand48 bcopy bcmp logb frexp fmod rint cbrt ftime setsid \
+random lrand48 logb frexp fmod rint cbrt ftime setsid \
 strerror fpathconf select mktime euidaccess getpagesize tzset setlocale \
 utimes getrlimit setrlimit setpgid getcwd getwd shutdown getaddrinfo \
-__fpending mblen mbrlen mbsinit strsignal setitimer ualarm index rindex \
+__fpending mblen mbrlen mbsinit strsignal setitimer ualarm strchr strrchr \
 sendto recvfrom getsockopt setsockopt getsockname getpeername \
-gai_strerror mkstemp getline getdelim mremap memmove fsync sync bzero \
+gai_strerror mkstemp getline getdelim mremap memmove fsync sync \
 memset memcmp difftime memcpy mempcpy mblen mbrlen posix_memalign \
-cfmakeraw cfsetspeed)
+cfmakeraw cfsetspeed isnan copysign __executable_start)
 
 AC_CHECK_HEADERS(sys/un.h)
 
@@ -2352,10 +2679,102 @@ AC_CHECK_FUNCS(getpt)
 # 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.
-AC_CHECK_LIB(ncurses, tparm)
+# Also we need tputs and friends to be able to build at all.
+have_tputs_et_al=true
+AC_SEARCH_LIBS(tputs, [ncurses terminfo termcap], , have_tputs_et_al=false)
+if test "$have_tputs_et_al" != true; then
+  AC_MSG_ERROR([I couldn't find termcap functions (tputs and friends).
+Maybe some development libraries/packages are missing?  Try installing
+libncurses-dev(el), libterminfo-dev(el) or similar.])
+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
+LIBS_TERMCAP=
+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 ;;
+
+  ## 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
+    ;;
 
-# Do we have res_init, for detecting changes in /etc/resolv.conf?
+  freebsd)
+    AC_MSG_CHECKING([whether FreeBSD is new enough to use terminfo])
+    AC_CACHE_VAL(emacs_cv_freebsd_terminfo,
+    [AC_TRY_LINK([#include <osreldate.h>],
+[#if __FreeBSD_version < 400000
+fail;
+#endif
+], emacs_cv_freebsd_terminfo=yes, emacs_cv_freebsd_terminfo=no)])
+
+    AC_MSG_RESULT($emacs_cv_freebsd_terminfo)
+
+    if test $emacs_cv_freebsd_terminfo = yes; then
+      TERMINFO=yes
+      LIBS_TERMCAP="-lncurses"
+    else
+      LIBS_TERMCAP="-ltermcap"
+    fi
+    ;;
+
+  netbsd)
+    if test $ac_cv_search_tputs = -lterminfo; then
+      TERMINFO=yes
+      LIBS_TERMCAP="-lterminfo"
+    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
+  AC_DEFINE(TERMINFO, 1, [Define to 1 if you use terminfo instead of termcap.])
+
+  ## Default used to be -ltermcap.  Add a case above if need something else.
+  test "x$LIBS_TERMCAP" = "x" && LIBS_TERMCAP="-lcurses"
+
+  TERMCAP_OBJ=terminfo.o
+fi
+AC_SUBST(LIBS_TERMCAP)
+AC_SUBST(TERMCAP_OBJ)
 
+
+# Do we have res_init, for detecting changes in /etc/resolv.conf?
 resolv=no
 AC_TRY_LINK([#include <netinet/in.h>
 #include <arpa/nameser.h>
@@ -2383,8 +2802,9 @@ if test "$have_res_init" = yes; then
 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.
+  # Don't set $LIBS here -- see comments above.  FIXME which comments?
   AC_CHECK_FUNC(res_send, , [AC_CHECK_FUNC(__res_send, ,
      [AC_CHECK_LIB(resolv, res_send, resolv=yes,
                  [AC_CHECK_LIB(resolv, __res_send, resolv=yes)])])])
@@ -2394,28 +2814,86 @@ if test "$with_hesiod" != no ; then
     RESOLVLIB=
   fi
   AC_CHECK_FUNC(hes_getmailhost, , [AC_CHECK_LIB(hesiod, hes_getmailhost,
-       [AC_DEFINE(HAVE_LIBHESIOD, 1,
-                 [Define to 1 if you have the hesiod library (-lhesiod).])],
-       :, $RESOLVLIB)])
+       hesiod=yes, :, $RESOLVLIB)])
+
+  if test x"$hesiod" = xyes; then
+    AC_DEFINE(HAVE_LIBHESIOD, 1,
+              [Define to 1 if you have the hesiod library (-lhesiod).])
+    LIBHESIOD=-lhesiod
+  fi
 fi
+AC_SUBST(LIBHESIOD)
 
 # Do we need libresolv (due to res_init or Hesiod)?
 if test "$resolv" = yes ; then
   AC_DEFINE(HAVE_LIBRESOLV, 1,
             [Define to 1 if you have the resolv library (-lresolv).])
+  LIBRESOLV=-lresolv
+else
+  LIBRESOLV=
 fi
+AC_SUBST(LIBRESOLV)
 
 # These tell us which Kerberos-related libraries to use.
+COM_ERRLIB=
+CRYPTOLIB=
+KRB5LIB=
+DESLIB=
+KRB4LIB=
+
 if test "${with_kerberos}" != no; then
-  AC_CHECK_LIB(com_err, com_err)
-  AC_CHECK_LIB(k5crypto, mit_des_cbc_encrypt)
-  AC_CHECK_LIB(crypto, mit_des_cbc_encrypt)
-  AC_CHECK_LIB(krb5, krb5_init_context)
+  AC_CHECK_LIB(com_err, com_err, have_com_err=yes, have_com_err=no)
+  if test $have_com_err = yes; then
+    COM_ERRLIB=-lcom_err
+    LIBS="$COM_ERRLIB $LIBS"
+    AC_DEFINE(HAVE_LIBCOM_ERR, 1, [Define to 1 if you have the `com_err' library (-lcom_err).])
+  fi
+  AC_CHECK_LIB(crypto, mit_des_cbc_encrypt, have_crypto=yes, have_crypto=no)
+  if test $have_crypto = yes; then
+    CRYPTOLIB=-lcrypto
+    LIBS="$CRYPTOLIB $LIBS"
+    AC_DEFINE(HAVE_LIBCRYPTO, 1, [Define to 1 if you have the `crypto' library (-lcrypto).])
+  fi
+  AC_CHECK_LIB(k5crypto, mit_des_cbc_encrypt, have_k5crypto=yes, have_k5crypto=no)
+  if test $have_k5crypto = yes; then
+    CRYPTOLIB=-lk5crypto
+    LIBS="$CRYPTOLIB $LIBS"
+    AC_DEFINE(HAVE_LIBK5CRYPTO, 1, [Define to 1 if you have the `k5crypto' library (-lk5crypto).])
+  fi
+  AC_CHECK_LIB(krb5, krb5_init_context, have_krb5=yes, have_krb5=no)
+  if test $have_krb5=yes; then
+    KRB5LIB=-lkrb5
+    LIBS="$KRB5LIB $LIBS"
+    AC_DEFINE(HAVE_LIBKRB5, 1, [Define to 1 if you have the `krb5' library (-lkrb5).])
+  fi
+  dnl FIXME Simplify.  Does not match 22 logic, thanks to default_off?
   if test "${with_kerberos5}" = no; then
-    AC_CHECK_LIB(des425, des_cbc_encrypt,,
-                [AC_CHECK_LIB(des, des_cbc_encrypt)])
-    AC_CHECK_LIB(krb4, krb_get_cred,,
-                [AC_CHECK_LIB(krb, krb_get_cred)])
+    AC_CHECK_LIB(des425, des_cbc_encrypt, have_des425=yes, have_des425=no )
+    if test $have_des425 = yes; then
+      DESLIB=-ldes425
+      LIBS="$DESLIB $LIBS"
+      AC_DEFINE(HAVE_LIBDES425, 1, [Define to 1 if you have the `des425' library (-ldes425).])
+    else
+      AC_CHECK_LIB(des, des_cbc_encrypt, have_des=yes, have_des=no)
+      if test $have_des = yes; then
+        DESLIB=-ldes
+        LIBS="$DESLIB $LIBS"
+        AC_DEFINE(HAVE_LIBDES, 1, [Define to 1 if you have the `des' library (-ldes).])
+      fi
+    fi
+    AC_CHECK_LIB(krb4, krb_get_cred, have_krb4=yes, have_krb4=no)
+    if test $have_krb4 = yes; then
+      KRB4LIB=-lkrb4
+      LIBS="$KRB4LIB $LIBS"
+      AC_DEFINE(HAVE_LIBKRB4, 1, [Define to 1 if you have the `krb4' library (-lkrb4).])
+    else
+      AC_CHECK_LIB(krb, krb_get_cred, have_krb=yes, have_krb=no)
+      if test $have_krb = yes; then
+        KRB4LIB=-lkrb
+        LIBS="$KRB4LIB $LIBS"
+        AC_DEFINE(HAVE_LIBKRB, 1, [Define to 1 if you have the `krb' library (-lkrb).])
+      fi
+    fi
   fi
 
   if test "${with_kerberos5}" != no; then
@@ -2433,6 +2911,12 @@ if test "${with_kerberos}" != no; then
   AC_CHECK_HEADERS(com_err.h)
 fi
 
+AC_SUBST(COM_ERRLIB)
+AC_SUBST(CRYPTOLIB)
+AC_SUBST(KRB5LIB)
+AC_SUBST(DESLIB)
+AC_SUBST(KRB4LIB)
+
 # Solaris requires -lintl if you want strerror (which calls dgettext)
 # to return localized messages.
 AC_CHECK_LIB(intl, dgettext)
@@ -2609,19 +3093,20 @@ if test "x$GCC" = xyes \
 fi
 
 #### Find out which version of Emacs this is.
-[version=`grep 'defconst[       ]*emacs-version' ${srcdir}/lisp/version.el \
+[version=`grep 'const char emacs_version' ${srcdir}/src/emacs.c \
         | sed -e 's/^[^"]*"\([^"]*\)".*$/\1/'`]
 if test x"${version}" = x; then
-  AC_MSG_ERROR([can't find current emacs version in `${srcdir}/lisp/version.el'.])
+  AC_MSG_ERROR([can't find current emacs version in `${srcdir}/src/emacs.c'.])
 fi
 if test x"${version}" != x"$PACKAGE_VERSION"; then
-  AC_MSG_WARN([version mismatch between `${srcdir}/configure.in' and `${srcdir}/lisp/version.el'.])
+  AC_MSG_WARN([version mismatch between `${srcdir}/configure.in' and `${srcdir}/src/emacs.c'.])
 fi
 
 ### Specify what sort of things we'll be editing into Makefile and config.h.
 ### Use configuration here uncanonicalized to avoid exceeding size limits.
 AC_SUBST(version)
 AC_SUBST(configuration)
+## Unused?
 AC_SUBST(canonical)
 AC_SUBST(srcdir)
 AC_SUBST(prefix)
@@ -2642,12 +3127,14 @@ AC_SUBST(docdir)
 AC_SUBST(bitmapdir)
 AC_SUBST(gamedir)
 AC_SUBST(gameuser)
-AC_SUBST(c_switch_system)
-AC_SUBST(c_switch_machine)
+## FIXME? Nothing uses @LD_SWITCH_X_SITE@.
+## src/Makefile.in did add LD_SWITCH_X_SITE (as a cpp define) to the
+## end of LIBX_BASE, but nothing ever set it.
 AC_SUBST(LD_SWITCH_X_SITE)
-AC_SUBST(LD_SWITCH_X_SITE_AUX)
 AC_SUBST(C_SWITCH_X_SITE)
+AC_SUBST(C_SWITCH_X_SYSTEM)
 AC_SUBST(CFLAGS)
+## Used in lwlib/Makefile.in.
 AC_SUBST(X_TOOLKIT_TYPE)
 AC_SUBST(machfile)
 AC_SUBST(opsysfile)
@@ -2656,11 +3143,7 @@ AC_SUBST(ns_appdir)
 AC_SUBST(ns_appbindir)
 AC_SUBST(ns_appresdir)
 AC_SUBST(ns_appsrc)
-AC_SUBST(GNUSTEP_MAKEFILES)
-AC_SUBST(GNUSTEP_SYSTEM_HEADERS)
-AC_SUBST(GNUSTEP_SYSTEM_LIBRARIES)
 AC_SUBST(GNU_OBJC_CFLAGS)
-AC_SUBST(LIB_SRC_EXTRA_INSTALLABLES)
 AC_SUBST(OTHER_FILES)
 
 AC_DEFINE_UNQUOTED(EMACS_CONFIGURATION,  "${canonical}",
@@ -2671,56 +3154,304 @@ AC_DEFINE_UNQUOTED(config_machfile,  "${machfile}",
                   [Define to the used machine dependent file.])
 AC_DEFINE_UNQUOTED(config_opsysfile, "${opsysfile}",
                   [Define to the used os dependent file.])
-AC_DEFINE_UNQUOTED(LD_SWITCH_X_SITE, ${LD_SWITCH_X_SITE},
-[Define LD_SWITCH_X_SITE to contain any special flags your loader
- may need to deal with X Windows.  For instance, if you've defined
- HAVE_X_WINDOWS above and your X libraries aren't in a place that
- your loader can find on its own, you might want to add "-L/..." or
- something similar.])
-AC_DEFINE_UNQUOTED(LD_SWITCH_X_SITE_AUX, ${LD_SWITCH_X_SITE_AUX},
-                  [Define LD_SWITCH_X_SITE_AUX with an -R option
-                   in case it's needed (for Solaris, for example).])
-AC_DEFINE_UNQUOTED(C_SWITCH_X_SITE,  ${C_SWITCH_X_SITE},
-[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 above 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.])
-AC_DEFINE_UNQUOTED(UNEXEC_SRC,       ${UNEXEC_SRC},
-                  [Define to the unexec source file name.])
 
+XMENU_OBJ=
+XOBJ=
+FONT_OBJ=
 if test "${HAVE_X_WINDOWS}" = "yes" ; then
   AC_DEFINE(HAVE_X_WINDOWS, 1,
            [Define to 1 if you want to use the X window system.])
+  XMENU_OBJ=xmenu.o
+  XOBJ="xterm.o xfns.o xselect.o xrdb.o fontset.o xsmfns.o fringe.o image.o xsettings.o xgselect.o"
+  FONT_OBJ=xfont.o
+  if test "$HAVE_XFT" = "yes"; then
+    FONT_OBJ="$FONT_OBJ ftfont.o xftfont.o ftxfont.o"
+  elif test "$HAVE_FREETYPE" = "yes"; then
+    FONT_OBJ="$FONT_OBJ ftfont.o ftxfont.o"
+  fi
+  AC_SUBST(FONT_OBJ)
 fi
+AC_SUBST(XMENU_OBJ)
+AC_SUBST(XOBJ)
+AC_SUBST(FONT_OBJ)
+
+WIDGET_OBJ=
+MOTIF_LIBW=
 if test "${USE_X_TOOLKIT}" != "none" ; then
+  WIDGET_OBJ=widget.o
   AC_DEFINE(USE_X_TOOLKIT, 1, [Define to 1 if using an X toolkit.])
   if test "${USE_X_TOOLKIT}" = "LUCID"; then
     AC_DEFINE(USE_LUCID, 1, [Define to 1 if using the Lucid X toolkit.])
   elif test "${USE_X_TOOLKIT}" = "MOTIF"; then
     AC_DEFINE(USE_MOTIF, 1, [Define to 1 if using the Motif X toolkit.])
+    MOTIF_LIBW=-lXm
+    case "$opsys" in
+      gnu-linux)
+        ## Paul Abrahams <abrahams at equinox.shaysnet.com> says this is needed.
+        MOTIF_LIBW="$MOTIF_LIBW -lXpm"
+        ;;
+
+      unixware)
+        ## Richard Anthony Ryan <ryanr at ellingtn.ftc.nrcs.usda.gov>
+        ## says -lXimp is needed in UNIX_SV ... 4.2 1.1.2.
+        MOTIF_LIBW="MOTIF_LIBW -lXimp"
+        ;;
+
+      aix4-2)
+        ## olson@mcs.anl.gov says -li18n is needed by -lXm.
+        MOTIF_LIBW="$MOTIF_LIBW -li18n"
+        ;;
+    esac
+    MOTIF_LIBW="$MOTIF_LIBW $LIBXP"
   fi
 fi
+AC_SUBST(WIDGET_OBJ)
+
+TOOLKIT_LIBW=
+case "$USE_X_TOOLKIT" in
+  MOTIF) TOOLKIT_LIBW="$MOTIF_LIBW" ;;
+  LUCID) TOOLKIT_LIBW="$LUCID_LIBW" ;;
+  none) test "x$HAVE_GTK" = "xyes" && TOOLKIT_LIBW="$GTK_LIBS" ;;
+esac
+AC_SUBST(TOOLKIT_LIBW)
+
+if test "$USE_X_TOOLKIT" = "none"; then
+  LIBXT_OTHER="\$(LIBXSM)"
+  OLDXMENU_TARGET="really-oldXMenu"
+else
+  LIBXT_OTHER="\$(LIBXMU) -lXt \$(LIBXTR6) -lXext"
+  OLDXMENU_TARGET="really-lwlib"
+fi
+AC_SUBST(LIBXT_OTHER)
+
+## The X Menu stuff is present in the X10 distribution, but missing
+## from X11.  If we have X10, just use the installed library;
+## otherwise, use our own copy.
 if test "${HAVE_X11}" = "yes" ; then
   AC_DEFINE(HAVE_X11, 1,
            [Define to 1 if you want to use version 11 of X windows.
             Otherwise, Emacs expects to use version 10.])
+
+  if test "$USE_X_TOOLKIT" = "none"; then
+    OLDXMENU="\${oldXMenudir}libXMenu11.a"
+  else
+    OLDXMENU="\${lwlibdir}liblw.a"
+  fi
+  LIBXMENU="\$(OLDXMENU)"
+  LIBX_OTHER="\$(LIBXT) \$(LIBX_EXTRA)"
+  OLDXMENU_DEPS="\${OLDXMENU} ../src/\${OLDXMENU}"
+else
+  ## For a syntactically valid Makefile; not actually used for anything.
+  ## See comments in src/Makefile.in.
+  OLDXMENU=nothing
+  ## FIXME This case (!HAVE_X11 && HAVE_X_WINDOWS) is no longer possible(?).
+  if test "${HAVE_X_WINDOWS}" = "yes"; then
+    LIBXMENU="-lXMenu"
+  else
+    LIBXMENU=
+  fi
+  LIBX_OTHER=
+  OLDXMENU_DEPS=
+fi
+
+if test "$HAVE_GTK" = "yes" || test "$HAVE_MENUS" != "yes"; then
+  OLDXMENU_TARGET=
+  OLDXMENU=nothing  
+  LIBXMENU=
+  OLDXMENU_DEPS=
 fi
+
+AC_SUBST(OLDXMENU_TARGET)
+AC_SUBST(OLDXMENU)
+AC_SUBST(LIBXMENU)
+AC_SUBST(LIBX_OTHER)
+AC_SUBST(OLDXMENU_DEPS)
+
 if test "${HAVE_MENUS}" = "yes" ; then
   AC_DEFINE(HAVE_MENUS, 1,
            [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.])
 fi
+
 if test "${GNU_MALLOC}" = "yes" ; then
   AC_DEFINE(GNU_MALLOC, 1,
            [Define to 1 if you want to use the GNU memory allocator.])
 fi
+
+RALLOC_OBJ=
 if test "${REL_ALLOC}" = "yes" ; then
   AC_DEFINE(REL_ALLOC, 1,
            [Define REL_ALLOC if you want to use the relocating allocator for
             buffer space.])
+
+  test "$system_malloc" != "yes" && RALLOC_OBJ=ralloc.o
 fi
+AC_SUBST(RALLOC_OBJ)
+
+if test "$opsys" = "cygwin"; then
+  CYGWIN_OBJ="sheap.o"
+  ## Cygwin differs because of its unexec().
+  PRE_ALLOC_OBJ=
+  POST_ALLOC_OBJ=lastfile.o
+else
+  CYGWIN_OBJ=
+  PRE_ALLOC_OBJ=lastfile.o
+  POST_ALLOC_OBJ=
+fi
+AC_SUBST(CYGWIN_OBJ)
+AC_SUBST(PRE_ALLOC_OBJ)
+AC_SUBST(POST_ALLOC_OBJ)
+
+
+case "$opsys" in
+  aix4-2) LD_SWITCH_SYSTEM_TEMACS="-Wl,-bnodelcsect" ;;
+
+  darwin)
+   ## The -headerpad option tells ld (see man page) to leave room at the
+   ## end of the header for adding load commands.  Needed for dumping.
+   ## 0x690 is the total size of 30 segment load commands (at 56
+   ## each); under Cocoa 31 commands are required.
+   if test "$HAVE_NS" = "yes"; then
+     libs_nsgui="-framework AppKit"
+     headerpad_extra=6C8
+   else
+     libs_nsgui=
+     headerpad_extra=690
+   fi
+   LD_SWITCH_SYSTEM_TEMACS="-prebind $libs_nsgui -Xlinker -headerpad -Xlinker $headerpad_extra"
+   ## This is here because src/Makefile.in did some extra fiddling around
+   ## with LD_SWITCH_SYSTEM.  The cpp logic was:
+   ##   #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).
+   ## 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,
+   ## rather than LD_SWITCH_SYSTEM.
+   test "x$LD_SWITCH_SYSTEM" = "x" && test "x$GCC" != "xyes" && \
+     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
+  ## 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-linux) LD_SWITCH_SYSTEM_TEMACS="\$(LD_SWITCH_X_SITE_AUX)" ;;
+
+  *) LD_SWITCH_SYSTEM_TEMACS= ;;
+esac
+
+if test "$NS_IMPL_GNUSTEP" = "yes"; then
+  LD_SWITCH_SYSTEM_TEMACS="${LD_SWITCH_SYSTEM_TEMACS} -L${GNUSTEP_SYSTEM_LIBRARIES} ${GNUSTEP_LOCAL_LIBRARIES} -lgnustep-gui -lgnustep-base -lobjc -lpthread"
+fi
+
+AC_SUBST(LD_SWITCH_SYSTEM_TEMACS)
+
+
+LINKER=
+ORDINARY_LINK=
+case "$opsys" in
+  ## gnu: GNU needs its own crt0.
+  aix4-2|cygwin|darwin|gnu|hpux*|irix6-5|sol2*|unixware) ORDINARY_LINK=yes ;;
+
+  ## On post 1.3 releases of NetBSD, gcc -nostdlib also clears the
+  ## library search parth, i.e. it won't search /usr/lib for libc and
+  ## friends.  Using -nostartfiles instead avoids this problem, and
+  ## will also work on earlier NetBSD releases.
+  netbsd|openbsd) LINKER="\$(CC) -nostartfiles" ;;
+
+  ## macpcc: NAKAJI Hiroyuki <nakaji@tutrp.tut.ac.jp> says
+  ##   MkLinux/LinuxPPC needs this.
+  ## ibms390x only supports opsys = gnu-linux so it can be added here.
+  gnu-*)
+    case "$machine" in
+      macppc|ibms390x) LINKER="\$(CC) -nostdlib" ;;
+    esac
+    ;;
+esac
+
+
+if test "x$ORDINARY_LINK" = "xyes"; then
+
+  LINKER="\$(CC)"
+  AC_DEFINE(ORDINARY_LINK, 1, [Define if the C compiler is the linker.])
+
+## The system files defining neither ORDINARY_LINK nor LINKER are:
+## freebsd, gnu-* not on macppc|ibms390x.
+elif test "x$GCC" = "xyes" && test "x$LINKER" = "x"; then
+
+  ## Versions of GCC >= 2.0 put their library, libgcc.a, in obscure
+  ## places that are difficult to figure out at make time.  Fortunately,
+  ## these same versions allow you to pass arbitrary flags on to the
+  ## linker, so there is no reason not to use it as a linker.
+  ##
+  ## Well, it is not quite perfect.  The "-nostdlib" keeps GCC from
+  ## searching for libraries in its internal directories, so we have to
+  ## ask GCC explicitly where to find libgcc.a (LIB_GCC below).
+  LINKER="\$(CC) -nostdlib"
+fi
+
+test "x$LINKER" = "x" && LINKER=ld
+## FIXME? What setting of EDIT_LDFLAGS should this have?
+test "$NS_IMPL_GNUSTEP" = "yes" && LINKER="\$(CC) -rdynamic"
+
+AC_SUBST(LINKER)
+
+
+## FIXME? The logic here is not precisely the same as that above.
+## There is no check here for a pre-defined LINKER.
+## Should we only be setting LIB_GCC if LD ~ -nostdlib?
+LIB_GCC=
+if test "x$GCC" = "xyes" && test "x$ORDINARY_LINK" != "xyes"; then
+
+  case "$opsys" in
+    freebsd|netbsd|openbsd) LIB_GCC= ;;
+
+    gnu-*)
+      ## armin76@gentoo.org reported that the lgcc_s flag is necessary to
+      ## build on ARM EABI under GNU/Linux.  (Bug#5518)
+      ## Note that m/arm.h never bothered to undefine LIB_GCC first.
+      if test "$machine" = "arm"; then
+        LIB_GCC="-lgcc_s"
+      else
+        ## FIXME? s/gnu-linux.h used to define LIB_GCC as below, then
+        ## immediately undefine it again and redefine it to empty.
+        ## Was the C_SWITCH_X_SITE part really necessary?
+##      LIB_GCC=`$CC $C_SWITCH_X_SITE -print-libgcc-file-name`
+        LIB_GCC=
+      fi
+      ;;
+
+    ## Ask GCC where to find libgcc.a.
+    *) LIB_GCC=`$CC -print-libgcc-file-name 2> /dev/null` ;;
+  esac
+fi                              dnl if $GCC
+AC_SUBST(LIB_GCC)
+
+
+TOOLTIP_SUPPORT=
+WINDOW_SUPPORT=
+## If we're using X11/GNUstep, define some consequences.
+if test "$HAVE_X_WINDOWS" = "yes" || test "$HAVE_NS" = "yes"; then
+  AC_DEFINE(HAVE_WINDOW_SYSTEM, 1, [Define if you have a window system.])
+  AC_DEFINE(HAVE_MOUSE, 1, [Define if you have mouse support.])
+  MOUSE_SUPPORT="\$(REAL_MOUSE_SUPPORT)"
+  TOOLTIP_SUPPORT="\${lispsource}mouse.elc"
+
+  WINDOW_SUPPORT="\$(BASE_WINDOW_SUPPORT)"
+  test "$HAVE_X_WINDOWS" = "yes" && \
+    WINDOW_SUPPORT="$WINDOW_SUPPORT \$(X_WINDOW_SUPPORT)"
+
+fi
+AC_SUBST(MOUSE_SUPPORT)
+AC_SUBST(TOOLTIP_SUPPORT)
+AC_SUBST(WINDOW_SUPPORT)
 
 
 AH_TOP([/* GNU Emacs site configuration template file.
@@ -2751,37 +3482,12 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 ])dnl
 
 AH_BOTTOM([
-/* If we're using X11/Carbon/GNUstep, define some consequences.  */
-#if defined(HAVE_X_WINDOWS) || defined(HAVE_NS)
-#define HAVE_WINDOW_SYSTEM
-#define HAVE_MOUSE
-#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.  */
 #define AMPERSAND_FULL_NAME
 
-/* Define HAVE_SOUND if we have sound support.  We know it works
-   and compiles only on the specified platforms.   For others,
-   it probably doesn't make sense to try.  */
-
-#if defined __FreeBSD__ || defined __NetBSD__ || defined __linux__
-#ifdef HAVE_MACHINE_SOUNDCARD_H
-#define HAVE_SOUND 1
-#endif
-#ifdef HAVE_SYS_SOUNDCARD_H
-#define HAVE_SOUND 1
-#endif
-#ifdef HAVE_SOUNDCARD_H
-#define HAVE_SOUND 1
-#endif
-#ifdef HAVE_ALSA
-#define HAVE_SOUND 1
-#endif
-#endif /* __FreeBSD__ || __NetBSD__ || __linux__  */
-
-/* If using GNU, then support inline function declarations. */
+/* If using GNU, then support inline function declarations.  */
 /* Don't try to switch on inline handling as detected by AC_C_INLINE
    generally, because even if non-gcc compilers accept `inline', they
    may reject `extern inline'.  */
@@ -2806,12 +3512,9 @@ AH_BOTTOM([
 /* Set up some defines, C and LD flags for NeXTstep interface on GNUstep.
   (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. */
+   parallel this exactly since GNUstep is multi-OS.  */
 #ifdef HAVE_NS
 # ifdef NS_IMPL_GNUSTEP
-/* See also .m.o rule in Makefile.in */
-/* FIXME: are all these flags really needed?  Document here why.  */
-#  define C_SWITCH_X_SYSTEM -D_REENTRANT -fPIC -fno-strict-aliasing
 /* GNUstep needs a bit more pure memory.  Of the existing knobs,
 SYSTEM_PURESIZE_EXTRA seems like the least likely to cause problems.  */
 #  define SYSTEM_PURESIZE_EXTRA 30000
@@ -2843,24 +3546,6 @@ SYSTEM_PURESIZE_EXTRA seems like the least likely to cause problems.  */
 
 #define my_strftime nstrftime  /* for strftime.c */
 
-/* The rest of the code currently tests the CPP symbol BSTRING.
-   Override any claims made by the system-description files.
-   Note that on some SCO version it is possible to have bcopy and not bcmp.  */
-#undef BSTRING
-#if defined (HAVE_BCOPY) && defined (HAVE_BCMP)
-#define BSTRING
-#endif
-
-/* 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.
-
-   This declaration shouldn't appear when alloca.s or Makefile.in
-   includes config.h.  */
-#ifndef NOT_C_CODE
-extern char *getenv ();
-#endif
-
 /* These default definitions are good for almost all machines.
    The exceptions override them in m/MACHINE.h.  */
 
@@ -2887,56 +3572,42 @@ extern char *getenv ();
 #endif
 #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.  */
+/* 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
-/* For mktime.c:  */
-#ifndef __P
-# if defined PROTOTYPES
-#  define __P(args) args
-# else
-#  define __P(args) ()
-# endif  /* GCC.  */
-#endif /* __P */
-
-/* Don't include "string.h" or <stdlib.h> in non-C code.  */
-#ifndef NOT_C_CODE
+
 #ifdef HAVE_STRING_H
-#include "string.h"
-#endif
-#ifdef HAVE_STRINGS_H
-#include "strings.h"  /* May be needed for bcopy & al. */
+#include <string.h>
 #endif
+
 #ifdef HAVE_STDLIB_H
 #include <stdlib.h>
 #endif
-#ifndef __GNUC__
-# ifdef HAVE_ALLOCA_H
-#  include <alloca.h>
-# else /* AIX files deal with #pragma.  */
-#  ifndef alloca /* predefined by HP cc +Olibcalls */
-char *alloca ();
-#  endif
-# endif /* HAVE_ALLOCA_H */
-#endif /* __GNUC__ */
+
+#ifdef HAVE_ALLOCA_H
+# include <alloca.h>
+#elif defined __GNUC__
+# define alloca __builtin_alloca
+#elif defined _AIX
+# define alloca __alloca
+#else
+# include <stddef.h>
+# ifdef  __cplusplus
+extern "C"
+# endif
+void *alloca (size_t);
+#endif
+
 #ifndef HAVE_SIZE_T
 typedef unsigned size_t;
 #endif
-#endif /* NOT_C_CODE */
-
-/* Define HAVE_X_I18N if we have usable i18n support.  */
 
-#ifdef HAVE_X11R6
-#define HAVE_X_I18N
-#elif !defined X11R5_INHIBIT_I18N
-#define HAVE_X_I18N
+#ifndef HAVE_STRCHR
+#define strchr(a, b) index (a, b)
 #endif
 
-/* Define HAVE_X11R6_XIM if we have usable X11R6-style XIM support.  */
-
-#if defined HAVE_X11R6 && !defined INHIBIT_X11R6_XIM
-#define HAVE_X11R6_XIM
+#ifndef HAVE_STRRCHR
+#define strrchr(a, b) rindex (a, b)
 #endif
 
 #if defined __GNUC__ && (__GNUC__ > 2 \
@@ -2950,11 +3621,7 @@ typedef unsigned size_t;
    that the stack is continuous.  */
 #ifdef __GNUC__
 #  ifndef GC_SETJMP_WORKS
-  /* GC_SETJMP_WORKS is nearly always appropriate for GCC --
-     see NON_SAVING_SETJMP in the target descriptions.  */
-  /* Exceptions (see NON_SAVING_SETJMP in target description) are
-     SCO5 non-ELF (but Emacs specifies ELF) and SVR3 on x86.
-     Fixme: Deal with SVR3.  */
+  /* GC_SETJMP_WORKS is nearly always appropriate for GCC.  */
 #    define GC_SETJMP_WORKS 1
 #  endif
 #  ifndef GC_LISP_OBJECT_ALIGNMENT
@@ -2962,16 +3629,6 @@ typedef unsigned size_t;
 #  endif
 #endif
 
-#ifndef HAVE_BCOPY
-#define bcopy(a,b,s) memcpy (b,a,s)
-#endif
-#ifndef HAVE_BZERO
-#define bzero(a,s) memset (a,0,s)
-#endif
-#ifndef HAVE_BCMP
-#define BCMP memcmp
-#endif
-
 #endif /* EMACS_CONFIG_H */
 
 /*
@@ -3017,12 +3674,14 @@ echo "  Does Emacs use -lXaw3d?                                 ${HAVE_XAW3D}"
 echo "  Does Emacs use -lXpm?                                   ${HAVE_XPM}"
 echo "  Does Emacs use -ljpeg?                                  ${HAVE_JPEG}"
 echo "  Does Emacs use -ltiff?                                  ${HAVE_TIFF}"
-echo "  Does Emacs use a gif library?                           ${HAVE_GIF} $ac_gif_lib_name"
+echo "  Does Emacs use a gif library?                           ${HAVE_GIF} $LIBGIF"
 echo "  Does Emacs use -lpng?                                   ${HAVE_PNG}"
 echo "  Does Emacs use -lrsvg-2?                                ${HAVE_RSVG}"
+echo "  Does Emacs use imagemagick?                             ${HAVE_IMAGEMAGICK}"
 echo "  Does Emacs use -lgpm?                                   ${HAVE_GPM}"
 echo "  Does Emacs use -ldbus?                                  ${HAVE_DBUS}"
 echo "  Does Emacs use -lgconf?                                 ${HAVE_GCONF}"
+echo "  Does Emacs use -lselinux?                               ${HAVE_LIBSELINUX}"
 
 echo "  Does Emacs use -lfreetype?                              ${HAVE_FREETYPE}"
 echo "  Does Emacs use -lm17n-flt?                              ${HAVE_M17N_FLT}"
@@ -3066,29 +3725,17 @@ fi
 test "${exec_prefix}" != NONE &&
   exec_prefix=`echo "${exec_prefix}" | sed 's,\([^/]\)/*$,\1,'`]
 
-# Now get this: Some word that is part of the ${srcdir} directory name
-# or the ${configuration} value might, just might, happen to be an
-# identifier like `sun4' or `i386' or something, and be predefined by
-# the C preprocessor to some helpful value like 1, or maybe the empty
-# string.  Needless to say consequent macro substitutions are less
-# than conducive to the makefile finding the correct directory.
-[cpp_undefs="`echo $srcdir $configuration $canonical unix |
-  sed -e 's/[^a-zA-Z0-9_]/ /g' -e 's/^/ /' -e 's/  *$//' \
-  -e 's/  */ -U/g' -e 's/-U[0-9][^ ]*//g'`"]
-
-## Check if the C preprocessor will convert `..' to `. .'.  If so, set
-## CPP_NEED_TRADITIONAL to `yes' so that the code to generate Makefile
-## from Makefile.c can correctly provide the arg `-traditional' to the
-## C preprocessor.
-
-AC_EGREP_CPP(yes..yes,
-       [yes..yes],
-       CPP_NEED_TRADITIONAL=no,
-       CPP_NEED_TRADITIONAL=yes)
-
-AC_OUTPUT(Makefile lib-src/Makefile.c:lib-src/Makefile.in oldXMenu/Makefile \
+dnl You might wonder (I did) why epaths.h is generated by running make,
+dnl rather than just letting configure generate it from epaths.in.
+dnl One reason is that the various paths are not fully expanded (see above);
+dnl eg gamedir=${prefix}/var/games/emacs.
+dnl Secondly, the GNU Coding standards require that one should be able
+dnl to run `make prefix=/some/where/else' and override the values set
+dnl by configure.  This also explains the `move-if-change' test and
+dnl the use of force in the `epaths-force' rule in Makefile.in.
+AC_OUTPUT(Makefile lib-src/Makefile oldXMenu/Makefile \
        doc/emacs/Makefile doc/misc/Makefile doc/lispintro/Makefile \
-       doc/lispref/Makefile src/Makefile.c:src/Makefile.in \
+       doc/lispref/Makefile src/Makefile \
        lwlib/Makefile lisp/Makefile leim/Makefile, [
 
 ### Make the necessary directories, if they don't exist.
@@ -3096,58 +3743,15 @@ for dir in etc lisp ; do
   test -d ${dir} || mkdir ${dir}
 done
 
-# Build src/Makefile from ${srcdir}/src/Makefile.c
-# and lib-src/Makefile from ${srcdir}/lib-src/Makefile.c
-# This must be done after src/config.h is built, since we rely on that file.
-
 echo creating src/epaths.h
 ${MAKE-make} epaths-force
 
-# As of 2000-11-19, newest development versions of GNU cpp preprocess
-# `..' to `. .'  unless invoked with -traditional
-
-if test "x$GCC" = xyes && test "x$CPP_NEED_TRADITIONAL" = xyes; then
-  CPPFLAGS="$CPPFLAGS -traditional"
-fi
-
-echo creating lib-src/Makefile
-( cd lib-src
-  rm -f junk.c junk1.c junk2.c
-  sed -e '/start of cpp stuff/q' \
-      < Makefile.c > junk1.c
-  sed -e '1,/start of cpp stuff/d'\
-      -e 's,/\*\*/#\(.*\)$,/* \1 */,' \
-      < Makefile.c > junk.c
-  $CPP -P $cpp_undefs -I. -I$srcdir/src $CPPFLAGS junk.c | \
-      sed -e 's/^ /    /' -e '/^#/d' -e '/^[   \f]*$/d' > junk2.c
-  cat junk1.c junk2.c > Makefile.new
-  rm -f junk.c junk1.c junk2.c
-  chmod 444 Makefile.new
-  mv -f Makefile.new Makefile
-)
-
-echo creating src/Makefile
-( cd src
-  rm -f junk.c junk1.c junk2.c
-  sed -e '/start of cpp stuff/q' \
-      < Makefile.c > junk1.c
-  sed -e '1,/start of cpp stuff/d'\
-      -e 's,/\*\*/#\(.*\)$,/* \1 */,' \
-      < Makefile.c > junk.c
-  $CPP -P $cpp_undefs -I. -I$srcdir/src $CPPFLAGS junk.c | \
-      sed -e 's/^ /    /' -e '/^#/d' -e '/^[   \f]*$/d' > junk2.c
-  cat junk1.c junk2.c > Makefile.new
-  rm -f junk.c junk1.c junk2.c
-  chmod 444 Makefile.new
-  mv -f Makefile.new Makefile
-)
-
 if test ! -f src/.gdbinit && test -f $srcdir/src/.gdbinit; then
   echo creating src/.gdbinit
   echo source $srcdir/src/.gdbinit > src/.gdbinit
 fi
 
-], [GCC="$GCC" NON_GNU_CPP="$NON_GNU_CPP" CPP="$CPP" CPP_NEED_TRADITIONAL="$CPP_NEED_TRADITIONAL" CPPFLAGS="$CPPFLAGS" cpp_undefs="$cpp_undefs"])
+], [GCC="$GCC" NON_GNU_CPP="$NON_GNU_CPP" CPP="$CPP" CPPFLAGS="$CPPFLAGS"])
 
 m4_if(dnl      Do not change this comment
    arch-tag: 156a4dd5-bddc-4d18-96ac-f37742cf6a5e
index 63de0aafc0768a0dd259d92a357ffa4ce793643d..55ec7b75cce45a0deaa823bb8ed78044dea3d26d 100644 (file)
@@ -2,6 +2,15 @@
 
        * misc.texi (Amusements): Mention bubbles and animate.
 
+2010-07-31  Eli Zaretskii  <eliz@gnu.org>
+
+       * files.texi (Visiting): Add more index entries for
+       large-file-warning-threshold.
+
+2010-07-29  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * frames.texi (Tool Bars): Add doc for tool-bar-position.
+
 2010-06-23  Glenn Morris  <rgm@gnu.org>
 
        * abbrevs.texi, basic.texi, buffers.texi, building.texi, calendar.texi:
 
        * basic.texi (Inserting Text): Fix typo.
 
-2010-05-07  Chong Yidong  <cyd@stupidchicken.com>
+2010-06-10  Glenn Morris  <rgm@gnu.org>
 
-       * Version 23.2 released.
+       * ack.texi (Acknowledgments):
+       * emacs.texi (Acknowledgments): Update for notifications.el.
 
-2010-05-07  Chong Yidong  <cyd@stupidchicken.com>
+2010-05-31  Daiki Ueno  <ueno@unixuser.org>
+
+       * dired.texi (Operating on Files): Mention encryption commands
+       (Bug#6315).
+
+2010-05-29  Eli Zaretskii  <eliz@gnu.org>
+
+       * basic.texi (Moving Point): Update due to renaming of commands bound
+       to arrows.  Document bidi-aware behavior of C-<right> and C-<left>.
+
+2010-05-18  Eli Zaretskii  <eliz@gnu.org>
+
+       * display.texi (Fringes): Document reversal of fringe arrows for R2L
+       paragraphs.
+       (Line Truncation): Fix wording for bidi display.
+
+       * basic.texi (Moving Point): Document bidi-aware behavior of the arrow
+       keys.
+
+2010-05-08  Chong Yidong  <cyd@stupidchicken.com>
 
        * building.texi (GDB Graphical Interface): Remove misleading comparison
        to an IDE (Bug#6128).
 
-2010-05-03  Štěpán Němec  <stepnem@gmail.com>  (tiny change)
+2010-05-08  Štěpán Němec  <stepnem@gmail.com>  (tiny change)
 
        * programs.texi (Man Page):
        * misc.texi (Invoking emacsclient):
        * mini.texi (Repetition):
        * mark.texi (Setting Mark): Fix typos.
 
-2010-04-25  Chong Yidong  <cyd@stupidchicken.com>
+2010-05-08  Chong Yidong  <cyd@stupidchicken.com>
 
        * misc.texi (Printing): Document htmlfontify-buffer.
 
-2010-04-21  Glenn Morris  <rgm@gnu.org>
+2010-05-08  Glenn Morris  <rgm@gnu.org>
 
        * calendar.texi (Displaying the Diary, Format of Diary File):
        Fix external cross-references for TeX format output.
 
+2010-05-07  Chong Yidong  <cyd@stupidchicken.com>
+
+       * Version 23.2 released.
+
+2010-05-02  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * cmdargs.texi (Initial Options): Mention --chdir.
+
+2010-04-21  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * frames.texi (Tool Bars): Add tool-bar-style.
+
+2010-04-21  Glenn Morris  <rgm@gnu.org>
+
+       * ack.texi, emacs.texi (Acknowledgments): Add SELinux support.
+
 2010-04-18  Chong Yidong  <cyd@stupidchicken.com>
 
        * programs.texi (Semantic): New node.
 
        * misc.texi (Gnus): Use the `C-h i' keybinding for info.
 
-2010-04-16  Glenn Morris  <rgm@gnu.org>
+2010-04-18  Glenn Morris  <rgm@gnu.org>
 
        * emacs.texi (Acknowledgments): Remove duplicate.
 
        * maintaining.texi (VC Directory Commands): Mention stashes and shelves.
 
-2010-04-15  Glenn Morris  <rgm@gnu.org>
+2010-04-18  Glenn Morris  <rgm@gnu.org>
 
        * dired.texi (Misc Dired Features): Mention VC diff and log.
        * maintaining.texi (Old Revisions, VC Change Log):
        * custom.texi (Specifying File Variables, Directory Variables):
        Document new commands for manipulating local variable lists.
 
-2010-04-09  Glenn Morris  <rgm@gnu.org>
+2010-04-18  Glenn Morris  <rgm@gnu.org>
 
        * trouble.texi (Contributing): Add cindex entry.
        Mention etc/CONTRIBUTE.
 
-2010-04-06  Chong Yidong  <cyd@stupidchicken.com>
+2010-04-18  Chong Yidong  <cyd@stupidchicken.com>
 
        * mark.texi (Persistent Mark): Copyedits.  Replace undo example with
        query-replace (Bug#5774).
 
+2010-04-16  Glenn Morris  <rgm@gnu.org>
+
+       * ack.texi, emacs.texi (Acknowledgments): Update for Org changes.
+
+2010-04-11  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * xresources.texi (Lucid Resources): Mention faceName for dialogs.
+
+2010-04-08  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * xresources.texi (Lucid Resources): Mention faceName to set Xft fonts.
+
 2010-03-30  Eli Zaretskii  <eliz@gnu.org>
 
        * mule.texi (Input Methods): Mention "C-x 8 RET" and add a
        * basic.texi (Inserting Text): Add an index entry for "C-x 8 RET".
        Mention completion provided by `ucs-insert'.
 
-2010-03-28  Chong Yidong  <cyd@stupidchicken.com>
+2010-03-30  Chong Yidong  <cyd@stupidchicken.com>
 
        * sending.texi (Sending Mail): Note variables that may need
        customizing.
        (Mail Sending): Expand discussion of send-mail-function.
 
-2010-03-28  Chong Yidong  <cyd@stupidchicken.com>
+2010-03-30  Chong Yidong  <cyd@stupidchicken.com>
 
        Document Message mode as the default mail mode.
 
 
        * custom.texi (Init Examples): Add xref to Mail Header.
 
-       * emacs.texi (Top):  Fix xrefs.
+       * emacs.texi (Top): Fix xrefs.
 
-2010-03-25  Chong Yidong  <cyd@stupidchicken.com>
+2010-03-30  Chong Yidong  <cyd@stupidchicken.com>
 
        * maintaining.texi (VC With A Merging VCS): C-x v v now creates a
        repository if there is none.
        * misc.texi (Navigation): Document doc-view-continuous.
        (Shell Ring): Document new M-r binding.  M-s is no longer bound.
 
+2010-03-30  Juri Linkov  <juri@jurta.org>
+
+       * search.texi (Other Repeating Search): Remove line that `occur'
+       can not handle multiline matches.
+
+2010-03-30  Eli Zaretskii  <eliz@gnu.org>
+
+       * mule.texi (International): Mention support of bidirectional editing.
+       (Bidirectional Editing): New section.
+
+2010-03-28  Nick Roberts  <nickrob@snap.net.nz>
+
+       * emacs.texi (Top): Update node names to those in building.texi.
+
+2010-03-27  Nick Roberts  <nickrob@snap.net.nz>
+
+       doc/emacs/building.texi: Describe restored GDB/MI fuctionality removed by 2009-12-29T07:15:34Z!nickrob@snap.net.nz.
+       doc/emacs/emacs.texi: Update node names for building.texi.
+
 2010-03-24  Glenn Morris  <rgm@gnu.org>
 
        * ack.texi (Acknowledgments):
        * xresources.texi (Table of Resources):
        * mule.texi (Defining Fontsets, Charsets): Update xrefs.
 
+2010-03-10  Chong Yidong  <cyd@stupidchicken.com>
+
+       * Branch for 23.2.
+
 2010-03-06  Chong Yidong  <cyd@stupidchicken.com>
 
        * custom.texi (Init Examples): Add xref to Locals.
 
 2009-06-23  Miles Bader  <miles@gnu.org>
 
-       * display.texi (Scrolling): Document `recenter-redisplay'
+       * display.texi (Scrolling): Document `recenter-redisplay'.
        (Temporary Face Changes): Document `text-scale-set'.
 
 2009-06-21  Chong Yidong  <cyd@stupidchicken.com>
        (Fortran Columns): Mention font-locking.
        (Fortran Abbrev): Word syntax not relevant with new-style abbrev.
 
-2008-08-23  Johan Bockgard  <bojohan@muon>
+2008-08-23  Johan Bockgård  <bojohan@muon>
 
        * basic.texi (Moving Point): Fix <prior>/<next> confusion.
 
 2005-03-05  Juri Linkov  <juri@jurta.org>
 
        * cmdargs.texi (Emacs Invocation): Add cindex
-       "invocation (command line arguments)"
+       "invocation (command line arguments)".
        (Misc X): Add -nbc, --no-blinking-cursor.
 
 2005-03-04  Ulf Jasper  <ulf.jasper@web.de>
index cdcc0980b2e141de8a7af3876ede58967181931a..7277a395ff4751dc753bb6761fd9b8c280381a32 100644 (file)
@@ -226,6 +226,10 @@ for compiled Emacs Lisp code.
 Mathias Dahl wrote @file{image-dired.el}, a package for viewing image
 files as ``thumbnails.''
 
+@item
+Julien Danjou wrote an implementation of ``Desktop Notifications''
+(@file{notifications.el}).
+
 @item
 Vivek Dasmohapatra wrote @file{htmlfontify.el}, to convert a buffer or
 source tree to HTML.
@@ -252,11 +256,11 @@ Jan Dj@"{a}rv added support for the GTK+ toolkit and X drag-and-drop.
 Carsten Dominik wrote Ref@TeX{}, a package for setting up labels and
 cross-references in La@TeX{} documents; and co-wrote IDLWAVE mode
 (q.v.@:).  He was the main author of Org mode, for maintaining notes,
-todo lists, and project planning.  Thomas Baumann, Lennart Borgman,
-Baoqiu Cui, Daniel German, Bastien Guerry, Tassilo Horn, Philip Jackson,
-Tokuya Kameshima, Ross Patterson, Sebastian Rose, Eric Schulte, Andy
-Stewart, David O'Toole, John Wiegley, and Piotr Zielinski also wrote
-various Org mode components.
+todo lists, and project planning.  Thomas Baumann, Jan Böcker, Lennart
+Borgman, Baoqiu Cui, Daniel German, Bastien Guerry, Tassilo Horn, Philip
+Jackson, Tokuya Kameshima, Ross Patterson, Sebastian Rose, Eric Schulte,
+Paul Sexton, Ulf Stegemann, Andy Stewart, David O'Toole, John Wiegley,
+and Piotr Zielinski also wrote various Org mode components.
 
 @item
 Scott Draves wrote @file{tq.el}, help functions for maintaining
@@ -573,6 +577,10 @@ Peter Kleiweg wrote @file{ps-mode.el}, a mode for editing PostScript
 files and running a PostScript interpreter interactively from within
 Emacs.
 
+@item
+Karel Kl@'{@dotless{i}}@v{c} contributed SELinux support, for preserving the
+Security-Enchanced Linux context of files on backup and copy.
+
 @item
 Shuhei Kobayashi wrote @file{hex-util.el}, for operating on hexadecimal
 strings; support for HMAC (Keyed-Hashing for Message Authentication);
index d845d96bd0094aaae29ad096fd30f528372d7453..a4751e7f99dbf8a3d8eac3c99c0e57ccac554476 100644 (file)
@@ -147,6 +147,8 @@ keyboard commands that move point in more sophisticated ways.
 @findex move-end-of-line
 @findex forward-char
 @findex backward-char
+@findex right-char
+@findex left-char
 @findex next-line
 @findex previous-line
 @findex beginning-of-buffer
@@ -162,19 +164,33 @@ Move to the beginning of the line (@code{move-beginning-of-line}).
 @itemx @key{End}
 Move to the end of the line (@code{move-end-of-line}).
 @item C-f
-@itemx @key{right}
 Move forward one character (@code{forward-char}).
+@item @key{right}
+Move one character to the right (@code{right-char}).  This
+moves one character forward in text that is read in the usual
+left-to-right direction, but one character @emph{backward} if the text
+is read right-to-left, as needed for right-to-left scripts such as
+Arabic.  @xref{Bidirectional Editing}.
 @item C-b
-@itemx @key{left}
 Move backward one character (@code{backward-char}).
+@item @key{left}
+Move one character to the left (@code{left-char}).  This
+moves one character backward in left-to-right text and one character
+forward in right-to-left text.
 @item M-f
 @itemx M-@key{right}
-@itemx C-@key{right}
 Move forward one word (@code{forward-word}).
+@item C-@key{right}
+Move one word to the right (@code{right-word}).  This moves one word
+forward in left-to-right text and one word backward in right-to-left
+text.
 @item M-b
 @itemx M-@key{left}
-@itemx C-@key{left}
 Move backward one word (@code{backward-word}).
+@item C-@key{left}
+Move one word to the left (@code{left-word}).  This moves one word
+backward in left-to-right text and one word forward in right-to-left
+text.
 @item C-n
 @itemx @key{down}
 Move down one screen line (@code{next-line}).  This command attempts
index c84282f2aae676653a5f15a4c94a62dd32bcfbf1..dca76407e2320ff034b2c9842447d4b42a0d3839 100644 (file)
@@ -853,18 +853,19 @@ use @kbd{M-x gud-gdb}.  You need to use text command mode to debug
 multiple programs within one Emacs session.
 
 @menu
-* GDB-UI Layout::               Control the number of displayed buffers.
+* GDB User Interface Layout::   Control the number of displayed buffers.
 * Source Buffers::              Use the mouse in the fringe/margin to
                                 control your program.
 * Breakpoints Buffer::          A breakpoint control panel.
+* Threads Buffer::              Displays your threads.
 * Stack Buffer::                Select a frame from the call stack.
-* Other GDB-UI Buffers::        Input/output, locals, registers,
+* Other GDB Buffers::           Input/output, locals, registers,
                                 assembler, threads and memory buffers.
 * Watch Expressions::           Monitor variable values in the speedbar.
-* Reverse Debugging::           Execute and reverse debug your program.
+* Multithreaded Debugging::     Debugging programs with several threads.
 @end menu
 
-@node GDB-UI Layout
+@node GDB User Interface Layout
 @subsubsection GDB User Interface Layout
 @cindex GDB User Interface layout
 
@@ -1014,10 +1015,92 @@ Visit the source line for the current breakpoint
 Visit the source line for the breakpoint you click on.
 @end table
 
+@vindex gdb-show-threads-by-default
 When @code{gdb-many-windows} is non-@code{nil}, the breakpoints buffer
 shares its window with the threads buffer.  To switch from one to the
 other click with @kbd{Mouse-1} on the relevant button in the header
-line.
+line.  If @code{gdb-show-threads-by-default} is non-@code{nil}, the
+threads buffer, rather than the breakpoints buffer, is shown at start
+up.
+
+@node Threads Buffer
+@subsubsection Threads Buffer
+
+@findex gdb-select-thread
+The threads buffer displays a summary of all threads currently in your
+program (@pxref{Threads, Threads, Debugging programs with multiple
+threads, gdb, The GNU debugger}).  Move point to any thread in the list
+and press @key{RET} to select it (@code{gdb-select-thread}) and
+display the associated source in the primary source buffer.
+Alternatively, click @kbd{Mouse-2} on a thread to select it.  Contents
+of all GDB buffers are updated whenever you select a thread.
+
+  You can customize variables under @code{gdb-buffers} group to select
+fields included in threads buffer.
+
+@table @code
+@item gdb-thread-buffer-verbose-names
+@vindex gdb-thread-buffer-verbose-names
+Show long thread names like @samp{Thread 0x4e2ab70 (LWP 1983)} in
+threads buffer.
+
+@item gdb-thread-buffer-arguments
+@vindex gdb-thread-buffer-arguments
+Show arguments of thread top frames in threads buffer.
+
+@item gdb-thread-buffer-locations
+@vindex gdb-thread-buffer-locations
+Show file information or library names in threads buffer.
+
+@item gdb-thread-buffer-addresses
+@vindex gdb-thread-buffer-addresses
+Show addresses for thread frames in threads buffer.
+@end table
+
+  It’s possible to observe information for several threads
+simultaneously (in addition to buffers which show information for
+currently selected thread) using the following keys from the threads
+buffer.
+
+@table @kbd
+@item d
+@kindex d @r{(GDB threads buffer)}
+@findex gdb-display-disassembly-for-thread
+Display disassembly buffer for the thread at current line.
+(@code{gdb-display-disassembly-for-thread})
+
+@item f
+@kindex f @r{(GDB threads buffer)}
+@findex gdb-display-stack-for-thread
+Display stack buffer for the thread at current line.
+(@code{gdb-display-stack-for-thread}).
+
+@item l
+@kindex l @r{(GDB threads buffer)}
+@findex gdb-display-locals-for-thread
+Display locals buffer for the thread at current line.
+(@code{gdb-display-locals-for-thread}).
+
+@item r
+@kindex r @r{(GDB threads buffer)}
+@findex gdb-display-registers-for-thread
+Display registers buffer for the thread at current line.
+(@code{gdb-display-registers-for-thread}).
+@end table
+
+Pressing their upper-case counterparts, @kbd{D}, @kbd{F} ,@kbd{L} and
+@kbd{R} displays the corresponding buffer in a new frame.
+
+  When you create a buffer showing information about some specific
+thread, it becomes bound to that thread and keeps showing actual
+information while you debug your program.  Every GDB buffer contains a
+number of thread it shows information for in its mode name.  Thread
+number is also included in the buffer name of bound buffers to prevent
+buffer names clashing.
+
+Further commands are available in the threads buffer which depend on the
+mode of GDB that is used for controlling execution of your program.
+(@pxref{Multithreaded Debugging, Stopping and Starting Multi-threaded Programs}).
 
 @node Stack Buffer
 @subsubsection Stack Buffer
@@ -1035,7 +1118,7 @@ that stack frame and type @key{RET} (@code{gdb-frames-select}), or click
 selecting a stack frame updates it to display the local variables of the
 new frame.
 
-@node Other GDB-UI Buffers
+@node Other GDB Buffers
 @subsubsection Other Buffers
 
 @table @asis
@@ -1079,21 +1162,6 @@ arrow points to the current instruction, and you can set and remove
 breakpoints as in a source buffer.  Breakpoint icons also appear in
 the fringe or margin.
 
-@item Threads Buffer
-@findex gdb-threads-select
-The threads buffer displays a summary of all threads currently in your
-program (@pxref{Threads, Threads, Debugging programs with multiple
-threads, gdb, The GNU debugger}).  Move point to any thread in the
-list and press @key{RET} to select it (@code{gdb-threads-select}) and
-display the associated source in the primary source buffer.
-Alternatively, click @kbd{Mouse-2} on a thread to select it.  If the
-locals buffer is visible, its contents update to display the variables
-that are local in the new thread.
-
-When there is more than one main thread and the threads buffer is
-present, Emacs displays the selected thread number in the mode line of
-many of the GDB-UI Buffers.
-
 @item Memory Buffer
 The memory buffer lets you examine sections of program memory
 (@pxref{Memory, Memory, Examining memory, gdb, The GNU debugger}).
@@ -1104,9 +1172,9 @@ displays.  Alternatively, use @kbd{S} or @kbd{N} respectively.  Click
 size for these data items.
 @end table
 
-When @code{gdb-many-windows} is non-@code{nil}, the threads buffer
-shares its window with the breakpoints buffer, and the locals buffer
-with the registers buffer.  To switch from one to the other click with
+When @code{gdb-many-windows} is non-@code{nil}, the locals buffer
+shares its window with the registers buffer, just like breakpoints
+and threads buffers. To switch from one to the other click with
 @kbd{Mouse-1} on the relevant button in the header line.
 
 @node Watch Expressions
@@ -1175,26 +1243,96 @@ expressions updates, set @code{gdb-speedbar-auto-raise} to
 non-@code{nil}.  This can be useful if you are debugging with a full
 screen Emacs frame.
 
-@node Reverse Debugging
-@subsubsection Reverse Debugging
-
-  The GDB tool bar shares many buttons with the other GUD debuggers
-for tasks like stepping and printing expressions.  It also has a
-further set of buttons that allow reverse debugging (@pxref{Process
-Record and Replay, , ,gdb, The GNU debugger}).  This is useful when it
-takes a long time to reproduce the conditions where your program fails
-or for transient problems, like race conditions in multi-threaded
-programs, where a failure might otherwise be hard to reproduce.
-
-To use reverse debugging, set a breakpoint slightly before the
-location of interest and run your program to that point.  Enable
-process recording by clicking on the record button.  At this point, a
-new set of buttons appear.  These buttons allow program execution in
-the reverse direction.  Run your program over the code where the
-problem occurs, and then use the new set of buttons to retrace your
-steps, examine values, and analyze the problem.  When analysis is
-complete, turn off process recording by clicking on the record button
-again.
+@node Multithreaded Debugging
+@subsubsection Stopping and Starting Multi-threaded Programs
+@cindex Multithreaded debugging in GDB
+
+@subsubheading All-stop Debugging
+
+In all-stop mode, whenever your program stops, @emph{all} threads of
+execution stop.  Likewise, whenever you restart the program, all
+threads start executing.  @xref{All-Stop Mode, , All-Stop Mode, gdb,
+The GNU debugger}.  You can enable this behaviour in Emacs by setting
+@code{gdb-non-stop-setting} to @code{nil} before starting a debugging
+session.
+
+@subsubheading Non-stop Debugging
+@cindex Non-stop debugging in GDB
+
+For some multi-threaded targets, GDB supports a further mode of
+operation in which you can examine stopped program threads in the
+debugger while other threads continue to execute freely.
+@xref{Non-Stop Mode, , Non-Stop Mode, gdb, The GNU debugger}.
+This is referred to as @dfn{non-stop} mode.
+
+Versions of GDB prior to 7.0 do not support non-stop mode and it does
+not work on all targets.  In such cases, Emacs uses all-stop mode
+regardless of the value of @code{gdb-non-stop-setting}.
+
+@vindex gdb-non-stop-setting
+If the variable @code{gdb-non-stop-setting} is non-@code{nil} (the
+default value), Emacs tries to start GDB in non-stop mode.  Note that
+GDB debugging session needs to be restarted for change of this setting
+to take effect.
+
+@vindex gdb-switch-when-another-stopped
+When a thread stops in non-stop mode, Emacs automatically switches to
+that thread.  It may be undesirable to allow switching of current
+thread when some other stopped thread is already selected.  Set
+@code{gdb-switch-when-another-stopped} to @code{nil} to prevent this.
+
+@vindex gdb-switch-reasons
+Emacs can decide whether or not to switch to the stopped thread
+depending on the reason which caused the stop.  Customize
+@code{gdb-switch-reasons} to select stop reasons which make Emacs
+switch thread.
+
+@vindex gdb-stopped-hooks
+The variable @code{gdb-stopped-hooks} allows you to execute your
+functions whenever some thread stops.
+
+  In non-stop mode, you can switch between different modes for GUD
+execution control commands.
+
+@vindex gdb-gud-control-all-threads
+@table @dfn
+@item Non-stop/A
+
+When @code{gdb-gud-control-all-threads} is @code{t} (the default
+value), interruption and continuation commands apply to all threads,
+so you can halt or continue all your threads with one command using
+@code{gud-stop-subjob} and @code{gud-cont}, respectively.  The
+@samp{Go} button is shown on the toolbar when at least one thread is
+stopped, whereas @samp{Stop} button is shown when at least one thread
+is running.
+
+@item Non-stop/T
+
+When @code{gdb-gud-control-all-threads} is @code{nil}, only the
+current thread is stopped/continued.  @samp{Go} and @samp{Stop}
+buttons on the GUD toolbar are shown depending on the state of current
+thread.
+@end table
+
+You can change the current value of @code{gdb-gud-control-all-threads}
+from the tool bar or from @samp{GUD->GDB-MI} menu.
+
+  Stepping commands always apply to the current thread.
+
+@subsubheading Fine Thread Control
+
+  In non-stop mode, you can interrupt/continue your threads without
+selecting them.  Hitting @kbd{i} in threads buffer interrupts thread
+under point, @kbd{c} continues it, @kbd{s} steps through.  More such
+commands may be added in the future.
+
+Combined with creating bound buffers for any thread, this allows you
+to change and track state of many threads in the same time.
+
+  Note that when you interrupt a thread, it stops with @samp{signal
+received} reason.  If that reason is included in your
+@code{gdb-switch-reasons} (it is by default), Emacs will switch to
+that thread.
 
 @node Executing Lisp
 @section Executing Lisp Expressions
index a139e0eb0f47bfdc20bcb08b8ef94f56e34186c6..ff8e4f84abd8dc8fff74f213e31782d6d9f3bb20 100644 (file)
@@ -193,6 +193,15 @@ Certain options prevent loading of some of these files or substitute
 other files for them.
 
 @table @samp
+@item -chdir @var{directory}
+@opindex -chdir
+@itemx --chdir=@var{directory}
+@opindex --chdir
+@cindex change Emacs directory
+Change to @var{directory} before doing anything else.  This is mainly used
+by session management in X so that Emacs starts in the same directory as it
+stopped.  This makes desktop saving and restoring easier.
+
 @item -t @var{device}
 @opindex -t
 @itemx --terminal=@var{device}
index 8f5b2462c6783c97b4d16da585a3f6a84346125a..c8b4264d4861733f592143cb59c99018c4ad9b8c 100644 (file)
@@ -688,6 +688,34 @@ suitable guess made using the variables @code{lpr-command} and
 Compress the specified files (@code{dired-do-compress}).  If the file
 appears to be a compressed file already, uncompress it instead.
 
+@findex epa-dired-do-decrypt
+@kindex :d @r{(Dired)}
+@cindex decrypting files (in Dired)
+@item :d
+Decrypt the specified files (@code{epa-dired-do-decrypt}).
+@xref{Dired integration,,, epa, EasyPG Assistant User's Manual}.
+
+@findex epa-dired-do-verify
+@kindex :v @r{(Dired)}
+@cindex verifying digital signatures on files (in Dired)
+@item :v
+Verify digital signatures on the specified files (@code{epa-dired-do-verify}).
+@xref{Dired integration,,, epa, EasyPG Assistant User's Manual}.
+
+@findex epa-dired-do-sign
+@kindex :s @r{(Dired)}
+@cindex signing files (in Dired)
+@item :s
+Digitally sign the specified files (@code{epa-dired-do-sign}).
+@xref{Dired integration,,, epa, EasyPG Assistant User's Manual}.
+
+@findex epa-dired-do-encrypt
+@kindex :e @r{(Dired)}
+@cindex encrypting files (in Dired)
+@item :e
+Encrypt the specified files (@code{epa-dired-do-encrypt}).
+@xref{Dired integration,,, epa, EasyPG Assistant User's Manual}.
+
 @findex dired-do-load
 @kindex L @r{(Dired)}
 @cindex loading several files (in Dired)
index 7946a451c5489c6ed98ef9077f3a784f00d507d9..3b5e7b0b95571012684c99a6aed1884b96bb4bd3 100644 (file)
@@ -804,7 +804,10 @@ line, when one line of text is split into multiple lines on the
 screen.  The left fringe shows a curving arrow for each screen line
 except the first, indicating that ``this is not the real beginning.''
 The right fringe shows a curving arrow for each screen line except the
-last, indicating that ``this is not the real end.''
+last, indicating that ``this is not the real end.''  If the line's
+direction is right-to-left (@pxref{Bidirectional Editing}), the
+meaning of the curving arrows in the left and right fringes are
+swapped.
 
   The fringes indicate line truncation with short horizontal arrows
 meaning ``there's more text on this line which is scrolled
@@ -1191,8 +1194,8 @@ can display long lines by @dfn{truncation}.  This means that all the
 characters that do not fit in the width of the screen or window do not
 appear at all.  On graphical displays, a small straight arrow in the
 fringe indicates truncation at either end of the line.  On text-only
-terminals, @samp{$} appears in the first column when there is text
-truncated to the left, and in the last column when there is text
+terminals, @samp{$} appears in the leftmost column when there is text
+truncated to the left, and in the rightmost column when there is text
 truncated to the right.
 
 @vindex truncate-lines
index 7000fbd5c841420d4ec78b017338646735c22a2f..4de9ee4a57a0591aa3133b2330b7b49a369a8732 100644 (file)
@@ -5,7 +5,7 @@
 
 @c The edition number appears in several places in this file
 @set EDITION   Sixteenth
-@set EMACSVER  23.2.50
+@set EMACSVER  24.0.50
 
 @copying
 This is the @value{EDITION} edition of the @cite{GNU Emacs Manual},@*
@@ -747,14 +747,16 @@ Running Debuggers Under Emacs
 
 GDB Graphical Interface
 
-* GDB-UI Layout::       Control the number of displayed buffers.
-* Source Buffers::      Use the mouse in the fringe/margin to
-                          control your program.
-* Breakpoints Buffer::  A breakpoint control panel.
-* Stack Buffer::        Select a frame from the call stack.
-* Other GDB-UI Buffers::Input/output, locals, registers,
-                          assembler, threads and memory buffers.
-* Watch Expressions::   Monitor variable values in the speedbar.
+* GDB User Interface Layout::   Control the number of displayed buffers.
+* Source Buffers::              Use the mouse in the fringe/margin to
+                                control your program.
+* Breakpoints Buffer::          A breakpoint control panel.
+* Threads Buffer::              Displays your threads.
+* Stack Buffer::                Select a frame from the call stack.
+* Other GDB Buffers::           Input/output, locals, registers,
+                                assembler, threads and memory buffers.
+* Watch Expressions::           Monitor variable values in the speedbar.
+* Multithreaded Debugging::     Debugging programs with several threads.
 
 Maintaining Large Programs
 
@@ -1346,45 +1348,46 @@ Abrahamsson, Jay K.@: Adams, Michael Albinus, Nagy Andras, Ralf Angeli,
 Joe Arceneaux, Miles Bader, David Bakhash, Juanma Barranquero, Eli
 Barzilay, Thomas Baumann, Steven L.@: Baur, Jay Belanger, Alexander L.@:
 Belikoff, Boaz Ben-Zvi, Karl Berry, Anna M.@: Bigatti, Ray Blaak, Jim
-Blandy, Johan Bockg@aa{}rd, Lennart Borgman, Per Bothner, Terrence
-Brannon, Frank Bresz, Peter Breton, Emmanuel Briot, Kevin Broadey,
-Vincent Broman, David M.@: Brown, Georges Brun-Cottan, Joe Buehler,
-W@l{}odek Bzyl, Bill Carpenter, Per Cederqvist, Hans Chalupsky, Chong
-Yidong, Chris Chase, Bob Chassell, Andrew Choi, Sacha Chua, James Clark,
-Mike Clarkson, Glynn Clements, Daniel Colascione, Andrew Csillag, Baoqiu
-Cui, Doug Cutting, Mathias Dahl, Satyaki Das, Vivek Dasmohapatra,
-Michael DeCorte, Gary Delp, Matthieu Devin, Eri Ding, Jan Dj@"{a}rv,
-Carsten Dominik, Scott Draves, Benjamin Drieu, Viktor Dukhovni, Dmitry
-Dzhus, John Eaton, Rolf Ebert, Paul Eggert, Stephen Eglen, Torbj@"orn
-Einarsson, Tsugutomo Enami, Hans Henrik Eriksen, Michael Ernst, Ata
-Etemadi, Frederick Farnbach, Oscar Figueiredo, Fred Fish, Karl Fogel,
-Gary Foster, Romain Francoise, Noah Friedman, Andreas Fuchs, Hallvard
-Furuseth, Keith Gabryelski, Peter S.@: Galbraith, Kevin Gallagher, Kevin
-Gallo, Juan Le@'{o}n Lahoz Garc@'{@dotless{i}}a, Howard Gayle, Daniel
-German, Stephen Gildea, Julien Gilles, David Gillespie, Bob Glickstein,
-Deepak Goel, Boris Goldowsky, Michelangelo Grigni, Odd Gripenstam, Kai
-Gro@ss{}johann, Michael Gschwind, Bastien Guerry, Henry Guillaume, Doug
-Gwyn, Ken'ichi Handa, Lars Hansen, Chris Hanson, K. Shane Hartman, John
-Heidemann, Jon K.@: Hellan, Jesper Harder, Magnus Henoch, Markus
-Heritsch, Karl Heuer, Manabu Higashida, Anders Holst, Jeffrey C.@:
-Honig, Tassilo Horn, Kurt Hornik, Tom Houlder, Joakim Hove, Denis Howe,
-Lars Ingebrigtsen, Andrew Innes, Seiichiro Inoue, Philip Jackson, Pavel
-Janik, Paul Jarc, Ulf Jasper, Michael K. Johnson, Kyle Jones, Terry
-Jones, Simon Josefsson, Arne J@o{}rgensen, Tomoji Kagatani, Brewster
-Kahle, Tokuya Kameshima, Lute Kamstra, David Kastrup, David Kaufman,
-Henry Kautz, Taichi Kawabata, Howard Kaye, Michael Kifer, Richard King,
-Peter Kleiweg, Shuhei Kobayashi, Pavel Kobiakov, Larry K.@: Kolodney,
-David M.@: Koppelman, Koseki Yoshinori, Robert Krawitz, Sebastian
-Kremer, Ryszard Kubiak, David K@aa{}gedal, Daniel LaLiberte,
-Karl Landstrom, Mario Lang, Aaron Larson, James R.@: Larus,
-Vinicius Jose Latorre, Werner Lemberg, Frederic Lepied, Peter
-Liljenberg, Lars Lindberg, Chris Lindblad, Anders Lindgren, Thomas Link,
-Juri Linkov, Francis Litterio, Emilio C. Lopes, K@'{a}roly L@H{o}rentey,
-Dave Love, Sascha L@"{u}decke, Eric Ludlam, Alan Mackenzie, Christopher
-J.@: Madsen, Neil M.@: Mager, Ken Manheimer, Bill Mann, Brian Marick,
-Simon Marshall, Bengt Martensson, Charlie Martin, Thomas May, Roland
-McGrath, Will Mengarini, David Megginson, Ben A. Mesander, Wayne Mesard,
-Brad Miller, Lawrence Mitchell, Richard Mlynarik, Gerd Moellmann, Stefan
+Blandy, Johan Bockg@aa{}rd, Jan Böcker, Lennart Borgman, Per Bothner,
+Terrence Brannon, Frank Bresz, Peter Breton, Emmanuel Briot, Kevin
+Broadey, Vincent Broman, David M.@: Brown, Georges Brun-Cottan, Joe
+Buehler, W@l{}odek Bzyl, Bill Carpenter, Per Cederqvist, Hans Chalupsky,
+Chong Yidong, Chris Chase, Bob Chassell, Andrew Choi, Sacha Chua, James
+Clark, Mike Clarkson, Glynn Clements, Daniel Colascione, Andrew Csillag,
+Baoqiu Cui, Doug Cutting, Mathias Dahl, Julien Danjou, Satyaki Das,
+Vivek Dasmohapatra, Michael DeCorte, Gary Delp, Matthieu Devin, Eri
+Ding, Jan Dj@"{a}rv, Carsten Dominik, Scott Draves, Benjamin Drieu,
+Viktor Dukhovni, Dmitry Dzhus, John Eaton, Rolf Ebert, Paul Eggert,
+Stephen Eglen, Torbj@"orn Einarsson, Tsugutomo Enami, Hans Henrik
+Eriksen, Michael Ernst, Ata Etemadi, Frederick Farnbach, Oscar
+Figueiredo, Fred Fish, Karl Fogel, Gary Foster, Romain Francoise, Noah
+Friedman, Andreas Fuchs, Hallvard Furuseth, Keith Gabryelski, Peter S.@:
+Galbraith, Kevin Gallagher, Kevin Gallo, Juan Le@'{o}n Lahoz
+Garc@'{@dotless{i}}a, Howard Gayle, Daniel German, Stephen Gildea,
+Julien Gilles, David Gillespie, Bob Glickstein, Deepak Goel, Boris
+Goldowsky, Michelangelo Grigni, Odd Gripenstam, Kai Gro@ss{}johann,
+Michael Gschwind, Bastien Guerry, Henry Guillaume, Doug Gwyn, Ken'ichi
+Handa, Lars Hansen, Chris Hanson, K. Shane Hartman, John Heidemann, Jon
+K.@: Hellan, Jesper Harder, Magnus Henoch, Markus Heritsch, Karl Heuer,
+Manabu Higashida, Anders Holst, Jeffrey C.@: Honig, Tassilo Horn, Kurt
+Hornik, Tom Houlder, Joakim Hove, Denis Howe, Lars Ingebrigtsen, Andrew
+Innes, Seiichiro Inoue, Philip Jackson, Pavel Janik, Paul Jarc, Ulf
+Jasper, Michael K. Johnson, Kyle Jones, Terry Jones, Simon Josefsson,
+Arne J@o{}rgensen, Tomoji Kagatani, Brewster Kahle, Tokuya Kameshima,
+Lute Kamstra, David Kastrup, David Kaufman, Henry Kautz, Taichi
+Kawabata, Howard Kaye, Michael Kifer, Richard King, Peter Kleiweg, Karel
+Kl@'{@dotless{i}}@v{c}, Shuhei Kobayashi, Pavel Kobiakov, Larry K.@:
+Kolodney, David M.@: Koppelman, Koseki Yoshinori, Robert Krawitz,
+Sebastian Kremer, Ryszard Kubiak, David K@aa{}gedal, Daniel LaLiberte,
+Karl Landstrom, Mario Lang, Aaron Larson, James R.@: Larus, Vinicius
+Jose Latorre, Werner Lemberg, Frederic Lepied, Peter Liljenberg, Lars
+Lindberg, Chris Lindblad, Anders Lindgren, Thomas Link, Juri Linkov,
+Francis Litterio, Emilio C. Lopes, K@'{a}roly L@H{o}rentey, Dave Love,
+Sascha L@"{u}decke, Eric Ludlam, Alan Mackenzie, Christopher J.@:
+Madsen, Neil M.@: Mager, Ken Manheimer, Bill Mann, Brian Marick, Simon
+Marshall, Bengt Martensson, Charlie Martin, Thomas May, Roland McGrath,
+Will Mengarini, David Megginson, Ben A. Mesander, Wayne Mesard, Brad
+Miller, Lawrence Mitchell, Richard Mlynarik, Gerd Moellmann, Stefan
 Monnier, Morioka Tomohiko, Keith Moore, Jan Moringen, Glenn Morris,
 Diane Murray, Sen Nagata, Erik Naggum, Thomas Neumann, Thien-Thi Nguyen,
 Mike Newton, Jurgen Nickelsen, Dan Nicolaescu, Hrvoje Niksic, Jeff
@@ -1403,22 +1406,22 @@ Sato, Jorgen Schaefer, Holger Schauer, William Schelter, Ralph
 Schleicher, Gregor Schmid, Michael Schmidt, Ronald S. Schnell, Philippe
 Schnoebelen, Jan Schormann, Alex Schroeder, Stephen Schoef, Raymond
 Scholz, Eric Schulte, Andreas Schwab, Randal Schwartz, Oliver Seidel,
-Manuel Serrano, Hovav Shacham, Stanislav Shalunov, Marc Shapiro, Richard
-Sharman, Olin Shivers, Espen Skoglund, Rick Sladkey, Lynn Slater, Chris
-Smith, David Smith, Paul D.@: Smith, William Sommerfeld, Andre Spiegel,
-Michael Staats, Reiner Steib, Sam Steingold, Ake Stenhoff,
-Peter Stephenson, Ken Stevens, Andy Stewart, Jonathan
-Stigelman, Martin Stjernholm, Kim F.@: Storm, Steve Strassman, Olaf
-Sylvester, Naoto Takahashi, Steven Tamm, Jean-Philippe Theberge, Jens
-T.@: Berger Thielemann, Spencer Thomas, Jim Thompson, Luc Teirlinck,
-David O'Toole, Tom Tromey, Enami Tsugutomo, Eli Tziperman, Daiki Ueno,
-Masanobu Umeda, Rajesh Vaidheeswarran, Neil W.@: Van Dyke, Didier Verna,
-Joakim Verona, Ulrik Vieth, Geoffrey Voelker, Johan Vromans, Inge
-Wallin, John Paul Wallington, Colin Walters, Barry Warsaw, Morten
-Welinder, Joseph Brian Wells, Rodney Whitby, John Wiegley, Ed Wilkinson,
-Mike Williams, Bill Wohler, Steven A. Wood, Dale R.@: Worley, Francis
-J.@: Wright, Felix S. T. Wu, Tom Wurgler, Katsumi Yamaoka, Yamamoto
-Mitsuharu, Masatake Yamato, Jonathan Yavner, Ryan Yeske, Ilya
+Manuel Serrano, Paul Sexton, Hovav Shacham, Stanislav Shalunov, Marc
+Shapiro, Richard Sharman, Olin Shivers, Espen Skoglund, Rick Sladkey,
+Lynn Slater, Chris Smith, David Smith, Paul D.@: Smith, William
+Sommerfeld, Andre Spiegel, Michael Staats, Ulf Stegemann, Reiner Steib,
+Sam Steingold, Ake Stenhoff, Peter Stephenson, Ken Stevens, Andy Stewart,
+Jonathan Stigelman, Martin Stjernholm, Kim F.@: Storm, Steve Strassman,
+Olaf Sylvester, Naoto Takahashi, Steven Tamm, Jean-Philippe Theberge,
+Jens T.@: Berger Thielemann, Spencer Thomas, Jim Thompson, Luc
+Teirlinck, David O'Toole, Tom Tromey, Enami Tsugutomo, Eli Tziperman,
+Daiki Ueno, Masanobu Umeda, Rajesh Vaidheeswarran, Neil W.@: Van Dyke,
+Didier Verna, Joakim Verona, Ulrik Vieth, Geoffrey Voelker, Johan
+Vromans, Inge Wallin, John Paul Wallington, Colin Walters, Barry Warsaw,
+Morten Welinder, Joseph Brian Wells, Rodney Whitby, John Wiegley, Ed
+Wilkinson, Mike Williams, Bill Wohler, Steven A. Wood, Dale R.@: Worley,
+Francis J.@: Wright, Felix S. T. Wu, Tom Wurgler, Katsumi Yamaoka,
+Yamamoto Mitsuharu, Masatake Yamato, Jonathan Yavner, Ryan Yeske, Ilya
 Zakharevich, Milan Zamazal, Victor Zandy, Eli Zaretskii, Jamie Zawinski,
 Shenghuo Zhu, Piotr Zielinski, Ian T.@: Zimmermann, Reto Zimmermann,
 Neal Ziring, Teodor Zlatanov, and Detlev Zundel.
index 4701c1a7a898bd891da4de19dc48c8cd456aeaba..73c10ac834fbf0f5a2898b5edd4425ffa90d04a7 100644 (file)
@@ -202,6 +202,8 @@ since you visited or saved it last.  If the file has changed, Emacs offers
 to reread it.
 
 @vindex large-file-warning-threshold
+@cindex file, warning when size is large
+@cindex size of file, warning when visiting
 @cindex maximum buffer size exceeded, error message
   If you try to visit a file larger than
 @code{large-file-warning-threshold} (the default is 10000000, which is
index 0383ed9bf2072c4821865d0ba69ccee3b2f0bd36..fb7413e8593e5488ccc6ae169dd64d150aa585c8 100644 (file)
@@ -1263,6 +1263,19 @@ bar uses monochrome icons (PBM or XBM format).
   You can turn display of tool bars on or off with @kbd{M-x
 tool-bar-mode} or by customizing the option @code{tool-bar-mode}.
 
+@vindex tool-bar-style
+@cindex Tool Bar style
+  When Emacs is compiled with GTK+ support, tool bars can have text and images.
+Customize @code{tool-bar-style} to select style.  The default style is
+the same as for the desktop in the Gnome case.  If no default is found,
+the tool bar uses just images.
+
+@cindex Tool Bar position
+  You can also control the placement of the tool bar for the GTK+ tool bar
+with the frame parameter @code{tool-bar-position}.
+For a detailed description of frame parameters and customization,
+see @ref{Frame Parameters,,, elisp, The Emacs Lisp Reference Manual}.
+
 @node Dialog Boxes
 @section Using Dialog Boxes
 @cindex dialog boxes
index 89bf0ebcb04896da3c62c5f60d2904ceadffe449..9fdef17582647b94f647e2582563cb53a712702d 100644 (file)
@@ -66,6 +66,12 @@ displays (@pxref{Terminal Coding}).  If some characters are displayed
 incorrectly, refer to @ref{Undisplayable Characters}, which describes
 possible problems and explains how to solve them.
 
+@item
+Characters from scripts whose natural ordering of text is from right
+to left are reordered for display (@pxref{Bidirectional Editing}).
+These scripts include Arabic, Hebrew, Syriac, Thaana, and a few
+others.
+
 @item
 You can insert non-@acronym{ASCII} characters or search for them.  To do that,
 you can specify an input method (@pxref{Select Input Method}) suitable
@@ -107,6 +113,7 @@ to make sure Emacs interprets keyboard input correctly; see
 * Unibyte Mode::            You can pick one European character set
                               to use without multibyte characters.
 * Charsets::                How Emacs groups its internal character codes.
+* Bidirectional Editing::   Support for right-to-left scripts.
 @end menu
 
 @node International Chars
@@ -1659,6 +1666,84 @@ older Emacs versions.
 point before it and type @kbd{C-u C-x =} (@pxref{International
 Chars}).
 
+@node Bidirectional Editing
+@section Bidirectional Editing
+@cindex bidirectional editing
+@cindex right-to-left text
+
+  Emacs supports editing text written in scripts, such as Arabic and
+Hebrew, whose natural ordering of horizontal text for display is from
+right to left.  However, digits and Latin text embedded in these
+scripts are still displayed left to right.  It is also not uncommon to
+have small portions of text in Arabic or Hebrew embedded in otherwise
+Latin document, e.g., as comments and strings in a program source
+file.  For these reasons, text that uses these scripts is actually
+@dfn{bidirectional}: a mixture of runs of left-to-right and
+right-to-left characters.
+
+  This section describes the facilities and options provided by Emacs
+for editing bidirectional text.
+
+@cindex logical order
+@cindex visual order
+  Emacs stores right-to-left and bidirectional text in the so-called
+@dfn{logical} (or @dfn{reading}) order: the buffer or string position
+of the first character you read precedes that of the next character.
+Reordering of bidirectional text into the @dfn{visual} order happens
+at display time.  As result, character positions no longer increase
+monotonically with their positions on display.  Emacs implements the
+Unicode Bidirectional Algorithm described in the Unicode Standard
+Annex #9, for reordering of bidirectional text for display.
+
+@vindex bidi-display-reordering
+  The buffer-local variable @code{bidi-display-reordering} controls
+whether text in the buffer is reordered for display.  If its value is
+non-@code{nil}, Emacs reorders characters that have right-to-left
+directionality when they are displayed.  The default value is
+@code{nil}.
+
+  Each paragraph of bidirectional text can have its own @dfn{base
+direction}, either right-to-left or left-to-right.  (Paragraph
+boundaries are defined by the regular expressions
+@code{paragraph-start} and @code{paragraph-separate}, see
+@ref{Paragraphs}.)  Text in left-to-right paragraphs begins at the
+left margin of the window and is truncated or continued when it
+reaches the right margin.  By contrast, text in right-to-left
+paragraphs begins at the right margin and is continued or truncated at
+the left margin.
+
+@vindex bidi-paragraph-direction
+  Emacs determines the base direction of each paragraph dynamically,
+based on the text at the beginning of the paragraph.  However,
+sometimes a buffer may need to force a certain base direction for its
+paragraphs.  The variable @code{bidi-paragraph-direction}, if
+non-@code{nil}, disables the dynamic determination of the base
+direction, and instead forces all paragraphs in the buffer to have the
+direction specified by its buffer-local value.  The value can be either
+@code{right-to-left} or @code{left-to-right}.  Any other value is
+interpreted as @code{nil}.
+
+@cindex LRM
+@cindex RLM
+  Alternatively, you can control the base direction of a paragraph by
+inserting special formatting characters in front of the paragraph.
+The special character @code{RIGHT-TO-LEFT MARK}, or @sc{rlm}, forces
+the right-to-left direction on the following paragraph, while
+@code{LEFT-TO-RIGHT MARK}, or @sc{lrm} forces the left-to-right
+direction.  (You can use @kbd{C-x 8 RET} to insert these characters.)
+In a GUI session, the @sc{lrm} and @sc{rlm} characters display as
+blanks.
+
+  Because characters are reordered for display, Emacs commands that
+operate in the logical order or on stretches of buffer positions may
+produce unusual effects.  For example, @kbd{C-f} and @kbd{C-b}
+commands move point in the logical order, so the cursor will sometimes
+jump when point traverses reordered bidirectional text.  Similarly, a
+highlighted region covering a contiguous range of character positions
+may look discontinuous if the region spans reordered text.  This is
+normal and similar to behavior of other programs that support
+bidirectional text.
+
 @ignore
    arch-tag: 310ba60d-31ef-4ce7-91f1-f282dd57b6b3
 @end ignore
index 0916c577ef075997797f2a615e19c916ff75338a..69532e6083dcf3538b4f3883067b2096c8379973 100644 (file)
@@ -1312,8 +1312,7 @@ Prompt for a regexp, and display a list showing each line in the
 buffer that contains a match for it.  To limit the search to part of
 the buffer, narrow to that part (@pxref{Narrowing}).  A numeric
 argument @var{n} specifies that @var{n} lines of context are to be
-displayed before and after each matching line.  Currently,
-@code{occur} can not correctly handle multiline matches.
+displayed before and after each matching line.
 
 @kindex RET @r{(Occur mode)}
 @kindex o @r{(Occur mode)}
index 2965bec3bd2aaa4c608c23f14fe029efaf6dfa24..2a543eeee08b6728cc268feffbbec01a5f75589d 100644 (file)
@@ -399,8 +399,9 @@ Italic flag for face @var{face}---instead of @code{attributeSlant}.
 @end table
 
 @node Lucid Resources
-@appendixsec Lucid Menu X Resources
+@appendixsec Lucid Menu And Dialog X Resources
 @cindex Menu X Resources (Lucid widgets)
+@cindex Dialog X Resources (Lucid widgets)
 @cindex Lucid Widget X Resources
 
 @ifnottex
@@ -415,7 +416,7 @@ Emacs.pane.menubar.@var{resource}:  @var{value}
 @end example
 
 @noindent
-For example, to specify the font @samp{8x16} for the menu-bar items,
+For example, to specify the font @samp{Courier-12} for the menu-bar items,
 write this:
 @end ifnottex
 @iftex
@@ -423,32 +424,37 @@ write this:
 with the Lucid menu widgets, then the menu bar is a separate widget
 and has its own resources.  The resource specifications start with
 @samp{Emacs.pane.menubar}---for instance, to specify the font
-@samp{8x16} for the menu-bar items, write this:
+@samp{Courier-12} for the menu-bar items, write this:
 @end iftex
 
 @example
-Emacs.pane.menubar.font:  8x16
+Emacs.pane.menubar.faceName:  Courier-12
 @end example
 
 @noindent
-Resources for @emph{non-menubar} toolkit pop-up menus have
-@samp{menu*} instead of @samp{pane.menubar}.  For example, to specify
-the font @samp{8x16} for the pop-up menu items, write this:
+To specify a font, use fontconfig font names as values to the @code{faceName}
+resource.
+
+If Emacs is not built with the Xft library, Lucid menus and dialogs
+can only display old style fonts.  If Emacs is built with Xft and you
+prefer the old fonts, you have to specify @samp{none} to
+@code{faceName}:
 
 @example
-Emacs.menu*.font:  8x16
+Emacs.pane.menubar.faceName:    none
+Emacs.pane.dialog.faceName:     none
 @end example
 
 @noindent
-For dialog boxes, use @samp{dialog*}:
+To specify a non-Xft font, use @code{font}.  For example:
 
 @example
-Emacs.dialog*.font:  8x16
+Emacs.pane.menubar.font: lucidasanstypewriter-10
 @end example
 
 @noindent
-The Lucid menus can display multilingual text in your locale.  For
-more information about fontsets see the man page for
+The Lucid menus can display multilingual text in your locale with old style
+fonts.  For more information about fontsets see the man page for
 @code{XCreateFontSet}.  To enable multilingual menu text you specify a
 @code{fontSet} resource instead of the font resource.  If both
 @code{font} and @code{fontSet} resources are specified, the
@@ -461,6 +467,22 @@ for both the popup and menu bar menus, write this:
 Emacs*menu*fontSet:  -*-helvetica-medium-r-*--*-120-*-*-*-*-*-*,*
 @end example
 
+@noindent
+Resources for @emph{non-menubar} toolkit pop-up menus have
+@samp{menu*} instead of @samp{pane.menubar}.  For example, to specify
+the font @samp{8x16} for the pop-up menu items, write this:
+
+@example
+Emacs.menu*.font:       8x16
+@end example
+
+@noindent
+For dialog boxes, use @samp{dialog*}:
+
+@example
+Emacs.dialog*.faceName:        Sans-12
+@end example
+
 @noindent
 The @samp{*menu*} as a wildcard matches @samp{pane.menubar} and
 @samp{menu@dots{}}.
@@ -473,6 +495,8 @@ approach should work on both kinds of systems.
   Here is a list of the specific resources for menu bars and pop-up menus:
 
 @table @code
+@item faceName
+Xft font for menu item text.
 @item font
 Font for menu item text.
 @item fontSet
index 75b4faea971b69373ef51f44e73b54c6efc2a1a1..1ab0689196127cb8740d7c2d6692e26fd16ee64e 100644 (file)
@@ -6,6 +6,10 @@
 
        * Version 23.2 released.
 
+2010-03-10  Chong Yidong  <cyd@stupidchicken.com>
+
+       * Branch for 23.2.
+
 2010-02-16  Glenn Morris  <rgm@gnu.org>
 
        * emacs-lisp-intro.texi: Fix typo in name of `find-tag' command.
@@ -17,8 +21,7 @@
 
 2009-12-09  David Robinow  <drobinow@gmail.com>  (tiny change)
 
-       * makefile.w32-in: Use parenthesis for macros for nmake
-       compatibility.
+       * makefile.w32-in: Use parenthesis for macros for nmake compatibility.
 
 2009-12-03  Glenn Morris  <rgm@gnu.org>
 
@@ -76,7 +79,7 @@
 
 2009-02-22  Karl Berry  <karl@gnu.org>
 
-       * emacs-lisp-intro.texi (Default Configuration): fix dup word "by by".
+       * emacs-lisp-intro.texi (Default Configuration): Fix dup word "by by".
 
 2009-02-20  Juanma Barranquero  <lekktu@gmail.com>
 
        (Simple Extension): Replace longer expression with
        `emacs-major-version'.  Remove comment about `number-to-string'
        function.
-       (Miscellaneous): Add filename option, `-H', to `grep' example
+       (Miscellaneous): Add filename option, `-H', to `grep' example.
        (debug, debug-on-entry): Replace `GNU Emacs 22' with `a recent
        GNU Emacs'.
        (edebug): More properly state where to place point for 'M-x
        (sentence-end): Specify `in English' for glyphs that end a sentence.
        Note that in GNU Emacs 22, the name refers to both a variable and a
        function.
-       (fwd-sentence while loops): Write a function as one, not as a form
+       (fwd-sentence while loops): Write a function as one, not as a form.
        (fwd-para let): Add `which' to sentence with `parstart' and `parsep'.
        (etags): Move sentences involving `find-tag' and sources.  State
        location of Emacs `src' directory.
 2006-08-21  Robert J. Chassell  <bob@rattlesnake.com>
 
        * emacs-lisp-intro.texi: Deleted in directory copy of texinfo.tex
-         and pointed towards ../man/texinfo.tex so only one file
-         needs updating.  Added comment of what to do when building on own.
+       and pointed towards ../man/texinfo.tex so only one file
+       needs updating.  Added comment of what to do when building on own.
 
        * texinfo.tex: Changed to version 2006-02-13.16
-         to enable a DVI build using the more recent versions of TeX.
+       to enable a DVI build using the more recent versions of TeX.
 
 2006-05-25  David Kastrup  <dak@gnu.org>
 
 2003-11-16  Kevin Ryde  <user42@zip.com.au>
 
        * emacs-lisp-intro.texi: [CVS commitment by <bob@rattlesnake.com>]
-       Corrections to cross references,
+       Corrections to cross references.
        (Interactive Options): elisp "interactive" -> "Using Interactive".
        (defvar and asterisk): Remove emacs "Edit Options" reference,
        edit-options is no longer described in the emacs manual.
diff --git a/doc/lispref/.arch-inventory b/doc/lispref/.arch-inventory
deleted file mode 100644 (file)
index 2f5e6b9..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-# Generated files
-precious ^(config\.status|config\.cache)$
-
-# arch-tag: dde817a2-94ff-4c6e-838c-bb5b33e7f0df
index 399c07d13f5c6ee6b38d3602d3ecb950b2b43903..cd99c701ac244b83481c91d4564e351883d006e4 100644 (file)
@@ -1,34 +1,89 @@
+2010-08-28  Eli Zaretskii  <eliz@gnu.org>
+
+       * display.texi (Fringe Size/Pos): Add a cross-reference to "Layout
+       Parameters", where the default fringe width is described.
+
+       * frames.texi (Window Frame Parameters, Basic Parameters)
+       (Position Parameters, Layout Parameters, Management Parameters)
+       (Cursor Parameters, Font and Color Parameters): Add indexing for
+       frame parameters.  (Bug#6929)
+
+2010-08-25  Tom Tromey  <tromey@redhat.com>
+
+       * vol2.texi (Top): Update.
+       * vol1.texi (Top): Update.
+       * tips.texi (Library Headers): Mention Package-Version and
+       Package-Requires.
+       * package.texi: New file.
+       * os.texi (System Interface): Update pointers.
+       * elisp.texi (Top): Link to new nodes.  Include package.texi.
+       * anti.texi (Antinews): Update pointers.
+
+2010-08-25  Eli Zaretskii  <eliz@gnu.org>
+
+       * processes.texi (Filter Functions): Fix last change.
+
+2010-08-24  Markus Triska  <triska@gmx.at>
+
+       * processes.texi (Filter Functions): Use `buffer-live-p' instead
+       of `buffer-name' in the main text as well as in the example
+       (Bug#3098).
+
+2010-08-22  Chong Yidong  <cyd@stupidchicken.com>
+
+       * nonascii.texi (Text Representations):
+       * loading.texi (Loading Non-ASCII):
+       * compile.texi (Byte Compilation): Don't mention obsolete
+       --unibyte command-line argument.
+
 2010-08-22  Chong Yidong  <cyd@stupidchicken.com>
 
        * modes.texi (Defining Minor Modes): Doc fix (Bug#6880).
 
-2010-08-19  Chong Yidong  <cyd@stupidchicken.com>
+2010-08-22  Chong Yidong  <cyd@stupidchicken.com>
 
        * objects.texi (Bool-Vector Type): Minor definition tweak (Bug#6878).
 
-2010-08-02  Christoph  <cschol2112@googlemail.com>
+2010-08-20  Eli Zaretskii  <eliz@gnu.org>
+
+       * commands.texi (Misc Events): Add cross-references to where
+       POSITION of a mouse event is described in detail.
+
+2010-08-08  Christoph  <cschol2112@googlemail.com>
 
        * control.texi (Handling Errors) <error-message-string>: Fix arg name.
 
-2010-07-29  Juanma Barranquero  <lekktu@gmail.com>
+2010-08-08  Juanma Barranquero  <lekktu@gmail.com>
 
        * modes.texi (Defining Minor Modes): Use C-backspace, not C-delete.
        Suggested by Štěpán Němec <stepnem@gmail.com>.
 
-2010-07-28  Juanma Barranquero  <lekktu@gmail.com>
+2010-08-08  Juanma Barranquero  <lekktu@gmail.com>
 
        * minibuf.texi (High-Level Completion): Document args of
        `read-buffer-function' (bug#5625).
 
+2010-07-29  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * frames.texi (Layout Parameters): Add doc for tool-bar-position.
+
+2010-07-29  Michael Albinus  <michael.albinus@gmx.de>
+
+       * processes.texi (Process Information): Explain process property
+       `remote-tty'.
+
 2010-07-27  Juanma Barranquero  <lekktu@gmail.com>
 
        * modes.texi (Defining Minor Modes): Use C-delete in examples,
        instead of "\C-\^?" (bug#6334).
 
-2010-07-21  Juanma Barranquero  <lekktu@gmail.com>
-
        * text.texi (Special Properties): Fix typo.
 
+2010-07-09  Eli Zaretskii  <eliz@gnu.org>
+
+       * internals.texi (Writing Emacs Primitives): Adapt to ANSI C
+       calling sequences, which are now the standard.
+
 2010-06-24  Chong Yidong  <cyd@stupidchicken.com>
 
        * text.texi (Undo): Clarify command loop behavior (Bug#2433).
 
 2010-06-19  Chong Yidong  <cyd@stupidchicken.com>
 
-       * errors.texi (Standard Errors): Remove unnecessary markup
-       (Bug#6461).
+       * errors.texi (Standard Errors): Remove unnecessary markup (Bug#6461).
 
 2010-06-02  Chong Yidong  <cyd@stupidchicken.com>
 
        * minibuf.texi (Basic Completion): Document completion-boundaries.
        (Programmed Completion): Document the new fourth method for boundaries.
 
-2010-05-07  Chong Yidong  <cyd@stupidchicken.com>
+2010-05-22  Chong Yidong  <cyd@stupidchicken.com>
 
-       * Version 23.2 released.
+       * display.texi (Image Cache): Update documentation about image caching.
 
-2010-05-03  Štěpán Němec  <stepnem@gmail.com>  (tiny change)
+2010-05-08  Štěpán Němec  <stepnem@gmail.com>  (tiny change)
 
        * windows.texi (Textual Scrolling):
        * tips.texi (Coding Conventions):
        * loading.texi (Where Defined):
        * edebug.texi (Instrumenting): Fix typos.
 
-2010-04-25  Chong Yidong  <cyd@stupidchicken.com>
+2010-05-08  Chong Yidong  <cyd@stupidchicken.com>
 
        * keymaps.texi (Menu Bar): Document :advertised-binding property.
 
-       * functions.texi (Obsolete Functions): Document
-       set-advertised-calling-convention.
+       * functions.texi (Obsolete Functions):
+       Document set-advertised-calling-convention.
 
        * minibuf.texi (Basic Completion): Document completion-in-region.
        (Programmed Completion): Document completion-annotate-function.
 
        * elisp.texi (Top): Update node description.
 
+2010-05-08  Eli Zaretskii  <eliz@gnu.org>
+
+       * nonascii.texi (Character Properties):
+       Document unicode-category-table.  Add an index entry for Unicode
+       general category.
+
+2010-05-07  Chong Yidong  <cyd@stupidchicken.com>
+
+       * Version 23.2 released.
+
+2010-04-20  Juanma Barranquero  <lekktu@gmail.com>
+
+       * locals.texi (Standard Buffer-Local Variables):
+       Remove @ignore'd reference to `direction-reversed'.
+
 2010-04-14  Juri Linkov  <juri@jurta.org>
 
        Fix @deffn without category.
 
        * frames.texi (Cursor Parameters): Fix typo.  (Bug#5760)
 
-2010-03-21  Chong Yidong  <cyd@stupidchicken.com>
+2010-03-24  Chong Yidong  <cyd@stupidchicken.com>
 
        * processes.texi (Network Processes): Document seqpacket type.
 
+2010-03-20  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * os.texi (System Environment): Do not mention lynxos.
+
+2010-03-10  Chong Yidong  <cyd@stupidchicken.com>
+
+       * Branch for 23.2.
+
 2010-03-06  Chong Yidong  <cyd@stupidchicken.com>
 
        * objects.texi (Integer Type): Take note of the read syntax
 2005-02-05  Eli Zaretskii  <eliz@gnu.org>
 
        * frames.texi (Color Names): Add pointer to the X docs about RGB
-       color specifications.  Improve indexing
+       color specifications.  Improve indexing.
        (Text Terminal Colors): Replace the description of RGB values by
        an xref to "Color Names".
 
        * minibuf.texi (Reading File Names): read-file-name has new
        arg PREDICATE.  New function read-directory-name.
 
-       * macros.texi (Defining Macros): Give definition of `declare'
+       * macros.texi (Defining Macros): Give definition of `declare'.
        (Indenting Macros): New node.
 
        * frames.texi (Parameter Access): Add modify-all-frames-parameters.
        * numbers.texi (Integer Basics): Add most-positive-fixnum,
        most-negative-fixnum.
 
-       * compile.texi (Byte Compilation): Explain no-byte-compile
+       * compile.texi (Byte Compilation): Explain no-byte-compile.
        (Compiler Errors): New node.
 
        * os.texi (User Identification): user-uid, user-real-uid
index 11b8220d290c719fcc60cbc53d1efdca5222e625..92e0432b84273e3d219acd5430b877da4fcd572e 100644 (file)
@@ -6,7 +6,7 @@
 
 @c This node must have no pointers.
 
-@node Antinews, GNU Free Documentation License, System Interface, Top
+@node Antinews, GNU Free Documentation License, Packaging, Top
 @appendix Emacs 22 Antinews
 @c Update the elisp.texi, vol1.texi, vol2.texi Antinews menu entries
 @c with the above version number.
index 30b966b15d27aa76c914a4fae0a68892eadc950c..732df503ec012982e05b4eb69d83bd172e13c1fa 100644 (file)
@@ -11,7 +11,7 @@
 @center @titlefont{GNU Emacs Lisp Reference Manual}
 @sp 5
 @center GNU
-@center Emacs Version 23.2.50
+@center Emacs Version 24.0.50
 @center for Unix Users
 @sp 5
 
index d22cfd955cb8a7dd88995fec3f34ed18aaf34a01..17cfcc0def85c30dbe0118f0822dc8fc896a3582 100644 (file)
@@ -1616,7 +1616,8 @@ These kinds of event are generated by moving a mouse wheel.  Their
 usual meaning is a kind of scroll or zoom.
 
 The element @var{position} is a list describing the position of the
-event, in the same format as used in a mouse-click event.
+event, in the same format as used in a mouse-click event (@pxref{Click
+Events}).
 
 @vindex mouse-wheel-up-event
 @vindex mouse-wheel-down-event
@@ -1633,9 +1634,10 @@ selected in an application outside of Emacs, and then dragged and
 dropped onto an Emacs frame.
 
 The element @var{position} is a list describing the position of the
-event, in the same format as used in a mouse-click event, and
-@var{files} is the list of file names that were dragged and dropped.
-The usual way to handle this event is by visiting these files.
+event, in the same format as used in a mouse-click event (@pxref{Click
+Events}), and @var{files} is the list of file names that were dragged
+and dropped.  The usual way to handle this event is by visiting these
+files.
 
 This kind of event is generated, at present, only on some kinds of
 systems.
index 1c28664e7c3c9ca76cd602280270e7623bf3022c..69b57f19ea7597bb1c0526429182af85bf470792 100644 (file)
@@ -22,12 +22,6 @@ hardware (as true compiled code is), byte-code is completely
 transportable from machine to machine without recompilation.  It is not,
 however, as fast as true compiled code.
 
-  Compiling a Lisp file with the Emacs byte compiler always reads the
-file as multibyte text, even if Emacs was started with @samp{--unibyte},
-unless the file specifies otherwise.  This is so that compilation gives
-results compatible with running the same file without compilation.
-@xref{Loading Non-ASCII}.
-
   In general, any version of Emacs can run byte-compiled code produced
 by recent earlier versions of Emacs, but the reverse is not true.
 
index 71680c56821bb0b03c72c756adef5a1386a74fda..a565b4dd6ff2ff9df1958cab4786d14de8d5a373 100644 (file)
@@ -3214,7 +3214,9 @@ width from the window's frame.
   The values of these variables take effect when you display the
 buffer in a window.  If you change them while the buffer is visible,
 you can call @code{set-window-buffer} to display it once again in the
-same window, to make the changes take effect.
+same window, to make the changes take effect.  A buffer that does not
+specify values for these variables will use the default values
+specified for the frame; see @ref{Layout Parameters}.
 
 @defun set-window-fringes window left &optional right outside-margins
 This function sets the fringe widths of window @var{window}.
@@ -4039,6 +4041,7 @@ displayed (@pxref{Display Feature Testing}).
 * 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.
@@ -4463,6 +4466,51 @@ specifying the bounding box of the PostScript image, analogous to the
 @end example
 @end table
 
+@node ImageMagick Images
+@subsection ImageMagick Images
+The Imagemagick library can be used to load many image formats in Emacs.
+
+The function (imagemagick-types) returns a list of image file
+extensions that your installation of imagemagick supports.
+
+The function (imagemagick-register-types) will enable the imagemagick
+support for the extensions in imagemagick-types minus the types listed
+in imagemagick-types-inhibit.
+
+imagemagick-types-inhibit has the value '(C HTML HTM TXT PDF) by
+default.  There can be overlap between image loaders in your Emacs
+installation. If you never want to use the ImageMagick loader to use
+Jpeg files, for instance, add 'JPG to imagemagick-types-inhibit. Which
+loader that will be used in practice depends on the priority of the
+loaders.
+
+imagemagick-render-type is a new variable which can be set to choose
+between screen render methods for the ImageMagick loader.
+
+- 0 is a conservative metod which works with older ImageMagick
+  versions. It is a bit slow, but robust.
+
+- 1 utilizes a newer ImageMagick method   
+
+
+Images loaded with imagemagick will support a couple of new display
+specification behaviours:
+
+- if the :width and :height keywords are specified, these values are
+used for scaling the image. If only one of :width or :height is
+specified, the other one will be calculated so as to preserve the
+aspect ratio.If both :width and :height are specified, aspect ratio
+will not be preserved.
+
+- :rotation specifies a rotation angle in degrees.
+
+- :index specifies which image inside an image bundle file format, such
+as TIFF or DJVM, to view.
+
+The image-metadata function can be used to retrieve the total number
+of images in an image bundle. This is simmilar to how GIF files work.
+
+
 @node Other Image Types
 @subsection Other Image Types
 @cindex PBM
@@ -4730,29 +4778,35 @@ cache, it can always be displayed, even if the value of
 efficiently.  When Emacs displays an image, it searches the image
 cache for an existing image specification @code{equal} to the desired
 specification.  If a match is found, the image is displayed from the
-cache; otherwise, Emacs loads the image normally.
-
-  Occasionally, you may need to tell Emacs to refresh the images
-associated with a given image specification.  For example, suppose you
-display an image using a specification that contains a @code{:file}
-property.  The image is automatically cached, and subsequent displays
-of that image, with the same image specification, will use the image
-cache.  If the image file changes in the meantime, Emacs would be
-displaying the old version of the image.  In such a situation, you can
-``refresh'' the image by calling @code{image-refresh}.
-
-  In Emacs' current implementation, each graphical terminal possesses
-an image cache, which is shared by all the frames on that terminal
+cache.  Otherwise, Emacs loads the image normally.
+
+@defun image-flush spec &optional frame
+This function removes the image with specification @var{spec} from the
+image cache of frame @var{frame}.  Image specifications are compared
+using @code{equal}.  If @var{frame} is @code{nil}, it defaults to the
+selected frame.  If @var{frame} is @code{t}, the image is flushed on
+all existing frames.
+
+In Emacs' current implementation, each graphical terminal possesses an
+image cache, which is shared by all the frames on that terminal
 (@pxref{Multiple Terminals}).  Thus, refreshing an image in one frame
 also refreshes it in all other frames on the same terminal.
-
-@defun image-refresh spec &optional frame
-This function refreshes any images with image specifications
-@code{equal} to @var{spec} on frame @var{frame}.  If @var{frame} is
-@code{nil}, it defaults to the selected frame.  If @var{frame} is
-@code{t}, the refresh is applied to all existing frames.
 @end defun
 
+  One use for @code{image-flush} is to tell Emacs about a change in an
+image file.  If an image specification contains a @code{:file}
+property, the image is cached based on the file's contents when the
+image is first displayed.  Even if the file subsequently changes,
+Emacs continues displaying the old version of the image.  Calling
+@code{image-flush} flushes the image from the cache, forcing Emacs to
+re-read the file the next time it needs to display that image.
+
+  Another use for @code{image-flush} is for memory conservation.  If
+your Lisp program creates a large number of temporary images over a
+period much shorter than @code{image-cache-eviction-delay} (see
+below), you can opt to flush unused images yourself, instead of
+waiting for Emacs to do it automatically.
+
 @defun clear-image-cache &optional filter
 This function clears an image cache, removing all the images stored in
 it.  If @var{filter} is omitted or @code{nil}, it clears the cache for
@@ -4768,9 +4822,12 @@ period of time, Emacs removes it from the cache and frees the
 associated memory.
 
 @defvar image-cache-eviction-delay
-This variable specifies the number of seconds an image can remain in the
-cache without being displayed.  When an image is not displayed for this
-length of time, Emacs removes it from the image cache.
+This variable specifies the number of seconds an image can remain in
+the cache without being displayed.  When an image is not displayed for
+this length of time, Emacs removes it from the image cache.
+
+Under some circumstances, if the number of images in the cache grows
+too large, the actual eviction delay may be shorter than this.
 
 If the value is @code{nil}, Emacs does not remove images from the cache
 except when you explicitly clear it.  This mode can be useful for
index 231d71b73086b4399ff2629f03edb979ea6ecb02..135bd17ac8d16e35b791fdd6b3a5c4d9bac5022c 100644 (file)
@@ -8,7 +8,7 @@
 @c Please remember to update the edition number in README as well.
 @c And also the copies in vol1.texi and vol2.texi.
 @set VERSION  3.0
-@set EMACSVER 23.2.50
+@set EMACSVER 24.0.50
 @set DATE July 2009
 
 @c in general, keep the following line commented out, unless doing a
@@ -159,6 +159,8 @@ Cover art by Etienne Suvasa.
 * 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 22.
@@ -1394,6 +1396,12 @@ Operating System Interface
 * Session Management::      Saving and restoring state with
                               X Session Management.
 
+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.
+
 Starting Up Emacs
 
 * Startup Summary::         Sequence of actions Emacs performs at startup.
@@ -1490,6 +1498,8 @@ Object Internals
 @include display.texi
 @include os.texi
 
+@include package.texi
+
 @c MOVE to Emacs Manual:  include misc-modes.texi
 
 @c appendices
index 7dfe3242c5dfb23bafcaf91cc21f3a99583238b1..78b4178bb217ac9830e1a5e99c9cb8ba9c736cdc 100644 (file)
@@ -461,6 +461,7 @@ Line Arguments for Emacs Invocation, emacs, The GNU Emacs Manual}.
 
 @node Window Frame Parameters
 @subsection Window Frame Parameters
+@cindex frame parameters for windowed displays
 
   Just what parameters a frame has depends on what display mechanism
 it uses.  This section describes the parameters that have special
@@ -489,16 +490,19 @@ terminal frames.
 frame.  @code{title} and @code{name} are meaningful on all terminals.
 
 @table @code
+@vindex display, a frame parameter
 @item display
 The display on which to open this frame.  It should be a string of the
 form @code{"@var{host}:@var{dpy}.@var{screen}"}, just like the
 @code{DISPLAY} environment variable.
 
+@vindex display-type, a frame parameter
 @item display-type
 This parameter describes the range of possible colors that can be used
 in this frame.  Its value is @code{color}, @code{grayscale} or
 @code{mono}.
 
+@vindex title, a frame parameter
 @item title
 If a frame has a non-@code{nil} title, it appears in the window
 system's title bar at the top of the frame, and also in the mode line
@@ -507,6 +511,7 @@ of windows in that frame if @code{mode-line-frame-identification} uses
 Emacs is not using a window system, and can only display one frame at
 a time.  @xref{Frame Titles}.
 
+@vindex name, a frame parameter
 @item name
 The name of the frame.  The frame name serves as a default for the frame
 title, if the @code{title} parameter is unspecified or @code{nil}.  If
@@ -520,11 +525,13 @@ looking up X resources for the frame.
 
 @node Position Parameters
 @subsubsection Position Parameters
+@cindex window position on display
 
   Position parameters' values are normally measured in pixels, but on
 text-only terminals they count characters or lines instead.
 
 @table @code
+@vindex left, a frame parameter
 @item left
 The position, in pixels, of the left (or right) edge of the frame with
 respect to the left (or right) edge of the screen.  The value may be:
@@ -550,11 +557,13 @@ Some window managers ignore program-specified positions.  If you want to
 be sure the position you specify is not ignored, specify a
 non-@code{nil} value for the @code{user-position} parameter as well.
 
+@vindex top, a frame parameter
 @item top
 The screen position of the top (or bottom) edge, in pixels, with respect
 to the top (or bottom) edge of the screen.  It works just like
 @code{left}, except vertically instead of horizontally.
 
+@vindex icon-left, a frame parameter
 @item icon-left
 The screen position of the left edge @emph{of the frame's icon}, in
 pixels, counting from the left edge of the screen.  This takes effect if
@@ -564,11 +573,13 @@ If you specify a value for this parameter, then you must also specify
 a value for @code{icon-top} and vice versa.  The window manager may
 ignore these two parameters.
 
+@vindex icon-top, a frame parameter
 @item icon-top
 The screen position of the top edge @emph{of the frame's icon}, in
 pixels, counting from the top edge of the screen.  This takes effect if
 and when the frame is iconified.
 
+@vindex user-position, a frame parameter
 @item user-position
 When you create a frame and specify its screen position with the
 @code{left} and @code{top} parameters, use this parameter to say whether
@@ -576,6 +587,7 @@ the specified position was user-specified (explicitly requested in some
 way by a human user) or merely program-specified (chosen by a program).
 A non-@code{nil} value says the position was user-specified.
 
+@cindex window positions and window managers
 Window managers generally heed user-specified positions, and some heed
 program-specified positions too.  But many ignore program-specified
 positions, placing the window in a default fashion or letting the user
@@ -591,24 +603,31 @@ parameters represent the user's stated preference; otherwise, use
 
 @node Size Parameters
 @subsubsection Size Parameters
+@cindex window size on display
 
   Size parameters' values are normally measured in pixels, but on
 text-only terminals they count characters or lines instead.
 
 @table @code
+@vindex height, a frame parameter
 @item height
 The height of the frame contents, in characters.  (To get the height in
 pixels, call @code{frame-pixel-height}; see @ref{Size and Position}.)
 
+@vindex width, a frame parameter
 @item width
 The width of the frame contents, in characters.  (To get the width in
 pixels, call @code{frame-pixel-width}; see @ref{Size and Position}.)
 
+@vindex user-size, a frame parameter
 @item user-size
 This does for the size parameters @code{height} and @code{width} what
-the @code{user-position} parameter (see above) does for the position
-parameters @code{top} and @code{left}.
+the @code{user-position} parameter (@pxref{Position Parameters,
+user-position}) does for the position parameters @code{top} and
+@code{left}.
 
+@cindex full-screen frames
+@vindex fullscreen, a frame parameter
 @item fullscreen
 Specify that width, height or both shall be maximized.  The value
 @code{fullwidth} specifies that width shall be as wide as possible.
@@ -623,33 +642,42 @@ covers the whole screen.
 
 @node Layout Parameters
 @subsubsection Layout Parameters
+@cindex layout parameters of frames
+@cindex frame layout parameters
 
   These frame parameters enable or disable various parts of the
 frame, or control their sizes.
 
 @table @code
+@vindex border-width, a frame parameter
 @item border-width
 The width in pixels of the frame's border.
 
+@vindex internal-border-width, a frame parameter
 @item internal-border-width
 The distance in pixels between text (or fringe) and the frame's border.
 
+@vindex vertical-scroll-bars, a frame parameter
 @item vertical-scroll-bars
 Whether the frame has scroll bars for vertical scrolling, and which side
 of the frame they should be on.  The possible values are @code{left},
 @code{right}, and @code{nil} for no scroll bars.
 
 @ignore
+@vindex horizontal-scroll-bars, a frame parameter
 @item horizontal-scroll-bars
 Whether the frame has scroll bars for horizontal scrolling
 (non-@code{nil} means yes).  Horizontal scroll bars are not currently
 implemented.
 @end ignore
 
+@vindex scroll-bar-width, a frame parameter
 @item scroll-bar-width
 The width of vertical scroll bars, in pixels, or @code{nil} meaning to
 use the default width.
 
+@vindex left-fringe, a frame parameter
+@vindex right-fringe, a frame parameter
 @item left-fringe
 @itemx right-fringe
 The default width of the left and right fringes of windows in this
@@ -666,17 +694,26 @@ fringe.  However, you can force one fringe or the other to a precise
 width by specifying that width as a negative integer.  If both widths are
 negative, only the left fringe gets the specified width.
 
+@vindex menu-bar-lines, a frame parameter
 @item menu-bar-lines
 The number of lines to allocate at the top of the frame for a menu
 bar.  The default is 1.  A value of @code{nil} means don't display a
 menu bar.  @xref{Menu Bar}.  (The X toolkit and GTK allow at most one
 menu bar line; they treat larger values as 1.)
 
+@vindex tool-bar-lines, a frame parameter
 @item tool-bar-lines
 The number of lines to use for the tool bar.  A value of @code{nil}
 means don't display a tool bar.  (GTK and Nextstep allow at most one
 tool bar line; they treat larger values as 1.)
 
+@vindex tool-bar-position, a frame parameter
+@item tool-bar-position
+The position of the tool bar.  Currently only for the GTK tool bar.
+Value can be one of @code{top}, @code{bottom} @code{left}, @code{right}.
+The default is  @code{top}.
+
+@vindex line-spacing, a frame parameter
 @item line-spacing
 Additional space to leave below each text line, in pixels (a positive
 integer).  @xref{Line Height}, for more information.
@@ -689,6 +726,7 @@ integer).  @xref{Line Height}, for more information.
 with which buffers have been, or should, be displayed in the frame.
 
 @table @code
+@vindex minibuffer, a frame parameter
 @item minibuffer
 Whether this frame has its own minibuffer.  The value @code{t} means
 yes, @code{nil} means no, @code{only} means this frame is just a
@@ -698,6 +736,7 @@ frame), the frame uses that minibuffer.
 This frame parameter takes effect when the frame is created, and can
 not be changed afterwards.
 
+@vindex buffer-predicate, a frame parameter
 @item buffer-predicate
 The buffer-predicate function for this frame.  The function
 @code{other-buffer} uses this predicate (from the selected frame) to
@@ -706,61 +745,73 @@ decide which buffers it should consider, if the predicate is not
 each buffer; if the predicate returns a non-@code{nil} value, it
 considers that buffer.
 
+@vindex buffer-list, a frame parameter
 @item buffer-list
-A list of buffers that have been selected in this frame,
-ordered most-recently-selected first.
+A list of buffers that have been selected in this frame, ordered
+most-recently-selected first.
 
+@vindex unsplittable, a frame parameter
 @item unsplittable
 If non-@code{nil}, this frame's window is never split automatically.
 @end table
 
 @node Management Parameters
 @subsubsection Window Management Parameters
-@cindex window manager, and frame parameters
+@cindex window manager interaction, and frame parameters
 
   These frame parameters, meaningful only on window system displays,
 interact with the window manager.
 
 @table @code
+@vindex visibility, a frame parameter
 @item visibility
 The state of visibility of the frame.  There are three possibilities:
 @code{nil} for invisible, @code{t} for visible, and @code{icon} for
 iconified.  @xref{Visibility of Frames}.
 
+@vindex auto-raise, a frame parameter
 @item auto-raise
 Whether selecting the frame raises it (non-@code{nil} means yes).
 
+@vindex auto-lower, a frame parameter
 @item auto-lower
 Whether deselecting the frame lowers it (non-@code{nil} means yes).
 
+@vindex icon-type, a frame parameter
 @item icon-type
 The type of icon to use for this frame when it is iconified.  If the
 value is a string, that specifies a file containing a bitmap to use.
 Any other non-@code{nil} value specifies the default bitmap icon (a
 picture of a gnu); @code{nil} specifies a text icon.
 
+@vindex icon-name, a frame parameter
 @item icon-name
 The name to use in the icon for this frame, when and if the icon
 appears.  If this is @code{nil}, the frame's title is used.
 
+@vindex window-id, a frame parameter
 @item window-id
 The number of the window-system window used by the frame
 to contain the actual Emacs windows.
 
+@vindex outer-window-id, a frame parameter
 @item outer-window-id
 The number of the outermost window-system window used for the whole frame.
 
+@vindex wait-for-wm, a frame parameter
 @item wait-for-wm
 If non-@code{nil}, tell Xt to wait for the window manager to confirm
 geometry changes.  Some window managers, including versions of Fvwm2
 and KDE, fail to confirm, so Xt hangs.  Set this to @code{nil} to
 prevent hanging with those window managers.
 
+@vindex sticky, a frame parameter
 @item sticky
 If non-@code{nil}, the frame is visible on all virtual desktops on systems
 with virtual desktops.
 
 @ignore
+@vindex parent-id, a frame parameter
 @item parent-id
 @c ??? Not yet working.
 The X window number of the window that should be the parent of this one.
@@ -772,10 +823,12 @@ it and see if it works.)
 
 @node Cursor Parameters
 @subsubsection Cursor Parameters
+@cindex cursor, and frame parameters
 
   This frame parameter controls the way the cursor looks.
 
 @table @code
+@vindex cursor-type, a frame parameter
 @item cursor-type
 How to display the cursor.  Legitimate values are:
 
@@ -827,10 +880,12 @@ and bar becomes a narrower bar).
 
 @node Font and Color Parameters
 @subsubsection Font and Color Parameters
+@cindex font and color, frame parameters
 
   These frame parameters control the use of fonts and colors.
 
 @table @code
+@vindex font-backend, a frame parameter
 @item font-backend
 A list of symbols, specifying the @dfn{font backends} to use for
 drawing fonts in the frame, in order of priority.  On X, there are
@@ -839,10 +894,12 @@ driver) and @code{xft} (the Xft font driver).  On other systems, there
 is only one available font backend, so it does not make sense to
 modify this frame parameter.
 
+@vindex background-mode, a frame parameter
 @item background-mode
 This parameter is either @code{dark} or @code{light}, according
 to whether the background color is a light one or a dark one.
 
+@vindex tty-color-mode, a frame parameter
 @item tty-color-mode
 @cindex standard colors for character terminals
 This parameter overrides the terminal's color support as given by the
@@ -858,6 +915,7 @@ If the parameter's value is a symbol, it specifies a number through
 the value of @code{tty-color-mode-alist}, and the associated number is
 used instead.
 
+@vindex screen-gamma, a frame parameter
 @item screen-gamma
 @cindex gamma correction
 If this is a number, Emacs performs ``gamma correction'' which adjusts
@@ -877,6 +935,7 @@ If your monitor displays colors too light, you should specify a
 that makes colors darker.  A screen gamma value of 1.5 may give good
 results for LCD color displays.
 
+@vindex alpha, a frame parameter
 @item alpha
 @cindex opacity, frame
 @cindex transparency, frame
@@ -904,37 +963,45 @@ automatically equivalent to particular face attributes of particular
 faces (@pxref{Standard Faces,,, emacs, The Emacs Manual}):
 
 @table @code
+@vindex font, a frame parameter
 @item font
 The name of the font for displaying text in the frame.  This is a
 string, either a valid font name for your system or the name of an Emacs
 fontset (@pxref{Fontsets}).  It is equivalent to the @code{font}
 attribute of the @code{default} face.
 
+@vindex foreground-color, a frame parameter
 @item foreground-color
 The color to use for the image of a character.  It is equivalent to
 the @code{:foreground} attribute of the @code{default} face.
 
+@vindex background-color, a frame parameter
 @item background-color
 The color to use for the background of characters.  It is equivalent to
 the @code{:background} attribute of the @code{default} face.
 
+@vindex mouse-color, a frame parameter
 @item mouse-color
 The color for the mouse pointer.  It is equivalent to the @code{:background}
 attribute of the @code{mouse} face.
 
+@vindex cursor-color, a frame parameter
 @item cursor-color
 The color for the cursor that shows point.  It is equivalent to the
 @code{:background} attribute of the @code{cursor} face.
 
+@vindex border-color, a frame parameter
 @item border-color
 The color for the border of the frame.  It is equivalent to the
 @code{:background} attribute of the @code{border} face.
 
+@vindex scroll-bar-foreground, a frame parameter
 @item scroll-bar-foreground
 If non-@code{nil}, the color for the foreground of scroll bars.  It is
 equivalent to the @code{:foreground} attribute of the
 @code{scroll-bar} face.
 
+@vindex scroll-bar-background, a frame parameter
 @item scroll-bar-background
 If non-@code{nil}, the color for the background of scroll bars.  It is
 equivalent to the @code{:background} attribute of the
index 708be9379f72373bf007207ed56e599a66ad1154..2420e777fe8ad7650391e998ffd2bd25087c4380 100644 (file)
@@ -518,8 +518,7 @@ If all args return nil, return nil.
 @end group
 @group
 usage: (or CONDITIONS ...)  */)
-  (args)
-     Lisp_Object args;
+  (Lisp_Object args)
 @{
   register Lisp_Object val = Qnil;
   struct gcpro gcpro1;
@@ -618,15 +617,15 @@ All the usual rules for documentation strings in Lisp code
 too.
 @end table
 
-  After the call to the @code{DEFUN} macro, you must write the argument
-name list that every C function must have, followed by ordinary C
-declarations for the arguments.  For a function with a fixed maximum
-number of arguments, declare a C argument for each Lisp argument, and
-give them all type @code{Lisp_Object}.  When a Lisp function has no
-upper limit on the number of arguments, its implementation in C actually
-receives exactly two arguments: the first is the number of Lisp
-arguments, and the second is the address of a block containing their
-values.  They have types @code{int} and @w{@code{Lisp_Object *}}.
+  After the call to the @code{DEFUN} macro, you must write the
+argument list that every C function must have, including the types for
+the arguments.  For a function with a fixed maximum number of
+arguments, declare a C argument for each Lisp argument, and give them
+all type @code{Lisp_Object}.  When a Lisp function has no upper limit
+on the number of arguments, its implementation in C actually receives
+exactly two arguments: the first is the number of Lisp arguments, and
+the second is the address of a block containing their values.  They
+have types @code{int} and @w{@code{Lisp_Object *}}.
 
 @cindex @code{GCPRO} and @code{UNGCPRO}
 @cindex protect C variables from garbage collection
index bbdd67fc3a5a1ab9f98305c519cab784d4931171..dee2a0252ebc897314b6396d7de9634fa392513e 100644 (file)
@@ -367,13 +367,6 @@ example) is read without decoding, the text of the program will be
 unibyte text, and its string constants will be unibyte strings.
 @xref{Coding Systems}.
 
-  To make the results more predictable, Emacs always performs decoding
-into the multibyte representation when loading Lisp files, even if it
-was started with the @samp{--unibyte} option.  This means that string
-constants with non-@acronym{ASCII} characters translate into multibyte
-strings.  The only exception is when a particular file specifies no
-decoding.
-
   The reason Emacs is designed this way is so that Lisp programs give
 predictable results, regardless of how Emacs was started.  In addition,
 this enables programs that depend on using multibyte text to work even
index 25bbc6f02b5dee32c7119d07601873bf9363980f..0bef9cb3554782c24abc3717a35529496e13216f 100644 (file)
@@ -106,11 +106,6 @@ Minor mode variables will not be listed here.
 @item desktop-save-buffer
 @xref{Desktop Save Mode}.
 
-@ignore
-@item direction-reversed
-Does not work yet.
-@end ignore
-
 @item enable-multibyte-characters
 @ref{Text Representations}.
 
index dfcb3e4730b1ba7968d05d53f600fec1e7902af5..40c78d97da7bb74dcdf0ab633e852a9906cc4e02 100644 (file)
@@ -102,9 +102,6 @@ it contains unibyte encoded text or binary non-text data.
 
 You cannot set this variable directly; instead, use the function
 @code{set-buffer-multibyte} to change a buffer's representation.
-
-The @samp{--unibyte} command line option does its job by setting the
-default value to @code{nil} early in startup.
 @end defvar
 
 @defun position-bytes position
@@ -375,6 +372,7 @@ This property corresponds to the Unicode @code{Name} property.  The
 value is a string consisting of upper-case Latin letters A to Z,
 digits, spaces, and hyphen @samp{-} characters.
 
+@cindex unicode general category
 @item general-category
 This property corresponds to the Unicode @code{General_Category}
 property.  The value is a symbol whose name is a 2-letter abbreviation
@@ -501,13 +499,18 @@ This function stores @var{value} as the value of the property
 @var{propname} for the character @var{char}.
 @end defun
 
-@defvar char-script-table
+@defvar unicode-category-table
 The value of this variable is a char-table (@pxref{Char-Tables}) that
-specifies, for each character, a symbol whose name is the script to
-which the character belongs, according to the Unicode Standard
-classification of the Unicode code space into script-specific blocks.
-This char-table has a single extra slot whose value is the list of all
-script symbols.
+specifies, for each character, its Unicode @code{General_Category}
+property as a symbol.
+@end defvar
+
+@defvar char-script-table
+The value of this variable is a char-table that specifies, for each
+character, a symbol whose name is the script to which the character
+belongs, according to the Unicode Standard classification of the
+Unicode code space into script-specific blocks.  This char-table has a
+single extra slot whose value is the list of all script symbols.
 @end defvar
 
 @defvar char-width-table
index f4eba6a691e093728169bff82b74d701c7a4fad9..dd8272342721e7967703ca93b71fa1eba1d5e0c8 100644 (file)
@@ -5,7 +5,7 @@
 @c   Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @setfilename ../../info/os
-@node System Interface, Antinews, Display, Top
+@node System Interface, Packaging, Display, Top
 @chapter Operating System Interface
 
   This chapter is about starting and getting out of Emacs, access to
@@ -787,9 +787,6 @@ Hewlett-Packard HPUX operating system.
 @item irix
 Silicon Graphics Irix system.
 
-@item lynxos 3.0.1
-LynxOS-3.0.1.
-
 @item ms-dos
 Microsoft MS-DOS ``operating system.''  Emacs compiled with DJGPP for
 MS-DOS binds @code{system-type} to @code{ms-dos} even when you run it on
diff --git a/doc/lispref/package.texi b/doc/lispref/package.texi
new file mode 100644 (file)
index 0000000..138f8d9
--- /dev/null
@@ -0,0 +1,197 @@
+@c -*-texinfo-*-
+@c This is part of the GNU Emacs Lisp Reference Manual.
+@c Copyright (C) 2010
+@c   Free Software Foundation, Inc.
+@c See the file elisp.texi for copying conditions.
+@setfilename ../../info/package
+@node Packaging, Antinews, System Interface, Top
+@chapter Preparing Lisp code for distribution
+@cindex packaging
+
+  Emacs provides a standard way for Emacs Lisp code to be distributed
+to users.  This approach lets users easily download, install,
+uninstall, and upgrade Lisp code that they might want to use.
+
+  A @dfn{package} is simply one or more files, formatted and bundled
+in a particular way.  Typically a package includes primarily Emacs
+Lisp code, but it is possible to create other kinds of packages as
+well.
+
+@menu
+* 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.
+@end menu
+
+@node Packaging Basics
+@section Packaging Basics
+@cindex packaging basics
+
+  A package has a few attributes:
+@cindex package attributes
+
+@table @asis
+@item Name
+A string, the name of the package.  This attribute is mandatory.  If
+it does not exist, the package cannot be installed by the package
+manager.
+
+@item Version
+A version number, which is anything that can be parsed by
+@code{version-to-list}.  This attribute is mandatory.  If it does not
+exist, the package cannot be installed by the package manager.
+
+@item Brief description
+This is shown to the user in the package menu buffer.  It is just a
+single line.  On a terminal with 80 characters per line, there are
+only 36 characters available in the package menu mode for showing the
+brief description, so it is best to keep it very brief.  If no brief
+name is given, an empty string is used.
+
+@item Long description
+This can be a @file{README} file or the like.  This is available to
+the user before the package is installed, via the package menu.  It
+should more fully describe the package and its capabilities, so a user
+can read it to decide whether he wants to install the package.  This
+attribute is optional.
+
+@item Dependencies
+This is a list of other packages and their minimal acceptable
+versions.  This is used both at download time (to make sure all the
+needed code is available) and at activation time (to ensure a package
+is only activated if all its dependencies have been successfully
+activated).  This attribute is optional.
+
+@item Manual
+A package can optionally include an Info manual.
+@end table
+
+  Conceptually, a package goes through several state transitions (in
+reality some of these transitions are grouped together):
+
+@table @asis
+@item Download
+Fetch the package from somewhere.
+
+@item Install
+Unpack the package, or write a @file{.el} file into the appropriate
+install directory.  This step also includes extracting autoloads and
+byte-compiling the Emacs Lisp code.
+
+@item Activate
+Update @code{load-path} and @code{Info-directory-list} and evaluate
+the autoloads, so that the package is ready for the user to use.
+@end table
+
+  It is best for users if packages do not do too much work at
+activation time.  The best approach is to have activation consist of
+some autoloads and little more.
+
+@node Simple Packages
+@section Simple Packages
+@cindex single file packages
+
+  The simplest package consists of a single Emacs Lisp source file.
+In this case, all the attributes of the package (@pxref{Packaging
+Basics}) are taken from this file.
+
+  The package system expects this @file{.el} file to conform to the
+Emacs Lisp library header conventions.  @xref{Library Headers}.
+
+  The name of the package is the same as the base name of the
+@file{.el} file, as written in the first comment line.  For example,
+given the header line:
+
+@smallexample
+;;; superfrobnicator.el --- frobnicate and bifurcate flanges
+@end smallexample
+
+the package name will be @samp{superfrobnicator}.
+
+  The short description of the package is also taken from the first
+line of the file.
+
+  If the file has a ``Commentary'' header, then it is used as the long
+description.
+
+  The version of the package comes either from the ``Package-Version''
+header, if it exists, or from the ``Version'' header.  A package is
+required to have a version number.  Each release of a package must be
+accompanied by an increase in the version number.
+
+  If the file has a ``Package-Requires'' header, then that is used as
+the package dependencies.  Otherwise, the package is assumed not to
+have any dependencies.
+
+  A single-file package cannot have an Info manual.
+
+  The file will be scanned for autoload cookies at install time.
+@xref{Autoload}.
+
+@node Multi-file Packages
+@section Multi-file Packages
+@cindex multi-file packages
+
+  A multi-file package is just a @file{.tar} file.  While less
+convenient to create than a single-file package, a multi-file package
+also offers more features: it can include an Info manual, multiple
+Emacs Lisp files, and also other data files needed by a package.
+
+  The contents of the @file{.tar} file must all appear beneath a
+single directory, named after the package and version.  Files can
+appear in subdirectories of this top-most directory, but Emacs Lisp
+code will only be found (and thus byte-compiled) at the top-most
+level.  Also, the @file{.tar} file is typically also given this same
+name.  For example, if you are distributing version 1.3 of the
+superfrobnicator, the package file would be named
+``superfrobnicator-1.3.tar'' and the contents would all appear in the
+directory @file{superfrobnicator-1.3} in that @file{.tar}.
+
+  The package must include a @file{-pkg.el} file, named after the
+package.  In our example above, this file would be called
+@file{superfrobnicator-pkg.el}.  This file must have a single form in
+it, a call to @code{define-package}.  The package dependencies and
+brief description are taken from this form.
+
+@defun define-package name version &optional docstring requirements
+Define a package.  @var{name} is the name of the package, a string.
+@var{version} is the package's version, a string.  It must be in a
+form that can be understood by @code{version-to-list}.
+@var{docstring} is the short description of the package.
+@var{requirements} is a list of required packages and their versions.
+@end defun
+
+  If a @file{README} file exists in the content directory, then it is
+used as the long description.
+
+  If the package has an Info manual, you should distribute the needed
+info files, plus a @file{dir} file made with @command{install-info}.
+@xref{Invoking install-info, Invoking install-info, Invoking
+install-info, texinfo, Texinfo}.
+
+  Do not include any @file{.elc} files in the package.  Those will be
+created at install time.  Note that there is no way to control the
+order in which files are byte-compiled; your package must be robust
+here.
+
+  The installation process will scan all the @file{.el} files in the
+package for autoload cookies.  @xref{Autoload}.  They are extracted
+into a @file{-autoloads.el} file (e.g.,
+@file{superfrobnicator-autoloads.el}), so do not include a file of
+that name in your package.
+
+  Any other files in the @file{.tar} file are simply unpacked when the
+package is installed.  This can be useful if your package needs
+auxiliary data files --- e.g., icons or sounds.
+
+  Emacs Lisp code installed via the package manager must take special
+care to be location-independent.  One easy way to do this is to make
+references to auxiliary data files relative to @var{load-file-name}.
+For example:
+
+@smallexample
+(defconst superfrobnicator-base (file-name-directory load-file-name))
+
+(defun superfrobnicator-fetch-image (file)
+  (expand-file-name file superfrobnicator-base))
+@end smallexample
index 1a4a766c81cee08bbb1199196ad5a77bbf236220..89f97f99de318c2ddd876d18db0224d6388abb3e 100644 (file)
@@ -868,7 +868,9 @@ terminated, the value is 0.
 This function returns the terminal name that @var{process} is using for
 its communication with Emacs---or @code{nil} if it is using pipes
 instead of a terminal (see @code{process-connection-type} in
-@ref{Asynchronous Processes}).
+@ref{Asynchronous Processes}).  If @var{process} represents a program
+running on a remote host, the terminal name used by that program on
+the remote host is provided as process property @code{remote-tty}.
 @end defun
 
 @defun process-coding-system process
@@ -1271,22 +1273,24 @@ process's buffer, mimicking the actions of Emacs when there is no
 filter.  Such filter functions need to use @code{set-buffer} in order to
 be sure to insert in that buffer.  To avoid setting the current buffer
 semipermanently, these filter functions must save and restore the
-current buffer.  They should also update the process marker, and in some
-cases update the value of point.  Here is how to do these things:
+current buffer.  They should also check whether the buffer is still
+alive, update the process marker, and in some cases update the value
+of point.  Here is how to do these things:
 
 @smallexample
 @group
 (defun ordinary-insertion-filter (proc string)
-  (with-current-buffer (process-buffer proc)
-    (let ((moving (= (point) (process-mark proc))))
+  (when (buffer-live-p (process-buffer proc))
+    (with-current-buffer (process-buffer proc)
+      (let ((moving (= (point) (process-mark proc))))
 @end group
 @group
-      (save-excursion
-        ;; @r{Insert the text, advancing the process marker.}
-        (goto-char (process-mark proc))
-        (insert string)
-        (set-marker (process-mark proc) (point)))
-      (if moving (goto-char (process-mark proc))))))
+        (save-excursion
+          ;;  @r{Insert the text, advancing the process marker.}
+          (goto-char (process-mark proc))
+          (insert string)
+          (set-marker (process-mark proc) (point)))
+        (if moving (goto-char (process-mark proc)))))))
 @end group
 @end smallexample
 
@@ -1313,12 +1317,6 @@ expression searching or matching had to explicitly save and restore the
 match data.  Now Emacs does this automatically for filter functions;
 they never need to do it explicitly.  @xref{Match Data}.
 
-  A filter function that writes the output into the buffer of the
-process should check whether the buffer is still alive.  If it tries to
-insert into a dead buffer, it will get an error.  The expression
-@code{(buffer-name (process-buffer @var{process}))} returns @code{nil}
-if the buffer is dead.
-
   The output to the function may come in chunks of any size.  A program
 that produces the same output twice in a row may send it as one batch of
 200 characters one time, and five batches of 40 characters the next.  If
index de281b0e147cc10a8dd38ae601772606ca414e8e..bf3afcf53ee6f2c99143d80943068098c452e588 100644 (file)
@@ -1052,6 +1052,31 @@ Please use that command to see a list of the meaningful keywords.
 This field is important; it's how people will find your package when
 they're looking for things by topic area.  To separate the keywords, you
 can use spaces, commas, or both.
+
+@item Package-Version
+If @samp{Version} is not suitable for use by the package manager, then
+a package can define @samp{Package-Version}; it will be used instead.
+This is handy if @samp{Version} is an RCS id or something else that
+cannot be parsed by @code{version-to-list}.  @xref{Packaging Basics}.
+
+@item Package-Requires
+If this exists, it names packages on which the current package depends
+for proper operation.  @xref{Packaging Basics}.  This is used by the
+package manager both at download time (to ensure that a complete set
+of packages is downloaded) and at activation time (to ensure that a
+package is activated if and only if all its dependencies have been).
+
+Its format is a list of lists.  The @code{car} of each sub-list is the
+name of a package, as a symbol.  The @code{cadr} of each sub-list is
+the minimum acceptable version number, as a string.  For instance:
+
+@smallexample
+;; Package-Requires: ((gnus "1.0") (bubbles "2.7.2"))
+@end smallexample
+
+The package code automatically defines a package named @samp{emacs}
+with the version number of the currently running Emacs.  This can be
+used to require a minimal version of Emacs for a package.
 @end table
 
   Just about every Lisp library ought to have the @samp{Author} and
index d8449044fddf177334c18dd0a592fcbe3c2a487f..6e8237334acea32d00c47be9e38648f3c3c32661 100644 (file)
@@ -27,7 +27,7 @@
 @c Version of the manual and of Emacs.
 @c Please remember to update the edition number in README as well.
 @set VERSION  3.0
-@set EMACSVER 23.2.50
+@set EMACSVER 24.0.50
 @set DATE July 2009
 
 @dircategory Emacs
@@ -180,6 +180,8 @@ Reference Manual, corresponding to GNU Emacs version @value{EMACSVER}.
 * 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 22.
@@ -1415,6 +1417,12 @@ Operating System Interface
 * Session Management::      Saving and restoring state with
                               X Session Management.
 
+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.
+
 Starting Up Emacs
 
 * Startup Summary::         Sequence of actions Emacs performs at startup.
index 3f1dc33c23421c019bd62092d3b4b0664a7e6693..b36e06eae3adb52e8a00b648229a8d915dacaa36 100644 (file)
@@ -27,7 +27,7 @@
 @c Version of the manual and of Emacs.
 @c Please remember to update the edition number in README as well.
 @set VERSION  3.0
-@set EMACSVER 23.2.50
+@set EMACSVER 24.0.50
 @set DATE July 2009
 
 @dircategory Emacs
@@ -179,6 +179,8 @@ Reference Manual, corresponding to GNU Emacs version @value{EMACSVER}.
 * 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 22.
@@ -1414,6 +1416,12 @@ Operating System Interface
 * Session Management::      Saving and restoring state with
                               X Session Management.
 
+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.
+
 Starting Up Emacs
 
 * Startup Summary::         Sequence of actions Emacs performs at startup.
index 3bee2a1011ab5cec78c113e705e80770f672d0b1..47f059e7d3cf742b71488d5b25fa42126d6dd45f 100644 (file)
@@ -6,10 +6,14 @@
 
        * Version 23.2 released.
 
+2010-03-10  Chong Yidong  <cyd@stupidchicken.com>
+
+       * Branch for 23.2.
+
 2010-01-09  Chong Yidong  <cyd@stupidchicken.com>
 
-       * emacs.1: Copyedits.  Update options -Q, -mm and --daemon.  Remove
-       deprecated --unibyte option.
+       * emacs.1: Copyedits.  Update options -Q, -mm and --daemon.
+       Remove deprecated --unibyte option.
 
 2009-06-21  Chong Yidong  <cyd@stupidchicken.com>
 
index b192514eadfa82b653f5337ddd2e864f1fa53f05..2ad9e2c543a29a5f24b9139bdbbf40a324e816d0 100644 (file)
@@ -1,5 +1,5 @@
 .\" See section COPYING for copyright and redistribution information.
-.TH EMACS 1 "2007 April 13" "GNU Emacs 23.2.50"
+.TH EMACS 1 "2007 April 13" "GNU Emacs 24.0.50"
 .
 .
 .SH NAME
index 322be57330d1fe1601a8b799bf1a715db620e3b4..482499d4df50811389d8ed47d39af90ec769cfbc 100644 (file)
@@ -1,3 +1,31 @@
+2010-08-31  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * gnus.texi (HTML): Document gnus-blocked-images.
+
+       * message.texi (Wide Reply): Document message-prune-recipient-rules.
+
+2010-08-30  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * gnus.texi (Summary Mail Commands): Note that only the addresses from
+       the first message are used for wide replies.
+       (Changing Servers): Remove documentation on gnus-change-server and
+       friends, since it's been removed.
+
+2010-08-29  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * gnus.texi (Drafts): Mention B DEL.
+
+2010-08-29  Tim Landscheidt  <tim@tim-landscheidt.de>  (tiny change)
+
+       * gnus.texi (Delayed Articles): Mention that the Date header is the
+       original one, even if you delay.
+
+2010-08-29  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * gnus.texi (Asynchronous Fetching): Document
+       gnus-async-post-fetch-function.
+       (HTML): Made into its own section.
+
 2010-08-26  Michael Albinus  <michael.albinus@gmx.de>
 
        Sync with Tramp 2.1.19.
 
        * trampver.texi: Update release number.
 
-2010-08-01  Juanma Barranquero  <lekktu@gmail.com>
+2010-08-23  Michael Albinus  <michael.albinus@gmx.de>
+
+       * dbus.texi (Alternative Buses): New chapter.
+
+2010-08-12  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * cl.texi (Mapping over Sequences): Rename mapc => cl-mapc.
+
+2010-08-09  Jay Belanger  <jay.p.belanger@gmail.com>
+
+       * calc.texi (Customizing Calc): Rearrange description of new
+       variables to match the presentation of other variables.
+
+2010-08-08  Juanma Barranquero  <lekktu@gmail.com>
 
        * org.texi (Footnotes, Tables in HTML export): Fix typos.
 
-2010-07-23  Chong Yidong  <cyd@stupidchicken.com>
+2010-08-08  Jay Belanger  <jay.p.belanger@gmail.com>
+
+       * calc.texi (Making Selections, Selecting Subformulas)
+       (Customizing Calc): Mention how to use faces to emphasize selected
+       sub-formulas.
+
+2010-08-05  Michael Albinus  <michael.albinus@gmx.de>
+
+       * tramp.texi (External packages): File attributes cache flushing
+       for asynchronous processes.
+
+2010-08-01  Alan Mackenzie  <acm@muc.de>
+
+       Enhance the manual for the latest Java Mode.
+
+       * cc-mode.texi (Syntactic Symbols): New symbols annotation-top-cont and
+       annotation-var-cont.
+       (Java Symbols): Page renamed from Anonymous Class Symbol.  Document the
+       two new symbols.
+
+2010-07-28  Michael Albinus  <michael.albinus@gmx.de>
+
+       * tramp.texi (Traces and Profiles): Describe verbose level 9.
+
+2010-07-27  Chong Yidong  <cyd@stupidchicken.com>
 
        * nxml-mode.texi (Limitations): Remove obsolete discussion (Bug#6708).
 
+2010-07-19  Juanma Barranquero  <lekktu@gmail.com>
+
+       * org.texi: Fix typo in previous change (2010-07-19T09:47:27Z!carsten.dominik@gmail.com).
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org.texi: Add macros to get plain quotes in PDF output.
+       List additional contributors.
+       (Capture): New section, replaces the section about remember.
+       (Working With Source Code): New chapter, focused on documenting Org
+       Babel.
+       (Code evaluation security): New section.
+       (MobileOrg): Document DropBox support.
+       (TaskJuggler export): Document taskjuggler and Gantt chart support.
+       (Special symbols): Show how to display UTF8 characters for entities.
+       (Global TODO list): Clarify the use of the "M" key and the differences
+       to the "m" key.
+       (RSS Feeds): Mention Atom feeds as well.
+       (Setting tags): Remove paragraph about
+       `org-complete-tags-always-offer-all-agenda-tags'.
+
+2010-07-17  Michael Albinus  <michael.albinus@gmx.de>
+
+       * tramp.texi (Inline methods): Remove remark about doubled "-t"
+       argument.
+       (Frequently Asked Questions): Recommend "sshx" and "scpx" for
+       echoing shells.
+
+2010-07-10  Michael Albinus  <michael.albinus@gmx.de>
+
+       * tramp.texi (Inline methods): Remove "kludgy" phrase.
+       (Filename Syntax): Describe port numbers.
+
+2010-07-09  Michael Albinus  <michael.albinus@gmx.de>
+
+       * dbus.texi (Top): Introduce Index.  Emphasize "nil" whereever
+       forgotten.
+       (Type Conversion): Precise conversion of natural numbers.
+       (Errors and Events): Add "debugging" to concept index.  Add variable
+       `dbus-debug'.
+
+2010-07-04  Michael Albinus  <michael.albinus@gmx.de>
+
+       * dbus.texi (Receiving Method Calls): Add optional argument
+       EMITS-SIGNAL to `dbus-register-property'.
+
 2010-06-27  Alex Schroeder  <alex@gnu.org>
 
        * nxml-mode.texi (Commands for locating a schema): Fix typo.
        * idlwave.texi (Load-Path Shadows):
        * org.texi (Handling links): Fix typos.
 
-2010-05-07  Chong Yidong  <cyd@stupidchicken.com>
+2010-06-07  Teodor Zlatanov  <tzz@lifelogs.com>
 
-       * Version 23.2 released.
+       * gnus.texi (Interactive): Explain effect of gnus-expert-user better.
+
+2010-05-26  Michael Albinus  <michael.albinus@gmx.de>
 
-2010-05-03  Štěpán Němec  <stepnem@gmail.com>  (tiny change)
+       * eshell.texi (Built-ins): Describe, how to disable a built-in command
+       by an alias.  (Bug#6226)
+
+2010-05-16  Jay Belanger  <jay.p.belanger@gmail.com>
+
+       * calc.texi (Manipulating Vectors): Mention that vectors can
+       be used to determine bins for `calc-histogram'.
+
+2010-05-13  Jay Belanger  <jay.p.belanger@gmail.com>
+
+       * calc.texi: Remove "\turnoffactive" commands throughout.
+
+2010-05-08  Štěpán Němec  <stepnem@gmail.com>  (tiny change)
 
        * url.texi (HTTP language/coding, Customization):
        * message.texi (Header Commands, Responses):
        * cl.texi (Argument Lists): Fix typos.
 
-2010-04-18  Chong Yidong  <cyd@stupidchicken.com>
+2010-05-08  Chong Yidong  <cyd@stupidchicken.com>
 
-       * ede.texi (EDE Mode): Refer to init file rather than `.emacs'.  Note
-       that Development menu is always available.
+       * ede.texi (EDE Mode): Refer to init file rather than `.emacs'.
+       Note that Development menu is always available.
        (Creating a project): Fix terminology.
        (Add/Remove files): Fix typo.
 
-2010-04-17  Teodor Zlatanov  <tzz@lifelogs.com>
+2010-05-07  Chong Yidong  <cyd@stupidchicken.com>
+
+       * Version 23.2 released.
+
+2010-05-01  Daniel E. Doherty  <ddoherty03@gmail.com>  (tiny change)
+
+       * calc.texi (Tutorial): Use "^{\prime}" to indicate primes.
+
+2010-05-01  Michael Albinus  <michael.albinus@gmx.de>
+
+       * tramp.texi (Inline methods, Default Method):
+       Mention `tramp-inline-compress-start-size'.
+
+2010-04-18  Teodor Zlatanov  <tzz@lifelogs.com>
 
        * gnus.texi (Gnus Versions, Oort Gnus): Mention the Git repo instead of
        the CVS repo.  Put the Git repo in the news section.
 
-       * gnus-coding.texi (Gnus Maintainance Guide): Fixed title typo.
+       * gnus-coding.texi (Gnus Maintainance Guide): Fix title typo.
        Removed some mentions of CVS.  Mention the new Git repo.
 
-2010-04-15  Andreas Seltenreich  <seltenreich@gmx.de>
+2010-04-18  Andreas Seltenreich  <seltenreich@gmx.de>
 
        * gnus.texi (Score File Format): Fix typo.  Reported by Štěpán Němec.
        (Mail Group Commands): Add index entry.
 
-2010-04-15  Glenn Morris  <rgm@gnu.org>
+2010-04-18  Glenn Morris  <rgm@gnu.org>
 
        * info.texi (Search Index): Mention Emacs's Info-virtual-index.
 
-2010-03-14  Michael Albinus  <michael.albinus@gmx.de>
+2010-04-18  Jay Belanger  <jay.p.belanger@gmail.com>
+
+       * calc.texi (Radix modes): Mention that the option prefix will
+       turn on twos-complement mode.
+       (Inverse and Hyperbolic Flags): Mention the Option flag.
+
+2010-04-15  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org.texi (LaTeX and PDF export): Add a footnote about xetex.
+       (LaTeX/PDF export commands): Rename and Move section.
+       (Sectioning structure): Update.
+       (References): New use case for field coordinates.
+       (The export dispatcher): Rename from ASCII export.
+       (Setting up the staging area): Document the availability of
+       encryption for MobileOrg.
+       (Images and tables): Document how to reference labels.
+       (Index entries): New section.
+       (Generating an index): New section.
+       (Column width and alignment): Document that <N> now
+       means a fixed width, not a maximum width.
+       (Publishing options): Document the :email option.
+       (Beamer class export): Fix bug in the BEAMER example.
+       (Refiling notes): Document refile logging.
+       (In-buffer settings): Document refile logging keywords.
+       (Drawers): Document `C-c C-z' command.
+       (Agenda commands): Mention the alternative key `C-c C-z'.
+       (Special properties): Document the BLOCKED property.
+       (The spreadsheet): Mention the formula editor.
+       (References): Document field coordinates.
+       (Publishing action): Correct the documentation for the
+       publishing function.
+       (The date/time prompt): Document that we accept dates
+       like month/day/year.
+       (Cooperation): Document the changes in table.el support.
+       (Faces for TODO keywords, Faces for TODO keywords)
+       (Priorities): Document the easy colors.
+       (Visibility cycling): Document the new double prefix
+       arg for `org-reveal'.
+       (Cooperation): Remember.el is part of Emacs.
+       (Clean view): Mention that `wrap-prefix' is also set by
+       org-indent-mode.
+       (Agenda commands): Add information about prefix args to
+       scheduling and deadline commands.
+       (Search view): Point to the docstring of
+       `org-search-view' for more details.
+       (Agenda commands): Document that `>' prompts for a date.
+       (Setting tags): Document variable
+       org-complete-tags-always-offer-all-agenda-tags.
+       (Column attributes): Cross-reference special properties.
+
+2010-04-10  Michael Albinus  <michael.albinus@gmx.de>
+
+       Synchronize with Tramp repository.
+
+       * tramp.texi (Auto-save and Backup): Remove reference to Emacs 21.
+       (Frequently Asked Questions): Adapt supported (X)Emacs versions.  Adapt
+       supported MS Windows versions.  Remove obsolete URL.  Use the $()
+       syntax, texi2dvi reports errors with the backquotes.
+
+       * trampver.texi: Update release number.
+
+2010-04-01  Teodor Zlatanov  <tzz@lifelogs.com>
+
+       * gnus.texi (Finding the News): Add pointers to the Server buffer
+       because it's essential.
+
+2010-03-31  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * gnus.texi (MIME Commands): Update description of
+       gnus-article-browse-html-article.
+
+2010-03-27  Teodor Zlatanov  <tzz@lifelogs.com>
+
+       * auth.texi (Secret Service API): Add TODO node.
+       (Help for users): Explain the new source options for `auth-sources'.
+
+2010-03-24  Michael Albinus  <michael.albinus@gmx.de>
 
        * trampver.texi: Update release number.
 
+2010-03-10  Chong Yidong  <cyd@stupidchicken.com>
+
+       * Branch for 23.2.
+
 2010-03-03  Chong Yidong  <cyd@stupidchicken.com>
 
        * faq.texi (Escape sequences in shell output): Note that ansi-color is
 2010-01-17  Michael Albinus  <michael.albinus@gmx.de>
 
        * tramp.texi (Frequently Asked Questions): Add GNU Emacs 23 and
-       SXEmacs 22 to the supported systems.  New item for hung ssh sessions.
+       SXEmacs 22 to the supported systems.  New item for hung ssh sessions.
 
 2010-01-17  Glenn Morris  <rgm@gnu.org>
 
        (Agenda commands): Document new bulk commands.
        (Plain lists): Document new behavior of
        `org-cycle-include-plain-lists'.
-        Hyphenation only in TeX.
+       Hyphenation only in TeX.
        (Clocking work time): Document the key to update effort
        estimates.
        (Clocking work time): Document the clock time display.
 2008-06-15  Reiner Steib  <Reiner.Steib@gmx.de>
 
        * gnus.texi (Mail Source Customization): Correct values of
-        `mail-source-delete-incoming'.  Reported by Tassilo Horn.
+       `mail-source-delete-incoming'.  Reported by Tassilo Horn.
        (Oort Gnus): Fix version comment for mml-dnd-protocol-alist.
 
 2008-06-14  Reiner Steib  <Reiner.Steib@gmx.de>
 
        * gnus-news.texi, gnus-coding.texi, sasl.texi: New files.
 
-2007-10-28  Emanuele Giaquinta  <e.giaquinta@glauco.it>  (tiny change)
-
-       * gnus-faq.texi ([5.12]): Remove reference to discontinued service.
-
 2007-10-28  Reiner Steib  <Reiner.Steib@gmx.de>
 
        * gnus.texi (Sorting the Summary Buffer): Remove
 
        * org.texi (Progress logging): New section.
 
-2006-05-29  Stefan Monnier  <monnier@iro.umontreal.ca>
-
-       * viper.texi (Viper Specials):
-       * gnus.texi (Example Setup):
-       * faq.texi (Backspace invokes help):
-       * dired-x.texi (Optional Installation Dired Jump):
-       * calc.texi (Defining Simple Commands): Use ;; instead of ;;; to better
-       follow coding conventions.
-
-2006-05-18  Reiner Steib  <Reiner.Steib@gmx.de>
-
-       * gnus.texi (Saving Articles): Clarify gnus-summary-save-article-mail.
-
 2006-06-06  Carsten Dominik  <dominik@science.uva.nl>
 
        * org.texi (ASCII export): Document indentation adaptation.
 
        * org.texi: Small typo fixes.
 
+2006-05-29  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * viper.texi (Viper Specials):
+       * gnus.texi (Example Setup):
+       * faq.texi (Backspace invokes help):
+       * dired-x.texi (Optional Installation Dired Jump):
+       * calc.texi (Defining Simple Commands): Use ;; instead of ;;; to better
+       follow coding conventions.
+
 2006-05-29  Michael Albinus  <michael.albinus@gmx.de>
 
        * tramp.texi (Frequently Asked Questions): Disable zsh zle.
 
        * gnus.texi (Article Washing): Additions.
 
-2006-01-08  Alex Schroeder  <alex@gnu.org>
-
-       * pgg.texi (Caching passphrase): Rewording.
-
 2006-01-13  Carsten Dominik  <dominik@science.uva.nl>
 
        * org.texi (Agenda commands): Document tags command.
 
        * org.texi (FAQ): Document `org-table-tab-jumps-over-hlines'.
        (Agenda): Document commands `org-cycle-agenda-files' and
-       `org-agenda-file-to-front'
+       `org-agenda-file-to-front'.
        (Built-in table editor): Document `org-table-sort-lines'.
        (HTML formatting): Export of hand-formatted lists.
 
 
 2000-12-14  Dave Love  <fx@gnu.org>
 
-       * Makefile.in (mostlyclean): Remove gnustmp.*
+       * Makefile.in (mostlyclean): Remove gnustmp.*.
        (gnus.dvi): Change rule to remove @latex stuff.
 
 2000-10-19  Eric M. Ludlam  <zappo@ultranet.com>
index 2bd79ccdee32c86d4fc7b55660ab6c46dc860f16..85e691d4b62968722be53c51e81cfd3afc2df344 100644 (file)
@@ -57,6 +57,7 @@ It is a way for multiple applications to share a single configuration
 @menu
 * Overview::                    Overview of the auth-source library.
 * Help for users::              
+* Secret Service API::          
 * Help for developers::         
 * Index::                       
 * Function Index::              
@@ -68,15 +69,15 @@ It is a way for multiple applications to share a single configuration
 @chapter Overview
 
 The auth-source library is simply a way for Emacs and Gnus, among
-others, to find the answer to the old burning question ``I have a
-server name and a port, what are my user name and password?''
+others, to answer the old burning question ``I have a server name and
+a port, what are my user name and password?''
 
 The auth-source library actually supports more than just the user name
 (known as the login) or the password, but only those two are in use
-today in Emacs or Gnus.  Similarly, the auth-source library can in
-theory support multiple storage formats, but currently it only
-understands the classic ``netrc'' format, examples of which you can
-see later in this document.
+today in Emacs or Gnus.  Similarly, the auth-source library supports
+multiple storage formats, currently either the classic ``netrc''
+format, examples of which you can see later in this document, or the
+Secret Service API.
 
 @node Help for users
 @chapter Help for users
@@ -120,17 +121,21 @@ auth-source library is not loaded for some other reason.
 @defvar auth-sources
 
 The @code{auth-sources} variable tells the auth-source library where
-your netrc files live for a particular host and protocol.  While you
-can get fancy, the default and simplest configuration is:
+your netrc files or Secret Service API collection items live for a
+particular host and protocol.  While you can get fancy, the default
+and simplest configuration is:
 
 @lisp
+;;; old default: required :host and :protocol, not needed anymore
 (setq auth-sources '((:source "~/.authinfo.gpg" :host t :protocol t)))
+;;; mostly equivalent (see below about fallbacks) but shorter:
+(setq auth-sources '((:source "~/.authinfo.gpg")))
 @end lisp
 
 This says ``for any host and any protocol, use just that one file.''
-Sweet simplicity.  In fact, this is already the default, so unless you
-want to move your netrc file, it will just work if you have that
-file.  You may not, though, so make sure it exists.
+Sweet simplicity.  In fact, the latter is already the default, so
+unless you want to move your netrc file, it will just work if you have
+that file.  Make sure it exists.
 
 By adding multiple entries to @code{auth-sources} with a particular
 host or protocol, you can have specific netrc files for that host or
@@ -138,6 +143,35 @@ protocol.  Usually this is unnecessary but may make sense if you have
 shared netrc files or some other unusual setup (90% of Emacs users
 have unusual setups and the remaining 10% are @emph{really} unusual).
 
+Here's an example that uses the Secret Service API for all lookups,
+using the default collection:
+
+@lisp
+(setq auth-sources '((:source (:secrets default))))
+@end lisp
+
+And here's a mixed example, using two sources:
+
+@lisp
+(setq auth-sources '((:source (:secrets default) :host "myserver" :user "joe")
+                     (:source "~/.authinfo.gpg")))
+@end lisp
+
+The best match is determined by order (starts from the bottom) only
+for the first pass, where things are checked exactly.  In the example
+above, the first pass would find a single match for host
+@code{myserver}.  The netrc choice would fail because it matches any
+host and protocol implicitly (as a @emph{fallback}).  A specified
+value of @code{:host t} in @code{auth-sources} is considered a match
+on the first pass, unlike a missing @code{:host}.
+
+Now if you look for host @code{missing}, it won't match either source
+explicitly.  The second pass (the @emph{fallback} pass) will look at
+all the implicit matches and collect them.  They will be scored and
+returned sorted by score.  The score is based on the number of
+explicit parameters that matched. See the @code{auth-pick} function
+for details.
+
 @end defvar
 
 If you don't customize @code{auth-sources}, you'll have to live with
@@ -190,25 +224,32 @@ don't use a port entry, you match any Tramp method, as explained
 earlier.  Since Tramp has about 88 connection methods, this may be
 necessary if you have an unusual (see earlier comment on those) setup.
 
+@node Secret Service API
+@chapter Secret Service API
+
+TODO: how does it work generally, how does secrets.el work, some examples.
+
 @node Help for developers
 @chapter Help for developers
 
 The auth-source library only has one function for external use.
 
-@defun auth-source-user-or-password mode host port
+@defun auth-source-user-or-password mode host port &optional username
 
 Retrieve appropriate authentication tokens, determined by @var{mode},
-for host @var{host} and @var{port}.  If @code{auth-source-debug} is t,
-debugging messages will be printed.  Set @code{auth-source-debug} to a
-function to use that function for logging.  The parameters passed will
-be the same that the @code{message} function takes, that is, a string
+for host @var{host} and @var{port}.  If @var{username} is provided it
+will also be checked.  If @code{auth-source-debug} is t, debugging
+messages will be printed.  Set @code{auth-source-debug} to a function
+to use that function for logging.  The parameters passed will be the
+same that the @code{message} function takes, that is, a string
 formatting spec and optional parameters.
 
 If @var{mode} is a list of strings, the function will return a list of
 strings or @code{nil} objects (thus you can avoid parsing the netrc
-file more than once).  If it's a string, the function will return a
-string or a @code{nil} object.  Currently only the modes ``login'' and
-``password'' are recognized but more may be added in the future.
+file or checking the Secret Service API more than once).  If it's a
+string, the function will return a string or a @code{nil} object.
+Currently only the modes ``login'' and ``password'' are recognized but
+more may be added in the future.
 
 @var{host} is a string containing the host name.
 
@@ -216,6 +257,8 @@ string or a @code{nil} object.  Currently only the modes ``login'' and
 a port number.  It must be a string, corresponding to the port in the
 users' netrc files.
 
+@var{username} contains the user name (e.g. ``joe'') as a string.
+
 @example
 ;; IMAP example
 (setq auth (auth-source-user-or-password
index b410a6b31bb0e6bf45b3eb07c6834ac9b0075a4a..f0b79e95dc82b55ec227cbe06ca9fb5e1295155e 100644 (file)
@@ -76,7 +76,6 @@
 @newcount@calcpageno
 @newtoks@calcoldeverypar @calcoldeverypar=@everypar
 @everypar={@calceverypar@the@calcoldeverypar}
-@ifx@turnoffactive@undefinedzzz@def@turnoffactive{}@fi
 @ifx@ninett@undefinedzzz@font@ninett=cmtt9@fi
 @catcode`@\=0 \catcode`\@=11
 \r@ggedbottomtrue
@@ -1804,7 +1803,6 @@ or, in large mathematical notation,
 @end example
 @end ifnottex
 @tex
-\turnoffactive
 \beforedisplay
 $$ 2 + { 3 \times 4 \times 5 \over 6 \times 7^8 } - 9 $$
 \afterdisplay
@@ -3358,7 +3356,6 @@ Suppose we had the following set of equations:
 @end group
 @end ifnottex
 @tex
-\turnoffactive
 \beforedisplayh
 $$ \openup1\jot \tabskip=0pt plus1fil
 \halign to\displaywidth{\tabskip=0pt
@@ -3385,7 +3382,6 @@ This can be cast into the matrix equation,
 @end group
 @end ifnottex
 @tex
-\turnoffactive
 \beforedisplay
 $$ \pmatrix{ 1 & 2 & 3 \cr 4 & 5 & 6 \cr 7 & 6 & 0 }
    \times
@@ -3457,7 +3453,6 @@ in terms of @expr{a} and @expr{b}.
 @end group
 @end ifnottex
 @tex
-\turnoffactive
 \beforedisplay
 $$ \eqalign{ x &+ a y = 6 \cr
              x &+ b y = 10}
@@ -3483,7 +3478,6 @@ on the left by the transpose of @expr{A}:
 @samp{trn(A)*A*X = trn(A)*B}.
 @end ifnottex
 @tex
-\turnoffactive
 $A^T A \, X = A^T B$, where $A^T$ is the transpose \samp{trn(A)}.
 @end tex
 Now 
@@ -3506,7 +3500,6 @@ system:
 @end group
 @end ifnottex
 @tex
-\turnoffactive
 \beforedisplayh
 $$ \openup1\jot \tabskip=0pt plus1fil
 \halign to\displaywidth{\tabskip=0pt
@@ -3778,7 +3771,6 @@ m = (N sum(x y) - sum(x) sum(y)) / (N sum(x^2) - sum(x)^2)
 @end example
 @end ifnottex
 @tex
-\turnoffactive
 \beforedisplay
 $$ m = {N \sum x y - \sum x \sum y  \over
         N \sum x^2 - \left( \sum x \right)^2} $$
@@ -3820,7 +3812,6 @@ respectively.  (We could have used @kbd{*} to compute @samp{sum(x^2)} and
 @samp{sum(x y)}.)
 @end ifnottex
 @tex
-\turnoffactive
 These are $\sum x$, $\sum x^2$, $\sum y$, and $\sum x y$,
 respectively.  (We could have used \kbd{*} to compute $\sum x^2$ and
 $\sum x y$.)
@@ -3874,7 +3865,6 @@ b = (sum(y) - m sum(x)) / N
 @end example
 @end ifnottex
 @tex
-\turnoffactive
 \beforedisplay
 $$ b = {\sum y - m \sum x \over N} $$
 \afterdisplay
@@ -5223,7 +5213,6 @@ down to the formula,
 @end example
 @end ifnottex
 @tex
-\turnoffactive
 \beforedisplay
 $$ \displaylines{
       \qquad {h \over 3} (f(a) + 4 f(a+h) + 2 f(a+2h) + 4 f(a+3h) + \cdots
@@ -5245,7 +5234,6 @@ h * (f(a) + f(a+h) + f(a+2h) + f(a+3h) + ...
 @end example
 @end ifnottex
 @tex
-\turnoffactive
 \beforedisplay
 $$ h (f(a) + f(a+h) + f(a+2h) + f(a+3h) + \cdots
            + f(a+(n-2)h) + f(a+(n-1)h)) $$
@@ -5686,7 +5674,6 @@ cos(x) = 1 - x^2 / 2! + x^4 / 4! - x^6 / 6! + ...
 @end example
 @end ifnottex
 @tex
-\turnoffactive
 \beforedisplay
 $$ \cos x = 1 - {x^2 \over 2!} + {x^4 \over 4!} - {x^6 \over 6!} + \cdots $$
 \afterdisplay
@@ -5704,7 +5691,6 @@ cos(x) = 1 - x^2 / 2! + O(x^3)
 @end example
 @end ifnottex
 @tex
-\turnoffactive
 \beforedisplay
 $$ \cos x = 1 - {x^2 \over 2!} + O(x^3) $$
 \afterdisplay
@@ -6234,7 +6220,7 @@ new_x = x - f(x)/f'(x)
 @end ifnottex
 @tex
 \beforedisplay
-$$ x_{\rm new} = x - {f(x) \over f'(x)} $$
+$$ x_{\rm new} = x - {f(x) \over f^{\prime}(x)} $$
 \afterdisplay
 @end tex
 
@@ -6336,7 +6322,6 @@ s(n+1,m) = s(n,m-1) - n s(n,m)   for n >= m >= 1.
 @end example
 @end ifnottex
 @tex
-\turnoffactive
 \beforedisplay
 $$ \eqalign{ s(n,n)   &= 1 \qquad \hbox{for } n \ge 0,  \cr
              s(n,0)   &= 0 \qquad \hbox{for } n > 0, \cr
@@ -6875,7 +6860,6 @@ get the row sum.  Similarly, use @kbd{[1 1] r 4 *} to get the column sum.
 @end example
 @end ifnottex
 @tex
-\turnoffactive
 \beforedisplay
 $$ \eqalign{ x &+ a y = 6 \cr
              x &+ b y = 10}
@@ -6939,7 +6923,6 @@ which we can solve using Calc's @samp{/} command.
 @end example
 @end ifnottex
 @tex
-\turnoffactive
 \beforedisplayh
 $$ \openup1\jot \tabskip=0pt plus1fil
 \halign to\displaywidth{\tabskip=0pt
@@ -7074,7 +7057,6 @@ the first job is to form the matrix that describes the problem.
 @end example
 @end ifnottex
 @tex
-\turnoffactive
 \beforedisplay
 $$ m \times x + b \times 1 = y $$
 \afterdisplay
@@ -7865,7 +7847,6 @@ So the result when we take the modulo after every step is,
 @end example
 @end ifnottex
 @tex
-\turnoffactive
 \beforedisplay
 $$ 3 (3 a + b - 511 m) + c - 511 n $$
 \afterdisplay
@@ -7881,7 +7862,6 @@ the distributive law yields
 @end example
 @end ifnottex
 @tex
-\turnoffactive
 \beforedisplay
 $$ 9 a + 3 b + c - 511\times3 m - 511 n $$
 \afterdisplay
@@ -7899,9 +7879,8 @@ term.  So we can take it out to get an equivalent formula with
 @end example
 @end ifnottex
 @tex
-\turnoffactive
 \beforedisplay
-$$ 9 a + 3 b + c - 511 n' $$
+$$ 9 a + 3 b + c - 511 n^{\prime} $$
 \afterdisplay
 @end tex
 
@@ -12167,7 +12146,7 @@ You are prompted for a file name.  All Calc modes are then reset to
 their default values, then settings from the file you named are loaded
 if this file exists, and this file becomes the one that Calc will
 use in the future for commands like @kbd{m m}.  The default settings
-file name is @file{~/.calc.el}.  You can see the current file name by
+file name is @file{~/.emacs.d/calc.el}.  You can see the current file name by
 giving a blank response to the @kbd{m F} prompt.  See also the
 discussion of the @code{calc-settings-file} variable; @pxref{Customizing Calc}.
 
@@ -12289,15 +12268,21 @@ may be executed with @kbd{x} or @kbd{M-x}.  Their effect is simply to
 toggle the Inverse and/or Hyperbolic flags and then execute the
 corresponding base command (@code{calc-sin} in this case).
 
-The Inverse and Hyperbolic flags apply only to the next Calculator
-command, after which they are automatically cleared.  (They are also
-cleared if the next keystroke is not a Calc command.)  Digits you
-type after @kbd{I} or @kbd{H} (or @kbd{K}) are treated as prefix
-arguments for the next command, not as numeric entries.  The same
-is true of @kbd{C-u}, but not of the minus sign (@kbd{K -} means to
-subtract and keep arguments).
-
-The third Calc prefix flag, @kbd{K} (keep-arguments), is discussed
+@kindex O
+@pindex calc-option
+The @kbd{O} key (@code{calc-option}) sets another flag, the
+@dfn{Option Flag}, which also can alter the subsequent Calc command in
+various ways. 
+
+The Inverse, Hyperbolic and Option flags apply only to the next
+Calculator command, after which they are automatically cleared.  (They
+are also cleared if the next keystroke is not a Calc command.)  Digits
+you type after @kbd{I}, @kbd{H} or @kbd{O} (or @kbd{K}) are treated as
+prefix arguments for the next command, not as numeric entries.  The
+same is true of @kbd{C-u}, but not of the minus sign (@kbd{K -} means
+to subtract and keep arguments).
+
+Another Calc prefix flag, @kbd{K} (keep-arguments), is discussed
 elsewhere.  @xref{Keep Arguments}.
 
 @node Calculation Modes, Simplification Modes, Inverse and Hyperbolic, Mode Settings
@@ -13175,12 +13160,13 @@ in the current radix.  (Larger integers will still be displayed in their
 entirety.) 
 
 @cindex Two's complements
-With the binary, octal and hexadecimal display modes, Calc can
-display @expr{w}-bit integers using two's complement notation.  This
-option is selected with the key sequences @kbd{C-u d 2}, @kbd{C-u d 8}
-and @kbd{C-u d 6}, respectively, and a negative word size might be
-appropriate (@pxref{Binary Functions}). In two's complement 
-notation, the integers in the (nearly) symmetric interval from
+Calc can display @expr{w}-bit integers using two's complement
+notation, although this is most useful with the binary, octal and
+hexadecimal display modes.  This option is selected by using the
+@kbd{O} option prefix before setting the display radix, and a negative word
+size might be appropriate (@pxref{Binary Functions}). In two's
+complement notation, the integers in the (nearly) symmetric interval
+from
 @texline @math{-2^{w-1}}
 @infoline @expr{-2^(w-1)}
 to
@@ -14401,7 +14387,6 @@ $$ \sin\left( a^2 \over b_i \right) $$
 @end group
 @end example
 @tex
-\turnoffactive
 $$ [3 + 4i, {3 \over 4}, 3 \pm 4, [ 3 \ldots \infty)] $$
 @end tex
 @sp 1
@@ -14427,7 +14412,6 @@ $$ [|a|, \left| a \over b \right|,
 @end group
 @end example
 @tex
-\turnoffactive
 $$ [\sin{a}, \sin{2 a}, \sin(2 + a), \sin\left( {a \over b} \right)] $$
 @end tex
 @sp 2
@@ -14460,7 +14444,6 @@ First with @samp{\def\evalto@{@}}, then with @samp{\def\evalto#1\to@{@}}:
 @end group
 @end example
 @tex
-\turnoffactive
 $$ 2 + 3 \to 5 $$
 $$ 5 $$
 @end tex
@@ -14475,7 +14458,6 @@ First with standard @code{\to}, then with @samp{\let\to\Rightarrow}:
 @end group
 @end example
 @tex
-\turnoffactive
 $$ [{2 + 3 \to 5}, {{a \over 2} \to {b + c \over 2}}] $$
 {\let\to\Rightarrow
 $$ [{2 + 3 \to 5}, {{a \over 2} \to {b + c \over 2}}] $$}
@@ -14492,7 +14474,6 @@ Matrices normally, then changing @code{\matrix} to @code{\pmatrix}:
 @end group
 @end example
 @tex
-\turnoffactive
 $$ \matrix{ {a \over b} & 0 \cr 0 & 2^{(x + 1)} } $$
 $$ \pmatrix{ {a \over b} & 0 \cr 0 & 2^{(x + 1)} } $$
 @end tex
@@ -16006,7 +15987,7 @@ No line breaking (@kbd{d b}).
 Selections show deep structure (@kbd{j b}; @pxref{Making Selections}).
 
 @item Save
-Record modes in @file{~/.calc.el} (@kbd{m R}; @pxref{General Mode Commands}).
+Record modes in @file{~/.emacs.d/calc.el} (@kbd{m R}; @pxref{General Mode Commands}).
 
 @item Local
 Record modes in Embedded buffer (@kbd{m R}).
@@ -17928,7 +17909,6 @@ ddb(cost, salv, life, per) = --------,  book = cost - depreciation so far
 @end example
 @end ifnottex
 @tex
-\turnoffactive
 $$ \code{fv}(r, n, p) = p { (1 + r)^n - 1 \over r } $$
 $$ \code{fvb}(r, n, p) = p { ((1 + r)^n - 1) (1 + r) \over r } $$
 $$ \code{fvl}(r, n, p) = p (1 + r)^n $$
@@ -18584,7 +18564,6 @@ letter gamma).  You can obtain these using the @kbd{H f G} [@code{gammag}]
 and @kbd{H I f G} [@code{gammaG}] commands.
 @end ifnottex
 @tex
-\turnoffactive
 The functions corresponding to the integrals that define $P(a,x)$
 and $Q(a,x)$ but without the normalizing $1/\Gamma(a)$
 factor are called $\gamma(a,x)$ and $\Gamma(a,x)$, respectively.
@@ -20051,6 +20030,20 @@ range are ignored.  (You can tell if elements have been ignored by noting
 that the counts in the result vector don't add up to the length of the
 input vector.)
 
+If no prefix is given, then you will be prompted for a vector which
+will be used to determine the bins. (If a positive integer is given at
+this prompt, it will be still treated as if it were given as a
+prefix.)  Each bin will consist of the interval of numbers closest to
+the corresponding number of this new vector; if the vector 
+@expr{[a, b, c, ...]} is entered at the prompt, the bins will be 
+@expr{(-inf, (a+b)/2]}, @expr{((a+b)/2, (b+c)/2]}, etc.  The result of 
+this command will be a vector counting how many elements of the
+original vector are in each bin.
+
+The result will then be a vector with the same length as this new vector;
+each element of the new vector will be replaced by the number of
+elements of the original vector which are closest to it.
+
 @kindex H v H
 @kindex H V H
 With the Hyperbolic flag, @kbd{H V H} pulls two vectors from the stack.
@@ -20552,7 +20545,6 @@ this is the weighted mean of the @expr{x} values with weights
 @texline @math{1 /\sigma^2}.
 @infoline @expr{1 / s^2}.
 @tex
-\turnoffactive
 $$ \mu = { \displaystyle \sum { x_i \over \sigma_i^2 } \over
            \displaystyle \sum { 1 \over \sigma_i^2 } } $$
 @end tex
@@ -20586,7 +20578,6 @@ root of the reciprocal of the sum of the reciprocals of the squares
 of the input errors.  (I.e., the variance is the reciprocal of the
 sum of the reciprocals of the variances.)
 @tex
-\turnoffactive
 $$ \sigma_\mu^2 = {1 \over \displaystyle \sum {1 \over \sigma_i^2}} $$
 @end tex
 If the inputs are plain
@@ -20596,7 +20587,6 @@ out to be equivalent to calculating the standard deviation and
 then assuming each value's error is equal to this standard
 deviation.)
 @tex
-\turnoffactive
 $$ \sigma_\mu^2 = {\sigma^2 \over N} $$
 @end tex
 
@@ -20629,7 +20619,6 @@ command computes the harmonic mean of the data values.  This is
 defined as the reciprocal of the arithmetic mean of the reciprocals
 of the values.
 @tex
-\turnoffactive
 $$ { N \over \displaystyle \sum {1 \over x_i} } $$
 @end tex
 
@@ -20643,7 +20632,6 @@ is the @var{n}th root of the product of the values.  This is also
 equal to the @code{exp} of the arithmetic mean of the logarithms
 of the data values.
 @tex
-\turnoffactive
 $$ \exp \left ( \sum { \ln x_i } \right ) =
    \left ( \prod { x_i } \right)^{1 / N} $$
 @end tex
@@ -20655,7 +20643,6 @@ mean'' of two numbers taken from the stack.  This is computed by
 replacing the two numbers with their arithmetic mean and geometric
 mean, then repeating until the two values converge.
 @tex
-\turnoffactive
 $$ a_{i+1} = { a_i + b_i \over 2 } , \qquad b_{i+1} = \sqrt{a_i b_i} $$
 @end tex
 
@@ -20678,7 +20665,6 @@ deviation, whose value is the square root of the sum of the squares of
 the differences between the values and the mean of the @expr{N} values,
 divided by @expr{N-1}.
 @tex
-\turnoffactive
 $$ \sigma^2 = {1 \over N - 1} \sum (x_i - \mu)^2 $$
 @end tex
 
@@ -20705,7 +20691,6 @@ is used when the input represents a sample of the set of all
 data values, so that the mean computed from the input is itself
 only an estimate of the true mean.
 @tex
-\turnoffactive
 $$ \sigma^2 = {1 \over N} \sum (x_i - \mu)^2 $$
 @end tex
 
@@ -20770,7 +20755,6 @@ are composed of error forms, the error for a given data point
 is taken as the square root of the sum of the squares of the two
 input errors.
 @tex
-\turnoffactive
 $$ \sigma_{x\!y}^2 = {1 \over N-1} \sum (x_i - \mu_x) (y_i - \mu_y) $$
 $$ \sigma_{x\!y}^2 =
     {\displaystyle {1 \over N-1}
@@ -20798,7 +20782,6 @@ This is defined by the covariance of the vectors divided by the
 product of their standard deviations.  (There is no difference
 between sample or population statistics here.)
 @tex
-\turnoffactive
 $$ r_{x\!y} = { \sigma_{x\!y}^2 \over \sigma_x^2 \sigma_y^2 } $$
 @end tex
 
 
 @noindent
 Every character not part of the sub-formula @samp{b} has been changed
-to a dot.  The @samp{*} next to the line number is to remind you that
+to a dot. (If the customizable variable
+@code{calc-highlight-selections-with-faces} is non-nil, then the characters
+not part of the sub-formula are de-emphasized by using a less
+noticeable face instead of using dots. @pxref{Displaying Selections}.)
+The @samp{*} next to the line number is to remind you that
 the formula has a portion of it selected.  (In this case, it's very
 obvious, but it might not always be.  If Embedded mode is enabled,
 the word @samp{Sel} also appears in the mode line because the stack
@@ -21743,6 +21730,9 @@ of the hierarchy simply by pointing to it with the cursor.
 @noindent
 @kindex j d
 @pindex calc-show-selections
+@vindex calc-highlight-selections-with-faces
+@vindex calc-selected-face
+@vindex calc-nonselected-face
 The @kbd{j d} (@code{calc-show-selections}) command controls how
 selected sub-formulas are displayed.  One of the alternatives is
 illustrated in the above examples; if we press @kbd{j d} we switch
@@ -21757,6 +21747,13 @@ by @samp{#} signs:
         . . . .                   2 x + 1
 @end group
 @end smallexample
+If the customizable variable
+@code{calc-highlight-selections-with-faces} is non-nil, then the
+non-selected portion of the formula will be de-emphasized by using a
+less noticeable face (@code{calc-nonselected-face}) instead of dots
+and the selected sub-formula will be highlighted by using a more
+noticeable face (@code{calc-selected-face}) instead of @samp{#}
+signs. (@pxref{Customizing Calc}.)
 
 @node Operating on Selections, Rearranging with Selections, Displaying Selections, Selecting Subformulas
 @subsection Operating on Selections
@@ -24354,8 +24351,6 @@ For example, suppose the data matrix
 @end example
 @end ifnottex
 @tex
-\turnoffactive
-\turnoffactive
 \beforedisplay
 $$ \pmatrix{ 1 & 2 & 3 & 4  & 5  \cr
              5 & 7 & 9 & 11 & 13 }
@@ -24415,7 +24410,6 @@ chi^2 = sum((y_i - (a + b x_i))^2, i, 1, N)
 @end example
 @end ifnottex
 @tex
-\turnoffactive
 \beforedisplay
 $$ \chi^2 = \sum_{i=1}^N (y_i - (a + b x_i))^2 $$
 \afterdisplay
@@ -24606,7 +24600,6 @@ chi^2 = sum(((y_i - (a + b x_i)) / sigma_i)^2, i, 1, N)
 @end example
 @end ifnottex
 @tex
-\turnoffactive
 \beforedisplay
 $$ \chi^2 = \sum_{i=1}^N \left(y_i - (a + b x_i) \over \sigma_i\right)^2 $$
 \afterdisplay
@@ -25381,7 +25374,6 @@ any later ones are answered by reading additional elements from
 the stack.  Thus, @kbd{' k^2 @key{RET} ' k @key{RET} 1 @key{RET} 5 @key{RET} a + @key{RET}}
 produces the result 55.
 @tex
-\turnoffactive
 $$ \sum_{k=1}^5 k^2 = 55 $$
 @end tex
 
@@ -28108,7 +28100,7 @@ possible to create user-defined temperature units.
 @cindex Calc init file, user-defined units
 The @kbd{u p} (@code{calc-permanent-units}) command stores the user-defined
 units in your Calc init file (the file given by the variable
-@code{calc-settings-file}, typically @file{~/.calc.el}), so that the
+@code{calc-settings-file}, typically @file{~/.emacs.d/calc.el}), so that the
 units will still be available in subsequent Emacs sessions.  If there
 was already a set of user-defined units in your Calc init file, it
 is replaced by the new set.  (@xref{General Mode Commands}, for a way to
@@ -28509,7 +28501,7 @@ names rather than prompting for the variable name.
 @cindex Calc init file, variables
 The @kbd{s p} (@code{calc-permanent-variable}) command saves a
 variable's value permanently in your Calc init file (the file given by
-the variable @code{calc-settings-file}, typically @file{~/.calc.el}), so
+the variable @code{calc-settings-file}, typically @file{~/.emacs.d/calc.el}), so
 that its value will still be available in future Emacs sessions.  You
 can re-execute @w{@kbd{s p}} later on to update the saved value, but the
 only way to remove a saved variable is to edit your calc init file
@@ -30862,7 +30854,7 @@ Two more mode-recording modes selectable by @kbd{m R} are available
 which are also available outside of Embedded mode.  
 (@pxref{General Mode Commands}.) They are @code{Save},  in which mode
 settings are recorded permanently in your Calc init file (the file given
-by the variable @code{calc-settings-file}, typically @file{~/.calc.el})
+by the variable @code{calc-settings-file}, typically @file{~/.emacs.d/calc.el})
 rather than by annotating the current document, and no-recording
 mode (where there is no symbol like @code{Save} or @code{Local} in
 the mode line), in which mode-changing commands do not leave any
@@ -31122,7 +31114,7 @@ The @kbd{Z P} (@code{calc-user-define-permanent}) command makes a key
 binding permanent so that it will remain in effect even in future Emacs
 sessions.  (It does this by adding a suitable bit of Lisp code into
 your Calc init file; that is, the file given by the variable
-@code{calc-settings-file}, typically @file{~/.calc.el}.)  For example,
+@code{calc-settings-file}, typically @file{~/.emacs.d/calc.el}.)  For example,
 @kbd{Z P s} would register our @code{sincos} command permanently.  If
 you later wish to unregister this command you must edit your Calc init
 file by hand.  (@xref{General Mode Commands}, for a way to tell Calc to
@@ -31855,7 +31847,7 @@ step of @code{myfact} could have been written
 
 A good place to put your @code{defmath} commands is your Calc init file
 (the file given by @code{calc-settings-file}, typically
-@file{~/.calc.el}), which will not be loaded until Calc starts.
+@file{~/.emacs.d/calc.el}), which will not be loaded until Calc starts.
 If a file named @file{.emacs} exists in your home directory, Emacs reads
 and executes the Lisp forms in this file as it starts up.  While it may
 seem reasonable to put your favorite @code{defmath} commands there,
@@ -34933,7 +34925,7 @@ character of the prefix can simply be typed twice.
 
 Calc is controlled by many variables, most of which can be reset
 from within Calc.  Some variables are less involved with actual
-calculation, and can be set outside of Calc using Emacs's
+calculation and can be set outside of Calc using Emacs's
 customization facilities.  These variables are listed below.
 Typing @kbd{M-x customize-variable RET @var{variable-name} RET}
 will bring up a buffer in which the variable's value can be redefined.
@@ -34956,7 +34948,9 @@ If @code{calc-settings-file} is not your user init file (typically
 @code{nil}, then Calc will automatically load your settings file (if it
 exists) the first time Calc is invoked.
 
-The default value for this variable is @code{"~/.calc.el"}.
+The default value for this variable is @code{"~/.emacs.d/calc.el"}
+unless the file @file{~/.calc.el} exists, in which case the default
+value will be @code{"~/.calc.el"}.
 @end defvar
 
 @defvar calc-gnuplot-name
@@ -35217,6 +35211,23 @@ should also be added to @code{calc-embedded-announce-formula-alist}
 and @code{calc-embedded-open-close-plain-alist}.
 @end defvar
 
+@defvar calc-highlight-selections-with-faces
+@defvarx calc-selected-face
+@defvarx calc-nonselected-face
+See @ref{Displaying Selections}.@*
+The variable @code{calc-highlight-selections-with-faces} 
+determines how selected sub-formulas are distinguished.
+If @code{calc-highlight-selections-with-faces} is nil, then 
+a selected sub-formula is distinguished either by changing every
+character not part of the sub-formula with a dot or by changing every
+character in the sub-formula with a @samp{#} sign.  
+If @code{calc-highlight-selections-with-faces} is t,
+then a selected sub-formula is distinguished either by displaying the
+non-selected portion of the formula with @code{calc-nonselected-face} 
+or by displaying the selected sub-formula with
+@code{calc-nonselected-face}.
+@end defvar
+
 @defvar calc-multiplication-has-precedence
 The variable @code{calc-multiplication-has-precedence} determines
 whether multiplication has precedence over division in algebraic
@@ -35459,6 +35470,7 @@ keystrokes are not listed in this summary.
 @r{       @:      M     @:             @:        @:calc-more-recursion-depth@:}
 @r{       @:    I M     @:             @:        @:calc-less-recursion-depth@:}
 @r{      a@:      N     @:             @:     5  @:evalvn@:(a)}
+@r{       @:      O     @:command      @:    32  @:@:Option}
 @r{       @:      P     @:             @:        @:@:pi}
 @r{       @:    I P     @:             @:        @:@:gamma}
 @r{       @:    H P     @:             @:        @:@:e}
index c1d8db80dae4e91bcef53820fe598648408531ae..73ee0e107d31d6332ff42cad17ae08a8eaa68ad1 100644 (file)
@@ -312,19 +312,19 @@ Indentation Engine Basics
 
 Syntactic Symbols
 
-* Function Symbols::
-* Class Symbols::
-* Conditional Construct Symbols::
-* Switch Statement Symbols::
-* Brace List Symbols::
-* External Scope Symbols::
-* Paren List Symbols::
-* Literal Symbols::
-* Multiline Macro Symbols::
-* Objective-C Method Symbols::
-* Anonymous Class Symbol::
-* Statement Block Symbols::
-* K&R Symbols::
+* Function Symbols::            
+* Class Symbols::               
+* Conditional Construct Symbols::  
+* Switch Statement Symbols::    
+* Brace List Symbols::          
+* External Scope Symbols::      
+* Paren List Symbols::          
+* Literal Symbols::             
+* Multiline Macro Symbols::     
+* Objective-C Method Symbols::  
+* Java Symbols::
+* Statement Block Symbols::     
+* K&R Symbols::                 
 
 Customizing Indentation
 
@@ -3971,6 +3971,9 @@ The first line in a ``topmost'' definition.  @ref{Function Symbols}.
 Topmost definition continuation lines.  This is only used in the parts
 that aren't covered by other symbols such as @code{func-decl-cont} and
 @code{knr-argdecl}.  @ref{Function Symbols}.
+@item annotation-top-cont
+Topmost definition continuation lines where all previous items are
+annotations.  @ref{Java Symbols}.
 @item member-init-intro
 First line in a member initialization list.  @ref{Class Symbols}.
 @item member-init-cont
@@ -3999,6 +4002,9 @@ with an open brace.  @ref{Brace List Symbols}.
 A statement.  @ref{Function Symbols}.
 @item statement-cont
 A continuation of a statement.  @ref{Function Symbols}.
+@item annotation-var-cont
+A continuation of a statement where all previous items are
+annotations.  @ref{Java Symbols}.
 @item statement-block-intro
 The first line in a new statement block.  @ref{Conditional Construct
 Symbols}.
@@ -4112,23 +4118,23 @@ Symbols}.
 @item inexpr-class
 A class definition inside an expression.  This is used for anonymous
 classes in Java.  It's also used for anonymous array initializers in
-Java.  @ref{Anonymous Class Symbol}.
+Java.  @ref{Java Symbols}.
 @end table
 
 @menu
-* Function Symbols::
-* Class Symbols::
-* Conditional Construct Symbols::
-* Switch Statement Symbols::
-* Brace List Symbols::
-* External Scope Symbols::
-* Paren List Symbols::
-* Literal Symbols::
-* Multiline Macro Symbols::
-* Objective-C Method Symbols::
-* Anonymous Class Symbol::
-* Statement Block Symbols::
-* K&R Symbols::
+* Function Symbols::            
+* Class Symbols::               
+* Conditional Construct Symbols::  
+* Switch Statement Symbols::    
+* Brace List Symbols::          
+* External Scope Symbols::      
+* Paren List Symbols::          
+* Literal Symbols::             
+* Multiline Macro Symbols::     
+* Objective-C Method Symbols::  
+* Java Symbols::
+* Statement Block Symbols::     
+* K&R Symbols::                 
 @end menu
 
 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -4233,7 +4239,7 @@ Hitting @kbd{C-c C-s} on line 5 shows the following analysis:
 
 @noindent
 The primary syntactic symbol for this line is @code{access-label} as
-this a label keyword that specifies access protection in C++.  However,
+this is a label keyword that specifies access protection in C++.  However,
 because this line is also a top-level construct inside a class
 definition, the analysis actually shows two syntactic symbols.  The
 other syntactic symbol assigned to this line is @code{inclass}.
@@ -4740,7 +4746,7 @@ macros.}.
 @xref{Custom Macros}, for more info about the treatment of macros.
 
 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-@node    Objective-C Method Symbols, Anonymous Class Symbol, Multiline Macro Symbols, Syntactic Symbols
+@node    Objective-C Method Symbols, Java Symbols, Multiline Macro Symbols, Syntactic Symbols
 @comment node-name, next, previous, up
 @subsection Objective-C Method Symbols
 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -4767,34 +4773,45 @@ assigned @code{objc-method-args-cont} syntax.  Lines 5 and 6 are both
 assigned @code{objc-method-call-cont} syntax.
 
 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-@node    Anonymous Class Symbol, Statement Block Symbols, Objective-C Method Symbols, Syntactic Symbols
+@node    Java Symbols, Statement Block Symbols, Objective-C Method Symbols, Syntactic Symbols
 @comment node-name, next, previous, up
-@subsection Anonymous Class Symbol (Java)
+@subsection Java Symbols
 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
 Java has a concept of anonymous classes which can look something like
 this:
 
 @example
- 1: public void watch(Observable o) @{
- 2:     o.addObserver(new Observer() @{
- 3:             public void update(Observable o, Object arg) @{
- 4:                 history.addElement(arg);
- 5:             @}
- 6:         @});
- 7: @}
+ 1:  @@Test
+ 2:  public void watch(Observable o) @{
+ 3:      @@NonNull
+ 4:      Observer obs = new Observer() @{
+ 5:          public void update(Observable o, Object arg) @{
+ 6:              history.addElement(arg);
+ 7:          @}
+ 8:      @};
+ 9:      o.addObserver(obs);
+ 10: @}
 @end example
 
 @ssindex inexpr-class
 The brace following the @code{new} operator opens the anonymous class.
-Lines 3 and 6 are assigned the @code{inexpr-class} syntax, besides the
+Lines 5 and 8 are assigned the @code{inexpr-class} syntax, besides the
 @code{inclass} symbol used in normal classes.  Thus, the class will be
 indented just like a normal class, with the added indentation given to
 @code{inexpr-class}.  An @code{inexpr-class} syntactic element doesn't
 have an anchor position.
 
+@ssindex annotation-top-cont
+@ssindex annotation-var-cont
+Line 2 is assigned the @code{annotation-top-cont} syntax, due to it being a
+continuation of a topmost introduction with an annotation symbol preceding
+the current line.  Similarly, line 4 is assigned the @code{annotation-var-cont}
+syntax due to it being a continuation of a variable declaration where preceding
+the declaration is an annotation.
+
 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-@node    Statement Block Symbols, K&R Symbols, Anonymous Class Symbol, Syntactic Symbols
+@node    Statement Block Symbols, K&R Symbols, Java Symbols, Syntactic Symbols
 @comment node-name, next, previous, up
 @subsection Statement Block Symbols
 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
index 755b2f3f1b70494108ca7e37858d190848aea355..96e4a28ae82dabaef3654bfc10a1be298d63d482 100644 (file)
@@ -3763,10 +3763,10 @@ that it passes in the list pointers themselves rather than the
 @code{car}s of the advancing pointers.
 @end defun
 
-@defun mapc function seq &rest more-seqs
+@defun cl-mapc function seq &rest more-seqs
 This function is like @code{mapcar*}, except that the values returned
 by @var{function} are ignored and thrown away rather than being
-collected into a list.  The return value of @code{mapc} is @var{seq},
+collected into a list.  The return value of @code{cl-mapc} is @var{seq},
 the first sequence.  This function is more general than the Emacs
 primitive @code{mapc}.
 @end defun
index c92cb279f099f9e79aaa1f3dfa52d78e58f1b44f..f4f96d5539151f7ea0b9e54cb9c80b5f5d4810e2 100644 (file)
@@ -5,6 +5,9 @@
 @c @setchapternewpage odd
 @c %**end of header
 
+@syncodeindex vr cp
+@syncodeindex fn cp
+
 @copying
 Copyright @copyright{} 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
@@ -50,7 +53,10 @@ 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.
 * Errors and Events::           Errors and events.
+* Index::                       Index including concepts, functions, variables.
+
 * GNU Free Documentation License:: The license for this documentation.
 @end menu
 
@@ -418,7 +424,8 @@ Example:
 @result{} "/org/freedesktop/SystemToolsBackends/UsersConfig"
 @end lisp
 
-If @var{object} has no @var{attribute}, the function returns nil.
+If @var{object} has no @var{attribute}, the function returns
+@code{nil}.
 @end defun
 
 
@@ -669,7 +676,7 @@ A @var{property} value can be retrieved by the function
 @defun dbus-get-property bus service path interface property
 This function returns the value of @var{property} of @var{interface}.
 It will be checked at @var{bus}, @var{service}, @var{path}.  The
-result can be any valid D-Bus value, or nil if there is no
+result can be any valid D-Bus value, or @code{nil} if there is no
 @var{property}.  Example:
 
 @lisp
@@ -863,12 +870,12 @@ Lisp function call.  The following mapping to D-Bus types is
 applied, when the corresponding D-Bus message is created:
 
 @example
-@multitable {@code{t} and @code{nil}} {@expansion{}} {DBUS_TYPE_BOOLEAN}
+@multitable {negative integer} {@expansion{}} {DBUS_TYPE_BOOLEAN}
 @item Lisp type               @tab              @tab D-Bus type
 @item
 @item @code{t} and @code{nil} @tab @expansion{} @tab DBUS_TYPE_BOOLEAN
-@item number                  @tab @expansion{} @tab DBUS_TYPE_UINT32
-@item integer                 @tab @expansion{} @tab DBUS_TYPE_INT32
+@item natural number          @tab @expansion{} @tab DBUS_TYPE_UINT32
+@item negative integer        @tab @expansion{} @tab DBUS_TYPE_INT32
 @item float                   @tab @expansion{} @tab DBUS_TYPE_DOUBLE
 @item string                  @tab @expansion{} @tab DBUS_TYPE_STRING
 @item list                    @tab @expansion{} @tab DBUS_TYPE_ARRAY
@@ -889,19 +896,19 @@ types are represented by the type symbols @code{:byte},
 Example:
 
 @lisp
-(dbus-call-method @dots{} @var{NUMBER} @var{STRING})
+(dbus-call-method @dots{} @var{NAT-NUMBER} @var{STRING})
 @end lisp
 
 is equivalent to
 
 @lisp
-(dbus-call-method @dots{} :uint32 @var{NUMBER} :string @var{STRING})
+(dbus-call-method @dots{} :uint32 @var{NAT-NUMBER} :string @var{STRING})
 @end lisp
 
 but different to
 
 @lisp
-(dbus-call-method @dots{} :int32 @var{NUMBER} :signature @var{STRING})
+(dbus-call-method @dots{} :int32 @var{NAT-NUMBER} :signature @var{STRING})
 @end lisp
 
 The value for a byte D-Bus type can be any integer in the range 0
@@ -994,17 +1001,17 @@ Output parameters of D-Bus methods and signals are mapped to Lisp
 objects.
 
 @example
-@multitable {DBUS_TYPE_OBJECT_PATH} {@expansion{}} {@code{t} or @code{nil}}
+@multitable {DBUS_TYPE_OBJECT_PATH} {@expansion{}} {natural number or float}
 @item D-Bus type            @tab              @tab Lisp type
 @item
 @item DBUS_TYPE_BOOLEAN     @tab @expansion{} @tab @code{t} or @code{nil}
-@item DBUS_TYPE_BYTE        @tab @expansion{} @tab number
-@item DBUS_TYPE_UINT16      @tab @expansion{} @tab number
-@item DBUS_TYPE_INT16       @tab @expansion{} @tab number
-@item DBUS_TYPE_UINT32      @tab @expansion{} @tab number or float
-@item DBUS_TYPE_INT32       @tab @expansion{} @tab number or float
-@item DBUS_TYPE_UINT64      @tab @expansion{} @tab number or float
-@item DBUS_TYPE_INT64       @tab @expansion{} @tab number or float
+@item DBUS_TYPE_BYTE        @tab @expansion{} @tab natural number
+@item DBUS_TYPE_UINT16      @tab @expansion{} @tab natural number
+@item DBUS_TYPE_INT16       @tab @expansion{} @tab integer
+@item DBUS_TYPE_UINT32      @tab @expansion{} @tab natural number or float
+@item DBUS_TYPE_INT32       @tab @expansion{} @tab integer or float
+@item DBUS_TYPE_UINT64      @tab @expansion{} @tab natural number or float
+@item DBUS_TYPE_INT64       @tab @expansion{} @tab integer or float
 @item DBUS_TYPE_DOUBLE      @tab @expansion{} @tab float
 @item DBUS_TYPE_STRING      @tab @expansion{} @tab string
 @item DBUS_TYPE_OBJECT_PATH @tab @expansion{} @tab string
@@ -1030,7 +1037,7 @@ The signal @code{PropertyModified}, discussed as example in
 (@var{BOOL} stands here for either @code{nil} or @code{t}):
 
 @lisp
-(@var{NUMBER} ((@var{STRING} @var{BOOL} @var{BOOL}) (@var{STRING} @var{BOOL} @var{BOOL}) @dots{}))
+(@var{INTEGER} ((@var{STRING} @var{BOOL} @var{BOOL}) (@var{STRING} @var{BOOL} @var{BOOL}) @dots{}))
 @end lisp
 
 @defun dbus-byte-array-to-string byte-array
@@ -1359,7 +1366,7 @@ The test runs then
 @end example
 @end defun
 
-@defun dbus-register-property bus service path interface property access value
+@defun dbus-register-property bus service path interface property access value &optional emits-signal
 With this function, an application declares a @var{property} on the D-Bus
 @var{bus}.
 
@@ -1387,7 +1394,12 @@ only way to change their values.  Properties with access type
 
 The interface @samp{org.freedesktop.DBus.Properties} is added to
 @var{path}, including a default handler for the @samp{Get},
-@samp{GetAll} and @samp{Set} methods of this interface.  Example:
+@samp{GetAll} and @samp{Set} methods of this interface.  When
+@var{emits-signal} is non-@code{nil}, the signal
+@samp{PropertiesChanged} is sent when the property is changed by
+@code{dbus-set-property}.
+
+@noindent Example:
 
 @lisp
 (dbus-register-property
@@ -1399,7 +1411,7 @@ The interface @samp{org.freedesktop.DBus.Properties} is added to
 
 (dbus-register-property
   :session "org.freedesktop.TextEditor" "/org/freedesktop/TextEditor"
-  "org.freedesktop.TextEditor" "version" :readwrite emacs-version)
+  "org.freedesktop.TextEditor" "version" :readwrite emacs-version t)
 
 @result{} ((:session "org.freedesktop.TextEditor" "version")
     ("org.freedesktop.TextEditor" "/org/freedesktop/TextEditor"))
@@ -1568,11 +1580,68 @@ which objects the GNU/Linux @code{hal} daemon adds.
 @end defun
 
 
+@node Alternative Buses
+@chapter Alternative buses.
+@cindex bus names
+@cindex UNIX domain 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.
+
+@defun dbus-init-bus bus
+Establish the connection to D-Bus @var{bus}.
+
+@var{bus} can be either the symbol @code{:system} or the symbol
+@code{:session}, or it can be a string denoting the address of the
+corresponding bus.  For the system and session busses, 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:
+
+@example
+# eval `dbus-launch --auto-syntax`
+# echo $DBUS_SESSION_BUS_ADDRESS
+
+@print{} unix:abstract=/tmp/dbus-JoFtAVG92w,guid=2f320a1ebe50b7ef58e
+@end example
+
+In Emacs, you can access to this bus via its address:
+
+@lisp
+(setq my-bus
+      "unix:abstract=/tmp/dbus-JoFtAVG92w,guid=2f320a1ebe50b7ef58e")
+
+@result{} "unix:abstract=/tmp/dbus-JoFtAVG92w,guid=2f320a1ebe50b7ef58e"
+
+(dbus-init-bus my-bus)
+
+@result{} nil
+
+(dbus-get-unique-name my-bus)
+
+@result{} ":1.0"
+@end lisp
+@end defun
+
+
 @node Errors and Events
 @chapter Errors and events.
+@cindex debugging
 @cindex errors
 @cindex events
 
+The internal actions can be traced by running in a debug mode.
+
+@defvar dbus-debug
+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
@@ -1587,8 +1656,7 @@ appended to the @code{dbus-error}.
 @defspec dbus-ignore-errors forms@dots{}
 This executes @var{forms} exactly like a @code{progn}, except that
 @code{dbus-error} errors are ignored during the @var{forms}.  These
-errors can be made visible when variable @code{dbus-debug} is set to
-@code{t}.
+errors can be made visible when @code{dbus-debug} is set to @code{t}.
 @end defspec
 
 Incoming D-Bus messages are handled as Emacs events, see @pxref{Misc
@@ -1636,12 +1704,12 @@ The result is either the symbol @code{:system} or the symbol @code{:session}.
 
 @defun dbus-event-message-type event
 Returns the message type of the corresponding D-Bus message.  The
-result is a number.
+result is a natural number.
 @end defun
 
 @defun dbus-event-serial-number event
 Returns the serial number of the corresponding D-Bus message.
-The result is a number.
+The result is a natural number.
 @end defun
 
 @defun dbus-event-service-name event
@@ -1691,6 +1759,12 @@ D-Bus applications running.  Therefore, they shall check carefully,
 whether a given D-Bus error is related to them.
 
 
+@node Index
+@unnumbered Index
+
+@printindex cp
+
+
 @node GNU Free Documentation License
 @appendix GNU Free Documentation License
 @include doclicense.texi
index 713a55c7cc70f262bed3305c8de928bfb0e3d66d..b5370478bdbb309895e7cc54a4e91606e150dbae 100644 (file)
@@ -394,7 +394,7 @@ variable will cause @samp{text/html} parts to be treated as attachments.
 @item mm-text-html-renderer
 @vindex mm-text-html-renderer
 This selects the function used to render @acronym{HTML}.  The predefined
-renderers are selected by the symbols @code{w3},
+renderers are selected by the symbols @code{gnus-article-html}, @code{w3},
 @code{w3m}@footnote{See @uref{http://emacs-w3m.namazu.org/} for more
 information about emacs-w3m}, @code{links}, @code{lynx},
 @code{w3m-standalone} or @code{html2text}.  If @code{nil} use an
index d04a8a76311cafad104601e29580c2d3f7d3fd68..6ec431dccfd4bc1c8d3ffe19a06dc547377ce44a 100644 (file)
@@ -369,6 +369,17 @@ eshell/ls is a compiled Lisp function in `em-ls.el'
 /bin/ls
 @end example
 
+If you want to discard a given built-in command, you could declare an
+alias, @ref{Aliases}.  Eample:
+
+@example
+~ $ which sudo
+eshell/sudo is a compiled Lisp function in `em-unix.el'
+~ $ alias sudo '*sudo $*'
+~ $ which sudo
+sudo is an alias, defined as "*sudo $*"
+@end example
+
 Some of the built-in commands have a special behaviour in Eshell:
 
 @table @code
index 9cf9ff503452a65a7b6e148cea8d545d5f17711c..f4dc0247197c6400c937cafc5ece6b4b345e802d 100644 (file)
@@ -5,7 +5,7 @@
 @c %**end of header
 
 @c This is used in many places
-@set VER 23.2.50
+@set VER 24.0.50
 
 @c This file is maintained by Romain Francoise <rfrancoise@gnu.org>.
 @c Feel free to install changes without prior permission (but I'd
index 7a917b6d2dfb7dbbfc7fa52ef5634dc9a7de9bda..745d2333c0ce48de4adfd0bba59cbb4c2a4d5059 100644 (file)
@@ -632,7 +632,7 @@ Select Methods
 * Getting Mail::                Reading your personal mail with Gnus.
 * Browsing the Web::            Getting messages from a plethora of Web sources.
 * IMAP::                        Using Gnus as a @acronym{IMAP} client.
-* Other Sources::               Reading directories, files, SOUP packets.
+* Other Sources::               Reading directories, files.
 * Combined Groups::             Combining groups into one group.
 * Email Based Diary::           Using mails to manage diary events in Gnus.
 * Gnus Unplugged::              Reading news and mail offline.
@@ -695,9 +695,6 @@ Browsing the Web
 
 * Archiving Mail::
 * Web Searches::                Creating groups from articles that match a string.
-* Slashdot::                    Reading the Slashdot comments.
-* Ultimate::                    The Ultimate Bulletin Board systems.
-* Web Archive::                 Reading mailing list archived on web.
 * RSS::                         Reading RDF site summary.
 * Customizing W3::              Doing stuff to Emacs/W3 from Gnus.
 
@@ -715,19 +712,12 @@ Other Sources
 * Directory Groups::            You can read a directory as if it was a newsgroup.
 * Anything Groups::             Dired?  Who needs dired?
 * Document Groups::             Single files can be the basis of a group.
-* SOUP::                        Reading @sc{soup} packets ``offline''.
 * Mail-To-News Gateways::       Posting articles via mail-to-news gateways.
 
 Document Groups
 
 * Document Server Internals::   How to add your own document types.
 
-SOUP
-
-* SOUP Commands::               Commands for creating and sending @sc{soup} packets
-* SOUP Groups::                 A back end for reading @sc{soup} packets.
-* SOUP Replies::                How to enable @code{nnsoup} to take over mail and news.
-
 Combined Groups
 
 * Virtual Groups::              Combining articles from many groups.
@@ -996,6 +986,15 @@ terminology section (@pxref{Terminology}).
 @section Finding the News
 @cindex finding news
 
+First of all, you should know that there is a special buffer called
+@code{*Server*} that lists all the servers Gnus knows about.  You can
+press @kbd{^} from the Group buffer to see it.  In the Server buffer,
+you can press @kbd{RET} on a defined server to see all the groups it
+serves (subscribed or not!).  You can also add or delete servers, edit
+a foreign server's definition, agentize or de-agentize a server, and
+do many other neat things.  @xref{Server Buffer}.  
+@xref{Foreign Groups}.  @xref{Agent Basics}.
+
 @vindex gnus-select-method
 @c @head
 The @code{gnus-select-method} variable says where Gnus should look for
@@ -1286,7 +1285,7 @@ parameter (@pxref{Topic Parameters}).  For instance, a @code{subscribe}
 topic parameter that looks like
 
 @example
-"nnslashdot"
+"nnml"
 @end example
 
 will mean that all groups that match that regex will be subscribed under
@@ -1376,31 +1375,11 @@ you have read is by keeping track of article numbers.  So when you
 change @code{gnus-select-method}, your @file{.newsrc} file becomes
 worthless.
 
-Gnus provides a few functions to attempt to translate a @file{.newsrc}
-file from one server to another.  They all have one thing in
-common---they take a looong time to run.  You don't want to use these
-functions more than absolutely necessary.
-
-@kindex M-x gnus-change-server
-@findex gnus-change-server
-If you have access to both servers, Gnus can request the headers for all
-the articles you have read and compare @code{Message-ID}s and map the
-article numbers of the read articles and article marks.  The @kbd{M-x
-gnus-change-server} command will do this for all your native groups.  It
-will prompt for the method you want to move to.
-
-@kindex M-x gnus-group-move-group-to-server
-@findex gnus-group-move-group-to-server
-You can also move individual groups with the @kbd{M-x
-gnus-group-move-group-to-server} command.  This is useful if you want to
-move a (foreign) group from one server to another.
-
 @kindex M-x gnus-group-clear-data-on-native-groups
 @findex gnus-group-clear-data-on-native-groups
-If you don't have access to both the old and new server, all your marks
-and read ranges have become worthless.  You can use the @kbd{M-x
-gnus-group-clear-data-on-native-groups} command to clear out all data
-that you have on your native groups.  Use with caution.
+You can use the @kbd{M-x gnus-group-clear-data-on-native-groups}
+command to clear out all data that you have on your native groups.
+Use with caution.
 
 @kindex M-x gnus-group-clear-data
 @findex gnus-group-clear-data
@@ -6034,6 +6013,11 @@ threads.
 This variable can also be a number.  In that case, center the window at
 the given number of lines from the top.
 
+@item gnus-summary-stop-at-end-of-message
+@vindex gnus-summary-stop-at-end-of-message
+If non-@code{nil}, don't go to the next article when hitting
+@kbd{SPC}, and you're at the end of the article.
+
 @end table
 
 
@@ -6341,7 +6325,8 @@ present, that's used instead.
 @findex gnus-summary-wide-reply-with-original
 Mail a wide reply to the current article and include the original
 message (@code{gnus-summary-wide-reply-with-original}).  This command uses
-the process/prefix convention.
+the process/prefix convention, but only uses the headers from the
+first article to determine the recipients.
 
 @item S v
 @kindex S v (Summary)
@@ -6405,8 +6390,6 @@ the posting style of the current group.  If given a prefix, disable that.
 If the prefix is 1, prompt for a group name to find the posting style.
 
 @item S i
-@itemx i
-@kindex i (Summary)
 @kindex S i (Summary)
 @findex gnus-summary-news-other-window
 Prepare a news (@code{gnus-summary-news-other-window}).  By default,
@@ -6744,6 +6727,12 @@ Presumably, you want to use the demon for sending due delayed articles.
 Just don't forget to set that up :-)
 @end table
 
+When delaying an article with @kbd{C-c C-j}, Message mode will
+automatically add a @code{"Date"} header with the current time.  In
+many cases you probably want the @code{"Date"} header to reflect the
+time the message is sent instead.  To do this, you have to delete
+@code{Date} from @code{message-draft-headers}.
+
 
 @node Marking Articles
 @section Marking Articles
@@ -6852,10 +6841,6 @@ Marked as read by a catchup (@code{gnus-catchup-mark}).
 @vindex gnus-canceled-mark
 Canceled article (@code{gnus-canceled-mark})
 
-@item F
-@vindex gnus-souped-mark
-@sc{soup}ed article (@code{gnus-souped-mark}).  @xref{SOUP}.
-
 @item Q
 @vindex gnus-sparse-mark
 Sparsely reffed article (@code{gnus-sparse-mark}).  @xref{Customizing
@@ -7826,7 +7811,7 @@ This is a rather obscure variable that few will find useful.  It's
 intended for those non-news newsgroups where the back end has to fetch
 quite a lot to present the summary buffer, and where it's impossible to
 go back to parents of articles.  This is mostly the case in the
-web-based groups, like the @code{nnultimate} groups.
+web-based groups.
 
 If you don't use those, then it's safe to leave this as the default
 @code{nil}.  If you want to use this variable, it should be a regexp
@@ -8262,6 +8247,16 @@ These functions will be called many, many times, so they should
 preferably be short and sweet to avoid slowing down Gnus too much.
 It's probably a good idea to byte-compile things like this.
 
+@vindex gnus-async-post-fetch-function
+@findex gnus-html-prefetch-images
+After an article has been prefetched, this
+@code{gnus-async-post-fetch-function} will be called.  The buffer will
+be narrowed to the region of the article that was fetched.  A useful
+value would be @code{gnus-html-prefetch-images}, which will prefetch
+and store images referenced in the article, so that you don't have to
+wait for them to be fetched when you read the article.  This is useful
+for @acronym{HTML} messages that have external images.
+
 @vindex gnus-prefetched-article-deletion-strategy
 Articles have to be removed from the asynch buffer sooner or later.  The
 @code{gnus-prefetched-article-deletion-strategy} says when to remove
@@ -10506,17 +10501,24 @@ the same manner:
 @kindex K H (Summary)
 @findex gnus-article-browse-html-article
 View @samp{text/html} parts of the current article with a WWW browser.
-The message header is added to the beginning of every html part unless
-the prefix argument is given.
+Inline images embedded in a message using the @code{cid} scheme, as they
+are generally considered to be safe, will be processed properly.  The
+message header is added to the beginning of every @acronym{HTML} part
+unless the prefix argument is given.
 
-Warning: Spammers use links to images in HTML articles to verify whether
-you have read the message.  As this command passes the @acronym{HTML}
-content to the browser without eliminating these ``web bugs'' you should
-only use it for mails from trusted senders.
+Warning: Spammers use links to images (using the @code{http} scheme) in
+@acronym{HTML} articles to verify whether you have read the message.  As
+this command passes the @acronym{HTML} content to the browser without
+eliminating these ``web bugs'' you should only use it for mails from
+trusted senders.
 
 If you always want to display @acronym{HTML} parts in the browser, set
 @code{mm-text-html-renderer} to @code{nil}.
 
+This command creates temporary files to pass @acronym{HTML} contents
+including images if any to the browser, and deletes them when exiting
+the group (if you want).
+
 @item K b
 @kindex K b (Summary)
 Make all the @acronym{MIME} parts have buttons in front of them.  This is
@@ -12170,6 +12172,7 @@ tell Gnus otherwise.
 @menu
 * Hiding Headers::              Deciding what headers should be displayed.
 * Using MIME::                  Pushing articles through @acronym{MIME} before reading them.
+* HTML::                        Reading @acronym{HTML} messages.
 * Customizing Articles::        Tailoring the look of the articles.
 * Article Keymap::              Keystrokes available in the article buffer.
 * Misc Article::                Other stuff.
@@ -12466,6 +12469,60 @@ Any similarity to real events and people is purely coincidental.  Ahem.
 Also @pxref{MIME Commands}.
 
 
+@node HTML
+@section @acronym{HTML}
+@cindex @acronym{HTML}
+
+If you have @code{w3m} installed on your system, Gnus can display
+@acronym{HTML} articles in the article buffer.  There are many Gnus
+add-ons for doing this, using various approaches, but there's one
+(sort of) built-in method that's used by default.
+
+For a complete overview, consult @xref{Display Customization,
+,Display Customization, emacs-mime, The Emacs MIME Manual}.  This
+section only describes the default method.
+
+@table @code
+@item mm-text-html-renderer
+@vindex mm-text-html-renderer
+If set to @code{gnus-article-html}, Gnus will use the built-in method,
+that's based on @code{curl} and @code{w3m}.
+
+@item gnus-blocked-images
+@vindex gnus-blocked-images
+Images that have @acronym{URL}s that match this regexp won't be
+fetched and displayed.  For instance, do block all @acronym{URL}s that
+have the string ``ads'' in them, do the following:
+
+@lisp
+(setq gnus-blocked-images "ads")
+@end lisp
+
+The default is to block all external images.
+
+@item gnus-html-cache-directory
+@vindex gnus-html-cache-directory
+Gnus will download and cache images according to how
+@code{gnus-blocked-images} is set.  These images will be stored in
+this directory.
+
+@item gnus-html-cache-size
+@vindex gnus-html-cache-size
+When @code{gnus-html-cache-size} bytes have been used in that
+directory, the oldest files will be deleted.  The default is 500MB.
+
+@item gnus-html-frame-width
+@vindex gnus-html-frame-width
+The width to use when rendering HTML.  The default is 70.
+
+@end table
+
+To use this, make sure that you have @code{w3m} and @code{curl}
+installed.  If you have, then Gnus should display @acronym{HTML}
+automatically. 
+
+
+
 @node Customizing Articles
 @section Customizing Articles
 @cindex article customization
@@ -13543,6 +13600,9 @@ If you have some messages that you wish not to send, you can use the
 @kbd{D t} (@code{gnus-draft-toggle-sending}) command to mark the message
 as unsendable.  This is a toggling command.
 
+Finally, if you want to delete a draft, use the normal @kbd{B DEL}
+command (@pxref{Mail Group Commands}).
+
 
 @node Rejected Articles
 @section Rejected Articles
@@ -13673,7 +13733,7 @@ The different methods all have their peculiarities, of course.
 * Getting Mail::                Reading your personal mail with Gnus.
 * Browsing the Web::            Getting messages from a plethora of Web sources.
 * IMAP::                        Using Gnus as a @acronym{IMAP} client.
-* Other Sources::               Reading directories, files, SOUP packets.
+* Other Sources::               Reading directories, files.
 * Combined Groups::             Combining groups into one group.
 * Email Based Diary::           Using mails to manage diary events in Gnus.
 * Gnus Unplugged::              Reading news and mail offline.
@@ -17334,9 +17394,6 @@ interfaces to these sources.
 @menu
 * Archiving Mail::
 * Web Searches::                Creating groups from articles that match a string.
-* Slashdot::                    Reading the Slashdot comments.
-* Ultimate::                    The Ultimate Bulletin Board systems.
-* Web Archive::                 Reading mailing list archived on web.
 * RSS::                         Reading RDF site summary.
 * Customizing W3::              Doing stuff to Emacs/W3 from Gnus.
 @end menu
@@ -17479,159 +17536,6 @@ Format string URL to fetch an article by @code{Message-ID}.
 @end table
 
 
-@node Slashdot
-@subsection Slashdot
-@cindex Slashdot
-@cindex nnslashdot
-
-@uref{http://slashdot.org/, Slashdot} is a popular news site, with
-lively discussion following the news articles.  @code{nnslashdot} will
-let you read this forum in a convenient manner.
-
-The easiest way to read this source is to put something like the
-following in your @file{~/.gnus.el} file:
-
-@lisp
-(setq gnus-secondary-select-methods
-      '((nnslashdot "")))
-@end lisp
-
-This will make Gnus query the @code{nnslashdot} back end for new comments
-and groups.  The @kbd{F} command will subscribe each new news article as
-a new Gnus group, and you can read the comments by entering these
-groups.  (Note that the default subscription method is to subscribe new
-groups as zombies.  Other methods are available (@pxref{Subscription
-Methods}).
-
-If you want to remove an old @code{nnslashdot} group, the @kbd{G DEL}
-command is the most handy tool (@pxref{Foreign Groups}).
-
-When following up to @code{nnslashdot} comments (or posting new
-comments), some light @acronym{HTML}izations will be performed.  In
-particular, text quoted with @samp{> } will be quoted with
-@samp{blockquote} instead, and signatures will have @samp{br} added to
-the end of each line.  Other than that, you can just write @acronym{HTML}
-directly into the message buffer.  Note that Slashdot filters out some
-@acronym{HTML} forms.
-
-The following variables can be altered to change its behavior:
-
-@table @code
-@item nnslashdot-threaded
-Whether @code{nnslashdot} should display threaded groups or not.  The
-default is @code{t}.  To be able to display threads, @code{nnslashdot}
-has to retrieve absolutely all comments in a group upon entry.  If a
-threaded display is not required, @code{nnslashdot} will only retrieve
-the comments that are actually wanted by the user.  Threading is nicer,
-but much, much slower than unthreaded.
-
-@item nnslashdot-login-name
-@vindex nnslashdot-login-name
-The login name to use when posting.
-
-@item nnslashdot-password
-@vindex nnslashdot-password
-The password to use when posting.
-
-@item nnslashdot-directory
-@vindex nnslashdot-directory
-Where @code{nnslashdot} will store its files.  The default is
-@file{~/News/slashdot/}.
-
-@item nnslashdot-active-url
-@vindex nnslashdot-active-url
-The @acronym{URL} format string that will be used to fetch the
-information on news articles and comments.  The default is@*
-@samp{http://slashdot.org/search.pl?section=&min=%d}.
-
-@item nnslashdot-comments-url
-@vindex nnslashdot-comments-url
-The @acronym{URL} format string that will be used to fetch comments.
-
-@item nnslashdot-article-url
-@vindex nnslashdot-article-url
-The @acronym{URL} format string that will be used to fetch the news
-article.  The default is
-@samp{http://slashdot.org/article.pl?sid=%s&mode=nocomment}.
-
-@item nnslashdot-threshold
-@vindex nnslashdot-threshold
-The score threshold.  The default is -1.
-
-@item nnslashdot-group-number
-@vindex nnslashdot-group-number
-The number of old groups, in addition to the ten latest, to keep
-updated.  The default is 0.
-
-@end table
-
-
-
-@node Ultimate
-@subsection Ultimate
-@cindex nnultimate
-@cindex Ultimate Bulletin Board
-
-@uref{http://www.ultimatebb.com/, The Ultimate Bulletin Board} is
-probably the most popular Web bulletin board system used.  It has a
-quite regular and nice interface, and it's possible to get the
-information Gnus needs to keep groups updated.
-
-The easiest way to get started with @code{nnultimate} is to say
-something like the following in the group buffer:  @kbd{B nnultimate RET
-http://www.tcj.com/messboard/ubbcgi/ RET}.  (Substitute the @acronym{URL}
-(not including @samp{Ultimate.cgi} or the like at the end) for a forum
-you're interested in; there's quite a list of them on the Ultimate web
-site.)  Then subscribe to the groups you're interested in from the
-server buffer, and read them from the group buffer.
-
-The following @code{nnultimate} variables can be altered:
-
-@table @code
-@item nnultimate-directory
-@vindex nnultimate-directory
-The directory where @code{nnultimate} stores its files.  The default is@*
-@file{~/News/ultimate/}.
-@end table
-
-
-@node Web Archive
-@subsection Web Archive
-@cindex nnwarchive
-@cindex Web Archive
-
-Some mailing lists only have archives on Web servers, such as
-@uref{http://www.egroups.com/} and
-@uref{http://www.mail-archive.com/}.  It has a quite regular and nice
-interface, and it's possible to get the information Gnus needs to keep
-groups updated.
-
-@findex gnus-group-make-warchive-group
-The easiest way to get started with @code{nnwarchive} is to say
-something like the following in the group buffer: @kbd{M-x
-gnus-group-make-warchive-group RET @var{an_egroup} RET egroups RET
-www.egroups.com RET @var{your@@email.address} RET}.  (Substitute the
-@var{an_egroup} with the mailing list you subscribed, the
-@var{your@@email.address} with your email address.), or to browse the
-back end by @kbd{B nnwarchive RET mail-archive RET}.
-
-The following @code{nnwarchive} variables can be altered:
-
-@table @code
-@item nnwarchive-directory
-@vindex nnwarchive-directory
-The directory where @code{nnwarchive} stores its files.  The default is@*
-@file{~/News/warchive/}.
-
-@item nnwarchive-login
-@vindex nnwarchive-login
-The account name on the web server.
-
-@item nnwarchive-passwd
-@vindex nnwarchive-passwd
-The password for your account on the web server.
-@end table
-
 @node RSS
 @subsection RSS
 @cindex nnrss
@@ -18568,7 +18472,6 @@ newsgroups.
 * Directory Groups::            You can read a directory as if it was a newsgroup.
 * Anything Groups::             Dired?  Who needs dired?
 * Document Groups::             Single files can be the basis of a group.
-* SOUP::                        Reading @sc{soup} packets ``offline''.
 * Mail-To-News Gateways::       Posting articles via mail-to-news gateways.
 @end menu
 
@@ -18936,289 +18839,6 @@ correct type.  A high number means high probability; a low number
 means low probability with @samp{0} being the lowest valid number.
 
 
-@node SOUP
-@subsection SOUP
-@cindex SOUP
-@cindex offline
-
-In the PC world people often talk about ``offline'' newsreaders.  These
-are thingies that are combined reader/news transport monstrosities.
-With built-in modem programs.  Yecchh!
-
-Of course, us Unix Weenie types of human beans use things like
-@code{uucp} and, like, @code{nntpd} and set up proper news and mail
-transport things like Ghod intended.  And then we just use normal
-newsreaders.
-
-However, it can sometimes be convenient to do something that's a bit
-easier on the brain if you have a very slow modem, and you're not really
-that interested in doing things properly.
-
-A file format called @sc{soup} has been developed for transporting news
-and mail from servers to home machines and back again.  It can be a bit
-fiddly.
-
-First some terminology:
-
-@table @dfn
-
-@item server
-This is the machine that is connected to the outside world and where you
-get news and/or mail from.
-
-@item home machine
-This is the machine that you want to do the actual reading and responding
-on.  It is typically not connected to the rest of the world in any way.
-
-@item packet
-Something that contains messages and/or commands.  There are two kinds
-of packets:
-
-@table @dfn
-@item message packets
-These are packets made at the server, and typically contain lots of
-messages for you to read.  These are called @file{SoupoutX.tgz} by
-default, where @var{x} is a number.
-
-@item response packets
-These are packets made at the home machine, and typically contains
-replies that you've written.  These are called @file{SoupinX.tgz} by
-default, where @var{x} is a number.
-
-@end table
-
-@end table
-
-
-@enumerate
-
-@item
-You log in on the server and create a @sc{soup} packet.  You can either
-use a dedicated @sc{soup} thingie (like the @code{awk} program), or you
-can use Gnus to create the packet with its @sc{soup} commands (@kbd{O
-s} and/or @kbd{G s b}; and then @kbd{G s p}) (@pxref{SOUP Commands}).
-
-@item
-You transfer the packet home.  Rail, boat, car or modem will do fine.
-
-@item
-You put the packet in your home directory.
-
-@item
-You fire up Gnus on your home machine using the @code{nnsoup} back end as
-the native or secondary server.
-
-@item
-You read articles and mail and answer and followup to the things you
-want (@pxref{SOUP Replies}).
-
-@item
-You do the @kbd{G s r} command to pack these replies into a @sc{soup}
-packet.
-
-@item
-You transfer this packet to the server.
-
-@item
-You use Gnus to mail this packet out with the @kbd{G s s} command.
-
-@item
-You then repeat until you die.
-
-@end enumerate
-
-So you basically have a bipartite system---you use @code{nnsoup} for
-reading and Gnus for packing/sending these @sc{soup} packets.
-
-@menu
-* SOUP Commands::               Commands for creating and sending @sc{soup} packets
-* SOUP Groups::                 A back end for reading @sc{soup} packets.
-* SOUP Replies::                How to enable @code{nnsoup} to take over mail and news.
-@end menu
-
-
-@node SOUP Commands
-@subsubsection SOUP Commands
-
-These are commands for creating and manipulating @sc{soup} packets.
-
-@table @kbd
-@item G s b
-@kindex G s b (Group)
-@findex gnus-group-brew-soup
-Pack all unread articles in the current group
-(@code{gnus-group-brew-soup}).  This command understands the
-process/prefix convention.
-
-@item G s w
-@kindex G s w (Group)
-@findex gnus-soup-save-areas
-Save all @sc{soup} data files (@code{gnus-soup-save-areas}).
-
-@item G s s
-@kindex G s s (Group)
-@findex gnus-soup-send-replies
-Send all replies from the replies packet
-(@code{gnus-soup-send-replies}).
-
-@item G s p
-@kindex G s p (Group)
-@findex gnus-soup-pack-packet
-Pack all files into a @sc{soup} packet (@code{gnus-soup-pack-packet}).
-
-@item G s r
-@kindex G s r (Group)
-@findex nnsoup-pack-replies
-Pack all replies into a replies packet (@code{nnsoup-pack-replies}).
-
-@item O s
-@kindex O s (Summary)
-@findex gnus-soup-add-article
-This summary-mode command adds the current article to a @sc{soup} packet
-(@code{gnus-soup-add-article}).  It understands the process/prefix
-convention (@pxref{Process/Prefix}).
-
-@end table
-
-
-There are a few variables to customize where Gnus will put all these
-thingies:
-
-@table @code
-
-@item gnus-soup-directory
-@vindex gnus-soup-directory
-Directory where Gnus will save intermediate files while composing
-@sc{soup} packets.  The default is @file{~/SoupBrew/}.
-
-@item gnus-soup-replies-directory
-@vindex gnus-soup-replies-directory
-This is what Gnus will use as a temporary directory while sending our
-reply packets.  @file{~/SoupBrew/SoupReplies/} is the default.
-
-@item gnus-soup-prefix-file
-@vindex gnus-soup-prefix-file
-Name of the file where Gnus stores the last used prefix.  The default is
-@samp{gnus-prefix}.
-
-@item gnus-soup-packer
-@vindex gnus-soup-packer
-A format string command for packing a @sc{soup} packet.  The default is
-@samp{tar cf - %s | gzip > $HOME/Soupout%d.tgz}.
-
-@item gnus-soup-unpacker
-@vindex gnus-soup-unpacker
-Format string command for unpacking a @sc{soup} packet.  The default is
-@samp{gunzip -c %s | tar xvf -}.
-
-@item gnus-soup-packet-directory
-@vindex gnus-soup-packet-directory
-Where Gnus will look for reply packets.  The default is @file{~/}.
-
-@item gnus-soup-packet-regexp
-@vindex gnus-soup-packet-regexp
-Regular expression matching @sc{soup} reply packets in
-@code{gnus-soup-packet-directory}.
-
-@end table
-
-
-@node SOUP Groups
-@subsubsection SOUP Groups
-@cindex nnsoup
-
-@code{nnsoup} is the back end for reading @sc{soup} packets.  It will
-read incoming packets, unpack them, and put them in a directory where
-you can read them at leisure.
-
-These are the variables you can use to customize its behavior:
-
-@table @code
-
-@item nnsoup-tmp-directory
-@vindex nnsoup-tmp-directory
-When @code{nnsoup} unpacks a @sc{soup} packet, it does it in this
-directory.  (@file{/tmp/} by default.)
-
-@item nnsoup-directory
-@vindex nnsoup-directory
-@code{nnsoup} then moves each message and index file to this directory.
-The default is @file{~/SOUP/}.
-
-@item nnsoup-replies-directory
-@vindex nnsoup-replies-directory
-All replies will be stored in this directory before being packed into a
-reply packet.  The default is @file{~/SOUP/replies/}.
-
-@item nnsoup-replies-format-type
-@vindex nnsoup-replies-format-type
-The @sc{soup} format of the replies packets.  The default is @samp{?n}
-(rnews), and I don't think you should touch that variable.  I probably
-shouldn't even have documented it.  Drats!  Too late!
-
-@item nnsoup-replies-index-type
-@vindex nnsoup-replies-index-type
-The index type of the replies packet.  The default is @samp{?n}, which
-means ``none''.  Don't fiddle with this one either!
-
-@item nnsoup-active-file
-@vindex nnsoup-active-file
-Where @code{nnsoup} stores lots of information.  This is not an ``active
-file'' in the @code{nntp} sense; it's an Emacs Lisp file.  If you lose
-this file or mess it up in any way, you're dead.  The default is
-@file{~/SOUP/active}.
-
-@item nnsoup-packer
-@vindex nnsoup-packer
-Format string command for packing a reply @sc{soup} packet.  The default
-is @samp{tar cf - %s | gzip > $HOME/Soupin%d.tgz}.
-
-@item nnsoup-unpacker
-@vindex nnsoup-unpacker
-Format string command for unpacking incoming @sc{soup} packets.  The
-default is @samp{gunzip -c %s | tar xvf -}.
-
-@item nnsoup-packet-directory
-@vindex nnsoup-packet-directory
-Where @code{nnsoup} will look for incoming packets.  The default is
-@file{~/}.
-
-@item nnsoup-packet-regexp
-@vindex nnsoup-packet-regexp
-Regular expression matching incoming @sc{soup} packets.  The default is
-@samp{Soupout}.
-
-@item nnsoup-always-save
-@vindex nnsoup-always-save
-If non-@code{nil}, save the replies buffer after each posted message.
-
-@end table
-
-
-@node SOUP Replies
-@subsubsection SOUP Replies
-
-Just using @code{nnsoup} won't mean that your postings and mailings end
-up in @sc{soup} reply packets automagically.  You have to work a bit
-more for that to happen.
-
-@findex nnsoup-set-variables
-The @code{nnsoup-set-variables} command will set the appropriate
-variables to ensure that all your followups and replies end up in the
-@sc{soup} system.
-
-In specific, this is what it does:
-
-@lisp
-(setq message-send-news-function 'nnsoup-request-post)
-(setq message-send-mail-function 'nnsoup-request-mail)
-@end lisp
-
-And that's it, really.  If you only want news to go into the @sc{soup}
-system you just use the first line.  If you only want mail to be
-@sc{soup}ed you use the second.
-
-
 @node Mail-To-News Gateways
 @subsection Mail-To-News Gateways
 @cindex mail-to-news gateways
@@ -22890,8 +22510,11 @@ default.
 @item gnus-expert-user
 @vindex gnus-expert-user
 If this variable is non-@code{nil}, you will seldom be asked any
-questions by Gnus.  It will simply assume you know what you're doing, no
-matter how strange.
+questions by Gnus.  It will simply assume you know what you're doing,
+no matter how strange.  For example, quitting Gnus, exiting a group
+without an update, catching up with a group, deleting expired
+articles, and replying by mail to a news message will not require
+confirmation.
 
 @item gnus-interactive-catchup
 @vindex gnus-interactive-catchup
@@ -27940,8 +27563,7 @@ news batches, ClariNet briefs collections, and just about everything
 else (@pxref{Document Groups}).
 
 @item
-Gnus has a new back end (@code{nnsoup}) to create/read SOUP packets
-(@pxref{SOUP}).
+Gnus has a new back end (@code{nnsoup}) to create/read SOUP packets.
 
 @item
 The Gnus cache is much faster.
@@ -29502,10 +29124,9 @@ Gnus not to use @acronym{NOV}.
 As the variables for the other back ends, there are
 @code{nndiary-nov-is-evil}, @code{nndir-nov-is-evil},
 @code{nnfolder-nov-is-evil}, @code{nnimap-nov-is-evil},
-@code{nnml-nov-is-evil}, @code{nnspool-nov-is-evil}, and
-@code{nnwarchive-nov-is-evil}.  Note that a non-@code{nil} value for
-@code{gnus-nov-is-evil} overrides all those variables.@footnote{Although
-the back ends @code{nnkiboze}, @code{nnslashdot}, @code{nnultimate}, and
+@code{nnml-nov-is-evil}, and @code{nnspool-nov-is-evil}.  Note that a
+non-@code{nil} value for @code{gnus-nov-is-evil} overrides all those
+variables.@footnote{Although the back ends @code{nnkiboze}, and
 @code{nnwfm} don't have their own nn*-nov-is-evil.}
 @end table
 
index 283d29c0de4acdd3e672a124bbcb408c304e865b..d411953387038206f5593478cabf1d80807d9f41 100644 (file)
@@ -182,6 +182,37 @@ Addresses that match the @code{message-dont-reply-to-names} regular
 expression (or list of regular expressions) will be removed from the
 @code{Cc} header. A value of @code{nil} means exclude your name only.
 
+@vindex message-prune-recipient-rules
+@code{message-prune-recipient-rules} is used to prune the addresses
+used when doing a wide reply.  It's meant to be used to remove
+duplicate addresses and the like.  It's a list of lists, where the
+first element is a regexp to match the address to trigger the rule,
+and the second is a regexp that will be expanded based on the first,
+to match addresses to be pruned.
+
+It's complicated to explain, but it's easy to use.
+
+For instance, if you get an email from @samp{foo@@example.org}, but
+@samp{foo@@zot.example.org} is also in the @code{Cc} list, then your
+wide reply will go out to both these addresses, since they are unique.
+
+To avoid this, do something like the following:
+
+@lisp
+(setq message-prune-recipient-rules
+      '(("^\\([^@@]+\\)@@\\(.*\\)" "\\1@@.*[.]\\2")))
+@end lisp
+
+If, for instance, you want all wide replies that involve messages from
+@samp{cvs@@example.org} to go to that address, and nowhere else (i.e.,
+remove all other recipients if @samp{cvs@@example.org} is in the
+recipient list:
+
+@lisp
+(setq message-prune-recipient-rules
+      '(("cvs@@example.org" ".")))
+@end lisp
+
 @vindex message-wide-reply-confirm-recipients
 If @code{message-wide-reply-confirm-recipients} is non-@code{nil} you
 will be asked to confirm that you want to reply to multiple
@@ -1645,7 +1676,8 @@ the problem will actually occur.
 @cindex split large message
 The limitation of messages sent as message/partial.  The lower bound
 of message size in characters, beyond which the message should be sent
-in several parts.  If it is @code{nil}, the size is unlimited.
+in several parts.  If it is @code{nil} (which is the default), the
+size is unlimited.
 
 @end table
 
index d4857d7a61c889dace1a206b0e9e09aa716a27c3..9074f171e4b1d817c920b6aeb23fd7c22490140a 100644 (file)
@@ -1,10 +1,16 @@
+
 \input texinfo
 @c %**start of header
 @setfilename ../../info/org
 @settitle The Org Manual
 
-@set VERSION 6.33x
-@set DATE November 2009
+@set VERSION 7.01
+@set DATE July 2010
+
+@c Use proper quote and backtick for code sections in PDF output
+@c Cf. Texinfo manual 14.2
+@set txicodequoteundirected
+@set txicodequotebacktick
 
 @c Version and Contact Info
 @set MAINTAINERSITE @uref{http://orgmode.org,maintainers webpage}
@@ -45,7 +51,7 @@ e.g.,
 @copying
 This manual is for Org version @value{VERSION}.
 
-Copyright @copyright{} 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation
+Copyright @copyright{} 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
@@ -68,7 +74,7 @@ license to the document, as described in section 6 of the license.
 
 @dircategory Emacs
 @direntry
-* Org Mode: (org).              Outline-based notes management and organizer.
+* Org Mode: (org).      Outline-based notes management and organizer
 @end direntry
 
 @titlepage
@@ -76,6 +82,7 @@ license to the document, as described in section 6 of the license.
 
 @subtitle Release @value{VERSION}
 @author by Carsten Dominik
+with contributions by David O'Toole, Bastien Guerry, Philip Rooke, Dan Davison, Eric Schulte, and Thomas Dye
 
 @c The following two commands start the copyright page.
 @page
@@ -94,344 +101,400 @@ license to the document, as described in section 6 of the license.
 @end ifnottex
 
 @menu
-* Introduction::                Getting started
-* Document Structure::          A tree works like your brain
-* Tables::                      Pure magic for quick formatting
-* Hyperlinks::                  Notes in context
-* TODO Items::                  Every tree branch can be a TODO item
-* Tags::                        Tagging headlines and matching sets of tags
-* Properties and Columns::      Storing information about an entry
-* Dates and Times::             Making items useful for planning
-* Capture - Refile - Archive::  The ins and outs for projects
-* Agenda Views::                Collecting information into views
-* Markup::                      Prepare text for rich export
-* Exporting::                   Sharing and publishing of notes
-* Publishing::                  Create a web site of linked Org files
-* Miscellaneous::               All the rest which did not fit elsewhere
-* Hacking::                     How to hack your way around
-* MobileOrg::                   Viewing and capture on a mobile device
-* History and Acknowledgments::  How Org came into being
-* Main Index::                  An index of Org's concepts and features
-* Key Index::                   Key bindings and where they are described
-* Variable Index::              Variables mentioned in the manual
+* Introduction::               Getting started
+* Document Structure::         A tree works like your brain
+* Tables::                     Pure magic for quick formatting
+* Hyperlinks::                 Notes in context
+* TODO Items::                 Every tree branch can be a TODO item
+* Tags::                       Tagging headlines and matching sets of tags
+* Properties and Columns::     Storing information about an entry
+* Dates and Times::            Making items useful for planning
+* Capture - Refile - Archive:: The ins and outs for projects
+* Agenda Views::               Collecting information into views
+* Markup::                     Prepare text for rich export
+* Exporting::                  Sharing and publishing of notes
+* Publishing::                 Create a web site of linked Org files
+* Working With Source Code::   Export, evaluate, and tangle code blocks
+* Miscellaneous::              All the rest which did not fit elsewhere
+* Hacking::                    How to hack your way around
+* MobileOrg::                  Viewing and capture on a mobile device
+* History and Acknowledgments::         How Org came into being
+* Main Index::                 An index of Org's concepts and features
+* Key Index::                  Key bindings and where they are described
+* Variable Index::             Variables mentioned in the manual
 
 @detailmenu
  --- The Detailed Node Listing ---
 
 Introduction
 
-* Summary::                     Brief summary of what Org does
-* Installation::                How to install a downloaded version of Org
-* Activation::                  How to activate Org for certain buffers
-* Feedback::                    Bug reports, ideas, patches etc.
-* Conventions::                 Type-setting conventions in the manual
-
-Document Structure
-
-* Outlines::                    Org is based on Outline mode
-* Headlines::                   How to typeset Org tree headlines
-* Visibility cycling::          Show and hide, much simplified
-* Motion::                      Jumping to other headlines
-* Structure editing::           Changing sequence and level of headlines
-* Sparse trees::                Matches embedded in context
-* Plain lists::                 Additional structure within an entry
-* Drawers::                     Tucking stuff away
-* Blocks::                      Folding blocks
-* Footnotes::                   How footnotes are defined in Org's syntax
-* Orgstruct mode::              Structure editing outside Org
+* Summary::                    Brief summary of what Org does
+* Installation::               How to install a downloaded version of Org
+* Activation::                 How to activate Org for certain buffers
+* Feedback::                   Bug reports, ideas, patches etc.
+* Conventions::                        Type-setting conventions in the manual
+
+Document structure
+
+* Outlines::                   Org is based on Outline mode
+* Headlines::                  How to typeset Org tree headlines
+* Visibility cycling::         Show and hide, much simplified
+* Motion::                     Jumping to other headlines
+* Structure editing::          Changing sequence and level of headlines
+* Sparse trees::               Matches embedded in context
+* Plain lists::                        Additional structure within an entry
+* Drawers::                    Tucking stuff away
+* Blocks::                     Folding blocks
+* Footnotes::                  How footnotes are defined in Org's syntax
+* Orgstruct mode::             Structure editing outside Org
 
 Tables
 
-* Built-in table editor::       Simple tables
-* Column width and alignment::  Overrule the automatic settings
-* Column groups::               Grouping to trigger vertical lines
-* Orgtbl mode::                 The table editor as minor mode
-* The spreadsheet::             The table editor has spreadsheet capabilities
-* Org-Plot::                    Plotting from org tables
+* Built-in table editor::      Simple tables
+* Column width and alignment:: Overrule the automatic settings
+* Column groups::              Grouping to trigger vertical lines
+* Orgtbl mode::                        The table editor as minor mode
+* The spreadsheet::            The table editor has spreadsheet capabilities
+* Org-Plot::                   Plotting from org tables
 
 The spreadsheet
 
-* References::                  How to refer to another field or range
-* Formula syntax for Calc::     Using Calc to compute stuff
-* Formula syntax for Lisp::     Writing formulas in Emacs Lisp
-* Field formulas::              Formulas valid for a single field
-* Column formulas::             Formulas valid for an entire column
+* References::                 How to refer to another field or range
+* Formula syntax for Calc::    Using Calc to compute stuff
+* Formula syntax for Lisp::    Writing formulas in Emacs Lisp
+* Field formulas::             Formulas valid for a single field
+* Column formulas::            Formulas valid for an entire column
 * Editing and debugging formulas::  Fixing formulas
-* Updating the table::          Recomputing all dependent fields
-* Advanced features::           Field names, parameters and automatic recalc
+* Updating the table::         Recomputing all dependent fields
+* Advanced features::          Field names, parameters and automatic recalc
 
 Hyperlinks
 
-* Link format::                 How links in Org are formatted
-* Internal links::              Links to other places in the current file
-* External links::              URL-like links to the world
-* Handling links::              Creating, inserting and following
-* Using links outside Org::     Linking from my C source code?
-* Link abbreviations::          Shortcuts for writing complex links
-* Search options::              Linking to a specific location
-* Custom searches::             When the default search is not enough
+* Link format::                        How links in Org are formatted
+* Internal links::             Links to other places in the current file
+* External links::             URL-like links to the world
+* Handling links::             Creating, inserting and following
+* Using links outside Org::    Linking from my C source code?
+* Link abbreviations::         Shortcuts for writing complex links
+* Search options::             Linking to a specific location
+* Custom searches::            When the default search is not enough
 
 Internal links
 
-* Radio targets::               Make targets trigger links in plain text
+* Radio targets::              Make targets trigger links in plain text
 
-TODO Items
+TODO items
 
-* TODO basics::                 Marking and displaying TODO entries
-* TODO extensions::             Workflow and assignments
-* Progress logging::            Dates and notes for progress
-* Priorities::                  Some things are more important than others
-* Breaking down tasks::         Splitting a task into manageable pieces
-* Checkboxes::                  Tick-off lists
+* TODO basics::                        Marking and displaying TODO entries
+* TODO extensions::            Workflow and assignments
+* Progress logging::           Dates and notes for progress
+* Priorities::                 Some things are more important than others
+* Breaking down tasks::                Splitting a task into manageable pieces
+* Checkboxes::                 Tick-off lists
 
 Extended use of TODO keywords
 
-* Workflow states::             From TODO to DONE in steps
-* TODO types::                  I do this, Fred does the rest
-* Multiple sets in one file::   Mixing it all, and still finding your way
-* Fast access to TODO states::  Single letter selection of a state
-* Per-file keywords::           Different files, different requirements
-* Faces for TODO keywords::     Highlighting states
-* TODO dependencies::           When one task needs to wait for others
+* Workflow states::            From TODO to DONE in steps
+* TODO types::                 I do this, Fred does the rest
+* Multiple sets in one file::  Mixing it all, and still finding your way
+* Fast access to TODO states:: Single letter selection of a state
+* Per-file keywords::          Different files, different requirements
+* Faces for TODO keywords::    Highlighting states
+* TODO dependencies::          When one task needs to wait for others
 
 Progress logging
 
-* Closing items::               When was this entry marked DONE?
-* Tracking TODO state changes::  When did the status change?
-* Tracking your habits::        How consistent have you been?
+* Closing items::              When was this entry marked DONE?
+* Tracking TODO state changes::         When did the status change?
+* Tracking your habits::       How consistent have you been?
 
 Tags
 
-* Tag inheritance::             Tags use the tree structure of the outline
-* Setting tags::                How to assign tags to a headline
-* Tag searches::                Searching for combinations of tags
+* Tag inheritance::            Tags use the tree structure of the outline
+* Setting tags::               How to assign tags to a headline
+* Tag searches::               Searching for combinations of tags
 
-Properties and Columns
+Properties and columns
 
-* Property syntax::             How properties are spelled out
-* Special properties::          Access to other Org mode features
-* Property searches::           Matching property values
-* Property inheritance::        Passing values down the tree
-* Column view::                 Tabular viewing and editing
-* Property API::                Properties for Lisp programmers
+* Property syntax::            How properties are spelled out
+* Special properties::         Access to other Org-mode features
+* Property searches::          Matching property values
+* Property inheritance::       Passing values down the tree
+* Column view::                        Tabular viewing and editing
+* Property API::               Properties for Lisp programmers
 
 Column view
 
-* Defining columns::            The COLUMNS format property
-* Using column view::           How to create and use column view
-* Capturing column view::       A dynamic block for column view
+* Defining columns::           The COLUMNS format property
+* Using column view::          How to create and use column view
+* Capturing column view::      A dynamic block for column view
 
 Defining columns
 
-* Scope of column definitions::  Where defined, where valid?
-* Column attributes::           Appearance and content of a column
+* Scope of column definitions::         Where defined, where valid?
+* Column attributes::          Appearance and content of a column
 
-Dates and Times
+Dates and times
 
-* Timestamps::                  Assigning a time to a tree entry
-* Creating timestamps::         Commands which insert timestamps
-* Deadlines and scheduling::    Planning your work
-* Clocking work time::          Tracking how long you spend on a task
-* Resolving idle time::         Resolving time if you've been idle
-* Effort estimates::            Planning work effort in advance
-* Relative timer::              Notes with a running timer
+* Timestamps::                 Assigning a time to a tree entry
+* Creating timestamps::                Commands which insert timestamps
+* Deadlines and scheduling::   Planning your work
+* Clocking work time::         Tracking how long you spend on a task
+* Resolving idle time::                Resolving time if you've been idle
+* Effort estimates::           Planning work effort in advance
+* Relative timer::             Notes with a running timer
 
 Creating timestamps
 
-* The date/time prompt::        How Org mode helps you entering date and time
-* Custom time format::          Making dates look different
+* The date/time prompt::       How Org-mode helps you entering date and time
+* Custom time format::         Making dates look different
 
 Deadlines and scheduling
 
-* Inserting deadline/schedule::  Planning items
-* Repeated tasks::              Items that show up again and again
+* Inserting deadline/schedule::         Planning items
+* Repeated tasks::             Items that show up again and again
 
 Capture - Refile - Archive
 
-* Remember::                    Capture new tasks/ideas with little interruption
-* Attachments::                 Add files to tasks.
-* RSS Feeds::                   Getting input from RSS feeds
-* Protocols::                   External (e.g. Browser) access to Emacs and Org
-* Refiling notes::              Moving a tree from one place to another
-* Archiving::                   What to do with finished projects
+* Capture::                    Capturing new stuff
+* Attachments::                        Add files to tasks
+* RSS Feeds::                  Getting input from RSS feeds
+* Protocols::                  External (e.g. Browser) access to Emacs and Org
+* Refiling notes::             Moving a tree from one place to another
+* Archiving::                  What to do with finished projects
+
+Capture
+
+* Setting up capture::         Where notes will be stored
+* Using capture::              Commands to invoke and terminate capture
+* Capture templates::          Define the outline of different note types
 
-Remember
+Capture templates
 
-* Setting up Remember for Org::  Some code for .emacs to get things going
-* Remember templates::          Define the outline of different note types
-* Storing notes::               Directly get the note to where it belongs
+* Template elements::          What is needed for a complete template entry
+* Template expansion::         Filling in information about time and context
 
 Archiving
 
-* Moving subtrees::             Moving a tree to an archive file
-* Internal archiving::          Switch off a tree but keep i in the file
+* Moving subtrees::            Moving a tree to an archive file
+* Internal archiving::         Switch off a tree but keep it in the file
 
-Agenda Views
+Agenda views
 
-* Agenda files::                Files being searched for agenda information
-* Agenda dispatcher::           Keyboard access to agenda views
-* Built-in agenda views::       What is available out of the box?
-* Presentation and sorting::    How agenda items are prepared for display
-* Agenda commands::             Remote editing of Org trees
-* Custom agenda views::         Defining special searches and views
-* Exporting Agenda Views::      Writing a view to a file
-* Agenda column view::          Using column view for collected entries
+* Agenda files::               Files being searched for agenda information
+* Agenda dispatcher::          Keyboard access to agenda views
+* Built-in agenda views::      What is available out of the box?
+* Presentation and sorting::   How agenda items are prepared for display
+* Agenda commands::            Remote editing of Org trees
+* Custom agenda views::                Defining special searches and views
+* Exporting Agenda Views::     Writing a view to a file
+* Agenda column view::         Using column view for collected entries
 
 The built-in agenda views
 
-* Weekly/daily agenda::         The calendar page with current tasks
-* Global TODO list::            All unfinished action items
+* Weekly/daily agenda::                The calendar page with current tasks
+* Global TODO list::           All unfinished action items
 * Matching tags and properties::  Structured information with fine-tuned search
-* Timeline::                    Time-sorted view for single file
-* Search view::                 Find entries by searching for text
-* Stuck projects::              Find projects you need to review
+* Timeline::                   Time-sorted view for single file
+* Search view::                        Find entries by searching for text
+* Stuck projects::             Find projects you need to review
 
 Presentation and sorting
 
-* Categories::                  Not all tasks are equal
-* Time-of-day specifications::  How the agenda knows the time
-* Sorting of agenda items::     The order of things
+* Categories::                 Not all tasks are equal
+* Time-of-day specifications:: How the agenda knows the time
+* Sorting of agenda items::    The order of things
 
 Custom agenda views
 
-* Storing searches::            Type once, use often
-* Block agenda::                All the stuff you need in a single buffer
-* Setting Options::             Changing the rules
+* Storing searches::           Type once, use often
+* Block agenda::               All the stuff you need in a single buffer
+* Setting Options::            Changing the rules
 
 Markup for rich export
 
-* Structural markup elements::  The basic structure as seen by the exporter
-* Images and tables::           Tables and Images will be included
-* Literal examples::            Source code examples with special formatting
-* Include files::               Include additional files into a document
-* Macro replacement::           Use macros to create complex output
-* Embedded LaTeX::              LaTeX can be freely used inside Org documents
+* Structural markup elements:: The basic structure as seen by the exporter
+* Images and tables::          Tables and Images will be included
+* Literal examples::           Source code examples with special formatting
+* Include files::              Include additional files into a document
+* Index entries::              Making an index
+* Macro replacement::          Use macros to create complex output
+* Embedded LaTeX::             LaTeX can be freely used inside Org documents
 
 Structural markup elements
 
-* Document title::              Where the title is taken from
-* Headings and sections::       The document structure as seen by the exporter
-* Table of contents::           The if and where of the table of contents
-* Initial text::                Text before the first heading?
-* Lists::                       Lists
-* Paragraphs::                  Paragraphs
-* Footnote markup::             Footnotes
-* Emphasis and monospace::      Bold, italic, etc.
-* Horizontal rules::            Make a line
-* Comment lines::               What will *not* be exported
+* Document title::             Where the title is taken from
+* Headings and sections::      The document structure as seen by the exporter
+* Table of contents::          The if and where of the table of contents
+* Initial text::               Text before the first heading?
+* Lists::                      Lists
+* Paragraphs::                 Paragraphs
+* Footnote markup::            Footnotes
+* Emphasis and monospace::     Bold, italic, etc.
+* Horizontal rules::           Make a line
+* Comment lines::              What will *not* be exported
 
 Embedded La@TeX{}
 
-* Special symbols::             Greek letters and other symbols
-* Subscripts and superscripts::  Simple syntax for raising/lowering text
-* LaTeX fragments::             Complex formulas made easy
-* Previewing LaTeX fragments::  What will this snippet look like?
-* CDLaTeX mode::                Speed up entering of formulas
+* Special symbols::            Greek letters and other symbols
+* Subscripts and superscripts::         Simple syntax for raising/lowering text
+* LaTeX fragments::            Complex formulas made easy
+* Previewing LaTeX fragments:: What will this snippet look like?
+* CDLaTeX mode::               Speed up entering of formulas
 
 Exporting
 
-* Selective export::            Using tags to select and exclude trees
-* Export options::              Per-file export settings
-* The export dispatcher::       How to access exporter commands
-* ASCII export::                Exporting to plain ASCII
-* HTML export::                 Exporting to HTML
-* LaTeX and PDF export::        Exporting to La@TeX{}, and processing to PDF
-* DocBook export::              Exporting to DocBook
-* Freemind export::             Exporting to Freemind mind maps
-* XOXO export::                 Exporting to XOXO
-* iCalendar export::            Exporting in iCalendar format
+* Selective export::           Using tags to select and exclude trees
+* Export options::             Per-file export settings
+* The export dispatcher::      How to access exporter commands
+* ASCII/Latin-1/UTF-8 export:: Exporting to flat files with encoding
+* HTML export::                        Exporting to HTML
+* LaTeX and PDF export::       Exporting to La@TeX{}, and processing to PDF
+* DocBook export::             Exporting to DocBook
+* TaskJuggler export::         Exporting to TaskJuggler
+* Freemind export::            Exporting to Freemind mind maps
+* XOXO export::                        Exporting to XOXO
+* iCalendar export::           Exporting in iCalendar format
 
 HTML export
 
-* HTML Export commands::        How to invoke HTML export
-* Quoting HTML tags::           Using direct HTML in Org mode
-* Links in HTML export::        How links will be interpreted and formatted
-* Tables in HTML export::       How to modify the formatting of tables
-* Images in HTML export::       How to insert figures into HTML output
-* Text areas in HTML export::   An alternative way to show an example
-* CSS support::                 Changing the appearance of the output
-* Javascript support::          Info and Folding in a web browser
+* HTML Export commands::       How to invoke HTML export
+* Quoting HTML tags::          Using direct HTML in Org-mode
+* Links in HTML export::       How links will be interpreted and formatted
+* Tables in HTML export::      How to modify the formatting of tables
+* Images in HTML export::      How to insert figures into HTML output
+* Text areas in HTML export::  An alternative way to show an example
+* CSS support::                        Changing the appearance of the output
+* JavaScript support::         Info and Folding in a web browser
 
 La@TeX{} and PDF export
 
-* LaTeX/PDF export commands::   Which key invokes which commands
-* Quoting LaTeX code::          Incorporating literal La@TeX{} code
-* Sectioning structure::        Changing sectioning in La@TeX{} output
-* Tables in LaTeX export::      Options for exporting tables to La@TeX{}
-* Images in LaTeX export::      How to insert figures into La@TeX{} output
+* LaTeX/PDF export commands::  Which key invokes which commands
+* Header and sectioning::      Setting up the export file structure
+* Quoting LaTeX code::         Incorporating literal La@TeX{} code
+* Tables in LaTeX export::     Options for exporting tables to La@TeX{}
+* Images in LaTeX export::     How to insert figures into La@TeX{} output
+* Beamer class export::                Turning the file into a presentation
 
 DocBook export
 
-* DocBook export commands::     How to invoke DocBook export
-* Quoting DocBook code::        Incorporating DocBook code in Org files
-* Recursive sections::          Recursive sections in DocBook
-* Tables in DocBook export::    Tables are exported as HTML tables
-* Images in DocBook export::    How to insert figures into DocBook output
-* Special characters::          How to handle special characters
+* DocBook export commands::    How to invoke DocBook export
+* Quoting DocBook code::       Incorporating DocBook code in Org files
+* Recursive sections::         Recursive sections in DocBook
+* Tables in DocBook export::   Tables are exported as HTML tables
+* Images in DocBook export::   How to insert figures into DocBook output
+* Special characters::         How to handle special characters
 
 Publishing
 
-* Configuration::               Defining projects
-* Uploading files::             How to get files up on the server
-* Sample configuration::        Example projects
-* Triggering publication::      Publication commands
+* Configuration::              Defining projects
+* Uploading files::            How to get files up on the server
+* Sample configuration::       Example projects
+* Triggering publication::     Publication commands
 
 Configuration
 
-* Project alist::               The central configuration variable
-* Sources and destinations::    From here to there
-* Selecting files::             What files are part of the project?
-* Publishing action::           Setting the function doing the publishing
-* Publishing options::          Tweaking HTML export
-* Publishing links::            Which links keep working after publishing?
-* Project page index::          Publishing a list of project files
+* Project alist::              The central configuration variable
+* Sources and destinations::   From here to there
+* Selecting files::            What files are part of the project?
+* Publishing action::          Setting the function doing the publishing
+* Publishing options::         Tweaking HTML export
+* Publishing links::           Which links keep working after publishing?
+* Sitemap::                    Generating a list of all pages
+* Generating an index::                An index that reaches across pages
 
 Sample configuration
 
-* Simple example::              One-component publishing
-* Complex example::             A multi-component publishing example
+* Simple example::             One-component publishing
+* Complex example::            A multi-component publishing example
+
+Working with source code
+
+* Structure of code blocks::   Code block syntax described
+* Editing source code::                Language major-mode editing
+* Exporting code blocks::      Export contents and/or results
+* Extracting source code::     Create pure source code files
+* Evaluating code blocks::     Place results of evaluation in the Org-mode buffer
+* Library of Babel::           Use and contribute to a library of useful code blocks
+* Languages::                  List of supported code block languages
+* Header arguments::           Configure code block functionality
+* Results of evaluation::      How evaluation results are handled
+* Noweb reference syntax::     Literate programming in Org-mode
+* Key bindings and useful functions::  Work quickly with code blocks
+* Batch execution::            Call functions from the command line
+
+Header arguments
+
+* Using header arguments::     Different ways to set header arguments
+* Specific header arguments::  List of header arguments
+
+Using header arguments
+
+* System-wide header arguments::  Set global default values
+* Language-specific header arguments:: Set default values by language
+* Buffer-wide header arguments::  Set default values for a specific buffer
+* Header arguments in Org-mode properties::  Set default values for a buffer or heading
+* Code block specific header arguments::  The most common way to set values
+
+Specific header arguments
+
+* var::                                Pass arguments to code blocks
+* results::                    Specify the type of results and how they will be collected and handled
+* file::                       Specify a path for file output
+* dir::                                Specify the default directory for code block execution
+* exports::                    Export code and/or results
+* tangle::                     Toggle tangling and specify file name
+* no-expand::                  Turn off variable assignment and noweb expansion during tangling
+* session::                    Preserve the state of code evaluation
+* noweb::                      Toggle expansion of noweb references
+* cache::                      Avoid re-evaluating unchanged code blocks
+* hlines::                     Handle horizontal lines in tables
+* colnames::                   Handle column names in tables
+* rownames::                   Handle row names in tables
+* shebang::                    Make tangled files executable
 
 Miscellaneous
 
-* Completion::                  M-TAB knows what you need
-* Speed keys::                  Electic commands at the beginning of a headline
-* Customization::               Adapting Org to your taste
-* In-buffer settings::          Overview of the #+KEYWORDS
-* The very busy C-c C-c key::   When in doubt, press C-c C-c
-* Clean view::                  Getting rid of leading stars in the outline
-* TTY keys::                    Using Org on a tty
-* Interaction::                 Other Emacs packages
+* Completion::                 M-TAB knows what you need
+* Speed keys::                 Electric commands at the beginning of a headline
+* Code evaluation security::   Org mode files evaluate inline code
+* Customization::              Adapting Org to your taste
+* In-buffer settings::         Overview of the #+KEYWORDS
+* The very busy C-c C-c key::  When in doubt, press C-c C-c
+* Clean view::                 Getting rid of leading stars in the outline
+* TTY keys::                   Using Org on a tty
+* Interaction::                        Other Emacs packages
 
 Interaction with other packages
 
-* Cooperation::                 Packages Org cooperates with
-* Conflicts::                   Packages that lead to conflicts
+* Cooperation::                        Packages Org cooperates with
+* Conflicts::                  Packages that lead to conflicts
 
 Hacking
 
-* Hooks::                       Who to reach into Org's internals
-* Add-on packages::             Available extensions
-* Adding hyperlink types::      New custom link types
-* Context-sensitive commands::  How to add functionality to such commands
-* Tables in arbitrary syntax::  Orgtbl for La@TeX{} and other programs
-* Dynamic blocks::              Automatically filled blocks
-* Special agenda views::        Customized views
+* Hooks::                      Who to reach into Org's internals
+* Add-on packages::            Available extensions
+* Adding hyperlink types::     New custom link types
+* Context-sensitive commands:: How to add functionality to such commands
+* Tables in arbitrary syntax:: Orgtbl for La@TeX{} and other programs
+* Dynamic blocks::             Automatically filled blocks
+* Special agenda views::       Customized views
 * Extracting agenda information::  Postprocessing of agenda information
-* Using the property API::      Writing programs that use entry properties
-* Using the mapping API::       Mapping over all or selected entries
+* Using the property API::     Writing programs that use entry properties
+* Using the mapping API::      Mapping over all or selected entries
 
 Tables and lists in arbitrary syntax
 
-* Radio tables::                Sending and receiving radio tables
-* A LaTeX example::             Step by step, almost a tutorial
-* Translator functions::        Copy and modify
-* Radio lists::                 Doing the same for lists
+* Radio tables::               Sending and receiving radio tables
+* A LaTeX example::            Step by step, almost a tutorial
+* Translator functions::       Copy and modify
+* Radio lists::                        Doing the same for lists
 
 MobileOrg
 
-* Setting up the staging area::  Where to interact with the mobile device
-* Pushing to MobileOrg::        Uploading Org files and agendas
-* Pulling from MobileOrg::      Integrating captured and flagged items
+* Setting up the staging area::         Where to interact with the mobile device
+* Pushing to MobileOrg::       Uploading Org files and agendas
+* Pulling from MobileOrg::     Integrating captured and flagged items
 
 @end detailmenu
 @end menu
@@ -441,11 +504,11 @@ MobileOrg
 @cindex introduction
 
 @menu
-* Summary::                     Brief summary of what Org does
-* Installation::                How to install a downloaded version of Org
-* Activation::                  How to activate Org for certain buffers
-* Feedback::                    Bug reports, ideas, patches etc.
-* Conventions::                 Type-setting conventions in the manual
+* Summary::                    Brief summary of what Org does
+* Installation::               How to install a downloaded version of Org
+* Activation::                 How to activate Org for certain buffers
+* Feedback::                   Bug reports, ideas, patches etc.
+* Conventions::                        Type-setting conventions in the manual
 @end menu
 
 @node Summary, Installation, Introduction, Introduction
@@ -470,40 +533,39 @@ structured ASCII file, as HTML, or (TODO and agenda items only) as an
 iCalendar file.  It can also serve as a publishing tool for a set of
 linked web pages.
 
-An important design aspect that distinguishes Org from, for example,
-Planner/Muse is that it encourages you to store every piece of information
-only once.  In Planner, you have project pages, day pages and possibly
-other files, duplicating some information such as tasks.  In Org,
-you only have notes files.  In your notes you mark entries as tasks, and
-label them with tags and timestamps.  All necessary lists, like a
-schedule for the day, the agenda for a meeting, tasks lists selected by
-tags, etc., are created dynamically when you need them.
+As a project planning environment, Org works by adding metadata to outline
+nodes.  Based on this data, specific entries can be extracted in queries and
+create dynamic @i{agenda views}.
+
+Org mode contains the Org Babel environment which allows to work with
+embedded source code block in a file, to facilitate code evaluation,
+documentation, and tangling.
+
+Org's automatic, context-sensitive table editor with spreadsheet
+capabilities can be integrated into any major mode by activating the
+minor Orgtbl mode.  Using a translation step, it can be used to maintain
+tables in arbitrary file types, for example in La@TeX{}.  The structure
+editing and list creation capabilities can be used outside Org with
+the minor Orgstruct mode.
 
 Org keeps simple things simple.  When first fired up, it should
 feel like a straightforward, easy to use outliner.  Complexity is not
 imposed, but a large amount of functionality is available when you need
-it.  Org is a toolbox and can be used in different ways, for
-example as:
+it.  Org is a toolbox and can be used in different ways and for different
+ends, for example:
 
 @example
 @r{@bullet{} an outline extension with visibility cycling and structure editing}
 @r{@bullet{} an ASCII system and table editor for taking structured notes}
-@r{@bullet{} an ASCII table editor with spreadsheet-like capabilities}
 @r{@bullet{} a TODO list editor}
 @r{@bullet{} a full agenda and planner with deadlines and work scheduling}
 @pindex GTD, Getting Things Done
-@r{@bullet{} an environment to implement David Allen's GTD system}
-@r{@bullet{} a basic database application}
+@r{@bullet{} an environment in which to implement David Allen's GTD system}
 @r{@bullet{} a simple hypertext system, with HTML and La@TeX{} export}
 @r{@bullet{} a publishing tool to create a set of interlinked webpages}
+@r{@bullet{} an environment for literate programming}
 @end example
 
-Org's automatic, context-sensitive table editor with spreadsheet
-capabilities can be integrated into any major mode by activating the
-minor Orgtbl mode.  Using a translation step, it can be used to maintain
-tables in arbitrary file types, for example in La@TeX{}.  The structure
-editing and list creation capabilities can be used outside Org with
-the minor Orgstruct mode.
 
 @cindex FAQ
 There is a website for Org which provides links to the newest
@@ -600,14 +662,6 @@ Do not forget to activate Org as described in the following section.
 @cindex global key bindings
 @cindex key bindings, global
 
-@iftex
-@b{Important:} @i{If you use copy-and-paste to copy Lisp code from the
-PDF documentation as viewed by some PDF viewers to your @file{.emacs} file, the
-single-quote character comes out incorrectly and the code will not work.
-You need to fix the single-quotes by hand, or copy from Info
-documentation.}
-@end iftex
-
 Add the following lines to your @file{.emacs} file.  The last three lines
 define @emph{global} keys for the commands @command{org-store-link},
 @command{org-agenda}, and @command{org-iswitchb}---please choose suitable
@@ -630,9 +684,9 @@ active.  You can do this with either one of the following two lines
 (add-hook 'org-mode-hook 'turn-on-font-lock)  ; Org buffers only
 @end lisp
 
-@cindex Org mode, turning on
+@cindex Org-mode, turning on
 With this setup, all files with extension @samp{.org} will be put
-into Org mode.  As an alternative, make the first line of a file look
+into Org-mode.  As an alternative, make the first line of a file look
 like this:
 
 @example
@@ -640,7 +694,7 @@ MY PROJECTS    -*- mode: org; -*-
 @end example
 
 @vindex org-insert-mode-line-in-empty-file
-@noindent which will select Org mode for this buffer no matter what
+@noindent which will select Org-mode for this buffer no matter what
 the file's name is.  See also the variable
 @code{org-insert-mode-line-in-empty-file}.
 
@@ -743,7 +797,7 @@ special meaning are written with all capitals.
 @end table
 
 @node Document Structure, Tables, Introduction, Top
-@chapter Document Structure
+@chapter Document structure
 @cindex document structure
 @cindex structure of document
 
@@ -751,17 +805,17 @@ Org is based on Outline mode and provides flexible commands to
 edit the structure of the document.
 
 @menu
-* Outlines::                    Org is based on Outline mode
-* Headlines::                   How to typeset Org tree headlines
-* Visibility cycling::          Show and hide, much simplified
-* Motion::                      Jumping to other headlines
-* Structure editing::           Changing sequence and level of headlines
-* Sparse trees::                Matches embedded in context
-* Plain lists::                 Additional structure within an entry
-* Drawers::                     Tucking stuff away
-* Blocks::                      Folding blocks
-* Footnotes::                   How footnotes are defined in Org's syntax
-* Orgstruct mode::              Structure editing outside Org
+* Outlines::                   Org is based on Outline mode
+* Headlines::                  How to typeset Org tree headlines
+* Visibility cycling::         Show and hide, much simplified
+* Motion::                     Jumping to other headlines
+* Structure editing::          Changing sequence and level of headlines
+* Sparse trees::               Matches embedded in context
+* Plain lists::                        Additional structure within an entry
+* Drawers::                    Tucking stuff away
+* Blocks::                     Folding blocks
+* Footnotes::                  How footnotes are defined in Org's syntax
+* Orgstruct mode::             Structure editing outside Org
 @end menu
 
 @node Outlines, Headlines, Document Structure, Document Structure
@@ -783,11 +837,14 @@ command, @command{org-cycle}, which is bound to the @key{TAB} key.
 @cindex headlines
 @cindex outline tree
 @vindex org-special-ctrl-a/e
+@vindex org-special-ctrl-k
+@vindex org-ctrl-k-protect-subtree
 
-Headlines define the structure of an outline tree.  The headlines in
-Org start with one or more stars, on the left margin@footnote{See
-the variable @code{org-special-ctrl-a/e} to configure special behavior
-of @kbd{C-a} and @kbd{C-e} in headlines.}.  For example:
+Headlines define the structure of an outline tree.  The headlines in Org
+start with one or more stars, on the left margin@footnote{See the variables
+@code{org-special-ctrl-a/e}, @code{org-special-ctrl-k}, and
+@code{org-ctrl-k-protect-subtree} to configure special behavior of @kbd{C-a},
+@kbd{C-e}, and @kbd{C-k} in headlines.}.  For example:
 
 @example
 * Top level headline
@@ -876,7 +933,11 @@ Reveal context around point, showing the current entry, the following heading
 and the hierarchy above.  Useful for working near a location that has been
 exposed by a sparse tree command (@pxref{Sparse trees}) or an agenda command
 (@pxref{Agenda commands}).  With a prefix argument show, on each
-level, all sibling headings.
+level, all sibling headings.  With double prefix arg, also show the entire
+subtree of the parent.
+@kindex C-c C-k
+@item C-c C-k
+Expose all the headings of the subtree, CONTENT view for just one subtree.
 @kindex C-c C-x b
 @item C-c C-x b
 Show the current subtree in an indirect buffer@footnote{The indirect
@@ -1134,7 +1195,7 @@ functionality.
 @vindex org-show-following-heading
 @vindex org-show-siblings
 @vindex org-show-entry-below
-An important feature of Org mode is the ability to construct @emph{sparse
+An important feature of Org-mode is the ability to construct @emph{sparse
 trees} for selected information in an outline tree, so that the entire
 document is folded as much as possible, but the selected information is made
 visible along with the headline structure above it@footnote{See also the
@@ -1143,7 +1204,7 @@ variables @code{org-show-hierarchy-above}, @code{org-show-following-heading},
 control on how much context is shown around each match.}.  Just try it out
 and you will see immediately how it works.
 
-Org mode contains several commands creating such trees, all these
+Org-mode contains several commands creating such trees, all these
 commands can be accessed through a dispatcher:
 
 @table @kbd
@@ -1218,7 +1279,9 @@ visually indistinguishable from true headlines.  In short: even though
 as bullets.
 @item
 @emph{Ordered} list items start with a numeral followed by either a period or
-a right parenthesis, such as @samp{1.} or @samp{1)}.
+a right parenthesis, such as @samp{1.} or @samp{1)}.  If you want a list to
+start a different value (e.g. 20), start the text of the item with
+@code{[@@start:20]}.
 @item
 @emph{Description} list items are unordered list items, and contain the
 separator @samp{ :: } to separate the description @emph{term} from the
@@ -1263,6 +1326,11 @@ properly (@pxref{Exporting}).  Since indentation is what governs the
 structure of these lists, many structural constructs like @code{#+BEGIN_...}
 blocks can be indented to signal that they should be part of a list item.
 
+@vindex org-list-demote-modify-bullet
+If you find that using a different bullet for a sub-list (than that used for
+the current list-level) improves readability, customize the variable
+@code{org-list-demote-modify-bullet}.
+
 The following commands act on items when the cursor is in the first line
 of an item (the line with the bullet or number).
 
@@ -1317,6 +1385,11 @@ similar effect.
 Move the item including subitems up/down (swap with previous/next item
 of same indentation).  If the list is ordered, renumbering is
 automatic.
+@kindex M-@key{left}
+@kindex M-@key{right}
+@item M-@key{left}
+@itemx M-@key{right}
+Decrease/increase the indentation of an item, leaving children alone.
 @kindex M-S-@key{left}
 @kindex M-S-@key{right}
 @item M-S-@key{left}
@@ -1367,7 +1440,7 @@ numerically, alphabetically, by time, or by custom function.
 
 @vindex org-drawers
 Sometimes you want to keep information associated with an entry, but you
-normally don't want to see it.  For this, Org mode has @emph{drawers}.
+normally don't want to see it.  For this, Org-mode has @emph{drawers}.
 Drawers need to be configured with the variable
 @code{org-drawers}@footnote{You can define drawers on a per-file basis
 with a line like @code{#+DRAWERS: HIDDEN PROPERTIES STATE}}.  Drawers
@@ -1385,10 +1458,18 @@ look like this:
 Visibility cycling (@pxref{Visibility cycling}) on the headline will hide and
 show the entry, but keep the drawer collapsed to a single line.  In order to
 look inside the drawer, you need to move the cursor to the drawer line and
-press @key{TAB} there.  Org mode uses the @code{PROPERTIES} drawer for
+press @key{TAB} there.  Org-mode uses the @code{PROPERTIES} drawer for
 storing properties (@pxref{Properties and Columns}), and you can also arrange
 for state change notes (@pxref{Tracking TODO state changes}) and clock times
-(@pxref{Clocking work time}) to be stored in a drawer @code{LOGBOOK}.
+(@pxref{Clocking work time}) to be stored in a drawer @code{LOGBOOK}.  If you
+want to store a quick note in the LOGBOOK drawer, in a similar way as this is
+done by state changes, use
+
+@table @kbd
+@kindex C-c C-z
+@item C-c C-z
+Add a time-stamped note to the LOGBOOK drawer.
+@end table
 
 @node Blocks, Footnotes, Drawers, Document Structure
 @section Blocks
@@ -1413,8 +1494,8 @@ or on a per-file basis by using
 @section Footnotes
 @cindex footnotes
 
-Org mode supports the creation of footnotes.  In contrast to the
-@file{footnote.el} package, Org mode's footnotes are designed for work on a
+Org-mode supports the creation of footnotes.  In contrast to the
+@file{footnote.el} package, Org-mode's footnotes are designed for work on a
 larger document, not only for one-off documents like emails.  The basic
 syntax is similar to the one used by @file{footnote.el}, i.e. a footnote is
 defined in a paragraph that is started by a footnote marker in square
@@ -1428,7 +1509,7 @@ The Org homepage[fn:1] now looks a lot better than it used to.
 [fn:1] The link is: http://orgmode.org
 @end example
 
-Org mode extends the number-based syntax to @emph{named} footnotes and
+Org-mode extends the number-based syntax to @emph{named} footnotes and
 optional inline definition.  Using plain numbers as markers (as
 @file{footnote.el} does) is supported for backward compatibility, but not
 encouraged because of possible conflicts with La@TeX{} snippets (@pxref{Embedded
@@ -1522,7 +1603,7 @@ you can use the usual commands to follow these links.
 @cindex Orgstruct mode
 @cindex minor mode for structure editing
 
-If you like the intuitive way the Org mode structure editing and list
+If you like the intuitive way the Org-mode structure editing and list
 formatting works, you might want to use these commands in other modes like
 Text mode or Mail mode as well.  The minor mode @code{orgstruct-mode} makes
 this possible.   Toggle the mode with @kbd{M-x orgstruct-mode}, or
@@ -1559,12 +1640,12 @@ calculator).
 @end ifnotinfo
 
 @menu
-* Built-in table editor::       Simple tables
-* Column width and alignment::  Overrule the automatic settings
-* Column groups::               Grouping to trigger vertical lines
-* Orgtbl mode::                 The table editor as minor mode
-* The spreadsheet::             The table editor has spreadsheet capabilities
-* Org-Plot::                    Plotting from org tables
+* Built-in table editor::      Simple tables
+* Column width and alignment:: Overrule the automatic settings
+* Column groups::              Grouping to trigger vertical lines
+* Orgtbl mode::                        The table editor as minor mode
+* The spreadsheet::            The table editor has spreadsheet capabilities
+* Org-Plot::                   Plotting from org tables
 @end menu
 
 @node Built-in table editor, Column width and alignment, Tables, Tables
@@ -1815,13 +1896,13 @@ The width of columns is automatically determined by the table editor.  And
 also the alignment of a column is determined automatically from the fraction
 of number-like versus non-number fields in the column.
 
-Sometimes a single field or a few fields need to carry more text,
-leading to inconveniently wide columns.  To limit@footnote{This feature
-does not work on XEmacs.} the width of a column, one field anywhere in
-the column may contain just the string @samp{<N>} where @samp{N} is an
-integer specifying the width of the column in characters.  The next
-re-align will then set the width of this column to no more than this
-value.
+Sometimes a single field or a few fields need to carry more text, leading to
+inconveniently wide columns.  Or maybe you want to make a table with several
+columns having a fixed width, regardless of content.  To set@footnote{This
+feature does not work on XEmacs.} the width of a column, one field anywhere
+in the column may contain just the string @samp{<N>} where @samp{N} is an
+integer specifying the width of the column in characters.  The next re-align
+will then set the width of this column to this value.
 
 @example
 @group
@@ -1862,6 +1943,9 @@ to the right and of string-rich column to the left, you and use @samp{<r>} or
 @samp{<l>} in a similar fashion.  You may also combine alignment and field
 width like this: @samp{<l10>}.
 
+Lines which only contain these formatting cookies will be removed
+automatically when exporting the document.
+
 @node Column groups, Orgtbl mode, Column width and alignment, Tables
 @section Column groups
 @cindex grouping columns in tables
@@ -1878,18 +1962,18 @@ a group of its own.  Boundaries between column groups will upon export be
 marked with vertical lines.  Here is an example:
 
 @example
-|   |  N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
-|---+----+-----+-----+-----+---------+------------|
-| / | <> |   < |     |   > |       < |          > |
-| # |  1 |   1 |   1 |   1 |       1 |          1 |
-| # |  2 |   4 |   8 |  16 |  1.4142 |     1.1892 |
-| # |  3 |   9 |  27 |  81 |  1.7321 |     1.3161 |
-|---+----+-----+-----+-----+---------+------------|
-#+TBLFM: $3=$2^2::$4=$2^3::$5=$2^4::$6=sqrt($2)::$7=sqrt(sqrt(($2)))
+| N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
+|---+-----+-----+-----+---------+------------|
+| / |   < |     |   > |       < |          > |
+| 1 |   1 |   1 |   1 |       1 |          1 |
+| 2 |   4 |   8 |  16 |  1.4142 |     1.1892 |
+| 3 |   9 |  27 |  81 |  1.7321 |     1.3161 |
+|---+-----+-----+-----+---------+------------|
+#+TBLFM: $2=$1^2::$3=$1^3::$4=$1^4::$5=sqrt($1)::$6=sqrt(sqrt(($1)))
 @end example
 
 It is also sufficient to just insert the column group starters after
-every vertical line you'd like to have:
+every vertical line you would like to have:
 
 @example
 |  N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
@@ -1926,21 +2010,23 @@ Orgtbl mode, including spreadsheet capabilities.  For details, see
 
 The table editor makes use of the Emacs @file{calc} package to implement
 spreadsheet-like capabilities.  It can also evaluate Emacs Lisp forms to
-derive fields from other fields.  While fully featured, Org's
-implementation is not identical to other spreadsheets.  For example,
-Org knows the concept of a @emph{column formula} that will be
-applied to all non-header fields in a column without having to copy the
-formula to each relevant field.
+derive fields from other fields.  While fully featured, Org's implementation
+is not identical to other spreadsheets.  For example, Org knows the concept
+of a @emph{column formula} that will be applied to all non-header fields in a
+column without having to copy the formula to each relevant field.  There is
+also a formula debugger, and a formula editor with features for highlighting
+fields in the table corresponding to the references at the point in the
+formula, moving these references by arrow keys
 
 @menu
-* References::                  How to refer to another field or range
-* Formula syntax for Calc::     Using Calc to compute stuff
-* Formula syntax for Lisp::     Writing formulas in Emacs Lisp
-* Field formulas::              Formulas valid for a single field
-* Column formulas::             Formulas valid for an entire column
+* References::                 How to refer to another field or range
+* Formula syntax for Calc::    Using Calc to compute stuff
+* Formula syntax for Lisp::    Writing formulas in Emacs Lisp
+* Field formulas::             Formulas valid for a single field
+* Column formulas::            Formulas valid for an entire column
 * Editing and debugging formulas::  Fixing formulas
-* Updating the table::          Recomputing all dependent fields
-* Advanced features::           Field names, parameters and automatic recalc
+* Updating the table::         Recomputing all dependent fields
+* Advanced features::          Field names, parameters and automatic recalc
 @end menu
 
 @node References, Formula syntax for Calc, The spreadsheet, The spreadsheet
@@ -2038,6 +2124,28 @@ suppressed, so that the vector contains only the non-empty fields (but
 see the @samp{E} mode switch below).  If there are no non-empty fields,
 @samp{[0]} is returned to avoid syntax errors in formulas.
 
+@subsubheading Field coordinates in formulas
+@cindex field coordinates
+@cindex coordinates, of field
+@cindex row, of field coordinates
+@cindex column, of field coordinates
+
+For Calc formulas and Lisp formulas @code{@@#} and @code{$#} can be used to
+get the row or column number of the field where the formula result goes.
+The traditional Lisp formula equivalents are @code{org-table-current-dline}
+and @code{org-table-current-column}.  Examples:
+
+@example
+if(@@# % 2, $#, string(""))   @r{column number on odd lines only}
+$3 = remote(FOO, @@@@#$2)      @r{copy column 2 from table FOO into}
+                             @r{column 3 of the current table}
+@end example
+
+@noindent For the second example, table FOO must have at least as many rows
+as the current table.  Inefficient@footnote{The computation time scales as
+O(N^2) because table FOO is parsed for each field to be copied.} for large
+number of rows.
+
 @subsubheading Named references
 @cindex named references
 @cindex references, named
@@ -2127,8 +2235,11 @@ compact.  The default settings can be configured using the variable
 @code{org-calc-default-modes}.
 
 @example
-p20           @r{switch the internal precision to 20 digits}
-n3 s3 e2 f4   @r{normal, scientific, engineering, or fixed display format}
+p20           @r{set the internal Calc calculation precision to 20 digits}
+n3 s3 e2 f4   @r{Normal, scientific, engineering, or fixed}
+              @r{format of the result of Calc passed back to Org.}
+              @r{Calc formatting is unlimited in precision as}
+              @r{long as the Calc calculation precision is greater.}
 D R           @r{angle modes: degrees, radians}
 F S           @r{fraction and symbolic modes}
 N             @r{interpret all fields as numbers, use 0 for non-numbers}
@@ -2138,8 +2249,16 @@ L             @r{literal}
 @end example
 
 @noindent
-In addition, you may provide a @code{printf} format specifier to
-reformat the final result.  A few examples:
+Unless you use large integer numbers or high-precision-calculation
+and -display for floating point numbers you may alternatively provide a
+@code{printf} format specifier to reformat the Calc result after it has been
+passed back to Org instead of letting Calc already do the
+formatting@footnote{The @code{printf} reformatting is limited in precision
+because the value passed to it is converted into an @code{integer} or
+@code{double}.  The @code{integer} is limited in size by truncating the
+signed value to 32 bits.  The @code{double} is limited in precision to 64
+bits overall which leaves approximately 16 significant decimal digits.}.
+A few examples:
 
 @example
 $1+$2                @r{Sum of first and second field}
@@ -2409,6 +2528,11 @@ hline are left alone, assuming that these are part of the table header.
 Iterate the table by recomputing it until no further changes occur.
 This may be necessary if some computed fields use the value of other
 fields that are computed @i{later} in the calculation sequence.
+@item M-x org-table-recalculate-buffer-tables
+Recompute all tables in the current buffer.
+@item M-x org-table-iterate-buffer-tables
+Iterate all tables in the current buffer, in order to converge table-to-table
+dependencies.
 @end table
 
 @node Advanced features,  , Updating the table, The spreadsheet
@@ -2516,7 +2640,7 @@ functions.
 @node Org-Plot,  , The spreadsheet, Tables
 @section Org-Plot
 @cindex graph, in tables
-@cindex plot tables using gnuplot
+@cindex plot tables using Gnuplot
 @cindex #+PLOT
 
 Org-Plot can produce 2D and 3D graphs of information stored in org tables
@@ -2606,14 +2730,14 @@ Like HTML, Org provides links inside a file, external links to
 other files, Usenet articles, emails, and much more.
 
 @menu
-* Link format::                 How links in Org are formatted
-* Internal links::              Links to other places in the current file
-* External links::              URL-like links to the world
-* Handling links::              Creating, inserting and following
-* Using links outside Org::     Linking from my C source code?
-* Link abbreviations::          Shortcuts for writing complex links
-* Search options::              Linking to a specific location
-* Custom searches::             When the default search is not enough
+* Link format::                        How links in Org are formatted
+* Internal links::             Links to other places in the current file
+* External links::             URL-like links to the world
+* Handling links::             Creating, inserting and following
+* Using links outside Org::    Linking from my C source code?
+* Link abbreviations::         Shortcuts for writing complex links
+* Search options::             Linking to a specific location
+* Custom searches::            When the default search is not enough
 @end menu
 
 @node Link format, Internal links, Hyperlinks, Hyperlinks
@@ -2689,7 +2813,7 @@ headlines@footnote{To insert a link targeting a headline, in-buffer
 completion can be used.  Just type a star followed by a few optional letters
 into the buffer and press @kbd{M-@key{TAB}}.  All headlines in the current
 buffer will be offered as completions.  @xref{Handling links}, for more
-commands creating links.}.  When searching, Org mode will first try an
+commands creating links.}.  When searching, Org-mode will first try an
 exact match, but then move on to more and more lenient searches.  For
 example, the link @samp{[[*My Targets]]} will find any of the following:
 
@@ -2706,7 +2830,7 @@ several times in direct succession goes back to positions recorded
 earlier.
 
 @menu
-* Radio targets::               Make targets trigger links in plain text
+* Radio targets::              Make targets trigger links in plain text
 @end menu
 
 @node Radio targets,  , Internal links, Internal links
@@ -2752,14 +2876,18 @@ the colon.  The following list shows examples for each link type.
 
 @example
 http://www.astro.uva.nl/~dominik          @r{on the web}
+doi:10.1000/182                           @r{DOI for an electronic resource}
 file:/home/dominik/images/jupiter.jpg     @r{file, absolute path}
 /home/dominik/images/jupiter.jpg          @r{same as above}
 file:papers/last.pdf                      @r{file, relative path}
 ./papers/last.pdf                         @r{same as above}
+file:/myself@@some.where:papers/last.pdf   @r{file, path on remote machine}
+/myself@@some.where:papers/last.pdf        @r{same as above}
 file:sometextfile::NNN                    @r{file with line number to jump to}
 file:projects.org                         @r{another Org file}
 file:projects.org::some words             @r{text search in Org file}
 file:projects.org::*task title            @r{heading search in Org file}
+docview:papers/last.pdf::NNN              @r{open file in doc-view mode at page NNN}
 id:B7423F4D-2E8A-471B-8810-C40F074717E9   @r{Link to heading by ID}
 news:comp.emacs                           @r{Usenet link}
 mailto:adent@@galaxy.net                   @r{Mail link}
@@ -2776,6 +2904,7 @@ gnus:group                                @r{Gnus group link}
 gnus:group#id                             @r{Gnus article link}
 bbdb:R.*Stallman                          @r{BBDB link (with regexp)}
 irc:/irc.com/#emacs/bob                   @r{IRC link}
+info:org:External%20links                 @r{Info node link (with encoded space)}
 shell:ls *.org                            @r{A shell command}
 elisp:org-agenda                          @r{Interactive Elisp command}
 elisp:(find-file-other-frame "Elisp.org") @r{Elisp form to evaluate}
@@ -2916,14 +3045,14 @@ to the current directory using @samp{../}.  Otherwise an absolute path
 is used, if possible with @samp{~/} for your home directory.  You can
 force an absolute path with two @kbd{C-u} prefixes.
 @c
-@item C-c C-l @r{(with cursor on existing link)}
+@item C-c C-l @ @r{(with cursor on existing link)}
 When the cursor is on an existing link, @kbd{C-c C-l} allows you to edit the
 link and description parts of the link.
 @c
 @cindex following links
 @kindex C-c C-o
-@kindex RET
-@item C-c C-o @r{or} @key{RET}
+@kindex @key{RET}
+@item C-c C-o @ @r{(or, if @code{org-return-follows-link} is set, also} @key{RET}
 @vindex org-file-apps
 Open link at point.  This will launch a web browser for URLs (using
 @command{browse-url-at-point}), run VM/MH-E/Wanderlust/Rmail/Gnus/BBDB for
@@ -2954,6 +3083,14 @@ Like @kbd{mouse-2}, but force file links to be opened with Emacs, and
 internal links to be displayed in another window@footnote{See the
 variable @code{org-display-internal-link-with-indirect-buffer}}.
 @c
+@cindex inlining images
+@cindex images, inlining
+@kindex C-c C-x C-v
+@item C-c C-x C-v
+Toggle the inline display of linked images.  Normally this will only inline
+images that have no description part in the link, i.e. images that will also
+be inlined during export.  When called with a prefix argument, also display
+images that do have a link description.
 @cindex mark ring
 @kindex C-c %
 @item C-c %
@@ -3013,8 +3150,9 @@ abbreviated link looks like this
 
 @noindent
 @vindex org-link-abbrev-alist
-where the tag is optional.  The @i{linkword} must be a word; letter, numbers,
-@samp{-}, and @samp{_} are allowed here.  Abbreviations are resolved
+where the tag is optional.
+The @i{linkword} must be a word, starting with a letter, followed by
+letters, numbers, @samp{-}, and @samp{_}.  Abbreviations are resolved
 according to the information in the variable @code{org-link-abbrev-alist}
 that relates the linkwords to replacement text.  Here is an example:
 
@@ -3075,6 +3213,7 @@ link, together with an explanation:
 [[file:~/code/main.c::255]]
 [[file:~/xx.org::My Target]]
 [[file:~/xx.org::*My Target]]
+[[file:~/xx.org::#my-custom-id]]
 [[file:~/xx.org::/regexp/]]
 @end example
 
@@ -3089,10 +3228,12 @@ link will become an HTML reference to the corresponding named anchor in
 the linked file.
 @item *My Target
 In an Org file, restrict search to headlines.
+@item #my-custom-id
+Link to a heading with a @code{CUSTOM_ID} property
 @item /regexp/
 Do a regular expression search for @code{regexp}.  This uses the Emacs
 command @code{occur} to list all matches in a separate window.  If the
-target file is in Org mode, @code{org-occur} is used to create a
+target file is in Org-mode, @code{org-occur} is used to create a
 sparse tree with the matches.
 @c If the target file is a directory,
 @c @code{grep} will be used to search all files in the directory.
@@ -3128,10 +3269,10 @@ for Bib@TeX{} database files, and you can use the corresponding code as
 an implementation example.  See the file @file{org-bibtex.el}.
 
 @node TODO Items, Tags, Hyperlinks, Top
-@chapter TODO Items
+@chapter TODO items
 @cindex TODO items
 
-Org mode does not maintain TODO lists as separate documents@footnote{Of
+Org-mode does not maintain TODO lists as separate documents@footnote{Of
 course, you can make a document that contains only long lists of TODO items,
 but this is not required.}.  Instead, TODO items are an integral part of the
 notes file, because TODO items usually come up while taking notes!  With Org
@@ -3140,16 +3281,16 @@ information is not duplicated, and the entire context from which the TODO
 item emerged is always present.
 
 Of course, this technique for managing TODO items scatters them
-throughout your notes file.  Org mode compensates for this by providing
+throughout your notes file.  Org-mode compensates for this by providing
 methods to give you an overview of all the things that you have to do.
 
 @menu
-* TODO basics::                 Marking and displaying TODO entries
-* TODO extensions::             Workflow and assignments
-* Progress logging::            Dates and notes for progress
-* Priorities::                  Some things are more important than others
-* Breaking down tasks::         Splitting a task into manageable pieces
-* Checkboxes::                  Tick-off lists
+* TODO basics::                        Marking and displaying TODO entries
+* TODO extensions::            Workflow and assignments
+* Progress logging::           Dates and notes for progress
+* Priorities::                 Some things are more important than others
+* Breaking down tasks::                Splitting a task into manageable pieces
+* Checkboxes::                 Tick-off lists
 @end menu
 
 @node TODO basics, TODO extensions, TODO Items, TODO Items
@@ -3196,27 +3337,26 @@ mostly if more than two TODO states are possible (@pxref{TODO
 extensions}).  See also @ref{Conflicts}, for a discussion of the interaction
 with @code{shift-selection-mode}.  See also the variable
 @code{org-treat-S-cursor-todo-selection-as-state-change}.
-@kindex C-c C-v
 @kindex C-c / t
 @cindex sparse tree, for TODO
-@item C-c C-v
 @itemx C-c / t
 @vindex org-todo-keywords
 View TODO items in a @emph{sparse tree} (@pxref{Sparse trees}).  Folds the
-entire buffer, but shows all TODO items and the headings hierarchy above
-them.  With a prefix argument, search for a specific TODO.  You will be
-prompted for the keyword, and you can also give a list of keywords like
-@code{KWD1|KWD2|...} to list entries that match any one of these keywords.
-With numeric prefix argument N, show the tree for the Nth keyword in the
-variable @code{org-todo-keywords}.  With two prefix arguments, find all TODO
-and DONE entries.
+entire buffer, but shows all TODO items (with not-DONE state) and the
+headings hierarchy above them.  With a prefix argument (or by using @kbd{C-c
+/ T}), search for a specific TODO.  You will be prompted for the keyword, and
+you can also give a list of keywords like @code{KWD1|KWD2|...} to list
+entries that match any one of these keywords.  With numeric prefix argument
+N, show the tree for the Nth keyword in the variable
+@code{org-todo-keywords}.  With two prefix arguments, find all TODO states,
+both un-done and done.
 @kindex C-c a t
 @item C-c a t
-Show the global TODO list.  Collects the TODO items from all agenda
-files (@pxref{Agenda Views}) into a single buffer.  The new buffer will
-be in @code{agenda-mode}, which provides commands to examine and
-manipulate the TODO entries from the new buffer (@pxref{Agenda
-commands}).  @xref{Global TODO list}, for more information.
+Show the global TODO list.  Collects the TODO items (with not-DONE states)
+from all agenda files (@pxref{Agenda Views}) into a single buffer.  The new
+buffer will be in @code{agenda-mode}, which provides commands to examine and
+manipulate the TODO entries from the new buffer (@pxref{Agenda commands}).
+@xref{Global TODO list}, for more information.
 @kindex S-M-@key{RET}
 @item S-M-@key{RET}
 Insert a new TODO entry below the current one.
@@ -3233,7 +3373,7 @@ option @code{org-todo-state-tags-triggers} for details.
 
 @vindex org-todo-keywords
 By default, marked TODO entries have one of only two states: TODO and
-DONE.  Org mode allows you to classify TODO items in more complex ways
+DONE.  Org-mode allows you to classify TODO items in more complex ways
 with @emph{TODO keywords} (stored in @code{org-todo-keywords}).  With
 special setup, the TODO keyword system can work differently in different
 files.
@@ -3242,13 +3382,13 @@ Note that @i{tags} are another way to classify headlines in general and
 TODO items in particular (@pxref{Tags}).
 
 @menu
-* Workflow states::             From TODO to DONE in steps
-* TODO types::                  I do this, Fred does the rest
-* Multiple sets in one file::   Mixing it all, and still finding your way
-* Fast access to TODO states::  Single letter selection of a state
-* Per-file keywords::           Different files, different requirements
-* Faces for TODO keywords::     Highlighting states
-* TODO dependencies::           When one task needs to wait for others
+* Workflow states::            From TODO to DONE in steps
+* TODO types::                 I do this, Fred does the rest
+* Multiple sets in one file::  Mixing it all, and still finding your way
+* Fast access to TODO states:: Single letter selection of a state
+* Per-file keywords::          Different files, different requirements
+* Faces for TODO keywords::    Highlighting states
+* TODO dependencies::          When one task needs to wait for others
 @end menu
 
 @node Workflow states, TODO types, TODO extensions, TODO extensions
@@ -3258,7 +3398,7 @@ TODO items in particular (@pxref{Tags}).
 
 You can use TODO keywords to indicate different @emph{sequential} states
 in the process of working on an item, for example@footnote{Changing
-this variable only becomes effective after restarting Org mode in a
+this variable only becomes effective after restarting Org-mode in a
 buffer.}:
 
 @lisp
@@ -3301,7 +3441,7 @@ be set up like this:
 
 In this case, different keywords do not indicate a sequence, but rather
 different types.  So the normal work flow would be to assign a task to a
-person, and later to mark it DONE.  Org mode supports this style by adapting
+person, and later to mark it DONE.  Org-mode supports this style by adapting
 the workings of the command @kbd{C-c C-t}@footnote{This is also true for the
 @kbd{t} command in the timeline and agenda buffers.}.  When used several
 times in succession, it will still cycle through all names, in order to first
@@ -3309,10 +3449,10 @@ select the right type for a task.  But when you return to the item after some
 time and execute @kbd{C-c C-t} again, it will switch from any name directly
 to DONE.  Use prefix arguments or completion to quickly select a specific
 name.  You can also review the items of a specific TODO type in a sparse tree
-by using a numeric prefix to @kbd{C-c C-v}.  For example, to see all things
-Lucy has to do, you would use @kbd{C-3 C-c C-v}.  To collect Lucy's items
+by using a numeric prefix to @kbd{C-c / t}.  For example, to see all things
+Lucy has to do, you would use @kbd{C-3 C-c / t}.  To collect Lucy's items
 from all agenda files into a single buffer, you would use the numeric prefix
-argument as well when creating the global TODO list: @kbd{C-3 C-c t}.
+argument as well when creating the global TODO list: @kbd{C-3 C-c t}.
 
 @node Multiple sets in one file, Fast access to TODO states, TODO types, TODO extensions
 @subsection Multiple keyword sets in one file
@@ -3332,7 +3472,7 @@ like this:
         (sequence "|" "CANCELED")))
 @end lisp
 
-The keywords should all be different, this helps Org mode to keep track
+The keywords should all be different, this helps Org-mode to keep track
 of which subsequence should be used for a given entry.  In this setup,
 @kbd{C-c C-t} only operates within a subsequence, so it switches from
 @code{DONE} to (nothing) to @code{TODO}, and from @code{FIXED} to
@@ -3429,9 +3569,9 @@ Remember that the keywords after the vertical bar (or the last keyword
 if no bar is there) must always mean that the item is DONE (although you
 may use a different word).  After changing one of these lines, use
 @kbd{C-c C-c} with the cursor still in the line to make the changes
-known to Org mode@footnote{Org mode parses these lines only when
-Org mode is activated after visiting a file.  @kbd{C-c C-c} with the
-cursor in a line starting with @samp{#+} is simply restarting Org mode
+known to Org-mode@footnote{Org-mode parses these lines only when
+Org-mode is activated after visiting a file.  @kbd{C-c C-c} with the
+cursor in a line starting with @samp{#+} is simply restarting Org-mode
 for the current buffer.}.
 
 @node Faces for TODO keywords, TODO dependencies, Per-file keywords, TODO extensions
@@ -3441,7 +3581,7 @@ for the current buffer.}.
 @vindex org-todo @r{(face)}
 @vindex org-done @r{(face)}
 @vindex org-todo-keyword-faces
-Org mode highlights TODO keywords with special faces: @code{org-todo}
+Org-mode highlights TODO keywords with special faces: @code{org-todo}
 for keywords indicating that an item still has to be acted upon, and
 @code{org-done} for keywords indicating that an item is finished.  If
 you are using more than 2 different states, you might want to use
@@ -3451,15 +3591,16 @@ special faces for some of them.  This can be done using the variable
 @lisp
 @group
 (setq org-todo-keyword-faces
-      '(("TODO"      . org-warning)
-        ("DEFERRED"  . shadow)
-        ("CANCELED"  . (:foreground "blue" :weight bold))))
+      '(("TODO" . org-warning) ("STARTED" . "yellow")
+        ("CANCELED" . (:foreground "blue" :weight bold))))
 @end group
 @end lisp
 
-While using a list with face properties as shown for CANCELED
-@emph{should} work, this does not aways seem to be the case.  If
-necessary, define a special face and use that.
+While using a list with face properties as shown for CANCELED @emph{should}
+work, this does not aways seem to be the case.  If necessary, define a
+special face and use that.  A string is interpreted as a color.  The variable
+@code{org-faces-easy-properties} determines if that color is interpreted as a
+foreground or a background color.
 
 @node TODO dependencies,  , Faces for TODO keywords, TODO extensions
 @subsection TODO dependencies
@@ -3530,7 +3671,7 @@ module @file{org-depend.el}.
 @cindex progress logging
 @cindex logging, of progress
 
-Org mode can automatically record a timestamp and possibly a note when
+Org-mode can automatically record a timestamp and possibly a note when
 you mark a TODO item as DONE, or even each time you change the state of
 a TODO item.  This system is highly configurable, settings can be on a
 per-keyword basis and can be localized to a file or even a subtree.  For
@@ -3538,9 +3679,9 @@ information on how to clock working time for a task, see @ref{Clocking
 work time}.
 
 @menu
-* Closing items::               When was this entry marked DONE?
-* Tracking TODO state changes::  When did the status change?
-* Tracking your habits::        How consistent have you been?
+* Closing items::              When was this entry marked DONE?
+* Tracking TODO state changes::         When did the status change?
+* Tracking your habits::       How consistent have you been?
 @end menu
 
 @node Closing items, Tracking TODO state changes, Progress logging, Progress logging
@@ -3594,7 +3735,7 @@ behavior---the recommended drawer for this is called @code{LOGBOOK}.  You can
 also overrule the setting of this variable for a subtree by setting a
 @code{LOG_INTO_DRAWER} property.
 
-Since it is normally too much to record a note for every state, Org mode
+Since it is normally too much to record a note for every state, Org-mode
 expects configuration on a per-keyword basis for this.  This is achieved by
 adding special markers @samp{!} (for a timestamp) and @samp{@@} (for a note)
 in parentheses after each keyword.  For example, with the setting
@@ -3608,7 +3749,7 @@ in parentheses after each keyword.  For example, with the setting
 @vindex org-log-done
 you not only define global TODO keywords and fast access keys, but also
 request that a time is recorded when the entry is set to
-DONE@footnote{It is possible that Org mode will record two timestamps
+DONE@footnote{It is possible that Org-mode will record two timestamps
 when you are using both @code{org-log-done} and state change logging.
 However, it will never prompt for two notes---if you have configured
 both, the state change recording note will take precedence and cancel
@@ -3724,7 +3865,7 @@ If the task was going to be overdue the next day.
 If the task was overdue on that day.
 @end table
 
-In addition to coloring each day, the day is also marked with an asterix if
+In addition to coloring each day, the day is also marked with an asterisk if
 the task was actually done that day, and an exclamation mark to show where
 the current day falls in the graph.
 
@@ -3754,21 +3895,22 @@ which should only be done in certain contexts, for example.
 @section Priorities
 @cindex priorities
 
-If you use Org mode extensively, you may end up enough TODO items that
+If you use Org-mode extensively, you may end up with enough TODO items that
 it starts to make sense to prioritize them.  Prioritizing can be done by
-placing a @emph{priority cookie} into the headline of a TODO item, like
-this
+placing a @emph{priority cookie} into the headline of a TODO item, like this
 
 @example
 *** TODO [#A] Write letter to Sam Fortune
 @end example
 
 @noindent
-By default, Org mode supports three priorities: @samp{A}, @samp{B}, and
-@samp{C}.  @samp{A} is the highest priority.  An entry without a cookie
-is treated as priority @samp{B}.  Priorities make a difference only in
-the agenda (@pxref{Weekly/daily agenda}); outside the agenda, they have
-no inherent meaning to Org mode.
+@vindex org-priority-faces
+By default, Org-mode supports three priorities: @samp{A}, @samp{B}, and
+@samp{C}.  @samp{A} is the highest priority.  An entry without a cookie is
+treated as priority @samp{B}.  Priorities make a difference only in the
+agenda (@pxref{Weekly/daily agenda}); outside the agenda, they have no
+inherent meaning to Org-mode.  The cookies can be highlighted with special
+faces by customizing the variable @code{org-priority-faces}.
 
 Priorities can be attached to any outline tree entries; they do not need
 to be TODO items.
@@ -3821,7 +3963,7 @@ with detailed subtasks on the tree@footnote{To keep subtasks out of the
 global TODO list, see the @code{org-agenda-todo-list-sublevels}.}.  To keep
 the overview over the fraction of subtasks that are already completed, insert
 either @samp{[/]} or @samp{[%]} anywhere in the headline.  These cookies will
-be updates each time the todo status of a child changes, or when pressing
+be updated each time the TODO status of a child changes, or when pressing
 @kbd{C-c C-c} on the cookie.  For example:
 
 @example
@@ -3987,7 +4129,7 @@ entry twice (checkboxes with @kbd{C-c C-c}).
 @cindex sparse tree, tag based
 
 An excellent way to implement labels and contexts for cross-correlating
-information is to assign @i{tags} to headlines.  Org mode has extensive
+information is to assign @i{tags} to headlines.  Org-mode has extensive
 support for tags.
 
 @vindex org-tag-faces
@@ -4001,9 +4143,9 @@ You may specify special faces for specific tags using the variable
 (@pxref{Faces for TODO keywords}).
 
 @menu
-* Tag inheritance::             Tags use the tree structure of the outline
-* Setting tags::                How to assign tags to a headline
-* Tag searches::                Searching for combinations of tags
+* Tag inheritance::            Tags use the tree structure of the outline
+* Setting tags::               How to assign tags to a headline
+* Tag searches::               Searching for combinations of tags
 @end menu
 
 @node Tag inheritance, Setting tags, Tags, Tags
@@ -4067,7 +4209,7 @@ also a special command for inserting tags:
 @item C-c C-q
 @cindex completion, of tags
 @vindex org-tags-column
-Enter new tags for the current headline.  Org mode will either offer
+Enter new tags for the current headline.  Org-mode will either offer
 completion or a special single-key interface for setting tags, see
 below.  After pressing @key{RET}, the tags will be inserted and aligned
 to @code{org-tags-column}.  When called with a @kbd{C-u} prefix, all
@@ -4111,7 +4253,7 @@ by adding a STARTUP option line to that file:
 #+STARTUP: noptag
 @end example
 
-By default Org mode uses the standard minibuffer completion facilities for
+By default Org-mode uses the standard minibuffer completion facilities for
 entering tags.  However, it also implements another, quicker, tag selection
 method called @emph{fast tag selection}.  This allows you to select and
 deselect tags with just a single key press.  For this to work well you should
@@ -4270,11 +4412,11 @@ and properties.  For a complete description with many examples, see
 
 
 @node Properties and Columns, Dates and Times, Tags, Top
-@chapter Properties and Columns
+@chapter Properties and columns
 @cindex properties
 
 Properties are a set of key-value pairs associated with an entry.  There
-are two main applications for properties in Org mode.  First, properties
+are two main applications for properties in Org-mode.  First, properties
 are like tags, but with a value.  Second, you can use properties to
 implement (very basic) database capabilities in an Org buffer.  For
 an example of the first application, imagine maintaining a file where
@@ -4290,12 +4432,12 @@ Properties can be conveniently edited and viewed in column view
 (@pxref{Column view}).
 
 @menu
-* Property syntax::             How properties are spelled out
-* Special properties::          Access to other Org mode features
-* Property searches::           Matching property values
-* Property inheritance::        Passing values down the tree
-* Column view::                 Tabular viewing and editing
-* Property API::                Properties for Lisp programmers
+* Property syntax::            How properties are spelled out
+* Special properties::         Access to other Org-mode features
+* Property searches::          Matching property values
+* Property inheritance::       Passing values down the tree
+* Column view::                        Tabular viewing and editing
+* Property API::               Properties for Lisp programmers
 @end menu
 
 @node Property syntax, Special properties, Properties and Columns, Properties and Columns
@@ -4389,7 +4531,7 @@ nearest column format definition.
 @section Special properties
 @cindex properties, special
 
-Special properties provide an alternative access method to Org mode
+Special properties provide an alternative access method to Org-mode
 features, like the TODO state or the priority of an entry, discussed in the
 previous chapters.  This interface exists so that you can include
 these states in a column view (@pxref{Column view}), or to use them in
@@ -4407,6 +4549,7 @@ used as keys in the properties drawer:
 @cindex property, special, TIMESTAMP
 @cindex property, special, TIMESTAMP_IA
 @cindex property, special, CLOCKSUM
+@cindex property, special, BLOCKED
 @c guessing that ITEM is needed in this area; also, should this list be sorted?
 @cindex property, special, ITEM
 @example
@@ -4422,6 +4565,7 @@ TIMESTAMP    @r{The first keyword-less timestamp in the entry.}
 TIMESTAMP_IA @r{The first inactive timestamp in the entry.}
 CLOCKSUM     @r{The sum of CLOCK intervals in the subtree.  @code{org-clock-sum}}
              @r{must be run first to compute the values.}
+BLOCKED      @r{"t" if task is currently blocked by children or siblings}
 ITEM         @r{The content of the entry.}
 @end example
 
@@ -4475,16 +4619,18 @@ a regular expression and matched against the property values.
 @vindex org-use-property-inheritance
 The outline structure of Org-mode documents lends itself for an
 inheritance model of properties: if the parent in a tree has a certain
-property, the children can inherit this property.  Org mode does not
+property, the children can inherit this property.  Org-mode does not
 turn this on by default, because it can slow down property searches
 significantly and is often not needed.  However, if you find inheritance
 useful, you can turn it on by setting the variable
 @code{org-use-property-inheritance}.  It may be set to @code{t} to make
 all properties inherited from the parent, to a list of properties
 that should be inherited, or to a regular expression that matches
-inherited properties.
+inherited properties.  If a property has the value @samp{nil}, this is
+interpreted as an explicit undefine of he property, so that inheritance
+search will stop at this value and return @code{nil}.
 
-Org mode has a few properties for which inheritance is hard-coded, at
+Org-mode has a few properties for which inheritance is hard-coded, at
 least for the special applications for which they are used:
 
 @cindex property, COLUMNS
@@ -4515,7 +4661,7 @@ subtree (@pxref{Tracking TODO state changes}).
 A great way to view and edit properties in an outline tree is
 @emph{column view}.  In column view, each outline node is turned into a
 table row.  Columns in this table provide access to properties of the
-entries.  Org mode implements columns by overlaying a tabular structure
+entries.  Org-mode implements columns by overlaying a tabular structure
 over the headline of each item.  While the headlines have been turned
 into a table row, you can still change the visibility of the outline
 tree.  For example, you get a compact table by switching to CONTENTS
@@ -4527,9 +4673,9 @@ Column view also works in agenda buffers (@pxref{Agenda Views}) where
 queries have collected selected items, possibly from a number of files.
 
 @menu
-* Defining columns::            The COLUMNS format property
-* Using column view::           How to create and use column view
-* Capturing column view::       A dynamic block for column view
+* Defining columns::           The COLUMNS format property
+* Using column view::          How to create and use column view
+* Capturing column view::      A dynamic block for column view
 @end menu
 
 @node Defining columns, Using column view, Column view, Column view
@@ -4541,8 +4687,8 @@ Setting up a column view first requires defining the columns.  This is
 done by defining a column format line.
 
 @menu
-* Scope of column definitions::  Where defined, where valid?
-* Column attributes::           Appearance and content of a column
+* Scope of column definitions::         Where defined, where valid?
+* Column attributes::          Appearance and content of a column
 @end menu
 
 @node Scope of column definitions, Column attributes, Defining columns, Defining columns
@@ -4599,7 +4745,7 @@ optional.  The individual parts have the following meaning:
                 @{+@}       @r{Sum numbers in this column.}
                 @{+;%.1f@}  @r{Like @samp{+}, but format result with @samp{%.1f}.}
                 @{$@}       @r{Currency, short for @samp{+;%.2f}.}
-                @{:@}       @r{Sum times, HH:MM:SS, plain numbers are hours.}
+                @{:@}       @r{Sum times, HH:MM, plain numbers are hours.}
                 @{X@}       @r{Checkbox status, @samp{[X]} if all children are @samp{[X]}.}
                 @{X/@}      @r{Checkbox status, @samp{[n/m]}.}
                 @{X%@}      @r{Checkbox status, @samp{[n%]}.}
@@ -4624,7 +4770,7 @@ values.
 
 @example
 :COLUMNS:  %25ITEM %9Approved(Approved?)@{X@} %Owner %11Status \@footnote{Please note that the COLUMNS definition must be on a single line---it is wrapped here only because of formatting constraints.}
-                   %10Time_Estimate@{:@} %CLOCKSUM
+                  %10Time_Estimate@{:@} %CLOCKSUM
 :Owner_ALL:    Tammy Mark Karl Lisa Don
 :Status_ALL:   "In progress" "Not started yet" "Finished" ""
 :Approved_ALL: "[ ]" "[X]"
@@ -4810,7 +4956,7 @@ features based on them.  For more information see @ref{Using the
 property API}.
 
 @node Dates and Times, Capture - Refile - Archive, Properties and Columns, Top
-@chapter Dates and Times
+@chapter Dates and times
 @cindex dates
 @cindex times
 @cindex timestamp
@@ -4818,19 +4964,19 @@ property API}.
 
 To assist project planning, TODO items can be labeled with a date and/or
 a time.  The specially formatted string carrying the date and time
-information is called a @emph{timestamp} in Org mode.  This may be a
+information is called a @emph{timestamp} in Org-mode.  This may be a
 little confusing because timestamp is often used as indicating when
-something was created or last changed.  However, in Org mode this term
+something was created or last changed.  However, in Org-mode this term
 is used in a much wider sense.
 
 @menu
-* Timestamps::                  Assigning a time to a tree entry
-* Creating timestamps::         Commands which insert timestamps
-* Deadlines and scheduling::    Planning your work
-* Clocking work time::          Tracking how long you spend on a task
-* Resolving idle time::         Resolving time if you've been idle
-* Effort estimates::            Planning work effort in advance
-* Relative timer::              Notes with a running timer
+* Timestamps::                 Assigning a time to a tree entry
+* Creating timestamps::                Commands which insert timestamps
+* Deadlines and scheduling::   Planning your work
+* Clocking work time::         Tracking how long you spend on a task
+* Resolving idle time::                Resolving time if you've been idle
+* Effort estimates::           Planning work effort in advance
+* Relative timer::             Notes with a running timer
 @end menu
 
 
@@ -4845,7 +4991,7 @@ is used in a much wider sense.
 A timestamp is a specification of a date (possibly with a time or a range of
 times) in a special format, either @samp{<2003-09-16 Tue>} or
 @samp{<2003-09-16 Tue 09:39>} or @samp{<2003-09-16 Tue
-12:00-12:30>}@footnote{This is inspired by the standard ISO 6801 date/time
+12:00-12:30>}@footnote{This is inspired by the standard ISO 8601 date/time
 format.  To use an alternative format, see @ref{Custom time format}.}.  A
 timestamp can appear anywhere in the headline or body of an Org tree entry.
 Its presence causes entries to be shown on specific dates in the agenda
@@ -4876,7 +5022,7 @@ following will show up in the agenda every Wednesday:
 @end example
 
 @item Diary-style sexp entries
-For more complex date specifications, Org mode supports using the
+For more complex date specifications, Org-mode supports using the
 special sexp diary entries implemented in the Emacs calendar/diary
 package.  For example
 
@@ -4915,7 +5061,7 @@ angular ones.  These timestamps are inactive in the sense that they do
 @cindex creating timestamps
 @cindex timestamps, creating
 
-For Org mode to recognize timestamps, they need to be in the specific
+For Org-mode to recognize timestamps, they need to be in the specific
 format.  All commands listed below produce timestamps in the correct
 format.
 
@@ -4986,8 +5132,8 @@ the following column).
 
 
 @menu
-* The date/time prompt::        How Org mode helps you entering date and time
-* Custom time format::          Making dates look different
+* The date/time prompt::       How Org-mode helps you entering date and time
+* Custom time format::         Making dates look different
 @end menu
 
 @node The date/time prompt, Custom time format, Creating timestamps, Creating timestamps
@@ -4996,17 +5142,17 @@ the following column).
 @cindex time, reading in minibuffer
 
 @vindex org-read-date-prefer-future
-When Org mode prompts for a date/time, the default is shown in default
+When Org-mode prompts for a date/time, the default is shown in default
 date/time format, and the prompt therefore seems to ask for a specific
 format.  But it will in fact accept any string containing some date and/or
 time information, and it is really smart about interpreting your input.  You
 can, for example, use @kbd{C-y} to paste a (possibly multi-line) string
-copied from an email message.  Org mode will find whatever information is in
+copied from an email message.  Org-mode will find whatever information is in
 there and derive anything you have not specified from the @emph{default date
 and time}.  The default is usually the current date and time, but when
 modifying an existing timestamp, or when entering the second stamp of a
 range, it is taken from the stamp in the buffer.  When filling in
-information, Org mode assumes that most of the time you will want to enter a
+information, Org-mode assumes that most of the time you will want to enter a
 date in the future: if you omit the month/year and the given day/month is
 @i{before} today, it will assume that you mean a future date@footnote{See the
 variable @code{org-read-date-prefer-future}.  You may set that variable to
@@ -5015,14 +5161,16 @@ tomorrow.}.  If the date has been automatically shifted into the future, the
 time prompt will show this with @samp{(=>F).}
 
 For example, let's assume that today is @b{June 13, 2006}.  Here is how
-various inputs will be interpreted, the items filled in by Org mode are
+various inputs will be interpreted, the items filled in by Org-mode are
 in @b{bold}.
 
 @example
 3-2-5         --> 2003-02-05
+2/5/3         --> 2003-02-05
 14            --> @b{2006}-@b{06}-14
 12            --> @b{2006}-@b{07}-12
-Fri           --> nearest Friday (defaultdate or later)
+2/5           --> @b{2007}-02-05
+Fri           --> nearest Friday (default date or later)
 sep 15        --> @b{2006}-09-15
 feb 15        --> @b{2007}-02-15
 sep 12 9      --> 2009-09-12
@@ -5069,6 +5217,8 @@ from the minibuffer:
 
 @kindex <
 @kindex >
+@kindex M-v
+@kindex C-v
 @kindex mouse-1
 @kindex S-@key{right}
 @kindex S-@key{left}
@@ -5078,12 +5228,13 @@ from the minibuffer:
 @kindex M-S-@key{left}
 @kindex @key{RET}
 @example
-> / <          @r{Scroll calendar forward/backward by one month.}
+@key{RET}           @r{Choose date at cursor in calendar.}
 mouse-1        @r{Select date by clicking on it.}
 S-@key{right}/@key{left}     @r{One day forward/backward.}
 S-@key{down}/@key{up}     @r{One week forward/backward.}
 M-S-@key{right}/@key{left}   @r{One month forward/backward.}
-@key{RET}           @r{Choose date in calendar.}
+> / <          @r{Scroll calendar forward/backward by one month.}
+M-v / C-v      @r{Scroll calendar forward/backward by 3 months.}
 @end example
 
 @vindex org-read-date-display-live
@@ -5102,7 +5253,7 @@ minibuffer@footnote{If you find this distracting, turn the display of with
 
 @vindex org-display-custom-times
 @vindex org-time-stamp-custom-formats
-Org mode uses the standard ISO notation for dates and times as it is
+Org-mode uses the standard ISO notation for dates and times as it is
 defined in ISO 8601.  If you cannot get used to this and require another
 representation of date and time to keep you happy, you can get it by
 customizing the variables @code{org-display-custom-times} and
@@ -5115,7 +5266,7 @@ Toggle the display of custom formats for dates and times.
 @end table
 
 @noindent
-Org mode needs the default format for scanning, so the custom date/time
+Org-mode needs the default format for scanning, so the custom date/time
 format does not @emph{replace} the default format---instead it is put
 @emph{over} the default format using text properties.  This has the
 following consequences:
@@ -5192,30 +5343,30 @@ I.e. the task will automatically be forwarded until completed.
 @end example
 
 @noindent
-@b{Important:} Scheduling an item in Org mode should @i{not} be
+@b{Important:} Scheduling an item in Org-mode should @i{not} be
 understood in the same way that we understand @i{scheduling a meeting}.
 Setting a date for a meeting is just a simple appointment, you should
 mark this entry with a simple plain timestamp, to get this item shown
 on the date where it applies.  This is a frequent misunderstanding by
-Org users.  In Org mode, @i{scheduling} means setting a date when you
+Org users.  In Org-mode, @i{scheduling} means setting a date when you
 want to start working on an action item.
 @end table
 
 You may use timestamps with repeaters in scheduling and deadline
-entries.  Org mode will issue early and late warnings based on the
+entries.  Org-mode will issue early and late warnings based on the
 assumption that the timestamp represents the @i{nearest instance} of
 the repeater.  However, the use of diary sexp entries like
 @c
 @code{<%%(diary-float t 42)>}
 @c
-in scheduling and deadline timestamps is limited.  Org mode does not
+in scheduling and deadline timestamps is limited.  Org-mode does not
 know enough about the internals of each sexp function to issue early and
 late warnings.  However, it will show the item on each day where the
 sexp entry matches.
 
 @menu
-* Inserting deadline/schedule::  Planning items
-* Repeated tasks::              Items that show up again and again
+* Inserting deadline/schedule::         Planning items
+* Repeated tasks::             Items that show up again and again
 @end menu
 
 @node Inserting deadline/schedule, Repeated tasks, Deadlines and scheduling, Deadlines and scheduling
@@ -5281,7 +5432,7 @@ Sparse tree for deadlines and scheduled items after a given date.
 @cindex tasks, repeated
 @cindex repeated tasks
 
-Some tasks need to be repeated again and again.  Org mode helps to
+Some tasks need to be repeated again and again.  Org-mode helps to
 organize such tasks using a so-called repeater in a DEADLINE, SCHEDULED,
 or plain timestamp.  In the following example
 @example
@@ -5295,17 +5446,21 @@ from that time.  If you need both a repeater and a special warning period in
 a deadline entry, the repeater should come first and the warning period last:
 @code{DEADLINE: <2005-10-01 Sat +1m -3d>}.
 
-Deadlines and scheduled items produce entries in the agenda when they
-are over-due, so it is important to be able to mark such an entry as
-completed once you have done so.  When you mark a DEADLINE or a SCHEDULE
-with the TODO keyword DONE, it will no longer produce entries in the
-agenda.  The problem with this is, however, that then also the
-@emph{next} instance of the repeated entry will not be active.  Org mode
-deals with this in the following way: When you try to mark such an entry
-DONE (using @kbd{C-c C-t}), it will shift the base date of the repeating
-timestamp by the repeater interval, and immediately set the entry state
-back to TODO.  In the example above, setting the state to DONE would
-actually switch the date like this:
+@vindex org-todo-repeat-to-state
+Deadlines and scheduled items produce entries in the agenda when they are
+over-due, so it is important to be able to mark such an entry as completed
+once you have done so.  When you mark a DEADLINE or a SCHEDULE with the TODO
+keyword DONE, it will no longer produce entries in the agenda.  The problem
+with this is, however, that then also the @emph{next} instance of the
+repeated entry will not be active.  Org-mode deals with this in the following
+way: When you try to mark such an entry DONE (using @kbd{C-c C-t}), it will
+shift the base date of the repeating timestamp by the repeater interval, and
+immediately set the entry state back to TODO@footnote{In fact, the target
+state is taken from, in this sequence, the @code{REPEAT_TO_STATE} property or
+the variable @code{org-todo-repeat-to-state}.  If neither of these is
+specified, the target state defaults to the first state of the TODO state
+sequence.}.  In the example above, setting the state to DONE would actually
+switch the date like this:
 
 @example
 ** TODO Pay the rent
@@ -5330,7 +5485,7 @@ task, this may not be the best way to handle it.  For example, if you
 forgot to call you father for 3 weeks, it does not make sense to call
 him 3 times in a single day to make up for it.  Finally, there are tasks
 like changing batteries which should always repeat a certain time
-@i{after} the last time you did it.  For these tasks, Org mode has
+@i{after} the last time you did it.  For these tasks, Org-mode has
 special repeaters markers with @samp{++} and @samp{.+}.  For example:
 
 @example
@@ -5357,7 +5512,7 @@ created for this purpose, it is described in @ref{Structure editing}.
 @node Clocking work time, Resolving idle time, Deadlines and scheduling, Dates and Times
 @section Clocking work time
 
-Org mode allows you to clock the time you spend on specific tasks in a
+Org-mode allows you to clock the time you spend on specific tasks in a
 project.  When you start working on an item, you can start the clock.
 When you stop working on that task, or when you mark the task done, the
 clock is stopped and the corresponding time interval is recorded.  It
@@ -5493,6 +5648,8 @@ new table.  The @samp{BEGIN} line can specify options:
 :tend        @r{A time string specifying when to stop considering times.}
 :step        @r{@code{week} or @code{day}, to split the table into chunks.}
              @r{To use this, @code{:block} or @code{:tstart}, @code{:tend} are needed.}
+:stepskip0   @r{Don't show steps that have zero time}
+:tags        @r{A tags match to select entries that should contribute}
 :link        @r{Link the item headlines in the table to their origins.}
 :formula     @r{Content of a @code{#+TBLFM} line to be added and evaluated.}
              @r{As a special case, @samp{:formula %} adds a column with % time.}
@@ -5585,8 +5742,8 @@ use the shift key and press @kbd{S}.  Remember that using shift will always
 leave you clocked out, no matter which option you choose.
 @item C
 To cancel the clock altogether, use @kbd{C}.  Note that if instead of
-cancelling you subtract the away time, and the resulting clock amount is less
-than a minute, the clock will still be cancelled rather than clutter up the
+canceling you subtract the away time, and the resulting clock amount is less
+than a minute, the clock will still be canceled rather than clutter up the
 log with an empty entry.
 @end table
 
@@ -5714,7 +5871,7 @@ timer is reset to 0.  When called with a @kbd{C-u} prefix, reset the timer to
 specific starting offset.  The user is prompted for the offset, with a
 default taken from a timer string at point, if any, So this can be used to
 restart taking notes after a break in the process.  When called with a double
-prefix argument @kbd{C-c C-u}, change all timer strings in the active region
+prefix argument @kbd{C-u C-u}, change all timer strings in the active region
 by a certain amount.  This can be used to fix timer strings if the timer was
 not started at exactly the right moment.
 @end table
@@ -5725,155 +5882,282 @@ not started at exactly the right moment.
 
 An important part of any organization system is the ability to quickly
 capture new ideas and tasks, and to associate reference material with them.
-Org uses the @file{remember.el} package to create tasks, and stores files
+Org does this using a process called @i{capture}.  It also can store files
 related to a task (@i{attachments}) in a special directory.  Once in the
 system, tasks and projects need to be moved around.  Moving completed project
 trees to an archive file keeps the system compact and fast.
 
 @menu
-* Remember::                    Capture new tasks/ideas with little interruption
-* Attachments::                 Add files to tasks.
-* RSS Feeds::                   Getting input from RSS feeds
-* Protocols::                   External (e.g. Browser) access to Emacs and Org
-* Refiling notes::              Moving a tree from one place to another
-* Archiving::                   What to do with finished projects
+* Capture::                    Capturing new stuff
+* Attachments::                        Add files to tasks
+* RSS Feeds::                  Getting input from RSS feeds
+* Protocols::                  External (e.g. Browser) access to Emacs and Org
+* Refiling notes::             Moving a tree from one place to another
+* Archiving::                  What to do with finished projects
 @end menu
 
-@node Remember, Attachments, Capture - Refile - Archive, Capture - Refile - Archive
-@section Remember
-@cindex @file{remember.el}
+@node Capture, Attachments, Capture - Refile - Archive, Capture - Refile - Archive
+@section Capture
+@cindex capture
 
-The Remember package by John Wiegley lets you store quick notes with little
-interruption of your work flow.  It is an excellent way to add new notes and
-tasks to Org files.  The @code{remember.el} package is part of Emacs 23, not
-Emacs 22.  See @uref{http://www.emacswiki.org/cgi-bin/wiki/RememberMode} for
-more information.
+Org's method for capturing new items is heavily inspired by John Wiegley
+excellent remember package.  Up to version 6.36 Org used a special setup
+for @file{remember.el}.  @file{org-remember.el} is still part of Org-mode for
+backward compatibility with existing setups.  You can find the documentation
+for org-remember at @url{http://orgmode.org/org-remember.pdf}.
+
+The new capturing setup described here is preferred and should be used by new
+users.  To convert your @code{org-remember-templates}, run the command
+@example
+@kbd{M-x org-capture-import-remember-templates @key{RET}}
+@end example
+@noindent and then customize the new variable with @kbd{M-x
+customize-variable org-capture-templates}, check the result, and save the
+customization.  You can then use both remember and capture until
+you are familiar with the new mechanism.
 
-Org significantly expands the possibilities of Remember: you may define
-templates for different note types, and associate target files and headlines
-with specific templates.  It also allows you to select the location where a
-note should be stored interactively, on the fly.
+Capture lets you quickly store notes with little interruption of your work
+flow.  The basic process of capturing is very similar to remember, but Org
+does enhance it with templates and more.
 
 @menu
-* Setting up Remember for Org::  Some code for .emacs to get things going
-* Remember templates::          Define the outline of different note types
-* Storing notes::               Directly get the note to where it belongs
+* Setting up capture::         Where notes will be stored
+* Using capture::              Commands to invoke and terminate capture
+* Capture templates::          Define the outline of different note types
 @end menu
 
-@node Setting up Remember for Org, Remember templates, Remember, Remember
-@subsection Setting up Remember for Org
+@node Setting up capture, Using capture, Capture, Capture
+@subsection Setting up capture
 
-The following customization will tell Remember to use Org files as
-target, and to create annotations compatible with Org links.
+The following customization sets a default target file for notes, and defines
+a global key@footnote{Please select your own key, @kbd{C-c c} is only a
+suggestion.}  for capturing new material.
 
 @example
-(org-remember-insinuate)
-(setq org-directory "~/path/to/my/orgfiles/")
 (setq org-default-notes-file (concat org-directory "/notes.org"))
-(define-key global-map "\C-cr" 'org-remember)
+(define-key global-map "\C-cc" 'org-capture)
 @end example
 
-@noindent
-The last line binds the command @code{org-remember} to a global
-key@footnote{Please select your own key, @kbd{C-c r} is only a
-suggestion.}.  @code{org-remember} basically just calls Remember,
-but it makes a few things easier: if there is an active region, it will
-automatically copy the region into the Remember buffer.  It also allows
-to jump to the buffer and location where Remember notes are being
-stored: just call @code{org-remember} with a prefix argument.  If you
-use two prefix arguments, Org jumps to the location where the last
-remember note was stored.
-
-The Remember buffer will actually use @code{org-mode} as its major mode, so
-that all editing features of Org mode are available.  In addition to this, a
-minor mode @code{org-remember-mode} is turned on, for the single purpose that
-you can use its keymap @code{org-remember-mode-map} to overwrite some of
-Org mode's key bindings.
-
-You can also call @code{org-remember} in a special way from the agenda,
-using the @kbd{k r} key combination.  With this access, any timestamps
-inserted by the selected Remember template (see below) will default to
-the cursor date in the agenda, rather than to the current date.
-
-@node Remember templates, Storing notes, Setting up Remember for Org, Remember
-@subsection Remember templates
-@cindex templates, for Remember
-
-In combination with Org, you can use templates to generate
-different types of Remember notes.  For example, if you would like
-to use one template to create general TODO entries, another one for
-journal entries, and a third one for collecting random ideas, you could
-use:
-
-@example
-(setq org-remember-templates
- '(("Todo" ?t "* TODO %?\n  %i\n  %a" "~/org/TODO.org" "Tasks")
-   ("Journal" ?j "* %U %?\n\n  %i\n  %a" "~/org/JOURNAL.org")
-   ("Idea" ?i "* %^@{Title@}\n  %i\n  %a" "~/org/JOURNAL.org" "New Ideas")))
-@end example
-
-@vindex org-remember-default-headline
-@vindex org-directory
-@noindent In these entries, the first string is just a name, and the
-character specifies how to select the template.  It is useful if the
-character is also the first letter of the name.  The next string specifies
-the template.  Two more (optional) strings give the file in which, and the
-headline under which, the new note should be stored.  The file (if not
-present or @code{nil}) defaults to @code{org-default-notes-file}, the heading
-to @code{org-remember-default-headline}.  If the file name is not an absolute
-path, it will be interpreted relative to @code{org-directory}.
-
-The heading can also be the symbols @code{top} or @code{bottom} to send notes
-as level 1 entries to the beginning or end of the file, respectively.  It may
-also be the symbol @code{date-tree}.  Then, a tree with year on level 1,
-month on level 2 and day on level three will be build in the file, and the
-entry will be filed into the tree under the current date@footnote{If the file
-contains an entry with a @code{DATE_TREE} property, the entire date tree will
-be build under that entry.}
-
-An optional sixth element specifies the contexts in which the user can select
-the template.  This element can be a list of major modes or a function.
-@code{org-remember} will first check whether the function returns @code{t} or
-if we are in any of the listed major modes, and exclude templates for which
-this condition is not fulfilled.  Templates that do not specify this element
-at all, or that use @code{nil} or @code{t} as a value will always be
-selectable.
-
-So for example:
-
-@example
-(setq org-remember-templates
- '(("Bug" ?b "* BUG %?\n  %i\n  %a" "~/org/BUGS.org" "Bugs" (emacs-lisp-mode))
-   ("Journal" ?j "* %U %?\n\n  %i\n  %a" "~/org/JOURNAL.org" "X" my-check)
-   ("Idea" ?i "* %^@{Title@}\n  %i\n  %a" "~/org/JOURNAL.org" "New Ideas")))
-@end example
+@node Using capture, Capture templates, Setting up capture, Capture
+@subsection Using capture
 
-@noindent
-The first template will only be available when invoking @code{org-remember}
-from an buffer in @code{emacs-lisp-mode}.  The second template will only be
-available when the function @code{my-check} returns @code{t}.  The third
-template will be proposed in any context.
+@table @kbd
+@kindex C-c c
+@item C-c c
+Call the command @code{org-capture}.  If you have templates defined
+@pxref{Capture templates}, it will offer these templates for selection or use
+a new Org outline node as the default template.  It will insert the template
+into the target file and switch to an indirect buffer narrowed to this new
+node.  You may then insert the information you want.
+
+@kindex C-c C-c
+@item C-c C-c
+Once you have finished entering information into the capture buffer, 
+@kbd{C-c C-c} will return you to the window configuration before the capture
+process, so that you can resume your work without further distraction.
+
+@kindex C-c C-w
+@item C-c C-w
+Finalize the capture process by refiling (@pxref{Refiling notes}) the note to
+a different place.
+
+@kindex C-c C-k
+@item C-c C-k
+Abort the capture process and return to the previous state.
+@end table
+
+You can also call @code{org-capture} in a special way from the agenda, using
+the @kbd{k c} key combination.  With this access, any timestamps inserted by
+the selected capture template will default to the cursor date in the agenda,
+rather than to the current date.
+
+@node Capture templates,  , Using capture, Capture
+@subsection Capture templates
+@cindex templates, for Capture
+
+You can use templates for different types of capture items, and
+for different target locations.  The easiest way to create such templates is
+through the customize interface.
+
+@table @kbd
+@kindex C-c c C
+@item C-c c C
+Customize the variable @code{org-capture-templates}.
+@end table
+
+Before we give the formal description of template definitions, let's look at
+an example.  Say you would like to use one template to create general TODO
+entries, and you want to put these entries under the heading @samp{Tasks} in
+your file @file{~/org/gtd.org}.  Also, a date tree in the file
+@file{journal.org} should capture journal entries.  A possible configuration
+would look like:
 
-When you call @kbd{M-x org-remember} (or @kbd{M-x remember}) to remember
-something, Org will prompt for a key to select the template (if you have
-more than one template) and then prepare the buffer like
+@example
+(setq org-capture-templates
+ '(("t" "Todo" entry (file+headline "~/org/gtd.org" "Tasks")
+        "* TODO %?\n  %i\n  %a")
+   ("j" "Journal" entry (file+datetree "~/org/journal.org")
+        "* %?\nEntered on %U\n  %i\n  %a")))
+@end example
+
+@noindent If you then press @kbd{C-c c t}, Org will prepare the template
+for you like this:
 @example
 * TODO
-  [[file:@var{link to where you called remember}]]
+  [[file:@var{link to where you initiated capture}]]
 @end example
 
 @noindent
-During expansion of the template, special @kbd{%}-escapes@footnote{If you
-need one of these sequences literally, escape the @kbd{%} with a backslash.}
-allow dynamic insertion of content:
+During expansion of the template, @code{%a} has been replaced by a link to
+the location from where you called the capture command.  This can be
+extremely useful for deriving tasks from emails, for example.  You fill in
+the task definition, press @code{C-c C-c} and Org returns you to the same
+place where you started the capture process.
+
+
+@menu
+* Template elements::          What is needed for a complete template entry
+* Template expansion::         Filling in information about time and context
+@end menu
+
+@node Template elements, Template expansion, Capture templates, Capture templates
+@subsubsection Template elements
+
+Now lets look at the elements of a template definition.  Each entry in
+@code{org-capture-templates} is a list with the following items: 
+
+@table @var
+@item keys
+The keys that will select the template, as a string, characters
+only, for example @code{"a"} for a template to be selected with a
+single key, or @code{"bt"} for selection with two keys.  When using
+several keys, keys using the same prefix key must be sequential 
+in the list and preceded by a 2-element entry explaining the
+prefix key, for example
 @example
+         ("b" "Templates for marking stuff to buy")
+@end example
+@noindent If you do not define a template for the @kbd{C} key, this key will
+be used to open the customize buffer for this complex variable.
+
+@item description
+A short string describing the template, which will be shown during
+selection.
+
+@item type
+The type of entry, a symbol.  Valid values are:
+@table @code
+@item entry
+An Org-mode node, with a headline. Will be filed as the child of the
+target entry or as a top-level entry.  The target file should be an Org-mode
+file.
+@item item
+A plain list item, placed in the first plain  list at the target
+location.  Again the target file should be an Org file.
+@item checkitem
+A checkbox item.  This only differs from the plain list item by the
+default template.
+@item table-line
+a new line in the first table at the target location.  Where exactly the
+line will be inserted depends on the properties @code{:prepend} and
+@code{:table-line-pos} (see below).
+@item plain
+Text to be inserted as it is.
+@end table
+
+@item target
+Specification of where the captured item should be placed.
+In Org-mode files, targets usually define a node.  Entries will become
+children of this node, other types will be added to the table or list in the
+body of this node.
+
+Valid values are:
+@table @code
+@item (file "path/to/file")
+Text will be placed at the beginning or end of that file.
+
+@item (id "id of existing org entry")
+Filing as child of this entry, or in the body of the entry.
+
+@item (file+headline "path/to/file" "node headline")
+Fast configuration if the target heading is unique in the file.
+
+@item (file+olp "path/to/file" "Level 1 heading" "Level 2" ...)
+For non-unique headings, the full path is safer.
+
+@item (file+regexp  "path/to/file" "regexp to find location")
+Use a regular expression to position the cursor.
+
+@item (file+datetree "path/to/file")
+Will create a heading in a date tree.
+
+@item (file+function "path/to/file" function-finding-location)
+A function to find the right location in the file.
+
+@item (clock)
+File to the entry that is currently being clocked.
+
+@item (function function-finding-location)
+Most general way, write your own function to find both
+file and location.
+@end table
+
+@item template
+The template for creating the capture item.  If you leave this empty, an
+appropriate default template will be used.  Otherwise this is a string with
+escape codes, which will be replaced depending on time and context of the
+capture call.  The string with escapes may be loaded from a template file,
+using the special syntax @code{(file "path/to/template")}.  See below for
+more details.
+
+@item properties
+The rest of the entry is a property list of additional options.
+Recognized properties are:
+@table @code
+@item :prepend
+Normally new captured information will be appended at
+the target location (last child, last table line, last list item...).
+Setting this property will change that.
+
+@item :immediate-finish
+When set, do not offer to edit the information, just
+file it away immediately.  This makes sense if the template only needs
+information that can be added automatically.
+
+@item :empty-lines
+Set this to the number of lines to insert
+before and after the new item.  Default 0, only common other value is 1.
+
+@item :clock-in
+Start the clock in this item.
+
+@item :clock-resume
+If starting the capture interrupted a clock, restart that clock when finished
+with the capture.
+
+@item :unnarrowed
+Do not narrow the target buffer, simply show the full buffer.  Default is to
+narrow it so that you only see the new material.
+@end table
+@end table
+
+@node Template expansion,  , Template elements, Capture templates
+@subsubsection Template expansion
+
+In the template itself, special @kbd{%}-escapes@footnote{If you need one of
+these sequences literally, escape the @kbd{%} with a backslash.}  allow
+dynamic insertion of content:
+
+@comment SJE: should these sentences terminate in period?
+@smallexample
 %^@{@var{prompt}@}  @r{prompt the user for a string and replace this sequence with it.}
             @r{You may specify a default value and a completion table with}
             @r{%^@{prompt|default|completion2|completion3...@}}
             @r{The arrow keys access a prompt-specific history.}
 %a          @r{annotation, normally the link created with @code{org-store-link}}
 %A          @r{like @code{%a}, but prompt for the description part}
-%i          @r{initial content, the region when remember is called with C-u.}
+%i          @r{initial content, the region when capture is called while the}
+            @r{region is active.}
             @r{The entire text will be indented like @code{%i} itself.}
 %t          @r{timestamp, date only}
 %T          @r{timestamp with date and time}
@@ -5885,28 +6169,25 @@ allow dynamic insertion of content:
 %x          @r{Content of the X clipboard.}
 %^C         @r{Interactive selection of which kill or clip to use.}
 %^L         @r{Like @code{%^C}, but insert as link.}
+%k          @r{title of the currently clocked task}
+%K          @r{link to the currently clocked task}
 %^g         @r{prompt for tags, with completion on tags in target file.}
-%k          @r{title of currently clocked task}
-%K          @r{link to currently clocked task}
 %^G         @r{prompt for tags, with completion all tags in all agenda files.}
 %^@{@var{prop}@}p   @r{Prompt the user for a value for property @var{prop}}
 %:keyword   @r{specific information for certain link types, see below}
 %[@var{file}]     @r{insert the contents of the file given by @var{file}}
 %(@var{sexp})     @r{evaluate Elisp @var{sexp} and replace with the result}
-%!          @r{immediately store note after completing the template}
-            @r{(skipping the @kbd{C-c C-c} that normally triggers storing)}
-%&          @r{jump to target location immediately after storing note}
-@end example
+@end smallexample
 
 @noindent
 For specific link types, the following keywords will be
 defined@footnote{If you define your own link types (@pxref{Adding
 hyperlink types}), any property you store with
-@code{org-store-link-props} can be accessed in remember templates in a
+@code{org-store-link-props} can be accessed in capture templates in a
 similar way.}:
 
 @vindex org-from-is-user-regexp
-@example
+@smallexample
 Link type          |  Available keywords
 -------------------+----------------------------------------------
 bbdb               |  %:name %:company
@@ -5918,91 +6199,25 @@ vm, wl, mh, rmail  |  %:type %:subject %:message-id
 gnus               |  %:group, @r{for messages also all email fields}
 w3, w3m            |  %:url
 info               |  %:file %:node
-calendar           |  %:date"
-@end example
+calendar           |  %:date
+@end smallexample
 
 @noindent
 To place the cursor after template expansion use:
 
-@example
+@smallexample
 %?          @r{After completing the template, position cursor here.}
-@end example
-
-@noindent
-If you change your mind about which template to use, call
-@code{org-remember} in the remember buffer.  You may then select a new
-template that will be filled with the previous context information.
-
-@node Storing notes,  , Remember templates, Remember
-@subsection Storing notes
-
-@vindex org-remember-clock-out-on-exit
-When you are finished preparing a note with Remember, you have to press
-@kbd{C-c C-c} to file the note away.  If you have started the clock in the
-Remember buffer, you will first be asked if you want to clock out
-now@footnote{To avoid this query, configure the variable
-@code{org-remember-clock-out-on-exit}.}.  If you answer @kbd{n}, the clock
-will continue to run after the note was filed away.
-
-The handler will then store the note in the file and under the headline
-specified in the template, or it will use the default file and headline.
-The window configuration will be restored, sending you back to the working
-context before the call to Remember.  To re-use the location found
-during the last call to Remember, exit the Remember buffer with
-@kbd{C-0 C-c C-c}, i.e. specify a zero prefix argument to @kbd{C-c C-c}.
-Another special case is @kbd{C-2 C-c C-c} which files the note as a child of
-the currently clocked item.
-
-@vindex org-remember-store-without-prompt
-If you want to store the note directly to a different place, use
-@kbd{C-1 C-c C-c} instead to exit Remember@footnote{Configure the
-variable @code{org-remember-store-without-prompt} to make this behavior
-the default.}.  The handler will then first prompt for a target file---if
-you press @key{RET}, the value specified for the template is used.
-Then the command offers the headings tree of the selected file, with the
-cursor position at the default headline (if you specified one in the
-template).  You can either immediately press @key{RET} to get the note
-placed there.  Or you can use the following keys to find a different
-location:
-@example
-@key{TAB}         @r{Cycle visibility.}
-@key{down} / @key{up}   @r{Next/previous visible headline.}
-n / p        @r{Next/previous visible headline.}
-f / b        @r{Next/previous headline same level.}
-u            @r{One level up.}
-@c 0-9          @r{Digit argument.}
-@end example
-@noindent
-Pressing @key{RET} or @key{left} or @key{right}
-then leads to the following result.
-
-@vindex org-reverse-note-order
-@multitable @columnfractions 0.2 0.15 0.65
-@item @b{Cursor position} @tab @b{Key} @tab @b{Note gets inserted}
-@item on headline     @tab @key{RET}              @tab as sublevel of the heading at cursor, first or last
-@item                 @tab                        @tab depending on @code{org-reverse-note-order}.
-@item                 @tab @key{left}/@key{right} @tab as same level, before/after current heading
-@item buffer-start    @tab @key{RET} @tab as level 2 heading at end of file or level 1 at beginning
-@item                 @tab @tab depending on @code{org-reverse-note-order}.
-@item not on headline @tab @key{RET}
-      @tab at cursor position, level taken from context.
-@end multitable
-
-Before inserting the text into a tree, the function ensures that the text has
-a headline, i.e. a first line that starts with a @samp{*}.  If not, a
-headline is constructed from the current date.  If you have indented the text
-of the note below the headline, the indentation will be adapted if inserting
-the note into the tree requires demotion from level 1.
+@end smallexample
 
 
-@node Attachments, RSS Feeds, Remember, Capture - Refile - Archive
+@node Attachments, RSS Feeds, Capture, Capture - Refile - Archive
 @section Attachments
 @cindex attachments
 
 @vindex org-attach-directory
 It is often useful to associate reference material with an outline node/task.
 Small chunks of plain text can simply be stored in the subtree of a project.
-Hyperlinks (@pxref{Hyperlinks}) can be used to establish associations with
+Hyperlinks (@pxref{Hyperlinks}) can establish associations with
 files that live elsewhere on your computer or in the cloud, like emails or
 source code files belonging to a project.  Another method is @i{attachments},
 which are files located in a directory belonging to an outline node.  Org
@@ -6019,14 +6234,14 @@ choice to an entry.  You can also make children inherit the attachment
 directory from a parent, so that an entire subtree uses the same attached
 directory.
 
-@noindent The following commands deal with attachments.
+@noindent The following commands deal with attachments:
 
 @table @kbd
 
 @kindex C-c C-a
 @item C-c C-a
 The dispatcher for commands related to the attachment system.  After these
-keys, a list of commands is displayed and you need to press an additional key
+keys, a list of commands is displayed and you must press an additional key
 to select a command:
 
 @table @kbd
@@ -6056,7 +6271,7 @@ attachments yourself.
 @kindex C-c C-a o
 @item o
 @vindex org-file-apps
-Open current task's attachment.  If there are more than one, prompt for a
+Open current task's attachment.  If there is more than one, prompt for a
 file name first.  Opening will follow the rules set by @code{org-file-apps}.
 For more details, see the information on following hyperlinks
 (@pxref{Handling links}).
@@ -6099,23 +6314,27 @@ same directory for attachments as the parent does.
 @node RSS Feeds, Protocols, Attachments, Capture - Refile - Archive
 @section RSS feeds
 @cindex RSS feeds
+@cindex Atom feeds
 
-Org has the capability to add and change entries based on information found in
-RSS feeds.  You could use this to make a task out of each new podcast in a
+Org can add and change entries based on information found in RSS feeds and
+Atom feeds.  You could use this to make a task out of each new podcast in a
 podcast feed.  Or you could use a phone-based note-creating service on the
-web to import tasks into Org.  To access feeds, you need to configure the
-variable @code{org-feed-alist}.  The docstring of this variable has detailed
+web to import tasks into Org.  To access feeds, configure the variable
+@code{org-feed-alist}.  The docstring of this variable has detailed
 information.  Here is just an example:
 
 @example
 (setq org-feed-alist
-      '(("ReQall" "http://www.reqall.com/user/feeds/rss/a1b2c3....."
-         "~/org/feeds.org" "ReQall Entries")
+     '(("Slashdot"
+        "http://rss.slashdot.org/Slashdot/slashdot"
+        "~/txt/org/feeds.org" "Slashdot Entries")))
 @end example
+
 @noindent
-will configure that new items from the feed provided by @file{reqall.com}
-will result in new entries in the file @file{~/org/feeds.org} under the
-heading @samp{ReQall Entries}, whenever the following command is used:
+will configure that new items from the feed provided by
+@code{rss.slashdot.org} will result in new entries in the file
+@file{~/org/feeds.org} under the heading @samp{Slashdot Entries}, whenever
+the following command is used:
 
 @table @kbd
 @kindex C-c C-x g
@@ -6136,8 +6355,8 @@ list of drawers in that file:
 #+DRAWERS: LOGBOOK PROPERTIES FEEDSTATUS
 @end example
 
-For more information, see @file{org-feed.el} and the docstring of
-@code{org-feed-alist}.
+For more information, including how to read atom feeds, see
+@file{org-feed.el} and the docstring of @code{org-feed-alist}.
 
 @node Protocols, Refiling notes, RSS Feeds, Capture - Refile - Archive
 @section Protocols for external access
@@ -6147,7 +6366,7 @@ For more information, see @file{org-feed.el} and the docstring of
 You can set up Org for handling protocol calls from outside applications that
 are passed to Emacs through the @file{emacsserver}.  For example, you can
 configure bookmarks in your web browser to send a link to the current page to
-Org and create a note from it using Remember (@pxref{Remember}).  Or you
+Org and create a note from it using capture (@pxref{Capture}).  Or you
 could create a bookmark that will tell Emacs to open the local source file of
 a remote website you are looking at with the browser.  See
 @uref{http://orgmode.org/worg/org-contrib/org-protocol.php} for detailed
@@ -6170,6 +6389,8 @@ process, you can use the following special command:
 @vindex org-refile-use-outline-path
 @vindex org-outline-path-complete-in-steps
 @vindex org-refile-allow-creating-parent-nodes
+@vindex org-log-refile
+@vindex org-refile-use-cache
 Refile the entry or region at point.  This command offers possible locations
 for refiling the entry and lets you select one with completion.  The item (or
 all items in the region) is filed below the target heading as a subitem.
@@ -6183,6 +6404,10 @@ the variables @code{org-refile-use-outline-path} and
 @code{org-outline-path-complete-in-steps}.  If you would like to be able to
 create new nodes as new parents for refiling on the fly, check the
 variable @code{org-refile-allow-creating-parent-nodes}.
+When the variable @code{org-log-refile}@footnote{with corresponding
+@code{#+STARTUP} keywords @code{logrefile}, @code{lognoterefile},
+and @code{nologrefile}} is set, a time stamp or a note will be
+recorded when an entry has been refiled.
 @kindex C-u C-c C-w
 @item C-u C-c C-w
 Use the refile interface to jump to a heading.
@@ -6191,6 +6416,10 @@ Use the refile interface to jump to a heading.
 Jump to the location where @code{org-refile} last moved a tree to.
 @item C-2 C-c C-w
 Refile as the child of the item currently being clocked.
+@item C-0 C-c C-w @ @r{or} @ C-u C-u C-u C-c C-w
+Clear the target cache.  Caching of refile targets can be turned on by
+setting @code{org-refile-use-cache}.  To make the command seen new possible
+targets, you have to clear the cache with this command.
 @end table
 
 @node Archiving,  , Refiling notes, Capture - Refile - Archive
@@ -6211,8 +6440,8 @@ Archive the current entry using the command specified in the variable
 @end table
 
 @menu
-* Moving subtrees::             Moving a tree to an archive file
-* Internal archiving::          Switch off a tree but keep i in the file
+* Moving subtrees::            Moving a tree to an archive file
+* Internal archiving::         Switch off a tree but keep it in the file
 @end menu
 
 @node Moving subtrees, Internal archiving, Archiving, Archiving
@@ -6305,12 +6534,12 @@ Archived trees are not exported (@pxref{Exporting}), only the headline
 is.  Configure the details using the variable
 @code{org-export-with-archived-trees}.
 @item
-@vindex org-columns-skip-arrchived-trees
+@vindex org-columns-skip-archived-trees
 Archived trees are excluded from column view unless the variable
-@code{org-columns-skip-arrchived-trees} is configured to @code{nil}.
+@code{org-columns-skip-archived-trees} is configured to @code{nil}.
 @end itemize
 
-The following commands help managing the ARCHIVE tag:
+The following commands help manage the ARCHIVE tag:
 
 @table @kbd
 @kindex C-c C-x a
@@ -6339,7 +6568,7 @@ outline.
 
 
 @node Agenda Views, Markup, Capture - Refile - Archive, Top
-@chapter Agenda Views
+@chapter Agenda views
 @cindex agenda views
 
 Due to the way Org works, TODO items, time-stamped items, and
@@ -6389,14 +6618,14 @@ window configuration is restored when the agenda exits:
 @code{org-agenda-restore-windows-after-quit}.
 
 @menu
-* Agenda files::                Files being searched for agenda information
-* Agenda dispatcher::           Keyboard access to agenda views
-* Built-in agenda views::       What is available out of the box?
-* Presentation and sorting::    How agenda items are prepared for display
-* Agenda commands::             Remote editing of Org trees
-* Custom agenda views::         Defining special searches and views
-* Exporting Agenda Views::      Writing a view to a file
-* Agenda column view::          Using column view for collected entries
+* Agenda files::               Files being searched for agenda information
+* Agenda dispatcher::          Keyboard access to agenda views
+* Built-in agenda views::      What is available out of the box?
+* Presentation and sorting::   How agenda items are prepared for display
+* Agenda commands::            Remote editing of Org trees
+* Custom agenda views::                Defining special searches and views
+* Exporting Agenda Views::     Writing a view to a file
+* Agenda column view::         Using column view for collected entries
 @end menu
 
 @node Agenda files, Agenda dispatcher, Agenda Views, Agenda Views
@@ -6538,12 +6767,12 @@ a number of special tags matches.  @xref{Custom agenda views}.
 In this section we describe the built-in views.
 
 @menu
-* Weekly/daily agenda::         The calendar page with current tasks
-* Global TODO list::            All unfinished action items
+* Weekly/daily agenda::                The calendar page with current tasks
+* Global TODO list::           All unfinished action items
 * Matching tags and properties::  Structured information with fine-tuned search
-* Timeline::                    Time-sorted view for single file
-* Search view::                 Find entries by searching for text
-* Stuck projects::              Find projects you need to review
+* Timeline::                   Time-sorted view for single file
+* Search view::                        Find entries by searching for text
+* Stuck projects::             Find projects you need to review
 @end menu
 
 @node Weekly/daily agenda, Global TODO list, Built-in agenda views, Built-in agenda views
@@ -6586,7 +6815,7 @@ anniversaries, lunar phases, sunrise/set, recurrent appointments
 Org.  It can be very useful to combine output from Org with
 the diary.
 
-In order to include entries from the Emacs diary into Org mode's
+In order to include entries from the Emacs diary into Org-mode's
 agenda, you only need to customize the variable
 
 @lisp
@@ -6595,7 +6824,7 @@ agenda, you only need to customize the variable
 
 @noindent After that, everything will happen automatically.  All diary
 entries including holidays, anniversaries, etc., will be included in the
-agenda buffer created by Org mode.  @key{SPC}, @key{TAB}, and
+agenda buffer created by Org-mode.  @key{SPC}, @key{TAB}, and
 @key{RET} can be used from the agenda buffer to jump to the diary
 file in order to edit existing diary entries.  The @kbd{i} command to
 insert new entries for the current date works in the agenda buffer, as
@@ -6606,7 +6835,7 @@ between calendar and agenda.
 
 If you are using the diary only for sexp entries and holidays, it is
 faster to not use the above setting, but instead to copy or even move
-the entries into an Org file. Org mode evaluates diary-style sexp
+the entries into an Org file. Org-mode evaluates diary-style sexp
 entries, and does it faster because there is no overhead for first
 creating the diary display.  Note that the sexp entries must start at
 the left margin, no whitespace is allowed before them.  For example,
@@ -6618,8 +6847,8 @@ will be made in the agenda:
 #+CATEGORY: Holiday
 %%(org-calendar-holiday)   ; special function for holiday names
 #+CATEGORY: Ann
-%%(diary-anniversary 14  5 1956) Arthur Dent is %d years old
-%%(diary-anniversary  2 10 1869) Mahatma Gandhi would be %d years old
+%%(diary-anniversary  5 14 1956)@footnote{Note that the order of the arguments (month, day, year) depends on the setting of @code{calendar-date-style}.} Arthur Dent is %d years old
+%%(diary-anniversary 10  2 1869) Mahatma Gandhi would be %d years old
 @end example
 
 @subsubheading Anniversaries from BBDB
@@ -6636,7 +6865,7 @@ following to one your your agenda files:
 * Anniversaries
   :PROPERTIES:
   :CATEGORY: Anniv
-  :END
+  :END:
 %%(org-bbdb-anniversaries)
 @end example
 
@@ -6681,20 +6910,20 @@ collected into a single place.
 @table @kbd
 @kindex C-c a t
 @item C-c a t
-Show the global TODO list.  This collects the TODO items from all
-agenda files (@pxref{Agenda Views}) into a single buffer.  The buffer is in
-@code{agenda-mode}, so there are commands to examine and manipulate
-the TODO entries directly from that buffer (@pxref{Agenda commands}).
+Show the global TODO list.  This collects the TODO items from all agenda
+files (@pxref{Agenda Views}) into a single buffer.  By default, this lists
+items with a state the is not a DONE state.  The buffer is in
+@code{agenda-mode}, so there are commands to examine and manipulate the TODO
+entries directly from that buffer (@pxref{Agenda commands}).
 @kindex C-c a T
 @item C-c a T
 @cindex TODO keyword matching
 @vindex org-todo-keywords
-Like the above, but allows selection of a specific TODO keyword.  You
-can also do this by specifying a prefix argument to @kbd{C-c a t}.  With
-a @kbd{C-u} prefix you are prompted for a keyword, and you may also
-specify several keywords by separating them with @samp{|} as the boolean OR
-operator.  With a numeric prefix, the nth keyword in
-@code{org-todo-keywords} is selected.
+Like the above, but allows selection of a specific TODO keyword.  You can
+also do this by specifying a prefix argument to @kbd{C-c a t}.  You are
+prompted for a keyword, and you may also specify several keywords by
+separating them with @samp{|} as the boolean OR operator.  With a numeric
+prefix, the nth keyword in @code{org-todo-keywords} is selected.
 @kindex r
 The @kbd{r} key in the agenda buffer regenerates it, and you can give
 a prefix argument to this command to change the selected TODO keyword,
@@ -6756,11 +6985,12 @@ define a custom command for it (@pxref{Agenda dispatcher}).
 @item C-c a M
 @vindex org-tags-match-list-sublevels
 @vindex org-agenda-tags-todo-honor-ignore-options
-Like @kbd{C-c a m}, but only select headlines that are also TODO items and
-force checking subitems (see variable @code{org-tags-match-list-sublevels}).
-To exclude scheduled/deadline items, see the variable
-@code{org-agenda-tags-todo-honor-ignore-options}.  Matching specific TODO
-keywords together with a tags match is also possible, see @ref{Tag searches}.
+Like @kbd{C-c a m}, but only select headlines that are also TODO items in a
+not-DONE state and force checking subitems (see variable
+@code{org-tags-match-list-sublevels}).  To exclude scheduled/deadline items,
+see the variable @code{org-agenda-tags-todo-honor-ignore-options}.  Matching
+specific TODO keywords together with a tags match is also possible, see
+@ref{Tag searches}.
 @end table
 
 The commands available in the tags list are described in @ref{Agenda
@@ -6865,7 +7095,7 @@ other properties will slow down the search.  However, once you have paid the
 price by accessing one property, testing additional properties is cheap
 again.
 
-You can configure Org mode to use property inheritance during a search, but
+You can configure Org-mode to use property inheritance during a search, but
 beware that this can slow down searches considerably.  See @ref{Property
 inheritance}, for details.
 
@@ -6874,12 +7104,13 @@ different way to test TODO states in a search.  For this, terminate the
 tags/property part of the search string (which may include several terms
 connected with @samp{|}) with a @samp{/} and then specify a Boolean
 expression just for TODO keywords.  The syntax is then similar to that for
-tags, but should be applied with care: for example, a positive
-selection on several TODO keywords cannot meaningfully be combined with
-boolean AND.  However, @emph{negative selection} combined with AND can be
-meaningful.  To make sure that only lines are checked that actually have any
-TODO keyword (resulting in a speed-up), use @kbd{C-c a M}, or equivalently
-start the TODO part after the slash with @samp{!}.  Examples:
+tags, but should be applied with care: for example, a positive selection on
+several TODO keywords cannot meaningfully be combined with boolean AND.
+However, @emph{negative selection} combined with AND can be meaningful.  To
+make sure that only lines are checked that actually have any TODO keyword
+(resulting in a speed-up), use @kbd{C-c a M}, or equivalently start the TODO
+part after the slash with @samp{!}.  Using @kbd{C-c a M} or @samp{/!} will
+not match TODO keywords in a DONE state.  Examples:
 
 @table @samp
 @item work/WAITING
@@ -6897,7 +7128,7 @@ Select @samp{:work:}-tagged TODO lines that are either @samp{WAITING} or
 @cindex timeline, single file
 @cindex time-sorted view
 
-The timeline summarizes all time-stamped items from a single Org mode
+The timeline summarizes all time-stamped items from a single Org-mode
 file in a @emph{time-sorted view}.  The main purpose of this command is
 to give an overview over events in a project.
 
@@ -6919,7 +7150,7 @@ The commands available in the timeline buffer are listed in
 @cindex text search
 @cindex searching, for text
 
-This agenda view is a general text search facility for Org mode entries.
+This agenda view is a general text search facility for Org-mode entries.
 It is particularly useful to find notes.
 
 @table @kbd
@@ -6936,7 +7167,9 @@ logic.  The search string @samp{+computer +wifi -ethernet -@{8\.11[bg]@}}
 will search for note entries that contain the keywords @code{computer}
 and @code{wifi}, but not the keyword @code{ethernet}, and which are also
 not matched by the regular expression @code{8\.11[bg]}, meaning to
-exclude both 8.11b and 8.11g.
+exclude both 8.11b and 8.11g.  The first @samp{+} is necessary to turn on
+word search, other @samp{+} characters are optional.  For more details, see
+the docstring of the command @code{org-search-view}.
 
 @vindex org-agenda-text-search-extra-files
 Note that in addition to the agenda files, this command will also search
@@ -6949,7 +7182,7 @@ If you are following a system like David Allen's GTD to organize your
 work, one of the ``duties'' you have is a regular review to make sure
 that all projects move along.  A @emph{stuck} project is a project that
 has no defined next actions, so it will never show up in the TODO lists
-Org mode produces.  During the review, you need to identify such
+Org-mode produces.  During the review, you need to identify such
 projects and define next actions for them.
 
 @table @kbd
@@ -6968,7 +7201,7 @@ work for you.  The built-in default assumes that all your projects are
 level-2 headlines, and that a project is not stuck if it has at least
 one entry marked with a TODO keyword TODO or NEXT or NEXTACTION.
 
-Let's assume that you, in your own way of using Org mode, identify
+Let's assume that you, in your own way of using Org-mode, identify
 projects with a tag PROJECT, and that you use a TODO keyword MAYBE to
 indicate a project that should not be considered yet.  Let's further
 assume that the TODO keyword DONE marks finished projects, and that NEXT
@@ -6995,7 +7228,7 @@ will still be searched for stuck projects.
 @cindex presentation, of agenda items
 
 @vindex org-agenda-prefix-format
-Before displaying items in an agenda view, Org mode visually prepares
+Before displaying items in an agenda view, Org-mode visually prepares
 the items and sorts them.  Each item occupies a single line.  The line
 starts with a @emph{prefix} that contains the @emph{category}
 (@pxref{Categories}) of the item and other important information.  You can
@@ -7004,9 +7237,9 @@ The prefix is followed by a cleaned-up version of the outline headline
 associated with the item.
 
 @menu
-* Categories::                  Not all tasks are equal
-* Time-of-day specifications::  How the agenda knows the time
-* Sorting of agenda items::     The order of things
+* Categories::                 Not all tasks are equal
+* Time-of-day specifications:: How the agenda knows the time
+* Sorting of agenda items::    The order of things
 @end menu
 
 @node Categories, Time-of-day specifications, Presentation and sorting, Presentation and sorting
@@ -7042,7 +7275,7 @@ longer than 10 characters.
 @subsection Time-of-day specifications
 @cindex time-of-day specification
 
-Org mode checks each agenda item for a time-of-day specification.  The
+Org-mode checks each agenda item for a time-of-day specification.  The
 time can be part of the timestamp that triggered inclusion into the
 agenda, for example as in @w{@samp{<2005-05-10 Tue 19:00>}}.  Time
 ranges can be specified with two timestamps, like
@@ -7054,7 +7287,7 @@ plain text (like @samp{12:45} or a @samp{8:30-1pm}).  If the agenda
 integrates the Emacs diary (@pxref{Weekly/daily agenda}), time
 specifications in diary entries are recognized as well.
 
-For agenda display, Org mode extracts the time and displays it in a
+For agenda display, Org-mode extracts the time and displays it in a
 standard 24 hour format as part of the prefix.  The example times in
 the previous paragraphs would end up in the agenda like this:
 
@@ -7245,6 +7478,7 @@ Prompt for a date and go there.
 Toggle the inclusion of diary entries.  See @ref{Weekly/daily agenda}.
 @c
 @kindex v l
+@kindex v L
 @kindex l
 @item v l @ @r{or short} @ l
 @vindex org-log-done
@@ -7256,6 +7490,7 @@ types that should be included in log mode using the variable
 @code{org-agenda-log-mode-items}.  When called with a @kbd{C-u} prefix, show
 all possible logbook entries, including state changes.  When called with two
 prefix args @kbd{C-u C-u}, show only logging information, nothing else.
+@kbd{v L} is equivalent to @kbd{C-u v l}.
 @c
 @kindex v [
 @kindex [
@@ -7393,12 +7628,12 @@ Internet, and outside of business hours, with something like this:
 @group
 (defun org-my-auto-exclude-function (tag)
   (and (cond
-        ((string= tag "Net")
-         (/= 0 (call-process "/sbin/ping" nil nil nil
-                             "-c1" "-q" "-t1" "mail.gnu.org")))
-        ((or (string= tag "Errand") (string= tag "Call"))
-         (let ((hour (nth 2 (decode-time))))
-           (or (< hour 8) (> hour 21)))))
+       ((string= tag "Net")
+        (/= 0 (call-process "/sbin/ping" nil nil nil
+                            "-c1" "-q" "-t1" "mail.gnu.org")))
+       ((or (string= tag "Errand") (string= tag "Call"))
+        (let ((hour (nth 2 (decode-time))))
+          (or (< hour 8) (> hour 21)))))
        (concat "-" tag)))
 
 (setq org-agenda-auto-exclude-function 'org-my-auto-exclude-function)
@@ -7501,7 +7736,7 @@ agenda, change a tag for all headings in the region.
 @c
 @kindex ,
 @item ,
-Set the priority for the current item.  Org mode prompts for the
+Set the priority for the current item.  Org-mode prompts for the
 priority character. If you reply with @key{SPC}, the priority cookie
 is removed from the entry.
 @c
@@ -7523,8 +7758,9 @@ key for this.
 @itemx S-@key{down}
 Decrease the priority of the current item.
 @c
+@kindex C-c C-z
 @kindex z
-@item z
+@item z @ @r{or also} @ C-c C-z
 @vindex org-log-into-drawer
 Add a note to the entry.  This note will be recorded, and then files to the
 same location where state change notes are put.  Depending on
@@ -7536,11 +7772,11 @@ Dispatcher for all command related to attachments.
 @c
 @kindex C-c C-s
 @item C-c C-s
-Schedule this item
+Schedule this item, with prefix arg remove the scheduling timestamp
 @c
 @kindex C-c C-d
 @item C-c C-d
-Set a deadline for this item.
+Set a deadline for this item, with prefix arg remove the deadline.
 @c
 @kindex k
 @item k
@@ -7552,7 +7788,7 @@ m   @r{Mark the entry at point for action.  You can also make entries}
     @r{in Org files with @kbd{C-c C-x C-k}.}
 d   @r{Set the deadline of the marked entry to the date at point.}
 s   @r{Schedule the marked entry at the date at point.}
-r   @r{Call @code{org-remember} with the cursor date as default date.}
+r   @r{Call @code{org-capture} with the cursor date as default date.}
 @end example
 @noindent
 Press @kbd{r} afterward to refresh the agenda and see the effect of the
@@ -7576,9 +7812,8 @@ into the past.
 @c
 @kindex >
 @item >
-Change the timestamp associated with the current line to today.
-The key @kbd{>} has been chosen, because it is the same as @kbd{S-.}
-on my keyboard.
+Change the timestamp associated with the current line.  The key @kbd{>} has
+been chosen, because it is the same as @kbd{S-.}  on my keyboard.
 @c
 @kindex I
 @item I
@@ -7601,7 +7836,7 @@ Jump to the running clock in another window.
 @cindex remote editing, bulk, from agenda
 
 @kindex m
-@item s
+@item m
 Mark the entry at point for bulk action.
 
 @kindex u
@@ -7615,7 +7850,9 @@ Unmark all marked entries for bulk action.
 @kindex B
 @item B
 Bulk action: act on all marked entries in the agenda.  This will prompt for
-another key to select the action to be applied:
+another key to select the action to be applied.  The prefix arg to @kbd{B}
+will be passed through to the @kbd{s} and @kbd{d} commands, to bulk-remove
+these special timestamps.
 @example
 r  @r{Prompt for a single refile target and move all entries.  The entries}
    @r{will no longer be in the agenda, refresh (@kbd{g}) to bring them back.}
@@ -7640,7 +7877,7 @@ d  @r{Set deadline to a specific date.}
 Open the Emacs calendar and move to the date at the agenda cursor.
 @c
 @item c
-When in the calendar, compute and show the Org mode agenda for the
+When in the calendar, compute and show the Org-mode agenda for the
 date at the cursor.
 @c
 @cindex diary entries, creating from agenda
@@ -7658,7 +7895,7 @@ If you configure @code{org-agenda-diary-file} to point to an Org-mode file,
 Org will create entries (in org-mode syntax) in that file instead.  Most
 entries will be stored in a date-based outline tree that will later make it
 easy to archive appointments from previous months/years.  The tree will be
-build under an entry with a @code{DATE_TREE} property, or else with years as
+built under an entry with a @code{DATE_TREE} property, or else with years as
 top-level entries.  Emacs will prompt you for the entry text - if you specify
 it, the entry will be created in @code{org-agenda-diary-file} without further
 interaction.  If you directly press @key{RET} at the prompt without typing
@@ -7726,9 +7963,9 @@ agenda buffers.  Custom agenda commands will be accessible through the
 dispatcher (@pxref{Agenda dispatcher}), just like the default commands.
 
 @menu
-* Storing searches::            Type once, use often
-* Block agenda::                All the stuff you need in a single buffer
-* Setting Options::             Changing the rules
+* Storing searches::           Type once, use often
+* Block agenda::               All the stuff you need in a single buffer
+* Setting Options::            Changing the rules
 @end menu
 
 @node Storing searches, Block agenda, Custom agenda views, Custom agenda views
@@ -7838,7 +8075,7 @@ command @kbd{C-c a o} provides a similar view for office tasks.
 @cindex options, for custom agenda views
 
 @vindex org-agenda-custom-commands
-Org mode contains a number of variables regulating agenda construction
+Org-mode contains a number of variables regulating agenda construction
 and display.  The global variables define the behavior for all agenda
 commands, including the custom commands.  However, if you want to change
 some settings just for a single custom view, you can do so.  Setting
@@ -7910,7 +8147,7 @@ yourself.
 @cindex agenda views, exporting
 
 If you are away from your computer, it can be very useful to have a printed
-version of some agenda views to carry around.  Org mode can export custom
+version of some agenda views to carry around.  Org-mode can export custom
 agenda views as plain text, HTML@footnote{You need to install Hrvoje Niksic's
 @file{htmlize.el}.}, Postscript, PDF@footnote{To create PDF output, the
 ghostscript @file{ps2pdf} utility must be installed on the system.  Selecting
@@ -7975,7 +8212,7 @@ or absolute.
 @end lisp
 
 The extension of the file name determines the type of export.  If it is
-@file{.html}, Org mode will use the @file{htmlize.el} package to convert
+@file{.html}, Org-mode will use the @file{htmlize.el} package to convert
 the buffer to HTML and save it to this file name.  If the extension is
 @file{.ps}, @code{ps-print-buffer-with-faces} is used to produce
 Postscript output.  If the extension is @file{.ics}, iCalendar export is
@@ -8109,32 +8346,33 @@ the agenda).
 When exporting Org-mode documents, the exporter tries to reflect the
 structure of the document as accurately as possible in the backend.  Since
 export targets like HTML, La@TeX{}, or DocBook allow much richer formatting,
-Org mode has rules on how to prepare text for rich export.  This section
+Org-mode has rules on how to prepare text for rich export.  This section
 summarizes the markup rules used in an Org-mode buffer.
 
 @menu
-* Structural markup elements::  The basic structure as seen by the exporter
-* Images and tables::           Tables and Images will be included
-* Literal examples::            Source code examples with special formatting
-* Include files::               Include additional files into a document
-* Macro replacement::           Use macros to create complex output
-* Embedded LaTeX::              LaTeX can be freely used inside Org documents
+* Structural markup elements:: The basic structure as seen by the exporter
+* Images and tables::          Tables and Images will be included
+* Literal examples::           Source code examples with special formatting
+* Include files::              Include additional files into a document
+* Index entries::              Making an index
+* Macro replacement::          Use macros to create complex output
+* Embedded LaTeX::             LaTeX can be freely used inside Org documents
 @end menu
 
 @node Structural markup elements, Images and tables, Markup, Markup
 @section Structural markup elements
 
 @menu
-* Document title::              Where the title is taken from
-* Headings and sections::       The document structure as seen by the exporter
-* Table of contents::           The if and where of the table of contents
-* Initial text::                Text before the first heading?
-* Lists::                       Lists
-* Paragraphs::                  Paragraphs
-* Footnote markup::             Footnotes
-* Emphasis and monospace::      Bold, italic, etc.
-* Horizontal rules::            Make a line
-* Comment lines::               What will *not* be exported
+* Document title::             Where the title is taken from
+* Headings and sections::      The document structure as seen by the exporter
+* Table of contents::          The if and where of the table of contents
+* Initial text::               Text before the first heading?
+* Lists::                      Lists
+* Paragraphs::                 Paragraphs
+* Footnote markup::            Footnotes
+* Emphasis and monospace::     Bold, italic, etc.
+* Horizontal rules::           Make a line
+* Comment lines::              What will *not* be exported
 @end menu
 
 @node Document title, Headings and sections, Structural markup elements, Structural markup elements
@@ -8201,7 +8439,7 @@ the table of contents entirely, by configuring the variable
 @cindex text before first headline, markup rules
 @cindex #+TEXT
 
-Org mode normally exports the text before the first headline, and even uses
+Org-mode normally exports the text before the first headline, and even uses
 the first line as the document title.  The text will be fully marked up.  If
 you need to include literal HTML, La@TeX{}, or DocBook code, use the special
 constructs described below in the sections for the individual exporters.
@@ -8329,11 +8567,12 @@ Toggle the COMMENT keyword at the beginning of an entry.
 @cindex tables, markup rules
 @cindex #+CAPTION
 @cindex #+LABEL
-Both the native Org mode tables (@pxref{Tables}) and tables formatted with
-the @file{table.el} package will be exported properly.  For Org mode tables,
+Both the native Org-mode tables (@pxref{Tables}) and tables formatted with
+the @file{table.el} package will be exported properly.  For Org-mode tables,
 the lines before the first horizontal separator line will become table header
 lines.  You can use the following lines somewhere before the table to assign
-a caption and a label for cross references:
+a caption and a label for cross references, and in the text you can refer to
+the object with @code{\ref@{tab:basic-data@}}:
 
 @example
 #+CAPTION: This is the caption for the next table (or link)
@@ -8347,8 +8586,8 @@ Some backends (HTML, La@TeX{}, and DocBook) allow you to directly include
 images into the exported document.  Org does this, if a link to an image
 files does not have a description part, for example @code{[[./img/a.jpg]]}.
 If you wish to define a caption for the image and maybe a label for internal
-cross references, you sure that the link is on a line by itself precede it
-with:
+cross references, make sure that the link is on a line by itself and precede
+it with @code{#+CAPTION} and @code{#+LABEL} as follows:
 
 @example
 #+CAPTION: This is the caption for the next figure link (or table)
@@ -8402,9 +8641,9 @@ be used to fontify the example:
 
 @example
 #+BEGIN_SRC emacs-lisp
-(defun org-xor (a b)
-   "Exclusive or."
-   (if a (not b) b))
+  (defun org-xor (a b)
+     "Exclusive or."
+     (if a (not b) b))
 #+END_SRC
 @end example
 
@@ -8450,7 +8689,7 @@ Edit the source code example at point in its native mode.  This works by
 switching to a temporary buffer with the source code.  You need to exit by
 pressing @kbd{C-c '} again@footnote{Upon exit, lines starting with @samp{*}
 or @samp{#} will get a comma prepended, to keep them from being interpreted
-by Org as outline nodes or special comments.  These commas will be striped
+by Org as outline nodes or special comments.  These commas will be stripped
 for editing with @kbd{C-c '}, and also for export.}, the edited version will
 then replace the old version in the Org buffer.  Fixed-width regions
 (where each line starts with a colon followed by a space) will be edited
@@ -8468,7 +8707,7 @@ label is stored as a link @samp{(label)}, for retrieval with @kbd{C-c C-l}.
 @end table
 
 
-@node Include files, Macro replacement, Literal examples, Markup
+@node Include files, Index entries, Literal examples, Markup
 @section Include files
 @cindex include files, markup rules
 
@@ -8483,7 +8722,7 @@ include your @file{.emacs} file, you could use:
 The optional second and third parameter are the markup (e.g. @samp{quote},
 @samp{example}, or @samp{src}), and, if the markup is @samp{src}, the
 language for formatting the contents.  The markup is optional, if it is not
-given, the text will be assumed to be in Org mode format and will be
+given, the text will be assumed to be in Org-mode format and will be
 processed normally.  The include line will also allow additional keyword
 parameters @code{:prefix1} and @code{:prefix} to specify prefixes for the
 first line and for each following line, as well as any options accepted by
@@ -8499,8 +8738,25 @@ the selected markup.  For example, to include a file as an item, use
 Visit the include file at point.
 @end table
 
+@node Index entries, Macro replacement, Include files, Markup
+@section Index entries
+@cindex index entries, for publishing
+
+You can specify entries that will be used for generating an index during
+publishing.  This is done by lines starting with @code{#+INDEX}.  An entry
+the contains an exclamation mark will create a sub item.  See @ref{Generating
+an index} for more information.
+
+@example
+* Curriculum Vitae
+#+INDEX: CV
+#+INDEX: Application!CV
+@end example
+
+
 
-@node Macro replacement, Embedded LaTeX, Include files, Markup
+
+@node Macro replacement, Embedded LaTeX, Index entries, Markup
 @section Macro replacement
 @cindex macro replacement, during export
 @cindex #+MACRO
@@ -8536,20 +8792,20 @@ mathematical symbols and the occasional formula.  La@TeX{}@footnote{La@TeX{}
 is a macro system based on Donald E. Knuth's @TeX{} system.  Many of the
 features described here as ``La@TeX{}'' are really from @TeX{}, but for
 simplicity I am blurring this distinction.}  is widely used to typeset
-scientific documents. Org mode supports embedding La@TeX{} code into its
+scientific documents. Org-mode supports embedding La@TeX{} code into its
 files, because many academics are used to reading La@TeX{} source code, and
 because it can be readily processed into images for HTML production.
 
 It is not necessary to mark La@TeX{} macros and code in any special way.
-If you observe a few conventions, Org mode knows how to find it and what
+If you observe a few conventions, Org-mode knows how to find it and what
 to do with it.
 
 @menu
-* Special symbols::             Greek letters and other symbols
-* Subscripts and superscripts::  Simple syntax for raising/lowering text
-* LaTeX fragments::             Complex formulas made easy
-* Previewing LaTeX fragments::  What will this snippet look like?
-* CDLaTeX mode::                Speed up entering of formulas
+* Special symbols::            Greek letters and other symbols
+* Subscripts and superscripts::         Simple syntax for raising/lowering text
+* LaTeX fragments::            Complex formulas made easy
+* Previewing LaTeX fragments:: What will this snippet look like?
+* CDLaTeX mode::               Speed up entering of formulas
 @end menu
 
 @node Special symbols, Subscripts and superscripts, Embedded LaTeX, Embedded LaTeX
@@ -8565,14 +8821,14 @@ You can use La@TeX{} macros to insert special symbols like @samp{\alpha} to
 indicate the Greek letter, or @samp{\to} to indicate an arrow.  Completion
 for these macros is available, just type @samp{\} and maybe a few letters,
 and press @kbd{M-@key{TAB}} to see possible completions.  Unlike La@TeX{}
-code, Org mode allows these macros to be present without surrounding math
+code, Org-mode allows these macros to be present without surrounding math
 delimiters, for example:
 
 @example
 Angles are written as Greek letters \alpha, \beta and \gamma.
 @end example
 
-@vindex org-html-entities
+@vindex org-entities
 During export, these symbols will be transformed into the native format of
 the exporter backend.  Strings like @code{\alpha} will be exported as
 @code{&alpha;} in the HTML output, and as @code{$\alpha$} in the La@TeX{}
@@ -8581,11 +8837,24 @@ output.  Similarly, @code{\nbsp} will become @code{&nbsp;} in HTML and
 like this: @samp{\Aacute@{@}stor}.
 
 A large number of entities is provided, with names taken from both HTML and
-La@TeX{}, see the variable @code{org-html-entities} for the complete list.
+La@TeX{}, see the variable @code{org-entities} for the complete list.
 @samp{\-} is treated as a shy hyphen, and @samp{--}, @samp{---}, and
 @samp{...} are all converted into special commands creating hyphens of
 different lengths or a compact set of dots.
 
+If you would like to see entities displayed as utf8 characters, use the
+following command@footnote{You can turn this on by default by setting the
+variable @code{org-pretty-entities}, or on a per-file base with the
+@code{#+STARTUP} option @code{entitiespretty}.}:
+
+@table @kbd
+@kindex C-c C-x \
+@item C-c C-x \
+Toggle display of entities as UTF8 characters.  This does not change the
+buffer content which remains plain ASCII, but it overlays the UTF8 character
+for display purposes only.
+@end table
+
 @node Subscripts and superscripts, LaTeX fragments, Special symbols, Embedded LaTeX
 @subsection Subscripts and superscripts
 @cindex subscript
@@ -8614,6 +8883,12 @@ convention, or use, on a per-file basis:
 #+OPTIONS: ^:@{@}
 @end example
 
+@table @kbd
+@kindex C-c C-x \
+@item C-c C-x \
+In addition to showing entities as UTF8 characters, this command will also
+format sub- and superscripts in a WYSIWYM way.
+@end table
 
 @node LaTeX fragments, Previewing LaTeX fragments, Subscripts and superscripts, Embedded LaTeX
 @subsection La@TeX{} fragments
@@ -8626,7 +8901,7 @@ MathML, but that is not yet fully supported by many browsers, and there
 is no decent converter for turning La@TeX{} or ASCII representations of
 formulas into MathML. So for the time being, converting formulas into
 images seems the way to go.}. More complex expressions need a dedicated
-formula processor. To this end, Org mode can contain arbitrary La@TeX{}
+formula processor. To this end, Org-mode can contain arbitrary La@TeX{}
 fragments. It provides commands to preview the typeset result of these
 fragments, and upon export to HTML, all fragments will be converted to
 images and inlined into the HTML document@footnote{The La@TeX{} export
@@ -8713,12 +8988,12 @@ setting is active:
 
 CDLa@TeX{} mode is a minor mode that is normally used in combination with a
 major La@TeX{} mode like AUC@TeX{} in order to speed-up insertion of
-environments and math templates.  Inside Org mode, you can make use of
+environments and math templates.  Inside Org-mode, you can make use of
 some of the features of CDLa@TeX{} mode.  You need to install
 @file{cdlatex.el} and @file{texmathp.el} (the latter comes also with
 AUC@TeX{}) from @url{http://www.astro.uva.nl/~dominik/Tools/cdlatex}.
-Don't use CDLa@TeX{} mode itself under Org mode, but use the light
-version @code{org-cdlatex-mode} that comes as part of Org mode.  Turn it
+Don't use CDLa@TeX{} mode itself under Org-mode, but use the light
+version @code{org-cdlatex-mode} that comes as part of Org-mode.  Turn it
 on for the current buffer with @code{M-x org-cdlatex-mode}, or for all
 Org files with
 
@@ -8735,7 +9010,7 @@ Environment templates can be inserted with @kbd{C-c @{}.
 @item
 @kindex @key{TAB}
 The @key{TAB} key will do template expansion if the cursor is inside a
-La@TeX{} fragment@footnote{Org mode has a method to test if the cursor is
+La@TeX{} fragment@footnote{Org-mode has a method to test if the cursor is
 inside such a fragment, see the documentation of the function
 @code{org-inside-LaTeX-fragment-p}.}.  For example, @key{TAB} will
 expand @code{fr} to @code{\frac@{@}@{@}} and position the cursor
@@ -8776,28 +9051,30 @@ Org-mode documents can be exported into a variety of other formats.  For
 printing and sharing of notes, ASCII export produces a readable and simple
 version of an Org file.  HTML export allows you to publish a notes file on
 the web, while the XOXO format provides a solid base for exchange with a
-broad range of other applications. La@TeX{} export lets you use Org mode and
+broad range of other applications. La@TeX{} export lets you use Org-mode and
 its structured editing functions to easily create La@TeX{} files.  DocBook
 export makes it possible to convert Org files to many other formats using
-DocBook tools.  To incorporate entries with associated times like deadlines
-or appointments into a desktop calendar program like iCal, Org mode can also
-produce extracts in the iCalendar format.  Currently Org mode only supports
-export, not import of these different formats.
+DocBook tools.  For project management you can create gantt and resource
+charts by using TaskJuggler export.  To incorporate entries with associated
+times like deadlines or appointments into a desktop calendar program like
+iCal, Org-mode can also produce extracts in the iCalendar format.  Currently
+Org-mode only supports export, not import of these different formats.
 
 Org supports export of selected regions when @code{transient-mark-mode} is
 enabled (default in Emacs 23).
 
 @menu
-* Selective export::            Using tags to select and exclude trees
-* Export options::              Per-file export settings
-* The export dispatcher::       How to access exporter commands
-* ASCII export::                Exporting to plain ASCII
-* HTML export::                 Exporting to HTML
-* LaTeX and PDF export::        Exporting to La@TeX{}, and processing to PDF
-* DocBook export::              Exporting to DocBook
-* Freemind export::             Exporting to Freemind mind maps
-* XOXO export::                 Exporting to XOXO
-* iCalendar export::            Exporting in iCalendar format
+* Selective export::           Using tags to select and exclude trees
+* Export options::             Per-file export settings
+* The export dispatcher::      How to access exporter commands
+* ASCII/Latin-1/UTF-8 export:: Exporting to flat files with encoding
+* HTML export::                        Exporting to HTML
+* LaTeX and PDF export::       Exporting to La@TeX{}, and processing to PDF
+* DocBook export::             Exporting to DocBook
+* TaskJuggler export::         Exporting to TaskJuggler
+* Freemind export::            Exporting to Freemind mind maps
+* XOXO export::                        Exporting to XOXO
+* iCalendar export::           Exporting in iCalendar format
 @end menu
 
 @node Selective export, Export options, Exporting, Exporting
@@ -8858,6 +9135,7 @@ Insert template with export options, see example below.
 @cindex #+LINK_HOME
 @cindex #+EXPORT_SELECT_TAGS
 @cindex #+EXPORT_EXCLUDE_TAGS
+@cindex #+XSLT
 @cindex #+LATEX_HEADER
 @vindex user-full-name
 @vindex user-mail-address
@@ -8880,6 +9158,7 @@ Insert template with export options, see example below.
 #+LATEX_HEADER: extra line(s) for the LaTeX header, like \usepackage@{xyz@}
 #+EXPORT_SELECT_TAGS:   Tags that select a tree for export
 #+EXPORT_EXCLUDE_TAGS:  Tags that exclude a tree from export
+#+XSLT:        the XSLT stylesheet used by DocBook exporter to generate FO file
 @end example
 
 @noindent
@@ -8905,7 +9184,7 @@ you can:
 H:         @r{set the number of headline levels for export}
 num:       @r{turn on/off section-numbers}
 toc:       @r{turn on/off table of contents, or set level limit (integer)}
-\n:        @r{turn on/off line-break-preservation}
+\n:        @r{turn on/off line-break-preservation (DOES NOT WORK)}
 @@:         @r{turn on/off quoted HTML tags}
 ::         @r{turn on/off fixed-width sections}
 |:         @r{turn on/off tables}
@@ -8923,6 +9202,7 @@ TeX:       @r{turn on/off simple @TeX{} macros in plain text}
 LaTeX:     @r{turn on/off La@TeX{} fragments}
 skip:      @r{turn on/off skipping the text before the first heading}
 author:    @r{turn on/off inclusion of author name/email into exported file}
+email:     @r{turn on/off inclusion of author email into exported file}
 creator:   @r{turn on/off inclusion of creator info into exported file}
 timestamp: @r{turn on/off inclusion creation time into exported file}
 d:         @r{turn on/off inclusion of drawers}
@@ -8938,7 +9218,7 @@ settings with properties @code{EXPORT_FILE_NAME}, @code{EXPORT_TITLE},
 @code{EXPORT_TEXT}, @code{EXPORT_AUTHOR}, @code{EXPORT_DATE}, and
 @code{EXPORT_OPTIONS}.
 
-@node The export dispatcher, ASCII export, Export options, Exporting
+@node The export dispatcher, ASCII/Latin-1/UTF-8 export, Export options, Exporting
 @section The export dispatcher
 @cindex dispatcher, for export commands
 
@@ -8970,12 +9250,15 @@ Call an the exporter, but reverse the setting of
 not set, or force processing in the current Emacs process if set.
 @end table
 
-@node ASCII export, HTML export, The export dispatcher, Exporting
-@section ASCII export
+@node ASCII/Latin-1/UTF-8 export, HTML export, The export dispatcher, Exporting
+@section ASCII/Latin-1/UTF-8 export
 @cindex ASCII export
+@cindex Latin-1 export
+@cindex UTF-8 export
 
 ASCII export produces a simple and very readable version of an Org-mode
-file.
+file, containing only plain ASCII.  Latin-1 and UTF-8 export augment the file
+with special characters and symbols available in these encodings.
 
 @cindex region, active
 @cindex active region
@@ -8996,8 +9279,18 @@ export.
 @kindex C-c C-e A
 @item C-c C-e A
 Export to a temporary buffer, do not create a file.
+@kindex C-c C-e n
+@kindex C-c C-e N
+@item C-c C-e n @ @ @r{and} @ @ C-c C-e N
+Like the above commands, but use Latin-1 encoding.
+@kindex C-c C-e u
+@kindex C-c C-e U
+@item C-c C-e u @ @ @r{and} @ @ C-c C-e U
+Like the above commands, but use UTF-8 encoding.
 @kindex C-c C-e v a
-@item C-c C-e v a
+@kindex C-c C-e v n
+@kindex C-c C-e v u
+@item C-c C-e v a @ @ @r{and} @ @ C-c C-e v n @ @ @r{and} @ @ C-c C-e v u
 Export only the visible part of the document.
 @end table
 
@@ -9025,23 +9318,23 @@ Links will be exported in a footnote-like style, with the descriptive part in
 the text and the link in a note before the next heading.  See the variable
 @code{org-export-ascii-links-to-notes} for details and other options.
 
-@node HTML export, LaTeX and PDF export, ASCII export, Exporting
+@node HTML export, LaTeX and PDF export, ASCII/Latin-1/UTF-8 export, Exporting
 @section HTML export
 @cindex HTML export
 
-Org mode contains an HTML (XHTML 1.0 strict) exporter with extensive
+Org-mode contains an HTML (XHTML 1.0 strict) exporter with extensive
 HTML formatting, in ways similar to John Gruber's @emph{markdown}
 language, but with additional support for tables.
 
 @menu
-* HTML Export commands::        How to invoke HTML export
-* Quoting HTML tags::           Using direct HTML in Org mode
-* Links in HTML export::        How links will be interpreted and formatted
-* Tables in HTML export::       How to modify the formatting of tables
-* Images in HTML export::       How to insert figures into HTML output
-* Text areas in HTML export::   An alternative way to show an example
-* CSS support::                 Changing the appearance of the output
-* Javascript support::          Info and Folding in a web browser
+* HTML Export commands::       How to invoke HTML export
+* Quoting HTML tags::          Using direct HTML in Org-mode
+* Links in HTML export::       How links will be interpreted and formatted
+* Tables in HTML export::      How to modify the formatting of tables
+* Images in HTML export::      How to insert figures into HTML output
+* Text areas in HTML export::  An alternative way to show an example
+* CSS support::                        Changing the appearance of the output
+* JavaScript support::         Info and Folding in a web browser
 @end menu
 
 @node HTML Export commands, Quoting HTML tags, HTML export, HTML export
@@ -9196,7 +9489,7 @@ will link to a high resolution version of the image, you could use:
 [[file:highres.jpg][file:thumb.jpg]]
 @end example
 
-If you need to add attributes to an inlines image, use a @code{#+ATTR_HTML}.
+If you need to add attributes to an inlined image, use a @code{#+ATTR_HTML}.
 In the example below we specify the @code{alt} and @code{title} attributes to
 support text viewers and accessibility, and align it to the right.
 
@@ -9226,14 +9519,14 @@ respectively.  For example
 
 @example
 #+BEGIN_EXAMPLE -t -w 40
-(defun org-xor (a b)
-   "Exclusive or."
-   (if a (not b) b))
+  (defun org-xor (a b)
+     "Exclusive or."
+     (if a (not b) b))
 #+END_EXAMPLE
 @end example
 
 
-@node CSS support, Javascript support, Text areas in HTML export, HTML export
+@node CSS support, JavaScript support, Text areas in HTML export, HTML export
 @subsection CSS support
 @cindex CSS, for HTML export
 @cindex HTML export, CSS
@@ -9304,8 +9597,8 @@ referring to an external file.
 @c FIXME: More about header and footer styles
 @c FIXME: Talk about links and targets.
 
-@node Javascript support,  , CSS support, HTML export
-@subsection Javascript supported display of web pages
+@node JavaScript support,  , CSS support, HTML export
+@subsection JavaScript supported display of web pages
 
 @cindex Rose, Sebastian
 Sebastian Rose has written a JavaScript program especially designed to
@@ -9377,20 +9670,26 @@ pages, configure the variable @code{org-export-html-use-infojs}.
 @cindex PDF export
 @cindex Guerry, Bastien
 
-Org mode contains a La@TeX{} exporter written by Bastien Guerry.  With
-further processing, this backend is also used to produce PDF output.  Since
-the La@TeX{} output uses @file{hyperref} to implement links and cross
-references, the PDF output file will be fully linked.
+Org-mode contains a La@TeX{} exporter written by Bastien Guerry.  With
+further processing@footnote{The default LaTeX output is designed for
+processing with pdftex or latex.  It includes packages that are not
+compatible with xetex and possibly luatex.  See the variables
+@code{org-export-latex-default-packages-alist} and
+@code{org-export-latex-packages-alist}.}, this backend is also used to
+produce PDF output.  Since the La@TeX{} output uses @file{hyperref} to
+implement links and cross references, the PDF output file will be fully
+linked.
 
 @menu
-* LaTeX/PDF export commands::   Which key invokes which commands
-* Quoting LaTeX code::          Incorporating literal La@TeX{} code
-* Sectioning structure::        Changing sectioning in La@TeX{} output
-* Tables in LaTeX export::      Options for exporting tables to La@TeX{}
-* Images in LaTeX export::      How to insert figures into La@TeX{} output
+* LaTeX/PDF export commands::  Which key invokes which commands
+* Header and sectioning::      Setting up the export file structure
+* Quoting LaTeX code::         Incorporating literal La@TeX{} code
+* Tables in LaTeX export::     Options for exporting tables to La@TeX{}
+* Images in LaTeX export::     How to insert figures into La@TeX{} output
+* Beamer class export::                Turning the file into a presentation
 @end menu
 
-@node LaTeX/PDF export commands, Quoting LaTeX code, LaTeX and PDF export, LaTeX and PDF export
+@node LaTeX/PDF export commands, Header and sectioning, LaTeX and PDF export, LaTeX and PDF export
 @subsection La@TeX{} export commands
 
 @cindex region, active
@@ -9417,11 +9716,11 @@ Export to a temporary buffer, do not create a file.
 @item C-c C-e v L
 Export only the visible part of the document.
 @item M-x org-export-region-as-latex
-Convert the region to La@TeX{} under the assumption that it was Org mode
+Convert the region to La@TeX{} under the assumption that it was Org-mode
 syntax before.  This is a global command that can be invoked in any
 buffer.
 @item M-x org-replace-region-by-latex
-Replace the active region (assumed to be in Org mode syntax) by La@TeX{}
+Replace the active region (assumed to be in Org-mode syntax) by La@TeX{}
 code.
 @kindex C-c C-e p
 @item C-c C-e p
@@ -9449,7 +9748,41 @@ with a numeric prefix argument. For example,
 @noindent
 creates two levels of headings and does the rest as items.
 
-@node Quoting LaTeX code, Sectioning structure, LaTeX/PDF export commands, LaTeX and PDF export
+@node Header and sectioning, Quoting LaTeX code, LaTeX/PDF export commands, LaTeX and PDF export
+@subsection Header and sectioning structure
+@cindex La@TeX{} class
+@cindex La@TeX{} sectioning structure
+@cindex La@TeX{} header
+@cindex header, for LaTeX files
+@cindex sectioning structure, for LaTeX export
+
+By default, the La@TeX{} output uses the class @code{article}.
+
+@vindex org-export-latex-default-class
+@vindex org-export-latex-classes
+@vindex org-export-latex-default-packages-alist
+@vindex org-export-latex-packages-alist
+@cindex #+LATEX_HEADER
+@cindex #+LATEX_CLASS
+@cindex #+LATEX_CLASS_OPTIONS
+@cindex property, LATEX_CLASS
+@cindex property, LATEX_CLASS_OPTIONS
+You can change this globally by setting a different value for
+@code{org-export-latex-default-class} or locally by adding an option like
+@code{#+LaTeX_CLASS: myclass} in your file, or with a @code{:LaTeX_CLASS:}
+property that applies when exporting a region containing only this (sub)tree.
+The class must be listed in @code{org-export-latex-classes}.  This variable
+defines a header template for each class@footnote{Into which the values of
+@code{org-export-latex-default-packages-alist} and
+@code{org-export-latex-packages-alist} are spliced.}, and allows you to
+define the sectioning structure for each class.  You can also define your own
+classes there.  @code{#+LaTeX_CLASS_OPTIONS} or a @code{LaTeX_CLASS_OPTIONS}
+property can specify the options for the @code{\documentclass} macro.  You
+can also use @code{#+LATEX_HEADER: \usepackage@{xyz@}} to add lines to the
+header.  See the docstring of @code{org-export-latex-classes} for more
+information.
+
+@node Quoting LaTeX code, Tables in LaTeX export, Header and sectioning, LaTeX and PDF export
 @subsection Quoting La@TeX{} code
 
 Embedded La@TeX{} as described in @ref{Embedded LaTeX}, will be correctly
@@ -9473,35 +9806,17 @@ All lines between these markers are exported literally
 #+END_LaTeX
 @end example
 
-@node  Sectioning structure, Tables in LaTeX export, Quoting LaTeX code, LaTeX and PDF export
-@subsection Sectioning structure
-@cindex La@TeX{} class
-@cindex La@TeX{} sectioning structure
-
-By default, the La@TeX{} output uses the class @code{article}.
-
-@vindex org-export-latex-default-class
-@vindex org-export-latex-classes
-@cindex #+LATEX_HEADER
-@cindex #+LATEX_CLASS
-@cindex property, LATEX_CLASS
-You can change this globally by setting a different value for
-@code{org-export-latex-default-class} or locally by adding an option like
-@code{#+LaTeX_CLASS: myclass} in your file, or with a @code{:LaTeX_CLASS:}
-property that applies when exporting a region containing only this (sub)tree.
-The class should be listed in @code{org-export-latex-classes}, where you can
-also define the sectioning structure for each class, as well as defining
-additional classes.  You can also use @code{#+LATEX_HEADER:
-\usepackage@{xyz@}} to add lines to the header.
 
-@node Tables in LaTeX export, Images in LaTeX export, Sectioning structure, LaTeX and PDF export
+@node Tables in LaTeX export, Images in LaTeX export, Quoting LaTeX code, LaTeX and PDF export
 @subsection Tables in La@TeX{} export
 @cindex tables, in La@TeX{} export
 
 For La@TeX{} export of a table, you can specify a label and a caption
 (@pxref{Images and tables}).  You can also use the @code{ATTR_LaTeX} line to
-request a longtable environment for the table, so that it may span several
-pages.  Finally, you can set the alignment string:
+request a @code{longtable} environment for the table, so that it may span
+several pages, or provide the @code{multicolumn} keyword that will make the
+table span the page in a multicolumn environment (@code{table*} environment).
+Finally, you can set the alignment string:
 
 @cindex #+CAPTION
 @cindex #+LABEL
@@ -9515,7 +9830,7 @@ pages.  Finally, you can set the alignment string:
 @end example
 
 
-@node Images in LaTeX export,  , Tables in LaTeX export, LaTeX and PDF export
+@node Images in LaTeX export, Beamer class export, Tables in LaTeX export, LaTeX and PDF export
 @subsection Images in La@TeX{} export
 @cindex images, inline in La@TeX{}
 @cindex inlining images in La@TeX{}
@@ -9532,12 +9847,12 @@ options that can be used in the optional argument of the
 @code{figure} environment, add something like @samp{placement=[h!]} to the
 Attributes.
 
-If you'd like to let text flow around the image, add the word @samp{wrap} to
-the @code{#+ATTR_LaTeX:} line, which will make the figure occupy the left
-half of the page.  To fine-tune, the @code{placement} field will be the
-set of additional arguments needed by the @code{wrapfigure} environment.
-Note that if you change the size of the image, you need to use compatible
-settings for @code{\includegraphics} and @code{wrapfigure}.
+If you would like to let text flow around the image, add the word @samp{wrap}
+to the @code{#+ATTR_LaTeX:} line, which will make the figure occupy the left
+half of the page.  To fine-tune, the @code{placement} field will be the set
+of additional arguments needed by the @code{wrapfigure} environment.  Note
+that if you change the size of the image, you need to use compatible settings
+for @code{\includegraphics} and @code{wrapfigure}.
 
 @cindex #+CAPTION
 @cindex #+LABEL
@@ -9555,11 +9870,138 @@ settings for @code{\includegraphics} and @code{wrapfigure}.
 If you need references to a label created in this way, write
 @samp{\ref@{fig:SED-HR4049@}} just like in La@TeX{}.
 
-@node DocBook export, Freemind export, LaTeX and PDF export, Exporting
+@node Beamer class export,  , Images in LaTeX export, LaTeX and PDF export
+@subsection Beamer class export
+
+The LaTeX class @file{beamer} allows production of high quality presentations
+using LaTeX and pdf processing.  Org-mode has special support for turning an
+Org-mode file or tree into a @file{beamer} presentation.
+
+When the LaTeX class for the current buffer (as set with @code{#+LaTeX_CLASS:
+beamer}) or subtree (set with a @code{LaTeX_CLASS} property) is
+@code{beamer}, a special export mode will turn the file or tree into a beamer
+presentation.  Any tree with not-too-deep level nesting should in principle be
+exportable as a beamer presentation.  By default, the top-level entries (or
+the first level below the selected subtree heading) will be turned into
+frames, and the outline structure below this level will become itemize lists.
+You can also configure the variable @code{org-beamer-frame-level} to a
+different level - then the hierarchy above frames will produce the sectioning
+structure of the presentation.
+
+A template for useful in-buffer settings or properties can be inserted into
+the buffer with @kbd{M-x org-beamer-settings-template}.  Among other things,
+this will install a column view format which is very handy for editing
+special properties used by beamer.
+
+You can influence the structure of the presentation using the following
+properties:
+
+@table @code
+@item BEAMER_env
+The environment that should be used to format this entry.  Valid environments
+are defined in the constant @code{org-beamer-environments-default}, and you
+can define more in @code{org-beamer-environments-extra}.  If this property is
+set, the entry will also get a @code{:B_environment:} tag to make this
+visible.  This tag has no semantic meaning, it is only a visual aid.
+@item BEAMER_envargs
+The beamer-special arguments that should be used for the environment, like
+@code{[t]} or @code{[<+->]} of @code{<2-3>}.  If the @code{BEAMER_col}
+property is also set, something like @code{C[t]} can be added here as well to
+set an options argument for the implied @code{columns} environment.
+@code{c[t]} will set an option for the implied @code{column} environment.
+@item BEAMER_col
+The width of a column that should start with this entry.  If this property is
+set, the entry will also get a @code{:BMCOL:} property to make this visible.
+Also this tag is only a visual aid.  When this is a plain number, it will be
+interpreted as a fraction of @code{\textwidth}.  Otherwise it will be assumed
+that you have specified the units, like @samp{3cm}.  The first such property
+in a frame will start a @code{columns} environment to surround the columns.
+This environment is closed when an entry has a @code{BEAMER_col} property
+with value 0 or 1, or automatically at the end of the frame.
+@item BEAMER_extra
+Additional commands that should be inserted after the environment has been
+opened.  For example, when creating a frame, this can be used to specify
+transitions.
+@end table
+
+Frames will automatically receive a @code{fragile} option if they contain
+source code that uses the verbatim environment.  Special @file{beamer}
+specific code can be inserted using @code{#+BEAMER:} and
+@code{#+BEGIN_beamer...#+end_beamer} constructs, similar to other export
+backends, but with the difference that @code{#+LaTeX:} stuff will be included
+in the presentation as well.
+
+Outline nodes with @code{BEAMER_env} property value @samp{note} or
+@samp{noteNH} will be formatted as beamer notes, i,e, they will be wrapped
+into @code{\note@{...@}}.  The former will include the heading as part of the
+note text, the latter will ignore the heading of that node.  To simplify note
+generation, it is actually enough to mark the note with a @emph{tag} (either
+@code{:B_note:} or @code{:B_noteNH:}) instead of creating the
+@code{BEAMER_env} property.
+
+You can turn on a special minor mode @code{org-beamer-mode} for editing
+support with
+
+@example
+#+STARTUP: beamer
+@end example
+
+@table @kbd
+@kindex C-c C-b
+@item C-c C-b
+In @code{org-beamer-mode}, this key offers fast selection of a beamer
+environment or the @code{BEAMER_col} property.
+@end table
+
+Column view provides a great way to set the environment of a node and other
+important parameters.  Make sure you are using a COLUMN format that is geared
+toward this special purpose.  The command @kbd{M-x
+org-beamer-settings-template} defines such a format.
+
+Here is a simple example Org document that is intended for beamer export.
+
+@smallexample
+#+LaTeX_CLASS: beamer
+#+TITLE: Example Presentation
+#+AUTHOR: Carsten Dominik
+#+LaTeX_CLASS_OPTIONS: [presentation]
+#+BEAMER_FRAME_LEVEL: 2
+#+BEAMER_HEADER_EXTRA: \usetheme@{Madrid@}\usecolortheme@{default@}
+#+COLUMNS: %35ITEM %10BEAMER_env(Env) %10BEAMER_envargs(Args) %4BEAMER_col(Col) %8BEAMER_extra(Ex)
+
+* This is the first structural section
+
+** Frame 1 \\ with a subtitle
+*** Thanks to Eric Fraga                                      :BMCOL:B_block:
+    :PROPERTIES:
+    :BEAMER_env: block
+    :BEAMER_envargs: C[t]
+    :BEAMER_col: 0.5
+    :END:
+    for the first viable beamer setup in Org
+*** Thanks to everyone else                                   :BMCOL:B_block:
+    :PROPERTIES:
+    :BEAMER_col: 0.5
+    :BEAMER_env: block
+    :BEAMER_envargs: <2->
+    :END:
+    for contributing to the discussion
+**** This will be formatted as a beamer note                  :B_note:
+** Frame 2 \\ where we will not use columns
+*** Request                                                   :B_block:
+    Please test this stuff!
+    :PROPERTIES:
+    :BEAMER_env: block
+    :END:
+@end smallexample
+
+For more information, see the documentation on Worg.
+
+@node DocBook export, TaskJuggler export, LaTeX and PDF export, Exporting
 @section DocBook export
 @cindex DocBook export
 @cindex PDF export
-@cindex Cui, Baoqui
+@cindex Cui, Baoqiu
 
 Org contains a DocBook exporter written by Baoqiu Cui.  Once an Org file is
 exported to DocBook format, it can be further processed to produce other
@@ -9569,12 +10011,12 @@ tools and stylesheets.
 Currently DocBook exporter only supports DocBook V5.0.
 
 @menu
-* DocBook export commands::     How to invoke DocBook export
-* Quoting DocBook code::        Incorporating DocBook code in Org files
-* Recursive sections::          Recursive sections in DocBook
-* Tables in DocBook export::    Tables are exported as HTML tables
-* Images in DocBook export::    How to insert figures into DocBook output
-* Special characters::          How to handle special characters
+* DocBook export commands::    How to invoke DocBook export
+* Quoting DocBook code::       Incorporating DocBook code in Org files
+* Recursive sections::         Recursive sections in DocBook
+* Tables in DocBook export::   Tables are exported as HTML tables
+* Images in DocBook export::   How to insert figures into DocBook output
+* Special characters::         How to handle special characters
 @end menu
 
 @node DocBook export commands, Quoting DocBook code, DocBook export, DocBook export
@@ -9606,6 +10048,13 @@ need to have XSLT processor and XSL-FO processor software installed on your
 system.  Check variables @code{org-export-docbook-xslt-proc-command} and
 @code{org-export-docbook-xsl-fo-proc-command}.
 
+@vindex org-export-docbook-xslt-stylesheet
+The stylesheet argument @code{%s} in variable
+@code{org-export-docbook-xslt-proc-command} is replaced by the value of
+variable @code{org-export-docbook-xslt-stylesheet}, which needs to be set by
+the user.  You can also overrule this global setting on a per-file basis by
+adding an in-buffer setting @code{#+XSLT:} to the Org file.
+
 @kindex C-c C-e v D
 @item C-c C-e v D
 Export only the visible part of the document.
@@ -9693,21 +10142,21 @@ or @code{width}, can be specified in two ways: you can either customize
 variable @code{org-export-docbook-default-image-attributes} or use the
 @code{#+ATTR_DOCBOOK:} line.  Attributes specified in variable
 @code{org-export-docbook-default-image-attributes} are applied to all inline
-images in the Org file to be exported (unless they are overwritten by image
+images in the Org file to be exported (unless they are overridden by image
 attributes specified in @code{#+ATTR_DOCBOOK:} lines).
 
 The @code{#+ATTR_DOCBOOK:} line can be used to specify additional image
-attributes or overwrite default image attributes for individual images.  If
+attributes or override default image attributes for individual images.  If
 the same attribute appears in both the @code{#+ATTR_DOCBOOK:} line and
 variable @code{org-export-docbook-default-image-attributes}, the former
-overwrites the latter.  Here is an example about how image attributes can be
+takes precedence.  Here is an example about how image attributes can be
 set:
 
 @cindex #+CAPTION
 @cindex #+LABEL
 @cindex #+ATTR_DOCBOOK
 @example
-#+CAPTION:    The logo of Org mode
+#+CAPTION:    The logo of Org-mode
 #+LABEL:      unicorn-svg
 #+ATTR_DOCBOOK: scalefit="1" width="100%" depth="100%"
 [[./img/org-mode-unicorn.svg]]
@@ -9724,12 +10173,12 @@ more types to this list as long as DocBook supports them.
 @cindex Special characters in DocBook export
 
 @vindex org-export-docbook-doctype
-@vindex org-html-entities
+@vindex org-entities
 Special characters that are written in @TeX{}-like syntax, such as @code{\alpha},
 @code{\Gamma}, and @code{\Zeta}, are supported by DocBook exporter.  These
 characters are rewritten to XML entities, like @code{&alpha;},
 @code{&Gamma;}, and @code{&Zeta;}, based on the list saved in variable
-@code{org-html-entities}.  As long as the generated DocBook file includes the
+@code{org-entities}.  As long as the generated DocBook file includes the
 corresponding entities, these special characters are recognized.
 
 You can customize variable @code{org-export-docbook-doctype} to include the
@@ -9748,12 +10197,142 @@ special characters included in XHTML entities:
 "
 @end example
 
-@node Freemind export, XOXO export, DocBook export, Exporting
+@node  TaskJuggler export, Freemind export, DocBook export, Exporting
+@section TaskJuggler export
+@cindex TaskJuggler export
+@cindex Project management
+
+@uref{http://www.taskjuggler.org/, TaskJuggler} is a project management tool.
+It provides an optimizing scheduler that computes your project time lines and
+resource assignments based on the project outline and the constraints that
+you have provided.
+
+The TaskJuggler exporter is a bit different from other exporters, such as the
+HTML and LaTeX exporters for example, in that it does not export all the
+nodes of a document or strictly follow the order of the nodes in the
+document.
+
+Instead the TaskJuggler exporter looks for a tree that defines the tasks and
+a optionally tree that defines the resources for this project. It then
+creates a TaskJuggler file based on these trees and the attributes defined in
+all the nodes.
+
+@subsection TaskJuggler export commands
+
+@table @kbd
+@kindex C-c C-e j
+@item C-c C-e j
+Export as TaskJuggler file.
+
+@kindex C-c C-e J
+@item C-c C-e J
+Export as TaskJuggler file and then open the file with TaskJugglerUI.
+@end table
+
+@subsection Tasks
+
+@vindex org-export-taskjuggler-project-tag
+Create your tasks as you usually do with Org-mode. Assign efforts to each
+task using properties (it's easiest to do this in the column view). You
+should end up with something similar to the example by Peter Jones in
+@url{http://www.contextualdevelopment.com/static/artifacts/articles/2008/project-planning/project-planning.org}.
+Now mark the top node of your tasks with a tag named
+@code{:taskjuggler_project:} (or whatever you customized
+@code{org-export-taskjuggler-project-tag} to). You are now ready to export
+the project plan with @kbd{C-c C-e J} which will export the project plan and
+open a gantt chart in TaskJugglerUI.
+
+@subsection Resources
+
+@vindex org-export-taskjuggler-resource-tag
+Next you can define resources and assign those to work on specific tasks. You
+can group your resources hierarchically. Tag the top node of the resources
+with @code{:taskjuggler_resource:} (or whatever you customized
+@code{org-export-taskjuggler-resource-tag} to). You can optionally assign an
+identifier (named @samp{resource_id}) to the resources (using the standard
+Org properties commands, @pxref{Property syntax}) or you can let the exporter
+generate identifiers automatically (the exporter picks the first word of the
+headline as the identifier as long as it is unique, see the documentation of
+@code{org-taskjuggler-get-unique-id}). Using that identifier you can then
+allocate resources to tasks. This is again done with the @samp{allocate}
+property on the tasks. Do this in column view or when on the task type
+@kbd{C-c C-x p allocate @key{RET} <resource_id> @key{RET}}.
+
+Once the allocations are done you can again export to TaskJuggler and check
+in the Resource Allocation Graph which person is working on what task at what
+time.
+
+@subsection Export of properties
+
+The exporter also takes TODO state information into consideration, i.e. if a
+task is marked as done it will have the corresponding attribute in
+TaskJuggler (@samp{complete 100}). Also it will export any property on a task
+resource or resource node which is known to TaskJuggler, such as
+@samp{limits}, @samp{vacation}, @samp{shift}, @samp{booking},
+@samp{efficiency}, @samp{journalentry}, @samp{rate} for resources or
+@samp{account}, @samp{start}, @samp{note}, @samp{duration}, @samp{end},
+@samp{journalentry}, @samp{milestone}, @samp{reference}, @samp{responsible},
+@samp{scheduling}, etc for tasks.
+
+@subsection Dependencies
+
+The exporter will handle dependencies that are defined in the tasks either
+with the @samp{ORDERED} attribute (@pxref{TODO dependencies}), with the
+@samp{BLOCKER} attribute (see org-depend.el) or alternatively with a
+@samp{depends} attribute. Both the @samp{BLOCKER} and the @samp{depends}
+attribute can be either @samp{previous-sibling} or a reference to an
+identifier (named @samp{task_id}) which is defined for another task in the
+project. @samp{BLOCKER} and the @samp{depends} attribute can define multiple
+dependencies separated by either space or comma. You can also specify
+optional attributes on the dependency by simply appending it. The following
+examples should illustrate this:
+
+@example
+* Preparation
+  :PROPERTIES:
+  :task_id:  preparation
+  :ORDERED:  t
+  :END:
+* Training material
+  :PROPERTIES:
+  :task_id:  training_material
+  :ORDERED:  t
+  :END:
+** Markup Guidelines
+   :PROPERTIES:
+   :Effort:   2.0
+   :END:
+** Workflow Guidelines
+   :PROPERTIES:
+   :Effort:   2.0
+   :END:
+* Presentation
+  :PROPERTIES:
+  :Effort:   2.0
+  :BLOCKER:  training_material @{ gapduration 1d @} preparation
+  :END:
+@end example
+
+@subsection Reports
+
+@vindex org-export-taskjuggler-default-reports
+TaskJuggler can produce many kinds of reports (e.g. gantt chart, resource
+allocation, etc). The user defines what kind of reports should be generated
+for a project in the TaskJuggler file. The exporter will automatically insert
+some default reports in the file. These defaults are defined in
+@code{org-export-taskjuggler-default-reports}. They can be modified using
+customize along with a number of other options. For a more complete list, see
+@kbd{M-x customize-group @key{RET} org-export-taskjuggler @key{RET}}.
+
+For more information and examples see the Org-taskjuggler tutorial at
+@uref{http://orgmode.org/worg/org-tutorials/org-taskjuggler.php}.
+
+@node Freemind export, XOXO export, TaskJuggler export, Exporting
 @section Freemind export
 @cindex Freemind export
 @cindex mind map
 
-The freemind exporter was written by Lennart Borgman.
+The Freemind exporter was written by Lennart Borgman.
 
 @table @kbd
 @kindex C-c C-e m
@@ -9765,7 +10344,7 @@ Export as Freemind mind map @file{myfile.mm}.
 @section XOXO export
 @cindex XOXO export
 
-Org mode contains an exporter that produces XOXO-style output.
+Org-mode contains an exporter that produces XOXO-style output.
 Currently, this exporter only handles the general outline structure and
 does not interpret any additional Org-mode features.
 
@@ -9786,10 +10365,10 @@ Export only the visible part of the document.
 @vindex org-icalendar-use-deadline
 @vindex org-icalendar-use-scheduled
 @vindex org-icalendar-categories
-Some people use Org mode for keeping track of projects, but still prefer a
+Some people use Org-mode for keeping track of projects, but still prefer a
 standard calendar application for anniversaries and appointments.  In this
 case it can be useful to show deadlines and other time-stamped items in Org
-files in the calendar application.  Org mode can export calendar information
+files in the calendar application.  Org-mode can export calendar information
 in the standard iCalendar format.  If you also want to have TODO entries
 included in the export, configure the variable
 @code{org-icalendar-include-todo}.  Plain timestamps are exported as VEVENT,
@@ -9847,10 +10426,9 @@ and the description from the body (limited to
 How this calendar is best read and updated, depends on the application
 you are using.  The FAQ covers this issue.
 
-@node Publishing, Miscellaneous, Exporting, Top
+@node Publishing, Working With Source Code, Exporting, Top
 @chapter Publishing
 @cindex publishing
-@cindex O'Toole, David
 
 Org includes a publishing management system that allows you to configure
 automatic HTML conversion of @emph{projects} composed of interlinked org
@@ -9864,10 +10442,10 @@ conversion so that files are available in both formats on the server.
 Publishing has been contributed to Org by David O'Toole.
 
 @menu
-* Configuration::               Defining projects
-* Uploading files::             How to get files up on the server
-* Sample configuration::        Example projects
-* Triggering publication::      Publication commands
+* Configuration::              Defining projects
+* Uploading files::            How to get files up on the server
+* Sample configuration::       Example projects
+* Triggering publication::     Publication commands
 @end menu
 
 @node Configuration, Uploading files, Publishing, Publishing
@@ -9877,13 +10455,14 @@ Publishing needs significant configuration to specify files, destination
 and many other properties of a project.
 
 @menu
-* Project alist::               The central configuration variable
-* Sources and destinations::    From here to there
-* Selecting files::             What files are part of the project?
-* Publishing action::           Setting the function doing the publishing
-* Publishing options::          Tweaking HTML export
-* Publishing links::            Which links keep working after publishing?
-* Project page index::          Publishing a list of project files
+* Project alist::              The central configuration variable
+* Sources and destinations::   From here to there
+* Selecting files::            What files are part of the project?
+* Publishing action::          Setting the function doing the publishing
+* Publishing options::         Tweaking HTML export
+* Publishing links::           Which links keep working after publishing?
+* Sitemap::                    Generating a list of all pages
+* Generating an index::                An index that reaches across pages
 @end menu
 
 @node Project alist, Sources and destinations, Configuration, Configuration
@@ -9929,11 +10508,15 @@ publish to a webserver using a file name syntax appropriate for
 the Emacs @file{tramp} package.  Or you can publish to a local directory and
 use external tools to upload your website (@pxref{Uploading files}).
 @item @code{:preparation-function}
-@tab Function called before starting the publishing process, for example, to
-run @code{make} for updating files to be published.
+@tab Function or list of functions to be called before starting the
+publishing process, for example, to run @code{make} for updating files to be
+published.  The project property list is scoped into this call as the
+variable @code{project-plist}.
 @item @code{:completion-function}
-@tab Function called after finishing the publishing process, for example, to
-change permissions of the resulting files.
+@tab Function or list of functions called after finishing the publishing
+process, for example, to change permissions of the resulting files.  The
+project property list is scoped into this call as the variable
+@code{project-plist}.
 @end multitable
 @noindent
 
@@ -9994,10 +10577,11 @@ list of functions, which will all be called in turn.
 @tab Non-nil means, publish htmlized source.
 @end multitable
 
-The function must accept two arguments: a property list containing at least a
-@code{:publishing-directory} property, and the name of the file to be
-published.  It should take the specified file, make the necessary
-transformation (if any) and place the result into the destination folder.
+The function must accept three arguments: a property list containing at least
+a @code{:publishing-directory} property, the name of the file to be
+published, and the path to the publishing directory of the output file.  It
+should take the specified file, make the necessary transformation (if any)
+and place the result into the destination folder.
 
 @node Publishing options, Publishing links, Publishing action, Configuration
 @subsection Options for the HTML/La@TeX{} exporters
@@ -10033,6 +10617,7 @@ respective variable for details.
 @vindex org-export-with-fixed-width
 @vindex org-export-with-timestamps
 @vindex org-export-author-info
+@vindex org-export-email
 @vindex org-export-creator-info
 @vindex org-export-with-tables
 @vindex org-export-highlight-first-table-line
@@ -10081,6 +10666,7 @@ respective variable for details.
 @item @code{:fixed-width}           @tab @code{org-export-with-fixed-width}
 @item @code{:timestamps}            @tab @code{org-export-with-timestamps}
 @item @code{:author-info}           @tab @code{org-export-author-info}
+@item @code{:email-info}            @tab @code{org-export-email-info}
 @item @code{:creator-info}          @tab @code{org-export-creator-info}
 @item @code{:tables}                @tab @code{org-export-with-tables}
 @item @code{:table-auto-headline}   @tab @code{org-export-highlight-first-table-line}
@@ -10117,7 +10703,7 @@ its setting overrides the value of the corresponding user variable (if
 any) during publishing.  Options set within a file (@pxref{Export
 options}), however, override everything.
 
-@node Publishing links, Project page index, Publishing options, Configuration
+@node Publishing links, Sitemap, Publishing options, Configuration
 @subsection Links between published files
 @cindex links, publishing
 
@@ -10154,31 +10740,61 @@ description into the HTML file, but no link.  One option for this
 function is @code{org-publish-validate-link} which checks if the given
 file is part of any project in @code{org-publish-project-alist}.
 
-@node Project page index,  , Publishing links, Configuration
-@subsection Project page index
-@cindex index, of published pages
+@node Sitemap, Generating an index, Publishing links, Configuration
+@subsection Generating a sitemap
+@cindex sitemap, of published pages
 
-The following properties may be used to control publishing of an
-index of files or a summary page for a given project.
+The following properties may be used to control publishing of
+a map of files for a given project.
 
-@multitable @columnfractions 0.25 0.75
-@item @code{:auto-index}
-@tab When non-nil, publish an index during @code{org-publish-current-project}
+@multitable @columnfractions 0.35 0.65
+@item @code{:auto-sitemap}
+@tab When non-nil, publish a sitemap during @code{org-publish-current-project}
 or @code{org-publish-all}.
 
-@item @code{:index-filename}
-@tab Filename for output of index. Defaults to @file{sitemap.org} (which
+@item @code{:sitemap-filename}
+@tab Filename for output of sitemap. Defaults to @file{sitemap.org} (which
 becomes @file{sitemap.html}).
 
-@item @code{:index-title}
-@tab Title of index page. Defaults to name of file.
+@item @code{:sitemap-title}
+@tab Title of sitemap page. Defaults to name of file.
 
-@item @code{:index-function}
-@tab Plug-in function to use for generation of index.
-Defaults to @code{org-publish-org-index}, which generates a plain list
+@item @code{:sitemap-function}
+@tab Plug-in function to use for generation of the sitemap.
+Defaults to @code{org-publish-org-sitemap}, which generates a plain list
 of links to all files in the project.
+
+@item @code{:sitemap-sort-folders}
+@tab Where folders should appear in the sitemap.  Set this to @code{first}
+(default) or @code{last} to display folders first or last,
+respectively.  Any other value will mix files and folders.
+
+@item @code{:sitemap-alphabetically}
+@tab The site map is normally sorted alphabetically.  Set this explicitly to
+@code{nil} to turn off sorting.
+
+@item @code{:sitemap-ignore-case}
+@tab Should sorting be case-sensitive?  Default @code{nil}.
+
+@end multitable
+
+@node Generating an index,  , Sitemap, Configuration
+@subsection Generating an index
+@cindex index, in a publishing project
+
+Org-mode can generate an index across the files of a publishing project.
+
+@multitable @columnfractions 0.25 0.75
+@item @code{:makeindex}
+@tab When non-nil, generate in index in the file @file{theindex.org} and
+publish it as @file{theindex.html}.
 @end multitable
 
+The file will be create when first publishing a project with the
+@code{:makeindex} set.  The file only contains a statement @code{#+include:
+"theindex.inc"}.  You can then built around this include statement by adding
+a title, style information etc.
+
 @node Uploading files, Sample configuration, Configuration, Publishing
 @section Uploading files
 @cindex rsync
@@ -10186,7 +10802,7 @@ of links to all files in the project.
 
 For those people already utilizing third party sync tools such as
 @command{rsync} or @command{unison}, it might be preferable not to use the built in
-@i{remote} publishing facilities of Org mode which rely heavily on
+@i{remote} publishing facilities of Org-mode which rely heavily on
 Tramp.  Tramp, while very useful and powerful, tends not to be
 so efficient for multiple file transfer and has been known to cause problems
 under heavy usage.
@@ -10220,8 +10836,8 @@ project publishing only a set of Org files.  The second example is
 more complex, with a multi-component project.
 
 @menu
-* Simple example::              One-component publishing
-* Complex example::             A multi-component publishing example
+* Simple example::             One-component publishing
+* Complex example::            A multi-component publishing example
 @end menu
 
 @node Simple example, Complex example, Sample configuration, Sample configuration
@@ -10253,7 +10869,7 @@ excluded.
 To ensure that links are preserved, care should be taken to replicate
 your directory structure on the web server, and to use relative file
 paths. For example, if your Org files are kept in @file{~/org} and your
-publishable images in @file{~/images}, you'd link to an image with
+publishable images in @file{~/images}, you would link to an image with
 @c
 @example
 file:../images/myimage.png
@@ -10321,26 +10937,1378 @@ above, or by customizing the variable @code{org-publish-use-timestamps-flag}.
 This may be necessary in particular if files include other files via
 @code{#+SETUPFILE:} or @code{#+INCLUDE:}.
 
-@node Miscellaneous, Hacking, Publishing, Top
-@chapter Miscellaneous
+@comment  node-name,  next,  previous,  up
+@comment Working With Source Code, Miscellaneous, Publishing, Top
+
+@node Working With Source Code, Miscellaneous, Publishing, Top
+@chapter Working with source code
+@cindex Schulte, Eric
+@cindex Davison, Dan
+@cindex source code, working with
+
+Source code can be included in Org-mode documents using a @samp{src} block,
+e.g.
+
+@example
+#+BEGIN_SRC emacs-lisp
+  (defun org-xor (a b)
+     "Exclusive or."
+     (if a (not b) b))
+#+END_SRC
+@end example
+
+Org-mode provides a number of features for working with live source code,
+including editing of code blocks in their native major-mode, evaluation of
+code blocks, tangling of code blocks, and exporting code blocks and
+their results in several formats.  This functionality was contributed by Dan
+Davison and Eric Schulte, and was originally named Org-babel.
+
+The following sections describe Org-mode's code block handling facilities.
 
 @menu
-* Completion::                  M-TAB knows what you need
-* Speed keys::                  Electic commands at the beginning of a headline
-* Customization::               Adapting Org to your taste
-* In-buffer settings::          Overview of the #+KEYWORDS
-* The very busy C-c C-c key::   When in doubt, press C-c C-c
-* Clean view::                  Getting rid of leading stars in the outline
-* TTY keys::                    Using Org on a tty
-* Interaction::                 Other Emacs packages
+* Structure of code blocks::   Code block syntax described
+* Editing source code::                Language major-mode editing
+* Exporting code blocks::      Export contents and/or results
+* Extracting source code::     Create pure source code files
+* Evaluating code blocks::     Place results of evaluation in the Org-mode buffer
+* Library of Babel::           Use and contribute to a library of useful code blocks
+* Languages::                  List of supported code block languages
+* Header arguments::           Configure code block functionality
+* Results of evaluation::      How evaluation results are handled
+* Noweb reference syntax::     Literate programming in Org-mode
+* Key bindings and useful functions::  Work quickly with code blocks
+* Batch execution::            Call functions from the command line
 @end menu
 
+@comment  node-name,  next,  previous,  up
+@comment  Structure of code blocks, Editing source code, Working With Source Code, Working With Source Code
 
-@node Completion, Speed keys, Miscellaneous, Miscellaneous
-@section Completion
-@cindex completion, of @TeX{} symbols
-@cindex completion, of TODO keywords
-@cindex completion, of dictionary words
+@node Structure of code blocks, Editing source code, Working With Source Code, Working With Source Code
+@section Structure of code blocks
+@cindex code block, structure
+@cindex source code, block structure
+
+The structure of code blocks is as follows:
+
+@example
+#+srcname: <name>
+#+begin_src <language> <switches> <header arguments>
+  <body>
+#+end_src
+@end example
+
+@table @code
+@item <name>
+This name is associated with the code block.  This is similar to the
+@samp{#+tblname} lines that can be used to name tables in Org-mode files.
+Referencing the name of a code block makes it possible to evaluate the
+block from other places in the file, other files, or from Org-mode table
+formulas (see @ref{The spreadsheet}).
+@item <language>
+The language of the code in the block.
+@item <switches>
+Switches controlling exportation of the code block (see switches discussion in
+@ref{Literal examples})
+@item <header arguments>
+Optional header arguments control many aspects of evaluation, export and
+tangling of code blocks. See the @ref{Header arguments}
+section. Header arguments can also be set on a per-buffer or per-subtree
+basis using properties.
+@item <body>
+The source code.
+@end table
+
+@comment  node-name,  next,  previous,  up
+@comment  Editing source code, Exporting code blocks, Structure of code blocks, Working With Source Code
+
+@node Editing source code, Exporting code blocks, Structure of code blocks, Working With Source Code
+@section Editing source code
+@cindex code block, editing
+@cindex source code, editing
+
+@kindex C-c '
+Use @kbd{C-c '} to edit the current code block. This brings up
+a language major-mode edit buffer containing the body of the code
+block. Saving this buffer will write the new contents back to the Org
+buffer. Use @kbd{C-c '} again to exit.
+
+The @code{org-src-mode} minor mode will be active in the edit buffer. The
+following variables can be used to configure the behavior of the edit
+buffer. See also the customization group @code{org-edit-structure} for
+further configuration options.
+
+@table @code
+@item org-src-lang-modes
+If an Emacs major-mode named @code{<lang>-mode} exists, where
+@code{<lang>} is the language named in the header line of the code block,
+then the edit buffer will be placed in that major-mode. This variable
+can be used to map arbitrary language names to existing major modes.
+@item org-src-window-setup
+Controls the way Emacs windows are rearranged when the edit buffer is created.
+@item org-src-preserve-indentation
+This variable is especially useful for tangling languages such as
+python, in which whitespace indentation in the output is critical.
+@item org-src-ask-before-returning-to-edit-buffer
+By default, Org will ask before returning to an open edit buffer. Set
+this variable to nil to switch without asking.
+@end table
+
+@comment  node-name,  next,  previous,  up
+@comment  Exporting code blocks, Extracting source code, Editing source code, Working With Source Code
+
+@node Exporting code blocks, Extracting source code, Editing source code, Working With Source Code
+@section Exporting code blocks
+@cindex code block, exporting
+@cindex source code, exporting
+
+It is possible to export the @emph{contents} of code blocks, the
+@emph{results} of code block evaluation, @emph{neither}, or @emph{both}.  For
+most languages, the default exports the contents of code blocks. However, for
+some languages (e.g. @code{ditaa}) the default exports the results of code
+block evaluation.  For information on exporting code block bodies, see
+@ref{Literal examples}.
+
+The @code{:exports} header argument can be used to specify export
+behavior:
+
+@subsubheading Header arguments:
+@table @code
+@item :exports code
+The default in most languages. The body of the code block is exported, as
+described in @ref{Literal examples}.
+@item :exports results
+The code block will be evaluated and the results will be placed in the
+Org-mode buffer for export, either updating previous results of the code
+block located anywhere in the buffer or, if no previous results exist,
+placing the results immediately after the code block.  The body of the code
+block will not be exported.
+@item :exports both
+Both the code block and its results will be exported.
+@item :exports none
+Neither the code block nor its results will be exported.
+@end table
+
+It is possible to inhibit the evaluation of code blocks during export.
+Setting the the @code{org-export-babel-evaluate} variable to @code{nil} will
+ensure that no code blocks are evaluated as part of the export process.  This
+can be useful in situations where potentially untrusted Org-mode files are
+exported in an automated fashion, for example when Org-mode is used as the
+markup language for a wiki.
+
+@comment  node-name,  next,  previous,  up
+@comment  Extracting source code, Evaluating code blocks, Exporting code blocks, Working With Source Code
+@node Extracting source code, Evaluating code blocks, Exporting code blocks, Working With Source Code
+@section Extracting source code
+@cindex source code, extracting
+@cindex code block, extracting source code
+
+Creating pure source code files by extracting code from source blocks is
+referred to as ``tangling''---a term adopted from the literate programming
+community.  During ``tangling'' of code blocks their bodies are expanded
+using @code{org-babel-expand-src-block} which can expand both variable and
+``noweb'' style references  (see @ref{Noweb reference syntax}).
+
+@subsubheading Header arguments
+@table @code
+@item :tangle no
+The default.  The code block is not included in the tangled output.
+@item :tangle yes
+Include the code block in the tangled output. The output file name is the
+name of the org file with the extension @samp{.org} replaced by the extension
+for the block language.
+@item :tangle filename
+Include the code block in the tangled output to file @samp{filename}.
+@end table
+
+@kindex  C-c C-v t
+@subsubheading Functions
+@table @code
+@item org-babel-tangle @kbd{C-c C-v t}
+Tangle the current file.
+@item org-babel-tangle-file
+Choose a file to tangle.
+@end table
+
+@subsubheading Hooks
+@table @code
+@item org-babel-post-tangle-hook
+This hook is run from within code files tangled by @code{org-babel-tangle}.
+Example applications could include post-processing, compilation or evaluation
+of tangled code files.
+@end table
+
+@node Evaluating code blocks, Library of Babel, Extracting source code, Working With Source Code
+@section Evaluating code blocks
+@cindex code block, evaluating
+@cindex source code, evaluating
+
+Code blocks can be evaluated@footnote{Whenever code is evaluated there is a
+potential for that code to do harm.  Org-mode provides a number of safeguards
+to ensure that it only evaluates code with explicit confirmation from the
+user.  For information on these safeguards (and on how to disable them) see
+@ref{Code evaluation security}.} and the results placed in the Org-mode
+buffer.  By default, evaluation is only turned on for @code{emacs-lisp} code
+blocks, however support exists for evaluating blocks in many languages.  See
+@ref{Languages} for a list of supported languages.  See @ref{Structure of
+code blocks} for information on the syntax used to define a code block.
+
+@kindex C-c C-c
+There are a number of ways to evaluate code blocks.  The simplest is to press
+@kbd{C-c C-c} or @kbd{C-c C-v e} with the point on a code block@footnote{The
+@code{org-babel-no-eval-on-ctrl-c-ctrl-c} variable can be used to remove code
+evaluation from the @kbd{C-c C-c} key binding.}.  This will call the
+@code{org-babel-execute-src-block} function to evaluate the block and insert
+its results into the Org-mode buffer.
+
+It is also possible to evaluate named code blocks from anywhere in an
+Org-mode buffer or an Org-mode table.  @code{#+call} (or synonymously
+@code{#+function} or @code{#+lob}) lines can be used to remotely execute code
+blocks located in the current Org-mode buffer or in the ``Library of Babel''
+(see @ref{Library of Babel}).  These lines use the following syntax.
+
+@example
+#+call: <name>(<arguments>) <header arguments>
+#+function: <name>(<arguments>) <header arguments>
+#+lob: <name>(<arguments>) <header arguments>
+@end example
+
+@table @code
+@item <name>
+The name of the code block to be evaluated.
+@item <arguments>
+Arguments specified in this section will be passed to the code block.
+@item <header arguments>
+Header arguments can be placed after the function invocation.  See
+@ref{Header arguments} for more information on header arguments.
+@end table
+
+
+@node Library of Babel, Languages, Evaluating code blocks, Working With Source Code
+@section Library of Babel
+@cindex babel, library of
+@cindex source code, library
+@cindex code block, library
+
+The ``Library of Babel'' is a library of code blocks
+that can be called from any Org-mode file.  The library is housed in an
+Org-mode file located in the @samp{contrib} directory of Org-mode.
+Org-mode users can deposit functions they believe to be generally
+useful in the library.
+
+Code blocks defined in the ``Library of Babel'' can be called remotely as if
+they were in the current Org-mode buffer (see @ref{Evaluating code blocks}
+for information on the syntax of remote code block evaluation).
+
+@kindex C-c C-v l
+Code blocks located in any Org-mode file can be loaded into the ``Library of
+Babel'' with the @code{org-babel-lob-ingest} function, bound to @kbd{C-c C-v
+l}.
+
+@node Languages, Header arguments, Library of Babel, Working With Source Code
+@section Languages
+@cindex babel, languages
+@cindex source code, languages
+@cindex code block, languages
+
+Code blocks in the following languages are supported.
+
+@multitable @columnfractions 0.28 0.3 0.22 0.2
+@item @b{Language} @tab @b{Identifier} @tab @b{Language} @tab @b{Identifier}
+@item Asymptote @tab asymptote @tab C @tab C
+@item C++ @tab C++ @tab Clojure @tab clojure
+@item css @tab css @tab ditaa @tab ditaa
+@item Graphviz @tab dot @tab Emacs Lisp @tab emacs-lisp
+@item gnuplot @tab gnuplot @tab Haskell @tab haskell
+@item LaTeX @tab latex @tab Matlab @tab matlab
+@item Mscgen @tab mscgen @tab Objective Caml @tab ocaml
+@item Octave @tab octave @tab OZ @tab oz
+@item Perl @tab perl @tab Python @tab python
+@item R @tab R @tab Ruby @tab ruby
+@item Sass @tab sass @tab GNU Screen @tab screen
+@item shell @tab sh @tab SQL @tab sql
+@item Sqlite @tab sqlite
+@end multitable
+
+Language-specific documentation is available for some languages.  If
+available, it can be found at
+@uref{http://orgmode.org/worg/org-contrib/babel/languages}.
+
+The @code{org-babel-load-languages} controls which languages are enabled for
+evaluation (by default only @code{emacs-lisp} is enabled).  This variable can
+be set using the customization interface or by adding code like the following
+to your emacs configuration.
+
+@quotation
+The following disables @code{emacs-lisp} evaluation and enables evaluation of
+@code{R} code blocks.
+@end quotation
+
+@lisp
+(org-babel-do-load-languages
+ 'org-babel-load-languages
+ '((emacs-lisp . nil)
+   (R . t)))
+@end lisp
+
+It is also possible to enable support for a language by loading the related
+elisp file with @code{require}.
+
+@quotation
+The following adds support for evaluating @code{clojure} code blocks.
+@end quotation
+
+@lisp
+(require 'ob-clojure)
+@end lisp
+
+@node Header arguments, Results of evaluation, Languages, Working With Source Code
+@section Header arguments
+@cindex code block, header arguments
+@cindex source code, block header arguments
+
+Code block functionality can be configured with header arguments.  This
+section provides an overview of the use of header arguments, and then
+describes each header argument in detail.
+
+@menu
+* Using header arguments::     Different ways to set header arguments
+* Specific header arguments::  List of header arguments
+@end menu
+
+@node Using header arguments, Specific header arguments, Header arguments, Header arguments
+@subsection Using header arguments
+
+The values of header arguments can be set in five different ways, each more
+specific (and having higher priority) than the last.
+@menu
+* System-wide header arguments::  Set global default values
+* Language-specific header arguments:: Set default values by language
+* Buffer-wide header arguments::  Set default values for a specific buffer
+* Header arguments in Org-mode properties::  Set default values for a buffer or heading
+* Code block specific header arguments::  The most common way to set values
+@end menu
+
+
+@node System-wide header arguments, Language-specific header arguments, Using header arguments, Using header arguments
+@subsubheading System-wide header arguments
+@vindex org-babel-default-header-args
+System-wide values of header arguments can be specified by customizing the
+@code{org-babel-default-header-args} variable:
+
+@example
+:session    => "none"
+:results    => "replace"
+:exports    => "code"
+:cache      => "no"
+:noweb      => "no"
+@end example
+
+@c @example
+@c   org-babel-default-header-args is a variable defined in `org-babel.el'.
+@c   Its value is
+@c   ((:session . "none")
+@c    (:results . "replace")
+@c    (:exports . "code")
+@c    (:cache . "no")
+@c    (:noweb . "no"))
+
+
+@c   Documentation:
+@c   Default arguments to use when evaluating a code block.
+@c @end example
+
+For example, the following example could be used to set the default value of
+@code{:noweb} header arguments to @code{yes}.  This would have the effect of
+expanding @code{:noweb} references by default when evaluating source code
+blocks.
+
+@lisp
+(setq org-babel-default-header-args
+(cons '(:noweb . "yes")
+(assq-delete-all :noweb org-babel-default-header-args)))
+@end lisp
+
+@node Language-specific header arguments, Buffer-wide header arguments, System-wide header arguments, Using header arguments
+@subsubheading Language-specific header arguments
+Each language can define its own set of default header arguments.  See the
+language-specific documentation available online at
+@uref{http://orgmode.org/worg/org-contrib/babel}.
+
+@node Buffer-wide header arguments, Header arguments in Org-mode properties, Language-specific header arguments, Using header arguments
+@subsubheading Buffer-wide header arguments
+Buffer-wide header arguments may be specified through the use of a special
+line placed anywhere in an Org-mode file.  The line consists of the
+@code{#+BABEL:} keyword followed by a series of header arguments which may be
+specified using the standard header argument syntax.
+
+For example the following would set @code{session} to @code{*R*}, and
+@code{results} to @code{silent} for every code block in the buffer, ensuring
+that all execution took place in the same session, and no results would be
+inserted into the buffer.
+
+@example
+#+BABEL: :session *R* :results silent
+@end example
+
+@node Header arguments in Org-mode properties, Code block specific header arguments, Buffer-wide header arguments, Using header arguments
+@subsubheading Header arguments in Org-mode properties
+
+Header arguments are also read from Org-mode properties (see @ref{Property
+syntax}), which can be set on a buffer-wide or per-heading basis. An example
+of setting a header argument for all code blocks in a buffer is
+
+@example
+#+property: tangle yes
+@end example
+
+When properties are used to set default header arguments, they are looked up
+with inheritance, so the value of the @code{:cache} header argument will default
+to @code{yes} in all code blocks in the subtree rooted at the following
+heading:
+
+@example
+* outline header
+:PROPERTIES:
+:cache:    yes
+:END:
+@end example
+
+@kindex C-c C-x p
+@vindex org-babel-default-header-args
+Properties defined in this way override the properties set in
+@code{org-babel-default-header-args}.  It is convenient to use the
+@code{org-set-property} function bound to @kbd{C-c C-x p} to set properties
+in Org-mode documents.
+
+@node Code block specific header arguments,  , Header arguments in Org-mode properties, Using header arguments
+@subsubheading Code block specific header arguments
+
+The most common way to assign values to header arguments is at the
+code block level.  This can be done by listing a sequence of header
+arguments and their values as part of the @code{#+begin_src} line.
+Properties set in this way override both the values of
+@code{org-babel-default-header-args} and header arguments specified as
+properties.  In the following example, the @code{:results} header argument
+is set to @code{silent}, meaning the results of execution will not be
+inserted in the buffer, and the @code{:exports} header argument is set to
+@code{code}, meaning only the body of the code block will be
+preserved on export to HTML or LaTeX.
+
+@example
+#+source: factorial
+#+begin_src haskell :results silent :exports code :var n=0
+fac 0 = 1
+fac n = n * fac (n-1)
+#+end_src
+@end example
+
+Similarly, it is possible to set header arguments for inline code blocks:
+
+@example
+src_haskell[:exports both]@{fac 5@}
+@end example
+
+Header arguments for ``Library of Babel'' or function call lines can be set as shown below:
+
+@example
+#+call: factorial(n=5) :exports results
+@end example
+
+@node Specific header arguments,  , Using header arguments, Header arguments
+@subsection Specific header arguments
+The following header arguments are defined:
+
+@menu
+* var::                                Pass arguments to code blocks
+* results::                    Specify the type of results and how they will
+                                be collected and handled
+* file::                       Specify a path for file output
+* dir::                                Specify the default (possibly remote)
+                                directory for code block execution
+* exports::                    Export code and/or results
+* tangle::                     Toggle tangling and specify file name
+* no-expand::                  Turn off variable assignment and noweb
+                                expansion during tangling
+* comments::                    Toggle insertion of comments in tangled
+                                code files
+* session::                    Preserve the state of code evaluation
+* noweb::                      Toggle expansion of noweb references
+* cache::                      Avoid re-evaluating unchanged code blocks
+* hlines::                     Handle horizontal lines in tables
+* colnames::                   Handle column names in tables
+* rownames::                   Handle row names in tables
+* shebang::                    Make tangled files executable
+* eval::                        Limit evaluation of specific code blocks
+@end menu
+
+@node var, results, Specific header arguments, Specific header arguments
+@subsubsection @code{:var}
+The @code{:var} header argument is used to pass arguments to code blocks.
+The specifics of how arguments are included in a code block vary by language;
+these are addressed in the language-specific documentation. However, the
+syntax used to specify arguments is the same across all languages.  The
+values passed to arguments can be literal values, values from org-mode tables
+and literal example blocks, or the results of other code blocks.
+
+These values can be indexed in a manner similar to arrays---see the
+``indexable variable values'' heading below.
+
+The following syntax is used to pass arguments to code blocks using the
+@code{:var} header argument.
+
+@example
+:var name=assign
+@end example
+
+where @code{assign} can take one of the following forms
+
+@itemize @bullet
+@item literal value
+either a string @code{"string"} or a number @code{9}.
+@item reference
+a table name:
+
+@example
+#+tblname: example-table
+| 1 |
+| 2 |
+| 3 |
+| 4 |
+
+#+source: table-length
+#+begin_src emacs-lisp :var table=example-table
+(length table)
+#+end_src
+
+#+results: table-length
+: 4
+@end example
+
+a code block name, as assigned by @code{#+srcname:}, followed by
+parentheses:
+
+@example
+#+begin_src emacs-lisp :var length=table-length()
+(* 2 length)
+#+end_src
+
+#+results:
+: 8
+@end example
+
+In addition, an argument can be passed to the code block referenced
+by @code{:var}.  The argument is passed within the parentheses following the
+code block name:
+
+@example
+#+source: double
+#+begin_src emacs-lisp :var input=8
+(* 2 input)
+#+end_src
+
+#+results: double
+: 16
+
+#+source: squared
+#+begin_src emacs-lisp :var input=double(input=1)
+(* input input)
+#+end_src
+
+#+results: squared
+: 4
+@end example
+@end itemize
+
+@subsubheading Alternate argument syntax
+It is also possible to specify arguments in a potentially more natural way
+using the @code{#+source:} line of a code block.  As in the following
+example arguments can be packed inside of parenthesis, separated by commas,
+following the source name.
+
+@example
+#+source: double(input=0, x=2)
+#+begin_src emacs-lisp
+(* 2 (+ input x))
+#+end_src
+@end example
+
+@subsubheading Indexable variable values
+It is possible to reference portions of variable values by ``indexing'' into
+the variables.  Indexes are 0 based with negative values counting back from
+the end.  If an index is separated by @code{,}s then each subsequent section
+will index into the next deepest nesting or dimension of the value.  The
+following example assigns the last cell of the first row the table
+@code{example-table} to the variable @code{data}:
+
+@example
+#+results: example-table
+| 1 | a |
+| 2 | b |
+| 3 | c |
+| 4 | d |
+
+#+begin_src emacs-lisp :var data=example-table[0,-1]
+  data
+#+end_src
+
+#+results:
+: a
+@end example
+
+Ranges of variable values can be referenced using two integers separated by a
+@code{:}, in which case the entire inclusive range is referenced.  For
+example the following assigns the middle three rows of @code{example-table}
+to @code{data}.
+
+@example
+#+results: example-table
+| 1 | a |
+| 2 | b |
+| 3 | c |
+| 4 | d |
+| 5 | 3 |
+
+#+begin_src emacs-lisp :var data=example-table[1:3]
+  data
+#+end_src
+
+#+results:
+| 2 | b |
+| 3 | c |
+| 4 | d |
+@end example
+
+Additionally, an empty index, or the single character @code{*}, are both
+interpreted to mean the entire range and as such are equivalent to
+@code{0:-1}, as shown in the following example in which the entire first
+column is referenced.
+
+@example
+#+results: example-table
+| 1 | a |
+| 2 | b |
+| 3 | c |
+| 4 | d |
+
+#+begin_src emacs-lisp :var data=example-table[,0]
+  data
+#+end_src
+
+#+results:
+| 1 | 2 | 3 | 4 |
+@end example
+
+It is possible to index into the results of code blocks as well as tables.
+Any number of dimensions can be indexed.  Dimensions are separated from one
+another by commas, as shown in the following example.
+
+@example
+#+source: 3D
+#+begin_src emacs-lisp
+  '(((1  2  3)  (4  5  6)  (7  8  9))
+    ((10 11 12) (13 14 15) (16 17 18))
+    ((19 20 21) (22 23 24) (25 26 27)))
+#+end_src
+
+#+begin_src emacs-lisp :var data=3D[1,,1]
+  data
+#+end_src
+
+#+results:
+| 11 | 14 | 17 |
+@end example
+
+@node results, file, var, Specific header arguments
+@subsubsection @code{:results}
+
+There are three classes of @code{:results} header argument.  Only one option of
+each type may be supplied per code block.
+
+@itemize @bullet
+@item
+@b{collection} header arguments specify how the results should be collected
+from the code block
+@item
+@b{type} header arguments specify what type of result the code block will
+return---which has implications for how they will be inserted into the
+Org-mode buffer
+@item
+@b{handling} header arguments specify how the results of evaluating the code
+block should be handled.
+@end itemize
+
+@subsubheading Collection
+The following options are mutually exclusive, and specify how the results
+should be collected from the code block.
+
+@itemize @bullet
+@item @code{value}
+This is the default.  The result is the value of the last statement in the
+code block.  This header argument places the evaluation in functional
+mode.  Note that in some languages, e.g., python, use of this result type
+requires that a @code{return} statement be included in the body of the source
+code block. E.g., @code{:results value}.
+@item @code{output}
+The result is the collection of everything printed to STDOUT during the
+execution of the code block.  This header argument places the
+evaluation in scripting mode.  E.g., @code{:results output}.
+@end itemize
+
+@subsubheading Type
+
+The following options are mutually exclusive and specify what type of results
+the code block will return.  By default, results are inserted as either a
+table or scalar depending on their value.
+
+@itemize @bullet
+@item @code{table}, @code{vector}
+The results should be interpreted as an Org-mode table.  If a single value is
+returned, it will be converted into a table with one row and one column.
+E.g., @code{:results value table}.
+@item @code{scalar}, @code{verbatim}
+The results should be interpreted literally---they will not be
+converted into a table.  The results will be inserted into the Org-mode
+buffer as quoted text.  E.g., @code{:results value verbatim}.
+@item @code{file}
+The results will be interpreted as the path to a file, and will be inserted
+into the Org-mode buffer as a file link.  E.g., @code{:results value file}.
+@item @code{raw}, @code{org}
+The results are interpreted as raw Org-mode code and are inserted directly
+into the buffer.  If the results look like a table they will be aligned as
+such by Org-mode.  E.g., @code{:results value raw}.
+@item @code{html}
+Results are assumed to be HTML and will be enclosed in a @code{begin_html}
+block.  E.g., @code{:results value html}.
+@item @code{latex}
+Results assumed to be LaTeX and are enclosed in a @code{begin_latex} block.
+E.g., @code{:results value latex}.
+@item @code{code}
+Result are assumed to be parseable code and are enclosed in a code block.
+E.g., @code{:results value code}.
+@item @code{pp}
+The result is converted to pretty-printed code and is enclosed in a code
+block.  This option currently supports Emacs Lisp, python, and ruby.  E.g.,
+@code{:results value pp}.
+@end itemize
+
+@subsubheading Handling
+The following results options indicate what happens with the
+results once they are collected.
+
+@itemize @bullet
+@item @code{silent}
+The results will be echoed in the minibuffer but will not be inserted into
+the Org-mode buffer.  E.g., @code{:results output silent}.
+@item @code{replace}
+The default value.  Any existing results will be removed, and the new results
+will be inserted into the Org-mode buffer in their place.  E.g.,
+@code{:results output replace}.
+@item @code{append}
+If there are pre-existing results of the code block then the new results will
+be appended to the existing results.  Otherwise the new results will be
+inserted as with @code{replace}.
+@item @code{prepend}
+If there are pre-existing results of the code block then the new results will
+be prepended to the existing results.  Otherwise the new results will be
+inserted as with @code{replace}.
+@end itemize
+
+@node file, dir, results, Specific header arguments
+@subsubsection @code{:file}
+
+The header argument @code{:file} is used to specify a path for file output.
+An Org-mode style @code{file:} link is inserted into the buffer as the result
+(see @ref{Link format}). Common examples are graphical output from R,
+gnuplot, ditaa and LaTeX code blocks.
+
+Note that for some languages, including R, gnuplot, LaTeX and ditaa,
+graphical output is sent to the specified file without the file being
+referenced explicitly in the code block. See the documentation for the
+individual languages for details. In contrast, general purpose languages such
+as python and ruby require that the code explicitly create output
+corresponding to the path indicated by @code{:file}.
+
+
+@node dir, exports, file, Specific header arguments
+@subsubsection @code{:dir} and remote execution
+
+While the @code{:file} header argument can be used to specify the path to the
+output file, @code{:dir} specifies the default directory during code block
+execution. If it is absent, then the directory associated with the current
+buffer is used. In other words, supplying @code{:dir path} temporarily has
+the same effect as changing the current directory with @kbd{M-x cd path}, and
+then not supplying @code{:dir}. Under the surface, @code{:dir} simply sets
+the value of the Emacs variable @code{default-directory}.
+
+When using @code{:dir}, you should supply a relative path for file output
+(e.g. @code{:file myfile.jpg} or @code{:file results/myfile.jpg}) in which
+case that path will be interpreted relative to the default directory.
+
+In other words, if you want your plot to go into a folder called Work in your
+home directory, you could use
+
+@example
+#+begin_src R :file myplot.png :dir ~/Work
+matplot(matrix(rnorm(100), 10), type="l")
+#+end_src
+@end example
+
+@subsubheading Remote execution
+A directory on a remote machine can be specified using tramp file syntax, in
+which case the code will be evaluated on the remote machine. An example is
+
+@example
+#+begin_src R :file plot.png :dir /dand@@yakuba.princeton.edu:
+plot(1:10, main=system("hostname", intern=TRUE))
+#+end_src
+@end example
+
+Text results will be returned to the local Org-mode buffer as usual, and file
+output will be created on the remote machine with relative paths interpreted
+relative to the remote directory. An Org-mode link to the remote file will be
+created.
+
+So, in the above example a plot will be created on the remote machine,
+and a link of the following form will be inserted in the org buffer:
+
+@example
+[[file:/scp:dand@@yakuba.princeton.edu:/home/dand/plot.png][plot.png]]
+@end example
+
+Most of this functionality follows immediately from the fact that @code{:dir}
+sets the value of the Emacs variable @code{default-directory}, thanks to
+tramp. Those using XEmacs, or GNU Emacs prior to version 23 may need to
+install tramp separately in order for the these features to work correctly.
+
+@subsubheading Further points
+
+@itemize @bullet
+@item
+If @code{:dir} is used in conjunction with @code{:session}, although it will
+determine the starting directory for a new session as expected, no attempt is
+currently made to alter the directory associated with an existing session.
+@item
+@code{:dir} should typically not be used to create files during export with
+@code{:exports results} or @code{:exports both}. The reason is that, in order
+to retain portability of exported material between machines, during export
+links inserted into the buffer will *not* be expanded against @code{default
+directory}. Therefore, if @code{default-directory} is altered using
+@code{:dir}, it is probable that the file will be created in a location to
+which the link does not point.
+@end itemize
+
+@node exports, tangle, dir, Specific header arguments
+@subsubsection @code{:exports}
+
+The @code{:exports} header argument specifies what should be included in HTML
+or LaTeX exports of the Org-mode file.
+
+@itemize @bullet
+@item @code{code}
+The default.  The body of code is included into the exported file.  E.g.,
+@code{:exports code}.
+@item @code{results}
+The result of evaluating the code is included in the exported file. E.g.,
+@code{:exports results}.
+@item @code{both}
+Both the code and results are included in the exported file. E.g.,
+@code{:exports both}.
+@item @code{none}
+Nothing is included in the exported file.  E.g., @code{:exports none}.
+@end itemize
+
+@node tangle, comments, exports, Specific header arguments
+@subsubsection @code{:tangle}
+
+The @code{:tangle} header argument specifies whether or not the code
+block should be included in tangled extraction of source code files.
+
+@itemize @bullet
+@item @code{yes}
+The code block is exported to a source code file named after the
+basename (name w/o extension) of the Org-mode file.  E.g., @code{:tangle
+yes}.
+@item @code{no}
+The default.  The code block is not exported to a source code file.
+E.g., @code{:tangle no}.
+@item other
+Any other string passed to the @code{:tangle} header argument is interpreted
+as a file basename to which the block will be exported.  E.g., @code{:tangle
+basename}.
+@end itemize
+
+@node comments, no-expand, tangle, Specific header arguments
+@subsubsection @code{:comments}
+By default code blocks are tangled to source-code files without any insertion
+of comments beyond those which may already exist in the body of the code
+block.  The @code{:comments} header argument can be set to ``yes''
+e.g. @code{:comments yes} to enable the insertion of comments around code
+blocks during tangling.  The inserted comments contain pointers back to the
+original Org file from which the comment was tangled.
+
+@node no-expand, session, comments, Specific header arguments
+@subsubsection @code{:no-expand}
+
+By default, code blocks are expanded with @code{org-babel-expand-src-block}
+during tangling.  This has the effect of assigning values to variables
+specified with @code{:var} (see @ref{var}), and of replacing ``noweb''
+references (see @ref{Noweb reference syntax}) with their targets.  The
+@code{:no-expand} header argument can be used to turn off this behavior.
+
+@node session, noweb, no-expand, Specific header arguments
+@subsubsection @code{:session}
+
+The @code{:session} header argument starts a session for an interpreted
+language where state is preserved.
+
+By default, a session is not started.
+
+A string passed to the @code{:session} header argument will give the session
+a name.  This makes it possible to run concurrent sessions for each
+interpreted language.
+
+@node noweb, cache, session, Specific header arguments
+@subsubsection @code{:noweb}
+
+The @code{:noweb} header argument controls expansion of ``noweb'' style (see
+@ref{Noweb reference syntax}) references in a code block.  This header
+argument can have one of two values: @code{yes} or @code{no}.
+
+@itemize @bullet
+@item @code{no}
+The default.  No ``noweb'' syntax specific action is taken on evaluating
+code blocks, However, noweb references will still be expanded during
+tangling.
+@item @code{yes}
+All ``noweb'' syntax references in the body of the code block will be
+expanded before the block is evaluated.
+@end itemize
+
+@subsubheading Noweb prefix lines
+Noweb insertions are now placed behind the line prefix of the
+@code{<<reference>>}.
+This behavior is illustrated in the following example.  Because the
+@code{<<example>>} noweb reference appears behind the SQL comment syntax,
+each line of the expanded noweb reference will be commented.
+
+This code block:
+
+@example
+-- <<example>>
+@end example
+
+
+expands to:
+
+@example
+-- this is the
+-- multi-line body of example
+@end example
+
+Note that noweb replacement text that does not contain any newlines will not
+be affected by this change, so it is still possible to use inline noweb
+references.
+
+@node cache, hlines, noweb, Specific header arguments
+@subsubsection @code{:cache}
+
+The @code{:cache} header argument controls the use of in-buffer caching of
+the results of evaluating code blocks.  It can be used to avoid re-evaluating
+unchanged code blocks.  This header argument can have one of two
+values: @code{yes} or @code{no}.
+
+@itemize @bullet
+@item @code{no}
+The default.  No caching takes place, and the code block will be evaluated
+every time it is called.
+@item @code{yes}
+Every time the code block is run a sha1 hash of the code and arguments
+passed to the block will be generated.  This hash is packed into the
+@code{#+results:} line and will be checked on subsequent
+executions of the code block.  If the code block has not
+changed since the last time it was evaluated, it will not be re-evaluated.
+@end itemize
+
+@node hlines, colnames, cache, Specific header arguments
+@subsubsection @code{:hlines}
+
+Tables are frequently represented with one or more horizontal lines, or
+hlines.  The @code{:hlines} argument to a code block accepts the
+values @code{yes} or @code{no}, with a default value of @code{no}.
+
+@itemize @bullet
+@item @code{no}
+Strips horizontal lines from the input table.  In most languages this is the
+desired effect because an @code{hline} symbol is interpreted as an unbound
+variable and raises an error.  Setting @code{:hlines no} or relying on the
+default value yields the following results.
+
+@example
+#+tblname: many-cols
+| a | b | c |
+|---+---+---|
+| d | e | f |
+|---+---+---|
+| g | h | i |
+
+#+source: echo-table
+#+begin_src python :var tab=many-cols
+  return tab
+#+end_src
+
+#+results: echo-table
+| a | b | c |
+| d | e | f |
+| g | h | i |
+@end example
+
+@item @code{yes}
+Leaves hlines in the table. Setting @code{:hlines yes} has this effect.
+
+@example
+#+tblname: many-cols
+| a | b | c |
+|---+---+---|
+| d | e | f |
+|---+---+---|
+| g | h | i |
+
+#+source: echo-table
+#+begin_src python :var tab=many-cols :hlines yes
+  return tab
+#+end_src
+
+#+results: echo-table
+| a | b | c |
+|---+---+---|
+| d | e | f |
+|---+---+---|
+| g | h | i |
+@end example
+@end itemize
+
+@node colnames, rownames, hlines, Specific header arguments
+@subsubsection @code{:colnames}
+
+The @code{:colnames} header argument accepts the values @code{yes},
+@code{no}, or @code{nil} for unassigned.  The default value is @code{nil}.
+
+@itemize @bullet
+@item @code{nil}
+If an input table looks like it has column names
+(because its second row is an hline), then the column
+names will be removed from the table before
+processing, then reapplied to the results.
+
+@example
+#+tblname: less-cols
+| a |
+|---|
+| b |
+| c |
+
+#+srcname: echo-table-again
+#+begin_src python :var tab=less-cols
+  return [[val + '*' for val in row] for row in tab]
+#+end_src
+
+#+results: echo-table-again
+| a  |
+|----|
+| b* |
+| c* |
+@end example
+
+@item @code{no}
+No column name pre-processing takes place
+
+@item @code{yes}
+Column names are removed and reapplied as with @code{nil} even if the table
+does not ``look like'' it has column names (i.e. the second row is not an
+hline)
+@end itemize
+
+@node rownames, shebang, colnames, Specific header arguments
+@subsubsection @code{:rownames}
+
+The @code{:rownames} header argument can take on the values @code{yes}
+or @code{no}, with a default value of @code{no}.
+
+@itemize @bullet
+@item @code{no}
+No row name pre-processing will take place.
+
+@item @code{yes}
+The first column of the table is removed from the table before processing,
+and is then reapplied to the results.
+
+@example
+#+tblname: with-rownames
+| one | 1 | 2 | 3 | 4 |  5 |
+| two | 6 | 7 | 8 | 9 | 10 |
+
+#+srcname: echo-table-once-again
+#+begin_src python :var tab=with-rownames :rownames yes
+  return [[val + 10 for val in row] for row in tab]
+#+end_src
+
+#+results: echo-table-once-again
+| one | 11 | 12 | 13 | 14 | 15 |
+| two | 16 | 17 | 18 | 19 | 20 |
+@end example
+@end itemize
+
+@node shebang, eval, rownames, Specific header arguments
+@subsubsection @code{:shebang}
+
+Setting the @code{:shebang} header argument to a string value
+(e.g. @code{:shebang "#!/bin/bash"}) causes the string to be inserted as the
+first line of any tangled file holding the code block, and the file
+permissions of the tangled file are set to make it executable.
+
+@node eval, , shebang, Specific header arguments
+@subsubsection @code{:eval}
+The @code{:eval} header argument can be used to limit the evaluation of
+specific code blocks.  @code{:eval} accepts two arguments ``never'' and
+``query''.  @code{:eval never} will ensure that a code block is never
+evaluated, this can be useful for protecting against the evaluation of
+dangerous code blocks.  @code{:eval query} will require a query for every
+execution of a code block regardless of the value of the
+@code{org-confirm-babel-evaluate} variable.
+
+@node Results of evaluation, Noweb reference syntax, Header arguments, Working With Source Code
+@section Results of evaluation
+@cindex code block, results of evaluation
+@cindex source code, results of evaluation
+
+The way in which results are handled depends on whether a session is invoked,
+as well as on whether @code{:results value} or @code{:results output} is
+used. The following table shows the possibilities:
+
+@multitable @columnfractions 0.26 0.33 0.41
+@item @tab @b{Non-session} @tab @b{Session}
+@item @code{:results value} @tab value of last expression @tab value of last expression
+@item @code{:results output} @tab contents of STDOUT @tab concatenation of interpreter output
+@end multitable
+
+Note: With @code{:results value}, the result in both @code{:session} and
+non-session is returned to Org-mode as a table (a one- or two-dimensional
+vector of strings or numbers) when appropriate.
+
+@subsection Non-session
+@subsubsection @code{:results value}
+This is the default. Internally, the value is obtained by wrapping the code
+in a function definition in the external language, and evaluating that
+function. Therefore, code should be written as if it were the body of such a
+function. In particular, note that python does not automatically return a
+value from a function unless a @code{return} statement is present, and so a
+@samp{return} statement will usually be required in python.
+
+This is the only one of the four evaluation contexts in which the code is
+automatically wrapped in a function definition.
+
+@subsubsection @code{:results output}
+The code is passed to the interpreter as an external process, and the
+contents of the standard output stream are returned as text. (In certain
+languages this also contains the error output stream; this is an area for
+future work.)
+
+@subsection @code{:session}
+@subsubsection @code{:results value}
+The code is passed to the interpreter running as an interactive Emacs
+inferior process. The result returned is the result of the last evaluation
+performed by the interpreter. (This is obtained in a language-specific
+manner: the value of the variable @code{_} in python and ruby, and the value
+of @code{.Last.value} in R).
+
+@subsubsection @code{:results output}
+The code is passed to the interpreter running as an interactive Emacs
+inferior process. The result returned is the concatenation of the sequence of
+(text) output from the interactive interpreter. Notice that this is not
+necessarily the same as what would be sent to @code{STDOUT} if the same code
+were passed to a non-interactive interpreter running as an external
+process. For example, compare the following two blocks:
+
+@example
+#+begin_src python :results output
+ print "hello"
+ 2
+ print "bye"
+#+end_src
+
+#+resname:
+: hello
+: bye
+@end example
+
+In non-session mode, the '2' is not printed and does not appear.
+@example
+#+begin_src python :results output :session
+ print "hello"
+ 2
+ print "bye"
+#+end_src
+
+#+resname:
+: hello
+: 2
+: bye
+@end example
+
+But in @code{:session} mode, the interactive interpreter receives input '2'
+and prints out its value, '2'. (Indeed, the other print statements are
+unnecessary here).
+
+@node Noweb reference syntax, Key bindings and useful functions, Results of evaluation, Working With Source Code
+@section Noweb reference syntax
+@cindex code block, noweb reference
+@cindex syntax, noweb
+@cindex source code, noweb reference
+
+The ``noweb'' (see @uref{http://www.cs.tufts.edu/~nr/noweb/}) Literate
+Programming system allows named blocks of code to be referenced by using the
+familiar Noweb syntax:
+
+@example
+<<code-block-name>>
+@end example
+
+When a code block is tangled or evaluated, whether or not ``noweb''
+references are expanded depends upon the value of the @code{:noweb} header
+argument.  If @code{:noweb yes}, then a Noweb reference is expanded before
+evaluation.  If @code{:noweb no}, the default, then the reference is not
+expanded before evaluation.
+
+Note: the default value, @code{:noweb no}, was chosen to ensure that
+correct code is not broken in a language, such as Ruby, where
+@code{<<arg>>} is a syntactically valid construct.  If @code{<<arg>>} is not
+syntactically valid in languages that you use, then please consider setting
+the default value.
+
+@node Key bindings and useful functions, Batch execution, Noweb reference syntax, Working With Source Code
+@section Key bindings and useful functions
+@cindex code block, key bindings
+
+Many common Org-mode key sequences are re-bound depending on
+the context.
+
+Within a code block, the following key bindings
+are active:
+
+@multitable @columnfractions 0.25 0.75
+@kindex C-c C-c
+@item @kbd{C-c C-c} @tab org-babel-execute-src-block
+@kindex C-c C-o
+@item @kbd{C-c C-o} @tab org-babel-open-src-block-result
+@kindex C-up
+@item @kbd{C-@key{up}}    @tab org-babel-load-in-session
+@kindex M-down
+@item @kbd{M-@key{down}}  @tab org-babel-pop-to-session
+@end multitable
+
+In an Org-mode buffer, the following key bindings are active:
+
+@multitable @columnfractions 0.45 0.55
+@kindex C-c C-v a
+@kindex C-c C-v C-a
+@item @kbd{C-c C-v a} @ @ @r{or} @ @ @kbd{C-c C-v C-a} @tab org-babel-sha1-hash
+@kindex C-c C-v b
+@kindex C-c C-v C-b
+@item @kbd{C-c C-v b} @ @ @r{or} @ @ @kbd{C-c C-v C-b} @tab org-babel-execute-buffer
+@kindex C-c C-v f
+@kindex C-c C-v C-f
+@item @kbd{C-c C-v f} @ @ @r{or} @ @ @kbd{C-c C-v C-f} @tab org-babel-tangle-file
+@kindex C-c C-v g
+@item @kbd{C-c C-v g} @tab org-babel-goto-named-source-block
+@kindex C-c C-v h
+@item @kbd{C-c C-v h} @tab org-babel-describe-bindings
+@kindex C-c C-v l
+@kindex C-c C-v C-l
+@item @kbd{C-c C-v l} @ @ @r{or} @ @ @kbd{C-c C-v C-l} @tab org-babel-lob-ingest
+@kindex C-c C-v p
+@kindex C-c C-v C-p
+@item @kbd{C-c C-v p} @ @ @r{or} @ @ @kbd{C-c C-v C-p} @tab org-babel-expand-src-block
+@kindex C-c C-v s
+@kindex C-c C-v C-s
+@item @kbd{C-c C-v s} @ @ @r{or} @ @ @kbd{C-c C-v C-s} @tab org-babel-execute-subtree
+@kindex C-c C-v t
+@kindex C-c C-v C-t
+@item @kbd{C-c C-v t} @ @ @r{or} @ @ @kbd{C-c C-v C-t} @tab org-babel-tangle
+@kindex C-c C-v z
+@kindex C-c C-v C-z
+@item @kbd{C-c C-v z} @ @ @r{or} @ @ @kbd{C-c C-v C-z} @tab org-babel-switch-to-session
+@end multitable
+
+@c When possible these keybindings were extended to work when the control key is
+@c kept pressed, resulting in the following additional keybindings.
+
+@c @multitable @columnfractions 0.25 0.75
+@c @item @kbd{C-c C-v C-a} @tab org-babel-sha1-hash
+@c @item @kbd{C-c C-v C-b} @tab org-babel-execute-buffer
+@c @item @kbd{C-c C-v C-f} @tab org-babel-tangle-file
+@c @item @kbd{C-c C-v C-l} @tab org-babel-lob-ingest
+@c @item @kbd{C-c C-v C-p} @tab org-babel-expand-src-block
+@c @item @kbd{C-c C-v C-s} @tab org-babel-execute-subtree
+@c @item @kbd{C-c C-v C-t} @tab org-babel-tangle
+@c @item @kbd{C-c C-v C-z} @tab org-babel-switch-to-session
+@c @end multitable
+
+@node Batch execution,  , Key bindings and useful functions, Working With Source Code
+@section Batch execution
+@cindex code block, batch execution
+@cindex source code, batch execution
+
+It is possible to call functions from the command line.  This shell
+script calls @code{org-babel-tangle} on every one of its arguments.
+
+Be sure to adjust the paths to fit your system.
+
+@example
+#!/bin/sh
+# -*- mode: shell-script -*-
+#
+# tangle a file with org-mode
+#
+DIR=`pwd`
+FILES=""
+
+# wrap each argument in the code required to call tangle on it
+for i in $@@; do
+FILES="$FILES \"$i\""
+done
+
+emacsclient \
+--eval "(progn
+(add-to-list 'load-path (expand-file-name \"~/src/org/lisp/\"))
+(add-to-list 'load-path (expand-file-name \"~/src/org/contrib/lisp/\"))
+(require 'org)(require 'org-exp)(require 'ob)(require 'ob-tangle)
+(mapc (lambda (file)
+       (find-file (expand-file-name file \"$DIR\"))
+       (org-babel-tangle)
+       (kill-buffer)) '($FILES)))"
+@end example
+
+@node Miscellaneous, Hacking, Working With Source Code, Top
+@chapter Miscellaneous
+
+@menu
+* Completion::                 M-TAB knows what you need
+* Speed keys::                 Electric commands at the beginning of a headline
+* Code evaluation security::   Org mode files evaluate inline code
+* Customization::              Adapting Org to your taste
+* In-buffer settings::         Overview of the #+KEYWORDS
+* The very busy C-c C-c key::  When in doubt, press C-c C-c
+* Clean view::                 Getting rid of leading stars in the outline
+* TTY keys::                   Using Org on a tty
+* Interaction::                        Other Emacs packages
+@end menu
+
+
+@node Completion, Speed keys, Miscellaneous, Miscellaneous
+@section Completion
+@cindex completion, of @TeX{} symbols
+@cindex completion, of TODO keywords
+@cindex completion, of dictionary words
 @cindex completion, of option keywords
 @cindex completion, of tags
 @cindex completion, of property keys
@@ -10387,7 +12355,7 @@ buffer.
 After @samp{[}, complete link abbreviations (@pxref{Link abbreviations}).
 @item
 After @samp{#+}, complete the special keywords like @samp{TYP_TODO} or
-@samp{OPTIONS} which set file-specific options for Org mode.  When the
+@samp{OPTIONS} which set file-specific options for Org-mode.  When the
 option keyword is already complete, pressing @kbd{M-@key{TAB}} again
 will insert example settings for this keyword.
 @item
@@ -10398,7 +12366,7 @@ Elsewhere, complete dictionary words using Ispell.
 @end itemize
 @end table
 
-@node Speed keys, Customization, Completion, Miscellaneous
+@node Speed keys, Code evaluation security, Completion, Miscellaneous
 @section Speed keys
 @cindex speed keys
 @vindex org-use-speed-commands
@@ -10416,7 +12384,62 @@ or on a small mobile device with a limited keyboard.
 To see which commands are available, activate the feature and press @kbd{?}
 with the cursor at the beginning of a headline.
 
-@node Customization, In-buffer settings, Speed keys, Miscellaneous
+@node Code evaluation security, Customization, Speed keys, Miscellaneous
+@section Code evaluation and security issues
+
+Org provides tool to work with the code snippets, including evaluating them.
+
+Running code on your machine always comes with a security risk.  Badly
+written or malicious code can be executed on purpose or by accident.  Org has
+default settings which will only evaluate such code if you give explicit
+permission to do so, and as a casual user of these features you should leave
+these precautions intact.
+
+For people who regularly work with such code, the confirmation prompts can
+become annoying, and you might want to turn them off.  This can be done, but
+you must be aware of the risks that are involved.
+
+Code evaluation can happen under the following circumstances:
+
+@table @i
+@item Source code blocks
+Source code blocks can be evaluated during export, or when pressing @kbd{C-c
+C-c} in the block.  The most important thing to realize here is that Org mode
+files which contain code snippets are in a certain sense like executable
+files.  So you should accept them and load them into Emacs only from trusted
+sources - just like you would do with a program you install on your computer.
+
+Make sure you know what you are doing before customizing the variables
+which take of the default security brakes.
+
+@defopt org-confirm-babel-evaluate
+When set to t user is queried before code block evaluation
+@end defopt
+
+@item Following @code{shell} and @code{elisp} links
+Org has two link types that can directly evaluate code (@pxref{External
+links}).  These links can be problematic because the code to be evaluated his
+not visible.
+
+@defopt org-confirm-shell-link-function
+Function to queries user about shell link execution.
+@end defopt
+@defopt org-confirm-elisp-link-function
+Functions to query user for Emacs Lisp link execution.
+@end defopt
+
+@item Following @code{shell} and @code{elisp} links
+Org has two link types that can directly evaluate code (@pxref{External
+links}).  These links can be problematic because the code to be evaluated his
+not visible.  @b{Security advice:}  Do not use these links, use source code
+blocks which make the associated actions much more transparent.
+
+@item Formulas in tables
+Formulas in tables (@pxref{The spreadsheet}) are code that is evaluated
+either by the @i{calc} interpreter, or by the @i{Emacs Lisp} interpreter.
+@end table
+
+@node Customization, In-buffer settings, Code evaluation security, Miscellaneous
 @section Customization
 @cindex customization
 @cindex options, for customization
@@ -10435,7 +12458,7 @@ lines into the buffer (@pxref{In-buffer settings}).
 @cindex in-buffer settings
 @cindex special keywords
 
-Org mode uses special lines in the buffer to define settings on a
+Org-mode uses special lines in the buffer to define settings on a
 per-file basis.  These lines start with a @samp{#+} followed by a
 keyword, a colon, and then individual words defining a setting.  Several
 setting words can be in the same line, but you can also have multiple
@@ -10494,14 +12517,14 @@ buffer, most useful for specifying the allowed values of a property.
 @item #+SETUPFILE: file
 This line defines a file that holds more in-buffer setup.  Normally this is
 entirely ignored.  Only when the buffer is parsed for option-setting lines
-(i.e. when starting Org mode for a file, when pressing @kbd{C-c C-c} in a
+(i.e. when starting Org-mode for a file, when pressing @kbd{C-c C-c} in a
 settings line, or when exporting), then the contents of this file are parsed
 as if they had been included in the buffer.  In particular, the file can be
-any other Org mode file with internal setup.  You can visit the file the
+any other Org-mode file with internal setup.  You can visit the file the
 cursor is in the line with @kbd{C-c '}.
 @item #+STARTUP:
 @cindex #+STARTUP:
-This line sets options to be used at startup of Org mode, when an
+This line sets options to be used at startup of Org-mode, when an
 Org file is being visited.
 
 The first set of options deals with the initial visibility of the outline
@@ -10561,6 +12584,9 @@ configured using these options (see variables @code{org-log-done},
 @cindex @code{logredeadline}, STARTUP keyword
 @cindex @code{lognoteredeadline}, STARTUP keyword
 @cindex @code{nologredeadline}, STARTUP keyword
+@cindex @code{logrefile}, STARTUP keyword
+@cindex @code{lognoterefile}, STARTUP keyword
+@cindex @code{nologrefile}, STARTUP keyword
 @example
 logdone            @r{record a timestamp when an item is marked DONE}
 lognotedone        @r{record timestamp and a note when DONE}
@@ -10576,6 +12602,9 @@ nologreschedule    @r{do not record when a scheduling date changes}
 logredeadline      @r{record a timestamp when deadline changes}
 lognoteredeadline  @r{record a note when deadline changes}
 nologredeadline    @r{do not record when a deadline date changes}
+logrefile          @r{record a timestamp when refiling}
+lognoterefile      @r{record a note when refiling}
+nologrefile        @r{do not record when refiling}
 @end example
 @vindex org-hide-leading-stars
 @vindex org-odd-levels-only
@@ -10648,6 +12677,15 @@ To hide blocks on startup, use these keywords. The corresponding variable is
 hideblocks   @r{Hide all begin/end blocks on startup}
 nohideblocks @r{Do not hide blocks on startup}
 @end example
+@cindex org-pretty-entities
+The the display of entities as UTF8 characters is governed by the variable
+@code{org-pretty-entities} and the keywords
+@cindex @code{entitiespretty}, STARTUP keyword
+@cindex @code{entitiesplain}, STARTUP keyword
+@example
+entitiespretty  @r{Show entities as UTF8 characters where possible}
+entitiesplain   @r{Leave entities plain}
+@end example
 @item #+TAGS:  TAG1(c1) TAG2(c2)
 @vindex org-tag-alist
 These lines (several such lines are allowed) specify the valid tags in
@@ -10656,8 +12694,8 @@ keys.  The corresponding variable is @code{org-tag-alist}.
 @item #+TBLFM:
 This line contains the formulas for the table directly above the line.
 @item #+TITLE:, #+AUTHOR:, #+EMAIL:, #+LANGUAGE:, #+TEXT:, #+DATE:,
-@itemx #+OPTIONS:, #+BIND:
-@itemx #+DESCRIPTION:, #+KEYWORDS:
+@itemx #+OPTIONS:, #+BIND:, #+XSLT:,
+@itemx #+DESCRIPTION:, #+KEYWORDS:,
 @itemx #+LATEX_HEADER:, #+STYLE:, #+LINK_UP:, #+LINK_HOME:,
 @itemx #+EXPORT_SELECT_TAGS:, #+EXPORT_EXCLUDE_TAGS:
 These lines provide settings for exporting files.  For more details see
@@ -10695,10 +12733,7 @@ works even if the automatic table editor has been turned off.
 If the cursor is on a @code{#+TBLFM} line, re-apply the formulas to
 the entire table.
 @item
-If the cursor is inside a table created by the @file{table.el} package,
-activate that table.
-@item
-If the current buffer is a Remember buffer, close the note and file it.
+If the current buffer is a capture buffer, close the note and file it.
 With a prefix argument, file it, without further interaction, to the
 default location.
 @item
@@ -10749,19 +12784,24 @@ more text                        |          more text
 @end example
 
 @noindent
-If you are using at least Emacs 23.1.50.3 and version 6.29 of Org, this kind
-of view can be achieved dynamically at display time using
-@code{org-indent-mode}.  In this minor mode, all lines are prefixed for
-display with the necessary amount of space.  Also headlines are prefixed with
-additional stars, so that the amount of indentation shifts by
-two@footnote{See the variable @code{org-indent-indentation-per-level}.}
-spaces per level.  All headline stars but the last one are made invisible
-using the @code{org-hide} face@footnote{Turning on @code{org-indent-mode}
-sets @code{org-hide-leading-stars} to @code{t} and
-@code{org-adapt-indentation} to @code{nil}.} - see below under @samp{2.} for
-more information on how this works.  You can turn on @code{org-indent-mode}
-for all files by customizing the variable @code{org-startup-indented}, or you
-can turn it on for individual files using
+
+If you are using at least Emacs 23.2@footnote{Emacs 23.1 can actually crash
+with @code{org-indent-mode}} and version 6.29 of Org, this kind of view can
+be achieved dynamically at display time using @code{org-indent-mode}.  In
+this minor mode, all lines are prefixed for display with the necessary amount
+of space@footnote{@code{org-indent-mode} also sets the @code{wrap-prefix}
+property, such that @code{visual-line-mode} (or purely setting
+@code{word-wrap}) wraps long lines (including headlines) correctly indented.
+}.  Also headlines are prefixed with additional stars, so that the amount of
+indentation shifts by two@footnote{See the variable
+@code{org-indent-indentation-per-level}.}  spaces per level.  All headline
+stars but the last one are made invisible using the @code{org-hide}
+face@footnote{Turning on @code{org-indent-mode} sets
+@code{org-hide-leading-stars} to @code{t} and @code{org-adapt-indentation} to
+@code{nil}.} - see below under @samp{2.} for more information on how this
+works.  You can turn on @code{org-indent-mode} for all files by customizing
+the variable @code{org-startup-indented}, or you can turn it on for
+individual files using
 
 @example
 #+STARTUP: indent
@@ -10859,16 +12899,16 @@ is really only fun with @kbd{S-@key{cursor}} keys, whereas on a
 tty you would rather use @kbd{C-c .} to re-insert the timestamp.
 
 @multitable @columnfractions 0.15 0.2 0.1 0.2
-@item @b{Default} @tab @b{Alternative 1} @tab @b{Speed key} @tab @b{Alternative 2} 
-@item @kbd{S-@key{TAB}}     @tab @kbd{C-u @key{TAB}}       @tab @kbd{C} @tab                            
-@item @kbd{M-@key{left}}    @tab @kbd{C-c C-x l}           @tab @kbd{l} @tab @kbd{@key{Esc} @key{left}} 
-@item @kbd{M-S-@key{left}}  @tab @kbd{C-c C-x L}           @tab @kbd{L} @tab                            
+@item @b{Default} @tab @b{Alternative 1} @tab @b{Speed key} @tab @b{Alternative 2}
+@item @kbd{S-@key{TAB}}     @tab @kbd{C-u @key{TAB}}       @tab @kbd{C} @tab
+@item @kbd{M-@key{left}}    @tab @kbd{C-c C-x l}           @tab @kbd{l} @tab @kbd{@key{Esc} @key{left}}
+@item @kbd{M-S-@key{left}}  @tab @kbd{C-c C-x L}           @tab @kbd{L} @tab
 @item @kbd{M-@key{right}}   @tab @kbd{C-c C-x r}           @tab @kbd{r} @tab @kbd{@key{Esc} @key{right}}
-@item @kbd{M-S-@key{right}} @tab @kbd{C-c C-x R}           @tab @kbd{R} @tab                           
-@item @kbd{M-@key{up}}      @tab @kbd{C-c C-x u}           @tab @kbd{ } @tab @kbd{@key{Esc} @key{up}}  
-@item @kbd{M-S-@key{up}}    @tab @kbd{C-c C-x U}           @tab @kbd{U} @tab                           
+@item @kbd{M-S-@key{right}} @tab @kbd{C-c C-x R}           @tab @kbd{R} @tab
+@item @kbd{M-@key{up}}      @tab @kbd{C-c C-x u}           @tab @kbd{ } @tab @kbd{@key{Esc} @key{up}}
+@item @kbd{M-S-@key{up}}    @tab @kbd{C-c C-x U}           @tab @kbd{U} @tab
 @item @kbd{M-@key{down}}    @tab @kbd{C-c C-x d}           @tab @kbd{ } @tab @kbd{@key{Esc} @key{down}}
-@item @kbd{M-S-@key{down}}  @tab @kbd{C-c C-x D}           @tab @kbd{D} @tab                            
+@item @kbd{M-S-@key{down}}  @tab @kbd{C-c C-x D}           @tab @kbd{D} @tab
 @item @kbd{S-@key{RET}}     @tab @kbd{C-c C-x c}           @tab @kbd{ } @tab
 @item @kbd{M-@key{RET}}     @tab @kbd{C-c C-x m}           @tab @kbd{ } @tab @kbd{@key{Esc} @key{RET}}
 @item @kbd{M-S-@key{RET}}   @tab @kbd{C-c C-x M}           @tab @kbd{ } @tab
@@ -10888,8 +12928,8 @@ Org lives in the world of GNU Emacs and interacts in various ways
 with other code out there.
 
 @menu
-* Cooperation::                 Packages Org cooperates with
-* Conflicts::                   Packages that lead to conflicts
+* Cooperation::                        Packages Org cooperates with
+* Conflicts::                  Packages that lead to conflicts
 @end menu
 
 @node Cooperation, Conflicts, Interaction, Interaction
@@ -10924,11 +12964,11 @@ setup.  See the installation instructions in the file
 @item @file{cdlatex.el} by Carsten Dominik
 @cindex @file{cdlatex.el}
 @cindex Dominik, Carsten
-Org mode can make use of the CDLa@TeX{} package to efficiently enter
+Org-mode can make use of the CDLa@TeX{} package to efficiently enter
 La@TeX{} fragments into Org files.  See @ref{CDLaTeX mode}.
 @item @file{imenu.el} by Ake Stenhoff and Lars Lindberg
 @cindex @file{imenu.el}
-Imenu allows menu access to an index of items in a file.  Org mode
+Imenu allows menu access to an index of items in a file.  Org-mode
 supports Imenu---all you need to do to get the index is the following:
 @lisp
 (add-hook 'org-mode-hook
@@ -10940,13 +12980,12 @@ the option @code{org-imenu-depth}.
 @item @file{remember.el} by John Wiegley
 @cindex @file{remember.el}
 @cindex Wiegley, John
-Org cooperates with remember, see @ref{Remember}.
-@file{Remember.el} is not part of Emacs, find it on the web.
+Org used to use this package for capture, but no longer does.
 @item @file{speedbar.el} by Eric M. Ludlam
 @cindex @file{speedbar.el}
 @cindex Ludlam, Eric M.
 Speedbar is a package that creates a special frame displaying files and
-index items in files.  Org mode supports Speedbar and allows you to
+index items in files.  Org-mode supports Speedbar and allows you to
 drill into Org files directly from the Speedbar.  It also allows you to
 restrict the scope of agenda commands to a file or a subtree by using
 the command @kbd{<} in the Speedbar frame.
@@ -10957,20 +12996,18 @@ the command @kbd{<} in the Speedbar frame.
 @cindex @file{table.el}
 @cindex Ota, Takaaki
 
-Complex ASCII tables with automatic line wrapping, column- and
-row-spanning, and alignment can be created using the Emacs table
-package by Takaaki Ota (@uref{http://sourceforge.net/projects/table},
-and also part of Emacs 22).
-When @key{TAB} or @kbd{C-c C-c} is pressed in such a table, Org mode
-will call @command{table-recognize-table} and move the cursor into the
-table.  Inside a table, the keymap of Org mode is inactive.  In order
-to execute Org mode-related commands, leave the table.
+Complex ASCII tables with automatic line wrapping, column- and row-spanning,
+and alignment can be created using the Emacs table package by Takaaki Ota
+(@uref{http://sourceforge.net/projects/table}, and also part of Emacs 22).
+Org-mode will recognize these tables and export them properly.  Because of
+interference with other Org-mode functionality, you unfortunately cannot edit
+these tables directly in the buffer.  Instead, you need to use the command
+@kbd{C-c '} to edit them, similar to source code snippets.
 
 @table @kbd
-@kindex C-c C-c
-@item C-c C-c
-Recognize @file{table.el} table.  Works when the cursor is in a
-table.el table.
+@kindex C-c '
+@item C-c '
+Edit a @file{table.el} table.  Works when the cursor is in a table.el table.
 @c
 @kindex C-c ~
 @item C-c ~
@@ -10980,17 +13017,17 @@ format.  See the documentation string of the command
 @code{org-convert-table} for the restrictions under which this is
 possible.
 @end table
-@file{table.el} is part of Emacs 22.
+@file{table.el} is part of Emacs since Emacs 22.
 @item @file{footnote.el} by Steven L. Baur
 @cindex @file{footnote.el}
 @cindex Baur, Steven L.
-Org mode recognizes numerical footnotes as provided by this package.
-However, Org mode also has its own footnote support (@pxref{Footnotes}),
+Org-mode recognizes numerical footnotes as provided by this package.
+However, Org-mode also has its own footnote support (@pxref{Footnotes}),
 which makes using @file{footnote.el} unnecessary.
 @end table
 
 @node Conflicts,  , Cooperation, Interaction
-@subsection Packages that lead to conflicts with Org mode
+@subsection Packages that lead to conflicts with Org-mode
 
 @table @asis
 
@@ -11002,7 +13039,7 @@ This conflicts with the use of @kbd{S-@key{cursor}} commands in Org to change
 timestamps, TODO keywords, priorities, and item bullet types if the cursor is
 at such a location.  By default, @kbd{S-@key{cursor}} commands outside
 special contexts don't do anything, but you can customize the variable
-@code{org-support-shift-select}.  Org mode then tries to accommodate shift
+@code{org-support-shift-select}.  Org-mode then tries to accommodate shift
 selection by (i) using it outside of the special contexts where special
 commands apply, and by (ii) extending an existing active region even if the
 cursor moves across a special context.
@@ -11017,7 +13054,7 @@ region.  In fact, Emacs 23 has this built-in in the form of
 @code{shift-selection-mode}, see previous paragraph.  If you are using Emacs
 23, you probably don't want to use another package for this purpose.  However,
 if you prefer to leave these keys to a different package while working in
-Org mode, configure the variable @code{org-replace-disputed-keys}.  When set,
+Org-mode, configure the variable @code{org-replace-disputed-keys}.  When set,
 Org will move the following key bindings in Org files, and in the agenda
 buffer (but not during date selection).
 
@@ -11040,15 +13077,26 @@ fixed this problem:
 
 @lisp
 (add-hook 'org-mode-hook
-          (lambda ()
-            (org-set-local 'yas/trigger-key [tab])
-            (define-key yas/keymap [tab] 'yas/next-field-group)))
+         (lambda ()
+           (org-set-local 'yas/trigger-key [tab])
+           (define-key yas/keymap [tab] 'yas/next-field-group)))
 @end lisp
 
 @item @file{windmove.el} by Hovav Shacham
 @cindex @file{windmove.el}
 This package also uses the @kbd{S-<cursor>} keys, so everything written
-in the paragraph above about CUA mode also applies here.
+in the paragraph above about CUA mode also applies here.  If you want make
+the windmove function active in locations where Org-mode does not have
+special functionality on @kbd{S-@key{cursor}}, add this to your
+configuration:
+
+@lisp
+;; Make windmove work in org-mode:
+(add-hook 'org-shiftup-final-hook 'windmove-up)
+(add-hook 'org-shiftleft-final-hook 'windmove-left)
+(add-hook 'org-shiftdown-final-hook 'windmove-down)
+(add-hook 'org-shiftright-final-hook 'windmove-right)
+@end lisp
 
 @item @file{viper.el} by Michael Kifer
 @cindex @file{viper.el}
@@ -11073,16 +13121,16 @@ This appendix covers some aspects where users can extend the functionality of
 Org.
 
 @menu
-* Hooks::                       Who to reach into Org's internals
-* Add-on packages::             Available extensions
-* Adding hyperlink types::      New custom link types
-* Context-sensitive commands::  How to add functionality to such commands
-* Tables in arbitrary syntax::  Orgtbl for La@TeX{} and other programs
-* Dynamic blocks::              Automatically filled blocks
-* Special agenda views::        Customized views
+* Hooks::                      Who to reach into Org's internals
+* Add-on packages::            Available extensions
+* Adding hyperlink types::     New custom link types
+* Context-sensitive commands:: How to add functionality to such commands
+* Tables in arbitrary syntax:: Orgtbl for La@TeX{} and other programs
+* Dynamic blocks::             Automatically filled blocks
+* Special agenda views::       Customized views
 * Extracting agenda information::  Postprocessing of agenda information
-* Using the property API::      Writing programs that use entry properties
-* Using the mapping API::       Mapping over all or selected entries
+* Using the property API::     Writing programs that use entry properties
+* Using the mapping API::      Mapping over all or selected entries
 @end menu
 
 @node Hooks, Add-on packages, Hacking, Hacking
@@ -11101,7 +13149,7 @@ maintained by the Worg project and can be found at
 
 A large number of add-on packages have been written by various authors.
 These packages are not part of Emacs, but they are distributed as contributed
-packages with the separate release available at the Org mode home page at
+packages with the separate release available at the Org-mode home page at
 @uref{http://orgmode.org}.  The list of contributed packages, along with
 documentation about each package, is maintained by the Worg project at
 @uref{http://orgmode.org/worg/org-contrib/}.
@@ -11260,7 +13308,6 @@ hard to do in a general way, would lead to a customization nightmare,
 and would take away much of the simplicity of the Orgtbl-mode table
 editor.
 
-
 This appendix describes a different approach.  We keep the Orgtbl mode
 table in its native format (the @i{source table}), and use a custom
 function to @i{translate} the table to the correct syntax, and to
@@ -11268,17 +13315,17 @@ function to @i{translate} the table to the correct syntax, and to
 the burden of writing conversion functions on the user, but it allows
 for a very flexible system.
 
-Bastien added the ability to do the same with lists.  You can use Org's
-facilities to edit and structure lists by turning @code{orgstruct-mode}
-on, then locally exporting such lists in another format (HTML, La@TeX{}
-or Texinfo.)
+Bastien added the ability to do the same with lists, in Orgstruct mode.  You
+can use Org's facilities to edit and structure lists by turning
+@code{orgstruct-mode} on, then locally exporting such lists in another format
+(HTML, La@TeX{} or Texinfo.)
 
 
 @menu
-* Radio tables::                Sending and receiving radio tables
-* A LaTeX example::             Step by step, almost a tutorial
-* Translator functions::        Copy and modify
-* Radio lists::                 Doing the same for lists
+* Radio tables::               Sending and receiving radio tables
+* A LaTeX example::            Step by step, almost a tutorial
+* Translator functions::       Copy and modify
+* Radio lists::                        Doing the same for lists
 @end menu
 
 @node Radio tables, A LaTeX example, Tables in arbitrary syntax, Tables in arbitrary syntax
@@ -11532,7 +13579,7 @@ containing the formatted table.  If you write a generally useful
 translator, please post it on @email{emacs-orgmode@@gnu.org} so that
 others can benefit from your work.
 
-@node  Radio lists,  , Translator functions, Tables in arbitrary syntax
+@node Radio lists,  , Translator functions, Tables in arbitrary syntax
 @subsection Radio lists
 @cindex radio lists
 @cindex org-list-insert-radio-list
@@ -11546,7 +13593,9 @@ Here are the differences with radio tables:
 
 @itemize @minus
 @item
-Use @code{ORGLST} instead of @code{ORGTBL}.
+Orgstruct mode must be active.
+@item
+Use the @code{ORGLST} keyword instead of @code{ORGTBL}.
 @item
 The available translation functions for radio lists don't take
 parameters.
@@ -11557,12 +13606,12 @@ parameters.
 Here is a La@TeX{} example.  Let's say that you have this in your
 La@TeX{} file:
 
-@cindex #+ORGLIST
+@cindex #+ORGLST
 @example
 % BEGIN RECEIVE ORGLST to-buy
 % END RECEIVE ORGLST to-buy
 \begin@{comment@}
-#+ORGLIST: SEND to-buy orgtbl-to-latex
+#+ORGLST: SEND to-buy org-list-to-latex
 - a new house
 - a new computer
   + a new keyboard
@@ -11707,6 +13756,10 @@ Skip current entry if it has not been scheduled.
 Skip current entry if it has a deadline.
 @item '(org-agenda-skip-entry-if 'scheduled 'deadline)
 Skip current entry if it has a deadline, or if it is scheduled.
+@item '(org-agenda-skip-entry-if 'todo '("TODO" "WAITING"))
+Skip current entry if the TODO keyword is TODO or WAITING.
+@item '(org-agenda-skip-entry-if 'todo 'done)
+Skip current entry if the TODO keyword marks a DONE state.
 @item '(org-agenda-skip-entry-if 'timestamp)
 Skip current entry if it has any timestamp, may also be deadline or scheduled.
 @item '(org-agenda-skip-entry 'regexp "regular expression")
@@ -11900,6 +13953,15 @@ Treat the value of the property PROPERTY as a whitespace-separated list of
 values and check if VALUE is in this list.
 @end defun
 
+@defopt org-property-allowed-value-functions
+Hook for functions supplying allowed values for specific.
+The functions must take a single argument, the name of the property, and
+return a flat list of allowed values.  If @samp{:ETC} is one of
+the values, use the values as completion help, but allow also other values
+to be entered.  The functions must return @code{nil} if they are not
+responsible for this property.
+@end defopt
+
 @node Using the mapping API,  , Using the property API, Hacking
 @section Using the mapping API
 @cindex API, for mapping
@@ -12015,11 +14077,13 @@ The following example counts the number of entries with TODO keyword
 @cindex iPhone
 @cindex MobileOrg
 
-@i{MobileOrg} is an application for the @i{iPhone/iPod Touch} series of
-devices, developed by Richard Moreland.  @i{MobileOrg} offers offline viewing
-and capture support for an Org-mode system rooted on a ``real'' computer.  It
-does also allow you to record changes to existing entries.  For information
-about @i{MobileOrg}, see @uref{http://mobileorg.ncogni.to/}).
+@uref{http://mobileorg.ncogni.to/, MobileOrg} is an application for the
+@i{iPhone/iPod Touch} series of devices, developed by Richard Moreland.
+@i{MobileOrg} offers offline viewing and capture support for an Org-mode
+system rooted on a ``real'' computer.  It does also allow you to record
+changes to existing entries.  Android users should check out
+@uref{http://wiki.github.com/matburt/mobileorg-android/, MobileOrg Android}
+by Matt Jones.
 
 This appendix describes the support Org has for creating agenda views in a
 format that can be displayed by @i{MobileOrg}, and for integrating notes
@@ -12027,49 +14091,42 @@ captured and changes made by @i{MobileOrg} into the main system.
 
 For changing tags and TODO states in MobileOrg, you should have set up the
 customization variables @code{org-todo-keywords} and @code{org-tags-alist} to
-cover all important tags and todo keywords, even if individual files use only
+cover all important tags and TODO keywords, even if individual files use only
 part of these.  MobileOrg will also offer you states and tags set up with
-in-buffer settings, but it will understand the logistics of todo state
+in-buffer settings, but it will understand the logistics of TODO state
 @i{sets} (@pxref{Per-file keywords}) and @i{mutually exclusive} tags
 (@pxref{Setting tags}) only for those set in these variables.
 
 @menu
-* Setting up the staging area::  Where to interact with the mobile device
-* Pushing to MobileOrg::        Uploading Org files and agendas
-* Pulling from MobileOrg::      Integrating captured and flagged items
+* Setting up the staging area::         Where to interact with the mobile device
+* Pushing to MobileOrg::       Uploading Org files and agendas
+* Pulling from MobileOrg::     Integrating captured and flagged items
 @end menu
 
 @node Setting up the staging area, Pushing to MobileOrg, MobileOrg, MobileOrg
 @section Setting up the staging area
 
-Org-mode has commands to prepare a directory with files for @i{MobileOrg},
-and to read captured notes from there.  If Emacs can directly write to the
-WebDAV directory accessed by @i{MobileOrg}, just point to this directory
-using the variable @code{org-mobile-directory}.  Using the @file{tramp}
-method, @code{org-mobile-directory} may point to a remote directory
-accessible through, for example, 
-@file{ssh/scp}:
+MobileOrg needs to interact with Emacs through directory on a
+server@footnote{If you are using a public server, you might prefer to encrypt
+the files on the server.  This can be done with Org-mode 6.35 and, hopefully,
+with MobileOrg 1.4 (please check before trying to use this).  On the Emacs
+side, configure the variables @code{org-mobile-use-encryption} and
+@code{org-mobile-encryption-password}.}.  The easiest way to create that
+directory is to use a free @uref{http://dropbox.com,Dropbox.com}
+account@footnote{If you cannot use Dropbox, or if your version of MobileOrg
+does not support it, you can use a webdav server.  For more information,
+check out the the documentation of MobileOrg and also this
+@uref{http://orgmode.org/worg/org-faq.php#mobileorg_webdav, FAQ entry}.}.
+When MobileOrg first connects to your Dropbox, it will create a directory
+@i{MobileOrg} inside the Dropbox.  After the directory has been created, tell
+Emacs about it:
 
-@smallexample
-(setq org-mobile-directory "/scpc:user@@remote.host:org/webdav/")
-@end smallexample
-
-If Emacs cannot access the WebDAV directory directly using a @file{tramp}
-method, or you prefer to maintain a local copy, you can use a local directory
-for staging.  Other means must then be used to keep this directory in sync
-with the WebDAV directory.  In the following example, files are staged in
-@file{~/stage}, and Org-mode hooks take care of moving files to and from the
-WebDAV directory using @file{scp}.
+@lisp
+(setq org-mobile-directory "~/Dropbox/MobileOrg")
+@end lisp
 
-@smallexample
-(setq org-mobile-directory "~/stage/")
-(add-hook 'org-mobile-post-push-hook
-  (lambda () (shell-command "scp -r ~/stage/* user@@wdhost:mobile/")))
-(add-hook 'org-mobile-pre-pull-hook
-  (lambda () (shell-command "scp user@@wdhost:mobile/mobileorg.org ~/stage/ ")))
-(add-hook 'org-mobile-post-pull-hook
-  (lambda () (shell-command "scp ~/stage/mobileorg.org user@@wdhost:mobile/")))
-@end smallexample
+Org-mode has commands to put files for @i{MobileOrg} into that directory,
+and to read captured notes from there.
 
 @node Pushing to MobileOrg, Pulling from MobileOrg, Setting up the staging area, MobileOrg
 @section Pushing to MobileOrg
@@ -12079,28 +14136,26 @@ to the directory @code{org-mobile-directory}.  By default this list contains
 all agenda files (as listed in @code{org-agenda-files}), but additional files
 can be included by customizing @code{org-mobiles-files}.  File names will be
 staged with path relative to @code{org-directory}, so all files should be
-inside this directory.  The push operation also creates (in the same
-directory) a special Org file @file{agendas.org}.  This file is an Org-mode
-style outline, containing every custom agenda view defined by the user.
-While creating the agendas, Org-mode will force@footnote{See the variable
-@code{org-mobile-force-id-on-agenda-items}.}  an ID property on all entries
-referenced by the agendas, so that these entries can be uniquely identified
-if @i{MobileOrg} flags them for further action.  Finally, Org writes the file
-@file{index.org}, containing links to all other files.  If @i{MobileOrg} is
-configured to request this file from the WebDAV server, all agendas and Org
-files will be downloaded to the device.  To speed up the download, MobileOrg
-will only read files whose checksums@footnote{stored automatically in the
-file @file{checksums.dat}} have changed.
+inside this directory.  The push operation also creates a special Org file
+@file{agendas.org} with all custom agenda view defined by the
+user@footnote{While creating the agendas, Org-mode will force (see the
+variable @code{org-mobile-force-id-on-agenda-items}) ID properties on all
+referenced entries, so that these entries can be uniquely
+identified if @i{MobileOrg} flags them for further action.}.  Finally, Org
+writes the file @file{index.org}, containing links to all other files.
+@i{MobileOrg} first reads this file from the server, and then downloads all
+agendas and Org files listed in it.  To speed up the download, MobileOrg will
+only read files whose checksums@footnote{stored automatically in the file
+@file{checksums.dat}} have changed.
 
 @node Pulling from MobileOrg,  , Pushing to MobileOrg, MobileOrg
 @section Pulling from MobileOrg
 
-When @i{MobileOrg} synchronizes with the WebDAV server, it not only pulls the
-Org files for viewing.  It also appends captured entries and pointers to
-flagged and changed entries to the file @file{mobileorg.org} on the server.
-Org has a @emph{pull} operation that integrates this information into an
-inbox file and operates on the pointers to flagged entries.  Here is how it
-works:
+When @i{MobileOrg} synchronizes with the server, it not only pulls the Org
+files for viewing.  It also appends captured entries and pointers to flagged
+and changed entries to the file @file{mobileorg.org} on the server.  Org has
+a @emph{pull} operation that integrates this information into an inbox file
+and operates on the pointers to flagged entries.  Here is how it works:
 
 @enumerate
 @item
@@ -12141,38 +14196,32 @@ this flagged entry is finished.
 If you are not able to process all flagged entries directly, you can always
 return to this agenda view using @kbd{C-c a ?}.  Note, however, that there is
 a subtle difference.  The view created automatically by @kbd{M-x
-org-mobile-pull RET} is guaranteed to search all files that have been
+org-mobile-pull @key{RET}} is guaranteed to search all files that have been
 addressed by the last pull.  This might include a file that is not currently
 in your list of agenda files.  If you later use @kbd{C-c a ?} to regenerate
 the view, only the current agenda files will be searched.
 
 @node History and Acknowledgments, Main Index, MobileOrg, Top
-@appendix History and Acknowledgments
-@cindex acknowledgements
+@appendix History and acknowledgments
+@cindex acknowledgments
 @cindex history
 @cindex thanks
 
-Org was born in 2003, out of frustration over the user interface
-of the Emacs Outline mode.  I was trying to organize my notes and
-projects, and using Emacs seemed to be the natural way to go.  However,
-having to remember eleven different commands with two or three keys per
-command, only to hide and show parts of the outline tree, that seemed
-entirely unacceptable to me.  Also, when using outlines to take notes, I
-constantly wanted to restructure the tree, organizing it parallel to my
-thoughts and plans.  @emph{Visibility cycling} and @emph{structure
-editing} were originally implemented in the package
-@file{outline-magic.el}, but quickly moved to the more general
-@file{org.el}.  As this environment became comfortable for project
-planning, the next step was adding @emph{TODO entries}, basic
-@emph{timestamps}, and @emph{table support}.  These areas highlighted the two main
-goals that Org still has today: to be a new, outline-based,
-plain text mode with innovative and intuitive editing features, and to
-incorporate project planning functionality directly into a notes file.
-
-A special thanks goes to @i{Bastien Guerry} who has not only written a large
-number of extensions to Org (most of them integrated into the core by now),
-but who has also helped in the development and maintenance of Org so much that he
-should be considered the main co-contributor to this package.
+Org was born in 2003, out of frustration over the user interface of the Emacs
+Outline mode.  I was trying to organize my notes and projects, and using
+Emacs seemed to be the natural way to go.  However, having to remember eleven
+different commands with two or three keys per command, only to hide and show
+parts of the outline tree, that seemed entirely unacceptable to me.  Also,
+when using outlines to take notes, I constantly wanted to restructure the
+tree, organizing it parallel to my thoughts and plans.  @emph{Visibility
+cycling} and @emph{structure editing} were originally implemented in the
+package @file{outline-magic.el}, but quickly moved to the more general
+@file{org.el}.  As this environment became comfortable for project planning,
+the next step was adding @emph{TODO entries}, basic @emph{timestamps}, and
+@emph{table support}.  These areas highlighted the two main goals that Org
+still has today: to be a new, outline-based, plain text mode with innovative
+and intuitive editing features, and to incorporate project planning
+functionality directly into a notes file.
 
 Since the first release, literally thousands of emails to me or to
 @email{emacs-orgmode@@gnu.org} have provided a constant stream of bug
@@ -12183,6 +14232,38 @@ in shaping one or more aspects of Org.  The list may not be
 complete, if I have forgotten someone, please accept my apologies and
 let me know.
 
+Before I get to this list, a few special mentions are in order:
+
+@table @i
+@item Bastien Guerry
+Bastien has written a large number of extensions to Org (most of them
+integrated into the core by now), including the LaTeX exporter and the plain
+list parser.  His support during the early days, when he basically acted as
+co-maintainer, was central to the success of this project.  Bastien also
+invented Worg, helped establishing the Web presence of Org, and sponsors
+hosting costs for the orgmode.org website.
+@item Eric Schulte and Dan Davison
+Eric and Dan are jointly responsible for the Org-babel system, which turns
+Org into a multi-language environment for evaluating code and doing literate
+programming and reproducible research.
+@item John Wiegley
+John has also contributed a number of great ideas and patches
+directly to Org, including the attachment system (@file{org-attach.el}),
+integration with Apple Mail (@file{org-mac-message.el}), hierarchical
+dependencies of TODO items, habit tracking (@file{org-habits.el}), and
+encryption (@file{org-crypt.el}).  Also, the capture system is really an
+extended copy of his great @file{remember.el}.
+@item Sebastian Rose
+Without Sebastian, the HTML/XHTML publishing of Org would be the pitiful work
+of an ignorant amateur.  Sebastian has pushed this part of Org onto a much
+higher level.  He also wrote @file{org-info.js}, a Java script for displaying
+webpages derived from Org using an Info-like or a folding interface with
+single-key navigation.
+@end table
+
+@noindent OK, now to the full list of contributions!  Again, please let me
+know what I am missing here!
+
 @itemize @bullet
 
 @item
@@ -12195,12 +14276,14 @@ Org-mode website.
 @item
 @i{Alex Bochannek} provided a patch for rounding timestamps.
 @item
+@i{Jan Böcker} wrote @file{org-docview.el}.
+@item
 @i{Brad Bozarth} showed how to pull RSS feed data into Org-mode files.
 @item
 @i{Tom Breton} wrote @file{org-choose.el}.
 @item
 @i{Charles Cave}'s suggestion sparked the implementation of templates
-for Remember.
+for Remember, which are now templates for capture.
 @item
 @i{Pavel Chalmoviansky} influenced the agenda treatment of items with
 specified time.
@@ -12213,8 +14296,6 @@ calculations and improved XEmacs compatibility, in particular by porting
 @item
 @i{Baoqiu Cui} contributed the DocBook exporter.
 @item
-@i{Dan Davison} wrote (together with @i{Eric Schulte}) Org Babel.
-@item
 @i{Eddward DeVilla} proposed and tested checkbox statistics.  He also
 came up with the idea of properties, and that there should be an API for
 them.
@@ -12225,6 +14306,9 @@ them.
 inspired some of the early development, including HTML export.  He also
 asked for a way to narrow wide table columns.
 @item
+@i{Thomas S. Dye} contributed documentation on Worg and helped integrating
+the Org-Babel documentation into the manual.
+@item
 @i{Christian Egli} converted the documentation into Texinfo format,
 patched CSS formatting into the HTML exporter, and inspired the agenda.
 @item
@@ -12246,9 +14330,6 @@ around a match in a hidden outline tree.
 @item
 @i{Niels Giesen} had the idea to automatically archive DONE trees.
 @item
-@i{Bastien Guerry} wrote the La@TeX{} exporter and @file{org-bibtex.el}, and
-has been prolific with patches, ideas, and bug reports.
-@item
 @i{Kai Grossjohann} pointed out key-binding conflicts with other packages.
 @item
 @i{Bernt Hansen} has driven much of the support for auto-repeating tasks,
@@ -12263,6 +14344,8 @@ patches.
 @i{Scott Jaderholm} proposed footnotes, control over whitespace between
 folded entries, and column view for properties.
 @item
+@i{Matt Jones} wrote @i{MobileOrg Android}.
+@item
 @i{Tokuya Kameshima} wrote @file{org-wl.el} and @file{org-mew.el}.
 @item
 @i{Shidai Liu} ("Leo") asked for embedded La@TeX{} and tested it.  He also
@@ -12271,6 +14354,10 @@ provided frequent feedback and some patches.
 @i{Matt Lundin} has proposed last-row references for table formulas and named
 invisible anchors.  He has also worked a lot on the FAQ.
 @item
+@i{David Maus} wrote @file{org-atom.el}, maintains the issues file for Org,
+and is a prolific contributor on the mailing list with competent replies,
+small fixes and patches.
+@item
 @i{Jason F. McBrayer} suggested agenda export to CSV format.
 @item
 @i{Max Mikhanosha} came up with the idea of refiling.
@@ -12293,6 +14380,9 @@ and being able to quickly restrict the agenda to a subtree.
 @i{Tim O'Callaghan} suggested in-file links, search options for general
 file links, and TAGS.
 @item
+@i{Osamu Okano} wrote @file{orgcard2ref.pl}, a perl program to create a text
+version of the reference card.
+@item
 @i{Takeshi Okano} translated the manual and David O'Toole's tutorial
 into Japanese.
 @item
@@ -12317,10 +14407,6 @@ also acted as mailing list moderator for some time.
 @item
 @i{Kevin Rogers} contributed code to access VM files on remote hosts.
 @item
-@i{Sebastian Rose} wrote @file{org-info.js}, a Java script for displaying
-webpages derived from Org using an Info-like or a folding interface with
-single-key navigation.
-@item
 @i{Frank Ruell} solved the mystery of the @code{keymapp nil} bug, a
 conflict with @file{allout.el}.
 @item
@@ -12333,8 +14419,7 @@ of feedback, developed and applied standards to the Org documentation.
 @i{Christian Schlauer} proposed angular brackets around links, among
 other things.
 @item
-@i{Eric Schulte} wrote @file{org-plot.el} and (together with @i{Dan Davison})
-Org Babel, and contributed various patches, small features and modules.
+@i{Paul Sexton} wrote @file{org-ctags.el}.
 @item
 Linking to VM/BBDB/Gnus was first inspired by @i{Tom Shannon}'s
 @file{organizer-mode.el}.
@@ -12356,31 +14441,30 @@ tweaks and features.
 @i{Adam Spiers} asked for global linking commands, inspired the link
 extension system, added support for mairix, and proposed the mapping API.
 @item
+@i{Ulf Stegemann} created the table to translate special symbols to HTML,
+LaTeX, UTF-8, Latin-1 and ASCII.
+@item
 @i{Andy Stewart} contributed code to @file{org-w3m.el}, to copy HTML content
 with links transformation to Org syntax.
 @item
 @i{David O'Toole} wrote @file{org-publish.el} and drafted the manual
 chapter about publishing.
 @item
+@i{Stefan Vollmar} organized a video-recorded talk at the
+Max-Planck-Institute for Neurology.  He also inspired the creation of a
+concept index for HTML export.
+@item
 @i{J@"urgen Vollmer} contributed code generating the table of contents
 in HTML output.
 @item
+@i{Samuel Wales} has provided important feedback and bug reports.
+@item
 @i{Chris Wallace} provided a patch implementing the @samp{QUOTE}
 keyword.
 @item
 @i{David Wainberg} suggested archiving, and improvements to the linking
 system.
 @item
-@i{John Wiegley} wrote @file{emacs-wiki.el}, @file{planner.el}, and
-@file{muse.el}, which have some overlap with Org.  Initially the development
-of Org was fully independent because I was not aware of the existence of
-these packages.  But with time I have occasionally looked at John's code and
-learned a lot from it.  John has also contributed a number of great ideas and
-patches directly to Org, including the attachment system
-(@file{org-attach.el}), integration with Apple Mail
-(@file{org-mac-message.el}), hierarchical dependencies of TODO items, habit
-tracking (@file{org-habits.el}) and support for pcomplete.
-@item
 @i{Carsten Wimmer} suggested some changes and helped fix a bug in
 linking to Gnus.
 @item
@@ -12393,17 +14477,17 @@ and contributed various ideas and code snippets.
 
 
 @node Main Index, Key Index, History and Acknowledgments, Top
-@unnumbered Concept Index
+@unnumbered Concept index
 
 @printindex cp
 
 @node Key Index, Variable Index, Main Index, Top
-@unnumbered Key Index
+@unnumbered Key index
 
 @printindex ky
 
 @node Variable Index,  , Key Index, Top
-@unnumbered Variable Index
+@unnumbered Variable index
 
 This is not a complete index of variables and faces, only the ones that are
 mentioned in the manual.  For a more complete list, use @kbd{M-x
@@ -12418,8 +14502,6 @@ org-customize @key{RET}} and then click yourself through the tree.
 @end ignore
 
 @c Local variables:
-@c ispell-local-dictionary: "en_US-w_accents"
-@c ispell-local-pdict: "./.aspell.org.pws"
 @c fill-column: 77
 @c End:
 
diff --git a/etc/.arch-inventory b/etc/.arch-inventory
deleted file mode 100644 (file)
index 30ad7ba..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-# Unlike most emacs dirs, etc has a simple non-autoconf-generated makefile
-source ^(Makefile)$
-
-# Auto-generated files, which ignore
-precious ^(buildobj\.lst)$
-
-# Generated files (DOC-X is generated on windows)
-backup ^(DOC(|-[0-9.]*|-X))$
-
-# Install-in-place on NT makes this directory, so just ignore it
-backup ^(icons)$
-
-# arch-tag: 5a1d62e0-593a-48cd-8743-8d45dc58dfae
index 26611a57de12f8fbd089f8b31b55f3c6bea2a5d8..916f8cdd794ee041159e27f295aedf734fc44cc9 100644 (file)
@@ -1042,7 +1042,7 @@ and changed nndoc.el allout.el bytecomp.el gnus-sum.el gnus-util.el
 
 François-David Collin: changed message.el mm-decode.el
 
-Fred Fish: changed linux.h unexec.c
+Fred Fish: changed linux.h unexcoff.c
 
 Fred Oberhauser: changed nnmail.el
 
@@ -1273,7 +1273,7 @@ Inge Wallin: co-wrote avl-tree.el ewoc.el
 Inoue Seiichiro: changed xterm.c xfns.c xterm.h
 
 International Business Machines: changed emacs.c fileio.c process.c
-  sysdep.c unexec.c
+  sysdep.c unexcoff.c
 
 Irie Tetsuya: changed gnus.texi message.texi
 
@@ -1334,7 +1334,7 @@ James TD Smith: changed org.el org-colview.el org-clock.el
 
 James Troup: changed gnus-sum.el
 
-James Van Artsdalen: changed unexec.c usg5-4.h
+James Van Artsdalen: changed unexcoff.c usg5-4.h
 
 James Wright: changed em-unix.el
 
@@ -2176,7 +2176,7 @@ and changed tramp.texi dbusbind.c dbus.texi ange-ftp.el trampver.el
   simple.el vc.el configure.in dired.el and 50 other files
 
 Michael Ben-Gershon: changed acorn.h configure.in riscix1-1.h riscix1-2.h
-  unexec.c
+  unexcoff.c
 
 Michael D. Ernst: wrote reposition.el
 and changed dired-x.el uniquify.el ispell.el bibtex.el rmail.el dired.el
@@ -2200,7 +2200,7 @@ Michael I. Bushnell: changed rmail.el simple.el callproc.c gnu.h gnus.el
 
 Michael K. Johnson: changed configure.in emacs.c intel386.h linux.h
   mem-limits.h process.c sysdep.c syssignal.h systty.h template.h
-  unexec.c
+  unexcoff.c
 
 Michael Kifer: wrote ediff-diff.el ediff-help.el ediff-hook.el
   ediff-init.el ediff-merg.el ediff-mult.el ediff-ptch.el ediff-util.el
@@ -2259,7 +2259,7 @@ and changed gnus-score.el
 Microelectronics and Computer Technology Corporation: changed
   emacsclient.c etags.c lisp.h movemail.c rmail.el rmailedit.el
   rmailkwd.el rmailmsc.el rmailout.el rmailsum.el scribe.el server.el
-  sysdep.c unexec.c xmenu.c
+  sysdep.c unexcoff.c xmenu.c
 
 Mikael Djurfeldt: changed xdisp.c
 
@@ -2685,7 +2685,7 @@ and changed files.el keyboard.c simple.el xterm.c xdisp.c Makefile.in
 Richard Mlynarik: wrote cl-indent.el ebuff-menu.el ehelp.el rfc822.el
   terminal.el yow.el
 and changed files.el sysdep.c rmail.el info.el keyboard.c bytecomp.el
-  fileio.c simple.el process.c startup.el window.c editfns.c unexec.c
+  fileio.c simple.el process.c startup.el window.c editfns.c unexcoff.c
   xfns.c keymap.c minibuf.c sendmail.el buffer.c dispnew.c emacs.c
   subr.el and 129 other files
 
@@ -2921,7 +2921,7 @@ Slawomir Nowaczyk: changed emacs.py python.el TUTORIAL.pl flyspell.el
   ls-lisp.el w32proc.c
 
 Spencer Thomas: changed dabbrev.el emacsclient.c gnus.texi server.el
-  unexec.c
+  unexcoff.c
 
 Sriram Karra: changed message.el
 
index d2145fb811bb1b918816e304a3b64bfafb0bb1f0..70e002f0f9ef7411994f446a602f12954653d8cf 100644 (file)
@@ -1,11 +1,60 @@
+2010-08-25  Kenichi Handa  <handa@m17n.org>
+
+       * HELLO: Change designation sequences for Arabic text.
+
+2010-08-23  Michael Albinus  <michael.albinus@gmx.de>
+
+       * NEWS: dbus.el supports alternative buses.
+
 2010-08-22  Alex Harsanyi  <harsanyi@mac.com>  (tiny change)
 
        * emacs3.py: Import imp module and use it (Bug#5756).
 
-2010-07-27  Ken Brown  <kbrown@cornell.edu>
+2010-08-14  Eli Zaretskii  <eliz@gnu.org>
+
+       * tutorials/TUTORIAL.he: Use MAQAF instead of hyphen where appropriate.
+       Fix a few typos.
+
+2010-08-08  Ken Brown  <kbrown@cornell.edu>
 
        * PROBLEMS: Mention problem with Cygwin 1.5.19.
 
+2010-08-07  Eli Zaretskii  <eliz@gnu.org>
+
+       * NEWS: Mention the Hebrew translation.
+
+       * tutorials/TUTORIAL.he: Don't use acronyms.
+
+2010-08-05  Eli Zaretskii  <eliz@gnu.org>
+
+       * AUTHORS: Rename unexec.o => unexcoff.o.
+       * PROBLEMS: Rename unexec.o => unexcoff.o.
+
+2010-07-31  Eli Zaretskii  <eliz@gnu.org>
+
+       * tutorials/TUTORIAL.he: New file.
+
+       * tutorials/TUTORIAL.translators: Add TUTORIAL.he.
+
+2010-07-24  Christoph Scholtes  <cschol2112@gmail.com>
+
+       * NEWS: Document new --distfiles configure.bat option and
+       `dist' make target on Windows.
+
+2010-07-20  Juanma Barranquero  <lekktu@gmail.com>
+
+       * PROBLEMS: Add note about use of backslashes in Windows paths.
+
+2010-07-19  Juanma Barranquero  <lekktu@gmail.com>
+
+       * NEWS: Mention --enable-checking is now supported on Windows.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * refcards/orgcard.tex: Remove the key for the TODO sparse tree
+       and add the new key.  Document new keys for image and entity
+       display.  Document the Org Babel keys.
+
 2010-06-19  Ken Brown  <kbrown@cornell.edu>
 
        * PROBLEMS: Update Cygwin GCC information.  (Bug#6458)
 
        * tutorials/TUTORIAL.bg, tutorials/TUTORIAL.es: Fix typos.
 
-2010-05-19  Stefan Monnier  <monnier@iro.umontreal.ca>
+2010-06-09  Michael Albinus  <michael.albinus@gmx.de>
 
-       * NEWS: Add sections for Emacs-23.3.
+       * NEWS: Add notifications.el.
 
-2010-05-07  Chong Yidong  <cyd@stupidchicken.com>
+2010-05-28  Glenn Morris  <rgm@gnu.org>
 
-       * Version 23.2 released.
+       * MACHINES: Remove some old information no longer of relevance.
+       Switch to outline-mode.
 
-2010-04-27  Chong Yidong  <cyd@stupidchicken.com>
+2010-05-27  Glenn Morris  <rgm@gnu.org>
+
+       * PROBLEMS: Remove old information no longer of relevance.
+
+2010-05-24  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * NEWS: Add sections for Emacs-23.3.
+
+2010-05-08  Chong Yidong  <cyd@stupidchicken.com>
 
        * PROBLEMS: Document gcc-4.5 bug (Bug#6031).
 
-2010-04-23  Kenichi Handa  <handa@m17n.org>
+2010-05-08  Kenichi Handa  <handa@m17n.org>
 
        * HELLO: Adjust Burmese for Unicode 5.2 encoding.
 
-2010-04-04  Francesc Rocher  <rocher@member.fsf.org>
+2010-05-07  Chong Yidong  <cyd@stupidchicken.com>
+
+       * Version 23.2 released.
+
+2010-05-07  Eli Zaretskii  <eliz@gnu.org>
+
+       * HELLO: Reorder Arabic greetings into logical order (they were
+       mistakenly changed to visual order by the 2010-03-28 change).
+
+2010-04-18  Francesc Rocher  <rocher@member.fsf.org>
 
        * MORE.STUFF: Add a new entry for QWE.
 
-2010-03-28  Chong Yidong  <cyd@stupidchicken.com>
+2010-04-18  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * HELLO (Mathematics): Prefer Unicode charset.
+
+2010-03-30  Chong Yidong  <cyd@stupidchicken.com>
 
        * images/icons/hicolor/scalable/apps/emacs.svg: Put preamble after
        svg tag (Bug#5790).
 
-2010-03-27  Eli Zaretskii  <eliz@gnu.org>
+2010-03-30  Eli Zaretskii  <eliz@gnu.org>
 
        * PROBLEMS: Mention problems on MS-Windows with incompatible
        regex.h headers.
 
-2010-03-15  Francesc Rocher  <rocher@member.fsf.org>
+2010-03-28  Eli Zaretskii  <eliz@gnu.org>
+
+       * HELLO: Reorder Arabic and Hebrew into logical order, and
+       insert RLM before the opening paren, to make the display more
+       reasonable.  Add setting for bidi-display-reordering in the local
+       variables section.
+       * NEWS: Mention initial support for bidirectional editing.
+
+2010-03-24  Francesc Rocher  <rocher@member.fsf.org>
 
        * MORE.STUFF: Remove CEDET entry, now distributed as part of Emacs.
 
+2010-03-22  Teodor Zlatanov  <tzz@lifelogs.com>
+
+       * gnus/gnus-setup.ast: Add finish links to the top nodes.
+
+       * gnus/news-server.ast: Add some trivial validation.
+
+2010-03-13  Michael Albinus  <michael.albinus@gmx.de>
+
+       * NEWS: Add secrets.el.
+
+2010-03-12  Chong Yidong  <cyd@stupidchicken.com>
+
+       * images/custom/down.xpm, images/custom/right.xpm: Update images
+       to increase contrast on bright backgrounds.
+
+2010-03-10  Chong Yidong  <cyd@stupidchicken.com>
+
+       * Branch for 23.2.
+
 2010-03-06  Glenn Morris  <rgm@gnu.org>
 
        * srecode/default.srt (COPYRIGHT): Update template copyright to GPLv3+.
 2006-11-05  Slawomir Nowaczyk  <slawek@cs.lth.se>
 
        * emacs.py (eargs): Provide eldoc message for builtin types.
-         Make sure eargs always outputs sentinel, to avoid Emacs freeze.
+       Make sure eargs always outputs sentinel, to avoid Emacs freeze.
 
 2006-10-22  Chong Yidong  <cyd@stupidchicken.com>
 
 1990-01-19  David Lawrence  (tale@cocoa-puffs)
 
        * timer.c, getdate.y (new files) and Makefile:
-         Sub-process support for run-at-time in timer.el.
-         Doesn't yet work correctly for USG.
+       Sub-process support for run-at-time in timer.el.
+       Doesn't yet work correctly for USG.
 
 1990-01-10  Jim Kingdon  (kingdon@pogo)
 
        * etags.c: Changes for VMS.
        Always define ETAGS on VMS.
        Define macros GOOD and BAD for success and failure exit codes.
-       (begtk, intk): Allow `$' in identifiers
+       (begtk, intk): Allow `$' in identifiers.
        (main): Don't support -B, -F or -u on VMS.
        Alternate loop for scanning filename arguments.
        (system): Delete definition of this function.
index 334daa36eac062526a1c86576278dc228c991669..6fd5b412f4cb384ce3440434a0c8c56c2135fca5 100644 (file)
--- a/etc/DEBUG
+++ b/etc/DEBUG
@@ -5,9 +5,8 @@ Copyright (C) 1985, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
 See the end of the file for license conditions.
 
 
-[People who debug Emacs on Windows using Microsoft debuggers
-should read the Windows-specific section near the end of this
-document.]
+[People who debug Emacs on Windows using Microsoft debuggers should
+read the Windows-specific section near the end of this document.]
 
 ** When you debug Emacs with GDB, you should start it in the directory
 where the executable was made.  That directory has a .gdbinit file
@@ -50,8 +49,7 @@ On modern POSIX systems, you can override that with this command:
    handle SIGINT stop nopass
 
 After this `handle' command, SIGINT will return control to GDB.  If
-you want the C-g to cause a QUIT within Emacs as well, omit the
-`nopass'.
+you want the C-g to cause a QUIT within Emacs as well, omit the `nopass'.
 
 A technique that can work when `handle SIGINT' does not is to store
 the code for some character into the variable stop_character.  Thus,
@@ -443,10 +441,9 @@ It is necessary to refer to the file `nmout' to convert
 numeric addresses into symbols and vice versa.
 
 It is useful to be running under a window system.
-Then, if Emacs becomes hopelessly wedged, you can create
-another window to do kill -9 in.  kill -ILL is often
-useful too, since that may make Emacs dump core or return
-to adb.
+Then, if Emacs becomes hopelessly wedged, you can create another
+window to do kill -9 in.  kill -ILL is often useful too, since that
+may make Emacs dump core or return to adb.
 
 
 ** Debugging incorrect screen updating.
@@ -483,16 +480,14 @@ suitable for Unix and GNU systems, to build such a debugging version:
 Building Emacs like that activates many assertions which scrutinize
 display code operation more than Emacs does normally.  (To see the
 code which tests these assertions, look for calls to the `xassert'
-macros.)  Any assertion that is reported to fail should be
-investigated.
+macros.)  Any assertion that is reported to fail should be investigated.
 
 Building with GLYPH_DEBUG defined also defines several helper
 functions which can help debugging display code.  One such function is
 `dump_glyph_matrix'.  If you run Emacs under GDB, you can print the
 contents of any glyph matrix by just calling that function with the
 matrix as its argument.  For example, the following command will print
-the contents of the current matrix of the window whose pointer is in
-`w':
+the contents of the current matrix of the window whose pointer is in `w':
 
   (gdb) p dump_glyph_matrix (w->current_matrix, 2)
 
@@ -621,14 +616,9 @@ Emacs compiled with such packages might not run without some hacking,
 because Emacs replaces the system's memory allocation functions with
 its own versions, and because the dumping process might be
 incompatible with the way these packages use to track allocated
-memory.  Here are some of the changes you might find necessary
-(SYSTEM-NAME and MACHINE-NAME are the names of your OS- and
-CPU-specific headers in the subdirectories of `src'):
+memory.  Here are some of the changes you might find necessary:
 
-  - In src/s/SYSTEM-NAME.h add "#define SYSTEM_MALLOC".
-
-  - In src/m/MACHINE-NAME.h add "#define CANNOT_DUMP" and
-    "#define CANNOT_UNEXEC".
+  - Edit configure, to set system_malloc and CANNOT_DUMP to "yes".
 
   - Configure with a different --prefix= option.  If you use GCC,
     version 2.7.2 is preferred, as some malloc debugging packages
index c7bd5ebe4497094afe8165962c88090136353d33..f7320f7301f10b51426e613c675f7c4f4ce9b1b0 100644 (file)
--- a/etc/HELLO
+++ b/etc/HELLO
@@ -4,7 +4,7 @@ Non-ASCII examples:
   Europe: \e,A!\e(BHola!, Gr\e,A|_\e(B Gott, Hyv\e,Add\e(B p\e,Ad\e(Biv\e,Add\e(B, Tere \e,Au\e(Bhtust, Bon\e,Cu\e(Bu
           Cze\e,B6f\e(B!, Dobr\e,B}\e(B den, \e,L7T`PRabRcYbU\e(B!, \e,FCei\\e(B \e,Fsar\e(B, \e$,1J2J0J;J0J@JOJ=J1J0\e(B
   Africa: \e$(3!A!,!>\e(B
-  Middle/Near East: \e,Hylem\e(B, \e,GecjdY\e(B \e,GeGdqSdG\e(B
+  Middle/Near East: \e,Hylem\e(B, \e$,1-g.$-s.1.$-g.%\e(B \e$,1-y.$.*.#.%\e(B
   South Asia: \e$,19h9n9x:-9d:'\e(B, \e$,15h5n5x6-5d6'\e(B, \e$,1?(?.?8?M>u?>?0\e(B, \e$,1@H@N@X@m@5@^@P@"\e(B, \e$,1;6;A;#;?;,;G\e(B,
               \e$,1AFAzB4AvB=B AqB*\e(B, \e$,1<U<C<5<m<5<N<m\e(B, \e$,1=h=n=x>-=U=~=p=B\e(B, \e$(7"7"!#C!;"E"S"G!;"7"2"[!;"D"["#"G!>\e(B
   South East Asia: \e$,1\'\f\:\V\4\?\]\:\e(B, \e(1JP:R-4U\e(B, \e$,1H9H$HZHYH"H<HLH5HK\e(B, \e,TJGQJ4U$CQ:\e(B, Ch\e,1`\e(Bo b\e,1U\e(Bn
@@ -16,7 +16,7 @@ Non-ASCII examples:
 LANGUAGE (NATIVE NAME) HELLO
 ---------------------- -----
 Amharic (\e$,1O M[MmN{\e(B)      \e$,1M`MKM]\e(B
-Arabic (\e,GIqjHQYdG\e(B)        \e,GecjdY\e(B \e,GeGdqSdG\e(B
+Arabic \e$,1ro\e(B(\e$,1-g.$-y-q-h.*.1-i\e(B)      \e$,1-g.$-s.1.$-g.%\e(B \e$,1-y.$.*.#.%\e(B
 Bengali (\e$,17,7>6b727>\e(B)    \e$,17(7.787M6u7>70\e(B
 Braille        \e$,2(3(1('('(5\e(B
 Burmese (\e$,1H9H\H4HZH9HL\e(B)  \e$,1H9H$HZHYH"H<HLH5HK\e(B
@@ -34,7 +34,7 @@ Georgian (\e$,1JEJ0J@J7J5J4J:J8\e(B)    \e$,1J2J0J;J0J@JOJ=J1J0\e(B
 German (Deutsch)       Guten Tag / Gr\e,A|_\e(B Gott
 Greek (\e,Fekkgmij\\e(B) \e,FCei\\e(B \e,Fsar\e(B
 Gujarati (\e$,19W:!9\9p9~9d: \e(B)       \e$,19h9n9x:-9d:'\e(B
-Hebrew (\e,Hzixar\e(B)   \e,Hylem\e(B
+Hebrew \e$,1ro\e(B(\e$,1-",q-(,y-*\e(B)    \e,Hylem\e(B
 Hungarian (magyar)     Sz\e,Bi\e(Bp j\e,Bs\e(B napot!
 Hindi (\e$,15y5\7f5B5f6 \e(B)      \e$,15h5n5x6-5d6'\e(B / \e$,15h5n5x6-5U5~5p\e(B \e$,16D\e(B
 Italian (italiano)     Ciao / Buon giorno
@@ -44,7 +44,7 @@ Khmer (\e$,1\7\V\?\V\!\r\8\b\:\e(B)     \e$,1\'\f\:\V\4\?\]\:\e(B
 Lao (\e(1>RJRERG\e(B)    \e(1JP:R-4U\e(B / \e(1"mcKib*!4U\e(B
 Malayalam (\e$,1@N@R@O@^@S@"\e(B)        \e$,1@H@N@X@m@5@^@P@"\e(B
 Maltese (il-Malti)     Bon\e,Cu\e(Bu / Sa\e,C11\e(Ba
-Mathematics    \e$B"O\e(B p \e$A!J\e(B world \e$(O#@\e(B hello p  \e$A!u\e(B
+Mathematics    \e$,1x \e(B p \e$,1x(\e(B world \e$,1s"\e(B hello p  \e$,2!a\e(B
 Nederlands, Vlaams     Hallo / Dag
 Norwegian (norsk)      Hei / God dag
 Oriya (\e$,1:s;\;?:f\e(B)        \e$,1;6;A;#;?;,;G\e(B
@@ -91,4 +91,5 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Local Variables:
 ;;; tab-width: 32
+;;; bidi-display-reordering: t
 ;;; End:
index 8fc79ab0d1d446097748d0fbf657e504d95bb6a7..ebefc8905e074ea70f6eb24b9b9ea294a1fb2b09 100644 (file)
@@ -6,9 +6,9 @@ See the end of the file for license conditions.
 
 This is a list of the status of GNU Emacs on various machines and systems.
 
-For each system and machine, we give the configuration name you should
-pass to the `configure' script to prepare to build Emacs for that
-system/machine.
+Information about older releases, and platforms that are no longer
+supported, has been removed.  Consult older versions of this file if
+you are interested in this information.
 
 The `configure' script uses the configuration name to decide which
 machine and operating system description files `src/config.h' should
@@ -25,16 +25,10 @@ configuration name(s) should select your new machine description and
 system description files.
 
 Some obsolete platforms are unsupported beginning with Emacs 23.1, see
-the full list at the end of this file.
+the list at the end of this file.
 
 \f
-Here are the configurations Emacs is intended to work with, with the
-corresponding configuration names.  You can postpend version numbers
-to operating system names (i.e. sunos4.1) or architecture names (i.e.
-hppa1.1).  If you leave out the version number, the `configure' script
-will configure Emacs for the latest version it knows about.
-
-Alpha (DEC) running GNU/Linux (alpha-dec-linux-gnu)
+** Alpha (DEC) running GNU/Linux (alpha-dec-linux-gnu)
 
   DEC C compiler version 5.9 (DEC C V5.9-005 on Digital UNIX V4.0f)
   is reported to produce bogus binaries of Emacs 21.2 when the
@@ -47,125 +41,26 @@ Alpha (DEC) running GNU/Linux (alpha-dec-linux-gnu)
   versions fail to build with a message "Invalid dimension for the
   charset-ID 160".
 
-  Note that the X11 libraries on GNU/Linux systems for the Alpha are
-  said to have bugs that prevent Emacs from working with X (as of
-  November 1995).  Recent releases work (July 2000).
-
-Apple Macintosh running Mac OS X
-
-  For installation instructions see the file nextstep/INSTALL.
-
-Apple PowerPC Macintosh running GNU/Linux
-
-  There are special considerations for a variety of this system which
-  is known as the ``Yellow Dog [GNU/]Linux'': Emacs may crash during
-  dumping.  To solve this, edit the header file src/m/macppc.h in the
-  Emacs distribution, and remove the "#if 0" and "#endif" directives
-  which surround the following block near the end of the file:
-
-    #if 0  /* This breaks things on PPC GNU/Linux except for Yellowdog,
-             even with identical GCC, as, ld.  Let's take it out until we
-             know what's really going on here.  */
-    /* GCC 2.95 and newer on GNU/Linux PPC changed the load address to
-       0x10000000.  */
-    #if defined __linux__
-    #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
-    #define DATA_SEG_BITS  0x10000000
-    #endif
-    #endif
-    #endif /* 0 */
-
-  After that, reconfigure and rebuild Emacs.  It should now build
-  successfully.
-
-Cubix QBx/386 (i386-cubix-sysv)
-
-  Changes merged in 19.1.  Systems before 2/A/0 may fail to compile etags.c
-  due to a compiler bug.
-
-Motorola Delta 147 (m68k-motorola-sysv)
-
-  The EMacs 19.26 pretest was reported to work.
-
-  Motorola Delta boxes running System V/68 release 3.
-  Tested on 147 board with SVR3V7, no X and gcc.
-  Tested on 167 board with SVR3V7, no X, cc, gnucc and gcc.
-  Reports say it works with X too.
-
-  The installation script chooses the compiler itself.  gnucc is
-  preferred.
+** Apple Macintosh running Mac OS X
 
-Fujitsu DS/90 (sparc-fujitsu-sysv4)
+** Apple PowerPC Macintosh running GNU/Linux
 
-  Changes merged in 20.3.
-
-HP 9000 series 700 or 800 (Spectrum) (hppa1.0-hp-hpux or hppa1.1-hp-hpux
-                                     or ...hpux9shr)
-
-  Use hppa1.1 for the 700 series and hppa1.0 for the 800
-  series machines.  (Emacs may not actually care which one you use.)
+** HP 9000 series 700 or 800 (Spectrum) (hppa1.0-hp-hpux or hppa1.1-hp-hpux)
 
   Emacs 20 may work on HPUX 10.  You need patch PHSS_6202 to install
   the Xaw and Xmu libraries.  On HPUX 10.20 you may need to compile with GCC;
   when Emacs was compiled with HP's C compiler, HP92453-01 A.10.32.03,
   the subprocess features failed to work.
 
-  19.26 is believed to work on HPUX 9 provided you compile with GCC.
-  As of version 19.16, Emacs was reported to build (using GCC) and run
-  on HP 9000/700 series machines running HP/UX versions 8.07 and 9.01.
-  The HP compiler is known to fail on some versions if you use +O3,
-  but it may work with lower optimization levels.
-
-  Use hppa1.1-hp-hpux9shr to use shared libraries on HPUX version 9.
-  You may need to create the X libraries libXaw.a and libXmu.a from
-  the MIT X distribute, and you may need to edit src/Makefile's
-  definition of LIBXT to look like this:
-
-     LIBXT= $(LIBW) -lXmu -lXt $(LIBXTR6) -lXext
-
-  Some people report trouble using the GNU memory allocator under
-  HP/UX version 9.  The problems often manifest as lots of ^@'s in the
-  buffer.
-
-  We are told that these problems go away if you obtain the latest
-  patches for the HP/UX C compiler.  James J Dempsey
-  <jjd@spserv.bbn.com> says that this set of versions works for him:
-    /bin/cc:
-           HP92453-01 A.09.28 HP C Compiler
-    /lib/ccom:
-           HP92453-01 A.09.28 HP C Compiler
-            HP-UX SLLIC/OPTIMIZER  HP-UX.09.00.23  02/18/93
-            Ucode Code Generator - HP-UX.09.00.23.5 (patch)  2/18/93
-
-  For 700 series machines, the HP-UX patch needed is known as
-  PHSS_2653.  (Perhaps for 800 series machines as well; we don't
-  know.)  If you are on the Internet, you should be able to obtain
-  this patch by using telnet to access the machine
-  support.mayfield.hp.com and logging in as "hpslreg" and following
-  the instructions there.  Or you may be able to use this
-  web site:
-
-    HP Patch Server: http://support.mayfield.hp.com/patches/html/patches.html
-    HP Support Line: http://support.mayfield.hp.com
-
-  Please do not ask FSF for further support on this.  If you have any
-  trouble obtaining the patch, contact HP Software Support.
-
-  If your buffer fills up with nulls (^@) at some point, it could well
-  be that problem.  That problem does not happen when people use GCC
-  to compile Emacs.  On the other hand, the HP compiler version 9.34
-  was reported to work for the 19.26 pretest.  9.65 was also reported to work.
-
-  If you turn on the DSUSP character (delayed suspend),
-  Emacs 19.26 does not know how to turn it off on HPUX.
-  You need to turn it off manually.
+  If you turn on the DSUSP character (delayed suspend), Emacs 19.26
+  does not know how to turn it off on HPUX. You need to turn it off manually.
 
   If you are running HP/UX release 8.0 or later, you need the optional
   "C/ANSI C" software in order to build Emacs (older releases of HP/UX
   do not require any special software).  If the file "/etc/filesets/C"
   exists on your machine, you have this software, otherwise you do not.
 
-IBM RS/6000 (rs6000-ibm-aix*)
+** IBM RS/6000 (rs6000-ibm-aix*)
 
   Emacs 19.26 is believed to work; its pretest was tested.
 
@@ -180,32 +75,22 @@ IBM RS/6000 (rs6000-ibm-aix*)
   persons say that the tty VMIN and VTIME settings have been
   corrupted; if you have a fix, please send it to us.
 
-  Compiling with -O using the IBM compiler has been known
-  to make Emacs work incorrectly.  It's reported that on
-  AIX 3.2.5 with an IBM compiler earlier than 1.03.00.14,
-  cc -O fails for some files.  You need to install any
-  PTF containing APAR #IX42810 to bring the compiler to
-  the 1.03.00.14 level to allow optimized compiles.
-
-  There are reports that IBM compiler versions earlier than 1.03.00.02
-  fail even without -O.  However, another report said that compiler
-  version 1.02.01.00 did work, on AIX 3.2.4, with Emacs 19.31.
+  Compiling with -O using the IBM compiler has been known to make
+  Emacs work incorrectly.  There are reports that IBM compiler versions
+  earlier than 1.03.00.02 fail even without -O.
 
   As of 19.11, if you strip the Emacs executable, it ceases to work.
 
   If anyone can fix the above problems, or confirm that they don't happen
   with certain versions of various programs, we would appreciate it.
 
-IBM System/390 running GNU/Linux (s390-*-linux-gnu)
+** IBM System/390 running GNU/Linux (s390-*-linux-gnu)
 
-  As of Emacs 21.2, a 31-bit only version is supported on this
-  system.
+  As of Emacs 21.2, a 31-bit only version is supported on this system.
 
-Intel 386 (i386-*-freebsd,      i386-*-linux-gnu,
-          i386-*-sol2.4,       i386-intsys-sysv,
-          i386-*-sysv4,        i386-*-sysv4.2,  i386-*-cygwin,
-          i386-*-msdos,        i386-*-windowsnt.
-          i386... can be replaced with i486... or i586...)
+** Intel 386 (i386-*-freebsd,      i386-*-linux-gnu,
+          i386-*-cygwin,       i386-*-msdos,   i386-*-windowsnt.
+          i386 can be replaced with i486, i586, or i686)
 
   In the above configurations, * means that the manufacturer's name
   you specify does not matter, and you can use any name you like
@@ -214,12 +99,9 @@ Intel 386 (i386-*-freebsd,      i386-*-linux-gnu,
   Use i386-*-linux-gnu for GNU/Linux systems; Emacs runs as of version 19.26.
   Use i386-*-cygwin for Cygwin; Emacs builds as of version 22.1, in both X11
   and non-X11 modes.  (The Cygwin site has source and binaries for 21.2.)
-  Use i386-intsys-sysv for Integrated Solutions 386 machines.
-  It may also be correct for Microport systems.
 
   On GNU/Linux systems, Emacs 19.23 was said to work properly with libc
-  version 4.5.21, but not with 4.5.19.  If your system uses QMAGIC
-  for the executable format, you must edit config.h to define LINUX_QMAGIC.
+  version 4.5.21, but not with 4.5.19.
 
   On GNU/Linux, configure may fail to put these definitions in config.h:
 
@@ -232,26 +114,11 @@ Intel 386 (i386-*-freebsd,      i386-*-linux-gnu,
   It is possible that this problem happens only with X11R6.
   Newer system versions have fixed it.
 
-  The 19.26 pretest was reported to work on SVR4.3 and on Freebsd.
-
-  19.29 is reported to crash when using Motif on Solaris 2.5.
-  The reasons are not yet known.
-
-  For System V release 4, use i386-*-sysv4.
-  For System V release 4.2, use i386-*-sysv4.2.
-
-  If you are using SCO Unix, see notes at end under SCO.
-
   On NetBSD and FreeBSD, at one time, it was necessary to use
   GNU make, not the system's make.  Assuming it's installed as gmake,
   do `gmake install MAKE=gmake'.  However, more recently it is
   reported that using the system Make on NetBSD 1.3.1 works ok.
 
-  If you are using System V release 4.2, you may find that `cc -E'
-  puts spurious spaces in `src/xmakefile'.  If that happens,
-  specify CPP=/lib/cpp as an option when you run make.
-  There is no problem if you compile with GCC.
-
   Note that use of Linux with GCC 2.4 and the DLL 4.4 libraries
   requires the experimental "net 2" network patches (no relation to
   Berkeley Net 2).  There is a report that (some version of) Linux
@@ -259,16 +126,6 @@ Intel 386 (i386-*-freebsd,      i386-*-linux-gnu,
   but no coherent explanation of why that might be so.  If it is so,
   in current versions of Linux, something else should probably be changed.
 
-  Some versions have sys/sioctl.h, and require it in sysdep.c.
-  But some versions do not have sys/sioctl.h.
-  For a given version of the system, this may depend on whether you have
-  X Windows or TCP/IP.  Define or undefine NO_SIOCTL_H in config.h
-  according to whether you have the file.
-
-  Likewise, some versions have been known to need sys/ttold.h, sys/stream.h,
-  and sys/ptem.h included in sysdep.c.  If your system has these files,
-  try defining NEED_PTEM_H in config.h if you have trouble without it.
-
   You may find that adding -I/usr/X/include or -I/usr/netinclude or both
   to CFLAGS avoids compilation errors on certain systems.
 
@@ -276,14 +133,13 @@ Intel 386 (i386-*-freebsd,      i386-*-linux-gnu,
   but define `struct tc' instead; add `#define tchars tc'
   to config.h to solve this problem.
 
-Iris 4D (mips-sgi-irix6.*)
+** Iris 4D (mips-sgi-irix6.*)
 
   Emacs 21.3 is reported to work on IRIX 6.5.x.
 
   You can build a 64-bit executable (with larger maximum buffer size)
   on Irix 6.5 by specifying the 64-bit ABI using the `-64' compiler
-  flag or otherwise (see cc(1)).  This may work on earlier Irix 6
-  systems if you edit src/s/irix6-0.h following irix6-5.h.
+  flag or otherwise (see cc(1)).
 
   If compiling with GCC on Irix 6 yields an error "conflicting types
   for `initstate'", install GCC 2.95 or a newer version, and this
@@ -292,36 +148,7 @@ Iris 4D (mips-sgi-irix6.*)
   could also try reinstalling the same version of GCC, and telling us
   whether that fixes the problem.
 
-NCR Intel system (i386-ncr-sysv4.2)
-
-  This system works in 19.31, but if you don't link it with GNU ld,
-  you may need to set LD_RUN_PATH at link time to specify where
-  to find the X libraries.
-
-Prime EXL (i386-prime-sysv)
-
-  Minor changes merged in 19.1.
-
-Siemens Nixdorf RM600 and RM400 (mips-siemens-sysv4)
-
-  Changes merged in 19.29.  The version configured with
-  `--with-x' works without any modifications, but `--with-x-toolkit'
-  works only if the Athena library and the Toolkit library are linked
-  statically.  For this, edit `src/Makefile' after the `configure' run
-  and modify the lines with `-lXaw' and `-lXt' as follows:
-
-    LIBW= /usr/lib/libXaw.a
-    LIBXT= $(LIBW) -lXmu /usr/lib/libXt.a $(LIBXTR6) -lXext
-
-  In addition, `--with-x-toolkit=motif' works only
-  if the Motif library and the Toolkit library are linked statically.
-  To do this, edit `src/Makefile' after the `configure' run
-  and modify the lines with `-lXm' and `-lXt' as follows:
-
-    LIBW= /usr/lib/libXm.a /usr/ccs/lib/libgen.a
-    LIBXT= $(LIBW) -lXmu /usr/lib/libXt.a $(LIBXTR6) -lXext
-
-Sun 4 (sparc), Sun 386 (sparc-sun-solaris2.*,
+** Sun 4 (sparc), Sun 386 (sparc-sun-solaris2.*,
                               i386-sun-solaris2.*, sparc*-*-linux-gnu)
 
   To build a 32-bit Emacs (i.e. if you are having any sort of problem
@@ -369,16 +196,6 @@ Sun 4 (sparc), Sun 386 (sparc-sun-solaris2.*,
   As of release 2.95, GCC doesn't work properly with the 64-bit ABI
   (applicable on UltraSPARC), but that isn't the default mode.
 
-  Emacs 20.3 fails to build on Solaris 2.5 if you use GCC 2.7.2.3.
-  Installing GCC 2.8 fixes the problem.
-
-  19.32 works on Solaris 2.4 and 2.5.  On Solaris 2.5
-  you may need one of these patches to prevent Emacs from crashing
-  when it starts up:
-        103093-03: [README] SunOS 5.5: kernel patch (2140557 bytes)
-        102832-01: [README] OpenWindows 3.5: Xview Jumbo Patch (4181613 bytes)
-       103242-04: [README] SunOS 5.5: linker patch (595363 bytes)
-
   There are reports that using SunSoft cc with -xO4 -xdepend produces
   bad code for some part of Emacs.
 
@@ -390,11 +207,6 @@ Sun 4 (sparc), Sun 386 (sparc-sun-solaris2.*,
   for transferring text between clients.  The Cut, Paste and Copy items
   in the menu bar Edit menu work with the clipboard.
 
-  A user reported irreproducible segmentation faults when using 19.29
-  on Solaris 2.3 and 2.4 after compiling it with the Sun compiler.
-  The problem went away when GCC 2.7.0 was used instead.  We do not know
-  whether anything in Emacs is partly to blame for this.
-
   If you compile with Sun's ANSI compiler acc, you need additional options
   when linking temacs, such as
      /usr/lang/SC2.0.1/values-Xt.o -L/usr/lang/SC2.0.1/cg87 -L/usr/lang/SC2.0.1
@@ -416,40 +228,23 @@ Sun 4 (sparc), Sun 386 (sparc-sun-solaris2.*,
 
   If you have trouble using open-network-stream, get the distribution
   of `bind' (the BSD name-server), build libresolv.a, and link Emacs
-  with -lresolv, by copying the #definition of LIBS_SYSTEM in
-  src/s/sunos4-1.h to src/config.h.  This problem is due to obsolete
-  software in the nonshared standard library.
+  with -lresolv, by editing LIBRESOLV in src/Makefile.  This problem is
+  due to obsolete software in the nonshared standard library.
 
-  Note that Emacs on a Sun is not really as big as it looks.
-  As dumped, it includes around 200k of zeros between the
-  original text section and the original data section
-  (now remapped as part of the text).  These are never
-  swapped in.
+  Note that Emacs on a Sun is not really as big as it looks.  As
+  dumped, it includes around 200k of zeros between the original text
+  section and the original data section (now remapped as part of the
+  text). These are never swapped in.
 
-SuperH (sh[34]*-*-linux-gnu)
+** SuperH (sh[34]*-*-linux-gnu)
 
   Emacs 23.0.60 was reported to work on GNU/Linux (October 2008).
   Tested on a little-endian sh4 system (cpu type SH7751R) running
   Gentoo Linux 2008.0.
 
-Tadpole 68K (m68k-tadpole-sysv)
-
-  Changes merged in 19.1.
-
-  You may need to edit Makefile to change the variables LIBDIR and
-  BINDIR from /usr/local to /usr/contrib.
-
-  To give movemail access to /usr/mail, you may need to execute
-
-    chmod 2755 etc/movemail; chgrp mail etc/movemail
+* Here are notes about some of the systems supported:
 
-Vaxen running Berkeley Unix (vax-dec-bsd4.1, vax-dec-bsd4.2, vax-dec-bsd4.3)
-
-  Works.
-\f
-Here are notes about some of the systems supported:
-
-Linux (actually GNU/Linux)
+** Linux (actually GNU/Linux)
 
   Most of the complete systems which use the Linux kernel are close
   enough to the GNU system to be considered variant GNU systems.  We
@@ -468,58 +263,22 @@ Linux (actually GNU/Linux)
   people to write more free software.  See the file LINUX-GNU in this
   directory for more explanation.
 
-Microport
-
-  See under "Intel 386".
-
-MSDOS
-
-  For installation on MSDOS, see the file INSTALL (search for `MSDOG',
-  near the end of the file).  See the "MS-DOS" chapter of the manual
-  for information about using Emacs on MSDOS.
-
-System V rel 4.0.3 and 4.0.4 (usg5.4)
+** Mac OS X
 
-  Supported, including shared libraries for ELF, but ptys do not work
-  because TIOCGPGRP fails to work on ptys (but Dell 2.2 seems to have
-  fixed this).  This failure is probably due to a misunderstanding of
-  the consequences of the POSIX spec: many system designers mistakenly
-  think that POSIX requires this feature to fail.  This is untrue;
-  ptys are an extension, and POSIX says that extensions *when used*
-  may change the action of standard facilities in any fashion.
-
-  If you get compilation errors about wrong number of
-  arguments to getpgrp, define GETPGRP_NO_ARG.
-
-  The standard C preprocessor may generate xmakefile incorrectly.  However,
-  /lib/cpp will work, so use `make CPP=/lib/cpp'.  Standard cpp
-  seems to work OK under Dell 2.2.
-
-  Some versions 3 and earlier of V.4, on the Intel 386 and 860, had
-  problems in the X11 libraries.  These prevent Emacs from working
-  with X.  You can use Emacs with X provided your copy of X is based
-  on X11 release 4 or newer, or is Dell's 2.2 (which is a 4.0.3).
-  Unfortunately, the only way you can tell whether your X11 library is
-  new enough is to try compiling Emacs to use X.  If emacs runs, your
-  X11 library is new enough.
+  For installation instructions see the file nextstep/INSTALL.
 
-  In this context, GSV4 and GSV4i are alternate names for X11R4.
-  OL2.* is X11R3 based.  OL3 is in between X11R3 and X11R4, and may or
-  may not work, depending on who made the Unix system.  If the library
-  libXol is part of the X distribution, then you have X11R3 and Emacs
-  won't work with X.
+** MSDOS
 
-  Most versions of V.4 support sockets.  If `/usr/lib/libsocket.so'
-  exists, your system supports them.  If yours does not, you must add
-  #undef HAVE_SOCKETS in config.h, after the inclusion of s-usg5-4.h.
-  (Any system that supports Internet should implement sockets.)
+  For installation on MSDOS, see the file msdos/INSTALL.
+  See the "MS-DOS" chapter of the manual for information about using
+  Emacs on MSDOS.
 
-Windows NT/95/98/ME/2000
+** MS-Windows NT/95/98/ME/2000
 
   For installation on all versions of the MS-Windows platform, see the
   file nt/INSTALL.
 
-X86_64 GNU/Linux
+** X86_64 GNU/Linux
 
   No special procedures should be needed to build a 64-bit Emacs.  To
   build a 32-bit Emacs, first ensure that the necessary 32-bit system
@@ -530,6 +289,9 @@ X86_64 GNU/Linux
 
   (using the location of the 32-bit X libraries on your system).
 
+\f
+* Obsolete platforms
+
 Support for the following obsolete platforms was removed in Emacs 23.1
 (the names in parentheses state the files in src/ that were removed):
 
@@ -622,7 +384,7 @@ Support for the following obsolete platforms was removed in Emacs 23.1
 
 \f
 Local variables:
-mode: text
+mode: outline
 fill-prefix: "  "
 End:
 
index 74291bab8abe6faa0cbbd65cbb10032155a22edf..16525c378e79ae133a5e4954c1d015ae2176bf1e 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
 GNU Emacs NEWS -- history of user-visible changes.
 
-Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+Copyright (C) 2010 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 Please send Emacs bug reports to bug-gnu-emacs@gnu.org.
 If possible, use M-x report-emacs-bug.
 
-This file is about changes in Emacs version 23.
+This file is about changes in Emacs version 24.
 
-See files NEWS.22, NEWS.21, NEWS.20, NEWS.19, NEWS.18, and NEWS.1-17
-for changes in older Emacs versions.
+See files NEWS.23, NEWS.22, NEWS.21, NEWS.20, NEWS.19, NEWS.18,
+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.
 
-\f
-* Installation Changes in Emacs 23.3
-
-* Startup Changes in Emacs 23.3
 
-* Changes in Emacs 23.3
+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
-* Editing Changes in Emacs 23.3
+* Installation Changes in Emacs 24.1
 
-\f
-* Changes in Specialized Modes and Packages in Emacs 23.3
+** Configure links against libselinux if it is found.
+You can disable this by using --without-selinux.
 
 ---
-** The appt-add command takes an optional argument for the warning time.
-This can be used in place of the default appt-message-warning-time.
-
-\f
-* New Modes and Packages in Emacs 23.3
-
-\f
-* Incompatible Lisp Changes in Emacs 23.3
-
-\f
-* Lisp changes in Emacs 23.3
-
-** New function byte-to-string, like char-to-string but for bytes.
-
-\f
-* Changes in Emacs 23.3 on non-free operating systems
-
-\f
-* Installation Changes in Emacs 23.2
-
-** New configure options for Emacs developers.
-These are not new features; only the configure flags are new.
-
-*** --enable-profiling builds Emacs with profiling enabled.
-This might not work on all platforms.
-
-*** --enable-checking[=OPTIONS] builds emacs with extra runtime checks.
-
-** `make install' now consistently ignores umask, creating a
-world-readable install.
-
-** Emacs compiles with Gconf support, if it is detected.
-Use the configure option --without-gconf to disable this.
-This is used by the `font-use-system-font' feature (see below).
-
-* Startup Changes in Emacs 23.2
-
-** The command-line option -Q (--quick) also inhibits loading X resources.
-However, if Emacs is compiled with the Lucid or Motif toolkit, X
-resource settings for the graphical widgets are still applied.
-On Windows, the -Q option causes Emacs to ignore Registry settings,
-but environment variables set on the Registry are still honored.
-
-*** The new variable `inhibit-x-resources' shows whether X resources
-were loaded.
-
-** New command-line option -mm (--maximized) maximizes the initial frame.
-
-* Changes in Emacs 23.2
-
-** The maximum size of buffers (and the largest fixnum) is doubled.
-On typical 32bit systems, buffers can now be up to 512MB.
-
-** The default value of `trash-directory' is now nil.
-This means that `move-file-to-trash' trashes files according to
-freedesktop.org specifications, the same method used by the Gnome,
-KDE, and XFCE desktops.  (This change has no effect on Windows, which
-uses `system-move-file-to-trash' for trashing.)
-
-** The pointer now becomes invisible when typing.
-Customize `make-pointer-invisible' to disable this feature.
-
-** Font changes
-
-*** Emacs can use the system default monospaced font in Gnome.
-To enable this feature, set `font-use-system-font' to non-nil (it is
-nil by default).  If the system default changes, Emacs changes also.
-This feature requires Gconf support, which is automatically included
-at compile-time if configure detects the gconf libraries (you can
-disable this with the configure option --without-gconf).
-
-*** On X11, Emacs reacts to Xft changes made by configuration tools,
-via the XSETTINGS mechanism.  This includes antialias, hinting,
-hintstyle, RGBA, DPI and lcdfilter changes.
-
-** Killing a buffer with a running process now asks for confirmation.
-To remove this query, remove `process-kill-buffer-query-function' from
-`kill-buffer-query-functions', or set the appropriate process flag
-with `set-process-query-on-exit-flag'.
-
-** File-local variable changes
+** By default, the installed Info and man pages are compressed.
+You can disable this by configuring --without-compress-info.
 
-*** Specifying a minor mode as a local variables enables that mode,
-unconditionally.  The previous behavior, toggling the mode, was
-neither reliable nor generally desirable.
-
-*** There are new commands for adding and removing file-local variables:
-`add-file-local-variable', `delete-file-local-variable',
-`add-file-local-variable-prop-line', and
-`delete-file-local-variable-prop-line'.
-
-*** There are new commands for adding and removing directory-local variables,
-and copying them to and from file-local variable lists:
-`add-dir-local-variable', `delete-dir-local-variable',
-`copy-dir-locals-to-file-locals',
-`copy-dir-locals-to-file-locals-prop-line' and
-`copy-file-locals-to-dir-locals'.
-
-** Internationalization changes
-
-*** Unibyte sessions are now considered obsolete.
-This refers to the EMACS_UNIBYTE environment variable as well as the
---unibyte, --multibyte, --no-multibyte, and --no-unibyte command line
-arguments.  Customizing enable-multibyte-characters and setting
-default-enable-multibyte-characters are also deprecated.
+---
+** There are new configure options:
+--with-mmdf, --with-mail-unlink, --with-mailhost.
+These provide no new functionality, they just remove the need to edit
+lib-src/Makefile by hand in order to use the associated features.
 
-*** New coding system `utf-8-hfs'.
-This is suitable for default-file-name-coding-system on Mac OS X; see
-international/ucs-normalize.el.
+---
+** There is a new configure option --with-crt-dir.
+This is only useful if your crt*.o files are in a non-standard location.
 
-** Function arguments in *Help* buffers are now shown in upper-case.
-Customize `help-downcase-arguments' to t to show them in lower-case.
+---
+** Emacs can be compiled against Gtk+ 3.0 if you pass --with-x-toolkit=gtk3
+to configure.  Note that other libraries used by Emacs, RSVG and GConf,
+also depend on Gtk+.  You can disable them with --without-rsvg and
+--without-gconf.
 
-** New command `async-shell-command', bound globally to `M-&'.
-This executes the command asynchronously, similar to calling `M-!' and
-manually adding an ampersand to the end of the command.  With `M-&',
-you don't need the ampersand.  The output appears in the buffer
-`*Async Shell Command*'.
+** There is a new configure option --enable-use-lisp-union-type.
+This is only useful for Emacs developers to debug certain types of bugs.
+These is not a new feature; only the configure flag is new.
 
-** When running in a new enough xterm (newer than version 242), Emacs
-asks xterm what the background color is and it sets up faces
-accordingly for a dark background if needed (the current default is to
-consider the background light).
+---
+** New translation of the Emacs Tutorial in Hebrew is available
+Type `C-u C-h t' to choose it in case your language setup doesn't
+automatically select it.
 
 \f
-* Editing Changes in Emacs 23.2
-
-** Kill-ring and selection changes
-
-*** If `select-active-regions' is t, any active region automatically
-becomes the primary selection (for interaction with other window
-applications).  If you enable this, you might want to bind
-`mouse-yank-primary' to Mouse-2.
-
-*** When `save-interprogram-paste-before-kill' is non-nil, the kill
-commands save the interprogram-paste selection into the kill ring
-before doing anything else.  This avoids losing the selection.
-
-*** When `kill-do-not-save-duplicates' is non-nil, identical
-subsequent kills are not duplicated in the `kill-ring'.
-
-** Completion changes
-
-*** The new command `completion-at-point' provides mode-sensitive completion.
-
-*** tab-always-indent set to `complete' lets TAB do completion as well.
-
-*** The new completion-style `initials' is available.
-For instance, this can complete M-x lch to list-command-history.
+* Startup Changes in Emacs 24.1
 
-*** The new variable `completions-format' determines how completions
-are displayed in the *Completions* buffer.  If you set it to
-`vertical', completions are sorted vertically in columns.
-
-** The default value of `blink-matching-paren-distance' is increased.
-
-** M-n provides more default values in the minibuffer for commands
-that read file names.  These include the file name at point (when ffap
-is loaded without ffap-bindings), the file name on the current line
-(in Dired buffers), and the directory names of adjacent Dired windows
-(for Dired commands that operate on several directories, such as copy,
-rename, or diff).
-
-** M-r is bound to the new `move-to-window-line-top-bottom'.
-This moves point to the window center, top and bottom on successive
-invocations, in the same spirit as the C-l (recenter-top-bottom)
-command.
-
-** The new variable `recenter-positions' determines the default
-cycling order of C-l (`recenter-top-bottom').
-
-** The abbrevs file is now a file named abbrev_defs in
-user-emacs-directory; but the old location, ~/.abbrev_defs, is used if
-that file exists.
+** The --unibyte, --multibyte, --no-multibyte, and --no-unibyte
+command line arguments no longer have any effect.  (They were declared
+obsolete in Emacs 23.)
 
 \f
-* Changes in Specialized Modes and Packages in Emacs 23.2
-
-** The bookmark menu has a narrowing search via bookmark-bmenu-search.
-
-** Calc
-
-*** The Calc settings file is now a file named calc.el in
-user-emacs-directory; but the old location, ~/.calc.el, is used if
-that file exists.
+* Changes in Emacs 24.1
 
-*** Graphing commands (`g f' etc.) now work on MS-Windows, if you have
-the native Windows port of Gnuplot version 3.8 or later installed.
+** New emacsclient argument --parent-id ID can be used to open a
+client frame in parent X window ID, via XEmbed.  This works like the
+--parent-id argument to Emacs.
 
-** Calendar and diary
+** Completion can cycle, depending on completion-cycle-threshold.
 
-*** Fancy diary display is now the default.
-If you prefer the simple display, customize `diary-display-function'.
+** auto-mode-case-fold is now enabled by default.
 
-*** The diary's fancy display now enables view-mode.
++++
+** Emacs now supports display and editing of bidirectional text.
 
-*** The command `calendar-current-date' accepts an optional argument
-giving an offset from today.
+See the node "Bidirectional Editing" in the Emacs Manual for some
+initial documentation.
 
-** Desktop
+To turn this on in any given buffer, set the buffer-local variable
+`bidi-display-reordering' to a non-nil value.  The default is nil.
 
-*** The default value for `desktop-buffers-not-to-save' is nil.
-This means Desktop will try restoring all buffers, when you restart
-your Emacs session.  Also, `desktop-buffers-not-to-save' is only
-effective for buffers that have no associated file.  If you want to
-exempt buffers that do correspond to files, customize the value of
-`desktop-files-not-to-save' instead.
+The buffer-local variable `bidi-paragraph-direction', if non-nil,
+forces each paragraph in the buffer to have its base direction
+according to the value of this variable.  Possible values are
+`right-to-left' and `left-to-right'.  If the value is nil (the
+default), Emacs determines the base direction of each paragraph from
+its text, as specified by the Unicode Bidirectional Algorithm.
 
-** Dired
+The function `current-bidi-paragraph-direction' returns the actual
+value of paragraph base direction at point.
 
-*** The new variable `dired-auto-revert-buffer', if non-nil, causes
-Dired buffers to be reverted automatically on revisiting them.
+Reordering of bidirectional text for display in Emacs is a "Full
+bidirectionality" class implementation of the Unicode Bidirectional
+Algorithm.
 
-** DocView
+Note that some advanced display features, such as overlay strings and
+`display' text properties, do not yet work correctly when
+bidirectional text is reordered for display.
 
-*** When `doc-view-continuous' is non-nil, scrolling a line
-on the page edge advances to the next/previous page.
+** GTK scroll-bars are now placed on the right by default.
+Use `set-scroll-bar-mode' to change this.
 
-** Elint
+** GTK tool bars can have just text, just images or images and text.
+Customize `tool-bar-style' to choose style.  On a Gnome desktop, the default
+is taken from the desktop settings.
 
-*** Elint now uses compilation-mode.
+** GTK tool bars can be placed on the left/right or top/bottom of the frame.
+The frame-parameter tool-bar-position controls this.  It takes the values
+top, left, right or bottom.  The Options => Show/Hide menu has entries
+for this.
 
-*** Elint can now scan individual files and whole directories,
-and can be run in batch mode.
+** ImageMagick support
+It is now possible to use the Imagemagick library to load many new
+image formats in Emacs.
 
-*** Elint does a more thorough initialization, and recognizes more built-in
-functions and variables.  Customize `elint-scan-preloaded' if you want
-to sacrifice some accuracy for a faster startup.
+To enable, use the following configure option:
+--with-imagemagick
 
-*** Elint attempts some basic understanding of featurep and (f)boundp tests.
+The new function (imagemagick-types) returns a list of image file
+extensions that your installation of imagemagick supports.
 
-*** Customize `elint-ignored-warnings' to suppress some warnings.
+The function (imagemagick-register-types) will enable the imagemagick
+support for the extensions in imagemagick-types minus the types listed
+in imagemagick-types-inhibit.
 
-** GDB-UI
+See the Emacs Manual for more information.
 
-*** Toolbar functionality for reverse debugging.  Display of STL
-collections as watch expressions.  These features require GDB 7.0 or later.
+** The colors for selected text (the region face) are taken from the GTK
+theme when Emacs is built with GTK.
 
-** Grep
+** Emacs uses GTK tooltips by default if built with GTK.  You can turn that
+off by customizing x-gtk-use-system-tooltips.
 
-*** A new command `zrgrep' searches recursively in gzipped files.
+** Lucid menus and dialogs can display antialiased fonts if Emacs is built
+with Xft.
 
-** Info
+** Basic SELinux support has been added.
+This requires Emacs to be linked with libselinux at build time.
 
-*** The new command `Info-virtual-index' bound to "I" displays a menu of
-matched topics found in the index.
+*** Emacs preserves the SELinux file context when backing up, and
+optionally when copying files. To this end, copy-file has an extra
+optional argument, and backup-buffer and friends include the SELinux
+context in their return values.
 
-*** The new command `info-finder' replaces finder.el with a virtual Info
-manual that generates an Info file which gives the same information
-through a menu structure.
+*** The new functions file-selinux-context and set-file-selinux-context
+get and set the SELinux context of a file.
 
-** LaTeX mode now provides completion (via completion-at-point).
+*** Tramp offers handlers for file-selinux-context and set-file-selinux-context
+for remote machines which support SELinux.
 
-** Message mode is now the default mode for composing mail.
+** New scrolling commands `scroll-up-command' and `scroll-down-command'
+(bound to C-v/[next] and M-v/[prior]) does not signal errors at top/bottom
+of buffer at first key-press (instead moves to top/bottom of buffer)
+when a new variable `scroll-error-top-bottom' is non-nil.
 
-The default for `mail-user-agent' is now message-user-agent, so the
-C-x m (`compose-mail') command uses Message mode instead of Mail mode.
+** New scrolling commands `scroll-up-line' and `scroll-down-line'
+scroll a line instead of full screen.
 
-Message mode has been included in Emacs, as part of the Gnus package,
-for several years.  It provides several features that are absent in
-Mail mode, such as MIME handling.
+** New property `scroll-command' should be set on a command's symbol to
+define it as a scroll command affected by `scroll-preserve-screen-position.
 
-*** If the user has not customized mail-user-agent, `compose-mail'
-checks for Mail mode customizations, and issues a warning if these
-customizations are found.  This alerts users who may otherwise be
-unaware that their mail configuration has changed.
+** Trash changes
 
-To disable this check, set compose-mail-user-agent-warnings to nil.
+*** `delete-by-moving-to-trash' now only affects commands that specify
+trashing.  This avoids inadvertently trashing temporary files.
 
-** The default value of mail-interactive is t, since Emacs 23.1.
-(This was not announced at the time.)  It means that when sending mail,
-Emacs will wait for the process sending mail to return.  If you
-experience delays when sending mail, you may wish to set this to nil.
+*** Calling `delete-file' or `delete-directory' with a prefix argument
+now forces true deletion, regardless of `delete-by-moving-to-trash'.
 
-** nXML mode is now the default for editing XML files.
+** New option `list-colors-sort' defines the color sort order
+for `list-colors-display'.
 
-** pcomplete provides a new command `pcomplete-std-completion' which
-is similar to `pcomplete' but using the standard completion UI code.
-
-** Shell (and other comint modes)
-
-*** M-s is no longer bound to `comint-next-matching-input'.
-
-*** M-r is now bound to `comint-history-isearch-backward-regexp'.
-This starts an incremental search of the comint/shell input history.
-
-*** ansi-color is now enabled by default in Shell mode.
-To disable it, set ansi-color-for-comint-mode to nil.
-
-** Tramp
-
-*** New connection methods "rsyncc", "imap" and "imaps".
-On systems which support GVFS-Fuse, Tramp offers also the new
-connection methods "dav", "davs", "obex" and "synce".
-
-** VC and related modes
+** An Emacs Lisp package manager is now included.
+This is a convenient way to download and install additional packages,
+from elpa.gnu.org.
 
-*** When using C-x v v or C-x v i on a unregistered file that is in a
-directory not controlled by any VCS, ask the user what VC backend to
-use to create a repository, create a new repository and register the
-file.
+*** `M-x list-packages' shows a list of packages, which can be
+selected for installation.
 
-*** New command `vc-root-print-log', bound to `C-x v L'.
-This displays a `*vc-change-log*' buffer showing the history of the
-version-controlled directory tree as a whole.
+*** New command `describe-package', bound to `C-h P'.
 
-*** New command `vc-root-diff', bound to `C-x v D'.
-This is similar to `vc-diff', but compares the entire directory tree
-of the current VC directory with its working revision.
-
-*** `C-x v l' and `C-x v L' do not show the full log by default.
-The number of entries shown can be chosen interactively with a prefix
-argument, or by customizing vc-log-show-limit.  The `*vc-change-log*'
-buffer now contains buttons at the end of the buffer, which can be
-used to increase the number of entries shown.  RCS, SCCS, and CVS do
-not support this feature.
-
-*** vc-annotate supports annotations through file copies and renames,
-it displays the old names for the files and it can show logs/diffs for
-the corresponding lines.  Currently only Git and Mercurial take
-advantage of this feature.
-
-*** The log command in vc-annotate can display a single log entry
-instead of redisplaying the full log.  The RCS, CVS and SCCS VC
-backends do not support this.
-
-*** When a file is not found, VC will not try to check it out of RCS anymore.
-
-*** Diff and log operations can be used from Dired buffers.
-
-*** vc-git changes
-
-**** The short log format for git makes use of the graph display,
-so it's not supported on git versions earlier than 1.5.6.
-
-**** vc-dir uses the --relative option of git, and so requires at least
-git version 1.5.5.
-
-**** Support for operating with stashes has been added to vc-dir:
-the stash list is displayed in the *vc-dir* header, stashes can be
-created, removed, applied and their content displayed.
-
-*** vc-bzr supports operating with shelves: the shelve list is
-displayed in the *vc-dir* header, shelves can be created, removed and applied.
-
-*** log-edit-strip-single-file-name controls whether or not single filenames
-are stripped when copying text from the ChangeLog to the *VC-Log* buffer.
-
-** Miscellaneous
-
-*** Interactively `multi-isearch-buffers' and `multi-isearch-buffers-regexp'
-read buffer names to search, one by one, ended with RET.  With a prefix
-argument, they ask for a regexp, and search in buffers whose names match
-the specified regexp.  Interactively `multi-isearch-files' and
-`multi-isearch-files-regexp' read file names to search, one by one,
-ended with RET.  With a prefix argument, they ask for a wildcard, and
-search in file buffers whose file names match the specified wildcard.
-
-*** Autorevert Tail mode now works also for remote files.
-
-*** The new eshell built-in commands `su' and `sudo' support Tramp.
-Thus, they change `default-directory' to reflect the new user id, and
-let commands run under that user's permissions.  This works even when
-`default-directory' is already remote.  Calling the external commands
-is possible via `*su' or `*sudo', respectively.
-
-** Obsolete packages
-
-*** sym-comp.el is now obsolete, superseded by completion-at-point.
-
-*** lucid.el and levents.el are now obsolete.
-
-\f
-* New Modes and Packages in Emacs 23.2
-
-** CEDET (the Collection of Emacs Development Tools) is now in Emacs.
-This is a collection of packages to aid with using Emacs as an IDE
-(integrated development environment):
-
-*** The Semantic package allows the use of parsers to intelligently
-edit and navigate source code.  Parsers for C/C++, Java, Javascript,
-and several other languages are included by default, and Semantic can
-also interface with external tools such as GNU Global and GNU Idutils.
-
-To enable Semantic, use the global minor mode `semantic-mode'.
-See the Semantic manual for details.
-
-*** EDE (Emacs Development Environment) is a package for managing code
-projects, including features such as automatic Makefile generation.
-
-To enable EDE, use the minor mode `global-ede-mode'.
-See the EDE manual for details.
-
-*** SRecode is a library for recoding Semantic tags back into source
-code.  It is currently used by some parts of Semantic and EDE; in the
-future, it may be used for code generation features.
-
-*** The EIEIO library implements a subset of the Common Lisp Object
-System (CLOS).  It is used by the other CEDET packages.
-
-** mpc.el is a front end for the Music Player Daemon.  Run it with M-x mpc.
-
-** htmlfontify.el turns a fontified Emacs buffer into an HTML page.
-
-** js.el is a new major mode for JavaScript files.
-
-** imap-hash.el is a new library to address IMAP mailboxes as hashtables.
+*** By default, all installed packages are loaded and activated
+automatically when Emacs starts up.  To disable this, set
+`package-enable-at-startup' to nil.  To change which packages are
+loaded, customize `package-load-list'.
 
 \f
-* Incompatible Lisp Changes in Emacs 23.2
-
-** The Lisp reader turns integers that are too large/small into floats.
-For instance, on machines where `536870911' is the largest integer,
-reading `536870912' gives the floating-point object `536870912.0'.
-
-This change only concerns the Lisp reader; it does not affect how
-actual integer objects overflow.
-
-** Several obsolete functions removed.
-The functions have been obsolete since Emacs 19, and are unlikely to
-be in use:
-
-  time-stamp-month-dd-yyyy, time-stamp-dd/mm/yyyy, time-stamp-mon-dd-yyyy
-  time-stamp-dd-mon-yy, time-stamp-yy/mm/dd, time-stamp-yyyy/mm/dd,
-  time-stamp-yyyy-mm-dd, time-stamp-yymmdd, time-stamp-hh:mm:ss,
-  time-stamp-hhmm, baud-rate
-
-** Support for generating Emacs 18 compatible bytecode (by setting
-the variable `byte-compile-compatibility') has been removed.
-
-** In image-mode.el `image-mode-maybe' is obsolete.
-Instead, you can either use `image-mode' (which displays an image file
-as the actual image initially), or `image-mode-as-text' (when you want
-to display an image file as text initially).  `image-mode-as-text' is a
-combination of a non-image mode from `auto-mode-alist' (or Fundamental
-mode) and `image-minor-mode'.  `image-minor-mode' provides a `C-c C-c'
-key binding to toggle image display.
-`image-toggle-display-text' removes image properties.
-`image-toggle-display-image' adds image properties.
-`image-toggle-display' toggles between `image-mode-as-text' and `image-mode'.
+* Editing Changes in Emacs 24.1
 
-\f
-* Lisp changes in Emacs 23.2
+** completion-at-point is now an alias for complete-symbol.
 
-** All the default-FOO variables that hold the default value of the FOO
-variable, are now declared obsolete.
+** mouse-region-delete-keys has been deleted.
 
-** read-key is a function halfway between read-event and read-key-sequence.
-It reads a single key, but obeys input and escape sequence decoding.
+** Deletion changes
 
-** Frame parameter changes
+*** New option `delete-active-region'.
+If non-nil, C-d, [delete], and DEL delete the region if it is active
+and no prefix argument is given.  If set to `kill', these commands
+kill instead.
 
-*** You can give the `fullscreen' frame parameter the value `maximized'.
-This maximizes the frame.
+*** New command `delete-forward-char', bound to C-d and [delete].
+This is meant for interactive use, and obeys `delete-active-region';
+delete-char, meant for Lisp, does not obey `delete-active-region'.
 
-*** The new frame parameter `sticky' makes Emacs frames sticky in
-virtual desktops.
+*** `delete-backward-char' is now a Lisp function.
+Apart from obeying `delete-active-region', its behavior is unchanged.
+However, the byte compiler now warns if it is called from Lisp; you
+should use delete-char with a negative argument instead.
 
-** Completion changes
+*** The option `mouse-region-delete-keys' has been deleted.
 
-*** completion-base-size is obsoleted by completion-base-position.
-This change causes a few backward incompatibilities, mostly with
-choose-completion-string-functions where the `mini-p' argument has
-been replaced by a `base-position' argument, and where the `base-size'
-argument is now always nil.
+** Selection changes.
 
-*** New function `completion-in-region' to use the standard completion
-facilities on a particular region of text.
+The default handling of clipboard and primary selections has been
+changed to conform with other X applications.
 
-*** The 4th arg to all-completions (aka hide-spaces) is declared obsolete.
+*** `select-active-regions' now defaults to t, so active regions set
+the primary selection.
 
-*** completion-annotate-function specifies how to compute annotations
-for completions displayed in *Completions*.
+It also accepts a new value, `lazy', which means to only set the
+primary selection for temporarily active regions (usually made by
+mouse-dragging or shift-selection).
 
-** Minibuffer changes
+*** `mouse-2' is now bound to `mouse-yank-primary'.
 
-*** read-file-name-predicate is obsolete.  It was used to pass the predicate
-to read-file-name-internal because read-file-name-internal abused its `pred'
-argument to pass the current directory, but this hack is not needed
-any more.
+*** `x-select-enable-clipboard' now defaults to t.
+Thus, killing and yanking now use the clipboard (in addition to the
+kill ring).
 
-** Changes to file-manipulation functions
+*** `x-select-enable-primary' now defaults to nil.
 
-*** `delete-directory' has an optional parameter RECURSIVE.
-
-*** New function `copy-directory', which copies a directory recursively.
-
-** called-interactively-p now takes one argument and replaces interactive-p
-which is now marked obsolete.
-
-** New function set-advertised-calling-convention makes it possible
-to obsolete arguments as well as make some arguments mandatory.
-
-** You can control which binding is preferentially shown in menus and
-docstrings by adding a `:advertised-binding' property to the corresponding
-command's symbol.  That property can hold a single binding or a list
-of bindings.
-
-** Network and process changes
-
-*** start-process-shell-command and start-file-process-shell-command
-now only take a single `command' argument.
-
-*** The new variable `process-file-side-effects' should be set to nil
-if a `process-file' call does not change a remote file.  This allows
-file name handlers such as Tramp to optimizations.
-
-*** make-network-process can now also create `seqpacket' Unix sockets.
-
-** Loading changes
-
-*** eval-next-after-load is obsolete.
-
-*** New hook `after-load-functions' run after loading an Elisp file.
-
-** Byte compilation changes
-
-*** Changing the file-names generated by byte-compilation by redefining
-the function `byte-compile-dest-file' before loading bytecomp.el is obsolete.
-Instead, customize byte-compile-dest-file-function.
-
-*** `byte-compile-warnings' has new members, `constants' and `suspicious'.
-
-** New macro with-silent-modifications to tweak text properties without
-affecting the buffer's modification state.
-
-** Hash tables have a new printed representation that is readable.
-The feature `hashtable-print-readable' identifies this new
-functionality.
-
-** New functions for performing Unicode normalization:
-ucs-normalize-NFD-region, ucs-normalize-NFD-string,
-ucs-normalize-NFC-region, ucs-normalize-NFC-string,
-ucs-normalize-NFKD-region, ucs-normalize-NFKD-string,
-ucs-normalize-NFKC-region, ucs-normalize-NFKC-string,
-ucs-normalize-HFS-NFD-region, ucs-normalize-HFS-NFD-string,
-ucs-normalize-HFS-NFC-region, ucs-normalize-HFS-NFC-string.
-
-** Face aliases can now be marked as obsolete, using the macro
-`define-obsolete-face-alias'.
-
-** New function `window-full-height-p', analogous to the full-width version.
-
-\f
-* Changes in Emacs 23.2 on non-free operating systems
-
-** On MS-Windows, `display-time' now displays the system load average
-as well as the time, as it does on GNU and Unix.
+*** `mouse-drag-copy-region' now defaults to nil.
 
 \f
-* Installation Changes in Emacs 23.1
-
-** The default X toolkit is now Gtk+, rather than Lucid.
-The configure option `--with-gtk' has been removed.  Gtk is now the
-default toolkit, but you can use --with-x-toolkit=gtk if necessary.
-
-** New font code.
-Fonts are handled by new code capable of dealing with multiple font
-backends.  This uses the freetype and fontconfig libraries.
-
-*** Emacs now accepts font names supplied in the fontconfig format
-(e.g. "monospace-12:bold") and GTK format (e.g. "Monospace Bold 12").
-
-*** Added support for local fonts (fonts installed on the machine
-where Emacs is running).
-
-*** Added support for the Xft library for antialiasing.
-
-*** Added support for the otf library for complex text layout by
-OpenType fonts.
-
-*** Added support for the m17n library for text shaping.
-
-** Changes to image support
-
-*** configure now checks for libgif before libungif when searching for
-a GIF library.
+* Changes in Specialized Modes and Packages in Emacs 24.1
 
-*** Emacs now supports the SVG image format through librsvg2.
+** FIXME: xdg-open for browse-url and reportbug, 2010/08.  (Close bug#4546?)
 
-*** Emacs now supports multi-page TIFF images.
+** Archive Mode has basic support to browse 7z archives.
 
-** New NeXTSTEP-based port.
-This provides support for GNUstep (via the GNUstep libraries) and Mac
-OS X (via the Cocoa libraries).
+** ERC changes
 
-Specify --with-ns to configure for this.  By default, a self-contained
-app will be built (containing all lisp).  To install/share lisp with
-other emacsen (e.g. X11 build) use --disable-ns-self-contained.  See
-nextstep/README and nextstep/INSTALL in the Emacs source directory.
+*** New vars `erc-autojoin-timing' and `erc-autojoin-delay'.
+If the value of `erc-autojoin-timing' is 'ident, ERC autojoins after a
+successful NickServ identification, or after `erc-autojoin-delay'
+seconds.  The default value, 'ident, means to autojoin immediately
+after connecting.
 
-** Mac OS X is no longer supported via Carbon.
-Use the NeXTSTEP port, described above.
+** In ido-mode, C-v is no longer bound to ido-toggle-vc.
+The reason is that this interferes with cua-mode.
 
-** The new configuration option "--with-dbus" enables D-Bus language
-bindings for Emacs.
+** partial-completion-mode is now obsolete.
+You can get a comparable behavior with:
+(setq completion-styles '(partial-completion initials))
+(setq completion-pcm-complete-word-inserts-delimiters t)
 
-** Support for many obsolete platforms has been removed.
-See the list at the end of etc/MACHINES for details.
+** mpc.el: Can use pseudo tags of the form tag1|tag2 as a union of two tags.
+** Customize
 
-*** Support for systems without alloca has been removed.
+*** Customize buffers now contain a search field.
+The search is performed using `customize-apropos'.
+To turn off the search field, set custom-search-field to nil .
 
-*** Support for Sun windows has been removed.
+*** Custom options now start out hidden if at their default values.
+Use the arrow to the left of the option name to toggle visibility.
 
-*** The `emacstool' utility has been removed.
+*** custom-buffer-sort-alphabetically now defaults to t.
 
-** The following platforms will be removed in a future Emacs version:
-If you are still using Emacs on one of these platforms, please email
-emacs-devel@gnu.org to inform the Emacs developers.
+*** The color widget now has a "Choose" button, which allows you to
+choose a color via list-colors-display.
 
-*** Old GNU/Linux systems based on libc version 5.
+** Dired-x
 
-*** Old FreeBSD, NetBSD, and OpenBSD systems based on the COFF
-executable format.
+*** dired-jump and dired-jump-other-window called with a prefix argument
+read a file name from the minibuffer instead of using buffer-file-name.
 
-*** Solaris versions 2.6 and below.
-
-*** Solaris on IBM RS6000 machines.
-
-*** UNIX System V (the original SysV, not later platforms based on it).
-
-*** Unixware on non-x86 machines.
-
-*** Platforms not supporting shared libraries (i.e., requiring the
-NO_SHARED_LIBS compilation flag).
-
-** The configure options `--with-gcc', `--without-gcc' have been removed.
-Configure will use gcc by default.  Set the CC environment variable if
-you need control over which C compiler is used.
-
-** The refcards are now shipped as PDF files.
-
-** The manuals are now licensed under the GNU Free Documentation License v1.3,
-or any later version.
-
-** Emacs 23 comes with a new set of default icons.
-Various resolutions are available as etc/images/icons/hicolor/*/apps/emacs.png.
-The Emacs 22 icon is available as `emacs22.png' in the same location.
-\f
-* Changes in Emacs 23.1
-
-** Improved X Window System support
-
-*** Emacs now supports using both X displays and ttys in one session.
-With an Emacs server active (M-x server-start), `emacsclient -t'
-creates a tty frame connected to the running emacs server.  You can
-use any number of different ttys.  `emacsclient -c' creates a new X11
-frame on the current $DISPLAY (or a tty frame if $DISPLAY is not set).
-There may be problems if a display exits unexpectedly and Emacs is compiled
-with Gtk+, see etc/PROBLEMS.
-
-You can test for the presence of this feature in your Lisp code by
-testing for the `multi-tty' feature.
-
-*** Emacs starts in the background, as a daemon, when given the
---daemon command line argument.  It disconnects from the terminal and
-starts the server.  Clients can connect and create graphical or
-terminal frames using emacsclient.
-
-**** emacsclient starts emacs in daemon mode and connects to it when
---alternate-editor="" is used (or when the evironment variable
-ALTERNATE_EDITOR is set to "") and emacsclient cannot connect to an
-emacs server.
-
-*** The new command close-display-connection closes a connection to a
-remote display.  There are some bugs for Gtk+.  See etc/PROBLEMS.
-
-*** Emacs now supports the XEmbed specification.
-You can embed Emacs in another application on X11.  The new command line
-option --parent-id is used to pass the parent window id to Emacs.  See
-http://standards.freedesktop.org/xembed-spec/xembed-spec-latest.html
-for details about XEmbed.
-
-*** Emacs can now set the frame opacity.
-The opacity of a frame can be controlled by setting the `alpha' frame
-parameter.  This only takes effect on a compositing window manager for
-the X Window System, such as Compiz, Beryl and Compiz Fusion, on Mac
-OS X, or on Windows 2000 and later versions of Windows.
-
-The alpha parameter should be an integer between 0 (transparent) and
-100 (opaque), or a float number between 0.0 and 1.0.  It can also be a
-cons cell (ACTIVE . INACTIVE), where ACTIVE is the opacity of an
-active frame and INACTIVE is the opacity of non-active frames.
-
-The variable `frame-alpha-lower-limit' defines a lower bound for the
-opacity; the default is 20.
-
-** Internationalization changes
-
-*** The Emacs character set is now a superset of Unicode.
-(It has about four times the code space, which should be plenty).
-
-The internal encoding used for buffers and strings is now
-Unicode-based and called `utf-8-emacs' (`emacs-internal' is an alias
-for this).  This encoding is backward-compatible with Unicode's UTF-8
-encoding.  The internal encoding previously used by Emacs,
-`emacs-mule', is still available for reading and writing files.
-
-During byte-compilation, Emacs 23 uses `utf-8-emacs' to write files.
-As a result, byte-compiled files containing non-ASCII characters can't
-be read by earlier versions of Emacs.  Files compiled by Emacs 20, 21,
-or 22 are loaded correctly as `emacs-mule' (whether or not they
-contain multibyte characters).  This takes somewhat more time, so it
-may be worth recompiling existing .elc files which don't need to be
-shared with older Emacsen.
-
-*** There are new coding systems/aliases; see M-x list-coding-systems.
-
-*** There is a new charset implementation with many new charsets.
-See M-x list-character-sets.  New charsets can be defined conveniently
-as tables of unicodes.
-
-*** There are new language environments for Chinese-GBK,
-Chinese-GB18030, Khmer, Bengali, Punjabi, Gujarati, Oriya, Telugu,
-Sinhala, and TaiViet.
+** VC and related modes
 
-*** The minor modes unify-8859-on-encoding-mode and
-unify-8859-on-decoding-mode are obsolete.
+*** New VC commands: vc-log-incoming, vc-log-outgoing, vc-find-conflicted-file.
 
-*** `ucs-insert' is bound to `C-x 8 RET' and in addition to hex numbers
-accepts numbers in hash notation (e.g. #o21430 for octal, or #10r8984 for
-decimal).  It also accepts Unicode character names with completion.
+**** vc-log-incoming for Git runs "git fetch" so that the necessary
+data is available locally.
+
+**** vc-log-incoming and vc-log-outgoing for Git require version 1.7 (or newer).
+
+*** New key bindings: C-x v I and C-x v O bound to vc-log-incoming and
+vc-log-outgoing, respectively.
+
+*** vc-dir for Bzr supports viewing shelve contents and shelving snapshots.
+
+*** Special markup can be added to log-edit buffers.
+The log-edit buffers are expected to have a format similar to email messages
+with headers of the form:
+  Author: <author of this change>
+  Summary: <one line summary of this change>
+  Fixes: <reference to the bug fixed by this change>
+Some backends handle some of those headers specially, but any unknown header
+is just left as is in the message, so it is not lost.
+
+**** vc-git handles Author: and Date:
+**** vc-hg handles  Author: and Date:
+**** vc-bzr handles Author:, Date: and Fixes:
+**** vc-mtn handles Author: and Date:
+
+*** Pressing g in a *vc-diff* buffer reruns vc-diff, so it will
+produce an up to date diff.
+
+** Directory local variables can apply to file-less buffers.
+For example, adding "(diff-mode . ((mode . whitespace)))" to your
+.dir-locals.el file, will turn on `whitespace-mode' for *vc-diff* buffers.
 
-*** The `cyrillic-translit' input method supports many new characters.
-Common typographical characters available from Unicode were added to
-`cyrillic-translit': punctuation marks, accented characters, fractions,
-and others.
+** SQL Mode enhancements.
+
+*** Several variables have been marked as safe local variables.  The
+variables `sql-product', `sql-user', `sql-server', `sql-database' and
+`sql-port' can now be safely used as local variables.
 
-** Emacs now supports serial port access on GNU/Linux, Unix, and
-Windows.  The new command `serial-term' starts an interactive terminal
-on a serial port.  The serial port can be configured at runtime with
-the mode-line mouse menu.
+*** Added ability to login with a port on MySQL.
+The custom variable `sql-port' can be specified for connection to
+MySQL servers.
 
-** Menu Bar changes
+*** Command continuation prompts in SQL interactive mode are suppressed.
+Multiple line commands in SQL interactive mode, generate command
+continuation prompts which needlessly confuse the output.  These
+prompts are now filtered out from the output.  This change impacts
+multiple line SQL statements entered with C-j between each line,
+statements yanked into the buffer and statements sent with
+`sql-send-*' functions.
 
-*** In the Options menu, the "Set Default Font" item applies the
-selected font to the `default' face on all frames, not just the
-current frame.  Furthermore, if Emacs is compiled with both GTK and
-Fontconfig support, the "Set Default Font" item uses the GTK font
-selection dialog instead of an Emacs pop-up menu.
+*** Custom variables control prompting for login parameters.
+Each supported product has a custom variable `sql-*-login-params'
+which is a list of the parameters to be prompted for before a
+connection is established.
 
-*** The font setting chosen by "Set Default Font" is saved if the
-"Save Options" item is used.
+By default, the value of the parameter is simply prompted for.  For
+`server' and `database', they can be specified in a list as shown
+below:
 
-*** The Tools menu contains a new Encryption/Decryption submenu.
-This contains commands provided by EasyPG, the newly-included
-interface to GnuPG (see New Modes and Packages).
+  (server :file ARG)
+  (database :file ARG)
+  (server :completion ARG)
+  (database :completion ARG)
 
-*** In the Options menu, the "Truncate Long Lines in the Buffer" entry
-has been replaced with a submenu offering three different ways to
-handle long lines: truncation, continuation at the window edge, and
-the new word wrapping behavior (see Editing Changes, below).
+The ARG when :file is specified is a regexp that will match valid file
+names (without the directory portion).  Generally these strings will
+be of the form ".+\.SUF" where SUF is the desired file suffix.
 
-*** Improvements to menus for major and minor modes
-More major and minor modes now have a mode specific menu, and existing
-mode menus have been improved to include more functionality.
+When :completion is specified, the ARG corresponds to the PREDICATE
+argument to the `completing-read' function (a list of possible values
+or a function returning such a list).
 
-** Mode-line changes
+*** Added `sql-connection-alist' to record login parameter values.
+An alist for recording different username, database and server
+values.  If there are multiple databases that you connect to the
+parameters needed can be stored in this alist.
 
-*** The mode-line displays a `@', instead of `-', if the
-default-directory for the current buffer is on a remote machine.
+For example, the following might be set in the user's init.el:
 
-*** The mode-line displays a mode menu when mouse-1 is clicked on a
-minor mode, in the same way as it already did for major modes.
+  (setq sql-connection-alist
+        '((dev (sql-product 'sqlite)
+               (sql-database "/home/mmaug/dev.db"))
+          (prd (sql-product 'oracle)
+               (sql-user "mmaug")
+               (sql-database "iprd2a"))))
 
-*** The `mode-line-emphasis' face is used to highlight certain
-mode-line information (e.g. waiting for a VC command to finish).
+This defines two connections named "dev" and "prd".
 
-*** The mode-line tooltips have been improved to provide more details.
+*** Added `sql-connect' to use predefined connections.
+Sets the login parameters based on the values in the
+`sql-connection-alist' and start a SQL interactive session.  Any
+values specified in the connection will not be prompted for.
 
-*** The VC, line/colum number and minor mode indicators on the mode
-line are now interactive: mouse-1 can be used on them to pop up a menu.
+In the example above, if the user were to invoke M-x sql-connect, they
+would be prompted for the connection.  The user can respond with
+either "dev" or "prd".  The "dev" connection would connect to the
+SQLite database without prompting; the "prd" connection would prompt
+for the users password and then connect to the Oracle database.
 
-** File deletion can make use of the Recycle Bin or system Trash folder.
-Set `delete-by-moving-to-trash' non-nil to use this.  Deleted files
-and directories will then be sent to the Recycle Bin on Windows, and
-to `trash-directory' on other systems.
+**** Added SQL->Start... submenu when connections are defined.
+When connections have been defined, There is a submenu available that
+allows the user to select one to start a SQLi session.  The "Start
+SQLi Session" item moves to the "Start..." submenu when cnnections
+have been defined.
+
+**** Added "Save Connection" menu item in SQLi buffers.
+When a SQLi session is not started by a connection then
+`sql-save-connection' will gather the login params specified for the
+session and save them as a new connection.
+
+*** Added option `sql-send-terminator'.
+When set makes sure that each command sent with `sql-send-*' commands
+are properly terminated and submitted to the SQL processor.
+
+*** Added option `sql-oracle-scan-on'.
+When set commands sent to Oracle's SQL*Plus are scanned for strings
+starting with an ampersand and the user is asked for replacement text.
+In general, the SQL*Plus option SCAN should always be set OFF under
+SQL interactive mode and this option used in its place.
 
-** Directory-local variables can now be defined.
-By default, Emacs looks in .dir-locals.el for directory-local
-variables.  For more information, see `dir-locals-set-directory-class'
-and `dir-locals-set-class-variables'.
+*** SQL interactive mode will replace tabs with spaces.
+This prevents the comand interpretter for MySQL and Postgres from
+listing object name completions when being sent text via
+`sql-send-*' functions.
 
-** Emacs can now use `auth-source' for authentication.
-`smtpmail' and `url' (Tramp and Gnus also) use `auth-source' to obtain
-login names and passwords.  The match, if found, is reported
-in *Messages* with the password blanked out.
+*** An API for manipulating SQL product definitions has been added.
 
-** `where-is-preferred-modifier' can specify your favorite modifier.
+** s-region.el is now declared obsolete, superceded by shift-select-mode
+enabled by default in 23.1.
+
+** gdb-mi
 
-\f
-* Startup Changes in Emacs 23.1
-
-** The option `inhibit-startup-screen' (with aliases to old names
-`inhibit-splash-screen' and `inhibit-startup-message') doesn't inhibit
-display of the initial message in the *scratch* buffer.  If you don't
-want to display the initial message in the *scratch* buffer at startup,
-you can set the option `initial-scratch-message' to nil.
-
-** New user option `initial-buffer-choice' specifies what to display
-after starting Emacs: startup screen, *scratch* buffer, visiting a
-file or directory.
-
-** New alias `argv' for `command-line-args-left'
-This is a convenience alias, so that one can write `(pop argv)'
-inside of --eval command line arguments in order to access
-following arguments.
-
-** The abbrev file is no longer read at startup in batch mode.
-
-** Emacs now supports invocation by an X session manager.
-It can save a session and restore it later.  See the documentation of
-the functions `emacs-session-save' and `emacs-session-restore'.
-(Actually, this feature was introduced with Emacs 22, but it was not
-documented.)
-\f
-* Incompatible Editing Changes in Emacs 23.1
-
-** In Dired, `dired-flag-garbage-files' is rebound from `&' to `%&'
-on the regexp command prefix map.
-
-** In Dired-x, all command guesses for ! are now added to the default
-list accessible by M-n instead of pushing all guesses temporarily into
-the history list.
-
-** In Isearch mode, a special case of typing `C-w' at the beginning of
-the minibuffer that toggles word search (i.e. using key sequences
-`C-s RET C-w' or `C-s M-e C-w') is obsolete.  You can use the global key
-`M-s w' to start word search, or type `M-s w' in Isearch mode to
-toggle word search.  To start nonincremental word search you can now use
-`M-s w RET' and `M-s w C-r RET' instead of `C-s RET C-w' and `C-r RET C-w'.
-
-** In Info, `Info-search' is unbound from `M-s' to allow using `M-s w'
-for word search as well as other search commands from the global prefix
-key `M-s'.  `Info-search' is still bound to `s', and also incremental
-search commands `C-s', `C-M-s', `C-r', `C-M-r' are available for searching
-through multiple Info nodes, together with their nonincremental versions
-`C-s RET', `C-r RET', `C-M-s RET', `C-M-r RET', `M-s w RET'.
-
-** In Text mode, `center-line' and `center-paragraph' are rebound from
-`M-s' and `M-S' to global keys `M-o M-s' and `M-o M-S' on the global
-prefix map `M-o', which is intended for such formatting commands.
-
-** The following input methods were removed in Emacs 22.2, but this was
-not advertised: danish-alt-postfix, esperanto-alt-postfix,
-finnish-alt-postfix, german-alt-postfix, icelandic-alt-postfix,
-norwegian-alt-postfix, scandinavian-alt-postfix, spanish-alt-postfix,
-and swedish-alt-postfix.  Use the versions without "alt-", which are
-identical.
+*** GDB User Interface migrated to GDB Machine Interface and now
+supports multithread non-stop debugging and debugging of several
+threads simultaneously.
+
+** D-Bus
+
+*** It is possible now, to access alternative buses than the default
+system or session bus.
 
 \f
-* Editing Changes in Emacs 23.1
-
-** The C-n and C-p line-motion commands now move by screen lines,
-taking continued lines and variable-width characters into account.
-Setting `line-move-visual' to nil reverts this to the previous
-behavior (i.e., motion by logical lines based on buffer contents
-alone).
-
-** C-x C-c now invokes `save-buffers-kill-terminal', and C-z now
-invokes `suspend-frame'.  These changes are for compatibility with the
-new multi-tty support (see `Improved X Window System support' above).
-
-** Mark changes
-
-*** Transient Mark mode is now on by default.
-
-*** mark-even-if-inactive now defaults to t
-
-*** When Transient Mark mode is on, C-SPC C-SPC pushes a mark without
-activating it.
-
-*** When Transient Mark mode is on, M-q now fills the region if the
-region is active.  Otherwise, it fills the current paragraph.
-
-*** When Transient Mark mode is on, M-$ now checks spelling of the
-region if the region is active.  Otherwise, it checks spelling of the
-word at point.
-
-*** When Transient Mark mode is on, TAB now indents the region if the
-region is active.
-
-*** The variable `use-empty-active-region' controls whether an empty
-active region in Transient Mark mode should make commands operate on
-that empty region.
-
-** Temporarily active regions
-
-*** The new variable shift-select-mode, non-nil by default, controls
-shift-selection.  When Shift Select mode is on, shift-translated
-motion keys (e.g. S-left and S-down) activate and extend a temporary
-region, similar to mouse-selection.
-
-*** Temporarily active regions, created using shift-selection or
-mouse-selection, are not necessarily deactivated in the next command.
-They are only deactivated after point motion commands that are not
-shift-translated, or after commands that would ordinarily deactivate
-the mark in Transient Mark mode (e.g., any command that modifies the
-buffer).
-
-** Minibuffer and completion changes
-
-*** Emacs may ask for confirmation before opening a non-existent file
-or buffer.  By default, Emacs requests confirmation if you type RET
-immediately after TAB, and the resulting input is not an existing file
-or buffer; this usually happens when the minibuffer input did not
-complete far enough and you entered RET by mistake.  In that case,
-Emacs puts the message "[Confirm]" in the minibuffer; type RET again
-to create the file or buffer.
-
-The new variable confirm-nonexistent-file-or-buffer determines whether
-Emacs asks for confirmation.  The default value is `after-completion'.
-If you change it to t, Emacs always asks for confirmation; if you
-change it to nil, Emacs never asks for confirmation.
-
-*** The rules for performing completion have been changed.
-When generating completion alternatives, Emacs now takes the
-minibuffer text after point, if any, into account: this text is
-treated as a substring of the remaining part of the completion
-alternative (i.e., the part not matched by the minibuffer text before
-point).  If no completion alternatives are found this way, Emacs
-attempts to perform partial-completion.  If still no completion
-alternatives are found, we fall back on the Emacs 22 rules for
-performing completion.
-
-The new variable `completion-styles' can be customized to choose your
-favorite completion style.
-
-*** When M-n in the minibuffer reaches the end of the list of defaults,
-it adds the completion list to the end, so next M-n continues putting
-completion items to the minibuffer.  The same principle applies to
-incremental search commands as well: C-s or C-M-s starts searching
-the default values and after the end of defaults they continue
-searching minibuffer completion items.
-
-*** Minibuffer input of shell commands now comes with completion.
-
-*** In the `C-x d' (Dired) prompt, typing M-n gives the visited file
-name of the current buffer.
-
-*** In the M-! (shell-command) prompt, M-n provides some default commands.
-These are guessed using the file extension of the current file, based
-on the file-handlers specified in the operating system's `mailcap'
-file.  The ! command in Dired (dired-do-shell-command) works
-similarly, using the file displayed on the current line.
-
-*** A list of regexp default values is available via M-n for `occur',
-`keep-lines', `flush-lines' and `how-many'.  This list includes the active
-region in transient-mark-mode, the word under the cursor, the last Isearch
-regexp, the last Isearch string and the last replacement regexp.
-
-*** When enable-recursive-minibuffers is non-nil, operations which use
-switch-to-buffer (such as C-x b and C-x C-f) do not fail any more when
-used in a minibuffer or a dedicated window.  Instead, they fallback on
-using pop-to-buffer, which will use some other window.  This change
-has no effect when enable-recursive-minibuffers is nil (the default).
-
-*** Isearch started in the minibuffer searches in the minibuffer history.
-Reverse Isearch commands (C-r, C-M-r) search in previous minibuffer
-history elements, and forward Isearch commands (C-s, C-M-s) search in
-next history elements.  When the reverse search reaches the first history
-element, it wraps to the last history element, and the forward search
-wraps to the first history element.  When the search is terminated, the
-history element containing the search string becomes the current.
-
-*** The variable read-file-name-completion-ignore-case overrides
-completion-ignore-case for file name completion.
-
-*** The variable read-buffer-completion-ignore-case overrides
-completion-ignore-case for buffer name completion.
-
-*** The new command `minibuffer-force-complete' chooses one of the
-possible completions, rather than stopping at the common prefix.
-
-*** If `completion-auto-help' is `lazy', Emacs shows the completions
-buffer only on the second attempt to complete.  This was already
-supported in `partial-completion-mode'.
-
-** Face changes
-
-*** S-down-mouse-1 now pops up a menu for changing the font and text
-size of the default face in the current buffer.  The face is changed
-via face remapping (see Lisp changes, below).
-
-*** New commands to change the default face size in the current buffer.
-To increase it, type `C-x C-+' or `C-x C-='.  To decrease it, type
-`C-x C--'.  To restore the default (global) face size, type `C-x C-0'.
-These work via Text Scale mode, a new minor mode.
-
-The final key in the above commands may be repeated without the
-leading `C-x', e.g. `C-x C-= C-= C-=' increases the face height by
-three steps.  Each step scales the height of the default face by the
-value of the variable `text-scale-mode-step'.
-
-*** The commands buffer-face-mode and buffer-face-set can be used to
-remap the default face in the current buffer.  See "Buffer Face mode",
-under New Modes and Packages.
-
-** Primary selection changes
-
-*** You can disable kill ring commands from accessing the primary
-selection by setting `x-select-enable-primary' to nil.
-
-** Continuation lines can now be wrapped at word boundaries
-(word-wrapping).  This is controlled by the new per-buffer variable
-`word-wrap'.  Word wrapping does not take place if continuation lines
-are not shown, e.g. if truncate-lines is non-nil.  The most convenient
-way to enable word-wrapping is using the new minor mode Visual Line
-mode; in addition to setting `word-wrap' to t, this rebinds some
-editing commands to work on screen lines rather than text lines.  See
-New Modes and Packages, below.
-
-** Window management changes
-
-*** truncate-partial-width-windows now accepts integer values, which
-specify a minimum window width for partial-width windows, below which
-lines are truncated.  The default has been changed to 50.
-
-*** The new command balance-windows-area balances windows both
-vertically and horizontally.
-
-*** pop-to-buffer now always sets input focus when the popped-to window
-is on a different frame.
-
-** Miscellaneous changes:
-
-*** C-l is bound to the new command recenter-top-bottom, rather than recenter.
-This moves the current line to window center, top and bottom on
-successive invocations.
-
-*** scroll-preserve-screen-position also preserves the column position.
+* New Modes and Packages in Emacs 24.1
 
-*** If `yank-pop-change-selection' is t, rotating the kill ring also
-updates the selection or clipboard to the current yank, just as M-w
-would do so with the text it copies to the kill ring.
+** pcase.el provides the ML-style pattern matching macro `pcase'.
 
-*** C-M-% now shows replacement as it would look in the buffer, with
-`\N' and `\&' substituted according to the match.  Old behavior can be
-restored by customizing `query-replace-show-replacement'.
+** smie.el is a package providing a simple generic indentation engine.
 
-*** The command shell prompts for the default directory, when it is
-called with a prefix and the default directory is a remote file name.
-This is because some file name handlers (like ange-ftp) are not able to
-run processes remotely.
+** secrets.el is an implementation of the Secret Service API, an
+interface to password managers like GNOME Keyring or KDE Wallet.  The
+Secret Service API requires D-Bus for communication.  The command
+`secrets-show-secrets' offers a buffer with a visualization of the
+secrets.
 
-*** The new command kill-matching-buffers kills buffers whose name
-matches a regexp.
+** notifications.el provides an implementation of the Desktop
+Notifications API.  It requires D-Bus for communication.
 
-*** The value of comment-style now defaults to `indent'.
-Thefore, comment-start markers are inserted at the current indentation
-of the region to comment, rather than the leftmost column.
-
-*** The new commands `pp-macroexpand-expression' and
-`pp-macroexpand-last-sexp' pretty-print macro expansions.
-
-*** The new command `set-file-modes' allows to set file's mode bits.
-The mode bits can be specified in symbolic notation, like with GNU
-Coreutils, in addition to an octal number.  `chmod' is a new
-convenience alias for this function.
-
-*** `next-error-recenter' specifies how next-error should recenter the
-visited source file.  Its value can be a number (for example, 0 for
-top line, -1 for bottom line), or nil for no recentering.
-
-*** When typing in a password in the echo area, C-y yanks the current
-kill into the password.
-
-*** Tooltip frame parameters `font' and `color' in `tooltip-frame-parameters'
-are ignored.  Customize the `tooltip' face instead.
-
-*** `mkdir' is a new convenience alias for `make-directory'.
 \f
-* New Modes and Packages in Emacs 23.1
-
-** Auto Composition Mode is a minor mode that composes characters
-automatically when they are displayed.  It is globally on by default.
-It uses `auto-composition-function' (default `auto-compose-chars').
-
-** Bubbles, a new game, is similar to SameGame.
-
-** Buffer Face mode is a minor mode for remapping the default face in
-the current buffer.  The variable `buffer-face-mode-face' specifies
-the face to remap to.  The command `buffer-face-set' prompts for a
-face name, sets `buffer-face-mode-face' to it, and enables
-buffer-face-mode.  See "Face changes", under Editing Changes, for a
-description of face remapping.
-
-** butterfly flips the desired bit on the drive platter.
-See http://xkcd.com/378/
-
-** bug-reference.el provides clickable links to bug reports.
-
-** dbus.el provides D-Bus language bindings.
-D-Bus is an inter-process communication mechanism for applications
-residing on the same host.  See the manual for details.
-
-** DocView mode allows viewing of PDF, PostScript and DVI documents.
-One can also search for a regular expression in the document.  For
-details, see the commentary in doc-view.el.
-
-PDF and DVI files are now opened in Doc View mode by default.
-
-In Postcript mode, C-c C-c launches Doc View minor mode for viewing
-the postscript file.
-
-** EasyPG provides an interface to the GNU Privacy Guard (GnuPG).
-It includes a GnuPG keyring browser, cryptographic operations on
-regions and files, and automatic encryption of *.gpg files.  For
-details, see the EasyPG Assistant User's Manual.
+* Incompatible Lisp Changes in Emacs 24.1
 
-** json.el is a library for parsing and generating JSON
-(JavaScript Object Notation), a lightweight data-interchange format.
+** A backquote not followed by a space is now always treated as new-style.
 
-** linum.el is a new minor mode to display line numbers for the
-current buffer.
+** Test for special mode-class was moved from view-file to view-buffer.
+FIXME: This only says what was changed, but not what are the
+programmer-visible consequences.
 
-** mairix.el is an interface to mairix, a free tool for indexing and
-searching locally stored mail.  It allows you to query mairix and
-display the search results with Rmail, Gnus and VM.  Note that there
-is an existing Gnus back end, nnmairix.el, which should be used with
-Maildir/MH setups.
+** Passing a nil argument to a minor mode function now turns the mode
+   ON unconditionally.
 
-** minibuffer-depth-indicate-mode shows the minibuffer depth in the prompt.
+** During startup, Emacs no longer adds entries for `menu-bar-lines'
+and `tool-bar-lines' to `default-frame-alist' and
+`initial-frame-alist'.  With these alist entries omitted, `make-frame'
+checks the value of the variable `menu-bar-mode'/`tool-bar-mode' to
+determine whether to create a menu-bar or tool-bar, respectively.
+If the alist entries are added, they override the value of
+`menu-bar-mode'/`tool-bar-mode'.
 
-** nXML Mode
-This is a new mode for editing XML documents.  It allows a schema to
-be associated with the XML document being edited, using Relax NG as
-the schema language.  The schema is used to provide two key features:
-
-*** Continuous validation.  nXML validates as you type, highlighting
-any invalid parts of your document.
-
-*** Completion.  nXML can assist you in entering an element name,
-attribute name or data value by using information about what is
-allowed by the schema in that context.
-
-** proced.el provides a Dired-like interface for operating on
-processes.  Proced makes an Emacs buffer containing a listing of the
-current processes.  You can use the normal Emacs commands to move
-around in this buffer, and special Proced commands to operate on the
-processes listed.  It is currently only functional on GNU/Linux,
-MS-Windows and Solaris.
-
-** Remember Mode is a mode for jotting down things to remember.
-Notes can be saved to a Diary file.  For details, see the Remember
-Manual.
-
-** RST mode is a major mode for editing reStructuredText files.
-
-** Ruby mode is a major mode for Ruby files.
-
-** Visual Line mode provides support for editing by visual lines.
-It turns on word-wrapping in the current buffer, and rebinds C-a, C-e,
-and C-k to commands that operate by visual lines instead of logical
-lines.  This is a more reliable replacement for longlines-mode.
-This can also be turned on using the menu bar, via
-Options -> Line Wrapping in this Buffer -> Word Wrap
-
-** xesam.el is an implementation of Xesam, an interface to (desktop)
-search engines like Beagle, Strigi, and Tracker.  The Xesam API
-requires D-Bus for communication.
-
-** zeroconf.el offers service discovery and service publishing
-interfaces according to the zeroconf specification.  It communicates
-with Avahi, a zeroconf implementation, via D-Bus messages on systems
-which have installed this software.
-
-** There is a new `whitespace' package.
-(The pre-existing one has been renamed to `old-whitespace'.)
-Now, besides reporting bogus blanks, the whitespace package has a
-minor mode and a global minor mode to visualize blanks (TAB, (HARD)
-SPACE and NEWLINE).  The visualization is made via faces and/or display
-table.  It can also indicate lines that extend beyond a given column,
-trailing blanks, and empty lines at the start or end of a buffer.
-See `whitespace-style' for more details.  The `whitespace-action' option
-specifies what to do when a buffer is visited, killed, or written.
+** Regions created by mouse dragging are now normal active regions,
+similar to the ones created by shift-selection.  In previous Emacs
+versions, these regions were delineated by `mouse-drag-overlay', which
+has now been removed.
 
 \f
-* Changes in Specialized Modes and Packages in Emacs 23.1
-
-** Abbrev has been rewritten in Elisp and extended with more flexibility.
-
-*** New functions: abbrev-get, abbrev-put, abbrev-table-get, abbrev-table-put,
-abbrev-table-p, abbrev-insert, abbrev-table-menu.
-
-*** Special hook `abbrev-expand-functions' obsoletes `pre-abbrev-expand-hook'.
-
-*** `make-abbrev-table', `define-abbrev', `define-abbrev-table' all take
-extra arguments for arbitrary properties.
-
-*** New variable `abbrev-minor-mode-table-alist'.
-
-*** `local-abbrev-table' can hold a list of abbrev-tables.
+* Lisp changes in Emacs 24.1
 
-*** Abbrevs have now the following special properties:
-`:count', `:system', `:enable-function', `:case-fixed'.
+** New hook post-self-insert-hook run at the end of self-insert-command.
 
-*** Abbrev-tables have now the following special properties:
-`:parents', `:case-fixed', `:enable-function', `:regexp',
-`abbrev-table-modiff'.
+** Syntax tables support a new "comment style c" additionally to style b.
+** frame-local variables cannot be let-bound any more.
+** prog-mode is a new major-mode meant to be the parent of programming mode.
+** define-minor-mode accepts a new keyword :variable.
 
-** Apropos
+** `delete-file' and `delete-directory now accept optional arg TRASH.
+Trashing is performed if TRASH and `delete-by-moving-to-trash' are
+both non-nil.  Interactively, TRASH defaults to t, unless a prefix
+argument is supplied (see Trash changes, above).
 
-*** `apropos-library' describes the elements defined in a given library.
+** buffer-substring-filters is obsoleted by filter-buffer-substring-functions.
 
-*** Set `apropos-compact-layout' is you want a more compact (but wider) layout.
+** New completion style `substring'.
 
-** Archive Mode has basic support to browse Rar archives.
-Note, however, that the free version of the unrar command only handles
-versions 1 and 2 of the Rar format.
+** Image API
 
-** BibTeX mode
+*** When the image type is one of listed in `image-animated-types'
+and the number of sub-images in the image is more than one, then the
+new function `create-animated-image' creates an animated image where
+sub-images are displayed successively with the duration defined by
+`image-animate-max-time' and the delay between sub-images defined
+by the Graphic Control Extension of the image.
 
-*** New command `bibtex-initialize' (re)initializes BibTeX buffers.
-
-*** New `bibtex-entry-format' options `whitespace', `braces', and
-`string', disabled by default.
-
-*** New variable `bibtex-cite-matcher-alist' contains rules to
-identify cited keys in BibTeX entries, used by `bibtex-find-crossref'.
-
-*** Command `bibtex-url' allows multiple URLs per entry.
-
-** Bookmarks
-
-*** bookmark.el saves bookmarks in a pre-Emacs-23-incompatible file format
-bookmark.el can read a .emacs.bmk file saved by an older Emacs, but an
-older Emacs cannot read one saved by Emacs 23.
-
-** Calendar and diary
-
-*** There is a new date style, `iso', essentially year/month/day.
-The variable `european-calendar-style' is obsolete - use `calendar-date-style'.
-Similarly, the commands `american-calendar' and `european-calendar'
-should be replaced by `calendar-set-date-style'.
-
-*** The calendar namespace has been rationalized.
-All functions and variables now begin with a `calendar-', `diary-', or
-`holiday-' prefix.  The various calendar systems have secondary
-prefixes, eg `calendar-french-'.  The old names you are likely to use
-directly still exist, for the time being, as aliases, but please start
-using the new names.
-
-*** The whitespace in the calendar layout can be customized.
-See the variables:
-calendar-left-margin, calendar-intermonth-spacing, calendar-column-width,
-calendar-day-header-width, and calendar-day-digit-width.
-
-*** Text (e.g. ISO weeks) can be displayed between the calendar months.
-See the variables calendar-intermonth-header and calendar-intermonth-text.
-
-*** The function `holiday-chinese' computes holidays on the Chinese calendar.
-It has been used to add items to the list `holiday-oriental-holidays'.
-
-*** `diary-remind' accepts a negative number -DAYS as a shorthand for
-the list (1 2 ... DAYS).
-
-** Change Log mode
-
-*** The new command C-c C-f (change-log-find-file) finds the file
-associated with the current log entry.
-
-*** The new command C-c C-c (change-log-goto-source) goes to the
-source code associated with a log entry.
-
-** Compile and grep modes
-
-*** The mode-line entry for the *compilation* and *grep* buffer is color coded.
-It has different colors for to show that: (a) the command is still
-running, (b) successful completion, (c) error.
-
-*** compilation-auto-jump-to-first-error tells `compile' to jump to
-the first error encountered during compilations.
-
-*** compilation-scroll-output accepts a new value, `first-error', which
-says to stop auto scrolling at the first error that occurs.
-
-*** The `cc' alias for C++ files in `grep-file-aliases' has been
-improved.  `hh' can be used to match C++ header files and `cchh' both
-C++ sources and headers.
-
-** Copyright
-
-*** You can specify your copyright holders' names.
-Only copyright lines with holders matching `copyright-names-regexp' are
-considered for update.
-
-*** Copyrights can be at the end of the buffer.
-This is controlled by `copyright-at-end-flag' (used by, e.g., change-log-mode).
-
-** Custom
-
-*** defcustom accepts new keyword arguments, `:safe' and `:risky', which
-set a variable's `safe-local-variable' and `risky-local-variable' property.
-
-** Diff mode
-
-*** diff-refine-hunk highlights word-level details of changes in a diff hunk.
-It's used automatically as you move through hunks, see
-diff-auto-refine-mode.  It is bound to `C-c C-b'.
-
-*** diff-add-change-log-entries-other-window iterates through the diff
-buffer and tries to create ChangeLog entries for each change.
-It is bound to `C-x 4 A'.
-
-*** Turning on `whitespace-mode' in a diff buffer will show trailing
-whitespace problems in the modified lines.
-
-** Dired
-
-*** In Dired, C-x C-q now runs the command wdired-change-to-wdired-mode,
-and C-x C-q in wdired-mode exits it with asking a question about
-saving changes.
-
-*** `&' runs the command `dired-do-async-shell-command' that executes
-the command asynchronously without the need to manually add ampersand
-to the end of the command.  Its output appears in the buffer `*Async Shell
-Command*'.
-
-*** `M-s f C-s' and `M-s f M-C-s' run Isearch that matches only at file names.
-When a new user option `dired-isearch-filenames' is t, then even ordinary
-Isearch started with `C-s' and `C-M-s' matches only at file names in the
-Dired buffer.  When `dired-isearch-filenames' is `dwim' then activation of
-file name Isearch depends on the position of point - if point is on a file
-name initially, then Isearch matches only file names, otherwise it matches
-everywhere in the Dired buffer.  You can toggle file names matching on or
-off by typing `M-s f' in Isearch mode.
-
-*** `M-s a C-s' and `M-s a M-C-s' run multi-file Isearch on the marked files.
-They visit the first marked file in the sequence and display the usual Isearch
-prompt for a string or a regexp where all Isearch commands are available.
-
-*** `Q' in Dired provides two new keys for multi-file replacement.
-The upper case key `Y' replaces all remaining matches in all remaining files
-with no more questions.  The upper case key `N' stops doing replacements
-in the current file and skips to the next file.  These multi-file keys
-are available for all commands that use `tags-query-replace'
-including `dired-do-query-replace-regexp', `vc-dir-query-replace-regexp',
-`reftex-query-replace-document'.
-
-** Fortran
-
-*** The line length of fixed-form Fortran is not fixed at 72 any more.
-Customize the variable `fortran-line-length' to change it.
-
-*** In Fortran mode, M-; is now bound to the standard comment-dwim,
-rather than fortran-indent-comment.
-
-*** (The increasingly misnamed) F90 mode supports Fortran 2003 syntax.
-
-** Gnus
-
-*** The Gnus package has been updated
-There are many new features, bug fixes and improvements; see the file
-GNUS-NEWS or the node "No Gnus" in the Gnus manual for details.
-
-*** In Emacs 23, Gnus uses Emacs' new internal coding system `utf-8-emacs' for
-saving articles, drafts, and ~/.newsrc.eld.  These file may not be read
-correctly in Emacs 22 and below.  If you want to Gnus across different Emacs
-versions, you may set `mm-auto-save-coding-system' to `emacs-mule'.
-
-*** Passwords are consistently loaded through `auth-source'
-Gnus can use `auth-source' for POP and IMAP passwords.  Also see that
-`smtpmail' and `url' support `auth-source' for SMTP and HTTP/HTTPS/RSS
-authentication respectively.
-
-** Help mode
-
-*** New macro `with-help-window' should set up help windows better
-than `with-output-to-temp-buffer' with `print-help-return-message'.
-
-*** New option `help-window-select' permits to customize whether help
-window shall be automatically selected when invoking help.
-
-*** New variable `help-window-point-marker' permits one to specify a new
-position for point in help window (for example in `view-lossage').
+*** `image-extension-data' is renamed to `image-metadata'.
 
 ** Isearch
 
-*** New command `isearch-forward-word' bound globally to `M-s w' starts
-incremental word search.  New command `isearch-toggle-word' bound to the
-same key `M-s w' in Isearch mode toggles word searching on or off
-while Isearch is active.
-
-*** New command `isearch-highlight-regexp' bound to `M-s h r' in Isearch
-mode runs `highlight-regexp' (`hi-lock-face-buffer') with the current
-search string as its regexp argument.  The same key `M-s h r' and
-other keys on the `M-s h' prefix are bound globally to the command
-`highlight-regexp' and other hi-lock commands.
-
-*** New command `isearch-occur' bound to `M-s o' in Isearch mode
-runs `occur' with the current search string.  The same key `M-s o'
-is bound globally to the command `occur'.
-
-*** Isearch can now search through multiple ChangeLog files.
-When running Isearch in a ChangeLog file, if the search fails,
-then another C-s tries searching the previous ChangeLog,
-if there is one (e.g. going from ChangeLog to ChangeLog.12).
-This is enabled if multi-isearch-search is non-nil.
-
-*** Two new commands to start Isearch on a list of marked buffers
-for buff-menu.el and ibuffer.el are bound to the keys `M-s a C-s' and
-`M-s a M-C-s'.
-
-*** The part of an Isearch that failed to match is highlighted in
-`isearch-fail' face.
-
-*** `C-h C-h' in Isearch mode displays isearch-specific Help screen,
-`C-h b' displays all Isearch key bindings, `C-h k' displays the full
-documentation of the given Isearch key sequence, `C-h m' displays
-documentation for Isearch mode.  All the other Help commands exit
-Isearch mode and execute their global definitions.
-
-*** When started in the minibuffer, Isearch searches in the minibuffer
-history.  See `Minibuffer changes', above.
-
-** MH-E
-
-*** Upgraded to MH-E version 8.2.  See MH-E-NEWS for details.
-
-** Python
-*** The file etc/emacs.py now supports both Python 2 and 3, meaning
-that either version can be used as inferior Python by python.el.
-
-*** Python mode now has `pdbtrack' functionality.  When using pdb to
-debug a Python program, pdbtrack notices the pdb prompt and displays
-the source file and line that the program is stopped at, much the same
-way as gud-mode does for debugging C programs with gdb.
-
-** Recentf
-
-*** The default value of `recentf-keep' prevents from checking of
-remote files, if there is no established connection to the
-corresponding remote host.
-
-** Rmail
-
-*** Rmail no longer converts the messages to Babyl format.
-Instead, it uses UNIX mbox format, both on disk and in Rmail buffers,
-and does conversion and decoding when a message is displayed.
-
-The first time you visit an Rmail file in Babyl format, Rmail
-automatically converts it to mbox format.  This is a one-time
-conversion, but it can take a few minutes, depending on how fast is
-your machine and on the size of the file.  You should find the rest of
-Rmail usage unaltered.
-
-However, M-x set-rmail-inbox-list now lasts only for one session
-because there is no way to save the list of inbox files in an
-mbox-format file.
-
-Also, whereas with Babyl format M-x find-file would switch to Rmail
-mode, with mbox format this is no longer the case (there being no way
-to add an "-*- rmail-*-" cookie to an mbox file).  Use C-u M-x rmail
-instead.
-
-If you have written any extensions to Rmail, they are likely to need
-updating.  Conceptually, the Rmail buffer that you see is no longer
-just a narrowed portion of the whole.  So you cannot access the whole
-of a message (or message collection) by a simple save-restriction and
-widen.  Instead, there are two buffers: the rmail-buffer, and the
-rmail-view-buffer.  The former is the buffer that you see, the latter
-is invisible.  Most of the time, the invisible `view' buffer contains
-the full contents of the Rmail file, and the Rmail buffer contains a
-decoded copy of the current message (with only a subset of the
-headers).  In this state, Rmail is said to be `swapped'.
-
-You may find the following functions useful:
-
-`rmail-get-header' and `rmail-set-header' get or set the value of a
-message header, whether or not it is currently visible.
-
-`rmail-apply-in-message' is a general purpose function that calls a
-function (with arguments) which you specify on the full text of a given
-message.  To further narrow to just the headers, search forward for "\n\n".
+*** New hook `isearch-update-post-hook' that runs in `isearch-update'.
 
-*** The new command `rmail-mime' displays MIME messages.
-It is bound to `v' in Rmail buffers and summaries.  It displays plain
-text and multipart messages in a temporary buffer, and offers buttons
-to save attachments.
-
-*** The command `rmail-redecode-body' no longer accepts the optional arg RAW.
-Since Rmail now holds messages in their original undecoded form in a
-separate buffer, `rmail-redecode-body' no longer encodes the original
-message, and therefore there should be no need to avoid encoding it.
-
-*** The o command is now `rmail-output'.  It is an all-purpose command
-for copying messages from Rmail and appending them to files.  It
-handles Babyl-format files as well as mbox-format files, and it
-handles both kinds properly when they are visited in Emacs.  It always
-copies the full headers of the message.
-
-*** The C-o command is now `rmail-output-as-seen'.  It uses
-the message as displayed, appending it to an mbox file.
-
-*** The modified status of the Rmail buffer is reported in the mode-line.
-Previously, this information was hidden.
-
-** TeX modes
-
-*** New option latex-indent-within-escaped-parens
-permits to customize indentation of LaTeX environments delimited
-by escaped parens.
-
-** T-mouse Mode
-
-*** If the gpm mouse server is running and t-mouse-mode is enabled,
-Emacs uses a Unix socket in a GNU/Linux console to talk to server,
-rather than faking events using the client program mev.  This C level
-approach provides mouse highlighting and help echoing in the
-minibuffer.
-
-** Tramp
-
-*** New connection methods.
-The new methods "plinkx", "plink2", "psftp", "sftp" and "fish" have
-been introduced.  There are also new so-called gateway methods
-"tunnel" and "socks".
-
-*** IPv6 addresses.
-IPv6 addresses are supported now as host names.  They must be embedded
-in square brackets, like in "/ssh:[::1]:".
-
-*** Multihop syntax has been removed.
-The pseudo-method "multi" has been removed.  Instead, multi hops
-can be specified by the new variable `tramp-default-proxies-alist'.
-
-*** More default settings.
-Default values can be set via the variables `tramp-default-user',
-`tramp-default-user-alist' and `tramp-default-host'.
-
-*** Connection information is cached.
-In order to reduce connection setup, information about used
-connections is kept persistently in a file.  The name of this file is
-defined in the variable `tramp-persistency-file-name'.
-
-*** Control of remote processes.
-Running processes on a remote host can be controlled by settings in
-`tramp-remote-path' and `tramp-remote-process-environment'.
-
-*** Success of remote copy is checked.
-When the variable `file-precious-flag' is set, the success of a remote
-file copy is checked via the file's checksum.
-
-*** Passwords can be read from an authentification file.
-Tramp uses the package `auth-source' to read passwords from a file, if
-necessary.
-
-** VC and related modes
-
-*** VC now supports applying VC operations to a set of files at a time.
-This enables VC to work much more effectively with changeset-oriented
-version-control systems such as Subversion, GNU Arch, Mercurial, Git
-and Bzr.  VC will now pass a multiple-file commit to these systems as
-a single changeset.
-
-*** vc-dir is a new command that displays file names and their VC
-status.  It allows to apply various VC operations to a file, a
-directory or a set of files/directories.
-
-*** VC switches are no longer appended, rather the first non-nil value is used.
-(This was for the most part true in Emacs 22, but was not advertised).
-This is because there is an increasing variety of VC systems, and they
-do not all accept the same "common" options.  For example, a CVS diff
-command used to append the values of `vc-cvs-diff-switches',
-`vc-diff-switches', and `diff-switches'.  Now the first non-nil value
-from that sequence is used.  The special value `t' means "no switches".
-
-*** Clicking on the VC mode-line entry now pops the VC menu.
-
-*** The VC mode-line entry now has a tooltip that explains the VC file status.
-
-*** In VC Annotate mode, the key bindings have changed to use lower
-case keys instead of the upper case keys used in the past.
-
-*** In VC Annotate mode, for VC systems that support changesets, you can
-see the diff for the whole changeset (not only for the current file)
-by typing the D key.  Using the "Show changeset diff of revision at
-line" menu entry does the same thing.
-
-*** In VC Annotate mode, you can type v to toggle the annotation visibility.
-
-*** In VC Annotate mode, you can type f to show the file revision on
-the current line.
-
-*** Asynchronous VC commands display [Waiting...] in the mode-line
-of the corresponding buffer as long as the asynchronous process is
-active.
-
-*** Log entries can be modified using the key "e" in log-view.
-For now only CVS, RCS, SCCS and SVN support this functionality.
-This is done by the `modify-change-comment' backend function.
-
-*** In log-view-mode, for VC systems that support changesets, you can
-see the diff for the whole changeset (not only for the current file)
-by typing the D key or using the "Changeset Diff" menu entry.
-
-*** In Log Edit mode,  C-c C-d now shows the diff for the files involved.
-
-*** vc-git supports the "git grep" command.
-
-*** VC Support for Meta-CVS has been removed for lack of a maintainer able
-to update it to the new VC.
-
-** Miscellaneous
-
-*** comint-mode uses `start-file-process' now (see Lisp Changes).
-If `default-directory' is a remote file name, subprocesses are started
-on the corresponding remote system.
-
-*** Eldoc highlights the function argument under point
-with the face `eldoc-highlight-function-argument'.
-
-*** In Etags, the --members option is now the default.
-Use --no-members if you want the old default behavior of not tagging
-struct members in C, members variables in C++ and variables in PHP.
-
-*** The `gdb' command only works with the graphical interface now.
-Use `gud-gdb' if you want the (old) text command mode.
-
-*** goto-address.el provides two new minor modes, goto-address-mode and
-goto-address-prog-mode, which buttonize URLS and email addresses.
-
-*** The new command `eshell/info' runs info in an eshell buffer.
-
-*** The new variable `ffap-rfc-directories' specifies a list of local
-directories in which `ffap-rfc' will first search for RFCs.
-
-*** hide-ifdef-mode allows shadowing ifdef-blocks instead of hiding them.
-See option `hide-ifdef-shadow' and function `hide-ifdef-toggle-shadowing'.
-
-*** `icomplete-prospects-height' now supercedes `icomplete-prospects-length'.
-
-*** Info displays breadcrumbs in the header of the page.
-See Info-breadcrumbs-depth to control it.
-
-*** net-utils has an `iwconfig' command, similar to the existing `ifconfig'.
-It is used to configure wireless interfaces.
-
-*** The pcmpl-unix package supports hostname completion for ssh and scp.
-
-*** sgml-electric-tag-pair-mode lets you simultaneously edit matched tag pairs.
-
-*** smerge-refine highlights word-level details of changes in conflict.
-It's used automatically as you move through conflicts, see
-smerge-auto-refine-mode.
-
-*** talk.el has been extended for multiple tty support.
-
-*** A new command `display-time-world' has been added to the Time
-package.  It creates a buffer with an updating time display using
-several time zones.
-
-*** The appearance of superscript and subscript in TeX is more customizable.
-See the documentation of the variables: tex-fontify-script,
-tex-font-script-display, tex-suscript-height-ratio, and
-tex-suscript-height-minimum.
-
-*** view-remove-frame-by-deleting is now by default t
-since users found iconification of view-mode frames distracting.
-
-*** WoMan tries to add locale-specific manual page directories to the
-search path.  This can be disabled by setting `woman-locale' to nil.
-
-\f
-* Changes in Emacs 23.1 on non-free operating systems
-
-** Case is now considered significant in completion on MS-Windows.
-The default value of `completion-ignore-case' is now nil on
-MS-Windows, the same as it is for other operating systems.  The
-variable doesn't apply to reading a file name -- in that case Emacs
-heeds `read-file-name-completion-ignore-case' instead.
-
-** IPv6 is supported on MS-Windows.
-Emacs now supports IPv6 on Windows XP and later, and earlier versions
-of Windows with third party IPv6 stacks installed.  In Emacs 22, IPv6 was
-supported on other platforms, but not on Windows due to using the winsock
-1.1 header file, even though Emacs was linking to the winsock 2 library.
-
-** Busy cursor (hourglass) now displays on MS-Windows.
-When Emacs is busy, an hourglass mouse cursor is displayed on Windows.
-In Emacs 22 only X supported the busy cursor.
-
-** Battery status is available on MS-Windows
-Emacs can now display the battery status in the mode-line when enabled with
-display-battery-mode or from the Options menu.  More verbose battery
-information is also available with the command `battery'.  In Emacs 22
-battery status was supported only on GNU/Linux and Mac.
-
-** More keys available on MS-Windows.
-Keys normally associated with IMEs, and some exotic keys not normally found
-on standard keyboards have been given names so they can be bound to functions
-inside Emacs.  If there are keys on your keyboard that have not been exposed
-to Emacs in the past, try C-h k to see if they are available now.
-
-Emacs can now bind functions to the extra buttons for media player and
-browser control present on some keyboards.  These buttons are disabled
-by default, since enabling them prevents their system-wide use when
-Emacs has focus.  To enable them, set the variable
-w32-pass-multimedia-buttons to nil.  See the doc string of that variable
-for the list of extra keys that are available.
-
-** BDF fonts no longer supported on MS-Windows.
-The font backend was completely rewritten for this release.  The focus
-on Windows has been getting acceptable performance and full unicode
-support, including complex script shaping for native Windows fonts.  A
-rewrite of the BDF font support has not happened due to lack of time
-and developers.  If demand still exists for such a backend even with
-the improved language support for native Windows fonts, future
-development in this direction will most likely be based on the
-freetype library, giving access to a wider range of font formats.
-
-\f
-* Incompatible Lisp Changes in Emacs 23.1
-
-** Variables cannot be both buffer-local and frame-local any more.
-
-** `functionp' returns nil for special forms.
-I.e., it only returns t for objects that can be passed to `funcall'.
-
-** The behavior of map-char-table has changed.  It may call the
-specified function with a cons (FROM . TO) as a key if characters in
-that range have the same value.
-
-** Process changes
-
-*** The function `dired-call-process' has been removed.
-
-*** The multibyteness of process filters is now determined by the
-coding-system used for decoding.  The functions
-`process-filter-multibyte-p' and `set-process-filter-multibyte' are
-obsolete.
-
-** The variable `byte-compile-warnings' can now be a list starting with `not',
-meaning to disable the specified warnings.  The meaning of this list
-may therefore be the reverse of what you expect (of course, this is
-only an issue if you make use of the new `not' syntax).  Rather than
-checking/manipulating elements directly, use the new functions
-`byte-compile-warning-enabled-p', `byte-compile-disable-warning', and
-`byte-compile-enable-warning.'
-
-** `mode-name' is no longer guaranteed to be a string.
-Use `(format-mode-line mode-name)' to ensure a string value.
-
-** The function x-font-family-list has been removed.
-Use the new function font-family-list (see Lisp Changes, below).
-
-** Internationalization changes
-
-*** The value of the function `charset-id' is now always 0.
-
-*** The functions `register-char-codings' and `coding-system-spec'
-have been removed.
-
-*** The cpXXX coding systems are now supported automatically.
-The functions cp-...-codepage, which you had to use in Emacs 22 to
-enable support for these coding systems, have been deleted.
-
-*** The following features have been removed.  They were used for
-displaying various scripts with specific fonts, and are no longer
-needed now that OpenType font support is available:
-
-**** `devanagari' and `devan-util', and all associated devanagari-* and
-dev-* functions and variables (formerly used for Devanagari script).
-
-**** `kannada' and `knd-util', and all associated kannada-* and knd-*
-functions and variables (formerly used for Kannada script).
-
-**** `malayalam' and `mlm-util', and all associated malayalam-* and
-mlm-* functions and variables (formerly used for Malayalam script).
-
-**** `tamil' and `tml-util, and all associated tamil-* and tml-*
-functions and variables (formerly used for Tamil script).
-
-*** The meaning of NAME argument of `set-fontset-font' is changed.
-Previously nil is accepted as the default fontset.  Now, nil is for
-the fontset of the selected frame and t is for the default fontset.
-
-*** The meaning of FONTSET argument of `print-fontset' is changed.
-Now, nil is for the fontset of the selected frame and t is for the
-default fontset.
-
-** If a function in write-region-annotate-functions returns with a
-different buffer current, Emacs no longer kills that buffer
-automatically.  This behavior existed in previous versions of Emacs,
-but was undocumented.  To kill a buffer after write-region, give the
-variable `write-region-post-annotation-function' a buffer-local value
-of `kill-buffer'.
-
-** The variable temp-file-name-pattern has been removed.
-This variable was only used by call-process-region, which now uses
-temporary-file-directory instead.
-
-** The COUNT and SYSTEM-FLAG arguments to define-abbrev have been
-removed.  The function now takes extra arguments for specifying
-arbitrary abbrev properties.
-
-** end-of-defun-function is now guaranteed to work only when called
-from the start of a defun.  It must now leave point exactly at the end
-of defun, since `end-of-defun' now itself moves forward over
-whitespace after calling it.
-
-\f
-* Lisp Changes in Emacs 23.1
-
-** The new variable `generate-autoload-cookie' controls the magic comment
-string used by `update-file-autoloads' to find autoloaded forms.  The
-variable `generated-autoload-file' similarly controls the name of the
-file where `update-file-autoloads' writes the calls to `autoload'.
-The default values are ";;;###autoload" and `loaddefs.el',
-respectively.
-
-** New primitives `list-system-processes' and `process-attributes'
-let Lisp programs access the processes that are running on the local
-machine.  See the doc strings of these functions for more details.
-Not all platforms support accessing this information; on those that
-don't, these primitives will return nil.
-
-** New variable `user-emacs-directory'.
-Use this instead of "~/.emacs.d".
-
-** If a local hook function has a non-nil `permanent-local-hook'
-property, `kill-all-local-variables' does not remove it from the local
-value of the hook variable; it remains even if you change major modes.
-
-** `frame-inherited-parameters' lets new frames inherit parameters from
-the selected frame.
-
-** New keymap `input-decode-map' overrides like key-translation-map, but
-applies before function-key-map.  Also it is terminal-local contrary to
-key-translation-map.  Terminal-specific key-sequences are generally added to
-this map rather than to function-key-map now.
-
-** `ignore-errors' is now a standard macro (does not require the CL package).
-
-** `interprogram-paste-function' can now return one string or a list
-of strings.  In the latter case, Emacs puts the second and following
-strings on the kill ring.
-
-** In `condition-case', a handler can specify "let the debugger run first".
-You do this by writing `debug' in the list of conditions to be handled,
-like this:
-
-    (condition-case nil
-       (foo bar)
-      ((debug error) nil))
-
-** clone-indirect-buffer now runs the clone-indirect-buffer-hook.
-
-** `beginning-of-defun-function' now takes one argument, the count given to
-`beginning-of-defun'.  (N.B. `end-of-defun-function' doesn't take any
-arguments.)
-
-** `file-remote-p' has new optional parameters IDENTIFICATION and CONNECTED.
-IDENTIFICATION specifies which part of the remote identifier has to be
-returned.  With CONNECTED passed non-nil, it is checked whether a
-remote connection has been established already.
-
-** The new macro `declare-function' suppresses compiler warnings about
-undefined functions.
-
-** Changes to interactive function handling
-
-*** The new interactive spec code ^ says to first call
-handle-shift-selection if shift-select-mode is non-nil, before reading
-the command arguments.  This is used for shift-selection (see above).
-
-*** Built-in functions can now have an interactive specification that
-is not a prompt string.  If the `intspec' parameter of a `DEFUN'
-starts with a `(', the string is evaluated as a Lisp form.
-
-*** The interactive-form of a function can be added post-facto via the
-`interactive-form' symbol property.  Mostly useful to add complex
-interactive forms to subroutines.
-
-** Region changes
-
-*** Commands should use `use-region-p' to test whether there is
-an active region that they should operate on.
-
-*** `region-active-p' returns non-nil when Transient Mark mode is
-enabled and the mark is active.  Most commands that act specially on
-the active region in Transient Mark mode should use `use-region-p'
-instead of `region-active-p', because `use-region-p' obeys the new
-user option `use-empty-active-region' (see Editing Changes, above).
-
-*** If a command sets `transient-mark-mode' to (only . OLDVAL), that
-means to activate transient-mark-mode temporarily, until the next
-unshifted point motion command or mark deactivation.  Afterwards,
-reset transient-mark-mode to the value OLDVAL.  The values `only' and
-`identity', introduced in Emacs 22, are now deprecated.
-
-** Emacs session information
-
-*** The new variables `before-init-time' and `after-init-time' record the
-value of `current-time' before and after Emacs loads the init files.
-
-*** The new function `emacs-uptime' returns the uptime of an Emacs instance.
-
-*** The new function `emacs-init-time' returns the duration of the
-Emacs initialization.
-
-** Changes affecting display-buffer
-
-*** display-buffer tries to be smarter when splitting windows.
-The new option split-window-preferred-function lets you specify your own
-function to pop up new windows.  Its default value split-window-sensibly
-can split a window either vertically or horizontally, whichever seems
-more suitable in the current configuration.  You can tune the behavior
-of split-window-sensibly by customizing split-height-threshold and the
-new option split-width-threshold.  Both options now take the value nil
-to inhibit splitting in one direction.  Setting split-width-threshold to
-nil inhibits horizontal splitting and gets you the behavior of Emacs 22
-in this respect.  In any case, display-buffer may now split the largest
-window vertically even when it is not as wide as the containing frame.
-
-*** If pop-up-frames has the value `graphic-only', display-buffer only
-makes a separate frame on graphic displays.
-
-*** select-frame and set-frame-selected-window have a new optional
-argument NORECORD.  If non-nil, this will avoid messing with the order
-of recently selected windows and the buffer list.
-
-** Window parameters can now be defined.
-These are analogous to frame parameters, but are associated with
-individual windows.
-
-*** The new functions window-parameters, window-parameter, and
-set-window-parameter are used to query and set window parameters.
-
-** Minibuffer and completion changes
-
-*** A list of default values can be specified for the DEFAULT argument of
-functions `read-from-minibuffer', `read-string', `read-command',
-`read-variable', `read-buffer', `completing-read'.  Elements of this list
-are available for inserting into the minibuffer by typing `M-n'.
-For empty input these functions return the first element of this list.
-
-*** New function `read-regexp' uses the regexp history and some useful
-regexp defaults (string at point, last Isearch/replacement regexp/string)
-via M-n when reading a regexp in the minibuffer.
-
-*** minibuffer-local-must-match-filename-map is now named
-minibuffer-local-filename-must-match-map.
-
-*** The `require-match' argument to `completing-read' accepts the new
-values `confirm-only' and `confirm-after-completion'.
-
-** Search and replacement changes
-
-*** The regexp form \(?<num>:<regexp>\) specifies the group number explicitly.
-
-*** New function `match-substitute-replacement' returns the result of
-`replace-match' without actually using it in the buffer.
-
-*** The new variable `replace-search-function' determines the function
-to use for searching in query-replace and replace-string.  The
-function it specifies is called by `perform-replace' when its 4th
-argument is nil.
-
-*** The new variable `replace-re-search-function' determines the
-function to use for searching in `query-replace-regexp',
-`replace-regexp', `query-replace-regexp-eval', and
-`map-query-replace-regexp'.  The function it specifies is called by
-`perform-replace' when its 4th argument is non-nil.
-
-*** New keymap `search-map' bound to `M-s' provides global bindings
-for search related commands.
-
-*** New keymap `multi-query-replace-map' contains additonal keys bound
-to `automatic-all' and `exit-current' for multi-buffer interactive replacement.
-
-*** The variable `inhibit-changing-match-data', if non-nil, prevents
-the search and match primitives from changing the match data.
-
-*** New functions `word-search-forward-lax' and `word-search-backward-lax'.
-These are like `word-search-forward and `word-search-backward', except
-that the end of the search string need not match a word boundary,
-unless it ends in whitespace.
-
-** File handling changes
-
-*** set-file-modes is now interactive and can take the mode value in
-symbolic notation thanks to auxiliary functions.
-
-*** file-local-variables-alist stores an alist of file-local
-variables defined in the current buffer.
-
-** Face-remapping
-
-*** Each face can be remapped to a different face definition using the
-variable `face-remapping-alist'.  This is an alist that maps faces to
-replacement definitions (which can be face names, lists of face names,
-or attribute/value plists.  If this variable is buffer-local, the
-remapping occurs only in that buffer.
-
-*** text-scale-mode remaps the default face to a larger or smaller
-size in the current buffer.  This feature is used by the Buffer Face
-menu and the new `C-x C-+', `C-x C--', and `C-x C-0' commands (see
-Editing Changes, above).
-
-*** New functions:
-
-**** `face-remap-add-relative' adds a face remapping entry to the
-current buffer.
-
-**** ``face-remap-remove-relative' removes a face remapping entry from
-the current buffer.
-
-**** `face-remap-reset-base' restores a face to its global definition.
-
-**** `face-remap-set-base' sets the base remapping of a face.
-
-** Process changes
-
-*** The new function `start-file-process' is similar to `start-process',
-but obeys file handlers.  The file handler is chosen based on
-`default-directory'.  The functions `start-file-process-shell-command'
-and `process-file-shell-command' are also new; they call internally
-`start-file-process' and `process-file', respectively.
-
-*** The new function `process-lines' executes an external program and
-returns its output as a list of lines.
-
-** Character code, representation, and charset changes.
-
-*** In multibyte buffers and strings, characters are represented by
-UTF-8 byte sequences.  The character code space is now 0x0..0x3FFFFF
-with no gap; code points 0x0..0x10FFFF are Unicode characters of the
-same code points, while code points 0x3FFF80..0x3FFFFF are raw 8-bit
-bytes.
-
-*** Generic characters no longer exist.
-
-*** The concept of a charset has changed.  A single character may
-belong to multiple charsets (e.g. a-grave, U+00E0, belongs to charsets
-unicode, iso-8859-1, iso-8859-3, etc).
-
-**** The dimension of a charset is now 1, 2, 3, or 4, and the size of
-each dimension is no longer limited to 94 or 96.
-
-**** A dynamic charset priority list is used to infer the charset of
-characters for display.
-
-*** The functions `split-char' and `make-char' now accept up to 4
-positional codes instead of just 2.
-
-*** The functions `encode-char' and `decode-char' now accept any character sets.
-
-*** The function `define-charset' now accepts a completely different
-form of arguments (old-style arguments still work).
-
-*** The value of the function `char-charset' depends on the current
-priorities of charsets.
-
-*** The function get-char-code-property now accepts many Unicode base
-character properties.  They are `name', `general-category',
-`canonical-combining-class', `bidi-class', `decomposition',
-`decimal-digit-value', `digit-value', `numeric-value', `mirrored',
-`old-name', `iso-10646-comment', `uppercase', `lowercase', and
-`titlecase'.
-
-*** The functions `modify-syntax-entry' and `modify-category-entry' now
-accept a cons of characters as the first argument, and modify all
-entries in that range of characters.
-
-*** Use of `translation-table-for-input' for character code unification
-is now obsolete, since Emacs 23.1 and later uses Unicode as basis for
-internal representation of characters.
-
-*** New functions:
-
-**** `characterp' returns t if and only if the argument is a character.
-This replaces `char-valid-p', which is now obsolete.
-
-**** `max-char' returns the maximum character code (currently #x3FFFFF).
-
-**** `define-charset-alias' defines an alias of a charset.
-
-**** `set-charset-priority' sets priorities of charsets.
-
-**** `charset-priority-list' returns a prioritized list of charsets.
-
-**** `unibyte-string' makes a unibyte string from bytes.
-
-**** `define-char-code-property' defines a character code property.
-
-**** `char-code-property-description' returns the description string of
-a character code property.
-
-*** New variables:
-
-**** `find-word-boundary-function-table' is a char-table of functions to
-search for a word boundary.
-
-**** `char-script-table' is a char-table of script names.
-
-**** `char-width-table' is a char-table of character widths.
-
-**** `print-charset-text-property' controls how to handle `charset' text
-property on printing a string.
-
-**** `printable-chars' is a char-table of printable characters.
-
-** Code conversion changes
-
-*** The new function `define-coding-system' should be used to define a
-coding system instead of `make-coding-system' (which is now obsolete).
-
-*** The functions `encode-coding-region' and `decode-coding-region'
-have an optional 4th argument to specify where the result of
-conversion should go.
-
-*** The functions `encode-coding-string' and `decode-coding-string'
-have an optional 4th argument specifying a buffer to store the result
-of conversion.
-
-*** The new variable `inhibit-null-byte-detection' controls whether to
-consider text with null bytes as binary data.  By default, it is
-`nil', and Emacs uses `no-conversion' for any text containing null
-bytes.
-
-*** The functions `set-coding-priority' and `make-coding-system' are obsolete.
-
-*** New functions:
-
-**** `with-coding-priority' executes Lisp code using the specified
-coding system priority order.
-
-**** `check-coding-systems-region' checks if the text in the region is
-encodable by the specified coding systems.
-
-**** `coding-system-aliases' returns a list of aliases of a coding system.
-
-**** `coding-system-charset-list' returns a list of charsets supported
-by a coding system.
-
-**** `coding-system-priority-list' returns a list of coding systems
-ordered by their priorities.
-
-**** `set-coding-system-priority' sets priorities of coding systems.
-
-**** `coding-system-from-name' returns a coding system matching with
-the argument name.
-
-** There is a new input method, Robin, different from Quail.
-It has three functionalities:
- i) a simple input method (converts an ASCII sequence into a string).
-ii) converts an existing buffer substring into another string
-iii) reverse conversion (each character produced by a
-robin rule can hold the original ASCII sequence as a char-code-property)
-
-*** The new function `robin-define-package' defines a Robin package.
-
-*** The new function `robin-modify-package' modifies an existing Robin package.
-
-*** The new function `robin-use-package' starts using a Robin package
-as an input method.
-
-*** The new function `string-to-unibyte' is like `string-as-unibyte'
-but signals an error if STRING contains a non-ASCII, non-eight-bit
-character.
-
-** Changes related to the new font backend
-
-*** Which font backends to use can be specified by the X resource
-"FontBackend".  For instance, to use both X core fonts and Xft fonts:
-
-Emacs.FontBackend: x,xft
-
-If this resource is not set, Emacs tries to use all font backends
-available on your graphic device.
-
-*** New frame parameter `font-backend' specifies a list of
-font-backends supported by the frame's graphic device.  On X, they are
-currently `x' and `xft'.
-
-*** The function `set-fontset-font' now accepts a script name as the
-second argument, and has an optional 5th argument to control how to
-set the font.
-
-*** New functions:
-
-**** `fontp' checks if the argument is a font-spec or font-entity.
-
-**** `font-spec' creates a new font-spec object.
-
-**** `font-get' returns a font property value.
-
-**** `font-put' sets a font property value.
-
-**** `font-face-attributes' returns a plist of face attributes set by a font.
-
-**** `list-fonts' returns a list of font-entities matching a font spec.
-
-**** `find-font' returns the font-entity best matching the given font spec.
-
-**** `font-family-list' returns a list of family names of available fonts.
-
-**** `font-xlfd-name' returns an XLFD name of a given font spec, font
-entity, or font object.
-
-**** `clear-font-cache' clears all font caches.
-
-** Changes related to multiple-terminal (multi-tty) support
-
-*** $TERM is now set to `dumb' for subprocesses.  If you want to know the
-$TERM inherited by Emacs you will have to look inside initial-environment.
-
-*** $DISPLAY is now dynamically inherited from the frame's `display'.
-
-*** The `window-system' variable is now frame-local.  The new
-`initial-window-system' variable contains the `window-system' value
-for the first frame.  `window-system' is also now a function that
-takes a frame argument.
-
-*** The `keyboard-translate-table' variable and the terminal and
-keyboard coding systems are now terminal-local.
-
-*** You can specify a terminal device (`tty' parameter) and a terminal
-type (`tty-type' parameter) to `make-terminal-frame'.
-
-*** The function `make-frame-on-display' now works during a tty
-session.
-
-*** A new `terminal' data type.
-The functions `get-device-terminal', `terminal-parameters',
-`terminal-parameter', `set-terminal-parameter' use this data type.
-
-*** Function key sequences are now mapped using `local-function-key-map',
-a new variable.  This inherits from the global variable function-key-map,
-which is not used directly any more.
-
-*** New hooks:
-
-**** before-hack-local-variables-hook is called after setting new
-variable file-local-variables-alist, and before actually applying the
-file-local variables.
-
-**** `suspend-tty-functions' and `resume-tty-functions' are called
-after a tty frame has been suspended or resumed, respectively.  The
-functions are called with the terminal id of the frame being
-suspended/resumed as a parameter.
-
-**** The special hook `delete-terminal-functions' is called before
-deleting a terminal.
-
-*** New functions:
-
-**** `delete-terminal'
-
-**** `suspend-tty'
-
-**** `resume-tty'.
-
-*** `initial-environment' holds the environment inherited from Emacs's parent.
-
-** Redisplay changes
-
-*** For underlined characters, the distance between the underline and
-the baseline is controlled by a new variable, `underline-minimum-offset'.
-
-*** You can now pass the value of the `invisible' property to
-invisible-p to check whether it would cause the text to be invisible.
-This is convenient when checking invisibility of text with no buffer
-position (e.g. in before/after-strings).
-
-*** `clear-image-cache' can be told to flush only images of a specific file.
-
-*** `vertical-motion' can now be given a goal column.
-It now accepts a cons cell (COLS . LINES) in its first argument, which
-says to stop, where possible, at a pixel x-position equal to COLS
-times the default column width.
-
-*** redisplay-end-trigger-functions, set-window-redisplay-end-trigger,
-and window-redisplay-end-trigger are obsolete.  Use `jit-lock-register'
-instead.
-
-*** The new variables `wrap-prefix' and `line-prefix' specify display
-specs which are appended at display-time to every continuation line
-and non-continuation line, respectively.  In addition, Emacs
-recognizes the `wrap-prefix' and `line-prefix' text or overlay
-properties; these have the same effects as the variables of the same
-name, but take precedence.
-
-** The Lisp interpreter now treats non-breaking space as whitespace.
-
-** Miscellaneous new functions
-
-*** `apply-partially' performs a "curried" application of a function.
-
-*** `buffer-swap-text' swaps text between two buffers.  This can be
-useful for modes such as tar-mode, archive-mode, RMAIL.
-
-*** `combine-and-quote-strings' produces a single string from a list of strings
-sticking a separator string in between each pair, and quoting those
-strings that include the separator as their substring.  Useful for
-consing shell command lines from the individual arguments.
-
-*** `custom-note-var-changed' tells Custom to treat the change in a
-certain variable as having been made within Custom.
-
-*** `face-all-attributes' returns an alist describing all the basic
-attributes of a given face.
-
-*** `format-seconds' converts a number of seconds into a readable
-string of days, hours, etc.
-
-*** `image-refresh' refreshes all images associated with a given image
-specification.
-
-*** `locate-user-emacs-file' helps packages to select the appropriate
-place to save user-specific files.  It defaults to `user-emacs-directory'
-unless the file already exists at $HOME.
-
-*** `read-color' reads a color name using the minibuffer.
-
-*** `read-shell-command' does what its name says, with completion.  It
-uses the minibuffer-local-shell-command-map for that.
-
-*** `split-string-and-unquote' splits a string into a list of substrings
-on the boundaries of a given delimiter, and unquotes the substrings that
-are quoted.  Useful for taking apart shell commands.
-
-*** The two new functions `looking-at-p' and `string-match-p' can do
-the same matching as `looking-at' and `string-match' without changing
-the match data.
-
-*** The two new functions `make-serial-process' and
-`serial-process-configure' provide a Lisp interface to the new serial
-port support (see Emacs changes, above).
-
-** Miscellaneous new variables
-
-*** `auto-save-include-big-deletions', if non-nil, means auto-save is
-not turned off automatically after a big deletion.
-
-*** `read-circle', if nil, disables the reading of recursive Lisp
-structures using the #N= and #N# syntax.
-
-*** `this-command-keys-shift-translated' is non-nil if the key
-sequence invoking the current command was found by shift-translation.
-
-*** `window-point-insertion-type' determines the insertion-type of the
-marker used for window-point.
-
-*** bookmark provides `bookmark-make-record-function' so special major
-modes like Info can teach bookmark.el how to save and restore the
-relevant data.
-
-*** `fill-forward-paragraph-function' specifies which function the
-filling code should use to find paragraph boundaries.
+** Progress reporters can now "spin".
+The MIN-VALUE and MAX-VALUE arguments of `make-progress-reporter' can
+now be nil, or omitted.  This makes a "non-numeric" reporter.  Each
+time you call `progress-reporter-update' on that progress reporter,
+with a nil or omitted VALUE argument, the reporter message is
+displayed with a "spinning bar".
 
 \f
-* New Packages for Lisp Programming in Emacs 23.1
+* Changes in Emacs 24.1 on non-free operating systems
 
-** The new package avl-tree.el deals with the AVL tree data structure.
+** New configure.bat option --enable-checking builds emacs with extra
+runtime checks.
 
-** The new package check-declare.el verifies the accuracy of
-declare-function macros (see Lisp Changes, above).
+** New configure.bat option --distfiles to specify files to be
+   included in binary distribution
 
-** find-cmd.el can build `find' commands using lisp syntax.
-
-** The package misearch.el has been added.  It allows Isearch to search
-through multiple buffers.  A variable `multi-isearch-next-buffer-function'
-defines the function to call to get the next buffer to search in the series
-of multiple buffers.  Top-level functions `multi-isearch-buffers',
-`multi-isearch-buffers-regexp', `multi-isearch-files' and
-`multi-isearch-files-regexp' accept a single argument that specifies
-a list of buffers/files to search for a string/regexp.
-
-** The new major mode `special-mode' is intended as a parent for
-major modes such as those that set the "'mode-class 'special" property.
+** New make target `dist' to create binary disttribution for Windows
+   platform
 
 \f
 ----------------------------------------------------------------------
@@ -2424,5 +538,3 @@ Local variables:
 mode: outline
 paragraph-separate: "[         \f]*$"
 end:
-
-arch-tag: e759449d-88b3-4de4-9900-3a6c3dfa23e2
diff --git a/etc/NEWS.23 b/etc/NEWS.23
new file mode 100644 (file)
index 0000000..74291ba
--- /dev/null
@@ -0,0 +1,2428 @@
+GNU Emacs NEWS -- history of user-visible changes.
+
+Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+See the end of the file for license conditions.
+
+Please send Emacs bug reports to bug-gnu-emacs@gnu.org.
+If possible, use M-x report-emacs-bug.
+
+This file is about changes in Emacs version 23.
+
+See files NEWS.22, NEWS.21, NEWS.20, NEWS.19, NEWS.18, 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.
+
+\f
+* Installation Changes in Emacs 23.3
+
+* Startup Changes in Emacs 23.3
+
+* Changes in Emacs 23.3
+
+\f
+* Editing Changes in Emacs 23.3
+
+\f
+* Changes in Specialized Modes and Packages in Emacs 23.3
+
+---
+** The appt-add command takes an optional argument for the warning time.
+This can be used in place of the default appt-message-warning-time.
+
+\f
+* New Modes and Packages in Emacs 23.3
+
+\f
+* Incompatible Lisp Changes in Emacs 23.3
+
+\f
+* Lisp changes in Emacs 23.3
+
+** New function byte-to-string, like char-to-string but for bytes.
+
+\f
+* Changes in Emacs 23.3 on non-free operating systems
+
+\f
+* Installation Changes in Emacs 23.2
+
+** New configure options for Emacs developers.
+These are not new features; only the configure flags are new.
+
+*** --enable-profiling builds Emacs with profiling enabled.
+This might not work on all platforms.
+
+*** --enable-checking[=OPTIONS] builds emacs with extra runtime checks.
+
+** `make install' now consistently ignores umask, creating a
+world-readable install.
+
+** Emacs compiles with Gconf support, if it is detected.
+Use the configure option --without-gconf to disable this.
+This is used by the `font-use-system-font' feature (see below).
+
+* Startup Changes in Emacs 23.2
+
+** The command-line option -Q (--quick) also inhibits loading X resources.
+However, if Emacs is compiled with the Lucid or Motif toolkit, X
+resource settings for the graphical widgets are still applied.
+On Windows, the -Q option causes Emacs to ignore Registry settings,
+but environment variables set on the Registry are still honored.
+
+*** The new variable `inhibit-x-resources' shows whether X resources
+were loaded.
+
+** New command-line option -mm (--maximized) maximizes the initial frame.
+
+* Changes in Emacs 23.2
+
+** The maximum size of buffers (and the largest fixnum) is doubled.
+On typical 32bit systems, buffers can now be up to 512MB.
+
+** The default value of `trash-directory' is now nil.
+This means that `move-file-to-trash' trashes files according to
+freedesktop.org specifications, the same method used by the Gnome,
+KDE, and XFCE desktops.  (This change has no effect on Windows, which
+uses `system-move-file-to-trash' for trashing.)
+
+** The pointer now becomes invisible when typing.
+Customize `make-pointer-invisible' to disable this feature.
+
+** Font changes
+
+*** Emacs can use the system default monospaced font in Gnome.
+To enable this feature, set `font-use-system-font' to non-nil (it is
+nil by default).  If the system default changes, Emacs changes also.
+This feature requires Gconf support, which is automatically included
+at compile-time if configure detects the gconf libraries (you can
+disable this with the configure option --without-gconf).
+
+*** On X11, Emacs reacts to Xft changes made by configuration tools,
+via the XSETTINGS mechanism.  This includes antialias, hinting,
+hintstyle, RGBA, DPI and lcdfilter changes.
+
+** Killing a buffer with a running process now asks for confirmation.
+To remove this query, remove `process-kill-buffer-query-function' from
+`kill-buffer-query-functions', or set the appropriate process flag
+with `set-process-query-on-exit-flag'.
+
+** File-local variable changes
+
+*** Specifying a minor mode as a local variables enables that mode,
+unconditionally.  The previous behavior, toggling the mode, was
+neither reliable nor generally desirable.
+
+*** There are new commands for adding and removing file-local variables:
+`add-file-local-variable', `delete-file-local-variable',
+`add-file-local-variable-prop-line', and
+`delete-file-local-variable-prop-line'.
+
+*** There are new commands for adding and removing directory-local variables,
+and copying them to and from file-local variable lists:
+`add-dir-local-variable', `delete-dir-local-variable',
+`copy-dir-locals-to-file-locals',
+`copy-dir-locals-to-file-locals-prop-line' and
+`copy-file-locals-to-dir-locals'.
+
+** Internationalization changes
+
+*** Unibyte sessions are now considered obsolete.
+This refers to the EMACS_UNIBYTE environment variable as well as the
+--unibyte, --multibyte, --no-multibyte, and --no-unibyte command line
+arguments.  Customizing enable-multibyte-characters and setting
+default-enable-multibyte-characters are also deprecated.
+
+*** New coding system `utf-8-hfs'.
+This is suitable for default-file-name-coding-system on Mac OS X; see
+international/ucs-normalize.el.
+
+** Function arguments in *Help* buffers are now shown in upper-case.
+Customize `help-downcase-arguments' to t to show them in lower-case.
+
+** New command `async-shell-command', bound globally to `M-&'.
+This executes the command asynchronously, similar to calling `M-!' and
+manually adding an ampersand to the end of the command.  With `M-&',
+you don't need the ampersand.  The output appears in the buffer
+`*Async Shell Command*'.
+
+** When running in a new enough xterm (newer than version 242), Emacs
+asks xterm what the background color is and it sets up faces
+accordingly for a dark background if needed (the current default is to
+consider the background light).
+
+\f
+* Editing Changes in Emacs 23.2
+
+** Kill-ring and selection changes
+
+*** If `select-active-regions' is t, any active region automatically
+becomes the primary selection (for interaction with other window
+applications).  If you enable this, you might want to bind
+`mouse-yank-primary' to Mouse-2.
+
+*** When `save-interprogram-paste-before-kill' is non-nil, the kill
+commands save the interprogram-paste selection into the kill ring
+before doing anything else.  This avoids losing the selection.
+
+*** When `kill-do-not-save-duplicates' is non-nil, identical
+subsequent kills are not duplicated in the `kill-ring'.
+
+** Completion changes
+
+*** The new command `completion-at-point' provides mode-sensitive completion.
+
+*** tab-always-indent set to `complete' lets TAB do completion as well.
+
+*** The new completion-style `initials' is available.
+For instance, this can complete M-x lch to list-command-history.
+
+*** The new variable `completions-format' determines how completions
+are displayed in the *Completions* buffer.  If you set it to
+`vertical', completions are sorted vertically in columns.
+
+** The default value of `blink-matching-paren-distance' is increased.
+
+** M-n provides more default values in the minibuffer for commands
+that read file names.  These include the file name at point (when ffap
+is loaded without ffap-bindings), the file name on the current line
+(in Dired buffers), and the directory names of adjacent Dired windows
+(for Dired commands that operate on several directories, such as copy,
+rename, or diff).
+
+** M-r is bound to the new `move-to-window-line-top-bottom'.
+This moves point to the window center, top and bottom on successive
+invocations, in the same spirit as the C-l (recenter-top-bottom)
+command.
+
+** The new variable `recenter-positions' determines the default
+cycling order of C-l (`recenter-top-bottom').
+
+** The abbrevs file is now a file named abbrev_defs in
+user-emacs-directory; but the old location, ~/.abbrev_defs, is used if
+that file exists.
+
+\f
+* Changes in Specialized Modes and Packages in Emacs 23.2
+
+** The bookmark menu has a narrowing search via bookmark-bmenu-search.
+
+** Calc
+
+*** The Calc settings file is now a file named calc.el in
+user-emacs-directory; but the old location, ~/.calc.el, is used if
+that file exists.
+
+*** Graphing commands (`g f' etc.) now work on MS-Windows, if you have
+the native Windows port of Gnuplot version 3.8 or later installed.
+
+** Calendar and diary
+
+*** Fancy diary display is now the default.
+If you prefer the simple display, customize `diary-display-function'.
+
+*** The diary's fancy display now enables view-mode.
+
+*** The command `calendar-current-date' accepts an optional argument
+giving an offset from today.
+
+** Desktop
+
+*** The default value for `desktop-buffers-not-to-save' is nil.
+This means Desktop will try restoring all buffers, when you restart
+your Emacs session.  Also, `desktop-buffers-not-to-save' is only
+effective for buffers that have no associated file.  If you want to
+exempt buffers that do correspond to files, customize the value of
+`desktop-files-not-to-save' instead.
+
+** Dired
+
+*** The new variable `dired-auto-revert-buffer', if non-nil, causes
+Dired buffers to be reverted automatically on revisiting them.
+
+** DocView
+
+*** When `doc-view-continuous' is non-nil, scrolling a line
+on the page edge advances to the next/previous page.
+
+** Elint
+
+*** Elint now uses compilation-mode.
+
+*** Elint can now scan individual files and whole directories,
+and can be run in batch mode.
+
+*** Elint does a more thorough initialization, and recognizes more built-in
+functions and variables.  Customize `elint-scan-preloaded' if you want
+to sacrifice some accuracy for a faster startup.
+
+*** Elint attempts some basic understanding of featurep and (f)boundp tests.
+
+*** Customize `elint-ignored-warnings' to suppress some warnings.
+
+** GDB-UI
+
+*** Toolbar functionality for reverse debugging.  Display of STL
+collections as watch expressions.  These features require GDB 7.0 or later.
+
+** Grep
+
+*** A new command `zrgrep' searches recursively in gzipped files.
+
+** Info
+
+*** The new command `Info-virtual-index' bound to "I" displays a menu of
+matched topics found in the index.
+
+*** The new command `info-finder' replaces finder.el with a virtual Info
+manual that generates an Info file which gives the same information
+through a menu structure.
+
+** LaTeX mode now provides completion (via completion-at-point).
+
+** Message mode is now the default mode for composing mail.
+
+The default for `mail-user-agent' is now message-user-agent, so the
+C-x m (`compose-mail') command uses Message mode instead of Mail mode.
+
+Message mode has been included in Emacs, as part of the Gnus package,
+for several years.  It provides several features that are absent in
+Mail mode, such as MIME handling.
+
+*** If the user has not customized mail-user-agent, `compose-mail'
+checks for Mail mode customizations, and issues a warning if these
+customizations are found.  This alerts users who may otherwise be
+unaware that their mail configuration has changed.
+
+To disable this check, set compose-mail-user-agent-warnings to nil.
+
+** The default value of mail-interactive is t, since Emacs 23.1.
+(This was not announced at the time.)  It means that when sending mail,
+Emacs will wait for the process sending mail to return.  If you
+experience delays when sending mail, you may wish to set this to nil.
+
+** nXML mode is now the default for editing XML files.
+
+** pcomplete provides a new command `pcomplete-std-completion' which
+is similar to `pcomplete' but using the standard completion UI code.
+
+** Shell (and other comint modes)
+
+*** M-s is no longer bound to `comint-next-matching-input'.
+
+*** M-r is now bound to `comint-history-isearch-backward-regexp'.
+This starts an incremental search of the comint/shell input history.
+
+*** ansi-color is now enabled by default in Shell mode.
+To disable it, set ansi-color-for-comint-mode to nil.
+
+** Tramp
+
+*** New connection methods "rsyncc", "imap" and "imaps".
+On systems which support GVFS-Fuse, Tramp offers also the new
+connection methods "dav", "davs", "obex" and "synce".
+
+** VC and related modes
+
+*** When using C-x v v or C-x v i on a unregistered file that is in a
+directory not controlled by any VCS, ask the user what VC backend to
+use to create a repository, create a new repository and register the
+file.
+
+*** New command `vc-root-print-log', bound to `C-x v L'.
+This displays a `*vc-change-log*' buffer showing the history of the
+version-controlled directory tree as a whole.
+
+*** New command `vc-root-diff', bound to `C-x v D'.
+This is similar to `vc-diff', but compares the entire directory tree
+of the current VC directory with its working revision.
+
+*** `C-x v l' and `C-x v L' do not show the full log by default.
+The number of entries shown can be chosen interactively with a prefix
+argument, or by customizing vc-log-show-limit.  The `*vc-change-log*'
+buffer now contains buttons at the end of the buffer, which can be
+used to increase the number of entries shown.  RCS, SCCS, and CVS do
+not support this feature.
+
+*** vc-annotate supports annotations through file copies and renames,
+it displays the old names for the files and it can show logs/diffs for
+the corresponding lines.  Currently only Git and Mercurial take
+advantage of this feature.
+
+*** The log command in vc-annotate can display a single log entry
+instead of redisplaying the full log.  The RCS, CVS and SCCS VC
+backends do not support this.
+
+*** When a file is not found, VC will not try to check it out of RCS anymore.
+
+*** Diff and log operations can be used from Dired buffers.
+
+*** vc-git changes
+
+**** The short log format for git makes use of the graph display,
+so it's not supported on git versions earlier than 1.5.6.
+
+**** vc-dir uses the --relative option of git, and so requires at least
+git version 1.5.5.
+
+**** Support for operating with stashes has been added to vc-dir:
+the stash list is displayed in the *vc-dir* header, stashes can be
+created, removed, applied and their content displayed.
+
+*** vc-bzr supports operating with shelves: the shelve list is
+displayed in the *vc-dir* header, shelves can be created, removed and applied.
+
+*** log-edit-strip-single-file-name controls whether or not single filenames
+are stripped when copying text from the ChangeLog to the *VC-Log* buffer.
+
+** Miscellaneous
+
+*** Interactively `multi-isearch-buffers' and `multi-isearch-buffers-regexp'
+read buffer names to search, one by one, ended with RET.  With a prefix
+argument, they ask for a regexp, and search in buffers whose names match
+the specified regexp.  Interactively `multi-isearch-files' and
+`multi-isearch-files-regexp' read file names to search, one by one,
+ended with RET.  With a prefix argument, they ask for a wildcard, and
+search in file buffers whose file names match the specified wildcard.
+
+*** Autorevert Tail mode now works also for remote files.
+
+*** The new eshell built-in commands `su' and `sudo' support Tramp.
+Thus, they change `default-directory' to reflect the new user id, and
+let commands run under that user's permissions.  This works even when
+`default-directory' is already remote.  Calling the external commands
+is possible via `*su' or `*sudo', respectively.
+
+** Obsolete packages
+
+*** sym-comp.el is now obsolete, superseded by completion-at-point.
+
+*** lucid.el and levents.el are now obsolete.
+
+\f
+* New Modes and Packages in Emacs 23.2
+
+** CEDET (the Collection of Emacs Development Tools) is now in Emacs.
+This is a collection of packages to aid with using Emacs as an IDE
+(integrated development environment):
+
+*** The Semantic package allows the use of parsers to intelligently
+edit and navigate source code.  Parsers for C/C++, Java, Javascript,
+and several other languages are included by default, and Semantic can
+also interface with external tools such as GNU Global and GNU Idutils.
+
+To enable Semantic, use the global minor mode `semantic-mode'.
+See the Semantic manual for details.
+
+*** EDE (Emacs Development Environment) is a package for managing code
+projects, including features such as automatic Makefile generation.
+
+To enable EDE, use the minor mode `global-ede-mode'.
+See the EDE manual for details.
+
+*** SRecode is a library for recoding Semantic tags back into source
+code.  It is currently used by some parts of Semantic and EDE; in the
+future, it may be used for code generation features.
+
+*** The EIEIO library implements a subset of the Common Lisp Object
+System (CLOS).  It is used by the other CEDET packages.
+
+** mpc.el is a front end for the Music Player Daemon.  Run it with M-x mpc.
+
+** htmlfontify.el turns a fontified Emacs buffer into an HTML page.
+
+** js.el is a new major mode for JavaScript files.
+
+** imap-hash.el is a new library to address IMAP mailboxes as hashtables.
+
+\f
+* Incompatible Lisp Changes in Emacs 23.2
+
+** The Lisp reader turns integers that are too large/small into floats.
+For instance, on machines where `536870911' is the largest integer,
+reading `536870912' gives the floating-point object `536870912.0'.
+
+This change only concerns the Lisp reader; it does not affect how
+actual integer objects overflow.
+
+** Several obsolete functions removed.
+The functions have been obsolete since Emacs 19, and are unlikely to
+be in use:
+
+  time-stamp-month-dd-yyyy, time-stamp-dd/mm/yyyy, time-stamp-mon-dd-yyyy
+  time-stamp-dd-mon-yy, time-stamp-yy/mm/dd, time-stamp-yyyy/mm/dd,
+  time-stamp-yyyy-mm-dd, time-stamp-yymmdd, time-stamp-hh:mm:ss,
+  time-stamp-hhmm, baud-rate
+
+** Support for generating Emacs 18 compatible bytecode (by setting
+the variable `byte-compile-compatibility') has been removed.
+
+** In image-mode.el `image-mode-maybe' is obsolete.
+Instead, you can either use `image-mode' (which displays an image file
+as the actual image initially), or `image-mode-as-text' (when you want
+to display an image file as text initially).  `image-mode-as-text' is a
+combination of a non-image mode from `auto-mode-alist' (or Fundamental
+mode) and `image-minor-mode'.  `image-minor-mode' provides a `C-c C-c'
+key binding to toggle image display.
+`image-toggle-display-text' removes image properties.
+`image-toggle-display-image' adds image properties.
+`image-toggle-display' toggles between `image-mode-as-text' and `image-mode'.
+
+\f
+* Lisp changes in Emacs 23.2
+
+** All the default-FOO variables that hold the default value of the FOO
+variable, are now declared obsolete.
+
+** read-key is a function halfway between read-event and read-key-sequence.
+It reads a single key, but obeys input and escape sequence decoding.
+
+** Frame parameter changes
+
+*** You can give the `fullscreen' frame parameter the value `maximized'.
+This maximizes the frame.
+
+*** The new frame parameter `sticky' makes Emacs frames sticky in
+virtual desktops.
+
+** Completion changes
+
+*** completion-base-size is obsoleted by completion-base-position.
+This change causes a few backward incompatibilities, mostly with
+choose-completion-string-functions where the `mini-p' argument has
+been replaced by a `base-position' argument, and where the `base-size'
+argument is now always nil.
+
+*** New function `completion-in-region' to use the standard completion
+facilities on a particular region of text.
+
+*** The 4th arg to all-completions (aka hide-spaces) is declared obsolete.
+
+*** completion-annotate-function specifies how to compute annotations
+for completions displayed in *Completions*.
+
+** Minibuffer changes
+
+*** read-file-name-predicate is obsolete.  It was used to pass the predicate
+to read-file-name-internal because read-file-name-internal abused its `pred'
+argument to pass the current directory, but this hack is not needed
+any more.
+
+** Changes to file-manipulation functions
+
+*** `delete-directory' has an optional parameter RECURSIVE.
+
+*** New function `copy-directory', which copies a directory recursively.
+
+** called-interactively-p now takes one argument and replaces interactive-p
+which is now marked obsolete.
+
+** New function set-advertised-calling-convention makes it possible
+to obsolete arguments as well as make some arguments mandatory.
+
+** You can control which binding is preferentially shown in menus and
+docstrings by adding a `:advertised-binding' property to the corresponding
+command's symbol.  That property can hold a single binding or a list
+of bindings.
+
+** Network and process changes
+
+*** start-process-shell-command and start-file-process-shell-command
+now only take a single `command' argument.
+
+*** The new variable `process-file-side-effects' should be set to nil
+if a `process-file' call does not change a remote file.  This allows
+file name handlers such as Tramp to optimizations.
+
+*** make-network-process can now also create `seqpacket' Unix sockets.
+
+** Loading changes
+
+*** eval-next-after-load is obsolete.
+
+*** New hook `after-load-functions' run after loading an Elisp file.
+
+** Byte compilation changes
+
+*** Changing the file-names generated by byte-compilation by redefining
+the function `byte-compile-dest-file' before loading bytecomp.el is obsolete.
+Instead, customize byte-compile-dest-file-function.
+
+*** `byte-compile-warnings' has new members, `constants' and `suspicious'.
+
+** New macro with-silent-modifications to tweak text properties without
+affecting the buffer's modification state.
+
+** Hash tables have a new printed representation that is readable.
+The feature `hashtable-print-readable' identifies this new
+functionality.
+
+** New functions for performing Unicode normalization:
+ucs-normalize-NFD-region, ucs-normalize-NFD-string,
+ucs-normalize-NFC-region, ucs-normalize-NFC-string,
+ucs-normalize-NFKD-region, ucs-normalize-NFKD-string,
+ucs-normalize-NFKC-region, ucs-normalize-NFKC-string,
+ucs-normalize-HFS-NFD-region, ucs-normalize-HFS-NFD-string,
+ucs-normalize-HFS-NFC-region, ucs-normalize-HFS-NFC-string.
+
+** Face aliases can now be marked as obsolete, using the macro
+`define-obsolete-face-alias'.
+
+** New function `window-full-height-p', analogous to the full-width version.
+
+\f
+* Changes in Emacs 23.2 on non-free operating systems
+
+** On MS-Windows, `display-time' now displays the system load average
+as well as the time, as it does on GNU and Unix.
+
+\f
+* Installation Changes in Emacs 23.1
+
+** The default X toolkit is now Gtk+, rather than Lucid.
+The configure option `--with-gtk' has been removed.  Gtk is now the
+default toolkit, but you can use --with-x-toolkit=gtk if necessary.
+
+** New font code.
+Fonts are handled by new code capable of dealing with multiple font
+backends.  This uses the freetype and fontconfig libraries.
+
+*** Emacs now accepts font names supplied in the fontconfig format
+(e.g. "monospace-12:bold") and GTK format (e.g. "Monospace Bold 12").
+
+*** Added support for local fonts (fonts installed on the machine
+where Emacs is running).
+
+*** Added support for the Xft library for antialiasing.
+
+*** Added support for the otf library for complex text layout by
+OpenType fonts.
+
+*** Added support for the m17n library for text shaping.
+
+** Changes to image support
+
+*** configure now checks for libgif before libungif when searching for
+a GIF library.
+
+*** Emacs now supports the SVG image format through librsvg2.
+
+*** Emacs now supports multi-page TIFF images.
+
+** New NeXTSTEP-based port.
+This provides support for GNUstep (via the GNUstep libraries) and Mac
+OS X (via the Cocoa libraries).
+
+Specify --with-ns to configure for this.  By default, a self-contained
+app will be built (containing all lisp).  To install/share lisp with
+other emacsen (e.g. X11 build) use --disable-ns-self-contained.  See
+nextstep/README and nextstep/INSTALL in the Emacs source directory.
+
+** Mac OS X is no longer supported via Carbon.
+Use the NeXTSTEP port, described above.
+
+** The new configuration option "--with-dbus" enables D-Bus language
+bindings for Emacs.
+
+** Support for many obsolete platforms has been removed.
+See the list at the end of etc/MACHINES for details.
+
+*** Support for systems without alloca has been removed.
+
+*** Support for Sun windows has been removed.
+
+*** The `emacstool' utility has been removed.
+
+** The following platforms will be removed in a future Emacs version:
+If you are still using Emacs on one of these platforms, please email
+emacs-devel@gnu.org to inform the Emacs developers.
+
+*** Old GNU/Linux systems based on libc version 5.
+
+*** Old FreeBSD, NetBSD, and OpenBSD systems based on the COFF
+executable format.
+
+*** Solaris versions 2.6 and below.
+
+*** Solaris on IBM RS6000 machines.
+
+*** UNIX System V (the original SysV, not later platforms based on it).
+
+*** Unixware on non-x86 machines.
+
+*** Platforms not supporting shared libraries (i.e., requiring the
+NO_SHARED_LIBS compilation flag).
+
+** The configure options `--with-gcc', `--without-gcc' have been removed.
+Configure will use gcc by default.  Set the CC environment variable if
+you need control over which C compiler is used.
+
+** The refcards are now shipped as PDF files.
+
+** The manuals are now licensed under the GNU Free Documentation License v1.3,
+or any later version.
+
+** Emacs 23 comes with a new set of default icons.
+Various resolutions are available as etc/images/icons/hicolor/*/apps/emacs.png.
+The Emacs 22 icon is available as `emacs22.png' in the same location.
+\f
+* Changes in Emacs 23.1
+
+** Improved X Window System support
+
+*** Emacs now supports using both X displays and ttys in one session.
+With an Emacs server active (M-x server-start), `emacsclient -t'
+creates a tty frame connected to the running emacs server.  You can
+use any number of different ttys.  `emacsclient -c' creates a new X11
+frame on the current $DISPLAY (or a tty frame if $DISPLAY is not set).
+There may be problems if a display exits unexpectedly and Emacs is compiled
+with Gtk+, see etc/PROBLEMS.
+
+You can test for the presence of this feature in your Lisp code by
+testing for the `multi-tty' feature.
+
+*** Emacs starts in the background, as a daemon, when given the
+--daemon command line argument.  It disconnects from the terminal and
+starts the server.  Clients can connect and create graphical or
+terminal frames using emacsclient.
+
+**** emacsclient starts emacs in daemon mode and connects to it when
+--alternate-editor="" is used (or when the evironment variable
+ALTERNATE_EDITOR is set to "") and emacsclient cannot connect to an
+emacs server.
+
+*** The new command close-display-connection closes a connection to a
+remote display.  There are some bugs for Gtk+.  See etc/PROBLEMS.
+
+*** Emacs now supports the XEmbed specification.
+You can embed Emacs in another application on X11.  The new command line
+option --parent-id is used to pass the parent window id to Emacs.  See
+http://standards.freedesktop.org/xembed-spec/xembed-spec-latest.html
+for details about XEmbed.
+
+*** Emacs can now set the frame opacity.
+The opacity of a frame can be controlled by setting the `alpha' frame
+parameter.  This only takes effect on a compositing window manager for
+the X Window System, such as Compiz, Beryl and Compiz Fusion, on Mac
+OS X, or on Windows 2000 and later versions of Windows.
+
+The alpha parameter should be an integer between 0 (transparent) and
+100 (opaque), or a float number between 0.0 and 1.0.  It can also be a
+cons cell (ACTIVE . INACTIVE), where ACTIVE is the opacity of an
+active frame and INACTIVE is the opacity of non-active frames.
+
+The variable `frame-alpha-lower-limit' defines a lower bound for the
+opacity; the default is 20.
+
+** Internationalization changes
+
+*** The Emacs character set is now a superset of Unicode.
+(It has about four times the code space, which should be plenty).
+
+The internal encoding used for buffers and strings is now
+Unicode-based and called `utf-8-emacs' (`emacs-internal' is an alias
+for this).  This encoding is backward-compatible with Unicode's UTF-8
+encoding.  The internal encoding previously used by Emacs,
+`emacs-mule', is still available for reading and writing files.
+
+During byte-compilation, Emacs 23 uses `utf-8-emacs' to write files.
+As a result, byte-compiled files containing non-ASCII characters can't
+be read by earlier versions of Emacs.  Files compiled by Emacs 20, 21,
+or 22 are loaded correctly as `emacs-mule' (whether or not they
+contain multibyte characters).  This takes somewhat more time, so it
+may be worth recompiling existing .elc files which don't need to be
+shared with older Emacsen.
+
+*** There are new coding systems/aliases; see M-x list-coding-systems.
+
+*** There is a new charset implementation with many new charsets.
+See M-x list-character-sets.  New charsets can be defined conveniently
+as tables of unicodes.
+
+*** There are new language environments for Chinese-GBK,
+Chinese-GB18030, Khmer, Bengali, Punjabi, Gujarati, Oriya, Telugu,
+Sinhala, and TaiViet.
+
+*** The minor modes unify-8859-on-encoding-mode and
+unify-8859-on-decoding-mode are obsolete.
+
+*** `ucs-insert' is bound to `C-x 8 RET' and in addition to hex numbers
+accepts numbers in hash notation (e.g. #o21430 for octal, or #10r8984 for
+decimal).  It also accepts Unicode character names with completion.
+
+*** The `cyrillic-translit' input method supports many new characters.
+Common typographical characters available from Unicode were added to
+`cyrillic-translit': punctuation marks, accented characters, fractions,
+and others.
+
+** Emacs now supports serial port access on GNU/Linux, Unix, and
+Windows.  The new command `serial-term' starts an interactive terminal
+on a serial port.  The serial port can be configured at runtime with
+the mode-line mouse menu.
+
+** Menu Bar changes
+
+*** In the Options menu, the "Set Default Font" item applies the
+selected font to the `default' face on all frames, not just the
+current frame.  Furthermore, if Emacs is compiled with both GTK and
+Fontconfig support, the "Set Default Font" item uses the GTK font
+selection dialog instead of an Emacs pop-up menu.
+
+*** The font setting chosen by "Set Default Font" is saved if the
+"Save Options" item is used.
+
+*** The Tools menu contains a new Encryption/Decryption submenu.
+This contains commands provided by EasyPG, the newly-included
+interface to GnuPG (see New Modes and Packages).
+
+*** In the Options menu, the "Truncate Long Lines in the Buffer" entry
+has been replaced with a submenu offering three different ways to
+handle long lines: truncation, continuation at the window edge, and
+the new word wrapping behavior (see Editing Changes, below).
+
+*** Improvements to menus for major and minor modes
+More major and minor modes now have a mode specific menu, and existing
+mode menus have been improved to include more functionality.
+
+** Mode-line changes
+
+*** The mode-line displays a `@', instead of `-', if the
+default-directory for the current buffer is on a remote machine.
+
+*** The mode-line displays a mode menu when mouse-1 is clicked on a
+minor mode, in the same way as it already did for major modes.
+
+*** The `mode-line-emphasis' face is used to highlight certain
+mode-line information (e.g. waiting for a VC command to finish).
+
+*** The mode-line tooltips have been improved to provide more details.
+
+*** The VC, line/colum number and minor mode indicators on the mode
+line are now interactive: mouse-1 can be used on them to pop up a menu.
+
+** File deletion can make use of the Recycle Bin or system Trash folder.
+Set `delete-by-moving-to-trash' non-nil to use this.  Deleted files
+and directories will then be sent to the Recycle Bin on Windows, and
+to `trash-directory' on other systems.
+
+** Directory-local variables can now be defined.
+By default, Emacs looks in .dir-locals.el for directory-local
+variables.  For more information, see `dir-locals-set-directory-class'
+and `dir-locals-set-class-variables'.
+
+** Emacs can now use `auth-source' for authentication.
+`smtpmail' and `url' (Tramp and Gnus also) use `auth-source' to obtain
+login names and passwords.  The match, if found, is reported
+in *Messages* with the password blanked out.
+
+** `where-is-preferred-modifier' can specify your favorite modifier.
+
+\f
+* Startup Changes in Emacs 23.1
+
+** The option `inhibit-startup-screen' (with aliases to old names
+`inhibit-splash-screen' and `inhibit-startup-message') doesn't inhibit
+display of the initial message in the *scratch* buffer.  If you don't
+want to display the initial message in the *scratch* buffer at startup,
+you can set the option `initial-scratch-message' to nil.
+
+** New user option `initial-buffer-choice' specifies what to display
+after starting Emacs: startup screen, *scratch* buffer, visiting a
+file or directory.
+
+** New alias `argv' for `command-line-args-left'
+This is a convenience alias, so that one can write `(pop argv)'
+inside of --eval command line arguments in order to access
+following arguments.
+
+** The abbrev file is no longer read at startup in batch mode.
+
+** Emacs now supports invocation by an X session manager.
+It can save a session and restore it later.  See the documentation of
+the functions `emacs-session-save' and `emacs-session-restore'.
+(Actually, this feature was introduced with Emacs 22, but it was not
+documented.)
+\f
+* Incompatible Editing Changes in Emacs 23.1
+
+** In Dired, `dired-flag-garbage-files' is rebound from `&' to `%&'
+on the regexp command prefix map.
+
+** In Dired-x, all command guesses for ! are now added to the default
+list accessible by M-n instead of pushing all guesses temporarily into
+the history list.
+
+** In Isearch mode, a special case of typing `C-w' at the beginning of
+the minibuffer that toggles word search (i.e. using key sequences
+`C-s RET C-w' or `C-s M-e C-w') is obsolete.  You can use the global key
+`M-s w' to start word search, or type `M-s w' in Isearch mode to
+toggle word search.  To start nonincremental word search you can now use
+`M-s w RET' and `M-s w C-r RET' instead of `C-s RET C-w' and `C-r RET C-w'.
+
+** In Info, `Info-search' is unbound from `M-s' to allow using `M-s w'
+for word search as well as other search commands from the global prefix
+key `M-s'.  `Info-search' is still bound to `s', and also incremental
+search commands `C-s', `C-M-s', `C-r', `C-M-r' are available for searching
+through multiple Info nodes, together with their nonincremental versions
+`C-s RET', `C-r RET', `C-M-s RET', `C-M-r RET', `M-s w RET'.
+
+** In Text mode, `center-line' and `center-paragraph' are rebound from
+`M-s' and `M-S' to global keys `M-o M-s' and `M-o M-S' on the global
+prefix map `M-o', which is intended for such formatting commands.
+
+** The following input methods were removed in Emacs 22.2, but this was
+not advertised: danish-alt-postfix, esperanto-alt-postfix,
+finnish-alt-postfix, german-alt-postfix, icelandic-alt-postfix,
+norwegian-alt-postfix, scandinavian-alt-postfix, spanish-alt-postfix,
+and swedish-alt-postfix.  Use the versions without "alt-", which are
+identical.
+
+\f
+* Editing Changes in Emacs 23.1
+
+** The C-n and C-p line-motion commands now move by screen lines,
+taking continued lines and variable-width characters into account.
+Setting `line-move-visual' to nil reverts this to the previous
+behavior (i.e., motion by logical lines based on buffer contents
+alone).
+
+** C-x C-c now invokes `save-buffers-kill-terminal', and C-z now
+invokes `suspend-frame'.  These changes are for compatibility with the
+new multi-tty support (see `Improved X Window System support' above).
+
+** Mark changes
+
+*** Transient Mark mode is now on by default.
+
+*** mark-even-if-inactive now defaults to t
+
+*** When Transient Mark mode is on, C-SPC C-SPC pushes a mark without
+activating it.
+
+*** When Transient Mark mode is on, M-q now fills the region if the
+region is active.  Otherwise, it fills the current paragraph.
+
+*** When Transient Mark mode is on, M-$ now checks spelling of the
+region if the region is active.  Otherwise, it checks spelling of the
+word at point.
+
+*** When Transient Mark mode is on, TAB now indents the region if the
+region is active.
+
+*** The variable `use-empty-active-region' controls whether an empty
+active region in Transient Mark mode should make commands operate on
+that empty region.
+
+** Temporarily active regions
+
+*** The new variable shift-select-mode, non-nil by default, controls
+shift-selection.  When Shift Select mode is on, shift-translated
+motion keys (e.g. S-left and S-down) activate and extend a temporary
+region, similar to mouse-selection.
+
+*** Temporarily active regions, created using shift-selection or
+mouse-selection, are not necessarily deactivated in the next command.
+They are only deactivated after point motion commands that are not
+shift-translated, or after commands that would ordinarily deactivate
+the mark in Transient Mark mode (e.g., any command that modifies the
+buffer).
+
+** Minibuffer and completion changes
+
+*** Emacs may ask for confirmation before opening a non-existent file
+or buffer.  By default, Emacs requests confirmation if you type RET
+immediately after TAB, and the resulting input is not an existing file
+or buffer; this usually happens when the minibuffer input did not
+complete far enough and you entered RET by mistake.  In that case,
+Emacs puts the message "[Confirm]" in the minibuffer; type RET again
+to create the file or buffer.
+
+The new variable confirm-nonexistent-file-or-buffer determines whether
+Emacs asks for confirmation.  The default value is `after-completion'.
+If you change it to t, Emacs always asks for confirmation; if you
+change it to nil, Emacs never asks for confirmation.
+
+*** The rules for performing completion have been changed.
+When generating completion alternatives, Emacs now takes the
+minibuffer text after point, if any, into account: this text is
+treated as a substring of the remaining part of the completion
+alternative (i.e., the part not matched by the minibuffer text before
+point).  If no completion alternatives are found this way, Emacs
+attempts to perform partial-completion.  If still no completion
+alternatives are found, we fall back on the Emacs 22 rules for
+performing completion.
+
+The new variable `completion-styles' can be customized to choose your
+favorite completion style.
+
+*** When M-n in the minibuffer reaches the end of the list of defaults,
+it adds the completion list to the end, so next M-n continues putting
+completion items to the minibuffer.  The same principle applies to
+incremental search commands as well: C-s or C-M-s starts searching
+the default values and after the end of defaults they continue
+searching minibuffer completion items.
+
+*** Minibuffer input of shell commands now comes with completion.
+
+*** In the `C-x d' (Dired) prompt, typing M-n gives the visited file
+name of the current buffer.
+
+*** In the M-! (shell-command) prompt, M-n provides some default commands.
+These are guessed using the file extension of the current file, based
+on the file-handlers specified in the operating system's `mailcap'
+file.  The ! command in Dired (dired-do-shell-command) works
+similarly, using the file displayed on the current line.
+
+*** A list of regexp default values is available via M-n for `occur',
+`keep-lines', `flush-lines' and `how-many'.  This list includes the active
+region in transient-mark-mode, the word under the cursor, the last Isearch
+regexp, the last Isearch string and the last replacement regexp.
+
+*** When enable-recursive-minibuffers is non-nil, operations which use
+switch-to-buffer (such as C-x b and C-x C-f) do not fail any more when
+used in a minibuffer or a dedicated window.  Instead, they fallback on
+using pop-to-buffer, which will use some other window.  This change
+has no effect when enable-recursive-minibuffers is nil (the default).
+
+*** Isearch started in the minibuffer searches in the minibuffer history.
+Reverse Isearch commands (C-r, C-M-r) search in previous minibuffer
+history elements, and forward Isearch commands (C-s, C-M-s) search in
+next history elements.  When the reverse search reaches the first history
+element, it wraps to the last history element, and the forward search
+wraps to the first history element.  When the search is terminated, the
+history element containing the search string becomes the current.
+
+*** The variable read-file-name-completion-ignore-case overrides
+completion-ignore-case for file name completion.
+
+*** The variable read-buffer-completion-ignore-case overrides
+completion-ignore-case for buffer name completion.
+
+*** The new command `minibuffer-force-complete' chooses one of the
+possible completions, rather than stopping at the common prefix.
+
+*** If `completion-auto-help' is `lazy', Emacs shows the completions
+buffer only on the second attempt to complete.  This was already
+supported in `partial-completion-mode'.
+
+** Face changes
+
+*** S-down-mouse-1 now pops up a menu for changing the font and text
+size of the default face in the current buffer.  The face is changed
+via face remapping (see Lisp changes, below).
+
+*** New commands to change the default face size in the current buffer.
+To increase it, type `C-x C-+' or `C-x C-='.  To decrease it, type
+`C-x C--'.  To restore the default (global) face size, type `C-x C-0'.
+These work via Text Scale mode, a new minor mode.
+
+The final key in the above commands may be repeated without the
+leading `C-x', e.g. `C-x C-= C-= C-=' increases the face height by
+three steps.  Each step scales the height of the default face by the
+value of the variable `text-scale-mode-step'.
+
+*** The commands buffer-face-mode and buffer-face-set can be used to
+remap the default face in the current buffer.  See "Buffer Face mode",
+under New Modes and Packages.
+
+** Primary selection changes
+
+*** You can disable kill ring commands from accessing the primary
+selection by setting `x-select-enable-primary' to nil.
+
+** Continuation lines can now be wrapped at word boundaries
+(word-wrapping).  This is controlled by the new per-buffer variable
+`word-wrap'.  Word wrapping does not take place if continuation lines
+are not shown, e.g. if truncate-lines is non-nil.  The most convenient
+way to enable word-wrapping is using the new minor mode Visual Line
+mode; in addition to setting `word-wrap' to t, this rebinds some
+editing commands to work on screen lines rather than text lines.  See
+New Modes and Packages, below.
+
+** Window management changes
+
+*** truncate-partial-width-windows now accepts integer values, which
+specify a minimum window width for partial-width windows, below which
+lines are truncated.  The default has been changed to 50.
+
+*** The new command balance-windows-area balances windows both
+vertically and horizontally.
+
+*** pop-to-buffer now always sets input focus when the popped-to window
+is on a different frame.
+
+** Miscellaneous changes:
+
+*** C-l is bound to the new command recenter-top-bottom, rather than recenter.
+This moves the current line to window center, top and bottom on
+successive invocations.
+
+*** scroll-preserve-screen-position also preserves the column position.
+
+*** If `yank-pop-change-selection' is t, rotating the kill ring also
+updates the selection or clipboard to the current yank, just as M-w
+would do so with the text it copies to the kill ring.
+
+*** C-M-% now shows replacement as it would look in the buffer, with
+`\N' and `\&' substituted according to the match.  Old behavior can be
+restored by customizing `query-replace-show-replacement'.
+
+*** The command shell prompts for the default directory, when it is
+called with a prefix and the default directory is a remote file name.
+This is because some file name handlers (like ange-ftp) are not able to
+run processes remotely.
+
+*** The new command kill-matching-buffers kills buffers whose name
+matches a regexp.
+
+*** The value of comment-style now defaults to `indent'.
+Thefore, comment-start markers are inserted at the current indentation
+of the region to comment, rather than the leftmost column.
+
+*** The new commands `pp-macroexpand-expression' and
+`pp-macroexpand-last-sexp' pretty-print macro expansions.
+
+*** The new command `set-file-modes' allows to set file's mode bits.
+The mode bits can be specified in symbolic notation, like with GNU
+Coreutils, in addition to an octal number.  `chmod' is a new
+convenience alias for this function.
+
+*** `next-error-recenter' specifies how next-error should recenter the
+visited source file.  Its value can be a number (for example, 0 for
+top line, -1 for bottom line), or nil for no recentering.
+
+*** When typing in a password in the echo area, C-y yanks the current
+kill into the password.
+
+*** Tooltip frame parameters `font' and `color' in `tooltip-frame-parameters'
+are ignored.  Customize the `tooltip' face instead.
+
+*** `mkdir' is a new convenience alias for `make-directory'.
+\f
+* New Modes and Packages in Emacs 23.1
+
+** Auto Composition Mode is a minor mode that composes characters
+automatically when they are displayed.  It is globally on by default.
+It uses `auto-composition-function' (default `auto-compose-chars').
+
+** Bubbles, a new game, is similar to SameGame.
+
+** Buffer Face mode is a minor mode for remapping the default face in
+the current buffer.  The variable `buffer-face-mode-face' specifies
+the face to remap to.  The command `buffer-face-set' prompts for a
+face name, sets `buffer-face-mode-face' to it, and enables
+buffer-face-mode.  See "Face changes", under Editing Changes, for a
+description of face remapping.
+
+** butterfly flips the desired bit on the drive platter.
+See http://xkcd.com/378/
+
+** bug-reference.el provides clickable links to bug reports.
+
+** dbus.el provides D-Bus language bindings.
+D-Bus is an inter-process communication mechanism for applications
+residing on the same host.  See the manual for details.
+
+** DocView mode allows viewing of PDF, PostScript and DVI documents.
+One can also search for a regular expression in the document.  For
+details, see the commentary in doc-view.el.
+
+PDF and DVI files are now opened in Doc View mode by default.
+
+In Postcript mode, C-c C-c launches Doc View minor mode for viewing
+the postscript file.
+
+** EasyPG provides an interface to the GNU Privacy Guard (GnuPG).
+It includes a GnuPG keyring browser, cryptographic operations on
+regions and files, and automatic encryption of *.gpg files.  For
+details, see the EasyPG Assistant User's Manual.
+
+** json.el is a library for parsing and generating JSON
+(JavaScript Object Notation), a lightweight data-interchange format.
+
+** linum.el is a new minor mode to display line numbers for the
+current buffer.
+
+** mairix.el is an interface to mairix, a free tool for indexing and
+searching locally stored mail.  It allows you to query mairix and
+display the search results with Rmail, Gnus and VM.  Note that there
+is an existing Gnus back end, nnmairix.el, which should be used with
+Maildir/MH setups.
+
+** minibuffer-depth-indicate-mode shows the minibuffer depth in the prompt.
+
+** nXML Mode
+This is a new mode for editing XML documents.  It allows a schema to
+be associated with the XML document being edited, using Relax NG as
+the schema language.  The schema is used to provide two key features:
+
+*** Continuous validation.  nXML validates as you type, highlighting
+any invalid parts of your document.
+
+*** Completion.  nXML can assist you in entering an element name,
+attribute name or data value by using information about what is
+allowed by the schema in that context.
+
+** proced.el provides a Dired-like interface for operating on
+processes.  Proced makes an Emacs buffer containing a listing of the
+current processes.  You can use the normal Emacs commands to move
+around in this buffer, and special Proced commands to operate on the
+processes listed.  It is currently only functional on GNU/Linux,
+MS-Windows and Solaris.
+
+** Remember Mode is a mode for jotting down things to remember.
+Notes can be saved to a Diary file.  For details, see the Remember
+Manual.
+
+** RST mode is a major mode for editing reStructuredText files.
+
+** Ruby mode is a major mode for Ruby files.
+
+** Visual Line mode provides support for editing by visual lines.
+It turns on word-wrapping in the current buffer, and rebinds C-a, C-e,
+and C-k to commands that operate by visual lines instead of logical
+lines.  This is a more reliable replacement for longlines-mode.
+This can also be turned on using the menu bar, via
+Options -> Line Wrapping in this Buffer -> Word Wrap
+
+** xesam.el is an implementation of Xesam, an interface to (desktop)
+search engines like Beagle, Strigi, and Tracker.  The Xesam API
+requires D-Bus for communication.
+
+** zeroconf.el offers service discovery and service publishing
+interfaces according to the zeroconf specification.  It communicates
+with Avahi, a zeroconf implementation, via D-Bus messages on systems
+which have installed this software.
+
+** There is a new `whitespace' package.
+(The pre-existing one has been renamed to `old-whitespace'.)
+Now, besides reporting bogus blanks, the whitespace package has a
+minor mode and a global minor mode to visualize blanks (TAB, (HARD)
+SPACE and NEWLINE).  The visualization is made via faces and/or display
+table.  It can also indicate lines that extend beyond a given column,
+trailing blanks, and empty lines at the start or end of a buffer.
+See `whitespace-style' for more details.  The `whitespace-action' option
+specifies what to do when a buffer is visited, killed, or written.
+
+\f
+* Changes in Specialized Modes and Packages in Emacs 23.1
+
+** Abbrev has been rewritten in Elisp and extended with more flexibility.
+
+*** New functions: abbrev-get, abbrev-put, abbrev-table-get, abbrev-table-put,
+abbrev-table-p, abbrev-insert, abbrev-table-menu.
+
+*** Special hook `abbrev-expand-functions' obsoletes `pre-abbrev-expand-hook'.
+
+*** `make-abbrev-table', `define-abbrev', `define-abbrev-table' all take
+extra arguments for arbitrary properties.
+
+*** New variable `abbrev-minor-mode-table-alist'.
+
+*** `local-abbrev-table' can hold a list of abbrev-tables.
+
+*** Abbrevs have now the following special properties:
+`:count', `:system', `:enable-function', `:case-fixed'.
+
+*** Abbrev-tables have now the following special properties:
+`:parents', `:case-fixed', `:enable-function', `:regexp',
+`abbrev-table-modiff'.
+
+** Apropos
+
+*** `apropos-library' describes the elements defined in a given library.
+
+*** Set `apropos-compact-layout' is you want a more compact (but wider) layout.
+
+** Archive Mode has basic support to browse Rar archives.
+Note, however, that the free version of the unrar command only handles
+versions 1 and 2 of the Rar format.
+
+** BibTeX mode
+
+*** New command `bibtex-initialize' (re)initializes BibTeX buffers.
+
+*** New `bibtex-entry-format' options `whitespace', `braces', and
+`string', disabled by default.
+
+*** New variable `bibtex-cite-matcher-alist' contains rules to
+identify cited keys in BibTeX entries, used by `bibtex-find-crossref'.
+
+*** Command `bibtex-url' allows multiple URLs per entry.
+
+** Bookmarks
+
+*** bookmark.el saves bookmarks in a pre-Emacs-23-incompatible file format
+bookmark.el can read a .emacs.bmk file saved by an older Emacs, but an
+older Emacs cannot read one saved by Emacs 23.
+
+** Calendar and diary
+
+*** There is a new date style, `iso', essentially year/month/day.
+The variable `european-calendar-style' is obsolete - use `calendar-date-style'.
+Similarly, the commands `american-calendar' and `european-calendar'
+should be replaced by `calendar-set-date-style'.
+
+*** The calendar namespace has been rationalized.
+All functions and variables now begin with a `calendar-', `diary-', or
+`holiday-' prefix.  The various calendar systems have secondary
+prefixes, eg `calendar-french-'.  The old names you are likely to use
+directly still exist, for the time being, as aliases, but please start
+using the new names.
+
+*** The whitespace in the calendar layout can be customized.
+See the variables:
+calendar-left-margin, calendar-intermonth-spacing, calendar-column-width,
+calendar-day-header-width, and calendar-day-digit-width.
+
+*** Text (e.g. ISO weeks) can be displayed between the calendar months.
+See the variables calendar-intermonth-header and calendar-intermonth-text.
+
+*** The function `holiday-chinese' computes holidays on the Chinese calendar.
+It has been used to add items to the list `holiday-oriental-holidays'.
+
+*** `diary-remind' accepts a negative number -DAYS as a shorthand for
+the list (1 2 ... DAYS).
+
+** Change Log mode
+
+*** The new command C-c C-f (change-log-find-file) finds the file
+associated with the current log entry.
+
+*** The new command C-c C-c (change-log-goto-source) goes to the
+source code associated with a log entry.
+
+** Compile and grep modes
+
+*** The mode-line entry for the *compilation* and *grep* buffer is color coded.
+It has different colors for to show that: (a) the command is still
+running, (b) successful completion, (c) error.
+
+*** compilation-auto-jump-to-first-error tells `compile' to jump to
+the first error encountered during compilations.
+
+*** compilation-scroll-output accepts a new value, `first-error', which
+says to stop auto scrolling at the first error that occurs.
+
+*** The `cc' alias for C++ files in `grep-file-aliases' has been
+improved.  `hh' can be used to match C++ header files and `cchh' both
+C++ sources and headers.
+
+** Copyright
+
+*** You can specify your copyright holders' names.
+Only copyright lines with holders matching `copyright-names-regexp' are
+considered for update.
+
+*** Copyrights can be at the end of the buffer.
+This is controlled by `copyright-at-end-flag' (used by, e.g., change-log-mode).
+
+** Custom
+
+*** defcustom accepts new keyword arguments, `:safe' and `:risky', which
+set a variable's `safe-local-variable' and `risky-local-variable' property.
+
+** Diff mode
+
+*** diff-refine-hunk highlights word-level details of changes in a diff hunk.
+It's used automatically as you move through hunks, see
+diff-auto-refine-mode.  It is bound to `C-c C-b'.
+
+*** diff-add-change-log-entries-other-window iterates through the diff
+buffer and tries to create ChangeLog entries for each change.
+It is bound to `C-x 4 A'.
+
+*** Turning on `whitespace-mode' in a diff buffer will show trailing
+whitespace problems in the modified lines.
+
+** Dired
+
+*** In Dired, C-x C-q now runs the command wdired-change-to-wdired-mode,
+and C-x C-q in wdired-mode exits it with asking a question about
+saving changes.
+
+*** `&' runs the command `dired-do-async-shell-command' that executes
+the command asynchronously without the need to manually add ampersand
+to the end of the command.  Its output appears in the buffer `*Async Shell
+Command*'.
+
+*** `M-s f C-s' and `M-s f M-C-s' run Isearch that matches only at file names.
+When a new user option `dired-isearch-filenames' is t, then even ordinary
+Isearch started with `C-s' and `C-M-s' matches only at file names in the
+Dired buffer.  When `dired-isearch-filenames' is `dwim' then activation of
+file name Isearch depends on the position of point - if point is on a file
+name initially, then Isearch matches only file names, otherwise it matches
+everywhere in the Dired buffer.  You can toggle file names matching on or
+off by typing `M-s f' in Isearch mode.
+
+*** `M-s a C-s' and `M-s a M-C-s' run multi-file Isearch on the marked files.
+They visit the first marked file in the sequence and display the usual Isearch
+prompt for a string or a regexp where all Isearch commands are available.
+
+*** `Q' in Dired provides two new keys for multi-file replacement.
+The upper case key `Y' replaces all remaining matches in all remaining files
+with no more questions.  The upper case key `N' stops doing replacements
+in the current file and skips to the next file.  These multi-file keys
+are available for all commands that use `tags-query-replace'
+including `dired-do-query-replace-regexp', `vc-dir-query-replace-regexp',
+`reftex-query-replace-document'.
+
+** Fortran
+
+*** The line length of fixed-form Fortran is not fixed at 72 any more.
+Customize the variable `fortran-line-length' to change it.
+
+*** In Fortran mode, M-; is now bound to the standard comment-dwim,
+rather than fortran-indent-comment.
+
+*** (The increasingly misnamed) F90 mode supports Fortran 2003 syntax.
+
+** Gnus
+
+*** The Gnus package has been updated
+There are many new features, bug fixes and improvements; see the file
+GNUS-NEWS or the node "No Gnus" in the Gnus manual for details.
+
+*** In Emacs 23, Gnus uses Emacs' new internal coding system `utf-8-emacs' for
+saving articles, drafts, and ~/.newsrc.eld.  These file may not be read
+correctly in Emacs 22 and below.  If you want to Gnus across different Emacs
+versions, you may set `mm-auto-save-coding-system' to `emacs-mule'.
+
+*** Passwords are consistently loaded through `auth-source'
+Gnus can use `auth-source' for POP and IMAP passwords.  Also see that
+`smtpmail' and `url' support `auth-source' for SMTP and HTTP/HTTPS/RSS
+authentication respectively.
+
+** Help mode
+
+*** New macro `with-help-window' should set up help windows better
+than `with-output-to-temp-buffer' with `print-help-return-message'.
+
+*** New option `help-window-select' permits to customize whether help
+window shall be automatically selected when invoking help.
+
+*** New variable `help-window-point-marker' permits one to specify a new
+position for point in help window (for example in `view-lossage').
+
+** Isearch
+
+*** New command `isearch-forward-word' bound globally to `M-s w' starts
+incremental word search.  New command `isearch-toggle-word' bound to the
+same key `M-s w' in Isearch mode toggles word searching on or off
+while Isearch is active.
+
+*** New command `isearch-highlight-regexp' bound to `M-s h r' in Isearch
+mode runs `highlight-regexp' (`hi-lock-face-buffer') with the current
+search string as its regexp argument.  The same key `M-s h r' and
+other keys on the `M-s h' prefix are bound globally to the command
+`highlight-regexp' and other hi-lock commands.
+
+*** New command `isearch-occur' bound to `M-s o' in Isearch mode
+runs `occur' with the current search string.  The same key `M-s o'
+is bound globally to the command `occur'.
+
+*** Isearch can now search through multiple ChangeLog files.
+When running Isearch in a ChangeLog file, if the search fails,
+then another C-s tries searching the previous ChangeLog,
+if there is one (e.g. going from ChangeLog to ChangeLog.12).
+This is enabled if multi-isearch-search is non-nil.
+
+*** Two new commands to start Isearch on a list of marked buffers
+for buff-menu.el and ibuffer.el are bound to the keys `M-s a C-s' and
+`M-s a M-C-s'.
+
+*** The part of an Isearch that failed to match is highlighted in
+`isearch-fail' face.
+
+*** `C-h C-h' in Isearch mode displays isearch-specific Help screen,
+`C-h b' displays all Isearch key bindings, `C-h k' displays the full
+documentation of the given Isearch key sequence, `C-h m' displays
+documentation for Isearch mode.  All the other Help commands exit
+Isearch mode and execute their global definitions.
+
+*** When started in the minibuffer, Isearch searches in the minibuffer
+history.  See `Minibuffer changes', above.
+
+** MH-E
+
+*** Upgraded to MH-E version 8.2.  See MH-E-NEWS for details.
+
+** Python
+*** The file etc/emacs.py now supports both Python 2 and 3, meaning
+that either version can be used as inferior Python by python.el.
+
+*** Python mode now has `pdbtrack' functionality.  When using pdb to
+debug a Python program, pdbtrack notices the pdb prompt and displays
+the source file and line that the program is stopped at, much the same
+way as gud-mode does for debugging C programs with gdb.
+
+** Recentf
+
+*** The default value of `recentf-keep' prevents from checking of
+remote files, if there is no established connection to the
+corresponding remote host.
+
+** Rmail
+
+*** Rmail no longer converts the messages to Babyl format.
+Instead, it uses UNIX mbox format, both on disk and in Rmail buffers,
+and does conversion and decoding when a message is displayed.
+
+The first time you visit an Rmail file in Babyl format, Rmail
+automatically converts it to mbox format.  This is a one-time
+conversion, but it can take a few minutes, depending on how fast is
+your machine and on the size of the file.  You should find the rest of
+Rmail usage unaltered.
+
+However, M-x set-rmail-inbox-list now lasts only for one session
+because there is no way to save the list of inbox files in an
+mbox-format file.
+
+Also, whereas with Babyl format M-x find-file would switch to Rmail
+mode, with mbox format this is no longer the case (there being no way
+to add an "-*- rmail-*-" cookie to an mbox file).  Use C-u M-x rmail
+instead.
+
+If you have written any extensions to Rmail, they are likely to need
+updating.  Conceptually, the Rmail buffer that you see is no longer
+just a narrowed portion of the whole.  So you cannot access the whole
+of a message (or message collection) by a simple save-restriction and
+widen.  Instead, there are two buffers: the rmail-buffer, and the
+rmail-view-buffer.  The former is the buffer that you see, the latter
+is invisible.  Most of the time, the invisible `view' buffer contains
+the full contents of the Rmail file, and the Rmail buffer contains a
+decoded copy of the current message (with only a subset of the
+headers).  In this state, Rmail is said to be `swapped'.
+
+You may find the following functions useful:
+
+`rmail-get-header' and `rmail-set-header' get or set the value of a
+message header, whether or not it is currently visible.
+
+`rmail-apply-in-message' is a general purpose function that calls a
+function (with arguments) which you specify on the full text of a given
+message.  To further narrow to just the headers, search forward for "\n\n".
+
+*** The new command `rmail-mime' displays MIME messages.
+It is bound to `v' in Rmail buffers and summaries.  It displays plain
+text and multipart messages in a temporary buffer, and offers buttons
+to save attachments.
+
+*** The command `rmail-redecode-body' no longer accepts the optional arg RAW.
+Since Rmail now holds messages in their original undecoded form in a
+separate buffer, `rmail-redecode-body' no longer encodes the original
+message, and therefore there should be no need to avoid encoding it.
+
+*** The o command is now `rmail-output'.  It is an all-purpose command
+for copying messages from Rmail and appending them to files.  It
+handles Babyl-format files as well as mbox-format files, and it
+handles both kinds properly when they are visited in Emacs.  It always
+copies the full headers of the message.
+
+*** The C-o command is now `rmail-output-as-seen'.  It uses
+the message as displayed, appending it to an mbox file.
+
+*** The modified status of the Rmail buffer is reported in the mode-line.
+Previously, this information was hidden.
+
+** TeX modes
+
+*** New option latex-indent-within-escaped-parens
+permits to customize indentation of LaTeX environments delimited
+by escaped parens.
+
+** T-mouse Mode
+
+*** If the gpm mouse server is running and t-mouse-mode is enabled,
+Emacs uses a Unix socket in a GNU/Linux console to talk to server,
+rather than faking events using the client program mev.  This C level
+approach provides mouse highlighting and help echoing in the
+minibuffer.
+
+** Tramp
+
+*** New connection methods.
+The new methods "plinkx", "plink2", "psftp", "sftp" and "fish" have
+been introduced.  There are also new so-called gateway methods
+"tunnel" and "socks".
+
+*** IPv6 addresses.
+IPv6 addresses are supported now as host names.  They must be embedded
+in square brackets, like in "/ssh:[::1]:".
+
+*** Multihop syntax has been removed.
+The pseudo-method "multi" has been removed.  Instead, multi hops
+can be specified by the new variable `tramp-default-proxies-alist'.
+
+*** More default settings.
+Default values can be set via the variables `tramp-default-user',
+`tramp-default-user-alist' and `tramp-default-host'.
+
+*** Connection information is cached.
+In order to reduce connection setup, information about used
+connections is kept persistently in a file.  The name of this file is
+defined in the variable `tramp-persistency-file-name'.
+
+*** Control of remote processes.
+Running processes on a remote host can be controlled by settings in
+`tramp-remote-path' and `tramp-remote-process-environment'.
+
+*** Success of remote copy is checked.
+When the variable `file-precious-flag' is set, the success of a remote
+file copy is checked via the file's checksum.
+
+*** Passwords can be read from an authentification file.
+Tramp uses the package `auth-source' to read passwords from a file, if
+necessary.
+
+** VC and related modes
+
+*** VC now supports applying VC operations to a set of files at a time.
+This enables VC to work much more effectively with changeset-oriented
+version-control systems such as Subversion, GNU Arch, Mercurial, Git
+and Bzr.  VC will now pass a multiple-file commit to these systems as
+a single changeset.
+
+*** vc-dir is a new command that displays file names and their VC
+status.  It allows to apply various VC operations to a file, a
+directory or a set of files/directories.
+
+*** VC switches are no longer appended, rather the first non-nil value is used.
+(This was for the most part true in Emacs 22, but was not advertised).
+This is because there is an increasing variety of VC systems, and they
+do not all accept the same "common" options.  For example, a CVS diff
+command used to append the values of `vc-cvs-diff-switches',
+`vc-diff-switches', and `diff-switches'.  Now the first non-nil value
+from that sequence is used.  The special value `t' means "no switches".
+
+*** Clicking on the VC mode-line entry now pops the VC menu.
+
+*** The VC mode-line entry now has a tooltip that explains the VC file status.
+
+*** In VC Annotate mode, the key bindings have changed to use lower
+case keys instead of the upper case keys used in the past.
+
+*** In VC Annotate mode, for VC systems that support changesets, you can
+see the diff for the whole changeset (not only for the current file)
+by typing the D key.  Using the "Show changeset diff of revision at
+line" menu entry does the same thing.
+
+*** In VC Annotate mode, you can type v to toggle the annotation visibility.
+
+*** In VC Annotate mode, you can type f to show the file revision on
+the current line.
+
+*** Asynchronous VC commands display [Waiting...] in the mode-line
+of the corresponding buffer as long as the asynchronous process is
+active.
+
+*** Log entries can be modified using the key "e" in log-view.
+For now only CVS, RCS, SCCS and SVN support this functionality.
+This is done by the `modify-change-comment' backend function.
+
+*** In log-view-mode, for VC systems that support changesets, you can
+see the diff for the whole changeset (not only for the current file)
+by typing the D key or using the "Changeset Diff" menu entry.
+
+*** In Log Edit mode,  C-c C-d now shows the diff for the files involved.
+
+*** vc-git supports the "git grep" command.
+
+*** VC Support for Meta-CVS has been removed for lack of a maintainer able
+to update it to the new VC.
+
+** Miscellaneous
+
+*** comint-mode uses `start-file-process' now (see Lisp Changes).
+If `default-directory' is a remote file name, subprocesses are started
+on the corresponding remote system.
+
+*** Eldoc highlights the function argument under point
+with the face `eldoc-highlight-function-argument'.
+
+*** In Etags, the --members option is now the default.
+Use --no-members if you want the old default behavior of not tagging
+struct members in C, members variables in C++ and variables in PHP.
+
+*** The `gdb' command only works with the graphical interface now.
+Use `gud-gdb' if you want the (old) text command mode.
+
+*** goto-address.el provides two new minor modes, goto-address-mode and
+goto-address-prog-mode, which buttonize URLS and email addresses.
+
+*** The new command `eshell/info' runs info in an eshell buffer.
+
+*** The new variable `ffap-rfc-directories' specifies a list of local
+directories in which `ffap-rfc' will first search for RFCs.
+
+*** hide-ifdef-mode allows shadowing ifdef-blocks instead of hiding them.
+See option `hide-ifdef-shadow' and function `hide-ifdef-toggle-shadowing'.
+
+*** `icomplete-prospects-height' now supercedes `icomplete-prospects-length'.
+
+*** Info displays breadcrumbs in the header of the page.
+See Info-breadcrumbs-depth to control it.
+
+*** net-utils has an `iwconfig' command, similar to the existing `ifconfig'.
+It is used to configure wireless interfaces.
+
+*** The pcmpl-unix package supports hostname completion for ssh and scp.
+
+*** sgml-electric-tag-pair-mode lets you simultaneously edit matched tag pairs.
+
+*** smerge-refine highlights word-level details of changes in conflict.
+It's used automatically as you move through conflicts, see
+smerge-auto-refine-mode.
+
+*** talk.el has been extended for multiple tty support.
+
+*** A new command `display-time-world' has been added to the Time
+package.  It creates a buffer with an updating time display using
+several time zones.
+
+*** The appearance of superscript and subscript in TeX is more customizable.
+See the documentation of the variables: tex-fontify-script,
+tex-font-script-display, tex-suscript-height-ratio, and
+tex-suscript-height-minimum.
+
+*** view-remove-frame-by-deleting is now by default t
+since users found iconification of view-mode frames distracting.
+
+*** WoMan tries to add locale-specific manual page directories to the
+search path.  This can be disabled by setting `woman-locale' to nil.
+
+\f
+* Changes in Emacs 23.1 on non-free operating systems
+
+** Case is now considered significant in completion on MS-Windows.
+The default value of `completion-ignore-case' is now nil on
+MS-Windows, the same as it is for other operating systems.  The
+variable doesn't apply to reading a file name -- in that case Emacs
+heeds `read-file-name-completion-ignore-case' instead.
+
+** IPv6 is supported on MS-Windows.
+Emacs now supports IPv6 on Windows XP and later, and earlier versions
+of Windows with third party IPv6 stacks installed.  In Emacs 22, IPv6 was
+supported on other platforms, but not on Windows due to using the winsock
+1.1 header file, even though Emacs was linking to the winsock 2 library.
+
+** Busy cursor (hourglass) now displays on MS-Windows.
+When Emacs is busy, an hourglass mouse cursor is displayed on Windows.
+In Emacs 22 only X supported the busy cursor.
+
+** Battery status is available on MS-Windows
+Emacs can now display the battery status in the mode-line when enabled with
+display-battery-mode or from the Options menu.  More verbose battery
+information is also available with the command `battery'.  In Emacs 22
+battery status was supported only on GNU/Linux and Mac.
+
+** More keys available on MS-Windows.
+Keys normally associated with IMEs, and some exotic keys not normally found
+on standard keyboards have been given names so they can be bound to functions
+inside Emacs.  If there are keys on your keyboard that have not been exposed
+to Emacs in the past, try C-h k to see if they are available now.
+
+Emacs can now bind functions to the extra buttons for media player and
+browser control present on some keyboards.  These buttons are disabled
+by default, since enabling them prevents their system-wide use when
+Emacs has focus.  To enable them, set the variable
+w32-pass-multimedia-buttons to nil.  See the doc string of that variable
+for the list of extra keys that are available.
+
+** BDF fonts no longer supported on MS-Windows.
+The font backend was completely rewritten for this release.  The focus
+on Windows has been getting acceptable performance and full unicode
+support, including complex script shaping for native Windows fonts.  A
+rewrite of the BDF font support has not happened due to lack of time
+and developers.  If demand still exists for such a backend even with
+the improved language support for native Windows fonts, future
+development in this direction will most likely be based on the
+freetype library, giving access to a wider range of font formats.
+
+\f
+* Incompatible Lisp Changes in Emacs 23.1
+
+** Variables cannot be both buffer-local and frame-local any more.
+
+** `functionp' returns nil for special forms.
+I.e., it only returns t for objects that can be passed to `funcall'.
+
+** The behavior of map-char-table has changed.  It may call the
+specified function with a cons (FROM . TO) as a key if characters in
+that range have the same value.
+
+** Process changes
+
+*** The function `dired-call-process' has been removed.
+
+*** The multibyteness of process filters is now determined by the
+coding-system used for decoding.  The functions
+`process-filter-multibyte-p' and `set-process-filter-multibyte' are
+obsolete.
+
+** The variable `byte-compile-warnings' can now be a list starting with `not',
+meaning to disable the specified warnings.  The meaning of this list
+may therefore be the reverse of what you expect (of course, this is
+only an issue if you make use of the new `not' syntax).  Rather than
+checking/manipulating elements directly, use the new functions
+`byte-compile-warning-enabled-p', `byte-compile-disable-warning', and
+`byte-compile-enable-warning.'
+
+** `mode-name' is no longer guaranteed to be a string.
+Use `(format-mode-line mode-name)' to ensure a string value.
+
+** The function x-font-family-list has been removed.
+Use the new function font-family-list (see Lisp Changes, below).
+
+** Internationalization changes
+
+*** The value of the function `charset-id' is now always 0.
+
+*** The functions `register-char-codings' and `coding-system-spec'
+have been removed.
+
+*** The cpXXX coding systems are now supported automatically.
+The functions cp-...-codepage, which you had to use in Emacs 22 to
+enable support for these coding systems, have been deleted.
+
+*** The following features have been removed.  They were used for
+displaying various scripts with specific fonts, and are no longer
+needed now that OpenType font support is available:
+
+**** `devanagari' and `devan-util', and all associated devanagari-* and
+dev-* functions and variables (formerly used for Devanagari script).
+
+**** `kannada' and `knd-util', and all associated kannada-* and knd-*
+functions and variables (formerly used for Kannada script).
+
+**** `malayalam' and `mlm-util', and all associated malayalam-* and
+mlm-* functions and variables (formerly used for Malayalam script).
+
+**** `tamil' and `tml-util, and all associated tamil-* and tml-*
+functions and variables (formerly used for Tamil script).
+
+*** The meaning of NAME argument of `set-fontset-font' is changed.
+Previously nil is accepted as the default fontset.  Now, nil is for
+the fontset of the selected frame and t is for the default fontset.
+
+*** The meaning of FONTSET argument of `print-fontset' is changed.
+Now, nil is for the fontset of the selected frame and t is for the
+default fontset.
+
+** If a function in write-region-annotate-functions returns with a
+different buffer current, Emacs no longer kills that buffer
+automatically.  This behavior existed in previous versions of Emacs,
+but was undocumented.  To kill a buffer after write-region, give the
+variable `write-region-post-annotation-function' a buffer-local value
+of `kill-buffer'.
+
+** The variable temp-file-name-pattern has been removed.
+This variable was only used by call-process-region, which now uses
+temporary-file-directory instead.
+
+** The COUNT and SYSTEM-FLAG arguments to define-abbrev have been
+removed.  The function now takes extra arguments for specifying
+arbitrary abbrev properties.
+
+** end-of-defun-function is now guaranteed to work only when called
+from the start of a defun.  It must now leave point exactly at the end
+of defun, since `end-of-defun' now itself moves forward over
+whitespace after calling it.
+
+\f
+* Lisp Changes in Emacs 23.1
+
+** The new variable `generate-autoload-cookie' controls the magic comment
+string used by `update-file-autoloads' to find autoloaded forms.  The
+variable `generated-autoload-file' similarly controls the name of the
+file where `update-file-autoloads' writes the calls to `autoload'.
+The default values are ";;;###autoload" and `loaddefs.el',
+respectively.
+
+** New primitives `list-system-processes' and `process-attributes'
+let Lisp programs access the processes that are running on the local
+machine.  See the doc strings of these functions for more details.
+Not all platforms support accessing this information; on those that
+don't, these primitives will return nil.
+
+** New variable `user-emacs-directory'.
+Use this instead of "~/.emacs.d".
+
+** If a local hook function has a non-nil `permanent-local-hook'
+property, `kill-all-local-variables' does not remove it from the local
+value of the hook variable; it remains even if you change major modes.
+
+** `frame-inherited-parameters' lets new frames inherit parameters from
+the selected frame.
+
+** New keymap `input-decode-map' overrides like key-translation-map, but
+applies before function-key-map.  Also it is terminal-local contrary to
+key-translation-map.  Terminal-specific key-sequences are generally added to
+this map rather than to function-key-map now.
+
+** `ignore-errors' is now a standard macro (does not require the CL package).
+
+** `interprogram-paste-function' can now return one string or a list
+of strings.  In the latter case, Emacs puts the second and following
+strings on the kill ring.
+
+** In `condition-case', a handler can specify "let the debugger run first".
+You do this by writing `debug' in the list of conditions to be handled,
+like this:
+
+    (condition-case nil
+       (foo bar)
+      ((debug error) nil))
+
+** clone-indirect-buffer now runs the clone-indirect-buffer-hook.
+
+** `beginning-of-defun-function' now takes one argument, the count given to
+`beginning-of-defun'.  (N.B. `end-of-defun-function' doesn't take any
+arguments.)
+
+** `file-remote-p' has new optional parameters IDENTIFICATION and CONNECTED.
+IDENTIFICATION specifies which part of the remote identifier has to be
+returned.  With CONNECTED passed non-nil, it is checked whether a
+remote connection has been established already.
+
+** The new macro `declare-function' suppresses compiler warnings about
+undefined functions.
+
+** Changes to interactive function handling
+
+*** The new interactive spec code ^ says to first call
+handle-shift-selection if shift-select-mode is non-nil, before reading
+the command arguments.  This is used for shift-selection (see above).
+
+*** Built-in functions can now have an interactive specification that
+is not a prompt string.  If the `intspec' parameter of a `DEFUN'
+starts with a `(', the string is evaluated as a Lisp form.
+
+*** The interactive-form of a function can be added post-facto via the
+`interactive-form' symbol property.  Mostly useful to add complex
+interactive forms to subroutines.
+
+** Region changes
+
+*** Commands should use `use-region-p' to test whether there is
+an active region that they should operate on.
+
+*** `region-active-p' returns non-nil when Transient Mark mode is
+enabled and the mark is active.  Most commands that act specially on
+the active region in Transient Mark mode should use `use-region-p'
+instead of `region-active-p', because `use-region-p' obeys the new
+user option `use-empty-active-region' (see Editing Changes, above).
+
+*** If a command sets `transient-mark-mode' to (only . OLDVAL), that
+means to activate transient-mark-mode temporarily, until the next
+unshifted point motion command or mark deactivation.  Afterwards,
+reset transient-mark-mode to the value OLDVAL.  The values `only' and
+`identity', introduced in Emacs 22, are now deprecated.
+
+** Emacs session information
+
+*** The new variables `before-init-time' and `after-init-time' record the
+value of `current-time' before and after Emacs loads the init files.
+
+*** The new function `emacs-uptime' returns the uptime of an Emacs instance.
+
+*** The new function `emacs-init-time' returns the duration of the
+Emacs initialization.
+
+** Changes affecting display-buffer
+
+*** display-buffer tries to be smarter when splitting windows.
+The new option split-window-preferred-function lets you specify your own
+function to pop up new windows.  Its default value split-window-sensibly
+can split a window either vertically or horizontally, whichever seems
+more suitable in the current configuration.  You can tune the behavior
+of split-window-sensibly by customizing split-height-threshold and the
+new option split-width-threshold.  Both options now take the value nil
+to inhibit splitting in one direction.  Setting split-width-threshold to
+nil inhibits horizontal splitting and gets you the behavior of Emacs 22
+in this respect.  In any case, display-buffer may now split the largest
+window vertically even when it is not as wide as the containing frame.
+
+*** If pop-up-frames has the value `graphic-only', display-buffer only
+makes a separate frame on graphic displays.
+
+*** select-frame and set-frame-selected-window have a new optional
+argument NORECORD.  If non-nil, this will avoid messing with the order
+of recently selected windows and the buffer list.
+
+** Window parameters can now be defined.
+These are analogous to frame parameters, but are associated with
+individual windows.
+
+*** The new functions window-parameters, window-parameter, and
+set-window-parameter are used to query and set window parameters.
+
+** Minibuffer and completion changes
+
+*** A list of default values can be specified for the DEFAULT argument of
+functions `read-from-minibuffer', `read-string', `read-command',
+`read-variable', `read-buffer', `completing-read'.  Elements of this list
+are available for inserting into the minibuffer by typing `M-n'.
+For empty input these functions return the first element of this list.
+
+*** New function `read-regexp' uses the regexp history and some useful
+regexp defaults (string at point, last Isearch/replacement regexp/string)
+via M-n when reading a regexp in the minibuffer.
+
+*** minibuffer-local-must-match-filename-map is now named
+minibuffer-local-filename-must-match-map.
+
+*** The `require-match' argument to `completing-read' accepts the new
+values `confirm-only' and `confirm-after-completion'.
+
+** Search and replacement changes
+
+*** The regexp form \(?<num>:<regexp>\) specifies the group number explicitly.
+
+*** New function `match-substitute-replacement' returns the result of
+`replace-match' without actually using it in the buffer.
+
+*** The new variable `replace-search-function' determines the function
+to use for searching in query-replace and replace-string.  The
+function it specifies is called by `perform-replace' when its 4th
+argument is nil.
+
+*** The new variable `replace-re-search-function' determines the
+function to use for searching in `query-replace-regexp',
+`replace-regexp', `query-replace-regexp-eval', and
+`map-query-replace-regexp'.  The function it specifies is called by
+`perform-replace' when its 4th argument is non-nil.
+
+*** New keymap `search-map' bound to `M-s' provides global bindings
+for search related commands.
+
+*** New keymap `multi-query-replace-map' contains additonal keys bound
+to `automatic-all' and `exit-current' for multi-buffer interactive replacement.
+
+*** The variable `inhibit-changing-match-data', if non-nil, prevents
+the search and match primitives from changing the match data.
+
+*** New functions `word-search-forward-lax' and `word-search-backward-lax'.
+These are like `word-search-forward and `word-search-backward', except
+that the end of the search string need not match a word boundary,
+unless it ends in whitespace.
+
+** File handling changes
+
+*** set-file-modes is now interactive and can take the mode value in
+symbolic notation thanks to auxiliary functions.
+
+*** file-local-variables-alist stores an alist of file-local
+variables defined in the current buffer.
+
+** Face-remapping
+
+*** Each face can be remapped to a different face definition using the
+variable `face-remapping-alist'.  This is an alist that maps faces to
+replacement definitions (which can be face names, lists of face names,
+or attribute/value plists.  If this variable is buffer-local, the
+remapping occurs only in that buffer.
+
+*** text-scale-mode remaps the default face to a larger or smaller
+size in the current buffer.  This feature is used by the Buffer Face
+menu and the new `C-x C-+', `C-x C--', and `C-x C-0' commands (see
+Editing Changes, above).
+
+*** New functions:
+
+**** `face-remap-add-relative' adds a face remapping entry to the
+current buffer.
+
+**** ``face-remap-remove-relative' removes a face remapping entry from
+the current buffer.
+
+**** `face-remap-reset-base' restores a face to its global definition.
+
+**** `face-remap-set-base' sets the base remapping of a face.
+
+** Process changes
+
+*** The new function `start-file-process' is similar to `start-process',
+but obeys file handlers.  The file handler is chosen based on
+`default-directory'.  The functions `start-file-process-shell-command'
+and `process-file-shell-command' are also new; they call internally
+`start-file-process' and `process-file', respectively.
+
+*** The new function `process-lines' executes an external program and
+returns its output as a list of lines.
+
+** Character code, representation, and charset changes.
+
+*** In multibyte buffers and strings, characters are represented by
+UTF-8 byte sequences.  The character code space is now 0x0..0x3FFFFF
+with no gap; code points 0x0..0x10FFFF are Unicode characters of the
+same code points, while code points 0x3FFF80..0x3FFFFF are raw 8-bit
+bytes.
+
+*** Generic characters no longer exist.
+
+*** The concept of a charset has changed.  A single character may
+belong to multiple charsets (e.g. a-grave, U+00E0, belongs to charsets
+unicode, iso-8859-1, iso-8859-3, etc).
+
+**** The dimension of a charset is now 1, 2, 3, or 4, and the size of
+each dimension is no longer limited to 94 or 96.
+
+**** A dynamic charset priority list is used to infer the charset of
+characters for display.
+
+*** The functions `split-char' and `make-char' now accept up to 4
+positional codes instead of just 2.
+
+*** The functions `encode-char' and `decode-char' now accept any character sets.
+
+*** The function `define-charset' now accepts a completely different
+form of arguments (old-style arguments still work).
+
+*** The value of the function `char-charset' depends on the current
+priorities of charsets.
+
+*** The function get-char-code-property now accepts many Unicode base
+character properties.  They are `name', `general-category',
+`canonical-combining-class', `bidi-class', `decomposition',
+`decimal-digit-value', `digit-value', `numeric-value', `mirrored',
+`old-name', `iso-10646-comment', `uppercase', `lowercase', and
+`titlecase'.
+
+*** The functions `modify-syntax-entry' and `modify-category-entry' now
+accept a cons of characters as the first argument, and modify all
+entries in that range of characters.
+
+*** Use of `translation-table-for-input' for character code unification
+is now obsolete, since Emacs 23.1 and later uses Unicode as basis for
+internal representation of characters.
+
+*** New functions:
+
+**** `characterp' returns t if and only if the argument is a character.
+This replaces `char-valid-p', which is now obsolete.
+
+**** `max-char' returns the maximum character code (currently #x3FFFFF).
+
+**** `define-charset-alias' defines an alias of a charset.
+
+**** `set-charset-priority' sets priorities of charsets.
+
+**** `charset-priority-list' returns a prioritized list of charsets.
+
+**** `unibyte-string' makes a unibyte string from bytes.
+
+**** `define-char-code-property' defines a character code property.
+
+**** `char-code-property-description' returns the description string of
+a character code property.
+
+*** New variables:
+
+**** `find-word-boundary-function-table' is a char-table of functions to
+search for a word boundary.
+
+**** `char-script-table' is a char-table of script names.
+
+**** `char-width-table' is a char-table of character widths.
+
+**** `print-charset-text-property' controls how to handle `charset' text
+property on printing a string.
+
+**** `printable-chars' is a char-table of printable characters.
+
+** Code conversion changes
+
+*** The new function `define-coding-system' should be used to define a
+coding system instead of `make-coding-system' (which is now obsolete).
+
+*** The functions `encode-coding-region' and `decode-coding-region'
+have an optional 4th argument to specify where the result of
+conversion should go.
+
+*** The functions `encode-coding-string' and `decode-coding-string'
+have an optional 4th argument specifying a buffer to store the result
+of conversion.
+
+*** The new variable `inhibit-null-byte-detection' controls whether to
+consider text with null bytes as binary data.  By default, it is
+`nil', and Emacs uses `no-conversion' for any text containing null
+bytes.
+
+*** The functions `set-coding-priority' and `make-coding-system' are obsolete.
+
+*** New functions:
+
+**** `with-coding-priority' executes Lisp code using the specified
+coding system priority order.
+
+**** `check-coding-systems-region' checks if the text in the region is
+encodable by the specified coding systems.
+
+**** `coding-system-aliases' returns a list of aliases of a coding system.
+
+**** `coding-system-charset-list' returns a list of charsets supported
+by a coding system.
+
+**** `coding-system-priority-list' returns a list of coding systems
+ordered by their priorities.
+
+**** `set-coding-system-priority' sets priorities of coding systems.
+
+**** `coding-system-from-name' returns a coding system matching with
+the argument name.
+
+** There is a new input method, Robin, different from Quail.
+It has three functionalities:
+ i) a simple input method (converts an ASCII sequence into a string).
+ii) converts an existing buffer substring into another string
+iii) reverse conversion (each character produced by a
+robin rule can hold the original ASCII sequence as a char-code-property)
+
+*** The new function `robin-define-package' defines a Robin package.
+
+*** The new function `robin-modify-package' modifies an existing Robin package.
+
+*** The new function `robin-use-package' starts using a Robin package
+as an input method.
+
+*** The new function `string-to-unibyte' is like `string-as-unibyte'
+but signals an error if STRING contains a non-ASCII, non-eight-bit
+character.
+
+** Changes related to the new font backend
+
+*** Which font backends to use can be specified by the X resource
+"FontBackend".  For instance, to use both X core fonts and Xft fonts:
+
+Emacs.FontBackend: x,xft
+
+If this resource is not set, Emacs tries to use all font backends
+available on your graphic device.
+
+*** New frame parameter `font-backend' specifies a list of
+font-backends supported by the frame's graphic device.  On X, they are
+currently `x' and `xft'.
+
+*** The function `set-fontset-font' now accepts a script name as the
+second argument, and has an optional 5th argument to control how to
+set the font.
+
+*** New functions:
+
+**** `fontp' checks if the argument is a font-spec or font-entity.
+
+**** `font-spec' creates a new font-spec object.
+
+**** `font-get' returns a font property value.
+
+**** `font-put' sets a font property value.
+
+**** `font-face-attributes' returns a plist of face attributes set by a font.
+
+**** `list-fonts' returns a list of font-entities matching a font spec.
+
+**** `find-font' returns the font-entity best matching the given font spec.
+
+**** `font-family-list' returns a list of family names of available fonts.
+
+**** `font-xlfd-name' returns an XLFD name of a given font spec, font
+entity, or font object.
+
+**** `clear-font-cache' clears all font caches.
+
+** Changes related to multiple-terminal (multi-tty) support
+
+*** $TERM is now set to `dumb' for subprocesses.  If you want to know the
+$TERM inherited by Emacs you will have to look inside initial-environment.
+
+*** $DISPLAY is now dynamically inherited from the frame's `display'.
+
+*** The `window-system' variable is now frame-local.  The new
+`initial-window-system' variable contains the `window-system' value
+for the first frame.  `window-system' is also now a function that
+takes a frame argument.
+
+*** The `keyboard-translate-table' variable and the terminal and
+keyboard coding systems are now terminal-local.
+
+*** You can specify a terminal device (`tty' parameter) and a terminal
+type (`tty-type' parameter) to `make-terminal-frame'.
+
+*** The function `make-frame-on-display' now works during a tty
+session.
+
+*** A new `terminal' data type.
+The functions `get-device-terminal', `terminal-parameters',
+`terminal-parameter', `set-terminal-parameter' use this data type.
+
+*** Function key sequences are now mapped using `local-function-key-map',
+a new variable.  This inherits from the global variable function-key-map,
+which is not used directly any more.
+
+*** New hooks:
+
+**** before-hack-local-variables-hook is called after setting new
+variable file-local-variables-alist, and before actually applying the
+file-local variables.
+
+**** `suspend-tty-functions' and `resume-tty-functions' are called
+after a tty frame has been suspended or resumed, respectively.  The
+functions are called with the terminal id of the frame being
+suspended/resumed as a parameter.
+
+**** The special hook `delete-terminal-functions' is called before
+deleting a terminal.
+
+*** New functions:
+
+**** `delete-terminal'
+
+**** `suspend-tty'
+
+**** `resume-tty'.
+
+*** `initial-environment' holds the environment inherited from Emacs's parent.
+
+** Redisplay changes
+
+*** For underlined characters, the distance between the underline and
+the baseline is controlled by a new variable, `underline-minimum-offset'.
+
+*** You can now pass the value of the `invisible' property to
+invisible-p to check whether it would cause the text to be invisible.
+This is convenient when checking invisibility of text with no buffer
+position (e.g. in before/after-strings).
+
+*** `clear-image-cache' can be told to flush only images of a specific file.
+
+*** `vertical-motion' can now be given a goal column.
+It now accepts a cons cell (COLS . LINES) in its first argument, which
+says to stop, where possible, at a pixel x-position equal to COLS
+times the default column width.
+
+*** redisplay-end-trigger-functions, set-window-redisplay-end-trigger,
+and window-redisplay-end-trigger are obsolete.  Use `jit-lock-register'
+instead.
+
+*** The new variables `wrap-prefix' and `line-prefix' specify display
+specs which are appended at display-time to every continuation line
+and non-continuation line, respectively.  In addition, Emacs
+recognizes the `wrap-prefix' and `line-prefix' text or overlay
+properties; these have the same effects as the variables of the same
+name, but take precedence.
+
+** The Lisp interpreter now treats non-breaking space as whitespace.
+
+** Miscellaneous new functions
+
+*** `apply-partially' performs a "curried" application of a function.
+
+*** `buffer-swap-text' swaps text between two buffers.  This can be
+useful for modes such as tar-mode, archive-mode, RMAIL.
+
+*** `combine-and-quote-strings' produces a single string from a list of strings
+sticking a separator string in between each pair, and quoting those
+strings that include the separator as their substring.  Useful for
+consing shell command lines from the individual arguments.
+
+*** `custom-note-var-changed' tells Custom to treat the change in a
+certain variable as having been made within Custom.
+
+*** `face-all-attributes' returns an alist describing all the basic
+attributes of a given face.
+
+*** `format-seconds' converts a number of seconds into a readable
+string of days, hours, etc.
+
+*** `image-refresh' refreshes all images associated with a given image
+specification.
+
+*** `locate-user-emacs-file' helps packages to select the appropriate
+place to save user-specific files.  It defaults to `user-emacs-directory'
+unless the file already exists at $HOME.
+
+*** `read-color' reads a color name using the minibuffer.
+
+*** `read-shell-command' does what its name says, with completion.  It
+uses the minibuffer-local-shell-command-map for that.
+
+*** `split-string-and-unquote' splits a string into a list of substrings
+on the boundaries of a given delimiter, and unquotes the substrings that
+are quoted.  Useful for taking apart shell commands.
+
+*** The two new functions `looking-at-p' and `string-match-p' can do
+the same matching as `looking-at' and `string-match' without changing
+the match data.
+
+*** The two new functions `make-serial-process' and
+`serial-process-configure' provide a Lisp interface to the new serial
+port support (see Emacs changes, above).
+
+** Miscellaneous new variables
+
+*** `auto-save-include-big-deletions', if non-nil, means auto-save is
+not turned off automatically after a big deletion.
+
+*** `read-circle', if nil, disables the reading of recursive Lisp
+structures using the #N= and #N# syntax.
+
+*** `this-command-keys-shift-translated' is non-nil if the key
+sequence invoking the current command was found by shift-translation.
+
+*** `window-point-insertion-type' determines the insertion-type of the
+marker used for window-point.
+
+*** bookmark provides `bookmark-make-record-function' so special major
+modes like Info can teach bookmark.el how to save and restore the
+relevant data.
+
+*** `fill-forward-paragraph-function' specifies which function the
+filling code should use to find paragraph boundaries.
+
+\f
+* New Packages for Lisp Programming in Emacs 23.1
+
+** The new package avl-tree.el deals with the AVL tree data structure.
+
+** The new package check-declare.el verifies the accuracy of
+declare-function macros (see Lisp Changes, above).
+
+** find-cmd.el can build `find' commands using lisp syntax.
+
+** The package misearch.el has been added.  It allows Isearch to search
+through multiple buffers.  A variable `multi-isearch-next-buffer-function'
+defines the function to call to get the next buffer to search in the series
+of multiple buffers.  Top-level functions `multi-isearch-buffers',
+`multi-isearch-buffers-regexp', `multi-isearch-files' and
+`multi-isearch-files-regexp' accept a single argument that specifies
+a list of buffers/files to search for a string/regexp.
+
+** The new major mode `special-mode' is intended as a parent for
+major modes such as those that set the "'mode-class 'special" property.
+
+\f
+----------------------------------------------------------------------
+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/>.
+
+\f
+Local variables:
+mode: outline
+paragraph-separate: "[         \f]*$"
+end:
+
+arch-tag: e759449d-88b3-4de4-9900-3a6c3dfa23e2
index fb1b2b38d562f8985e866d6f7034f1c454fcdaeb..093d815bd81fb5d86a8d37c1c249bfc28c2e5ffa 100644 (file)
@@ -9,7 +9,9 @@ See the end of the file for license conditions.
 This file describes various problems that have been encountered
 in compiling, installing and running GNU Emacs.  Try doing C-c C-t
 and browsing through the outline headers.  (See C-h m for help on
-Outline mode.)
+Outline mode.)  Information about systems that are no longer supported,
+and old Emacs releases, has been removed.  Consult older versions of
+this file if you are interested in that information.
 
 * Mule-UCS doesn't work in Emacs 23.
 
@@ -85,18 +87,10 @@ it's loaded very early in the startup procedure.)
 Similarly, any other .el file for which there's no corresponding .elc
 file could fail to load if it is compressed.
 
-The solution is to uncompress all .el files which don't have a .elc
-file.
+The solution is to uncompress all .el files that don't have a .elc file.
 
 Another possible reason for such failures is stale *.elc files
-lurking somewhere on your load-path.  The following command will
-print any duplicate Lisp files that are present in load-path:
-
-    emacs -q -batch -f list-load-path-shadows
-
-If this command prints any file names, some of these files are stale,
-and should be deleted or their directories removed from your
-load-path.
+lurking somewhere on your load-path -- see the next section.
 
 ** Emacs prints an error at startup after upgrading from an earlier version.
 
@@ -273,8 +267,7 @@ than the corresponding .el file.
 
 These control the actions of Emacs.
 ~/.emacs is your Emacs init file.
-EMACSLOADPATH overrides which directories the function
-"load" will search.
+EMACSLOADPATH overrides which directories the function "load" will search.
 
 If you observe strange problems, check for these and get rid
 of them, then try again.
@@ -420,8 +413,7 @@ For example, (system-name) returns some variation on
 
 You need to configure your machine with a fully qualified domain name,
 (i.e. a name with at least one ".") either in /etc/hosts,
-/etc/hostname, the NIS, or wherever your system calls for specifying
-this.
+/etc/hostname, the NIS, or wherever your system calls for specifying this.
 
 If you cannot fix the configuration, you can set the Lisp variable
 mail-host-address to the value you want.
@@ -487,13 +479,7 @@ causes it.
             else
             {
 
-** PSGML
-
-*** Old versions of the PSGML package use the obsolete variables
-`before-change-function' and `after-change-function', which are no
-longer used by Emacs.  Please use PSGML 1.2.3 or later.
-
-*** PSGML conflicts with sgml-mode.
+** PSGML conflicts with sgml-mode.
 
 PSGML package uses the same names of some variables (like keymap)
 as built-in sgml-mode.el because it was created as a replacement
@@ -503,38 +489,6 @@ HTML page and then start to work with SGML or XML file.  html-mode
 (from sgml-mode.el) is used for HTML file and loading of psgml.el
 (for sgml-mode or xml-mode) will cause an error.
 
-*** Versions of the PSGML package earlier than 1.0.3 (stable) or 1.1.2
-(alpha) fail to parse DTD files correctly in Emacs 20.3 and later.
-Here is a patch for psgml-parse.el from PSGML 1.0.1 and, probably,
-earlier versions.
-
---- psgml-parse.el     1998/08/21 19:18:18     1.1
-+++ psgml-parse.el     1998/08/21 19:20:00
-@@ -2383,7 +2383,7 @@ (defun sgml-push-to-entity (entity &opti
-       (setq sgml-buffer-parse-state nil))
-     (cond
-      ((stringp entity)                        ; a file name
--      (save-excursion (insert-file-contents entity))
-+      (insert-file-contents entity)
-       (setq default-directory (file-name-directory entity)))
-      ((consp (sgml-entity-text entity)) ; external id?
-       (let* ((extid (sgml-entity-text entity))
-
-** AUCTeX
-
-You should not be using a version older than 11.52 if you can avoid
-it.
-
-*** Emacs 21 freezes when visiting a TeX file with AUCTeX installed.
-
-Emacs 21 needs version 10 or later of AUCTeX; upgrading should solve
-these problems.
-
-*** No colors in AUCTeX with Emacs 21.
-
-Upgrade to AUC TeX version 10 or later, and make sure it is
-byte-compiled with Emacs 21.
-
 ** PCL-CVS
 
 *** Lines are not updated or new lines are added in the buffer upon commit.
@@ -568,8 +522,7 @@ terminal type.
 
 The cause of this is a shell startup file that sets the TERMCAP
 environment variable.  The terminal emulator uses that variable to
-provide the information on the special terminal type that Emacs
-emulates.
+provide the information on the special terminal type that Emacs emulates.
 
 Rewrite your shell startup file so that it does not change TERMCAP
 in such a case.  You could use the following conditional which sets
@@ -642,16 +595,6 @@ To work around the problem, you could either (a) set the variable
 invoking `df'; (b) use `df' from the GNU Fileutils package; or
 (c) use CVS, which is Free Software, instead of ClearCase.
 
-*** Versions of the W3 package released before Emacs 21.1 don't run
-under Emacs 21.  This fixed in W3 version 4.0pre.47.
-
-*** The LDAP support rely on ldapsearch program from OpenLDAP version 2.
-
-It can fail to work with ldapsearch program from OpenLDAP version 1.
-Version 1 of OpenLDAP is now deprecated.  If you are still using it,
-please upgrade to version 2.  As a temporary workaround, remove
-argument "-x" from the variable `ldap-ldapsearch-args'.
-
 *** ps-print commands fail to find prologue files ps-prin*.ps.
 
 This can happen if you use an old version of X-Symbol package: it
@@ -878,8 +821,7 @@ To circumvent this problem, set x-use-underline-position-properties
 to nil in your `.emacs'.
 
 To see what is the value of UNDERLINE_POSITION defined by the font,
-type `xlsfonts -lll FONT' and look at the font's UNDERLINE_POSITION
-property.
+type `xlsfonts -lll FONT' and look at the font's UNDERLINE_POSITION property.
 
 ** When using Exceed, fonts sometimes appear too tall.
 
@@ -929,12 +871,6 @@ mule-unicode-2500-33ff:-gnu-unifont-*-iso10646-1,\
 mule-unicode-e000-ffff:-gnu-unifont-*-iso10646-1,\
 mule-unicode-0100-24ff:-gnu-unifont-*-iso10646-1
 
-*** Athena/Lucid toolkit limitations
-
-The Athena/Lucid toolkit cannot display UTF-8 strings in the menu, so
-if you have UTF-8 buffer names, the buffer menu won't display the
-names properly.  The GTK+ toolkit works properly.
-
 ** The UTF-8/16/7 coding systems don't encode CJK (Far Eastern) characters.
 
 Emacs directly supports the Unicode BMP whose code points are in the
@@ -969,8 +905,7 @@ To see what glyphs are included in a font, use `xfd', like this:
 
   xfd -fn -schumacher-clean-medium-r-normal--12-120-75-75-c-60-iso8859-1
 
-If this shows only ASCII glyphs, the font is indeed the source of the
-problem.
+If this shows only ASCII glyphs, the font is indeed the source of the problem.
 
 The solution is to remove the corresponding lines from the appropriate
 `fonts.alias' file, then run `mkfontdir' in that directory, and then run
@@ -1076,8 +1011,7 @@ have made the key binding correctly.
 
 If C-h c reports an event that doesn't have the Alt modifier, it may
 be because your X server has no key for the Alt modifier.  The X
-server that comes from MIT does not set up the Alt modifier by
-default.
+server that comes from MIT does not set up the Alt modifier by default.
 
 If your keyboard has keys named Alt, you can enable them as follows:
 
@@ -1103,7 +1037,7 @@ into Meta.  This is because of the great importance of Meta in Emacs.
 
 This happens sometimes when using Metacity.  Resizing Emacs or ALT-Tab:bing
 makes the system unresponsive to the mouse or the keyboard.  Killing Emacs
-or shifting out from X11 and back again usually cures it (i.e. Ctrl-Alt-F1 
+or shifting out from X11 and back again usually cures it (i.e. Ctrl-Alt-F1
 and then Alt-F7).  A bug for it is here:
 https://bugs.launchpad.net/ubuntu/+source/metacity/+bug/231034.
 Note that a permanent fix seems to be to disable "assistive technologies".
@@ -1219,8 +1153,7 @@ menu placement.
 
 On some systems, even with Motif 1.2 emulation, Emacs occasionally
 locks up, grabbing all mouse and keyboard events.  We still don't know
-what causes these problems; they are not reproducible by Emacs
-developers.
+what causes these problems; they are not reproducible by Emacs developers.
 
 *** Motif: The Motif version of Emacs paints the screen a solid color.
 
@@ -1387,15 +1320,6 @@ One cause of such problems is having (setq term-file-prefix nil) in
 your .emacs file.  Another cause is a bad value of EMACSLOADPATH in
 the environment.
 
-*** Emacs fails to get default settings from X Windows server.
-
-The X library in X11R4 has a bug; it interchanges the 2nd and 3rd
-arguments to XGetDefaults.  Define the macro XBACKWARDS in config.h to
-tell Emacs to compensate for this.
-
-I don't believe there is any way Emacs can determine for itself
-whether this problem is present on a given system.
-
 *** X Windows doesn't work if DISPLAY uses a hostname.
 
 People have reported kernel bugs in certain systems that cause Emacs
@@ -1407,12 +1331,6 @@ You may be able to compensate for the bug by doing (set-input-mode nil nil).
 However, that has the disadvantage of turning off interrupts, so that
 you are unable to quit out of a Lisp program by typing C-g.
 
-The easy way to do this is to put
-
-  (setq x-sigio-bug t)
-
-in your site-init.el file.
-
 *** Prevent double pastes in X
 
 The problem:  a region, such as a command, is pasted twice when you copy
@@ -1564,8 +1482,7 @@ In this case, there is no obvious bug in Emacs, and most likely you
 need more padding, or possibly the terminal manual is wrong.
 
 2) The characters sent are incorrect, due to an obscure aspect
- of the terminal behavior not described in an obvious way
- by termcap.
+ of the terminal behavior not described in an obvious way by termcap.
 
 This case is hard.  It will be necessary to think of a way for
 Emacs to distinguish between terminals with this kind of behavior
@@ -1591,14 +1508,13 @@ in termcap.c, tparam.c, term.c, scroll.c, cm.c or dispnew.c.
 Some versions of rlogin (and possibly telnet) do not pass flow
 control characters to the remote system to which they connect.
 On such systems, emacs on the remote system cannot disable flow
-control on the local system.  Sometimes `rlogin -8' will avoid this
-problem.
+control on the local system.  Sometimes `rlogin -8' will avoid this problem.
 
 One way to cure this is to disable flow control on the local host
 (the one running rlogin, not the one running rlogind) using the
 stty command, before starting the rlogin process.  On many systems,
 "stty start u stop u" will do this.  On some systems, use
-"stty -ixon" instead. 
+"stty -ixon" instead.
 
 Some versions of tcsh will prevent even this from working.  One way
 around this is to start another shell before starting rlogin, and
@@ -1611,8 +1527,7 @@ following to your .emacs (on the host running rlogind):
 
 (enable-flow-control-on "vt200" "vt300" "vt101" "vt131")
 
-See the entry about spontaneous display of I-search (above) for more
-info.
+See the entry about spontaneous display of I-search (above) for more info.
 
 ** Output from Control-V is slow.
 
@@ -2010,8 +1925,8 @@ Definitions" to make them defined.
 
 ** Solaris
 
-We list bugs in current versions here.  Solaris 2.x and 4.x are covered in the
-section on legacy systems.
+We list bugs in current versions here.  See also the section on legacy
+systems.
 
 *** On Solaris, C-x doesn't get through to Emacs when you use the console.
 
@@ -2025,7 +1940,7 @@ may not work if you have used the unshared system libraries.  This
 is because the unshared libraries fail to use YP for host name lookup.
 As a result, the host name you specify may not be recognized.
 
-*** Solaris 2,6: Emacs crashes with SIGBUS or SIGSEGV on Solaris after you delete a frame.
+*** Solaris 2.6: Emacs crashes with SIGBUS or SIGSEGV on Solaris after you delete a frame.
 
 We suspect that this is a bug in the X libraries provided by
 Sun.  There is a report that one of these patches fixes the bug and
@@ -2341,8 +2256,7 @@ selection".
 
 Of this does not work, please inform bug-gnu-emacs@gnu.org.  Then
 please call support for your X-server and see if you can get a fix.
-If you do, please send it to bug-gnu-emacs@gnu.org so we can list it
-here.
+If you do, please send it to bug-gnu-emacs@gnu.org so we can list it here.
 
 * Build-time problems
 
@@ -2373,18 +2287,6 @@ The solution is to tell configure to use the correct C preprocessor
 for your C compiler (CPP="/opt/SUNWspro/bin/cc -E" in the above
 example).
 
-*** `configure' fails with ``"junk.c", line 660: invalid input token: 8.elc''
-
-The final stage of the Emacs configure process uses the C preprocessor
-to generate the Makefiles.  Errors of this form can occur if the C
-preprocessor inserts extra whitespace into its output.  The solution
-is to find the switches that stop your preprocessor from inserting extra
-whitespace, add them to CPPFLAGS, and re-run configure.  For example,
-this error can occur on Solaris 10 when using the Sun Studio compiler
-``Sun C 5.8'' with its preprocessor CPP="/opt/SUNWspro/bin/cc -E".
-The relevant switch in this case is "-Xs" (``compile assuming
-(pre-ANSI) K & R C style code'').
-
 ** Compilation
 
 *** Building Emacs over NFS fails with ``Text file busy''.
@@ -2427,46 +2329,6 @@ you are working on the host called `marvin'.  Then an entry in the
 
 The solution is to remove this line from `etc/fstab'.
 
-*** Building Emacs with GCC 2.9x fails in the `src' directory.
-
-This may happen if you use a development version of GNU `cpp' from one
-of the GCC snapshots between Oct 2000 and Feb 2001, or from a released
-version of GCC newer than 2.95.2 which was prepared around those
-dates; similar problems were reported with some snapshots of GCC 3.1
-around Sep 30 2001.  The preprocessor in those versions is
-incompatible with a traditional Unix cpp (e.g., it expands ".." into
-". .", which breaks relative file names that reference the parent
-directory; or inserts TAB characters before lines that set Make
-variables).
-
-The solution is to make sure the preprocessor is run with the
-`-traditional' option.  The `configure' script does that automatically
-when it detects the known problems in your cpp, but you might hit some
-unknown ones.  To force the `configure' script to use `-traditional',
-run the script like this:
-
-  CPP='gcc -E -traditional' ./configure ...
-
-(replace the ellipsis "..." with any additional arguments you pass to
-the script).
-
-Note that this problem does not pertain to the MS-Windows port of
-Emacs, since it doesn't use the preprocessor to generate Makefiles.
-
-*** src/Makefile and lib-src/Makefile are truncated--most of the file missing.
-*** Compiling wakeup, in lib-src, says it can't make wakeup.c.
-
-This can happen if configure uses GNU sed version 2.03.  That version
-had a bug.  GNU sed version 2.05 works properly.To solve the
-problem, install the current version of GNU Sed, then rerun Emacs's
-configure script.
-
-*** Compiling lib-src says there is no rule to make test-distrib.c.
-
-This results from a bug in a VERY old version of GNU Sed.  To solve
-the problem, install the current version of GNU Sed, then rerun
-Emacs's configure script.
-
 *** Building a 32-bit executable on a 64-bit GNU/Linux architecture.
 
 First ensure that the necessary 32-bit system libraries and include
@@ -2579,6 +2441,20 @@ several workarounds for this problem:
        2. Install the latest Windows SDK.
        3. Replace emacs.ico with an older or edited icon.
 
+*** Building the MS-Windows port complains about unknown escape sequences.
+
+Errors and warnings can look like this:
+
+ w32.c:1959:27: error: \x used with no following hex digits
+ w32.c:1959:27: warning: unknown escape sequence '\i'
+
+This happens when paths using backslashes are passed to the compiler or
+linker (via -I and possibly other compiler flags); when these paths are
+included in source code, the backslashes are interpreted as escape sequences.
+See http://lists.gnu.org/archive/html/emacs-devel/2010-07/msg00995.html
+
+The fix is to use forward slashes in all paths passed to the compiler.
+
 ** Linking
 
 *** Building Emacs with a system compiler fails to link because of an
@@ -2598,31 +2474,6 @@ A solution is to link with GCC, like this:
 Since the .o object files already exist, this will not recompile Emacs
 with GCC, but just restart by trying again to link temacs.
 
-*** AIX 1.3 ptf 0013: Link failure.
-
-There is a real duplicate definition of the function `_slibc_free' in
-the library /lib/libc_s.a (just do nm on it to verify).  The
-workaround/fix is:
-
-    cd /lib
-    ar xv libc_s.a NLtmtime.o
-    ar dv libc_s.a NLtmtime.o
-
-*** AIX 4.1.2: Linker error messages such as
-  ld: 0711-212 SEVERE ERROR: Symbol .__quous, found in the global symbol table
-        of archive /usr/lib/libIM.a, was not defined in archive member shr.o.
-
-This is a problem in libIM.a.  You can work around it by executing
-these shell commands in the src subdirectory of the directory where
-you build Emacs:
-
-    cp /usr/lib/libIM.a .
-    chmod 664 libIM.a
-    ranlib libIM.a
-
-Then change -lIM to ./libIM.a in the command to link temacs (in
-Makefile).
-
 *** Sun with acc: Link failure when using acc on a Sun.
 
 To use acc, you need additional options just before the libraries, such as
@@ -2651,7 +2502,7 @@ The fix is to install a newer version of ncurses, such as version 4.2.
 ** Bootstrapping
 
 Bootstrapping (compiling the .el files) is normally only necessary
-with CVS builds, since the .elc files are pre-compiled in releases.
+with development builds, since the .elc files are pre-compiled in releases.
 
 *** "No rule to make target" with Ubuntu 8.04 make 3.81-3build1
 
@@ -2763,32 +2614,28 @@ nonprinting characters, you can fix them:
 
 *** temacs prints "Pure Lisp storage exhausted".
 
-This means that the Lisp code loaded from the .elc and .el
-files during  temacs -l loadup inc dump  took up more
-space than was allocated.
+This means that the Lisp code loaded from the .elc and .el files
+during temacs -l loadup inc dump took up more space than was allocated.
 
 This could be caused by
  1) adding code to the preloaded Lisp files
  2) adding more preloaded files in loadup.el
  3) having a site-init.el or site-load.el which loads files.
    Note that ANY site-init.el or site-load.el is nonstandard;
-   if you have received Emacs from some other site
-   and it contains a site-init.el or site-load.el file, consider
-   deleting that file.
+   if you have received Emacs from some other site and it contains a
+   site-init.el or site-load.el file, consider deleting that file.
  4) getting the wrong .el or .elc files
    (not from the directory you expected).
  5) deleting some .elc files that are supposed to exist.
    This would cause the source files (.el files) to be
    loaded instead.  They take up more room, so you lose.
- 6) a bug in the Emacs distribution which underestimates
-   the space required.
+ 6) a bug in the Emacs distribution which underestimates the space required.
 
 If the need for more space is legitimate, change the definition
 of PURESIZE in puresize.h.
 
 But in some of the cases listed above, this problem is a consequence
-of something else that is wrong.  Be sure to check and fix the real
-problem.
+of something else that is wrong.  Be sure to check and fix the real problem.
 
 *** Linux: Emacs crashes when dumping itself on Mac PPC running Yellow Dog GNU/Linux.
 
@@ -2901,7 +2748,7 @@ build Emacs in a directory on a local disk.
 Two causes have been seen for such problems.
 
 1) On a system where getpagesize is not a system call, it is defined
-as a macro.  If the definition (in both unexec.c and malloc.c) is wrong,
+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).
 
@@ -2911,111 +2758,13 @@ 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 the m- or the s- file.
 
-* Emacs 19 problems
-
-** Error messages `Wrong number of arguments: #<subr where-is-internal>, 5'.
-
-This typically results from having the powerkey library loaded.
-Powerkey was designed for Emacs 19.22.  It is obsolete now because
-Emacs 19 now has this feature built in; and powerkey also calls
-where-is-internal in an obsolete way.
-
-So the fix is to arrange not to load powerkey.
-
 * Runtime problems on legacy systems
 
 This section covers bugs reported on very old hardware or software.
 If you are using hardware and an operating system shipped after 2000,
 it is unlikely you will see any of these.
 
-** Ancient operating systems
-
-AIX 4.2 was end-of-lifed on Dec 31st, 1999.
-
-*** AIX: You get this compiler error message:
-
-    Processing include file ./XMenuInt.h
-        1501-106: (S) Include file X11/Xlib.h not found.
-
-This means your system was installed with only the X11 runtime i.d
-libraries.  You have to find your sipo (bootable tape) and install
-X11Dev... with smit.
-
-(This report must be ancient.  Bootable tapes are long dead.)
-
-*** AIX 3.2.4: Releasing Ctrl/Act key has no effect, if Shift is down.
-
-Due to a feature of AIX, pressing or releasing the Ctrl/Act key is
-ignored when the Shift, Alt or AltGr keys are held down.  This can
-lead to the keyboard being "control-locked"--ordinary letters are
-treated as control characters.
-
-You can get out of this "control-locked" state by pressing and
-releasing Ctrl/Act while not pressing or holding any other keys.
-
-*** AIX 3.2.5: You get this message when running Emacs:
-
-    Could not load program emacs
-    Symbol smtcheckinit in csh is undefined
-    Error was: Exec format error
-
-or this one:
-
-    Could not load program .emacs
-    Symbol _system_con in csh is undefined
-    Symbol _fp_trapsta in csh is undefined
-    Error was: Exec format error
-
-These can happen when you try to run on AIX 3.2.5 a program that was
-compiled with 3.2.4.  The fix is to recompile.
-
-*** AIX 4.2: Emacs gets a segmentation fault at startup.
-
-If you are using IBM's xlc compiler, compile emacs.c
-without optimization; that should avoid the problem.
-
-*** ISC Unix
-
-**** ISC: display-time causes kernel problems on ISC systems.
-
-Under Interactive Unix versions 3.0.1 and 4.0 (and probably other
-versions), display-time causes the loss of large numbers of STREVENT
-cells.  Eventually the kernel's supply of these cells is exhausted.
-This makes emacs and the whole system run slow, and can make other
-processes die, in particular pcnfsd.
-
-Other emacs functions that communicate with remote processes may have
-the same problem.  Display-time seems to be far the worst.
-
-The only known fix: Don't run display-time.
-
-**** Sunos 5.3: Subprocesses remain, hanging but not zombies.
-
-A bug in Sunos 5.3 causes Emacs subprocesses to remain after Emacs
-exits.  Sun patch # 101415-02 is part of the fix for this, but it only
-applies to ptys, and doesn't fix the problem with subprocesses
-communicating through pipes.
-
-*** Irix
-
-*** Irix 6.2: No visible display on mips-sgi-irix6.2 when compiling with GCC 2.8.1.
-
-This problem went away after installing the latest IRIX patches
-as of 8 Dec 1998.
-
-The same problem has been reported on Irix 6.3.
-
-*** Irix 6.3: substituting environment variables in file names
-in the minibuffer gives peculiar error messages such as
-
-   Substituting nonexistent environment variable ""
-
-This is not an Emacs bug; it is caused by something in SGI patch
-003082 August 11, 1998.
-
-*** OPENSTEP
-
-**** OPENSTEP 4.2: Compiling syntax.c with gcc 2.7.2.1 fails.
+*** OPENSTEP 4.2: Compiling syntax.c with gcc 2.7.2.1 fails.
 
 The compiler was reported to crash while compiling syntax.c with the
 following message:
@@ -3053,81 +2802,6 @@ called.  The problem does not happen if you compile with GCC.
 This can happen if you configure Emacs without specifying the precise
 version of Solaris that you are using.
 
-**** Solaris 2.3 and 2.4: Unpredictable segmentation faults.
-
-A user reported that this happened in 19.29 when it was compiled with
-the Sun compiler, but not when he recompiled with GCC 2.7.0.
-
-We do not know whether something in Emacs is partly to blame for this.
-
-**** Solaris 2.4: Emacs dumps core on startup.
-
-Bill Sebok says that the cause of this is Solaris 2.4 vendor patch
-102303-05, which extends the Solaris linker to deal with the Solaris
-Common Desktop Environment's linking needs.  You can fix the problem
-by removing this patch and installing patch 102049-02 instead.
-However, that linker version won't work with CDE.
-
-Solaris 2.5 comes with a linker that has this bug.  It is reported that if
-you install all the latest patches (as of June 1996), the bug is fixed.
-We suspect the crucial patch is one of these, but we don't know
-for certain.
-
-        103093-03: [README] SunOS 5.5: kernel patch (2140557 bytes)
-        102832-01: [README] OpenWindows 3.5: Xview Jumbo Patch (4181613 bytes)
-        103242-04: [README] SunOS 5.5: linker patch (595363 bytes)
-
-(One user reports that the bug was fixed by those patches together
-with patches 102980-04, 103279-01, 103300-02, and 103468-01.)
-
-If you can determine which patch does fix the bug, please tell
-bug-gnu-emacs@gnu.org.
-
-Meanwhile, the GNU linker links Emacs properly on both Solaris 2.4 and
-Solaris 2.5.
-
-**** Solaris 2.4: Dired hangs and C-g does not work.  Or Emacs hangs
-forever waiting for termination of a subprocess that is a zombie.
-
-casper@fwi.uva.nl says the problem is in X11R6.  Rebuild libX11.so
-after changing the file xc/config/cf/sunLib.tmpl.  Change the lines
-
-    #if ThreadedX
-    #define SharedX11Reqs -lthread
-    #endif
-
-to:
-
-    #if OSMinorVersion < 4
-    #if ThreadedX
-    #define SharedX11Reqs -lthread
-    #endif
-    #endif
-
-Be sure also to edit x/config/cf/sun.cf so that OSMinorVersion is 4
-(as it should be for Solaris 2.4).  The file has three definitions for
-OSMinorVersion: the first is for x86, the second for SPARC under
-Solaris, and the third for SunOS 4.  Make sure to update the
-definition for your type of machine and system.
-
-Then do `make Everything' in the top directory of X11R6, to rebuild
-the makefiles and rebuild X.  The X built this way work only on
-Solaris 2.4, not on 2.3.
-
-For multithreaded X to work it is necessary to install patch
-101925-02 to fix problems in header files [2.4].  You need
-to reinstall gcc or re-run just-fixinc after installing that
-patch.
-
-However, Frank Rust <frust@iti.cs.tu-bs.de> used a simpler solution:
-he changed
-    #define ThreadedX          YES
-to
-    #define ThreadedX          NO
-in sun.cf and did `make World' to rebuild X11R6.  Removing all
-`-DXTHREAD*' flags and `-lthread' entries from lib/X11/Makefile and
-typing 'make install' in that directory also seemed to work.
-
 **** Solaris 2.x: GCC complains "64 bit integer types not supported".
 
 This suggests that GCC is not installed correctly.  Most likely you
@@ -3173,23 +2847,11 @@ lists the supported locales; any locale other than "C" or "POSIX"
 should do.
 
 pen@lysator.liu.se says (Feb 1998) that the Compose key does work
-if you link with the MIT X11 libraries instead of the Solaris X11
-libraries.
-
-*** HP/UX versions before 11.0
-
-HP/UX 9 was end-of-lifed in December 1998.
-HP/UX 10 was end-of-lifed in May 1999.
-
-**** HP/UX 9: Emacs crashes with SIGBUS or SIGSEGV after you delete a frame.
-
-We think this is due to a bug in the X libraries provided by HP.  With
-the alternative X libraries in /usr/contrib/mitX11R5/lib, the problem
-does not happen.
+if you link with the MIT X11 libraries instead of the Solaris X11 libraries.
 
 *** HP/UX 10: Large file support is disabled.
-
-See the comments in src/s/hpux10.h.
+(HP/UX 10 was end-of-lifed in May 1999.)
+See the comments in src/s/hpux10-20.h.
 
 *** HP/UX: Emacs is slow using X11R5.
 
@@ -3200,165 +2862,7 @@ libXmu.a, libXext.a and others.  HP/UX normally doesn't come with
 those libraries installed.  To get good performance, you need to
 install them and rebuild Emacs.
 
-*** Ultrix and Digital Unix
-
-**** Ultrix 4.2: `make install' fails on install-doc with `Error 141'.
-
-This happens on Ultrix 4.2 due to failure of a pipeline of tar
-commands.  We don't know why they fail, but the bug seems not to be in
-Emacs.  The workaround is to run the shell command in install-doc by
-hand.
-
-**** Digital Unix 4.0: Garbled display on non-X terminals when Emacs runs.
-
-So far it appears that running `tset' triggers this problem (when TERM
-is vt100, at least).  If you do not run `tset', then Emacs displays
-properly.  If someone can tell us precisely which effect of running
-`tset' actually causes the problem, we may be able to implement a fix
-in Emacs.
-
-**** Ultrix: `expand-file-name' fails to work on any but the machine you dumped Emacs on.
-
-On Ultrix, if you use any of the functions which look up information
-in the passwd database before dumping Emacs (say, by using
-expand-file-name in site-init.el), then those functions will not work
-in the dumped Emacs on any host but the one Emacs was dumped on.
-
-The solution?  Don't use expand-file-name in site-init.el, or in
-anything it loads.  Yuck - some solution.
-
-I'm not sure why this happens; if you can find out exactly what is
-going on, and perhaps find a fix or a workaround, please let us know.
-Perhaps the YP functions cache some information, the cache is included
-in the dumped Emacs, and is then inaccurate on any other host.
-
-*** SVr4
-
-**** SVr4: On some variants of SVR4, Emacs does not work at all with X.
-
-Try defining BROKEN_FIONREAD in your config.h file.  If this solves
-the problem, please send a bug report to tell us this is needed; be
-sure to say exactly what type of machine and system you are using.
-
-**** SVr4: After running emacs once, subsequent invocations crash.
-
-Some versions of SVR4 have a serious bug in the implementation of the
-mmap () system call in the kernel; this causes emacs to run correctly
-the first time, and then crash when run a second time.
-
-Contact your vendor and ask for the mmap bug fix; in the mean time,
-you may be able to work around the problem by adding a line to your
-operating system description file (whose name is reported by the
-configure script) that reads:
-#define SYSTEM_MALLOC
-This makes Emacs use memory less efficiently, but seems to work around
-the kernel bug.
-
-*** Irix 5 and earlier
-
-Exactly when Irix-5 end-of-lifed is obscure.  But since Irix 6.0
-shipped in 1994, it has been some years.
-
-**** Irix 5.2: unexelfsgi.c can't find cmplrs/stsupport.h.
-
-The file cmplrs/stsupport.h was included in the wrong file set in the
-Irix 5.2 distribution.  You can find it in the optional fileset
-compiler_dev, or copy it from some other Irix 5.2 system.  A kludgy
-workaround is to change unexelfsgi.c to include sym.h instead of
-syms.h.
-
-**** Irix 5.3: "out of virtual swap space".
-
-This message occurs when the system runs out of swap space due to too
-many large programs running.  The solution is either to provide more
-swap space or to reduce the number of large programs being run.  You
-can check the current status of the swap space by executing the
-command `swap -l'.
-
-You can increase swap space by changing the file /etc/fstab.  Adding a
-line like this:
-
-/usr/swap/swap.more     swap    swap    pri=3 0 0
-
-where /usr/swap/swap.more is a file previously created (for instance
-by using /etc/mkfile), will increase the swap space by the size of
-that file.  Execute `swap -m' or reboot the machine to activate the
-new swap area.  See the manpages for `swap' and `fstab' for further
-information.
-
-The objectserver daemon can use up lots of memory because it can be
-swamped with NIS information.  It collects information about all users
-on the network that can log on to the host.
-
-If you want to disable the objectserver completely, you can execute
-the command `chkconfig objectserver off' and reboot.  That may disable
-some of the window system functionality, such as responding CDROM
-icons.
-
-You can also remove NIS support from the objectserver.  The SGI `admin'
-FAQ has a detailed description on how to do that; see question 35
-("Why isn't the objectserver working?").  The admin FAQ can be found at
-ftp://viz.tamu.edu/pub/sgi/faq/.
-
-**** Irix 5.3: Emacs crashes in utmpname.
-
-This problem is fixed in Patch 3175 for Irix 5.3.
-It is also fixed in Irix versions 6.2 and up.
-
-**** Irix 6.0: Make tries (and fails) to build a program named unexelfsgi.
-
-A compiler bug inserts spaces into the string "unexelfsgi . o"
-in src/Makefile.  Edit src/Makefile, after configure is run,
-find that string, and take out the spaces.
-
-Compiler fixes in Irix 6.0.1 should eliminate this problem.
-
-*** SCO Unix and UnixWare
-
-**** SCO 3.2v4: Unusable default font.
-
-The Open Desktop environment comes with default X resource settings
-that tell Emacs to use a variable-width font.  Emacs cannot use such
-fonts, so it does not work.
-
-This is caused by the file /usr/lib/X11/app-defaults/ScoTerm, which is
-the application-specific resource file for the `scoterm' terminal
-emulator program.  It contains several extremely general X resources
-that affect other programs besides `scoterm'.  In particular, these
-resources affect Emacs also:
-
-        *Font: -*-helvetica-medium-r-*--12-*-p-*
-        *Background:                   scoBackground
-        *Foreground:                   scoForeground
-
-The best solution is to create an application-specific resource file for
-Emacs, /usr/lib/X11/sco/startup/Emacs, with the following contents:
-
-        Emacs*Font:    -*-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-1
-        Emacs*Background:      white
-        Emacs*Foreground:      black
-
-(These settings mimic the Emacs defaults, but you can change them to
-suit your needs.)  This resource file is only read when the X server
-starts up, so you should restart it by logging out of the Open Desktop
-environment or by running `scologin stop; scologin start` from the shell
-as root.  Alternatively, you can put these settings in the
-/usr/lib/X11/app-defaults/Emacs resource file and simply restart Emacs,
-but then they will not affect remote invocations of Emacs that use the
-Open Desktop display.
-
-These resource files are not normally shared across a network of SCO
-machines; you must create the file on each machine individually.
-
-**** SCO 4.2.0: Regular expressions matching bugs on SCO systems.
-
-On SCO, there are problems in regexp matching when Emacs is compiled
-with the system compiler.  The compiler version is "Microsoft C
-version 6", SCO 4.2.0h Dev Sys Maintenance Supplement 01/06/93; Quick
-C Compiler Version 1.00.46 (Beta).  The solution is to compile with
-GCC.
-
-**** UnixWare 2.1: Error 12 (virtual memory exceeded) when dumping Emacs.
+*** UnixWare 2.1: Error 12 (virtual memory exceeded) when dumping Emacs.
 
 Paul Abrahams (abrahams@acm.org) reports that with the installed
 virtual memory settings for UnixWare 2.1.2, an Error 12 occurs during
@@ -3381,21 +2885,7 @@ According to Martin Sohnius, you can also retune this in the kernel:
 (He recommends you not change the stack limit, though.)
 These changes take effect when you reboot.
 
-*** Linux 1.x
-
-**** Linux 1.0-1.04: Typing C-c C-c in Shell mode kills your X server.
-
-This happens with Linux kernel 1.0 thru 1.04, approximately.  The workaround is
-to define SIGNALS_VIA_CHARACTERS in config.h and recompile Emacs.
-Newer Linux kernel versions don't have this problem.
-
-**** Linux 1.3: Output from subprocess (such as man or diff) is randomly
-truncated on GNU/Linux systems.
-
-This is due to a kernel bug which seems to be fixed in Linux version
-1.3.75.
-
-** Windows 3.1, 95, 98, and ME
+** MS-Windows 95, 98, ME, and NT
 
 *** MS-Windows NT/95: Problems running Perl under Emacs
 
@@ -3477,8 +2967,7 @@ http://www.gnu.org/software/emacs/windows/.
 When a program you are trying to run is not found on the PATH,
 Windows might respond by crashing or locking up your system.  In
 particular, this has been reported when trying to compile a Java
-program in JDEE when javac.exe is installed, but not on the system
-PATH.
+program in JDEE when javac.exe is installed, but not on the system PATH.
 
 ** MS-DOS
 
@@ -3543,7 +3032,7 @@ your system works as before.
 *** MS-DOS: Emacs crashes at startup.
 
 Some users report that Emacs 19.29 requires dpmi memory management,
-and crashes on startup if the system does not have it.  We don't yet
+and crashes on startup if the system does not have it.  We don't
 know why this happens--perhaps these machines don't have enough real
 memory, or perhaps something is wrong in Emacs or the compiler.
 However, arranging to use dpmi support is a workaround.
@@ -3567,7 +3056,7 @@ This is an unfortunate side-effect of the support for Unix-style
 device names such as /dev/null in the DJGPP runtime library.  A
 work-around is to rename the problem directory to another name.
 
-*** MS-DOS+DJGPP: Problems on MS-DOG if DJGPP v2.0 is used to compile Emacs.
+*** MS-DOS+DJGPP: Problems on MS-DOS if DJGPP v2.0 is used to compile Emacs.
 
 There are two DJGPP library bugs which cause problems:
 
@@ -3589,8 +3078,7 @@ the Lisp files it needs to load at startup.  Redirect Emacs stdout
 and stderr to a file to see the error message printed by Emacs.
 
 Another manifestation of this problem is that Emacs is unable to load
-the support for editing program sources in languages such as C and
-Lisp.
+the support for editing program sources in languages such as C and Lisp.
 
 This can happen if the Emacs distribution was unzipped without LFN
 support, thus causing long filenames to be truncated to the first 6
@@ -3620,7 +3108,7 @@ shortcut keys entirely by adding this line to ~/.OWdefaults:
 
     OpenWindows.WindowMenuAccelerators: False
 
-**** twm: A position you specified in .Xdefaults is ignored, using twm.
+*** twm: A position you specified in .Xdefaults is ignored, using twm.
 
 twm normally ignores "program-specified" positions.
 You can tell it to obey them with this command in your `.twmrc' file:
@@ -3643,62 +3131,6 @@ This problem seems to be a matter of configuring the DECserver to use
 
 * Build problems on legacy systems
 
-** BSD/386 1.0: --with-x-toolkit option configures wrong.
-
-This problem is due to bugs in the shell in version 1.0 of BSD/386.
-The workaround is to edit the configure file to use some other shell,
-such as bash.
-
-** Digital Unix 4.0: Emacs fails to build, giving error message
-     Invalid dimension for the charset-ID 160
-
-This is due to a bug or an installation problem in GCC 2.8.0.
-Installing a more recent version of GCC fixes the problem.
-
-** Digital Unix 4.0: Failure in unexec while dumping emacs.
-
-This problem manifests itself as an error message
-
-    unexec: Bad address, writing data section to ...
-
-The user suspects that this happened because his X libraries
-were built for an older system version,
-
-    ./configure --x-includes=/usr/include --x-libraries=/usr/shlib
-
-made the problem go away.
-
-** Sunos 4.1.1: there are errors compiling sysdep.c.
-
-If you get errors such as
-
-    "sysdep.c", line 2017: undefined structure or union
-    "sysdep.c", line 2017: undefined structure or union
-    "sysdep.c", line 2019: nodename undefined
-
-This can result from defining LD_LIBRARY_PATH.  It is very tricky
-to use that environment variable with Emacs.  The Emacs configure
-script links many test programs with the system libraries; you must
-make sure that the libraries available to configure are the same
-ones available when you build Emacs.
-
-** SunOS 4.1.1: You get this error message from GNU ld:
-
-    /lib/libc.a(_Q_sub.o): Undefined symbol __Q_get_rp_rd referenced from text segment
-
-The problem is in the Sun shared C library, not in GNU ld.
-
-The solution is to install Patch-ID# 100267-03 from Sun.
-
-** Sunos 4.1: Undefined symbols when linking using --with-x-toolkit.
-
-If you get the undefined symbols _atowc _wcslen, _iswprint, _iswspace,
-_iswcntrl, _wcscpy, and _wcsncpy, then you need to add -lXwchar after
--lXaw in the command that links temacs.
-
-This problem seems to arise only when the international language
-extensions to X11R5 are installed.
-
 ** SunOS: Emacs gets error message from linker on Sun.
 
 If the error message says that a symbol such as `f68881_used' or
@@ -3783,7 +3215,7 @@ In the XCONS, etc., macros in lisp.h you must replace (a).u.val with
 This problem will only happen if USE_LISP_UNION_TYPE is manually
 defined in lisp.h.
 
-*** C compilers lose on returning unions.
+** 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
index b8c55bff92bd303f794da49fe164cd0e048eb4c7..d58eb8be3d84c579ac604de79688bdaab3fb403e 100644 (file)
--- a/etc/TODO
+++ b/etc/TODO
@@ -12,7 +12,46 @@ it best.  Since Emacs is an FSF-copyrighted package, please be
 prepared to sign legal papers to transfer the copyright on your work
 to the FSF.
 
-* Simple tasks. These don't require much emacs knowledge, they are
+* Tentative plan for Emacs-24
+
+** Bidi
+** lexbind: I haven't checked the status of the code recently, so
+  I don't know how realistic it is to include it.  But it's been around
+  for a long time, and I trust Miles, so I have hope.
+** concurrency: including it as an "experimental" compile-time option
+  sounds good.  Of course there might still be big questions around
+  "which form of concurrency" we'll want.
+** Overhaul of customize: sounds wonderful.
+** some kind of color-theme: agreed.
+** better support for dynamic embedded graphics: I like this idea (my
+  mpc.el code could use it for the volume widget), tho I wonder if the
+  resulting efficiency will be sufficient.
+** Spread Semantic.
+** 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.
+** package manager.
+
+** 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
+make it.
+*** multiple inheritance for keymaps (to get rid of the
+  fix_submap_inheritance hack and to more cleanly express the
+  relationship between minibuffer-local-*-map): I've had this locally
+  for a long time, but the details of the semantics is somewhat ... delicate.
+*** Derive from prog-mode in more places, close bug#5532.
+*** prog-mode could/should provide a better fill-paragraph default
+  that uses syntax-tables to recognize string/comment boundaries.
+*** provide more completion-at-point-functions.  Make existing
+  in-buffer completion use completion-at-point.
+*** "functional" function-key-map that would make it easy to add (and
+  remove) mappings like "FOO-mouse-4 -> FOO-scroll-down",
+  "FOO-tab -> ?\FOO-\t", "uppercase -> lowercase", "[fringe KEY...] ->
+  [KEY]", "H-FOO -> M-FOO", "C-x C-y FOO -> H-FOO", ...
+
+
+* Simple tasks. These don't require much Emacs knowledge, they are
 suitable for anyone from beginners to experts.
 
 ** Convert modes that use view-mode to be derived from special-mode instead.
@@ -66,9 +105,6 @@ for users to customize.
 
 ** erase-buffer should perhaps disregard read-only properties of text.
 
-** Make occur correctly handle matches that span more than one line,
-   as well as overlapping matches.
-
 ** Fix the kill/yank treatment of invisible text.  At the moment,
   invisible text is placed in the kill-ring, so that the contents of
   the ring may not correspond to the text as displayed to the user.
@@ -92,8 +128,6 @@ for users to customize.
 
 ** Enhance scroll-bar to handle tall line (similar to line-move).
 
-** Make occur handle multi-line matches cleanly with context.
-
 ** In Custom buffers, put the option that turns a mode on or off first,
   using a heuristic of some kind?
 
@@ -147,7 +181,14 @@ dired buffers and DTRT WRT `auto-revert-mode'.
 http://lists.gnu.org/archive/html/emacs-devel/2008-08/msg00456.html
 
 * Important features:
-
+** Extended text-properties (to make overlays "obsolete")
+*** Several text-property planes
+This would get us rid of font-lock-face property (and I'd be happy to
+get rid of char-property-alias-alist as well) since font-lock would
+simply use the `face' property in the `font-lock' plane.
+Each property would come with an Elisp merge-function.  The merge
+would be performed in add-text-properties.
+*** zero-width text-properties.
 ** Having tabs above a window to switch buffers in it.
 
 ** "Perspectives" are named persistent window configurations.  We have
index d6a236d243d3e862e340a7ea2c19318e99f7f35d..9cf39c90f9f76acffb24b95a10760a1b497eb4ac 100644 (file)
@@ -93,6 +93,43 @@ symbol: comma
 "foo.adb", line 2(11): warning: file name does not match ...
 "src/swapping.c", line 30.34: 1506-342 (W) "/*" detected in comment.
 
+* Cucumber
+
+symbol: cucumber
+
+Feature: This is an example for backtrace.
+
+  Scenario: undefined step  # features/cucumber.feature:3
+    Given this is undefined # features/cucumber.feature:4
+
+  Scenario: assertion false (Test::Unit)    # foo/bar.feature:6
+    Given this will generate 'assert false' # foo/bar.rb:1
+      <false> is not true. (Test::Unit::AssertionFailedError)
+      /home/gusev/.rvm/foo/bar.rb:48:in `assert_block'
+      /home/gusev/.rvm/foo/bar.rb:500:in `_wrap_assertion'
+      features/cucumber.feature:7:in `Given this will generate 'assert false''
+
+  Scenario: assertion false (RSpec)           # foo/bar.feature:9
+    Given this will generate 'should be_true' # foo/bar.rb:5
+      expected true to be false (Spec::Expectations::ExpectationNotMetError)
+      ./foo/bar/baz.rb:6:in `/^this will generate 'should be_true'$/'
+      foo/bar.feature:10:in `Given this will generate 'should be_true''
+
+  Scenario: backtrace in step definition # foo/bar.feature:12
+    Given this will generate backtrace   # foo/sbar.rb:9
+       (RuntimeError)
+      ./foo/bar.rb:10:in `/^this will generate backtrace$/'
+      foo/bar.feature:13:in `Given this will generate backtrace'
+
+Failing Scenarios:
+cucumber foo/cucumber.feature:6 # Scenario: assertion false (Test::Unit)
+cucumber foo/cucumber.feature:9 # Scenario: assertion false (RSpec)
+cucumber foo/cucumber.feature:12 # Scenario: backtrace in step definition
+cucumber foo/cucumber.feature:15 # Scenario: deeep backtrace in step definition
+
+5 scenarios (4 failed, 1 undefined)
+5 steps (4 failed, 1 undefined)
+0m0.007s
 
 * EDG C/C++
 
@@ -318,6 +355,51 @@ symbol: php
 Parse error: parse error, unexpected $ in main.php on line 59
 Fatal error: Call to undefined function: mysql_pconnect() in db.inc on line 66
 
+* Ruby
+
+symbol: ruby
+
+plain-exception.rb:7:in `fun': unhandled exception
+       from plain-exception.rb:3:in `proxy'
+       from plain-exception.rb:12
+
+* Ruby (Test::Unit)
+
+symbol: ruby-Test::Unit
+
+Loaded suite examples/test-unit
+Started
+FFFE
+Finished in 0.023173 seconds.
+
+  1) Failure:
+test_a_deep_assert(BacktracesTest)
+    [examples/test-unit.rb:28:in `here_is_a_deep_assert'
+     examples/test-unit.rb:19:in `test_a_deep_assert']:
+<false> is not true.
+
+  2) Failure:
+test_assert(BacktracesTest) [examples/test-unit.rb:5]:
+<false> is not true.
+
+  3) Failure:
+test_assert_raise(BacktracesTest) [examples/test-unit.rb:9]:
+Exception raised:
+Class: <RuntimeError>
+Message: <"">
+---Backtrace---
+examples/test-unit.rb:10:in `test_assert_raise'
+examples/test-unit.rb:9:in `test_assert_raise'
+---------------
+
+  4) Error:
+test_backtrace(BacktracesTest):
+NoMethodError: undefined method `not_exists' for nil:NilClass
+    examples/test-unit.rb:24:in `some_function_call_from_nil'
+    examples/test-unit.rb:15:in `test_backtrace'
+
+4 tests, 3 assertions, 3 failures, 1 errors
+
 * RXP
 
 symbol: rxp
@@ -375,11 +457,11 @@ bloofle defined( /users/wolfgang/foo.c(4) ), but never used
 
 * GCOV (test coverage program)
 
-symbol: gcov-file gcov-bb-file gcov-never-called-line gcov-called-line 
+symbol: gcov-file gcov-bb-file gcov-never-called-line gcov-called-line
 
         -:    0:Source:foo.c
         -:    0:Object:foo.bb
-        -:    1:/* $ gcc -fprofile-arcs -ftest-coverage foo.c 
+        -:    1:/* $ gcc -fprofile-arcs -ftest-coverage foo.c
         -:    2:   $ ./a.out
         -:    3:   $ gcov foo.c
         -:    4:   LANG=C gcov foo.c
@@ -393,10 +475,10 @@ symbol: gcov-file gcov-bb-file gcov-never-called-line gcov-called-line
         1:   12:    r = 1;
     #####:   13:  else if (argc == 2)
     #####:   14:    r = 2;
-        -:   15:  else 
+        -:   15:  else
     #####:   16:    r = 0;
         1:   17:  return r;
-        -:   18:} 
+        -:   18:}
 
 
 * Podchecker error messages, per Pod::Checker
index 2893c40b24522a0aa2f5e542690af24ea59b498c..31eeee024e147dbdeb98aa8286ded91ff2e941b5 100644 (file)
@@ -33,6 +33,8 @@ Your mail can be downloaded into Gnus in several ways, choose one:
 
 @end text
 
+@next 'finish
+
 @node Setting up a NNTP server
 
 @text
@@ -40,6 +42,8 @@ TODO: this will be a real link.
 Run M-x assistant and use the news-server.ast file as input.
 @end text
 
+@next 'finish
+
 \f
 @c Local variables:
 @c mode: texinfo
index 294f92382d9f4cad1ec78b85faa603fc1bce9b77..432f71a50f08e1a01a2fc9ceca8409561ae53be7 100644 (file)
@@ -2,9 +2,9 @@
 
 
 @node Setting up the news server name and port number
-@variable server :string (gnus-getenv-nntpserver)
+@variable server :string (or (gnus-getenv-nntpserver) "your-server-here")
 @variable port :number 119
-@validate (assistant-validate-connect-to-server server port)
+@validate (or (assistant-validate-connect-to-server server port) (y-or-n-p "Do you want to use the server anyway, although you can't confirm it's valid?"))
 @result gnus-select-method (list 'nntp server (list 'nntp-server port))
 @text
 Usenet news is usually read from your Internet service prodider's news
@@ -14,10 +14,10 @@ As a guess, the name of the server might be news.yourisp.com.
 
 Server name: @variable{server}
 Port number: @variable{port}
+
 @end text
 @next t "User name and password"
 
-
 @node User name and password
 @type interstitial
 @next 
index 4ddb255bc4436c1e51b2a942c8ad0edd769beea2..9977d4991876686f24874c72005a0f266d83a2c6 100644 (file)
@@ -1,19 +1,16 @@
 /* XPM */
 static char * down_xpm[] = {
-"8 12 4 1",
+"9 9 4 1",
 "      c none",
-".     c gray90",
-"X     c gray45",
-"O     c gray75",
-"........",
-".OOOOOOX",
-" .OOOOX ",
-" .OOOOX ",
-"  .OOX  ",
-"  .OOX  ",
-"   OX   ",
-"   OX   ",
-"        ",
-"        ",
-"        ",
-"        "};
+".     c black",
+"x     c gray45",
+"+     c white",
+".........",
+".x+++++x.",
+" .+++++. ",
+" .x+++x. ",
+"  .+++.  ",
+"  .x+x.  ",
+"   .+.   ",
+"   .x.   ",
+"    .    "};
index c75f7e74058e8f8df86f731e7fa3281d9b8490d9..a105af025e962395cb7d48cc4322e53ece10af30 100644 (file)
@@ -1,19 +1,16 @@
 /* XPM */
 static char * right_xpm[] = {
-"8 12 4 1",
+"9 9 4 1",
 "      c none",
-".     c gray90",
-"X     c gray45",
-"O     c gray75",
-"..      ",
-"..O.    ",
-"..OOO.  ",
-"..OOOOOX",
-"..OOOOXX",
-"..OOXX  ",
-"..XX    ",
-"OO      ",
-"        ",
-"        ",
-"        ",
-"        " };
+".     c black",
+"x     c gray45",
+"+     c white",
+"..       ",
+".x..     ",
+".++x..   ",
+".++++x.. ",
+".++++++x.",
+".++++x.. ",
+".++x..   ",
+".x..     ",
+"..       "};
index c35cafbba5221b7b30f290d25b69859551e3f0b4..c1f604a64dd6bb0554c944fabb2080681c67caae 100644 (file)
@@ -1,6 +1,6 @@
 % Reference Card for Org Mode
-\def\orgversionnumber{6.33x}
-\def\versionyear{2009}          % latest update
+\def\orgversionnumber{7.01}
+\def\versionyear{2010}          % latest update
 \def\year{2010}                 % latest copyright year
 
 %**start of header
 % Specify how many you want here.
 \columnsperpage=3
 
-% Set letterpaper to 0 for A4 paper, 1 for letter (US) paper.  Useful
-% only when columnsperpage is 2 or 3.
-\letterpaper=0
-
 % PDF output layout.  0 for A4, 1 for letter (US), a `l' is added for
 % a landscape layout.
 \input pdflayout.sty
@@ -22,7 +18,7 @@
 
 % Nothing else needs to be changed below this line.
 % Copyright (C) 1987, 1993, 1996, 1997, 2001, 2002, 2003, 2004, 2005,
-%   2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
+%   2006, 2007, 2008, 2009  Free Software Foundation, Inc.
 
 % This file is part of GNU Emacs.
 
@@ -279,12 +275,12 @@ are preserved on all copies.
 
 \section{Getting Started}
 %
-\vskip -2mm
-\beginexample%
-(add-to-list 'auto-mode-alist '("\\\\.org\$" . org-mode))
-(define-key global-map "\\C-cl" 'org-store-link)$^1$
-(define-key global-map "\\C-ca" 'org-agenda)$^1$
-\endexample
+%\vskip -2mm
+%\beginexample%
+%(add-to-list 'auto-mode-alist '("\\\\.org\$" . org-mode))
+%(define-key global-map "\\C-cl" 'org-store-link)$^1$
+%(define-key global-map "\\C-ca" 'org-agenda)$^1$
+%\endexample
 %
 \metax{To read the on-line documentation try}{M-x org-info}
 
@@ -333,7 +329,7 @@ are preserved on all copies.
 \section{Filtering and Sparse Trees}
 
 \key{construct a sparse tree by various criteria}{C-c /}
-\key{view TODO's in sparse tree}{C-c C-v}
+\key{view TODO's in sparse tree}{C-c / t/T}
 \key{global TODO list in agenda mode}{C-c a t$^1$}
 \key{time sorted view of current org file}{C-c a L}
 
@@ -374,9 +370,9 @@ Outside of tables, the same keys may have other functionality.
 
 {\bf Regions}
 
-\key{cut rectangular region}{C-c C-x C-w}
-\key{copy rectangular region}{C-c C-x M-w}
-\key{paste rectangular region}{C-c C-x C-y}
+\metax{cut/copy/paste rectangular region}{C-c C-x C-w/M-w/C-y}
+%\key{copy rectangular region}{C-c C-x M-w}
+%\key{paste rectangular region}{C-c C-x C-y}
 \key{fill paragraph across selected cells}{C-c C-q}
 
 {\bf Miscellaneous}
@@ -446,36 +442,53 @@ formula, \kbd{:=} a field formula.
 \key{find next link}{C-c C-x C-n}
 \key{find previous link}{C-c C-x C-p}
 \key{edit code snippet of file at point}{C-c '}
-
-{\bf Internal Links}
-
-\key{\kbd{<<My Target>>}}{\rm target}
-\key{\kbd{<<<My Target>>>}}{\rm radio target$^2$}
-\key{\kbd{[[*this text]]}}{\rm find headline}
-\metax{\kbd{[[this text]]}}{\rm find target or text in buffer}
-\metax{\kbd{[[this text][description]]}}{\rm optional link text}
-
-{\bf External Links}
-
-\key{\kbd{file:/home/dominik/img/mars.jpg}}{\rm file, absolute}
-\key{\kbd{file:papers/last.pdf}}{\rm file, relative}
-\key{\kbd{file:projects.org::*that text}}{\rm find headline}
-\key{\kbd{file:projects.org::find me}}{\rm find trgt/string}
-%\key{\kbd{file:projects.org::/regexp/}}{\rm regexp search}
-\key{\kbd{http://www.astro.uva.nl/~dominik}}{\rm on the web}
-\key{\kbd{mailto:adent@galaxy.net}}{\rm Email address}
-\key{\kbd{news:comp.emacs}}{\rm Usenet group}
-\key{\kbd{bbdb:Richard Stallman}}{\rm BBDB person}
-\key{\kbd{gnus:group}}{\rm GNUS group}
-\key{\kbd{gnus:group\#id}}{\rm GNUS message}
-\key{\kbd{vm|wl|mhe|rmail:folder}}{\rm Mail folder}
-\key{\kbd{vm|wl|mhe|rmail:folder\#id}}{\rm Mail message}
-\key{\kbd{info:emacs:Regexps}}{\rm Info file:node}
-\key{\kbd{shell:ls *.org}}{\rm shell command}
-\key{\kbd{elisp:(calendar)}}{\rm elisp form}
-\metax{\kbd{[[external link][description]]}}{\rm optional link text}
-%\key{\kbd{vm://myself@some.where.org/folder\#id}}{\rm VM remote}
-
+\key{toggle inline display of linked images}{C-c C-x C-v}
+
+% {\bf Internal Links}
+
+% \key{\kbd{<<My Target>>}}{\rm target}
+% \key{\kbd{<<<My Target>>>}}{\rm radio target$^2$}
+% \key{\kbd{[[*this text]]}}{\rm find headline}
+% \metax{\kbd{[[this text]]}}{\rm find target or text in buffer}
+% \metax{\kbd{[[this text][description]]}}{\rm optional link text}
+
+% {\bf External Links}
+
+% \key{\kbd{file:/home/dominik/img/mars.jpg}}{\rm file, absolute}
+% \key{\kbd{file:papers/last.pdf}}{\rm file, relative}
+% \key{\kbd{file:projects.org::*that text}}{\rm find headline}
+% \key{\kbd{file:projects.org::find me}}{\rm find trgt/string}
+% %\key{\kbd{file:projects.org::/regexp/}}{\rm regexp search}
+% \key{\kbd{http://www.astro.uva.nl/~dominik}}{\rm on the web}
+% \key{\kbd{mailto:adent@galaxy.net}}{\rm Email address}
+% \key{\kbd{news:comp.emacs}}{\rm Usenet group}
+% \key{\kbd{bbdb:Richard Stallman}}{\rm BBDB person}
+% \key{\kbd{gnus:group}}{\rm GNUS group}
+% \key{\kbd{gnus:group\#id}}{\rm GNUS message}
+% \key{\kbd{vm|wl|mhe|rmail:folder}}{\rm Mail folder}
+% \key{\kbd{vm|wl|mhe|rmail:folder\#id}}{\rm Mail message}
+% \key{\kbd{info:emacs:Regexps}}{\rm Info file:node}
+% \key{\kbd{shell:ls *.org}}{\rm shell command}
+% \key{\kbd{elisp:(calendar)}}{\rm elisp form}
+% \metax{\kbd{[[external link][description]]}}{\rm optional link text}
+% %\key{\kbd{vm://myself@some.where.org/folder\#id}}{\rm VM remote}
+
+\section{Working with Code (Babel)}
+
+\key{execute code block at point}{C-c C-c}
+\key{open results of code block at point}{C-c C-o}
+\key{view expanded body of code block at point}{C-c C-v v}
+\key{go to named code block}{C-c C-v g}
+\key{go to named result}{C-c C-v r}
+\key{go to the next code block}{C-c C-v n}
+\key{go to the previous code block}{C-c C-v p}
+\key{execute all code blocks in current buffer}{C-c C-v b}
+\key{execute all code blocks in current subtree}{C-c C-v s}
+\key{tangle code blocks in current file}{C-c C-v t}
+\key{tangle code blocks in supplied file}{C-c C-v f}
+\key{ingest all code blocks in supplied file into the Library of Babel}{C-c C-v l}
+\key{switch to the session of the current code block}{C-c C-v z}
+\key{view sha1 hash of the current code block}{C-c C-v a}
 
 % \section{Remember-mode Integration}
 
@@ -694,6 +707,7 @@ some other place.
 \key{export visible part only}{C-c C-e v}
 \key{insert template of export options}{C-c C-e t}
 \key{toggle fixed width for entry or region}{C-c :}
+\key{toggle pretty display of scripts, entities}{C-c C-x {\tt\char`\\}}
 
 %{\bf HTML formatting}
 
@@ -734,10 +748,8 @@ some other place.
 
 {\bf Comments: Text not being exported}
 
-Text before the first headline is not considered part of the document
-and is therefore never exported.
-Lines starting with \kbd{\#} are comments and are not exported.
-Subtrees whose header starts with COMMENT are never exported.
+Lines starting with \kbd{\#} and subtrees starting with COMMENT are
+never exported.
 
 \key{toggle COMMENT keyword on entry}{C-c ;}
 
@@ -753,8 +765,8 @@ your own key as shown under INSTALLATION.
 $^2$ After changing a \kbd{\#+KEYWORD} or \kbd{<<<target>>>} line,
 press \kbd{C-c C-c} with the cursor still in the line to update.
 
-$^3$ Keybinding affected by {\tt org-support-shift-select} and {\tt
-  org-replace-disputed-keys}.
+$^3$ Keybinding affected by {\tt org-support-shift-select} and
{\tt org-replace-disputed-keys}.
 
 \copyrightnotice
 
diff --git a/etc/tutorials/TUTORIAL.he b/etc/tutorials/TUTORIAL.he
new file mode 100644 (file)
index 0000000..8c37631
--- /dev/null
@@ -0,0 +1,1038 @@
+שיעור ראשון בשימוש ב־Emacs. זכויות שימוש ראה בסוף המסמך.
+
+פקודות רבות של Emacs משתמשות במקש CONTROL (לפעמים הוא מסומן ב־CTRL או CTL)
+או במקש META (לפעמים מסומן EDIT או ALT). במקום לציין את כל השמות האפשריים
+בכל פעם, נשתמש בקיצורים הבאים:
+
+‏<תו>-C  משמעותו לחץ והחזק מקש CONTROL ואז הקש על מקש <תו>.
+         לדוגמא, C-f משמעותו: לחץ והחזק CONTROL והקש על f.
+‏<תו>-M  משמעותו לחץ והחזק מקש META או EDIT או ALT ואז הקש על מקש <תו>.
+         אם במקלדת אין אף אחד ממקשי META או EDIT או ALT, אפשר להקיש
+        ולשחרר מקש ESC ואז להקיש <תו>. אנו נכתוב <ESC> עבור מקש ESC.
+
+הערה חשובה: כדי לצאת מ־Emacs יש להקיש C-x C-c (שני תוים, משמאל לימין).
+כדי להפסיק פקודה באמצע ההקשה, יש להקיש C-g.
+המחרוזת ">>" בקצה הימני מסמנת הוראות עבורכם כדי לנסות להשתמש בפקודה כלשהי.
+לדוגמה:
+<<שורות ריקות תתווספנה סביב השורה הבאה ע"י help-with-tutorial>>
+[אמצע העמוד הושאר ריק למטרות לימודיות. הטקסט ממשיך להלן]
+>>  הקישו עתה C-v (הצג העמוד הבא) על־מנת להתקדם לעמוד הבא. (קדימה, נסו
+    זאת ע"י לחיצה והחזקה של מקש CONTROL והקשה על v.)
+    מעתה והלאה, עליכם לעשות זאת בכל פעם שתסיימו לקרוא את המוצג על המסך.
+
+שימו לב לחפיפה של שתי שורות כאשר אתם עוברים ממסך למשך, מה שמבטיח רציפות
+מסוימת בעת קריאת הטקסט.
+
+דבר ראשון שעליכם ללמוד הוא כיצד לנוע ממקום אחד למשנהו בתוך הטקסט. אתם
+כבר יודעים כיצד להתקדם לעמוד הבא, עם C-v. לחזרה לעמוד הקודם הקישו M-v
+(החזיקו מקש META והקישו v או הקישו ‭<ESC>v‬ אם אין במקלדת מקש META
+או EDIT או ALT).
+
+>>  נסו עתה כמה פעמים להקיש M-v ואחר־כך C-v.
+
+
+* סיכום עד כאן
+--------------
+
+לשם תנועה בעמודים שלמים וצפייה בהם, השתמשו בפקודות הבאות:
+
+       ‏C-v  התקדם לעמוד הבא
+       ‏M-v  חזור לעמוד הקודם
+       ‏C-l  נקה תצוגה והצג מחדש את הטקסט,
+               כך שהטקסט ליד הסמן יימצא במרכז התצוגה
+               (שימו לב: CONTROL-L ולא CONTROL-1.)
+
+>> מצאו את הסמן על־גבי התצוגה וזכרו את הטקסט לידו. לאחר מכן הקישו C-l.
+   מצאו את הסמן שנית ושימו לב שהוא עדיין ליד אותו הטקסט, אבל עכשיו
+   הוא במרכז התצוגה.
+   אם תקישו C-l שוב, קטע הטקסט הזה יזוז לקצה העליון של התצוגה. הקישו
+   C-l שוב והוא יזוז לתחתית התצוגה.
+
+גם מקשי PageUp ו־PageDn, אם הם קיימים במקלדת שלכם, יכולים לשמש לתנועה
+בעמודים שלמים, אולם השימוש ב־C-v ו־M-v יעיל יותר.
+
+* תנועת סמן בסיסית
+------------------
+
+תנועה בעמודים שלמים הינה שימושית, אבל כיצד ניתן להגיע למקום ספציפי
+בתוך הטקסט שעל־גבי התצוגה?
+
+ניתן לעשות זאת בכמה דרכים. אפשר למשל להשתמש במקשי החצים, אולם יהיה
+זה יעיל יותר אם תחזיקו את הידיים מעל החלק הסטנדרטי של המקלדת ותשתמשו
+בפקודות C-p, C-b, C-f ו־C-n. פקודות אלו שוות ערך לארבעת מקשי החצים,
+כדלקמן:
+
+                       שורה קודמת, C-p
+                                :
+                                :
+          קדימה, C-f ... מיקום סמן נוכחי ... אחורה, C-b
+                                :
+                                :
+                       השורה הבאה, C-n
+
+>> השתמשו במקשי C-n ו־C-p על־מנת להגיע לשורה האמצעית של הדיאגרמה.
+   הקישו C-l כדי למרכז את הדיאגרמה על־גבי התצוגה.
+
+קל יותר לזכור את המקשים הללו באמצעות המלים שהם מייצגים:
+P מ־previous (קודם), N מ־Next (הבא), B מ־Backward (אחורה)
+ו־F מ־Forward (קדימה). מקשי התנועה הבסיסיים הללו ישמשו אתכם כל הזמן.
+
+>> הקישו C-n כמה פעמים כדי למקם את הסמן בשורה זו.
+
+>> הניעו את הסמן בתוך השורה עם C-f ואחר־כך למעלה עם C-p.
+   שימו לב מה עושה C-p כאשר הסמן נמצא באמצע השורה.
+
+כל שורה של טקטס מסתיימת בתו מיוחד הנקרא Newline. תו זה מפריד בין
+השורה לזו שאחריה. (בדרך כלל, השורה האחרונה בקובץ תסתיים אף היא
+ב־Newline, אך Emacs אינו זקוק לכך.)
+
+>> נסו C-b בתחילת שורה. הוא יגרום לסמן לנוע לסוף השורה הקודמת. זאת,
+   משום שהוא נע אחורה וחולף על־פני תו ה־Newline.
+
+גם C-f יכול לחלוף על־פני Newline, בדיוק כמו C-b.
+
+>> הקישו C-b עוד כמה פעמים כדי לקבל הרגשה היכן נמצא הסמן.
+   עתה הקישו C-f מספר פעמים הדרוש לשוב לסוף השורה. ואז הקישו
+   C-f עוד פעם אחת כדי לנוע לתחילת השורה הבאה.
+
+כשהסמן יוצא מגבולות הטקסט המוצג, חלקי הטקסט מעבר לחלק המוצג נכנסים
+לתצוגה. לזה קוראים "גלילה". גלילה מאפשרת ל־Emacs להניע את הסמן למקום
+כלשהו בטקסט מבלי שהסמן ייעלם מהתצוגה.
+
+>> נסו להניע את הסמן אל מחוץ לתצוגה ע"י הקשת C-n ושימו לב למה שקורה.
+
+אם תנועה תו־תו איטית מדי, תוכלו לנוע מילים שלמות. M-f ‏(META-f) מזיז
+את הסמן מילה אחת קדימה ואילו M-b זז מילה אחורה.
+
+>> הקישו M-f ו־M-b מספר פעמים.
+
+אם הסמן נמצא באמצע מילה, M-f זז לסוף המילה. אם הסמן נמצא בין שתי מלים,
+M-f עובר את המילה הבאה ונעצר בסופה. M-b פועל באופן דומה בכיוון הפוך.
+
+>> הקישו עתה M-f ו־M-b פעמים אחדות, וגם C-f ו־C-b פה ושם כדי שתוכלו
+   להתרשם מהתוצאה של M-f ו־M-b במקומות שונים בתוך ובין המלים.
+
+שימו לב להקבלה שבין C-f ו־C-b מצד אחד ו־M-f ו־M-b מהצד השני. לעתים
+קרובות מאד מקשים עם META משמשים לפעולות הקשורות ליחידות של שפה (מלים,
+משפטים, פסקאות) ואילו מקשים עם CONTROL פועלים על יחידות בסיסיות שאינן
+תלויות בסוג הטקסט שהינכך עורכים (תוים, שורות, וכד').
+
+ההקבלה הזאת קיימת גם לגבי שורות ומשפטים: C-a ו־C-e נעים לתחילת השורה
+וסופה, בהתאמה, ואילו M-a ו־M-e נעים לתחילת המשפט וסופו.
+
+>> נסו עתה שתי הקשות על C-a ואחר־כך שתי הקשות על C-e.
+   נסו שני M-a ואחר־כך שני M-e.
+
+שימו לב שחזרה על C-a אינה עושה דבר, ואילו כל הקשה חוזרת על M-a מניעה
+את הסמן במשפט נוסף. אמנם אין כאן אנלוגיה מושלמת, אבל התוצאה נראית
+טבעית בשני המקרים.
+
+מקום הסמן בתוך הטקסט נקרא "point" ("נקודה"). במלים אחרות, הסמן מראה
+את מיקומו של "point" בתוך הטקסט.
+
+הנה סיכום של פקודות פשוטות להנעת הסמן, כולל פקודות שנעות במלים
+ומשפטים שלמים:
+
+       ‏C-f  נוע תו אחד קדימה
+       ‏C-b  נוע תו אחד אחורה
+
+       ‏M-f  נוע מילה קדימה
+       ‏M-b  נוע מילה אחורה
+
+       ‏C-n  נוע לשורה הבאה
+       ‏C-p  נוע לשורה הקודמת
+
+       ‏C-a  נוע לתחילת השורה
+       ‏C-e  נוע לסוף השורה
+
+       ‏M-a  נוע קדימה לסוף המשפט
+       ‏M-e  נוע אחורה לתחילת המשפט
+
+>> נסו את כל הפקודות הללו מספר פעמים, לשם תרגול.
+   אלו הן הפקודות הנפוצות ביותר.
+
+שתי פקודות תנועה חשובות אחרת הן ‭M-<‬ ‏(META פחות), אשר נעה לתחילת
+הטקסט, ו־‭M->‬ ‏(META יותר), אשר נעה לסוף הטקסט.
+
+ברוב המקלדות המקש ">" נמצא מעל הפסיק, לכן כדי להקישו יש צורך ללחוץ
+ולהחזיק מקש Shift. באופן דומה יש ללחוץ על Shift כדי להקיש ‭M-<‬כי
+אחרת היה יוצא M-פסיק.
+
+>> נסו עתה ‭M-<‬ כדי להגיע לתחילת השיעור.
+   אחר־כך הקישו C-v מספר פעמים, עד שתגיעו לכאן.
+
+>> עכשיו נסו ‭M->‬ כדי להגיע לסוף השיעור.
+   לאחר מכן הקישו M-v כמה פעמים כדי לחזור לכאן.
+
+ניתן להזיז את הסמן גם בעזרת מקשי החצים, אם הם קיימים במקלדת שלכם.
+אבל אנחנו ממליצים ללמוד להשתמש ב־C-b, C-f, C-n ו־C-p משלוש סיבות.
+קודם כל, הם יעבדו עם כל מקלדת. שנית, כשתתרגלו לעבוד עם Emacs, תראו
+כי השימוש במקשים אלו מהיר יותר מהשימוש בחצים (מכיון שאין צורך להזיז
+את היד מהחלק העיקרי של המקלדת). ושלישית, כשהמקשים הללו יהפכו להרגל,
+יהיה לכם קל יותר ללמוד פקודות מתקדמות יותר של תנועת הסמן.
+
+רוב הפקודות של Emacs מקבלות ארגומנט נומרי; עבור רוב הפקודות הארגומנט
+משמש כמונה של מספר החזרות על הפקודה. כדי לספק ארגומנט לפקודה, יש להקיש
+C-u ואחר־כך ספרות, וזאת לפני שמקישים את הפקודה עצמה. עם במקלדת קיים
+מקש META (או EDIT או ALT), יש גם אפשרות אחרת לציין ארגומנט נומרי:
+הקישו את הספרות תוך כדי החזקת מקש META. אנו ממליצים על C-u משום שהוא
+יעבוד עם כל מקלדת. הארגומנט הנומרי נקרא גם "ארגומנט קידומת" (prefix
+argument) משום מקישים אותו לפני הפקודה אליה הוא מתייחס.
+
+למשל, C-u 8 C-f מניע את הסמן 8 תוים קדימה.
+
+>> נסו להקיש C-n או C-p עם ארגומנט נומרי, כדי להזיז את הסמן אל שורה
+   מסוימת בפקודה אחת בלבד.
+
+רוב הפקודות מפרשות את הארגומנט הנומרי כמונה חזרות, אבל פקודות מסוימות
+משתמשות בו בצורות אחרות. כמה פקודות (אבל אף אחת מבין אלו שלמדנו עד כה)
+משתמשות בו כדגלון -- נוכחותו של הארגומנט, ללא קשר לערכו המספרי, גורמת
+לפקודה להתנהג קצת אחרת.
+
+‏C-v ו־M-v יוצאים מהכלל הזה באופן אחר. כשפקודות אלו מקבלות ארגומנט,
+הן גוללים את התצוגה כמספר הזה של שורות, ולא בדפים. למשל, C-u 8 C-v
+יגלול את התצוגה ב־8 שורות.
+
+>> נסו עתה להקיש C-u 8 C-v.
+
+כתוצאה, התצוגה היתה צריכה לזוז ב־8 שורות. אם ברצונכם לגלול בחזרה,
+אפשר להשיג זאת ע"י מתן ארגומנט ל־M-v.
+
+אם הפעלתם את Emacs על־גבי מערכת חלונאית כגון X או MS-Windows, אתם
+צריכים לראות פס צר וגבוה, ששמו פס גלילה (scroll bar) בצידו של החלון
+של Emacs. (שימו לב שבשני צידי החלון קיימים פסים נוספים. אלה נקראים
+"השוליים" -- "fringes" -- ומשמשים להצגת סימני המשך שורה וסימונים
+אחרים. פס הגלילה, לעומתם, מופיע רק בצד אחד והוא הכי קרוב לקצה החלון
+בצד ההוא.)
+
+>> נסו עתה להקליק בכפתור האמצעי של העכבר בחלק העליון של האזור המודגש
+   של פס הגלילה. פעולה זו אמורה לגלול את הטקסט בשיעור שתלוי במקום בו
+   הקלקתם.
+
+>> נסו לגרור את העכבר מעלה ומטה, תוך כדי לחיצה על הכפתור האמצעי.
+   כתוצאה, Emacs יגלול את הטקסט מעלה ומטה בהתאם לתנועת העכבר.
+
+אם העכבר שלכם מצויד בגלגל, תוכלו להשתמש גם בו לגלילת הטקסט.
+
+* אם Emacs מפסיק להגיב
+----------------------
+
+אם Emacs מפסיק להגיב לפקודות, תוכלו להפסיק אותו בבטחה ע"י הקשת C-g.
+פקודות שביצוען מתארך אף הן ניתנות להפסקה בעזרת C-g.
+
+בנוסף, תגרום הקשת C-g לביטול הארגומנט הנומרי או תחילת הפקודה שטרם
+השלמתם להקיש והתחרטתם.
+
+>> הקישו C-u 100 כדי לציין ארגומנט של 100, ולאחר מכן C-g. עתה הקישו
+   C-f. הוא צריך לנוע תו אחד בלבד, שכן ביטלתם את הארגומנט בעזרת C-g.
+
+אם הקשתם <ESC> בטעות, ניתן לבטלו בעזרת C-g.
+
+* פקודות מנוטרלות
+-----------------
+
+מספר פקודות ב־Emacs מנוטרלות בכוונה כדי שמשתמשים מתחילים לא יפעילו
+אותן בדרך מקרה.
+
+אם תקישו את אחת הפקודות הללו, Emacs יציג הודעה המתארת את הפקודה וישאל
+אם לבצע את הפקודה או לבטלה.
+
+אם אכן בכוונתכם לנסות את הפקודה, הקישו <SPC> (מקש הרווח) בתשובה לשאלה.
+בדרך כלל, אם אינכם מעוניינים לבצע את הפקודה המנוטרלת, הקישו "n" בתשובה
+לשאלה הזו.
+
+* חלונות
+--------
+
+תצוגת Emacs יכולה לכלול יותר מחלון אחד, כשכל אחד מהם מציג טקסט משלו.
+מאוחר יותר נסביר כיצד להשתמש בחלונות מרובים. כעת ברצוננו להסביר כיצד
+להפטר מחלונות מנותרים ולחזור לעריכה בחלון יחיד. אין דבר פשוט מזה:
+
+       ‏C-x 1        חלון אחד בלבד (כלומר, סגור את כל החלונות האחרים).
+
+כדי להפעיל פקודה זו, הקישו CONTROL-x ולאחריו את הספרה 1. הפקודה C-x 1
+מרחיבה את החלון המציג את הסמן כך שהוא תופס את כל שטח התצוגה. הפקודה
+מבטלת את שאר החלונות.
+
+>> הניעו את הסמן לתוך שורה זו והקישו C-u 0 C-l.
+>> עתה הקישו CONTROL-h k CONTROL-f.
+   שימו לב כיצד החלון הנוכחי מצטמצם ומופיע חלון חדש שבו מוצג
+   התיעוד של הפקודה CONTROL-f.
+
+>> הקישו C-x 1 ושימו לב שהחלון עם ההסבר על C-f נעלם.
+
+פקודה זו שונה מכל שאר הפקודות שלמדנו עד כה בכך שהיא מכילה שני תוים.
+היא מתחילה עם התו CONTROL-x. פקודות רבות מאד מתחילות ב־CONTROL-x; חלק
+גדול מהן עוסקות בחלונות, קבצים, חוצצים ונושאים דומים אחרים. פקודות אלו
+מכילות שנים, שלושה ואפילו ארבעה תוים.
+
+
+* הכנסה ומחיקה
+--------------
+
+אם ברצונכם להכניס טקסט, פשוט הקישו על המקשים המתאימים. תוים רגילים,
+כגון A, א, 7, * וכד' מתפרשים ע"י Emacs כטקסט ומיד מתווספים לטקסט
+הקיים. הקישו <Return> (מקש חזרת גרר) כדי להכניס את תו השורה החדשה
+(Newline).
+
+למחיקת התו האחרון שהקשתם הקישו <DelBack>. המקש שאנו קוראים לו <DelBack>
+יכול להתקרא בשמות שונים -- "Delete", "DEL" או "Backspace". בדרך כלל
+זהו מקש גדול ובולט שנמצא לא הרחק ממקש <Return>, והוא משמש אתכם למחיקת
+התו אחרון גם בתוכניות אחרות, לא רק ב־Emacs.
+
+אם קיים במקלדת שלכם מקש גדול שעליו רשום <Backspace>, אז זהון המקש אשר
+ישמש כ־<DelBack>. גם אם יהיה מקש אחר המסומן ב־"Delete" במקום אחרת זה
+אינו ה־<DelBack> שלכם.
+
+באופן כללי יותר, <DelBack> מוחק את התו שקודם למיקום הסמן.
+
+>> הקישו עתה מספר תוים, ואחר־כך מחקו אותם ע"י הקשות אחדות
+   על <DelBack>. אל תחששו לשנות את הקובץ הזה -- העותק המקורי
+   של השיעור יישאר ללא שינוי. אתם עובדים על העותק האישי שלכם.
+
+כאשר שורה של טקסט נעשית ארוכה משורה אחת של תצוגה, חלק מהטקסט ממשיך
+בשורת תצוגה נוספת, היא "שורת ההמשך". תו לוכסן ("/") בסוף השורה (או
+חץ עקלקל קטן באזור השוליים -- "fringe") מסמל שלשורה יש שורת המשך.
+
+>> הקישו טקסט עד שתגיעו לקצה השורה, ואז תמשיכו להקיש עוד טקסט.
+   כתוצאה, תראו שמופיעה שורת המשך.
+
+>> עתה הקישו <DelBack> על־מנת למחוק טקסט עד שהשורה תיעשה קצרה מספיק
+   ותתאים לשורה בודדת על־גבי התצוגה. שורת ההמשך תיעלם.
+
+ניתן למחוק את תו ה־Newline כמו כל תו אחר. מחיקת ה־Newline בין שתי
+שורות תמזג את השורות לשורה אחת. אם השורה המשולבת תהיה ארוכה מרוחב
+התצוגה, היא תוצג עם שורת המשך.
+
+>> הניעו את הסמן לתחילת השורה והקישו <DelBack>. כתוצאה, השורה תתמזג
+   אם קודמתה.
+
+>> עתה הקישו <Return> כדי להחזיר את ה־Newline שמחקתם.
+
+זכרו כי לרוב הפקודות ב־Emacs אפשר לציין מספר חזרות. גם תוי טקסט
+שייכים לקבוצת פקודות זו. חזרה על תו טקסט מכניסה אותו מספר פעמים.
+
+>> נסו זאת עכשיו -- הקישו ‪C-u 8 *‬ על־מנת להכניס ********.
+
+ובכן, למדתם את האופן הבסיסי ביותר להדפיס משהו ב־Emacs ולתקן שגיאות.
+אפשר למחוק גם מלים ואף שורות שלמות. להלן סיכום פקודות המחיקה:
+
+       ‏<Delback>    מחק תו שלפני הסמן
+       ‏C-d          מחק תו מתחת או אחרי הסמן
+
+       ‏‭M-<Delback>‬  גזור מילה שלפני הסמן
+       ‏M-d          גזור מילה שאחרי הסמן
+
+       ‏C-k          גזור טקסט מהסמן ועד סוף השורה
+       ‏M-k          גזור טקסט עד סוף המשפט הנוכחי.
+
+שימו לב שהיחס בין <Delback> ו־C-d לעומת M-<Delback>‎ ו־M-d ממשיכים את
+ההקבלה שבין C-f ו־M-f (אמנם <Delback> איננו תו בקרה, בוא נזניח את
+הנקודה הזו לעת־עתה). C-k ו־M-k דומים ל־C-e ו־M-e, אם נקביל שורות
+למשפטים.
+
+בנוסף, קיימת שיטה אחידה שמאפשרת לגזור קטע כלשהו של טקסט. לשם כך, תגיעו
+לקצה האחד של חלק הטקסט והקישו C-@‎ או C-<SPC>‎ (אחד מבין שני אלו).
+(<SPC> הוא מקש הרווח.) עתה הניעו את הסמן לקצה השני של חלק הטקסט והקישו
+C-w. כתוצאה, כל הטקסט בין שני המקומות הללו ייגזר.
+
+>> הניעו את הסמן אל האות ב בתחילת הפיסקה הקודמת.
+>> הקישו C-<SPC>‎. ‏Emacs צריך להציג הודעה האומרת "Mark set" בתחתית
+   התצוגה.
+>> הניעו את הסמן אל האות צ בשורה השניה של הפיסקה.
+>> הקישו C-w. בכך תגזרו את חלק הטקסט שמתחיל ב־ב ומסתיים לפני ה־צ.
+
+ההבדל בין "מחיקה" ("deletion") ו־"גזירה" ("killing") הוא שהטקסט
+"הגזור" ניתן לאחזור ולהכנסה (במקום כלשהוא בטקסט), ואילו טקסט "מחוק" לא
+ניתן להכניס מחדש בשיטה זו. (אבל ניתן לבטל את מחיקה -- ראה להלן.) אחזור
+הטקסט הגזור נקרא "הדבקה" ("yanking"). באופן כללי, פקודות אשר עלולות
+להעלים כמויות גדולות של טקסט תמיד גוזרות את הטקסט (כך שניתן יהיה בקלות
+לשחזרו) בעוד הפקודות שמורידות תו בודד או שורות ריקות ותוי רווח --
+מוחקות (כך שלא ניתן להדביק את הטקסט שנמחק). כך, <Delback> ו־C-d מוחקים
+כאשר מפעילים אותם ללא ארגומנט, אבל גוזרים כאשר מפעילים אותם עם ארגומנט.
+
+>> הניעו את הסמן לתחילת שורה שאינה ריקה. אחר־כך הקישו C-k כדי לגזור
+   את כל הטקסט של אותה שורה.
+>> הקישו C-k פעם נוספת. שימו לב שהוא גוזר את ה־Newline שבסוף השורה.
+
+שימו לב ש־C-k בודד גוזר את תכולת השורה, ו־C-k נוסף גוזר גם את השורה
+עצמה וגורם לשאר השורות לנוע כלפי מעלה. C-k מפרש את הארגומנט הנומרי
+באופן מיוחד: הוא גוזר כמספר הזה שורות, כולל ה־Newlines שלהן. זה שונה
+מסתם הפעלה חוזרת: C-u 2 C-k גוזר שתי שורות כולל ה־Newlines שלהן,
+ואילו הקשה על C-k פעמיים לא עושה כן.
+
+אחזור הטקסט שגזרנו נקרא "הדבקה" ("yanking"). (תחשבו על זה כעל שליפה
+של טקסט מתהום הנשייה אליה הוא נלקח.) ניתן להדביק את הטקסט שגזרתם
+באותו מקום ממנו נגזר או במקום אחר כלשהו בתוך הטקסט שאתם עורכים, או
+אפילו בקובץ אחר. ניתן להדביק את אותו הטקסט מספר פעמים ובכך ליצור
+עותקים מרובים ממנו. תוכניות עריכה אחרות משתמשות במונחים "cutting"
+ו־"pasting" במקום "killing" ו־"yanking" (ראה את מילון המונחים בפרק
+ה־"Glossary" של מדריך למשתמשי Emacs).
+
+הפקודה להדבקה היא C-y. היא מכניסה את הטקסט הגזור במקום הנוכחי של הסמן.
+
+>> נסו זאת: הקישו C-y כדי לאחזר טקסט שגזרתם קודם לכן.
+
+אם תקישו C-k מספר פעמים ברצף, כל הטקסט שגזרתם בדרך זו נשמר ביחד, כך
+ש־C-y בודד ידביק את כולו בבת אחת.
+
+>> עשו זאת עתה: הקישו C-k כמה פעמים.
+
+עכשיו לאחזור הטקסט שגזרתם:
+
+>> הקישו C-y. אחר־כך הניעו את הסמן כמה שורות כלפי מטה והקישו C-y שוב.
+   כפי שראיתם, כך תוכלו להעתיק חלק מהטקסט ממקום למקום.
+
+מה לעשות אם יש לכם טקסט להדבקה, אבל בינתיים גזרתם טקסט אחר? C-y ידביק
+רק את הגזירה האחרונה. אולם הטקסט שגזרתם קודם לכן אינו הלך לאיבוד. ניתן
+לאחזרו בעזרת הפקודה M-y. אחרי שהקשתם C-y שמדביק את הטקסט שגזרתם
+לאחרונה, הקשה על M-y מחליפה את הטקסט המודבק בטקסט שגזרתם בפעם לפני
+האחרונה. הקשה חוזרת ונשנית על M-y מביאה טקסט שגזרתם בפעמים קודמות יותר
+ויותר. כשתראו שהטקסט המודבק הוא מה שרציתם להדביק, תפסיקו להקיש M-y
+ותמשיכו בעריכה כרגיל. אין צורך בשום פקודה מיוחדת לשם כך.
+
+אם תקישו M-y מספיק פעמים בזו אחר זו, תגיעו חזרה לנקודת ההתחלה (טקסט
+שגזרתם לאחרונה).
+
+>> גזרו שורה, אחר־כך תניעו את הסמן אנה ואנה, ולבסוף גזרו שורה נוספת.
+   הקישו C-y כדי לאחזר את השורה השניה שגזרתם.
+   עתה הקישו M-y והשורה שאחזרתם תוחלף בשורה הראשונה שגזרתם.
+   הקישו M-y מספר פעמים נוספות ושימו לב לתוצאות. המשיכו להקיש M-y
+   עד שהשורה השניה שגזרתם תופיע שוב, ואז תמשיכו עוד מספר פעמים.
+   אם תרצו, תוכלו לנסות M-y עם ארגומנט חיובי או שלילי.
+
+
+* ביטול פעולות
+--------------
+
+אם שיניתם את הטקסט ואז החלטתם שהשינוי היה טעות, תוכלו לבטל את השינוי
+בעזרת פקודת הביטול, C-x u.
+
+בדרך כלל, C-x u מבטל את השינויים שבוצעו ע"י פקודה אחת. הפעלה חוזרת של
+C-x u ברצף מבטלת שינויים של פקודות קודמות, אחת אחרי השניה.
+
+שני יוצאים מהכלל הזה: פקודות שאינן משנות טקסט (למשל פקודות הנעת הסמן
+ופקודות גלילה) אינן נספרות ותוים שמכניסים את עצמם מקובצים בקבוצות של
+עד 20, כדי להקטין את מספר הפעמים שיש להקיש C-x u כדי לבטל הכנסת טקסט.
+
+>> גזרו שורה זו עם C-k, אחר־כך הקישו C-x u והיא תופיע שוב.
+
+‏C-_‎ הינה דרך חלופית להפעיל את פקודת הביטול. היא פועלת בדיוק כמו C-x u,
+אבל קלה יותר להקשה מספר פעמים בזו אחר זו. החסרון של C-_‎ הוא שבכמה
+מקלדות לא ברור מאליו כיצד להקיש זאת. זו הסיבה לקיומו של C-x u. במקלדות
+אחדות ניתן להקיש C-_‎ ע"י החזקת CONTROL והקשת לוכסן /.
+
+ארגומנט נומרי ל־C-_‎ או ל־C-x u משמש כמספר החזרות על הפקודה.
+
+ניתן לבטל מחיקה של טקסט בדיוק כמו שניתן לבטל גזירה. ההבדלים בין מחיקה
+וגזירה משפיעים על יכולתכם להדביק את הטקסט הגזור עם C-y; הם אינם חשובים
+לעניין הביטול.
+
+
+* קבצים
+-------
+
+על־מנת שהטקסט שערכתם יישמר, יש לשים אותו בקובץ. אחרת, הוא ייעלם ברגע
+שתצאו מ־Emacs. כדי לשים את הטקס בקובץ, יש "לפתוח" ("find") את הקובץ
+לפני שמתחילים להקיש טקסט. (שם אחר לכך הוא "לפקוד" את הקובץ - "visit".)
+
+פתיחת הקובץ משמעותה שתוכן הקובץ מוצג בתוך Emacs. מבחינות רבות הדבר
+דומה לעריכת הקובץ עצמו. אולם, השוניים שלכם בתוך Emacs אינם הופכים חלק
+מהקובץ עד שאתם "שומרים" את הקובץ. זאת, כדי להימנע מיצירת קובץ שאינו
+שלם במערכת שלא כרצונכם. אפילו אם אתם שומרים את הקובץ, Emacs משאיר את
+התוכן המקורי בשם שונה למקרה שמאוחר יותר תחליטו שהשינויים נעשו בטעות.
+
+אם תביטו בחלק התחתון של התצוגה, תראו שם שורה בולטת שמתחילה ומסתיימת
+במקפים וליד הקצה השמאלי שלה כתוב "TUTORIAL.he". חלק זה של התצוגה בדרך
+כלל מציג את שם הקובץ אותו אתם פוקדים. כרגע אתם פוקדים קובץ בשם
+"TUTORIAL.he" שהוא עותק הטיוטה האישי שלכם של שיעור השימוש ב־Emacs.
+פתיחת קובץ כלשהו ב־Emacs תציג את שמו של הקובץ במקום זה.
+
+היבט אחד מיוחד של פתיחת קובץ הוא שיש לציין את שם הקובץ אשר ברצונכם
+לפתוח. אנו אומרים שהפקודה "קוראת ארגומנט מהמסוף" (במקרה זה הארגומנט
+הוא שם הקובץ). אחרי שתקישו את הפקודה
+
+       ‏C-x C-f    פתח קובץ
+
+‏Emacs מבקש שתקישו את שם הקובץ. שם הקובץ שתקישו מופיע בשורה התחתונה של
+התצוגה. שורה זו נקראת "מיני־חוצץ" ("minibuffer") כשהיא משמשת לסוג זה
+של קלט. ניתן להשתמש בכל פקודות העריכה הרגילות של Emacs כשמקישים את
+שם הקובץ בחוצץ זה.
+
+אם טרם סיימתם להקיש את שם הקובץ (או כל סוג אחר של קלט במיני־חוצץ),
+ניתן לבטל את הפקודה בעזרת C-g.
+
+>> הקישו C-x C-f ואחר־כך הקישו C-g. זה מבטל את המיני־חוצץ וגם מבטל
+   את הפקודה C-x C-f שהשתמשה במיני־חוצץ. התוצאה היא שאף קובץ לא נפתח.
+
+משסיימתם להקיש את שם הקובץ, הקישו <Return> לסיים את הקלט. או־אז תיגש
+C-x C-f לעבודה ותמצא ותפתח את הקובץ שבחרתם. המיני־חוצץ נעלם כאשר
+פקודת ה־C-x C-f תסיים את עבודתה.
+
+זמן קצר אחר־כך תוכן הקובץ יופיע על־גבי התצוגה ותוכלו לבצע בו שינויים.
+כשתחליטו לשמור את השינויים, הקישו את הפקודה הבאה:
+
+       ‏C-x C-s    שמור את הקובץ
+
+פקודה זו שומרת בקובץ את הטקסט המוחזק בתוך Emacs. בפעם הראשונה שתפעילו
+פקודה זו, Emacs משנה את שם הקובץ המקורי לשם חדש כך שהמקור לא ילך
+לאיבוד. השם החדש נוצר ע"י הוספת "~" בסוף השם המקורי של הקובץ.
+
+כשהשמירה מסתיימת, Emacs מציג בשורה התחתונה את שם הקובץ שנשמר. נסו
+לשמור לעתים מזומנות על־מנת להימנע מלאבד יותר מדי מהעבודה שלכם אם המחשב
+ייפול (ראה להלן פיסקה על שמירה אוטומטית).
+
+>> הקישו C-x C-s כדי לשמור את העותק שלכם של השיעור.
+   כתוצאה, תופיע ההודעה "Wrote ... TUTORIAL.he" בתחתית התצוגה.
+
+ניתן לפתוח קובץ קיים על־מנת לצפות בו או לערוך אותו. ניתן גם לפתוח קובץ
+שאינו קיים. זו הדרך ליצור קבצים חדשים בעזרת Emacs: פתחו את הקובץ
+שיהיה תחילה ריק ואז התחילו להקיש טקסט לתוכו. כשתפעילו את פקודת השמירה,
+Emacs ייצור את הקובץ עם הטקסט שהקשתם. מאותו רגע ואילך, תוכלו לחשוב
+שהינכם עורכים קובץ קיים.
+
+
+* חוצצים
+--------
+
+אם תפתחו קובץ נוסף עם C-x C-f, הקובץ הראשון עדיין נשאר פתוח ב־Emacs.
+תוכלו לחזור אליו ע"י C-x C-f. כך תוכלו לפתוח מספר רב של קבצים.
+
+>> ניצור עתה קובץ בשם "foo" ע"י הקשת C-x C-f foo <Return>‎.
+   אחר־כך הכניסו קצת טקסט, ערכו אותו ולבסוף שמרו בקובץ "foo"
+   ע"י C-x C-s. עתה חזרו לשיעור בעזרת C-x C-f TUTORIAL.he <Return>‎.
+
+‏Emacs מחזיק כל קובץ בתוך יישות בשם "חוצץ" ("buffer"). פתיחת קובץ יוצרת
+חוצץ חדש בתוך Emacs. כדי לראות את רשימת החוצצים הקיימים בתוך Emacs,
+הקישו
+
+       ‏C-x C-b    הצג רשימת כל החוצצים
+
+>> נסו את C-x C-b בנקודה זו.
+
+שימו לב שלכל חוצץ יש שם וכל חוצץ עשוי גם לציין את שם הקובץ שאת תוכנו
+הוא מחזיק. כל טקסט שאתם מקישים בחלון Emacs תמיד יהיה חלק של חוצץ
+כלשהו.
+
+>> הקישו C-x 1 כדי להפטר מרשימת החוצצים.
+
+כשקיימים מספר חוצצים, רק אחד מהם יכול להיות החוצץ "הנוכחי" בכל רגע
+נתון. זהו החוצץ בו אתם מבצעים עריכה באותו רגע. אם ברצונכם לערוך חוצץ
+אחר, עליכם "לעבור" חוצץ. עבור חוצצים שמתאימים לקבצים, ניתן לעשות זאת
+ע"י C-x C-f שיפקוד את הקובץ בשנית. אבל קיימת דרך פשוטה יותר: שימוש
+בפקודה C-x b. פקודה זו תחייב אותכם להקיש את שם החוצץ.
+
+>> הקישו C-x b foo <Return>‎ כדי לחזור לחוצץ "foo" אשר מחזיק טקסט של
+   הקובץ "foo". אחר־כך הקישו C-x b TUTORIAL.he <Return>‎ כדי לשוב
+   לשיעור זה.
+
+ברוב המקרים שם החוצץ זהה לשם הקובץ (ללא שם התיקיה שלו). אבל אין זה
+תמיד כך. רשימת החוצצים שנוצרת ע"י C-x C-b תמיד תציג את שמות כל החוצצים
+הקיימים ב־Emacs.
+
+כל טקסט שמוצג בחלון של Emacs הינו תמיד חלק של חוצץ כלשהו. קיימים
+חוצצים שאינם קשורים לשום קובץ. לדוגמא, החוצץ בשם "*Buffer List*" אינו
+מציג שום קובץ. זהו חוצץ המחזיק את רשימת החוצצים שנוצר ע"י C-x C-b.
+חוצץ בשם "*Messages*" אף הוא אינו קשור לשום קובץ; הוא מחזיק את ההודעות
+שהופיעו בשורה התחתונה במהלך עבודתכם בתוך Emacs.
+
+>> הקישו C-x b *Messages* <Return>‎ כדי לצפות בחוצץ של הודעות.
+   אחר־כך הקישו C-x b TUTORIAL.he <Return>‎ על־מנת לחזור לשיעור זה.
+
+אם עשיתם שינויים בטקסט של קובץ ואחר־כך פתחתם קובץ אחר, אין הדבר שומר
+את השינויים שעשיתם לקובץ הראשון. השינויים הללו נשארים בתוך Emacs, בתוך
+החוצץ של אותו קובץ. יצירתו ועריכתו של הקובץ הנוסף אינם משפיעים על
+החוצץ של הקובץ הראשון. דבר זה הוא שימושי, אך משמעותו היא שיש צורך
+בשיטה נוחה לשמור את החוצץ של הקובץ הראשון. היה זה מאד לא נוח אילו
+לשם כך הייתם צריכים לעבור לחוצץ ההוא בעזרת C-x C-f ואז לשמור עם
+C-x C-s. לכן קיימת פקודה
+
+       ‏C-x s     שמור חוצצים אחדים
+
+‏C-x s עובר על כל החוצצים אשר מכילים שינויים שטרם נשמרו. לגבי כל חוצץ
+כזה הוא שואל אתכם האם לשמור אותו או לא.
+
+>> הכניסו שורה של טקסט ואחר־כך הקישו C-x s.
+   הוא צריך לשאול האם לשמור חוצץ בשם TUTORIAL.he.
+   השיבו בחיוב ע"י הקשה על "y".
+
+
+* הרחבת אוסף הפקודות
+--------------------
+
+מספר הפקודות ב־Emacs גדול בהרבה ממה שניתן להפעיל ע"י כל תוי ה־control
+וה־meta. כדי להתגבר על בעיה זו, Emacs משתמש בפקודות X המרחיבות (eXtend)
+את אוסף הפקודות הרגיל. פקודות הרחבה אלו הן שתים:
+
+       ‏C-x     הרחבת תו. תו בודד שבא אחריו משלים את הפקודה.
+       ‏M-x     הרחבה ע"י שם הפקודה. אחריו בא שם ארוך של פקודה.
+
+בעזרת שתי אלו ניתן להפעיל פקודות שימושיות שבהן משתמשים לעתים רחוקות
+יותר מאשר פקודות שלמדתם עד עכשיו. כמה מהן כבר ראיתם: C-x C-f לפתיחת
+קובץ, ו־C-x C-s לשמירת קובץ, לדוגמא. דוגמא נוספת היא פקודה לצאת
+מ־Emacs -- ‏C-x C-c. (כשאתם מפעילים C-x C-c, אל תדאגו לשינויים שטרם
+נשמרו; C-x C-c מציע לשמור כל קובץ ששיניתם לפני שהוא מסיים את Emacs.)
+
+אם אתם משתמשים בצג גרפי אשר תומך במספר תוכניות במקביל, אינכם זקוקים
+לפקודה מיוחדת כדי לעבור מ־Emacs לתוכנית אחרת. אפשר לעשות זאת בעזרת
+העכבר או פקודות של מנהל החלונות. אולם, כאשר אתם משתמשים בתצוגה
+טקסטואלית שמסוגלת להציג רק תוכנית אחת בו־זמנית, תצטרכו "להשעות"
+("suspend") את Emacs על־מנת לעבור לתוכנית אחרת.
+
+הפקודה C-z יוצאת מ־Emacs *באופן זמני* -- כך שתוכלו לשוב אליו מאוחר
+יותר ולהמשיך מאותה נקודה. כאשר Emacs רץ על תצוגת טקסט, C-z "משעה" את
+Emacs: הוא מחזיר אתכם לשורת הפקודות הבסיסית של מערכת ההפעלה ("shell"),
+אבל אינו מסיים את Emacs. ברוב המערכות, כדי להמשיך בעבודתכם ב־Emacs,
+תצטרכו להקיש את הפקודה "fg" או ‭"%emacs"‬.
+
+הרגע הנכון להשתמש ב־C-x C-c הוא כאשר אתם עומדים להתנתק (log out).
+כמו־כן, תצטרכו להשתמש בו כדי לצאת מ־Emacs שהופעל ע"י תוכניות אחרות
+כגון קריאת דואר אלקטרוני -- תוכניות אלו לא תמיד יודעות להסתדר עם
+השעיית Emacs.
+
+קיימות פקודות C-x רבות מאד. להלן רשימת אלו שכבר למדתם:
+
+       ‏C-x C-f      פתח קובץ
+       ‏C-x C-s      שמור קובץ
+       ‏C-x s        שמור חוצצים אחדים
+       ‏C-x C-b      הצג רשימת חוצצים
+       ‏C-x b        החלף חוצץ
+       ‏C-x C-c      צא מ־Emacs
+       ‏C-x 1        השאר רק חלון אחד ומחק כל השאר
+       ‏C-x u        בטל פקודה אחרונה
+
+הרחבה ע"י שם הפקודה שימושית עם פקודות עוד יותר נדירות או פקודות
+ספציפיות רק לאופני פעולה (modes) מיוחדים. דוגמא לכך היא פקודה
+replace-string (החלף מחרוזת) אשר מחליפה מחרוזת אחת במשנה בכל החוצץ.
+אחרי שתקישו M-x, ‏Emacs מציג M-x בתחתית התצוגה ומחכה שתקישו את שם
+הפקודה, במקרה זה "replace-string". מספיק שתקישו "repl s<TAB>‎" ו־Emacs
+ישלים את השם המלא. (<TAB> הוא מקש Tab, בדרך כלל תמצאו אותו מעל מקש
+ה־CapsLock או Shift, ליד הקצה השמאלי של המקלדת.) סיימו את שם הפקודה
+ע"י הקשת <Return>.
+
+הפקודה להחלפת מחרוזת זקוקה לשני ארגומנטים -- המחרוזת שתוחלף וזו שתחליף
+אותה. סיימו הקשה של כל אחת מהן ע"י <Return>.
+
+>> הביאו את הסמן שתי שורות מתחת לשורה זו.
+   עתה הקישו M-x repl s<Return>changed<Return>altered<Return>‎.
+
+   שימו לב שהמילה "changed" בשורה זו שתנתה: זה עתה החלפתם את
+   המילה c-h-a-n-g-e-d במילה "altered" בכל מקום בו היא נמצאת אחרי
+   הסמן.
+
+
+* שמירה אוטומטית
+----------------
+
+שינויים שערכתם בקובץ אבל טרם שמרתם עלולים ללכת לאיבוד אם המחשב שלכם
+נתקע. על־מנת להגן עליכם מפני סכנה זו, Emacs שומר לעתים מזומנות כל קובץ
+שנמצא בעריכה. השמירה האוטומטית הזאת נעשית לקובץ נפרד ששמו מתחיל
+ומסתיים בתו #. לדוגמא, אם הינכם עורכים קובץ בשם "hello.c", קובץ השמירה
+האוטומטית שיווצר עבורו ייקרא "#hello.c#". שמירה רגילה של הקובץ על ידכם
+מוחקת את קובץ השמירה האוטומטית.
+
+אם המחשב אכן נתקע, תוכלו לנציל את השינויים שלא הספקתם לשמור. לשם כך,
+יש לפתוח את הקובץ כרגיל (את הקובץ בשמו המקורי, לא את קובץ השמירה
+האוטומטית), ואחר־כך להקיש M-x recover-file <Return>‎. כש־Emacs יבקש
+אישור, הקישו yes<Return>‎ כדי ש־Emacs ישחזר את הקובץ כפי שנשמר
+אוטומטית.
+
+
+* תצוגת הד
+----------
+
+אם Emacs מגלה שאתם מקישים פקודה לאט, הוא מציג את שהקשתם בתחתית התצוגה,
+באזור שנקרא "אזור תצוגת הד". אזור זה משתמש בשורה התחתונה של התצוגה.
+
+
+* שורת סטטוס
+------------
+
+השורה שמעל אזור תצוגת הד נקראת "שורת הסטטוס" (mode line). שורה זו
+מציגה משהו כמו:
+
+    -U:**-  TUTORIAL.he    63% L651    (Fundamental)-----------------------
+
+שורה זו מציגה מידע חשוב לגבי מצבו של Emacs ולגבי הטקסט שנמצא בעריכה.
+
+אתם כבר יודעים מהי משמעותו של שם הקובץ -- זהו הקובץ שפתחתם. NN%‎ מציין
+את מיקומכם הנוכחי בתוך הטקסט, לאמור כי NN אחוזים מהטקסט קודמים לטקסט
+המוצג כרגע בחלון. אם המוצג בחלון כולל את תחילת הטקסט, תראו שם "Top"
+במקום "0% ". אם המוצג בחלון כולל את סוף הטקסט, תראו שם "Bot" ‏(bottom).
+אם הטקסט כל־כך קצר שכולו מוצג בחלון, שורת הסטטוס תציג "All".
+
+האות L והמספר שאחריה מציינים את המיקום הנוכחי בדרך אחרת: הם מראים את
+מספר השורה שבה נמצא הסמן.
+
+הכוכביות ליד הקצה השמאלי משמעותן כי שיניתם את הטקסט. מיד אחרי פתיחת
+הקובץ או אחרי שמירתו החלק הזה של שורת הסטטוס אינו מציג כוכביות, אלא רק
+מקפים.
+
+החלק שבתוך הסוגריים אומר לכם מהo אופני העריכה (editing modes) הפעילים
+כעת. ברירת המחדל היא Fundamental, האופן הבסיס, שבו אתם משתמשים כעת.
+זוהי דוגמא של "אופן עריכה ראשי" (major mode).
+
+ל־Emacs אופני עריכה ראשיים רבים ומגוונים. חלק מהם נועדו לעריכה של שפת
+תכנות מסוימת ו/או סוג מסוים של טקסט, כגון Lisp mode, Text mode וכד'.
+בכל רגע נתון רק אופן עיקרי אחד יכול להיות פעיל ושמו תמיד מצויין בשורת
+הסטטוס באותו מקום בו כרגע אתם רואים "Fundamental".
+
+כל אופן עיקרי גורם לכמה פקודות לפעול בצורה מיוחדת. למשל, ישנן פקודות
+ליצירת הערות בתוך תוכנית, והיות וכל שפת תכנות מגדירה את הפורמט של
+הערות בצורה אחרת, כל אופן עיקרי חייב להכניס הערות בצורה שמתאימה לשפה.
+כל אופן עיקרי הינו למעשה שם הפקודה שבעזרתה אפשר להפעיל את אותו האופן.
+למשל הפקודה להפעיל את האופן Fundamental הינה M-x fundamental-mode.
+
+אם בכוונתכם לערוך טקסט בשפה אנושית כלשהי, כמו הקובץ הזה, כדאי לכם
+להשתמש ב־Text mode.
+
+>> הקישו M-x text-mode <Return>‎.
+
+אל דאגה: אף אחת מפקודות Emacs שלמדתם עד כה משנה את התנהגותה באופן
+מהותי. עם זאת, שימו לב ש־M-f ו־M-b מתייחסים עכשיו ל־'גרש' כחלק מהמילה.
+לפני־כן, ב־Fundamental mode, ‏M-f ו־M-b התנהגו עם הגרש כמפריד בין
+מילים.
+
+אופנים ראשיים בדרך־כלל משנים קלות את התנהגות הפקודות: רוב הפקודות
+עדיין "עושות אותה עבודה" בכל האופנים הראשיים, אבל עושות אותה קצת אחרת.
+
+לצפיה בתיעוד של האופן הראשי הנוכחי יש להקיש C-h m.
+
+>> השתמשו ב־C-u C-v פעם אחת או יותר כדי להביא שורה זו לראשית התצוגה.
+>> עתה הקישו C-h m כדי לראות במה Text mode שונה מה־Fundamental mode.
+>> לבסוף, הקישו C-x 1 כדי לסלק את התיעוד מהתצוגה.
+
+אופנים ראשיים נקראים כך משום שקיימים גם אופני־משנה (minor modes).
+אופני משנה אינם מהווים חלופה לאופנים הראשיים, הם רק משנים אותם במקצת.
+כל אופן־משנה ניתן להפעלה או ביטול ללא תלות בכל שאר אופני המשנה וללא
+תלות באופן הראשי הנוכחי. לכן תוכלו להפעיל אופן־משנה אחד או יותר, או אף
+אופן־משנה.
+
+אחד מאופני־המשנה השימושיים ביותר, במיוחד לשם עריכת טקס בשפת־אנוש, הוא
+Auto Fill mode. כאשר אופן זה מופעל, Emacs אוטומטית פותח שורה חדשה
+בסיום מילה אם הטקסט שהקשתם ארוך מדי בשביל שורה אחת.
+
+להפעלת Auto Fill mode יש להקיש M-x auto-fill-mode <Return>‎. כאשר אופן
+זה מופעל, ניתן לבטלו ע"י M-x auto-fill-mode <Return>‎. זאת אומרת, פקודה
+זו מפעילה את האופן כשאינו פעיל ומבטלת אותו כשהוא פעיל. לפעולה זו
+קוראים "מיתוג" -- הפקודה "ממתגת" את האופן.
+
+>> הקישו עתה M-x auto-fill-mode <Return>‎. אחר־כך הקישו "שדגכ " (עם
+   הרווח בסוף) שוב ושוב עד שתיפתח שורה חדשה. הרווחים חשובים משום
+   ש־Auto Fill mode שובר שורות אך ורק ברווח שבין המלים.
+
+השוליים (margin) ש־Emacs שומר בדרך־כלל מתחילים אחרי 70 תווים, אבל ניתן
+לשנות הגדרה זו בעזרת הפקודה C-x f. פקודה זו מקבלת את ההגדרה החדשה של
+השוליים כארגומנט נומרי.
+
+>> הקישו C-x f עם ארגומנט של 20. (C-u 2 0 C-x f). אחר־כך הקישו טקסט
+   כלשהו ושימו לב ש־Emacs פותח שורות חדשות אחרי 20 תווים לכל היותר.
+   לבסוף, החזירו את הגדרת השוליים ל־70 ע"י שימוש חוזר ב־C-x f.
+
+אם ערכתם שינויים באמצע פסקה, Auto Fill mode לא ימלא שורות מחדש באופן
+אוטומטי.
+כדי למלא מחדש את כל הפסקה הקישו M-q ‏(META-q) כשהסמן נמצא בתוך
+הפסקה.
+
+>> הניעו את הסמן לתוך הפסקה הקודמת והקישו M-q.
+
+
+* חיפוש
+-------
+
+‏Emacs יכול לחפש מחרוזות (רצף של תווים או מילים) קדימה או אחורה בתוך
+הטקסט. חיפוש של מחרוזת הוא סוג של פקודה להנעת הסמן: הוא ממקם את הסמן
+היכן שנמצאה המחרוזת הבאה.
+
+החיפוש של Emacs הינו "מצטבר" ("incremental"). פירוש הדבר הוא שהחיפוש
+מתבצע במקביל להקשתכם את המחרוזת אותה ברצונכם למצוא.
+
+הפקודה להתחיל בחיפוש היא C-s לחיפוש קדימה ו־C-r לחיפוש אחורה. חכו! אל
+תפעילו אותן עדיין.
+
+כשתקישו C-s, תראו שבאזור תצוגת ההד יופיע הטקסט "I-search". זה אומר
+ש־Emacs נמצא במצב "חיפוש מצטבר" ("incremental search") והוא ממתין
+להקשתכם את המחרוזת אותה ברצונכם למצוא. הקשה על <Return> מסיימת את
+החיפוש.
+
+>> הקישו עתה C-s כדי להתחיל בחיפוש. לאט־לאט, אות־אות, הקישו את המילה
+   "סמן", עם הפסקה אחרי כל אות, ושימו לב להתנהגות הסמן.
+   זה עתה מצאתם את המילה "סמן" פעם אחת.
+>> הקישו C-s שוב, כדי למצוא את "סמן" במקומות נוספים בטקסט.
+>> הקישו <Delback> שלוש פעמים ושימו לב לתנועת הסמן בכל הקשה.
+>> הקישו <Return> לסיום החיפוש.
+
+האם שמתם לב למה שקרה? במהלך "חיפוש מצטבר" Emacs מנסה למצוא את המקום
+הבא בו מופיעה המחרוזת שהקשתם. כדי למצוא את המחרוזת במקום הבא, פשוט
+הקישו C-s פעם נוספת. אם המחרוזת אינה נמצאת בהמשך הטקסט, Emacs מצפצף
+ומודיע שהחיפוש נכנס למצב של "כשלון" ("failing"). הקשה על C-g גם היא
+מסיימת את החיפוש.
+
+(הערה: במערכות אחדות הקשה על C-s מקפיעה את תצוגת המסך, כך שלא תראו
+יותר שום פלט של Emacs. משמעות הדבר שתכונת מערכת ההפעלה ששמה "flow
+control" מופעלת ע"י C-s ואינה מעבירה את C-s ל־Emacs. לביטול הקפאת
+התצוגה במערכות אלו יש להקיש C-q.)
+
+אם במהלך החיפוש תקישו על <Delback>, תראו שהתו האחרון של המחרוזת
+המבוקשת נמחק והחיפוש חוזר למקום הקודם בו נמצאה המחרוזת ללא התו האחרון.
+למשל, נניח שהקשתם "ס" על־מנת למצוא את המקום הבא בו מופיעה האות "ס". אם
+עכשיו תקישו "מ", הסמן יזוז למקום בו נמצא "סמ". עתה הקישו <Delback>.
+ה־"מ" נמחק מהמחרוזת והסמן חוזר למקום בו הוא מצא את "ס" לראשונה.
+
+אם במהלך החיפוש תפעילו פקודה כלשהי ע"י הקשה על מקש תוך לחיצה על
+CONTROL או META, החיפוש יסתיים. (כמה תווים יוצאים מכלל זה -- אלו תווים
+מיוחדים בעת חיפוש, כדוגמת C-s ו־C-r.)
+
+הקשה על C-s מתחילה חיפוש שמנסה למצוא את המחרוזת _אחרי_ הסמן. אם
+ברצונכם למצוא משהו בטקסט הקודם למקום הנוכחי, הקישו C-r במקום C-s. כל
+מה שאמרנו לגבי C-s תקף גם לגבי C-r, אלא שכיוון החיפוש מתהפך.
+
+
+* חלונות מרובים
+---------------
+
+אחת התכונות הנוחות של Emacs היא כי ניתן להציג יותר מחלון אחד על המסך
+בו־זמנית. (הערה: Emacs משתמש במונח "frame" -- "תבנית" -- בשביל מה
+שתוכניות אחרות מכנות "חלון". תבניות מתוארות בפסקה הבאה. תוכלו למצוא את
+רשימת המונחים של Emacs בפרק "Glossary" של מדריך משתמש.)
+
+>> הביאו סמן לשורה זו והקישו C-u 0 C-l ‏(CONTROL-L ולא CONTROL-1).
+
+>> עתה הקישו C-x 2 וכתוצאה מכך החלון יתחלק לשניים. כל אחד משני החלונות
+   מציג את השיעור הזה. הסמן נשאר בחלון העליוןץ
+
+>> הקישו C-M-v כדי לגלול את החלון התחתון.
+   (אם במקלדת שלכם אין מקש META אמיתי, הקישו ‎<ESC> C-v כתחליף.)
+
+>> הקישו C-x o ‏("o" הוא רמז ל־"other", "אחר") על־מנת להעביר את הסמן
+   לחלון התחתון.
+>> הקישו C-v ו־M-v בחלון התחתון כדי לגלול אותו.
+   המשיכו לקרוא הוראות אלו בחלון העליון.
+
+>> הקישו C-x o שוב לחזור לחלון העליון.
+   הסמן בחלון העליון יישאר במקום בו הוא היה לפני־כן.
+
+תוכלו להמשיך להשתמש ב־C-x o כדי לדלג בין שני החלונות. לכל חלון מיקום
+סמן משלו, אבל רק חלון אחד מציג את הסמן בכל רגע. כל פקודות העריכה
+הרגילות פועלות על החלון שבו מוצג הסמן. אנו קוראים לחלון זה "החלון
+הנבחר".
+
+הפקודה C-M-v נוחה מאד כאשר הינכם עורכים טקסט בחלון אחד ומשתמשים בחלון
+אחר לייחוס. תוכלו בכל עת לשמור על הסמן בחלון בו אתם עורכים טקסט
+ולהתקדם בחלון השני בעזרת C-M-v.
+
+‏C-M-v היא דוגמא אחת של פקודת CONTROL-META. אם במקלדת שלכם קיים מקש
+META אמיתי, תוכלו להקיש את הפקודה ע"י לחיצה והחזקה של מקשי CONTROL
+ו־META גם יחד ואז להקיש v. הסדר שבו תלחצו על CONTROL ו־META אינו משנה
+כי שני המקשים הללו פועלים ע"י שינוי התו המוקש יחד איתם.
+
+אם אין במקלדת מקש META אמיתי ואתם משתמשים ב־<ESC> כתחליף, הסדר כן
+משנה: חייבים להקיש <ESC> ורק לאחר מכן CONTROL-v, וזאת משום
+ש־CONTROL-<ESC> v לא יעבוד. <ESC> הוא תו בזכות עצמו, שלא כמו CONTROL
+או META.
+
+>> הקישו C-x 1 (בחלון העליון) כדי לסלק את החלון התחתון.
+
+(אילו הקשתם C-x 1 בחלון התחתון, הייתם מסלקים את החלון העליון. תוכלו
+לחשוב על פקודה זו כ־"השאר רק חלון אחד -- החלון בו אני נמצא עתה".)
+
+אין חובה להציג את אותו החוצץ בשני החלונות. תוכלו להשתמש ב־C-x C-f
+לפתיחת קובץ באחד החלונות -- דבר זה אינו משפיע על החלון השני. אפשר גם
+לפתוח קבצים שונים בכל אחד משני החלונות באופן בלתי־תלוי.
+
+הנה עוד שיטה להשתמש בשני חלונות להצגה של שני דברים שונים:
+
+>> הקישו C-x 4 C-f ואחר־כך הקישו שם של אחד הקבצים שלכם.
+   סיימו עם <Return>. שימו לב שהקובץ המבוקש מוצג בחלון התחתון. הסמן
+   מדלג לשם אף הוא.
+
+>> הקישו C-x o לעבור לחלון העליון ואחר־כך הקישו C-x 1 כדי לסלק את
+   החלון התחתון.
+
+
+* תבניות מרובות
+---------------
+
+‏Emacs מסוגל לפתוח מספר "תבניות" ("frames") בתנאי שאינכם משתמשים בצג
+שמסוגל להציג רק טקסט. תבנית כוללת קבוצת חלונות, תפריט, פסי גלילה, אזור
+תצוגת הד וכו'. (תוכניות אחרות נוהגות לקרוא לזה "חלון".)
+
+>> הקישו M-x make-frame <Return>‎.
+   כתוצאה, תבנית חדשה תופיע על המסך.
+
+כל מה שעשיתם בתבנית המקורית ניתן לעשות גם בתבנית החדשה. התבנית הראשונה
+אין בה שום דבר מיוחד.
+
+>> הקישו M-x delete-frame <Return>‎.
+   התבנית שבה הקשתם את הפקודה תיסגר ותיעלם מהמסך.
+
+כמו־כן, ניתן לסגור תבנית בדרך הרגילה הנתמכת ע"י מנהל החלונות של המערכת
+שלכם (בדרך־כלל, ע"י הקלקה על הכפתור המסומן ב־"X" בפינה עליונה של
+התבנית.) שום מידע אינו הולך לעיבוד כאשר סוגרים תבנית (או חלון). המידע
+הזה פשוט יורד מהתצוגה, אבל ניתן לאחזרו מאוחר יותר.
+
+
+* רמות עריכה רקורסיביות
+-----------------------
+
+יתכן ותיקלעו למצב שקרוי "רמת עריכה רקורסיבית". Emacs מציין זאת ע"י
+סוגריים מרובעים בשורת הסטטוס מסביב לשם האופן הראשי. למשל, יוצג שם
+[(Fundamental)] במקום (Fundamental).
+
+כדי להחלץ מרמת עריכה רקורסיבית יש להקיש <ESC> <ESC> <ESC>. זוהי פקודה
+כללית של "הימלטות". ניתן להשתמש בה גם כדי לסלק חלונות מיותרים וליציאה
+מתוך מיני־חוצץ.
+
+>> הקישו M-x כדי להיכנס למיני־חוצץ; אחר־כך הקישו <ESC> <ESC> <ESC> כדי
+   להיחלץ משם.
+
+הקשה על C-g לא תחלץ אתכם מרמות עריכה רקורסיביות. זאת, משום ש־C-g מבטל
+פקודות וארגומנטים _במסגרת_ הרמה הרקורסיבית, מבלי לצאת ממנה.
+
+
+* לקבלת עזרה נוספת
+------------------
+
+בשיעור הראשון הזה השתדלנו לתת בידיכם מידע שאך יספיק להתחלת השימוש שלכם
+ב־Emacs. ‏Emacs מכיל כל־כך הרבה שאין שום אפשרות לתאר ולהסביר כאן את
+הכל. אולם, סביר שתרצו ללמוד יותר על Emacs שכן יש בו עוד הרבה תכונות
+שימושיות. Emacs כולל פקודות לשם קריאת תיעוד על הפקודות של Emacs.
+הפעלת פקודות "עזרה" אלו תמיד מתחילה במקש CONTROL-h שעל־כן נקרא "מקש
+עזרה" ("help").
+
+להפעלת פקודות עזרה יש להקיש את C-h ואחר־כך עוד תו שמבקש עזרה מסוג
+מסויים. אם אתם _באמת_ אבודים, הקישו C-h ?‎ ו־Emacs יציג את סוגי העזרה
+שהוא מעמיד לרשותכם. אם הקשתם C-h ובסופו של דבר החלטתם שאין צורך בשום
+עזרה, פשוט הקישו C-g לבטל את הפקודה.
+
+(אם הקשת C-h אינה מציגה בתחתית התצוגה הודעה בדבר עזרה, נסו להקיש F1 או
+M-x help <Return>‎ כתחליף.)
+
+סוג העזרה הבסיס ביותר הוא C-h c. הקישו C-h, אחריו את האות c ואז הקישו
+סדרת מקשים שמפעילה פקודה כלשהי. Emacs יציג תיאור מאד קצר של הפקודה
+ההיא.
+
+>> הקישו C-h c C-p.
+
+התוצאה שתוצג צריכה להיות משהו כמו זה:
+
+               C-p runs the command previous-line
+
+ההודעה הזו מראה את "שם הפונקציה". היות ושמות הפונקציות נבחרים כדי
+לציין מה הן עושות, השמות עשויים לשמש כתיעוד מקוצר -- מספיק כדי להזכיר
+לכם את הפקודות שלמדתם בעבר.
+
+ניתן לציין אחרי C-h c גם פקודות שמופעלות ע"י סדרת מקשים באורך גדול
+מאחד, כגון C-x C-s או (אם אין מקש META או EDIT או ALT) ‏‎<ESC> v.
+
+לקבלת מידע מפורט יותר על פקודה, השתמשו בפקודה C-h k במקום C-h c.
+
+>> הקישו C-h k C-p.
+
+כתוצאה, יוצגו השם והתיעוד של הפונקציה בחלון Emacs נפרד. כשתסיימו לקרוא
+את התיעוד, הקישו C-x 1 כדי לסלק את חלון העזרה. לא חייבים לעשות זאת
+מיד. אפשר לבצע קצת עריכה תוך שימוש בתיעוד המוצג ורק אחר־כך להקיש C-x 1.
+
+הנה עוד כמה פקודות עזרה שימושיות:
+
+    ‏C-h f   תן הסבר על פונקציה. יש להקיש את שם הפונקציה.
+
+>> נסו להקיש C-h f previous-line <Return>‎.
+   כתוצאה, יוצג תיעוד מלא של הפונקציה המממשת את הפקודה C-p כפי שהוא
+   ידוע ל־Emacs.
+
+פקודה דומה C-h v מציגה תיעוד של משתנה, כולל אלו שאת הערכים שלהם ניתן
+לשנות כדי לקסטם את Emacs. יש להקיש את שם המשתנה כאשר Emacs יבקש זאת.
+
+    ‏C-h a   פקודות בנוגע לנושא מסויים. הקישו מילת מפתח ו־Emacs
+               יציג את רשימת הפקודות ששמותיהן מכילות את מילת המפתח.
+               כל הפקודות הללו ניתנות להפעלה ע"י META-x. עבור חלק
+               מהפקודות תוצג גם סדרת מקשים שמפעילה את הפקודה.
+
+>> הקישו C-h a file <Return>‎.
+
+כתוצאה מזה, יוצג חלון עם רשימה של כל הפקודות ששמותיהן מכילות את המילה
+"file". ביניהן תראו גם מקשי קיצור כגון C-x C-f לצד שמות הפקודות כגון
+find-file.
+
+>> הקישו C-M-v כדי לגלול את חלון העזרה. עשו זאת פעמים אחדות.
+
+>> עתה הקישו C-x 1 כדי לסגור את חלון העזרה.
+
+    ‏C-h i   הצג מדריכים למשתמש הכלולים בחבילת Emacs. (פקודה זו
+               ידועה גם בשם "Info".) פקודה זאת פותחת חוצץ מיוחד הקרוי
+               "*info*" שבו תוכלו לקרוא מדריכים המותקנים במערכת שלכם.
+               הקישו m emacs <Return>‎ כדי לקרוא במדריך למשתמשי Emacs.
+               אם אינכם מכירים את Info, הקישו ? ו־Emacs יקח אתכם
+               לשיעור על התכונות של Info mode. כשתסיימו עם השיעור
+               הזה, אנו בהחלט ממליצים להשתמש במדריך Emacs בתור התיעוד
+               העיקרי שלכם.
+
+
+* עוד תכונות
+------------
+
+תוכלו ללמוד עוד על־אודות Emacs ע"י קריאה במדריך למשתמש שלו, אם כספר
+מודפס או בגירסה מקוונת בתוך Emacs עצמו. (תוכלו להגיע אל המדריך דרך
+תפריט Help או ע"י הקשה על C-h r.) אולם שתי תכונות שבוודאי ימצאו חן
+בעיניכם הן השלמה אשר חוסכת הקשות, ו־dired שמאפשרת טיפול נוח בקבצים.
+
+השלמה היא דרך להימנע מהקשות מיותרות. למשל, אם ברצונכם לעבור לחוצץ
+*Messages*, תוכלו להקיש C-x b *M<Tab>‎ ו־Emacs ישלים את שאר האותיות של
+שם החוצץ ככל שניתן להסיק ממה שהקשתם. השלמה פועלת גם על שמות הפקודות
+ושמות קבצים. תכונת ההשלמה מתוארת במלואה במדריך למשתמש Emacs בצומת
+(node) בשם "Completion".
+
+‏Dired מאפשר להציג רשימת קבצים בתיקיה (וכאפציה גם בתת-תיקיות שלה), לנוע
+בתוך הרשימה הזו, לפתוח קבצים, לשנות את שמותיהם, למחוק אותם ולבצע עליהם
+עוד פעולות רבות. Dired מתואר במלואו במדריך למשתמש בצומת בשם "Dired".
+
+בנוסף, מדריך למשתמש מתאר עוד הרבה מאד תכונות של Emacs.
+
+
+* לסיום
+-------
+
+כדי לצאת מ־Emacs יש להקיש C-x C-c.
+
+שיעור זה נכתב כדי להיות מובן לכל המשתמשים החדשים, לכן אם מצאתם שמשהו
+כאן אינו ברור, אל תשבו ותאשימו את עצמכם -- תתלוננו!
+
+
+* זכויות שימוש
+--------------
+
+שיעור זה הינו צאצא של שורה ארוכה של שיעורים בשימוש ב־Emacs, החל מהגרסה
+הראשונה שנכתבה ע"י Stuart Cracraft עבור גירסת ה־Emacs המקורית.
+
+גירסה זו של השיעור הינה חלק מחבילת GNU Emacs. היא מוגנת בזכויות יוצרים
+וניתנת להעתקה והפצת עותקים בתנאים מסויימים כדלקמן:
+
+                       Copyright (C) 2010 Free Software Foundation, Inc.
+
+‏GNU Emacs הינו תכנה חפשית; זכותכם להפיצו ו\או לשנותו בכפוף לתנאי
+הרשיון GNU General Public License, כפי שהוא יוצא לאור ע"י Free
+Software Foundation, אם בגרסא 3 של הרשיון, ואם (כאופציה השמורה לכם)
+בכל גרסא מאוחרת יותר.
+
+‏GNU Emacs מופץ מתוך תקווה שהוא יביא תועלת, אולם ללא כל כתב אחריות;
+אפילו לא אחריות־במשתמע של סחירות או התאמה לאיזו תכלית מסוימת. לפרטים,
+אנא עיינו ב־GNU General Public License.
+
+‏GNU Emacs אמור להיות מלווה בעותק של GNU General Public License; אם לא
+קיבלתם אותו, תוכלו למצוא אותו ב־‭<http://www.gnu.org/licenses/>‬.
+
+הנכם מוזמנים לקרוא את הקובץ COPYING ואז אכן לחלק עותקים של GNU Emacs
+לחבריכם. עזרו לנו לחסל את "הבעלות" על תוכנה שאינה אלא חבלה בתוכנה,
+וזאת ע"י שימוש, כתיבה ושיתוף של תוכנה חופשית!
+
+
+
+--- end of TUTORIAL.he ---
+
+;;; Local Variables:
+;;;   coding: utf-8
+;;;   bidi-display-reordering: t
+;;;   sentence-end-double-space: nil
+;;;   bidi-paragraph-direction: nil
+;;; End:
index b9e1f4b6ad342f19c8681f4022a5f7b0394b50df..ea0b1ec040ec52c29342e06b0e1c486e512a34d5 100644 (file)
@@ -31,6 +31,10 @@ Maintainer: Rafael Sepúlveda <drs@gnulinux.org.mx>
 Author:     Éric Jacoboni <jaco@teaser.fr>
 Maintainer: Éric Jacoboni <jaco@teaser.fr>
 
+* TUTORIAL.he
+Author:     Eli Zaretskii <eliz@gnu.org>
+Maintainer: Eli Zaretskii <eliz@gnu.org>
+
 * TUTORIAL.it:
 Author:     Alfredo Finelli <alfredofnl@tiscali.it>
            Italian GNU Translation Group <tp@lists.linux.it>
diff --git a/info/.arch-inventory b/info/.arch-inventory
deleted file mode 100644 (file)
index 4efa6ef..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-# There are only three real source files in this directory:
-#
-#   "dir", ".cvsignore", and this file, ".arch-inventory"
-
-# Everything else is generated at compile time.  Unfortunately, the "backup"
-# category overrides the "source" category, so we have to have horrible
-# regexp that matches everything _except_ "dir"...
-
-# 1 or 2 characters long
-backup ^[a-zA-Z0-9][-_.a-zA-Z0-9]?$
-# 4 or more characters long
-backup ^[a-zA-Z0-9][-_.a-zA-Z0-9][-_.a-zA-Z0-9][-_.a-zA-Z0-9]+$
-# 3 chars long, but 1st char not "d"
-backup ^[abce-zA-Z0-9][-_.a-zA-Z0-9][-_.a-zA-Z0-9]$
-# 3 chars long, but 2nd char not "i"
-backup ^[a-zA-Z0-9][-_.a-hj-zA-Z0-9][-_.a-zA-Z0-9]$
-# 3 chars long, but 3rd char not "r"
-backup ^[a-zA-Z0-9][-_.a-zA-Z0-9][-_.a-qs-zA-Z0-9]$
-
-# arch-tag: 60144ab9-cdc1-45b6-8193-b9683c80ec86
diff --git a/leim/.arch-inventory b/leim/.arch-inventory
deleted file mode 100644 (file)
index 3e125ae..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-# Auto-generated files, which ignore.
-precious ^(stamp-subdir|changed\..*|leim-list\.el)$
-
-# arch-tag: a4cda8ae-2a52-4d85-bd29-14e25c7ed2a2
index 9c5b2374b1fb9fe852e036dd1933246ed7d1e42e..1233aaf3062f931cb797c75736ee20038fd3d232 100644 (file)
 
        * quail/greek.el ("greek"): Add rules for Greek style quotes.
 
+2010-05-15  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (install): Remove references to CVS-related files.
+
 2010-05-07  Chong Yidong  <cyd@stupidchicken.com>
 
        * Version 23.2 released.
 
        * quail/vntelex.el: Fix "af" rule (Bug#5836).
 
+2010-03-27  Eli Zaretskii  <eliz@gnu.org>
+
+       * makefile.w32-in ($(TIT), $(MISC_DIC), leim-list.el): Enclose the
+       argument of "-l" in $(ARGQUOTE), in case it includes blanks or
+       other special characters.
+
+2010-03-18  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (maintainer-clean): Use bootstrap-clean.
+       (extraclean): Fix deletion patterns.
+
+       * Makefile.in (dot): Remove, since ../ is used throughout the
+       other Makefiles.
+
+2010-03-10  Chong Yidong  <cyd@stupidchicken.com>
+
+       * Branch for 23.2.
+
 2010-02-16  Kenichi Handa  <handa@m17n.org>
 
        * SKK-DIC/SKK-JISYO.L: Updated to the latest version.
 
 2001-03-31  Kenichi Handa  <handa@etl.go.jp>
 
-       * Makefile.in (TIT-GB): Delete quail/PY.elc and quail/ZIRANMA.elc
+       * Makefile.in (TIT-GB): Delete quail/PY.elc and quail/ZIRANMA.elc.
        (NON-TIT-BIG5): Delete ${srcdir}/quail/quick-b5.elc
        ${srcdir}/quail/tsang-b5.elc.
        (CHINESE-NON-TIT): Delete ${NON-TIT-CNS}.
index 244063bb2c42caaeb51baf79e3876532d5e1474c..ba70319ca1e683a712b313c4e5c1dc902d11f731 100644 (file)
@@ -40,18 +40,15 @@ INSTALLDIR=$(DESTDIR)${datadir}/emacs/${version}/leim
 
 GZIP_PROG = @GZIP_PROG@
 
-# On IBM RS6000, double-dot gets screwed up.
-dot = .
-
 # 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 = ${dot}${dot}/src/emacs
+BUILT-EMACS = ../src/emacs
 
-buildlisppath=${srcdir}/${dot}${dot}/lisp
+buildlisppath=${srcdir}/../lisp
 
 # How to run Emacs.
 RUN-EMACS = EMACSLOADPATH=$(buildlisppath) LC_ALL=C \
-       ${BUILT-EMACS} -batch --no-init-file --no-site-file --multibyte
+       ${BUILT-EMACS} -batch --no-init-file --no-site-file
 
 # Subdirectories to be made if ${srcdir} is different from the current
 # directory.
@@ -161,7 +158,7 @@ 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.
-${dot}${dot}/src/emacs:
+../src/emacs:
        cd ../src; ${MAKE} ${MFLAGS} emacs
 
 ${SUBDIRS}:
@@ -224,7 +221,7 @@ MV_DIRS = for i in $$dir; do rm -fr `basename "$$i"` ; mv "$$i" . ; done
 
 install: all
        if [ ! -d ${INSTALLDIR} ] ; then \
-          umask 022; ${srcdir}/${dot}${dot}/mkinstalldirs ${INSTALLDIR}; \
+          umask 022; ${srcdir}/../mkinstalldirs ${INSTALLDIR}; \
        else true; fi
        if [ x`(cd ${INSTALLDIR} && /bin/pwd)` != x`(/bin/pwd)` ] ; then \
          rm -f ${INSTALLDIR}/leim-list.el; \
@@ -240,8 +237,6 @@ install: all
            tar -chf - quail/* ja-dic \
                | (cd ${INSTALLDIR}; umask 0; tar -xvf - && cat > /dev/null) ;\
          fi; \
-         rm -rf ${INSTALLDIR}/CVS        ${INSTALLDIR}/*/CVS; \
-         rm -f  ${INSTALLDIR}/.cvsignore ${INSTALLDIR}/*/.cvsignore; \
          rm -f  ${INSTALLDIR}/.gitignore ${INSTALLDIR}/*/.gitignore; \
          rm -f  ${INSTALLDIR}/.arch-inventory ${INSTALLDIR}/*/.arch-inventory; \
          rm -f  ${INSTALLDIR}/\#*        ${INSTALLDIR}/*/\#* ; \
@@ -278,16 +273,17 @@ clean mostlyclean:
 # 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
 
 distclean: clean
        if test -f stamp-subdir; then rm -rf ${SUBDIRS} stamp-subdir; fi
        rm -f Makefile
 
-maintainer-clean: distclean
-       rm -f ${WORLD}
+maintainer-clean: distclean bootstrap-clean
 
 extraclean: maintainer-clean
-       -rm -f *~ \#* m/?*~ s/?*~
+       -rm -f *~ \#* */*~ */\#*
 
 .PHONY: check-declare
 
index c36e98af61808a1eac28bdc34b8200b3240fc1f5..f55fbbf816c70c754d7e8e040d81a123046eb5f6 100644 (file)
@@ -37,7 +37,7 @@ BUILT_EMACS = $(THISDIR)/$(dot)$(dot)/src/$(BLD)/emacs.exe
 buildlisppath=$(CURDIR)/$(dot)$(dot)/lisp
 
 # How to run Emacs.
-RUN_EMACS = "$(BUILT_EMACS)" -batch --no-init-file --no-site-file --multibyte
+RUN_EMACS = "$(BUILT_EMACS)" -batch --no-init-file --no-site-file
 
 # Set EMACSLOADPATH correctly (already defined in environment).
 EMACSLOADPATH=$(buildlisppath)
@@ -170,17 +170,21 @@ $(SUBDIRS):
 # WARNING: Do NOT split the part inside $(ARGQUOTE)s into multiple lines as
 #          this can break with GNU Make 3.81 and later if sh.exe is used.
 $(TIT):
-       $(RUN_EMACS) -l $(buildlisppath)/international/titdic-cnv \
+       $(RUN_EMACS) -l \
+           $(ARGQUOTE)$(buildlisppath)/international/titdic-cnv$(ARGQUOTE) \
            --eval $(ARGQUOTE)(batch-titdic-convert t)$(ARGQUOTE) \
            -dir quail $(srcdir)/CXTERM-DIC
-       $(RUN_EMACS)  -l $(buildlisppath)/international/quail \
+       $(RUN_EMACS)  -l \
+           $(ARGQUOTE)$(buildlisppath)/international/quail$(ARGQUOTE) \
            -f batch-byte-compile $(TIT:.elc=.el)
 
 # Rule to generate quail/*.el from MISC_DIC/*.tit.
 $(MISC_DIC):
-       $(RUN_EMACS) -l $(buildlisppath)/international/titdic-cnv \
+       $(RUN_EMACS) -l \
+           $(ARGQUOTE)$(buildlisppath)/international/titdic-cnv$(ARGQUOTE) \
            -f batch-miscdic-convert -dir quail $(srcdir)/MISC-DIC
-       $(RUN_EMACS)  -l $(buildlisppath)/international/quail \
+       $(RUN_EMACS)  -l \
+           $(ARGQUOTE)$(buildlisppath)/international/quail$(ARGQUOTE) \
            -f batch-byte-compile $(MISC_DIC:.elc=.el)
 
 #
@@ -188,7 +192,8 @@ $(MISC_DIC):
 #          this can break with GNU Make 3.81 and later if sh.exe is used.
 leim-list.el: $(SUBDIRS) $(WORLD) $(srcdir)/leim-ext.el
        - $(DEL) leim-list.el
-       $(RUN_EMACS) -l $(buildlisppath)/international/quail \
+       $(RUN_EMACS) -l \
+           $(ARGQUOTE)$(buildlisppath)/international/quail$(ARGQUOTE) \
            --eval $(ARGQUOTE)(update-leim-list-file $(DQUOTE).$(DQUOTE))$(ARGQUOTE)
        $(RUN_EMACS) --eval $(ARGQUOTE)(w32-append-code-lines $(DQUOTE)$@$(DQUOTE) $(DQUOTE)$(srcdir)/leim-ext.el$(DQUOTE))$(ARGQUOTE)
 
diff --git a/leim/quail/.arch-inventory b/leim/quail/.arch-inventory
deleted file mode 100644 (file)
index 8e90362..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-# Auto-generated lisp files, which ignore.
-precious ^([A-Z0-9].*|tsang-.*|quick-.*)\.el$
-
-# arch-tag: 3d0d3e6b-f7c3-4dce-9135-a72ba7fe095d
diff --git a/lib-src/.arch-inventory b/lib-src/.arch-inventory
deleted file mode 100644 (file)
index ea3cf80..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-# Ignore binaries
-backup ^(test-distrib|make-docfile|profile|digest-doc|movemail|fakemail|blessmail|hexl|update-game-score|etags|ctags|emacsclient|b2m|ebrowse|sorted-doc)$
-
-# Building actually makes a copy/link of the source file
-precious ^(ctags\.c)$
-
-# Windows generates this
-backup ^(DOC)$
-
-# arch-tag: da33b3d6-170d-4fe5-9eb8-ed2753bc9b4f
index 6b3584eb90fd47972c82d5db5c27aabc84d37486..4f3f386310ae85b89032e1757e87c09fb271d1de 100644 (file)
@@ -1,8 +1,328 @@
+2010-08-11  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * fakemail.c: Include stdlib.h for getenv. Remove declaration of
+       popen, fclose and pclose.
+       (my_name, fatal, error, put_line): Use const char*
+       (main): Remove extern getenv, mail_program_name is const char*.
+
+       * update-game-score.c (get_prefix, write_scores, main): Use const char*.
+
+       * sorted-doc.c (error, fatal, states): Use const char *.
+
+       * pop.h (pop_multi_first): Use const char *.
+       (_ARGS): Remove.
+
+       * pop.c (pop_multi_first, socket_connection, sendline): Use conat char*.
+
+       * movemail.c (fatal, error, concat): Use const char *.
+
+       * make-docfile.c (error, fatal, scan_c_file, scan_lisp_file): Use
+       const char *.
+
+       * etags.c (compressor, language, Ada_suffix, Ada_help, Asm_suffixes)
+       (Asm_help, default_C_suffixes, default_C_help, Cplusplus_suffixes)
+       (Cplusplus_help, Cjava_suffixes, Cobol_suffixes, Cstar_suffixes)
+       (Erlang_suffixes, Erlang_help, Forth_suffixes, Forth_help)
+       (Fortran_suffixes, Fortran_help, HTML_suffixes,  HTML_help)
+       (Lisp_suffixes, Lisp_help, Lua_suffixes, Lua_help)
+       (Makefile_filenames, Makefile_help, Objc_suffixes, Objc_help)
+       (Pascal_suffixes, Pascal_help, Perl_suffixes, Perl_interpreters)
+       (Perl_help, PHP_suffixes, PHP_help, plain_C_suffixses, PS_suffixes)
+       (PS_help, Prolog_suffixes, Prolog_help, Python_suffixes, Python_help)
+       (Scheme_suffixes, Scheme_help, TeX_suffixes, TeX_help, Texinfo_suffixes)
+       (Texinfo_help, Yacc_suffixes, Yacc_help, auto_help, none_help)
+       (no_lang_help, print_language_names)
+       (get_language_from_interpreter, get_language_from_filename)
+       (init, make_tag, struct C_stab_entry, write_classname, TEX_defenv)
+       (TEX_decode_env, nocase_tail, savestr, savenstr, fatal, pfatal)
+       (concat): Use const char*.
+
+       * emacsclient.c (message, sock_err_message, send_to_emacs)
+       (quote_argument, set_local_socket)
+       (start_daemon_and_retry_set_socket): Use const char*.
+
+       * ebrowse.c (struct member): filename, def_filename is const.
+       (struct sym): filename, sfilename is const.
+       (struct kw): name is const.
+       (add_sym, yyerror, token_string, insert_keyword, main): Use const char*.
+
+       * b2m.c (concat, fatal): Use const char*.
+       (main): Don't assign labels a string literal.
+
+2010-08-07  Juanma Barranquero  <lekktu@gmail.com>
+
+       * ebrowse.c (usage, version, mark_virtual):
+       Remove duplicate declarations.
+
+2010-08-06  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * emacsclient.c: Move socket related #includes together with the
+       rest of the #includes.  Move a WINDOWSNT includes closer together.
+       (HAVE_CONFIG_H): Remove.
+       (NO_RETURN): Remove, defined in config.h.
+       (main): Convert definition to standard C.
+
+2010-07-29  Juanma Barranquero  <lekktu@gmail.com>
+
+       * make-docfile.c (write_c_args): Warn for old-style empty arglist ().
+
+2010-07-25  Juanma Barranquero  <lekktu@gmail.com>
+
+       * emacsclient.c (getcwd): Fix previous change: make getcwd
+       conditional on HAVE_GETCWD and declare with the correct POSIX
+       profile (for some reason MinGW headers define its 2nd arg as int,
+       not size_t; but getcwd is not used on Windows nonetheless).
+
+2010-07-25  Juanma Barranquero  <lekktu@gmail.com>
+
+       * emacsclient.c (getcwd, w32_getenv):
+       * ntlib.h (getlogin, getuid, getegid, getgid): Fix prototypes.
+
+2010-07-24  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * update-game-score.c (usage): Add NO_RETURN specifier.
+       * movemail.c (fatal, pfatal_with_name, pfatal_and_delete):
+       * make-docfile.c (fatal):
+       * hexl.c (usage):
+       * fakemail.c (fatal):
+       * etags.c (fatal, suggest_asking_for_help, pfatal):
+       * emacsclient.c (fatal):
+       * b2m.c (fatal): Likewise.
+
+2010-07-23  Juanma Barranquero  <lekktu@gmail.com>
+
+       * make-docfile.c (write_c_args): Correctly handle prefixes of "defalt".
+
+2010-07-20  Juanma Barranquero  <lekktu@gmail.com>
+
+       * emacsclient.c (get_current_dir_name, w32_get_resource)
+       (w32_getenv, w32_set_user_model_id, w32_window_app, w32_execvp)
+       (close_winsock, initialize_sockets, w32_find_emacs_process)
+       (w32_give_focus):
+       * ntlib.c (getlogin, getuid, getgid, getegid):
+       Convert definitions to standard C.
+
+2010-07-12  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * Makefile.in (C_WARNINGS_SWITCH, PROFILING_CFLAGS)
+       (PROFILING_LDFLAGS): Set from substitution.
+       (BASE_CFLAGS): Add  ${C_WARNINGS_SWITCH}.
+       (ALL_CFLAGS, CPP_CFLAGS): Add ${PROFILING_CFLAGS}.
+       (LINK_CFLAGS): Add ${PROFILING_LDFLAGS}.
+
+2010-07-12  Eli Zaretskii  <eliz@gnu.org>
+
+       * makefile.w32-in (lisp2): Change hebrew.el to hebrew.elc (see
+       2010-07-12T05:25:46Z!handa@etlken).
+
+2010-07-11  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * emacsclient.c (set_local_socket): Use strchr, strrchr instead of
+       index, rindex.
+       * movemail.c (mail_spool_name, popmail): Likewise.
+       * pop.c (pop_list): Likewise.
+
+2010-07-11  Eli Zaretskii  <eliz@gnu.org>
+
+       * makefile.w32-in (obj): Add menu.o, bidi.o, w32uniscribe.o,
+       and unexw32.o.  (Bug#6603)
+
+2010-07-10  Eli Zaretskii  <eliz@gnu.org>
+
+       * Makefile.in ($(DESTDIR)${archlibdir}): Convert spaces to TABs.
+
+2010-07-09  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * make-docfile.c (write_c_args): Restructure scanning loop.
+
+2010-07-09  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * make-docfile.c (write_c_args): Deal with type names in DEFUN
+       arguments.
+
+2010-07-08  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * update-game-score.c (P_): Remove macro.
+       * ebrowse.c: Remove include guards.
+       (P_): Remove macro.
+
+2010-07-07  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * ebrowse.c (add_sym, make_namespace): Replace bcopy, bzero by
+       memcpy, memmove, memset.
+       * pop.c (pop_retrieve, socket_connection, pop_getline): Likewise.
+
+2010-07-06  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * movemail.c: Add MAIL_USE_POP around prototypes.
+       Include <string.h> if HAVE_STRING_H.
+       (strerror): Only declare if !HAVE_STRERROR.
+       (fatal): Make static.
+       (error): Likewise.
+       (pfatal_with_name): Likewise.
+       (pfatal_and_delete). Likewise.
+       (concat): Likewise.
+       (xmalloc): Likewise.
+       (popmail): Likewise.
+       (pop_retr): Likewise.
+       (mbx_write): Likewise.
+       (mbx_delimit_begin): Likewise.
+       (mbx_delimit_end): Likewise.
+
+2010-07-04  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * fakemail.c (action): Convert function definitions to standard C.
+       (add_a_stream):
+       * test-distrib.c (cool_read):
+       (main): Likewise.
+
+2010-07-03  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * sorted-doc.c (cmpdoc): Fix signature.
+       (qsort_compare): Delete.
+       (main): Remove cast.
+
+2010-07-03  Juanma Barranquero  <lekktu@gmail.com>
+
+       * ebrowse.c (match_qualified_namespace_alias): Check for null pointer.
+
+2010-07-03  Juanma Barranquero  <lekktu@gmail.com>
+
+       Fix prototype warnings.
+
+       * ebrowse.c (match_qualified_namespace_alias):
+       Pass sym* to find_namespace, not link*.
+
+       * emacsclient.c (send_to_emacs, quote_argument): Arg s is HSOCKET.
+
+       * sorted-doc.c (qsort_compare): New typedef.
+       (main): Use it to cast cmpdoc.
+
+2010-07-03  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * update-game-score.c: Convert function definitions to standard C.
+       * sorted-doc.c:
+       * profile.c:
+       * pop.c:
+       * movemail.c:
+       * make-docfile.c:
+       * hexl.c:
+       * fakemail.c:
+       * etags.c:
+       * ebrowse.c:
+       * digest-doc.c:
+       * b2m.c: Likewise.
+
+2010-07-02  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * make-docfile.c (xmalloc, xrealloc, concat, readline, fatal):
+       * b2m.c (scan_file, scan_lisp_file, scan_c_file): Convert to
+       standard C prototypes.
+
+2010-07-02  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * ebrowse.c: Remove P_ and __P.
+       * etags.c:
+       * movemail.c:
+       * pop.c:
+       * update-game-score.c: Likewise.
+
+2010-06-24  Juanma Barranquero  <lekktu@gmail.com>
+
+       * movemail.c (error): Avoid warning when there are no args.
+
+2010-06-11  Juanma Barranquero  <lekktu@gmail.com>
+
+       * makefile.w32-in (lisp2): Fix references to vc/vc-hooks.elc
+       and vc/ediff-hook.elc.
+
+2010-06-06  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * ntlib.h: Remove code dealing with BSTRING.
+
+2010-05-29  Chong Yidong  <cyd@stupidchicken.com>
+
+       * emacsclient.c (longopts, decode_options, print_help_and_exit):
+       New arg `-parent-id'.
+       (main): Send parent-id to Emacs.
+
+2010-05-27  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (distclean): No more Makefile.c.
+
+2010-05-22  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * Makefile.in (STAMP_INST_SCRIPTS, STAMP_SCRIPS): New (Bug #6246).
+       (all): Depend onSTAMP_INST_SCRIPTS, STAMP_SCRIPS (Bug #6246).
+       (stamp-rcs2log, stamp-rcs-checkin, stamp-grep-changelog, stamp-vcdiff):
+       New rules (Bug #6246).
+       (clean): Remove stamp-* (Bug #6246).
+
+2010-05-12  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (INSTALLABLES): Remove @LIB_SRC_EXTRA_INSTALLABLES@.
+
+2010-05-11  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (.m.o): Remove, there are no .m files.
+       (BASE_CFLAGS): New variable.
+       (ALL_CFLAGS, LINK_CFLAGS, CPP_CFLAGS): Use $BASE_CFLAGS.
+       (check): Update the message.
+       (update-game-score${EXEEXT}): Do not use $MOVE_FLAGS.
+
+       * Makefile.in: Convert comments to makefile format.
+
+       * Makefile.in (LIBS_SYSTEM) [MSDOS]: Do not reset.
+       (config.h) [MSDOS]: Do not include.
+
+2010-05-10  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (LIBS_SYSTEM): Set with configure, not cpp.
+       (LIBS_SYSTEM) [MSDOS]: Reset with MSDOS_LIBS_SYSTEM.
+       (NOT_C_CODE): Remove, no longer used.
+       (config.h) [!MSDOS]: No longer include.
+       (LOADLIBES): Use LIBS_SYSTEM as a variable.
+
+       * Makefile.in (BLESSMAIL_TARGET): Set with configure, not cpp.
+
+2010-05-08  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (THIS_IS_MAKEFILE): Remove, unused.
+
 2010-05-07  Chong Yidong  <cyd@stupidchicken.com>
 
        * Version 23.2 released.
 
-2010-05-05  Christoph  <cschol2112@googlemail.com>  (tiny change)
+2010-05-06  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in: Minimize blessmail-related cpp usage.
+       (BLESSMAIL_TARGET): New variable.
+       (MOVEMAIL_NEEDS_BLESSING): Remove, replace by above variable.
+       (blessmail): Always define this rule.
+       (need-blessmail): New rule, split out from maybe-blessmail.
+       (maybe-blessmail): Use BLESSMAIL_TARGET.
+
+2010-05-04  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in: Use @C_SWITCH_SYSTEM@, @C_SWITCH_MACHINE@ rather than
+       @c_switch_system@, @c_switch_machine@.
+
+2010-04-26  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * Makefile.in (LIBS_MACHINE): Remove all uses, unused.
+
+2010-04-12  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * Makefile.in (ALL_CFLAGS, LINK_CFLAGS, CPP_CFLAGS): Move to the
+       non-cpp section.
+
+2010-04-11  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * Makefile.in (C_SWITCH_SYSTEM, C_SWITCH_MACHINE): Define using
+       autoconf, not cpp.
+       (ALL_CFLAGS): Use them as make variables.
+
+2010-04-07  Christoph  <cschol2112@googlemail.com>  (tiny change)
 
        * makefile.w32-in (OTHER_PLATFORM_SUPPORT): Use parenthesis
        for macros for nmake compatibility.
        possibility of symlink attack when movemail is setgid mail
        (CVE-2010-0825).
 
-2010-03-19  Tetsurou Okazaki  <okazaki@be.to>  (tiny change)
+2010-04-02  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       Remove extern errno declarations.
+       * movemail.c:
+       * etags.c:
+       * emacsclient.c: Remove extern errno declarations.
+
+2010-03-20  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (KRB4LIB, DESLIB, KRB5LIB, CRYPTOLIB, COM_ERRLIB)
+       (LIBHESIOD, LIBRESOLV): Make previous change a bit more friendly by
+       defining these as Makefile variables.
+       (LIBS_MOVE): Add LIBS_MAIL into this.
+       (movemail${EXEEXT}): Just use LIBS_MOVE, not LIBS_MAIL as well.
 
-       * Makefile.in (uninstall): Handle the case where archlibdir does
-       not exist.  (Bug#5720)
+2010-03-18  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (KRB4LIB, DESLIB, KRB5LIB, CRYPTOLIB, COM_ERRLIB)
+       (HESIODLIB, LIBS_MAIL): Set using autoconf rather than cpp.
+       (BASE_CFLAGS): Remove (identical to CPP_CFLAGS).
+
+2010-03-18  Tetsurou Okazaki  <okazaki@be.to>  (tiny change)
+
+       * Makefile.in (uninstall): Handle the case where archlibdir does not
+       exist.  (Bug#5720)
+
+2010-03-10  Chong Yidong  <cyd@stupidchicken.com>
+
+       * Branch for 23.2.
 
 2010-02-20  Kevin Ryde  <user42@zip.com.au>
 
 
 2010-01-29  Kester Habermann  <kester@linuxtag.org>  (tiny change)
 
-       * etags.c (Fortran_functions): Handle recursive keyword
-       (Bug#5484).
+       * etags.c (Fortran_functions): Handle recursive keyword (Bug#5484).
 
 2010-01-11  Glenn Morris  <rgm@gnu.org>
 
 
 2008-02-01  Jason Rumney  <jasonr@gnu.org>
 
-       * makefile.w32-in (obj): Sync with src/Makefile.in
+       * makefile.w32-in (obj): Sync with src/Makefile.in.
        (TOOLTIP_SUPPORT, WINDOW_SUPPORT): New definitions.
        (WINNT_SUPPORT): Add term/w32-win.elc.
        (lisp1, lisp2): Sync with lisp in src/Makefile.in.
 
        * makefile.w32-in (WINNT_SUPPORT, MOUSE_SUPPORT, lisp): Revert to
        using .elc files.
-       (lisp): Sync with list in src/Makefile.in
+       (lisp): Sync with list in src/Makefile.in.
        (VMS_SUPPORT, MSDOS_SUPPORT): Define, so DOC files can be shared.
 
 2002-02-10  Paul Eggert  <eggert@twinsun.com>
 
 2000-03-02  Gerd Moellmann  <gerd@gnu.org>
 
-       * etags.c (lisp_suffixes)  Add `LSP'.
+       * etags.c (lisp_suffixes): Add `LSP'.
 
 2000-02-10  Francesco Potortì  <pot@gnu.org>
 
        * Makefile.in.in (install, maybe-blessmail): Don't cd ..;
        configure has already set $(INSTALL) to the proper relative path.
 
-1995-06-27  Francesco Potortì  (pot@cnuce.cnr.it)
-
-       * etags.c (plain_C_entries): New function.
-       (lowcase): New macro.
-       (tail, Fortran_functions, Pascal_functions): Use new macro lowcase.
-       (lang_suffixes): New suffix ".pc" for Pro*C files.
-       (consider_token): Don't tag all tokens beginning with DEFUN & Co..
-       (tail): Look for the end of the token when comparing.
-       (takeprec): Since now tail behaves differently, use strneq.
-
 1995-07-08  Paul Eggert  <eggert@twinsun.com>
 
        * rcs2log (datearg): Separate date from time with comma, not space,
        (TOKEN): Member linestart removed.
        (linepos, prev_linepos, lb1): Deleted.
        (main): Call initbuffer on lbs array instead of lb1.
-       (init): Removed the initialisation of the logical _gd array;
+       (init): Removed the initialisation of the logical _gd array.
        (find_entries): A .sa suffix means assembler file.
        (C_create_stab): "auto", "void", "extern", "static" are st_C_typespec.
        All C state machines rewritten.
        * etags.c: Changes for VMS.
        Always define ETAGS on VMS.
        Define macros GOOD and BAD for success and failure exit codes.
-       (begtk, intk): Allow `$' in identifiers
+       (begtk, intk): Allow `$' in identifiers.
        (main): Don't support -B, -F or -u on VMS.
        Alternate loop for scanning filename arguments.
        (system): Delete definition of this function.
index 0353c4412fb723eae7a4d22f894e45f1c9b8fb10..9ad3c65afad88307bb9e13eed6abbe932dad4a76 100644 (file)
@@ -1,6 +1,6 @@
 # Makefile for lib-src subdirectory in GNU Emacs.
 # Copyright (C) 1985, 1987, 1988, 1993, 1994, 2001, 2002, 2003, 2004,
-#               2005, 2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
+#   2005, 2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
@@ -31,8 +31,14 @@ EMACSOPT = -batch --no-site-file --multibyte
 CC=@CC@
 CFLAGS=@CFLAGS@
 version=@version@
+## Used in $archlibdir.
 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@
+PROFILING_LDFLAGS = @PROFILING_LDFLAGS@
 
 # Program name transformation.
 TRANSFORM = @program_transform_name@
@@ -103,14 +109,16 @@ INSTALL_STRIP =
 
 # ========================== Lists of Files ===========================
 
-# Things that a user might actually run,
-# which should be installed in bindir.
-INSTALLABLES = etags${EXEEXT} ctags${EXEEXT} emacsclient${EXEEXT} b2m${EXEEXT} ebrowse${EXEEXT} @LIB_SRC_EXTRA_INSTALLABLES@
+# Things that a user might actually run, which should be installed in bindir.
+INSTALLABLES = etags${EXEEXT} ctags${EXEEXT} emacsclient${EXEEXT} \
+               b2m${EXEEXT} ebrowse${EXEEXT}
+
 INSTALLABLE_SCRIPTS = rcs-checkin grep-changelog
+STAMP_INST_SCRIPTS = stamp-rcs-checkin stamp-grep-changelog
 
 # Things that Emacs runs internally, or during the build process,
 #  which should not be installed in bindir.
-UTILITIES profile${EXEEXT} digest-doc${EXEEXT} sorted-doc${EXEEXT} \
+UTILITIES = profile${EXEEXT} digest-doc${EXEEXT} sorted-doc${EXEEXT} \
             movemail${EXEEXT} fakemail${EXEEXT} \
             hexl${EXEEXT} update-game-score${EXEEXT}
 
@@ -119,171 +127,95 @@ 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
 
 EXECUTABLES= ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}
 
-# Additional -D flags for movemail (add to MOVE_FLAGS if desired):
-# MAIL_USE_POP         Support mail retrieval from a POP mailbox.
-# MAIL_USE_MMDF                Support MMDF mailboxes.
-# MAIL_USE_FLOCK       Use flock for file locking (see the comments
-#                      about locking in movemail.c)
-# MAIL_UNLINK_SPOOL    Unlink the user's spool mailbox after reading
-#                      it (instead of just emptying it).
-# KERBEROS             Support Kerberized POP.
-# KRB5                 Support Kerberos Version 5 pop instead of
-#                      Version 4 (define this in addition to
-#                      KERBEROS).
-# HESIOD               Support Hesiod lookups of user mailboxes.
-# MAILHOST             A string, the host name of the default POP
-#                      mail host for the site.
+# Specify additional -D flags for movemail. Options:
+# -DMAIL_USE_FLOCK or -DMAIL_USE_LOCKF (use flock or lockf for file locking).
+# See the comments about locking in movemail.c.  Normally the values
+# set by configure should be correct and you should not need to do anything.
+# If neither flag is set, you need to use blessmail.
 MOVE_FLAGS=
 
-# ========================== start of cpp stuff =======================
-/* From here on, comments must be done in C syntax.  */
-
-#define THIS_IS_MAKEFILE
-#define NOT_C_CODE
-#include "../src/config.h"
-
-/* Some s/SYSTEM.h files define this to request special libraries.  */
-#ifndef LIBS_SYSTEM
-#define LIBS_SYSTEM
-#endif
-
-/* Some m/MACHINE.h files define this to request special libraries.  */
-#ifndef LIBS_MACHINE
-#define LIBS_MACHINE
-#endif
-
-#ifndef C_SWITCH_SYSTEM
-#define C_SWITCH_SYSTEM
-#endif
-
-#ifndef C_SWITCH_MACHINE
-#define C_SWITCH_MACHINE
-#endif
-
-#undef MOVEMAIL_NEEDS_BLESSING
-#ifndef MAIL_USE_FLOCK
-#ifndef MAIL_USE_LOCKF
-#define MOVEMAIL_NEEDS_BLESSING
-#endif
-#endif
-
-#ifdef MOVEMAIL_NEEDS_BLESSING
-#define BLESSMAIL blessmail
-#else
-#define BLESSMAIL
-#endif
-
-#ifdef KERBEROS
-# ifdef HAVE_LIBKRB
-    KRB4LIB = -lkrb
-# else
-#  ifdef HAVE_LIBKRB4
-     KRB4LIB = -lkrb4
-#  endif
-# endif
-# ifdef HAVE_LIBDES
-    DESLIB = -ldes
-# else
-#  ifdef HAVE_LIBDES425
-    DESLIB = -ldes425
-#  endif
-# endif
-# ifdef HAVE_LIBKRB5
-    KRB5LIB = -lkrb5
-# endif
-# ifdef HAVE_LIBK5CRYPTO
-    CRYPTOLIB = -lk5crypto
-# else
-#  ifdef HAVE_LIBCRYPTO
-    CRYPTOLIB = -lcrypto
-#  endif
-# endif
-# ifdef HAVE_LIBCOM_ERR
-    COM_ERRLIB = -lcom_err
-# endif
-#endif /* KERBEROS */
-
-/* If HESIOD is defined, set this to "-lhesiod". */
-#ifdef HAVE_LIBHESIOD
-# ifdef HAVE_LIBRESOLV
-    HESIODLIB= -lhesiod -lresolv
-# else
-    HESIODLIB= -lhesiod
-# endif
-#endif
-
-LIBS_MOVE=$(KRB4LIB) $(DESLIB) $(KRB5LIB) $(CRYPTOLIB) $(COM_ERRLIB) $(HESIODLIB)
-
-#ifdef HAVE_LIBLOCKFILE
-LIBS_MAIL=-llockfile
-#else
-#ifdef HAVE_LIBMAIL
-LIBS_MAIL=-lmail
-#endif
-#endif
-
-LOADLIBES=LIBS_SYSTEM LIBS_MACHINE
-
-/* We need to #define emacs to get the right versions of some files.
-   Some other files - those shared with other GNU utilities - need
-   HAVE_CONFIG_H #defined before they know they can take advantage of
-   the information in ../src/config.h.  */
-ALL_CFLAGS = C_SWITCH_SYSTEM C_SWITCH_MACHINE -DHAVE_CONFIG_H \
-   -I. -I../src -I${srcdir} -I${srcdir}/../src ${LDFLAGS} ${CPPFLAGS} ${CFLAGS}
-LINK_CFLAGS = C_SWITCH_SYSTEM C_SWITCH_MACHINE -DHAVE_CONFIG_H \
-   -I. -I../src -I${srcdir} -I${srcdir}/../src ${LDFLAGS} ${CFLAGS}
-CPP_CFLAGS = C_SWITCH_SYSTEM C_SWITCH_MACHINE -DHAVE_CONFIG_H \
-   -I. -I../src -I${srcdir} -I${srcdir}/../src ${CPPFLAGS} ${CFLAGS}
-/* This was all of CPP_CFLAGS except -Demacs.
-   Now that -Demacs has been deleted from CPP_CFLAGS,
-   this is actually the same as CPP_CFLAGS, but let\'s not delete it yet.  */
-BASE_CFLAGS = C_SWITCH_SYSTEM C_SWITCH_MACHINE -DHAVE_CONFIG_H \
-   -I. -I../src -I${srcdir} -I${srcdir}/../src ${CPPFLAGS} ${CFLAGS}
-\f
-.SUFFIXES: .m
+## Empty if either MAIL_USE_FLOCK or MAIL_USE_LOCKF, else need-blessmail.
+BLESSMAIL_TARGET=@BLESSMAIL_TARGET@
+
+## -lkrb if HAVE_LIBKRB or -lkrb4 if HAVE_LIBKRB4
+KRB4LIB=@KRB4LIB@
+## -ldes if HAVE_LIBDES or -ldes425 if HAVE_LIBDES425
+DESLIB=@DESLIB@
+## -lkrb5 if HAVE_LIBKRB5
+KRB5LIB=@KRB5LIB@
+## -lk5crypto if HAVE_LIBK5CRYPTO or -lcrypto if HAVE_LIBCRYPTO
+CRYPTOLIB=@CRYPTOLIB@
+## -lcom_err if HAVE_LIBCOM_ERR
+COM_ERRLIB=@COM_ERRLIB@
+## -lhesiod if HAVE_LIBHESIOD
+LIBHESIOD=@LIBHESIOD@
+## -lresolv if HAVE_LIBRESOLV
+LIBRESOLV=@LIBRESOLV@
+## -llockfile if HAVE_LIBLOCKFILE or -lmail if HAVE_LIBMAIL
+LIBS_MAIL=@LIBS_MAIL@
+
+## Extra libraries to use when linking movemail.
+LIBS_MOVE = $(LIBS_MAIL) $(KRB4LIB) $(DESLIB) $(KRB5LIB) $(CRYPTOLIB) \
+            $(COM_ERRLIB) $(LIBHESIOD) $(LIBRESOLV)
+
+## 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${srcdir} -I${srcdir}/../src
+
+ALL_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${LDFLAGS} ${CPPFLAGS} ${CFLAGS}
+LINK_CFLAGS = ${BASE_CFLAGS} ${PROFILING_LDFLAGS} ${LDFLAGS} ${CFLAGS}
+CPP_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${CPPFLAGS} ${CFLAGS}
+
+LOADLIBES=$(LIBS_SYSTEM)
 
-/* This is the default compilation command.
-   But we should never rely on it, because some make version
-   failed to find it for getopt.o.
-   Using an explicit command made it work.  */
+\f
+## This is the default compilation command.
+## But we should never rely on it, because some make version failed to
+## find it for getopt.o.
+## Using an explicit command made it work.
 .c.o:
        ${CC} -c ${CPP_CFLAGS} $<
 
-.m.o:
-       $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $<
-
-all: ${DONT_INSTALL} ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}
+all: ${DONT_INSTALL} ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}  ${STAMP_INST_SCRIPTS} ${STAMP_SCRIPTS}
 
-/* These targets copy the scripts into the build directory
-so that they can be run from there in an uninstalled Emacs.
-The "-" is prepended because some versions of cp barf when
-srcdir is the current directory, and thus the file will be
-copied into itself.  */
-rcs2log: $(srcdir)/rcs2log
+## These targets copy the scripts into the build directory so that
+## they can be run from there in an uninstalled Emacs.
+## The "-" is prepended because some versions of cp barf when srcdir
+## is the current directory, and thus the file will be copied into itself.
+stamp-rcs2log: $(srcdir)/rcs2log
        -cp -p $(srcdir)/rcs2log rcs2log
+       touch $@
 
-rcs-checkin: $(srcdir)/rcs-checkin
+stamp-rcs-checkin: $(srcdir)/rcs-checkin
        -cp -p $(srcdir)/rcs-checkin rcs-checkin
+       touch $@
 
-grep-changelog: $(srcdir)/grep-changelog
+stamp-grep-changelog: $(srcdir)/grep-changelog
        -cp -p $(srcdir)/grep-changelog grep-changelog
+       touch $@
 
-vcdiff: $(srcdir)/vcdiff
+stamp-vcdiff: $(srcdir)/vcdiff
        -cp -p $(srcdir)/vcdiff vcdiff
+       touch $@
 
-#ifdef MOVEMAIL_NEEDS_BLESSING
+## Only used if we need blessmail, but no harm in always defining.
+## This makes the actual blessmail executable.
 blessmail:
        $(EMACS) $(EMACSOPT) -l $(srcdir)/../lisp/mail/blessmail.el
        chmod +x blessmail
-#endif
 
-maybe-blessmail: BLESSMAIL
-#ifdef MOVEMAIL_NEEDS_BLESSING
-/* Don\'t charge ahead and do it!  Let the installer decide.
-         ./blessmail $(DESTDIR)${archlibdir}/movemail${EXEEXT}  */
+## This checks if we need to run blessmail.
+## Do not charge ahead and do it!  Let the installer decide.
+need-blessmail: blessmail
        @if [ `wc -l <blessmail` != 2 ] ; then \
          dir=`sed -n -e 's/echo mail directory = \(.*\)/\1/p' blessmail`; \
          echo Assuming $$dir is really the mail spool directory, you should; \
@@ -291,10 +223,15 @@ maybe-blessmail: BLESSMAIL
          echo as root, to give  movemail${EXEEXT}  appropriate permissions.; \
          echo Do that after running  make install.; \
        fi
-#endif
 
-/* Install the internal utilities.  Until they are installed, we can
-   just run them directly from lib-src.  */
+## This is the target invoked by the top-level Makefile.
+maybe-blessmail: $(BLESSMAIL_TARGET)
+
+## Install the internal utilities.  Until they are installed, we can
+## just run them directly from lib-src.
+## If the chown/chmod commands fail, that is not a big deal.
+## update-game-score will detect at runtime that it is not setuid,
+## and handle things accordingly.
 $(DESTDIR)${archlibdir}: all
        @echo
        @echo "Installing utilities run internally by Emacs."
@@ -307,14 +244,11 @@ $(DESTDIR)${archlibdir}: all
        umask 022; $(top_srcdir)/mkinstalldirs $(DESTDIR)${gamedir}; \
        touch $(DESTDIR)${gamedir}/snake-scores; \
        touch $(DESTDIR)${gamedir}/tetris-scores
-/* If the following commands fail, that is not a big deal.
-   update-game-score will detect at runtime that it is not setuid,
-   and handle things accordingly. */
        -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)` \
+       if [ `(cd $(DESTDIR)${archlibdir} && /bin/pwd)` \
              != `(cd ${srcdir} && /bin/pwd)` ]; then \
          for file in ${SCRIPTS}; do \
            $(INSTALL_SCRIPT) ${srcdir}/$$file $(DESTDIR)${archlibdir}/$$file; \
@@ -338,19 +272,21 @@ uninstall:
        for file in ${INSTALLABLES} ${INSTALLABLE_SCRIPTS}; do \
          rm -f $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \
        done)
-       (cd $(DESTDIR)${archlibdir} && \
-        rm -f ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS})
+       if [ -d $(DESTDIR)${archlibdir} ]; then \
+         (cd $(DESTDIR)${archlibdir} && \
+          rm -f ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}) \
+       fi
 
 mostlyclean:
        -rm -f core *.o getopt.h getopt.h-t
 
 clean: mostlyclean
        -rm -f ${INSTALLABLES} ${UTILITIES} ${DONT_INSTALL}
-       -rm -f fns*.el *.tab.c *.tab.h
+       -rm -f fns*.el *.tab.c *.tab.h stamp-*
 
 distclean: clean
        -rm -f TAGS
-       -rm -f Makefile Makefile.c blessmail
+       -rm -f Makefile blessmail
 
 maintainer-clean: distclean
        true
@@ -358,24 +294,24 @@ maintainer-clean: distclean
 extraclean: maintainer-clean
        -rm -f *~ \#*
 
-/* Test the contents of the directory.  */
+## Test the contents of the directory.
 check:
-       @echo "We don't have any tests for GNU Emacs yet."
+       @echo "We don't have any tests for the lib-src/ directory yet."
 
 tags: TAGS
 TAGS: etags${EXEEXT}
        etags *.[ch]
 
-/* This verifies that the non-ASCII characters in the file \`testfile\'
-   have not been clobbered by whatever means were used to copy and
-   distribute Emacs.  If they were clobbered, all the .elc files were
-   clobbered too.  */
+## This verifies that the non-ASCII characters in the file \`testfile\'
+## have not been clobbered by whatever means were used to copy and
+## distribute Emacs.  If they were clobbered, all the .elc files were
+## clobbered too.
 test-distrib${EXEEXT}: ${srcdir}/test-distrib.c
        $(CC) ${ALL_CFLAGS} -o test-distrib ${srcdir}/test-distrib.c
        ./test-distrib ${srcdir}/testfile
 
-/* We need the following in order to create a <getopt.h> when the system
-   does not have one that works with the given compiler.  */
+## We need the following in order to create a <getopt.h> when the system
+## does not have one that works with the given compiler.
 GETOPT_H = @GETOPT_H@
 getopt.h: getopt_.h
        cp $(srcdir)/getopt_.h $@-t
@@ -392,24 +328,31 @@ REGEXPOBJ = regex.o
 REGEXPDEPS = $(REGEXPOBJ) $(srcdir)/../src/regex.h
 
 regex.o: $(srcdir)/../src/regex.c $(srcdir)/../src/regex.h ../src/config.h
-       ${CC} -c ${BASE_CFLAGS} -DCONFIG_BROKETS -DINHIBIT_STRING_HEADER ${srcdir}/../src/regex.c
+       ${CC} -c ${CPP_CFLAGS} -DCONFIG_BROKETS -DINHIBIT_STRING_HEADER \
+         ${srcdir}/../src/regex.c
 
 etags${EXEEXT}: ${srcdir}/etags.c $(GETOPTDEPS) $(REGEXPDEPS) ../src/config.h
-       $(CC) ${ALL_CFLAGS} -DEMACS_NAME="\"GNU Emacs\"" -DVERSION="\"${version}\"" ${srcdir}/etags.c $(GETOPTOBJS) $(REGEXPOBJ) $(LOADLIBES) -o etags
+       $(CC) ${ALL_CFLAGS} -DEMACS_NAME="\"GNU Emacs\"" \
+         -DVERSION="\"${version}\"" ${srcdir}/etags.c $(GETOPTOBJS) \
+         $(REGEXPOBJ) $(LOADLIBES) -o etags
 
 ebrowse${EXEEXT}: ${srcdir}/ebrowse.c $(GETOPTDEPS) ../src/config.h
-       $(CC) ${ALL_CFLAGS} -DVERSION="\"${version}\"" ${srcdir}/ebrowse.c $(GETOPTOBJS) $(LOADLIBES) -o ebrowse
+       $(CC) ${ALL_CFLAGS} -DVERSION="\"${version}\"" \
+         ${srcdir}/ebrowse.c $(GETOPTOBJS) $(LOADLIBES) -o ebrowse
 
-/* We depend on etags to assure that parallel makes don\'t write two
-   etags.o files on top of each other.  */
+## We depend on etags to assure that parallel makes do not write two
+## etags.o files on top of each other.
 ctags${EXEEXT}: etags${EXEEXT}
-       $(CC) ${ALL_CFLAGS} -DCTAGS -DEMACS_NAME="\"GNU Emacs\"" -DVERSION="\"${version}\"" ${srcdir}/etags.c $(GETOPTOBJS) $(REGEXPOBJ) $(LOADLIBES) -o ctags
+       $(CC) ${ALL_CFLAGS} -DCTAGS -DEMACS_NAME="\"GNU Emacs\"" \
+         -DVERSION="\"${version}\"" ${srcdir}/etags.c $(GETOPTOBJS) \
+         $(REGEXPOBJ) $(LOADLIBES) -o ctags
 
 profile${EXEEXT}: ${srcdir}/profile.c ../src/config.h
        $(CC) ${ALL_CFLAGS} ${srcdir}/profile.c $(LOADLIBES) -o profile
 
 make-docfile${EXEEXT}: ${srcdir}/make-docfile.c ../src/config.h
-       $(CC) ${ALL_CFLAGS} ${srcdir}/make-docfile.c $(LOADLIBES) -o make-docfile
+       $(CC) ${ALL_CFLAGS} ${srcdir}/make-docfile.c $(LOADLIBES) \
+         -o make-docfile
 
 digest-doc${EXEEXT}: ${srcdir}/digest-doc.c
        $(CC) ${ALL_CFLAGS} ${srcdir}/digest-doc.c $(LOADLIBES) -o digest-doc
@@ -422,7 +365,8 @@ b2m${EXEEXT}: ${srcdir}/b2m.c ../src/config.h $(GETOPTDEPS)
           $(GETOPTOBJS) $(LOADLIBES) -o b2m
 
 movemail${EXEEXT}: movemail.o pop.o $(GETOPTDEPS)
-       $(CC) ${LINK_CFLAGS} ${MOVE_FLAGS} movemail.o pop.o $(GETOPTOBJS) $(LOADLIBES) $(LIBS_MAIL) $(LIBS_MOVE) -o movemail
+       $(CC) ${LINK_CFLAGS} ${MOVE_FLAGS} movemail.o pop.o \
+         $(GETOPTOBJS) $(LOADLIBES) $(LIBS_MOVE) -o movemail
 
 movemail.o: ${srcdir}/movemail.c ../src/config.h $(GETOPT_H)
        $(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/movemail.c
@@ -442,8 +386,11 @@ hexl${EXEEXT}: ${srcdir}/hexl.c ../src/config.h
        $(CC) ${ALL_CFLAGS} ${srcdir}/hexl.c $(LOADLIBES) -o hexl
 
 update-game-score${EXEEXT}: update-game-score.o $(GETOPTDEPS)
-       $(CC) ${LINK_CFLAGS} ${MOVE_FLAGS} update-game-score.o $(GETOPTOBJS) $(LOADLIBES) -o update-game-score
+       $(CC) ${LINK_CFLAGS} update-game-score.o $(GETOPTOBJS) \
+         $(LOADLIBES) -o update-game-score
 
 update-game-score.o: ${srcdir}/update-game-score.c ../src/config.h $(GETOPT_H)
        $(CC) -c ${CPP_CFLAGS} ${srcdir}/update-game-score.c \
          -DHAVE_SHARED_GAME_DIR="\"$(gamedir)\""
+
+## Makefile ends here.
index 7de48e6a522ec3bb4f7fe8a213ee9b0d70568f11..803d75e233c8cee53e1a92251999abaa9de67ccc 100644 (file)
@@ -64,12 +64,13 @@ struct linebuffer
   char *buffer;
 };
 
-extern char *strtok();
+extern char *strtok(char *, const char *);
 
-long *xmalloc (), *xrealloc ();
-char *concat ();
-long readline ();
-void fatal ();
+long *xmalloc (unsigned int size);
+long *xrealloc (char *ptr, unsigned int size);
+char *concat (const char *s1, const char *s2, const char *s3);
+long readline (struct linebuffer *linebuffer, register FILE *stream);
+void fatal (const char *message) NO_RETURN;
 
 /*
  * xnew -- allocate storage.  SYNOPSIS: Type *xnew (int n, Type);
@@ -90,9 +91,7 @@ struct option longopts[] =
 extern int optind;
 
 int
-main (argc, argv)
-     int argc;
-     char **argv;
+main (int argc, char **argv)
 {
   logical labels_saved, printing, header, first, last_was_blank_line;
   time_t ltoday;
@@ -171,6 +170,7 @@ main (argc, argv)
            continue;
          else if (data.buffer[1] == '\f')
            {
+              static char babyl[] = "X-Babyl-Labels: ";
              if (first)
                first = FALSE;
              else if (! last_was_blank_line)
@@ -178,7 +178,7 @@ main (argc, argv)
              /* Save labels. */
              readline (&data, stdin);
              p = strtok (data.buffer, " ,\r\n\t");
-             labels = "X-Babyl-Labels: ";
+             labels = babyl;
 
              while ((p = strtok (NULL, " ,\r\n\t")))
                labels = concat (labels, p, ", ");
@@ -219,8 +219,7 @@ main (argc, argv)
  * concatenate those of s1, s2, s3.
  */
 char *
-concat (s1, s2, s3)
-     char *s1, *s2, *s3;
+concat (const char *s1, const char *s2, const char *s3)
 {
   int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3);
   char *result = xnew (len1 + len2 + len3 + 1, char);
@@ -239,9 +238,7 @@ concat (s1, s2, s3)
  * which is the length of the line including the newline, if any.
  */
 long
-readline (linebuffer, stream)
-     struct linebuffer *linebuffer;
-     register FILE *stream;
+readline (struct linebuffer *linebuffer, register FILE *stream)
 {
   char *buffer = linebuffer->buffer;
   register char *p = linebuffer->buffer;
@@ -291,8 +288,7 @@ readline (linebuffer, stream)
  * Like malloc but get fatal error if memory is exhausted.
  */
 long *
-xmalloc (size)
-     unsigned int size;
+xmalloc (unsigned int size)
 {
   long *result = (long *) malloc (size);
   if (result == NULL)
@@ -301,9 +297,7 @@ xmalloc (size)
 }
 
 long *
-xrealloc (ptr, size)
-     char *ptr;
-     unsigned int size;
+xrealloc (char *ptr, unsigned int size)
 {
   long *result = (long *) realloc (ptr, size);
   if (result == NULL)
@@ -312,8 +306,7 @@ xrealloc (ptr, size)
 }
 
 void
-fatal (message)
-     char *message;
+fatal (const char *message)
 {
   fprintf (stderr, "%s: %s\n", progname, message);
   exit (EXIT_FAILURE);
index d8c6e620a19a300151321d0cf3c8d253550c3180..b3cb58e6d999be42c05c9c48c735644c23b2d56a 100644 (file)
@@ -31,7 +31,7 @@ but in texinfo format and sorted by function/variable name.  */
 #endif
 
 int
-main ()
+main (void)
 {
   register int ch;
   register int notfirst = 0;
index b51b4aa69657b4beb89ea5b11f583f2deb6d97e0..1fcbb8662f59ae1f67ab9da8917b48ca86665dae 100644 (file)
@@ -20,20 +20,14 @@ 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>
-#endif
-
 #include <stdio.h>
 
 #ifdef HAVE_STDLIB_H
 #include <stdlib.h>
 #endif
 
-#ifdef HAVE_STRING_H
 #include <string.h>
-#endif
-
 #include <ctype.h>
 #include <assert.h>
 #include "getopt.h"
@@ -45,12 +39,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* Conditionalize function prototypes.  */
 
-#ifdef PROTOTYPES              /* From config.h.  */
-#define P_(x) x
-#else
-#define P_(x) ()
-#endif
-
 /* Value is non-zero if strings X and Y compare equal.  */
 
 #define streq(X, Y) (*(X) == *(Y) && strcmp ((X) + 1, (Y) + 1) == 0)
@@ -261,10 +249,10 @@ struct member
   int vis;                     /* Visibility (public, ...).  */
   int flags;                   /* See F_* above.  */
   char *regexp;                        /* Matching regular expression.  */
-  char *filename;              /* Don't free this shared string.  */
+  const char *filename;                /* Don't free this shared string.  */
   int pos;                     /* Buffer position of occurrence.  */
   char *def_regexp;            /* Regular expression matching definition.  */
-  char *def_filename;          /* File name of definition.  */
+  const char *def_filename;    /* File name of definition.  */
   int def_pos;                 /* Buffer position of definition.  */
   char name[1];                        /* Member name.  */
 };
@@ -306,8 +294,8 @@ struct sym
   struct member *types;                /* List of local types.  */
   char *regexp;                        /* Matching regular expression.  */
   int pos;                     /* Buffer position.  */
-  char *filename;              /* File in which it can be found.  */
-  char *sfilename;             /* File in which members can be found.  */
+  const char *filename;                /* File in which it can be found.  */
+  const char *sfilename;       /* File in which members can be found.  */
   struct sym *namesp;          /* Namespace in which defined. .  */
   char name[1];                 /* Name of the class.  */
 };
@@ -365,7 +353,7 @@ int yyline;
 
 /* The name of the current input file.  */
 
-char *filename;
+const char *filename;
 
 /* Three character class vectors, and macros to test membership
    of characters.  */
@@ -456,7 +444,7 @@ int tk = -1;
 
 struct kw
 {
-  char *name;                  /* Spelling.  */
+  const char *name;            /* Spelling.  */
   int tk;                      /* Token value.  */
   struct kw *next;             /* Next in collision chain.  */
 };
@@ -479,62 +467,59 @@ struct search_path *search_path_tail;
 
 /* Function prototypes.  */
 
-int yylex P_ ((void));
-void yyparse P_ ((void));
-void re_init_parser P_ ((void));
-char *token_string P_ ((int));
-char *matching_regexp P_ ((void));
-void init_sym P_ ((void));
-struct sym *add_sym P_ ((char *, struct sym *));
-void add_link P_ ((struct sym *, struct sym *));
-void add_member_defn P_ ((struct sym *, char *, char *,
-                         int, unsigned, int, int, int));
-void add_member_decl P_ ((struct sym *, char *, char *, int,
-                         unsigned, int, int, int, int));
-void dump_roots P_ ((FILE *));
-void *xmalloc P_ ((int));
-void xfree P_ ((void *));
-void add_global_defn P_ ((char *, char *, int, unsigned, int, int, int));
-void add_global_decl P_ ((char *, char *, int, unsigned, int, int, int));
-void add_define P_ ((char *, char *, int));
-void mark_inherited_virtual P_ ((void));
-void leave_namespace P_ ((void));
-void enter_namespace P_ ((char *));
-void register_namespace_alias P_ ((char *, struct link *));
-void insert_keyword P_ ((char *, int));
-void re_init_scanner P_ ((void));
-void init_scanner P_ ((void));
-void usage P_ ((int));
-void version P_ ((void));
-void process_file P_ ((char *));
-void add_search_path P_ ((char *));
-FILE *open_file P_ ((char *));
-int process_pp_line P_ ((void));
-int dump_members P_ ((FILE *, struct member *));
-void dump_sym P_ ((FILE *, struct sym *));
-int dump_tree P_ ((FILE *, struct sym *));
-struct member *find_member P_ ((struct sym *, char *, int, int, unsigned));
-struct member *add_member P_ ((struct sym *, char *, int, int, unsigned));
-void mark_virtual P_ ((struct sym *));
-void mark_virtual P_ ((struct sym *));
-struct sym *make_namespace P_ ((char *, struct sym *));
-char *sym_scope P_ ((struct sym *));
-char *sym_scope_1 P_ ((struct sym *));
-int skip_to P_ ((int));
-void skip_matching P_ ((void));
-void member P_ ((struct sym *, int));
-void class_body P_ ((struct sym *, int));
-void class_definition P_ ((struct sym *, int, int, int));
-void declaration P_ ((int));
-unsigned parm_list P_ ((int *));
-char *operator_name P_ ((int *));
-struct sym *parse_classname P_ ((void));
-struct sym *parse_qualified_ident_or_type P_ ((char **));
-void parse_qualified_param_ident_or_type P_ ((char **));
-int globals P_ ((int));
-void yyerror P_ ((char *, char *));
-void usage P_ ((int)) NO_RETURN;
-void version P_ (()) NO_RETURN;
+int yylex (void);
+void yyparse (void);
+void re_init_parser (void);
+const char *token_string (int);
+char *matching_regexp (void);
+void init_sym (void);
+struct sym *add_sym (const char *, struct sym *);
+void add_link (struct sym *, struct sym *);
+void add_member_defn (struct sym *, char *, char *,
+                      int, unsigned, int, int, int);
+void add_member_decl (struct sym *, char *, char *, int,
+                      unsigned, int, int, int, int);
+void dump_roots (FILE *);
+void *xmalloc (int);
+void xfree (void *);
+void add_global_defn (char *, char *, int, unsigned, int, int, int);
+void add_global_decl (char *, char *, int, unsigned, int, int, int);
+void add_define (char *, char *, int);
+void mark_inherited_virtual (void);
+void leave_namespace (void);
+void enter_namespace (char *);
+void register_namespace_alias (char *, struct link *);
+void insert_keyword (const char *, int);
+void re_init_scanner (void);
+void init_scanner (void);
+void process_file (char *);
+void add_search_path (char *);
+FILE *open_file (char *);
+int process_pp_line (void);
+int dump_members (FILE *, struct member *);
+void dump_sym (FILE *, struct sym *);
+int dump_tree (FILE *, struct sym *);
+struct member *find_member (struct sym *, char *, int, int, unsigned);
+struct member *add_member (struct sym *, char *, int, int, unsigned);
+void mark_virtual (struct sym *);
+struct sym *make_namespace (char *, struct sym *);
+char *sym_scope (struct sym *);
+char *sym_scope_1 (struct sym *);
+int skip_to (int);
+void skip_matching (void);
+void member (struct sym *, int);
+void class_body (struct sym *, int);
+void class_definition (struct sym *, int, int, int);
+void declaration (int);
+unsigned parm_list (int *);
+char *operator_name (int *);
+struct sym *parse_classname (void);
+struct sym *parse_qualified_ident_or_type (char **);
+void parse_qualified_param_ident_or_type (char **);
+int globals (int);
+void yyerror (const char *, const char *);
+void usage (int) NO_RETURN;
+void version (void) NO_RETURN;
 
 
 \f
@@ -546,8 +531,7 @@ void version P_ (()) NO_RETURN;
    name and line number.  */
 
 void
-yyerror (format, s)
-     char *format, *s;
+yyerror (const char *format, const char *s)
 {
   fprintf (stderr, "%s:%d: ", filename, yyline);
   fprintf (stderr, format, s);
@@ -559,8 +543,7 @@ yyerror (format, s)
    available.  */
 
 void *
-xmalloc (nbytes)
-     int nbytes;
+xmalloc (int nbytes)
 {
   void *p = malloc (nbytes);
   if (p == NULL)
@@ -575,9 +558,7 @@ xmalloc (nbytes)
 /* Like realloc but print an error and exit if out of memory.  */
 
 void *
-xrealloc (p, sz)
-     void *p;
-     int sz;
+xrealloc (void *p, int sz)
 {
   p = realloc (p, sz);
   if (p == NULL)
@@ -593,8 +574,7 @@ xrealloc (p, sz)
    available..  If S is null, return null.  */
 
 char *
-xstrdup (s)
-     char *s;
+xstrdup (char *s)
 {
   if (s)
     s = strcpy (xmalloc (strlen (s) + 1), s);
@@ -611,7 +591,7 @@ xstrdup (s)
    special symbol for globals (`*Globals*').  */
 
 void
-init_sym ()
+init_sym (void)
 {
   global_symbols = add_sym (GLOBALS_NAME, NULL);
 }
@@ -625,13 +605,11 @@ init_sym ()
    create a new symbol and set it to default values.  */
 
 struct sym *
-add_sym (name, nested_in_class)
-     char *name;
-     struct sym *nested_in_class;
+add_sym (const char *name, struct sym *nested_in_class)
 {
   struct sym *sym;
   unsigned h;
-  char *s;
+  const char *s;
   struct sym *scope = nested_in_class ? nested_in_class : current_namespace;
 
   for (s = name, h = 0; *s; ++s)
@@ -654,7 +632,7 @@ add_sym (name, nested_in_class)
        }
 
       sym = (struct sym *) xmalloc (sizeof *sym + strlen (name));
-      bzero (sym, sizeof *sym);
+      memset (sym, 0, sizeof *sym);
       strcpy (sym->name, name);
       sym->namesp = scope;
       sym->next = class_table[h];
@@ -668,8 +646,7 @@ add_sym (name, nested_in_class)
 /* Add links between superclass SUPER and subclass SUB.  */
 
 void
-add_link (super, sub)
-     struct sym *super, *sub;
+add_link (struct sym *super, struct sym *sub)
 {
   struct link *lnk, *lnk2, *p, *prev;
 
@@ -709,11 +686,7 @@ add_link (super, sub)
    found or null if not found.  */
 
 struct member *
-find_member (cls, name, var, sc, hash)
-     struct sym *cls;
-     char *name;
-     int var, sc;
-     unsigned hash;
+find_member (struct sym *cls, char *name, int var, int sc, unsigned int hash)
 {
   struct member **list;
   struct member *p;
@@ -763,16 +736,7 @@ find_member (cls, name, var, sc, hash)
    F_* defines).  */
 
 void
-add_member_decl (cls, name, regexp, pos, hash, var, sc, vis, flags)
-     struct sym *cls;
-     char *name;
-     char *regexp;
-     int pos;
-     unsigned hash;
-     int var;
-     int sc;
-     int vis;
-     int flags;
+add_member_decl (struct sym *cls, char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int vis, int flags)
 {
   struct member *m;
 
@@ -820,15 +784,7 @@ add_member_decl (cls, name, regexp, pos, hash, var, sc, vis, flags)
    F_* defines).  */
 
 void
-add_member_defn (cls, name, regexp, pos, hash, var, sc, flags)
-     struct sym *cls;
-     char *name;
-     char *regexp;
-     int pos;
-     unsigned hash;
-     int var;
-     int sc;
-     int flags;
+add_member_defn (struct sym *cls, char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int flags)
 {
   struct member *m;
 
@@ -870,9 +826,7 @@ add_member_defn (cls, name, regexp, pos, hash, var, sc, flags)
    if it is non-null.  POS is the position in the file.  */
 
 void
-add_define (name, regexp, pos)
-     char *name, *regexp;
-     int pos;
+add_define (char *name, char *regexp, int pos)
 {
   add_global_defn (name, regexp, pos, 0, 1, SC_FRIEND, F_DEFINE);
   add_global_decl (name, regexp, pos, 0, 1, SC_FRIEND, F_DEFINE);
@@ -890,13 +844,7 @@ add_define (name, regexp, pos)
    F_* defines).  */
 
 void
-add_global_defn (name, regexp, pos, hash, var, sc, flags)
-     char *name, *regexp;
-     int pos;
-     unsigned hash;
-     int var;
-     int sc;
-     int flags;
+add_global_defn (char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int flags)
 {
   int i;
   struct sym *sym;
@@ -927,13 +875,7 @@ add_global_defn (name, regexp, pos, hash, var, sc, flags)
    F_* defines).  */
 
 void
-add_global_decl (name, regexp, pos, hash, var, sc, flags)
-     char *name, *regexp;
-     int pos;
-     unsigned hash;
-     int var;
-     int sc;
-     int flags;
+add_global_decl (char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int flags)
 {
   /* Add declaration only if not already declared.  Header files must
      be processed before source files for this to have the right effect.
@@ -972,12 +914,7 @@ add_global_decl (name, regexp, pos, hash, var, sc, flags)
    Value is a pointer to the member's structure.  */
 
 struct member *
-add_member (cls, name, var, sc, hash)
-     struct sym *cls;
-     char *name;
-     int var;
-     int sc;
-     unsigned hash;
+add_member (struct sym *cls, char *name, int var, int sc, unsigned int hash)
 {
   struct member *m = (struct member *) xmalloc (sizeof *m + strlen (name));
   struct member **list;
@@ -1048,8 +985,7 @@ add_member (cls, name, var, sc, hash)
    in base classes.  */
 
 void
-mark_virtual (r)
-     struct sym *r;
+mark_virtual (struct sym *r)
 {
   struct link *p;
   struct member *m, *m2;
@@ -1073,7 +1009,7 @@ mark_virtual (r)
    are virtual because of a virtual declaration in a base class.  */
 
 void
-mark_inherited_virtual ()
+mark_inherited_virtual (void)
 {
   struct sym *r;
   int i;
@@ -1088,12 +1024,10 @@ mark_inherited_virtual ()
 /* Create and return a symbol for a namespace with name NAME.  */
 
 struct sym *
-make_namespace (name, context)
-     char *name;
-     struct sym *context;
+make_namespace (char *name, struct sym *context)
 {
   struct sym *s = (struct sym *) xmalloc (sizeof *s + strlen (name));
-  bzero (s, sizeof *s);
+  memset (s, 0, sizeof *s);
   strcpy (s->name, name);
   s->next = all_namespaces;
   s->namesp = context;
@@ -1105,9 +1039,7 @@ make_namespace (name, context)
 /* Find the symbol for namespace NAME.  If not found, retrun NULL */
 
 struct sym *
-check_namespace (name, context)
-     char *name;
-     struct sym *context;
+check_namespace (char *name, struct sym *context)
 {
   struct sym *p = NULL;
 
@@ -1115,18 +1047,16 @@ check_namespace (name, context)
     {
       if (streq (p->name, name) && (p->namesp == context))
            break;
-       }
+    }
 
   return p;
-    }
+}
 
 /* Find the symbol for namespace NAME.  If not found, add a new symbol
    for NAME to all_namespaces.  */
 
 struct sym *
-find_namespace (name, context)
-     char *name;
-     struct sym *context;
+find_namespace (char *name, struct sym *context)
 {
   struct sym *p = check_namespace (name, context);
 
@@ -1140,8 +1070,7 @@ find_namespace (name, context)
 /* Find namespace alias with name NAME. If not found return NULL. */
 
 struct link *
-check_namespace_alias (name)
-    char *name;
+check_namespace_alias (char *name)
 {
   struct link *p = NULL;
   struct alias *al;
@@ -1165,9 +1094,7 @@ check_namespace_alias (name)
 /* Register the name NEW_NAME as an alias for namespace list OLD_NAME.  */
 
 void
-register_namespace_alias (new_name, old_name)
-     char *new_name;
-     struct link *old_name;
+register_namespace_alias (char *new_name, struct link *old_name)
 {
   unsigned h;
   char *s;
@@ -1195,8 +1122,7 @@ register_namespace_alias (new_name, old_name)
 /* Enter namespace with name NAME.  */
 
 void
-enter_namespace (name)
-     char *name;
+enter_namespace (char *name)
 {
   struct sym *p = find_namespace (name, current_namespace);
 
@@ -1217,7 +1143,7 @@ enter_namespace (name)
 /* Leave the current namespace.  */
 
 void
-leave_namespace ()
+leave_namespace (void)
 {
   assert (namespace_sp > 0);
   current_namespace = namespace_stack[--namespace_sp];
@@ -1259,8 +1185,7 @@ int scope_buffer_len;
 /* Make sure scope_buffer has enough room to add LEN chars to it.  */
 
 void
-ensure_scope_buffer_room (len)
-     int len;
+ensure_scope_buffer_room (int len)
 {
   if (scope_buffer_len + len >= scope_buffer_size)
     {
@@ -1276,8 +1201,7 @@ ensure_scope_buffer_room (len)
    scope name constructed.  */
 
 char *
-sym_scope_1 (p)
-     struct sym *p;
+sym_scope_1 (struct sym *p)
 {
   int len;
 
@@ -1311,8 +1235,7 @@ sym_scope_1 (p)
    as it would appear in a C*+ source file.  */
 
 char *
-sym_scope (p)
-     struct sym *p;
+sym_scope (struct sym *p)
 {
   if (!scope_buffer)
     {
@@ -1334,9 +1257,7 @@ sym_scope (p)
    list.  */
 
 int
-dump_members (fp, m)
-     FILE *fp;
-     struct member *m;
+dump_members (FILE *fp, struct member *m)
 {
   int n;
 
@@ -1369,9 +1290,7 @@ dump_members (fp, m)
 /* Dump class ROOT to stream FP.  */
 
 void
-dump_sym (fp, root)
-     FILE *fp;
-     struct sym *root;
+dump_sym (FILE *fp, struct sym *root)
 {
   fputs (CLASS_STRUCT, fp);
   PUTSTR (root->name, fp);
@@ -1397,9 +1316,7 @@ dump_sym (fp, root)
    number of classes written.  */
 
 int
-dump_tree (fp, root)
-     FILE *fp;
-     struct sym *root;
+dump_tree (FILE *fp, struct sym *root)
 {
   struct link *lk;
   unsigned n = 0;
@@ -1446,8 +1363,7 @@ dump_tree (fp, root)
 /* Dump the entire class tree to file FP.  */
 
 void
-dump_roots (fp)
-     FILE *fp;
+dump_roots (FILE *fp)
 {
   int i, n = 0;
   struct sym *r;
@@ -1521,7 +1437,7 @@ do {                                              \
    input buffer not consumed.  */
 
 int
-process_pp_line ()
+process_pp_line (void)
 {
   int in_comment = 0, in_string = 0;
   int c;
@@ -1592,7 +1508,7 @@ process_pp_line ()
 /* Value is the next token from the input buffer.  */
 
 int
-yylex ()
+yylex (void)
 {
   int c;
   char end_char;
@@ -2009,7 +1925,7 @@ static char *matching_regexp_buffer, *matching_regexp_end_buf;
    shorter than min_regexp.  */
 
 char *
-matching_regexp ()
+matching_regexp (void)
 {
   char *p;
   char *s;
@@ -2059,9 +1975,8 @@ matching_regexp ()
 
 /* Return a printable representation of token T.  */
 
-char *
-token_string (t)
-     int t;
+const char *
+token_string (int t)
 {
   static char b[3];
 
@@ -2178,7 +2093,7 @@ token_string (t)
 /* Reinitialize the scanner for a new input file.  */
 
 void
-re_init_scanner ()
+re_init_scanner (void)
 {
   in = inbuffer;
   yyline = 1;
@@ -2196,11 +2111,9 @@ re_init_scanner ()
    table.  */
 
 void
-insert_keyword (name, tk)
-     char *name;
-     int tk;
+insert_keyword (const char *name, int tk)
 {
-  char *s;
+  const char *s;
   unsigned h = 0;
   struct kw *k = (struct kw *) xmalloc (sizeof *k);
 
@@ -2219,7 +2132,7 @@ insert_keyword (name, tk)
    character class vectors and fills the keyword hash table.  */
 
 void
-init_scanner ()
+init_scanner (void)
 {
   int i;
 
@@ -2363,8 +2276,7 @@ init_scanner ()
    the current lookahead token after skipping.  */
 
 int
-skip_to (token)
-     int token;
+skip_to (int token)
 {
   while (!LOOKING_AT2 (YYEOF, token))
     MATCH ();
@@ -2375,7 +2287,7 @@ skip_to (token)
    angle brackets, curly brackets) matching the current lookahead.  */
 
 void
-skip_matching ()
+skip_matching (void)
 {
   int open, close, n;
 
@@ -2418,7 +2330,7 @@ skip_matching ()
 }
 
 void
-skip_initializer ()
+skip_initializer (void)
 {
   for (;;)
     {
@@ -2445,7 +2357,7 @@ skip_initializer ()
 /* Build qualified namespace alias (A::B::c) and return it. */
 
 struct link *
-match_qualified_namespace_alias ()
+match_qualified_namespace_alias (void)
 {
   struct link *head = NULL;
   struct link *cur = NULL;
@@ -2458,7 +2370,7 @@ match_qualified_namespace_alias ()
         {
         case IDENT:
           tmp = (struct link *) xmalloc (sizeof *cur);
-          tmp->sym = find_namespace (yytext, cur);
+          tmp->sym = find_namespace (yytext, cur ? cur->sym : NULL);
           tmp->next = NULL;
           if (head)
             {
@@ -2482,7 +2394,7 @@ match_qualified_namespace_alias ()
 /* Re-initialize the parser by resetting the lookahead token.  */
 
 void
-re_init_parser ()
+re_init_parser (void)
 {
   tk = -1;
 }
@@ -2495,8 +2407,7 @@ re_init_parser ()
    distinguish between overloaded functions.  */
 
 unsigned
-parm_list (flags)
-     int *flags;
+parm_list (int *flags)
 {
   unsigned hash = 0;
   int type_seen = 0;
@@ -2609,7 +2520,7 @@ parm_list (flags)
 /* Print position info to stdout.  */
 
 void
-print_info ()
+print_info (void)
 {
   if (info_position >= 0 && BUFFER_POS () <= info_position)
     if (info_cls)
@@ -2624,9 +2535,7 @@ print_info ()
    public).  */
 
 void
-member (cls, vis)
-     struct sym *cls;
-     int vis;
+member (struct sym *cls, int vis)
 {
   char *id = NULL;
   int sc = SC_MEMBER;
@@ -2835,9 +2744,7 @@ member (cls, vis)
    union, class).  */
 
 void
-class_body (cls, tag)
-     struct sym *cls;
-     int tag;
+class_body (struct sym *cls, int tag)
 {
   int vis = tag == CLASS ? PRIVATE : PUBLIC;
   int temp;
@@ -2898,7 +2805,7 @@ class_body (cls, tag)
    symbol for that class.  */
 
 struct sym *
-parse_classname ()
+parse_classname (void)
 {
   struct sym *last_class = NULL;
 
@@ -2928,12 +2835,11 @@ parse_classname ()
    a static buffer holding the constructed operator name string.  */
 
 char *
-operator_name (sc)
-     int *sc;
+operator_name (int *sc)
 {
   static int id_size = 0;
   static char *id = NULL;
-  char *s;
+  const char *s;
   int len;
 
   MATCH ();
@@ -3019,8 +2925,7 @@ operator_name (sc)
    symbol structure for the ident.  */
 
 struct sym *
-parse_qualified_ident_or_type (last_id)
-     char **last_id;
+parse_qualified_ident_or_type (char **last_id)
 {
   struct sym *cls = NULL;
   char *id = NULL;
@@ -3085,8 +2990,7 @@ parse_qualified_ident_or_type (last_id)
    symbol structure for the ident.  */
 
 void
-parse_qualified_param_ident_or_type (last_id)
-     char **last_id;
+parse_qualified_param_ident_or_type (char **last_id)
 {
   struct sym *cls = NULL;
   static char *id = NULL;
@@ -3128,11 +3032,7 @@ parse_qualified_param_ident_or_type (last_id)
    Current lookahead is the class name.  */
 
 void
-class_definition (containing, tag, flags, nested)
-     struct sym *containing;
-     int tag;
-     int flags;
-     int nested;
+class_definition (struct sym *containing, int tag, int flags, int nested)
 {
   struct sym *current;
   struct sym *base_class;
@@ -3229,10 +3129,7 @@ class_definition (containing, tag, flags, nested)
    information about the member (see the F_* defines).  */
 
 void
-add_declarator (cls, id, flags, sc)
-     struct sym **cls;
-     char **id;
-     int flags, sc;
+add_declarator (struct sym **cls, char **id, int flags, int sc)
 {
   if (LOOKING_AT2 (';', ','))
     {
@@ -3275,8 +3172,7 @@ add_declarator (cls, id, flags, sc)
 /* Parse a declaration.  */
 
 void
-declaration (flags)
-     int flags;
+declaration (int flags)
 {
   char *id = NULL;
   struct sym *cls = NULL;
@@ -3430,8 +3326,7 @@ declaration (flags)
    otherwise.  */
 
 int
-globals (start_flags)
-     int start_flags;
+globals (int start_flags)
 {
   int anonymous;
   int class_tk;
@@ -3549,7 +3444,7 @@ globals (start_flags)
 /* Parse the current input file.  */
 
 void
-yyparse ()
+yyparse (void)
 {
   while (globals (0) == 0)
     MATCH_IF ('}');
@@ -3565,8 +3460,7 @@ yyparse ()
    input files.  */
 
 void
-add_search_path (path_list)
-     char *path_list;
+add_search_path (char *path_list)
 {
   while (*path_list)
     {
@@ -3601,8 +3495,7 @@ add_search_path (path_list)
    unchanged file name.  */
 
 FILE *
-open_file (file)
-     char *file;
+open_file (char *file)
 {
   FILE *fp = NULL;
   static char *buffer;
@@ -3661,8 +3554,7 @@ Usage: ebrowse [options] {files}\n\
 "
 
 void
-usage (error)
-     int error;
+usage (int error)
 {
   puts (USAGE);
   exit (error ? EXIT_FAILURE : EXIT_SUCCESS);
@@ -3677,7 +3569,7 @@ usage (error)
 #endif
 
 void
-version ()
+version (void)
 {
   /* Makes it easier to update automatically. */
   char emacs_copyright[] = "Copyright (C) 2010 Free Software Foundation, Inc.";
@@ -3693,8 +3585,7 @@ version ()
    table.  */
 
 void
-process_file (file)
-     char *file;
+process_file (char *file)
 {
   FILE *fp;
 
@@ -3749,8 +3640,7 @@ process_file (file)
    is null when EOF is reached.  */
 
 char *
-read_line (fp)
-     FILE *fp;
+read_line (FILE *fp)
 {
   static char *buffer;
   static int buffer_size;
@@ -3786,13 +3676,11 @@ read_line (fp)
 /* Main entry point.  */
 
 int
-main (argc, argv)
-     int argc;
-     char **argv;
+main (int argc, char **argv)
 {
   int i;
   int any_inputfiles = 0;
-  static char *out_filename = DEFAULT_OUTFILE;
+  static const char *out_filename = DEFAULT_OUTFILE;
   static char **input_filenames = NULL;
   static int input_filenames_size = 0;
   static int n_input_files;
index 01241b518bbbdf4ae001ecc86f5a88f79e22727d..e8ffbe7c562f48959f57135fe44fe4f9ae21722b 100644 (file)
@@ -18,9 +18,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>
-#endif
 
 #ifdef WINDOWSNT
 
@@ -32,6 +30,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 # include <stdlib.h>
 # include <windows.h>
 # include <commctrl.h>
+# include <io.h>
+# include <winsock2.h>
 
 # define NO_SOCKETS_IN_FILE_SYSTEM
 
@@ -45,8 +45,12 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 # ifdef HAVE_INET_SOCKETS
 #  include <netinet/in.h>
+#  ifdef HAVE_SOCKETS
+#    include <sys/types.h>
+#    include <sys/socket.h>
+#    include <sys/un.h>
+#  endif /* HAVE_SOCKETS */
 # endif
-
 # include <arpa/inet.h>
 
 # define INVALID_SOCKET -1
@@ -67,25 +71,23 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <stdio.h>
 #include "getopt.h"
 #ifdef HAVE_UNISTD_H
-#include <unistd.h>
+# include <unistd.h>
 #endif
 
-#ifdef WINDOWSNT
-# include <io.h>
-#else /* not WINDOWSNT */
-# include <pwd.h>
-#endif /* not WINDOWSNT */
+#include <pwd.h>
 #include <sys/stat.h>
-
 #include <signal.h>
 #include <errno.h>
 
+
 \f
-char *getenv (), *getwd ();
-char *(getcwd) ();
+char *getenv (const char *), *getwd (char *);
+#ifdef HAVE_GETCWD
+char *(getcwd) (char *, size_t);
+#endif
 
 #ifdef WINDOWSNT
-char *w32_getenv ();
+char *w32_getenv (char *);
 #define egetenv(VAR) w32_getenv(VAR)
 #else
 #define egetenv(VAR) getenv(VAR)
@@ -112,10 +114,6 @@ char *w32_getenv ();
 #define TRUE 1
 #endif
 
-#ifndef NO_RETURN
-#define NO_RETURN
-#endif
-
 /* Additional space when allocating buffers for filenames, etc.  */
 #define EXTRA_SPACE 100
 
@@ -136,7 +134,10 @@ int eval = 0;
 int current_frame = 1;
 
 /* The display on which Emacs should work.  --display.  */
-char *display = NULL;
+const char *display = NULL;
+
+/* The parent window ID, if we are opening a frame via XEmbed.  */
+char *parent_id = NULL;
 
 /* Nonzero means open a new Emacs frame on the current terminal. */
 int tty = 0;
@@ -149,12 +150,14 @@ const char *alternate_editor = NULL;
 char *socket_name = NULL;
 
 /* If non-NULL, the filename of the authentication file.  */
-char *server_file = NULL;
+const char *server_file = NULL;
 
 /* PID of the Emacs server process.  */
 int emacs_pid = 0;
 
-void print_help_and_exit () NO_RETURN;
+void print_help_and_exit (void) NO_RETURN;
+void fail (void) NO_RETURN;
+
 
 struct option longopts[] =
 {
@@ -173,6 +176,7 @@ struct option longopts[] =
 #ifndef WINDOWSNT
   { "display", required_argument, NULL, 'd' },
 #endif
+  { "parent-id", required_argument, NULL, 'p' },
   { 0, 0, 0, 0 }
 };
 
@@ -180,8 +184,7 @@ struct option longopts[] =
 /* Like malloc but get fatal error if memory is exhausted.  */
 
 long *
-xmalloc (size)
-     unsigned int size;
+xmalloc (unsigned int size)
 {
   long *result = (long *) malloc (size);
   if (result == NULL)
@@ -232,7 +235,7 @@ xstrdup (const char *s)
    Any other returned value must be freed with free.  This is used
    only when get_current_dir_name is not defined on the system.  */
 char*
-get_current_dir_name ()
+get_current_dir_name (void)
 {
   char *buf;
   char *pwd;
@@ -308,10 +311,7 @@ get_current_dir_name ()
    Return NULL if the variable was not found, or it was empty.
    This code is based on w32_get_resource (w32.c).  */
 char *
-w32_get_resource (predefined, key, type)
-     HKEY predefined;
-     char *key;
-     LPDWORD type;
+w32_get_resource (HKEY predefined, char *key, LPDWORD type)
 {
   HKEY hrootkey = NULL;
   char *result = NULL;
@@ -344,8 +344,7 @@ w32_get_resource (predefined, key, type)
   variables in the registry if they don't appear in the environment.
 */
 char *
-w32_getenv (envvar)
-     char *envvar;
+w32_getenv (char *envvar)
 {
   char *value;
   DWORD dwType;
@@ -393,7 +392,7 @@ w32_getenv (envvar)
 }
 
 void
-w32_set_user_model_id ()
+w32_set_user_model_id (void)
 {
   HMODULE shell;
   HRESULT (WINAPI * set_user_model) (wchar_t * id);
@@ -401,7 +400,7 @@ w32_set_user_model_id ()
   /* On Windows 7 and later, we need to set the user model ID
      to associate emacsclient launched files with Emacs frames
      in the UI.  */
-  shell = LoadLibrary("shell32.dll");
+  shell = LoadLibrary ("shell32.dll");
   if (shell)
     {
       set_user_model
@@ -420,7 +419,7 @@ w32_set_user_model_id ()
 }
 
 int
-w32_window_app ()
+w32_window_app (void)
 {
   static int window_app = -1;
   char szTitle[MAX_PATH];
@@ -431,7 +430,7 @@ w32_window_app ()
          nonconsole apps.  Testing for the console title seems to work. */
       window_app = (GetConsoleTitleA (szTitle, MAX_PATH) == 0);
       if (window_app)
-        InitCommonControls();
+        InitCommonControls ();
     }
 
   return window_app;
@@ -443,13 +442,11 @@ w32_window_app ()
   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
+  predictably bad results.  By contrast, POSIX execvp passes the arguments
   directly into the argv array of the child process.
 */
 int
-w32_execvp (path, argv)
-     char *path;
-     char **argv;
+w32_execvp (const char *path, char **argv)
 {
   int i;
 
@@ -482,9 +479,9 @@ ttyname (int fd)
 /* Display a normal or error message.
    On Windows, use a message box if compiled as a Windows app.  */
 void
-message (int is_error, char *message, ...)
+message (int is_error, const char *message, ...)
 {
-  char msg [2048];
+  char msg[2048];
   va_list args;
 
   va_start (args, message);
@@ -513,9 +510,7 @@ message (int is_error, char *message, ...)
    The global variable `optind' will say how many arguments we used up.  */
 
 void
-decode_options (argc, argv)
-     int argc;
-     char **argv;
+decode_options (int argc, char **argv)
 {
   alternate_editor = egetenv ("ALTERNATE_EDITOR");
 
@@ -583,6 +578,11 @@ decode_options (argc, argv)
           current_frame = 0;
           break;
 
+       case 'p':
+         parent_id = optarg;
+          current_frame = 0;
+         break;
+
        case 'H':
          print_help_and_exit ();
          break;
@@ -636,7 +636,7 @@ an empty string");
 
 \f
 void
-print_help_and_exit ()
+print_help_and_exit (void)
 {
   /* Spaces and tabs are significant in this message; they're chosen so the
      message aligns properly both in a tty and in a Windows message box.
@@ -656,7 +656,8 @@ The following OPTIONS are accepted:\n\
 -e, --eval             Evaluate the FILE arguments as ELisp expressions\n\
 -n, --no-wait          Don't wait for the server to return\n\
 -d DISPLAY, --display=DISPLAY\n\
-                       Visit the file in the given display\n"
+                       Visit the file in the given display\n\
+--parent-id=ID          Open in parent window ID, via XEmbed\n"
 #ifndef NO_SOCKETS_IN_FILE_SYSTEM
 "-s SOCKET, --socket-name=SOCKET\n\
                        Set filename of the UNIX socket for communication\n"
@@ -697,9 +698,7 @@ fail (void)
 #if !defined (HAVE_SOCKETS) || !defined (HAVE_INET_SOCKETS)
 
 int
-main (argc, argv)
-     int argc;
-     char **argv;
+main (int argc, char **argv)
 {
   main_argv = argv;
   progname = argv[0];
@@ -711,19 +710,10 @@ main (argc, argv)
 
 #else /* HAVE_SOCKETS && HAVE_INET_SOCKETS */
 
-#ifdef WINDOWSNT
-# include <winsock2.h>
-#else
-# include <sys/types.h>
-# include <sys/socket.h>
-# include <sys/un.h>
-#endif
-
 #define AUTH_KEY_LENGTH      64
 #define SEND_BUFFER_SIZE   4096
 
-extern char *strerror ();
-extern int errno;
+extern char *strerror (int);
 
 /* Buffer to accumulate data to send in TCP connections.  */
 char send_buffer[SEND_BUFFER_SIZE + 1];
@@ -734,8 +724,7 @@ HSOCKET emacs_socket = 0;
 /* On Windows, the socket library was historically separate from the standard
    C library, so errors are handled differently.  */
 void
-sock_err_message (function_name)
-     char *function_name;
+sock_err_message (const char *function_name)
 {
 #ifdef WINDOWSNT
   char* msg = NULL;
@@ -759,9 +748,7 @@ sock_err_message (function_name)
    - the buffer is full (but this shouldn't happen)
    Otherwise, we just accumulate it.  */
 void
-send_to_emacs (s, data)
-     HSOCKET s;
-     char *data;
+send_to_emacs (HSOCKET s, const char *data)
 {
   while (data)
     {
@@ -798,14 +785,13 @@ send_to_emacs (s, data)
    any initial -.  Change spaces to underscores, too, so that the
    return value never contains a space.
 
-   Does not change the string.  Outputs the result to STREAM.  */
+   Does not change the string.  Outputs the result to S.  */
 void
-quote_argument (s, str)
-     HSOCKET s;
-     char *str;
+quote_argument (HSOCKET s, const char *str)
 {
   char *copy = (char *) xmalloc (strlen (str) * 2 + 1);
-  char *p, *q;
+  const char *p;
+  char *q;
 
   p = str;
   q = copy;
@@ -842,8 +828,7 @@ quote_argument (s, str)
    modifying the string in place.   Returns STR. */
 
 char *
-unquote_argument (str)
-     char *str;
+unquote_argument (char *str)
 {
   char *p, *q;
 
@@ -874,8 +859,7 @@ unquote_argument (str)
 
 \f
 int
-file_name_absolute_p (filename)
-     const unsigned char *filename;
+file_name_absolute_p (const unsigned char *filename)
 {
   /* Sanity check, it shouldn't happen.  */
   if (! filename) return FALSE;
@@ -901,15 +885,15 @@ file_name_absolute_p (filename)
 
 #ifdef WINDOWSNT
 /* Wrapper to make WSACleanup a cdecl, as required by atexit.  */
-void
-__cdecl close_winsock ()
+void __cdecl
+close_winsock (void)
 {
   WSACleanup ();
 }
 
 /* Initialize the WinSock2 library.  */
 void
-initialize_sockets ()
+initialize_sockets (void)
 {
   WSADATA wsaData;
 
@@ -929,9 +913,7 @@ initialize_sockets ()
  * the Emacs server: host, port, pid and authentication string.
  */
 int
-get_server_config (server, authentication)
-     struct sockaddr_in *server;
-     char *authentication;
+get_server_config (struct sockaddr_in *server, char *authentication)
 {
   char dotted[32];
   char *port;
@@ -996,7 +978,7 @@ get_server_config (server, authentication)
 }
 
 HSOCKET
-set_tcp_socket ()
+set_tcp_socket (void)
 {
   HSOCKET s;
   struct sockaddr_in server;
@@ -1045,7 +1027,7 @@ set_tcp_socket ()
 
 /* Returns 1 if PREFIX is a prefix of STRING. */
 static int
-strprefix (char *prefix, char *string)
+strprefix (const char *prefix, const char *string)
 {
   return !strncmp (prefix, string, strlen (prefix));
 }
@@ -1110,8 +1092,7 @@ find_tty (char **tty_type, char **tty_name, int noabort)
    0 - success: none of the above */
 
 static int
-socket_status (socket_name)
-     char *socket_name;
+socket_status (char *socket_name)
 {
   struct stat statbfr;
 
@@ -1214,7 +1195,7 @@ init_signals (void)
 
 
 HSOCKET
-set_local_socket ()
+set_local_socket (void)
 {
   HSOCKET s;
   struct sockaddr_un server;
@@ -1235,11 +1216,13 @@ set_local_socket ()
     int sock_status = 0;
     int default_sock = !socket_name;
     int saved_errno = 0;
-    char *server_name = "server";
-    char *tmpdir;
+    const char *server_name = "server";
+    const char *tmpdir;
 
-    if (socket_name && !index (socket_name, '/') && !index (socket_name, '\\'))
-      { /* socket_name is a file name component.  */
+    if (socket_name && !strchr (socket_name, '/')
+       && !strchr (socket_name, '\\'))
+      {
+       /* socket_name is a file name component.  */
        server_name = socket_name;
        socket_name = NULL;
        default_sock = 1;       /* Try both UIDs.  */
@@ -1410,9 +1393,7 @@ FARPROC set_fg;  /* Pointer to AllowSetForegroundWindow.  */
 FARPROC get_wc;  /* Pointer to RealGetWindowClassA.  */
 
 BOOL CALLBACK
-w32_find_emacs_process (hWnd, lParam)
-     HWND hWnd;
-     LPARAM lParam;
+w32_find_emacs_process (HWND hWnd, LPARAM lParam)
 {
   DWORD pid;
   char class[6];
@@ -1440,7 +1421,7 @@ w32_find_emacs_process (hWnd, lParam)
  * process id = emacs_pid.  If found, allow it to grab the focus.
  */
 void
-w32_give_focus ()
+w32_give_focus (void)
 {
   HANDLE user32;
 
@@ -1478,7 +1459,7 @@ start_daemon_and_retry_set_socket (void)
       pid_t w;
       w = waitpid (dpid, &status, WUNTRACED | WCONTINUED);
 
-      if ((w == -1) || !WIFEXITED (status) || WEXITSTATUS(status))
+      if ((w == -1) || !WIFEXITED (status) || WEXITSTATUS (status))
        {
          message (TRUE, "Error: Could not start the Emacs daemon\n");
          exit (EXIT_FAILURE);
@@ -1499,11 +1480,13 @@ start_daemon_and_retry_set_socket (void)
     }
   else
     {
-      char *d_argv[] = {"emacs", "--daemon", 0 };
+      char emacs[] = "emacs";
+      char daemon[] = "--daemon";
+      char *d_argv[] = {emacs, daemon, 0 };
       if (socket_name != NULL)
        {
          /* Pass  --daemon=socket_name as argument.  */
-         char *deq = "--daemon=";
+         const char *deq = "--daemon=";
          char *daemon_arg = alloca (strlen (deq)
                                     + strlen (socket_name) + 1);
          strcpy (daemon_arg, deq);
@@ -1517,9 +1500,7 @@ start_daemon_and_retry_set_socket (void)
 }
 
 int
-main (argc, argv)
-     int argc;
-     char **argv;
+main (int argc, char **argv)
 {
   int i, rl, needlf = 0;
   char *cwd, *str;
@@ -1621,6 +1602,13 @@ main (argc, argv)
       send_to_emacs (emacs_socket, " ");
     }
 
+  if (parent_id)
+    {
+      send_to_emacs (emacs_socket, "-parent-id ");
+      quote_argument (emacs_socket, parent_id);
+      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.  */
index 17aad9a225296e96be2d113d91e5c0870073f5de..42e4017ab5037ed275edb8e76bc5e6bc09116797 100644 (file)
@@ -100,15 +100,10 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4";
 # ifndef PTR                   /* for XEmacs */
 #   define PTR void *
 # endif
-# ifndef __P                   /* for XEmacs */
-#   define __P(args) args
-# endif
 #else  /* no config.h */
 # if defined(__STDC__) && (__STDC__ || defined(__SUNPRO_C))
-#   define __P(args) args      /* use prototypes */
 #   define PTR void *          /* for generic pointers */
 # else /* not standard C */
-#   define __P(args) ()                /* no prototypes */
 #   define const               /* remove const for old compilers' sake */
 #   define PTR long *          /* don't use void* */
 # endif
@@ -158,20 +153,20 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4";
 #  include <stdlib.h>
 #  include <string.h>
 # else /* no standard C headers */
-   extern char *getenv __P((const char *));
-   extern char *strcpy __P((char *, const char *));
-   extern char *strncpy __P((char *, const char *, unsigned long));
-   extern char *strcat __P((char *, const char *));
-   extern char *strncat __P((char *, const char *, unsigned long));
-   extern int strcmp __P((const char *, const char *));
-   extern int strncmp __P((const char *, const char *, unsigned long));
-   extern int system __P((const char *));
-   extern unsigned long strlen __P((const char *));
-   extern void *malloc __P((unsigned long));
-   extern void *realloc __P((void *, unsigned long));
-   extern void exit __P((int));
-   extern void free __P((void *));
-   extern void *memmove __P((void *, const void *, unsigned long));
+   extern char *getenv (const char *);
+   extern char *strcpy (char *, const char *);
+   extern char *strncpy (char *, const char *, unsigned long);
+   extern char *strcat (char *, const char *);
+   extern char *strncat (char *, const char *, unsigned long);
+   extern int strcmp (const char *, const char *);
+   extern int strncmp (const char *, const char *, unsigned long);
+   extern int system (const char *);
+   extern unsigned long strlen (const char *);
+   extern void *malloc (unsigned long);
+   extern void *realloc (void *, unsigned long);
+   extern void exit (int);
+   extern void free (void *);
+   extern void *memmove (void *, const void *, unsigned long);
 #  define EXIT_SUCCESS 0
 #  define EXIT_FAILURE 1
 # endif
@@ -188,9 +183,6 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4";
 #include <stdio.h>
 #include <ctype.h>
 #include <errno.h>
-#ifndef errno
-  extern int errno;
-#endif
 #include <sys/types.h>
 #include <sys/stat.h>
 
@@ -276,22 +268,22 @@ If you want regular expression support, you should delete this notice and
 
 #define bool int
 
-typedef void Lang_function __P((FILE *));
+typedef void Lang_function (FILE *);
 
 typedef struct
 {
-  char *suffix;                        /* file name suffix for this compressor */
-  char *command;               /* takes one arg and decompresses to stdout */
+  const char *suffix;           /* file name suffix for this compressor */
+  const char *command;         /* takes one arg and decompresses to stdout */
 } compressor;
 
 typedef struct
 {
-  char *name;                  /* language name */
-  char *help;                   /* detailed help for the language */
+  const char *name;             /* language name */
+  const char *help;            /* detailed help for the language */
   Lang_function *function;     /* parse function */
-  char **suffixes;             /* name suffixes of this language's files */
-  char **filenames;            /* names of this language's files */
-  char **interpreters;         /* interpreters for this language */
+  const char **suffixes;        /* name suffixes of this language's files */
+  const char **filenames;       /* names of this language's files */
+  const char **interpreters;    /* interpreters for this language */
   bool metasource;             /* source used to generate other sources */
 } language;
 
@@ -312,7 +304,7 @@ typedef struct node_st
 {                              /* sorting structure */
   struct node_st *left, *right;        /* left and right sons */
   fdesc *fdp;                  /* description of file to whom tag belongs */
-  char *name;                  /* tag name */
+  char *name;                  /* tag name */
   char *regex;                 /* search regexp */
   bool valid;                  /* write this tag on the tag file */
   bool is_func;                        /* function tag: use regexp in CTAGS mode */
@@ -368,87 +360,87 @@ typedef struct regexp
 /* Many compilers barf on this:
        Lang_function Ada_funcs;
    so let's write it this way */
-static void Ada_funcs __P((FILE *));
-static void Asm_labels __P((FILE *));
-static void C_entries __P((int c_ext, FILE *));
-static void default_C_entries __P((FILE *));
-static void plain_C_entries __P((FILE *));
-static void Cjava_entries __P((FILE *));
-static void Cobol_paragraphs __P((FILE *));
-static void Cplusplus_entries __P((FILE *));
-static void Cstar_entries __P((FILE *));
-static void Erlang_functions __P((FILE *));
-static void Forth_words __P((FILE *));
-static void Fortran_functions __P((FILE *));
-static void HTML_labels __P((FILE *));
-static void Lisp_functions __P((FILE *));
-static void Lua_functions __P((FILE *));
-static void Makefile_targets __P((FILE *));
-static void Pascal_functions __P((FILE *));
-static void Perl_functions __P((FILE *));
-static void PHP_functions __P((FILE *));
-static void PS_functions __P((FILE *));
-static void Prolog_functions __P((FILE *));
-static void Python_functions __P((FILE *));
-static void Scheme_functions __P((FILE *));
-static void TeX_commands __P((FILE *));
-static void Texinfo_nodes __P((FILE *));
-static void Yacc_entries __P((FILE *));
-static void just_read_file __P((FILE *));
-
-static void print_language_names __P((void));
-static void print_version __P((void));
-static void print_help __P((argument *));
-int main __P((int, char **));
-
-static compressor *get_compressor_from_suffix __P((char *, char **));
-static language *get_language_from_langname __P((const char *));
-static language *get_language_from_interpreter __P((char *));
-static language *get_language_from_filename __P((char *, bool));
-static void readline __P((linebuffer *, FILE *));
-static long readline_internal __P((linebuffer *, FILE *));
-static bool nocase_tail __P((char *));
-static void get_tag __P((char *, char **));
-
-static void analyse_regex __P((char *));
-static void free_regexps __P((void));
-static void regex_tag_multiline __P((void));
-static void error __P((const char *, const char *));
-static void suggest_asking_for_help __P((void));
-void fatal __P((char *, char *));
-static void pfatal __P((char *));
-static void add_node __P((node *, node **));
-
-static void init __P((void));
-static void process_file_name __P((char *, language *));
-static void process_file __P((FILE *, char *, language *));
-static void find_entries __P((FILE *));
-static void free_tree __P((node *));
-static void free_fdesc __P((fdesc *));
-static void pfnote __P((char *, bool, char *, int, int, long));
-static void make_tag __P((char *, int, bool, char *, int, int, long));
-static void invalidate_nodes __P((fdesc *, node **));
-static void put_entries __P((node *));
-
-static char *concat __P((char *, char *, char *));
-static char *skip_spaces __P((char *));
-static char *skip_non_spaces __P((char *));
-static char *savenstr __P((char *, int));
-static char *savestr __P((char *));
-static char *etags_strchr __P((const char *, int));
-static char *etags_strrchr __P((const char *, int));
-static int etags_strcasecmp __P((const char *, const char *));
-static int etags_strncasecmp __P((const char *, const char *, int));
-static char *etags_getcwd __P((void));
-static char *relative_filename __P((char *, char *));
-static char *absolute_filename __P((char *, char *));
-static char *absolute_dirname __P((char *, char *));
-static bool filename_is_absolute __P((char *f));
-static void canonicalize_filename __P((char *));
-static void linebuffer_init __P((linebuffer *));
-static void linebuffer_setlen __P((linebuffer *, int));
-static PTR xmalloc __P((unsigned int));
-static PTR xrealloc __P((char *, unsigned int));
+static void Ada_funcs (FILE *);
+static void Asm_labels (FILE *);
+static void C_entries (int c_ext, FILE *);
+static void default_C_entries (FILE *);
+static void plain_C_entries (FILE *);
+static void Cjava_entries (FILE *);
+static void Cobol_paragraphs (FILE *);
+static void Cplusplus_entries (FILE *);
+static void Cstar_entries (FILE *);
+static void Erlang_functions (FILE *);
+static void Forth_words (FILE *);
+static void Fortran_functions (FILE *);
+static void HTML_labels (FILE *);
+static void Lisp_functions (FILE *);
+static void Lua_functions (FILE *);
+static void Makefile_targets (FILE *);
+static void Pascal_functions (FILE *);
+static void Perl_functions (FILE *);
+static void PHP_functions (FILE *);
+static void PS_functions (FILE *);
+static void Prolog_functions (FILE *);
+static void Python_functions (FILE *);
+static void Scheme_functions (FILE *);
+static void TeX_commands (FILE *);
+static void Texinfo_nodes (FILE *);
+static void Yacc_entries (FILE *);
+static void just_read_file (FILE *);
+
+static void print_language_names (void);
+static void print_version (void);
+static void print_help (argument *);
+int main (int, char **);
+
+static compressor *get_compressor_from_suffix (char *, char **);
+static language *get_language_from_langname (const char *);
+static language *get_language_from_interpreter (char *);
+static language *get_language_from_filename (char *, bool);
+static void readline (linebuffer *, FILE *);
+static long readline_internal (linebuffer *, FILE *);
+static bool nocase_tail (const char *);
+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 add_node (node *, node **);
+
+static void init (void);
+static void process_file_name (char *, language *);
+static void process_file (FILE *, char *, language *);
+static void find_entries (FILE *);
+static void free_tree (node *);
+static void free_fdesc (fdesc *);
+static void pfnote (char *, bool, char *, int, int, long);
+static void make_tag (const char *, int, bool, char *, int, int, long);
+static void invalidate_nodes (fdesc *, node **);
+static void put_entries (node *);
+
+static char *concat (const char *, const char *, const char *);
+static char *skip_spaces (char *);
+static char *skip_non_spaces (char *);
+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 *);
+static char *absolute_dirname (char *, char *);
+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 (unsigned int);
+static PTR xrealloc (char *, unsigned int);
 
 \f
 static char searchar = '/';    /* use /.../ searches */
@@ -477,7 +469,7 @@ static linebuffer token_name;       /* a buffer containing a tag name */
 
 /* boolean "functions" (see init)      */
 static bool _wht[CHARS], _nin[CHARS], _itk[CHARS], _btk[CHARS], _etk[CHARS];
-static char
+static const char
   /* white chars */
   *white = " \f\t\n\r\v",
   /* not in a name */
@@ -577,9 +569,9 @@ static compressor compressors[] =
  */
 
 /* Ada code */
-static char *Ada_suffixes [] =
+static const char *Ada_suffixes [] =
   { "ads", "adb", "ada", NULL };
-static char Ada_help [] =
+static const char Ada_help [] =
 "In Ada code, functions, procedures, packages, tasks and types are\n\
 tags.  Use the `--packages-only' option to create tags for\n\
 packages only.\n\
@@ -597,7 +589,7 @@ body of the package `bidule', while `M-x find-tag <RET> bidule <RET>'\n\
 will just search for any tag `bidule'.";
 
 /* Assembly code */
-static char *Asm_suffixes [] =
+static const char *Asm_suffixes [] =
   { "a",       /* Unix assembler */
     "asm", /* Microcontroller assembly */
     "def", /* BSO/Tasking definition includes  */
@@ -608,7 +600,7 @@ static char *Asm_suffixes [] =
     "src", /* BSO/Tasking C compiler output */
     NULL
   };
-static char Asm_help [] =
+static const char Asm_help [] =
 "In assembler code, labels appearing at the beginning of a line,\n\
 followed by a colon, are tags.";
 
@@ -616,10 +608,10 @@ followed by a colon, are tags.";
 /* Note that .c and .h can be considered C++, if the --c++ flag was
    given, or if the `class' or `template' keywords are met inside the file.
    That is why default_C_entries is called for these. */
-static char *default_C_suffixes [] =
+static const char *default_C_suffixes [] =
   { "c", "h", NULL };
 #if CTAGS                              /* C help for Ctags */
-static char default_C_help [] =
+static const char default_C_help [] =
 "In C code, any C function is a tag.  Use -t to tag typedefs.\n\
 Use -T to tag definitions of `struct', `union' and `enum'.\n\
 Use -d to tag `#define' macro definitions and `enum' constants.\n\
@@ -627,7 +619,7 @@ Use --globals to tag global variables.\n\
 You can tag function declarations and external variables by\n\
 using `--declarations', and struct members by using `--members'.";
 #else                                  /* C help for Etags */
-static char default_C_help [] =
+static const char default_C_help [] =
 "In C code, any C function or typedef is a tag, and so are\n\
 definitions of `struct', `union' and `enum'.  `#define' macro\n\
 definitions and `enum' constants are tags unless you specify\n\
@@ -639,12 +631,12 @@ You can tag function declarations and external variables by\n\
 using `--declarations'.";
 #endif /* C help for Ctags and Etags */
 
-static char *Cplusplus_suffixes [] =
+static const char *Cplusplus_suffixes [] =
   { "C", "c++", "cc", "cpp", "cxx", "H", "h++", "hh", "hpp", "hxx",
     "M",                       /* Objective C++ */
     "pdb",                     /* Postscript with C syntax */
     NULL };
-static char Cplusplus_help [] =
+static const char Cplusplus_help [] =
 "In C++ code, all the tag constructs of C code are tagged.  (Use\n\
 --help --lang=c --lang=c++ for full help.)\n\
 In addition to C tags, member functions are also recognized.  Member\n\
@@ -653,131 +645,131 @@ Tags for variables and functions in classes are named `CLASS::VARIABLE'\n\
 and `CLASS::FUNCTION'.  `operator' definitions have tag names like\n\
 `operator+'.";
 
-static char *Cjava_suffixes [] =
+static const char *Cjava_suffixes [] =
   { "java", NULL };
 static char Cjava_help [] =
 "In Java code, all the tags constructs of C and C++ code are\n\
 tagged.  (Use --help --lang=c --lang=c++ --lang=java for full help.)";
 
 
-static char *Cobol_suffixes [] =
+static const char *Cobol_suffixes [] =
   { "COB", "cob", NULL };
 static char Cobol_help [] =
 "In Cobol code, tags are paragraph names; that is, any word\n\
 starting in column 8 and followed by a period.";
 
-static char *Cstar_suffixes [] =
+static const char *Cstar_suffixes [] =
   { "cs", "hs", NULL };
 
-static char *Erlang_suffixes [] =
+static const char *Erlang_suffixes [] =
   { "erl", "hrl", NULL };
-static char Erlang_help [] =
+static const char Erlang_help [] =
 "In Erlang code, the tags are the functions, records and macros\n\
 defined in the file.";
 
-char *Forth_suffixes [] =
+const char *Forth_suffixes [] =
   { "fth", "tok", NULL };
-static char Forth_help [] =
+static const char Forth_help [] =
 "In Forth code, tags are words defined by `:',\n\
 constant, code, create, defer, value, variable, buffer:, field.";
 
-static char *Fortran_suffixes [] =
+static const char *Fortran_suffixes [] =
   { "F", "f", "f90", "for", NULL };
-static char Fortran_help [] =
+static const char Fortran_help [] =
 "In Fortran code, functions, subroutines and block data are tags.";
 
-static char *HTML_suffixes [] =
+static const char *HTML_suffixes [] =
   { "htm", "html", "shtml", NULL };
-static char HTML_help [] =
+static const char HTML_help [] =
 "In HTML input files, the tags are the `title' and the `h1', `h2',\n\
 `h3' headers.  Also, tags are `name=' in anchors and all\n\
 occurrences of `id='.";
 
-static char *Lisp_suffixes [] =
+static const char *Lisp_suffixes [] =
   { "cl", "clisp", "el", "l", "lisp", "LSP", "lsp", "ml", NULL };
-static char Lisp_help [] =
+static const char Lisp_help [] =
 "In Lisp code, any function defined with `defun', any variable\n\
 defined with `defvar' or `defconst', and in general the first\n\
 argument of any expression that starts with `(def' in column zero\n\
 is a tag.";
 
-static char *Lua_suffixes [] =
+static const char *Lua_suffixes [] =
   { "lua", "LUA", NULL };
-static char Lua_help [] =
+static const char Lua_help [] =
 "In Lua scripts, all functions are tags.";
 
-static char *Makefile_filenames [] =
+static const char *Makefile_filenames [] =
   { "Makefile", "makefile", "GNUMakefile", "Makefile.in", "Makefile.am", NULL};
-static char Makefile_help [] =
+static const char Makefile_help [] =
 "In makefiles, targets are tags; additionally, variables are tags\n\
 unless you specify `--no-globals'.";
 
-static char *Objc_suffixes [] =
+static const char *Objc_suffixes [] =
   { "lm",                      /* Objective lex file */
     "m",                       /* Objective C file */
      NULL };
-static char Objc_help [] =
+static const char Objc_help [] =
 "In Objective C code, tags include Objective C definitions for classes,\n\
 class categories, methods and protocols.  Tags for variables and\n\
 functions in classes are named `CLASS::VARIABLE' and `CLASS::FUNCTION'.\n\
 (Use --help --lang=c --lang=objc --lang=java for full help.)";
 
-static char *Pascal_suffixes [] =
+static const char *Pascal_suffixes [] =
   { "p", "pas", NULL };
-static char Pascal_help [] =
+static const char Pascal_help [] =
 "In Pascal code, the tags are the functions and procedures defined\n\
 in the file.";
 /* " // this is for working around an Emacs highlighting bug... */
 
-static char *Perl_suffixes [] =
+static const char *Perl_suffixes [] =
   { "pl", "pm", NULL };
-static char *Perl_interpreters [] =
+static const char *Perl_interpreters [] =
   { "perl", "@PERL@", NULL };
-static char Perl_help [] =
+static const char Perl_help [] =
 "In Perl code, the tags are the packages, subroutines and variables\n\
 defined by the `package', `sub', `my' and `local' keywords.  Use\n\
 `--globals' if you want to tag global variables.  Tags for\n\
 subroutines are named `PACKAGE::SUB'.  The name for subroutines\n\
 defined in the default package is `main::SUB'.";
 
-static char *PHP_suffixes [] =
+static const char *PHP_suffixes [] =
   { "php", "php3", "php4", NULL };
-static char PHP_help [] =
+static const char PHP_help [] =
 "In PHP code, tags are functions, classes and defines.  Unless you use\n\
 the `--no-members' option, vars are tags too.";
 
-static char *plain_C_suffixes [] =
+static const char *plain_C_suffixes [] =
   { "pc",                      /* Pro*C file */
      NULL };
 
-static char *PS_suffixes [] =
+static const char *PS_suffixes [] =
   { "ps", "psw", NULL };       /* .psw is for PSWrap */
-static char PS_help [] =
+static const char PS_help [] =
 "In PostScript code, the tags are the functions.";
 
-static char *Prolog_suffixes [] =
+static const char *Prolog_suffixes [] =
   { "prolog", NULL };
-static char Prolog_help [] =
+static const char Prolog_help [] =
 "In Prolog code, tags are predicates and rules at the beginning of\n\
 line.";
 
-static char *Python_suffixes [] =
+static const char *Python_suffixes [] =
   { "py", NULL };
-static char Python_help [] =
+static const char Python_help [] =
 "In Python code, `def' or `class' at the beginning of a line\n\
 generate a tag.";
 
 /* Can't do the `SCM' or `scm' prefix with a version number. */
-static char *Scheme_suffixes [] =
+static const char *Scheme_suffixes [] =
   { "oak", "sch", "scheme", "SCM", "scm", "SM", "sm", "ss", "t", NULL };
-static char Scheme_help [] =
+static const char Scheme_help [] =
 "In Scheme code, tags include anything defined with `def' or with a\n\
 construct whose name starts with `def'.  They also include\n\
 variables set with `set!' at top level in the file.";
 
-static char *TeX_suffixes [] =
+static const char *TeX_suffixes [] =
   { "bib", "clo", "cls", "ltx", "sty", "TeX", "tex", NULL };
-static char TeX_help [] =
+static const char TeX_help [] =
 "In LaTeX text, the argument of any of the commands `\\chapter',\n\
 `\\section', `\\subsection', `\\subsubsection', `\\eqno', `\\label',\n\
 `\\ref', `\\cite', `\\bibitem', `\\part', `\\appendix', `\\entry',\n\
@@ -789,28 +781,28 @@ Other commands can be specified by setting the environment variable\n\
      TEXTAGS=\"mycommand:myothercommand\".";
 
 
-static char *Texinfo_suffixes [] =
+static const char *Texinfo_suffixes [] =
   { "texi", "texinfo", "txi", NULL };
-static char Texinfo_help [] =
+static const char Texinfo_help [] =
 "for texinfo files, lines starting with @node are tagged.";
 
-static char *Yacc_suffixes [] =
+static const char *Yacc_suffixes [] =
   { "y", "y++", "ym", "yxx", "yy", NULL }; /* .ym is Objective yacc file */
-static char Yacc_help [] =
+static const char Yacc_help [] =
 "In Bison or Yacc input files, each rule defines as a tag the\n\
 nonterminal it constructs.  The portions of the file that contain\n\
 C code are parsed as C code (use --help --lang=c --lang=yacc\n\
 for full help).";
 
-static char auto_help [] =
+static const char auto_help [] =
 "`auto' is not a real language, it indicates to use\n\
 a default language for files base on file name suffix and file contents.";
 
-static char none_help [] =
+static const char none_help [] =
 "`none' is not a real language, it indicates to only do\n\
 regexp processing on files.";
 
-static char no_lang_help [] =
+static const char no_lang_help [] =
 "No detailed help available for this language.";
 
 
@@ -856,10 +848,10 @@ static language lang_names [] =
 
 \f
 static void
-print_language_names ()
+print_language_names (void)
 {
   language *lang;
-  char **name, **ext;
+  const char **name, **ext;
 
   puts ("\nThese are the currently supported languages, along with the\n\
 default file names and dot suffixes:");
@@ -895,7 +887,7 @@ etags --help --lang=ada.");
 # define VERSION "17.38.1.4"
 #endif
 static void
-print_version ()
+print_version (void)
 {
   /* Makes it easier to update automatically. */
   char emacs_copyright[] = "Copyright (C) 2010 Free Software Foundation, Inc.";
@@ -912,8 +904,7 @@ print_version ()
 #endif
 
 static void
-print_help (argbuffer)
-     argument *argbuffer;
+print_help (argument *argbuffer)
 {
   bool help_for_lang = FALSE;
 
@@ -1090,9 +1081,7 @@ Relative ones are stored relative to the output file's directory.\n");
 
 \f
 int
-main (argc, argv)
-     int argc;
-     char *argv[];
+main (int argc, char **argv)
 {
   int i;
   unsigned int nincluded_files;
@@ -1417,9 +1406,7 @@ main (argc, argv)
  * Idea by Vladimir Alexiev <vladimir@cs.ualberta.ca> (1998)
  */
 static compressor *
-get_compressor_from_suffix (file, extptr)
-     char *file;
-     char **extptr;
+get_compressor_from_suffix (char *file, char **extptr)
 {
   compressor *compr;
   char *slash, *suffix;
@@ -1455,8 +1442,7 @@ get_compressor_from_suffix (file, extptr)
  * Return a language given the name.
  */
 static language *
-get_language_from_langname (name)
-     const char *name;
+get_language_from_langname (const char *name)
 {
   language *lang;
 
@@ -1478,11 +1464,10 @@ get_language_from_langname (name)
  * Return a language given the interpreter name.
  */
 static language *
-get_language_from_interpreter (interpreter)
-     char *interpreter;
+get_language_from_interpreter (char *interpreter)
 {
   language *lang;
-  char **iname;
+  const char **iname;
 
   if (interpreter == NULL)
     return NULL;
@@ -1501,12 +1486,10 @@ get_language_from_interpreter (interpreter)
  * Return a language given the file name.
  */
 static language *
-get_language_from_filename (file, case_sensitive)
-     char *file;
-     bool case_sensitive;
+get_language_from_filename (char *file, int case_sensitive)
 {
   language *lang;
-  char **name, **ext, *suffix;
+  const char **name, **ext, *suffix;
 
   /* Try whole file name first. */
   for (lang = lang_names; lang->name != NULL; lang++)
@@ -1537,9 +1520,7 @@ get_language_from_filename (file, case_sensitive)
  * This routine is called on each file argument.
  */
 static void
-process_file_name (file, lang)
-     char *file;
-     language *lang;
+process_file_name (char *file, language *lang)
 {
   struct stat stat_buf;
   FILE *inf;
@@ -1661,10 +1642,7 @@ process_file_name (file, lang)
 }
 
 static void
-process_file (fh, fn, lang)
-     FILE *fh;
-     char *fn;
-     language *lang;
+process_file (FILE *fh, char *fn, language *lang)
 {
   static const fdesc emptyfdesc;
   fdesc *fdp;
@@ -1741,9 +1719,9 @@ process_file (fh, fn, lang)
  * of a char is TRUE if it is the string "white", else FALSE.
  */
 static void
-init ()
+init (void)
 {
-  register char *sp;
+  register const char *sp;
   register int i;
 
   for (i = 0; i < CHARS; i++)
@@ -1764,8 +1742,7 @@ init ()
  * which finds the function and type definitions.
  */
 static void
-find_entries (inf)
-     FILE *inf;
+find_entries (FILE *inf)
 {
   char *cp;
   language *lang = curfdp->lang;
@@ -1923,23 +1900,23 @@ find_entries (inf)
  * etags.el needs to use the same characters that are in NONAM.
  */
 static void
-make_tag (name, namelen, is_func, linestart, linelen, lno, cno)
-     char *name;               /* tag name, or NULL if unnamed */
-     int namelen;              /* tag length */
-     bool is_func;             /* tag is a function */
-     char *linestart;          /* start of the line where tag is */
-     int linelen;              /* length of the line where tag is */
-     int lno;                  /* line number */
-     long cno;                 /* character number */
+make_tag (const char *name,    /* tag name, or NULL if unnamed */
+         int namelen,          /* tag length */
+         int is_func,          /* tag is a function */
+         char *linestart,      /* start of the line where tag is */
+         int linelen,          /* length of the line where tag is */
+         int lno,              /* line number */
+         long int cno)         /* character number */
 {
   bool named = (name != NULL && namelen > 0);
+  char *nname = NULL;
 
   if (!CTAGS && named)         /* maybe set named to false */
     /* Let's try to make an implicit tag name, that is, create an unnamed tag
        such that etags.el can guess a name from it. */
     {
       int i;
-      register char *cp = name;
+      register const char *cp = name;
 
       for (i = 0; i < namelen; i++)
        if (notinname (*cp++))
@@ -1958,21 +1935,20 @@ make_tag (name, namelen, is_func, linestart, linelen, lno, cno)
     }
 
   if (named)
-    name = savenstr (name, namelen);
-  else
-    name = NULL;
-  pfnote (name, is_func, linestart, linelen, lno, cno);
+    nname = savenstr (name, namelen);
+
+  pfnote (nname, is_func, linestart, linelen, lno, cno);
 }
 
 /* Record a tag. */
 static void
-pfnote (name, is_func, linestart, linelen, lno, cno)
-     char *name;               /* tag name, or NULL if unnamed */
-     bool is_func;             /* tag is a function */
-     char *linestart;          /* start of the line where tag is */
-     int linelen;              /* length of the line where tag is */
-     int lno;                  /* line number */
-     long cno;                 /* character number */
+pfnote (char *name, int is_func, char *linestart, int linelen, int lno, long int cno)
+                               /* tag name, or NULL if unnamed */
+                               /* tag is a function */
+                               /* start of the line where tag is */
+                               /* length of the line where tag is */
+                               /* line number */
+                               /* character number */
 {
   register node *np;
 
@@ -2026,8 +2002,7 @@ pfnote (name, is_func, linestart, linelen, lno, cno)
  *     recurse on left children, iterate on right children.
  */
 static void
-free_tree (np)
-     register node *np;
+free_tree (register node *np)
 {
   while (np)
     {
@@ -2045,8 +2020,7 @@ free_tree (np)
  *     delete a file description
  */
 static void
-free_fdesc (fdp)
-     register fdesc *fdp;
+free_fdesc (register fdesc *fdp)
 {
   free (fdp->infname);
   free (fdp->infabsname);
@@ -2066,8 +2040,7 @@ free_fdesc (fdp)
  *     maintain state.
  */
 static void
-add_node (np, cur_node_p)
-     node *np, **cur_node_p;
+add_node (node *np, node **cur_node_p)
 {
   register int dif;
   register node *cur_node = *cur_node_p;
@@ -2147,9 +2120,7 @@ add_node (np, cur_node_p)
  *     given file description (CTAGS case) or free them (ETAGS case).
  */
 static void
-invalidate_nodes (badfdp, npp)
-     fdesc *badfdp;
-     node **npp;
+invalidate_nodes (fdesc *badfdp, node **npp)
 {
   node *np = *npp;
 
@@ -2181,13 +2152,12 @@ invalidate_nodes (badfdp, npp)
 }
 
 \f
-static int total_size_of_entries __P((node *));
-static int number_len __P((long));
+static int total_size_of_entries (node *);
+static int number_len (long);
 
 /* Length of a non-negative number's decimal representation. */
 static int
-number_len (num)
-     long num;
+number_len (long int num)
 {
   int len = 1;
   while ((num /= 10) > 0)
@@ -2202,8 +2172,7 @@ number_len (num)
  * but is still supplied for backward compatibility.
  */
 static int
-total_size_of_entries (np)
-     register node *np;
+total_size_of_entries (register node *np)
 {
   register int total = 0;
 
@@ -2223,8 +2192,7 @@ total_size_of_entries (np)
 }
 
 static void
-put_entries (np)
-     register node *np;
+put_entries (register node *np)
 {
   register char *sp;
   static fdesc *fdp = NULL;
@@ -2333,9 +2301,9 @@ enum sym_type
   st_C_struct, st_C_extern, st_C_enum, st_C_define, st_C_typedef
 };
 
-static unsigned int hash __P((const char *, unsigned int));
-static struct C_stab_entry * in_word_set __P((const char *, unsigned int));
-static enum sym_type C_symtype __P((char *, int, int));
+static unsigned int hash (const char *, unsigned int);
+static struct C_stab_entry * in_word_set (const char *, unsigned int);
+static enum sym_type C_symtype (char *, int, int);
 
 /* Feed stuff between (but not including) %[ and %] lines to:
      gperf -m 5
@@ -2392,7 +2360,7 @@ and replace lines between %< and %> with its output, then:
 /* Command-line: gperf -m 5  */
 /* Computed positions: -k'2-3' */
 
-struct C_stab_entry { char *name; int c_ext; enum sym_type type; };
+struct C_stab_entry { const char *name; int c_ext; enum sym_type type; };
 /* maximum key range = 33, duplicates = 0 */
 
 #ifdef __GNUC__
@@ -2403,9 +2371,7 @@ inline
 #endif
 #endif
 static unsigned int
-hash (str, len)
-     register const char *str;
-     register unsigned int len;
+hash (register const char *str, register unsigned int len)
 {
   static unsigned char asso_values[] =
     {
@@ -2451,9 +2417,7 @@ hash (str, len)
 }
 
 static struct C_stab_entry *
-in_word_set (str, len)
-     register const char *str;
-     register unsigned int len;
+in_word_set (register const char *str, register unsigned int len)
 {
   enum
     {
@@ -2519,10 +2483,7 @@ in_word_set (str, len)
 /*%>*/
 
 static enum sym_type
-C_symtype (str, len, c_ext)
-     char *str;
-     int len;
-     int c_ext;
+C_symtype (char *str, int len, int c_ext)
 {
   register struct C_stab_entry *se = in_word_set (str, len);
 
@@ -2588,7 +2549,7 @@ static enum
 /*
  * When objdef is different from onone, objtag is the name of the class.
  */
-static char *objtag = "<uninited>";
+static const char *objtag = "<uninited>";
 
 /*
  * Yet another little state machine to deal with preprocessor lines.
@@ -2649,9 +2610,9 @@ static struct tok
  * Variables and functions for dealing with nested structures.
  * Idea by Mykola Dzyuba <mdzyuba@yahoo.com> (2001)
  */
-static void pushclass_above __P((int, char *, int));
-static void popclass_above __P((int));
-static void write_classname __P((linebuffer *, char *qualifier));
+static void pushclass_above (int, char *, int);
+static void popclass_above (int);
+static void write_classname (linebuffer *, const char *qualifier);
 
 static struct {
   char **cname;                        /* nested class names */
@@ -2666,10 +2627,7 @@ static struct {
                         && bracelev == cstack.bracelev[nestlev-1] + 1)
 
 static void
-pushclass_above (bracelev, str, len)
-     int bracelev;
-     char *str;
-     int len;
+pushclass_above (int bracelev, char *str, int len)
 {
   int nl;
 
@@ -2688,8 +2646,7 @@ pushclass_above (bracelev, str, len)
 }
 
 static void
-popclass_above (bracelev)
-     int bracelev;
+popclass_above (int bracelev)
 {
   int nl;
 
@@ -2703,9 +2660,7 @@ popclass_above (bracelev)
 }
 
 static void
-write_classname (cn, qualifier)
-     linebuffer *cn;
-     char *qualifier;
+write_classname (linebuffer *cn, const char *qualifier)
 {
   int i, len;
   int qlen = strlen (qualifier);
@@ -2739,8 +2694,8 @@ write_classname (cn, qualifier)
 }
 
 \f
-static bool consider_token __P((char *, int, int, int *, int, int, bool *));
-static void make_C_tag __P((bool));
+static bool consider_token (char *, int, int, int *, int, int, bool *);
+static void make_C_tag (bool);
 
 /*
  * consider_token ()
@@ -2760,14 +2715,14 @@ static void make_C_tag __P((bool));
  */
 
 static bool
-consider_token (str, len, c, c_extp, bracelev, parlev, is_func_or_var)
-     register char *str;       /* IN: token pointer */
-     register int len;         /* IN: token length */
-     register int c;           /* IN: first char after the token */
-     int *c_extp;              /* IN, OUT: C extensions mask */
-     int bracelev;             /* IN: brace level */
-     int parlev;               /* IN: parenthesis level */
-     bool *is_func_or_var;     /* OUT: function or variable found */
+consider_token (register char *str, register int len, register int c, int *c_extp, int bracelev, int parlev, int *is_func_or_var)
+                               /* IN: token pointer */
+                               /* IN: token length */
+                               /* IN: first char after the token */
+                               /* IN, OUT: C extensions mask */
+                               /* IN: brace level */
+                               /* IN: parenthesis level */
+                               /* OUT: function or variable found */
 {
   /* When structdef is stagseen, scolonseen, or snone with bracelev > 0,
      structtype is the type of the preceding struct-like keyword, and
@@ -3101,8 +3056,7 @@ do {                                                                      \
 
 
 static void
-make_C_tag (isfun)
-     bool isfun;
+make_C_tag (int isfun)
 {
   /* This function is never called when token.valid is FALSE, but
      we must protect against invalid input or internal errors. */
@@ -3128,16 +3082,16 @@ make_C_tag (isfun)
  *     C syntax and adds them to the list.
  */
 static void
-C_entries (c_ext, inf)
-     int c_ext;                        /* extension of C */
-     FILE *inf;                        /* input file */
+C_entries (int c_ext, FILE *inf)
+                                       /* extension of C */
+                                       /* input file */
 {
   register char c;             /* latest char read; '\0' for end of line */
   register char *lp;           /* pointer one beyond the character `c' */
   int curndx, newndx;          /* indices for current and new lb */
   register int tokoff;         /* offset in line of start of current token */
   register int toklen;         /* length of current token */
-  char *qualifier;             /* string used to qualify names */
+  const char *qualifier;        /* string used to qualify names */
   int qlen;                    /* length of qualifier */
   int bracelev;                        /* current brace level */
   int bracketlev;              /* current bracket level */
@@ -3960,48 +3914,42 @@ C_entries (c_ext, inf)
  * of a global flag.
  */
 static void
-default_C_entries (inf)
-     FILE *inf;
+default_C_entries (FILE *inf)
 {
   C_entries (cplusplus ? C_PLPL : C_AUTO, inf);
 }
 
 /* Always do plain C. */
 static void
-plain_C_entries (inf)
-     FILE *inf;
+plain_C_entries (FILE *inf)
 {
   C_entries (0, inf);
 }
 
 /* Always do C++. */
 static void
-Cplusplus_entries (inf)
-     FILE *inf;
+Cplusplus_entries (FILE *inf)
 {
   C_entries (C_PLPL, inf);
 }
 
 /* Always do Java. */
 static void
-Cjava_entries (inf)
-     FILE *inf;
+Cjava_entries (FILE *inf)
 {
   C_entries (C_JAVA, inf);
 }
 
 /* Always do C*. */
 static void
-Cstar_entries (inf)
-     FILE *inf;
+Cstar_entries (FILE *inf)
 {
   C_entries (C_STAR, inf);
 }
 
 /* Always do Yacc. */
 static void
-Yacc_entries (inf)
-     FILE *inf;
+Yacc_entries (FILE *inf)
 {
   C_entries (YACC, inf);
 }
@@ -4034,8 +3982,7 @@ Yacc_entries (inf)
  * matching on files that have no language defined.
  */
 static void
-just_read_file (inf)
-     FILE *inf;
+just_read_file (FILE *inf)
 {
   register char *dummy;
 
@@ -4046,11 +3993,11 @@ just_read_file (inf)
 \f
 /* Fortran parsing */
 
-static void F_takeprec __P((void));
-static void F_getit __P((FILE *));
+static void F_takeprec (void);
+static void F_getit (FILE *);
 
 static void
-F_takeprec ()
+F_takeprec (void)
 {
   dbp = skip_spaces (dbp);
   if (*dbp != '*')
@@ -4073,8 +4020,7 @@ F_takeprec ()
 }
 
 static void
-F_getit (inf)
-     FILE *inf;
+F_getit (FILE *inf)
 {
   register char *cp;
 
@@ -4098,8 +4044,7 @@ F_getit (inf)
 
 
 static void
-Fortran_functions (inf)
-     FILE *inf;
+Fortran_functions (FILE *inf)
 {
   LOOP_ON_INPUT_LINES (inf, lb, dbp)
     {
@@ -4181,14 +4126,10 @@ Fortran_functions (inf)
  * Philippe Waroquiers (1998)
  */
 
-static void Ada_getit __P((FILE *, char *));
-
 /* Once we are positioned after an "interesting" keyword, let's get
    the real tag value necessary. */
 static void
-Ada_getit (inf, name_qualifier)
-     FILE *inf;
-     char *name_qualifier;
+Ada_getit (FILE *inf, const char *name_qualifier)
 {
   register char *cp;
   char *name;
@@ -4251,8 +4192,7 @@ Ada_getit (inf, name_qualifier)
 }
 
 static void
-Ada_funcs (inf)
-     FILE *inf;
+Ada_funcs (FILE *inf)
 {
   bool inquote = FALSE;
   bool skip_till_semicolumn = FALSE;
@@ -4365,8 +4305,7 @@ Ada_funcs (inf)
  * Idea by Bob Weiner, Motorola Inc. (1994)
  */
 static void
-Asm_labels (inf)
-     FILE *inf;
+Asm_labels (FILE *inf)
 {
   register char *cp;
 
@@ -4398,8 +4337,7 @@ Asm_labels (inf)
  * Ideas by Kai Großjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE> (2001)
  */
 static void
-Perl_functions (inf)
-     FILE *inf;
+Perl_functions (FILE *inf)
 {
   char *package = savestr ("main"); /* current package name */
   register char *cp;
@@ -4481,8 +4419,7 @@ Perl_functions (inf)
  * More ideas by seb bacon <seb@jamkit.com> (2002)
  */
 static void
-Python_functions (inf)
-     FILE *inf;
+Python_functions (FILE *inf)
 {
   register char *cp;
 
@@ -4512,8 +4449,7 @@ Python_functions (inf)
  * Idea by Diez B. Roggisch (2001)
  */
 static void
-PHP_functions (inf)
-     FILE *inf;
+PHP_functions (FILE *inf)
 {
   register char *cp, *name;
   bool search_identifier = FALSE;
@@ -4592,8 +4528,7 @@ PHP_functions (inf)
  * Idea by Corny de Souza (1993)
  */
 static void
-Cobol_paragraphs (inf)
-     FILE *inf;
+Cobol_paragraphs (FILE *inf)
 {
   register char *bp, *ep;
 
@@ -4621,8 +4556,7 @@ Cobol_paragraphs (inf)
  * Ideas by Assar Westerlund <assar@sics.se> (2001)
  */
 static void
-Makefile_targets (inf)
-     FILE *inf;
+Makefile_targets (FILE *inf)
 {
   register char *bp;
 
@@ -4657,8 +4591,7 @@ Makefile_targets (inf)
  *  the tag is skipped.
  */
 static void
-Pascal_functions (inf)
-     FILE *inf;
+Pascal_functions (FILE *inf)
 {
   linebuffer tline;            /* mostly copied from C_entries */
   long save_lcno;
@@ -4835,10 +4768,10 @@ Pascal_functions (inf)
  *  look for (def or (DEF, quote or QUOTE
  */
 
-static void L_getit __P((void));
+static void L_getit (void);
 
 static void
-L_getit ()
+L_getit (void)
 {
   if (*dbp == '\'')            /* Skip prefix quote */
     dbp++;
@@ -4854,8 +4787,7 @@ L_getit ()
 }
 
 static void
-Lisp_functions (inf)
-     FILE *inf;
+Lisp_functions (FILE *inf)
 {
   LOOP_ON_INPUT_LINES (inf, lb, dbp)
     {
@@ -4899,8 +4831,7 @@ Lisp_functions (inf)
  *  "function" and "local function" are tags if they start at column 1.
  */
 static void
-Lua_functions (inf)
-     FILE *inf;
+Lua_functions (FILE *inf)
 {
   register char *bp;
 
@@ -4926,8 +4857,7 @@ Lua_functions (inf)
  *   Masatake Yamato <masata-y@is.aist-nara.ac.jp> (1999)
  */
 static void
-PS_functions (inf)
-     FILE *inf;
+PS_functions (FILE *inf)
 {
   register char *bp, *ep;
 
@@ -4957,8 +4887,7 @@ PS_functions (inf)
  * Ideas by Eduardo Horvath <eeh@netbsd.org> (2004)
  */
 static void
-Forth_words (inf)
-     FILE *inf;
+Forth_words (FILE *inf)
 {
   register char *bp;
 
@@ -4994,8 +4923,7 @@ Forth_words (inf)
  * Original code by Ken Haase (1985?)
  */
 static void
-Scheme_functions (inf)
-     FILE *inf;
+Scheme_functions (FILE *inf)
 {
   register char *bp;
 
@@ -5030,13 +4958,13 @@ static linebuffer *TEX_toktab = NULL; /* Table with tag tokens */
 
 /* Default set of control sequences to put into TEX_toktab.
    The value of environment var TEXTAGS is prepended to this.  */
-static char *TEX_defenv = "\
+static const char *TEX_defenv = "\
 :chapter:section:subsection:subsubsection:eqno:label:ref:cite:bibitem\
 :part:appendix:entry:index:def\
 :newcommand:renewcommand:newenvironment:renewenvironment";
 
-static void TEX_mode __P((FILE *));
-static void TEX_decode_env __P((char *, char *));
+static void TEX_mode (FILE *);
+static void TEX_decode_env (const char *, const char *);
 
 static char TEX_esc = '\\';
 static char TEX_opgrp = '{';
@@ -5046,8 +4974,7 @@ static char TEX_clgrp = '}';
  * TeX/LaTeX scanning loop.
  */
 static void
-TeX_commands (inf)
-     FILE *inf;
+TeX_commands (FILE *inf)
 {
   char *cp;
   linebuffer *key;
@@ -5111,8 +5038,7 @@ TeX_commands (inf)
 /* Figure out whether TeX's escapechar is '\\' or '!' and set grouping
    chars accordingly. */
 static void
-TEX_mode (inf)
-     FILE *inf;
+TEX_mode (FILE *inf)
 {
   int c;
 
@@ -5146,11 +5072,9 @@ TEX_mode (inf)
 /* Read environment and prepend it to the default string.
    Build token table. */
 static void
-TEX_decode_env (evarname, defenv)
-     char *evarname;
-     char *defenv;
+TEX_decode_env (const char *evarname, const char *defenv)
 {
-  register char *env, *p;
+  register const char *env, *p;
   int i, len;
 
   /* Append default string to environment. */
@@ -5158,10 +5082,7 @@ TEX_decode_env (evarname, defenv)
   if (!env)
     env = defenv;
   else
-    {
-      char *oldenv = env;
-      env = concat (oldenv, defenv, "");
-    }
+    env = concat (env, defenv, "");
 
   /* Allocate a token table */
   for (len = 1, p = env; p;)
@@ -5196,8 +5117,7 @@ TEX_decode_env (evarname, defenv)
 \f
 /* Texinfo support.  Dave Love, Mar. 2000.  */
 static void
-Texinfo_nodes (inf)
-     FILE * inf;
+Texinfo_nodes (FILE *inf)
 {
   char *cp, *start;
   LOOP_ON_INPUT_LINES (inf, lb, cp)
@@ -5220,8 +5140,7 @@ Texinfo_nodes (inf)
  * Francesco Potortì, 2002.
  */
 static void
-HTML_labels (inf)
-     FILE * inf;
+HTML_labels (FILE *inf)
 {
   bool getnext = FALSE;                /* next text outside of HTML tags is a tag */
   bool skiptag = FALSE;                /* skip to the end of the current HTML tag */
@@ -5341,13 +5260,12 @@ HTML_labels (inf)
  * Original code by Sunichirou Sugou (1989)
  * Rewritten by Anders Lindgren (1996)
  */
-static int prolog_pr __P((char *, char *));
-static void prolog_skip_comment __P((linebuffer *, FILE *));
-static int prolog_atom __P((char *, int));
+static int prolog_pr (char *, char *);
+static void prolog_skip_comment (linebuffer *, FILE *);
+static int prolog_atom (char *, int);
 
 static void
-Prolog_functions (inf)
-     FILE *inf;
+Prolog_functions (FILE *inf)
 {
   char *cp, *last;
   int len;
@@ -5383,9 +5301,7 @@ Prolog_functions (inf)
 
 
 static void
-prolog_skip_comment (plb, inf)
-     linebuffer *plb;
-     FILE *inf;
+prolog_skip_comment (linebuffer *plb, FILE *inf)
 {
   char *cp;
 
@@ -5411,9 +5327,9 @@ prolog_skip_comment (plb, inf)
  * header was found.
  */
 static int
-prolog_pr (s, last)
-     char *s;
-     char *last;               /* Name of last clause. */
+prolog_pr (char *s, char *last)
+             
+                               /* Name of last clause. */
 {
   int pos;
   int len;
@@ -5449,9 +5365,7 @@ prolog_pr (s, last)
  *   Backslash quotes everything.
  */
 static int
-prolog_atom (s, pos)
-     char *s;
-     int pos;
+prolog_atom (char *s, int pos)
 {
   int origpos;
 
@@ -5506,13 +5420,12 @@ prolog_atom (s, pos)
  * Assumes that Erlang functions start at column 0.
  * Original code by Anders Lindgren (1996)
  */
-static int erlang_func __P((char *, char *));
-static void erlang_attribute __P((char *));
-static int erlang_atom __P((char *));
+static int erlang_func (char *, char *);
+static void erlang_attribute (char *);
+static int erlang_atom (char *);
 
 static void
-Erlang_functions (inf)
-     FILE *inf;
+Erlang_functions (FILE *inf)
 {
   char *cp, *last;
   int len;
@@ -5571,9 +5484,9 @@ Erlang_functions (inf)
  * was found.
  */
 static int
-erlang_func (s, last)
-     char *s;
-     char *last;               /* Name of last clause. */
+erlang_func (char *s, char *last)
+             
+                               /* Name of last clause. */
 {
   int pos;
   int len;
@@ -5609,8 +5522,7 @@ erlang_func (s, last)
  * -record(graph, {vtab = notable, cyclic = true}).
  */
 static void
-erlang_attribute (s)
-     char *s;
+erlang_attribute (char *s)
 {
   char *cp = s;
 
@@ -5630,8 +5542,7 @@ erlang_attribute (s)
  * Return the number of bytes consumed, or -1 if there was an error.
  */
 static int
-erlang_atom (s)
-     char *s;
+erlang_atom (char *s)
 {
   int pos = 0;
 
@@ -5655,9 +5566,9 @@ erlang_atom (s)
 }
 
 \f
-static char *scan_separators __P((char *));
-static void add_regex __P((char *, language *));
-static char *substitute __P((char *, char *, struct re_registers *));
+static char *scan_separators (char *);
+static void add_regex (char *, language *);
+static char *substitute (char *, char *, struct re_registers *);
 
 /*
  * Take a string like "/blah/" and turn it into "blah", verifying
@@ -5669,8 +5580,7 @@ static char *substitute __P((char *, char *, struct re_registers *));
  * unterminated regexps.
  */
 static char *
-scan_separators (name)
-     char *name;
+scan_separators (char *name)
 {
   char sep = name[0];
   char *copyto = name;
@@ -5722,8 +5632,7 @@ scan_separators (name)
 /* Look at the argument of --regex or --no-regex and do the right
    thing.  Same for each line of a regexp file. */
 static void
-analyse_regex (regex_arg)
-     char *regex_arg;
+analyse_regex (char *regex_arg)
 {
   if (regex_arg == NULL)
     {
@@ -5794,12 +5703,11 @@ analyse_regex (regex_arg)
 /* Separate the regexp pattern, compile it,
    and care for optional name and modifiers. */
 static void
-add_regex (regexp_pattern, lang)
-     char *regexp_pattern;
-     language *lang;
+add_regex (char *regexp_pattern, language *lang)
 {
   static struct re_pattern_buffer zeropattern;
   char sep, *pat, *name, *modifiers;
+  char empty[] = "";
   const char *err;
   struct re_pattern_buffer *patbuf;
   regexp *rp;
@@ -5831,7 +5739,7 @@ add_regex (regexp_pattern, lang)
   if (modifiers == NULL)       /* no terminating separator --> no name */
     {
       modifiers = name;
-      name = "";
+      name = empty;
     }
   else
     modifiers += 1;            /* skip separator */
@@ -5913,9 +5821,7 @@ add_regex (regexp_pattern, lang)
  * arguments.
  */
 static char *
-substitute (in, out, regs)
-     char *in, *out;
-     struct re_registers *regs;
+substitute (char *in, char *out, struct re_registers *regs)
 {
   char *result, *t;
   int size, dig, diglen;
@@ -5962,7 +5868,7 @@ substitute (in, out, regs)
 
 /* Deallocate all regexps. */
 static void
-free_regexps ()
+free_regexps (void)
 {
   regexp *rp;
   while (p_head != NULL)
@@ -5984,7 +5890,7 @@ free_regexps ()
  * Idea by Ben Wing <ben@666.com> (2002).
  */
 static void
-regex_tag_multiline ()
+regex_tag_multiline (void)
 {
   char *buffer = filebuf.buffer;
   regexp *rp;
@@ -6061,8 +5967,7 @@ regex_tag_multiline ()
 
 \f
 static bool
-nocase_tail (cp)
-     char *cp;
+nocase_tail (const char *cp)
 {
   register int len = 0;
 
@@ -6077,9 +5982,7 @@ nocase_tail (cp)
 }
 
 static void
-get_tag (bp, namepp)
-     register char *bp;
-     char **namepp;
+get_tag (register char *bp, char **namepp)
 {
   register char *cp = bp;
 
@@ -6110,9 +6013,7 @@ get_tag (bp, namepp)
  * appended to `filebuf'.
  */
 static long
-readline_internal (lbp, stream)
-     linebuffer *lbp;
-     register FILE *stream;
+readline_internal (linebuffer *lbp, register FILE *stream)
 {
   char *buffer = lbp->buffer;
   register char *p = lbp->buffer;
@@ -6190,9 +6091,7 @@ readline_internal (lbp, stream)
  * directives.
  */
 static void
-readline (lbp, stream)
-     linebuffer *lbp;
-     FILE *stream;
+readline (linebuffer *lbp, FILE *stream)
 {
   long result;
 
@@ -6385,8 +6284,7 @@ readline (lbp, stream)
  * with xnew where the string CP has been copied.
  */
 static char *
-savestr (cp)
-     char *cp;
+savestr (const char *cp)
 {
   return savenstr (cp, strlen (cp));
 }
@@ -6396,9 +6294,7 @@ savestr (cp)
  * the string CP has been copied for at most the first LEN characters.
  */
 static char *
-savenstr (cp, len)
-     char *cp;
-     int len;
+savenstr (const char *cp, int len)
 {
   register char *dp;
 
@@ -6415,9 +6311,7 @@ savenstr (cp, len)
  * Identical to POSIX strrchr, included for portability.
  */
 static char *
-etags_strrchr (sp, c)
-     register const char *sp;
-     register int c;
+etags_strrchr (register const char *sp, register int c)
 {
   register const char *r;
 
@@ -6437,9 +6331,7 @@ etags_strrchr (sp, c)
  * Identical to POSIX strchr, included for portability.
  */
 static char *
-etags_strchr (sp, c)
-     register const char *sp;
-     register int c;
+etags_strchr (register const char *sp, register int c)
 {
   do
     {
@@ -6455,9 +6347,7 @@ etags_strchr (sp, c)
  * Same as BSD's strcasecmp, included for portability.
  */
 static int
-etags_strcasecmp (s1, s2)
-     register const char *s1;
-     register const char *s2;
+etags_strcasecmp (register const char *s1, register const char *s2)
 {
   while (*s1 != '\0'
         && (ISALPHA (*s1) && ISALPHA (*s2)
@@ -6477,10 +6367,7 @@ etags_strcasecmp (s1, s2)
  * Same as BSD's strncasecmp, included for portability.
  */
 static int
-etags_strncasecmp (s1, s2, n)
-     register const char *s1;
-     register const char *s2;
-     register int n;
+etags_strncasecmp (register const char *s1, register const char *s2, register int n)
 {
   while (*s1 != '\0' && n-- > 0
         && (ISALPHA (*s1) && ISALPHA (*s2)
@@ -6498,8 +6385,7 @@ etags_strncasecmp (s1, s2, n)
 
 /* Skip spaces (end of string is not space), return new pointer. */
 static char *
-skip_spaces (cp)
-     char *cp;
+skip_spaces (char *cp)
 {
   while (iswhite (*cp))
     cp++;
@@ -6508,8 +6394,7 @@ skip_spaces (cp)
 
 /* Skip non spaces, except end of string, return new pointer. */
 static char *
-skip_non_spaces (cp)
-     char *cp;
+skip_non_spaces (char *cp)
 {
   while (*cp != '\0' && !iswhite (*cp))
     cp++;
@@ -6518,23 +6403,21 @@ skip_non_spaces (cp)
 
 /* Print error message and exit.  */
 void
-fatal (s1, s2)
-     char *s1, *s2;
+fatal (const char *s1, const char *s2)
 {
   error (s1, s2);
   exit (EXIT_FAILURE);
 }
 
 static void
-pfatal (s1)
-     char *s1;
+pfatal (const char *s1)
 {
   perror (s1);
   exit (EXIT_FAILURE);
 }
 
 static void
-suggest_asking_for_help ()
+suggest_asking_for_help (void)
 {
   fprintf (stderr, "\tTry `%s %s' for a complete list of options.\n",
           progname, NO_LONG_OPTIONS ? "-h" : "--help");
@@ -6543,8 +6426,7 @@ suggest_asking_for_help ()
 
 /* Print error message.  `s1' is printf control string, `s2' is arg for it. */
 static void
-error (s1, s2)
-     const char *s1, *s2;
+error (const char *s1, const char *s2)
 {
   fprintf (stderr, "%s: ", progname);
   fprintf (stderr, s1, s2);
@@ -6554,8 +6436,7 @@ error (s1, s2)
 /* Return a newly-allocated string whose contents
    concatenate those of s1, s2, s3.  */
 static char *
-concat (s1, s2, s3)
-     char *s1, *s2, *s3;
+concat (const char *s1, const char *s2, const char *s3)
 {
   int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3);
   char *result = xnew (len1 + len2 + len3 + 1, char);
@@ -6572,7 +6453,7 @@ concat (s1, s2, s3)
 /* Does the same work as the system V getcwd, but does not need to
    guess the buffer size in advance. */
 static char *
-etags_getcwd ()
+etags_getcwd (void)
 {
 #ifdef HAVE_GETCWD
   int bufsize = 200;
@@ -6622,8 +6503,7 @@ etags_getcwd ()
 /* Return a newly allocated string containing the file name of FILE
    relative to the absolute directory DIR (which should end with a slash). */
 static char *
-relative_filename (file, dir)
-     char *file, *dir;
+relative_filename (char *file, char *dir)
 {
   char *fp, *dp, *afn, *res;
   int i;
@@ -6662,8 +6542,7 @@ relative_filename (file, dir)
 /* Return a newly allocated string containing the absolute file name
    of FILE given DIR (which should end with a slash). */
 static char *
-absolute_filename (file, dir)
-     char *file, *dir;
+absolute_filename (char *file, char *dir)
 {
   char *slashp, *cp, *res;
 
@@ -6736,8 +6615,7 @@ absolute_filename (file, dir)
    file name of dir where FILE resides given DIR (which should
    end with a slash). */
 static char *
-absolute_dirname (file, dir)
-     char *file, *dir;
+absolute_dirname (char *file, char *dir)
 {
   char *slashp, *res;
   char save;
@@ -6756,8 +6634,7 @@ absolute_dirname (file, dir)
 /* Whether the argument string is an absolute file name.  The argument
    string must have been canonicalized with canonicalize_filename. */
 static bool
-filename_is_absolute (fn)
-     char *fn;
+filename_is_absolute (char *fn)
 {
   return (fn[0] == '/'
 #ifdef DOS_NT
@@ -6769,8 +6646,7 @@ filename_is_absolute (fn)
 /* Upcase DOS drive letter and collapse separators into single slashes.
    Works in place. */
 static void
-canonicalize_filename (fn)
-     register char *fn;
+canonicalize_filename (register char *fn)
 {
   register char* cp;
   char sep = '/';
@@ -6799,8 +6675,7 @@ canonicalize_filename (fn)
 \f
 /* Initialize a linebuffer for use. */
 static void
-linebuffer_init (lbp)
-     linebuffer *lbp;
+linebuffer_init (linebuffer *lbp)
 {
   lbp->size = (DEBUG) ? 3 : 200;
   lbp->buffer = xnew (lbp->size, char);
@@ -6810,9 +6685,7 @@ linebuffer_init (lbp)
 
 /* Set the minimum size of a string contained in a linebuffer. */
 static void
-linebuffer_setlen (lbp, toksize)
-     linebuffer *lbp;
-     int toksize;
+linebuffer_setlen (linebuffer *lbp, int toksize)
 {
   while (lbp->size <= toksize)
     {
@@ -6824,8 +6697,7 @@ linebuffer_setlen (lbp, toksize)
 
 /* Like malloc but get fatal error if memory is exhausted. */
 static PTR
-xmalloc (size)
-     unsigned int size;
+xmalloc (unsigned int size)
 {
   PTR result = (PTR) malloc (size);
   if (result == NULL)
@@ -6834,9 +6706,7 @@ xmalloc (size)
 }
 
 static PTR
-xrealloc (ptr, size)
-     char *ptr;
-     unsigned int size;
+xrealloc (char *ptr, unsigned int size)
 {
   PTR result = (PTR) realloc (ptr, size);
   if (result == NULL)
index f98fb749476125a81e78bdf3baaf5b5bebc053ba..16baeb266a8b97959930c1d7a83ecc486ce7a5c1 100644 (file)
@@ -30,7 +30,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #if defined (BSD_SYSTEM) && !defined (USE_FAKEMAIL)
 /* This program isnot used in BSD, so just avoid loader complaints.  */
 int
-main ()
+main (void)
 {
   return 0;
 }
@@ -59,6 +59,7 @@ main ()
 #include <ctype.h>
 #include <time.h>
 #include <pwd.h>
+#include <stdlib.h>
 
 /* This is to declare cuserid.  */
 #ifdef HAVE_UNISTD_H
@@ -100,7 +101,7 @@ typedef struct header_record *header;
 struct stream_record
 {
   FILE *handle;
-  int (*action)();
+  int (*action)(FILE *);
   struct stream_record *rest_streams;
 };
 typedef struct stream_record *stream_list;
@@ -140,19 +141,16 @@ struct linebuffer lb;
 #define MAIL_PROGRAM_NAME "/bin/mail"
 #endif
 
-static char *my_name;
+static const char *my_name;
 static char *the_date;
 static char *the_user;
 static line_list file_preface;
 static stream_list the_streams;
 static boolean no_problems = true;
 
-extern FILE *popen ();
-extern int fclose (), pclose ();
+static void fatal (const char *s1) NO_RETURN;
 
 #ifdef CURRENT_USER
-extern struct passwd *getpwuid ();
-extern unsigned short geteuid ();
 static struct passwd *my_entry;
 #define cuserid(s)                             \
 (my_entry = getpwuid (((int) geteuid ())),     \
@@ -164,8 +162,7 @@ static struct passwd *my_entry;
 /* Print error message.  `s1' is printf control string, `s2' is arg for it. */
 
 static void
-error (s1, s2)
-     char *s1, *s2;
+error (const char *s1, const char *s2)
 {
   printf ("%s: ", my_name);
   printf (s1, s2);
@@ -176,8 +173,7 @@ error (s1, s2)
 /* Print error message and exit.  */
 
 static void
-fatal (s1)
-     char *s1;
+fatal (const char *s1)
 {
   error ("%s", s1);
   exit (EXIT_FAILURE);
@@ -186,8 +182,7 @@ fatal (s1)
 /* Like malloc but get fatal error if memory is exhausted.  */
 
 static long *
-xmalloc (size)
-     int size;
+xmalloc (int size)
 {
   long *result = (long *) malloc (((unsigned) size));
   if (result == ((long *) NULL))
@@ -196,9 +191,7 @@ xmalloc (size)
 }
 
 static long *
-xrealloc (ptr, size)
-     long *ptr;
-     int size;
+xrealloc (long int *ptr, int size)
 {
   long *result = (long *) realloc (ptr, ((unsigned) size));
   if (result == ((long *) NULL))
@@ -209,8 +202,7 @@ xrealloc (ptr, size)
 /* Initialize a linebuffer for use */
 
 void
-init_linebuffer (linebuffer)
-     struct linebuffer *linebuffer;
+init_linebuffer (struct linebuffer *linebuffer)
 {
   linebuffer->size = INITIAL_LINE_SIZE;
   linebuffer->buffer = ((char *) xmalloc (INITIAL_LINE_SIZE));
@@ -220,9 +212,7 @@ init_linebuffer (linebuffer)
    Return the length of the line.  */
 
 long
-readline (linebuffer, stream)
-     struct linebuffer *linebuffer;
-     FILE *stream;
+readline (struct linebuffer *linebuffer, FILE *stream)
 {
   char *buffer = linebuffer->buffer;
   char *p = linebuffer->buffer;
@@ -257,9 +247,7 @@ readline (linebuffer, stream)
    If there is no keyword, return NULL and don't alter *REST.  */
 
 char *
-get_keyword (field, rest)
-     register char *field;
-     char **rest;
+get_keyword (register char *field, char **rest)
 {
   static char keyword[KEYWORD_SIZE];
   register char *ptr;
@@ -284,8 +272,7 @@ get_keyword (field, rest)
 /* Nonzero if the string FIELD starts with a colon-terminated keyword.  */
 
 boolean
-has_keyword (field)
-     char *field;
+has_keyword (char *field)
 {
   char *ignored;
   return (get_keyword (field, &ignored) != ((char *) NULL));
@@ -302,9 +289,7 @@ has_keyword (field)
    the caller has to make it big enough.  */
 
 char *
-add_field (the_list, field, where)
-     line_list the_list;
-     register char *field, *where;
+add_field (line_list the_list, register char *field, register char *where)
 {
   register char c;
   while (true)
@@ -360,7 +345,7 @@ add_field (the_list, field, where)
 }
 \f
 line_list
-make_file_preface ()
+make_file_preface (void)
 {
   char *the_string, *temp;
   long idiotic_interface;
@@ -404,9 +389,7 @@ make_file_preface ()
 }
 
 void
-write_line_list (the_list, the_stream)
-     register line_list the_list;
-     FILE *the_stream;
+write_line_list (register line_list the_list, FILE *the_stream)
 {
   for ( ;
       the_list != ((line_list) NULL) ;
@@ -419,7 +402,7 @@ write_line_list (the_list, the_stream)
 }
 \f
 int
-close_the_streams ()
+close_the_streams (void)
 {
   register stream_list rem;
   for (rem = the_streams;
@@ -432,9 +415,7 @@ close_the_streams ()
 }
 
 void
-add_a_stream (the_stream, closing_action)
-     FILE *the_stream;
-     int (*closing_action)();
+add_a_stream (FILE *the_stream, int (*closing_action) (FILE *))
 {
   stream_list old = the_streams;
   the_streams = new_stream ();
@@ -445,8 +426,7 @@ add_a_stream (the_stream, closing_action)
 }
 
 int
-my_fclose (the_file)
-     FILE *the_file;
+my_fclose (FILE *the_file)
 {
   putc ('\n', the_file);
   fflush (the_file);
@@ -454,8 +434,7 @@ my_fclose (the_file)
 }
 
 boolean
-open_a_file (name)
-     char *name;
+open_a_file (char *name)
 {
   FILE *the_stream = fopen (name, "a");
   if (the_stream != ((FILE *) NULL))
@@ -470,8 +449,7 @@ open_a_file (name)
 }
 
 void
-put_string (s)
-     char *s;
+put_string (char *s)
 {
   register stream_list rem;
   for (rem = the_streams;
@@ -482,21 +460,20 @@ put_string (s)
 }
 
 void
-put_line (string)
-     char *string;
+put_line (const char *string)
 {
   register stream_list rem;
   for (rem = the_streams;
        rem != ((stream_list) NULL);
        rem = rem->rest_streams)
     {
-      char *s = string;
+      const char *s = string;
       int column = 0;
 
       /* Divide STRING into lines.  */
       while (*s != 0)
        {
-         char *breakpos;
+         const char *breakpos;
 
          /* Find the last char that fits.  */
          for (breakpos = s; *breakpos && column < 78; ++breakpos)
@@ -543,9 +520,7 @@ put_line (string)
    Call open_a_file for each file.  */
 
 void
-setup_files (the_list, field)
-     register line_list the_list;
-     register char *field;
+setup_files (register line_list the_list, register char *field)
 {
   register char *start;
   register char c;
@@ -581,8 +556,7 @@ setup_files (the_list, field)
    The result says how big to make the buffer to pass to parse_header.  */
 
 int
-args_size (the_header)
-     header the_header;
+args_size (header the_header)
 {
   register header old = the_header;
   register line_list rem;
@@ -613,9 +587,7 @@ args_size (the_header)
    Also, if the header has any FCC fields, call setup_files for each one.  */
 
 void
-parse_header (the_header, where)
-     header the_header;
-     register char *where;
+parse_header (header the_header, register char *where)
 {
   register header old = the_header;
   do
@@ -647,7 +619,7 @@ parse_header (the_header, where)
    Continuation lines are grouped in the headers they continue.  */
 
 header
-read_header ()
+read_header (void)
 {
   register header the_header = ((header) NULL);
   register line_list *next_line = ((line_list *) NULL);
@@ -701,8 +673,7 @@ read_header ()
 }
 \f
 void
-write_header (the_header)
-     header the_header;
+write_header (header the_header)
 {
   register header old = the_header;
   do
@@ -719,20 +690,16 @@ write_header (the_header)
 }
 \f
 int
-main (argc, argv)
-     int argc;
-     char **argv;
+main (int argc, char **argv)
 {
   char *command_line;
   header the_header;
   long name_length;
-  char *mail_program_name;
+  const char *mail_program_name;
   char buf[BUFLEN + 1];
   register int size;
   FILE *the_pipe;
 
-  extern char *getenv ();
-
   mail_program_name = getenv ("FAKEMAILER");
   if (!(mail_program_name && *mail_program_name))
     mail_program_name = MAIL_PROGRAM_NAME;
index 91fadd81f5a4f21893d5cb888d210c24cdfe78e2..b31ab812534c28ed83aa7b9ae05165509d2ed31d 100644 (file)
@@ -49,12 +49,10 @@ int base = DEFAULT_BASE, un_flag = FALSE, iso_flag = FALSE, endian = 1;
 int group_by = DEFAULT_GROUPING;
 char *progname;
 
-void usage();
+void usage(void) NO_RETURN;
 
 int
-main (argc, argv)
-     int argc;
-     char *argv[];
+main (int argc, char **argv)
 {
   register long address;
   char string[18];
@@ -278,7 +276,7 @@ main (argc, argv)
 }
 
 void
-usage ()
+usage (void)
 {
   fprintf (stderr, "usage: %s [-de] [-iso]\n", progname);
   exit (EXIT_FAILURE);
index eb15342ca5b1dce22cb04959dd23dc1ce872a8b1..4824731672b2eda2d1c85bc26edb41f1b84d1aab 100644 (file)
@@ -67,9 +67,10 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #define IS_DIRECTORY_SEP(_c_) ((_c_) == DIRECTORY_SEP)
 #endif
 
-int scan_file ();
-int scan_lisp_file ();
-int scan_c_file ();
+int scan_file (char *filename);
+int scan_lisp_file (const char *filename, const char *mode);
+int scan_c_file (char *filename, const char *mode);
+void fatal (const char *s1, const char *s2) NO_RETURN;
 
 #ifdef MSDOS
 /* s/msdos.h defines this as sys_chdir, but we're not linking with the
@@ -91,8 +92,7 @@ char *progname;
 
 /* VARARGS1 */
 void
-error (s1, s2)
-     char *s1, *s2;
+error (const char *s1, const char *s2)
 {
   fprintf (stderr, "%s: ", progname);
   fprintf (stderr, s1, s2);
@@ -103,8 +103,7 @@ error (s1, s2)
 
 /* VARARGS1 */
 void
-fatal (s1, s2)
-     char *s1, *s2;
+fatal (const char *s1, const char *s2)
 {
   error (s1, s2);
   exit (EXIT_FAILURE);
@@ -113,8 +112,7 @@ fatal (s1, s2)
 /* Like malloc but get fatal error if memory is exhausted.  */
 
 void *
-xmalloc (size)
-     unsigned int size;
+xmalloc (unsigned int size)
 {
   void *result = (void *) malloc (size);
   if (result == NULL)
@@ -123,9 +121,7 @@ xmalloc (size)
 }
 \f
 int
-main (argc, argv)
-     int argc;
-     char **argv;
+main (int argc, char **argv)
 {
   int i;
   int err_count = 0;
@@ -187,8 +183,7 @@ main (argc, argv)
 
 /* Add a source file name boundary marker in the output file.  */
 void
-put_filename (filename)
-     char *filename;
+put_filename (char *filename)
 {
   char *tmp;
 
@@ -207,8 +202,7 @@ put_filename (filename)
 /* Return 1 if file is not found, 0 if it is found.  */
 
 int
-scan_file (filename)
-     char *filename;
+scan_file (char *filename)
 {
   int len = strlen (filename);
 
@@ -239,10 +233,10 @@ struct rcsoc_state
 
   /* A keyword we look for at the beginning of lines.  If found, it is
      not copied, and SAW_KEYWORD is set to true.  */
-  char *keyword;
+  const char *keyword;
   /* The current point we've reached in an occurrence of KEYWORD in
      the input stream.  */
-  char *cur_keyword_ptr;
+  const char *cur_keyword_ptr;
   /* Set to true if we saw an occurrence of KEYWORD.  */
   int saw_keyword;
 };
@@ -251,9 +245,7 @@ struct rcsoc_state
    spaces are output first.  */
 
 static INLINE void
-put_char (ch, state)
-     int ch;
-     struct rcsoc_state *state;
+put_char (int ch, struct rcsoc_state *state)
 {
   int out_ch;
   do
@@ -286,9 +278,7 @@ put_char (ch, state)
    keyword, but were in fact not.  */
 
 static void
-scan_keyword_or_put_char (ch, state)
-     int ch;
-     struct rcsoc_state *state;
+scan_keyword_or_put_char (int ch, struct rcsoc_state *state)
 {
   if (state->keyword
       && *state->cur_keyword_ptr == ch
@@ -336,7 +326,7 @@ scan_keyword_or_put_char (ch, state)
           keyword, but it was a false alarm.  Output the
           part we scanned.  */
        {
-         char *p;
+         const char *p;
 
          for (p = state->keyword; p < state->cur_keyword_ptr; p++)
            put_char (*p, state);
@@ -359,11 +349,7 @@ scan_keyword_or_put_char (ch, state)
    true if any were encountered.  */
 
 int
-read_c_string_or_comment (infile, printflag, comment, saw_usage)
-     FILE *infile;
-     int printflag;
-     int *saw_usage;
-     int comment;
+read_c_string_or_comment (FILE *infile, int printflag, int comment, int *saw_usage)
 {
   register int c;
   struct rcsoc_state state;
@@ -451,15 +437,12 @@ read_c_string_or_comment (infile, printflag, comment, saw_usage)
    MINARGS and MAXARGS are the minimum and maximum number of arguments.  */
 
 void
-write_c_args (out, func, buf, minargs, maxargs)
-     FILE *out;
-     char *func, *buf;
-     int minargs, maxargs;
+write_c_args (FILE *out, char *func, char *buf, int minargs, int maxargs)
 {
   register char *p;
   int in_ident = 0;
-  int just_spaced = 0;
-  int need_space = 1;
+  char *ident_start;
+  int ident_length = 0;
 
   fprintf (out, "(fn");
 
@@ -469,9 +452,8 @@ write_c_args (out, func, buf, minargs, maxargs)
   for (p = buf; *p; p++)
     {
       char c = *p;
-      int ident_start = 0;
 
-      /* Notice when we start printing a new identifier.  */
+      /* Notice when a new identifier starts.  */
       if ((('A' <= c && c <= 'Z')
           || ('a' <= c && c <= 'z')
           || ('0' <= c && c <= '9')
@@ -481,55 +463,56 @@ write_c_args (out, func, buf, minargs, maxargs)
          if (!in_ident)
            {
              in_ident = 1;
-             ident_start = 1;
-
-             if (need_space)
-               putc (' ', out);
-
-             if (minargs == 0 && maxargs > 0)
-               fprintf (out, "&optional ");
-             just_spaced = 1;
-
-             minargs--;
-             maxargs--;
+             ident_start = p;
            }
          else
-           in_ident = 0;
+           {
+             in_ident = 0;
+             ident_length = p - ident_start;
+           }
        }
 
-      /* Print the C argument list as it would appear in lisp:
-        print underscores as hyphens, and print commas and newlines
-        as spaces.  Collapse adjacent spaces into one.  */
-      if (c == '_')
-       c = '-';
-      else if (c == ',' || c == '\n')
-       c = ' ';
-
-      /* In C code, `default' is a reserved word, so we spell it
-        `defalt'; unmangle that here.  */
-      if (ident_start
-         && strncmp (p, "defalt", 6) == 0
-         && ! (('A' <= p[6] && p[6] <= 'Z')
-               || ('a' <= p[6] && p[6] <= 'z')
-               || ('0' <= p[6] && p[6] <= '9')
-               || p[6] == '_'))
+      /* Found the end of an argument, write out the last seen
+        identifier.  */
+      if (c == ',' || c == ')')
        {
-         fprintf (out, "DEFAULT");
-         p += 5;
-         in_ident = 0;
-         just_spaced = 0;
-       }
-      else if (c != ' ' || !just_spaced)
-       {
-         if (c >= 'a' && c <= 'z')
-           /* Upcase the letter.  */
-           c += 'A' - 'a';
-         putc (c, out);
-       }
+         if (ident_length == 0)
+           {
+             error ("empty arg list for `%s' should be (void), not ()", func);
+             continue;
+           }
+
+         if (strncmp (ident_start, "void", ident_length) == 0)
+           continue;
+
+         putc (' ', out);
+
+         if (minargs == 0 && maxargs > 0)
+           fprintf (out, "&optional ");
 
-      just_spaced = c == ' ';
-      need_space = 0;
+         minargs--;
+         maxargs--;
+
+         /* In C code, `default' is a reserved word, so we spell it
+            `defalt'; unmangle that here.  */
+         if (ident_length == 6 && strncmp (ident_start, "defalt", 6) == 0)
+           fprintf (out, "DEFAULT");
+         else
+           while (ident_length-- > 0)
+             {
+               c = *ident_start++;
+               if (c >= 'a' && c <= 'z')
+                 /* Upcase the letter.  */
+                 c += 'A' - 'a';
+               else if (c == '_')
+                 /* Print underscore as hyphen.  */
+                 c = '-';
+               putc (c, out);
+             }
+       }
     }
+
+  putc (')', out);
 }
 \f
 /* Read through a c file.  If a .o file is named,
@@ -538,8 +521,7 @@ write_c_args (out, func, buf, minargs, maxargs)
    Accepts any word starting DEF... so it finds DEFSIMPLE and DEFPRED.  */
 
 int
-scan_c_file (filename, mode)
-     char *filename, *mode;
+scan_c_file (char *filename, const char *mode)
 {
   FILE *infile;
   register int c;
@@ -815,8 +797,7 @@ scan_c_file (filename, mode)
  */
 
 void
-skip_white (infile)
-     FILE *infile;
+skip_white (FILE *infile)
 {
   char c = ' ';
   while (c == ' ' || c == '\t' || c == '\n' || c == '\r')
@@ -825,9 +806,7 @@ skip_white (infile)
 }
 
 void
-read_lisp_symbol (infile, buffer)
-     FILE *infile;
-     char *buffer;
+read_lisp_symbol (FILE *infile, char *buffer)
 {
   char c;
   char *fillp = buffer;
@@ -855,8 +834,7 @@ read_lisp_symbol (infile, buffer)
 }
 
 int
-scan_lisp_file (filename, mode)
-     char *filename, *mode;
+scan_lisp_file (const char *filename, const char *mode)
 {
   FILE *infile;
   register int c;
index 601d412894e2b0db0be6d71fa59d1b3a4d7db53b..72a04ecff8922eb38fbdc8b389ae209104bf0d14 100644 (file)
@@ -22,7 +22,7 @@ ALL = make-docfile hexl ctags etags movemail ebrowse sorted-doc digest-doc emacs
 
 .PHONY: $(ALL)
 
-VERSION                = 23.2.50
+VERSION                = 24.0.50
 
 LOCAL_FLAGS    = -DWINDOWSNT -DDOS_NT -DSTDC_HEADERS=1 -DNO_LDAV=1 \
                  -DNO_ARCHIVES=1 -DHAVE_CONFIG_H=1 -I../nt/inc \
@@ -143,11 +143,11 @@ $(BLD)/ctags.$(O): ctags.c
 #
 obj =   dosfns.o msdos.o \
        xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o fringe.o image.o \
-       fontset.o \
+       fontset.o menu.o \
        w32.o w32console.o w32fns.o w32heap.o w32inevt.o \
        w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o \
-       font.o w32font.o \
-       dispnew.o frame.o scroll.o xdisp.o window.o \
+       font.o w32font.o w32uniscribe.o \
+       dispnew.o frame.o scroll.o xdisp.o window.o bidi.o \
        charset.o coding.o category.o ccl.o character.o chartab.o \
        cm.o term.o terminal.o xfaces.o \
        emacs.o keyboard.o macros.o keymap.o sysdep.o \
@@ -157,7 +157,7 @@ obj =   dosfns.o msdos.o \
        alloc.o data.o doc.o editfns.o callint.o \
        eval.o floatfns.o fns.o print.o lread.o \
        syntax.o bytecode.o \
-       process.o callproc.o \
+       process.o callproc.o unexw32.o \
        region-cache.o sound.o atimer.o \
        doprnt.o strftime.o intervals.o textprop.o composite.o md5.o
 
@@ -247,7 +247,7 @@ lisp2 = \
        $(lispsource)language/slovak.el \
        $(lispsource)language/romanian.el \
        $(lispsource)language/greek.el \
-       $(lispsource)language/hebrew.el \
+       $(lispsource)language/hebrew.elc \
        $(lispsource)language/japanese.el \
        $(lispsource)language/korean.el \
        $(lispsource)language/lao.el \
@@ -279,8 +279,8 @@ lisp2 = \
        $(lispsource)textmodes/text-mode.elc \
        $(lispsource)emacs-lisp/timer.elc \
        $(lispsource)jka-cmpr-hook.elc \
-       $(lispsource)vc-hooks.elc \
-       $(lispsource)ediff-hook.elc \
+       $(lispsource)vc/vc-hooks.elc \
+       $(lispsource)vc/ediff-hook.elc \
        $(lispsource)epa-hook.elc \
        $(TOOLTIP_SUPPORT) \
        $(WINNT_SUPPORT) \
index ae51df3d39c967fe43ff1f2fb9b97d579b8b7e4f..4ccdc93688c1691ff645a45aca05aa9c37a95a14 100644 (file)
@@ -69,6 +69,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #ifdef HAVE_FCNTL_H
 #include <fcntl.h>
 #endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
 #include "syswait.h"
 #ifdef MAIL_USE_POP
 #include "pop.h"
@@ -140,36 +143,29 @@ static char *mail_spool_name ();
 #endif
 #endif
 
-#ifndef errno
-extern int errno;
-#endif
-char *strerror ();
-#ifdef HAVE_INDEX
-extern char *index __P ((const char *, int));
-#endif
-#ifdef HAVE_RINDEX
-extern char *rindex __P((const char *, int));
+#ifndef HAVE_STRERROR
+char *strerror (int);
 #endif
 
-void fatal ();
-void error ();
-void pfatal_with_name ();
-void pfatal_and_delete ();
-char *concat ();
-long *xmalloc ();
-int popmail ();
-int pop_retr ();
-int mbx_write ();
-int mbx_delimit_begin ();
-int mbx_delimit_end ();
+static void fatal (const char *s1, const char *s2, const char *s3) NO_RETURN;
+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);
+#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);
+static int mbx_write (char *line, int len, FILE *mbf);
+static int mbx_delimit_begin (FILE *mbf);
+static int mbx_delimit_end (FILE *mbf);
+#endif
 
 /* Nonzero means this is name of a lock file to delete on fatal error.  */
 char *delete_lockname;
 
 int
-main (argc, argv)
-     int argc;
-     char **argv;
+main (int argc, char **argv)
 {
   char *inname, *outname;
   int indesc, outdesc;
@@ -562,7 +558,7 @@ mail_spool_name (inname)
   char *indir, *fname;
   int status;
 
-  if (! (fname = rindex (inname, '/')))
+  if (! (fname = strrchr (inname, '/')))
     return NULL;
 
   fname++;
@@ -592,9 +588,8 @@ mail_spool_name (inname)
 \f
 /* Print error message and exit.  */
 
-void
-fatal (s1, s2, s3)
-     char *s1, *s2, *s3;
+static void
+fatal (const char *s1, const char *s2, const char *s3)
 {
   if (delete_lockname)
     unlink (delete_lockname);
@@ -605,9 +600,8 @@ fatal (s1, s2, s3)
 /* Print error message.  `s1' is printf control string, `s2' and `s3'
    are args for it or null. */
 
-void
-error (s1, s2, s3)
-     char *s1, *s2, *s3;
+static void
+error (const char *s1, const char *s2, const char *s3)
 {
   fprintf (stderr, "movemail: ");
   if (s3)
@@ -615,20 +609,18 @@ error (s1, s2, s3)
   else if (s2)
     fprintf (stderr, s1, s2);
   else
-    fprintf (stderr, s1);
+    fprintf (stderr, "%s", s1);
   fprintf (stderr, "\n");
 }
 
-void
-pfatal_with_name (name)
-     char *name;
+static void
+pfatal_with_name (char *name)
 {
   fatal ("%s for %s", strerror (errno), name);
 }
 
-void
-pfatal_and_delete (name)
-     char *name;
+static void
+pfatal_and_delete (char *name)
 {
   char *s = strerror (errno);
   unlink (name);
@@ -637,9 +629,8 @@ pfatal_and_delete (name)
 
 /* Return a newly-allocated string whose contents concatenate those of s1, s2, s3.  */
 
-char *
-concat (s1, s2, s3)
-     char *s1, *s2, *s3;
+static char *
+concat (const char *s1, const char *s2, const char *s3)
 {
   int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3);
   char *result = (char *) xmalloc (len1 + len2 + len3 + 1);
@@ -654,9 +645,8 @@ concat (s1, s2, s3)
 
 /* Like malloc but get fatal error if memory is exhausted.  */
 
-long *
-xmalloc (size)
-     unsigned size;
+static long *
+xmalloc (unsigned int size)
 {
   long *result = (long *) malloc (size);
   if (!result)
@@ -705,25 +695,20 @@ char Errmsg[200];         /* POP errors, at least, can exceed
  * Return a value suitable for passing to `exit'.
  */
 
-int
-popmail (mailbox, outfile, preserve, password, reverse_order)
-     char *mailbox;
-     char *outfile;
-     int preserve;
-     char *password;
-     int reverse_order;
+static int
+popmail (char *mailbox, char *outfile, int preserve, char *password, int reverse_order)
 {
   int nmsgs, nbytes;
   register int i;
   int mbfi;
   FILE *mbf;
-  char *getenv ();
+  char *getenv (const char *);
   popserver server;
   int start, end, increment;
   char *user, *hostname;
 
   user = mailbox;
-  if ((hostname = index(mailbox, ':')))
+  if ((hostname = strchr (mailbox, ':')))
     *hostname++ = '\0';
 
   server = pop_open (hostname, user, password, POP_NO_GETPASS);
@@ -836,13 +821,9 @@ popmail (mailbox, outfile, preserve, password, reverse_order)
   return EXIT_SUCCESS;
 }
 
-int
-pop_retr (server, msgno, arg)
-     popserver server;
-     int msgno;
-     FILE *arg;
+static int
+pop_retr (popserver server, int msgno, FILE *arg)
 {
-  extern char *strerror ();
   char *line;
   int ret;
 
@@ -887,11 +868,8 @@ pop_retr (server, msgno, arg)
                         && (a[3] == 'm') \
                         && (a[4] == ' '))
 
-int
-mbx_write (line, len, mbf)
-     char *line;
-     int len;
-     FILE *mbf;
+static int
+mbx_write (char *line, int len, FILE *mbf)
 {
 #ifdef MOVEMAIL_QUOTE_POP_FROM_LINES
   if (IS_FROM_LINE (line))
@@ -914,9 +892,8 @@ mbx_write (line, len, mbf)
   return (OK);
 }
 
-int
-mbx_delimit_begin (mbf)
-     FILE *mbf;
+static int
+mbx_delimit_begin (FILE *mbf)
 {
   time_t now;
   struct tm *ltime;
@@ -932,9 +909,8 @@ mbx_delimit_begin (mbf)
   return (OK);
 }
 
-int
-mbx_delimit_end (mbf)
-     FILE *mbf;
+static int
+mbx_delimit_end (FILE *mbf)
 {
   if (putc ('\n', mbf) == EOF)
     return (NOTOK);
index c815f32d51d0bc37f3a5ce8036d6980359c1f326..c24b35d9a1984a4911e12f102f3610166d757738 100644 (file)
@@ -38,7 +38,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
    would necessitate including windows.h in the files that used it.
    This is much easier.  */
 void
-sleep(unsigned long seconds)
+sleep (unsigned long seconds)
 {
   Sleep (seconds * 1000);
 }
@@ -56,7 +56,7 @@ static HANDLE getppid_parent;
 static int    getppid_ppid;
 
 int
-getppid(void)
+getppid (void)
 {
   char *ppid;
   DWORD result;
@@ -64,7 +64,7 @@ getppid(void)
   ppid = getenv ("EM_PARENT_PROCESS_ID");
   if (!ppid)
     {
-      printf("no pid.\n");
+      printf ("no pid.\n");
       return 0;
     }
   else
@@ -74,11 +74,11 @@ getppid(void)
 
   if (!getppid_parent)
     {
-      getppid_parent = OpenProcess (SYNCHRONIZE, FALSE, atoi(ppid));
+      getppid_parent = OpenProcess (SYNCHRONIZE, FALSE, atoi (ppid));
       if (!getppid_parent)
        {
          printf ("Failed to open handle to parent process: %d\n",
-                GetLastError());
+                GetLastError ());
          exit (1);
        }
     }
@@ -94,13 +94,13 @@ getppid(void)
       return 1;
     case WAIT_FAILED:
     default:
-      printf ("Checking parent status failed: %d\n", GetLastError());
+      printf ("Checking parent status failed: %d\n", GetLastError ());
       exit (1);
     }
 }
 
 char *
-getlogin ()
+getlogin (void)
 {
   static char user_name[256];
   DWORD  length = sizeof (user_name);
@@ -120,19 +120,19 @@ cuserid (char * s)
 }
 
 unsigned
-getuid ()
+getuid (void)
 {
   return 0;
 }
 
 unsigned
-getgid ()
+getgid (void)
 {
   return 0;
 }
 
 unsigned
-getegid ()
+getegid (void)
 {
   return 0;
 }
@@ -219,7 +219,7 @@ sys_ctime (const time_t *t)
 }
 
 FILE *
-sys_fopen(const char * path, const char * mode)
+sys_fopen (const char * path, const char * mode)
 {
   return fopen (path, mode);
 }
index ab1e7ba2866910673b5a50060d8b5f1cbbf93551..4dd6a32ee329907ac61ca6fa2636b5f4e0cf059a 100644 (file)
@@ -30,25 +30,19 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #ifdef sleep
 #undef sleep
 #endif
-void sleep(unsigned long seconds);
+void sleep (unsigned long seconds);
 char *getwd (char *dir);
-int getppid(void);
-char * getlogin ();
+int getppid (void);
+char * getlogin (void);
 char * cuserid (char * s);
-unsigned getuid ();
-unsigned getegid ();
-unsigned getgid ();
+unsigned getuid (void);
+unsigned getegid (void);
+unsigned getgid (void);
 int setuid (unsigned uid);
 int setegid (unsigned gid);
 char * getpass (const char * prompt);
 int fchown (int fd, unsigned uid, unsigned gid);
 
-#ifndef BSTRING
-#define bzero(b, l) memset(b, 0, l)
-#define bcopy(s, d, l) memcpy(d, s, l)
-#define bcmp(a, b, l) memcmp(a, b, l)
-#endif
-
 /* redirect or undo interceptions created by config.h */
 #undef access
 #define access  _access
index 64488e7e3eae663ee08051d26dd5ad4faaeda5c8..9eabbd2041e53ca7333e743c3b1796f29771a8b1 100644 (file)
@@ -108,24 +108,16 @@ extern int h_errno;
 #endif
 #endif
 
-#ifndef __P
-# ifdef __STDC__
-#  define __P(a) a
-# else
-#  define __P(a) ()
-# endif /* __STDC__ */
-#endif /* ! __P */
-
-static int socket_connection __P((char *, int));
-static int pop_getline __P((popserver, char **));
-static int sendline __P((popserver, char *));
-static int fullwrite __P((int, char *, int));
-static int getok __P((popserver));
+static int socket_connection (char *, int);
+static int pop_getline (popserver, char **);
+static int sendline (popserver, const char *);
+static int fullwrite (int, char *, int);
+static int getok (popserver);
 #if 0
-static int gettermination __P((popserver));
+static int gettermination (popserver);
 #endif
-static void pop_trash __P((popserver));
-static char *find_crlf __P((char *, int));
+static void pop_trash (popserver);
+static char *find_crlf (char *, int);
 
 #define ERROR_MAX 160          /* a pretty arbitrary size, but needs
                                   to be bigger than the original
@@ -174,11 +166,7 @@ int pop_debug = 0;
  *     explanation of the error.
  */
 popserver
-pop_open (host, username, password, flags)
-     char *host;
-     char *username;
-     char *password;
-     int flags;
+pop_open (char *host, char *username, char *password, int flags)
 {
   int sock;
   popserver server;
@@ -345,10 +333,7 @@ pop_open (host, username, password, flags)
  *     connection impossible.
  */
 int
-pop_stat (server, count, size)
-     popserver server;
-     int *count;
-     int *size;
+pop_stat (popserver server, int *count, int *size)
 {
   char *fromserver;
   char *end_ptr;
@@ -421,11 +406,7 @@ pop_stat (server, count, size)
  *     connection impossible.
  */
 int
-pop_list (server, message, IDs, sizes)
-     popserver server;
-     int message;
-     int **IDs;
-     int **sizes;
+pop_list (popserver server, int message, int **IDs, int **sizes)
 {
   int how_many, i;
   char *fromserver;
@@ -484,7 +465,7 @@ pop_list (server, message, IDs, sizes)
          return (-1);
        }
       (*IDs)[0] = atoi (&fromserver[4]);
-      fromserver = index (&fromserver[4], ' ');
+      fromserver = strchr (&fromserver[4], ' ');
       if (! fromserver)
        {
          strcpy (pop_error,
@@ -515,7 +496,7 @@ pop_list (server, message, IDs, sizes)
              return (-1);
            }
          (*IDs)[i] = atoi (fromserver);
-         fromserver = index (fromserver, ' ');
+         fromserver = strchr (fromserver, ' ');
          if (! fromserver)
            {
              strcpy (pop_error,
@@ -567,11 +548,7 @@ pop_list (server, message, IDs, sizes)
  * Side effects: May kill connection on error.
  */
 int
-pop_retrieve (server, message, markfrom, msg_buf)
-     popserver server;
-     int message;
-     int markfrom;
-     char **msg_buf;
+pop_retrieve (popserver server, int message, int markfrom, char **msg_buf)
 {
   int *IDs, *sizes, bufsize, fromcount = 0, cp = 0;
   char *ptr, *fromserver;
@@ -635,7 +612,7 @@ pop_retrieve (server, message, markfrom, msg_buf)
            }
          ptr[cp++] = '>';
        }
-      bcopy (fromserver, &ptr[cp], ret);
+      memcpy (&ptr[cp], fromserver, ret);
       cp += ret;
       ptr[cp++] = '\n';
     }
@@ -645,10 +622,7 @@ pop_retrieve (server, message, markfrom, msg_buf)
 }
 
 int
-pop_retrieve_first (server, message, response)
-     popserver server;
-     int message;
-     char **response;
+pop_retrieve_first (popserver server, int message, char **response)
 {
   sprintf (pop_error, "RETR %d", message);
   return (pop_multi_first (server, pop_error, response));
@@ -663,25 +637,19 @@ pop_retrieve_first (server, message, response)
   */
 
 int
-pop_retrieve_next (server, line)
-     popserver server;
-     char **line;
+pop_retrieve_next (popserver server, char **line)
 {
   return (pop_multi_next (server, line));
 }
 
 int
-pop_retrieve_flush (server)
-     popserver server;
+pop_retrieve_flush (popserver server)
 {
   return (pop_multi_flush (server));
 }
 
 int
-pop_top_first (server, message, lines, response)
-     popserver server;
-     int message, lines;
-     char **response;
+pop_top_first (popserver server, int message, int lines, char **response)
 {
   sprintf (pop_error, "TOP %d %d", message, lines);
   return (pop_multi_first (server, pop_error, response));
@@ -696,25 +664,19 @@ pop_top_first (server, message, lines, response)
   */
 
 int
-pop_top_next (server, line)
-     popserver server;
-     char **line;
+pop_top_next (popserver server, char **line)
 {
   return (pop_multi_next (server, line));
 }
 
 int
-pop_top_flush (server)
-     popserver server;
+pop_top_flush (popserver server)
 {
   return (pop_multi_flush (server));
 }
 
 int
-pop_multi_first (server, command, response)
-     popserver server;
-     char *command;
-     char **response;
+pop_multi_first (popserver server, const char *command, char **response)
 {
   if (server->in_multi)
     {
@@ -757,9 +719,7 @@ pop_multi_first (server, command, response)
   0, LINE is set to null. */
 
 int
-pop_multi_next (server, line)
-     popserver server;
-     char **line;
+pop_multi_next (popserver server, char **line)
 {
   char *fromserver;
   int ret;
@@ -797,8 +757,7 @@ pop_multi_next (server, line)
 }
 
 int
-pop_multi_flush (server)
-     popserver server;
+pop_multi_flush (popserver server)
 {
   char *line;
   int ret;
@@ -829,9 +788,7 @@ pop_multi_flush (server)
  *     otherwise.
  */
 int
-pop_delete (server, message)
-     popserver server;
-     int message;
+pop_delete (popserver server, int message)
 {
   if (server->in_multi)
     {
@@ -861,8 +818,7 @@ pop_delete (server, message)
  * Side effects: Closes connection on error.
  */
 int
-pop_noop (server)
-     popserver server;
+pop_noop (popserver server)
 {
   if (server->in_multi)
     {
@@ -891,8 +847,7 @@ pop_noop (server)
  * Side effects: Closes the connection on error.
  */
 int
-pop_last (server)
-     popserver server;
+pop_last (popserver server)
 {
   char *fromserver;
 
@@ -949,8 +904,7 @@ pop_last (server)
  * Side effects: Closes the connection on error.
  */
 int
-pop_reset (server)
-     popserver server;
+pop_reset (popserver server)
 {
   if (pop_retrieve_flush (server))
     {
@@ -978,8 +932,7 @@ pop_reset (server)
  *     function is called, even if an error occurs.
  */
 int
-pop_quit (server)
-     popserver server;
+pop_quit (popserver server)
 {
   int ret = 0;
 
@@ -1023,9 +976,7 @@ static int have_winsock = 0;
  *     into pop_error.
  */
 static int
-socket_connection (host, flags)
-     char *host;
-     int flags;
+socket_connection (char *host, int flags)
 {
 #ifdef HAVE_GETADDRINFO
   struct addrinfo *res, *it;
@@ -1037,7 +988,7 @@ socket_connection (host, flags)
   struct servent *servent;
   struct sockaddr_in addr;
   char found_port = 0;
-  char *service;
+  const char *service;
   int sock;
   char *realhost;
 #ifdef KERBEROS
@@ -1069,7 +1020,7 @@ socket_connection (host, flags)
   }
 #endif
 
-  bzero ((char *) &addr, sizeof (addr));
+  memset (&addr, 0, sizeof (addr));
   addr.sin_family = AF_INET;
 
   /** "kpop" service is  never used: look for 20060515 to see why **/
@@ -1145,8 +1096,7 @@ socket_connection (host, flags)
           if (it->ai_addrlen == sizeof (addr))
             {
               struct sockaddr_in *in_a = (struct sockaddr_in *) it->ai_addr;
-              bcopy (&in_a->sin_addr, (char *) &addr.sin_addr,
-                     sizeof (addr.sin_addr));
+              memcpy (&addr.sin_addr, &in_a->sin_addr, sizeof (addr.sin_addr));
               if (! connect (sock, (struct sockaddr *) &addr, sizeof (addr)))
                 break;
             }
@@ -1174,8 +1124,7 @@ socket_connection (host, flags)
 
   while (*hostent->h_addr_list)
     {
-      bcopy (*hostent->h_addr_list, (char *) &addr.sin_addr,
-            hostent->h_length);
+      memcpy (&addr.sin_addr, *hostent->h_addr_list, hostent->h_length);
       if (! connect (sock, (struct sockaddr *) &addr, sizeof (addr)))
        break;
       hostent->h_addr_list++;
@@ -1335,9 +1284,7 @@ socket_connection (host, flags)
  * THE RETURNED LINE MAY CONTAIN EMBEDDED NULLS!
  */
 static int
-pop_getline (server, line)
-     popserver server;
-     char **line;
+pop_getline (popserver server, char **line)
 {
 #define GETLINE_ERROR "Error reading from server: "
 
@@ -1369,8 +1316,8 @@ pop_getline (server, line)
        }
       else
        {
-         bcopy (server->buffer + server->buffer_index,
-                server->buffer, server->data);
+         memmove (server->buffer, server->buffer + server->buffer_index,
+                  server->data);
          /* Record the fact that we've searched the data already in
              the buffer for a CRLF, so that when we search below, we
              don't have to search the same data twice.  There's a "-
@@ -1467,9 +1414,7 @@ pop_getline (server, line)
  * Side effects: Closes the connection on error.
  */
 static int
-sendline (server, line)
-     popserver server;
-     char *line;
+sendline (popserver server, const char *line)
 {
 #define SENDLINE_ERROR "Error writing to POP server: "
   int ret;
@@ -1516,10 +1461,7 @@ sendline (server, line)
  * Return value: Same as write.  Pop_error is not set.
  */
 static int
-fullwrite (fd, buf, nbytes)
-     int fd;
-     char *buf;
-     int nbytes;
+fullwrite (int fd, char *buf, int nbytes)
 {
   char *cp;
   int ret = 0;
@@ -1549,8 +1491,7 @@ fullwrite (fd, buf, nbytes)
  * Side effects: On failure, may make the connection unusable.
  */
 static int
-getok (server)
-     popserver server;
+getok (popserver server)
 {
   char *fromline;
 
@@ -1621,8 +1562,7 @@ gettermination (server)
  *     since the last pop_reset) may be lost.
  */
 void
-pop_close (server)
-     popserver server;
+pop_close (popserver server)
 {
   pop_trash (server);
   free ((char *) server);
@@ -1638,8 +1578,7 @@ pop_close (server)
  *     pop_close or pop_quit after this function has been called.
  */
 static void
-pop_trash (server)
-     popserver server;
+pop_trash (popserver server)
 {
   if (server->file >= 0)
     {
@@ -1671,9 +1610,7 @@ pop_trash (server)
    null, or 0 if it does not contain one.  */
 
 static char *
-find_crlf (in_string, len)
-     char *in_string;
-     int len;
+find_crlf (char *in_string, int len)
 {
   while (len--)
     {
index 4b6853e77c85f2fdf2185eb17788fe877f829f25..2ba3fab83a010233ebdf87519e38019b8772b466 100644 (file)
@@ -49,39 +49,31 @@ typedef struct _popserver *popserver;
 #define POP_NO_HESIOD  (1<<1)
 #define POP_NO_GETPASS         (1<<2)
 
-#ifdef __STDC__
-#define _ARGS(a) a
-#else
-#define _ARGS(a) ()
-#endif
-
-extern popserver pop_open _ARGS((char *host, char *username, char *password,
-                                int flags));
-extern int pop_stat _ARGS((popserver server, int *count, int *size));
-extern int pop_list _ARGS((popserver server, int message, int **IDs,
-                          int **size));
-extern int pop_retrieve _ARGS((popserver server, int message, int markfrom,
-                              char **));
-extern int pop_retrieve_first _ARGS((popserver server, int message,
-                                    char **response));
-extern int pop_retrieve_next _ARGS((popserver server, char **line));
-extern int pop_retrieve_flush _ARGS((popserver server));
-extern int pop_top_first _ARGS((popserver server, int message, int lines,
-                               char **response));
-extern int pop_top_next _ARGS((popserver server, char **line));
-extern int pop_top_flush _ARGS((popserver server));
-extern int pop_multi_first _ARGS((popserver server, char *command,
-                                 char **response));
-extern int pop_multi_next _ARGS((popserver server, char **line));
-extern int pop_multi_flush _ARGS((popserver server));
-extern int pop_delete _ARGS((popserver server, int message));
-extern int pop_noop _ARGS((popserver server));
-extern int pop_last _ARGS((popserver server));
-extern int pop_reset _ARGS((popserver server));
-extern int pop_quit _ARGS((popserver server));
-extern void pop_close _ARGS((popserver));
-
-#undef _ARGS
+extern popserver pop_open (char *host, char *username, char *password,
+                           int flags);
+extern int pop_stat (popserver server, int *count, int *size);
+extern int pop_list (popserver server, int message, int **IDs,
+                     int **size);
+extern int pop_retrieve (popserver server, int message, int markfrom,
+                         char **);
+extern int pop_retrieve_first (popserver server, int message,
+                               char **response);
+extern int pop_retrieve_next (popserver server, char **line);
+extern int pop_retrieve_flush (popserver server);
+extern int pop_top_first (popserver server, int message, int lines,
+                          char **response);
+extern int pop_top_next (popserver server, char **line);
+extern int pop_top_flush (popserver server);
+extern int pop_multi_first (popserver server, const char *command,
+                            char **response);
+extern int pop_multi_next (popserver server, char **line);
+extern int pop_multi_flush (popserver server);
+extern int pop_delete (popserver server, int message);
+extern int pop_noop (popserver server);
+extern int pop_last (popserver server);
+extern int pop_reset (popserver server);
+extern int pop_quit (popserver server);
+extern void pop_close (popserver);
 
 /* arch-tag: 76cc5f58-8e86-48fa-bc72-a7c6cb1c4f1c
    (do not change this comment) */
index 0347350a7993d87ad10cbd3174f6fd63614ed000..37653e63c4966c08c01b1565181fb228d5522da1 100644 (file)
@@ -40,7 +40,7 @@ static char time_string[30];
 /* Reset the stopwatch to zero.  */
 
 void
-reset_watch ()
+reset_watch (void)
 {
   EMACS_GET_TIME (TV1);
   watch_not_started = 0;
@@ -51,7 +51,7 @@ reset_watch ()
    If reset_watch was not called yet, exit.  */
 
 char *
-get_time ()
+get_time (void)
 {
   if (watch_not_started)
     exit (EXIT_FAILURE);  /* call reset_watch first ! */
@@ -79,7 +79,7 @@ gettimeofday (tp, tzp)
 #endif
 \f
 int
-main ()
+main (void)
 {
   int c;
   while ((c = getchar ()) != EOF)
index ce58529193a0758abd4052a9740b24364b608fcd..db3f3029532aa5974f34d106c15fecf24ec03da6 100644 (file)
@@ -65,8 +65,7 @@ struct docstr                 /* Allocated thing for an entry. */
 /* Print error message.  `s1' is printf control string, `s2' is arg for it. */
 
 void
-error (s1, s2)
-     char *s1, *s2;
+error (const char *s1, const char *s2)
 {
   fprintf (stderr, "sorted-doc: ");
   fprintf (stderr, s1, s2);
@@ -76,8 +75,7 @@ error (s1, s2)
 /* Print error message and exit.  */
 
 void
-fatal (s1, s2)
-     char *s1, *s2;
+fatal (const char *s1, const char *s2)
 {
   error (s1, s2);
   exit (EXIT_FAILURE);
@@ -86,8 +84,7 @@ fatal (s1, s2)
 /* Like malloc but get fatal error if memory is exhausted.  */
 
 char *
-xmalloc (size)
-     int size;
+xmalloc (int size)
 {
   char *result = malloc ((unsigned)size);
   if (result == NULL)
@@ -96,8 +93,7 @@ xmalloc (size)
 }
 
 char *
-xstrdup (str)
-     char * str;
+xstrdup (char *str)
 {
   char *buf = xmalloc (strlen (str) + 1);
   (void) strcpy (buf, str);
@@ -107,28 +103,27 @@ xstrdup (str)
 /* Comparison function for qsort to call.  */
 
 int
-cmpdoc (a, b)
-     DOCSTR **a;
-     DOCSTR **b;
+cmpdoc (const void *va, const void *vb)
 {
+  DOCSTR *const *a = va;
+  DOCSTR *const *b = vb;
   register int val = strcmp ((*a)->name, (*b)->name);
   if (val) return val;
   return (*a)->type - (*b)->type;
 }
 
-
 enum state
 {
   WAITING, BEG_NAME, NAME_GET, BEG_DESC, DESC_GET
 };
 
-char *states[] =
+const char *states[] =
 {
   "WAITING", "BEG_NAME", "NAME_GET", "BEG_DESC", "DESC_GET"
 };
 
 int
-main ()
+main (void)
 {
   register DOCSTR *dp = NULL;  /* allocated DOCSTR */
   register LINE *lp = NULL;    /* allocated line */
index a6c7c187f8adc17583edf1869d106911c1f89aec..880bd11588256960baa4b4df39eb5c2b2a0342d0 100644 (file)
@@ -52,10 +52,7 @@ char buf[300];
 
 /* Like `read' but keeps trying until it gets SIZE bytes or reaches eof.  */
 int
-cool_read (fd, buf, size)
-     int fd;
-     char *buf;
-     int size;
+cool_read (int fd, char *buf, int size)
 {
   int num, sofar = 0;
 
@@ -70,9 +67,7 @@ cool_read (fd, buf, size)
 }
 
 int
-main (argc, argv)
-     int argc;
-     char **argv;
+main (int argc, char **argv)
 {
   int fd;
 
index 24fd45f72d352b31ce2bf7694dacf59789cd1276..b8e1147d1c1b3e72029a0e92a21146fe80e24e9b 100644 (file)
@@ -60,25 +60,19 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 extern char *optarg;
 extern int optind, opterr;
 
+int usage (int err) NO_RETURN;
+
 #define MAX_ATTEMPTS 5
 #define MAX_SCORES 200
 #define MAX_DATA_LEN 1024
 
-/* Declare the prototype for a general external function.  */
-#if defined (PROTOTYPES) || defined (WINDOWSNT)
-#define P_(proto) proto
-#else
-#define P_(proto) ()
-#endif
-
 #ifndef HAVE_DIFFTIME
 /* OK on POSIX (time_t is arithmetic type) modulo overflow in subtraction.  */
 #define difftime(t1, t0) (double)((t1) - (t0))
 #endif
 
 int
-usage (err)
-     int err;
+usage (int err)
 {
   fprintf (stdout, "Usage: update-game-score [-m MAX ] [ -r ] game/scorefile SCORE DATA\n");
   fprintf (stdout, "       update-game-score -h\n");
@@ -89,8 +83,8 @@ usage (err)
   exit (err);
 }
 
-int lock_file P_ ((const char *filename, void **state));
-int unlock_file P_ ((const char *filename, void *state));
+int lock_file (const char *filename, void **state);
+int unlock_file (const char *filename, void *state);
 
 struct score_entry
 {
@@ -99,25 +93,24 @@ struct score_entry
   char *data;
 };
 
-int read_scores P_ ((const char *filename, struct score_entry **scores,
-                    int *count));
-int push_score P_ ((struct score_entry **scores, int *count,
-                   int newscore, char *username, char *newdata));
-void sort_scores P_ ((struct score_entry *scores, int count, int reverse));
-int write_scores P_ ((const char *filename, const struct score_entry *scores,
-                     int count));
+int read_scores (const char *filename, struct score_entry **scores,
+                 int *count);
+int push_score (struct score_entry **scores, int *count,
+                int newscore, char *username, char *newdata);
+void sort_scores (struct score_entry *scores, int count, int reverse);
+int write_scores (const char *filename, const struct score_entry *scores,
+                  int count);
 
-void lose P_ ((const char *msg)) NO_RETURN;
+void lose (const char *msg) NO_RETURN;
 
 void
-lose (msg)
-     const char *msg;
+lose (const char *msg)
 {
   fprintf (stderr, "%s\n", msg);
   exit (EXIT_FAILURE);
 }
 
-void lose_syserr P_ ((const char *msg)) NO_RETURN;
+void lose_syserr (const char *msg) NO_RETURN;
 
 /* Taken from sysdep.c.  */
 #ifndef HAVE_STRERROR
@@ -137,15 +130,14 @@ strerror (errnum)
 #endif /* ! HAVE_STRERROR */
 
 void
-lose_syserr (msg)
-     const char *msg;
+lose_syserr (const char *msg)
 {
   fprintf (stderr, "%s: %s\n", msg, strerror (errno));
   exit (EXIT_FAILURE);
 }
 
 char *
-get_user_id P_ ((void))
+get_user_id (void)
 {
   char *name;
   struct passwd *buf = getpwuid (getuid ());
@@ -165,10 +157,8 @@ get_user_id P_ ((void))
   return buf->pw_name;
 }
 
-char *
-get_prefix (running_suid, user_prefix)
-     int running_suid;
-     char *user_prefix;
+const char *
+get_prefix (int running_suid, const char *user_prefix)
 {
   if (!running_suid && user_prefix == NULL)
     lose ("Not using a shared game directory, and no prefix given.");
@@ -184,13 +174,12 @@ get_prefix (running_suid, user_prefix)
 }
 
 int
-main (argc, argv)
-     int argc;
-     char **argv;
+main (int argc, char **argv)
 {
   int c, running_suid;
   void *lockstate;
-  char *user_id, *scorefile, *prefix, *user_prefix = NULL;
+  char *user_id, *scorefile;
+  const char *prefix, *user_prefix = NULL;
   struct stat buf;
   struct score_entry *scores;
   int newscore, scorecount, reverse = 0, max = MAX_SCORES;
@@ -273,9 +262,7 @@ main (argc, argv)
 }
 
 int
-read_score (f, score)
-     FILE *f;
-     struct score_entry *score;
+read_score (FILE *f, struct score_entry *score)
 {
   int c;
   if (feof (f))
@@ -359,10 +346,7 @@ read_score (f, score)
 }
 
 int
-read_scores (filename, scores, count)
-     const char *filename;
-     struct score_entry **scores;
-     int *count;
+read_scores (const char *filename, struct score_entry **scores, int *count)
 {
   int readval, scorecount, cursize;
   struct score_entry *ret;
@@ -395,9 +379,7 @@ read_scores (filename, scores, count)
 }
 
 int
-score_compare (a, b)
-     const void *a;
-     const void *b;
+score_compare (const void *a, const void *b)
 {
   const struct score_entry *sa = (const struct score_entry *) a;
   const struct score_entry *sb = (const struct score_entry *) b;
@@ -405,9 +387,7 @@ score_compare (a, b)
 }
 
 int
-score_compare_reverse (a, b)
-     const void *a;
-     const void *b;
+score_compare_reverse (const void *a, const void *b)
 {
   const struct score_entry *sa = (const struct score_entry *) a;
   const struct score_entry *sb = (const struct score_entry *) b;
@@ -415,11 +395,7 @@ score_compare_reverse (a, b)
 }
 
 int
-push_score (scores, count, newscore, username, newdata)
-     struct score_entry **scores;
-     int *count; int newscore;
-     char *username;
-     char *newdata;
+push_score (struct score_entry **scores, int *count, int newscore, char *username, char *newdata)
 {
  struct score_entry *newscores
    = (struct score_entry *) realloc (*scores,
@@ -435,20 +411,14 @@ push_score (scores, count, newscore, username, newdata)
 }
 
 void
-sort_scores (scores, count, reverse)
-     struct score_entry *scores;
-     int count;
-     int reverse;
+sort_scores (struct score_entry *scores, int count, int reverse)
 {
   qsort (scores, count, sizeof (struct score_entry),
        reverse ? score_compare_reverse : score_compare);
 }
 
 int
-write_scores (filename, scores, count)
-     const char *filename;
-     const struct score_entry * scores;
-     int count;
+write_scores (const char *filename, const struct score_entry *scores, int count)
 {
   FILE *f;
   int i;
@@ -477,14 +447,12 @@ write_scores (filename, scores, count)
 }
 
 int
-lock_file (filename, state)
-  const char *filename;
-  void **state;
+lock_file (const char *filename, void **state)
 {
   int fd;
   struct stat buf;
   int attempts = 0;
-  char *lockext = ".lockfile";
+  const char *lockext = ".lockfile";
   char *lockpath = malloc (strlen (filename) + strlen (lockext) + 60);
   if (!lockpath)
     return -1;
@@ -520,9 +488,7 @@ lock_file (filename, state)
 }
 
 int
-unlock_file (filename, state)
-  const char *filename;
- void *state;
+unlock_file (const char *filename, void *state)
 {
   char *lockpath = (char *) state;
   int ret = unlink (lockpath);
diff --git a/lisp/.arch-inventory b/lisp/.arch-inventory
deleted file mode 100644 (file)
index 5341c2d..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-# Auto-generated lisp files, which ignore
-precious ^(loaddefs|finder-inf|cus-load)\.el$
-
-# arch-tag: fc62dc9f-3a91-455b-b8e7-d49df66beee0
index d61a8c565a83f87b2fe91e21c19112881c2836ff..cea29413eb910a13b54dc5ce4177cafb19d0d23e 100644 (file)
@@ -9,6 +9,235 @@
        characters in the element vector.
        (standard-display-european): Likewise.
 
+2010-08-31  Masatake YAMATO  <yamato@redhat.com>
+
+       * textmodes/nroff-mode.el (nroff-view): New command.
+       (nroff-mode-map): Bind it to C-c C-c.
+
+2010-08-31  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/smie.el (smie-down-list): New command.
+
+       Remove old indentation and navigation code on octave-mode.
+       * progmodes/octave-mod.el (octave-mode-map): Remap down-list to
+       smie-down-list rather than add a binding for octave-down-block.
+       (octave-mark-block, octave-blink-matching-block-open):
+       Rely on forward-sexp-function.
+       (octave-fill-paragraph): Don't narrow, so you can use
+       indent-according-to-mode.
+       (octave-block-begin-regexp, octave-block-begin-or-end-regexp): Remove.
+       (octave-in-block-p, octave-re-search-forward-kw)
+       (octave-re-search-backward-kw, octave-indent-calculate)
+       (octave-end-as-array-index-p, octave-block-end-offset)
+       (octave-scan-blocks, octave-forward-block, octave-backward-block)
+       (octave-down-block, octave-backward-up-block, octave-up-block)
+       (octave-before-magic-comment-p, octave-indent-line): Remove.
+
+2010-08-31  Chong Yidong  <cyd@stupidchicken.com>
+
+       * emacs-lisp/package.el (package--read-archive-file): Just use
+       `read', to avoid copying an additional string.
+       (package-menu-mode): Set header-line-format here.
+       (package-menu-refresh, package-menu-revert): Signal an error if
+       not in the Package Menu.
+       (package-menu-package-list): New var.
+       (package--generate-package-list): Operate on the current buffer;
+       don't assume that it is *Packages*, since the user may rename it.
+       Allow persistent package listings and sort keys using
+       package-menu-package-list and package-menu-package-sort-key.
+       (package-menu--version-predicate): Fix version calculation.
+       (package-menu-sort-by-column): Don't select the window.
+       (package--list-packages): Create the *Packages* buffer.
+       Set package-menu-package-list-key.
+       (list-packages): Sorting by status is now the default.
+       (package-buffer-info): Use match-string-no-properties.
+       (define-package): Add a &rest argument for future proofing, but
+       don't use it yet.
+       (package-install-from-buffer, package-install-buffer-internal):
+       Merge into a single function, package-install-from-buffer.
+       (package-install-file): Change caller.
+
+       * finder.el: Load finder-inf using `require'.
+       (finder-list-matches): Sorting by status is now the default.
+       (finder-compile-keywords): Simpify printing.
+
+2010-08-30  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * progmodes/octave-mod.el (octave-font-lock-keywords): Use regexp-opt.
+       (octave-mode-map): Remove special bindings for forward/backward-block
+       and octave-backward-up-block.  Use smie-close-block.
+       (octave-continuation-marker-regexp): New var.
+       (octave-continuation-regexp): Use it.
+       (octave-operator-table, octave-smie-op-levels)
+       (octave-operator-regexp, octave-smie-indent-rules): New vars.
+       (octave-smie-backward-token, octave-smie-forward-token): New funs.
+       (octave-mode): Use SMIE.
+       (octave-close-block): Delete.
+
+2010-08-30  Eli Zaretskii  <eliz@gnu.org>
+
+       * menu-bar.el (menu-bar-edit-menu) <"Paste">: Check selection in
+       CLIPBOARD, not in PRIMARY.  (Bug#6944)
+
+2010-08-30  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/smie.el (smie-indent-offset-rule): Let :parent take
+       a list of parents.
+       (smie-indent-column): Allow indirection through variables.
+
+       * composite.el (save-buffer-state): Delete, unused.
+       * font-lock.el (save-buffer-state): Use with-silent-modifications.
+       (font-lock-default-fontify-region): Use with-syntax-table.
+       * jit-lock.el (with-buffer-unmodified): Remove.
+       (with-buffer-prepared-for-jit-lock): Use with-silent-modifications.
+
+       Use `declare' in defmacros.
+       * window.el (save-selected-window):
+       * subr.el (with-temp-file, with-temp-message, with-syntax-table):
+       * progmodes/python.el (def-python-skeleton):
+       * net/dbus.el (dbus-ignore-errors):
+       * jka-cmpr-hook.el (with-auto-compression-mode):
+       * international/mule.el (with-category-table):
+       * emacs-lisp/timer.el (with-timeout):
+       * emacs-lisp/lisp-mnt.el (lm-with-file):
+       * emacs-lisp/eieio.el (with-slots):
+       * emacs-lisp/easymenu.el (easy-menu-define):
+       * emacs-lisp/debug.el (debugger-env-macro):
+       * emacs-lisp/cl-compat.el (Multiple-value-bind, Multiple-value-setq)
+       (Multiple-value-call, Multiple-value-prog1):
+       * emacs-lisp/cl-seq.el (cl-parsing-keywords, cl-check-key)
+       (cl-check-test-nokey, cl-check-test, cl-check-match): Move indent and
+       edebug rule to definition.
+       * emacs-lisp/lisp-mode.el (save-selected-window)
+       (with-current-buffer, combine-after-change-calls)
+       (with-output-to-string, with-temp-file, with-temp-buffer)
+       (with-temp-message, with-syntax-table, read-if, eval-after-load)
+       (dolist, dotimes, when, unless):
+       * emacs-lisp/byte-run.el (inline): Remove indent rule, redundant.
+
+2010-08-29  Chong Yidong  <cyd@stupidchicken.com>
+
+       * finder.el: Require `package'.
+       (finder-known-keywords): Tweak descriptions.  Retire `oop' keyword.
+       (finder-package-info): Var deleted.
+       (finder-keywords-hash, finder--builtins-alist): New vars.
+       (finder-compile-keywords): Compute package--builtins and
+       finder-keywords-hash instead of finder-keywords-hash, respecting
+       the "Package" header.
+       (finder-unknown-keywords, finder-list-matches):
+       Use finder-keywords-hash and package--list-packages.
+       (finder-mode): Don't set font-lock-defaults.
+       (finder-exit): We don't use "*Finder-package*" and "*Finder
+       Category*" buffers anymore.
+
+       * emacs-lisp/package.el (package--builtins-base): Var deleted.
+       (package--builtins): Set default value to nil.
+       (package-initialize): Load precomputed value of package--builtins
+       from finder-inf.el.
+       (package-alist, package-compute-transaction)
+       (package-download-transaction): Improve docstring.
+       (package-read-all-archive-contents): Do not change
+       package--builtins here.
+       (list-packages): Make package-list-packages an alias for this.
+       Sort by status by default.
+       (package--list-packages): Add optional PACKAGES arg.
+       (describe-package-1): Use font-lock-face property.  For built-in
+       packages, insert file commentary.
+       (package--generate-package-list): Rename from
+       package-list-packages-internal; all callers changed.  Add optional
+       PACKAGES arg.  Add alphabetical sort fallbacks.
+       (package-menu--version-predicate, package-menu--status-predicate)
+       (package-menu--description-predicate)
+       (package-menu--name-predicate): New functions.
+
+       * info.el (Info-finder-find-node): Search package-alist instead of
+       finder-package-info.
+
+2010-08-29  Chong Yidong  <cyd@stupidchicken.com>
+
+       * subr.el (version-regexp-alist): Don't use "a" and "b" for
+       "alpha" and "beta".
+       (version-to-list): Handle versions like "10.3d".
+
+2010-08-28  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/macroexp.el (macroexpand-all-1): Use pcase.
+       (macroexp-accumulate): Use `declare'.
+
+2010-08-27  Vinicius Jose Latorre  <viniciusjl@ig.com.br>
+
+       * whitespace.el (whitespace-style): Adjust type declaration.
+
+2010-08-26  Magnus Henoch  <magnus.henoch@gmail.com>
+
+       * net/tramp-gvfs.el (tramp-gvfs-handle-copy-file): Do not pass
+       empty argument to gvfs-copy.
+
+2010-08-26  Chong Yidong  <cyd@stupidchicken.com>
+
+       * net/tramp-compat.el (tramp-compat-delete-file): Rewrite to
+       handle new TRASH arg of `delete-file'.
+
+2010-08-26  Christian Lynbech  <christian.lynbech@tieto.com>  (tiny change)
+
+       * net/tramp.el (tramp-handle-insert-directory): Don't use
+       `forward-word', its default syntax could be changed.
+
+2010-08-26  Toru TSUNEYOSHI  <t_tuneyosi@hotmail.com>
+            Michael Albinus  <michael.albinus@gmx.de>
+
+       Implement compression for inline methods.
+
+       * net/tramp.el (tramp-inline-compress-start-size): New defcustom.
+       (tramp-copy-size-limit): Allow also nil.
+       (tramp-inline-compress-commands): New defconst.
+       (tramp-find-inline-compress, tramp-get-inline-compress)
+       (tramp-get-inline-coding): New defuns.
+       (tramp-get-remote-coding, tramp-get-local-coding): Remove,
+       replaced by `tramp-get-inline-coding'.
+       (tramp-handle-file-local-copy, tramp-handle-write-region)
+       (tramp-method-out-of-band-p): Use `tramp-get-inline-coding'.
+
+2010-08-26  Noah Lavine  <noah549@gmail.com>  (tiny change)
+
+       Detect ssh 'ControlMaster' argument automatically in some cases.
+
+       * net/tramp.el (tramp-detect-ssh-controlmaster): New defun.
+       (tramp-default-method): Use it.
+
+2010-08-26  Karel Klíč  <kklic@redhat.com>
+
+       * net/tramp.el (tramp-file-name-for-operation):
+       Add file-selinux-context.
+
+2010-08-26  Łukasz Stelmach  <lukasz.stelmach@iem.pw.edu.pl>  (tiny change)
+
+       * play/cookie1.el (read-cookie): Fix off-by-one error (bug#6921).
+
+2010-08-26  Chong Yidong  <cyd@stupidchicken.com>
+
+       * simple.el (beginning-of-buffer, end-of-buffer): Doc fix
+       (Bug#6907).
+
+2010-08-26  Nathan Weizenbaum  <nweiz@cressida.sea.corp.google.com>  (tiny change)
+
+       * progmodes/js.el: Make indentation more customizable (Bug#6914).
+       (js-paren-indent-offset, js-square-indent-offset)
+       (js-curly-indent-offset): New options.
+       (js--proper-indentation): Use them.
+
+2010-08-26  Daniel Colascione  <dan.colascione@gmail.com>
+
+       * progmodes/sh-script.el (sh-get-indent-info): Use syntax-ppss
+       instead of inspecting font-lock properties (Bug#6916).
+
+2010-08-26  David Reitter  <david.reitter@gmail.com>
+
+       * server.el (server-visit-files): Run pre-command-hook and
+       post-command-hook for each buffer while it is current
+       (Bug#6910).
+       (server-execute): Do not run hooks here.
+
 2010-08-26  Michael Albinus  <michael.albinus@gmx.de>
 
        Sync with Tramp 2.1.19.
 
        * net/trampver.el: Update release number.
 
-2010-08-26  Magnus Henoch  <magnus.henoch@gmail.com>
+2010-08-26  Chong Yidong  <cyd@stupidchicken.com>
 
-       * net/tramp-gvfs.el (tramp-gvfs-handle-copy-file): Do not pass
-       empty argument to gvfs-copy.
+       * help.el (help-map): Bind `C-h P' to describe-package.
 
-2010-08-26  Chong Yidong  <cyd@stupidchicken.com>
+       * menu-bar.el (menu-bar-describe-menu): Add describe-package.
 
-       * net/tramp-compat.el (tramp-compat-delete-file): Rewrite to
-       handle new TRASH arg of `delete-file'.
+       * emacs-lisp/package.el (package-refresh-contents): Catch errors
+       when downloading archives.
+       (describe-package-1): Add package commentary.
+       (package-install-button-action): New function.
+       (package-menu-mode-map): Bind ? to package-menu-describe-package.
+       (package-menu-view-commentary): Function removed.
+       (package-list-packages-internal): Hide the `package' package too.
 
-2010-08-26  Christian Lynbech  <christian.lynbech@tieto.com>  (tiny change)
+2010-08-25  Kenichi Handa  <handa@m17n.org>
 
-       * net/tramp.el (tramp-handle-insert-directory): Don't use
-       `forward-word', its default syntax could be changed.
+       * language/misc-lang.el ("Arabic"): New language environment.
+       Setup composition-function-table for Arabic characters.
 
-2010-08-26  Toru TSUNEYOSHI  <t_tuneyosi@hotmail.com>
-            Michael Albinus  <michael.albinus@gmx.de>
+       * international/fontset.el (setup-default-fontset): Fix typo for
+       arabic OTF spec (fini->fina).
 
-       Implement compression for inline methods.
+2010-08-25  Jan Djärv  <jan.h.d@swipnet.se>
 
-       * net/tramp.el (tramp-inline-compress-start-size): New defcustom.
-       (tramp-copy-size-limit): Allow also nil.
-       (tramp-inline-compress-commands): New defconst.
-       (tramp-find-inline-compress, tramp-get-inline-compress)
-       (tramp-get-inline-coding): New defuns.
-       (tramp-get-remote-coding, tramp-get-local-coding): Remove,
-       replaced by `tramp-get-inline-coding'.
-       (tramp-handle-file-local-copy, tramp-handle-write-region)
-       (tramp-method-out-of-band-p): Use `tramp-get-inline-coding'.
+       * menu-bar.el (menu-bar-set-tool-bar-position): Set frame parameter
+       on all frames.
 
-2010-08-26  Noah Lavine  <noah549@gmail.com>  (tiny change)
+2010-08-24  Vinicius Jose Latorre  <viniciusjl@ig.com.br>
 
-       Detect ssh 'ControlMaster' argument automatically in some cases.
+       * whitespace.el: Allow cleaning up blanks without blank
+       visualization (Bug#6651).  Adjust help window for
+       whitespace-toggle-options (Bug#6479).  Allow to use fill-column
+       instead of whitespace-line-column (from EmacsWiki).  New version
+       13.1.
+       (whitespace-style): Added new value 'face.  Adjust docstring.
+       (whitespace-space, whitespace-hspace, whitespace-tab): Adjust
+       foreground property face.
+       (whitespace-line-column): Adjust docstring and type declaration.
+       (whitespace-style-value-list, whitespace-toggle-option-alist)
+       (whitespace-help-text): Adjust const initialization.
+       (whitespace-toggle-options, global-whitespace-toggle-options):
+       Adjust docstring.
+       (whitespace-display-window, whitespace-interactive-char)
+       (whitespace-style-face-p, whitespace-color-on): Adjust code.
+       (whitespace-help-scroll): New fun.
 
-       * net/tramp.el (tramp-detect-ssh-controlmaster): New defun.
-       (tramp-default-method): Use it.
+2010-08-24  Chong Yidong  <cyd@stupidchicken.com>
 
-2010-08-26  Karel Klíč  <kklic@redhat.com>
+       * emacs-lisp/package.el (list-packages): Alias for
+       package-list-packages.
 
-       * net/tramp.el (tramp-file-name-for-operation):
-       Add file-selinux-context.
+2010-08-24  Kevin Ryde  <user42@zip.com.au>
 
-2010-08-26  Łukasz Stelmach  <lukasz.stelmach@iem.pw.edu.pl>  (tiny change)
+       * textmodes/flyspell.el (flyspell-check-tex-math-command): Doc fix
+       (Bug#5651).
 
-       * play/cookie1.el (read-cookie): Fix off-by-one error (bug#6921).
+       * progmodes/ruby-mode.el (ruby): Add defgroup.
 
-2010-08-26  Chong Yidong  <cyd@stupidchicken.com>
+2010-08-24  Chong Yidong  <cyd@stupidchicken.com>
 
-       * simple.el (beginning-of-buffer, end-of-buffer): Doc fix
-       (Bug#6907).
+       * progmodes/python.el: Add Ipython support (Bug#5390).
+       (python-shell-prompt-alist)
+       (python-shell-continuation-prompt-alist): New options.
+       (python--set-prompt-regexp): New function.
+       (inferior-python-mode, run-python, python-shell): Require
+       ansi-color.  Use python--set-prompt-regexp to set the comint
+       prompt based on the Python interpreter.
+       (python--prompt-regexp): New var.
+       (python-check-comint-prompt)
+       (python-comint-output-filter-function): Use it.
+       (run-python): Use a pipe (Bug#5694).
+
+2010-08-24  Fabian Ezequiel Gallina  <galli.87@gmail.com>  (tiny change)
+
+       * progmodes/python.el (python-send-region): Send a different
+       Python command if Ipython is in use.
+       (python-check-version): Use a Python command to find the version.
+
+2010-08-24  Chong Yidong  <cyd@stupidchicken.com>
+
+       * mouse.el (mouse-yank-primary): Avoid setting primary when
+       deactivating the mark (Bug#6872).
 
 2010-08-23  Chris Foote <chris@foote.com.au>  (tiny change)
 
        * progmodes/python.el (python-block-pairs): Allow use of "finally"
        with "else" (Bug#3991).
 
+2010-08-23  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/dbus.el: Accept UNIX domain sockets as bus address.
+       (top): Don't initialize `dbus-registered-objects-table' anymore,
+       this is done in dbusbind,c.
+       (dbus-check-event): Adapt test for bus.
+       (dbus-return-values-table, dbus-unregister-service)
+       (dbus-event-bus-name, dbus-introspect, dbus-register-property):
+       Adapt doc string.
+
+2010-08-23  Juanma Barranquero  <lekktu@gmail.com>
+
+       * ido.el (ido-use-virtual-buffers): Fix typo in docstring.
+
+2010-08-22  Juri Linkov  <juri@jurta.org>
+
+       * simple.el (read-extended-command): New function with the logic
+       for `completing-read' moved to Elisp from `execute-extended-command'.
+       Use `function-called-at-point' in `minibuffer-default-add-function'
+       to get a command name for M-n (bug#5364, bug#5214).
+
+2010-08-22  Chong Yidong  <cyd@stupidchicken.com>
+
+       * startup.el (command-line-1): Issue warning for ignored arguments
+       --unibyte, etc (Bug#6886).
+
 2010-08-22  Leo  <sdl.web@gmail.com>
 
        * net/rcirc.el (rcirc-add-or-remove): Accept a list of elements.
 
        * emacs-lisp/easy-mmode.el (define-minor-mode): Doc fix (Bug#6880).
 
-2010-08-21  Vinicius Jose Latorre  <viniciusjl@ig.com.br>
-
-       * whitespace.el: Fix slow cursor movement (Bug#6172).  Reported by
-       Christoph Groth <cwg@falma.de> and Liu Xin <x_liu@neusoft.com>.
-       New version 13.0.
-       (whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp):
-       Adjust initialization.
-       (whitespace-bob-marker, whitespace-eob-marker)
-       (whitespace-buffer-changed): New vars.
-       (whitespace-cleanup, whitespace-color-on, whitespace-color-off)
-       (whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp)
-       (whitespace-post-command-hook, whitespace-display-char-on):
-       Adjust code.
-       (whitespace-looking-back, whitespace-buffer-changed): New funs.
-       (whitespace-space-regexp, whitespace-tab-regexp): Eliminate funs.
-
-2010-08-21  Leo  <sdl.web@gmail.com>
+2010-08-22  Leo  <sdl.web@gmail.com>
 
        Fix buffer-list rename&refresh after killing a buffer in ido.
        * lisp/ido.el: Revert Óscar's.
        Remember the buffers at head, rather than their name.
        * lisp/iswitchb.el (iswitchb-kill-buffer): Re-make the list.
 
-2010-08-21  Kirk Kelsey  <kirk.kelsey@0x4b.net>  (tiny change)
+2010-08-22  Kirk Kelsey  <kirk.kelsey@0x4b.net>  (tiny change)
             Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * progmodes/make-mode.el (makefile-fill-paragraph): Account for the
        extra backslash added to each line (bug#6890).
 
-2010-08-21  Stefan Monnier  <monnier@iro.umontreal.ca>
+2010-08-22  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * subr.el (read-key): Don't echo keystrokes (bug#6883).
 
-2010-08-21  Glenn Morris  <rgm@gnu.org>
+2010-08-22  Glenn Morris  <rgm@gnu.org>
 
        * menu-bar.el (menu-bar-games-menu): Add landmark.
 
-2010-08-20  Glenn Morris  <rgm@gnu.org>
+2010-08-22  Glenn Morris  <rgm@gnu.org>
 
        * align.el (align-regexp): Make group and spacing arguments
        use the interactive defaults when non-interactive.  (Bug#6698)
        (mail-text-start): Remove declaration.
        (rmail-retry-failure): Require sendmail.
 
-2010-08-19  Stefan Monnier  <monnier@iro.umontreal.ca>
+2010-08-22  Chong Yidong  <cyd@stupidchicken.com>
 
        * subr.el (read-key): Don't hide the menu-bar entries (bug#6881).
 
-2010-08-18  Michael Albinus  <michael.albinus@gmx.de>
+2010-08-22  Michael Albinus  <michael.albinus@gmx.de>
 
        * progmodes/flymake.el (flymake-start-syntax-check-process):
        Use `start-file-process' in order to let it run also on remote hosts.
 
-2010-08-18  Kenichi Handa  <handa@m17n.org>
+2010-08-22  Kenichi Handa  <handa@m17n.org>
 
        * files.el: Add `word-wrap' as safe local variable.
 
-2010-08-18  Glenn Morris  <rgm@gnu.org>
+2010-08-22  Glenn Morris  <rgm@gnu.org>
 
        * woman.el (woman-translate): Case matters.  (Bug#6849)
 
-2010-08-14  Chong Yidong  <cyd@stupidchicken.com>
+2010-08-22  Chong Yidong  <cyd@stupidchicken.com>
 
        * simple.el (kill-region): Doc fix (Bug#6787).
 
-2010-08-14  Glenn Morris  <rgm@gnu.org>
+2010-08-22  Glenn Morris  <rgm@gnu.org>
 
        * calendar/diary-lib.el (diary-header-line-format):
        Fit it to the window, not the frame.
 
-2010-08-11  Andreas Schwab  <schwab@linux-m68k.org>
+2010-08-22  Andreas Schwab  <schwab@linux-m68k.org>
 
        * subr.el (ignore-errors): Add debug declaration.
 
-2010-08-09  Geoff Gole  <geoffgole@gmail.com>  (tiny change)
+2010-08-22  Geoff Gole  <geoffgole@gmail.com>  (tiny change)
 
        * whitespace.el (whitespace-color-off): Remove post-command-hook
        locally.
 
+2010-08-21  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * vc/add-log.el (add-log-file-name): Don't get confused by symlinks.
+
+2010-08-21  Chong Yidong  <cyd@stupidchicken.com>
+
+       * cus-edit.el (custom-group-value-create): Add extra newline
+       before end line (Bug#6876).
+
+2010-08-21  Chong Yidong  <cyd@stupidchicken.com>
+
+       * mouse.el (mouse-save-then-kill): Don't save region to kill ring
+       when extending it.  Before killing on the second click, check if
+       the buffer is the correct one.  Doc fix.
+       (mouse-secondary-save-then-kill): Allow usage without first
+       calling mouse-start-secondary, by defaulting to point.  Don't save
+       an empty secondary selection.  Doc fix.
+
+2010-08-21  Vinicius Jose Latorre  <viniciusjl@ig.com.br>
+
+       * whitespace.el: Fix slow cursor movement (Bug#6172).  Reported by
+       Christoph Groth <cwg@falma.de> and Liu Xin <x_liu@neusoft.com>.
+       New version 13.0.
+       (whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp):
+       Adjust initialization.
+       (whitespace-bob-marker, whitespace-eob-marker)
+       (whitespace-buffer-changed): New vars.
+       (whitespace-cleanup, whitespace-color-on, whitespace-color-off)
+       (whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp)
+       (whitespace-post-command-hook, whitespace-display-char-on):
+       Adjust code.
+       (whitespace-looking-back, whitespace-buffer-changed): New funs.
+       (whitespace-space-regexp, whitespace-tab-regexp): Fun eliminated.
+
+2010-08-19  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * files.el (locate-file-completion-table): Only list the .el and .elc
+       extensions if there's no other choice (bug#5955).
+
+       * facemenu.el (facemenu-self-insert-data): New var.
+       (facemenu-post-self-insert-function, facemenu-set-self-insert-face):
+       New functions.
+       (facemenu-add-face): Use them.
+
+       * simple.el (blink-matching-open): Obey forward-sexp-function.
+
+2010-08-18  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * simple.el (prog-mode-map): New var.
+       (prog-indent-sexp): New command.
+
+       * progmodes/octave-mod.el (octave-mode-menu): Make toggle buttons.
+
+       * progmodes/prolog.el (smie): Require.
+
+       * emacs-lisp/smie.el (smie-default-backward-token)
+       (smie-default-forward-token): Strip properties.
+       (smie-next-sexp): Be more careful with associative operators.
+       (smie-forward-sexp-command): Generalize.
+       (smie-backward-sexp-command): Simplify.
+       (smie-closer-alist): New var.
+       (smie-close-block): New command.
+       (smie-indent-debug-log): New var.
+       (smie-indent-offset-rule): Add a few more cases.
+       (smie-indent-column): New function.
+       (smie-indent-after-keyword): Use it.
+       (smie-indent-keyword): Use it.
+       Fix up the opener code's point position.
+       (smie-indent-comment): Only applies at BOL.
+       (smie-indent-debug): New command.
+
+       * emacs-lisp/autoload.el (make-autoload): Preload the macros's
+       declarations that are useful before running the macro.
+
+2010-08-18  Joakim Verona  <joakim@verona.se>
+
+       * image.el (imagemagick-types-inhibit): New variable.
+       (imagemagick-register-types): New function.
+       * image-mode.el (image-transform-properties): New function.
+       (image-transform-set-scale, image-transform-fit-to-height)
+       (image-transform-set-rotation, image-transform-set-resize)
+       (image-transform-fit-to-width, image-transform-fit-to-height):
+       New functions.
+       (image-toggle-display-image): Support image transforms.
+
+2010-08-18  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * image.el (create-animated-image): Don't add heuristic mask to image
+       (Bug#6839).
+
+2010-08-18  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * term/ns-win.el (ns-get-pasteboard, ns-set-pasteboard):
+       Use QCLIPBOARD instead of QPRIMARY (Bug#6677).
+
+2010-08-17  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/lisp.el (up-list): Obey forward-sexp-function if set.
+
+       Font-lock '...' strings, plus various simplifications and fixes.
+       * progmodes/octave-mod.el (octave-font-lock-keywords): Use regexp-opt.
+       (octave-font-lock-close-quotes): New function.
+       (octave-font-lock-syntactic-keywords): New var.
+       (octave-mode): Use it.  Set beginning-of-defun-function.
+       (octave-mode-map): Don't override the <foo>-defun commands.
+       (octave-mode-menu): Pass it directly to easy-menu-define;
+       remove (now generic) <foo>-defun commands; use info-lookup-symbol.
+       (octave-block-match-alist): Fix up last change so that
+       octave-close-block uses the more specific keyword.
+       (info-lookup-mode): Silence byte-compiler.
+       (octave-beginning-of-defun): Not interactive any more.
+       Optimize slightly.
+       (octave-end-of-defun, octave-mark-defun, octave-in-defun-p): Remove.
+       (octave-indent-defun, octave-send-defun): Use mark-defun instead.
+       (octave-completion-at-point-function): Make sure point is within
+       beg..end.
+       (octave-reindent-then-newline-and-indent):
+       Use reindent-then-newline-and-indent.
+       (octave-add-octave-menu): Remove.
+
+2010-08-17  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * mail/emacsbug.el (report-emacs-bug-insert-to-mailer)
+       (report-emacs-bug-can-use-xdg-email): New functions.
+       (report-emacs-bug): Set can-xdg-email to result of
+       report-emacs-bug-can-use-xdg-email.  If can-xdg-email bind
+       \C-cm to report-emacs-bug-insert-to-mailer and add help text
+       about it.
+
+       * net/browse-url.el (browse-url-default-browser): Add cond
+       for browse-url-xdg-open.
+       (browse-url-can-use-xdg-open, browse-url-xdg-open): New functions.
+
+2010-08-17  Glenn Morris  <rgm@gnu.org>
+
+       * progmodes/cc-engine.el (c-new-BEG, c-new-END)
+       (c-fontify-recorded-types-and-refs): Define for compiler.
+       * progmodes/cc-mode.el (c-new-BEG, c-new-END): Move definitions
+       before use.
+
+       * calendar/icalendar.el (icalendar--convert-recurring-to-diary):
+       Fix format call.
+
+2010-08-17  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/tramp.el (tramp-handle-make-symbolic-link): Flush file
+       properties.
+       (tramp-handle-process-file): Call the program in a subshell, in
+       order to preserve working directory.
+       (tramp-action-password): Hide password prompt before next run.
+       (tramp-process-actions): Widen connection buffer for the trace.
+
+2010-08-16  Deniz Dogan  <deniz.a.m.dogan@gmail.com>
+
+       * net/rcirc.el (rcirc-log-process-buffers): New option.
+       (rcirc-print): Use it.
+       (rcirc-generate-log-filename): New function.
+       (rcirc-log-filename-function): Change default to
+       rcirc-generate-log-filename (Bug#6828).
+
+2010-08-16  Chong Yidong  <cyd@stupidchicken.com>
+
+       * simple.el (deactivate-mark): If select-active-regions is `only',
+       only set selection for temporarily active regions.
+
+       * cus-start.el: Change defcustom for select-active-regions.
+
+2010-08-15  Chong Yidong  <cyd@stupidchicken.com>
+
+       * mouse.el (mouse--drag-set-mark-and-point): New function.
+       (mouse-drag-track): Use LOCATION arg to push-mark.
+       Use mouse--drag-set-mark-and-point to take click-count into
+       consideration when updating point and mark (Bug#6840).
+
+2010-08-15  Chong Yidong  <cyd@stupidchicken.com>
+
+       * progmodes/compile.el (compilation-error-regexp-alist-alist):
+       Give the Ruby rule a lower priority than Gnu (Bug#6778).
+
+2010-08-14  Štěpán Němec  <stepnem@gmail.com>  (tiny change)
+
+       * font-lock.el (lisp-font-lock-keywords-2):
+       Add combine-after-change-calls, condition-case-no-debug,
+       with-demoted-errors, and with-silent-modifications (Bug#6025).
+
+2010-08-14  Kevin Ryde  <user42@zip.com.au>
+
+       * emacs-lisp/copyright.el (copyright-update-year)
+       (copyright-update): Temporary switch-to-buffer to ensure the
+       buffer change being queried is visible (Bug#5394).
+
+2010-08-14  Tom Tromey  <tromey@redhat.com>
+
+       * progmodes/etags.el (tags-file-name): Mark safe if stringp
+       (Bug#6733).
+
+2010-08-14  Eli Zaretskii  <eliz@gnu.org>
+
+       * mouse.el (mouse-yank-primary): Fix mouse-2 on MS-Windows and
+       MS-DOS.  (Bug#6689)
+
+2010-08-13  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * menu-bar.el (menu-bar-set-tool-bar-position): New function.
+       (menu-bar-showhide-tool-bar-menu-customize-enable-left)
+       (menu-bar-showhide-tool-bar-menu-customize-enable-right)
+       (menu-bar-showhide-tool-bar-menu-customize-enable-top)
+       (menu-bar-showhide-tool-bar-menu-customize-enable-bottom):
+       Call menu-bar-set-tool-bar-position.
+
+2010-08-12  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * progmodes/octave-mod.el (octave-mode-syntax-table): Use the new "c"
+       comment style (bug#6834).
+       * progmodes/scheme.el (scheme-mode-syntax-table):
+       * emacs-lisp/lisp-mode.el (lisp-mode-syntax-table): Remove spurious
+       "b" flag in "' 14b" syntax.
+
+       * progmodes/octave-mod.el (octave-mode-map): Remove special bindings
+       for (un)commenting the region and performing completion.
+       (octave-mode-menu): Use standard commands for help and completion.
+       (octave-mode-syntax-table): Support %{..%} comments (sort of).
+       (octave-mode): Use define-derived-mode.
+       Set completion-at-point-functions and don't set columns.
+       Don't disable adaptive-fill-regexp.
+       (octave-describe-major-mode, octave-comment-region)
+       (octave-uncomment-region, octave-comment-indent)
+       (octave-indent-for-comment): Remove.
+       (octave-indent-calculate): Rename from calculate-octave-indent.
+       (octave-indent-line, octave-fill-paragraph): Update caller.
+       (octave-initialize-completions): No need to make an alist.
+       (octave-completion-at-point-function): New function.
+       (octave-complete-symbol): Use it.
+       (octave-insert-defun): Use define-skeleton.
+
+       * progmodes/octave-mod.el (octave-mode): Set comment-add.
+       (octave-mode-map): Use comment-dwim (bug#6829).
+
+2010-08-12  Antoine Levitt  <antoine.levitt@gmail.com>  (tiny change)
+
+       * cus-edit.el (custom-save-variables, custom-save-faces): Fix up
+       indentation of inserted comment.
+
+2010-08-11  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * faces.el (region): Add type gtk that uses gtk colors.
+
+       * dynamic-setting.el (dynamic-setting-handle-config-changed-event):
+       Handle theme-name change.
+
+2010-08-10  Michael R. Mauger  <mmaug@yahoo.com>
+
+       * progmodes/sql.el: Version 2.5
+       (sql-product-alist): Add :prompt-cont-regexp property for several
+       database products.
+       (sql-prompt-cont-regexp): New variable.
+       (sql-output-newline-count, sql-output-by-send):
+       New variables.  Record number of newlines in input text.
+       (sql-send-string): Handle multiple filters and count newlines.
+       (sql-send-magic-terminator): Count terminator newline.
+       (sql-interactive-remove-continuation-prompt): Filters output to
+       remove continuation prompts; one for each newline.
+       (sql-interactive-mode): Set up new variables, prompt regexp and
+       output filter.
+       (sql-mode-sqlite-font-lock-keywords): Correct some keywords.
+       (sql-make-alternate-buffer-name): Correct buffer name in edge cases.
+
+2010-08-10  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/pcase.el: New file.
+
+2010-08-10  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/tramp.el (tramp-vc-registered-read-file-names): Read input
+       as here-document, otherwise the command could exceed maximum
+       length of command line.
+       (tramp-handle-vc-registered): Call script accordingly.
+       Reported by Toru TSUNEYOSHI <t_tuneyosi@hotmail.com>.
+
+2010-08-10  Kenichi Handa  <handa@m17n.org>
+
+       * language/hebrew.el: Exclude U+05C3 (Hebrew SOF PASUQ) from the
+       composable pattern.
+
+2010-08-09  Chong Yidong  <cyd@stupidchicken.com>
+
+       * emacs-lisp/package.el (package-version-split)
+       (package--version-first-nonzero, package-version-compare):
+       Functions removed.
+       (package-directory-list, package-load-all-descriptors)
+       (package--built-in, package-activate, define-package)
+       (package-installed-p, package-compute-transaction)
+       (package-read-all-archive-contents)
+       (package--add-to-archive-contents, package-buffer-info)
+       (package-tar-file-info, package-list-packages-internal):
+       Use version-to-list and version-list-*.
+
+       * emacs-lisp/package-x.el (package-upload-buffer-internal):
+       Use version-to-list.
+       (package-upload-buffer-internal): Use version-list-<=.
+
+2010-08-09  Kenichi Handa  <handa@m17n.org>
+
+       * language/hebrew.el: Exclude U+05BD (Hebrew MAQAF) from the
+       composable pattern.
+
+2010-08-08  Chong Yidong  <cyd@stupidchicken.com>
+
+       * tutorial.el (tutorial--default-keys): C-d is now bound to
+       delete-forward-char (Bug#6826).
+
+       * mouse.el (mouse-drag-track): Remove accidentally-removed check
+       for `double' value of mouse-1-click-follows-link (Bug#6807).
+
 2010-08-08  Johan Bockgård  <bojohan@gnu.org>
 
        * replace.el (replace-highlight): Bind isearch-forward and
        (isearch-lazy-highlight-new-loop, isearch-lazy-highlight-search):
        (isearch-lazy-highlight-update): Use it.
 
-2010-08-06  Kenichi Handa  <handa@m17n.org>
+2010-08-08  Kenichi Handa  <handa@m17n.org>
 
        * international/mule.el (define-charset): Store NAME as :base property.
        (ctext-non-standard-encodings-table): Pay attention to charset aliases.
        (ctext-pre-write-conversion): Sort ctext-standard-encodings by the
        current priority.  Force using the designation of the specific
-       charset by adding `charset' text property.  Improve the whole
-       algorithm.
+       charset by adding `charset' text property.  Improve the whole algorithm.
 
-2010-08-05  Juanma Barranquero  <lekktu@gmail.com>
+2010-08-08  Juanma Barranquero  <lekktu@gmail.com>
 
        * emulation/pc-select.el (pc-selection-mode-hook)
        (copy-region-as-kill-nomark, beginning-of-buffer-mark)
        (pc-selection-mode): Fix typos in docstrings.
 
-2010-08-04  Kenichi Handa  <handa@m17n.org>
+2010-08-08  Kenichi Handa  <handa@m17n.org>
 
        * language/cyrillic.el: Don't add "microsoft-cp1251" to
        ctext-non-standard-encodings-alist here.
        (ctext-no-compositions): Doc fix.
        (compound-text-with-extensions): Doc fix.
 
-2010-08-04  Stefan Monnier  <monnier@iro.umontreal.ca>
+2010-08-08  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * simple.el (exchange-dot-and-mark): Mark obsolete, finally.
 
-2010-08-03  Juanma Barranquero  <lekktu@gmail.com>
+2010-08-08  Juanma Barranquero  <lekktu@gmail.com>
 
        * progmodes/which-func.el (which-func-format): Split help-echo text
        into lines, like other mode-line tooltips.
        * server.el (server-start): When using TCP sockets, force IPv4
        and use a literal 127.0.0.1 for localhost.  (Related to bug#6781.)
 
-2010-08-02  Stefan Monnier  <monnier@iro.umontreal.ca>
+2010-08-08  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * bindings.el (complete-symbol): Run completion-at-point as a fallback.
 
-2010-08-02  Juanma Barranquero  <lekktu@gmail.com>
+2010-08-08  Juanma Barranquero  <lekktu@gmail.com>
 
        * term.el (term-delimiter-argument-list): Reflow docstring.
        (term-read-input-ring, term-write-input-ring, term-send-input)
        (term-bol, term-erase-in-display, serial-supported-or-barf):
        Fix typos in docstrings.
 
-2010-08-02  Stefan Monnier  <monnier@iro.umontreal.ca>
+2010-08-08  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * bindings.el (function-key-map): Add a S-tab => backtab fallback.
 
-2010-08-01  Juanma Barranquero  <lekktu@gmail.com>
+2010-08-08  Juanma Barranquero  <lekktu@gmail.com>
 
        * dabbrev.el (dabbrev-completion): Fix typo in docstring.
 
-2010-08-01  MON KEY  <monkey@sandpframing.com>  (tiny change)
+2010-08-08  MON KEY  <monkey@sandpframing.com>  (tiny change)
 
        * emacs-lisp/syntax.el (syntax-ppss-toplevel-pos):
        Fix typo in docstring (bug#6747).
 
-2010-07-30  Leo  <sdl.web@gmail.com>
+2010-08-08  Leo  <sdl.web@gmail.com>
 
        * eshell/esh-io.el (eshell-get-target): Better detection of
        read-only file (Bug#6762).
 
-2010-07-30  Juanma Barranquero  <lekktu@gmail.com>
+2010-08-08  Juanma Barranquero  <lekktu@gmail.com>
 
        * align.el (align-default-spacing): Doc fix.
        (align-region-heuristic, align-regexp): Fix typos in docstrings.
 
-2010-07-23  Juanma Barranquero  <lekktu@gmail.com>
+2010-08-08  Stephen Peters <speters@itasoftware.com>
 
-       * help-fns.el (find-lisp-object-file-name): Doc fix (bug#6494).
+       * calendar/icalendar.el
+       (icalendar--split-value): Fixed splitting regexp. (Bug#6766)
+       (icalendar--get-weekday-numbers): New
+       (icalendar--convert-recurring-to-diary): Handle multiple byday
+       values in weekly rules. (Bug#6766)
 
-2010-07-20  Juanma Barranquero  <lekktu@gmail.com>
+2010-08-08  Ulf Jasper  <ulf.jasper@web.de>
 
-       * cedet/semantic/db-file.el (object-write): Fix typo in docstring.
+       * calendar/icalendar.el (icalendar-uid-format): Doc fix.
+       (icalendar--create-uid, icalendar-export-region)
+       (icalendar--parse-summary-and-rest): Code formatting.
 
-2010-07-19  Juanma Barranquero  <lekktu@gmail.com>
+2010-08-08  Jay Belanger  <jay.p.belanger@gmail.com>
 
-       * time.el (display-time-day-and-date): Remove spurious * in docstring.
-       (display-time-world-buffer-name, display-time-world-mode-map):
-       Fix typos in docstrings.
+       * calc/calc.el (calc-trail-mode,calc-refresh): Use `face' property
+       to italicize headers.
+       (calc-highlight-selections-with-faces): New variable.
+       (calc-selected-face, calc-nonselected-face): New faces.
 
-2010-07-17  Shyam Karanatt  <shyam@swathanthran.in>  (tiny change)
+       * calc/calccomp.el (math-comp-highlight-string): Use
+       `calc-highlight-selections-with-faces' to determine how to highlight
+       sub-formulas.
 
-       * image-mode.el (image-display-size): New function.
-       (image-forward-hscroll, image-next-line, image-eol, image-eob)
-       (image-mode-fit-frame): Use it (Bug#6639).
+       * calc/calc-sel.el (calc-show-selections): Change message to when
+       using faces to highlight selections.
 
-2010-07-17  Chong Yidong  <cyd@stupidchicken.com>
+2010-08-07  Michael R. Mauger  <mmaug@yahoo.com>
 
-       * dired.el (dired-buffers-for-dir): Handle list values of
-       dired-directory (Bug#6636).
+       * progmodes/sql.el (sql-mode-sqlite-font-lock-keywords):
+       Add SQLite 3 keywords, functions and datatypes.
+       (sql-interactive-mode): Remove `comint-process-echoes' set to t
+       (Bug#6686).
 
-2010-07-16  Reiner Steib  <Reiner.Steib@gmx.de>
+2010-08-07  Chong Yidong  <cyd@stupidchicken.com>
 
-       * vc.el (vc-coding-system-inherit-eol): New defvar.
-       (vc-coding-system-for-diff): Use it to decide whether to inherit
-       from the file the EOL format for reading the diffs of that file.
-       (Bug#4451)
+       * simple.el (select-active-regions): Move to keyboard.c.
+       (deactivate-mark): Used saved-region-selection.
+       (select-active-region): Function removed.
+       (activate-mark, set-mark, push-mark-command)
+       (handle-shift-selection): Don't call it.
+       (keyboard-quit): Avoid adding the region to the window selection.
 
-2010-07-16  Eli Zaretskii  <eliz@gnu.org>
+       * mouse.el (mouse-drag-track): Remove hacks to deal with old
+       select-active-regions implementation.
+       (mouse-yank-at-click): Doc fix.
 
-       * mail/rmailmm.el (rmail-mime-save): Make the temp buffer
-       unibyte, so compressed attachments are not compressed again.
+       * cus-start.el: Add custom declaration for select-active-regions.
 
-2010-07-14  Jan Djärv  <jan.h.d@swipnet.se>
+2010-08-07  Eli Zaretskii  <eliz@gnu.org>
 
-       * xt-mouse.el (xterm-mouse-event-read): Fix for characters > 127
-       now that unicode is used (Bug#6594).
+       * simple.el (delete-forward-char): Doc fix.
 
-2010-07-14  Chong Yidong  <cyd@stupidchicken.com>
+       * tutorial.el (help-with-tutorial): Hack safe file-local variables
+       after reading the tutorial.
 
-       * simple.el (push-mark-command): Set the selection if
-       select-active-regions is non-nil.
+2010-08-06  Alan Mackenzie  <bug-cc-mode@gnu.org>
 
-2010-07-10  Glenn Morris  <rgm@gnu.org>
+       * progmodes/cc-cmds.el (c-mask-paragraph, c-fill-paragraph): Fix
+       for the case that a C style comment has its delimiters alone on
+       their respective lines.
 
-       * calendar/calendar.el (calendar-week-end-day): New function.
-       * calendar/cal-tex.el (cal-tex-cursor-month): Remove unused vars.
-       Respect calendar-week-start-day.  (Bug#6606)
-       (cal-tex-insert-day-names, cal-tex-insert-blank-days)
-       (cal-tex-insert-blank-days-at-end): Respect calendar-week-start-day.
-       (cal-tex-first-blank-p, cal-tex-last-blank-p): Simplify, and
-       respect calendar-week-start-day.
+2010-08-06  Michael Albinus  <michael.albinus@gmx.de>
 
-2010-07-10  Chong Yidong  <cyd@stupidchicken.com>
+       * net/tramp.el (tramp-handle-start-file-process): Set connection
+       property "vec".
+       (tramp-process-sentinel): Use it for flushing the cache.  We
+       cannot do it via the process buffer, the buffer could be deleted
+       already when running the sentinel.
 
-       * simple.el (use-region-p): Doc fix (Bug#6607).
+2010-08-06  Jürgen Hötzel  <juergen@archlinux.org>  (tiny change)
 
-2010-07-07  Christoph Scholtes  <cschol2112@gmail.com>
+       * comint.el (comint-mode): Make directory tracking functions
+       functional on remote files.  (Bug#6764)
 
-       * progmodes/python.el (python-font-lock-keywords): Add Python 2.7
-       builtins (BufferError, BytesWarning, WindowsError; callables
-       bin, bytearray, bytes, format, memoryview, next, print; __package__).
+2010-08-06  Dan Nicolaescu  <dann@ics.uci.edu>
 
-2010-07-07  Glenn Morris  <rgm@gnu.org>
+       * vc/diff-mode.el (diff-mode-shared-map): Bind g to revert-buffer.
 
-       * play/zone.el (zone-fall-through-ws): Fix next-line ->
-       forward-line fallout.
+2010-08-05  Eli Zaretskii  <eliz@gnu.org>
 
-2010-07-06  Chong Yidong  <cyd@stupidchicken.com>
+       * emacs-lisp/find-gc.el (find-gc-source-files): Rename
+       unexec.c => unexcoff.c.
 
-       * mouse.el (mouse-appearance-menu): Add docstring.
+       * emacs-lisp/authors.el (authors-fixed-entries): Rename
+       unexec.c => unexcoff.c.
 
-       * help.el (describe-key): Print up-event using key-description.
+2010-08-05  Michael Albinus  <michael.albinus@gmx.de>
 
-2010-07-03  Michael Albinus  <michael.albinus@gmx.de>
+       * net/tramp.el (tramp-handle-dired-uncache): Flush directory
+       cache, not only file cache.
+       (tramp-process-sentinel): New defun.
+       (tramp-handle-start-file-process): Use it, in order to invalidate
+       file caches.
 
-       * net/zeroconf.el (zeroconf-resolve-service)
-       (zeroconf-service-resolver-handler): Use
-       `dbus-byte-array-to-string'.
-       (zeroconf-publish-service): Use `dbus-string-to-byte-array'.
+2010-08-03  Leo  <sdl.web@gmail.com>
 
-2010-07-03  Jan Moringen  <jan.moringen@uni-bielefeld.de>
+       * server.el (server-start): Simplify loop.
 
-       * net/zeroconf.el (zeroconf-service-remove-hook): New defun.
+2010-08-02  Stefan Monnier  <monnier@iro.umontreal.ca>
 
-2010-06-30  Dan Nicolaescu  <dann@ics.uci.edu>
+       * frame.el (screen-height, screen-width, set-screen-width)
+       (set-screen-height): Remove ancient compatibility aliases.
 
-       Avoid displaying files with a nil state in vc-dir.
-       * vc-dir.el (vc-dir-update): Obey the noinsert argument in all
-       cases that cause insertion.
+       * textmodes/fill.el (justify-current-line): Don't add 1 to nspaces
+       when justifying.  It seems useless and harmful for ncols=1 (bug#6738).
+
+       * emacs-lisp/timer.el (timer-event-handler): Protect against timers
+       that change current buffer.
+
+2010-08-01  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+       * mouse.el (mouse-fixup-help-message): Match "mouse-2" only at the
+       beginning of the string.  Use `string-match-p'.  (Bug#6765)
+
+2010-08-01  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * cus-start.el (x-gtk-use-system-tooltips): New variable.
+
+2010-08-01  Chong Yidong  <cyd@stupidchicken.com>
+
+       * emacs-lisp/package.el (package--list-packages): Fix column alignment.
+       (package--builtins): Tweak descriptions.
+       (package-print-package): Upcase descriptions if necessary.
+       Show all built-in packages in font-lock-builtin-face.
+       (package-list-packages-internal): Omit "emacs" package.
+       Show status of built-in packages as "built-in".
+
+2010-07-31  Chong Yidong  <cyd@stupidchicken.com>
+
+       * mouse.el (mouse-save-then-kill): Doc fix.  Deactivate mark
+       before killing to preserve the primary selection (Bug#6701).
+
+       * term/x-win.el (x-select-text): Doc fix.
+
+2010-07-31  Nathaniel Flath  <flat0103@gmail.com>
+
+       Enhance Java Mode to handle Java 5.0 (Tiger) and Java 6 (Mustang).
+       The following functions were modified or created:
+
+       * progmodes/cc-vars.el (c-offsets-alist, c-inside-block-syms)
+       (objc-font-lock-extra-types):
+       * progmodes/cc-mode.el (c-basic-common-init):
+       * progmodes/cc-langs.el (c-make-mode-syntax-table)
+       (c++-make-template-syntax-table)
+       (c-identifier-syntax-modifications, c-symbol-start, c-operators)
+       (c-<-op-cont-regexp, c->-op-cont-regexp, c-class-decl-kwds)
+       (c-brace-list-decl-kwds, c-modifier-kwds, c-prefix-spec-kwds-re)
+       (c-type-list-kwds, c-decl-prefix-re, c-opt-type-suffix-key):
+       * progmodes/cc-fonts.el (c-make-inverse-face)
+       (c-basic-matchers-after):
+       * progmodes/cc-engine.el (c-forward-keyword-clause)
+       (c-forward-<>-arglist, c-forward-<>-arglist-recur)
+       (c-forward-name, c-forward-type, c-forward-decl-or-cast-1)
+       (c-guess-continued-construct, c-guess-basic-syntax):
+
+2010-07-31  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * faces.el (face-all-attributes): Improve documentation (Bug#6767).
+
+2010-07-31  Eli Zaretskii  <eliz@gnu.org>
+
+       * files.el (bidi-paragraph-direction): Define safe local values.
+
+       * language/hebrew.el ("Hebrew"): Add TUTORIAL.he to
+       language-info-alist.  Remove outdated FIXME in a comment.
+
+2010-07-31  Alan Mackenzie  <acm@muc.de>
+
+       * progmodes/cc-cmds.el (c-mask-paragraph): Fix bug #6688:
+       Auto-fill broken in C/C++ modes.
+
+2010-07-29  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * menu-bar.el (menu-bar-showhide-tool-bar-menu-customize-enable-left)
+       (menu-bar-showhide-tool-bar-menu-customize-disable)
+       (menu-bar-showhide-tool-bar-menu-customize-enable-right)
+       (menu-bar-showhide-tool-bar-menu-customize-enable-bottom)
+       (menu-bar-showhide-tool-bar-menu-customize-enable-top): New functions
+       (menu-bar-showhide-tool-bar-menu): If tool bar is moveable,
+       make a menu for Options => toolbar that can move it.
+
+2010-07-29  Chong Yidong  <cyd@stupidchicken.com>
+
+       * emacs-lisp/package-x.el (package--make-rss-entry):
+       (package-maint-add-news-item, package--update-news)
+       (package-upload-buffer-internal): New arg ARCHIVE-URL.
+
+       * emacs-lisp/package.el (package-archive-url): Rename from
+       package-archive-id.
+       (package-install): Doc fix.
+       (package-download-single, package-download-tar, package-install)
+       (package-menu-view-commentary): Callers changed.
+
+2010-07-29  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/tramp.el (tramp-handle-start-file-process): Check only for
+       `remote-tty' process property.
+       (tramp-open-shell): Don't check for tty.
+       (tramp-open-connection-setup-interactive-shell): Set `remote-tty'
+       process property.
+
+       * progmodes/gdb-mi.el (gdb-init-1): Check also for tty on a remote
+       host.
+
+2010-07-28  Chong Yidong  <cyd@stupidchicken.com>
+
+       * emacs-lisp/package.el (package-load-list, package-archives)
+       (package-archive-contents, package-user-dir)
+       (package-directory-list, package--builtins, package-alist)
+       (package-activated-list, package-obsolete-alist): Mark as risky.
+
+2010-07-28  Phil Hagelberg  <phil@evri.com>
+
+       Add support for non-default package repositories.
+       * emacs-lisp/package.el (package-archive-base): Var deleted.
+       (package-archives): New variable.
+       (package-archive-contents): Doc fix.
+       (package-load-descriptor): Do nothing if descriptor file is missing.
+       (package--write-file-no-coding): New function.
+       (package-unpack-single): Use it.
+       (package-archive-id): New function.
+       (package-download-single, package-download-tar)
+       (package-menu-view-commentary): Use it.
+       (package-installed-p): Make second argument optional.
+       (package-read-all-archive-contents): New function.
+       (package-initialize): Use it.
+       (package-read-archive-contents): Add ARCHIVE argument.
+       (package--add-to-archive-contents): New function.
+       (package-install): Don't call package-read-archive-contents.
+       (package--download-one-archive): Store archive file in a
+       subdirectory of package-user-dir.
+       (package-menu-execute): Remove spurious line movement.
+
+2010-07-28  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * cus-start.el (tool-bar-style): Add text-image-horiz.
+
+2010-07-28  Michael Albinus  <michael.albinus@gmx.de>
+
+       * progmodes/gud.el (gud-common-init): Check for remoteness of
+       `file', and not of `default-directory'.
+
+2010-07-28  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/tramp.el (tramp-methods): Move hostname to the end in all
+       ssh `tramp-login-args'.
+       (tramp-verbose): Describe verbose level 9.
+       (tramp-open-shell): Check for tty if `tramp-verbose' >= 9.
+       (tramp-open-connection-setup-interactive-shell): Trace stty
+       settings if `tramp-verbose' >= 9.
+       (tramp-handle-start-file-process): Implement tty setting.
+       (Bug#4604, Bug#6360)
+
+       * net/tramp-cmds.el (tramp-bug): Recommend setting of
+       `tramp-verbose' to 9.
+
+2010-07-27  Aaron S. Hawley  <ashawley@burlingtontelecom.net>
+
+       * emacs-lisp/re-builder.el (reb-re-syntax, reb-lisp-mode)
+       (reb-lisp-syntax-p, reb-change-syntax, reb-cook-regexp):
+       Remove references to package `lisp-re' (bug#4369).
+
+2010-07-27  Tom Tromey  <tromey@redhat.com>
+
+       * progmodes/js.el (js-mode):
+       * progmodes/make-mode.el (makefile-mode):
+       * progmodes/simula.el (simula-mode):
+       * progmodes/tcl.el (tcl-mode): Derive from prog-mode.
+
+2010-07-27  Juanma Barranquero  <lekktu@gmail.com>
+
+       * help-fns.el (find-lisp-object-file-name): Doc fix (bug#6494).
+
+       * cedet/semantic/db-file.el (object-write): Fix typo in docstring.
+
+       * time.el (display-time-day-and-date): Remove spurious * in docstring.
+       (display-time-world-buffer-name, display-time-world-mode-map):
+       Fix typos in docstrings.
+
+2010-07-27  Shyam Karanatt  <shyam@swathanthran.in>  (tiny change)
+
+       * image-mode.el (image-display-size): New function.
+       (image-forward-hscroll, image-next-line, image-eol, image-eob)
+       (image-mode-fit-frame): Use it (Bug#6639).
+
+2010-07-27  Chong Yidong  <cyd@stupidchicken.com>
+
+       * dired.el (dired-buffers-for-dir): Handle list values of
+       dired-directory (Bug#6636).
+
+2010-07-26  Sam Steingold  <sds@gnu.org>
+
+       * mouse.el (mouse-yank-primary, mouse-yank-secondary):
+       Do not call `x-get-selection' the second time, reuse the value.
+
+2010-07-26  Daiki Ueno  <ueno@unixuser.org>
+
+       * epa-mail.el (epa-mail-mode-map): Add alternative key bindings
+       which consist of control chars only.  Suggested by Richard Stallman.
+
+2010-07-25  Daiki Ueno  <ueno@unixuser.org>
+
+       * epa-file.el (epa-file-insert-file-contents): Check if LOCAL-FILE
+       exists before passing an error to find-file-not-found-functions
+       (bug#6723).
+
+2010-07-23  Lukas Huonker  <l.huonker@gmail.com>
+
+       * play/tetris.el (tetris-tty-colors, tetris-x-colors, tetris-blank):
+       Remove leading nil element, adjust values.
+       (tetris-shapes, tetris-shape-scores):
+       Change representation of shapes and remove some redundancy.
+       (tetris-get-shape-cell, tetris-shape-width, tetris-draw-next-shape)
+       (tetris-draw-shape, tetris-erase-shape, tetris-test-shape):
+       Adjust for working with new representation of shapes.
+       (tetris-shape-rotations): New function.
+       (tetris-move-bottom, tetris-move-left, tetris-move-right)
+       (tetris-rotate-prev, tetris-rotate-next):
+       Adjust for working with the new version of tetris-test-shape.
+
+2010-07-23  Markus Triska  <markus.triska@gmx.at>
+
+       * progmodes/ps-mode.el: Use comint (bug#5954).
+       (ps-run-mode-map): Adapt for comint-mode; omit "\r", [return]..
+       (ps-mode-other-newline): Simplify.
+       (ps-run-mode): Derive from comint-mode instead of
+       fundamental-mode, yielding input history etc.
+       (ps-run-start, ps-run-quit, ps-run-clear, ps-run-region)
+       (ps-run-send-string): Adapt for comint-mode.
+       (ps-run-newline): Remove now unneeded function.
+
+2010-07-23  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/tramp.el (tramp-methods): Move hostname to the end in all
+       plink `tramp-login-args'.
+
+2010-07-23  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/tramp.el (tramp-open-shell): New defun.
+       (tramp-find-shell, tramp-open-connection-setup-interactive-shell):
+       Use it.
+
+2010-07-23  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/tramp.el (tramp-file-name-regexp-unified)
+       (tramp-completion-file-name-regexp-unified): On W32 systems, do
+       not regard the volume letter as remote filename.  (Bug#5447)
+
+2010-07-23  Juanma Barranquero  <lekktu@gmail.com>
+
+       * custom.el (custom-declare-variable): Give a clearer error message
+       when the docstring is missing (bug#6476).
+
+2010-07-22  Michael R. Mauger  <mmaug@yahoo.com>
+
+       * progmodes/sql.el: Version 2.4.  Improved Login prompting.
+       (sql-login-params): New widget definition.
+       (sql-oracle-login-params, sql-mysql-login-params)
+       (sql-solid-login-params, sql-sybase-login-params)
+       (sql-informix-login-params, sql-ingres-login-params)
+       (sql-ms-login-params, sql-postgres-login-params)
+       (sql-interbase-login-params, sql-db2-login-params)
+       (sql-linter-login-params): Use it.
+       (sql-sqlite-login-params): Use it; Define "database" parameter as
+       a file name.
+       (sql-sqlite-program): Change to "sqlite3".
+       (sql-comint-sqlite): Make sure database name is complete.
+       (sql-for-each-login): New function.
+       (sql-connect, sql-save-connection): Use it.
+       (sql-get-login-ext): New function.
+       (sql-get-login): Use it.
+       (sql-make-alternate-buffer-name): Handle :file parameters.
+
+2010-07-22  Juanma Barranquero  <lekktu@gmail.com>
+
+       * dired.el (dired-no-confirm): Document value t and fix defcustom to
+       accept it (bug#6597).  Suggested by Drew Adams <drew.adams@oracle.com>.
+
+2010-07-22  Teemu Likonen  <tlikonen@iki.fi>  (tiny change)
+
+       * dired.el (dired-mode-map): Use command remapping (bug#6632).
+
+2010-07-22  Lawrence Mitchell  <wence@gmx.li>
+
+       * term/vt100.el (vt100-wide-mode): Fix :init-value keyword (bug#6620).
+
+2010-07-21  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/tramp.el (tramp-get-ls-command)
+       (tramp-get-ls-command-with-dired): Run tests on "/dev/null"
+       instead of "/".
+
+2010-07-20  Michael R. Mauger  <mmaug@yahoo.com>
+
+       * progmodes/sql.el: Version 2.3.
+       (sql-connection-alist): Changed keys from symbols to strings;
+       enhanced the widget definition.
+       (sql-mode-menu): Added submenu to select connections.
+       (sql-interactive-mode-menu): Added "Save Connection" item.
+       (sql-add-product): Fixed menu item.
+       (sql-get-product-feature): Improved error handling.
+       (sql--alt-buffer-part, sql--alt-if-not-empty): Removed.
+       (sql-make-alternate-buffer-name): Simplified.
+       (sql-product-interactive): Handle missing product.
+       (sql-connect): Support string keys, minor improvements.
+       (sql-save-connection): New function.
+       (sql-connection-menu-filter): New function.
+
+2010-07-20  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/tramp.el (tramp-file-name-handler): Trace 'quit.
+       (tramp-open-connection-setup-interactive-shell): Apply
+       workaround for IRIX64 bug.  Move argument of last
+       `tramp-send-command' where it belongs to.
+
+2010-07-20  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/tramp.el (tramp-perl-file-attributes)
+       (tramp-perl-directory-files-and-attributes): Don't pass "$3".
+       (tramp-maybe-open-connection): Use `async-args' and `gw-args' in
+       front of `login-args'.
+
+2010-07-19  Juanma Barranquero  <lekktu@gmail.com>
+
+       * time.el (display-time-world-mode): Define with `define-derived-mode'.
+       Set `show-trailing-whitespace' to nil.
+       (display-time-world-display): Simplify.
+
+2010-07-18  Alan Mackenzie  <acm@muc.de>
+
+       Enhance `c-file-style' in file/directory local variables.
+       * progmodes/cc-mode.el (c-count-cfss): New function.
+       (c-before-hack-hook): Call `c-set-style' differently according to
+       whether c-file-style was set in file or directory local
+       variables.
+
+2010-07-18  Michael R. Mauger  <mmaug@yahoo.com>
+
+       * progmodes/sql.el: Version 2.2.
+       (sql-product, sql-user, sql-database, sql-server, sql-port): Use
+       defcustom :safe keyword rather than putting safe-local-variable
+       property.
+       (sql-password): Use defcustom :risky keyword rather than putting
+       risky-local-variable property.
+       (sql-oracle-login-params, sql-sqlite-login-params)
+       (sql-solid-login-params, sql-sybase-login-params)
+       (sql-informix-login-params, sql-ingres-login-params)
+       (sql-ms-login-params, sql-postgres-login-params)
+       (sql-interbase-login-params, sql-db2-login-params)
+       (sql-linter-login-params): Add `port' option.
+       (sql-get-product-feature): Added NO-INDIRECT parameter.
+       (sql-comint-oracle, sql-comint-sybase)
+       (sql-comint-informix, sql-comint-sqlite, sql-comint-mysql)
+       (sql-comint-solid, sql-comint-ingres, sql-comint-ms)
+       (sql-comint-postgres, sql-comint-interbase, sql-comint-db2)
+       (sql-comint-linter): Renamed sql-connect-* functions to
+       sql-comint-*.
+       (sql-product-alist, sql-mode-menu): Renamed as above and
+       :sqli-connect-func to :sqli-comint-func.
+       (sql-connection): New variable.
+       (sql-interactive-mode): Set it.
+       (sql-connection-alist): New variable.
+       (sql-connect): New function.
+       (sql--alt-buffer-part, sql--alt-if-not-empty)
+       (sql-make-alternate-buffer-name): Improved alternative buffer name.
+
+2010-07-17  Thierry Volpiatto  <thierry.volpiatto@gmail.com>
+
+       * image-mode.el (image-bookmark-make-record): Do not set context
+       in an image (Bug#6650).
+
+2010-07-17  Chong Yidong  <cyd@stupidchicken.com>
+
+       * simple.el (select-active-region): New function.
+       (push-mark-command, set-mark, activate-mark)
+       (handle-shift-selection): Use it.
+       (deactivate-mark): Don't check for size of region.
+
+       * mouse.el (mouse-drag-track): Use select-active-region.
+
+2010-07-17  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/tramp.el (tramp-get-ls-command-with-dired): Make test for
+       "--dired" stronger.
+
+2010-07-17  Chong Yidong  <cyd@stupidchicken.com>
+
+       * term/x-win.el (x-select-enable-primary): Change default to nil.
+       (x-select-enable-clipboard): Add :version keyword.
+
+       * mouse.el (mouse-drag-copy-region):
+       * simple.el (select-active-regions): Likewise.
+
+2010-07-16  Reiner Steib  <Reiner.Steib@gmx.de>
+
+       * vc/vc.el (vc-coding-system-inherit-eol): New defvar.
+       (vc-coding-system-for-diff): Use it to decide whether to inherit
+       from the file the EOL format for reading the diffs of that file.
+       (Bug#4451)
+
+2010-07-16  Eli Zaretskii  <eliz@gnu.org>
+
+       * mail/rmailmm.el (rmail-mime-save): Make the temp buffer
+       unibyte, so compressed attachments are not compressed again.
+
+2010-07-16  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/tramp.el (tramp-handle-shell-command): Don't use hard-wired
+       "/bin/sh" but `tramp-remote-sh' from `tramp-methods'.
+       (tramp-find-shell): Simplify setting connection property.
+       (tramp-get-ls-command): Make test for "--color=never" stronger.
+
+2010-07-15  Simon South  <ssouth@member.fsf.org>
+
+       * progmodes/delphi.el (delphi-previous-indent-of): Indent case
+       blocks within record declarations (i.e. variant parts) correctly.
+
+2010-07-15  Simon South  <ssouth@member.fsf.org>
+
+       * progmodes/delphi.el (delphi-token-at): Give newlines precedence
+       over literal tokens when parsing so newlines aren't "absorbed" by
+       single-line comments.  Corrects the indentation of case blocks
+       that have a comment on the first line.
+
+2010-07-14  Karl Fogel  <kfogel@red-bean.com>
+
+       * bookmark.el (bookmark-load-hook): Fix doc string as suggested
+       by Drew Adams (Bug#5504).
+
+2010-07-14  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * xt-mouse.el (xterm-mouse-event-read): Fix for characters > 127
+       now that Unicode is used (Bug#6594).
+
+2010-07-14  Chong Yidong  <cyd@stupidchicken.com>
+
+       * term/x-win.el (x-select-enable-clipboard): Default to t.
+       (x-initialize-window-system): Don't overwrite Paste menu item.
+
+       * simple.el (select-active-regions): Default to t.
+       (push-mark-command): Don't overwrite primary with empty string.
+
+       * mouse.el: Bind mouse-2 to mouse-yank-primary.
+       (mouse-drag-copy-region): Default to nil.
+
+       * menu-bar.el (menu-bar-enable-clipboard): Don't overwrite
+       Cut/Copy/Paste menu bar items.
+
+2010-07-13  Thierry Volpiatto  <thierry.volpiatto@gmail.com>
+
+       Allow C-w when setting a bookmark in a Gnus Article buffer (Bug#5975).
+       Patch applied by Karl Fogel.
+
+       * bookmark.el (bookmark-set): Don't set `bookmark-yank-point'
+       and `bookmark-current-buffer' if they have been already set in
+       another buffer (e.g gnus-art).
+
+2010-07-13  Karl Fogel  <kfogel@red-bean.com>
+            Thierry Volpiatto  <thierry.volpiatto@gmail.com>
+
+       Preparation for setting bookmarks in Gnus article buffers (Bug#5975).
+
+       * bookmark.el (bookmark-make-record-default): Allow unneeded
+       information to be omitted from the record.
+
+       Adjust declarations and calls:
+
+       * info.el (bookmark-make-record-default): Adjust declaration.
+       (Info-bookmark-make-record): Adjust call.
+
+       * woman.el (bookmark-make-record-default): Adjust declaration.
+       (woman-bookmark-make-record): Adjust call.
+
+       * man.el (bookmark-make-record-default): Adjust declaration.
+       (Man-bookmark-make-record): Adjust call.
+
+       * image-mode.el (bookmark-make-record-default): Adjust declaration.
+
+       * doc-view.el (bookmark-make-record-default): Adjust declaration.
+
+2010-07-13  Karl Fogel  <kfogel@red-bean.com>
+
+       * 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.
+
+2010-07-13  Thierry Volpiatto  <thierry.volpiatto@gmail.com>
+
+       * bookmark.el (bookmark-show-annotation): Ensure annotations show,
+       e.g. in Info bookmarks, by using `switch-to-buffer-other-window'.
+       Patch applied by Karl Fogel (Bug#6444).
+
+2010-07-13  Chong Yidong  <cyd@stupidchicken.com>
+
+       * frame.el (make-frame): Fix typo in 2010-06-30 change (Bug#6625).
+
+2010-07-13  Adrian Robert  <Adrian.B.Robert@gmail.com>
+
+       * term/ns-win.el: Bind M-~ to 'ns-prev-frame (due to Matthew
+       Dempsky; bug#5084).  Remove incorrect binding for S-tab.
+       (ns-alternatives-map): Change S-tab binding to backtab
+       (bug#6616).
+
+       * simple.el (normal-erase-is-backspace-setup-frame): Set mode on
+       under ns.
+
+2010-07-12  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * language/tai-viet.el ("TaiViet"): Try to fix re-encoding bugs.
+       (Bug#5806)
+
+       * language/tv-util.el (tai-viet-re): Remove format.
+
+2010-07-12  Kenichi Handa  <handa@m17n.org>
+
+       * language/hebrew.el: Remove no-byte-compile declaration.
+       Change coding: tag to utf-8.  Register hebrew-shape-gstring in
+       composition-function-table for 3-character looking back.
+       (hebrew-font-get-precomposed): New function.
+       (hebrew-shape-gstring): Utilize precomposed glyphs if available.
+
+2010-07-11  Chong Yidong  <cyd@stupidchicken.com>
+
+       * mouse.el (mouse-drag-track): Handle select-active-regions
+       (Bug#6612).
+
+2010-07-11  Magnus Henoch  <magnus.henoch@gmail.com>
+
+       * net/tramp-gvfs.el (tramp-gvfs-handle-copy-file): Do not pass
+       empty argument to gvfs-copy.
+
+2010-07-10  Glenn Morris  <rgm@gnu.org>
+
+       * calendar/calendar.el (calendar-week-end-day): New function.
+       * calendar/cal-tex.el (cal-tex-cursor-month): Remove unused vars.
+       Respect calendar-week-start-day.  (Bug#6606)
+       (cal-tex-insert-day-names, cal-tex-insert-blank-days)
+       (cal-tex-insert-blank-days-at-end): Respect calendar-week-start-day.
+       (cal-tex-first-blank-p, cal-tex-last-blank-p): Simplify, and
+       respect calendar-week-start-day.
+
+2010-07-10  Chong Yidong  <cyd@stupidchicken.com>
+
+       * simple.el (use-region-p): Doc fix (Bug#6607).
+
+2010-07-10  Aleksei Gusev  <aleksei.gusev@gmail.com>  (tiny change)
+
+       * progmodes/compile.el (compilation-error-regexp-alist-alist): Add
+       regexps for cucumber and ruby.
+
+2010-07-08  Daiki Ueno  <ueno@unixuser.org>
+
+       * epa-file.el (epa-file-error, epa-file--find-file-not-found-function)
+       (epa-file-insert-file-contents): Hack to prevent
+       find-file from opening empty buffer when decryption failed
+       (bug#6568).
+
+2010-07-07  Agustín Martín  <agustin.martin@hispalinux.es>
+
+       * textmodes/ispell.el (ispell-alternate-dictionary):
+       Use file-readable-p.
+       Return nil if no word-list is found at default locations.
+       (ispell-complete-word-dict): Default to nil.
+       (ispell-command-loop): Use 'word-list' when using lookup-words.
+       (lookup-words): Use ispell-complete-word-dict or
+       ispell-alternate-dictionary.  Check for word-list availability
+       and handle errors if needed with better messages (Bug#6539).
+       (ispell-complete-word): Use ispell-complete-word-dict or
+       ispell-alternate-dictionary.
+
+2010-07-07  Christoph Scholtes  <cschol2112@gmail.com>
+
+       * progmodes/python.el (python-font-lock-keywords): Add Python 2.7
+       builtins (BufferError, BytesWarning, WindowsError; callables
+       bin, bytearray, bytes, format, memoryview, next, print; __package__).
+
+2010-07-07  Glenn Morris  <rgm@gnu.org>
+
+       * play/zone.el (top-level): Do not require timer, tabify, or cl.
+       (zone-shift-left): Ignore intangibility, and any errors from
+       forward-char.
+       (zone-shift-right): Remove no-op end-of-line.  Ignore intangibility.
+       (zone-pgm-putz-with-case): Use upcase-region rather than inserting,
+       deleting, and copying text properties.
+       (zone-line-specs, zone-pgm-stress): Check forward-line exit status.
+       (zone-pgm-rotate): Handle odd buffers like that of gomoku, where getting
+       to point-max is hard.
+       (zone-fret, zone-fill-out-screen): Replace cl's do with dotimes.
+       (zone-fill-out-screen): Ignore intangibility.
+
+2010-07-05  Chong Yidong  <cyd@stupidchicken.com>
+
+       * menu-bar.el (menu-bar-mode):
+       * tool-bar.el (tool-bar-mode): Replace default-frame-alist element
+       if it has been set.
+
+       * mouse.el (mouse-drag-track): Call mouse-start-end to handle
+       word/line selection (Bug#6565).
+
+2010-07-04  Juanma Barranquero  <lekktu@gmail.com>
+
+       * net/dbus.el (dbus-send-signal): Declare function.
+
+2010-07-04  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/dbus.el: Implement signal "PropertiesChanged" (from D-Bus 1.3.1).
+       (dbus-register-property): New optional argument EMITS-SIGNAL.
+       (dbus-property-handler): Send signal "PropertiesChanged" if requested.
+
+2010-07-03  Chong Yidong  <cyd@stupidchicken.com>
+
+       * mouse.el (mouse-drag-overlay): Variable deleted.
+       (mouse-move-drag-overlay, mouse-show-mark): Functions deleted.
+       (mouse--remap-link-click-p): New function.
+       (mouse-drag-track): Handle dragging by using temporary Transient
+       Mark mode, instead of a special overlay.
+       (mouse-kill-ring-save, mouse-save-then-kill): Don't call
+       mouse-show-mark.
+
+       * mouse-sel.el (mouse-sel-selection-alist): mouse-drag-overlay
+       deleted.
+
+2010-07-02  Juri Linkov  <juri@jurta.org>
+
+       * autoinsert.el (auto-insert-alist): Fix readability
+       by using dotted pair notation for lambda.
+
+2010-07-02  Juri Linkov  <juri@jurta.org>
+
+       * faces.el (read-face-name): Rename arg `string-describing-default'
+       to `default'.  Doc fix.  Display the default value in quotes
+       in the prompt.  With empty input, return the `default' arg,
+       unless the default value is a string (in which case return nil).
+       (describe-face): Replace the string `default' arg of `read-face-name'
+       with the symbol `default'.
+
+2010-07-02  Chong Yidong  <cyd@stupidchicken.com>
+
+       * emulation/viper-cmd.el (viper-delete-backward-char)
+       (viper-del-backward-char-in-insert)
+       (viper-del-backward-char-in-replace, viper-change)
+       (viper-backward-indent): Replace delete-backward-char with
+       delete-char (Bug#6552).
+
+2010-07-01  Chong Yidong  <cyd@stupidchicken.com>
+
+       * ruler-mode.el (ruler--save-header-line-format): Fix typos.
+
+2010-06-30  Chong Yidong  <cyd@stupidchicken.com>
+
+       * frame.el (make-frame): Add default-frame-alist to the PARAMETERS
+       argument passed to frame-creation-function (Bug#5378).
+
+       * faces.el (x-handle-named-frame-geometry)
+       (x-handle-reverse-video, x-create-frame-with-faces)
+       (face-set-after-frame-default, tty-create-frame-with-faces): Don't
+       separately consult default-frame-alist.  It is now passed as the
+       PARAMETER argument.
+
+2010-06-30  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * startup.el (command-line): Don't call tool-bar-setup in a
+       tty-only build.
+
+2010-06-30  Chong Yidong  <cyd@stupidchicken.com>
+
+       * ruler-mode.el (ruler--save-header-line-format): New fun.
+       (ruler-mode): Use it as a setter function, so as not to overwrite
+       ruler-mode-header-line-format-old if Ruler mode is on (Bug#5370).
+
+2010-06-29  Chong Yidong  <cyd@stupidchicken.com>
+
+       * vc/vc.el (vc-deduce-backend): New fun.  Handle diff buffers.
+       (vc-root-diff, vc-print-root-log, vc-log-incoming)
+       (vc-log-outgoing): Use it.
+       (vc-diff-internal): Set diff-vc-backend.
+
+       * vc/diff-mode.el (diff-vc-backend): New var.
+
+2010-06-28  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * dynamic-setting.el (font-setting-change-default-font): Remove
+       call to message.
+
+2010-06-28  Kenichi Handa  <handa@m17n.org>
+
+       * international/quail.el (quail-insert-kbd-layout): Fix the
+       showing of untranslated characters.
+
+2010-06-28  Chong Yidong  <cyd@stupidchicken.com>
+
+       * simple.el (delete-active-region): New option.
+       (delete-backward-char): Implement in Lisp.
+       (delete-forward-char): New command.
+
+       * mouse.el (mouse-region-delete-keys): Deleted.
+       (mouse-show-mark): Simplify.
+
+       * bindings.el (global-map): Bind delete and DEL, the former to
+       delete-forward-char.
+
+2010-06-27  Lennart Borgman  <lennart.borgman@gmail.com>
+
+       * progmodes/ruby-mode.el (ruby-mode-map): Don't bind TAB.
+       (ruby-mode): Bind indent-line-function (Bug#5119).
+
+2010-06-27  Chong Yidong  <cyd@stupidchicken.com>
+
+       * startup.el (command-line): Recognize "0" X resource value.
+
+2010-06-27  Chong Yidong  <cyd@stupidchicken.com>
+
+       * startup.el (command-line): Use X resources to set the value of
+       menu-bar-mode and tool-bar-mode, before calling frame-initialize.
+
+       * menu-bar.el (menu-bar-mode):
+       * tool-bar.el (tool-bar-mode): Don't change default-frame-alist.
+       Set init-value to t.
+
+       * frame.el (frame-notice-user-settings): Don't change
+       default-frame-alist based on menu-bar-mode and tool-bar-mode, or
+       vice versa (Bug#2249).
+
+2010-06-26  Eli Zaretskii  <eliz@gnu.org>
+
+       * w32-fns.el (w32-convert-standard-filename): Doc fix.
+
+2010-06-25  Agustín Martín  <agustin.martin@hispalinux.es>
+
+       * textmodes/flyspell.el (flyspell-check-previous-highlighted-word):
+       Make sure `flyspell-word' re-checks word after function run (Bug#6504).
+
+       * textmodes/ispell.el (ispell-init-process): Make sure ispell and
+       default directories are expanded (Bug#6143).
+
+2010-06-24  Juri Linkov  <juri@jurta.org>
+
+       * minibuffer.el (completions-format): Change default from nil to
+       `horizontal'.  Remove `nil' value from :type.  Doc fix.  (Bug#6459)
+
+2010-06-24  Juri Linkov  <juri@jurta.org>
+
+       * vc/vc.el (vc-diff-internal): Set `revert-buffer-function'
+       buffer-locally to lambda that re-runs the vc diff command.
+       (Bug#6447)
+
+2010-06-24  Chong Yidong  <cyd@stupidchicken.com>
+
+       * kmacro.el (kmacro-call-macro): Don't issue hint message if the
+       echo area is in use (Bug#3412).
+
+2010-06-22  Glenn Morris  <rgm@gnu.org>
+
+       * textmodes/texinfmt.el (texinfo-format-region)
+       (texinfo-raise-lower-sections, texinfo-format-separate-node)
+       (texinfo-itemize-item, texinfo-multitable-item, texinfo-alias)
+       (texinfo-format-option, texinfo-noindent):
+       Use line-beginning-position and line-end-position.
+
+       * calc/calc-aent.el, calc/calc-ext.el, calc/calc-lang.el:
+       * calc/calc-store.el, calc/calc-units.el, calc/calc.el:
+       * calc/calccomp.el: Add explicit utf-8 coding cookies to files with
+       utf-8 characters.
+
+2010-06-21  Karl Fogel  <kfogel@red-bean.com>
+
+       * play/zone.el (zone-fall-through-ws): Fix next-line ->
+       forward-line fallout.
+
+2010-07-06  Chong Yidong  <cyd@stupidchicken.com>
+
+       * mouse.el (mouse-appearance-menu): Add docstring.
+
+       * help.el (describe-key): Print up-event using key-description.
+
+2010-07-03  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/zeroconf.el (zeroconf-resolve-service)
+       (zeroconf-service-resolver-handler): Use
+       `dbus-byte-array-to-string'.
+       (zeroconf-publish-service): Use `dbus-string-to-byte-array'.
+
+2010-07-03  Jan Moringen  <jan.moringen@uni-bielefeld.de>
+
+       * net/zeroconf.el (zeroconf-service-remove-hook): New defun.
+
+2010-06-30  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       Avoid displaying files with a nil state in vc-dir.
+       * vc/vc-dir.el (vc-dir-update): Obey the noinsert argument in all
+       cases that cause insertion.
        (vc-dir-resynch-file): Tell vc-dir-update to avoid inserting files
        with a nil state.
 
-2010-06-30  Chong Yidong  <cyd@stupidchicken.com>
+2010-06-30  Chong Yidong  <cyd@stupidchicken.com>
+
+       * xml.el (xml-parse-region): Avoid infloop (Bug#5281).
+
+2010-06-29  Leo  <sdl.web@gmail.com>
+
+       * emacs-lisp/rx.el (rx): Doc fix.  (Bug#6537)
+
+2010-06-27  Oleksandr Gavenko  <gavenkoa@gmail.com>  (tiny change)
+
+       * generic-x.el (bat-generic-mode): Fix regexp for command line
+       switches (Bug#5719).
+
+2010-06-27  Masatake YAMATO  <yamato@redhat.com>
+
+       * htmlfontify.el (hfy-face-attr-for-class): Use append instead
+       of nconc to avoid pure storage error (Bug#6239).
+
+2010-06-27  Christoph  <cschol2112@googlemail.com>  (tiny change)
+
+       * bookmark.el (bookmark-bmenu-2-window, bookmark-bmenu-other-window)
+       (bookmark-bmenu-other-window-with-mouse): Remove unnecessary
+       bindings of bookmark-automatically-show-annotations (Bug#6515).
+
+2010-06-25  Eli Zaretskii  <eliz@gnu.org>
+
+       * arc-mode.el (archive-zip-extract): Don't quote the file name on
+       MS-Windows and MS-DOS.  (Bug#6467, Bug#6144)
+
+2010-06-24  Štěpán Němec  <stepnem@gmail.com>  (tiny change)
+
+       * comint.el (make-comint, make-comint-in-buffer): Mention return
+       value in the docstrings.  (Bug#6498)
+
+2010-06-24  Yoni Rabkin  <yoni@rabkins.net>
+
+       * bs.el (bs-mode-font-lock-keywords): Remove "by" from Dired pattern,
+       since it is not present when using some non-default switches.
+
+2010-06-23  Karl Fogel  <kfogel@red-bean.com>
+
+       * simple.el (compose-mail): Fix doc string to refer to
+       `compose-mail-user-agent-warnings', instead of to the
+       nonexistent `compose-mail-check-user-agent'.
+
+2010-06-21  Alan Mackenzie  <bug-cc-mode@gnu.org>
+
+       Fix an indentation bug:
+
+       * progmodes/cc-mode.el (c-common-init): Initialise c-new-BEG/END.
+       (c-neutralize-syntax-in-and-mark-CPP): c-new-BEG/END: Take account
+       of existing values.
+
+       * progmodes/cc-engine.el (c-clear-<-pair-props-if-match-after)
+       (c-clear->-pair-props-if-match-before): now return t when they've
+       cleared properties, nil otherwise.
+       (c-before-change-check-<>-operators): Set c-new-beg/end correctly
+       by taking account of the existing value.
+
+       * progmodes/cc-defs.el
+       (c-clear-char-property-with-value-function): Fix this to clear the
+       property rather than overwriting it with nil.
+
+2010-06-20  Chong Yidong  <cyd@stupidchicken.com>
+
+       * emacs-lisp/package.el (package-print-package): Add link to
+       package description via describe-package.
+       (describe-package-1): List package requirements.  Add button to
+       perform installation.
+       (package-menu-describe-package): New command.
+
+       * help-mode.el (help-package): New button type.
+
+2010-06-19  Chong Yidong  <cyd@stupidchicken.com>
+
+       * emacs-lisp/package.el: Move package-list-packages binding to
+       menu-bar.el.
+       (describe-package, describe-package-1, package--dir): New funs.
+       (package-activate-1): Use package--dir.
+
+       * emacs-lisp/package-x.el (gnus-article-buffer): Require package.
+
+       * help-mode.el (help-package-def): New button type.
+
+       * menu-bar.el: Move package-list-packages binding here from
+       package.el.
+
+2010-06-19  Gustav Hållberg  <gustav@gmail.com>  (tiny change)
+
+       * descr-text.el (describe-char): Avoid trailing whitespace.  (Bug#6423)
+
+2010-06-18  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/edebug.el (edebug-read-list):
+       Phase out old-style backquotes.
+
+2010-06-17  Juri Linkov  <juri@jurta.org>
+
+       * help-mode.el (help-mode): Set buffer-local variable
+       revert-buffer-function to help-mode-revert-buffer.
+       (help-mode-revert-buffer): New function.
+
+       * info.el (Info-revert-find-node): Check for major-mode Info-mode
+       before popping to "*info*" (like in other Info functions).
+       Keep buffer-name in old-buffer-name.  Keep Info-history-forward in
+       old-history-forward.  Pop to old-buffer-name or "*info*" to
+       recreate the killed buffer.  Set Info-history-forward from
+       old-history-forward.
+       (Info-breadcrumbs-depth): Add :group and :version.
+
+2010-06-17  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * emacs-lisp/package.el (package-menu-mode-map): Add a menu.
+
+2010-06-17  Agustín Martín  <agustin.martin@hispalinux.es>
+
+       * textmodes/ispell.el (ispell-aspell-find-dictionary): Fix regexp
+       for languages like Portuguese with pt_{BR,PT} and no plain pt.
+
+2010-06-17  Juanma Barranquero  <lekktu@gmail.com>
+
+       * emacs-lisp/package.el (package-menu-mode-map):
+       Move initialization into declaration.
+
+       * menu-bar.el (menu-bar-options-menu): Fix typo in menu entry.
+
+2010-06-17  Chong Yidong  <cyd@stupidchicken.com>
+
+       * emacs-lisp/package.el (package-archive-base): Point to
+       elpa.gnu.org.
+       (package-enable, package-load-list): New defcustoms.
+       (package-user-dir, package-directory-list): Turn into defcustoms.
+       Don't include package-user-dir in package-directory-list.
+       (package--builtins-base): Don't include Emacs as a "package".
+       (package-subdirectory-regexp): New var.
+       (package-load-all-descriptors, package-compute-transaction)
+       (package-download-transaction): Obey package-load-list.
+       (package-activate-1): Rename from package-do-activate.
+       (package-list-packages-internal): Check package-load-list.
+       (package-load-descriptor, package-generate-autoloads)
+       (package-unpack, package-unpack-single)
+       (package--read-archive-file, package-delete): Use
+       expand-file-name.
+
+       * emacs-lisp/package-x.el: New file.  Package uploading
+       functionality split out from package.el.
+
+       * startup.el (command-line): Load packages after reading init
+       file.
+
+2010-06-17  Tom Tromey  <tromey@redhat.com>
+
+       * emacs-lisp/package.el: New file.
+
+2010-06-22  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       Fix vc-annotate for renamed files when using Git.
+       * vc-git.el (vc-git-find-revision): Deal with empty results from
+       ls-files.  Doe not pass the object as a file name to cat-file, it
+       is not a file name.
+       (vc-git-annotate-command): Pass the file name using -- to avoid
+       ambiguity with the revision.
+       (vc-git-previous-revision): Pass a relative file name.
+
+2010-06-22  Glenn Morris  <rgm@gnu.org>
+
+       * progmodes/js.el (js-mode-map): Use standard capitalization and
+       ellipses for menu entries.
+
+       * wid-edit.el (widget-complete): Doc fix.
+
+2010-06-22  Jürgen Hötzel  <juergen@hoetzel.info>  (tiny change)
+
+       * wid-edit.el (widget-complete): Fix typo in 2009-12-02 change.
+
+2010-06-22  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       Fix annotating other revisions for renamed files in vc-annotate.
+       * vc-annotate.el (vc-annotate): Add an optional argument for the
+       VC backend.  Use it when non-nil.
+       (vc-annotate-warp-revision): Pass the VC backend to vc-annotate.
+       (Bug#6487)
+
+       Fix vc-annotate-show-changeset-diff-revision-at-line for git.
+       * vc-annotate.el (vc-annotate-show-diff-revision-at-line-internal):
+       Do not pass the file name to the 'previous-revision call when we
+       don't want a file diff.  (Bug#6489)
+
+2010-06-21  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       Fix finding revisions for renamed files in vc-annotate.
+       * vc.el (vc-find-revision): Add an optional argument for
+       the VC backend.  Use it when non-nil.
+       * vc-annotate.el (vc-annotate-find-revision-at-line): Pass the VC
+       backend to vc-find-revision.  (Bug#6487)
+
+2010-06-21  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       Fix reading file names in Git annotate buffers.
+       * vc-git.el (vc-git-annotate-extract-revision-at-line): Remove
+       trailing whitespace.  Suggested by Eric Hanchrow.  (Bug#6481)
+
+2010-06-20  Alan Mackenzie  <acm@muc.de>
+
+       * progmodes/cc-mode.el (c-before-hack-hook): When the mode is set
+       in file local variables, set it first.
+
+2010-06-19  Glenn Morris  <rgm@gnu.org>
+
+       * descr-text.el (describe-char-unicode-data): Insert separating
+       space when needed.  (Bug#6422)
+
+       * progmodes/idlwave.el (idlwave-action-and-binding):
+       Fix typo in 2009-12-03 change.  (Bug#6450)
+
+2010-06-17  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/macroexp.el (macroexpand-all-1): Put back special
+       handling for `lambda' (misunderstanding).
+
+2010-06-16  Jay Belanger  <jay.p.belanger@gmail.com>
+
+       * calc/calc-poly.el (math-accum-factors): Make sure that
+       constants aren't distributed after they are factored out.
+
+2010-06-16  Juri Linkov  <juri@jurta.org>
+
+       * facemenu.el (list-colors-display): Call `pop-to-buffer' before
+       `list-colors-print'.  (Bug#6332)
+
+       * subr.el (read-quoted-char): Fix up last change (bug#6290).
+
+2010-06-16  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/macroexp.el (macroexpand-all-1): Don't handle `lambda'
+       specially, since it's a macro.  Fix up wrong hint passed to maybe-cons.
+
+       * font-lock.el (font-lock-major-mode): Rename from
+       font-lock-mode-major-mode to distinguish it from
+       global-font-lock-mode's own font-lock-mode-major-mode (bug#6135).
+       (font-lock-set-defaults):
+       * font-core.el (font-lock-default-function): Adjust users.
+       (font-lock-mode): Don't set it at all.
+
+2010-06-16  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * vc-annotate.el (vc-annotate): Use vc-read-revision.
+
+2010-06-16  Glenn Morris  <rgm@gnu.org>
+
+       * calendar/appt.el (appt-time-msg-list): Doc fix.
+       (appt-check): Let-bind appt-warn-time.
+       (appt-add): Make the 3rd argument optional.
+       Simplify argument names.  Doc fix.  Check for integer WARNTIME.
+       Only add WARNTIME to the output list if non-nil.
+
+2010-06-16  Ivan Kanis  <apple@kanis.eu>
+
+       * calendar/appt.el (appt-check): Let the 3rd element of
+       appt-time-msg-list specify the warning time.
+       (appt-add): Add new argument with the warning time.  (Bug#5176)
+
+2010-06-16  Bob Rogers  <rogers-emacs@rgrjr.dyndns.org>  (tiny change)
+
+       * vc-svn.el (vc-svn-after-dir-status): Fix regexp for Subversions
+       older than version 1.6.  (Bug#6361)
+
+2010-06-16  Helmut Eller  <eller.helmut@gmail.com>
+
+       * emacs-lisp/cl-macs.el (destructuring-bind): Bind `bind-enquote',
+       used by cl-do-arglist.  (Bug#6408)
+
+2010-06-16  Agustín Martín  <agustin.martin@hispalinux.es>
+
+       * textmodes/ispell.el (ispell-dictionary-base-alist): Fix
+       portuguese casechars/not-casechars for missing 'çÇ'.
+       Suggested by Rolando Pereira (bug#6434).
+
+2010-06-15  Juanma Barranquero  <lekktu@gmail.com>
+
+       * facemenu.el (list-colors-sort): Doc fix.
+
+2010-06-15  Bob Rogers  <rogers-emacs@rgrjr.dyndns.org>  (tiny change)
+
+       * progmodes/sql.el (sql-connect-mysql): Fix typo.
+
+2010-06-14  Juri Linkov  <juri@jurta.org>
+
+       Add sort option `list-colors-sort'.  (Bug#6332)
+       * facemenu.el (color-rgb-to-hsv): New function.
+       (list-colors-sort): New defcustom.
+       (list-colors-sort-key): New function.
+       (list-colors-display): Doc fix.  Sort list according to the option
+       `list-colors-sort'.
+       (list-colors-print): Add HSV values to `help-echo' property of
+       RGB strings.
+
+2010-06-14  Juri Linkov  <juri@jurta.org>
+
+       * compare-w.el: Move to the "vc" subdirectory.
+
+2010-06-14  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * image-mode.el (image-mode-map): Remap left-char and right-char.
+
+       * nxml/nxml-mode.el (nxml-indent-line): Standardize indent behavior.
+
+2010-06-12  Chong Yidong  <cyd@stupidchicken.com>
+
+       * term/common-win.el (x-colors): Add all the color names defined
+       in rgb.txt (Bug#6332).
+
+       * facemenu.el (list-colors-print): Don't print extra names if it
+       will overflow the window width.
+
+       * vc/log-edit.el (log-edit-font-lock-keywords): Revert 2010-06-02
+       change (Bug#6343).
+
+2010-06-12  Eli Zaretskii  <eliz@gnu.org>
+
+       * files.el (make-directory): Doc fix (bug#6396).
+
+2010-06-12  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/tramp.el (tramp-remote-process-environment): Protect version
+       string by apostroph.
+       (tramp-shell-prompt-pattern): Do not use a shy group in case of
+       XEmacs.
+       (tramp-file-name-for-operation): Add `call-process-region'.
+       (tramp-set-process-query-on-exit-flag): Fix wrong parentheses.
+
+       * net/tramp-compat.el (top): Do not autoload
+       `tramp-handle-file-remote-p'.  Load tramp-util.el and tramp-vc.el
+       only when `start-file-process' is not bound.
+       (tramp-advice-file-expand-wildcards): Do not use
+       `tramp-handle-file-remote-p'.
+       (tramp-compat-make-temp-file): Handle the case, that
+       `make-temp-file' has no third argument EXTENSION.
+
+2010-06-11  Juanma Barranquero  <lekktu@gmail.com>
+
+       * makefile.w32-in (WINS_BASIC): Include new directory vc.
+
+       * loadup.el ("vc-hooks", "ediff-hook"): Load from lisp/vc/.
+
+2010-06-11  Juri Linkov  <juri@jurta.org>
+
+       * finder.el (finder-known-keywords): Add keyword "vc"
+       for version control.
+
+       * add-log.el, cvs-status.el, diff.el, diff-mode.el, ediff.el,
+       * emerge.el, log-edit.el, log-view.el, pcvs.el, smerge-mode.el,
+       * vc-annotate.el, vc-bzr.el, vc-dir.el, vc-dispatcher.el, vc-git.el,
+       * vc-hg.el, vc-mtn.el, vc.el: Add keyword "vc".
+
+2010-06-11  Juri Linkov  <juri@jurta.org>
+
+       Move version control related files to the "vc" subdirectory.
+       * add-log.el, cvs-status.el, diff.el, diff-mode.el, ediff-diff.el,
+       * ediff.el, ediff-help.el, ediff-hook.el, ediff-init.el,
+       * ediff-merg.el, ediff-mult.el, ediff-ptch.el, ediff-util.el,
+       * ediff-vers.el, ediff-wind.el, emerge.el, log-edit.el, log-view.el,
+       * pcvs-defs.el, pcvs.el, pcvs-info.el, pcvs-parse.el, pcvs-util.el,
+       * smerge-mode.el, vc-annotate.el, vc-arch.el, vc-bzr.el, vc-cvs.el,
+       * vc-dav.el, vc-dir.el, vc-dispatcher.el, vc.el, vc-git.el,
+       * vc-hg.el, vc-hooks.el, vc-mtn.el, vc-rcs.el, vc-sccs.el, vc-svn.el:
+       Move files to the "vc" subdirectory.
+
+2010-06-11  Chong Yidong  <cyd@stupidchicken.com>
+
+       * comint.el (comint-password-prompt-regexp): Fix 2010-04-10 change
+       (Bug#6367).
+
+2010-06-11  Stephen Eglen  <stephen@gnu.org>
+
+       * shell.el: Bind `shell-resync-dirs' to M-RET.
+
+2010-06-10  Michael Albinus  <michael.albinus@gmx.de>
+
+       * notifications.el: Move file from lisp/net, because it is
+       supposed to talk locally to the user.
+
+2010-06-10  Julien Danjou  <julien@danjou.info>
+
+       * net/notifications.el (notifications-on-action-signal)
+       (notifications-on-closed-signal): Pass notification id as first
+       argument to the callback functions.  Add docstrings.
+       (notifications-notify): Fix docstring.
+
+2010-06-10  Glenn Morris  <rgm@gnu.org>
+
+       * emacs-lisp/authors.el (authors-ignored-files)
+       (authors-valid-file-names): Add some files.
+
+2010-06-10  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * net/rcirc.el (rcirc-server-alist, rcirc, rcirc-connect): Resolve
+       merge conflict, giving preference to the emacs-23 version of the code.
+
+2010-06-09  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/advice.el (ad-compile-function):
+       Define warning-suppress-types before we let-bind it (bug#6275).
+
+       * vc-dispatcher.el: Rename mode-line-hook to vc-mode-line-hook;
+       declare it, make it buffer-local and permanent-local (bug#6324).
+       (vc-resynch-window): Adjust name.
+       * vc-hooks.el (vc-find-file-hook): Adjust name.
+
+2010-06-09  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/notifications.el (notifications-notify): Fix docstring.
+
+2010-06-09  Juanma Barranquero  <lekktu@gmail.com>
+
+       Update to Unicode 6.0.0 beta.
+       * international/charprop.el: Update copyright.
+       * international/mule-cmds.el (ucs-names): Update character ranges.
+       * international/uni-bidi.el:
+       * international/uni-category.el:
+       * international/uni-combining.el:
+       * international/uni-comment.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-old-name.el:
+       * international/uni-titlecase.el:
+       * international/uni-uppercase.el: Regenerate.
+
+2010-06-09  Juanma Barranquero  <lekktu@gmail.com>
+
+       * emacs-lisp/smie.el (comment-string-strip): Declare function.
+       (smie-precs-precedence-table): Fix typo in docstring.
+
+       * vc-mtn.el (log-edit-extract-headers): Declare function.
+
+       * vc-hg.el (log-edit-extract-headers): Remove duplicate declaration.
+
+       * net/notifications.el (dbus-register-signal): Declare function.
+       (notifications-notify): Fix typos and reflow docstring.
+
+2010-06-09  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       Improve VC create/retrieve tag/branch.
+       * vc.el (vc-create-tag): Do not read the directory name for VCs
+       with repository revision granularity.  Adjust the tag/branch
+       prompt.  Reset VC properties.
+       (vc-retrieve-tag): Do not read the directory name for VCs
+       with repository revision granularity.  Reset VC properties.
+
+2010-06-09  Julien Danjou  <julien@danjou.info>
+
+       * net/notifications.el: New file.
+
+2010-06-09  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       Add optional support for resetting VC properties.
+       * vc-dispatcher.el (vc-resynch-window): Add new optional argument,
+       call vc-file-clearprops when true.
+       (vc-resynch-buffer): Add new optional argument, pass it down.
+       (vc-resynch-buffers-in-directory): Likewise.
+
+       Improve support for special markup in the VC commit message.
+       * vc-mtn.el (vc-mtn-checkin): Add support for Author: and Date: markup.
+       * vc-hg.el (vc-hg-checkin): Add support for Date:.
+       * vc-git.el (vc-git-checkin):
+       * vc-bzr.el (vc-bzr-checkin): Likewise.
+
+2010-06-09  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/smie.el (smie-indent-keyword): Remove special case that
+       can be handled with a ((:before "fn") (:prev "=>" parent)) rule.
+
+2010-06-07  Martin Pohlack  <mp26@os.inf.tu-dresden.de>
+
+       * iimage.el: Remove images as soon as the underlying text is modified.
+       (iimage-modification-hook): New function.
+       (iimage-mode-buffer): Use it.
+
+2010-06-07  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/smie.el (smie-indent-offset-rule): Rename from
+       smie-indent-offset-after.  Add :prev case.  Make a bit more generic.
+       (smie-indent-virtual): Remove `virtual' arg.  Update callers.
+       (smie-indent-keyword): Add handling of open-paren keywords.
+       (smie-indent-comment-continue): Don't assume comment-continue.
+
+2010-06-07  Martin Rudalics  <rudalics@gmx.at>
+
+       * window.el (pop-to-buffer): Remove the conditional that
+       compares new-window and old-window, so it will reselect
+       the selected window unconditionally.
+       http://lists.gnu.org/archive/html/emacs-devel/2010-06/msg00078.html
+
+2010-06-07  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/smie.el (smie-indent-offset-after)
+       (smie-indent-forward-token, smie-indent-backward-token): New functions.
+       (smie-indent-after-keyword): Use them.
+       (smie-indent-fixindent): Only applies to the indentation of the BOL.
+       (smie-indent-keyword): Tweak the black magic.
+       (smie-indent-comment-continue): Strip comment-continue before use.
+       (smie-indent-functions): Indent comments before keywords.
+
+2010-06-06  Juri Linkov  <juri@jurta.org>
+
+       * isearch.el (isearch-lazy-highlight-search): Fix looping
+       by checking for empty match.  This syncs this loop with the
+       similar loop in `isearch-search'.  (Bug#6362)
+
+2010-06-05  Juanma Barranquero  <lekktu@gmail.com>
+
+       * net/dbus.el (dbus-register-method): Declare function.
+       (dbus-handle-event, dbus-property-handler): Fix typos in docstrings.
+       (dbus-introspect): Doc fix.
+       (dbus-event-bus-name, dbus-introspect-get-interface)
+       (dbus-introspect-get-argument): Reflow docstrings.
+
+2010-06-05  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       vc-log-incoming/vc-log-outgoing fixes for Git.
+       * vc-git.el (vc-git-log-view-mode): Fix font lock for
+       incoming/outgoing logs.
+       (vc-git-log-outgoing, vc-git-log-incoming): Use @{upstream}
+       instead of vc-git-compute-remote.
+       (vc-git-compute-remote): Remove.
+
+2010-06-04  Chong Yidong  <cyd@stupidchicken.com>
+
+       * term/common-win.el (x-colors): Add "dark green" and "dark
+       turquoise" (Bug#6332).
+
+2010-06-04  Juri Linkov  <juri@jurta.org>
+
+       * simple.el (kill-new): Fix logic of kill-do-not-save-duplicates.
+       Instead of setting `replace' to t and replacing the same string
+       with itself, don't do certain actions when
+       kill-do-not-save-duplicates is non-nil and string is equal to car
+       of kill-ring: don't call menu-bar-update-yank-menu, don't push
+       interprogram-paste strings to kill-ring, and don't push the input
+       argument `string' to kill-ring.
+       http://lists.gnu.org/archive/html/emacs-devel/2010-06/msg00072.html
+
+2010-06-04  Juanma Barranquero  <lekktu@gmail.com>
+
+       * subr.el (directory-sep-char): Move from fileio.c and make a defconst.
+
+2010-06-04  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/tramp-gvfs.el (tramp-gvfs-handle-expand-file-name): Expand "~/".
+       (tramp-gvfs-handler-mounted-unmounted)
+       (tramp-gvfs-connection-mounted-p): Handle default-location.
+
+       * net/tramp-smb.el (tramp-smb-handle-delete-directory): Don't try to
+       move files to trash.
+
+2010-06-04  Juanma Barranquero  <lekktu@gmail.com>
+
+       * international/mule-cmds.el (nonascii-insert-offset)
+       (nonascii-translation-table): Add obsolescence information.
+
+       * international/mule.el (make-translation-table-from-vector): Doc fix.
+
+2010-06-03  Eric Ludlam  <zappo@gnu.org>
+
+       * cedet/semantic/lex-spp.el
+       (semantic-lex-spp-table-write-slot-value): Instead of erroring on
+       invalid values during save, just save a nil (Bug#6324).
+
+2010-06-03  Glenn Morris  <rgm@gnu.org>
+
+       * desktop.el (desktop-clear-preserve-buffers):
+       Add "*Warnings*" buffer.  (Bug#6336)
+
+2010-06-03  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       vc-log-incoming/vc-log-outgoing improvements for Git.
+       * vc-git.el (vc-git-log-outgoing): Use the same format as the
+       short log.
+       (vc-git-log-incoming): Likewise.  Run "git fetch" before the log command.
+
+       Add bindings for vc-log-incoming and vc-log-outgoing.
+       * vc-hooks.el (vc-prefix-map): Add bindings for vc-log-incoming
+       and vc-log-outgoing.
+       * vc-dir.el (vc-dir-menu-map): Add menu bindings for vc-log-incoming
+       and vc-log-outgoing.
+
+2010-06-03  Chong Yidong  <cyd@stupidchicken.com>
+
+       * net/rcirc.el (rcirc-sort-nicknames): Remove.
+       (rcirc-handler-366): Always sort nicknames.
+
+2010-06-03  Juanma Barranquero  <lekktu@gmail.com>
+
+       * emacs-lisp/smie.el (comment-continue): Declare for byte-compiler.
+
+2010-06-03  Chong Yidong  <cyd@stupidchicken.com>
+
+       * net/rcirc.el (rcirc-nickname<, rcirc-sort-nicknames-join): Doc fix.
+
+2010-06-03  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * net/rcirc.el (rcirc-sort-nicknames): Change default.
+       (rcirc-sort-nicknames-join): Avoid setq.
+
+2010-06-03  Deniz Dogan  <deniz.a.m.dogan@gmail.com>
+
+       * net/rcirc.el (rcirc-sort-nicknames): New custom.
+       (rcirc-nickname<, rcirc-sort-nicknames-join): New funs.
+       (rcirc-handler-366): Use them.
+
+2010-06-03  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       Split smie-indent-calculate into more manageable chunks.
+       * emacs-lisp/smie.el (smie-indent-virtual, smie-indent-fixindent)
+       (smie-indent-comment, smie-indent-after-keyword, smie-indent-keyword)
+       (smie-indent-close, smie-indent-comment-continue, smie-indent-bob)
+       (smie-indent-exps): Extract from smie-indent-calculate.
+       (smie-indent-functions): New var.
+       (smie-indent-functions): Use them.
+
+2010-06-02  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/smie.el (smie-indent-hanging-p): Use smie-bolp.
+       (smie-indent-calculate): Simplify and cleanup.
+
+2010-06-02  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/tramp-gvfs.el (top): Require url-util.
+       (tramp-gvfs-mount-point): Remove.
+       (tramp-gvfs-stringify-dbus-message, tramp-gvfs-send-command):
+       New defuns.
+       (with-tramp-dbus-call-method): Format trace message.
+       (tramp-gvfs-handle-copy-file, tramp-gvfs-handle-rename-file):
+       Implement backup call, when operation on local files fails.
+       Use progress reporter.  Flush properties of changed files.
+       (tramp-gvfs-handle-make-directory): Make more traces.
+       (tramp-gvfs-url-file-name): Hexify file name in url.
+       (tramp-gvfs-fuse-file-name): Take also prefix (like dav shares)
+       into account for the resulting file name.
+       (tramp-gvfs-handler-askquestion): Return dummy mountpoint, when
+       the answer is "no".  See `tramp-gvfs-maybe-open-connection'.
+       (tramp-gvfs-handler-mounted-unmounted)
+       (tramp-gvfs-connection-mounted-p): Test also for new mountspec
+       attribute "default_location".  Set "prefix" property.
+       (tramp-gvfs-mount-spec): Return both prefix and mountspec.
+       (tramp-gvfs-maybe-open-connection): Test, whether mountpoint
+       exists.  Raise an error, if not (due to a corresponding answer
+       "no" in interactive questions, for example).
+
+2010-06-02  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * log-edit.el (log-edit-font-lock-keywords): Make group 4 match lax.
+
+2010-06-01  Juanma Barranquero  <lekktu@gmail.com>
+
+       * emacs-lisp/eldoc.el: Add completions for new commands left-* and
+       right-*.  (Bug#6265)
+
+2010-06-01  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       Add support for vc-log-incoming, improve vc-log-outgoing for Git.
+       * vc-git.el (vc-git-compute-remote): New function.
+       (vc-git-log-outgoing): Use it instead of hard coding a value.
+       (vc-git-log-incoming): New function.
+
+       Improve state updating for VC tag commands.
+       * vc.el (vc-create-tag, vc-retrieve-tag): Call vc-resynch-buffer
+       to update the state of all buffers in the directory.
+
+       * vc-dir.el (vc-dir-update): Remove entries with a nil state (bug#5539).
+
+2010-06-01  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * vc-bzr.el (vc-bzr-revision-completion-table): Apply
+       `file-directory-p' to the filename part rather than to the whole text.
+
+2010-05-31  Jonathan Marchand  <jonathlela@gmail.com>  (tiny change)
+
+       * cedet/ede/cpp-root.el (ede-set-project-variables): Fix feature name
+       (bug#6231).
+
+2010-05-31  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * man.el (Man-completion-table): Let the user type "-k " (bug#6319).
+
+2010-05-31  Drew Adams  <drew.adams@oracle.com>
+
+       * files.el (directory-files-no-dot-files-regexp): Doc fix (bug#6298).
+
+2010-05-31  Juanma Barranquero  <lekktu@gmail.com>
+
+       * subr.el (momentary-string-display): Just use read-event to read
+       the exit event (Bug#6238).
+
+2010-05-30  Eli Zaretskii  <eliz@gnu.org>
+
+       * international/mule.el (define-coding-system): Doc fix (bug#6313).
+
+2010-05-30  Juanma Barranquero  <lekktu@gmail.com>
+
+       * emulation/cua-base.el: Recognize also `right-word' and `left-word'.
+       Suggested by Eli Zaretskii <eliz@gnu.org>.
+
+2010-05-30  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * minibuffer.el (completion-file-name-table): Don't return a boundary
+       past the end of `string' (bug#6299).
+       (completion--file-name-table): Delegate to completion-file-name-table
+       for the `boundaries' case.
+
+2010-05-30  Juanma Barranquero  <lekktu@gmail.com>
+
+       * emulation/cua-base.el: Recognize `right-char' and `left-char' as
+       movement commands.
+
+       * progmodes/ada-xref.el (ada-prj-ada-project-path-sep): Set from
+       `path-separator', but maintain compatibility with Emacs 20.2.
+
+2010-05-29  Chong Yidong  <cyd@stupidchicken.com>
+
+       * server.el (server-process-filter): Receive parent-id argument
+       from emacsclient.
+       (server-create-window-system-frame): New arg.  Pass parent-id as
+       frame parameter.
+
+2010-05-29  Eli Zaretskii  <eliz@gnu.org>
+
+       Bidi-sensitive word movement with arrow keys.
+       * subr.el (right-arrow-command, left-arrow-command): Move to
+       bindings.el.
+
+       * bindings.el (right-char, left-char): Move from subr.el and
+       rename from right-arrow-command and left-arrow-command.
+       (right-word, left-word): New functions.
+       (global-map) <right>: Bind to right-char.
+       (global-map) <left>: Bind to left-char.
+       (global-map) <C-right>: Bind to right-word.
+       (global-map) <C-left>: Bind to left-word.
+
+       * ls-lisp.el (ls-lisp-classify-file): New function.
+       (ls-lisp-insert-directory): Call it if switches include -F (bug#6294).
+       (ls-lisp-classify): Call ls-lisp-classify-file.
+       (insert-directory): Remove blanks from switches.
+
+2010-05-29  Chong Yidong  <cyd@stupidchicken.com>
+
+       * ansi-color.el: Delete unused escape sequences (Bug#6085).
+       (ansi-color-drop-regexp): New constant.
+       (ansi-color-apply, ansi-color-filter-region)
+       (ansi-color-apply-on-region): Delete unrecognized control sequences.
+       (ansi-color-apply): Build string list before calling concat.
+
+2010-05-28  Juri Linkov  <juri@jurta.org>
+
+       * image-dired.el (image-dired-dired-toggle-marked-thumbs):
+       Replace LOCALP arg of `dired-get-filename' 'no-dir with nil.
+       (Bug#5270)
+
+2010-05-28  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/tramp.el (tramp-debug-message): Add `tramp-compat-funcall'
+       to ignored backtrace functions.
+       (with-progress-reporter): Expand docstring.
+       (tramp-handle-delete-file): Implement TRASH argument.
+       (tramp-get-remote-trash): New defun.
+
+2010-05-28  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/tramp-compat.el (tramp-compat-delete-file): Use
+       `symbol-value' for backward compatibility.
+
+       * net/tramp.el (tramp-handle-make-symbolic-link)
+       (tramp-handle-load)
+       (tramp-do-copy-or-rename-file-via-buffer)
+       (tramp-do-copy-or-rename-file-directly)
+       (tramp-do-copy-or-rename-file-out-of-band)
+       (tramp-handle-process-file, tramp-handle-call-process-region)
+       (tramp-handle-shell-command, tramp-handle-file-local-copy)
+       (tramp-handle-insert-file-contents, tramp-handle-write-region)
+       (tramp-delete-temp-file-function): Use `delete-file' instead
+       of `tramp-compat-delete-file'.
+
+       * net/tramp-fish.el (tramp-fish-handle-delete-directory)
+       (tramp-fish-handle-make-symbolic-link)
+       (tramp-fish-handle-process-file): Use `delete-file' instead
+       of `tramp-compat-delete-file'.
+
+       * net/tramp-ftp.el (tramp-ftp-file-name-handler): Use
+       `delete-file' instead of `tramp-compat-delete-file'.
+
+       * net/tramp-gvfs.el (tramp-gvfs-handle-delete-file): Rename arg.
+       (tramp-gvfs-handle-write-region): Use `delete-file' instead of
+       `tramp-compat-delete-file'.
+
+       * net/tramp-imap.el (tramp-imap-do-copy-or-rename-file): Use
+       `delete-file' instead of `tramp-compat-delete-file'.
+
+       * net/tramp-smb.el (tramp-smb-handle-copy-file)
+       (tramp-smb-handle-file-local-copy, tramp-smb-handle-rename-file)
+       (tramp-smb-handle-write-region): Use `delete-file' instead of
+       `tramp-compat-delete-file'.
+       (tramp-smb-handle-delete-directory): Use 'trash as arg.
+
+2010-05-27  Chong Yidong  <cyd@stupidchicken.com>
+
+       * dired.el (dired-delete-file): New arg TRASH.
+       (dired-internal-do-deletions): New arg TRASH.  Use progress reporter.
+       (dired-do-flagged-delete, dired-do-delete): Use trash.
+
+       * speedbar.el (speedbar-item-delete): Allow trashing.
+
+       * files.el (delete-directory): New arg TRASH.
+
+       * net/ange-ftp.el (ange-ftp-del-tmp-name, ange-ftp-delete-file)
+       (ange-ftp-rename-remote-to-remote)
+       (ange-ftp-rename-local-to-remote)
+       (ange-ftp-rename-remote-to-local, ange-ftp-load)
+       (ange-ftp-compress, ange-ftp-uncompress): Remove optional arg from
+       `delete-file'.
+       (ange-ftp-delete-directory): Add optional arg to `delete-file', to
+       allow trashing.
+
+       * net/tramp-compat.el (tramp-compat-delete-file): Rewrite to
+       handle new TRASH arg of `delete-file'.
+
+       * net/tramp.el (tramp-handle-delete-file): Change FORCE arg to TRASH.
+       (tramp-handle-make-symbolic-link, tramp-handle-load)
+       (tramp-do-copy-or-rename-file-via-buffer)
+       (tramp-do-copy-or-rename-file-directly)
+       (tramp-do-copy-or-rename-file-out-of-band)
+       (tramp-handle-process-file, tramp-handle-call-process-region)
+       (tramp-handle-shell-command, tramp-handle-file-local-copy)
+       (tramp-handle-insert-file-contents, tramp-handle-write-region)
+       (tramp-delete-temp-file-function): Use null TRASH arg in
+       tramp-compat-delete-file call.
+
+       * net/tramp-fish.el (tramp-fish-handle-delete-directory)
+       (tramp-fish-handle-delete-file)
+       (tramp-fish-handle-make-symbolic-link)
+       (tramp-fish-handle-process-file): Use null TRASH arg in
+       `tramp-compat-delete-file' call.
+
+       * net/tramp-ftp.el (tramp-ftp-file-name-handler): Use null TRASH
+       arg in `tramp-compat-delete-file' call.
+
+       * net/tramp-gvfs.el (tramp-gvfs-handle-delete-file): Rename arg.
+       (tramp-gvfs-handle-write-region): Use null TRASH arg in
+       `tramp-compat-delete-file' call.
+
+       * net/tramp-imap.el (tramp-imap-handle-delete-file): Rename arg.
+       (tramp-imap-do-copy-or-rename-file): Use null TRASH arg in
+       `tramp-compat-delete-file' call.
+
+       * net/tramp-smb.el (tramp-smb-handle-copy-file)
+       (tramp-smb-handle-file-local-copy, tramp-smb-handle-rename-file)
+       (tramp-smb-handle-write-region): Use null TRASH arg in
+       tramp-compat-delete-file call.
+       (tramp-smb-handle-delete-directory): Use tramp-compat-delete-file.
+       (tramp-smb-handle-delete-file): Rename arg.
+
+       * diff.el (diff-sentinel):
+       * epg.el (epg--make-temp-file, epg-decrypt-string)
+       (epg-verify-string, epg-sign-string, epg-encrypt-string):
+       * jka-compr.el (jka-compr-partial-uncompress)
+       (jka-compr-call-process, jka-compr-write-region):
+       * server.el (server-sentinel): Remove optional arg from
+       delete-file, reverting 2010-05-03 change.
+
+2010-05-27  Chong Yidong  <cyd@stupidchicken.com>
+
+       * progmodes/verilog-mode.el (verilog-type-font-keywords): Use
+       font-lock-constant-face, not obsolete font-lock-reference-face.
+
+2010-05-27  Kenichi Handa  <handa@m17n.org>
+
+       * language/hebrew.el (hebrew-shape-gstring): Check if a glyph
+       element of GSTRING is nil.
+
+2010-05-27  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/smie.el (smie-forward-token-function)
+       (smie-backward-token-function): New vars.
+       (smie-backward-sexp, smie-forward-sexp)
+       (smie-indent-hanging-p, smie-indent-calculate): Use them.
+       (smie-default-backward-token): Rename from smie-backward-token and
+       skip comments.
+       (smie-default-forward-token): Rename from smie-forward-token and
+       skip comments.
+       (smie-next-sexp): Handle nil results from next-token.
+       (smie-indent-calculate): Add a new case for special `fixindent' comments.
+
+2010-05-27  Chong Yidong  <cyd@stupidchicken.com>
+
+       * progmodes/verilog-mode.el (verilog-type-font-keywords):
+       Use font-lock-constant-face, not obsolete font-lock-reference-face.
+
+2010-05-27  Masatake YAMATO  <yamato@redhat.com>
+
+       * htmlfontify.el (hfy-face-resolve-face): New function.
+       (hfy-face-to-style): Use it (Bug#6279).
+
+2010-05-26  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * progmodes/ada-xref.el (ada-gnat-parse-gpr):
+       * emulation/edt.el (edt-load-keys): Avoid (expand-file-name ".").
+
+2010-05-26  Glenn Morris  <rgm@gnu.org>
+
+       * emulation/edt.el (edt-load-keys): Use locate-library.
+
+2010-05-25  Chong Yidong  <cyd@stupidchicken.com>
+
+       * log-edit.el (log-edit-strip-single-file-name): Default to nil.
+       (log-edit-changelog-entries): Doc fix.
+       (log-edit-changelog-insert-entries): Args changed.
+       Rename relative filenames in ChangeLog entries.  Delete tabs.
+       (log-edit-insert-changelog-entries): Reorganize return value of
+       `log-edit-changelog-entries' to pass filenames to
+       log-edit-changelog-insert-entries.
+
+2010-05-25  Thierry Volpiatto  <thierry.volpiatto@gmail.com>
+
+       * dired.el (dired-mode-map): Rebind "\C-t\C-t" from
+       `image-dired-dired-insert-marked-thumbs' to
+       `image-dired-dired-toggle-marked-thumbs'.
+
+       * image-dired.el: Require cl when compiling.
+       (image-dired-dired-toggle-marked-thumbs): Rename from
+       `image-dired-dired-insert-marked-thumbs'.  Add ARG.  Doc fix.
+       Use interactive spec "P".  Set LOCALP arg of `dired-get-filename'
+       to 'no-dir.  Skip files whose names don't match
+       `image-file-name-regexp'.  When file has a thumbnail overlay,
+       delete it.  (Bug#5270)
+
+2010-05-25  Juri Linkov  <juri@jurta.org>
+
+       * image-mode.el (image-mode): Add image-after-revert-hook to
+       after-revert-hook.
+       (image-after-revert-hook): New function.  (Bug#5669)
+
+2010-05-25  Juri Linkov  <juri@jurta.org>
+
+       * image.el (image-animated-p): When delay between animated images
+       is 0, set it to 10 (0.1 sec).  (Bug#6258)
+
+2010-05-25  Christian Lynbech  <christian.lynbech@tieto.com>  (tiny change)
+
+       * net/tramp.el (tramp-handle-insert-directory): Don't use
+       `forward-word', its default syntax could be changed.
+
+2010-05-25  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/tramp.el (tramp-progress-reporter-update): New defun.
+       (with-progress-reporter): Use it.
+       (tramp-process-actions):
+       * net/tramp-gvfs.el (tramp-gvfs-handler-askquestion): Preserve
+       current message, in order to let progress reporter continue
+       afterwards.  (Bug#6257)
+
+2010-05-25  Glenn Morris  <rgm@gnu.org>
+
+       * net/rcirc.el (rcirc-default-user-name, rcirc-default-full-name):
+       Add :version.
+
+2010-05-25  Ryan Yeske  <rcyeske@gmail.com>
+
+       * net/rcirc.el (rcirc-default-user-name): Change to "user".
+       (rcirc-default-full-name): Change to "unknown".
+       (rcirc-user-name-history): Add variable.
+
+2010-05-25  Ryan Yeske  <rcyeske@gmail.com>
+            Jonathan Rockway  <jon@jrock.us>
+
+       * net/rcirc.el (rcirc-server-alist): Add :pass.
+       (rcirc): When prompting for connection parameters, also prompt for
+       username and password.
+       (rcirc-connect): Take a PASS argument.  If PASS is non-nil, send
+       value to server when connecting.
+
+2010-05-25  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/smie.el (smie-set-prec2tab): Check override before use.
+       (smie-merge-prec2s): Pass the tables as separate args.
+       (smie-bnf-precedence-table): Adjust call accordingly.
+       (smie-prec2-levels): Set levels at the end.
+
+       Replace Lisp calls to delete-backward-char by delete-char.
+       * bs.el, expand.el, ido.el, image-dired.el, lpr.el, pcomplete.el,
+       * skeleton.el, term.el, time.el, wid-edit.el, woman.el,
+       * calc/calc-graph.el, calc/calc-help.el, calc/calc-incom.el,
+       * calc/calc.el, emacs-cl-extra.el, emacs-cl-loaddefs.el,
+       * emulation/cua-rect.el, emulation/viper-ex.el, eshell/esh-test.el,
+       * eshell/eshell.el, gnus/gnus-uu.el, gnus/nndoc.el, gnus/nnrss.el,
+       * gnus/rfc2047.el, gnus/utf7.el, international/utf-7.el,
+       * language/ethio-util.el, mh-e/mh-alias.el, mh-e/mh-search.el,
+       * net/imap.el, net/rcirc.el, obsolete/complete.el, play/decipher.el,
+       * progmodes/ada-mode.el, progmodes/cc-awk.el, progmodes/dcl-mode.el,
+       * progmodes/ps-mode.el, progmodes/verilog-mode.el,
+       * progmodes/vhdl-mode.el, textmodes/bibtex.el, textmodes/fill.el,
+       * textmodes/reftex-auc.el, textmodes/rst.el, textmodes/sgml-mode.el,
+       * textmodes/table.el, textmodes/texinfmt.el: Replace Lisp calls to
+       delete-backward-char by calls to delete-char.
+
+2010-05-25  Kenichi Handa  <handa@m17n.org>
+
+       * language/hebrew.el (hebrew-shape-gstring): New function.
+       Register it in composition-function-table for all Hebrew combining
+       characters.
+
+2010-05-25  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * epa.el (epa--select-keys): Don't explicitly delete the window since
+       that can fail (e.g. sole window in frame).  Use dedication instead.
+
+2010-05-24  Uday S Reddy  <u.s.reddy@cs.bham.ac.uk>  (tiny change)
+
+       * textmodes/fill.el (fill-region): Don't fill past the end (bug#6201).
+
+2010-05-22  Chong Yidong  <cyd@stupidchicken.com>
+
+       * image.el (image-refresh): Define as an alias for image-flush.
+
+       * image-mode.el (image-toggle-display-image): Caller changed.
+
+2010-05-21  Juri Linkov  <juri@jurta.org>
+
+       * progmodes/grep.el (grep-read-files): Fix multi-pattern aliases.
+       Remove "all" from grep-files-aliases.  Split grep-files-aliases by
+       whitespace, call wildcard-to-regexp on substrings and concat them
+       with "\\|".  (Bug#6114)
+
+2010-05-21  Alan Mackenzie  <acm@muc.de>
+
+       * progmodes/cc-engine.el (c-parse-state-get-strategy):
+       Replace parameter `here' with `here-' and `here-plus', which sandwich
+       any pertinent CPP construct.
+       (c-remove-stale-state-cache-backwards): Fix a bug which happens
+       when doing (c-parse-state) in a CPP construct: Exclude any "new"
+       CPP construct from taking part in the scanning.
+
+2010-05-21  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/tramp.el (tramp-do-copy-or-rename-file)
+       (tramp-handle-file-local-copy, tramp-maybe-open-connection):
+       Tune `with-progress-reporter' messages.
+       (tramp-handle-vc-registered):
+       * net/tramp-fish.el (tramp-fish-handle-file-local-copy)
+       (tramp-fish-handle-insert-file-contents)
+       (tramp-fish-maybe-open-connection):
+       * net/tramp-gvfs.el (tramp-gvfs-maybe-open-connection):
+       * net/tramp-imap.el (tramp-imap-do-copy-or-rename-file)
+       (tramp-imap-handle-insert-file-contents)
+       (tramp-imap-handle-file-local-copy): Use `with-progress-reporter'.
+
+2010-05-21  Juanma Barranquero  <lekktu@gmail.com>
+
+       * add-log.el (change-log-font-lock-keywords):
+       Highlight all authors in multi-author entries.
+
+       * smerge-mode.el (smerge-refine-ignore-whitespace)
+       (smerge-refine-weight-hack, smerge-refine, smerge-makeup-conflict):
+       Fix typos in docstrings.
+       (smerge-resolve, smerge-refine-subst): Reflow docstrings.
+
+2010-05-21  Glenn Morris  <rgm@gnu.org>
+
+       * progmodes/fortran.el (fortran-mode):
+       * progmodes/f90.el (f90-mode): Derive from prog-mode.
+
+       * loadup.el [CANNOT_DUMP]: Update for bootstrap-emacs no longer
+       having a relative path in src/Makefile.in.
+
+2010-05-20  Kevin Ryde  <user42@zip.com.au>
+
+       * help-mode.el (help-make-xrefs): For Info node links turn
+       newlines into spaces.  Link node names with newlines are matched
+       by help-xref-info-regexp and buttonized, this change ensures they
+       can be followed successfully with RET.  (Bug#6206)
+
+2010-05-20  Juri Linkov  <juri@jurta.org>
+
+       * locate.el (locate): Use pop-to-buffer instead of
+       switch-to-buffer-other-window.  (Bug#6204)
+
+2010-05-20  Juri Linkov  <juri@jurta.org>
+
+       * replace.el (replace-highlight): Fix lazy-highlighting
+       for `M-s w str M-% str RET'.
+
+2009-12-15  Masatake YAMATO  <yamato@redhat.com>
+
+       * isearch.el (isearch-yank-word-or-char): Pull next subword
+       when `subword-mode' is activated.  (Bug#6220)
+
+2010-05-20  Mark A. Hershberger  <mah@everybody.org>
+
+       * isearch.el (isearch-update-post-hook): New hook.
+       (isearch-update): Use the new hook.  (Bug#6225)
+
+2010-05-20  Juri Linkov  <juri@jurta.org>
+
+       * isearch.el (isearch-mode-map): Bind more keys to isearch-help-map:
+       [f1], [help], and (char-to-string help-char) instead of "\C-h".
+       (Bug#6222)
+
+2010-05-20  Juri Linkov  <juri@jurta.org>
+
+       * isearch.el (isearch-yank-string): Use isearch-process-search-string.
+       (Bug#6223)
+
+2010-05-20  Juri Linkov  <juri@jurta.org>
+
+       * dired-x.el (dired-jump, dired-jump-other-window): Add arg
+       FILE-NAME to read from the minibuffer when called interactively
+       with prefix argument instead of using buffer-file-name.
+       http://lists.gnu.org/archive/html/emacs-devel/2010-05/msg00534.html
+
+       * dired.el: Update autoloads.
+
+2010-05-20  Chong Yidong  <cyd@stupidchicken.com>
+
+       * nxml/nxml-mode.el (nxml-mode-map): Bind C-c / to
+       nxml-finish-element, for consistency with SGML mode.
+
+       * progmodes/octave-mod.el (octave-mode-map): Bind C-c / to
+       octave-close-block.
+
+2010-05-20  Juanma Barranquero  <lekktu@gmail.com>
+
+       * composite.el: Require cl when compiling.
+       (reference-point-alist, compose-gstring-for-graphic)
+       (compose-gstring-for-terminal): Fix typos in docstrings.
+
+2010-05-19  Juri Linkov  <juri@jurta.org>
+
+       * emacs-lisp/cl-macs.el (window-parameter): Add defsetf with
+       set-window-parameter.
+
+2010-05-19  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/tramp.el (tramp-methods): Add `tramp-async-args' attribute
+       where appropriate.
+       (tramp-maybe-open-connection): Use it.
+
+2010-05-19  Eli Zaretskii  <eliz@gnu.org>
+
+       * simple.el (move-end-of-line): Make sure we are at line beginning
+       before backing up to end of previous line.
+
+2010-05-19  Michael Albinus  <michael.albinus@gmx.de>
+
+       * password-cache.el (password-cache-remove): Fix docstring.
+
+       * net/secrets.el: Autoload the widget functions.
+       (secrets-search-items, secrets-create-item)
+       (secrets-get-attributes, secrets-expand-item): Attributes will be
+       stored on the password database without leading ":", as all other
+       clients do as well.
+       (secrets-mode): Fix docstring.
+       (secrets-show-secrets): Provide it as autoloaded command only when
+       D-Bus support is available.  Check existence of Secret Service API.
+
+2010-05-19  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * indent.el (indent-region): Deactivate region (bug#6200).
+
+2010-05-19  Glenn Morris  <rgm@gnu.org>
+
+       * vc-dir.el (vc-dir): Don't pop-up-windows.  (Bug#6204)
+
+2010-05-19  Kenichi Handa  <handa@m17n.org>
+
+       * composite.el: Register compose-gstring-for-graphic in
+       composition-function-table only for combining characters (Mn, Mc, Me).
+
+2010-05-18  Jay Belanger  <jay.p.belanger@gmail.com>
+
+       * calc/calc-trail.el (calc-trail-isearch-forward)
+       (calc-trail-isearch-backward): Ensure that the new window
+       point is set correctly.
+
+2010-05-18  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * subr.el (read-quoted-char): Resolve modifiers after key
+       remapping (bug#6212).
+
+2010-05-18  Michael Albinus  <michael.albinus@gmx.de>
+
+       Add visualization code for secrets.
+       * net/secrets.el (secrets-mode): New major mode.
+       (secrets-show-secrets, secrets-show-collections)
+       (secrets-expand-collection, secrets-expand-item)
+       (secrets-tree-widget-after-toggle-function)
+       (secrets-tree-widget-show-password): New defuns.
+
+2010-05-18  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/smie.el (smie-next-sexp): Break inf-loop at BOB.
+       (smie-backward-sexp, smie-forward-sexp): Remove boundary condition now
+       handled in smie-next-sexp.
+       (smie-indent-calculate): Provide a starting indentation (so the
+       recursion is well-founded ;-).
+
+       Fix handling of non-associative equal levels.
+       * emacs-lisp/smie.el (smie-prec2-levels): Choose distinct levels even
+       when it's not needed.
+       (smie-op-left, smie-op-right): New functions.
+       (smie-next-sexp): New function, extracted from smie-backward-sexp.
+       Better handle equal levels to distinguish the associative case from
+       the "multi-keyword construct" case.
+       (smie-backward-sexp, smie-forward-sexp): Use it.
+
+2010-05-18  Juanma Barranquero  <lekktu@gmail.com>
+
+       * progmodes/prolog.el (smie-indent-basic): Declare for byte-compiler.
+
+       * emacs-lisp/smie.el (smie-precs-precedence-table, smie-backward-sexp)
+       (smie-forward-sexp, smie-indent-calculate): Fix typos in docstrings.
+
+2010-05-17  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       Provide a simple generic indentation engine and use it for Prolog.
+       * emacs-lisp/smie.el: New file.
+       * progmodes/prolog.el (prolog-smie-op-levels)
+       (prolog-smie-indent-rules): New var.
+       (prolog-mode-variables): Use them to configure SMIE.
+       (prolog-indent-line, prolog-indent-level): Remove.
+
+2010-05-17  Jay Belanger  <jay.p.belanger@gmail.com>
+
+       * calc/calc-vec.el (math-vector-avg): Put the vector elements in
+       order before computing the averages.
+
+2010-05-16  Jay Belanger  <jay.p.belanger@gmail.com>
+
+       * calc/calc-vec.el (calc-histogram):
+       (calcFunc-histogram): Allow vectors as inputs.
+       (math-vector-avg): New function.
+
+       * calc/calc-ext.el (math-group-float): Have the number of digits
+       being grouped depend on the radix (Bug#6189).
+
+2010-05-15  Ken Raeburn  <raeburn@raeburn.org>
+
+       * version.el (emacs-copyright, emacs-version): Don't define here,
+       now that emacs.c defines it.
+
+2010-05-15  Eli Zaretskii  <eliz@gnu.org>
+
+       * international/mule-cmds.el (mule-menu-keymap): Fix definition of
+       "Describe Language Environment" menu item.
+
+       * language/hebrew.el ("Hebrew", "Windows-1255"): Doc fix.
+
+       Bidi-sensitive movement with arrow keys.
+       * subr.el (right-arrow-command, left-arrow-command): New functions.
+
+       * bindings.el (global-map): Bind them to right and left arrow keys.
+
+       Don't override standard definition of convert-standard-filename.
+       * files.el (convert-standard-filename): Call
+       w32-convert-standard-filename and dos-convert-standard-filename on
+       the corresponding systems.
+
+       * w32-fns.el (w32-convert-standard-filename): Rename from
+       convert-standard-filename.  Doc fix.
+
+       * dos-fns.el (dos-convert-standard-filename): Doc fix.
+       (convert-standard-filename): Don't defalias.
+       (register-name-alist, make-register, register-value)
+       (set-register-value, intdos): Obsolete aliases for the
+       corresponding dos-* functions and variables.
+       (dos-intdos): Add a doc string.
+
+2010-05-15  Jay Belanger  <jay.p.belanger@gmail.com>
+
+       * calc/calc-aent.el (math-read-token, math-find-user-tokens):
+       * calc/calc-lang.el (math-read-big-rec, math-lang-read-symbol):
+       (math-compose-tex-func):
+       * calc/calccomp.el (math-compose-expr):
+       * calc/calc-ext.el (math-format-flat-expr-fancy):
+       * calc/calc-store.el (calc-read-var-name):
+       * calc/calc-units.el (calc-explain-units-rec): Allow Greek letters.
+
+       * calc/calc.el (var-π, var-φ, var-γ): New variables.
+       * calc/calc-aent.el (math-read-replacement-list): Add "micro" symbol.
+       * calc/calc-units.el (math-unit-prefixes): Add mu for micro.
+       (math-standard-units): Add units.
+
+2010-05-15  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * progmodes/asm-mode.el (asm-mode):
+       * progmodes/prolog.el (prolog-mode): Use define-derived-mode.
+
+       * pcomplete.el (pcomplete-completions-at-point): New function,
+       extracted from pcomplete-std-complete.
+       (pcomplete-std-complete): Use it.
+
+2010-05-15  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (setwins, setwins_almost, setwins_for_subdirs):
+       Remove references to CVS, RCS and Old directories.
+
+2010-05-14  Jay Belanger  <jay.p.belanger@gmail.com>
+
+       * calc/calc-bin.el (math-format-twos-complement): Group digits when
+       appropriate.
+
+2010-05-14  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * progmodes/sh-script.el (sh-mode-default-syntax-table): Remove.
+       (sh-mode-syntax-table): Give it a default value instead.
+       (sh-header-marker): Make buffer-local.
+       (sh-mode): Move make-local-variable to the corresponding setq.
+       (sh-add-completer): Avoid gratuitously let-binding a buffer-local var.
+       Use complete-with-action.
+
+       * simple.el (prog-mode): New (abstract) major mode.
+       * emacs-lisp/lisp-mode.el (emacs-lisp-mode, lisp-mode): Use it.
+       * progmodes/sh-script.el (sh-mode): Remove redundant var assignment.
+
+2010-05-14  Juanma Barranquero  <lekktu@gmail.com>
+
+       * progmodes/sql.el (sql-oracle-program): Reflow docstring.
+       (sql-oracle-scan-on, sql-sybase-program, sql-product-font-lock)
+       (sql-add-product-keywords, sql-highlight-product, sql-set-product)
+       (sql-make-alternate-buffer-name, sql-placeholders-filter)
+       (sql-escape-newlines-filter, sql-input-sender)
+       (sql-send-magic-terminator, sql-sybase): Fix typos in docstrings.
+
+2010-05-13  Chong Yidong  <cyd@stupidchicken.com>
+
+       Add TeX open-block and close-block keybindings to SGML, and vice versa.
+
+       * textmodes/tex-mode.el (tex-mode-map): Bind C-c C-t to
+       latex-open-block and C-c / to latex-close-block.
+
+       * textmodes/sgml-mode.el (sgml-mode-map): Bind C-c C-o to sgml-tag
+       and C-c C-e to sgml-close-tag.
+
+2010-05-13  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/tramp.el (with-progress-reporter): Create reporter object
+       only when the message would be displayed.  Handle nested calls.
+       (tramp-handle-load, tramp-handle-file-local-copy)
+       (tramp-handle-insert-file-contents, tramp-handle-write-region)
+       (tramp-maybe-send-script, tramp-find-shell):
+       Use `with-progress-reporter'.
+       (tramp-handle-dired-compress-file, tramp-maybe-open-connection):
+       Fix message text.
+
+       * net/tramp-smb.el (tramp-smb-handle-copy-file)
+       (tramp-smb-handle-file-local-copy, tramp-smb-handle-rename-file)
+       (tramp-smb-handle-write-region, tramp-smb-maybe-open-connection):
+       Use `with-progress-reporter'.
+
+2010-05-13  Agustín Martín  <agustin.martin@hispalinux.es>
+
+       * textmodes/ispell.el (ispell-init-process): Do not kill ispell
+       process everytime when spellchecking from the minibuffer (bug#6143).
+
+2010-05-13  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * progmodes/sh-script.el (sh-mode): Use define-derived-mode.
+
+       * dos-fns.el: Add "dos-" prefix for namespace control.
+       (convert-standard-filename): Define as alias for
+       dos-convert-standard-filename but only if applicable.
+
+2010-05-12  Alan Mackenzie  <acm@muc.de>
+
+       * progmodes/cc-cmds.el (c-beginning-of-defun, c-end-of-defun):
+       Push the mark at the start of these functions when appropriate.
+
+2010-05-12  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * minibuffer.el (completion-cycle-threshold): New custom var.
+       (completion--do-completion): Use it.
+       (minibuffer-complete): Use cycling if appropriate.
+
+2010-05-11  Juanma Barranquero  <lekktu@gmail.com>
+
+       * dirtrack.el (dirtrackp): Remove defcustom; don't make automatically
+       buffer-local (it's an obsolete alias for `dirtrack-mode') (bug#6173).
+
+2010-05-11  Juri Linkov  <juri@jurta.org>
+
+       * scroll-all.el (scroll-all-check-to-scroll):
+       Add `scroll-up-command' and `scroll-down-command' (bug#6164).
+
+2010-05-11  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * iimage.el (iimage-mode-map): Move initialization into declaration.
+       (iimage-mode-buffer): Use with-silent-modifications.
+       Simplify calling convention.  Adjust callers.
+       (iimage-mode): Don't run hook redundantly.
+
+       * minibuffer.el (completion-pcm--pattern->regex):
+       Fix last change (bug#6160).
+
+2010-05-10  Juri Linkov  <juri@jurta.org>
+
+       Remove nodes visited during Isearch from the Info history.
+       * info.el (Info-isearch-initial-history)
+       (Info-isearch-initial-history-list): New variables.
+       (Info-isearch-start): Record initial values of
+       Info-isearch-initial-history and Info-isearch-initial-history-list.
+       Add Info-isearch-end to isearch-mode-end-hook.
+       (Info-isearch-end): New function.
+
+2010-05-10  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/tramp.el (tramp-do-file-attributes-with-stat): Add space in
+       format string, in order to work around a bug in pdksh.
+       Reported by Gilles Pion <gpion@lfdj.com>.
+       (tramp-handle-verify-visited-file-modtime): Do not send a command
+       when the connection is not established.
+       (tramp-handle-set-file-times): Simplify the check for utc.
+
+2010-05-10  Juanma Barranquero  <lekktu@gmail.com>
+
+       Fix use of `filter-buffer-substring' (rework previous change).
+       * emulation/cua-base.el (cua--filter-buffer-noprops): New function.
+       (cua-repeat-replace-region):
+       * emulation/cua-rect.el (cua--extract-rectangle, cua-incr-rectangle):
+       * emulation/cua-gmrk.el (cua-copy-region-to-global-mark)
+       (cua-cut-region-to-global-mark): Use it.
+
+2010-05-09  Michael R. Mauger  <mmaug@yahoo.com>
+
+       * progmodes/sql.el: Version 2.1.
+       (sql-product-alist): Redesign structure of product info.
+       (sql-product, sql-user, sql-server, sql-database): Safe variables.
+       (sql-port, sql-port-history): New variables.
+       (sql-interactive-product): New variable.
+       (sql-send-terminator): New variable.
+       (sql-imenu-generic-expression): Add "Types" imenu entry.
+       (sql-oracle-login-params, sql-sqlite-login-params)
+       (sql-mysql-login-params, sql-solid-login-params)
+       (sql-sybase-login-params, sql-informix-login-params)
+       (sql-ingres-login-params, sql-ms-login-params)
+       (sql-postgres-login-params, sql-interbase-login-params)
+       (sql-db2-login-params, sql-linter-login-params)
+       (sql-oracle-scan-on): New variables.
+       (sql-mode-map): Add C-c C-i to start interactive mode.
+       (sql-mode-menu): Update existing menu entries.
+       (sql-font-lock-keywords-builder): Compile-time font-lock optimization.
+       (sql-mode-oracle-font-lock-keywords)
+       (sql-mode-postgres-font-lock-keywords)
+       (sql-mode-ms-font-lock-keywords)
+       (sql-mode-sybase-font-lock-keywords)
+       (sql-mode-informix-font-lock-keywords)
+       (sql-mode-interbase-font-lock-keywords)
+       (sql-mode-ingres-font-lock-keywords)
+       (sql-mode-solid-font-lock-keywords)
+       (sql-mode-mysql-font-lock-keywords)
+       (sql-mode-sqlite-font-lock-keywords)
+       (sql-mode-db2-font-lock-keywords)
+       (sql-mode-linter-font-lock-keywords): Update initialization to
+       reduce run-time complexity.
+       (sql-add-product, sql-del-product): New functions.
+       (sql-set-product-feature, sql-get-product-feature): New functions.
+       (sql-product-font-lock): Update product API.
+       (sql-add-product-keywords): New function.
+       (sql-highlight-product): Update product API.
+       (sql-help-list-products): New function.
+       (sql-help): Dynamically lists free and non-free products.
+       (sql-get-login): Correct bug in handling history and added
+       prompt for port.
+       (sql-copy-column): Copy without properties.
+       (sqli-input-sender): Apply filters to SQLi input.
+       (sql-query-placeholders-and-send): Obey `sql-oracle-scan-on' setting.
+       Implement as a filter.
+       (sql-escape-newlines-filter): Implement as a filter.
+       (sql-remove-tabs-filter): New function.
+       (sql-send-magic-terminator): New function.
+       (sql-send-string): Implement magic terminator.
+       (sql-send-region): Use `sql-send-string'.
+       (sql-interactive-mode): Use product API.
+       (sql-product-interactive): Use product API.
+       (sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
+       (sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
+       (sql-db2, sql-linter): Use `sql-product-interactive'.
+       (sql-connect): New function.
+       (sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
+       (sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
+       (sql-connect-ingres, sql-connect-ms, sql-connect-postgres)
+       (sql-connect-interbase, sql-connect-db2, sql-connect-linter):
+       Use `sql-connect'.
+
+2010-05-09  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * minibuffer.el (completion-pcm-complete-word-inserts-delimiters):
+       New custom variable.
+       (completion-pcm--string->pattern): Use it.
+       (completion-pcm--pattern->regex, completion-pcm--pattern->string):
+       Make it handle any symbol as `any'.
+       (completion-pcm--merge-completions): Extract common suffix for the new
+       `prefix' symbol as well.
+       (completion-substring--all-completions): Use the new `prefix' symbol.
+
+2010-05-09  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
+       not bound.
+       (tramp-compat-copy-file): Add PRESERVE-SELINUX-CONTEXT.
+       (tramp-compat-funcall): New defmacro.
+       (tramp-compat-line-beginning-position)
+       (tramp-compat-line-end-position)
+       (tramp-compat-temporary-file-directory)
+       (tramp-compat-make-temp-file, tramp-compat-file-attributes)
+       (tramp-compat-copy-file, tramp-compat-copy-directory)
+       (tramp-compat-delete-file, tramp-compat-delete-directory)
+       (tramp-compat-number-sequence, tramp-compat-process-running-p)
+       * net/tramp.el (top, with-progress-reporter)
+       (tramp-rfn-eshadow-setup-minibuffer)
+       (tramp-rfn-eshadow-update-overlay, tramp-handle-set-file-times)
+       (tramp-handle-dired-compress-file, tramp-handle-shell-command)
+       (tramp-completion-mode-p, tramp-check-for-regexp)
+       (tramp-open-connection-setup-interactive-shell)
+       (tramp-compute-multi-hops, tramp-read-passwd, tramp-clear-passwd)
+       (tramp-time-diff, tramp-coding-system-change-eol-conversion)
+       (tramp-set-process-query-on-exit-flag, tramp-unload-tramp)
+       * net/tramp-cmds.el (tramp-cleanup-all-connections)
+       (tramp-reporter-dump-variable, tramp-load-report-modules)
+       (tramp-append-tramp-buffers)
+       * net/tramp-gvfs.el (tramp-gvfs-handle-file-selinux-context): Use it.
+
+       * net/tramp-imap.el (top): Autoload `epg-make-context'.
+
+2010-05-08  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * progmodes/compile.el (compilation-buffer-modtime): Rename from
+       buffer-modtime.  Adjust users.
+
+2010-05-08  Chong Yidong  <cyd@stupidchicken.com>
+
+       * international/mule.el (auto-coding-alist): Only purecopy
+       car of each item, not the whole list (Bug#6083).
+
+2010-05-08  Chong Yidong  <cyd@stupidchicken.com>
+
+       * progmodes/js.el (js-mode): Make paragraph variables local before
+       calling c-setup-paragraph-variables (Bug#6071).
+
+2010-05-08  Eli Zaretskii  <eliz@gnu.org>
+
+       * composite.el (compose-region, reference-point-alist): Fix typos
+       in the doc strings.
+
+2010-05-08  Alexander Klimov  <alserkli@inbox.ru>  (tiny change)
+
+       * calc/calc-graph.el (calc-graph-plot): Use the proper form for
+       gnuplot's "set" command.
+
+2010-05-08  Juanma Barranquero  <lekktu@gmail.com>
+
+       * abbrev.el (last-abbrev-text): Doc fix.
+       (abbrev-prefix-mark): Don't escape parenthesis.
+
+2010-05-08  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * composite.el (find-composition): Doc fix.
+
+2010-05-08  Juanma Barranquero  <lekktu@gmail.com>
+
+       * progmodes/sql.el (sql-electric-stuff): Fix typo in tag.
+       (sql-oracle-program, sql-sqlite-options)
+       (sql-query-placeholders-and-send): Doc fixes.
+       (sql-set-product, sql-interactive-mode): Reflow docstrings.
+       (sql-imenu-generic-expression, sql-buffer)
+       (sql-mode-ansi-font-lock-keywords, sql-mode-oracle-font-lock-keywords)
+       (sql-mode-postgres-font-lock-keywords, sql-mode-ms-font-lock-keywords)
+       (sql-mode-sybase-font-lock-keywords)
+       (sql-mode-informix-font-lock-keywords)
+       (sql-mode-interbase-font-lock-keywords)
+       (sql-mode-ingres-font-lock-keywords, sql-mode-solid-font-lock-keywords)
+       (sql-mode-mysql-font-lock-keywords, sql-mode-sqlite-font-lock-keywords)
+       (sql-mode-db2-font-lock-keywords, sql-mode-font-lock-keywords)
+       (sql-product-feature, sql-highlight-product)
+       (comint-line-beginning-position, sql-rename-buffer)
+       (sql-toggle-pop-to-buffer-after-send-region sql-oracle)
+       (sql-sybase, sql-informix, sql-sqlite, sql-mysql, sql-solid)
+       (sql-ingres, sql-ms, sql-postgres, sql-interbase, sql-db2, sql-linter):
+       Fix typos in docstrings.
+
+2010-05-08  Juri Linkov  <juri@jurta.org>
+
+       * info.el (Info-fontify-node): Put Info-breadcrumbs to the `display'
+       property instead of `invisible' and `after-string' (bug#5998).
+
+2010-05-08  Juri Linkov  <juri@jurta.org>
+
+       * image-mode.el (image-mode-as-text): Fix typo in docstring.
+
+2010-05-08  Juanma Barranquero  <lekktu@gmail.com>
+
+       * filecache.el (file-cache-add-directory-list)
+       (file-cache-add-directory-recursively): Fix typos in docstrings.
+
+2010-05-08  Kenichi Handa  <handa@m17n.org>
+
+       * language/indian.el (gurmukhi-composable-pattern): Fix typo.
+       (gujarati-composable-pattern): Fix typo.
+
+2010-05-08  Kenichi Handa  <handa@m17n.org>
+
+       * language/indian.el (oriya-composable-pattern)
+       (tamil-composable-pattern, malayalam-composable-pattern):
+       Add two-part vowels to "v" (vowel sign).
+
+2010-05-08  Chong Yidong  <cyd@stupidchicken.com>
+
+       * files.el (copy-directory): Handle symlinks (Bug#5982).
+
+2010-05-08  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * vc-hg.el (vc-hg-state): Use HGRCPATH, not HGRC.
+       (vc-hg-working-revision): Likewise.  Use hg parents, not hg parent
+       (Bug#5846).
+
+2010-05-08  Glenn Morris  <rgm@gnu.org>
+
+       * emacs-lisp/lisp.el (lisp-completion-at-point): Give it a doc string.
+
+       * minibuffer.el (completion-at-point): Doc fix.
+
+2010-05-08  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * electric.el (Electric-command-loop): Minor tweak.
+
+       * ebuff-menu.el (electric-buffer-list): Try and make it behave a bit
+       better with dedicated windows.
+
+2010-05-07  Chong Yidong  <cyd@stupidchicken.com>
+
+       * Version 23.2 released.
+
+2010-05-07  Deniz Dogan  <deniz.a.m.dogan@gmail.com>  (tiny change)
+            Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       Highlight vendor specific properties.
+       * textmodes/css-mode.el (css-proprietary-nmstart-re): New var.
+       (css-proprietary-property): New face.
+       (css-font-lock-keywords): Use them.
+
+2010-05-07  Eli Zaretskii  <eliz@gnu.org>
+
+       * cus-start.el (all): Add native condition for tool-bar-* symbols.
+
+2010-05-07  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * textmodes/dns-mode.el (auto-mode-alist): Add entry for .zone files.
+       * files.el (auto-mode-alist): Remove redundant entries.
+
+       * files.el (auto-save-mode): Move to simple.el to fix bootstrap.
+       * simple.el (auto-save-mode): Move from files.el.
+       * minibuffer.el (completion--common-suffix): Fix copy&paste error.
+
+2010-05-07  Christian von Roques  <roques@mti.ag>  (tiny change)
+
+       * lisp/epg.el (epg-key-capablity-alist): Add "D" flag (Bug#5592).
+
+2010-05-07  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * mail/binhex.el (binhex-decode-region-internal)
+       * mail/uudecode.el (uudecode-decode-region-internal)
+       * net/dns.el (dns-read-string-name, dns-write, dns-read)
+       (dns-read-type, dns-query)
+       * pgg-parse.el (pgg-parse-armor)
+       * pgg.el (pgg-verify-region)
+       * sha1.el (sha1-string-external): Don't run set-buffer-multibyte for
+       XEmacs.
+
+       * net/imap.el (imap-disable-multibyte): Redefine it as a macro.
+
+2010-05-07  Juanma Barranquero  <lekktu@gmail.com>
+
+       * progmodes/cperl-mode.el (cperl-mode-unload-function): New function.
+
+       Fix use of `filter-buffer-substring' (4th arg NOPROPS removed).
+       * emulation/cua-base.el (cua-repeat-replace-region):
+       * emulation/cua-gmrk.el (cua-copy-region-to-global-mark)
+       (cua-cut-region-to-global-mark):
+       Remove text properties with `set-text-properties'.
+
+2010-05-06  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/tramp.el (top, with-progress-reporter):
+       Use `symbol-function' inside `funcall'.
+
+       * net/tramp-compat.el (tramp-compat-file-attributes)
+       (tramp-compat-delete-file, tramp-compat-delete-directory):
+       Handle only `wrong-number-of-arguments' error.
+
+       * net/tramp-gvfs.el (tramp-gvfs-handle-copy-file): Fix typo.
+       (tramp-gvfs-handle-file-selinux-context): Use `symbol-function'
+       inside `funcall'.
+
+2010-05-06  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * minibuffer.el (completion--sreverse, completion--common-suffix):
+       New functions.
+       (completion-pcm--merge-completions): Extract common suffix when safe.
+
+       * emacs-lisp/easy-mmode.el (define-minor-mode):
+       Make :variable more flexible.
+       * files.el (auto-save-mode): Use it to define using define-minor-mode.
+
+2010-05-05  Juri Linkov  <juri@jurta.org>
+
+       Add `slow' and `history' tags to the desktop data.
+
+       * info.el (Info-virtual-nodes) [*Index*]: Add `slow' tag.
+       (Info-virtual-files) [*Apropos*]: Add `slow' tag.
+       (Info-finder-find-node): Require `finder.el' to be able
+       to restore node from the desktop.
+       (Info-desktop-buffer-misc-data): Save all nodes.  Save additional
+       data `Info-history' and `slow' tag in the assoc list.
+       (Info-restore-desktop-buffer): Don't restore nodes with the
+       `slow' tag.  Restore `Info-history'.
+
+2010-05-05  Michael Albinus  <michael.albinus@gmx.de>
+
+       Add FORCE argument to `delete-file'.
+
+       * net/ange-ftp.el (ange-ftp-del-tmp-name): Make it a defun,
+       forcing to delete the temporary file.
+       (ange-ftp-delete-file): Add FORCE arg.
+       (ange-ftp-rename-remote-to-remote)
+       (ange-ftp-rename-local-to-remote, ange-ftp-rename-remote-to-local)
+       (ange-ftp-load, ange-ftp-compress, ange-ftp-uncompress):
+       Force file deletion.
+
+       * net/tramp-compat.el (tramp-compat-delete-file): New defun.
+
+       * net/tramp.el (tramp-handle-delete-file): Add FORCE arg.
+       (tramp-handle-make-symbolic-link, tramp-handle-load)
+       (tramp-do-copy-or-rename-file-via-buffer)
+       (tramp-do-copy-or-rename-file-directly)
+       (tramp-do-copy-or-rename-file-out-of-band)
+       (tramp-handle-process-file, tramp-handle-call-process-region)
+       (tramp-handle-shell-command, tramp-handle-file-local-copy)
+       (tramp-handle-insert-file-contents, tramp-handle-write-region)
+       (tramp-delete-temp-file-function): Use `tramp-compat-delete-file'.
+
+       * net/tramp-fish.el (tramp-fish-handle-delete-file): Add FORCE arg.
+       (tramp-fish-handle-make-symbolic-link)
+       (tramp-fish-handle-process-file): Use `tramp-compat-delete-file'.
+
+       * net/tramp-ftp.el (tramp-ftp-file-name-handler):
+       Use `tramp-compat-delete-file'.
+
+       * net/tramp-gvfs.el (tramp-gvfs-handle-delete-file): Add FORCE arg.
+       (tramp-gvfs-handle-write-region): Use `tramp-compat-delete-file'.
+
+       * net/tramp-imap.el (tramp-imap-handle-delete-file): Add FORCE arg.
+       (tramp-imap-do-copy-or-rename-file): Use `tramp-compat-delete-file'.
+
+       * net/tramp-smb.el (tramp-smb-handle-delete-file): Add FORCE arg.
+       (tramp-smb-handle-copy-file, tramp-smb-handle-file-local-copy)
+       (tramp-smb-handle-rename-file, tramp-smb-handle-write-region): Use
+       `tramp-compat-delete-file'.
+
+2010-05-05  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       Minor cleanups.
+       * subr.el (add-minor-mode): Use push.
+       * mail/supercite.el (sc-electric-mode): Use more descriptive arg name.
+       * emulation/edt.el (edt-select-mode): Simplify.
+
+       Use define-minor-mode in more cases.
+       * term/tvi970.el (tvi970-set-keypad-mode):
+       * simple.el (auto-fill-mode, overwrite-mode, binary-overwrite-mode)
+       (normal-erase-is-backspace-mode):
+       * scroll-bar.el (scroll-bar-mode): Use it and define-minor-mode.
+       (set-scroll-bar-mode-1): (Re)move to its sole caller.
+       (get-scroll-bar-mode): New function.
+       * emacs-lisp/cl-macs.el (eq): Handle a non-variable first arg.
+
+       Use define-minor-mode for less obvious cases.
+       * emacs-lisp/easy-mmode.el (define-minor-mode): Add :variable keyword.
+       * emacs-lisp/cl-macs.el (terminal-parameter, eq): Add setf method.
+       * international/iso-ascii.el (iso-ascii-mode):
+       * frame.el (auto-raise-mode, auto-lower-mode):
+       * composite.el (global-auto-composition-mode): Use define-minor-mode.
+
+2010-05-04  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/tramp.el (tramp-methods): Remove "-q" from `tramp-login-args'
+       in order to see error messages for failed logins.
+
+2010-05-03  Chong Yidong  <cyd@stupidchicken.com>
+
+       * diff.el (diff-sentinel):
+
+       * epg.el (epg--make-temp-file, epg-decrypt-string)
+       (epg-verify-string, epg-sign-string, epg-encrypt-string):
+
+       * jka-compr.el (jka-compr-partial-uncompress)
+       (jka-compr-call-process, jka-compr-write-region, jka-compr-load):
+
+       * server.el (server-sentinel): Use delete-file's new FORCE arg
+       (Bug#6070).
+
+2010-05-03  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       Use define-minor-mode where applicable.
+       * view.el (view-mode):
+       * type-break.el (type-break-query-mode)
+       (type-break-mode-line-message-mode):
+       * textmodes/reftex.el (reftex-mode):
+       * term/vt100.el (vt100-wide-mode):
+       * tar-mode.el (tar-subfile-mode):
+       * savehist.el (savehist-mode):
+       * ibuf-ext.el (ibuffer-auto-mode):
+       * composite.el (auto-composition-mode):
+       * progmodes/vhdl-mode.el (vhdl-electric-mode, vhdl-stutter-mode):
+       Use define-minor-mode.
+       (vhdl-mode): Use static mode-line format.
+       (vhdl-mode-line-update): Delete.
+       (vhdl-create-mode-menu, vhdl-activate-customizations)
+       (vhdl-hs-minor-mode): Don't bother calling it.
+
+2010-05-02  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * simple.el (with-wrapper-hook): Move.
+       (buffer-substring-filters): Mark obsolete.
+       (filter-buffer-substring-functions): New variable.
+       (filter-buffer-substring): Use it.  Remove unused arg `noprops'.
+
+       Use a mode-line spec rather than a static string in Semantic.
+       * cedet/semantic/util-modes.el:
+       (semantic-minor-modes-format): New var to replace...
+       (semantic-minor-modes-status): Remove.
+       (semantic-mode-line-update): Construct a mode-line spec rather than
+       a static string so that mouse buttons can be used on individual minor
+       modes and so that semantic-mode-line-update only needs to be called
+       when global settings are changed.
+       (semantic-add-minor-mode, semantic-toggle-minor-mode-globally):
+       Call semantic-mode-line-update.
+       (semantic-toggle-minor-mode-globally): Don't assume mode is on
+       minor-mode-alist, check semantic-minor-mode-alist as well.
+       (semantic-stickyfunc-mode, semantic-show-parser-state-auto-marker)
+       (semantic-show-parser-state-marker, semantic-show-parser-state-mode)
+       (semantic-show-unmatched-syntax-mode, semantic-highlight-edits-mode):
+       * cedet/semantic/mru-bookmark.el (semantic-mru-bookmark-mode):
+       * cedet/semantic/idle.el (semantic-idle-scheduler-mode)
+       (define-semantic-idle-service, semantic-idle-summary-mode):
+       * cedet/semantic/decorate/mode.el (semantic-decoration-mode):
+       Don't call semantic-mode-line-update any more.
+
+2010-05-02  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       Use define-minor-mode in CEDET where applicable.
+
+       * cedet/srecode/mode.el (srecode-minor-mode,global-srecode-minor-mode):
+       Use define-minor-mode.
+
+       * cedet/semantic/util-modes.el (semantic-add-minor-mode):
+       Remove unused arg `keymap' and code redundant with define-minor-mode.
+       (semantic-toggle-minor-mode-globally): Only handle arg -1 and 1.
+       (semantic-stickyfunc-mode, global-semantic-show-unmatched-syntax-mode)
+       (semantic-highlight-func-mode, global-semantic-show-parser-state-mode)
+       (global-semantic-highlight-edits-mode, semantic-highlight-edits-mode)
+       (semantic-show-unmatched-syntax-mode, semantic-show-parser-state-mode)
+       (global-semantic-stickyfunc-mode, global-semantic-highlight-func-mode):
+       Use define-minor-mode.
+       (semantic-stickyfunc-mode-setup, semantic-highlight-edits-mode-setup)
+       (semantic-show-unmatched-syntax-mode-setup)
+       (semantic-show-parser-state-mode-setup)
+       (semantic-highlight-func-mode-setup): Inline into sole caller.
+
+       * cedet/semantic/mru-bookmark.el (global-semantic-mru-bookmark-mode)
+       (semantic-mru-bookmark-mode): Use define-minor-mode.
+       (semantic-mru-bookmark-mode-setup): Inline into sole caller.
+
+       * cedet/semantic/idle.el (define-semantic-idle-service):
+       Use define-minor-mode and inline setup function into its sole caller.
+       (semantic-idle-scheduler-mode-setup)
+       (semantic-idle-summary-mode-setup): Inline into sole caller.
+       (global-semantic-idle-scheduler-mode, semantic-idle-scheduler-mode):
+       Use define-minor-mode.
+
+       * cedet/semantic/decorate/mode.el (global-semantic-decoration-mode)
+       (semantic-decoration-mode): Use define-minor-mode.
+       (semantic-decoration-mode-setup): Inline into sole caller.
+
+       * cedet/ede/dired.el (ede-dired-minor-mode): Initialize in declaration.
+       (ede-dired-minor-mode): Use define-minor-mode and derived-mode-p.
+       (ede-dired-add-to-target): Use dolist.
+
+2010-05-01  Toru TSUNEYOSHI  <t_tuneyosi@hotmail.com>
+            Michael Albinus  <michael.albinus@gmx.de>
+
+       Implement compression for inline methods.
+
+       * net/tramp.el (tramp-inline-compress-start-size): New defcustom.
+       (tramp-copy-size-limit): Allow also nil.
+       (tramp-inline-compress-commands): New defconst.
+       (tramp-find-inline-compress, tramp-get-inline-compress)
+       (tramp-get-inline-coding): New defuns.
+       (tramp-get-remote-coding, tramp-get-local-coding): Remove,
+       replaced by `tramp-get-inline-coding'.
+       (tramp-handle-file-local-copy, tramp-handle-write-region)
+       (tramp-method-out-of-band-p): Use `tramp-get-inline-coding'.
+
+2010-05-01  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * bindings.el (mode-line-abbrev-mode, mode-line-auto-fill-mode):
+       Remove unused functions.
+
+       * emacs-lisp/lisp-mode.el (lisp-mode): Use define-derived-mode.
+       Set find-tag-default-function as a variable rather than a property.
+
+       * minibuffer.el (tags-completion-at-point-function): Move to etags.el.
+       * progmodes/etags.el (tags-completion-at-point-function):
+       Remove left over interactive spec.  Add autoloading stub.
+       (complete-tag): Use tags-completion-at-point-function.
+
+2010-04-30  Chong Yidong  <cyd@stupidchicken.com>
+
+       * minibuffer.el (tags-completion-at-point-function): Fix return value.
+
+2010-04-29  Chong Yidong  <cyd@stupidchicken.com>
+
+       * ido.el (ido-init-completion-maps): Remove C-v binding.
+       (ido-minibuffer-setup): Don't set cua-inhibit-cua-keys (Bug#5765).
+
+2010-04-29  Chong Yidong  <cyd@stupidchicken.com>
+
+       * minibuffer.el (tags-completion-at-point-function): New function.
+       (completion-at-point-functions): Use it.
+
+       * cedet/semantic.el (semantic-completion-at-point-function):
+       New function.
+       (semantic-mode): Use semantic-completion-at-point-function for
+       completion-at-point-functions instead.
+
+       * progmodes/etags.el (complete-tag): Revert last change.
+
+2010-04-29  Alan Mackenzie  <acm@muc.de>
+
+       * progmodes/cc-mode.el (c-extend-region-for-CPP): Fix an
+       off-by-one error (in end of macro position).
+
+2010-04-29  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * net/browse-url.el (browse-url-firefox-program): Use iceweasel if
+       firefox is absent.  Don't autoload.
+       (browse-url-galeon-program): Don't autoload.
+
+2010-04-28  Chong Yidong  <cyd@stupidchicken.com>
+
+       * bindings.el (complete-symbol): Move into minibuffer.el.
+
+       * minibuffer.el (complete-tag): Move from etags.el.  If tags
+       completion cannot be performed, return nil instead of signalling
+       an error.
+       (completion-at-point): Make it an alias for complete-symbol.
+       (complete-symbol): Move from bindings.el, and replace with the
+       body of completion-at-point.
+
+       * progmodes/etags.el (complete-tag): Move to minibuffer.el.
+
+       * cedet/semantic.el (semantic-mode): When enabled, add
+       semantic-ia-complete-symbol to completion-at-point-functions.
+
+       * cedet/semantic/ia.el (semantic-ia-complete-symbol): Return nil
+       if Semantic is not active.
+
+2010-04-28  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/tramp.el (tramp-remote-selinux-p): New defun.
+       (tramp-handle-file-selinux-context)
+       (tramp-handle-set-file-selinux-context): Use it.
+
+2010-04-28  Sam Steingold  <sds@gnu.org>
+
+       * progmodes/bug-reference.el (bug-reference-url-format): Mark as
+       `safe-local-variable' if the value is a string or a symbol with
+       the property `bug-reference-url-format'.
+
+2010-04-28  Chong Yidong  <cyd@stupidchicken.com>
+
+       * progmodes/bug-reference.el (bug-reference-url-format):
+       Revert 2010-04-27 change due to security risk.
+
+2010-04-28  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       Make it possible to locally disable a globally enabled mode.
+       * simple.el (fundamental-mode): Run fundamental-mode-hook.
+       * emacs-lisp/derived.el (define-derived-mode): Use fundamental-mode
+       rather than kill-all-local-variables so it runs fundamental-mode-hook.
+       * emacs-lisp/easy-mmode.el (define-globalized-minor-mode):
+       Use fundamental-mode-hook to run MODE-enable-in-buffers earlier, so
+       that subsequent hooks get a chance to disable it.
+
+2010-04-27  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/easy-mmode.el (define-globalized-minor-mode):
+       Avoid re-enabling a minor mode after the user turned the minor mode
+       off if MODE-enable-in-buffers is run twice (typically once from
+       fundamental-mode's after-change-major-mode-hook and a second time from
+       run-mode-hook's own after-change-major-mode-hook).
+
+       * emacs-lisp/lisp.el (lisp-complete-symbol): Fail gracefully.
+
+2010-04-27  Sam Steingold  <sds@gnu.org>
+
+       * progmodes/bug-reference.el (bug-reference-url-format): Mark as
+       `safe-local-variable' if the value is a string or a function, as
+       documented and implemented on 2010-04-02.
+
+2010-04-27  Juanma Barranquero  <lekktu@gmail.com>
+
+       * ido.el (ido-buffer-internal): Bind `ido-use-virtual-buffers' to nil
+       when method is 'kill.
+
+2010-04-27  Agustín Martín  <agustin.martin@hispalinux.es>
+
+       * textmodes/ispell.el (ispell-init-process): Fix personal dictionary
+       condition in default directory check.
+       (ispell-init-process,ispell-kill-ispell,kill-buffer-hook):
+       Kill ispell process when killing its associated buffer.
+
+2010-04-27  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * desktop.el (desktop-kill): ask-if-new: Ask if desktop file exists,
+       but we aren't using it.
+
+2010-04-25  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * tool-bar.el (tool-bar-local-item-from-menu): Revert unintended
+       checkin in 2010-04-23T16:26:11Z!monnier@iro.umontreal.ca.
+
+2010-04-24  Glenn Morris  <rgm@gnu.org>
+
+       * emacs-lisp/authors.el (authors-obsolete-files-regexps):
+       Ignore VCS-ignore files, and deleted nextstep preferences files.
+       (authors-ignored-files): Ignore deleted cedet test files, and "*.el".
+       (authors-ambiguous-files): New list.
+       (authors-valid-file-names): Add some deleted files.
+       (authors-renamed-files-alist): Add font-setting.el, edt-user.doc.
+       (authors-disambiguate-file-name): New function.  (Bug#5501)
+       (authors-canonical-file-name): Doc fix.
+       Don't warn about obsolete files.
+       (authors-canonical-file-name, authors-scan-el):
+       Use authors-disambiguate-file-name.
+
+       * hfy-cmap.el (htmlfontify-load-rgb-file, hfy-fallback-colour-values):
+       Add autoload cookies.
+       (htmlfontify-unload-rgb-file, hfy-fallback-colour-values): Add docs.
+       (generated-autoload-file): Set file-local value to "htmlfontify.el".
+       * htmlfontify.el (caddr, cadddr): Remove fallback definitions.
+       They have definitions / compiler macros in cl.el.
+       (htmlfontify-load-rgb-file, hfy-fallback-colour-values):
+       Replace manual autoloads with generated ones.
+       (htmlfontify-unload-rgb-file): Remove autoload.
+       * Makefile.in (autoloads): Ensure htmlfontify.el is writable.
+
+2010-04-23  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/bytecomp.el (byte-compile-set-default): New function.
+       (byte-compile-setq-default): Optimize for the
+       single-var case and don't call byte-compile-form in this case to avoid
+       inf-loop with byte-compile-set-default.
+
+       * progmodes/compile.el (compilation-start): Abbreviate default directory.
+
+2010-04-23  Michael Albinus  <michael.albinus@gmx.de>
+
+       Implement SELINUX backends.
+
+       * net/tramp.el (tramp-file-name-handler-alist):
+       Add `file-selinux-context' and `set-file-selinux-context'.
+       (tramp-handle-file-selinux-context)
+       (tramp-handle-set-file-selinux-context): New defuns.
+       (tramp-handle-copy-file, tramp-do-copy-or-rename-file):
+       Handle PRESERVE-SELINUX-CONTEXT.
+
+       * net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist):
+       Add `file-selinux-context' and `set-file-selinux-context'.
+       (tramp-gvfs-handle-file-selinux-context)
+       (tramp-gvfs-handle-set-file-selinux-context): New defuns.
+       (tramp-gvfs-handle-copy-file): Handle PRESERVE-SELINUX-CONTEXT.
+
+       * net/ange-ftp.el (ange-ftp-copy-file):
+       * net/tramp-fish.el (tramp-fish-handle-copy-file):
+       * net/tramp-imap.el (tramp-imap-handle-copy-file):
+       * net/tramp-smb.el (tramp-smb-handle-copy-file):
+       Add PRESERVE-SELINUX-CONTEXT.
+
+2010-04-22  Michael Albinus  <michael.albinus@gmx.de>
+
+       Synchronize with Tramp repository.
+
+       * net/tramp.el (with-connection-property, tramp-completion-mode-p)
+       (tramp-action-process-alive, tramp-action-out-of-band)
+       (tramp-check-for-regexp, tramp-file-name-p, tramp-equal-remote)
+       (tramp-exists-file-name-handler): Fix docstring.
+       (with-progress-reporter): New defmacro.
+       (tramp-do-copy-or-rename-file, tramp-handle-dired-compress-file)
+       (tramp-maybe-open-connection): Use it.
+
+2010-04-22  Noah Lavine  <noah549@gmail.com>  (tiny change)
+
+       Detect ssh 'ControlMaster' argument automatically in some cases.
+
+       * net/tramp.el (tramp-detect-ssh-controlmaster): New defun.
+       (tramp-default-method): Use it.
+
+2010-04-22  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/tramp.el (tramp-handle-copy-file): Add new optional
+       parameter `preserve-selinux-context'.
+       (tramp-file-name-for-operation): Add `set-file-selinux-context'.
+
+2010-04-22  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/tramp.el (tramp-completion-handle-file-name-all-completions):
+       Ensure, that non remote files are still checked.  Oops.
+
+2010-04-21  Michael Albinus  <michael.albinus@gmx.de>
+
+       Fix Bug#5840.
+
+       * icomplete.el (icomplete-completions): Use `non-essential'.
+
+       * net/tramp.el (tramp-connectable-p): New defun.
+       (tramp-handle-expand-file-name)
+       (tramp-completion-handle-file-name-all-completions)
+       (tramp-completion-handle-file-name-completion): Use it.
+
+2010-04-21  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/lisp.el (lisp-completion-at-point): Try and handle errors.
+
+2010-04-21  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * vc-dir.el (vc-dir-tool-bar-map): Add :label on some tool bar items.
+
+       * tool-bar.el (tool-bar-setup): Add :label on some tool bar items.
+
+       * loadup.el: Load dynamic-setting.el if feature dynamic-setting
+       is present.
+
+       * info.el (info-tool-bar-map): Add labels.
+
+       * cus-start.el (all): Add tool-bar-style and tool-bar-max-label-size.
+
+       * cus-edit.el (custom-commands): Add labels for tool bar.
+       (custom-buffer-create-internal, Custom-mode): Adjust for
+       labels in custom-commands.
+
+       * dynamic-setting.el: Renamed from font-setting.el.
+
+2010-04-21  John Wiegley  <jwiegley@gmail.com>
+
+       * ido.el (ido-init-completion-maps): For ido-switch-buffer, C-o
+       toggles the use of virtual buffers.
+       (ido-buffer-internal): Guard `ido-use-virtual-buffers' global value.
+       (ido-toggle-virtual-buffers): New function.
+
+2010-04-21  Juanma Barranquero  <lekktu@gmail.com>
+
+       Use `define-derived-mode'; fix window selection; doc fixes.
+       * play/tetris.el (tetris, tetris-update-speed-function)
+       (tetris-tty-colors, tetris-x-colors, tetris-move-bottom)
+       (tetris-move-left, tetris-move-right, tetris-rotate-prev)
+       (tetris-rotate-next, tetris-end-game, tetris-start-game)
+       (tetris-pause-game): Fix typos in docstrings.
+       (tetris-mode-map, tetris-null-map):
+       Move initialization into declaration.
+       (tetris-mode): Define with `define-derived-mode';
+       set show-trailing-whitespace to nil.
+       (tetris): Prefer window already displaying the "*Tetris*" buffer.
+
+2010-04-21  Karel Klíč  <kklic@redhat.com>
 
-       * xml.el (xml-parse-region): Avoid infloop (Bug#5281).
+       * files.el (backup-buffer): Handle SELinux context, and return it
+       if a backup was made by renaming.
+       (backup-buffer-copy): Set SELinux context to the target file.
+       (basic-save-buffer): Set SELinux context of the newly written file.
+       (basic-save-buffer-1): Now it also returns any SELinux context.
+       (basic-save-buffer-2): Set SELinux context of the newly created file,
+       and return it.
+       * net/tramp.el (tramp-file-name-for-operation):
+       Add file-selinux-context.
 
-2010-06-29  Leo  <sdl.web@gmail.com>
+2010-04-21  Stefan Monnier  <monnier@iro.umontreal.ca>
 
-       * emacs-lisp/rx.el (rx): Doc fix.  (Bug#6537)
+       Make the log-edit comments use RFC822 format throughout.
 
-2010-06-27  Oleksandr Gavenko  <gavenkoa@gmail.com>  (tiny change)
+       * vc.el (vc-checkin, vc-modify-change-comment):
+       Adjust to new vc-start/finish-logentry.
+       (vc-find-conflicted-file): New command.
+       (vc-transfer-file): Adjust to new vc-checkin.
+       (vc-next-action): Improve scoping.
 
-       * generic-x.el (bat-generic-mode): Fix regexp for command line
-       switches (Bug#5719).
+       * vc-hg.el (vc-hg-log-edit-mode): Remove.
+       (vc-hg-checkin): Remove extra arg.  Use log-edit-extract-headers.
 
-2010-06-27  Masatake YAMATO  <yamato@redhat.com>
+       * vc-git.el (vc-git-log-edit-mode): Remove.
+       (vc-git-checkin): Remove extra arg.  Use log-edit-extract-headers.
+       (vc-git-commits-coding-system): Rename from git-commits-coding-system.
 
-       * htmlfontify.el (hfy-face-attr-for-class): Use append instead
-       of nconc to avoid pure storage error (Bug#6239).
+       * vc-dispatcher.el (vc-log-edit): Shorten names for log-edit-show-files.
+       (vc-start-logentry): Remove argument `extra'.
+       (vc-finish-logentry): Remove extra args.
 
-2010-06-27  Christoph  <cschol2112@googlemail.com>  (tiny change)
+       * vc-bzr.el (vc-bzr-log-edit-mode): Remove.
+       (vc-bzr-checkin): Remove extra arg.  Use log-edit-extract-headers.
+       (vc-bzr-conflicted-files): New function.
 
-       * bookmark.el (bookmark-bmenu-2-window, bookmark-bmenu-other-window)
-       (bookmark-bmenu-other-window-with-mouse): Remove unnecessary
-       bindings of bookmark-automatically-show-annotations (Bug#6515).
+       * log-edit.el (log-edit-extra-flags)
+       (log-edit-before-checkin-process): Remove.
+       (log-edit-summary, log-edit-header, log-edit-unknown-header): New faces.
+       (log-edit-headers-alist): New var.
+       (log-edit-header-contents-regexp): New const.
+       (log-edit-match-to-eoh): New function.
+       (log-edit-font-lock-keywords): Use them.
+       (log-edit): Insert a "Summary:" header as default.
+       (log-edit-mode): Mark font-lock rules as case-insensitive.
+       (log-edit-done): Cleanup headers.
+       (log-view-process-buffer): Remove.
+       (log-edit-extract-headers): New function to replace it.
 
-2010-06-25  Eli Zaretskii  <eliz@gnu.org>
+2010-04-20  Juanma Barranquero  <lekktu@gmail.com>
 
-       * arc-mode.el (archive-zip-extract): Don't quote the file name on
-       MS-Windows and MS-DOS.  (Bug#6467, Bug#6144)
+       * subr.el (default-direction-reversed): Remove obsolescence info.
 
-2010-06-24  Štěpán Němec  <stepnem@gmail.com>  (tiny change)
+2010-04-20  Stefan Monnier  <monnier@iro.umontreal.ca>
 
-       * comint.el (make-comint, make-comint-in-buffer): Mention return
-       value in the docstrings.  (Bug#6498)
+       * vc-dispatcher.el (vc-finish-logentry): Don't mess so badly with the
+       windows/frames.
 
-2010-06-24  Yoni Rabkin  <yoni@rabkins.net>
+       * emacs-lisp/lisp.el (lisp-completion-at-point): Complete around point.
+       I.e. include text after point in the completion region.
+       Also, return nil when we're not after/in a symbol.
 
-       * bs.el (bs-mode-font-lock-keywords): Remove "by" from Dired pattern,
-       since it is not present when using some non-default switches.
+       * international/mule-cmds.el (view-hello-file): Don't fiddle with the
+       default enable-multibyte-characters.
 
-2010-06-23  Karl Fogel  <kfogel@red-bean.com>
+2010-04-19  Stefan Monnier  <monnier@iro.umontreal.ca>
 
-       * simple.el (compose-mail): Fix doc string to refer to
-       `compose-mail-user-agent-warnings', instead of to the
-       nonexistent `compose-mail-check-user-agent'.
+       * international/mule.el: Help the user choose a valid coding-system.
+       (read-buffer-file-coding-system): New function.
+       (set-buffer-file-coding-system): Use it.  Prompt the user if the
+       coding-system cannot encode all the chars.
 
-2010-06-22  Dan Nicolaescu  <dann@ics.uci.edu>
+       * vc-bzr.el: Use standard *vc* and *vc-diff* buffers.
+       (vc-bzr-shelve-show, vc-bzr-shelve-apply)
+       (vc-bzr-shelve-apply-and-keep, vc-bzr-shelve-snapshot):
+       Don't use *vc-bzr-shelve*.
 
-       Fix vc-annotate for renamed files when using Git.
-       * vc-git.el (vc-git-find-revision): Deal with empty results from
-       ls-files.  Doe not pass the object as a file name to cat-file, it
-       is not a file name.
-       (vc-git-annotate-command): Pass the file name using -- to avoid
-       ambiguity with the revision.
-       (vc-git-previous-revision): Pass a relative file name.
+2010-04-19  Chong Yidong  <cyd@stupidchicken.com>
 
-2010-06-22  Glenn Morris  <rgm@gnu.org>
+       * cedet/ede/pmake.el (ede-proj-makefile-insert-variables):
+       Don't destroy list before using it.
 
-       * progmodes/js.el (js-mode-map): Use standard capitalization and
-       ellipses for menu entries.
+2010-04-19  Dan Nicolaescu  <dann@ics.uci.edu>
 
-       * wid-edit.el (widget-complete): Doc fix.
+       Fix the version number for added files.
+       * vc-hg.el (vc-hg-working-revision): Check if the file is
+       registered after hg parent fails (Bug#5961).
 
-2010-06-22  Jürgen Hötzel  <juergen@hoetzel.info>  (tiny change)
+2010-04-19  Glenn Morris  <rgm@gnu.org>
 
-       * wid-edit.el (widget-complete): Fix typo in 2009-12-02 change.
+       * htmlfontify.el (htmlfontify-buffer)
+       (htmlfontify-copy-and-link-dir): Autoload entry points.
 
-2010-06-22  Dan Nicolaescu  <dann@ics.uci.edu>
+2010-04-19  Magnus Henoch  <magnus.henoch@gmail.com>
 
-       Fix annotating other revisions for renamed files in vc-annotate.
-       * vc-annotate.el (vc-annotate): Add an optional argument for the
-       VC backend.  Use it when non-nil.
-       (vc-annotate-warp-revision): Pass the VC backend to vc-annotate.  (Bug#6487)
+       * vc-hg.el (vc-hg-annotate-extract-revision-at-line): Expand file
+       name relative to the project root (Bug#5960).
 
-       Fix vc-annotate-show-changeset-diff-revision-at-line for git.
-       * vc-annotate.el (vc-annotate-show-diff-revision-at-line-internal):
-       Do not pass the file name to the 'previous-revision call when we
-       don't want a file diff.  (Bug#6489)
+2010-04-19  Glenn Morris  <rgm@gnu.org>
 
-2010-06-21  Dan Nicolaescu  <dann@ics.uci.edu>
+       * vc-git.el (vc-git-print-log): Doc fix.
 
-       Fix finding revisions for renamed files in vc-annotate.
-       * vc.el (vc-find-revision): Add an optional argument for
-       the VC backend.  Use it when non-nil.
-       * vc-annotate.el (vc-annotate-find-revision-at-line): Pass the VC
-       backend to vc-find-revision.  (Bug#6487)
+2010-04-19  Óscar Fuentes  <ofv@wanadoo.es>
 
-2010-06-21  Dan Nicolaescu  <dann@ics.uci.edu>
+       * ido.el (ido-file-internal): Fix 2009-12-02 change.
 
-       Fix reading file names in Git annotate buffers.
-       * vc-git.el (vc-git-annotate-extract-revision-at-line): Remove
-       trailing whitespace.  Suggested by Eric Hanchrow.  (Bug#6481)
+2010-04-19  Christoph  <cschol2112@googlemail.com>  (tiny change)
 
-2010-06-20  Alan Mackenzie  <acm@muc.de>
+       * progmodes/grep.el (grep-compute-defaults): Fix handling of host
+       default settings (Bug#5928).
 
-       * progmodes/cc-mode.el (c-before-hack-hook): When the mode is set
-       in file local variables, set it first.
+2010-04-19  Glenn Morris  <rgm@gnu.org>
 
-2010-06-19  Glenn Morris  <rgm@gnu.org>
+       * progmodes/fortran.el (fortran-match-and-skip-declaration):
+       New function.
+       (fortran-font-lock-keywords-3): Use it.  (Bug#1385)
 
-       * descr-text.el (describe-char-unicode-data): Insert separating
-       space when needed.  (Bug#6422)
+2010-04-19  Kenichi Handa  <handa@m17n.org>
 
-       * progmodes/idlwave.el (idlwave-action-and-binding):
-       Fix typo in 2009-12-03 change.  (Bug#6450)
+       * language/indian.el (malayalam-composable-pattern): Fix previous
+       change (add U+0D4D "SIGN VIRAMA").
+       (oriya-composable-pattern): Add U+0B30 and fix typo in the regexp.
+       (tamil-composable-pattern): Fix typo in the regexp.
+       (telugu-composable-pattern): Fix U+0C4D and typo in the regexp.
+       (kannada-composable-pattern): Fix U+0CB0 and typo in the regexp.
+       (malayalam-composable-pattern): Fix U+0D4D and typo in the regexp.
 
-2010-06-17  Stefan Monnier  <monnier@iro.umontreal.ca>
+2010-04-19  Chong Yidong  <cyd@stupidchicken.com>
 
-       * subr.el (read-quoted-char): Fix up last change (bug#6290).
+       * textmodes/tex-mode.el (latex-mode): Revert 2008-03-03 change to
+       paragraph-separate (Bug#5821).
 
-2010-06-16  Stefan Monnier  <monnier@iro.umontreal.ca>
+2010-04-19  Juri Linkov  <juri@jurta.org>
 
-       * font-lock.el (font-lock-major-mode): Rename from
-       font-lock-mode-major-mode to distinguish it from
-       global-font-lock-mode's own font-lock-mode-major-mode (bug#6135).
-       (font-lock-set-defaults):
-       * font-core.el (font-lock-default-function): Adjust users.
-       (font-lock-mode): Don't set it at all.
+       Put breadcrumbs on overlay instead of inserting to buffer (bug#5809).
 
-2010-06-15  Stefan Monnier  <monnier@iro.umontreal.ca>
+       * info.el (Info-find-node-2): Comment out code that skips
+       breadcrumbs line.
+       (Info-mouse-follow-link): New command.
+       (Info-link-keymap): New keymap.
+       (Info-breadcrumbs): Rename from `Info-insert-breadcrumbs'.
+       Return a string with links instead of inserting breadcrumbs
+       to the Info buffer.
+       (Info-fontify-node): Comment out code that inserts breadcrumbs.
+       Instead of putting the `invisible' text property over the Info
+       header, make an overlay over the Info header with the `invisible'
+       property and `after-string' set to the string returned by
+       `Info-breadcrumbs'.
 
-       * vc-annotate.el (vc-annotate): Use vc-read-revision.
+2010-04-19  Chong Yidong  <cyd@stupidchicken.com>
 
-2010-06-15  Glenn Morris  <rgm@gnu.org>
+       * help.el (help-window-setup-finish): Doc fix (Bug#5830).
+       Reported by monkey@sandpframing.com.
 
-       * calendar/appt.el (appt-time-msg-list): Doc fix.
-       (appt-check): Let-bind appt-warn-time.
-       (appt-add): Make the 3rd argument optional.
-       Simplify argument names.  Doc fix.  Check for integer WARNTIME.
-       Only add WARNTIME to the output list if non-nil.
+2010-04-19  Stefan Monnier  <monnier@iro.umontreal.ca>
 
-2010-06-15  Ivan Kanis  <apple@kanis.eu>
+       * tmm.el (tmm-prompt): Remove obsolete call to x-popup-menu.
+       (tmm-get-keymap): Add key-binding shortcuts now that they're not
+       available in the "keyseq cache" any more.
 
-       * calendar/appt.el (appt-check): Let the 3rd element of
-       appt-time-msg-list specify the warning time.
-       (appt-add): Add new argument with the warning time.  (Bug#5176)
+       * custom.el (defcustom): Add edebug spec.
 
-2010-06-12  Bob Rogers  <rogers-emacs@rgrjr.dyndns.org>  (tiny change)
+2010-04-18  Juri Linkov  <juri@jurta.org>
 
-       * vc-svn.el (vc-svn-after-dir-status): Fix regexp for Subversions
-       older than version 1.6.  (Bug#6361)
+       Test for special mode-class in view-buffer instead of view-file (bug#5513).
 
-2010-06-12  Helmut Eller  <eller.helmut@gmail.com>
+       * view.el (view-file, view-buffer): Move test for special mode-class
+       from view-file to view-buffer.
 
-       * emacs-lisp/cl-macs.el (destructuring-bind): Bind `bind-enquote',
-       used by cl-do-arglist.  (Bug#6408)
+       * tar-mode.el (tar-extract): Turn if's into one cond
+       like in arc-mode.el.
 
-2010-06-09  Stefan Monnier  <monnier@iro.umontreal.ca>
+2010-04-18  Juri Linkov  <juri@jurta.org>
 
-       * emacs-lisp/advice.el (ad-compile-function):
-       Define warning-suppress-types before we let-bind it (bug#6275).
+       Add 7z archive format support (bug#5475).
 
-       * vc-dispatcher.el: Rename mode-line-hook to vc-mode-line-hook;
-       declare it, make it buffer-local and permanent-local (bug#6324).
-       (vc-resynch-window): Adjust name.
-       * vc-hooks.el (vc-find-file-hook): Adjust name.
+       * arc-mode.el (archive-zip-extract): Try to find 7z executable.
+       (archive-7z-extract): New defcustom.
+       (archive-find-type): Add magic string for 7z.
+       (archive-extract-by-stdout): Add new optional arg `stderr-file'.
+       If `stderr-file' is non-nil, use `(t stderr-file)' for the
+       `buffer' arg of `call-process'.
+       (archive-zip-extract): Check `archive-zip-extract' for "7z" and
+       call the function `archive-7z-extract' with the variable
+       `archive-7z-extract' let-bound to `archive-zip-extract'.
+       (archive-7z-summarize, archive-7z-extract): New functions.
 
-2010-06-07  Jonathan Rockway  <jon@jrock.us>
+       * international/mule.el (auto-coding-alist):
+       * files.el (auto-mode-alist): Add 7z file extension.
 
-       * net/rcirc.el: Add support for password authentication.
-       (rcirc-server-alist): Add :password keyword.
-       (rcirc): Ask for a password, or get it from the server's alist.
-       (rcirc-connect): Add password argument.  Pass it to server.
+2010-04-18  Stefan Monnier  <monnier@iro.umontreal.ca>
 
-2010-06-05  Juanma Barranquero  <lekktu@gmail.com>
+       * loadup.el: Setup hash-cons for pure data.
 
-       * net/dbus.el (dbus-register-method): Declare function.
-       (dbus-handle-event, dbus-property-handler): Fix typos in docstrings.
-       (dbus-introspect): Doc fix.
-       (dbus-event-bus-name, dbus-introspect-get-interface)
-       (dbus-introspect-get-argument): Reflow docstrings.
+       Fix duplicate entries in cedet's loaddefs.el files.
+       * emacs-lisp/autoload.el (autoload-file-load-name): Be more clever.
+       Should make most file-local generated-autoload-file unnecessary.
+       (print-readably): Silence warnings.
+       (autoload-find-destination): Take load-name as an arg to make sure
+       it's the same as the one that will be in the file.
+       (autoload-generate-file-autoloads): Adjust to above changes.
+       Try to make the dataflow a bit simpler.
 
-2010-06-04  Chong Yidong  <cyd@stupidchicken.com>
+       * cvs-status.el (cvs-refontify): Remove unused.
 
-       * term/common-win.el (x-colors): Add "dark green" and "dark
-       turquoise" (Bug#6332).
+2010-04-18  Jay Belanger  <jay.p.belanger@gmail.com>
 
-2010-06-03  Eric Ludlam  <zappo@gnu.org>
+       * calc.el (calc-mode-map): Bind "O" to `calc-missing-key'.
 
-       * cedet/semantic/lex-spp.el
-       (semantic-lex-spp-table-write-slot-value): Instead of erroring on
-       invalid values during save, just save a nil (Bug#6324).
+       * calc-bin.el (calc-radix): Have the "O" option turn on
+       twos-complement mode.
 
-2010-06-03  Glenn Morris  <rgm@gnu.org>
+2010-04-17  Jay Belanger  <jay.p.belanger@gmail.com>
 
-       * desktop.el (desktop-clear-preserve-buffers):
-       Add "*Warnings*" buffer.  (Bug#6336)
+       * calc-ext.el (calc-init-extensions): Add keybinding for 'calc-option'.
+       Add `calc-option-prefix-help' to calc-help autoloads.
+       (calc-inverse): Add "Option" to message, as appropriate.
+       (calc-hyperbolic): Add "Option" to message, as appropriate.
+       (calc-option, calc-is-option): New functions.
 
-2010-06-02  Dan Nicolaescu  <dann@ics.uci.edu>
+       * calc-help.el (calc-full-help): Add `calc-option-help'.
+       (calc-option-prefix-help): New function.
 
-       * vc-dir.el (vc-dir-update): Remove entries with a nil state (bug#5539).
+       * calc-misc.el (calc-help): Add "Option" entry.
 
-2010-06-01  Stefan Monnier  <monnier@iro.umontreal.ca>
+       * calc.el (calc-local-var-list): Add `calc-option-flag'.
+       (calc-option-flag): New variable.
+       (calc-do): Set `calc-option-flag to nil.
+       (calc-set-mode-line): Add "Opt " as appropriate.
 
-       * vc-bzr.el (vc-bzr-revision-completion-table): Apply
-       `file-directory-p' to the filename part rather than to the whole text.
+2010-04-16  Juri Linkov  <juri@jurta.org>
 
-2010-05-31  Jonathan Marchand  <jonathlela@gmail.com>  (tiny change)
+       Move scrolling commands from simple.el to window.el
+       because their primitives are implemented in window.c.
 
-       * cedet/ede/cpp-root.el (ede-set-project-variables): Fix feature name
-       (bug#6231).
+       * simple.el (scroll-error-top-bottom)
+       (scroll-up-command, scroll-down-command, scroll-up-line)
+       (scroll-down-line, scroll-other-window-down)
+       (beginning-of-buffer-other-window, end-of-buffer-other-window):
+       * window.el (scroll-error-top-bottom)
+       (scroll-up-command, scroll-down-command, scroll-up-line)
+       (scroll-down-line, scroll-other-window-down)
+       (beginning-of-buffer-other-window, end-of-buffer-other-window):
+       Move from simple.el to window.el because their primitives are
+       implemented in window.c.
 
-2010-05-31  Stefan Monnier  <monnier@iro.umontreal.ca>
+2010-04-16  Juri Linkov  <juri@jurta.org>
 
-       * man.el (Man-completion-table): Let the user type "-k " (bug#6319).
+       * isearch.el (isearch-lookup-scroll-key): Check both
+       `isearch-scroll' and `scroll-command' properties.
+       (scroll-up, scroll-down): Remove `isearch-scroll' property.
 
-2010-05-31  Drew Adams  <drew.adams@oracle.com>
+       * mwheel.el (mwheel-scroll): Remove `isearch-scroll' property.
 
-       * files.el (directory-files-no-dot-files-regexp): Doc fix (bug#6298).
+       * simple.el (scroll-up-command, scroll-down-command)
+       (scroll-up-line, scroll-down-line): Remove `isearch-scroll' property.
 
-2010-05-31  Juanma Barranquero  <lekktu@gmail.com>
+2010-04-15  Juri Linkov  <juri@jurta.org>
 
-       * subr.el (momentary-string-display): Just use read-event to read
-       the exit event (Bug#6238).
+       * simple.el (scroll-up-command, scroll-down-command)
+       (scroll-up-line, scroll-down-line): Put `scroll-command'
+       property on the these symbols.  Remove them from
+       `scroll-preserve-screen-position-commands'.
 
-2010-05-29  Chong Yidong  <cyd@stupidchicken.com>
+       * mwheel.el (mwheel-scroll): Put `scroll-command' and
+       `isearch-scroll' properties on the `mwheel-scroll' symbol.
+       Remove it from `scroll-preserve-screen-position-commands'.
 
-       * ansi-color.el: Delete unused escape sequences (Bug#6085).
-       (ansi-color-drop-regexp): New constant.
-       (ansi-color-apply, ansi-color-filter-region)
-       (ansi-color-apply-on-region): Delete unrecognized control sequences.
-       (ansi-color-apply): Build string list before calling concat.
+       * isearch.el (isearch-allow-scroll): Doc fix.
 
-2010-05-27  Chong Yidong  <cyd@stupidchicken.com>
+2010-04-15  Michael Albinus  <michael.albinus@gmx.de>
 
-       * progmodes/verilog-mode.el (verilog-type-font-keywords):
-       Use font-lock-constant-face, not obsolete font-lock-reference-face.
+       * net/tramp.el (tramp-error-with-buffer): Don't show the
+       connection buffer when we are in completion mode.
+       (tramp-file-name-handler): Catch the error for some operations
+       when we are in completion mode.  This gives the user the chance to
+       correct the file name in the minibuffer.
 
-2010-05-27  Masatake YAMATO  <yamato@redhat.com>
+2010-04-15  Glenn Morris  <rgm@gnu.org>
 
-       * htmlfontify.el (hfy-face-resolve-face): New function.
-       (hfy-face-to-style): Use it (Bug#6279).
+       * progmodes/verilog-mode.el (verilog-forward-sexp): Avoid free variable.
 
-2010-05-25  Stefan Monnier  <monnier@iro.umontreal.ca>
+2010-04-15  Juanma Barranquero  <lekktu@gmail.com>
 
-       * epa.el (epa--select-keys): Don't explicitly delete the window since
-       that can fail (e.g. sole window in frame).  Use dedication instead.
+       Simplify by using `define-derived-mode'.
+       * info.el (Info-mode):
+       * calendar/todo-mode.el (todo-mode):
+       * play/gomoku.el (gomoku-mode): Define with `define-derived-mode'.
+       (gomoku-mode-map): Move initialization into declaration.
 
-2010-05-19  Uday S Reddy  <u.s.reddy@cs.bham.ac.uk>  (tiny change)
+2010-04-14  Michael Albinus  <michael.albinus@gmx.de>
 
-       * textmodes/fill.el (fill-region): Don't fill past the end (bug#6201).
+       Fix Bug#5840.
+       * ido.el (ido-file-name-all-completions-1):
+       * minibuffer.el (minibuffer-completion-help):
+       * net/tramp.el (tramp-completion-mode-p): Use `non-essential'.
 
-2010-05-18  Stefan Monnier  <monnier@iro.umontreal.ca>
+2010-04-14  Stefan Monnier  <monnier@iro.umontreal.ca>
 
-       * subr.el (read-quoted-char): Resolve modifiers after key
-       remapping (bug#6212).
+       * simple.el (non-essential): New var.
 
-2010-05-11  Stefan Monnier  <monnier@iro.umontreal.ca>
+       Add a new field `location' to bookmarks for non-file bookmarks.
+       * bookmark.el (bookmark-location): Use the new field, if present.
+       (bookmark-insert-location): Undo last change, not needed any more.
+       * man.el (Man-bookmark-make-record):
+       * woman.el (woman-bookmark-make-record): Add `location' field.
 
-       * tmm.el (tmm-prompt): Don't try to precompute bindings.
-       (tmm-get-keymap): Compute shortcuts (bug#6171).
+2010-04-14  Juri Linkov  <juri@jurta.org>
 
-2010-05-10  Glenn Morris  <rgm@gnu.org>
+       * simple.el (scroll-error-top-bottom): New defcustom.
+       (scroll-up-command, scroll-down-command): Use it.  Doc fix.
 
-       * desktop.el (desktop-save-buffer-p): Don't mistakenly include
-       all dired buffers, even tramp ones.  (Bug#5755)  [Backport from trunk]
+       * emulation/pc-select.el (pc-select-override-scroll-error):
+       Obsolete in favor of `scroll-error-top-bottom'.
 
-2010-05-07  Chong Yidong  <cyd@stupidchicken.com>
+2010-04-14  Juri Linkov  <juri@jurta.org>
 
-       * Version 23.2 released.
+       * tutorial.el (tutorial--default-keys): Rebind `C-v' to
+       `scroll-up-command' and `M-v' to `scroll-down-command'.
 
-2010-05-03  Chong Yidong  <cyd@stupidchicken.com>
+       * emulation/cua-rect.el (cua--init-rectangles):
+       * forms.el (forms--change-commands):
+       * image-mode.el (image-mode-map):
+       Remap scroll-down-command and scroll-up-command
+       in addition to scroll-down and scroll-up.
 
-       * international/mule.el (auto-coding-alist):  Only purecopy
-       car of each item, not the whole list (Bug#6083).
+2010-04-14  Juri Linkov  <juri@jurta.org>
 
-2010-05-02  Chong Yidong  <cyd@stupidchicken.com>
+       * mwheel.el (scroll-preserve-screen-position-commands):
+       Add mwheel-scroll to this list of commands.
 
-       * progmodes/js.el (js-mode): Make paragraph variables local before
-       calling c-setup-paragraph-variables (Bug#6071).
+       * simple.el (scroll-preserve-screen-position-commands):
+       Add scroll-up-command, scroll-down-command, scroll-up-line,
+       scroll-down-line to this list of commands.
 
-2010-05-01  Eli Zaretskii  <eliz@gnu.org>
+2010-04-13  Stefan Monnier  <monnier@iro.umontreal.ca>
 
-       * composite.el (compose-region, reference-point-alist): Fix typos
-       in the doc strings.
+       * obsolete/complete.el: Move from lisp/complete.el.
 
-2010-04-28  Alexander Klimov  <alserkli@inbox.ru>  (tiny change)
+       * pcomplete.el (pcomplete-here*): Fix mistaken change (bug#5935).
 
-       * calc/calc-graph.el (calc-graph-plot): Use the proper form for
-       gnuplot's "set" command.
+       * emacs-lisp/easy-mmode.el (define-minor-mode): Passing a nil argument
+       to the minor mode function now turns the mode ON unconditionally.
 
-2010-04-26  Juanma Barranquero  <lekktu@gmail.com>
+2010-04-12  Stefan Monnier  <monnier@iro.umontreal.ca>
 
-       * abbrev.el (last-abbrev-text): Doc fix.
-       (abbrev-prefix-mark): Don't escape parenthesis.
+       * vc-dir.el (vc-dir-kill-line): New command.
+       (vc-dir-mode-map): Bind it to C-k.
 
-2010-04-24  Andreas Schwab  <schwab@linux-m68k.org>
+       * bookmark.el (bookmark-insert-location): Handle a nil filename.
 
-       * composite.el (find-composition): Doc fix.
+       * woman.el: Add bookmark declarations to silence the compiler.
+       (bookmark-prop-get): Use `man-args' rather than `filename' as a first
+       step to compatibility between man and woman bookmarks.
+       Adjust for Man-default-bookmark-title renaming.
+       (woman-bookmark-jump): Adjust accordingly.  Don't forget to autoload.
 
-2010-04-24  Juanma Barranquero  <lekktu@gmail.com>
+       * man.el: Add bookmark declarations to silence the compiler.
+       (Man-name-local-regexp): Make it match NAME as well.
+       (Man-getpage-in-background): Return the buffer.
+       (Man-notify-when-ready): Use `case'.
+       (man-set-default-bookmark-title): Rename to Man-default-bookmark-title.
+       Don't hardcode "NAME".  Simplify.
+       (Man-bookmark-make-record): Use Man-arguments rather than buffer-name.
+       Rename from Man-bookmark-make-record.
+       (Man-bookmark-jump): Rename from man-bookmark-jump.  Simplify now that
+       we have the actual man-args.  Use Man-getpage-in-background rather
+       than `man' since the arg is already processed.  Let bookmark.el do the
+       window handling.  Only wait for the relevant process.
+       Don't forget to autoload.
 
-       * progmodes/sql.el (sql-electric-stuff): Fix typo in tag.
-       (sql-oracle-program, sql-sqlite-options)
-       (sql-query-placeholders-and-send): Doc fixes.
-       (sql-set-product, sql-interactive-mode): Reflow docstrings.
-       (sql-imenu-generic-expression, sql-buffer)
-       (sql-mode-ansi-font-lock-keywords, sql-mode-oracle-font-lock-keywords)
-       (sql-mode-postgres-font-lock-keywords, sql-mode-ms-font-lock-keywords)
-       (sql-mode-sybase-font-lock-keywords)
-       (sql-mode-informix-font-lock-keywords)
-       (sql-mode-interbase-font-lock-keywords)
-       (sql-mode-ingres-font-lock-keywords, sql-mode-solid-font-lock-keywords)
-       (sql-mode-mysql-font-lock-keywords, sql-mode-sqlite-font-lock-keywords)
-       (sql-mode-db2-font-lock-keywords, sql-mode-font-lock-keywords)
-       (sql-product-feature, sql-highlight-product)
-       (comint-line-beginning-position, sql-rename-buffer)
-       (sql-toggle-pop-to-buffer-after-send-region)
-       (sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql, sql-solid)
-       (sql-ingres, sql-ms, sql-postgres, sql-interbase, sql-db2, sql-linter):
-       Fix typos in docstrings.
+       * bookmark.el (bookmark-default-file): Use locate-user-emacs-file.
+
+2010-04-12  Thierry Volpiatto  <thierry.volpiatto@gmail.com>
+
+       * woman.el (woman-bookmark-make-record, woman-bookmark-jump):
+       New functions.
+       (woman-mode): Setup bookmark support.
+
+       * man.el (man-set-default-bookmark-title, man-bookmark-make-record)
+       (man-bookmark-jump): New functions.
+       (Man-mode): Setup bookmark support.
+
+2010-04-10  Jari Aalto  <jari.aalto@cante.net>
 
-2010-04-23  Juri Linkov  <juri@jurta.org>
+       * comint.el (comint-password-prompt-regexp): Use regexp-opt, and
+       recognize ssh-keygen prompt (Bug#2817).
+
+2010-04-10  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/tramp.el (tramp-do-copy-or-rename-file): Add progress reporter.
+
+2010-04-10  Michael Albinus  <michael.albinus@gmx.de>
+
+       Synchronize with Tramp repository.
+
+       * net/tramp.el (tramp-completion-function-alist)
+       (tramp-file-name-regexp, tramp-chunksize)
+       (tramp-local-coding-commands, tramp-remote-coding-commands):
+       Fix docstring.
+       (tramp-remote-process-environment): Use `format' instead of `concat'.
+       (tramp-handle-directory-files-and-attributes)
+       (tramp-get-remote-path): Use `copy-tree'.
+       (tramp-handle-file-name-all-completions): Backward/ XEmacs
+       compatibility: Use `completion-ignore-case' if
+       `read-file-name-completion-ignore-case' does not exist.
+       (tramp-do-copy-or-rename-file-directly): Do not use
+       `tramp-handle-file-remote-p'.
+       (tramp-do-copy-or-rename-file-out-of-band):
+       Use `tramp-compat-delete-directory'.
+       (tramp-do-copy-or-rename-file-out-of-band)
+       (tramp-compute-multi-hops, tramp-maybe-open-connection):
+       Use `format-spec-make'.
+       (tramp-find-foreign-file-name-handler)
+       (tramp-advice-make-auto-save-file-name)
+       (tramp-set-auto-save-file-modes): Remove superfluous check for
+       `stringp'.  This is done inside `tramp-tramp-file-p'.
+       (tramp-debug-outline-regexp): New defconst.
+       (tramp-get-debug-buffer): Use it.
+       (tramp-check-for-regexp): Use (forward-line 1).
+       (tramp-set-auto-save-file-modes): Adapt version check.
+
+       * net/tramp-compat.el (tramp-advice-file-expand-wildcards):
+       Wrap call of `featurep' for 2nd argument.
+       (tramp-compat-make-temp-file): Simplify fallback implementation.
+       (tramp-compat-copy-tree): Remove function.
+       (tramp-compat-delete-directory): Provide implementation for older
+       Emacsen.
+
+       * net/tramp-fish.el (tramp-fish-handle-directory-files-and-attributes):
+       Do not use `tramp-fish-handle-file-attributes.
 
-       * info.el (Info-fontify-node): Put Info-breadcrumbs to the `display'
-       property instead of `invisible' and `after-string' (bug#5998).
+       * net/trampver.el: Update release number.
 
-2010-04-23  Juri Linkov  <juri@jurta.org>
+2010-04-10  Glenn Morris  <rgm@gnu.org>
 
-       * image-mode.el (image-mode-as-text): Fix typo in docstring.
+       * progmodes/compile.el (compilation-save-buffers-predicate):
+       Add missing :version tag.
 
-2010-04-23  Juanma Barranquero  <lekktu@gmail.com>
+2010-04-09  Sam Steingold  <sds@gnu.org>
 
-       * filecache.el (file-cache-add-directory-list)
-       (file-cache-add-directory-recursively): Fix typos in docstrings.
+       * progmodes/compile.el (compilation-save-buffers-predicate):
+       Remove the "autoload" cookie.
 
-2010-04-22  Kenichi Handa  <handa@m17n.org>
+       * progmodes/bug-reference.el (turn-on-bug-reference-mode)
+       (turn-on-bug-reference-prog-mode): Remove, `bug-reference-mode'
+       and `bug-reference-prog-mode' can be used in hooks directly.
 
-       * language/indian.el (gurmukhi-composable-pattern): Fix typo.
-       (gujarati-composable-pattern): Fix typo.
+2010-04-09  Dan Nicolaescu  <dann@ics.uci.edu>
 
-2010-04-20  Kenichi Handa  <handa@m17n.org>
+       Add --author support to git commit.
+       * vc-git.el (vc-git-checkin): Pass extra-args to the commit command.
+       (vc-git-log-edit-mode): New minor mode.
+       (log-edit-mode, log-edit-extra-flags, log-edit-mode):
+       New declarations.
 
-       * language/indian.el (oriya-composable-pattern)
-       (tamil-composable-pattern, malayalam-composable-pattern): Add
-       two-part vowels to "v" (vowel sign).
+2010-04-09  Eric Raymond  <esr@snark.thyrsus.com>
 
-2010-04-20  Chong Yidong  <cyd@stupidchicken.com>
+       * vc-hooks.el, vc-git.el: Improve documentation comments.
 
-       * files.el (copy-directory): Handle symlinks (Bug#5982).
+2010-04-08  Stefan Monnier  <monnier@iro.umontreal.ca>
 
-       * progmodes/compile.el (compilation-next-error-function): Revert
-       2009-10-12 change (Bug#5983).
+       Fix some of the problems in defsubst* (bug#5728).
+       * emacs-lisp/cl-macs.el (defsubst*): Don't substitute non-trivial args.
+       (cl-defsubst-expand): Do the substitutions simultaneously (bug#5728).
 
-2010-04-20  Dan Nicolaescu  <dann@ics.uci.edu>
+2010-04-07  Sam Steingold  <sds@gnu.org>
 
-       * vc-hg.el (vc-hg-state): Use HGRCPATH, not HGRC.
-       (vc-hg-working-revision): Likewise.  Use hg parents, not hg parent
-       (Bug#5846).
+       * progmodes/compile.el (compilation-save-buffers-predicate):
+       New custom variable.
+       (compile, recompile): Pass it to `save-some-buffers'.
 
-2010-04-20  Glenn Morris  <rgm@gnu.org>
+2010-04-07  Jan Djärv  <jan.h.d@swipnet.se>
 
-       * emacs-lisp/lisp.el (lisp-completion-at-point): Give it a doc string.
+       * wid-edit.el (widget-choose): Move cursor to the second line of
+       the buffer (Bug#5695).
 
-       * minibuffer.el (completion-at-point): Doc fix.
+2010-04-07  Dan Nicolaescu  <dann@ics.uci.edu>
 
-2010-04-18  Chong Yidong  <cyd@stupidchicken.com>
+       Add new VC methods: vc-log-incoming and vc-log-outgoing.
+       * vc.el (vc-print-log-setup-buttons): New function split out from
+       vc-print-log-internal.
+       (vc-log-internal-common): New function, a parametrized version of
+       vc-print-log-internal.
+       (vc-print-log-internal): Just call vc-log-internal-common with the
+       right arguments.
+       (vc-incoming-outgoing-internal):
+       (vc-log-incoming, vc-log-outgoing): New functions.
+       (vc-log-view-type): New permanent local variable.
 
-       * cedet/ede/pmake.el (ede-proj-makefile-insert-variables): Don't
-       destroy list before using it.
+       * vc-hooks.el (vc-menu-map): Bind vc-log-incoming and vc-log-outgoing.
 
-2010-04-17  Dan Nicolaescu  <dann@ics.uci.edu>
+       * vc-bzr.el (vc-bzr-log-view-mode): Use vc-log-view-type instead
+       of the dynamic bound vc-short-log.
+       (vc-bzr-log-incoming, vc-bzr-log-outgoing): New functions.
 
-       Fix the version number for added files.
-       * vc-hg.el (vc-hg-working-revision): Check if the file is
-       registered after hg parent fails (Bug#5961).
+       * vc-git.el (vc-git-log-outgoing): New function.
+       (vc-git-log-view-mode): Use vc-log-view-type instead
+       of the dynamic bound vc-short-log.
 
-2010-04-17  Glenn Morris  <rgm@gnu.org>
+       * vc-hg.el (vc-hg-log-view-mode): Use vc-log-view-type instead
+       of the dynamic bound vc-short-log.  Highlight the tag.
+       (vc-hg-log-incoming, vc-hg-log-outgoing): New functions.
+       (vc-hg-outgoing, vc-hg-incoming, vc-hg-outgoing-mode):
+       (vc-hg-incoming-mode): Remove.
+       (vc-hg-extra-menu-map): Do not bind vc-hg-incoming and vc-hg-outgoing.
 
-       * htmlfontify.el (htmlfontify-buffer)
-       (htmlfontify-copy-and-link-dir): Autoload entry points.
+2010-04-07  Dan Nicolaescu  <dann@ics.uci.edu>
 
-2010-04-17  Magnus Henoch  <magnus.henoch@gmail.com>
+       Fix default-directory for vc-root-diff.
+       * vc.el (vc-root-diff): Bind default-directory to the root
+       directory for the diff command.
 
-       * vc-hg.el (vc-hg-annotate-extract-revision-at-line): Expand file
-       name relative to the project root (Bug#5960).
+2010-04-07  Michael McNamara  <mac@mail.brushroad.com>
 
-2010-04-16  Glenn Morris  <rgm@gnu.org>
+       * progmodes/verilog-mode.el (verilog-forward-sexp):
+       (verilog-calc-1): Support "disable fork" and "fork wait" multi
+       word keywords, suggested by Steve Pearlmutter.
+       (verilog-pretty-declarations): Support lineup of declarations in
+       port lists.
+       (verilog-skip-backward-comments, verilog-skip-forward-comment-p):
+       fix bug for /* / comments.
+       (verilog-backward-syntactic-ws, verilog-forward-syntactic-ws):
+       Speed up and simplfy as this is never called with a bound.
+       (verilog-pretty-declarations): Enhance to line up declarations
+       inside a parameter list, suggested by Alan Morgan.
+       (verilog-pretty-expr): Tune assignment regular expression match
+       string for corner cases; also use markers instead of character
+       number as indent changes the later.
 
-       * vc-git.el (vc-git-print-log): Doc fix.
+2010-04-07  Wilson Snyder  <wsnyder@wsnyder.org>
 
-2010-04-14  Óscar Fuentes  <ofv@wanadoo.es>
+       * progmodes/verilog-mode.el (verilog-type-keywords): Fix pulldown
+       as missing keyword.
+       (verilog-read-sub-decls-line): Fix comments in AUTO_TEMPLATE
+       causing truncation of AUTOWIRE signals.  Reported by Bruce Tennant.
+       (verilog-auto-inst, verilog-auto-inst-port): Add vl_mbits for
+       AUTO_TEMPLATEs needing multiple array bits.  Suggested by Bruce
+       Tennant.
+       (verilog-keywords):
+       (verilog-1800-2005-keywords, verilog-1800-2009-keywords): Add IEEE
+       1800-2009 keywords, including "global.".
 
-       * ido.el (ido-file-internal): Fix 2009-12-02 change.
+2010-04-06  John Wiegley  <jwiegley@gmail.com>
 
-2010-04-14  Christoph  <cschol2112@googlemail.com>  (tiny change)
+       * ido.el (ido-add-virtual-buffers-to-list): Fix duplicated names
+       appearing in buffer list (if a live buffer name matched a recentf
+       file basename).  Should use uniquify to offer a real solution.
 
-       * progmodes/grep.el (grep-compute-defaults): Fix handling of host
-       default settings (Bug#5928).
+2010-04-06  John Wiegley  <jwiegley@gmail.com>
+
+       * ido.el (ido-use-virtual-buffers, ido-virtual): Move a ChangeLog
+       comment to code, and add a :version tag.
+       (ido-virtual-buffers): Move defvar to fix byte-compiler warning.
 
-2010-04-10  Glenn Morris  <rgm@gnu.org>
+2010-04-06  Juanma Barranquero  <lekktu@gmail.com>
 
-       * progmodes/fortran.el (fortran-match-and-skip-declaration):
-       New function.
-       (fortran-font-lock-keywords-3): Use it.  (Bug#1385)
+       Enable recentf-mode if using virtual buffers.
+       * ido.el (recentf-list): Declare for byte-compiler.
+       (ido-virtual-buffers): Move up to silence byte-compiler. Add docstring.
+       (ido-make-buffer-list): Simplify.
+       (ido-add-virtual-buffers-to-list): Simplify.  Enable recentf-mode.
 
-2010-04-07  Kenichi Handa  <handa@m17n.org>
+2010-04-05  Juri Linkov  <juri@jurta.org>
 
-       * language/indian.el (malayalam-composable-pattern): Fix previous
-       change (add U+0D4D "SIGN VIRAMA").
-       (oriya-composable-pattern): Add U+0B30 and fix typo in the regexp.
-       (tamil-composable-pattern): Fix typo in the regexp.
-       (telugu-composable-pattern): Fix U+0C4D and typo in the regexp.
-       (kannada-composable-pattern): Fix U+0CB0 and typo in the regexp.
-       (malayalam-composable-pattern): Fix U+0D4D and typo in the regexp.
+       Scrolling commands which scroll a line instead of full screen.
+       http://lists.gnu.org/archive/html/emacs-devel/2010-03/msg01452.html
 
-2010-04-06  Chong Yidong  <cyd@stupidchicken.com>
+       * simple.el (scroll-up-line, scroll-down-line): New commands.
+       Put property isearch-scroll=t on them.
 
-       * textmodes/tex-mode.el (latex-mode): Revert 2008-03-03 change to
-       paragraph-separate (Bug#5821).
+       * emulation/ws-mode.el (scroll-down-line, scroll-up-line):
+       Remove commands.
 
 2010-04-05  Juri Linkov  <juri@jurta.org>
 
-       Put breadcrumbs on overlay instead of inserting to buffer (bug#5809).
+       Scrolling commands which do not signal errors at top/bottom.
+       http://lists.gnu.org/archive/html/emacs-devel/2010-03/msg01452.html
 
-       * info.el (Info-find-node-2): Comment out code that skips
-       breadcrumbs line.
-       (Info-mouse-follow-link): New command.
-       (Info-link-keymap): New keymap.
-       (Info-breadcrumbs): Rename from `Info-insert-breadcrumbs'.
-       Return a string with links instead of inserting breadcrumbs
-       to the Info buffer.
-       (Info-fontify-node): Comment out code that inserts breadcrumbs.
-       Instead of putting the `invisible' text property over the Info
-       header, make an overlay over the Info header with the `invisible'
-       property and `after-string' set to the string returned by
-       `Info-breadcrumbs'.
+       * simple.el (scroll-up-command, scroll-down-command): New commands.
+       Put property isearch-scroll=t on them.
 
-2010-04-03  Chong Yidong  <cyd@stupidchicken.com>
+       * bindings.el (global-map): Rebind [prior] from `scroll-down' to
+       `scroll-down-command' and [next] from `scroll-up' to
+       `scroll-up-command'.
 
-       * help.el (help-window-setup-finish): Doc fix (Bug#5830).
-       Reported by monkey@sandpframing.com.
+       * emulation/cua-base.el: Put property CUA=move on
+       `scroll-up-command' and `scroll-down-command'.
+       (cua--init-keymaps): Remap `scroll-up-command' to `cua-scroll-up'
+       and `scroll-down-command' to `cua-scroll-down'.
+
+2010-04-05  Juanma Barranquero  <lekktu@gmail.com>
+
+       * help.el (describe-mode): Return nil.
+
+2010-04-04  John Wiegley  <jwiegley@gmail.com>
+
+       * ido.el (ido-use-virtual-buffers): New variable to indicate
+       whether "virtual buffer" support is enabled for IDO.
+       (ido-virtual): Face used to indicate virtual buffers in the list.
+       (ido-buffer-internal): If a buffer is chosen, and no such buffer
+       exists, but a virtual buffer of that name does (which would be why
+       it was in the list), recreate the buffer by reopening the file.
+       (ido-make-buffer-list): If virtual buffers are being used, call
+       `ido-add-virtual-buffers-to-list' before the make list hook.
+       (ido-virtual-buffers): New variable which contains a copy of the
+       current contents of the `recentf-list', albeit pared down for the
+       sake of speed, and with proper faces applied.
+       (ido-add-virtual-buffers-to-list): Using the `recentf-list',
+       create a list of "virtual buffers" to present to the user in
+       addition to the currently open set.  Note that this logic could
+       get rather slow if that list is too large.  With the default
+       `recentf-max-saved-items' of 200, there is little speed penalty.
+
+2010-04-03  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * font-lock.el: Require CL when compiling.
+       (font-lock-turn-on-thing-lock): Use `case'.
+
+2010-04-03  Eli Zaretskii  <eliz@gnu.org>
+
+       * emacs-lisp/authors.el (authors-fixed-entries): Add entry for Eli
+       Zaretskii.
 
 2010-04-02  Juanma Barranquero  <lekktu@gmail.com>
 
        (semantic-create-imenu-directory-index): Fix typos in docstrings.
        (semantic-imenu-goto-function): Reflow docstring.
 
-2010-03-30  Tomas Abrahamsson  <tab@lysator.liu.se>
+2010-04-02  Juri Linkov  <juri@jurta.org>
+
+       * ehelp.el (electric-help-orig-major-mode):
+       New buffer-local variable.
+       (electric-help-mode): Set it to original major-mode.  Doc fix.
+       (with-electric-help): Use `electric-help-orig-major-mode' instead
+       of (default-value 'major-mode).  Doc fix.
+       http://lists.gnu.org/archive/html/emacs-devel/2010-04/msg00069.html
+
+2010-04-02  Sam Steingold  <sds@gnu.org>
+
+       * vc-hg.el (vc-hg-push, vc-hg-pull): Use `apply' when calling
+       `vc-hg-command' with a list of flags.
+
+       * progmodes/bug-reference.el (bug-reference-bug-regexp):
+       Also accept "patch" and "RFE".
+       (bug-reference-fontify): `bug-reference-url-format' can also be a
+       function to be able to handle the bug kind.
+       (turn-on-bug-reference-mode, turn-on-bug-reference-prog-mode): Add.
+
+2010-04-02  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * tmm.el (tmm-get-keymap): Check with symbolp before passing
+       value to fboundp, it may not be a symbol.
+
+2010-03-31  Chong Yidong  <cyd@stupidchicken.com>
+
+       * cus-edit.el (custom-buffer-sort-alphabetically): Update :version.
+
+2010-03-31  Juri Linkov  <juri@jurta.org>
+
+       * simple.el (next-line, previous-line): Re-throw a signal
+       with `signal' instead of using `ding'.
+       http://lists.gnu.org/archive/html/emacs-devel/2010-03/msg01432.html
+
+2010-03-31  Juri Linkov  <juri@jurta.org>
+
+       * simple.el (keyboard-escape-quit): Raise deselecting the active
+       region higher than exiting the minibuffer.
+       http://lists.gnu.org/archive/html/emacs-devel/2010-03/msg00904.html
+
+2010-03-31  Juri Linkov  <juri@jurta.org>
+
+       * image.el (image-animated-p): Use `image-metadata' instead of
+       `image-extension-data'.  Get GIF extenstion data from metadata
+       property `extension-data'.
+
+2010-03-31  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * simple.el (append-to-buffer): Simplify.
+
+2010-03-31  Tomas Abrahamsson  <tab@lysator.liu.se>
 
        * textmodes/artist.el (artist-mode): Fix typo in docstring.
        Reported by Alex Schröder <kensanata@gmail.com>.  (Bug#5807)
 
-2010-03-30  Kenichi Handa  <handa@m17n.org>
+2010-03-31  Kenichi Handa  <handa@m17n.org>
 
        * language/sinhala.el (composition-function-table): Fix regexp for
        the new Unicode specification.
        (telugu-composable-pattern): New variables to cope with the new
        Unicode specification.  Use them in composition-function-table.
 
-2010-03-29  Stefan Monnier  <monnier@iro.umontreal.ca>
+2010-03-31  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        Make tmm-menubar work for the Buffers menu again (bug#5726).
        * tmm.el (tmm-prompt): Also handle keymap entries in the form of
        vectors rather than cons cells, as used in menu-bar-update-buffers.
 
-2010-03-28  Chong Yidong  <cyd@stupidchicken.com>
+2010-03-31  Chong Yidong  <cyd@stupidchicken.com>
 
        * progmodes/js.el (js-auto-indent-flag, js-mode-map)
        (js-insert-and-indent): Revert 2009-08-15 change, restoring
 
        * mail/sendmail.el (mail-default-directory): Doc fix.
 
-2010-03-27  Chong Yidong  <cyd@stupidchicken.com>
+2010-03-31  Chong Yidong  <cyd@stupidchicken.com>
 
        * mail/sendmail.el (mail-default-directory): Doc fix.
 
-2010-03-27  Eli Zaretskii  <eliz@gnu.org>
+2010-03-31  Eli Zaretskii  <eliz@gnu.org>
 
        * subr.el (version-regexp-alist, version-to-list)
        (version-list-<, version-list-=, version-list-<=)
        (version-list-not-zero, version<, version<=, version=): Doc fix.
        (Bug#5744).
 
-2010-03-26  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
-            Nick Roberts  <nickrob@snap.net.nz>
-
-       * progmodes/gdb-ui.el (gdb-apple-test): New function.
-       (gdb-init-1): Use it.
-
-2010-02-10  Dan Nicolaescu  <dann@ics.uci.edu>
+2010-02-31  Dan Nicolaescu  <dann@ics.uci.edu>
 
        * vc.el (vc-root-diff): Doc fix.
 
-2010-03-25  Chong Yidong  <cyd@stupidchicken.com>
+2010-03-31  Chong Yidong  <cyd@stupidchicken.com>
 
        * vc.el (vc-print-log, vc-print-root-log): Doc fix.
 
        * simple.el (append-to-buffer): Fix last change.
 
-2010-03-24  Chong Yidong  <cyd@stupidchicken.com>
+2010-03-31  Chong Yidong  <cyd@stupidchicken.com>
 
        * simple.el (append-to-buffer): Ensure that point is preserved if
        BUFFER is the current buffer.  Suggested by YAMAMOTO Mitsuharu.
        (Bug#5749)
 
+2010-03-31  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * files.el (auto-mode-case-fold): Change default to t.
+
+2010-03-30  Juri Linkov  <juri@jurta.org>
+
+       * dired-x.el (dired-omit-mode): Doc fix.
+
+2010-03-30  Juri Linkov  <juri@jurta.org>
+
+       * replace.el (occur-accumulate-lines): Move occur-engine related
+       functions `occur-accumulate-lines' and `occur-engine-add-prefix'
+       to be located after `occur-engine'.
+
+2010-03-30  Juri Linkov  <juri@jurta.org>
+
+       Make occur handle multi-line matches cleanly with context.
+       http://lists.gnu.org/archive/html/emacs-devel/2010-03/msg01280.html
+
+       * replace.el (occur-accumulate-lines): Add optional arg `pt'.
+       (occur-engine): Add local variables `ret', `prev-after-lines',
+       `prev-lines'.  Use more arguments for `occur-context-lines'.
+       Set first elem of its returned list to `data', and the second elem
+       to `prev-after-lines'.  Don't print the separator line.
+       In the end, print remaining context after-lines.
+       (occur-context-lines): Add new arguments `begpt', `endpt',
+       `lines', `prev-lines', `prev-after-lines'.  Rewrite to combine
+       after-lines of the previous match with before-lines of the
+       current match and not overlap them.  Return a list with two
+       values: the output line and the list of context after-lines.
+
+2010-03-30  Juri Linkov  <juri@jurta.org>
+
+       * replace.el (occur-accumulate-lines): Fix a bug where the first
+       context line at the beginning of the buffer was missing.
+
+2010-03-30  Eli Zaretskii  <eliz@gnu.org>
+
+       * files.el: Make bidi-display-reordering safe variable for boolean
+       values.
+
+2010-03-29  Phil Hagelberg  <phil@evri.com>
+            Chong Yidong  <cyd@stupidchicken.com>
+
+       * subr.el: Extend progress reporters to perform "spinning".
+       (progress-reporter-update, progress-reporter-do-update):
+       Handle non-numeric value arguments.
+       (progress-reporter--pulse-characters): New var.
+
+2010-03-28  Chong Yidong  <cyd@stupidchicken.com>
+
+       * progmodes/compile.el (compilation-start): Fix regexp detection
+       of initial cd command (Bug#5771).
+
+2010-03-28  Stefan Guath  <stefan@automata.se>  (tiny change)
+
+       * find-dired.el (find-dired): Use read-directory-name (Bug#5777).
+
+2010-03-27  Nick Roberts  <nickrob@snap.net.nz>
+
+       Restore GDB/MI fuctionality removed by 2009-12-29T07:15:34Z!nickrob@snap.net.nz.
+       * lisp/progmodes/gdb-mi.el: Restore.
+       * lisp/progmodes/gdb-ui.el: Remove.
+       * lisp/progmodes/gud.el: Re-accommodate for gdb-mi.el.
+
+2010-03-25  Glenn Morris  <rgm@gnu.org>
+
+       * desktop.el (desktop-save-buffer-p): Don't mistakenly include
+       all dired buffers, even tramp ones.  (Bug#5755)
+
+2010-03-25  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       Add "union tags" in mpc.el.
+       * mpc.el: Remove backward compatibility code.
+       (mpc-browser-tags): Change default.
+       (mpc--find-memoize-union-tags): New var.
+       (mpc-cmd-flush, mpc-cmd-special-tag-p): New fun.
+       (mpc-cmd-find): Handle the case where the playlist does not exist.
+       Handle union-tags.
+       (mpc-cmd-list): Use mpc-cmd-special-tag-p.  Handle union-tags.
+       (mpc-cmd-add): Use mpc-cmd-flush.
+       (mpc-tagbrowser-tag-name): New fun.
+       (mpc-tagbrowser-buf): Use it.
+       (mpc-songs-refresh): Use cond.  Move to point-min as a fallback.
+
 2010-03-24  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+       Misc cleanup.
+       * progmodes/make-mode.el (makefile-bsdmake-rule-action-regex):
+       Use replace-regexp-in-string.
+       (makefile-mode-abbrev-table): Merge defvar and define-abbrev-table.
+       (makefile-imake-mode-syntax-table): Move init into defvar.
+       (makefile-mode): Use define-derived-mode.
+
        * progmodes/make-mode.el (makefile-rule-action-regex): Backtrack less.
        (makefile-make-font-lock-keywords): Adjust rule since submatch 1 may
        not be present any more.
 
        * cedet/srecode/table.el (srecode-template-table): Fix docstring typo.
 
-2010-03-23  Glenn Morris  <rgm@gnu.org>
+2010-03-24  Glenn Morris  <rgm@gnu.org>
 
        * textmodes/flyspell.el (sgml-lexical-context): Autoload it (Bug#5752).
 
-2010-03-21  Chong Yidong  <cyd@stupidchicken.com>
+2010-03-24  Chong Yidong  <cyd@stupidchicken.com>
 
        * indent.el (indent-for-tab-command): Doc fix.
 
-2010-03-22  Juanma Barranquero  <lekktu@gmail.com>
+2010-03-24  Alan Mackenzie  <acm@muc.de>
+
+       * progmodes/cc-engine.el (c-remove-stale-state-cache):
+       Fix off-by-one error.  Fixes bug #5747.
+
+2010-03-24  Juanma Barranquero  <lekktu@gmail.com>
 
        * image-dired.el (image-dired-display-thumbs): Fix typo in docstring.
        (image-dired-read-comment): Doc fix.
        (reftex-cite-punctuation, reftex-search-unrecursed-path-first)
        (reftex-highlight-selection): Fix typos in docstrings.
 
-2010-03-19  Juanma Barranquero  <lekktu@gmail.com>
+2010-03-24  Juanma Barranquero  <lekktu@gmail.com>
 
        * minibuffer.el (completion-in-region-functions): Fix docstring typos.
 
-2010-03-18  Glenn Morris  <rgm@gnu.org>
+2010-03-24  Glenn Morris  <rgm@gnu.org>
 
        * mail/rmail.el (rmail-highlight-face): Restore option deleted
        2008-02-13 without comment; mark it obsolete.
        (rmail-highlight-headers): Use rmail-highlight-face once more.
 
-2010-03-16  Chong Yidong  <cyd@stupidchicken.com>
+2010-03-24  Chong Yidong  <cyd@stupidchicken.com>
 
        * woman.el (woman2-process-escapes): Only consume the newline if
        the filler character is on a line by itself (Bug#5729).
 
-2010-03-16  Kenichi Handa  <handa@m17n.org>
+2010-03-24  Kenichi Handa  <handa@m17n.org>
 
        * language/indian.el (devanagari-composable-pattern): Add more
        consonants.
 
-2010-03-14  Michael Albinus  <michael.albinus@gmx.de>
+2010-03-24  Michael Albinus  <michael.albinus@gmx.de>
 
        * net/trampver.el: Update release number.
 
-2010-03-13  Glenn Morris  <rgm@gnu.org>
+2010-03-24  Glenn Morris  <rgm@gnu.org>
 
        * Makefile.in (ELCFILES): Add cedet/semantic/imenu.el.
 
-2010-03-13  Michael Albinus  <michael.albinus@gmx.de>
+2010-03-24  Michael Albinus  <michael.albinus@gmx.de>
 
        * net/tramp.el (tramp-find-executable):
        Use `tramp-get-connection-buffer'.  Make the regexp for checking
        (tramp-open-connection-setup-interactive-shell): Remove workaround
        for OpenSolaris bug, it is not needed anymore.
 
-2010-03-13  Eric M. Ludlam  <zappo@gnu.org>
+2010-03-24  Eric M. Ludlam  <zappo@gnu.org>
 
        * cedet/semantic/imenu.el: New file, from the CEDET repository
        (Bug#5412).
 
-2010-03-12  Glenn Morris  <rgm@gnu.org>
+2010-03-24  Glenn Morris  <rgm@gnu.org>
 
        * emacs-lisp/cl-macs.el (defsubst*): Add autoload cookie.  (Bug#4427)
 
-2010-03-11  Wilson Snyder  <wsnyder@wsnyder.org>
+2010-03-24  Wilson Snyder  <wsnyder@wsnyder.org>
 
        * files.el (auto-mode-alist): Accept more verilog file patterns.
 
+2010-03-24  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * vc-dir.el (vc-dir-headers): Abbreviate the working dir.
+
+2010-03-24  Glenn Morris  <rgm@gnu.org>
+
+       * vc-bzr.el (vc-bzr-log-edit-mode): Add --fixes support to
+       log-edit-before-checkin-process.
+
+       * vc.el (vc-modify-change-comment): Pass MODE to vc-start-logentry.
+
+       * vc.el, vc-bzr.el, vc-hg.el (log-edit-mode): Declare.
+
+       * vc-dispatcher.el (vc-start-logentry): Doc fix.
+       (log-view-process-buffer, log-edit-extra-flags): Declare.
+
+       * log-edit.el (log-edit-before-checkin-process): Doc fix.
+
+       * cedet/semantic/bovine/c.el (semantic-c-describe-environment):
+       Consistently check ede-object is bound throughout.
+
+       * cedet/ede/project-am.el (ede-shell-run-something): Declare.
+
+2010-03-23  Sam Steingold  <sds@gnu.org>
+
+       Fix bug#5620: recalculate all markers on compilation buffer
+       modifications, not on file modifications.
+       * progmodes/compile.el (buffer-modtime): New buffer-local variable:
+       the buffer modification time, for buffers not associated with files.
+       (compilation-mode): Create it.
+       (compilation-filter): Update it.
+       (compilation-next-error-function): Use it instead of
+       `visited-file-modtime' for timestamp.
+
+2010-03-23  Juri Linkov  <juri@jurta.org>
+
+       Implement Occur multi-line matches.
+       http://lists.gnu.org/archive/html/emacs-devel/2010-03/msg01044.html
+
+       * replace.el (occur): Doc fix.
+       (occur-engine): Set `begpt' to the beginning of the first line.
+       Set `endpt' to the end of the last match line.  At first, count
+       line numbers between `origpt' and `begpt'.  Split out code from
+       `out-line' variable to new let-bindings `match-prefix' and
+       `match-str'.  In `out-line' add non-numeric prefix to all
+       non-first lines of multi-line matches.  Finally, count lines
+       between `begpt' and `endpt' and add to `lines'.
+
+2010-03-23  Juri Linkov  <juri@jurta.org>
+
+       * replace.el (occur-accumulate-lines, occur-engine):
+       Use `occur-engine-line' instead of duplicate code.
+       (occur-engine-line): New function created from duplicate code
+       in `occur-accumulate-lines' and `occur-engine'.
+
+       * replace.el (occur-engine-line): Add optional arg `keep-props'.
+       (occur-accumulate-lines, occur-engine): Add arg `keep-props'.
+
+2010-03-23  Juri Linkov  <juri@jurta.org>
+
+       * finder.el: Remove TODO tasks.
+
+       * info.el (Info-finder-find-node): Add node "all"
+       with all package info.  Handle a list of multiple keywords
+       separated by comma.
+       (info-finder): In interactive use with a prefix argument,
+       use `completing-read-multiple' to read a list of keywords
+       separated by comma.
+
+2010-03-23  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       Add a new completion style `substring'.
+       * minibuffer.el (completion-basic--pattern): New function.
+       (completion-basic-try-completion, completion-basic-all-completions):
+       Use it.
+       (completion-substring--all-completions)
+       (completion-substring-try-completion)
+       (completion-substring-all-completions): New functions.
+       (completion-styles-alist): New style `substring'.
+
+2010-03-22  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       Get rid of .elc files after removal of the corresponding .el.
+       * Makefile.in (compile-clean): New target.
+       (compile-main): Use it.
+
+2010-03-22  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * Makefile.in (compile-main): cd to $(lisp) in a sub-shell, so we
+       don't do make there.  When compiling with separate object dir, there
+       is no Makefile there.
+
+2010-03-22  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       Get rid of the ELCFILES abomination, again.
+       * Makefile.in (update-elclist, ELCFILES, compile-last): Remove.
+       (all, compile): Don't call compile-last.
+       (compile-main): Build the "elcfiles" list dynamically.
+       (compile-targets): New (internal) target.
+
+2010-03-21  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * Makefile.in (top_srcdir): Define.
+       (abs_top_builddir): Define.
+       (srcdir): Don't append `/..'.
+       (EMACS): Use ${abs_top_builddir}.
+       (all, compile, compile-always, compile-last): Don't set emacswd.
+       (update-subdirs, update-authors): Use $(top_srcdir) instead of
+       $(srcdir).
+       (lisp): Use $(srcdir) instead of @srcdir@.
+
+2010-03-21  Juri Linkov  <juri@jurta.org>
+
+       Fix message of multi-line occur regexps and multi-buffer header lines.
+       http://lists.gnu.org/archive/html/emacs-devel/2010-03/msg00457.html
+
+       * replace.el (occur-1): Don't display regexp if it is longer
+       than window-width.  Use `query-replace-descr' to display regexp.
+       (occur-engine): Don't display regexp in the buffer header for
+       multi-buffer occur.  Display a separate header line with total
+       match count and regexp for multi-buffer occur.
+       Use `query-replace-descr' to display regexp.
+
+2010-03-20  Teodor Zlatanov  <tzz@lifelogs.com>
+
+       * net/secrets.el: Fix parenthesis.
+       (secrets-enabled): Fix parenthesis.
+
+2010-03-20  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       Use more relative file and directory names.
+       * Makefile.in (EMACS): Arrange for it to work when we chdir.
+       (setwins, setwins_almost, setwins_for_subdirs):
+       Don't `cd'; output relative names.
+       (all, compile, compile-always, compile-last): Set emacswd.
+       (custom-deps, finder-data, autoloads, update-subdirs, compile-last):
+       Just cd to the lisp source dir so we can use relative file names.
+
+       * outline.el (hide-sublevels): Unfix the paren non-typo! (bug#5738).
+
+2010-03-20  Glenn Morris  <rgm@gnu.org>
+
+       * textmodes/rst.el: Use faces for font-lock customization, and make the
+       old -face variables obsolete.
+       (rst-block, rst-external, rst-definition, rst-directive, rst-comment)
+       (rst-emphasis1, rst-emphasis2, rst-literal, rst-reference): New faces.
+       (rst-block-face, rst-external-face, rst-definition-face)
+       (rst-directive-face, rst-comment-face, rst-emphasis1-face)
+       (rst-emphasis2-face, rst-literal-face, rst-reference-face):
+       Make obsolete.
+       (rst-font-lock-keywords-function): Update for above changes.
+
+2010-03-20  Juri Linkov  <juri@jurta.org>
+
+       * s-region.el:
+       * obsolete/s-region.el: Move to obsolete.
+
+2010-03-19  Juanma Barranquero  <lekktu@gmail.com>
+
+       * vc-dispatcher.el (vc-do-command): Remove reference to `vc-path'.
+
+2010-03-19  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * vc-hooks.el (vc-path): Remove variable and obsolete declaration.
+
+2010-03-19  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       Add special markup processing for commit logs.
+       * log-edit.el (log-edit-extra-flags): New variable.
+       (log-edit): Add new argument MODE.  Use that mode when non-nil
+       instead of the log-view-mode.
+       (log-view-process-buffer): New function.
+
+       * vc.el: Document that the checkin method takes optional
+       arguments.  Document new backend specific method: log-view-mode.
+       (vc-default-log-edit-mode): New function.
+       (vc-checkin): Use a backend specific log-view-mode.
+       Pass extra arguments to the checkin method.
+       (vc-modify-change-comment): Pass a dummy extra argument.
+
+       * vc-dispatcher.el (vc-log-edit): Add a mode argument, pass it to
+       log-edit.
+       (vc-start-logentry): Add a mode argument, pass it to vc-log-edit.
+       (vc-finish-logentry): Process the log buffer before passing it
+       down.  Pass log-edit-extra-flags.
+
+       * vc-bzr.el (vc-bzr-checkin): Pass extra arguments to the commit
+       command.
+       (log-edit-extra-flags, log-edit-before-checkin-process):
+       New declarations.
+
+       * vc-hg.el (vc-hg-checkin): Pass extra arguments to the commit
+       command.
+       (log-edit-extra-flags, log-edit-before-checkin-process):
+       New declarations.
+       (vc-hg-log-edit-mode): New derived mode.
+
+       * vc-arch.el (vc-arch-checkin):
+       * vc-cvs.el (vc-cvs-checkin):
+       * vc-git.el (vc-git-checkin):
+       * vc-mtn.el (vc-mtn-checkin):
+       * vc-rcs.el (vc-rcs-checkin):
+       * vc-sccs.el (vc-sccs-checkin):
+       * vc-svn.el (vc-svn-checkin): Add an optional ignored argument.
+
+2010-03-19  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * outline.el (hide-sublevels): Don't hide trailing newline (and fix
+       parent typo).
+
+2010-03-19  Glenn Morris  <rgm@gnu.org>
+
+       * password-cache.el (password-cache, password-cache-expiry): Autoload.
+
+2010-03-18  Glenn Morris  <rgm@gnu.org>
+
+       * emacs-lisp/autoload.el (autoload-rubric): Doc fix.
+
+       * replace.el (query-replace-history): Give it a doc string.
+       (map-query-replace-regexp): Use query-replace-from-history-variable
+       and query-replace-to-history-variable.
+
+       * mail/hashcash.el (declare-function): Remove duplicate definition.
+
+       * mail/emacsbug.el (report-emacs-bug-pretest-address):
+       Make it an obsolete alias for report-emacs-bug-address.
+       (message-strip-special-text-properties): Declare.
+       (report-emacs-bug): Remove test for a pretest bug address.
+       Combine message-mode-specific code.
+
+       * mail/supercite.el: Don't require sendmail.
+       (mh-in-header-p): Declare rather than using with-no-warnings.
+       (sc-no-blank-line-or-header): Use rfc822-goto-eoh rather than
+       mail-header-end.  Don't bind mysterious variable `kill-lines-magic'.
+
+       * calendar/cal-french.el: Convert to utf-8.
+
+       * files.el (interpreter-mode-alist): Use emacs-lisp-mode for
+       Emacs scripts.
+
+2010-03-16  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/secrets.el (secrets-enabled): New variable.  Use it instead
+       of a subfeature.
+
+2010-03-15  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/secrets.el (top): Register the D-Bus signals only when the
+       service "org.freedesktop.secrets" can be pinged.
+       Provide subfeature `enabled'.
+
+2010-03-14  Juri Linkov  <juri@jurta.org>
+
+       Add finder unknown keywords.
+
+       * finder.el (finder-unknown-keywords): New function.
+
+       * info.el (Info-finder-find-node): Use `finder-unknown-keywords'
+       to create a Finder node with unknown keywords.
+
+2010-03-14  Juri Linkov  <juri@jurta.org>
+
+       * finder.el (finder-compile-keywords): Replace `princ' with
+       `prin1' on a list of symbols interned from keyword strings.
+
+       * emacs-lisp/lisp-mnt.el (lm-keywords-list): If `keywords' contains
+       a comma, then split keywords using a comma and optional whitespace.
+       Otherwise, split by whitespace.
+
+       * complete.el:
+       * face-remap.el:
+       * log-view.el:
+       * net/hmac-def.el:
+       * net/hmac-md5.el:
+       * net/netrc.el:
+       * progmodes/mixal-mode.el: Fix keywords.
+
+2010-03-13  Michael Albinus  <michael.albinus@gmx.de>
+
+       * Makefile.in (ELCFILES): Add net/secrets.elc.
+
+       * net/secrets.el: New file.
+
+2010-03-12  Chong Yidong  <cyd@stupidchicken.com>
+
+       * facemenu.el (list-colors-display, list-colors-print): New arg
+       callback.  Use it to allow selecting colors.
+
+       * wid-edit.el (widget-image-insert): Insert image prop even if the
+       current display is non-graphic.
+       (widget-field-value-set): New fun.
+       (editable-field): Use it.
+       (widget-field-value-get): Clean up unused var.
+       (widget-color-value-create, widget-color--choose-action):
+       New funs.  Allow using list-colors-display to choose color.
+
+2010-03-12  Chong Yidong  <cyd@stupidchicken.com>
+
+       * cus-edit.el: Resort topmost custom groups.
+       (custom-buffer-sort-alphabetically): Default to t.
+       (customize-apropos): Use apropos-parse-pattern.
+       (custom-search-field): New var.
+       (custom-buffer-create-internal): Add custom-apropos search field.
+       (custom-add-parent-links): Don't display parent doc.
+       (custom-group-value-create): Don't sort top-level custom group.
+       (custom-magic-value-create): Show visibility button before option name.
+
+       (custom-variable-state): New fun, from custom-variable-state-set.
+       (custom-variable-state-set): Use it.
+       (custom-group-value-create): Hide options with standard values
+       using the :hidden-states property.  Use progress reporter.
+
+       (custom-show): Simplify.
+       (custom-visibility): Disable images by default.
+       (custom-variable): New property :hidden-states.
+       (custom-variable-value-create): Enable images for
+       custom-visibility widgets.  Use :hidden-states property to
+       determine initial visibility.
+
+       * wid-edit.el (widget-image-find): Give images center ascent.
+       (visibility): Add :on-image and :off-image properties.
+       (widget-visibility-value-create): Use them.
+
+2010-03-12  Chong Yidong  <cyd@stupidchicken.com>
+
+       * cus-edit.el (processes): Remove from development group.
+       (oop, hypermedia): Delete group.
+       (comm): Promote to top-level group.
+
+       * net/browse-url.el (browse-url):
+       * net/xesam.el (xesam):
+       * net/tramp.el (tramp):
+       * net/goto-addr.el (goto-address):
+       * net/ange-ftp.el (ange-ftp): Put in comm group.
+
+       * view.el (view): Remove from editing group.
+
+       * uniquify.el (uniquify): Put in files group.
+
+       * net/browse-url.el (browse-url):
+       * ps-print.el (postscript): Put in external group.
+
+       * cus-edit.el (outlines):
+       * textmodes/text-mode.el (text-mode-hook):
+       * textmodes/table.el (table):
+       * textmodes/picture.el (picture):
+       * outline.el (outlines): Put in wp group.
+
+       * nxml/nxml-mode.el (nxml): Remove from wp group.
+
+       * net/tramp-imap.el (tramp-imap): Put in tramp group.
+
+       * mail/metamail.el (metamail): Remove from hypermedia group.
+
+       * cus-edit.el (abbrev):
+       * whitespace.el (whitespace):
+       * vcursor.el (vcursor):
+       * reveal.el (reveal):
+       * hl-line.el (hl-line): Put in convenience group.
+
+       * epg-config.el (epg): Put in data group.
+
+       * emulation/pc-select.el (pc-select): Put in emulations group.
+
+       * calculator.el (calculator): Put in applications group.
+
+2010-03-12  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       Add .dir-locals.el support for file-less buffers.
+       * files.el (hack-local-variables): Split out code to apply local
+       variable settings ...
+       (hack-local-variables-apply): ... here.  New function.
+       (hack-dir-local-variables): Use the default directory for when the
+       buffer does not have an associated file.
+       (hack-dir-local-variables-non-file-buffer): New function.
+       * diff-mode.el (diff-mode):
+       * vc-annotate.el (vc-annotate-mode):
+       * vc-dir.el (vc-dir-mode):
+       * log-edit.el (log-edit-mode):
+       * log-view.el (log-view-mode): Call hack-dir-local-variables-non-file-buffer.
+
+2010-03-12  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       Add support for shelving snapshots and for showing shelves.
+       * vc-bzr.el (vc-bzr-shelve-show, vc-bzr-shelve-show-at-point)
+       (vc-bzr-shelve-apply-and-keep-at-point, vc-bzr-shelve-snapshot):
+       New functions.
+       (vc-bzr-shelve-map, vc-bzr-shelve-menu-map)
+       (vc-bzr-extra-menu-map): Map them.
+
+2010-03-11  Glenn Morris  <rgm@gnu.org>
+
+       * cus-edit.el (customize-changed-options-previous-release):
+       Bump to 23.1.
+
+       * image.el (image-animate-max-time): Fix :version tag.
+
+2010-03-10  Chong Yidong  <cyd@stupidchicken.com>
+
+       * Branch for 23.2.
+
+2010-03-10  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * vc-git.el (vc-git-revision-table): Include remote branches.
+
+2010-03-10  Kim F. Storm  <storm@cua.dk>
+
+       Animated image API.
+       http://lists.gnu.org/archive/html/emacs-devel/2010-03/msg00211.html
+
+       * image.el (image-animate-max-time): New defcustom.
+       (image-animated-types): New defconst.
+       (create-animated-image, image-animate-timer)
+       (image-animate-start, image-animate-stop, image-animate-timeout)
+       (image-animated-p): New functions.
+
+       * image-mode.el (image-toggle-display-image):
+       Replace `create-image' with `create-animated-image'.
+
 2010-03-09  Miles Bader  <miles@gnu.org>
 
        * vc-git.el (vc-git-print-log): Use "tformat:" for shortlog,
 
 2010-03-07  Štěpán Němec  <stepnem@gmail.com>  (tiny change)
 
-       * vc-git.el (vc-git-annotate-extract-revision-at-line): Use
-       vc-git-root as default directory for revision path (Bug#5657).
+       * vc-git.el (vc-git-annotate-extract-revision-at-line):
+       Use vc-git-root as default directory for revision path (Bug#5657).
 
 2010-03-06  Chong Yidong  <cyd@stupidchicken.com>
 
 2010-02-28  Michael Albinus  <michael.albinus@gmx.de>
 
        * net/dbus.el (dbus-introspect, dbus-get-property)
-       (dbus-set-property, dbus-get-all-properties): Use
-       `dbus-call-method' when noninteractive.  (Bug#5645)
+       (dbus-set-property, dbus-get-all-properties):
+       Use `dbus-call-method' when noninteractive.  (Bug#5645)
 
 2010-02-28  Chong Yidong  <cyd@stupidchicken.com>
 
 2010-02-03  Michael Albinus  <michael.albinus@gmx.de>
 
        * net/ange-ftp.el (ange-ftp-insert-directory): Parse directory
-       also in case of (and (not full) (not wildcard)). This is needed,
+       also in case of (and (not full) (not wildcard)).  This is needed
        when dired is called with a list of files, which are not in
        `default-directory'.  (Bug#5478)
 
 2010-01-21  Alan Mackenzie  <acm@muc.de>
 
        Fix a situation where deletion of a cpp construct throws an error.
-       * progmodes/cc-engine.el (c-invalidate-state-cache): Before
-       invoking c-with-all-but-one-cpps-commented-out, check that the
+       * progmodes/cc-engine.el (c-invalidate-state-cache):
+       Before invoking c-with-all-but-one-cpps-commented-out, check that the
        special cpp construct is still in the buffer.
        (c-parse-state): Record the special cpp with markers, not numbers.
 
 
 2010-01-02  Karl Fogel  <kfogel@red-bean.com>
 
-       * bookmark.el (bookmark-bmenu-any-marks): New function
+       * bookmark.el (bookmark-bmenu-any-marks): New function.
        (bookmark-bmenu-save): Clear buffer modification if no marks.
 
 2010-01-02  Karl Fogel  <kfogel@red-bean.com>
 
 2009-12-18  Ulf Jasper  <ulf.jasper@web.de>
 
-       * calendar/icalendar.el (icalendar--convert-tz-offset): Fixed
-       timezone names.
-       (icalendar--convert-tz-offset): Fixed the "last-day-problem".
+       * calendar/icalendar.el (icalendar--convert-tz-offset):
+       Fix timezone names.
+       (icalendar--convert-tz-offset): Fix the "last-day-problem".
        (icalendar--add-diary-entry): Remove the trailing blank that
        diary-make-entry inserts.
 
        (tramp-advice-file-expand-wildcards): Remove it.
 
        * net/tramp-compat.el (top): Autoload `tramp-handle-file-remote-p'.
-       (tramp-advice-file-expand-wildcards): Moved from tramp.el.
+       (tramp-advice-file-expand-wildcards): Move from tramp.el.
        Activate advice for older GNU Emacs versions.  (Bug#5237)
 
 2009-12-17  Juanma Barranquero  <lekktu@gmail.com>
 
        * files.el (hack-local-variables-filter): While ignoring duplicates,
        don't take `mode' into account.
-       (hack-local-variables-filter, hack-dir-local-variables): Don't
-       remove duplicate `mode' from local-variables-alist (like `eval').
+       (hack-local-variables-filter, hack-dir-local-variables):
+       Don't remove duplicate `mode' from local-variables-alist (like `eval').
 
 2009-12-17  Juri Linkov  <juri@jurta.org>
 
-       Make `dired-diff' more safe.  (Bug#5225)
+       Make `dired-diff' safer.  (Bug#5225)
 
        * dired-aux.el (dired-diff): Signal an error when `file' equals to
        `current' or when `file' is a directory of the `current' file.
 
 2009-12-10  Vinicius Jose Latorre  <viniciusjl@ig.com.br>
 
-       * whitespace.el (whitespace-display-char-on): Ensure
-       `buffer-display-table' is unique when two or more windows are
+       * whitespace.el (whitespace-display-char-on):
+       Ensure `buffer-display-table' is unique when two or more windows are
        visible.  Reported by Martin Pohlack <mp26@os.inf.tu-dresden.de>.
        New version 12.1.
 
 
 2009-12-09  Vivek Dasmohapatra  <vivek@etla.org>
 
-       Drop some properties to avoid surprises.
+       Drop some properties to avoid surprises (bug#5002).
        * htmlfontify.el (hfy-ignored-properties): New defcustom.
        (hfy-fontify-buffer): Use it.
 
        * Makefile.in (ELCFILES): Adapt to subword.el move.
 
 2009-11-21  Thierry Volpiatto  <thierry.volpiatto@gmail.com>
-           Stefan Monnier  <monnier@iro.umontreal.ca>
+            Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * bookmark.el (bookmark-bmenu-bookmark-column): Remove var.
        (bookmark-bmenu-list): Save name on `bookmark-name-prop' text-prop.
 
        * textmodes/fill.el: Convert to utf-8 encoding.
        (fill-french-nobreak-p): Remove redundant » and « inherited from our
-       pre-unicode days.
+       pre-Unicode days.
 
        * add-log.el (change-log-fill-forward-paragraph): New function.
        (change-log-mode): Use it so fill-region DTRT.
        indent buffer only if called interactively (Bug#4452).
 
 2009-09-19  Juanma Barranquero  <lekktu@gmail.com>
-           Eli Zaretskii  <eliz@gnu.org>
+            Eli Zaretskii  <eliz@gnu.org>
 
        This fixes bug#4197 (merged to bug#865, though not identical).
        * server.el (server-auth-dir): Add docstring note about FAT32.
        Don't call substitute-in-file-name on diary-file.
 
 2009-09-03  Eduard Wiebe  <usenet@pusto.de>
-           Stefan Monnier  <monnier@iro.umontreal.ca>
+            Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * mail/footnote.el (footnote-prefix): Make it a defcustom.
        (footnote-mode-map): Move initialization into the declaration.
        * progmodes/hideshow.el (hs-special-modes-alist): Add js-mode entry.
 
 2009-08-14  Daniel Colascione  <dan.colascione@gmail.com>
-           Karl Landstrom  <karl.landstrom@brgeight.se>
+            Karl Landstrom  <karl.landstrom@brgeight.se>
 
        * progmodes/js.el: New file.
 
        XZ is the successor to LZMA: <http://tukaani.org/xz/>
 
 2009-06-22  Dmitry Dzhus  <dima@sphinx.net.ru>
-           Nick Roberts  <nickrob@snap.net.nz>
+            Nick Roberts  <nickrob@snap.net.nz>
 
        * progmodes/gdb-mi.el: Pull further modified changes from Dmitry's
        repository (http://sphinx.net.ru/hg/gdb-mi/).
index dd96ee162f19508b596934c260de008e3d5cfc11..b33b6c62532c32a0773260893a853bfdf81c95ed 100644 (file)
 
 1986-03-15  Bill Rozas  (jinx@prep)
 
-       * scheme.el: (scheme-zap-name) Uses expand-file-name to obtain an
+       * scheme.el (scheme-zap-name): Uses expand-file-name to obtain an
        absolute pathname.
 
 1986-03-15  Richard M. Stallman  (rms@prep)
 
 1986-03-13  Bill Rozas  (jinx@prep)
 
-       * scheme.el: (scheme-zap-name) change it back to fromedit.zap
+       * scheme.el (scheme-zap-name): Change it back to fromedit.zap
        since that is where scheme expects it and it is too much work to
        change scheme right now.  This interface is obsolete anyway, but
        some people (athena) still use it.
        * info.el (Info-find-node):
        Fix braino.
        Also, allow abbreviations for node names.
-       Info-tagify:  insert tags in forward order so that
+       (Info-tagify): Insert tags in forward order so that
        an abbrev finds the textually first possibility rather than the
        last.
 
 
 1986-01-18  Richard M. Stallman  (rms@prep)
 
-       * doctor.el:  Fix typo "symtoms".
+       * doctor.el: Fix typo "symtoms".
 
 1986-01-10  Richard Mlynarik  (mly@prep)
 
 1985-12-27  Richard Mlynarik  (mly@prep)
 
        * view.el:
-       Various:  Fix cases of "view" => "View" which were missed.  Damn.
+       Various: Fix cases of "view" => "View" which were missed.  Damn.
 
 1985-12-27  Richard M. Stallman  (rms@prep)
 
        * files.el (normal-mode):
        New command to choose major mode automatically.
 
-       * inc-vers.el:  Renamed from inc-version.el
+       * inc-vers.el: Renamed from inc-version.el
        for file name length reasons.
 
        * term/*.el: terminal-specific files found here now.
        * info.el:
        (Info-select-node): Was searching unboundedly for "execute:".
        (Info-follow-reference): Was called Info-footnote.
-         Also, handle presence of spaces and newlines in ref names.
+        Also, handle presence of spaces and newlines in ref names.
        (Info-extract-menu-node-name): Handle presence of spaces and
         newlines in the node name.
        (Info-menu): Handle presence of spaces and newlines in item
        in the *compilation* buffer, thus allowing buffers to have local
        compilation-error-regexp variables.
 
-       (provide 'compile)
-
 1985-12-05  Richard M. Stallman  (rms@prep)
 
        * files.el (recover-file):
 
 1985-11-27  Richard Mlynarik  (mly@prep)
 
-       * rnews.el: (news-mode, news-set-mode-line):
+       * rnews.el (news-mode, news-set-mode-line):
        Get rid of news-mode-group-string.
 
        * rnews.el (news-unsubscribe-internal):
 1985-10-28  Richard M. Stallman  (rms@prep)
 
        * rmail.el, rmailsum.el, rmailkwd.el, rmailmsc.el,
-         rmailout.el, rmailedit.el:
+       * rmailout.el, rmailedit.el:
        Install thoroughly rewritten rmail with many new features.
 
        * debug.el (debug, debugger-mode):
 
        * mouseinit.el
        Delete this file.  Put its contents in files
-       term-bg.el, term-bgnv.el, term-bgrv.el, term-bbn.el
+       term-bg.el, term-bgnv.el, term-bgrv.el, term-bbn.el.
        (Perhaps there should be a subdirectory emacs/lisp/term/ ??)
 
 1985-10-23  Richard M. Stallman  (rms@prep)
 
 1985-10-17  Richard Mlynarik  (mly@mit-prep)
 
-       * rnews.el: (news-save-item-in-file)
+       * rnews.el (news-save-item-in-file):
        Append to file, rather than overwriting.
 
        * isearch.el
 
        * texinfo.el:
        Change syntax for @xref and @pxref to use braces.
-       Change syntax for @node to read entire line
+       Change syntax for @node to read entire line.
        (new function texinfo-format-parse-line-args for that).
        Change paragraph-separate, etc., so only directives without
        braces separate paragraphs.  When formatting, discard all of the
        "c-continued-statement-offset" as in the documentation and manual
 
        * rmail.el (rmail-find):
-       Hack default of last search string, hack reverse search
-       (-ve prefix arg)
+       Hack default of last search string, hack reverse search.
+       (-ve prefix arg):
        Make "-" be negative-argument
 
 1985-07-23  Richard Mlynarik  (mly@mit-prep)
        No, this directory is added automatically to the path
        used by call-process.  It should have worked before. - RMS
 
-       * loaddefs.el:  C-z -> C-c in documentation for mail.
+       * loaddefs.el: C-z -> C-c in documentation for mail.
        autoload report-emacs-bug from emacsbug.el.
 
-       * emacsbug.el:  New file.  Reports bugs with version info.
+       * emacsbug.el: New file.  Reports bugs with version info.
 
        * helper.el (Helper-describe-bindings):
        Make it describe local bindings faster by binding global map to
 
        * lisp-mode.el: First form of prog1 is distinguished.
 
-       * loaddefs.el: autoload functions from chistory.el and echistory.el.
+       * loaddefs.el: Autoload functions from chistory.el and echistory.el.
 
        * chistory.el:
        New file containing two alternatives to `repeat-complex-command'
 
 1985-06-11  K. Shane Hartman  (shane@mit-prep)
 
-       * ebuff-menu.el:  Make M-C-v scroll-other-window instead of
+       * ebuff-menu.el: Make M-C-v scroll-other-window instead of
        scroll-down.  Make M-v scroll-down.
 
-       * ebuff-menu.el, echistory.el:  Made them use electric.
+       * ebuff-menu.el, echistory.el: Made them use electric.
 
        * electric.el:
        New module for packages that retain control until some event
        Made it use helper.el.  Remove kill-ring-save stuff pending use of
        new winning prin1-to-string for minibuffer hacking.
 
-       * view.el:  Made it use helper.el.
+       * view.el: Made it use helper.el.
 
        * helper.el:
        New module for packages which want to do help without giving up
 
 1985-06-01  K. Shane Hartman  (shane@mit-prep)
 
-       * loaddefs.el:  Update documentation for rmail.
+       * loaddefs.el: Update documentation for rmail.
 
        * lisp-mode.el (calculate-lisp-indent):
        Asked (fboundp 'lisp-indent-hook).  Right question is boundp.
        Skip strings, comments, char constants.
        Find symbols even if they have no letters in them.
 
-       * mlsupport.el:  Insert symbol-value call in use-local-map.
+       * mlsupport.el: Insert symbol-value call in use-local-map.
        Handle key codes > 127 in local-bind-to-key.
        Write ml-modify-syntax-entry.
 
 
        * sendmail.el, loaddefs.el
        added send-mail-function; initially sendmail-send-it
-       (also, mail-yank-ignored-headers had a typo)
+       (also, mail-yank-ignored-headers had a typo).
 
        * rmail.el (rmail-get-new-mail, convert-to-babyl-format, ...)
-         loaddefs.el
+       * loaddefs.el:
        Remodularize inbox parsing.  Add support(?) for mmdf inboxes.
        Note that I can't seem to define definitive documentation of
        what this format is; however the code installed seems to work
 1985-05-16  K. Shane Hartman  (shane@mit-prep)
 
        * dired.el: Put dired-rename-file, dired-copy file-on keys.  Make
-       them change buffer if appropriate.  Put dired-mark-backup-files,
+       them change buffer if appropriate.  Put dired-mark-backup-files,
        dired-mark-temp-files on keys.  Eliminate possibility of looping
        at last line in dired-repeat-over-filenames.
 
        replace loop so that replacing continues after moving back to
        previous.
 
-       * add-log.el: add prefix arg to add-change-log-entry so will
+       * add-log.el: Add prefix arg to add-change-log-entry so will
        prompt for information if desired.  If there is an entry for today,
        make sure login-name is same before using it, else make new entry.
        Use auto-fill-mode.
 
 1985-05-12  Richard M. Stallman  (rms@mit-prep)
 
-       * lisp-mode.el: defined lisp-mode-commands, lisp-mode-variables.
+       * lisp-mode.el: Defined lisp-mode-commands, lisp-mode-variables.
        Added external-lisp-mode.
        Made doc strings mention mode hook variables.
 
-       * shell.el: defined functions `lisp' and `inferior-lisp-mode'.
+       * shell.el: Defined functions `lisp' and `inferior-lisp-mode'.
        Renamed shell-send-defun... to lisp-send-defun...
        and made them use process "lisp", buffer *lisp*.
 
-       * text-mode.el: made indented-text-mode not call text-mode.
+       * text-mode.el: Made indented-text-mode not call text-mode.
        Made doc strings mention mode hook variables.
 
        * c-mode.el: Made doc strings mention mode hook variables.
 
-       * add-log.el
+       * add-log.el:
        Change format used for change log entries.
        Select indented-text-mode for the change log file.
 
 1985-05-12  K. Shane Hartman  (shane@mit-ajax)
-       simple.el: suppress matching close paren if preceded
+
+       * simple.el: Suppress matching close paren if preceded
                by char syntax \.
-       mim-mode.el: flush private paren blinker in favor of default.
-       add-log.el: change mode-string to mode-name so reflected in
+       * mim-mode.el: Flush private paren blinker in favor of default.
+       * add-log.el: Change mode-string to mode-name so reflected in
                mode-line.  change \\W to \\sW when looking for place to add.
 
 1985-05-12  Richard M. Stallman  (rms@mit-prep)
-       simple.el: modified open-line to insert newlines before
+
+       * simple.el: Modified open-line to insert newlines before
                an existing one before dot.  This makes better redisplay.
-       dired.el: Installed Shane's changes that allow user to choose
+       dired.el: Installed Shane's changes that allow user to choose
                switches to use.
 
 1985-05-11  Richard M. Stallman  (rms@mit-prep)
-       rmail.el: if given file name as argument,
+
+       * rmail.el: If given file name as argument,
                correctly displays one message of that file
                but does not try to get new mail.
-       simple.el: Fix what-line bug: line # too high by 1 if not at bol.
+       simple.el: Fix what-line bug: line # too high by 1 if not at bol.
                Put in blink-matching-paren-distance,
                and check for wrong kinds of parens matching.
-       time.el: Put in display-time-day-and-date flag,
+       time.el: Put in display-time-day-and-date flag,
                to display day and date in addition to the time.
-       startup.el: Call lisp-interaction-mode-hook if defined.
+       startup.el: Call lisp-interaction-mode-hook if defined.
                Set current buffer variables from defaults
                in case user's init file has changed them.
 
index 50b82e13a1598e064ab1d22e2af3caaa9a834259..cf4d13ccefb4626a1f708435c66cadf1e9b8ef74 100644 (file)
 
 2003-06-10  Rajesh Vaidheeswarran  <rv@gnu.org>
 
-       * whitespace.el (whitespace-version): Bump to 3.3
+       * whitespace.el (whitespace-version): Bump to 3.3.
        (whitespace-cleanup): Respect user preference for silence
 
        * whitespace.el: Remove :tag in commentary :link.  Remove empty
        (bibtex-version): Remove support for bug reporting.
        (bibtex-field-delimiters, bibtex-entry-delimiters)
        (bibtex-sort-ignore-string-entries, bibtex-maintain-sorted-entries)
-       Replace make-variable-buffer-local by make-local-variable for
+       Replace make-variable-buffer-local by make-local-variable.
        (bibtex-entry-format): New tag `required-fields'.
        (bibtex-maintain-sorted-entries): New var.
        (bibtex-sort-entry-class, bibtex-sort-entry-class-alist): New vars.
        (ccl-encode-mule-utf-16-le-with-signature)
        (ccl-encode-mule-utf-16-be-with-signature): New CCL programs.
        (mule-utf-16-post-read-conversion): New function.
-       (mule-utf-16-le-with-signature, mule-utf-16-be-with-signature),
+       (mule-utf-16-le-with-signature, mule-utf-16-be-with-signature)
        (mule-utf-16): New coding systems.
-       (utf-16-le-with-signature, utf-16-be-with-signature),
+       (utf-16-le-with-signature, utf-16-be-with-signature)
        (utf-16): Aliases of the above coding systems.
 
 2003-04-08  Martin Stjernholm  <bug-cc-mode@gnu.org>
        Other cleanups.
        Command line option --no-desktop introduced.
        (desktop-read): Record buffers in the desktop file in
-       the same order as that in the buffer list,
+       the same order as that in the buffer list.
        (desktop-save): Put buffers in the order given in desktop file,
        regardless of what handlers do.
        (desktop-file-version): New variable.  Version number of desktop
        * gdb-ui.el : Remove inappropriate key-bindings.
        (gdb-info-breakpoints-custom, gdb-goto-bp-this-line):
        Parse correctly when breakpoint has no line number.
-       (def-gdb-auto-update-handler, gdb-info-locals-handler),
+       (def-gdb-auto-update-handler, gdb-info-locals-handler)
        (gdb-display-end): Avoid using insert-buffer.
        (gdb-frames-select-by-mouse): Rename gdb-frames-mouse-select.
 
 
 2002-01-05  Andre Spiegel  <spiegel@gnu.org>
 
-       * vc.el (vc-branch-part): Return nil if there's no `.'
+       * vc.el (vc-branch-part): Return nil if there's no `.'.
        (vc-default-previous-version): Renamed from vc-previous-version.
        New args BACKEND and FILE.  Return nil for revision numbers
-       without a `.'
+       without a `.'.
        (vc-version-diff): Call vc-BACKEND-previous-version.
        (vc-steal-lock): Steal lock before composing mail, so that no mail
        is sent when the stealing goes wrong.  And we'll actually see the
        lambda expression.
        (ps-mode-menu-main): Submenu with options on/off was replaced with
        a toggle button.
-       (ps-mode, ps-run-mode): Define with `define-derived-mode'
+       (ps-mode, ps-run-mode): Define with `define-derived-mode'.
        (ps-mode): Autoload cookie added on same line as comment.
        (ps-mode-tabkey, ps-mode-backward-delete-char):
        (ps-mode-r-balance): Replace `delete-horizontal-space' and
-       `indent-to' with `indent-line-to'
+       `indent-to' with `indent-line-to'.
        (ps-mode-print-buffer, ps-mode-print-region): Use `funcall'
        instead of `eval'.
        (ps-mode-print-region): Use `with-temp-buffer'.
        (vc-default-annotate-current-time): Added.
 
        * vc-cvs.el (vc-cvs-annotate-difference): Removed to generic
-       version in vc.el, with
+       version in vc.el.
        (vc-cvs-annotate-current-time): Added, as override of default.
        (vc-cvs-annotate-time): Added.  Taken mostly from the (now removed)
        `vc-cvs-annotate-difference'.
index 86bf9434fc90c10ba6efc61a680f9de3561329b9..c1ee441ea6b71294d2bb76a1070fd65ae33c28b3 100644 (file)
@@ -84,7 +84,7 @@
 
 2004-12-30  Andreas Leue  <al@sphenon.de>
 
-       * textmodes/artist.el (artist-version): 1.2.6
+       * textmodes/artist.el (artist-version): 1.2.6.
        (artist-prev-next-op-alist): New variable.
        (artist-select-next-op-in-list): New function.
        (artist-select-prev-op-in-list): New function.
        (calculator-radix-grouping-digits)
        (calculator-radix-grouping-separator):
        New defcustoms for the new radix grouping mode functionality.
-       (calculator-mode-hook): Now used in electric mode too,
+       (calculator-mode-hook): Now used in electric mode too.
        (calculator): Call it.
        (calculator-mode-map): Some new keys.
        (calculator-message): New function.  Some new calls.
        (math-so-far, math-integ-expr, math-expr-parts, calc-low)
        (calc-high, math-solve-var, math-solve-full, math-solve-vars)
        (math-try-solve-sign, math-solve-b, math-solve-system-vv)
-       (math-solve-res): New variables
+       (math-solve-res): New variables.
        (math-derivative, calcFunc-deriv, calcFunc-tderiv)
        (math-integral, math-replace-integral-parts)
        (math-integrate-by-parts, calc-dump-integral-cache)
        mark mode (to include the current match to region boundaries).
        Push the search string to `query-replace-from-history-variable'.
        Add prompt "Query replace regexp" for isearch-regexp.
-       Add region beginning/end as last arguments of `perform-replace.'
+       Add region beginning/end as last arguments of `perform-replace'.
        (isearch-query-replace-regexp): Replace code by the call to
        `isearch-query-replace' with arg `t'.
 
 
        (compile): Additional argument for interactive compiles like TeX.
 
-       * progmodes/grep.el (kill-grep): Move here from compile.el
+       * progmodes/grep.el (kill-grep): Move here from compile.el.
        (grep-error, grep-hit-face, grep-error-face)
        (grep-mode-font-lock-keywords): New variables.
        (grep-regexp-alist): Simplify regexp and add `binary' case.
        (rsf-bbdb-auto-delete-spam-entries): Rename from
        rmail-bbdb-auto-delete-spam-bbdb-entries.  The cc: field is
        scanned together with the recipients field for spam testing; Don't
-       delete spam message if rmail-delete-after-output is non-nil;
+       delete spam message if rmail-delete-after-output is non-nil.
        (rsf-check-field): New function, extracted from code in
        rmail-spam-filter to ease addition of header fields like
-       content-type:;
+       content-type:.
        (message-content-type): New variable.  The content-type: field was
-       added also in defcustom of rsf-definitions-alist;
+       added also in defcustom of rsf-definitions-alist.
        (rmail-spam-filter): Replace repeated test code for header fields
        by calls to check-field; change the call to
        rmail-output-to-rmail-file such that rmail-current-message stays
 2003-12-29  Stuart Herring  <herring@lanl.gov>  (tiny change)
 
        * comint.el (comint-watch-for-password-prompt): Pass `string' as
-       arg to send-invisible
+       arg to send-invisible.
        (send-invisible): Doc fix.  The argument is now a prompt, not the
        string to send.
        (comint-read-noecho): Doc fix.
        Ensure that recentf correctly updates the menu bar.
        * recentf.el (recentf-menu-path,recentf-menu-before): Doc fix.
        (recentf-menu-bar): New function.
-       (recentf-clear-data): Use it
+       (recentf-clear-data): Use it.
        (recentf-update-menu): Likewise.  Use easy-menu-add-item instead
        of easy-menu-change.
 
        (reftex-toc-split-windows-fraction): New option.
        (reftex-recenter-toc-when-idle): Search *toc* window on all
        visible frames.
-       (reftex-toc): Additional parameter REUSE
+       (reftex-toc): Additional parameter REUSE.
        (reftex-toc-recenter): Remember current frame.  Call `reftex-toc'
        with REUSE argument.
        (reftex-recenter-toc-when-idle): Reset `current-prefix-arg' for
        erroneously in previous version.
        (bibtex-string-files): Docstring reflects new parsing scheme.
        (bibtex-autokey-transcriptions): Merge some rewrite entries, fix
-       docstring, add # as one of the chars to crush
+       docstring, add # as one of the chars to crush.
        (bibtex-autokey-prefix-string, bibtex-autokey-names)
        (bibtex-autokey-names-stretch, bibtex-autokey-additional-names)
        (bibtex-autokey-name-change-strings)
        preamble entries.
        (bibtex-fill-field-bounds): New function.
        (bibtex-fill-field): New command.  Bound to fill-paragraph-function.
-       (bibtex-fill-entry): Use bibtex-fill-field-bounds
+       (bibtex-fill-entry): Use bibtex-fill-field-bounds.
        (bibtex-String): Use bibtex-strings.  Always obey
        bibtex-sort-ignore-string-entries.
 
index 95f59243cb127ae12efb55af2f16682eab9e3d0a..640c45dfc0cd3384aa076729d4b6a67ebfa5c6b4 100644 (file)
 2007-03-20  Richard Stallman  <rms@gnu.org>
 
        * textmodes/ispell.el (ispell-call-process): New function.
-       Defends against bad `default-directory.'
+       Defends against bad `default-directory'.
        (ispell-check-version, ispell-find-aspell-dictionaries)
        (ispell-get-aspell-config-value, lookup-words): Call it.
        (ispell-call-process-region): New function.
        (org-set-frame-title, org-show-reference)
        (org-unhighlight-once, org-verify-change-for-undo): New functions.
        (org-show-variable): Remove command.
-       (org-add-log-maybe): New arguments STATE, FINDPOS
+       (org-add-log-maybe): New arguments STATE, FINDPOS.
        (org-table-sort-lines): Rewrite from scratch.
        (org-link-search): New argument AVOID-POS.
        (org-print-icalendar-entries): Remove argument CATEGORY.
 
 2006-12-30  Jan Djärv  <jan.h.d@swipnet.se>
 
-       * scroll-bar.el (previous-scroll-bar-mode): New variable
+       * scroll-bar.el (previous-scroll-bar-mode): New variable.
        (set-scroll-bar-mode): Set previous-scroll-bar-mode.
        (scroll-bar-mode): Use previous-scroll-bar-mode if set.
 
        (cperl-to-comment-or-eol): Do not call `cperl-update-syntaxification'
                        recursively.
                Bound `next-single-property-change' via `point-max'.
-       (cperl-unwind-to-safe): Bound likewise
+       (cperl-unwind-to-safe): Bound likewise.
        (cperl-font-lock-fontify-region-function): Likewise.
        (cperl-find-pods-heres): Mark as recursive for `cperl-to-comment-or-eol'
                Initialization of `cperl-font-lock-multiline-start' could be
        (cperl-calculate-indent): `char-after' could be nil...
        (cperl-find-pods-heres): REx can start after "[" too.
                Highlight (??{}) in RExen too.
-       (cperl-maybe-white-and-comment-rex): New constant
+       (cperl-maybe-white-and-comment-rex): New constant.
        (cperl-white-and-comment-rex): Likewise.
                XXXX Not very efficient, but hard to make
                better while keeping 1 group.
                Syntax-mark a {}-part of (?{}) as "comment"
                        (it was the ()-part)
                Better logic to distinguish what is what in REx
-       (cperl-tips-faces): Document REx highlighting
+       (cperl-tips-faces): Document REx highlighting.
        (cperl-praise): Mention REx syntax highlight etc.
 
        After 5.17:
        (cperl-indent-comment-at-column-0): New customization variable.
        (cperl-comment-indent): Indentation after $#a would increase by 1.
        (cperl-mode): Make `defun-prompt-regexp' grok BEGIN/END etc.
-       (cperl-find-pods-heres): Mark CODE of s///e as `syntax-type' `multiline'
+       (cperl-find-pods-heres): Mark CODE of s///e as `syntax-type' `multiline'.
        (cperl-at-end-of-expr): Would fail if @BAR=12 follows after ";".
        (cperl-init-faces): If `cperl-highlight-variables-indiscriminately'
                        highlight $ in $foo too (UNTESTED).
        (cperl-style-alist): Likewise.
        (cperl-fix-line-spacing): Support `cperl-merge-trailing-else' being nil,
                and `cperl-extra-newline-before-brace' etc
-               being t
+               being t.
        (cperl-indent-exp): Plans B and C to find continuation blocks even
                if `cperl-extra-newline-before-brace' is t.
 
        (gdb-stack-position): New variable.
        (gdb-starting, gdb-exited): Reset gdb-stack-position to nil.
        (gdb-frames-mode): Set gdb-stack-position to nil.
-       Add to overlay-arrow-variable-list
+       Add to overlay-arrow-variable-list.
        (gdb-reset): Delete gdb-stack-position from above list.
 
 2006-08-14  Jan Djärv  <jan.h.d@swipnet.se>
        * avoid.el (mouse-avoidance-animating-pointer): New var.
        (mouse-avoidance-nudge-mouse): Use it.
        (mouse-avoidance-banish): Rename from mouse-avoidance-banish-hook.
-       (mouse-avoidance-exile): Rename from mouse-avoidance-exile-hook
+       (mouse-avoidance-exile): Rename from mouse-avoidance-exile-hook.
        (mouse-avoidance-fancy): Rename from mouse-avoidance-fancy-hook.
        Don't activate if currently animating.  All callers changed.
 
        * progmodes/gdb-ui.el (gdb-same-frame): New option.
        (gud-old-arrow, gdb-frame-begin, gdb-printing): New variables.
        (gdb-init-1): Initialise them.
-       (gdb-starting): Reset gdb-printing
+       (gdb-starting): Reset gdb-printing.
        (gdb-starting): Save value of gud-overlay-arrow-position.
        (gdb-frame-begin): Set gdb-frame-begin, gdb-printing.
        (gdb-stopped): Don't look for source if calling procedure e.g "p a ()".
        links to BibTeX database entries..
        (org-get-current-options, org-set-regexps-and-options):
        Implement logging as a startup option.
-       (org-store-link): Make sure context string is never empty
+       (org-store-link): Make sure context string is never empty.
        (org-insert-link): Use relative path when possible.
        (org-at-item-checklet-p): New function.
        (org-shifttab, org-shiftmetaleft, org-shiftmetaright)
        (gdb-init-1, gdb-post-prompt): ...and references to it.
        (gdb-frame-handler): Strip directory name from filename if present.
 
-       * progmodes/gud.el (gdb-force-update): Delete defvar
+       * progmodes/gud.el (gdb-force-update): Delete defvar.
        (gud-speedbar-buttons): ...and references to it.  Use window-start
        to try to keep position in watch expression.
 
 
        * diff-mode.el (diff-mode-shared-map): Don't bind M-W, M-U, M-C,
        M-r, M-R, M-A, M-SPC or M-DEL.
-       (diff-mode-map): diff-refine-hunk now on C-c C-w
+       (diff-mode-map): diff-refine-hunk now on C-c C-w.
        (diff-mode-map): Bind C-c C-e, C-c C-n, C-c C-r, C-c C-u.
 
        * help-mode.el (help-mode): view-exit-action calls delete-window
        (org-edit-agenda-file-list, org-store-new-agenda-file-list)
        (org-read-agenda-file-list): New functions.
        (org-table-edit-field)
-       (org-table-create-or-convert-from-region): New commands
+       (org-table-create-or-convert-from-region): New commands.
        (org-table-toggle-vline-visibility): Command removed.
        (org-table-convert-region): Made a command.
        (orgtbl-delete-backward-char, orgtbl-delete-char): Remove commands.
        Optional argument unrestricted means ignore any restrictions.
        (org-install-agenda-files-menu): Find a buffer in Org-mode before
        trying to modify the menu.  Use generalized access to
-       `org-agenda-files.'
+       `org-agenda-files'.
        (org-agenda-list, org-todo-list, org-cycle-agenda-files)
        (org-agenda-file-to-front, org-remove-file, org-diary)
        (org-tags-view, org-export-icalendar-all-agenda-files)
        (thumbs-resize-image): Rename from thumbs-resize-image-interactive.
        Use increment argument to enlarge/shrink.  Preserve point.
        (thumbs-shrink-image): Rename from thumbs-resize-image-size-down.
-       (thumbs-enlarge-image): Rename from thumbs-resize-image-size-up
+       (thumbs-enlarge-image): Rename from thumbs-resize-image-size-up.
        (thumbs-show-thumbs-list): Set thumbs-buffer to current-buffer.
        (thumbs-mark, thumbs-unmark): Preserve point.
        (thumbs-modify-image): Keep old temp files and use to modify.
        (c-after-statement-terminator-p): Adapt for virtual semicolons;
        check more rigorously for "end of macro".
        (c-back-over-illiterals, c-forward-over-illiterals): Adapt for
-       virtual semicolons;
+       virtual semicolons.
        (c-beginning-of-statement): Adapt for virtual semicolons; Separate
        out the code for forward movement into ...
        (c-end-of-statement): Now contains the code for forward movement,
        (allout-mode): Use key-binding substitution in the docstring.
        (allout-kill-line): Spell-out kill ring data structure mutation
        instead of using byte-compiler-complaint-provoking `pop'.
-       (allout-insert-listified): Use `insert' rather than `insert-string'
+       (allout-insert-listified): Use `insert' rather than `insert-string'.
        (allout-toggle-current-subtree-encryption): Update docstring, adjust
        to new gpp-based encryption, use new `allout-encrypted-topic-p'.
        (allout-encrypt-string): Totally revamped vis new underlying
        * progmodes/gdb-ui.el (gdb-info-breakpoints-custom):
        Put `font-lock-function-name-face'.
        (gdb-info-frames-custom): Put `font-lock-function-name-face'
-       and `font-lock-variable-name-face'
+       and `font-lock-variable-name-face'.
        (gdb-registers-font-lock-keywords): New font lock keywords definition.
        (gdb-registers-mode): Use `gdb-registers-font-lock-keywords'.
        (gdb-memory-font-lock-keywords): New font lock keywords definition.
        (gdb-memory-mode): Use `gdb-memory-font-lock-keywords'.
        (gdb-local-font-lock-keywords): New font lock keywords definition.
-       (gdb-locals-mode): Use `gdb-local-font-lock-keywords'
+       (gdb-locals-mode): Use `gdb-local-font-lock-keywords'.
        (gdb-threads-font-lock-keywords): New font lock keywords definition.
        (gdb-threads-mode): Use `gdb-threads-font-lock-keywords'.
 
        * loadhist.el (unload-feature): Update for new format of load-history.
        Simplify the code.
 
-       * mail/rmail.el (rmail-ignored-headers): Ignore more headers
+       * mail/rmail.el (rmail-ignored-headers): Ignore more headers.
        (rmail-font-lock-keywords): Don't fontify the text of a citation.
 
        * mail/sendmail.el (mail-font-lock-keywords):
        (org-evaluate-time-range): Insert at point instead of directly
        after time range.
        (org-first-headline-recenter, org-subtree-end-visible-p)
-       (org-optimize-window-after-visibility-change): New functions
+       (org-optimize-window-after-visibility-change): New functions.
        (org-agenda-post-command-hook): Don't allow point at end of line,
        to make sure it always hits the text properties.
        (org-agenda-next-date-line, org-agenda-previous-date-line):
 
 2005-04-11  Jan Djärv  <jan.h.d@swipnet.se>
 
-       * dired.el (dired-mode): Use dnd-* instead of x-dnd-*
+       * dired.el (dired-mode): Use dnd-* instead of x-dnd-*.
        (dired-dnd-handle-local-file): Call dnd-get-local-file-name.
        (dired-dnd-handle-file): Call dnd-get-local-file-uri.
 
        * cus-edit.el (dnd): New group.
 
-       * term/w32-win.el (dnd): Require dnd
+       * term/w32-win.el (dnd): Require dnd.
        (w32-drag-n-drop): Call dnd-handle-one-url.
 
        * x-dnd.el: Require dnd.
 
        * progmodes/gdb-ui.el (gdb-var-update-handler)
        (gdb-speedbar-timer-fn): Ensure speedbar updates with new values
-       for watch expressions,
+       for watch expressions.
        (gdb-var-create-handler): Don't set speedbar-update-flag.
        (gdb-post-prompt): Simplify test for speedbar.
 
        (bibtex-field-list, bibtex-find-crossref): Fix typos in error messages.
 
 2005-01-24  Dan Nicolaescu  <dann@ics.uci.edu>
-           Juri Linkov  <juri@jurta.org>
+            Juri Linkov  <juri@jurta.org>
 
        * textmodes/reftex-global.el (reftex-isearch-push-state-function)
        (reftex-isearch-pop-state-function, reftex-isearch-isearch-search)
 2005-01-15  James R. Van Zandt  <jrvz@comcast.net>  (tiny change)
 
        * progmodes/sh-script.el: Code copied from make-mode.el
-       with small changes,
+       with small changes.
        (sh-mode-map): Bind C-c C-\.
        (sh-backslash-column, sh-backslash-align): New variables.
        (sh-backslash-region, sh-append-backslash): New functions.
 
 2005-01-15  Sergey Poznyakoff  <gray@Mirddin.farlep.net>
 
-       * mail/rmail.el: Updated to work with movemail from GNU Mailutils
+       * mail/rmail.el: Updated to work with movemail from GNU Mailutils.
        (rmail-pop-password, rmail-pop-password-required): Move to
        rmail-obsolete group.
        (rmail-set-pop-password): Rename to rmail-set-remote-password.
 
        * textmodes/reftex-vars.el (reftex-cite-format-builtin):
        Add optional arguments to most cite commands.
-       (reftex-cite-cleanup-optional-args): New option
+       (reftex-cite-cleanup-optional-args): New option.
        (reftex-cite-prompt-optional-args): New option.
        (reftex-trust-label-prefix): New option.
 
index 12ea1f45e176874a7c404b35ec6e5fac6e06a04f..630a4bc08659b2eda657cfec34f166a34be9424e 100644 (file)
        char-width-table.  Don't make ethiopic and tibetan double column.
 
        * textmodes/fill.el (fill-find-break-point-function-table):
-        Don't set it up in defvar.
+       Don't set it up in defvar.
        (fill-nospace-between-words-table): New variable.
        (fill-delete-newlines): Check fill-nospace-between-words-table
        instead of charset property nospace-between-words.
        (ps-header-footer-string): Delete function.
        (ps-encode-header-string-function): New variable.
        (ps-generate-header-line): Call ps-encode-header-string-function.
-       (ps-basic-plot-string-function): New variable
+       (ps-basic-plot-string-function): New variable.
        (ps-begin-job): Set ps-basic-plot-string-function and
        ps-encode-header-string-function.  For setting up headers and
        footers, don't use caches such as ps-rh-cache.  Don't call
 
        * international/mule.el (ctext-non-standard-encodings-alist):
        Rename from non-standard-icccm-encodings-alist.
-       (ctext-non-standard-encodings-regexp): New variable
+       (ctext-non-standard-encodings-regexp): New variable.
        (ctext-post-read-conversion): Full rewrite.
        (ctext-non-standard-designations-alist): Rename from
        non-standard-designations-alist.
 2008-02-01  Dave Love  <fx@gnu.org>
 
        * emacs-lisp/byte-opt.el (side-effect-free-fns):
-        Add string-make-unibyte string-make-multibyte string-to-multibyte
-        string-as-multibyte string-as-unibyte.
+       Add string-make-unibyte string-make-multibyte string-to-multibyte
+       string-as-multibyte string-as-unibyte.
 
 2008-02-01  Dave Love  <fx@gnu.org>
 
        * ibuffer.el (ibuffer-mode): Fix typo in previous change.
 
 2008-01-17  Vinicius Jose Latorre  <viniciusjl@ig.com.br>
-           Miles Bader  <miles@gnu.org>
+            Miles Bader  <miles@gnu.org>
 
        * blank-mode.el: New file.  Minor mode to visualize (HARD) SPACE,
        TAB, NEWLINE.  Miles Bader <miles@gnu.org> wrote the original code
        (verilog-insert-indices): Escape braces in doc strings.
 
 2007-12-08  Michael McNamara  <mac@verilog.com>
-           Wilson Snyder  <wsnyder@wsnyder.org>
+            Wilson Snyder  <wsnyder@wsnyder.org>
 
        * progmodes/verilog-mode.el: New file.
 
        * doc-view.el (doc-view-search-backward, doc-view-search):
        Fix assignment to free variable bug.
 
-2007-11-16  Martin Pohlack  <mp26@os.inf.tu-dresden.de>  (tiny change)
+2007-11-16  Martin Pohlack  <mp26@os.inf.tu-dresden.de>
 
        * emulation/pc-select.el (pc-select-shifted-mark): New var.
        (ensure-mark): Set it.
        (allout-end-of-line): Preserve mark activation status when jumping.
        (allout-open-topic): Account for opening after a child that
        contains a hidden trailing newline.  Preserve match data.
-       Run allout-structure-added-hook
+       Run allout-structure-added-hook.
        (allout-encrypt-decrypted): Preserve match data.
        (allout-toggle-current-subtree-exposure): Add new interactive
        function for toggle subtree exposure - suggested by tassilo.
        (org-find-base-buffer-visiting): Catch the case that there is no
        buffer visiting the file.
        (org-property-or-variable-value): New function.
-       (org-todo): Use `org-property-or-variable-value'
+       (org-todo): Use `org-property-or-variable-value'.
        (org-agenda-compact-blocks): New option.
        (org-prepare-agenda, org-agenda-list): Use `org-agenda-compact-blocks'.
        (org-agenda-schedule, org-agenda-deadline):
 
        * progmodes/cperl-mode.el: Merge upstream 5.23.
        (cperl-where-am-i): Remove function.
-       (cperl-backward-to-noncomment): Don't go too far when skipping POD/HEREs
+       (cperl-backward-to-noncomment): Don't go too far when skipping POD/HEREs.
        (cperl-sniff-for-indent): De-invert [string] and [comment].
        When looking for label, skip s:m:y:tr.
        (cperl-indent-line): Likewise.
        Use native Emacs functions, when appropriate.
 
 2007-08-01  Dan Nicolaescu  <dann@ics.uci.edu>
-           Stefan Monnier  <monnier@iro.umontreal.ca>
+            Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * vc.el: Document new VC operation `extra-menu'.
 
index 1edfd9081d0dfbd60be18da260aa90dcbc90fc98..79a8b3776f2d9d7d7ed942a1ed1a395ff97c9ac9 100644 (file)
 
 2009-04-11  Chong Yidong  <cyd@stupidchicken.com>
 
-       * files.el (dir-locals-directory-cache):  Rename from
+       * files.el (dir-locals-directory-cache): Rename from
        dir-locals-directory-alist.  Change format to include
        the mtime of the directory-local variables file (Bug#2833).
        (dir-locals-set-directory-class): New arg mtime.  Store it in
 
        * paren.el (show-paren-function):
        * simple.el (kill-forward-chars, kill-backward-chars):
-        Use (+/- (point) N), instead of `forward-point'.
+       Use (+/- (point) N), instead of `forward-point'.
 
 2009-03-19  Glenn Morris  <rgm@gnu.org>
 
        Don't activate node nil.  (Bug#1569)
 
 2009-01-22  Paul Reilly  <pmr@pajato.com>
-           Henrik Enberg  <enberg@printf.se>
-           Alex Schroeder  <alex@gnu.org>
-           Chong Yidong  <cyd@stupidchicken.com>
-           Richard M Stallman  <rms@gnu.org>
-           Glenn Morris  <rgm@gnu.org>
-           Juanma Barranquero  <lekktu@gmail.com>
+            Henrik Enberg  <enberg@printf.se>
+            Alex Schroeder  <alex@gnu.org>
+            Chong Yidong  <cyd@stupidchicken.com>
+            Richard M Stallman  <rms@gnu.org>
+            Glenn Morris  <rgm@gnu.org>
+            Juanma Barranquero  <lekktu@gmail.com>
 
        * mail/rmail.el: Code implementing Rmail-mbox functionality.
        (rmail-attribute-header, rmail-keyword-header)
        was orderly adjusted, nil otherwise.
 
 2008-12-12  Juanma Barranquero  <lekktu@gmail.com>
-           Stefan Monnier  <monnier@iro.umontreal.ca>
+            Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * server.el (server-sentinel): Uncomment code to delete connection file.
        (server-start): Save the connection file in the server property list.
        terminal variable assignment.
 
 2008-12-10  Yukihiro Matsumoto  <matz@ruby-lang.org>
-           Nobuyoshi Nakada  <nobu@ruby-lang.org>
+            Nobuyoshi Nakada  <nobu@ruby-lang.org>
 
        * progmodes/ruby-mode.el: New file.
 
        New aliases, to satisfy `define-derived-mode' expectations.
 
 2008-11-15  Glenn Morris  <rgm@gnu.org>
-           Martin Rudalics  <rudalics@gmx.at>
+            Martin Rudalics  <rudalics@gmx.at>
 
        * emacs-lisp/find-func.el (find-function-advised-original): New.
        (find-function-C-source, find-function-noselect):
 
 2008-07-31  Alan Mackenzie  <acm@muc.de>
 
-       * progmodes/cc-mode.el (c-before-hack-hook): New function
+       * progmodes/cc-mode.el (c-before-hack-hook): New function.
        (Top Level): Install c-before-hack-hook on
        before-hack-local-variables-hook, rather than
        c-postprocess-file-styles on hack-local-variables-hook.
        (newsticker--treeview-propertize-tag): Show item title in tooltip.
 
 2008-06-20  Martin Blais  <blais@furius.ca>
-           Stefan Merten  <smerten@oekonux.de>
-           David Goodger  <goodger@python.org>
+            Stefan Merten  <smerten@oekonux.de>
+            David Goodger  <goodger@python.org>
 
        * textmodes/rst.el: New file.
 
        * term/linux.el (terminal-init-linux): Load t-mouse.
 
 2008-06-13  Stefan Monnier  <monnier@iro.umontreal.ca>
-           Drew Adams  <drew.adams@oracle.com>
+            Drew Adams  <drew.adams@oracle.com>
 
        * info.el (Info-breadcrumbs-depth): New var.
        (Info-insert-breadcrumbs): New function.
        for useful options.
 
 2008-03-01  Dan Nicolaescu  <dann@ics.uci.edu>
-           Glenn Morris  <rgm@gnu.org>
+            Glenn Morris  <rgm@gnu.org>
 
        * emacs-lisp/bytecomp.el (byte-recompile-directory)
        (byte-compile-file, batch-byte-compile, batch-byte-compile-file):
index e3193944011e9a11e415877934f6805ee320f3b9..90c00dc6360af677fff495618d0860d25ecc9c92 100644 (file)
 1986-08-07  Richard Mlynarik  (mly@prep)
 
        * rfc822.el, loaddefs.el, mail-utils.el:
-       Hairy address parser, used only if mail-use-rfc822 is non-nil
+       Hairy address parser, used only if mail-use-rfc822 is non-nil.
        (It is nil by default, so if one doesn't like or need the hair of
-       this file, then one is never troubled by it)
+       this file, then one is never troubled by it.)
 
        * disassemble.el, loaddefs.el:
        Code from doug@csli.stanford.edu modified by mly.
index 26b872af9bbcad0926c227a55b3a237671edfdb7..f99f2ec4ec0c15fe6462eea0d169788d1cb7bc44 100644 (file)
 
        * frame.el (frame-initialize): Fix error syntax.
        (toggle-horizontal-scroll-bar): Likewise.
-       (toggle-horizontal-scroll-bar): Renamed from set-horizontal-bar
+       (toggle-horizontal-scroll-bar): Renamed from set-horizontal-bar.
        (toggle-vertical-scroll-bar): Likewise.
        (toggle-auto-lower, toggle-auto-raise): Likewise.
        (set-foreground-color, set-background-color):
        (list-diary-entries, mark-diary-entries)
        (include-other-diary-files, mark-included-diary-files):
        Added the possibility of `shared diary files' with a recursive
-       include mechanism like the C preprocessor
+       include mechanism like the C preprocessor.
        (list-calendar-holidays): Eliminated the 'special class of holidays,
        rewriting the entire mechanism to make it more general.
        (calendar-holiday-function-float): Changed the 'float class of
 
 1988-12-12  Richard Stallman  (rms@mole.ai.mit.edu)
 
-       * telnet.el (telnet-send-input): Save input in telnet-previous-input
+       * telnet.el (telnet-send-input): Save input in telnet-previous-input.
        (telnet-mode): Make that var buffer-local.
        (telnet-copy-last-input): New fn to yank that var; now on C-c C-y.
 
index cd36210f7fca44ebb36c82cb80f74d9df1362fd2..8cb0e343a1a42723391385af073730f661a6138d 100644 (file)
        ispell-menu-map, ispell-menu-lucid, and ispell-menu-map-needed
        so users can more easily modify and upgrade entries.
        (ispell-dictionary-alist): Once more a single variable.
-       (ispell-required-version): Documentation changes
-       (ispell-skip-sgml): Documentation changes
+       (ispell-required-version): Documentation changes.
+       (ispell-skip-sgml): Documentation changes.
        (ispell-command-loop): `mode-line-format' now shows misspelled word.
        (ispell-message-text-end): Can now process postscript version 1.
        (ispell-message-start-skip): New variable for block skips, set up for
        19.28 and earlier and XEmacs 19.11 and earlier.
        * ediff.el (ediff-patch-buffer): Now handles buffers that don't
        visit any file.
-       (ediff-windows): Renamed to ediff-windows-wordwise, added
+       (ediff-windows): Renamed to ediff-windows-wordwise.
        (ediff-windows-linewise): New function.
        Changed ediff-small/large-regions to ediff-regions-wordwise/linewise.
 
 
        * mail-extr.el (mail-extr-all-letters-but-separators):
        Reinstate \377, the bug in search.c is apparently gone.
-       (mail-extr-first-letters): Add 8-bit characters
+       (mail-extr-first-letters): Add 8-bit characters.
        (mail-extr-last-letters): Ditto.
 
        * simple.el (indent-for-comment): Move to beginning of line only
        (ada-end-stmt-re): Add "separate" body parts, "else", and
        "package <Id> is".
        (ada-subprogram-start-re): Add "entry", "protected" and
-       "package body"
+       "package body".
        (ada-indent-function): Handle "elsif" the same way as "if", added
        "separate" for no indent.
        (ada-get-indent-type): If "type ... is .." is followed by code on
        ones the numbers of subexpressions to refer to.
        (vc-cvs-status): New per-file property, only used in the CVS case.
        (vc-cvs-status): New function.
-       (vc-log-info): Adapted to new version of vc-parse-buffer
+       (vc-log-info): Adapted to new version of vc-parse-buffer.
        (vc-fetch-properties): Adapted to new version of vc-parse-buffer.
        Better search regexp for CVS latest version.
        (vc-log-info): Search for branch version only in the RCS case,
        (vc-consult-rcs-headers): New function.
        (vc-branch-version): New per-file property, refers
        to the RCS version selected by `rcs -b'.
-       (vc-workfile-version): New function.  Also new per-file property
+       (vc-workfile-version): New function.  Also new per-file property.
        (vc-consult-headers): New parameter variable.
        (vc-mistrust-permissions): Default set to `nil'.
        (vc-locking-user): Property is now cached.  The other functions
 1995-04-03  David Kågedal  <davidk@lysator.liu.se>
 
        * tempo.el (tempo-insert):
-       Added the P tag and modified the s tag accordingly
+       Added the P tag and modified the s tag accordingly.
        (tempo-insert-named): Checks for valid name, insert mark otherwise.
 
        * tempo.el (tempo-dolist): Changed (cadr ...) to (car (cdr ...)).
        (enriched-delq-1, enriched-make-list-uniq)
        (enriched-make-relatively-unique, enriched-common-tail)
        (enriched-reorder, enriched-insert-annotations)
-       (enriched-loc-annotations, enriched-annotate-change
+       (enriched-loc-annotations, enriched-annotate-change)
        (enriched-encode-unknown): Move to format.el.  Names changed.
 
        (enriched-display-table): Copy standard table if there is one,
        (ispell-command-loop): Properly adjust screen with different settings
        of ispell-choices-win-default-height.
        (check-ispell-version): Use fundamental-mode as default-major-mode.
-       (ispell-change-dictionary): Remove unnecessary process kills
+       (ispell-change-dictionary): Remove unnecessary process kills.
        (ispell-region): Fold sgml support in with tib checking.
        (ispell-message): Skips checking of forwarded messages.
 
 
 1995-02-02  Richard Stallman  <rms@pogo.gnu.ai.mit.edu>
 
-       * c-mode.el (c-mode-map): No binding for c-fill-paragraph
+       * c-mode.el (c-mode-map): No binding for c-fill-paragraph.
        (c-fill-paragraph): Return t.
        (c-mode): Put c-fill-paragraph in fill-paragraph-function.
 
        * tempo.el (tempo-insert-template): Quoted transient-mark-mode
        Expansion around region now puts point at the first mark.
 
-       * tempo.el (tempo-region-start, tempo-region-stop): New variables
+       * tempo.el (tempo-region-start, tempo-region-stop): New variables.
        (tempo-insert-template, tempo-insert): Don't affect the
        mark.  Check for Transient Mark mode.
 
        Keybinding for bold-italic changed from M-g o to M-g l; M-g o is
        now "other".
        (facemenu-justification-menu, facemenu-indentation-menu):
-       New submenus, moved from enriched.el
+       New submenus, moved from enriched.el.
        (list-colors-display, facemenu-color-equal): New functions.
        (facemenu-menu): Added "Display Faces" item.
        (facemenu-new-faces-at-end): New variable.
        reference keys before they are used.
        (bibtex-generate-autokey, bibtex-clean-entry): New function to
        generate an autokey if necessary.
-       (bibtex-autokey-names, bibtex-autokey-name-change-strings,
-       bibtex-autokey-name-length, bibtex-autokey-name-separator,
-       bibtex-autokey-year-length, bibtex-autokey-titlewords,
-       bibtex-autokey-title-terminators,
-       bibtex-autokey-titlewords-stretch,
-       bibtex-autokey-titleword-first-ignore,
-       bibtex-autokey-titleword-abbrevs,
-       bibtex-autokey-titleword-change-strings,
-       bibtex-autokey-titleword-length,
-       bibtex-autokey-titleword-separator,
-       bibtex-autokey-name-year-separator,
-       bibtex-autokey-year-title-separator): New variables related to
+       (bibtex-autokey-names, bibtex-autokey-name-change-strings)
+       (bibtex-autokey-name-length, bibtex-autokey-name-separator)
+       (bibtex-autokey-year-length, bibtex-autokey-titlewords)
+       (bibtex-autokey-title-terminators)
+       (bibtex-autokey-titlewords-stretch)
+       (bibtex-autokey-titleword-first-ignore)
+       (bibtex-autokey-titleword-abbrevs)
+       (bibtex-autokey-titleword-change-strings)
+       (bibtex-autokey-titleword-length)
+       (bibtex-autokey-titleword-separator)
+       (bibtex-autokey-name-year-separator)
+       (bibtex-autokey-year-title-separator): New variables related to
        bibtex-generate-autokey.
        (bibtex-find-entry-location): Optional second parameter maybedup
        to tell it that entering a duplicate entry isn't to report by an
        (validate-bibtex-buffer): Completely rewritten to validate, if
        buffer is syntactically correct.
        (find-bibtex-duplicates): Moved into validate-bibtex-buffer.
-       (ispell-abstract, bibtex-ispell-abstract, ispell-bibtex-entry,
-       bibtex-ispell-entry, beginning-of-bibtex-entry,
-       bibtex-beginning-of-entry, end-of-bibtex-entry,
-       bibtex-end-of-entry, hide-bibtex-entry-bodies,
-       bibtex-hide-entry-bodies, narrow-to-bibtex-entry,
-       bibtex-narrow-to-entry, sort-bibtex-entries, bibtex-sort-entries,
-       validate-bibtex-buffer, bibtex-validate-buffer,
-       find-bibtex-entry-location, bibtex-find-entry-location): All
+       (ispell-abstract, bibtex-ispell-abstract, ispell-bibtex-entry)
+       (bibtex-ispell-entry, beginning-of-bibtex-entry)
+       (bibtex-beginning-of-entry, end-of-bibtex-entry)
+       (bibtex-end-of-entry, hide-bibtex-entry-bodies)
+       (bibtex-hide-entry-bodies, narrow-to-bibtex-entry)
+       (bibtex-narrow-to-entry, sort-bibtex-entries, bibtex-sort-entries)
+       (validate-bibtex-buffer, bibtex-validate-buffer)
+       (find-bibtex-entry-location, bibtex-find-entry-location): All
        interactive functions are renamed, so that any interface function
        begins with "bibtex-".  Mapping:
        ispell-abstract            --> bibtex-ispell-abstract
        sort-bibtex-entries        --> bibtex-sort-entries
        validate-bibtex-buffer     --> bibtex-validate-buffer
        find-bibtex-entry-location --> bibtex-find-entry-location
-       (bibtex-maintain-sorted-entries,
-       bibtex-sort-ignore-string-entries): Default is now t.
+       (bibtex-maintain-sorted-entries)
+       (bibtex-sort-ignore-string-entries): Default is now t.
        (bibtex-complete-string): String list is built from additional
        string list bibtex-predefined-string and current strings in file.
        (string-equalp): Deleted and substituted by string-equal.
        (bibtex-current-entry-label, put-string-on-kill-ring): Deleted
        (AUCTeX provides all the functionality needed for citation
        completion).
-       (bibtex-enclosing-reference, bibtex-pop-previous, bibtex-pop-next,
-       bibtex-clean-entry): Hacked for speed (bibtex-pop-previous and
+       (bibtex-enclosing-reference, bibtex-pop-previous, bibtex-pop-next)
+       (bibtex-clean-entry): Hacked for speed (bibtex-pop-previous and
        bibtex-pop-next were to slow for larger BibTeX files).
        (bibtex-pop-previous, bibtex-pop-next): Delimiters from previous
        or next entry are changed to actual delimiters if necessary.
        bibtex-pop-next didn't work, probably due to a bug in
        re-search-forward).
        (several functions): Added support for {} as field delimiters
-       (better than '"' for accented characters.
+       (better than '"' for accented characters).
        (bibtex-clean-entry): If optional field crossref is empty or
        missing, former optional fields (if bibtex-include-OPTcrossref was
        t) are necessary again.  bibtex-clean-entry complains if they are
 1994-12-09  Ken Stevens  <stevensk@afit.af.mil>
 
        * ispell.el: Added ispell-offset for version consistency.
-       (ispell-dictionary-alist): Updated dictionaries & better match defaults
-       (ispell-alternate-dictionary): Added /usr/shar path
+       (ispell-dictionary-alist): Updated dictionaries & better match defaults.
+       (ispell-alternate-dictionary): Added /usr/shar path.
        (ispell-menu-map-needed): Redo changes that made this incompatible
        with earlier versions of Emacs19.
        (ispell-required-version): Changed to assure version 3.1.12 accessed.
 1994-10-07  Richard Stallman  <rms@mole.gnu.ai.mit.edu>
 
        * mouse.el (mouse-major-mode-menu): New function, on C-mouse-3.
-       (mouse-major-mode-menu-1): New function
+       (mouse-major-mode-menu-1): New function.
        (mouse-set-font): Move it to C-mouse-2.
 
        * font-lock.el (font-lock-defaults-alist): Delete most modes--all
 
        * cc-mode.el (c-progress-info, c-progress-init)
        (c-progress-update, c-progress-fini):
-       New vars/defuns for better long indentation progress reporting
+       New vars/defuns for better long indentation progress reporting.
        (c-indent-exp, c-indent-region): Use them.
 
        * cc-mode.el (c-guess-basic-syntax):
        find proper relpos of an arglist-cont.
 
        * cc-mode.el (c-offset-alist-default):
-       statement-case-open default offset is zero
+       statement-case-open default offset is zero.
        (c-skip-case-statement-forward): New function.
        (c-guess-basic-syntax): CASE 15: use c-skip-case-statement-forward in
        proper places to find the real relpos of statement's inside switch
        * ediff.el (ediff-toggle-read-only, ediff-patch-file): Check out
        version controlled files before their buffers are modified.
        (ediff-local-checkout-flag, ediff-toggle-read-only-function):
-        New variables.
+       New variables.
 
        * ediff.el (ediff-find-file, ediff-patch-file): Were getting
        confused by symbolic links.  Fixed.
 1994-07-23  enami tsugutomo  <enami@sys.ptg.sony.co.jp>
 
        * lisp/add-log.el (add-log-current-defun): Skip doc string
-         correctly even if it ends with line that starts space.
+       correctly even if it ends with line that starts space.
 
 1994-07-22  Ed Reingold  <reingold@albert.gnu.ai.mit.edu>
 
        `gnus-uu-asynchronous' variable set.
        (gnus-uu-ctl-map): Removed the keystrokes `C-c C-v C-h' and
        `C-c C-v h' from the keymap.
-       (gnus-uu-decode-and-view-all-articles,
-       (gnus-uu-decode-and-view-all-unread-articles,
-       (gnus-uu-decode-and-save-all-unread-articles,
+       (gnus-uu-decode-and-view-all-articles)
+       (gnus-uu-decode-and-view-all-unread-articles)
+       (gnus-uu-decode-and-save-all-unread-articles)
        (gnus-uu-decode-and-save-all-articles): Accept prefix arg for # files.
        (gnus-uu-uustrip-article-as): Waits for uudecode to finish before
        further treatment of the resulting files.
        * solar.el (solar-sunrise, solar-sunset): Fix doc string.
        (solar-time-string): Rewritten.
        (solar-adj-time-for-dst): New function.
-       (solar-sunrise-sunset, diary-sabbath-candles,
-        solar-equinoxes-solstices): Revised to use the rewritten and new fcns.
+       (solar-sunrise-sunset, diary-sabbath-candles)
+       (solar-equinoxes-solstices): Revised to use the rewritten and new fcns.
 
        * calendar.el (solar-holidays): Revised to use the rewritten and
-        new fcns.
+       new fcns.
 
        * lunar.el (lunar-phase): Revised to use the rewritten and new fcns.
 
index 2ba61dc516e0a9d607974acd275c14f5466305a5..e5bd7fa9d27bcb29d5d489a83234d8b00f6fb2ad 100644 (file)
        Added default constants.
        (simula-emacs-features): New constant to hold information
        on which flavor if emacs is running (from cc-mode.el).
-       (simula-mode-menu): Menu definition for Lucid Emacs
+       (simula-mode-menu): Menu definition for Lucid Emacs.
        (simula-mode-map): Bound new command simula-indent-exp to C-M-q
        and added lots of commands to [menu-bar].
        (simula-popup-menu): New function for Lucid menus.
        (gomoku-winning-qtuple-beg, gomoku-winning-qtuple-end)
        (gomoku-winning-qtuple-dx, gomoku-winning-qtuple-dy): Pseudo variables
        only used for non-functional argument passing deleted.
-       (gomoku-cross-winning-qtuple): Accordingly deleted function and
+       (gomoku-cross-winning-qtuple): Accordingly deleted function.
        (gomoku-check-filled-qtuple): Accordingly adapted.
        (gomoku-cross-qtuple): Don't be confused by tabs.
        (gomoku-move-down, gomoku-move-up): Simplified because point is always
 
        * ediff-init.el (ediff-hide-face): New function.
        (ediff-collect-diffs-metajob): Fixed.
-       (ediff-check-for-cl-seq): Function deleted
+       (ediff-check-for-cl-seq): Function deleted.
        (ediff-abbreviate-file-name): Now a defun.
        (ediff-has-face-support-p): New function.  Ediff now supports
        faces whenever possible.
        (run-ediff-from-cvs-buffer): New function.  Moved all
        version-control-related stuff to a new file, ediff-vers.el.
 
-       * ediff-util.el (ediff-save-buffer-in-file): New function
+       * ediff-util.el (ediff-save-buffer-in-file): New function.
        (ediff-visible-region): No longer narrows the merge buffer.
        (ediff-status-info): Now tells if we are focusing on regions where
        both buffers differ from the ancestor.
        When changing the environment, avoid need for setenv.
 
 1996-01-05  Karl Eichwalder  <ke@ke.Central.DE>
-           Karl Fogel  <kfogel@floss.red-bean.com>
+            Karl Fogel  <kfogel@floss.red-bean.com>
 
        * bookmark.el: "cyclic.com" addresses changed to "red-bean.com".
        (bookmark-bmenu-mode-map): Don't bind C-k.
 1995-10-09  Roland McGrath  <roland@churchy.gnu.ai.mit.edu>
 
        * etags.el (tags-table-check-computed-list): Map
-        tags-expand-table-name over lists of included tables.
+       tags-expand-table-name over lists of included tables.
 
 1995-10-09  Erik Naggum  <erik@naggum.no>
 
 
        * ediff-meta.el: New file.
        * ediff-hook.el: New file.
-       * ediff.el: Moved menubar definitions to a new file, ediff-hook.el
+       * ediff.el: Moved menubar definitions to a new file, ediff-hook.el.
        (ediff-files, ediff-merge-files): Better file-name defaults.
        (ediff-split-string): New function.
        (ediff-exec-process): Now handles diff args separated by space.
 
 1995-08-15  Daniel Pfeiffer  <Daniel.Pfeiffer@Informatik.START.dbp.de>
 
-       * skeleton.el (skeleton-pair-insert-maybe): Plain insert in Ovwrt mode
+       * skeleton.el (skeleton-pair-insert-maybe): Plain insert in Ovwrt mode.
        (skeleton-insert): If skeleton doesn't fit in window, put beginning
        at top before going to _ point.
        (skeleton-internal-list): Rewritten so that resume: sections pertain
-       only to inferior skeletons and make str available there
+       only to inferior skeletons and make str available there.
        (skeleton-read): Don't quit and remove partial skeleton when empty
        string entered for outer iterator.  Added implicit argument `input'.
        (define-skeleton, skeleton-insert, skeleton-internal-list): Use `x
 1995-07-22  Daniel Pfeiffer  <Daniel.Pfeiffer@Informatik.START.dbp.de>
 
        * apropos.el: Add latest changes of old library and some more.
-       (apropos): Only show unbound symbols when do-all
+       (apropos): Only show unbound symbols when do-all.
        (apropos-documentation-check-elc-file): New copied function.
        (apropos-command): Also use `apropos-do-all' when called as function.
        (apropos-print-doc): Renamed from `apropos-print-documentation', i
        (apropos-use-faces, apropos-local-map): New variables.
        (apropos-command): New name for `command-apropos' no longer in help.el.
        (apropos-value): New command.
-       (apropos-documentation): New name for `super-apropos'
+       (apropos-documentation): New name for `super-apropos'.
        (apropos-follow, apropos-mouse-follow): New commands for hypertext.
        (apropos-describe-plist): New function.
 
 
        * skeleton.el: Partly rewritten and extended.
        (skeleton-filter, skeleton-untabify, skeleton-further-elements)
-       (skeleton-abbrev-cleanup): New variables
-       (skeleton-proxy, skeleton-abbrev-cleanup): New functions
+       (skeleton-abbrev-cleanup): New variables.
+       (skeleton-proxy, skeleton-abbrev-cleanup): New functions.
        (skeleton-insert): Sublanguage element < must now be handled via
        `skeleton-further-elements' (used only in sh-script and ada).  Lisp
        expressions can be quoted to ignore the return value.
 
 1995-06-29  David M. Smith  <D.M.Smith@lancaster.ac.uk>
 
-       * ielm.el (ielm-font-lock-keywords): New variable
+       * ielm.el (ielm-font-lock-keywords): New variable.
        (inferior-emacs-lisp-mode): Use it for font-lock support
 
 1995-06-29  Bryan O'Sullivan  <bos@Eng.Sun.COM>
index 6858c07d8521e2e32d4ebfd84e75feadd47809f5..2e96063eb81951aaeb62d9b8083a01a3d39c99cd 100644 (file)
        * abbrev.el: Likewise.
 
 1998-05-26  Emilio Lopes  <Emilio.Lopes@Physik.TU-Muenchen.DE>
-           Karl Fogel  <kfogel@red-bean.com>
+            Karl Fogel  <kfogel@red-bean.com>
 
        * bookmark.el: Changes so bookmark list mode works with Info:
        (bookmark-jump-noselect): Use an inner save-window-excursion.
 1997-12-09  Kenichi HANDA  <handa@nora.etl.go.jp>
 
        * language/korea-util.el (setup-korean-environment):
-       Bind C-f9 (intead of C-f10) to quail-hangul-switch-symbol-ksc.
+       Bind C-f9 (instead of C-f10) to quail-hangul-switch-symbol-ksc.
 
        * language/korean.el: Documentation for "Korean" language
        environment adjusted for the above change.
index 8ecf3f0e33af9eb60c5792061d3134fb0614092d..6e1de200f7c7aaff4d376b17ff154360fc50de7f 100644 (file)
        version numbering regexp list
        change-log-version-number-regexp-list.
        (change-log-find-version): Renamed to
-       change-log-version-number-search
+       change-log-version-number-search.
        (add-log-file-name-function): New.
        (change-log-search-vc-number): Added END parameter.  Added doc
        string to function.
 1999-12-15  Carsten Dominik  <dominik@astro.uva.nl>
 
        * textmodes/reftex.el (reftex-compile-variables): Respect new
-       structure of `reftex-index-macro'
+       structure of `reftex-index-macro'.
        (reftex-compile-variables): Use the changed structure of
        `reftex-label-alist'.
 
        ps-mule-prepare-cmpchar-font): Deleted.
        (ps-mule-string-encoding): New arg NO-SETFONT.
        (ps-mule-bitmap-prologue): In Postscript code of BuildGlyphCommon,
-       check Composing, not Cmpchar
+       check Composing, not Cmpchar.
        (ps-mule-initialize): Set ps-mule-composition-prologue-generated
        to nil.
        (ps-mule-begin-job): Check existence of new composition.
        (font-lock-add-keywords): Rename `major-mode' into `mode'.
        (font-lock-remove-keywords): Added a dummy `mode' argument for
        potential future support.
-       (font-lock-fontify-anchored-keywords,
+       (font-lock-fontify-anchored-keywords)
        (font-lock-fontify-keywords-region): Only handle multiline strings
        if necessary (avoids a pathological behavior in (f.ex) diff-mode).
 
        the new backquote syntax.
        (smbclient-program, smbclient-program-options)
        (smbclient-prompt-regexp, smbclient-font-lock-keywords): New
-       variables
+       variables.
        (smbclient, smbclient-list-shares): New functions
 
 1999-11-12  Sam Steingold  <sds@ksp.com>
        * whitespace.el: Test for existence of `defcustom' and `defgroup'
        using fboundp instead of assuming that these are not present in
        particular flavors of emacs.
-       (whitespace-version): Update to 2.8
+       (whitespace-version): Update to 2.8.
        (whitespace-display-in-modeline): Add custom variable to control
        displaying the whitespace errors on the modeline based on
        suggestion from <klaus.berndl@sdm.de>
 1999-10-19  Peter Kleiweg  <kleiweg@let.rug.nl>
 
        * progmodes/ps-mode.el (ps-mode-print-function): Fix default
-       value: \"lpr\" changed to "lpr"
-       (ps-mode-version): New constant
-       (ps-mode-show-version): New function, added key in ps-mode-map
-       (ps-run-messages): Removed
+       value: \"lpr\" changed to "lpr".
+       (ps-mode-version): New constant.
+       (ps-mode-show-version): New function, added key in ps-mode-map.
+       (ps-run-messages): Removed.
        (ps-run-font-lock-keywords-2): New defcustom variable replacing
        ps-run-messages.  These keywords now include the value of
        ps-run-prompt, making its fontification customizable.
        (ps-run-init): Removed \\n from docstring, it is now added when
-       the value is used
+       the value is used.
        (ps-run-font-lock-keywords-1): Added checking for initial ^ in
-       ps-run-prompt
+       ps-run-prompt.
        (ps-mode): Added ps-run-font-lock-keywords-2 to list of
        customizable variables in doc-string (its equivalent
        ps-run-messages was missing in previous version of the doc-string).
 1999-10-14  Stefan Monnier  <monnier@cs.yale.edu>
 
        * ange-ftp.el (ange-ftp-make-tmp-name, ange-ftp-del-tmp-name):
-       * browse-url.el (browse-url-of-buffer, browse-url-delete-temp-file),
+       * browse-url.el (browse-url-of-buffer, browse-url-delete-temp-file)
        (browse-url-temp-file-list, browse-url-delete-temp-file-list):
        * ediff-util.el (ediff-make-temp-file):
        * ediff-vers.el (ediff-pcl-cvs-view-revision):
        (custom-buffer-create-internal): Obey custom-raised-buttons,
        Custom-buffer-done.
        (custom-button-face): Make it `released-button'.
-       (custom-button-pressed-face): Make it `pressed-button'
+       (custom-button-pressed-face): Make it `pressed-button'.
        (custom-mode-map): Bind "q" to Custom-buffer-done.
        (custom-mode): Deal with raised/pressed buttons.
 
        font-lock-defaults setting.
        (java-properties-generic-mode): Supports both ! and # as comment
        characters.
-       (java-properties-generic-mode): Added an imenu-generic-expression
+       (java-properties-generic-mode): Added an imenu-generic-expression.
        (java-properties-generic-mode): Reworked to support the various
        different ways to separate name and value (viz, '=', ':' and
        whitespace).
        (reftex-toc-find-section): Use new version of `reftex-nearest-match'.
        (reftex-insert-docstruct): Adapted to work with the index stuff.
        (reftex-parse-from-file): Find index entries as well.
-       (reftex-toc-toggle-index): New function
+       (reftex-toc-toggle-index): New function.
        (reftex-toc-map): `i' is now used to toggle the index, File
        boundaries has been moved to `F'.
        (reftex-select-label-map): Toggling display of file boundaries is
        (reftex-index-section-letters, reftex-index-include-context)
        (reftex-index-follow-mode, reftex-index-header-face)
        (reftex-index-section-face, reftex-index-tag-face)
-       (reftex-index-face): New options
+       (reftex-index-face): New options.
        (reftex-index-map, reftex-index-menu, reftex-last-index-file)
        (reftex-index-tag, reftex-index-return-marker)
        (reftex-index-restriction-indicator, reftex-index-restriction-data)
        (reftex-index-key-end-re, reftex-find-index-entry-regexp-format)
        (reftex-everything-regexp-no-index, reftex-index-re)
        (reftex-macros-with-index, reftex-index-macro-alist): New variables.
-       (reftex-index-help, reftex-index-macros-builtin,
+       (reftex-index-help, reftex-index-macros-builtin)
        (reftex-key-to-index-macro-alist, reftex-query-index-macro-prompt)
-       (reftex-query-index-macro-help): New constants
+       (reftex-query-index-macro-help): New constants.
        (reftex-index-selection-or-word, reftex-index)
        (reftex-default-index, reftex-update-default-index)
        (reftex-index-complete-tag, reftex-index-select-tag)
        window; and poles can be oriented horizontally.  Face support is
        thrown in gratuitously.
        (hanoi): Changed default number of rings back to 3.
-       (hanoi-unix, hanoi-unix-64): New commands
+       (hanoi-unix, hanoi-unix-64): New commands.
        (hanoi-horizontal-flag, hanoi-move-period, hanoi-use-faces,
        hanoi-pole-face, hanoi-base-face, hanoi-even-ring-face,
        hanoi-odd-ring-face): New variables.
 1999-03-12  Eric M. Ludlam  <zappo@ultranet.com>
 
        * speedbar.el: Added commentary about stealthy functions.
-       (speedbar-message) new function.
-       (speedbar-y-or-n-p): New function
-       (speedbar-with-attached-buffer) Moved macro before reference.
+       (speedbar-message): New function.
+       (speedbar-y-or-n-p): New function.
+       (speedbar-with-attached-buffer): Moved macro before reference.
        Now uses `save-selected-window'.
-       (speedbar-mouse-hscroll, speedbar-track-mouse, speedbar-refresh,
-       speedbar-generic-item-info, speedbar-item-info-file-helper,
-       speedbar-item-delete, speedbar-insert-generic-list,
-       speedbar-timer-fn, speedbar-check-vc-this-line,
-       speedbar-check-obj-this-line, speedbar-fetch-dynamic-etags,
-       speedbar-buffers-item-info) Use speedbar-message.
-       (speedbar-item-info) Limit `message-log-max'.
-       (speedbar-item-load, speedbar-item-copy, speedbar-item-rename,
-       speedbar-item-delete, speedbar-item-object-delete,
-       speedbar-buffer-kill-buffer) Use speedbar-y-or-n-p.
+       (speedbar-mouse-hscroll, speedbar-track-mouse, speedbar-refresh)
+       (speedbar-generic-item-info, speedbar-item-info-file-helper)
+       (speedbar-item-delete, speedbar-insert-generic-list)
+       (speedbar-timer-fn, speedbar-check-vc-this-line)
+       (speedbar-check-obj-this-line, speedbar-fetch-dynamic-etags)
+       (speedbar-buffers-item-info): Use speedbar-message.
+       (speedbar-item-info): Limit `message-log-max'.
+       (speedbar-item-load, speedbar-item-copy, speedbar-item-rename)
+       (speedbar-item-delete, speedbar-item-object-delete)
+       (speedbar-buffer-kill-buffer): Use speedbar-y-or-n-p.
 
 1999-03-10  Kenichi Handa  <handa@mulelab.etl.go.jp>
 
 
 1999-02-12  Alex Schroeder  <a.schroeder@bsiag.ch>
 
-       * sql.el: Set version to 1.3.2
+       * sql.el: Set version to 1.3.2.
        (sql-solid-program): Added support for solid.
        (sql-help): Doc mentions sql-solid.
        (sql-solid): Entry function for Solid.
        coding-system-list here.
 
        * international/mule.el (coding-system-lessp): Moved here from
-       mule-util.el
+       mule-util.el.
        (add-to-coding-system-list): New function.
        (make-subsidiary-coding-system, make-coding-system,
        define-coding-system-alias): Use it instead of setting
        (speedbar-add-mode-functions-list) Improve doc.
        (speedbar-line-token) New function.
        (speedbar-dired) Fix order of directories in -shown-directories.
-       (speedbar-line-path): Default return is default-directory
+       (speedbar-line-path): Default return is default-directory.
        (speedbar-buffers-line-path): Return is dir name only.
        (speedbar-mode-functions-list): New variable.
        (speedbar-mouse-item-info): Rewrote to be a replaceable fn.
 1998-12-29  Masatake Yamato  <masata-y@tori.aist-nara.ac.jp>
 
        * page-ext.el: Added mouse-selection feature for pages directory buffer.
-       (pages-directory-map): Bind mouse-2
+       (pages-directory-map): Bind mouse-2.
        (pages-copy-header-and-position): Put text property.
        (pages-directory-goto-with-mouse): New function.
 
        (cperl-after-block-p): Likewise.
        (cperl-after-block-and-statement-beg): Likewise.
        (cperl-after-block-p): After END/BEGIN we are a block.
-       (cperl-after-expr-p): Skip labels when checking
+       (cperl-after-expr-p): Skip labels when checking.
        (cperl-indent-region): Make a marker for END - text added/removed.
        Disable hooks during the call (how to call them later?).
        Now indents 820-line-long function in 6.5 sec (including
        (cperl-fix-line-spacing): Sped up to bail out early.
        (x-color-defined-p): Was not compiling on XEmacs
        Was defmacro'ed with a tick.  Remove another def.
-       (cperl-clobber-lisp-bindings): If set, C-c variants are the old ones
+       (cperl-clobber-lisp-bindings): If set, C-c variants are the old ones.
        (cperl-unwind-to-safe): New function.
        (cperl-fontify-syntaxically): Use `cperl-unwind-to-safe' to start at
        reasonable position.
        (cperl-etags-goto-tag-location): New macro.
        (cperl-version): New variable.  New menu entry
        random docstrings: References to "future" 20.3 removed.
-       Menu was described as `CPerl' instead of `Perl'
+       Menu was described as `CPerl' instead of `Perl'.
        (perl-font-lock-keywords): Would not highlight `sub foo($$);'.
        (cperl-toggle-construct-fix): Was toggling to t instead of 1.
        (cperl-ps-print-init): Associate `cperl-array-face', `cperl-hash-face'
        enable-kinsoku.
 
        * simple.el (do-auto-fill): Don't check kinsoku-enable here.
-       Don't call kinsoku directly, intead call fill-find-break-point.
+       Don't call kinsoku directly, instead call fill-find-break-point.
 
        * textmodes/fill.el: Setup `fill-find-break-point-function'
        property to character sets which require `kinsoku' processing for
        filling.
        (fill-find-break-point): New function.
        (fill-region-as-paragraph): Don't check kinsoku-enable here.
-       Don't call kinsoku directly, intead call fill-find-break-point.
+       Don't call kinsoku directly, instead call fill-find-break-point.
 
 1998-10-18  Richard Stallman  <rms@psilocin.ai.mit.edu>
 
        set unconditional-jump to nil.
        (ccl-compile-read-multibyte-character): Return nil.
        (ccl-compile-write-multibyte-character): Likewise.
-       (ccl-compile-translate-character): Likewise
+       (ccl-compile-translate-character): Likewise.
        (ccl-compile-map-multiple): Likewise.
        (ccl-compile-map-single): Likewise.
 
 
        * net-utils.el (ftp, nslookup): Require comint.
        (network-service-connection): Likewise.
-       (whois-server-name): Defaults to whois.arin.net
+       (whois-server-name): Defaults to whois.arin.net.
        (whois-server-list, whois-server-tld, whois-guess-server): New var.
        (whois): Tries to guess the appropriate top-level domain server.
        (whois-get-tld): New function.
        (reftex-view-cr-cite, reftex-view-cr-ref, reftex-end-of-bib-entry):
        New functions.
        (reftex-auto-view-crossref): New value `window' allowed.
-       (reftex-view-crossref-when-idle): Process new `window' option in
+       (reftex-view-crossref-when-idle): Process new `window' option.
        (reftex-translate-to-ascii-function): New default.
        (reftex-label-illegal-re): Default changed, removed Latin1.
        (reftex-latin1-to-ascii): New function.
        (checkdoc-this-string-valid): When converting a comment into a doc
        string, make sure " chars are \".
        (checkdoc-sentencespace-region-engine): Only do double space check
-       if based on the variable `sentence-end-double-space'
+       if based on the variable `sentence-end-double-space'.
        (checkdoc-this-string-valid-engine): ? ends valid sentence.
        (checkdoc-proper-noun-region-engine): Exclude items in URLs
 
index 135eb8edbb3440ca42041c22fa742c1821d2d45f..56239cd3104d3f7afc97af8629d45bd2b561e96a 100644 (file)
        (cperl-find-pods-heres): Could access `font-lock-comment-face' in -nw.
        No -nw-compile time warnings now.
        (cperl-find-tags): TAGS file had too short substring-to-search.
-       Be less verbose in non-interactive mode
-       (imenu-example--create-perl-index): Set index-marker after name
+       Be less verbose in non-interactive mode.
+       (imenu-example--create-perl-index): Set index-marker after name.
        (cperl-outline-regexp): New variable.
        (cperl-outline-level): Made compatible with `cperl-outline-regexp'.
        (cperl-mode): Made use `cperl-outline-regexp'.
        (help-setup-xref, help-xref-following, help-make-xrefs)
        (help-xref-button, help-insert-xref-button, help-xref-interned)
        (help-xref-go-back, help-go-back, help-do-xref, help-follow)
-       (help-xref-on-pp): Functions moved into `help-mode.el'
+       (help-xref-on-pp): Functions moved into `help-mode.el'.
        (help-mode-map, help-xref-stack, help-xref-stack-item)
        (help-highlight-p, help-highlight-face, help-back-label)
        (help-xref-symbol-regexp, help-xref-mule-regexp)
 2001-09-07  Eli Zaretskii  <eliz@is.elta.co.il>
 
        * textmodes/ispell.el (ispell-dictionary-alist-4): Add "german"
-       and "german8", for the new German orthography dictionaries,
+       and "german8", for the new German orthography dictionaries.
        (ispell-dictionary-alist-5, ispell-dictionary-alist-6): Rearrange
        the entries, to keep the line length balanced for loaddefs.el.
 
        * Makefile.in (finder_setwins): Renamed from nonobsolete_setwins.
        Don't include term/.
 
-       * mail/sc.el:  Moved to obsolete/.
+       * mail/sc.el: Moved to obsolete/.
 
 2001-08-14  Vinicius Jose Latorre  <vinicius@cpqd.com.br>
 
 
        * ediff-init.el (ediff-with-syntax-table): New macro, uses
        with-syntax-table.
-       (ediff-coding-system-for-read): From ediff-diff.el
+       (ediff-coding-system-for-read): From ediff-diff.el.
        (ediff-coding-system-for-write): New variable.
        (ediff-highest-priority): Fixed the bug having to do with disappearing
        overlays.
 
 2001-06-27  Francesco Potortì  <pot@gnu.org>
 
-       * uniquify.el: (uniquify-rationalize-file-buffer-names):
-         Undo previous change.
+       * uniquify.el (uniquify-rationalize-file-buffer-names):
+       Undo previous change.
 
 2001-06-27  Francesco Potortì  <pot@gnu.org>
 
 
 2001-02-12  Dave Love  <d.love@dl.ac.uk>
 
-       * international/latin1-disp.el:  Doc fixes.
+       * international/latin1-disp.el: Doc fixes.
        (latin1-display) <defgroup>: Add :link.
        (latin1-display) <function>: Set variable latin1-display.
 
 
        * shell.el (shell-write-history-on-exit): Make sure that we are in
        the shell buffer (M-x tex-file RET inserted the error message into
-       the TeX buffer).
+       the TeX buffer).
 
 2001-01-27  Eli Zaretskii  <eliz@is.elta.co.il>
 
        to nil.
 
        * tooltip.el (tooltip-frame-parameters): Remove colors.
-       (tooltip): New face
+       (tooltip): New face.
        (tooltip-set-param): New function.
        (tooltip-show): Set up color frame parameters from face `tooltip'.
        Display the tooltip text in face `tooltip'.
 2000-11-13  Miles Bader  <miles@gnu.org>
 
        * textmodes/fill.el (skip-line-prefix): New function.
-       (fill-region-as-paragraph, fill-region):  Return the fill-prefix.
+       (fill-region-as-paragraph, fill-region): Return the fill-prefix.
        (fill-paragraph): Don't leave point inside the fill-prefix.
        * textmodes/refill.el (refill-fill-paragraph-at): Don't leave
        point inside the fill-prefix.
 
 2000-11-12  Dave Love  <fx@gnu.org>
 
-       * mail/feedmail.el: Fix header,
+       * mail/feedmail.el: Fix header.
        (feedmail) <defgroup>: Add :link.
 
        * view.el: Use local-map property, not keymap on mode-line string.
        * iswitchb.el (iswitchb-mode): Add :require.
 
        * info.el (Info-goto-node, Info-menu): Doc fix.
-       (Info-mode-menu): Bind beginning-of-buffer, Info-edit
+       (Info-mode-menu): Bind beginning-of-buffer, Info-edit.
        (info-tool-bar-map): New variable.
        (Info-mode): Use it.
        (Info-edit-map): Define all in defvar.
 2000-10-06  Dave Love  <fx@gnu.org>
 
        * textmodes/fill.el (sentence-end-double-space)
-       (sentence-end-without-period):  Doc fix.
+       (sentence-end-without-period): Doc fix.
        (adaptive-fill-regexp): Purecopy.
        (unjustify-current-line): Use line-end-position.
        (fill-individual-paragraphs-prefix): Use line-beginning-position.
 
        * net/net-utils.el (nslookup-font-lock-keywords)
        (ftp-font-lock-keywords, smbclient-font-lock-keywords):
-       Only set if window-system is non-nil
+       Only set if window-system is non-nil.
        (net-utils-run-program): Returns buffer.
        (network-connection-reconnect): Added this function.
 
        (generic-mode-alist): Renamed to generic-mode-list.
        (generic-find-file-regexp): Default changed to "^#".
        (generic-read-type): Uses completing read on generic-mode-list.
-       (generic-mode-sanity-check): removed this function.
-       (generic-add-to-auto-mode): Removed this function
+       (generic-mode-sanity-check): Removed this function.
+       (generic-add-to-auto-mode): Removed this function.
        (generic-mode-internal): Bind mode-specific definitions
        into function instead of putting them in alist.
        (generic-mode-set-comments): Reworked extensively.
-       (generic-mode-find-file-hook): Simplified regexp searching
-       (generic-make-keywords-list): Omit extra pair of parens
+       (generic-mode-find-file-hook): Simplified regexp searching.
+       (generic-make-keywords-list): Omit extra pair of parens.
 
        * find-lisp.el (find-lisp-find-files-internal):
        Make sure directory name ends with "/".
        Regexp now allows leading whitespace.
        (rc-generic-mode): Added eval-when-compile
        around generic-make-keywords-list.
-       Deleted duplicate regexp
+       Deleted duplicate regexp.
        (rul-generic-mode): Added eval-when-compile
        around generic-make-keywords-list.
        (etc-fstab-generic-mode): New generic mode.
        (comint-insert-clicked-input): Be more careful to find the overlay.
        Use this-command-keys rather than hardcoding mouse-2.
 
-       * font-lock.el: Replace confusing (,@ with ,
+       * font-lock.el: Replace confusing (,@ with ,.
        (tex-font-lock-keywords-1, tex-font-lock-keywords-2):
        Don't use regexp-opt-depth.  Spice up the regexp for args.
        Don't distinguish between cmds that can take an opt arg or not.
 
        * strokes.el: Sync with maintainer's current version with changes
        for Emacs, but avoid runtime cl and levents.
-       (toplevel):  Change autoloads and compilation requires.
+       (toplevel): Change autoloads and compilation requires.
        (strokes-version, strokes-bug-address, strokes-lift): Values
        changed.
        (strokes-xpm-header, strokes-insinuated): New variable.
        New functions, used instead of non-`strokes-' versions..
        (strokes-mouse-event-p): Rewritten.
        (strokes-event-closest-point): Avoid event-point.
-       (strokes-get-grid-position): Avoid cdadr, caadr
+       (strokes-get-grid-position): Avoid cdadr, caadr.
        (strokes-read-stroke, strokes-read-complex-stroke): Avoid levents
        functions.
        (strokes-help): Use with-output-to-temp-buffer.
 2000-09-14  Dave Love  <fx@gnu.org>
 
        * toolbar/cancel.xpm, toolbar/close.xpm, toolbar/copy.xpm,
-       toolbar/cut.xpm, toolbar/exit.xpm, toolbar/fld_open.xpm,
-       toolbar/help.xpm, toolbar/info.xpm, toolbar/mail.xpm,
-       toolbar/mail_compose.xpm, toolbar/new.xpm, toolbar/open.xpm,
-       toolbar/paste.xpm, toolbar/preferences.xpm, toolbar/print.xpm,
-       toolbar/save.xpm, toolbar/saveas.xpm, toolbar/search-replace.xpm,
-       toolbar/search.xpm, toolbar/spell.xpm, toolbar/undo.xpm:  New.
+       toolbar/cut.xpm, toolbar/exit.xpm, toolbar/fld_open.xpm,
+       toolbar/help.xpm, toolbar/info.xpm, toolbar/mail.xpm,
+       toolbar/mail_compose.xpm, toolbar/new.xpm, toolbar/open.xpm,
+       toolbar/paste.xpm, toolbar/preferences.xpm, toolbar/print.xpm,
+       toolbar/save.xpm, toolbar/saveas.xpm, toolbar/search-replace.xpm,
+       * toolbar/search.xpm, toolbar/spell.xpm, toolbar/undo.xpm: New.
        From Tuomas Kuosmanen <tigert@gimp.org>.  (Gnome icons fetched
        from <URL:http://tigert.gimp.org/gnome/gnome-stock/>.)
 
 
 2000-09-05  Stefan Monnier  <monnier@cs.yale.edu>
 
-       * vc.el: (toplevel): Don't require `dired' at run-time.
+       * vc.el (toplevel): Don't require `dired' at run-time.
        (vc-dired-resynch-file): Remove autoload cookie.
 
 2000-09-05  Andre Spiegel  <spiegel@gnu.org>
        `vc-locking-user' semantics.
        (vc-backend-merge): Remove.
 
-       * vc-rcs.el, vc-scc.el: (vc-{sc,r}cs-check{in,out}): Update 'vc-state
+       * vc-rcs.el, vc-scc.el (vc-{sc,r}cs-check{in,out}): Update 'vc-state
        rather than 'vc-locking-user.
 
        * vc-rcs-hooks.el (vc-rcs-consult-headers): Adapt to new `vc-state'.
        * locate.el (locate): Cleaned up locate command's interactive prompting
        Thanks to François_Pinard <pinard@iro.umontreal.ca> for suggestions.
 
-       * filecache.el (file-cache-case-fold-search): New variable
-       (file-cache-assoc-function): New variable
+       * filecache.el (file-cache-case-fold-search): New variable.
+       (file-cache-assoc-function): New variable.
        (file-cache-minibuffer-complete): Use file-cache-assoc-function.
-       Use file-cache-case-fold-search variable
-       (file-cache-add-file): Use file-cache-assoc-function
-       (file-cache-delete-file): likewise
-       (file-cache-directory-name): likewise
-       (file-cache-debug-read-from-minibuffer): likewise
+       Use file-cache-case-fold-search variable.
+       (file-cache-add-file): Use file-cache-assoc-function.
+       (file-cache-delete-file): Likewise.
+       (file-cache-directory-name): Likewise.
+       (file-cache-debug-read-from-minibuffer): Likewise.
 
 2000-08-28  Gerd Moellmann  <gerd@gnu.org>
 
 
        * international/ja-dic-cnv.el: Renamed from skkdic-cnv.el.
        Provide ja-dic-cnv instead of skkdic-cnv.
-       (ja-dic-filename): Renamed from skkdic-filename.  Referers changed
+       (ja-dic-filename): Renamed from skkdic-filename.  Referers changed.
        (iso-2022-7bit-short): Add safe-charsets property.
        (skkdic-convert-postfix): Search Japanese chou-on character in
        addition to Hiragana character.
        (skkdic-convert-prefix, skkdic-collect-okuri-nasi): Likewise.
-       (skkdic-convert): Change file names from skkdic.el to ja-dic.el
+       (skkdic-convert): Change file names from skkdic.el to ja-dic.el.
        (batch-skkdic-convert): Likewise.
 
        * international/ja-dic-utl.el: Renamed from skkdic-utl.el.
        (ispell-dictionary-alist-4): Fixed regexp in francais-tex
        dictionary, added italiano dictionary.
        (ispell-skip-region-alist): Removed regexp thrashing when `-' is a
-       word character
+       word character.
        (ispell-tex-skip-alists): Added psfig support.
        (ispell-skip-html): Renamed from ispell-skip-sgml.
        (ispell-begin-skip-region-regexp, ispell-skip-region)
        (ispell-minor-check): Improved html skipping support to skip across
-       code, and recognize `&' commands without proper `;' syntax;
+       code, and recognize `&' commands without proper `;' syntax.
        (ispell-process-line): Fix alignment error when manually
        correcting spelling.
        (ispell): Fix comment string.
        (goto-address-url-face, goto-address-url-mouse-face)
        (goto-address-mail-face, goto-address-mail-mouse-face): Doc fix.
        (goto-address-url-regexp): Use thing-at-point-url-regexp.
-       (goto-address-fontify, goto-address-at-mouse): Simplify,
+       (goto-address-fontify, goto-address-at-mouse): Simplify.
        (goto-address-at-point): browse-url-url-at-point,
        goto-address-find-address-at-point can return nil.
        (goto-address-find-address-at-point): Return nil on failure.
        (comint-replace-by-expanded-history)
        (comint-get-old-input-default, comint-show-output)
        (comint-backward-matching-input, comint-forward-matching-input)
-       (comint-next-prompt, comint-previous-prompt):  Use field
+       (comint-next-prompt, comint-previous-prompt): Use field
        properties if comint-use-prompt-regexp-instead-of-fields is nil.
        (comint-line-beginning-position): New function.
        (comint-bol): Use comint-line-beginning-position.  Make ARG optional.
        leading comma nicely. Extended to handle member initializers
        too.
 
-       * cc-engine.el: (c-beginning-of-inheritance-list,
-       c-guess-basic-syntax): Fixed recognition of inheritance lists
+       * cc-engine.el (c-beginning-of-inheritance-list)
+       (c-guess-basic-syntax): Fixed recognition of inheritance lists
        when the lines begins with a comma.
 
        * cc-vars.el (c-offsets-alist): Changed default for
        ada-xref.el before ada-prj.el, so that the Project menu is created
        when ada-prj tries to add to it.
        (ada-activate-keys-for-case): Suppress the characters that are not
-       part of the Ada syntax. Better compatibility with else-mode
+       part of the Ada syntax. Better compatibility with else-mode.
        (ada-adjust-case-interactive): When auto-casing is not active,
        correctly insert newlines (used to insert only ^M).  Prevent the
        syntax table from being changed in case of an error
        (or '_' becomes part of a word and some commands are confused).
        Do nothing if ada-auto-case is nil.
-       (ada-after-keyword-p): Ignore keywords that are also attributes
-       (ada-batch-reformat): Update usage comment
-       (ada-call-from-contextual-menu): New function
+       (ada-after-keyword-p): Ignore keywords that are also attributes.
+       (ada-batch-reformat): Update usage comment.
+       (ada-call-from-contextual-menu): New function.
        (ada-case-read-exceptions): Reinitialize the casing exception list
        first to nil first, so that the casing exception file can be
        shared.
        (ada-check-defun-name): Handles "configure" keyword for gnatdist
        files.
        (ada-compile-goto-error): Fix regexp used to detect a file:line
-       anywhere in the error message
-       (ada-contextual-menu-last-point): New variable
+       anywhere in the error message.
+       (ada-contextual-menu-last-point): New variable.
        (ada-create-keymap): If the variable delete-key-deletes-forward is
        t on XEmacs, it means that DEL should delete one character
        forward.
        are not in fact seeing "end if".  Ignore "when" statements except
        when initial keyword was "begin".  Fix handling of nested
        procedures.  Add a recursive call to this function to skip over
-       other 'end' statmts.  Fix indentation for "when .. => begin"
+       other 'end' statmts.  Fix indentation for "when .. => begin".
        (ada-in-open-paren-p): Fix indentation for complex boolean
        expressions, where 'and then', 'or else' and parenthesis
        statements are mixed up.
        (ada-in-paramlist-p): Skip comments while searching for the
        beginning Fix handling of operator declarations.
-       (ada-indent-align-comments): New variable
+       (ada-indent-align-comments): New variable.
        (ada-indent-current): Change the syntax table only in the
        protected section, so that we are sure it is restored correctly.
        (ada-indent-on-previous-lines): Use ada-use-indent and
-       ada-with-indent Correctly indent "select ... then"
+       ada-with-indent.  Correctly indent "select ... then".
        (ada-indent-region): Slight speedup.
        (ada-indent-renames): New variable.
        (ada-last-which-function-subprog, ada-last-which-function-line):
-       New variables
+       New variables.
        (ada-looking-at-semi-private): Correctly indent the 'private'
        keyword when it is the first word in a package declaration.
        (ada-loose-case-word): Stop searching if at the end of the buffer.
        (ada-mode): Add support for abbrev-mode, outline-mode and
        which-func-mode Override the old find-file.el entry in
        ff-special-constructs since it is using the obsolete
-       ada-spec-suffix variable
-       (ada-no-auto-case): New function
+       ada-spec-suffix variable.
+       (ada-no-auto-case): New function.
        (ada-scan-paramlist): When parsing the argument type, accept
        spaces (as in "X 'Class", generated by Rational Rose).
        (ada-other-file-name): No longer loads the other file.
        (ada-search-ignore-complex-boolean): New function.
        (ada-uncomment-region): Emacs21 already knows how to delete
        comments not starting in the first column.
-       (ada-use-indent): New variable
+       (ada-use-indent): New variable.
        (ada-which-function): New function.
-       (ada-with-indent): New variable
-       (ada-xemacs): evaluate it at compile time too, so that ada-mode.el
+       (ada-with-indent): New variable.
+       (ada-xemacs): Evaluate it at compile time too, so that ada-mode.el
        can be batch-compiled from the command line.
 
        * ada-xref.el: Got rid of all byte-compiler warnings on Emacs.
        Add to the menu when the file is loaded, not in ada-mode-hook.
        Add -toolbar to the default ddd command Switches moved from
        ada-prj-default-comp-cmd and ada-prj-default-make-cmd to
-       ada-prj-default-comp-opt
-       (ada-add-ada-menu): Remove the map and name parameters Add the Ada
-       Reference Manual to the menu
-       (ada-check-current): rewritten as a call to ada-compile-current
+       ada-prj-default-comp-opt.
+       (ada-add-ada-menu): Remove the map and name parameters Add the Ada
+       Reference Manual to the menu.
+       (ada-check-current): Rewritten as a call to ada-compile-current.
        (ada-compile): Removed.
        (ada-compile-application, ada-compile-current, ada-check-current):
        Set the compilation-search-path so that compile.el automatically
        finds the sources in src_dir.  Automatic scrolling of the
        compilation buffer.  C-uC-cC-c asks for confirmation before
-       compiling
-       (ada-compile-current): New parameter, prj-field
+       compiling.
+       (ada-compile-current): New parameter, prj-field.
        (ada-complete-identifier): Load the .ali file before doing
-       processing
+       processing.
        (ada-find-ali-file-in-dir): prepend build_dir to obj_dir to
        conform to gnatmake's behavior.
-       (ada-find-file-in-dir): New function
-       (ada-find-references): Set the environment variables for gnatfind
+       (ada-find-file-in-dir): New function.
+       (ada-find-references): Set the environment variables for gnatfind.
        (ada-find-src-file-in-dir): New function.
-       (ada-first-non-nil): Removed
+       (ada-first-non-nil): Removed.
        (ada-gdb-application): Add support for jdb, the java debugger.
        (ada-get-ada-file-name): Load the original-file first if not done
        yet.
        (ada-get-all-references): Handles the new ali syntax (parent types
        are found between <>).
-       (ada-initialize-runtime-library): New function
+       (ada-initialize-runtime-library): New function.
        (ada-mode-hook): Always load a project file when a file is opened,
        so that the casing exceptions are correctly read.
        (ada-operator-re): Add all missing operators ("abs", "rem", "**").
        src_dir to initialize ada-search-directories and
        compilation-search-path,...  Add the standard runtime library to
        the search path for find-file.
-       (ada-prj-default-debugger): Was missing an opening '{'
+       (ada-prj-default-debugger): Was missing an opening '{'.
        (ada-prj-default-bind-opt, ada-prj-default-link-opt): New
        variables.
-       (ada-prj-default-gnatmake-opt): New variable
+       (ada-prj-default-gnatmake-opt): New variable.
        (ada-prj-find-prj-file): Handles non-file buffers For non-Ada
        buffers, the project file is the default one Save the windows
        configuration before displaying the menu.
-       (ada-prj-src-dir, ada-prj-obj-dir, ada-prj-comp-opt,...): Removed
+       (ada-prj-src-dir, ada-prj-obj-dir, ada-prj-comp-opt,...): Removed.
        (ada-read-identifier): Fix xrefs on operators (for "mod", "and",
        ...)  regexp-quote identifiers names to support operators +,
        -,... in regexps.
        (ada-remote): New function.
        (ada-run-application): Erase the output buffer before starting the
        run Support remote execution of the application.  Use
-       call-process, or the arguments are incorrectly parsed
+       call-process, or the arguments are incorrectly parsed.
        (ada-set-default-project-file): Reread the content of the active
        project file, not the one from the current buffer When a project
        file is set as the default project, all directories are
        automatically associated with it.
-       (ada-set-environment): New function
-       (ada-treat-cmd-string): New special variable ${current}
+       (ada-set-environment): New function.
+       (ada-treat-cmd-string): New special variable ${current}.
        (ada-treat-cmd-string): Revised.  The substitution is now done for
-       any ${...} substring
+       any ${...} substring.
        (ada-xref-current): If no body was found, compiles the spec
        instead.  Setup ADA_{SOURCE,OBJECTS}_PATH before running the
        compiler to get rid of command line length limitations.
-       (ada-xref-get-project-field): New function
-       (ada-xref-project-files): New variable
+       (ada-xref-get-project-field): New function.
+       (ada-xref-project-files): New variable.
        (ada-xref-runtime-library-specs-path)
-       (ada-xref-runtime-library-ali-path): New variables
+       (ada-xref-runtime-library-ali-path): New variables.
        (ada-xref-set-default-prj-values): Default run command now does a
        cd to the build directory.  New field: main_unit Provide a default
        file name even if the current buffer has no prj file.
        Rewritten to show a tabbed-dialog.
        (ada-prj-add-ada-menu): Remove the map and name parameters.
        (ada-prj-display-page, ada-prj-field, ada-prj-initialize-values):
-       New function
-       (ada-prj-load-directory, ada-prj-subdirs-of): New functions
-       (ada-prj-load-from-file): New function
-       (ada-prj-save): Always save fields that depend on the current buffer
+       New function.
+       (ada-prj-load-directory, ada-prj-subdirs-of): New functions.
+       (ada-prj-load-from-file): New function.
+       (ada-prj-save): Always save fields that depend on the current buffer.
        (ada-prj-show-value): New function
 
        * ada-stmt.el (ada-stmt-add-to-ada-menu): Hide the menu if not in
        (cyrillic-koi8-r-encode-table): Define it as a translation table
        made from the reverse map of above.
        (ccl-decode-koi8): Use translate-character.
-       (ccl-encode-koi8, ccl-encode-koi8-font): Likewize
+       (ccl-encode-koi8, ccl-encode-koi8-font): Likewise.
        (cyrillic-alternativnyj-nonascii-translation-table): Define it as
        a translation table made from cyrillic-alternativnyj-decode-table.
        (cyrillic-alternativnyj-encode-table): Define it as a translation
 
        * speedbar.el (speedbar-easymenu-definition-base): Image toggle fix.
        (speedbar-insert-button): Invisible text property fix.
-       (speedbar-directory-plus): Renamed from speedbar-directory-+
-       (speedbar-directory-minus): Renamed from speedbar-directory--
-       (speedbar-page-plus): Renamed from speedbar-file-+
-       (speedbar-page-minus): Renamed from speedbar-file--
-       (speedbar-page): Renamed from speedbar-file-
-       (speedbar-tag): Renamed from speedbar-tag-
-       (speedbar-tag-plus): Renamed from speedbar-tag-+
-       (speedbar-tag-minus): Renamed from speedbar-tag--
+       (speedbar-directory-plus): Renamed from speedbar-directory-+.
+       (speedbar-directory-minus): Renamed from speedbar-directory--.
+       (speedbar-page-plus): Renamed from speedbar-file-+.
+       (speedbar-page-minus): Renamed from speedbar-file--.
+       (speedbar-page): Renamed from speedbar-file-.
+       (speedbar-tag): Renamed from speedbar-tag-.
+       (speedbar-tag-plus): Renamed from speedbar-tag-+.
+       (speedbar-tag-minus): Renamed from speedbar-tag--.
        (speedbar-expand-image-button-alist): Use above renames.
 
        * sb-dir-plus.xpm: Renamed from sb-dir+.xpm
        (speedbar-visiting-tag-hook): Set new defaults.  Added options.
        (speedbar-reconfigure-keymaps-hook): New variable.
        (speedbar-frame-parameters): Updated documentation.
-       (speedbar-use-imenu-flag): Updated custom tag
+       (speedbar-use-imenu-flag): Updated custom tag.
        (speedbar-dynamic-tags-function-list): New variable.
        (speedbar-tag-hierarchy-method): Updated doc & custom.
        (speedbar-indentation-width, speedbar-indentation-width) New
        `force-mode-line-update'.
        (speedbar-mode, speedbar-quick-mouse, speedbar-click)
        (speedbar-double-click): Use `speedbar-mouse-set-point' instead of
-       `mouse-set-point'
+       `mouse-set-point'.
        (speedbar-reconfigure-keymaps): Run configure keymap hooks.
        (speedbar-item-info-tag-helper): Revamped to handle a wider range
        of arbitrary text, and new helper functions.
        (speedbar-apply-one-tag-hierarchy-method): Deleted (and replaced).
        (speedbar-sort-tag-hierarchy, speedbar-prefix-group-tag-hierarchy)
        (speedbar-trim-words-tag-hierarchy)
-       (speedbar-simple-group-tag-hierarchy): New functions
+       (speedbar-simple-group-tag-hierarchy): New functions.
        (speedbar-create-tag-hierarchy): Update doc, use new tag hooks.
        (speedbar-insert-imenu-list, speedbar-insert-etags-list): New
        functions.
-       (speedbar-mouse-set-point): New function
+       (speedbar-mouse-set-point): New function.
        (speedbar-power-click): Updated documentation.
        (speedbar-line-token, speedbar-goto-this-file): Handle more types
        of tag prefix text.
        "Revert Buffer" menu items.
        (speedbar-buffer-buttons-engine): Be smarter when creating a
        filename tag (for expansion purposes.).
-       (speedbar-highlight-one-tag-line,
+       (speedbar-highlight-one-tag-line)
        (speedbar-unhighlight-one-tag-line, speedbar-recenter-to-top)
        (speedbar-recenter): New functions.
        (defimage-speedbar): Image loading abstraction.
        (help-xref-interned): Maybe insert face doc too.  Separate
        sections with a line of hyphens.
 
-       * faces.el:  Some doc fixes.  Declare some functions obsolete.
+       * faces.el: Some doc fixes.  Declare some functions obsolete.
        (describe-face): Add customize button.  Return the help
        text.  Fix prompt.
 
 2000-03-30  Peter Breton  <pbreton@ne.mediaone.net>
 
        * net/net-utils.el:
-       (network-connection-host, network-connection-service): New variables
-       (network-connection-mode): New mode, derived from comint-mode
+       (network-connection-host, network-connection-service): New variables.
+       (network-connection-mode): New mode, derived from comint-mode.
        (network-connection-mode-setup): New function, saves host and
        service information in local variables.
 
        * lisp/locate.el:
-       (locate-word-at-point): Added this function
+       (locate-word-at-point): Added this function.
        (locate): Default to using locate-word-at-point as input
        Run dired-mode-hook
 
        (backward-kill-word): Revert addition of * to interactive spec --
        it's a feature.
 
-       * paragraphs.el: (kill-paragraph, backward-kill-paragraph)
+       * paragraphs.el (kill-paragraph, backward-kill-paragraph)
        (backward-kill-sentence, kill-sentence): Likewise.
 
        * gud.el (gud-jdb-build-class-source-alist): Prepend space to
 
 2000-02-10  Dave Love  <fx@gnu.org>
 
-       * wid-edit.el: (widgets) [defgroup]: Remove url link.
+       * wid-edit.el (widgets) [defgroup]: Remove url link.
        (widget-color-choice-list, widget-color-history, widget-mouse-help):
        Deleted.
        (widget-specify-field, widget-specify-button): Don't use
        * simple.el (eval-expression): Don't bind debug-on-error if
        eval-expression-debug-on-error is nil.  Detect changed
        debug-on-error, and propagate new value to global binding, if
-       eval-expression-debug-on-error is non-nil,
+       eval-expression-debug-on-error is non-nil.
        (eval-expression-debug-on-error): Change doc string.
 
 2000-01-11  Richard M. Stallman  <rms@gnu.org>
 
 2000-01-10  Ken Stevens  <k.stevens@ieee.org>
 
-       * ispell.el:  Only define dictionaries in menus when they exist.
+       * ispell.el: Only define dictionaries in menus when they exist.
        (version18p): New variable.
        (version20p): New variable.
        (xemacsp): New variable.
index f9dc1710cc34792eb96d66eb34e1a597a8964bcc..8d681b4f673651beb5f4f7a60a8cb43bc99ddf57 100644 (file)
 
 SHELL = /bin/sh
 
-lisp=@srcdir@
-VPATH=@srcdir@
-srcdir=@srcdir@/..
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+abs_top_builddir = @abs_top_builddir@
+lisp = $(srcdir)
+VPATH = $(srcdir)
 
 # You can specify a different executable on the make command line,
 # e.g. "make EMACS=../src/emacs ...".
 
-EMACS = ../src/emacs
+# We sometimes change directory before running Emacs (typically when
+# building out-of-tree, we chdir to the source directory), so we need
+# to use an absolute file name.
+EMACS = ${abs_top_builddir}/src/emacs
 
-# Command line flags for Emacs.  This must include --multibyte,
-# otherwise some files will not compile.
+# Command line flags for Emacs.
 
-EMACSOPT = -batch --no-site-file --multibyte
+EMACSOPT = -batch --no-site-file
 
 # Extra flags to pass to the byte compiler
 BYTE_COMPILE_EXTRA_FLAGS =
@@ -79,29 +83,26 @@ COMPILE_FIRST = \
 emacs = EMACSLOADPATH=$(lisp) LC_ALL=C $(EMACS) $(EMACSOPT)
 
 # Common command to find subdirectories
-
-setwins=subdirs=`(cd $$wd; find . -type d -print)`; \
+setwins=subdirs=`(find . -type d -print)`; \
        for file in $$subdirs; do \
-          case $$file in */Old | */RCS | */CVS | */CVS/* | */.* | */.*/* | */=* ) ;; \
-               *) wins="$$wins $$wd/$$file" ;; \
+          case $$file in */.* | */.*/* | */=* ) ;; \
+               *) wins="$$wins $$file" ;; \
           esac; \
         done
 
 # Find all subdirectories except `obsolete' and `term'.
-
-setwins_almost=subdirs=`(cd $$wd; find . -type d -print)`; \
+setwins_almost=subdirs=`(find . -type d -print)`; \
        for file in $$subdirs; do \
-          case $$file in */Old | */RCS | */CVS | */CVS/* | */.* | */.*/* | */=* | */obsolete | */term ) ;; \
-               *) wins="$$wins $$wd/$$file" ;; \
+          case $$file in */.* | */.*/* | */=* | */obsolete | */term ) ;; \
+               *) wins="$$wins $$file" ;; \
           esac; \
         done
 
 # Find all subdirectories in which we might want to create subdirs.el
-
-setwins_for_subdirs=subdirs=`(cd $$wd; find . -type d -print)`; \
+setwins_for_subdirs=subdirs=`(find . -type d -print)`; \
        for file in $$subdirs; do \
-          case $$file in */Old | */RCS | */CVS | */CVS/* | */.* | */.*/* | */=* | */cedet* ) ;; \
-               *) wins="$$wins $$wd/$$file" ;; \
+          case $$file in */.* | */.*/* | */=* | */cedet* ) ;; \
+               *) wins="$$wins $$file" ;; \
           esac; \
         done
 
@@ -110,8 +111,6 @@ setwins_for_subdirs=subdirs=`(cd $$wd; find . -type d -print)`; \
 # 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
-       @: Let us check that we byte-compiled all the files.
-       $(MAKE) $(MFLAGS) compile-last EMACS=$(EMACS)
 
 doit:
 
@@ -132,14 +131,14 @@ doit:
 $(lisp)/cus-load.el:
        $(MAKE) $(MFLAGS) custom-deps
 custom-deps: doit
-       wd=$(lisp); $(setwins_almost); \
+       cd $(lisp); $(setwins_almost); \
        echo Directories: $$wins; \
        $(emacs) -l cus-dep --eval '(setq generated-custom-dependencies-file "$(lisp)/cus-load.el")' -f custom-make-dependencies $$wins
 
 $(lisp)/finder-inf.el:
        $(MAKE) $(MFLAGS) finder-data
 finder-data: doit
-       wd=$(lisp); $(setwins_almost); \
+       cd $(lisp); $(setwins_almost); \
        echo Directories: $$wins; \
        $(emacs) -l finder --eval '(setq generated-finder-keywords-file "$(lisp)/finder-inf.el")' -f finder-compile-keywords-make-dist $$wins
 
@@ -148,8 +147,8 @@ finder-data: doit
 autoloads: $(LOADDEFS) doit
        chmod +w $(lisp)/ps-print.el $(lisp)/emulation/tpu-edt.el \
          $(lisp)/emacs-lisp/cl-loaddefs.el $(lisp)/mail/rmail.el \
-         $(lisp)/dired.el $(lisp)/ibuffer.el
-       wd=$(lisp); $(setwins_almost); \
+         $(lisp)/dired.el $(lisp)/ibuffer.el $(lisp)/htmlfontify.el
+       cd $(lisp); $(setwins_almost); \
        echo Directories: $$wins; \
        $(emacs) -l autoload --eval '(setq generated-autoload-file "$(lisp)/loaddefs.el")' -f batch-update-autoloads $$wins
 
@@ -158,9 +157,9 @@ autoloads: $(LOADDEFS) doit
 $(lisp)/subdirs.el:
        $(MAKE) $(MFLAGS) update-subdirs
 update-subdirs: doit
-       wd=$(lisp); $(setwins_for_subdirs); \
+       cd $(lisp); $(setwins_for_subdirs); \
        for file in $$wins; do \
-          $(srcdir)/update-subdirs $$file; \
+          $(top_srcdir)/update-subdirs $$file; \
        done;
 
 updates: update-subdirs autoloads finder-data custom-deps
@@ -174,1290 +173,12 @@ cvs-update: bzr-update
 # Update the AUTHORS file.
 
 update-authors:
-       $(emacs) -l authors -f batch-update-authors $(srcdir)/etc/AUTHORS $(srcdir)
+       $(emacs) -l authors -f batch-update-authors $(top_srcdir)/etc/AUTHORS $(top_srcdir)
 
 TAGS TAGS-LISP: $(lisptagsfiles1) $(lisptagsfiles2) $(lisptagsfiles3) $(lisptagsfiles4)
        els=`echo $(lisptagsfiles1) $(lisptagsfiles2) $(lisptagsfiles3) $(lisptagsfiles4) | sed -e "s,$(lisp)/[^ ]*loaddefs[^ ]*,," -e "s,$(lisp)/ldefs-boot[^ ]*,,"`; \
        ${ETAGS} -o $@ $$els
 
-.PHONY: update-elclist
-
-## Post-bootstrap, find the list of .elc files and use sed to update
-## ELCFILES in Makefile.in.
-## Errors in the final sed are non-fatal, since they have no effect on
-## building Emacs.  chmod +w is for CVSREAD=1.
-## "echo" is non-portable with regards to backslashes, eg between zsh
-## and bash.  Hence the use of sed on line 2 below (line 1 seems to be OK).
-## http://lists.gnu.org/archive/html/emacs-devel/2008-05/msg01535.html
-update-elclist:
-       echo "/^ELCFILES/,/^$$/c\\" > temp.sed
-       echo "ELCFILES =" | sed -e 's/$$/ \\\\\\/' >> temp.sed
-       LC_COLLATE=C ls $(lisp)/*.elc $(lisp)/*/*.elc $(lisp)/*/*/*.elc $(lisp)/*/*/*/*.elc | sed -e "s|^$(lisp)|       \$$(lisp)|" -e 's/$$/ \\\\\\/' -e '$$ s/ \\\\//' >> temp.sed
-       echo "" >> temp.sed
-       -sed -f temp.sed $(lisp)/Makefile.in > temp-elcfiles || rm temp-elcfiles
-       rm temp.sed
-       @test -f temp-elcfiles || echo "Maintainer warning: failed to update Makefile.in.  You can ignore this if you are not an Emacs developer."
-       if test -f temp-elcfiles; then \
-         chmod +w $(lisp)/Makefile.in; \
-         mv -f temp-elcfiles $(lisp)/Makefile.in; \
-       fi
-       -(LC_COLLATE=C ls $(lisp)/*.elc $(lisp)/*/*.elc $(lisp)/*/*/*.elc $(lisp)/*/*/*/*.elc | sed 's/elc$$/el/';  \
-         LC_COLLATE=C ls $(lisp)/*.el $(lisp)/*/*.el $(lisp)/*/*/*.el $(lisp)/*/*/*/*.el; \
-         LC_COLLATE=C ls $(lisp)/*.el $(lisp)/*/*.el $(lisp)/*/*/*.el $(lisp)/*/*/*/*.el) |       \
-            sort | uniq -u | while read extra; do                         \
-                echo "Found left over byte-compiled file: $${extra}c !!" ;\
-            done
-
-## Explicitly list the .elc files, for the sake of parallel builds.
-## http://lists.gnu.org/archive/html/bug-gnu-emacs/2008-05/msg00016.html
-## This can probably be done more elegantly, but needs to be portable.
-ELCFILES = \
-       $(lisp)/abbrev.elc \
-       $(lisp)/abbrevlist.elc \
-       $(lisp)/add-log.elc \
-       $(lisp)/align.elc \
-       $(lisp)/allout.elc \
-       $(lisp)/ansi-color.elc \
-       $(lisp)/apropos.elc \
-       $(lisp)/arc-mode.elc \
-       $(lisp)/array.elc \
-       $(lisp)/autoarg.elc \
-       $(lisp)/autoinsert.elc \
-       $(lisp)/autorevert.elc \
-       $(lisp)/avoid.elc \
-       $(lisp)/battery.elc \
-       $(lisp)/bindings.elc \
-       $(lisp)/bookmark.elc \
-       $(lisp)/bs.elc \
-       $(lisp)/buff-menu.elc \
-       $(lisp)/button.elc \
-       $(lisp)/calc/calc-aent.elc \
-       $(lisp)/calc/calc-alg.elc \
-       $(lisp)/calc/calc-arith.elc \
-       $(lisp)/calc/calc-bin.elc \
-       $(lisp)/calc/calc-comb.elc \
-       $(lisp)/calc/calc-cplx.elc \
-       $(lisp)/calc/calc-embed.elc \
-       $(lisp)/calc/calc-ext.elc \
-       $(lisp)/calc/calc-fin.elc \
-       $(lisp)/calc/calc-forms.elc \
-       $(lisp)/calc/calc-frac.elc \
-       $(lisp)/calc/calc-funcs.elc \
-       $(lisp)/calc/calc-graph.elc \
-       $(lisp)/calc/calc-help.elc \
-       $(lisp)/calc/calc-incom.elc \
-       $(lisp)/calc/calc-keypd.elc \
-       $(lisp)/calc/calc-lang.elc \
-       $(lisp)/calc/calc-macs.elc \
-       $(lisp)/calc/calc-map.elc \
-       $(lisp)/calc/calc-math.elc \
-       $(lisp)/calc/calc-menu.elc \
-       $(lisp)/calc/calc-misc.elc \
-       $(lisp)/calc/calc-mode.elc \
-       $(lisp)/calc/calc-mtx.elc \
-       $(lisp)/calc/calc-nlfit.elc \
-       $(lisp)/calc/calc-poly.elc \
-       $(lisp)/calc/calc-prog.elc \
-       $(lisp)/calc/calc-rewr.elc \
-       $(lisp)/calc/calc-rules.elc \
-       $(lisp)/calc/calc-sel.elc \
-       $(lisp)/calc/calc-stat.elc \
-       $(lisp)/calc/calc-store.elc \
-       $(lisp)/calc/calc-stuff.elc \
-       $(lisp)/calc/calc-trail.elc \
-       $(lisp)/calc/calc-undo.elc \
-       $(lisp)/calc/calc-units.elc \
-       $(lisp)/calc/calc-vec.elc \
-       $(lisp)/calc/calc-yank.elc \
-       $(lisp)/calc/calc.elc \
-       $(lisp)/calc/calcalg2.elc \
-       $(lisp)/calc/calcalg3.elc \
-       $(lisp)/calc/calccomp.elc \
-       $(lisp)/calc/calcsel2.elc \
-       $(lisp)/calculator.elc \
-       $(lisp)/calendar/appt.elc \
-       $(lisp)/calendar/cal-bahai.elc \
-       $(lisp)/calendar/cal-china.elc \
-       $(lisp)/calendar/cal-coptic.elc \
-       $(lisp)/calendar/cal-dst.elc \
-       $(lisp)/calendar/cal-french.elc \
-       $(lisp)/calendar/cal-hebrew.elc \
-       $(lisp)/calendar/cal-html.elc \
-       $(lisp)/calendar/cal-islam.elc \
-       $(lisp)/calendar/cal-iso.elc \
-       $(lisp)/calendar/cal-julian.elc \
-       $(lisp)/calendar/cal-mayan.elc \
-       $(lisp)/calendar/cal-menu.elc \
-       $(lisp)/calendar/cal-move.elc \
-       $(lisp)/calendar/cal-persia.elc \
-       $(lisp)/calendar/cal-tex.elc \
-       $(lisp)/calendar/cal-x.elc \
-       $(lisp)/calendar/calendar.elc \
-       $(lisp)/calendar/diary-lib.elc \
-       $(lisp)/calendar/holidays.elc \
-       $(lisp)/calendar/icalendar.elc \
-       $(lisp)/calendar/lunar.elc \
-       $(lisp)/calendar/parse-time.elc \
-       $(lisp)/calendar/solar.elc \
-       $(lisp)/calendar/time-date.elc \
-       $(lisp)/calendar/timeclock.elc \
-       $(lisp)/calendar/todo-mode.elc \
-       $(lisp)/case-table.elc \
-       $(lisp)/cdl.elc \
-       $(lisp)/cedet/cedet-cscope.elc \
-       $(lisp)/cedet/cedet-files.elc \
-       $(lisp)/cedet/cedet-global.elc \
-       $(lisp)/cedet/cedet-idutils.elc \
-       $(lisp)/cedet/cedet.elc \
-       $(lisp)/cedet/data-debug.elc \
-       $(lisp)/cedet/ede.elc \
-       $(lisp)/cedet/ede/autoconf-edit.elc \
-       $(lisp)/cedet/ede/cpp-root.elc \
-       $(lisp)/cedet/ede/dired.elc \
-       $(lisp)/cedet/ede/emacs.elc \
-       $(lisp)/cedet/ede/files.elc \
-       $(lisp)/cedet/ede/linux.elc \
-       $(lisp)/cedet/ede/locate.elc \
-       $(lisp)/cedet/ede/make.elc \
-       $(lisp)/cedet/ede/makefile-edit.elc \
-       $(lisp)/cedet/ede/pconf.elc \
-       $(lisp)/cedet/ede/pmake.elc \
-       $(lisp)/cedet/ede/proj-archive.elc \
-       $(lisp)/cedet/ede/proj-aux.elc \
-       $(lisp)/cedet/ede/proj-comp.elc \
-       $(lisp)/cedet/ede/proj-elisp.elc \
-       $(lisp)/cedet/ede/proj-info.elc \
-       $(lisp)/cedet/ede/proj-misc.elc \
-       $(lisp)/cedet/ede/proj-obj.elc \
-       $(lisp)/cedet/ede/proj-prog.elc \
-       $(lisp)/cedet/ede/proj-scheme.elc \
-       $(lisp)/cedet/ede/proj-shared.elc \
-       $(lisp)/cedet/ede/proj.elc \
-       $(lisp)/cedet/ede/project-am.elc \
-       $(lisp)/cedet/ede/shell.elc \
-       $(lisp)/cedet/ede/simple.elc \
-       $(lisp)/cedet/ede/source.elc \
-       $(lisp)/cedet/ede/speedbar.elc \
-       $(lisp)/cedet/ede/srecode.elc \
-       $(lisp)/cedet/ede/system.elc \
-       $(lisp)/cedet/ede/util.elc \
-       $(lisp)/cedet/inversion.elc \
-       $(lisp)/cedet/mode-local.elc \
-       $(lisp)/cedet/pulse.elc \
-       $(lisp)/cedet/semantic.elc \
-       $(lisp)/cedet/semantic/analyze.elc \
-       $(lisp)/cedet/semantic/analyze/complete.elc \
-       $(lisp)/cedet/semantic/analyze/debug.elc \
-       $(lisp)/cedet/semantic/analyze/fcn.elc \
-       $(lisp)/cedet/semantic/analyze/refs.elc \
-       $(lisp)/cedet/semantic/bovine.elc \
-       $(lisp)/cedet/semantic/bovine/c-by.elc \
-       $(lisp)/cedet/semantic/bovine/c.elc \
-       $(lisp)/cedet/semantic/bovine/debug.elc \
-       $(lisp)/cedet/semantic/bovine/el.elc \
-       $(lisp)/cedet/semantic/bovine/gcc.elc \
-       $(lisp)/cedet/semantic/bovine/make-by.elc \
-       $(lisp)/cedet/semantic/bovine/make.elc \
-       $(lisp)/cedet/semantic/bovine/scm-by.elc \
-       $(lisp)/cedet/semantic/bovine/scm.elc \
-       $(lisp)/cedet/semantic/chart.elc \
-       $(lisp)/cedet/semantic/complete.elc \
-       $(lisp)/cedet/semantic/ctxt.elc \
-       $(lisp)/cedet/semantic/db-debug.elc \
-       $(lisp)/cedet/semantic/db-ebrowse.elc \
-       $(lisp)/cedet/semantic/db-el.elc \
-       $(lisp)/cedet/semantic/db-file.elc \
-       $(lisp)/cedet/semantic/db-find.elc \
-       $(lisp)/cedet/semantic/db-global.elc \
-       $(lisp)/cedet/semantic/db-javascript.elc \
-       $(lisp)/cedet/semantic/db-mode.elc \
-       $(lisp)/cedet/semantic/db-ref.elc \
-       $(lisp)/cedet/semantic/db-typecache.elc \
-       $(lisp)/cedet/semantic/db.elc \
-       $(lisp)/cedet/semantic/debug.elc \
-       $(lisp)/cedet/semantic/decorate.elc \
-       $(lisp)/cedet/semantic/decorate/include.elc \
-       $(lisp)/cedet/semantic/decorate/mode.elc \
-       $(lisp)/cedet/semantic/dep.elc \
-       $(lisp)/cedet/semantic/doc.elc \
-       $(lisp)/cedet/semantic/ede-grammar.elc \
-       $(lisp)/cedet/semantic/edit.elc \
-       $(lisp)/cedet/semantic/find.elc \
-       $(lisp)/cedet/semantic/format.elc \
-       $(lisp)/cedet/semantic/fw.elc \
-       $(lisp)/cedet/semantic/grammar-wy.elc \
-       $(lisp)/cedet/semantic/grammar.elc \
-       $(lisp)/cedet/semantic/html.elc \
-       $(lisp)/cedet/semantic/ia-sb.elc \
-       $(lisp)/cedet/semantic/ia.elc \
-       $(lisp)/cedet/semantic/idle.elc \
-       $(lisp)/cedet/semantic/imenu.elc \
-       $(lisp)/cedet/semantic/java.elc \
-       $(lisp)/cedet/semantic/lex-spp.elc \
-       $(lisp)/cedet/semantic/lex.elc \
-       $(lisp)/cedet/semantic/mru-bookmark.elc \
-       $(lisp)/cedet/semantic/sb.elc \
-       $(lisp)/cedet/semantic/scope.elc \
-       $(lisp)/cedet/semantic/senator.elc \
-       $(lisp)/cedet/semantic/sort.elc \
-       $(lisp)/cedet/semantic/symref.elc \
-       $(lisp)/cedet/semantic/symref/cscope.elc \
-       $(lisp)/cedet/semantic/symref/filter.elc \
-       $(lisp)/cedet/semantic/symref/global.elc \
-       $(lisp)/cedet/semantic/symref/grep.elc \
-       $(lisp)/cedet/semantic/symref/idutils.elc \
-       $(lisp)/cedet/semantic/symref/list.elc \
-       $(lisp)/cedet/semantic/tag-file.elc \
-       $(lisp)/cedet/semantic/tag-ls.elc \
-       $(lisp)/cedet/semantic/tag-write.elc \
-       $(lisp)/cedet/semantic/tag.elc \
-       $(lisp)/cedet/semantic/texi.elc \
-       $(lisp)/cedet/semantic/util-modes.elc \
-       $(lisp)/cedet/semantic/util.elc \
-       $(lisp)/cedet/semantic/wisent.elc \
-       $(lisp)/cedet/semantic/wisent/comp.elc \
-       $(lisp)/cedet/semantic/wisent/java-tags.elc \
-       $(lisp)/cedet/semantic/wisent/javascript.elc \
-       $(lisp)/cedet/semantic/wisent/javat-wy.elc \
-       $(lisp)/cedet/semantic/wisent/js-wy.elc \
-       $(lisp)/cedet/semantic/wisent/python-wy.elc \
-       $(lisp)/cedet/semantic/wisent/python.elc \
-       $(lisp)/cedet/semantic/wisent/wisent.elc \
-       $(lisp)/cedet/srecode.elc \
-       $(lisp)/cedet/srecode/args.elc \
-       $(lisp)/cedet/srecode/compile.elc \
-       $(lisp)/cedet/srecode/cpp.elc \
-       $(lisp)/cedet/srecode/ctxt.elc \
-       $(lisp)/cedet/srecode/dictionary.elc \
-       $(lisp)/cedet/srecode/document.elc \
-       $(lisp)/cedet/srecode/el.elc \
-       $(lisp)/cedet/srecode/expandproto.elc \
-       $(lisp)/cedet/srecode/extract.elc \
-       $(lisp)/cedet/srecode/fields.elc \
-       $(lisp)/cedet/srecode/filters.elc \
-       $(lisp)/cedet/srecode/find.elc \
-       $(lisp)/cedet/srecode/getset.elc \
-       $(lisp)/cedet/srecode/insert.elc \
-       $(lisp)/cedet/srecode/java.elc \
-       $(lisp)/cedet/srecode/map.elc \
-       $(lisp)/cedet/srecode/mode.elc \
-       $(lisp)/cedet/srecode/semantic.elc \
-       $(lisp)/cedet/srecode/srt-mode.elc \
-       $(lisp)/cedet/srecode/srt-wy.elc \
-       $(lisp)/cedet/srecode/srt.elc \
-       $(lisp)/cedet/srecode/table.elc \
-       $(lisp)/cedet/srecode/template.elc \
-       $(lisp)/cedet/srecode/texi.elc \
-       $(lisp)/chistory.elc \
-       $(lisp)/cmuscheme.elc \
-       $(lisp)/comint.elc \
-       $(lisp)/compare-w.elc \
-       $(lisp)/complete.elc \
-       $(lisp)/completion.elc \
-       $(lisp)/composite.elc \
-       $(lisp)/cus-dep.elc \
-       $(lisp)/cus-edit.elc \
-       $(lisp)/cus-face.elc \
-       $(lisp)/cus-start.elc \
-       $(lisp)/cus-theme.elc \
-       $(lisp)/custom.elc \
-       $(lisp)/cvs-status.elc \
-       $(lisp)/dabbrev.elc \
-       $(lisp)/delim-col.elc \
-       $(lisp)/delsel.elc \
-       $(lisp)/descr-text.elc \
-       $(lisp)/desktop.elc \
-       $(lisp)/dframe.elc \
-       $(lisp)/diff-mode.elc \
-       $(lisp)/diff.elc \
-       $(lisp)/dired-aux.elc \
-       $(lisp)/dired-x.elc \
-       $(lisp)/dired.elc \
-       $(lisp)/dirtrack.elc \
-       $(lisp)/disp-table.elc \
-       $(lisp)/dnd.elc \
-       $(lisp)/doc-view.elc \
-       $(lisp)/dos-fns.elc \
-       $(lisp)/dos-vars.elc \
-       $(lisp)/dos-w32.elc \
-       $(lisp)/double.elc \
-       $(lisp)/ebuff-menu.elc \
-       $(lisp)/echistory.elc \
-       $(lisp)/ediff-diff.elc \
-       $(lisp)/ediff-help.elc \
-       $(lisp)/ediff-hook.elc \
-       $(lisp)/ediff-init.elc \
-       $(lisp)/ediff-merg.elc \
-       $(lisp)/ediff-mult.elc \
-       $(lisp)/ediff-ptch.elc \
-       $(lisp)/ediff-util.elc \
-       $(lisp)/ediff-vers.elc \
-       $(lisp)/ediff-wind.elc \
-       $(lisp)/ediff.elc \
-       $(lisp)/edmacro.elc \
-       $(lisp)/ehelp.elc \
-       $(lisp)/electric.elc \
-       $(lisp)/elide-head.elc \
-       $(lisp)/emacs-lisp/advice.elc \
-       $(lisp)/emacs-lisp/assoc.elc \
-       $(lisp)/emacs-lisp/authors.elc \
-       $(lisp)/emacs-lisp/autoload.elc \
-       $(lisp)/emacs-lisp/avl-tree.elc \
-       $(lisp)/emacs-lisp/backquote.elc \
-       $(lisp)/emacs-lisp/benchmark.elc \
-       $(lisp)/emacs-lisp/bindat.elc \
-       $(lisp)/emacs-lisp/byte-opt.elc \
-       $(lisp)/emacs-lisp/byte-run.elc \
-       $(lisp)/emacs-lisp/bytecomp.elc \
-       $(lisp)/emacs-lisp/chart.elc \
-       $(lisp)/emacs-lisp/check-declare.elc \
-       $(lisp)/emacs-lisp/checkdoc.elc \
-       $(lisp)/emacs-lisp/cl-compat.elc \
-       $(lisp)/emacs-lisp/cl-extra.elc \
-       $(lisp)/emacs-lisp/cl-indent.elc \
-       $(lisp)/emacs-lisp/cl-macs.elc \
-       $(lisp)/emacs-lisp/cl-seq.elc \
-       $(lisp)/emacs-lisp/cl.elc \
-       $(lisp)/emacs-lisp/copyright.elc \
-       $(lisp)/emacs-lisp/crm.elc \
-       $(lisp)/emacs-lisp/cust-print.elc \
-       $(lisp)/emacs-lisp/debug.elc \
-       $(lisp)/emacs-lisp/derived.elc \
-       $(lisp)/emacs-lisp/disass.elc \
-       $(lisp)/emacs-lisp/easy-mmode.elc \
-       $(lisp)/emacs-lisp/easymenu.elc \
-       $(lisp)/emacs-lisp/edebug.elc \
-       $(lisp)/emacs-lisp/eieio-base.elc \
-       $(lisp)/emacs-lisp/eieio-comp.elc \
-       $(lisp)/emacs-lisp/eieio-custom.elc \
-       $(lisp)/emacs-lisp/eieio-datadebug.elc \
-       $(lisp)/emacs-lisp/eieio-opt.elc \
-       $(lisp)/emacs-lisp/eieio-speedbar.elc \
-       $(lisp)/emacs-lisp/eieio.elc \
-       $(lisp)/emacs-lisp/eldoc.elc \
-       $(lisp)/emacs-lisp/elint.elc \
-       $(lisp)/emacs-lisp/elp.elc \
-       $(lisp)/emacs-lisp/ewoc.elc \
-       $(lisp)/emacs-lisp/find-func.elc \
-       $(lisp)/emacs-lisp/find-gc.elc \
-       $(lisp)/emacs-lisp/float-sup.elc \
-       $(lisp)/emacs-lisp/generic.elc \
-       $(lisp)/emacs-lisp/gulp.elc \
-       $(lisp)/emacs-lisp/helper.elc \
-       $(lisp)/emacs-lisp/lisp-mnt.elc \
-       $(lisp)/emacs-lisp/lisp-mode.elc \
-       $(lisp)/emacs-lisp/lisp.elc \
-       $(lisp)/emacs-lisp/lmenu.elc \
-       $(lisp)/emacs-lisp/macroexp.elc \
-       $(lisp)/emacs-lisp/map-ynp.elc \
-       $(lisp)/emacs-lisp/pp.elc \
-       $(lisp)/emacs-lisp/re-builder.elc \
-       $(lisp)/emacs-lisp/regexp-opt.elc \
-       $(lisp)/emacs-lisp/regi.elc \
-       $(lisp)/emacs-lisp/ring.elc \
-       $(lisp)/emacs-lisp/rx.elc \
-       $(lisp)/emacs-lisp/shadow.elc \
-       $(lisp)/emacs-lisp/sregex.elc \
-       $(lisp)/emacs-lisp/syntax.elc \
-       $(lisp)/emacs-lisp/tcover-ses.elc \
-       $(lisp)/emacs-lisp/tcover-unsafep.elc \
-       $(lisp)/emacs-lisp/testcover.elc \
-       $(lisp)/emacs-lisp/timer.elc \
-       $(lisp)/emacs-lisp/tq.elc \
-       $(lisp)/emacs-lisp/trace.elc \
-       $(lisp)/emacs-lisp/unsafep.elc \
-       $(lisp)/emacs-lisp/warnings.elc \
-       $(lisp)/emacs-lock.elc \
-       $(lisp)/emerge.elc \
-       $(lisp)/emulation/crisp.elc \
-       $(lisp)/emulation/cua-base.elc \
-       $(lisp)/emulation/cua-gmrk.elc \
-       $(lisp)/emulation/cua-rect.elc \
-       $(lisp)/emulation/edt-lk201.elc \
-       $(lisp)/emulation/edt-mapper.elc \
-       $(lisp)/emulation/edt-pc.elc \
-       $(lisp)/emulation/edt-vt100.elc \
-       $(lisp)/emulation/edt.elc \
-       $(lisp)/emulation/keypad.elc \
-       $(lisp)/emulation/pc-mode.elc \
-       $(lisp)/emulation/pc-select.elc \
-       $(lisp)/emulation/tpu-edt.elc \
-       $(lisp)/emulation/tpu-extras.elc \
-       $(lisp)/emulation/tpu-mapper.elc \
-       $(lisp)/emulation/vi.elc \
-       $(lisp)/emulation/vip.elc \
-       $(lisp)/emulation/viper-cmd.elc \
-       $(lisp)/emulation/viper-ex.elc \
-       $(lisp)/emulation/viper-init.elc \
-       $(lisp)/emulation/viper-keym.elc \
-       $(lisp)/emulation/viper-macs.elc \
-       $(lisp)/emulation/viper-mous.elc \
-       $(lisp)/emulation/viper-util.elc \
-       $(lisp)/emulation/viper.elc \
-       $(lisp)/emulation/ws-mode.elc \
-       $(lisp)/env.elc \
-       $(lisp)/epa-dired.elc \
-       $(lisp)/epa-file.elc \
-       $(lisp)/epa-hook.elc \
-       $(lisp)/epa-mail.elc \
-       $(lisp)/epa.elc \
-       $(lisp)/epg-config.elc \
-       $(lisp)/epg.elc \
-       $(lisp)/erc/erc-autoaway.elc \
-       $(lisp)/erc/erc-backend.elc \
-       $(lisp)/erc/erc-button.elc \
-       $(lisp)/erc/erc-capab.elc \
-       $(lisp)/erc/erc-compat.elc \
-       $(lisp)/erc/erc-dcc.elc \
-       $(lisp)/erc/erc-ezbounce.elc \
-       $(lisp)/erc/erc-fill.elc \
-       $(lisp)/erc/erc-goodies.elc \
-       $(lisp)/erc/erc-hecomplete.elc \
-       $(lisp)/erc/erc-ibuffer.elc \
-       $(lisp)/erc/erc-identd.elc \
-       $(lisp)/erc/erc-imenu.elc \
-       $(lisp)/erc/erc-join.elc \
-       $(lisp)/erc/erc-lang.elc \
-       $(lisp)/erc/erc-list.elc \
-       $(lisp)/erc/erc-log.elc \
-       $(lisp)/erc/erc-match.elc \
-       $(lisp)/erc/erc-menu.elc \
-       $(lisp)/erc/erc-netsplit.elc \
-       $(lisp)/erc/erc-networks.elc \
-       $(lisp)/erc/erc-notify.elc \
-       $(lisp)/erc/erc-page.elc \
-       $(lisp)/erc/erc-pcomplete.elc \
-       $(lisp)/erc/erc-replace.elc \
-       $(lisp)/erc/erc-ring.elc \
-       $(lisp)/erc/erc-services.elc \
-       $(lisp)/erc/erc-sound.elc \
-       $(lisp)/erc/erc-speedbar.elc \
-       $(lisp)/erc/erc-spelling.elc \
-       $(lisp)/erc/erc-stamp.elc \
-       $(lisp)/erc/erc-track.elc \
-       $(lisp)/erc/erc-truncate.elc \
-       $(lisp)/erc/erc-xdcc.elc \
-       $(lisp)/erc/erc.elc \
-       $(lisp)/eshell/em-alias.elc \
-       $(lisp)/eshell/em-banner.elc \
-       $(lisp)/eshell/em-basic.elc \
-       $(lisp)/eshell/em-cmpl.elc \
-       $(lisp)/eshell/em-dirs.elc \
-       $(lisp)/eshell/em-glob.elc \
-       $(lisp)/eshell/em-hist.elc \
-       $(lisp)/eshell/em-ls.elc \
-       $(lisp)/eshell/em-pred.elc \
-       $(lisp)/eshell/em-prompt.elc \
-       $(lisp)/eshell/em-rebind.elc \
-       $(lisp)/eshell/em-script.elc \
-       $(lisp)/eshell/em-smart.elc \
-       $(lisp)/eshell/em-term.elc \
-       $(lisp)/eshell/em-unix.elc \
-       $(lisp)/eshell/em-xtra.elc \
-       $(lisp)/eshell/esh-arg.elc \
-       $(lisp)/eshell/esh-cmd.elc \
-       $(lisp)/eshell/esh-ext.elc \
-       $(lisp)/eshell/esh-io.elc \
-       $(lisp)/eshell/esh-mode.elc \
-       $(lisp)/eshell/esh-module.elc \
-       $(lisp)/eshell/esh-opt.elc \
-       $(lisp)/eshell/esh-proc.elc \
-       $(lisp)/eshell/esh-test.elc \
-       $(lisp)/eshell/esh-util.elc \
-       $(lisp)/eshell/esh-var.elc \
-       $(lisp)/eshell/eshell.elc \
-       $(lisp)/expand.elc \
-       $(lisp)/ezimage.elc \
-       $(lisp)/face-remap.elc \
-       $(lisp)/facemenu.elc \
-       $(lisp)/faces.elc \
-       $(lisp)/ffap.elc \
-       $(lisp)/filecache.elc \
-       $(lisp)/files-x.elc \
-       $(lisp)/files.elc \
-       $(lisp)/filesets.elc \
-       $(lisp)/find-cmd.elc \
-       $(lisp)/find-dired.elc \
-       $(lisp)/find-file.elc \
-       $(lisp)/find-lisp.elc \
-       $(lisp)/finder.elc \
-       $(lisp)/flow-ctrl.elc \
-       $(lisp)/foldout.elc \
-       $(lisp)/follow.elc \
-       $(lisp)/font-core.elc \
-       $(lisp)/font-lock.elc \
-       $(lisp)/font-setting.elc \
-       $(lisp)/format-spec.elc \
-       $(lisp)/format.elc \
-       $(lisp)/forms.elc \
-       $(lisp)/frame.elc \
-       $(lisp)/fringe.elc \
-       $(lisp)/generic-x.elc \
-       $(lisp)/gnus/auth-source.elc \
-       $(lisp)/gnus/canlock.elc \
-       $(lisp)/gnus/compface.elc \
-       $(lisp)/gnus/deuglify.elc \
-       $(lisp)/gnus/earcon.elc \
-       $(lisp)/gnus/ecomplete.elc \
-       $(lisp)/gnus/flow-fill.elc \
-       $(lisp)/gnus/gmm-utils.elc \
-       $(lisp)/gnus/gnus-agent.elc \
-       $(lisp)/gnus/gnus-art.elc \
-       $(lisp)/gnus/gnus-async.elc \
-       $(lisp)/gnus/gnus-audio.elc \
-       $(lisp)/gnus/gnus-bcklg.elc \
-       $(lisp)/gnus/gnus-bookmark.elc \
-       $(lisp)/gnus/gnus-cache.elc \
-       $(lisp)/gnus/gnus-cite.elc \
-       $(lisp)/gnus/gnus-cus.elc \
-       $(lisp)/gnus/gnus-delay.elc \
-       $(lisp)/gnus/gnus-demon.elc \
-       $(lisp)/gnus/gnus-diary.elc \
-       $(lisp)/gnus/gnus-dired.elc \
-       $(lisp)/gnus/gnus-draft.elc \
-       $(lisp)/gnus/gnus-dup.elc \
-       $(lisp)/gnus/gnus-eform.elc \
-       $(lisp)/gnus/gnus-ems.elc \
-       $(lisp)/gnus/gnus-fun.elc \
-       $(lisp)/gnus/gnus-group.elc \
-       $(lisp)/gnus/gnus-int.elc \
-       $(lisp)/gnus/gnus-kill.elc \
-       $(lisp)/gnus/gnus-logic.elc \
-       $(lisp)/gnus/gnus-mh.elc \
-       $(lisp)/gnus/gnus-ml.elc \
-       $(lisp)/gnus/gnus-mlspl.elc \
-       $(lisp)/gnus/gnus-move.elc \
-       $(lisp)/gnus/gnus-msg.elc \
-       $(lisp)/gnus/gnus-nocem.elc \
-       $(lisp)/gnus/gnus-picon.elc \
-       $(lisp)/gnus/gnus-range.elc \
-       $(lisp)/gnus/gnus-registry.elc \
-       $(lisp)/gnus/gnus-salt.elc \
-       $(lisp)/gnus/gnus-score.elc \
-       $(lisp)/gnus/gnus-setup.elc \
-       $(lisp)/gnus/gnus-sieve.elc \
-       $(lisp)/gnus/gnus-soup.elc \
-       $(lisp)/gnus/gnus-spec.elc \
-       $(lisp)/gnus/gnus-srvr.elc \
-       $(lisp)/gnus/gnus-start.elc \
-       $(lisp)/gnus/gnus-sum.elc \
-       $(lisp)/gnus/gnus-topic.elc \
-       $(lisp)/gnus/gnus-undo.elc \
-       $(lisp)/gnus/gnus-util.elc \
-       $(lisp)/gnus/gnus-uu.elc \
-       $(lisp)/gnus/gnus-vm.elc \
-       $(lisp)/gnus/gnus-win.elc \
-       $(lisp)/gnus/gnus.elc \
-       $(lisp)/gnus/html2text.elc \
-       $(lisp)/gnus/ietf-drums.elc \
-       $(lisp)/gnus/legacy-gnus-agent.elc \
-       $(lisp)/gnus/mail-parse.elc \
-       $(lisp)/gnus/mail-prsvr.elc \
-       $(lisp)/gnus/mail-source.elc \
-       $(lisp)/gnus/mailcap.elc \
-       $(lisp)/gnus/message.elc \
-       $(lisp)/gnus/messcompat.elc \
-       $(lisp)/gnus/mm-bodies.elc \
-       $(lisp)/gnus/mm-decode.elc \
-       $(lisp)/gnus/mm-encode.elc \
-       $(lisp)/gnus/mm-extern.elc \
-       $(lisp)/gnus/mm-partial.elc \
-       $(lisp)/gnus/mm-url.elc \
-       $(lisp)/gnus/mm-util.elc \
-       $(lisp)/gnus/mm-uu.elc \
-       $(lisp)/gnus/mm-view.elc \
-       $(lisp)/gnus/mml-sec.elc \
-       $(lisp)/gnus/mml-smime.elc \
-       $(lisp)/gnus/mml.elc \
-       $(lisp)/gnus/mml1991.elc \
-       $(lisp)/gnus/mml2015.elc \
-       $(lisp)/gnus/nnagent.elc \
-       $(lisp)/gnus/nnbabyl.elc \
-       $(lisp)/gnus/nndb.elc \
-       $(lisp)/gnus/nndiary.elc \
-       $(lisp)/gnus/nndir.elc \
-       $(lisp)/gnus/nndoc.elc \
-       $(lisp)/gnus/nndraft.elc \
-       $(lisp)/gnus/nneething.elc \
-       $(lisp)/gnus/nnfolder.elc \
-       $(lisp)/gnus/nngateway.elc \
-       $(lisp)/gnus/nnheader.elc \
-       $(lisp)/gnus/nnimap.elc \
-       $(lisp)/gnus/nnir.elc \
-       $(lisp)/gnus/nnkiboze.elc \
-       $(lisp)/gnus/nnlistserv.elc \
-       $(lisp)/gnus/nnmail.elc \
-       $(lisp)/gnus/nnmaildir.elc \
-       $(lisp)/gnus/nnmairix.elc \
-       $(lisp)/gnus/nnmbox.elc \
-       $(lisp)/gnus/nnmh.elc \
-       $(lisp)/gnus/nnml.elc \
-       $(lisp)/gnus/nnnil.elc \
-       $(lisp)/gnus/nnoo.elc \
-       $(lisp)/gnus/nnrss.elc \
-       $(lisp)/gnus/nnslashdot.elc \
-       $(lisp)/gnus/nnsoup.elc \
-       $(lisp)/gnus/nnspool.elc \
-       $(lisp)/gnus/nntp.elc \
-       $(lisp)/gnus/nnultimate.elc \
-       $(lisp)/gnus/nnvirtual.elc \
-       $(lisp)/gnus/nnwarchive.elc \
-       $(lisp)/gnus/nnweb.elc \
-       $(lisp)/gnus/nnwfm.elc \
-       $(lisp)/gnus/pop3.elc \
-       $(lisp)/gnus/qp.elc \
-       $(lisp)/gnus/rfc1843.elc \
-       $(lisp)/gnus/rfc2045.elc \
-       $(lisp)/gnus/rfc2047.elc \
-       $(lisp)/gnus/rfc2104.elc \
-       $(lisp)/gnus/rfc2231.elc \
-       $(lisp)/gnus/score-mode.elc \
-       $(lisp)/gnus/sieve-manage.elc \
-       $(lisp)/gnus/sieve-mode.elc \
-       $(lisp)/gnus/sieve.elc \
-       $(lisp)/gnus/smiley.elc \
-       $(lisp)/gnus/smime.elc \
-       $(lisp)/gnus/spam-report.elc \
-       $(lisp)/gnus/spam-stat.elc \
-       $(lisp)/gnus/spam-wash.elc \
-       $(lisp)/gnus/spam.elc \
-       $(lisp)/gnus/starttls.elc \
-       $(lisp)/gnus/utf7.elc \
-       $(lisp)/gnus/webmail.elc \
-       $(lisp)/gnus/yenc.elc \
-       $(lisp)/gs.elc \
-       $(lisp)/help-at-pt.elc \
-       $(lisp)/help-fns.elc \
-       $(lisp)/help-macro.elc \
-       $(lisp)/help-mode.elc \
-       $(lisp)/help.elc \
-       $(lisp)/hex-util.elc \
-       $(lisp)/hexl.elc \
-       $(lisp)/hfy-cmap.elc \
-       $(lisp)/hi-lock.elc \
-       $(lisp)/hilit-chg.elc \
-       $(lisp)/hippie-exp.elc \
-       $(lisp)/hl-line.elc \
-       $(lisp)/htmlfontify.elc \
-       $(lisp)/ibuf-ext.elc \
-       $(lisp)/ibuf-macs.elc \
-       $(lisp)/ibuffer.elc \
-       $(lisp)/icomplete.elc \
-       $(lisp)/ido.elc \
-       $(lisp)/ielm.elc \
-       $(lisp)/iimage.elc \
-       $(lisp)/image-dired.elc \
-       $(lisp)/image-file.elc \
-       $(lisp)/image-mode.elc \
-       $(lisp)/image.elc \
-       $(lisp)/imenu.elc \
-       $(lisp)/indent.elc \
-       $(lisp)/info-look.elc \
-       $(lisp)/info-xref.elc \
-       $(lisp)/info.elc \
-       $(lisp)/informat.elc \
-       $(lisp)/international/ccl.elc \
-       $(lisp)/international/characters.elc \
-       $(lisp)/international/fontset.elc \
-       $(lisp)/international/isearch-x.elc \
-       $(lisp)/international/iso-ascii.elc \
-       $(lisp)/international/iso-cvt.elc \
-       $(lisp)/international/iso-transl.elc \
-       $(lisp)/international/ja-dic-cnv.elc \
-       $(lisp)/international/ja-dic-utl.elc \
-       $(lisp)/international/kinsoku.elc \
-       $(lisp)/international/kkc.elc \
-       $(lisp)/international/latexenc.elc \
-       $(lisp)/international/latin1-disp.elc \
-       $(lisp)/international/mule-cmds.elc \
-       $(lisp)/international/mule-conf.elc \
-       $(lisp)/international/mule-diag.elc \
-       $(lisp)/international/mule-util.elc \
-       $(lisp)/international/mule.elc \
-       $(lisp)/international/ogonek.elc \
-       $(lisp)/international/quail.elc \
-       $(lisp)/international/robin.elc \
-       $(lisp)/international/titdic-cnv.elc \
-       $(lisp)/international/ucs-normalize.elc \
-       $(lisp)/international/utf-7.elc \
-       $(lisp)/isearch.elc \
-       $(lisp)/isearchb.elc \
-       $(lisp)/iswitchb.elc \
-       $(lisp)/jit-lock.elc \
-       $(lisp)/jka-cmpr-hook.elc \
-       $(lisp)/jka-compr.elc \
-       $(lisp)/json.elc \
-       $(lisp)/kermit.elc \
-       $(lisp)/kmacro.elc \
-       $(lisp)/language/china-util.elc \
-       $(lisp)/language/chinese.elc \
-       $(lisp)/language/cyril-util.elc \
-       $(lisp)/language/cyrillic.elc \
-       $(lisp)/language/ethio-util.elc \
-       $(lisp)/language/ethiopic.elc \
-       $(lisp)/language/european.elc \
-       $(lisp)/language/hanja-util.elc \
-       $(lisp)/language/ind-util.elc \
-       $(lisp)/language/indian.elc \
-       $(lisp)/language/japan-util.elc \
-       $(lisp)/language/korea-util.elc \
-       $(lisp)/language/lao-util.elc \
-       $(lisp)/language/thai-util.elc \
-       $(lisp)/language/thai-word.elc \
-       $(lisp)/language/tibet-util.elc \
-       $(lisp)/language/tibetan.elc \
-       $(lisp)/language/tv-util.elc \
-       $(lisp)/language/viet-util.elc \
-       $(lisp)/language/vietnamese.elc \
-       $(lisp)/ledit.elc \
-       $(lisp)/linum.elc \
-       $(lisp)/loadhist.elc \
-       $(lisp)/locate.elc \
-       $(lisp)/log-edit.elc \
-       $(lisp)/log-view.elc \
-       $(lisp)/longlines.elc \
-       $(lisp)/lpr.elc \
-       $(lisp)/ls-lisp.elc \
-       $(lisp)/macros.elc \
-       $(lisp)/mail/binhex.elc \
-       $(lisp)/mail/emacsbug.elc \
-       $(lisp)/mail/feedmail.elc \
-       $(lisp)/mail/footnote.elc \
-       $(lisp)/mail/hashcash.elc \
-       $(lisp)/mail/mail-extr.elc \
-       $(lisp)/mail/mail-hist.elc \
-       $(lisp)/mail/mail-utils.elc \
-       $(lisp)/mail/mailabbrev.elc \
-       $(lisp)/mail/mailalias.elc \
-       $(lisp)/mail/mailclient.elc \
-       $(lisp)/mail/mailheader.elc \
-       $(lisp)/mail/mailpost.elc \
-       $(lisp)/mail/metamail.elc \
-       $(lisp)/mail/mspools.elc \
-       $(lisp)/mail/reporter.elc \
-       $(lisp)/mail/rfc2368.elc \
-       $(lisp)/mail/rfc822.elc \
-       $(lisp)/mail/rmail-spam-filter.elc \
-       $(lisp)/mail/rmail.elc \
-       $(lisp)/mail/rmailedit.elc \
-       $(lisp)/mail/rmailkwd.elc \
-       $(lisp)/mail/rmailmm.elc \
-       $(lisp)/mail/rmailmsc.elc \
-       $(lisp)/mail/rmailout.elc \
-       $(lisp)/mail/rmailsort.elc \
-       $(lisp)/mail/rmailsum.elc \
-       $(lisp)/mail/sendmail.elc \
-       $(lisp)/mail/smtpmail.elc \
-       $(lisp)/mail/supercite.elc \
-       $(lisp)/mail/uce.elc \
-       $(lisp)/mail/undigest.elc \
-       $(lisp)/mail/unrmail.elc \
-       $(lisp)/mail/uudecode.elc \
-       $(lisp)/makesum.elc \
-       $(lisp)/man.elc \
-       $(lisp)/master.elc \
-       $(lisp)/mb-depth.elc \
-       $(lisp)/md4.elc \
-       $(lisp)/menu-bar.elc \
-       $(lisp)/mh-e/mh-alias.elc \
-       $(lisp)/mh-e/mh-buffers.elc \
-       $(lisp)/mh-e/mh-comp.elc \
-       $(lisp)/mh-e/mh-e.elc \
-       $(lisp)/mh-e/mh-folder.elc \
-       $(lisp)/mh-e/mh-funcs.elc \
-       $(lisp)/mh-e/mh-identity.elc \
-       $(lisp)/mh-e/mh-inc.elc \
-       $(lisp)/mh-e/mh-junk.elc \
-       $(lisp)/mh-e/mh-letter.elc \
-       $(lisp)/mh-e/mh-limit.elc \
-       $(lisp)/mh-e/mh-mime.elc \
-       $(lisp)/mh-e/mh-print.elc \
-       $(lisp)/mh-e/mh-scan.elc \
-       $(lisp)/mh-e/mh-search.elc \
-       $(lisp)/mh-e/mh-seq.elc \
-       $(lisp)/mh-e/mh-show.elc \
-       $(lisp)/mh-e/mh-speed.elc \
-       $(lisp)/mh-e/mh-thread.elc \
-       $(lisp)/mh-e/mh-tool-bar.elc \
-       $(lisp)/mh-e/mh-utils.elc \
-       $(lisp)/mh-e/mh-xface.elc \
-       $(lisp)/midnight.elc \
-       $(lisp)/minibuf-eldef.elc \
-       $(lisp)/minibuffer.elc \
-       $(lisp)/misc.elc \
-       $(lisp)/misearch.elc \
-       $(lisp)/mouse-copy.elc \
-       $(lisp)/mouse-drag.elc \
-       $(lisp)/mouse-sel.elc \
-       $(lisp)/mouse.elc \
-       $(lisp)/mpc.elc \
-       $(lisp)/msb.elc \
-       $(lisp)/mwheel.elc \
-       $(lisp)/net/ange-ftp.elc \
-       $(lisp)/net/browse-url.elc \
-       $(lisp)/net/dbus.elc \
-       $(lisp)/net/dig.elc \
-       $(lisp)/net/dns.elc \
-       $(lisp)/net/eudc-bob.elc \
-       $(lisp)/net/eudc-export.elc \
-       $(lisp)/net/eudc-hotlist.elc \
-       $(lisp)/net/eudc-vars.elc \
-       $(lisp)/net/eudc.elc \
-       $(lisp)/net/eudcb-bbdb.elc \
-       $(lisp)/net/eudcb-ldap.elc \
-       $(lisp)/net/eudcb-mab.elc \
-       $(lisp)/net/eudcb-ph.elc \
-       $(lisp)/net/goto-addr.elc \
-       $(lisp)/net/hmac-def.elc \
-       $(lisp)/net/hmac-md5.elc \
-       $(lisp)/net/imap-hash.elc \
-       $(lisp)/net/imap.elc \
-       $(lisp)/net/ldap.elc \
-       $(lisp)/net/mairix.elc \
-       $(lisp)/net/net-utils.elc \
-       $(lisp)/net/netrc.elc \
-       $(lisp)/net/newst-backend.elc \
-       $(lisp)/net/newst-plainview.elc \
-       $(lisp)/net/newst-reader.elc \
-       $(lisp)/net/newst-ticker.elc \
-       $(lisp)/net/newst-treeview.elc \
-       $(lisp)/net/newsticker.elc \
-       $(lisp)/net/ntlm.elc \
-       $(lisp)/net/quickurl.elc \
-       $(lisp)/net/rcirc.elc \
-       $(lisp)/net/rcompile.elc \
-       $(lisp)/net/rlogin.elc \
-       $(lisp)/net/sasl-cram.elc \
-       $(lisp)/net/sasl-digest.elc \
-       $(lisp)/net/sasl-ntlm.elc \
-       $(lisp)/net/sasl.elc \
-       $(lisp)/net/snmp-mode.elc \
-       $(lisp)/net/socks.elc \
-       $(lisp)/net/telnet.elc \
-       $(lisp)/net/tls.elc \
-       $(lisp)/net/tramp-cache.elc \
-       $(lisp)/net/tramp-cmds.elc \
-       $(lisp)/net/tramp-compat.elc \
-       $(lisp)/net/tramp-fish.elc \
-       $(lisp)/net/tramp-ftp.elc \
-       $(lisp)/net/tramp-gvfs.elc \
-       $(lisp)/net/tramp-gw.elc \
-       $(lisp)/net/tramp-imap.elc \
-       $(lisp)/net/tramp-smb.elc \
-       $(lisp)/net/tramp-uu.elc \
-       $(lisp)/net/tramp.elc \
-       $(lisp)/net/trampver.elc \
-       $(lisp)/net/webjump.elc \
-       $(lisp)/net/xesam.elc \
-       $(lisp)/net/zeroconf.elc \
-       $(lisp)/newcomment.elc \
-       $(lisp)/novice.elc \
-       $(lisp)/nxml/nxml-enc.elc \
-       $(lisp)/nxml/nxml-glyph.elc \
-       $(lisp)/nxml/nxml-maint.elc \
-       $(lisp)/nxml/nxml-mode.elc \
-       $(lisp)/nxml/nxml-ns.elc \
-       $(lisp)/nxml/nxml-outln.elc \
-       $(lisp)/nxml/nxml-parse.elc \
-       $(lisp)/nxml/nxml-rap.elc \
-       $(lisp)/nxml/nxml-uchnm.elc \
-       $(lisp)/nxml/nxml-util.elc \
-       $(lisp)/nxml/rng-cmpct.elc \
-       $(lisp)/nxml/rng-dt.elc \
-       $(lisp)/nxml/rng-loc.elc \
-       $(lisp)/nxml/rng-maint.elc \
-       $(lisp)/nxml/rng-match.elc \
-       $(lisp)/nxml/rng-nxml.elc \
-       $(lisp)/nxml/rng-parse.elc \
-       $(lisp)/nxml/rng-pttrn.elc \
-       $(lisp)/nxml/rng-uri.elc \
-       $(lisp)/nxml/rng-util.elc \
-       $(lisp)/nxml/rng-valid.elc \
-       $(lisp)/nxml/rng-xsd.elc \
-       $(lisp)/nxml/xmltok.elc \
-       $(lisp)/nxml/xsd-regexp.elc \
-       $(lisp)/obsolete/awk-mode.elc \
-       $(lisp)/obsolete/fast-lock.elc \
-       $(lisp)/obsolete/iso-acc.elc \
-       $(lisp)/obsolete/iso-insert.elc \
-       $(lisp)/obsolete/iso-swed.elc \
-       $(lisp)/obsolete/lazy-lock.elc \
-       $(lisp)/obsolete/levents.elc \
-       $(lisp)/obsolete/lucid.elc \
-       $(lisp)/obsolete/old-whitespace.elc \
-       $(lisp)/obsolete/options.elc \
-       $(lisp)/obsolete/resume.elc \
-       $(lisp)/obsolete/rnews.elc \
-       $(lisp)/obsolete/rnewspost.elc \
-       $(lisp)/obsolete/sc.elc \
-       $(lisp)/obsolete/scribe.elc \
-       $(lisp)/obsolete/swedish.elc \
-       $(lisp)/obsolete/sym-comp.elc \
-       $(lisp)/obsolete/vc-mcvs.elc \
-       $(lisp)/obsolete/x-menu.elc \
-       $(lisp)/org/org-agenda.elc \
-       $(lisp)/org/org-archive.elc \
-       $(lisp)/org/org-ascii.elc \
-       $(lisp)/org/org-attach.elc \
-       $(lisp)/org/org-bbdb.elc \
-       $(lisp)/org/org-bibtex.elc \
-       $(lisp)/org/org-clock.elc \
-       $(lisp)/org/org-colview.elc \
-       $(lisp)/org/org-compat.elc \
-       $(lisp)/org/org-crypt.elc \
-       $(lisp)/org/org-datetree.elc \
-       $(lisp)/org/org-docbook.elc \
-       $(lisp)/org/org-exp-blocks.elc \
-       $(lisp)/org/org-exp.elc \
-       $(lisp)/org/org-faces.elc \
-       $(lisp)/org/org-feed.elc \
-       $(lisp)/org/org-footnote.elc \
-       $(lisp)/org/org-freemind.elc \
-       $(lisp)/org/org-gnus.elc \
-       $(lisp)/org/org-habit.elc \
-       $(lisp)/org/org-html.elc \
-       $(lisp)/org/org-icalendar.elc \
-       $(lisp)/org/org-id.elc \
-       $(lisp)/org/org-indent.elc \
-       $(lisp)/org/org-info.elc \
-       $(lisp)/org/org-inlinetask.elc \
-       $(lisp)/org/org-install.elc \
-       $(lisp)/org/org-irc.elc \
-       $(lisp)/org/org-jsinfo.elc \
-       $(lisp)/org/org-latex.elc \
-       $(lisp)/org/org-list.elc \
-       $(lisp)/org/org-mac-message.elc \
-       $(lisp)/org/org-macs.elc \
-       $(lisp)/org/org-mew.elc \
-       $(lisp)/org/org-mhe.elc \
-       $(lisp)/org/org-mobile.elc \
-       $(lisp)/org/org-mouse.elc \
-       $(lisp)/org/org-plot.elc \
-       $(lisp)/org/org-protocol.elc \
-       $(lisp)/org/org-publish.elc \
-       $(lisp)/org/org-remember.elc \
-       $(lisp)/org/org-rmail.elc \
-       $(lisp)/org/org-src.elc \
-       $(lisp)/org/org-table.elc \
-       $(lisp)/org/org-timer.elc \
-       $(lisp)/org/org-vm.elc \
-       $(lisp)/org/org-w3m.elc \
-       $(lisp)/org/org-wl.elc \
-       $(lisp)/org/org-xoxo.elc \
-       $(lisp)/org/org.elc \
-       $(lisp)/outline.elc \
-       $(lisp)/paren.elc \
-       $(lisp)/password-cache.elc \
-       $(lisp)/pcmpl-cvs.elc \
-       $(lisp)/pcmpl-gnu.elc \
-       $(lisp)/pcmpl-linux.elc \
-       $(lisp)/pcmpl-rpm.elc \
-       $(lisp)/pcmpl-unix.elc \
-       $(lisp)/pcomplete.elc \
-       $(lisp)/pcvs-defs.elc \
-       $(lisp)/pcvs-info.elc \
-       $(lisp)/pcvs-parse.elc \
-       $(lisp)/pcvs-util.elc \
-       $(lisp)/pcvs.elc \
-       $(lisp)/pgg-def.elc \
-       $(lisp)/pgg-gpg.elc \
-       $(lisp)/pgg-parse.elc \
-       $(lisp)/pgg-pgp.elc \
-       $(lisp)/pgg-pgp5.elc \
-       $(lisp)/pgg.elc \
-       $(lisp)/play/5x5.elc \
-       $(lisp)/play/animate.elc \
-       $(lisp)/play/blackbox.elc \
-       $(lisp)/play/bubbles.elc \
-       $(lisp)/play/cookie1.elc \
-       $(lisp)/play/decipher.elc \
-       $(lisp)/play/dissociate.elc \
-       $(lisp)/play/doctor.elc \
-       $(lisp)/play/dunnet.elc \
-       $(lisp)/play/fortune.elc \
-       $(lisp)/play/gamegrid.elc \
-       $(lisp)/play/gametree.elc \
-       $(lisp)/play/gomoku.elc \
-       $(lisp)/play/handwrite.elc \
-       $(lisp)/play/hanoi.elc \
-       $(lisp)/play/landmark.elc \
-       $(lisp)/play/life.elc \
-       $(lisp)/play/meese.elc \
-       $(lisp)/play/morse.elc \
-       $(lisp)/play/mpuz.elc \
-       $(lisp)/play/pong.elc \
-       $(lisp)/play/snake.elc \
-       $(lisp)/play/solitaire.elc \
-       $(lisp)/play/spook.elc \
-       $(lisp)/play/studly.elc \
-       $(lisp)/play/tetris.elc \
-       $(lisp)/play/yow.elc \
-       $(lisp)/play/zone.elc \
-       $(lisp)/printing.elc \
-       $(lisp)/proced.elc \
-       $(lisp)/progmodes/ada-mode.elc \
-       $(lisp)/progmodes/ada-prj.elc \
-       $(lisp)/progmodes/ada-stmt.elc \
-       $(lisp)/progmodes/ada-xref.elc \
-       $(lisp)/progmodes/antlr-mode.elc \
-       $(lisp)/progmodes/asm-mode.elc \
-       $(lisp)/progmodes/autoconf.elc \
-       $(lisp)/progmodes/bug-reference.elc \
-       $(lisp)/progmodes/cap-words.elc \
-       $(lisp)/progmodes/cc-align.elc \
-       $(lisp)/progmodes/cc-awk.elc \
-       $(lisp)/progmodes/cc-bytecomp.elc \
-       $(lisp)/progmodes/cc-cmds.elc \
-       $(lisp)/progmodes/cc-compat.elc \
-       $(lisp)/progmodes/cc-defs.elc \
-       $(lisp)/progmodes/cc-engine.elc \
-       $(lisp)/progmodes/cc-fonts.elc \
-       $(lisp)/progmodes/cc-langs.elc \
-       $(lisp)/progmodes/cc-menus.elc \
-       $(lisp)/progmodes/cc-mode.elc \
-       $(lisp)/progmodes/cc-styles.elc \
-       $(lisp)/progmodes/cc-vars.elc \
-       $(lisp)/progmodes/cfengine.elc \
-       $(lisp)/progmodes/cmacexp.elc \
-       $(lisp)/progmodes/compile.elc \
-       $(lisp)/progmodes/cperl-mode.elc \
-       $(lisp)/progmodes/cpp.elc \
-       $(lisp)/progmodes/cwarn.elc \
-       $(lisp)/progmodes/dcl-mode.elc \
-       $(lisp)/progmodes/delphi.elc \
-       $(lisp)/progmodes/ebnf-abn.elc \
-       $(lisp)/progmodes/ebnf-bnf.elc \
-       $(lisp)/progmodes/ebnf-dtd.elc \
-       $(lisp)/progmodes/ebnf-ebx.elc \
-       $(lisp)/progmodes/ebnf-iso.elc \
-       $(lisp)/progmodes/ebnf-otz.elc \
-       $(lisp)/progmodes/ebnf-yac.elc \
-       $(lisp)/progmodes/ebnf2ps.elc \
-       $(lisp)/progmodes/ebrowse.elc \
-       $(lisp)/progmodes/etags.elc \
-       $(lisp)/progmodes/executable.elc \
-       $(lisp)/progmodes/f90.elc \
-       $(lisp)/progmodes/flymake.elc \
-       $(lisp)/progmodes/fortran.elc \
-       $(lisp)/progmodes/gdb-ui.elc \
-       $(lisp)/progmodes/glasses.elc \
-       $(lisp)/progmodes/grep.elc \
-       $(lisp)/progmodes/gud.elc \
-       $(lisp)/progmodes/hideif.elc \
-       $(lisp)/progmodes/hideshow.elc \
-       $(lisp)/progmodes/icon.elc \
-       $(lisp)/progmodes/idlw-complete-structtag.elc \
-       $(lisp)/progmodes/idlw-help.elc \
-       $(lisp)/progmodes/idlw-shell.elc \
-       $(lisp)/progmodes/idlw-toolbar.elc \
-       $(lisp)/progmodes/idlwave.elc \
-       $(lisp)/progmodes/inf-lisp.elc \
-       $(lisp)/progmodes/js.elc \
-       $(lisp)/progmodes/ld-script.elc \
-       $(lisp)/progmodes/m4-mode.elc \
-       $(lisp)/progmodes/make-mode.elc \
-       $(lisp)/progmodes/mantemp.elc \
-       $(lisp)/progmodes/meta-mode.elc \
-       $(lisp)/progmodes/mixal-mode.elc \
-       $(lisp)/progmodes/modula2.elc \
-       $(lisp)/progmodes/octave-inf.elc \
-       $(lisp)/progmodes/octave-mod.elc \
-       $(lisp)/progmodes/pascal.elc \
-       $(lisp)/progmodes/perl-mode.elc \
-       $(lisp)/progmodes/prolog.elc \
-       $(lisp)/progmodes/ps-mode.elc \
-       $(lisp)/progmodes/python.elc \
-       $(lisp)/progmodes/ruby-mode.elc \
-       $(lisp)/progmodes/scheme.elc \
-       $(lisp)/progmodes/sh-script.elc \
-       $(lisp)/progmodes/simula.elc \
-       $(lisp)/progmodes/sql.elc \
-       $(lisp)/progmodes/subword.elc \
-       $(lisp)/progmodes/tcl.elc \
-       $(lisp)/progmodes/vera-mode.elc \
-       $(lisp)/progmodes/verilog-mode.elc \
-       $(lisp)/progmodes/vhdl-mode.elc \
-       $(lisp)/progmodes/which-func.elc \
-       $(lisp)/progmodes/xscheme.elc \
-       $(lisp)/ps-bdf.elc \
-       $(lisp)/ps-def.elc \
-       $(lisp)/ps-mule.elc \
-       $(lisp)/ps-print.elc \
-       $(lisp)/ps-samp.elc \
-       $(lisp)/recentf.elc \
-       $(lisp)/rect.elc \
-       $(lisp)/register.elc \
-       $(lisp)/repeat.elc \
-       $(lisp)/replace.elc \
-       $(lisp)/reposition.elc \
-       $(lisp)/reveal.elc \
-       $(lisp)/rfn-eshadow.elc \
-       $(lisp)/rot13.elc \
-       $(lisp)/ruler-mode.elc \
-       $(lisp)/s-region.elc \
-       $(lisp)/savehist.elc \
-       $(lisp)/saveplace.elc \
-       $(lisp)/sb-image.elc \
-       $(lisp)/scroll-all.elc \
-       $(lisp)/scroll-bar.elc \
-       $(lisp)/scroll-lock.elc \
-       $(lisp)/select.elc \
-       $(lisp)/server.elc \
-       $(lisp)/ses.elc \
-       $(lisp)/sha1.elc \
-       $(lisp)/shadowfile.elc \
-       $(lisp)/shell.elc \
-       $(lisp)/simple.elc \
-       $(lisp)/skeleton.elc \
-       $(lisp)/smerge-mode.elc \
-       $(lisp)/sort.elc \
-       $(lisp)/soundex.elc \
-       $(lisp)/speedbar.elc \
-       $(lisp)/startup.elc \
-       $(lisp)/strokes.elc \
-       $(lisp)/subr.elc \
-       $(lisp)/t-mouse.elc \
-       $(lisp)/tabify.elc \
-       $(lisp)/talk.elc \
-       $(lisp)/tar-mode.elc \
-       $(lisp)/tempo.elc \
-       $(lisp)/term.elc \
-       $(lisp)/term/common-win.elc \
-       $(lisp)/term/internal.elc \
-       $(lisp)/term/ns-win.elc \
-       $(lisp)/term/pc-win.elc \
-       $(lisp)/term/rxvt.elc \
-       $(lisp)/term/sun.elc \
-       $(lisp)/term/sup-mouse.elc \
-       $(lisp)/term/tty-colors.elc \
-       $(lisp)/term/tvi970.elc \
-       $(lisp)/term/vt100.elc \
-       $(lisp)/term/w32-win.elc \
-       $(lisp)/term/w32console.elc \
-       $(lisp)/term/x-win.elc \
-       $(lisp)/term/xterm.elc \
-       $(lisp)/terminal.elc \
-       $(lisp)/textmodes/artist.elc \
-       $(lisp)/textmodes/bib-mode.elc \
-       $(lisp)/textmodes/bibtex-style.elc \
-       $(lisp)/textmodes/bibtex.elc \
-       $(lisp)/textmodes/conf-mode.elc \
-       $(lisp)/textmodes/css-mode.elc \
-       $(lisp)/textmodes/dns-mode.elc \
-       $(lisp)/textmodes/enriched.elc \
-       $(lisp)/textmodes/fill.elc \
-       $(lisp)/textmodes/flyspell.elc \
-       $(lisp)/textmodes/ispell.elc \
-       $(lisp)/textmodes/makeinfo.elc \
-       $(lisp)/textmodes/nroff-mode.elc \
-       $(lisp)/textmodes/page-ext.elc \
-       $(lisp)/textmodes/page.elc \
-       $(lisp)/textmodes/paragraphs.elc \
-       $(lisp)/textmodes/picture.elc \
-       $(lisp)/textmodes/po.elc \
-       $(lisp)/textmodes/refbib.elc \
-       $(lisp)/textmodes/refer.elc \
-       $(lisp)/textmodes/refill.elc \
-       $(lisp)/textmodes/reftex-auc.elc \
-       $(lisp)/textmodes/reftex-cite.elc \
-       $(lisp)/textmodes/reftex-dcr.elc \
-       $(lisp)/textmodes/reftex-global.elc \
-       $(lisp)/textmodes/reftex-index.elc \
-       $(lisp)/textmodes/reftex-parse.elc \
-       $(lisp)/textmodes/reftex-ref.elc \
-       $(lisp)/textmodes/reftex-sel.elc \
-       $(lisp)/textmodes/reftex-toc.elc \
-       $(lisp)/textmodes/reftex-vars.elc \
-       $(lisp)/textmodes/reftex.elc \
-       $(lisp)/textmodes/remember.elc \
-       $(lisp)/textmodes/rst.elc \
-       $(lisp)/textmodes/sgml-mode.elc \
-       $(lisp)/textmodes/spell.elc \
-       $(lisp)/textmodes/table.elc \
-       $(lisp)/textmodes/tex-mode.elc \
-       $(lisp)/textmodes/texinfmt.elc \
-       $(lisp)/textmodes/texinfo.elc \
-       $(lisp)/textmodes/texnfo-upd.elc \
-       $(lisp)/textmodes/text-mode.elc \
-       $(lisp)/textmodes/tildify.elc \
-       $(lisp)/textmodes/two-column.elc \
-       $(lisp)/textmodes/underline.elc \
-       $(lisp)/thingatpt.elc \
-       $(lisp)/thumbs.elc \
-       $(lisp)/time-stamp.elc \
-       $(lisp)/time.elc \
-       $(lisp)/timezone.elc \
-       $(lisp)/tmm.elc \
-       $(lisp)/tool-bar.elc \
-       $(lisp)/tooltip.elc \
-       $(lisp)/tree-widget.elc \
-       $(lisp)/tutorial.elc \
-       $(lisp)/type-break.elc \
-       $(lisp)/uniquify.elc \
-       $(lisp)/url/url-about.elc \
-       $(lisp)/url/url-auth.elc \
-       $(lisp)/url/url-cache.elc \
-       $(lisp)/url/url-cid.elc \
-       $(lisp)/url/url-cookie.elc \
-       $(lisp)/url/url-dav.elc \
-       $(lisp)/url/url-dired.elc \
-       $(lisp)/url/url-expand.elc \
-       $(lisp)/url/url-file.elc \
-       $(lisp)/url/url-ftp.elc \
-       $(lisp)/url/url-gw.elc \
-       $(lisp)/url/url-handlers.elc \
-       $(lisp)/url/url-history.elc \
-       $(lisp)/url/url-http.elc \
-       $(lisp)/url/url-imap.elc \
-       $(lisp)/url/url-irc.elc \
-       $(lisp)/url/url-ldap.elc \
-       $(lisp)/url/url-mailto.elc \
-       $(lisp)/url/url-methods.elc \
-       $(lisp)/url/url-misc.elc \
-       $(lisp)/url/url-news.elc \
-       $(lisp)/url/url-nfs.elc \
-       $(lisp)/url/url-ns.elc \
-       $(lisp)/url/url-parse.elc \
-       $(lisp)/url/url-privacy.elc \
-       $(lisp)/url/url-proxy.elc \
-       $(lisp)/url/url-util.elc \
-       $(lisp)/url/url-vars.elc \
-       $(lisp)/url/url.elc \
-       $(lisp)/userlock.elc \
-       $(lisp)/vc-annotate.elc \
-       $(lisp)/vc-arch.elc \
-       $(lisp)/vc-bzr.elc \
-       $(lisp)/vc-cvs.elc \
-       $(lisp)/vc-dav.elc \
-       $(lisp)/vc-dir.elc \
-       $(lisp)/vc-dispatcher.elc \
-       $(lisp)/vc-git.elc \
-       $(lisp)/vc-hg.elc \
-       $(lisp)/vc-hooks.elc \
-       $(lisp)/vc-mtn.elc \
-       $(lisp)/vc-rcs.elc \
-       $(lisp)/vc-sccs.elc \
-       $(lisp)/vc-svn.elc \
-       $(lisp)/vc.elc \
-       $(lisp)/vcursor.elc \
-       $(lisp)/view.elc \
-       $(lisp)/vt-control.elc \
-       $(lisp)/vt100-led.elc \
-       $(lisp)/w32-fns.elc \
-       $(lisp)/w32-vars.elc \
-       $(lisp)/wdired.elc \
-       $(lisp)/whitespace.elc \
-       $(lisp)/wid-browse.elc \
-       $(lisp)/wid-edit.elc \
-       $(lisp)/widget.elc \
-       $(lisp)/windmove.elc \
-       $(lisp)/window.elc \
-       $(lisp)/winner.elc \
-       $(lisp)/woman.elc \
-       $(lisp)/x-dnd.elc \
-       $(lisp)/xml.elc \
-       $(lisp)/xt-mouse.elc
-
 # The src/Makefile.in has its own set of dependencies and when they decide
 # that one Lisp file needs to be re-compiled, we had better recompile it as
 # well, otherwise every subsequent make will again call us, until we finally
@@ -1486,17 +207,53 @@ compile-onefile:
 
 # An old-fashioned suffix rule, which, according to the GNU Make manual,
 # cannot have prerequisites.
-# Note that if a .el file is removed from the repository without
-# updating ELCFILES, make will abort.
 .el.elc:
        @echo Compiling $<
        @$(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile $<
 
-.PHONY: compile-first compile-main compile-last compile compile-always
+.PHONY: compile-first compile-main compile compile-always
 
 compile-first: $(COMPILE_FIRST)
 
-compile-main: $(ELCFILES)
+# In `compile-main' we could directly do
+#    ... | xargs $(MAKE) $(MFLAGS) EMACS="$(EMACS)"
+# and it works, but it generates a lot of messages like
+#    make[2]: « gnus/gnus-mlspl.elc » is up to date.
+# so instead, we use "xargs echo" to split the list of file into manageable
+# chunks and then use an intermediate `compile-targets' target so the
+# actual targets (the .elc files) are not mentioned as targets on the
+# make command line.
+
+
+.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: compile-clean
+       @(cd $(lisp); $(setwins); \
+       els=`echo "$$wins " | sed -e 's|/\./|/|g' -e 's|/\. | |g' -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
+
+.PHONY: compile-clean
+# Erase left-over .elc files that do not have a corresponding .el file.
+compile-clean:
+       @cd $(lisp); $(setwins); \
+       elcs=`echo "$$wins " | sed -e 's|/\./|/|g' -e 's|/\. | |g' -e 's| |/*.elc |g'`; \
+       for el in $$(echo $$elcs | sed -e 's/\.elc/\.el/g'); do \
+         if test -f "$$el" -o \! -f "$${el}c"; then :; else \
+           echo rm "$${el}c"; \
+           rm "$${el}c"; \
+         fi \
+       done
 
 # Compile all Lisp files, but don't recompile those that are up to
 # date.  Some .el files don't get compiled because they set the
@@ -1506,10 +263,6 @@ compile-main: $(ELCFILES)
 # sub-makes that run rules that use it, for the sake of some non-GNU makes.
 compile: $(LOADDEFS) autoloads compile-first
        $(MAKE) $(MFLAGS) compile-main EMACS=$(EMACS)
-       $(MAKE) $(MFLAGS) compile-last EMACS=$(EMACS)
-
-## Doing this causes make install to dump another emacs.
-#      $(MAKE) $(MFLAGS) update-elclist
 
 # Compile all Lisp files.  This is like `compile' but compiles files
 # unconditionally.  Some files don't actually get compiled because they
@@ -1518,20 +271,6 @@ compile-always: doit
        cd $(lisp); rm -f *.elc */*.elc */*/*.elc */*/*/*.elc
        $(MAKE) $(MFLAGS) compile EMACS=$(EMACS)
 
-## In case any files are missing from ELCFILES.
-compile-last:
-       @wd=$(lisp); $(setwins); \
-       els=`echo "$$wins " | sed -e 's|/\./|/|g' -e 's|/\. | |g' -e 's| |/*.el |g'`; \
-       for el in $$els; do \
-         test -f $$el || continue; \
-         test -f $${el}c && continue; \
-         GREP_OPTIONS= grep 'no-byte-compile: t' $$el > /dev/null && continue; \
-         sel=`echo $$el | sed "s|^$(lisp)|\\$$(lisp)|"`; \
-         echo "Maintainer warning: $$sel missing from \$$ELCFILES?"; \
-         echo "Compiling $$el"; \
-         $(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile $$el || exit 1; \
-       done
-
 compile-calc:
        for el in $(lisp)/calc/*.el; do \
          echo Compiling $$el; \
@@ -1551,8 +290,7 @@ 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 (followed up with compile-last,
-# if ELCFILES is out of date).  recompile has some advantages:
+# 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.
index a1fc3f90bf6cfd32887ba1033252ac0220ef8c52..6e48360587f4f997cfb366eda35bdd2b65a7b74f 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Maintainer: FSF
 ;; Keywords: abbrev convenience
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
index bf51a3dc4183df16aee4eb6737fcd7d913ff80fd..5f9cbee2cf534b0a98fbe6d7e18130a0e3883292 100644 (file)
@@ -6,6 +6,7 @@
 
 ;; Maintainer: FSF
 ;; Keywords: abbrev
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
index 666c62246d479547746e11f9aea1ef532d934492..5c7577d5353c6d1e77902e320c6a61a29a7cb707 100644 (file)
@@ -2239,13 +2239,13 @@ function can also be used as an `isearch-mode-end-hook'."
       (allout-show-to-offshoot)))
 
 ;;;_ #3 Internal Position State-Tracking -- "allout-recent-*" funcs
-;;; All the basic outline functions that directly do string matches to
-;;; evaluate heading prefix location set the variables
-;;; `allout-recent-prefix-beginning'  and `allout-recent-prefix-end'
-;;; when successful.  Functions starting with `allout-recent-' all
-;;; use this state, providing the means to avoid redundant searches
-;;; for just-established data.  This optimization can provide
-;;; significant speed improvement, but it must be employed carefully.
+;; All the basic outline functions that directly do string matches to
+;; evaluate heading prefix location set the variables
+;; `allout-recent-prefix-beginning'  and `allout-recent-prefix-end'
+;; when successful.  Functions starting with `allout-recent-' all
+;; use this state, providing the means to avoid redundant searches
+;; for just-established data.  This optimization can provide
+;; significant speed improvement, but it must be employed carefully.
 ;;;_  = allout-recent-prefix-beginning
 (defvar allout-recent-prefix-beginning 0
   "Buffer point of the start of the last topic prefix encountered.")
index 09de0c08e1942d11c370cd73cfd741152dd31584..d62721e157c5f687a8783ffbee128f4963ef3270 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Joe Wells <jbw@bigbird.bu.edu>
 ;;     Daniel Pfeiffer <occitan@esperanto.org> (rewrite)
 ;; Keywords: help
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
index 1cb3ade9a2d797cb7f61a08d5d7e770fa819333c..6dda7b2e40be0d85be702ec0b2037807e012cb96 100644 (file)
 ;; ARCHIVE TYPES: Currently only the archives below are handled, but the
 ;; structure for handling just about anything is in place.
 ;;
-;;                     Arc     Lzh     Zip     Zoo      Rar
-;;                     ----------------------------------------
-;; View listing                Intern  Intern  Intern  Intern   Y
-;; Extract member      Y       Y       Y       Y        Y
-;; Save changed member Y       Y       Y       Y        N
-;; Add new member      N       N       N       N        N
-;; Delete member       Y       Y       Y       Y        N
-;; Rename member       Y       Y       N       N        N
-;; Chmod               -       Y       Y       -        N
-;; Chown               -       Y       -       -        N
-;; Chgrp               -       Y       -       -        N
+;;                     Arc     Lzh     Zip     Zoo     Rar     7z
+;;                     --------------------------------------------
+;; View listing                Intern  Intern  Intern  Intern  Y       Y
+;; Extract member      Y       Y       Y       Y       Y       Y
+;; Save changed member Y       Y       Y       Y       N       N
+;; Add new member      N       N       N       N       N       N
+;; Delete member       Y       Y       Y       Y       N       N
+;; Rename member       Y       Y       N       N       N       N
+;; Chmod               -       Y       Y       -       N       N
+;; Chown               -       Y       -       -       N       N
+;; Chgrp               -       Y       -       -       N       N
 ;;
 ;; Special thanks to Bill Brodie <wbrodie@panix.com> for very useful tips
 ;; on the first released version of this package.
@@ -217,17 +217,17 @@ Archive and member name will be added."
 ;; Zip archive configuration
 
 (defcustom archive-zip-extract
-  (if (and (not (executable-find "unzip"))
-           (executable-find "pkunzip"))
-      '("pkunzip" "-e" "-o-")
-    '("unzip" "-qq" "-c"))
+  (cond ((executable-find "unzip") '("unzip" "-qq" "-c"))
+       ((executable-find "7z") '("7z" "x" "-so"))
+       ((executable-find "pkunzip") '("pkunzip" "-e" "-o-"))
+       (t '("unzip" "-qq" "-c")))
   "Program and its options to run in order to extract a zip file member.
 Extraction should happen to standard output.  Archive and member name will
 be added."
   :type '(list (string :tag "Program")
-               (repeat :tag "Options"
-                       :inline t
-                       (string :format "%v")))
+              (repeat :tag "Options"
+                      :inline t
+                      (string :format "%v")))
   :group 'archive-zip)
 
 ;; For several reasons the latter behavior is not desirable in general.
@@ -315,6 +315,20 @@ Archive and member name will be added."
                        :inline t
                        (string :format "%v")))
   :group 'archive-zoo)
+;; ------------------------------
+;; 7z archive configuration
+
+(defcustom archive-7z-extract
+  '("7z" "x" "-so")
+  "Program and its options to run in order to extract a 7z file member.
+Extraction should happen to standard output.  Archive and member name will
+be added."
+  :type '(list (string :tag "Program")
+               (repeat :tag "Options"
+                       :inline t
+                       (string :format "%v")))
+  :group 'archive-7z)
+
 ;; -------------------------------------------------------------------------
 ;;; Section: Variables
 
@@ -732,6 +746,7 @@ archive.
           ((and (looking-at "MZ")
                 (re-search-forward "Rar!" (+ (point) 100000) t))
            'rar-exe)
+         ((looking-at "7z\274\257\047\034") '7z)
          (t (error "Buffer format not recognized")))))
 ;; -------------------------------------------------------------------------
 
@@ -1047,8 +1062,8 @@ using `make-temp-file', and the generated name is returned."
        (archive-maybe-update t))
       (or (not (buffer-name buffer))
           (cond
-           (view-p (view-buffer
-                   buffer (and just-created 'kill-buffer-if-not-modified)))
+           (view-p
+           (view-buffer buffer (and just-created 'kill-buffer-if-not-modified)))
            ((eq other-window-p 'display) (display-buffer buffer))
            (other-window-p (switch-to-buffer-other-window buffer))
            (t (switch-to-buffer buffer))))))
@@ -1081,11 +1096,11 @@ using `make-temp-file', and the generated name is returned."
     (archive-delete-local tmpfile)
     success))
 
-(defun archive-extract-by-stdout (archive name command)
+(defun archive-extract-by-stdout (archive name command &optional stderr-file)
   (apply 'call-process
         (car command)
         nil
-        t
+        (if stderr-file (list t stderr-file) t)
         nil
         (append (cdr command) (list archive name))))
 
@@ -1787,8 +1802,13 @@ This doesn't recover lost files, it just undoes changes in the buffer itself."
     (apply 'vector (nreverse files))))
 
 (defun archive-zip-extract (archive name)
-  (if (member-ignore-case (car archive-zip-extract) '("pkunzip" "pkzip"))
-      (archive-*-extract archive name archive-zip-extract)
+  (cond
+   ((member-ignore-case (car archive-zip-extract) '("pkunzip" "pkzip"))
+    (archive-*-extract archive name archive-zip-extract))
+   ((equal (car archive-zip-extract) "7z")
+    (let ((archive-7z-extract archive-zip-extract))
+      (archive-7z-extract archive name)))
+   (t
     (archive-extract-by-stdout
      archive
      ;; unzip expands wildcards in NAME, so we need to quote it.  But
@@ -1800,7 +1820,7 @@ This doesn't recover lost files, it just undoes changes in the buffer itself."
              (equal (car archive-zip-extract) "unzip"))
         (shell-quote-argument name)
        name)
-     archive-zip-extract)))
+     archive-zip-extract))))
 
 (defun archive-zip-write-file-member (archive descr)
   (archive-*-write-file-member
@@ -2008,7 +2028,65 @@ This doesn't recover lost files, it just undoes changes in the buffer itself."
       (if tmpbuf (kill-buffer tmpbuf))
       (delete-file tmpfile))))
 
+;; -------------------------------------------------------------------------
+;;; Section: 7z Archives
 
+(defun archive-7z-summarize ()
+  (let ((maxname 10)
+       (maxsize 5)
+       (file buffer-file-name)
+       (files ()))
+    (with-temp-buffer
+      (call-process "7z" nil t nil "l" "-slt" file)
+      (goto-char (point-min))
+      (re-search-forward "^-+\n")
+      (while (re-search-forward "^Path = \\(.*\\)\n" nil t)
+        (goto-char (match-end 0))
+        (let ((name (match-string 1))
+              (size (save-excursion
+                     (and (re-search-forward "^Size = \\(.*\\)\n")
+                          (match-string 1))))
+             (time (save-excursion
+                     (and (re-search-forward "^Modified = \\(.*\\)\n")
+                          (match-string 1)))))
+          (if (> (length name) maxname) (setq maxname (length name)))
+          (if (> (length size) maxsize) (setq maxsize (length size)))
+          (push (vector name name nil nil time nil nil size)
+                files))))
+    (setq files (nreverse files))
+    (goto-char (point-min))
+    (let* ((format (format " %%%ds %%s %%s" maxsize))
+           (sep (format format (make-string maxsize ?-) "-------------------" ""))
+           (column (length sep)))
+      (insert (format format "Size " "Date       Time    " " Filename") "\n")
+      (insert sep (make-string maxname ?-) "\n")
+      (archive-summarize-files (mapcar (lambda (desc)
+                                         (let ((text
+                                                (format format
+                                                       (aref desc 7)
+                                                       (aref desc 4)
+                                                       (aref desc 1))))
+                                           (vector text
+                                                   column
+                                                   (length text))))
+                                       files))
+      (insert sep (make-string maxname ?-) "\n")
+      (apply 'vector files))))
+
+(defun archive-7z-extract (archive name)
+  (let ((tmpfile (make-temp-file "7z-stderr")))
+    ;; 7z doesn't provide a `quiet' option to suppress non-essential
+    ;; stderr messages.  So redirect stderr to a temp file and display it
+    ;; in the echo area when it contains error messages.
+    (prog1 (archive-extract-by-stdout
+           archive name archive-7z-extract tmpfile)
+      (with-temp-buffer
+       (insert-file-contents tmpfile)
+       (unless (search-forward "Everything is Ok" nil t)
+         (message "%s" (buffer-string)))
+       (delete-file tmpfile)))))
+
+;; -------------------------------------------------------------------------
 ;;; Section `ar' archives.
 
 ;; TODO: we currently only handle the basic format of ar archives,
index b3a594d31d41ceec4d28cec3d418e0520dbe0722..9a8001875e0bc65b941815540cfe6793155606a8 100644 (file)
@@ -126,10 +126,10 @@ If this contains a %s, that will be replaced by the matching rule."
      _ "\n\\begin{document}\n" _
      "\n\\end{document}")
 
-    (("/bin/.*[^/]\\'" . "Shell-Script mode magic number")
-     lambda ()
+    (("/bin/.*[^/]\\'" . "Shell-Script mode magic number") .
+     (lambda ()
        (if (eq major-mode (default-value 'major-mode))
-        (sh-mode)))
+          (sh-mode))))
 
     (ada-mode . ada-header)
 
index 3ce21a578d593705759881b3b4e3c136f77a2b76..d19db2c779e8aa1707f47249525588b5c302eea0 100644 (file)
@@ -6,6 +6,7 @@
 
 ;; Maintainer: FSF
 ;; Keywords: internal
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
@@ -62,24 +63,6 @@ corresponding to the mode line clicked."
     (force-mode-line-update)))
 
 
-(defun mode-line-abbrev-mode (event)
-  "Turn off `abbrev-mode' from the mode-line."
-  (interactive "e")
-  (save-selected-window
-    (select-window (posn-window (event-start event)))
-    (abbrev-mode)
-    (force-mode-line-update)))
-
-
-(defun mode-line-auto-fill-mode (event)
-  "Turn off `auto-fill-mode' from the mode-line."
-  (interactive "e")
-  (save-selected-window
-    (select-window (posn-window (event-start event)))
-    (auto-fill-mode)
-    (force-mode-line-update)))
-
-
 (defvar mode-line-input-method-map
   (let ((map (make-sparse-keymap)))
     (define-key map [mode-line mouse-2]
@@ -671,30 +654,6 @@ is okay.  See `mode-line-format'.")
 
 (define-key esc-map "\t" 'complete-symbol)
 
-(defun complete-symbol (arg)
-  "Perform tags completion on the text around point.
-If a tags table is loaded, call `complete-tag'.
-Otherwise, if Semantic is active, call `semantic-ia-complete-symbol'.
-
-With a prefix argument, this command does completion within
-the collection of symbols listed in the index of the manual for the
-language you are using."
-  (interactive "P")
-  (cond (arg
-        (info-complete-symbol))
-       ((or tags-table-list tags-file-name)
-        (complete-tag))
-       ((and (fboundp 'semantic-ia-complete-symbol)
-             (fboundp 'semantic-active-p)
-             (semantic-active-p))
-        (semantic-ia-complete-symbol))
-        (completion-at-point-functions (completion-at-point))
-       (t
-        (error "%s"
-               (substitute-command-keys
-                "No completions available; use \\[visit-tags-table] \
-or \\[semantic-mode]")))))
-
 ;; Reduce total amount of space we must allocate during this function
 ;; that we will not need to keep permanently.
 (garbage-collect)
@@ -720,6 +679,63 @@ or \\[semantic-mode]")))))
 ;but they are not assigned to keys there.
 (put 'narrow-to-region 'disabled t)
 
+;; Moving with arrows in bidi-sensitive direction.
+(defun right-char (&optional n)
+  "Move point N characters to the right (to the left if N is negative).
+On reaching beginning or end of buffer, stop and signal error.
+
+Depending on the bidirectional context, this may move either forward
+or backward in the buffer.  This is in contrast with \\[forward-char]
+and \\[backward-char], which see."
+  (interactive "^p")
+  (if (eq (current-bidi-paragraph-direction) 'left-to-right)
+      (forward-char n)
+    (backward-char n)))
+
+(defun left-char ( &optional n)
+  "Move point N characters to the left (to the right if N is negative).
+On reaching beginning or end of buffer, stop and signal error.
+
+Depending on the bidirectional context, this may move either backward
+or forward in the buffer.  This is in contrast with \\[backward-char]
+and \\[forward-char], which see."
+  (interactive "^p")
+  (if (eq (current-bidi-paragraph-direction) 'left-to-right)
+      (backward-char n)
+    (forward-char n)))
+
+(defun right-word (&optional n)
+  "Move point N words to the right (to the left if N is negative).
+
+Depending on the bidirectional context, this may move either forward
+or backward in the buffer.  This is in contrast with \\[forward-word]
+and \\[backward-word], which see.
+
+Value is normally t.
+If an edge of the buffer or a field boundary is reached, point is left there
+there and the function returns nil.  Field boundaries are not noticed
+if `inhibit-field-text-motion' is non-nil."
+  (interactive "^p")
+  (if (eq (current-bidi-paragraph-direction) 'left-to-right)
+      (forward-word n)
+    (backward-word n)))
+
+(defun left-word (&optional n)
+  "Move point N words to the left (to the right if N is negative).
+
+Depending on the bidirectional context, this may move either backward
+or forward in the buffer.  This is in contrast with \\[backward-word]
+and \\[forward-word], which see.
+
+Value is normally t.
+If an edge of the buffer or a field boundary is reached, point is left there
+there and the function returns nil.  Field boundaries are not noticed
+if `inhibit-field-text-motion' is non-nil."
+  (interactive "^p")
+  (if (eq (current-bidi-paragraph-direction) 'left-to-right)
+      (backward-word n)
+    (forward-word n)))
+
 (defvar narrow-map (make-sparse-keymap)
   "Keymap for narrowing commands.")
 (define-key ctl-x-map "n" narrow-map)
@@ -807,6 +823,9 @@ or \\[semantic-mode]")))))
     (setq i (1+ i))))
 (define-key global-map [?\C-\M--] 'negative-argument)
 
+(define-key global-map "\177" 'delete-backward-char)
+(define-key global-map "\C-d" 'delete-forward-char)
+
 (define-key global-map "\C-k" 'kill-line)
 (define-key global-map "\C-w" 'kill-region)
 (define-key esc-map "w" 'kill-ring-save)
@@ -870,12 +889,12 @@ or \\[semantic-mode]")))))
 (define-key global-map [C-home]                'beginning-of-buffer)
 (define-key global-map [M-home]                'beginning-of-buffer-other-window)
 (define-key esc-map    [home]          'beginning-of-buffer-other-window)
-(define-key global-map [left]          'backward-char)
+(define-key global-map [left]          'left-char)
 (define-key global-map [up]            'previous-line)
-(define-key global-map [right]         'forward-char)
+(define-key global-map [right]         'right-char)
 (define-key global-map [down]          'next-line)
-(define-key global-map [prior]         'scroll-down)
-(define-key global-map [next]          'scroll-up)
+(define-key global-map [prior]         'scroll-down-command)
+(define-key global-map [next]          'scroll-up-command)
 (define-key global-map [C-up]          'backward-paragraph)
 (define-key global-map [C-down]                'forward-paragraph)
 (define-key global-map [C-prior]       'scroll-right)
@@ -1075,8 +1094,8 @@ or \\[semantic-mode]")))))
 (global-set-key [M-left]   'backward-word)
 (define-key esc-map [left] 'backward-word)
 ;; ilya@math.ohio-state.edu says these bindings are standard on PC editors.
-(global-set-key [C-right]  'forward-word)
-(global-set-key [C-left]   'backward-word)
+(global-set-key [C-right]  'right-word)
+(global-set-key [C-left]   'left-word)
 ;; This is not quite compatible, but at least is analogous
 (global-set-key [C-delete] 'kill-word)
 (global-set-key [C-backspace] 'backward-kill-word)
index 9515837fc28ce94a4194783c690f69793d7ad265..0eec76f4da7d0729c3fb79f41615bf7702144103 100644 (file)
@@ -92,7 +92,7 @@ To specify the file in which to save them, modify the variable
   (if bookmark-file
       ;; In case user set `bookmark-file' in her .emacs:
       bookmark-file
-    (convert-standard-filename "~/.emacs.bmk"))
+    (locate-user-emacs-file "bookmarks" ".emacs.bmk"))
   "File in which to save bookmarks by default."
   :type 'file
   :group 'bookmark)
@@ -528,26 +528,36 @@ old one."
     (setq bookmark-current-bookmark stripped-name)
     (bookmark-bmenu-surreptitiously-rebuild-list)))
 
-(defun bookmark-make-record-default (&optional point-only)
+(defun bookmark-make-record-default (&optional no-file no-context posn)
   "Return the record describing the location of a new bookmark.
-Must be at the correct position in the buffer in which the bookmark is
-being set.
-If POINT-ONLY is non-nil, then only return the subset of the
-record that pertains to the location within the buffer."
-  `(,@(unless point-only `((filename . ,(bookmark-buffer-file-name))))
-    (front-context-string
-     . ,(if (>= (- (point-max) (point)) bookmark-search-size)
-            (buffer-substring-no-properties
-             (point)
-             (+ (point) bookmark-search-size))
-          nil))
-    (rear-context-string
-     . ,(if (>= (- (point) (point-min)) bookmark-search-size)
-            (buffer-substring-no-properties
-             (point)
-             (- (point) bookmark-search-size))
-          nil))
-    (position . ,(point))))
+Point should be at the buffer in which the bookmark is being set,
+and normally should be at the position where the bookmark is desired,
+but see the optional arguments for other possibilities.
+
+If NO-FILE is non-nil, then only return the subset of the
+record that pertains to the location within the buffer, leaving off
+the part that records the filename.
+
+If NO-CONTEXT is non-nil, do not include the front- and rear-context
+strings in the record -- the position is enough.
+
+If POSN is non-nil, record POSN as the point instead of `(point)'."
+  `(,@(unless no-file `((filename . ,(bookmark-buffer-file-name))))
+    ,@(unless no-context `((front-context-string
+                           . ,(if (>= (- (point-max) (point))
+                                      bookmark-search-size)
+                                  (buffer-substring-no-properties
+                                   (point)
+                                   (+ (point) bookmark-search-size))
+                                  nil))))
+    ,@(unless no-context `((rear-context-string
+                           . ,(if (>= (- (point) (point-min))
+                                      bookmark-search-size)
+                                  (buffer-substring-no-properties
+                                   (point)
+                                   (- (point) bookmark-search-size))
+                                  nil))))
+    (position . ,(or posn (point)))))
 
 \f
 ;;; File format stuff
@@ -773,27 +783,34 @@ Use \\[bookmark-delete] to remove bookmarks (you give it a name and
 it removes only the first instance of a bookmark with that name from
 the list of bookmarks.)"
   (interactive (list nil current-prefix-arg))
-  (let* ((record (bookmark-make-record))
-         (default (car record)))
+  (unwind-protect
+       (let* ((record (bookmark-make-record))
+              (default (car record)))
+
+         (bookmark-maybe-load-default-file)
+         ;; Don't set `bookmark-yank-point' and `bookmark-current-buffer'
+         ;; if they have been already set in another buffer. (e.g gnus-art).
+         (unless (and bookmark-yank-point
+                      bookmark-current-buffer)
+           (setq bookmark-yank-point (point))
+           (setq bookmark-current-buffer (current-buffer)))
+
+         (let ((str
+                (or name
+                    (read-from-minibuffer
+                     (format "Set bookmark (%s): " default)
+                     nil
+                     bookmark-minibuffer-read-name-map
+                     nil nil default))))
+           (and (string-equal str "") (setq str default))
+           (bookmark-store str (cdr record) no-overwrite)
+
+           ;; Ask for an annotation buffer for this bookmark
+           (when bookmark-use-annotations
+             (bookmark-edit-annotation str))))
+    (setq bookmark-yank-point nil)
+    (setq bookmark-current-buffer nil)))
 
-    (bookmark-maybe-load-default-file)
-
-    (setq bookmark-yank-point (point))
-    (setq bookmark-current-buffer (current-buffer))
-
-    (let ((str
-           (or name
-               (read-from-minibuffer
-                (format "Set bookmark (%s): " default)
-                nil
-                bookmark-minibuffer-read-name-map
-                nil nil default))))
-      (and (string-equal str "") (setq str default))
-      (bookmark-store str (cdr record) no-overwrite)
-
-      ;; Ask for an annotation buffer for this bookmark
-      (when bookmark-use-annotations
-        (bookmark-edit-annotation str)))))
 
 (defun bookmark-kill-line (&optional newline-too)
   "Kill from point to end of line.
@@ -1176,7 +1193,7 @@ minibuffer history list `bookmark-history'."
   (or no-history (bookmark-maybe-historicize-string bookmark))
   (let ((start (point)))
     (prog1
-       (insert (bookmark-location bookmark)) ; *Return this line*
+       (insert (bookmark-location bookmark))
       (if (display-mouse-p)
          (add-text-properties
           start
@@ -1191,10 +1208,16 @@ minibuffer history list `bookmark-history'."
 (defalias 'bookmark-locate 'bookmark-insert-location)
 
 (defun bookmark-location (bookmark)
-  "Return the name of the file associated with BOOKMARK, or nil if none.
+  "Return a description of the location of BOOKMARK.
 BOOKMARK may be a bookmark name (a string) or a bookmark record."
   (bookmark-maybe-load-default-file)
-  (bookmark-get-filename bookmark))
+  ;; We could call the `handler' and ask for it to construct a description
+  ;; dynamically: it would open up several new possibilities, but it
+  ;; would have the major disadvantage of forcing to load each and
+  ;; every handler when the user calls bookmark-menu.
+  (or (bookmark-prop-get bookmark 'location)
+      (bookmark-get-filename bookmark)
+      "-- Unknown location --"))
 
 
 ;;;###autoload
@@ -1727,15 +1750,15 @@ last full line, move to the last full line.  The return value is undefined."
   "Display the annotation for bookmark named BOOKMARK in a buffer,
 if an annotation exists."
   (let ((annotation (bookmark-get-annotation bookmark)))
-    (if (and annotation (not (string-equal annotation "")))
-        (save-excursion
-          (let ((old-buf (current-buffer)))
-            (pop-to-buffer (get-buffer-create "*Bookmark Annotation*") t)
-            (delete-region (point-min) (point-max))
-            ;; (insert (concat "Annotation for bookmark '" bookmark "':\n\n"))
-            (insert annotation)
-            (goto-char (point-min))
-            (pop-to-buffer old-buf))))))
+    (when (and annotation (not (string-equal annotation "")))
+      (save-excursion
+        (let ((old-buf (current-buffer)))
+          (pop-to-buffer (get-buffer-create "*Bookmark Annotation*") t)
+          (delete-region (point-min) (point-max))
+          ;; (insert (concat "Annotation for bookmark '" bookmark "':\n\n"))
+          (insert annotation)
+          (goto-char (point-min))
+          (switch-to-buffer-other-window old-buf))))))
 
 
 (defun bookmark-show-all-annotations ()
@@ -2173,7 +2196,7 @@ strings returned are not."
 \f
 ;; Load Hook
 (defvar bookmark-load-hook nil
-  "Hook run at the end of loading bookmark.")
+  "Hook run at the end of loading library `bookmark.el'.")
 
 ;; Exit Hook, called from kill-emacs-hook
 (defvar bookmark-exit-hook nil
index ef2e5834edc77e0336596cd0ea79b5c1f5a0596f..0ce7670201d7c8c74e93acc1b7efcde066c34fb0 100644 (file)
@@ -1152,7 +1152,7 @@ and move point to current buffer."
     (dolist (buffer list)
       (bs--insert-one-entry buffer)
       (insert "\n"))
-    (delete-backward-char 1)
+    (delete-char -1)
     (bs--set-window-height)
     (bs--goto-current-buffer)
     (font-lock-fontify-buffer)
index 9ec78309f9d3db2242c41db6ad9ea37c02d8dde9..e0f00d3553dd9e4244aef07ef99816941aa3ebd1 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Maintainer: FSF
 ;; Keywords: convenience
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
index 2a9a49c399a64bbc2f7b8794ad608140033f9abb..c771474da3ad72a6c8b21ec6e6d8265ab658bb4a 100644 (file)
@@ -5,6 +5,7 @@
 ;;
 ;; Author: Miles Bader <miles@gnu.org>
 ;; Keywords: extensions
+;; Package: emacs
 ;;
 ;; This file is part of GNU Emacs.
 ;;
diff --git a/lisp/calc/.arch-inventory b/lisp/calc/.arch-inventory
deleted file mode 100644 (file)
index e4e8f82..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-# Auto-generated lisp files, which ignore
-precious ^(.*-loaddefs)\.el$
-
-# arch-tag: 5258f69e-459b-449b-bdd7-bdbd5f948cb9
index 9e095252fc1a08e7ebf1cf9a19bd9e6e35465431..cf3a697c5d7339e752f2411ae69b47af419518d9 100644 (file)
@@ -72,6 +72,16 @@ opinions.
 Summary of changes to "Calc"
 ------- -- ------- --  ----
 
+Emacs 24.1
+
+* Added option to highlight selections using faces.
+
+* Gave `calc-histogram' the option of using a vector to determine the bins.
+
+* Added "O" option prefix.
+
+* Used "O" prefix to "d r" (`calc-radix') to turn on twos-complement mode.
+
 Emacs 23.2
 
 * Added twos-complement display.
index 58e30a237f937a4b80d192d74744637f15cd7a89..30f15f049053b2e59d9a21c49b4096c393af734b 100644 (file)
@@ -1,7 +1,7 @@
 ;;; calc-aent.el --- algebraic entry functions for Calc
 
-;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2002, 2003, 2004, 2005,
+;;   2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
 ;; Author: Dave Gillespie <daveg@synaptics.com>
 ;; Maintainer: Jay Belanger <jay.p.belanger@gmail.com>
@@ -510,6 +510,7 @@ The value t means abort and give an error message.")
     ("≥" ">=")
     ("≦" "<=")
     ("≧" ">=")
+    ("µ" "μ")
     ;; fractions
     ("¼" "(1:4)") ; 1/4
     ("½" "(1:2)") ; 1/2
@@ -608,9 +609,9 @@ in Calc algebraic input.")
         (setq math-exp-str (math-remove-percentsigns math-exp-str)))
     (if calc-language-input-filter
        (setq math-exp-str (funcall calc-language-input-filter math-exp-str)))
-    (while (setq math-exp-token 
+    (while (setq math-exp-token
                  (string-match "\\.\\.\\([^.]\\|.[^.]\\)" math-exp-str))
-      (setq math-exp-str 
+      (setq math-exp-str
             (concat (substring math-exp-str 0 math-exp-token) "\\dots"
                            (substring math-exp-str (+ math-exp-token 2)))))
     (math-build-parse-table)
@@ -675,11 +676,11 @@ in Calc algebraic input.")
     (cond ((and (stringp (car p))
                (or (> (length (car p)) 1) (equal (car p) "$")
                    (equal (car p) "\""))
-               (string-match "[^a-zA-Z0-9]" (car p)))
+               (string-match "[^a-zA-Zα-ωΑ-Ω0-9]" (car p)))
           (let ((s (regexp-quote (car p))))
-            (if (string-match "\\`[a-zA-Z0-9]" s)
+            (if (string-match "\\`[a-zA-Zα-ωΑ-Ω0-9]" s)
                 (setq s (concat "\\<" s)))
-            (if (string-match "[a-zA-Z0-9]\\'" s)
+            (if (string-match "[a-zA-Zα-ωΑ-Ω0-9]\\'" s)
                 (setq s (concat s "\\>")))
             (or (assoc s math-toks)
                 (progn
@@ -711,22 +712,24 @@ in Calc algebraic input.")
               (math-read-token)))
            ((and (memq ch calc-user-token-chars)
                  (let ((case-fold-search nil))
-                   (eq (string-match 
+                   (eq (string-match
                          calc-user-tokens math-exp-str math-exp-pos)
                        math-exp-pos)))
             (setq math-exp-token 'punc
                   math-expr-data (math-match-substring math-exp-str 0)
                   math-exp-pos (match-end 0)))
            ((or (and (>= ch ?a) (<= ch ?z))
-                (and (>= ch ?A) (<= ch ?Z)))
-            (string-match 
+                (and (>= ch ?A) (<= ch ?Z))
+                (and (>= ch ?α) (<= ch ?ω))
+                (and (>= ch ?Α) (<= ch ?Ω)))
+            (string-match
               (cond
                ((and (memq calc-language calc-lang-allow-underscores)
                      (memq calc-language calc-lang-allow-percentsigns))
-                "[a-zA-Z0-9_'#]*")
+                "[a-zA-Zα-ωΑ-Ω0-9_'#]*")
                ((memq calc-language calc-lang-allow-underscores)
-                              "[a-zA-Z0-9_#]*")
-               (t "[a-zA-Z0-9'#]*"))
+                              "[a-zA-Zα-ωΑ-Ω0-9_#]*")
+               (t "[a-zA-Zα-ωΑ-Ω0-9'#]*"))
               math-exp-str math-exp-pos)
             (setq math-exp-token 'symbol
                   math-exp-pos (match-end 0)
@@ -742,19 +745,19 @@ in Calc algebraic input.")
                      (eq (string-match "_\\.?[0-9]" math-exp-str math-exp-pos)
                           math-exp-pos)
                      (or (eq math-exp-pos 0)
-                         (and (not (memq calc-language 
+                         (and (not (memq calc-language
                                           calc-lang-allow-underscores))
-                              (eq (string-match "[^])}\"a-zA-Z0-9'$]_"
+                              (eq (string-match "[^])}\"a-zA-Zα-ωΑ-Ω0-9'$]_"
                                                 math-exp-str (1- math-exp-pos))
                                   (1- math-exp-pos))))))
             (or (and (memq calc-language calc-lang-c-type-hex)
                      (string-match "0[xX][0-9a-fA-F]+" math-exp-str math-exp-pos))
-                (string-match "_?\\([0-9]+.?0*@ *\\)?\\([0-9]+.?0*' *\\)?\\(0*\\([2-9]\\|1[0-4]\\)\\(#[#]?\\|\\^\\^\\)[0-9a-dA-D.]+[eE][-+_]?[0-9]+\\|0*\\([2-9]\\|[0-2][0-9]\\|3[0-6]\\)\\(#[#]?\\|\\^\\^\\)[0-9a-zA-Z:.]+\\|[0-9]+:[0-9:]+\\|[0-9.]+\\([eE][-+_]?[0-9]+\\)?\"?\\)?"
+                (string-match "_?\\([0-9]+.?0*@ *\\)?\\([0-9]+.?0*' *\\)?\\(0*\\([2-9]\\|1[0-4]\\)\\(#[#]?\\|\\^\\^\\)[0-9a-dA-D.]+[eE][-+_]?[0-9]+\\|0*\\([2-9]\\|[0-2][0-9]\\|3[0-6]\\)\\(#[#]?\\|\\^\\^\\)[0-9a-zA-Zα-ωΑ-Ω:.]+\\|[0-9]+:[0-9:]+\\|[0-9.]+\\([eE][-+_]?[0-9]+\\)?\"?\\)?"
                                math-exp-str math-exp-pos))
             (setq math-exp-token 'number
                   math-expr-data (math-match-substring math-exp-str 0)
                   math-exp-pos (match-end 0)))
-            ((and (setq adfn 
+            ((and (setq adfn
                         (assq ch (get calc-language 'math-lang-read-symbol)))
                   (eval (nth 1 adfn)))
              (eval (nth 2 adfn)))
@@ -807,8 +810,8 @@ in Calc algebraic input.")
 
 (defun math-read-expr-level (exp-prec &optional exp-term)
   (let* ((math-expr-opers (math-expr-ops))
-         (x (math-read-factor)) 
-         (first t) 
+         (x (math-read-factor))
+         (first t)
          op op2)
     (while (and (or (and calc-user-parse-table
                         (setq op (calc-check-user-syntax x exp-prec))
@@ -829,8 +832,8 @@ in Calc algebraic input.")
                             (memq math-exp-token '(symbol number dollar hash))
                             (equal math-expr-data "(")
                             (and (equal math-expr-data "[")
-                                 (not (equal 
-                                        (get calc-language 
+                                 (not (equal
+                                        (get calc-language
                                              'math-function-open) "["))
                                  (not (and math-exp-keep-spaces
                                            (eq (car-safe x) 'vec)))))
@@ -1138,8 +1141,8 @@ If the current Calc language does not use placeholders, return nil."
                                    (eq math-exp-token 'end)))
                           (throw 'syntax "Expected `)'"))
                       (math-read-token)
-                      (if (and (memq calc-language 
-                                      calc-lang-parens-are-subscripts) 
+                      (if (and (memq calc-language
+                                      calc-lang-parens-are-subscripts)
                                 args
                                (require 'calc-ext)
                                (let ((calc-matrix-mode 'scalar))
@@ -1181,7 +1184,7 @@ If the current Calc language does not use placeholders, return nil."
                                               (substring (symbol-name (cdr v))
                                                          4))
                                              (cdr v))))))
-                  (while (and (memq calc-language 
+                  (while (and (memq calc-language
                                      calc-lang-brackets-are-subscripts)
                               (equal math-expr-data "["))
                     (math-read-token)
@@ -1281,6 +1284,7 @@ If the current Calc language does not use placeholders, return nil."
 (provide 'calc-aent)
 
 ;; Local variables:
+;; coding: utf-8
 ;; generated-autoload-file: "calc-loaddefs.el"
 ;; End:
 
index 7af60e921407df91f50ec17df0f26507f7999cbf..4ab698ea64069acb1896c29ca5d0746bd0cf4348 100644 (file)
@@ -175,7 +175,7 @@ the size of a Calc bignum digit.")
        (progn
         (calc-change-mode 
           (list 'calc-number-radix 'calc-twos-complement-mode)
-          (list n (and (or (= n 2) (= n 8) (= n 16)) arg)) t)
+          (list n (or arg (calc-is-option))) t)
         ;; also change global value so minibuffer sees it
         (setq-default calc-number-radix calc-number-radix))
      (setq n calc-number-radix))
@@ -845,6 +845,8 @@ the size of a Calc bignum digit.")
            (len (length num)))
       (if (< len digs)
           (setq num (concat (make-string (- digs len) ?0) num))))
+    (when calc-group-digits
+      (setq num (math-group-float num)))
     (concat 
      (number-to-string calc-number-radix)
      "##"
index 61ec35732824be79430b998b51b47631a9b5f8ad..18e63655ecf5336901ab2fbd1ad94e7f56bd7afa 100644 (file)
@@ -1,7 +1,7 @@
 ;;; calc-ext.el --- various extension functions for Calc
 
-;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2002, 2003, 2004, 2005,
+;;   2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
 ;; Maintainer: Jay Belanger <jay.p.belanger@gmail.com>
   (define-key calc-mode-map "J" 'calc-conj)
   (define-key calc-mode-map "L" 'calc-ln)
   (define-key calc-mode-map "N" 'calc-eval-num)
+  (define-key calc-mode-map "O" 'calc-option)
   (define-key calc-mode-map "P" 'calc-pi)
   (define-key calc-mode-map "Q" 'calc-sqrt)
   (define-key calc-mode-map "R" 'calc-round)
@@ -959,7 +960,7 @@ math-read-brackets math-reduce-cols math-reduce-vec math-transpose)
 
  ("calc-yank" calc-alg-edit calc-clean-newlines
 calc-do-grab-rectangle calc-do-grab-region calc-finish-stack-edit
-calc-copy-to-register calc-insert-register 
+calc-copy-to-register calc-insert-register
 calc-append-to-register calc-prepend-to-register
 calc-force-refresh calc-locate-cursor-element calc-show-edit-buffer)
 
@@ -988,7 +989,7 @@ calc-floor calc-idiv calc-increment calc-mant-part calc-max calc-min
 calc-round calc-scale-float calc-sign calc-trunc calc-xpon-part)
 
  ("calc-bin" calc-and calc-binary-radix calc-clip calc-twos-complement-mode
-calc-decimal-radix calc-diff calc-hex-radix calc-leading-zeros 
+calc-decimal-radix calc-diff calc-hex-radix calc-leading-zeros
 calc-lshift-arith calc-lshift-binary calc-not calc-octal-radix calc-or calc-radix
 calc-rotate-binary calc-rshift-arith calc-rshift-binary calc-word-size
 calc-xor)
@@ -1045,7 +1046,7 @@ calc-graph-zero-x calc-graph-zero-y)
 calc-d-prefix-help calc-describe-function calc-describe-key
 calc-describe-key-briefly calc-describe-variable calc-f-prefix-help
 calc-full-help calc-g-prefix-help calc-help-prefix
-calc-hyperbolic-prefix-help calc-inv-hyp-prefix-help
+calc-hyperbolic-prefix-help calc-inv-hyp-prefix-help calc-option-prefix-help
 calc-inverse-prefix-help calc-j-prefix-help calc-k-prefix-help
 calc-m-prefix-help calc-r-prefix-help calc-s-prefix-help
 calc-t-prefix-help calc-u-prefix-help calc-v-prefix-help)
@@ -1408,9 +1409,18 @@ calc-kill calc-kill-region calc-yank))))
                        (with-current-buffer calc-main-buffer
                          calc-hyperbolic-flag)
                      calc-hyperbolic-flag))
-         (msg (if hyp-flag
-                 "Inverse Hyperbolic..."
-               "Inverse...")))
+         (opt-flag (if (or
+                        (eq major-mode 'calc-keypad-mode)
+                        (eq major-mode 'calc-trail-mode))
+                       (with-current-buffer calc-main-buffer
+                         calc-option-flag)
+                     calc-option-flag))
+         (msg
+          (cond
+           ((and opt-flag hyp-flag) "Option Inverse Hyperbolic...")
+           (hyp-flag "Inverse Hyperbolic...")
+           (opt-flag "Option Inverse...")
+           (t "Inverse..."))))
     (calc-fancy-prefix 'calc-inverse-flag msg n)))
 
 (defconst calc-fancy-prefix-map
@@ -1489,9 +1499,18 @@ calc-kill calc-kill-region calc-yank))))
                        (with-current-buffer calc-main-buffer
                          calc-inverse-flag)
                      calc-inverse-flag))
-         (msg (if inv-flag
-                  "Inverse Hyperbolic..."
-                "Hyperbolic...")))
+         (opt-flag (if (or
+                        (eq major-mode 'calc-keypad-mode)
+                        (eq major-mode 'calc-trail-mode))
+                       (with-current-buffer calc-main-buffer
+                         calc-option-flag)
+                     calc-option-flag))
+         (msg
+          (cond
+           ((and opt-flag inv-flag) "Option Inverse Hyperbolic...")
+           (opt-flag "Option Hyperbolic...")
+           (inv-flag "Inverse Hyperbolic...")
+           (t "Hyperbolic..."))))
     (calc-fancy-prefix 'calc-hyperbolic-flag msg n)))
 
 (defun calc-hyperbolic-func ()
@@ -1504,6 +1523,31 @@ calc-kill calc-kill-region calc-yank))))
 (defun calc-is-hyperbolic ()
   calc-hyperbolic-flag)
 
+(defun calc-option (&optional n)
+  (interactive "P")
+  (let* ((inv-flag (if (or
+                        (eq major-mode 'calc-keypad-mode)
+                        (eq major-mode 'calc-trail-mode))
+                       (with-current-buffer calc-main-buffer
+                         calc-inverse-flag)
+                     calc-inverse-flag))
+         (hyp-flag (if (or
+                        (eq major-mode 'calc-keypad-mode)
+                        (eq major-mode 'calc-trail-mode))
+                       (with-current-buffer calc-main-buffer
+                         calc-hyperbolic-flag)
+                     calc-hyperbolic-flag))
+         (msg
+          (cond
+           ((and hyp-flag inv-flag) "Option Inverse Hyperbolic...")
+           (hyp-flag "Option Hyperbolic...")
+           (inv-flag "Option Inverse...")
+           (t "Option..."))))
+    (calc-fancy-prefix 'calc-option-flag msg n)))
+
+(defun calc-is-option ()
+  calc-option-flag)
+
 (defun calc-keep-args (&optional n)
   (interactive "P")
   (calc-fancy-prefix 'calc-keep-args-flag "Keep args..." n))
@@ -1658,8 +1702,8 @@ calc-kill calc-kill-region calc-yank))))
 (defun calc-execute-extended-command (n)
   (interactive "P")
   (let* ((prompt (concat (calc-num-prefix-name n) "M-x "))
-        (cmd (intern 
-               (completing-read prompt obarray 'commandp t "calc-" 
+        (cmd (intern
+               (completing-read prompt obarray 'commandp t "calc-"
                                 'calc-extended-command-history))))
     (setq prefix-arg n)
     (command-execute cmd)))
@@ -3239,7 +3283,7 @@ If X is not an error form, return 1."
             (concat "-" (math-format-flat-expr (nth 1 a) 1000)))
            (t
             (concat (math-remove-dashes
-                     (if (string-match "\\`calcFunc-\\([a-zA-Z0-9']+\\)\\'"
+                     (if (string-match "\\`calcFunc-\\([a-zA-Zα-ωΑ-Ω0-9']+\\)\\'"
                                        (symbol-name (car a)))
                          (math-match-substring (symbol-name (car a)) 1)
                        (symbol-name (car a))))
@@ -3425,7 +3469,8 @@ If X is not an error form, return 1."
 
 (defun math-group-float (str)   ; [X X]
   (let* ((pt (or (string-match "[^0-9a-zA-Z]" str) (length str)))
-        (g (if (integerp calc-group-digits) (math-abs calc-group-digits) 3))
+        (g (if (integerp calc-group-digits) (math-abs calc-group-digits)
+              (if (memq calc-number-radix '(2 16)) 4 3)))
         (i pt))
     (if (and (integerp calc-group-digits) (< calc-group-digits 0))
        (while (< (setq i (+ (1+ i) g)) (length str))
@@ -3455,5 +3500,9 @@ A key may contain additional specs for Inverse, Hyperbolic, and Inv+Hyp.")
 
 (provide 'calc-ext)
 
+;; Local variables:
+;; coding: utf-8
+;; End:
+
 ;; arch-tag: 1814ba7f-a390-49dc-9e25-a5adc205e97e
 ;;; calc-ext.el ends here
index a01f5b8b9facf47afab8afeca2c7257852b37f0a..265f0b325b9638c0fea07b8a196125c038084e8c 100644 (file)
            n temp))
     (math-div n d)))
 
-
-
 (defun calcFunc-fdiv (a b)   ; [R I I] [Public]
-  (if (Math-num-integerp a)
-      (if (Math-num-integerp b)
-         (if (Math-zerop b)
-             (math-reject-arg a "*Division by zero")
-           (math-make-frac (math-trunc a) (math-trunc b)))
-       (math-reject-arg b 'integerp))
-    (math-reject-arg a 'integerp)))
+  (cond
+   ((Math-num-integerp a)
+    (cond 
+     ((Math-num-integerp b)
+      (if (Math-zerop b)
+         (math-reject-arg a "*Division by zero")
+       (math-make-frac (math-trunc a) (math-trunc b))))
+     ((eq (car-safe b) 'frac)
+      (if (Math-zerop (nth 1 b))
+         (math-reject-arg a "*Division by zero")
+       (math-make-frac (math-mul (math-trunc a) (nth 2 b)) (nth 1 b))))
+     (t (math-reject-arg b 'integerp))))
+   ((eq (car-safe a) 'frac)
+    (cond 
+     ((Math-num-integerp b)
+      (if (Math-zerop b)
+         (math-reject-arg a "*Division by zero")
+       (math-make-frac (cadr a) (math-mul (nth 2 a) (math-trunc b)))))
+     ((eq (car-safe b) 'frac)
+      (if (Math-zerop (nth 1 b))
+         (math-reject-arg a "*Division by zero")
+       (math-make-frac (math-mul (nth 1 a) (nth 2 b)) (math-mul (nth 2 a) (nth 1 b)))))
+     (t (math-reject-arg b 'integerp))))
+   (t 
+    (math-reject-arg a 'integerp))))
 
 (provide 'calc-frac)
 
index 9af89ab6c3abe389aba3024bc2403736747b2020..9fefaa73d79041766c206fad7feb7d7508388d65 100644 (file)
           (while (memq (preceding-char) '(?\s ?\t))
             (forward-char -1))
           (if (eq (preceding-char) ?\,)
-              (delete-backward-char 1))))
+              (delete-char -1))))
        (with-current-buffer calcbuf
         (setq cache-env (list calc-angle-mode
                               calc-complex-mode
index 0b2240f78c4f5ab727732cab90b94179afdbae7d..47c951306418689168ff444de4b9127b299e0179 100644 (file)
@@ -128,7 +128,7 @@ C-w  Describe how there is no warranty for Calc."
               (dig2 (char-after (match-beginning 3))))
           (delete-region (match-end 1) (match-end 0))
           (goto-char (match-beginning 1))
-          (delete-backward-char 1)
+          (delete-char -1)
           (delete-char 5)
           (insert (format "%c .. %c" (min dig1 dig2) (max dig1 dig2)))))
       (goto-char (point-min)))))
@@ -446,6 +446,7 @@ C-w  Describe how there is no warranty for Calc."
            '(calc-inverse-prefix-help
              calc-hyperbolic-prefix-help
              calc-inv-hyp-prefix-help
+              calc-option-prefix-help
              calc-a-prefix-help
              calc-b-prefix-help
              calc-c-prefix-help
@@ -512,6 +513,11 @@ C-w  Describe how there is no warranty for Calc."
      "I H + a S (general invert func); v h (rtail)")
    "inverse-hyperbolic" nil))
 
+(defun calc-option-prefix-help ()
+  (interactive)
+  (calc-do-prefix-help
+   '("")
+   "option" nil))
 
 (defun calc-f-prefix-help ()
   (interactive)
index 6244c0d97e1af22e5e83b42cd29e8db12f3e74cc..4381172114601a68d64dd17a8ebe901cdd06d450 100644 (file)
 (defun calc-digit-dots ()
   (if (eq calc-prev-char ?.)
       (progn
-       (delete-backward-char 1)
+       (delete-char -1)
        (if (calc-minibuffer-contains ".*\\.\\'")
-           (delete-backward-char 1))
+           (delete-char -1))
        (setq calc-prev-char 'dots
              last-command-event 32)
        (if calc-prev-prev-char
             (erase-buffer))
          (exit-minibuffer)))
     ;; just ignore extra decimal point, anticipating ".."
-    (delete-backward-char 1)))
+    (delete-char -1)))
 
 (defun calc-dots ()
   (interactive)
index cd30232feeea4d17cc23fc0d02f924a1be4e8d02..f461c47aafd4981486ba55fd1976ca71ba84d340 100644 (file)
@@ -1,7 +1,7 @@
 ;;; calc-lang.el --- calc language functions
 
-;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2002, 2003, 2004, 2005,
+;;   2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
 ;; Maintainer: Jay Belanger <jay.p.belanger@gmail.com>
 (put 'pascal 'math-lang-read-symbol
      '((?\$
         (eq (string-match
-             "\\(\\$[0-9a-fA-F]+\\)\\($\\|[^0-9a-zA-Z]\\)"
+             "\\(\\$[0-9a-fA-F]+\\)\\($\\|[^0-9a-zA-Zα-ωΑ-Ω]\\)"
              math-exp-str math-exp-pos)
             math-exp-pos)
         (setq math-exp-token 'number
 
 (put 'fortran 'math-lang-read-symbol
      '((?\.
-        (eq (string-match "\\.[a-zA-Z][a-zA-Z][a-zA-Z]?\\."
+        (eq (string-match "\\.[a-zA-Zα-ωΑ-Ω][a-zA-Zα-ωΑ-Ω][a-zA-Zα-ωΑ-Ω]?\\."
                           math-exp-str math-exp-pos) math-exp-pos)
         (setq math-exp-token 'punc
               math-expr-data (upcase (math-match-substring math-exp-str 0))
 (add-to-list 'calc-lang-allow-underscores 'fortran)
 (add-to-list 'calc-lang-parens-are-subscripts 'fortran)
 
-;; The next few variables are local to math-read-exprs in calc-aent.el 
+;; The next few variables are local to math-read-exprs in calc-aent.el
 ;; and math-read-expr in calc-ext.el, but are set in functions they call.
 
 (defvar math-exp-token)
          ((= n 1)
           (message "TeX language mode with \\hbox{func}(\\hbox{var})"))
          ((> n 1)
-          (message 
+          (message
            "TeX language mode with \\hbox{func}(\\hbox{var}) and multiline matrices"))
          ((= n -1)
           (message "TeX language mode with \\func(\\hbox{var})"))
          ((< n -1)
-          (message 
+          (message
            "TeX language mode with \\func(\\hbox{var}) and multiline matrices")))))
 
 (defun calc-latex-language (n)
          ((= n 1)
           (message "LaTeX language mode with \\text{func}(\\text{var})"))
          ((> n 1)
-          (message 
+          (message
            "LaTeX language mode with \\text{func}(\\text{var}) and multiline matrices"))
          ((= n -1)
           (message "LaTeX language mode with \\func(\\text{var})"))
          ((< n -1)
-          (message 
+          (message
            "LaTeX language mode with \\func(\\text{var}) and multiline matrices")))))
 
 (put 'tex 'math-lang-name "TeX")
        (intv . math-compose-tex-intv)))
 
 (put 'tex 'math-variable-table
-  '( 
+  '(
     ;; The Greek letters
     ( \\alpha      . var-alpha )
     ( \\beta       . var-beta  )
      '((?\\
         (< math-exp-pos (1- (length math-exp-str)))
         (progn
-          (or (string-match "\\\\hbox *{\\([a-zA-Z0-9]+\\)}"
+          (or (string-match "\\\\hbox *{\\([a-zA-Zα-ωΑ-Ω0-9]+\\)}"
                             math-exp-str math-exp-pos)
-              (string-match "\\(\\\\\\([a-zA-Z]+\\|[^a-zA-Z]\\)\\)"
+              (string-match "\\(\\\\\\([a-zA-Zα-ωΑ-Ω]+\\|[^a-zA-Zα-ωΑ-Ω]\\)\\)"
                             math-exp-str math-exp-pos))
           (setq math-exp-token 'symbol
                 math-exp-pos (match-end 0)
 
 (defun math-compose-tex-matrix (a &optional ltx)
   (if (cdr a)
-      (cons (append (math-compose-vector (cdr (car a)) " & " 0) 
+      (cons (append (math-compose-vector (cdr (car a)) " & " 0)
                     (if ltx '(" \\\\ ") '(" \\cr ")))
             (math-compose-tex-matrix (cdr a) ltx))
     (list (math-compose-vector (cdr (car a)) " & " 0))))
 (defun math-compose-tex-var (a prec)
   (if (and calc-language-option
            (not (= calc-language-option 0))
-           (string-match "\\`[a-zA-Z][a-zA-Z0-9]+\\'"
+           (string-match "\\`[a-zA-Zα-ωΑ-Ω][a-zA-Zα-ωΑ-Ω0-9]+\\'"
                          (symbol-name (nth 1 a))))
       (if (eq calc-language 'latex)
           (format "\\text{%s}" (symbol-name (nth 1 a)))
   (let (left right)
     (if (and calc-language-option
              (not (= calc-language-option 0))
-             (string-match "\\`[a-zA-Z][a-zA-Z0-9]+\\'" func))
+             (string-match "\\`[a-zA-Zα-ωΑ-Ω][a-zA-Zα-ωΑ-Ω0-9]+\\'" func))
         (if (< (prefix-numeric-value calc-language-option) 0)
             (setq func (format "\\%s" func))
           (setq func (if (eq calc-language 'latex)
            (setq left "{" right "}"))
           (t (setq left calc-function-open
                    right calc-function-close)))
-    (list 'horiz func 
+    (list 'horiz func
           left
           (math-compose-vector (cdr a) ", " 0)
           right)))
      '((?\\
         (< math-exp-pos (1- (length math-exp-str)))
         (progn
-          (or (string-match "\\\\hbox *{\\([a-zA-Z0-9]+\\)}"
+          (or (string-match "\\\\hbox *{\\([a-zA-Zα-ωΑ-Ω0-9]+\\)}"
                             math-exp-str math-exp-pos)
-              (string-match "\\\\text *{\\([a-zA-Z0-9]+\\)}"
+              (string-match "\\\\text *{\\([a-zA-Zα-ωΑ-Ω0-9]+\\)}"
                             math-exp-str math-exp-pos)
-              (string-match "\\(\\\\\\([a-zA-Z]+\\|[^a-zA-Z]\\)\\)"
+              (string-match "\\(\\\\\\([a-zA-Zα-ωΑ-Ω]+\\|[^a-zA-Zα-ωΑ-Ω]\\)\\)"
                             math-exp-str math-exp-pos))
           (setq math-exp-token 'symbol
                 math-exp-pos (match-end 0)
                      (and right
                           (setq math-exp-str (copy-sequence math-exp-str))
                           (aset math-exp-str right ?\]))))))))))
-        
+
 (defun math-latex-parse-frac (f val)
   (let (numer denom)
     (setq numer (car (math-read-expr-list)))
                  (cdr (math-transpose a)))
                 '("}")))))
 
-(put 'eqn 'math-var-formatter 
+(put 'eqn 'math-var-formatter
      (function
       (lambda (a prec)
         (let (v)
                         (intern (substring (symbol-name (nth 2 a)) 0 -1))))
                  prec)
               (symbol-name (nth 1 a))))))))
-      
+
 (defconst math-eqn-special-funcs
   '( calcFunc-log
      calcFunc-ln calcFunc-exp
      calcFunc-arcsin calcFunc-arccos calcFunc-arctan
      calcFunc-arcsinh calcFunc-arccosh calcFunc-arctanh))
 
-(put 'eqn 'math-func-formatter 
+(put 'eqn 'math-func-formatter
      (function
       (lambda (func a)
         (let (left right)
                      (not (math-tex-expr-is-flat (nth 1 a))))
                  (setq left "{left ( "
                        right " right )}"))
-                
-                ((and 
+
+                ((and
                   (memq (car a) math-eqn-special-funcs)
                   (= (length a) 2)
                   (or (Math-realp (nth 1 a))
      ("above" punc ",")))
 
 (put 'eqn 'math-lang-adjust-words
-     (function 
+     (function
       (lambda ()
         (let ((code (assoc math-expr-data math-eqn-ignore-words)))
           (cond ((null code))
        ( Gamma       . var-gamma)))
 
 (put 'yacas 'math-parse-table
-     '((("Deriv(" 0 ")" 0) 
+     '((("Deriv(" 0 ")" 0)
         calcFunc-deriv (var ArgB var-ArgB) (var ArgA var-ArgA))
-       (("D(" 0 ")" 0) 
+       (("D(" 0 ")" 0)
         calcFunc-deriv (var ArgB var-ArgB) (var ArgA var-ArgA))
-       (("Integrate(" 0 ")" 0) 
+       (("Integrate(" 0 ")" 0)
         calcFunc-integ (var ArgB var-ArgB)(var ArgA var-ArgA))
-       (("Integrate(" 0 "," 0 "," 0 ")" 0) 
-        calcFunc-integ (var ArgD var-ArgD) (var ArgA var-ArgA) 
+       (("Integrate(" 0 "," 0 "," 0 ")" 0)
+        calcFunc-integ (var ArgD var-ArgD) (var ArgA var-ArgA)
         (var ArgB var-ArgB) (var ArgC var-ArgC))
-       (("Subst(" 0 "," 0 ")" 0) 
-        calcFunc-subst (var ArgC var-ArgC) (var ArgA var-ArgA) 
+       (("Subst(" 0 "," 0 ")" 0)
+        calcFunc-subst (var ArgC var-ArgC) (var ArgA var-ArgA)
         (var ArgB var-ArgB))
-       (("Taylor(" 0 "," 0 "," 0 ")" 0) 
-        calcFunc-taylor (var ArgD var-ArgD) 
-        (calcFunc-eq (var ArgA var-ArgA) (var ArgB var-ArgB)) 
+       (("Taylor(" 0 "," 0 "," 0 ")" 0)
+        calcFunc-taylor (var ArgD var-ArgD)
+        (calcFunc-eq (var ArgA var-ArgA) (var ArgB var-ArgB))
         (var ArgC var-ArgC))))
 
 (put 'yacas 'math-oper-table
         (math-compose-expr (nth 2 a) -1)
         (if (not (nth 3 a))
             ")"
-          (concat 
+          (concat
            ","
            (math-compose-expr (nth 3 a) -1)
            ","
      '(("+"    +               100  100)
        ("-"    -               100  134)
        ("*"    *               120  120)
-       ("."    *               130  129)       
+       ("."    *               130  129)
        ("/"    /               120  120)
        ("u-"   neg              -1  180)
        ("u+"   ident            -1  180)
           (nth 3 args))))
 
 (put 'maxima 'math-parse-table
-     '((("if" 0 "then" 0 "else" 0) 
-        calcFunc-if 
-        (var ArgA var-ArgA) 
+     '((("if" 0 "then" 0 "else" 0)
+        calcFunc-if
+        (var ArgA var-ArgA)
         (var ArgB var-ArgB)
         (var ArgC var-ArgC))))
 
       (lambda (a)
         (list 'horiz
               "matrix("
-              (math-compose-vector (cdr a) 
+              (math-compose-vector (cdr a)
                                    (concat math-comp-comma " ")
                                    math-comp-vector-prec)
               ")"))))
@@ -1734,7 +1734,7 @@ order to Calc's."
           (nth 0 args))))
 
 (put 'giac 'math-parse-table
-     '((("set" 0) 
+     '((("set" 0)
         calcFunc-rdup
         (var ArgA var-ArgA))))
 
@@ -1748,7 +1748,7 @@ order to Calc's."
   "Compose the arguments to a Calc function in reverse order.
 This is used for various language modes which have functions in reverse
 order to Calc's."
-  (list 'horiz (nth 1 fn) 
+  (list 'horiz (nth 1 fn)
         "("
         (math-compose-expr (nth 2 a) 0)
         ","
@@ -1770,7 +1770,7 @@ order to Calc's."
           (list 'horiz
                 (math-compose-expr (nth 1 a) 1000)
                 "["
-                (math-compose-expr 
+                (math-compose-expr
                  (calc-normalize (list '- (nth 2 a) 1)) 0)
                 "]")))))
 
@@ -2001,7 +2001,7 @@ order to Calc's."
         (list 'horiz
               "matrix("
               math-comp-left-bracket
-              (math-compose-vector (cdr a) 
+              (math-compose-vector (cdr a)
                                    (concat math-comp-comma " ")
                                    math-comp-vector-prec)
               math-comp-right-bracket
@@ -2044,9 +2044,9 @@ order to Calc's."
 (defvar math-read-big-baseline)
 (defvar math-read-big-h2)
 
-;; The variables math-rb-h1, math-rb-h2, math-rb-v1 and math-rb-v2 
-;; are local to math-read-big-rec, but are used by math-read-big-char, 
-;; math-read-big-emptyp and math-read-big-balance which are called by 
+;; The variables math-rb-h1, math-rb-h2, math-rb-v1 and math-rb-v2
+;; are local to math-read-big-rec, but are used by math-read-big-char,
+;; math-read-big-emptyp and math-read-big-balance which are called by
 ;; math-read-big-rec.
 ;; math-rb-h2 is also local to math-read-big-bigp in calc-ext.el,
 ;; which calls math-read-big-balance.
@@ -2055,40 +2055,40 @@ order to Calc's."
 (defvar math-rb-v1)
 (defvar math-rb-v2)
 
-(defun math-read-big-rec (math-rb-h1 math-rb-v1 math-rb-h2 math-rb-v2 
+(defun math-read-big-rec (math-rb-h1 math-rb-v1 math-rb-h2 math-rb-v2
                                      &optional baseline prec short)
   (or prec (setq prec 0))
 
   ;; Clip whitespace above or below.
-  (while (and (< math-rb-v1 math-rb-v2) 
+  (while (and (< math-rb-v1 math-rb-v2)
               (math-read-big-emptyp math-rb-h1 math-rb-v1 math-rb-h2 (1+ math-rb-v1)))
     (setq math-rb-v1 (1+ math-rb-v1)))
-  (while (and (< math-rb-v1 math-rb-v2) 
+  (while (and (< math-rb-v1 math-rb-v2)
               (math-read-big-emptyp math-rb-h1 (1- math-rb-v2) math-rb-h2 math-rb-v2))
     (setq math-rb-v2 (1- math-rb-v2)))
 
   ;; If formula is a single line high, normal parser can handle it.
   (if (<= math-rb-v2 (1+ math-rb-v1))
       (if (or (<= math-rb-v2 math-rb-v1)
-             (> math-rb-h1 (length (setq math-rb-v2 
+             (> math-rb-h1 (length (setq math-rb-v2
                                           (nth math-rb-v1 math-read-big-lines)))))
          (math-read-big-error math-rb-h1 math-rb-v1)
        (setq math-read-big-baseline math-rb-v1
              math-read-big-h2 math-rb-h2
              math-rb-v2 (nth math-rb-v1 math-read-big-lines)
-             math-rb-h2 (math-read-expr 
-                          (substring math-rb-v2 math-rb-h1 
+             math-rb-h2 (math-read-expr
+                          (substring math-rb-v2 math-rb-h1
                                      (min math-rb-h2 (length math-rb-v2)))))
        (if (eq (car-safe math-rb-h2) 'error)
-           (math-read-big-error (+ math-rb-h1 (nth 1 math-rb-h2)) 
+           (math-read-big-error (+ math-rb-h1 (nth 1 math-rb-h2))
                                  math-rb-v1 (nth 2 math-rb-h2))
          math-rb-h2))
 
     ;; Clip whitespace at left or right.
-    (while (and (< math-rb-h1 math-rb-h2) 
+    (while (and (< math-rb-h1 math-rb-h2)
                 (math-read-big-emptyp math-rb-h1 math-rb-v1 (1+ math-rb-h1) math-rb-v2))
       (setq math-rb-h1 (1+ math-rb-h1)))
-    (while (and (< math-rb-h1 math-rb-h2) 
+    (while (and (< math-rb-h1 math-rb-h2)
                 (math-read-big-emptyp (1- math-rb-h2) math-rb-v1 math-rb-h2 math-rb-v2))
       (setq math-rb-h2 (1- math-rb-h2)))
 
@@ -2107,7 +2107,7 @@ order to Calc's."
             (/= (aref line math-rb-h1) ?\ )
             (if (and (= (aref line math-rb-h1) ?\-)
                      ;; Make sure it's not a minus sign.
-                     (or (and (< (1+ math-rb-h1) len) 
+                     (or (and (< (1+ math-rb-h1) len)
                                (= (aref line (1+ math-rb-h1)) ?\-))
                          (/= (math-read-big-char math-rb-h1 (1- v)) ?\ )
                          (/= (math-read-big-char math-rb-h1 (1+ v)) ?\ )))
@@ -2166,7 +2166,7 @@ order to Calc's."
            ;; Binomial coefficient.
            ((and (= other-char ?\()
                  (= (math-read-big-char (1+ math-rb-h1) v) ?\ )
-                 (= (string-match "( *)" (nth v math-read-big-lines) 
+                 (= (string-match "( *)" (nth v math-read-big-lines)
                                    math-rb-h1) math-rb-h1))
             (setq h (match-end 0))
             (math-read-big-emptyp math-rb-h1 math-rb-v1 (1+ math-rb-h1) v nil t)
@@ -2180,7 +2180,7 @@ order to Calc's."
 
            ;; Minus sign.
            ((= other-char ?\-)
-            (setq p (list 'neg (math-read-big-rec (1+ math-rb-h1) math-rb-v1 
+            (setq p (list 'neg (math-read-big-rec (1+ math-rb-h1) math-rb-v1
                                                    math-rb-h2 math-rb-v2 v 250 t))
                   v math-read-big-baseline
                   h math-read-big-h2))
@@ -2199,10 +2199,10 @@ order to Calc's."
               (if (= sep ?\])
                   (math-read-big-error (1- h) v "Expected `)'"))
               (if (= sep ?\))
-                  (setq p (math-read-big-rec 
+                  (setq p (math-read-big-rec
                             (1+ math-rb-h1) math-rb-v1 (1- h) math-rb-v2 v))
                 (setq hmid (math-read-big-balance h v "(")
-                      p (list p 
+                      p (list p
                                (math-read-big-rec h math-rb-v1 (1- hmid) math-rb-v2 v))
                       h hmid)
                 (cond ((= sep ?\.)
@@ -2301,9 +2301,11 @@ order to Calc's."
 
            ;; Variable name or function call.
            ((or (and (>= other-char ?a) (<= other-char ?z))
-                (and (>= other-char ?A) (<= other-char ?Z)))
+                (and (>= other-char ?A) (<= other-char ?Z))
+                (and (>= other-char ?α) (<= other-char ?ω))
+                (and (>= other-char ?Α) (<= other-char ?Ω)))
             (setq line (nth v math-read-big-lines))
-            (string-match "\\([a-zA-Z'_]+\\) *" line math-rb-h1)
+            (string-match "\\([a-zA-Zα-ωΑ-Ω'_]+\\) *" line math-rb-h1)
             (setq h (match-end 1)
                   widest (match-end 0)
                   p (math-match-substring line 1))
@@ -2345,7 +2347,7 @@ order to Calc's."
             (math-read-big-emptyp math-rb-h1 math-rb-v1 h v nil t)
             (math-read-big-emptyp math-rb-h1 (1+ v) h math-rb-v2 nil t)))
 
-      ;; Now left term is bounded by math-rb-h1, math-rb-v1, h, math-rb-v2; 
+      ;; Now left term is bounded by math-rb-h1, math-rb-v1, h, math-rb-v2;
       ;; baseline = v.
       (if baseline
          (or (= v baseline)
@@ -2387,12 +2389,12 @@ order to Calc's."
        (cond ((eq (nth 3 widest) -1)
               (setq p (list (nth 1 widest) p)))
              ((equal (car widest) "?")
-              (let ((y (math-read-big-rec h math-rb-v1 math-rb-h2 
+              (let ((y (math-read-big-rec h math-rb-v1 math-rb-h2
                                            math-rb-v2 baseline nil t)))
                 (or (= (math-read-big-char math-read-big-h2 baseline) ?\:)
                     (math-read-big-error math-read-big-h2 baseline "Expected `:'"))
                 (setq p (list (nth 1 widest) p y
-                              (math-read-big-rec 
+                              (math-read-big-rec
                                 (1+ math-read-big-h2) math-rb-v1 math-rb-h2 math-rb-v2
                                 baseline (nth 3 widest) t))
                       h math-read-big-h2)))
@@ -2481,5 +2483,9 @@ order to Calc's."
 
 (provide 'calc-lang)
 
+;; Local variables:
+;; coding: utf-8
+;; End:
+
 ;; arch-tag: 483bfe15-f290-4fef-bb7d-ce65be687f2e
 ;;; calc-lang.el ends here
index b6b2917f0fea2e166c6987fe2b6bed744910eefa..890e624ecb45c047c3d2a9dfeb26849c1ee7db1c 100644 (file)
@@ -35,6 +35,7 @@
 (declare-function calc-inv-hyp-prefix-help "calc-help" ())
 (declare-function calc-inverse-prefix-help "calc-help" ())
 (declare-function calc-hyperbolic-prefix-help "calc-help" ())
+(declare-function calc-option-prefix-help "calc-help" ())
 (declare-function calc-explain-why "calc-stuff" (why &optional more))
 (declare-function calc-clear-command-flag "calc-ext" (f))
 (declare-function calc-roll-down-with-selections "calc-sel" (n m))
@@ -219,7 +220,7 @@ Calc user interface as before (either C-x * C or C-x * K; initially C-x * C).
   (let ((msgs
         '("Press `h' for complete help; press `?' repeatedly for a summary"
           "Letter keys: Negate; Precision; Yank; Why; Xtended cmd; Quit"
-          "Letter keys: SHIFT + Undo, reDo; Keep-args; Inverse, Hyperbolic"
+          "Letter keys: SHIFT + Undo, reDo; Keep-args; Inverse, Hyperbolic, Option"
           "Letter keys: SHIFT + sQrt; Sin, Cos, Tan; Exp, Ln, logB"
           "Letter keys: SHIFT + Floor, Round; Abs, conJ, arG; Pi"
           "Letter keys: SHIFT + Num-eval; More-recn; eXec-kbd-macro"
@@ -245,20 +246,22 @@ Calc user interface as before (either C-x * C or C-x * K; initially C-x * C).
                  (calc-inv-hyp-prefix-help)
                (calc-inverse-prefix-help))
            (calc-hyperbolic-prefix-help))
-       (setq calc-help-phase
-             (if (eq this-command last-command)
-                 (% (1+ calc-help-phase) (1+ (length msgs)))
-               0))
-       (let ((msg (nth calc-help-phase msgs)))
-         (message "%s" (if msg
-                           (concat msg ":"
-                                   (make-string (- (apply 'max
-                                                          (mapcar 'length
-                                                                  msgs))
-                                                   (length msg)) 32)
-                                   "  [?=MORE]")
-                         "")))))))
-
+        (if calc-option-flag
+            (calc-option-prefix-help)
+          (setq calc-help-phase
+                (if (eq this-command last-command)
+                    (% (1+ calc-help-phase) (1+ (length msgs)))
+                  0))
+          (let ((msg (nth calc-help-phase msgs)))
+            (message "%s" (if msg
+                              (concat msg ":"
+                                      (make-string (- (apply 'max
+                                                             (mapcar 'length
+                                                                     msgs))
+                                                      (length msg)) 32)
+                                      "  [?=MORE]")
+                            ""))))))))
+  
 
 
 
index a994ace6fb60913c1e353fccd5b3bdac48f7beaa..f268a032d147d70ef643673c112aeae27f8668d1 100644 (file)
                  (cons 'vec (cons (nth 1 facs) (cons (list 'vec fac pow)
                                                      (cdr (cdr facs)))))
                (cons 'vec (cons (list 'vec fac pow) (cdr facs))))))))
-    (math-mul (math-pow fac pow) facs)))
+    (math-mul (math-pow fac pow) (math-factor-protect facs))))
 
 (defun math-factor-poly-coefs (p &optional square-free)    ; uses "x"
   (let (t1 t2 temp)
index 084b9ea2b6a91efc41cdc2cccb50c62848981fcc..c485fdd168a03e6dfc70d3538c906a1e0c557ffa 100644 (file)
        (setq n (1+ n))))
    (calc-clear-command-flag 'position-point)))
 
+(defvar calc-highlight-selections-with-faces)
+
 (defun calc-show-selections (arg)
   (interactive "P")
   (calc-wrapper
                (setcar (nthcdr 2 calc-selection-cache-entry) nil)
                (calc-change-current-selection sel)))))
    (message (if calc-show-selections
-               "Displaying only selected part of formulas"
-             "Displaying all but selected part of formulas"))))
+                (if calc-highlight-selections-with-faces
+                    "De-emphasizing all but selected part of formulas"
+                  "Displaying only selected part of formulas")
+              (if calc-highlight-selections-with-faces
+                  "Emphasizing selected part of formulas"
+                "Displaying all but selected part of formulas")))))
 
 ;; The variables calc-final-point-line and calc-final-point-column
 ;; are declared in calc.el, and are used throughout.
index 5ec21eee8873d19c8575e52fb6df37e4b2f530d0..b82ed08c557c900040bb536c9d8e59b266ce188e 100644 (file)
@@ -1,7 +1,7 @@
 ;;; calc-store.el --- value storage functions for Calc
 
-;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2002, 2003, 2004, 2005,
+;;   2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
 ;; Maintainer: Jay Belanger <jay.p.belanger@gmail.com>
                     (minibuffer-completion-predicate
                      (lambda (x) (boundp (intern (concat "var-" x)))))
                     (minibuffer-completion-confirm t))
-                (read-from-minibuffer 
-                 prompt nil calc-var-name-map nil 
+                (read-from-minibuffer
+                 prompt nil calc-var-name-map nil
                  'calc-read-var-name-history)))))
     (setq calc-aborted-prefix "")
     (and (not (equal var "var-"))
-        (if (string-match "\\`\\([-a-zA-Z0-9]+\\) *:?=" var)
+        (if (string-match "\\`\\([-a-zA-Zα-ωΑ-Ω0-9]+\\) *:?=" var)
             (if (null calc-given-value-flag)
                 (error "Assignment is not allowed in this command")
               (let ((svar (intern (substring var 0 (match-end 1)))))
 
 (provide 'calc-store)
 
+;; Local variables:
+;; coding: utf-8
+;; End:
+
 ;; arch-tag: 2fbfec82-a521-42ca-bcd8-4f254ae6313e
 ;;; calc-store.el ends here
index 9bbb4178fd300f4afd1c98c1f4f1a0e68761a7e4..20dc1d1b99e2099f4616ab1dcc863e4524b153f8 100644 (file)
 (defun calc-trail-isearch-forward ()
   (interactive)
   (calc-with-trail-buffer
-   (save-window-excursion
-     (select-window (get-buffer-window (current-buffer)))
-     (let ((search-exit-char ?\r))
-       (isearch-forward)))
-   (calc-trail-here)))
+   (let ((win (get-buffer-window (current-buffer)))
+         pos)
+     (save-window-excursion
+       (select-window win)
+       (isearch-forward)
+       (setq pos (point)))
+     (goto-char pos)
+     (set-window-point win pos)
+     (calc-trail-here))))
 
 (defun calc-trail-isearch-backward ()
   (interactive)
   (calc-with-trail-buffer
-   (save-window-excursion
-     (select-window (get-buffer-window (current-buffer)))
-     (let ((search-exit-char ?\r))
-       (isearch-backward)))
-   (calc-trail-here)))
+   (let ((win (get-buffer-window (current-buffer)))
+         pos)
+     (save-window-excursion
+       (select-window win)
+       (isearch-backward)
+       (setq pos (point)))
+     (goto-char pos)
+     (set-window-point win pos)
+     (calc-trail-here))))
 
 (defun calc-trail-yank (arg)
   (interactive "P")
index 6dd3e4911b757e8d38c1680b48fc6c91ac1a744b..a88e87dffbc32fa5226ecedc188389b8a0f24d0c 100644 (file)
@@ -1,7 +1,7 @@
 ;;; calc-units.el --- unit conversion functions for Calc
 
-;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2002, 2003, 2004, 2005,
+;;   2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
 ;; Maintainer: Jay Belanger <jay.p.belanger@gmail.com>
 
 ;;; Units table last updated 9-Jan-91 by Ulrich Mueller (ulm@vsnhd1.cern.ch)
 ;;; with some additions by Przemek Klosowski (przemek@rrdstrad.nist.gov)
-;;; Updated April 2002 by Jochen Küpper
+;;; Updated April 2002 by Jochen Küpper
 
 ;;; Updated August 2007, using
 ;;;     CODATA (http://physics.nist.gov/cuu/Constants/index.html)
 ;;;     NIST   (http://physics.nist.gov/Pubs/SP811/appenB9.html)
 ;;;     ESUWM  (Encyclopaedia of Scientific Units, Weights and
-;;;             Measures, by François Cardarelli)
+;;;             Measures, by François Cardarelli)
 ;;; All conversions are exact unless otherwise noted.
 
 (defvar math-standard-units
               "1.602176487 10^-19 C (*)") ;;(approx) CODATA
     ( V       "W/A"                   "Volt" )
     ( ohm     "V/A"                   "Ohm" )
+    ( Ω       "ohm"                   "Ohm" )
     ( mho     "A/V"                   "Mho" )
     ( S       "A/V"                   "Siemens" )
     ( F       "C/V"                   "Farad" )
               "6.62606896 10^-34 J s (*)")
     ( hbar    "h / (2 pi)"                  "Planck's constant" ) ;; Exact
     ( mu0     "4 pi 10^(-7) H/m"            "Permeability of vacuum") ;; Exact
+    ( μ0      "mu0"                         "Permeability of vacuum") ;; Exact
     ( eps0    "1 / (mu0 c^2)"               "Permittivity of vacuum" )
+    ( ε0      "eps0"                        "Permittivity of vacuum" )
     ( G       "6.67428*10^(-11) m^3/(kg s^2)"    "Gravitational constant" nil
               "6.67428 10^-11 m^3/(kg s^2) (*)")
     ( Nav     "6.02214179*10^(23) / mol"    "Avogadro's constant" nil
               "1.674927211 10^-27 kg (*)")
     ( mmu     "1.88353130*10^(-28) kg"      "Muon rest mass" nil
               "1.88353130 10^-28 kg (*)")
+    ( mμ      "mmu"                         "Muon rest mass" nil
+              "1.88353130 10^-28 kg (*)")
     ( Ryd     "10973731.568527 /m"          "Rydberg's constant" nil
               "10973731.568527 /m (*)")
     ( k       "1.3806504*10^(-23) J/K"      "Boltzmann's constant" nil
               "1.3806504 10^-23 J/K (*)")
     ( alpha   "7.2973525376*10^(-3)"        "Fine structure constant" nil
               "7.2973525376 10^-3 (*)")
+    ( α       "alpha"                        "Fine structure constant" nil
+              "7.2973525376 10^-3 (*)")
     ( muB     "927.400915*10^(-26) J/T"     "Bohr magneton" nil
               "927.400915 10^-26 J/T (*)")
     ( muN     "5.05078324*10^(-27) J/T"     "Nuclear magneton" nil
@@ -316,6 +323,7 @@ that the combined units table will be rebuilt.")
      ( ?c  (^ 10 -2)  "Centi"  )
      ( ?m  (^ 10 -3)  "Milli"  )
      ( ?u  (^ 10 -6)  "Micro"  )
+     ( ?μ  (^ 10 -6)  "Micro"  )
      ( ?n  (^ 10 -9)  "Nano"   )
      ( ?p  (^ 10 -12) "Pico"   )
      ( ?f  (^ 10 -15) "Femto"  )
@@ -581,8 +589,8 @@ If EXPR is nil, return nil."
        (let ((name (or (nth 2 u) (symbol-name (car u)))))
          (if (eq (aref name 0) ?\*)
              (setq name (substring name 1)))
-         (if (string-match "[^a-zA-Z0-9']" name)
-             (if (string-match "^[a-zA-Z0-9' ()]*$" name)
+         (if (string-match "[^a-zA-Zα-ωΑ-Ω0-9']" name)
+             (if (string-match "^[a-zA-Zα-ωΑ-Ω0-9' ()]*$" name)
                  (while (setq pos (string-match "[ ()]" name))
                    (setq name (concat (substring name 0 pos)
                                       (if (eq (aref name pos) 32) "-" "")
@@ -592,7 +600,7 @@ If EXPR is nil, return nil."
              (setq name (concat (nth 2 (assq (aref (symbol-name
                                                     (nth 1 expr)) 0)
                                              math-unit-prefixes))
-                                (if (and (string-match "[^a-zA-Z0-9']" name)
+                                (if (and (string-match "[^a-zA-Zα-ωΑ-Ω0-9']" name)
                                          (not (memq (car u) '(mHg gf))))
                                     (concat "-" name)
                                   (downcase name)))))
@@ -1540,8 +1548,8 @@ If EXPR is nil, return nil."
 
 (provide 'calc-units)
 
-;; Local Variables:
-;; coding: iso-latin-1
+;; Local variables:
+;; coding: utf-8
 ;; End:
 
 ;; arch-tag: e993314f-3adc-4191-be61-4ef8874881c4
index c4de362ab366f2582937369fdc0631d8affb3a95..5b807a55491b84864ffbd017dedf33aef6bbdf00 100644 (file)
      (calc-enter-result 1 "grad" (list 'calcFunc-grade (calc-top-n 1))))))
 
 (defun calc-histogram (n)
-  (interactive "NNumber of bins: ")
+  (interactive "P")
+  (unless (natnump n)
+    (setq n (math-read-expr (read-string "Centers of bins: "))))
   (calc-slow-wrapper
    (if calc-hyperbolic-flag
        (calc-enter-result 2 "hist" (list 'calcFunc-histogram
                                         (calc-top-n 2)
                                         (calc-top-n 1)
-                                        (prefix-numeric-value n)))
+                                        n))
      (calc-enter-result 1 "hist" (list 'calcFunc-histogram
                                       (calc-top-n 1)
-                                      (prefix-numeric-value n))))))
+                                       n)))))
 
 (defun calc-transpose (arg)
   (interactive "P")
   (if (Math-vectorp wts)
       (or (= (length vec) (length wts))
          (math-dimension-error)))
-  (or (natnump n)
-      (math-reject-arg n 'fixnatnump))
-  (let ((res (make-vector n 0))
-       (vp vec)
-       (wvec (Math-vectorp wts))
-       (wp wts)
-       bin)
-    (while (setq vp (cdr vp))
-      (setq bin (car vp))
-      (or (natnump bin)
-         (setq bin (math-floor bin)))
-      (and (natnump bin)
-          (< bin n)
-          (aset res bin (math-add (aref res bin)
-                                  (if wvec (car (setq wp (cdr wp))) wts)))))
-    (cons 'vec (append res nil))))
+  (cond ((natnump n)
+         (let ((res (make-vector n 0))
+               (vp vec)
+               (wvec (Math-vectorp wts))
+               (wp wts)
+               bin)
+           (while (setq vp (cdr vp))
+             (setq bin (car vp))
+             (or (natnump bin)
+                 (setq bin (math-floor bin)))
+            (and (natnump bin)
+                 (< bin n)
+                 (aset res bin 
+                       (math-add (aref res bin)
+                                 (if wvec (car (setq wp (cdr wp))) wts)))))
+           (cons 'vec (append res nil))))
+        ((Math-vectorp n) ;; n is a vector of midpoints
+         (let* ((bds (math-vector-avg n))
+                (res (make-vector (1- (length n)) 0))
+                (vp (cdr vec))
+                (wvec (Math-vectorp wts))
+                (wp wts)
+                num)
+           (while vp
+             (setq num (car vp))
+             (let ((tbds (cdr bds))
+                   (i 0))
+               (while (and tbds (Math-lessp (car tbds) num))
+                 (setq i (1+ i))
+                 (setq tbds (cdr tbds)))
+               (aset res i 
+                     (math-add (aref res i)
+                               (if wvec (car (setq wp (cdr wp))) wts))))
+             (setq vp (cdr vp)))
+           (cons 'vec (append res nil))))
+        (t
+         (math-reject-arg n "*Expecting an integer or vector"))))
+
+;;; Replace a vector [a b c ...] with a vector of averages
+;;; [(a+b)/2 (b+c)/2 ...]
+(defun math-vector-avg (vec)
+  (let ((vp (sort (copy-sequence (cdr vec)) 'math-beforep))
+        (res nil))
+    (while (and vp (cdr vp))
+      (setq res (cons (math-div (math-add (car vp) (cadr vp)) 2) res)
+            vp (cdr vp)))
+    (cons 'vec (reverse res))))
 
 
 ;;; Set operations.
index 2a6ec97ef5cba3f8132b6639496b6665c283b438..e0560465a99096a6ef87bbb9e3aabf2737f06611 100644 (file)
@@ -419,12 +419,33 @@ in normal mode."
   :group 'calc
   :type 'boolean)
 
-(defcustom calc-undo-length 
+(defcustom calc-undo-length
   100
   "The number of undo steps that will be preserved when Calc is quit."
   :group 'calc
   :type 'integer)
 
+(defcustom calc-highlight-selections-with-faces
+  nil
+  "If non-nil, use a separate face to indicate selected sub-formulas.
+If `calc-show-selections' is non-nil, then selected sub-formulas are shown
+by displaying the rest of the formula in `calc-nonselected-face'.  
+If `calc-show-selections' is nil, then selected sub-formulas are shown
+by displaying the sub-formula in `calc-selected-face'."
+  :group 'calc
+  :type 'boolean)
+
+(defface calc-nonselected-face
+  '((t :inherit shadow       
+       :slant italic))
+  "Face used to show the non-selected portion of a formula."
+  :group 'calc)
+
+(defface calc-selected-face
+  '((t :weight bold))
+  "Face used to show the selected portion of a formula."
+  :group 'calc)
+
 (defvar calc-bug-address "jay.p.belanger@gmail.com"
   "Address of the maintainer of Calc, for use by `report-calc-bug'.")
 
@@ -797,6 +818,7 @@ Used by `calc-user-invocation'.")
                                calc-matrix-mode
                                calc-inverse-flag
                                calc-hyperbolic-flag
+                                calc-option-flag
                                calc-keep-args-flag
                                calc-angle-mode
                                calc-number-radix
@@ -926,6 +948,8 @@ Used by `calc-user-invocation'.")
   "If non-nil, next operation is Inverse.")
 (defvar calc-hyperbolic-flag nil
   "If non-nil, next operation is Hyperbolic.")
+(defvar calc-option-flag nil
+  "If non-nil, next operation has Optional behavior.")
 (defvar calc-keep-args-flag nil
   "If non-nil, next operation should not remove its arguments from stack.")
 (defvar calc-function-open "("
@@ -996,9 +1020,12 @@ Used by `calc-user-invocation'.")
 (defvar math-working-step-2 nil)
 (defvar var-i '(special-const (math-imaginary 1)))
 (defvar var-pi '(special-const (math-pi)))
+(defvar var-π '(special-const (math-pi)))
 (defvar var-e '(special-const (math-e)))
 (defvar var-phi '(special-const (math-phi)))
+(defvar var-φ '(special-const (math-phi)))
 (defvar var-gamma '(special-const (math-gamma-const)))
+(defvar var-γ '(special-const (math-gamma-const)))
 (defvar var-Modes '(special-const (math-get-modes-vec)))
 
 (mapc (lambda (v) (or (boundp v) (set v nil)))
@@ -1038,7 +1065,7 @@ Used by `calc-user-invocation'.")
     (mapc (lambda (x) (define-key map (char-to-string x) 'undefined))
           "lOW")
     (mapc (lambda (x) (define-key map (char-to-string x) 'calc-missing-key))
-          (concat "ABCDEFGHIJKLMNPQRSTUVXZabcdfghjkmoprstuvwxyz"
+          (concat "ABCDEFGHIJKLMNOPQRSTUVXZabcdfghjkmoprstuvwxyz"
                   ":\\|!()[]<>{},;=~`\C-k\C-w\C-_"))
     (define-key map "\M-w" 'calc-missing-key)
     (define-key map "\M-k" 'calc-missing-key)
@@ -1227,7 +1254,7 @@ the trail buffer."
     ;; Eventually, prompt user with a list of buffers using embedded mode.
     (when (and
            info-list
-           (yes-or-no-p 
+           (yes-or-no-p
             (concat "This Calc stack is being used for embedded mode. Kill anyway?")))
       (while info-list
         (with-current-buffer (car (car info-list))
@@ -1379,8 +1406,7 @@ commands given here will actually operate on the *Calculator* stack."
     (set (make-local-variable 'calc-main-buffer) buf))
   (when (= (buffer-size) 0)
     (let ((buffer-read-only nil))
-      (insert (propertize (concat "Emacs Calculator Trail\n")
-                         'font-lock-face 'italic))))
+      (insert (propertize "Emacs Calculator Trail\n" 'face 'italic))))
   (run-mode-hooks 'calc-trail-mode-hook))
 
 (defun calc-create-buffer ()
@@ -1619,6 +1645,7 @@ See calc-keypad for details."
          (calc-select-buffer)
          (setq calc-inverse-flag nil
                calc-hyperbolic-flag nil
+                calc-option-flag nil
                calc-keep-args-flag nil)))
       (when (memq 'do-edit calc-command-flags)
        (switch-to-buffer (get-buffer-create "*Calc Edit*")))
@@ -1757,6 +1784,7 @@ See calc-keypad for details."
                              (> (calc-stack-size) 0)
                              (calc-top 1 'sel)) "Sel " "")
                     (if calc-display-dirty "Dirty " "")
+                     (if calc-option-flag "Opt " "")
                     (if calc-inverse-flag "Inv " "")
                     (if calc-hyperbolic-flag "Hyp " "")
                     (if calc-keep-args-flag "Keep " "")
@@ -1968,7 +1996,7 @@ See calc-keypad for details."
         (erase-buffer)
         (when calc-show-banner
           (insert (propertize "--- Emacs Calculator Mode ---\n"
-                              'font-lock-face 'italic)))
+                              'face 'italic)))
         (while thing
           (goto-char (point-min))
           (when calc-show-banner
@@ -2378,7 +2406,7 @@ See calc-keypad for details."
            (progn
              (require 'calc-ext)
              (calc-digit-dots))
-         (delete-backward-char 1)
+         (delete-char -1)
          (beep)
          (calc-temp-minibuffer-message " [Bad format]"))))))
   (setq calc-prev-prev-char calc-prev-char
@@ -3401,7 +3429,7 @@ largest Emacs integer.")
                   (Math-lessp a math-half-2-word-size))
              (and (Math-integer-negp a)
                   (require 'calc-ext)
-                  (let ((comparison 
+                  (let ((comparison
                          (math-compare (Math-integer-neg a) math-half-2-word-size)))
                     (or (= comparison 0)
                         (= comparison -1))))))
@@ -3545,7 +3573,7 @@ largest Emacs integer.")
   (math-normalize
    (save-match-data
      (cond
-      
+
       ;; Integers (most common case)
       ((string-match "\\` *\\([0-9]+\\) *\\'" s)
        (let ((digs (math-match-substring s 1)))
@@ -3557,22 +3585,22 @@ largest Emacs integer.")
            (if (<= (length digs) (* 2 math-bignum-digit-length))
                (string-to-number digs)
              (cons 'bigpos (math-read-bignum digs))))))
-      
+
       ;; Clean up the string if necessary
       ((string-match "\\`\\(.*\\)[ \t\n]+\\([^\001]*\\)\\'" s)
        (math-read-number (concat (math-match-substring s 1)
                                  (math-match-substring s 2))))
-      
+
       ;; Plus and minus signs
       ((string-match "^[-_+]\\(.*\\)$" s)
        (let ((val (math-read-number (math-match-substring s 1))))
          (and val (if (eq (aref s 0) ?+) val (math-neg val)))))
-      
+
       ;; Forms that require extensions module
       ((string-match "[^-+0-9eE.]" s)
        (require 'calc-ext)
        (math-read-number-fancy s))
-      
+
       ;; Decimal point
       ((string-match "^\\([0-9]*\\)\\.\\([0-9]*\\)$" s)
        (let ((int (math-match-substring s 1))
@@ -3585,7 +3613,7 @@ largest Emacs integer.")
                   (list 'float
                         (math-add (math-scale-int int flen) frac)
                         (- flen)))))))
-      
+
       ;; "e" notation
       ((string-match "^\\(.*\\)[eE]\\([-+]?[0-9]+\\)$" s)
        (let ((mant (math-match-substring s 1))
@@ -3596,7 +3624,7 @@ largest Emacs integer.")
            (and mant exp (Math-realp mant) (> exp -4000000) (< exp 4000000)
                 (let ((mant (math-float mant)))
                   (list 'float (nth 1 mant) (+ (nth 2 mant) exp)))))))
-      
+
       ;; Syntax error!
       (t nil)))))
 
@@ -3789,7 +3817,7 @@ See Info node `(calc)Defining Functions'."
       (setq unread-command-event nil)
     (setq unread-command-events nil)))
 
-(defcalcmodevar math-2-word-size 
+(defcalcmodevar math-2-word-size
   (math-read-number-simple "4294967296")
   "Two to the power of `calc-word-size'.")
 
@@ -3806,5 +3834,9 @@ See Info node `(calc)Defining Functions'."
 
 (provide 'calc)
 
+;; Local variables:
+;; coding: utf-8
+;; End:
+
 ;; arch-tag: 0c3b170c-4ce6-4eaf-8d9b-5834d1fe938f
 ;;; calc.el ends here
index c7d3469abe0f7648bb6060761c175284bfe5b9da..6923cd7693a2b3c6fb0cefccf3760932730f6761 100644 (file)
@@ -1,7 +1,7 @@
 ;;; calccomp.el --- composition functions for Calc
 
-;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2002, 2003, 2004, 2005,
+;;   2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
 ;; Maintainer: Jay Belanger <jay.p.belanger@gmail.com>
 ;;;
 ;;;    (tag X C)             Composition C corresponds to sub-expression X
 
-;; math-comp-just and math-comp-comma-spc are local to 
-;; math-compose-expr, but are used by math-compose-matrix, which is 
+;; math-comp-just and math-comp-comma-spc are local to
+;; math-compose-expr, but are used by math-compose-matrix, which is
 ;; called by math-compose-expr
 (defvar math-comp-just)
 (defvar math-comp-comma-spc)
 
-;; math-comp-vector-prec is local to math-compose-expr, but is used by 
-;; math-compose-matrix and math-compose-rows, which are called by 
+;; math-comp-vector-prec is local to math-compose-expr, but is used by
+;; math-compose-matrix and math-compose-rows, which are called by
 ;; math-compose-expr.
 (defvar math-comp-vector-prec)
 
-;; math-comp-left-bracket, math-comp-right-bracket and math-comp-comma are 
-;; local to math-compose-expr, but are used by math-compose-rows, which is 
+;; math-comp-left-bracket, math-comp-right-bracket and math-comp-comma are
+;; local to math-compose-expr, but are used by math-compose-rows, which is
 ;; called by math-compose-expr.
 (defvar math-comp-left-bracket)
 (defvar math-comp-right-bracket)
        (list 'tag a (math-compose-expr a prec))))
      ((and (not (consp a)) (not (integerp a)))
       (concat "'" (prin1-to-string a)))
-     ((setq spfn (assq (car-safe a) 
+     ((setq spfn (assq (car-safe a)
                        (get calc-language 'math-special-function-table)))
       (setq spfn (cdr spfn))
       (if (consp spfn)
              (and (nth 1 calc-frac-format) (Math-integerp a)))
          (if (and
                calc-language
-               (not (memq calc-language 
+               (not (memq calc-language
                           '(flat big unform))))
              (let ((aa (math-adjust-fraction a))
                    (calc-frac-format nil))
                (math-compose-expr (list '/
-                                        (if (memq calc-language 
+                                        (if (memq calc-language
                                                    calc-lang-slash-idiv)
                                             (math-float (nth 1 aa))
                                           (nth 1 aa))
                                            (cdr a)
                                            (if full rows 3) t)))))
              (if (or calc-full-vectors (< (length a) 7))
-                  (if (and 
+                  (if (and
                        (setq spfn (get calc-language 'math-matrix-formatter))
                        (math-matrixp a))
                       (funcall spfn a)
                     (list 'horiz
                           math-comp-left-bracket
-                          (math-compose-vector (cdr a) 
+                          (math-compose-vector (cdr a)
                                                (concat math-comp-comma " ")
                                                math-comp-vector-prec)
                           math-comp-right-bracket))
                (list 'horiz
                      math-comp-left-bracket
                      (math-compose-vector (list (nth 1 a) (nth 2 a) (nth 3 a))
-                                          (concat math-comp-comma " ") 
+                                          (concat math-comp-comma " ")
                                            math-comp-vector-prec)
-                     math-comp-comma 
+                     math-comp-comma
                       (if (setq spfn (get calc-language 'math-dots))
                           (concat " " spfn)
                         " ...")
                              (and prevc nextc
                                   (or (and (>= nextc ?a) (<= nextc ?z))
                                       (and (>= nextc ?A) (<= nextc ?Z))
+                                      (and (>= nextc ?α) (<= nextc ?ω))
+                                      (and (>= nextc ?Α) (<= nextc ?Ω))
                                       (and (>= nextc ?0) (<= nextc ?9))
                                       (memq nextc '(?. ?_ ?#
                                                        ?\( ?\[ ?\{))
                                (not (math-tex-expr-is-flat (nth 1 a))))))
                   (list 'horiz
                         (if lr "\\left" "")
-                        (if (string-match "\\`u\\([^a-zA-Z]\\)\\'" (car op))
+                        (if (string-match "\\`u\\([^a-zA-Zα-ωΑ-Ω]\\)\\'" (car op))
                             (substring (car op) 1)
                           (car op))
                         (if (or lr (> (length (car op)) 2)) " " "")
                (t
                 (let ((rhs (math-compose-expr (nth 1 a) (nth 3 op))))
                   (list 'horiz
-                        (let ((ops (if (string-match "\\`u\\([^a-zA-Z]\\)\\'"
+                        (let ((ops (if (string-match "\\`u\\([^a-zA-Zα-ωΑ-Ω]\\)\\'"
                                                      (car op))
                                        (substring (car op) 1)
                                      (car op))))
                     (setq func (car func2)))
                 (setq func (math-remove-dashes
                             (if (string-match
-                                 "\\`calcFunc-\\([a-zA-Z0-9']+\\)\\'"
+                                 "\\`calcFunc-\\([a-zA-Zα-ωΑ-Ω0-9']+\\)\\'"
                                  (symbol-name func))
                                 (math-match-substring (symbol-name func) 1)
                               (symbol-name func))))
                                                    math-comp-vector-prec)
                                                   (if (= col cols)
                                                       ""
-                                                    (concat 
+                                                    (concat
                                                       math-comp-comma-spc " ")))))
                                          a)))
                      res)))
       (if (<= count 0)
          (if (< count 0)
              (math-compose-rows (cdr a) -1 nil)
-           (cons (concat 
+           (cons (concat
                    (let ((mdots (get calc-language 'math-dots)))
                      (if mdots
                          (concat " " mdots)
               (if (memq prec '(196 201)) ")" "")))))
 
 ;; The variables math-svo-c, math-svo-wid and math-svo-off are local
-;; to math-stack-value-offset in calc.el, but are used by 
+;; to math-stack-value-offset in calc.el, but are used by
 ;; math-stack-value-offset-fancy, which is called by math-stack-value-offset..
 (defvar math-svo-c)
 (defvar math-svo-wid)
 ;;; of the formula.
 
 ;; The variables math-comp-full-width, math-comp-highlight, math-comp-word,
-;; math-comp-level, math-comp-margin and math-comp-buf are local to 
-;; math-comp-to-string-flat, but are used by math-comp-to-string-flat-term, 
+;; math-comp-level, math-comp-margin and math-comp-buf are local to
+;; math-comp-to-string-flat, but are used by math-comp-to-string-flat-term,
 ;; which is called by math-comp-to-string-flat.
-;; math-comp-highlight and math-comp-buf are also local to 
-;; math-comp-simplify-term and math-comp-simplify respectively, but are used 
+;; math-comp-highlight and math-comp-buf are also local to
+;; math-comp-simplify-term and math-comp-simplify respectively, but are used
 ;; by math-comp-add-string.
 (defvar math-comp-full-width)
 (defvar math-comp-highlight)
   (cond ((not (consp c))
         (if math-comp-highlight
             (setq c (math-comp-highlight-string c)))
-        (setq math-comp-word (if (= (length math-comp-word) 0) c 
+        (setq math-comp-word (if (= (length math-comp-word) 0) c
                                 (concat math-comp-word c))
               math-comp-pos (+ math-comp-pos (length c))))
 
 
 (defun math-comp-highlight-string (s)
   (setq s (copy-sequence s))
-  (let ((i (length s)))
-    (while (>= (setq i (1- i)) 0)
-      (or (memq (aref s i) '(32 ?\n))
-         (aset s i (if calc-show-selections ?\. ?\#)))))
-  s)
-
+  (if calc-highlight-selections-with-faces
+      (if (not calc-show-selections)
+          (propertize s 'face 'calc-selected-face)
+        (propertize s 'face 'calc-nonselected-face))
+    (let ((i (length s)))
+      (while (>= (setq i (1- i)) 0)
+        (or (memq (aref s i) '(32 ?\n))
+            (aset s i (if calc-show-selections ?\. ?\#)))))
+    s))
 
 ;; The variable math-comp-sel-tag is local to calc-find-selected-part
-;; in calc-sel.el, but is used by math-comp-sel-flat-term and 
-;; math-comp-add-string-sel, which are called (indirectly) by 
+;; in calc-sel.el, but is used by math-comp-sel-flat-term and
+;; math-comp-add-string-sel, which are called (indirectly) by
 ;; calc-find-selected-part.
 (defvar math-comp-sel-tag)
 
 
 (provide 'calccomp)
 
+;; Local variables:
+;; coding: utf-8
+;; End:
+
 ;; arch-tag: 7c45d10a-a286-4dab-af49-7ae8989fbf78
 ;;; calccomp.el ends here
index d1b9b517e5fe38765b5c01bd2eea49d27ea6d9df..a20efdbc12264d3b71f234870d60afde373933d9 100644 (file)
@@ -54,7 +54,7 @@
   :prefix "calculator"
   :version "21.1"
   :group 'tools
-  :group 'convenience)
+  :group 'applications)
 
 (defcustom calculator-electric-mode nil
   "Run `calculator' electrically, in the echo area.
diff --git a/lisp/calendar/.arch-inventory b/lisp/calendar/.arch-inventory
deleted file mode 100644 (file)
index c709748..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-# Auto-generated lisp files, which ignore
-precious ^(.*-loaddefs)\.el$
-
-# arch-tag: 6246cac0-cd69-4d59-8677-c1451a4d5831
index 7fcaab9da34cc2df658b3baf22541fb7966ab03d..ad36531bb4083607690c93615191f025426645e0 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Neil Mager <neilm@juliet.ll.mit.edu>
 ;; Maintainer: Glenn Morris <rgm@gnu.org>
 ;; Keywords: calendar
+;; Package: calendar
 
 ;; This file is part of GNU Emacs.
 
index 7270d423409c1339960d3d27626e72c690b1b773..7b8f61a7a8416057671f12f602da8f0bf8617ab4 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: John Wiegley <johnw@gnu.org>
 ;; Keywords: calendar
 ;; Human-Keywords: Bahá'í calendar, Bahá'í, Baha'i, Bahai, calendar, diary
+;; Package: calendar
 
 ;; This file is part of GNU Emacs.
 
index f9946c18045d80ce9e8dd4653faaf1e29c8c3cc7..0fc63e7eaaccaa6ab90b17df707c8ab22a20e4b9 100644 (file)
@@ -7,6 +7,7 @@
 ;; Maintainer: Glenn Morris <rgm@gnu.org>
 ;; Keywords: calendar
 ;; Human-Keywords: Chinese calendar, calendar, holidays, diary
+;; Package: calendar
 
 ;; This file is part of GNU Emacs.
 
index 16cc6672727986ab011dfc4284462995ebf52563..69612edab38ccd37db3f7b2f6f553de4f47b0a16 100644 (file)
@@ -7,6 +7,7 @@
 ;; Maintainer: Glenn Morris <rgm@gnu.org>
 ;; Keywords: calendar
 ;; Human-Keywords: Coptic calendar, Ethiopic calendar, calendar, diary
+;; Package: calendar
 
 ;; This file is part of GNU Emacs.
 
index c541caa5696d1bc0bbb9059f41b094718d87ae5c..d27bc8480a7b1fe9757628430badb1b33a2ff2a8 100644 (file)
@@ -8,6 +8,7 @@
 ;; Maintainer: Glenn Morris <rgm@gnu.org>
 ;; Keywords: calendar
 ;; Human-Keywords: daylight saving time, calendar, diary, holidays
+;; Package: calendar
 
 ;; This file is part of GNU Emacs.
 
index 1ee290f5aa95c1636a1d765382332a3d53f8149b..98a118f232f2281e58b86ce42a8b6fccf46c11be 100644 (file)
@@ -1,12 +1,14 @@
 ;;; cal-french.el --- calendar functions for the French Revolutionary calendar
 
 ;; Copyright (C) 1988, 1989, 1992, 1994, 1995, 1997, 2001, 2002, 2003,
-;;   2004, 2005, 2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
+;;   2004, 2005, 2006, 2007, 2008, 2009, 2010
+;;   Free Software Foundation, Inc.
 
 ;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
 ;; Maintainer: Glenn Morris <rgm@gnu.org>
 ;; Keywords: calendar
 ;; Human-Keywords: French Revolutionary calendar, calendar, diary
+;; Package: calendar
 
 ;; This file is part of GNU Emacs.
 
@@ -40,8 +42,8 @@
   "Array of month names in the French calendar.")
 
 (defconst calendar-french-multibyte-month-name-array
-  ["Vendémiaire" "Brumaire" "Frimaire" "Nivôse" "Pluviôse" "Ventôse"
-   "Germinal" "Floréal" "Prairial" "Messidor" "Thermidor" "Fructidor"]
+  ["Vendémiaire" "Brumaire" "Frimaire" "Nivôse" "Pluviôse" "Ventôse"
+   "Germinal" "Floréal" "Prairial" "Messidor" "Thermidor" "Fructidor"]
   "Array of multibyte month names in the French calendar.")
 
 (defconst calendar-french-day-name-array
@@ -55,8 +57,8 @@
   "Array of special day names in the French calendar.")
 
 (defconst calendar-french-multibyte-special-days-array
-  ["de la Vertu" "du Génie" "du Travail" "de la Raison" "des Récompenses"
-   "de la Révolution"]
+  ["de la Vertu" "du Génie" "du Travail" "de la Raison" "des Récompenses"
+   "de la Révolution"]
   "Array of multibyte special day names in the French calendar.")
 
 (defun calendar-french-accents-p ()
@@ -174,13 +176,13 @@ Defaults to today's date if DATE is not given."
     (cond
      ((< y 1) "")
      ((= m 13) (format (if (calendar-french-accents-p)
-                           "Jour %s de l'Année %d de la Révolution"
+                           "Jour %s de l'Année %d de la Révolution"
                          "Jour %s de l'Anne'e %d de la Re'volution")
                        (aref (calendar-french-special-days-array) (1- d))
                        y))
      (t (format
          (if (calendar-french-accents-p)
-             "%d %s an %d de la Révolution"
+             "%d %s an %d de la Révolution"
            "%d %s an %d de la Re'volution")
          d
          (aref (calendar-french-month-name-array) (1- m))
@@ -208,7 +210,7 @@ Echo French Revolutionary date unless NOECHO is non-nil."
           (year (progn
                   (calendar-read
                    (if (calendar-french-accents-p)
-                       "Année de la Révolution (>0): "
+                       "Année de la Révolution (>0): "
                      "Anne'e de la Re'volution (>0): ")
                    (lambda (x) (> x 0))
                    (number-to-string
@@ -264,5 +266,9 @@ Echo French Revolutionary date unless NOECHO is non-nil."
 
 (provide 'cal-french)
 
+;; Local Variables:
+;; coding: utf-8
+;; End:
+
 ;; arch-tag: 7e8045a3-8609-46b5-9cde-cf40ce541cf9
 ;;; cal-french.el ends here
index 2a7556ff322c83262772b611cce552e7ee7ed995..98c1a29df7c66832e008cfd0f7499f809486ab56 100644 (file)
@@ -8,6 +8,7 @@
 ;; Maintainer: Glenn Morris <rgm@gnu.org>
 ;; Keywords: calendar
 ;; Human-Keywords: Hebrew calendar, calendar, diary
+;; Package: calendar
 
 ;; This file is part of GNU Emacs.
 
index 33066b201bfffb16ec2da658c8c5ffc294dc509b..d4210027600b1cf702752f8f605a5b2400e4d877 100644 (file)
@@ -7,6 +7,7 @@
 ;; Keywords: calendar
 ;; Human-Keywords: calendar, diary, HTML
 ;; Created: 23 Aug 2002
+;; Package: calendar
 
 ;; This file is part of GNU Emacs.
 
index 1c09f1db113e3206bbbf324ae1a8277314021c56..da631a9710a52c3afb7677e54a38d6459fd26fa6 100644 (file)
@@ -7,6 +7,7 @@
 ;; Maintainer: Glenn Morris <rgm@gnu.org>
 ;; Keywords: calendar
 ;; Human-Keywords: Islamic calendar, calendar, diary
+;; Package: calendar
 
 ;; This file is part of GNU Emacs.
 
index 0762860b0bad44d175f3160350248a24fff8cd1f..3c5055defb6de085ed3243d33b0a1110466380e4 100644 (file)
@@ -7,6 +7,7 @@
 ;; Maintainer: Glenn Morris <rgm@gnu.org>
 ;; Keywords: calendar
 ;; Human-Keywords: ISO calendar, calendar, diary
+;; Package: calendar
 
 ;; This file is part of GNU Emacs.
 
index d1cea19be4003b479f97dce743b507f05457ae87..0cf9388a4b02cb040c47d6de2cba9dc6daf24dbc 100644 (file)
@@ -7,6 +7,7 @@
 ;; Maintainer: Glenn Morris <rgm@gnu.org>
 ;; Keywords: calendar
 ;; Human-Keywords: Julian calendar, Julian day number, calendar, diary
+;; Package: calendar
 
 ;; This file is part of GNU Emacs.
 
index de079b122c7b3938ac797d25f5dd9eaad02b5c21..d2e4810fa82fb4446a3d149d17f8db756444fa3e 100644 (file)
@@ -8,6 +8,7 @@
 ;; Maintainer: Glenn Morris <rgm@gnu.org>
 ;; Keywords: calendar
 ;; Human-Keywords: Mayan calendar, Maya, calendar, diary
+;; Package: calendar
 
 ;; This file is part of GNU Emacs.
 
index 521cd2dce2d0459e0322d8dcd45f0a0bbe419b8f..877be9556fb87fbd85c6158749ebe2f4f3df798c 100644 (file)
@@ -8,6 +8,7 @@
 ;; Maintainer: Glenn Morris <rgm@gnu.org>
 ;; Keywords: calendar
 ;; Human-Keywords: calendar, popup menus, menu bar
+;; Package: calendar
 
 ;; This file is part of GNU Emacs.
 
index 89e45bef779d38fdf8fbf79f0b93ac106d20be3b..e569e8c424ca8769f3103adedd9c70f4da1933ad 100644 (file)
@@ -7,6 +7,7 @@
 ;; Maintainer: Glenn Morris <rgm@gnu.org>
 ;; Keywords: calendar
 ;; Human-Keywords: calendar
+;; Package: calendar
 
 ;; This file is part of GNU Emacs.
 
index 95ae2f165bb1ea3395b8b7fc654c9c2ebbd6c233..5c624ddcf01eb17ff4d8026c61731f408c4b1d58 100644 (file)
@@ -7,6 +7,7 @@
 ;; Maintainer: Glenn Morris <rgm@gnu.org>
 ;; Keywords: calendar
 ;; Human-Keywords: Persian calendar, calendar, diary
+;; Package: calendar
 
 ;; This file is part of GNU Emacs.
 
index 46fb0869787fdcf477cc15e4cffd41232fffd4e1..e6ba1ad343977d765dd1993116e9f14cf7f23d58 100644 (file)
@@ -8,6 +8,7 @@
 ;; Maintainer: Glenn Morris <rgm@gnu.org>
 ;; Keywords: calendar
 ;; Human-Keywords: Calendar, LaTeX
+;; Package: calendar
 
 ;; This file is part of GNU Emacs.
 
index 90a4c5d33b8489d2f43160f705ce7ae4acc3a279..377646147b9172799265ba84a8546b6fae2b277a 100644 (file)
@@ -8,6 +8,7 @@
 ;; Maintainer: Glenn Morris <rgm@gnu.org>
 ;; Keywords: calendar
 ;; Human-Keywords: calendar, dedicated frames
+;; Package: calendar
 
 ;; This file is part of GNU Emacs.
 
index 0cafc85a24b4a54edcd48534200393a775b43f70..af61fdf149e312a13134927fa4d9363d888bf25a 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
 ;; Maintainer: Glenn Morris <rgm@gnu.org>
 ;; Keywords: holidays, calendar
+;; Package: calendar
 
 ;; This file is part of GNU Emacs.
 
index a07402aa0315aa07173734ee92ad11176a89cfff..0be138906b6474a6b73457339f1a2849a75d3d26 100644 (file)
@@ -7,6 +7,7 @@
 ;; Created:        August 2002
 ;; Keywords:       calendar
 ;; Human-Keywords: calendar, diary, iCalendar, vCalendar
+;; Version:        0.19
 
 ;; This file is part of GNU Emacs.
 
@@ -212,15 +213,15 @@ if nil they are ignored."
 
 (defcustom icalendar-uid-format
   "emacs%t%c"
-  "Format of unique ID code (UID) for each iCalendar object.  
-The following specifiers are available: 
+  "Format of unique ID code (UID) for each iCalendar object.
+The following specifiers are available:
 %c COUNTER, an integer value that is increased each time a uid is
-   generated. This may be necessary for systems which do not
+   generated.  This may be necessary for systems which do not
    provide time-resolution finer than a second.
 %h HASH, a hash value of the diary entry,
 %s DTSTART, the start date (excluding time) of the diary entry,
 %t TIMESTAMP, a unique creation timestamp,
-%u USERNAME, the user-login-name.
+%u USERNAME, the variable `user-login-name'.
 
 For example, a value of \"%s_%h@mydomain.com\" will generate a
 UID code for each entry composed of the time of the event, a hash
@@ -427,7 +428,7 @@ children."
         (goto-char (point-min))
         (while
             (re-search-forward
-             "\\([A-Za-z0-9-]+\\)=\\(\\([^;,:]+\\)\\|\"\\([^\"]+\\)\"\\);?"
+             "\\([A-Za-z0-9-]+\\)=\\(\\([^;:]+\\)\\|\"\\([^\"]+\\)\"\\);?"
              nil t)
           (setq param-name (intern (match-string 1)))
           (setq param-value (match-string 2))
@@ -744,6 +745,20 @@ Note that this silently ignores seconds."
     ;; Error:
     -1))
 
+(defun icalendar--get-weekday-numbers (abbrevweekdays)
+  "Return the list of numbers for the comma-separated ABBREVWEEKDAYS."
+  (when abbrevweekdays
+    (let* ((num -1)
+           (weekday-alist (mapcar (lambda (day)
+                                    (progn
+                                      (setq num (1+ num))
+                                      (cons (downcase day) num)))
+                                  icalendar--weekday-array)))
+      (delq nil
+            (mapcar (lambda (abbrevday)
+                      (cdr (assoc abbrevday weekday-alist)))
+                    (split-string (downcase abbrevweekdays) ","))))))
+
 (defun icalendar--get-weekday-abbrev (weekday)
   "Return the abbreviated WEEKDAY."
   (catch 'found
@@ -912,21 +927,21 @@ current iCalendar object, as a string.  Increase
 `icalendar--uid-count'.  Returns the UID string."
   (let ((uid icalendar-uid-format))
     
-    (setq uid (replace-regexp-in-string 
-              "%c" 
+    (setq uid (replace-regexp-in-string
+              "%c"
               (format "%d" icalendar--uid-count)
                uid t t))
     (setq icalendar--uid-count (1+ icalendar--uid-count))
-    (setq uid (replace-regexp-in-string 
+    (setq uid (replace-regexp-in-string
               "%t"
               (format "%d%d%d" (car (current-time))
                       (cadr (current-time))
-                      (car (cddr (current-time)))) 
+                      (car (cddr (current-time))))
               uid t t))
-    (setq uid (replace-regexp-in-string 
-              "%h" 
+    (setq uid (replace-regexp-in-string
+              "%h"
               (format "%d" (abs (sxhash entry-full))) uid t t))
-    (setq uid (replace-regexp-in-string 
+    (setq uid (replace-regexp-in-string
               "%u" (or user-login-name "UNKNOWN_USER") uid t t))
     (let ((dtstart (if (string-match "^DTSTART[^:]*:\\([0-9]*\\)" contents)
                        (substring contents (match-beginning 1) (match-end 1))
@@ -1008,7 +1023,7 @@ FExport diary data into iCalendar file: ")
                 (if url
                     (setq contents (concat contents "\nURL:" url))))
 
-             (setq header (concat "\nBEGIN:VEVENT\nUID:" 
+             (setq header (concat "\nBEGIN:VEVENT\nUID:"
                                   (icalendar--create-uid entry-full contents)))
               (setq result (concat result header contents "\nEND:VEVENT")))
           ;; handle errors
@@ -1126,7 +1141,7 @@ Returns an alist."
                (list "%u"
                      (concat "\\(" icalendar-import-format-url "\\)??"))))
        ;; Need the \' regexp in order to detect multi-line items
-        (setq s (concat "\\`" 
+        (setq s (concat "\\`"
                           (icalendar--rris "%s" "\\(.*?\\)" s nil t)
                         "\\'"))
         (if (string-match s summary-and-rest)
@@ -2057,39 +2072,48 @@ END-T is the event's end time in diary format."
           ))
       )
     (cond ((string-equal frequency "WEEKLY")
-           (if (not start-t)
-               (progn
-                 ;; weekly and all-day
-                 (icalendar--dmsg "weekly all-day")
-                 (if until
-                     (setq result
-                           (format
-                            (concat "%%%%(and "
-                                    "(diary-cyclic %d %s) "
-                                    "(diary-block %s %s))")
-                            (* interval 7)
-                            dtstart-conv
-                            dtstart-conv
-                            (if count until-1-conv until-conv)
-                            ))
-                   (setq result
-                         (format "%%%%(and (diary-cyclic %d %s))"
-                                 (* interval 7)
-                                 dtstart-conv))))
-             ;; weekly and not all-day
-             (let* ((byday (cadr (assoc 'BYDAY rrule-props)))
-                    (weekday
-                     (icalendar--get-weekday-number byday)))
+          (let* ((byday (cadr (assoc 'BYDAY rrule-props)))
+                 (weekdays
+                  (icalendar--get-weekday-numbers byday))
+                 (weekday-clause
+                  (when (> (length weekdays) 1)
+                    (format "(memq (calendar-day-of-week date) '%s) "
+                            weekdays))))
+            (if (not start-t)
+                (progn
+                  ;; weekly and all-day
+                  (icalendar--dmsg "weekly all-day")
+                  (if until
+                      (setq result
+                            (format
+                             (concat "%%%%(and "
+                                     "%s"
+                                     "(diary-block %s %s))")
+                             (or weekday-clause
+                                 (format "(diary-cyclic %d %s) "
+                                         (* interval 7)
+                                         dtstart-conv))
+                             dtstart-conv
+                             (if count until-1-conv until-conv)
+                             ))
+                      (setq result
+                            (format "%%%%(and %s(diary-cyclic %d %s))"
+                                    (or weekday-clause "")
+                                    (if weekday-clause 1 (* interval 7))
+                                    dtstart-conv))))
+               ;; weekly and not all-day
                (icalendar--dmsg "weekly not-all-day")
                (if until
                    (setq result
                          (format
                           (concat "%%%%(and "
-                                  "(diary-cyclic %d %s) "
+                                  "%s"
                                   "(diary-block %s %s)) "
                                   "%s%s%s")
-                          (* interval 7)
-                          dtstart-conv
+                         (or weekday-clause
+                             (format "(diary-cyclic %d %s) "
+                                     (* interval 7)
+                                     dtstart-conv))
                           dtstart-conv
                           until-conv
                           (or start-t "")
@@ -2100,10 +2124,11 @@ END-T is the event's end time in diary format."
                  ;; DTEND;VALUE=DATE-TIME:20030919T113000
                  (setq result
                        (format
-                        "%%%%(and (diary-cyclic %s %s)) %s%s%s"
-                        (* interval 7)
-                        dtstart-conv
-                        (or start-t "")
+                        "%%%%(and %s(diary-cyclic %d %s)) %s%s%s"
+                       (or weekday-clause "")
+                       (if weekday-clause 1 (* interval 7))
+                       dtstart-conv
+                       (or start-t "")
                         (if end-t "-" "") (or end-t "")))))))
           ;; yearly
           ((string-equal frequency "YEARLY")
index 37a68888854a38690ca3be5f0857dcc9dd1bd2f1..58111a036d1070e80b67ba50fe0dc51164642c13 100644 (file)
@@ -7,6 +7,7 @@
 ;; Maintainer: Glenn Morris <rgm@gnu.org>
 ;; Keywords: calendar
 ;; Human-Keywords: moon, lunar phases, calendar, diary
+;; Package: calendar
 
 ;; This file is part of GNU Emacs.
 
index 3d6ab73e778f45c73e351f75c916382cb8f1f6ee..8cf831f99454d6cde2b7b1cbf8d45afc18e3dbd9 100644 (file)
@@ -8,6 +8,7 @@
 ;; Maintainer: Glenn Morris <rgm@gnu.org>
 ;; Keywords: calendar
 ;; Human-Keywords: sunrise, sunset, equinox, solstice, calendar, diary, holidays
+;; Package: calendar
 
 ;; This file is part of GNU Emacs.
 
index 6e8aac171c12a850c7479212b968311c827fb650..8fd41163eaf944c522582c3fd178eaa4526d6c88 100644 (file)
@@ -918,17 +918,9 @@ If INCLUDE-SEP is non-nil, return point after the separator."
 
 ;; As calendar reads .todo-do before todo-mode is loaded.
 ;;;###autoload
-(defun todo-mode ()
-  "Major mode for editing TODO lists.
-
-\\{todo-mode-map}"
-  (interactive)
-  (kill-all-local-variables)
-  (setq major-mode 'todo-mode)
-  (setq mode-name "TODO")
-  (use-local-map todo-mode-map)
-  (easy-menu-add todo-menu)
-  (run-mode-hooks 'todo-mode-hook))
+(define-derived-mode todo-mode nil "TODO"
+  "Major mode for editing TODO lists."
+  (easy-menu-add todo-menu))
 
 (defvar date)
 (defvar entry)
index 53d30bf28197f33ab1223cc23d6d3f97502f002d..1e5974d7d1afa1faccb21a5841f8dd821ef2da16 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Howard Gayle
 ;; Maintainer: FSF
 ;; Keywords: i18n
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
index bff80222f78172d3a098b6f8ab49d36b927ada8f..18cb7071d5c7236b67389e7067ed6a84966ece56 100644 (file)
@@ -3,6 +3,7 @@
 ;;; Copyright (C) 2009, 2010 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
+;; Package: cedet
 
 ;; This file is part of GNU Emacs.
 
index 9dacf062288180255b2b431eee49b9aa67012282..bb7137ddad2219070d47abd856c98f80e6ae2153 100644 (file)
@@ -3,6 +3,7 @@
 ;; Copyright (C) 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <eric@siege-engine.com>
+;; Package: cedet
 
 ;; This file is part of GNU Emacs.
 
index 3a34ca44e2513d7133f5aaf8a1f1d0668b62c06f..b98bd31693501395e46904531bc762067e40949d 100644 (file)
@@ -3,6 +3,7 @@
 ;; Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <eric@siege-engine.com>
+;; Package: cedet
 
 ;; This file is part of GNU Emacs.
 
index 562749dda00a4fa2023024ec5af295fb2ff56278..44c325b78cd14b3f6d97fdea1232a5cf2b7f42cf 100644 (file)
@@ -5,6 +5,7 @@
 ;; Author: Eric M. Ludlam <eric@siege-engine.com>
 ;; Version: 0.2
 ;; Keywords: OO, lisp
+;; Package: cedet
 
 ;; This file is part of GNU Emacs.
 
index b15745aac76e2bf043cd1f97ef4a82e99bb8eb76..6a6d09fda69c5cb985a74df66833587906b1db46 100644 (file)
@@ -5,7 +5,7 @@
 
 ;; Author: David Ponce <david@dponce.com>
 ;; Maintainer: Eric M. Ludlam  <zappo@gnu.org>
-;; Version: 0.2
+;; Version: 1.0pre7
 ;; Keywords: OO, lisp
 
 ;; This file is part of GNU Emacs.
index ed8441d2df032946a3526346df90269e871449ff..f48de002fe3d26aaec1e347c2e21b04a9d50aac8 100644 (file)
@@ -5,6 +5,7 @@
 ;; Author: Eric M. Ludlam  <zappo@gnu.org>
 ;; Version: 0.2
 ;; Keywords: OO, lisp
+;; Package: cedet
 
 ;; This file is part of GNU Emacs.
 
index 46fcdb000f8e21ae68b97c34d349978c4650d3fd..807c7797668c936b77c52d278e9a171a21a522c4 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: project, make
+;; Version: 1.0pre7
 
 ;; This file is part of GNU Emacs.
 
index ede302877237ec51ee41fd6657d642af83bb3d74..827847406155d36dbc4566d6375ba3b95d4e6969 100644 (file)
 ;; This provides a dired interface to EDE, allowing users to modify
 ;; their project file by adding files (or whatever) directly from a
 ;; dired buffer.
-
+(eval-when-compile (require 'cl))
 (require 'easymenu)
 (require 'dired)
 (require 'ede)
 
 ;;; Code:
-(defvar ede-dired-minor-mode nil
-  "Non-nil when in ede dired minor mode.")
-(make-variable-buffer-local 'ede-dired-minor-mode)
-
-(defvar ede-dired-keymap nil
+(defvar ede-dired-keymap
+  (let ((map (make-sparse-keymap)))
+    (define-key map ".a" 'ede-dired-add-to-target)
+    (define-key map ".t" 'ede-new-target)
+    (define-key map ".s" 'ede-speedbar)
+    (define-key map ".C" 'ede-compile-project)
+    (define-key map ".d" 'ede-make-dist)
+
+    (easy-menu-define
+      ede-dired-menu map "EDE Dired Minor Mode Menu"
+      '("Project"
+        [ "Add files to target" ede-dired-add-to-target (ede-current-project) ]
+        ( "Build" :filter ede-build-forms-menu)
+        "-"
+        [ "Create Project" ede-new (not (ede-current-project)) ]
+        [ "Create Target" ede-new-target (ede-current-project) ]
+        "-"
+        ( "Customize Project" :filter ede-customize-forms-menu )
+        [ "View Project Tree" ede-speedbar (ede-current-project) ]
+        ))
+    map)
   "Keymap used for ede dired minor mode.")
 
-(if ede-dired-keymap
-    nil
-  (setq ede-dired-keymap (make-sparse-keymap))
-  (define-key ede-dired-keymap ".a" 'ede-dired-add-to-target)
-  (define-key ede-dired-keymap ".t" 'ede-new-target)
-  (define-key ede-dired-keymap ".s" 'ede-speedbar)
-  (define-key ede-dired-keymap ".C" 'ede-compile-project)
-  (define-key ede-dired-keymap ".d" 'ede-make-dist)
-
-  (easy-menu-define
-   ede-dired-menu ede-dired-keymap "EDE Dired Minor Mode Menu"
-   '("Project"
-     [ "Add files to target" ede-dired-add-to-target (ede-current-project) ]
-     ( "Build" :filter ede-build-forms-menu)
-     "-"
-     [ "Create Project" ede-new (not (ede-current-project)) ]
-     [ "Create Target" ede-new-target (ede-current-project) ]
-     "-"
-     ( "Customize Project" :filter ede-customize-forms-menu )
-     [ "View Project Tree" ede-speedbar (ede-current-project) ]
-     ))
-  )
-
-(defun ede-dired-minor-mode (&optional arg)
+(define-minor-mode ede-dired-minor-mode
   "A minor mode that should only be activated in DIRED buffers.
-If ARG is nil, toggle, if it is a positive number, force on, if
+If ARG is nil or a positive number, force on, if
 negative, force off."
-  (interactive "P")
-  (if (not (or (eq major-mode 'dired-mode)
-              (eq major-mode 'vc-dired-mode)))
-      (error "Not in DIRED mode"))
-  (setq ede-dired-minor-mode
-       (not (or (and (null arg) ede-dired-minor-mode)
-                (<= (prefix-numeric-value arg) 0))))
-  (if (and (not (ede-directory-project-p default-directory))
-          (not (interactive-p)))
-      (setq ede-dired-minor-mode nil))
-  )
+  :lighter " EDE" :keymap ede-dired-keymap
+  (unless (derived-mode-p 'dired-mode)
+    (setq ede-dired-minor-mode nil)
+    (error "Not in DIRED mode"))
+  (unless (or (ede-directory-project-p default-directory)
+              (interactive-p))
+    (setq ede-dired-minor-mode nil)))
 
 (defun ede-dired-add-to-target (target)
   "Add a file, or all marked files into a TARGET."
@@ -85,24 +74,13 @@ negative, force off."
                (let ((ede-object (ede-current-project)))
                  (ede-invoke-method 'project-interactive-select-target
                                     "Add files to Target: "))))
-  (let ((files (dired-get-marked-files t)))
-    (while files
-      (project-add-file target (car files))
-      ;; Find the buffer for this files, and set it's ede-object
-      (if (get-file-buffer (car files))
-         (with-current-buffer (get-file-buffer (car files))
-           (setq ede-object nil)
-           (setq ede-object (ede-buffer-object (current-buffer)))))
-      ;; Increment.
-      (setq files (cdr files)))))
-
-;; Minor mode management.
-(add-to-list 'minor-mode-alist '(ede-dired-minor-mode " EDE"))
-(let ((a (assoc 'ede-dired-minor-mode minor-mode-map-alist)))
-  (if a
-      (setcdr a ede-dired-keymap)
-    (add-to-list 'minor-mode-map-alist (cons 'ede-dired-minor-mode
-                                            ede-dired-keymap))))
+  (dolist (file (dired-get-marked-files t))
+    (project-add-file target file)
+    ;; Find the buffer for this files, and set it's ede-object
+    (if (get-file-buffer file)
+        (with-current-buffer (get-file-buffer file)
+          (setq ede-object nil)
+          (setq ede-object (ede-buffer-object (current-buffer)))))))
 
 (provide 'ede/dired)
 
index e126e4c0175f7247f1706680574d78821cdcd9f9..3eb1f9c21839e976a8cd475cacc6d4c8d492b126 100644 (file)
@@ -402,6 +402,8 @@ Argument COMMAND is the command to use for compiling the target."
          (funcall project-am-debug-target-function cmd))
       (kill-buffer tb))))
 
+(declare-function ede-shell-run-something "ede/shell")
+
 (defmethod project-run-target ((obj project-am-objectcode))
   "Run the current project target in comint buffer."
   (let ((tb (get-buffer-create " *padt*"))
index 14b196bbe2238a9bbfb6238608cd75d2e21b1d23..f5d3f54f205d7f27e12f2de5ad0473dcaf7b1f37 100644 (file)
@@ -4,7 +4,8 @@
 ;;   2008, 2009, 2010  Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
-;; Keywords: syntax
+;; Keywords: syntax tools
+;; Version: 2.0pre7
 
 ;; This file is part of GNU Emacs.
 
@@ -1080,6 +1081,11 @@ Semantic mode.
            (require 'semantic/db-ebrowse)
            (semanticdb-load-ebrowse-caches)))
        (add-hook 'mode-local-init-hook 'semantic-new-buffer-fcn)
+       ;; Add semantic-ia-complete-symbol to
+       ;; completion-at-point-functions, so that it is run from
+       ;; M-TAB.
+       (add-hook 'completion-at-point-functions
+                 'semantic-completion-at-point-function)
        (if global-ede-mode
            (define-key cedet-menu-map [cedet-menu-separator] '("--")))
        (dolist (b (buffer-list))
@@ -1087,6 +1093,8 @@ Semantic mode.
            (semantic-new-buffer-fcn))))
     ;; Disable all Semantic features.
     (remove-hook 'mode-local-init-hook 'semantic-new-buffer-fcn)
+    (remove-hook 'completion-at-point-functions
+                'semantic-completion-at-point-function)
     (define-key cedet-menu-map [cedet-menu-separator] nil)
     (define-key cedet-menu-map [semantic-options-separator] nil)
     ;; FIXME: handle semanticdb-load-ebrowse-caches
@@ -1094,6 +1102,9 @@ Semantic mode.
       (if (and (boundp mode) (eval mode))
          (funcall mode -1)))))
 
+(defun semantic-completion-at-point-function ()
+  'semantic-ia-complete-symbol)
+
 ;;; Autoload some functions that are not in semantic/loaddefs
 
 (autoload 'global-semantic-idle-completions-mode "semantic/idle"
index 1f8b96afe0d514ed691ae5e69121e0906fb9f628..aab87f7eb250a10c3bdc3de7c4245720e01a22aa 100644 (file)
@@ -1761,8 +1761,9 @@ DO NOT return the list of tags encompassing point."
 
       (when (arrayp semantic-lex-spp-project-macro-symbol-obarray)
        (princ "\n  Project symbol map:\n")
-       (princ "      Your project symbol map is derived from the EDE object:\n      ")
-       (princ (object-print ede-object))
+       (when (and (boundp 'ede-object) ede-object)
+         (princ "      Your project symbol map is derived from the EDE object:\n      ")
+         (princ (object-print ede-object)))
        (princ "\n\n")
        (let ((macros nil))
          (mapatoms
index c5dee1676b6e344586d0f90b72ce7392de43ac10..3c7549c6d0c2413f8d0b4d623515dde760fe7035 100644 (file)
@@ -224,46 +224,34 @@ Flush functions from `semantic-decorate-pending-decoration-hook'."
 ;; Generic mode for handling basic highlighting and decorations.
 ;;
 
-(defcustom global-semantic-decoration-mode nil
-  "*If non-nil, enable global use of command `semantic-decoration-mode'.
-When this mode is activated, decorations specified by
-`semantic-decoration-styles'."
-  :group 'semantic
-  :group 'semantic-modes
-  :type 'boolean
-  :require 'semantic/decorate/mode
-  :initialize 'custom-initialize-default
-  :set (lambda (sym val)
-         (global-semantic-decoration-mode (if val 1 -1))))
-
 ;;;###autoload
-(defun global-semantic-decoration-mode (&optional arg)
+(define-minor-mode global-semantic-decoration-mode
   "Toggle global use of option `semantic-decoration-mode'.
 Decoration mode turns on all active decorations as specified
-by `semantic-decoration-styles'.
-If ARG is positive, enable, if it is negative, disable.
-If ARG is nil, then toggle."
-  (interactive "P")
-  (setq global-semantic-decoration-mode
-        (semantic-toggle-minor-mode-globally
-         'semantic-decoration-mode arg)))
+by `semantic-decoration-styles'."
+  :global t :group 'semantic :group 'semantic-modes
+  ;; Not needed because it's autoloaded instead.
+  ;; :require 'semantic/decorate/mode
+  (semantic-toggle-minor-mode-globally
+   'semantic-decoration-mode (if global-semantic-decoration-mode 1 -1)))
 
 (defcustom semantic-decoration-mode-hook nil
   "Hook run at the end of function `semantic-decoration-mode'."
   :group 'semantic
   :type 'hook)
 
-;;;;###autoload
-(defvar semantic-decoration-mode nil
-  "Non-nil if command `semantic-decoration-mode' is enabled.
-Use the command `semantic-decoration-mode' to change this variable.")
-(make-variable-buffer-local 'semantic-decoration-mode)
-
-(defun semantic-decoration-mode-setup ()
-  "Setup the `semantic-decoration-mode' minor mode.
-The minor mode can be turned on only if the semantic feature is available
-and the current buffer was set up for parsing.  Return non-nil if the
+(define-minor-mode semantic-decoration-mode
+  "Minor mode for decorating tags.
+Decorations are specified in `semantic-decoration-styles'.
+You can define new decoration styles with
+`define-semantic-decoration-style'.
+With prefix argument ARG, turn on if positive, otherwise off.  The
+minor mode can be turned on only if semantic feature is available and
+the current buffer was set up for parsing.  Return non-nil if the
 minor mode is enabled."
+;;
+;;\\{semantic-decoration-map}"
+  nil nil nil
   (if semantic-decoration-mode
       (if (not (and (featurep 'semantic) (semantic-active-p)))
           (progn
@@ -280,8 +268,7 @@ minor mode is enabled."
                   'semantic-decorate-tags-after-full-reparse nil t)
         ;; Add decorations to available tags.  The above hooks ensure
         ;; that new tags will be decorated when they become available.
-        (semantic-decorate-add-decorations (semantic-fetch-available-tags))
-        )
+        (semantic-decorate-add-decorations (semantic-fetch-available-tags)))
     ;; Remove decorations from available tags.
     (semantic-decorate-clear-decorations (semantic-fetch-available-tags))
     ;; Cleanup any leftover crap too.
@@ -290,41 +277,10 @@ minor mode is enabled."
     (remove-hook 'semantic-after-partial-cache-change-hook
                  'semantic-decorate-tags-after-partial-reparse t)
     (remove-hook 'semantic-after-toplevel-cache-change-hook
-                 'semantic-decorate-tags-after-full-reparse t)
-    )
-  semantic-decoration-mode)
-
-(defun semantic-decoration-mode (&optional arg)
-  "Minor mode for decorating tags.
-Decorations are specified in `semantic-decoration-styles'.
-You can define new decoration styles with
-`define-semantic-decoration-style'.
-With prefix argument ARG, turn on if positive, otherwise off.  The
-minor mode can be turned on only if semantic feature is available and
-the current buffer was set up for parsing.  Return non-nil if the
-minor mode is enabled."
-;;
-;;\\{semantic-decoration-map}"
-  (interactive
-   (list (or current-prefix-arg
-             (if semantic-decoration-mode 0 1))))
-  (setq semantic-decoration-mode
-        (if arg
-            (>
-             (prefix-numeric-value arg)
-             0)
-          (not semantic-decoration-mode)))
-  (semantic-decoration-mode-setup)
-  (run-hooks 'semantic-decoration-mode-hook)
-  (if (called-interactively-p 'interactive)
-      (message "decoration-mode minor mode %sabled"
-               (if semantic-decoration-mode "en" "dis")))
-  (semantic-mode-line-update)
-  semantic-decoration-mode)
+                 'semantic-decorate-tags-after-full-reparse t)))
 
 (semantic-add-minor-mode 'semantic-decoration-mode
-                         ""
-                         nil)
+                         "")
 
 (defun semantic-decorate-tags-after-full-reparse (tag-list)
   "Add decorations after a complete reparse of the current buffer.
index 2e926005ead92b2cc21bd6395ad76d6000824313..710b52f37d6522c62903c506a11a4e42bce43eb0 100644 (file)
@@ -110,56 +110,52 @@ Supports caching."
 If POS is nil, default to point.
 Completion options are calculated with `semantic-analyze-possible-completions'."
   (interactive "d")
-  (or pos (setq pos (point)))
-  ;; Calculating completions is a two step process.
-  ;;
-  ;; The first analyzer the current context, which finds tags
-  ;; for all the stuff that may be references by the code around
-  ;; POS.
-  ;;
-  ;; The second step derives completions from that context.
-  (let* ((a (semantic-analyze-current-context pos))
-        (syms (semantic-ia-get-completions a pos))
-        (pre (car (reverse (oref a prefix))))
-        )
-    ;; If PRE was actually an already completed symbol, it doesn't
-    ;; come in as a string, but as a tag instead.
-    (if (semantic-tag-p pre)
-       ;; We will try completions on it anyway.
-       (setq pre (semantic-tag-name pre)))
-    ;; Complete this symbol.
-    (if (null syms)
-       (progn
-         ;(message "No smart completions found.  Trying senator-complete-symbol.")
+  (when (semantic-active-p)
+    (or pos (setq pos (point)))
+    ;; Calculating completions is a two step process.
+    ;;
+    ;; The first analyzer the current context, which finds tags for
+    ;; all the stuff that may be references by the code around POS.
+    ;;
+    ;; The second step derives completions from that context.
+    (let* ((a (semantic-analyze-current-context pos))
+          (syms (semantic-ia-get-completions a pos))
+          (pre (car (reverse (oref a prefix)))))
+      ;; If PRE was actually an already completed symbol, it doesn't
+      ;; come in as a string, but as a tag instead.
+      (if (semantic-tag-p pre)
+         ;; We will try completions on it anyway.
+         (setq pre (semantic-tag-name pre)))
+      ;; Complete this symbol.
+      (if (null syms)
          (if (semantic-analyze-context-p a)
              ;; This is a clever hack.  If we were unable to find any
              ;; smart completions, lets divert to how senator derives
              ;; completions.
              ;;
-             ;; This is a way of making this fcn more useful since the
-             ;; smart completion engine sometimes failes.
-             (semantic-complete-symbol)))
-      ;; Use try completion to seek a common substring.
-      (let ((tc (try-completion (or pre "")  syms)))
-       (if (and (stringp tc) (not (string= tc (or pre ""))))
-           (let ((tok (semantic-find-first-tag-by-name
-                       tc syms)))
-             ;; Delete what came before...
-             (when (and (car (oref a bounds)) (cdr (oref a bounds)))
-               (delete-region (car (oref a bounds))
-                              (cdr (oref a bounds)))
-               (goto-char (car (oref a bounds))))
-             ;; We have some new text.  Stick it in.
-             (if tok
-                 (semantic-ia-insert-tag tok)
-               (insert tc)))
-         ;; We don't have new text.  Show all completions.
-         (when (cdr (oref a bounds))
-           (goto-char (cdr (oref a bounds))))
-         (with-output-to-temp-buffer "*Completions*"
-           (display-completion-list
-            (mapcar semantic-ia-completion-format-tag-function syms))
-           ))))))
+             ;; This is a way of making this fcn more useful since
+             ;; the smart completion engine sometimes failes.
+             (semantic-complete-symbol))
+       ;; Use try completion to seek a common substring.
+       (let ((tc (try-completion (or pre "")  syms)))
+         (if (and (stringp tc) (not (string= tc (or pre ""))))
+             (let ((tok (semantic-find-first-tag-by-name
+                         tc syms)))
+               ;; Delete what came before...
+               (when (and (car (oref a bounds)) (cdr (oref a bounds)))
+                 (delete-region (car (oref a bounds))
+                                (cdr (oref a bounds)))
+                 (goto-char (car (oref a bounds))))
+               ;; We have some new text.  Stick it in.
+               (if tok
+                   (semantic-ia-insert-tag tok)
+                 (insert tc)))
+           ;; We don't have new text.  Show all completions.
+           (when (cdr (oref a bounds))
+             (goto-char (cdr (oref a bounds))))
+           (with-output-to-temp-buffer "*Completions*"
+             (display-completion-list
+              (mapcar semantic-ia-completion-format-tag-function syms)))))))))
 
 (defcustom semantic-ia-completion-menu-format-tag-function
   'semantic-uml-concise-prototype-nonterminal
index ba7a49757a5a55073d1b9ecac46b5eeb8e030a74..a2db3b549d619c3952d2485e319b449620f1c31f 100644 (file)
@@ -128,16 +128,6 @@ unlikely the user would be ready to type again right away."
 ;; The minor mode portion of this code just sets up the minor mode
 ;; which does the initial scheduling of the idle timers.
 ;;
-;;;###autoload
-(defcustom global-semantic-idle-scheduler-mode nil
-  "*If non-nil, enable global use of idle-scheduler mode."
-  :group 'semantic
-  :group 'semantic-modes
-  :type 'boolean
-  :require 'semantic/idle
-  :initialize 'custom-initialize-default
-  :set (lambda (sym val)
-         (global-semantic-idle-scheduler-mode (if val 1 -1))))
 
 (defcustom semantic-idle-scheduler-mode-hook nil
   "Hook run at the end of the function `semantic-idle-scheduler-mode'."
@@ -167,24 +157,8 @@ exceeds the `semantic-idle-scheduler-max-buffer-size' threshold."
        (or (<= semantic-idle-scheduler-max-buffer-size 0)
           (< (buffer-size) semantic-idle-scheduler-max-buffer-size))))
 
-(defun semantic-idle-scheduler-mode-setup ()
-  "Setup option `semantic-idle-scheduler-mode'.
-The minor mode can be turned on only if semantic feature is available
-and the current buffer was set up for parsing.  When minor mode is
-enabled parse the current buffer if needed.  Return non-nil if the
-minor mode is enabled."
-  (if semantic-idle-scheduler-mode
-      (if (not (and (featurep 'semantic) (semantic-active-p)))
-          (progn
-            ;; Disable minor mode if semantic stuff not available
-            (setq semantic-idle-scheduler-mode nil)
-            (error "Buffer %s was not set up idle time scheduling"
-                   (buffer-name)))
-        (semantic-idle-scheduler-setup-timers)))
-  semantic-idle-scheduler-mode)
-
 ;;;###autoload
-(defun semantic-idle-scheduler-mode (&optional arg)
+(define-minor-mode semantic-idle-scheduler-mode
   "Minor mode to auto parse buffer following a change.
 When this mode is off, a buffer is only rescanned for tokens when
 some command requests the list of available tokens.  When idle-scheduler
@@ -195,26 +169,18 @@ With prefix argument ARG, turn on if positive, otherwise off.  The
 minor mode can be turned on only if semantic feature is available and
 the current buffer was set up for parsing.  Return non-nil if the
 minor mode is enabled."
-  (interactive
-   (list (or current-prefix-arg
-             (if semantic-idle-scheduler-mode 0 1))))
-  (setq semantic-idle-scheduler-mode
-        (if arg
-            (>
-             (prefix-numeric-value arg)
-             0)
-          (not semantic-idle-scheduler-mode)))
-  (semantic-idle-scheduler-mode-setup)
-  (run-hooks 'semantic-idle-scheduler-mode-hook)
-  (if (called-interactively-p 'interactive)
-      (message "idle-scheduler minor mode %sabled"
-               (if semantic-idle-scheduler-mode "en" "dis")))
-  (semantic-mode-line-update)
-  semantic-idle-scheduler-mode)
+  nil nil nil
+  (if semantic-idle-scheduler-mode
+      (if (not (and (featurep 'semantic) (semantic-active-p)))
+          (progn
+            ;; Disable minor mode if semantic stuff not available
+            (setq semantic-idle-scheduler-mode nil)
+            (error "Buffer %s was not set up idle time scheduling"
+                   (buffer-name)))
+        (semantic-idle-scheduler-setup-timers))))
 
 (semantic-add-minor-mode 'semantic-idle-scheduler-mode
-                         "ARP"
-                         nil)
+                         "ARP")
 \f
 ;;; SERVICES services
 ;;
@@ -582,31 +548,23 @@ This routine creates the following functions and variables:"
        (mode   (intern (concat (symbol-name name) "-mode")))
        (hook   (intern (concat (symbol-name name) "-mode-hook")))
        (map    (intern (concat (symbol-name name) "-mode-map")))
-       (setup  (intern (concat (symbol-name name) "-mode-setup")))
        (func   (intern (concat (symbol-name name) "-idle-function"))))
 
     `(eval-and-compile
-       (defun ,global (&optional arg)
+       (define-minor-mode ,global
         ,(concat "Toggle " (symbol-name global) ".
 With ARG, turn the minor mode on if ARG is positive, off otherwise.
 
 When this minor mode is enabled, `" (symbol-name mode) "' is
 turned on in every Semantic-supported buffer.")
-        (interactive "P")
-        (setq ,global
-              (semantic-toggle-minor-mode-globally
-               ',mode arg)))
-
-       (defcustom ,global nil
-        ,(concat "Non-nil if `" (symbol-name mode) "' is enabled.")
+         :global t
         :group 'semantic
         :group 'semantic-modes
-        :type 'boolean
         :require 'semantic/idle
-        :initialize 'custom-initialize-default
-        :set (lambda (sym val)
-               (,global (if val 1 -1))))
+        (semantic-toggle-minor-mode-globally
+         ',mode (if ,global 1 -1)))
 
+       ;; FIXME: Get rid of this when define-minor-mode does it for us.
        (defcustom ,hook nil
         ,(concat "Hook run at the end of function `" (symbol-name mode) "'.")
         :group 'semantic
@@ -617,14 +575,9 @@ turned on in every Semantic-supported buffer.")
           km)
         ,(concat "Keymap for `" (symbol-name mode) "'."))
 
-       (defvar ,mode nil
-        ,(concat "Non-nil if the minor mode `" (symbol-name mode) "' is enabled.
-Use the command `" (symbol-name mode) "' to change this variable."))
-       (make-variable-buffer-local ',mode)
-
-       (defun ,setup ()
-        ,(concat "Set up `" (symbol-name mode) "'.
-Return non-nil if the minor mode is enabled.")
+       (define-minor-mode ,mode
+        ,doc
+         :keymap ,map
         (if ,mode
             (if (not (and (featurep 'semantic) (semantic-active-p)))
                 (progn
@@ -633,36 +586,12 @@ Return non-nil if the minor mode is enabled.")
                   (error "Buffer %s was not set up for parsing"
                          (buffer-name)))
               ;; Enable the mode mode
-              (semantic-idle-scheduler-add #',func)
-              )
+              (semantic-idle-scheduler-add #',func))
           ;; Disable the mode mode
-          (semantic-idle-scheduler-remove #',func)
-          )
-        ,mode)
-
-       (defun ,mode (&optional arg)
-        ,doc
-        (interactive
-         (list (or current-prefix-arg
-                   (if ,mode 0 1))))
-        (setq ,mode
-              (if arg
-                  (>
-                   (prefix-numeric-value arg)
-                   0)
-                (not ,mode)))
-        (,setup)
-        (run-hooks ,hook)
-        (if (called-interactively-p 'interactive)
-            (message "%s %sabled"
-                     (symbol-name ',mode)
-                     (if ,mode "en" "dis")))
-        (semantic-mode-line-update)
-        ,mode)
+          (semantic-idle-scheduler-remove #',func)))
 
        (semantic-add-minor-mode ',mode
-                               ""      ; idle schedulers are quiet?
-                               ,map)
+                               "")     ; idle schedulers are quiet?
 
        (defun ,func ()
         ,(concat "Perform idle activity for the minor mode `"
@@ -814,21 +743,6 @@ When this minor mode is enabled, the echo area displays a summary
 of the lexical token at point whenever Emacs is idle."
   :group 'semantic
   :group 'semantic-modes
-  (semantic-idle-summary-mode-setup)
-  (semantic-mode-line-update))
-
-(defun semantic-idle-summary-refresh-echo-area ()
-  (and semantic-idle-summary-mode
-       eldoc-last-message
-       (if (and (not executing-kbd-macro)
-               (not (and (boundp 'edebug-active) edebug-active))
-               (not cursor-in-echo-area)
-               (not (eq (selected-window) (minibuffer-window))))
-           (eldoc-message eldoc-last-message)
-         (setq eldoc-last-message nil))))
-
-(defun semantic-idle-summary-mode-setup ()
-  "Set up `semantic-idle-summary-mode'."
   (if semantic-idle-summary-mode
       ;; Enable the mode
       (progn
@@ -842,8 +756,17 @@ of the lexical token at point whenever Emacs is idle."
        (add-hook 'pre-command-hook 'semantic-idle-summary-refresh-echo-area t))
     ;; Disable the mode
     (semantic-idle-scheduler-remove 'semantic-idle-summary-idle-function)
-    (remove-hook 'pre-command-hook 'semantic-idle-summary-refresh-echo-area t))
-  semantic-idle-summary-mode)
+    (remove-hook 'pre-command-hook 'semantic-idle-summary-refresh-echo-area t)))
+
+(defun semantic-idle-summary-refresh-echo-area ()
+  (and semantic-idle-summary-mode
+       eldoc-last-message
+       (if (and (not executing-kbd-macro)
+               (not (and (boundp 'edebug-active) edebug-active))
+               (not cursor-in-echo-area)
+               (not (eq (selected-window) (minibuffer-window))))
+           (eldoc-message eldoc-last-message)
+         (setq eldoc-last-message nil))))
 
 (semantic-add-minor-mode 'semantic-idle-summary-mode "")
 
@@ -957,22 +880,22 @@ Call `semantic-symref-hits-in-region' to identify local references."
 
 \f
 ;;;###autoload
-(defun global-semantic-idle-scheduler-mode (&optional arg)
+(define-minor-mode global-semantic-idle-scheduler-mode
   "Toggle global use of option `semantic-idle-scheduler-mode'.
 The idle scheduler will automatically reparse buffers in idle time,
 and then schedule other jobs setup with `semantic-idle-scheduler-add'.
-If ARG is positive, enable, if it is negative, disable.
-If ARG is nil, then toggle."
-  (interactive "P")
+If ARG is positive or nil, enable, if it is negative, disable."
+  :global t
+  :group 'semantic
+  :group 'semantic-modes
   ;; When turning off, disable other idle modes.
-  (when (or (and (numberp arg) (< arg 0))
-           (and (null arg) global-semantic-idle-scheduler-mode))
+  (when (null global-semantic-idle-scheduler-mode)
     (global-semantic-idle-summary-mode -1)
     (global-semantic-idle-tag-highlight-mode -1)
     (global-semantic-idle-completions-mode -1))
-  (setq global-semantic-idle-scheduler-mode
-        (semantic-toggle-minor-mode-globally
-         'semantic-idle-scheduler-mode arg)))
+  (semantic-toggle-minor-mode-globally
+   'semantic-idle-scheduler-mode
+   (if global-semantic-idle-scheduler-mode 1 -1)))
 
 \f
 ;;; Completion Popup Mode
index 1982f81cbad7abcdd0d6406b2b1f6d143f596da9..12e0cb9f834286d0ab8e2da937a67e5b6ac5d932 100644 (file)
@@ -239,27 +239,15 @@ This function pushes tags onto the tag ring."
 ;;
 ;; Tracking minor mode.
 
-(defcustom global-semantic-mru-bookmark-mode nil
-  "If non-nil, enable `semantic-mru-bookmark-mode' globally.
-When this mode is enabled, Emacs keeps track of which tags have
-been edited, and you can re-visit them with \\[semantic-mrub-switch-tags]."
-  :group 'semantic
-  :group 'semantic-modes
-  :type 'boolean
-  :require 'semantic-util-modes
-  :initialize 'custom-initialize-default
-  :set (lambda (sym val)
-         (global-semantic-mru-bookmark-mode (if val 1 -1))))
-
 ;;;###autoload
-(defun global-semantic-mru-bookmark-mode (&optional arg)
+(define-minor-mode global-semantic-mru-bookmark-mode
   "Toggle global use of option `semantic-mru-bookmark-mode'.
-If ARG is positive, enable, if it is negative, disable.
-If ARG is nil, then toggle."
-  (interactive "P")
-  (setq global-semantic-mru-bookmark-mode
-        (semantic-toggle-minor-mode-globally
-         'semantic-mru-bookmark-mode arg)))
+If ARG is positive or nil, enable, if it is negative, disable."
+  :global t :group 'semantic :group 'semantic-modes
+  ;; Not needed because it's autoloaded instead.
+  ;; :require 'semantic-util-modes
+  (semantic-toggle-minor-mode-globally
+   'semantic-mru-bookmark-mode (if global-semantic-mru-bookmark-mode 1 -1)))
 
 (defcustom semantic-mru-bookmark-mode-hook nil
   "*Hook run at the end of function `semantic-mru-bookmark-mode'."
@@ -272,17 +260,18 @@ If ARG is nil, then toggle."
     km)
   "Keymap for mru-bookmark minor mode.")
 
-(defvar semantic-mru-bookmark-mode nil
-  "Non-nil if mru-bookmark minor mode is enabled.
-Use the command `semantic-mru-bookmark-mode' to change this variable.")
-(make-variable-buffer-local 'semantic-mru-bookmark-mode)
+(define-minor-mode semantic-mru-bookmark-mode
+  "Minor mode for tracking tag-based bookmarks automatically.
+When this mode is enabled, Emacs keeps track of which tags have
+been edited, and you can re-visit them with \\[semantic-mrub-switch-tags].
+
+\\{semantic-mru-bookmark-mode-map}
 
-(defun semantic-mru-bookmark-mode-setup ()
-  "Setup option `semantic-mru-bookmark-mode'.
-The minor mode can be turned on only if semantic feature is available
-and the current buffer was set up for parsing.  When minor mode is
-enabled parse the current buffer if needed.  Return non-nil if the
+With prefix argument ARG, turn on if positive, otherwise off.  The
+minor mode can be turned on only if semantic feature is available and
+the current buffer was set up for parsing.  Return non-nil if the
 minor mode is enabled."
+  :keymap semantic-mru-bookmark-mode-map
   (if semantic-mru-bookmark-mode
       (if (not (and (featurep 'semantic) (semantic-active-p)))
          (progn
@@ -294,47 +283,15 @@ minor mode is enabled."
         (add-hook 'semantic-edits-new-change-hooks
                   'semantic-mru-bookmark-change-hook-fcn nil t)
         (add-hook 'semantic-edits-move-change-hooks
-                  'semantic-mru-bookmark-change-hook-fcn nil t)
-        )
+                  'semantic-mru-bookmark-change-hook-fcn nil t))
     ;; Remove hooks
     (remove-hook 'semantic-edits-new-change-hooks
                 'semantic-mru-bookmark-change-hook-fcn t)
     (remove-hook 'semantic-edits-move-change-hooks
-                'semantic-mru-bookmark-change-hook-fcn t)
-    )
-  semantic-mru-bookmark-mode)
-
-(defun semantic-mru-bookmark-mode (&optional arg)
-  "Minor mode for tracking tag-based bookmarks automatically.
-When this mode is enabled, Emacs keeps track of which tags have
-been edited, and you can re-visit them with \\[semantic-mrub-switch-tags].
-
-\\{semantic-mru-bookmark-mode-map}
-
-With prefix argument ARG, turn on if positive, otherwise off.  The
-minor mode can be turned on only if semantic feature is available and
-the current buffer was set up for parsing.  Return non-nil if the
-minor mode is enabled."
-  (interactive
-   (list (or current-prefix-arg
-             (if semantic-mru-bookmark-mode 0 1))))
-  (setq semantic-mru-bookmark-mode
-        (if arg
-            (>
-             (prefix-numeric-value arg)
-             0)
-          (not semantic-mru-bookmark-mode)))
-  (semantic-mru-bookmark-mode-setup)
-  (run-hooks 'semantic-mru-bookmark-mode-hook)
-  (if (called-interactively-p 'interactive)
-      (message "mru-bookmark minor mode %sabled"
-               (if semantic-mru-bookmark-mode "en" "dis")))
-  (semantic-mode-line-update)
-  semantic-mru-bookmark-mode)
+                'semantic-mru-bookmark-change-hook-fcn t)))
 
 (semantic-add-minor-mode 'semantic-mru-bookmark-mode
-                         "k"
-                         semantic-mru-bookmark-mode-map)
+                         "k")
 
 ;;; COMPLETING READ
 ;;
index 7e3a615d0b15280b6c352d3d221134796e6ebc58..9f53dffea98171c5a5523666166ff4aa351294e3 100644 (file)
 ;;
 
 ;;; Code:
+
+;; FIXME: compiling util-modes.el seems to require loading util-modes.el,
+;; so if the previous compilation generated a file that fails to load,
+;; recompiling fails to fix the problem.
 (require 'semantic)
 
 ;;; Group for all semantic enhancing modes
@@ -49,8 +53,7 @@ line."
   :set (lambda (sym val)
          (set-default sym val)
          ;; Update status of all Semantic enabled buffers
-         (semantic-map-buffers
-          #'semantic-mode-line-update)))
+         (semantic-mode-line-update)))
 
 (defcustom semantic-mode-line-prefix
   (propertize "S" 'face 'bold)
@@ -60,59 +63,61 @@ line."
   :require 'semantic/util-modes
   :initialize 'custom-initialize-default)
 
-(defvar semantic-minor-modes-status nil
-  "String showing Semantic minor modes which are locally enabled.
+(defvar semantic-minor-modes-format nil
+  "Mode line format showing Semantic minor modes which are locally enabled.
 It is displayed in the mode line.")
-(make-variable-buffer-local 'semantic-minor-modes-status)
+(put 'semantic-minor-modes-format 'risky-local-variable t)
 
 (defvar semantic-minor-mode-alist nil
   "Alist saying how to show Semantic minor modes in the mode line.
 Like variable `minor-mode-alist'.")
 
 (defun semantic-mode-line-update ()
-  "Update display of Semantic minor modes in the mode line.
+  "Update mode line format of Semantic minor modes.
 Only minor modes that are locally enabled are shown in the mode line."
-  (setq semantic-minor-modes-status nil)
-  (if semantic-update-mode-line
-      (let ((ml semantic-minor-mode-alist)
-            mm ms see)
-        (while ml
-          (setq mm (car ml)
-                ms (cadr mm)
-                mm (car mm)
-                ml (cdr ml))
-          (when (and (symbol-value mm)
-                     ;; Only show local minor mode status
-                     (not (memq mm semantic-init-hook)))
-            (and ms
-                 (symbolp ms)
-                 (setq ms (symbol-value ms)))
-            (and (stringp ms)
-                 (not (member ms see)) ;; Don't duplicate same status
-                 (setq see (cons ms see)
-                       ms (if (string-match "^[ ]*\\(.+\\)" ms)
-                              (match-string 1 ms)))
-                 (setq semantic-minor-modes-status
-                       (if semantic-minor-modes-status
-                           (concat semantic-minor-modes-status "/" ms)
-                         ms)))))
-        (if semantic-minor-modes-status
-            (setq semantic-minor-modes-status
-                  (concat
-                   " "
-                   (if (string-match "^[ ]*\\(.+\\)"
-                                     semantic-mode-line-prefix)
-                       (match-string 1 semantic-mode-line-prefix)
-                     "S")
-                   "/"
-                   semantic-minor-modes-status))))))
+  (setq semantic-minor-modes-format nil)
+  (dolist (x semantic-minor-mode-alist)
+    (setq minor-mode-alist (delq (assq (car x) minor-mode-alist)
+                                 minor-mode-alist)))
+  (when semantic-update-mode-line
+    (let ((locals '()))
+      ;; Select the minor modes that aren't enabled globally and who
+      ;; have a non-empty "name".
+      (dolist (x semantic-minor-mode-alist)
+        (unless (or (memq (car x) semantic-init-hook)
+                    (not (string-match "^[ ]*\\(.+\\)" (cadr x))))
+          (push (list (car x) (concat "/" (match-string 1 (cadr x)))) locals)))
+      ;; Then build the format spec.
+      (when locals
+        (let ((prefix (if (string-match "^[ ]*\\(.+\\)"
+                                        semantic-mode-line-prefix)
+                          (match-string 1 semantic-mode-line-prefix)
+                        "S")))
+          (setq semantic-minor-modes-format
+                `((:eval (if (or ,@(mapcar 'car locals))
+                             ,(concat " " prefix)))))
+          ;; It would be easier to just put `locals' inside
+          ;; semantic-minor-modes-format, but then things like
+          ;; mode-line-minor-mode-help can't find the right major mode
+          ;; any more.  So instead, we carefully put the minor modes
+          ;; in minor-mode-alist.
+          (let* ((elem (or (assq 'semantic-minor-modes-format
+                                 minor-mode-alist)
+                           ;; FIXME: This entry is meaningless for
+                           ;; mode-line-minor-mode-help.
+                           '(semantic-minor-modes-format
+                           semantic-minor-modes-format)))
+                 (tail (or (memq elem minor-mode-alist)
+                           (setq minor-mode-alist
+                                 (cons elem minor-mode-alist)))))
+            (setcdr tail (nconc locals (cdr tail)))))))))      
 
 (defun semantic-desktop-ignore-this-minor-mode (buffer)
   "Installed as a minor-mode initializer for Desktop mode.
 BUFFER is the buffer to not initialize a Semantic minor mode in."
   nil)
 
-(defun semantic-add-minor-mode (toggle name &optional keymap)
+(defun semantic-add-minor-mode (toggle name)
   "Register a new Semantic minor mode.
 TOGGLE is a symbol which is the name of a buffer-local variable that
 is toggled on or off to say whether the minor mode is active or not.
@@ -120,98 +125,58 @@ It is also an interactive function to toggle the mode.
 
 NAME specifies what will appear in the mode line when the minor mode
 is active.  NAME should be either a string starting with a space, or a
-symbol whose value is such a string.
-
-Optional KEYMAP is the keymap for the minor mode that will be added to
-`minor-mode-map-alist'."
-  ;; Add a dymmy semantic minor mode to display the status
-  (or (assq 'semantic-minor-modes-status minor-mode-alist)
-      (setq minor-mode-alist (cons (list 'semantic-minor-modes-status
-                                         'semantic-minor-modes-status)
-                                   minor-mode-alist)))
-  (if (fboundp 'add-minor-mode)
-      ;; Emacs 21 & XEmacs
-      (add-minor-mode toggle "" keymap)
-    ;; Emacs 20
-    (or (assq toggle minor-mode-alist)
-        (setq minor-mode-alist (cons (list toggle "") minor-mode-alist)))
-    (or (not keymap)
-        (assq toggle minor-mode-map-alist)
-        (setq minor-mode-map-alist (cons (cons toggle keymap)
-                                         minor-mode-map-alist))))
+symbol whose value is such a string."
   ;; Record how to display this minor mode in the mode line
   (let ((mm (assq toggle semantic-minor-mode-alist)))
     (if mm
         (setcdr mm (list name))
       (setq semantic-minor-mode-alist (cons (list toggle name)
                                        semantic-minor-mode-alist))))
+  (semantic-mode-line-update)
 
   ;; Semantic minor modes don't work w/ Desktop restore.
   ;; This line will disable this minor mode from being restored
   ;; by Desktop.
   (when (boundp 'desktop-minor-mode-handlers)
     (add-to-list 'desktop-minor-mode-handlers
-                (cons toggle 'semantic-desktop-ignore-this-minor-mode)))
-  )
+                (cons toggle 'semantic-desktop-ignore-this-minor-mode))))
 
 (defun semantic-toggle-minor-mode-globally (mode &optional arg)
   "Toggle minor mode MODE in every Semantic enabled buffer.
 Return non-nil if MODE is turned on in every Semantic enabled buffer.
-If ARG is positive, enable, if it is negative, disable.  If ARG is
-nil, then toggle.  Otherwise do nothing.  MODE must be a valid minor
-mode defined in `minor-mode-alist' and must be too an interactive
-function used to toggle the mode."
-  (or (and (fboundp mode) (assq mode minor-mode-alist))
+If ARG is positive, enable, if it is negative, disable.
+MODE must be a valid minor mode defined in `minor-mode-alist' and must be
+too an interactive function used to toggle the mode."
+  ;; FIXME: All callers should pass a -1 or +1 argument.
+  (or (and (fboundp mode) (or (assq mode minor-mode-alist) ;Needed?
+                             (assq mode semantic-minor-mode-alist)))
       (error "Semantic minor mode %s not found" mode))
-  (if (not arg)
-      (if (memq mode semantic-init-hook)
-         (setq arg -1)
-       (setq arg 1)))
-  ;; Add or remove the MODE toggle function from
-  ;; `semantic-init-hook'.  Then turn MODE on or off in every
-  ;; Semantic enabled buffer.
+  ;; Add or remove the MODE toggle function from `semantic-init-hook'.
   (cond
    ;; Turn off if ARG < 0
-   ((< arg 0)
-    (remove-hook 'semantic-init-hook mode)
-    (semantic-map-buffers #'(lambda () (funcall mode -1)))
-    nil)
+   ((< arg 0) (remove-hook 'semantic-init-hook mode))
    ;; Turn on if ARG > 0
-   ((> arg 0)
-    (add-hook 'semantic-init-hook mode)
-    (semantic-map-buffers #'(lambda () (funcall mode 1)))
-    t)
+   ((> arg 0) (add-hook 'semantic-init-hook mode))
    ;; Otherwise just check MODE state
    (t
-    (memq mode semantic-init-hook))
-   ))
+    (error "semantic-toggle-minor-mode-globally: arg should be -1 or 1")))
+  ;; Update the minor mode format.
+  (semantic-mode-line-update)
+  ;; Then turn MODE on or off in every Semantic enabled buffer.
+  (semantic-map-buffers #'(lambda () (funcall mode arg))))
 \f
 ;;;;
 ;;;; Minor mode to highlight areas that a user edits.
 ;;;;
 
 ;;;###autoload
-(defun global-semantic-highlight-edits-mode (&optional arg)
+(define-minor-mode global-semantic-highlight-edits-mode
   "Toggle global use of option `semantic-highlight-edits-mode'.
-If ARG is positive, enable, if it is negative, disable.
-If ARG is nil, then toggle."
-  (interactive "P")
-  (setq global-semantic-highlight-edits-mode
-        (semantic-toggle-minor-mode-globally
-         'semantic-highlight-edits-mode arg)))
-
-;;;###autoload
-(defcustom global-semantic-highlight-edits-mode nil
-  "If non-nil enable global use of variable `semantic-highlight-edits-mode'.
-When this mode is enabled, changes made to a buffer are highlighted
-until the buffer is reparsed."
-  :group 'semantic
-  :group 'semantic-modes
-  :type 'boolean
-  :require 'semantic/util-modes
-  :initialize 'custom-initialize-default
-  :set (lambda (sym val)
-         (global-semantic-highlight-edits-mode (if val 1 -1))))
+If ARG is positive or nil, enable, if it is negative, disable."
+  :global t :group 'semantic :group 'semantic-modes
+  (semantic-toggle-minor-mode-globally
+   'semantic-highlight-edits-mode
+   (if global-semantic-highlight-edits-mode 1 -1)))
 
 (defcustom semantic-highlight-edits-mode-hook nil
   "Hook run at the end of function `semantic-highlight-edits-mode'."
@@ -238,17 +203,18 @@ This function will set the face property on this overlay."
     km)
   "Keymap for highlight-edits minor mode.")
 
-(defvar semantic-highlight-edits-mode nil
-  "Non-nil if highlight-edits minor mode is enabled.
-Use the command `semantic-highlight-edits-mode' to change this variable.")
-(make-variable-buffer-local 'semantic-highlight-edits-mode)
-
-(defun semantic-highlight-edits-mode-setup ()
-  "Setup option `semantic-highlight-edits-mode'.
-The minor mode can be turned on only if semantic feature is available
-and the current buffer was set up for parsing.  When minor mode is
-enabled parse the current buffer if needed.  Return non-nil if the
+;;;###autoload
+(define-minor-mode semantic-highlight-edits-mode
+  "Minor mode for highlighting changes made in a buffer.
+Changes are tracked by semantic so that the incremental parser can work
+properly.
+This mode will highlight those changes as they are made, and clear them
+when the incremental parser accounts for those edits.
+With prefix argument ARG, turn on if positive, otherwise off.  The
+minor mode can be turned on only if semantic feature is available and
+the current buffer was set up for parsing.  Return non-nil if the
 minor mode is enabled."
+  :keymap semantic-highlight-edits-mode-map
   (if semantic-highlight-edits-mode
       (if (not (and (featurep 'semantic) (semantic-active-p)))
          (progn
@@ -258,73 +224,28 @@ minor mode is enabled."
                   (buffer-name)))
        (semantic-make-local-hook 'semantic-edits-new-change-hooks)
        (add-hook 'semantic-edits-new-change-hooks
-                 'semantic-highlight-edits-new-change-hook-fcn nil t)
-       )
+                 'semantic-highlight-edits-new-change-hook-fcn nil t))
     ;; Remove hooks
     (remove-hook 'semantic-edits-new-change-hooks
-                'semantic-highlight-edits-new-change-hook-fcn t)
-    )
-  semantic-highlight-edits-mode)
-
-;;;###autoload
-(defun semantic-highlight-edits-mode (&optional arg)
-  "Minor mode for highlighting changes made in a buffer.
-Changes are tracked by semantic so that the incremental parser can work
-properly.
-This mode will highlight those changes as they are made, and clear them
-when the incremental parser accounts for those edits.
-With prefix argument ARG, turn on if positive, otherwise off.  The
-minor mode can be turned on only if semantic feature is available and
-the current buffer was set up for parsing.  Return non-nil if the
-minor mode is enabled."
-  (interactive
-   (list (or current-prefix-arg
-             (if semantic-highlight-edits-mode 0 1))))
-  (setq semantic-highlight-edits-mode
-        (if arg
-            (>
-             (prefix-numeric-value arg)
-             0)
-          (not semantic-highlight-edits-mode)))
-  (semantic-highlight-edits-mode-setup)
-  (run-hooks 'semantic-highlight-edits-mode-hook)
-  (if (called-interactively-p 'interactive)
-      (message "highlight-edits minor mode %sabled"
-               (if semantic-highlight-edits-mode "en" "dis")))
-  (semantic-mode-line-update)
-  semantic-highlight-edits-mode)
+                'semantic-highlight-edits-new-change-hook-fcn t)))
 
 (semantic-add-minor-mode 'semantic-highlight-edits-mode
-                         "e"
-                         semantic-highlight-edits-mode-map)
-
+                         "e")
 \f
 ;;;;
 ;;;; Minor mode to show unmatched-syntax elements
 ;;;;
 
 ;;;###autoload
-(defun global-semantic-show-unmatched-syntax-mode (&optional arg)
+(define-minor-mode global-semantic-show-unmatched-syntax-mode
   "Toggle global use of option `semantic-show-unmatched-syntax-mode'.
-If ARG is positive, enable, if it is negative, disable.
-If ARG is nil, then toggle."
-  (interactive "P")
-  (setq global-semantic-show-unmatched-syntax-mode
-        (semantic-toggle-minor-mode-globally
-         'semantic-show-unmatched-syntax-mode arg)))
-
-;;;###autoload
-(defcustom global-semantic-show-unmatched-syntax-mode nil
-  "If non-nil, enable global use of `semantic-show-unmatched-syntax-mode'.
-When this mode is enabled, syntax in the current buffer which the
-semantic parser cannot match is highlighted with a red underline."
-  :group 'semantic
-  :group 'semantic-modes
-  :type 'boolean
-  :require 'semantic/util-modes
-  :initialize 'custom-initialize-default
-  :set (lambda (sym val)
-         (global-semantic-show-unmatched-syntax-mode (if val 1 -1))))
+If ARG is positive or nil, enable, if it is negative, disable."
+  :global t :group 'semantic :group 'semantic-modes
+  ;; Not needed because it's autoloaded instead.
+  ;; :require 'semantic/util-modes
+  (semantic-toggle-minor-mode-globally
+   'semantic-show-unmatched-syntax-mode
+   (if global-semantic-show-unmatched-syntax-mode 1 -1)))
 
 (defcustom semantic-show-unmatched-syntax-mode-hook nil
   "Hook run at the end of function `semantic-show-unmatched-syntax-mode'."
@@ -432,18 +353,21 @@ Do not search past BOUND if non-nil."
     km)
   "Keymap for command `semantic-show-unmatched-syntax-mode'.")
 
-(defvar semantic-show-unmatched-syntax-mode nil
-  "Non-nil if show-unmatched-syntax minor mode is enabled.
-Use the command `semantic-show-unmatched-syntax-mode' to change this
-variable.")
-(make-variable-buffer-local 'semantic-show-unmatched-syntax-mode)
-
-(defun semantic-show-unmatched-syntax-mode-setup ()
-  "Setup the `semantic-show-unmatched-syntax' minor mode.
-The minor mode can be turned on only if semantic feature is available
-and the current buffer was set up for parsing.  When minor mode is
-enabled parse the current buffer if needed.  Return non-nil if the
-minor mode is enabled."
+;;;###autoload
+(define-minor-mode semantic-show-unmatched-syntax-mode
+  "Minor mode to highlight unmatched lexical syntax tokens.
+When a parser executes, some elements in the buffer may not match any
+parser rules.  These text characters are considered unmatched syntax.
+Often time, the display of unmatched syntax can expose coding
+problems before the compiler is run.
+
+With prefix argument ARG, turn on if positive, otherwise off.  The
+minor mode can be turned on only if semantic feature is available and
+the current buffer was set up for parsing.  Return non-nil if the
+minor mode is enabled.
+
+\\{semantic-show-unmatched-syntax-mode-map}"
+  :keymap semantic-show-unmatched-syntax-mode-map
   (if semantic-show-unmatched-syntax-mode
       (if (not (and (featurep 'semantic) (semantic-active-p)))
           (progn
@@ -468,43 +392,10 @@ minor mode is enabled."
     (remove-hook 'semantic-pre-clean-token-hooks
                 'semantic-clean-token-of-unmatched-syntax t)
     ;; Cleanup unmatched-syntax highlighting
-    (semantic-clean-unmatched-syntax-in-buffer))
-  semantic-show-unmatched-syntax-mode)
-
-;;;###autoload
-(defun semantic-show-unmatched-syntax-mode (&optional arg)
-  "Minor mode to highlight unmatched lexical syntax tokens.
-When a parser executes, some elements in the buffer may not match any
-parser rules.  These text characters are considered unmatched syntax.
-Often time, the display of unmatched syntax can expose coding
-problems before the compiler is run.
-
-With prefix argument ARG, turn on if positive, otherwise off.  The
-minor mode can be turned on only if semantic feature is available and
-the current buffer was set up for parsing.  Return non-nil if the
-minor mode is enabled.
-
-\\{semantic-show-unmatched-syntax-mode-map}"
-  (interactive
-   (list (or current-prefix-arg
-             (if semantic-show-unmatched-syntax-mode 0 1))))
-  (setq semantic-show-unmatched-syntax-mode
-        (if arg
-            (>
-             (prefix-numeric-value arg)
-             0)
-          (not semantic-show-unmatched-syntax-mode)))
-  (semantic-show-unmatched-syntax-mode-setup)
-  (run-hooks 'semantic-show-unmatched-syntax-mode-hook)
-  (if (called-interactively-p 'interactive)
-      (message "show-unmatched-syntax minor mode %sabled"
-               (if semantic-show-unmatched-syntax-mode "en" "dis")))
-  (semantic-mode-line-update)
-  semantic-show-unmatched-syntax-mode)
+    (semantic-clean-unmatched-syntax-in-buffer)))
 
 (semantic-add-minor-mode 'semantic-show-unmatched-syntax-mode
-                         "u"
-                         semantic-show-unmatched-syntax-mode-map)
+                         "u")
 
 (defun semantic-show-unmatched-syntax-next ()
   "Move forward to the next occurrence of unmatched syntax."
@@ -519,27 +410,15 @@ minor mode is enabled.
 ;;;;
 
 ;;;###autoload
-(defcustom global-semantic-show-parser-state-mode nil
-  "If non-nil enable global use of `semantic-show-parser-state-mode'.
-When enabled, the current parse state of the current buffer is displayed
-in the mode line.  See `semantic-show-parser-state-marker' for details
-on what is displayed."
-  :group 'semantic
-  :type 'boolean
-  :require 'semantic/util-modes
-  :initialize 'custom-initialize-default
-  :set (lambda (sym val)
-         (global-semantic-show-parser-state-mode (if val 1 -1))))
-
-;;;###autoload
-(defun global-semantic-show-parser-state-mode (&optional arg)
+(define-minor-mode global-semantic-show-parser-state-mode
   "Toggle global use of option `semantic-show-parser-state-mode'.
-If ARG is positive, enable, if it is negative, disable.
-If ARG is nil, then toggle."
-  (interactive "P")
-  (setq global-semantic-show-parser-state-mode
-        (semantic-toggle-minor-mode-globally
-         'semantic-show-parser-state-mode arg)))
+If ARG is positive or nil, enable, if it is negative, disable."
+  :global t :group 'semantic
+  ;; Not needed because it's autoloaded instead.
+  ;; :require 'semantic/util-modes
+  (semantic-toggle-minor-mode-globally
+   'semantic-show-parser-state-mode
+   (if global-semantic-show-parser-state-mode 1 -1)))
 
 (defcustom semantic-show-parser-state-mode-hook nil
   "Hook run at the end of function `semantic-show-parser-state-mode'."
@@ -551,17 +430,22 @@ If ARG is nil, then toggle."
     km)
   "Keymap for show-parser-state minor mode.")
 
-(defvar semantic-show-parser-state-mode nil
-  "Non-nil if show-parser-state minor mode is enabled.
-Use the command `semantic-show-parser-state-mode' to change this variable.")
-(make-variable-buffer-local 'semantic-show-parser-state-mode)
-
-(defun semantic-show-parser-state-mode-setup ()
-  "Setup option `semantic-show-parser-state-mode'.
-The minor mode can be turned on only if semantic feature is available
-and the current buffer was set up for parsing.  When minor mode is
-enabled parse the current buffer if needed.  Return non-nil if the
+;;;###autoload
+(define-minor-mode semantic-show-parser-state-mode
+  "Minor mode for displaying parser cache state in the modeline.
+The cache can be in one of three states.  They are
+Up to date, Partial reparse needed, and Full reparse needed.
+The state is indicated in the modeline with the following characters:
+ `-'  ->  The cache is up to date.
+ `!'  ->  The cache requires a full update.
+ `~'  ->  The cache needs to be incrementally parsed.
+ `%'  ->  The cache is not currently parseable.
+ `@'  ->  Auto-parse in progress (not set here.)
+With prefix argument ARG, turn on if positive, otherwise off.  The
+minor mode can be turned on only if semantic feature is available and
+the current buffer was set up for parsing.  Return non-nil if the
 minor mode is enabled."
+  :keymap semantic-show-parser-state-mode-map
   (if semantic-show-parser-state-mode
       (if (not (and (featurep 'semantic) (semantic-active-p)))
           (progn
@@ -603,8 +487,7 @@ minor mode is enabled."
                  'semantic-show-parser-state-auto-marker nil t)
        (semantic-make-local-hook 'semantic-after-idle-scheduler-reparse-hook)
        (add-hook 'semantic-after-idle-scheduler-reparse-hook
-                 'semantic-show-parser-state-marker nil t)
-        )
+                 'semantic-show-parser-state-marker nil t))
     ;; Remove parts of mode line
     (setq mode-line-modified
          (delq 'semantic-show-parser-state-string mode-line-modified))
@@ -626,45 +509,10 @@ minor mode is enabled."
     (remove-hook 'semantic-before-idle-scheduler-reparse-hook
                 'semantic-show-parser-state-auto-marker t)
     (remove-hook 'semantic-after-idle-scheduler-reparse-hook
-                'semantic-show-parser-state-marker t)
-    )
-  semantic-show-parser-state-mode)
-
-;;;###autoload
-(defun semantic-show-parser-state-mode (&optional arg)
-  "Minor mode for displaying parser cache state in the modeline.
-The cache can be in one of three states.  They are
-Up to date, Partial reparse needed, and Full reparse needed.
-The state is indicated in the modeline with the following characters:
- `-'  ->  The cache is up to date.
- `!'  ->  The cache requires a full update.
- `~'  ->  The cache needs to be incrementally parsed.
- `%'  ->  The cache is not currently parseable.
- `@'  ->  Auto-parse in progress (not set here.)
-With prefix argument ARG, turn on if positive, otherwise off.  The
-minor mode can be turned on only if semantic feature is available and
-the current buffer was set up for parsing.  Return non-nil if the
-minor mode is enabled."
-  (interactive
-   (list (or current-prefix-arg
-             (if semantic-show-parser-state-mode 0 1))))
-  (setq semantic-show-parser-state-mode
-        (if arg
-            (>
-             (prefix-numeric-value arg)
-             0)
-          (not semantic-show-parser-state-mode)))
-  (semantic-show-parser-state-mode-setup)
-  (run-hooks 'semantic-show-parser-state-mode-hook)
-  (if (called-interactively-p 'interactive)
-      (message "show-parser-state minor mode %sabled"
-               (if semantic-show-parser-state-mode "en" "dis")))
-  (semantic-mode-line-update)
-  semantic-show-parser-state-mode)
+                'semantic-show-parser-state-marker t)))
 
 (semantic-add-minor-mode 'semantic-show-parser-state-mode
-                         ""
-                         semantic-show-parser-state-mode-map)
+                         "")
 
 (defvar semantic-show-parser-state-string nil
   "String showing the parser state for this buffer.
@@ -691,7 +539,7 @@ in many situations."
              (t
                "-")))
   ;;(message "Setup mode line indicator to [%s]" semantic-show-parser-state-string)
-  (semantic-mode-line-update))
+  )
 
 (defun semantic-show-parser-state-auto-marker ()
   "Hook function run before an autoparse.
@@ -699,7 +547,6 @@ Set up `semantic-show-parser-state-marker' to show `@'
 to indicate a parse in progress."
   (unless (semantic-parse-tree-up-to-date-p)
     (setq semantic-show-parser-state-string "@")
-    (semantic-mode-line-update)
     ;; For testing.
     ;;(sit-for 1)
     ))
@@ -710,30 +557,14 @@ to indicate a parse in progress."
 ;;;;
 
 ;;;###autoload
-(defun global-semantic-stickyfunc-mode (&optional arg)
+(define-minor-mode global-semantic-stickyfunc-mode
   "Toggle global use of option `semantic-stickyfunc-mode'.
-If ARG is positive, enable, if it is negative, disable.
-If ARG is nil, then toggle."
-  (interactive "P")
-  (setq global-semantic-stickyfunc-mode
-        (semantic-toggle-minor-mode-globally
-         'semantic-stickyfunc-mode arg)))
-
-;;;###autoload
-(defcustom global-semantic-stickyfunc-mode nil
-  "If non-nil, enable global use of `semantic-stickyfunc-mode'.
-This minor mode only works for Emacs 21 or later.
-When enabled, the header line is enabled, and the first line
-of the current function or method is displayed in it.
-This makes it appear that the first line of that tag is
-`sticky' to the top of the window."
-  :group 'semantic
-  :group 'semantic-modes
-  :type 'boolean
-  :require 'semantic/util-modes
-  :initialize 'custom-initialize-default
-  :set (lambda (sym val)
-         (global-semantic-stickyfunc-mode (if val 1 -1))))
+If ARG is positive or nil, enable, if it is negative, disable."
+  :global t :group 'semantic :group 'semantic-modes
+  ;; Not needed because it's autoloaded instead.
+  ;; :require 'semantic/util-modes
+  (semantic-toggle-minor-mode-globally
+   'semantic-stickyfunc-mode (if global-semantic-stickyfunc-mode 1 -1)))
 
 (defcustom semantic-stickyfunc-mode-hook nil
   "Hook run at the end of function `semantic-stickyfunc-mode'."
@@ -781,11 +612,6 @@ This makes it appear that the first line of that tag is
        (describe-function 'semantic-stickyfunc-mode)) t])
   )
 
-(defvar semantic-stickyfunc-mode nil
-  "Non-nil if stickyfunc minor mode is enabled.
-Use the command `semantic-stickyfunc-mode' to change this variable.")
-(make-variable-buffer-local 'semantic-stickyfunc-mode)
-
 (defcustom semantic-stickyfunc-indent-string
   (if (and window-system (not (featurep 'xemacs)))
       (concat
@@ -870,11 +696,21 @@ when it lands in the sticky line."
        (t nil))
   "The header line format used by stickyfunc mode.")
 
-(defun semantic-stickyfunc-mode-setup ()
-  "Setup option `semantic-stickyfunc-mode'.
-For semantic enabled buffers, make the function declaration for the top most
-function \"sticky\".  This is accomplished by putting the first line of
-text for that function in the header line."
+;;;###autoload
+(define-minor-mode semantic-stickyfunc-mode
+  "Minor mode to show the title of a tag in the header line.
+Enables/disables making the header line of functions sticky.
+A function (or other tag class specified by
+`semantic-stickyfunc-sticky-classes') has a header line, meaning the
+first line which describes the rest of the construct.  This first
+line is what is displayed in the header line.
+
+With prefix argument ARG, turn on if positive, otherwise off.  The
+minor mode can be turned on only if semantic feature is available and
+the current buffer was set up for parsing.  Return non-nil if the
+minor mode is enabled."
+  ;; Don't need indicator.  It's quite visible
+  :keymap semantic-stickyfunc-mode-map
   (if semantic-stickyfunc-mode
       (progn
        (unless (and (featurep 'semantic) (semantic-active-p))
@@ -892,8 +728,7 @@ text for that function in the header line."
                            semantic-stickyfunc-header-line-format)))
          (set (make-local-variable 'semantic-stickyfunc-old-hlf)
               header-line-format))
-       (setq header-line-format semantic-stickyfunc-header-line-format)
-       )
+       (setq header-line-format semantic-stickyfunc-header-line-format))
     ;; Disable sticky func mode
     ;; Restore previous buffer local value of header line format if
     ;; the current one is the sticky func one.
@@ -901,38 +736,7 @@ text for that function in the header line."
       (kill-local-variable 'header-line-format)
       (when (local-variable-p 'semantic-stickyfunc-old-hlf (current-buffer))
        (setq header-line-format semantic-stickyfunc-old-hlf)
-       (kill-local-variable 'semantic-stickyfunc-old-hlf))))
-  semantic-stickyfunc-mode)
-
-;;;###autoload
-(defun semantic-stickyfunc-mode (&optional arg)
-  "Minor mode to show the title of a tag in the header line.
-Enables/disables making the header line of functions sticky.
-A function (or other tag class specified by
-`semantic-stickyfunc-sticky-classes') has a header line, meaning the
-first line which describes the rest of the construct.  This first
-line is what is displayed in the header line.
-
-With prefix argument ARG, turn on if positive, otherwise off.  The
-minor mode can be turned on only if semantic feature is available and
-the current buffer was set up for parsing.  Return non-nil if the
-minor mode is enabled."
-  (interactive
-   (list (or current-prefix-arg
-             (if semantic-stickyfunc-mode 0 1))))
-  (setq semantic-stickyfunc-mode
-        (if arg
-            (>
-             (prefix-numeric-value arg)
-             0)
-          (not semantic-stickyfunc-mode)))
-  (semantic-stickyfunc-mode-setup)
-  (run-hooks 'semantic-stickyfunc-mode-hook)
-  (if (called-interactively-p 'interactive)
-      (message "Stickyfunc minor mode %sabled"
-               (if semantic-stickyfunc-mode "en" "dis")))
-  (semantic-mode-line-update)
-  semantic-stickyfunc-mode)
+       (kill-local-variable 'semantic-stickyfunc-old-hlf)))))
 
 (defvar semantic-stickyfunc-sticky-classes
   '(function type)
@@ -1012,8 +816,7 @@ Argument EVENT describes the event that caused this function to be called."
 
 
 (semantic-add-minor-mode 'semantic-stickyfunc-mode
-                         "" ;; Don't need indicator.  It's quite visible
-                         semantic-stickyfunc-mode-map)
+                         "") ;; Don't need indicator.  It's quite visible
 
 
 \f
@@ -1025,26 +828,15 @@ Argument EVENT describes the event that caused this function to be called."
 ;; from the tag going off the top of the screen.
 
 ;;;###autoload
-(defun global-semantic-highlight-func-mode (&optional arg)
+(define-minor-mode global-semantic-highlight-func-mode
   "Toggle global use of option `semantic-highlight-func-mode'.
-If ARG is positive, enable, if it is negative, disable.
-If ARG is nil, then toggle."
-  (interactive "P")
-  (setq global-semantic-highlight-func-mode
-        (semantic-toggle-minor-mode-globally
-         'semantic-highlight-func-mode arg)))
-
-;;;###autoload
-(defcustom global-semantic-highlight-func-mode nil
-  "If non-nil, enable global use of `semantic-highlight-func-mode'.
-When enabled, the first line of the current tag is highlighted."
-  :group 'semantic
-  :group 'semantic-modes
-  :type 'boolean
-  :require 'semantic/util-modes
-  :initialize 'custom-initialize-default
-  :set (lambda (sym val)
-         (global-semantic-highlight-func-mode (if val 1 -1))))
+If ARG is positive or nil, enable, if it is negative, disable."
+  :global t :group 'semantic :group 'semantic-modes
+  ;; Not needed because it's autoloaded instead.
+  ;; :require 'semantic/util-modes
+  (semantic-toggle-minor-mode-globally
+   'semantic-highlight-func-mode
+   (if global-semantic-highlight-func-mode 1 -1)))
 
 (defcustom semantic-highlight-func-mode-hook nil
   "Hook run at the end of function `semantic-highlight-func-mode'."
@@ -1108,11 +900,6 @@ Argument EVENT describes the event that caused this function to be called."
       )
     (select-window startwin)))
 
-(defvar semantic-highlight-func-mode nil
-  "Non-nil if highlight-func minor mode is enabled.
-Use the command `semantic-highlight-func-mode' to change this variable.")
-(make-variable-buffer-local 'semantic-highlight-func-mode)
-
 (defvar semantic-highlight-func-ct-overlay nil
   "Overlay used to highlight the tag the cursor is in.")
 (make-variable-buffer-local 'semantic-highlight-func-ct-overlay)
@@ -1126,28 +913,8 @@ Use the command `semantic-highlight-func-mode' to change this variable.")
   "Face used to show the top of current function."
   :group 'semantic-faces)
 
-
-(defun semantic-highlight-func-mode-setup ()
-  "Setup option `semantic-highlight-func-mode'.
-For Semantic enabled buffers, highlight the first line of the
-current tag declaration."
-  (if semantic-highlight-func-mode
-      (progn
-       (unless (and (featurep 'semantic) (semantic-active-p))
-         ;; Disable minor mode if semantic stuff not available
-         (setq semantic-highlight-func-mode nil)
-         (error "Buffer %s was not set up for parsing" (buffer-name)))
-       ;; Setup our hook
-       (add-hook 'post-command-hook 'semantic-highlight-func-highlight-current-tag nil t)
-       )
-    ;; Disable highlight func mode
-    (remove-hook 'post-command-hook 'semantic-highlight-func-highlight-current-tag t)
-    (semantic-highlight-func-highlight-current-tag t)
-    )
-  semantic-highlight-func-mode)
-
 ;;;###autoload
-(defun semantic-highlight-func-mode (&optional arg)
+(define-minor-mode semantic-highlight-func-mode
   "Minor mode to highlight the first line of the current tag.
 Enables/disables making the current function's first line light up.
 A function (or other tag class specified by
@@ -1162,21 +929,20 @@ With prefix argument ARG, turn on if positive, otherwise off.  The
 minor mode can be turned on only if semantic feature is available and
 the current buffer was set up for parsing.  Return non-nil if the
 minor mode is enabled."
-  (interactive
-   (list (or current-prefix-arg
-             (if semantic-highlight-func-mode 0 1))))
-  (setq semantic-highlight-func-mode
-        (if arg
-            (>
-             (prefix-numeric-value arg)
-             0)
-          (not semantic-highlight-func-mode)))
-  (semantic-highlight-func-mode-setup)
-  (run-hooks 'semantic-highlight-func-mode-hook)
-  (if (called-interactively-p 'interactive)
-      (message "Highlight-Func minor mode %sabled"
-               (if semantic-highlight-func-mode "en" "dis")))
-  semantic-highlight-func-mode)
+  :lighter nil ;; Don't need indicator.  It's quite visible.
+  (if semantic-highlight-func-mode
+      (progn
+       (unless (and (featurep 'semantic) (semantic-active-p))
+         ;; Disable minor mode if semantic stuff not available
+         (setq semantic-highlight-func-mode nil)
+         (error "Buffer %s was not set up for parsing" (buffer-name)))
+       ;; Setup our hook
+       (add-hook 'post-command-hook
+                  'semantic-highlight-func-highlight-current-tag nil t))
+    ;; Disable highlight func mode
+    (remove-hook 'post-command-hook
+                 'semantic-highlight-func-highlight-current-tag t)
+    (semantic-highlight-func-highlight-current-tag t)))
 
 (defun semantic-highlight-func-highlight-current-tag (&optional disable)
   "Highlight the current tag under point.
@@ -1223,8 +989,7 @@ function was called, move the overlay."
   nil)
 
 (semantic-add-minor-mode 'semantic-highlight-func-mode
-                         "" ;; Don't need indicator.  It's quite visible
-                         nil)
+                         "") ;; Don't need indicator.  It's quite visible
 
 (provide 'semantic/util-modes)
 
index a903ffd0af15e89ea17bfcea65018538356d99fa..d6c218f2b5a76906f752716fe46fa97b73c10f8c 100644 (file)
@@ -4,6 +4,7 @@
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: codegeneration
+;; Version: 1.0pre7
 
 ;; This file is part of GNU Emacs.
 
index f588eed2bb14c42698f77f744e87141cc7d46df1..f1590ed5ec0e81f4bda2945c45ac170706e391c9 100644 (file)
 
 ;;; Code:
 
-(defcustom global-srecode-minor-mode nil
-  "Non-nil in buffers with Semantic Recoder macro keybindings."
-  :group 'srecode
-  :type 'boolean
-  :require 'srecode/mode
-  :initialize 'custom-initialize-default
-  :set (lambda (sym val)
-         (global-srecode-minor-mode (if val 1 -1))))
-
-(defvar srecode-minor-mode nil
-  "Non-nil in buffers with Semantic Recoder macro keybindings.")
-(make-variable-buffer-local 'srecode-minor-mode)
-
 (defcustom srecode-minor-mode-hook nil
   "Hook run at the end of the function `srecode-minor-mode'."
   :group 'srecode
   "Keymap for srecode minor mode.")
 
 ;;;###autoload
-(defun srecode-minor-mode (&optional arg)
+(define-minor-mode srecode-minor-mode
   "Toggle srecode minor mode.
 With prefix argument ARG, turn on if positive, otherwise off.  The
 minor mode can be turned on only if semantic feature is available and
@@ -158,16 +145,7 @@ the current buffer was set up for parsing.  Return non-nil if the
 minor mode is enabled.
 
 \\{srecode-mode-map}"
-  (interactive
-   (list (or current-prefix-arg
-             (if srecode-minor-mode 0 1))))
-  ;; Flip the bits.
-  (setq srecode-minor-mode
-        (if arg
-            (>
-             (prefix-numeric-value arg)
-             0)
-          (not srecode-minor-mode)))
+  :keymap srecode-mode-map
   ;; If we are turning things on, make sure we have templates for
   ;; this mode first.
   (when srecode-minor-mode
@@ -176,25 +154,20 @@ minor mode is enabled.
                (mapcar (lambda (map)
                          (srecode-map-entries-for-mode map major-mode))
                        (srecode-get-maps))))
-      (setq srecode-minor-mode nil))
-    )
-  ;; Run hooks if we are turning this on.
-  (when srecode-minor-mode
-    (run-hooks 'srecode-minor-mode-hook))
-  srecode-minor-mode)
+      (setq srecode-minor-mode nil))))
 
 ;;;###autoload
-(defun global-srecode-minor-mode (&optional arg)
+(define-minor-mode global-srecode-minor-mode
   "Toggle global use of srecode minor mode.
-If ARG is positive, enable, if it is negative, disable.
-If ARG is nil, then toggle."
-  (interactive "P")
-  (setq global-srecode-minor-mode
-        (semantic-toggle-minor-mode-globally
-         'srecode-minor-mode arg)))
+If ARG is positive or nil, enable, if it is negative, disable."
+  :global t :group 'srecode
+  ;; Not needed because it's autoloaded instead.
+  ;; :require 'srecode/mode
+  (semantic-toggle-minor-mode-globally
+   'srecode-minor-mode (if global-srecode-minor-mode 1 -1)))
 
 ;; Use the semantic minor mode magic stuff.
-(semantic-add-minor-mode 'srecode-minor-mode "" srecode-mode-map)
+(semantic-add-minor-mode 'srecode-minor-mode "")
 
 ;;; Menu Filters
 ;;
index d5d17357ed17feb8d7c9cad4e3832505b5987380..641be4f4d224e47d8e8fbd8131462e4dac5785b7 100644 (file)
@@ -8,6 +8,7 @@
 ;;     Simon Marshall <simon@gnu.org>
 ;; Maintainer: FSF
 ;; Keywords: processes
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
@@ -309,7 +310,6 @@ the function `comint-truncate-buffer' is on `comint-output-filter-functions'."
   :type 'integer
   :group 'comint)
 
-;; FIXME: this should be defcustom
 (defcustom comint-input-ring-size 500
   "Size of the input history ring in `comint-mode'."
   :type 'integer
@@ -340,11 +340,17 @@ This variable is buffer-local."
 ;; Some implementations of passwd use "Password (again)" as the 2nd prompt.
 ;; Something called "perforce" uses "Enter password:".
 (defcustom comint-password-prompt-regexp
-  "\\(\\(Enter \\|[Oo]ld \\|[Nn]ew \\|'s \\|login \\|\
-Kerberos \\|CVS \\|UNIX \\| SMB \\|LDAP \\|\\[sudo] \\|^\\)\
-\[Pp]assword\\( (again)\\)?\\|\
-pass phrase\\|\\(Enter \\|Repeat \\|Bad \\)?[Pp]assphrase\\)\
-\\(?:, try again\\)?\\(?: for [^:]+\\)?:\\s *\\'"
+  (concat
+   "\\("
+   (regexp-opt
+    '("Enter" "Enter same" "Old" "old" "New" "new" "'s" "login"
+      "Kerberos" "CVS" "UNIX" " SMB" "LDAP" "[sudo]" "Repeat" "Bad"))
+   " +\\)?"
+   (regexp-opt
+    '("password" "Password" "passphrase" "Passphrase"
+      "pass phrase" "Pass phrase"))
+   "\\(?:\\(?:, try\\)? *again\\| (empty for no passphrase)\\| (again)\\)?\
+\\(?: for [^:]+\\)?:\\s *\\'")
   "Regexp matching prompts for passwords in the inferior process.
 This is used by `comint-watch-for-password-prompt'."
   :type 'regexp
@@ -669,6 +675,9 @@ Entry to this mode runs the hooks on `comint-mode-hook'."
   (make-local-variable 'comint-process-echoes)
   (make-local-variable 'comint-file-name-chars)
   (make-local-variable 'comint-file-name-quote-list)
+  ;; dir tracking on remote files
+  (set (make-local-variable 'comint-file-name-prefix)
+       (or (file-remote-p default-directory) ""))
   (make-local-variable 'comint-accum-marker)
   (setq comint-accum-marker (make-marker))
   (make-local-variable 'font-lock-defaults)
index 5b01718fc715402b8e88c961c0ecce01051016bd..1ecfec86b5d4d5c8585111e777e740b47efe406a 100644 (file)
@@ -8,6 +8,7 @@
 ;; Author: Kenichi HANDA <handa@etl.go.jp>
 ;; (according to ack.texi)
 ;; Keywords: mule, multilingual, character composition
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
@@ -28,6 +29,8 @@
 
 ;;; Code:
 
+(eval-when-compile (require 'cl))
+
 (defconst reference-point-alist
   '((tl . 0) (tc . 1) (tr . 2)
     (Bl . 3) (Bc . 4) (Br . 5)
@@ -77,7 +80,7 @@ follows (the point `*' corresponds to both reference points):
     +----+-----+ <--- new descent
 
 A composition rule may have the form \(GLOBAL-REF-POINT
-NEW-REF-POINT XOFF YOFF), where XOFF and YOFF specifies how much
+NEW-REF-POINT XOFF YOFF), where XOFF and YOFF specify how much
 to shift NEW-REF-POINT from GLOBAL-REF-POINT.  In this case, XOFF
 and YOFF are integers in the range -100..100 representing the
 shifting percentage against the font size.")
@@ -410,27 +413,6 @@ after a sequence of character events."
 \f
 ;;; Automatic character composition.
 
-;; Copied from font-lock.el.
-(eval-when-compile
-  ;; Borrowed from lazy-lock.el.
-  ;; We use this to preserve or protect things when modifying text properties.
-  (defmacro save-buffer-state (varlist &rest body)
-    "Bind variables according to VARLIST and eval BODY restoring buffer state."
-    `(let* ,(append varlist
-                   '((modified (buffer-modified-p)) (buffer-undo-list t)
-                     (inhibit-read-only t) (inhibit-point-motion-hooks t)
-                     (inhibit-modification-hooks t)
-                     deactivate-mark buffer-file-name buffer-file-truename))
-       ,@body
-       (unless modified
-        (restore-buffer-modified-p nil))))
-  ;; Fixme: This makes bootstrapping fail with this error.
-  ;;   Symbol's function definition is void: eval-defun
-  ;;(def-edebug-spec save-buffer-state let)
-  )
-
-(put 'save-buffer-state 'lisp-indent-function 1)
-
 ;; These macros must match with C macros LGSTRING_XXX and LGLYPH_XXX in font.h
 (defsubst lgstring-header (gstring) (aref gstring 0))
 (defsubst lgstring-set-header (gstring header) (aset gstring 0 header))
@@ -532,12 +514,12 @@ after a sequence of character events."
 
 (defun compose-gstring-for-graphic (gstring)
   "Compose glyph-string GSTRING for graphic display.
-Non-spacing characters are composed with the preceding base
+Combining characters are composed with the preceding base
 character.  If the preceding character is not a base character,
-each non-spacing character is composed as a spacing character by
+each combining character is composed as a spacing character by
 a padding space before and/or after the character.
 
-All non-spacing characters has this function in
+All non-spacing characters have this function in
 `composition-function-table' unless overwritten."
   (let* ((header (lgstring-header gstring))
         (nchars (lgstring-char-len gstring))
@@ -660,16 +642,16 @@ All non-spacing characters has this function in
             [nil 0 compose-gstring-for-graphic])))
   (map-char-table
    #'(lambda (key val)
-       (if (= val 0)
+       (if (memq val '(Mn Mc Me))
           (set-char-table-range composition-function-table key elt)))
-   char-width-table))
+   unicode-category-table))
 
 (defun compose-gstring-for-terminal (gstring)
   "Compose glyph string GSTRING for terminal display.
 Non-spacing characters are composed with the preceding base
 character.  If the preceding character is not a base character,
 each non-spacing character is composed as a spacing character by
-prepending a space before it."
+prepending a space before it."
   (let* ((header (lgstring-header gstring))
         (nchars (lgstring-char-len gstring))
         (nglyphs (lgstring-glyph-len gstring))
@@ -745,14 +727,13 @@ This function is the default value of `auto-composition-function' (which see)."
          (setq func 'compose-gstring-for-terminal))
       (funcall func gstring))))
 
-(make-variable-buffer-local 'auto-composition-mode)
 (put 'auto-composition-mode 'permanent-local t)
 
 (make-variable-buffer-local 'auto-composition-function)
 (setq-default auto-composition-function 'auto-compose-chars)
 
 ;;;###autoload
-(defun auto-composition-mode (&optional arg)
+(define-minor-mode auto-composition-mode
   "Toggle Auto Composition mode.
 With ARG, turn Auto Composition mode off if and only if ARG is a non-positive
 number; if ARG is nil, toggle Auto Composition mode; anything else turns Auto
@@ -762,24 +743,16 @@ When Auto Composition is enabled, text characters are automatically composed
 by functions registered in `composition-function-table' (which see).
 
 You can use `global-auto-composition-mode' to turn on
-Auto Composition mode in all buffers (this is the default)."
-  (interactive "P")
-  (setq auto-composition-mode
-       (if arg
-           (or (not (integerp arg)) (> arg 0))
-         (not auto-composition-mode))))
+Auto Composition mode in all buffers (this is the default).")
 
 ;;;###autoload
-(defun global-auto-composition-mode (&optional arg)
+(define-minor-mode global-auto-composition-mode
   "Toggle Auto-Composition mode in every possible buffer.
 With prefix arg, turn Global-Auto-Composition mode on if and only if arg
 is positive.
 See `auto-composition-mode' for more information on Auto-Composition mode."
-  (interactive "P")
-  (setq-default auto-composition-mode
-               (if arg
-                   (or (not (integerp arg)) (> arg 0))
-                 (not (default-value 'auto-composition-mode)))))
+  :variable (default-value 'auto-composition-mode))
+
 (defalias 'toggle-auto-composition 'auto-composition-mode)
 
 \f
index 249dd51acda2f357d1258a47112d9d6184d8f7d6..230410772ab8464a4271dffc248e67248346fef3 100644 (file)
@@ -5,6 +5,7 @@
 ;;
 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
 ;; Keywords: internal
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
index b815e31f31cb37a0b3ecaf4364b020b6b8c75bf8..a333be289edac31110032864f2d41371f74323ff 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
 ;; Maintainer: FSF
 ;; Keywords: help, faces
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
   "Basic text editing facilities."
   :group 'emacs)
 
+(defgroup convenience nil
+  "Convenience features for faster editing."
+  :group 'emacs)
+
+(defgroup files nil
+  "Support for editing files."
+  :group 'emacs)
+
+(defgroup wp nil
+  "Support for editing text files."
+  :tag "Text"
+  :group 'emacs)
+
+(defgroup data nil
+  "Support for editing binary data files."
+  :group 'emacs)
+
 (defgroup abbrev nil
   "Abbreviation handling, typing shortcuts, macros."
   :tag "Abbreviations"
-  :group 'editing)
+  :group 'convenience)
 
 (defgroup matching nil
   "Various sorts of searching and matching."
 
 (defgroup outlines nil
   "Support for hierarchical outlining."
-  :group 'editing)
+  :group 'wp)
 
 (defgroup external nil
   "Interfacing to external utilities."
   :group 'emacs)
 
+(defgroup comm nil
+  "Communications, networking, and remote access to files."
+  :tag "Communication"
+  :group 'emacs)
+
 (defgroup processes nil
   "Process, subshell, compilation, and job control support."
-  :group 'external
-  :group 'development)
-
-(defgroup convenience nil
-  "Convenience features for faster editing."
-  :group 'emacs)
+  :group 'external)
 
 (defgroup programming nil
   "Support for programming in other languages."
   "Programming tools."
   :group 'programming)
 
-(defgroup oop nil
-  "Support for object-oriented programming."
-  :group 'programming)
-
 (defgroup applications nil
   "Applications written in Emacs."
   :group 'emacs)
   "Fitting Emacs with its environment."
   :group 'emacs)
 
-(defgroup comm nil
-  "Communications, networking, remote access to files."
-  :tag "Communication"
-  :group 'environment)
-
 (defgroup hardware nil
   "Support for interfacing with miscellaneous hardware."
   :group 'environment)
   "Support for Emacs frames and window systems."
   :group 'environment)
 
-(defgroup data nil
-  "Support for editing files of data."
-  :group 'emacs)
-
-(defgroup files nil
-  "Support for editing files."
-  :group 'emacs)
-
-(defgroup wp nil
-  "Word processing."
-  :group 'emacs)
-
 (defgroup tex nil
   "Code related to the TeX formatter."
   :link '(custom-group-link :tag "Font Lock Faces group" font-lock-faces)
   "Support for multiple fonts."
   :group 'emacs)
 
-(defgroup hypermedia nil
-  "Support for links between text or other media types."
-  :group 'emacs)
-
 (defgroup help nil
   "Support for on-line help systems."
   :group 'emacs)
@@ -680,10 +673,11 @@ If `last', order groups after non-groups."
   :group 'custom-browse)
 
 ;;;###autoload
-(defcustom custom-buffer-sort-alphabetically nil
-  "If non-nil, sort each customization group alphabetically in Custom buffer."
+(defcustom custom-buffer-sort-alphabetically t
+  "Whether to sort customization groups alphabetically in Custom buffer."
   :type 'boolean
-  :group 'custom-buffer)
+  :group 'custom-buffer
+  :version "24.1")
 
 (defcustom custom-buffer-order-groups 'last
   "If non-nil, order group members within each customization group.
@@ -746,25 +740,31 @@ groups after non-groups, if nil do not order groups at all."
 (defvar custom-commands
   '(("Set for current session" Custom-set t
      "Apply all settings in this buffer to the current session"
-     "index")
+     "index"
+     "Apply")
     ("Save for future sessions" Custom-save
      (or custom-file user-init-file)
      "Apply all settings in this buffer and save them for future Emacs sessions."
-     "save")
+     "save"
+     "Save")
     ("Undo edits" Custom-reset-current t
      "Restore all settings in this buffer to reflect their current values."
-     "refresh")
+     "refresh"
+     "Undo")
     ("Reset to saved" Custom-reset-saved t
      "Restore all settings in this buffer to their saved values (if any)."
-     "undo")
+     "undo"
+     "Reset")
     ("Erase customizations" Custom-reset-standard
      (or custom-file user-init-file)
      "Un-customize all settings in this buffer and save them with standard values."
-     "delete")
+     "delete"
+     "Uncustomize")
     ("Help for Customize" Custom-help t
      "Get help for using Customize."
-     "help")
-    ("Exit" Custom-buffer-done t "Exit Customize." "exit")))
+     "help"
+     "Help")
+    ("Exit" Custom-buffer-done t "Exit Customize." "exit" "Exit")))
 
 (defun Custom-help ()
   "Read the node on Easy Customization in the Emacs manual."
@@ -1136,7 +1136,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 "22.1"
+(defvar customize-changed-options-previous-release "23.1"
   "Version for `customize-changed-options' to refer back to by default.")
 
 ;; Packages will update this variable, so make it available.
@@ -1382,42 +1382,52 @@ suggest to customize that face, if it's customizable."
       (custom-buffer-create (custom-sort-items found t nil)
                            "*Customize Saved*"))))
 
+(declare-function apropos-parse-pattern "apropos" (pattern))
+
 ;;;###autoload
-(defun customize-apropos (regexp &optional all)
-  "Customize all loaded options, faces and groups matching REGEXP.
-If ALL is `options', include only options.
-If ALL is `faces', include only faces.
-If ALL is `groups', include only groups.
-If ALL is t (interactively, with prefix arg), include variables
+(defun customize-apropos (pattern &optional type)
+  "Customize all 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,
+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 "sCustomize (regexp): \nP")
-  (let ((found nil))
-    (mapatoms (lambda (symbol)
-               (when (string-match regexp (symbol-name symbol))
-                 (when (and (not (memq all '(faces options)))
-                            (get symbol 'custom-group))
-                   (push (list symbol 'custom-group) found))
-                 (when (and (not (memq all '(options groups)))
-                            (custom-facep symbol))
-                   (push (list symbol 'custom-face) found))
-                 (when (and (not (memq all '(groups faces)))
-                            (boundp symbol)
-                            (eq (indirect-variable symbol) symbol)
-                            (or (get symbol 'saved-value)
-                                (custom-variable-p symbol)
-                                (and (not (memq all '(nil options)))
-                                     (get symbol 'variable-documentation))))
-                   (push (list symbol 'custom-variable) found)))))
+  (interactive (list (apropos-read-pattern "symbol") current-prefix-arg))
+  (require 'apropos)
+  (apropos-parse-pattern pattern)
+  (let (found tests)
+    (mapatoms
+     `(lambda (symbol)
+       (when (string-match apropos-regexp (symbol-name symbol))
+         ,(if (not (memq type '(faces options)))
+              '(if (get symbol 'custom-group)
+                   (push (list symbol 'custom-group) found)))
+         ,(if (not (memq type '(options groups)))
+              '(if (custom-facep symbol)
+                   (push (list symbol 'custom-face) found)))
+         ,(if (not (memq type '(groups faces)))
+              `(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))))
+                   (push (list symbol 'custom-variable) found))))))
     (if (not found)
        (error "No %s matching %s"
-               (if (eq all t)
-                   "items"
-                 (format "customizable %s"
-                         (if (memq all '(options faces groups))
-                             (symbol-name all)
-                           "items")))
-               regexp)
+              (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*"))))
@@ -1540,6 +1550,12 @@ This button will have a menu with all three reset operations."
 (defvar custom-button-pressed nil
   "Face used for pressed buttons in customization buffers.")
 
+(defcustom custom-search-field t
+  "If non-nil, show a search field in Custom buffers."
+  :type 'boolean
+  :version "24.1"
+  :group 'custom-buffer)
+
 (defcustom custom-raised-buttons (not (equal (face-valid-attribute-values :box)
                                             '(("unspecified" . unspecified))))
   "If non-nil, indicate active buttons in a `raised-button' style.
@@ -1563,14 +1579,9 @@ 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 "Editing a setting changes only the text in this buffer."
-                    (if init-file
-                        "
-To apply your changes, use the Save or Set buttons.
-Saving a change normally works by editing your init file."
-                      "
-Currently, these settings cannot be saved for future Emacs sessions,
-possibly because you started Emacs with `-q'.")
+      (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 ")
       (widget-create 'custom-manual
                     :tag "Saving Customizations"
@@ -1582,6 +1593,26 @@ possibly because you started Emacs with `-q'.")
                     "(emacs)Top")
       (widget-insert "."))
     (widget-insert "\n")
+
+    ;; Insert the search field.
+    (when custom-search-field
+      (widget-insert "\n")
+      (let* ((echo "Search for custom items")
+            (search-widget
+             (widget-create
+              'editable-field
+              :size 40 :help-echo echo
+              :action `(lambda (widget &optional event)
+                         (customize-apropos (widget-value widget))))))
+       (widget-insert " ")
+       (widget-create-child-and-convert
+        search-widget 'push-button
+        :tag "Search"
+        :help-echo echo :action
+        (lambda (widget &optional event)
+          (customize-apropos (widget-value (widget-get widget :parent)))))
+       (widget-insert "\n")))
+
     ;; The custom command buttons are also in the toolbar, so for a
     ;; time they were not inserted in the buffer if the toolbar was in use.
     ;; But it can be a little confusing for the buffer layout to
@@ -1589,11 +1620,10 @@ possibly because you started Emacs with `-q'.")
     ;; mention that a custom buffer can in theory be created in a
     ;; frame with a toolbar, then later viewed in one without.
     ;; So now the buttons are always inserted in the buffer.  (Bug#1326)
-;;;    (when (not (and (bound-and-true-p tool-bar-mode) (display-graphic-p)))
     (if custom-buffer-verbose-help
-       (widget-insert "\n
- Operate on all settings in this buffer that are not marked HIDDEN:\n"))
-    (let ((button (lambda (tag action active help icon)
+       (widget-insert "
+ 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
@@ -1988,63 +2018,64 @@ and `face'."
                   (nth 3 entry)))
         (form (widget-get parent :custom-form))
         children)
-    (while (string-match "\\`\\(.*\\)%c\\(.*\\)\\'" text)
-      (setq text (concat (match-string 1 text)
-                        (symbol-name category)
-                        (match-string 2 text))))
-    (when (and custom-magic-show
-              (or (not hidden)
-                  (memq category custom-magic-show-hidden)))
-      (insert "   ")
+    (unless (eq state 'hidden)
+      (while (string-match "\\`\\(.*\\)%c\\(.*\\)\\'" text)
+       (setq text (concat (match-string 1 text)
+                          (symbol-name category)
+                          (match-string 2 text))))
+      (when (and custom-magic-show
+                (or (not hidden)
+                    (memq category custom-magic-show-hidden)))
+       (insert "   ")
+       (when (and (eq category 'group)
+                  (not (and (eq custom-buffer-style 'links)
+                            (> (widget-get parent :custom-level) 1))))
+         (insert-char ?\  (* custom-buffer-indent
+                             (widget-get parent :custom-level))))
+       (push (widget-create-child-and-convert
+              widget 'choice-item
+              :help-echo "Change the state of this item."
+              :format (if hidden "%t" "%[%t%]")
+              :button-prefix 'widget-push-button-prefix
+              :button-suffix 'widget-push-button-suffix
+              :mouse-down-action 'widget-magic-mouse-down-action
+              :tag "State")
+             children)
+       (insert ": ")
+       (let ((start (point)))
+         (if (eq custom-magic-show 'long)
+             (insert text)
+           (insert (symbol-name state)))
+         (cond ((eq form 'lisp)
+                (insert " (lisp)"))
+               ((eq form 'mismatch)
+                (insert " (mismatch)")))
+         (put-text-property start (point) 'face 'custom-state))
+       (insert "\n"))
       (when (and (eq category 'group)
                 (not (and (eq custom-buffer-style 'links)
                           (> (widget-get parent :custom-level) 1))))
        (insert-char ?\  (* custom-buffer-indent
                            (widget-get parent :custom-level))))
-      (push (widget-create-child-and-convert
-            widget 'choice-item
-            :help-echo "Change the state of this item."
-            :format (if hidden "%t" "%[%t%]")
-            :button-prefix 'widget-push-button-prefix
-            :button-suffix 'widget-push-button-suffix
-            :mouse-down-action 'widget-magic-mouse-down-action
-            :tag "State")
-           children)
-      (insert ": ")
-      (let ((start (point)))
-       (if (eq custom-magic-show 'long)
-           (insert text)
-         (insert (symbol-name state)))
-       (cond ((eq form 'lisp)
-              (insert " (lisp)"))
-             ((eq form 'mismatch)
-              (insert " (mismatch)")))
-       (put-text-property start (point) 'face 'custom-state))
-      (insert "\n"))
-    (when (and (eq category 'group)
-              (not (and (eq custom-buffer-style 'links)
-                        (> (widget-get parent :custom-level) 1))))
-      (insert-char ?\  (* custom-buffer-indent
-                         (widget-get parent :custom-level))))
-    (when custom-magic-show-button
-      (when custom-magic-show
-       (let ((indent (widget-get parent :indent)))
-         (when indent
-           (insert-char ?  indent))))
-      (push (widget-create-child-and-convert
-            widget 'choice-item
-            :mouse-down-action 'widget-magic-mouse-down-action
-            :button-face face
-            :button-prefix ""
-            :button-suffix ""
-            :help-echo "Change the state."
-            :format (if hidden "%t" "%[%t%]")
-            :tag (if (memq form '(lisp mismatch))
-                     (concat "(" magic ")")
-                   (concat "[" magic "]")))
-           children)
-      (insert " "))
-    (widget-put widget :children children)))
+      (when custom-magic-show-button
+       (when custom-magic-show
+         (let ((indent (widget-get parent :indent)))
+           (when indent
+             (insert-char ?  indent))))
+       (push (widget-create-child-and-convert
+              widget 'choice-item
+              :mouse-down-action 'widget-magic-mouse-down-action
+              :button-face face
+              :button-prefix ""
+              :button-suffix ""
+              :help-echo "Change the state."
+              :format (if hidden "%t" "%[%t%]")
+              :tag (if (memq form '(lisp mismatch))
+                       (concat "(" magic ")")
+                     (concat "[" magic "]")))
+             children)
+       (insert " "))
+      (widget-put widget :children children))))
 
 (defun custom-magic-reset (widget)
   "Redraw the :custom-magic property of WIDGET."
@@ -2206,12 +2237,9 @@ and `face'."
 (defun custom-show (widget value)
   "Non-nil if WIDGET should be shown with VALUE by default."
   (let ((show (widget-get widget :custom-show)))
-    (cond ((null show)
-          nil)
-         ((eq t show)
-          t)
-         (t
-          (funcall show widget value)))))
+    (if (functionp show)
+       (funcall show widget value)
+      show)))
 
 (defun custom-load-widget (widget)
   "Load all dependencies for WIDGET."
@@ -2289,8 +2317,7 @@ Insert PREFIX first if non-nil."
               (insert ", "))))
       (widget-put widget :buttons buttons))))
 
-(defun custom-add-parent-links (widget &optional initial-string
-                                      doc-initial-string)
+(defun custom-add-parent-links (widget &optional initial-string doc-initial-string)
   "Add \"Parent groups: ...\" to WIDGET if the group has parents.
 The value is non-nil if any parents were found.
 If INITIAL-STRING is non-nil, use that rather than \"Parent groups:\"."
@@ -2309,36 +2336,6 @@ If INITIAL-STRING is non-nil, use that rather than \"Parent groups:\"."
                         symbol)
                        buttons)
                  (setq parents (cons symbol parents)))))
-    (and (null (get name 'custom-links)) ;No links of its own.
-         (= (length parents) 1)         ;A single parent.
-         (let* ((links (delq nil (mapcar (lambda (w)
-                                          (unless (eq (widget-type w)
-                                                      'custom-group-link)
-                                            w))
-                                        (get (car parents) 'custom-links))))
-                (many (> (length links) 2)))
-           (when links
-             (let ((pt (point))
-                   (left-margin (+ left-margin 2)))
-              (insert "\n" (or doc-initial-string "Group documentation:") " ")
-              (while links
-                (push (widget-create-child-and-convert
-                       widget (car links)
-                       :button-face 'custom-link
-                       :mouse-face 'highlight
-                       :pressed-face 'highlight)
-                      buttons)
-                (setq links (cdr links))
-                (cond ((null links)
-                       (insert ".\n"))
-                      ((null (cdr links))
-                       (if many
-                           (insert ", and ")
-                         (insert " and ")))
-                      (t
-                        (insert ", "))))
-               (fill-region-as-paragraph pt (point))
-               (delete-to-left-margin (1+ pt) (+ pt 2))))))
     (if parents
         (insert "\n")
       (delete-region start (point)))
@@ -2413,8 +2410,6 @@ If INITIAL-STRING is non-nil, use that rather than \"Parent groups:\"."
 
 ;;; The `custom-variable' Widget.
 
-;; When this was underlined blue, users confused it with a
-;; Mosaic-style hyperlink...
 (defface custom-variable-tag
   `((((class color)
       (background dark))
@@ -2459,7 +2454,11 @@ However, setting it through Custom sets the default value.")
     (documentation-property variable 'variable-documentation)))
 
 (define-widget 'custom-variable 'custom
-  "Customize variable."
+  "A widget for displaying a Custom variable.
+
+The following property has a special meaning for this widget:
+:hidden-states - A list of widget states for which the widget's initial
+                 contents should be hidden."
   :format "%v"
   :help-echo "Set or reset this variable."
   :documentation-property #'custom-variable-documentation
@@ -2469,6 +2468,7 @@ However, setting it through Custom sets the default value.")
   :custom-form nil ; defaults to value of `custom-variable-default-form'
   :value-create 'custom-variable-value-create
   :action 'custom-variable-action
+  :hidden-states '(standard)
   :custom-set 'custom-variable-set
   :custom-mark-to-save 'custom-variable-mark-to-save
   :custom-reset-current 'custom-redraw
@@ -2503,7 +2503,6 @@ try matching its doc string against `custom-guess-doc-alist'."
   (let* ((buttons (widget-get widget :buttons))
         (children (widget-get widget :children))
         (form (widget-get widget :custom-form))
-        (state (widget-get widget :custom-state))
         (symbol (widget-get widget :value))
         (tag (widget-get widget :tag))
         (type (custom-variable-type symbol))
@@ -2513,17 +2512,17 @@ try matching its doc string against `custom-guess-doc-alist'."
         (last (widget-get widget :custom-last))
         (value (if (default-boundp symbol)
                    (funcall get symbol)
-                 (widget-get conv :value))))
-    ;; If the widget is new, the child determines whether it is hidden.
-    (cond (state)
-         ((custom-show type value)
-          (setq state 'unknown))
-         (t
-          (setq state 'hidden)))
+                 (widget-get conv :value)))
+        (state (or (widget-get widget :custom-state)
+                   (if (memq (custom-variable-state symbol value)
+                             (widget-get widget :hidden-states))
+                       'hidden))))
+
     ;; If we don't know the state, see if we need to edit it in lisp form.
+    (unless state
+      (setq state (if (custom-show type value) 'unknown 'hidden)))
     (when (eq state 'unknown)
       (unless (widget-apply conv :match value)
-       ;; (widget-apply (widget-convert type) :match value)
        (setq form 'mismatch)))
     ;; Now we can create the child widget.
     (cond ((eq custom-buffer-style 'tree)
@@ -2536,21 +2535,36 @@ try matching its doc string against `custom-guess-doc-alist'."
          ((eq state 'hidden)
           ;; Indicate hidden value.
           (push (widget-create-child-and-convert
-                 widget 'item
-                 :format "%{%t%}: "
-                 :sample-face 'custom-variable-tag
-                 :tag tag
-                 :parent widget)
-                buttons)
-          (push (widget-create-child-and-convert
-                 widget 'visibility
+                 widget 'custom-visibility
                  :help-echo "Show the value of this option."
+                 :on-image "down"
+                 :on "Hide"
+                 :off-image "right"
                  :off "Show Value"
                  :action 'custom-toggle-parent
                  nil)
+                buttons)
+          (insert " ")
+          (push (widget-create-child-and-convert
+                 widget 'item
+                 :format "%{%t%} "
+                 :sample-face 'custom-variable-tag
+                 :tag tag
+                 :parent widget)
                 buttons))
          ((memq form '(lisp mismatch))
           ;; In lisp mode edit the saved value when possible.
+          (push (widget-create-child-and-convert
+                 widget 'custom-visibility
+                 :help-echo "Hide the value of this option."
+                 :on "Hide"
+                 :off "Show"
+                 :on-image "down"
+                 :off-image "right"
+                 :action 'custom-toggle-parent
+                 t)
+                buttons)
+          (insert " ")
           (let* ((value (cond ((get symbol 'saved-value)
                                (car (get symbol 'saved-value)))
                               ((get symbol 'standard-value)
@@ -2560,15 +2574,6 @@ try matching its doc string against `custom-guess-doc-alist'."
                               (t
                                (custom-quote (widget-get conv :value))))))
             (insert (symbol-name symbol) ": ")
-            (push (widget-create-child-and-convert
-                   widget 'visibility
-                   :help-echo "Hide the value of this option."
-                   :on "Hide Value"
-                   :off "Show Value"
-                   :action 'custom-toggle-parent
-                   t)
-                  buttons)
-            (insert " ")
             (push (widget-create-child-and-convert
                    widget 'sexp
                    :button-face 'custom-variable-button-face
@@ -2579,6 +2584,17 @@ try matching its doc string against `custom-guess-doc-alist'."
                   children)))
          (t
           ;; Edit mode.
+          (push (widget-create-child-and-convert
+                 widget 'custom-visibility
+                 :help-echo "Hide or show this option."
+                 :on "Hide"
+                 :off "Show"
+                 :on-image "down"
+                 :off-image "right"
+                 :action 'custom-toggle-parent
+                 t)
+                buttons)
+          (insert " ")
           (let* ((format (widget-get type :format))
                  tag-format value-format)
             (unless (string-match ":" format)
@@ -2595,15 +2611,6 @@ try matching its doc string against `custom-guess-doc-alist'."
                    :sample-face 'custom-variable-tag
                    tag)
                   buttons)
-            (insert " ")
-            (push (widget-create-child-and-convert
-                   widget 'visibility
-                   :help-echo "Hide the value of this option."
-                   :on "Hide Value"
-                   :off "Show Value"
-                   :action 'custom-toggle-parent
-                   t)
-                  buttons)
             (push (widget-create-child-and-convert
                    widget type
                    :format value-format
@@ -2635,7 +2642,7 @@ try matching its doc string against `custom-guess-doc-alist'."
          ;; Don't push it !!! Custom assumes that the first child is the
          ;; value one.
          (setq children (append children (list comment-widget)))))
-      ;; Update the rest of the properties properties.
+      ;; Update the rest of the properties.
       (widget-put widget :custom-form form)
       (widget-put widget :children children)
       ;; Now update the state.
@@ -2658,61 +2665,69 @@ try matching its doc string against `custom-guess-doc-alist'."
   (apply 'widget-apply (car (widget-get (widget-get widget :parent) :children))
         :mouse-down-action args))
 
-(defun custom-variable-state-set (widget)
-  "Set the state of WIDGET."
-  (let* ((symbol (widget-value widget))
-        (get (or (get symbol 'custom-get) 'default-value))
+(defun custom-variable-state (symbol val)
+  "Return the state of SYMBOL if its value is VAL.
+If SYMBOL has a non-nil `custom-get' property, it overrides VAL.
+Possible return values are `standard', `saved', `set', `themed',
+`changed', and `rogue'."
+  (let* ((get (or (get symbol 'custom-get) 'default-value))
         (value (if (default-boundp symbol)
                    (funcall get symbol)
-                 (widget-get widget :value)))
+                 val))
         (comment (get symbol 'variable-comment))
         tmp
-        temp
-        (state (cond ((progn (setq tmp (get symbol 'customized-value))
-                             (setq temp
-                                   (get symbol 'customized-variable-comment))
-                             (or tmp temp))
-                      (if (condition-case nil
-                              (and (equal value (eval (car tmp)))
-                                   (equal comment temp))
-                            (error nil))
-                          'set
-                        'changed))
-                     ((progn (setq tmp (get symbol 'theme-value))
-                             (setq temp (get symbol 'saved-variable-comment))
-                             (or tmp temp))
-                      (if (condition-case nil
-                              (and (equal comment temp)
-                                   (equal value
-                                          (eval
-                                           (car (custom-variable-theme-value
-                                                 symbol)))))
-                            (error nil))
-                          (cond
-                           ((eq (caar tmp) 'user) 'saved)
-                           ((eq (caar tmp) 'changed)
-                             (if (condition-case nil
-                                     (and (null comment)
-                                          (equal value
-                                                 (eval
-                                                  (car (get symbol 'standard-value)))))
-                                   (error nil))
-                                 ;; The value was originally set outside
-                                 ;; custom, but it was set to the standard
-                                 ;; value (probably an autoloaded defcustom).
-                                 'standard
-                               'changed))
-                           (t 'themed))
-                        'changed))
-                     ((setq tmp (get symbol 'standard-value))
-                      (if (condition-case nil
-                              (and (equal value (eval (car tmp)))
-                                   (equal comment nil))
-                            (error nil))
-                          'standard
-                        'changed))
-                     (t 'rogue))))
-    (widget-put widget :custom-state state)))
+        temp)
+    (cond ((progn (setq tmp (get symbol 'customized-value))
+                 (setq temp
+                       (get symbol 'customized-variable-comment))
+                 (or tmp temp))
+          (if (condition-case nil
+                  (and (equal value (eval (car tmp)))
+                       (equal comment temp))
+                (error nil))
+              'set
+            'changed))
+         ((progn (setq tmp (get symbol 'theme-value))
+                 (setq temp (get symbol 'saved-variable-comment))
+                 (or tmp temp))
+          (if (condition-case nil
+                  (and (equal comment temp)
+                       (equal value
+                              (eval
+                               (car (custom-variable-theme-value
+                                     symbol)))))
+                (error nil))
+              (cond
+               ((eq (caar tmp) 'user) 'saved)
+               ((eq (caar tmp) 'changed)
+                (if (condition-case nil
+                        (and (null comment)
+                             (equal value
+                                    (eval
+                                     (car (get symbol 'standard-value)))))
+                      (error nil))
+                    ;; The value was originally set outside
+                    ;; custom, but it was set to the standard
+                    ;; value (probably an autoloaded defcustom).
+                    'standard
+                  'changed))
+               (t 'themed))
+            'changed))
+         ((setq tmp (get symbol 'standard-value))
+          (if (condition-case nil
+                  (and (equal value (eval (car tmp)))
+                       (equal comment nil))
+                (error nil))
+              'standard
+            'changed))
+         (t 'rogue))))
+
+(defun custom-variable-state-set (widget &optional state)
+  "Set the state of WIDGET to STATE.
+If STATE is nil, the value is computed by `custom-variable-state'."
+  (widget-put widget :custom-state
+             (or state (custom-variable-state (widget-value widget)
+                                              (widget-get widget :value)))))
 
 (defun custom-variable-standard-value (widget)
   (get (widget-value widget) 'standard-value))
@@ -2998,7 +3013,9 @@ to switch between two values."
   :button-face 'custom-visibility
   :pressed-face 'custom-visibility
   :mouse-face 'highlight
-  :pressed-face 'highlight)
+  :pressed-face 'highlight
+  :on-image nil
+  :off-image nil)
 
 (defface custom-visibility
   '((t :height 0.8 :inherit link))
@@ -3345,6 +3362,18 @@ SPEC must be a full face spec."
           (insert " " tag "\n")
           (widget-put widget :buttons buttons))
          (t
+          ;; Visibility.
+          (push (widget-create-child-and-convert
+                 widget 'custom-visibility
+                 :help-echo "Hide or show this face."
+                 :on "Hide"
+                 :off "Show"
+                 :on-image "down"
+                 :off-image "right"
+                 :action 'custom-toggle-parent
+                 (not (eq state 'hidden)))
+                buttons)
+          (insert " ")
           ;; Create tag.
           (insert tag)
           (widget-specify-sample widget begin (point))
@@ -3359,16 +3388,6 @@ SPEC must be a full face spec."
                                                  :sample-face symbol
                                                  :tag "sample")
                 buttons)
-          ;; Visibility.
-          (insert " ")
-          (push (widget-create-child-and-convert
-                 widget 'visibility
-                 :help-echo "Hide or show this face."
-                 :on "Hide Face"
-                 :off "Show Face"
-                 :action 'custom-toggle-parent
-                 (not (eq state 'hidden)))
-                buttons)
           ;; Magic.
           (insert "\n")
           (let ((magic (widget-create-child-and-convert
@@ -3920,8 +3939,11 @@ If GROUPS-ONLY non-nil, return only those members that are groups."
             (insert " " tag "\n")
             (widget-put widget :buttons buttons)
             (message "Creating group...")
-            (let* ((members (custom-sort-items members
-                             custom-browse-sort-alphabetically
+            (let* ((members (custom-sort-items
+                             members
+                             ;; Never sort the top-level custom group.
+                             (unless (eq symbol 'emacs)
+                               custom-browse-sort-alphabetically)
                              custom-browse-order-groups))
                    (prefixes (widget-get widget :custom-prefixes))
                    (custom-prefix-list (custom-prefix-add symbol prefixes))
@@ -3979,17 +4001,21 @@ If GROUPS-ONLY non-nil, return only those members that are groups."
 
          ;; Nested style.
          (t                            ;Visible.
+          ;; Draw a horizontal line (this works for both graphical
+          ;; and text displays):
+          (let ((p (point)))
+            (insert "\n")
+            (put-text-property p (1+ p) 'face '(:underline t))
+            (overlay-put (make-overlay p (1+ p))
+                         'before-string
+                         (propertize "\n" 'face '(:underline t)
+                                     'display '(space :align-to 999))))
+
           ;; Add parent groups references above the group.
-          (if t    ;;; This should test that the buffer
-                   ;;; was made to display a group.
-              (when (eq level 1)
-                (if (custom-add-parent-links widget
-                                             "Parent groups:"
-                                             "Parent group documentation:")
-                    (insert "\n"))))
-          ;; Create level indicator.
+          (when (eq level 1)
+            (if (custom-add-parent-links widget "Parent groups:")
+                (insert "\n")))
           (insert-char ?\  (* custom-buffer-indent (1- level)))
-          (insert "/- ")
           ;; Create tag.
           (let ((start (point)))
             (insert tag " group: ")
@@ -4009,12 +4035,7 @@ If GROUPS-ONLY non-nil, return only those members that are groups."
                    (not (eq state 'hidden)))
                   buttons)
             (insert " "))
-          ;; Create more dashes.
-          ;; Use 76 instead of 75 to compensate for the temporary "<"
-          ;; added by `widget-insert'.
-          (insert-char ?- (- 76 (current-column)
-                             (* custom-buffer-indent level)))
-          (insert "\\\n")
+          (insert "\n")
           ;; Create magic button.
           (let ((magic (widget-create-child-and-convert
                         widget 'custom-magic
@@ -4040,43 +4061,50 @@ If GROUPS-ONLY non-nil, return only those members that are groups."
                                             ?\ ))
           ;; Members.
           (message "Creating group...")
-          (let* ((members (custom-sort-items members
-                                             custom-buffer-sort-alphabetically
-                                             custom-buffer-order-groups))
+          (let* ((members (custom-sort-items
+                           members
+                           ;; Never sort the top-level custom group.
+                           (unless (eq symbol 'emacs)
+                             custom-buffer-sort-alphabetically)
+                           custom-buffer-order-groups))
                  (prefixes (widget-get widget :custom-prefixes))
                  (custom-prefix-list (custom-prefix-add symbol prefixes))
-                 (length (length members))
+                 (len (length members))
                  (count 0)
-                 (children (mapcar (lambda (entry)
-                                     (widget-insert "\n")
-                                     (message "\
-Creating group members... %2d%%"
-                                              (/ (* 100.0 count) length))
-                                     (setq count (1+ count))
-                                     (prog1
-                                         (widget-create-child-and-convert
-                                          widget (nth 1 entry)
-                                          :group widget
-                                          :tag (custom-unlispify-tag-name
-                                                (nth 0 entry))
-                                          :custom-prefixes custom-prefix-list
-                                          :custom-level (1+ level)
-                                          :value (nth 0 entry))
-                                       (unless (eq (preceding-char) ?\n)
-                                         (widget-insert "\n"))))
-                                   members)))
-            (message "Creating group magic...")
+                 (reporter (make-progress-reporter
+                            "Creating group entries..." 0 len))
+                 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))
+                           hidden-p)
+                       (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))
             (mapc 'custom-magic-reset children)
-            (message "Creating group state...")
             (widget-put widget :children children)
             (custom-group-state-update widget)
-            (message "Creating group... done"))
+            (progress-reporter-done reporter))
           ;; End line
-          (insert "\n")
-          (insert-char ?\  (* custom-buffer-indent (1- level)))
-          (insert "\\- " (widget-get widget :tag) " group end ")
-          (insert-char ?- (- 75 (current-column) (* custom-buffer-indent level)))
-          (insert "/\n")))))
+          (let ((p (1+ (point))))
+            (insert "\n\n")
+            (put-text-property p (1+ p) 'face '(:underline t))
+            (overlay-put (make-overlay p (1+ p))
+                         'before-string
+                         (propertize "\n" 'face '(:underline t)
+                                     'display '(space :align-to 999))))))))
 
 (defvar custom-group-menu
   `(("Set for Current Session" custom-group-set
@@ -4377,10 +4405,10 @@ This function does not save the buffer."
       (unless (bolp)
        (princ "\n"))
       (princ "(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.\n")
+ ;; custom-set-variables was added by Custom.
+ ;; If you edit it by hand, you could mess it up, so be careful.
+ ;; Your init file should contain only one such instance.
+ ;; If there is more than one, they won't work right.\n")
       (dolist (symbol saved-list)
        (let ((spec (car-safe (get symbol 'theme-value)))
              (value (get symbol 'saved-value))
@@ -4453,10 +4481,10 @@ This function does not save the buffer."
       (unless (bolp)
        (princ "\n"))
       (princ "(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.\n")
+ ;; custom-set-faces was added by Custom.
+ ;; If you edit it by hand, you could mess it up, so be careful.
+ ;; Your init file should contain only one such instance.
+ ;; If there is more than one, they won't work right.\n")
       (dolist (symbol saved-list)
        (let ((spec (car-safe (get symbol 'theme-face)))
              (value (get symbol 'saved-face))
@@ -4659,7 +4687,8 @@ if that value is non-nil."
             (mapc
              (lambda (arg)
                (tool-bar-local-item-from-menu
-                (nth 1 arg) (nth 4 arg) map custom-mode-map))
+                (nth 1 arg) (nth 4 arg) map custom-mode-map
+                :label (nth 5 arg)))
              custom-commands)
             (setq custom-tool-bar-map map))))
   (make-local-variable 'custom-options)
index 5cb808c2e38e40191195bd4e1e7113b5ad958e40..f6a07507f2cf64dcaab75b93f940b440c0f09529 100644 (file)
@@ -5,6 +5,7 @@
 ;;
 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
 ;; Keywords: help, faces
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
index 30678a09bb83a5ffc207af0027eef2fd849def72..161de5e78ec63e89572cce6354bde880d79aa0e2 100644 (file)
@@ -5,6 +5,7 @@
 ;;
 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
 ;; Keywords: internal
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
@@ -197,6 +198,11 @@ Leaving \"Default\" unchecked is equivalent with specifying a default of
             (help-char keyboard character)
             (help-event-list keyboard (repeat (sexp :format "%v")))
             (menu-prompting menu boolean)
+            (select-active-regions killing
+                                   (choice (const :tag "always" t)
+                                           (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")))
@@ -339,6 +345,16 @@ since it could result in memory overflow and make Emacs crash."
                       (const :tag "Off (nil)" :value nil)
                       (const :tag "Immediate" :value t)
                       (number :tag "Delay by secs" :value 0.5)) "22.1")
+             (tool-bar-style
+             frames (choice
+                     (const :tag "Images" :value image)
+                     (const :tag "Text" :value text)
+                     (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")
+
             ;; xfaces.c
             (scalable-fonts-allowed display boolean "22.1")
             ;; xfns.c
@@ -348,6 +364,7 @@ since it could result in memory overflow and make Emacs crash."
             (x-gtk-show-hidden-files menu boolean "22.1")
             (x-gtk-file-dialog-help-text menu boolean "22.1")
             (x-gtk-whole-detached-tool-bar x boolean "22.1")
+            (x-gtk-use-system-tooltips tooltip boolean "23.3")
             ;; xterm.c
             (x-use-underline-position-properties display boolean "22.1")
             (x-underline-at-descent-line display boolean "22.1")
@@ -399,6 +416,10 @@ since it could result in memory overflow and make Emacs crash."
                       (fboundp 'define-fringe-bitmap))
                      ((equal "font-use-system-font" (symbol-name symbol))
                       (featurep 'system-font-setting))
+                     ;; Conditioned on x-create-frame, because that's
+                     ;; the condition for loadup.el to preload tool-bar.el.
+                     ((string-match "tool-bar-" (symbol-name symbol))
+                      (fboundp 'x-create-frame))
                      (t t))))
     (if (not (boundp symbol))
        ;; If variables are removed from C code, give an error here!
index 0fb6e485de14137212d56227f62e42c51b036bca..77ea09cfe9a074639a830b661edd64fae03c740f 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Alex Schroeder <alex@gnu.org>
 ;; Maintainer: FSF
 ;; Keywords: help, faces
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
index 2484ee26f2136dfec5274d024d5fc34ea70769e0..d6ecc6dfbd502f3121471231cfa593df19f5106b 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
 ;; Maintainer: FSF
 ;; Keywords: help, faces
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
@@ -143,7 +144,9 @@ set to nil, as the value is no longer rogue."
   (when (get symbol 'force-value)
     (put symbol 'force-value nil))
   (when doc
-    (put symbol 'variable-documentation doc))
+    (if (keywordp doc)
+       (error "Doc string is missing")
+      (put symbol 'variable-documentation doc)))
   (let ((initialize 'custom-initialize-reset)
        (requests nil))
     (unless (memq :group args)
@@ -304,7 +307,7 @@ _outside_ any bindings for these variables.  \(`defvar' and
 
 See Info node `(elisp) Customization' in the Emacs Lisp manual
 for more information."
-  (declare (doc-string 3))
+  (declare (doc-string 3) (debug (name body)))
   ;; It is better not to use backquote in this file,
   ;; because that makes a bootstrapping problem
   ;; if you need to recompile all the Lisp files using interpreted code.
index 250d87a6ae6f88b52c28d284d70826fc37abeb98..93c69e0eea5510551a5ecff029ea5b4b1abf4b2d 100644 (file)
@@ -618,7 +618,7 @@ as well as widgets, buttons, overlays, and text properties."
               ,@(if (not eight-bit-p)
                     (let ((unicodedata (describe-char-unicode-data char)))
                       (if unicodedata
-                          (cons (list "Unicode data" " ") unicodedata))))))
+                          (cons (list "Unicode data" "") unicodedata))))))
       (setq max-width (apply 'max (mapcar (lambda (x)
                                             (if (cadr x) (length (car x)) 0))
                                           item-list)))
@@ -642,7 +642,8 @@ as well as widgets, buttons, overlays, and text properties."
                               (window-width))
                       (insert "\n")
                       (indent-to (1+ max-width)))
-                    (insert " " clm)))
+                    (unless (zerop (length clm))
+                      (insert " " clm))))
                 (insert "\n"))))
 
           (when overlays
index 60bc044696bc54be2caa28a16b3906c54975d136..8f0b8075cdf1604c92969d2c83e015ffdf529adc 100644 (file)
@@ -622,7 +622,10 @@ is nil, ask the user where to save the desktop."
   (when (and desktop-save-mode
              (let ((exists (file-exists-p (desktop-full-file-name))))
                (or (eq desktop-save t)
-                   (and exists (memq desktop-save '(ask-if-new if-exists)))
+                   (and exists (eq desktop-save 'if-exists))
+                  ;; If it exists, but we aren't using it, we are going
+                  ;; to ask for a new directory below.
+                   (and exists desktop-dirname (eq desktop-save 'ask-if-new))
                    (and
                     (or (memq desktop-save '(ask ask-if-new))
                         (and exists (eq desktop-save 'ask-if-exists)))
index 62d6928c024594a08501eaa8adde838d5137c442..f4b79414c6ad9512bbda2ff0a135e5ceedcd6865 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Sebastian Kremer <sk@thp.uni-koeln.de>.
 ;; Maintainer: FSF
 ;; Keywords: files
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
index f919840e65da9903f7a1ea2a386d8e9b9f35767e..45fdda71356994cf79018a1fa0bcc2e024745b87 100644 (file)
@@ -7,6 +7,7 @@
 ;;     Lawrence R. Dodd <dodd@roebling.poly.edu>
 ;; Maintainer: Romain Francoise <rfrancoise@gnu.org>
 ;; Keywords: dired extensions files
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
@@ -163,7 +164,13 @@ With numeric ARG, enable Dired-Omit mode if ARG is positive, disable
 otherwise.  Enabling and disabling is buffer-local.
 If enabled, \"uninteresting\" files are not listed.
 Uninteresting files are those whose filenames match regexp `dired-omit-files',
-plus those ending with extensions in `dired-omit-extensions'."
+plus those ending with extensions in `dired-omit-extensions'.
+
+To enable omitting in every Dired buffer, you can put in your ~/.emacs
+
+  (add-hook 'dired-mode-hook (lambda () (dired-omit-mode 1)))
+
+See Info node `(dired-x) Omitting Variables' for more information."
   :group 'dired-x
   (if dired-omit-mode
       ;; This will mention how many lines were omitted:
@@ -500,16 +507,21 @@ See variables `dired-texinfo-unclean-extensions',
 ;;; JUMP.
 
 ;;;###autoload
-(defun dired-jump (&optional other-window)
+(defun dired-jump (&optional other-window file-name)
   "Jump to dired buffer corresponding to current buffer.
 If in a file, dired the current directory and move to file's line.
 If in Dired already, pop up a level and goto old directory's line.
 In case the proper dired file line cannot be found, refresh the dired
-buffer and try again."
-  (interactive "P")
-  (let* ((file buffer-file-name)
+buffer and try again.
+When OTHER-WINDOW is non-nil, jump to dired buffer in other window.
+Interactively with prefix argument, read FILE-NAME and
+move to its line in dired."
+  (interactive
+   (list nil (and current-prefix-arg
+                 (read-file-name "Jump to dired file: "))))
+  (let* ((file (or file-name buffer-file-name))
          (dir (if file (file-name-directory file) default-directory)))
-    (if (eq major-mode 'dired-mode)
+    (if (and (eq major-mode 'dired-mode) (null file-name))
         (progn
           (setq dir (dired-current-directory))
           (dired-up-directory other-window)
@@ -533,10 +545,12 @@ buffer and try again."
                    (dired-omit-mode)
                    (dired-goto-file file))))))))
 
-(defun dired-jump-other-window ()
+(defun dired-jump-other-window (&optional file-name)
   "Like \\[dired-jump] (`dired-jump') but in other window."
-  (interactive)
-  (dired-jump t))
+  (interactive
+   (list (and current-prefix-arg
+             (read-file-name "Jump to dired file: "))))
+  (dired-jump t file-name))
 \f
 ;;; OMITTING.
 
index 4a23865dfca564806803b0b008e209b61e47299f..ecc3b5bd47e2309b38564a7c37b5dc389446e166 100644 (file)
@@ -7,6 +7,7 @@
 ;; Author: Sebastian Kremer <sk@thp.uni-koeln.de>
 ;; Maintainer: FSF
 ;; Keywords: files
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
@@ -1380,10 +1381,8 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST."
     (define-key map ">" 'dired-next-dirline)
     (define-key map "^" 'dired-up-directory)
     (define-key map " "  'dired-next-line)
-    (define-key map "\C-n" 'dired-next-line)
-    (define-key map "\C-p" 'dired-previous-line)
-    (define-key map [down] 'dired-next-line)
-    (define-key map [up] 'dired-previous-line)
+    (define-key map [remap next-line] 'dired-next-line)
+    (define-key map [remap previous-line] 'dired-previous-line)
     ;; hiding
     (define-key map "$" 'dired-hide-subdir)
     (define-key map "\M-$" 'dired-hide-all)
@@ -1393,7 +1392,7 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST."
     (define-key map (kbd "M-s f C-s")   'dired-isearch-filenames)
     (define-key map (kbd "M-s f M-C-s") 'dired-isearch-filenames-regexp)
     ;; misc
-    (define-key map "\C-x\C-q" 'dired-toggle-read-only)
+    (define-key map [remap toggle-read-only] 'dired-toggle-read-only)
     (define-key map "?" 'dired-summary)
     (define-key map "\177" 'dired-unmark-backward)
     (define-key map [remap undo] 'dired-undo)
@@ -1409,7 +1408,7 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST."
     (define-key map "\C-t." 'image-dired-display-thumb)
     (define-key map "\C-tc" 'image-dired-dired-comment-files)
     (define-key map "\C-tf" 'image-dired-mark-tagged-files)
-    (define-key map "\C-t\C-t" 'image-dired-dired-insert-marked-thumbs)
+    (define-key map "\C-t\C-t" 'image-dired-dired-toggle-marked-thumbs)
     (define-key map "\C-te" 'image-dired-dired-edit-comment-and-tags)
     ;; encryption and decryption (epa-dired)
     (define-key map ":d" 'epa-dired-do-decrypt)
@@ -2581,7 +2580,7 @@ Anything else means ask for each directory."
 ;; Delete file, possibly delete a directory and all its files.
 ;; This function is usefull outside of dired.  One could change it's name
 ;; to e.g. recursive-delete-file and put it somewhere else.
-(defun dired-delete-file (file &optional recursive) "\
+(defun dired-delete-file (file &optional recursive trash) "\
 Delete FILE or directory (possibly recursively if optional RECURSIVE is true.)
 RECURSIVE determines what to do with a non-empty directory.  If RECURSIVE is:
 nil, do not delete.
@@ -2592,15 +2591,19 @@ Anything else, ask for each sub-directory."
   ;; (and (file-directory-p fn) (not (file-symlink-p fn)))
   ;; but more efficient
   (if (not (eq t (car (file-attributes file))))
-      (delete-file file)
+      (delete-file file trash)
     (if (and recursive
             (directory-files file t dired-re-no-dot) ; Not empty.
             (or (eq recursive 'always)
-                (yes-or-no-p (format "Recursive delete of %s? "
+                (yes-or-no-p (format "Recursively %s %s? "
+                                     (if (and trash
+                                              delete-by-moving-to-trash)
+                                         "trash"
+                                       "delete")
                                      (dired-make-relative file)))))
        (if (eq recursive 'top) (setq recursive 'always)) ; Don't ask again.
       (setq recursive nil))
-    (delete-directory file recursive)))
+    (delete-directory file recursive trash)))
 
 (defun dired-do-flagged-delete (&optional nomessage)
   "In Dired, delete the files flagged for deletion.
@@ -2618,7 +2621,7 @@ non-empty directories is allowed."
         ;; this can't move point since ARG is nil
         (dired-map-over-marks (cons (dired-get-filename) (point))
                               nil)
-        nil)
+        nil t)
       (or nomessage
          (message "(No deletions requested)")))))
 
@@ -2633,11 +2636,11 @@ non-empty directories is allowed."
    ;; this may move point if ARG is an integer
    (dired-map-over-marks (cons (dired-get-filename) (point))
                         arg)
-   arg))
+   arg t))
 
 (defvar dired-deletion-confirmer 'yes-or-no-p) ; or y-or-n-p?
 
-(defun dired-internal-do-deletions (l arg)
+(defun dired-internal-do-deletions (l arg &optional trash)
   ;; L is an alist of files to delete, with their buffer positions.
   ;; ARG is the prefix arg.
   ;; Filenames are absolute.
@@ -2646,14 +2649,21 @@ non-empty directories is allowed."
   ;; lines still to be changed, so the (point) values in L stay valid.
   ;; Also, for subdirs in natural order, a subdir's files are deleted
   ;; before the subdir itself - the other way around would not work.
-  (let ((files (mapcar (function car) l))
-       (count (length l))
-       (succ 0))
+  (let* ((files (mapcar (function car) l))
+        (count (length l))
+        (succ 0)
+        (trashing (and trash delete-by-moving-to-trash))
+        (progress-reporter
+         (make-progress-reporter
+          (if trashing "Trashing..." "Deleting...")
+          succ count)))
     ;; canonicalize file list for pop up
     (setq files (nreverse (mapcar (function dired-make-relative) files)))
     (if (dired-mark-pop-up
         " *Deletions*" 'delete files dired-deletion-confirmer
-        (format "Delete %s " (dired-mark-prompt arg files)))
+        (format "%s %s "
+                (if trashing "Trash" "Delete")
+                (dired-mark-prompt arg files)))
        (save-excursion
          (let (failures);; files better be in reverse order for this loop!
            (while l
@@ -2661,10 +2671,10 @@ non-empty directories is allowed."
              (let ((inhibit-read-only t))
                (condition-case err
                    (let ((fn (car (car l))))
-                     (dired-delete-file fn dired-recursive-deletes)
+                     (dired-delete-file fn dired-recursive-deletes trash)
                      ;; if we get here, removing worked
                      (setq succ (1+ succ))
-                     (message "%s of %s deletions" succ count)
+                     (progress-reporter-update progress-reporter succ)
                      (dired-fun-in-all-buffers
                       (file-name-directory fn) (file-name-nondirectory fn)
                       (function dired-delete-entry) fn))
@@ -2673,7 +2683,7 @@ non-empty directories is allowed."
                   (setq failures (cons (car (car l)) failures)))))
              (setq l (cdr l)))
            (if (not failures)
-               (message "%d deletion%s done" count (dired-plural-s count))
+               (progress-reporter-done progress-reporter)
              (dired-log-summary
               (format "%d of %d deletion%s failed"
                       (length failures) count
@@ -2756,17 +2766,19 @@ name, or the marker and a count of marked files."
     (fit-window-to-buffer (get-buffer-window buf) nil 1)))
 
 (defcustom dired-no-confirm nil
-  "A list of symbols for commands Dired should not confirm.
+  "A list of symbols for commands Dired should not confirm, or t.
 Command symbols are `byte-compile', `chgrp', `chmod', `chown', `compress',
 `copy', `delete', `hardlink', `load', `move', `print', `shell', `symlink',
-`touch' and `uncompress'."
+`touch' and `uncompress'.
+If t, confirmation is never needed."
   :group 'dired
-  :type '(set (const byte-compile) (const chgrp)
-             (const chmod) (const chown) (const compress)
-             (const copy) (const delete) (const hardlink)
-             (const load) (const move) (const print)
-             (const shell) (const symlink) (const touch)
-             (const uncompress)))
+  :type '(choice (const :tag "Confirmation never needed" t)
+                (set (const byte-compile) (const chgrp)
+                     (const chmod) (const chown) (const compress)
+                     (const copy) (const delete) (const hardlink)
+                     (const load) (const move) (const print)
+                     (const shell) (const symlink) (const touch)
+                     (const uncompress))))
 
 (defun dired-mark-pop-up (bufname op-symbol files function &rest args)
   "Return FUNCTION's result on ARGS after showing which files are marked.
@@ -3523,7 +3535,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" "07676ea25af17f5d50cc5db4f53bddc0")
+;;;;;;  dired-diff) "dired-aux" "dired-aux.el" "416d272299fd4774c47c2f677ee640a4")
 ;;; Generated autoloads from dired-aux.el
 
 (autoload 'dired-diff "dired-aux" "\
@@ -3976,7 +3988,7 @@ true then the type of the file linked to by FILE is printed instead.
 ;;;***
 \f
 ;;;### (autoloads (dired-do-relsymlink dired-jump) "dired-x" "dired-x.el"
-;;;;;;  "bb37ec379c0a523368794491b691fd8d")
+;;;;;;  "27c312d6d5d40d8cb4ef8d62e30d5f4a")
 ;;; Generated autoloads from dired-x.el
 
 (autoload 'dired-jump "dired-x" "\
@@ -3985,8 +3997,11 @@ If in a file, dired the current directory and move to file's line.
 If in Dired already, pop up a level and goto old directory's line.
 In case the proper dired file line cannot be found, refresh the dired
 buffer and try again.
+When OTHER-WINDOW is non-nil, jump to dired buffer in other window.
+Interactively with prefix argument, read FILE-NAME and
+move to its line in dired.
 
-\(fn &optional OTHER-WINDOW)" t nil)
+\(fn &optional OTHER-WINDOW FILE-NAME)" t nil)
 
 (autoload 'dired-do-relsymlink "dired-x" "\
 Relative symlink all marked (or next ARG) files into a directory.
index c209a2a6eb9ebc981d37cda478eb88b6560f44c5..4e29c51fa75e637b3dda22325e03a40999e1ee38 100644 (file)
@@ -143,13 +143,6 @@ be on a single line."
   :group 'dirtrack
   :type  'string)
 
-(defcustom dirtrackp t
-  "If non-nil, directory tracking via `dirtrack' is enabled."
-  :group 'dirtrack
-  :type  'boolean)
-
-(make-variable-buffer-local 'dirtrackp)
-
 (defcustom dirtrack-directory-function
   (if (memq system-type (list 'ms-dos 'windows-nt 'cygwin))
       'dirtrack-windows-directory-function
index 86aed277765d632bc57d5c0b785cd6b676adc9ad..e9bdd3d9be3758e3d98f2d4c66334beb754d1c44 100644 (file)
@@ -7,6 +7,7 @@
 ;; Based on a previous version by Howard Gayle
 ;; Maintainer: FSF
 ;; Keywords: i18n
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
index d7cbb641babec9f1b3ded07312391371a7a842ad..7b9d0c0786cd763ae33cb85eb19f5af38caf629e 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Jan Djärv <jan.h.d@swipnet.se>
 ;; Maintainer: FSF
 ;; Keywords: window, drag, drop
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
index 528d5979ce1cb268ee680bc1504e413bbf96eea1..4f183f4b9dca4f45fcf620753191f20f44de3c04 100644 (file)
@@ -1349,8 +1349,8 @@ See the command `doc-view-mode' for more information on this mode."
 
 ;;;; Bookmark integration
 
-(declare-function bookmark-make-record-default "bookmark"
-                  (&optional point-only))
+(declare-function bookmark-make-record-default
+                  "bookmark" (&optional no-file no-context posn))
 (declare-function bookmark-prop-get "bookmark" (bookmark prop))
 (declare-function bookmark-default-handler "bookmark" (bmk))
 
index c1c2517bc22b4563ee273b69dbabd785ef7c922e..b840319113d576d1fc6953f019dc37ddc47894f7 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Maintainer: Morten Welinder <terra@diku.dk>
 ;; Keywords: internal
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
 (declare-function int86 "dosfns.c")
 (declare-function msdos-long-file-names "msdos.c")
 
-;; This overrides a trivial definition in files.el.
-(defun convert-standard-filename (filename)
-  "Convert a standard file's name to something suitable for the current OS.
+;; See convert-standard-filename in files.el.
+(defun dos-convert-standard-filename (filename)
+  "Convert a standard file's name to something suitable for MS-DOS.
 This means to guarantee valid names and perhaps to canonicalize
 certain patterns.
 
+This function is called by `convert-standard-filename'.
+
 On Windows and DOS, replace invalid characters.  On DOS, make
-sure to obey the 8.3 limitations.  On Windows, turn Cygwin names
-into native names, and also turn slashes into backslashes if the
-shell requires it (see `w32-shell-dos-semantics')."
+sure to obey the 8.3 limitations."
   (if (or (not (stringp filename))
          ;; This catches the case where FILENAME is "x:" or "x:/" or
          ;; "/", thus preventing infinite recursion.
@@ -48,7 +49,7 @@ shell requires it (see `w32-shell-dos-semantics')."
     (let ((flen (length filename)))
       ;; If FILENAME has a trailing slash, remove it and recurse.
       (if (memq (aref filename (1- flen)) '(?/ ?\\))
-         (concat (convert-standard-filename
+         (concat (dos-convert-standard-filename
                   (substring filename 0 (1- flen)))
                  "/")
        (let* (;; ange-ftp gets in the way for names like "/foo:bar".
@@ -122,10 +123,10 @@ shell requires it (see `w32-shell-dos-semantics')."
                (aset string (1- (length string)) lastchar))))
          (concat (if (and (stringp dir)
                           (memq (aref dir dlen-m-1) '(?/ ?\\)))
-                     (concat (convert-standard-filename
+                     (concat (dos-convert-standard-filename
                               (substring dir 0 dlen-m-1))
                              "/")
-                   (convert-standard-filename dir))
+                   (dos-convert-standard-filename dir))
                  string))))))
 
 (defun dos-8+3-filename (filename)
@@ -188,12 +189,12 @@ shell requires it (see `w32-shell-dos-semantics')."
 
 ;; This is for the sake of standard file names elsewhere in Emacs that
 ;; are defined as constant strings or via defconst, and whose
-;; conversion via `convert-standard-filename' does not give good
+;; conversion via `dos-convert-standard-filename' does not give good
 ;; enough results.
 (defun dosified-file-name (file-name)
   "Return a variant of FILE-NAME that is valid on MS-DOS filesystems.
 
-This function is for those rare cases where `convert-standard-filename'
+This function is for those rare cases where `dos-convert-standard-filename'
 does not do a job that is good enough, e.g. if you need to preserve the
 file-name extension.  It recognizes only certain specific file names
 that are used in Emacs Lisp sources; any other file name will be
@@ -209,13 +210,13 @@ returned unaltered."
 (defvar msdos-shells)
 
 ;; Override settings chosen at startup.
-(defun set-default-process-coding-system ()
+(defun dos-set-default-process-coding-system ()
   (setq default-process-coding-system
        (if (default-value 'enable-multibyte-characters)
            '(undecided-dos . undecided-dos)
          '(raw-text-dos . raw-text-dos))))
 
-(add-hook 'before-init-hook 'set-default-process-coding-system)
+(add-hook 'before-init-hook 'dos-set-default-process-coding-system)
 
 ;; File names defined in preloaded packages can be incorrect or
 ;; invalid if long file names were available during dumping, but not
@@ -232,17 +233,22 @@ returned unaltered."
 
 (add-hook 'before-init-hook 'dos-reevaluate-defcustoms)
 
-(defvar register-name-alist
+(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))))
 
-(defun make-register ()
+(define-obsolete-variable-alias
+  'register-name-alist 'dos-register-name-alist "24.1")
+
+(defun dos-make-register ()
   (make-vector 8 0))
 
-(defun register-value (regs name)
-  (let ((where (cdr (assoc name register-name-alist))))
+(define-obsolete-function-alias 'make-register 'dos-make-register "24.1")
+
+(defun dos-register-value (regs name)
+  (let ((where (cdr (assoc name dos-register-name-alist))))
     (cond ((consp where)
           (let ((tem (aref regs (car where))))
             (if (zerop (cdr where))
@@ -252,10 +258,12 @@ returned unaltered."
           (aref regs where))
          (t nil))))
 
-(defun set-register-value (regs name value)
+(define-obsolete-function-alias 'register-value 'dos-register-value "24.1")
+
+(defun dos-set-register-value (regs name value)
   (and (numberp value)
        (>= value 0)
-       (let ((where (cdr (assoc name register-name-alist))))
+       (let ((where (cdr (assoc name dos-register-name-alist))))
         (cond ((consp where)
                (let ((tem (aref regs (car where)))
                      (value (logand value 255)))
@@ -268,18 +276,29 @@ returned unaltered."
                (aset regs where (logand value 65535))))))
   regs)
 
-(defsubst intdos (regs)
+(define-obsolete-function-alias
+  'set-register-value 'dos-set-register-value "24.1")
+
+(defsubst dos-intdos (regs)
+  "Issue the DOS Int 21h with registers REGS.
+
+REGS should be a vector produced by `dos-make-register'
+and `dos-set-register-value', which see."
   (int86 33 regs))
 
+(define-obsolete-function-alias 'intdos 'dos-intdos "24.1")
+
 ;; Backward compatibility for obsolescent functions which
 ;; set screen size.
 
-(defun mode25 ()
+(defun dos-mode25 ()
   "Changes the number of screen rows to 25."
   (interactive)
   (set-frame-size (selected-frame) 80 25))
 
-(defun mode4350 ()
+(define-obsolete-function-alias 'mode25 'dos-mode25 "24.1")
+
+(defun dos-mode4350 ()
   "Changes the number of rows to 43 or 50.
 Emacs always tries to set the screen height to 50 rows first.
 If this fails, it will try to set it to 43 rows, on the assumption
@@ -290,6 +309,8 @@ that your video hardware might not support 50-line mode."
       nil  ; the original built-in function returned nil
     (set-frame-size (selected-frame) 80 43)))
 
+(define-obsolete-function-alias 'mode4350 'dos-mode4350 "24.1")
+
 (provide 'dos-fns)
 
 ;; arch-tag: 00b03579-8ebb-4a02-8762-5c5a929774ad
index 8af147e78f6cb6f73568e8b56f5f72d2c44891f1..e153df3e743f9d500866b9e883c4aeab92c4fd46 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Maintainer: FSF
 ;; Keywords: internal
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
index 424ea0a701dd7a3b373c96bf1f6e521ad776d63c..0962ae5f13a67bb3faf1786326a4ee7cda1cbcaf 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Maintainer: Geoff Voelker <voelker@cs.washington.edu>
 ;; Keywords: internal
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
similarity index 75%
rename from lisp/font-setting.el
rename to lisp/dynamic-setting.el
index 3de0b81621c8193503843c903479a4cc6f1538b2..cfa1053c44d11a24a7166b36ac7652ef3ddfeef5 100644 (file)
@@ -1,10 +1,11 @@
-;;; font-setting.el --- Support dynamic font changes   -*- coding: utf-8 -*-
+;;; dynamic-setting.el --- Support dynamic changes
 
 ;; Copyright (C) 2009, 2010 Free Software Foundation, Inc.
 
 ;; Author: Jan Djärv <jan.h.d@swipnet.se>
 ;; Maintainer: FSF
-;; Keywords: font, system-font
+;; Keywords: font, system-font, tool-bar-style
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
@@ -65,7 +66,6 @@ current form for the frame (i.e. hinting or somesuch changed)."
                      frame-font)))
              (if font-to-set
                  (progn
-                   (message "setting %s" font-to-set)
                    (set-frame-parameter f 'font-parameter font-to-set)
                    (set-face-attribute 'default f
                                        :width 'normal
@@ -81,21 +81,30 @@ current form for the frame (i.e. hinting or somesuch changed)."
          (custom-push-theme 'theme-face 'default 'user 'set spec)
          (put 'default 'face-modified nil))))))
 
-(defun font-setting-handle-config-changed-event (event)
-  "Handle config-changed-event to change fonts on the display in EVENT.
-If `font-use-system-font' is nil, the font is not changed."
+(defun dynamic-setting-handle-config-changed-event (event)
+  "Handle config-changed-event on the display in EVENT.
+Changes can be
+  The monospace font. If `font-use-system-font' is nil, the font
+    is not changed.
+  Xft parameters, like DPI and hinting.
+  The tool bar style."
   (interactive "e")
-  (let ((type (nth 1 event)) ;; font-name or font-render
+  (let ((type (nth 1 event))
        (display-name (nth 2 event)))
-    (if (or (not (eq type 'font-name))
-           font-use-system-font)
-       (font-setting-change-default-font display-name
-                                         (eq type 'font-name)))))
+    (cond ((and (eq type 'monospace-font-name) font-use-system-font)
+          (font-setting-change-default-font display-name t))
 
-(if (or (featurep 'system-font-setting) (featurep 'font-render-setting))
-  (define-key special-event-map [config-changed-event]
-    'font-setting-handle-config-changed-event))
+         ((eq type 'font-render)
+          (font-setting-change-default-font display-name nil))
 
-(provide 'font-setting)
+         ;; This is a bit heavy, ideally we would just clear faces
+         ;; on the affected display, and perhaps only the relevant
+         ;; faces.  Oh well.
+         ((eq type 'theme-name) (clear-face-cache))
+
+         ((eq type 'tool-bar-style) (force-mode-line-update t)))))
+
+(define-key special-event-map [config-changed-event]
+  'dynamic-setting-handle-config-changed-event)
 
 ;; arch-tag: 3a57e78f-1cd6-48b6-ab75-98f160dcc017
index 99704e02b352f2cad34f44738a47137cc01dee0a..6e307d1ab86ee3f840aa78c9a9dbf9a4ba0115f4 100644 (file)
@@ -95,7 +95,7 @@ Run hooks in `electric-buffer-menu-mode-hook' on entry.
                                             (cons first last))))))
        (set-buffer buffer)
        (Buffer-menu-mode)
-       (bury-buffer buffer)
+       (bury-buffer)                ;Get rid of window, if dedicated.
        (message "")))
     (if select
        (progn (set-buffer buffer)
index 7de4fd0ba6316ef05548c02931c8548d8ce4b941..63ec3838d327ad64bc79ddb758a8ccb8f063b2e5 100644 (file)
     map)
   "Keymap defining commands available in `electric-help-mode'.")
 
+(defvar electric-help-orig-major-mode nil)
+(make-variable-buffer-local 'electric-help-orig-major-mode)
+
 (defun electric-help-mode ()
   "`with-electric-help' temporarily places its buffer in this mode.
-\(On exit from `with-electric-help', the buffer is put in default `major-mode'.)"
+\(On exit from `with-electric-help', the original `major-mode' is restored.)"
   (setq buffer-read-only t)
+  (setq electric-help-orig-major-mode major-mode)
   (setq mode-name "Help")
   (setq major-mode 'help)
   (setq mode-line-buffer-identification '(" Help:  %b"))
@@ -131,7 +135,7 @@ If THUNK returns non-nil, we don't do those things.
 
 When the user exits (with `electric-help-exit', or otherwise), the help
 buffer's window disappears (i.e., we use `save-window-excursion'), and
-BUFFER is put into default `major-mode' (or `fundamental-mode')."
+BUFFER is put back into its original major mode."
   (setq buffer (get-buffer-create (or buffer "*Help*")))
   (let ((one (one-window-p t))
        (config (current-window-configuration))
@@ -170,13 +174,17 @@ BUFFER is put into default `major-mode' (or `fundamental-mode')."
       (set-buffer buffer)
       (setq buffer-read-only nil)
 
+      ;; Restore the original major mode saved by `electric-help-mode'.
       ;; We should really get a usable *Help* buffer when retaining
       ;; the electric one with `r'.  The problem is that a simple
-      ;; call to help-mode won't cut it; at least RET is bound wrong
-      ;; afterwards.  It's also not clear that `help-mode' is always
-      ;; the right thing, maybe we should add an optional parameter.
+      ;; call to `help-mode' won't cut it; e.g. RET is bound wrong
+      ;; afterwards (`View-scroll-line-forward' instead of `help-follow').
+      ;; That's because Help mode should be set with `with-help-window'
+      ;; instead of the direct call to `help-mode'. But at least
+      ;; RET works correctly on links after using `help-mode'.
+      ;; This is satisfactory enough.
       (condition-case ()
-          (funcall (or (default-value 'major-mode) 'fundamental-mode))
+          (funcall (or electric-help-orig-major-mode 'fundamental-mode))
         (error nil))
 
       (set-window-configuration config)
index db53b5fa84ef756b60d93dacd1e82c2416fd9c6b..fb3e462efbaf757c06555166ffd9caf67fb2405b 100644 (file)
         (err nil)
         (prompt-string prompt))
     (while t
-      (if (not (or (stringp prompt) (eq prompt nil) (eq prompt 'noprompt)))
+      (if (functionp prompt)
           (setq prompt-string (funcall prompt)))
       (if (not (stringp prompt-string))
-          (if (eq prompt-string 'noprompt)
-              (setq prompt-string nil)
-            (setq prompt-string "->")))
+          (setq prompt-string (unless (eq prompt-string 'noprompt) "->")))
       (setq cmd (read-key-sequence prompt-string))
       (setq last-command-event (aref cmd (1- (length cmd)))
            this-command (key-binding cmd t)
index 9267bc8ac91fc0e1cecd84dcbc42c7e35760f274..578e0877d30698fa5593ea16e4fa53aca166dc06 100644 (file)
@@ -7,6 +7,7 @@
 ;; Maintainer: FSF
 ;; Created: 12 Dec 1992
 ;; Keywords: extensions, lisp, tools
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
index 7728215bb91db3995dde5ef8df876b764eb44c9f..3bfa076d71c2ac49ddff5655f23dd9489f029d58 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Gerd Moellmann <gerd@gnu.org>
 ;; Maintainer: Kim F. Storm <storm@cua.dk>
 ;; Keywords: maint
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
@@ -220,6 +221,9 @@ If REALNAME is nil, ignore that author.")
   '("vc-\\*\\.el$"
     "spec.txt$"
     ".*loaddefs.el$"                   ; not obsolete, but auto-generated
+    "\\.\\(cvs\\|git\\)ignore$"                ; obsolete or uninteresting
+    "\\.arch-inventory$"
+    "preferences\\.\\(nib\\|gorm\\)"
     "vc-\\(rcs\\|cvs\\|sccs\\)-hooks\\.el$")
   "List of regexps matching obsolete files.
 Changes to files matching one of the regexps in this list are not
@@ -244,6 +248,14 @@ listed.")
     "Imakefile" "icons/sink.ico" "aixcc.lex"
     "nxml/char-name/unicode"
     "js2-mode.el"      ; only installed very briefly, replaced by js.el
+    "cedet/tests/testtemplates.cpp"
+    "cedet/tests/testusing.cpp"
+    "cedet/tests/scopetest.cpp"
+    "cedet/tests/scopetest.java"
+    "cedet/tests/test.cpp"
+    "cedet/tests/test.py"
+    "cedet/tests/teststruct.cpp"
+    "*.el"
     ;; Autogen:
     "cus-load.el" "finder-inf.el" "ldefs-boot.el"
     ;; Never had any meaningful changes logged, now deleted:
@@ -255,7 +267,7 @@ listed.")
     "3B-MAXMEM" "AIX.DUMP" "SUN-SUPPORT" "XENIX"
     "CODINGS" "CHARSETS"
     "calc/INSTALL" "calc/Makefile"
-    "vms-pp.trans" "_emacs" "batcomp.com"
+    "vms-pp.trans" "_emacs" "batcomp.com" "notes/cpp" ; admin/
     ;; MH-E stuff not in Emacs:
     "import-emacs" "release-utils"
     ;; Erc stuff not in Emacs:
@@ -286,6 +298,42 @@ listed.")
   "List of files and directories to ignore.
 Changes to files in this list are not listed.")
 
+;; List via: find . -name '*.el' | sed 's/.*\///g' | sort | uniq -d
+;; FIXME It would be better to discover these dynamically.
+;; Note that traditionally "Makefile.in" etc have not been in this list.
+;; Ditto for "abbrev.texi" etc.
+(defconst authors-ambiguous-files
+  '("chart.el"
+    "compile.el"
+    "complete.el"
+    "cpp.el"
+    "ctxt.el"
+    "debug.el"
+    "dired.el"
+    "el.el"
+    "files.el"
+    "find.el"
+    "format.el"
+    "grep.el"
+    "imenu.el"
+    "java.el"
+    "linux.el"
+    "locate.el"
+    "make.el"
+    "mode.el"
+    "python.el"
+    "semantic.el"
+    "shell.el"
+    "simple.el"
+    "sort.el"
+    "speedbar.el"
+    "srecode.el"
+    "table.el"
+    "texi.el"
+    "util.el"
+    "wisent.el")
+  "List of basenames occurring more than once in the source.")
+
 ;; FIXME :cowrote entries here can be overwritten by :wrote entries
 ;; derived from a file's Author: header (eg mh-e).  This really means
 ;; the Author: header is erroneous.
@@ -307,7 +355,7 @@ Changes to files in this list are not listed.")
     ;; No longer distributed.
 ;;;    ("Viktor Dukhovni" :wrote "unexsunos4.c")
     ("Paul Eggert" :wrote "rcs2log" "vcdiff")
-    ("Fred Fish" :changed "unexec.c")
+    ("Fred Fish" :changed "unexcoff.c")
     ;; No longer distributed.
 ;;;    ("Tim Fleehart" :wrote "makefile.nt")
     ("Keith Gabryelski" :wrote "hexl.c")
@@ -330,13 +378,13 @@ Changes to files in this list are not listed.")
      "indent.c" "search.c" "xdisp.c" "region-cache.c" "region-cache.h")
     ;; ibmrt.h, ibmrt-aix.h no longer distributed.
     ("International Business Machines" :changed "emacs.c" "fileio.c"
-     "process.c" "sysdep.c" "unexec.c")
+     "process.c" "sysdep.c" "unexcoff.c")
     ;; No longer distributed.
 ;;;    ("Ishikawa Chiaki" :changed "aviion.h" "dgux.h")
     ;; ymakefile no longer distributed.
     ("Michael K. Johnson" :changed "configure.in" "emacs.c" "intel386.h"
      "mem-limits.h" "process.c" "template.h" "sysdep.c" "syssignal.h"
-     "systty.h" "unexec.c" "linux.h")
+     "systty.h" "unexcoff.c" "linux.h")
     ;; No longer distributed.
 ;;;    ("Kyle Jones" :wrote "mldrag.el")
     ("Henry Kautz" :wrote "bib-mode.el")
@@ -361,7 +409,7 @@ Changes to files in this list are not listed.")
      "rmail.el" "rmailedit.el" "rmailkwd.el"
      "rmailmsc.el" "rmailout.el" "rmailsum.el" "scribe.el"
      ;; It was :wrote for xmenu.c, but it has been rewritten since.
-     "server.el" "lisp.h" "sysdep.c" "unexec.c" "xmenu.c")
+     "server.el" "lisp.h" "sysdep.c" "unexcoff.c" "xmenu.c")
     ("Niall Mansfield" :changed "etags.c")
     ("Brian Marick" :cowrote "hideif.el")
     ("Marko Kohtala" :changed "info.el")
@@ -416,9 +464,9 @@ Changes to files in this list are not listed.")
     ("Kayvan Sylvan" :changed "supercite.el")
     ;; No longer distributed: emacsserver.c, tcp.c.
     ("Spencer Thomas" :changed "emacsclient.c" "server.el"
-     "dabbrev.el" "unexec.c" "gnus.texi")
+     "dabbrev.el" "unexcoff.c" "gnus.texi")
     ("Jonathan Vail" :changed "vc.el")
-    ("James Van Artsdalen" :changed "usg5-4.h" "unexec.c")
+    ("James Van Artsdalen" :changed "usg5-4.h" "unexcoff.c")
     ;; No longer distributed: src/makefile.nt, lisp/makefile.nt
     ;; winnt.el renamed to w32-fns.el; nt.[ch] to w32.[ch];
     ;; ntheap.[ch] to w32heap.[ch]; ntinevt.c to w32inevt.c;
@@ -427,6 +475,7 @@ Changes to files in this list are not listed.")
     ("Geoff Voelker" :wrote "w32-fns.el" "w32.c" "w32.h" "w32heap.c"
      "w32heap.h" "w32inevt.c" "w32proc.c" "w32term.c" "ms-w32.h")
     ("Morten Welinder" :wrote "dosfns.c" "[many MS-DOS files]" "msdos.h")
+    ("Eli Zaretskii" :wrote "bidi.c" "[bidirectional display in xdisp.c]")
     ;; Not using this version any more.
 ;;;    ("Pace Willisson" :wrote "ispell.el")
     ;; FIXME overwritten by Author:.
@@ -457,17 +506,21 @@ Changes to files in this list are not listed.")
     "getdate.y"
     "ymakefile"
     "permute-index" "index.perm"
+    "ibmrs6000.inp"
     "emacs.ico"
     "emacs21.ico"
     "LPF" "LEDIT" "OTHER.EMACSES"
     "emacs16_mac.png" "emacs24_mac.png"
     "emacs256_mac.png" "emacs32_mac.png"
     "emacs48_mac.png" "emacs512_mac.png"
+    "revdiff"                          ; admin/
+    "mainmake" "sed1.inp" "sed2.inp" "sed3.inp" ; msdos/
+    "mac-fix-env.m"
     ;; Deleted vms stuff:
     "temacs.opt" "descrip.mms" "compile.com" "link.com"
     )
-  "File names which are valid, but no longer exist (or cannot be
-found) in the repository.")
+  "File names which are valid, but no longer exist (or cannot be found)
+in the repository.")
 
 (defconst authors-renamed-files-alist
   '(("nt.c" . "w32.c") ("nt.h" . "w32.h")
@@ -504,6 +557,7 @@ found) in the repository.")
     ;; index and pick merged into search.
     ("mh-index.el" . "mh-search.el")
     ("mh-pick.el" . "mh-search.el")
+    ("font-setting.el" . "dynamic-setting.el")
     ;; INSTALL-CVS -> .CVS -> .BZR
     ("INSTALL-CVS" . "INSTALL.BZR")
     ("INSTALL.CVS" . "INSTALL.BZR")
@@ -529,6 +583,7 @@ found) in the repository.")
     ("schema/docbook-dyntbl.rnc" . "schema/docbk-dyntbl.rnc")
     ("schema/docbook-soextbl.rnc" . "schema/docbk-soextbl.rn" )
     ("texi/url.txi" . "url.texi")
+    ("edt-user.doc" . "edt.texi")
     ;; Moved to different directories.
     ("ctags.1" . "ctags.1")
     ("etags.1" . "etags.1")
@@ -573,10 +628,25 @@ Otherwise, the file name is accepted as is.")
 (defvar authors-checked-files-alist)
 (defvar authors-invalid-file-names)
 
+(defun authors-disambiguate-file-name (fullname)
+  "Convert FULLNAME to an unambiguous relative-name."
+  (let ((relname (file-name-nondirectory fullname))
+       parent)
+    (if (member relname authors-ambiguous-files)
+       ;; In case of ambiguity, just prepend the parent directory.
+       ;; FIXME obviously this is not a perfect solution.
+       (if (string-equal "lisp"
+                         (setq parent (file-name-nondirectory
+                                       (directory-file-name
+                                        (file-name-directory fullname)))))
+           relname
+         (format "%s/%s" parent relname))
+      relname)))
+
 (defun authors-canonical-file-name (file log-file pos author)
   "Return canonical file name for FILE found in LOG-FILE.
 Checks whether FILE is a valid (existing) file name, has been renamed,
-or is on the list of removed files.  Returns the non-diretory part of
+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
@@ -593,7 +663,7 @@ to print a message if FILE is not found."
              (file-exists-p file)
              (file-exists-p relname)
              (file-exists-p (concat "etc/" relname)))
-         (setq valid relname)
+         (setq valid (authors-disambiguate-file-name fullname))
        (setq valid (assoc file authors-renamed-files-alist))
        (if valid
            (setq valid (cdr valid))
@@ -610,6 +680,7 @@ to print a message if FILE is not found."
            (cons (cons fullname valid) authors-checked-files-alist))
       (unless (or valid
                  (member file authors-ignored-files)
+                 (authors-obsolete-file-p file)
                  (string-match "[*]" file)
                  (string-match "^[0-9.]+$" file))
        (setq authors-invalid-file-names
@@ -758,7 +829,7 @@ TABLE is a hash table to add author information to."
         (enable-local-variables :safe) ; for find-file, hence let*
         (enable-local-eval nil)
         (buffer (find-file-noselect file)))
-    (setq file (file-name-nondirectory file))
+    (setq file (authors-disambiguate-file-name (expand-file-name file)))
     (with-current-buffer buffer
       (save-restriction
        (widen)
index c985aae07b6f493a5b5ed1907764a6a19ac4f63b..30c384aff91791c4cd99fcd628b6e5eff3cc07b3 100644 (file)
@@ -1,10 +1,12 @@
 ;; autoload.el --- maintain autoloads in loaddefs.el
 
 ;; Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2001, 2002, 2003,
-;;   2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+;;   2004, 2005, 2006, 2007, 2008, 2009, 2010
+;;   Free Software Foundation, Inc.
 
 ;; Author: Roland McGrath <roland@gnu.org>
 ;; Keywords: maint
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
@@ -108,29 +110,48 @@ or macro definition or a defcustom)."
       (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)))
+                     ((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))
             (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)))
-       ;; `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))))
+        (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 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)))
 
      ;; For defclass forms, use `eieio-defclass-autoload'.
      ((eq car 'defclass)
@@ -258,14 +279,17 @@ put the output in."
 TYPE (default \"autoloads\") is a string stating the type of
 information contained in FILE.  If FEATURE is non-nil, FILE
 will provide a feature.  FEATURE may be a string naming the
-feature, otherwise it will be based on FILE's name."
+feature, otherwise it will be based on FILE's name.
+
+At present, a feature is in fact always provided, but this should
+not be relied upon."
   (let ((basename (file-name-nondirectory file)))
     (concat ";;; " basename
            " --- automatically extracted " (or type "autoloads") "\n"
            ";;\n"
            ";;; Code:\n\n"
            "\f\n"
-           ;; This is used outside of autoload.el.
+           ;; This is used outside of autoload.el, eg cus-dep, finder.
            "(provide '"
            (if (stringp feature)
                feature
@@ -324,7 +348,29 @@ which lists the file name and which functions are in it, etc."
   "File local variable to prevent scanning this file for autoload cookies.")
 
 (defun autoload-file-load-name (file)
-  (let ((name (file-name-nondirectory file)))
+  "Compute the name that will be used to load FILE."
+  ;; OUTFILE should be the name of the global loaddefs.el file, which
+  ;; is expected to be at the root directory of the files we're
+  ;; scanning for autoloads and will be in the `load-path'.
+  (let* ((outfile (default-value 'generated-autoload-file))
+         (name (file-relative-name file (file-name-directory outfile)))
+         (names '())
+         (dir (file-name-directory outfile)))
+    ;; If `name' has directory components, only keep the
+    ;; last few that are really needed.
+    (while name
+      (setq name (directory-file-name name))
+      (push (file-name-nondirectory name) names)
+      (setq name (file-name-directory name)))
+    (while (not name)
+      (cond
+       ((null (cdr names)) (setq name (car names)))
+       ((file-exists-p (expand-file-name "subdirs.el" dir))
+        ;; FIXME: here we only check the existence of subdirs.el,
+        ;; without checking its content.  This makes it generate wrong load
+        ;; names for cases like lisp/term which is not added to load-path.
+        (setq dir (expand-file-name (pop names) dir)))
+       (t (setq name (mapconcat 'identity names "/")))))
     (if (string-match "\\.elc?\\(\\.\\|\\'\\)" name)
         (substring name 0 (match-beginning 0))
       name)))
@@ -339,6 +385,8 @@ Return non-nil in the case where no autoloads were added at point."
   (interactive "fGenerate autoloads for file: ")
   (autoload-generate-file-autoloads file (current-buffer)))
 
+(defvar print-readably)
+
 ;; When called from `generate-file-autoloads' we should ignore
 ;; `generated-autoload-file' altogether.  When called from
 ;; `update-file-autoloads' we don't know `outbuf'.  And when called from
@@ -369,9 +417,8 @@ Return non-nil if and only if FILE adds no autoloads to OUTFILE
           (visited (get-file-buffer file))
           (otherbuf nil)
           (absfile (expand-file-name file))
-          relfile
           ;; nil until we found a cookie.
-          output-start)
+          output-start ostart)
       (with-current-buffer (or visited
                                ;; It is faster to avoid visiting the file.
                                (autoload-find-file file))
@@ -381,7 +428,10 @@ Return non-nil if and only if FILE adds no autoloads to OUTFILE
          (setq load-name
                (if (stringp generated-autoload-load-name)
                    generated-autoload-load-name
-                 (autoload-file-load-name file)))
+                 (autoload-file-load-name absfile)))
+          (when (and outfile
+                     (not (equal outfile (autoload-generated-file))))
+            (setq otherbuf t))
           (save-excursion
             (save-restriction
               (widen)
@@ -392,26 +442,22 @@ Return non-nil if and only if FILE adds no autoloads to OUTFILE
                  ((looking-at (regexp-quote generate-autoload-cookie))
                   ;; If not done yet, figure out where to insert this text.
                   (unless output-start
-                    (when (and outfile
-                               (not (equal outfile (autoload-generated-file))))
-                      ;; A file-local setting of autoload-generated-file says
-                      ;; we should ignore OUTBUF.
-                      (setq outbuf nil)
-                      (setq otherbuf t))
-                    (unless outbuf
-                      (setq outbuf (autoload-find-destination absfile))
-                      (unless outbuf
-                        ;; The file has autoload cookies, but they're
-                        ;; already up-to-date.  If OUTFILE is nil, the
-                        ;; entries are in the expected OUTBUF, otherwise
-                        ;; they're elsewhere.
-                        (throw 'done outfile)))
-                    (with-current-buffer outbuf
-                      (setq relfile (file-relative-name absfile))
-                      (setq output-start (point)))
-                    ;; (message "file=%S, relfile=%S, dest=%S"
-                    ;;          file relfile (autoload-generated-file))
-                    )
+                    (let ((outbuf
+                           (or (if otherbuf
+                                   ;; A file-local setting of
+                                   ;; autoload-generated-file says we
+                                   ;; should ignore OUTBUF.
+                                   nil
+                                 outbuf)
+                               (autoload-find-destination absfile load-name)
+                               ;; The file has autoload cookies, but they're
+                               ;; already up-to-date. If OUTFILE is nil, the
+                               ;; entries are in the expected OUTBUF,
+                               ;; otherwise they're elsewhere.
+                               (throw 'done otherbuf))))
+                      (with-current-buffer outbuf
+                        (setq output-start (point-marker)
+                              ostart (point)))))
                   (search-forward generate-autoload-cookie)
                   (skip-chars-forward " \t")
                   (if (eolp)
@@ -423,7 +469,8 @@ Return non-nil if and only if FILE adds no autoloads to OUTFILE
                             (if autoload
                                 (push (nth 1 form) autoloads-done)
                               (setq autoload form))
-                            (let ((autoload-print-form-outbuf outbuf))
+                            (let ((autoload-print-form-outbuf
+                                   (marker-buffer output-start)))
                               (autoload-print-form autoload)))
                         (error
                          (message "Error in %s: %S" file err)))
@@ -438,7 +485,7 @@ Return non-nil if and only if FILE adds no autoloads to OUTFILE
                                   (forward-char 1))
                               (point))
                             (progn (forward-line 1) (point)))
-                           outbuf)))
+                           (marker-buffer output-start))))
                  ((looking-at ";")
                   ;; Don't read the comment.
                   (forward-line 1))
@@ -450,40 +497,44 @@ Return non-nil if and only if FILE adds no autoloads to OUTFILE
             (let ((secondary-autoloads-file-buf
                    (if (local-variable-p 'generated-autoload-file)
                        (current-buffer))))
-              (with-current-buffer outbuf
+              (with-current-buffer (marker-buffer output-start)
                 (save-excursion
                   ;; Insert the section-header line which lists the file name
                   ;; and which functions are in it, etc.
+                  (assert (= ostart output-start))
                   (goto-char output-start)
-                  (autoload-insert-section-header
-                   outbuf autoloads-done load-name relfile
-                   (if secondary-autoloads-file-buf
-                       ;; MD5 checksums are much better because they do not
-                       ;; change unless the file changes (so they'll be
-                       ;; equal on two different systems and will change
-                       ;; less often than time-stamps, thus leading to fewer
-                       ;; unneeded changes causing spurious conflicts), but
-                       ;; using time-stamps is a very useful optimization,
-                       ;; so we use time-stamps for the main autoloads file
-                       ;; (loaddefs.el) where we have special ways to
-                       ;; circumvent the "random change problem", and MD5
-                       ;; checksum in secondary autoload files where we do
-                       ;; not need the time-stamp optimization because it is
-                       ;; already provided by the primary autoloads file.
-                       (md5 secondary-autoloads-file-buf
-                            ;; We'd really want to just use
-                            ;; `emacs-internal' instead.
-                            nil nil 'emacs-mule-unix)
-                     (nth 5 (file-attributes relfile))))
-                  (insert ";;; Generated autoloads from " relfile "\n"))
+                  (let ((relfile (file-relative-name absfile)))
+                    (autoload-insert-section-header
+                     (marker-buffer output-start)
+                     autoloads-done load-name relfile
+                     (if secondary-autoloads-file-buf
+                         ;; MD5 checksums are much better because they do not
+                         ;; change unless the file changes (so they'll be
+                         ;; equal on two different systems and will change
+                         ;; less often than time-stamps, thus leading to fewer
+                         ;; unneeded changes causing spurious conflicts), but
+                         ;; using time-stamps is a very useful optimization,
+                         ;; so we use time-stamps for the main autoloads file
+                         ;; (loaddefs.el) where we have special ways to
+                         ;; circumvent the "random change problem", and MD5
+                         ;; checksum in secondary autoload files where we do
+                         ;; not need the time-stamp optimization because it is
+                         ;; already provided by the primary autoloads file.
+                         (md5 secondary-autoloads-file-buf
+                              ;; We'd really want to just use
+                              ;; `emacs-internal' instead.
+                              nil nil 'emacs-mule-unix)
+                       (nth 5 (file-attributes relfile))))
+                    (insert ";;; Generated autoloads from " relfile "\n")))
                 (insert generate-autoload-section-trailer))))
           (message "Generating autoloads for %s...done" file))
         (or visited
             ;; We created this buffer, so we should kill it.
             (kill-buffer (current-buffer))))
-      ;; If the entries were added to some other buffer, then the file
-      ;; doesn't add entries to OUTFILE.
-      (or (not output-start) otherbuf))))
+      (or (not output-start)
+          ;; If the entries were added to some other buffer, then the file
+          ;; doesn't add entries to OUTFILE.
+          otherbuf))))
 \f
 (defun autoload-save-buffers ()
   (while autoload-modified-buffers
@@ -507,15 +558,14 @@ Return FILE if there was no autoload cookie in it, else nil."
           (message "Autoload section for %s is up to date." file)))
     (if no-autoloads file)))
 
-(defun autoload-find-destination (file)
+(defun autoload-find-destination (file load-name)
   "Find the destination point of the current buffer's autoloads.
 FILE is the file name of the current buffer.
 Returns a buffer whose point is placed at the requested location.
 Returns nil if the file's autoloads are uptodate, otherwise
 removes any prior now out-of-date autoload entries."
   (catch 'up-to-date
-    (let* ((load-name (autoload-file-load-name file))
-           (buf (current-buffer))
+    (let* ((buf (current-buffer))
            (existing-buffer (if buffer-file-name buf))
            (found nil))
       (with-current-buffer
@@ -528,7 +578,7 @@ removes any prior now out-of-date autoload entries."
         (unless (zerop (coding-system-eol-type buffer-file-coding-system))
           (set-buffer-file-coding-system 'unix))
         (or (> (buffer-size) 0)
-            (error "Autoloads file %s does not exist" buffer-file-name))
+            (error "Autoloads file %s lacks boilerplate" buffer-file-name))
         (or (file-writable-p buffer-file-name)
             (error "Autoloads file %s is not writable" buffer-file-name))
         (widen)
@@ -648,6 +698,7 @@ directory or directories specified."
                  (t
                    (autoload-remove-section (match-beginning 0))
                    (if (autoload-generate-file-autoloads
+                        ;; Passing `current-buffer' makes it insert at point.
                         file (current-buffer) buffer-file-name)
                        (push file no-autoloads))))
             (push file done)
@@ -656,6 +707,9 @@ directory or directories specified."
       (dolist (file files)
         (cond
          ((member (expand-file-name file) autoload-excludes) nil)
+         ;; Passing nil as second argument forces
+         ;; autoload-generate-file-autoloads to look for the right
+         ;; spot where to insert each autoloads section.
          ((autoload-generate-file-autoloads file nil buffer-file-name)
           (push file no-autoloads))))
 
index 998cee15342be5367b7e2ff150be2a0e75b2a4c7..96e2fb41e893f860e4ab81c6e036710a7aeb1cc4 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Rick Sladkey <jrs@world.std.com>
 ;; Maintainer: FSF
 ;; Keywords: extensions, internal
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
index e461010a6ce767a76d122b514e81f591f2faa1e0..1ff34fa6a81fb5d353f7c740ea0228e1fde2d812 100644 (file)
@@ -7,6 +7,7 @@
 ;;     Hallvard Furuseth <hbf@ulrik.uio.no>
 ;; Maintainer: FSF
 ;; Keywords: internal
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
index dbbf057ae22ef899ab98e45815cf4378e5e4b818..6ce141eb8e62e5e8e6b54f4f308cd28ec5d8291f 100644 (file)
@@ -7,6 +7,7 @@
 ;;     Hallvard Furuseth <hbf@ulrik.uio.no>
 ;; Maintainer: FSF
 ;; Keywords: internal
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
@@ -65,7 +66,6 @@ The return value of this function is not used."
 ;; Redefined in byte-optimize.el.
 ;; This is not documented--it's not clear that we should promote it.
 (fset 'inline 'progn)
-(put 'inline 'lisp-indent-function 0)
 
 ;;; Interface to inline functions.
 
index 394169be99d7665c16284aa5d9fdb3271a6c5d5e..c42292a27879294c47d9011706b0e8e0317af684 100644 (file)
@@ -7,6 +7,7 @@
 ;;     Hallvard Furuseth <hbf@ulrik.uio.no>
 ;; Maintainer: FSF
 ;; Keywords: lisp
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
@@ -3333,21 +3334,31 @@ If it is nil, then the handler is \"byte-compile-SYMBOL.\""
     (setq for-effect nil)))
 
 (defun byte-compile-setq-default (form)
-  (let ((bytecomp-args (cdr form))
-       setters)
-    (while bytecomp-args
-      (let ((var (car bytecomp-args)))
-       (and (or (not (symbolp var))
-                (byte-compile-const-symbol-p var t))
-            (byte-compile-warning-enabled-p 'constants)
-            (byte-compile-warn
-             "variable assignment to %s `%s'"
-             (if (symbolp var) "constant" "nonvariable")
-             (prin1-to-string var)))
-       (push (list 'set-default (list 'quote var) (car (cdr bytecomp-args)))
-             setters))
-      (setq bytecomp-args (cdr (cdr bytecomp-args))))
-    (byte-compile-form (cons 'progn (nreverse setters)))))
+  (setq form (cdr form))
+  (if (> (length form) 2)
+      (let ((setters ()))
+        (while (consp form)
+          (push `(setq-default ,(pop form) ,(pop form)) setters))
+        (byte-compile-form (cons 'progn (nreverse setters))))
+    (let ((var (car form)))
+      (and (or (not (symbolp var))
+               (byte-compile-const-symbol-p var t))
+           (byte-compile-warning-enabled-p 'constants)
+           (byte-compile-warn
+            "variable assignment to %s `%s'"
+            (if (symbolp var) "constant" "nonvariable")
+            (prin1-to-string var)))
+      (byte-compile-normal-call `(set-default ',var ,@(cdr form))))))
+
+(byte-defop-compiler-1 set-default)
+(defun byte-compile-set-default (form)
+  (let ((varexp (car-safe (cdr-safe form))))
+    (if (eq (car-safe varexp) 'quote)
+        ;; If the varexp is constant, compile it as a setq-default
+        ;; so we get more warnings.
+        (byte-compile-setq-default `(setq-default ,(car-safe (cdr varexp))
+                                                  ,@(cddr form)))
+      (byte-compile-normal-call form))))
 
 (defun byte-compile-quote (form)
   (byte-compile-constant (car (cdr form))))
index 68d7c0ae3bad99016a558f2b1add016f64a16c61..f4923b6f8c6fea9996a6be0731c6b72ddef39b2c 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Dave Gillespie <daveg@synaptics.com>
 ;; Version: 2.02
 ;; Keywords: extensions
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
 ;;; by capitalizing the first letter: Values, Multiple-value-*,
 ;;; to avoid conflict with the new-style definitions in cl-macs.
 
-(put 'Multiple-value-bind  'lisp-indent-function 2)
-(put 'Multiple-value-setq  'lisp-indent-function 2)
-(put 'Multiple-value-call  'lisp-indent-function 1)
-(put 'Multiple-value-prog1 'lisp-indent-function 1)
-
 (defvar *mvalues-values* nil)
 
 (defun Values (&rest val-forms)
             (list *mvalues-temp*))))
 
 (defmacro Multiple-value-call (function &rest args)
+  (declare (indent 1))
   (list 'apply function
        (cons 'append
              (mapcar (function (lambda (x) (list 'Multiple-value-list x)))
                      args))))
 
 (defmacro Multiple-value-bind (vars form &rest body)
+  (declare (indent 2))
   (list* 'multiple-value-bind vars (list 'Multiple-value-list form) body))
 
 (defmacro Multiple-value-setq (vars form)
+  (declare (indent 2))
   (list 'multiple-value-setq vars (list 'Multiple-value-list form)))
 
 (defmacro Multiple-value-prog1 (form &rest body)
+  (declare (indent 1))
   (list 'prog1 form (list* 'let '((*mvalues-values* nil)) body)))
 
 
index 3211f79c9e954a5487485de90fc99f614fbc0282..b7c908882ed088c4954084da3b0fa8793c00c5aa 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Author: Dave Gillespie <daveg@synaptics.com>
 ;; Keywords: extensions
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
@@ -685,7 +686,7 @@ PROPLIST is a list of the sort returned by `symbol-plist'.
     (setq last (point))
     (goto-char (1+ pt))
     (while (search-forward "(quote " last t)
-      (delete-backward-char 7)
+      (delete-char -7)
       (insert "'")
       (forward-sexp)
       (delete-char 1))
index e4f605d4fd0e4048ccec2fa8450cbdc535f799db..4e7ada8851f4b08f4edd9cfc96e567a83fdded10 100644 (file)
@@ -7,6 +7,7 @@
 ;; Created: July 1987
 ;; Maintainer: FSF
 ;; Keywords: lisp, tools
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
index 7640a0b1575833f5e2c694f70b345461434fc21c..1efeae382f92abda984664545a3f8037d01fd3d0 100644 (file)
@@ -10,7 +10,7 @@
 ;;;;;;  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" "d93072a26c59f663a92b10df8bc28187")
+;;;;;;  cl-mapcar-many equalp coerce) "cl-extra" "cl-extra.el" "20c8c875ff1d11dd819e15a1f25afd73")
 ;;; Generated autoloads from cl-extra.el
 
 (autoload 'coerce "cl-extra" "\
@@ -277,12 +277,12 @@ Not documented
 ;;;;;;  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" "49b7d96626dd8ba5d39551909edbd4c7")
+;;;;;;  declare 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" "c5a12d86541b5137054eccc43e4fc839")
 ;;; Generated autoloads from cl-macs.el
 
 (autoload 'gensym "cl-macs" "\
@@ -535,11 +535,6 @@ Not documented
 
 \(fn &rest BODY)" nil (quote macro))
 
-(autoload 'the "cl-macs" "\
-Not documented
-
-\(fn TYPE FORM)" nil (quote macro))
-
 (autoload 'declare "cl-macs" "\
 Not documented
 
@@ -759,7 +754,7 @@ surrounded by (block NAME ...).
 ;;;;;;  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" "ec3ea1c77742734db8496272fe5721be")
+;;;;;;  replace fill reduce) "cl-seq" "cl-seq.el" "7b7531276ddf8457abecdd487d3cf0b7")
 ;;; Generated autoloads from cl-seq.el
 
 (autoload 'reduce "cl-seq" "\
@@ -1242,7 +1237,6 @@ Keywords supported:  :test :test-not :key
 ;; version-control: never
 ;; no-byte-compile: t
 ;; no-update-autoloads: t
+;; coding: utf-8
 ;; End:
-
-;; arch-tag: 08cc5aab-e992-47f6-992e-12a7428c1a0e
 ;;; cl-loaddefs.el ends here
index 3e800c5300814d7a378aac9d47348475b48c94c6..db2ab1c91d6c325a50622a1693d4ff8737241c5d 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Dave Gillespie <daveg@synaptics.com>
 ;; Version: 2.02
 ;; Keywords: extensions
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
   (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
@@ -1763,6 +1770,7 @@ Example:
 (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)
@@ -1806,6 +1814,7 @@ Example:
 (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)
@@ -1815,10 +1824,26 @@ Example:
 (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.
+;; 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*))
@@ -2616,21 +2641,36 @@ surrounded by (block NAME ...).
                    (cons '&cl-quote args))
                  (list* 'cl-defsubst-expand (list 'quote argns)
                         (list 'quote (list* 'block name body))
-                        (not (or unsafe (cl-expr-access-order pbody argns)))
+                         ;; 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))
-    (let ((lets (delq nil
-                     (mapcar* (function
-                               (lambda (argn argv)
-                                 (if (or simple (cl-const-expr-p argv))
-                                     (progn (setq body (subst argv argn body))
-                                            (and unsafe (list argn argv)))
-                                   (list argn argv))))
-                              argns argvs))))
+    (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))))
+      ;; FIXME: `sublis/subst' will happily substitute the symbol
+      ;; `argn' in places where it's not used as a reference
+      ;; to a variable.
+      ;; FIXME: `sublis/subst' will happily copy `argv' to a different
+      ;; 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))))
 
 
index a823e9015db6ea13f84ce487a0970d7dbc6fd61c..a5070e4aceab8a681ca4b13424f6870b4ae2495f 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Dave Gillespie <daveg@synaptics.com>
 ;; Version: 2.02
 ;; Keywords: extensions
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
@@ -47,6 +48,7 @@
 ;;; this file independent from cl-macs.
 
 (defmacro cl-parsing-keywords (kwords other-keys &rest body)
+  (declare (indent 2) (debug (sexp sexp &rest form)))
   (cons
    'let*
    (cons (mapcar
                                          (car cl-keys-temp)))
                            '(setq cl-keys-temp (cdr (cdr cl-keys-temp)))))))
          body))))
-(put 'cl-parsing-keywords 'lisp-indent-function 2)
-(put 'cl-parsing-keywords 'edebug-form-spec '(sexp sexp &rest form))
 
 (defmacro cl-check-key (x)
+  (declare (debug edebug-forms))
   (list 'if 'cl-key (list 'funcall 'cl-key x) x))
 
 (defmacro cl-check-test-nokey (item x)
+  (declare (debug edebug-forms))
   (list 'cond
        (list 'cl-test
              (list 'eq (list 'not (list 'funcall 'cl-test item x))
                       (list 'equal item x) (list 'eq item x)))))
 
 (defmacro cl-check-test (item x)
+  (declare (debug edebug-forms))
   (list 'cl-check-test-nokey item (list 'cl-check-key x)))
 
 (defmacro cl-check-match (x y)
+  (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))))
 
-(put 'cl-check-key 'edebug-form-spec 'edebug-forms)
-(put 'cl-check-test 'edebug-form-spec 'edebug-forms)
-(put 'cl-check-test-nokey 'edebug-form-spec 'edebug-forms)
-(put 'cl-check-match 'edebug-form-spec 'edebug-forms)
-
 (defvar cl-test) (defvar cl-test-not)
 (defvar cl-if) (defvar cl-if-not)
 (defvar cl-key)
index acfd3504ec769c1736c0ddad7acb4f78cf64ebfc..776ce5e9ca1ead949d1214e4e3e75c5435d1a166 100644 (file)
@@ -4,6 +4,7 @@
 ;;   2006, 2007, 2008, 2009, 2010 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
index 6f7a43af844ef7174d2f185177d8229a665be636..43eb61b0bee183ac01586b91a53c6029479ae6ae 100644 (file)
@@ -158,13 +158,15 @@ When this is `function', only ask when called non-interactively."
     (unless (string= (buffer-substring (- (match-end 3) 2) (match-end 3))
                     (substring copyright-current-year -2))
       (if (or noquery
-             ;; Fixes some point-moving oddness (bug#2209).
-             (save-excursion
-               (y-or-n-p (if replace
-                             (concat "Replace copyright year(s) by "
-                                     copyright-current-year "? ")
-                           (concat "Add " copyright-current-year
-                                   " to copyright? ")))))
+             (save-window-excursion
+               (switch-to-buffer (current-buffer))
+               ;; Fixes some point-moving oddness (bug#2209).
+               (save-excursion
+                 (y-or-n-p (if replace
+                               (concat "Replace copyright year(s) by "
+                                       copyright-current-year "? ")
+                             (concat "Add " copyright-current-year
+                                     " to copyright? "))))))
          (if replace
              (replace-match copyright-current-year t t nil 3)
            (let ((size (save-excursion (skip-chars-backward "0-9"))))
@@ -224,8 +226,10 @@ version \\([0-9]+\\), or (at"
                   (string-to-number copyright-current-gpl-version))
               (or noquery
                    (save-match-data
-                     (y-or-n-p (format "Replace GPL version by %s? "
-                                       copyright-current-gpl-version))))
+                    (save-window-excursion
+                      (switch-to-buffer (current-buffer))
+                      (y-or-n-p (format "Replace GPL version by %s? "
+                                        copyright-current-gpl-version)))))
               (progn
                 (if (match-end 2)
                     ;; Esperanto bilingual comment in two-column.el
index b8ff3c03ee9e9e9dd7b362eba37075e63236ac2e..17fcf7ad6c512c5190f9e4de5ed398c1420868e6 100644 (file)
@@ -514,9 +514,9 @@ Applies to the frame whose line point is on in the backtrace."
        (insert ? )))
   (beginning-of-line))
 
-(put 'debugger-env-macro 'lisp-indent-function 0)
 (defmacro debugger-env-macro (&rest body)
   "Run BODY in original environment."
+  (declare (indent 0))
   `(save-excursion
     (if (null (buffer-name debugger-old-buffer))
         ;; old buffer deleted
index debef5535f5d6a794e3ef96681216999418041f2..3456d1a63fbcfa65bf1ec453c8e818a50cb04b62 100644 (file)
@@ -7,6 +7,7 @@
 ;; Author: David Megginson (dmeggins@aix1.uottawa.ca)
 ;; Maintainer: FSF
 ;; Keywords: extensions
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
@@ -230,7 +231,7 @@ No problems result if this variable is not bound.
                                        ; Run the parent.
         (delay-mode-hooks
 
-         (,(or parent 'kill-all-local-variables))
+         (,(or parent 'fundamental-mode))
                                        ; Identify the child mode.
          (setq major-mode (quote ,child))
          (setq mode-name ,name)
index a48816f99c62f25b524959693a09896c32c9aeac..e11572dfc627521c26f3bd2230b39acdbee2ca65 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Author: Georges Brun-Cottan <Georges.Brun-Cottan@inria.fr>
 ;; Maintainer: Stefan Monnier <monnier@gnu.org>
+;; Package: emacs
 
 ;; Keywords: extensions lisp
 
@@ -114,6 +115,11 @@ BODY contains code to execute each time the mode is enabled or disabled.
 :lighter SPEC  Same as the LIGHTER argument.
 :keymap MAP    Same as the KEYMAP argument.
 :require SYM   Same as in `defcustom'.
+:variable PLACE        The location (as can be used with `setf') to use instead
+               of the variable MODE to store the state of the mode.  PLACE
+               can also be of the form (GET . SET) where GET is an expression
+               that returns the current state and SET is a function that takes
+               a new state and sets it.
 
 For example, you could write
   (define-minor-mode foo-mode \"If enabled, foo on you!\"
@@ -145,6 +151,9 @@ For example, you could write
         (type nil)
         (extra-args nil)
         (extra-keywords nil)
+         (variable nil)          ;The PLACE where the state is stored.
+         (setter nil)            ;The function (if any) to set the mode var.
+         (modefun mode)          ;The minor mode function name we're defining.
         (require t)
         (hook (intern (concat mode-name "-hook")))
         (hook-on (intern (concat mode-name "-on-hook")))
@@ -165,6 +174,12 @@ For example, you could write
        (:type (setq type (list :type (pop body))))
        (:require (setq require (pop body)))
        (:keymap (setq keymap (pop body)))
+        (:variable (setq variable (pop body))
+         (if (not (functionp (cdr-safe variable)))
+             ;; PLACE is not of the form (GET . SET).
+             (setq mode variable)
+           (setq mode (car variable))
+           (setq setter (cdr variable))))
        (t (push keyw extra-keywords) (push (pop body) extra-keywords))))
 
     (setq keymap-sym (if (and keymap (symbolp keymap)) keymap
@@ -185,12 +200,16 @@ For example, you could write
 
     `(progn
        ;; Define the variable to enable or disable the mode.
-       ,(if (not globalp)
-           `(progn
-              (defvar ,mode ,init-value ,(format "Non-nil if %s is enabled.
+       ,(cond
+         ;; If :variable is specified, then the var will be
+         ;; declared elsewhere.
+         (variable nil)
+         ((not globalp)
+          `(progn
+             (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))
-
+             (make-variable-buffer-local ',mode)))
+         (t
          (let ((base-doc-string
                  (concat "Non-nil if %s is enabled.
 See the command `%s' for a description of this minor mode."
@@ -205,10 +224,10 @@ or call the function `%s'."))))
               ,@group
               ,@type
               ,@(unless (eq require t) `(:require ,require))
-               ,@(nreverse extra-keywords))))
+               ,@(nreverse extra-keywords)))))
 
        ;; The actual function.
-       (defun ,mode (&optional arg ,@extra-args)
+       (defun ,modefun (&optional arg ,@extra-args)
         ,(or doc
              (format (concat "Toggle %s on or off.
 Interactively, with no prefix argument, toggle the mode.
@@ -219,22 +238,19 @@ With zero or negative ARG turn mode off.
         ;; repeat-command still does the toggling correctly.
         (interactive (list (or current-prefix-arg 'toggle)))
         (let ((,last-message (current-message)))
-           (setq ,mode
-                 (cond
-                  ((eq arg 'toggle) (not ,mode))
-                  (arg (> (prefix-numeric-value arg) 0))
-                  (t
-                   (if (null ,mode) t
-                     (message
-                      "Toggling %s off; better pass an explicit argument."
-                      ',mode)
-                     nil))))
+           (,@(if setter (list setter)
+                (list (if (symbolp mode) 'setq 'setf) mode))
+            (if (eq arg 'toggle)
+                (not ,mode)
+              ;; A nil argument also means ON now.
+              (> (prefix-numeric-value arg) 0)))
            ,@body
            ;; The on/off hooks are here for backward compatibility only.
            (run-hooks ',hook (if ,mode ',hook-on ',hook-off))
            (if (called-interactively-p 'any)
                (progn
-                 ,(if globalp `(customize-mark-as-set ',mode))
+                 ,(if (and globalp (symbolp mode))
+                      `(customize-mark-as-set ',mode))
                  ;; Avoid overwriting a message shown by the body,
                  ;; but do overwrite previous messages.
                  (unless (and (current-message)
@@ -259,9 +275,15 @@ With zero or negative ARG turn mode off.
                     (t (error "Invalid keymap %S" ,keymap))))
             ,(format "Keymap for `%s'." mode-name)))
 
-       (add-minor-mode ',mode ',lighter
-                      ,(if keymap keymap-sym
-                         `(if (boundp ',keymap-sym) ,keymap-sym))))))
+       ,(if (not (symbolp mode))
+            (if (or lighter keymap)
+                (error ":lighter and :keymap unsupported with mode expression %s" mode))
+          `(with-no-warnings
+             (add-minor-mode ',mode ',lighter
+                           ,(if keymap keymap-sym
+                                `(if (boundp ',keymap-sym) ,keymap-sym))
+                             nil
+                             ,(unless (eq mode modefun) 'modefun)))))))
 \f
 ;;;
 ;;; make global minor mode
@@ -341,9 +363,11 @@ See `%s' for more information on %s."
             (progn
               (add-hook 'after-change-major-mode-hook
                         ',MODE-enable-in-buffers)
+              (add-hook 'fundamental-mode-hook ',MODE-enable-in-buffers)
               (add-hook 'find-file-hook ',MODE-check-buffers)
               (add-hook 'change-major-mode-hook ',MODE-cmhh))
           (remove-hook 'after-change-major-mode-hook ',MODE-enable-in-buffers)
+           (remove-hook 'fundamental-mode-hook ',MODE-enable-in-buffers)
           (remove-hook 'find-file-hook ',MODE-check-buffers)
           (remove-hook 'change-major-mode-hook ',MODE-cmhh))
 
@@ -364,13 +388,14 @@ See `%s' for more information on %s."
         (dolist (buf ,MODE-buffers)
           (when (buffer-live-p buf)
             (with-current-buffer buf
-              (if ,mode
-                  (unless (eq ,MODE-major-mode major-mode)
-                    (,mode -1)
-                    (,turn-on)
-                    (setq ,MODE-major-mode major-mode))
-                (,turn-on)
-                (setq ,MODE-major-mode major-mode))))))
+               (unless (eq ,MODE-major-mode major-mode)
+                 (if ,mode
+                     (progn
+                       (,mode -1)
+                       (,turn-on)
+                       (setq ,MODE-major-mode major-mode))
+                   (,turn-on)
+                   (setq ,MODE-major-mode major-mode)))))))
        (put ',MODE-enable-in-buffers 'definition-name ',global-mode)
 
        (defun ,MODE-check-buffers ()
index 470f0f677797bd00431d4bbd1360308356fcff13..9992861fc3c2437751866a12ddc4af0062e01001 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Keywords: emulations
 ;; Author: Richard Stallman <rms@gnu.org>
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
@@ -42,8 +43,6 @@ menus, turn this variable off, otherwise it is probably better to keep it on.")
 (defsubst easy-menu-intern (s)
   (if (stringp s) (intern s) s))
 
-;;;###autoload
-(put 'easy-menu-define 'lisp-indent-function 'defun)
 ;;;###autoload
 (defmacro easy-menu-define (symbol maps doc menu)
   "Define a menu bar submenu in maps MAPS, according to MENU.
@@ -150,6 +149,7 @@ unselectable text.  A string consisting solely of hyphens is displayed
 as a solid horizontal line.
 
 A menu item can be a list with the same format as MENU.  This is a submenu."
+  (declare (indent defun))
   `(progn
      ,(if symbol `(defvar ,symbol nil ,doc))
      (easy-menu-do-define (quote ,symbol) ,maps ,doc ,menu)))
index 8bf20b0ccef0f0b678950a10d03bedd04308f915..43fb5762647a5db9e73b29cbd84b04efd56a02cc 100644 (file)
@@ -885,17 +885,12 @@ already is one.)"
    (edebug-storing-offsets (1- (point)) 'quote)
    (edebug-read-storing-offsets stream)))
 
-(defvar edebug-read-backquote-level 0
-  "If non-zero, we're in a new-style backquote.
-It should never be negative.  This controls how we read comma constructs.")
-
 (defun edebug-read-backquote (stream)
   ;; Turn `thing into (\` thing)
   (forward-char 1)
   (list
    (edebug-storing-offsets (1- (point)) '\`)
-   (let ((edebug-read-backquote-level (1+ edebug-read-backquote-level)))
-     (edebug-read-storing-offsets stream))))
+   (edebug-read-storing-offsets stream)))
 
 (defun edebug-read-comma (stream)
   ;; Turn ,thing into (\, thing).  Handle ,@ and ,. also.
@@ -910,12 +905,9 @@ It should never be negative.  This controls how we read comma constructs.")
             (forward-char 1)))
       ;; Generate the same structure of offsets we would have
       ;; if the resulting list appeared verbatim in the input text.
-      (if (zerop edebug-read-backquote-level)
-         (edebug-storing-offsets opoint symbol)
-       (list
-        (edebug-storing-offsets opoint symbol)
-        (let ((edebug-read-backquote-level (1- edebug-read-backquote-level)))
-          (edebug-read-storing-offsets stream)))))))
+      (list
+       (edebug-storing-offsets opoint symbol)
+       (edebug-read-storing-offsets stream)))))
 
 (defun edebug-read-function (stream)
   ;; Turn #'thing into (function thing)
@@ -937,17 +929,7 @@ It should never be negative.  This controls how we read comma constructs.")
   (prog1
       (let ((elements))
        (while (not (memq (edebug-next-token-class) '(rparen dot)))
-         (if (and (eq (edebug-next-token-class) 'backquote)
-                  (null elements)
-                  (zerop edebug-read-backquote-level))
-             (progn
-               ;; Old style backquote.
-               (forward-char 1)        ; Skip backquote.
-               ;; Call edebug-storing-offsets here so that we
-               ;; produce the same offsets we would have had
-               ;; if the backquote were an ordinary symbol.
-               (push (edebug-storing-offsets (1- (point)) '\`) elements))
-           (push (edebug-read-storing-offsets stream) elements)))
+          (push (edebug-read-storing-offsets stream) elements))
        (setq elements (nreverse elements))
        (if (eq 'dot (edebug-next-token-class))
            (let (dotted-form)
@@ -4455,7 +4437,7 @@ With prefix argument, make it a temporary breakpoint."
   (add-hook 'cl-load-hook
            (function (lambda () (require 'cl-specs)))))
 
-;;; edebug-cl-read and cl-read are available from liberte@cs.uiuc.edu
+;; edebug-cl-read and cl-read are available from liberte@cs.uiuc.edu
 (if (featurep 'cl-read)
     (add-hook 'edebug-setup-hook
              (function (lambda () (require 'edebug-cl-read))))
@@ -4466,8 +4448,8 @@ With prefix argument, make it a temporary breakpoint."
 \f
 ;;; Finalize Loading
 
-;;; Finally, hook edebug into the rest of Emacs.
-;;; There are probably some other things that could go here.
+;; Finally, hook edebug into the rest of Emacs.
+;; There are probably some other things that could go here.
 
 ;; Install edebug read and eval functions.
 (edebug-install-read-eval-functions)
index b573af29ee27bbceace19afca9dac56ab2e6e514..91cb5642fb767d2ee914c6bd9cc56de8b17c0ba7 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Eric M. Ludlam  <zappo@gnu.org>
 ;; Version: 0.2
 ;; Keywords: OO, lisp
+;; Package: eieio
 
 ;; This file is part of GNU Emacs.
 
index a2b955a280be2623b77d10b1e125a52906b980c0..0e76f4bb3312483d5a022389bceb31bc8087f5db 100644 (file)
@@ -5,7 +5,8 @@
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Version: 0.2
-;; Keywords: oop, lisp, tools
+;; Keywords: lisp, tools
+;; Package: eieio
 
 ;; This file is part of GNU Emacs.
 
index 268d60fc19632de476fa27922bc9f92f2f05bbc9..12ff23b311f0042f6728462edd92b7fd95c9940f 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Version: 0.2
 ;; Keywords: OO, lisp
+;; Package: eieio
 
 ;; This file is part of GNU Emacs.
 
index 5dc54f5c35e35cb634ba8c2b9631ffa95dccebd9..b58fbfd3f0872a7b5d1d5040955fa73393fe8827 100644 (file)
@@ -4,6 +4,7 @@
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: OO, lisp
+;; Package: eieio
 
 ;; This file is part of GNU Emacs.
 
index 375ce0bc6d6bf9e4c0c78d0764cc4e2e4bc05b74..ca3850562c8fe151980de9ca1a98ac668e64c4b9 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Version: 0.2
 ;; Keywords: OO, lisp
+;; Package: eieio
 
 ;; This file is part of GNU Emacs.
 
index e4c1c50aa8f9cf390bd0ef608947a85840315f6e..e16c3a17438492b3858cb647fb02fdfcbabcfeca 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Version: 0.2
 ;; Keywords: OO, tools
+;; Package: eieio
 
 ;; This file is part of GNU Emacs.
 
index f5e684e1323e192ed3350895b7b987351d92a562..34fb5b9c9fc246d44db02527868f2b93e0be392c 100644 (file)
@@ -1610,6 +1610,7 @@ SPEC-LIST is of a form similar to `let'.  For example:
 Where each VAR is the local variable given to the associated
 SLOT.  A slot specified without a variable name is given a
 variable name of the same name as the slot."
+  (declare (indent 2))
   ;; Transform the spec-list into a symbol-macrolet spec-list.
   (let ((mappings (mapcar (lambda (entry)
                            (let ((var  (if (listp entry) (car entry) entry))
@@ -1618,8 +1619,6 @@ variable name of the same name as the slot."
                          spec-list)))
     (append (list 'symbol-macrolet mappings)
            body)))
-(put 'with-slots 'lisp-indent-function 2)
-
 \f
 ;;; Simple generators, and query functions.  None of these would do
 ;;  well embedded into an object.
index 961d576433a064575c37726a2085cd8b540dcb73..b4845495c9ef1f52adb500f1ed9673e7dce54b7d 100644 (file)
@@ -530,13 +530,13 @@ The words \"&rest\", \"&optional\" are returned unchanged."
 \f
 ;; Prime the command list.
 (eldoc-add-command-completions
- "backward-" "beginning-of-" "move-beginning-of-" "delete-other-windows"
- "delete-window" "handle-select-window"
- "end-of-" "move-end-of-" "exchange-point-and-mark" "forward-"
- "indent-for-tab-command" "goto-" "mark-page" "mark-paragraph"
- "mouse-set-point" "move-" "pop-global-mark" "next-" "other-window"
- "previous-" "recenter" "scroll-" "self-insert-command"
- "split-window-" "up-list" "down-list")
+ "backward-" "beginning-of-" "delete-other-windows" "delete-window"
+ "down-list" "end-of-" "exchange-point-and-mark" "forward-" "goto-"
+ "handle-select-window" "indent-for-tab-command" "left-" "mark-page"
+ "mark-paragraph" "mouse-set-point" "move-" "move-beginning-of-"
+ "move-end-of-" "next-" "other-window" "pop-global-mark" "previous-"
+ "recenter" "right-" "scroll-" "self-insert-command" "split-window-"
+ "up-list")
 
 (provide 'eldoc)
 
index 3ca1df466b9fa950c114e6810b7149e6c82ae283..49d3a7075d4de9fc6fb031c63dbc4e182cfba04b 100644 (file)
@@ -60,7 +60,7 @@ Each entry has the form (FUNCTION . FUNCTIONS-IT-CALLS).")
     "indent.c" "search.c" "regex.c" "undo.c"
     "alloc.c" "data.c" "doc.c" "editfns.c"
     "callint.c" "eval.c" "fns.c" "print.c" "lread.c"
-    "abbrev.c" "syntax.c" "unexec.c"
+    "abbrev.c" "syntax.c" "unexcoff.c"
     "bytecode.c" "process.c" "callproc.c" "doprnt.c"
     "x11term.c" "x11fns.c"))
 
index 6a05bda82ae582948edc849b597f9ae8c7209d64..6bdc9073ddf39da507c95b1d1006c3206180efb1 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Maintainer: FSF
 ;; Keywords: internal
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
index b6e8427ea1cfc0cf08826af184193a92b405605d..51b23c3f402619aab3cc9656e9cb6841e58881b2 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author:  Peter Breton <pbreton@cs.umb.edu>
 ;; Created: Fri Sep 27 1996
 ;; Keywords: generic, comment, font-lock
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
index b7cb8b93c2f2972e56ef576aa32afa2b1845ce9a..6a5974293289c93855e1d5e6257b02f1d6775f9f 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: K. Shane Hartman
 ;; Maintainer: FSF
 ;; Keywords: help
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
index 8a1c753f5f68f683cfe86c4da892c87590b836bf..7df65acb28332b9a5249aee854b136669c5c8387 100644 (file)
@@ -298,6 +298,7 @@ The returned value is a list of strings, one per line."
 (defmacro lm-with-file (file &rest body)
   "Execute BODY in a buffer containing the contents of FILE.
 If FILE is nil, execute BODY in the current buffer."
+  (declare (indent 1) (debug t))
   (let ((filesym (make-symbol "file")))
     `(let ((,filesym ,file))
        (if ,filesym
@@ -311,9 +312,6 @@ If FILE is nil, execute BODY in the current buffer."
           (with-syntax-table emacs-lisp-mode-syntax-table
             ,@body))))))
 
-(put 'lm-with-file 'lisp-indent-function 1)
-(put 'lm-with-file 'edebug-form-spec t)
-
 ;; Fixme: Probably this should be amalgamated with copyright.el; also
 ;; we need a check for ranges in copyright years.
 
@@ -458,7 +456,9 @@ each line."
   "Return list of keywords given in file FILE."
   (let ((keywords (lm-keywords file)))
     (if keywords
-       (split-string keywords "[, \t\n]+" t))))
+       (if (string-match-p "," keywords)
+           (split-string keywords ",[ \t\n]*" t)
+         (split-string keywords "[ \t\n]+" t)))))
 
 (defvar finder-known-keywords)
 (defun lm-keywords-finder-p (&optional file)
index 4b58a4e68c2346eaf0886420bbd6533ca0a5c2d8..e4330e43fc9adb5cd0f8a644b59789a5e46e67a0 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Maintainer: FSF
 ;; Keywords: lisp, languages
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
@@ -85,7 +86,7 @@
   (let ((table (copy-syntax-table emacs-lisp-mode-syntax-table)))
     (modify-syntax-entry ?\[ "_   " table)
     (modify-syntax-entry ?\] "_   " table)
-    (modify-syntax-entry ?# "' 14b" table)
+    (modify-syntax-entry ?# "' 14" table)
     (modify-syntax-entry ?| "\" 23bn" table)
     table)
   "Syntax table used in `lisp-mode'.")
@@ -221,8 +222,6 @@ font-lock keywords will not be case sensitive."
   ;;(set (make-local-variable 'adaptive-fill-mode) nil)
   (make-local-variable 'indent-line-function)
   (setq indent-line-function 'lisp-indent-line)
-  (make-local-variable 'parse-sexp-ignore-comments)
-  (setq parse-sexp-ignore-comments t)
   (make-local-variable 'outline-regexp)
   (setq outline-regexp ";;;\\(;* [^ \t\n]\\|###autoload\\)\\|(")
   (make-local-variable 'outline-level)
@@ -431,7 +430,7 @@ All commands in `lisp-mode-shared-map' are inherited by this map.")
   :type 'hook
   :group 'lisp)
 
-(define-derived-mode emacs-lisp-mode nil "Emacs-Lisp"
+(define-derived-mode emacs-lisp-mode prog-mode "Emacs-Lisp"
   "Major mode for editing Lisp code to run in Emacs.
 Commands:
 Delete converts tabs to spaces as it moves back.
@@ -466,7 +465,7 @@ if that value is non-nil."
   "Keymap for ordinary Lisp mode.
 All commands in `lisp-mode-shared-map' are inherited by this map.")
 
-(defun lisp-mode ()
+(define-derived-mode lisp-mode prog-mode "Lisp"
   "Major mode for editing Lisp code for Lisps other than GNU Emacs Lisp.
 Commands:
 Delete converts tabs to spaces as it moves back.
@@ -478,19 +477,12 @@ or to switch back to an existing one.
 
 Entry to this mode calls the value of `lisp-mode-hook'
 if that value is non-nil."
-  (interactive)
-  (kill-all-local-variables)
-  (use-local-map lisp-mode-map)
-  (setq major-mode 'lisp-mode)
-  (setq mode-name "Lisp")
   (lisp-mode-variables nil t)
+  (set (make-local-variable 'find-tag-default-function) 'lisp-find-tag-default)
   (make-local-variable 'comment-start-skip)
   (setq comment-start-skip
        "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\)\\(;+\\|#|\\) *")
-  (setq imenu-case-fold-search t)
-  (set-syntax-table lisp-mode-syntax-table)
-  (run-mode-hooks 'lisp-mode-hook))
-(put 'lisp-mode 'find-tag-default-function 'lisp-find-tag-default)
+  (setq imenu-case-fold-search t))
 
 (defun lisp-find-tag-default ()
   (let ((default (find-tag-default)))
@@ -1218,31 +1210,17 @@ This function also returns nil meaning don't specify the indentation."
 (put 'prog2 'lisp-indent-function 2)
 (put 'save-excursion 'lisp-indent-function 0)
 (put 'save-window-excursion 'lisp-indent-function 0)
-(put 'save-selected-window 'lisp-indent-function 0)
 (put 'save-restriction 'lisp-indent-function 0)
 (put 'save-match-data 'lisp-indent-function 0)
 (put 'save-current-buffer 'lisp-indent-function 0)
-(put 'with-current-buffer 'lisp-indent-function 1)
-(put 'combine-after-change-calls 'lisp-indent-function 0)
-(put 'with-output-to-string 'lisp-indent-function 0)
-(put 'with-temp-file 'lisp-indent-function 1)
-(put 'with-temp-buffer 'lisp-indent-function 0)
-(put 'with-temp-message 'lisp-indent-function 1)
-(put 'with-syntax-table 'lisp-indent-function 1)
 (put 'let 'lisp-indent-function 1)
 (put 'let* 'lisp-indent-function 1)
 (put 'while 'lisp-indent-function 1)
 (put 'if 'lisp-indent-function 2)
-(put 'read-if 'lisp-indent-function 2)
 (put 'catch 'lisp-indent-function 1)
 (put 'condition-case 'lisp-indent-function 2)
 (put 'unwind-protect 'lisp-indent-function 1)
 (put 'with-output-to-temp-buffer 'lisp-indent-function 1)
-(put 'eval-after-load 'lisp-indent-function 1)
-(put 'dolist 'lisp-indent-function 1)
-(put 'dotimes 'lisp-indent-function 1)
-(put 'when 'lisp-indent-function 1)
-(put 'unless 'lisp-indent-function 1)
 
 (defun indent-sexp (&optional endpos)
   "Indent each line of the list starting just after point.
index 54fa4d615cd5bf2c5810ac04dbbd7c3f96f14c17..e799dcd77c154ad8212d5a85c306da5c2f4264b2 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Maintainer: FSF
 ;; Keywords: lisp, languages
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
@@ -142,7 +143,13 @@ This command assumes point is not in a string or comment."
   (or arg (setq arg 1))
   (let ((inc (if (> arg 0) 1 -1)))
     (while (/= arg 0)
-      (goto-char (or (scan-lists (point) inc 1) (buffer-end arg)))
+      (if forward-sexp-function
+          (condition-case err
+              (while (let ((pos (point)))
+                       (forward-sexp inc)
+                       (/= (point) pos)))
+            (scan-error (goto-char (nth 2 err))))
+        (goto-char (or (scan-lists (point) inc 1) (buffer-end arg))))
       (setq arg (- arg inc)))))
 
 (defun kill-sexp (&optional arg)
@@ -624,21 +631,25 @@ considered."
   (interactive)
   (let* ((data (lisp-completion-at-point predicate))
          (plist (nthcdr 3 data)))
-    (let ((completion-annotate-function (plist-get plist :annotate-function)))
+    (if (null data)
+        (minibuffer-message "Nothing to complete")
+      (let ((completion-annotate-function
+             (plist-get plist :annotate-function)))
       (completion-in-region (nth 0 data) (nth 1 data) (nth 2 data)
-                            (plist-get plist :predicate)))))
+                              (plist-get plist :predicate))))))
 
 
 (defun lisp-completion-at-point (&optional predicate)
   "Function used for `completion-at-point-functions' in `emacs-lisp-mode'."
   ;; FIXME: the `end' could be after point?
-  (let* ((end (point))
+  (let* ((pos (point))
          (beg (with-syntax-table emacs-lisp-mode-syntax-table
-                (save-excursion
-                  (backward-sexp 1)
-                  (while (= (char-syntax (following-char)) ?\')
-                    (forward-char 1))
-                  (point))))
+                (condition-case nil
+                    (save-excursion
+                      (backward-sexp 1)
+                      (skip-syntax-forward "'")
+                      (point))
+                  (scan-error pos))))
          (predicate
           (or predicate
               (save-excursion
@@ -657,12 +668,23 @@ considered."
                       ;; Maybe a `let' varlist or something.
                       nil
                     ;; Else, we assume that a function name is expected.
-                    'fboundp))))))
-    (list beg end obarray
-          :predicate predicate
-          :annotate-function
+                    'fboundp)))))
+         (end
+          (unless (or (eq beg (point-max))
+                      (member (char-syntax (char-after beg)) '(?\" ?\( ?\))))
+            (condition-case nil
+                (save-excursion
+                  (goto-char beg)
+                  (forward-sexp 1)
+                  (when (>= (point) pos)
+                    (point)))
+                  (scan-error pos)))))
+    (when end
+      (list beg end obarray
+            :predicate predicate
+            :annotate-function
             (unless (eq predicate 'fboundp)
-              (lambda (str) (if (fboundp (intern-soft str)) " <f>"))))))
+              (lambda (str) (if (fboundp (intern-soft str)) " <f>")))))))
 
 ;; arch-tag: aa7fa8a4-2e6f-4e9b-9cd9-fef06340e67e
 ;;; lisp.el ends here
index 364e35407032310b71e29a1d3def7a3d63d758d2..6dfd47b4ad1482ccef063aa45de4b5d6895e4ec0 100644 (file)
@@ -52,6 +52,7 @@ possible (for instance, when BODY just returns VAR unchanged, the
 result will be eq to LIST).
 
 \(fn (VAR LIST) BODY...)"
+  (declare (indent 1))
   (let ((var (car var+list))
        (list (cadr var+list))
        (shared (make-symbol "shared"))
@@ -72,7 +73,6 @@ result will be eq to LIST).
           (push ,new-el ,unshared))
         (setq ,tail (cdr ,tail)))
        (nconc (nreverse ,unshared) ,shared))))
-(put 'macroexp-accumulate 'lisp-indent-function 1)
 
 (defun macroexpand-all-forms (forms &optional skip)
   "Return FORMS with macros expanded.  FORMS is a list of forms.
@@ -107,80 +107,69 @@ Assumes the caller has bound `macroexpand-all-environment'."
                   macroexpand-all-environment)
     ;; Normal form; get its expansion, and then expand arguments.
     (setq form (macroexpand form macroexpand-all-environment))
-    (if (consp form)
-       (let ((fun (car form)))
-         (cond
-          ((eq fun 'cond)
-           (maybe-cons fun (macroexpand-all-clauses (cdr form)) form))
-          ((eq fun 'condition-case)
-           (maybe-cons
-            fun
-            (maybe-cons (cadr form)
-                        (maybe-cons (macroexpand-all-1 (nth 2 form))
-                                    (macroexpand-all-clauses (nthcdr 3 form) 1)
-                                    (cddr form))
-                        (cdr form))
-            form))
-          ((eq fun 'defmacro)
-           (push (cons (cadr form) (cons 'lambda (cddr form)))
-                 macroexpand-all-environment)
-           (macroexpand-all-forms form 3))
-          ((eq fun 'defun)
-           (macroexpand-all-forms form 3))
-          ((memq fun '(defvar defconst))
-           (macroexpand-all-forms form 2))
-          ((eq fun 'function)
-           (if (and (consp (cadr form)) (eq (car (cadr form)) 'lambda))
-               (maybe-cons fun
-                           (maybe-cons (macroexpand-all-forms (cadr form) 2)
-                                       nil
-                                       (cadr form))
-                           form)
-             form))
-          ((memq fun '(let let*))
-           (maybe-cons fun
-                       (maybe-cons (macroexpand-all-clauses (cadr form) 1)
-                                   (macroexpand-all-forms (cddr form))
-                                   (cdr form))
-                       form))
-          ((eq fun 'quote)
-           form)
-          ((and (consp fun) (eq (car fun) 'lambda))
-           ;; embedded lambda
-           (maybe-cons (macroexpand-all-forms fun 2)
-                       (macroexpand-all-forms (cdr form))
-                       form))
-          ;; The following few cases are for normal function calls that
-          ;; are known to funcall one of their arguments.  The byte
-          ;; compiler has traditionally handled these functions specially
-          ;; by treating a lambda expression quoted by `quote' as if it
-          ;; were quoted by `function'.  We make the same transformation
-          ;; here, so that any code that cares about the difference will
-          ;; see the same transformation.
-          ;; First arg is a function:
-          ((and (memq fun '(apply mapcar mapatoms mapconcat mapc))
-                (consp (cadr form))
-                (eq (car (cadr form)) 'quote))
-           ;; We don't use `maybe-cons' since there's clearly a change.
-           (cons fun
-                 (cons (macroexpand-all-1 (cons 'function (cdr (cadr form))))
-                       (macroexpand-all-forms (cddr form)))))
-          ;; Second arg is a function:
-          ((and (eq fun 'sort)
-                (consp (nth 2 form))
-                (eq (car (nth 2 form)) 'quote))
-           ;; We don't use `maybe-cons' since there's clearly a change.
-           (cons fun
-                 (cons (macroexpand-all-1 (cadr form))
-                       (cons (macroexpand-all-1
-                              (cons 'function (cdr (nth 2 form))))
-                             (macroexpand-all-forms (nthcdr 3 form))))))
-          (t
-           ;; For everything else, we just expand each argument (for
-           ;; setq/setq-default this works alright because the variable names
-           ;; are symbols).
-           (macroexpand-all-forms form 1))))
-      form)))
+    (pcase form
+      (`(cond . ,clauses)
+       (maybe-cons 'cond (macroexpand-all-clauses clauses) form))
+      (`(condition-case . ,(or `(,err ,body . ,handlers) dontcare))
+       (maybe-cons
+        'condition-case
+        (maybe-cons err
+                    (maybe-cons (macroexpand-all-1 body)
+                                (macroexpand-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)
+       (macroexpand-all-forms form 3))
+      (`(defun . ,_) (macroexpand-all-forms form 3))
+      (`(,(or `defvar `defconst) . ,_) (macroexpand-all-forms form 2))
+      (`(function ,(and f `(lambda . ,_)))
+       (maybe-cons 'function
+                   (maybe-cons (macroexpand-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)
+                               (cdr form))
+                   form))
+      (`(,(and fun `(lambda . ,_)) . ,args)
+       ;; Embedded lambda in function position.
+       (maybe-cons (macroexpand-all-forms fun 2)
+                   (macroexpand-all-forms args)
+                   form))
+      ;; The following few cases are for normal function calls that
+      ;; are known to funcall one of their arguments.  The byte
+      ;; compiler has traditionally handled these functions specially
+      ;; by treating a lambda expression quoted by `quote' as if it
+      ;; were quoted by `function'.  We make the same transformation
+      ;; here, so that any code that cares about the difference will
+      ;; see the same transformation.
+      ;; First arg is a function:
+      (`(,(and fun (or `apply `mapcar `mapatoms `mapconcat `mapc)) ',f . ,args)
+       ;; We don't use `maybe-cons' since there's clearly a change.
+       (cons fun
+             (cons (macroexpand-all-1 (list 'function f))
+                   (macroexpand-all-forms args))))
+      ;; Second arg is a function:
+      (`(,(and fun (or `sort)) ,arg1 ',f . ,args)
+       ;; We don't use `maybe-cons' since there's clearly a change.
+       (cons fun
+             (cons (macroexpand-all-1 arg1)
+                   (cons (macroexpand-all-1
+                          (list 'function f))
+                         (macroexpand-all-forms args)))))
+      (`(,_ . ,_)
+       ;; 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))
+      (t form))))
 
 ;;;###autoload
 (defun macroexpand-all (form &optional environment)
diff --git a/lisp/emacs-lisp/package-x.el b/lisp/emacs-lisp/package-x.el
new file mode 100644 (file)
index 0000000..38c4d5b
--- /dev/null
@@ -0,0 +1,227 @@
+;;; package-x.el --- Package extras
+
+;; Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+
+;; Author: Tom Tromey <tromey@redhat.com>
+;; Created: 10 Mar 2007
+;; Version: 0.9
+;; Keywords: tools
+;; Package: package
+
+;; 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, 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; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
+
+;;; Commentary:
+
+;; This file currently contains parts of the package system most
+;; people won't need, such as package uploading.
+
+;;; Code:
+
+(require 'package)
+(defvar gnus-article-buffer)
+
+;; Note that this only works if you have the password, which you
+;; probably don't :-).
+(defvar package-archive-upload-base nil
+  "Base location for uploading to package archive.")
+
+(defun package--encode (string)
+  "Encode a string by replacing some characters with XML entities."
+  ;; We need a special case for translating "&" to "&amp;".
+  (let ((index))
+    (while (setq index (string-match "[&]" string index))
+      (setq string (replace-match "&amp;" t nil string))
+      (setq index (1+ index))))
+  (while (string-match "[<]" string)
+    (setq string (replace-match "&lt;" t nil string)))
+  (while (string-match "[>]" string)
+    (setq string (replace-match "&gt;" t nil string)))
+  (while (string-match "[']" string)
+    (setq string (replace-match "&apos;" t nil string)))
+  (while (string-match "[\"]" string)
+    (setq string (replace-match "&quot;" t nil string)))
+  string)
+
+(defun package--make-rss-entry (title text archive-url)
+  (let ((date-string (format-time-string "%a, %d %B %Y %T %z")))
+    (concat "<item>\n"
+           "<title>" (package--encode title) "</title>\n"
+           ;; FIXME: should have a link in the web page.
+           "<link>" archive-url "news.html</link>\n"
+           "<description>" (package--encode text) "</description>\n"
+           "<pubDate>" date-string "</pubDate>\n"
+           "</item>\n")))
+
+(defun package--make-html-entry (title text)
+  (concat "<li> " (format-time-string "%B %e") " - "
+         title " - " (package--encode text)
+         " </li>\n"))
+
+(defun package--update-file (file location text)
+  (save-excursion
+    (let ((old-buffer (find-buffer-visiting file)))
+      (with-current-buffer (let ((find-file-visit-truename t))
+                            (or old-buffer (find-file-noselect file)))
+       (goto-char (point-min))
+       (search-forward location)
+       (forward-line)
+       (insert text)
+       (let ((file-precious-flag t))
+         (save-buffer))
+       (unless old-buffer
+         (kill-buffer (current-buffer)))))))
+
+(defun package-maint-add-news-item (title description archive-url)
+  "Add a news item to the ELPA web pages.
+TITLE is the title of the news item.
+DESCRIPTION is the text of the news item.
+You need administrative access to ELPA to use this."
+  (interactive "sTitle: \nsText: ")
+  (package--update-file (concat package-archive-upload-base "elpa.rss")
+                       "<description>"
+                       (package--make-rss-entry title description archive-url))
+  (package--update-file (concat package-archive-upload-base "news.html")
+                       "New entries go here"
+                       (package--make-html-entry title description)))
+
+(defun package--update-news (package version description archive-url)
+  "Update the ELPA web pages when a package is uploaded."
+  (package-maint-add-news-item (concat package " version " version)
+                              description
+                              archive-url))
+
+(defun package-upload-buffer-internal (pkg-info extension &optional archive-url)
+  "Upload a package whose contents are in the current buffer.
+PKG-INFO is the package info, see `package-buffer-info'.
+EXTENSION is the file extension, a string.  It can be either
+\"el\" or \"tar\".
+
+Optional arg ARCHIVE-URL is the URL of the destination archive.
+If nil, the \"gnu\" archive is used."
+  (unless archive-url
+    (or (setq archive-url (cdr (assoc "gnu" package-archives)))
+       (error "No destination URL")))
+  (save-excursion
+    (save-restriction
+      (let* ((file-type (cond
+                        ((equal extension "el") 'single)
+                        ((equal extension "tar") 'tar)
+                        (t (error "Unknown extension `%s'" extension))))
+            (file-name (aref pkg-info 0))
+            (pkg-name (intern file-name))
+            (requires (aref pkg-info 1))
+            (desc (if (string= (aref pkg-info 2) "")
+                      (read-string "Description of package: ")
+                    (aref pkg-info 2)))
+            (pkg-version (aref pkg-info 3))
+            (commentary (aref pkg-info 4))
+            (split-version (version-to-list pkg-version))
+            (pkg-buffer (current-buffer))
+
+            ;; Download latest archive-contents.
+            (buffer (url-retrieve-synchronously
+                     (concat archive-url "archive-contents"))))
+
+       ;; Parse archive-contents.
+       (set-buffer buffer)
+       (package-handle-response)
+       (re-search-forward "^$" nil 'move)
+       (forward-char)
+       (delete-region (point-min) (point))
+       (let ((contents (package-read-from-string
+                        (buffer-substring-no-properties (point-min)
+                                                        (point-max))))
+             (new-desc (vector split-version requires desc file-type)))
+         (if (> (car contents) package-archive-version)
+             (error "Unrecognized archive version %d" (car contents)))
+         (let ((elt (assq pkg-name (cdr contents))))
+           (if elt
+               (if (version-list-<= split-version
+                                    (package-desc-vers (cdr elt)))
+                   (error "New package has smaller version: %s" pkg-version)
+                 (setcdr elt new-desc))
+             (setq contents (cons (car contents)
+                                  (cons (cons pkg-name new-desc)
+                                        (cdr contents))))))
+
+         ;; Now CONTENTS is the updated archive contents.  Upload
+         ;; this and the package itself.  For now we assume ELPA is
+         ;; writable via file primitives.
+         (let ((print-level nil)
+               (print-length nil))
+           (write-region (concat (pp-to-string contents) "\n")
+                         nil
+                         (concat package-archive-upload-base
+                                 "archive-contents")))
+
+         ;; If there is a commentary section, write it.
+         (when commentary
+           (write-region commentary nil
+                         (concat package-archive-upload-base
+                                 (symbol-name pkg-name) "-readme.txt")))
+
+         (set-buffer pkg-buffer)
+         (kill-buffer buffer)
+         (write-region (point-min) (point-max)
+                       (concat package-archive-upload-base
+                               file-name "-" pkg-version
+                               "." extension)
+                       nil nil nil 'excl)
+
+         ;; Write a news entry.
+         (package--update-news (concat file-name "." extension)
+                               pkg-version desc archive-url)
+
+         ;; special-case "package": write a second copy so that the
+         ;; installer can easily find the latest version.
+         (if (string= file-name "package")
+             (write-region (point-min) (point-max)
+                           (concat package-archive-upload-base
+                                   file-name "." extension)
+                           nil nil nil 'ask)))))))
+
+(defun package-upload-buffer ()
+  "Upload a single .el file to ELPA from the current buffer."
+  (interactive)
+  (save-excursion
+    (save-restriction
+      ;; Find the package in this buffer.
+      (let ((pkg-info (package-buffer-info)))
+       (package-upload-buffer-internal pkg-info "el")))))
+
+(defun package-upload-file (file)
+  (interactive "fPackage file name: ")
+  (with-temp-buffer
+    (insert-file-contents-literally file)
+    (let ((info (cond
+                ((string-match "\\.tar$" file) (package-tar-file-info file))
+                ((string-match "\\.el$" file) (package-buffer-info))
+                (t (error "Unrecognized extension `%s'"
+                          (file-name-extension file))))))
+      (package-upload-buffer-internal info (file-name-extension file)))))
+
+(defun package-gnus-summary-upload ()
+  "Upload a package contained in the current *Article* buffer.
+This should be invoked from the gnus *Summary* buffer."
+  (interactive)
+  (with-current-buffer gnus-article-buffer
+    (package-upload-buffer)))
+
+(provide 'package-x)
+
+;;; package.el ends here
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
new file mode 100644 (file)
index 0000000..78e5282
--- /dev/null
@@ -0,0 +1,1635 @@
+;;; package.el --- Simple package system for Emacs
+
+;; Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+
+;; Author: Tom Tromey <tromey@redhat.com>
+;; Created: 10 Mar 2007
+;; Version: 0.9
+;; Keywords: tools
+
+;; 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, 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; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
+
+;;; Change Log:
+
+;;  2 Apr 2007 - now using ChangeLog file
+;; 15 Mar 2007 - updated documentation
+;; 14 Mar 2007 - Changed how obsolete packages are handled
+;; 13 Mar 2007 - Wrote package-install-from-buffer
+;; 12 Mar 2007 - Wrote package-menu mode
+
+;;; Commentary:
+
+;; The idea behind package.el is to be able to download packages and
+;; install them.  Packages are versioned and have versioned
+;; dependencies.  Furthermore, this supports built-in packages which
+;; may or may not be newer than user-specified packages.  This makes
+;; it possible to upgrade Emacs and automatically disable packages
+;; which have moved from external to core.  (Note though that we don't
+;; currently register any of these, so this feature does not actually
+;; work.)
+
+;; A package is described by its name and version.  The distribution
+;; format is either  a tar file or a single .el file.
+
+;; A tar file should be named "NAME-VERSION.tar".  The tar file must
+;; unpack into a directory named after the package and version:
+;; "NAME-VERSION".  It must contain a file named "PACKAGE-pkg.el"
+;; which consists of a call to define-package.  It may also contain a
+;; "dir" file and the info files it references.
+
+;; A .el file is named "NAME-VERSION.el" in the remote archive, but is
+;; installed as simply "NAME.el" in a directory named "NAME-VERSION".
+
+;; The downloader downloads all dependent packages.  By default,
+;; packages come from the official GNU sources, but others may be
+;; added by customizing the `package-archives' alist.  Packages get
+;; byte-compiled at install time.
+
+;; At activation time we will set up the load-path and the info path,
+;; and we will load the package's autoloads.  If a package's
+;; dependencies are not available, we will not activate that package.
+
+;; Conceptually a package has multiple state transitions:
+;;
+;; * Download.  Fetching the package from ELPA.
+;; * Install.  Untar the package, or write the .el file, into
+;;   ~/.emacs.d/elpa/ directory.
+;; * Byte compile.  Currently this phase is done during install,
+;;   but we may change this.
+;; * Activate.  Evaluate the autoloads for the package to make it
+;;   available to the user.
+;; * Load.  Actually load the package and run some code from it.
+
+;; Other external functions you may want to use:
+;;
+;; M-x package-list-packages
+;;    Enters a mode similar to buffer-menu which lets you manage
+;;    packages.  You can choose packages for install (mark with "i",
+;;    then "x" to execute) or deletion (not implemented yet), and you
+;;    can see what packages are available.  This will automatically
+;;    fetch the latest list of packages from ELPA.
+;;
+;; M-x package-list-packages-no-fetch
+;;    Like package-list-packages, but does not automatically fetch the
+;;    new list of packages.
+;;
+;; M-x package-install-from-buffer
+;;    Install a package consisting of a single .el file that appears
+;;    in the current buffer.  This only works for packages which
+;;    define a Version header properly; package.el also supports the
+;;    extension headers Package-Version (in case Version is an RCS id
+;;    or similar), and Package-Requires (if the package requires other
+;;    packages).
+;;
+;; M-x package-install-file
+;;    Install a package from the indicated file.  The package can be
+;;    either a tar file or a .el file.  A tar file must contain an
+;;    appropriately-named "-pkg.el" file; a .el file must be properly
+;;    formatted as with package-install-from-buffer.
+
+;;; Thanks:
+;;; (sorted by sort-lines):
+
+;; Jim Blandy <jimb@red-bean.com>
+;; Karl Fogel <kfogel@red-bean.com>
+;; Kevin Ryde <user42@zip.com.au>
+;; Lawrence Mitchell
+;; Michael Olson <mwolson@member.fsf.org>
+;; Sebastian Tennant <sebyte@smolny.plus.com>
+;; Stefan Monnier <monnier@iro.umontreal.ca>
+;; Vinicius Jose Latorre <viniciusjl@ig.com.br>
+;; Phil Hagelberg <phil@hagelb.org>
+
+;;; ToDo:
+
+;; - putting info dirs at the start of the info path means
+;;   users see a weird ordering of categories.  OTOH we want to
+;;   override later entries.  maybe emacs needs to enforce
+;;   the standard layout?
+;; - put bytecode in a separate directory tree
+;; - perhaps give users a way to recompile their bytecode
+;;   or do it automatically when emacs changes
+;; - give users a way to know whether a package is installed ok
+;; - give users a way to view a package's documentation when it
+;;   only appears in the .el
+;; - use/extend checkdoc so people can tell if their package will work
+;; - "installed" instead of a blank in the status column
+;; - tramp needs its files to be compiled in a certain order.
+;;   how to handle this?  fix tramp?
+;; - on emacs 21 we don't kill the -autoloads.el buffer.  what about 22?
+;; - maybe we need separate .elc directories for various emacs versions
+;;   and also emacs-vs-xemacs.  That way conditional compilation can
+;;   work.  But would this break anything?
+;; - should store the package's keywords in archive-contents, then
+;;   let the users filter the package-menu by keyword.  See
+;;   finder-by-keyword.  (We could also let people view the
+;;   Commentary, but it isn't clear how useful this is.)
+;; - William Xu suggests being able to open a package file without
+;;   installing it
+;; - Interface with desktop.el so that restarting after an install
+;;   works properly
+;; - Implement M-x package-upgrade, to upgrade any/all existing packages
+;; - Use hierarchical layout.  PKG/etc PKG/lisp PKG/info
+;;   ... except maybe lisp?
+;; - It may be nice to have a macro that expands to the package's
+;;   private data dir, aka ".../etc".  Or, maybe data-directory
+;;   needs to be a list (though this would be less nice)
+;;   a few packages want this, eg sokoban
+;; - package menu needs:
+;;     ability to know which packages are built-in & thus not deletable
+;;     it can sometimes print odd results, like 0.3 available but 0.4 active
+;;        why is that?
+;; - Allow multiple versions on the server...?
+;;   [ why bother? ]
+;; - Don't install a package which will invalidate dependencies overall
+;; - Allow something like (or (>= emacs 21.0) (>= xemacs 21.5))
+;;   [ currently thinking, why bother.. KISS ]
+;; - Allow optional package dependencies
+;;   then if we require 'bbdb', bbdb-specific lisp in lisp/bbdb
+;;   and just don't compile to add to load path ...?
+;; - Have a list of archive URLs?  [ maybe there's no point ]
+;; - David Kastrup pointed out on the xemacs list that for GPL it
+;;   is friendlier to ship the source tree.  We could "support" that
+;;   by just having a "src" subdir in the package.  This isn't ideal
+;;   but it probably is not worth trying to support random source
+;;   tree layouts, build schemes, etc.
+;; - Our treatment of the info path is somewhat bogus
+;; - perhaps have an "unstable" tree in ELPA as well as a stable one
+
+;;; Code:
+
+(defgroup package nil
+  "Manager for Emacs Lisp packages."
+  :group 'applications
+  :version "24.1")
+
+;;;###autoload
+(defcustom package-enable-at-startup t
+  "Whether to activate installed packages when Emacs starts.
+If non-nil, packages are activated after reading the init file
+and before `after-init-hook'.  Activation is not done if
+`user-init-file' is nil (e.g. Emacs was started with \"-q\").
+
+Even if the value is nil, you can type \\[package-initialize] to
+activate the package system at any time."
+  :type 'boolean
+  :group 'package
+  :version "24.1")
+
+(defcustom package-load-list '(all)
+  "List of packages for `package-initialize' to load.
+Each element in this list should be a list (NAME VERSION), or the
+symbol `all'.  The symbol `all' says to load the latest installed
+versions of all packages not specified by other elements.
+
+For an element (NAME VERSION), NAME is a package name (a symbol).
+VERSION should be t, a string, or nil.
+If VERSION is t, all versions are loaded, though obsolete ones
+ will be put in `package-obsolete-alist' and not activated.
+If VERSION is a string, only that version is ever loaded.
+ Any other version, even if newer, is silently ignored.
+ Hence, the package is \"held\" at that version.
+If VERSION is nil, the package is not loaded (it is \"disabled\")."
+  :type '(repeat symbol)
+  :risky t
+  :group 'package
+  :version "24.1")
+
+(defvar Info-directory-list)
+(declare-function info-initialize "info" ())
+(declare-function url-http-parse-response "url-http" ())
+(declare-function lm-header "lisp-mnt" (header))
+(declare-function lm-commentary "lisp-mnt" (&optional file))
+(declare-function dired-delete-file "dired" (file &optional recursive trash))
+(defvar url-http-end-of-headers)
+
+(defcustom package-archives '(("gnu" . "http://elpa.gnu.org/packages/"))
+  "An alist of archives from which to fetch.
+The default value points to the GNU Emacs package repository.
+Each element has the form (ID . URL), where ID is an identifier
+string for an archive and URL is a http: URL (a string)."
+  :type '(alist :key-type (string :tag "Archive name")
+                :value-type (string :tag "Archive URL"))
+  :risky t
+  :group 'package
+  :version "24.1")
+
+(defconst package-archive-version 1
+  "Version number of the package archive understood by this file.
+Lower version numbers than this will probably be understood as well.")
+
+(defconst package-el-version "1.0"
+  "Version of package.el.")
+
+;; We don't prime the cache since it tends to get out of date.
+(defvar package-archive-contents nil
+  "Cache of the contents of the Emacs Lisp Package Archive.
+This is an alist mapping package names (symbols) to package
+descriptor vectors.  These are like the vectors for `package-alist'
+but have extra entries: one which is 'tar for tar packages and
+'single for single-file packages, and one which is the name of
+the archive from which it came.")
+(put 'package-archive-contents 'risky-local-variable t)
+
+(defcustom package-user-dir (locate-user-emacs-file "elpa")
+  "Directory containing the user's Emacs Lisp packages.
+The directory name should be absolute.
+Apart from this directory, Emacs also looks for system-wide
+packages in `package-directory-list'."
+  :type 'directory
+  :risky t
+  :group 'package
+  :version "24.1")
+
+(defcustom package-directory-list
+  ;; Defaults are subdirs named "elpa" in the site-lisp dirs.
+  (let (result)
+    (dolist (f load-path)
+      (if (equal (file-name-nondirectory f) "site-lisp")
+         (push (expand-file-name "elpa" f) result)))
+    (nreverse result))
+  "List of additional directories containing Emacs Lisp packages.
+Each directory name should be absolute.
+
+These directories contain packages intended for system-wide; in
+contrast, `package-user-dir' contains packages for personal use."
+  :type '(repeat directory)
+  :risky t
+  :group 'package
+  :version "24.1")
+
+;; The value is precomputed in finder-inf.el, but don't load that
+;; until it's needed (i.e. when `package-intialize' is called).
+(defvar package--builtins nil
+  "Alist of built-in packages.
+Each element has the form (PKG . DESC), where PKG is a package
+name (a symbol) and DESC is a vector that describes the package.
+
+The vector DESC has the form [VERSION REQS DOCSTRING].
+  VERSION is a version list.
+  REQS is a list of packages (symbols) required by the package.
+  DOCSTRING is a brief description of the package.")
+(put 'package--builtins 'risky-local-variable t)
+
+(defvar package-alist nil
+  "Alist of all packages available for activation.
+Each element has the form (PKG . DESC), where PKG is a package
+name (a symbol) and DESC is a vector that describes the package.
+
+The vector DESC has the form [VERSION REQS DOCSTRING].
+  VERSION is a version list.
+  REQS is a list of packages (symbols) required by the package.
+  DOCSTRING is a brief description of the package.
+
+This variable is set automatically by `package-load-descriptor',
+called via `package-initialize'.  To change which packages are
+loaded and/or activated, customize `package-load-list'.")
+(put 'package-archive-contents 'risky-local-variable t)
+
+(defvar package-activated-list nil
+  "List of the names of currently activated packages.")
+(put 'package-activated-list 'risky-local-variable t)
+
+(defvar package-obsolete-alist nil
+  "Representation of obsolete packages.
+Like `package-alist', but maps package name to a second alist.
+The inner alist is keyed by version.")
+(put 'package-obsolete-alist 'risky-local-variable t)
+
+(defconst package-subdirectory-regexp
+  "^\\([^.].*\\)-\\([0-9]+\\(?:[.][0-9]+\\)*\\)$"
+  "Regular expression matching the name of a package subdirectory.
+The first subexpression is the package name.
+The second subexpression is the version string.")
+
+(defun package-version-join (l)
+  "Turn a list of version numbers into a version string."
+  (mapconcat 'int-to-string l "."))
+
+(defun package-strip-version (dirname)
+  "Strip the version from a combined package name and version.
+E.g., if given \"quux-23.0\", will return \"quux\""
+  (if (string-match package-subdirectory-regexp dirname)
+      (match-string 1 dirname)))
+
+(defun package-load-descriptor (dir package)
+  "Load the description file in directory DIR for package PACKAGE."
+  (let* ((pkg-dir (expand-file-name package dir))
+        (pkg-file (expand-file-name
+                   (concat (package-strip-version package) "-pkg")
+                   pkg-dir)))
+    (when (and (file-directory-p pkg-dir)
+              (file-exists-p (concat pkg-file ".el")))
+      (load pkg-file nil t))))
+
+(defun package-load-all-descriptors ()
+  "Load descriptors for installed Emacs Lisp packages.
+This looks for package subdirectories in `package-user-dir' and
+`package-directory-list'.  The variable `package-load-list'
+controls which package subdirectories may be loaded.
+
+In each valid package subdirectory, this function loads the
+description file containing a call to `define-package', which
+updates `package-alist' and `package-obsolete-alist'."
+  (let ((all (memq 'all package-load-list))
+       name version force)
+    (dolist (dir (cons package-user-dir package-directory-list))
+      (when (file-directory-p dir)
+       (dolist (subdir (directory-files dir))
+         (when (and (file-directory-p (expand-file-name subdir dir))
+                    (string-match package-subdirectory-regexp subdir))
+           (setq name    (intern (match-string 1 subdir))
+                 version (match-string 2 subdir)
+                 force   (assq name package-load-list))
+           (when (cond
+                  ((null force)
+                   all) ; not in package-load-list
+                  ((null (setq force (cadr force)))
+                   nil) ; disabled
+                  ((eq force t)
+                   t)
+                  ((stringp force) ; held
+                   (version-list-= (version-to-list version)
+                                   (version-to-list force)))
+                  (t
+                   (error "Invalid element in `package-load-list'")))
+             (package-load-descriptor dir subdir))))))))
+
+(defsubst package-desc-vers (desc)
+  "Extract version from a package description vector."
+  (aref desc 0))
+
+(defsubst package-desc-reqs (desc)
+  "Extract requirements from a package description vector."
+  (aref desc 1))
+
+(defsubst package-desc-doc (desc)
+  "Extract doc string from a package description vector."
+  (aref desc 2))
+
+(defsubst package-desc-kind (desc)
+  "Extract the kind of download from an archive package description vector."
+  (aref desc 3))
+
+(defun package--dir (name version-string)
+  (let* ((subdir (concat name "-" version-string))
+        (dir-list (cons package-user-dir package-directory-list))
+        pkg-dir)
+    (while dir-list
+      (let ((subdir-full (expand-file-name subdir (car dir-list))))
+       (if (file-directory-p subdir-full)
+           (setq pkg-dir  subdir-full
+                 dir-list nil)
+         (setq dir-list (cdr dir-list)))))
+    pkg-dir))
+
+(defun package-activate-1 (package pkg-vec)
+  (let* ((name (symbol-name package))
+        (version-str (package-version-join (package-desc-vers pkg-vec)))
+        (pkg-dir (package--dir name version-str)))
+    (unless pkg-dir
+      (error "Internal error: could not find directory for %s-%s"
+            name version-str))
+    ;; Add info node.
+    (if (file-exists-p (expand-file-name "dir" pkg-dir))
+       (progn
+         ;; FIXME: not the friendliest, but simple.
+         (require 'info)
+         (info-initialize)
+         (setq Info-directory-list (cons pkg-dir Info-directory-list))))
+    ;; Add to load path, add autoloads, and activate the package.
+    (setq load-path (cons pkg-dir load-path))
+    (load (expand-file-name (concat name "-autoloads") pkg-dir) nil t)
+    (setq package-activated-list (cons package package-activated-list))
+    ;; Don't return nil.
+    t))
+
+(defun package--built-in (package version)
+  "Return true if the package is built-in to Emacs."
+  (let ((elt (assq package package--builtins)))
+    (and elt (version-list-= (package-desc-vers (cdr elt)) version))))
+
+;; FIXME: return a reason instead?
+(defun package-activate (package version)
+  "Activate a package, and recursively activate its dependencies.
+Return nil if the package could not be activated."
+  ;; Assume the user knows what he is doing -- go ahead and activate a
+  ;; newer version of a package if an older one has already been
+  ;; activated.  This is not ideal; we'd at least need to check to see
+  ;; if the package has actually been loaded, and not merely
+  ;; activated.  However, don't try to activate 'emacs', as that makes
+  ;; no sense.
+  (unless (eq package 'emacs)
+    (let* ((pkg-desc (assq package package-alist))
+          (this-version (package-desc-vers (cdr pkg-desc)))
+          (req-list (package-desc-reqs (cdr pkg-desc)))
+          ;; If the package was never activated, do it now.
+          (keep-going (or (not (memq package package-activated-list))
+                          (version-list-< version this-version))))
+      (while (and req-list keep-going)
+       (let* ((req (car req-list))
+              (req-name (car req))
+              (req-version (cadr req)))
+         (or (package-activate req-name req-version)
+             (setq keep-going nil)))
+       (setq req-list (cdr req-list)))
+      (if keep-going
+         (package-activate-1 package (cdr pkg-desc))
+       ;; We get here if a dependency failed to activate -- but we
+       ;; can also get here if the requested package was already
+       ;; activated.  Return non-nil in the latter case.
+       (and (memq package package-activated-list)
+            (version-list-<= version this-version))))))
+
+(defun package-mark-obsolete (package pkg-vec)
+  "Put package on the obsolete list, if not already there."
+  (let ((elt (assq package package-obsolete-alist)))
+    (if elt
+       ;; If this obsolete version does not exist in the list, update
+       ;; it the list.
+       (unless (assoc (package-desc-vers pkg-vec) (cdr elt))
+         (setcdr elt (cons (cons (package-desc-vers pkg-vec) pkg-vec)
+                           (cdr elt))))
+      ;; Make a new association.
+      (setq package-obsolete-alist
+           (cons (cons package (list (cons (package-desc-vers pkg-vec)
+                                           pkg-vec)))
+                 package-obsolete-alist)))))
+
+(defun define-package (name-str version-string
+                               &optional docstring requirements
+                               &rest extra-properties)
+  "Define a new package.
+NAME is the name of the package, a string.
+VERSION-STRING is the version of the package, a dotted sequence
+of integers.
+DOCSTRING is the optional description.
+REQUIREMENTS is a list of requirements on other packages.
+Each requirement is of the form (OTHER-PACKAGE \"VERSION\").
+
+EXTRA-PROPERTIES is currently unused."
+  (let* ((name (intern name-str))
+        (pkg-desc (assq name package-alist))
+        (new-version (version-to-list version-string))
+        (new-pkg-desc
+         (cons name
+               (vector new-version
+                       (mapcar
+                        (lambda (elt)
+                          (list (car elt)
+                                (version-to-list (car (cdr elt)))))
+                        requirements)
+                       docstring))))
+    ;; Only redefine a package if the redefinition is newer.
+    (if (or (not pkg-desc)
+           (version-list-< (package-desc-vers (cdr pkg-desc))
+                           new-version))
+       (progn
+         (when pkg-desc
+           ;; Remove old package and declare it obsolete.
+           (setq package-alist (delq pkg-desc package-alist))
+           (package-mark-obsolete (car pkg-desc) (cdr pkg-desc)))
+         ;; Add package to the alist.
+         (setq package-alist (cons new-pkg-desc package-alist)))
+      ;; You can have two packages with the same version, for instance
+      ;; one in the system package directory and one in your private
+      ;; directory.  We just let the first one win.
+      (unless (version-list-= new-version
+                             (package-desc-vers (cdr pkg-desc)))
+       ;; The package is born obsolete.
+       (package-mark-obsolete (car new-pkg-desc) (cdr new-pkg-desc))))))
+
+;; From Emacs 22.
+(defun package-autoload-ensure-default-file (file)
+  "Make sure that the autoload file FILE exists and if not create it."
+  (unless (file-exists-p file)
+    (write-region
+     (concat ";;; " (file-name-nondirectory file)
+            " --- automatically extracted autoloads\n"
+            ";;\n"
+            ";;; Code:\n\n"
+            "\f\n;; Local Variables:\n"
+            ";; version-control: never\n"
+            ";; no-byte-compile: t\n"
+            ";; no-update-autoloads: t\n"
+            ";; End:\n"
+            ";;; " (file-name-nondirectory file)
+            " ends here\n")
+     nil file))
+  file)
+
+(defun package-generate-autoloads (name pkg-dir)
+  (let* ((auto-name (concat name "-autoloads.el"))
+        (ignore-name (concat name "-pkg.el"))
+        (generated-autoload-file (expand-file-name auto-name pkg-dir))
+        (version-control 'never))
+    (require 'autoload)
+    (unless (fboundp 'autoload-ensure-default-file)
+      (package-autoload-ensure-default-file generated-autoload-file))
+    (update-directory-autoloads pkg-dir)))
+
+(defun package-untar-buffer ()
+  "Untar the current buffer.
+This uses `tar-untar-buffer' if it is available.
+Otherwise it uses an external `tar' program.
+`default-directory' should be set by the caller."
+  (require 'tar-mode)
+  (if (fboundp 'tar-untar-buffer)
+      (progn
+       ;; tar-mode messes with narrowing, so we just let it have the
+       ;; whole buffer to play with.
+       (delete-region (point-min) (point))
+       (tar-mode)
+       (tar-untar-buffer))
+    ;; FIXME: check the result.
+    (call-process-region (point) (point-max) "tar" nil '(nil nil) nil
+                        "xf" "-")))
+
+(defun package-unpack (name version)
+  (let ((pkg-dir (expand-file-name (concat (symbol-name name) "-" version)
+                                  package-user-dir)))
+    ;; Be careful!!
+    (make-directory package-user-dir t)
+    (if (file-directory-p pkg-dir)
+       (mapc (lambda (file) nil) ; 'delete-file -- FIXME: when we're
+                                 ; more confident
+             (directory-files pkg-dir t "^[^.]")))
+    (let* ((default-directory (file-name-as-directory package-user-dir)))
+      (package-untar-buffer)
+      (package-generate-autoloads (symbol-name name) pkg-dir)
+      (let ((load-path (cons pkg-dir load-path)))
+       (byte-recompile-directory pkg-dir 0 t)))))
+
+(defun package--write-file-no-coding (file-name excl)
+  (let ((buffer-file-coding-system 'no-conversion))
+    (write-region (point-min) (point-max) file-name nil nil nil excl)))
+
+(defun package-unpack-single (file-name version desc requires)
+  "Install the contents of the current buffer as a package."
+  ;; Special case "package".
+  (if (string= file-name "package")
+      (package--write-file-no-coding
+       (expand-file-name (concat file-name ".el") package-user-dir)
+       nil)
+    (let* ((pkg-dir  (expand-file-name (concat file-name "-" version)
+                                      package-user-dir))
+          (el-file  (expand-file-name (concat file-name ".el") pkg-dir))
+          (pkg-file (expand-file-name (concat file-name "-pkg.el") pkg-dir)))
+      (make-directory pkg-dir t)
+      (package--write-file-no-coding el-file 'excl)
+      (let ((print-level nil)
+           (print-length nil))
+       (write-region
+        (concat
+         (prin1-to-string
+          (list 'define-package
+                file-name
+                version
+                desc
+                (list 'quote
+                      ;; Turn version lists into string form.
+                      (mapcar
+                       (lambda (elt)
+                         (list (car elt)
+                               (package-version-join (car (cdr elt)))))
+                       requires))))
+         "\n")
+        nil
+        pkg-file
+        nil nil nil 'excl))
+      (package-generate-autoloads file-name pkg-dir)
+      (let ((load-path (cons pkg-dir load-path)))
+       (byte-recompile-directory pkg-dir 0 t)))))
+
+(defun package-handle-response ()
+  "Handle the response from the server.
+Parse the HTTP response and throw if an error occurred.
+The url package seems to require extra processing for this.
+This should be called in a `save-excursion', in the download buffer.
+It will move point to somewhere in the headers."
+  ;; We assume HTTP here.
+  (require 'url-http)
+  (let ((response (url-http-parse-response)))
+    (when (or (< response 200) (>= response 300))
+      (display-buffer (current-buffer))
+      (error "Error during download request:%s"
+            (buffer-substring-no-properties (point) (progn
+                                                      (end-of-line)
+                                                      (point)))))))
+
+(defun package-download-single (name version desc requires)
+  "Download and install a single-file package."
+  (let ((buffer (url-retrieve-synchronously
+                (concat (package-archive-url name)
+                        (symbol-name name) "-" version ".el"))))
+    (with-current-buffer buffer
+      (package-handle-response)
+      (re-search-forward "^$" nil 'move)
+      (forward-char)
+      (delete-region (point-min) (point))
+      (package-unpack-single (symbol-name name) version desc requires)
+      (kill-buffer buffer))))
+
+(defun package-download-tar (name version)
+  "Download and install a tar package."
+  (let ((tar-buffer (url-retrieve-synchronously
+                    (concat (package-archive-url name)
+                            (symbol-name name) "-" version ".tar"))))
+    (with-current-buffer tar-buffer
+      (package-handle-response)
+      (re-search-forward "^$" nil 'move)
+      (forward-char)
+      (package-unpack name version)
+      (kill-buffer tar-buffer))))
+
+(defun package-installed-p (package &optional min-version)
+  (let ((pkg-desc (assq package package-alist)))
+    (and pkg-desc
+        (version-list-<= min-version
+                         (package-desc-vers (cdr pkg-desc))))))
+
+(defun package-compute-transaction (package-list requirements)
+  "Return a list of packages to be installed, including PACKAGE-LIST.
+PACKAGE-LIST should be a list of package names (symbols).
+
+REQUIREMENTS should be a list of additional requirements; each
+element in this list should have the form (PACKAGE VERSION),
+where PACKAGE is a package name and VERSION is the required
+version of that package (as a list).
+
+This function recursively computes the requirements of the
+packages in REQUIREMENTS, and returns a list of all the packages
+that must be installed.  Packages that are already installed are
+not included in this list."
+  (dolist (elt requirements)
+    (let* ((next-pkg (car elt))
+          (next-version (cadr elt)))
+      (unless (package-installed-p next-pkg next-version)
+       ;; A package is required, but not installed.  It might also be
+       ;; blocked via `package-load-list'.
+       (let ((pkg-desc (assq next-pkg package-archive-contents))
+             hold)
+         (when (setq hold (assq next-pkg package-load-list))
+           (setq hold (cadr hold))
+           (cond ((eq hold nil)
+                  (error "Required package '%s' is disabled"
+                         (symbol-name next-pkg)))
+                 ((null (stringp hold))
+                  (error "Invalid element in `package-load-list'"))
+                 ((version-list-< (version-to-list hold) next-version)
+                  (error "Package '%s' held at version %s, \
+but version %s required"
+                         (symbol-name next-pkg) hold
+                         (package-version-join next-version)))))
+         (unless pkg-desc
+           (error "Package '%s' is not available for installation"
+                  (symbol-name next-pkg)))
+         (unless (version-list-<= next-version
+                                  (package-desc-vers (cdr pkg-desc)))
+           (error
+            "Need package '%s' with version %s, but only %s is available"
+            (symbol-name next-pkg) (package-version-join next-version)
+            (package-version-join (package-desc-vers (cdr pkg-desc)))))
+         ;; Only add to the transaction if we don't already have it.
+         (unless (memq next-pkg package-list)
+           (setq package-list (cons next-pkg package-list)))
+         (setq package-list
+               (package-compute-transaction package-list
+                                            (package-desc-reqs
+                                             (cdr pkg-desc))))))))
+  package-list)
+
+(defun package-read-from-string (str)
+  "Read a Lisp expression from STR.
+Signal an error if the entire string was not used."
+  (let* ((read-data (read-from-string str))
+        (more-left
+         (condition-case nil
+             ;; The call to `ignore' suppresses a compiler warning.
+             (progn (ignore (read-from-string
+                             (substring str (cdr read-data))))
+                    t)
+           (end-of-file nil))))
+    (if more-left
+        (error "Can't read whole string")
+      (car read-data))))
+
+(defun package--read-archive-file (file)
+  "Re-read archive file FILE, if it exists.
+Will return the data from the file, or nil if the file does not exist.
+Will throw an error if the archive version is too new."
+  (let ((filename (expand-file-name file package-user-dir)))
+    (when (file-exists-p filename)
+      (with-temp-buffer
+       (insert-file-contents-literally filename)
+       (let ((contents (read (current-buffer))))
+         (if (> (car contents) package-archive-version)
+             (error "Package archive version %d is higher than %d"
+                    (car contents) package-archive-version))
+         (cdr contents))))))
+
+(defun package-read-all-archive-contents ()
+  "Re-read `archive-contents', if it exists.
+If successful, set `package-archive-contents'."
+  (dolist (archive package-archives)
+    (package-read-archive-contents (car archive))))
+
+(defun package-read-archive-contents (archive)
+  "Re-read archive contents for ARCHIVE.
+If successful, set the variable `package-archive-contents'.
+If the archive version is too new, signal an error."
+  ;; Version 1 of 'archive-contents' is identical to our internal
+  ;; representation.
+  (let* ((dir (concat "archives/" archive))
+        (contents-file (concat dir "/archive-contents"))
+        contents)
+    (when (setq contents (package--read-archive-file contents-file))
+      (dolist (package contents)
+       (package--add-to-archive-contents package archive)))))
+
+(defun package--add-to-archive-contents (package archive)
+  "Add the PACKAGE from the given ARCHIVE if necessary.
+Also, add the originating archive to the end of the package vector."
+  (let* ((name    (car package))
+         (version (aref (cdr package) 0))
+         (entry   (cons (car package)
+                       (vconcat (cdr package) (vector archive))))
+         (existing-package (cdr (assq name package-archive-contents))))
+    (when (or (not existing-package)
+              (version-list-< (aref existing-package 0) version))
+      (add-to-list 'package-archive-contents entry))))
+
+(defun package-download-transaction (package-list)
+  "Download and install all the packages in PACKAGE-LIST.
+PACKAGE-LIST should be a list of package names (symbols).
+This function assumes that all package requirements in
+PACKAGE-LIST are satisfied, i.e. that PACKAGE-LIST is computed
+using `package-compute-transaction'."
+  (dolist (elt package-list)
+    (let* ((desc (cdr (assq elt package-archive-contents)))
+          ;; As an exception, if package is "held" in
+          ;; `package-load-list', download the held version.
+          (hold (cadr (assq elt package-load-list)))
+          (v-string (or (and (stringp hold) hold)
+                        (package-version-join (package-desc-vers desc))))
+          (kind (package-desc-kind desc)))
+      (cond
+       ((eq kind 'tar)
+       (package-download-tar elt v-string))
+       ((eq kind 'single)
+       (package-download-single elt v-string
+                                (package-desc-doc desc)
+                                (package-desc-reqs desc)))
+       (t
+       (error "Unknown package kind: %s" (symbol-name kind)))))))
+
+;;;###autoload
+(defun package-install (name)
+  "Install the package named NAME.
+Interactively, prompt for the package name.
+The package is found on one of the archives in `package-archives'."
+  (interactive
+   (list (intern (completing-read "Install package: "
+                                 (mapcar (lambda (elt)
+                                           (cons (symbol-name (car elt))
+                                                 nil))
+                                         package-archive-contents)
+                                 nil t))))
+  (let ((pkg-desc (assq name package-archive-contents)))
+    (unless pkg-desc
+      (error "Package '%s' is not available for installation"
+            (symbol-name name)))
+    (package-download-transaction
+     (package-compute-transaction (list name)
+                                 (package-desc-reqs (cdr pkg-desc)))))
+  ;; Try to activate it.
+  (package-initialize))
+
+(defun package-strip-rcs-id (v-str)
+  "Strip RCS version ID from the version string.
+If the result looks like a dotted numeric version, return it.
+Otherwise return nil."
+  (if v-str
+      (if (string-match "^[ \t]*[$]Revision:[ \t]\([0-9.]+\)[ \t]*[$]$" v-str)
+         (match-string 1 v-str)
+       (if (string-match "^[0-9.]*$" v-str)
+           v-str))))
+
+(defun package-buffer-info ()
+  "Return a vector describing the package in the current buffer.
+The vector has the form
+
+   [FILENAME REQUIRES DESCRIPTION VERSION COMMENTARY]
+
+FILENAME is the file name, a string, sans the \".el\" extension.
+REQUIRES is a requires list, or nil.
+DESCRIPTION is the package description, a string.
+VERSION is the version, a string.
+COMMENTARY is the commentary section, a string, or nil if none.
+
+If the buffer does not contain a conforming package, signal an
+error.  If there is a package, narrow the buffer to the file's
+boundaries."
+  (goto-char (point-min))
+  (unless (re-search-forward "^;;; \\([^ ]*\\)\\.el --- \\(.*\\)$" nil t)
+    (error "Packages lacks a file header"))
+  (let ((file-name (match-string-no-properties 1))
+       (desc      (match-string-no-properties 2))
+       (start     (line-beginning-position)))
+    (unless (search-forward (concat ";;; " file-name ".el ends here"))
+      (error "Package lacks a terminating comment"))
+    ;; Try to include a trailing newline.
+    (forward-line)
+    (narrow-to-region start (point))
+    (require 'lisp-mnt)
+    ;; Use some headers we've invented to drive the process.
+    (let* ((requires-str (lm-header "package-requires"))
+          (requires (if requires-str
+                        (package-read-from-string requires-str)))
+          ;; Prefer Package-Version; if defined, the package author
+          ;; probably wants us to use it.  Otherwise try Version.
+          (pkg-version
+           (or (package-strip-rcs-id (lm-header "package-version"))
+               (package-strip-rcs-id (lm-header "version"))))
+          (commentary (lm-commentary)))
+      (unless pkg-version
+       (error
+        "Package lacks a \"Version\" or \"Package-Version\" header"))
+      ;; Turn string version numbers into list form.
+      (setq requires
+           (mapcar
+            (lambda (elt)
+              (list (car elt)
+                    (version-to-list (car (cdr elt)))))
+            requires))
+      (vector file-name requires desc pkg-version commentary))))
+
+(defun package-tar-file-info (file)
+  "Find package information for a tar file.
+FILE is the name of the tar file to examine.
+The return result is a vector like `package-buffer-info'."
+  (unless (string-match "^\\(.+\\)-\\([0-9.]+\\)\\.tar$" file)
+    (error "Invalid package name `%s'" file))
+  (let* ((pkg-name (file-name-nondirectory (match-string-no-properties 1 file)))
+        (pkg-version (match-string-no-properties 2 file))
+        ;; Extract the package descriptor.
+        (pkg-def-contents (shell-command-to-string
+                           ;; Requires GNU tar.
+                           (concat "tar -xOf " file " "
+                                   pkg-name "-" pkg-version "/"
+                                   pkg-name "-pkg.el")))
+        (pkg-def-parsed (package-read-from-string pkg-def-contents)))
+    (unless (eq (car pkg-def-parsed) 'define-package)
+      (error "No `define-package' sexp is present in `%s-pkg.el'" pkg-name))
+    (let ((name-str       (nth 1 pkg-def-parsed))
+         (version-string (nth 2 pkg-def-parsed))
+         (docstring      (nth 3 pkg-def-parsed))
+         (requires       (nth 4 pkg-def-parsed))
+         (readme (shell-command-to-string
+                  ;; Requires GNU tar.
+                  (concat "tar -xOf " file " "
+                          pkg-name "-" pkg-version "/README"))))
+      (unless (equal pkg-version version-string)
+       (error "Package has inconsistent versions"))
+      (unless (equal pkg-name name-str)
+       (error "Package has inconsistent names"))
+      ;; Kind of a hack.
+      (if (string-match ": Not found in archive" readme)
+         (setq readme nil))
+      ;; Turn string version numbers into list form.
+      (if (eq (car requires) 'quote)
+         (setq requires (car (cdr requires))))
+      (setq requires
+           (mapcar (lambda (elt)
+                     (list (car elt)
+                           (version-to-list (cadr elt))))
+                   requires))
+      (vector pkg-name requires docstring version-string readme))))
+
+;;;###autoload
+(defun package-install-from-buffer (pkg-info type)
+  "Install a package from the current buffer.
+When called interactively, the current buffer is assumed to be a
+single .el file that follows the packaging guidelines; see info
+node `(elisp)Packaging'.
+
+When called from Lisp, PKG-INFO is a vector describing the
+information, of the type returned by `package-buffer-info'; and
+TYPE is the package type (either `single' or `tar')."
+  (interactive (list (package-buffer-info) 'single))
+  (save-excursion
+    (save-restriction
+      (let* ((file-name (aref pkg-info 0))
+            (requires  (aref pkg-info 1))
+            (desc (if (string= (aref pkg-info 2) "")
+                      "No description available."
+                    (aref pkg-info 2)))
+            (pkg-version (aref pkg-info 3)))
+       ;; Download and install the dependencies.
+       (let ((transaction (package-compute-transaction nil requires)))
+         (package-download-transaction transaction))
+       ;; Install the package itself.
+       (cond
+        ((eq type 'single)
+         (package-unpack-single file-name pkg-version desc requires))
+        ((eq type 'tar)
+         (package-unpack (intern file-name) pkg-version))
+        (t
+         (error "Unknown type: %s" (symbol-name type))))
+       ;; Try to activate it.
+       (package-initialize)))))
+
+;;;###autoload
+(defun package-install-file (file)
+  "Install a package from a file.
+The file can either be a tar file or an Emacs Lisp file."
+  (interactive "fPackage file name: ")
+  (with-temp-buffer
+    (insert-file-contents-literally file)
+    (cond
+     ((string-match "\\.el$" file)
+      (package-install-from-buffer (package-buffer-info) 'single))
+     ((string-match "\\.tar$" file)
+      (package-install-from-buffer (package-tar-file-info file) 'tar))
+     (t (error "Unrecognized extension `%s'" (file-name-extension file))))))
+
+(defun package-delete (name version)
+  (require 'dired)                     ; for dired-delete-file
+  (dired-delete-file (expand-file-name (concat name "-" version)
+                                      package-user-dir)
+                    ;; FIXME: query user?
+                    'always))
+
+(defun package-archive-url (name)
+  "Return the archive containing the package NAME."
+  (let ((desc (cdr (assq (intern-soft name) package-archive-contents))))
+    (cdr (assoc (aref desc (- (length desc) 1)) package-archives))))
+
+(defun package--download-one-archive (archive file)
+  "Download an archive file FILE from ARCHIVE, and cache it locally."
+  (let* ((archive-name (car archive))
+         (archive-url  (cdr archive))
+        (dir (expand-file-name "archives" package-user-dir))
+        (dir (expand-file-name archive-name dir))
+         (buffer (url-retrieve-synchronously (concat archive-url file))))
+    (with-current-buffer buffer
+      (package-handle-response)
+      (re-search-forward "^$" nil 'move)
+      (forward-char)
+      (delete-region (point-min) (point))
+      (make-directory dir t)
+      (setq buffer-file-name (expand-file-name file dir))
+      (let ((version-control 'never))
+       (save-buffer)))
+    (kill-buffer buffer)))
+
+(defun package-refresh-contents ()
+  "Download the ELPA archive description if needed.
+Invoking this will ensure that Emacs knows about the latest versions
+of all packages.  This will let Emacs make them available for
+download."
+  (interactive)
+  (unless (file-exists-p package-user-dir)
+    (make-directory package-user-dir t))
+  (dolist (archive package-archives)
+    (condition-case nil
+       (package--download-one-archive archive "archive-contents")
+      (error (message "Failed to download `%s' archive."
+                     (car archive)))))
+  (package-read-all-archive-contents))
+
+;;;###autoload
+(defun package-initialize ()
+  "Load Emacs Lisp packages, and activate them.
+The variable `package-load-list' controls which packages to load."
+  (interactive)
+  (require 'finder-inf nil t)
+  (setq package-alist package--builtins)
+  (setq package-activated-list (mapcar #'car package-alist))
+  (setq package-obsolete-alist nil)
+  (package-load-all-descriptors)
+  (package-read-all-archive-contents)
+  ;; Try to activate all our packages.
+  (mapc (lambda (elt)
+         (package-activate (car elt) (package-desc-vers (cdr elt))))
+       package-alist))
+
+\f
+;;;; Package description buffer.
+
+;;;###autoload
+(defun describe-package (package)
+  "Display the full documentation of PACKAGE (a symbol)."
+  (interactive
+   (let* ((packages (append (mapcar 'car package-alist)
+                           (mapcar 'car package-archive-contents)))
+         (guess (function-called-at-point))
+         val)
+     (unless (memq guess packages)
+       (setq guess nil))
+     (setq packages (mapcar 'symbol-name packages))
+     (setq val
+          (completing-read (if guess
+                               (format "Describe package (default %s): "
+                                       guess)
+                             "Describe package: ")
+                           packages nil t nil nil guess))
+     (list (if (equal val "") guess (intern val)))))
+  (if (or (null package) (null (symbolp package)))
+      (message "You did not specify a package")
+    (help-setup-xref (list #'describe-package package)
+                    (called-interactively-p 'interactive))
+    (with-help-window (help-buffer)
+      (with-current-buffer standard-output
+       (describe-package-1 package)))))
+
+(defun describe-package-1 (package)
+  (require 'lisp-mnt)
+  (let ((package-name (symbol-name package))
+       (built-in (assq package package--builtins))
+       desc pkg-dir reqs version installable)
+    (prin1 package)
+    (princ " is ")
+    (if (setq desc (cdr (assq package package-alist)))
+       ;; This package is loaded (i.e. in `package-alist').
+       (progn
+         (setq version (package-version-join (package-desc-vers desc)))
+         (cond (built-in
+                (princ "a built-in package.\n\n"))
+               ((setq pkg-dir (package--dir package-name version))
+                (insert "an installed package.\n\n"))
+               (t ;; This normally does not happen.
+                (insert "a deleted package.\n\n")
+                (setq version nil))))
+      ;; This package is not installed.
+      (setq desc    (cdr (assq package package-archive-contents))
+           version (package-version-join (package-desc-vers desc))
+           installable t)
+      (insert "an uninstalled package.\n\n"))
+
+    (insert "     " (propertize "Status" 'font-lock-face 'bold) ": ")
+    (cond (pkg-dir
+          (insert (propertize "Installed"
+                              'font-lock-face 'font-lock-comment-face))
+          (insert " in `")
+          ;; Todo: Add button for uninstalling.
+          (help-insert-xref-button (file-name-as-directory pkg-dir)
+                                   'help-package-def pkg-dir)
+          (insert "'."))
+         (installable
+          (insert "Available -- ")
+          (let ((button-text (if (display-graphic-p)
+                                 "Install"
+                               "[Install]"))
+                (button-face (if (display-graphic-p)
+                                 '(:box (:line-width 2 :color "dark grey")
+                                        :background "light grey"
+                                        :foreground "black")
+                               'link)))
+            (insert-text-button button-text
+                                'face button-face
+                                'follow-link t
+                                'package-symbol package
+                                'action 'package-install-button-action)))
+         (built-in
+          (insert (propertize "Built-in"
+                              'font-lock-face 'font-lock-builtin-face) "."))
+         (t (insert "Deleted.")))
+    (insert "\n")
+    (and version
+        (> (length version) 0)
+        (insert "    "
+                (propertize "Version" 'font-lock-face 'bold) ": " version "\n"))
+    (setq reqs (package-desc-reqs desc))
+    (when reqs
+      (insert "   " (propertize "Requires" 'font-lock-face 'bold) ": ")
+      (let ((first t)
+           name vers text)
+       (dolist (req reqs)
+         (setq name (car req)
+               vers (cadr req)
+               text (format "%s-%s" (symbol-name name)
+                            (package-version-join vers)))
+         (cond (first (setq first nil))
+               ((>= (+ 2 (current-column) (length text))
+                    (window-width))
+                (insert ",\n               "))
+               (t (insert ", ")))
+         (help-insert-xref-button text 'help-package name))
+       (insert "\n")))
+    (insert "    " (propertize "Summary" 'font-lock-face 'bold)
+           ": " (package-desc-doc desc) "\n\n")
+
+    (if (assq package package--builtins)
+       ;; For built-in packages, insert the commentary.
+       (let ((fn (locate-file (concat package-name ".el") load-path
+                              load-file-rep-suffixes))
+             (opoint (point)))
+         (insert (or (lm-commentary fn) ""))
+         (save-excursion
+           (goto-char opoint)
+           (when (re-search-forward "^;;; Commentary:\n" nil t)
+             (replace-match ""))
+           (while (re-search-forward "^\\(;+ ?\\)" nil t)
+             (replace-match ""))))
+      (let ((readme (expand-file-name (concat package-name "-readme.txt")
+                                     package-user-dir)))
+       ;; For elpa packages, try downloading the commentary.  If that
+       ;; fails, try an existing readme file in `package-user-dir'.
+       (cond ((let ((buffer (ignore-errors
+                              (url-retrieve-synchronously
+                               (concat (package-archive-url package)
+                                       package-name "-readme.txt"))))
+                    response)
+                (when buffer
+                  (with-current-buffer buffer
+                    (setq response (url-http-parse-response))
+                    (if (or (< response 200) (>= response 300))
+                        (setq response nil)
+                      (setq buffer-file-name
+                            (expand-file-name readme package-user-dir))
+                      (delete-region (point-min) (1+ url-http-end-of-headers))
+                      (save-buffer)))
+                  (when response
+                    (insert-buffer-substring buffer)
+                    (kill-buffer buffer)
+                    t))))
+             ((file-readable-p readme)
+              (insert-file-contents readme)
+              (goto-char (point-max))))))))
+
+(defun package-install-button-action (button)
+  (let ((package (button-get button 'package-symbol)))
+    (when (y-or-n-p (format "Install package `%s'? " package))
+      (package-install package)
+      (revert-buffer nil t)
+      (goto-char (point-min)))))
+
+\f
+;;;; Package menu mode.
+
+(defvar package-menu-mode-map
+  (let ((map (make-keymap))
+       (menu-map (make-sparse-keymap "Package")))
+    (suppress-keymap map)
+    (define-key map "\C-m" 'package-menu-describe-package)
+    (define-key map "q" 'quit-window)
+    (define-key map "n" 'next-line)
+    (define-key map "p" 'previous-line)
+    (define-key map "u" 'package-menu-mark-unmark)
+    (define-key map "\177" 'package-menu-backup-unmark)
+    (define-key map "d" 'package-menu-mark-delete)
+    (define-key map "i" 'package-menu-mark-install)
+    (define-key map "g" 'package-menu-revert)
+    (define-key map "r" 'package-menu-refresh)
+    (define-key map "~" 'package-menu-mark-obsolete-for-deletion)
+    (define-key map "x" 'package-menu-execute)
+    (define-key map "h" 'package-menu-quick-help)
+    (define-key map "?" 'package-menu-describe-package)
+    (define-key map [follow-link] 'mouse-face)
+    (define-key map [mouse-2] 'mouse-select-window)
+    (define-key map [menu-bar package-menu] (cons "Package" menu-map))
+    (define-key menu-map [mq]
+      '(menu-item "Quit" quit-window
+                 :help "Quit package selection"))
+    (define-key menu-map [s1] '("--"))
+    (define-key menu-map [mn]
+      '(menu-item "Next" next-line
+                 :help "Next Line"))
+    (define-key menu-map [mp]
+      '(menu-item "Previous" previous-line
+                 :help "Previous Line"))
+    (define-key menu-map [s2] '("--"))
+    (define-key menu-map [mu]
+      '(menu-item "Unmark" package-menu-mark-unmark
+                 :help "Clear any marks on a package and move to the next line"))
+    (define-key menu-map [munm]
+      '(menu-item "Unmark backwards" package-menu-backup-unmark
+                 :help "Back up one line and clear any marks on that package"))
+    (define-key menu-map [md]
+      '(menu-item "Mark for deletion" package-menu-mark-delete
+                 :help "Mark a package for deletion and move to the next line"))
+    (define-key menu-map [mi]
+      '(menu-item "Mark for install" package-menu-mark-install
+                 :help "Mark a package for installation and move to the next line"))
+    (define-key menu-map [s3] '("--"))
+    (define-key menu-map [mg]
+      '(menu-item "Update package list" package-menu-revert
+                 :help "Update the list of packages"))
+    (define-key menu-map [mr]
+      '(menu-item "Refresh package list" package-menu-refresh
+                 :help "Download the ELPA archive"))
+    (define-key menu-map [s4] '("--"))
+    (define-key menu-map [mt]
+      '(menu-item "Mark obsolete packages" package-menu-mark-obsolete-for-deletion
+                 :help "Mark all obsolete packages for deletion"))
+    (define-key menu-map [mx]
+      '(menu-item "Execute actions" package-menu-execute
+                 :help "Perform all the marked actions"))
+    (define-key menu-map [s5] '("--"))
+    (define-key menu-map [mh]
+      '(menu-item "Help" package-menu-quick-help
+                 :help "Show short key binding help for package-menu-mode"))
+    (define-key menu-map [mc]
+      '(menu-item "View Commentary" package-menu-view-commentary
+                 :help "Display information about this package"))
+    map)
+  "Local keymap for `package-menu-mode' buffers.")
+
+(defvar package-menu-sort-button-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map [header-line mouse-1] 'package-menu-sort-by-column)
+    (define-key map [header-line mouse-2] 'package-menu-sort-by-column)
+    (define-key map [follow-link] 'mouse-face)
+    map)
+  "Local keymap for package menu sort buttons.")
+
+(put 'package-menu-mode 'mode-class 'special)
+
+(defun package-menu-mode ()
+  "Major mode for browsing a list of packages.
+Letters do not insert themselves; instead, they are commands.
+\\<package-menu-mode-map>
+\\{package-menu-mode-map}"
+  (kill-all-local-variables)
+  (use-local-map package-menu-mode-map)
+  (setq major-mode 'package-menu-mode)
+  (setq mode-name "Package Menu")
+  (setq truncate-lines t)
+  (setq buffer-read-only t)
+  (setq header-line-format
+       (mapconcat
+        (lambda (pair)
+          (let ((column (car pair))
+                (name (cdr pair)))
+            (concat
+             ;; Insert a space that aligns the button properly.
+             (propertize " " 'display (list 'space :align-to column)
+                         'face 'fixed-pitch)
+             ;; Set up the column button.
+             (propertize name
+                         'column-name name
+                         'help-echo "mouse-1: sort by column"
+                         'mouse-face 'highlight
+                         'keymap package-menu-sort-button-map))))
+        ;; We take a trick from buff-menu and have a dummy leading
+        ;; space to align the header line with the beginning of the
+        ;; text.  This doesn't really work properly on Emacs 21, but
+        ;; it is close enough.
+        '((0 . "")
+          (2 . "Package")
+          (20 . "Version")
+          (32 . "Status")
+          (43 . "Description"))
+        ""))
+  (run-mode-hooks 'package-menu-mode-hook))
+
+(defun package-menu-refresh ()
+  "Download the ELPA archive.
+This fetches the file describing the current contents of
+the Emacs Lisp Package Archive, and then refreshes the
+package menu.  This lets you see what new packages are
+available for download."
+  (interactive)
+  (unless (eq major-mode 'package-menu-mode)
+    (error "The current buffer is not a Package Menu"))
+  (package-refresh-contents)
+  (package--generate-package-list))
+
+(defun package-menu-revert ()
+  "Update the list of packages."
+  (interactive)
+  (unless (eq major-mode 'package-menu-mode)
+    (error "The current buffer is not a Package Menu"))
+  (package--generate-package-list))
+
+(defun package-menu-describe-package ()
+  "Describe the package in the current line."
+  (interactive)
+  (let ((name (package-menu-get-package)))
+    (if name
+       (describe-package (intern name))
+      (message "No package on this line"))))
+
+(defun package-menu-mark-internal (what)
+  (unless (eobp)
+    (let ((buffer-read-only nil))
+      (beginning-of-line)
+      (delete-char 1)
+      (insert what)
+      (forward-line))))
+
+;; fixme numeric argument
+(defun package-menu-mark-delete (num)
+  "Mark a package for deletion and move to the next line."
+  (interactive "p")
+  (package-menu-mark-internal "D"))
+
+(defun package-menu-mark-install (num)
+  "Mark a package for installation and move to the next line."
+  (interactive "p")
+  (package-menu-mark-internal "I"))
+
+(defun package-menu-mark-unmark (num)
+  "Clear any marks on a package and move to the next line."
+  (interactive "p")
+  (package-menu-mark-internal " "))
+
+(defun package-menu-backup-unmark ()
+  "Back up one line and clear any marks on that package."
+  (interactive)
+  (forward-line -1)
+  (package-menu-mark-internal " ")
+  (forward-line -1))
+
+(defun package-menu-mark-obsolete-for-deletion ()
+  "Mark all obsolete packages for deletion."
+  (interactive)
+  (save-excursion
+    (goto-char (point-min))
+    (forward-line 2)
+    (while (not (eobp))
+      (if (looking-at ".*\\s obsolete\\s ")
+         (package-menu-mark-internal "D")
+       (forward-line 1)))))
+
+(defun package-menu-quick-help ()
+  "Show short key binding help for package-menu-mode."
+  (interactive)
+  (message "n-ext, i-nstall, d-elete, u-nmark, x-ecute, r-efresh, h-elp"))
+
+(define-obsolete-function-alias
+  'package-menu-view-commentary 'package-menu-describe-package "24.1")
+
+;; Return the name of the package on the current line.
+(defun package-menu-get-package ()
+  (save-excursion
+    (beginning-of-line)
+    (if (looking-at ". \\([^ \t]*\\)")
+       (match-string-no-properties 1))))
+
+;; Return the version of the package on the current line.
+(defun package-menu-get-version ()
+  (save-excursion
+    (beginning-of-line)
+    (if (looking-at ". [^ \t]*[ \t]*\\([0-9.]*\\)")
+       (match-string 1))))
+
+(defun package-menu-get-status ()
+  (save-excursion
+    (if (looking-at ". [^ \t]*[ \t]*[^ \t]*[ \t]*\\([^ \t]*\\)")
+       (match-string 1)
+      "")))
+
+(defun package-menu-execute ()
+  "Perform all the marked actions.
+Packages marked for installation will be downloaded and
+installed.  Packages marked for deletion will be removed.
+Note that after installing packages you will want to restart
+Emacs."
+  (interactive)
+  (goto-char (point-min))
+  (while (not (eobp))
+    (let ((cmd (char-after))
+         (pkg-name (package-menu-get-package))
+         (pkg-vers (package-menu-get-version))
+         (pkg-status (package-menu-get-status)))
+      (cond
+       ((eq cmd ?D)
+       (when (and (string= pkg-status "installed")
+                  (string= pkg-name "package"))
+         ;; FIXME: actually, we could be tricky and remove all info.
+         ;; But that is drastic and the user can do that instead.
+         (error "Can't delete most recent version of `package'"))
+       ;; Ask for confirmation here?  Maybe if package status is ""?
+       ;; Or if any lisp from package is actually loaded?
+       (message "Deleting %s-%s..." pkg-name pkg-vers)
+       (package-delete pkg-name pkg-vers)
+       (message "Deleting %s-%s... done" pkg-name pkg-vers))
+       ((eq cmd ?I)
+       (package-install (intern pkg-name)))))
+    (forward-line))
+  (package-menu-revert))
+
+(defun package-print-package (package version key desc)
+  (let ((face
+        (cond ((string= key "built-in") 'font-lock-builtin-face)
+              ((string= key "available") 'default)
+              ((string= key "held") 'font-lock-constant-face)
+              ((string= key "disabled") 'font-lock-warning-face)
+              ((string= key "installed") 'font-lock-comment-face)
+              (t ; obsolete, but also the default.
+               'font-lock-warning-face))))
+    (insert (propertize "  " 'font-lock-face face))
+    (insert-text-button (symbol-name package)
+                       'face 'link
+                       'follow-link t
+                       'package-symbol package
+                       'action (lambda (button)
+                                 (describe-package
+                                  (button-get button 'package-symbol))))
+    (indent-to 20 1)
+    (insert (propertize (package-version-join version) 'font-lock-face face))
+    (indent-to 32 1)
+    (insert (propertize key 'font-lock-face face))
+    ;; FIXME: this 'when' is bogus...
+    (when desc
+      (indent-to 43 1)
+      (let ((opoint (point)))
+       (insert (propertize desc 'font-lock-face face))
+       (upcase-region opoint (min (point) (1+ opoint)))))
+    (insert "\n")))
+
+(defun package-list-maybe-add (package version status description result)
+  (unless (assoc (cons package version) result)
+    (setq result (cons (list (cons package version) status description)
+                      result)))
+  result)
+
+(defvar package-menu-package-list nil
+  "List of packages to display in the Package Menu buffer.
+A value of nil means to display all packages.")
+
+(defvar package-menu-sort-key nil
+  "Sort key for the current Package Menu buffer.")
+
+(defun package--generate-package-list ()
+  "Populate the current Package Menu buffer."
+  (package-initialize)
+  (let ((inhibit-read-only t)
+       info-list name desc hold builtin)
+    (setq buffer-read-only nil)
+    (erase-buffer)
+    ;; List installed packages
+    (dolist (elt package-alist)
+      (setq name (car elt))
+      (when (and (not (eq name 'emacs)) ; Hide the `emacs' package.
+                (or (null package-menu-package-list)
+                    (memq name package-menu-package-list)))
+       (setq desc (cdr elt)
+             hold (cadr (assq name package-load-list))
+             builtin (cdr (assq name package--builtins)))
+       (setq info-list
+             (package-list-maybe-add
+              name (package-desc-vers desc)
+              ;; FIXME: it turns out to be tricky to see if this
+              ;; package is presently activated.
+              (cond ((stringp hold) "held")
+                    ((and builtin
+                          (version-list-=
+                           (package-desc-vers builtin)
+                           (package-desc-vers desc)))
+                     "built-in")
+                    (t "installed"))
+              (package-desc-doc desc)
+              info-list))))
+
+    ;; List available and disabled packages
+    (dolist (elt package-archive-contents)
+      (setq name (car elt)
+           desc (cdr elt)
+           hold (assq name package-load-list))
+      (when (or (null package-menu-package-list)
+               (memq name package-menu-package-list))
+       (setq info-list
+             (package-list-maybe-add name
+                                     (package-desc-vers desc)
+                                     (if (and hold (null (cadr hold)))
+                                         "disabled"
+                                       "available")
+                                     (package-desc-doc (cdr elt))
+                                     info-list))))
+    ;; List obsolete packages
+    (mapc (lambda (elt)
+           (mapc (lambda (inner-elt)
+                   (setq info-list
+                         (package-list-maybe-add (car elt)
+                                                 (package-desc-vers
+                                                  (cdr inner-elt))
+                                                 "obsolete"
+                                                 (package-desc-doc
+                                                  (cdr inner-elt))
+                                                 info-list)))
+                 (cdr elt)))
+         package-obsolete-alist)
+
+    (setq info-list
+         (sort info-list
+               (cond ((string= package-menu-sort-key "Package")
+                      'package-menu--name-predicate)
+                     ((string= package-menu-sort-key "Version")
+                      'package-menu--version-predicate)
+                     ((string= package-menu-sort-key "Description")
+                      'package-menu--description-predicate)
+                     (t ; By default, sort by package status
+                      'package-menu--status-predicate))))
+
+    (dolist (elt info-list)
+      (package-print-package (car (car elt))
+                            (cdr (car elt))
+                            (car (cdr elt))
+                            (car (cdr (cdr elt)))))
+    (goto-char (point-min))
+    (set-buffer-modified-p nil)
+    (current-buffer)))
+
+(defun package-menu--version-predicate (left right)
+  (let ((vleft  (or (cdr (car left))  '(0)))
+       (vright (or (cdr (car right)) '(0))))
+    (if (version-list-= vleft vright)
+       (package-menu--name-predicate left right)
+      (version-list-< vleft vright))))
+
+(defun package-menu--status-predicate (left right)
+  (let ((sleft  (cadr left))
+       (sright (cadr right)))
+    (cond ((string= sleft sright)
+          (package-menu--name-predicate left right))
+         ((string= sleft  "available") t)
+         ((string= sright "available") nil)
+         ((string= sleft  "installed") t)
+         ((string= sright "installed") nil)
+         ((string= sleft  "held") t)
+         ((string= sright "held") nil)
+         ((string= sleft  "built-in") t)
+         ((string= sright "built-in") nil)
+         ((string= sleft  "obsolete") t)
+         ((string= sright  "obsolete") nil)
+         (t (string< sleft sright)))))
+
+(defun package-menu--description-predicate (left right)
+  (let ((sleft  (car (cddr left)))
+       (sright (car (cddr right))))
+    (if (string= sleft sright)
+       (package-menu--name-predicate left right)
+      (string< sleft sright))))
+
+(defun package-menu--name-predicate (left right)
+  (string< (symbol-name (caar left))
+          (symbol-name (caar right))))
+
+(defun package-menu-sort-by-column (&optional e)
+  "Sort the package menu by the column of the mouse click E."
+  (interactive "e")
+  (let* ((pos (event-start e))
+        (obj (posn-object pos))
+        (col (if obj
+                 (get-text-property (cdr obj) 'column-name (car obj))
+               (get-text-property (posn-point pos) 'column-name)))
+        (buf (window-buffer (posn-window (event-start e)))))
+    (with-current-buffer buf
+      (when (eq major-mode 'package-menu-mode)
+       (setq package-menu-sort-key col)
+       (package--generate-package-list)))))
+
+(defun package--list-packages (&optional packages)
+  "Generate and pop to the *Packages* buffer.
+Optional PACKAGES is a list of names of packages (symbols) to
+list; the default is to display everything in `package-alist'."
+  (with-current-buffer (get-buffer-create "*Packages*")
+    (package-menu-mode)
+    (set (make-local-variable 'package-menu-package-list) packages)
+    (set (make-local-variable 'package-menu-sort-key) nil)
+    (package--generate-package-list)
+    ;; It's okay to use pop-to-buffer here.  The package menu buffer
+    ;; has keybindings, and the user just typed `M-x list-packages',
+    ;; suggesting that they might want to use them.
+    (pop-to-buffer (current-buffer))))
+
+;;;###autoload
+(defun list-packages ()
+  "Display a list of packages.
+Fetches the updated list of packages before displaying.
+The list is displayed in a buffer named `*Packages*'."
+  (interactive)
+  (package-refresh-contents)
+  (package--list-packages))
+
+;;;###autoload
+(defalias 'package-list-packages 'list-packages)
+
+(defun package-list-packages-no-fetch ()
+  "Display a list of packages.
+Does not fetch the updated list of packages before displaying.
+The list is displayed in a buffer named `*Packages*'."
+  (interactive)
+  (package--list-packages))
+
+(provide 'package)
+
+;;; package.el ends here
diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el
new file mode 100644 (file)
index 0000000..0b46eb2
--- /dev/null
@@ -0,0 +1,489 @@
+;;; pcase.el --- ML-style pattern-matching macro for Elisp
+
+;; Copyright (C) 2010  Free Software Foundation, Inc.
+
+;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
+;; Keywords: 
+
+;; 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:
+
+;; ML-style pattern matching.
+;; The entry points are autoloaded.
+
+;;; Code:
+
+(eval-when-compile (require 'cl))
+
+;; 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 t :test 'equal))
+
+;;;###autoload
+(defmacro pcase (exp &rest cases)
+  "Perform ML-style pattern matching on EXP.
+CASES is a list of elements of the form (UPATTERN CODE...).
+
+UPatterns can take the following forms:
+  _            matches anything.
+  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.
+  `QPAT                matches if the QPattern QPAT matches.
+  (pred PRED)  matches if PRED applied to the object returns non-nil.
+
+QPatterns can take the following forms:
+  (QPAT1 . QPAT2)      matches if QPAT1 matches the car and QPAT2 the cdr.
+  ,UPAT                        matches if the UPattern UPAT matches.
+  ATOM                 matches if the object is `eq' to ATOM.
+QPatterns for vectors are not implemented yet.
+
+PRED can take the form
+  FUNCTION     in which case it gets called with one argument.
+  (FUN ARG1 .. ARGN) in which case it gets called with N+1 arguments.
+A PRED of the form FUNCTION is equivalent to one of the form (FUNCTION).
+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))
+  (or (gethash (cons exp cases) pcase-memoize)
+      (puthash (cons exp cases)
+               (pcase-expand exp cases)
+               pcase-memoize)))
+
+;;;###autoload
+(defmacro pcase-let* (bindings 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)."
+  (if (null bindings) body
+    `(pcase ,(cadr (car bindings))
+       (,(caar bindings) (plet* ,(cdr bindings) ,body))
+       (t (error "Pattern match failure in `plet'")))))
+
+;;;###autoload
+(defmacro pcase-let (bindings 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)."
+  (if (null (cdr bindings))
+      `(plet* ,bindings ,body)
+    (setq bindings (mapcar (lambda (x) (cons (make-symbol "x") x)) bindings))
+    `(let ,(mapcar (lambda (binding) (list (nth 0 binding) (nth 2 binding)))
+                   bindings)
+       (plet* ,(mapcar (lambda (binding) (list (nth 1 binding) (nth 0 binding)))
+                       bindings)
+              ,body))))
+
+(defun pcase-expand (exp 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.
+                (destructuring-bind (code prevvars res) prev
+                  (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))))
+    `(let ,defs ,main)))
+
+(defun pcase-codegen (code vars)
+  `(let ,(mapcar (lambda (b) (list (car b) (cdr b))) vars)
+     ,@code))
+
+(defun pcase-small-branch-p (code)
+  (and (= 1 (length code))
+       (or (not (consp (car code)))
+           (let ((small t))
+             (dolist (e (car code))
+               (if (consp e) (setq small nil)))
+             small))))
+
+;; Try to use `cond' rather than a sequence of `if's, so as to reduce
+;; the depth of the generated tree.
+(defun pcase-if (test then else)
+  (cond
+   ((eq else :pcase-dontcare) then)
+   ((eq (car-safe else) 'if)
+    `(cond (,test ,then)
+           (,(nth 1 else) ,(nth 2 else))
+           (t ,@(nthcdr 3 else))))
+   ((eq (car-safe else) 'cond)
+    `(cond (,test ,then)
+           ,@(cdr else)))
+   (t `(if ,test ,then ,else))))
+
+(defun pcase-upat (qpattern)
+  (cond
+   ((eq (car-safe qpattern) '\,) (cadr qpattern))
+   (t (list '\` qpattern))))
+
+;; Note about MATCH:
+;; When we have patterns like `(PAT1 . PAT2), after performing the `consp'
+;; check, we want to turn all the similar patterns into ones of the form
+;; (and (match car PAT1) (match cdr PAT2)), so you naturally need conjunction.
+;; Earlier code hence used branches of the form (MATCHES . CODE) where
+;; MATCHES was a list (implicitly a conjunction) of (SYM . PAT).
+;; But if we have a pattern of the form (or `(PAT1 . PAT2) PAT3), there is
+;; no easy way to eliminate the `consp' check in such a representation.
+;; So we replaced the MATCHES by the MATCH below which can be made up
+;; of conjunctions and disjunctions, so if we know `foo' is a cons, we can
+;; turn (match foo . (or `(PAT1 . PAT2) PAT3)) into
+;; (or (and (match car . `PAT1) (match cdr . `PAT2)) (match foo . PAT3)).
+;; The downside is that we now have `or' and `and' both in MATCH and
+;; in PAT, so there are different equivalent representations and we
+;; need to handle them all.  We do not try to systematically
+;; canonicalize them to one form over another, but we do occasionally
+;; turn one into the other.
+
+(defun pcase-u (branches)
+  "Expand matcher for rules BRANCHES.
+Each BRANCH has the form (MATCH CODE . VARS) where
+CODE is the code generator for that branch.
+VARS is the set of vars already bound by earlier matches.
+MATCH is the pattern that needs to be matched, of the form:
+  (match VAR . UPAT)
+  (and MATCH ...)
+  (or MATCH ...)"
+  (when (setq branches (delq nil branches))
+    (destructuring-bind (match code &rest vars) (car branches)
+      (pcase-u1 (list match) code vars (cdr branches)))))
+
+(defun pcase-and (match matches)
+  (if matches `(and ,match ,@matches) match))
+
+(defun pcase-split-match (sym splitter match)
+  (case (car match)
+    ((match)
+     (if (not (eq sym (cadr match)))
+         (cons match match)
+       (let ((pat (cddr match)))
+         (cond
+          ;; Hoist `or' and `and' patterns to `or' and `and' matches.
+          ((memq (car-safe pat) '(or and))
+           (pcase-split-match sym splitter
+                              (cons (car pat)
+                                    (mapcar (lambda (alt)
+                                              `(match ,sym . ,alt))
+                                            (cdr pat)))))
+          (t (let ((res (funcall splitter (cddr match))))
+               (cons (or (car res) match) (or (cdr res) match))))))))
+    ((or and)
+     (let ((then-alts '())
+           (else-alts '())
+           (neutral-elem (if (eq 'or (car match)) :pcase-fail :pcase-succeed))
+           (zero-elem (if (eq 'or (car match)) :pcase-succeed :pcase-fail)))
+       (dolist (alt (cdr match))
+         (let ((split (pcase-split-match sym splitter alt)))
+           (unless (eq (car split) neutral-elem)
+             (push (car split) then-alts))
+           (unless (eq (cdr split) neutral-elem)
+             (push (cdr split) else-alts))))
+       (cons (cond ((memq zero-elem then-alts) zero-elem)
+                   ((null then-alts) neutral-elem)
+                   ((null (cdr then-alts)) (car then-alts))
+                   (t (cons (car match) (nreverse then-alts))))
+             (cond ((memq zero-elem else-alts) zero-elem)
+                   ((null else-alts) neutral-elem)
+                   ((null (cdr else-alts)) (car else-alts))
+                   (t (cons (car match) (nreverse else-alts)))))))
+    (t (error "Uknown MATCH %s" match))))
+
+(defun pcase-split-rest (sym splitter rest)
+  (let ((then-rest '())
+        (else-rest '()))
+    (dolist (branch rest)
+      (let* ((match (car branch))
+             (code&vars (cdr branch))
+             (splitted
+              (pcase-split-match sym splitter match)))
+        (unless (eq (car splitted) :pcase-fail)
+          (push (cons (car splitted) code&vars) then-rest))
+        (unless (eq (cdr splitted) :pcase-fail)
+          (push (cons (cdr splitted) code&vars) else-rest))))
+    (cons (nreverse then-rest) (nreverse else-rest))))
+
+(defun pcase-split-consp (syma symd pat)
+  (cond
+   ;; A QPattern for a cons, can only go the `then' side.
+   ((and (eq (car-safe pat) '\`) (consp (cadr pat)))
+    (let ((qpat (cadr pat)))
+      (cons `(and (match ,syma . ,(pcase-upat (car qpat)))
+                  (match ,symd . ,(pcase-upat (cdr qpat))))
+            :pcase-fail)))
+   ;; A QPattern but not for a cons, can only go the `else' side.
+   ((eq (car-safe pat) '\`) (cons :pcase-fail nil))))
+
+(defun pcase-split-eq (elem pat)
+  (cond
+   ;; The same match will give the same result.
+   ((and (eq (car-safe pat) '\`) (equal (cadr pat) elem))
+    (cons :pcase-succeed :pcase-fail))
+   ;; A different match will fail if this one succeeds.
+   ((and (eq (car-safe pat) '\`)
+         ;; (or (integerp (cadr pat)) (symbolp (cadr pat))
+         ;;     (consp (cadr pat)))
+         )
+    (cons :pcase-fail nil))))
+
+(defun pcase-split-memq (elems pat)
+  ;; Based on pcase-split-eq.
+  (cond
+   ;; The same match will give the same result.
+   ((and (eq (car-safe pat) '\`) (member (cadr pat) elems))
+    (cons :pcase-succeed nil))
+   ;; A different match will fail if this one succeeds.
+   ((and (eq (car-safe pat) '\`)
+         ;; (or (integerp (cadr pat)) (symbolp (cadr pat))
+         ;;     (consp (cadr pat)))
+         )
+    (cons :pcase-fail nil))))
+
+(defun pcase-split-pred (upat pat)
+  ;; FIXME: For predicates like (pred (> a)), two such predicates may
+  ;; actually refer to different variables `a'.
+  (if (equal upat pat)
+      (cons :pcase-succeed :pcase-fail)))
+
+(defun pcase-fgrep (vars sexp)
+  "Check which of the symbols VARS appear in SEXP."
+  (let ((res '()))
+    (while (consp sexp)
+      (dolist (var (pcase-fgrep vars (pop sexp)))
+        (unless (memq var res) (push var res))))
+    (and (memq sexp vars) (not (memq sexp res)) (push sexp res))
+    res))
+
+;; It's very tempting to use `pcase' below, tho obviously, it'd create
+;; bootstrapping problems.
+(defun pcase-u1 (matches code vars rest)
+  "Return code that runs CODE (with VARS) if MATCHES match.
+and otherwise defers to REST which is a list of branches of the form
+\(ELSE-MATCH ELSE-CODE . ELSE-VARS)."
+  ;; Depending on the order in which we choose to check each of the MATCHES,
+  ;; the resulting tree may be smaller or bigger.  So in general, we'd want
+  ;; to be careful to chose the "optimal" order.  But predicate
+  ;; patterns make this harder because they create dependencies
+  ;; between matches.  So we don't bother trying to reorder anything.
+  (cond
+   ((null matches) (funcall code vars))
+   ((eq :pcase-fail (car matches)) (pcase-u rest))
+   ((eq :pcase-succeed (car matches))
+    (pcase-u1 (cdr matches) code vars rest))
+   ((eq 'and (caar matches))
+    (pcase-u1 (append (cdar matches) (cdr matches)) code vars rest))
+   ((eq 'or (caar matches))
+    (let* ((alts (cdar matches))
+           (var (if (eq (caar alts) 'match) (cadr (car alts))))
+           (simples '()) (others '()))
+      (when var
+        (dolist (alt alts)
+          (if (and (eq (car alt) 'match) (eq var (cadr alt))
+                   (let ((upat (cddr alt)))
+                     (and (eq (car-safe upat) '\`)
+                          (or (integerp (cadr upat)) (symbolp (cadr upat))))))
+              (push (cddr alt) simples)
+            (push alt others))))
+      (cond
+       ((null alts) (error "Please avoid it") (pcase-u rest))
+       ((> (length simples) 1)
+        ;; De-hoist the `or' MATCH into an `or' pattern that will be
+        ;; turned into a `memq' below.
+        (pcase-u1 (cons `(match ,var or . ,(nreverse simples)) (cdr matches))
+                  code vars
+                  (if (null others) rest
+                    (cons (list*
+                           (pcase-and (if (cdr others)
+                                          (cons 'or (nreverse others))
+                                        (car others))
+                                      (cdr matches))
+                           code vars)
+                          rest))))
+       (t
+        (pcase-u1 (cons (pop alts) (cdr matches)) code vars
+                  (if (null alts) (progn (error "Please avoid it") rest)
+                    (cons (list*
+                           (pcase-and (if (cdr alts)
+                                          (cons 'or alts) (car alts))
+                                      (cdr matches))
+                           code vars)
+                          rest)))))))
+   ((eq 'match (caar matches))
+    (destructuring-bind (op sym &rest upat) (pop matches)
+      (cond
+       ((memq upat '(t _)) (pcase-u1 matches code vars rest))
+       ((eq upat 'dontcare) :pcase-dontcare)
+       ((functionp upat)  (error "Feature removed, use (pred %s)" upat))
+       ((eq (car-safe upat) 'pred)
+        (destructuring-bind (then-rest &rest else-rest)
+            (pcase-split-rest
+             sym (apply-partially 'pcase-split-pred upat) rest)
+          (pcase-if (if (symbolp (cadr upat))
+                        `(,(cadr upat) ,sym)
+                      (let* ((exp (cadr upat))
+                             ;; `vs' is an upper bound on the vars we need.
+                             (vs (pcase-fgrep (mapcar #'car vars) exp)))
+                        (if vs
+                            ;; Let's not replace `vars' in `exp' since it's
+                            ;; too difficult to do it right, instead just
+                            ;; let-bind `vars' around `exp'.
+                            `(let ,(mapcar (lambda (var)
+                                             (list var (cdr (assq var vars))))
+                                           vs)
+                               ;; FIXME: `vars' can capture `sym'.  E.g.
+                               ;; (pcase x ((and `(,x . ,y) (pred (fun x)))))
+                               (,@exp ,sym))
+                          `(,@exp ,sym))))
+                    (pcase-u1 matches code vars then-rest)
+                    (pcase-u else-rest))))
+       ((symbolp upat)
+        (pcase-u1 matches code (cons (cons upat sym) vars) rest))
+       ((eq (car-safe upat) '\`)
+        (pcase-q1 sym (cadr upat) matches code vars rest))
+       ((eq (car-safe upat) 'or)
+        (let ((all (> (length (cdr upat)) 1)))
+          (when all
+            (dolist (alt (cdr upat))
+              (unless (and (eq (car-safe alt) '\`)
+                           (or (symbolp (cadr alt)) (integerp (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))))
+                (destructuring-bind (then-rest &rest else-rest)
+                    (pcase-split-rest
+                     sym (apply-partially 'pcase-split-memq elems) rest)
+                  (pcase-if `(memq ,sym ',elems)
+                            (pcase-u1 matches code vars then-rest)
+                            (pcase-u else-rest))))
+            (pcase-u1 (cons `(match ,sym ,@(cadr upat)) matches) code vars
+                      (append (mapcar (lambda (upat)
+                                        `((and (match ,sym . ,upat) ,@matches)
+                                          ,code ,@vars))
+                                      (cddr upat))
+                              rest)))))
+       ((eq (car-safe upat) 'and)
+        (pcase-u1 (append (mapcar (lambda (upat) `(match ,sym ,@upat)) (cdr upat))
+                          matches)
+                  code vars rest))
+       ((eq (car-safe upat) 'not)
+        ;; FIXME: The implementation below is naive and results in
+        ;; inefficient code.
+        ;; To make it work right, we would need to turn pcase-u1's
+        ;; `code' and `vars' into a single argument of the same form as
+        ;; `rest'.  We would also need to split this new `then-rest' argument
+        ;; for every test (currently we don't bother to do it since
+        ;; it's only useful for odd patterns like (and `(PAT1 . PAT2)
+        ;; `(PAT3 . PAT4)) which the programmer can easily rewrite
+        ;; to the more efficient `(,(and PAT1 PAT3) . ,(and PAT2 PAT4))).
+        (pcase-u1 `((match ,sym . ,(cadr upat)))
+                  (lexical-let ((rest rest))
+                    ;; FIXME: This codegen is not careful to share its
+                    ;; code if used several times: code blow up is likely.
+                    (lambda (vars)
+                      ;; `vars' will likely contain bindings which are
+                      ;; not always available in other paths to
+                      ;; `rest', so there' no point trying to pass
+                      ;; them down.
+                      (pcase-u rest)))
+                  vars
+                  (list `((and . ,matches) ,code . ,vars))))
+       (t (error "Unknown upattern `%s'" upat)))))
+   (t (error "Incorrect MATCH %s" (car matches)))))
+
+(defun pcase-q1 (sym qpat matches code vars rest)
+  "Return code that runs CODE if SYM matches QPAT and if MATCHES match.
+and if not, defers to REST which is a list of branches of the form
+\(OTHER_MATCH OTHER-CODE . OTHER-VARS)."
+  (cond
+   ((eq (car-safe qpat) '\,) (error "Can't use `,UPATTERN"))
+   ((floatp qpat) (error "Floating point patterns not supported"))
+   ((vectorp qpat)
+    ;; FIXME.
+    (error "Vector QPatterns not implemented yet"))
+   ((consp qpat)
+    (let ((syma (make-symbol "xcar"))
+          (symd (make-symbol "xcdr")))
+      (destructuring-bind (then-rest &rest else-rest)
+          (pcase-split-rest sym (apply-partially 'pcase-split-consp syma symd)
+                            rest)
+        (pcase-if `(consp ,sym)
+                  `(let ((,syma (car ,sym))
+                         (,symd (cdr ,sym)))
+                     ,(pcase-u1 `((match ,syma . ,(pcase-upat (car qpat)))
+                                  (match ,symd . ,(pcase-upat (cdr qpat)))
+                                  ,@matches)
+                                code vars then-rest))
+                  (pcase-u else-rest)))))
+   ((or (integerp qpat) (symbolp qpat))
+    (destructuring-bind (then-rest &rest else-rest)
+        (pcase-split-rest sym (apply-partially 'pcase-split-eq qpat) rest)
+      (pcase-if `(eq ,sym ',qpat)
+                (pcase-u1 matches code vars then-rest)
+                (pcase-u else-rest))))
+   (t (error "Unkown QPattern %s" qpat))))
+
+
+(provide 'pcase)
+;;; pcase.el ends here
index ec1a704ce0b230c933868b55004ea56cd551b29b..1845effd5bb11833e9578a11369c019008ec6f9e 100644 (file)
 ;; this limit allowing an easy way to see all matches.
 
 ;; Currently `re-builder' understands five different forms of input,
-;; namely `read', `string', `rx', `sregex' and `lisp-re' syntax.  Read
+;; namely `read', `string', `rx', and `sregex' syntax.  Read
 ;; syntax and string syntax are both delimited by `"'s and behave
 ;; according to their name.  With the `string' syntax there's no need
 ;; to escape the backslashes and double quotes simplifying the editing
 ;; somewhat.  The other three allow editing of symbolic regular
-;; expressions supported by the packages of the same name.  (`lisp-re'
-;; is a package by me and its support may go away as it is nearly the
-;; same as the `sregex' package in Emacs)
+;; expressions supported by the packages of the same name.
 
 ;; Editing symbolic expressions is done through a major mode derived
 ;; from `emacs-lisp-mode' so you'll get all the good stuff like
 
 (defcustom reb-re-syntax 'read
   "Syntax for the REs in the RE Builder.
-Can either be `read', `string', `sregex', `lisp-re', `rx'."
+Can either be `read', `string', `sregex', or `rx'."
   :group 're-builder
   :type '(choice (const :tag "Read syntax" read)
                 (const :tag "String syntax" string)
                 (const :tag "`sregex' syntax" sregex)
-                (const :tag "`lisp-re' syntax" lisp-re)
                 (const :tag "`rx' syntax" rx)))
 
 (defcustom reb-auto-match-limit 200
@@ -281,9 +278,8 @@ Except for Lisp syntax this is the same as `reb-regexp'.")
 (define-derived-mode reb-lisp-mode
   emacs-lisp-mode "RE Builder Lisp"
   "Major mode for interactively building symbolic Regular Expressions."
-  (cond ((eq reb-re-syntax 'lisp-re)   ; Pull in packages
-        (require 'lisp-re))            ; as needed
-       ((eq reb-re-syntax 'sregex)     ; sregex is not autoloaded
+  ;; Pull in packages as needed
+  (cond        ((eq reb-re-syntax 'sregex)     ; sregex is not autoloaded
         (require 'sregex))             ; right now..
        ((eq reb-re-syntax 'rx)         ; rx-to-string is autoloaded
         (require 'rx)))                ; require rx anyway
@@ -329,7 +325,7 @@ Except for Lisp syntax this is the same as `reb-regexp'.")
 
 (defsubst reb-lisp-syntax-p ()
   "Return non-nil if RE Builder uses a Lisp syntax."
-  (memq reb-re-syntax '(lisp-re sregex rx)))
+  (memq reb-re-syntax '(sregex rx)))
 
 (defmacro reb-target-binding (symbol)
   "Return binding for SYMBOL in the RE Builder target buffer."
@@ -489,10 +485,10 @@ Optional argument SYNTAX must be specified if called non-interactively."
    (list (intern
          (completing-read "Select syntax: "
                           (mapcar (lambda (el) (cons (symbol-name el) 1))
-                                  '(read string lisp-re sregex rx))
+                                  '(read string sregex rx))
                           nil t (symbol-name reb-re-syntax)))))
 
-  (if (memq syntax '(read string lisp-re sregex rx))
+  (if (memq syntax '(read string sregex rx))
       (let ((buffer (get-buffer reb-buffer)))
        (setq reb-re-syntax syntax)
        (when buffer
@@ -616,10 +612,7 @@ optional fourth argument FORCE is non-nil."
 
 (defun reb-cook-regexp (re)
   "Return RE after processing it according to `reb-re-syntax'."
-  (cond ((eq reb-re-syntax 'lisp-re)
-        (when (fboundp 'lre-compile-string)
-          (lre-compile-string (eval (car (read-from-string re))))))
-       ((eq reb-re-syntax 'sregex)
+  (cond ((eq reb-re-syntax 'sregex)
         (apply 'sregex (eval (car (read-from-string re)))))
        ((eq reb-re-syntax 'rx)
         (rx-to-string (eval (car (read-from-string re)))))
diff --git a/lisp/emacs-lisp/smie.el b/lisp/emacs-lisp/smie.el
new file mode 100644 (file)
index 0000000..e8b5c24
--- /dev/null
@@ -0,0 +1,1113 @@
+;;; smie.el --- Simple Minded Indentation Engine
+
+;; Copyright (C) 2010  Free Software Foundation, Inc.
+
+;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
+;; Keywords: languages, lisp, internal, parsing, indentation
+
+;; 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 this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; While working on the SML indentation code, the idea grew that maybe
+;; I could write something generic to do the same thing, and at the
+;; end of working on the SML code, I had a pretty good idea of what it
+;; could look like.  That idea grew stronger after working on
+;; LaTeX indentation.
+;;
+;; So at some point I decided to try it out, by writing a new
+;; indentation code for Coq while trying to keep most of the code
+;; "table driven", where only the tables are Coq-specific.  The result
+;; (which was used for Beluga-mode as well) turned out to be based on
+;; something pretty close to an operator precedence parser.
+
+;; So here is another rewrite, this time following the actual principles of
+;; operator precedence grammars.  Why OPG?  Even though they're among the
+;; weakest kinds of parsers, these parsers have some very desirable properties
+;; for Emacs:
+;; - most importantly for indentation, they work equally well in either
+;;   direction, so you can use them to parse backward from the indentation
+;;   point to learn the syntactic context;
+;; - they work locally, so there's no need to keep a cache of
+;;   the parser's state;
+;; - because of that locality, indentation also works just fine when earlier
+;;   parts of the buffer are syntactically incorrect since the indentation
+;;   looks at "as little as possible" of the buffer to make an indentation
+;;   decision.
+;; - they typically have no error handling and can't even detect a parsing
+;;   error, so we don't have to worry about what to do in case of a syntax
+;;   error because the parser just automatically does something.  Better yet,
+;;   we can afford to use a sloppy grammar.
+
+;; The development (especially the parts building the 2D precedence
+;; tables and then computing the precedence levels from it) is largely
+;; inspired from page 187-194 of "Parsing techniques" by Dick Grune
+;; and Ceriel Jacobs (BookBody.pdf available at
+;; http://www.cs.vu.nl/~dick/PTAPG.html).
+;;
+;; OTOH we had to kill many chickens, read many coffee grounds, and practice
+;; untold numbers of black magic spells, to come up with the indentation code.
+;; Since then, some of that code has been beaten into submission, but the
+;; smie-indent-keyword is still pretty obscure.
+
+;;; Code:
+
+;; FIXME: I think the behavior on empty lines is wrong.  It shouldn't
+;; look at the next token on subsequent lines.
+
+(eval-when-compile (require 'cl))
+
+(defvar comment-continue)
+(declare-function comment-string-strip "newcomment" (str beforep afterp))
+
+;;; Building precedence level tables from BNF specs.
+
+(defun smie-set-prec2tab (table x y val &optional override)
+  (assert (and x y))
+  (let* ((key (cons x y))
+         (old (gethash key table)))
+    (if (and old (not (eq old val)))
+        (if (and override (gethash key override))
+            ;; FIXME: The override is meant to resolve ambiguities,
+            ;; but it also hides real conflicts.  It would be great to
+            ;; be able to distinguish the two cases so that overrides
+            ;; don't hide real conflicts.
+            (puthash key (gethash key override) table)
+          (display-warning 'smie (format "Conflict: %s %s/%s %s" x old val y)))
+      (puthash key val table))))
+
+(defun smie-precs-precedence-table (precs)
+  "Compute a 2D precedence table from a list of precedences.
+PRECS should be a list, sorted by precedence (e.g. \"+\" will
+come before \"*\"), of elements of the form \(left OP ...)
+or (right OP ...) or (nonassoc OP ...) or (assoc OP ...).  All operators in
+one of those elements share the same precedence level and associativity."
+  (let ((prec2-table (make-hash-table :test 'equal)))
+    (dolist (prec precs)
+      (dolist (op (cdr prec))
+        (let ((selfrule (cdr (assq (car prec)
+                                   '((left . >) (right . <) (assoc . =))))))
+          (when selfrule
+            (dolist (other-op (cdr prec))
+              (smie-set-prec2tab prec2-table op other-op selfrule))))
+        (let ((op1 '<) (op2 '>))
+          (dolist (other-prec precs)
+            (if (eq prec other-prec)
+                (setq op1 '> op2 '<)
+              (dolist (other-op (cdr other-prec))
+                (smie-set-prec2tab prec2-table op other-op op2)
+                (smie-set-prec2tab prec2-table other-op op op1)))))))
+    prec2-table))
+
+(defun smie-merge-prec2s (&rest tables)
+  (if (null (cdr tables))
+      (car tables)
+    (let ((prec2 (make-hash-table :test 'equal)))
+      (dolist (table tables)
+        (maphash (lambda (k v)
+                   (smie-set-prec2tab prec2 (car k) (cdr k) v))
+                 table))
+      prec2)))
+
+(defun smie-bnf-precedence-table (bnf &rest precs)
+  (let ((nts (mapcar 'car bnf))         ;Non-terminals
+        (first-ops-table ())
+        (last-ops-table ())
+        (first-nts-table ())
+        (last-nts-table ())
+        (prec2 (make-hash-table :test 'equal))
+        (override (apply 'smie-merge-prec2s
+                         (mapcar 'smie-precs-precedence-table precs)))
+        again)
+    (dolist (rules bnf)
+      (let ((nt (car rules))
+            (last-ops ())
+            (first-ops ())
+            (last-nts ())
+            (first-nts ()))
+        (dolist (rhs (cdr rules))
+          (assert (consp rhs))
+          (if (not (member (car rhs) nts))
+              (pushnew (car rhs) first-ops)
+            (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").
+              ;; Strictly speaking, this should only be done if the
+              ;; first is a non-terminal which can expand to a phrase
+              ;; without any OP in it, but checking doesn't seem worth
+              ;; the trouble, and it lets the writer of the BNF
+              ;; be a bit more sloppy by skipping uninteresting base
+              ;; cases which are terminals but not OPs.
+              (assert (not (member (cadr rhs) nts)))
+              (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)
+              (when (consp (cdr shr))
+                (assert (not (member (cadr shr) nts)))
+                (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)
+        (push (cons nt last-nts) last-nts-table)))
+    ;; Compute all first-ops by propagating the initial ones we have
+    ;; now, according to first-nts.
+    (setq again t)
+    (while (prog1 again (setq again nil))
+      (dolist (first-nts first-nts-table)
+        (let* ((nt (pop first-nts))
+               (first-ops (assoc nt first-ops-table)))
+          (dolist (first-nt first-nts)
+            (dolist (op (cdr (assoc first-nt first-ops-table)))
+              (unless (member op first-ops)
+                (setq again t)
+                (push op (cdr first-ops))))))))
+    ;; Same thing for last-ops.
+    (setq again t)
+    (while (prog1 again (setq again nil))
+      (dolist (last-nts last-nts-table)
+        (let* ((nt (pop last-nts))
+               (last-ops (assoc nt last-ops-table)))
+          (dolist (last-nt last-nts)
+            (dolist (op (cdr (assoc last-nt last-ops-table)))
+              (unless (member op last-ops)
+                (setq again t)
+                (push op (cdr last-ops))))))))
+    ;; Now generate the 2D precedence table.
+    (dolist (rules bnf)
+      (dolist (rhs (cdr rules))
+        (while (cdr rhs)
+          (cond
+           ((member (car rhs) nts)
+            (dolist (last (cdr (assoc (car rhs) last-ops-table)))
+              (smie-set-prec2tab prec2 last (cadr rhs) '> override)))
+           ((member (cadr rhs) nts)
+            (dolist (first (cdr (assoc (cadr rhs) first-ops-table)))
+              (smie-set-prec2tab prec2 (car rhs) first '< override))
+            (if (and (cddr rhs) (not (member (car (cddr rhs)) nts)))
+                (smie-set-prec2tab prec2 (car rhs) (car (cddr rhs))
+                                   '= override)))
+           (t (smie-set-prec2tab prec2 (car rhs) (cadr rhs) '= override)))
+          (setq rhs (cdr rhs)))))
+    prec2))
+
+(defun smie-prec2-levels (prec2)
+  ;; FIXME: Rather than only return an alist of precedence levels, we should
+  ;; also extract other useful data from it:
+  ;; - matching sets of block openers&closers (which can otherwise become
+  ;;   collapsed into a single equivalence class in smie-op-levels) for
+  ;;   smie-close-block as well as to detect mismatches in smie-next-sexp
+  ;;   or in blink-paren (as well as to do the blink-paren for inner
+  ;;   keywords like the "in" of "let..in..end").
+  ;; - better default indentation rules (i.e. non-zero indentation after inner
+  ;;   keywords like the "in" of "let..in..end") for smie-indent-after-keyword.
+  ;; Of course, maybe those things would be even better handled in the
+  ;; bnf->prec function.
+  "Take a 2D precedence table and turn it into an alist of precedence levels.
+PREC2 is a table as returned by `smie-precs-precedence-table' or
+`smie-bnf-precedence-table'."
+  ;; For each operator, we create two "variables" (corresponding to
+  ;; the left and right precedence level), which are represented by
+  ;; cons cells.  Those are the vary cons cells that appear in the
+  ;; final `table'.  The value of each "variable" is kept in the `car'.
+  (let ((table ())
+        (csts ())
+        (eqs ())
+        tmp x y)
+    ;; 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)
+               (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))))
+             prec2)
+    ;; First process the equality constraints.
+    (let ((eqs eqs))
+      (while eqs
+        (let ((from (caar eqs))
+              (to (cdar eqs)))
+          (setq eqs (cdr eqs))
+          (if (eq to from)
+              nil                   ;Nothing to do.
+            (dolist (other-eq eqs)
+              (if (eq from (cdr other-eq)) (setcdr other-eq to))
+              (when (eq from (car other-eq))
+                ;; This can happen because of `assoc' settings in precs
+                ;; or because of a rhs like ("op" foo "op").
+                (setcar other-eq to)))
+            (dolist (cst csts)
+              (if (eq from (cdr cst)) (setcdr cst to))
+              (if (eq from (car cst)) (setcar cst to)))))))
+    ;; Then eliminate trivial constraints iteratively.
+    (let ((i 0))
+      (while csts
+        (let ((rhvs (mapcar 'cdr csts))
+              (progress nil))
+          (dolist (cst csts)
+            (unless (memq (car cst) rhvs)
+              (setq progress t)
+              ;; We could give each var in a given iteration the same value,
+              ;; but we can also give them arbitrarily different values.
+              ;; Basically, these are vars between which there is no
+              ;; constraint (neither equality nor inequality), so
+              ;; anything will do.
+              ;; We give them arbitrary values, which means that we
+              ;; replace the "no constraint" case with either > or <
+              ;; but not =.  The reason we do that is so as to try and
+              ;; distinguish associative operators (which will have
+              ;; left = right).
+              (unless (caar cst)
+                (setcar (car cst) i)
+                (incf i))
+              (setq csts (delq cst csts))))
+          (unless progress
+            (error "Can't resolve the precedence table to precedence levels")))
+        (incf i 10))
+      ;; Propagate equalities back to their source.
+      (dolist (eq (nreverse eqs))
+        (assert (or (null (caar eq)) (eq (car eq) (cdr eq))))
+        (setcar (car eq) (cadr eq)))
+      ;; Finally, fill in the remaining vars (which only appeared on the
+      ;; right side of the < constraints).
+      (dolist (x table)
+        ;; When both sides are nil, it means this operator binds very
+        ;; very tight, but it's still just an operator, so we give it
+        ;; the highest precedence.
+        ;; OTOH if only one side is nil, it usually means it's like an
+        ;; open-paren, which is very important for indentation purposes,
+        ;; so we keep it nil, to make it easier to recognize.
+        (unless (or (nth 1 x) (nth 2 x))
+          (setf (nth 1 x) i)
+          (setf (nth 2 x) i))))
+    table))
+
+;;; Parsing using a precedence level table.
+
+(defvar smie-op-levels 'unset
+  "List of token parsing info.
+Each element is of the form (TOKEN LEFT-LEVEL RIGHT-LEVEL).
+Parsing is done using an operator precedence parser.
+LEFT-LEVEL and RIGHT-LEVEL can be either numbers or nil, where nil
+means that this operator does not bind on the corresponding side,
+i.e. a LEFT-LEVEL of nil means this is a token that behaves somewhat like
+an open-paren, whereas a RIGHT-LEVEL of nil would correspond to something
+like a close-paren.")
+
+(defvar smie-forward-token-function 'smie-default-forward-token
+  "Function to scan forward for the next token.
+Called with no argument should return a token and move to its end.
+If no token is found, return nil or the empty string.
+It can return nil when bumping into a parenthesis, which lets SMIE
+use syntax-tables to handle them in efficient C code.")
+
+(defvar smie-backward-token-function 'smie-default-backward-token
+  "Function to scan backward the previous token.
+Same calling convention as `smie-forward-token-function' except
+it should move backward to the beginning of the previous token.")
+
+(defalias 'smie-op-left 'car)
+(defalias 'smie-op-right 'cadr)
+
+(defun smie-default-backward-token ()
+  (forward-comment (- (point)))
+  (buffer-substring-no-properties
+   (point)
+   (progn (if (zerop (skip-syntax-backward "."))
+              (skip-syntax-backward "w_'"))
+          (point))))
+
+(defun smie-default-forward-token ()
+  (forward-comment (point-max))
+  (buffer-substring-no-properties
+   (point)
+   (progn (if (zerop (skip-syntax-forward "."))
+              (skip-syntax-forward "w_'"))
+          (point))))
+
+(defun smie-associative-p (toklevels)
+  ;; in "a + b + c" we want to stop at each +, but in
+  ;; "if a then b elsif c then d else c" we don't want to stop at each keyword.
+  ;; To distinguish the two cases, we made smie-prec2-levels choose
+  ;; different levels for each part of "if a then b else c", so that
+  ;; by checking if the left-level is equal to the right level, we can
+  ;; figure out that it's an associative operator.
+  ;; This is not 100% foolproof, tho, since the "elsif" will have to have
+  ;; equal left and right levels (since it's optional), so smie-next-sexp
+  ;; has to be careful to distinguish those different cases.
+  (eq (smie-op-left toklevels) (smie-op-right toklevels)))
+
+(defun smie-next-sexp (next-token next-sexp op-forw op-back halfsexp)
+  "Skip over one sexp.
+NEXT-TOKEN is a function of no argument that moves forward by one
+token (after skipping comments if needed) and returns it.
+NEXT-SEXP is a lower-level function to skip one sexp.
+OP-FORW is the accessor to the forward level of the level data.
+OP-BACK is the accessor to the backward level of the level data.
+HALFSEXP if non-nil, means skip over a partial sexp if needed.  I.e. if the
+first token we see is an operator, skip over its left-hand-side argument.
+Possible return values:
+  (FORW-LEVEL POS TOKEN): we couldn't skip TOKEN because its back-level
+    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.
+  (nil POS TOKEN): we skipped over a paren-like pair.
+  nil: we skipped over an identifier, matched parentheses, ..."
+  (catch 'return
+    (let ((levels ()))
+      (while
+          (let* ((pos (point))
+                 (token (funcall next-token))
+                 (toklevels (cdr (assoc token smie-op-levels))))
+            (cond
+             ((null toklevels)
+              (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)))))))
+                (if (eq pos (point))
+                    ;; We did not move, so let's abort the loop.
+                    (throw 'return (list t (point))))))
+             ((null (funcall op-back toklevels))
+              ;; A token like a paren-close.
+              (assert (funcall op-forw toklevels)) ;Otherwise, why mention it?
+              (push toklevels levels))
+             (t
+              (while (and levels (< (funcall op-back toklevels)
+                                    (funcall op-forw (car levels))))
+                (setq levels (cdr levels)))
+              (cond
+               ((null levels)
+                (if (and halfsexp (funcall op-forw toklevels))
+                    (push toklevels levels)
+                  (throw 'return
+                         (prog1 (list (or (car toklevels) t) (point) token)
+                           (goto-char pos)))))
+               (t
+                (let ((lastlevels levels))
+                  (if (and levels (= (funcall op-back toklevels)
+                                     (funcall op-forw (car levels))))
+                      (setq levels (cdr levels)))
+                  ;; We may have found a match for the previously pending
+                  ;; operator.  Is this the end?
+                  (cond
+                   ;; Keep looking as long as we haven't matched the
+                   ;; topmost operator.
+                   (levels
+                    (if (funcall op-forw toklevels)
+                        (push toklevels levels)))
+                   ;; We matched the topmost operator.  If the new operator
+                   ;; is the last in the corresponding BNF rule, we're done.
+                   ((null (funcall op-forw toklevels))
+                    ;; It is the last element, let's stop here.
+                    (throw 'return (list nil (point) token)))
+                   ;; If the new operator is not the last in the BNF rule,
+                   ;; ans is not associative, it's one of the inner operators
+                   ;; (like the "in" in "let .. in .. end"), so keep looking.
+                   ((not (smie-associative-p toklevels))
+                    (push toklevels levels))
+                   ;; The new operator is associative.  Two cases:
+                   ;; - it's really just an associative operator (like + or ;)
+                   ;;   in which case we should have stopped right before.
+                   ((and lastlevels
+                         (smie-associative-p (car lastlevels)))
+                    (throw 'return
+                           (prog1 (list (or (car 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
+                   ;;   looking for the closing element.
+                   (t (setq levels lastlevels))))))))
+            levels)
+        (setq halfsexp nil)))))
+
+(defun smie-backward-sexp (&optional halfsexp)
+  "Skip over one sexp.
+HALFSEXP if non-nil, means skip over a partial sexp if needed.  I.e. if the
+first token we see is an operator, skip over its left-hand-side argument.
+Possible return values:
+  (LEFT-LEVEL POS TOKEN): we couldn't skip TOKEN because its right-level
+    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.
+  (nil POS TOKEN): we skipped over a paren-like pair.
+  nil: we skipped over an identifier, matched parentheses, ..."
+  (smie-next-sexp
+   (indirect-function smie-backward-token-function)
+   (indirect-function 'backward-sexp)
+   (indirect-function 'smie-op-left)
+   (indirect-function 'smie-op-right)
+   halfsexp))
+
+(defun smie-forward-sexp (&optional halfsexp)
+  "Skip over one sexp.
+HALFSEXP if non-nil, means skip over a partial sexp if needed.  I.e. if the
+first token we see is an operator, skip over its left-hand-side argument.
+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.
+  (nil POS TOKEN): we skipped over a paren-like pair.
+  nil: we skipped over an identifier, matched parentheses, ..."
+  (smie-next-sexp
+   (indirect-function smie-forward-token-function)
+   (indirect-function 'forward-sexp)
+   (indirect-function 'smie-op-right)
+   (indirect-function 'smie-op-left)
+   halfsexp))
+
+;;; Miscellanous commands using the precedence parser.
+
+(defun smie-backward-sexp-command (&optional n)
+  "Move backward through N logical elements."
+  (interactive "^p")
+  (smie-forward-sexp-command (- n)))
+
+(defun smie-forward-sexp-command (&optional n)
+  "Move forward through N logical elements."
+  (interactive "^p")
+  (let ((forw (> n 0))
+        (forward-sexp-function nil))
+    (while (/= n 0)
+      (setq n (- n (if forw 1 -1)))
+      (let ((pos (point))
+            (res (if forw
+                     (smie-forward-sexp 'halfsexp)
+                   (smie-backward-sexp 'halfsexp))))
+        (if (and (car res) (= pos (point)) (not (if forw (eobp) (bobp))))
+            (signal 'scan-error
+                    (list "Containing expression ends prematurely"
+                          (cadr res) (cadr res)))
+          nil)))))
+
+(defvar smie-closer-alist nil
+  "Alist giving the closer corresponding to an opener.")
+
+(defun smie-close-block ()
+  "Close the closest surrounding block."
+  (interactive)
+  (let ((closer
+         (save-excursion
+           (backward-up-list 1)
+           (if (looking-at "\\s(")
+               (string (cdr (syntax-after (point))))
+             (let* ((open (funcall smie-forward-token-function))
+                    (closer (cdr (assoc open smie-closer-alist)))
+                    (levels (list (assoc open smie-op-levels)))
+                    (seen '())
+                    (found '()))
+               (cond
+                ;; Even if we improve the auto-computation of closers,
+                ;; there are still cases where we need manual
+                ;; intervention, e.g. for Octave's use of `until'
+                ;; as a pseudo-closer of `do'.
+                (closer)
+                ((or (equal levels '(nil)) (nth 1 (car levels)))
+                 (error "Doesn't look like a block"))
+                (t
+                 ;; FIXME: With grammars like Octave's, every closer ("end",
+                 ;; "endif", "endwhile", ...) has the same level, so we'd need
+                 ;; to look at the BNF or at least at the 2D prec-table, in
+                 ;; order to find the right closer for a given opener.
+                 (while levels
+                   (let ((level (pop levels)))
+                     (dolist (other smie-op-levels)
+                       (when (and (eq (nth 2 level) (nth 1 other))
+                                  (not (memq other seen)))
+                         (push other seen)
+                         (if (nth 2 other)
+                             (push other levels)
+                           (push (car other) found))))))
+                 (cond
+                  ((null found) (error "No known closer for opener %s" open))
+                  ;; FIXME: what should we do if there are various closers?
+                  (t (car found))))))))))
+    (unless (save-excursion (skip-chars-backward " \t") (bolp))
+      (newline))
+    (insert closer)
+    (if (save-excursion (skip-chars-forward " \t") (eolp))
+        (indent-according-to-mode)
+      (reindent-then-newline-and-indent))))
+
+(defun smie-down-list (&optional arg)
+  "Move forward down one level paren-like blocks.  Like `down-list'.
+With argument ARG, do this that many times.
+A negative argument means move backward but still go down a level.
+This command assumes point is not in a string or comment."
+  (interactive "p")
+  (let ((start (point))
+        (inc (if (< arg 0) -1 1))
+        (offset (if (< arg 0) 1 0))
+        (next-token (if (< arg 0)
+                        smie-backward-token-function
+                      smie-forward-token-function)))
+    (while (/= arg 0)
+      (setq arg (- arg inc))
+      (while
+          (let* ((pos (point))
+                 (token (funcall next-token))
+                 (levels (assoc token smie-op-levels)))
+            (cond
+             ((zerop (length token))
+              (if (if (< inc 0) (looking-back "\\s(\\|\\s)" (1- (point)))
+                    (looking-at "\\s(\\|\\s)"))
+                  ;; Go back to `start' in case of an error.  This presumes
+                  ;; none of the token we've found until now include a ( or ).
+                  (progn (goto-char start) (down-list inc) nil)
+                (forward-sexp inc)
+                (/= (point) pos)))
+             ((and levels (null (nth (+ 1 offset) levels))) nil)
+             ((and levels (null (nth (- 2 offset) levels)))
+              (let ((end (point)))
+                (goto-char start)
+                (signal 'scan-error
+                        (list "Containing expression ends prematurely"
+                              pos end))))
+             (t)))))))
+
+;;; The indentation engine.
+
+(defcustom smie-indent-basic 4
+  "Basic amount of indentation."
+  :type 'integer)
+
+(defvar smie-indent-rules 'unset
+  ;; TODO: For SML, we need more rule formats, so as to handle
+  ;;   structure Foo =
+  ;;      Bar (toto)
+  ;; and
+  ;;   structure Foo =
+  ;;   struct ... end
+  ;; I.e. the indentation after "=" depends on the parent ("structure")
+  ;; as well as on the following token ("struct").
+  "Rules of the following form.
+\((:before . TOK) . OFFSET-RULES)      how to indent TOK itself.
+\(TOK . OFFSET-RULES)  how to indent right after TOK.
+\(list-intro . TOKENS) declare TOKENS as being followed by what may look like
+                         a funcall but is just a sequence of expressions.
+\(t . OFFSET)          basic indentation step.
+\(args . OFFSET)               indentation of arguments.
+\((T1 . T2) OFFSET)    like ((:before . T2) (:parent T1 OFFSET)).
+
+OFFSET-RULES is a list of elements which can each either be:
+
+\(:hanging . OFFSET-RULES)     if TOK is hanging, use OFFSET-RULES.
+\(:parent PARENT . OFFSET-RULES) if TOK's parent is PARENT, use OFFSET-RULES.
+\(:next TOKEN . OFFSET-RULES)  if TOK is followed by TOKEN, use OFFSET-RULES.
+\(:prev TOKEN . OFFSET-RULES)  if TOK is preceded by TOKEN, use
+\(:bolp . OFFSET-RULES)                If TOK is first on a line, use OFFSET-RULES.
+OFFSET                         the offset to use.
+
+PARENT can be either the name of the parent or a list of such names.
+
+OFFSET can be of the form:
+`point'                                align with the token.
+`parent'                               align with the parent.
+NUMBER                         offset by NUMBER.
+\(+ OFFSETS...)                        use the sum of OFFSETS.
+VARIABLE                       use the value of VARIABLE as offset.
+
+The precise meaning of `point' depends on various details: it can
+either mean the position of the token we're indenting, or the
+position of its parent, or the position right after its parent.
+
+A nil offset for indentation after an opening token defaults
+to `smie-indent-basic'.")
+
+(defun smie-indent-hanging-p ()
+  ;; A hanging keyword is one that's at the end of a line except it's not at
+  ;; the beginning of a line.
+  (and (save-excursion
+         (when (zerop (length (funcall smie-forward-token-function)))
+           ;; Could be an open-paren.
+           (forward-char 1))
+         (skip-chars-forward " \t")
+         (eolp))
+       (not (smie-bolp))))
+
+(defun smie-bolp ()
+  (save-excursion (skip-chars-backward " \t") (bolp)))
+
+(defun smie-indent-offset (elem)
+  (or (cdr (assq elem smie-indent-rules))
+      (cdr (assq t smie-indent-rules))
+      smie-indent-basic))
+
+(defvar smie-indent-debug-log)
+
+(defun smie-indent-offset-rule (tokinfo &optional after parent)
+  "Apply the OFFSET-RULES in TOKINFO.
+Point is expected to be right in front of the token corresponding to TOKINFO.
+If computing the indentation after the token, then AFTER is the position
+after the token, otherwise it should be nil.
+PARENT if non-nil should be the parent info returned by `smie-backward-sexp'."
+  (let ((rules (cdr tokinfo))
+        next prev
+        offset)
+    (while (consp rules)
+      (let ((rule (pop rules)))
+        (cond
+         ((not (consp rule)) (setq offset rule))
+         ((eq (car rule) '+) (setq offset rule))
+         ((eq (car rule) :hanging)
+          (when (smie-indent-hanging-p)
+            (setq rules (cdr rule))))
+         ((eq (car rule) :bolp)
+          (when (smie-bolp)
+            (setq rules (cdr rule))))
+         ((eq (car rule) :eolp)
+          (unless after
+            (error "Can't use :eolp in :before indentation rules"))
+          (when (> after (line-end-position))
+            (setq rules (cdr rule))))
+         ((eq (car rule) :prev)
+          (unless prev
+            (save-excursion
+              (setq prev (smie-indent-backward-token))))
+          (when (equal (car prev) (cadr rule))
+            (setq rules (cddr rule))))
+         ((eq (car rule) :next)
+          (unless next
+            (unless after
+              (error "Can't use :next in :before indentation rules"))
+            (save-excursion
+              (goto-char after)
+              (setq next (smie-indent-forward-token))))
+          (when (equal (car next) (cadr rule))
+            (setq rules (cddr rule))))
+         ((eq (car rule) :parent)
+          (unless parent
+            (save-excursion
+              (if after (goto-char after))
+              (setq parent (smie-backward-sexp 'halfsexp))))
+          (when (if (listp (cadr rule))
+                    (member (nth 2 parent) (cadr rule))
+                  (equal (nth 2 parent) (cadr rule)))
+            (setq rules (cddr rule))))
+         (t (error "Unknown rule %s for indentation of %s"
+                   rule (car tokinfo))))))
+    ;; If `offset' is not set yet, use `rules' to handle the case where
+    ;; the tokinfo uses the old-style ((PARENT . TOK). OFFSET).
+    (unless offset (setq offset rules))
+    (when (boundp 'smie-indent-debug-log)
+      (push (list (point) offset tokinfo) smie-indent-debug-log))
+    offset))
+
+(defun smie-indent-column (offset &optional base parent virtual-point)
+  "Compute the actual column to use for a given OFFSET.
+BASE is the base position to use, and PARENT is the parent info, if any.
+If VIRTUAL-POINT is non-nil, then `point' is virtual."
+  (cond
+   ((eq (car-safe offset) '+)
+    (apply '+ (mapcar (lambda (offset) (smie-indent-column offset nil parent))
+                      (cdr offset))))
+   ((integerp offset)
+    (+ offset
+       (case base
+         ((nil) 0)
+         (parent (goto-char (cadr parent))
+                 (smie-indent-virtual))
+         (t
+          (goto-char base)
+          ;; For indentation after "(let" in SML-mode, we end up accumulating
+          ;; the offset of "(" and the offset of "let", so we use `min' to try
+          ;; and get it right either way.
+          (min (smie-indent-virtual) (current-column))))))
+   ((eq offset 'point)
+    ;; In indent-keyword, if we're indenting `then' wrt `if', we want to use
+    ;; indent-virtual rather than use just current-column, so that we can
+    ;; apply the (:before . "if") rule which does the "else if" dance in SML.
+    ;; But in other cases, we do not want to use indent-virtual
+    ;; (e.g. indentation of "*" w.r.t "+", or ";" wrt "(").  We could just
+    ;; always use indent-virtual and then have indent-rules say explicitly
+    ;; to use `point' after things like "(" or "+" when they're not at EOL,
+    ;; but you'd end up with lots of those rules.
+    ;; So we use a heuristic here, which is that we only use virtual if
+    ;; the parent is tightly linked to the child token (they're part of
+    ;; the same BNF rule).
+    (if (and virtual-point (null (car parent))) ;Black magic :-(
+        (smie-indent-virtual) (current-column)))
+   ((eq offset 'parent)
+    (unless parent
+      (setq parent (or (smie-backward-sexp 'halfsexp) :notfound)))
+    (if (consp parent) (goto-char (cadr parent)))
+    (smie-indent-virtual))
+   ((eq offset nil) nil)
+   ((and (symbolp offset) (boundp 'offset))
+    (smie-indent-column (symbol-value offset) base parent virtual-point))
+   (t (error "Unknown indentation offset %s" offset))))
+
+(defun smie-indent-forward-token ()
+  "Skip token forward and return it, along with its levels."
+  (let ((tok (funcall smie-forward-token-function)))
+    (cond
+     ((< 0 (length tok)) (assoc tok smie-op-levels))
+     ((looking-at "\\s(")
+      (forward-char 1)
+      (list (buffer-substring (1- (point)) (point)) nil 0)))))
+
+(defun smie-indent-backward-token ()
+  "Skip token backward and return it, along with its levels."
+  (let ((tok (funcall smie-backward-token-function)))
+    (cond
+     ((< 0 (length tok)) (assoc tok smie-op-levels))
+     ;; 4 == Open paren syntax.
+     ((eq 4 (syntax-class (syntax-after (1- (point)))))
+      (forward-char -1)
+      (list (buffer-substring (point) (1+ (point))) nil 0)))))
+
+(defun smie-indent-virtual ()
+  ;; We used to take an optional arg (with value :not-hanging) to specify that
+  ;; we should only use (smie-indent-calculate) if we're looking at a hanging
+  ;; keyword.  This was a bad idea, because the virtual indent of a position
+  ;; should not depend on the caller, since it leads to situations where two
+  ;; dependent indentations get indented differently.
+  "Compute the virtual indentation to use for point.
+This is used when we're not trying to indent point but just
+need to compute the column at which point should be indented
+in order to figure out the indentation of some other (further down) point."
+  ;; Trust pre-existing indentation on other lines.
+  (if (smie-bolp) (current-column) (smie-indent-calculate)))
+
+(defun smie-indent-fixindent ()
+  ;; Obey the `fixindent' special comment.
+  (and (smie-bolp)
+       (save-excursion
+         (comment-normalize-vars)
+         (re-search-forward (concat comment-start-skip
+                                    "fixindent"
+                                    comment-end-skip)
+                            ;; 1+ to account for the \n comment termination.
+                            (1+ (line-end-position)) t))
+       (current-column)))
+
+(defun smie-indent-bob ()
+  ;; Start the file at column 0.
+  (save-excursion
+    (forward-comment (- (point)))
+    (if (bobp) 0)))
+
+(defun smie-indent-close ()
+  ;; Align close paren with opening paren.
+  (save-excursion
+    ;; (forward-comment (point-max))
+    (when (looking-at "\\s)")
+      (while (not (zerop (skip-syntax-forward ")")))
+        (skip-chars-forward " \t"))
+      (condition-case nil
+          (progn
+            (backward-sexp 1)
+            (smie-indent-virtual))      ;:not-hanging
+        (scan-error nil)))))
+
+(defun smie-indent-keyword ()
+  ;; Align closing token with the corresponding opening one.
+  ;; (e.g. "of" with "case", or "in" with "let").
+  (save-excursion
+    (let* ((pos (point))
+           (toklevels (smie-indent-forward-token))
+           (token (pop toklevels)))
+      (if (null (car toklevels))
+          (save-excursion
+            (goto-char pos)
+            ;; Different cases:
+            ;; - smie-bolp: "indent according to others".
+            ;; - common hanging: "indent according to others".
+            ;; - SML-let hanging: "indent like parent".
+            ;; - if-after-else: "indent-like parent".
+            ;; - middle-of-line: "trust current position".
+            (cond
+             ((null (cdr toklevels)) nil) ;Not a keyword.
+             ((smie-bolp)
+              ;; For an open-paren-like thingy at BOL, always indent only
+              ;; based on other rules (typically smie-indent-after-keyword).
+              nil)
+             (t
+              ;; We're only ever here for virtual-indent, which is why
+              ;; we can use (current-column) as answer for `point'.
+              (let* ((tokinfo (or (assoc (cons :before token)
+                                         smie-indent-rules)
+                                  ;; By default use point unless we're hanging.
+                                  `((:before . ,token) (:hanging nil) point)))
+                     ;; (after (prog1 (point) (goto-char pos)))
+                     (offset (smie-indent-offset-rule tokinfo)))
+                (smie-indent-column offset)))))
+
+        ;; FIXME: This still looks too much like black magic!!
+        ;; FIXME: Rather than a bunch of rules like (PARENT . TOKEN), we
+        ;; want a single rule for TOKEN with different cases for each PARENT.
+        (let* ((parent (smie-backward-sexp 'halfsexp))
+               (tokinfo
+                (or (assoc (cons (caddr parent) token)
+                           smie-indent-rules)
+                    (assoc (cons :before token) smie-indent-rules)
+                    ;; Default rule.
+                    `((:before . ,token)
+                      ;; (:parent open 0)
+                      point)))
+               (offset (save-excursion
+                         (goto-char pos)
+                         (smie-indent-offset-rule tokinfo nil parent))))
+          ;; Different behaviors:
+          ;; - align with parent.
+          ;; - parent + offset.
+          ;; - after parent's column + offset (actually, after or before
+          ;;   depending on where backward-sexp stopped).
+          ;; ? let it drop to some other indentation function (almost never).
+          ;; ? parent + offset + parent's own offset.
+          ;; Different cases:
+          ;; - bump into a same-level operator.
+          ;; - bump into a specific known parent.
+          ;; - find a matching open-paren thingy.
+          ;; - bump into some random parent.
+          ;; ? borderline case (almost never).
+          ;; ? bump immediately into a parent.
+          (cond
+           ((not (or (< (point) pos)
+                     (and (cadr parent) (< (cadr parent) pos))))
+            ;; If we didn't move at all, that means we didn't really skip
+            ;; what we wanted.  Should almost never happen, other than
+            ;; maybe when an infix or close-paren is at the beginning
+            ;; of a buffer.
+            nil)
+           ((eq (car parent) (car toklevels))
+            ;; We bumped into a same-level operator. align with it.
+            (if (and (smie-bolp) (/= (point) pos)
+                     (save-excursion
+                       (goto-char (goto-char (cadr parent)))
+                       (not (smie-bolp)))
+                     ;; Check the offset of `token' rather then its parent
+                     ;; because its parent may have used a special rule.  E.g.
+                     ;;    function foo;
+                     ;;      line2;
+                     ;;      line3;
+                     ;; The ; on the first line had a special rule, but when
+                     ;; indenting line3, we don't care about it and want to
+                     ;; align with line2.
+                     (memq offset '(point nil)))
+                ;; If the parent is at EOL and its children are indented like
+                ;; itself, then we can just obey the indentation chosen for the
+                ;; child.
+                ;; This is important for operators like ";" which
+                ;; are usually at EOL (and have an offset of 0): otherwise we'd
+                ;; always go back over all the statements, which is
+                ;; a performance problem and would also mean that fixindents
+                ;; in the middle of such a sequence would be ignored.
+                ;;
+                ;; This is a delicate point!
+                ;; Even if the offset is not 0, we could follow the same logic
+                ;; and subtract the offset from the child's indentation.
+                ;; But that would more often be a bad idea: OT1H we generally
+                ;; want to reuse the closest similar indentation point, so that
+                ;; the user's choice (or the fixindents) are obeyed.  But OTOH
+                ;; we don't want this to affect "unrelated" parts of the code.
+                ;; E.g. a fixindent in the body of a "begin..end" should not
+                ;; affect the indentation of the "end".
+                (current-column)
+              (goto-char (cadr parent))
+              ;; Don't use (smie-indent-virtual :not-hanging) here, because we
+              ;; want to jump back over a sequence of same-level ops such as
+              ;;    a -> b -> c
+              ;;    -> d
+              ;; So as to align with the earliest appropriate place.
+              (smie-indent-virtual)))
+           (tokinfo
+            (if (and (= (point) pos) (smie-bolp)
+                     (or (eq offset 'point)
+                         (and (consp offset) (memq 'point offset))))
+                ;; Since we started at BOL, we're not computing a virtual
+                ;; indentation, and we're still at the starting point, so
+                ;; we can't use `current-column' which would cause
+                ;; indentation to depend on itself.
+                nil
+              (smie-indent-column offset 'parent parent
+                                  ;; If we're still at pos, indent-virtual
+                                  ;; will inf-loop.
+                                  (unless (= (point) pos) 'virtual))))))))))
+
+(defun smie-indent-comment ()
+  "Compute indentation of a comment."
+  ;; Don't do it for virtual indentations.  We should normally never be "in
+  ;; front of a comment" when doing virtual-indentation anyway.  And if we are
+  ;; (as can happen in octave-mode), moving forward can lead to inf-loops.
+  (and (smie-bolp)
+       (looking-at comment-start-skip)
+       (save-excursion
+         (forward-comment (point-max))
+         (skip-chars-forward " \t\r\n")
+         (smie-indent-calculate))))
+
+(defun smie-indent-comment-continue ()
+  ;; indentation of comment-continue lines.
+  (let ((continue (and comment-continue
+                       (comment-string-strip comment-continue t t))))
+    (and (< 0 (length continue))
+         (looking-at (regexp-quote continue)) (nth 4 (syntax-ppss))
+         (let ((ppss (syntax-ppss)))
+           (save-excursion
+             (forward-line -1)
+             (if (<= (point) (nth 8 ppss))
+                 (progn (goto-char (1+ (nth 8 ppss))) (current-column))
+               (skip-chars-forward " \t")
+               (if (looking-at (regexp-quote continue))
+                   (current-column))))))))
+
+(defun smie-indent-after-keyword ()
+  ;; Indentation right after a special keyword.
+  (save-excursion
+    (let* ((pos (point))
+           (toklevel (smie-indent-backward-token))
+           (tok (car toklevel))
+           (tokinfo (assoc tok smie-indent-rules)))
+      ;; Set some default indent rules.
+      (if (and toklevel (null (cadr toklevel)) (null tokinfo))
+          (setq tokinfo (list (car toklevel))))
+      ;; (if (and tokinfo (null toklevel))
+      ;;     (error "Token %S has indent rule but has no parsing info" tok))
+      (when toklevel
+        (unless tokinfo
+          ;; The default indentation after a keyword/operator is 0 for
+          ;; infix and t for prefix.
+          ;; Using the BNF syntax, we could come up with better
+          ;; defaults, but we only have the precedence levels here.
+          (setq tokinfo (list tok 'default-rule
+                              (if (cadr toklevel) 0 (smie-indent-offset t)))))
+        (let ((offset
+               (or (smie-indent-offset-rule tokinfo pos)
+                   (smie-indent-offset t))))
+          (let ((before (point)))
+            (goto-char pos)
+            (smie-indent-column offset before)))))))
+
+(defun smie-indent-exps ()
+  ;; Indentation of sequences of simple expressions without
+  ;; intervening keywords or operators.  E.g. "a b c" or "g (balbla) f".
+  ;; Can be a list of expressions or a function call.
+  ;; If it's a function call, the first element is special (it's the
+  ;; function).  We distinguish function calls from mere lists of
+  ;; expressions based on whether the preceding token is listed in
+  ;; the `list-intro' entry of smie-indent-rules.
+  ;;
+  ;; TODO: to indent Lisp code, we should add a way to specify
+  ;; particular indentation for particular args depending on the
+  ;; function (which would require always skipping back until the
+  ;; function).
+  ;; TODO: to indent C code, such as "if (...) {...}" we might need
+  ;; to add similar indentation hooks for particular positions, but
+  ;; based on the preceding token rather than based on the first exp.
+  (save-excursion
+    (let ((positions nil)
+          arg)
+      (while (and (null (car (smie-backward-sexp)))
+                  (push (point) positions)
+                  (not (smie-bolp))))
+      (save-excursion
+        ;; Figure out if the atom we just skipped is an argument rather
+        ;; than a function.
+        (setq arg (or (null (car (smie-backward-sexp)))
+                      (member (funcall smie-backward-token-function)
+                              (cdr (assoc 'list-intro smie-indent-rules))))))
+      (cond
+       ((null positions)
+        ;; We're the first expression of the list.  In that case, the
+        ;; indentation should be (have been) determined by its context.
+        nil)
+       (arg
+        ;; There's a previous element, and it's not special (it's not
+        ;; the function), so let's just align with that one.
+        (goto-char (car positions))
+        (current-column))
+       ((cdr positions)
+        ;; We skipped some args plus the function and bumped into something.
+        ;; Align with the first arg.
+        (goto-char (cadr positions))
+        (current-column))
+       (positions
+        ;; We're the first arg.
+        (goto-char (car positions))
+        ;; FIXME: Use smie-indent-column.
+        (+ (smie-indent-offset 'args)
+           ;; We used to use (smie-indent-virtual), but that
+           ;; doesn't seem right since it might then indent args less than
+           ;; the function itself.
+           (current-column)))))))
+
+(defvar smie-indent-functions
+  '(smie-indent-fixindent smie-indent-bob smie-indent-close smie-indent-comment
+   smie-indent-comment-continue smie-indent-keyword smie-indent-after-keyword
+   smie-indent-exps)
+  "Functions to compute the indentation.
+Each function is called with no argument, shouldn't move point, and should
+return either nil if it has no opinion, or an integer representing the column
+to which that point should be aligned, if we were to reindent it.")
+
+(defun smie-indent-calculate ()
+  "Compute the indentation to use for point."
+  (run-hook-with-args-until-success 'smie-indent-functions))
+
+(defun smie-indent-line ()
+  "Indent current line using the SMIE indentation engine."
+  (interactive)
+  (let* ((savep (point))
+        (indent (condition-case-no-debug nil
+                    (save-excursion
+                       (forward-line 0)
+                       (skip-chars-forward " \t")
+                       (if (>= (point) savep) (setq savep nil))
+                       (or (smie-indent-calculate) 0))
+                   (error 0))))
+    (if (not (numberp indent))
+        ;; If something funny is used (e.g. `noindent'), return it.
+        indent
+      (if (< indent 0) (setq indent 0)) ;Just in case.
+      (if savep
+          (save-excursion (indent-line-to indent))
+        (indent-line-to indent)))))
+
+(defun smie-indent-debug ()
+  "Show the rules used to compute indentation of current line."
+  (interactive)
+  (let ((smie-indent-debug-log '()))
+    (smie-indent-calculate)
+    ;; FIXME: please improve!
+    (message "%S" smie-indent-debug-log)))
+
+(defun smie-setup (op-levels indent-rules)
+  (set (make-local-variable 'smie-indent-rules) indent-rules)
+  (set (make-local-variable 'smie-op-levels) op-levels)
+  (set (make-local-variable 'indent-line-function) 'smie-indent-line))
+
+
+(provide 'smie)
+;;; smie.el ends here
index cf5e79d2a262054613af1d525cfdef6509a3039d..8df70f4d979a67102de870f9d3a0241b584f3e49 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Jonathan Yavner <jyavner@engineer.com>
 ;; Maintainer: Jonathan Yavner <jyavner@engineer.com>
 ;; Keywords: spreadsheet lisp utility
+;; Package: testcover
 
 ;; 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
index b300ee6dceffde7943e1a62f265a1a0bd7129899..47f931bf9d3ed5343f2facc893f3b6e758a95b57 100644 (file)
@@ -5,6 +5,7 @@
 ;; Author: Jonathan Yavner <jyavner@engineer.com>
 ;; Maintainer: Jonathan Yavner <jyavner@engineer.com>
 ;; Keywords: safety lisp utility
+;; Package: testcover
 
 ;; This file is part of GNU Emacs.
 
index f3b8ddcd123b919795b89468a2aae402c8f3ce18..6ae6a86857ea3615a49bd3629700f4308b8e3756 100644 (file)
@@ -4,6 +4,7 @@
 ;;   2009, 2010  Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
@@ -321,7 +322,11 @@ This function is called, by name, directly by the C code."
          ;; We do this after rescheduling so that the handler function
          ;; can cancel its own timer successfully with cancel-timer.
          (condition-case nil
-             (apply (timer--function timer) (timer--args timer))
+              ;; Timer functions should not change the current buffer.
+              ;; If they do, all kinds of nasty surprises can happen,
+              ;; and it can be hellish to track down their source.
+              (save-current-buffer
+                (apply (timer--function timer) (timer--args timer)))
            (error nil))
          (if retrigger
              (setf (timer--triggered timer) nil)))
@@ -438,8 +443,6 @@ This function returns a timer object which you can use in `cancel-timer'."
   "This is the timer function used for the timer made by `with-timeout'."
   (throw tag 'timeout))
 
-(put 'with-timeout 'lisp-indent-function 1)
-
 (defvar with-timeout-timers nil
   "List of all timers used by currently pending `with-timeout' calls.")
 
@@ -451,6 +454,7 @@ event (such as keyboard input, input from subprocesses, or a certain time);
 if the program loops without waiting in any way, the timeout will not
 be detected.
 \n(fn (SECONDS TIMEOUT-FORMS...) BODY)"
+  (declare (indent 1))
   (let ((seconds (car list))
        (timeout-forms (cdr list)))
     `(let ((with-timeout-tag (cons nil nil))
index 11cee8197a467ea977e70040b111c824abe94a78..f6749cd9e97cc05308f6c9b0747bc99b63bbfa1b 100644 (file)
@@ -780,6 +780,10 @@ Repeating prefix key when region is active works as a single prefix key."
     (setq mark-active nil)
     (run-hooks 'deactivate-mark-hook)))
 
+(defun cua--filter-buffer-noprops (start end)
+  (let ((str (filter-buffer-substring start end)))
+    (set-text-properties 0 (length str) nil str)
+    str))
 
 ;; The current register prefix
 (defvar cua--register nil)
@@ -1039,8 +1043,7 @@ of text."
                    (setq s (car u))
                  (setq s (car u) e (cdr u)))))))
          (cond ((and s e (<= s e) (= s (mark t)))
-                (setq cua--repeat-replace-text
-                      (filter-buffer-substring s e nil t)))
+                (setq cua--repeat-replace-text (cua--filter-buffer-noprops s e)))
                ((and (null s) (eq u elt)) ;; nothing inserted
                 (setq cua--repeat-replace-text
                       ""))
@@ -1440,6 +1443,8 @@ If ARG is the atom `-', scroll upward by nearly full screen."
   ;; scrolling
   (define-key cua-global-keymap [remap scroll-up]      'cua-scroll-up)
   (define-key cua-global-keymap [remap scroll-down]    'cua-scroll-down)
+  (define-key cua-global-keymap [remap scroll-up-command]   'cua-scroll-up)
+  (define-key cua-global-keymap [remap scroll-down-command] 'cua-scroll-down)
 
   (define-key cua--cua-keys-keymap [(control x) timeout] 'kill-region)
   (define-key cua--cua-keys-keymap [(control c) timeout] 'copy-region-as-kill)
@@ -1492,6 +1497,8 @@ If ARG is the atom `-', scroll upward by nearly full screen."
 
 (dolist (cmd
  '(forward-char backward-char
+   right-char left-char
+   right-word left-word
    next-line previous-line
    forward-word backward-word
    end-of-line beginning-of-line
@@ -1499,6 +1506,7 @@ If ARG is the atom `-', scroll upward by nearly full screen."
    move-end-of-line move-beginning-of-line
    end-of-buffer beginning-of-buffer
    scroll-up scroll-down
+   scroll-up-command scroll-down-command
    up-list down-list backward-up-list
    end-of-defun beginning-of-defun
    forward-sexp backward-sexp
index 6cb8bfe6e1cd29c2df50ede6fdc4e532b3a84497..761a3d5ec24ed9ed2ff71ebf1e81cdb81447da76 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Author: Kim F. Storm <storm@cua.dk>
 ;; Keywords: keyboard emulations convenience cua mark
+;; Package: cua-base
 
 ;; This file is part of GNU Emacs.
 
@@ -137,7 +138,7 @@ With prefix argument, don't jump to global mark when cancelling it."
       (let ((src-buf (current-buffer)))
        (save-excursion
          (if (equal (marker-buffer cua--global-mark-marker) src-buf)
-             (let ((text (filter-buffer-substring start end nil t)))
+             (let ((text (cua--filter-buffer-noprops start end)))
                (goto-char (marker-position cua--global-mark-marker))
                (insert text))
            (set-buffer (marker-buffer cua--global-mark-marker))
@@ -161,7 +162,7 @@ With prefix argument, don't jump to global mark when cancelling it."
              (if (and (< start (marker-position cua--global-mark-marker))
                       (< (marker-position cua--global-mark-marker) end))
                  (message "Can't move region into itself")
-               (let ((text (filter-buffer-substring start end nil t))
+               (let ((text (cua--filter-buffer-noprops start end))
                      (p1 (copy-marker start))
                      (p2 (copy-marker end)))
                  (goto-char (marker-position cua--global-mark-marker))
index a59e0f24c7f831a2965c126ba811b82fb00eacfa..2cbf44388692b4514b934d32af3ff96bb1246501 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Author: Kim F. Storm <storm@cua.dk>
 ;; Keywords: keyboard emulations convenience CUA
+;; Package: cua-base
 
 ;; This file is part of GNU Emacs.
 
@@ -625,7 +626,7 @@ If command is repeated at same position, delete the rectangle."
     (if (not (cua--rectangle-virtual-edges))
        (cua--rectangle-operation nil nil nil nil nil ; do not tabify
          '(lambda (s e l r)
-            (setq rect (cons (filter-buffer-substring s e nil t) rect))))
+            (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)
           (let ((copy t) (bs 0) (as 0) row)
@@ -643,7 +644,7 @@ If command is repeated at same position, delete the rectangle."
               (setq as (- r (max (current-column) l))
                     e (point)))
                     (setq row (if (and copy (> e s))
-                          (filter-buffer-substring s e nil t)
+                          (cua--filter-buffer-noprops s e)
                         ""))
             (when (> bs 0)
               (setq row (concat (make-string bs ?\s) row)))
@@ -1124,12 +1125,12 @@ The length of STRING need not be the same as the rectangle width."
      '(lambda (s e l r)
         (cond
          ((re-search-forward "0x\\([0-9a-fA-F]+\\)" e t)
-          (let* ((txt (filter-buffer-substring (match-beginning 1) (match-end 1) nil t))
+          (let* ((txt (cua--filter-buffer-noprops (match-beginning 1) (match-end 1)))
                  (n (string-to-number txt 16))
                  (fmt (format "0x%%0%dx" (length txt))))
             (replace-match (format fmt (+ n increment)))))
          ((re-search-forward "\\( *-?[0-9]+\\)" e t)
-          (let* ((txt (filter-buffer-substring (match-beginning 1) (match-end 1) nil t))
+          (let* ((txt (cua--filter-buffer-noprops (match-beginning 1) (match-end 1)))
                  (prefix (if (= (aref txt 0) ?0) "0" ""))
                  (n (string-to-number txt 10))
                  (fmt (format "%%%s%dd" prefix (length txt))))
@@ -1344,7 +1345,7 @@ With prefix arg, indent to that column."
          pad)
         (if (bolp)
             nil
-          (delete-backward-char 1)
+          (delete-char -1)
           (if (cua--rectangle-right-side t)
               (cua--rectangle-insert-col (current-column))
             (setq indent (- l (current-column))))))
@@ -1432,6 +1433,8 @@ With prefix arg, indent to that column."
   (define-key cua--rectangle-keymap [remap beginning-of-buffer] 'cua-resize-rectangle-top)
   (define-key cua--rectangle-keymap [remap scroll-down]         'cua-resize-rectangle-page-up)
   (define-key cua--rectangle-keymap [remap scroll-up]           'cua-resize-rectangle-page-down)
+  (define-key cua--rectangle-keymap [remap scroll-down-command] 'cua-resize-rectangle-page-up)
+  (define-key cua--rectangle-keymap [remap scroll-up-command]   'cua-resize-rectangle-page-down)
 
   (define-key cua--rectangle-keymap [remap delete-backward-char] 'cua-delete-char-rectangle)
   (define-key cua--rectangle-keymap [remap backward-delete-char] 'cua-delete-char-rectangle)
index 6cce36e42a165129d340efe7a496bd7025d26332..e50e064077d03ffe69f909c4e2aa57ff03e27e19 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Kevin Gallagher <Kevin.Gallagher@boeing.com>
 ;; Maintainer: Kevin Gallagher <Kevin.Gallagher@boeing.com>
 ;; Keywords: emulations
+;; Package: edt
 
 ;; This file is part of GNU Emacs.
 
index e5c0ceecf1c13d46683d5b2ab118c06a889d4988..6bf50db5442559cae03555eb98c87dabfbaca42a 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Kevin Gallagher <Kevin.Gallagher@boeing.com>
 ;; Maintainer: Kevin Gallagher <Kevin.Gallagher@boeing.com>
 ;; Keywords: emulations
+;; Package: edt
 
 ;; This file is part of GNU Emacs.
 
index 0cd421620abda1b63dc338a130dfaaa660009af1..04128ac00b9cb67313143ca4ac5f8c4a902803fb 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Kevin Gallagher <Kevin.Gallagher@boeing.com>
 ;; Maintainer: Kevin Gallagher <Kevin.Gallagher@boeing.com>
 ;; Keywords: emulations
+;; Package: edt
 
 ;; This file is part of GNU Emacs.
 
index f14bdfc79cb2e65318a3e21b406ed6780c444d66..9416a9ad48afb567946e47274e4594b475fc36d7 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Kevin Gallagher <Kevin.Gallagher@boeing.com>
 ;; Maintainer: Kevin Gallagher <Kevin.Gallagher@boeing.com>
 ;; Keywords: emulations
+;; Package: edt
 
 ;; This file is part of GNU Emacs.
 
index 2abde59af9088ac8b68041480016274ed9575dd3..88b74afe86bfb019693e5fc6a0566bddbbb723a0 100644 (file)
@@ -1,7 +1,8 @@
 ;;; edt.el --- enhanced EDT keypad mode emulation for GNU Emacs 19
 
 ;; Copyright (C) 1986, 1992, 1993, 1994, 1995, 2000, 2001, 2002, 2003,
-;;   2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+;;   2004, 2005, 2006, 2007, 2008, 2009, 2010
+;;   Free Software Foundation, Inc.
 
 ;; Author: Kevin Gallagher <Kevin.Gallagher@boeing.com>
 ;; Maintainer: Kevin Gallagher <Kevin.Gallagher@boeing.com>
@@ -858,8 +859,7 @@ Argument NUM is the number of lines to delete."
 In select mode, selected text is highlighted."
   (if arg
       (progn
-       (make-local-variable 'edt-select-mode)
-       (setq edt-select-mode 'edt-select-mode-current)
+       (set (make-local-variable 'edt-select-mode) 'edt-select-mode-current)
        (setq rect-start-point (window-point)))
     (progn
       (kill-local-variable 'edt-select-mode)))
@@ -2057,40 +2057,32 @@ created."
 
      Ack!!  You're running the Enhanced EDT Emulation without loading an
      EDT key mapping file.  To create an EDT key mapping file, run the
-     edt-mapper.el program.  It is safest to run it from an Emacs loaded
+     edt-mapper program.  It is safest to run it from an Emacs loaded
      without any of your own customizations found in your .emacs file, etc.
      The reason for this is that some user customizations confuse edt-mapper.
      You can do this by quitting Emacs and then invoking Emacs again as
      follows:
 
-          emacs -q -l edt-mapper.el
+          emacs -q -l edt-mapper
 
      [NOTE:  If you do nothing out of the ordinary in your .emacs file, and
-     the search for edt-mapper.el is successful, you can try running it now.]
+     the search for edt-mapper is successful, you can try running it now.]
 
-     The file edt-mapper.el includes these same directions on how to
+     The library edt-mapper includes these same directions on how to
      use it!  Perhaps it's lying around here someplace. \n     ")
-        (let ((file "edt-mapper.el")
-              (found nil)
-              (path nil)
-              (search-list (append (list (expand-file-name ".")) load-path)))
-          (while (and (not found) search-list)
-            (setq path (concat (car search-list)
-                               (if (string-match "/$" (car search-list)) "" "/")
-                               file))
-            (if (and (file-exists-p path) (not (file-directory-p path)))
-                (setq found t))
-            (setq search-list (cdr search-list)))
-          (cond (found
-                 (insert (format
-                          "Ah yes, there it is, in \n\n       %s \n\n" path))
-                 (if (edt-y-or-n-p "Do you want to run it now? ")
-                     (load-file path)
-                   (error "EDT Emulation not configured")))
-                (t
-                 (insert "Nope, I can't seem to find it.  :-(\n\n")
-                 (sit-for 20)
-                 (error "EDT Emulation not configured")))))))
+         (let ((path (locate-library
+                      "edt-mapper"
+                      nil (append (list default-directory) load-path))))
+           (if path
+               (progn
+                 (insert (format
+                          "Ah yes, there it is, in \n\n       %s \n\n" path))
+                 (if (edt-y-or-n-p "Do you want to run it now? ")
+                     (load-file path)
+                   (error "EDT Emulation not configured")))
+             (insert "Nope, I can't seem to find it.  :-(\n\n")
+             (sit-for 20)
+             (error "EDT Emulation not configured"))))))
 
 ;;;
 ;;;  Turning the EDT Emulation on and off.
@@ -2571,12 +2563,12 @@ Argument GOLD-BINDING is the Emacs function to be bound to GOLD <KEY>."
 ;;; DEFAULT EDT KEYPAD HELP
 ;;;
 
-;;;
-;;; Upper case commands in the keypad diagram below indicate that the
-;;; emulation should look and feel very much like EDT.  Lower case
-;;; commands are enhancements and/or additions to the EDT keypad
-;;; commands or are native Emacs commands.
-;;;
+;;
+;; Upper case commands in the keypad diagram below indicate that the
+;; emulation should look and feel very much like EDT.  Lower case
+;; commands are enhancements and/or additions to the EDT keypad
+;; commands or are native Emacs commands.
+;;
 
 (defun edt-keypad-help ()
   "DEFAULT EDT Keypad Active.
@@ -2685,7 +2677,7 @@ G-C-\\: Split Window                     |  FNDNXT  |   Yank   |   CUT    |
 
 ;;;
 ;;; EDT emulation screen width commands.
-;;;
+;;
 ;; Some terminals require modification of terminal attributes when
 ;; changing the number of columns displayed, hence the fboundp tests
 ;; below.  These functions are defined in the corresponding terminal
index 22983f496942e4740846200f16c45969856c3266..fcff6a7eb60dff54499902282c522cf9cf7e561f 100644 (file)
@@ -82,8 +82,7 @@
 (defgroup pc-select nil
   "Emulate pc bindings."
   :prefix "pc-select"
-  :group 'editing-basics
-  :group 'convenience)
+  :group 'emulations)
 
 (defcustom pc-select-override-scroll-error t
   "*Non-nil means don't generate error on scrolling past edge of buffer.
@@ -94,6 +93,9 @@ text with these commands.  If you set this variable to non-nil, these
 errors are suppressed."
   :type 'boolean
   :group 'pc-select)
+(define-obsolete-variable-alias 'pc-select-override-scroll-error
+                                'scroll-error-top-bottom
+                                "24.1")
 
 (defcustom pc-select-selection-keys-only nil
   "*Non-nil means only bind the basic selection keys when started.
index c5dd9b3cf325afd2a3d86547efe35fea6305ada5..bcd67d4aff7a327ee29b372e156dc035c5755d9a 100644 (file)
@@ -2438,7 +2438,7 @@ If FILE is nil, try to load a default file.  The default file names are
 
 \f
 ;;;### (autoloads (tpu-set-cursor-bound tpu-set-cursor-free tpu-set-scroll-margins
-;;;;;;  tpu-cursor-free-mode) "tpu-extras" "tpu-extras.el" "d003e4c2f1291eccc629926bb0f88e17")
+;;;;;;  tpu-cursor-free-mode) "tpu-extras" "tpu-extras.el" "78abc50917c93d2b35596d307fc638c4")
 ;;; Generated autoloads from tpu-extras.el
 
 (autoload 'tpu-cursor-free-mode "tpu-extras" "\
index 2fc9ce516f521a8ee8967fa4983c1fb43197cd3b..dbad4f787a0942a076961fcc0c1223dade9438db 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Rob Riepel <riepel@networking.stanford.edu>
 ;; Maintainer: Rob Riepel <riepel@networking.stanford.edu>
 ;; Keywords: emulations
+;; Package: tpu-edt
 
 ;; This file is part of GNU Emacs.
 
index ed42824a8bbb94db02f08c693d316f090e1a3bb3..b4942564eba6163adf2bcb081e6a1c79658d13f5 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Rob Riepel <riepel@networking.stanford.edu>
 ;; Maintainer: Rob Riepel <riepel@networking.stanford.edu>
 ;; Keywords: emulations
+;; Package: tpu-edt
 
 ;; This file is part of GNU Emacs.
 
index 8c216d9aca60a46bfc70db4f4551df654d7fe70a..07719ba45be503b802c0dfe28065c47f0cdc2b8b 100644 (file)
@@ -4,6 +4,7 @@
 ;;   2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
+;; Package: viper
 
 ;; This file is part of GNU Emacs.
 
@@ -4247,7 +4248,7 @@ Null string will repeat previous search."
          (setq viper-use-register nil)))
     (if (and (bolp) viper-ex-style-editing)
        (ding))
-    (delete-backward-char val t)))
+    (delete-char (- val) t)))
 
 
 (defun viper-del-backward-char-in-insert ()
@@ -4256,7 +4257,7 @@ Null string will repeat previous search."
   (if (and viper-ex-style-editing (bolp))
       (beep 1)
     ;; don't put on kill ring
-    (delete-backward-char 1 nil)))
+    (delete-char -1 nil)))
 
 
 (defun viper-del-backward-char-in-replace ()
@@ -4269,14 +4270,14 @@ cursor move past the beginning of line."
   (cond (viper-delete-backwards-in-replace
         (cond ((not (bolp))
                ;; don't put on kill ring
-               (delete-backward-char 1 nil))
+               (delete-char -1 nil))
               (viper-ex-style-editing
                (beep 1))
               ((bobp)
                (beep 1))
               (t
                ;; don't put on kill ring
-               (delete-backward-char 1 nil))))
+               (delete-char -1 nil))))
        (viper-ex-style-editing
         (if (bolp)
             (beep 1)
@@ -4344,7 +4345,7 @@ cursor move past the beginning of line."
            (insert-before-markers "@") ; put placeholder after the TAB
            (untabify (viper-replace-start) (point))
            ;; del @, don't put on kill ring
-           (delete-backward-char 1)
+           (delete-char -1)
 
            (viper-set-replace-overlay-glyphs
             viper-replace-region-start-delimiter
@@ -4622,7 +4623,7 @@ One can use `` and '' to temporarily jump 1 step back."
            (progn
              (if (eq ?^ (preceding-char))
                  (setq viper-preserve-indent t))
-             (delete-backward-char 1)
+             (delete-char -1)
              (setq p (point))
              (setq indent nil)))
        (save-excursion
index 5f5c7e86d6366acbb9ac70605e1c99edef55f891..be387d7724b2afef60ab7e220397df64759ffac0 100644 (file)
@@ -4,6 +4,7 @@
 ;;   2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
+;; Package: viper
 
 ;; This file is part of GNU Emacs.
 
@@ -750,7 +751,7 @@ reversed."
                          (format "[^\\\\]\\(\\\\\\\\\\)*\\\\%c" c)))
                    (setq cont nil)
                  ;; we are at an escaped delimiter: unescape it and continue
-                 (delete-backward-char 2)
+                 (delete-char -2)
                  (insert c)
                  (if (eolp)
                      ;; if at eol, exit loop and go to next line
index 68f729e8b4349e202553cb95cac489e6c2d9a49c..ebd18d47e154270c9c6563a3c20c7e327a959000 100644 (file)
@@ -4,6 +4,7 @@
 ;;   2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
+;; Package: viper
 
 ;; This file is part of GNU Emacs.
 
index cfc84956dac51888d817a3ff32d9e39bb2495b3b..d75573673d7eb266fc0d166e33b5d98d2998a33b 100644 (file)
@@ -4,6 +4,7 @@
 ;;   2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
+;; Package: viper
 
 ;; This file is part of GNU Emacs.
 
index ec31aeef42844ae3f6907e0ea025e8aab189dac0..71d565632eba8c8763efd8c584fd34f2fe3aca2c 100644 (file)
@@ -4,6 +4,7 @@
 ;;   2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
+;; Package: viper
 
 ;; This file is part of GNU Emacs.
 
index dd1cd5362cebaa451854e1c6b6df9248d6b390aa..9bea921e167bced1d6b8d50109c061365f66fd3f 100644 (file)
@@ -4,6 +4,7 @@
 ;;   2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
+;; Package: viper
 
 ;; This file is part of GNU Emacs.
 
index 99dd305cb4c264061c64a7dc800ecdf30596f18b..1ad24da1ef89ceb98702ab0bc4fbad476b1ba826 100644 (file)
@@ -4,6 +4,7 @@
 ;;   2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
+;; Package: viper
 
 ;; This file is part of GNU Emacs.
 
index 302cfa82958e4e75fca1d49b5ae637aafc8d5bf2..04833a836a611d99e7352e4919253945549b7fe7 100644 (file)
@@ -8,6 +8,7 @@
 
 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
 ;; Keywords: emulations
+;; Version: 3.14.1
 
 ;; Yoni Rabkin <yoni@rabkins.net> contacted the maintainer of this
 ;; file on 20/3/2008, and the maintainer agreed that when a bug is
index ed8b55629999aa68b2b432646e9c11855660c3ec..220ac7d67dc5731a67abbcebbdfcc78fe30912bf 100644 (file)
@@ -339,16 +339,6 @@ the distance between the end of the text and `fill-column'."
        (+ left-margin
          (/ (- fill-column left-margin line-length) 2))))))
 
-(defun scroll-down-line ()
-  "Scroll one line down."
-  (interactive)
-  (scroll-down 1))
-
-(defun scroll-up-line ()
-  "Scroll one line up."
-  (interactive)
-  (scroll-up 1))
-
 ;;;;;;;;;;;
 ;; wordstar special variables:
 
index 0699e907fa8006fefd11b8c11df280cfc8d12961..b69f2d2b0e31f2edb6a905dda503f859e9ee3fc0 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Maintainer: FSF
 ;; Keywords: processes, unix
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
index 7ba414da2f9f1d404161410a7f6228aae3bc842d..80ecef6f54fc33c16cc0c350815435a66452bab0 100644 (file)
@@ -3,6 +3,7 @@
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
 ;; Keywords: PGP, GnuPG
+;; Package: epa
 
 ;; This file is part of GNU Emacs.
 
index 2bbb0aa6455a2756fbbf6de464725c1580a8facf..24480ce3c76f47933af60ee6a271b2954f6fd6de 100644 (file)
@@ -3,6 +3,7 @@
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
 ;; Keywords: PGP, GnuPG
+;; Package: epa
 
 ;; This file is part of GNU Emacs.
 
@@ -101,6 +102,14 @@ way."
     (insert (epa-file--decode-coding-string string (or coding-system-for-read
                                                       'undecided)))))
 
+(defvar epa-file-error nil)
+(defun epa-file--find-file-not-found-function ()
+  (let ((error epa-file-error))
+    (save-window-excursion
+      (kill-buffer))
+    (signal 'file-error
+           (cons "Opening input file" (cdr error)))))
+
 (defvar last-coding-system-used)
 (defun epa-file-insert-file-contents (file &optional visit beg end replace)
   (barf-if-buffer-read-only)
@@ -131,6 +140,16 @@ way."
            (error
             (if (setq entry (assoc file epa-file-passphrase-alist))
                 (setcdr entry nil))
+            ;; Hack to prevent find-file from opening empty buffer
+            ;; when decryption failed (bug#6568).  See the place
+            ;; where `find-file-not-found-functions' are called in
+            ;; `find-file-noselect-1'.
+            (when (file-exists-p local-file)
+              (make-local-variable 'epa-file-error)
+              (setq epa-file-error error)
+              (add-hook 'find-file-not-found-functions
+                        'epa-file--find-file-not-found-function
+                        nil t))
             (signal 'file-error
                     (cons "Opening input file" (cdr error)))))
          (make-local-variable 'epa-file-encrypt-to)
index 9ed2feb15bf446697cea908c6ceef702732fac8c..5fb7e2c0bf3fe2f63339d1f509276346fbadc3f9 100644 (file)
@@ -3,6 +3,7 @@
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
 ;; Keywords: PGP, GnuPG
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
index b3c31fe43545331e06e74e441796da162d603706..09b3086811514dcbcc017b61ca5aacaccdf79980 100644 (file)
@@ -3,6 +3,7 @@
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
 ;; Keywords: PGP, GnuPG, mail, message
+;; Package: epa
 
 ;; This file is part of GNU Emacs.
 
     (define-key keymap "\C-c\C-ee" 'epa-mail-encrypt)
     (define-key keymap "\C-c\C-ei" 'epa-mail-import-keys)
     (define-key keymap "\C-c\C-eo" 'epa-insert-keys)
+    (define-key keymap "\C-c\C-e\C-d" 'epa-mail-decrypt)
+    (define-key keymap "\C-c\C-e\C-v" 'epa-mail-verify)
+    (define-key keymap "\C-c\C-e\C-s" 'epa-mail-sign)
+    (define-key keymap "\C-c\C-e\C-e" 'epa-mail-encrypt)
+    (define-key keymap "\C-c\C-e\C-i" 'epa-mail-import-keys)
+    (define-key keymap "\C-c\C-e\C-o" 'epa-insert-keys)
     keymap))
 
 (defvar epa-mail-mode-hook nil)
index 3cdf2ff3ffacd9c2a1c20b575deaab21cb1e95e9..37c5d01fb1d530214fb1f19e9251228ce897b7fa 100644 (file)
@@ -4,6 +4,7 @@
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
 ;; Keywords: PGP, GnuPG
+;; Package: epg
 
 ;; This file is part of GNU Emacs.
 
@@ -34,7 +35,7 @@
 (defgroup epg ()
   "The EasyPG library."
   :version "23.1"
-  :group 'emacs)
+  :group 'data)
 
 (defcustom epg-gpg-program "gpg"
   "The `gpg' executable."
index 9fde76d5f8570311e28524e9cf2604ddbb6df6c8..fae896c4ae0ddea22fd5d9877c57a635edd68da3 100644 (file)
@@ -4,6 +4,7 @@
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
 ;; Keywords: PGP, GnuPG
+;; Version: 1.0.0
 
 ;; This file is part of GNU Emacs.
 
   '((?e . encrypt)
     (?s . sign)
     (?c . certify)
-    (?a . authentication)))
+    (?a . authentication)
+    (?D . disabled)))
 
 (defvar epg-new-signature-type-alist
   '((?D . detached)
index 3dea16b6dbf5faf22a9b7d384c7365a200a0db30..90b3131ebd85a5bb1823615ad7a38f79d4f79c50 100644 (file)
@@ -1,7 +1,26 @@
+2010-08-14  Vivek Dasmohapatra  <vivek@etla.org>
+
+       * erc-join.el (erc-autojoin-timing, erc-autojoin-delay): New vars.
+       (erc-autojoin-channels-delayed, erc-autojoin-after-ident): New
+       functions.
+       (erc-autojoin-channels): Allow autojoining after ident (Bug#5521).
+
+2010-08-08  Fran Litterio  <flitterio@gmail.com>
+
+       * erc-backend.el (erc-server-filter-function): Call
+       erc-log-irc-protocol.
+
+       * erc.el (erc-toggle-debug-irc-protocol): Bind
+       erc-toggle-debug-irc-protocol to t.
+
 2010-05-07  Chong Yidong  <cyd@stupidchicken.com>
 
        * Version 23.2 released.
 
+2010-03-10  Chong Yidong  <cyd@stupidchicken.com>
+
+       * Branch for 23.2.
+
 2010-02-07  Vivek Dasmohapatra  <vivek@etla.org>
 
        * erc-services.el (erc-nickserv-alist): Fix defcustom type (Bug#5520).
@@ -12,8 +31,8 @@
        (erc-server-reconnect): Use it to reconnect via old
        connector (Bug#4958).
 
-       * erc.el (erc-determine-parameters): Save
-       erc-server-connect-function to erc-session-connector.
+       * erc.el (erc-determine-parameters):
+       Save erc-server-connect-function to erc-session-connector.
 
 2009-11-03  Stefan Monnier  <monnier@iro.umontreal.ca>
 
index d378cf36d42c226f7369f1207eafed973ae75b20..6f46837ad1984221367cf60d6ea3de2e4ad60cb9 100644 (file)
        to delete-if-not.
 
        * erc.el(erc-update-current-channel-member):
-        Use erc-downcase when comparing
+       Use erc-downcase when comparing
        nick entries.  Cleanup indentation.
 
 2003-11-01  Lawrence Mitchell  <wence@gmx.li>
 2003-10-24  Mario Lang  <mlang@delysid.org>
 
        * erc-dcc.el: From Stephan Stahl <stl@isogmbh.de>:
-        * (erc-dcc-send-block): Kill buffer if transfer completed correctly.
+       (erc-dcc-send-block): Kill buffer if transfer completed correctly.
 
 2003-10-22  Mario Lang  <mlang@delysid.org>
 
index 16e7788a2211773a0730a524319855970d3b140d..a1cbab740be95a84918ad956298875aa545081d0 100644 (file)
@@ -72,7 +72,7 @@
 2004-12-24  Jorgen Schaefer  <forcer@users.sourceforge.net>
 
        * erc-goodies.el, erc.el: The Small Extraction of Stuff[tm] commit.
-        Moved some functions from erc.el to erc-goodies.el, and
+       Moved some functions from erc.el to erc-goodies.el, and
        transformed them to erc modules in the process.
        - imenu autoload stuff moved.  I don't know why it is here at all.
        - Moved: scroll-to-bottom, make-read-only, distinguish-noncommands,
index 8b533b4c25598b3b669bf97a495247c103adf9d4..9a237d47d557132f920bff1214365cb69afd8dc9 100644 (file)
@@ -574,6 +574,7 @@ Make sure you are in an ERC buffer when running this."
                       nil
                     (substring erc-server-filter-data
                                (match-end 0))))
+            (erc-log-irc-protocol line nil)
             (erc-parse-server-response process line)))))))
 
 (defsubst erc-server-reconnect-p (event)
index 7081d97fc4b5fa80c198f95e042e5cef89818082..c54c2c534f33e72d48dcd6ac4a0761b8060eb5d1 100644 (file)
 (define-erc-module autojoin nil
   "Makes ERC autojoin on connects and reconnects."
   ((add-hook 'erc-after-connect 'erc-autojoin-channels)
+   (add-hook 'erc-nickserv-identified-hook 'erc-autojoin-after-ident)
    (add-hook 'erc-server-JOIN-functions 'erc-autojoin-add)
    (add-hook 'erc-server-PART-functions 'erc-autojoin-remove))
   ((remove-hook 'erc-after-connect 'erc-autojoin-channels)
+   (remove-hook 'erc-nickserv-identified-hook 'erc-autojoin-after-ident)
    (remove-hook 'erc-server-JOIN-functions 'erc-autojoin-add)
    (remove-hook 'erc-server-PART-functions 'erc-autojoin-remove)))
 
@@ -66,6 +68,24 @@ time is used again."
                       (repeat :tag "Channels"
                               (string :tag "Name")))))
 
+(defcustom erc-autojoin-timing 'connect
+  "When ERC should attempt to autojoin a channel.
+If the value is `connect', autojoin immediately on connecting.
+If the value is `ident', autojoin after successful NickServ
+identification, or after `erc-autojoin-delay' seconds.
+Any other value means the same as `connect'."
+  :group 'erc-autojoin
+  :type  '(choice (const :tag "On Connection" 'connect)
+                 (const :tag "When Identified" 'ident)))
+
+(defcustom erc-autojoin-delay 30
+  "Number of seconds to wait before attempting to autojoin channels.
+This only takes effect if `erc-autojoin-timing' is `ident'.
+If NickServ identification occurs before this delay expires, ERC
+autojoins immediately at that time."
+  :group 'erc-autojoin
+  :type  'integer)
+
 (defcustom erc-autojoin-domain-only t
   "Truncate host name to the domain name when joining a server.
 If non-nil, and a channel on the server a.b.c is joined, then
@@ -75,12 +95,60 @@ servers, presumably in the same domain."
   :group 'erc-autojoin
   :type 'boolean)
 
+(defvar erc--autojoin-timer nil)
+(make-variable-buffer-local 'erc--autojoin-timer)
+
+(defun erc-autojoin-channels-delayed (server nick buffer)
+  "Attempt to autojoin channels.
+This is called from a timer set up by `erc-autojoin-channels'."
+  (if erc--autojoin-timer
+      (setq erc--autojoin-timer
+           (erc-cancel-timer erc--autojoin-timer)))
+  (with-current-buffer buffer
+    ;; Don't kick of another delayed autojoin or try to wait for
+    ;; another ident response:
+    (let ((erc-autojoin-delay -1)
+         (erc-autojoin-timing 'connect))
+      (erc-log "Delayed autojoin started (no ident success detected yet)")
+      (erc-autojoin-channels server nick))))
+
+(defun erc-autojoin-after-ident (network nick)
+  "Autojoin channels in `erc-autojoin-channels-alist'.
+This function is run from `erc-nickserv-identified-hook'."
+  (if erc--autojoin-timer
+      (setq erc--autojoin-timer
+           (erc-cancel-timer erc--autojoin-timer)))
+  (when (eq erc-autojoin-timing 'ident)
+    (let ((server (or erc-server-announced-name erc-session-server))
+         (joined (mapcar (lambda (buf)
+                           (with-current-buffer buf (erc-default-target)))
+                         (erc-channel-list erc-server-process))))
+      ;; We may already be in these channels, e.g. because the
+      ;; autojoin timer went off.
+      (dolist (l erc-autojoin-channels-alist)
+       (when (string-match (car l) server)
+         (dolist (chan (cdr l))
+           (unless (erc-member-ignore-case chan joined)
+             (erc-server-send (concat "join " chan))))))))
+  nil)
+
 (defun erc-autojoin-channels (server nick)
   "Autojoin channels in `erc-autojoin-channels-alist'."
-  (dolist (l erc-autojoin-channels-alist)
-    (when (string-match (car l) server)
-      (dolist (chan (cdr l))
-       (erc-server-send (concat "join " chan))))))
+  (if (eq erc-autojoin-timing 'ident)
+      ;; Prepare the delayed autojoin timer, in case ident doesn't
+      ;; happen within the allotted time limit:
+      (when (> erc-autojoin-delay 0)
+       (setq erc--autojoin-timer
+             (run-with-timer erc-autojoin-delay nil
+                             'erc-autojoin-channels-delayed
+                             server nick (current-buffer))))
+    ;; `erc-autojoin-timing' is `connect':
+    (dolist (l erc-autojoin-channels-alist)
+      (when (string-match (car l) server)
+       (dolist (chan (cdr l))
+         (erc-server-send (concat "join " chan))))))
+  ;; Return nil to avoid stomping on any other hook funcs.
+  nil)
 
 (defun erc-autojoin-add (proc parsed)
   "Add the channel being joined to `erc-autojoin-channels-alist'."
index b76f486f155bf823ccb7eb16032817c9692509b1..54f87982f8f87def18d26d1aab55ae9b7b86e658 100644 (file)
@@ -12,6 +12,7 @@
 ;;               David Edmondson (dme@dme.org)
 ;; Maintainer: Michael Olson (mwolson@gnu.org)
 ;; Keywords: IRC, chat, client, Internet
+;; Version: 5.3
 
 ;; This file is part of GNU Emacs.
 
@@ -2306,14 +2307,14 @@ If ARG is non-nil, show the *erc-protocol* buffer."
          (insert (erc-make-notice "This buffer displays all IRC protocol traffic exchanged with each server.\n"))
          (insert (erc-make-notice "Kill this buffer to terminate protocol logging.\n\n")))
        (use-local-map (make-sparse-keymap))
-       (local-set-key (kbd "RET") 'erc-toggle-debug-irc-protocol))
+       (local-set-key (kbd "t") 'erc-toggle-debug-irc-protocol))
       (add-hook 'kill-buffer-hook
                #'(lambda () (setq erc-debug-irc-protocol nil))
                nil 'local)
       (goto-char (point-max))
       (let ((inhibit-read-only t))
        (insert (erc-make-notice
-                (format "IRC protocol logging %s at %s -- Press ENTER to toggle logging.\n"
+                (format "IRC protocol logging %s at %s -- Press `t' to toggle logging.\n"
                         (if erc-debug-irc-protocol "disabled" "enabled")
                         (current-time-string))))))
     (setq erc-debug-irc-protocol (not erc-debug-irc-protocol))
diff --git a/lisp/eshell/.arch-inventory b/lisp/eshell/.arch-inventory
deleted file mode 100644 (file)
index b5d82cd..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-# Generated files
-precious ^(esh-groups)\.el$
-
-# arch-tag: 8dc7bfaa-6ca6-4be0-915a-1e539c3dabfb
index eb448e9704f2bc3c54ff9502f09e00f1924de9c0..5bce6072f0a918968377a2f54c7b40715bbb1e3f 100644 (file)
       (eshell-redisplay))
     (let ((truth (eval command)))
       (with-current-buffer test-buffer
-       (delete-backward-char 6)
+       (delete-char -6)
        (insert-before-markers
         "[" (let (str)
               (if truth
index 74f65d2fe55aef849049441baf70d1ed82a4376b..89ec3ab9c601c97592fbdfa81f911171a3d73e88 100644 (file)
@@ -404,7 +404,7 @@ With prefix ARG, insert output into the current buffer at point."
          (assert (not (eshell-interactive-process)))
          (goto-char (point-max))
          (while (and (bolp) (not (bobp)))
-           (delete-backward-char 1)))
+           (delete-char -1)))
        (assert (and buf (buffer-live-p buf)))
        (unless arg
          (let ((len (if (not intr) 2
index 23fde5f21de06b4aef209f017c25eeb8894aa844..14bc210232cc04bda2cdae59dd46763bbd7b1d12 100644 (file)
@@ -368,7 +368,7 @@ See `expand-add-abbrevs'.  Value is non-nil if expansion was done."
     nil))
 
 (defun expand-do-expansion ()
-  (delete-backward-char (length last-abbrev-text))
+  (delete-char (- (length last-abbrev-text)))
   (let* ((vect (symbol-value last-abbrev))
         (text (aref vect 0))
         (position (aref vect 1))
index c8fdfff85888c8e2b2c5d662e1b25de5d50cc8a0..5067221585b06f19d285454040a86efd27da3f7b 100644 (file)
@@ -3,7 +3,7 @@
 ;; Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
 ;;
 ;; Author: Miles Bader <miles@gnu.org>
-;; Keywords: faces face remapping display user commands
+;; Keywords: faces, face remapping, display, user commands
 ;;
 ;; This file is part of GNU Emacs.
 ;;
index 6f9e679976350bc315bd4acf8c62255b287e7a45..5249538d711d61b65097e51142b1d3805f33d96a 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Author: Boris Goldowsky <boris@gnu.org>
 ;; Keywords: faces
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
@@ -479,63 +480,195 @@ These special properties include `invisible', `intangible' and `read-only'."
        nil
       col)))
 
-(defun list-colors-display (&optional list buffer-name)
+(defun color-rgb-to-hsv (r g b)
+  "For R, G, B color components return a list of hue, saturation, value.
+R, G, B input values should be in [0..65535] range.
+Output values for hue are integers in [0..360] range.
+Output values for saturation and value are integers in [0..100] range."
+  (let* ((r (/ r 65535.0))
+        (g (/ g 65535.0))
+        (b (/ b 65535.0))
+        (max (max r g b))
+        (min (min r g b))
+        (h (cond ((= max min) 0)
+                 ((= max r) (mod (+ (* 60 (/ (- g b) (- max min))) 360) 360))
+                 ((= max g) (+ (* 60 (/ (- b r) (- max min))) 120))
+                 ((= max b) (+ (* 60 (/ (- r g) (- max min))) 240))))
+        (s (cond ((= max 0) 0)
+                 (t (- 1 (/ min max)))))
+        (v max))
+    (list (round h) (round s 0.01) (round v 0.01))))
+
+(defcustom list-colors-sort nil
+  "Color sort order for `list-colors-display'.
+`nil' means default implementation-dependent order (defined in `x-colors').
+`name' sorts by color name.
+`rgb' sorts by red, green, blue components.
+`(rgb-dist . COLOR)' sorts by the RGB distance to the specified color.
+`hsv' sorts by hue, saturation, value.
+`(hsv-dist . COLOR)' sorts by the HSV distance to the specified color
+and excludes grayscale colors."
+  :type '(choice (const :tag "Unsorted" nil)
+                (const :tag "Color Name" name)
+                (const :tag "Red-Green-Blue" rgb)
+                (cons :tag "Distance on RGB cube"
+                      (const :tag "Distance from Color" rgb-dist)
+                      (color :tag "Source Color Name"))
+                (const :tag "Hue-Saturation-Value" hsv)
+                (cons :tag "Distance on HSV cylinder"
+                      (const :tag "Distance from Color" hsv-dist)
+                      (color :tag "Source Color Name")))
+  :group 'facemenu
+  :version "24.1")
+
+(defun list-colors-sort-key (color)
+  "Return a list of keys for sorting colors depending on `list-colors-sort'.
+COLOR is the name of the color.  When return value is nil,
+filter out the color from the output."
+  (cond
+   ((null list-colors-sort) color)
+   ((eq list-colors-sort 'name)
+    (downcase color))
+   ((eq list-colors-sort 'rgb)
+    (color-values color))
+   ((eq (car-safe list-colors-sort) 'rgb-dist)
+    (color-distance color (cdr list-colors-sort)))
+   ((eq list-colors-sort 'hsv)
+    (apply 'color-rgb-to-hsv (color-values color)))
+   ((eq (car-safe list-colors-sort) 'hsv-dist)
+    (let* ((c-rgb (color-values color))
+          (c-hsv (apply 'color-rgb-to-hsv c-rgb))
+          (o-hsv (apply 'color-rgb-to-hsv
+                        (color-values (cdr list-colors-sort)))))
+      (unless (and (eq (nth 0 c-rgb) (nth 1 c-rgb)) ; exclude grayscale
+                  (eq (nth 1 c-rgb) (nth 2 c-rgb)))
+       ;; 3D Euclidean distance (sqrt is not needed for sorting)
+       (+ (expt (- 180 (abs (- 180 (abs (- (nth 0 c-hsv) ; wrap hue
+                                           (nth 0 o-hsv)))))) 2)
+          (expt (- (nth 1 c-hsv) (nth 1 o-hsv)) 2)
+          (expt (- (nth 2 c-hsv) (nth 2 o-hsv)) 2)))))))
+
+(defun list-colors-display (&optional list buffer-name callback)
   "Display names of defined colors, and show what they look like.
 If the optional argument LIST is non-nil, it should be a list of
 colors to display.  Otherwise, this command computes a list of
-colors that the current display can handle.  If the optional
-argument BUFFER-NAME is nil, it defaults to *Colors*."
+colors that the current display can handle.
+
+If the optional argument BUFFER-NAME is nil, it defaults to
+*Colors*.
+
+If the optional argument CALLBACK is non-nil, it should be a
+function to call each time the user types RET or clicks on a
+color.  The function should accept a single argument, the color
+name.
+
+You can change the color sort order by customizing `list-colors-sort'."
   (interactive)
   (when (and (null list) (> (display-color-cells) 0))
     (setq list (list-colors-duplicates (defined-colors)))
+    (when list-colors-sort
+      ;; Schwartzian transform with `(color key1 key2 key3 ...)'.
+      (setq list (mapcar
+                 'car
+                 (sort (delq nil (mapcar
+                                  (lambda (c)
+                                    (let ((key (list-colors-sort-key
+                                                (car c))))
+                                      (when key
+                                        (cons c (if (consp key) key
+                                                  (list key))))))
+                                  list))
+                       (lambda (a b)
+                         (let* ((a-keys (cdr a))
+                                (b-keys (cdr b))
+                                (a-key (car a-keys))
+                                (b-key (car b-keys)))
+                           ;; Skip common keys at the beginning of key lists.
+                           (while (and a-key b-key (equal a-key b-key))
+                             (setq a-keys (cdr a-keys) a-key (car a-keys)
+                                   b-keys (cdr b-keys) b-key (car b-keys)))
+                           (cond
+                            ((and (numberp a-key) (numberp b-key))
+                             (< a-key b-key))
+                            ((and (stringp a-key) (stringp b-key))
+                             (string< a-key b-key)))))))))
     (when (memq (display-visual-class) '(gray-scale pseudo-color direct-color))
       ;; Don't show more than what the display can handle.
       (let ((lc (nthcdr (1- (display-color-cells)) list)))
        (if lc
            (setcdr lc nil)))))
-  (with-help-window (or buffer-name "*Colors*")
-    (with-current-buffer standard-output
+  (let ((buf (get-buffer-create "*Colors*")))
+    (with-current-buffer buf
+      (erase-buffer)
       (setq truncate-lines t)
-      (if temp-buffer-show-function
-         (list-colors-print list)
-       ;; Call list-colors-print from temp-buffer-show-hook
-       ;; to get the right value of window-width in list-colors-print
-       ;; after the buffer is displayed.
-       (add-hook 'temp-buffer-show-hook
-                 (lambda ()
-                   (set-buffer-modified-p
-                    (prog1 (buffer-modified-p)
-                      (list-colors-print list))))
-                 nil t)))))
-
-(defun list-colors-print (list)
-  (dolist (color list)
-    (if (consp color)
-       (if (cdr color)
-           (setq color (sort color (lambda (a b)
-                                     (string< (downcase a)
-                                              (downcase b))))))
-      (setq color (list color)))
-    (put-text-property
-     (prog1 (point)
-       (insert (car color))
-       (indent-to 22))
-     (point)
-     'face (list ':background (car color)))
-    (put-text-property
-     (prog1 (point)
-       (insert " " (if (cdr color)
-                      (mapconcat 'identity (cdr color) ", ")
-                    (car color))))
-     (point)
-     'face (list ':foreground (car color)))
-    (indent-to (max (- (window-width) 8) 44))
-    (insert (apply 'format "#%02x%02x%02x"
-                  (mapcar (lambda (c) (lsh c -8))
-                          (color-values (car color)))))
-
-    (insert "\n"))
-  (goto-char (point-min)))
+      ;; Display buffer before generating content to allow
+      ;; `list-colors-print' to get the right window-width.
+      (pop-to-buffer buf)
+      (list-colors-print list callback)
+      (set-buffer-modified-p nil)))
+  (if callback
+      (message "Click on a color to select it.")))
+
+(defun list-colors-print (list &optional callback)
+  (let ((callback-fn
+        (if callback
+            `(lambda (button)
+               (funcall ,callback (button-get button 'color-name))))))
+    (dolist (color list)
+      (if (consp color)
+         (if (cdr color)
+             (setq color (sort color (lambda (a b)
+                                       (string< (downcase a)
+                                                (downcase b))))))
+       (setq color (list color)))
+      (let* ((opoint (point))
+            (color-values (color-values (car color)))
+            (light-p (>= (apply 'max color-values)
+                         (* (car (color-values "white")) .5)))
+            (max-len (max (- (window-width) 33) 20)))
+       (insert (car color))
+       (indent-to 22)
+       (put-text-property opoint (point) 'face `(:background ,(car color)))
+       (put-text-property
+        (prog1 (point)
+          (insert " ")
+          (if (cdr color)
+              ;; Insert as many color names as possible, fitting max-len.
+              (let ((names (list (car color)))
+                    (others (cdr color))
+                    (len (length (car color)))
+                    newlen)
+                (while (and others
+                            (< (setq newlen (+ len 2 (length (car others))))
+                               max-len))
+                  (setq len newlen)
+                  (push (pop others) names))
+                (insert (mapconcat 'identity (nreverse names) ", ")))
+            (insert (car color))))
+        (point)
+        'face (list :foreground (car color)))
+       (indent-to (max (- (window-width) 8) 44))
+       (insert (propertize
+                (apply 'format "#%02x%02x%02x"
+                       (mapcar (lambda (c) (lsh c -8))
+                               color-values))
+                'mouse-face 'highlight
+                'help-echo
+                (let ((hsv (apply 'color-rgb-to-hsv
+                                  (color-values (car color)))))
+                  (format "H:%d S:%d V:%d"
+                          (nth 0 hsv) (nth 1 hsv) (nth 2 hsv)))))
+       (when callback
+         (make-text-button
+          opoint (point)
+          'follow-link t
+          'mouse-face (list :background (car color)
+                            :foreground (if light-p "black" "white"))
+          'color-name (car color)
+          'action callback-fn)))
+      (insert "\n"))
+    (goto-char (point-min))))
+
 
 (defun list-colors-duplicates (&optional list)
   "Return a list of colors with grouped duplicate colors.
@@ -567,6 +700,22 @@ determine the correct answer."
   (cond ((equal a b) t)
        ((equal (color-values a) (color-values b)))))
 
+
+(defvar facemenu-self-insert-data nil)
+
+(defun facemenu-post-self-insert-function ()
+  (when (and (car facemenu-self-insert-data)
+             (eq last-command (cdr facemenu-self-insert-data)))
+    (put-text-property (1- (point)) (point)
+                       'face (car facemenu-self-insert-data))
+    (setq facemenu-self-insert-data nil))
+  (remove-hook 'post-self-insert-hook 'facemenu-post-self-insert-function))
+
+(defun facemenu-set-self-insert-face (face)
+  "Arrange for the next self-inserted char to have face `face'."
+  (setq facemenu-self-insert-data (cons face this-command))
+  (add-hook 'post-self-insert-hook 'facemenu-post-self-insert-function))
+
 (defun facemenu-add-face (face &optional start end)
   "Add FACE to text between START and END.
 If START is nil or START to END is empty, add FACE to next typed character
@@ -580,51 +729,52 @@ As a special case, if FACE is `default', then the region is left with NO face
 text property.  Otherwise, selecting the default face would not have any
 effect.  See `facemenu-remove-face-function'."
   (interactive "*xFace: \nr")
-  (if (and (eq face 'default)
-          (not (eq facemenu-remove-face-function t)))
-      (if facemenu-remove-face-function
-         (funcall facemenu-remove-face-function start end)
-       (if (and start (< start end))
-           (remove-text-properties start end '(face default))
-         (setq self-insert-face 'default
-               self-insert-face-command this-command)))
-    (if facemenu-add-face-function
-       (save-excursion
-         (if end (goto-char end))
-         (save-excursion
-           (if start (goto-char start))
-           (insert-before-markers
-            (funcall facemenu-add-face-function face end)))
-         (if facemenu-end-add-face
-             (insert (if (stringp facemenu-end-add-face)
-                         facemenu-end-add-face
-                       (funcall facemenu-end-add-face face)))))
+  (cond
+   ((and (eq face 'default)
+         (not (eq facemenu-remove-face-function t)))
+    (if facemenu-remove-face-function
+        (funcall facemenu-remove-face-function start end)
       (if (and start (< start end))
-         (let ((part-start start) part-end)
-           (while (not (= part-start end))
-             (setq part-end (next-single-property-change part-start 'face
-                                                         nil end))
-             (let ((prev (get-text-property part-start 'face)))
-               (put-text-property part-start part-end 'face
-                                  (if (null prev)
-                                      face
-                                    (facemenu-active-faces
-                                     (cons face
-                                           (if (listp prev)
-                                               prev
-                                             (list prev)))
-                                     ;; Specify the selected frame
-                                     ;; because nil would mean to use
-                                     ;; the new-frame default settings,
-                                     ;; and those are usually nil.
-                                     (selected-frame)))))
-             (setq part-start part-end)))
-       (setq self-insert-face (if (eq last-command self-insert-face-command)
-                                  (cons face (if (listp self-insert-face)
-                                                 self-insert-face
-                                               (list self-insert-face)))
-                                face)
-             self-insert-face-command this-command))))
+          (remove-text-properties start end '(face default))
+        (facemenu-set-self-insert-face 'default))))
+   (facemenu-add-face-function
+    (save-excursion
+      (if end (goto-char end))
+      (save-excursion
+        (if start (goto-char start))
+        (insert-before-markers
+         (funcall facemenu-add-face-function face end)))
+      (if facemenu-end-add-face
+          (insert (if (stringp facemenu-end-add-face)
+                      facemenu-end-add-face
+                    (funcall facemenu-end-add-face face))))))
+   ((and start (< start end))
+    (let ((part-start start) part-end)
+      (while (not (= part-start end))
+        (setq part-end (next-single-property-change part-start 'face
+                                                    nil end))
+        (let ((prev (get-text-property part-start 'face)))
+          (put-text-property part-start part-end 'face
+                             (if (null prev)
+                                 face
+                               (facemenu-active-faces
+                                (cons face
+                                      (if (listp prev)
+                                          prev
+                                        (list prev)))
+                                ;; Specify the selected frame
+                                ;; because nil would mean to use
+                                ;; the new-frame default settings,
+                                ;; and those are usually nil.
+                                (selected-frame)))))
+        (setq part-start part-end))))
+   (t
+    (facemenu-set-self-insert-face
+     (if (eq last-command (cdr facemenu-self-insert-data))
+         (cons face (if (listp (car facemenu-self-insert-data))
+                        (car facemenu-self-insert-data)
+                      (list (car facemenu-self-insert-data))))
+       face))))
   (unless (facemenu-enable-faces-p)
     (message "Font-lock mode will override any faces you set in this buffer")))
 
index 900e96ed048e587d6558589e69f0b4e7ff047ec8..400a0f1c96e6ec5361559c185d85c3ce8b865e4b 100644 (file)
@@ -6,6 +6,7 @@
 
 ;; Maintainer: FSF
 ;; Keywords: internal
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
@@ -376,7 +377,7 @@ FRAME nil or not specified means do it for all frames."
 (defun face-all-attributes (face &optional frame)
   "Return an alist stating the attributes of FACE.
 Each element of the result has the form (ATTR-NAME . ATTR-VALUE).
-Normally the value describes the default attributes,
+If FRAME is omitted or nil the value describes the default attributes,
 but if you specify FRAME, the value describes the attributes
 of FACE on FRAME."
   (mapcar (lambda (pair)
@@ -915,13 +916,14 @@ of the default face.  Value is FACE."
 ;;; Interactively modifying faces.
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-(defun read-face-name (prompt &optional string-describing-default multiple)
+(defun read-face-name (prompt &optional default multiple)
   "Read a face, defaulting to the face or faces on the char after point.
 If it has the property `read-face-name', that overrides the `face' property.
 PROMPT should be a string that describes what the caller will do with the face;
 it should not end in a space.
-STRING-DESCRIBING-DEFAULT should describe what default the caller will use if
-the user just types RET; you can omit it.
+The optional argument DEFAULT provides the value to display in the
+minibuffer prompt that is returned if the user just types RET
+unless DEFAULT is a string (in which case nil is returned).
 If MULTIPLE is non-nil, return a list of faces (possibly only one).
 Otherwise, return a single face."
   (let ((faceprop (or (get-char-property (point) 'read-face-name)
@@ -960,10 +962,10 @@ Otherwise, return a single face."
     (let* ((input
            ;; Read the input.
            (completing-read-multiple
-            (if (or faces string-describing-default)
-                (format "%s (default %s): " prompt
+            (if (or faces default)
+                (format "%s (default `%s'): " prompt
                         (if faces (mapconcat 'symbol-name faces ",")
-                          string-describing-default))
+                          default))
               (format "%s: " prompt))
             (completion-table-in-turn nonaliasfaces aliasfaces)
             nil t nil 'face-name-history
@@ -971,7 +973,7 @@ Otherwise, return a single face."
           ;; Canonicalize the output.
           (output
            (cond ((or (equal input "") (equal input '("")))
-                  faces)
+                  (or faces (unless (stringp default) default)))
                  ((stringp input)
                   (mapcar 'intern (split-string input ", *" t)))
                  ((listp input)
@@ -1334,7 +1336,7 @@ and FRAME defaults to the selected frame.
 If the optional argument FRAME is given, report on face FACE in that frame.
 If FRAME is t, report on the defaults for face FACE (for new frames).
 If FRAME is omitted or nil, use the selected frame."
-  (interactive (list (read-face-name "Describe face" "= `default' face" t)))
+  (interactive (list (read-face-name "Describe face" 'default t)))
   (let* ((attrs '((:family . "Family")
                  (:foundry . "Foundry")
                  (:width . "Width")
@@ -1948,8 +1950,7 @@ according to the `background-mode' and `display-type' frame parameters."
   "Add geometry parameters for a named frame to parameter list PARAMETERS.
 Value is the new parameter list."
   ;; Note that `x-resource-name' has a global meaning.
-  (let ((x-resource-name (or (cdr (assq 'name parameters))
-                            (cdr (assq 'name default-frame-alist)))))
+  (let ((x-resource-name (cdr (assq 'name parameters))))
     (when x-resource-name
       ;; Before checking X resources, we must have an X connection.
       (or (window-system)
@@ -1960,7 +1961,7 @@ Value is the new parameter list."
        (and (setq res-geometry (x-get-resource "geometry" "Geometry"))
             (setq parsed (x-parse-geometry res-geometry))
             (setq parameters
-                  (append parameters default-frame-alist parsed
+                  (append parameters parsed
                           ;; If the resource specifies a position,
                           ;; take note of that.
                           (if (or (assq 'top parsed) (assq 'left parsed))
@@ -1972,7 +1973,6 @@ Value is the new parameter list."
   "Handle the reverse-video frame parameter and X resource.
 `x-create-frame' does not handle this one."
   (when (cdr (or (assq 'reverse parameters)
-                (assq 'reverse default-frame-alist)
                 (let ((resource (x-get-resource "reverseVideo"
                                                 "ReverseVideo")))
                   (if resource
@@ -1998,13 +1998,10 @@ Value is the new parameter list."
 (declare-function x-setup-function-keys "term/x-win" (frame))
 
 (defun x-create-frame-with-faces (&optional parameters)
-  "Create a frame from optional frame parameters PARAMETERS.
-Parameters not specified by PARAMETERS are taken from
-`default-frame-alist'.  If PARAMETERS specify a frame name,
-handle X geometry resources for that name.  If either PARAMETERS
-or `default-frame-alist' contains a `reverse' parameter, or
-the X resource ``reverseVideo'' is present, handle that.
-Value is the new frame created."
+  "Create and return a frame with frame parameters PARAMETERS.
+If PARAMETERS specify a frame name, handle X geometry resources
+for that name.  If PARAMETERS includes a `reverse' parameter, or
+the X resource ``reverseVideo'' is present, handle that."
   (setq parameters (x-handle-named-frame-geometry parameters))
   (let* ((params (copy-tree parameters))
         (visibility-spec (assq 'visibility parameters))
@@ -2035,7 +2032,7 @@ Value is the new frame created."
 Calculate the face definitions using the face specs, custom theme
 settings, X resources, and `face-new-frame-defaults'.
 Finally, apply any relevant face attributes found amongst the
-frame parameters in PARAMETERS and `default-frame-alist'."
+frame parameters in PARAMETERS."
   (dolist (face (nreverse (face-list))) ;Why reverse?  --Stef
     (condition-case ()
        (progn
@@ -2061,16 +2058,14 @@ frame parameters in PARAMETERS and `default-frame-alist'."
                       (mouse-color mouse :background))))
     (dolist (param face-params)
       (let* ((param-name (nth 0 param))
-            (value (cdr (or (assq param-name parameters)
-                            (assq param-name default-frame-alist)))))
+            (value (cdr (assq param-name parameters))))
        (if value
            (set-face-attribute (nth 1 param) frame
                                (nth 2 param) value))))))
 
 (defun tty-handle-reverse-video (frame parameters)
   "Handle the reverse-video frame parameter for terminal frames."
-  (when (cdr (or (assq 'reverse parameters)
-                (assq 'reverse default-frame-alist)))
+  (when (cdr (assq 'reverse parameters))
     (let* ((params (frame-parameters frame))
           (bg (cdr (assq 'foreground-color params)))
           (fg (cdr (assq 'background-color params))))
@@ -2086,11 +2081,8 @@ frame parameters in PARAMETERS and `default-frame-alist'."
 
 
 (defun tty-create-frame-with-faces (&optional parameters)
-  "Create a frame from optional frame parameters PARAMETERS.
-Parameters not specified by PARAMETERS are taken from
-`default-frame-alist'.  If either PARAMETERS or `default-frame-alist'
-contains a `reverse' parameter, handle that.  Value is the new frame
-created."
+  "Create and return a frame from optional frame parameters PARAMETERS.
+If PARAMETERS contains a `reverse' parameter, handle that."
   (let ((frame (make-terminal-frame parameters))
        success)
     (unwind-protect
@@ -2290,6 +2282,9 @@ terminal type to a different value."
 (defface region
   '((((class color) (min-colors 88) (background dark))
      :background "blue3")
+    (((class color) (min-colors 88) (background light) (type gtk))
+     :foreground "gtk_selection_fg_color"
+     :background "gtk_selection_bg_color")
     (((class color) (min-colors 88) (background light) (type ns))
      :background "ns_selection_color")
     (((class color) (min-colors 88) (background light))
index 096f302820a89193e83662f58b96c0553a0751bd..222141bd357b8cc8b5aa49565ef7e826ba6ed5f8 100644 (file)
@@ -5,6 +5,7 @@
 ;; Author: Juri Linkov <juri@jurta.org>
 ;; Maintainer: FSF
 ;; Keywords: files
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
index f6564768ae7c0fafbef2e67c3ae63c10b595b9b9..73a0c5c9e24d21e91940cd7fc7fd0cf02564ea40 100644 (file)
@@ -1,10 +1,11 @@
 ;;; files.el --- file input and output commands for Emacs
 
 ;; Copyright (C) 1985, 1986, 1987, 1992, 1993, 1994, 1995, 1996,
-;;   1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-;;   2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+;;   1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+;;   2007, 2008, 2009, 2010  Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
@@ -574,6 +575,9 @@ Runs the usual ange-ftp hook, but only for completion operations."
          (inhibit-file-name-operation op))
       (apply op args))))
 
+(declare-function dos-convert-standard-filename "dos-fns.el" (filename))
+(declare-function w32-convert-standard-filename "w32-fns.el" (filename))
+
 (defun convert-standard-filename (filename)
   "Convert a standard file's name to something suitable for the OS.
 This means to guarantee valid names and perhaps to canonicalize
@@ -591,15 +595,20 @@ and also turn slashes into backslashes if the shell requires it (see
 `w32-shell-dos-semantics').
 
 See Info node `(elisp)Standard File Names' for more details."
-  (if (eq system-type 'cygwin)
-      (let ((name (copy-sequence filename))
-           (start 0))
-       ;; Replace invalid filename characters with !
-       (while (string-match "[?*:<>|\"\000-\037]" name start)
-              (aset name (match-beginning 0) ?!)
-         (setq start (match-end 0)))
-       name)
-    filename))
+  (cond
+   ((eq system-type 'cygwin)
+    (let ((name (copy-sequence filename))
+         (start 0))
+      ;; Replace invalid filename characters with !
+      (while (string-match "[?*:<>|\"\000-\037]" name start)
+       (aset name (match-beginning 0) ?!)
+       (setq start (match-end 0)))
+      name))
+   ((eq system-type 'windows-nt)
+    (w32-convert-standard-filename filename))
+   ((eq system-type 'ms-dos)
+    (dos-convert-standard-filename filename))
+   (t filename)))
 
 (defun read-directory-name (prompt &optional dir default-dirname mustmatch initial)
   "Read directory name, prompting with PROMPT and completing in directory DIR.
@@ -749,21 +758,44 @@ one or more of those symbols."
              (let ((x (file-name-directory suffix)))
                (if x (1- (length x)) (length suffix))))))
    (t
-    (let ((names nil)
+    (let ((names '())
+          ;; If we have files like "foo.el" and "foo.elc", we could load one of
+          ;; them with "foo.el", "foo.elc", or "foo", where just "foo" is the
+          ;; preferred way.  So if we list all 3, that gives a lot of redundant
+          ;; entries for the poor soul looking just for "foo".  OTOH, sometimes
+          ;; the user does want to pay attention to the extension.  We try to
+          ;; diffuse this tension by stripping the suffix, except when the
+          ;; result is a single element (i.e. usually we only list "foo" unless
+          ;; it's the only remaining element in the list, in which case we do
+          ;; list "foo", "foo.elc" and "foo.el").
+          (fullnames '())
          (suffix (concat (regexp-opt suffixes t) "\\'"))
          (string-dir (file-name-directory string))
           (string-file (file-name-nondirectory string)))
       (dolist (dir dirs)
-       (unless dir
-         (setq dir default-directory))
-       (if string-dir (setq dir (expand-file-name string-dir dir)))
-       (when (file-directory-p dir)
-         (dolist (file (file-name-all-completions
-                        string-file dir))
-           (push file names)
-           (when (string-match suffix file)
-             (setq file (substring file 0 (match-beginning 0)))
-              (push file names)))))
+        (unless dir
+          (setq dir default-directory))
+        (if string-dir (setq dir (expand-file-name string-dir dir)))
+        (when (file-directory-p dir)
+          (dolist (file (file-name-all-completions
+                         string-file dir))
+            (if (not (string-match suffix file))
+                (push file names)
+              (push file fullnames)
+              (push (substring file 0 (match-beginning 0)) names)))))
+      ;; Switching from names to names+fullnames creates a non-monotonicity
+      ;; which can cause problems with things like partial-completion.
+      ;; To minimize the problem, filter out completion-regexp-list, so that
+      ;; M-x load-library RET t/x.e TAB finds some files.
+      (if completion-regexp-list
+          (setq names (all-completions "" names)))
+      ;; Remove duplicates of the first element, so that we can easily check
+      ;; if `names' really only contains a single element.
+      (when (cdr names) (setcdr names (delete (car names) (cdr names))))
+      (unless (cdr names)
+        ;; There's no more than one matching non-suffixed element, so expand
+        ;; the list by adding the suffixed elements as well.
+        (setq names (nconc names fullnames)))
       (completion-table-with-context
        string-dir names string-file pred action)))))
 
@@ -2159,7 +2191,7 @@ in that case, this function acts as if `enable-local-variables' were t."
   (if (fboundp 'ucs-set-table-for-input) ; don't lose when building
       (ucs-set-table-for-input)))
 
-(defcustom auto-mode-case-fold nil
+(defcustom auto-mode-case-fold t
   "Non-nil means to try second pass through `auto-mode-alist'.
 This means that if the first case-sensitive search through the alist fails
 to find a matching major mode, a second case-insensitive search is made.
@@ -2252,15 +2284,14 @@ since only a single case-insensitive search through the alist is made."
      ;; The list of archive file extensions should be in sync with
      ;; `auto-coding-alist' with `no-conversion' coding system.
      ("\\.\\(\
-arc\\|zip\\|lzh\\|lha\\|zoo\\|[jew]ar\\|xpi\\|rar\\|\
-ARC\\|ZIP\\|LZH\\|LHA\\|ZOO\\|[JEW]AR\\|XPI\\|RAR\\)\\'" . archive-mode)
+arc\\|zip\\|lzh\\|lha\\|zoo\\|[jew]ar\\|xpi\\|rar\\|7z\\|\
+ARC\\|ZIP\\|LZH\\|LHA\\|ZOO\\|[JEW]AR\\|XPI\\|RAR\\|7Z\\)\\'" . archive-mode)
      ("\\.\\(sx[dmicw]\\|od[fgpst]\\|oxt\\)\\'" . archive-mode) ;OpenOffice.org
      ("\\.\\(deb\\|[oi]pk\\)\\'" . archive-mode) ; Debian/Opkg packages.
      ;; Mailer puts message to be edited in
      ;; /tmp/Re.... or Message
      ("\\`/tmp/Re" . text-mode)
      ("/Message[0-9]*\\'" . text-mode)
-     ("\\.zone\\'" . zone-mode)
      ;; some news reader is reported to use this
      ("\\`/tmp/fol/" . text-mode)
      ("\\.oak\\'" . scheme-mode)
@@ -2294,7 +2325,6 @@ ARC\\|ZIP\\|LZH\\|LHA\\|ZOO\\|[JEW]AR\\|XPI\\|RAR\\)\\'" . archive-mode)
      ("#\\*mail\\*" . mail-mode)
      ("\\.g\\'" . antlr-mode)
      ("\\.ses\\'" . ses-mode)
-     ("\\.\\(soa\\|zone\\)\\'" . dns-mode)
      ("\\.docbook\\'" . sgml-mode)
      ("\\.com\\'" . dcl-mode)
      ("/config\\.\\(?:bat\\|log\\)\\'" . fundamental-mode)
@@ -2404,7 +2434,8 @@ and `magic-mode-alist', which determines modes based on file contents.")
      ("pg" . text-mode)
      ("make" . makefile-gmake-mode)            ; Debian uses this
      ("guile" . scheme-mode)
-     ("clisp" . lisp-mode)))
+     ("clisp" . lisp-mode)
+     ("emacs" . emacs-lisp-mode)))
   "Alist mapping interpreter names to major modes.
 This is used for files whose first lines match `auto-mode-interpreter-regexp'.
 Each element looks like (INTERPRETER . MODE).
@@ -2767,15 +2798,19 @@ asking you for confirmation."
 
 (mapc (lambda (pair)
        (put (car pair) 'safe-local-variable (cdr pair)))
-      '((buffer-read-only     . booleanp)   ;; C source code
-       (default-directory    . stringp)    ;; C source code
-       (fill-column          . integerp)   ;; C source code
-       (indent-tabs-mode     . booleanp)   ;; C source code
-       (left-margin          . integerp)   ;; C source code
-       (no-update-autoloads  . booleanp)
-       (tab-width            . integerp)   ;; C source code
-       (truncate-lines       . booleanp)   ;; C source code
-       (word-wrap            . booleanp))) ;; C source code
+      '((buffer-read-only        . booleanp)   ;; C source code
+       (default-directory       . stringp)    ;; C source code
+       (fill-column             . integerp)   ;; C source code
+       (indent-tabs-mode        . booleanp)   ;; C source code
+       (left-margin             . integerp)   ;; C source code
+       (no-update-autoloads     . booleanp)
+       (tab-width               . integerp)   ;; C source code
+       (truncate-lines          . booleanp)   ;; C source code
+       (word-wrap               . booleanp) ;; C source code
+       (bidi-display-reordering . booleanp))) ;; C source code
+
+(put 'bidi-paragraph-direction 'safe-local-variable
+     (lambda (v) (memq v '(nil right-to-left left-to-right))))
 
 (put 'c-set-style 'safe-local-eval-function t)
 
@@ -3113,14 +3148,17 @@ is specified, returning t if it is specified."
          ;; Otherwise, set the variables.
          (enable-local-variables
           (hack-local-variables-filter result nil)
-          (when file-local-variables-alist
-            ;; Any 'evals must run in the Right sequence.
-            (setq file-local-variables-alist
-                  (nreverse file-local-variables-alist))
-            (run-hooks 'before-hack-local-variables-hook)
-            (dolist (elt file-local-variables-alist)
-              (hack-one-local-variable (car elt) (cdr elt))))
-          (run-hooks 'hack-local-variables-hook)))))
+          (hack-local-variables-apply)))))
+
+(defun hack-local-variables-apply ()
+  (when file-local-variables-alist
+    ;; Any 'evals must run in the Right sequence.
+    (setq file-local-variables-alist
+         (nreverse file-local-variables-alist))
+    (run-hooks 'before-hack-local-variables-hook)
+    (dolist (elt file-local-variables-alist)
+      (hack-one-local-variable (car elt) (cdr elt))))
+  (run-hooks 'hack-local-variables-hook))
 
 (defun safe-local-variable-p (sym val)
   "Non-nil if SYM is safe as a file-local variable with value VAL.
@@ -3414,15 +3452,14 @@ is found.  Returns the new class name."
 Store the directory-local variables in `dir-local-variables-alist'
 and `file-local-variables-alist', without applying them."
   (when (and enable-local-variables
-            (buffer-file-name)
-            (not (file-remote-p (buffer-file-name))))
+            (not (file-remote-p (or (buffer-file-name) default-directory))))
     ;; Find the variables file.
-    (let ((variables-file (dir-locals-find-file (buffer-file-name)))
+    (let ((variables-file (dir-locals-find-file (or (buffer-file-name) default-directory)))
          (class nil)
          (dir-name nil))
       (cond
        ((stringp variables-file)
-       (setq dir-name (file-name-directory (buffer-file-name)))
+       (setq dir-name (if (buffer-file-name) (file-name-directory (buffer-file-name)) default-directory))
        (setq class (dir-locals-read-from-file variables-file)))
        ((consp variables-file)
        (setq dir-name (nth 0 variables-file))
@@ -3439,6 +3476,10 @@ and `file-local-variables-alist', without applying them."
              (push elt dir-local-variables-alist))
            (hack-local-variables-filter variables dir-name)))))))
 
+(defun hack-dir-local-variables-non-file-buffer ()
+  (hack-dir-local-variables)
+  (hack-local-variables-apply))
+
 \f
 (defcustom change-major-mode-with-file-name t
   "Non-nil means \\[write-file] should set the major mode from the file name.
@@ -3618,10 +3659,13 @@ variable `make-backup-files'.  If it's done by renaming, then the file is
 no longer accessible under its old name.
 
 The value is non-nil after a backup was made by renaming.
-It has the form (MODES . BACKUPNAME).
+It has the form (MODES SELINUXCONTEXT BACKUPNAME).
 MODES is the result of `file-modes' on the original
 file; this means that the caller, after saving the buffer, should change
 the modes of the new file to agree with the old modes.
+SELINUXCONTEXT is the result of `file-selinux-context' on the original
+file; this means that the caller, after saving the buffer, should change
+the SELinux context of the new file to agree with the old context.
 BACKUPNAME is the backup file name, which is the old file renamed."
   (if (and make-backup-files (not backup-inhibited)
           (not buffer-backed-up)
@@ -3649,7 +3693,8 @@ BACKUPNAME is the backup file name, which is the old file renamed."
                            (or delete-old-versions
                                (y-or-n-p (format "Delete excess backup versions of %s? "
                                                  real-file-name)))))
-                     (modes (file-modes buffer-file-name)))
+                     (modes (file-modes buffer-file-name))
+                     (context (file-selinux-context buffer-file-name)))
                  ;; Actually write the back up file.
                  (condition-case ()
                      (if (or file-precious-flag
@@ -3669,10 +3714,10 @@ BACKUPNAME is the backup file name, which is the old file renamed."
                                                   (<= (nth 2 attr) backup-by-copying-when-privileged-mismatch)))
                                          (or (nth 9 attr)
                                              (not (file-ownership-preserved-p real-file-name)))))))
-                         (backup-buffer-copy real-file-name backupname modes)
+                         (backup-buffer-copy real-file-name backupname modes context)
                        ;; rename-file should delete old backup.
                        (rename-file real-file-name backupname t)
-                       (setq setmodes (cons modes backupname)))
+                       (setq setmodes (list modes context backupname)))
                    (file-error
                     ;; If trouble writing the backup, write it in ~.
                     (setq backupname (expand-file-name
@@ -3681,7 +3726,7 @@ BACKUPNAME is the backup file name, which is the old file renamed."
                     (message "Cannot write backup file; backing up in %s"
                              backupname)
                     (sleep-for 1)
-                    (backup-buffer-copy real-file-name backupname modes)))
+                    (backup-buffer-copy real-file-name backupname modes context)))
                  (setq buffer-backed-up t)
                  ;; Now delete the old versions, if desired.
                  (if delete-old-versions
@@ -3693,7 +3738,7 @@ BACKUPNAME is the backup file name, which is the old file renamed."
                  setmodes)
            (file-error nil))))))
 
-(defun backup-buffer-copy (from-name to-name modes)
+(defun backup-buffer-copy (from-name to-name modes context)
   (let ((umask (default-file-modes)))
     (unwind-protect
        (progn
@@ -3720,7 +3765,9 @@ BACKUPNAME is the backup file name, which is the old file renamed."
       ;; Reset the umask.
       (set-default-file-modes umask)))
   (and modes
-       (set-file-modes to-name (logand modes #o1777))))
+       (set-file-modes to-name (logand modes #o1777)))
+  (and context
+       (set-file-selinux-context to-name context)))
 
 (defun file-name-sans-versions (name &optional keep-backup-version)
   "Return file NAME sans backup versions or strings.
@@ -4250,7 +4297,9 @@ Before and after saving the buffer, this function runs
                  (nthcdr 10 (file-attributes buffer-file-name)))
            (if setmodes
                (condition-case ()
-                   (set-file-modes buffer-file-name (car setmodes))
+                   (progn
+                     (set-file-modes buffer-file-name (car setmodes))
+                     (set-file-selinux-context buffer-file-name (nth 1 setmodes)))
                  (error nil))))
          ;; If the auto-save file was recent before this command,
          ;; delete it now.
@@ -4263,7 +4312,7 @@ Before and after saving the buffer, this function runs
 ;; This does the "real job" of writing a buffer into its visited file
 ;; and making a backup file.  This is what is normally done
 ;; but inhibited if one of write-file-functions returns non-nil.
-;; It returns a value (MODES . BACKUPNAME), like backup-buffer.
+;; It returns a value (MODES SELINUXCONTEXT BACKUPNAME), like backup-buffer.
 (defun basic-save-buffer-1 ()
   (prog1
       (if save-buffer-coding-system
@@ -4275,7 +4324,7 @@ Before and after saving the buffer, this function runs
       (setq buffer-file-coding-system-explicit
            (cons last-coding-system-used nil)))))
 
-;; This returns a value (MODES . BACKUPNAME), like backup-buffer.
+;; This returns a value (MODES SELINUXCONTEXT BACKUPNAME), like backup-buffer.
 (defun basic-save-buffer-2 ()
   (let (tempsetmodes setmodes)
     (if (not (file-writable-p buffer-file-name))
@@ -4346,8 +4395,9 @@ Before and after saving the buffer, this function runs
            ;; Since we have created an entirely new file,
            ;; make sure it gets the right permission bits set.
            (setq setmodes (or setmodes
-                              (cons (or (file-modes buffer-file-name)
+                              (list (or (file-modes buffer-file-name)
                                         (logand ?\666 umask))
+                                    (file-selinux-context buffer-file-name)
                                     buffer-file-name)))
            ;; We succeeded in writing the temp file,
            ;; so rename it.
@@ -4358,8 +4408,11 @@ Before and after saving the buffer, this function runs
        ;; (setmodes is set) because that says we're superseding.
        (cond ((and tempsetmodes (not setmodes))
               ;; Change the mode back, after writing.
-              (setq setmodes (cons (file-modes buffer-file-name) buffer-file-name))
-              (set-file-modes buffer-file-name (logior (car setmodes) 128))))
+              (setq setmodes (list (file-modes buffer-file-name)
+                                   (file-selinux-context buffer-file-name)
+                                   buffer-file-name))
+              (set-file-modes buffer-file-name (logior (car setmodes) 128))
+              (set-file-selinux-context buffer-file-name (nth 1 setmodes)))))
        (let (success)
          (unwind-protect
              (progn
@@ -4373,8 +4426,8 @@ Before and after saving the buffer, this function runs
            ;; the backup by renaming, undo the backing-up.
            (and setmodes (not success)
                 (progn
-                  (rename-file (cdr setmodes) buffer-file-name t)
-                  (setq buffer-backed-up nil)))))))
+                  (rename-file (nth 2 setmodes) buffer-file-name t)
+                  (setq buffer-backed-up nil))))))
     setmodes))
 
 (defun diff-buffer-with-file (&optional buffer)
@@ -4610,16 +4663,17 @@ or multiple mail buffers, etc."
       (force-mode-line-update))))
 
 (defun make-directory (dir &optional parents)
-  "Create the directory DIR and any nonexistent parent dirs.
-If DIR already exists as a directory, signal an error, unless PARENTS is set.
+  "Create the directory DIR and optionally any nonexistent parent dirs.
+If DIR already exists as a directory, signal an error, unless
+PARENTS is non-nil.
 
-Interactively, the default choice of directory to create
-is the current default directory for file names.
-That is useful when you have visited a file in a nonexistent directory.
+Interactively, the default choice of directory to create is the
+current buffer's default directory.  That is useful when you have
+visited a file in a nonexistent directory.
 
-Noninteractively, the second (optional) argument PARENTS says whether
-to create parent directories if they don't exist.  Interactively,
-this happens by default."
+Noninteractively, the second (optional) argument PARENTS, if
+non-nil, says whether to create parent directories that don't
+exist.  Interactively, this happens by default."
   (interactive
    (list (read-file-name "Make directory: " default-directory default-directory
                         nil nil)
@@ -4650,19 +4704,30 @@ this happens by default."
   "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*"
   "Regexp matching any file name except \".\" and \"..\".")
 
-(defun delete-directory (directory &optional recursive)
+(defun delete-directory (directory &optional recursive trash)
   "Delete the directory named DIRECTORY.  Does not follow symlinks.
-If RECURSIVE is non-nil, all files in DIRECTORY are deleted as well."
+If RECURSIVE is non-nil, all files in DIRECTORY are deleted as well.
+TRASH non-nil means to trash the directory instead, provided
+`delete-by-moving-to-trash' is non-nil.
+
+When called interactively, TRASH is t if no prefix argument is
+given.  With a prefix argument, TRASH is nil."
   (interactive
-   (let ((dir (expand-file-name
-              (read-file-name
-               "Delete directory: "
-               default-directory default-directory nil nil))))
+   (let* ((trashing (and delete-by-moving-to-trash
+                        (null current-prefix-arg)))
+         (dir (expand-file-name
+               (read-file-name
+                (if trashing
+                    "Move directory to trash: "
+                  "Delete directory: ")
+                default-directory default-directory nil nil))))
      (list dir
           (if (directory-files dir nil directory-files-no-dot-files-regexp)
               (y-or-n-p
-               (format "Directory `%s' is not empty, really delete? " dir))
-            nil))))
+               (format "Directory `%s' is not empty, really %s? "
+                       dir (if trashing "trash" "delete")))
+            nil)
+          (null current-prefix-arg))))
   ;; If default-directory is a remote directory, make sure we find its
   ;; delete-directory handler.
   (setq directory (directory-file-name (expand-file-name directory)))
@@ -4670,7 +4735,7 @@ If RECURSIVE is non-nil, all files in DIRECTORY are deleted as well."
     (cond
      (handler
       (funcall handler 'delete-directory directory recursive))
-     (delete-by-moving-to-trash
+     ((and delete-by-moving-to-trash trash)
       ;; Only move non-empty dir to trash if recursive deletion was
       ;; requested.  This mimics the non-`delete-by-moving-to-trash'
       ;; case, where the operation fails in delete-directory-internal.
@@ -4690,8 +4755,8 @@ If RECURSIVE is non-nil, all files in DIRECTORY are deleted as well."
                  ;; (and (file-directory-p fn) (not (file-symlink-p fn)))
                  ;; but more efficient
                  (if (eq t (car (file-attributes file)))
-                     (delete-directory file recursive)
-                   (delete-file file)))
+                     (delete-directory file recursive nil)
+                   (delete-file file nil)))
                ;; We do not want to delete "." and "..".
                (directory-files
                 directory 'full directory-files-no-dot-files-regexp)))
@@ -5135,30 +5200,6 @@ The optional second argument indicates whether to kill internal buffers too."
         (kill-buffer-ask buffer)))))
 
 \f
-(defun auto-save-mode (arg)
-  "Toggle auto-saving of contents of current buffer.
-With prefix argument ARG, turn auto-saving on if positive, else off."
-  (interactive "P")
-  (setq buffer-auto-save-file-name
-        (and (if (null arg)
-                (or (not buffer-auto-save-file-name)
-                    ;; If auto-save is off because buffer has shrunk,
-                    ;; then toggling should turn it on.
-                    (< buffer-saved-size 0))
-              (or (eq arg t) (listp arg) (and (integerp arg) (> arg 0))))
-            (if (and buffer-file-name auto-save-visited-file-name
-                     (not buffer-read-only))
-                buffer-file-name
-              (make-auto-save-file-name))))
-  ;; If -1 was stored here, to temporarily turn off saving,
-  ;; turn it back on.
-  (and (< buffer-saved-size 0)
-       (setq buffer-saved-size 0))
-  (if (called-interactively-p 'interactive)
-      (message "Auto-save %s (in this buffer)"
-              (if buffer-auto-save-file-name "on" "off")))
-  buffer-auto-save-file-name)
-
 (defun rename-auto-save-file ()
   "Adjust current buffer's auto save file name for current conditions.
 Also rename any existing auto save file, if it was made in this session."
index 9458fdfec434b8ea63db846643c8ecf2435010d9..0c8229c8f7aee91810137ca4529540428d788241 100644 (file)
@@ -99,7 +99,7 @@ The command run (after changing into DIR) is
 
 except that the variable `find-ls-option' specifies what to use
 as the final argument."
-  (interactive (list (read-file-name "Run find in directory: " nil "" t)
+  (interactive (list (read-directory-name "Run find in directory: " nil "" t)
                     (read-string "Run find (with args): " find-args
                                  '(find-args-history . 1))))
   (let ((dired-buffers dired-buffers))
index 682fc1d4ae2f0c245e1ab4c3bdd6ff753070215f..0c12a08d10410dcee990332d01199a7f001cfb1d 100644 (file)
 
 ;; This mode uses the Keywords library header to provide code-finding
 ;; services by keyword.
-;;
-;; Things to do:
-;;    1. Support multiple keywords per search.  This could be extremely hairy;
-;; there doesn't seem to be any way to get completing-read to exit on
-;; an EOL with no substring pending, which is what we'd want to end the loop.
-;;    2. Search by string in synopsis line?
-;;    3. Function to check finder-package-info for unknown keywords.
 
 ;;; Code:
 
+(require 'package)
 (require 'lisp-mnt)
-(require 'find-func)                   ;for find-library(-suffixes)
-;; Use `load' rather than `require' so that it doesn't get loaded
-;; during byte-compilation (at which point it might be missing).
-(load "finder-inf" t t)
+(require 'find-func) ;for find-library(-suffixes)
+(require 'finder-inf nil t)
 
 ;; These are supposed to correspond to top-level customization groups,
 ;; says rms.
 (defvar finder-known-keywords
-  '(
-    (abbrev    . "abbreviation handling, typing shortcuts, macros")
-    ;; Too specific:
-    (bib       . "code related to the `bib' bibliography processor")
-    (c         . "support for the C language and related languages")
-    (calendar  . "calendar and time management support")
-    (comm      . "communications, networking, remote access to files")
+  '((abbrev    . "abbreviation handling, typing shortcuts, and macros")
+    (bib       . "bibliography processors")
+    (c         . "C and related programming languages")
+    (calendar  . "calendar and time management tools")
+    (comm      . "communications, networking, and remote file access")
     (convenience . "convenience features for faster editing")
-    (data      . "support for editing files of data")
-    (docs      . "support for Emacs documentation")
+    (data      . "editing data (non-text) files")
+    (docs      . "Emacs documentation facilities")
     (emulations        . "emulations of other editors")
     (extensions        . "Emacs Lisp language extensions")
-    (faces     . "support for multiple fonts")
-    (files      . "support for editing and manipulating files")
-    (frames     . "support for Emacs frames and window systems")
+    (faces     . "fonts and colors for text")
+    (files      . "file editing and manipulation")
+    (frames     . "Emacs frames and window systems")
     (games     . "games, jokes and amusements")
-    (hardware  . "support for interfacing with exotic hardware")
-    (help      . "support for on-line help systems")
-    (hypermedia . "support for links between text or other media types")
-    (i18n      . "internationalization and alternate character-set support")
+    (hardware  . "interfacing with system hardware")
+    (help      . "on-line help systems")
+    (hypermedia . "links between text or other media types")
+    (i18n      . "internationalization and character-set support")
     (internal  . "code for Emacs internals, build process, defaults")
     (languages . "specialized modes for editing programming languages")
     (lisp      . "Lisp support, including Emacs Lisp")
     (local     . "code local to your site")
-    (maint     . "maintenance aids for the Emacs development group")
-    (mail      . "modes for electronic-mail handling")
-    (matching  . "various sorts of searching and matching")
+    (maint     . "Emacs development tools and aids")
+    (mail      . "email reading and posting")
+    (matching  . "searching, matching, and sorting")
     (mouse     . "mouse support")
-    (multimedia . "images and sound support")
-    (news      . "support for netnews reading and posting")
-    (oop        . "support for object-oriented programming")
-    (outlines   . "support for hierarchical outlining")
-    (processes . "process, subshell, compilation, and job control support")
-    (terminals . "support for terminal types")
-    (tex       . "supporting code for the TeX formatter")
+    (multimedia . "images and sound")
+    (news      . "USENET news reading and posting")
+    (outlines   . "hierarchical outlining and note taking")
+    (processes . "processes, subshells, and compilation")
+    (terminals . "text terminals (ttys)")
+    (tex       . "the TeX document formatter")
     (tools     . "programming tools")
-    (unix      . "front-ends/assistants for, or emulators of, UNIX-like features")
-    (wp                . "word processing")
-    ))
+    (unix      . "UNIX feature interfaces and emulators")
+    (vc                . "version control")
+    (wp                . "word processing")))
 
 (defvar finder-mode-map
   (let ((map (make-sparse-keymap))
 
 ;;; Code for regenerating the keyword list.
 
-(defvar finder-package-info nil
-  "Assoc list mapping file names to description & keyword lists.")
+(defvar finder-keywords-hash nil
+  "Hash table mapping keywords to lists of package names.
+Keywords and package names both should be symbols.")
 
 (defvar generated-finder-keywords-file "finder-inf.el"
   "The function `finder-compile-keywords' writes keywords into this file.")
@@ -148,10 +138,91 @@ cus-load\\|finder-inf\\|esh-groups\\|subdirs\\)\\.el$\\)"
 
 (autoload 'autoload-rubric "autoload")
 
+(defvar finder--builtins-alist
+  '(("calc" . calc)
+    ("ede"  . ede)
+    ("erc"  . erc)
+    ("eshell" . eshell)
+    ("gnus" . gnus)
+    ("international" . emacs)
+    ("language" . emacs)
+    ("mh-e" . mh-e)
+    ("semantic" . semantic)
+    ("analyze" . semantic)
+    ("bovine" . semantic)
+    ("decorate" . semantic)
+    ("symref" . semantic)
+    ("wisent" . semantic)
+    ("nxml" . nxml)
+    ("org"  . org)
+    ("srecode" . srecode)
+    ("term" . emacs)
+    ("url"  . url))
+  "Alist of built-in package directories.
+Each element should have the form (DIR . PACKAGE), where DIR is a
+directory name and PACKAGE is the name of a package (a symbol).
+When generating `package--builtins', Emacs assumes any file in
+DIR is part of the package PACKAGE.")
+
 (defun finder-compile-keywords (&rest dirs)
-  "Regenerate the keywords association list into `generated-finder-keywords-file'.
-Optional arguments DIRS are a list of Emacs Lisp directories to compile from;
-no arguments compiles from `load-path'."
+  "Regenerate list of built-in Emacs packages.
+This recomputes `package--builtins' and `finder-keywords-hash',
+and prints them into the file `generated-finder-keywords-file'.
+
+Optional DIRS is a list of Emacs Lisp directories to compile
+from; the default is `load-path'."
+  ;; Allow compressed files also.
+  (setq package--builtins nil)
+  (setq finder-keywords-hash (make-hash-table :test 'eq))
+  (let ((el-file-regexp "^\\([^=].*\\)\\.el\\(\\.\\(gz\\|Z\\)\\)?$")
+       package-override files base-name processed
+       summary keywords package version entry desc)
+    (dolist (d (or dirs load-path))
+      (when (file-exists-p (directory-file-name d))
+       (message "Directory %s" d)
+       (setq package-override
+             (intern-soft
+              (cdr-safe
+               (assoc (file-name-nondirectory (directory-file-name d))
+                      finder--builtins-alist))))
+       (setq files (directory-files d nil el-file-regexp))
+       (dolist (f files)
+         (unless (or (string-match finder-no-scan-regexp f)
+                     (null (setq base-name
+                                 (and (string-match el-file-regexp f)
+                                      (intern (match-string 1 f)))))
+                     (memq base-name processed))
+           (push base-name processed)
+           (with-temp-buffer
+             (insert-file-contents (expand-file-name f d))
+             (setq summary  (lm-synopsis)
+                   keywords (mapcar 'intern (lm-keywords-list))
+                   package  (or package-override
+                                (intern-soft (lm-header "package"))
+                                base-name)
+                   version  (lm-header "version")))
+           (when summary
+             (setq version (ignore-errors (version-to-list version)))
+             (setq entry (assq package package--builtins))
+             (cond ((null entry)
+                    (push (cons package (vector version nil summary))
+                          package--builtins))
+                   ((eq base-name package)
+                    (setq desc (cdr entry))
+                    (aset desc 0 version)
+                    (aset desc 2 summary)))
+             (dolist (kw keywords)
+               (puthash kw
+                        (cons package
+                              (delq package
+                                    (gethash kw finder-keywords-hash)))
+                        finder-keywords-hash))))))))
+
+  (setq package--builtins
+       (sort package--builtins
+             (lambda (a b) (string< (symbol-name (car a))
+                                    (symbol-name (car b))))))
+
   (save-excursion
     (find-file generated-finder-keywords-file)
     (setq buffer-undo-list t)
@@ -159,40 +230,16 @@ no arguments compiles from `load-path'."
     (insert (autoload-rubric generated-finder-keywords-file
                              "keyword-to-package mapping" t))
     (search-backward "\f")
-    (insert "(setq finder-package-info '(\n")
-    (let (processed summary keywords)
-      (mapc
-       (lambda (d)
-        (when (file-exists-p (directory-file-name d))
-          (message "Directory %s" d)
-          (mapc
-           (lambda (f)
-              ;; FIXME should this not be using (expand-file-name f d)?
-             (unless (or (member f processed)
-                          (string-match finder-no-scan-regexp f))
-                (setq processed (cons f processed))
-                (with-temp-buffer
-                  (insert-file-contents (expand-file-name f d))
-                  (setq summary (lm-synopsis)
-                        keywords (lm-keywords-list)))
-                (insert
-                 (format "    (\"%s\"\n        "
-                         (if (string-match "\\.\\(gz\\|Z\\)$" f)
-                             (file-name-sans-extension f)
-                           f)))
-                (prin1 summary (current-buffer))
-                (insert "\n        ")
-                (princ keywords (current-buffer))
-                (insert ")\n")))
-           (directory-files d nil
-                             ;; Allow compressed files also.  FIXME:
-                             ;; generalize this, especially for
-                             ;; MS-DOG-type filenames.
-                             "^[^=].*\\.el\\(\\.\\(gz\\|Z\\)\\)?$"
-                             ))))
-       (or dirs load-path)))
-    (insert "    ))\n")
-    (eval-buffer)         ; so we get the new keyword list immediately
+    (insert "(setq package--builtins '(\n")
+    (dolist (package package--builtins)
+      (insert "  ")
+      (prin1 package (current-buffer))
+      (insert "\n"))
+    (insert "))\n\n")
+    ;; Insert hash table.
+    (insert "(setq finder-keywords-hash\n      ")
+    (prin1 finder-keywords-hash (current-buffer))
+    (insert ")\n")
     (basic-save-buffer)))
 
 (defun finder-compile-keywords-make-dist ()
@@ -230,6 +277,17 @@ no arguments compiles from `load-path'."
      '(mouse-face highlight
                  help-echo finder-help-echo))))
 
+(defun finder-unknown-keywords ()
+  "Return an alist of unknown keywords and number of their occurences.
+Unknown keywords are those present in `finder-keywords-hash' but
+not `finder-known-keywords'."
+  (let (alist)
+    (maphash (lambda (kw packages)
+              (unless (assq kw finder-known-keywords)
+                (push (cons kw (length packages)) alist)))
+            finder-keywords-hash)
+    (sort alist (lambda (a b) (string< (car a) (car b))))))
+
 ;;;###autoload
 (defun finder-list-keywords ()
   "Display descriptions of the keywords in the Finder buffer."
@@ -238,46 +296,27 @@ no arguments compiles from `load-path'."
       (pop-to-buffer "*Finder*")
     (pop-to-buffer (get-buffer-create "*Finder*"))
     (finder-mode)
-    (setq buffer-read-only nil
-          buffer-undo-list t)
-    (erase-buffer)
-    (mapc
-     (lambda (assoc)
-       (let ((keyword (car assoc)))
-        (insert (symbol-name keyword))
-        (finder-insert-at-column 14 (concat (cdr assoc) "\n"))
-        (finder-mouse-face-on-line)))
-     finder-known-keywords)
-    (goto-char (point-min))
-    (setq finder-headmark (point)
-          buffer-read-only t)
-    (set-buffer-modified-p nil)
-    (balance-windows)
-    (finder-summary)))
+    (let ((inhibit-read-only t))
+      (erase-buffer)
+      (dolist (assoc finder-known-keywords)
+       (let ((keyword (car assoc)))
+         (insert (propertize (symbol-name keyword)
+                             'font-lock-face 'font-lock-constant-face))
+         (finder-insert-at-column 14 (concat (cdr assoc) "\n"))
+         (finder-mouse-face-on-line)))
+      (goto-char (point-min))
+      (setq finder-headmark (point)
+           buffer-read-only t)
+      (set-buffer-modified-p nil)
+      (balance-windows)
+      (finder-summary))))
 
 (defun finder-list-matches (key)
-  (pop-to-buffer (set-buffer (get-buffer-create "*Finder Category*")))
-  (finder-mode)
-  (setq buffer-read-only nil
-         buffer-undo-list t)
-  (erase-buffer)
-  (let ((id (intern key)))
-    (insert
-     "The following packages match the keyword `" key "':\n\n")
-    (setq finder-headmark (point))
-    (mapc
-     (lambda (x)
-       (when (memq id (cadr (cdr x)))
-         (insert (car x))
-         (finder-insert-at-column 16 (concat (cadr x) "\n"))
-         (finder-mouse-face-on-line)))
-     finder-package-info)
-    (goto-char (point-min))
-    (forward-line)
-    (setq buffer-read-only t)
-    (set-buffer-modified-p nil)
-    (shrink-window-if-larger-than-buffer)
-    (finder-summary)))
+  (let* ((id (intern key))
+        (packages (gethash id finder-keywords-hash)))
+    (unless packages
+      (error "No packages matching key `%s'" key))
+    (package--list-packages packages)))
 
 (define-button-type 'finder-xref 'action #'finder-goto-xref)
 
@@ -364,8 +403,8 @@ FILE should be in a form suitable for passing to `locate-library'."
 \\[finder-select]      more help for the item on the current line
 \\[finder-exit]        exit Finder mode and kill the Finder buffer."
   :syntax-table finder-mode-syntax-table
-  (setq font-lock-defaults '(finder-font-lock-keywords nil nil
-                             (("+-*/.<>=!?$%_&~^:@" . "w")) nil))
+  (setq buffer-read-only t
+       buffer-undo-list t)
   (set (make-local-variable 'finder-headmark) nil))
 
 (defun finder-summary ()
@@ -382,8 +421,8 @@ finder directory, \\[finder-exit] = quit, \\[finder-summary] = help")))
 Delete the window and kill all Finder-related buffers."
   (interactive)
   (ignore-errors (delete-window))
-  (dolist (buff '("*Finder*" "*Finder-package*" "*Finder Category*"))
-    (and (get-buffer buff) (kill-buffer buff))))
+  (let ((buf "*Finder*"))
+    (and (get-buffer buf) (kill-buffer buf))))
 
 \f
 (provide 'finder)
index bee9227639c2755ccfa346470caa0695955589cd..4c7ef29a072ac811a7808500b4a8da34b491f7ab 100644 (file)
@@ -6,7 +6,7 @@
 ;; Author: Kevin Broadey <KevinB@bartley.demon.co.uk>
 ;; Maintainer: FSF
 ;; Created: 27 Jan 1994
-;; Version: foldout.el 1.10 dated 94/05/19 at 17:09:12
+;; Version: 1.10
 ;; Keywords: folding, outlines
 
 ;; This file is part of GNU Emacs.
index d33295b3c34a3edb15e56845b068cc738fd47741..a8b72539d5d204dcfdcb644171257e212735ff7f 100644 (file)
@@ -6,6 +6,7 @@
 
 ;; Maintainer: FSF
 ;; Keywords: languages, faces
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
index b4a2a72eee835972c8bb06c0af0ff86e6c163b6f..bfea0dabfe26a531281d2841565a8b2c7e44e452 100644 (file)
@@ -9,6 +9,7 @@
 ;;     Stefan Monnier
 ;; Maintainer: FSF
 ;; Keywords: languages, faces
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
 ;;; Code:
 
 (require 'syntax)
+(eval-when-compile (require 'cl))
 
 ;; Define core `font-lock' group.
 (defgroup font-lock '((jit-lock custom-group))
@@ -613,21 +615,10 @@ Major/minor modes can set this variable if they know which option applies.")
   (defmacro save-buffer-state (varlist &rest body)
     "Bind variables according to VARLIST and eval BODY restoring buffer state."
     (declare (indent 1) (debug let))
-    (let ((modified (make-symbol "modified")))
-      `(let* ,(append varlist
-                     `((,modified (buffer-modified-p))
-                       (buffer-undo-list t)
-                       (inhibit-read-only t)
-                       (inhibit-point-motion-hooks t)
-                       (inhibit-modification-hooks t)
-                       deactivate-mark
-                       buffer-file-name
-                       buffer-file-truename))
-        (unwind-protect
-            (progn
-              ,@body)
-          (unless ,modified
-            (restore-buffer-modified-p nil))))))
+    `(let* ,(append varlist
+                    `((inhibit-point-motion-hooks t)))
+       (with-silent-modifications
+         ,@body)))
   ;;
   ;; Shut up the byte compiler.
   (defvar font-lock-face-attributes))  ; Obsolete but respected if set.
@@ -902,26 +893,24 @@ 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 ()
-  (let ((thing-mode (font-lock-value-in-major-mode font-lock-support-mode)))
-    (cond ((eq thing-mode 'fast-lock-mode)
-          (fast-lock-mode t))
-         ((eq thing-mode 'lazy-lock-mode)
-          (lazy-lock-mode t))
-         ((eq thing-mode 'jit-lock-mode)
-          ;; Prepare for jit-lock
-          (remove-hook 'after-change-functions
-                       'font-lock-after-change-function t)
-          (set (make-local-variable 'font-lock-fontify-buffer-function)
-               'jit-lock-refontify)
-          ;; Don't fontify eagerly (and don't abort if the buffer is large).
-          (set (make-local-variable 'font-lock-fontified) t)
-          ;; Use jit-lock.
-          (jit-lock-register 'font-lock-fontify-region
-                             (not font-lock-keywords-only))
-           ;; Tell jit-lock how we extend the region to refontify.
-           (add-hook 'jit-lock-after-change-extend-region-functions
-                     'font-lock-extend-jit-lock-region-after-change
-                     nil t)))))
+  (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
+     ;; Prepare for jit-lock
+     (remove-hook 'after-change-functions
+                  'font-lock-after-change-function t)
+     (set (make-local-variable 'font-lock-fontify-buffer-function)
+          'jit-lock-refontify)
+     ;; Don't fontify eagerly (and don't abort if the buffer is large).
+     (set (make-local-variable 'font-lock-fontified) t)
+     ;; Use jit-lock.
+     (jit-lock-register 'font-lock-fontify-region
+                        (not font-lock-keywords-only))
+     ;; Tell jit-lock how we extend the region to refontify.
+     (add-hook 'jit-lock-after-change-extend-region-functions
+               'font-lock-extend-jit-lock-region-after-change
+               nil t))))
 
 (defun font-lock-turn-off-thing-lock ()
   (cond ((bound-and-true-p fast-lock-mode)
@@ -1125,38 +1114,33 @@ Put first the functions more likely to cause a change and cheaper to compute.")
 (defun font-lock-default-fontify-region (beg end loudly)
   (save-buffer-state
       ((parse-sexp-lookup-properties
-        (or parse-sexp-lookup-properties font-lock-syntactic-keywords))
-       (old-syntax-table (syntax-table)))
-    (unwind-protect
-       (save-restriction
-         (unless font-lock-dont-widen (widen))
-         ;; Use the fontification syntax table, if any.
-         (when font-lock-syntax-table
-           (set-syntax-table font-lock-syntax-table))
-          ;; Extend the region to fontify so that it starts and ends at
-          ;; safe places.
-          (let ((funs font-lock-extend-region-functions)
-                (font-lock-beg beg)
-                (font-lock-end end))
-            (while funs
-              (setq funs (if (or (not (funcall (car funs)))
-                                 (eq funs font-lock-extend-region-functions))
-                             (cdr funs)
-                           ;; If there's been a change, we should go through
-                           ;; the list again since this new position may
-                           ;; warrant a different answer from one of the fun
-                           ;; we've already seen.
-                           font-lock-extend-region-functions)))
-            (setq beg font-lock-beg end font-lock-end))
-         ;; Now do the fontification.
-         (font-lock-unfontify-region beg end)
-         (when font-lock-syntactic-keywords
-           (font-lock-fontify-syntactic-keywords-region beg end))
-         (unless font-lock-keywords-only
-           (font-lock-fontify-syntactically-region beg end loudly))
-         (font-lock-fontify-keywords-region beg end loudly))
-      ;; Clean up.
-      (set-syntax-table old-syntax-table))))
+        (or parse-sexp-lookup-properties font-lock-syntactic-keywords)))
+    ;; Use the fontification syntax table, if any.
+    (with-syntax-table (or font-lock-syntax-table (syntax-table))
+      (save-restriction
+        (unless font-lock-dont-widen (widen))
+        ;; Extend the region to fontify so that it starts and ends at
+        ;; safe places.
+        (let ((funs font-lock-extend-region-functions)
+              (font-lock-beg beg)
+              (font-lock-end end))
+          (while funs
+            (setq funs (if (or (not (funcall (car funs)))
+                               (eq funs font-lock-extend-region-functions))
+                           (cdr funs)
+                         ;; If there's been a change, we should go through
+                         ;; the list again since this new position may
+                         ;; warrant a different answer from one of the fun
+                         ;; we've already seen.
+                         font-lock-extend-region-functions)))
+          (setq beg font-lock-beg end font-lock-end))
+        ;; Now do the fontification.
+        (font-lock-unfontify-region beg end)
+        (when font-lock-syntactic-keywords
+          (font-lock-fontify-syntactic-keywords-region beg end))
+        (unless font-lock-keywords-only
+          (font-lock-fontify-syntactically-region beg end loudly))
+        (font-lock-fontify-keywords-region beg end loudly)))))
 
 ;; The following must be rethought, since keywords can override fontification.
 ;;    ;; Now scan for keywords, but not if we are inside a comment now.
@@ -2284,14 +2268,17 @@ in which C preprocessor directives are used. e.g. `asm-mode' and
                 "inline" "lambda" "save-restriction" "save-excursion"
                 "save-selected-window" "save-window-excursion"
                 "save-match-data" "save-current-buffer"
-                "unwind-protect" "condition-case" "track-mouse"
-                "eval-after-load" "eval-and-compile" "eval-when-compile"
-                "eval-when" "eval-next-after-load"
+                "combine-after-change-calls" "unwind-protect"
+                "condition-case" "condition-case-no-debug"
+                "track-mouse" "eval-after-load" "eval-and-compile"
+                "eval-when-compile" "eval-when" "eval-next-after-load"
                 "with-case-table" "with-category-table"
-                "with-current-buffer" "with-electric-help"
+                "with-current-buffer" "with-demoted-errors"
+                "with-electric-help"
                 "with-local-quit" "with-no-warnings"
                 "with-output-to-string" "with-output-to-temp-buffer"
-                "with-selected-window" "with-selected-frame" "with-syntax-table"
+                "with-selected-window" "with-selected-frame"
+                "with-silent-modifications" "with-syntax-table"
                 "with-temp-buffer" "with-temp-file" "with-temp-message"
                 "with-timeout" "with-timeout-handler") t)
          "\\>")
index d4262e2d0e694dd2d9cf7f6adfb0dc6e36ee83db..0436187d984c1ee163c5fea063b5bdfc9793d840 100644 (file)
@@ -4,6 +4,7 @@
 ;;   2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
 
 ;; Author: Boris Goldowsky <boris@gnu.org>
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
index acb86dcc194bde323f0b034aaafa40a47a045edf..50f7ac9f506ac48fb44a37a021b98074b7cee122 100644 (file)
@@ -1407,7 +1407,9 @@ Commands:                        Equivalent keys in read-only mode:
   (if forms-forms-scroll
       (progn
        (local-set-key [remap scroll-up] 'forms-next-record)
-       (local-set-key [remap scroll-down] 'forms-prev-record)))
+       (local-set-key [remap scroll-down] 'forms-prev-record)
+       (local-set-key [remap scroll-up-command] 'forms-next-record)
+       (local-set-key [remap scroll-down-command] 'forms-prev-record)))
   ;;
   ;; beginning-of-buffer -> forms-first-record
   ;; end-of-buffer -> forms-end-record
index 0628db7ee389f09da00edef7f26d685eec822e0f..8f65cc7f1e56f3cb83a718526bf098bec2710310 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Maintainer: FSF
 ;; Keywords: internal
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
@@ -24,6 +25,7 @@
 ;;; Commentary:
 
 ;;; Code:
+(eval-when-compile (require 'cl))
 
 (defvar frame-creation-function-alist
   (list (cons nil
@@ -38,13 +40,6 @@ as its argument.")
 
 (defvar window-system-default-frame-alist nil
   "Alist of window-system dependent default frame parameters.
-You can set this in your init file; for example,
-
- ;; Disable menubar and toolbar on the console, but enable them under X.
- (setq window-system-default-frame-alist
-       '((x (menu-bar-lines . 1) (tool-bar-lines . 1))
-         (nil (menu-bar-lines . 0) (tool-bar-lines . 0))))
-
 Parameters specified here supersede the values given in
 `default-frame-alist'.")
 
@@ -286,36 +281,6 @@ and (cdr ARGS) as second."
 React to settings of `initial-frame-alist',
 `window-system-default-frame-alist' and `default-frame-alist'
 there (in decreasing order of priority)."
-  ;; Make menu-bar-mode and default-frame-alist consistent.
-  (when (boundp 'menu-bar-mode)
-    (let ((default (assq 'menu-bar-lines default-frame-alist)))
-      (if default
-         (setq menu-bar-mode (not (eq (cdr default) 0)))
-       (setq default-frame-alist
-             (cons (cons 'menu-bar-lines (if menu-bar-mode 1 0))
-                   default-frame-alist)))))
-
-  ;; Make tool-bar-mode and default-frame-alist consistent.  Don't do
-  ;; it in batch mode since that would leave a tool-bar-lines
-  ;; parameter in default-frame-alist in a dumped Emacs, which is not
-  ;; what we want.
-  (when (and (boundp 'tool-bar-mode)
-            (not noninteractive))
-    (let ((default (assq 'tool-bar-lines default-frame-alist)))
-      (if default
-         (setq tool-bar-mode (not (eq (cdr default) 0)))
-       ;; If Emacs was started on a tty, changing default-frame-alist
-       ;; would disable the toolbar on X frames created later.  We
-       ;; want to keep the default of showing a toolbar under X even
-       ;; in this case.
-       ;;
-       ;; If the user explicitly called `tool-bar-mode' in .emacs,
-       ;; then default-frame-alist is already changed anyway.
-       (when initial-window-system
-         (setq default-frame-alist
-               (cons (cons 'tool-bar-lines (if tool-bar-mode 1 0))
-                     default-frame-alist))))))
-
   ;; Creating and deleting frames may shift the selected frame around,
   ;; and thus the current buffer.  Protect against that.  We don't
   ;; want to use save-excursion here, because that may also try to set
@@ -719,15 +684,17 @@ The functions are run with one arg, the newly created frame.")
 
 (defun make-frame (&optional parameters)
   "Return a newly created frame displaying the current buffer.
-Optional argument PARAMETERS is an alist of parameters for the new frame.
-Each element of PARAMETERS should have the form (NAME . VALUE), for example:
+Optional argument PARAMETERS is an alist of frame parameters for
+the new frame.  Each element of PARAMETERS should have the
+form (NAME . VALUE), for example:
 
  (name . STRING)       The frame should be named STRING.
 
  (width . NUMBER)      The frame should be NUMBER characters in width.
  (height . NUMBER)     The frame should be NUMBER text lines high.
 
-You cannot specify either `width' or `height', you must use neither or both.
+You cannot specify either `width' or `height', you must specify
+neither or both.
 
  (minibuffer . t)      The frame should have a minibuffer.
  (minibuffer . nil)    The frame should have no minibuffer.
@@ -739,15 +706,17 @@ You cannot specify either `width' or `height', you must use neither or both.
 
  (terminal . TERMINAL)  The frame should use the terminal object TERMINAL.
 
-Before the frame is created (via `frame-creation-function-alist'), functions on the
-hook `before-make-frame-hook' are run.  After the frame is created, functions
-on `after-make-frame-functions' are run with one arg, the newly created frame.
+In addition, any parameter specified in `default-frame-alist',
+but not present in PARAMETERS, is applied.
+
+Before creating the frame (via `frame-creation-function-alist'),
+this function runs the hook `before-make-frame-hook'.  After
+creating the frame, it runs the hook `after-make-frame-functions'
+with one arg, the newly created frame.
 
-This function itself does not make the new frame the selected frame.
-The previously selected frame remains selected.  However, the
-window system may select the new frame for its own reasons, for
-instance if the frame appears under the mouse pointer and your
-setup is for focus to follow the pointer."
+On graphical displays, this function does not itself make the new
+frame the selected frame.  However, the window system may select
+the new frame according to its own rules."
   (interactive)
   (let* ((w (cond
             ((assq 'terminal parameters)
@@ -762,14 +731,21 @@ setup is for focus to follow the pointer."
             (t window-system)))
         (frame-creation-function (cdr (assq w frame-creation-function-alist)))
         (oldframe (selected-frame))
+        (params parameters)
         frame)
     (unless frame-creation-function
       (error "Don't know how to create a frame on window system %s" w))
+    ;; Add parameters from `window-system-default-frame-alist'.
+    (dolist (p (cdr (assq w window-system-default-frame-alist)))
+      (unless (assq (car p) params)
+       (push p params)))
+    ;; Add parameters from `default-frame-alist'.
+    (dolist (p default-frame-alist)
+      (unless (assq (car p) params)
+       (push p params)))
+    ;; Now make the frame.
     (run-hooks 'before-make-frame-hook)
-    (setq frame
-          (funcall frame-creation-function
-                   (append parameters
-                           (cdr (assq w window-system-default-frame-alist)))))
+    (setq frame (funcall frame-creation-function params))
     (normal-erase-is-backspace-setup-frame frame)
     ;; Inherit the original frame's parameters.
     (dolist (param frame-inherited-parameters)
@@ -1132,37 +1108,26 @@ To get the frame's current border color, use `frame-parameters'."
   (modify-frame-parameters (selected-frame)
                           (list (cons 'border-color color-name))))
 
-(defun auto-raise-mode (arg)
+(define-minor-mode auto-raise-mode
   "Toggle whether or not the selected frame should auto-raise.
 With ARG, turn auto-raise mode on if and only if ARG is positive.
 Note that this controls Emacs's own auto-raise feature.
 Some window managers allow you to enable auto-raise for certain windows.
 You can use that for Emacs windows if you wish, but if you do,
 that is beyond the control of Emacs and this command has no effect on it."
-  (interactive "P")
-  (if (null arg)
-      (setq arg
-           (if (cdr (assq 'auto-raise (frame-parameters (selected-frame))))
-               -1 1)))
-  (if (> arg 0)
-      (raise-frame (selected-frame)))
-  (modify-frame-parameters (selected-frame)
-                          (list (cons 'auto-raise (> arg 0)))))
+  :variable (frame-parameter nil 'auto-raise)
+  (if (frame-parameter nil 'auto-raise)
+      (raise-frame)))
 
-(defun auto-lower-mode (arg)
+(define-minor-mode auto-lower-mode
   "Toggle whether or not the selected frame should auto-lower.
 With ARG, turn auto-lower mode on if and only if ARG is positive.
 Note that this controls Emacs's own auto-lower feature.
 Some window managers allow you to enable auto-lower for certain windows.
 You can use that for Emacs windows if you wish, but if you do,
 that is beyond the control of Emacs and this command has no effect on it."
-  (interactive "P")
-  (if (null arg)
-      (setq arg
-           (if (cdr (assq 'auto-lower (frame-parameters (selected-frame))))
-               -1 1)))
-  (modify-frame-parameters (selected-frame)
-                          (list (cons 'auto-lower (> arg 0)))))
+  :variable (frame-parameter nil 'auto-lower))
+
 (defun set-frame-name (name)
   "Set the name of the selected frame to NAME.
 When called interactively, prompt for the name of the frame.
@@ -1467,23 +1432,6 @@ In the 3rd, 4th, and 6th examples, the returned value is relative to
 the opposite frame edge from the edge indicated in the input spec."
   (cons (car spec) (frame-geom-value-cons (car spec) (cdr spec))))
 \f
-;;;; Aliases for backward compatibility with Emacs 18.
-(define-obsolete-function-alias 'screen-height 'frame-height "19.7")
-(define-obsolete-function-alias 'screen-width 'frame-width "19.7")
-
-(defun set-screen-width (cols &optional pretend)
-  "Change the size of the screen to COLS columns.
-Optional second arg non-nil means that redisplay should use COLS columns
-but that the idea of the actual width of the frame should not be changed.
-This function is provided only for compatibility with Emacs 18."
-  (set-frame-width (selected-frame) cols pretend))
-
-(defun set-screen-height (lines &optional pretend)
-  "Change the height of the screen to LINES lines.
-Optional second arg non-nil means that redisplay should use LINES lines
-but that the idea of the actual height of the screen should not be changed.
-This function is provided only for compatibility with Emacs 18."
-  (set-frame-height (selected-frame) lines pretend))
 
 (defun delete-other-frames (&optional frame)
   "Delete all frames except FRAME.
@@ -1509,9 +1457,6 @@ left untouched.  FRAME nil or omitted means use the selected frame."
       (when (eq (frame-parameter frame 'minibuffer) 'only)
        (delete-frame frame)))))
 
-(make-obsolete 'set-screen-width 'set-frame-width "19.7")
-(make-obsolete 'set-screen-height 'set-frame-height "19.7")
-
 ;; miscellaneous obsolescence declarations
 (define-obsolete-variable-alias 'delete-frame-hook
     'delete-frame-functions "22.1")
index 18a89cddd7d1fa8618de37cfb4fe923abfe3c011..600ef7ca1e1c4f38880a458b5751003ea98e66a7 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Simon Josefsson <simon@josefsson.org>
 ;; Maintainer: FSF
 ;; Keywords: frames
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
index 0083989c75ab42590e7555eee4e4b217de5862f6..8c2e8b4bc99b4e4b4a3c607116ea8531d31b8042 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author:  Peter Breton <pbreton@cs.umb.edu>
 ;; Created: Tue Oct 08 1996
 ;; Keywords: generic, comment, font-lock
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
index ab1210af5b5efb69068c0b4252dd81d5ffdd8c0b..dd1b54f9a0e5aecfbc4a0b562877cb3df2c70a28 100644 (file)
@@ -1,3 +1,534 @@
+2010-08-31  Julien Danjou  <julien@danjou.info>  (tiny change)
+
+       * nnimap.el (nnimap-request-newgroups): Use nnimap-request-list-method
+       instead of lsub directly.
+
+2010-08-31  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * nnwarchive.el: Removed.
+
+       * gnus-soup.el: Removed.
+
+       * nnsoup.el: Removed.
+
+       * nnultimate.el: Removed.
+
+       * gnus-html.el (gnus-blocked-images): New variable.
+
+       * message.el (message-prune-recipients): New function.
+       (message-prune-recipient-rules): New variable.
+
+       * gnus-cite.el (gnus-article-natural-long-line-p): New function to
+       guess whether a long line is natural text or not.
+
+       * gnus-html.el (gnus-html-schedule-image-fetching): Use
+       gnus-process-plist and friends for compatibility.
+
+2010-08-31  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * gnus-html.el: Require packages that define macros used in this file.
+       (gnus-article-mouse-face): Declare to silence byte-compiler.
+       (gnus-html-curl-sentinel): Use with-current-buffer, inhibit-read-only, and
+       process-get.
+       (gnus-html-put-image): Use plist-get to avoid getf.
+       (gnus-html-prefetch-images): Use with-current-buffer.
+
+2010-08-31  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * gnus-ems.el: Provide compatibility functions for
+       gnus-set-process-plist.
+
+       * gnus-sum.el (gnus-summary-stop-at-end-of-message)
+       * gnus.el (gnus-valid-select-methods)
+       * message.el (message-send-mail-partially-limit)
+       * mm-decode.el (mm-text-html-renderer)
+       * mml.el (mml-insert-mime-headers-always)
+       * smiley.el (smiley-regexp-alist): Bump custom version.
+
+2010-08-31  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * gnus-html.el: require mm-url.
+       (gnus-html-wash-tags): Clarify the code a bit by renaming the variable
+       with the url to `url'.
+       (gnus-html-wash-tags): Support cid: URLs/images.
+
+2010-08-30  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * gnus-sum.el: As per discussion 3 years, 8 weeks, 3 days, 9 hours, 57
+       minutes, 56 seconds ago on the ding list, remove the `w' and `i'
+       bindings, as they aren't useful at all. `w' is moved to `W w'.
+
+       * gnus-move.el: Removed file, since it doesn't really work.
+
+       * gnus-html.el (gnus-article-html): Tell w3m that the input is
+       UTF-8. This seems to fix problems with some German web feeds.
+
+       * gnus.el (gnus-group-startup-message): Put the xpm version of the logo
+       at the top so that the proper colours are applied.
+
+       * gnus-art.el (gnus-article-view-part): Doc fix.
+
+       * gnus-html.el (gnus-html-put-image): Use gnus-create-image to be
+       XEmacs-compatible.
+       (gnus-html-put-image): Don't do images on non-graphic displays.
+
+       * nnslashdot.el: Removed this unused backend.
+
+       * gnus-undo.el (gnus-undo-register-1): Limit the undo actions to 100
+       actions.
+       (gnus-undo-register-1): Revert last change.
+
+       * gnus-group.el (gnus-group-completing-read): Protect against not
+       having completion-styles bound.
+
+       * mml.el (mml-insert-mime-headers-always): Change the default to t, to
+       make broken recipients happier.
+
+       * gnus-html.el (gnus-html-put-image): Use gnus-put-image.
+
+       * gnus-ems.el (gnus-put-image): Have gnus-put-image take an optional
+       point parameter.
+
+       * gnus-group.el (gnus-group-completing-read): Add 'substring to
+       completion-styles for group selection.
+
+2009-02-04  Andreas Schwab  <schwab@suse.de>
+
+       * gnus-score.el (gnus-score-string): Fix regex for matching extra
+       headers and regexp-quote the match if necessary.
+
+2009-03-24  Miles Bader  <miles@gnu.org>
+
+       * smiley.el (smiley-regexp-alist): Don't delete the semicolon before
+       the blinking smiley.
+
+2009-03-24  Simon Josefsson  <simon@josefsson.org>
+
+       * smiley.el (smiley-regexp-alist): Disallow ;;) from being treated as a
+       blink smiley.
+
+2010-08-29  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * gnus-start.el (gnus-dribble-read-file): Ensure that the directory
+       where the dribbel file lives exists.
+
+       * message.el (message-send-mail-partially-limit): Change the default to
+       nil, since most people don't want this.
+
+       * mm-url.el (mm-url-decode-entities): Also decode entities like
+       &#x3212.
+
+2009-07-16  Kevin Ryde  <user42@zip.com.au>  (tiny change)
+
+       * gnus-sum.el (gnus-summary-idna-message):
+       * nnrss.el (nnrss-normalize-date, nnrss-discover-feed):
+       Hyperlink urls in docstrings with URL `...'.
+
+2010-08-29  Adam Sjøgren  <asjo@koldfront.dk>
+
+       * gnus-html.el (gnus-html-put-image): Use XEmacs-compatible image
+       functions.
+
+2010-08-29  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * gnus-art.el (gnus-article-add-button): Take an optional parameter to
+       say what the mouseover text should be.
+
+       * gnus-html.el (gnus-html-prefetch-images): Use the summary-local
+       version of the mm-w3m-safe-url-regexp variable to only download images
+       in the groups where we want that to happen.
+
+       * gnus-sum.el (gnus-summary-stop-at-end-of-message): New variable.
+
+       * gnus-art.el (gnus-article-beginning-of-window): Make into defun for
+       easier debugging.
+       (gnus-article-beginning-of-window): Add kludge to allow spacing past
+       big pictures in the article buffer.
+
+       * mm-decode.el (mm-text-html-renderer): Default the html renderer to
+       gnus-article-html.
+       (mm-text-html-renderer): gnus-article-html needs curl in addition to
+       w3m.
+
+       * gnus-html.el: Start a new super-simple HTML renderer based on w3m.
+
+2010-08-28  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * gnus.el (gnus-valid-select-methods): Remove reference to nngoogle,
+       which doesn't exist.
+
+       * message.el (message-inhibit-ecomplete): New variable to allow some
+       function to inhibit ecomplete address storage.
+       (message-resend): Disable ecomplete message storage when resending
+       messages.
+
+       * nntp.el (nntp-async-kluge): Remove the Emacs 20.3-related kluge.
+
+2010-08-27  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * gnus-sum.el (gnus-summary-move-article, gnus-summary-delete-article):
+       Save excursion while copying, moving, and deleting articles in order to
+       prevent the cursor from jumping to unforeseen place.
+
+2010-08-17  Glenn Morris  <rgm@gnu.org>
+
+       * gnus-sync.el: Require gnus components whose functions are used.
+
+       * gnus-art.el (bookmark-make-record-function):
+       * gnus-sum.el (bookmark-yank-point, bookmark-current-bookmark):
+       Declare for compiler.
+
+       * mm-url.el (mml-compute-boundary): Autoload.
+
+2010-08-15  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * gnus-start.el (gnus-start-draft-setup): Move doc string forward.
+
+2010-08-14  Teodor Zlatanov  <tzz@lifelogs.com>
+
+       Typo fix "hoo4a" -> "hook".
+
+       * gnus-sync.el (gnus-sync-install-hooks): Typo fix.
+
+2010-08-14  Glenn Morris  <rgm@gnu.org>
+
+       * gnus-sync.el (gnus-sync): Fix defgroup version.
+
+2010-08-13  Teodor Zlatanov  <tzz@lifelogs.com>
+
+       Doc fixes and keep unknown groups (ammended for nunion bug fix).
+
+       * gnus-sync.el: Fix docs.
+       (gnus-sync-save): Keep unknown groups in `gnus-sync-newsrc-loader'.
+       (gnus-sync-read): Don't wipe `gnus-sync-newsrc-loader' after reading.
+
+2010-08-12  Teodor Zlatanov  <tzz@lifelogs.com>
+
+       Optimizations for gnus-sync.el.
+
+       * gnus-sync.el: Add docs about gnus-sync-backend
+       possibilities.
+       (gnus-sync-save): Remove unnecessary message.
+       (gnus-sync-read): Optimize and show what groups were skipped.
+
+2010-08-12  Teodor Zlatanov  <tzz@lifelogs.com>
+
+       Minor bug fixes for gnus-sync.el.
+
+       * gnus-sync.el (gnus-sync-unload-hook, gnus-sync-install-hooks): Don't
+       read the sync on get-new-news.
+
+       * gnus-sync.el (gnus-sync-save): Define `variable' so the compiler is
+       quiet.
+
+       * gnus-sync.el (gnus-sync-read): Use `gnus-sync-newsrc-offsets' (fix typo).
+
+2010-07-30  Lawrence Mitchell  <wence@gmx.li>
+
+       Make saving and restoring of hidden threads work with overlays.
+       Patch applied by Ted Zlatanov.
+
+       * gnus-sum.el (gnus-hidden-threads-configuration)
+       (gnus-restore-hidden-threads-configuration): Update to deal with text
+       properties, rather than searching for a magic character.
+
+2010-08-12  Teodor Zlatanov  <tzz@lifelogs.com>
+
+       New gnus-sync.el library for synchronization of marks.
+
+       * gnus-sync.el: New library for synchronization of marks.
+
+       * gnus-util.el (gnus-grep-in-list): Moved from gnus-registry.el and
+       renamed from `gnus-registry-grep-in-list'.
+
+       * gnus-registry.el (gnus-registry-follow-group-p): Use `gnus-grep-in-list'.
+
+       * gnus-start.el (gnus-start-draft-setup): Make it interactive.
+
+2010-08-06  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * rfc2047.el (rfc2047-encode): Use utf-8 as a last resort if
+       determining charset of text fails.
+
+2010-08-01  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * nnmail.el (nnmail-get-new-mail-1): Revert.
+
+       * nnml.el (nnml-active-number): Make sure names of newly created groups
+       in nnml-group-alist are encoded.
+
+2010-07-30  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * nnmail.el (nnmail-get-new-mail-1): Encode group names possibly
+       containing non-ASCII characters in active file for nnml back end.
+
+2010-07-24  David Engster  <dengste@eml.cc>
+
+       * mml-smime.el (mml-smime-epg-verify): Also accept the older
+       x-pkcs7-signature MIME type as signature (RFC 2311, C.1).
+
+2010-07-21  Daiki Ueno  <ueno@unixuser.org>
+
+       * mml.el (mml-parse-1): Collect "certfile" attributes in "<#secure>"
+       tag (Bug#6654).
+
+2010-07-20  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * gnus-sum.el (gnus-summary-bookmark-make-record): Bookmark position in
+       the article buffer, not the summary buffer.
+
+2010-07-15  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * gnus-sum.el (gnus-summary-bookmark-make-record): Make it work for
+       Emacs 23 as well.
+
+2010-07-13  Thierry Volpiatto  <thierry.volpiatto@gmail.com>
+
+       Allow C-w when setting a bookmark in a Gnus Article buffer (Bug#5975).
+       Patch applied by Karl Fogel.
+
+       * gnus-sum.el (gnus-summary-bookmark-make-record): Set
+       `bookmark-yank-point' and `bookmark-current-buffer' to allow C-w.
+
+2010-07-13  Thierry Volpiatto  <thierry.volpiatto@gmail.com>
+
+       Allow bookmarks to be set from Gnus Article buffers (Bug #5975).
+       Patch applied (with minor tweaks) by Karl Fogel.  Note this leaves
+       C-w still not working correctly from Article buffers; Thierry's
+       patch to fix that will be applied after this.
+
+       * gnus-art.el (bookmark-make-record-function): New local variable.
+
+       * gnus-sum.el (gnus-summary-bookmark-make-record): Allow setting from
+       article buffer.
+       (gnus-summary-bookmark-jump): Maybe jump to article buffer.
+
+2010-07-13  Karl Fogel  <kfogel@red-bean.com>
+
+       * gnus-sum.el (bookmark-make-record-default): Adjust declaration, based
+       on changes in bookmark.el.
+
+2010-06-22  Mark A. Hershberger  <mah@everybody.org>
+
+       * mm-url.el (mm-url-encode-multipart-form-data): New function to handle
+       the *other* type of HTML form submission.
+
+2010-06-15  Michael Albinus  <michael.albinus@gmx.de>
+
+       * auth-source.el (auth-source-pick): If choice does not contain a
+       questioned keyword, set the check to t.
+
+2010-06-12  Romain Francoise  <romain@orebokech.com>
+
+       * gnus-util.el (gnus-date-get-time): Move up before first use.
+
+2010-06-10  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * gnus-art.el (gnus-mime-buttonized-part-id): New internal variable.
+       (gnus-article-edit-part): Bind it to make last part that is substituted
+       or deleted visible.
+       (gnus-mime-display-single): Buttonize part of which id equals to
+       gnus-mime-buttonized-part-id.
+
+2010-06-10  Dan Christensen  <jdc@uwo.ca>
+
+       * gnus-util.el (gnus-user-date): Use gnus-date-get-time.
+       (gnus-dd-mmm): Use gnus-date-get-time.
+       * gnus-sum.el (gnus-thread-latest-date): Use gnus-date-get-time and
+       simplify logic.
+       (gnus-summary-limit-to-age): Use gnus-date-get-time.
+       (gnus-sort-threads): emit message if gnus-sort-threads-loop used.
+
+2010-06-08  Michael Albinus  <michael.albinus@gmx.de>
+
+       * auth-source.el (top): Autoload `secrets-list-collections',
+       `secrets-create-item', `secrets-delete-item'.
+       (auth-sources): Fix tag string.
+       (auth-get-source, auth-source-retrieve, auth-source-create)
+       (auth-source-delete): New defuns.
+       (auth-source-pick): Rewrite in order to avoid 2 passes.
+       (auth-source-forget-user-or-password): New parameter USERNAME.
+       (auth-source-user-or-password): New parameters CREATE-MISSING and
+       DELETE-EXISTING.  Retrieve password interactively, if needed.
+
+2010-06-07  Teemu Likonen  <tlikonen@iki.fi>  (tiny change)
+
+       * gnus-agent.el (gnus-agent-expire-unagentized-dirs): Don't ask about
+       deleting unused directories when gnus-expert-user is t.
+
+2010-06-02  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * gnus-art.el (gnus-article-browse-delete-temp-files): Don't make query
+       for each temp file when gnus-article-browse-delete-temp is ask.
+
+2010-05-20  Kevin Ryde  <user42@zip.com.au>
+
+       * gnus-start.el (gnus-level-unsubscribed): Doc fix.  (Bug#6206)
+
+2010-05-14  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * gnus-sum.el (gnus-summary-save-article): Don't bother to re-fetch
+       article unless decoding article to be saved.
+
+2010-05-13  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * mml1991.el (mml1991-mailcrypt-encrypt, mml1991-gpg-encrypt)
+       * mml2015.el (mml2015-gpg-encrypt): Disable multibyte in buffers
+       generated within the mm-with-unibyte-current-buffer macro.
+
+2010-05-13  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * gnus-art.el (gnus-bind-safe-url-regexp): Bind mm-w3m-safe-url-regexp
+       to nil when we're in a mml-preview buffer and no group is selected.
+
+2010-05-12  Andreas Seltenreich  <seltenreich@gmx.de>
+
+       * gnus-sum.el (gnus-summary-read-group-1): Don't jump to next group
+       when catching the `C-g'.  Reported by "Leo".
+
+2010-05-12  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * message.el (message-forward-make-body-plain)
+       (message-forward-make-body-mml): Use mm-multibyte-string-p instead of
+       multibyte-string-p.
+
+2010-05-12  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * message.el (message-forward-make-body-mml): Assume original message
+       is multibyte string; error on unibyte.
+       (message-forward-make-body-plain): Ditto; don't add excessive newline
+       in body end.
+
+2010-05-11  Andreas Seltenreich  <seltenreich@gmx.de>
+
+       * gnus-sum.el (gnus-summary-kill-thread): Use gnus-summary-mark-article
+       instead of g-s-m-a-as-unread to set the expirable mark.  (Bug#5284)
+
+2010-05-11  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * mm-extern.el (mm-extern-url): Don't use
+       mm-with-unibyte-current-buffer.
+       (mm-extern-cache-contents): Use with-current-buffer instead of
+       save-excursion + set-buffer.
+
+2010-05-10  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * mm-util.el (mm-emacs-mule): Remove.
+
+2010-05-10  Andreas Seltenreich  <seltenreich@gmx.de>
+
+       * gnus-sum.el (gnus-summary-mode): Don't make minor-mode-alist
+       buffer-local as it's incompatible with Stefan Monnier's 2010-05-03
+       change.
+
+2010-05-10  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * mm-util.el (mm-with-unibyte-current-buffer): Redefine it so as not to
+       bind the default value of enable-multibyte-characters to nil.
+
+2010-05-10  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * message.el (message-forward-make-body-plain)
+       (message-forward-make-body-mml):
+       Don't use mm-with-unibyte-current-buffer.
+
+2010-05-07  Christian von Roques  <roques@mti.ag>  (tiny change)
+
+       * mml2015.el (mml2015-epg-find-usable-key): Skip disabled key
+       (Bug#5592).
+
+2010-05-07  Julien Danjou  <julien@danjou.info>
+
+       * gnus-art.el (gnus-mime-pipe-part): Add optional argument `cmd'; pass
+       it to mm-pipe-part.
+
+       * mm-decode.el (mm-pipe-part): Add optional argument `cmd'; use it if
+       it is given.
+
+2010-05-07  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * nnweb.el (nnweb-gmane-search)
+       * yenc.el (yenc-decode-region): Don't run set-buffer-multibyte for
+       XEmacs.
+
+       * gnus-art.el (gnus-article-browse-html-parts)
+       * gnus-group.el (gnus-read-ephemeral-gmane-group)
+       (gnus-read-ephemeral-bug-grou): Use mm-make-temp-file instead of
+       make-temp-file.
+
+       * gnus-dired.el (gnus-dired-mode): Bind gnus-dired-mode-hook,
+       gnus-dired-mode-on-hook and gnus-dired-mode-off-hook for XEmacs when
+       compiling.
+
+       * gnus-ml.el (gnus-mailing-list-mode): Bind gnus-mailing-list-mode-hook,
+       gnus-mailing-list-mode-on-hook and gnus-mailing-list-mode-off-hook for
+       XEmacs when compiling.
+
+       * gnus-salt.el (gnus-pick-mode): Bind gnus-pick-mode-on-hook and
+       gnus-pick-mode-off-hook for XEmacs when compiling.
+       (gnus-binary-mode): Bind gnus-binary-mode-on-hook and
+       gnus-binary-mode-off-hook for XEmacs when compiling.
+
+       * gnus-sum.el (gnus-summary-limit-strange-charsets-predicate): Return
+       nil if char-charset is not available.
+
+       * sieve-manage.el (sieve-manage-disable-multibyte): Redefine it as a
+       macro.
+
+       * mm-url.el (mm-url-form-encode-xwfu): Use mm-encode-coding-string
+       instead of encode-coding-string.
+
+       * mm-util.el (mm-enable-multibyte, mm-disable-multibyte): Use (featurep
+       'xemacs) instead of mm-emacs-mule to switch function definitions.
+       (mm-with-unibyte-current-buffer): Make it a progn macro for XEmacs.
+
+2010-05-06  Tommi Vainikainen  <thv@iki.fi>  (tiny change)
+
+       * mml-sec.el (mml-secure-message-sign): Fix cut and paste error.
+
+2010-05-06  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * gnus-dired.el, gnus-draft.el, gnus-ml.el, gnus-salt.el, gnus-sum.el,
+       gnus-undo.el, mml.el: Require easy-mmode for XEmacs when compiling.
+
+2010-05-03  Juanma Barranquero  <lekktu@gmail.com>
+
+       * mm-util.el (mm-decompress-buffer): Use `delete-file';
+       alias `jka-compr-delete-temp-file' no longer exists.
+
+2010-05-03  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       Use define-minor-mode in Gnus where applicable.
+       * mml.el (mml-mode): Use define-minor-mode.
+       * gnus-undo.el (gnus-undo-mode-map): Initialize in declaration.
+       (gnus-undo-mode): Use define-minor-mode.
+       * gnus-sum.el (gnus-dead-summary-mode-map): Initialize in declaration.
+       (gnus-dead-summary-mode): Use define-minor-mode.
+       * gnus-salt.el (gnus-pick-mode-map, gnus-binary-mode-map):
+       Initialize in declaration.
+       (gnus-pick-mode, gnus-binary-mode): Use define-minor-mode.
+       * gnus-ml.el (gnus-mailing-list-mode-map): Initialize in declaration.
+       (gnus-mailing-list-mode): Use define-minor-mode.
+       * gnus-draft.el (gnus-draft-mode-map): Initialize in declaration.
+       (gnus-draft-mode): Use define-minor-mode.
+       * gnus-dired.el (gnus-dired-mode-map): Initialize in declaration.
+       (gnus-dired-mode): Use define-minor-mode.
+
+2010-05-01  Andreas Seltenreich  <seltenreich@gmx.de>
+
+       * mml.el (mml-generate-mime-1,mml-compute-boundary-1): Update 'mml
+       handles on recursive mml-to-mime translation and check them for
+       boundary delimiter collisions.  Reported by Greg Troxel.
+
+2010-04-27  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * gnus-util.el: Don't load tm and apel XEmacs packages when compiling.
+
+2010-04-23  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * mm-util.el (mm-find-buffer-file-coding-system):
+       * yenc.el (yenc-decode-region): Don't let-bind a read-only variable.
+
 2010-04-22  Andreas Seltenreich  <seltenreich@gmx.de>
 
        * message.el (message-generate-headers): Record insertion of optional
 
        * nnir.el: Don't mention CVS.
 
+2010-04-14  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * gnus-sum.el (gnus-summary-bookmark-make-record):
+       Add `location' field.
+
+2010-04-12  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * gnus-sum.el: Add bookmark declarations to silence the compiler.
+       (gnus-mark-xrefs-as-read, gnus-summary-limit-to-bodies):
+       Use with-current-buffer to silence the byte-compiler.
+       (gnus-summary-bookmark-make-record): Use derived-mode-p and don't
+       bother to require `gnus'.
+       (gnus-summary-bookmark-jump): Don't forget to autoload.  Simplify.
+
+2010-04-12  Thierry Volpiatto  <thierry.volpiatto@gmail.com>
+
+       * gnus-sum.el (gnus-summary-bookmark-make-record)
+       (gnus-summary-bookmark-jump): New functions.
+       (gnus-summary-mode): Setup bookmark support.
+
 2010-04-01  Andreas Schwab  <schwab@linux-m68k.org>
 
        * mm-uu.el (mm-uu-pgp-signed-extract-1): Use buffer-file-coding-system
        if set.
 
-2010-03-29  Katsumi Yamaoka  <yamaoka@jpl.org>
+2010-03-31  Katsumi Yamaoka  <yamaoka@jpl.org>
 
-       * mm-decode.el (mm-add-meta-html-tag): Fix regexp matching meta tag.
+       * gnus-art.el (gnus-article-browse-html-save-cid-content): Rename from
+       gnus-article-browse-html-save-cid-image; make it work recursively for
+       forwarded messages as well.
+       (gnus-article-browse-html-parts): Work when prefix arg is given.
+       (gnus-article-browse-html-article): Doc fix.
 
-2010-03-27  Chong Yidong  <cyd@stupidchicken.com>
+2010-03-30  Chong Yidong  <cyd@stupidchicken.com>
 
        * message.el (message-default-mail-headers):
        (message-default-headers): Carry the value mail-default-headers over
        into message-default-mail-headers, rather than message-default-headers.
 
-2010-03-22  Juanma Barranquero  <lekktu@gmail.com>
+2010-03-30  Martin Stjernholm  <mast@lysator.liu.se>
+
+       * mm-decode.el (mm-add-meta-html-tag): Add option to override the
+       charset.
+
+       * gnus-art.el (gnus-article-browse-html-parts): Force the correct
+       charset into the <meta> tag when the article is encoded to utf-8.
+
+2010-03-30  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * gnus-art.el (gnus-article-browse-delete-temp-files):
+       Delete directories as well.
+       (gnus-article-browse-html-parts): Work for images that do not specify
+       file names; delete temp directory when quitting; insert header at the
+       right place; use file: scheme for image files.
+
+2010-03-30  Eric Schulte  <schulte.eric@gmail.com>
+
+       * gnus-art.el (gnus-article-browse-html-save-cid-image): New function.
+       (gnus-article-browse-html-parts): Use it to make temporary cid image
+       files in addition to html file so that browser may display them.
+
+2010-03-29  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * mm-decode.el (mm-add-meta-html-tag): Fix regexp matching meta tag.
+
+2010-03-29  Teodor Zlatanov  <tzz@lifelogs.com>
+
+       * auth-source.el (auth-source-pick): Fix for non-secrets specifier.
+
+2010-03-27  Teodor Zlatanov  <tzz@lifelogs.com>
+
+       * auth-source.el (auth-sources): Change default to be simpler.
+       Explain about Secret Service API sources.  Improve Customize options.
+       (auth-source-pick): Change to accept any number of search parameters.
+       Implement fallbacks iteratively, not recursively.  Add scoring on the
+       second pass and sort by score.  Call Secret Service API when needed.
+       (auth-source-user-or-password): Use it.  Call Secret Service API
+       directly when needed to get the user name and the password.
+
+2010-03-24  Juanma Barranquero  <lekktu@gmail.com>
 
        * message.el (message-interactive): Doc fix.
        (message-qmail-inject-args): Reflow.
 
        * smiley.el (smiley-buffer): Fix typo in docstring.
 
+2010-03-24  Glenn Morris  <rgm@gnu.org>
+
+       * mail-source.el (gnus-message): Declare.
+       (mail-source-delete-old-incoming): Require gnus-util.
+
+2010-03-23  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * gnus-art.el (canlock-verify): Autoload it for Emacs 21.
+
+       * message.el (ecomplete-setup): Autoload it for Emacs <23.
+
+       * mml-sec.el (mml-secure-cache-passphrase): Default to t that is
+       password-cache's default if it is not bound.
+       (mml-secure-passphrase-cache-expiry): Default to 16 that is
+       password-cache-expiry's default if it is not bound.
+
+       * pop3.el (pop3-list): Don't use 3rd arg of `split-string' which is not
+       available in Emacs 21.
+
+2010-03-23  Teodor Zlatanov  <tzz@lifelogs.com>
+
+       * auth-source.el (auth-sources): Fix up definition so extra parameters
+       are always inline.
+
+2010-03-22  Martin Stjernholm  <mast@lysator.liu.se>
+
+       * nnimap.el (nnimap-verify-uidvalidity): Fixed bug where uidvalidity
+       wasn't updated after mismatch.  Clear cached mailbox info correctly
+       when uidvalidity changes.
+       (nnimap-group-prefixed-name): New function to avoid some code
+       duplication.
+       (nnimap-verify-uidvalidity, nnimap-group-overview-filename)
+       (nnimap-request-group): Use it.
+       (nnimap-retrieve-groups, nnimap-verify-uidvalidity)
+       (nnimap-update-unseen): Significantly improved speed of Gnus startup
+       with many imap folders.  This is done by caching the group status from
+       the imap server persistently in a group parameter `imap-status'.  (This
+       was cached before too if `nnimap-retrieve-groups-asynchronous' was set,
+       but not persistently, so every Gnus startup was still very slow.)
+
+2010-03-20  Teodor Zlatanov  <tzz@lifelogs.com>
+
+       * auth-source.el: Set up autoloads.  Bump to 23.2 because of the
+       secrets.el dependency.
+       (auth-sources): Add optional user name.  Add secrets.el configuration
+       choice (unused right now).
+
+2010-03-20  Teodor Zlatanov  <tzz@lifelogs.com>
+
+       * gnus-sum.el (gnus-summary-make-menu-bar): Let
+       `gnus-registry-install-shortcuts' fill in the functions.
+
+       * gnus-registry.el (gnus-summary-misc-menu): Declare to avoid
+       warnings.
+       (gnus-registry-misc-menus): Variable to hold registry mark menus.
+       (gnus-registry-install-shortcuts): Populate and use it in a
+       `gnus-summary-menu-hook' lambda, under "Gnus"->"Registry Marks".
+
+2010-03-20  Martin Stjernholm  <mast@lysator.liu.se>
+
+       * nnimap.el (nnimap-decode-group-name, nnimap-encode-group-name):
+       In-place substitutions for the group name encoding/decoding.
+       (nnimap-find-minmax-uid, nnimap-possibly-change-group)
+       (nnimap-retrieve-headers-progress, nnimap-possibly-change-group)
+       (nnimap-retrieve-headers-progress, nnimap-request-article-part)
+       (nnimap-update-unseen, nnimap-request-list)
+       (nnimap-retrieve-groups, nnimap-request-update-info-internal)
+       (nnimap-request-set-mark, nnimap-split-to-groups)
+       (nnimap-split-articles, nnimap-request-newgroups)
+       (nnimap-request-create-group, nnimap-request-accept-article)
+       (nnimap-request-delete-group, nnimap-request-rename-group)
+       (nnimap-acl-get, nnimap-acl-edit): Use them.  Replace `mbx' with
+       `encoded-mbx' for consistency.
+       (nnimap-close-group): Call `imap-current-mailbox' instead of using the
+       variable `imap-current-mailbox'.
+
+       * gnus-agent.el (gnus-agent-fetch-articles, gnus-agent-fetch-headers)
+       (gnus-agent-regenerate-group): Use `gnus-agent-decoded-group-name'.
+
+2010-03-20  Bojan Petrovic  <bpetrovi@f.bg.ac.rs>
+
+       * pop3.el (pop3-display-message-size-flag): Display message size byte
+       counts during POP3 download.
+       (pop3-movemail): Use it.
+       (pop3-list): Implement listing of available messages.
+
+2010-03-20  Mark Triggs  <mst@dishevelled.net>  (tiny change)
+
+       * nnir.el (nnir-get-article-nov-override-function): New function to
+       override the normal NOV retrieval.
+       (nnir-retrieve-headers): Use it.
+
+2010-03-19  Michael Albinus  <michael.albinus@gmx.de>
+
+       * auth-source.el (netrc-machine-user-or-password): Autoload.
+
+2010-03-19  Glenn Morris  <rgm@gnu.org>
+
+       Stop message.el from loading about 40 libraries it doesn't always need.
+       The general approach is to autoload rather than require, and to
+       require in the specific functions rather than the file.  (Bug#5642)
+
+       * gmm-utils.el: Don't require wid-edit.
+       (widget-create-child-value, widget-convert, widget-default-get):
+       Autoload.
+
+       * gnus-util.el: Don't require time-date, netrc.
+       (message-fetch-field, gnus-group-name-decode): Declare rather than
+       autoloading.
+       (gnus-fetch-field): Require message.
+       (gnus-decode-newsgroups): Require gnus-group.
+
+       * ietf-drums.el: Don't require time-date.
+
+       * message.el: Don't require hashcash, canlock, ecomplete.
+       Do require mail-utils.  Require nnheader only when compiling.
+       (smtpmail-default-smtp-server): Remove declaration.
+       (message-send-mail-function): Check smtpmail-default-smtp-server
+       is bound rather than requiring smtpmail.
+       (message-auto-save-directory, message-insert-signature): Use
+       expand-file-name rather than nnheader-concat.
+       (nnheader-insert-file-contents): Autoload.
+       (hashcash-wait-async): Declare.
+       (message-send-mail): Only call gnus-setup-posting-charset if
+       gnus-group-posting-charset-alist is bound.  Require hashcash if needed.
+       (message-send-mail-with-sendmail): Require sendmail.
+       (canlock-password, canlock-password-for-verify): Declare.
+       (message-canlock-password): Require canlock.
+       (nnheader-get-report): Autoload.
+       (gnus-setup-posting-charset): Declare.
+       (message-send-news): Require gnus-msg.
+       (message-make-references, message-make-in-reply-to): Use mail-header-id
+       rather than the alias mail-header-message-id.
+       (ecomplete-add-item, ecomplete-save): Declare.
+       (message-put-addresses-in-ecomplete): Require ecomplete.
+       (ecomplete-display-matches): Autoload.
+
+       * mm-decode.el: Don't require mailcap, gnus-util.
+       (gnus-map-function, gnus-replace-in-string, gnus-read-shell-command)
+       (message-fetch-field, mailcap-parse-mailcaps, mailcap-mime-info):
+       Autoload.
+       (mailcap-mime-extensions): Declare.
+
+       * mm-encode.el: Don't require mailcap.
+       (mailcap-extension-to-mime): Autoload.
+
+       * mml-sec.el: Don't require password-cache.
+
+       * mml.el (gnus-setup-posting-charset): Declare rather than autoload.
+       (mailcap-parse-mimetypes, mailcap-mime-types): Declare.
+       (mml-minibuffer-read-type): Require mailcap.
+       (mml-preview): Require gnus-msg.
+
+       * mml1991.el: Require password-cache.
+       (password-cache-expiry): Remove declaration.
+
+       * mml2015.el: Require password-cache.
+       (password-cache-expiry): Remove declaration.
+
+       * nneething.el (mailcap): Require mailcap.
+
+       * nnheader.el (declare-function): Add compatibility stub.
+       (message-remove-header): Declare rather than autoload.
+       (nnheader-replace-header): Require message.
+
+       * nnimap.el (declare-function): Add compatibility stub.
+       (netrc-parse, netrc-machine-user-or-password): Declare.
+       (nnimap-open-connection): Require netrc.
+
+       * nntp.el (declare-function): Add compatibility stub.
+       (netrc-parse, netrc-machine, netrc-get): Declare.
+       (nntp-send-authinfo): Require netrc.
+
+       * rfc2047.el: Don't require qp.
+       (quoted-printable-encode-region, quoted-printable-decode-string):
+       Autoload.
+
+       * sieve-mode.el: Don't require easymenu.
+       (easy-menu-add-item): Autoload it.
+
+       * spam-stat.el (time-to-number-of-days): Autoload it.
+
+2010-03-17  Kevin Ryde  <user42@zip.com.au>
+
+       * mml.el (mml-read-tag): Unquote values with `read' to reverse
+       prin1 in mml-insert-tag (just stripping the quotes gave wrong
+       value if any backslash escapes).
+
+2010-03-15  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * mm-util.el (mm-charset-to-coding-system): Use coding-system-from-name
+       if it is available.  (bug#5647)
+
 2010-02-26  Glenn Morris  <rgm@gnu.org>
 
        * message.el (message-send-mail-function): Change the default, so that
 
 2006-11-06  Reiner Steib  <Reiner.Steib@gmx.de>
 
-       * message.el (message-strip-subject-encoded-words): New function
+       * message.el (message-strip-subject-encoded-words): New function.
        (message-simplify-subject-functions): New variable.
        (message-simplify-subject): Use it.  Fix typo in doc string.
        Support message-strip-subject-encoded-words.
 
 2006-09-20  Maxime Edouard Robert Froumentin  <max@lapin-bleu.net>
 
-       (gnus-insert-mime-button, gnus-insert-mime-security-button): Apply
-       gnus-article-button-face to MIME and security buttons.
+       * gnus-art.el (gnus-insert-mime-button)
+       (gnus-insert-mime-security-button):
+       Apply gnus-article-button-face to MIME and security buttons.
 
 2006-09-20  Reiner Steib  <Reiner.Steib@gmx.de>
 
 
        * gnus-agent.el: Added gnus-agent-flush* to purge agent info.
        (gnus-agent-read-agentview): Fixed handling of end-of-file error.
-       (gnus-agent-read-local): All symbols allocated in my-obarray
+       (gnus-agent-read-local): All symbols allocated in my-obarray.
        (gnus-agent-set-local): Skip invalid entries (min and/or max is nil).
        (gnus-agent-regenerate-group): Check numeric names to see if they are
        messages or groups.
        to get all the groups a message ID is in.
 
        * spam-stat.el (spam-stat-split-fancy-spam-threshold)
-       (spam-stat-split-fancy): Change "threshhold" to "threshold"
+       (spam-stat-split-fancy): Change "threshhold" to "threshold".
        (spam-stat-score-buffer-user-functions): Add :number custom type.
 
 2005-04-06  Katsumi Yamaoka  <yamaoka@jpl.org>
 
 2004-11-14  Magnus Henoch  <mange@freemail.hu>
 
-       * hashcash.el (hashcash-default-payment): Change default to 20
-       (hashcash-default-accept-payment): Change default to 20
-       (hashcash-process-alist): New variable
-       (hashcash-generate-payment-async): Add
-       (hashcash-already-paid-p): Add
-       (hashcash-insert-payment): Don't generate payments twice
-       (hashcash-insert-payment-async): Add
-       (hashcash-insert-payment-async-2): Add
-       (hashcash-cancel-async): Add
-       (hashcash-wait-async): Add
-       (hashcash-processes-running-p): Add
-       (hashcash-wait-or-cancel): Add
+       * hashcash.el (hashcash-default-payment): Change default to 20.
+       (hashcash-default-accept-payment): Change default to 20.
+       (hashcash-process-alist): New variable.
+       (hashcash-generate-payment-async): Add.
+       (hashcash-already-paid-p): Add.
+       (hashcash-insert-payment): Don't generate payments twice.
+       (hashcash-insert-payment-async): Add.
+       (hashcash-insert-payment-async-2): Add.
+       (hashcash-cancel-async): Add.
+       (hashcash-wait-async): Add.
+       (hashcash-processes-running-p): Add.
+       (hashcash-wait-or-cancel): Add.
        (mail-add-payment): New optional argument.  Conditionally start
        asynchronous calculation.
-       (mail-add-payment-async): Add
+       (mail-add-payment-async): Add.
 
        * message.el (message-send-mail): Wait for asynchronous hashcash
        results.  Don't clobber existing X-Hashcash headers.
        (nnsoup-unpack-packets, nnsoup-make-active): Simplify.
 
        * nnspool.el (nnspool-find-id): Use with-temp-buffer.
-       (nnspool-sift-nov-with-sed): Use last
+       (nnspool-sift-nov-with-sed): Use last.
        (nnspool-retrieve-headers-with-nov): Use mapc.
        (nnspool-request-newgroups): Use dolist.
        (nnspool-request-group): Use last.
        * gnus-registry.el (gnus-registry-split-fancy-with-parent): Try
        to append in-reply-to: data to the references: header.
 
-       * netrc.el: Remove old encryption support, autoload gnus-encrypt.el
+       * netrc.el: Remove old encryption support, autoload gnus-encrypt.el.
        (netrc-parse): Use gnus-encrypt.el functions.
 
        * gnus-encrypt.el: Add new file for encryption support; currently
 
 2004-05-26  Adam Sjøgren  <asjo@koldfront.dk>  (tiny change)
 
-       (spam-ham-copy-or-move-routine): Don't declare `todo' twice.
+       * spam.el (spam-ham-copy-or-move-routine): Don't declare `todo' twice.
 
 2004-05-26  Katsumi Yamaoka  <yamaoka@jpl.org>
 
 
        * gnus-group.el: Require gnus-sum and autoload functions to
        resolve warnings when gnus-group.el compiled alone.
-       (gnus-group-line-format): Documented new %F
+       (gnus-group-line-format): Documented new %F.
        (size of Fetched data) group line format; identifies disk space
        used by agent and cache.
        (gnus-group-line-format-alist): Defined new F format.
        is "nndraft:queue".  Suggested by Gaute Strokkenes
        <gs234@srcf.ucam.org>
 
-       * gnus-agent.el (agent-disable-undownloaded-faces): Removed
-       (agent-enable-undownloaded-faces): Added
+       * gnus-agent.el (agent-disable-undownloaded-faces): Removed.
+       (agent-enable-undownloaded-faces): Added.
        (gnus-agent-cat-groups): Use eval-and-compile, not
        eval-when-compile, to define gnus-agent-set-cat-groups as the setf
        method of gnus-agent-cat-groups even when the buffer has been
        active file (local makes it unnecessary).
        (gnus-agent-regenerate-group): Fixed XEmacs compatibility.
 
-       * gnus-cus.el (agent-disable-undownloaded-faces): Removed
-       (agent-enable-undownloaded-faces): Added
+       * gnus-cus.el (agent-disable-undownloaded-faces): Removed.
+       (agent-enable-undownloaded-faces): Added.
 
        * gnus-draft.el (gnus-draft-send): Bind gnus-agent-queue-mail to
        disable it when sending to "nndraft:queue".
 
 2004-01-14  Kai Grossjohann  <kai@emptydomain.de>
 
-       (message-kill-to-signature): Change docstring.
+       * message.el (message-kill-to-signature): Change docstring.
 
 2004-01-14  Katsumi Yamaoka  <yamaoka@jpl.org>
 
 
 2004-01-05  Reiner Steib  <Reiner.Steib@gmx.de>
 
-       * gnus-art.el (gnus-treat-ansi-sequences,
+       * gnus-art.el (gnus-treat-ansi-sequences)
        (article-treat-ansi-sequences): New variable and function.
        Suggested by Dan Jacobson <jidanni@jidanni.org>.
 
 2004-01-04  Mario Lang  <lang@zid.tugraz.at>
 
        * dns.el (dns-query-types): Fix typo.
-       (dns-query-types): New function
+       (dns-query-types): New function.
        (dns-read-type): Add support for AAAA records, see RFC 3596.  Parse MX,
        PTR and SOA replies, see RFC 1035.
 
index e455770711b9cb40070457a35b33fbbccf14a397..520b3a4b735fb63181dac900ac60d32820532e75 100644 (file)
 
        * gnus-start.el (gnus-slave-save-newsrc):
        * gnus-uu.el (gnus-uu-tmp-dir, gnus-uu-decode-binhex)
-         (gnus-uu-decode-binhex-view, gnus-uu-digest-mail-forward)
-         (gnus-uu-initialize):
+       (gnus-uu-decode-binhex-view, gnus-uu-digest-mail-forward)
+       (gnus-uu-initialize):
        * nnmail.el (nnmail-make-complex-temp-name, nnmail-get-new-mail):
-         Use make-temp-file.
+       Use make-temp-file.
 
 1999-09-07  Eli Zaretskii  <eliz@gnu.org>
 
 
 1998-08-13  Simon Josefsson  <jas@pdc.kth.se>
 
-       * gnus-msg.el (gnus-setup-message): use message-setup-hook
-       instead
-       (gnus-configure-posting-styles): new posting-style 'body
-       (gnus-configure-posting-styles): insert headers immediately
+       * gnus-msg.el (gnus-setup-message): Use message-setup-hook
+       instead.
+       (gnus-configure-posting-styles): New posting-style 'body.
+       (gnus-configure-posting-styles): Insert headers immediately
 
 1998-08-13  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
 
 1998-08-12  Simon Josefsson  <jas@pdc.kth.se>
 
-       * gnus-cache.el (gnus-uncacheable-groups): doc change
-       (gnus-cacheable-groups): new variable
-       (gnus-cache-possibly-enter-article): use it
+       * gnus-cache.el (gnus-uncacheable-groups): Doc change.
+       (gnus-cacheable-groups): New variable.
+       (gnus-cache-possibly-enter-article): Use it.
 
 1998-08-12  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
index cd7f3b56aad36b746ef92bac21ce4b6974106b80..140df493b7c7a01f9c073b2a86170252df99b4b7 100644 (file)
        (gnus-agent-regenerate): Uses new gnus-agent-covered-methods
        function as gnus-agent-covered-methods variable no longer provides
        methods.
-       (gnus-agent-covered-methods): New function
+       (gnus-agent-covered-methods): New function.
        (gnus-agent-expire-group, gnus-agent-expire): Final message will,
        if gnus-verbose is greater than 4, report statistics of NOV
        entries and files deleted as well as total bytes recovered.
-       (gnus-agent-expire-done-message): New function
+       (gnus-agent-expire-done-message): New function.
        (gnus-agent-unread-articles): Bug fix.  No longer drops last
        unread article onto read list.
        (gnus-agent-regenerate-group): Changed prompt to use typical
 
        * spam.el
        (spam-log-processing-to-registry): Improved message and comments.
-       (spam-log-unregistration-needed-p): New function
+       (spam-log-unregistration-needed-p): New function.
        (spam-ifile-register-spam-routine)
        (spam-ifile-register-ham-routine, spam-stat-register-spam-routine)
        (spam-stat-register-ham-routine)
 
        * message.el (message-mode-field-menu): Added
        message-generate-unsubscribed-mail-followup-to.
-       (message-forward-subject-fwd): Avoid double "Fwd: "
+       (message-forward-subject-fwd): Avoid double "Fwd: ".
        (message-change-subject): Added comment.
 
 2003-10-19  Lars Magne Ingebrigtsen  <larsi@gnus.org>
        (spam-spamoracle-learn-ham, spam-spamoracle-learn-spam): New functions.
 
        * gnus.el (gnus-group-spam-exit-processor-spamoracle)
-       (gnus-group-ham-exit-processor-spamoracle): New variables for SpamOracle
+       (gnus-group-ham-exit-processor-spamoracle): New variables for SpamOracle.
        (spam-process, ham-process): Added spamoracle spam/ham processors.
 
 2003-06-08  Jesper Harder  <harder@ifa.au.dk>
 
        * message.el (message-use-idna): Use mm-coding-system-p.
        (message-tokenize-header, message-make-organization)
-       (message-make-from):  Use with-temp-buffer.
+       (message-make-from): Use with-temp-buffer.
        (message-set-work-buffer): Deleted.
        (message-fill-paragraph): Use `if' not `and' for compiler warning.
        (message-check-news-header-syntax): Remove useless lambda.
        * gnus-registry.el (gnus-registry-split-fancy-with-parent): Added
        diagnostic message.
        (gnus-registry-grep-in-list): Don't run when word is nil.
-       (gnus-registry-fetch-message-id-fast): New function
+       (gnus-registry-fetch-message-id-fast): New function.
        (gnus-registry-delete-group, gnus-registry-add-group): Make sure
        the id and group are not nil.
        (gnus-registry-register-message-ids): New function.
        `message-valid-fqdn-regexp' for initialization.
        (gnus-button-handle-info-url): Renamed and extended version of
        `gnus-button-handle-info'.
-       (gnus-button-message-level): Renamed from `gnus-button-mail-level'
+       (gnus-button-message-level): Renamed from `gnus-button-mail-level'.
        (gnus-button-handle-symbol, gnus-button-handle-library)
        (gnus-button-handle-info-keystrokes): New functions.
        (gnus-button-browse-level): New variable.
 2003-02-08  Michael Welsh Duggan  <md5i@cs.cmu.edu>
 
        * nnmail.el (nnmail-split-it): If a message ends up matching the
-         same mailbox more than once, it will cause duplicates to appear
-         in the mailbox.
+       same mailbox more than once, it will cause duplicates to appear
+       in the mailbox.
 
 2003-02-08  Simon Josefsson  <jas@extundo.com>
 
 2003-01-13  Jhair Tocancipa Triana  <jhair_tocancipa@@gmx.net>
 
        * gnus-audio.el (gnus-audio-au-player, gnus-audio-wav-player): Use
-         /usr/bin/play as default player.
-         (gnus-audio-play): Added ARG-DESCRIPTOR to prompt for a file to play.
+       /usr/bin/play as default player.
+       (gnus-audio-play): Added ARG-DESCRIPTOR to prompt for a file to play.
 
 2003-01-14  Katsumi Yamaoka  <yamaoka@jpl.org>
 
 
 2003-01-12  Raymond Scholz  <ray-2003@zonix.de>
 
-       * gnus-msg.el (gnus-confirm-mail-reply-to-news):  May be a
+       * gnus-msg.el (gnus-confirm-mail-reply-to-news): May be a
        regexp or a function too.
        (gnus-confirm-treat-mail-like-news): New variable.  Ask for
        confirmation even if the original article is mail.
 
 2003-01-02  Reiner Steib  <Reiner.Steib@gmx.de>
 
-       * gnus-art.el (gnus-button-url-regexp,
-       (gnus-button-mid-or-mail-regexp, gnus-button-alist,
+       * gnus-art.el (gnus-button-url-regexp)
+       (gnus-button-mid-or-mail-regexp, gnus-button-alist)
        (gnus-header-button-alist): Regexps are case insensitive here.
 
 2003-01-02  Simon Josefsson  <jas@extundo.com>
 
 2002-10-31  Alex Schroeder  <alex@emacswiki.org>
 
-       * spam-stat.el (spam-stat-process-directory): Add dir to message
+       * spam-stat.el (spam-stat-process-directory): Add dir to message.
        (spam-stat-reduce-size): No longer remove words
        with values close to 0.5, because the default value is 0.2.
 
        boolean not a string
        * gnus-group.el (gnus-group-line-format): Add description of %C
        * gnus-group.el (gnus-group-line-format-alist): Add gnus-tmp-comment
-         as %C
+       as %C
        * gnus-group.el (gnus-group-insert-group-line): Add gnus-tmp-comment.
 
 2002-04-22  Paul Jarc  <prj@po.cwru.edu>
 2002-01-02  ShengHuo ZHU  <zsh@cs.rochester.edu>
 
        * gnus-picon.el (gnus-picon-transform-newsgroups): Fix for the case
-         "Newsgroups: rec.music.beatles.moderated, rec.music.beatles".
+       "Newsgroups: rec.music.beatles.moderated, rec.music.beatles".
 
 2002-01-03  Steve Youngs  <youngs@xemacs.org>
 
        (imap-stream-alist): Backslash.
 
        * gnus-sum.el (gnus-summary-limit-to-author): Missing arguments.
-         Thanks to david.goldberg6@verizon.net (David S. Goldberg).
+       Thanks to david.goldberg6@verizon.net (David S. Goldberg).
 
 2001-11-27 14:00:00  ShengHuo ZHU  <zsh@cs.rochester.edu>
 
        Support "Importance:" header in Message.
 
        * message.el (message-mode-map): Bind C-c C-p to
-       `message-insert-or-toggle-importance'
+       `message-insert-or-toggle-importance'.
        (message-mode-menu): Add message-insert-importance-{high,low}.
        (message-insert-importance-high, message-insert-importance-low)
        (message-insert-or-toggle-importance): New functions.
 2001-10-30 13:00:00  ShengHuo ZHU  <zsh@cs.rochester.edu>
 
        * gnus-spec.el (gnus-parse-simple-format): Use
-         buffer-substring-no-properties.
+       buffer-substring-no-properties.
 
 2001-10-30  Katsumi Yamaoka  <yamaoka@jpl.org>
 
 
 2001-10-21  Simon Josefsson  <jas@extundo.com>
 
-       * nnimap.el (nnimap): Defgroup
+       * nnimap.el (nnimap): Defgroup.
        (nnimap-strict-function, nnimap-strict-function-match): New
        widget, from Per Abrahamsen  <abraham@dina.kvl.dk>.
        (nnimap-split-crosspost, nnimap-split-inbox)
        * gnus-cus.el (gnus-group-customize): Use it.
 
        * gnus.el (gnus-define-group-parameter): New macro.
-       (auto-expire): Use it
+       (auto-expire): Use it.
        (total-expire): Use it.
        * gnus-art.el (banner): Use it.
 
 
        * gnus-msg.el (gnus-summary-mail-forward): ???
 
-       * message.el (message-forward):  Move mime-to-mml here.
+       * message.el (message-forward): Move mime-to-mml here.
 
 2000-12-20 02:00:00  ShengHuo ZHU  <zsh@cs.rochester.edu>
 
 
        * nnheader.el: Wrap subst-char-in-string def in eval-and-compile.
        Put some defvars in eval-when-compile.
-       (gnus-intersection, gnus-sorted-complement):  Autoload.
+       (gnus-intersection, gnus-sorted-complement): Autoload.
 
        * imap.el (imap-point-at-eol): New, replacing gnus-point-at-eol.
 
 
        * qp.el (mm-decode-coding-region, mm-encode-coding-region):
        Autoload.
-       (quoted-printable-decode-region):  Rename arg which confused
+       (quoted-printable-decode-region): Rename arg which confused
        charset with coding-system.  Don't use nonascii-insert-offset.
        Coding-system encode the region initially.  Don't recognize `=='
        as valid QP.  Coding-system decode the region finally.
 
 2000-09-29  Gerd Moellmann  <gerd@gnu.org>
 
-       * smiley-ems.el (smiley-update-cache):  Use `:ascent center'.
+       * smiley-ems.el (smiley-update-cache): Use `:ascent center'.
 
 2000-09-21  Dave Love  <fx@gnu.org>
 
        * gnus-art.el (gnus-mime-display-part): Show MIME security button.
        (gnus-insert-mime-security-button): New function.
        * mm-decode.el (mm-possibly-verify-or-decrypt): Add security info.
-       * mml2015.el:  Add security info when verify or decrypt.
+       * mml2015.el: Add security info when verify or decrypt.
        * mm-uu.el (mm-uu-pgp-signed-extract): Use multipart.
        (mm-uu-pgp-encrypted-extract): Ditto.
 
        (mm-dissect-multipart): Use it.
        * mml2015.el (mml2015-fix-micalg): New function.
        (mml2015-decrypt): Use new interface.
-       (mml2015-verify):  Use new interface.
+       (mml2015-verify): Use new interface.
        (mml2015-setup): Make it bogus.
 
 2000-10-28 16:54:45  ShengHuo ZHU  <zsh@cs.rochester.edu>
index 284e6e911bdd3cce5adb6a5658756bf80e2a44d7..e43f09e5ed1168f829f22714d0007068f62a15b7 100644 (file)
 (require 'gnus-util)
 
 (eval-when-compile (require 'cl))
-(eval-when-compile (require 'netrc))
+(autoload 'netrc-machine-user-or-password "netrc")
+(autoload 'secrets-create-item "secrets")
+(autoload 'secrets-delete-item "secrets")
+(autoload 'secrets-get-alias "secrets")
+(autoload 'secrets-get-attribute "secrets")
+(autoload 'secrets-get-secret "secrets")
+(autoload 'secrets-list-collections "secrets")
+(autoload 'secrets-search-items "secrets")
 
 (defgroup auth-source nil
   "Authentication sources."
@@ -49,7 +56,7 @@
   "List of authentication protocols and their names"
 
   :group 'auth-source
-  :version "23.1" ;; No Gnus
+  :version "23.2" ;; No Gnus
   :type '(repeat :tag "Authentication Protocols"
                 (cons :tag "Protocol Entry"
                       (symbol :tag "Protocol")
@@ -57,6 +64,7 @@
                               (string :tag "Name")))))
 
 ;;; 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)))
@@ -71,7 +79,7 @@
 (defcustom auth-source-do-cache t
   "Whether auth-source should cache information."
   :group 'auth-source
-  :version "23.1" ;; No Gnus
+  :version "23.2" ;; No Gnus
   :type `boolean)
 
 (defcustom auth-source-debug nil
@@ -85,8 +93,8 @@ If the value is t, debug messages are logged with `message'.
 If the value is a function, debug messages are logged by calling
  that function using the same arguments as `message'."
   :group 'auth-source
-  :version "23.1" ;; No Gnus
-  :type        `(choice 
+  :version "23.2" ;; No Gnus
+  :type        `(choice
          :tag "auth-source debugging mode"
          (const :tag "Log using `message' to the *Messages* buffer" t)
          (function :tag "Function that takes arguments like `message'")
@@ -96,29 +104,51 @@ If the value is a function, debug messages are logged by calling
   "Whether auth-source should hide passwords in log messages.
 Only relevant if `auth-source-debug' is not nil."
   :group 'auth-source
-  :version "23.1" ;; No Gnus
+  :version "23.2" ;; No Gnus
   :type `boolean)
 
-(defcustom auth-sources '((:source "~/.authinfo.gpg" :host t :protocol t))
+(defcustom auth-sources '((:source "~/.authinfo.gpg"))
   "List of authentication sources.
 
-Each entry is the authentication type with optional properties."
+The default will get login and password information from a .gpg
+file, which you should set up with the EPA/EPG packages to be
+encrypted.  See the auth.info manual for details.
+
+Each entry is the authentication type with optional properties.
+
+It's best to customize this with `M-x customize-variable' because the choices
+can get pretty complex."
   :group 'auth-source
-  :version "23.1" ;; No Gnus
+  :version "23.2" ;; No Gnus
   :type `(repeat :tag "Authentication Sources"
                 (list :tag "Source definition"
                       (const :format "" :value :source)
-                      (string :tag "Authentication Source")
-                      (const :format "" :value :host)
-                      (choice :tag "Host (machine) choice"
-                              (const :tag "Any" t)
-                              (regexp :tag "Host (machine) regular expression (TODO)")
-                              (const :tag "Fallback" nil))
-                      (const :format "" :value :protocol)
-                      (choice :tag "Protocol"
-                              (const :tag "Any" t)
-                              (const :tag "Fallback" nil)
-                              ,@auth-source-protocols-customize))))
+                      (choice :tag "Authentication backend choice"
+                              (string :tag "Authentication Source (file)")
+                              (list :tag "secrets.el (Secret Service API/KWallet/GNOME Keyring)"
+                                     (const :format "" :value :secrets)
+                                     (choice :tag "Collection to use"
+                                             (string :tag "Collection name")
+                                             (const :tag "Default" 'default)
+                                             (const :tag "Login" "login")
+                                             (const :tag "Temporary" "session"))))
+                      (repeat :tag "Extra Parameters" :inline t
+                              (choice :tag "Extra parameter"
+                                      (list :tag "Host (omit to match as a fallback)"
+                                            (const :format "" :value :host)
+                                            (choice :tag "Host (machine) choice"
+                                                    (const :tag "Any" t)
+                                                    (regexp :tag "Host (machine) regular expression")))
+                                      (list :tag "Protocol (omit to match as a fallback)"
+                                            (const :format "" :value :protocol)
+                                            (choice :tag "Protocol"
+                                                    (const :tag "Any" t)
+                                                    ,@auth-source-protocols-customize))
+                                      (list :tag "User  (omit to match as a fallback)" :inline t
+                                            (const :format "" :value :user)
+                                            (choice :tag "Personality or username"
+                                                    (const :tag "Any" t)
+                                                    (string :tag "Specific user name"))))))))
 
 ;; temp for debugging
 ;; (unintern 'auth-source-protocols)
@@ -129,7 +159,7 @@ Each entry is the authentication type with optional properties."
 ;; (customize-variable 'auth-source-protocols)
 ;; (setq auth-source-protocols nil)
 ;; (format "%S" auth-source-protocols)
-;; (auth-source-pick "a" 'imap)
+;; (auth-source-pick nil :host "a" :port 'imap)
 ;; (auth-source-user-or-password "login" "imap.myhost.com" 'imap)
 ;; (auth-source-user-or-password "password" "imap.myhost.com" 'imap)
 ;; (auth-source-user-or-password-imap "login" "imap.myhost.com")
@@ -145,78 +175,274 @@ Each entry is the authentication type with optional properties."
   ;; we also check the value
   (when auth-source-debug
     (let ((logger (if (functionp auth-source-debug)
-                     auth-source-debug 
+                     auth-source-debug
                    'message)))
       (apply logger msg))))
 
-(defun auth-source-pick (host protocol &optional fallback)
-  "Parse `auth-sources' for HOST, and PROTOCOL matches.
-
-Returns fallback choices (where PROTOCOL or HOST are nil) with FALLBACK t."
-  (interactive "sHost: \nsProtocol: \n") ;for testing
-  (let (choices)
-    (dolist (choice auth-sources)
-      (let ((h (plist-get choice :host))
-           (p (plist-get choice :protocol)))
-       (when (and
-              (or (equal t h)
-                  (and (stringp h) (string-match h host))
-                  (and fallback (equal h nil)))
-              (or (equal t p)
-                  (and (symbolp p) (equal p protocol))
-                  (and fallback (equal p nil))))
-         (push choice choices))))
-    (if choices
-       choices
-      (unless fallback
-       (auth-source-pick host protocol t)))))
-
-(defun auth-source-forget-user-or-password (mode host protocol)
+;; (auth-source-pick nil :host "any" :protocol 'imap :user "joe")
+;; (auth-source-pick t :host "any" :protocol 'imap :user "joe")
+;; (setq auth-sources '((:source (:secrets default) :host t :protocol t :user "joe")
+;;                  (:source (:secrets "session") :host t :protocol t :user "joe")
+;;                  (:source (:secrets "login") :host t :protocol t)
+;;                  (:source "~/.authinfo.gpg" :host t :protocol t)))
+
+;; (setq auth-sources '((:source (:secrets default) :host t :protocol t :user "joe")
+;;                  (:source (:secrets "session") :host t :protocol t :user "joe")
+;;                  (:source (:secrets "login") :host t :protocol t)
+;;                  ))
+
+;; (setq auth-sources '((:source "~/.authinfo.gpg" :host t :protocol t)))
+
+(defun auth-get-source (entry)
+  "Return the source string of ENTRY, which is one entry in `auth-sources'.
+If it is a Secret Service API, return the collection name, otherwise
+the file name."
+  (let ((source (plist-get entry :source)))
+    (if (stringp source)
+       source
+      ;; Secret Service API.
+      (setq source (plist-get source :secrets))
+      (when (eq source 'default)
+       (setq source (or (secrets-get-alias "default") "login")))
+      (or source "session"))))
+
+(defun auth-source-pick (&rest spec)
+  "Parse `auth-sources' for matches of the SPEC plist.
+
+Common keys are :host, :protocol, and :user.  A value of t in
+SPEC means to always succeed in the match.  A string value is
+matched as a regex."
+  (let ((keys (loop for i below (length spec) by 2 collect (nth i spec)))
+       choices)
+    (dolist (choice (copy-tree auth-sources) choices)
+      (let ((source (plist-get choice :source))
+           (match t))
+       (when
+           (and
+            ;; Check existence of source.
+            (if (consp source)
+                ;; Secret Service API.
+                (member (auth-get-source choice) (secrets-list-collections))
+              ;; authinfo file.
+              (file-exists-p source))
+
+            ;; Check keywords.
+            (dolist (k keys match)
+              (let* ((v (plist-get spec k))
+                     (choicev (if (plist-member choice k)
+                                  (plist-get choice k) t)))
+                (setq match
+                      (and match
+                           (or
+                            ;; source always matches spec key
+                            (eq t choicev)
+                            ;; source key gives regex to match against spec
+                            (and (stringp choicev) (string-match choicev v))
+                            ;; source key gives symbol to match against spec
+                            (and (symbolp choicev) (eq choicev v))))))))
+
+         (add-to-list 'choices choice 'append))))))
+
+(defun auth-source-retrieve (mode entry &rest spec)
+  "Retrieve MODE credentials according to SPEC from ENTRY."
+  (catch 'no-password
+    (let ((host (plist-get spec :host))
+         (user (plist-get spec :user))
+         (prot (plist-get spec :protocol))
+         (source (plist-get entry :source))
+         result)
+      (cond
+       ;; Secret Service API.
+       ((consp source)
+       (let ((coll (auth-get-source entry))
+             item)
+         ;; Loop over candidates with a matching host attribute.
+         (dolist (elt (secrets-search-items coll :host host) item)
+           (when (and (or (not user)
+                          (string-equal
+                           user (secrets-get-attribute coll elt :user)))
+                      (or (not prot)
+                          (string-equal
+                           prot (secrets-get-attribute coll elt :protocol))))
+             (setq item elt)
+             (return elt)))
+         ;; Compose result.
+         (when item
+           (setq result
+                 (mapcar (lambda (m)
+                           (if (string-equal "password" m)
+                               (or (secrets-get-secret coll item)
+                                   ;; When we do not find a password,
+                                   ;; we return nil anyway.
+                                   (throw 'no-password nil))
+                             (or (secrets-get-attribute coll item :user)
+                                 user)))
+                         (if (consp mode) mode (list mode)))))
+         (if (consp mode) result (car result))))
+       ;; Anything else is netrc.
+       (t
+       (let ((search (list source (list host) (list (format "%s" prot))
+                           (auth-source-protocol-defaults prot))))
+         (setq result
+               (mapcar (lambda (m)
+                         (if (string-equal "password" m)
+                             (or (apply
+                                  'netrc-machine-user-or-password m search)
+                                 ;; When we do not find a password, we
+                                 ;; return nil anyway.
+                                 (throw 'no-password nil))
+                           (or (apply
+                                'netrc-machine-user-or-password m search)
+                               user)))
+                       (if (consp mode) mode (list mode)))))
+       (if (consp mode) result (car result)))))))
+
+(defun auth-source-create (mode entry &rest spec)
+  "Create interactively credentials according to SPEC in ENTRY.
+Return structure as specified by MODE."
+  (let* ((host (plist-get spec :host))
+        (user (plist-get spec :user))
+        (prot (plist-get spec :protocol))
+        (source (plist-get entry :source))
+        (name (concat (if user (format "%s@" user))
+                      host
+                      (if prot (format ":%s" prot))))
+        result)
+    (setq result
+         (mapcar
+          (lambda (m)
+            (if (equal "password" m)
+                (let ((passwd (read-passwd "Password: ")))
+                  (cond
+                   ;; Secret Service API.
+                   ((consp source)
+                    (apply
+                     'secrets-create-item
+                     (auth-get-source entry) name passwd spec))
+                   (t)) ;; netrc not implemented yes.
+                  passwd)
+              (or
+               ;; the originally requested :user
+               user
+               "unknown-user")))
+          (if (consp mode) mode (list mode))))
+    (if (consp mode) result (car result))))
+
+(defun auth-source-delete (entry &rest spec)
+  "Delete credentials according to SPEC in ENTRY."
+  (let ((host (plist-get spec :host))
+       (user (plist-get spec :user))
+       (prot (plist-get spec :protocol))
+       (source (plist-get entry :source)))
+    (cond
+     ;; Secret Service API.
+     ((consp source)
+      (let ((coll (auth-get-source entry)))
+       ;; Loop over candidates with a matching host attribute.
+       (dolist (elt (secrets-search-items coll :host host))
+         (when (and (or (not user)
+                        (string-equal
+                         user (secrets-get-attribute coll elt :user)))
+                    (or (not prot)
+                        (string-equal
+                         prot (secrets-get-attribute coll elt :protocol))))
+           (secrets-delete-item coll elt)))))
+     (t)))) ;; netrc not implemented yes.
+
+(defun auth-source-forget-user-or-password
+  (mode host protocol &optional username)
+  "Remove cached authentication token."
   (interactive "slogin/password: \nsHost: \nsProtocol: \n") ;for testing
-  (remhash (format "%s %s:%s" mode host protocol) auth-source-cache))
+  (remhash
+   (if username
+       (format "%s %s:%s %s" mode host protocol username)
+     (format "%s %s:%s" mode host protocol))
+   auth-source-cache))
 
 (defun auth-source-forget-all-cached ()
   "Forget all cached auth-source authentication tokens."
   (interactive)
   (setq auth-source-cache (make-hash-table :test 'equal)))
 
-(defun auth-source-user-or-password (mode host protocol)
+;; (progn
+;;   (auth-source-forget-all-cached)
+;;   (list
+;;    (auth-source-user-or-password '("login" "password") "imap.myhost.com" "other")
+;;    (auth-source-user-or-password '("login" "password") "imap.myhost.com" "other" "tzz")
+;;    (auth-source-user-or-password '("login" "password") "imap.myhost.com" "other" "joe")))
+
+(defun auth-source-user-or-password
+  (mode host protocol &optional username create-missing delete-existing)
   "Find MODE (string or list of strings) matching HOST and PROTOCOL.
-MODE can be \"login\" or \"password\" for example."
+
+USERNAME is optional and will be used as \"login\" in a search
+across the Secret Service API (see secrets.el) if the resulting
+items don't have a username.  This means that if you search for
+username \"joe\" and it matches an item but the item doesn't have
+a :user attribute, the username \"joe\" will be returned.
+
+A non nil DELETE-EXISTING means deleting any matching password
+entry in the respective sources.  This is useful only when
+CREATE-MISSING is non nil as well; the intended use case is to
+remove wrong password entries.
+
+If no matching entry is found, and CREATE-MISSING is non nil,
+the password will be retrieved interactively, and it will be
+stored in the password database which matches best (see
+`auth-sources').
+
+MODE can be \"login\" or \"password\"."
   (auth-source-do-debug
-   "auth-source-user-or-password: get %s for %s (%s)"
-   mode host protocol)
+   "auth-source-user-or-password: get %s for %s (%s) + user=%s"
+   mode host protocol username)
   (let* ((listy (listp mode))
         (mode (if listy mode (list mode)))
-        (cname (format "%s %s:%s" mode host protocol))
-        (found (gethash cname auth-source-cache)))
+        (cname (if username
+                   (format "%s %s:%s %s" mode host protocol username)
+                 (format "%s %s:%s" mode host protocol)))
+        (search (list :host host :protocol protocol))
+        (search (if username (append search (list :user username)) search))
+        (found (if (not delete-existing)
+                   (gethash cname auth-source-cache)
+                 (remhash cname auth-source-cache)
+                 nil)))
     (if found
        (progn
          (auth-source-do-debug
-          "auth-source-user-or-password: cached %s=%s for %s (%s)"
+          "auth-source-user-or-password: cached %s=%s for %s (%s) + %s"
           mode
           ;; don't show the password
-          (if (and (member "password" mode) auth-source-hide-passwords) "SECRET" found)
-          host protocol)
-         found)
-      (dolist (choice (auth-source-pick host protocol))
-       (setq found (netrc-machine-user-or-password
-                    mode
-                    (plist-get choice :source)
-                    (list host)
-                    (list (format "%s" protocol))
-                    (auth-source-protocol-defaults protocol)))
+          (if (and (member "password" mode) auth-source-hide-passwords)
+              "SECRET"
+            found)
+          host protocol username)
+         found)                        ; return the found data
+      ;; else, if not found
+      (let ((choices (apply 'auth-source-pick search)))
+       (dolist (choice choices)
+         (if delete-existing
+             (apply 'auth-source-delete choice search)
+           (setq found (apply 'auth-source-retrieve mode choice search)))
+         (and found (return found)))
+
+       ;; We haven't found something, so we will create it interactively.
+       (when (and (not found) choices create-missing)
+         (setq found (apply 'auth-source-create mode (car choices) search)))
+
+       ;; Cache the result.
        (when found
          (auth-source-do-debug
-          "auth-source-user-or-password: found %s=%s for %s (%s)"
+          "auth-source-user-or-password: found %s=%s for %s (%s) + %s"
           mode
           ;; don't show the password
-          (if (and (member "password" mode) auth-source-hide-passwords) "SECRET" found)
-          host protocol)
+          (if (and (member "password" mode) auth-source-hide-passwords)
+              "SECRET" found)
+          host protocol username)
          (setq found (if listy found (car-safe found)))
          (when auth-source-do-cache
            (puthash cname found auth-source-cache)))
-       (return found)))))
+
+       found))))
 
 (defun auth-source-protocol-defaults (protocol)
   "Return a list of default ports and names for PROTOCOL."
index b44d3c08c4aa55fb0dc7b1a2b8960ff9788eef1a..640eb50a0229d76adf74838f8f1bdad08b1846c4 100644 (file)
@@ -28,8 +28,6 @@
 
 ;;; Code:
 
-(require 'wid-edit)
-
 (defgroup gmm nil
   "Utility functions for Gnus, Message and MML."
   :prefix "gmm-"
@@ -95,6 +93,10 @@ ARGS are passed to `message'."
   "Non-nil if SYMBOL is a widget."
   (get symbol 'widget-type))
 
+(autoload 'widget-create-child-value "wid-edit")
+(autoload 'widget-convert "wid-edit")
+(autoload 'widget-default-get "wid-edit")
+
 ;; Copy of the `nnmail-lazy' code from `nnmail.el':
 (define-widget 'gmm-lazy 'default
   "Base widget for recursive datastructures.
index f385c71069bcf03bbd101e58488c39379ca7e34d..edc4e0f3befd9c20f55d5fc658f01814111b6d4c 100644 (file)
@@ -1583,7 +1583,8 @@ downloaded into the agent."
           (setq selected-sets (nreverse selected-sets))
 
           (gnus-make-directory dir)
-          (gnus-message 7 "Fetching articles for %s..." group)
+         (gnus-message 7 "Fetching articles for %s..."
+                       (gnus-agent-decoded-group-name group))
 
           (unwind-protect
               (while (setq articles (pop selected-sets))
@@ -1594,7 +1595,8 @@ downloaded into the agent."
                     (let (article)
                       (while (setq article (pop articles))
                         (gnus-message 10 "Fetching article %s for %s..."
-                                      article group)
+                                     article
+                                     (gnus-agent-decoded-group-name group))
                         (when (or
                                (gnus-backlog-request-article group article
                                                              nntp-server-buffer)
@@ -1942,7 +1944,8 @@ article numbers will be returned."
 
         (if articles
             (progn
-              (gnus-message 7 "Fetching headers for %s..." group)
+             (gnus-message 7 "Fetching headers for %s..."
+                           (gnus-agent-decoded-group-name group))
 
               ;; Fetch them.
               (gnus-make-directory (nnheader-translate-file-chars
@@ -3631,7 +3634,8 @@ articles in every agentized group? "))
  deleting them?")))
           (while to-remove
             (let ((dir (pop to-remove)))
-              (if (gnus-y-or-n-p (format "Delete %s? " dir))
+              (if (or gnus-expert-user
+                     (gnus-y-or-n-p (format "Delete %s? " dir)))
                   (let* (delete-recursive
                         files f
                          (delete-recursive
@@ -3904,7 +3908,7 @@ If REREAD is not nil, downloaded articles are marked as unread."
                     (sit-for 1)
                     t)))))
   (when group
-    (gnus-message 5 "Regenerating in %s" group)
+    (gnus-message 5 "Regenerating in %s" (gnus-agent-decoded-group-name group))
     (let* ((gnus-command-method (or gnus-command-method
                                    (gnus-find-method-for-group group)))
           (file (gnus-agent-article-name ".overview" group))
@@ -3981,7 +3985,8 @@ If REREAD is not nil, downloaded articles are marked as unread."
                      (or (not nov-arts)
                          (> (car downloaded) (car nov-arts))))
                 ;; This entry is missing from the overview file
-                (gnus-message 3 "Regenerating NOV %s %d..." group
+                (gnus-message 3 "Regenerating NOV %s %d..."
+                              (gnus-agent-decoded-group-name group)
                               (car downloaded))
                 (let ((file (concat dir (number-to-string (car downloaded)))))
                   (mm-with-unibyte-buffer
index 1a66404f841037e0d09c00b29c2795a8b14a5596..0d6d10222b26870d7bdeaa64f3040364e230b8f2 100644 (file)
@@ -2806,31 +2806,66 @@ summary buffer."
 (defun gnus-article-browse-delete-temp-files (&optional how)
   "Delete temp-files created by `gnus-article-browse-html-parts'."
   (when (and gnus-article-browse-html-temp-list
-            (or how
-                (setq how gnus-article-browse-delete-temp)))
-    (when (and (eq how 'ask)
-              (gnus-y-or-n-p (format
-                              "Delete all %s temporary HTML file(s)? "
-                              (length gnus-article-browse-html-temp-list)))
-              (setq how t)))
+            (progn
+              (or how (setq how gnus-article-browse-delete-temp))
+              (if (eq how 'ask)
+                  (let ((files (length gnus-article-browse-html-temp-list)))
+                    (gnus-y-or-n-p (format
+                                    "Delete all %s temporary HTML file%s? "
+                                    files
+                                    (if (> files 1) "s" ""))))
+                how)))
     (dolist (file gnus-article-browse-html-temp-list)
-      (when (and (file-exists-p file)
-                (or (eq how t)
-                    ;; `how' is neither `nil', `ask' nor `t' (i.e. `file'):
-                    (gnus-y-or-n-p
-                     (format "Delete temporary HTML file `%s'? " file))))
-       (delete-file file)))
+      (cond ((file-directory-p file)
+            (when (or (not (eq how 'file))
+                      (gnus-y-or-n-p
+                       (format
+                        "Delete temporary HTML file(s) in directory `%s'? "
+                        (file-name-as-directory file))))
+              (gnus-delete-directory file)))
+           ((file-exists-p file)
+            (when (or (not (eq how 'file))
+                      (gnus-y-or-n-p
+                       (format "Delete temporary HTML file `%s'? " file)))
+              (delete-file file)))))
     ;; Also remove file from the list when not deleted or if file doesn't
     ;; exist anymore.
     (setq gnus-article-browse-html-temp-list nil))
   gnus-article-browse-html-temp-list)
 
+(defun gnus-article-browse-html-save-cid-content (cid handles directory)
+  "Find CID content in HANDLES and save it in a file in DIRECTORY.
+Return file name."
+  (save-match-data
+    (let (file type)
+      (catch 'found
+       (dolist (handle handles)
+         (cond
+          ((not (listp handle)))
+          ((equal (mm-handle-media-supertype handle) "multipart")
+           (when (setq file (gnus-article-browse-html-save-cid-content
+                             cid handle directory))
+             (throw 'found file)))
+          ((equal (concat "<" cid ">") (mm-handle-id handle))
+           (setq file
+                 (expand-file-name
+                  (or (mail-content-type-get
+                       (mm-handle-disposition handle) 'filename)
+                      (mail-content-type-get
+                       (setq type (mm-handle-type handle)) 'name)
+                      (concat
+                       (make-temp-name "cid")
+                       (car (rassoc (car type) mailcap-mime-extensions))))
+                  directory))
+           (mm-save-part-to-file handle file)
+           (throw 'found file))))))))
+
 (defun gnus-article-browse-html-parts (list &optional header)
   "View all \"text/html\" parts from LIST.
 Recurse into multiparts.  The optional HEADER that should be a decoded
 message header will be added to the bodies of the \"text/html\" parts."
   ;; Internal function used by `gnus-article-browse-html-article'.
-  (let (type file charset tmp-file showed)
+  (let (type file charset content cid-dir tmp-file showed)
     ;; Find and show the html-parts.
     (dolist (handle list)
       ;; If HTML, show it:
@@ -2853,16 +2888,42 @@ message header will be added to the bodies of the \"text/html\" parts."
                        (setq handle (mm-handle-cache handle)
                              type (mm-handle-type handle))
                        (equal (car type) "text/html"))))
-            (when (or (setq charset (mail-content-type-get type 'charset))
-                      header
-                      (not file))
+            (setq charset (mail-content-type-get type 'charset)
+                  content (mm-get-part handle))
+            (with-temp-buffer
+              (if (eq charset 'gnus-decoded)
+                  (mm-enable-multibyte)
+                (mm-disable-multibyte))
+              (insert content)
+              ;; resolve cid contents
+              (let ((case-fold-search t)
+                    cid-file)
+                (goto-char (point-min))
+                (while (re-search-forward "\
+<img[\t\n ]+\\(?:[^\t\n >]+[\t\n ]+\\)*src=\"\\(cid:\\([^\"]+\\)\\)\""
+                                          nil t)
+                  (unless cid-dir
+                    (setq cid-dir (mm-make-temp-file "cid" t))
+                    (add-to-list 'gnus-article-browse-html-temp-list cid-dir))
+                  (setq file nil
+                        content nil)
+                  (when (setq cid-file
+                              (gnus-article-browse-html-save-cid-content
+                               (match-string 2)
+                               (with-current-buffer gnus-article-buffer
+                                 gnus-article-mime-handles)
+                               cid-dir))
+                    (replace-match (concat "file://" cid-file)
+                                   nil nil nil 1))))
+              (unless content (setq content (buffer-string))))
+            (when (or charset header (not file))
               (setq tmp-file (mm-make-temp-file
                               ;; Do we need to care for 8.3 filenames?
                               "mm-" nil ".html")))
             ;; Add a meta html tag to specify charset and a header.
             (cond
              (header
-              (let (title eheader body hcharset coding)
+              (let (title eheader body hcharset coding force-charset)
                 (with-temp-buffer
                   (mm-enable-multibyte)
                   (setq case-fold-search t)
@@ -2885,8 +2946,8 @@ message header will be added to the bodies of the \"text/html\" parts."
                                                              charset)
                             title (when title
                                     (mm-encode-coding-string title charset))
-                            body (mm-encode-coding-string (mm-get-part handle)
-                                                          charset))
+                            body (mm-encode-coding-string content charset)
+                            force-charset t)
                     (setq hcharset (mm-find-mime-charset-region (point-min)
                                                                 (point-max)))
                     (cond ((= (length hcharset) 1)
@@ -2907,7 +2968,7 @@ message header will be added to the bodies of the \"text/html\" parts."
                                         title (when title
                                                 (mm-encode-coding-string
                                                  title coding))
-                                        body (mm-get-part handle))
+                                        body content)
                                 (setq charset 'utf-8
                                       eheader (mm-encode-coding-string
                                                (buffer-string) charset)
@@ -2916,22 +2977,23 @@ message header will be added to the bodies of the \"text/html\" parts."
                                                title charset))
                                       body (mm-encode-coding-string
                                             (mm-decode-coding-string
-                                             (mm-get-part handle) body)
-                                            charset))))
+                                             content body)
+                                            charset)
+                                      force-charset t)))
                           (setq charset hcharset
                                 eheader (mm-encode-coding-string
                                          (buffer-string) coding)
                                 title (when title
                                         (mm-encode-coding-string
                                          title coding))
-                                body (mm-get-part handle)))
+                                body content))
                       (setq eheader (mm-string-as-unibyte (buffer-string))
-                            body (mm-get-part handle))))
+                            body content)))
                   (erase-buffer)
                   (mm-disable-multibyte)
                   (insert body)
                   (when charset
-                    (mm-add-meta-html-tag handle charset))
+                    (mm-add-meta-html-tag handle charset force-charset))
                   (when title
                     (goto-char (point-min))
                     (unless (search-forward "<title>" nil t)
@@ -2948,10 +3010,9 @@ message header will be added to the bodies of the \"text/html\" parts."
              (charset
               (mm-with-unibyte-buffer
                 (insert (if (eq charset 'gnus-decoded)
-                            (mm-encode-coding-string
-                             (mm-get-part handle)
-                             (setq charset 'utf-8))
-                          (mm-get-part handle)))
+                            (mm-encode-coding-string content
+                                                     (setq charset 'utf-8))
+                          content))
                 (if (or (mm-add-meta-html-tag handle charset)
                         (not file))
                     (mm-write-region (point-min) (point-max)
@@ -2998,17 +3059,23 @@ message header will be added to the bodies of the \"text/html\" parts."
 
 (defun gnus-article-browse-html-article (&optional arg)
   "View \"text/html\" parts of the current article with a WWW browser.
+Inline images embedded in a message using the cid scheme, as they are
+generally considered to be safe, will be processed properly.
 The message header is added to the beginning of every html part unless
 the prefix argument ARG is given.
 
-Warning: Spammers use links to images in HTML articles to verify
-whether you have read the message.  As
+Warning: Spammers use links to images (using the http scheme) in HTML
+articles to verify whether you have read the message.  As
 `gnus-article-browse-html-article' passes the HTML content to the
 browser without eliminating these \"web bugs\" you should only
 use it for mails from trusted senders.
 
 If you always want to display HTML parts in the browser, set
-`mm-text-html-renderer' to nil."
+`mm-text-html-renderer' to nil.
+
+This command creates temporary files to pass HTML contents including
+images if any to the browser, and deletes them when exiting the group
+\(if you want)."
   ;; Cf. `mm-w3m-safe-url-regexp'
   (interactive "P")
   (if arg
@@ -4192,6 +4259,8 @@ If variable `gnus-use-long-file-name' is non-nil, it is
                  (put-text-property (match-end 0) (point-max)
                                     'face eface)))))))))
 
+(autoload 'canlock-verify "canlock" nil t) ;; for Emacs 21.
+
 (defun article-verify-cancel-lock ()
   "Verify Cancel-Lock header."
   (interactive)
@@ -4345,6 +4414,8 @@ If variable `gnus-use-long-file-name' is non-nil, it is
 
     (gnus-run-hooks 'gnus-article-menu-hook)))
 
+(defvar bookmark-make-record-function)
+
 (defun gnus-article-mode ()
   "Major mode for displaying an article.
 
@@ -4383,6 +4454,8 @@ commands:
   (make-local-variable 'gnus-article-image-alist)
   (make-local-variable 'gnus-article-charset)
   (make-local-variable 'gnus-article-ignored-charsets)
+  (set (make-local-variable 'bookmark-make-record-function)
+       'gnus-summary-bookmark-make-record)
   ;; Prevent Emacs 22 from displaying non-break space with `nobreak-space'
   ;; face.
   (set (make-local-variable 'nobreak-char-display) nil)
@@ -4759,7 +4832,11 @@ General format specifiers can also be used.  See Info node
                           (with-current-buffer gnus-article-current-summary
                             gnus-newsgroup-name)
                         gnus-newsgroup-name)))
-           (if (cond ((stringp gnus-safe-html-newsgroups)
+           (if (cond ((not group)
+                      ;; Maybe we're in a mml-preview buffer
+                      ;; and no group is selected.
+                      t)
+                     ((stringp gnus-safe-html-newsgroups)
                       (string-match gnus-safe-html-newsgroups group))
                      ((consp gnus-safe-html-newsgroups)
                       (member group gnus-safe-html-newsgroups)))
@@ -4823,6 +4900,10 @@ General format specifiers can also be used.  See Info node
          (t
           (gnus-article-goto-part n)))))
 
+(defvar gnus-mime-buttonized-part-id nil
+  "ID of a mime part that should be buttonized.
+`gnus-mime-save-part-and-strip' and `gnus-mime-delete-part' bind it.")
+
 (eval-when-compile
   (defsubst gnus-article-edit-part (handles &optional current-id)
     "Edit an article in order to delete a mime part.
@@ -4865,10 +4946,15 @@ and `gnus-mime-delete-part', and not provided at run-time normally."
         ,(gnus-group-read-only-p)
         ,gnus-summary-buffer no-highlight))
      t)
-    (gnus-article-edit-done)
+    ;; Force buttonizing this part.
+    (let ((gnus-mime-buttonized-part-id current-id))
+      (gnus-article-edit-done))
     (gnus-configure-windows 'article)
     (when (and current-id (integerp gnus-auto-select-part))
-      (gnus-article-jump-to-part (+ current-id gnus-auto-select-part)))))
+      (gnus-article-jump-to-part
+       (min (max (+ current-id gnus-auto-select-part) 1)
+           (with-current-buffer gnus-article-buffer
+             (length gnus-article-mime-handle-alist)))))))
 
 (defun gnus-mime-replace-part (file)
   "Replace MIME part under point with an external body."
@@ -4978,13 +5064,14 @@ Deleting parts may malfunction or destroy the article; continue? "))
     (when data
       (mm-save-part data))))
 
-(defun gnus-mime-pipe-part ()
-  "Pipe the MIME part under point to a process."
+(defun gnus-mime-pipe-part (&optional cmd)
+  "Pipe the MIME part under point to a process.
+Use CMD as the process."
   (interactive)
   (gnus-article-check-buffer)
   (let ((data (get-text-property (point) 'gnus-data)))
     (when data
-      (mm-pipe-part data))))
+      (mm-pipe-part data cmd))))
 
 (defun gnus-mime-view-part ()
   "Interactively choose a viewing method for the MIME part under point."
@@ -5462,7 +5549,9 @@ N is the numerical prefix."
     1))
 
 (defun gnus-article-view-part (&optional n)
-  "View MIME part N, which is the numerical prefix."
+  "View MIME part N, which is the numerical prefix.
+If the part is already shown, hide the part.  If N is nil, view
+all parts."
   (interactive "P")
   (with-current-buffer gnus-article-buffer
     (or (numberp n) (setq n (gnus-article-mime-match-handle-first
@@ -5770,7 +5859,8 @@ If displaying \"text/html\" is discouraged \(see
                   ((or (bobp) (eq (char-before (1- (point))) ?\n)) 0)
                   (t 1))))
          (when (or (not display)
-                   (not (gnus-unbuttonized-mime-type-p type)))
+                   (not (gnus-unbuttonized-mime-type-p type))
+                   (eq id gnus-mime-buttonized-part-id))
            (gnus-insert-mime-button
             handle id (list (or display (and not-attachment text))))
            (gnus-article-insert-newline)
@@ -6195,18 +6285,22 @@ Argument LINES specifies lines to be scrolled up."
     (gnus-article-next-page-1 lines)
     nil))
 
-(defmacro gnus-article-beginning-of-window ()
+(defun gnus-article-beginning-of-window ()
   "Move point to the beginning of the window.
 In Emacs, the point is placed at the line number which `scroll-margin'
 specifies."
   (if (featurep 'xemacs)
-      '(move-to-window-line 0)
-    '(move-to-window-line
-      (min (max 0 scroll-margin)
-          (max 1 (- (window-height)
-                    (if mode-line-format 1 0)
-                    (if header-line-format 1 0)
-                    2))))))
+      (move-to-window-line 0)
+    ;; There is an obscure bug in Emacs that makes it impossible to
+    ;; scroll past big pictures in the article buffer.  Try to fix
+    ;; this by adding a sanity check by counting the lines visible.
+    (when (> (count-lines (window-start) (window-end)) 30)
+      (move-to-window-line
+       (min (max 0 scroll-margin)
+           (max 1 (- (window-height)
+                     (if mode-line-format 1 0)
+                     (if header-line-format 1 0)
+                     2)))))))
 
 (defun gnus-article-next-page-1 (lines)
   (unless (featurep 'xemacs)
@@ -7811,7 +7905,7 @@ url is put as the `gnus-button-url' overlay property on the button."
 
 ;;; External functions:
 
-(defun gnus-article-add-button (from to fun &optional data)
+(defun gnus-article-add-button (from to fun &optional data text)
   "Create a button between FROM and TO with callback FUN and data DATA."
   (when gnus-article-button-face
     (gnus-overlay-put (gnus-make-overlay from to nil t)
@@ -7823,6 +7917,7 @@ url is put as the `gnus-button-url' overlay property on the button."
          (list 'gnus-callback fun)
          (and data (list 'gnus-data data))))
   (widget-convert-button 'link from to :action 'gnus-widget-press-button
+                        :help-echo (or text "Follow the link")
                         :button-keymap gnus-widget-button-keymap))
 
 ;;; Internal functions:
index 432990e3c2ce33365a404af84343942bf111b426..95ea48803c73df2ef689f915356413d389ddf895 100644 (file)
@@ -71,6 +71,13 @@ It should return non-nil if the article is to be prefetched."
   :group 'gnus-asynchronous
   :type 'function)
 
+(defcustom gnus-async-post-fetch-function nil
+  "Function called after an article has been prefetched.
+The function will be called narrowed to the region of the article
+that was fetched."
+  :group 'gnus-asynchronous
+  :type 'function)
+
 ;;; Internal variables.
 
 (defvar gnus-async-prefetch-article-buffer " *Async Prefetch Article*")
@@ -227,6 +234,11 @@ It should return non-nil if the article is to be prefetched."
     (setq gnus-async-current-prefetch-article nil)
     (when arg
       (gnus-async-set-buffer)
+      (when gnus-async-post-fetch-function
+       (save-excursion
+         (save-restriction
+           (narrow-to-region mark (point-max))
+           (funcall gnus-async-post-fetch-function summary))))
       (gnus-async-with-semaphore
        (setq
         gnus-async-article-alist
index adec9cfd7256552d5bce6570a0e04cf345873ae1..9502bd819cc4081c5713108d4475e553f21484ac 100644 (file)
@@ -552,6 +552,24 @@ If WIDTH (the numerical prefix), use that text width when filling."
              gnus-cite-loose-attribution-alist nil
              gnus-cite-article nil)))))
 
+(defun gnus-article-natural-long-line-p ()
+  "Return true if the current line is long, and it's natural text."
+  (save-excursion
+    (beginning-of-line)
+    (and
+     ;; The line is long.
+     (> (- (line-end-position) (line-beginning-position))
+       (frame-width))
+     ;; It doesn't start with spaces.
+     (not (looking-at "    "))
+     ;; Not cited text.
+     (let ((line-number (1+ (count-lines (point-min) (point))))
+          citep)
+       (dolist (elem gnus-cite-prefix-alist)
+        (when (member line-number (cdr elem))
+          (setq citep t)))
+       (not citep)))))
+
 (defun gnus-article-hide-citation (&optional arg force)
   "Toggle hiding of all cited text except attribution lines.
 See the documentation for `gnus-article-highlight-citation'.
index 595a9fe4ffda625ec107fd8840245db815da6cfb..e5c886d86726b12ef8eab7a5f8b76cf266683da6 100644 (file)
@@ -39,6 +39,9 @@
 
 ;;; Code:
 
+(eval-when-compile
+  (when (featurep 'xemacs)
+    (require 'easy-mmode))) ; for `define-minor-mode'
 (require 'dired)
 (autoload 'mml-attach-file "mml")
 (autoload 'mm-default-file-encoding "mm-decode");; Shift this to `mailcap.el'?
 (autoload 'message-buffers "message")
 (autoload 'gnus-print-buffer "gnus-sum")
 
-(defvar gnus-dired-mode nil
-  "Minor mode for intersections of MIME mail composition and dired.")
-
-(defvar gnus-dired-mode-map nil)
-
-(unless gnus-dired-mode-map
-  (setq gnus-dired-mode-map (make-sparse-keymap))
-
-  (define-key gnus-dired-mode-map "\C-c\C-m\C-a" 'gnus-dired-attach)
-  (define-key gnus-dired-mode-map "\C-c\C-m\C-l" 'gnus-dired-find-file-mailcap)
-  (define-key gnus-dired-mode-map "\C-c\C-m\C-p" 'gnus-dired-print))
+(defvar gnus-dired-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map "\C-c\C-m\C-a" 'gnus-dired-attach)
+    (define-key map "\C-c\C-m\C-l" 'gnus-dired-find-file-mailcap)
+    (define-key map "\C-c\C-m\C-p" 'gnus-dired-print)
+    map))
 
 ;; FIXME: Make it customizable, change the default to `mail-user-agent' when
 ;; this file is renamed (e.g. to `dired-mime.el').
@@ -89,19 +87,19 @@ See `mail-user-agent' for more information."
                               gnus-user-agent)
                (function :tag "Other")))
 
-(defun gnus-dired-mode (&optional arg)
+(eval-when-compile
+  (when (featurep 'xemacs)
+    (defvar gnus-dired-mode-hook)
+    (defvar gnus-dired-mode-on-hook)
+    (defvar gnus-dired-mode-off-hook)))
+
+(define-minor-mode gnus-dired-mode
   "Minor mode for intersections of gnus and dired.
 
 \\{gnus-dired-mode-map}"
-  (interactive "P")
-  (when (eq major-mode 'dired-mode)
-    (set (make-local-variable 'gnus-dired-mode)
-        (if (null arg) (not gnus-dired-mode)
-          (> (prefix-numeric-value arg) 0)))
-    (when gnus-dired-mode
-      (add-minor-mode 'gnus-dired-mode "" gnus-dired-mode-map)
-      (save-current-buffer
-       (run-hooks 'gnus-dired-mode-hook)))))
+  :keymap gnus-dired-mode-map
+  (unless (derived-mode-p 'dired-mode)
+    (setq gnus-dired-mode nil)))
 
 ;;;###autoload
 (defun turn-on-gnus-dired-mode ()
index 1e6b7ee5dee11a4dd5e201a3e954890adada44ff..c04ea13b3a965371fca3aa3293ecc13ec21d6c9d 100644 (file)
 (require 'nndraft)
 (require 'gnus-agent)
 (eval-when-compile (require 'cl))
+(eval-when-compile
+  (when (featurep 'xemacs)
+    (require 'easy-mmode))) ; for `define-minor-mode'
 
 ;;; Draft minor mode
 
-(defvar gnus-draft-mode nil
-  "Minor mode for providing a draft summary buffers.")
-
-(defvar gnus-draft-mode-map nil)
-
-(unless gnus-draft-mode-map
-  (setq gnus-draft-mode-map (make-sparse-keymap))
-
-  (gnus-define-keys gnus-draft-mode-map
-    "Dt" gnus-draft-toggle-sending
-    "e"  gnus-draft-edit-message ;; Use `B w' for `gnus-summary-edit-article'
-    "De" gnus-draft-edit-message
-    "Ds" gnus-draft-send-message
-    "DS" gnus-draft-send-all-messages))
+(defvar gnus-draft-mode-map
+  (let ((map (make-sparse-keymap)))
+    (gnus-define-keys map
+     "Dt" gnus-draft-toggle-sending
+     "e"  gnus-draft-edit-message ;; Use `B w' for `gnus-summary-edit-article'
+     "De" gnus-draft-edit-message
+     "Ds" gnus-draft-send-message
+     "DS" gnus-draft-send-all-messages)
+    map))
 
 (defun gnus-draft-make-menu-bar ()
   (unless (boundp 'gnus-draft-menu)
        ["Send all messages" gnus-draft-send-all-messages t]
        ["Delete draft" gnus-summary-delete-article t]))))
 
-(defun gnus-draft-mode (&optional arg)
+(define-minor-mode gnus-draft-mode
   "Minor mode for providing a draft summary buffers.
 
 \\{gnus-draft-mode-map}"
-  (interactive "P")
-  (when (eq major-mode 'gnus-summary-mode)
-    (when (set (make-local-variable 'gnus-draft-mode)
-              (if (null arg) (not gnus-draft-mode)
-                (> (prefix-numeric-value arg) 0)))
-      ;; Set up the menu.
-      (when (gnus-visual-p 'draft-menu 'menu)
-       (gnus-draft-make-menu-bar))
-      (add-minor-mode 'gnus-draft-mode " Draft" gnus-draft-mode-map)
-      (gnus-run-hooks 'gnus-draft-mode-hook))))
+  :lighter " Draft" :keymap gnus-draft-mode-map
+  (cond
+   ((not (derived-mode-p 'gnus-summary-mode)) (setq gnus-draft-mode nil))
+   (gnus-draft-mode
+    ;; Set up the menu.
+    (when (gnus-visual-p 'draft-menu 'menu)
+      (gnus-draft-make-menu-bar)))))
 
 ;;; Commands
 
index efa74146a91595cd036570317232f7f57e195739..32b126a27132ba1a36df1e6567d6213010928159 100644 (file)
 
 (defun gnus-put-image (glyph &optional string category)
   (let ((point (point)))
-    (insert-image glyph (or string " "))
+    (insert-image glyph (or string "*"))
     (put-text-property point (point) 'gnus-image-category category)
     (unless string
       (put-text-property (1- (point)) (point)
          (setq start end
                end nil))))))
 
+(if (fboundp 'set-process-plist)
+    (progn
+      (defalias 'gnus-set-process-plist 'set-process-plist)
+      (defalias 'gnus-process-plist 'process-plist))
+  (defun gnus-set-process-plist (process plist)
+    "Replace the plist of PROCESS with PLIST.  Returns PLIST."
+    (put 'gnus-process-plist process plist))
+  (defun gnus-process-plist (process)
+    "Return the plist of PROCESS."
+    ;; Remove those of dead processes from `gnus-process-plist'
+    ;; to prevent it from growing.
+    (let ((plist (symbol-plist 'gnus-process-plist))
+         proc)
+      (while (setq proc (car plist))
+       (if (and (processp proc)
+                (memq (process-status proc) '(open run)))
+           (setq plist (cddr plist))
+         (setcar plist (caddr plist))
+         (setcdr plist (or (cdddr plist) '(nil))))))
+    (get 'gnus-process-plist process)))
+
 (provide 'gnus-ems)
 
 ;; arch-tag: e7360b45-14b5-4171-aa39-69a44aed3cdb
index 6d3b80e4f8827433a6cbb939b6ea89ee5fd4217e..e4758fadb85c0531a17f9c6c1dd26d1c48d34d53 100644 (file)
@@ -680,13 +680,6 @@ simple manner.")
   "\177" gnus-group-delete-group
   [delete] gnus-group-delete-group)
 
-(gnus-define-keys (gnus-group-soup-map "s" gnus-group-group-map)
-  "b" gnus-group-brew-soup
-  "w" gnus-soup-save-areas
-  "s" gnus-soup-send-replies
-  "p" gnus-soup-pack-packet
-  "r" nnsoup-pack-replies)
-
 (gnus-define-keys (gnus-group-sort-map "S" gnus-group-group-map)
   "s" gnus-group-sort-groups
   "a" gnus-group-sort-groups-by-alphabet
@@ -972,13 +965,6 @@ simple manner.")
     (easy-menu-define
      gnus-group-misc-menu gnus-group-mode-map ""
      `("Gnus"
-       ("SOUP"
-       ["Pack replies" nnsoup-pack-replies (fboundp 'nnsoup-request-group)]
-       ["Send replies" gnus-soup-send-replies
-        (fboundp 'gnus-soup-pack-packet)]
-       ["Pack packet" gnus-soup-pack-packet (fboundp 'gnus-soup-pack-packet)]
-       ["Save areas" gnus-soup-save-areas (fboundp 'gnus-soup-pack-packet)]
-       ["Brew SOUP" gnus-group-brew-soup (fboundp 'gnus-soup-pack-packet)])
        ["Send a mail" gnus-group-mail t]
        ["Send a message (mail or news)" gnus-group-post-news t]
        ["Create a local message" gnus-group-news t]
@@ -2202,7 +2188,10 @@ be permanent."
 The arguments are the same as `completing-read' except that COLLECTION
 and HIST default to `gnus-active-hashtb' and `gnus-group-history'
 respectively if they are omitted."
-  (let (group)
+  (let ((completion-styles (and (boundp 'completion-styles)
+                               completion-styles))
+       group)
+    (push 'substring completion-styles)
     (mapatoms (lambda (symbol)
                (setq group (symbol-name symbol))
                (set (intern (if (string-match "[^\000-\177]" group)
@@ -2364,7 +2353,7 @@ specified by `gnus-gmane-group-download-format'."
   (unless range (setq range 500))
   (when (< range 1)
     (error "Invalid range: %s" range))
-  (let ((tmpfile (make-temp-file
+  (let ((tmpfile (mm-make-temp-file
                  (format "%s.start-%s.range-%s." group start range)))
        (gnus-thread-sort-functions '(gnus-thread-sort-by-number)))
     (with-temp-file tmpfile
@@ -2445,7 +2434,7 @@ the bug number, and browsing the URL must return mbox output."
                     (cdr (assoc 'emacs gnus-bug-group-download-format-alist))))
   (when (stringp number)
     (setq number (string-to-number number)))
-  (let ((tmpfile (make-temp-file "gnus-temp-group-")))
+  (let ((tmpfile (mm-make-temp-file "gnus-temp-group-")))
     (with-temp-file tmpfile
       (url-insert-file-contents (format mbox-url number))
       (write-region (point-min) (point-max) tmpfile)
@@ -3094,42 +3083,6 @@ If there is, use Gnus to create an nnrss group"
          (nnrss-save-server-data nil))
       (error "No feeds found for %s" url))))
 
-(defvar nnwarchive-type-definition)
-(defvar gnus-group-warchive-type-history nil)
-(defvar gnus-group-warchive-login-history nil)
-(defvar gnus-group-warchive-address-history nil)
-
-(defun gnus-group-make-warchive-group ()
-  "Create a nnwarchive group."
-  (interactive)
-  (require 'nnwarchive)
-  (let* ((group (gnus-read-group "Group name: "))
-        (default-type (or (car gnus-group-warchive-type-history)
-                          (symbol-name (caar nnwarchive-type-definition))))
-        (type
-         (gnus-string-or
-          (completing-read
-           (format "Warchive type (default %s): " default-type)
-           (mapcar (lambda (elem) (list (symbol-name (car elem))))
-                   nnwarchive-type-definition)
-           nil t nil 'gnus-group-warchive-type-history)
-          default-type))
-        (address (read-string "Warchive address: "
-                              nil 'gnus-group-warchive-address-history))
-        (default-login (or (car gnus-group-warchive-login-history)
-                           user-mail-address))
-        (login
-         (gnus-string-or
-          (read-string
-           (format "Warchive login (default %s): " user-mail-address)
-           default-login 'gnus-group-warchive-login-history)
-          user-mail-address))
-        (method
-         `(nnwarchive ,address
-                      (nnwarchive-type ,(intern type))
-                      (nnwarchive-login ,login))))
-    (gnus-group-make-group group method)))
-
 (defun gnus-group-make-archive-group (&optional all)
   "Create the (ding) Gnus archive group of the most recent articles.
 Given a prefix, create a full group."
diff --git a/lisp/gnus/gnus-html.el b/lisp/gnus/gnus-html.el
new file mode 100644 (file)
index 0000000..576d883
--- /dev/null
@@ -0,0 +1,256 @@
+;;; gnus-html.el --- Quoted-Printable functions
+
+;; Copyright (C) 2010  Free Software Foundation, Inc.
+
+;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
+;; Keywords: html, web
+
+;; 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 idea is to provide a simple, fast and pretty minimal way to
+;; render HTML (including links and images) in a buffer, based on an
+;; external HTML renderer (i.e., w3m).
+
+;;; Code:
+
+(eval-when-compile (require 'cl))
+(eval-when-compile (require 'mm-decode))
+(require 'mm-url)
+
+(defcustom gnus-html-cache-directory (nnheader-concat gnus-directory "html-cache/")
+  "Where Gnus will cache images it downloads from the web."
+  :group 'gnus-art
+  :type 'directory)
+
+(defcustom gnus-html-cache-size 500000000
+  "The size of the Gnus image cache."
+  :group 'gnus-art
+  :type 'integer)
+
+(defcustom gnus-html-frame-width 70
+  "What width to use when rendering HTML."
+  :group 'gnus-art
+  :type 'integer)
+
+(defcustom gnus-blocked-images "."
+  "Images that have URLs matching this regexp will be blocked."
+  :group 'gnus-art
+  :type 'regexp)
+
+;;;###autoload
+(defun gnus-article-html (handle)
+  (let ((article-buffer (current-buffer)))
+    (save-restriction
+      (narrow-to-region (point) (point))
+      (save-excursion
+       (mm-with-part handle
+         (let* ((coding-system-for-read 'utf-8)
+                (coding-system-for-write 'utf-8)
+                (default-process-coding-system
+                  (cons coding-system-for-read coding-system-for-write)))
+           (call-process-region (point-min) (point-max)
+                                "w3m" 
+                                nil article-buffer nil
+                                "-halfdump"
+                                "-no-cookie"
+                                "-I" "UTF-8"
+                                "-O" "UTF-8"
+                                "-o" "ext_halfdump=1"
+                                "-o" "pre_conv=1"
+                                "-t" (format "%s" tab-width)
+                                "-cols" (format "%s" gnus-html-frame-width)
+                                "-o" "display_image=off"
+                                "-T" "text/html"))))
+      (gnus-html-wash-tags))))
+
+(defvar gnus-article-mouse-face)
+
+(defun gnus-html-wash-tags ()
+  (let (tag parameters string start end images url)
+    (mm-url-decode-entities)
+    (goto-char (point-min))
+    (while (re-search-forward "<\\([^ />]+\\)\\([^>]*\\)>" nil t)
+      (setq tag (match-string 1)
+           parameters (match-string 2)
+           start (match-beginning 0))
+      (when (plusp (length parameters))
+       (set-text-properties 0 (1- (length parameters)) nil parameters))
+      (delete-region start (point))
+      (when (search-forward (concat "</" tag ">") nil t)
+       (delete-region (match-beginning 0) (match-end 0)))
+      (setq end (point))
+      (cond
+       ;; Fetch and insert a picture.
+       ((equal tag "img_alt")
+       (when (string-match "src=\"\\([^\"]+\\)" parameters)
+         (setq url (match-string 1 parameters))
+         (if (string-match "^cid:\\(.*\\)" url)
+             ;; URLs with cid: have their content stashed in other
+             ;; parts of the MIME structure, so just insert them
+             ;; immediately.
+             (let ((handle (mm-get-content-id
+                            (setq url (match-string 1 url))))
+                   image)
+               (when handle
+                 (mm-with-part handle
+                   (setq image (gnus-create-image (buffer-string)
+                                                  nil t))))
+               (when image
+                 (delete-region start end)
+                 (gnus-put-image image)))
+           ;; Normal, external URL.
+           (when (or (null gnus-blocked-images)
+                     (not (string-match gnus-blocked-images url)))
+             (let ((file (gnus-html-image-id url)))
+               (if (file-exists-p file)
+                   ;; It's already cached, so just insert it.
+                   (when (gnus-html-put-image file (point))
+                     ;; Delete the ALT text.
+                     (delete-region start end))
+                 ;; We don't have it, so schedule it for fetching
+                 ;; asynchronously.
+                 (push (list url
+                             (set-marker (make-marker) start)
+                             (point-marker))
+                       images)))))))
+       ;; Add a link.
+       ((equal tag "a")
+       (when (string-match "href=\"\\([^\"]+\\)" parameters)
+         (setq url (match-string 1 parameters))
+         (gnus-article-add-button start end
+                                  'browse-url url
+                                  url)
+         (let ((overlay (gnus-make-overlay start end)))
+           (gnus-overlay-put overlay 'evaporate t)
+           (gnus-overlay-put overlay 'gnus-button-url url)
+           (when gnus-article-mouse-face
+             (gnus-overlay-put overlay 'mouse-face gnus-article-mouse-face)))))
+       ;; Whatever.  Just ignore the tag.
+       (t
+       ))
+      (goto-char start))
+    (goto-char (point-min))
+    ;; The output from -halfdump isn't totally regular, so strip
+    ;; off any </pre_int>s that were left over.
+    (while (re-search-forward "</pre_int>" nil t)
+      (replace-match "" t t))
+    (when images
+      (gnus-html-schedule-image-fetching (current-buffer) (nreverse images)))))
+
+(defun gnus-html-schedule-image-fetching (buffer images)
+  (let* ((url (caar images))
+        (process (start-process
+                  "images" nil "curl"
+                  "-s" "--create-dirs"
+                  "--location"
+                  "--max-time" "60"
+                  "-o" (gnus-html-image-id url)
+                  url)))
+    (process-kill-without-query process)
+    (set-process-sentinel process 'gnus-html-curl-sentinel)
+    (gnus-set-process-plist process (list 'images images
+                                         'buffer buffer))))
+
+(defun gnus-html-image-id (url)
+  (expand-file-name (sha1 url) gnus-html-cache-directory))
+
+(defun gnus-html-curl-sentinel (process event)
+  (when (string-match "finished" event)
+    (let* ((images (process-get process 'images))
+          (buffer (process-get process 'buffer))
+          (spec (pop images))
+          (file (gnus-html-image-id (car spec))))
+      (when (and (buffer-live-p buffer)
+                ;; If the position of the marker is 1, then that
+                ;; means that the text it was in has been deleted;
+                ;; i.e., that the user has selected a different
+                ;; article before the image arrived.
+                (not (= (marker-position (cadr spec)) (point-min))))
+       (with-current-buffer buffer
+         (let ((inhibit-read-only t))
+           (when (gnus-html-put-image file (cadr spec))
+             (delete-region (1+ (cadr spec)) (caddr spec))))))
+      (when images
+       (gnus-html-schedule-image-fetching buffer images)))))
+
+(defun gnus-html-put-image (file point)
+  (when (display-graphic-p)
+    (let ((image (ignore-errors
+                  (gnus-create-image file))))
+      (save-excursion
+       (goto-char point)
+       (if (and image
+                ;; Kludge to avoid displaying 30x30 gif images, which
+                ;; seems to be a signal of a broken image.
+                (not (and (listp image)
+                          (eq (plist-get (cdr image) :type) 'gif)
+                          (= (car (image-size image t)) 30)
+                          (= (cdr (image-size image t)) 30))))
+           (progn
+             (gnus-put-image image)
+             t)
+         (when (fboundp 'find-image)
+           (gnus-put-image (find-image
+                            '((:type xpm :file "lock-broken.xpm")))))
+         nil)))))
+
+(defun gnus-html-prune-cache ()
+  (let ((total-size 0)
+       files)
+    (dolist (file (directory-files gnus-html-cache-directory t nil t))
+      (let ((attributes (file-attributes file)))
+       (unless (nth 0 attributes)
+         (incf total-size (nth 7 attributes))
+         (push (list (time-to-seconds (nth 5 attributes))
+                     (nth 7 attributes) file)
+               files))))
+    (when (> total-size gnus-html-cache-size)
+      (setq files (sort files (lambda (f1 f2)
+                               (< (car f1) (car f2)))))
+      (dolist (file files)
+       (when (> total-size gnus-html-cache-size)
+         (decf total-size (cadr file))
+         (delete-file (nth 2 file)))))))
+
+;;;###autoload
+(defun gnus-html-prefetch-images (summary)
+  (let (blocked-images urls)
+    (when (buffer-live-p summary)
+      (with-current-buffer summary
+       (setq blocked-images gnus-blocked-images))
+      (save-match-data
+       (while (re-search-forward "<img.*src=[\"']\\([^\"']+\\)" nil t)
+         (let ((url (match-string 1)))
+           (when (or (null blocked-images)
+                     (not (string-match blocked-images url)))
+             (unless (file-exists-p (gnus-html-image-id url))
+               (push url urls)
+               (push (gnus-html-image-id url) urls)
+               (push "-o" urls)))))
+       (let ((process
+              (apply 'start-process 
+                     "images" nil "curl"
+                     "-s" "--create-dirs"
+                     "--location"
+                     "--max-time" "60"
+                     urls)))
+         (process-kill-without-query process))))))
+
+(provide 'gnus-html)
+
+;;; gnus-html.el ends here
index 078a8cfa15ceaff24a1dc15ebb96f1cddabf8990..30c1bfedcefd8b3231eebd2f50ba23f27b2d3e22 100644 (file)
 (require 'gnus)
 (require 'gnus-msg)
 (eval-when-compile (require 'cl))
+(eval-when-compile
+  (when (featurep 'xemacs)
+    (require 'easy-mmode))) ; for `define-minor-mode'
 
 ;;; Mailing list minor mode
 
-(defvar gnus-mailing-list-mode nil
-  "Minor mode for providing mailing-list commands.")
-
-(defvar gnus-mailing-list-mode-map nil)
+(defvar gnus-mailing-list-mode-map
+  (let ((map (make-sparse-keymap)))
+    (gnus-define-keys map
+      "\C-c\C-nh" gnus-mailing-list-help
+      "\C-c\C-ns" gnus-mailing-list-subscribe
+      "\C-c\C-nu" gnus-mailing-list-unsubscribe
+      "\C-c\C-np" gnus-mailing-list-post
+      "\C-c\C-no" gnus-mailing-list-owner
+      "\C-c\C-na" gnus-mailing-list-archive)
+    map))
 
 (defvar gnus-mailing-list-menu)
 
-(unless gnus-mailing-list-mode-map
-  (setq gnus-mailing-list-mode-map (make-sparse-keymap))
-
-  (gnus-define-keys gnus-mailing-list-mode-map
-    "\C-c\C-nh" gnus-mailing-list-help
-    "\C-c\C-ns" gnus-mailing-list-subscribe
-    "\C-c\C-nu" gnus-mailing-list-unsubscribe
-    "\C-c\C-np" gnus-mailing-list-post
-    "\C-c\C-no" gnus-mailing-list-owner
-    "\C-c\C-na" gnus-mailing-list-archive))
-
 (defun gnus-mailing-list-make-menu-bar ()
   (unless (boundp 'gnus-mailing-list-menu)
     (easy-menu-define
@@ -87,22 +85,26 @@ If FORCE is non-nil, replace the old ones."
          (gnus-mailing-list-mode 1))
       (gnus-message 1 "no list-post in this message."))))
 
+(eval-when-compile
+  (when (featurep 'xemacs)
+    (defvar gnus-mailing-list-mode-hook)
+    (defvar gnus-mailing-list-mode-on-hook)
+    (defvar gnus-mailing-list-mode-off-hook)))
+
 ;;;###autoload
-(defun gnus-mailing-list-mode (&optional arg)
+(define-minor-mode gnus-mailing-list-mode
   "Minor mode for providing mailing-list commands.
 
 \\{gnus-mailing-list-mode-map}"
-  (interactive "P")
-  (when (eq major-mode 'gnus-summary-mode)
-    (when (set (make-local-variable 'gnus-mailing-list-mode)
-              (if (null arg) (not gnus-mailing-list-mode)
-                (> (prefix-numeric-value arg) 0)))
-      ;; Set up the menu.
-      (when (gnus-visual-p 'mailing-list-menu 'menu)
-       (gnus-mailing-list-make-menu-bar))
-      (add-minor-mode 'gnus-mailing-list-mode " Mailing-List"
-                     gnus-mailing-list-mode-map)
-      (gnus-run-hooks 'gnus-mailing-list-mode-hook))))
+  :lighter " Mailing-List"
+  :keymap gnus-mailing-list-mode-map
+  (cond
+   ((not (derived-mode-p 'gnus-summary-mode))
+    (setq gnus-mailing-list-mode nil))
+   (gnus-mailing-list-mode
+    ;; Set up the menu.
+    (when (gnus-visual-p 'mailing-list-menu 'menu)
+      (gnus-mailing-list-make-menu-bar)))))
 
 ;;; Commands
 
diff --git a/lisp/gnus/gnus-move.el b/lisp/gnus/gnus-move.el
deleted file mode 100644 (file)
index 2c7a958..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-;;; gnus-move.el --- commands for moving Gnus from one server to another
-
-;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
-
-;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
-;; Keywords: news
-
-;; 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:
-
-(eval-when-compile (require 'cl))
-
-(require 'gnus)
-(require 'gnus-start)
-(require 'gnus-int)
-(require 'gnus-range)
-
-;;;
-;;; Moving by comparing Message-ID's.
-;;;
-
-;;;###autoload
-(defun gnus-change-server (from-server to-server)
-  "Move from FROM-SERVER to TO-SERVER.
-Update the .newsrc.eld file to reflect the change of nntp server."
-  (interactive
-   (list gnus-select-method (gnus-read-method "Move to method: ")))
-
-  ;; First start Gnus.
-  (let ((gnus-activate-level 0)
-       (mail-sources nil))
-    (gnus))
-
-  (save-excursion
-    ;; Go through all groups and translate.
-    (let ((nntp-nov-gap nil))
-      (dolist (info gnus-newsrc-alist)
-       (when (gnus-group-native-p (gnus-info-group info))
-         (gnus-move-group-to-server info from-server to-server))))))
-
-(defun gnus-move-group-to-server (info from-server to-server)
-  "Move group INFO from FROM-SERVER to TO-SERVER."
-  (let ((group (gnus-info-group info))
-       to-active hashtb type mark marks
-       to-article to-reads to-marks article
-       act-articles)
-    (gnus-message 7 "Translating %s..." group)
-    (when (gnus-request-group group nil to-server)
-      (setq to-active (gnus-parse-active)
-           hashtb (gnus-make-hashtable 1024)
-           act-articles (gnus-uncompress-range to-active))
-      ;; Fetch the headers from the `to-server'.
-      (when (and to-active
-                act-articles
-                (setq type (gnus-retrieve-headers
-                            act-articles
-                            group to-server)))
-       ;; Convert HEAD headers.  I don't care.
-       (when (eq type 'headers)
-         (nnvirtual-convert-headers))
-       ;; Create a mapping from Message-ID to article number.
-       (set-buffer nntp-server-buffer)
-       (goto-char (point-min))
-       (while (looking-at
-               "^[0-9]+\t[^\t]*\t[^\t]*\t[^\t]*\t\\([^\t]*\\)\t")
-         (gnus-sethash
-          (buffer-substring (match-beginning 1) (match-end 1))
-          (read (current-buffer))
-          hashtb)
-         (forward-line 1))
-       ;; Then we read the headers from the `from-server'.
-       (when (and (gnus-request-group group nil from-server)
-                  (gnus-active group)
-                  (gnus-uncompress-range
-                   (gnus-active group))
-                  (setq type (gnus-retrieve-headers
-                              (gnus-uncompress-range
-                               (gnus-active group))
-                              group from-server)))
-         ;; Make it easier to map marks.
-         (let ((mark-lists (gnus-info-marks info))
-               ms type m)
-           (while mark-lists
-             (setq type (caar mark-lists)
-                   ms (gnus-uncompress-range (cdr (pop mark-lists))))
-             (while ms
-               (if (setq m (assq (car ms) marks))
-                   (setcdr m (cons type (cdr m)))
-                 (push (list (car ms) type) marks))
-               (pop ms))))
-         ;; Convert.
-         (when (eq type 'headers)
-           (nnvirtual-convert-headers))
-         ;; Go through the headers and map away.
-         (set-buffer nntp-server-buffer)
-         (goto-char (point-min))
-         (while (looking-at
-                 "^[0-9]+\t[^\t]*\t[^\t]*\t[^\t]*\t\\([^\t]*\\)\t")
-           (when (setq to-article
-                       (gnus-gethash
-                        (buffer-substring (match-beginning 1) (match-end 1))
-                        hashtb))
-             ;; Add this article to the list of read articles.
-             (push to-article to-reads)
-             ;; See if there are any marks and then add them.
-             (when (setq mark (assq (read (current-buffer)) marks))
-               (setq marks (delq mark marks))
-               (setcar mark to-article)
-               (push mark to-marks))
-             (forward-line 1)))
-         ;; Now we know what the read articles are and what the
-         ;; article marks are.  We transform the information
-         ;; into the Gnus info format.
-         (setq to-reads
-               (gnus-range-add
-                (gnus-compress-sequence
-                 (and (setq to-reads (delq nil to-reads))
-                      (sort to-reads '<))
-                 t)
-                (cons 1 (1- (car to-active)))))
-         (gnus-info-set-read info to-reads)
-         ;; Do the marks.  I'm sure y'all understand what's
-         ;; going on down below, so I won't bother with any
-         ;; further comments.  <duck>
-         (let ((mlists gnus-article-mark-lists)
-               lists ms a)
-           (while mlists
-             (push (list (cdr (pop mlists))) lists))
-           (while (setq ms (pop marks))
-             (setq article (pop ms))
-             (while ms
-               (setcdr (setq a (assq (pop ms) lists))
-                       (cons article (cdr a)))))
-           (setq a lists)
-           (while a
-             (setcdr (car a) (gnus-compress-sequence
-                              (and (cdar a) (sort (cdar a) '<))))
-             (pop a))
-           (gnus-info-set-marks info lists t)))))
-    (gnus-message 7 "Translating %s...done" group)))
-
-(defun gnus-group-move-group-to-server (info from-server to-server)
-  "Move the group on the current line from FROM-SERVER to TO-SERVER."
-  (interactive
-   (let ((info (gnus-get-info (gnus-group-group-name))))
-     (list info (gnus-find-method-for-group (gnus-info-group info))
-          (gnus-read-method (format "Move group %s to method: "
-                                    (gnus-info-group info))))))
-  (save-excursion
-    (gnus-move-group-to-server info from-server to-server)
-    ;; We have to update the group info to point use the right server.
-    (gnus-info-set-method info to-server t)
-    ;; We also have to change the name of the group and stuff.
-    (let* ((group (gnus-info-group info))
-          (new-name (gnus-group-prefixed-name
-                     (gnus-group-real-name group) to-server)))
-      (gnus-info-set-group info new-name)
-      (gnus-sethash new-name (gnus-group-entry group) gnus-newsrc-hashtb)
-      (gnus-sethash group nil gnus-newsrc-hashtb))))
-
-(provide 'gnus-move)
-
-;; arch-tag: 503742b8-7d66-4d79-bb31-4a698070707b
-;;; gnus-move.el ends here
index e77b66e150d54a51879df4591359e4e262145af6..e3af088278c6a9032ab43da14042b01e89170cc8 100644 (file)
@@ -60,6 +60,7 @@
 (require 'gnus-sum)
 (require 'gnus-util)
 (require 'nnmail)
+(require 'easymenu)
 
 (defvar gnus-adaptive-word-syntax-table)
 
@@ -137,6 +138,10 @@ references.'"
                 (const :tag "Always Install" t)
                 (const :tag "Ask Me" ask)))
 
+(defvar gnus-summary-misc-menu) ;; Avoid byte compiler warning.
+
+(defvar gnus-registry-misc-menus nil)  ; ugly way to keep the menus
+
 (defcustom gnus-registry-clean-empty t
   "Whether the empty registry entries should be deleted.
 Registry entries are considered empty when they have no groups
@@ -656,10 +661,10 @@ necessary."
   "Determines if a group name should be followed.
 Consults `gnus-registry-unfollowed-groups' and
 `nnmail-split-fancy-with-parent-ignore-groups'."
-  (not (or (gnus-registry-grep-in-list
+  (not (or (gnus-grep-in-list
            group
            gnus-registry-unfollowed-groups)
-          (gnus-registry-grep-in-list
+          (gnus-grep-in-list
            group
            nnmail-split-fancy-with-parent-ignore-groups))))
 
@@ -740,14 +745,6 @@ Consults `gnus-registry-unfollowed-groups' and
                          (assoc article (gnus-data-list nil)))))
     nil))
 
-(defun gnus-registry-grep-in-list (word list)
-"Find if a WORD matches any regular expression in the given LIST."
-  (when (and word list)
-    (catch 'found
-      (dolist (r list)
-       (when (string-match r word)
-         (throw 'found r))))))
-
 (defun gnus-registry-do-marks (type function)
   "For each known mark, call FUNCTION for each cell of type TYPE.
 
@@ -764,7 +761,8 @@ FUNCTION should take two parameters, a mark symbol and the cell value."
   "Install the keyboard shortcuts and menus for the registry.
 Uses `gnus-registry-marks' to find what shortcuts to install."
   (let (keys-plist)
-    (gnus-registry-do-marks 
+    (setq gnus-registry-misc-menus nil)
+    (gnus-registry-do-marks
      :char
      (lambda (mark data)
        (let ((function-format
@@ -813,19 +811,34 @@ Uses `gnus-registry-marks' to find what shortcuts to install."
                    ;; 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 
+                     article
                      (assoc article (gnus-data-list nil)))))))
             (push (intern function-name) keys-plist)
-            (push shortcut keys-plist)
-            (gnus-message 
+            (push shortcut keys-plist)      
+            (push (vector (format "%s %s"
+                                  (upcase-initials variant-name)
+                                  (symbol-name mark))
+                          (intern function-name) t)
+                  gnus-registry-misc-menus)
+            (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)))
+     '(gnus-registry-mark-map "M" gnus-summary-mark-map)
+     keys-plist)
+    (add-hook 'gnus-summary-menu-hook
+             (lambda ()
+               (easy-menu-add-item 
+                gnus-summary-misc-menu
+                nil 
+                (cons "Registry Marks" gnus-registry-misc-menus))))))
 
 ;;; use like this:
 ;;; (defalias 'gnus-user-format-function-M 
index d729fada009d8ff9836ec06dec30f561458101fa..52f307d7fddb5084bc91c2776364a2f768e87717 100644 (file)
@@ -26,6 +26,9 @@
 ;;; Code:
 
 (eval-when-compile (require 'cl))
+(eval-when-compile
+  (when (featurep 'xemacs)
+    (require 'easy-mmode))) ; for `define-minor-mode'
 
 (require 'gnus)
 (require 'gnus-sum)
 ;;; gnus-pick-mode
 ;;;
 
-(defvar gnus-pick-mode nil
-  "Minor mode for providing a pick-and-read interface in Gnus
-summary buffers.")
-
 (defcustom gnus-pick-display-summary nil
   "*Display summary while reading."
   :type 'boolean
@@ -72,17 +71,15 @@ It accepts the same format specs that `gnus-summary-line-format' does."
 
 ;;; Internal variables.
 
-(defvar gnus-pick-mode-map nil)
-
-(unless gnus-pick-mode-map
-  (setq gnus-pick-mode-map (make-sparse-keymap))
-
-  (gnus-define-keys gnus-pick-mode-map
-    " " gnus-pick-next-page
-    "u" gnus-pick-unmark-article-or-thread
-    "." gnus-pick-article-or-thread
-    gnus-down-mouse-2 gnus-pick-mouse-pick-region
-    "\r" gnus-pick-start-reading))
+(defvar gnus-pick-mode-map
+  (let ((map (make-sparse-keymap)))
+    (gnus-define-keys map
+      " " gnus-pick-next-page
+      "u" gnus-pick-unmark-article-or-thread
+      "." gnus-pick-article-or-thread
+      gnus-down-mouse-2 gnus-pick-mouse-pick-region
+      "\r" gnus-pick-start-reading)
+    map))
 
 (defun gnus-pick-make-menu-bar ()
   (unless (boundp 'gnus-pick-menu)
@@ -104,30 +101,35 @@ It accepts the same format specs that `gnus-summary-line-format' does."
        ["Start reading" gnus-pick-start-reading t]
        ["Switch pick mode off" gnus-pick-mode gnus-pick-mode]))))
 
-(defun gnus-pick-mode (&optional arg)
+(eval-when-compile
+  (when (featurep 'xemacs)
+    (defvar gnus-pick-mode-on-hook)
+    (defvar gnus-pick-mode-off-hook)))
+
+(define-minor-mode gnus-pick-mode
   "Minor mode for providing a pick-and-read interface in Gnus summary buffers.
 
 \\{gnus-pick-mode-map}"
-  (interactive "P")
-  (when (eq major-mode 'gnus-summary-mode)
-    (if (not (set (make-local-variable 'gnus-pick-mode)
-                 (if (null arg) (not gnus-pick-mode)
-                   (> (prefix-numeric-value arg) 0))))
-       (remove-hook 'gnus-message-setup-hook 'gnus-pick-setup-message)
-      ;; Make sure that we don't select any articles upon group entry.
-      (set (make-local-variable 'gnus-auto-select-first) nil)
-      ;; Change line format.
-      (setq gnus-summary-line-format gnus-summary-pick-line-format)
-      (setq gnus-summary-line-format-spec nil)
-      (gnus-update-format-specifications nil 'summary)
-      (gnus-update-summary-mark-positions)
-      (add-hook 'gnus-message-setup-hook 'gnus-pick-setup-message)
-      (set (make-local-variable 'gnus-summary-goto-unread) 'never)
-      ;; Set up the menu.
-      (when (gnus-visual-p 'pick-menu 'menu)
-       (gnus-pick-make-menu-bar))
-      (add-minor-mode 'gnus-pick-mode " Pick" gnus-pick-mode-map)
-      (gnus-run-hooks 'gnus-pick-mode-hook))))
+  :lighter " Pick" :keymap gnus-pick-mode-map
+  (cond
+   ((not (derived-mode-p 'gnus-summary-mode)) (setq gnus-pick-mode nil))
+   ((not gnus-pick-mode)
+    ;; FIXME: a buffer-local minor mode removing globally from a hook??
+    (remove-hook 'gnus-message-setup-hook 'gnus-pick-setup-message))
+   (t
+    ;; Make sure that we don't select any articles upon group entry.
+    (set (make-local-variable 'gnus-auto-select-first) nil)
+    ;; Change line format.
+    (setq gnus-summary-line-format gnus-summary-pick-line-format)
+    (setq gnus-summary-line-format-spec nil)
+    (gnus-update-format-specifications nil 'summary)
+    (gnus-update-summary-mark-positions)
+    ;; FIXME: a buffer-local minor mode adding globally to a hook??
+    (add-hook 'gnus-message-setup-hook 'gnus-pick-setup-message)
+    (set (make-local-variable 'gnus-summary-goto-unread) 'never)
+    ;; Set up the menu.
+    (when (gnus-visual-p 'pick-menu 'menu)
+      (gnus-pick-make-menu-bar)))))
 
 (defun gnus-pick-setup-message ()
   "Make Message do the right thing on exit."
@@ -319,20 +321,14 @@ This must be bound to a button-down mouse event."
 ;;; gnus-binary-mode
 ;;;
 
-(defvar gnus-binary-mode nil
-  "Minor mode for providing a binary group interface in Gnus summary buffers.")
-
 (defvar gnus-binary-mode-hook nil
   "Hook run in summary binary mode buffers.")
 
-(defvar gnus-binary-mode-map nil)
-
-(unless gnus-binary-mode-map
-  (setq gnus-binary-mode-map (make-sparse-keymap))
-
-  (gnus-define-keys
-      gnus-binary-mode-map
-    "g" gnus-binary-show-article))
+(defvar gnus-binary-mode-map
+  (let ((map (make-sparse-keymap)))
+    (gnus-define-keys map
+      "g" gnus-binary-show-article)
+    map))
 
 (defun gnus-binary-make-menu-bar ()
   (unless (boundp 'gnus-binary-menu)
@@ -341,25 +337,25 @@ This must be bound to a button-down mouse event."
       '("Pick"
        ["Switch binary mode off" gnus-binary-mode t]))))
 
-(defun gnus-binary-mode (&optional arg)
+(eval-when-compile
+  (when (featurep 'xemacs)
+    (defvar gnus-binary-mode-on-hook)
+    (defvar gnus-binary-mode-off-hook)))
+
+(define-minor-mode gnus-binary-mode
   "Minor mode for providing a binary group interface in Gnus summary buffers."
-  (interactive "P")
-  (when (eq major-mode 'gnus-summary-mode)
-    (make-local-variable 'gnus-binary-mode)
-    (setq gnus-binary-mode
-         (if (null arg) (not gnus-binary-mode)
-           (> (prefix-numeric-value arg) 0)))
-    (when gnus-binary-mode
-      ;; Make sure that we don't select any articles upon group entry.
-      (make-local-variable 'gnus-auto-select-first)
-      (setq gnus-auto-select-first nil)
-      (make-local-variable 'gnus-summary-display-article-function)
-      (setq gnus-summary-display-article-function 'gnus-binary-display-article)
-      ;; Set up the menu.
-      (when (gnus-visual-p 'binary-menu 'menu)
-       (gnus-binary-make-menu-bar))
-      (add-minor-mode 'gnus-binary-mode " Binary" gnus-binary-mode-map)
-      (gnus-run-hooks 'gnus-binary-mode-hook))))
+  :lighter " Binary" :keymap gnus-binary-mode-map
+  (cond
+   ((not (derived-mode-p 'gnus-summary-mode)) (setq gnus-binary-mode nil))
+   (gnus-binary-mode
+    ;; Make sure that we don't select any articles upon group entry.
+    (make-local-variable 'gnus-auto-select-first)
+    (setq gnus-auto-select-first nil)
+    (make-local-variable 'gnus-summary-display-article-function)
+    (setq gnus-summary-display-article-function 'gnus-binary-display-article)
+    ;; Set up the menu.
+    (when (gnus-visual-p 'binary-menu 'menu)
+      (gnus-binary-make-menu-bar)))))
 
 (defun gnus-binary-display-article (article &optional all-header)
   "Run ARTICLE through the binary decode functions."
index 26c01229e332545712d261c5d911a632daa57f99..8cfd3d5ad0142976ee0947cfd82b4219eba36819 100644 (file)
@@ -2055,8 +2055,11 @@ score in `gnus-newsgroup-scored' by SCORE."
 
          ;; Evil hackery to make match usable in non-standard headers.
          (when extra
-           (setq match (concat "[ (](" extra " \\. \"[^)]*"
-                               match "[^\"]*\")[ )]")
+           (setq match (concat "[ (](" extra " \\. \"\\([^\"]*\\\\\"\\)*[^\"]*"
+                               (if (eq search-func 're-search-forward)
+                                   match
+                                 (regexp-quote match))
+                               "\\([^\"]*\\\\\"\\)*[^\"]*\")[ )]")
                  search-func 're-search-forward)) ; XXX danger?!?
 
          (cond
diff --git a/lisp/gnus/gnus-soup.el b/lisp/gnus/gnus-soup.el
deleted file mode 100644 (file)
index 13271a9..0000000
+++ /dev/null
@@ -1,611 +0,0 @@
-;;; gnus-soup.el --- SOUP packet writing support for Gnus
-
-;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
-
-;; Author: Per Abrahamsen <abraham@iesd.auc.dk>
-;;     Lars Magne Ingebrigtsen <larsi@gnus.org>
-;; Keywords: news, mail
-
-;; 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:
-
-(eval-when-compile (require 'cl))
-
-(require 'gnus)
-(require 'gnus-art)
-(require 'message)
-(require 'gnus-start)
-(require 'gnus-range)
-
-(defgroup gnus-soup nil
-  "SOUP packet writing support for Gnus."
-  :group 'gnus)
-
-;;; User Variables:
-
-(defcustom gnus-soup-directory (nnheader-concat gnus-home-directory "SoupBrew/")
-  "Directory containing an unpacked SOUP packet."
-  :version "22.1" ;; Gnus 5.10.9
-  :type 'directory
-  :group 'gnus-soup)
-
-(defcustom gnus-soup-replies-directory
-  (nnheader-concat gnus-soup-directory "SoupReplies/")
-  "Directory where Gnus will do processing of replies."
-  :version "22.1" ;; Gnus 5.10.9
-  :type 'directory
-  :group 'gnus-soup)
-
-(defcustom gnus-soup-prefix-file "gnus-prefix"
-  "Name of the file where Gnus stores the last used prefix."
-  :version "22.1" ;; Gnus 5.10.9
-  :type 'file
-  :group 'gnus-soup)
-
-(defcustom gnus-soup-packer "tar cf - %s | gzip > $HOME/Soupout%d.tgz"
-  "Format string command for packing a SOUP packet.
-The SOUP files will be inserted where the %s is in the string.
-This string MUST contain both %s and %d.  The file number will be
-inserted where %d appears."
-  :version "22.1" ;; Gnus 5.10.9
-  :type 'string
-  :group 'gnus-soup)
-
-(defcustom gnus-soup-unpacker "gunzip -c %s | tar xvf -"
-  "Format string command for unpacking a SOUP packet.
-The SOUP packet file name will be inserted at the %s."
-  :version "22.1" ;; Gnus 5.10.9
-  :type 'string
-  :group 'gnus-soup)
-
-(defcustom gnus-soup-packet-directory gnus-home-directory
-  "Where gnus-soup will look for REPLIES packets."
-  :version "22.1" ;; Gnus 5.10.9
-  :type 'directory
-  :group 'gnus-soup)
-
-(defcustom gnus-soup-packet-regexp "Soupin"
-  "Regular expression matching SOUP REPLIES packets in `gnus-soup-packet-directory'."
-  :version "22.1" ;; Gnus 5.10.9
-  :type 'regexp
-  :group 'gnus-soup)
-
-(defcustom gnus-soup-ignored-headers "^Xref:"
-  "Regexp to match headers to be removed when brewing SOUP packets."
-  :version "22.1" ;; Gnus 5.10.9
-  :type 'regexp
-  :group 'gnus-soup)
-
-;;; Internal Variables:
-
-(defvar gnus-soup-encoding-type ?u
-  "*Soup encoding type.
-`u' is USENET news format, `m' is Unix mbox format, and `M' is MMDF mailbox
-format.")
-
-(defvar gnus-soup-index-type ?c
-  "*Soup index type.
-`n' means no index file and `c' means standard Cnews overview
-format.")
-
-(defvar gnus-soup-areas nil)
-(defvar gnus-soup-last-prefix nil)
-(defvar gnus-soup-prev-prefix nil)
-(defvar gnus-soup-buffers nil)
-
-;;; Access macros:
-
-(defmacro gnus-soup-area-prefix (area)
-  `(aref ,area 0))
-(defmacro gnus-soup-set-area-prefix (area prefix)
-  `(aset ,area 0 ,prefix))
-(defmacro gnus-soup-area-name (area)
-  `(aref ,area 1))
-(defmacro gnus-soup-area-encoding (area)
-  `(aref ,area 2))
-(defmacro gnus-soup-area-description (area)
-  `(aref ,area 3))
-(defmacro gnus-soup-area-number (area)
-  `(aref ,area 4))
-(defmacro gnus-soup-area-set-number (area value)
-  `(aset ,area 4 ,value))
-
-(defmacro gnus-soup-encoding-format (encoding)
-  `(aref ,encoding 0))
-(defmacro gnus-soup-encoding-index (encoding)
-  `(aref ,encoding 1))
-(defmacro gnus-soup-encoding-kind (encoding)
-  `(aref ,encoding 2))
-
-(defmacro gnus-soup-reply-prefix (reply)
-  `(aref ,reply 0))
-(defmacro gnus-soup-reply-kind (reply)
-  `(aref ,reply 1))
-(defmacro gnus-soup-reply-encoding (reply)
-  `(aref ,reply 2))
-
-;;; Commands:
-
-(defun gnus-soup-send-replies ()
-  "Unpack and send all replies in the reply packet."
-  (interactive)
-  (let ((packets (directory-files
-                 gnus-soup-packet-directory t gnus-soup-packet-regexp)))
-    (while packets
-      (when (gnus-soup-send-packet (car packets))
-       (delete-file (car packets)))
-      (setq packets (cdr packets)))))
-
-(defun gnus-soup-add-article (n)
-  "Add the current article to SOUP packet.
-If N is a positive number, add the N next articles.
-If N is a negative number, add the N previous articles.
-If N is nil and any articles have been marked with the process mark,
-move those articles instead."
-  (interactive "P")
-  (let* ((articles (gnus-summary-work-articles n))
-        (tmp-buf (gnus-get-buffer-create "*soup work*"))
-        (area (gnus-soup-area gnus-newsgroup-name))
-        (prefix (gnus-soup-area-prefix area))
-        headers)
-    (buffer-disable-undo tmp-buf)
-    (save-excursion
-      (while articles
-       ;; Put the article in a buffer.
-       (set-buffer tmp-buf)
-       (when (gnus-request-article-this-buffer
-              (car articles) gnus-newsgroup-name)
-         (setq headers (nnheader-parse-head t))
-         (save-restriction
-           (message-narrow-to-head)
-           (message-remove-header gnus-soup-ignored-headers t))
-         (gnus-soup-store gnus-soup-directory prefix headers
-                          gnus-soup-encoding-type
-                          gnus-soup-index-type)
-         (gnus-soup-area-set-number
-          area (1+ (or (gnus-soup-area-number area) 0)))
-         ;; Mark article as read.
-         (set-buffer gnus-summary-buffer)
-         (gnus-summary-mark-as-read (car articles) gnus-souped-mark))
-       (gnus-summary-remove-process-mark (car articles))
-       (setq articles (cdr articles)))
-      (kill-buffer tmp-buf))
-    (gnus-soup-save-areas)
-    (gnus-set-mode-line 'summary)))
-
-(defun gnus-soup-pack-packet ()
-  "Make a SOUP packet from the SOUP areas."
-  (interactive)
-  (gnus-soup-read-areas)
-  (if (file-exists-p gnus-soup-directory)
-      (if (directory-files gnus-soup-directory nil "\\.MSG$")
-         (gnus-soup-pack gnus-soup-directory gnus-soup-packer)
-       (message "No files to pack."))
-    (message "No such directory: %s" gnus-soup-directory)))
-
-(defun gnus-group-brew-soup (n)
-  "Make a soup packet from the current group.
-Uses the process/prefix convention."
-  (interactive "P")
-  (let ((groups (gnus-group-process-prefix n)))
-    (while groups
-      (gnus-group-remove-mark (car groups))
-      (gnus-soup-group-brew (car groups) t)
-      (setq groups (cdr groups)))
-    (gnus-soup-save-areas)))
-
-(defun gnus-brew-soup (&optional level)
-  "Go through all groups on LEVEL or less and make a soup packet."
-  (interactive "P")
-  (let ((level (or level gnus-level-subscribed))
-       (newsrc (cdr gnus-newsrc-alist)))
-    (while newsrc
-      (when (<= (nth 1 (car newsrc)) level)
-       (gnus-soup-group-brew (caar newsrc) t))
-      (setq newsrc (cdr newsrc)))
-    (gnus-soup-save-areas)))
-
-;;;###autoload
-(defun gnus-batch-brew-soup ()
-  "Brew a SOUP packet from groups mention on the command line.
-Will use the remaining command line arguments as regular expressions
-for matching on group names.
-
-For instance, if you want to brew on all the nnml groups, as well as
-groups with \"emacs\" in the name, you could say something like:
-
-$ emacs -batch -f gnus-batch-brew-soup ^nnml \".*emacs.*\"
-
-Note -- this function hasn't been implemented yet."
-  (interactive)
-  nil)
-
-;;; Internal Functions:
-
-;; Store the current buffer.
-(defun gnus-soup-store (directory prefix headers format index)
-  ;; Create the directory, if needed.
-  (gnus-make-directory directory)
-  (let* ((msg-buf (nnheader-find-file-noselect
-                  (concat directory prefix ".MSG")))
-        (idx-buf (if (= index ?n)
-                     nil
-                   (nnheader-find-file-noselect
-                    (concat directory prefix ".IDX"))))
-        (article-buf (current-buffer))
-        from head-line beg type)
-    (setq gnus-soup-buffers (cons msg-buf (delq msg-buf gnus-soup-buffers)))
-    (buffer-disable-undo msg-buf)
-    (when idx-buf
-      (push idx-buf gnus-soup-buffers)
-      (buffer-disable-undo idx-buf))
-    (save-excursion
-      ;; Make sure the last char in the buffer is a newline.
-      (goto-char (point-max))
-      (unless (= (current-column) 0)
-       (insert "\n"))
-      ;; Find the "from".
-      (goto-char (point-min))
-      (setq from
-           (gnus-mail-strip-quoted-names
-            (or (mail-fetch-field "from")
-                (mail-fetch-field "really-from")
-                (mail-fetch-field "sender"))))
-      (goto-char (point-min))
-      ;; Depending on what encoding is supposed to be used, we make
-      ;; a soup header.
-      (setq head-line
-           (cond
-            ((or (= gnus-soup-encoding-type ?u)
-                 (= gnus-soup-encoding-type ?n)) ;;Gnus back compatibility.
-             (format "#! rnews %d\n" (buffer-size)))
-            ((= gnus-soup-encoding-type ?m)
-             (while (search-forward "\nFrom " nil t)
-               (replace-match "\n>From " t t))
-             (concat "From " (or from "unknown")
-                     " " (current-time-string) "\n"))
-            ((= gnus-soup-encoding-type ?M)
-             "\^a\^a\^a\^a\n")
-            (t (error "Unsupported type: %c" gnus-soup-encoding-type))))
-      ;; Insert the soup header and the article in the MSG buf.
-      (set-buffer msg-buf)
-      (goto-char (point-max))
-      (insert head-line)
-      (setq beg (point))
-      (insert-buffer-substring article-buf)
-      ;; Insert the index in the IDX buf.
-      (cond ((= index ?c)
-            (set-buffer idx-buf)
-            (gnus-soup-insert-idx beg headers))
-           ((/= index ?n)
-            (error "Unknown index type: %c" type)))
-      ;; Return the MSG buf.
-      msg-buf)))
-
-(defun gnus-soup-group-brew (group &optional not-all)
-  "Enter GROUP and add all articles to a SOUP package.
-If NOT-ALL, don't pack ticked articles."
-  (let ((gnus-expert-user t)
-       (gnus-large-newsgroup nil)
-       (entry (gnus-group-entry group)))
-    (when (or (null entry)
-             (eq (car entry) t)
-             (and (car entry)
-                  (> (car entry) 0))
-             (and (not not-all)
-                  (gnus-range-length (cdr (assq 'tick (gnus-info-marks
-                                                       (nth 2 entry)))))))
-      (when (gnus-summary-read-group group nil t)
-       (setq gnus-newsgroup-processable
-             (reverse
-              (if (not not-all)
-                  (append gnus-newsgroup-marked gnus-newsgroup-unreads)
-                gnus-newsgroup-unreads)))
-       (gnus-soup-add-article nil)
-       (gnus-summary-exit)))))
-
-(defun gnus-soup-insert-idx (offset header)
-  ;; [number subject from date id references chars lines xref]
-  (goto-char (point-max))
-  (insert
-   (format "%d\t%s\t%s\t%s\t%s\t%s\t%d\t%s\t\t\n"
-          offset
-          (or (mail-header-subject header) "(none)")
-          (or (mail-header-from header) "(nobody)")
-          (or (mail-header-date header) "")
-          (or (mail-header-id header)
-              (concat "soup-dummy-id-"
-                      (mapconcat
-                       (lambda (time) (int-to-string time))
-                       (current-time) "-")))
-          (or (mail-header-references header) "")
-          (or (mail-header-chars header) 0)
-          (or (mail-header-lines header) "0"))))
-
-(defun gnus-soup-save-areas ()
-  "Write all SOUP buffers."
-  (interactive)
-  (gnus-soup-write-areas)
-  (save-excursion
-    (let (buf)
-      (while gnus-soup-buffers
-       (setq buf (car gnus-soup-buffers)
-             gnus-soup-buffers (cdr gnus-soup-buffers))
-       (if (not (buffer-name buf))
-           ()
-         (set-buffer buf)
-         (when (buffer-modified-p)
-           (save-buffer))
-         (kill-buffer (current-buffer)))))
-    (gnus-soup-write-prefixes)))
-
-(defun gnus-soup-write-prefixes ()
-  (let ((prefixes gnus-soup-last-prefix)
-       prefix)
-    (save-excursion
-      (gnus-set-work-buffer)
-      (while (setq prefix (pop prefixes))
-       (erase-buffer)
-       (insert (format "(setq gnus-soup-prev-prefix %d)\n" (cdr prefix)))
-       (let ((coding-system-for-write mm-text-coding-system))
-         (gnus-write-buffer (concat (car prefix) gnus-soup-prefix-file)))))))
-
-(defun gnus-soup-pack (dir packer)
-  (let* ((files (mapconcat 'identity
-                          '("AREAS" "*.MSG" "*.IDX" "INFO"
-                            "LIST" "REPLIES" "COMMANDS" "ERRORS")
-                          " "))
-        (packer (if (< (string-match "%s" packer)
-                       (string-match "%d" packer))
-                    (format packer files
-                            (string-to-number (gnus-soup-unique-prefix dir)))
-                  (format packer
-                          (string-to-number (gnus-soup-unique-prefix dir))
-                          files)))
-        (dir (expand-file-name dir)))
-    (gnus-make-directory dir)
-    (setq gnus-soup-areas nil)
-    (gnus-message 4 "Packing %s..." packer)
-    (if (eq 0 (call-process shell-file-name
-                           nil nil nil shell-command-switch
-                           (concat "cd " dir " ; " packer)))
-       (progn
-         (call-process shell-file-name nil nil nil shell-command-switch
-                       (concat "cd " dir " ; rm " files))
-         (gnus-message 4 "Packing...done" packer))
-      (error "Couldn't pack packet"))))
-
-(defun gnus-soup-parse-areas (file)
-  "Parse soup area file FILE.
-The result is a of vectors, each containing one entry from the AREA file.
-The vector contain five strings,
-  [prefix name encoding description number]
-though the two last may be nil if they are missing."
-  (let (areas)
-    (when (file-exists-p file)
-      (save-excursion
-       (set-buffer (nnheader-find-file-noselect file 'force))
-       (buffer-disable-undo)
-       (goto-char (point-min))
-       (while (not (eobp))
-         (push (vector (gnus-soup-field)
-                       (gnus-soup-field)
-                       (gnus-soup-field)
-                       (and (eq (preceding-char) ?\t)
-                            (gnus-soup-field))
-                       (and (eq (preceding-char) ?\t)
-                            (string-to-number (gnus-soup-field))))
-               areas)
-         (when (eq (preceding-char) ?\t)
-           (beginning-of-line 2)))
-       (kill-buffer (current-buffer))))
-    areas))
-
-(defun gnus-soup-parse-replies (file)
-  "Parse soup REPLIES file FILE.
-The result is a of vectors, each containing one entry from the REPLIES
-file.  The vector contain three strings, [prefix name encoding]."
-  (let (replies)
-    (save-excursion
-      (set-buffer (nnheader-find-file-noselect file))
-      (buffer-disable-undo)
-      (goto-char (point-min))
-      (while (not (eobp))
-       (push (vector (gnus-soup-field) (gnus-soup-field)
-                     (gnus-soup-field))
-             replies)
-       (when (eq (preceding-char) ?\t)
-         (beginning-of-line 2)))
-      (kill-buffer (current-buffer)))
-    replies))
-
-(defun gnus-soup-field ()
-  (prog1
-      (buffer-substring (point) (progn (skip-chars-forward "^\t\n") (point)))
-    (forward-char 1)))
-
-(defun gnus-soup-read-areas ()
-  (or gnus-soup-areas
-      (setq gnus-soup-areas
-           (gnus-soup-parse-areas (concat gnus-soup-directory "AREAS")))))
-
-(defun gnus-soup-write-areas ()
-  "Write the AREAS file."
-  (interactive)
-  (when gnus-soup-areas
-    (with-temp-file (concat gnus-soup-directory "AREAS")
-      (let ((areas gnus-soup-areas)
-           area)
-       (while (setq area (pop areas))
-         (insert
-          (format
-           "%s\t%s\t%s%s\n"
-           (gnus-soup-area-prefix area)
-           (gnus-soup-area-name area)
-           (gnus-soup-area-encoding area)
-           (if (or (gnus-soup-area-description area)
-                   (gnus-soup-area-number area))
-               (concat "\t" (or (gnus-soup-area-description
-                                 area) "")
-                       (if (gnus-soup-area-number area)
-                           (concat "\t" (int-to-string
-                                         (gnus-soup-area-number area)))
-                         "")) ""))))))))
-
-(defun gnus-soup-write-replies (dir areas)
-  "Write a REPLIES file in DIR containing AREAS."
-  (with-temp-file (concat dir "REPLIES")
-    (let (area)
-      (while (setq area (pop areas))
-       (insert (format "%s\t%s\t%s\n"
-                       (gnus-soup-reply-prefix area)
-                       (gnus-soup-reply-kind area)
-                       (gnus-soup-reply-encoding area)))))))
-
-(defun gnus-soup-area (group)
-  (gnus-soup-read-areas)
-  (let ((areas gnus-soup-areas)
-       (real-group (gnus-group-real-name group))
-       area result)
-    (while areas
-      (setq area (car areas)
-           areas (cdr areas))
-      (when (equal (gnus-soup-area-name area) real-group)
-       (setq result area)))
-    (unless result
-      (setq result
-           (vector (gnus-soup-unique-prefix)
-                   real-group
-                   (format "%c%c%c"
-                           gnus-soup-encoding-type
-                           gnus-soup-index-type
-                           (if (gnus-member-of-valid 'mail group) ?m ?n))
-                   nil nil)
-           gnus-soup-areas (cons result gnus-soup-areas)))
-    result))
-
-(defun gnus-soup-unique-prefix (&optional dir)
-  (let* ((dir (file-name-as-directory (or dir gnus-soup-directory)))
-        (entry (assoc dir gnus-soup-last-prefix))
-        gnus-soup-prev-prefix)
-    (if entry
-       ()
-      (when (file-exists-p (concat dir gnus-soup-prefix-file))
-       (ignore-errors
-         (load (concat dir gnus-soup-prefix-file) nil t t)))
-      (push (setq entry (cons dir (or gnus-soup-prev-prefix 0)))
-           gnus-soup-last-prefix))
-    (setcdr entry (1+ (cdr entry)))
-    (gnus-soup-write-prefixes)
-    (int-to-string (cdr entry))))
-
-(defun gnus-soup-unpack-packet (dir unpacker packet)
-  "Unpack PACKET into DIR using UNPACKER.
-Return whether the unpacking was successful."
-  (gnus-make-directory dir)
-  (gnus-message 4 "Unpacking: %s" (format unpacker packet))
-  (prog1
-      (eq 0 (call-process
-            shell-file-name nil nil nil shell-command-switch
-            (format "cd %s ; %s" (expand-file-name dir)
-                    (format unpacker packet))))
-    (gnus-message 4 "Unpacking...done")))
-
-(defun gnus-soup-send-packet (packet)
-  (gnus-soup-unpack-packet
-   gnus-soup-replies-directory gnus-soup-unpacker packet)
-  (let ((replies (gnus-soup-parse-replies
-                 (concat gnus-soup-replies-directory "REPLIES"))))
-    (save-excursion
-      (while replies
-       (let* ((msg-file (concat gnus-soup-replies-directory
-                                (gnus-soup-reply-prefix (car replies))
-                                ".MSG"))
-              (msg-buf (and (file-exists-p msg-file)
-                            (nnheader-find-file-noselect msg-file)))
-              (tmp-buf (gnus-get-buffer-create " *soup send*"))
-              beg end)
-         (cond
-          ((and (/= (gnus-soup-encoding-format
-                     (gnus-soup-reply-encoding (car replies)))
-                    ?u)
-                (/= (gnus-soup-encoding-format
-                     (gnus-soup-reply-encoding (car replies)))
-                    ?n)) ;; Gnus back compatibility.
-           (error "Unsupported encoding"))
-          ((null msg-buf)
-           t)
-          (t
-           (buffer-disable-undo msg-buf)
-           (set-buffer msg-buf)
-           (goto-char (point-min))
-           (while (not (eobp))
-             (unless (looking-at "#! *rnews +\\([0-9]+\\)")
-               (error "Bad header"))
-             (forward-line 1)
-             (setq beg (point)
-                   end (+ (point) (string-to-number
-                                   (buffer-substring
-                                    (match-beginning 1) (match-end 1)))))
-             (switch-to-buffer tmp-buf)
-             (erase-buffer)
-             (mm-disable-multibyte)
-             (insert-buffer-substring msg-buf beg end)
-             (cond
-              ((string= (gnus-soup-reply-kind (car replies)) "news")
-               (gnus-message 5 "Sending news message to %s..."
-                             (mail-fetch-field "newsgroups"))
-               (sit-for 1)
-               (let ((message-syntax-checks
-                      'dont-check-for-anything-just-trust-me)
-                     (method (if (functionp message-post-method)
-                                 (funcall message-post-method)
-                               message-post-method))
-                     result)
-                 (run-hooks 'message-send-news-hook)
-                 (gnus-open-server method)
-                 (message "Sending news via %s..."
-                          (gnus-server-string method))
-                 (unless (let ((mail-header-separator ""))
-                           (gnus-request-post method))
-                   (message "Couldn't send message via news: %s"
-                            (nnheader-get-report (car method))))))
-              ((string= (gnus-soup-reply-kind (car replies)) "mail")
-               (gnus-message 5 "Sending mail to %s..."
-                             (mail-fetch-field "to"))
-               (sit-for 1)
-               (let ((mail-header-separator ""))
-                  (funcall (or message-send-mail-real-function
-                               message-send-mail-function))))
-              (t
-               (error "Unknown reply kind")))
-             (set-buffer msg-buf)
-             (goto-char end))
-           (delete-file (buffer-file-name))
-           (kill-buffer msg-buf)
-           (kill-buffer tmp-buf)
-           (gnus-message 4 "Sent packet"))))
-       (setq replies (cdr replies)))
-      t)))
-
-(provide 'gnus-soup)
-
-;; arch-tag: eddfa69d-13e8-4aea-84ef-62a526ef185c
-;;; gnus-soup.el ends here
index bf08ba6f88890ff735deed95da3fade5cd6a344a..f3d8ce010463b3fdb286ca749ad56bf135d39ac7 100644 (file)
@@ -181,7 +181,7 @@ Groups with levels less than `gnus-level-subscribed', which
 should be less than this variable, are subscribed.  Groups with
 levels from `gnus-level-subscribed' (exclusive) upto this
 variable (inclusive) are unsubscribed.  See also
-`gnus-level-zombie', `gnus-level-killed' and the Info node `Group
+`gnus-level-zombie', `gnus-level-killed' and the Info node `(gnus)Group
 Levels' for details.")
 
 (defconst gnus-level-zombie 8
@@ -814,6 +814,7 @@ prompt the user for the name of an NNTP server to use."
 
 (defun gnus-start-draft-setup ()
   "Make sure the draft group exists."
+  (interactive)
   (gnus-request-create-group "drafts" '(nndraft ""))
   (unless (gnus-group-entry "nndraft:drafts")
     (let ((gnus-level-default-subscribed 1))
@@ -868,6 +869,8 @@ prompt the user for the name of an NNTP server to use."
 (defun gnus-dribble-read-file ()
   "Read the dribble file from disk."
   (let ((dribble-file (gnus-dribble-file-name)))
+    (unless (file-exists-p (file-name-directory dribble-file))
+      (make-directory (file-name-directory dribble-file) t))
     (save-excursion
       (set-buffer (setq gnus-dribble-buffer
                        (gnus-get-buffer-create
@@ -2960,6 +2963,8 @@ If FORCE is non-nil, the .newsrc file is read."
 
 (defun gnus-slave-mode ()
   "Minor mode for slave Gnusae."
+  ;; FIXME: gnus-slave-mode appears to never be set (i.e. it'll always be nil):
+  ;; Remove, or fix and use define-minor-mode.
   (add-minor-mode 'gnus-slave-mode " Slave" (make-sparse-keymap))
   (gnus-run-hooks 'gnus-slave-mode-hook))
 
@@ -3058,6 +3063,7 @@ If FORCE is non-nil, the .newsrc file is read."
       nil)
      (t
       (save-excursion
+        ;; FIXME: Shouldn't save-restriction be done after set-buffer?
        (save-restriction
          (set-buffer nntp-server-buffer)
          (goto-char (point-min))
index 2464b132839d5cf4394a951c9a1954c19b04beb4..cd0824f98910ce2f891f28016abb239191d19b07 100644 (file)
@@ -30,6 +30,9 @@
   (unless (fboundp 'declare-function) (defmacro declare-function (&rest r))))
 (eval-when-compile
   (require 'cl))
+(eval-when-compile
+  (when (featurep 'xemacs)
+    (require 'easy-mmode))) ; for `define-minor-mode'
 
 (defvar tool-bar-mode)
 (defvar gnus-tmp-header)
@@ -73,6 +76,13 @@ See `gnus-group-goto-unread'."
   :version "23.1" ;; No Gnus
   :type 'boolean)
 
+(defcustom gnus-summary-stop-at-end-of-message nil
+  "If non-nil, don't select the next message when using `SPC'."
+  :link '(custom-manual "(gnus)Group Maneuvering")
+  :group 'gnus-summary-maneuvering
+  :version "24.1"
+  :type 'boolean)
+
 (defcustom gnus-fetch-old-headers nil
   "*Non-nil means that Gnus will try to build threads by grabbing old headers.
 If an unread article in the group refers to an older, already
@@ -528,11 +538,6 @@ string with the suggested prefix."
   :group 'gnus-summary-marks
   :type 'character)
 
-(defcustom gnus-souped-mark ?F
-  "*Mark used for souped articles."
-  :group 'gnus-summary-marks
-  :type 'character)
-
 (defcustom gnus-kill-file-mark ?X
   "*Mark used for articles killed by kill files."
   :group 'gnus-summary-marks
@@ -656,7 +661,7 @@ string with the suggested prefix."
 (defcustom gnus-auto-expirable-marks
   (list gnus-killed-mark gnus-del-mark gnus-catchup-mark
        gnus-low-score-mark gnus-ancient-mark gnus-read-mark
-       gnus-souped-mark gnus-duplicate-mark)
+       gnus-duplicate-mark)
   "*The list of marks converted into expiration if a group is auto-expirable."
   :version "21.1"
   :group 'gnus-summary
@@ -1248,7 +1253,7 @@ type of files to save."
   "Whether Gnus should parse all headers made available to it.
 This is mostly relevant for slow back ends where the user may
 wish to widen the summary buffer to include all headers
-that were fetched.  Say, for nnultimate groups."
+that were fetched."
   :version "22.1"
   :group 'gnus-summary
   :type '(choice boolean regexp))
@@ -1850,7 +1855,6 @@ increase the score of each group you read."
   "=" gnus-summary-expand-window
   "\C-x\C-s" gnus-summary-reselect-current-group
   "\M-g" gnus-summary-rescan-group
-  "w" gnus-summary-stop-page-breaking
   "\C-c\C-r" gnus-summary-caesar-message
   "f" gnus-summary-followup
   "F" gnus-summary-followup-with-original
@@ -1872,7 +1876,6 @@ increase the score of each group you read."
   [follow-link] mouse-face
   "m" gnus-summary-mail-other-window
   "a" gnus-summary-post-news
-  "i" gnus-summary-news-other-window
   "x" gnus-summary-limit-to-unread
   "s" gnus-summary-isearch-article
   "t" gnus-summary-toggle-header
@@ -2172,8 +2175,7 @@ increase the score of each group you read."
   "h" gnus-summary-save-article-folder
   "v" gnus-summary-save-article-vm
   "p" gnus-summary-pipe-output
-  "P" gnus-summary-muttprint
-  "s" gnus-soup-add-article)
+  "P" gnus-summary-muttprint)
 
 (gnus-define-keys (gnus-summary-mime-map "K" gnus-summary-mode-map)
   "b" gnus-summary-display-buttonized
@@ -2437,7 +2439,6 @@ gnus-summary-show-article-from-menu-as-charset-%s" cs))))
              ["Save in RMAIL mbox..." gnus-summary-save-article-rmail t]
              ["Save body in file..." gnus-summary-save-article-body-file t]
              ["Pipe through a filter..." gnus-summary-pipe-output t]
-             ["Add to SOUP packet" gnus-soup-add-article t]
              ["Print with Muttprint..." gnus-summary-muttprint t]
              ["Print" gnus-summary-print-article
               ,@(if (featurep 'xemacs) '(t)
@@ -2635,17 +2636,6 @@ gnus-summary-show-article-from-menu-as-charset-%s" cs))))
         ["Set expirable mark" gnus-summary-mark-as-expirable t]
         ["Set bookmark" gnus-summary-set-bookmark t]
         ["Remove bookmark" gnus-summary-remove-bookmark t])
-       ("Registry Mark"
-        ["Important"     gnus-registry-set-article-Important-mark    t]
-        ["Not Important" gnus-registry-remove-article-Important-mark t]
-        ["Work"          gnus-registry-set-article-Work-mark         t]
-        ["Not Work"      gnus-registry-remove-article-Work-mark      t]
-        ["Later"         gnus-registry-set-article-Later-mark        t]
-        ["Not Later"     gnus-registry-remove-article-Later-mark     t]
-        ["Personal"      gnus-registry-set-article-Personal-mark     t]
-        ["Not Personal"  gnus-registry-remove-article-Personal-mark  t]
-        ["To Do"         gnus-registry-set-article-To-Do-mark        t]
-        ["Not To Do"     gnus-registry-remove-article-To-Do-mark     t])
        ("Limit to"
         ["Marks..." gnus-summary-limit-to-marks t]
         ["Subject..." gnus-summary-limit-to-subject t]
@@ -2691,6 +2681,7 @@ gnus-summary-show-article-from-menu-as-charset-%s" cs))))
           gnus-newsgroup-process-stack]
          ["Save" gnus-summary-save-process-mark t]
          ["Run command on marked..." gnus-summary-universal-argument t]))
+       ("Registry Marks")
        ("Scroll article"
         ["Page forward" gnus-summary-next-page
          ,@(if (featurep 'xemacs) '(t)
@@ -3027,7 +3018,7 @@ When FORCE, rebuild the tool bar."
 
 
 (declare-function turn-on-gnus-mailing-list-mode "gnus-ml" ())
-
+(defvar bookmark-make-record-function)
 \f
 
 (defun gnus-summary-mode (&optional group)
@@ -3063,7 +3054,6 @@ The following commands are available:
   (gnus-simplify-mode-line)
   (setq major-mode 'gnus-summary-mode)
   (setq mode-name "Summary")
-  (make-local-variable 'minor-mode-alist)
   (use-local-map gnus-summary-mode-map)
   (buffer-disable-undo)
   (setq buffer-read-only t             ;Disable modification
@@ -3082,6 +3072,8 @@ The following commands are available:
   (gnus-run-mode-hooks 'gnus-summary-mode-hook)
   (turn-on-gnus-mailing-list-mode)
   (mm-enable-multibyte)
+  (set (make-local-variable 'bookmark-make-record-function)
+       'gnus-summary-bookmark-make-record)
   (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
   (gnus-update-summary-mark-positions))
 
@@ -3412,8 +3404,10 @@ marks of articles."
   (save-excursion
     (let (config)
       (goto-char (point-min))
-      (while (search-forward "\r" nil t)
-       (push (1- (point)) config))
+      (while (not (eobp))
+        (when (eq (get-char-property (point-at-eol) 'invisible) 'gnus-sum)
+          (push (save-excursion (forward-line 0) (point)) config))
+        (forward-line 1))
       config)))
 
 (defun gnus-restore-hidden-threads-configuration (config)
@@ -3421,10 +3415,8 @@ marks of articles."
   (save-excursion
     (let (point (inhibit-read-only t))
       (while (setq point (pop config))
-       (when (and (< point (point-max))
-                  (goto-char point)
-                  (eq (char-after) ?\n))
-         (subst-char-in-region point (1+ point) ?\n ?\r))))))
+        (goto-char point)
+        (gnus-summary-hide-thread)))))
 
 ;; Various summary mode internalish functions.
 
@@ -3937,7 +3929,6 @@ If NO-DISPLAY, don't generate a summary buffer."
          (progn
            (set-buffer gnus-group-buffer)
            (gnus-group-jump-to-group group)
-           (gnus-group-next-unread-group 1)
            (gnus-configure-windows 'group 'force))
        (gnus-handle-ephemeral-exit quit-config))
       ;; Finally signal the quit.
@@ -4826,7 +4817,8 @@ If LINE, insert the rebuilt thread starting on line LINE."
          ;; Even after binding max-lisp-eval-depth, the recursive
          ;; sorter might fail for very long threads.  In that case,
          ;; try using a (less well-tested) non-recursive sorter.
-         (error (gnus-sort-threads-loop
+         (error (gnus-message 9 "Sorting threads with loop...")
+                (gnus-sort-threads-loop
                  threads (gnus-make-sort-function
                           gnus-thread-sort-functions))))
       (gnus-message 8 "Sorting threads...done"))))
@@ -4993,22 +4985,17 @@ Unscored articles will be counted as having a score of zero."
   "Sort threads such that the thread with the most recently dated article comes first."
   (> (gnus-thread-latest-date h1) (gnus-thread-latest-date h2)))
 
+; Since this is called not only to sort the top-level threads, but
+; also in recursive sorts to order the articles within a thread, each
+; article will be processed many times.  Thus it speeds things up
+; quite a bit to use gnus-date-get-time, which caches the time value.
 (defun gnus-thread-latest-date (thread)
   "Return the highest article date in THREAD."
-  (let ((previous-time 0))
-    (apply 'max
-          (mapcar
-           (lambda (header)
-             (setq previous-time
-                   (condition-case ()
-                       (gnus-float-time (mail-header-parse-date
-                                         (mail-header-date header)))
-                     (error previous-time))))
-           (sort
-            (message-flatten-list thread)
-            (lambda (h1 h2)
-              (< (mail-header-number h1)
-                 (mail-header-number h2))))))))
+  (apply 'max
+        (mapcar (lambda (header) (gnus-float-time
+                                  (gnus-date-get-time
+                                   (mail-header-date header))))
+                (message-flatten-list thread))))
 
 (defun gnus-thread-total-score-1 (root)
   ;; This function find the total score of the thread below ROOT.
@@ -6100,8 +6087,7 @@ The resulting hash table is returned, or nil if no Xrefs were found."
   "Look through all the headers and mark the Xrefs as read."
   (let ((virtual (gnus-virtual-group-p from-newsgroup))
        name info xref-hashtb idlist method nth4)
-    (save-excursion
-      (set-buffer gnus-group-buffer)
+    (with-current-buffer gnus-group-buffer
       (when (setq xref-hashtb
                  (gnus-create-xref-hashtb from-newsgroup headers unreads))
        (mapatoms
@@ -7246,33 +7232,21 @@ The state which existed when entering the ephemeral is reset."
 
 ;;; Dead summaries.
 
-(defvar gnus-dead-summary-mode-map nil)
-
-(unless gnus-dead-summary-mode-map
-  (setq gnus-dead-summary-mode-map (make-keymap))
-  (suppress-keymap gnus-dead-summary-mode-map)
-  (substitute-key-definition
-   'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
-  (dolist (key '("\C-d" "\r" "\177" [delete]))
-    (define-key gnus-dead-summary-mode-map
-      key 'gnus-summary-wake-up-the-dead))
-  (dolist (key '("q" "Q"))
-    (define-key gnus-dead-summary-mode-map key 'bury-buffer)))
-
-(defvar gnus-dead-summary-mode nil
-  "Minor mode for Gnus summary buffers.")
-
-(defun gnus-dead-summary-mode (&optional arg)
+(defvar gnus-dead-summary-mode-map
+  (let ((map (make-keymap)))
+    (suppress-keymap map)
+    (substitute-key-definition 'undefined 'gnus-summary-wake-up-the-dead map)
+    (dolist (key '("\C-d" "\r" "\177" [delete]))
+      (define-key map key 'gnus-summary-wake-up-the-dead))
+    (dolist (key '("q" "Q"))
+      (define-key map key 'bury-buffer))
+    map))
+
+(define-minor-mode gnus-dead-summary-mode
   "Minor mode for Gnus summary buffers."
-  (interactive "P")
-  (when (eq major-mode 'gnus-summary-mode)
-    (make-local-variable 'gnus-dead-summary-mode)
-    (setq gnus-dead-summary-mode
-         (if (null arg) (not gnus-dead-summary-mode)
-           (> (prefix-numeric-value arg) 0)))
-    (when gnus-dead-summary-mode
-      (add-minor-mode
-       'gnus-dead-summary-mode " Dead" gnus-dead-summary-mode-map))))
+  :lighter " Dead" :keymap gnus-dead-summary-mode-map
+  (unless (derived-mode-p 'gnus-summary-mode)
+    (setq gnus-dead-summary-mode nil)))
 
 (defun gnus-deaden-summary ()
   "Make the current summary buffer into a dead summary buffer."
@@ -7805,7 +7779,7 @@ Also see the variable `gnus-article-skip-boring'."
            (setq endp (or (gnus-article-next-page lines)
                           (gnus-article-only-boring-p))))
          (when endp
-           (cond (stop
+           (cond ((or stop gnus-summary-stop-at-end-of-message)
                   (gnus-message 3 "End of message"))
                  (circular
                   (gnus-summary-beginning-of-article))
@@ -8203,14 +8177,15 @@ in `nnmail-extra-headers'."
       (gnus-summary-position-point))))
 
 (defun gnus-summary-limit-strange-charsets-predicate (header)
-  (let ((string (concat (mail-header-subject header)
-                       (mail-header-from header)))
-       charset found)
-    (dotimes (i (1- (length string)))
-      (setq charset (format "%s" (char-charset (aref string (1+ i)))))
-      (when (string-match "unicode\\|big\\|japanese" charset)
-       (setq found t)))
-    found))
+  (when (fboundp 'char-charset)
+    (let ((string (concat (mail-header-subject header)
+                         (mail-header-from header)))
+         charset found)
+      (dotimes (i (1- (length string)))
+       (setq charset (format "%s" (char-charset (aref string (1+ i)))))
+       (when (string-match "unicode\\|big\\|japanese" charset)
+         (setq found t)))
+      found)))
 
 (defun gnus-summary-limit-to-predicate (predicate)
   "Limit to articles where PREDICATE returns non-nil.
@@ -8255,9 +8230,7 @@ articles that are younger than AGE days."
          (when (and (vectorp (gnus-data-header d))
                     (setq date (mail-header-date (gnus-data-header d))))
            (setq is-younger (time-less-p
-                             (time-since (condition-case ()
-                                             (date-to-time date)
-                                           (error '(0 0))))
+                             (time-since (gnus-date-get-time date))
                              cutoff))
            (when (if younger-p
                      is-younger
@@ -8325,7 +8298,7 @@ If ALL is non-nil, limit strictly to unread articles."
           gnus-killed-mark gnus-spam-mark gnus-kill-file-mark
           gnus-low-score-mark gnus-expirable-mark
           gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
-          gnus-duplicate-mark gnus-souped-mark)
+          gnus-duplicate-mark)
      'reverse)))
 
 (defun gnus-summary-limit-to-headers (match &optional reverse)
@@ -8351,8 +8324,7 @@ If REVERSE (the prefix), limit to articles that don't match."
     (dolist (data gnus-newsgroup-data)
       (let (gnus-mark-article-hook)
        (gnus-summary-select-article t t nil (gnus-data-number data)))
-      (save-excursion
-       (set-buffer gnus-article-buffer)
+      (with-current-buffer gnus-article-buffer
        (article-goto-body)
        (let* ((case-fold-search t)
               (found (if headersp
@@ -9036,7 +9008,7 @@ Obeys the standard process/prefix convention."
       (setq group (format "%s-%d" gnus-newsgroup-name article))
       (gnus-summary-remove-process-mark article)
       (when (gnus-summary-display-article article)
-       (save-excursion
+       (save-excursion ;;What for?
          (with-temp-buffer
            (insert-buffer-substring gnus-original-article-buffer)
            ;; Remove some headers that may lead nndoc to make
@@ -9544,7 +9516,7 @@ IDNA encoded domain names looks like `xn--bar'.  If a string
 remain unencoded after running this function, it is likely an
 invalid IDNA string (`xn--bar' is invalid).
 
-You must have GNU Libidn (`http://www.gnu.org/software/libidn/')
+You must have GNU Libidn (URL `http://www.gnu.org/software/libidn/')
 installed for this command to work."
   (interactive "P")
   (if (not (and (condition-case nil (require 'idna)
@@ -9874,12 +9846,14 @@ ACTION can be either `move' (the default), `crosspost' or `copy'."
        ;;;!!!Why is this necessary?
        (set-buffer gnus-summary-buffer)
 
-       (gnus-summary-goto-subject article)
        (when (eq action 'move)
-         (gnus-summary-mark-article article gnus-canceled-mark))))
+         (save-excursion
+           (gnus-summary-goto-subject article)
+           (gnus-summary-mark-article article gnus-canceled-mark)))))
       (push article articles-to-update-marks))
 
-    (apply 'gnus-summary-remove-process-mark articles-to-update-marks)
+    (save-excursion
+      (apply 'gnus-summary-remove-process-mark articles-to-update-marks))
     ;; Re-activate all groups that have been moved to.
     (with-current-buffer gnus-group-buffer
       (let ((gnus-group-marked to-groups))
@@ -10135,19 +10109,20 @@ confirmation before the articles are deleted."
       ;; Delete the articles.
       (setq not-deleted (gnus-request-expire-articles
                         articles gnus-newsgroup-name 'force))
-      (while articles
-       (gnus-summary-remove-process-mark (car articles))
-       ;; The backend might not have been able to delete the article
-       ;; after all.
-       (unless (memq (car articles) not-deleted)
-         (gnus-summary-mark-article (car articles) gnus-canceled-mark))
-       (let* ((article (car articles))
-              (ghead  (gnus-data-header
-                                   (assoc article (gnus-data-list nil)))))
-         (run-hook-with-args 'gnus-summary-article-delete-hook
-                             'delete ghead gnus-newsgroup-name nil
-                             nil))
-       (setq articles (cdr articles)))
+      (save-excursion
+       (while articles
+         (gnus-summary-remove-process-mark (car articles))
+         ;; The backend might not have been able to delete the article
+         ;; after all.
+         (unless (memq (car articles) not-deleted)
+           (gnus-summary-mark-article (car articles) gnus-canceled-mark))
+         (let* ((article (car articles))
+                (ghead  (gnus-data-header
+                         (assoc article (gnus-data-list nil)))))
+           (run-hook-with-args 'gnus-summary-article-delete-hook
+                               'delete ghead gnus-newsgroup-name nil
+                               nil))
+         (setq articles (cdr articles))))
       (when not-deleted
        (gnus-message 4 "Couldn't delete articles %s" not-deleted)))
     (gnus-summary-position-point)
@@ -11527,7 +11502,7 @@ If the prefix argument is negative, tick articles instead."
              ((> unmark 0)
               (gnus-summary-mark-article-as-unread gnus-unread-mark))
              ((= unmark 0)
-              (gnus-summary-mark-article-as-unread gnus-expirable-mark))
+              (gnus-summary-mark-article nil gnus-expirable-mark))
              (t
               (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
        (setq articles (cdr articles))))
@@ -11684,12 +11659,8 @@ will not be marked as saved."
            (gnus-message 1 "Article %d is unsaveable" article))
        ;; This is a real article.
        (save-window-excursion
-         (let ((gnus-display-mime-function (when decode
-                                             gnus-display-mime-function))
-               (gnus-article-prepare-hook (when decode
-                                            gnus-article-prepare-hook)))
-           (gnus-summary-select-article t t nil article)
-           (gnus-summary-goto-subject article)))
+         (gnus-summary-select-article decode decode nil article)
+         (gnus-summary-goto-subject article))
        (with-current-buffer save-buffer
          (erase-buffer)
          (insert-buffer-substring (if decode
@@ -12650,6 +12621,64 @@ If ALL is a number, fetch this number of articles."
          (gnus-summary-limit (gnus-sorted-nunion old new))))
     (gnus-summary-position-point)))
 
+;;; Bookmark support for Gnus.
+(declare-function bookmark-make-record-default
+                  "bookmark" (&optional no-file no-context posn))
+(declare-function bookmark-prop-get "bookmark" (bookmark prop))
+(declare-function bookmark-default-handler "bookmark" (bmk))
+(declare-function bookmark-get-bookmark-record "bookmark" (bmk))
+(defvar bookmark-yank-point)
+(defvar bookmark-current-buffer)
+
+(defun gnus-summary-bookmark-make-record ()
+  "Make a bookmark entry for a Gnus summary buffer."
+  (let (pos buf)
+    (unless (and (derived-mode-p 'gnus-summary-mode) gnus-article-current)
+      (save-restriction              ; FIXME is it necessary to widen?
+        (widen) (setq pos (point))) ; Set position in gnus-article buffer.
+      (setq buf "art") ; We are recording bookmark from article buffer.
+      (setq bookmark-yank-point (point))
+      (setq bookmark-current-buffer (current-buffer))
+      (gnus-article-show-summary))      ; Go back in summary buffer.
+    ;; We are now recording bookmark from summary buffer.
+    (unless buf (setq buf "sum"))
+    (let* ((subject (elt (gnus-summary-article-header) 1))
+           (grp     (car gnus-article-current))
+           (art     (cdr gnus-article-current))
+           (head    (gnus-summary-article-header art))
+           (id      (mail-header-id head)))
+      `(,subject
+       ,@(condition-case nil
+             (bookmark-make-record-default 'no-file 'no-context pos)
+           (wrong-number-of-arguments
+            (bookmark-make-record-default 'point-only)))
+        (location . ,(format "Gnus-%s %s:%d:%s" buf grp art id))
+        (group . ,grp) (article . ,art)
+        (message-id . ,id) (handler . gnus-summary-bookmark-jump)))))
+
+;;;###autoload
+(defun gnus-summary-bookmark-jump (bookmark)
+  "Handler function for record returned by `gnus-summary-bookmark-make-record'.
+BOOKMARK is a bookmark name or a bookmark record."
+  (let ((group    (bookmark-prop-get bookmark 'group))
+        (article  (bookmark-prop-get bookmark 'article))
+        (id       (bookmark-prop-get bookmark 'message-id))
+        (buf      (car (split-string (bookmark-prop-get bookmark 'location)))))
+    (gnus-fetch-group group (list article))
+    (gnus-summary-insert-cached-articles)
+    (gnus-summary-goto-article id nil 'force)
+    ;; FIXME we have to wait article buffer is ready (only large buffer)
+    ;; Is there a better solution to know that?
+    ;; If we don't wait `bookmark-default-handler' will have no chance
+    ;; to set position. However there is no error, just wrong pos.
+    (sit-for 1)
+    (when (string= buf "Gnus-art")
+      (other-window 1))
+    (bookmark-default-handler
+     `(""
+       (buffer . ,(current-buffer))
+       . ,(bookmark-get-bookmark-record bookmark)))))
+
 (gnus-summary-make-all-marking-commands)
 
 (gnus-ems-redefine)
diff --git a/lisp/gnus/gnus-sync.el b/lisp/gnus/gnus-sync.el
new file mode 100644 (file)
index 0000000..c0e52b6
--- /dev/null
@@ -0,0 +1,233 @@
+;;; gnus-sync.el --- synchronization facility for Gnus
+
+;; Copyright (C) 2010  Free Software Foundation, Inc.
+
+;; Author: Ted Zlatanov <tzz@lifelogs.com>
+;; Keywords: news synchronization nntp nnrss
+
+;; 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:
+
+;; This is the gnus-sync.el package.
+
+;; 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))
+
+;; TODO:
+
+;; - after gnus-sync-read, the message counts are wrong
+
+;;; Code:
+
+(eval-when-compile (require 'cl))
+(require 'gnus)
+(require 'gnus-start)
+(require 'gnus-util)
+
+(defgroup gnus-sync nil
+  "The Gnus synchronization facility."
+  :version "24.1"
+  :group 'gnus)
+
+(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
+default because there is no active sync backend by default, so
+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'."
+  :group 'gnus-sync
+  :type '(repeat (choice (variable :tag "A known variable")
+                         (symbol :tag "Any symbol"))))
+
+(defcustom gnus-sync-backend nil
+  "The synchronization backend."
+  :group 'gnus-sync
+  :type '(radio (const :format "None" nil)
+                (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)
+  (cond
+   ((stringp gnus-sync-backend)
+    (gnus-message 7 "gnus-sync: 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)))))
+      (with-temp-file gnus-sync-backend
+        (progn
+          (let ((coding-system-for-write gnus-ding-file-coding-system)
+                (standard-output (current-buffer)))
+            (princ (format ";; -*- mode:emacs-lisp; coding: %s; -*-\n"
+                           gnus-ding-file-coding-system))
+            (princ ";; Gnus sync data v. 0.0.1\n")
+            (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)
+                   (variables (cons 'gnus-sync-newsrc-loader
+                                    gnus-sync-global-vars))
+                   variable)
+              (while variables
+                (if (and (boundp (setq variable (pop variables)))
+                           (symbol-value variable))
+                    (progn
+                      (princ "\n(setq ")
+                      (princ (symbol-name variable))
+                      (princ " '")
+                      (prin1 (symbol-value variable))
+                      (princ ")\n"))
+                  (princ "\n;;; skipping empty variable ")
+                  (princ (symbol-name variable)))))
+            (gnus-message
+             7
+             "gnus-sync: 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-sync-backend)
+            (save-excursion
+              (goto-char (point-min))
+              (while (re-search-forward "^(\\|(\\\"" nil t)
+                (replace-match "\n\\&" t))
+              (goto-char (point-min))
+              (while (re-search-forward " $" nil t)
+                (replace-match "" t t))))))))
+    ;; 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)
+  (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))))
+
+;;;###autoload
+(defun gnus-sync-initialize ()
+"Initialize the Gnus sync facility."
+  (interactive)
+  (gnus-message 5 "Initializing the sync facility")
+  (gnus-sync-install-hooks))
+
+;;;###autoload
+(defun gnus-sync-install-hooks ()
+  "Install the sync hooks."
+  (interactive)
+  ;; (add-hook 'gnus-get-new-news-hook 'gnus-sync-read)
+  (add-hook 'gnus-save-newsrc-hook 'gnus-sync-save)
+  (add-hook 'gnus-read-newsrc-el-hook 'gnus-sync-read))
+
+(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))
+
+(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)
+
+(provide 'gnus-sync)
+
+;;; gnus-sync.el ends here
index 9d259881b091230bb0f30ed7a6c467c1bef50e6b..b99f1772d5b3de8f51493fff8224c395fc8d1c1e 100644 (file)
@@ -1140,6 +1140,7 @@ articles in the topic and its subtopics."
 
 (defun gnus-topic-mode (&optional arg redisplay)
   "Minor mode for topicsifying Gnus group buffers."
+  ;; FIXME: Use define-minor-mode.
   (interactive (list current-prefix-arg t))
   (when (eq major-mode 'gnus-group-mode)
     (make-local-variable 'gnus-topic-mode)
index 8030c084c39fb7a0914997065d9eabbf21809f7a..d11b778f3514f025c85effae1137c942b161a636 100644 (file)
@@ -45,6 +45,9 @@
 ;;; Code:
 
 (eval-when-compile (require 'cl))
+(eval-when-compile
+  (when (featurep 'xemacs)
+    (require 'easy-mmode))) ; for `define-minor-mode'
 
 (require 'gnus-util)
 (require 'gnus)
   :group 'gnus-undo)
 
 (defcustom gnus-undo-mode nil
+  ;; FIXME: This is a buffer-local minor mode which requires running
+  ;; code upon activation/deactivation, so defining it as a defcustom
+  ;; doesn't seem very useful: setting it to non-nil via Customize
+  ;; probably won't do the right thing.
   "Minor mode for undoing in Gnus buffers."
   :type 'boolean
   :group 'gnus-undo)
 
 ;;; Minor mode definition.
 
-(defvar gnus-undo-mode-map nil)
-
-(unless gnus-undo-mode-map
-  (setq gnus-undo-mode-map (make-sparse-keymap))
-
-  (gnus-define-keys gnus-undo-mode-map
-    "\M-\C-_"     gnus-undo
-    "\C-_"        gnus-undo
-    "\C-xu"       gnus-undo
-    ;; many people are used to type `C-/' on X terminals and get `C-_'.
-    [(control /)] gnus-undo))
+(defvar gnus-undo-mode-map
+  (let ((map (make-sparse-keymap)))
+    (gnus-define-keys map
+      "\M-\C-_"     gnus-undo
+      "\C-_"        gnus-undo
+      "\C-xu"       gnus-undo
+      ;; many people are used to type `C-/' on X terminals and get `C-_'.
+      [(control /)] gnus-undo)
+    map))
 
 (defun gnus-undo-make-menu-bar ()
   ;; This is disabled for the time being.
       (cons "Undo" 'gnus-undo-actions)
       [menu-bar file whatever])))
 
-(defun gnus-undo-mode (&optional arg)
+(define-minor-mode gnus-undo-mode
   "Minor mode for providing `undo' in Gnus buffers.
 
 \\{gnus-undo-mode-map}"
-  (interactive "P")
-  (set (make-local-variable 'gnus-undo-mode)
-       (if (null arg) (not gnus-undo-mode)
-        (> (prefix-numeric-value arg) 0)))
+  :keymap gnus-undo-mode-map
   (set (make-local-variable 'gnus-undo-actions) nil)
   (set (make-local-variable 'gnus-undo-boundary) t)
   (when gnus-undo-mode
     ;; Set up the menu.
     (when (gnus-visual-p 'undo-menu 'menu)
       (gnus-undo-make-menu-bar))
-    (add-minor-mode 'gnus-undo-mode "" gnus-undo-mode-map)
     (gnus-make-local-hook 'post-command-hook)
-    (add-hook 'post-command-hook 'gnus-undo-boundary nil t)
-    (gnus-run-hooks 'gnus-undo-mode-hook)))
+    (add-hook 'post-command-hook 'gnus-undo-boundary nil t)))
 
 ;;; Interface functions.
 
index d101047280cbc28593e2ad522ca7abc8803e1975..93cc1f0a5422220db453d038f37467052215a254 100644 (file)
 (defvar gnus-original-article-buffer)
 (defvar gnus-user-agent)
 
-(require 'time-date)
-(require 'netrc)
-
-(autoload 'message-fetch-field "message")
 (autoload 'gnus-get-buffer-window "gnus-win")
 (autoload 'nnheader-narrow-to-headers "nnheader")
 (autoload 'nnheader-replace-chars-in-string "nnheader")
@@ -206,8 +202,11 @@ Uses `gnus-extract-address-components'."
 Uses `gnus-extract-address-components'."
   (nth 1 (gnus-extract-address-components from)))
 
+(declare-function message-fetch-field "message" (header &optional not-all))
+
 (defun gnus-fetch-field (field)
   "Return the value of the header FIELD of current article."
+  (require 'message)
   (save-excursion
     (save-restriction
       (let ((inhibit-point-motion-hooks t))
@@ -228,13 +227,14 @@ Uses `gnus-extract-address-components'."
                   (point)))))
 
 (declare-function gnus-find-method-for-group "gnus" (group &optional info))
-(autoload 'gnus-group-name-decode "gnus-group")
+(declare-function gnus-group-name-decode "gnus-group" (string charset))
 (declare-function gnus-group-name-charset "gnus-group" (method group))
 ;; gnus-group requires gnus-int which requires message.
 (declare-function message-tokenize-header "message"
                   (header &optional separator))
 
 (defun gnus-decode-newsgroups (newsgroups group &optional method)
+  (require 'gnus-group)
   (let ((method (or method (gnus-find-method-for-group group))))
     (mapconcat (lambda (group)
                 (gnus-group-name-decode group (gnus-group-name-charset
@@ -429,6 +429,20 @@ TIME defaults to the current time."
     (+ (car now) (* (car (cdr now)) 60) (* (car (nthcdr 2 now)) 3600)
        (* (- (string-to-number days) 1) 3600 24))))
 
+(defmacro gnus-date-get-time (date)
+  "Convert DATE string to Emacs time.
+Cache the result as a text property stored in DATE."
+  ;; Either return the cached value...
+  `(let ((d ,date))
+     (if (equal "" d)
+        '(0 0)
+       (or (get-text-property 0 'gnus-time d)
+          ;; or compute the value...
+          (let ((time (safe-date-to-time d)))
+            ;; and store it back in the string.
+            (put-text-property 0 1 'gnus-time time d)
+            time)))))
+
 (defvar gnus-user-date-format-alist
   '(((gnus-seconds-today) . "%k:%M")
     (604800 . "%a %k:%M")                   ;;that's one week
@@ -455,10 +469,10 @@ respectively.")
 
 (defun gnus-user-date (messy-date)
   "Format the messy-date according to gnus-user-date-format-alist.
-Returns \"  ?  \" if there's bad input or if an other error occurs.
+Returns \"  ?  \" if there's bad input or if another error occurs.
 Input should look like this: \"Sun, 14 Oct 2001 13:34:39 +0200\"."
   (condition-case ()
-      (let* ((messy-date (gnus-float-time (safe-date-to-time messy-date)))
+      (let* ((messy-date (gnus-float-time (gnus-date-get-time messy-date)))
             (now (gnus-float-time))
             ;;If we don't find something suitable we'll use this one
             (my-format "%b %d '%y"))
@@ -477,23 +491,9 @@ Input should look like this: \"Sun, 14 Oct 2001 13:34:39 +0200\"."
 (defun gnus-dd-mmm (messy-date)
   "Return a string like DD-MMM from a big messy string."
   (condition-case ()
-      (format-time-string "%d-%b" (safe-date-to-time messy-date))
+      (format-time-string "%d-%b" (gnus-date-get-time messy-date))
     (error "  -   ")))
 
-(defmacro gnus-date-get-time (date)
-  "Convert DATE string to Emacs time.
-Cache the result as a text property stored in DATE."
-  ;; Either return the cached value...
-  `(let ((d ,date))
-     (if (equal "" d)
-        '(0 0)
-       (or (get-text-property 0 'gnus-time d)
-          ;; or compute the value...
-          (let ((time (safe-date-to-time d)))
-            ;; and store it back in the string.
-            (put-text-property 0 1 'gnus-time time d)
-            time)))))
-
 (defsubst gnus-time-iso8601 (time)
   "Return a string of TIME in YYYYMMDDTHHMMSS format."
   (format-time-string "%Y%m%dT%H%M%S" time))
@@ -1070,23 +1070,15 @@ with potentially long computations."
 ;;; Functions for saving to babyl/mail files.
 
 (eval-when-compile
-  (condition-case nil
-      (progn
-       (require 'rmail)
-       (autoload 'rmail-update-summary "rmailsum"))
-    (error
-     (define-compiler-macro rmail-select-summary (&rest body)
-       ;; Rmail of the XEmacs version is supplied by the package, and
-       ;; requires tm and apel packages.  However, there may be those
-       ;; who haven't installed those packages.  This macro helps such
-       ;; people even if they install those packages later.
-       `(eval '(rmail-select-summary ,@body)))
-     ;; If there's rmail but there's no tm (or there's apel of the
-     ;; mainstream, not the XEmacs version), loading rmail of the XEmacs
-     ;; version fails halfway, however it provides the rmail-select-summary
-     ;; macro which uses the following functions:
-     (autoload 'rmail-summary-displayed "rmail")
-     (autoload 'rmail-maybe-display-summary "rmail"))))
+  (if (featurep 'xemacs)
+      ;; Don't load tm and apel XEmacs packages that provide some
+      ;; Emacs emulating functions and variables.
+      (let ((features features))
+       (provide 'tm-view)
+       (unless (fboundp 'set-alist) (defalias 'set-alist 'ignore))
+       (require 'rmail)) ;; It requires tm-view that loads apel.
+    (require 'rmail))
+  (autoload 'rmail-update-summary "rmailsum"))
 
 (defvar mm-text-coding-system)
 
@@ -1305,6 +1297,14 @@ Return the modified alist."
        (setq alist (delq entry alist)))
       alist)))
 
+(defun gnus-grep-in-list (word list)
+  "Find if a WORD matches any regular expression in the given LIST."
+  (when (and word list)
+    (catch 'found
+      (dolist (r list)
+       (when (string-match r word)
+         (throw 'found r))))))
+
 (defmacro gnus-pull (key alist &optional assoc-p)
   "Modify ALIST to be without KEY."
   (unless (symbolp alist)
index 3cce1e6973a8c594b88f26000e9474022c42c43a..86cd78cefa32b2cdcbb1d7e53160f1e7aa9c2bc1 100644 (file)
@@ -1488,7 +1488,7 @@ When called interactively, prompt for REGEXP."
       (when gnus-uu-kill-carriage-return
        (save-excursion
          (while (search-forward "\r" nil t)
-           (delete-backward-char 1))))
+           (delete-char -1))))
 
       (while (or (re-search-forward gnus-uu-begin-string nil t)
                 (re-search-forward gnus-uu-body-line nil t))
index b07dfc648c0057e86ec56e8ac5bcce92a4c8160e..dece8dccece00e971c5daeff6cb81f62be31ebd5 100644 (file)
@@ -7,6 +7,7 @@
 ;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
 ;;     Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news, mail
+;; Version: 5.13
 
 ;; This file is part of GNU Emacs.
 
@@ -1057,14 +1058,14 @@ be set in `.emacs' instead."
                                    (symbol-value 'image-load-path))
                                   (t load-path)))
            (image (find-image
-                   `((:type svg :file "gnus.svg")
-                     (:type png :file "gnus.png")
-                     (:type xpm :file "gnus.xpm"
+                   `((:type xpm :file "gnus.xpm"
                             :color-symbols
                             (("thing" . ,(car gnus-logo-colors))
                              ("shadow" . ,(cadr gnus-logo-colors))
                              ("oort" . "#eeeeee")
                              ("background" . ,(face-background 'default))))
+                     (:type svg :file "gnus.svg")
+                     (:type png :file "gnus.png")
                      (:type pbm :file "gnus.pbm"
                             ;; Account for the pbm's blackground.
                             :background ,(face-foreground 'gnus-splash)
@@ -1740,17 +1741,12 @@ slower."
     ("nndoc" none address prompt-address)
     ("nnbabyl" mail address respool)
     ("nnkiboze" post virtual)
-    ("nnsoup" post-mail address)
     ("nndraft" post-mail)
     ("nnfolder" mail respool address)
     ("nngateway" post-mail address prompt-address physical-address)
     ("nnweb" none)
-    ("nngoogle" post)
-    ("nnslashdot" post)
-    ("nnultimate" none)
     ("nnrss" none)
     ("nnwfm" none)
-    ("nnwarchive" none)
     ("nnlistserv" none)
     ("nnagent" post-mail)
     ("nnimap" post-mail address prompt-address physical-address)
@@ -1774,7 +1770,8 @@ this variable.  I think."
                                   (const :format "%v " prompt-address)
                                   (const :format "%v " physical-address)
                                   (const :format "%v " virtual)
-                                  (const respool)))))
+                                  (const respool))))
+  :version "24.1")
 
 (defun gnus-redefine-select-method-widget ()
   "Recomputes the select-method widget based on the value of
@@ -2892,10 +2889,6 @@ gnus-registry.el will populate this if it's loaded.")
      ("rmailsum" rmail-update-summary)
      ("gnus-audio" :interactive t gnus-audio-play)
      ("gnus-xmas" gnus-xmas-splash)
-     ("gnus-soup" :interactive t
-      gnus-group-brew-soup gnus-brew-soup gnus-soup-add-article
-      gnus-soup-send-replies gnus-soup-save-areas gnus-soup-pack-packet)
-     ("nnsoup" nnsoup-pack-replies)
      ("score-mode" :interactive t gnus-score-mode)
      ("gnus-mh" gnus-summary-save-article-folder
       gnus-Folder-save-name gnus-folder-save-name)
@@ -3027,8 +3020,6 @@ gnus-registry.el will populate this if it's loaded.")
       gnus-dup-enter-articles)
      ("gnus-range" gnus-copy-sequence)
      ("gnus-eform" gnus-edit-form)
-     ("gnus-move" :interactive t
-      gnus-group-move-group-to-server gnus-change-server)
      ("gnus-logic" gnus-score-advanced)
      ("gnus-undo" gnus-undo-mode gnus-undo-register)
      ("gnus-async" gnus-async-request-fetched-article gnus-async-prefetch-next
index 87012405ef9d4aa78086720c93d8a8cb9242086b..ffcb6fa60e0490b52f9226d6d66a4edde223ccdc 100644 (file)
@@ -39,7 +39,6 @@
 ;;; Code:
 
 (eval-when-compile (require 'cl))
-(require 'time-date)
 (require 'mm-util)
 
 (defvar ietf-drums-no-ws-ctl-token "\001-\010\013\014\016-\037\177"
index 44edd70363809612dbdafc50055a653b64e377c7..46f9169a6a3d467328660dc1041d175cc22d9945 100644 (file)
@@ -1,7 +1,7 @@
 ;;; mail-source.el --- functions for fetching mail
 
-;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+;;   2008, 2009, 2010  Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news, mail
@@ -574,10 +574,13 @@ Return the number of files that were found."
                      (error "Cannot get new mail"))
                    0)))))))))
 
+(declare-function gnus-message "gnus-util" (level &rest args))
+
 (defun mail-source-delete-old-incoming (&optional age confirm)
   "Remove incoming files older than AGE days.
 If CONFIRM is non-nil, ask for confirmation before removing a file."
   (interactive "P")
+  (require 'gnus-util)
   (let* ((high2days (/ 65536.0 60 60 24));; convert high bits to days
         (low2days  (/ 1.0 65536.0))     ;; convert low bits to days
         (diff (if (natnump age) age 30));; fallback, if no valid AGE given
index e725dfcea88198190fde12ec20e4dac1320c4e7c..6461a9ae743a2f750a7fcc1f32e0235f42cce1fd 100644 (file)
@@ -335,7 +335,7 @@ nil means your home directory."
   :group 'mailcap)
 
 (defvar mailcap-poor-system-types
-  '(ms-dos ms-windows windows-nt win32 w32 mswindows)
+  '(ms-dos windows-nt)
   "Systems that don't have a Unix-like directory hierarchy.")
 
 ;;;
index 2fe8a4d32ef5ce3941c67af21bca371db65f743a..2e27daca90b38db1ea6e23fe5641949f9dd4dc2f 100644 (file)
 (eval-when-compile
   (require 'cl))
 
-(require 'hashcash)
-(require 'canlock)
 (require 'mailheader)
 (require 'gmm-utils)
-(require 'nnheader)
+(require 'mail-utils)
+;; Only for the trivial macros mail-header-from, mail-header-date
+;; mail-header-references, mail-header-subject, mail-header-id
+(eval-when-compile (require 'nnheader))
 ;; This is apparently necessary even though things are autoloaded.
 ;; Because we dynamically bind mail-abbrev-mode-regexp, we'd better
 ;; require mailabbrev here.
@@ -48,7 +49,6 @@
 (require 'mail-parse)
 (require 'mml)
 (require 'rfc822)
-(require 'ecomplete)
 
 (autoload 'mailclient-send-it "mailclient") ;; Emacs 22 or contrib/
 
@@ -249,6 +249,14 @@ included.  Organization and User-Agent are optional."
   :link '(custom-manual "(message)Message Headers")
   :type '(repeat sexp))
 
+(defcustom message-prune-recipient-rules nil
+  "Rules for how to prune the list of recipients when doing wide replies.
+This is a list of regexps and regexp matches."
+  :group 'message-mail
+  :group 'message-headers
+  :link '(custom-manual "(message)Wide Reply")
+  :type '(repeat regexp))
+
 (defcustom message-deletable-headers '(Message-ID Date Lines)
   "Headers to be deleted if they already exist and were generated by message previously."
   :group 'message-headers
@@ -655,8 +663,6 @@ Done before generating the new subject of a forward."
   :link '(custom-manual "(message)Canceling News")
   :type 'string)
 
-(defvar smtpmail-default-smtp-server)
-
 (defun message-send-mail-function ()
   "Return suitable value for the variable `message-send-mail-function'."
   (cond ((and (require 'sendmail)
@@ -665,14 +671,13 @@ Done before generating the new subject of a forward."
              (executable-find sendmail-program))
         'message-send-mail-with-sendmail)
        ((and (locate-library "smtpmail")
-             (require 'smtpmail)
+             (boundp 'smtpmail-default-smtp-server)
              smtpmail-default-smtp-server)
         'message-smtpmail-send-it)
        ((locate-library "mailclient")
         'message-send-mail-with-mailclient)
        (t
-        (lambda ()
-          (error "Don't know how to send mail.  Please customize `message-send-mail-function'")))))
+        (error "Don't know how to send mail.  Please customize `message-send-mail-function'"))))
 
 ;; Useful to set in site-init.el
 (defcustom message-send-mail-function
@@ -1280,7 +1285,7 @@ text and it replaces `self-insert-command' with the other command, e.g.
   :type '(repeat function))
 
 (defcustom message-auto-save-directory
-  (file-name-as-directory (nnheader-concat message-directory "drafts"))
+  (file-name-as-directory (expand-file-name "drafts" message-directory))
   "*Directory where Message auto-saves buffers if Gnus isn't running.
 If nil, Message won't auto-save."
   :group 'message-buffers
@@ -1623,11 +1628,11 @@ If you'd like to make it possible to share draft files between XEmacs
 and Emacs, you may use `iso-2022-7bit' for this value at your own risk.
 Note that the coding-system `iso-2022-7bit' isn't suitable to all data.")
 
-(defcustom message-send-mail-partially-limit 1000000
+(defcustom message-send-mail-partially-limit nil
   "The limitation of messages sent as message/partial.
 The lower bound of message size in characters, beyond which the message
 should be sent in several parts.  If it is nil, the size is unlimited."
-  :version "21.1"
+  :version "24.1"
   :group 'message-buffers
   :link '(custom-manual "(message)Mail Variables")
   :type '(choice (const :tag "unlimited" nil)
@@ -1742,6 +1747,7 @@ You must have the \"hashcash\" binary installed, see `hashcash-path'."
 (defvar message-mime-part nil)
 (defvar message-posting-charset nil)
 (defvar message-inserted-headers nil)
+(defvar message-inhibit-ecomplete nil)
 
 ;; Byte-compiler warning
 (defvar gnus-active-hashtb)
@@ -1956,6 +1962,8 @@ is used by default."
                 (setq paren nil))))
        (nreverse elems)))))
 
+(autoload 'nnheader-insert-file-contents "nnheader")
+
 (defun message-mail-file-mbox-p (file)
   "Say whether FILE looks like a Unix mbox file."
   (when (and (file-exists-p file)
@@ -2849,6 +2857,8 @@ See also `message-forbidden-properties'."
          (inhibit-read-only t))
       (remove-text-properties begin end message-forbidden-properties))))
 
+(autoload 'ecomplete-setup "ecomplete") ;; for Emacs <23.
+
 ;;;###autoload
 (define-derived-mode message-mode text-mode "Message"
   "Major mode for editing mail and news to be sent.
@@ -3408,8 +3418,8 @@ Message buffers and is not meant to be called directly."
                                ;; if message-signature-file contains a path.
                                (not (file-name-directory
                                      message-signature-file)))
-                          (nnheader-concat message-signature-directory
-                                           message-signature-file)
+                          (expand-file-name message-signature-file
+                                            message-signature-directory)
                         message-signature-file))
                 (file-exists-p signature-file))))
     (when signature
@@ -4090,7 +4100,8 @@ It should typically alter the sending method in some way or other."
        (run-hooks 'message-sent-hook))
       (message "Sending...done")
       ;; Do ecomplete address snarfing.
-      (when (message-mail-alias-type-p 'ecomplete)
+      (when (and (message-mail-alias-type-p 'ecomplete)
+                (not message-inhibit-ecomplete))
        (message-put-addresses-in-ecomplete))
       ;; Mark the buffer as unmodified and delete auto-save.
       (set-buffer-modified-p nil)
@@ -4412,6 +4423,8 @@ This function could be useful in `message-setup-hook'."
            (erase-buffer)))
       (kill-buffer tembuf))))
 
+(declare-function hashcash-wait-async "hashcash" (&optional buffer))
+
 (defun message-send-mail (&optional arg)
   (require 'mail-utils)
   (let* ((tembuf (message-generate-new-buffer-clone-locals " message temp"))
@@ -4419,14 +4432,26 @@ This function could be useful in `message-setup-hook'."
         (news (message-news-p))
         (mailbuf (current-buffer))
         (message-this-is-mail t)
+        ;; gnus-setup-posting-charset is autoloaded in mml.el (FIXME
+        ;; maybe it should not be), which this file requires.  Hence
+        ;; the fboundp test is always true.  Loading it from gnus-msg
+        ;; loads many Gnus files (Bug#5642).  If
+        ;; gnus-group-posting-charset-alist hasn't been customized,
+        ;; this is just going to return nil anyway.  FIXME it would
+        ;; be good to improve this further, because even if g-g-p-c-a
+        ;; has been customized, that is likely to just be for news.
+        ;; Eg either move the definition from gnus-msg, or separate out
+        ;; the mail and news parts.
         (message-posting-charset
-         (if (fboundp 'gnus-setup-posting-charset)
+         (if (and (fboundp 'gnus-setup-posting-charset)
+                  (boundp 'gnus-group-posting-charset-alist))
              (gnus-setup-posting-charset nil)
            message-posting-charset))
         (headers message-required-mail-headers))
     (when (and message-generate-hashcash
               (not (eq message-generate-hashcash 'opportunistic)))
       (message "Generating hashcash...")
+      (require 'hashcash)
       ;; Wait for calculations already started to finish...
       (hashcash-wait-async)
       ;; ...and do calculations not already done.  mail-add-payment
@@ -4548,6 +4573,7 @@ If you always want Gnus to send messages in one piece, set
 
 (defun message-send-mail-with-sendmail ()
   "Send off the prepared buffer with sendmail."
+  (require 'sendmail)
   (let ((errbuf (if message-interactive
                    (message-generate-new-buffer-clone-locals
                     " sendmail errors")
@@ -4711,10 +4737,14 @@ Do not use this for anything important, it is cryptographically weak."
                  (prin1-to-string (recent-keys))
                  (prin1-to-string (garbage-collect))))))
 
+(defvar canlock-password)
+(defvar canlock-password-for-verify)
+
 (defun message-canlock-password ()
   "The password used by message for cancel locks.
 This is the value of `canlock-password', if that option is non-nil.
 Otherwise, generate and save a value for `canlock-password' first."
+  (require 'canlock)
   (unless canlock-password
     (customize-save-variable 'canlock-password (message-canlock-generate))
     (setq canlock-password-for-verify canlock-password))
@@ -4725,7 +4755,12 @@ Otherwise, generate and save a value for `canlock-password' first."
     (message-canlock-password)
     (canlock-insert-header)))
 
+(autoload 'nnheader-get-report "nnheader")
+
+(declare-function gnus-setup-posting-charset "gnus-msg" (group))
+
 (defun message-send-news (&optional arg)
+  (require 'gnus-msg)
   (let* ((tembuf (message-generate-new-buffer-clone-locals " *message temp*"))
         (case-fold-search nil)
         (method (if (functionp message-post-method)
@@ -5406,7 +5441,7 @@ In posting styles use `(\"Expires\" (make-expires-date 30))'."
           (* 25 25)))
   (let ((tm (current-time)))
     (concat
-     (if (or (memq system-type '(ms-dos emx))
+     (if (or (eq system-type 'ms-dos)
             ;; message-number-base36 doesn't handle bigints.
             (floatp (user-uid)))
         (let ((user (downcase (user-login-name))))
@@ -5464,7 +5499,7 @@ In posting styles use `(\"Expires\" (make-expires-date 30))'."
 (defun message-make-references ()
   "Return the References header for this message."
   (when message-reply-headers
-    (let ((message-id (mail-header-message-id message-reply-headers))
+    (let ((message-id (mail-header-id message-reply-headers))
          (references (mail-header-references message-reply-headers)))
       (if (or references message-id)
          (concat (or references "") (and references " ")
@@ -5476,7 +5511,7 @@ In posting styles use `(\"Expires\" (make-expires-date 30))'."
   (when message-reply-headers
     (let ((from (mail-header-from message-reply-headers))
          (date (mail-header-date message-reply-headers))
-         (msg-id (mail-header-message-id message-reply-headers)))
+         (msg-id (mail-header-id message-reply-headers)))
       (when from
        (let ((name (mail-extract-address-components from)))
          (concat
@@ -6424,9 +6459,7 @@ are not included."
       (setq buffer-file-name (expand-file-name
                              (concat
                              (if (memq system-type
-                                       '(ms-dos ms-windows windows-nt
-                                                cygwin cygwin32 win32 w32
-                                                mswindows))
+                                       '(ms-dos windows-nt cygwin))
                                  "message"
                                "*message*")
                               (format-time-string "-%Y%m%d-%H%M%S"))
@@ -6526,7 +6559,7 @@ The function is called with one parameter, a cons cell ..."
 
 (defun message-get-reply-headers (wide &optional to-address address-headers)
   (let (follow-to mct never-mct to cc author mft recipients extra)
-  ;; Find all relevant headers we need.
+    ;; Find all relevant headers we need.
     (save-restriction
       (message-narrow-to-headers-or-head)
       ;; Gmane renames "To".  Look at "Original-To", too, if it is present in
@@ -6652,6 +6685,8 @@ want to get rid of this query permanently.")))
                (if recip
                    (setq recipients (delq recip recipients))))))))
 
+      (setq recipients (message-prune-recipients recipients))
+      
       ;; Build the header alist.  Allow the user to be asked whether
       ;; or not to reply to all recipients in a wide reply.
       (setq follow-to (list (cons 'To (cdr (pop recipients)))))
@@ -6665,6 +6700,22 @@ want to get rid of this query permanently.")))
        (push (cons 'Cc recipients) follow-to)))
     follow-to))
 
+(defun message-prune-recipients (recipients)
+  (dolist (rule message-prune-recipient-rules)
+    (let ((match (car rule))
+         dup-match 
+         address)
+      (dolist (recipient recipients)
+       (setq address (car recipient))
+       (when (string-match match address)
+         (setq dup-match (replace-match (cadr rule) nil nil address))
+         (dolist (recipient recipients)
+           ;; Don't delete the address that triggered this.
+           (when (and (not (eq address (car recipient)))
+                      (string-match dup-match (car recipient)))
+             (setq recipients (delq recipient recipients))))))))
+  recipients)
+
 (defcustom message-simplify-subject-functions
   '(message-strip-list-identifiers
     message-strip-subject-re
@@ -7136,22 +7187,28 @@ Optional DIGEST will use digest to forward."
 (defun message-forward-make-body-plain (forward-buffer)
   (insert
    "\n-------------------- Start of forwarded message --------------------\n")
-  (let ((b (point)) e)
-    (insert
-     (with-temp-buffer
-       (mm-disable-multibyte)
-       (insert
-       (with-current-buffer forward-buffer
-         (mm-with-unibyte-current-buffer (buffer-string))))
-       (mm-enable-multibyte)
-       (mime-to-mml)
-       (goto-char (point-min))
-       (when (looking-at "From ")
-        (replace-match "X-From-Line: "))
-       (buffer-string)))
+  (let ((b (point))
+       (contents (with-current-buffer forward-buffer (buffer-string)))
+       e)
+    (unless (featurep 'xemacs)
+      (unless (mm-multibyte-string-p contents)
+       (error "Attempt to insert unibyte string from the buffer \"%s\"\
+ to the multibyte buffer \"%s\""
+              (if (bufferp forward-buffer)
+                  (buffer-name forward-buffer)
+                forward-buffer)
+              (buffer-name))))
+    (insert (mm-with-multibyte-buffer
+             (insert contents)
+             (mime-to-mml)
+             (goto-char (point-min))
+             (when (looking-at "From ")
+               (replace-match "X-From-Line: "))
+             (buffer-string)))
+    (unless (bolp) (insert "\n"))
     (setq e (point))
     (insert
-     "\n-------------------- End of forwarded message --------------------\n")
+     "-------------------- End of forwarded message --------------------\n")
     (message-remove-ignored-headers b e)))
 
 (defun message-remove-ignored-headers (b e)
@@ -7187,18 +7244,22 @@ Optional DIGEST will use digest to forward."
   (insert "\n\n<#mml type=message/rfc822 disposition=inline>\n")
   (let ((b (point)) e)
     (if (not message-forward-decoded-p)
-       (insert
-        (with-temp-buffer
-          (mm-disable-multibyte)
-          (insert
-           (with-current-buffer forward-buffer
-             (mm-with-unibyte-current-buffer (buffer-string))))
-          (mm-enable-multibyte)
-          (mime-to-mml)
-          (goto-char (point-min))
-          (when (looking-at "From ")
-            (replace-match "X-From-Line: "))
-          (buffer-string)))
+       (let ((contents (with-current-buffer forward-buffer (buffer-string))))
+         (unless (featurep 'xemacs)
+           (unless (mm-multibyte-string-p contents)
+             (error "Attempt to insert unibyte string from the buffer \"%s\"\
+ to the multibyte buffer \"%s\""
+                    (if (bufferp forward-buffer)
+                        (buffer-name forward-buffer)
+                      forward-buffer)
+                    (buffer-name))))
+         (insert (mm-with-multibyte-buffer
+                   (insert contents)
+                   (mime-to-mml)
+                   (goto-char (point-min))
+                   (when (looking-at "From ")
+                     (replace-match "X-From-Line: "))
+                   (buffer-string))))
       (save-restriction
        (narrow-to-region (point) (point))
        (mml-insert-buffer forward-buffer)
@@ -7390,6 +7451,7 @@ is for the internal use."
        (replace-match "X-From-Line: "))
       ;; Send it.
       (let ((message-inhibit-body-encoding t)
+           (message-inhibit-ecomplete t)
            message-required-mail-headers
            message-generate-hashcash
            rfc2047-encode-encoded-words)
@@ -8002,7 +8064,11 @@ From headers in the original article."
        (not result)
       result)))
 
+(declare-function ecomplete-add-item "ecomplete" (type key text))
+(declare-function ecomplete-save "ecomplete" ())
+
 (defun message-put-addresses-in-ecomplete ()
+  (require 'ecomplete)
   (dolist (header '("to" "cc" "from" "reply-to"))
     (let ((value (message-field-value header)))
       (dolist (string (mail-header-parse-addresses value 'raw))
@@ -8013,6 +8079,8 @@ From headers in the original article."
                            string))))
   (ecomplete-save))
 
+(autoload 'ecomplete-display-matches "ecomplete")
+
 (defun message-display-abbrev (&optional choose)
   "Display the next possible abbrev for the text before point."
   (interactive (list t))
index ac05362ec0ce08abf3b04331447e3766c5967bec..b59f0ab0610aff43d0f35a54409b78f1d7b720c7 100644 (file)
   (unless (fboundp 'declare-function) (defmacro declare-function (&rest r))))
 
 (require 'mail-parse)
-(require 'mailcap)
 (require 'mm-bodies)
-(require 'gnus-util)
 (eval-when-compile (require 'cl)
                   (require 'term))
 
+(autoload 'gnus-map-function "gnus-util")
+(autoload 'gnus-replace-in-string "gnus-util")
+(autoload 'gnus-read-shell-command "gnus-util")
+
 (autoload 'mm-inline-partial "mm-partial")
 (autoload 'mm-inline-external-body "mm-extern")
 (autoload 'mm-extern-cache-contents "mm-extern")
         ,disposition ,description ,cache ,id))
 
 (defcustom mm-text-html-renderer
-  (cond ((executable-find "w3m")
-        (if (locate-library "w3m")
-            'w3m
-          'w3m-standalone))
+  (cond ((and (executable-find "w3m")
+             (executable-find "curl"))
+        'gnus-article-html)
        ((executable-find "links") 'links)
        ((executable-find "lynx") 'lynx)
        ((locate-library "w3") 'w3)
@@ -122,7 +123,7 @@ The defined renderer types are:
 `w3'   : use Emacs/W3;
 `html2text' : use html2text;
 nil    : use external viewer (default web browser)."
-  :version "23.0" ;; No Gnus
+  :version "24.1"
   :type '(choice (const w3)
                 (const w3m :tag "emacs-w3m")
                 (const w3m-standalone :tag "standalone w3m" )
@@ -550,6 +551,8 @@ Postpone undisplaying of viewers for types in
     (message "Destroying external MIME viewers")
     (mm-destroy-parts mm-postponed-undisplay-list)))
 
+(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."
   (save-excursion
@@ -688,6 +691,9 @@ Postpone undisplaying of viewers for types in
          (goto-char (point-max)))
       (mapcar 'mm-display-parts handle))))
 
+(autoload 'mailcap-parse-mailcaps "mailcap")
+(autoload 'mailcap-mime-info "mailcap")
+
 (defun mm-display-part (handle &optional no-default)
   "Display the MIME part represented by HANDLE.
 Returns nil if the part is removed; inline if displayed inline;
@@ -747,6 +753,7 @@ external if displayed external."
                 handle 'mailcap-save-binary-file)))))))))
 
 (declare-function gnus-configure-windows "gnus-win" (setting &optional force))
+(defvar mailcap-mime-extensions)       ; mailcap-mime-info autoloads
 
 (defun mm-display-external (handle method)
   "Display HANDLE using METHOD."
@@ -1250,11 +1257,11 @@ PROMPT overrides the default one used to ask user for a file name."
           (mm-save-part-to-file handle file)
           file))))
 
-(defun mm-add-meta-html-tag (handle &optional charset)
+(defun mm-add-meta-html-tag (handle &optional charset force-charset)
   "Add meta html tag to specify CHARSET of HANDLE in the current buffer.
 CHARSET defaults to the one HANDLE specifies.  Existing meta tag that
-specifies charset will not be modified.  Return t if meta tag is added
-or replaced."
+specifies charset will not be modified unless FORCE-CHARSET is non-nil.
+Return t if meta tag is added or replaced."
   (when (equal (mm-handle-media-type handle) "text/html")
     (when (or charset
              (setq charset (mail-content-type-get (mm-handle-type handle)
@@ -1266,7 +1273,8 @@ or replaced."
        (if (re-search-forward "\
 <meta\\s-+http-equiv=[\"']?content-type[\"']?\\s-+content=[\"']\
 text/\\(\\sw+\\)\\(?:\;\\s-*charset=\\(.+\\)\\)?[\"'][^>]*>" nil t)
-           (if (and (match-beginning 2)
+           (if (and (not force-charset)
+                    (match-beginning 2)
                     (string-match "\\`html\\'" (match-string 1)))
                ;; Don't modify existing meta tag.
                nil
@@ -1292,12 +1300,13 @@ text/\\(\\sw+\\)\\(?:\;\\s-*charset=\\(.+\\)\\)?[\"'][^>]*>" nil t)
          (mm-write-region (point-min) (point-max) file nil nil nil 'binary t)
        (set-default-file-modes current-file-modes)))))
 
-(defun mm-pipe-part (handle)
-  "Pipe HANDLE to a process."
-  (let* ((name (mail-content-type-get (mm-handle-type handle) 'name))
-        (command
-         (gnus-read-shell-command
-           "Shell command on MIME part: " mm-last-shell-command)))
+(defun mm-pipe-part (handle &optional cmd)
+  "Pipe HANDLE to a process.
+Use CMD as the process."
+  (let ((name (mail-content-type-get (mm-handle-type handle) 'name))
+       (command (or cmd
+                    (gnus-read-shell-command
+                     "Shell command on MIME part: " mm-last-shell-command))))
     (mm-with-unibyte-buffer
       (mm-insert-part handle)
       (mm-add-meta-html-tag handle)
index a32927b8ae38c11587d72a2d998a3523a91abd2b..0d609e56cbbb7277c49d910766a2a85d299bf351 100644 (file)
@@ -26,7 +26,7 @@
 
 (eval-when-compile (require 'cl))
 (require 'mail-parse)
-(require 'mailcap)
+(autoload 'mailcap-extension-to-mime "mailcap")
 (autoload 'mm-body-7-or-8 "mm-bodies")
 (autoload 'mm-long-lines-p "mm-bodies")
 
index 1e3df3c4cff13ba26a2de0990b1fb3ec0dbd5395..f40f798789cec0aced7100bfd7b6252fc230b95c 100644 (file)
@@ -67,9 +67,8 @@
        (coding-system-for-read mm-binary-coding-system))
     (unless url
       (error "URL is not specified"))
-    (mm-with-unibyte-current-buffer
-      (mm-url-insert-file-contents url))
     (mm-disable-multibyte)
+    (mm-url-insert-file-contents url)
     (setq buffer-file-name name)))
 
 (defun mm-extern-anon-ftp (handle)
                            (or access-type
                                (error "Couldn't find access type"))))
                          mm-extern-function-alist)))
-        buf handles)
+        handles)
     (unless func
       (error "Access type (%s) is not supported" access-type))
     (mm-with-part handle
     (unless (bufferp (car handles))
       (mm-destroy-parts handles)
       (error "Multipart external body is not supported"))
-    (save-excursion
-      (set-buffer (setq buf (mm-handle-buffer handles)))
+    (with-current-buffer (mm-handle-buffer handles)
       (let (good)
        (unwind-protect
            (progn
index 35a43f5bd273634fa29a9588488f14cd67fe994a..3e80f6ac61cc3c64562c5c47f766752951a173f0 100644 (file)
@@ -365,15 +365,20 @@ If FOLLOW-REFRESH is non-nil, redirect refresh url in META."
 (defun mm-url-decode-entities ()
   "Decode all HTML entities."
   (goto-char (point-min))
-  (while (re-search-forward "&\\(#[0-9]+\\|[a-z]+[0-9]*\\);" nil t)
-    (let ((elem (if (eq (aref (match-string 1) 0) ?\#)
-                       (let ((c (mm-ucs-to-char
-                                 (string-to-number
-                                  (substring (match-string 1) 1)))))
-                         (if (mm-char-or-char-int-p c) c ?#))
-                     (or (cdr (assq (intern (match-string 1))
-                                    mm-url-html-entities))
-                         ?#))))
+  (while (re-search-forward "&\\(#[0-9]+\\|#x[0-9a-f]+\\|[a-z]+[0-9]*\\);" nil t)
+    (let* ((entity (match-string 1))
+          (elem (if (eq (aref entity 0) ?\#)
+                    (let ((c (mm-ucs-to-char
+                              ;; Hex number: &#x3212
+                              (if (eq (aref entity 1) ?x)
+                                  (string-to-number (substring entity 2)
+                                                    16)
+                                ;; Decimal number: &#23
+                                (string-to-number (substring entity 1))))))
+                      (if (mm-char-or-char-int-p c) c ?#))
+                  (or (cdr (assq (intern entity)
+                                 mm-url-html-entities))
+                      ?#))))
       (unless (stringp elem)
        (setq elem (char-to-string elem)))
       (replace-match elem t t))))
@@ -404,14 +409,10 @@ spaces.  Die Die Die."
       ((= char ?  ) "+")
       ((memq char mm-url-unreserved-chars) (char-to-string char))
       (t (upcase (format "%%%02x" char)))))
-   ;; Fixme: Should this actually be accepting multibyte?  Is there a
-   ;; better way in XEmacs?
-   (if (featurep 'mule)
-       (encode-coding-string chunk
-                            (if (fboundp 'find-coding-systems-string)
-                                (car (find-coding-systems-string chunk))
-                                buffer-file-coding-system))
-     chunk)
+   (mm-encode-coding-string chunk
+                           (if (fboundp 'find-coding-systems-string)
+                               (car (find-coding-systems-string chunk))
+                             buffer-file-coding-system))
    ""))
 
 (defun mm-url-encode-www-form-urlencoded (pairs)
@@ -422,6 +423,50 @@ spaces.  Die Die Die."
             (mm-url-form-encode-xwfu (cdr data))))
    pairs "&"))
 
+(autoload 'mml-compute-boundary "mml")
+
+(defun mm-url-encode-multipart-form-data (pairs &optional boundary)
+  "Return PAIRS encoded in multipart/form-data."
+  ;; RFC1867
+
+  ;; Get a good boundary
+  (unless boundary
+    (setq boundary (mml-compute-boundary '())))
+
+  (concat
+
+   ;; Start with the boundary
+   "--" boundary "\r\n"
+
+   ;; Create name value pairs
+   (mapconcat
+    'identity
+    ;; Delete any returned items that are empty
+    (delq nil
+          (mapcar (lambda (data)
+            (when (car data)
+              ;; For each pair
+              (concat
+
+               ;; Encode the name
+               "Content-Disposition: form-data; name=\""
+               (car data) "\"\r\n"
+               "Content-Type: text/plain; charset=utf-8\r\n"
+               "Content-Transfer-Encoding: binary\r\n\r\n"
+
+               (cond ((stringp (cdr data))
+                      (cdr data))
+                     ((integerp (cdr data))
+                      (int-to-string (cdr data))))
+
+               "\r\n")))
+                  pairs))
+    ;; use the boundary as a separator
+    (concat "--" boundary "\r\n"))
+
+   ;; put a boundary at the end.
+   "--" boundary "--\r\n"))
+
 (defun mm-url-fetch-form (url pairs)
   "Fetch a form from URL with PAIRS as the data using the POST method."
   (mm-url-load-url)
index 8dc232e757297739c116bc9c65a6b441ef99d692..2be5667eea786b4284cb1f948abeecbffc6c91e8 100644 (file)
@@ -566,6 +566,9 @@ is not available."
 ;;;     (eq charset (coding-system-get charset 'mime-charset))
         )
     charset)
+   ;; Use coding system Emacs knows.
+   ((and (fboundp 'coding-system-from-name)
+        (coding-system-from-name charset)))
    ;; Eval expressions from `mm-charset-eval-alist'
    ((let* ((el (assq charset mm-charset-eval-alist))
           (cs (car el))
@@ -677,7 +680,7 @@ superset of iso-8859-1."
   "100% binary coding system.")
 
 (defvar mm-text-coding-system
-  (or (if (memq system-type '(windows-nt ms-dos ms-windows))
+  (or (if (memq system-type '(windows-nt ms-dos))
          (and (mm-coding-system-p 'raw-text-dos) 'raw-text-dos)
        (and (mm-coding-system-p 'raw-text) 'raw-text))
       mm-binary-coding-system)
@@ -689,12 +692,12 @@ superset of iso-8859-1."
 (defvar mm-auto-save-coding-system
   (cond
    ((mm-coding-system-p 'utf-8-emacs)  ; Mule 7
-    (if (memq system-type '(windows-nt ms-dos ms-windows))
+    (if (memq system-type '(windows-nt ms-dos))
        (if (mm-coding-system-p 'utf-8-emacs-dos)
            'utf-8-emacs-dos mm-binary-coding-system)
       'utf-8-emacs))
    ((mm-coding-system-p 'emacs-mule)
-    (if (memq system-type '(windows-nt ms-dos ms-windows))
+    (if (memq system-type '(windows-nt ms-dos))
        (if (mm-coding-system-p 'emacs-mule-dos)
            'emacs-mule-dos mm-binary-coding-system)
       'emacs-mule))
@@ -899,26 +902,20 @@ mail with multiple parts is preferred to sending a Unicode one.")
       out)))
 
 (eval-and-compile
-  (defvar mm-emacs-mule (and (not (featurep 'xemacs))
-                            (boundp 'enable-multibyte-characters)
-                            (default-value 'enable-multibyte-characters)
-                            (fboundp 'set-buffer-multibyte))
-    "True in Emacs with Mule.")
-
-  (if mm-emacs-mule
-      (defun mm-enable-multibyte ()
-       "Set the multibyte flag of the current buffer.
+  (if (featurep 'xemacs)
+      (defalias 'mm-enable-multibyte 'ignore)
+    (defun mm-enable-multibyte ()
+      "Set the multibyte flag of the current buffer.
 Only do this if the default value of `enable-multibyte-characters' is
 non-nil.  This is a no-op in XEmacs."
-       (set-buffer-multibyte 'to))
-    (defalias 'mm-enable-multibyte 'ignore))
+      (set-buffer-multibyte t)))
 
-  (if mm-emacs-mule
-      (defun mm-disable-multibyte ()
-       "Unset the multibyte flag of in the current buffer.
+  (if (featurep 'xemacs)
+      (defalias 'mm-disable-multibyte 'ignore)
+    (defun mm-disable-multibyte ()
+      "Unset the multibyte flag of in the current buffer.
 This is a no-op in XEmacs."
-       (set-buffer-multibyte nil))
-    (defalias 'mm-disable-multibyte 'ignore)))
+      (set-buffer-multibyte nil))))
 
 (defun mm-preferred-coding-system (charset)
   ;; A typo in some Emacs versions.
@@ -1227,28 +1224,23 @@ Use multibyte mode for this."
 
 (defmacro mm-with-unibyte-current-buffer (&rest forms)
   "Evaluate FORMS with current buffer temporarily made unibyte.
-Also bind the default-value of `enable-multibyte-characters' to nil.
-Equivalent to `progn' in XEmacs
-
-NOTE: Use this macro with caution in multibyte buffers (it is not
-worth using this macro in unibyte buffers of course).  Use of
-`(set-buffer-multibyte t)', which is run finally, is generally
-harmful since it is likely to modify existing data in the buffer.
-For instance, it converts \"\\300\\255\" into \"\\255\" in
-Emacs 23 (unicode)."
-  (let ((multibyte (make-symbol "multibyte"))
-       (buffer (make-symbol "buffer")))
-    `(if mm-emacs-mule
-        (let ((,multibyte enable-multibyte-characters)
-              (,buffer (current-buffer)))
-          (unwind-protect
-              (letf (((default-value 'enable-multibyte-characters) nil))
-                (set-buffer-multibyte nil)
-                ,@forms)
-            (set-buffer ,buffer)
-            (set-buffer-multibyte ,multibyte)))
-       (letf (((default-value 'enable-multibyte-characters) nil))
-        ,@forms))))
+Equivalent to `progn' in XEmacs.
+
+Note: We recommend not using this macro any more; there should be
+better ways to do a similar thing.  The previous version of this macro
+bound the default value of `enable-multibyte-characters' to nil while
+evaluating FORMS but it is no longer done.  So, some programs assuming
+it if any may malfunction."
+  (if (featurep 'xemacs)
+      `(progn ,@forms)
+    (let ((multibyte (make-symbol "multibyte")))
+      `(let ((,multibyte enable-multibyte-characters))
+        (when ,multibyte
+          (set-buffer-multibyte nil))
+        (prog1
+            (progn ,@forms)
+          (when ,multibyte
+            (set-buffer-multibyte t)))))))
 (put 'mm-with-unibyte-current-buffer 'lisp-indent-function 0)
 (put 'mm-with-unibyte-current-buffer 'edebug-form-spec '(body))
 
@@ -1557,7 +1549,7 @@ decompressed data.  The buffer's multibyteness must be turned off."
              (error
               (setq err-msg (error-message-string err)))))
          (when (file-exists-p err-file)
-           (ignore-errors (jka-compr-delete-temp-file err-file)))
+           (ignore-errors (delete-file err-file)))
          (when inplace
            (unless err-msg
              (delete-region (point-min) (point-max))
@@ -1590,8 +1582,8 @@ gzip, bzip2, etc. are allowed."
                            filename))
                    (mm-decompress-buffer filename nil t))))
       (when decomp
-       (set-buffer (letf (((default-value 'enable-multibyte-characters) nil))
-                         (generate-new-buffer " *temp*")))
+       (set-buffer (generate-new-buffer " *temp*"))
+        (mm-disable-multibyte)
        (insert decomp)
        (setq filename (file-name-sans-extension filename)))
       (goto-char (point-min))
index 98142298c0481ee409531b4f13fae8be8ee9dde4..41abfcdc9b9a35b249bee6eb0d305182cd4e4f03 100644 (file)
 
 (eval-when-compile (require 'cl))
 
-(if (locate-library "password-cache")
-    (require 'password-cache)
-  (require 'password))
-
 (autoload 'mml2015-sign "mml2015")
 (autoload 'mml2015-encrypt "mml2015")
 (autoload 'mml1991-sign "mml1991")
@@ -109,12 +105,18 @@ details."
   :group 'message
   :type 'boolean)
 
-(defcustom mml-secure-cache-passphrase password-cache
+(defcustom mml-secure-cache-passphrase
+  (if (boundp 'password-cache)
+      password-cache
+    t)
   "If t, cache passphrase."
   :group 'message
   :type 'boolean)
 
-(defcustom mml-secure-passphrase-cache-expiry password-cache-expiry
+(defcustom mml-secure-passphrase-cache-expiry
+  (if (boundp 'password-cache-expiry)
+      password-cache-expiry
+    16)
   "How many seconds the passphrase is cached.
 Whether the passphrase is cached at all is controlled by
 `mml-secure-cache-passphrase'."
@@ -306,11 +308,11 @@ Use METHOD if given.  Else use `mml-secure-method' or
 
 
 (defun mml-secure-message-sign (&optional method)
-  "Add MML tags to sign this MML part.
+  "Add MML tags to sign the entire message.
 Use METHOD if given. Else use `mml-secure-method' or
 `mml-default-sign-method'."
   (interactive)
-  (mml-secure-part
+  (mml-secure-message
    (or method mml-secure-method mml-default-sign-method)
    'sign))
 
index a4541ac5dec32decc7a0b77a192987b2765ffa0b..827003f8ec7f7a5c79d0fb729010f79cc4ec763e 100644 (file)
@@ -520,10 +520,14 @@ Content-Disposition: attachment; filename=smime.p7m
                                           ctl 'protocol)
                                          "application/pkcs7-signature")
                                  t)))
-               (null (setq signature (mm-find-part-by-type
-                                      (cdr handle)
-                                      "application/pkcs7-signature"
-                                      nil t))))
+               (null (setq signature (or (mm-find-part-by-type
+                                          (cdr handle)
+                                          "application/pkcs7-signature"
+                                          nil t)
+                                         (mm-find-part-by-type
+                                          (cdr handle)
+                                          "application/x-pkcs7-signature"
+                                          nil t)))))
        (mm-set-handle-multipart-parameter
         mm-security-handle 'gnus-info "Corrupted")
        (throw 'error handle))
index 091a0ed90bd7b5e0cfa5f4c285835ab981f16f35..15a54a442185d54e34be81f07b342f540ce92f21 100644 (file)
 (require 'mm-decode)
 (require 'mml-sec)
 (eval-when-compile (require 'cl))
+(eval-when-compile
+  (when (featurep 'xemacs)
+    (require 'easy-mmode))) ; for `define-minor-mode'
 
 (autoload 'message-make-message-id "message")
-(autoload 'gnus-setup-posting-charset "gnus-msg")
+(declare-function gnus-setup-posting-charset "gnus-msg" (group))
 (autoload 'gnus-make-local-hook "gnus-util")
 (autoload 'message-fetch-field "message")
 (autoload 'message-mark-active-p "message")
@@ -117,10 +120,10 @@ match found will be used."
                          ,dispositions))))
   :group 'message)
 
-(defcustom mml-insert-mime-headers-always nil
+(defcustom mml-insert-mime-headers-always t
   "If non-nil, always put Content-Type: text/plain at top of empty parts.
 It is necessary to work against a bug in certain clients."
-  :version "22.1"
+  :version "24.1"
   :type 'boolean
   :group 'message)
 
@@ -225,7 +228,10 @@ part.  This is for the internal use, you should never modify the value.")
        (let* (secure-mode
               (taginfo (mml-read-tag))
               (keyfile (cdr (assq 'keyfile taginfo)))
-              (certfile (cdr (assq 'certfile taginfo)))
+              (certfiles (delq nil (mapcar (lambda (tag)
+                                             (if (eq (car-safe tag) 'certfile)
+                                                 (cdr tag)))
+                                           taginfo)))
               (recipients (cdr (assq 'recipients taginfo)))
               (sender (cdr (assq 'sender taginfo)))
               (location (cdr (assq 'tag-location taginfo)))
@@ -251,8 +257,10 @@ part.  This is for the internal use, you should never modify the value.")
                                 ,@tags
                                 ,(if keyfile "keyfile")
                                 ,keyfile
-                                ,(if certfile "certfile")
-                                ,certfile
+                                ,@(apply #'append
+                                         (mapcar (lambda (certfile)
+                                                   (list "certfile" certfile))
+                                                 certfiles))
                                 ,(if recipients "recipients")
                                 ,recipients
                                 ,(if sender "sender")
@@ -392,8 +400,8 @@ A message part needs to be split into %d charset parts.  Really send? "
       (skip-chars-forward "= \t\n")
       (setq val (buffer-substring-no-properties
                 (point) (progn (forward-sexp 1) (point))))
-      (when (string-match "^\"\\(.*\\)\"$" val)
-       (setq val (match-string 1 val)))
+      (when (string-match "\\`\"" val)
+       (setq val (read val))) ;; inverse of prin1 in mml-insert-tag
       (push (cons (intern elem) val) contents)
       (skip-chars-forward " \t\n"))
     (goto-char (match-end 0))
@@ -520,7 +528,10 @@ If MML is non-nil, return the buffer up till the correspondent mml tag."
                          ;; `m-g-d-t' will be bound to "message/rfc822"
                          ;; when encoding an article to be forwarded.
                          (mml-generate-default-type "text/plain"))
-                     (mml-to-mime))
+                     (mml-to-mime)
+                     ;; Update handle so mml-compute-boundary can
+                     ;; detect collisions with the nested parts.
+                     (setcdr (assoc 'contents cont) (buffer-string)))
                    (let ((mm-7bit-chars (concat mm-7bit-chars "\x1b")))
                      ;; ignore 0x1b, it is part of iso-2022-jp
                      (setq encoding (mm-body-7-or-8))))
@@ -699,7 +710,7 @@ If MML is non-nil, return the buffer up till the correspondent mml tag."
 (defun mml-compute-boundary-1 (cont)
   (let (filename)
     (cond
-     ((eq (car cont) 'part)
+     ((member (car cont) '(part mml))
       (with-temp-buffer
        (cond
         ((cdr (assq 'buffer cont))
@@ -898,8 +909,7 @@ If HANDLES is non-nil, use it instead reparsing the buffer."
     ;; Determine type and stuff.
     (unless (stringp (car handle))
       (unless (setq textp (equal (mm-handle-media-supertype handle) "text"))
-       (save-excursion
-         (set-buffer (setq buffer (mml-generate-new-buffer " *mml*")))
+       (with-current-buffer (setq buffer (mml-generate-new-buffer " *mml*"))
          (if (eq (mail-content-type-get (mm-handle-type handle) 'charset)
                  'gnus-decoded)
              ;; A part that mm-uu dissected from a non-MIME message
@@ -1126,25 +1136,18 @@ If HANDLES is non-nil, use it instead reparsing the buffer."
      ,@(if (featurep 'xemacs) '(t)
         '(:help "Display the EasyPG manual"))]))
 
-(defvar mml-mode nil
-  "Minor mode for editing MML.")
-
-(defun mml-mode (&optional arg)
+(define-minor-mode mml-mode
   "Minor mode for editing MML.
 MML is the MIME Meta Language, a minor mode for composing MIME articles.
 See Info node `(emacs-mime)Composing'.
 
 \\{mml-mode-map}"
-  (interactive "P")
-  (when (set (make-local-variable 'mml-mode)
-            (if (null arg) (not mml-mode)
-              (> (prefix-numeric-value arg) 0)))
-    (add-minor-mode 'mml-mode " MML" mml-mode-map)
+  :lighter " MML" :keymap mml-mode-map
+  (when mml-mode
     (easy-menu-add mml-menu mml-mode-map)
     (when (boundp 'dnd-protocol-alist)
       (set (make-local-variable 'dnd-protocol-alist)
-          (append mml-dnd-protocol-alist dnd-protocol-alist)))
-    (run-hooks 'mml-mode-hook)))
+          (append mml-dnd-protocol-alist dnd-protocol-alist)))))
 
 ;;;
 ;;; Helper functions for reading MIME stuff from the minibuffer and
@@ -1173,7 +1176,11 @@ If not set, `default-directory' will be used."
       (error "Permission denied: %s" file))
     file))
 
+(declare-function mailcap-parse-mimetypes "mailcap" (&optional path force))
+(declare-function mailcap-mime-types "mailcap" ())
+
 (defun mml-minibuffer-read-type (name &optional default)
+  (require 'mailcap)
   (mailcap-parse-mimetypes)
   (let* ((default (or default
                      (mm-default-file-encoding name)
@@ -1445,6 +1452,7 @@ or the `pop-to-buffer' function."
   (setq mml-preview-buffer (generate-new-buffer
                            (concat (if raw "*Raw MIME preview of "
                                      "*MIME preview of ") (buffer-name))))
+  (require 'gnus-msg)                ; for gnus-setup-posting-charset
   (save-excursion
     (let* ((buf (current-buffer))
           (message-options message-options)
index c523dccc05564ec8995b6e5d70f57c364a4cb740..3ba479574fd956f2066237eb386bccb92c229014 100644 (file)
 
 ;; For Emacs < 22.2.
 (eval-and-compile
-  (unless (fboundp 'declare-function) (defmacro declare-function (&rest r))))
+  (unless (fboundp 'declare-function) (defmacro declare-function (&rest r)))
+
+  (if (locate-library "password-cache")
+      (require 'password-cache)
+    (require 'password)))
 
 (eval-when-compile
   (require 'cl)
@@ -141,6 +145,7 @@ Whether the passphrase is cached at all is controlled by
       (delete-region (point-min) (point)))
     (mm-with-unibyte-current-buffer
       (with-temp-buffer
+       (inline (mm-disable-multibyte))
        (setq cipher (current-buffer))
        (insert-buffer-substring text)
        (unless (mc-encrypt-generic
@@ -221,6 +226,7 @@ Whether the passphrase is cached at all is controlled by
       (delete-region (point-min) (point)))
     (mm-with-unibyte-current-buffer
       (with-temp-buffer
+       (inline (mm-disable-multibyte))
        (flet ((gpg-encrypt-func
                (sign plaintext ciphertext result recipients &optional
                      passphrase sign-with-key armor textmode)
@@ -329,7 +335,6 @@ Whether the passphrase is cached at all is controlled by
 ;; epg wrapper
 
 (defvar epg-user-id-alist)
-(defvar password-cache-expiry)
 
 (autoload 'epg-make-context "epg")
 (autoload 'epg-passphrase-callback-function "epg")
index 65cf1a8f426c840636c9bbf7c38e5860a653944d..977f4dabb674dcd1a19fbf00e31f4e52d2fb9128 100644 (file)
 
 ;; For Emacs < 22.2.
 (eval-and-compile
-  (unless (fboundp 'declare-function) (defmacro declare-function (&rest r))))
+  (unless (fboundp 'declare-function) (defmacro declare-function (&rest r)))
+
+  (if (locate-library "password-cache")
+      (require 'password-cache)
+    (require 'password)))
 
 (eval-when-compile (require 'cl))
 (require 'mm-decode)
@@ -676,6 +680,7 @@ Whether the passphrase is cached at all is controlled by
        cipher)
     (mm-with-unibyte-current-buffer
       (with-temp-buffer
+       (mm-disable-multibyte)
        ;; set up a function to call the correct gpg encrypt routine
        ;; with the right arguments. (FIXME: this should be done
        ;; differently.)
@@ -986,8 +991,6 @@ Whether the passphrase is cached at all is controlled by
 (autoload 'epg-expand-group "epg-config")
 (autoload 'epa-select-keys "epa")
 
-(defvar password-cache-expiry)
-
 (defvar mml2015-epg-secret-key-id-list nil)
 
 (defun mml2015-epg-passphrase-callback (context key-id ignore)
@@ -1019,6 +1022,7 @@ Whether the passphrase is cached at all is controlled by
       (let ((pointer (epg-key-sub-key-list (car keys))))
        (while pointer
          (if (and (memq usage (epg-sub-key-capability (car pointer)))
+                  (not (memq 'disabled (epg-sub-key-capability (car pointer))))
                   (not (memq (epg-sub-key-validity (car pointer))
                              '(revoked expired))))
              (throw 'found (car keys)))
index 981570cc83fb5edd89d74a2c1fec5a1b9f1cc2e8..375e300a1eb1cfa6f8e93e1ca3d691ab6d19d936 100644 (file)
@@ -741,7 +741,7 @@ from the document.")
        (setq p (1+ (nth 3 blk)))))
     (goto-char begin)
     (while (re-search-forward "\r$" nil t)
-      (delete-backward-char 1))
+      (delete-char -1))
     (when head
       (goto-char begin)
       (when (search-forward "\n\n" nil t)
index f92c47eba044b16a6b8bd619e404e3511fa076ce..2a80d867e5679386be01b257f51899f62602d598 100644 (file)
@@ -28,6 +28,7 @@
 
 (eval-when-compile (require 'cl))
 
+(require 'mailcap)
 (require 'nnheader)
 (require 'nnmail)
 (require 'nnoo)
index f3283022db9cd765429b270aa75190c51185663f..449b32fab02aba42af3955ff1e2a21d6e7e82b74 100644 (file)
@@ -27,6 +27,8 @@
 
 ;;; Code:
 
+(eval-and-compile
+  (unless (fboundp 'declare-function) (defmacro declare-function (&rest r))))
 (eval-when-compile (require 'cl))
 
 (defvar nnmail-extra-headers)
@@ -75,7 +77,7 @@ Integer values will in effect be rounded up to the nearest multiple of
   "*Length of each read operation when trying to fetch HEAD headers.")
 
 (defvar nnheader-read-timeout
-  (if (string-match "windows-nt\\|os/2\\|emx\\|cygwin"
+  (if (string-match "windows-nt\\|os/2\\|cygwin"
                    (symbol-name system-type))
       ;; http://thread.gmane.org/v9655t3pjo.fsf@marauder.physik.uni-ulm.de
       ;;
@@ -100,7 +102,7 @@ Shorter values mean quicker response, but are more CPU intensive.")
 (defvar nnheader-file-name-translation-alist
   (let ((case-fold-search t))
     (cond
-     ((string-match "windows-nt\\|os/2\\|emx\\|cygwin"
+     ((string-match "windows-nt\\|os/2\\|cygwin"
                    (symbol-name system-type))
       (append (mapcar (lambda (c) (cons c ?_))
                      '(?: ?* ?\" ?< ?> ??))
@@ -121,7 +123,6 @@ on your system, you could say something like:
 
 (autoload 'nnmail-message-id "nnmail")
 (autoload 'mail-position-on-field "sendmail")
-(autoload 'message-remove-header "message")
 (autoload 'gnus-buffer-live-p "gnus-util")
 
 ;;; Header access macros.
@@ -662,8 +663,12 @@ the line could be found."
       ;; without inserting extra newline.
       (fill-region-as-paragraph begin (1+ (point))))))
 
+(declare-function message-remove-header "message"
+                 (header &optional is-regexp first reverse))
+
 (defun nnheader-replace-header (header new-value)
   "Remove HEADER and insert the NEW-VALUE."
+  (require 'message)
   (save-excursion
     (save-restriction
       (nnheader-narrow-to-headers)
@@ -781,8 +786,7 @@ If FULL, translate everything."
        ;; We translate -- but only the file name.  We leave the directory
        ;; alone.
        (if (and (featurep 'xemacs)
-                (memq system-type '(cygwin32 win32 w32 mswindows windows-nt
-                                             cygwin)))
+                (memq system-type '(windows-nt cygwin)))
            ;; This is needed on NT and stuff, because
            ;; file-name-nondirectory is not enough to split
            ;; file names, containing ':', e.g.
index 6d97c060a9675cbeafcfceda1af8e269b88b7c1f..b2b1ba61cf6fe9df047b981f0b8faadc6838f0f5 100644 (file)
 
 ;;; Code:
 
+;; For Emacs < 22.2.
+(eval-and-compile
+  (unless (fboundp 'declare-function) (defmacro declare-function (&rest r))))
+
 (require 'imap)
 (require 'nnoo)
 (require 'nnmail)
@@ -497,6 +501,20 @@ See also `nnimap-log'."
 
 ;; Utility functions:
 
+(defsubst nnimap-decode-group-name (group)
+  (and group
+       (gnus-group-decoded-name group)))
+
+(defsubst nnimap-encode-group-name (group)
+  (and group
+       (mm-encode-coding-string group (gnus-group-name-charset nil group))))
+
+(defun nnimap-group-prefixed-name (group &optional server)
+  (gnus-group-prefixed-name group
+                           (gnus-server-to-method
+                            (format "nnimap:%s"
+                                    (or server nnimap-current-server)))))
+
 (defsubst nnimap-get-server-buffer (server)
   "Return buffer for SERVER, if nil use current server."
   (cadr (assoc (or server nnimap-current-server) nnimap-server-buffer-alist)))
@@ -517,9 +535,7 @@ If SERVER is nil, uses the current server."
 
 (defun nnimap-verify-uidvalidity (group server)
   "Verify stored uidvalidity match current one in GROUP on SERVER."
-  (let* ((gnusgroup (gnus-group-prefixed-name
-                    group (gnus-server-to-method
-                           (format "nnimap:%s" server))))
+  (let* ((gnusgroup (nnimap-group-prefixed-name group server))
         (new-uidvalidity (imap-mailbox-get 'uidvalidity))
         (old-uidvalidity (gnus-group-get-parameter gnusgroup 'uidvalidity))
         (dir (file-name-as-directory (expand-file-name nnimap-directory)))
@@ -540,10 +556,18 @@ If SERVER is nil, uses the current server."
     (if old-uidvalidity
        (if (not (equal old-uidvalidity new-uidvalidity))
            ;; uidvalidity clash
-           (gnus-delete-file file)
-         (gnus-group-set-parameter gnusgroup 'uidvalidity new-uidvalidity)
+           (progn
+             (gnus-group-set-parameter gnusgroup 'uidvalidity new-uidvalidity)
+             (gnus-group-remove-parameter gnusgroup 'imap-status)
+             (gnus-sethash (gnus-group-prefixed-name group server)
+                           nil nnimap-mailbox-info)
+             (gnus-delete-file file))
          t)
       (gnus-group-add-parameter gnusgroup (cons 'uidvalidity new-uidvalidity))
+      (gnus-group-remove-parameter gnusgroup 'imap-status)
+      (gnus-sethash                    ; Maybe not necessary here.
+       (gnus-group-prefixed-name group server)
+       nil nnimap-mailbox-info)
       t)))
 
 (defun nnimap-before-find-minmax-bugworkaround ()
@@ -559,36 +583,39 @@ If SERVER is nil, uses the current server."
   "Find lowest and highest active article number in GROUP.
 If EXAMINE is non-nil the group is selected read-only."
   (with-current-buffer nnimap-server-buffer
-    (when (or (string= group (imap-current-mailbox))
-             (imap-mailbox-select group examine))
-      (let (minuid maxuid)
-       (when (> (imap-mailbox-get 'exists) 0)
-         (imap-fetch-safe '("1,*" . "1,*:*") "UID" nil 'nouidfetch)
-         (imap-message-map (lambda (uid Uid)
-                             (setq minuid (if minuid (min minuid uid) uid)
-                                   maxuid (if maxuid (max maxuid uid) uid)))
-                           'UID))
-       (list (imap-mailbox-get 'exists) minuid maxuid)))))
+    (let ((decoded-group (nnimap-decode-group-name group)))
+      (when (or (string= decoded-group (imap-current-mailbox))
+               (imap-mailbox-select decoded-group examine))
+       (let (minuid maxuid)
+         (when (> (imap-mailbox-get 'exists) 0)
+           (imap-fetch-safe '("1,*" . "1,*:*") "UID" nil 'nouidfetch)
+           (imap-message-map (lambda (uid Uid)
+                               (setq minuid (if minuid (min minuid uid) uid)
+                                     maxuid (if maxuid (max maxuid uid) uid)))
+                             'UID))
+         (list (imap-mailbox-get 'exists) minuid maxuid))))))
 
 (defun nnimap-possibly-change-group (group &optional server)
   "Make GROUP the current group, and SERVER the current server."
   (when (nnimap-possibly-change-server server)
-    (with-current-buffer nnimap-server-buffer
-      (if (or (null group) (imap-current-mailbox-p group))
-         imap-current-mailbox
-       (if (imap-mailbox-select group)
-           (if (or (nnimap-verify-uidvalidity
-                    group (or server nnimap-current-server))
-                   (zerop (imap-mailbox-get 'exists group))
-                   t ;; for OGnus to see if ignoring uidvalidity
-                   ;; changes has any bad effects.
-                   (yes-or-no-p
-                    (format
-                     "nnimap: Group %s is not uidvalid.  Continue? " group)))
-               imap-current-mailbox
-             (imap-mailbox-unselect)
-             (error "nnimap: Group %s is not uid-valid" group))
-         (nnheader-report 'nnimap (imap-error-text)))))))
+    (let ((decoded-group (nnimap-decode-group-name group)))
+      (with-current-buffer nnimap-server-buffer
+       (if (or (null group) (imap-current-mailbox-p decoded-group))
+           imap-current-mailbox        ; Note: utf-7 encoded.
+         (if (imap-mailbox-select decoded-group)
+             (if (or (nnimap-verify-uidvalidity
+                      group (or server nnimap-current-server))
+                     (zerop (imap-mailbox-get 'exists decoded-group))
+                     t ;; for OGnus to see if ignoring uidvalidity
+                     ;; changes has any bad effects.
+                     (yes-or-no-p
+                      (format
+                       "nnimap: Group %s is not uidvalid.  Continue? "
+                       decoded-group)))
+                 imap-current-mailbox  ; Note: utf-7 encoded.
+               (imap-mailbox-unselect)
+               (error "nnimap: Group %s is not uid-valid" decoded-group))
+           (nnheader-report 'nnimap (imap-error-text))))))))
 
 (defun nnimap-replace-whitespace (string)
   "Return STRING with all whitespace replaced with space."
@@ -614,7 +641,7 @@ If EXAMINE is non-nil the group is selected read-only."
     (let (headers lines chars uid mbx)
       (with-current-buffer nnimap-server-buffer
        (setq uid imap-current-message
-             mbx imap-current-mailbox
+             mbx (nnimap-encode-group-name (imap-current-mailbox))
              headers (if (imap-capability 'IMAP4rev1)
                           ;; xxx don't just use car? alist doesn't contain
                           ;; anything else now, but it might...
@@ -661,9 +688,7 @@ If EXAMINE is non-nil the group is selected read-only."
   "Make file name for GROUP on SERVER."
   (let* ((dir (file-name-as-directory (expand-file-name nnimap-directory)))
         (uidvalidity (gnus-group-get-parameter
-                      (gnus-group-prefixed-name
-                       group (gnus-server-to-method
-                              (format "nnimap:%s" server)))
+                      (nnimap-group-prefixed-name group server)
                       'uidvalidity))
         (name (nnheader-translate-file-chars
                (concat nnimap-nov-file-name
@@ -789,12 +814,17 @@ If EXAMINE is non-nil the group is selected read-only."
            (nnheader-nov-delete-outside-range low high))))
       'nov)))
 
+(declare-function netrc-parse "netrc" (file))
+(declare-function netrc-machine-user-or-password "netrc"
+                 (mode authinfo-file-or-list machines ports defaults))
+
 (defun nnimap-open-connection (server)
   ;; Note: `nnimap-open-server' that calls this function binds
   ;; `imap-logout-timeout' to `nnimap-logout-timeout'.
   (if (not (imap-open nnimap-address nnimap-server-port nnimap-stream
                      nnimap-authenticator nnimap-server-buffer))
       (nnheader-report 'nnimap "Can't open connection to server %s" server)
+    (require 'netrc)
     (unless (or (imap-capability 'IMAP4 nnimap-server-buffer)
                (imap-capability 'IMAP4rev1 nnimap-server-buffer))
       (imap-close nnimap-server-buffer)
@@ -805,7 +835,7 @@ If EXAMINE is non-nil the group is selected read-only."
           (port (if nnimap-server-port
                     (int-to-string nnimap-server-port)
                   "imap"))
-          (auth-info 
+          (auth-info
            (auth-source-user-or-password '("login" "password") server port))
           (auth-user (nth 0 auth-info))
           (auth-passwd (nth 1 auth-info))
@@ -955,8 +985,10 @@ function is generally only called when Gnus is shutting down."
                     article)))
       (when article
        (gnus-message 10 "nnimap: Fetching (part of) article %d from %s..."
-                     article (or group imap-current-mailbox
-                                 gnus-newsgroup-name))
+                     article (or (nnimap-decode-group-name group)
+                                 (imap-current-mailbox)
+                                 (nnimap-decode-group-name
+                                  gnus-newsgroup-name)))
        (if (not nnheader-callback-function)
            (with-current-buffer (or to-buffer nntp-server-buffer)
              (erase-buffer)
@@ -970,11 +1002,15 @@ function is generally only called when Gnus is shutting down."
              (nnheader-ms-strip-cr)
              (gnus-message
               10 "nnimap: Fetching (part of) article %d from %s...done"
-              article (or group imap-current-mailbox gnus-newsgroup-name))
+              article (or (nnimap-decode-group-name group)
+                          (imap-current-mailbox)
+                          (nnimap-decode-group-name gnus-newsgroup-name)))
              (if (bobp)
                  (nnheader-report 'nnimap "No such article %d in %s: %s"
-                                  article (or group imap-current-mailbox
-                                              gnus-newsgroup-name)
+                                  article (or (nnimap-decode-group-name group)
+                                              (imap-current-mailbox)
+                                              (nnimap-decode-group-name
+                                               gnus-newsgroup-name))
                                   (imap-error-text nnimap-server-buffer))
                (cons group article)))
          (add-hook 'imap-fetch-data-hook
@@ -1011,8 +1047,7 @@ function is generally only called when Gnus is shutting down."
 (deffoo nnimap-request-group (group &optional server fast)
   (nnimap-request-update-info-internal
    group
-   (gnus-get-info (gnus-group-prefixed-name
-                  group (gnus-server-to-method (format "nnimap:%s" server))))
+   (gnus-get-info (nnimap-group-prefixed-name group server))
    server)
   (when (nnimap-possibly-change-group group server)
     (nnimap-before-find-minmax-bugworkaround)
@@ -1035,8 +1070,8 @@ function is generally only called when Gnus is shutting down."
    (let ((old (gnus-gethash-safe (gnus-group-prefixed-name group server)
                                 nnimap-mailbox-info)))
      (list (nth 0 old) (nth 1 old)
-          (imap-mailbox-status group 'unseen nnimap-server-buffer)
-          (nth 3 old)))
+          (imap-mailbox-status (nnimap-decode-group-name group)
+                               'unseen nnimap-server-buffer)))
    nnimap-mailbox-info))
 
 (defun nnimap-close-group (group &optional server)
@@ -1051,7 +1086,7 @@ function is generally only called when Gnus is shutting down."
                    (imap-mailbox-close nnimap-close-asynchronous))))
        (ask (if (and (imap-search "DELETED")
                      (gnus-y-or-n-p (format "Expunge articles in group `%s'? "
-                                            imap-current-mailbox)))
+                                            (imap-current-mailbox))))
                 (progn
                   (imap-mailbox-expunge nnimap-close-asynchronous)
                   (unless nnimap-dont-close
@@ -1080,11 +1115,12 @@ function is generally only called when Gnus is shutting down."
        (dolist (mbx (funcall nnimap-request-list-method
                              (cdr pattern) (car pattern)))
          (or (member "\\NoSelect" (imap-mailbox-get 'list-flags mbx))
-             (let ((info (nnimap-find-minmax-uid mbx 'examine)))
+             (let* ((encoded-mbx (nnimap-encode-group-name mbx))
+                    (info (nnimap-find-minmax-uid encoded-mbx 'examine)))
                (when info
                  (with-current-buffer nntp-server-buffer
                    (insert (format "\"%s\" %d %d y\n"
-                                   mbx (or (nth 2 info) 0)
+                                   encoded-mbx (or (nth 2 info) 0)
                                    (max 1 (or (nth 1 info) 1)))))))))))
     (gnus-message 5 "nnimap: Generating active list%s...done"
                  (if (> (length server) 0) (concat " for " server) ""))
@@ -1134,73 +1170,88 @@ function is generally only called when Gnus is shutting down."
     (with-current-buffer nntp-server-buffer
       (erase-buffer)
       (nnimap-before-find-minmax-bugworkaround)
-      (let (asyncgroups slowgroups)
+      (let (asyncgroups slowgroups decoded-group)
        (if (null nnimap-retrieve-groups-asynchronous)
            (setq slowgroups groups)
          (dolist (group groups)
-           (gnus-message 9 "nnimap: Quickly checking mailbox %s" group)
-           (add-to-list (if (gnus-gethash-safe
-                             (gnus-group-prefixed-name group server)
-                             nnimap-mailbox-info)
+           (setq decoded-group (nnimap-decode-group-name group))
+           (gnus-message 9 "nnimap: Quickly checking mailbox %s"
+                         decoded-group)
+           (add-to-list (if (gnus-group-get-parameter
+                             (nnimap-group-prefixed-name group)
+                             'imap-status)
                             'asyncgroups
                           'slowgroups)
                         (list group (imap-mailbox-status-asynch
-                                     group '(uidvalidity uidnext unseen)
+                                     decoded-group
+                                     '(uidvalidity uidnext unseen)
                                      nnimap-server-buffer))))
          (dolist (asyncgroup asyncgroups)
-           (let ((group (nth 0 asyncgroup))
-                 (tag   (nth 1 asyncgroup))
-                 new old)
+           (let* ((group (nth 0 asyncgroup))
+                  (tag   (nth 1 asyncgroup))
+                  (gnusgroup (nnimap-group-prefixed-name group))
+                  (saved-uidvalidity (gnus-group-get-parameter gnusgroup
+                                                               'uidvalidity))
+                  (saved-imap-status (gnus-group-get-parameter gnusgroup
+                                                               'imap-status))
+                  (saved-info (and saved-imap-status
+                                   (split-string saved-imap-status " "))))
+             (setq decoded-group (nnimap-decode-group-name group))
              (when (imap-ok-p (imap-wait-for-tag tag nnimap-server-buffer))
-               (if (or (not (string=
-                             (nth 0 (gnus-gethash (gnus-group-prefixed-name
-                                                   group server)
-                                                  nnimap-mailbox-info))
-                             (imap-mailbox-get 'uidvalidity group
+               (if (or (not (equal
+                             saved-uidvalidity
+                             (imap-mailbox-get 'uidvalidity decoded-group
                                                nnimap-server-buffer)))
-                       (not (string=
-                             (nth 1 (gnus-gethash (gnus-group-prefixed-name
-                                                   group server)
-                                                  nnimap-mailbox-info))
-                             (imap-mailbox-get 'uidnext group
+                       (not (equal
+                             (nth 0 saved-info)
+                             (imap-mailbox-get 'uidnext decoded-group
                                                nnimap-server-buffer))))
                    (push (list group) slowgroups)
-                 (insert (nth 3 (gnus-gethash (gnus-group-prefixed-name
-                                               group server)
-                                              nnimap-mailbox-info))))))))
+                 (gnus-sethash
+                  (gnus-group-prefixed-name group server)
+                  (list (imap-mailbox-get 'uidvalidity
+                                          decoded-group nnimap-server-buffer)
+                        (imap-mailbox-get 'uidnext
+                                          decoded-group nnimap-server-buffer)
+                        (imap-mailbox-get 'unseen
+                                          decoded-group nnimap-server-buffer))
+                  nnimap-mailbox-info)
+                 (insert (format "\"%s\" %s %s y\n" group
+                                 (nth 2 saved-info)
+                                 (nth 1 saved-info))))))))
        (dolist (group slowgroups)
          (if nnimap-retrieve-groups-asynchronous
              (setq group (car group)))
-         (gnus-message 7 "nnimap: Mailbox %s modified" group)
-         (imap-mailbox-put 'uidnext nil group nnimap-server-buffer)
-         (or (member "\\NoSelect" (imap-mailbox-get 'list-flags group
+         (setq decoded-group (nnimap-decode-group-name group))
+         (gnus-message 7 "nnimap: Mailbox %s modified" decoded-group)
+         (or (member "\\NoSelect" (imap-mailbox-get 'list-flags decoded-group
                                                     nnimap-server-buffer))
-             (let* ((info (nnimap-find-minmax-uid group 'examine))
-                    (str (format "\"%s\" %d %d y\n" group
-                                 (or (nth 2 info) 0)
-                                 (max 1 (or (nth 1 info) 1)))))
-               (when (> (or (imap-mailbox-get 'recent group
+             (let* ((gnusgroup (nnimap-group-prefixed-name group))
+                    (status (imap-mailbox-status
+                             decoded-group '(uidvalidity uidnext unseen)
+                             nnimap-server-buffer))
+                    (info (nnimap-find-minmax-uid group 'examine))
+                    (min-uid (max 1 (or (nth 1 info) 1)))
+                    (max-uid (or (nth 2 info) 0)))
+               (when (> (or (imap-mailbox-get 'recent decoded-group
                                               nnimap-server-buffer) 0)
                         0)
-                 (push (list (cons group 0)) nnmail-split-history))
-               (insert str)
-               (when nnimap-retrieve-groups-asynchronous
-                 (gnus-sethash
-                  (gnus-group-prefixed-name group server)
-                  (list (or (imap-mailbox-get
-                             'uidvalidity group nnimap-server-buffer)
-                            (imap-mailbox-status
-                             group 'uidvalidity nnimap-server-buffer))
-                        (or (imap-mailbox-get
-                             'uidnext group nnimap-server-buffer)
-                            (imap-mailbox-status
-                             group 'uidnext nnimap-server-buffer))
-                        (or (imap-mailbox-get
-                             'unseen group nnimap-server-buffer)
-                            (imap-mailbox-status
-                             group 'unseen nnimap-server-buffer))
-                        str)
-                  nnimap-mailbox-info)))))))
+                 (push (list (cons decoded-group 0)) nnmail-split-history))
+               (insert (format "\"%s\" %d %d y\n" group max-uid min-uid))
+               (gnus-sethash
+                (gnus-group-prefixed-name group server)
+                status
+                nnimap-mailbox-info)
+               (if (not (equal (nth 0 status)
+                               (gnus-group-get-parameter gnusgroup
+                                                         'uidvalidity)))
+                   (nnimap-verify-uidvalidity group nnimap-current-server))
+               ;; The imap-status parameter is a string on the form
+               ;; "<uidnext> <min-uid> <max-uid>".
+               (gnus-group-add-parameter
+                gnusgroup
+                (cons 'imap-status
+                      (format "%s %s %s" (nth 1 status) min-uid max-uid))))))))
     (gnus-message 5 "nnimap: Checking mailboxes...done")
     'active))
 
@@ -1209,7 +1260,7 @@ function is generally only called when Gnus is shutting down."
     (when info ;; xxx what does this mean? should we create a info?
       (with-current-buffer nnimap-server-buffer
        (gnus-message 5 "nnimap: Updating info for %s..."
-                     (gnus-info-group info))
+                     (nnimap-decode-group-name (gnus-info-group info)))
 
        (when (nnimap-mark-permanent-p 'read)
          (let (seen unseen)
@@ -1255,7 +1306,7 @@ function is generally only called when Gnus is shutting down."
           t))
 
        (gnus-message 5 "nnimap: Updating info for %s...done"
-                     (gnus-info-group info))
+                     (nnimap-decode-group-name (gnus-info-group info)))
 
        info))))
 
@@ -1268,7 +1319,8 @@ function is generally only called when Gnus is shutting down."
   (when (nnimap-possibly-change-group group server)
     (with-current-buffer nnimap-server-buffer
       (let (action)
-       (gnus-message 7 "nnimap: Setting marks in %s..." group)
+       (gnus-message 7 "nnimap: Setting marks in %s..."
+                     (nnimap-decode-group-name group))
        (while (setq action (pop actions))
          (let ((range (nth 0 action))
                (what  (nth 1 action))
@@ -1309,7 +1361,8 @@ function is generally only called when Gnus is shutting down."
                     (imap-message-flags-set
                      (imap-range-to-message-set range)
                      (nnimap-mark-to-flag marks nil t)))))))
-       (gnus-message 7 "nnimap: Setting marks in %s...done" group))))
+       (gnus-message 7 "nnimap: Setting marks in %s...done"
+                     (nnimap-decode-group-name group)))))
   nil)
 
 (defun nnimap-split-fancy ()
@@ -1320,6 +1373,7 @@ function is generally only called when Gnus is shutting down."
 (defun nnimap-split-to-groups (rules)
   ;; tries to match all rules in nnimap-split-rule against content of
   ;; nntp-server-buffer, returns a list of groups that matched.
+  ;; Note: This function takes and returns decoded group names.
   (with-current-buffer nntp-server-buffer
     ;; Fold continuation lines.
     (goto-char (point-min))
@@ -1372,12 +1426,16 @@ function is generally only called when Gnus is shutting down."
     (list nnimap-split-inbox)))
 
 (defun nnimap-split-articles (&optional group server)
+  ;; Note: Assumes decoded group names in nnimap-split-inbox,
+  ;; nnimap-split-rule, nnimap-split-fancy, and nnmail-split-history.
   (when (nnimap-possibly-change-server server)
     (with-current-buffer nnimap-server-buffer
-      (let (rule inbox removeorig (inboxes (nnimap-split-find-inbox server)))
+      (let (rule inbox removeorig
+           (inboxes (nnimap-split-find-inbox server)))
        ;; iterate over inboxes
        (while (and (setq inbox (pop inboxes))
-                   (nnimap-possibly-change-group inbox)) ;; SELECT
+                   (nnimap-possibly-change-group
+                    (nnimap-encode-group-name inbox))) ;; SELECT
          ;; find split rule for this server / inbox
          (when (setq rule (nnimap-split-find-rule server inbox))
            ;; iterate over articles
@@ -1406,7 +1464,7 @@ function is generally only called when Gnus is shutting down."
                               (and (setq msgid
                                          (nnmail-fetch-field "message-id"))
                                    (nnmail-cache-insert msgid
-                                                        to-group
+                                                        (nnimap-encode-group-name to-group)
                                                         (nnmail-fetch-field "subject"))))))
                         ;; Add the group-art list to the history list.
                         (push (list (cons to-group 0)) nnmail-split-history))
@@ -1441,18 +1499,19 @@ function is generally only called when Gnus is shutting down."
       (nnimap-before-find-minmax-bugworkaround)
       (dolist (pattern (nnimap-pattern-to-list-arguments
                        nnimap-list-pattern))
-       (dolist (mbx (imap-mailbox-lsub (cdr pattern) (car pattern) nil
-                                       nnimap-server-buffer))
+       (dolist (mbx (funcall nnimap-request-list-method (cdr pattern) (car pattern) nil
+                              nnimap-server-buffer))
          (or (catch 'found
                (dolist (mailbox (imap-mailbox-get 'list-flags mbx
                                                   nnimap-server-buffer))
                  (if (string= (downcase mailbox) "\\noselect")
                      (throw 'found t)))
                nil)
-             (let ((info (nnimap-find-minmax-uid mbx 'examine)))
+             (let* ((encoded-mbx (nnimap-encode-group-name mbx))
+                    (info (nnimap-find-minmax-uid encoded-mbx 'examine)))
                (when info
                  (insert (format "\"%s\" %d %d y\n"
-                                 mbx (or (nth 2 info) 0)
+                                 encoded-mbx (or (nth 2 info) 0)
                                  (max 1 (or (nth 1 info) 1)))))))))
       (gnus-message 5 "nnimap: Listing subscribed mailboxes%s%s...done"
                    (if (> (length server) 0) " on " "") server))
@@ -1460,10 +1519,11 @@ function is generally only called when Gnus is shutting down."
 
 (deffoo nnimap-request-create-group (group &optional server args)
   (when (nnimap-possibly-change-server server)
-    (or (imap-mailbox-status group 'uidvalidity nnimap-server-buffer)
-       (imap-mailbox-create group nnimap-server-buffer)
-       (nnheader-report 'nnimap "%S"
-                        (imap-error-text nnimap-server-buffer)))))
+    (let ((decoded-group (nnimap-decode-group-name group)))
+      (or (imap-mailbox-status decoded-group 'uidvalidity nnimap-server-buffer)
+         (imap-mailbox-create decoded-group nnimap-server-buffer)
+         (nnheader-report 'nnimap "%S"
+                          (imap-error-text nnimap-server-buffer))))))
 
 (defun nnimap-time-substract (time1 time2)
   "Return TIME for TIME1 - TIME2."
@@ -1594,7 +1654,8 @@ function is generally only called when Gnus is shutting down."
                          nnimap-current-move-group)
                         (imap-message-copy (number-to-string
                                             nnimap-current-move-article)
-                                           group 'dontcreate nil
+                                           (nnimap-decode-group-name group)
+                                           'dontcreate nil
                                            nnimap-server-buffer))
                  (with-current-buffer (current-buffer)
                    (goto-char (point-min))
@@ -1614,13 +1675,15 @@ function is generally only called when Gnus is shutting down."
                  ;; this 'or' is for Cyrus server bug
                  (or (null (imap-current-mailbox nnimap-server-buffer))
                      (imap-mailbox-unselect nnimap-server-buffer))
-                 (imap-message-append group (current-buffer) nil nil
+                 (imap-message-append (nnimap-decode-group-name group)
+                                      (current-buffer) nil nil
                                       nnimap-server-buffer)))
          (cons group (nth 1 uid))
        (nnheader-report 'nnimap (imap-error-text nnimap-server-buffer))))))
 
 (deffoo nnimap-request-delete-group (group force &optional server)
   (when (nnimap-possibly-change-server server)
+    (setq group (nnimap-decode-group-name group))
     (when (string= group (imap-current-mailbox nnimap-server-buffer))
       (imap-mailbox-unselect nnimap-server-buffer))
     (with-current-buffer nnimap-server-buffer
@@ -1632,7 +1695,9 @@ function is generally only called when Gnus is shutting down."
 
 (deffoo nnimap-request-rename-group (group new-name &optional server)
   (when (nnimap-possibly-change-server server)
-    (imap-mailbox-rename group new-name nnimap-server-buffer)))
+    (imap-mailbox-rename (nnimap-decode-group-name group)
+                        (nnimap-decode-group-name new-name)
+                        nnimap-server-buffer)))
 
 (defun nnimap-expunge (mailbox server)
   (when (nnimap-possibly-change-group mailbox server)
@@ -1641,7 +1706,8 @@ function is generally only called when Gnus is shutting down."
 (defun nnimap-acl-get (mailbox server)
   (when (nnimap-possibly-change-server server)
     (and (imap-capability 'ACL nnimap-server-buffer)
-        (imap-mailbox-acl-get mailbox nnimap-server-buffer))))
+        (imap-mailbox-acl-get (nnimap-decode-group-name mailbox)
+                              nnimap-server-buffer))))
 
 (defun nnimap-acl-edit (mailbox method old-acls new-acls)
   (when (nnimap-possibly-change-server (cadr method))
@@ -1651,7 +1717,8 @@ function is generally only called when Gnus is shutting down."
       ;; delete all removed identifiers
       (mapc (lambda (old-acl)
              (unless (assoc (car old-acl) new-acls)
-               (or (imap-mailbox-acl-delete (car old-acl) mailbox)
+               (or (imap-mailbox-acl-delete (car old-acl)
+                                            (nnimap-decode-group-name mailbox))
                    (error "Can't delete ACL for %s" (car old-acl)))))
            old-acls)
       ;; set all changed acl's
@@ -1660,7 +1727,8 @@ function is generally only called when Gnus is shutting down."
                    (old-rights (cdr (assoc (car new-acl) old-acls))))
                (unless (and old-rights new-rights
                             (string= old-rights new-rights))
-                 (or (imap-mailbox-acl-set (car new-acl) new-rights mailbox)
+                 (or (imap-mailbox-acl-set (car new-acl) new-rights
+                                           (nnimap-decode-group-name mailbox))
                      (error "Can't set ACL for %s to %s" (car new-acl)
                             new-rights)))))
            new-acls)
index 73f56da7a9fda7cddb3da3378b67bb900570a091..c14d9a1b6aa3c4cd655ba9203e0d5afb681d6772 100644 (file)
 (defvar nnir-imap-search-argument-history ()
   "The history for querying search options in nnir")
 
+(defvar nnir-get-article-nov-override-function nil
+  "If non-nil, a function that will be passed each search result.  This
+should return a message's headers in NOV format.
+
+If this variable is nil, or if the provided function returns nil for a search
+result, `gnus-retrieve-headers' will be called instead.")
+
+
 ;;; Developer Extension Variable:
 
 (defvar nnir-engines
@@ -779,25 +787,31 @@ and show thread that contains this article."
        (nnir-possibly-change-server server)
         (let ((gnus-override-method
               (gnus-server-to-method server)))
-         (case (setq foo (gnus-retrieve-headers (list artno) artfullgroup nil))
-           (nov
-            (goto-char (point-min))
-            (setq novitem (nnheader-parse-nov))
-            (unless novitem
-              (pop-to-buffer nntp-server-buffer)
-              (error
-               "nnheader-parse-nov returned nil for article %s in group %s"
-               artno artfullgroup)))
-           (headers
-            (goto-char (point-min))
-            (setq novitem (nnheader-parse-head))
-            (unless novitem
-              (pop-to-buffer nntp-server-buffer)
-              (error
-               "nnheader-parse-head returned nil for article %s in group %s"
-               artno artfullgroup)))
-           (t (error "Unknown header type %s while requesting article %s of group %s"
-                     foo artno artfullgroup))))
+         ;; if nnir-get-article-nov-override-function is set, use it
+         (if nnir-get-article-nov-override-function
+             (setq novitem (funcall nnir-get-article-nov-override-function
+                                    artitem))
+         ;; else, set novitem through nnheader-parse-nov/nnheader-parse-head
+           (case (setq foo (gnus-retrieve-headers (list artno) 
+                                                  artfullgroup nil))
+             (nov
+              (goto-char (point-min))
+              (setq novitem (nnheader-parse-nov))
+              (unless novitem
+                (pop-to-buffer nntp-server-buffer)
+                (error
+                 "nnheader-parse-nov returned nil for article %s in group %s"
+                 artno artfullgroup)))
+             (headers
+              (goto-char (point-min))
+              (setq novitem (nnheader-parse-head))
+              (unless novitem
+                (pop-to-buffer nntp-server-buffer)
+                (error
+                 "nnheader-parse-head returned nil for article %s in group %s"
+                 artno artfullgroup)))
+             (t (error "Unknown header type %s while requesting article %s of group %s"
+                       foo artno artfullgroup)))))
        ;; replace article number in original group with article number
         ;; in nnir group
         (mail-header-set-number novitem art)
index 8bf0cbf5de10fc0aebd2dca0d9efb593d6671215..456f2d9d518f584609fa67abebfe3153dce6e2fe 100644 (file)
@@ -265,7 +265,7 @@ It scans low-level sorted spools even when not required."
   :type 'function)
 
 (defcustom nnmail-crosspost-link-function
-  (if (string-match "windows-nt\\|emx" (symbol-name system-type))
+  (if (string-match "windows-nt" (symbol-name system-type))
       'copy-file
     'add-name-to-file)
   "*Function called to create a copy of a file.
index fb5fb44113f213e1cc7051f72f4effc72b3bec40..238e0221b97a39ea37e46338fb044b9e30fdae68 100644 (file)
@@ -751,10 +751,9 @@ article number.  This function is called narrowed to an article."
 
 (defun nnml-active-number (group &optional server)
   "Compute the next article number in GROUP on SERVER."
-  (let ((active (cadr (assoc (if nnmail-group-names-not-encoded-p
-                                (nnml-encoded-group-name group server)
-                              group)
-                            nnml-group-alist))))
+  (let* ((encoded (if nnmail-group-names-not-encoded-p
+                     (nnml-encoded-group-name group server)))
+        (active (cadr (assoc (or encoded group) nnml-group-alist))))
     ;; The group wasn't known to nnml, so we just create an active
     ;; entry for it.
     (unless active
@@ -772,7 +771,7 @@ article number.  This function is called narrowed to an article."
                (cons (caar nnml-article-file-alist)
                      (caar (last nnml-article-file-alist)))
              (cons 1 0)))
-      (push (list group active) nnml-group-alist))
+      (push (list (or encoded group) active) nnml-group-alist))
     (setcdr active (1+ (cdr active)))
     (while (file-exists-p
            (nnml-group-pathname group (int-to-string (cdr active)) server))
index 08b621919eb092b9cea1824f3934791ed62ac532..b0f77b09da89097ec238e075b9a580a0090dc1fd 100644 (file)
@@ -498,7 +498,7 @@ nnrss: %s: Not valid XML %s and w3-parse doesn't work %s"
 (defun nnrss-normalize-date (date)
   "Return a date string of DATE in the RFC822 style.
 This function handles the ISO 8601 date format described in
-<URL:http://www.w3.org/TR/NOTE-datetime>, and also the RFC822 style
+URL `http://www.w3.org/TR/NOTE-datetime', and also the RFC822 style
 which RSS 2.0 allows."
   (let (case-fold-search vector year month day time zone cts given)
     (cond ((null date))                        ; do nothing for this case
@@ -682,7 +682,7 @@ which RSS 2.0 allows."
       (rfc2047-encode-region (point-min) (point-max)))
     (goto-char (point-min))
     (while (search-forward "\n" nil t)
-      (delete-backward-char 1))
+      (delete-char -1))
     (buffer-string)))
 
 ;;; Snarf functions
@@ -1012,7 +1012,7 @@ whether they are `offsite' or `onsite'."
 
 (defun nnrss-discover-feed (url)
   "Given a page, find an RSS feed using Mark Pilgrim's
-`ultra-liberal rss locator' (http://diveintomark.org/2002/08/15.html)."
+`ultra-liberal rss locator' (URL `http://diveintomark.org/2002/08/15.html')."
 
   (let ((parsed-page (nnrss-fetch url)))
 
diff --git a/lisp/gnus/nnslashdot.el b/lisp/gnus/nnslashdot.el
deleted file mode 100644 (file)
index 3a0d607..0000000
+++ /dev/null
@@ -1,505 +0,0 @@
-;;; nnslashdot.el --- interfacing with Slashdot
-
-;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
-
-;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
-;; Keywords: news
-
-;; 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:
-
-(eval-when-compile (require 'cl))
-
-(require 'nnoo)
-(require 'message)
-(require 'gnus-util)
-(require 'gnus)
-(require 'nnmail)
-(require 'mm-util)
-(require 'mm-url)
-
-(nnoo-declare nnslashdot)
-
-(defvoo nnslashdot-directory (nnheader-concat gnus-directory "slashdot/")
-  "Where nnslashdot will save its files.")
-
-(defvoo nnslashdot-active-url "http://slashdot.org/search.pl?section=&min=%d"
-  "Where nnslashdot will fetch the active file from.")
-
-(defvoo nnslashdot-comments-url "http://slashdot.org/comments.pl?sid=%s&threshold=%d&commentsort=%d&mode=flat&startat=%d"
-  "Where nnslashdot will fetch comments from.")
-
-(defvoo nnslashdot-article-url
-    "http://slashdot.org/article.pl?sid=%s&mode=nocomment"
-  "Where nnslashdot will fetch the article from.")
-
-(defvoo nnslashdot-backslash-url "http://slashdot.org/slashdot.xml"
-  "Where nnslashdot will fetch the stories from.")
-
-(defvoo nnslashdot-use-front-page nil
-  "Use the front page in addition to the backslash page.")
-
-(defvoo nnslashdot-threshold -1
-  "The article threshold.")
-
-(defvoo nnslashdot-threaded t
-  "Whether the nnslashdot groups should be threaded or not.")
-
-(defvoo nnslashdot-group-number 0
-  "The number of non-fresh groups to keep updated.")
-
-(defvoo nnslashdot-login-name ""
-  "The login name to use when posting.")
-
-(defvoo nnslashdot-password ""
-  "The password to use when posting.")
-
-;;; Internal variables
-
-(defvar nnslashdot-groups nil)
-(defvar nnslashdot-buffer nil)
-(defvar nnslashdot-headers nil)
-
-;;; Interface functions
-
-(nnoo-define-basics nnslashdot)
-
-(deffoo nnslashdot-retrieve-headers (articles &optional group server fetch-old)
-  (nnslashdot-possibly-change-server group server)
-  (condition-case why
-      (unless gnus-nov-is-evil
-       (nnslashdot-retrieve-headers-1 articles group))
-    (search-failed (nnslashdot-lose why))))
-
-(deffoo nnslashdot-retrieve-headers-1 (articles group)
-  (let* ((last (car (last articles)))
-        (start (if nnslashdot-threaded 1 (pop articles)))
-        (entry (assoc group nnslashdot-groups))
-        (sid (nth 2 entry))
-        (first-comments t)
-        headers article subject score from date lines parent point cid
-        s startats changed)
-    (save-excursion
-      (set-buffer nnslashdot-buffer)
-      (let ((case-fold-search t))
-       (erase-buffer)
-       (when (= start 1)
-         (mm-url-insert (format nnslashdot-article-url sid) t)
-         (goto-char (point-min))
-         (if (eobp)
-             (error "Couldn't open connection to slashdot"))
-         (re-search-forward "Posted by[ \t\r\n]+")
-         (when (looking-at "\\(<a[^>]+>\\)?[ \t\r\n]*\\([^<\r\n]+\\)")
-           (setq from (mm-url-decode-entities-string (match-string 2))))
-         (search-forward "on ")
-         (setq date (nnslashdot-date-to-date
-                     (buffer-substring (point) (1- (search-forward "<")))))
-         (setq lines (/ (- (point)
-                           (progn (forward-line 1) (point)))
-                        60))
-         (push
-          (cons
-           1
-           (make-full-mail-header
-            1 group from date
-            (concat "<" sid "%1@slashdot>")
-            "" 0 lines nil nil))
-          headers)
-         (setq start (if nnslashdot-threaded 2 (pop articles))))
-       (while (and start (<= start last))
-         (setq point (goto-char (point-max)))
-         (mm-url-insert
-          (format nnslashdot-comments-url sid
-                  nnslashdot-threshold 0 (- start 2))
-          t)
-         (when (and nnslashdot-threaded first-comments)
-           (setq first-comments nil)
-           (goto-char (point-max))
-           (while (re-search-backward "startat=\\([0-9]+\\)" nil t)
-             (setq s (string-to-number (match-string 1)))
-             (unless (memq s startats)
-               (push s startats)))
-           (setq startats (sort startats '<)))
-         (setq article (if (and article (< start article)) article start))
-         (goto-char point)
-         (while (re-search-forward
-                 "<a name=\"\\([0-9]+\\)\">\\([^<]+\\)\\(?:.*\n\\)\\{2,10\\}.*score:\\([^)]+\\))"
-                 nil t)
-           (setq cid (match-string 1)
-                 subject (match-string 2)
-                 score (match-string 3))
-           (unless (assq article (nth 4 entry))
-             (setcar (nthcdr 4 entry) (cons (cons article cid) (nth 4 entry)))
-             (setq changed t))
-           (when (string-match "^Re: *" subject)
-             (setq subject (concat "Re: " (substring subject (match-end 0)))))
-           (setq subject (mm-url-decode-entities-string subject)
-                 from "")
-           (when (re-search-forward "by[ \t\n]+<[^>]+>\\([^<(]+\\)" nil t)
-             (setq from
-                   (concat
-                    (mm-url-decode-entities-string (match-string 1))
-                    " <nobody@slashdot.org>")))
-           (search-forward "on ")
-           (setq date
-                 (nnslashdot-date-to-date
-                  (buffer-substring
-                   (point) (progn (skip-chars-forward "^()<>\n\r") (point)))))
-           (setq lines (/ (abs (- (search-forward "<div")
-                                  (search-forward "</div>")))
-                          70))
-           (if (not
-                (re-search-forward ".*cid=\\([0-9]+\\)\">Parent</A>" nil t))
-               (setq parent nil)
-             (setq parent (match-string 1))
-             (when (string= parent "0")
-               (setq parent nil)))
-           (push
-            (cons
-             article
-             (make-full-mail-header
-              article
-              (concat subject " (" score ")")
-              from date
-              (concat "<" sid "%" cid "@slashdot>")
-              (if parent
-                  (concat "<" sid "%" parent "@slashdot>")
-                "")
-              0 lines nil nil))
-            headers)
-           (while (and articles (<= (car articles) article))
-             (pop articles))
-           (setq article (1+ article)))
-         (if nnslashdot-threaded
-             (progn
-               (setq start (pop startats))
-               (if start (setq start (+ start 2))))
-           (setq start (pop articles))))))
-    (if changed (nnslashdot-write-groups))
-    (setq nnslashdot-headers (sort headers 'car-less-than-car))
-    (save-excursion
-      (set-buffer nntp-server-buffer)
-      (erase-buffer)
-      (mm-with-unibyte-current-buffer
-       (dolist (header nnslashdot-headers)
-        (nnheader-insert-nov (cdr header)))))
-    'nov))
-
-(deffoo nnslashdot-request-group (group &optional server dont-check)
-  (nnslashdot-possibly-change-server nil server)
-  (let ((elem (assoc group nnslashdot-groups)))
-    (cond
-     ((not elem)
-      (nnheader-report 'nnslashdot "Group does not exist"))
-     (t
-      (nnheader-report 'nnslashdot "Opened group %s" group)
-      (nnheader-insert
-       "211 %d %d %d %s\n" (cadr elem) 1 (cadr elem)
-       (prin1-to-string group))))))
-
-(deffoo nnslashdot-close-group (group &optional server)
-  (nnslashdot-possibly-change-server group server)
-  (when (gnus-buffer-live-p nnslashdot-buffer)
-    (save-excursion
-      (set-buffer nnslashdot-buffer)
-      (kill-buffer nnslashdot-buffer)))
-  t)
-
-(deffoo nnslashdot-request-article (article &optional group server buffer)
-  (nnslashdot-possibly-change-server group server)
-  (let (contents cid)
-    (condition-case why
-       (save-excursion
-         (set-buffer nnslashdot-buffer)
-         (let ((case-fold-search t))
-           (goto-char (point-min))
-           (when (and (stringp article)
-                      (string-match "%\\([0-9]+\\)@" article))
-             (setq cid (match-string 1 article))
-             (let ((map (nth 4 (assoc group nnslashdot-groups))))
-               (while map
-                 (if (equal (cdar map) cid)
-                     (setq article (caar map)
-                           map nil)
-                   (setq map (cdr map))))))
-           (when (numberp article)
-             (if (= article 1)
-                 (progn
-                   (search-forward "Posted by")
-                   (search-forward "<div class=\"intro\">")
-                   (setq contents
-                         (buffer-substring
-                          (point)
-                          (progn
-                            (search-forward "commentwrap")
-                            (match-beginning 0)))))
-               (setq cid (cdr (assq article
-                                    (nth 4 (assoc group nnslashdot-groups)))))
-               (search-forward (format "<a name=\"%s\">" cid))
-               (setq contents
-                     (buffer-substring
-                      (search-forward "<div class=\"commentBody\">")
-                      (progn
-                        (search-forward "<div class=\"commentSub\"")
-                        (match-beginning 0))))))))
-      (search-failed (nnslashdot-lose why)))
-
-    (when contents
-      (save-excursion
-       (set-buffer (or buffer nntp-server-buffer))
-       (erase-buffer)
-       (mm-with-unibyte-current-buffer
-         (insert contents)
-         (goto-char (point-min))
-         (while (re-search-forward "\\(<br>\r?\\)+" nil t)
-           (replace-match "<p>" t t))
-         (goto-char (point-min))
-         (insert "Content-Type: text/html\nMIME-Version: 1.0\n")
-         (insert "Newsgroups: " (caddr (assoc group nnslashdot-groups))
-                 "\n")
-         (let ((header (cdr (assq article nnslashdot-headers))))
-           (nnheader-insert-header header))
-         (nnheader-report 'nnslashdot "Fetched article %s" article))
-       (cons group article)))))
-
-(deffoo nnslashdot-close-server (&optional server)
-  (when (and (nnslashdot-server-opened server)
-            (gnus-buffer-live-p nnslashdot-buffer))
-    (save-excursion
-      (set-buffer nnslashdot-buffer)
-      (kill-buffer nnslashdot-buffer)))
-  (nnoo-close-server 'nnslashdot server))
-
-(deffoo nnslashdot-request-list (&optional server)
-  (nnslashdot-possibly-change-server nil server)
-  (let ((number 0)
-       (first nnslashdot-use-front-page)
-       sid elem description articles gname)
-    (condition-case why
-       ;; First we do the Ultramode to get info on all the latest groups.
-       (progn
-         (mm-with-unibyte-buffer
-           (mm-url-insert nnslashdot-backslash-url t)
-           (goto-char (point-min))
-           (if (eobp)
-               (error "Couldn't open connection to slashdot"))
-           (while (search-forward "<story>" nil t)
-             (narrow-to-region (point) (search-forward "</story>"))
-             (goto-char (point-min))
-             (re-search-forward "<title>\\([^<]+\\)</title>")
-             (setq description
-                   (mm-url-decode-entities-string (match-string 1)))
-             (re-search-forward "<url>\\([^<]+\\)</url>")
-             (setq sid (match-string 1))
-             (string-match "sid=\\([0-9/]+\\)\\(.shtml\\|$\\)" sid)
-             (setq sid (match-string 1 sid))
-             (re-search-forward "<comments>\\([^<]+\\)</comments>")
-             (setq articles (string-to-number (match-string 1)))
-             (setq gname (concat description " (" sid ")"))
-             (if (setq elem (assoc gname nnslashdot-groups))
-                 (setcar (cdr elem) articles)
-               (push (list gname articles sid (current-time) nil)
-                     nnslashdot-groups))
-             (goto-char (point-max))
-             (widen)))
-         ;; Then do the older groups.
-         (while (or first
-                    (> (- nnslashdot-group-number number) 0))
-           (setq first nil)
-           (mm-with-unibyte-buffer
-             (let ((case-fold-search t))
-               (mm-url-insert (format nnslashdot-active-url number) t)
-               (goto-char (point-min))
-               (while (re-search-forward
-                       "article.pl\\?sid=\\([^&]+\\).*>\\([^<]+\\)</a>"
-                       nil t)
-                 (setq sid (match-string 1)
-                       description
-                       (mm-url-decode-entities-string (match-string 2)))
-                 (forward-line 1)
-                 (when (re-search-forward "with \\([0-9]+\\) comment" nil t)
-                   (setq articles (1+ (string-to-number (match-string 1)))))
-                 (setq gname (concat description " (" sid ")"))
-                 (if (setq elem (assoc gname nnslashdot-groups))
-                     (setcar (cdr elem) articles)
-                   (push (list gname articles sid (current-time) nil)
-                         nnslashdot-groups)))))
-           (incf number 30)))
-      (search-failed (nnslashdot-lose why)))
-    (nnslashdot-write-groups)
-    (nnslashdot-generate-active)
-    t))
-
-(deffoo nnslashdot-request-newgroups (date &optional server)
-  (nnslashdot-possibly-change-server nil server)
-  (nnslashdot-generate-active)
-  t)
-
-(deffoo nnslashdot-request-post (&optional server)
-  (nnslashdot-possibly-change-server nil server)
-  (let ((sid (message-fetch-field "newsgroups"))
-       (subject (message-fetch-field "subject"))
-       (references (car (last (split-string
-                               (message-fetch-field "references")))))
-       body quoted pid)
-    (string-match "%\\([0-9]+\\)@slashdot" references)
-    (setq pid (match-string 1 references))
-    (message-goto-body)
-    (narrow-to-region (point) (progn (message-goto-signature) (point)))
-    (goto-char (point-min))
-    (while (not (eobp))
-      (if (looking-at "> ")
-         (progn
-           (delete-region (point) (+ (point) 2))
-           (unless quoted
-             (insert "<blockquote>\n"))
-           (setq quoted t))
-       (when quoted
-         (insert "</blockquote>\n")
-         (setq quoted nil)))
-      (forward-line 1))
-    (goto-char (point-min))
-    (while (re-search-forward "^ *\n" nil t)
-      (replace-match "<p>\n"))
-    (widen)
-    (when (message-goto-signature)
-      (forward-line -1)
-      (insert "<p>\n")
-      (while (not (eobp))
-       (end-of-line)
-       (insert "<br>")
-       (forward-line 1)))
-    (message-goto-body)
-    (setq body (buffer-substring (point) (point-max)))
-    (erase-buffer)
-    (mm-url-fetch-form
-     "http://slashdot.org/comments.pl"
-     `(("sid" . ,sid)
-       ("pid" . ,pid)
-       ("rlogin" . "userlogin")
-       ("unickname" . ,nnslashdot-login-name)
-       ("upasswd" . ,nnslashdot-password)
-       ("postersubj" . ,subject)
-       ("op" . "Submit")
-       ("postercomment" . ,body)
-       ("posttype" . "html")))))
-
-(deffoo nnslashdot-request-delete-group (group &optional force server)
-  (nnslashdot-possibly-change-server group server)
-  (setq nnslashdot-groups (delq (assoc group nnslashdot-groups)
-                               nnslashdot-groups))
-  (nnslashdot-write-groups))
-
-(deffoo nnslashdot-request-close ()
-  (setq nnslashdot-headers nil
-       nnslashdot-groups nil))
-
-(deffoo nnslashdot-request-expire-articles
-    (articles group &optional server force)
-  (nnslashdot-possibly-change-server group server)
-  (let ((item (assoc group nnslashdot-groups)))
-    (when item
-      (if (fourth item)
-         (when (and (>= (length articles) (cadr item)) ;; All are expirable.
-                    (nnmail-expired-article-p
-                     group
-                     (fourth item)
-                     force))
-           (setq nnslashdot-groups (delq item nnslashdot-groups))
-           (nnslashdot-write-groups)
-           (setq articles nil)) ;; all expired.
-       (setcdr (cddr item) (list (current-time)))
-       (nnslashdot-write-groups))))
-  articles)
-
-(nnoo-define-skeleton nnslashdot)
-
-;;; Internal functions
-
-(defun nnslashdot-possibly-change-server (&optional group server)
-  (nnslashdot-init server)
-  (when (and server
-            (not (nnslashdot-server-opened server)))
-    (nnslashdot-open-server server))
-  (unless nnslashdot-groups
-    (nnslashdot-read-groups)))
-
-(defun nnslashdot-make-tuple (tuple n)
-  (prog1
-      tuple
-    (while (> n 1)
-      (unless (cdr tuple)
-       (setcdr tuple (list nil)))
-      (setq tuple (cdr tuple)
-           n (1- n)))))
-
-(defun nnslashdot-read-groups ()
-  (let ((file (expand-file-name "groups" nnslashdot-directory)))
-    (when (file-exists-p file)
-      (mm-with-unibyte-buffer
-       (insert-file-contents file)
-       (goto-char (point-min))
-       (setq nnslashdot-groups (read (current-buffer))))
-      (when (and nnslashdot-groups (< (length (car nnslashdot-groups)) 5))
-       (dolist (group nnslashdot-groups)
-         (nnslashdot-make-tuple group 5))))))
-
-(defun nnslashdot-write-groups ()
-  (with-temp-file (expand-file-name "groups" nnslashdot-directory)
-    (gnus-prin1 nnslashdot-groups)))
-
-(defun nnslashdot-init (server)
-  "Initialize buffers and such."
-  (unless (file-exists-p nnslashdot-directory)
-    (gnus-make-directory nnslashdot-directory))
-  (unless (gnus-buffer-live-p nnslashdot-buffer)
-    (setq nnslashdot-buffer
-         (save-excursion
-           (nnheader-set-temp-buffer
-            (format " *nnslashdot %s*" server))))
-    (push nnslashdot-buffer gnus-buffers)))
-
-(defun nnslashdot-date-to-date (sdate)
-  (condition-case err
-      (let ((elem (delete "" (split-string sdate))))
-       (concat (substring (nth 0 elem) 0 3) " "
-               (substring (nth 1 elem) 0 3) " "
-               (substring (nth 2 elem) 0 2) " "
-               (substring (nth 3 elem) 1 6) " "
-               (format-time-string "%Y") " "
-               (nth 4 elem)))
-    (error "")))
-
-(defun nnslashdot-generate-active ()
-  (save-excursion
-    (set-buffer nntp-server-buffer)
-    (erase-buffer)
-    (dolist (elem nnslashdot-groups)
-      (when (numberp (cadr elem))
-       (insert (prin1-to-string (car elem))
-               " " (number-to-string (cadr elem)) " 1 y\n")))))
-
-(defun nnslashdot-lose (why)
-  (error "Slashdot HTML has changed; please get a new version of nnslashdot"))
-
-(provide 'nnslashdot)
-
-;; arch-tag: aa73df7a-f7e6-4eef-bdea-5ce2f8c691b3
-;;; nnslashdot.el ends here
diff --git a/lisp/gnus/nnsoup.el b/lisp/gnus/nnsoup.el
deleted file mode 100644 (file)
index 3cb4538..0000000
+++ /dev/null
@@ -1,812 +0,0 @@
-;;; nnsoup.el --- SOUP access for Gnus
-
-;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
-;;   2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
-
-;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
-;;     Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
-;; Keywords: news, mail
-
-;; 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 'nnheader)
-(require 'nnmail)
-(require 'gnus-soup)
-(require 'gnus-msg)
-(require 'nnoo)
-(eval-when-compile (require 'cl))
-
-(nnoo-declare nnsoup)
-
-(defvoo nnsoup-directory (nnheader-concat gnus-home-directory "SOUP/")
-  "*SOUP packet directory.")
-
-(defvoo nnsoup-tmp-directory
-    (cond ((fboundp 'temp-directory) (temp-directory))
-         ((boundp 'temporary-file-directory) temporary-file-directory)
-         ("/tmp/"))
-  "*Where nnsoup will store temporary files.")
-
-(defvoo nnsoup-replies-directory (expand-file-name "replies/" nnsoup-directory)
-  "*Directory where outgoing packets will be composed.")
-
-(defvoo nnsoup-replies-format-type ?u  ;; u is USENET news format.
-  "*Format of the replies packages.")
-
-(defvoo nnsoup-replies-index-type ?n
-  "*Index type of the replies packages.")
-
-(defvoo nnsoup-active-file (expand-file-name "active" nnsoup-directory)
-  "Active file.")
-
-(defvoo nnsoup-packer (concat "tar cf - %s | gzip > "
-                             (expand-file-name gnus-home-directory)
-                             "Soupin%d.tgz")
-  "Format string command for packing a SOUP packet.
-The SOUP files will be inserted where the %s is in the string.
-This string MUST contain both %s and %d.  The file number will be
-inserted where %d appears.")
-
-(defvoo nnsoup-unpacker "gunzip -c %s | tar xvf -"
-  "*Format string command for unpacking a SOUP packet.
-The SOUP packet file name will be inserted at the %s.")
-
-(defvoo nnsoup-packet-directory gnus-home-directory
-  "*Where nnsoup will look for incoming packets.")
-
-(defvoo nnsoup-packet-regexp "Soupout"
-  "*Regular expression matching SOUP packets in `nnsoup-packet-directory'.")
-
-(defvoo nnsoup-always-save t
-  "If non-nil commit the reply buffer on each message send.
-This is necessary if using message mode outside Gnus with nnsoup as a
-backend for the messages.")
-
-\f
-
-(defconst nnsoup-version "nnsoup 0.0"
-  "nnsoup version.")
-
-(defvoo nnsoup-status-string "")
-(defvoo nnsoup-group-alist nil)
-(defvoo nnsoup-current-prefix 0)
-(defvoo nnsoup-replies-list nil)
-(defvoo nnsoup-buffers nil)
-(defvoo nnsoup-current-group nil)
-(defvoo nnsoup-group-alist-touched nil)
-(defvoo nnsoup-article-alist nil)
-\f
-
-;;; Interface functions.
-
-(nnoo-define-basics nnsoup)
-
-(deffoo nnsoup-retrieve-headers (sequence &optional group server fetch-old)
-  (nnsoup-possibly-change-group group)
-  (save-excursion
-    (set-buffer nntp-server-buffer)
-    (erase-buffer)
-    (let ((areas (cddr (assoc nnsoup-current-group nnsoup-group-alist)))
-         (articles sequence)
-         (use-nov t)
-         useful-areas this-area-seq msg-buf)
-      (if (stringp (car sequence))
-         ;; We don't support fetching by Message-ID.
-         'headers
-       ;; We go through all the areas and find which files the
-       ;; articles in SEQUENCE come from.
-       (while (and areas sequence)
-         ;; Peel off areas that are below sequence.
-         (while (and areas (< (cdar (car areas)) (car sequence)))
-           (setq areas (cdr areas)))
-         (when areas
-           ;; This is a useful area.
-           (push (car areas) useful-areas)
-           (setq this-area-seq nil)
-           ;; We take note whether this MSG has a corresponding IDX
-           ;; for later use.
-           (when (or (= (gnus-soup-encoding-index
-                         (gnus-soup-area-encoding (nth 1 (car areas)))) ?n)
-                     (not (file-exists-p
-                           (nnsoup-file
-                            (gnus-soup-area-prefix (nth 1 (car areas)))))))
-             (setq use-nov nil))
-           ;; We assign the portion of `sequence' that is relevant to
-           ;; this MSG packet to this packet.
-           (while (and sequence (<= (car sequence) (cdar (car areas))))
-             (push (car sequence) this-area-seq)
-             (setq sequence (cdr sequence)))
-           (setcar useful-areas (cons (nreverse this-area-seq)
-                                      (car useful-areas)))))
-
-       ;; We now have a list of article numbers and corresponding
-       ;; areas.
-       (setq useful-areas (nreverse useful-areas))
-
-       ;; Two different approaches depending on whether all the MSG
-       ;; files have corresponding IDX files.  If they all do, we
-       ;; simply return the relevant IDX files and let Gnus sort out
-       ;; what lines are relevant.  If some of the IDX files are
-       ;; missing, we must return HEADs for all the articles.
-       (if use-nov
-           ;; We have IDX files for all areas.
-           (progn
-             (while useful-areas
-               (goto-char (point-max))
-               (let ((b (point))
-                     (number (car (nth 1 (car useful-areas))))
-                     (index-buffer (nnsoup-index-buffer
-                                    (gnus-soup-area-prefix
-                                     (nth 2 (car useful-areas))))))
-                 (when index-buffer
-                   (insert-buffer-substring index-buffer)
-                   (goto-char b)
-                   ;; We have to remove the index number entries and
-                   ;; insert article numbers instead.
-                   (while (looking-at "[0-9]+")
-                     (replace-match (int-to-string number) t t)
-                     (incf number)
-                     (forward-line 1))))
-               (setq useful-areas (cdr useful-areas)))
-             'nov)
-         ;; We insert HEADs.
-         (while useful-areas
-           (setq articles (caar useful-areas)
-                 useful-areas (cdr useful-areas))
-           (while articles
-             (when (setq msg-buf
-                         (nnsoup-narrow-to-article
-                          (car articles) (cdar useful-areas) 'head))
-               (goto-char (point-max))
-               (insert (format "221 %d Article retrieved.\n" (car articles)))
-               (insert-buffer-substring msg-buf)
-               (goto-char (point-max))
-               (insert ".\n"))
-             (setq articles (cdr articles))))
-
-         (nnheader-fold-continuation-lines)
-         'headers)))))
-
-(deffoo nnsoup-open-server (server &optional defs)
-  (nnoo-change-server 'nnsoup server defs)
-  (when (not (file-exists-p nnsoup-directory))
-    (condition-case ()
-       (make-directory nnsoup-directory t)
-      (error t)))
-  (cond
-   ((not (file-exists-p nnsoup-directory))
-    (nnsoup-close-server)
-    (nnheader-report 'nnsoup "Couldn't create directory: %s" nnsoup-directory))
-   ((not (file-directory-p (file-truename nnsoup-directory)))
-    (nnsoup-close-server)
-    (nnheader-report 'nnsoup "Not a directory: %s" nnsoup-directory))
-   (t
-    (nnsoup-read-active-file)
-    (nnheader-report 'nnsoup "Opened server %s using directory %s"
-                    server nnsoup-directory)
-    t)))
-
-(deffoo nnsoup-request-close ()
-  (nnsoup-write-active-file)
-  (nnsoup-write-replies)
-  (gnus-soup-save-areas)
-  ;; Kill all nnsoup buffers.
-  (let (buffer)
-    (while nnsoup-buffers
-      (setq buffer (cdr (pop nnsoup-buffers)))
-      (and buffer
-          (buffer-name buffer)
-          (kill-buffer buffer))))
-  (setq nnsoup-group-alist nil
-       nnsoup-group-alist-touched nil
-       nnsoup-current-group nil
-       nnsoup-replies-list nil)
-  (nnoo-close-server 'nnoo)
-  t)
-
-(deffoo nnsoup-request-article (id &optional newsgroup server buffer)
-  (nnsoup-possibly-change-group newsgroup)
-  (let (buf)
-    (save-excursion
-      (set-buffer (or buffer nntp-server-buffer))
-      (erase-buffer)
-      (when (and (not (stringp id))
-                (setq buf (nnsoup-narrow-to-article id)))
-       (insert-buffer-substring buf)
-       t))))
-
-(deffoo nnsoup-request-group (group &optional server dont-check)
-  (nnsoup-possibly-change-group group)
-  (if dont-check
-      t
-    (let ((active (cadr (assoc group nnsoup-group-alist))))
-      (if (not active)
-         (nnheader-report 'nnsoup "No such group: %s" group)
-       (nnheader-insert
-        "211 %d %d %d %s\n"
-        (max (1+ (- (cdr active) (car active))) 0)
-        (car active) (cdr active) group)))))
-
-(deffoo nnsoup-request-type (group &optional article)
-  (nnsoup-possibly-change-group group)
-  ;; Try to guess the type based on the first article in the group.
-  (when (not article)
-    (setq article
-         (cdar (car (cddr (assoc group nnsoup-group-alist))))))
-  (if (not article)
-      'unknown
-    (let ((kind (gnus-soup-encoding-kind
-                (gnus-soup-area-encoding
-                 (nth 1 (nnsoup-article-to-area
-                         article nnsoup-current-group))))))
-      (cond ((= kind ?m) 'mail)
-           ((= kind ?n) 'news)
-           (t 'unknown)))))
-
-(deffoo nnsoup-close-group (group &optional server)
-  ;; Kill all nnsoup buffers.
-  (let ((buffers nnsoup-buffers)
-       elem)
-    (while buffers
-      (when (equal (car (setq elem (pop buffers))) group)
-       (setq nnsoup-buffers (delq elem nnsoup-buffers))
-       (and (cdr elem) (buffer-name (cdr elem))
-            (kill-buffer (cdr elem))))))
-  t)
-
-(deffoo nnsoup-request-list (&optional server)
-  (save-excursion
-    (set-buffer nntp-server-buffer)
-    (erase-buffer)
-    (unless nnsoup-group-alist
-      (nnsoup-read-active-file))
-    (let ((alist nnsoup-group-alist)
-         (standard-output (current-buffer))
-         entry)
-      (while (setq entry (pop alist))
-       (insert (car entry) " ")
-       (princ (cdadr entry))
-       (insert " ")
-       (princ (caadr entry))
-       (insert " y\n"))
-      t)))
-
-(deffoo nnsoup-request-scan (group &optional server)
-  (nnsoup-unpack-packets))
-
-(deffoo nnsoup-request-newgroups (date &optional server)
-  (nnsoup-request-list))
-
-(deffoo nnsoup-request-list-newsgroups (&optional server)
-  nil)
-
-(deffoo nnsoup-request-post (&optional server)
-  (nnsoup-store-reply "news")
-  t)
-
-(deffoo nnsoup-request-mail (&optional server)
-  (nnsoup-store-reply "mail")
-  t)
-
-(deffoo nnsoup-request-expire-articles (articles group &optional server force)
-  (nnsoup-possibly-change-group group)
-  (let* ((total-infolist (assoc group nnsoup-group-alist))
-        (active (cadr total-infolist))
-        (infolist (cddr total-infolist))
-        info range-list mod-time prefix)
-    (while infolist
-      (setq info (pop infolist)
-           range-list (gnus-uncompress-range (car info))
-           prefix (gnus-soup-area-prefix (nth 1 info)))
-      (when;; All the articles in this file are marked for expiry.
-         (and (or (setq mod-time (nth 5 (file-attributes
-                                         (nnsoup-file prefix))))
-                  (setq mod-time (nth 5 (file-attributes
-                                         (nnsoup-file prefix t)))))
-              (gnus-sublist-p articles range-list)
-              ;; This file is old enough.
-              (nnmail-expired-article-p group mod-time force))
-       ;; Ok, we delete this file.
-       (when (ignore-errors
-               (nnheader-message
-                5 "Deleting %s in group %s..." (nnsoup-file prefix)
-                group)
-               (when (file-exists-p (nnsoup-file prefix))
-                 (delete-file (nnsoup-file prefix)))
-               (nnheader-message
-                5 "Deleting %s in group %s..." (nnsoup-file prefix t)
-                group)
-               (when (file-exists-p (nnsoup-file prefix t))
-                 (delete-file (nnsoup-file prefix t)))
-               t)
-         (setcdr (cdr total-infolist) (delq info (cddr total-infolist)))
-         (setq articles (gnus-sorted-difference articles range-list))))
-      (when (not mod-time)
-       (setcdr (cdr total-infolist) (delq info (cddr total-infolist)))))
-    (if (cddr total-infolist)
-       (setcar active (caaadr (cdr total-infolist)))
-      (setcar active (1+ (cdr active))))
-    (nnsoup-write-active-file t)
-    ;; Return the articles that weren't expired.
-    articles))
-
-\f
-;;; Internal functions
-
-(defun nnsoup-possibly-change-group (group &optional force)
-  (when (and group
-            (not (equal nnsoup-current-group group)))
-    (setq nnsoup-article-alist nil)
-    (setq nnsoup-current-group group))
-  t)
-
-(defun nnsoup-read-active-file ()
-  (setq nnsoup-group-alist nil)
-  (when (file-exists-p nnsoup-active-file)
-    (ignore-errors
-      (load nnsoup-active-file t t t))
-    ;; Be backwards compatible.
-    (when (and nnsoup-group-alist
-              (not (atom (caadar nnsoup-group-alist))))
-      (let ((alist nnsoup-group-alist)
-           entry e min max)
-       (while (setq e (cdr (setq entry (pop alist))))
-         (setq min (caaar e))
-         (setq max (cdar (car (last e))))
-         (setcdr entry (cons (cons min max) (cdr entry)))))
-      (setq nnsoup-group-alist-touched t))
-    nnsoup-group-alist))
-
-(defun nnsoup-write-active-file (&optional force)
-  (when (and nnsoup-group-alist
-            (or force
-                nnsoup-group-alist-touched))
-    (setq nnsoup-group-alist-touched nil)
-    (with-temp-file nnsoup-active-file
-      (gnus-prin1 `(setq nnsoup-group-alist ',nnsoup-group-alist))
-      (insert "\n")
-      (gnus-prin1 `(setq nnsoup-current-prefix ,nnsoup-current-prefix))
-      (insert "\n"))))
-
-(defun nnsoup-next-prefix ()
-  "Return the next free prefix."
-  (let (prefix)
-    (while (or (file-exists-p
-               (nnsoup-file (setq prefix (int-to-string
-                                          nnsoup-current-prefix))))
-              (file-exists-p (nnsoup-file prefix t)))
-      (incf nnsoup-current-prefix))
-    (incf nnsoup-current-prefix)
-    prefix))
-
-(defun nnsoup-file-name (dir file)
-  "Return the full name of FILE (in any case) in DIR."
-  (let* ((case-fold-search t)
-        (files (directory-files dir t))
-        (regexp (concat (regexp-quote file) "$")))
-    (car (delq nil
-              (mapcar
-               (lambda (file)
-                 (if (string-match regexp file)
-                     file
-                   nil))
-               files)))))
-
-(defun nnsoup-read-areas ()
-  (let ((areas-file (nnsoup-file-name nnsoup-tmp-directory "areas")))
-    (when areas-file
-      (save-excursion
-       (set-buffer nntp-server-buffer)
-       (let ((areas (gnus-soup-parse-areas areas-file))
-             entry number area lnum cur-prefix file)
-         ;; Go through all areas in the new AREAS file.
-         (while (setq area (pop areas))
-           ;; Change the name to the permanent name and move the files.
-           (setq cur-prefix (nnsoup-next-prefix))
-           (nnheader-message 5 "Incorporating file %s..." cur-prefix)
-           (when (file-exists-p
-                  (setq file
-                        (expand-file-name
-                         (concat (gnus-soup-area-prefix area) ".IDX")
-                         nnsoup-tmp-directory)))
-             (rename-file file (nnsoup-file cur-prefix)))
-           (when (file-exists-p
-                  (setq file (expand-file-name
-                              (concat (gnus-soup-area-prefix area) ".MSG")
-                              nnsoup-tmp-directory)))
-             (rename-file file (nnsoup-file cur-prefix t))
-             (gnus-soup-set-area-prefix area cur-prefix)
-             ;; Find the number of new articles in this area.
-             (setq number (nnsoup-number-of-articles area))
-             (if (not (setq entry (assoc (gnus-soup-area-name area)
-                                         nnsoup-group-alist)))
-                 ;; If this is a new area (group), we just add this info to
-                 ;; the group alist.
-                 (push (list (gnus-soup-area-name area)
-                             (cons 1 number)
-                             (list (cons 1 number) area))
-                       nnsoup-group-alist)
-               ;; There are already articles in this group, so we add this
-               ;; info to the end of the entry.
-               (nconc entry (list (list (cons (1+ (setq lnum (cdadr entry)))
-                                              (+ lnum number))
-                                        area)))
-               (setcdr (cadr entry) (+ lnum number))))))
-       (nnsoup-write-active-file t)
-       (delete-file areas-file)))))
-
-(defun nnsoup-number-of-articles (area)
-  (save-excursion
-    (cond
-     ;; If the number is in the area info, we just return it.
-     ((gnus-soup-area-number area)
-      (gnus-soup-area-number area))
-     ;; If there is an index file, we just count the lines.
-     ((/= (gnus-soup-encoding-index (gnus-soup-area-encoding area)) ?n)
-      (set-buffer (nnsoup-index-buffer (gnus-soup-area-prefix area)))
-      (count-lines (point-min) (point-max)))
-     ;; We do it the hard way - re-searching through the message
-     ;; buffer.
-     (t
-      (set-buffer (nnsoup-message-buffer (gnus-soup-area-prefix area)))
-      (unless (assoc (gnus-soup-area-prefix area) nnsoup-article-alist)
-       (nnsoup-dissect-buffer area))
-      (length (cdr (assoc (gnus-soup-area-prefix area)
-                         nnsoup-article-alist)))))))
-
-(defun nnsoup-dissect-buffer (area)
-  (let ((mbox-delim (concat "^" message-unix-mail-delimiter))
-       (format (gnus-soup-encoding-format (gnus-soup-area-encoding area)))
-       (i 0)
-       alist len)
-    (goto-char (point-min))
-    (cond
-     ;; rnews batch format
-     ((or (= format ?u)
-         (= format ?n)) ;; Gnus back compatibility.
-      (while (looking-at "^#! *rnews \\(+[0-9]+\\) *$")
-       (forward-line 1)
-       (push (list
-              (incf i) (point)
-              (progn
-                (forward-char (string-to-number (match-string 1)))
-                (point)))
-             alist)))
-     ;; Unix mbox format
-     ((= format ?m)
-      (while (looking-at mbox-delim)
-       (forward-line 1)
-       (push (list
-              (incf i) (point)
-              (progn
-                (if (re-search-forward mbox-delim nil t)
-                    (beginning-of-line)
-                  (goto-char (point-max)))
-                (point)))
-             alist)))
-     ;; MMDF format
-     ((= format ?M)
-      (while (looking-at "\^A\^A\^A\^A\n")
-       (forward-line 1)
-       (push (list
-              (incf i) (point)
-              (progn
-                (if (search-forward "\n\^A\^A\^A\^A\n" nil t)
-                    (beginning-of-line)
-                  (goto-char (point-max)))
-                (point)))
-             alist)))
-     ;; Binary format
-     ((or (= format ?B) (= format ?b))
-      (while (not (eobp))
-       (setq len (+ (* (char-after (point)) (expt 2.0 24))
-                    (* (char-after (+ (point) 1)) (expt 2 16))
-                    (* (char-after (+ (point) 2)) (expt 2 8))
-                    (char-after (+ (point) 3))))
-       (push (list
-              (incf i) (+ (point) 4)
-              (progn
-                (forward-char (floor (+ len 4)))
-                (point)))
-             alist)))
-     (t
-      (error "Unknown format: %c" format)))
-    (push (cons (gnus-soup-area-prefix area) alist) nnsoup-article-alist)))
-
-(defun nnsoup-index-buffer (prefix &optional message)
-  (let* ((file (concat prefix (if message ".MSG" ".IDX")))
-        (buffer-name (concat " *nnsoup " file "*")))
-    (or (get-buffer buffer-name)       ; File already loaded.
-       (when (file-exists-p (expand-file-name file nnsoup-directory))
-         (save-excursion               ; Load the file.
-           (set-buffer (get-buffer-create buffer-name))
-           (buffer-disable-undo)
-           (push (cons nnsoup-current-group (current-buffer)) nnsoup-buffers)
-           (nnheader-insert-file-contents
-            (expand-file-name file nnsoup-directory))
-           (current-buffer))))))
-
-(defun nnsoup-file (prefix &optional message)
-  (expand-file-name
-   (concat prefix (if message ".MSG" ".IDX"))
-   nnsoup-directory))
-
-(defun nnsoup-message-buffer (prefix)
-  (nnsoup-index-buffer prefix 'msg))
-
-(defun nnsoup-unpack-packets ()
-  "Unpack all packets in `nnsoup-packet-directory'."
-  (let ((packets (directory-files
-                 nnsoup-packet-directory t nnsoup-packet-regexp)))
-    (dolist (packet packets)
-      (nnheader-message 5 "nnsoup: unpacking %s..." packet)
-      (if (not (gnus-soup-unpack-packet
-               nnsoup-tmp-directory nnsoup-unpacker packet))
-         (nnheader-message 5 "Couldn't unpack %s" packet)
-       (delete-file packet)
-       (nnsoup-read-areas)
-       (nnheader-message 5 "Unpacking...done")))))
-
-(defun nnsoup-narrow-to-article (article &optional area head)
-  (let* ((area (or area (nnsoup-article-to-area article nnsoup-current-group)))
-        (prefix (and area (gnus-soup-area-prefix (nth 1 area))))
-        (msg-buf (and prefix (nnsoup-index-buffer prefix 'msg)))
-        beg end)
-    (when area
-      (save-excursion
-       (cond
-        ;; There is no MSG file.
-        ((null msg-buf)
-         nil)
-        ;; We use the index file to find out where the article
-        ;; begins and ends.
-        ((and (= (gnus-soup-encoding-index
-                  (gnus-soup-area-encoding (nth 1 area)))
-                 ?c)
-              (file-exists-p (nnsoup-file prefix)))
-         (set-buffer (nnsoup-index-buffer prefix))
-         (widen)
-         (goto-char (point-min))
-         (forward-line (- article (caar area)))
-         (setq beg (read (current-buffer)))
-         (forward-line 1)
-         (if (looking-at "[0-9]+")
-             (progn
-               (setq end (read (current-buffer)))
-               (set-buffer msg-buf)
-               (widen)
-               (let ((format (gnus-soup-encoding-format
-                              (gnus-soup-area-encoding (nth 1 area)))))
-                 (goto-char end)
-                 (when (or (= format ?u) (= format ?n) (= format ?m))
-                   (setq end (progn (forward-line -1) (point))))))
-           (set-buffer msg-buf))
-         (widen)
-         (narrow-to-region beg (or end (point-max))))
-        (t
-         (set-buffer msg-buf)
-         (widen)
-         (unless (assoc (gnus-soup-area-prefix (nth 1 area))
-                        nnsoup-article-alist)
-           (nnsoup-dissect-buffer (nth 1 area)))
-         (let ((entry (assq article (cdr (assoc (gnus-soup-area-prefix
-                                                 (nth 1 area))
-                                                nnsoup-article-alist)))))
-           (when entry
-             (narrow-to-region (cadr entry) (caddr entry))))))
-       (goto-char (point-min))
-       (if (not head)
-           ()
-         (narrow-to-region
-          (point-min)
-          (if (search-forward "\n\n" nil t)
-              (1- (point))
-            (point-max))))
-       msg-buf))))
-
-;;;###autoload
-(defun nnsoup-pack-replies ()
-  "Make an outbound package of SOUP replies."
-  (interactive)
-  (unless (file-exists-p nnsoup-replies-directory)
-    (nnheader-message 5 "No such directory: %s" nnsoup-replies-directory))
-  ;; Write all data buffers.
-  (gnus-soup-save-areas)
-  ;; Write the active file.
-  (nnsoup-write-active-file)
-  ;; Write the REPLIES file.
-  (nnsoup-write-replies)
-  ;; Check whether there is anything here.
-  (when (null (directory-files nnsoup-replies-directory nil "\\.MSG$"))
-    (error "No files to pack"))
-  ;; Pack all these files into a SOUP packet.
-  (gnus-soup-pack nnsoup-replies-directory nnsoup-packer))
-
-(defun nnsoup-write-replies ()
-  "Write the REPLIES file."
-  (when nnsoup-replies-list
-    (gnus-soup-write-replies nnsoup-replies-directory nnsoup-replies-list)
-    (setq nnsoup-replies-list nil)))
-
-(defun nnsoup-article-to-area (article group)
-  "Return the area that ARTICLE in GROUP is located in."
-  (let ((areas (cddr (assoc group nnsoup-group-alist))))
-    (while (and areas (< (cdar (car areas)) article))
-      (setq areas (cdr areas)))
-    (and areas (car areas))))
-
-(defvar nnsoup-old-functions
-  (list message-send-mail-real-function message-send-news-function))
-
-;;;###autoload
-(defun nnsoup-set-variables ()
-  "Use the SOUP methods for posting news and mailing mail."
-  (interactive)
-  (setq message-send-news-function 'nnsoup-request-post)
-  (setq message-send-mail-real-function 'nnsoup-request-mail))
-
-;;;###autoload
-(defun nnsoup-revert-variables ()
-  "Revert posting and mailing methods to the standard Emacs methods."
-  (interactive)
-  (setq message-send-mail-real-function (car nnsoup-old-functions))
-  (setq message-send-news-function (cadr nnsoup-old-functions)))
-
-(defun nnsoup-store-reply (kind)
-  ;; Mostly stolen from `message.el'.
-  (require 'mail-utils)
-  (let ((tembuf (generate-new-buffer " message temp"))
-       (case-fold-search nil)
-       delimline
-       (mailbuf (current-buffer)))
-    (unwind-protect
-       (save-excursion
-         (save-restriction
-           (message-narrow-to-headers)
-           (if (equal kind "mail")
-               (message-generate-headers message-required-mail-headers)
-             (message-generate-headers message-required-news-headers)))
-         (set-buffer tembuf)
-         (erase-buffer)
-         (insert-buffer-substring mailbuf)
-         ;; Remove some headers.
-         (save-restriction
-           (message-narrow-to-headers)
-           ;; Remove some headers.
-           (message-remove-header message-ignored-mail-headers t))
-         (goto-char (point-max))
-         ;; require one newline at the end.
-         (or (= (preceding-char) ?\n)
-             (insert ?\n))
-         (let ((case-fold-search t))
-           ;; Change header-delimiter to be what sendmail expects.
-           (goto-char (point-min))
-           (re-search-forward
-            (concat "^" (regexp-quote mail-header-separator) "\n"))
-           (replace-match "\n")
-           (backward-char 1)
-           (setq delimline (point-marker))
-           (goto-char (1+ delimline))
-           (let ((msg-buf
-                  (gnus-soup-store
-                   nnsoup-replies-directory
-                   (nnsoup-kind-to-prefix kind) nil nnsoup-replies-format-type
-                   nnsoup-replies-index-type))
-                 (num 0))
-             (when (and msg-buf (bufferp msg-buf))
-               (save-excursion
-                 (set-buffer msg-buf)
-                 (goto-char (point-min))
-                 (while (re-search-forward "^#! *rnews" nil t)
-                   (incf num))
-                 (when nnsoup-always-save
-                   (save-buffer)))
-               (nnheader-message 5 "Stored %d messages" num)))
-           (nnsoup-write-replies)
-           (kill-buffer tembuf))))))
-
-(defun nnsoup-kind-to-prefix (kind)
-  (unless nnsoup-replies-list
-    (setq nnsoup-replies-list
-         (gnus-soup-parse-replies
-          (expand-file-name "REPLIES" nnsoup-replies-directory))))
-  (let ((replies nnsoup-replies-list))
-    (while (and replies
-               (not (string= kind (gnus-soup-reply-kind (car replies)))))
-      (setq replies (cdr replies)))
-    (if replies
-       (gnus-soup-reply-prefix (car replies))
-      (push (vector (gnus-soup-unique-prefix nnsoup-replies-directory)
-                   kind
-                   (format "%c%c%c"
-                           nnsoup-replies-format-type
-                           nnsoup-replies-index-type
-                           (if (string= kind "news")
-                               ?n ?m)))
-           nnsoup-replies-list)
-      (gnus-soup-reply-prefix (car nnsoup-replies-list)))))
-
-(defun nnsoup-make-active ()
-  "(Re-)create the SOUP active file."
-  (interactive)
-  (let ((files (sort (directory-files nnsoup-directory t "IDX$")
-                    (lambda (f1 f2)
-                      (< (progn (string-match "/\\([0-9]+\\)\\." f1)
-                                (string-to-number (match-string 1 f1)))
-                         (progn (string-match "/\\([0-9]+\\)\\." f2)
-                                (string-to-number (match-string 1 f2)))))))
-       active group lines ident elem min)
-    (set-buffer (get-buffer-create " *nnsoup work*"))
-    (dolist (file files)
-      (nnheader-message 5 "Doing %s..." file)
-      (erase-buffer)
-      (nnheader-insert-file-contents file)
-      (goto-char (point-min))
-      (if (not (re-search-forward "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t *\\(Xref: \\)? *[^ ]* \\([^ ]+\\):[0-9]" nil t))
-         (setq group "unknown")
-       (setq group (match-string 2)))
-      (setq lines (count-lines (point-min) (point-max)))
-      (setq ident (progn (string-match
-                         "/\\([0-9]+\\)\\." file)
-                        (match-string 1 file)))
-      (if (not (setq elem (assoc group active)))
-         (push (list group (cons 1 lines)
-                     (list (cons 1 lines)
-                           (vector ident group "ucm" "" lines)))
-               active)
-       (nconc elem
-              (list
-               (list (cons (1+ (setq min (cdadr elem)))
-                           (+ min lines))
-                     (vector ident group "ucm" "" lines))))
-       (setcdr (cadr elem) (+ min lines))))
-    (nnheader-message 5 "")
-    (setq nnsoup-group-alist active)
-    (nnsoup-write-active-file t)))
-
-(defun nnsoup-delete-unreferenced-message-files ()
-  "Delete any *.MSG and *.IDX files that aren't known by nnsoup."
-  (interactive)
-  (let* ((known (apply 'nconc (mapcar
-                              (lambda (ga)
-                                (mapcar
-                                 (lambda (area)
-                                   (gnus-soup-area-prefix (cadr area)))
-                                 (cddr ga)))
-                              nnsoup-group-alist)))
-        (regexp "\\.MSG$\\|\\.IDX$")
-        (files (directory-files nnsoup-directory nil regexp))
-        non-files)
-    ;; Find all files that aren't known by nnsoup.
-    (dolist (file files)
-      (string-match regexp file)
-      (unless (member (substring file 0 (match-beginning 0)) known)
-       (push file non-files)))
-    ;; Sort and delete the files.
-    (setq non-files (sort non-files 'string<))
-    (map-y-or-n-p "Delete file %s? "
-                 (lambda (file) (delete-file
-                                 (expand-file-name file nnsoup-directory)))
-                 non-files)))
-
-(provide 'nnsoup)
-
-;; arch-tag: b0451389-5703-4450-9425-f66f6b38c828
-;;; nnsoup.el ends here
index 6e42a1fa31de1040d31721e139c89428fdeb8391..af04402d841306854deaa2e5a0400f8880ac8e1d 100644 (file)
 
 ;;; Code:
 
+;; For Emacs < 22.2.
+(eval-and-compile
+  (unless (fboundp 'declare-function) (defmacro declare-function (&rest r))))
+
 (require 'nnheader)
 (require 'nnoo)
 (require 'gnus-util)
@@ -294,13 +298,6 @@ to insert Cancel-Lock headers.")
 (defvoo nntp-server-xover 'try)
 (defvoo nntp-server-list-active-group 'try)
 
-(defvar nntp-async-needs-kluge
-  (string-match "^GNU Emacs 20\\.3\\." (emacs-version))
-  "*When non-nil, nntp will poll asynchronous connections
-once a second.  By default, this is turned on only for Emacs
-20.3, which has a bug that breaks nntp's normal method of
-noticing asynchronous data.")
-
 (defvar nntp-async-timer nil)
 (defvar nntp-async-process-list nil)
 
@@ -1168,6 +1165,11 @@ It will make innd servers spawn an nnrpd process to allow actual article
 reading."
   (nntp-send-command "^.*\n" "MODE READER"))
 
+(declare-function netrc-parse "netrc" (file))
+(declare-function netrc-machine "netrc"
+                 (list machine &optional port defaultport))
+(declare-function netrc-get "netrc" (alist type))
+
 (defun nntp-send-authinfo (&optional send-if-force)
   "Send the AUTHINFO to the nntp server.
 It will look in the \"~/.authinfo\" file for matching entries.  If
@@ -1176,10 +1178,11 @@ and a password.
 
 If SEND-IF-FORCE, only send authinfo to the server if the
 .authinfo file has the FORCE token."
+  (require 'netrc)
   (let* ((list (netrc-parse nntp-authinfo-file))
         (alist (netrc-machine list nntp-address "nntp"))
         (force (or (netrc-get alist "force") nntp-authinfo-force))
-        (auth-info 
+        (auth-info
          (auth-source-user-or-password '("login" "password") nntp-address "nntp"))
         (auth-user (nth 0 auth-info))
         (auth-passwd (nth 1 auth-info))
@@ -1358,17 +1361,7 @@ password contained in '~/.nntp-authinfo'."
          nntp-process-decode decode
          nntp-process-callback callback
          nntp-process-start-point (point-max))
-    (setq after-change-functions '(nntp-after-change-function))
-    (if nntp-async-needs-kluge
-       (nntp-async-kluge process))))
-
-(defun nntp-async-kluge (process)
-  ;; emacs 20.3 bug: process output with encoding 'binary
-  ;; doesn't trigger after-change-functions.
-  (unless nntp-async-timer
-    (setq nntp-async-timer
-         (run-at-time 1 1 'nntp-async-timer-handler)))
-  (add-to-list 'nntp-async-process-list process))
+    (setq after-change-functions '(nntp-after-change-function))))
 
 (defun nntp-async-timer-handler ()
   (mapcar
diff --git a/lisp/gnus/nnultimate.el b/lisp/gnus/nnultimate.el
deleted file mode 100644 (file)
index e65d30f..0000000
+++ /dev/null
@@ -1,480 +0,0 @@
-;;; nnultimate.el --- interfacing with the Ultimate Bulletin Board system
-
-;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
-
-;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
-;; Keywords: news
-
-;; 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:
-
-;; Note: You need to have `url' and `w3' installed for this
-;; backend to work.
-
-;;; Code:
-
-(eval-when-compile (require 'cl))
-
-(require 'nnoo)
-(require 'message)
-(require 'gnus-util)
-(require 'gnus)
-(require 'nnmail)
-(require 'mm-util)
-(require 'mm-url)
-(require 'nnweb)
-(require 'parse-time)
-(autoload 'w3-parse-buffer "w3-parse")
-
-(nnoo-declare nnultimate)
-
-(defvoo nnultimate-directory (nnheader-concat gnus-directory "ultimate/")
-  "Where nnultimate will save its files.")
-
-(defvoo nnultimate-address ""
-  "The address of the Ultimate bulletin board.")
-
-;;; Internal variables
-
-(defvar nnultimate-groups-alist nil)
-(defvoo nnultimate-groups nil)
-(defvoo nnultimate-headers nil)
-(defvoo nnultimate-articles nil)
-(defvar nnultimate-table-regexp
-  "postings.*editpost\\|forumdisplay\\|Forum[0-9]+/HTML\\|getbio")
-
-;;; Interface functions
-
-(nnoo-define-basics nnultimate)
-
-(deffoo nnultimate-retrieve-headers (articles &optional group server fetch-old)
-  (nnultimate-possibly-change-server group server)
-  (unless gnus-nov-is-evil
-    (let* ((last (car (last articles)))
-          (did nil)
-          (start 1)
-          (entry (assoc group nnultimate-groups))
-          (sid (nth 2 entry))
-          (topics (nth 4 entry))
-          (mapping (nth 5 entry))
-          (old-total (or (nth 6 entry) 1))
-          (furl "forumdisplay.cgi?action=topics&number=%d&DaysPrune=1000")
-          (furls (list (concat nnultimate-address (format furl sid))))
-          (nnultimate-table-regexp
-           "postings.*editpost\\|forumdisplay\\|getbio")
-          headers article subject score from date lines parent point
-          contents tinfo fetchers map elem a href garticles topic old-max
-          inc datel table current-page total-contents pages
-          farticles forum-contents parse furl-fetched mmap farticle)
-      (setq map mapping)
-      (while (and (setq article (car articles))
-                 map)
-       ;; Skip past the articles in the map until we reach the
-       ;; article we're looking for.
-       (while (and map
-                   (or (> article (caar map))
-                       (< (cadar map) (caar map))))
-         (pop map))
-       (when (setq mmap (car map))
-         (setq farticle -1)
-         (while (and article
-                     (<= article (nth 1 mmap)))
-           ;; Do we already have a fetcher for this topic?
-           (if (setq elem (assq (nth 2 mmap) fetchers))
-               ;; Yes, so we just add the spec to the end.
-               (nconc elem (list (cons article
-                                       (+ (nth 3 mmap) (incf farticle)))))
-             ;; No, so we add a new one.
-             (push (list (nth 2 mmap)
-                         (cons article
-                               (+ (nth 3 mmap) (incf farticle))))
-                   fetchers))
-           (pop articles)
-           (setq article (car articles)))))
-      ;; Now we have the mapping from/to Gnus/nnultimate article numbers,
-      ;; so we start fetching the topics that we need to satisfy the
-      ;; request.
-      (if (not fetchers)
-         (save-excursion
-           (set-buffer nntp-server-buffer)
-           (erase-buffer))
-       (setq nnultimate-articles nil)
-       (mm-with-unibyte-buffer
-         (dolist (elem fetchers)
-           (setq pages 1
-                 current-page 1
-                 total-contents nil)
-           (while (<= current-page pages)
-             (erase-buffer)
-             (setq subject (nth 2 (assq (car elem) topics)))
-             (setq href (nth 3 (assq (car elem) topics)))
-             (if (= current-page 1)
-                 (mm-url-insert href)
-               (string-match "\\.html$" href)
-               (mm-url-insert (concat (substring href 0 (match-beginning 0))
-                                     "-" (number-to-string current-page)
-                                     (match-string 0 href))))
-             (goto-char (point-min))
-             (setq contents
-                   (ignore-errors (w3-parse-buffer (current-buffer))))
-             (setq table (nnultimate-find-forum-table contents))
-             (goto-char (point-min))
-             (when (re-search-forward "topic is \\([0-9]+\\) pages" nil t)
-               (setq pages (string-to-number (match-string 1))))
-             (setq contents (cdr (nth 2 (car (nth 2 table)))))
-             (setq total-contents (nconc total-contents contents))
-             (incf current-page))
-           (when t
-             (let ((i 0))
-               (dolist (co total-contents)
-                 (push (list (or (nnultimate-topic-article-to-article
-                                  group (car elem) (incf i))
-                                 1)
-                             co subject)
-                       nnultimate-articles))))
-           (when nil
-             (dolist (art (cdr elem))
-               (when (nth (1- (cdr art)) total-contents)
-                 (push (list (car art)
-                             (nth (1- (cdr art)) total-contents)
-                             subject)
-                       nnultimate-articles))))))
-       (setq nnultimate-articles
-             (sort nnultimate-articles 'car-less-than-car))
-       ;; Now we have all the articles, conveniently in an alist
-       ;; where the key is the Gnus article number.
-       (dolist (articlef nnultimate-articles)
-         (setq article (nth 0 articlef)
-               contents (nth 1 articlef)
-               subject (nth 2 articlef))
-         (setq from (mapconcat 'identity
-                               (nnweb-text (car (nth 2 contents)))
-                               " ")
-               datel (nnweb-text (nth 2 (car (cdr (nth 2 contents))))))
-         (while datel
-           (when (string-match "Posted" (car datel))
-             (setq date (substring (car datel) (match-end 0))
-                   datel nil))
-           (pop datel))
-         (when date
-           (setq date (delete "" (split-string date "[-, \n\t\r    ]")))
-           (setq date
-                 (if (or (member "AM" date)
-                         (member "PM" date))
-                     (format
-                      "%s %s %s %s"
-                      (nth 1 date)
-                      (if (and (>= (length (nth 0 date)) 3)
-                               (assoc (downcase
-                                       (substring (nth 0 date) 0 3))
-                                      parse-time-months))
-                          (substring (nth 0 date) 0 3)
-                        (car (rassq (string-to-number (nth 0 date))
-                                    parse-time-months)))
-                      (nth 2 date) (nth 3 date))
-                   (format "%s %s %s %s"
-                           (car (rassq (string-to-number (nth 1 date))
-                                       parse-time-months))
-                           (nth 0 date) (nth 2 date) (nth 3 date)))))
-         (push
-          (cons
-           article
-           (make-full-mail-header
-            article subject
-            from (or date "")
-            (concat "<" (number-to-string sid) "%"
-                    (number-to-string article)
-                    "@ultimate." server ">")
-            "" 0
-            (/ (length (mapconcat
-                        'identity
-                        (nnweb-text
-                         (cdr (nth 2 (nth 1 (nth 2 contents)))))
-                        ""))
-               70)
-            nil nil))
-          headers))
-       (setq nnultimate-headers (sort headers 'car-less-than-car))
-       (save-excursion
-         (set-buffer nntp-server-buffer)
-         (mm-with-unibyte-current-buffer
-           (erase-buffer)
-           (dolist (header nnultimate-headers)
-             (nnheader-insert-nov (cdr header))))))
-      'nov)))
-
-(defun nnultimate-topic-article-to-article (group topic article)
-  (catch 'found
-    (dolist (elem (nth 5 (assoc group nnultimate-groups)))
-      (when (and (= topic (nth 2 elem))
-                (>= article (nth 3 elem))
-                (< article (+ (- (nth 1 elem) (nth 0 elem)) 1
-                              (nth 3 elem))))
-       (throw 'found
-              (+ (nth 0 elem) (- article (nth 3 elem))))))))
-
-(deffoo nnultimate-request-group (group &optional server dont-check)
-  (nnultimate-possibly-change-server nil server)
-  (when (not nnultimate-groups)
-    (nnultimate-request-list))
-  (unless dont-check
-    (nnultimate-create-mapping group))
-  (let ((elem (assoc group nnultimate-groups)))
-    (cond
-     ((not elem)
-      (nnheader-report 'nnultimate "Group does not exist"))
-     (t
-      (nnheader-report 'nnultimate "Opened group %s" group)
-      (nnheader-insert
-       "211 %d %d %d %s\n" (cadr elem) 1 (cadr elem)
-       (prin1-to-string group))))))
-
-(deffoo nnultimate-request-close ()
-  (setq nnultimate-groups-alist nil
-       nnultimate-groups nil))
-
-(deffoo nnultimate-request-article (article &optional group server buffer)
-  (nnultimate-possibly-change-server group server)
-  (let ((contents (cdr (assq article nnultimate-articles))))
-    (setq contents (cddr (nth 2 (nth 1 (nth 2 (car contents))))))
-    (when contents
-      (save-excursion
-       (set-buffer (or buffer nntp-server-buffer))
-       (erase-buffer)
-       (nnweb-insert-html (cons 'p (cons nil (list contents))))
-       (goto-char (point-min))
-       (insert "Content-Type: text/html\nMIME-Version: 1.0\n")
-       (let ((header (cdr (assq article nnultimate-headers))))
-         (mm-with-unibyte-current-buffer
-           (nnheader-insert-header header)))
-       (nnheader-report 'nnultimate "Fetched article %s" article)
-       (cons group article)))))
-
-(deffoo nnultimate-request-list (&optional server)
-  (nnultimate-possibly-change-server nil server)
-  (mm-with-unibyte-buffer
-    (mm-url-insert
-     (if (string-match "/$" nnultimate-address)
-        (concat nnultimate-address "Ultimate.cgi")
-       nnultimate-address))
-    (let ((contents (nth 2 (car (nth 2
-                                    (nnultimate-find-forum-table
-                                     (w3-parse-buffer (current-buffer)))))))
-         sid elem description articles a href group forum
-         a1 a2)
-      (dolist (row contents)
-       (setq row (nth 2 row))
-       (when (setq a (nnweb-parse-find 'a row))
-         (setq group (car (last (nnweb-text a)))
-               href (cdr (assq 'href (nth 1 a))))
-         (setq description (car (last (nnweb-text (nth 1 row)))))
-         (setq a1 (car (last (nnweb-text (nth 2 row)))))
-         (setq a2 (car (last (nnweb-text (nth 3 row)))))
-         (when (string-match "^[0-9]+$" a1)
-           (setq articles (string-to-number a1)))
-         (when (and a2 (string-match "^[0-9]+$" a2))
-           (setq articles (max articles (string-to-number a2))))
-         (when href
-           (string-match "number=\\([0-9]+\\)" href)
-           (setq forum (string-to-number (match-string 1 href)))
-           (if (setq elem (assoc group nnultimate-groups))
-               (setcar (cdr elem) articles)
-             (push (list group articles forum description nil nil nil nil)
-                   nnultimate-groups))))))
-    (nnultimate-write-groups)
-    (nnultimate-generate-active)
-    t))
-
-(deffoo nnultimate-request-newgroups (date &optional server)
-  (nnultimate-possibly-change-server nil server)
-  (nnultimate-generate-active)
-  t)
-
-(nnoo-define-skeleton nnultimate)
-
-;;; Internal functions
-
-(defun nnultimate-prune-days (group time)
-  "Compute the number of days to fetch info for."
-  (let ((old-time (nth 7 (assoc group nnultimate-groups))))
-    (if (null old-time)
-       1000
-      (- (time-to-days time) (time-to-days old-time)))))
-
-(defun nnultimate-create-mapping (group)
-  (let* ((entry (assoc group nnultimate-groups))
-        (sid (nth 2 entry))
-        (topics (nth 4 entry))
-        (mapping (nth 5 entry))
-        (old-total (or (nth 6 entry) 1))
-        (current-time (current-time))
-        (furl
-         (concat "forumdisplay.cgi?action=topics&number=%d&DaysPrune="
-                 (number-to-string
-                  (nnultimate-prune-days group current-time))))
-        (furls (list (concat nnultimate-address (format furl sid))))
-        contents forum-contents furl-fetched a subject href
-        garticles topic tinfo old-max inc parse)
-    (mm-with-unibyte-buffer
-      (while furls
-       (erase-buffer)
-       (mm-url-insert (pop furls))
-       (goto-char (point-min))
-       (setq parse (w3-parse-buffer (current-buffer)))
-       (setq contents
-             (cdr (nth 2 (car (nth 2 (nnultimate-find-forum-table
-                                      parse))))))
-       (setq forum-contents (nconc contents forum-contents))
-       (unless furl-fetched
-         (setq furl-fetched t)
-         ;; On the first time through this loop, we find all the
-         ;; forum URLs.
-         (dolist (a (nnweb-parse-find-all 'a parse))
-           (let ((href (cdr (assq 'href (nth 1 a)))))
-             (when (and href
-                        (string-match "forumdisplay.*startpoint" href))
-               (push href furls))))
-         (setq furls (nreverse furls))))
-      ;; The main idea here is to map Gnus article numbers to
-      ;; nnultimate article numbers.  Say there are three topics in
-      ;; this forum, the first with 4 articles, the seconds with 2,
-      ;; and the third with 1.  Then this will translate into 7 Gnus
-      ;; article numbers, where 1-4 comes from the first topic, 5-6
-      ;; from the second and 7 from the third.  Now, then next time
-      ;; the group is entered, there's 2 new articles in topic one
-      ;; and 1 in topic three.  Then Gnus article number 8-9 be 5-6
-      ;; in topic one and 10 will be the 2 in topic three.
-      (dolist (row (nreverse forum-contents))
-       (setq row (nth 2 row))
-       (when (setq a (nnweb-parse-find 'a row))
-         (setq subject (car (last (nnweb-text a)))
-               href (cdr (assq 'href (nth 1 a))))
-         (let ((artlist (nreverse (nnweb-text row)))
-               art)
-           (while (and (not art)
-                       artlist)
-             (when (string-match "^[0-9]+$" (car artlist))
-               (setq art (1+ (string-to-number (car artlist)))))
-             (pop artlist))
-           (setq garticles art))
-         (when garticles
-           (string-match "/\\([0-9]+\\).html" href)
-           (setq topic (string-to-number (match-string 1 href)))
-           (if (setq tinfo (assq topic topics))
-               (progn
-                 (setq old-max (cadr tinfo))
-                 (setcar (cdr tinfo) garticles))
-             (setq old-max 0)
-             (push (list topic garticles subject href) topics)
-             (setcar (nthcdr 4 entry) topics))
-           (when (not (= old-max garticles))
-             (setq inc (- garticles old-max))
-             (setq mapping (nconc mapping
-                                  (list
-                                   (list
-                                    old-total (1- (incf old-total inc))
-                                    topic (1+ old-max)))))
-             (incf old-max inc)
-             (setcar (nthcdr 5 entry) mapping)
-             (setcar (nthcdr 6 entry) old-total))))))
-    (setcar (nthcdr 7 entry) current-time)
-    (setcar (nthcdr 1 entry) (1- old-total))
-    (nnultimate-write-groups)
-    mapping))
-
-(defun nnultimate-possibly-change-server (&optional group server)
-  (nnultimate-init server)
-  (when (and server
-            (not (nnultimate-server-opened server)))
-    (nnultimate-open-server server))
-  (unless nnultimate-groups-alist
-    (nnultimate-read-groups)
-    (setq nnultimate-groups (cdr (assoc nnultimate-address
-                                       nnultimate-groups-alist)))))
-
-(deffoo nnultimate-open-server (server &optional defs connectionless)
-  (nnheader-init-server-buffer)
-  (if (nnultimate-server-opened server)
-      t
-    (unless (assq 'nnultimate-address defs)
-      (setq defs (append defs (list (list 'nnultimate-address server)))))
-    (nnoo-change-server 'nnultimate server defs)))
-
-(defun nnultimate-read-groups ()
-  (setq nnultimate-groups-alist nil)
-  (let ((file (expand-file-name "groups" nnultimate-directory)))
-    (when (file-exists-p file)
-      (mm-with-unibyte-buffer
-       (insert-file-contents file)
-       (goto-char (point-min))
-       (setq nnultimate-groups-alist (read (current-buffer)))))))
-
-(defun nnultimate-write-groups ()
-  (setq nnultimate-groups-alist
-       (delq (assoc nnultimate-address nnultimate-groups-alist)
-             nnultimate-groups-alist))
-  (push (cons nnultimate-address nnultimate-groups)
-       nnultimate-groups-alist)
-  (with-temp-file (expand-file-name "groups" nnultimate-directory)
-    (prin1 nnultimate-groups-alist (current-buffer))))
-
-(defun nnultimate-init (server)
-  "Initialize buffers and such."
-  (unless (file-exists-p nnultimate-directory)
-    (gnus-make-directory nnultimate-directory)))
-
-(defun nnultimate-generate-active ()
-  (save-excursion
-    (set-buffer nntp-server-buffer)
-    (erase-buffer)
-    (dolist (elem nnultimate-groups)
-      (insert (prin1-to-string (car elem))
-             " " (number-to-string (cadr elem)) " 1 y\n"))))
-
-(defun nnultimate-find-forum-table (contents)
-  (catch 'found
-    (nnultimate-find-forum-table-1 contents)))
-
-(defun nnultimate-find-forum-table-1 (contents)
-  (dolist (element contents)
-    (unless (stringp element)
-      (when (and (eq (car element) 'table)
-                (nnultimate-forum-table-p element))
-       (throw 'found element))
-      (when (nth 2 element)
-       (nnultimate-find-forum-table-1 (nth 2 element))))))
-
-(defun nnultimate-forum-table-p (parse)
-  (when (not (apply 'gnus-or
-                   (mapcar
-                    (lambda (p)
-                      (nnweb-parse-find 'table p))
-                    (nth 2 parse))))
-    (let ((href (cdr (assq 'href (nth 1 (nnweb-parse-find 'a parse 20)))))
-         case-fold-search)
-      (when (and href (string-match nnultimate-table-regexp href))
-       t))))
-
-(provide 'nnultimate)
-
-;; Local Variables:
-;; coding: iso-8859-1
-;; End:
-
-;; arch-tag: ab6bfc45-8fe1-4647-9c78-41050eb152b8
-;;; nnultimate.el ends here
diff --git a/lisp/gnus/nnwarchive.el b/lisp/gnus/nnwarchive.el
deleted file mode 100644 (file)
index 9b4e804..0000000
+++ /dev/null
@@ -1,727 +0,0 @@
-;;; nnwarchive.el --- interfacing with web archives
-
-;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
-
-;; Author: Shenghuo Zhu <zsh@cs.rochester.edu>
-;; Keywords: news egroups mail-archive
-
-;; 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:
-
-;; Note: You need to have `url' (w3 0.46) or greater version
-;; installed for some functions of this backend to work.
-
-;; Todo:
-;; 1. To support more web archives.
-;; 2. Generalize webmail to other MHonArc archive.
-
-;;; Code:
-
-(eval-when-compile (require 'cl))
-
-(require 'nnoo)
-(require 'message)
-(require 'gnus-util)
-(require 'gnus)
-(require 'gnus-bcklg)
-(require 'nnmail)
-(require 'mm-util)
-(require 'mm-url)
-
-(nnoo-declare nnwarchive)
-
-(defvar nnwarchive-type-definition
-  '((egroups
-     (address . "www.egroups.com")
-     (open-url
-      "http://www.egroups.com/login.cgi?&login_email=%s&login_password=%s"
-      nnwarchive-login nnwarchive-passwd)
-     (list-url
-      "http://www.egroups.com/mygroups")
-     (list-dissect . nnwarchive-egroups-list)
-     (list-groups . nnwarchive-egroups-list-groups)
-     (xover-url
-      "http://www.egroups.com/messages/%s/%d" group aux)
-     (xover-last-url
-      "http://www.egroups.com/messages/%s/" group)
-     (xover-page-size . 13)
-     (xover-dissect . nnwarchive-egroups-xover)
-     (article-url
-      "http://www.egroups.com/message/%s/%d?source=1" group article)
-     (article-dissect . nnwarchive-egroups-article)
-     (authentication . t)
-     (article-offset . 0)
-     (xover-files . nnwarchive-egroups-xover-files))
-    (mail-archive
-     (address . "www.mail-archive.com")
-     (open-url)
-     (list-url
-      "http://www.mail-archive.com/lists.html")
-     (list-dissect . nnwarchive-mail-archive-list)
-     (list-groups . nnwarchive-mail-archive-list-groups)
-     (xover-url
-      "http://www.mail-archive.com/%s/mail%d.html" group aux)
-     (xover-last-url
-      "http://www.mail-archive.com/%s/maillist.html" group)
-     (xover-page-size)
-     (xover-dissect . nnwarchive-mail-archive-xover)
-     (article-url
-      "http://www.mail-archive.com/%s/msg%05d.html" group article1)
-     (article-dissect . nnwarchive-mail-archive-article)
-     (xover-files . nnwarchive-mail-archive-xover-files)
-     (authentication)
-     (article-offset . 1))))
-
-(defvar nnwarchive-default-type 'egroups)
-
-(defvoo nnwarchive-directory (nnheader-concat gnus-directory "warchive/")
-  "Where nnwarchive will save its files.")
-
-(defvoo nnwarchive-type nil
-    "The type of nnwarchive.")
-
-(defvoo nnwarchive-address ""
-  "The address of nnwarchive.")
-
-(defvoo nnwarchive-login nil
-  "Your login name for the group.")
-
-(defvoo nnwarchive-passwd nil
-  "Your password for the group.")
-
-(defvoo nnwarchive-groups nil)
-
-(defvoo nnwarchive-headers-cache nil)
-
-(defvoo nnwarchive-authentication nil)
-
-(defvoo nnwarchive-nov-is-evil nil)
-
-(defconst nnwarchive-version "nnwarchive 1.0")
-
-;;; Internal variables
-
-(defvoo nnwarchive-open-url nil)
-(defvoo nnwarchive-open-dissect nil)
-
-(defvoo nnwarchive-list-url nil)
-(defvoo nnwarchive-list-dissect nil)
-(defvoo nnwarchive-list-groups nil)
-
-(defvoo nnwarchive-xover-files nil)
-(defvoo nnwarchive-xover-url nil)
-(defvoo nnwarchive-xover-last-url nil)
-(defvoo nnwarchive-xover-dissect nil)
-(defvoo nnwarchive-xover-page-size nil)
-
-(defvoo nnwarchive-article-url nil)
-(defvoo nnwarchive-article-dissect nil)
-(defvoo nnwarchive-xover-files nil)
-(defvoo nnwarchive-article-offset 0)
-
-(defvoo nnwarchive-buffer nil)
-
-(defvoo nnwarchive-keep-backlog 300)
-(defvar nnwarchive-backlog-articles nil)
-(defvar nnwarchive-backlog-hashtb nil)
-
-(defvoo nnwarchive-headers nil)
-
-
-;;; Interface functions
-
-(nnoo-define-basics nnwarchive)
-
-(defun nnwarchive-set-default (type)
-  (let ((defs (cdr (assq type nnwarchive-type-definition)))
-       def)
-    (dolist (def defs)
-      (set (intern (concat "nnwarchive-" (symbol-name (car def))))
-          (cdr def)))))
-
-(defmacro nnwarchive-backlog (&rest form)
-  `(let ((gnus-keep-backlog nnwarchive-keep-backlog)
-        (gnus-backlog-buffer
-         (format " *nnwarchive backlog %s*" nnwarchive-address))
-        (gnus-backlog-articles nnwarchive-backlog-articles)
-        (gnus-backlog-hashtb nnwarchive-backlog-hashtb))
-     (unwind-protect
-        (progn ,@form)
-       (setq nnwarchive-backlog-articles gnus-backlog-articles
-            nnwarchive-backlog-hashtb gnus-backlog-hashtb))))
-(put 'nnwarchive-backlog 'lisp-indent-function 0)
-(put 'nnwarchive-backlog 'edebug-form-spec '(form body))
-
-(defun nnwarchive-backlog-enter-article (group number buffer)
-  (nnwarchive-backlog
-    (gnus-backlog-enter-article group number buffer)))
-
-(defun nnwarchive-get-article (article &optional group server buffer)
-  (if (numberp article)
-      (if (nnwarchive-backlog
-           (gnus-backlog-request-article group article
-                                         (or buffer nntp-server-buffer)))
-         (cons group article)
-       (let (contents)
-         (save-excursion
-           (set-buffer nnwarchive-buffer)
-           (goto-char (point-min))
-           (let ((article1 (- article nnwarchive-article-offset)))
-             (nnwarchive-url nnwarchive-article-url))
-           (setq contents (funcall nnwarchive-article-dissect group article)))
-         (when contents
-           (save-excursion
-             (set-buffer (or buffer nntp-server-buffer))
-             (erase-buffer)
-             (insert contents)
-             (nnwarchive-backlog-enter-article group article (current-buffer))
-             (nnheader-report 'nnwarchive "Fetched article %s" article)
-             (cons group article)))))
-    nil))
-
-(deffoo nnwarchive-retrieve-headers (articles &optional group server fetch-old)
-  (nnwarchive-possibly-change-server group server)
-  (if (or gnus-nov-is-evil nnwarchive-nov-is-evil)
-      (with-temp-buffer
-       (with-current-buffer nntp-server-buffer
-         (erase-buffer))
-       (let ((buf (current-buffer)) b e)
-         (dolist (art articles)
-           (nnwarchive-get-article art group server buf)
-           (setq b (goto-char (point-min)))
-           (if (search-forward "\n\n" nil t)
-               (forward-char -1)
-             (goto-char (point-max)))
-           (setq e (point))
-           (with-current-buffer nntp-server-buffer
-             (insert (format "221 %d Article retrieved.\n" art))
-             (insert-buffer-substring buf b e)
-             (insert ".\n"))))
-       'headers)
-    (setq nnwarchive-headers (cdr (assoc group nnwarchive-headers-cache)))
-    (save-excursion
-      (set-buffer nnwarchive-buffer)
-      (erase-buffer)
-      (funcall nnwarchive-xover-files group articles))
-    (save-excursion
-      (set-buffer nntp-server-buffer)
-      (erase-buffer)
-      (let (header)
-      (dolist (art articles)
-       (if (setq header (assq art nnwarchive-headers))
-           (nnheader-insert-nov (cdr header))))))
-    (let ((elem (assoc group nnwarchive-headers-cache)))
-      (if elem
-         (setcdr elem nnwarchive-headers)
-       (push (cons group nnwarchive-headers) nnwarchive-headers-cache)))
-    'nov))
-
-(deffoo nnwarchive-request-group (group &optional server dont-check)
-  (nnwarchive-possibly-change-server nil server)
-  (when (and (not dont-check) nnwarchive-list-groups)
-    (funcall nnwarchive-list-groups (list group))
-    (nnwarchive-write-groups))
-  (let ((elem (assoc group nnwarchive-groups)))
-    (cond
-     ((not elem)
-      (nnheader-report 'nnwarchive "Group does not exist"))
-     (t
-      (nnheader-report 'nnwarchive "Opened group %s" group)
-      (nnheader-insert
-       "211 %d %d %d %s\n" (or (cadr elem) 0) 1 (or (cadr elem) 0)
-       (prin1-to-string group))
-      t))))
-
-(deffoo nnwarchive-request-article (article &optional group server buffer)
-  (nnwarchive-possibly-change-server group server)
-  (nnwarchive-get-article article group server buffer))
-
-(deffoo nnwarchive-close-server (&optional server)
-  (when (and (nnwarchive-server-opened server)
-            (gnus-buffer-live-p nnwarchive-buffer))
-    (save-excursion
-      (set-buffer nnwarchive-buffer)
-      (kill-buffer nnwarchive-buffer)))
-  (nnwarchive-backlog
-    (gnus-backlog-shutdown))
-  (nnoo-close-server 'nnwarchive server))
-
-(deffoo nnwarchive-request-list (&optional server)
-  (nnwarchive-possibly-change-server nil server)
-  (save-excursion
-    (set-buffer nnwarchive-buffer)
-    (erase-buffer)
-    (if nnwarchive-list-url
-       (nnwarchive-url nnwarchive-list-url))
-    (if nnwarchive-list-dissect
-       (funcall nnwarchive-list-dissect))
-    (nnwarchive-write-groups)
-    (nnwarchive-generate-active))
-  t)
-
-(deffoo nnwarchive-open-server (server &optional defs connectionless)
-  (nnoo-change-server 'nnwarchive server defs)
-  (nnwarchive-init server)
-  (when nnwarchive-authentication
-    (setq nnwarchive-login
-         (or nnwarchive-login
-             (read-string
-                (format "Login at %s: " server)
-                user-mail-address)))
-    (setq nnwarchive-passwd
-         (or nnwarchive-passwd
-             (read-passwd
-              (format "Password for %s at %s: "
-                      nnwarchive-login server)))))
-  (unless nnwarchive-groups
-    (nnwarchive-read-groups))
-  (save-excursion
-    (set-buffer nnwarchive-buffer)
-    (erase-buffer)
-    (if nnwarchive-open-url
-       (nnwarchive-url nnwarchive-open-url))
-    (if nnwarchive-open-dissect
-       (funcall nnwarchive-open-dissect)))
-  t)
-
-(nnoo-define-skeleton nnwarchive)
-
-;;; Internal functions
-
-(defun nnwarchive-possibly-change-server (&optional group server)
-  (nnwarchive-init server)
-  (when (and server
-            (not (nnwarchive-server-opened server)))
-    (nnwarchive-open-server server)))
-
-(defun nnwarchive-read-groups ()
-  (let ((file (expand-file-name (concat "groups-" nnwarchive-address)
-                               nnwarchive-directory)))
-    (when (file-exists-p file)
-      (with-temp-buffer
-       (insert-file-contents file)
-       (goto-char (point-min))
-       (setq nnwarchive-groups (read (current-buffer)))))))
-
-(defun nnwarchive-write-groups ()
-  (with-temp-file (expand-file-name (concat "groups-" nnwarchive-address)
-                                   nnwarchive-directory)
-    (prin1 nnwarchive-groups (current-buffer))))
-
-(defun nnwarchive-init (server)
-  "Initialize buffers and such."
-  (let ((type (intern server)) (defs nnwarchive-type-definition) def)
-    (cond
-     ((equal server "")
-      (setq type nnwarchive-default-type))
-     ((assq type nnwarchive-type-definition) t)
-     (t
-      (setq type nil)
-      (while (setq def (pop defs))
-       (when (equal (cdr (assq 'address (cdr def))) server)
-         (setq defs nil)
-         (setq type (car def))))
-      (unless type
-       (error "Undefined server %s" server))))
-    (setq nnwarchive-type type))
-  (unless (file-exists-p nnwarchive-directory)
-    (gnus-make-directory nnwarchive-directory))
-  (unless (gnus-buffer-live-p nnwarchive-buffer)
-    (setq nnwarchive-buffer
-         (save-excursion
-           (nnheader-set-temp-buffer
-            (format " *nnwarchive %s %s*" nnwarchive-type server)))))
-  (nnwarchive-set-default nnwarchive-type))
-
-(defun nnwarchive-eval (expr)
-  (cond
-   ((consp expr)
-    (cons (nnwarchive-eval (car expr)) (nnwarchive-eval (cdr expr))))
-   ((symbolp expr)
-    (eval expr))
-   (t
-    expr)))
-
-(defun nnwarchive-url (xurl)
-  (mm-with-unibyte-current-buffer
-    (let ((url-confirmation-func 'identity) ;; Some hacks.
-         (url-cookie-multiple-line nil))
-      (cond
-       ((eq (car xurl) 'post)
-       (pop xurl)
-       (mm-url-fetch-form (car xurl) (nnwarchive-eval (cdr xurl))))
-       (t
-       (mm-url-insert (apply 'format (nnwarchive-eval xurl))))))))
-
-(defun nnwarchive-generate-active ()
-  (save-excursion
-    (set-buffer nntp-server-buffer)
-    (erase-buffer)
-    (dolist (elem nnwarchive-groups)
-      (insert (prin1-to-string (car elem))
-             " " (number-to-string (or (cadr elem) 0)) " 1 y\n"))))
-
-(defun nnwarchive-paged (articles)
-  (let (art narts next)
-    (while (setq art (pop articles))
-      (when (and (>= art (or next 0))
-                (not (assq art nnwarchive-headers)))
-       (push art narts)
-       (setq next (+ art nnwarchive-xover-page-size))))
-    narts))
-
-;; egroups
-
-(defun nnwarchive-egroups-list-groups (groups)
-  (save-excursion
-    (let (articles)
-      (set-buffer nnwarchive-buffer)
-      (dolist (group groups)
-       (erase-buffer)
-       (nnwarchive-url nnwarchive-xover-last-url)
-       (goto-char (point-min))
-       (when (re-search-forward "of \\([0-9]+\\)[ \t\n\r]*</title>" nil t)
-         (setq articles (string-to-number (match-string 1))))
-       (let ((elem (assoc group nnwarchive-groups)))
-         (if elem
-             (setcar (cdr elem) articles)
-           (push (list group articles "") nnwarchive-groups)))
-       (setq nnwarchive-headers (cdr (assoc group nnwarchive-headers-cache)))
-       (nnwarchive-egroups-xover group)
-       (let ((elem (assoc group nnwarchive-headers-cache)))
-         (if elem
-             (setcdr elem nnwarchive-headers)
-           (push (cons group nnwarchive-headers) nnwarchive-headers-cache)))))))
-
-(defun nnwarchive-egroups-list ()
-  (let ((case-fold-search t)
-       group description elem articles)
-    (goto-char (point-min))
-    (while
-       (re-search-forward "href=\"/group/\\([^/\"\> ]+\\)" nil t)
-      (setq group (match-string 1)
-           description (match-string 2))
-      (if (setq elem (assoc group nnwarchive-groups))
-         (setcar (cdr elem) 0)
-       (push (list group articles description) nnwarchive-groups))))
-  t)
-
-(defun nnwarchive-egroups-xover (group)
-  (let (article subject from date)
-    (goto-char (point-min))
-    (while (re-search-forward
-           "<a href=\"/group/\\([^/]+\\)/\\([0-9]+\\)[^>]+>\\([^<]+\\)<"
-           nil t)
-      (setq group  (match-string 1)
-           article (string-to-number (match-string 2))
-           subject (match-string 3))
-      (forward-line 1)
-      (unless (assq article nnwarchive-headers)
-       (if (looking-at "<td[^>]+><font[^>]+>\\([^<]+\\)</font>")
-           (setq from (match-string 1)))
-       (forward-line 1)
-       (if (looking-at "<td[^>]+><font[^>]+>\\([^<]+\\)</font>")
-           (setq date (identity (match-string 1))))
-       (push (cons
-              article
-              (make-full-mail-header
-               article
-               (mm-url-decode-entities-string subject)
-               (mm-url-decode-entities-string from)
-               date
-               (concat "<" group "%"
-                       (number-to-string article)
-                       "@egroup.com>")
-               ""
-               0 0 "")) nnwarchive-headers))))
-  nnwarchive-headers)
-
-(defun nnwarchive-egroups-article (group articles)
-  (goto-char (point-min))
-  (if (search-forward "<pre>" nil t)
-      (delete-region (point-min) (point)))
-  (goto-char (point-max))
-  (if (search-backward "</pre>" nil t)
-      (delete-region (point) (point-max)))
-  (goto-char (point-min))
-  (while (re-search-forward "<a[^>]+>\\([^<]+\\)</a>" nil t)
-    (replace-match "\\1"))
-  (mm-url-decode-entities)
-  (buffer-string))
-
-(defun nnwarchive-egroups-xover-files (group articles)
-  (let (aux auxs)
-    (setq auxs (nnwarchive-paged (sort articles '<)))
-    (while (setq aux (pop auxs))
-      (goto-char (point-max))
-      (nnwarchive-url nnwarchive-xover-url))
-    (if nnwarchive-xover-dissect
-       (nnwarchive-egroups-xover group))))
-
-;; mail-archive
-
-(defun nnwarchive-mail-archive-list-groups (groups)
-  (save-excursion
-    (let (articles)
-      (set-buffer nnwarchive-buffer)
-      (dolist (group groups)
-       (erase-buffer)
-       (nnwarchive-url nnwarchive-xover-last-url)
-       (goto-char (point-min))
-       (when (re-search-forward "msg\\([0-9]+\\)\\.html" nil t)
-         (setq articles (1+ (string-to-number (match-string 1)))))
-       (let ((elem (assoc group nnwarchive-groups)))
-         (if elem
-             (setcar (cdr elem) articles)
-           (push (list group articles "") nnwarchive-groups)))
-       (setq nnwarchive-headers (cdr (assoc group nnwarchive-headers-cache)))
-       (nnwarchive-mail-archive-xover group)
-       (let ((elem (assoc group nnwarchive-headers-cache)))
-         (if elem
-             (setcdr elem nnwarchive-headers)
-           (push (cons group nnwarchive-headers)
-                 nnwarchive-headers-cache)))))))
-
-(defun nnwarchive-mail-archive-list ()
-  (let ((case-fold-search t)
-       group description elem articles)
-    (goto-char (point-min))
-    (while (re-search-forward "<a href=\"\\([^/]+\\)/\">\\([^>]+\\)<" nil t)
-      (setq group (match-string 1)
-           description (match-string 2))
-      (forward-line 1)
-      (setq articles 0)
-      (if (setq elem (assoc group nnwarchive-groups))
-         (setcar (cdr elem) articles)
-       (push (list group articles description) nnwarchive-groups))))
-  t)
-
-(defun nnwarchive-mail-archive-xover (group)
-  (let (article subject from date)
-    (goto-char (point-min))
-    (while (re-search-forward
-           "<A[^>]*HREF=\"msg\\([0-9]+\\)\\.html[^>]+>\\([^<]+\\)<"
-           nil t)
-      (setq article (1+ (string-to-number (match-string 1)))
-           subject (match-string 2))
-      (forward-line 1)
-      (unless (assq article nnwarchive-headers)
-       (if (looking-at "<UL><LI><EM>From</EM>: *\\([^<]*[^< ]\\) *&lt;\\([^&]+\\)&gt;")
-           (progn
-             (setq from (match-string 1)
-                   date (identity (match-string 2))))
-         (setq from "" date ""))
-       (push (cons
-              article
-              (make-full-mail-header
-               article
-               (mm-url-decode-entities-string subject)
-               (mm-url-decode-entities-string from)
-               date
-               (format "<%05d%%%s>\n" (1- article) group)
-               ""
-               0 0 "")) nnwarchive-headers))))
-  nnwarchive-headers)
-
-(defun nnwarchive-mail-archive-xover-files (group articles)
-  (unless nnwarchive-headers
-    (erase-buffer)
-    (nnwarchive-url nnwarchive-xover-last-url)
-    (goto-char (point-min))
-    (nnwarchive-mail-archive-xover group))
-  (let ((minart (apply 'min articles))
-       (min (apply 'min (mapcar 'car nnwarchive-headers)))
-       (aux 2))
-    (while (> min minart)
-      (erase-buffer)
-      (nnwarchive-url nnwarchive-xover-url)
-      (nnwarchive-mail-archive-xover group)
-      (setq min (apply 'min (mapcar 'car nnwarchive-headers))))))
-
-(defvar nnwarchive-caesar-translation-table nil
-  "Modified rot13 table. tr/@A-Z[a-z/N-Z[@A-Mn-za-m/.")
-
-(defun nnwarchive-make-caesar-translation-table ()
-  "Create modified rot13 table. tr/@A-Z[a-z/N-Z[@A-Mn-za-m/."
-  (let ((i -1)
-       (table (make-string 256 0))
-       (a (mm-char-int ?a))
-       (A (mm-char-int ?A)))
-    (while (< (incf i) 256)
-      (aset table i i))
-    (concat
-     (substring table 0 (1- A))
-     (substring table (+ A 13) (+ A 27))
-     (substring table (1- A) (+ A 13))
-     (substring table (+ A 27) a)
-     (substring table (+ a 13) (+ a 26))
-     (substring table a (+ a 13))
-     (substring table (+ a 26) 255))))
-
-(defun nnwarchive-from-r13 (from-r13)
-  (when from-r13
-    (with-temp-buffer
-      (insert from-r13)
-      (let ((message-caesar-translation-table
-            (or nnwarchive-caesar-translation-table
-                (setq nnwarchive-caesar-translation-table
-                      (nnwarchive-make-caesar-translation-table)))))
-       (message-caesar-region (point-min) (point-max))
-       (buffer-string)))))
-
-(defun nnwarchive-mail-archive-article (group article)
-  (let (p refs url mime e
-         from subject date id
-         done
-         (case-fold-search t))
-    (save-restriction
-      (goto-char (point-min))
-      (when (search-forward "X-Head-End" nil t)
-       (beginning-of-line)
-       (narrow-to-region (point-min) (point))
-       (mm-url-decode-entities)
-       (goto-char (point-min))
-       (while (search-forward "<!--X-" nil t)
-         (replace-match ""))
-       (goto-char (point-min))
-       (while (search-forward " -->" nil t)
-         (replace-match ""))
-       (setq from
-             (or (mail-fetch-field "from")
-                 (nnwarchive-from-r13
-                  (mail-fetch-field "from-r13"))))
-       (setq date (mail-fetch-field "date"))
-       (setq id (mail-fetch-field "message-id"))
-       (setq subject (mail-fetch-field "subject"))
-       (goto-char (point-max))
-       (widen))
-      (when (search-forward "<ul>" nil t)
-       (forward-line)
-       (delete-region (point-min) (point))
-       (search-forward "</ul>" nil t)
-       (end-of-line)
-       (narrow-to-region (point-min) (point))
-       (mm-url-remove-markup)
-       (mm-url-decode-entities)
-       (goto-char (point-min))
-       (delete-blank-lines)
-       (when from
-         (message-remove-header "from")
-         (goto-char (point-max))
-         (insert "From: " from "\n"))
-       (when subject
-         (message-remove-header "subject")
-         (goto-char (point-max))
-         (insert "Subject: " subject "\n"))
-       (when id
-         (goto-char (point-max))
-         (insert "X-Message-ID: <" id ">\n"))
-       (when date
-         (message-remove-header "date")
-         (goto-char (point-max))
-         (insert "Date: " date "\n"))
-       (goto-char (point-max))
-       (widen)
-       (insert "\n"))
-      (setq p (point))
-      (when (search-forward "X-Body-of-Message" nil t)
-       (forward-line)
-       (delete-region p (point))
-       (search-forward "X-Body-of-Message-End" nil t)
-       (beginning-of-line)
-       (save-restriction
-         (narrow-to-region p (point))
-         (goto-char (point-min))
-         (if (> (skip-chars-forward "\040\n\r\t") 0)
-             (delete-region (point-min) (point)))
-         (while (not (eobp))
-           (cond
-            ((looking-at "<PRE>\r?\n?")
-             (delete-region (match-beginning 0) (match-end 0))
-             (setq p (point))
-             (when (search-forward "</PRE>" nil t)
-               (delete-region (match-beginning 0) (match-end 0))
-               (save-restriction
-                 (narrow-to-region p (point))
-                 (mm-url-remove-markup)
-                 (mm-url-decode-entities)
-                 (goto-char (point-max)))))
-            ((looking-at "<P><A HREF=\"\\([^\"]+\\)")
-             (setq url (match-string 1))
-             (delete-region (match-beginning 0)
-                            (progn (forward-line) (point)))
-             ;; I hate to download the url encode it, then immediately
-             ;; decode it.
-             (insert "<#external"
-                     " type="
-                     (or (and url
-                              (string-match "\\.[^\\.]+$" url)
-                              (mailcap-extension-to-mime
-                               (match-string 0 url)))
-                         "application/octet-stream")
-                     (format " url=\"http://www.mail-archive.com/%s/%s\""
-                             group url)
-                     ">\n"
-                     "<#/external>")
-             (setq mime t))
-            (t
-             (setq p (point))
-             (insert "<#part type=\"text/html\" disposition=inline>")
-             (goto-char
-              (if (re-search-forward
-                   "[\040\n\r\t]*<PRE>\\|[\040\n\r\t]*<P><A HREF=\""
-                   nil t)
-                  (match-beginning 0)
-                (point-max)))
-             (insert "<#/part>")
-             (setq mime t)))
-           (setq p (point))
-           (if (> (skip-chars-forward "\040\n\r\t") 0)
-               (delete-region p (point))))
-         (goto-char (point-max))))
-      (setq p (point))
-      (when (search-forward "X-References-End" nil t)
-       (setq e (point))
-       (beginning-of-line)
-       (search-backward "X-References" p t)
-       (while (re-search-forward "msg\\([0-9]+\\)\\.html" e t)
-         (push (concat "<" (match-string 1) "%" group ">") refs)))
-      (delete-region p (point-max))
-      (goto-char (point-min))
-      (insert (format "Message-ID: <%05d%%%s>\n" (1- article) group))
-      (when refs
-       (insert "References:")
-       (while refs
-         (insert " " (pop refs)))
-       (insert "\n"))
-      (when mime
-       (unless (looking-at "$")
-         (search-forward "\n\n" nil t)
-         (forward-line -1))
-       (narrow-to-region (point) (point-max))
-       (insert "MIME-Version: 1.0\n"
-               (prog1
-                   (mml-generate-mime)
-                 (delete-region (point-min) (point-max))))
-       (widen)))
-    (buffer-string)))
-
-(provide 'nnwarchive)
-
-;; arch-tag: 1ab7a15c-777a-40e0-95c0-0c41b3963578
-;;; nnwarchive.el ends here
index b6b0ddd41a9dd44e9cdf39e30a9f24f080fbadfc..fcb8e93a05d5e8102b0f8ee1cbd831ed67de0b65 100644 (file)
@@ -525,7 +525,7 @@ Valid types include `google', `dejanews', and `gmane'.")
        ;;("TOPDOC" . "1000")
        ))))
   (setq buffer-file-name nil)
-  (set-buffer-multibyte t)
+  (unless (featurep 'xemacs) (set-buffer-multibyte t))
   (mm-decode-coding-region (point-min) (point-max) 'utf-8)
   t)
 
index b3012b4b19892a82e31f614ec4ce59f0260cb6c9..682959af195f0a18fcc0006e4d2c18e878a16010 100644 (file)
@@ -98,6 +98,12 @@ thing can fall apart and leave you with a corrupt mailbox."
   :type 'boolean
   :group 'pop3)
 
+(defcustom pop3-display-message-size-flag t
+  "*If non-nil, display the size of the message that is being fetched."
+  :version "22.1" ;; Oort Gnus
+  :type 'boolean
+  :group 'pop3) 
+
 (defvar pop3-timestamp nil
   "Timestamp returned when initially connected to the POP server.
 Used for APOP authentication.")
@@ -114,7 +120,7 @@ Used for APOP authentication.")
       (defalias 'pop3-accept-process-output 'nnheader-accept-process-output)
     ;; Borrowed from `nnheader.el':
     (defvar pop3-read-timeout
-      (if (string-match "windows-nt\\|os/2\\|emx\\|cygwin"
+      (if (string-match "windows-nt\\|os/2\\|cygwin"
                        (symbol-name system-type))
          1.0
        0.01)
@@ -135,6 +141,7 @@ Shorter values mean quicker response, but are more CPU intensive.")
         (crashbuf (get-buffer-create " *pop3-retr*"))
         (n 1)
         message-count
+        message-sizes
         (pop3-password pop3-password))
     ;; for debugging only
     (if pop3-debug (switch-to-buffer (process-buffer process)))
@@ -149,10 +156,18 @@ Shorter values mean quicker response, but are more CPU intensive.")
           (pop3-pass process))
          (t (error "Invalid POP3 authentication scheme")))
     (setq message-count (car (pop3-stat process)))
+    (when (and pop3-display-message-size-flag
+              (> message-count 0))
+      (setq message-sizes (pop3-list process)))
     (unwind-protect
        (while (<= n message-count)
-         (message "Retrieving message %d of %d from %s..."
-                  n message-count pop3-mailhost)
+         (if pop3-display-message-size-flag
+             (message "Retrieving message %d of %d from %s... (%.1fk)"
+                      n message-count pop3-mailhost
+                      (/ (cdr (assoc n message-sizes))
+                         1024.0))
+           (message "Retrieving message %d of %d from %s..."
+                    n message-count pop3-mailhost))      
          (pop3-retr process n crashbuf)
          (save-excursion
            (set-buffer crashbuf)
@@ -451,8 +466,28 @@ If NOW, use that time instead."
     ))
 
 (defun pop3-list (process &optional msg)
-  "Scan listing of available messages.
-This function currently does nothing.")
+  "If MSG is nil, return an alist of (MESSAGE-ID . SIZE) pairs.
+Otherwise, return the size of the message-id MSG"
+  (pop3-send-command process (if msg 
+                                (format "LIST %d" msg)
+                              "LIST"))
+  (let ((response (pop3-read-response process t)))
+    (if msg
+       (string-to-number (nth 2 (split-string response " ")))
+      (let ((start pop3-read-point) end)
+       (save-excursion
+         (set-buffer (process-buffer process))
+         (while (not (re-search-forward "^\\.\r\n" nil t))
+           (pop3-accept-process-output process)
+           (goto-char start))
+         (setq pop3-read-point (point-marker))
+         (goto-char (match-beginning 0))
+         (setq end (point-marker))
+         (mapcar #'(lambda (s) (let ((split (split-string s " ")))
+                                 (cons (string-to-number (nth 0 split))
+                                       (string-to-number (nth 1 split)))))
+                 (delete "" (split-string (buffer-substring start end)
+                                          "\r\n"))))))))
 
 (defun pop3-retr (process msg crashbuf)
   "Retrieve message-id MSG to buffer CRASHBUF."
index 793aa1f32dcd9626e65b02b7286194b0a2c50734..27d34ee5290729e513e1608b871a8f6b4f16b350 100644 (file)
@@ -31,7 +31,6 @@
   (require 'cl))
 (defvar message-posting-charset)
 
-(require 'qp)
 (require 'mm-util)
 (require 'ietf-drums)
 ;; Fixme: Avoid this (used for mail-parse-charset) mm dependence on gnus.
@@ -428,7 +427,7 @@ Dynamically bind `rfc2047-encoding-type' to change that."
                      ;; since encoded words can't occur in quotes.
                      (progn
                        (goto-char end)
-                       (delete-backward-char 1)
+                       (delete-char -1)
                        (goto-char start)
                        (delete-char 1)
                        (when last-encoded
@@ -656,6 +655,9 @@ should not change this value.")
 Point moves to the end of the region."
   (let ((mime-charset (or (mm-find-mime-charset-region b e) (list 'us-ascii)))
        cs encoding tail crest eword)
+    ;; Use utf-8 as a last resort if determining charset of text fails.
+    (if (memq nil mime-charset)
+       (setq mime-charset (list 'utf-8)))
     (cond ((> (length mime-charset) 1)
           (error "Can't rfc2047-encode `%s'"
                  (buffer-substring-no-properties b e)))
@@ -827,6 +829,8 @@ Point moves to the end of the region."
   "Base64-encode the header contained in STRING."
   (base64-encode-string string t))
 
+(autoload 'quoted-printable-encode-region "qp")
+
 (defun rfc2047-q-encode-string (string)
   "Quoted-printable-encode the header in STRING."
   (mm-with-unibyte-buffer
@@ -896,7 +900,7 @@ them.")
                  (goto-char beg)
                  (while (search-forward "\\" nil 'move)
                    (unless (memq (char-after) '(?\"))
-                     (delete-backward-char 1))
+                     (delete-char -1))
                    (forward-char)))
                (forward-char))
            (error
@@ -929,6 +933,8 @@ only be used for decoding, not for encoding."
        'raw-text
       cs)))
 
+(autoload 'quoted-printable-decode-string "qp")
+
 (defun rfc2047-decode-encoded-words (words)
   "Decode successive encoded-words in WORDS and return a decoded string.
 Each element of WORDS looks like (CHARSET ENCODING ENCODED-TEXT
index 4b78490bbe314ffc657cf77d2b3172e160a07473..bd8741fe85fce95d428bda9548911bfce671dbd2 100644 (file)
@@ -191,10 +191,10 @@ Valid states are `closed', `initial', `nonauth', and `auth'.")
 
 ;; Internal utility functions
 
-(defsubst sieve-manage-disable-multibyte ()
+(defmacro sieve-manage-disable-multibyte ()
   "Enable multibyte in the current buffer."
-  (when (fboundp 'set-buffer-multibyte)
-    (set-buffer-multibyte nil)))
+  (unless (featurep 'xemacs)
+    '(set-buffer-multibyte nil)))
 
 (declare-function password-read         "password-cache" (prompt &optional key))
 (declare-function password-cache-add    "password-cache" (key password))
index 99ec57ce38b357172c44597a1cfeb0f88db0e24f..f765589e7a0929bc0b72f46398aa83255d032fad 100644 (file)
@@ -1,7 +1,7 @@
 ;;; sieve-mode.el --- Sieve code editing commands for Emacs
 
-;; Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
-;;   Free Software Foundation, Inc.
+;; Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
+;;   2010  Free Software Foundation, Inc.
 
 ;; Author: Simon Josefsson <simon@josefsson.org>
 
@@ -49,7 +49,6 @@
 
 (autoload 'sieve-manage "sieve")
 (autoload 'sieve-upload "sieve")
-(require 'easymenu)
 (eval-when-compile
   (require 'font-lock))
 
   "Menubar used in sieve mode.")
 
 ;; Code for Sieve editing mode.
+(autoload 'easy-menu-add-item "easymenu")
 
 ;;;###autoload
 (define-derived-mode sieve-mode c-mode "Sieve"
index fbe71e7725fa50c9732cc4c106cd6f7fd94196ff..964e80bc21313374d44f91e2fddc83acc7e4986a 100644 (file)
@@ -102,7 +102,8 @@ is nil, use `smiley-style'."
 
 ;; The XEmacs version has a baroque, if not rococo, set of these.
 (defcustom smiley-regexp-alist
-  '(("\\(;-?)\\)\\W" 1 "blink")
+  '(("\\(;-)\\)\\W" 1 "blink")
+    ("[^;]\\(;)\\)\\W" 1 "blink")
     ("\\(:-]\\)\\W" 1 "forced")
     ("\\(8-)\\)\\W" 1 "braindamaged")
     ("\\(:-|\\)\\W" 1 "indifferent")
@@ -119,6 +120,7 @@ is nil, use `smiley-style'."
 The elements are (REGEXP MATCH IMAGE), where MATCH is the submatch in
 regexp to replace with IMAGE.  IMAGE is the name of an image file in
 `smiley-data-directory'."
+  :version "24.1"
   :type '(repeat (list regexp
                       (integer :tag "Regexp match number")
                       (string :tag "Image name")))
index 45c596539c98c23754f120a15e8c077e8084fc23..69fc2016a650ed7acb8a682b06587a1a04984630 100644 (file)
@@ -1,6 +1,7 @@
 ;;; spam-stat.el --- detecting spam based on statistics
 
-;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
+;;   2010  Free Software Foundation, Inc.
 
 ;; Author: Alex Schroeder <alex@gnu.org>
 ;; Keywords: network
@@ -557,6 +558,8 @@ check the variable `spam-stat-score-data'."
     (when (re-search-forward "^Xref:.*\n" nil t)
       (delete-region (match-beginning 0) (match-end 0)))))
 
+(autoload 'time-to-number-of-days "time-date")
+
 (defun spam-stat-process-directory (dir func)
   "Process all the regular files in directory DIR using function FUNC."
   (let* ((files (directory-files dir t "^[^.]"))
index ebf01d17b9c1a61e4a2ef8a23c90bcdd85cfa224..ec8111fe33b6649c14207907c7d5aec2d94ed0b1 100644 (file)
@@ -112,7 +112,7 @@ Use IMAP modification if FOR-IMAP is non-nil."
                 (skip-chars-forward not-direct-encoding-chars)))
            (if (and (= fc esc-char)
                     (= run-length 1))  ; Lone esc-char?
-               (delete-backward-char 1) ; Now there's one too many
+               (delete-char -1)        ; Now there's one too many
              (utf7-fragment-encode p (point) for-imap))
            (insert "-")))))))
 
@@ -153,7 +153,7 @@ Use IMAP modification if FOR-IMAP is non-nil."
              (save-excursion
                (utf7-fragment-decode p (point) for-imap)
                (goto-char p)
-               (delete-backward-char 1)))))))))
+               (delete-char -1)))))))))
 
 (defun utf7-fragment-decode (start end &optional for-imap)
   "Decode base64 encoded fragment from START to END of UTF-7 text in buffer.
index b0f7b4115b23b81320ddb1bfeb77218dd37a2ee5..2d56d660583943e69f182297d861d7fbaf068592 100644 (file)
@@ -89,8 +89,9 @@
              (when (re-search-forward "^=yend.*$" end t)
                (setq last (match-beginning 0))
                (setq footer-alist (yenc-parse-line (match-string 0)))
-               (letf (((default-value 'enable-multibyte-characters) nil))
-                     (setq work-buffer (generate-new-buffer " *yenc-work*")))
+               (setq work-buffer (generate-new-buffer " *yenc-work*"))
+               (unless (featurep 'xemacs)
+                 (with-current-buffer work-buffer (set-buffer-multibyte nil)))
                (while (< first last)
                  (setq char (char-after first))
                  (cond ((or (eq char ?\r)
index 18db4f443f645d5f3119c2859ed99959d844527c..4456a494099050870cebfe9f14769e44d325f5c2 100644 (file)
@@ -6,6 +6,7 @@
 
 ;; Maintainer: FSF
 ;; Keywords: help, internal
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
index 12fa29abf58205deedac820092ca8f4413ee8fd1..2e0f7fad53900f7ba18fffdacc94724ae01072b7 100644 (file)
@@ -7,6 +7,7 @@
 ;; Maintainer: FSF
 ;; Created: Mon Oct  1 11:42:39 1990
 ;; Adapted-By: ESR
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
index bad4ae94e2af4916d4ea392dbcc46a1eee80ae03..9d10d5170ba72e4a61ddd264bdcf291824e7e9f8 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Maintainer: FSF
 ;; Keywords: help, internal
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
@@ -244,6 +245,16 @@ The format is (FUNCTION ARGS...).")
                       (message "Unable to find location in file"))))
   'help-echo (purecopy "mouse-2, RET: find face's definition"))
 
+(define-button-type 'help-package
+  :supertype 'help-xref
+  'help-function 'describe-package
+  'help-echo (purecopy "mouse-2, RET: Describe package"))
+
+(define-button-type 'help-package-def
+  :supertype 'help-xref
+  'help-function (lambda (file) (dired file))
+  'help-echo (purecopy "mouse-2, RET: visit package directory"))
+
 \f
 ;;;###autoload
 (defun help-mode ()
@@ -272,6 +283,9 @@ Commands:
          (with-current-buffer buffer
            (bury-buffer))))
 
+  (set (make-local-variable 'revert-buffer-function)
+       'help-mode-revert-buffer)
+
   (run-mode-hooks 'help-mode-hook))
 
 ;;;###autoload
@@ -433,7 +447,9 @@ that."
                     (let ((data (match-string 2)))
                       (save-match-data
                         (unless (string-match "^([^)]+)" data)
-                          (setq data (concat "(emacs)" data))))
+                          (setq data (concat "(emacs)" data)))
+                       (setq data ;; possible newlines if para filled
+                             (replace-regexp-in-string "[ \t\n]+" " " data t t)))
                       (help-xref-button 2 'help-info data))))
                 ;; URLs
                 (save-excursion
@@ -781,6 +797,17 @@ Show all docs for that symbol as either a variable, function or face."
              (fboundp sym) (facep sym))
       (help-do-xref pos #'help-xref-interned (list sym)))))
 
+(defun help-mode-revert-buffer (ignore-auto noconfirm)
+  (when (or noconfirm (yes-or-no-p "Revert help buffer? "))
+    (let ((pos (point))
+         (item help-xref-stack-item)
+         ;; Pretend there is no current item to add to the history.
+         (help-xref-stack-item nil)
+         ;; Use the current buffer.
+         (help-xref-following t))
+      (apply (car item) (cdr item))
+      (goto-char pos))))
+
 (defun help-insert-string (string)
   "Insert STRING to the help buffer and install xref info for it.
 This function can be used to restore the old contents of the help buffer
index acfd78b301fcf334144f88e6f8783a9352a54bb7..a2e721dd6b3f907b18405678f6a9ebdc5ec89f8e 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Maintainer: FSF
 ;; Keywords: help, internal
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
     (define-key map "m" 'describe-mode)
     (define-key map "n" 'view-emacs-news)
     (define-key map "p" 'finder-by-keyword)
+    (define-key map "P" 'describe-package)
     (define-key map "r" 'info-emacs-manual)
     (define-key map "s" 'describe-syntax)
     (define-key map "t" 'help-with-tutorial)
@@ -873,7 +875,9 @@ whose documentation describes the minor mode."
               (insert (format-mode-line mode nil nil buffer))
               (add-text-properties start (point) '(face bold)))))
        (princ " mode:\n")
-       (princ (documentation major-mode))))))
+       (princ (documentation major-mode)))))
+  ;; For the sake of IELM and maybe others
+  nil)
 
 
 (defun describe-minor-mode (minor-mode)
index fc5359e1f6587ed2ab67a19d38ae47dc6118fded..7aefc36224b4ecbac278651ce0492d5d7d2593d4 100644 (file)
@@ -13,6 +13,7 @@
 ;; Description: fallback code for colour name -> rgb mapping
 ;; URL: http://rtfm.etla.org/emacs/htmlfontify/
 ;; Last-Updated: Sat 2003-02-15 03:49:32 +0000
+;; Package: htmlfontify
 
 ;; This file is part of GNU Emacs.
 
 (defconst hfy-rgb-regex
   "^\\s-*\\([0-9]+\\)\\s-+\\([0-9]+\\)\\s-+\\([0-9]+\\)\\s-+\\(.+\\)\\s-*$")
 
+;;;###autoload
 (defun htmlfontify-load-rgb-file (&optional file)
   "Load an X11 style rgb.txt FILE.
 Search `hfy-rgb-load-path' if FILE is not specified.
@@ -832,14 +834,21 @@ Loads the variable `hfy-rgb-txt-colour-map', which is used by
          (kill-buffer rgb-buffer)))))
 
 (defun htmlfontify-unload-rgb-file ()
+  "Unload the current color name -> rgb translation map."
   (interactive)
   (setq hfy-rgb-txt-colour-map nil))
 
+;;;###autoload
 (defun hfy-fallback-colour-values (colour-string)
+  "Use a fallback method for obtaining the rgb values for a color."
   (cdr (assoc-string colour-string (or hfy-rgb-txt-colour-map
                                        hfy-fallback-colour-map))) )
 
 (provide 'hfy-cmap)
-;;; hfy-cmap.el ends here
+
+;; Local Variables:
+;; generated-autoload-file: "htmlfontify.el"
+;; End:
 
 ;; arch-tag: dff7feea-add4-48ba-937c-e79ac40cec9b
+;;; hfy-cmap.el ends here
index eed03ff54db71afe6168c48884fce8e7791f7672..9a791076002cfb1ce1c0999ef99ed8ecce6f351e 100644 (file)
@@ -72,7 +72,7 @@
 (defgroup hl-line nil
   "Highlight the current line."
   :version "21.1"
-  :group 'editing)
+  :group 'convenience)
 
 (defface hl-line
   '((t :inherit highlight))
index f7a5382e6b827be8b2358863808ea6bd01e74f7b..5c491b0c37194ae253c87fcb8824d2f230847d00 100644 (file)
@@ -15,6 +15,7 @@
 ;; Compatibility: Emacs23, Emacs22
 ;; Incompatibility: Emacs19, Emacs20, Emacs21
 ;; Last Updated: Thu 2009-11-19 01:31:21 +0000
+;; Version: 0.21
 
 ;; This file is part of GNU Emacs.
 
 ;;  (`font-lock-fontify-region')
 (require 'cus-edit)
 
-(eval-and-compile
-  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-  ;; I want these - can't be bothered requiring all of cl though.
-  (if (not (fboundp 'caddr))
-      (defun caddr (list)
-        "Return the `car' of the `cddr' of LIST."
-        (car (cddr list))))
-
-  (if (not (fboundp 'cadddr))
-      (defun cadddr (list)
-        "Return the `cadr' of the `cddr' of LIST."
-        (cadr (cddr list))))
-  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-  (autoload
-    'htmlfontify-load-rgb-file
-    "hfy-cmap"
-    "Load an rgb.txt file for color name -> rgb translation purposes."
-    'interactive)
-
-  (autoload
-    'htmlfontify-unload-rgb-file
-    "hfy-cmap"
-    "Unload the current color name -> rgb translation map."
-    'interactive)
-
-  (autoload
-    'hfy-fallback-colour-values
-    "hfy-cmap"
-    "Use a fallback method for obtaining the rgb values for a color."
-    'interactive)
-  )
-
 (defconst htmlfontify-version 0.21)
 
 (defconst hfy-meta-tags
@@ -2379,7 +2347,28 @@ You may also want to set `hfy-page-header' and `hfy-page-footer'."
   (let ((file (hfy-initfile)))
     (load file 'NOERROR nil nil) ))
 
+\f
+;;;### (autoloads (hfy-fallback-colour-values htmlfontify-load-rgb-file)
+;;;;;;  "hfy-cmap" "hfy-cmap.el" "3de2db2d213813bb3afe170ffd66cdde")
+;;; Generated autoloads from hfy-cmap.el
+
+(autoload 'htmlfontify-load-rgb-file "hfy-cmap" "\
+Load an X11 style rgb.txt FILE.
+Search `hfy-rgb-load-path' if FILE is not specified.
+Loads the variable `hfy-rgb-txt-colour-map', which is used by
+`hfy-fallback-colour-values'.
+
+\(fn &optional FILE)" t nil)
+
+(autoload 'hfy-fallback-colour-values "hfy-cmap" "\
+Use a fallback method for obtaining the rgb values for a color.
+
+\(fn COLOUR-STRING)" nil nil)
+
+;;;***
+\f
+
 (provide 'htmlfontify)
-;;; htmlfontify.el ends here
 
 ;; arch-tag: 944e5e63-c81d-4baa-a82a-0275f9c30e61
+;;; htmlfontify.el ends here
index 69eb3188862246afaae6019c00a23df1213523b5..196838f248d83bbc36f77404dcad786bdaa0909b 100644 (file)
@@ -7,6 +7,7 @@
 ;; Maintainer: John Paul Wallington <jpw@gnu.org>
 ;; Created: 2 Dec 2001
 ;; Keywords: buffer, convenience
+;; Package: ibuffer
 
 ;; This file is part of GNU Emacs.
 
@@ -91,11 +92,6 @@ regardless of any active filters in this buffer."
 (defvar ibuffer-tmp-show-regexps nil
   "A list of regexps which should match buffer names to always show.")
 
-(defvar ibuffer-auto-mode nil
-  "If non-nil, Ibuffer auto-mode should be enabled for this buffer.
-Do not set this variable directly!  Use the function
-`ibuffer-auto-mode' instead.")
-
 (defvar ibuffer-auto-buffers-changed nil)
 
 (defcustom ibuffer-saved-filters '(("gnus"
@@ -220,6 +216,16 @@ Currently, this only applies to `ibuffer-saved-filters' and
         (ibuffer-included-in-filters-p buf ibuffer-filtering-qualifiers)
         (ibuffer-buf-matches-predicates buf ibuffer-always-show-predicates)))))
 
+;;;###autoload
+(define-minor-mode ibuffer-auto-mode
+  "Toggle use of Ibuffer's auto-update facility.
+With numeric ARG, enable auto-update if and only if ARG is positive."
+  nil nil nil
+  (unless (derived-mode-p 'ibuffer-mode)
+    (error "This buffer is not in Ibuffer mode"))
+  (frame-or-buffer-changed-p 'ibuffer-auto-buffers-changed) ; Initialize state vector
+  (add-hook 'post-command-hook 'ibuffer-auto-update-changed))
+
 (defun ibuffer-auto-update-changed ()
   (when (frame-or-buffer-changed-p 'ibuffer-auto-buffers-changed)
     (dolist (buf (buffer-list))
@@ -229,20 +235,6 @@ Currently, this only applies to `ibuffer-saved-filters' and
                     (derived-mode-p 'ibuffer-mode))
            (ibuffer-update nil t)))))))
 
-;;;###autoload
-(defun ibuffer-auto-mode (&optional arg)
-  "Toggle use of Ibuffer's auto-update facility.
-With numeric ARG, enable auto-update if and only if ARG is positive."
-  (interactive)
-  (unless (derived-mode-p 'ibuffer-mode)
-    (error "This buffer is not in Ibuffer mode"))
-  (set (make-local-variable 'ibuffer-auto-mode)
-       (if arg
-          (plusp arg)
-        (not ibuffer-auto-mode)))
-  (frame-or-buffer-changed-p 'ibuffer-auto-buffers-changed) ; Initialize state vector
-  (add-hook 'post-command-hook 'ibuffer-auto-update-changed))
-
 ;;;###autoload
 (defun ibuffer-mouse-filter-by-mode (event)
   "Enable or disable filtering by the major mode chosen via mouse."
index 60fb7e3b82097a2a19fd7c04b234c8c5cf9b82aa..684cfe8f51b6aee300a0dd6e20fa8bc85294f1b2 100644 (file)
@@ -7,6 +7,7 @@
 ;; Maintainer: John Paul Wallington <jpw@gnu.org>
 ;; Created: 6 Dec 2001
 ;; Keywords: buffer, convenience
+;; Package: ibuffer
 
 ;; This file is part of GNU Emacs.
 
index ea48ad5438a895448268860db1a4c19bf0f29fa8..c2492818b459cf2663fc48923f685123cf24807e 100644 (file)
@@ -2641,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" "4fb4f1a32cf4ecf4669a133a866f4a14")
+;;;;;;  ibuffer-auto-mode) "ibuf-ext" "ibuf-ext.el" "fa9822b5ef905f06d8a03dc9ce3a2894")
 ;;; Generated autoloads from ibuf-ext.el
 
 (autoload 'ibuffer-auto-mode "ibuf-ext" "\
index 94822a60a63c07fb115e0f050b32fb8005cb40b5..645981539d4ff0b5afee8e83329445e4a78ca15d 100644 (file)
@@ -283,7 +283,8 @@ The displays for unambiguous matches have ` [Matched]' appended
 matches exist.  \(Keybindings for uniquely matched commands
 are exhibited within the square braces.)"
 
-  (let* ((comps (completion-all-sorted-completions))
+  (let* ((non-essential t)
+        (comps (completion-all-sorted-completions))
          (last (if (consp comps) (last comps)))
          (base-size (cdr last))
          (open-bracket (if require-match "(" "["))
index a4409775a86ca4b53a409d3ae8519a2d5a47282a..858ee3ed5b0f68999c9421e5d0bf72ee16bc090b 100644 (file)
 
 ;;; Code:
 
-(defvar cua-inhibit-cua-keys)
+(defvar recentf-list)
 
 ;;; User Variables
 ;;
@@ -774,6 +774,24 @@ can be completed using TAB,
   :type '(repeat string)
   :group 'ido)
 
+(defcustom ido-use-virtual-buffers nil
+  "If non-nil, refer to past buffers as well as existing ones.
+Essentially it works as follows: Say you are visiting a file and
+the buffer gets cleaned up by mignight.el.  Later, you want to
+switch to that buffer, but find it's no longer open.  With
+virtual buffers enabled, the buffer name stays in the buffer
+list (using the `ido-virtual' face, and always at the end), and if
+you select it, it opens the file back up again.  This allows you
+to think less about whether recently opened files are still open
+or not.  Most of the time you can quit Emacs, restart, and then
+switch to a file buffer that was previously open as if it still
+were.
+    This feature relies upon the `recentf' package, which will be
+enabled if this variable is configured to a non-nil value."
+  :version "24.1"
+  :type 'boolean
+  :group 'ido)
+
 (defcustom ido-use-faces t
   "Non-nil means use ido faces to highlighting first match, only match and
 subdirs in the alternatives."
@@ -798,6 +816,11 @@ subdirs in the alternatives."
   "Face used by ido for highlighting subdirs in the alternatives."
   :group 'ido)
 
+(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"
@@ -1030,6 +1053,11 @@ so that it doesn't interfere with other minibuffer usage.")
   "Non-nil means to explicitly cursor on entry to minibuffer.
 Value is an integer which is number of chars to right of prompt.")
 
+(defvar ido-virtual-buffers nil
+  "List of virtual buffers, that is, past visited files.
+This is a copy of `recentf-list', pared down and with faces applied.
+Only used if `ido-use-virtual-buffers' is non-nil.")
+
 ;;; Variables with dynamic bindings.
 ;;; Declared here to keep the byte compiler quiet.
 
@@ -1595,7 +1623,6 @@ This function also adds a hook to the minibuffer."
     (define-key map "\C-o" 'ido-copy-current-word)
     (define-key map "\C-w" 'ido-copy-current-file-name)
     (define-key map [(meta ?l)] 'ido-toggle-literal)
-    (define-key map "\C-v" 'ido-toggle-vc)
     (set-keymap-parent map ido-file-dir-completion-map)
     (setq ido-file-completion-map map))
 
@@ -1604,6 +1631,7 @@ This function also adds a hook to the minibuffer."
     (define-key map "\C-x\C-f" 'ido-enter-find-file)
     (define-key map "\C-x\C-b" 'ido-fallback-command)
     (define-key map "\C-k" 'ido-kill-buffer-at-head)
+    (define-key map "\C-o" 'ido-toggle-virtual-buffers)
     (set-keymap-parent map ido-common-completion-map)
     (setq ido-buffer-completion-map map)))
 
@@ -2153,9 +2181,13 @@ If cursor is not at the end of the user input, move to end of input."
           (ido-current-directory nil)
           (ido-directory-nonreadable nil)
           (ido-directory-too-big nil)
+          (ido-use-virtual-buffers (if (eq method 'kill)
+                                       nil    ;; Don't consider virtual buffers for killing
+                                     ido-use-virtual-buffers))
           (require-match (confirm-nonexistent-file-or-buffer))
           (buf (ido-read-internal 'buffer (or prompt "Buffer: ") 'ido-buffer-history default
-                                  require-match initial)))
+                                  require-match initial))
+          filename)
 
       ;; Choose the buffer name: either the text typed in, or the head
       ;; of the list of matches
@@ -2191,6 +2223,16 @@ If cursor is not at the end of the user input, move to end of input."
                 (point))))
          (ido-visit-buffer buf method t)))
 
+       ;; check for a virtual buffer reference
+       ((and ido-use-virtual-buffers ido-virtual-buffers
+            (setq filename (assoc buf ido-virtual-buffers)))
+       (ido-visit-buffer (find-file-noselect (cdr filename)) method t))
+
+       ((and (eq ido-create-new-buffer 'prompt)
+            (null require-match)
+            (not (y-or-n-p (format "No buffer matching `%s', create one? " buf))))
+       nil)
+
        ;; buffer doesn't exist
        ((and (eq ido-create-new-buffer 'never)
             (null require-match))
@@ -2665,6 +2707,16 @@ C-x C-f ... C-d  enter `dired' on current directory."
        (setq ido-exit 'keep)
        (exit-minibuffer))))
 
+(defun ido-toggle-virtual-buffers ()
+  "Toggle the use of virtual buffers.
+See `ido-use-virtual-buffers' for explanation of virtual buffer."
+  (interactive)
+  (when (and ido-mode (eq ido-cur-item 'buffer))
+    (setq ido-use-virtual-buffers (not ido-use-virtual-buffers))
+    (setq ido-text-init ido-text)
+    (setq ido-exit 'refresh)
+    (exit-minibuffer)))
+
 (defun ido-reread-directory ()
   "Read current directory again.
 May be useful if cached version is no longer valid, but directory
@@ -2763,7 +2815,7 @@ If no buffer or file exactly matching the prompt exists, maybe create a new one.
    ((eq this-original-command 'viper-del-backward-char-in-insert)
     (funcall this-original-command))
    (t
-    (delete-backward-char (prefix-numeric-value count)))))
+    (delete-char (- (prefix-numeric-value count))))))
 
 (defun ido-delete-backward-word-updir (count)
   "Delete all chars backwards, or at beginning of buffer, go up one level."
@@ -3354,6 +3406,33 @@ for first matching file."
     (run-hooks 'ido-make-buffer-list-hook)
     ido-temp-list))
 
+(defun ido-add-virtual-buffers-to-list ()
+  "Add recently visited files, and bookmark files, to the buffer list.
+This is to make them appear as if they were \"virtual buffers\"."
+  ;; If no buffers matched, and virtual buffers are being used, then
+  ;; consult the list of past visited files, to see if we can find
+  ;; the file which the user might thought was still open.
+  (unless recentf-mode (recentf-mode 1))
+  (setq ido-virtual-buffers nil)
+  (let (name)
+    (dolist (head recentf-list)
+      (and (setq name (file-name-nondirectory head))
+           (null (get-file-buffer head))
+           (not (assoc name ido-virtual-buffers))
+           (not (member name ido-temp-list))
+           (not (ido-ignore-item-p name ido-ignore-buffers))
+           ;;(file-exists-p head)
+           (push (cons name head) ido-virtual-buffers))))
+  (when ido-virtual-buffers
+    (if ido-use-faces
+       (dolist (comp ido-virtual-buffers)
+         (put-text-property 0 (length (car comp))
+                            'face 'ido-virtual
+                            (car comp))))
+    (setq ido-temp-list
+         (nconc ido-temp-list
+                (nreverse (mapcar #'car ido-virtual-buffers))))))
+
 (defun ido-make-choice-list (default)
   ;; Return the current list of choices.
   ;; If DEFAULT is non-nil, and corresponds to an element of choices,
@@ -3393,7 +3472,7 @@ for first matching file."
     ;; Strip method:user@host: part of tramp completions.
     ;; Tramp completions do not include leading slash.
     (let* ((len (1- (length dir)))
-          (tramp-completion-mode t)
+          (non-essential t)
           (compl
            (or (file-name-all-completions "" dir)
                ;; work around bug in ange-ftp.
@@ -4515,7 +4594,6 @@ For details of keybindings, see `ido-find-file'."
   (when (ido-active)
     (add-hook 'pre-command-hook 'ido-tidy nil t)
     (add-hook 'post-command-hook 'ido-exhibit nil t)
-    (setq cua-inhibit-cua-keys t)
     (when (featurep 'xemacs)
       (ido-exhibit)
       (goto-char (point-min)))
index e52a7d3730114e1ca2a9a535519aed2497dc232d..1c9b092738b2d3cfb1d4c4dd6f5509b821aa181c 100644 (file)
   :group 'image)
 
 (defconst iimage-version "1.1")
-(defvar iimage-mode nil)
-(defvar iimage-mode-map nil)
 
-;; Set up key map.
-(unless iimage-mode-map
-  (setq iimage-mode-map (make-sparse-keymap))
-  (define-key iimage-mode-map "\C-l" 'iimage-recenter))
+(defvar iimage-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map "\C-l" 'iimage-recenter)
+    map))
 
 (defun iimage-recenter (&optional arg)
-"Re-draw images and recenter."
+  "Re-draw images and recenter."
   (interactive "P")
-  (iimage-mode-buffer 0)
-  (iimage-mode-buffer 1)
+  (iimage-mode-buffer nil)
+  (iimage-mode-buffer t)
   (recenter arg))
 
 (defvar iimage-mode-image-filename-regex
@@ -81,7 +79,7 @@
   `((,(concat "\\(`?file://\\|\\[\\[\\|<\\|`\\)?"
              "\\(" iimage-mode-image-filename-regex "\\)"
              "\\(\\]\\]\\|>\\|'\\)?") . 2))
-"*Alist of filename REGEXP vs NUM.
+  "*Alist of filename REGEXP vs NUM.
 Each element looks like (REGEXP . NUM).
 NUM specifies which parenthesized expression in the regexp.
 
@@ -90,54 +88,58 @@ Examples of image filename regexps:
     `file://foo.png'
     \\[\\[foo.gif]]
     <foo.png>
-     foo.JPG
-")
+     foo.JPG")
 
 (defvar iimage-mode-image-search-path nil
-"*List of directories to search for image files for iimage-mode.")
+  "*List of directories to search for image files for `iimage-mode'.")
 
 ;;;###autoload
-(defun turn-on-iimage-mode ()
-"Unconditionally turn on iimage mode."
-  (interactive)
-  (iimage-mode 1))
+(define-obsolete-function-alias 'turn-on-iimage-mode 'iimage-mode "24.1")
 
 (defun turn-off-iimage-mode ()
-"Unconditionally turn off iimage mode."
+  "Unconditionally turn off iimage mode."
   (interactive)
   (iimage-mode 0))
 
-(defalias 'iimage-locate-file 'locate-file)
+(defun iimage-modification-hook (beg end)
+  "Remove display property if a display region is modified."
+  ;;(debug-print "ii1 begin %d, end %d\n" beg end)
+  (let ((inhibit-modification-hooks t)
+        (beg (previous-single-property-change end 'display
+                                              nil (line-beginning-position)))
+        (end (next-single-property-change     beg 'display
+                                              nil (line-end-position))))
+    (when (and beg end (plist-get (text-properties-at beg) 'display))
+      ;;(debug-print "ii2 begin %d, end %d\n" beg end)
+      (remove-text-properties beg end
+                              '(display nil modification-hooks nil)))))
 
 (defun iimage-mode-buffer (arg)
-"Display/undisplay images.
-With numeric ARG, display the images if and only if ARG is positive."
-  (interactive)
-  (let ((ing (if (numberp arg)
-                (> arg 0)
-              iimage-mode))
-       (modp (buffer-modified-p (current-buffer)))
-       file buffer-read-only)
-    (save-excursion
-      (goto-char (point-min))
-      (dolist (pair iimage-mode-image-regex-alist)
-       (while (re-search-forward (car pair) nil t)
-         (if (and (setq file (match-string (cdr pair)))
-                  (setq file (iimage-locate-file file
-                                  (cons default-directory
-                                        iimage-mode-image-search-path))))
-             (if ing
-                 (add-text-properties (match-beginning 0) (match-end 0)
-                                      (list 'display (create-image file)))
-               (remove-text-properties (match-beginning 0) (match-end 0)
-                                       '(display)))))))
-    (set-buffer-modified-p modp)))
+  "Display images if ARG is non-nil, undisplay them otherwise."
+  (let ((image-path (cons default-directory iimage-mode-image-search-path))
+       file)
+    (with-silent-modifications
+      (save-excursion
+        (goto-char (point-min))
+        (dolist (pair iimage-mode-image-regex-alist)
+          (while (re-search-forward (car pair) nil t)
+            (when (and (setq file (match-string (cdr pair)))
+                       (setq file (locate-file file image-path)))
+              ;; FIXME: we don't mark our images, so we can't reliably
+              ;; remove them either (we may leave some of ours, and we
+              ;; may remove other packages's display properties).
+              (if arg
+                  (add-text-properties (match-beginning 0) (match-end 0)
+                                       `(display ,(create-image file)
+                                         modification-hooks
+                                         (iimage-modification-hook)))
+                (remove-text-properties (match-beginning 0) (match-end 0)
+                                        '(display modification-hooks))))))))))
 
 ;;;###autoload
 (define-minor-mode iimage-mode
   "Toggle inline image minor mode."
   :group 'iimage :lighter " iImg" :keymap iimage-mode-map
-  (run-hooks 'iimage-mode-hook)
   (iimage-mode-buffer iimage-mode))
 
 (provide 'iimage)
index f006e2e9edd46f592663c240761daa509f206fae..a74ddd312d5f708cb272f3f4072bc92550e8eae1 100644 (file)
 (require 'widget)
 
 (eval-when-compile
+  (require 'cl)
   (require 'wid-edit))
 
 (defgroup image-dired nil
@@ -632,26 +633,32 @@ according to the Thumbnail Managing Standard."
     (call-process shell-file-name nil nil nil shell-command-switch command)))
 
 ;;;###autoload
-(defun image-dired-dired-insert-marked-thumbs ()
-  "Insert thumbnails before file names of marked files in the dired buffer."
-  (interactive)
+(defun image-dired-dired-toggle-marked-thumbs (&optional arg)
+  "Toggle thumbnails in front of file names in the dired buffer.
+If no marked file could be found, insert or hide thumbnails on the
+current line.  ARG, if non-nil, specifies the files to use instead
+of the marked files.  If ARG is an integer, use the next ARG (or
+previous -ARG, if ARG<0) files."
+  (interactive "P")
   (dired-map-over-marks
-   (let* ((image-pos (dired-move-to-filename))
-          (image-file (dired-get-filename))
-          (thumb-file (image-dired-get-thumbnail-image image-file))
+   (let* ((image-pos  (dired-move-to-filename))
+          (image-file (dired-get-filename nil t))
+          thumb-file
           overlay)
-     ;; If image is not already added, then add it.
-     (unless (delq nil (mapcar (lambda (o) (overlay-get o 'put-image))
-                               ;; Can't use (overlays-at (point)), BUG?
-                               (overlays-in (point) (1+ (point)))))
-       (put-image thumb-file image-pos)
-       (setq
-       overlay
-       (car (delq nil (mapcar (lambda (o) (and (overlay-get o 'put-image) o))
-                              (overlays-in (point) (1+ (point)))))))
-       (overlay-put overlay 'image-file image-file)
-       (overlay-put overlay 'thumb-file thumb-file)))
-   nil)
+     (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)))
+          (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))
 
 (defun image-dired-dired-after-readin-hook ()
@@ -937,7 +944,7 @@ FILE-TAGS is an alist in the following form:
                ;; If on empty line at end of buffer
                (when (and (eobp)
                           (looking-at "^$"))
-                 (delete-backward-char 1))))))
+                 (delete-char -1))))))
        files)
       (save-buffer)
       (kill-buffer buf))))
index 7143d9833c05c485d19814bafba8025e0b839cdb..6e67847857f6a68771db8f7d6b83dff2ba745ac8 100644 (file)
@@ -4,6 +4,7 @@
 ;;
 ;; Author: Richard Stallman <rms@gnu.org>
 ;; Keywords: multimedia
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
@@ -320,10 +321,14 @@ This variable is used to display the current image type in the mode line.")
     (define-key map (kbd "DEL")       'image-scroll-down)
     (define-key map [remap forward-char] 'image-forward-hscroll)
     (define-key map [remap backward-char] 'image-backward-hscroll)
+    (define-key map [remap right-char] 'image-forward-hscroll)
+    (define-key map [remap left-char] 'image-backward-hscroll)
     (define-key map [remap previous-line] 'image-previous-line)
     (define-key map [remap next-line] 'image-next-line)
     (define-key map [remap scroll-up] 'image-scroll-up)
     (define-key map [remap scroll-down] 'image-scroll-down)
+    (define-key map [remap scroll-up-command] 'image-scroll-up)
+    (define-key map [remap scroll-down-command] 'image-scroll-down)
     (define-key map [remap move-beginning-of-line] 'image-bol)
     (define-key map [remap move-end-of-line] 'image-eol)
     (define-key map [remap beginning-of-buffer] 'image-bob)
@@ -377,6 +382,7 @@ to toggle between display as an image and display as text."
        (image-mode-setup-winprops)
 
        (add-hook 'change-major-mode-hook 'image-toggle-display-text nil t)
+       (add-hook 'after-revert-hook 'image-after-revert-hook nil t)
        (run-mode-hooks 'image-mode-hook)
        (message "%s" (concat
                       (substitute-command-keys
@@ -468,7 +474,7 @@ Remove text properties that display the image."
 
 (defvar archive-superior-buffer)
 (defvar tar-superior-buffer)
-(declare-function image-refresh "image.c" (spec &optional frame))
+(declare-function image-flush "image.c" (spec &optional frame))
 
 (defun image-toggle-display-image ()
   "Show the image of the image file.
@@ -488,7 +494,10 @@ was inserted."
                            (buffer-substring-no-properties (point-min) (point-max)))
                         filename))
         (type (image-type file-or-data nil data-p))
-        (image (create-image file-or-data type data-p))
+         (image0 (create-animated-image file-or-data type data-p))
+        (image (append image0
+                        (image-transform-properties image0)
+                        ))
         (props
          `(display ,image
                    intangible ,image
@@ -497,7 +506,7 @@ was inserted."
         (inhibit-read-only t)
         (buffer-undo-list t)
         (modified (buffer-modified-p)))
-    (image-refresh image)
+    (image-flush image)
     (let ((buffer-file-truename nil)) ; avoid changing dir mtime by lock_file
       (add-text-properties (point-min) (point-max) props)
       (restore-buffer-modified-p modified))
@@ -523,17 +532,25 @@ the image file and `image-mode' showing the image as an image."
   (if (image-get-display-property)
       (image-mode-as-text)
     (image-mode)))
+
+(defun image-after-revert-hook ()
+  (when (image-get-display-property)
+    (image-toggle-display-text)
+    ;; Update image display.
+    (redraw-frame (selected-frame))
+    (image-toggle-display-image)))
+
 \f
 ;;; Support for bookmark.el
-(declare-function bookmark-make-record-default "bookmark"
-                  (&optional point-only))
+(declare-function bookmark-make-record-default
+                  "bookmark" (&optional no-file no-context posn))
 (declare-function bookmark-prop-get "bookmark" (bookmark prop))
 (declare-function bookmark-default-handler "bookmark" (bmk))
 
 (defun image-bookmark-make-record ()
-  (nconc (bookmark-make-record-default)
-         `((image-type . ,image-type)
-           (handler    . image-bookmark-jump))))
+  `(,@(bookmark-make-record-default nil 'no-context 0)
+      (image-type . ,image-type)
+      (handler    . image-bookmark-jump)))
 
 ;;;###autoload
 (defun image-bookmark-jump (bmk)
@@ -543,6 +560,84 @@ the image file and `image-mode' showing the image as an image."
     (when (not (string= image-type (bookmark-prop-get bmk 'image-type)))
       (image-toggle-display))))
 \f
+
+(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 for transforming the view of images Image mode.")
+
+(define-minor-mode image-transform-mode
+  "minor mode for scaleing and rotation"
+  nil "image-transform"
+  image-transform-minor-mode-map)
+
+(defvar image-transform-resize   nil
+  "The image resize operation. See the command
+  `image-transform-set-scale' for more information." )
+
+(defvar image-transform-rotation 0.0)
+
+
+(defun image-transform-properties (display)
+  "Calculate the display properties for transformations; scaling
+and rotation. "
+  (let*
+      ((size (image-size display t))
+       (height
+        (cond
+         ((and (numberp image-transform-resize) (eq 100 image-transform-resize))
+          nil)
+         ((numberp image-transform-resize)
+          (* image-transform-resize (cdr size)))
+         ((eq image-transform-resize 'fit-height)
+          (- (nth 3 (window-inside-pixel-edges)) (nth 1 (window-inside-pixel-edges))))
+         (t nil)))
+       (width (if (eq image-transform-resize 'fit-width)
+                  (- (nth 2 (window-inside-pixel-edges)) (nth 0 (window-inside-pixel-edges))))))
+
+    `(,@(if height (list :height height))
+      ,@(if width (list :width width))
+      ,@(if (not (equal 0.0 image-transform-rotation))
+            (list :rotation image-transform-rotation))
+      ;;TODO fit-to-* should consider the rotation angle
+      )))
+
+(defun image-transform-set-scale (scale)
+  "SCALE sets the scaling for images. "
+  (interactive "nscale:")
+  (image-transform-set-resize (float scale)))
+
+(defun image-transform-fit-to-height ()
+  "Fit image height to window height. "
+  (interactive)
+  (image-transform-set-resize 'fit-height))
+
+(defun image-transform-fit-to-width ()
+  "Fit image width to window width. "
+  (interactive)
+  (image-transform-set-resize 'fit-width))
+
+(defun image-transform-set-resize (resize)
+  "Set the resize mode for images. The RESIZE value can be the
+symbol fit-height which fits the image to the window height. The
+symbol fit-width fits the image to the window width.  A number
+indicates a scaling factor. nil indicates scale to 100%. "
+  (setq image-transform-resize resize)
+  (if (eq 'image-mode major-mode) (image-toggle-display-image)))
+
+(defun image-transform-set-rotation (rotation)
+  "Set the image ROTATION angle. "
+  (interactive "nrotation:")
+  ;;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))
+  (if (eq major-mode 'image-mode) (image-toggle-display-image)))
+
 (provide 'image-mode)
 
 ;; arch-tag: b5b2b7e6-26a7-4b79-96e3-1546b5c4c6cb
index 944c6135e23af3453e513c7fb698b330295c424d..20e3d5f85aa70ff1b5c1b466c50c1cc830d2e04d 100644 (file)
@@ -1,10 +1,11 @@
 ;;; image.el --- image API
 
-;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003,
-;;   2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+;;   2007, 2008, 2009, 2010  Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
 ;; Keywords: multimedia
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
@@ -30,6 +31,7 @@
   "Image support."
   :group 'multimedia)
 
+(defalias 'image-refresh 'image-flush)
 
 (defconst image-type-header-regexps
   `(("\\`/[\t\n\r ]*\\*.*XPM.\\*/" . xpm)
@@ -584,6 +586,135 @@ Example:
   (declare (doc-string 3))
   `(defvar ,symbol (find-image ',specs) ,doc))
 
+\f
+;;; Animated image API
+
+(defcustom image-animate-max-time 30
+  "Time in seconds to animate images."
+  :type 'integer
+  :version "24.1"
+  :group 'image)
+
+(defconst image-animated-types '(gif)
+  "List of supported animated image types.")
+
+;;;###autoload
+(defun create-animated-image (file-or-data &optional type data-p &rest props)
+  "Create an animated image.
+FILE-OR-DATA is an image file name or image data.
+Optional TYPE is a symbol describing the image type.  If TYPE is omitted
+or nil, try to determine the image type from its first few bytes
+of image data.  If that doesn't work, and FILE-OR-DATA is a file name,
+use its file extension as image type.
+Optional DATA-P non-nil means FILE-OR-DATA is a string containing image data.
+Optional PROPS are additional image attributes to assign to the image,
+like, e.g. `:mask MASK'.
+Value is the image created, or nil if images of type TYPE are not supported.
+
+Images should not be larger than specified by `max-image-size'."
+  (setq type (image-type file-or-data type data-p))
+  (when (image-type-available-p type)
+    (let* ((animate (memq type image-animated-types))
+          (image
+           (append (list 'image :type type (if data-p :data :file) file-or-data)
+                   (if animate '(:index 0))
+                   props)))
+      (if animate
+         (image-animate-start image))
+      image)))
+
+(defun image-animate-timer (image)
+  "Return the animation timer for image IMAGE."
+  ;; See cancel-function-timers
+  (let ((tail timer-list) timer)
+    (while tail
+      (setq timer (car tail)
+           tail (cdr tail))
+      (if (and (eq (aref timer 5) #'image-animate-timeout)
+              (consp (aref timer 6))
+              (eq (car (aref timer 6)) image))
+         (setq tail nil)
+       (setq timer nil)))
+    timer))
+
+(defun image-animate-start (image &optional max-time)
+  "Start animation of image IMAGE.
+Optional second arg MAX-TIME is number of seconds to animate image,
+or t to animate infinitely."
+  (let ((anim (image-animated-p image))
+       timer tmo)
+    (when anim
+      (if (setq timer (image-animate-timer image))
+         (setcar (nthcdr 3 (aref timer 6)) max-time)
+       (setq tmo (* (cdr anim) 0.01))
+       (setq max-time (or max-time image-animate-max-time))
+       (run-with-timer tmo nil #'image-animate-timeout
+                       image 1 (car anim)
+                       (if (numberp max-time)
+                           (- max-time tmo)
+                         max-time))))))
+
+(defun image-animate-stop (image)
+  "Stop animation of image."
+  (let ((timer (image-animate-timer image)))
+    (when timer
+      (cancel-timer timer))))
+
+(defun image-animate-timeout (image ino count time-left)
+  (if (>= ino count)
+      (setq ino 0))
+  (plist-put (cdr image) :index ino)
+  (force-window-update)
+  (let ((anim (image-animated-p image)) tmo)
+    (when anim
+      (setq tmo (* (cdr anim) 0.01))
+      (unless (and (= ino 0) (numberp time-left) (< time-left tmo))
+       (run-with-timer tmo nil #'image-animate-timeout
+                       image (1+ ino) count
+                       (if (numberp time-left)
+                           (- time-left tmo)
+                         time-left))))))
+
+(defun image-animated-p (image)
+  "Return non-nil if image is animated.
+Actually, return value is a cons (IMAGES . DELAY) where IMAGES
+is the number of sub-images in the animated image, and DELAY
+is the delay in 100ths of a second until the next sub-image
+shall be displayed."
+  (cond
+   ((eq (plist-get (cdr image) :type) 'gif)
+    (let* ((metadata (image-metadata image))
+          (images (plist-get metadata 'count))
+          (extdata (plist-get metadata 'extension-data))
+          (anim (plist-get extdata #xF9))
+          (tmo (and (integerp images) (> images 1)
+                    (stringp anim) (>= (length anim) 4)
+                    (+ (aref anim 1) (* (aref anim 2) 256)))))
+      (when tmo
+       (if (eq tmo 0) (setq tmo 10))
+       (cons images tmo))))))
+
+\f
+(defcustom imagemagick-types-inhibit
+  '(C HTML HTM TXT PDF)
+  "Types the imagemagick loader should not try to handle.")
+
+;;;###autoload
+(defun imagemagick-register-types ()
+  "Register file types that imagemagick is able to handle."
+  (let ((im-types (imagemagick-types)))
+    (dolist (im-inhibit imagemagick-types-inhibit)
+      (setq im-types (remove im-inhibit im-types)))
+    (dolist (im-type im-types)
+      (let ((extension (downcase (symbol-name im-type))))
+       (push
+        (cons  (concat "\\." extension "\\'") 'image-mode)
+        auto-mode-alist)
+       (push
+        (cons  (concat "\\." extension "\\'") 'imagemagick)
+        image-type-file-name-regexps)))))
+
+
 
 (provide 'image)
 
index adecbfaeb1238db9f6674a779fd1a2c6b6c81b85..7116b705affb75ee39748f9c3c35f17d6868276c 100644 (file)
@@ -4,6 +4,7 @@
 ;;   2008, 2009, 2010  Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
@@ -431,7 +432,11 @@ column to indent to; if it is nil, use one of the three methods above."
        (or (eolp)
            (indent-to column 0))
        (forward-line 1))
-      (move-marker end nil))))
+      (move-marker end nil)))
+  ;; In most cases, reindenting modifies the buffer, but it may also
+  ;; leave it unmodified, in which case we have to deactivate the mark
+  ;; by hand.
+  (deactivate-mark))
 
 (defun indent-relative-maybe ()
   "Indent a new line like previous nonblank line.
index 42ec43eee228643aa8c4924acf0e5e73334c64d7..4fa9503b14e5b597ab12ac6766159c1a7f6f4e71 100644 (file)
@@ -238,7 +238,9 @@ This only has an effect if `Info-hide-note-references' is non-nil."
 (defcustom Info-breadcrumbs-depth 4
   "Depth of breadcrumbs to display.
 0 means do not display breadcrumbs."
-  :type 'integer)
+  :version "23.1"
+  :type 'integer
+  :group 'info)
 
 (defcustom Info-search-whitespace-regexp "\\s-+"
   "If non-nil, regular expression to match a sequence of whitespace chars.
@@ -266,6 +268,8 @@ with wrapping around the current Info node."
   :group 'info)
 
 (defvar Info-isearch-initial-node nil)
+(defvar Info-isearch-initial-history nil)
+(defvar Info-isearch-initial-history-list nil)
 
 (defcustom Info-mode-hook
   ;; Try to obey obsolete Info-fontify settings.
@@ -798,17 +802,22 @@ otherwise, that defaults to `Top'."
   "Go to an Info node FILENAME and NODENAME, re-reading disk contents.
 When *info* is already displaying FILENAME and NODENAME, the window position
 is preserved, if possible."
-  (pop-to-buffer "*info*")
+  (or (eq major-mode 'Info-mode) (pop-to-buffer "*info*"))
   (let ((old-filename Info-current-file)
        (old-nodename Info-current-node)
+       (old-buffer-name (buffer-name))
        (pcolumn      (current-column))
        (pline        (count-lines (point-min) (line-beginning-position)))
        (wline        (count-lines (point-min) (window-start)))
+       (old-history-forward Info-history-forward)
        (old-history  Info-history)
        (new-history  (and Info-current-file
                           (list Info-current-file Info-current-node (point)))))
     (kill-buffer (current-buffer))
+    (pop-to-buffer (or old-buffer-name "*info*"))
+    (Info-mode)
     (Info-find-node filename nodename)
+    (setq Info-history-forward old-history-forward)
     (setq Info-history old-history)
     (if (and (equal old-filename Info-current-file)
             (equal old-nodename Info-current-node))
@@ -1914,7 +1923,27 @@ If DIRECTION is `backward', search in the reverse direction."
   (setq Info-isearch-initial-node
        ;; Don't stop at initial node for nonincremental search.
        ;; Otherwise this variable is set after first search failure.
-       (and isearch-nonincremental Info-current-node)))
+       (and isearch-nonincremental Info-current-node))
+  (setq Info-isearch-initial-history      Info-history
+       Info-isearch-initial-history-list Info-history-list)
+  (add-hook 'isearch-mode-end-hook 'Info-isearch-end nil t))
+
+(defun Info-isearch-end ()
+  ;; Remove intermediate nodes (visited while searching)
+  ;; from the history.  Add only the last node (where Isearch ended).
+  (if (> (length Info-history)
+        (length Info-isearch-initial-history))
+      (setq Info-history
+           (nthcdr (- (length Info-history)
+                      (length Info-isearch-initial-history)
+                      1)
+                   Info-history)))
+  (if (> (length Info-history-list)
+        (length Info-isearch-initial-history-list))
+      (setq Info-history-list
+           (cons (car Info-history-list)
+                 Info-isearch-initial-history-list)))
+  (remove-hook 'isearch-mode-end-hook  'Info-isearch-end t))
 
 (defun Info-isearch-filter (beg-found found)
   "Test whether the current search hit is a visible useful text.
@@ -3104,6 +3133,7 @@ Give an empty topic name to go to the Index node itself."
 (add-to-list 'Info-virtual-nodes
             '("\\`\\*Index.*\\*\\'"
               (find-node . Info-virtual-index-find-node)
+              (slow . t)
               ))
 
 (defvar Info-virtual-index-nodes nil
@@ -3193,6 +3223,7 @@ search results."
               (toc-nodes . Info-apropos-toc-nodes)
               (find-file . Info-apropos-find-file)
               (find-node . Info-apropos-find-node)
+              (slow . t)
               ))
 
 (defvar Info-apropos-file "*Apropos*"
@@ -3341,12 +3372,13 @@ Build a menu of the possible matches."
   filename)
 
 (defvar finder-known-keywords)
-(defvar finder-package-info)
 (declare-function find-library-name "find-func" (library))
+(declare-function finder-unknown-keywords "finder" ())
 (declare-function lm-commentary "lisp-mnt" (&optional file))
 
 (defun Info-finder-find-node (filename nodename &optional no-going-back)
   "Finder-specific implementation of Info-find-node-2."
+  (require 'finder)
   (cond
    ((equal nodename "Top")
     ;; Display Top menu with descriptions of the keywords
@@ -3355,14 +3387,63 @@ Build a menu of the possible matches."
     (insert "Finder Keywords\n")
     (insert "***************\n\n")
     (insert "* Menu:\n\n")
+    (dolist (assoc (append '((all . "All package info")
+                            (unknown . "unknown keywords"))
+                          finder-known-keywords))
+      (let ((keyword (car assoc)))
+       (insert (format "* %s %s.\n"
+                       (concat (symbol-name keyword) ": "
+                               "kw:" (symbol-name keyword) ".")
+                       (cdr assoc))))))
+   ((equal nodename "unknown")
+    ;; Display unknown keywords
+    (insert (format "\n\^_\nFile: %s,  Node: %s,  Up: Top\n\n"
+                   Info-finder-file nodename))
+    (insert "Finder Unknown Keywords\n")
+    (insert "***********************\n\n")
+    (insert "* Menu:\n\n")
     (mapc
      (lambda (assoc)
-       (let ((keyword (car assoc)))
-        (insert (format "* %-14s %s.\n"
-                        (concat (symbol-name keyword) "::")
-                        (cdr assoc)))))
-     finder-known-keywords))
-   ((string-match-p "\\.el\\'" nodename)
+       (insert (format "* %-14s %s.\n"
+                      (concat (symbol-name (car assoc)) "::")
+                      (cdr assoc))))
+     (finder-unknown-keywords)))
+   ((equal nodename "all")
+    ;; Display all package info.
+    (insert (format "\n\^_\nFile: %s,  Node: %s,  Up: Top\n\n"
+                   Info-finder-file nodename))
+    (insert "Finder Package Info\n")
+    (insert "*******************\n\n")
+    (dolist (package package-alist)
+      (insert (format "%s - %s\n"
+                     (format "*Note %s::" (nth 0 package))
+                     (nth 1 package)))))
+   ((string-match "\\`kw:" nodename)
+    (setq nodename (substring nodename (match-end 0)))
+    ;; Display packages that match the keyword
+    ;; or the list of keywords separated by comma.
+    (insert (format "\n\^_\nFile: %s,  Node: kw:%s,  Up: Top\n\n"
+                   Info-finder-file nodename))
+    (insert "Finder Packages\n")
+    (insert "***************\n\n")
+    (insert
+     "The following packages match the keyword `" nodename "':\n\n")
+    (insert "* Menu:\n\n")
+    (let ((keywords
+          (mapcar 'intern (if (string-match-p "," nodename)
+                              (split-string nodename ",[ \t\n]*" t)
+                            (list nodename))))
+         hits desc)
+      (dolist (kw keywords)
+       (push (copy-tree (gethash kw finder-keywords-hash)) hits))
+      (setq hits (delete-dups (apply 'append hits)))
+      (dolist (package hits)
+       (setq desc (cdr-safe (assq package package-alist)))
+       (when (vectorp desc)
+         (insert (format "* %-16s %s.\n"
+                         (concat (symbol-name package) "::")
+                         (aref desc 2)))))))
+   (t
     ;; Display commentary section
     (insert (format "\n\^_\nFile: %s,  Node: %s,  Up: Top\n\n"
                    Info-finder-file nodename))
@@ -3383,31 +3464,28 @@ Build a menu of the possible matches."
           (goto-char (point-min))
           (while (re-search-forward "^;+ ?" nil t)
             (replace-match "" nil nil))
-          (buffer-string))))))
-   (t
-    ;; Display packages that match the keyword
-    (insert (format "\n\^_\nFile: %s,  Node: %s,  Up: Top\n\n"
-                   Info-finder-file nodename))
-    (insert "Finder Packages\n")
-    (insert "***************\n\n")
-    (insert
-     "The following packages match the keyword `" nodename "':\n\n")
-    (insert "* Menu:\n\n")
-    (let ((id (intern nodename)))
-      (mapc
-       (lambda (x)
-        (when (memq id (cadr (cdr x)))
-          (insert (format "* %-16s %s.\n"
-                          (concat (car x) "::")
-                          (cadr x)))))
-       finder-package-info)))))
+          (buffer-string))))))))
 
 ;;;###autoload
-(defun info-finder ()
-  "Display descriptions of the keywords in the Finder virtual manual."
-  (interactive)
+(defun info-finder (&optional keywords)
+  "Display descriptions of the keywords in the Finder virtual manual.
+In interactive use, a prefix argument directs this command to read
+a list of keywords separated by comma.  After that, it displays a node
+with a list packages that contain all specified keywords."
+  (interactive
+   (when current-prefix-arg
+     (require 'finder)
+     (list
+      (completing-read-multiple
+       "Keywords (separated by comma): "
+       (mapcar 'symbol-name (mapcar 'car (append finder-known-keywords
+                                                (finder-unknown-keywords))))
+       nil t))))
   (require 'finder)
-  (Info-find-node Info-finder-file "Top"))
+  (if keywords
+      (Info-find-node Info-finder-file (mapconcat 'identity keywords ", "))
+    (Info-find-node Info-finder-file "Top")))
+
 \f
 (defun Info-undefined ()
   "Make command be undefined in Info."
@@ -3685,9 +3763,11 @@ If FORK is non-nil, it is passed to `Info-goto-node'."
 (defvar info-tool-bar-map
   (let ((map (make-sparse-keymap)))
     (tool-bar-local-item-from-menu 'Info-history-back "left-arrow" map Info-mode-map
-                                  :rtl "right-arrow")
+                                  :rtl "right-arrow"
+                                  :label "Back")
     (tool-bar-local-item-from-menu 'Info-history-forward "right-arrow" map Info-mode-map
-                                  :rtl "left-arrow")
+                                  :rtl "left-arrow"
+                                  :label "Forward")
     (tool-bar-local-item-from-menu 'Info-prev "prev-node" map Info-mode-map
                                   :rtl "next-node")
     (tool-bar-local-item-from-menu 'Info-next "next-node" map Info-mode-map
@@ -3695,7 +3775,8 @@ If FORK is non-nil, it is passed to `Info-goto-node'."
     (tool-bar-local-item-from-menu 'Info-up "up-node" map Info-mode-map)
     (tool-bar-local-item-from-menu 'Info-top-node "home" map Info-mode-map)
     (tool-bar-local-item-from-menu 'Info-goto-node "jump-to" map Info-mode-map)
-    (tool-bar-local-item-from-menu 'Info-index "index" map Info-mode-map)
+    (tool-bar-local-item-from-menu 'Info-index "index" map Info-mode-map
+                                  :label "Index Search")
     (tool-bar-local-item-from-menu 'Info-search "search" map Info-mode-map)
     (tool-bar-local-item-from-menu 'Info-exit "exit" map Info-mode-map)
     map))
@@ -3795,7 +3876,7 @@ With a zero prefix arg, put the name inside a function call to `info'."
 
 ;; Autoload cookie needed by desktop.el
 ;;;###autoload
-(defun Info-mode ()
+(define-derived-mode Info-mode nil "Info"
   "Info mode provides commands for browsing through the Info documentation tree.
 Documentation in Info is divided into \"nodes\", each of which discusses
 one topic and contains references to other nodes which discuss related
@@ -3857,23 +3938,17 @@ Advanced commands:
 \\[clone-buffer]       Select a new cloned Info buffer in another window.
 \\[universal-argument] \\[info]        Move to new Info file with completion.
 \\[universal-argument] N \\[info]      Select Info buffer with prefix number in the name *info*<N>."
-  (kill-all-local-variables)
-  (setq major-mode 'Info-mode)
-  (setq mode-name "Info")
+  :syntax-table text-mode-syntax-table
+  :abbrev-table text-mode-abbrev-table
   (setq tab-width 8)
-  (use-local-map Info-mode-map)
   (add-hook 'activate-menubar-hook 'Info-menu-update nil t)
-  (set-syntax-table text-mode-syntax-table)
-  (setq local-abbrev-table text-mode-abbrev-table)
   (setq case-fold-search t)
   (setq buffer-read-only t)
   (make-local-variable 'Info-current-file)
   (make-local-variable 'Info-current-subfile)
   (make-local-variable 'Info-current-node)
-  (make-local-variable 'Info-tag-table-marker)
-  (setq Info-tag-table-marker (make-marker))
-  (make-local-variable 'Info-tag-table-buffer)
-  (setq Info-tag-table-buffer nil)
+  (set (make-local-variable 'Info-tag-table-marker) (make-marker))
+  (set (make-local-variable 'Info-tag-table-buffer) nil)
   (make-local-variable 'Info-history)
   (make-local-variable 'Info-history-forward)
   (make-local-variable 'Info-index-alternatives)
@@ -3882,12 +3957,10 @@ Advanced commands:
            '(:eval (get-text-property (point-min) 'header-line))))
   (set (make-local-variable 'tool-bar-map) info-tool-bar-map)
   ;; This is for the sake of the invisible text we use handling titles.
-  (make-local-variable 'line-move-ignore-invisible)
-  (setq line-move-ignore-invisible t)
-  (make-local-variable 'desktop-save-buffer)
-  (make-local-variable 'widen-automatically)
-  (setq widen-automatically nil)
-  (setq desktop-save-buffer 'Info-desktop-buffer-misc-data)
+  (set (make-local-variable 'line-move-ignore-invisible) t)
+  (set (make-local-variable 'desktop-save-buffer)
+       'Info-desktop-buffer-misc-data)
+  (set (make-local-variable 'widen-automatically) nil)
   (add-hook 'kill-buffer-hook 'Info-kill-buffer nil t)
   (add-hook 'clone-buffer-hook 'Info-clone-buffer nil t)
   (add-hook 'change-major-mode-hook 'font-lock-defontify nil t)
@@ -3906,8 +3979,7 @@ Advanced commands:
        'Info-revert-buffer-function)
   (Info-set-mode-line)
   (set (make-local-variable 'bookmark-make-record-function)
-       'Info-bookmark-make-record)
-  (run-mode-hooks 'Info-mode-hook))
+       'Info-bookmark-make-record))
 
 ;; When an Info buffer is killed, make sure the associated tags buffer
 ;; is killed too.
@@ -4790,27 +4862,42 @@ BUFFER is the buffer speedbar is requesting buttons for."
 
 (defun Info-desktop-buffer-misc-data (desktop-dirname)
   "Auxiliary information to be saved in desktop file."
-  (unless (Info-virtual-file-p Info-current-file)
-    (list Info-current-file Info-current-node)))
+  (list Info-current-file
+       Info-current-node
+       ;; Additional data as an association list.
+       (delq nil (list
+                  (and Info-history
+                       (cons 'history Info-history))
+                  (and (Info-virtual-fun
+                        'slow Info-current-file Info-current-node)
+                       (cons 'slow t))))))
 
 (defun Info-restore-desktop-buffer (desktop-buffer-file-name
                                     desktop-buffer-name
                                     desktop-buffer-misc)
   "Restore an Info buffer specified in a desktop file."
-  (let ((first (nth 0 desktop-buffer-misc))
-        (second (nth 1 desktop-buffer-misc)))
-  (when (and first second)
-    (when desktop-buffer-name
-      (set-buffer (get-buffer-create desktop-buffer-name))
-      (Info-mode))
-    (Info-find-node first second)
-    (current-buffer))))
+  (let* ((file (nth 0 desktop-buffer-misc))
+        (node (nth 1 desktop-buffer-misc))
+        (data (nth 2 desktop-buffer-misc))
+        (hist (assq 'history data))
+        (slow (assq 'slow data)))
+    ;; Don't restore nodes slow to regenerate.
+    (unless slow
+      (when (and file node)
+       (when desktop-buffer-name
+         (set-buffer (get-buffer-create desktop-buffer-name))
+         (Info-mode))
+       (Info-find-node file node)
+       (when hist
+         (setq Info-history (cdr hist)))
+       (current-buffer)))))
 
 (add-to-list 'desktop-buffer-mode-handlers
             '(Info-mode . Info-restore-desktop-buffer))
 
 ;;;; Bookmark support
-(declare-function bookmark-make-record-default "bookmark" (&optional pos-only))
+(declare-function bookmark-make-record-default
+                  "bookmark" (&optional no-file no-context posn))
 (declare-function bookmark-prop-get "bookmark" (bookmark prop))
 (declare-function bookmark-default-handler "bookmark" (bmk))
 (declare-function bookmark-get-bookmark-record "bookmark" (bmk))
@@ -4819,7 +4906,7 @@ BUFFER is the buffer speedbar is requesting buttons for."
   "This implements the `bookmark-make-record-function' type (which see)
 for Info nodes."
   `(,Info-current-node
-    ,@(bookmark-make-record-default 'point-only)
+    ,@(bookmark-make-record-default 'no-file)
     (filename . ,Info-current-file)
     (info-node . ,Info-current-node)
     (handler . Info-bookmark-jump)))
index db3ae0a51116307cec107d489f5c05bbd19bf497..5c3efcc9d07676172ea168f6b6e56e5fd0bcda32 100644 (file)
@@ -1,4 +1,4 @@
-;; Copyright (C) 1991-2009 Unicode, Inc.
+;; Copyright (C) 1991-2010 Unicode, Inc.
 ;; This file was generated from the Unicode data file at
 ;; http://www.unicode.org/Public/UNIDATA/UnicodeData.txt.
 ;; See lisp/international/README for the copyright and permission notice.
index ecb2088de89fc17d4fa19dc3d189d1f0fc1db71b..753b1ab25e7e36fb042d400814c434597e847a3c 100644 (file)
               (nil . "koi8-r"))
 
      (arabic ,(font-spec :registry "iso10646-1"
-                        :otf '(arab nil (init medi fini liga)))
+                        :otf '(arab nil (init medi fina liga)))
             (nil . "MuleArabic-0")
             (nil . "MuleArabic-1")
             (nil . "MuleArabic-2")
index 268f4c8990012e2b7e44cb8645dcabe1ae0c4afc..bbfc494a46d81175e050c6d7820688472497a705 100644 (file)
@@ -33,6 +33,7 @@
 ;;; Code:
 
 (require 'disp-table)
+(eval-when-compile (require 'cl))
 
 (defgroup iso-ascii nil
   "Set up char tables for ISO 8859/1 on ASCII terminals."
 (iso-ascii-display 254 "th")  ; small thorn, Icelandic
 (iso-ascii-display 255 "\"y") ; small y with diaeresis or umlaut mark
 
-(defun iso-ascii-mode (arg)
+(define-minor-mode iso-ascii-mode
   "Toggle ISO-ASCII mode."
-  (interactive "P")
-  (unless arg
-    (setq arg (eq standard-display-table iso-ascii-standard-display-table)))
-  (setq standard-display-table
-       (if arg
-           iso-ascii-display-table
-         iso-ascii-standard-display-table)))
+  :variable (eq standard-display-table iso-ascii-display-table)
+  (unless standard-display-table
+    (setq standard-display-table iso-ascii-standard-display-table)))
 
 (provide 'iso-ascii)
 
index 871bab2001305394618107ad60bc209c0b69f8e6..a3609c0ccfc053936b40141d87ccca78e278ac60 100644 (file)
 
     (define-key-after map [describe-language-environment]
       `(menu-item ,(purecopy "Describe Language Environment")
-            describe-language-environment-map
+            ,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
@@ -286,9 +286,8 @@ 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 (((default-value 'enable-multibyte-characters) t)
-        (coding-system-for-read 'iso-2022-7bit))
-       (view-file (expand-file-name "HELLO" data-directory))))
+  (letf ((coding-system-for-read 'iso-2022-7bit))
+    (view-file (expand-file-name "HELLO" data-directory))))
 
 (defun universal-coding-system-argument (coding-system)
   "Execute an I/O command using the specified coding system."
@@ -2180,7 +2179,7 @@ See `set-language-info-alist' for use in programs."
     ("af" . "Latin-1") ; Afrikaans
     ("am" "Ethiopic" utf-8) ; Amharic
     ("an" . "Latin-9") ; Aragonese
-    ; ar Arabic glibc uses 8859-6
+    ("ar" . "Arabic")
     ; as Assamese
     ; ay Aymara
     ("az" . "UTF-8") ; Azerbaijani
@@ -2883,8 +2882,10 @@ on encoding."
   :group 'mule
   :global t)
 
-(defvar nonascii-insert-offset 0 "This variable is obsolete.")
-(defvar nonascii-translation-table nil "This variable is obsolete.")
+(defvar nonascii-insert-offset 0)
+(make-obsolete-variable 'nonascii-insert-offset "do not use it." "23.1")
+(defvar nonascii-translation-table nil)
+(make-obsolete-variable 'nonascii-translation-table "do not use it." "23.1")
 
 (defvar ucs-names nil
   "Alist of cached (CHAR-NAME . CHAR-CODE) pairs.")
@@ -2894,15 +2895,19 @@ on encoding."
   (or ucs-names
       (let ((bmp-ranges
             '((#x0000 . #x33FF)
-              ;; (#x3400 . #x4DBF) CJK Ideograph Extension A
+              ;; (#x3400 . #x4DBF) CJK Ideographs Extension A
               (#x4DC0 . #x4DFF)
-              ;; (#x4E00 . #x9FFF) CJK Ideograph
-              (#xA000 . #x0D7FF)
+              ;; (#x4E00 . #x9FFF) CJK Unified Ideographs
+              (#xA000 . #xD7FF)
               ;; (#xD800 . #xFAFF) Surrogate/Private
               (#xFB00 . #xFFFD)))
            (upper-ranges
             '((#x10000 . #x134FF)
-              ;; (#x13500 . #x1CFFF) unused
+              ;; (#x13500 . #x167FF) unused
+              (#x16800 . #x16A3F)
+              ;; (#x16A40 . #x1AFFF) unused
+              (#x1B000 . #x1B0FF)
+              ;; (#x1B100 . #x1CFFF) unused
               (#x1D000 . #x1FFFF)
               ;; (#x20000 . #xDFFFF) CJK Ideograph Extension A, B, etc, unused
               (#xE0000 . #xE01FF)))
index 105163a5d118635b716b7927a22a0c8964bfe607..9f1833924b36d288f64f1f3b886c26d9598f43ed 100644 (file)
@@ -326,8 +326,7 @@ Return t if file exists."
            (with-current-buffer buffer
               ;; So that we don't get completely screwed if the
               ;; file is encoded in some complicated character set,
-              ;; read it with real decoding, as a multibyte buffer,
-              ;; even if this is a --unibyte Emacs session.
+              ;; read it with real decoding, as a multibyte buffer.
               (set-buffer-multibyte t)
              ;; Don't let deactivate-mark remain set.
              (let (deactivate-mark)
@@ -346,12 +345,7 @@ Return t if file exists."
            (eval-buffer buffer nil
                         ;; This is compatible with what `load' does.
                         (if purify-flag file fullname)
-                        ;; If this Emacs is running with --unibyte,
-                        ;; convert multibyte strings to unibyte
-                        ;; after reading them.
-;;                      (not (default-value 'enable-multibyte-characters))
-                        nil t
-                        ))
+                        nil t))
        (let (kill-buffer-hook kill-buffer-query-functions)
          (kill-buffer buffer)))
       (do-after-load-evaluation fullname)
@@ -609,9 +603,8 @@ VALUE must be one of `charset', `utf-8', `utf-16', `iso-2022',
 VALUE is the EOL (end-of-line) format of the coding system.  It must be
 one of `unix', `dos', `mac'.  The symbol `unix' means Unix-like EOL
 \(i.e. single LF), `dos' means DOS-like EOL \(i.e. sequence of CR LF),
-and `mac' means Mac-like EOL \(i.e. single CR).  If omitted, on
-decoding by the coding system, Emacs automatically detects the EOL
-format of the source text.
+and `mac' means Mac-like EOL \(i.e. single CR).  If omitted, Emacs
+detects the EOL format automatically when decoding.
 
 `:charset-list'
 
@@ -665,13 +658,6 @@ the coding system is replaced with VALUE.
 VALUE non-nil means that visiting a file with the coding system
 results in a unibyte buffer.
 
-`:eol-type'
-
-VALUE must be `unix', `dos', `mac'.  The symbol `unix' means Unix-like
-EOL (LF), `dos' means DOS-like EOL (CRLF), and `mac' means Mac-like
-EOL (CR).  If omitted, on decoding, the coding system detects EOL
-format automatically, and on encoding, uses Unix-like EOL.
-
 `:mime-charset'
 
 VALUE must be a symbol whose name is that of a MIME charset converted
@@ -1166,6 +1152,64 @@ Internal use only.")
 (make-variable-buffer-local 'buffer-file-coding-system-explicit)
 (put 'buffer-file-coding-system-explicit 'permanent-local t)
 
+(defun read-buffer-file-coding-system ()
+  (let* ((bcss (find-coding-systems-region (point-min) (point-max)))
+         (css-table
+          (unless (equal bcss '(undecided))
+            (append '("dos" "unix" "mac")
+                    (delq nil (mapcar (lambda (cs)
+                                        (if (memq (coding-system-base cs) bcss)
+                                            (symbol-name cs)))
+                                      coding-system-list)))))
+         (combined-table
+          (if css-table
+              (completion-table-in-turn css-table coding-system-alist)
+            coding-system-alist))
+         (auto-cs
+          (unless find-file-literally
+            (save-excursion
+              (save-restriction
+                (widen)
+                (goto-char (point-min))
+                (funcall set-auto-coding-function
+                         (or buffer-file-name "") (buffer-size))))))
+         (preferred
+          (let ((bfcs (default-value 'buffer-file-coding-system)))
+            (cons (and (or (equal bcss '(undecided))
+                           (memq (coding-system-base bfcs) bcss))
+                       bfcs)
+                  (mapcar (lambda (cs)
+                            (and (coding-system-p cs)
+                                 (coding-system-get cs :mime-charset)
+                                 (or (equal bcss '(undecided))
+                                     (memq (coding-system-base cs) bcss))
+                                 cs))
+                          (coding-system-priority-list)))))
+         (default
+           (let ((current (coding-system-base buffer-file-coding-system)))
+             ;; Generally use as a default the first preferred coding-system
+             ;; different from the current coding-system, except for
+             ;; the case of auto-cs since choosing anything else is asking
+             ;; for trouble (would lead to using a different coding
+             ;; system than specified in the coding tag).
+             (or auto-cs
+                 (car (delq nil
+                            (mapcar (lambda (cs)
+                                      (if (eq current (coding-system-base cs))
+                                          nil
+                                        cs))
+                                    preferred))))))
+         (completion-ignore-case t)
+         (completion-pcm--delim-wild-regex ; Let "u8" complete to "utf-8".
+          (concat completion-pcm--delim-wild-regex
+                  "\\|\\([[:alpha:]]\\)[[:digit:]]"))
+         (cs (completing-read
+              (format "Coding system for saving file (default %s): " default)
+              combined-table
+              nil t nil 'coding-system-history
+              (if default (symbol-name default)))))
+    (unless (zerop (length cs)) (intern cs))))
+
 (defun set-buffer-file-coding-system (coding-system &optional force nomodify)
   "Set the file coding-system of the current buffer to CODING-SYSTEM.
 This means that when you save the buffer, it will be converted
@@ -1183,19 +1227,26 @@ surely saves the buffer with CODING-SYSTEM.  From a program, if you
 don't want to mark the buffer modified, specify t for NOMODIFY.
 If you know exactly what coding system you want to use,
 just set the variable `buffer-file-coding-system' directly."
-  (interactive "zCoding system for saving file (default nil): \nP")
+  (interactive
+   (list (read-buffer-file-coding-system)
+         current-prefix-arg))
   (check-coding-system coding-system)
   (if (and coding-system buffer-file-coding-system (null force))
       (setq coding-system
            (merge-coding-systems coding-system buffer-file-coding-system)))
+  (when (called-interactively-p 'interactive)
+    ;; Check whether save would succeed, and jump to the offending char(s)
+    ;; if not.
+    (let ((css (find-coding-systems-region (point-min) (point-max))))
+      (unless (or (eq (car css) 'undecided)
+                  (memq (coding-system-base coding-system) css))
+        (setq coding-system (select-safe-coding-system-interactively
+                             (point-min) (point-max) css
+                             (list coding-system))))))
   (setq buffer-file-coding-system coding-system)
   (if buffer-file-coding-system-explicit
       (setcdr buffer-file-coding-system-explicit coding-system)
     (setq buffer-file-coding-system-explicit (cons nil coding-system)))
-  ;; This is in case of an explicit call.  Normally, `normal-mode' and
-  ;; `set-buffer-major-mode-hook' take care of setting the table.
-  (if (fboundp 'ucs-set-table-for-input) ; don't lose when building
-      (ucs-set-table-for-input))
   (unless nomodify
     (set-buffer-modified-p t))
   (force-mode-line-update))
@@ -1623,8 +1674,8 @@ in-place."
   ;; self-extracting exe archives.
   (mapcar (lambda (arg) (cons (purecopy (car arg)) (cdr arg)))
          '(("\\.\\(\
-arc\\|zip\\|lzh\\|lha\\|zoo\\|[jew]ar\\|xpi\\|rar\\|\
-ARC\\|ZIP\\|LZH\\|LHA\\|ZOO\\|[JEW]AR\\|XPI\\|RAR\\)\\'"
+arc\\|zip\\|lzh\\|lha\\|zoo\\|[jew]ar\\|xpi\\|rar\\|7z\\|\
+ARC\\|ZIP\\|LZH\\|LHA\\|ZOO\\|[JEW]AR\\|XPI\\|RAR\\|7Z\\)\\'"
      . no-conversion-multibyte)
     ("\\.\\(exe\\|EXE\\)\\'" . no-conversion)
     ("\\.\\(sx[dmicw]\\|odt\\|tar\\|tgz\\)\\'" . no-conversion)
@@ -2127,8 +2178,7 @@ character, say TO-ALT, FROM is also translated to TO-ALT."
 (defun make-translation-table-from-vector (vec)
   "Make translation table from decoding vector VEC.
 VEC is an array of 256 elements to map unibyte codes to multibyte
-characters.  Elements may be nil for undefined code points.
-See also the variable `nonascii-translation-table'."
+characters.  Elements may be nil for undefined code points."
   (let ((table (make-char-table 'translation-table))
        (rev-table (make-char-table 'translation-table))
        ch)
@@ -2247,13 +2297,12 @@ It returns the number of characters changed."
        (setq table val)))
   (translate-region-internal start end table))
 
-(put 'with-category-table 'lisp-indent-function 1)
-
 (defmacro with-category-table (table &rest body)
   "Execute BODY like `progn' with TABLE the current category table.
 The category table of the current buffer is saved, BODY is evaluated,
 then the saved table is restored, even in case of an abnormal exit.
 Value is what BODY returns."
+  (declare (indent 1) (debug t))
   (let ((old-table (make-symbol "old-table"))
        (old-buffer (make-symbol "old-buffer")))
     `(let ((,old-table (category-table))
index 9959b275943075c7300a4bee8ea5a9d3c454b704..621f314bf70c782329174a6c6604d024f99a1a70 100644 (file)
@@ -811,7 +811,7 @@ The format of KBD-LAYOUT is the same as `quail-keyboard-layout'."
                      (setq translation (aref (cdr translation) 0))
                    (setq translation " ")))
              (setq done-list (cons translation done-list)))
-         (setq translation ch))
+         (setq translation (aref kbd-layout i)))
        (aset layout i translation))
       (setq i (1+ i)))
 
index 1afd451994cc2257f5dcc5b57b4bf9b6363af33e..7902810442be049925243bf66ac0d4c87aafaae3 100644 (file)
Binary files a/lisp/international/uni-bidi.el and b/lisp/international/uni-bidi.el differ
index a410af138520260e93b40559d09963c35eabd626..b81045f1a0ef184a86a71d852f8402573c02dc53 100644 (file)
Binary files a/lisp/international/uni-category.el and b/lisp/international/uni-category.el differ
index ff26fa9519d58888865235a85463a48ba19e0802..1aca7ee1d116436537e50712a10d74a965de1938 100644 (file)
Binary files a/lisp/international/uni-combining.el and b/lisp/international/uni-combining.el differ
index be62ed3ff69b912603d0efdd8d23a3b4720f691c..dcc717977c726fb2e4ad42c697627c29a7655fae 100644 (file)
Binary files a/lisp/international/uni-comment.el and b/lisp/international/uni-comment.el differ
index 410390dc9c2b1b14a11282d3dd978e9be186695f..517280885b879b92f15d28b70c817af778ee882c 100644 (file)
Binary files a/lisp/international/uni-decimal.el and b/lisp/international/uni-decimal.el differ
index 76e05f2ccec1d421a500a8d9a5221f3e693ff500..f35bcebfed8ed607c4cce0daafcb15a5266ef5b8 100644 (file)
Binary files a/lisp/international/uni-decomposition.el and b/lisp/international/uni-decomposition.el differ
index 023ddcb71b0b740b148ea84d69153993dcfe7269..692dea1edc8007a5a327f8a27f8abbe1f3bc33fa 100644 (file)
Binary files a/lisp/international/uni-digit.el and b/lisp/international/uni-digit.el differ
index 6574cc7a9c48c9d7bed5f71c908546491bce8a76..7cc601159f0788ffe756934fafa803dc29c18d3e 100644 (file)
Binary files a/lisp/international/uni-lowercase.el and b/lisp/international/uni-lowercase.el differ
index dfdccfd2560c9572a4e876f84177e9a1fce8d30f..a1e2e69dfaa73f24b516ec13a733ec72e5a01e7a 100644 (file)
Binary files a/lisp/international/uni-mirrored.el and b/lisp/international/uni-mirrored.el differ
index 7ee5e104a0a3a166db013541f52f200623bf4cbb..335957e9548e6cba5585f4645045f20b2d6ab2f9 100644 (file)
Binary files a/lisp/international/uni-name.el and b/lisp/international/uni-name.el differ
index 9ef409e509be5befc00c14a5adb9aa0d16a6c748..278ad683fe43bc553af50d891ccdedad6f22f5d2 100644 (file)
Binary files a/lisp/international/uni-numeric.el and b/lisp/international/uni-numeric.el differ
index a6e1f64345832f5e1454ff50c18fe2587db5e9dc..2e28349240897050b13126e13bcaaff56b7dfd96 100644 (file)
Binary files a/lisp/international/uni-old-name.el and b/lisp/international/uni-old-name.el differ
index ed8121e2daf8c8e8adbf97f202281b7f899b72ab..729a469d10388417b341c0590d0748b46b0fff0b 100644 (file)
Binary files a/lisp/international/uni-titlecase.el and b/lisp/international/uni-titlecase.el differ
index 1652caf43598c1dc208a09689467e5b6d8a16ed2..0714b14794f38aa93bc14c8d661f20ae2c52a0e4 100644 (file)
Binary files a/lisp/international/uni-uppercase.el and b/lisp/international/uni-uppercase.el differ
index 831ccd391cf915f3bae39edf9ce31a08925f9fef..c2cd634674594500c2a98e8283589977d0011cf8 100644 (file)
@@ -62,7 +62,7 @@ IMAP non-nil means use the IMAP version."
                (decode-coding-region p (point) 'utf-16be)
                (save-excursion
                  (goto-char p)
-                 (delete-backward-char 1)))))))
+                 (delete-char -1)))))))
       (- (point-max) (point-min)))))
 
 ;;;###autoload
index 7071497cbfb903a11daaa6f3a5817b21de98a8e7..f18a74c59b5b6e5ce82bba89920f22cad2864f2d 100644 (file)
@@ -7,6 +7,7 @@
 ;; Author: Daniel LaLiberte <liberte@cs.uiuc.edu>
 ;; Maintainer: FSF
 ;; Keywords: matching
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
@@ -156,6 +157,9 @@ command history."
 (defvar isearch-mode-hook nil
   "Function(s) to call after starting up an incremental search.")
 
+(defvar isearch-update-post-hook nil
+  "Function(s) to call after isearch has found matches in the buffer.")
+
 (defvar isearch-mode-end-hook nil
   "Function(s) to call after terminating an incremental search.
 When these functions are called, `isearch-mode-end-hook-quit'
@@ -460,7 +464,9 @@ This is like `describe-bindings', but displays only Isearch keys."
     (define-key map "\M-\C-y" 'isearch-yank-char)
     (define-key map    "\C-y" 'isearch-yank-line)
 
-    (define-key map "\C-h" isearch-help-map)
+    (define-key map (char-to-string help-char) isearch-help-map)
+    (define-key map [help] isearch-help-map)
+    (define-key map [f1] isearch-help-map)
 
     (define-key map "\M-n" 'isearch-ring-advance)
     (define-key map "\M-p" 'isearch-ring-retreat)
@@ -868,7 +874,8 @@ It is called by the function `isearch-forward' and other related functions."
     (isearch-lazy-highlight-new-loop))
   ;; We must prevent the point moving to the end of composition when a
   ;; part of the composition has just been searched.
-  (setq disable-point-adjustment t))
+  (setq disable-point-adjustment t)
+  (run-hooks 'isearch-update-post-hook))
 
 (defun isearch-done (&optional nopush edit)
   "Exit Isearch mode.
@@ -1476,14 +1483,10 @@ If search string is empty, just beep."
           (eq 'not-yanks search-upper-case))
       (setq string (downcase string)))
   (if isearch-regexp (setq string (regexp-quote string)))
-  (setq isearch-string (concat isearch-string string)
-       isearch-message
-       (concat isearch-message
-               (mapconcat 'isearch-text-char-description
-                          string ""))
-       ;; Don't move cursor in reverse search.
-       isearch-yank-flag t)
-  (isearch-search-and-update))
+  ;; Don't move cursor in reverse search.
+  (setq isearch-yank-flag t)
+  (isearch-process-search-string
+   string (mapconcat 'isearch-text-char-description string "")))
 
 (defun isearch-yank-kill ()
   "Pull string from kill ring into search string."
@@ -1538,14 +1541,18 @@ or it might return the position of the end of the line."
   (interactive "p")
   (isearch-yank-internal (lambda () (forward-char arg) (point))))
 
+(declare-function subword-forward "subword" (&optional arg))
 (defun isearch-yank-word-or-char ()
-  "Pull next character or word from buffer into search string."
+  "Pull next character, subword or word from buffer into search string.
+Subword is used when `subword-mode' is activated. "
   (interactive)
   (isearch-yank-internal
    (lambda ()
      (if (or (= (char-syntax (or (char-after) 0)) ?w)
              (= (char-syntax (or (char-after (1+ (point))) 0)) ?w))
-         (forward-word 1)
+        (if (and (boundp 'subword-mode) subword-mode)
+            (subword-forward 1)
+          (forward-word 1))
        (forward-char 1)) (point))))
 
 (defun isearch-yank-word ()
@@ -1708,9 +1715,10 @@ Scroll-bar or mode-line events are processed appropriately."
 ;; attempts this, we scroll the text back again.
 ;;
 ;; We implement this feature with a property called `isearch-scroll'.
-;; If a command's symbol has the value t for this property it is a
-;; scrolling command.  The feature needs to be enabled by setting the
-;; customizable variable `isearch-allow-scroll' to a non-nil value.
+;; If a command's symbol has the value t for this property or for the
+;; `scroll-command' property, it is a scrolling command.  The feature
+;; needs to be enabled by setting the customizable variable
+;; `isearch-allow-scroll' to a non-nil value.
 ;;
 ;; The universal argument commands (e.g. C-u) in simple.el are marked
 ;; as scrolling commands, and isearch.el has been amended to allow
@@ -1727,12 +1735,11 @@ Scroll-bar or mode-line events are processed appropriately."
 (if (fboundp 'w32-handle-scroll-bar-event)
     (put 'w32-handle-scroll-bar-event 'isearch-scroll t))
 
-;; Commands which scroll the window:
+;; Commands which scroll the window (some scroll commands
+;; already have the `scroll-command' property on them):
 (put 'recenter 'isearch-scroll t)
 (put 'recenter-top-bottom 'isearch-scroll t)
 (put 'reposition-window 'isearch-scroll t)
-(put 'scroll-up 'isearch-scroll t)
-(put 'scroll-down 'isearch-scroll t)
 
 ;; Commands which act on the other window
 (put 'list-buffers 'isearch-scroll t)
@@ -1757,7 +1764,7 @@ Scroll-bar or mode-line events are processed appropriately."
   "Whether scrolling is allowed during incremental search.
 If non-nil, scrolling commands can be used in Isearch mode.
 However, the current match will never scroll offscreen.
-If nil, scolling commands will first cancel Isearch mode."
+If nil, scrolling commands will first cancel Isearch mode."
   :type 'boolean
   :group 'isearch)
 
@@ -1821,7 +1828,8 @@ Otherwise return nil."
   (let* ((overriding-terminal-local-map nil)
          (binding (key-binding key-seq)))
     (and binding (symbolp binding) (commandp binding)
-         (eq (get binding 'isearch-scroll) t)
+         (or (eq (get binding 'isearch-scroll) t)
+            (eq (get binding 'scroll-command) t))
          binding)))
 
 (defalias 'isearch-other-control-char 'isearch-other-meta-char)
@@ -2665,6 +2673,8 @@ Attempt to do the search exactly the way the pending Isearch would."
          ;; Clear RETRY unless the search predicate says
          ;; to skip this search hit.
          (if (or (not success)
+                 (= (point) bound) ; like (bobp) (eobp) in `isearch-search'.
+                 (= (match-beginning 0) (match-end 0))
                  (funcall isearch-filter-predicate
                           (match-beginning 0) (match-end 0)))
              (setq retry nil)))
index dbe1cbe23e1b54e75a5865a8e64b352185a6852c..cc250567ad89539d1082b701f80d8855041a4f76 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Author: Gerd Moellmann <gerd@gnu.org>
 ;; Keywords: faces files
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
 (eval-when-compile
   (require 'cl)
 
-  (defmacro with-buffer-unmodified (&rest body)
-    "Eval BODY, preserving the current buffer's modified state."
-    (declare (debug t))
-    (let ((modified (make-symbol "modified")))
-      `(let ((,modified (buffer-modified-p)))
-        (unwind-protect
-            (progn ,@body)
-          (unless ,modified
-            (restore-buffer-modified-p nil))))))
-
   (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."
     (declare (debug t))
-    `(let ((buffer-undo-list t)
-           (inhibit-read-only t)
-           (inhibit-point-motion-hooks t)
-           (inhibit-modification-hooks t)
-           deactivate-mark
-           buffer-file-name
-           buffer-file-truename)
-       ;; Do reset the modification status from within the let, since
-       ;; otherwise set-buffer-modified-p may try to unlock the file.
-       (with-buffer-unmodified
-           ,@body))))
-
-
+    `(let ((inhibit-point-motion-hooks t))
+       (with-silent-modifications
+         ,@body))))
 \f
 ;;; Customization.
 
index da8512d7fb90dd79144074ebf163d3a46650bfe0..68f564c488f8ac999d558b0f6639278d407c9fc9 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: jka@ece.cmu.edu (Jay K. Adams)
 ;; Maintainer: FSF
 ;; Keywords: data
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
@@ -334,6 +335,7 @@ Return the new status of auto compression (non-nil means on)."
 
 (defmacro with-auto-compression-mode (&rest body)
   "Evalute BODY with automatic file compression and uncompression enabled."
+  (declare (indent 0))
   (let ((already-installed (make-symbol "already-installed")))
     `(let ((,already-installed (jka-compr-installed-p)))
        (unwind-protect
@@ -343,8 +345,6 @@ Return the new status of auto compression (non-nil means on)."
             ,@body)
         (unless ,already-installed
           (jka-compr-uninstall))))))
-(put 'with-auto-compression-mode 'lisp-indent-function 0)
-
 
 ;; This is what we need to know about jka-compr-handler
 ;; in order to decide when to call it.
index 34ffcc90a76d23130574cb1b8fcd83666d2c6304..3f0ff542212b0afe5d781a46d2663e5d77017303 100644 (file)
@@ -181,7 +181,8 @@ to keep: LEN chars starting BEG chars from the beginning."
                          null-device))
                        jka-compr-acceptable-retval-list)
                  (jka-compr-error prog args infile message err-file))
-           (jka-compr-delete-temp-file err-file)))
+           (delete-file err-file)))
+
       ;; Run the uncompression program directly.
       ;; We get the whole file and must delete what we don't want.
       (jka-compr-call-process prog message infile t nil args))
@@ -222,7 +223,7 @@ to keep: LEN chars starting BEG chars from the beginning."
                                           "")))
                   jka-compr-acceptable-retval-list)
                  (jka-compr-error prog args infile message err-file))
-           (jka-compr-delete-temp-file err-file)))
+           (delete-file err-file)))
       (or (eq 0
              (apply 'call-process
                     prog infile (if (stringp output) temp output)
@@ -248,9 +249,6 @@ There should be no more than seven characters after the final `/'."
   "This routine will return the name of a new file."
   (make-temp-file jka-compr-temp-name-template))
 
-(defalias 'jka-compr-delete-temp-file 'delete-file)
-
-
 (defun jka-compr-write-region (start end file &optional append visit)
   (let* ((filename (expand-file-name file))
         (visit-file (if (stringp visit) (expand-file-name visit) filename))
@@ -337,7 +335,7 @@ There should be no more than seven characters after the final `/'."
                                                (and append can-append) 'dont))
              (erase-buffer)) )
 
-         (jka-compr-delete-temp-file temp-file)
+         (delete-file temp-file)
 
          (and
           compress-message
@@ -603,7 +601,7 @@ There should be no more than seven characters after the final `/'."
              (setq file (file-name-sans-extension file)))
            (setcar l file)))
 
-      (jka-compr-delete-temp-file local-copy))
+      (delete-file local-copy))
 
     t))
 
index c2bedf35339553a0afa630a6b51e6950089b3a84..439c7383223c6c7e5e678aa3584854ccae1e20fb 100644 (file)
@@ -642,11 +642,13 @@ others, use \\[kmacro-name-last-macro]."
                       kmacro-call-repeat-key)))
       (setq repeat-key-str (format-kbd-macro (vector repeat-key) nil))
       (while repeat-key
-       (message "(Type %s to repeat macro%s)"
-                repeat-key-str
-                (if (and kmacro-call-repeat-with-arg
-                         arg (> arg 1))
-                    (format " %d times" arg) ""))
+       ;; 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)
index 8d9b2d9f0cd31b903dfed4a84b99c6429d19478b..ee5073d308f0b765d56b1802c9da22edb269f211 100644 (file)
@@ -869,7 +869,7 @@ Otherwise, [0-9A-F]."
     (goto-char (point-min))
     (while (re-search-forward "[ሀ-፼]" nil t)
       (setq ucode (preceding-char))
-      (delete-backward-char 1)
+      (delete-char -1)
       (insert
        (format (if ethio-java-save-lowercase "\\u%4x" "\\u%4X")
               ucode)))))
index 993df98b3a6b633a75ea2e6b0d00d6369d3f0271..24ddfb2c11f6a4444fca36d69827b07d3554b3ff 100644 (file)
@@ -1,4 +1,4 @@
-;;; hebrew.el --- support for Hebrew -*- coding: iso-2022-7bit; no-byte-compile: t -*-
+;;; hebrew.el --- support for Hebrew -*- coding: utf-8 -*-
 
 ;; Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
 ;;   Free Software Foundation, Inc.
 (define-coding-system-alias 'iso-8859-8 'hebrew-iso-8bit)
 
 ;; These are for Explicit and Implicit directionality information, as
-;; defined in RFC 1556.  We don't yet support directional information
-;; in bidi languages, so these aliases are a lie, especially as far as
-;; iso-8859-8-e is concerned.  FIXME.
+;; defined in RFC 1556.
 (define-coding-system-alias 'iso-8859-8-e 'hebrew-iso-8bit)
 (define-coding-system-alias 'iso-8859-8-i 'hebrew-iso-8bit)
 
 (set-language-info-alist
- "Hebrew" '((charset iso-8859-8)
+ "Hebrew" '((tutorial . "TUTORIAL.he")
+           (charset iso-8859-8)
            (coding-priority hebrew-iso-8bit)
            (coding-system hebrew-iso-8bit windows-1255 cp862)
            (nonascii-translation . iso-8859-8)
            (input-method . "hebrew")
            (unibyte-display . hebrew-iso-8bit)
-           (sample-text . "Hebrew      \e,Hylem\e(B")
-           (documentation . "Right-to-left writing is not yet supported.")))
+           (sample-text . "Hebrew      שלום")
+           (documentation . "Bidirectional editing is supported.")))
 
 (set-language-info-alist
  "Windows-1255" '((coding-priority windows-1255)
                  (coding-system windows-1255)
                  (documentation . "\
 Support for Windows-1255 encoding, e.g. for Yiddish.
-Right-to-left writing is not yet supported.")))
+Bidirectional editing is supported.")))
 
 (define-coding-system 'windows-1255
   "windows-1255 (Hebrew) encoding (MIME: WINDOWS-1255)"
@@ -85,6 +84,179 @@ Right-to-left writing is not yet supported.")))
   :mime-charset 'cp862)
 (define-coding-system-alias 'ibm862 'cp862)
 
+;; Return a nested alist of Hebrew character sequences vs the
+;; corresponding glyph of FONT-OBJECT.
+(defun hebrew-font-get-precomposed (font-object)
+  (let ((precomposed (font-get font-object 'hebrew-precomposed))
+       ;; Vector of Hebrew precomposed charaters.
+       (chars [#xFB2A #xFB2B #xFB2C #xFB2D #xFB2E #xFB2F #xFB30 #xFB31
+               #xFB32 #xFB33 #xFB34 #xFB35 #xFB36 #xFB38 #xFB39 #xFB3A
+               #xFB3B #xFB3C #xFB3E #xFB40 #xFB41 #xFB43 #xFB44 #xFB46
+               #xFB47 #xFB48 #xFB49 #xFB4A #xFB4B #xFB4C #xFB4D #xFB4E])
+       ;; Vector of decomposition character sequences corresponding
+       ;; to the above vector.
+       (decomposed 
+        [[#x05E9 #x05C1]
+         [#x05E9 #x05C2]
+         [#x05E9 #x05BC #x05C1]
+         [#x05E9 #x05BC #x05C2]
+         [#x05D0 #x05B7]
+         [#x05D0 #x05B8]
+         [#x05D0 #x05BC]
+         [#x05D1 #x05BC]
+         [#x05D2 #x05BC]
+         [#x05D3 #x05BC]
+         [#x05D4 #x05BC]
+         [#x05D5 #x05BC]
+         [#x05D6 #x05BC]
+         [#x05D8 #x05BC]
+         [#x05D9 #x05BC]
+         [#x05DA #x05BC]
+         [#x05DB #x05BC]
+         [#x05DC #x05BC]
+         [#x05DE #x05BC]
+         [#x05E0 #x05BC]
+         [#x05E1 #x05BC]
+         [#x05E3 #x05BC]
+         [#x05E4 #x05BC]
+         [#x05E6 #x05BC]
+         [#x05E7 #x05BC]
+         [#x05E8 #x05BC]
+         [#x05E9 #x05BC]
+         [#x05EA #x05BC]
+         [#x05D5 #x05B9]
+         [#x05D1 #x05BF]
+         [#x05DB #x05BF]
+         [#x05E4 #x05BF]]))
+    (unless precomposed
+      (setq precomposed (list t))
+      (let ((gvec (font-get-glyphs font-object 0 (length chars) chars)))
+       (dotimes (i (length chars))
+         (if (aref gvec i)
+             (set-nested-alist (aref decomposed i) (aref gvec i)
+                               precomposed))))
+      ;; Cache the result in FONT-OBJECT's property.
+      (font-put font-object 'hebrew-precomposed precomposed))
+    precomposed))
+
+;; Composition function for hebrew.  GSTRING is made of a Hebrew base
+;; character followed by Hebrew diacritical marks, or is made of
+;; single Hebrew diacritical mark.  Adjust GSTRING to display that
+;; sequence properly.  The basic strategy is:
+;;
+;; (1) If there's single diacritical, add padding space to the left
+;; and right of the glyph.
+;;
+;; (2) If the font has OpenType features for Hebrew, ask the OTF
+;; driver the whole work.
+;;
+;; (3) If the font has precomposed glyphs, use them as far as
+;; possible.  Adjust the remaining glyphs artificially.
+
+(defun hebrew-shape-gstring (gstring)
+  (let* ((font (lgstring-font gstring))
+        (otf (font-get font :otf))
+        (nchars (lgstring-char-len gstring))
+        header nglyphs base-width glyph precomposed val idx)
+    (cond
+     ((= nchars 1)
+      ;; Independent diacritical mark.  Add padding space to left or
+      ;; right so that the glyph doesn't overlap with the surrounding
+      ;; chars.
+      (setq glyph (lgstring-glyph gstring 0))
+      (let ((width (lglyph-width glyph))
+           bearing)
+       (if (< (setq bearing (lglyph-lbearing glyph)) 0)
+           (lglyph-set-adjustment glyph bearing 0 (- width bearing)))
+       (if (> (setq bearing (lglyph-rbearing glyph)) width)
+           (lglyph-set-adjustment glyph 0 0 bearing))))
+
+     ((or (assq 'hebr (car otf)) (assq 'hebr (cdr otf)))
+      ;; FONT has OpenType features for Hebrew.
+      (font-shape-gstring gstring))
+
+     (t
+      ;; FONT doesn't have OpenType features for Hebrew.
+      ;; Try a precomposed glyph.
+      ;; Now GSTRING is in this form:
+      ;;   [[FONT CHAR1 CHAR2 ... CHARn] nil GLYPH1 GLYPH2 ... GLYPHn nil ...]
+      (setq precomposed (hebrew-font-get-precomposed font)
+           header (lgstring-header gstring)
+           val (lookup-nested-alist header precomposed nil 1))
+      (if (and (consp val) (vectorp (car val)))
+         ;; All characters can be displayed by a single precomposed glyph.
+         ;; Reform GSTRING to [HEADER nil PRECOMPOSED-GLYPH nil ...]
+         (let ((glyph (copy-sequence (car val))))
+           (lglyph-set-from-to glyph 0 (1- nchars))
+           (lgstring-set-glyph gstring 0 glyph)
+           (lgstring-set-glyph gstring 1 nil))
+       (if (and (integerp val) (> val 2)
+                (setq glyph (lookup-nested-alist header precomposed val 1))
+                (consp glyph) (vectorp (car glyph)))
+           ;; The first (1- VAL) characters can be displayed by a
+           ;; precomposed glyph.  Provided that VAL is 3, the first
+           ;; two glyphs should be replaced by the precomposed glyph.
+           ;; In that case, reform GSTRING to:
+           ;;   [HEADER nil PRECOMPOSED-GLYPH GLYPH3 ... GLYPHn nil ...]
+           (let* ((ncmp (1- val))      ; number of composed glyphs
+                  (diff (1- ncmp)))    ; number of reduced glyphs
+             (setq glyph (copy-sequence (car glyph)))
+             (lglyph-set-from-to glyph 0 (1- nchars))
+             (lgstring-set-glyph gstring 0 glyph)
+             (setq idx ncmp)
+             (while (< idx nchars)
+               (setq glyph (lgstring-glyph gstring idx))
+               (lglyph-set-from-to glyph 0 (1- nchars))
+               (lgstring-set-glyph gstring (- idx diff) glyph)
+               (setq idx (1+ idx)))
+             (lgstring-set-glyph gstring (- idx diff) nil)
+             (setq idx (- ncmp diff)
+                   nglyphs (- nchars diff)))
+         (setq glyph (lgstring-glyph gstring 0))
+         (lglyph-set-from-to glyph 0 (1- nchars))
+         (setq idx 1 nglyphs nchars))
+       ;; Now IDX is an index to the first non-precomposed glyph.
+       ;; Adjust positions of the remaining glyphs artificially.
+       (setq base-width (lglyph-width (lgstring-glyph gstring 0)))
+       (while (< idx nglyphs)
+         (setq glyph (lgstring-glyph gstring idx))
+         (lglyph-set-from-to glyph 0 (1- nchars))
+         (if (>= (lglyph-lbearing glyph) (lglyph-width glyph))
+             ;; It seems that this glyph is designed to be rendered
+             ;; before the base glyph.
+             (lglyph-set-adjustment glyph (- base-width) 0 0)
+           (if (>= (lglyph-lbearing glyph) 0)
+               ;; Align the horizontal center of this glyph to the
+               ;; horizontal center of the base glyph.
+               (let ((width (- (lglyph-rbearing glyph)
+                               (lglyph-lbearing glyph))))
+                 (lglyph-set-adjustment glyph
+                                        (- (/ (- base-width width) 2)
+                                           (lglyph-lbearing glyph)
+                                           base-width) 0 0))))
+         (setq idx (1+ idx))))))
+    gstring))
+
+(let* ((base "[\u05D0-\u05F2]")
+       (combining "[\u0591-\u05BD\u05BF\u05C1-\u05C2\u05C4-\u05C5\u05C7]+")
+       (pattern1 (concat base combining))
+       (pattern2 (concat base "\u200D" combining)))
+  (set-char-table-range
+   composition-function-table '(#x591 . #x5C7)
+   (list (vector pattern2 3 'hebrew-shape-gstring)
+        (vector pattern2 2 'hebrew-shape-gstring)
+        (vector pattern1 1 'hebrew-shape-gstring)
+        [nil 0 hebrew-shape-gstring]))
+  ;; Exclude non-combining characters.
+  (set-char-table-range
+   composition-function-table #x5BE nil)
+  (set-char-table-range
+   composition-function-table #x5C0 nil)
+  (set-char-table-range
+   composition-function-table #x5C3 nil)
+  (set-char-table-range
+   composition-function-table #x5C6 nil))
+
 (provide 'hebrew)
 
 ;; arch-tag: 3ca04f32-3f1e-498e-af46-8267498ba5d9
index 2431c9d9e99183de02847653ccfaa997379ba810..e2e4f29dd9e4a3b3a5f85abbd9a379abe0738f75 100644 (file)
@@ -40,8 +40,9 @@
 IPA is International Phonetic Alphabet for English, French, German
 and Italian.")))
 
-;; This is for Arabic.  But, as we still don't have Arabic language
-;; support, we at least define a coding system here.
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Arabic
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 (define-coding-system 'iso-8859-6
   "ISO-8859-6 based encoding (MIME:ISO-8859-6)."
@@ -58,6 +59,19 @@ and Italian.")))
   :mime-charset 'windows-1256)
 (define-coding-system-alias 'cp1256 'windows-1256)
 
+(set-language-info-alist
+ "Arabic" '((charset unicode)
+           (coding-system utf-8 iso-8859-6 windows-1256)
+           (coding-priority utf-8 iso-8859-6 windows-1256)
+           (input-method . "arabic")
+           (sample-text . "Arabic      السّلام عليكم")
+           (documentation . "Bidirectional editing is supported.")))
+
+(set-char-table-range
+ composition-function-table
+ '(#x600 . #x6FF)
+ (list ["[\u0600-\u06FF]+" 0 font-shape-gstring]))
+
 (provide 'misc-lang)
 
 ;; arch-tag: 6953585c-1a1a-4c09-be82-a2518afb6074
index 1423d298d274a5305b0a1be2dc80f8adca973f71..25ac901a6420e7d78cd18652b8badc25f75efe91 100644 (file)
@@ -37,7 +37,7 @@
              (coding-system utf-8)
              (coding-priority utf-8)
              (input-method . "tai-sonla")
-             (sample-text . "TaiViet (êª\81ꪫꪱꪣ êª½êª\95)\t\têª\85ꪰêª\99ê«\83 êª¨êª®ê«\83 êª\81ꪫꪱ / êª\85ꪾ êª¨ï¿½ï\81½ ꪁꪫꪱ")
+             (sample-text . "TaiViet (êª\81ꪫꪱꪣ êª¼êª\95)\t\têª\85ꪰêª\99ê«\82 êª¨êª®ê«\82 êª\81ꪫꪱ / êª\85ꪽ êª¨êª· ꪁꪫꪱ")
              (documentation . "\
 TaiViet refers to the Tai language used by Tai people in
 Vietnam, and also refers to the script used for this language.
@@ -45,15 +45,15 @@ Both the script and language have the same origin as that of Thai
 language/script used in Thailand, but now they differ from each
 other in a significant way (especially the scripts are).
 
-The language name is spelled as \"êª\81ꪫꪱꪣ êª½ꪕ\", and the script name is
-spelled as \"êª\8e�ï\81\9c êª½êª\95\" in the modern form, \"êª\8eꪴ êª½ꪕ\" in the traditional
-from.
+The language name is spelled as \"êª\81ꪫꪱꪣ êª¼ꪕ\", and the script name is
+spelled as \"êª\8eï\81\9c êª¼êª\95\" in the modern form, \"êª\8eꪳ êª¼ꪕ\" in the traditional
+form.
 
 As the proposal for TaiViet script to the Unicode is still on
 the progress, we use the Private Use Area for TaiViet
 characters (U+F000..U+F07E).  A TaiViet font encoded accordingly
 is available at this web page:
-    http://www.m17n.org/TaiViet/
+    http://www.m17n.org/viettai/
 ")))
 
 (provide 'tai-viet)
index 842366dacbceea2b643b1b19162b40ac9dca0476..67ed6327971eac811ce30e212d3a0854f86f5617 100644 (file)
@@ -24,8 +24,7 @@
 ;;; Code
 
 ;; Regexp matching with a sequence of Tai Viet characters.
-(defconst tai-viet-re
-  (format "[\xaa80-\xaac2\xaadb-\xaadf-]+"))
+(defconst tai-viet-re "[\xaa80-\xaac2\xaadb-\xaadf]+")
 
 ;; Char-table of information about glyph type of Tai Viet characters.
 (defconst tai-viet-glyph-info
index 8afe722bd2ae95382ca55e651d5c7b97987429df..ec2a7c3b52c2671cf67ef959fe4900f1fe67e0ac 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" (19383 49278))
+;;;;;;  "play/5x5.el" (19279 5151))
 ;;; Generated autoloads from play/5x5.el
 
 (autoload '5x5 "5x5" "\
@@ -65,7 +65,7 @@ should return a grid vector array that is the new solution.
 ;;;***
 \f
 ;;;### (autoloads (list-one-abbrev-table) "abbrevlist" "abbrevlist.el"
-;;;;;;  (19383 49278))
+;;;;;;  (19279 5148))
 ;;; Generated autoloads from abbrevlist.el
 
 (autoload 'list-one-abbrev-table "abbrevlist" "\
@@ -76,7 +76,7 @@ Display alphabetical listing of ABBREV-TABLE in buffer OUTPUT-BUFFER.
 ;;;***
 \f
 ;;;### (autoloads (ada-mode ada-add-extensions) "ada-mode" "progmodes/ada-mode.el"
-;;;;;;  (19383 49276))
+;;;;;;  (19313 15414))
 ;;; Generated autoloads from progmodes/ada-mode.el
 
 (autoload 'ada-add-extensions "ada-mode" "\
@@ -96,7 +96,7 @@ Ada mode is the major mode for editing Ada code.
 ;;;***
 \f
 ;;;### (autoloads (ada-header) "ada-stmt" "progmodes/ada-stmt.el"
-;;;;;;  (19383 49278))
+;;;;;;  (19279 38446))
 ;;; Generated autoloads from progmodes/ada-stmt.el
 
 (autoload 'ada-header "ada-stmt" "\
@@ -107,7 +107,7 @@ Insert a descriptive header at the top of the file.
 ;;;***
 \f
 ;;;### (autoloads (ada-find-file) "ada-xref" "progmodes/ada-xref.el"
-;;;;;;  (19383 49278))
+;;;;;;  (19279 38446))
 ;;; Generated autoloads from progmodes/ada-xref.el
 
 (autoload 'ada-find-file "ada-xref" "\
@@ -121,8 +121,8 @@ Completion is available.
 ;;;### (autoloads (change-log-merge add-log-current-defun change-log-mode
 ;;;;;;  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" "add-log.el" (19383
-;;;;;;  49278))
+;;;;;;  add-log-current-defun-function) "add-log" "add-log.el" (19279
+;;;;;;  5148))
 ;;; Generated autoloads from add-log.el
 
 (put 'change-log-default-name 'safe-local-variable 'string-or-null-p)
@@ -261,7 +261,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" (19383 49276))
+;;;;;;  "advice" "emacs-lisp/advice.el" (19323 49698))
 ;;; Generated autoloads from emacs-lisp/advice.el
 
 (defvar ad-redefinition-action 'warn "\
@@ -404,7 +404,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" (19383 49278))
+;;;;;;  align) "align" "align.el" (19279 5148))
 ;;; Generated autoloads from align.el
 
 (autoload 'align "align" "\
@@ -494,7 +494,7 @@ A replacement function for `newline-and-indent', aligning as it goes.
 ;;;***
 \f
 ;;;### (autoloads (outlineify-sticky allout-mode) "allout" "allout.el"
-;;;;;;  (19383 49278))
+;;;;;;  (19279 5148))
 ;;; Generated autoloads from allout.el
 
 (put 'allout-use-hanging-indents 'safe-local-variable (if (fboundp 'booleanp) 'booleanp '(lambda (x) (member x '(t nil)))))
@@ -801,7 +801,7 @@ setup for auto-startup.
 ;;;***
 \f
 ;;;### (autoloads (ange-ftp-hook-function ange-ftp-reread-dir) "ange-ftp"
-;;;;;;  "net/ange-ftp.el" (19383 49276))
+;;;;;;  "net/ange-ftp.el" (19356 10801))
 ;;; Generated autoloads from net/ange-ftp.el
 
 (defalias 'ange-ftp-re-read-dir 'ange-ftp-reread-dir)
@@ -823,7 +823,7 @@ Not documented
 ;;;***
 \f
 ;;;### (autoloads (animate-birthday-present animate-sequence animate-string)
-;;;;;;  "animate" "play/animate.el" (19383 49278))
+;;;;;;  "animate" "play/animate.el" (19279 5151))
 ;;; Generated autoloads from play/animate.el
 
 (autoload 'animate-string "animate" "\
@@ -851,7 +851,7 @@ You can specify the one's name by NAME; the default value is \"Sarah\".
 ;;;***
 \f
 ;;;### (autoloads (ansi-color-process-output ansi-color-for-comint-mode-on)
-;;;;;;  "ansi-color" "ansi-color.el" (19383 49278))
+;;;;;;  "ansi-color" "ansi-color.el" (19279 5148))
 ;;; Generated autoloads from ansi-color.el
 
 (autoload 'ansi-color-for-comint-mode-on "ansi-color" "\
@@ -877,7 +877,7 @@ 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" (19383 49278))
+;;;;;;  "antlr-mode" "progmodes/antlr-mode.el" (19279 5151))
 ;;; Generated autoloads from progmodes/antlr-mode.el
 
 (autoload 'antlr-show-makefile-rules "antlr-mode" "\
@@ -914,7 +914,7 @@ Used in `antlr-mode'.  Also a useful function in `java-mode-hook'.
 ;;;***
 \f
 ;;;### (autoloads (appt-activate appt-make-list appt-delete appt-add)
-;;;;;;  "appt" "calendar/appt.el" (19383 49278))
+;;;;;;  "appt" "calendar/appt.el" (19279 5149))
 ;;; Generated autoloads from calendar/appt.el
 
 (autoload 'appt-add "appt" "\
@@ -954,7 +954,7 @@ 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" (19383 49278))
+;;;;;;  apropos-read-pattern) "apropos" "apropos.el" (19279 5148))
 ;;; Generated autoloads from apropos.el
 
 (autoload 'apropos-read-pattern "apropos" "\
@@ -1057,8 +1057,8 @@ Returns list of symbols and documentation found.
 
 ;;;***
 \f
-;;;### (autoloads (archive-mode) "arc-mode" "arc-mode.el" (19383
-;;;;;;  49276))
+;;;### (autoloads (archive-mode) "arc-mode" "arc-mode.el" (19321
+;;;;;;  4517))
 ;;; Generated autoloads from arc-mode.el
 
 (autoload 'archive-mode "arc-mode" "\
@@ -1078,7 +1078,7 @@ archive.
 
 ;;;***
 \f
-;;;### (autoloads (array-mode) "array" "array.el" (19383 49278))
+;;;### (autoloads (array-mode) "array" "array.el" (19279 5148))
 ;;; Generated autoloads from array.el
 
 (autoload 'array-mode "array" "\
@@ -1149,8 +1149,8 @@ Entering array mode calls the function `array-mode-hook'.
 
 ;;;***
 \f
-;;;### (autoloads (artist-mode) "artist" "textmodes/artist.el" (19383
-;;;;;;  49276))
+;;;### (autoloads (artist-mode) "artist" "textmodes/artist.el" (19321
+;;;;;;  4517))
 ;;; Generated autoloads from textmodes/artist.el
 
 (autoload 'artist-mode "artist" "\
@@ -1356,8 +1356,8 @@ Keymap summary
 
 ;;;***
 \f
-;;;### (autoloads (asm-mode) "asm-mode" "progmodes/asm-mode.el" (19383
-;;;;;;  49278))
+;;;### (autoloads (asm-mode) "asm-mode" "progmodes/asm-mode.el" (19279
+;;;;;;  5151))
 ;;; Generated autoloads from progmodes/asm-mode.el
 
 (autoload 'asm-mode "asm-mode" "\
@@ -1385,7 +1385,7 @@ Special commands:
 ;;;***
 \f
 ;;;### (autoloads (autoarg-kp-mode autoarg-mode) "autoarg" "autoarg.el"
-;;;;;;  (19383 49278))
+;;;;;;  (19279 5148))
 ;;; Generated autoloads from autoarg.el
 
 (defvar autoarg-mode nil "\
@@ -1439,7 +1439,7 @@ etc. to supply digit arguments.
 ;;;***
 \f
 ;;;### (autoloads (autoconf-mode) "autoconf" "progmodes/autoconf.el"
-;;;;;;  (19383 49278))
+;;;;;;  (19279 5151))
 ;;; Generated autoloads from progmodes/autoconf.el
 
 (autoload 'autoconf-mode "autoconf" "\
@@ -1450,7 +1450,7 @@ Major mode for editing Autoconf configure.in files.
 ;;;***
 \f
 ;;;### (autoloads (auto-insert-mode define-auto-insert auto-insert)
-;;;;;;  "autoinsert" "autoinsert.el" (19383 49278))
+;;;;;;  "autoinsert" "autoinsert.el" (19279 5148))
 ;;; Generated autoloads from autoinsert.el
 
 (autoload 'auto-insert "autoinsert" "\
@@ -1489,7 +1489,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"
-;;;;;;  (19383 49278))
+;;;;;;  (19365 25156))
 ;;; Generated autoloads from emacs-lisp/autoload.el
 
 (put 'generated-autoload-file 'safe-local-variable 'stringp)
@@ -1528,7 +1528,7 @@ Calls `update-directory-autoloads' on the command line arguments.
 \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" (19383 49278))
+;;;;;;  "autorevert" "autorevert.el" (19279 5148))
 ;;; Generated autoloads from autorevert.el
 
 (autoload 'auto-revert-mode "autorevert" "\
@@ -1609,7 +1609,7 @@ specifies in the mode line.
 ;;;***
 \f
 ;;;### (autoloads (mouse-avoidance-mode mouse-avoidance-mode) "avoid"
-;;;;;;  "avoid.el" (19383 49278))
+;;;;;;  "avoid.el" (19279 5148))
 ;;; Generated autoloads from avoid.el
 
 (defvar mouse-avoidance-mode nil "\
@@ -1650,7 +1650,7 @@ definition of \"random distance\".)
 ;;;***
 \f
 ;;;### (autoloads (display-battery-mode battery) "battery" "battery.el"
-;;;;;;  (19383 49278))
+;;;;;;  (19279 5148))
 ;;; Generated autoloads from battery.el
  (put 'battery-mode-line-string 'risky-local-variable t)
 
@@ -1682,7 +1682,7 @@ seconds.
 ;;;***
 \f
 ;;;### (autoloads (benchmark benchmark-run-compiled benchmark-run)
-;;;;;;  "benchmark" "emacs-lisp/benchmark.el" (19383 49278))
+;;;;;;  "benchmark" "emacs-lisp/benchmark.el" (19279 5149))
 ;;; Generated autoloads from emacs-lisp/benchmark.el
 
 (autoload 'benchmark-run "benchmark" "\
@@ -1715,7 +1715,7 @@ For non-interactive use see also `benchmark-run' and
 ;;;***
 \f
 ;;;### (autoloads (bibtex-search-entry bibtex-mode bibtex-initialize)
-;;;;;;  "bibtex" "textmodes/bibtex.el" (19383 49278))
+;;;;;;  "bibtex" "textmodes/bibtex.el" (19279 38446))
 ;;; Generated autoloads from textmodes/bibtex.el
 
 (autoload 'bibtex-initialize "bibtex" "\
@@ -1802,7 +1802,7 @@ mode is not `bibtex-mode', START is nil, and DISPLAY is t.
 ;;;***
 \f
 ;;;### (autoloads (bibtex-style-mode) "bibtex-style" "textmodes/bibtex-style.el"
-;;;;;;  (19383 49278))
+;;;;;;  (19279 5152))
 ;;; Generated autoloads from textmodes/bibtex-style.el
  (add-to-list 'auto-mode-alist (cons (purecopy "\\.bst\\'") 'bibtex-style-mode))
 
@@ -1815,7 +1815,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"
-;;;;;;  (19383 49278))
+;;;;;;  (19279 5150))
 ;;; Generated autoloads from mail/binhex.el
 
 (defconst binhex-begin-line "^:...............................................................$")
@@ -1838,8 +1838,8 @@ Binhex decode region between START and END.
 
 ;;;***
 \f
-;;;### (autoloads (blackbox) "blackbox" "play/blackbox.el" (19383
-;;;;;;  49278))
+;;;### (autoloads (blackbox) "blackbox" "play/blackbox.el" (19279
+;;;;;;  5151))
 ;;; Generated autoloads from play/blackbox.el
 
 (autoload 'blackbox "blackbox" "\
@@ -1962,7 +1962,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" (19383 49276))
+;;;;;;  "bookmark.el" (19326 6129))
 ;;; Generated autoloads from bookmark.el
  (define-key ctl-x-r-map "b" 'bookmark-jump)
  (define-key ctl-x-r-map "m" 'bookmark-set)
@@ -2169,7 +2169,7 @@ Incremental search of bookmarks, hiding the non-matches as we go.
 ;;;;;;  browse-url-of-dired-file browse-url-of-buffer browse-url-of-file
 ;;;;;;  browse-url-url-at-point browse-url-galeon-program browse-url-firefox-program
 ;;;;;;  browse-url-browser-function) "browse-url" "net/browse-url.el"
-;;;;;;  (19383 49278))
+;;;;;;  (19356 10801))
 ;;; Generated autoloads from net/browse-url.el
 
 (defvar browse-url-browser-function (cond ((memq system-type '(windows-nt ms-dos cygwin)) 'browse-url-default-windows-browser) ((memq system-type '(darwin)) 'browse-url-default-macosx-browser) (t 'browse-url-default-browser)) "\
@@ -2499,8 +2499,8 @@ from `browse-url-elinks-wrapper'.
 
 ;;;***
 \f
-;;;### (autoloads (snarf-bruces bruce) "bruce" "play/bruce.el" (19383
-;;;;;;  49278))
+;;;### (autoloads (snarf-bruces bruce) "bruce" "play/bruce.el" (19279
+;;;;;;  5151))
 ;;; Generated autoloads from play/bruce.el
 
 (autoload 'bruce "bruce" "\
@@ -2516,7 +2516,7 @@ Return a vector containing the lines from `bruce-phrases-file'.
 ;;;***
 \f
 ;;;### (autoloads (bs-show bs-customize bs-cycle-previous bs-cycle-next)
-;;;;;;  "bs" "bs.el" (19383 49278))
+;;;;;;  "bs" "bs.el" (19279 5148))
 ;;; Generated autoloads from bs.el
 
 (autoload 'bs-cycle-next "bs" "\
@@ -2556,7 +2556,7 @@ name of buffer configuration.
 
 ;;;***
 \f
-;;;### (autoloads (bubbles) "bubbles" "play/bubbles.el" (19383 49278))
+;;;### (autoloads (bubbles) "bubbles" "play/bubbles.el" (19279 5151))
 ;;; Generated autoloads from play/bubbles.el
 
 (autoload 'bubbles "bubbles" "\
@@ -2578,7 +2578,7 @@ columns on its right towards the left.
 ;;;***
 \f
 ;;;### (autoloads (bug-reference-prog-mode bug-reference-mode) "bug-reference"
-;;;;;;  "progmodes/bug-reference.el" (19383 49278))
+;;;;;;  "progmodes/bug-reference.el" (19279 5151))
 ;;; Generated autoloads from progmodes/bug-reference.el
 
 (put 'bug-reference-url-format 'safe-local-variable 'stringp)
@@ -2600,7 +2600,7 @@ Like `bug-reference-mode', but only buttonize in comments and strings.
 ;;;;;;  compile-defun byte-compile-file byte-recompile-directory
 ;;;;;;  byte-force-recompile byte-compile-enable-warning byte-compile-disable-warning
 ;;;;;;  byte-compile-warnings-safe-p) "bytecomp" "emacs-lisp/bytecomp.el"
-;;;;;;  (19383 49278))
+;;;;;;  (19279 5149))
 ;;; 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)
@@ -2724,8 +2724,8 @@ and corresponding effects.
 
 ;;;***
 \f
-;;;### (autoloads nil "cal-china" "calendar/cal-china.el" (19383
-;;;;;;  49278))
+;;;### (autoloads nil "cal-china" "calendar/cal-china.el" (19279
+;;;;;;  5149))
 ;;; Generated autoloads from calendar/cal-china.el
 
 (put 'calendar-chinese-time-zone 'risky-local-variable t)
@@ -2734,7 +2734,7 @@ and corresponding effects.
 
 ;;;***
 \f
-;;;### (autoloads nil "cal-dst" "calendar/cal-dst.el" (19383 49278))
+;;;### (autoloads nil "cal-dst" "calendar/cal-dst.el" (19279 5149))
 ;;; Generated autoloads from calendar/cal-dst.el
 
 (put 'calendar-daylight-savings-starts 'risky-local-variable t)
@@ -2746,7 +2746,7 @@ and corresponding effects.
 ;;;***
 \f
 ;;;### (autoloads (calendar-hebrew-list-yahrzeits) "cal-hebrew" "calendar/cal-hebrew.el"
-;;;;;;  (19383 49284))
+;;;;;;  (19345 41626))
 ;;; Generated autoloads from calendar/cal-hebrew.el
 
 (autoload 'calendar-hebrew-list-yahrzeits "cal-hebrew" "\
@@ -2762,8 +2762,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" (19383
-;;;;;;  49278))
+;;;;;;  full-calc calc calc-dispatch) "calc" "calc/calc.el" (19282
+;;;;;;  55646))
 ;;; Generated autoloads from calc/calc.el
  (define-key ctl-x-map "*" 'calc-dispatch)
 
@@ -2845,8 +2845,8 @@ See Info node `(calc)Defining Functions'.
 
 ;;;***
 \f
-;;;### (autoloads (calculator) "calculator" "calculator.el" (19383
-;;;;;;  49277))
+;;;### (autoloads (calculator) "calculator" "calculator.el" (19356
+;;;;;;  10801))
 ;;; Generated autoloads from calculator.el
 
 (autoload 'calculator "calculator" "\
@@ -2857,8 +2857,8 @@ See the documentation for `calculator-mode' for more information.
 
 ;;;***
 \f
-;;;### (autoloads (calendar) "calendar" "calendar/calendar.el" (19383
-;;;;;;  49278))
+;;;### (autoloads (calendar) "calendar" "calendar/calendar.el" (19279
+;;;;;;  5149))
 ;;; Generated autoloads from calendar/calendar.el
 
 (autoload 'calendar "calendar" "\
@@ -2902,7 +2902,7 @@ This function is suitable for execution in a .emacs file.
 ;;;***
 \f
 ;;;### (autoloads (canlock-verify canlock-insert-header) "canlock"
-;;;;;;  "gnus/canlock.el" (19383 49278))
+;;;;;;  "gnus/canlock.el" (19279 5150))
 ;;; Generated autoloads from gnus/canlock.el
 
 (autoload 'canlock-insert-header "canlock" "\
@@ -2920,7 +2920,7 @@ it fails.
 ;;;***
 \f
 ;;;### (autoloads (capitalized-words-mode) "cap-words" "progmodes/cap-words.el"
-;;;;;;  (19383 49278))
+;;;;;;  (19279 5151))
 ;;; Generated autoloads from progmodes/cap-words.el
 
 (autoload 'capitalized-words-mode "cap-words" "\
@@ -2955,15 +2955,15 @@ Obsoletes `c-forward-into-nomenclature'.
 
 ;;;***
 \f
-;;;### (autoloads nil "cc-compat" "progmodes/cc-compat.el" (19383
-;;;;;;  49278))
+;;;### (autoloads nil "cc-compat" "progmodes/cc-compat.el" (19279
+;;;;;;  5151))
 ;;; 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"
-;;;;;;  (19396 34127))
+;;;;;;  (19370 36541))
 ;;; Generated autoloads from progmodes/cc-engine.el
 
 (autoload 'c-guess-basic-syntax "cc-engine" "\
@@ -2975,7 +2975,7 @@ Return the syntactic context of the current line.
 \f
 ;;;### (autoloads (pike-mode idl-mode java-mode objc-mode c++-mode
 ;;;;;;  c-mode c-initialize-cc-mode) "cc-mode" "progmodes/cc-mode.el"
-;;;;;;  (19396 34127))
+;;;;;;  (19338 9841))
 ;;; Generated autoloads from progmodes/cc-mode.el
 
 (autoload 'c-initialize-cc-mode "cc-mode" "\
@@ -3135,7 +3135,7 @@ Key bindings:
 ;;;***
 \f
 ;;;### (autoloads (c-set-offset c-add-style c-set-style) "cc-styles"
-;;;;;;  "progmodes/cc-styles.el" (19383 49278))
+;;;;;;  "progmodes/cc-styles.el" (19279 5151))
 ;;; Generated autoloads from progmodes/cc-styles.el
 
 (autoload 'c-set-style "cc-styles" "\
@@ -3186,7 +3186,7 @@ and exists only for compatibility reasons.
 
 ;;;***
 \f
-;;;### (autoloads nil "cc-vars" "progmodes/cc-vars.el" (19383 49278))
+;;;### (autoloads nil "cc-vars" "progmodes/cc-vars.el" (19279 5151))
 ;;; Generated autoloads from progmodes/cc-vars.el
 (put 'c-basic-offset 'safe-local-variable 'integerp)
 (put 'c-backslash-column 'safe-local-variable 'integerp)
@@ -3196,7 +3196,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"
-;;;;;;  (19383 49278))
+;;;;;;  (19279 5150))
 ;;; Generated autoloads from international/ccl.el
 
 (autoload 'ccl-compile "ccl" "\
@@ -3455,7 +3455,7 @@ See the documentation of `define-ccl-program' for the detail of CCL program.
 ;;;***
 \f
 ;;;### (autoloads (cfengine-mode) "cfengine" "progmodes/cfengine.el"
-;;;;;;  (19383 49278))
+;;;;;;  (19279 5151))
 ;;; Generated autoloads from progmodes/cfengine.el
 
 (autoload 'cfengine-mode "cfengine" "\
@@ -3470,7 +3470,7 @@ to the action header.
 ;;;***
 \f
 ;;;### (autoloads (check-declare-directory check-declare-file) "check-declare"
-;;;;;;  "emacs-lisp/check-declare.el" (19383 49278))
+;;;;;;  "emacs-lisp/check-declare.el" (19279 5149))
 ;;; Generated autoloads from emacs-lisp/check-declare.el
 
 (autoload 'check-declare-file "check-declare" "\
@@ -3495,7 +3495,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" (19383 49278))
+;;;;;;  "checkdoc" "emacs-lisp/checkdoc.el" (19279 5149))
 ;;; 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)
@@ -3690,7 +3690,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" (19383 49278))
+;;;;;;  "language/china-util.el" (19279 5150))
 ;;; Generated autoloads from language/china-util.el
 
 (autoload 'decode-hz-region "china-util" "\
@@ -3728,7 +3728,7 @@ Not documented
 ;;;***
 \f
 ;;;### (autoloads (command-history list-command-history repeat-matching-complex-command)
-;;;;;;  "chistory" "chistory.el" (19383 49278))
+;;;;;;  "chistory" "chistory.el" (19279 5148))
 ;;; Generated autoloads from chistory.el
 
 (autoload 'repeat-matching-complex-command "chistory" "\
@@ -3767,7 +3767,7 @@ and runs the normal hook `command-history-hook'.
 
 ;;;***
 \f
-;;;### (autoloads nil "cl" "emacs-lisp/cl.el" (19383 49278))
+;;;### (autoloads nil "cl" "emacs-lisp/cl.el" (19279 5149))
 ;;; Generated autoloads from emacs-lisp/cl.el
 
 (defvar custom-print-functions nil "\
@@ -3783,7 +3783,7 @@ a future Emacs interpreter will be able to use it.")
 ;;;***
 \f
 ;;;### (autoloads (common-lisp-indent-function) "cl-indent" "emacs-lisp/cl-indent.el"
-;;;;;;  (19383 49278))
+;;;;;;  (19279 5149))
 ;;; Generated autoloads from emacs-lisp/cl-indent.el
 
 (autoload 'common-lisp-indent-function "cl-indent" "\
@@ -3862,7 +3862,7 @@ For example, the function `case' has an indent property
 ;;;***
 \f
 ;;;### (autoloads (c-macro-expand) "cmacexp" "progmodes/cmacexp.el"
-;;;;;;  (19383 49278))
+;;;;;;  (19279 5151))
 ;;; Generated autoloads from progmodes/cmacexp.el
 
 (autoload 'c-macro-expand "cmacexp" "\
@@ -3882,8 +3882,8 @@ For use inside Lisp programs, see also `c-macro-expansion'.
 
 ;;;***
 \f
-;;;### (autoloads (run-scheme) "cmuscheme" "cmuscheme.el" (19383
-;;;;;;  49278))
+;;;### (autoloads (run-scheme) "cmuscheme" "cmuscheme.el" (19279
+;;;;;;  5148))
 ;;; Generated autoloads from cmuscheme.el
 
 (autoload 'run-scheme "cmuscheme" "\
@@ -3907,7 +3907,7 @@ is run).
 ;;;### (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"
-;;;;;;  (19383 49278))
+;;;;;;  (19279 5148))
 ;;; Generated autoloads from comint.el
 
 (defvar comint-output-filter-functions '(comint-postoutput-scroll-to-bottom comint-watch-for-password-prompt) "\
@@ -3999,8 +3999,8 @@ REGEXP-GROUP is the regular expression group in REGEXP to use.
 
 ;;;***
 \f
-;;;### (autoloads (compare-windows) "compare-w" "compare-w.el" (19383
-;;;;;;  49278))
+;;;### (autoloads (compare-windows) "compare-w" "compare-w.el" (19279
+;;;;;;  5148))
 ;;; Generated autoloads from compare-w.el
 
 (autoload 'compare-windows "compare-w" "\
@@ -4037,8 +4037,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" (19405
-;;;;;;  51439))
+;;;;;;  compilation-mode-hook) "compile" "progmodes/compile.el" (19375
+;;;;;;  49830))
 ;;; Generated autoloads from progmodes/compile.el
 
 (defvar compilation-mode-hook nil "\
@@ -4216,7 +4216,7 @@ This is the value of `next-error-function' in Compilation buffers.
 ;;;***
 \f
 ;;;### (autoloads (partial-completion-mode) "complete" "complete.el"
-;;;;;;  (19383 49278))
+;;;;;;  (19358 54001))
 ;;; Generated autoloads from complete.el
 
 (defvar partial-completion-mode nil "\
@@ -4258,7 +4258,7 @@ second TAB brings up the `*Completions*' buffer.
 ;;;***
 \f
 ;;;### (autoloads (dynamic-completion-mode) "completion" "completion.el"
-;;;;;;  (19383 49278))
+;;;;;;  (19279 5148))
 ;;; Generated autoloads from completion.el
 
 (defvar dynamic-completion-mode nil "\
@@ -4280,7 +4280,7 @@ Enable dynamic word-completion.
 ;;;### (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"
-;;;;;;  (19383 49278))
+;;;;;;  (19279 5152))
 ;;; Generated autoloads from textmodes/conf-mode.el
 
 (autoload 'conf-mode "conf-mode" "\
@@ -4436,7 +4436,7 @@ For details see `conf-mode'.  Example:
 ;;;***
 \f
 ;;;### (autoloads (shuffle-vector cookie-snarf cookie-insert cookie)
-;;;;;;  "cookie1" "play/cookie1.el" (19383 49278))
+;;;;;;  "cookie1" "play/cookie1.el" (19279 5151))
 ;;; Generated autoloads from play/cookie1.el
 
 (autoload 'cookie "cookie1" "\
@@ -4468,8 +4468,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" (19383
-;;;;;;  49278))
+;;;;;;  copyright-update) "copyright" "emacs-lisp/copyright.el" (19279
+;;;;;;  5149))
 ;;; Generated autoloads from emacs-lisp/copyright.el
 
 (autoload 'copyright-update "copyright" "\
@@ -4502,7 +4502,7 @@ Update copyright notice for all files in DIRECTORY matching MATCH.
 ;;;***
 \f
 ;;;### (autoloads (cperl-perldoc-at-point cperl-perldoc cperl-mode)
-;;;;;;  "cperl-mode" "progmodes/cperl-mode.el" (19383 49278))
+;;;;;;  "cperl-mode" "progmodes/cperl-mode.el" (19279 5151))
 ;;; Generated autoloads from progmodes/cperl-mode.el
 (put 'cperl-indent-level 'safe-local-variable 'integerp)
 (put 'cperl-brace-offset 'safe-local-variable 'integerp)
@@ -4701,7 +4701,7 @@ Run a `perldoc' on the word around point.
 ;;;***
 \f
 ;;;### (autoloads (cpp-parse-edit cpp-highlight-buffer) "cpp" "progmodes/cpp.el"
-;;;;;;  (19383 49278))
+;;;;;;  (19279 5151))
 ;;; Generated autoloads from progmodes/cpp.el
 
 (autoload 'cpp-highlight-buffer "cpp" "\
@@ -4720,7 +4720,7 @@ Edit display information for cpp conditionals.
 ;;;***
 \f
 ;;;### (autoloads (crisp-mode crisp-mode) "crisp" "emulation/crisp.el"
-;;;;;;  (19383 49278))
+;;;;;;  (19279 5150))
 ;;; Generated autoloads from emulation/crisp.el
 
 (defvar crisp-mode nil "\
@@ -4744,7 +4744,7 @@ With ARG, turn CRiSP mode on if ARG is positive, off otherwise.
 ;;;***
 \f
 ;;;### (autoloads (completing-read-multiple) "crm" "emacs-lisp/crm.el"
-;;;;;;  (19383 49278))
+;;;;;;  (19279 5149))
 ;;; Generated autoloads from emacs-lisp/crm.el
 
 (autoload 'completing-read-multiple "crm" "\
@@ -4779,8 +4779,8 @@ INHERIT-INPUT-METHOD.
 
 ;;;***
 \f
-;;;### (autoloads (css-mode) "css-mode" "textmodes/css-mode.el" (19392
-;;;;;;  42395))
+;;;### (autoloads (css-mode) "css-mode" "textmodes/css-mode.el" (19279
+;;;;;;  5152))
 ;;; Generated autoloads from textmodes/css-mode.el
  (add-to-list 'auto-mode-alist (cons (purecopy "\\.css\\'") 'css-mode))
 
@@ -4792,7 +4792,7 @@ Major mode to edit Cascading Style Sheets.
 ;;;***
 \f
 ;;;### (autoloads (cua-selection-mode cua-mode) "cua-base" "emulation/cua-base.el"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5150))
 ;;; Generated autoloads from emulation/cua-base.el
 
 (defvar cua-mode nil "\
@@ -4851,7 +4851,7 @@ Enable CUA selection mode without the C-z/C-x/C-c/C-v bindings.
 ;;;;;;  customize-mode customize 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"
-;;;;;;  (19383 49276))
+;;;;;;  (19356 10801))
 ;;; Generated autoloads from cus-edit.el
 
 (defvar custom-browse-sort-alphabetically nil "\
@@ -4859,8 +4859,8 @@ If non-nil, sort customization group alphabetically in `custom-browse'.")
 
 (custom-autoload 'custom-browse-sort-alphabetically "cus-edit" t)
 
-(defvar custom-buffer-sort-alphabetically nil "\
-If non-nil, sort each customization group alphabetically in Custom buffer.")
+(defvar custom-buffer-sort-alphabetically t "\
+Whether to sort customization groups alphabetically in Custom buffer.")
 
 (custom-autoload 'custom-buffer-sort-alphabetically "cus-edit" t)
 
@@ -5036,15 +5036,20 @@ Customize all already saved user options.
 \(fn)" t nil)
 
 (autoload 'customize-apropos "cus-edit" "\
-Customize all loaded options, faces and groups matching REGEXP.
-If ALL is `options', include only options.
-If ALL is `faces', include only faces.
-If ALL is `groups', include only groups.
-If ALL is t (interactively, with prefix arg), include variables
+Customize all 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,
+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 REGEXP &optional ALL)" t nil)
+\(fn PATTERN &optional TYPE)" t nil)
 
 (autoload 'customize-apropos-options "cus-edit" "\
 Customize all loaded customizable options matching REGEXP.
@@ -5149,7 +5154,7 @@ The format is suitable for use with `easy-menu-define'.
 ;;;***
 \f
 ;;;### (autoloads (customize-create-theme) "cus-theme" "cus-theme.el"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5148))
 ;;; Generated autoloads from cus-theme.el
 
 (autoload 'customize-create-theme "cus-theme" "\
@@ -5160,7 +5165,7 @@ Create a custom theme.
 ;;;***
 \f
 ;;;### (autoloads (cvs-status-mode) "cvs-status" "cvs-status.el"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5148))
 ;;; Generated autoloads from cvs-status.el
 
 (autoload 'cvs-status-mode "cvs-status" "\
@@ -5171,7 +5176,7 @@ Mode used for cvs status output.
 ;;;***
 \f
 ;;;### (autoloads (global-cwarn-mode turn-on-cwarn-mode cwarn-mode)
-;;;;;;  "cwarn" "progmodes/cwarn.el" (19383 49279))
+;;;;;;  "cwarn" "progmodes/cwarn.el" (19279 5151))
 ;;; Generated autoloads from progmodes/cwarn.el
 
 (autoload 'cwarn-mode "cwarn" "\
@@ -5218,7 +5223,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"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5150))
 ;;; Generated autoloads from language/cyril-util.el
 
 (autoload 'cyrillic-encode-koi8-r-char "cyril-util" "\
@@ -5247,7 +5252,7 @@ If the argument is nil, we return the display table to its standard state.
 ;;;***
 \f
 ;;;### (autoloads (dabbrev-expand dabbrev-completion) "dabbrev" "dabbrev.el"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5148))
 ;;; Generated autoloads from dabbrev.el
 (put 'dabbrev-case-fold-search 'risky-local-variable t)
 (put 'dabbrev-case-replace 'risky-local-variable t)
@@ -5294,7 +5299,7 @@ See also `dabbrev-abbrev-char-regexp' and \\[dabbrev-completion].
 ;;;***
 \f
 ;;;### (autoloads (data-debug-new-buffer) "data-debug" "cedet/data-debug.el"
-;;;;;;  (19383 49276))
+;;;;;;  (19323 49698))
 ;;; Generated autoloads from cedet/data-debug.el
 
 (autoload 'data-debug-new-buffer "data-debug" "\
@@ -5304,8 +5309,8 @@ Create a new data-debug buffer with NAME.
 
 ;;;***
 \f
-;;;### (autoloads (dbus-handle-event) "dbus" "net/dbus.el" (19383
-;;;;;;  49284))
+;;;### (autoloads (dbus-handle-event) "dbus" "net/dbus.el" (19345
+;;;;;;  41626))
 ;;; Generated autoloads from net/dbus.el
 
 (autoload 'dbus-handle-event "dbus" "\
@@ -5318,8 +5323,8 @@ If the HANDLER returns an `dbus-error', it is propagated as return message.
 
 ;;;***
 \f
-;;;### (autoloads (dcl-mode) "dcl-mode" "progmodes/dcl-mode.el" (19383
-;;;;;;  49279))
+;;;### (autoloads (dcl-mode) "dcl-mode" "progmodes/dcl-mode.el" (19279
+;;;;;;  5151))
 ;;; Generated autoloads from progmodes/dcl-mode.el
 
 (autoload 'dcl-mode "dcl-mode" "\
@@ -5446,7 +5451,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" (19383 49279))
+;;;;;;  "emacs-lisp/debug.el" (19279 5149))
 ;;; Generated autoloads from emacs-lisp/debug.el
 
 (setq debugger 'debug)
@@ -5490,7 +5495,7 @@ To specify a nil argument interactively, exit with an empty minibuffer.
 ;;;***
 \f
 ;;;### (autoloads (decipher-mode decipher) "decipher" "play/decipher.el"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5151))
 ;;; Generated autoloads from play/decipher.el
 
 (autoload 'decipher "decipher" "\
@@ -5519,8 +5524,8 @@ The most useful commands are:
 ;;;***
 \f
 ;;;### (autoloads (delimit-columns-rectangle delimit-columns-region
-;;;;;;  delimit-columns-customize) "delim-col" "delim-col.el" (19383
-;;;;;;  49276))
+;;;;;;  delimit-columns-customize) "delim-col" "delim-col.el" (19323
+;;;;;;  49698))
 ;;; Generated autoloads from delim-col.el
 
 (autoload 'delimit-columns-customize "delim-col" "\
@@ -5544,8 +5549,8 @@ START and END delimits the corners of text rectangle.
 
 ;;;***
 \f
-;;;### (autoloads (delphi-mode) "delphi" "progmodes/delphi.el" (19383
-;;;;;;  49279))
+;;;### (autoloads (delphi-mode) "delphi" "progmodes/delphi.el" (19279
+;;;;;;  38446))
 ;;; Generated autoloads from progmodes/delphi.el
 
 (autoload 'delphi-mode "delphi" "\
@@ -5596,8 +5601,8 @@ no args, if that value is non-nil.
 
 ;;;***
 \f
-;;;### (autoloads (delete-selection-mode) "delsel" "delsel.el" (19383
-;;;;;;  49279))
+;;;### (autoloads (delete-selection-mode) "delsel" "delsel.el" (19279
+;;;;;;  5148))
 ;;; Generated autoloads from delsel.el
 
 (defalias 'pending-delete-mode 'delete-selection-mode)
@@ -5626,7 +5631,7 @@ any selection.
 ;;;***
 \f
 ;;;### (autoloads (derived-mode-init-mode-variables define-derived-mode)
-;;;;;;  "derived" "emacs-lisp/derived.el" (19383 49279))
+;;;;;;  "derived" "emacs-lisp/derived.el" (19279 5149))
 ;;; Generated autoloads from emacs-lisp/derived.el
 
 (autoload 'define-derived-mode "derived" "\
@@ -5691,7 +5696,7 @@ the first time the mode is used.
 ;;;***
 \f
 ;;;### (autoloads (describe-char describe-text-properties) "descr-text"
-;;;;;;  "descr-text.el" (19383 49279))
+;;;;;;  "descr-text.el" (19279 5148))
 ;;; Generated autoloads from descr-text.el
 
 (autoload 'describe-text-properties "descr-text" "\
@@ -5719,7 +5724,7 @@ as well as widgets, buttons, overlays, and text properties.
 ;;;### (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" (19383 49279))
+;;;;;;  "desktop.el" (19372 27330))
 ;;; Generated autoloads from desktop.el
 
 (defvar desktop-save-mode nil "\
@@ -5903,7 +5908,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" (19383 49279))
+;;;;;;  "deuglify" "gnus/deuglify.el" (19279 5150))
 ;;; Generated autoloads from gnus/deuglify.el
 
 (autoload 'gnus-article-outlook-unwrap-lines "deuglify" "\
@@ -5936,7 +5941,7 @@ Deuglify broken Outlook (Express) articles and redisplay.
 ;;;***
 \f
 ;;;### (autoloads (diary-mode diary-mail-entries diary) "diary-lib"
-;;;;;;  "calendar/diary-lib.el" (19383 49276))
+;;;;;;  "calendar/diary-lib.el" (19299 25154))
 ;;; Generated autoloads from calendar/diary-lib.el
 
 (autoload 'diary "diary-lib" "\
@@ -5979,7 +5984,7 @@ Major mode for editing the diary file.
 ;;;***
 \f
 ;;;### (autoloads (diff-backup diff diff-command diff-switches) "diff"
-;;;;;;  "diff.el" (19419 35832))
+;;;;;;  "diff.el" (19279 5148))
 ;;; Generated autoloads from diff.el
 
 (defvar diff-switches (purecopy "-c") "\
@@ -6017,7 +6022,7 @@ With prefix arg, prompt for diff switches.
 ;;;***
 \f
 ;;;### (autoloads (diff-minor-mode diff-mode) "diff-mode" "diff-mode.el"
-;;;;;;  (19383 49279))
+;;;;;;  (19356 10801))
 ;;; Generated autoloads from diff-mode.el
 
 (autoload 'diff-mode "diff-mode" "\
@@ -6045,7 +6050,7 @@ Minor mode for viewing/editing context diffs.
 
 ;;;***
 \f
-;;;### (autoloads (dig) "dig" "net/dig.el" (19383 49279))
+;;;### (autoloads (dig) "dig" "net/dig.el" (19279 5151))
 ;;; Generated autoloads from net/dig.el
 
 (autoload 'dig "dig" "\
@@ -6058,7 +6063,7 @@ Optional arguments are passed to `dig-invoke'.
 \f
 ;;;### (autoloads (dired-mode dired-auto-revert-buffer dired-noselect
 ;;;;;;  dired-other-frame dired-other-window dired dired-trivial-filenames
-;;;;;;  dired-listing-switches) "dired" "dired.el" (19383 49276))
+;;;;;;  dired-listing-switches) "dired" "dired.el" (19313 15414))
 ;;; Generated autoloads from dired.el
 
 (defvar dired-listing-switches (purecopy "-al") "\
@@ -6203,7 +6208,7 @@ Keybindings:
 ;;;***
 \f
 ;;;### (autoloads (dirtrack dirtrack-mode) "dirtrack" "dirtrack.el"
-;;;;;;  (19383 49276))
+;;;;;;  (19299 25154))
 ;;; Generated autoloads from dirtrack.el
 
 (autoload 'dirtrack-mode "dirtrack" "\
@@ -6229,8 +6234,8 @@ function `dirtrack-debug-mode' to turn on debugging output.
 
 ;;;***
 \f
-;;;### (autoloads (disassemble) "disass" "emacs-lisp/disass.el" (19383
-;;;;;;  49279))
+;;;### (autoloads (disassemble) "disass" "emacs-lisp/disass.el" (19279
+;;;;;;  5149))
 ;;; Generated autoloads from emacs-lisp/disass.el
 
 (autoload 'disassemble "disass" "\
@@ -6249,7 +6254,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" (19383 49279))
+;;;;;;  "disp-table" "disp-table.el" (19279 5148))
 ;;; Generated autoloads from disp-table.el
 
 (autoload 'make-display-table "disp-table" "\
@@ -6361,7 +6366,7 @@ in `.emacs'.
 ;;;***
 \f
 ;;;### (autoloads (dissociated-press) "dissociate" "play/dissociate.el"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5151))
 ;;; Generated autoloads from play/dissociate.el
 
 (autoload 'dissociated-press "dissociate" "\
@@ -6377,7 +6382,7 @@ Default is 2.
 
 ;;;***
 \f
-;;;### (autoloads (dnd-protocol-alist) "dnd" "dnd.el" (19383 49279))
+;;;### (autoloads (dnd-protocol-alist) "dnd" "dnd.el" (19279 5148))
 ;;; 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)) "\
@@ -6398,7 +6403,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" (19383 49279))
+;;;;;;  "textmodes/dns-mode.el" (19279 5152))
 ;;; Generated autoloads from textmodes/dns-mode.el
 
 (autoload 'dns-mode "dns-mode" "\
@@ -6423,7 +6428,7 @@ Locate SOA record and increment the serial field.
 ;;;***
 \f
 ;;;### (autoloads (doc-view-bookmark-jump doc-view-minor-mode doc-view-mode
-;;;;;;  doc-view-mode-p) "doc-view" "doc-view.el" (19383 49276))
+;;;;;;  doc-view-mode-p) "doc-view" "doc-view.el" (19323 49698))
 ;;; Generated autoloads from doc-view.el
 
 (autoload 'doc-view-mode-p "doc-view" "\
@@ -6458,7 +6463,7 @@ Not documented
 
 ;;;***
 \f
-;;;### (autoloads (doctor) "doctor" "play/doctor.el" (19383 49279))
+;;;### (autoloads (doctor) "doctor" "play/doctor.el" (19279 5151))
 ;;; Generated autoloads from play/doctor.el
 
 (autoload 'doctor "doctor" "\
@@ -6468,7 +6473,7 @@ Switch to *doctor* buffer and start giving psychotherapy.
 
 ;;;***
 \f
-;;;### (autoloads (double-mode) "double" "double.el" (19383 49279))
+;;;### (autoloads (double-mode) "double" "double.el" (19279 5148))
 ;;; Generated autoloads from double.el
 
 (autoload 'double-mode "double" "\
@@ -6483,7 +6488,7 @@ when pressed twice.  See variable `double-map' for details.
 
 ;;;***
 \f
-;;;### (autoloads (dunnet) "dunnet" "play/dunnet.el" (19383 49279))
+;;;### (autoloads (dunnet) "dunnet" "play/dunnet.el" (19279 5151))
 ;;; Generated autoloads from play/dunnet.el
 
 (autoload 'dunnet "dunnet" "\
@@ -6494,7 +6499,7 @@ Switch to *dungeon* buffer and start game.
 ;;;***
 \f
 ;;;### (autoloads (gnus-earcon-display) "earcon" "gnus/earcon.el"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5150))
 ;;; Generated autoloads from gnus/earcon.el
 
 (autoload 'gnus-earcon-display "earcon" "\
@@ -6506,7 +6511,7 @@ Play sounds in message buffers.
 \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" (19383 49279))
+;;;;;;  "emacs-lisp/easy-mmode.el" (19279 5149))
 ;;; Generated autoloads from emacs-lisp/easy-mmode.el
 
 (defalias 'easy-mmode-define-minor-mode 'define-minor-mode)
@@ -6611,8 +6616,8 @@ CSS contains a list of syntax specifications of the form (CHAR . SYNTAX).
 ;;;***
 \f
 ;;;### (autoloads (easy-menu-change easy-menu-create-menu easy-menu-do-define
-;;;;;;  easy-menu-define) "easymenu" "emacs-lisp/easymenu.el" (19383
-;;;;;;  49279))
+;;;;;;  easy-menu-define) "easymenu" "emacs-lisp/easymenu.el" (19279
+;;;;;;  5149))
 ;;; Generated autoloads from emacs-lisp/easymenu.el
 
 (put 'easy-menu-define 'lisp-indent-function 'defun)
@@ -6766,7 +6771,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" (19383 49279))
+;;;;;;  "progmodes/ebnf2ps.el" (19279 5151))
 ;;; Generated autoloads from progmodes/ebnf2ps.el
 
 (autoload 'ebnf-customize "ebnf2ps" "\
@@ -7040,8 +7045,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" (19383
-;;;;;;  49279))
+;;;;;;  ebrowse-tree-mode) "ebrowse" "progmodes/ebrowse.el" (19279
+;;;;;;  5151))
 ;;; Generated autoloads from progmodes/ebrowse.el
 
 (autoload 'ebrowse-tree-mode "ebrowse" "\
@@ -7192,7 +7197,7 @@ Display statistics for a class tree.
 ;;;***
 \f
 ;;;### (autoloads (electric-buffer-list) "ebuff-menu" "ebuff-menu.el"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5148))
 ;;; Generated autoloads from ebuff-menu.el
 
 (autoload 'electric-buffer-list "ebuff-menu" "\
@@ -7217,7 +7222,7 @@ Run hooks in `electric-buffer-menu-mode-hook' on entry.
 ;;;***
 \f
 ;;;### (autoloads (Electric-command-history-redo-expression) "echistory"
-;;;;;;  "echistory.el" (19383 49279))
+;;;;;;  "echistory.el" (19279 5148))
 ;;; Generated autoloads from echistory.el
 
 (autoload 'Electric-command-history-redo-expression "echistory" "\
@@ -7229,7 +7234,7 @@ With prefix arg NOCONFIRM, execute current line as-is without editing.
 ;;;***
 \f
 ;;;### (autoloads (ecomplete-setup) "ecomplete" "gnus/ecomplete.el"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5150))
 ;;; Generated autoloads from gnus/ecomplete.el
 
 (autoload 'ecomplete-setup "ecomplete" "\
@@ -7239,7 +7244,7 @@ Not documented
 
 ;;;***
 \f
-;;;### (autoloads (global-ede-mode) "ede" "cedet/ede.el" (19383 49276))
+;;;### (autoloads (global-ede-mode) "ede" "cedet/ede.el" (19323 49698))
 ;;; Generated autoloads from cedet/ede.el
 
 (defvar global-ede-mode nil "\
@@ -7265,7 +7270,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" (19383 49279))
+;;;;;;  "emacs-lisp/edebug.el" (19279 5149))
 ;;; Generated autoloads from emacs-lisp/edebug.el
 
 (defvar edebug-all-defs nil "\
@@ -7338,7 +7343,7 @@ 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" "ediff.el" (19383 49279))
+;;;;;;  ediff-files3 ediff-files) "ediff" "ediff.el" (19279 5148))
 ;;; Generated autoloads from ediff.el
 
 (autoload 'ediff-files "ediff" "\
@@ -7570,7 +7575,7 @@ With optional NODE, goes to that node.
 ;;;***
 \f
 ;;;### (autoloads (ediff-customize) "ediff-help" "ediff-help.el"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5148))
 ;;; Generated autoloads from ediff-help.el
 
 (autoload 'ediff-customize "ediff-help" "\
@@ -7581,7 +7586,7 @@ Not documented
 ;;;***
 \f
 ;;;### (autoloads (ediff-show-registry) "ediff-mult" "ediff-mult.el"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5148))
 ;;; Generated autoloads from ediff-mult.el
 
 (autoload 'ediff-show-registry "ediff-mult" "\
@@ -7594,7 +7599,7 @@ Display Ediff's registry.
 ;;;***
 \f
 ;;;### (autoloads (ediff-toggle-use-toolbar ediff-toggle-multiframe)
-;;;;;;  "ediff-util" "ediff-util.el" (19383 49276))
+;;;;;;  "ediff-util" "ediff-util.el" (19313 15414))
 ;;; Generated autoloads from ediff-util.el
 
 (autoload 'ediff-toggle-multiframe "ediff-util" "\
@@ -7615,7 +7620,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"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5148))
 ;;; Generated autoloads from edmacro.el
 
 (defvar edmacro-eight-bits nil "\
@@ -7668,7 +7673,7 @@ or nil, use a compact 80-column format.
 ;;;***
 \f
 ;;;### (autoloads (edt-emulation-on edt-set-scroll-margins) "edt"
-;;;;;;  "emulation/edt.el" (19383 49279))
+;;;;;;  "emulation/edt.el" (19281 39617))
 ;;; Generated autoloads from emulation/edt.el
 
 (autoload 'edt-set-scroll-margins "edt" "\
@@ -7686,7 +7691,7 @@ Turn on EDT Emulation.
 ;;;***
 \f
 ;;;### (autoloads (electric-helpify with-electric-help) "ehelp" "ehelp.el"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5148))
 ;;; Generated autoloads from ehelp.el
 
 (autoload 'with-electric-help "ehelp" "\
@@ -7723,7 +7728,7 @@ Not documented
 ;;;***
 \f
 ;;;### (autoloads (turn-on-eldoc-mode eldoc-mode eldoc-minor-mode-string)
-;;;;;;  "eldoc" "emacs-lisp/eldoc.el" (19383 49279))
+;;;;;;  "eldoc" "emacs-lisp/eldoc.el" (19279 5149))
 ;;; Generated autoloads from emacs-lisp/eldoc.el
 
 (defvar eldoc-minor-mode-string (purecopy " ElDoc") "\
@@ -7766,8 +7771,8 @@ Emacs Lisp mode) that support ElDoc.")
 
 ;;;***
 \f
-;;;### (autoloads (elide-head) "elide-head" "elide-head.el" (19383
-;;;;;;  49279))
+;;;### (autoloads (elide-head) "elide-head" "elide-head.el" (19279
+;;;;;;  5148))
 ;;; Generated autoloads from elide-head.el
 
 (autoload 'elide-head "elide-head" "\
@@ -7784,7 +7789,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"
-;;;;;;  (19383 49284))
+;;;;;;  (19338 9840))
 ;;; Generated autoloads from emacs-lisp/elint.el
 
 (autoload 'elint-file "elint" "\
@@ -7820,8 +7825,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" (19383
-;;;;;;  49279))
+;;;;;;  elp-instrument-function) "elp" "emacs-lisp/elp.el" (19279
+;;;;;;  5149))
 ;;; Generated autoloads from emacs-lisp/elp.el
 
 (autoload 'elp-instrument-function "elp" "\
@@ -7856,7 +7861,7 @@ displayed.
 ;;;***
 \f
 ;;;### (autoloads (report-emacs-bug) "emacsbug" "mail/emacsbug.el"
-;;;;;;  (19383 49279))
+;;;;;;  (19365 25156))
 ;;; Generated autoloads from mail/emacsbug.el
 
 (autoload 'report-emacs-bug "emacsbug" "\
@@ -7871,7 +7876,7 @@ Prompts for bug subject.  Leaves you in a mail buffer.
 ;;;;;;  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"
-;;;;;;  "emerge.el" (19383 49279))
+;;;;;;  "emerge.el" (19256 49601))
 ;;; Generated autoloads from emerge.el
 
 (autoload 'emerge-files "emerge" "\
@@ -7932,7 +7937,7 @@ Not documented
 ;;;***
 \f
 ;;;### (autoloads (enriched-decode enriched-encode enriched-mode)
-;;;;;;  "enriched" "textmodes/enriched.el" (19383 49279))
+;;;;;;  "enriched" "textmodes/enriched.el" (19279 5152))
 ;;; Generated autoloads from textmodes/enriched.el
 
 (autoload 'enriched-mode "enriched" "\
@@ -7967,8 +7972,8 @@ Not documented
 ;;;;;;  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" (19383
-;;;;;;  49279))
+;;;;;;  epa-list-secret-keys epa-list-keys) "epa" "epa.el" (19279
+;;;;;;  5148))
 ;;; Generated autoloads from epa.el
 
 (autoload 'epa-list-keys "epa" "\
@@ -8141,7 +8146,7 @@ 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" (19383 49279))
+;;;;;;  epa-dired-do-decrypt) "epa-dired" "epa-dired.el" (19279 5148))
 ;;; Generated autoloads from epa-dired.el
 
 (autoload 'epa-dired-do-decrypt "epa-dired" "\
@@ -8167,7 +8172,7 @@ Encrypt marked files.
 ;;;***
 \f
 ;;;### (autoloads (epa-file-disable epa-file-enable epa-file-handler)
-;;;;;;  "epa-file" "epa-file.el" (19383 49279))
+;;;;;;  "epa-file" "epa-file.el" (19279 5148))
 ;;; Generated autoloads from epa-file.el
 
 (autoload 'epa-file-handler "epa-file" "\
@@ -8189,7 +8194,7 @@ Not documented
 \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" (19383 49279))
+;;;;;;  "epa-mail" "epa-mail.el" (19279 5148))
 ;;; Generated autoloads from epa-mail.el
 
 (autoload 'epa-mail-mode "epa-mail" "\
@@ -8253,7 +8258,7 @@ Minor mode to hook EasyPG into Mail mode.
 
 ;;;***
 \f
-;;;### (autoloads (epg-make-context) "epg" "epg.el" (19383 49279))
+;;;### (autoloads (epg-make-context) "epg" "epg.el" (19279 5148))
 ;;; Generated autoloads from epg.el
 
 (autoload 'epg-make-context "epg" "\
@@ -8264,7 +8269,7 @@ Return a context object.
 ;;;***
 \f
 ;;;### (autoloads (epg-expand-group epg-check-configuration epg-configuration)
-;;;;;;  "epg-config" "epg-config.el" (19383 49279))
+;;;;;;  "epg-config" "epg-config.el" (19356 10801))
 ;;; Generated autoloads from epg-config.el
 
 (autoload 'epg-configuration "epg-config" "\
@@ -8285,7 +8290,7 @@ Look at CONFIG and try to expand GROUP.
 ;;;***
 \f
 ;;;### (autoloads (erc-handle-irc-url erc erc-select-read-args) "erc"
-;;;;;;  "erc/erc.el" (19383 49276))
+;;;;;;  "erc/erc.el" (19299 25154))
 ;;; Generated autoloads from erc/erc.el
 
 (autoload 'erc-select-read-args "erc" "\
@@ -8327,33 +8332,33 @@ Otherwise, connect to HOST:PORT as USER and /join CHANNEL.
 
 ;;;***
 \f
-;;;### (autoloads nil "erc-autoaway" "erc/erc-autoaway.el" (19383
-;;;;;;  49279))
+;;;### (autoloads nil "erc-autoaway" "erc/erc-autoaway.el" (19279
+;;;;;;  5150))
 ;;; Generated autoloads from erc/erc-autoaway.el
  (autoload 'erc-autoaway-mode "erc-autoaway")
 
 ;;;***
 \f
-;;;### (autoloads nil "erc-button" "erc/erc-button.el" (19383 49279))
+;;;### (autoloads nil "erc-button" "erc/erc-button.el" (19279 5150))
 ;;; Generated autoloads from erc/erc-button.el
  (autoload 'erc-button-mode "erc-button" nil t)
 
 ;;;***
 \f
-;;;### (autoloads nil "erc-capab" "erc/erc-capab.el" (19383 49279))
+;;;### (autoloads nil "erc-capab" "erc/erc-capab.el" (19279 5150))
 ;;; 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" (19383 49279))
+;;;### (autoloads nil "erc-compat" "erc/erc-compat.el" (19279 5150))
 ;;; 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" (19383 49279))
+;;;;;;  "erc-dcc" "erc/erc-dcc.el" (19279 5150))
 ;;; Generated autoloads from erc/erc-dcc.el
  (autoload 'erc-dcc-mode "erc-dcc")
 
@@ -8386,7 +8391,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"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5150))
 ;;; Generated autoloads from erc/erc-ezbounce.el
 
 (autoload 'erc-cmd-ezb "erc-ezbounce" "\
@@ -8448,8 +8453,8 @@ Add EZBouncer convenience functions to ERC.
 
 ;;;***
 \f
-;;;### (autoloads (erc-fill) "erc-fill" "erc/erc-fill.el" (19383
-;;;;;;  49279))
+;;;### (autoloads (erc-fill) "erc-fill" "erc/erc-fill.el" (19279
+;;;;;;  5150))
 ;;; Generated autoloads from erc/erc-fill.el
  (autoload 'erc-fill-mode "erc-fill" nil t)
 
@@ -8461,15 +8466,15 @@ You can put this on `erc-insert-modify-hook' and/or `erc-send-modify-hook'.
 
 ;;;***
 \f
-;;;### (autoloads nil "erc-hecomplete" "erc/erc-hecomplete.el" (19383
-;;;;;;  49279))
+;;;### (autoloads nil "erc-hecomplete" "erc/erc-hecomplete.el" (19279
+;;;;;;  5150))
 ;;; Generated autoloads from erc/erc-hecomplete.el
  (autoload 'erc-hecomplete-mode "erc-hecomplete" nil t)
 
 ;;;***
 \f
 ;;;### (autoloads (erc-identd-stop erc-identd-start) "erc-identd"
-;;;;;;  "erc/erc-identd.el" (19383 49279))
+;;;;;;  "erc/erc-identd.el" (19279 5150))
 ;;; Generated autoloads from erc/erc-identd.el
  (autoload 'erc-identd-mode "erc-identd")
 
@@ -8491,7 +8496,7 @@ Not documented
 ;;;***
 \f
 ;;;### (autoloads (erc-create-imenu-index) "erc-imenu" "erc/erc-imenu.el"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5150))
 ;;; Generated autoloads from erc/erc-imenu.el
 
 (autoload 'erc-create-imenu-index "erc-imenu" "\
@@ -8501,20 +8506,20 @@ Not documented
 
 ;;;***
 \f
-;;;### (autoloads nil "erc-join" "erc/erc-join.el" (19383 49279))
+;;;### (autoloads nil "erc-join" "erc/erc-join.el" (19279 5150))
 ;;; Generated autoloads from erc/erc-join.el
  (autoload 'erc-autojoin-mode "erc-join" nil t)
 
 ;;;***
 \f
-;;;### (autoloads nil "erc-list" "erc/erc-list.el" (19383 49279))
+;;;### (autoloads nil "erc-list" "erc/erc-list.el" (19279 5150))
 ;;; 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" (19383 49279))
+;;;;;;  "erc/erc-log.el" (19279 5150))
 ;;; Generated autoloads from erc/erc-log.el
  (autoload 'erc-log-mode "erc-log" nil t)
 
@@ -8546,7 +8551,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"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5150))
 ;;; Generated autoloads from erc/erc-match.el
  (autoload 'erc-match-mode "erc-match")
 
@@ -8592,14 +8597,14 @@ Delete dangerous-host interactively to `erc-dangerous-hosts'.
 
 ;;;***
 \f
-;;;### (autoloads nil "erc-menu" "erc/erc-menu.el" (19383 49279))
+;;;### (autoloads nil "erc-menu" "erc/erc-menu.el" (19279 5150))
 ;;; 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"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5150))
 ;;; Generated autoloads from erc/erc-netsplit.el
  (autoload 'erc-netsplit-mode "erc-netsplit")
 
@@ -8611,7 +8616,7 @@ Show who's gone.
 ;;;***
 \f
 ;;;### (autoloads (erc-server-select erc-determine-network) "erc-networks"
-;;;;;;  "erc/erc-networks.el" (19383 49279))
+;;;;;;  "erc/erc-networks.el" (19279 5150))
 ;;; Generated autoloads from erc/erc-networks.el
 
 (autoload 'erc-determine-network "erc-networks" "\
@@ -8629,7 +8634,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" (19383 49279))
+;;;;;;  "erc/erc-notify.el" (19279 5150))
 ;;; Generated autoloads from erc/erc-notify.el
  (autoload 'erc-notify-mode "erc-notify" nil t)
 
@@ -8647,33 +8652,33 @@ Not documented
 
 ;;;***
 \f
-;;;### (autoloads nil "erc-page" "erc/erc-page.el" (19383 49279))
+;;;### (autoloads nil "erc-page" "erc/erc-page.el" (19279 5150))
 ;;; Generated autoloads from erc/erc-page.el
  (autoload 'erc-page-mode "erc-page")
 
 ;;;***
 \f
-;;;### (autoloads nil "erc-pcomplete" "erc/erc-pcomplete.el" (19383
-;;;;;;  49279))
+;;;### (autoloads nil "erc-pcomplete" "erc/erc-pcomplete.el" (19279
+;;;;;;  5150))
 ;;; Generated autoloads from erc/erc-pcomplete.el
  (autoload 'erc-completion-mode "erc-pcomplete" nil t)
 
 ;;;***
 \f
-;;;### (autoloads nil "erc-replace" "erc/erc-replace.el" (19383 49279))
+;;;### (autoloads nil "erc-replace" "erc/erc-replace.el" (19279 5150))
 ;;; Generated autoloads from erc/erc-replace.el
  (autoload 'erc-replace-mode "erc-replace")
 
 ;;;***
 \f
-;;;### (autoloads nil "erc-ring" "erc/erc-ring.el" (19383 49279))
+;;;### (autoloads nil "erc-ring" "erc/erc-ring.el" (19279 5150))
 ;;; 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" (19383 49276))
+;;;;;;  "erc-services" "erc/erc-services.el" (19313 15414))
 ;;; Generated autoloads from erc/erc-services.el
  (autoload 'erc-services-mode "erc-services" nil t)
 
@@ -8690,14 +8695,14 @@ When called interactively, read the password using `read-passwd'.
 
 ;;;***
 \f
-;;;### (autoloads nil "erc-sound" "erc/erc-sound.el" (19383 49279))
+;;;### (autoloads nil "erc-sound" "erc/erc-sound.el" (19279 5150))
 ;;; Generated autoloads from erc/erc-sound.el
  (autoload 'erc-sound-mode "erc-sound")
 
 ;;;***
 \f
 ;;;### (autoloads (erc-speedbar-browser) "erc-speedbar" "erc/erc-speedbar.el"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5150))
 ;;; Generated autoloads from erc/erc-speedbar.el
 
 (autoload 'erc-speedbar-browser "erc-speedbar" "\
@@ -8708,21 +8713,21 @@ This will add a speedbar major display mode.
 
 ;;;***
 \f
-;;;### (autoloads nil "erc-spelling" "erc/erc-spelling.el" (19383
-;;;;;;  49279))
+;;;### (autoloads nil "erc-spelling" "erc/erc-spelling.el" (19279
+;;;;;;  5150))
 ;;; Generated autoloads from erc/erc-spelling.el
  (autoload 'erc-spelling-mode "erc-spelling" nil t)
 
 ;;;***
 \f
-;;;### (autoloads nil "erc-stamp" "erc/erc-stamp.el" (19383 49279))
+;;;### (autoloads nil "erc-stamp" "erc/erc-stamp.el" (19279 5150))
 ;;; 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"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5150))
 ;;; Generated autoloads from erc/erc-track.el
 
 (defvar erc-track-minor-mode nil "\
@@ -8745,7 +8750,7 @@ module, otherwise the keybindings will not do anything useful.
 ;;;***
 \f
 ;;;### (autoloads (erc-truncate-buffer erc-truncate-buffer-to-size)
-;;;;;;  "erc-truncate" "erc/erc-truncate.el" (19383 49279))
+;;;;;;  "erc-truncate" "erc/erc-truncate.el" (19279 5150))
 ;;; Generated autoloads from erc/erc-truncate.el
  (autoload 'erc-truncate-mode "erc-truncate" nil t)
 
@@ -8765,7 +8770,7 @@ Meant to be used in hooks, like `erc-insert-post-hook'.
 ;;;***
 \f
 ;;;### (autoloads (erc-xdcc-add-file) "erc-xdcc" "erc/erc-xdcc.el"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5150))
 ;;; Generated autoloads from erc/erc-xdcc.el
  (autoload 'erc-xdcc-mode "erc-xdcc")
 
@@ -8776,8 +8781,8 @@ Add a file to `erc-xdcc-files'.
 
 ;;;***
 \f
-;;;### (autoloads (eshell-mode) "esh-mode" "eshell/esh-mode.el" (19383
-;;;;;;  49279))
+;;;### (autoloads (eshell-mode) "esh-mode" "eshell/esh-mode.el" (19279
+;;;;;;  5150))
 ;;; Generated autoloads from eshell/esh-mode.el
 
 (autoload 'eshell-mode "esh-mode" "\
@@ -8789,8 +8794,8 @@ Emacs shell interactive mode.
 
 ;;;***
 \f
-;;;### (autoloads (eshell-test) "esh-test" "eshell/esh-test.el" (19383
-;;;;;;  49279))
+;;;### (autoloads (eshell-test) "esh-test" "eshell/esh-test.el" (19279
+;;;;;;  5150))
 ;;; Generated autoloads from eshell/esh-test.el
 
 (autoload 'eshell-test "esh-test" "\
@@ -8801,7 +8806,7 @@ Test Eshell to verify that it works as expected.
 ;;;***
 \f
 ;;;### (autoloads (eshell-command-result eshell-command eshell) "eshell"
-;;;;;;  "eshell/eshell.el" (19383 49284))
+;;;;;;  "eshell/eshell.el" (19330 37505))
 ;;; Generated autoloads from eshell/eshell.el
 
 (autoload 'eshell "eshell" "\
@@ -8842,7 +8847,7 @@ 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"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5151))
 ;;; Generated autoloads from progmodes/etags.el
 
 (defvar tags-file-name nil "\
@@ -9150,7 +9155,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"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5150))
 ;;; Generated autoloads from language/ethio-util.el
 
 (autoload 'setup-ethiopic-environment-internal "ethio-util" "\
@@ -9320,7 +9325,7 @@ Not documented
 \f
 ;;;### (autoloads (eudc-load-eudc eudc-query-form eudc-expand-inline
 ;;;;;;  eudc-get-phone eudc-get-email eudc-set-server) "eudc" "net/eudc.el"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5151))
 ;;; Generated autoloads from net/eudc.el
 
 (autoload 'eudc-set-server "eudc" "\
@@ -9376,7 +9381,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" (19383 49279))
+;;;;;;  "eudc-bob" "net/eudc-bob.el" (19279 5151))
 ;;; Generated autoloads from net/eudc-bob.el
 
 (autoload 'eudc-display-generic-binary "eudc-bob" "\
@@ -9412,7 +9417,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" (19383 49279))
+;;;;;;  "eudc-export" "net/eudc-export.el" (19279 5151))
 ;;; Generated autoloads from net/eudc-export.el
 
 (autoload 'eudc-insert-record-at-point-into-bbdb "eudc-export" "\
@@ -9429,7 +9434,7 @@ Call `eudc-insert-record-at-point-into-bbdb' if on a record.
 ;;;***
 \f
 ;;;### (autoloads (eudc-edit-hotlist) "eudc-hotlist" "net/eudc-hotlist.el"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5151))
 ;;; Generated autoloads from net/eudc-hotlist.el
 
 (autoload 'eudc-edit-hotlist "eudc-hotlist" "\
@@ -9439,8 +9444,8 @@ Edit the hotlist of directory servers in a specialized buffer.
 
 ;;;***
 \f
-;;;### (autoloads (ewoc-create) "ewoc" "emacs-lisp/ewoc.el" (19383
-;;;;;;  49279))
+;;;### (autoloads (ewoc-create) "ewoc" "emacs-lisp/ewoc.el" (19279
+;;;;;;  5149))
 ;;; Generated autoloads from emacs-lisp/ewoc.el
 
 (autoload 'ewoc-create "ewoc" "\
@@ -9469,7 +9474,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"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5151))
 ;;; Generated autoloads from progmodes/executable.el
 
 (autoload 'executable-command-find-posix-p "executable" "\
@@ -9512,7 +9517,7 @@ file modes.
 \f
 ;;;### (autoloads (expand-jump-to-next-slot expand-jump-to-previous-slot
 ;;;;;;  expand-abbrev-hook expand-add-abbrevs) "expand" "expand.el"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5148))
 ;;; Generated autoloads from expand.el
 
 (autoload 'expand-add-abbrevs "expand" "\
@@ -9561,7 +9566,7 @@ This is used only in conjunction with `expand-add-abbrevs'.
 
 ;;;***
 \f
-;;;### (autoloads (f90-mode) "f90" "progmodes/f90.el" (19383 49276))
+;;;### (autoloads (f90-mode) "f90" "progmodes/f90.el" (19326 6129))
 ;;; Generated autoloads from progmodes/f90.el
 
 (autoload 'f90-mode "f90" "\
@@ -9627,8 +9632,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" (19383
-;;;;;;  49279))
+;;;;;;  face-remap-add-relative) "face-remap" "face-remap.el" (19358
+;;;;;;  54001))
 ;;; Generated autoloads from face-remap.el
 
 (autoload 'face-remap-add-relative "face-remap" "\
@@ -9768,7 +9773,7 @@ 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" (19383 49279))
+;;;;;;  feedmail-send-it) "feedmail" "mail/feedmail.el" (19256 49601))
 ;;; Generated autoloads from mail/feedmail.el
 
 (autoload 'feedmail-send-it "feedmail" "\
@@ -9822,7 +9827,7 @@ 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" (19383 49276))
+;;;;;;  find-file-at-point ffap-next) "ffap" "ffap.el" (19321 4517))
 ;;; Generated autoloads from ffap.el
 
 (autoload 'ffap-next "ffap" "\
@@ -9886,7 +9891,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" (19409 46567))
+;;;;;;  "filecache" "filecache.el" (19279 5148))
 ;;; Generated autoloads from filecache.el
 
 (autoload 'file-cache-add-directory "filecache" "\
@@ -9899,8 +9904,8 @@ be added to the cache.
 (autoload 'file-cache-add-directory-list "filecache" "\
 Add DIRECTORY-LIST (a list of directory names) to the file cache.
 If the optional REGEXP argument is non-nil, only files which match it
-will be added to the cache.  Note that the REGEXP is applied to the
-files in each directory, not to the directory list itself.
+will be added to the cache. Note that the REGEXP is applied to the files
+in each directory, not to the directory list itself.
 
 \(fn DIRECTORY-LIST &optional REGEXP)" t nil)
 
@@ -9923,10 +9928,10 @@ STRING is passed as an argument to the locate command.
 
 (autoload 'file-cache-add-directory-recursively "filecache" "\
 Adds DIR and any subdirectories to the file-cache.
-This function does not use any external programs.
+This function does not use any external programs
 If the optional REGEXP argument is non-nil, only files which match it
-will be added to the cache.  Note that the REGEXP is applied to the
-files in each directory, not to the directory list itself.
+will be added to the cache. Note that the REGEXP is applied to the files
+in each directory, not to the directory list itself.
 
 \(fn DIR &optional REGEXP)" t nil)
 
@@ -9946,7 +9951,7 @@ 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" (19383 49279))
+;;;;;;  add-file-local-variable) "files-x" "files-x.el" (19279 5148))
 ;;; Generated autoloads from files-x.el
 
 (autoload 'add-file-local-variable "files-x" "\
@@ -10011,8 +10016,8 @@ Copy directory-local variables to the -*- line.
 
 ;;;***
 \f
-;;;### (autoloads (filesets-init) "filesets" "filesets.el" (19383
-;;;;;;  49279))
+;;;### (autoloads (filesets-init) "filesets" "filesets.el" (19279
+;;;;;;  5148))
 ;;; Generated autoloads from filesets.el
 
 (autoload 'filesets-init "filesets" "\
@@ -10023,7 +10028,7 @@ Set up hooks, load the cache file -- if existing -- and build the menu.
 
 ;;;***
 \f
-;;;### (autoloads (find-cmd) "find-cmd" "find-cmd.el" (19383 49279))
+;;;### (autoloads (find-cmd) "find-cmd" "find-cmd.el" (19279 38446))
 ;;; Generated autoloads from find-cmd.el
 
 (autoload 'find-cmd "find-cmd" "\
@@ -10044,7 +10049,7 @@ result is a string that should be ready for the command line.
 \f
 ;;;### (autoloads (find-grep-dired find-name-dired find-dired find-grep-options
 ;;;;;;  find-ls-subdir-switches find-ls-option) "find-dired" "find-dired.el"
-;;;;;;  (19422 11991))
+;;;;;;  (19375 49830))
 ;;; Generated autoloads from find-dired.el
 
 (defvar find-ls-option (if (eq system-type 'berkeley-unix) (purecopy '("-ls" . "-gilsb")) (purecopy '("-exec ls -ld {} \\;" . "-ld"))) "\
@@ -10105,7 +10110,7 @@ Thus ARG can also contain additional grep options.
 \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"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5148))
 ;;; 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)))) "\
@@ -10199,7 +10204,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" (19383 49279))
+;;;;;;  "emacs-lisp/find-func.el" (19279 5149))
 ;;; Generated autoloads from emacs-lisp/find-func.el
 
 (autoload 'find-library "find-func" "\
@@ -10354,7 +10359,7 @@ 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" (19383 49279))
+;;;;;;  find-lisp-find-dired) "find-lisp" "find-lisp.el" (19279 5148))
 ;;; Generated autoloads from find-lisp.el
 
 (autoload 'find-lisp-find-dired "find-lisp" "\
@@ -10375,7 +10380,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" (19383 49279))
+;;;;;;  "finder" "finder.el" (19368 35187))
 ;;; Generated autoloads from finder.el
 
 (autoload 'finder-list-keywords "finder" "\
@@ -10397,7 +10402,7 @@ Find packages matching a given keyword.
 ;;;***
 \f
 ;;;### (autoloads (enable-flow-control-on enable-flow-control) "flow-ctrl"
-;;;;;;  "flow-ctrl.el" (19383 49279))
+;;;;;;  "flow-ctrl.el" (19279 5148))
 ;;; Generated autoloads from flow-ctrl.el
 
 (autoload 'enable-flow-control "flow-ctrl" "\
@@ -10419,7 +10424,7 @@ to get the effect of a C-q.
 ;;;***
 \f
 ;;;### (autoloads (fill-flowed fill-flowed-encode) "flow-fill" "gnus/flow-fill.el"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5150))
 ;;; Generated autoloads from gnus/flow-fill.el
 
 (autoload 'fill-flowed-encode "flow-fill" "\
@@ -10435,7 +10440,7 @@ Not documented
 ;;;***
 \f
 ;;;### (autoloads (flymake-mode-off flymake-mode-on flymake-mode)
-;;;;;;  "flymake" "progmodes/flymake.el" (19383 49276))
+;;;;;;  "flymake" "progmodes/flymake.el" (19299 25155))
 ;;; Generated autoloads from progmodes/flymake.el
 
 (autoload 'flymake-mode "flymake" "\
@@ -10459,7 +10464,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" (19383 49284))
+;;;;;;  "flyspell" "textmodes/flyspell.el" (19370 36541))
 ;;; Generated autoloads from textmodes/flyspell.el
 
 (autoload 'flyspell-prog-mode "flyspell" "\
@@ -10529,7 +10534,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"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5148))
 ;;; Generated autoloads from follow.el
 
 (autoload 'turn-on-follow-mode "follow" "\
@@ -10602,8 +10607,8 @@ in your `~/.emacs' file, replacing [f7] by your favourite key:
 
 ;;;***
 \f
-;;;### (autoloads (footnote-mode) "footnote" "mail/footnote.el" (19383
-;;;;;;  49279))
+;;;### (autoloads (footnote-mode) "footnote" "mail/footnote.el" (19279
+;;;;;;  5150))
 ;;; Generated autoloads from mail/footnote.el
 
 (autoload 'footnote-mode "footnote" "\
@@ -10617,7 +10622,7 @@ started, play around with the following keys:
 ;;;***
 \f
 ;;;### (autoloads (forms-find-file-other-window forms-find-file forms-mode)
-;;;;;;  "forms" "forms.el" (19383 49279))
+;;;;;;  "forms" "forms.el" (19279 5148))
 ;;; Generated autoloads from forms.el
 
 (autoload 'forms-mode "forms" "\
@@ -10654,7 +10659,7 @@ Visit a file in Forms mode in other window.
 ;;;***
 \f
 ;;;### (autoloads (fortran-mode) "fortran" "progmodes/fortran.el"
-;;;;;;  (19392 38041))
+;;;;;;  (19279 5151))
 ;;; Generated autoloads from progmodes/fortran.el
 
 (autoload 'fortran-mode "fortran" "\
@@ -10732,7 +10737,7 @@ 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" (19383 49279))
+;;;;;;  fortune-add-fortune) "fortune" "play/fortune.el" (19279 5151))
 ;;; Generated autoloads from play/fortune.el
 
 (autoload 'fortune-add-fortune "fortune" "\
@@ -10781,14 +10786,19 @@ and choose the directory as the fortune-file.
 
 ;;;***
 \f
-;;;### (autoloads (gdb-enable-debug gdb) "gdb-ui" "progmodes/gdb-ui.el"
-;;;;;;  (19383 49284))
-;;; Generated autoloads from progmodes/gdb-ui.el
+;;;### (autoloads (gdb gdb-enable-debug) "gdb-mi" "progmodes/gdb-mi.el"
+;;;;;;  (19375 49830))
+;;; 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'.")
 
-(autoload 'gdb "gdb-ui" "\
+(custom-autoload 'gdb-enable-debug "gdb-mi" t)
+
+(autoload 'gdb "gdb-mi" "\
 Run gdb on program FILE in buffer *gud-FILE*.
-The directory containing FILE becomes the initial working
-directory and source-file directory for your debugger.
+The directory containing FILE becomes the initial working directory
+and source-file directory for your debugger.
 
 If `gdb-many-windows' is nil (the default value) then gdb just
 pops up the GUD buffer unless `gdb-show-main' is t.  In this case
@@ -10796,10 +10806,8 @@ it starts with two windows: one displaying the GUD buffer and the
 other with the source file with the main routine of the inferior.
 
 If `gdb-many-windows' is t, regardless of the value of
-`gdb-show-main', the layout below will appear unless
-`gdb-use-separate-io-buffer' is nil when the source buffer
-occupies the full width of the frame.  Keybindings are shown in
-some of the buffers.
+`gdb-show-main', the layout below will appear.  Keybindings are
+shown in some of the buffers.
 
 Watch expressions appear in the speedbar/slowbar.
 
@@ -10811,37 +10819,37 @@ The following commands help control operation :
 See Info node `(emacs)GDB Graphical Interface' for a more
 detailed description of this mode.
 
+
 +----------------------------------------------------------------------+
 |                               GDB Toolbar                            |
 +-----------------------------------+----------------------------------+
-|  GUD buffer (I/O of GDB)          |  Locals buffer                   |
-|-----------------------------------+----------------------------------+
+| GUD buffer (I/O of GDB)           | Locals buffer                    |
+|                                   |                                  |
 |                                   |                                  |
-|  Source buffer                    |  I/O buffer for debugged program |
 |                                   |                                  |
-|-----------------------------------+----------------------------------+
-|  Stack buffer                     |  Breakpoints/threads buffer      |
 +-----------------------------------+----------------------------------+
-
-The option \"--annotate=3\" must be included in this value.  To
-run GDB in text command mode, use `gud-gdb'.  You need to use
-text command mode to debug multiple programs within one Emacs
-session.
+| Source buffer                     | I/O buffer (of debugged program) |
+|                                   | (comint-mode)                    |
+|                                   |                                  |
+|                                   |                                  |
+|                                   |                                  |
+|                                   |                                  |
+|                                   |                                  |
+|                                   |                                  |
++-----------------------------------+----------------------------------+
+| Stack buffer                      | Breakpoints buffer               |
+| RET      gdb-select-frame         | SPC    gdb-toggle-breakpoint     |
+|                                   | RET    gdb-goto-breakpoint       |
+|                                   | D      gdb-delete-breakpoint     |
++-----------------------------------+----------------------------------+
 
 \(fn COMMAND-LINE)" t nil)
 
-(defalias 'gdba 'gdb)
-
-(defvar gdb-enable-debug nil "\
-Non-nil means record the process input and output in `gdb-debug-log'.")
-
-(custom-autoload 'gdb-enable-debug "gdb-ui" t)
-
 ;;;***
 \f
 ;;;### (autoloads (generic-make-keywords-list generic-mode generic-mode-internal
-;;;;;;  define-generic-mode) "generic" "emacs-lisp/generic.el" (19383
-;;;;;;  49279))
+;;;;;;  define-generic-mode) "generic" "emacs-lisp/generic.el" (19279
+;;;;;;  5149))
 ;;; Generated autoloads from emacs-lisp/generic.el
 
 (defvar generic-mode-list nil "\
@@ -10916,7 +10924,7 @@ regular expression that can be used as an element of
 ;;;***
 \f
 ;;;### (autoloads (glasses-mode) "glasses" "progmodes/glasses.el"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5151))
 ;;; Generated autoloads from progmodes/glasses.el
 
 (autoload 'glasses-mode "glasses" "\
@@ -10930,7 +10938,7 @@ 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"
-;;;;;;  (19383 49279))
+;;;;;;  (19365 25156))
 ;;; Generated autoloads from gnus/gmm-utils.el
 
 (autoload 'gmm-regexp-concat "gmm-utils" "\
@@ -10985,7 +10993,7 @@ 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" (19383 49279))
+;;;;;;  gnus-slave-no-server) "gnus" "gnus/gnus.el" (19279 5150))
 ;;; Generated autoloads from gnus/gnus.el
 (when (fboundp 'custom-autoload)
  (custom-autoload 'gnus-select-method "gnus"))
@@ -11038,7 +11046,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" (19383 49279))
+;;;;;;  "gnus/gnus-agent.el" (19368 35187))
 ;;; Generated autoloads from gnus/gnus-agent.el
 
 (autoload 'gnus-unplugged "gnus-agent" "\
@@ -11129,7 +11137,7 @@ If CLEAN, obsolete (ignore).
 ;;;***
 \f
 ;;;### (autoloads (gnus-article-prepare-display) "gnus-art" "gnus/gnus-art.el"
-;;;;;;  (19383 49284))
+;;;;;;  (19368 35187))
 ;;; Generated autoloads from gnus/gnus-art.el
 
 (autoload 'gnus-article-prepare-display "gnus-art" "\
@@ -11140,7 +11148,7 @@ Make the current buffer look like a nice article.
 ;;;***
 \f
 ;;;### (autoloads (gnus-audio-play) "gnus-audio" "gnus/gnus-audio.el"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5150))
 ;;; Generated autoloads from gnus/gnus-audio.el
 
 (autoload 'gnus-audio-play "gnus-audio" "\
@@ -11151,7 +11159,7 @@ Play a sound FILE through the speaker.
 ;;;***
 \f
 ;;;### (autoloads (gnus-bookmark-bmenu-list gnus-bookmark-jump gnus-bookmark-set)
-;;;;;;  "gnus-bookmark" "gnus/gnus-bookmark.el" (19383 49279))
+;;;;;;  "gnus-bookmark" "gnus/gnus-bookmark.el" (19279 5150))
 ;;; Generated autoloads from gnus/gnus-bookmark.el
 
 (autoload 'gnus-bookmark-set "gnus-bookmark" "\
@@ -11176,8 +11184,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" (19383
-;;;;;;  49279))
+;;;;;;  gnus-jog-cache) "gnus-cache" "gnus/gnus-cache.el" (19279
+;;;;;;  5150))
 ;;; Generated autoloads from gnus/gnus-cache.el
 
 (autoload 'gnus-jog-cache "gnus-cache" "\
@@ -11219,7 +11227,7 @@ supported.
 ;;;***
 \f
 ;;;### (autoloads (gnus-delay-initialize gnus-delay-send-queue gnus-delay-article)
-;;;;;;  "gnus-delay" "gnus/gnus-delay.el" (19383 49279))
+;;;;;;  "gnus-delay" "gnus/gnus-delay.el" (19279 5150))
 ;;; Generated autoloads from gnus/gnus-delay.el
 
 (autoload 'gnus-delay-article "gnus-delay" "\
@@ -11255,7 +11263,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" (19383 49279))
+;;;;;;  "gnus-diary" "gnus/gnus-diary.el" (19279 38446))
 ;;; Generated autoloads from gnus/gnus-diary.el
 
 (autoload 'gnus-user-format-function-d "gnus-diary" "\
@@ -11271,7 +11279,7 @@ Not documented
 ;;;***
 \f
 ;;;### (autoloads (turn-on-gnus-dired-mode) "gnus-dired" "gnus/gnus-dired.el"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5150))
 ;;; Generated autoloads from gnus/gnus-dired.el
 
 (autoload 'turn-on-gnus-dired-mode "gnus-dired" "\
@@ -11282,7 +11290,7 @@ Convenience method to turn on gnus-dired-mode.
 ;;;***
 \f
 ;;;### (autoloads (gnus-draft-reminder) "gnus-draft" "gnus/gnus-draft.el"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5150))
 ;;; Generated autoloads from gnus/gnus-draft.el
 
 (autoload 'gnus-draft-reminder "gnus-draft" "\
@@ -11294,8 +11302,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" (19383
-;;;;;;  49279))
+;;;;;;  gnus-random-x-face) "gnus-fun" "gnus/gnus-fun.el" (19279
+;;;;;;  5150))
 ;;; Generated autoloads from gnus/gnus-fun.el
 
 (autoload 'gnus-random-x-face "gnus-fun" "\
@@ -11340,7 +11348,7 @@ FILE should be a PNG file that's 48x48 and smaller than or equal to
 ;;;***
 \f
 ;;;### (autoloads (gnus-fetch-group-other-frame gnus-fetch-group)
-;;;;;;  "gnus-group" "gnus/gnus-group.el" (19383 49279))
+;;;;;;  "gnus-group" "gnus/gnus-group.el" (19279 5150))
 ;;; Generated autoloads from gnus/gnus-group.el
 
 (autoload 'gnus-fetch-group "gnus-group" "\
@@ -11358,7 +11366,7 @@ Pop up a frame and enter GROUP.
 ;;;***
 \f
 ;;;### (autoloads (gnus-batch-score) "gnus-kill" "gnus/gnus-kill.el"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5150))
 ;;; Generated autoloads from gnus/gnus-kill.el
 
 (defalias 'gnus-batch-kill 'gnus-batch-score)
@@ -11373,7 +11381,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"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5150))
 ;;; Generated autoloads from gnus/gnus-ml.el
 
 (autoload 'turn-on-gnus-mailing-list-mode "gnus-ml" "\
@@ -11398,7 +11406,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"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5150))
 ;;; Generated autoloads from gnus/gnus-mlspl.el
 
 (autoload 'gnus-group-split-setup "gnus-mlspl" "\
@@ -11499,7 +11507,7 @@ Calling (gnus-group-split-fancy nil nil \"mail.others\") returns:
 ;;;***
 \f
 ;;;### (autoloads (gnus-change-server) "gnus-move" "gnus/gnus-move.el"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5150))
 ;;; Generated autoloads from gnus/gnus-move.el
 
 (autoload 'gnus-change-server "gnus-move" "\
@@ -11511,7 +11519,7 @@ Update the .newsrc.eld file to reflect the change of nntp server.
 ;;;***
 \f
 ;;;### (autoloads (gnus-button-reply gnus-button-mailto gnus-msg-mail)
-;;;;;;  "gnus-msg" "gnus/gnus-msg.el" (19383 49279))
+;;;;;;  "gnus-msg" "gnus/gnus-msg.el" (19279 5150))
 ;;; Generated autoloads from gnus/gnus-msg.el
 
 (autoload 'gnus-msg-mail "gnus-msg" "\
@@ -11536,7 +11544,7 @@ Like `message-reply'.
 ;;;***
 \f
 ;;;### (autoloads (gnus-nocem-load-cache gnus-nocem-scan-groups)
-;;;;;;  "gnus-nocem" "gnus/gnus-nocem.el" (19383 49279))
+;;;;;;  "gnus-nocem" "gnus/gnus-nocem.el" (19279 5150))
 ;;; Generated autoloads from gnus/gnus-nocem.el
 
 (autoload 'gnus-nocem-scan-groups "gnus-nocem" "\
@@ -11553,7 +11561,7 @@ Load the NoCeM cache.
 \f
 ;;;### (autoloads (gnus-treat-newsgroups-picon gnus-treat-mail-picon
 ;;;;;;  gnus-treat-from-picon) "gnus-picon" "gnus/gnus-picon.el"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5150))
 ;;; Generated autoloads from gnus/gnus-picon.el
 
 (autoload 'gnus-treat-from-picon "gnus-picon" "\
@@ -11580,7 +11588,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" (19383 49279))
+;;;;;;  "gnus/gnus-range.el" (19279 5150))
 ;;; Generated autoloads from gnus/gnus-range.el
 
 (autoload 'gnus-sorted-difference "gnus-range" "\
@@ -11648,7 +11656,7 @@ Add NUM into sorted LIST by side effect.
 ;;;***
 \f
 ;;;### (autoloads (gnus-registry-install-hooks gnus-registry-initialize)
-;;;;;;  "gnus-registry" "gnus/gnus-registry.el" (19383 49279))
+;;;;;;  "gnus-registry" "gnus/gnus-registry.el" (19368 35187))
 ;;; Generated autoloads from gnus/gnus-registry.el
 
 (autoload 'gnus-registry-initialize "gnus-registry" "\
@@ -11664,8 +11672,8 @@ Install the registry hooks.
 ;;;***
 \f
 ;;;### (autoloads (gnus-sieve-article-add-rule gnus-sieve-generate
-;;;;;;  gnus-sieve-update) "gnus-sieve" "gnus/gnus-sieve.el" (19383
-;;;;;;  49279))
+;;;;;;  gnus-sieve-update) "gnus-sieve" "gnus/gnus-sieve.el" (19279
+;;;;;;  5150))
 ;;; Generated autoloads from gnus/gnus-sieve.el
 
 (autoload 'gnus-sieve-update "gnus-sieve" "\
@@ -11693,7 +11701,7 @@ Not documented
 ;;;***
 \f
 ;;;### (autoloads (gnus-batch-brew-soup) "gnus-soup" "gnus/gnus-soup.el"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5150))
 ;;; Generated autoloads from gnus/gnus-soup.el
 
 (autoload 'gnus-batch-brew-soup "gnus-soup" "\
@@ -11713,7 +11721,7 @@ Note -- this function hasn't been implemented yet.
 ;;;***
 \f
 ;;;### (autoloads (gnus-update-format) "gnus-spec" "gnus/gnus-spec.el"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5150))
 ;;; Generated autoloads from gnus/gnus-spec.el
 
 (autoload 'gnus-update-format "gnus-spec" "\
@@ -11724,8 +11732,8 @@ Update the format specification near point.
 ;;;***
 \f
 ;;;### (autoloads (gnus-fixup-nnimap-unread-after-getting-new-news
-;;;;;;  gnus-declare-backend) "gnus-start" "gnus/gnus-start.el" (19383
-;;;;;;  49279))
+;;;;;;  gnus-declare-backend) "gnus-start" "gnus/gnus-start.el" (19279
+;;;;;;  5150))
 ;;; Generated autoloads from gnus/gnus-start.el
 
 (autoload 'gnus-declare-backend "gnus-start" "\
@@ -11741,7 +11749,7 @@ Not documented
 ;;;***
 \f
 ;;;### (autoloads (gnus-add-configuration) "gnus-win" "gnus/gnus-win.el"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5150))
 ;;; Generated autoloads from gnus/gnus-win.el
 
 (autoload 'gnus-add-configuration "gnus-win" "\
@@ -11751,7 +11759,7 @@ Add the window configuration CONF to `gnus-buffer-configuration'.
 
 ;;;***
 \f
-;;;### (autoloads (gomoku) "gomoku" "play/gomoku.el" (19383 49279))
+;;;### (autoloads (gomoku) "gomoku" "play/gomoku.el" (19279 5151))
 ;;; Generated autoloads from play/gomoku.el
 
 (autoload 'gomoku "gomoku" "\
@@ -11778,8 +11786,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" (19383
-;;;;;;  49279))
+;;;;;;  goto-address-at-point) "goto-addr" "net/goto-addr.el" (19356
+;;;;;;  10801))
 ;;; Generated autoloads from net/goto-addr.el
 
 (define-obsolete-function-alias 'goto-address-at-mouse 'goto-address-at-point "22.1")
@@ -11819,7 +11827,7 @@ Turn on `goto-address-mode', but only in comments and strings.
 \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" (19397 57330))
+;;;;;;  grep-window-height) "grep" "progmodes/grep.el" (19304 5068))
 ;;; Generated autoloads from progmodes/grep.el
 
 (defvar grep-window-height nil "\
@@ -11975,7 +11983,7 @@ file name to `*.gz', and sets `grep-highlight-matches' to `always'.
 
 ;;;***
 \f
-;;;### (autoloads (gs-load-image) "gs" "gs.el" (19383 49279))
+;;;### (autoloads (gs-load-image) "gs" "gs.el" (19279 5148))
 ;;; Generated autoloads from gs.el
 
 (autoload 'gs-load-image "gs" "\
@@ -11989,7 +11997,7 @@ 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" (19383 49279))
+;;;;;;  xdb dbx sdb gud-gdb) "gud" "progmodes/gud.el" (19374 384))
 ;;; Generated autoloads from progmodes/gud.el
 
 (autoload 'gud-gdb "gud" "\
@@ -12077,8 +12085,8 @@ Toggle the display of GUD tooltips.
 
 ;;;***
 \f
-;;;### (autoloads (handwrite) "handwrite" "play/handwrite.el" (19383
-;;;;;;  49279))
+;;;### (autoloads (handwrite) "handwrite" "play/handwrite.el" (19279
+;;;;;;  5151))
 ;;; Generated autoloads from play/handwrite.el
 
 (autoload 'handwrite "handwrite" "\
@@ -12096,7 +12104,7 @@ Variables: handwrite-linespace     (default 12)
 ;;;***
 \f
 ;;;### (autoloads (hanoi-unix-64 hanoi-unix hanoi) "hanoi" "play/hanoi.el"
-;;;;;;  (19383 49279))
+;;;;;;  (19256 49601))
 ;;; Generated autoloads from play/hanoi.el
 
 (autoload 'hanoi "hanoi" "\
@@ -12125,7 +12133,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" (19383 49279))
+;;;;;;  "hashcash" "mail/hashcash.el" (19365 25156))
 ;;; Generated autoloads from mail/hashcash.el
 
 (autoload 'hashcash-insert-payment "hashcash" "\
@@ -12170,7 +12178,7 @@ 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" (19383 49279))
+;;;;;;  help-at-pt-string) "help-at-pt" "help-at-pt.el" (19279 5148))
 ;;; Generated autoloads from help-at-pt.el
 
 (autoload 'help-at-pt-string "help-at-pt" "\
@@ -12300,7 +12308,7 @@ different regions.  With numeric argument ARG, behaves like
 ;;;### (autoloads (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"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5148))
 ;;; Generated autoloads from help-fns.el
 
 (autoload 'describe-function "help-fns" "\
@@ -12370,7 +12378,7 @@ BUFFER should be a buffer or a buffer name.
 ;;;***
 \f
 ;;;### (autoloads (three-step-help) "help-macro" "help-macro.el"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5148))
 ;;; Generated autoloads from help-macro.el
 
 (defvar three-step-help nil "\
@@ -12386,8 +12394,8 @@ 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" (19383
-;;;;;;  49279))
+;;;;;;  help-mode-setup help-mode) "help-mode" "help-mode.el" (19279
+;;;;;;  5148))
 ;;; Generated autoloads from help-mode.el
 
 (autoload 'help-mode "help-mode" "\
@@ -12479,7 +12487,7 @@ Add xrefs for symbols in `pp's output between FROM and TO.
 ;;;***
 \f
 ;;;### (autoloads (Helper-help Helper-describe-bindings) "helper"
-;;;;;;  "emacs-lisp/helper.el" (19383 49279))
+;;;;;;  "emacs-lisp/helper.el" (19279 5149))
 ;;; Generated autoloads from emacs-lisp/helper.el
 
 (autoload 'Helper-describe-bindings "helper" "\
@@ -12495,7 +12503,7 @@ Provide help for current mode.
 ;;;***
 \f
 ;;;### (autoloads (hexlify-buffer hexl-find-file hexl-mode) "hexl"
-;;;;;;  "hexl.el" (19383 49279))
+;;;;;;  "hexl.el" (19279 38446))
 ;;; Generated autoloads from hexl.el
 
 (autoload 'hexl-mode "hexl" "\
@@ -12592,7 +12600,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"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5148))
 ;;; Generated autoloads from hi-lock.el
 
 (autoload 'hi-lock-mode "hi-lock" "\
@@ -12726,7 +12734,7 @@ be found in variable `hi-lock-interactive-patterns'.
 ;;;***
 \f
 ;;;### (autoloads (hide-ifdef-mode) "hideif" "progmodes/hideif.el"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5151))
 ;;; Generated autoloads from progmodes/hideif.el
 
 (autoload 'hide-ifdef-mode "hideif" "\
@@ -12766,7 +12774,7 @@ how the hiding is done:
 ;;;***
 \f
 ;;;### (autoloads (turn-off-hideshow hs-minor-mode) "hideshow" "progmodes/hideshow.el"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5151))
 ;;; 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))) "\
@@ -12828,8 +12836,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" (19383
-;;;;;;  49279))
+;;;;;;  highlight-changes-mode) "hilit-chg" "hilit-chg.el" (19279
+;;;;;;  5148))
 ;;; Generated autoloads from hilit-chg.el
 
 (autoload 'highlight-changes-mode "hilit-chg" "\
@@ -12958,7 +12966,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" (19383 49279))
+;;;;;;  "hippie-exp.el" (19279 5148))
 ;;; 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) "\
@@ -13031,7 +13039,7 @@ argument VERBOSE non-nil makes the function verbose.
 ;;;***
 \f
 ;;;### (autoloads (global-hl-line-mode hl-line-mode) "hl-line" "hl-line.el"
-;;;;;;  (19383 49279))
+;;;;;;  (19356 10801))
 ;;; Generated autoloads from hl-line.el
 
 (autoload 'hl-line-mode "hl-line" "\
@@ -13075,7 +13083,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" (19383 49279))
+;;;;;;  "calendar/holidays.el" (19279 5149))
 ;;; Generated autoloads from calendar/holidays.el
 
 (defvar holiday-general-holidays (mapcar 'purecopy '((holiday-fixed 1 1 "New Year's Day") (holiday-float 1 1 3 "Martin Luther King Day") (holiday-fixed 2 2 "Groundhog Day") (holiday-fixed 2 14 "Valentine's Day") (holiday-float 2 1 3 "President's Day") (holiday-fixed 3 17 "St. Patrick's Day") (holiday-fixed 4 1 "April Fools' Day") (holiday-float 5 0 2 "Mother's Day") (holiday-float 5 1 -1 "Memorial Day") (holiday-fixed 6 14 "Flag Day") (holiday-float 6 0 3 "Father's Day") (holiday-fixed 7 4 "Independence Day") (holiday-float 9 1 1 "Labor Day") (holiday-float 10 1 2 "Columbus Day") (holiday-fixed 10 31 "Halloween") (holiday-fixed 11 11 "Veteran's Day") (holiday-float 11 4 4 "Thanksgiving"))) "\
@@ -13223,8 +13231,8 @@ The optional LABEL is used to label the buffer created.
 
 ;;;***
 \f
-;;;### (autoloads (html2text) "html2text" "gnus/html2text.el" (19383
-;;;;;;  49279))
+;;;### (autoloads (html2text) "html2text" "gnus/html2text.el" (19279
+;;;;;;  5150))
 ;;; Generated autoloads from gnus/html2text.el
 
 (autoload 'html2text "html2text" "\
@@ -13232,44 +13240,11 @@ Convert HTML to plain text in the current buffer.
 
 \(fn)" t nil)
 
-;;;***
-\f
-;;;### (autoloads (htmlfontify-copy-and-link-dir htmlfontify-buffer)
-;;;;;;  "htmlfontify" "htmlfontify.el" (19401 55581))
-;;; Generated autoloads from htmlfontify.el
-
-(autoload 'htmlfontify-buffer "htmlfontify" "\
-Create a new buffer, named for the current buffer + a .html extension,
-containing an inline CSS-stylesheet and formatted CSS-markup HTML
-that reproduces the look of the current Emacs buffer as closely
-as possible.
-
-Dangerous characters in the existing buffer are turned into HTML
-entities, so you should even be able to do HTML-within-HTML
-fontified display.
-
-You should, however, note that random control or eight-bit
-characters such as ^L (\f) or ¤ (\244) won't get mapped yet.
-
-If the SRCDIR and FILE arguments are set, lookup etags derived
-entries in the `hfy-tags-cache' and add HTML anchors and
-hyperlinks as appropriate.
-
-\(fn &optional SRCDIR FILE)" t nil)
-
-(autoload 'htmlfontify-copy-and-link-dir "htmlfontify" "\
-Trawl SRCDIR and write fontified-and-hyperlinked output in DSTDIR.
-F-EXT and L-EXT specify values for `hfy-extn' and `hfy-link-extn'.
-
-You may also want to set `hfy-page-header' and `hfy-page-footer'.
-
-\(fn SRCDIR DSTDIR &optional F-EXT L-EXT)" t nil)
-
 ;;;***
 \f
 ;;;### (autoloads (define-ibuffer-filter define-ibuffer-op define-ibuffer-sorter
-;;;;;;  define-ibuffer-column) "ibuf-macs" "ibuf-macs.el" (19383
-;;;;;;  49279))
+;;;;;;  define-ibuffer-column) "ibuf-macs" "ibuf-macs.el" (19279
+;;;;;;  5148))
 ;;; Generated autoloads from ibuf-macs.el
 
 (autoload 'define-ibuffer-column "ibuf-macs" "\
@@ -13358,7 +13333,7 @@ bound to the current value of the filter.
 ;;;***
 \f
 ;;;### (autoloads (ibuffer ibuffer-other-window ibuffer-list-buffers)
-;;;;;;  "ibuffer" "ibuffer.el" (19383 49279))
+;;;;;;  "ibuffer" "ibuffer.el" (19279 5148))
 ;;; Generated autoloads from ibuffer.el
 
 (autoload 'ibuffer-list-buffers "ibuffer" "\
@@ -13399,7 +13374,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" (19383 49284))
+;;;;;;  "calendar/icalendar.el" (19338 9840))
 ;;; Generated autoloads from calendar/icalendar.el
 
 (autoload 'icalendar-export-file "icalendar" "\
@@ -13451,8 +13426,8 @@ buffer `*icalendar-errors*'.
 
 ;;;***
 \f
-;;;### (autoloads (icomplete-mode) "icomplete" "icomplete.el" (19383
-;;;;;;  49279))
+;;;### (autoloads (icomplete-mode) "icomplete" "icomplete.el" (19279
+;;;;;;  5148))
 ;;; Generated autoloads from icomplete.el
 
 (defvar icomplete-mode nil "\
@@ -13473,7 +13448,7 @@ otherwise turn it off.
 
 ;;;***
 \f
-;;;### (autoloads (icon-mode) "icon" "progmodes/icon.el" (19383 49279))
+;;;### (autoloads (icon-mode) "icon" "progmodes/icon.el" (19279 5151))
 ;;; Generated autoloads from progmodes/icon.el
 
 (autoload 'icon-mode "icon" "\
@@ -13514,7 +13489,7 @@ with no args, if that value is non-nil.
 ;;;***
 \f
 ;;;### (autoloads (idlwave-shell) "idlw-shell" "progmodes/idlw-shell.el"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5151))
 ;;; Generated autoloads from progmodes/idlw-shell.el
 
 (autoload 'idlwave-shell "idlw-shell" "\
@@ -13540,7 +13515,7 @@ See also the variable `idlwave-shell-prompt-pattern'.
 ;;;***
 \f
 ;;;### (autoloads (idlwave-mode) "idlwave" "progmodes/idlwave.el"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 38446))
 ;;; Generated autoloads from progmodes/idlwave.el
 
 (autoload 'idlwave-mode "idlwave" "\
@@ -13674,8 +13649,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" (19397
-;;;;;;  64530))
+;;;;;;  ido-switch-buffer ido-mode ido-mode) "ido" "ido.el" (19292
+;;;;;;  15231))
 ;;; Generated autoloads from ido.el
 
 (defvar ido-mode nil "\
@@ -13936,7 +13911,7 @@ DEF, if non-nil, is the default value.
 
 ;;;***
 \f
-;;;### (autoloads (ielm) "ielm" "ielm.el" (19383 49279))
+;;;### (autoloads (ielm) "ielm" "ielm.el" (19279 5148))
 ;;; Generated autoloads from ielm.el
  (add-hook 'same-window-buffer-names (purecopy "*ielm*"))
 
@@ -13949,7 +13924,7 @@ Switches to the buffer `*ielm*', or creates it if it does not exist.
 ;;;***
 \f
 ;;;### (autoloads (iimage-mode turn-on-iimage-mode) "iimage" "iimage.el"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5148))
 ;;; Generated autoloads from iimage.el
 
 (autoload 'turn-on-iimage-mode "iimage" "\
@@ -13964,11 +13939,11 @@ Toggle inline image minor mode.
 
 ;;;***
 \f
-;;;### (autoloads (defimage find-image remove-images insert-sliced-image
-;;;;;;  insert-image put-image create-image image-type-auto-detected-p
+;;;### (autoloads (create-animated-image defimage find-image remove-images
+;;;;;;  insert-sliced-image insert-image put-image 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" (19383 49279))
+;;;;;;  "image" "image.el" (19356 10801))
 ;;; Generated autoloads from image.el
 
 (autoload 'image-type-from-data "image" "\
@@ -14142,6 +14117,22 @@ Example:
 
 \(fn SYMBOL SPECS &optional DOC)" nil (quote macro))
 
+(autoload 'create-animated-image "image" "\
+Create an animated image.
+FILE-OR-DATA is an image file name or image data.
+Optional TYPE is a symbol describing the image type.  If TYPE is omitted
+or nil, try to determine the image type from its first few bytes
+of image data.  If that doesn't work, and FILE-OR-DATA is a file name,
+use its file extension as image type.
+Optional DATA-P non-nil means FILE-OR-DATA is a string containing image data.
+Optional PROPS are additional image attributes to assign to the image,
+like, e.g. `:mask MASK'.
+Value is the image created, or nil if images of type TYPE are not supported.
+
+Images should not be larger than specified by `max-image-size'.
+
+\(fn FILE-OR-DATA &optional TYPE DATA-P &rest PROPS)" nil nil)
+
 ;;;***
 \f
 ;;;### (autoloads (image-dired-dired-edit-comment-and-tags image-dired-mark-tagged-files
@@ -14151,7 +14142,7 @@ Example:
 ;;;;;;  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-insert-marked-thumbs)
-;;;;;;  "image-dired" "image-dired.el" (19383 49285))
+;;;;;;  "image-dired" "image-dired.el" (19370 36540))
 ;;; Generated autoloads from image-dired.el
 
 (autoload 'image-dired-dired-insert-marked-thumbs "image-dired" "\
@@ -14285,7 +14276,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" (19422 11991))
+;;;;;;  "image-file.el" (19279 5148))
 ;;; 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")) "\
@@ -14347,7 +14338,7 @@ Image files are those 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" (19412 35030))
+;;;;;;  image-mode) "image-mode" "image-mode.el" (19356 10801))
 ;;; Generated autoloads from image-mode.el
  (push (cons (purecopy "\\.jpe?g\\'")    'image-mode) auto-mode-alist)
  (push (cons (purecopy "\\.png\\'")      'image-mode) auto-mode-alist)
@@ -14382,7 +14373,7 @@ displays an image file as text.  `image-minor-mode' provides the key
 to display an image file as the actual image.
 
 You can use `image-mode-as-text' in `auto-mode-alist' when you want
-to display an image file as text initially.
+to display an image file as text inititally.
 
 See commands `image-mode' and `image-minor-mode' for more information
 on these modes.
@@ -14397,7 +14388,7 @@ Not documented
 ;;;***
 \f
 ;;;### (autoloads (imenu imenu-add-menubar-index imenu-add-to-menubar
-;;;;;;  imenu-sort-function) "imenu" "imenu.el" (19383 49279))
+;;;;;;  imenu-sort-function) "imenu" "imenu.el" (19279 5148))
 ;;; Generated autoloads from imenu.el
 
 (defvar imenu-sort-function nil "\
@@ -14514,7 +14505,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" (19383 49279))
+;;;;;;  "ind-util" "language/ind-util.el" (19279 5150))
 ;;; Generated autoloads from language/ind-util.el
 
 (autoload 'indian-compose-region "ind-util" "\
@@ -14546,7 +14537,7 @@ 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" (19383 49279))
+;;;;;;  "progmodes/inf-lisp.el" (19279 5151))
 ;;; Generated autoloads from progmodes/inf-lisp.el
 
 (defvar inferior-lisp-filter-regexp (purecopy "\\`\\s *\\(:\\(\\w\\|\\s_\\)\\)?\\s *\\'") "\
@@ -14614,7 +14605,7 @@ of `inferior-lisp-program').  Runs the hooks from
 ;;;;;;  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"
-;;;;;;  (19412 35030))
+;;;;;;  (19368 35187))
 ;;; Generated autoloads from info.el
 
 (autoload 'info-other-window "info" "\
@@ -14689,8 +14680,11 @@ Build a menu of the possible matches.
 
 (autoload 'info-finder "info" "\
 Display descriptions of the keywords in the Finder virtual manual.
+In interactive use, a prefix argument directs this command to read
+a list of keywords separated by comma.  After that, it displays a node
+with a list packages that contain all specified keywords.
 
-\(fn)" t nil)
+\(fn &optional KEYWORDS)" t nil)
 
 (autoload 'Info-mode "info" "\
 Info mode provides commands for browsing through the Info documentation tree.
@@ -14793,7 +14787,7 @@ type returned by `Info-bookmark-make-record', which see.
 \f
 ;;;### (autoloads (info-complete-file info-complete-symbol info-lookup-file
 ;;;;;;  info-lookup-symbol info-lookup-reset) "info-look" "info-look.el"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5148))
 ;;; Generated autoloads from info-look.el
 
 (autoload 'info-lookup-reset "info-look" "\
@@ -14841,7 +14835,7 @@ Perform completion on file preceding point.
 ;;;***
 \f
 ;;;### (autoloads (info-xref-check-all-custom info-xref-check-all
-;;;;;;  info-xref-check) "info-xref" "info-xref.el" (19383 49279))
+;;;;;;  info-xref-check) "info-xref" "info-xref.el" (19279 5148))
 ;;; Generated autoloads from info-xref.el
 
 (autoload 'info-xref-check "info-xref" "\
@@ -14868,7 +14862,7 @@ quite a while.
 ;;;***
 \f
 ;;;### (autoloads (batch-info-validate Info-validate Info-split Info-split-threshold
-;;;;;;  Info-tagify) "informat" "informat.el" (19383 49279))
+;;;;;;  Info-tagify) "informat" "informat.el" (19279 5148))
 ;;; Generated autoloads from informat.el
 
 (autoload 'Info-tagify "informat" "\
@@ -14915,7 +14909,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"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5150))
 ;;; Generated autoloads from international/isearch-x.el
 
 (autoload 'isearch-toggle-specified-input-method "isearch-x" "\
@@ -14935,8 +14929,8 @@ Not documented
 
 ;;;***
 \f
-;;;### (autoloads (isearchb-activate) "isearchb" "isearchb.el" (19383
-;;;;;;  49279))
+;;;### (autoloads (isearchb-activate) "isearchb" "isearchb.el" (19279
+;;;;;;  5148))
 ;;; Generated autoloads from isearchb.el
 
 (autoload 'isearchb-activate "isearchb" "\
@@ -14952,7 +14946,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" (19383 49279))
+;;;;;;  "international/iso-cvt.el" (19279 5150))
 ;;; Generated autoloads from international/iso-cvt.el
 
 (autoload 'iso-spanish "iso-cvt" "\
@@ -15043,7 +15037,7 @@ Add submenus to the File menu, to convert to and from various formats.
 ;;;***
 \f
 ;;;### (autoloads nil "iso-transl" "international/iso-transl.el"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5150))
 ;;; 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)
@@ -15055,7 +15049,7 @@ 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" (19383 49276))
+;;;;;;  "ispell" "textmodes/ispell.el" (19313 15415))
 ;;; Generated autoloads from textmodes/ispell.el
 (put 'ispell-check-comments 'safe-local-variable (lambda (a) (memq a '(nil t exclusive))))
 
@@ -15273,8 +15267,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" (19383
-;;;;;;  49276))
+;;;### (autoloads (iswitchb-mode) "iswitchb" "iswitchb.el" (19321
+;;;;;;  4517))
 ;;; Generated autoloads from iswitchb.el
 
 (defvar iswitchb-mode nil "\
@@ -15299,7 +15293,7 @@ This mode enables switching between buffers using substrings.  See
 ;;;### (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" (19383 49279))
+;;;;;;  "japan-util" "language/japan-util.el" (19279 5150))
 ;;; Generated autoloads from language/japan-util.el
 
 (autoload 'setup-japanese-environment-internal "japan-util" "\
@@ -15377,7 +15371,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" (19383 49279))
+;;;;;;  "jka-compr.el" (19292 15231))
 ;;; Generated autoloads from jka-compr.el
 
 (defvar jka-compr-inhibit nil "\
@@ -15400,7 +15394,7 @@ by `jka-compr-installed'.
 
 ;;;***
 \f
-;;;### (autoloads (js-mode) "js" "progmodes/js.el" (19421 38445))
+;;;### (autoloads (js-mode) "js" "progmodes/js.el" (19279 5151))
 ;;; Generated autoloads from progmodes/js.el
 
 (autoload 'js-mode "js" "\
@@ -15418,7 +15412,7 @@ Key bindings:
 \f
 ;;;### (autoloads (keypad-setup keypad-numlock-shifted-setup keypad-shifted-setup
 ;;;;;;  keypad-numlock-setup keypad-setup) "keypad" "emulation/keypad.el"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5150))
 ;;; Generated autoloads from emulation/keypad.el
 
 (defvar keypad-setup nil "\
@@ -15474,7 +15468,7 @@ the decimal key on the keypad is mapped to DECIMAL instead of `.'
 ;;;***
 \f
 ;;;### (autoloads (kinsoku) "kinsoku" "international/kinsoku.el"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5150))
 ;;; Generated autoloads from international/kinsoku.el
 
 (autoload 'kinsoku "kinsoku" "\
@@ -15495,8 +15489,8 @@ the context of text formatting.
 
 ;;;***
 \f
-;;;### (autoloads (kkc-region) "kkc" "international/kkc.el" (19383
-;;;;;;  49279))
+;;;### (autoloads (kkc-region) "kkc" "international/kkc.el" (19279
+;;;;;;  5150))
 ;;; Generated autoloads from international/kkc.el
 
 (defvar kkc-after-update-conversion-functions nil "\
@@ -15521,7 +15515,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" (19383 49279))
+;;;;;;  "kmacro" "kmacro.el" (19279 5148))
 ;;; Generated autoloads from kmacro.el
  (global-set-key "\C-x(" 'kmacro-start-macro)
  (global-set-key "\C-x)" 'kmacro-end-macro)
@@ -15632,7 +15626,7 @@ If kbd macro currently being defined end it before activating it.
 ;;;***
 \f
 ;;;### (autoloads (setup-korean-environment-internal) "korea-util"
-;;;;;;  "language/korea-util.el" (19383 49279))
+;;;;;;  "language/korea-util.el" (19279 5150))
 ;;; Generated autoloads from language/korea-util.el
 
 (defvar default-korean-keyboard (purecopy (if (string-match "3" (or (getenv "HANGUL_KEYBOARD_TYPE") "")) "3" "")) "\
@@ -15647,7 +15641,7 @@ Not documented
 ;;;***
 \f
 ;;;### (autoloads (lm lm-test-run) "landmark" "play/landmark.el"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5151))
 ;;; Generated autoloads from play/landmark.el
 
 (defalias 'landmark-repeat 'lm-test-run)
@@ -15681,7 +15675,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" (19383 49279))
+;;;;;;  "lao-util" "language/lao-util.el" (19279 5150))
 ;;; Generated autoloads from language/lao-util.el
 
 (autoload 'lao-compose-string "lao-util" "\
@@ -15720,7 +15714,7 @@ Not documented
 \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" (19383 49279))
+;;;;;;  "latexenc" "international/latexenc.el" (19279 5150))
 ;;; 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))) "\
@@ -15752,7 +15746,7 @@ 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" (19383 49279))
+;;;;;;  "latin1-disp" "international/latin1-disp.el" (19279 5150))
 ;;; Generated autoloads from international/latin1-disp.el
 
 (defvar latin1-display nil "\
@@ -15794,7 +15788,7 @@ use either \\[customize] or the function `latin1-display'.")
 ;;;***
 \f
 ;;;### (autoloads (ld-script-mode) "ld-script" "progmodes/ld-script.el"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5151))
 ;;; Generated autoloads from progmodes/ld-script.el
 
 (add-to-list 'auto-mode-alist (purecopy '("\\.ld[si]?\\>" . ld-script-mode)))
@@ -15811,7 +15805,7 @@ A major mode to edit GNU ld script files
 ;;;***
 \f
 ;;;### (autoloads (ledit-from-lisp-mode ledit-mode) "ledit" "ledit.el"
-;;;;;;  (19383 49279))
+;;;;;;  (19279 5148))
 ;;; Generated autoloads from ledit.el
 
 (defconst ledit-save-files t "\
@@ -15846,7 +15840,7 @@ Not documented
 
 ;;;***
 \f
-;;;### (autoloads (life) "life" "play/life.el" (19383 49279))
+;;;### (autoloads (life) "life" "play/life.el" (19279 5151))
 ;;; Generated autoloads from play/life.el
 
 (autoload 'life "life" "\
@@ -15860,7 +15854,7 @@ generations (this defaults to 1).
 ;;;***
 \f
 ;;;### (autoloads (global-linum-mode linum-mode linum-format) "linum"
-;;;;;;  "linum.el" (19383 49279))
+;;;;;;  "linum.el" (19279 5148))
 ;;; Generated autoloads from linum.el
 
 (defvar linum-format 'dynamic "\
@@ -15898,8 +15892,8 @@ See `linum-mode' for more information on Linum mode.
 
 ;;;***
 \f
-;;;### (autoloads (unload-feature) "loadhist" "loadhist.el" (19383
-;;;;;;  49279))
+;;;### (autoloads (unload-feature) "loadhist" "loadhist.el" (19279
+;;;;;;  5148))
 ;;; Generated autoloads from loadhist.el
 
 (autoload 'unload-feature "loadhist" "\
@@ -15931,7 +15925,7 @@ something strange, such as redefining an Emacs function.
 ;;;***
 \f
 ;;;### (autoloads (locate-with-filter locate locate-ls-subdir-switches)
-;;;;;;  "locate" "locate.el" (19383 49279))
+;;;;;;  "locate" "locate.el" (19279 5148))
 ;;; Generated autoloads from locate.el
 
 (defvar locate-ls-subdir-switches (purecopy "-al") "\
@@ -15982,12 +15976,13 @@ except that FILTER is not optional.
 
 ;;;***
 \f
-;;;### (autoloads (log-edit) "log-edit" "log-edit.el" (19383 49276))
+;;;### (autoloads (log-edit) "log-edit" "log-edit.el" (19370 36540))
 ;;; Generated autoloads from log-edit.el
 
 (autoload 'log-edit "log-edit" "\
 Setup a buffer to enter a log message.
-\\<log-edit-mode-map>The buffer will be put in `log-edit-mode'.
+\\<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].
@@ -16004,12 +15999,12 @@ 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.
 
-\(fn CALLBACK &optional SETUP PARAMS BUFFER &rest IGNORE)" nil nil)
+\(fn CALLBACK &optional SETUP PARAMS BUFFER MODE &rest IGNORE)" nil nil)
 
 ;;;***
 \f
-;;;### (autoloads (log-view-mode) "log-view" "log-view.el" (19383
-;;;;;;  49279))
+;;;### (autoloads (log-view-mode) "log-view" "log-view.el" (19358
+;;;;;;  54001))
 ;;; Generated autoloads from log-view.el
 
 (autoload 'log-view-mode "log-view" "\
@@ -16019,8 +16014,8 @@ Major mode for browsing CVS log output.
 
 ;;;***
 \f
-;;;### (autoloads (longlines-mode) "longlines" "longlines.el" (19383
-;;;;;;  49279))
+;;;### (autoloads (longlines-mode) "longlines" "longlines.el" (19279
+;;;;;;  5148))
 ;;; Generated autoloads from longlines.el
 
 (autoload 'longlines-mode "longlines" "\
@@ -16041,8 +16036,8 @@ are indicated with a symbol.
 ;;;***
 \f
 ;;;### (autoloads (print-region lpr-region print-buffer lpr-buffer
-;;;;;;  lpr-command lpr-switches printer-name) "lpr" "lpr.el" (19383
-;;;;;;  49279))
+;;;;;;  lpr-command lpr-switches printer-name) "lpr" "lpr.el" (19279
+;;;;;;  5148))
 ;;; Generated autoloads from lpr.el
 
 (defvar lpr-windows-system (memq system-type '(ms-dos windows-nt)))
@@ -16136,7 +16131,7 @@ for further customization of the printer command.
 ;;;***
 \f
 ;;;### (autoloads (ls-lisp-support-shell-wildcards) "ls-lisp" "ls-lisp.el"
-;;;;;;  (19383 49276))
+;;;;;;  (19321 4517))
 ;;; Generated autoloads from ls-lisp.el
 
 (defvar ls-lisp-support-shell-wildcards t "\
@@ -16147,8 +16142,8 @@ Otherwise they are treated as Emacs regexps (for backward compatibility).")
 
 ;;;***
 \f
-;;;### (autoloads (lunar-phases) "lunar" "calendar/lunar.el" (19383
-;;;;;;  49279))
+;;;### (autoloads (lunar-phases) "lunar" "calendar/lunar.el" (19279
+;;;;;;  5149))
 ;;; Generated autoloads from calendar/lunar.el
 
 (autoload 'lunar-phases "lunar" "\
@@ -16162,8 +16157,8 @@ This function is suitable for execution in a .emacs file.
 
 ;;;***
 \f
-;;;### (autoloads (m4-mode) "m4-mode" "progmodes/m4-mode.el" (19383
-;;;;;;  49280))
+;;;### (autoloads (m4-mode) "m4-mode" "progmodes/m4-mode.el" (19279
+;;;;;;  5151))
 ;;; Generated autoloads from progmodes/m4-mode.el
 
 (autoload 'm4-mode "m4-mode" "\
@@ -16175,7 +16170,7 @@ A major mode to edit m4 macro files.
 ;;;***
 \f
 ;;;### (autoloads (macroexpand-all) "macroexp" "emacs-lisp/macroexp.el"
-;;;;;;  (19383 49280))
+;;;;;;  (19279 5149))
 ;;; Generated autoloads from emacs-lisp/macroexp.el
 
 (autoload 'macroexpand-all "macroexp" "\
@@ -16189,7 +16184,7 @@ 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" (19383 49277))
+;;;;;;  name-last-kbd-macro) "macros" "macros.el" (19345 41626))
 ;;; Generated autoloads from macros.el
 
 (autoload 'name-last-kbd-macro "macros" "\
@@ -16278,7 +16273,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" (19383 49280))
+;;;;;;  "mail/mail-extr.el" (19279 5150))
 ;;; Generated autoloads from mail/mail-extr.el
 
 (autoload 'mail-extract-address-components "mail-extr" "\
@@ -16310,7 +16305,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"
-;;;;;;  (19383 49280))
+;;;;;;  (19279 5150))
 ;;; Generated autoloads from mail/mail-hist.el
 
 (autoload 'mail-hist-define-keys "mail-hist" "\
@@ -16342,7 +16337,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-use-rfc822) "mail-utils" "mail/mail-utils.el"
-;;;;;;  (19383 49276))
+;;;;;;  (19313 15414))
 ;;; Generated autoloads from mail/mail-utils.el
 
 (defvar mail-use-rfc822 nil "\
@@ -16404,8 +16399,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" (19383
-;;;;;;  49280))
+;;;;;;  mail-abbrevs-mode) "mailabbrev" "mail/mailabbrev.el" (19279
+;;;;;;  5150))
 ;;; Generated autoloads from mail/mailabbrev.el
 
 (defvar mail-abbrevs-mode nil "\
@@ -16447,8 +16442,8 @@ double-quotes.
 ;;;***
 \f
 ;;;### (autoloads (mail-complete define-mail-alias expand-mail-aliases
-;;;;;;  mail-complete-style) "mailalias" "mail/mailalias.el" (19383
-;;;;;;  49280))
+;;;;;;  mail-complete-style) "mailalias" "mail/mailalias.el" (19279
+;;;;;;  5150))
 ;;; Generated autoloads from mail/mailalias.el
 
 (defvar mail-complete-style 'angles "\
@@ -16494,7 +16489,7 @@ current header, calls `mail-complete-function' and passes prefix arg if any.
 ;;;***
 \f
 ;;;### (autoloads (mailclient-send-it) "mailclient" "mail/mailclient.el"
-;;;;;;  (19383 49280))
+;;;;;;  (19279 5150))
 ;;; Generated autoloads from mail/mailclient.el
 
 (autoload 'mailclient-send-it "mailclient" "\
@@ -16508,7 +16503,7 @@ 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" (19383 49284))
+;;;;;;  "make-mode" "progmodes/make-mode.el" (19372 27330))
 ;;; Generated autoloads from progmodes/make-mode.el
 
 (autoload 'makefile-mode "make-mode" "\
@@ -16625,8 +16620,8 @@ An adapted `makefile-mode' that knows about imake.
 
 ;;;***
 \f
-;;;### (autoloads (make-command-summary) "makesum" "makesum.el" (19383
-;;;;;;  49280))
+;;;### (autoloads (make-command-summary) "makesum" "makesum.el" (19279
+;;;;;;  5148))
 ;;; Generated autoloads from makesum.el
 
 (autoload 'make-command-summary "makesum" "\
@@ -16637,7 +16632,7 @@ Previous contents of that buffer are killed first.
 
 ;;;***
 \f
-;;;### (autoloads (man-follow man) "man" "man.el" (19383 49278))
+;;;### (autoloads (man-follow man) "man" "man.el" (19345 41626))
 ;;; Generated autoloads from man.el
 
 (defalias 'manual-entry 'man)
@@ -16686,7 +16681,7 @@ Get a Un*x manual page of the item under point and put it in a buffer.
 
 ;;;***
 \f
-;;;### (autoloads (master-mode) "master" "master.el" (19383 49280))
+;;;### (autoloads (master-mode) "master" "master.el" (19279 5148))
 ;;; Generated autoloads from master.el
 
 (autoload 'master-mode "master" "\
@@ -16709,7 +16704,7 @@ yourself the value of `master-of' by calling `master-show-slave'.
 ;;;***
 \f
 ;;;### (autoloads (minibuffer-depth-indicate-mode) "mb-depth" "mb-depth.el"
-;;;;;;  (19383 49280))
+;;;;;;  (19279 5148))
 ;;; Generated autoloads from mb-depth.el
 
 (defvar minibuffer-depth-indicate-mode nil "\
@@ -16740,7 +16735,7 @@ Returns non-nil if the new state is enabled.
 ;;;;;;  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" (19409 46567))
+;;;;;;  "gnus/message.el" (19370 36541))
 ;;; 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)
@@ -16906,7 +16901,7 @@ which specify the range to operate on.
 ;;;***
 \f
 ;;;### (autoloads (metapost-mode metafont-mode) "meta-mode" "progmodes/meta-mode.el"
-;;;;;;  (19383 49280))
+;;;;;;  (19279 5151))
 ;;; Generated autoloads from progmodes/meta-mode.el
 
 (autoload 'metafont-mode "meta-mode" "\
@@ -16933,7 +16928,7 @@ Turning on MetaPost mode calls the value of the variable
 \f
 ;;;### (autoloads (metamail-region metamail-buffer metamail-interpret-body
 ;;;;;;  metamail-interpret-header) "metamail" "mail/metamail.el"
-;;;;;;  (19383 49280))
+;;;;;;  (19356 10801))
 ;;; Generated autoloads from mail/metamail.el
 
 (autoload 'metamail-interpret-header "metamail" "\
@@ -16978,7 +16973,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" (19383 49280))
+;;;;;;  "mh-e/mh-comp.el" (19279 5150))
 ;;; Generated autoloads from mh-e/mh-comp.el
 
 (autoload 'mh-smail "mh-comp" "\
@@ -17068,7 +17063,7 @@ delete the draft message.
 
 ;;;***
 \f
-;;;### (autoloads (mh-version) "mh-e" "mh-e/mh-e.el" (19383 49280))
+;;;### (autoloads (mh-version) "mh-e" "mh-e/mh-e.el" (19279 5150))
 ;;; Generated autoloads from mh-e/mh-e.el
 
 (put 'mh-progs 'risky-local-variable t)
@@ -17085,7 +17080,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" (19383 49280))
+;;;;;;  "mh-e/mh-folder.el" (19279 5150))
 ;;; Generated autoloads from mh-e/mh-folder.el
 
 (autoload 'mh-rmail "mh-folder" "\
@@ -17167,7 +17162,7 @@ perform the operation on all messages in that region.
 ;;;***
 \f
 ;;;### (autoloads (midnight-delay-set clean-buffer-list) "midnight"
-;;;;;;  "midnight.el" (19383 49280))
+;;;;;;  "midnight.el" (19369 15960))
 ;;; Generated autoloads from midnight.el
 
 (autoload 'clean-buffer-list "midnight" "\
@@ -17194,7 +17189,7 @@ to its second argument TM.
 ;;;***
 \f
 ;;;### (autoloads (minibuffer-electric-default-mode) "minibuf-eldef"
-;;;;;;  "minibuf-eldef.el" (19383 49280))
+;;;;;;  "minibuf-eldef.el" (19279 5148))
 ;;; Generated autoloads from minibuf-eldef.el
 
 (defvar minibuffer-electric-default-mode nil "\
@@ -17221,7 +17216,7 @@ Returns non-nil if the new state is enabled.
 
 ;;;***
 \f
-;;;### (autoloads (butterfly) "misc" "misc.el" (19383 49280))
+;;;### (autoloads (butterfly) "misc" "misc.el" (19279 5148))
 ;;; Generated autoloads from misc.el
 
 (autoload 'butterfly "misc" "\
@@ -17240,7 +17235,7 @@ variation of `C-x M-c M-butterfly' from url `http://xkcd.com/378/'.
 \f
 ;;;### (autoloads (multi-isearch-files-regexp multi-isearch-files
 ;;;;;;  multi-isearch-buffers-regexp multi-isearch-buffers multi-isearch-setup)
-;;;;;;  "misearch" "misearch.el" (19383 49280))
+;;;;;;  "misearch" "misearch.el" (19279 5148))
 ;;; Generated autoloads from misearch.el
  (add-hook 'isearch-mode-hook 'multi-isearch-setup)
 
@@ -17322,7 +17317,7 @@ whose file names match the specified wildcard.
 ;;;***
 \f
 ;;;### (autoloads (mixal-mode) "mixal-mode" "progmodes/mixal-mode.el"
-;;;;;;  (19383 49280))
+;;;;;;  (19358 54001))
 ;;; Generated autoloads from progmodes/mixal-mode.el
 
 (autoload 'mixal-mode "mixal-mode" "\
@@ -17336,7 +17331,7 @@ Major mode for the mixal asm language.
 ;;;***
 \f
 ;;;### (autoloads (mm-inline-external-body mm-extern-cache-contents)
-;;;;;;  "mm-extern" "gnus/mm-extern.el" (19383 49280))
+;;;;;;  "mm-extern" "gnus/mm-extern.el" (19279 5150))
 ;;; Generated autoloads from gnus/mm-extern.el
 
 (autoload 'mm-extern-cache-contents "mm-extern" "\
@@ -17355,7 +17350,7 @@ If NO-DISPLAY is nil, display it. Otherwise, do nothing after replacing.
 ;;;***
 \f
 ;;;### (autoloads (mm-inline-partial) "mm-partial" "gnus/mm-partial.el"
-;;;;;;  (19383 49280))
+;;;;;;  (19279 5150))
 ;;; Generated autoloads from gnus/mm-partial.el
 
 (autoload 'mm-inline-partial "mm-partial" "\
@@ -17369,7 +17364,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" (19383 49280))
+;;;;;;  "mm-url" "gnus/mm-url.el" (19279 5150))
 ;;; Generated autoloads from gnus/mm-url.el
 
 (autoload 'mm-url-insert-file-contents "mm-url" "\
@@ -17386,7 +17381,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" (19383 49283))
+;;;;;;  "gnus/mm-uu.el" (19279 5150))
 ;;; Generated autoloads from gnus/mm-uu.el
 
 (autoload 'mm-uu-dissect "mm-uu" "\
@@ -17406,7 +17401,7 @@ Assume text has been decoded if DECODED is non-nil.
 ;;;***
 \f
 ;;;### (autoloads (mml1991-sign mml1991-encrypt) "mml1991" "gnus/mml1991.el"
-;;;;;;  (19383 49280))
+;;;;;;  (19365 25156))
 ;;; Generated autoloads from gnus/mml1991.el
 
 (autoload 'mml1991-encrypt "mml1991" "\
@@ -17423,7 +17418,7 @@ Not documented
 \f
 ;;;### (autoloads (mml2015-self-encrypt mml2015-sign mml2015-encrypt
 ;;;;;;  mml2015-verify-test mml2015-verify mml2015-decrypt-test mml2015-decrypt)
-;;;;;;  "mml2015" "gnus/mml2015.el" (19383 49280))
+;;;;;;  "mml2015" "gnus/mml2015.el" (19365 25156))
 ;;; Generated autoloads from gnus/mml2015.el
 
 (autoload 'mml2015-decrypt "mml2015" "\
@@ -17464,7 +17459,7 @@ Not documented
 ;;;***
 \f
 ;;;### (autoloads (modula-2-mode) "modula2" "progmodes/modula2.el"
-;;;;;;  (19352 21355))
+;;;;;;  (19256 49603))
 ;;; Generated autoloads from progmodes/modula2.el
 
 (autoload 'modula-2-mode "modula2" "\
@@ -17496,7 +17491,7 @@ followed by the first character of the construct.
 ;;;***
 \f
 ;;;### (autoloads (unmorse-region morse-region) "morse" "play/morse.el"
-;;;;;;  (19383 49280))
+;;;;;;  (19279 5151))
 ;;; Generated autoloads from play/morse.el
 
 (autoload 'morse-region "morse" "\
@@ -17512,7 +17507,7 @@ Convert morse coded text in region to ordinary ASCII text.
 ;;;***
 \f
 ;;;### (autoloads (mouse-drag-drag mouse-drag-throw) "mouse-drag"
-;;;;;;  "mouse-drag.el" (19383 49280))
+;;;;;;  "mouse-drag.el" (19279 5148))
 ;;; Generated autoloads from mouse-drag.el
 
 (autoload 'mouse-drag-throw "mouse-drag" "\
@@ -17559,8 +17554,8 @@ To test this function, evaluate:
 
 ;;;***
 \f
-;;;### (autoloads (mouse-sel-mode) "mouse-sel" "mouse-sel.el" (19383
-;;;;;;  49280))
+;;;### (autoloads (mouse-sel-mode) "mouse-sel" "mouse-sel.el" (19279
+;;;;;;  5148))
 ;;; Generated autoloads from mouse-sel.el
 
 (defvar mouse-sel-mode nil "\
@@ -17612,7 +17607,7 @@ primary selection and region.
 
 ;;;***
 \f
-;;;### (autoloads (mpc) "mpc" "mpc.el" (19383 49280))
+;;;### (autoloads (mpc) "mpc" "mpc.el" (19372 27330))
 ;;; Generated autoloads from mpc.el
 
 (autoload 'mpc "mpc" "\
@@ -17622,7 +17617,7 @@ Main entry point for MPC.
 
 ;;;***
 \f
-;;;### (autoloads (mpuz) "mpuz" "play/mpuz.el" (19383 49280))
+;;;### (autoloads (mpuz) "mpuz" "play/mpuz.el" (19279 5151))
 ;;; Generated autoloads from play/mpuz.el
 
 (autoload 'mpuz "mpuz" "\
@@ -17632,7 +17627,7 @@ Multiplication puzzle with GNU Emacs.
 
 ;;;***
 \f
-;;;### (autoloads (msb-mode) "msb" "msb.el" (19383 49280))
+;;;### (autoloads (msb-mode) "msb" "msb.el" (19279 5148))
 ;;; Generated autoloads from msb.el
 
 (defvar msb-mode nil "\
@@ -17659,7 +17654,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"
-;;;;;;  (19383 49280))
+;;;;;;  (19279 5150))
 ;;; Generated autoloads from international/mule-diag.el
 
 (autoload 'list-character-sets "mule-diag" "\
@@ -17796,7 +17791,7 @@ 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" (19383 49276))
+;;;;;;  "mule-util" "international/mule-util.el" (19313 15414))
 ;;; Generated autoloads from international/mule-util.el
 
 (autoload 'string-to-sequence "mule-util" "\
@@ -17936,8 +17931,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" (19383
-;;;;;;  49280))
+;;;;;;  iwconfig ifconfig) "net-utils" "net/net-utils.el" (19279
+;;;;;;  5151))
 ;;; Generated autoloads from net/net-utils.el
 
 (autoload 'ifconfig "net-utils" "\
@@ -18036,7 +18031,7 @@ Open a network connection to HOST on PORT.
 ;;;;;;  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" (19383 49280))
+;;;;;;  "newcomment.el" (19279 5148))
 ;;; Generated autoloads from newcomment.el
 
 (defalias 'indent-for-comment 'comment-indent)
@@ -18236,7 +18231,7 @@ unless optional argument SOFT is non-nil.
 ;;;***
 \f
 ;;;### (autoloads (newsticker-start newsticker-running-p) "newst-backend"
-;;;;;;  "net/newst-backend.el" (19383 49280))
+;;;;;;  "net/newst-backend.el" (19279 5151))
 ;;; Generated autoloads from net/newst-backend.el
 
 (autoload 'newsticker-running-p "newst-backend" "\
@@ -18258,7 +18253,7 @@ Run `newsticker-start-hook' if newsticker was not running already.
 ;;;***
 \f
 ;;;### (autoloads (newsticker-plainview) "newst-plainview" "net/newst-plainview.el"
-;;;;;;  (19383 49280))
+;;;;;;  (19279 5151))
 ;;; Generated autoloads from net/newst-plainview.el
 
 (autoload 'newsticker-plainview "newst-plainview" "\
@@ -18269,7 +18264,7 @@ Start newsticker plainview.
 ;;;***
 \f
 ;;;### (autoloads (newsticker-show-news) "newst-reader" "net/newst-reader.el"
-;;;;;;  (19383 49280))
+;;;;;;  (19279 5151))
 ;;; Generated autoloads from net/newst-reader.el
 
 (autoload 'newsticker-show-news "newst-reader" "\
@@ -18280,7 +18275,7 @@ 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" (19383 49280))
+;;;;;;  "newst-ticker" "net/newst-ticker.el" (19279 5151))
 ;;; Generated autoloads from net/newst-ticker.el
 
 (autoload 'newsticker-ticker-running-p "newst-ticker" "\
@@ -18301,7 +18296,7 @@ running already.
 ;;;***
 \f
 ;;;### (autoloads (newsticker-treeview) "newst-treeview" "net/newst-treeview.el"
-;;;;;;  (19383 49280))
+;;;;;;  (19279 5151))
 ;;; Generated autoloads from net/newst-treeview.el
 
 (autoload 'newsticker-treeview "newst-treeview" "\
@@ -18312,7 +18307,7 @@ Start newsticker treeview.
 ;;;***
 \f
 ;;;### (autoloads (nndiary-generate-nov-databases) "nndiary" "gnus/nndiary.el"
-;;;;;;  (19383 49280))
+;;;;;;  (19279 38446))
 ;;; Generated autoloads from gnus/nndiary.el
 
 (autoload 'nndiary-generate-nov-databases "nndiary" "\
@@ -18322,8 +18317,8 @@ Generate NOV databases in all nndiary directories.
 
 ;;;***
 \f
-;;;### (autoloads (nndoc-add-type) "nndoc" "gnus/nndoc.el" (19383
-;;;;;;  49280))
+;;;### (autoloads (nndoc-add-type) "nndoc" "gnus/nndoc.el" (19279
+;;;;;;  5150))
 ;;; Generated autoloads from gnus/nndoc.el
 
 (autoload 'nndoc-add-type "nndoc" "\
@@ -18338,7 +18333,7 @@ symbol in the alist.
 ;;;***
 \f
 ;;;### (autoloads (nnfolder-generate-active-file) "nnfolder" "gnus/nnfolder.el"
-;;;;;;  (19383 49280))
+;;;;;;  (19279 5150))
 ;;; Generated autoloads from gnus/nnfolder.el
 
 (autoload 'nnfolder-generate-active-file "nnfolder" "\
@@ -18350,7 +18345,7 @@ This command does not work if you use short group names.
 ;;;***
 \f
 ;;;### (autoloads (nnkiboze-generate-groups) "nnkiboze" "gnus/nnkiboze.el"
-;;;;;;  (19383 49280))
+;;;;;;  (19279 5150))
 ;;; Generated autoloads from gnus/nnkiboze.el
 
 (autoload 'nnkiboze-generate-groups "nnkiboze" "\
@@ -18362,7 +18357,7 @@ Finds out what articles are to be part of the nnkiboze groups.
 ;;;***
 \f
 ;;;### (autoloads (nnml-generate-nov-databases) "nnml" "gnus/nnml.el"
-;;;;;;  (19383 49280))
+;;;;;;  (19279 38446))
 ;;; Generated autoloads from gnus/nnml.el
 
 (autoload 'nnml-generate-nov-databases "nnml" "\
@@ -18373,7 +18368,7 @@ Generate NOV databases in all nnml directories.
 ;;;***
 \f
 ;;;### (autoloads (nnsoup-revert-variables nnsoup-set-variables nnsoup-pack-replies)
-;;;;;;  "nnsoup" "gnus/nnsoup.el" (19383 49280))
+;;;;;;  "nnsoup" "gnus/nnsoup.el" (19279 5150))
 ;;; Generated autoloads from gnus/nnsoup.el
 
 (autoload 'nnsoup-pack-replies "nnsoup" "\
@@ -18394,7 +18389,7 @@ Revert posting and mailing methods to the standard Emacs methods.
 ;;;***
 \f
 ;;;### (autoloads (disable-command enable-command disabled-command-function)
-;;;;;;  "novice" "novice.el" (19383 49280))
+;;;;;;  "novice" "novice.el" (19279 5148))
 ;;; Generated autoloads from novice.el
 
 (defvar disabled-command-function 'disabled-command-function "\
@@ -18427,7 +18422,7 @@ to future sessions.
 ;;;***
 \f
 ;;;### (autoloads (nroff-mode) "nroff-mode" "textmodes/nroff-mode.el"
-;;;;;;  (19383 49280))
+;;;;;;  (19279 5152))
 ;;; Generated autoloads from textmodes/nroff-mode.el
 
 (autoload 'nroff-mode "nroff-mode" "\
@@ -18442,7 +18437,7 @@ closing requests for requests that are used in matched pairs.
 ;;;***
 \f
 ;;;### (autoloads (nxml-glyph-display-string) "nxml-glyph" "nxml/nxml-glyph.el"
-;;;;;;  (19383 49280))
+;;;;;;  (19279 5151))
 ;;; Generated autoloads from nxml/nxml-glyph.el
 
 (autoload 'nxml-glyph-display-string "nxml-glyph" "\
@@ -18454,8 +18449,8 @@ Return nil if the face cannot display a glyph for N.
 
 ;;;***
 \f
-;;;### (autoloads (nxml-mode) "nxml-mode" "nxml/nxml-mode.el" (19383
-;;;;;;  49276))
+;;;### (autoloads (nxml-mode) "nxml-mode" "nxml/nxml-mode.el" (19356
+;;;;;;  10801))
 ;;; Generated autoloads from nxml/nxml-mode.el
 
 (autoload 'nxml-mode "nxml-mode" "\
@@ -18517,7 +18512,7 @@ Many aspects this mode can be customized using
 ;;;***
 \f
 ;;;### (autoloads (nxml-enable-unicode-char-name-sets) "nxml-uchnm"
-;;;;;;  "nxml/nxml-uchnm.el" (19383 49280))
+;;;;;;  "nxml/nxml-uchnm.el" (19279 5151))
 ;;; Generated autoloads from nxml/nxml-uchnm.el
 
 (autoload 'nxml-enable-unicode-char-name-sets "nxml-uchnm" "\
@@ -18530,7 +18525,7 @@ the variable `nxml-enabled-unicode-blocks'.
 ;;;***
 \f
 ;;;### (autoloads (inferior-octave) "octave-inf" "progmodes/octave-inf.el"
-;;;;;;  (19383 49280))
+;;;;;;  (19279 5151))
 ;;; Generated autoloads from progmodes/octave-inf.el
 
 (autoload 'inferior-octave "octave-inf" "\
@@ -18553,7 +18548,7 @@ startup file, `~/.emacs-octave'.
 ;;;***
 \f
 ;;;### (autoloads (octave-mode) "octave-mod" "progmodes/octave-mod.el"
-;;;;;;  (19383 49280))
+;;;;;;  (19279 5151))
 ;;; Generated autoloads from progmodes/octave-mod.el
 
 (autoload 'octave-mode "octave-mod" "\
@@ -18648,7 +18643,7 @@ including a reproducible test case and send the message.
 ;;;;;;  org-map-entries org-open-link-from-string org-open-at-point-global
 ;;;;;;  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" "org/org.el" (19383 49280))
+;;;;;;  org-mode) "org" "org/org.el" (19356 10801))
 ;;; Generated autoloads from org/org.el
 
 (autoload 'org-mode "org" "\
@@ -18861,7 +18856,7 @@ 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" (19383 49280))
+;;;;;;  org-agenda) "org-agenda" "org/org-agenda.el" (19279 5151))
 ;;; Generated autoloads from org/org-agenda.el
 
 (autoload 'org-agenda "org-agenda" "\
@@ -19124,7 +19119,7 @@ belonging to the \"Work\" category.
 \f
 ;;;### (autoloads (org-archive-subtree-default-with-confirmation
 ;;;;;;  org-archive-subtree-default) "org-archive" "org/org-archive.el"
-;;;;;;  (19383 49280))
+;;;;;;  (19279 5151))
 ;;; Generated autoloads from org/org-archive.el
 
 (autoload 'org-archive-subtree-default "org-archive" "\
@@ -19143,7 +19138,7 @@ This command is set with the variable `org-archive-default-command'.
 \f
 ;;;### (autoloads (org-export-as-ascii org-export-region-as-ascii
 ;;;;;;  org-replace-region-by-ascii org-export-as-ascii-to-buffer)
-;;;;;;  "org-ascii" "org/org-ascii.el" (19383 49280))
+;;;;;;  "org-ascii" "org/org-ascii.el" (19279 5151))
 ;;; Generated autoloads from org/org-ascii.el
 
 (autoload 'org-export-as-ascii-to-buffer "org-ascii" "\
@@ -19196,8 +19191,8 @@ publishing directory.
 
 ;;;***
 \f
-;;;### (autoloads (org-attach) "org-attach" "org/org-attach.el" (19383
-;;;;;;  49280))
+;;;### (autoloads (org-attach) "org-attach" "org/org-attach.el" (19279
+;;;;;;  5151))
 ;;; Generated autoloads from org/org-attach.el
 
 (autoload 'org-attach "org-attach" "\
@@ -19209,7 +19204,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"
-;;;;;;  (19383 49280))
+;;;;;;  (19279 5151))
 ;;; Generated autoloads from org/org-bbdb.el
 
 (autoload 'org-bbdb-anniversaries "org-bbdb" "\
@@ -19220,7 +19215,7 @@ Extract anniversaries from BBDB for display in the agenda.
 ;;;***
 \f
 ;;;### (autoloads (org-clock-persistence-insinuate org-get-clocktable)
-;;;;;;  "org-clock" "org/org-clock.el" (19383 49280))
+;;;;;;  "org-clock" "org/org-clock.el" (19279 5151))
 ;;; Generated autoloads from org/org-clock.el
 
 (autoload 'org-get-clocktable "org-clock" "\
@@ -19240,7 +19235,7 @@ Set up hooks for clock persistence
 ;;;### (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" (19383 49280))
+;;;;;;  "org-docbook" "org/org-docbook.el" (19279 5151))
 ;;; Generated autoloads from org/org-docbook.el
 
 (autoload 'org-export-as-docbook-batch "org-docbook" "\
@@ -19317,7 +19312,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"
-;;;;;;  (19383 49280))
+;;;;;;  (19279 5151))
 ;;; Generated autoloads from org/org-exp.el
 
 (autoload 'org-export "org-exp" "\
@@ -19374,8 +19369,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" (19383
-;;;;;;  49280))
+;;;;;;  org-feed-update-all) "org-feed" "org/org-feed.el" (19279
+;;;;;;  5151))
 ;;; Generated autoloads from org/org-feed.el
 
 (autoload 'org-feed-update-all "org-feed" "\
@@ -19403,7 +19398,7 @@ Show the raw feed buffer of a feed.
 ;;;***
 \f
 ;;;### (autoloads (org-footnote-normalize org-footnote-action) "org-footnote"
-;;;;;;  "org/org-footnote.el" (19383 49281))
+;;;;;;  "org/org-footnote.el" (19279 5151))
 ;;; Generated autoloads from org/org-footnote.el
 
 (autoload 'org-footnote-action "org-footnote" "\
@@ -19430,7 +19425,7 @@ referenced sequence.
 ;;;### (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" (19383 49276))
+;;;;;;  "org/org-freemind.el" (19323 49698))
 ;;; Generated autoloads from org/org-freemind.el
 
 (autoload 'org-export-as-freemind "org-freemind" "\
@@ -19468,7 +19463,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" (19383 49281))
+;;;;;;  "org/org-html.el" (19279 5151))
 ;;; Generated autoloads from org/org-html.el
 
 (put 'org-export-html-style-include-default 'safe-local-variable 'booleanp)
@@ -19561,7 +19556,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"
-;;;;;;  (19383 49281))
+;;;;;;  (19279 5151))
 ;;; Generated autoloads from org/org-icalendar.el
 
 (autoload 'org-export-icalendar-this-file "org-icalendar" "\
@@ -19588,7 +19583,7 @@ The file is stored under the name `org-combined-agenda-icalendar-file'.
 \f
 ;;;### (autoloads (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" (19383 49281))
+;;;;;;  org-id-get-create) "org-id" "org/org-id.el" (19279 5151))
 ;;; Generated autoloads from org/org-id.el
 
 (autoload 'org-id-get-create "org-id" "\
@@ -19652,7 +19647,7 @@ Query the id database for the file in which this ID is located.
 ;;;***
 \f
 ;;;### (autoloads (org-indent-mode) "org-indent" "org/org-indent.el"
-;;;;;;  (19383 49281))
+;;;;;;  (19279 5151))
 ;;; Generated autoloads from org/org-indent.el
 
 (autoload 'org-indent-mode "org-indent" "\
@@ -19667,7 +19662,7 @@ FIXME:  How to update when broken?
 ;;;***
 \f
 ;;;### (autoloads (org-irc-store-link) "org-irc" "org/org-irc.el"
-;;;;;;  (19383 49281))
+;;;;;;  (19279 5151))
 ;;; Generated autoloads from org/org-irc.el
 
 (autoload 'org-irc-store-link "org-irc" "\
@@ -19680,7 +19675,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"
-;;;;;;  (19383 49281))
+;;;;;;  (19279 5151))
 ;;; Generated autoloads from org/org-latex.el
 
 (autoload 'org-export-as-latex-batch "org-latex" "\
@@ -19760,8 +19755,8 @@ Export as LaTeX, then process through to PDF, and open.
 ;;;***
 \f
 ;;;### (autoloads (org-mobile-create-sumo-agenda org-mobile-pull
-;;;;;;  org-mobile-push) "org-mobile" "org/org-mobile.el" (19383
-;;;;;;  49281))
+;;;;;;  org-mobile-push) "org-mobile" "org/org-mobile.el" (19279
+;;;;;;  5151))
 ;;; Generated autoloads from org/org-mobile.el
 
 (autoload 'org-mobile-push "org-mobile" "\
@@ -19786,7 +19781,7 @@ Create a file that contains all custom agenda views.
 ;;;***
 \f
 ;;;### (autoloads (org-plot/gnuplot) "org-plot" "org/org-plot.el"
-;;;;;;  (19383 49281))
+;;;;;;  (19279 5151))
 ;;; Generated autoloads from org/org-plot.el
 
 (autoload 'org-plot/gnuplot "org-plot" "\
@@ -19800,7 +19795,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"
-;;;;;;  (19383 49281))
+;;;;;;  (19279 5151))
 ;;; Generated autoloads from org/org-publish.el
 
 (defalias 'org-publish-project 'org-publish)
@@ -19834,7 +19829,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" (19383 49281))
+;;;;;;  "org/org-remember.el" (19279 5151))
 ;;; Generated autoloads from org/org-remember.el
 
 (autoload 'org-remember-insinuate "org-remember" "\
@@ -19909,7 +19904,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" (19383 49281))
+;;;;;;  "org-table" "org/org-table.el" (19279 5151))
 ;;; Generated autoloads from org/org-table.el
 
 (autoload 'turn-on-orgtbl "org-table" "\
@@ -19934,7 +19929,7 @@ The table is taken from the parameter TXT, or from the buffer at point.
 \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"
-;;;;;;  (19383 49281))
+;;;;;;  (19279 5151))
 ;;; Generated autoloads from org/org-timer.el
 
 (autoload 'org-timer-start "org-timer" "\
@@ -19978,7 +19973,7 @@ Set a timer.
 ;;;***
 \f
 ;;;### (autoloads (org-export-as-xoxo) "org-xoxo" "org/org-xoxo.el"
-;;;;;;  (19383 49281))
+;;;;;;  (19279 5151))
 ;;; Generated autoloads from org/org-xoxo.el
 
 (autoload 'org-export-as-xoxo "org-xoxo" "\
@@ -19990,7 +19985,7 @@ The XOXO buffer is named *xoxo-<source buffer name>*
 ;;;***
 \f
 ;;;### (autoloads (outline-minor-mode outline-mode) "outline" "outline.el"
-;;;;;;  (19383 49276))
+;;;;;;  (19365 25156))
 ;;; Generated autoloads from outline.el
 (put 'outline-regexp 'safe-local-variable 'string-or-null-p)
 
@@ -20047,7 +20042,7 @@ See the command `outline-mode' for more information on this mode.
 
 ;;;***
 \f
-;;;### (autoloads (show-paren-mode) "paren" "paren.el" (19383 49281))
+;;;### (autoloads (show-paren-mode) "paren" "paren.el" (19279 5148))
 ;;; Generated autoloads from paren.el
 
 (defvar show-paren-mode nil "\
@@ -20072,7 +20067,7 @@ in `show-paren-style' after `show-paren-delay' seconds of Emacs idle time.
 ;;;***
 \f
 ;;;### (autoloads (parse-time-string) "parse-time" "calendar/parse-time.el"
-;;;;;;  (19383 49281))
+;;;;;;  (19279 5149))
 ;;; Generated autoloads from calendar/parse-time.el
 (put 'parse-time-rules 'risky-local-variable t)
 
@@ -20085,8 +20080,8 @@ unknown are returned as nil.
 
 ;;;***
 \f
-;;;### (autoloads (pascal-mode) "pascal" "progmodes/pascal.el" (19383
-;;;;;;  49281))
+;;;### (autoloads (pascal-mode) "pascal" "progmodes/pascal.el" (19279
+;;;;;;  5151))
 ;;; Generated autoloads from progmodes/pascal.el
 
 (autoload 'pascal-mode "pascal" "\
@@ -20136,10 +20131,27 @@ no args, if that value is non-nil.
 
 \(fn)" t nil)
 
+;;;***
+\f
+;;;### (autoloads (password-cache-expiry password-cache) "password-cache"
+;;;;;;  "password-cache.el" (19365 25156))
+;;; Generated autoloads from password-cache.el
+
+(defvar password-cache t "\
+Whether to cache passwords.")
+
+(custom-autoload 'password-cache "password-cache" t)
+
+(defvar password-cache-expiry 16 "\
+How many seconds passwords are cached, or nil to disable expiring.
+Whether passwords are cached at all is controlled by `password-cache'.")
+
+(custom-autoload 'password-cache-expiry "password-cache" t)
+
 ;;;***
 \f
 ;;;### (autoloads (pc-bindings-mode) "pc-mode" "emulation/pc-mode.el"
-;;;;;;  (19383 49281))
+;;;;;;  (19279 5150))
 ;;; Generated autoloads from emulation/pc-mode.el
 
 (autoload 'pc-bindings-mode "pc-mode" "\
@@ -20157,7 +20169,7 @@ C-Escape does list-buffers.
 ;;;***
 \f
 ;;;### (autoloads (pc-selection-mode) "pc-select" "emulation/pc-select.el"
-;;;;;;  (19383 49281))
+;;;;;;  (19356 10801))
 ;;; Generated autoloads from emulation/pc-select.el
 
 (defvar pc-selection-mode nil "\
@@ -20223,8 +20235,8 @@ but before calling PC Selection mode):
 
 ;;;***
 \f
-;;;### (autoloads (pcomplete/cvs) "pcmpl-cvs" "pcmpl-cvs.el" (19383
-;;;;;;  49281))
+;;;### (autoloads (pcomplete/cvs) "pcmpl-cvs" "pcmpl-cvs.el" (19279
+;;;;;;  5148))
 ;;; Generated autoloads from pcmpl-cvs.el
 
 (autoload 'pcomplete/cvs "pcmpl-cvs" "\
@@ -20235,7 +20247,7 @@ Completion rules for the `cvs' command.
 ;;;***
 \f
 ;;;### (autoloads (pcomplete/tar pcomplete/make pcomplete/bzip2 pcomplete/gzip)
-;;;;;;  "pcmpl-gnu" "pcmpl-gnu.el" (19383 49281))
+;;;;;;  "pcmpl-gnu" "pcmpl-gnu.el" (19279 5148))
 ;;; Generated autoloads from pcmpl-gnu.el
 
 (autoload 'pcomplete/gzip "pcmpl-gnu" "\
@@ -20263,7 +20275,7 @@ Completion for the GNU tar utility.
 ;;;***
 \f
 ;;;### (autoloads (pcomplete/mount pcomplete/umount pcomplete/kill)
-;;;;;;  "pcmpl-linux" "pcmpl-linux.el" (19383 49281))
+;;;;;;  "pcmpl-linux" "pcmpl-linux.el" (19279 5148))
 ;;; Generated autoloads from pcmpl-linux.el
 
 (autoload 'pcomplete/kill "pcmpl-linux" "\
@@ -20283,8 +20295,8 @@ Completion for GNU/Linux `mount'.
 
 ;;;***
 \f
-;;;### (autoloads (pcomplete/rpm) "pcmpl-rpm" "pcmpl-rpm.el" (19383
-;;;;;;  49281))
+;;;### (autoloads (pcomplete/rpm) "pcmpl-rpm" "pcmpl-rpm.el" (19279
+;;;;;;  5148))
 ;;; Generated autoloads from pcmpl-rpm.el
 
 (autoload 'pcomplete/rpm "pcmpl-rpm" "\
@@ -20296,7 +20308,7 @@ 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" (19383 49281))
+;;;;;;  pcomplete/cd) "pcmpl-unix" "pcmpl-unix.el" (19282 55646))
 ;;; Generated autoloads from pcmpl-unix.el
 
 (autoload 'pcomplete/cd "pcmpl-unix" "\
@@ -20353,8 +20365,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" (19383
-;;;;;;  49281))
+;;;;;;  pcomplete-reverse pcomplete) "pcomplete" "pcomplete.el" (19279
+;;;;;;  5148))
 ;;; Generated autoloads from pcomplete.el
 
 (autoload 'pcomplete "pcomplete" "\
@@ -20413,7 +20425,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"
-;;;;;;  "pcvs.el" (19383 49281))
+;;;;;;  "pcvs.el" (19279 5148))
 ;;; Generated autoloads from pcvs.el
 
 (autoload 'cvs-checkout "pcvs" "\
@@ -20488,7 +20500,7 @@ The exact behavior is determined also by `cvs-dired-use-hook'." (when (stringp d
 
 ;;;***
 \f
-;;;### (autoloads nil "pcvs-defs" "pcvs-defs.el" (19383 49281))
+;;;### (autoloads nil "pcvs-defs" "pcvs-defs.el" (19279 5148))
 ;;; Generated autoloads from 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)))
@@ -20496,7 +20508,7 @@ The exact behavior is determined also by `cvs-dired-use-hook'." (when (stringp d
 ;;;***
 \f
 ;;;### (autoloads (perl-mode) "perl-mode" "progmodes/perl-mode.el"
-;;;;;;  (19383 49281))
+;;;;;;  (19279 5151))
 ;;; Generated autoloads from progmodes/perl-mode.el
 (put 'perl-indent-level 'safe-local-variable 'integerp)
 (put 'perl-continued-statement-offset 'safe-local-variable 'integerp)
@@ -20560,7 +20572,7 @@ Turning on Perl mode runs the normal hook `perl-mode-hook'.
 ;;;### (autoloads (pgg-snarf-keys pgg-snarf-keys-region pgg-insert-key
 ;;;;;;  pgg-verify pgg-verify-region pgg-sign pgg-sign-region pgg-decrypt
 ;;;;;;  pgg-decrypt-region pgg-encrypt pgg-encrypt-symmetric pgg-encrypt-symmetric-region
-;;;;;;  pgg-encrypt-region) "pgg" "pgg.el" (19383 49281))
+;;;;;;  pgg-encrypt-region) "pgg" "pgg.el" (19279 5148))
 ;;; Generated autoloads from pgg.el
 
 (autoload 'pgg-encrypt-region "pgg" "\
@@ -20694,7 +20706,7 @@ Import public keys in the current buffer.
 ;;;***
 \f
 ;;;### (autoloads (pgg-gpg-symmetric-key-p) "pgg-gpg" "pgg-gpg.el"
-;;;;;;  (19383 49281))
+;;;;;;  (19279 5148))
 ;;; Generated autoloads from pgg-gpg.el
 
 (autoload 'pgg-gpg-symmetric-key-p "pgg-gpg" "\
@@ -20705,7 +20717,7 @@ True if decoded armor MESSAGE-KEYS has symmetric encryption indicator.
 ;;;***
 \f
 ;;;### (autoloads (picture-mode) "picture" "textmodes/picture.el"
-;;;;;;  (19383 49281))
+;;;;;;  (19356 10801))
 ;;; Generated autoloads from textmodes/picture.el
 
 (autoload 'picture-mode "picture" "\
@@ -20786,7 +20798,7 @@ they are not defaultly assigned to keys.
 ;;;***
 \f
 ;;;### (autoloads (po-find-file-coding-system) "po" "textmodes/po.el"
-;;;;;;  (19383 49281))
+;;;;;;  (19279 5152))
 ;;; Generated autoloads from textmodes/po.el
 
 (autoload 'po-find-file-coding-system "po" "\
@@ -20797,7 +20809,7 @@ Called through `file-coding-system-alist', before the file is visited for real.
 
 ;;;***
 \f
-;;;### (autoloads (pong) "pong" "play/pong.el" (19383 49281))
+;;;### (autoloads (pong) "pong" "play/pong.el" (19279 5151))
 ;;; Generated autoloads from play/pong.el
 
 (autoload 'pong "pong" "\
@@ -20815,7 +20827,7 @@ pong-mode keybindings:\\<pong-mode-map>
 \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"
-;;;;;;  (19383 49281))
+;;;;;;  (19279 5149))
 ;;; Generated autoloads from emacs-lisp/pp.el
 
 (autoload 'pp-to-string "pp" "\
@@ -20883,7 +20895,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"
-;;;;;;  (19383 49281))
+;;;;;;  (19279 5148))
 ;;; Generated autoloads from printing.el
 
 (autoload 'pr-interface "printing" "\
@@ -21470,7 +21482,7 @@ are both set to t.
 
 ;;;***
 \f
-;;;### (autoloads (proced) "proced" "proced.el" (19383 49281))
+;;;### (autoloads (proced) "proced" "proced.el" (19279 5148))
 ;;; Generated autoloads from proced.el
 
 (autoload 'proced "proced" "\
@@ -21486,7 +21498,7 @@ See `proced-mode' for a description of features available in Proced buffers.
 ;;;***
 \f
 ;;;### (autoloads (switch-to-prolog prolog-mode) "prolog" "progmodes/prolog.el"
-;;;;;;  (19383 49281))
+;;;;;;  (19279 5151))
 ;;; Generated autoloads from progmodes/prolog.el
 
 (autoload 'prolog-mode "prolog" "\
@@ -21509,8 +21521,8 @@ With prefix argument \\[universal-prefix], prompt for the program to use.
 
 ;;;***
 \f
-;;;### (autoloads (bdf-directory-list) "ps-bdf" "ps-bdf.el" (19383
-;;;;;;  49281))
+;;;### (autoloads (bdf-directory-list) "ps-bdf" "ps-bdf.el" (19279
+;;;;;;  5148))
 ;;; 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")) "\
@@ -21521,8 +21533,8 @@ The default value is '(\"/usr/local/share/emacs/fonts/bdf\").")
 
 ;;;***
 \f
-;;;### (autoloads (ps-mode) "ps-mode" "progmodes/ps-mode.el" (19383
-;;;;;;  49281))
+;;;### (autoloads (ps-mode) "ps-mode" "progmodes/ps-mode.el" (19279
+;;;;;;  5151))
 ;;; Generated autoloads from progmodes/ps-mode.el
 
 (autoload 'ps-mode "ps-mode" "\
@@ -21573,8 +21585,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" (19383
-;;;;;;  49281))
+;;;;;;  ps-page-dimensions-database) "ps-print" "ps-print.el" (19356
+;;;;;;  10801))
 ;;; 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"))) "\
@@ -21771,7 +21783,7 @@ If EXTENSION is any other symbol, it is ignored.
 ;;;***
 \f
 ;;;### (autoloads (python-shell jython-mode python-mode run-python)
-;;;;;;  "python" "progmodes/python.el" (19383 49284))
+;;;;;;  "python" "progmodes/python.el" (19338 9841))
 ;;; Generated autoloads from progmodes/python.el
 
 (add-to-list 'interpreter-mode-alist (cons (purecopy "jython") 'jython-mode))
@@ -21887,7 +21899,7 @@ filter.
 ;;;***
 \f
 ;;;### (autoloads (quoted-printable-decode-region) "qp" "gnus/qp.el"
-;;;;;;  (19383 49281))
+;;;;;;  (19279 5150))
 ;;; Generated autoloads from gnus/qp.el
 
 (autoload 'quoted-printable-decode-region "qp" "\
@@ -21910,7 +21922,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" (19383 49281))
+;;;;;;  "international/quail.el" (19279 5150))
 ;;; Generated autoloads from international/quail.el
 
 (autoload 'quail-title "quail" "\
@@ -22141,8 +22153,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" (19383
-;;;;;;  49281))
+;;;;;;  quickurl-ask quickurl) "quickurl" "net/quickurl.el" (19279
+;;;;;;  5151))
 ;;; 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" "\
@@ -22214,7 +22226,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" (19383 49281))
+;;;;;;  "net/rcirc.el" (19279 5151))
 ;;; Generated autoloads from net/rcirc.el
 
 (autoload 'rcirc "rcirc" "\
@@ -22249,8 +22261,8 @@ Global minor mode for tracking activity in rcirc buffers.
 
 ;;;***
 \f
-;;;### (autoloads (remote-compile) "rcompile" "net/rcompile.el" (19383
-;;;;;;  49281))
+;;;### (autoloads (remote-compile) "rcompile" "net/rcompile.el" (19279
+;;;;;;  5151))
 ;;; Generated autoloads from net/rcompile.el
 
 (autoload 'remote-compile "rcompile" "\
@@ -22262,7 +22274,7 @@ See \\[compile].
 ;;;***
 \f
 ;;;### (autoloads (re-builder) "re-builder" "emacs-lisp/re-builder.el"
-;;;;;;  (19383 49281))
+;;;;;;  (19279 5149))
 ;;; Generated autoloads from emacs-lisp/re-builder.el
 
 (defalias 'regexp-builder 're-builder)
@@ -22274,7 +22286,7 @@ Construct a regexp interactively.
 
 ;;;***
 \f
-;;;### (autoloads (recentf-mode) "recentf" "recentf.el" (19383 49281))
+;;;### (autoloads (recentf-mode) "recentf" "recentf.el" (19279 5148))
 ;;; Generated autoloads from recentf.el
 
 (defvar recentf-mode nil "\
@@ -22301,8 +22313,8 @@ that were operated on recently.
 ;;;### (autoloads (clear-rectangle string-insert-rectangle string-rectangle
 ;;;;;;  delete-whitespace-rectangle open-rectangle insert-rectangle
 ;;;;;;  yank-rectangle kill-rectangle extract-rectangle delete-extract-rectangle
-;;;;;;  delete-rectangle move-to-column-force) "rect" "rect.el" (19383
-;;;;;;  49281))
+;;;;;;  delete-rectangle move-to-column-force) "rect" "rect.el" (19279
+;;;;;;  5148))
 ;;; Generated autoloads from rect.el
  (define-key ctl-x-r-map "c" 'clear-rectangle)
  (define-key ctl-x-r-map "k" 'kill-rectangle)
@@ -22436,8 +22448,8 @@ rectangle which were empty.
 
 ;;;***
 \f
-;;;### (autoloads (refill-mode) "refill" "textmodes/refill.el" (19383
-;;;;;;  49281))
+;;;### (autoloads (refill-mode) "refill" "textmodes/refill.el" (19279
+;;;;;;  5152))
 ;;; Generated autoloads from textmodes/refill.el
 
 (autoload 'refill-mode "refill" "\
@@ -22453,7 +22465,7 @@ refilling if they would cause auto-filling.
 ;;;***
 \f
 ;;;### (autoloads (reftex-reset-scanning-information reftex-mode
-;;;;;;  turn-on-reftex) "reftex" "textmodes/reftex.el" (19383 49281))
+;;;;;;  turn-on-reftex) "reftex" "textmodes/reftex.el" (19279 5152))
 ;;; Generated autoloads from textmodes/reftex.el
 
 (autoload 'turn-on-reftex "reftex" "\
@@ -22503,7 +22515,7 @@ This enforces rescanning the buffer on next use.
 ;;;***
 \f
 ;;;### (autoloads (reftex-citation) "reftex-cite" "textmodes/reftex-cite.el"
-;;;;;;  (19383 49281))
+;;;;;;  (19279 5152))
 ;;; Generated autoloads from textmodes/reftex-cite.el
 
 (autoload 'reftex-citation "reftex-cite" "\
@@ -22533,7 +22545,7 @@ While entering the regexp, completion on knows citation keys is possible.
 ;;;***
 \f
 ;;;### (autoloads (reftex-isearch-minor-mode) "reftex-global" "textmodes/reftex-global.el"
-;;;;;;  (19383 49281))
+;;;;;;  (19279 5152))
 ;;; Generated autoloads from textmodes/reftex-global.el
 
 (autoload 'reftex-isearch-minor-mode "reftex-global" "\
@@ -22550,7 +22562,7 @@ With no argument, this command toggles
 ;;;***
 \f
 ;;;### (autoloads (reftex-index-phrases-mode) "reftex-index" "textmodes/reftex-index.el"
-;;;;;;  (19383 49281))
+;;;;;;  (19279 5152))
 ;;; Generated autoloads from textmodes/reftex-index.el
 
 (autoload 'reftex-index-phrases-mode "reftex-index" "\
@@ -22583,7 +22595,7 @@ Here are all local bindings.
 ;;;***
 \f
 ;;;### (autoloads (reftex-all-document-files) "reftex-parse" "textmodes/reftex-parse.el"
-;;;;;;  (19383 49281))
+;;;;;;  (19279 5152))
 ;;; Generated autoloads from textmodes/reftex-parse.el
 
 (autoload 'reftex-all-document-files "reftex-parse" "\
@@ -22595,8 +22607,8 @@ of master file.
 
 ;;;***
 \f
-;;;### (autoloads nil "reftex-vars" "textmodes/reftex-vars.el" (19383
-;;;;;;  49285))
+;;;### (autoloads nil "reftex-vars" "textmodes/reftex-vars.el" (19370
+;;;;;;  36541))
 ;;; 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))))
@@ -22606,7 +22618,7 @@ of master file.
 ;;;***
 \f
 ;;;### (autoloads (regexp-opt-depth regexp-opt) "regexp-opt" "emacs-lisp/regexp-opt.el"
-;;;;;;  (19383 49281))
+;;;;;;  (19279 5149))
 ;;; Generated autoloads from emacs-lisp/regexp-opt.el
 
 (autoload 'regexp-opt "regexp-opt" "\
@@ -22635,7 +22647,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"
-;;;;;;  (19383 49281))
+;;;;;;  (19279 5152))
 ;;; Generated autoloads from textmodes/remember.el
 
 (autoload 'remember "remember" "\
@@ -22666,7 +22678,7 @@ Extract diary entries from the region.
 
 ;;;***
 \f
-;;;### (autoloads (repeat) "repeat" "repeat.el" (19383 49281))
+;;;### (autoloads (repeat) "repeat" "repeat.el" (19279 5148))
 ;;; Generated autoloads from repeat.el
 
 (autoload 'repeat "repeat" "\
@@ -22689,7 +22701,7 @@ recently executed command not bound to an input event\".
 ;;;***
 \f
 ;;;### (autoloads (reporter-submit-bug-report) "reporter" "mail/reporter.el"
-;;;;;;  (19383 49281))
+;;;;;;  (19279 5150))
 ;;; Generated autoloads from mail/reporter.el
 
 (autoload 'reporter-submit-bug-report "reporter" "\
@@ -22721,7 +22733,7 @@ mail-sending package is used for editing and sending the message.
 ;;;***
 \f
 ;;;### (autoloads (reposition-window) "reposition" "reposition.el"
-;;;;;;  (19383 49281))
+;;;;;;  (19279 5148))
 ;;; Generated autoloads from reposition.el
 
 (autoload 'reposition-window "reposition" "\
@@ -22748,7 +22760,7 @@ first comment line visible (if point is in a comment).
 ;;;***
 \f
 ;;;### (autoloads (global-reveal-mode reveal-mode) "reveal" "reveal.el"
-;;;;;;  (19383 49281))
+;;;;;;  (19356 10801))
 ;;; Generated autoloads from reveal.el
 
 (autoload 'reveal-mode "reveal" "\
@@ -22783,7 +22795,7 @@ With zero or negative ARG turn mode off.
 ;;;***
 \f
 ;;;### (autoloads (make-ring ring-p) "ring" "emacs-lisp/ring.el"
-;;;;;;  (19383 49281))
+;;;;;;  (19279 5149))
 ;;; Generated autoloads from emacs-lisp/ring.el
 
 (autoload 'ring-p "ring" "\
@@ -22798,7 +22810,7 @@ Make a ring that can contain SIZE elements.
 
 ;;;***
 \f
-;;;### (autoloads (rlogin) "rlogin" "net/rlogin.el" (19383 49281))
+;;;### (autoloads (rlogin) "rlogin" "net/rlogin.el" (19279 5151))
 ;;; Generated autoloads from net/rlogin.el
  (add-hook 'same-window-regexps (purecopy "^\\*rlogin-.*\\*\\(\\|<[0-9]+>\\)"))
 
@@ -22848,8 +22860,8 @@ variable.
 ;;;;;;  rmail-secondary-file-directory rmail-primary-inbox-list rmail-highlighted-headers
 ;;;;;;  rmail-retry-ignored-headers rmail-displayed-headers rmail-ignored-headers
 ;;;;;;  rmail-dont-reply-to-names rmail-user-mail-address-regexp
-;;;;;;  rmail-movemail-variant-p) "rmail" "mail/rmail.el" (19383
-;;;;;;  49285))
+;;;;;;  rmail-movemail-variant-p) "rmail" "mail/rmail.el" (19370
+;;;;;;  36541))
 ;;; Generated autoloads from mail/rmail.el
 
 (autoload 'rmail-movemail-variant-p "rmail" "\
@@ -23043,7 +23055,7 @@ 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" (19383 49281))
+;;;;;;  rmail-output) "rmailout" "mail/rmailout.el" (19279 5150))
 ;;; Generated autoloads from mail/rmailout.el
 (put 'rmail-output-file-alist 'risky-local-variable t)
 
@@ -23108,7 +23120,7 @@ than appending to it.  Deletes the message after writing if
 ;;;***
 \f
 ;;;### (autoloads (rng-c-load-schema) "rng-cmpct" "nxml/rng-cmpct.el"
-;;;;;;  (19383 49281))
+;;;;;;  (19279 5151))
 ;;; Generated autoloads from nxml/rng-cmpct.el
 
 (autoload 'rng-c-load-schema "rng-cmpct" "\
@@ -23120,7 +23132,7 @@ Return a pattern.
 ;;;***
 \f
 ;;;### (autoloads (rng-nxml-mode-init) "rng-nxml" "nxml/rng-nxml.el"
-;;;;;;  (19383 49281))
+;;;;;;  (19279 5151))
 ;;; Generated autoloads from nxml/rng-nxml.el
 
 (autoload 'rng-nxml-mode-init "rng-nxml" "\
@@ -23133,7 +23145,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"
-;;;;;;  (19383 49281))
+;;;;;;  (19279 5151))
 ;;; Generated autoloads from nxml/rng-valid.el
 
 (autoload 'rng-validate-mode "rng-valid" "\
@@ -23163,8 +23175,8 @@ to use for finding the schema.
 
 ;;;***
 \f
-;;;### (autoloads (rng-xsd-compile) "rng-xsd" "nxml/rng-xsd.el" (19383
-;;;;;;  49281))
+;;;### (autoloads (rng-xsd-compile) "rng-xsd" "nxml/rng-xsd.el" (19279
+;;;;;;  5151))
 ;;; Generated autoloads from nxml/rng-xsd.el
 
 (put 'http://www\.w3\.org/2001/XMLSchema-datatypes 'rng-dt-compile 'rng-xsd-compile)
@@ -23192,7 +23204,7 @@ must be equal.
 ;;;***
 \f
 ;;;### (autoloads (robin-use-package robin-modify-package robin-define-package)
-;;;;;;  "robin" "international/robin.el" (19383 49281))
+;;;;;;  "robin" "international/robin.el" (19279 5150))
 ;;; Generated autoloads from international/robin.el
 
 (autoload 'robin-define-package "robin" "\
@@ -23225,7 +23237,7 @@ 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" (19383 49281))
+;;;;;;  rot13-string rot13) "rot13" "rot13.el" (19279 5148))
 ;;; Generated autoloads from rot13.el
 
 (autoload 'rot13 "rot13" "\
@@ -23263,7 +23275,7 @@ Toggle the use of ROT13 encoding for the current window.
 ;;;***
 \f
 ;;;### (autoloads (rst-minor-mode rst-mode) "rst" "textmodes/rst.el"
-;;;;;;  (19383 49281))
+;;;;;;  (19365 25156))
 ;;; Generated autoloads from textmodes/rst.el
  (add-to-list 'auto-mode-alist (purecopy '("\\.re?st\\'" . rst-mode)))
 
@@ -23301,7 +23313,7 @@ for modes derived from Text mode, like Mail mode.
 ;;;***
 \f
 ;;;### (autoloads (ruby-mode) "ruby-mode" "progmodes/ruby-mode.el"
-;;;;;;  (19383 49281))
+;;;;;;  (19279 5151))
 ;;; Generated autoloads from progmodes/ruby-mode.el
 
 (autoload 'ruby-mode "ruby-mode" "\
@@ -23322,8 +23334,8 @@ The variable `ruby-indent-level' controls the amount of indentation.
 
 ;;;***
 \f
-;;;### (autoloads (ruler-mode) "ruler-mode" "ruler-mode.el" (19383
-;;;;;;  49281))
+;;;### (autoloads (ruler-mode) "ruler-mode" "ruler-mode.el" (19279
+;;;;;;  5148))
 ;;; Generated autoloads from ruler-mode.el
 
 (autoload 'ruler-mode "ruler-mode" "\
@@ -23333,8 +23345,8 @@ Display a ruler in the header line if ARG > 0.
 
 ;;;***
 \f
-;;;### (autoloads (rx rx-to-string) "rx" "emacs-lisp/rx.el" (19383
-;;;;;;  49281))
+;;;### (autoloads (rx rx-to-string) "rx" "emacs-lisp/rx.el" (19279
+;;;;;;  5149))
 ;;; Generated autoloads from emacs-lisp/rx.el
 
 (autoload 'rx-to-string "rx" "\
@@ -23644,7 +23656,7 @@ enclosed in `(and ...)'.
 ;;;***
 \f
 ;;;### (autoloads (savehist-mode savehist-mode) "savehist" "savehist.el"
-;;;;;;  (19383 49282))
+;;;;;;  (19279 5148))
 ;;; Generated autoloads from savehist.el
 
 (defvar savehist-mode nil "\
@@ -23670,7 +23682,7 @@ which is probably undesirable.
 ;;;***
 \f
 ;;;### (autoloads (dsssl-mode scheme-mode) "scheme" "progmodes/scheme.el"
-;;;;;;  (19383 49282))
+;;;;;;  (19279 5151))
 ;;; Generated autoloads from progmodes/scheme.el
 
 (autoload 'scheme-mode "scheme" "\
@@ -23712,7 +23724,7 @@ that variable's value is a string.
 ;;;***
 \f
 ;;;### (autoloads (gnus-score-mode) "score-mode" "gnus/score-mode.el"
-;;;;;;  (19383 49282))
+;;;;;;  (19279 5150))
 ;;; Generated autoloads from gnus/score-mode.el
 
 (autoload 'gnus-score-mode "score-mode" "\
@@ -23726,7 +23738,7 @@ This mode is an extended emacs-lisp mode.
 ;;;***
 \f
 ;;;### (autoloads (scroll-all-mode) "scroll-all" "scroll-all.el"
-;;;;;;  (19383 49282))
+;;;;;;  (19279 5148))
 ;;; Generated autoloads from scroll-all.el
 
 (defvar scroll-all-mode nil "\
@@ -23749,7 +23761,7 @@ apply to all visible windows in the same frame.
 ;;;***
 \f
 ;;;### (autoloads (scroll-lock-mode) "scroll-lock" "scroll-lock.el"
-;;;;;;  (19383 49282))
+;;;;;;  (19279 5148))
 ;;; Generated autoloads from scroll-lock.el
 
 (autoload 'scroll-lock-mode "scroll-lock" "\
@@ -23764,7 +23776,7 @@ during scrolling.
 ;;;***
 \f
 ;;;### (autoloads (semantic-mode semantic-default-submodes) "semantic"
-;;;;;;  "cedet/semantic.el" (19383 49276))
+;;;;;;  "cedet/semantic.el" (19323 49698))
 ;;; Generated autoloads from cedet/semantic.el
 
 (defvar semantic-default-submodes '(global-semantic-idle-scheduler-mode global-semanticdb-minor-mode) "\
@@ -23816,7 +23828,7 @@ Semantic mode.
 ;;;;;;  mail-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" (19383 49284))
+;;;;;;  "sendmail" "mail/sendmail.el" (19338 9841))
 ;;; Generated autoloads from mail/sendmail.el
 
 (defvar mail-from-style 'default "\
@@ -24115,8 +24127,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" (19392
-;;;;;;  53767))
+;;;;;;  server-force-delete server-start) "server" "server.el" (19279
+;;;;;;  5148))
 ;;; Generated autoloads from server.el
 
 (autoload 'server-start "server" "\
@@ -24170,7 +24182,7 @@ only these files will be asked to be saved.
 
 ;;;***
 \f
-;;;### (autoloads (ses-mode) "ses" "ses.el" (19383 49282))
+;;;### (autoloads (ses-mode) "ses" "ses.el" (19279 5148))
 ;;; Generated autoloads from ses.el
 
 (autoload 'ses-mode "ses" "\
@@ -24189,7 +24201,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"
-;;;;;;  (19383 49282))
+;;;;;;  (19292 15232))
 ;;; Generated autoloads from textmodes/sgml-mode.el
 
 (autoload 'sgml-mode "sgml-mode" "\
@@ -24255,7 +24267,7 @@ To work around that, do:
 ;;;***
 \f
 ;;;### (autoloads (sh-mode) "sh-script" "progmodes/sh-script.el"
-;;;;;;  (19383 49284))
+;;;;;;  (19345 41626))
 ;;; Generated autoloads from progmodes/sh-script.el
 (put 'sh-shell 'safe-local-variable 'symbolp)
 
@@ -24319,7 +24331,7 @@ with your script for an edit-interpret-debug cycle.
 
 ;;;***
 \f
-;;;### (autoloads (sha1) "sha1" "sha1.el" (19383 49282))
+;;;### (autoloads (sha1) "sha1" "sha1.el" (19279 5148))
 ;;; Generated autoloads from sha1.el
 
 (autoload 'sha1 "sha1" "\
@@ -24334,7 +24346,7 @@ If BINARY is non-nil, return a string in binary form.
 ;;;***
 \f
 ;;;### (autoloads (list-load-path-shadows) "shadow" "emacs-lisp/shadow.el"
-;;;;;;  (19383 49282))
+;;;;;;  (19279 5149))
 ;;; Generated autoloads from emacs-lisp/shadow.el
 
 (autoload 'list-load-path-shadows "shadow" "\
@@ -24384,8 +24396,8 @@ function, `find-emacs-lisp-shadows'.
 ;;;***
 \f
 ;;;### (autoloads (shadow-initialize shadow-define-regexp-group shadow-define-literal-group
-;;;;;;  shadow-define-cluster) "shadowfile" "shadowfile.el" (19383
-;;;;;;  49282))
+;;;;;;  shadow-define-cluster) "shadowfile" "shadowfile.el" (19279
+;;;;;;  5148))
 ;;; Generated autoloads from shadowfile.el
 
 (autoload 'shadow-define-cluster "shadowfile" "\
@@ -24424,7 +24436,7 @@ Set up file shadowing.
 ;;;***
 \f
 ;;;### (autoloads (shell shell-dumb-shell-regexp) "shell" "shell.el"
-;;;;;;  (19383 49282))
+;;;;;;  (19279 5148))
 ;;; Generated autoloads from shell.el
 
 (defvar shell-dumb-shell-regexp (purecopy "cmd\\(proxy\\)?\\.exe") "\
@@ -24474,7 +24486,7 @@ Otherwise, one argument `-i' is passed to the shell.
 ;;;***
 \f
 ;;;### (autoloads (sieve-upload-and-bury sieve-upload sieve-manage)
-;;;;;;  "sieve" "gnus/sieve.el" (19383 49282))
+;;;;;;  "sieve" "gnus/sieve.el" (19279 5150))
 ;;; Generated autoloads from gnus/sieve.el
 
 (autoload 'sieve-manage "sieve" "\
@@ -24495,7 +24507,7 @@ Not documented
 ;;;***
 \f
 ;;;### (autoloads (sieve-mode) "sieve-mode" "gnus/sieve-mode.el"
-;;;;;;  (19383 49282))
+;;;;;;  (19365 25156))
 ;;; Generated autoloads from gnus/sieve-mode.el
 
 (autoload 'sieve-mode "sieve-mode" "\
@@ -24510,8 +24522,8 @@ Turning on Sieve mode runs `sieve-mode-hook'.
 
 ;;;***
 \f
-;;;### (autoloads (simula-mode) "simula" "progmodes/simula.el" (19383
-;;;;;;  49282))
+;;;### (autoloads (simula-mode) "simula" "progmodes/simula.el" (19279
+;;;;;;  5151))
 ;;; Generated autoloads from progmodes/simula.el
 
 (autoload 'simula-mode "simula" "\
@@ -24560,7 +24572,7 @@ 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" (19383 49282))
+;;;;;;  define-skeleton) "skeleton" "skeleton.el" (19279 5148))
 ;;; Generated autoloads from skeleton.el
 
 (defvar skeleton-filter-function 'identity "\
@@ -24670,7 +24682,7 @@ symmetrical ones, and the same character twice for the others.
 ;;;***
 \f
 ;;;### (autoloads (smerge-start-session smerge-mode smerge-ediff)
-;;;;;;  "smerge-mode" "smerge-mode.el" (19383 49282))
+;;;;;;  "smerge-mode" "smerge-mode.el" (19279 5148))
 ;;; Generated autoloads from smerge-mode.el
 
 (autoload 'smerge-ediff "smerge-mode" "\
@@ -24695,7 +24707,7 @@ If no conflict maker is found, turn off `smerge-mode'.
 ;;;***
 \f
 ;;;### (autoloads (smiley-buffer smiley-region) "smiley" "gnus/smiley.el"
-;;;;;;  (19383 49285))
+;;;;;;  (19370 36541))
 ;;; Generated autoloads from gnus/smiley.el
 
 (autoload 'smiley-region "smiley" "\
@@ -24713,7 +24725,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" (19383 49282))
+;;;;;;  "mail/smtpmail.el" (19279 5150))
 ;;; Generated autoloads from mail/smtpmail.el
 
 (autoload 'smtpmail-send-it "smtpmail" "\
@@ -24728,7 +24740,7 @@ Send mail that was queued as a result of setting `smtpmail-queue-mail'.
 
 ;;;***
 \f
-;;;### (autoloads (snake) "snake" "play/snake.el" (19383 49282))
+;;;### (autoloads (snake) "snake" "play/snake.el" (19279 5151))
 ;;; Generated autoloads from play/snake.el
 
 (autoload 'snake "snake" "\
@@ -24752,7 +24764,7 @@ Snake mode keybindings:
 ;;;***
 \f
 ;;;### (autoloads (snmpv2-mode snmp-mode) "snmp-mode" "net/snmp-mode.el"
-;;;;;;  (19383 49282))
+;;;;;;  (19279 5151))
 ;;; Generated autoloads from net/snmp-mode.el
 
 (autoload 'snmp-mode "snmp-mode" "\
@@ -24781,8 +24793,8 @@ then `snmpv2-mode-hook'.
 
 ;;;***
 \f
-;;;### (autoloads (sunrise-sunset) "solar" "calendar/solar.el" (19383
-;;;;;;  49282))
+;;;### (autoloads (sunrise-sunset) "solar" "calendar/solar.el" (19279
+;;;;;;  5149))
 ;;; Generated autoloads from calendar/solar.el
 
 (autoload 'sunrise-sunset "solar" "\
@@ -24797,8 +24809,8 @@ This function is suitable for execution in a .emacs file.
 
 ;;;***
 \f
-;;;### (autoloads (solitaire) "solitaire" "play/solitaire.el" (19383
-;;;;;;  49282))
+;;;### (autoloads (solitaire) "solitaire" "play/solitaire.el" (19279
+;;;;;;  5151))
 ;;; Generated autoloads from play/solitaire.el
 
 (autoload 'solitaire "solitaire" "\
@@ -24875,7 +24887,7 @@ Pick your favourite 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" (19383 49282))
+;;;;;;  sort-lines sort-subr) "sort" "sort.el" (19279 5148))
 ;;; Generated autoloads from sort.el
 (put 'sort-fold-case 'safe-local-variable 'booleanp)
 
@@ -25019,8 +25031,8 @@ From a program takes two point or marker arguments, BEG and END.
 
 ;;;***
 \f
-;;;### (autoloads (spam-initialize) "spam" "gnus/spam.el" (19383
-;;;;;;  49282))
+;;;### (autoloads (spam-initialize) "spam" "gnus/spam.el" (19279
+;;;;;;  5150))
 ;;; Generated autoloads from gnus/spam.el
 
 (autoload 'spam-initialize "spam" "\
@@ -25036,7 +25048,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" (19383 49282))
+;;;;;;  "gnus/spam-report.el" (19279 5150))
 ;;; Generated autoloads from gnus/spam-report.el
 
 (autoload 'spam-report-process-queue "spam-report" "\
@@ -25079,7 +25091,7 @@ Spam reports will be queued with the method used when
 ;;;***
 \f
 ;;;### (autoloads (speedbar-get-focus speedbar-frame-mode) "speedbar"
-;;;;;;  "speedbar.el" (19383 49282))
+;;;;;;  "speedbar.el" (19279 5148))
 ;;; Generated autoloads from speedbar.el
 
 (defalias 'speedbar 'speedbar-frame-mode)
@@ -25104,7 +25116,7 @@ selected.  If the speedbar frame is active, then select the attached frame.
 ;;;***
 \f
 ;;;### (autoloads (spell-string spell-region spell-word spell-buffer)
-;;;;;;  "spell" "textmodes/spell.el" (19383 49282))
+;;;;;;  "spell" "textmodes/spell.el" (19279 5152))
 ;;; Generated autoloads from textmodes/spell.el
 
 (put 'spell-filter 'risky-local-variable t)
@@ -25148,8 +25160,8 @@ Check spelling of string supplied as argument.
 
 ;;;***
 \f
-;;;### (autoloads (snarf-spooks spook) "spook" "play/spook.el" (19383
-;;;;;;  49282))
+;;;### (autoloads (snarf-spooks spook) "spook" "play/spook.el" (19279
+;;;;;;  5151))
 ;;; Generated autoloads from play/spook.el
 
 (autoload 'spook "spook" "\
@@ -25167,8 +25179,8 @@ Return a vector containing the lines from `spook-phrases-file'.
 ;;;### (autoloads (sql-linter sql-db2 sql-interbase sql-postgres
 ;;;;;;  sql-ms sql-ingres sql-solid sql-mysql sql-sqlite sql-informix
 ;;;;;;  sql-sybase sql-oracle sql-product-interactive sql-mode sql-help
-;;;;;;  sql-add-product-keywords) "sql" "progmodes/sql.el" (19412
-;;;;;;  35030))
+;;;;;;  sql-add-product-keywords) "sql" "progmodes/sql.el" (19279
+;;;;;;  5151))
 ;;; Generated autoloads from progmodes/sql.el
 
 (autoload 'sql-add-product-keywords "sql" "\
@@ -25286,7 +25298,7 @@ the variables `sql-user', `sql-password', and `sql-database' as
 defaults, if set.  Additional command line parameters can be stored in
 the list `sql-oracle-options'.
 
-The buffer is put in SQL interactive mode, giving commands for sending
+The buffer is put in sql-interactive-mode, giving commands for sending
 input.  See `sql-interactive-mode'.
 
 To specify a coding system for converting non-ASCII characters
@@ -25312,7 +25324,7 @@ the variables `sql-server', `sql-user', `sql-password', and
 `sql-database' as defaults, if set.  Additional command line parameters
 can be stored in the list `sql-sybase-options'.
 
-The buffer is put in SQL interactive mode, giving commands for sending
+The buffer is put in sql-interactive-mode, giving commands for sending
 input.  See `sql-interactive-mode'.
 
 To specify a coding system for converting non-ASCII characters
@@ -25336,7 +25348,7 @@ If buffer exists and a process is running, just switch to buffer
 Interpreter used comes from variable `sql-informix-program'.  Login uses
 the variable `sql-database' as default, if set.
 
-The buffer is put in SQL interactive mode, giving commands for sending
+The buffer is put in sql-interactive-mode, giving commands for sending
 input.  See `sql-interactive-mode'.
 
 To specify a coding system for converting non-ASCII characters
@@ -25364,7 +25376,7 @@ the variables `sql-user', `sql-password', `sql-database', and
 `sql-server' as defaults, if set.  Additional command line parameters
 can be stored in the list `sql-sqlite-options'.
 
-The buffer is put in SQL interactive mode, giving commands for sending
+The buffer is put in sql-interactive-mode, giving commands for sending
 input.  See `sql-interactive-mode'.
 
 To specify a coding system for converting non-ASCII characters
@@ -25392,7 +25404,7 @@ the variables `sql-user', `sql-password', `sql-database', and
 `sql-server' as defaults, if set.  Additional command line parameters
 can be stored in the list `sql-mysql-options'.
 
-The buffer is put in SQL interactive mode, giving commands for sending
+The buffer is put in sql-interactive-mode, giving commands for sending
 input.  See `sql-interactive-mode'.
 
 To specify a coding system for converting non-ASCII characters
@@ -25417,7 +25429,7 @@ Interpreter used comes from variable `sql-solid-program'.  Login uses
 the variables `sql-user', `sql-password', and `sql-server' as
 defaults, if set.
 
-The buffer is put in SQL interactive mode, giving commands for sending
+The buffer is put in sql-interactive-mode, giving commands for sending
 input.  See `sql-interactive-mode'.
 
 To specify a coding system for converting non-ASCII characters
@@ -25441,7 +25453,7 @@ If buffer exists and a process is running, just switch to buffer
 Interpreter used comes from variable `sql-ingres-program'.  Login uses
 the variable `sql-database' as default, if set.
 
-The buffer is put in SQL interactive mode, giving commands for sending
+The buffer is put in sql-interactive-mode, giving commands for sending
 input.  See `sql-interactive-mode'.
 
 To specify a coding system for converting non-ASCII characters
@@ -25467,7 +25479,7 @@ variables `sql-user', `sql-password', `sql-database', and `sql-server'
 as defaults, if set.  Additional command line parameters can be stored
 in the list `sql-ms-options'.
 
-The buffer is put in SQL interactive mode, giving commands for sending
+The buffer is put in sql-interactive-mode, giving commands for sending
 input.  See `sql-interactive-mode'.
 
 To specify a coding system for converting non-ASCII characters
@@ -25493,7 +25505,7 @@ the variables `sql-database' and `sql-server' as default, if set.
 Additional command line parameters can be stored in the list
 `sql-postgres-options'.
 
-The buffer is put in SQL interactive mode, giving commands for sending
+The buffer is put in sql-interactive-mode, giving commands for sending
 input.  See `sql-interactive-mode'.
 
 To specify a coding system for converting non-ASCII characters
@@ -25523,7 +25535,7 @@ Interpreter used comes from variable `sql-interbase-program'.  Login
 uses the variables `sql-user', `sql-password', and `sql-database' as
 defaults, if set.
 
-The buffer is put in SQL interactive mode, giving commands for sending
+The buffer is put in sql-interactive-mode, giving commands for sending
 input.  See `sql-interactive-mode'.
 
 To specify a coding system for converting non-ASCII characters
@@ -25547,7 +25559,7 @@ If buffer exists and a process is running, just switch to buffer
 Interpreter used comes from variable `sql-db2-program'.  There is not
 automatic login.
 
-The buffer is put in SQL interactive mode, giving commands for sending
+The buffer is put in sql-interactive-mode, giving commands for sending
 input.  See `sql-interactive-mode'.
 
 If you use \\[sql-accumulate-and-indent] to send multiline commands to
@@ -25585,7 +25597,7 @@ local connections, `sql-server' refers to the server name from the
 for this to work).  If `sql-password' is an empty string, inl will use
 an empty password.
 
-The buffer is put in SQL interactive mode, giving commands for sending
+The buffer is put in sql-interactive-mode, giving commands for sending
 input.  See `sql-interactive-mode'.
 
 \(Type \\[describe-mode] in the SQL buffer for a list of commands.)
@@ -25595,7 +25607,7 @@ input.  See `sql-interactive-mode'.
 ;;;***
 \f
 ;;;### (autoloads (srecode-template-mode) "srecode/srt-mode" "cedet/srecode/srt-mode.el"
-;;;;;;  (19383 49282))
+;;;;;;  (19279 5149))
 ;;; Generated autoloads from cedet/srecode/srt-mode.el
 
 (autoload 'srecode-template-mode "srecode/srt-mode" "\
@@ -25611,8 +25623,8 @@ Major-mode for writing SRecode macros.
 ;;;;;;  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" (19383
-;;;;;;  49282))
+;;;;;;  strokes-global-set-stroke) "strokes" "strokes.el" (19279
+;;;;;;  5148))
 ;;; Generated autoloads from strokes.el
 
 (autoload 'strokes-global-set-stroke "strokes" "\
@@ -25722,7 +25734,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" (19383 49282))
+;;;;;;  "studly" "play/studly.el" (19256 49605))
 ;;; Generated autoloads from play/studly.el
 
 (autoload 'studlify-region "studly" "\
@@ -25743,7 +25755,7 @@ Studlify-case the current buffer.
 ;;;***
 \f
 ;;;### (autoloads (global-subword-mode subword-mode) "subword" "progmodes/subword.el"
-;;;;;;  (19383 49282))
+;;;;;;  (19279 5151))
 ;;; Generated autoloads from progmodes/subword.el
 
 (autoload 'subword-mode "subword" "\
@@ -25791,7 +25803,7 @@ See `subword-mode' for more information on Subword mode.
 ;;;***
 \f
 ;;;### (autoloads (sc-cite-original) "supercite" "mail/supercite.el"
-;;;;;;  (19383 49282))
+;;;;;;  (19365 25156))
 ;;; Generated autoloads from mail/supercite.el
 
 (autoload 'sc-cite-original "supercite" "\
@@ -25823,8 +25835,8 @@ and `sc-post-hook' is run after the guts of this function.
 
 ;;;***
 \f
-;;;### (autoloads (gpm-mouse-mode) "t-mouse" "t-mouse.el" (19383
-;;;;;;  49282))
+;;;### (autoloads (gpm-mouse-mode) "t-mouse" "t-mouse.el" (19279
+;;;;;;  5148))
 ;;; Generated autoloads from t-mouse.el
 
 (define-obsolete-function-alias 't-mouse-mode 'gpm-mouse-mode "23.1")
@@ -25851,7 +25863,7 @@ It relies on the `gpm' daemon being activated.
 
 ;;;***
 \f
-;;;### (autoloads (tabify untabify) "tabify" "tabify.el" (19383 49282))
+;;;### (autoloads (tabify untabify) "tabify" "tabify.el" (19279 5148))
 ;;; Generated autoloads from tabify.el
 
 (autoload 'untabify "tabify" "\
@@ -25886,7 +25898,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" (19383 49282))
+;;;;;;  "table" "textmodes/table.el" (19356 10801))
 ;;; Generated autoloads from textmodes/table.el
 
 (defvar table-cell-map-hook nil "\
@@ -26474,7 +26486,7 @@ converts a table into plain text without frames.  It is a companion to
 
 ;;;***
 \f
-;;;### (autoloads (talk talk-connect) "talk" "talk.el" (19383 49282))
+;;;### (autoloads (talk talk-connect) "talk" "talk.el" (19279 5148))
 ;;; Generated autoloads from talk.el
 
 (autoload 'talk-connect "talk" "\
@@ -26489,7 +26501,7 @@ Connect to the Emacs talk group from the current X display or tty frame.
 
 ;;;***
 \f
-;;;### (autoloads (tar-mode) "tar-mode" "tar-mode.el" (19383 49282))
+;;;### (autoloads (tar-mode) "tar-mode" "tar-mode.el" (19279 5148))
 ;;; Generated autoloads from tar-mode.el
 
 (autoload 'tar-mode "tar-mode" "\
@@ -26513,7 +26525,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" (19383 49282))
+;;;;;;  "progmodes/tcl.el" (19279 5151))
 ;;; Generated autoloads from progmodes/tcl.el
 
 (autoload 'tcl-mode "tcl" "\
@@ -26564,7 +26576,7 @@ Prefix argument means invert sense of `tcl-use-smart-word-finder'.
 
 ;;;***
 \f
-;;;### (autoloads (rsh telnet) "telnet" "net/telnet.el" (19383 49282))
+;;;### (autoloads (rsh telnet) "telnet" "net/telnet.el" (19279 5151))
 ;;; Generated autoloads from net/telnet.el
  (add-hook 'same-window-regexps (purecopy "\\*telnet-.*\\*\\(\\|<[0-9]+>\\)"))
 
@@ -26592,7 +26604,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"
-;;;;;;  (19383 49282))
+;;;;;;  (19292 15231))
 ;;; Generated autoloads from term.el
 
 (autoload 'make-term "term" "\
@@ -26634,8 +26646,8 @@ use in that buffer.
 
 ;;;***
 \f
-;;;### (autoloads (terminal-emulator) "terminal" "terminal.el" (19383
-;;;;;;  49282))
+;;;### (autoloads (terminal-emulator) "terminal" "terminal.el" (19279
+;;;;;;  5148))
 ;;; Generated autoloads from terminal.el
 
 (autoload 'terminal-emulator "terminal" "\
@@ -26672,7 +26684,7 @@ subprocess started.
 ;;;***
 \f
 ;;;### (autoloads (testcover-this-defun) "testcover" "emacs-lisp/testcover.el"
-;;;;;;  (19383 49282))
+;;;;;;  (19279 5149))
 ;;; Generated autoloads from emacs-lisp/testcover.el
 
 (autoload 'testcover-this-defun "testcover" "\
@@ -26682,7 +26694,7 @@ Start coverage on function under point.
 
 ;;;***
 \f
-;;;### (autoloads (tetris) "tetris" "play/tetris.el" (19383 49282))
+;;;### (autoloads (tetris) "tetris" "play/tetris.el" (19279 5151))
 ;;; Generated autoloads from play/tetris.el
 
 (autoload 'tetris "tetris" "\
@@ -26713,7 +26725,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"
-;;;;;;  (19387 22082))
+;;;;;;  (19323 49698))
 ;;; Generated autoloads from textmodes/tex-mode.el
 
 (defvar tex-shell-file-name nil "\
@@ -27015,7 +27027,7 @@ Major mode to edit DocTeX files.
 ;;;***
 \f
 ;;;### (autoloads (texi2info texinfo-format-region texinfo-format-buffer)
-;;;;;;  "texinfmt" "textmodes/texinfmt.el" (19383 49282))
+;;;;;;  "texinfmt" "textmodes/texinfmt.el" (19279 5152))
 ;;; Generated autoloads from textmodes/texinfmt.el
 
 (autoload 'texinfo-format-buffer "texinfmt" "\
@@ -27055,7 +27067,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" (19383 49282))
+;;;;;;  "texinfo" "textmodes/texinfo.el" (19279 5152))
 ;;; Generated autoloads from textmodes/texinfo.el
 
 (defvar texinfo-open-quote (purecopy "``") "\
@@ -27141,7 +27153,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"
-;;;;;;  (19383 49282))
+;;;;;;  (19279 5150))
 ;;; Generated autoloads from language/thai-util.el
 
 (autoload 'thai-compose-region "thai-util" "\
@@ -27170,7 +27182,7 @@ Not documented
 \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" (19383 49282))
+;;;;;;  "thingatpt" "thingatpt.el" (19279 5148))
 ;;; Generated autoloads from thingatpt.el
 
 (autoload 'forward-thing "thingatpt" "\
@@ -27227,7 +27239,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"
-;;;;;;  (19383 49282))
+;;;;;;  (19279 5148))
 ;;; Generated autoloads from thumbs.el
 
 (autoload 'thumbs-find-thumb "thumbs" "\
@@ -27265,8 +27277,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" (19383
-;;;;;;  49282))
+;;;;;;  tibetan-char-p) "tibet-util" "language/tibet-util.el" (19279
+;;;;;;  5150))
 ;;; Generated autoloads from language/tibet-util.el
 
 (autoload 'tibetan-char-p "tibet-util" "\
@@ -27340,7 +27352,7 @@ Not documented
 ;;;***
 \f
 ;;;### (autoloads (tildify-buffer tildify-region) "tildify" "textmodes/tildify.el"
-;;;;;;  (19383 49282))
+;;;;;;  (19279 5152))
 ;;; Generated autoloads from textmodes/tildify.el
 
 (autoload 'tildify-region "tildify" "\
@@ -27365,7 +27377,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" (19383 49282))
+;;;;;;  "time" "time.el" (19279 5148))
 ;;; Generated autoloads from time.el
 
 (defvar display-time-day-and-date nil "\
@@ -27428,7 +27440,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"
-;;;;;;  (19383 49282))
+;;;;;;  (19292 15231))
 ;;; Generated autoloads from calendar/time-date.el
 
 (autoload 'date-to-time "time-date" "\
@@ -27541,7 +27553,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" (19383 49282))
+;;;;;;  "time-stamp.el" (19279 5148))
 ;;; 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)
@@ -27585,7 +27597,7 @@ With ARG, turn time stamping on if and only if arg is positive.
 ;;;;;;  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"
-;;;;;;  (19383 49282))
+;;;;;;  (19279 5149))
 ;;; Generated autoloads from calendar/timeclock.el
 
 (autoload 'timeclock-modeline-display "timeclock" "\
@@ -27685,7 +27697,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" (19383 49282))
+;;;;;;  "international/titdic-cnv.el" (19279 5150))
 ;;; Generated autoloads from international/titdic-cnv.el
 
 (autoload 'titdic-convert "titdic-cnv" "\
@@ -27708,7 +27720,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" (19383 49284))
+;;;;;;  "tmm.el" (19279 5148))
 ;;; Generated autoloads from tmm.el
  (define-key global-map "\M-`" 'tmm-menubar)
  (define-key global-map [menu-bar mouse-1] 'tmm-menubar-mouse)
@@ -27748,7 +27760,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" (19383 49282))
+;;;;;;  "todo-mode" "calendar/todo-mode.el" (19279 5149))
 ;;; Generated autoloads from calendar/todo-mode.el
 
 (autoload 'todo-add-category "todo-mode" "\
@@ -27810,7 +27822,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" (19383 49282))
+;;;;;;  "tool-bar" "tool-bar.el" (19279 5148))
 ;;; Generated autoloads from tool-bar.el
 
 (autoload 'toggle-tool-bar-mode-from-frame "tool-bar" "\
@@ -27883,7 +27895,7 @@ holds a keymap.
 ;;;***
 \f
 ;;;### (autoloads (tpu-edt-on tpu-edt-mode) "tpu-edt" "emulation/tpu-edt.el"
-;;;;;;  (19383 49282))
+;;;;;;  (19279 5150))
 ;;; Generated autoloads from emulation/tpu-edt.el
 
 (defvar tpu-edt-mode nil "\
@@ -27910,7 +27922,7 @@ Turn on TPU/edt emulation.
 ;;;***
 \f
 ;;;### (autoloads (tpu-mapper) "tpu-mapper" "emulation/tpu-mapper.el"
-;;;;;;  (19383 49282))
+;;;;;;  (19279 5150))
 ;;; Generated autoloads from emulation/tpu-mapper.el
 
 (autoload 'tpu-mapper "tpu-mapper" "\
@@ -27944,7 +27956,7 @@ your local X guru can try to figure out why the key is being ignored.
 
 ;;;***
 \f
-;;;### (autoloads (tq-create) "tq" "emacs-lisp/tq.el" (19383 49282))
+;;;### (autoloads (tq-create) "tq" "emacs-lisp/tq.el" (19279 5149))
 ;;; Generated autoloads from emacs-lisp/tq.el
 
 (autoload 'tq-create "tq" "\
@@ -27958,7 +27970,7 @@ to a tcp server on another machine.
 ;;;***
 \f
 ;;;### (autoloads (trace-function-background trace-function trace-buffer)
-;;;;;;  "trace" "emacs-lisp/trace.el" (19383 49285))
+;;;;;;  "trace" "emacs-lisp/trace.el" (19370 36541))
 ;;; Generated autoloads from emacs-lisp/trace.el
 
 (defvar trace-buffer (purecopy "*trace-output*") "\
@@ -27995,7 +28007,7 @@ 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" (19383 49278))
+;;;;;;  "net/tramp.el" (19370 36541))
 ;;; Generated autoloads from net/tramp.el
 
 (defvar tramp-mode t "\
@@ -28128,7 +28140,7 @@ Discard Tramp from loading remote files.
 ;;;***
 \f
 ;;;### (autoloads (tramp-ftp-enable-ange-ftp) "tramp-ftp" "net/tramp-ftp.el"
-;;;;;;  (19383 49282))
+;;;;;;  (19279 5151))
 ;;; Generated autoloads from net/tramp-ftp.el
 
 (autoload 'tramp-ftp-enable-ange-ftp "tramp-ftp" "\
@@ -28138,8 +28150,8 @@ Not documented
 
 ;;;***
 \f
-;;;### (autoloads (help-with-tutorial) "tutorial" "tutorial.el" (19383
-;;;;;;  49282))
+;;;### (autoloads (help-with-tutorial) "tutorial" "tutorial.el" (19279
+;;;;;;  5148))
 ;;; Generated autoloads from tutorial.el
 
 (autoload 'help-with-tutorial "tutorial" "\
@@ -28164,7 +28176,7 @@ resumed later.
 ;;;***
 \f
 ;;;### (autoloads (tai-viet-composition-function) "tv-util" "language/tv-util.el"
-;;;;;;  (19383 49282))
+;;;;;;  (19279 5150))
 ;;; Generated autoloads from language/tv-util.el
 
 (autoload 'tai-viet-composition-function "tv-util" "\
@@ -28175,7 +28187,7 @@ Not documented
 ;;;***
 \f
 ;;;### (autoloads (2C-split 2C-associate-buffer 2C-two-columns) "two-column"
-;;;;;;  "textmodes/two-column.el" (19383 49282))
+;;;;;;  "textmodes/two-column.el" (19279 5152))
 ;;; Generated autoloads from textmodes/two-column.el
  (autoload '2C-command "two-column" () t 'keymap)
  (global-set-key "\C-x6" '2C-command)
@@ -28226,7 +28238,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"
-;;;;;;  (19383 49282))
+;;;;;;  (19279 5148))
 ;;; Generated autoloads from type-break.el
 
 (defvar type-break-mode nil "\
@@ -28408,7 +28420,7 @@ FRAC should be the inverse of the fractional value; for example, a value of
 
 ;;;***
 \f
-;;;### (autoloads (uce-reply-to-uce) "uce" "mail/uce.el" (19383 49282))
+;;;### (autoloads (uce-reply-to-uce) "uce" "mail/uce.el" (19279 5150))
 ;;; Generated autoloads from mail/uce.el
 
 (autoload 'uce-reply-to-uce "uce" "\
@@ -28426,7 +28438,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" (19383 49282))
+;;;;;;  "international/ucs-normalize.el" (19279 5150))
 ;;; Generated autoloads from international/ucs-normalize.el
 
 (autoload 'ucs-normalize-NFD-region "ucs-normalize" "\
@@ -28492,7 +28504,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" (19383 49282))
+;;;;;;  "textmodes/underline.el" (19279 5152))
 ;;; Generated autoloads from textmodes/underline.el
 
 (autoload 'underline-region "underline" "\
@@ -28513,7 +28525,7 @@ which specify the range to operate on.
 ;;;***
 \f
 ;;;### (autoloads (unrmail batch-unrmail) "unrmail" "mail/unrmail.el"
-;;;;;;  (19383 49283))
+;;;;;;  (19279 5150))
 ;;; Generated autoloads from mail/unrmail.el
 
 (autoload 'batch-unrmail "unrmail" "\
@@ -28532,8 +28544,8 @@ Convert old-style Rmail Babyl file FILE to system inbox format file TO-FILE.
 
 ;;;***
 \f
-;;;### (autoloads (unsafep) "unsafep" "emacs-lisp/unsafep.el" (19383
-;;;;;;  49283))
+;;;### (autoloads (unsafep) "unsafep" "emacs-lisp/unsafep.el" (19279
+;;;;;;  5150))
 ;;; Generated autoloads from emacs-lisp/unsafep.el
 
 (autoload 'unsafep "unsafep" "\
@@ -28546,7 +28558,7 @@ UNSAFEP-VARS is a list of symbols with local bindings.
 ;;;***
 \f
 ;;;### (autoloads (url-retrieve-synchronously url-retrieve) "url"
-;;;;;;  "url/url.el" (19383 49283))
+;;;;;;  "url/url.el" (19365 25156))
 ;;; Generated autoloads from url/url.el
 
 (autoload 'url-retrieve "url" "\
@@ -28586,7 +28598,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" (19383 49283))
+;;;;;;  "url-auth" "url/url-auth.el" (19279 5152))
 ;;; Generated autoloads from url/url-auth.el
 
 (autoload 'url-get-authentication "url-auth" "\
@@ -28628,8 +28640,8 @@ RATING   a rating between 1 and 10 of the strength of the authentication.
 ;;;***
 \f
 ;;;### (autoloads (url-cache-expired url-cache-extract url-is-cached
-;;;;;;  url-store-in-cache) "url-cache" "url/url-cache.el" (19383
-;;;;;;  49283))
+;;;;;;  url-store-in-cache) "url-cache" "url/url-cache.el" (19279
+;;;;;;  5152))
 ;;; Generated autoloads from url/url-cache.el
 
 (autoload 'url-store-in-cache "url-cache" "\
@@ -28654,7 +28666,7 @@ Return t if a cached file has expired.
 
 ;;;***
 \f
-;;;### (autoloads (url-cid) "url-cid" "url/url-cid.el" (19383 49283))
+;;;### (autoloads (url-cid) "url-cid" "url/url-cid.el" (19279 5152))
 ;;; Generated autoloads from url/url-cid.el
 
 (autoload 'url-cid "url-cid" "\
@@ -28665,7 +28677,7 @@ Not documented
 ;;;***
 \f
 ;;;### (autoloads (url-dav-vc-registered url-dav-supported-p) "url-dav"
-;;;;;;  "url/url-dav.el" (19383 49283))
+;;;;;;  "url/url-dav.el" (19279 5152))
 ;;; Generated autoloads from url/url-dav.el
 
 (autoload 'url-dav-supported-p "url-dav" "\
@@ -28680,8 +28692,8 @@ Not documented
 
 ;;;***
 \f
-;;;### (autoloads (url-file) "url-file" "url/url-file.el" (19383
-;;;;;;  49283))
+;;;### (autoloads (url-file) "url-file" "url/url-file.el" (19279
+;;;;;;  5152))
 ;;; Generated autoloads from url/url-file.el
 
 (autoload 'url-file "url-file" "\
@@ -28692,7 +28704,7 @@ Handle file: and ftp: URLs.
 ;;;***
 \f
 ;;;### (autoloads (url-open-stream url-gateway-nslookup-host) "url-gw"
-;;;;;;  "url/url-gw.el" (19383 49283))
+;;;;;;  "url/url-gw.el" (19279 5152))
 ;;; Generated autoloads from url/url-gw.el
 
 (autoload 'url-gateway-nslookup-host "url-gw" "\
@@ -28712,7 +28724,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"
-;;;;;;  (19383 49283))
+;;;;;;  (19279 5152))
 ;;; Generated autoloads from url/url-handlers.el
 
 (defvar url-handler-mode nil "\
@@ -28764,7 +28776,7 @@ Not documented
 ;;;***
 \f
 ;;;### (autoloads (url-http-options url-http-file-attributes url-http-file-exists-p
-;;;;;;  url-http) "url-http" "url/url-http.el" (19383 49283))
+;;;;;;  url-http) "url-http" "url/url-http.el" (19372 27330))
 ;;; Generated autoloads from url/url-http.el
 
 (autoload 'url-http "url-http" "\
@@ -28830,7 +28842,7 @@ HTTPS retrievals are asynchronous.")
 
 ;;;***
 \f
-;;;### (autoloads (url-irc) "url-irc" "url/url-irc.el" (19383 49283))
+;;;### (autoloads (url-irc) "url-irc" "url/url-irc.el" (19279 5152))
 ;;; Generated autoloads from url/url-irc.el
 
 (autoload 'url-irc "url-irc" "\
@@ -28840,8 +28852,8 @@ Not documented
 
 ;;;***
 \f
-;;;### (autoloads (url-ldap) "url-ldap" "url/url-ldap.el" (19383
-;;;;;;  49283))
+;;;### (autoloads (url-ldap) "url-ldap" "url/url-ldap.el" (19279
+;;;;;;  5152))
 ;;; Generated autoloads from url/url-ldap.el
 
 (autoload 'url-ldap "url-ldap" "\
@@ -28855,7 +28867,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"
-;;;;;;  (19383 49283))
+;;;;;;  (19279 5152))
 ;;; Generated autoloads from url/url-mailto.el
 
 (autoload 'url-mail "url-mailto" "\
@@ -28871,7 +28883,7 @@ Handle the mailto: URL syntax.
 ;;;***
 \f
 ;;;### (autoloads (url-data url-generic-emulator-loader url-info
-;;;;;;  url-man) "url-misc" "url/url-misc.el" (19383 49283))
+;;;;;;  url-man) "url-misc" "url/url-misc.el" (19279 5152))
 ;;; Generated autoloads from url/url-misc.el
 
 (autoload 'url-man "url-misc" "\
@@ -28903,7 +28915,7 @@ Fetch a data URL (RFC 2397).
 ;;;***
 \f
 ;;;### (autoloads (url-snews url-news) "url-news" "url/url-news.el"
-;;;;;;  (19383 49283))
+;;;;;;  (19279 5152))
 ;;; Generated autoloads from url/url-news.el
 
 (autoload 'url-news "url-news" "\
@@ -28920,7 +28932,7 @@ Not documented
 \f
 ;;;### (autoloads (url-ns-user-pref url-ns-prefs isInNet isResolvable
 ;;;;;;  dnsResolve dnsDomainIs isPlainHostName) "url-ns" "url/url-ns.el"
-;;;;;;  (19383 49283))
+;;;;;;  (19279 5152))
 ;;; Generated autoloads from url/url-ns.el
 
 (autoload 'isPlainHostName "url-ns" "\
@@ -28961,7 +28973,7 @@ Not documented
 ;;;***
 \f
 ;;;### (autoloads (url-generic-parse-url url-recreate-url) "url-parse"
-;;;;;;  "url/url-parse.el" (19383 49283))
+;;;;;;  "url/url-parse.el" (19279 5152))
 ;;; Generated autoloads from url/url-parse.el
 
 (autoload 'url-recreate-url "url-parse" "\
@@ -28979,7 +28991,7 @@ TYPE USER PASSWORD HOST PORTSPEC FILENAME TARGET ATTRIBUTES FULLNESS.
 ;;;***
 \f
 ;;;### (autoloads (url-setup-privacy-info) "url-privacy" "url/url-privacy.el"
-;;;;;;  (19383 49283))
+;;;;;;  (19279 5152))
 ;;; Generated autoloads from url/url-privacy.el
 
 (autoload 'url-setup-privacy-info "url-privacy" "\
@@ -28995,7 +29007,7 @@ Setup variables that expose info about you and your system.
 ;;;;;;  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" (19383 49283))
+;;;;;;  "url-util" "url/url-util.el" (19292 15232))
 ;;; Generated autoloads from url/url-util.el
 
 (defvar url-debug nil "\
@@ -29131,7 +29143,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" (19383 49283))
+;;;;;;  "userlock" "userlock.el" (19279 5148))
 ;;; Generated autoloads from userlock.el
 
 (autoload 'ask-user-about-lock "userlock" "\
@@ -29161,7 +29173,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" (19383 49283))
+;;;;;;  "utf-7" "international/utf-7.el" (19279 5150))
 ;;; Generated autoloads from international/utf-7.el
 
 (autoload 'utf-7-post-read-conversion "utf-7" "\
@@ -29188,7 +29200,7 @@ Not documented
 \f
 ;;;### (autoloads (uudecode-decode-region uudecode-decode-region-internal
 ;;;;;;  uudecode-decode-region-external) "uudecode" "mail/uudecode.el"
-;;;;;;  (19383 49283))
+;;;;;;  (19279 5150))
 ;;; Generated autoloads from mail/uudecode.el
 
 (autoload 'uudecode-decode-region-external "uudecode" "\
@@ -29218,7 +29230,7 @@ If FILE-NAME is non-nil, save the result to FILE-NAME.
 ;;;;;;  vc-create-tag vc-merge vc-insert-headers vc-revision-other-window
 ;;;;;;  vc-root-diff vc-diff vc-version-diff vc-register vc-next-action
 ;;;;;;  vc-before-checkin-hook vc-checkin-hook vc-checkout-hook)
-;;;;;;  "vc" "vc.el" (19383 49284))
+;;;;;;  "vc" "vc.el" (19370 36540))
 ;;; Generated autoloads from vc.el
 
 (defvar vc-checkout-hook nil "\
@@ -29460,8 +29472,8 @@ Return the branch part of a revision number REV.
 
 ;;;***
 \f
-;;;### (autoloads (vc-annotate) "vc-annotate" "vc-annotate.el" (19383
-;;;;;;  49283))
+;;;### (autoloads (vc-annotate) "vc-annotate" "vc-annotate.el" (19356
+;;;;;;  10801))
 ;;; Generated autoloads from vc-annotate.el
 
 (autoload 'vc-annotate "vc-annotate" "\
@@ -29496,7 +29508,7 @@ mode-specific menu.  `vc-annotate-color-map' and
 
 ;;;***
 \f
-;;;### (autoloads nil "vc-arch" "vc-arch.el" (19383 49283))
+;;;### (autoloads nil "vc-arch" "vc-arch.el" (19365 25156))
 ;;; Generated autoloads from vc-arch.el
  (defun vc-arch-registered (file)
   (if (vc-find-root file "{arch}/=tagging-method")
@@ -29506,7 +29518,7 @@ mode-specific menu.  `vc-annotate-color-map' and
 
 ;;;***
 \f
-;;;### (autoloads nil "vc-bzr" "vc-bzr.el" (19383 49276))
+;;;### (autoloads nil "vc-bzr" "vc-bzr.el" (19370 36540))
 ;;; Generated autoloads from vc-bzr.el
 
 (defconst vc-bzr-admin-dirname ".bzr" "\
@@ -29521,7 +29533,7 @@ Name of the directory containing Bzr repository status files.")
 
 ;;;***
 \f
-;;;### (autoloads nil "vc-cvs" "vc-cvs.el" (19383 49276))
+;;;### (autoloads nil "vc-cvs" "vc-cvs.el" (19365 25156))
 ;;; Generated autoloads from vc-cvs.el
  (defun vc-cvs-registered (f)
   (when (file-readable-p (expand-file-name
@@ -29531,7 +29543,7 @@ Name of the directory containing Bzr repository status files.")
 
 ;;;***
 \f
-;;;### (autoloads (vc-dir) "vc-dir" "vc-dir.el" (19383 49283))
+;;;### (autoloads (vc-dir) "vc-dir" "vc-dir.el" (19370 36540))
 ;;; Generated autoloads from vc-dir.el
 
 (autoload 'vc-dir "vc-dir" "\
@@ -29556,7 +29568,7 @@ These are the commands available for use in the file status buffer:
 ;;;***
 \f
 ;;;### (autoloads (vc-do-command) "vc-dispatcher" "vc-dispatcher.el"
-;;;;;;  (19383 49283))
+;;;;;;  (19374 2442))
 ;;; Generated autoloads from vc-dispatcher.el
 
 (autoload 'vc-do-command "vc-dispatcher" "\
@@ -29579,7 +29591,7 @@ case, and the process object in the asynchronous case.
 
 ;;;***
 \f
-;;;### (autoloads nil "vc-git" "vc-git.el" (19400 65477))
+;;;### (autoloads nil "vc-git" "vc-git.el" (19365 25156))
 ;;; Generated autoloads from vc-git.el
  (defun vc-git-registered (file)
   "Return non-nil if FILE is registered with git."
@@ -29590,7 +29602,7 @@ case, and the process object in the asynchronous case.
 
 ;;;***
 \f
-;;;### (autoloads nil "vc-hg" "vc-hg.el" (19405 52797))
+;;;### (autoloads nil "vc-hg" "vc-hg.el" (19370 36540))
 ;;; Generated autoloads from vc-hg.el
  (defun vc-hg-registered (file)
   "Return non-nil if FILE is registered with hg."
@@ -29601,7 +29613,7 @@ case, and the process object in the asynchronous case.
 
 ;;;***
 \f
-;;;### (autoloads nil "vc-mtn" "vc-mtn.el" (19383 49283))
+;;;### (autoloads nil "vc-mtn" "vc-mtn.el" (19365 25156))
 ;;; Generated autoloads from vc-mtn.el
 
 (defconst vc-mtn-admin-dir "_MTN")
@@ -29616,7 +29628,7 @@ case, and the process object in the asynchronous case.
 ;;;***
 \f
 ;;;### (autoloads (vc-rcs-master-templates) "vc-rcs" "vc-rcs.el"
-;;;;;;  (19383 49283))
+;;;;;;  (19365 25156))
 ;;; Generated autoloads from vc-rcs.el
 
 (defvar vc-rcs-master-templates (purecopy '("%sRCS/%s,v" "%s%s,v" "%sRCS/%s")) "\
@@ -29630,7 +29642,7 @@ For a description of possible values, see `vc-check-master-templates'.")
 ;;;***
 \f
 ;;;### (autoloads (vc-sccs-master-templates) "vc-sccs" "vc-sccs.el"
-;;;;;;  (19383 49283))
+;;;;;;  (19365 25156))
 ;;; Generated autoloads from vc-sccs.el
 
 (defvar vc-sccs-master-templates (purecopy '("%sSCCS/s.%s" "%ss.%s" vc-sccs-search-project-dir)) "\
@@ -29647,7 +29659,7 @@ find any project directory." (let ((project-dir (getenv "PROJECTDIR")) dirs dir)
 
 ;;;***
 \f
-;;;### (autoloads nil "vc-svn" "vc-svn.el" (19383 49276))
+;;;### (autoloads nil "vc-svn" "vc-svn.el" (19365 25156))
 ;;; Generated autoloads from vc-svn.el
  (defun vc-svn-registered (f)
   (let ((admin-dir (cond ((and (eq system-type 'windows-nt)
@@ -29663,7 +29675,7 @@ find any project directory." (let ((project-dir (getenv "PROJECTDIR")) dirs dir)
 ;;;***
 \f
 ;;;### (autoloads (vera-mode) "vera-mode" "progmodes/vera-mode.el"
-;;;;;;  (19383 49283))
+;;;;;;  (19279 5151))
 ;;; Generated autoloads from progmodes/vera-mode.el
  (add-to-list 'auto-mode-alist (cons (purecopy "\\.vr[hi]?\\'")  'vera-mode))
 
@@ -29721,7 +29733,7 @@ Key bindings:
 ;;;***
 \f
 ;;;### (autoloads (verilog-mode) "verilog-mode" "progmodes/verilog-mode.el"
-;;;;;;  (19383 49283))
+;;;;;;  (19279 5151))
 ;;; Generated autoloads from progmodes/verilog-mode.el
 
 (autoload 'verilog-mode "verilog-mode" "\
@@ -29858,7 +29870,7 @@ Key bindings specific to `verilog-mode-map' are:
 ;;;***
 \f
 ;;;### (autoloads (vhdl-mode) "vhdl-mode" "progmodes/vhdl-mode.el"
-;;;;;;  (19383 49283))
+;;;;;;  (19279 5151))
 ;;; Generated autoloads from progmodes/vhdl-mode.el
 
 (autoload 'vhdl-mode "vhdl-mode" "\
@@ -30399,7 +30411,7 @@ Key bindings:
 
 ;;;***
 \f
-;;;### (autoloads (vi-mode) "vi" "emulation/vi.el" (19383 49283))
+;;;### (autoloads (vi-mode) "vi" "emulation/vi.el" (19256 49605))
 ;;; Generated autoloads from emulation/vi.el
 
 (autoload 'vi-mode "vi" "\
@@ -30454,7 +30466,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" (19383 49283))
+;;;;;;  "language/viet-util.el" (19279 5150))
 ;;; Generated autoloads from language/viet-util.el
 
 (autoload 'viet-encode-viscii-char "viet-util" "\
@@ -30502,7 +30514,7 @@ Not documented
 ;;;;;;  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" (19383 49283))
+;;;;;;  "view" "view.el" (19356 10801))
 ;;; Generated autoloads from view.el
 
 (defvar view-remove-frame-by-deleting t "\
@@ -30748,8 +30760,8 @@ Exit View mode and make the current buffer editable.
 
 ;;;***
 \f
-;;;### (autoloads (vip-mode vip-setup) "vip" "emulation/vip.el" (19383
-;;;;;;  49283))
+;;;### (autoloads (vip-mode vip-setup) "vip" "emulation/vip.el" (19279
+;;;;;;  5150))
 ;;; Generated autoloads from emulation/vip.el
 
 (autoload 'vip-setup "vip" "\
@@ -30765,7 +30777,7 @@ Turn on VIP emulation of VI.
 ;;;***
 \f
 ;;;### (autoloads (viper-mode toggle-viper-mode) "viper" "emulation/viper.el"
-;;;;;;  (19383 49283))
+;;;;;;  (19279 5150))
 ;;; Generated autoloads from emulation/viper.el
 
 (autoload 'toggle-viper-mode "viper" "\
@@ -30782,7 +30794,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"
-;;;;;;  (19383 49283))
+;;;;;;  (19279 5150))
 ;;; Generated autoloads from emacs-lisp/warnings.el
 
 (defvar warning-prefix-function nil "\
@@ -30872,7 +30884,7 @@ this is equivalent to `display-warning', using
 ;;;***
 \f
 ;;;### (autoloads (wdired-change-to-wdired-mode) "wdired" "wdired.el"
-;;;;;;  (19383 49283))
+;;;;;;  (19279 5149))
 ;;; Generated autoloads from wdired.el
 
 (autoload 'wdired-change-to-wdired-mode "wdired" "\
@@ -30888,7 +30900,7 @@ See `wdired-mode'.
 
 ;;;***
 \f
-;;;### (autoloads (webjump) "webjump" "net/webjump.el" (19383 49283))
+;;;### (autoloads (webjump) "webjump" "net/webjump.el" (19279 5151))
 ;;; Generated autoloads from net/webjump.el
 
 (autoload 'webjump "webjump" "\
@@ -30905,7 +30917,7 @@ Please submit bug reports and other feedback to the author, Neil W. Van Dyke
 ;;;***
 \f
 ;;;### (autoloads (which-function-mode) "which-func" "progmodes/which-func.el"
-;;;;;;  (19383 49283))
+;;;;;;  (19279 5151))
 ;;; Generated autoloads from progmodes/which-func.el
  (put 'which-func-format 'risky-local-variable t)
  (put 'which-func-current 'risky-local-variable t)
@@ -30936,7 +30948,7 @@ and off otherwise.
 ;;;### (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" (19383 49283))
+;;;;;;  whitespace-mode) "whitespace" "whitespace.el" (19356 10801))
 ;;; Generated autoloads from whitespace.el
 
 (autoload 'whitespace-mode "whitespace" "\
@@ -31335,7 +31347,7 @@ cleaning up these problems.
 ;;;***
 \f
 ;;;### (autoloads (widget-minor-mode widget-browse-other-window widget-browse
-;;;;;;  widget-browse-at) "wid-browse" "wid-browse.el" (19383 49283))
+;;;;;;  widget-browse-at) "wid-browse" "wid-browse.el" (19279 5149))
 ;;; Generated autoloads from wid-browse.el
 
 (autoload 'widget-browse-at "wid-browse" "\
@@ -31362,8 +31374,8 @@ With arg, turn widget mode on if and only if arg is positive.
 ;;;***
 \f
 ;;;### (autoloads (widget-setup widget-insert widget-delete widget-create
-;;;;;;  widget-prompt-value widgetp) "wid-edit" "wid-edit.el" (19383
-;;;;;;  49283))
+;;;;;;  widget-prompt-value widgetp) "wid-edit" "wid-edit.el" (19356
+;;;;;;  10801))
 ;;; Generated autoloads from wid-edit.el
 
 (autoload 'widgetp "wid-edit" "\
@@ -31406,8 +31418,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" (19383
-;;;;;;  49283))
+;;;;;;  windmove-up windmove-left) "windmove" "windmove.el" (19279
+;;;;;;  5149))
 ;;; Generated autoloads from windmove.el
 
 (autoload 'windmove-left "windmove" "\
@@ -31460,7 +31472,7 @@ Default MODIFIER is 'shift.
 ;;;***
 \f
 ;;;### (autoloads (winner-mode winner-mode) "winner" "winner.el"
-;;;;;;  (19383 49283))
+;;;;;;  (19279 5149))
 ;;; Generated autoloads from winner.el
 
 (defvar winner-mode nil "\
@@ -31479,7 +31491,7 @@ With arg, turn Winner mode on if and only if arg is positive.
 ;;;***
 \f
 ;;;### (autoloads (woman-find-file woman-dired-find-file woman woman-locale)
-;;;;;;  "woman" "woman.el" (19383 49285))
+;;;;;;  "woman" "woman.el" (19370 36540))
 ;;; Generated autoloads from woman.el
 
 (defvar woman-locale nil "\
@@ -31523,7 +31535,7 @@ decompress the file if appropriate.  See the documentation for the
 ;;;***
 \f
 ;;;### (autoloads (wordstar-mode) "ws-mode" "emulation/ws-mode.el"
-;;;;;;  (19383 49283))
+;;;;;;  (19279 5150))
 ;;; Generated autoloads from emulation/ws-mode.el
 
 (autoload 'wordstar-mode "ws-mode" "\
@@ -31635,7 +31647,7 @@ The key bindings are:
 
 ;;;***
 \f
-;;;### (autoloads (xesam-search) "xesam" "net/xesam.el" (19383 49283))
+;;;### (autoloads (xesam-search) "xesam" "net/xesam.el" (19356 10801))
 ;;; Generated autoloads from net/xesam.el
 
 (autoload 'xesam-search "xesam" "\
@@ -31655,7 +31667,7 @@ Example:
 ;;;***
 \f
 ;;;### (autoloads (xml-parse-region xml-parse-file) "xml" "xml.el"
-;;;;;;  (19383 49283))
+;;;;;;  (19279 5149))
 ;;; Generated autoloads from xml.el
 
 (autoload 'xml-parse-file "xml" "\
@@ -31681,7 +31693,7 @@ If PARSE-NS is non-nil, then QNAMES are expanded.
 ;;;***
 \f
 ;;;### (autoloads (xmltok-get-declared-encoding-position) "xmltok"
-;;;;;;  "nxml/xmltok.el" (19383 49283))
+;;;;;;  "nxml/xmltok.el" (19279 5151))
 ;;; Generated autoloads from nxml/xmltok.el
 
 (autoload 'xmltok-get-declared-encoding-position "xmltok" "\
@@ -31699,8 +31711,8 @@ If LIMIT is non-nil, then do not consider characters beyond LIMIT.
 
 ;;;***
 \f
-;;;### (autoloads (xterm-mouse-mode) "xt-mouse" "xt-mouse.el" (19383
-;;;;;;  49283))
+;;;### (autoloads (xterm-mouse-mode) "xt-mouse" "xt-mouse.el" (19279
+;;;;;;  5149))
 ;;; Generated autoloads from xt-mouse.el
 
 (defvar xterm-mouse-mode nil "\
@@ -31729,7 +31741,7 @@ down the SHIFT key while pressing the mouse button.
 ;;;***
 \f
 ;;;### (autoloads (yenc-extract-filename yenc-decode-region) "yenc"
-;;;;;;  "gnus/yenc.el" (19383 49283))
+;;;;;;  "gnus/yenc.el" (19279 5150))
 ;;; Generated autoloads from gnus/yenc.el
 
 (autoload 'yenc-decode-region "yenc" "\
@@ -31745,7 +31757,7 @@ Extract file name from an yenc header.
 ;;;***
 \f
 ;;;### (autoloads (psychoanalyze-pinhead apropos-zippy insert-zippyism
-;;;;;;  yow) "yow" "play/yow.el" (19383 49283))
+;;;;;;  yow) "yow" "play/yow.el" (19279 5151))
 ;;; Generated autoloads from play/yow.el
 
 (autoload 'yow "yow" "\
@@ -31771,7 +31783,7 @@ Zippy goes to the analyst.
 
 ;;;***
 \f
-;;;### (autoloads (zone) "zone" "play/zone.el" (19383 49283))
+;;;### (autoloads (zone) "zone" "play/zone.el" (19279 5151))
 ;;; Generated autoloads from play/zone.el
 
 (autoload 'zone "zone" "\
@@ -31787,45 +31799,46 @@ Zone out, completely.
 ;;;;;;  "calc/calc-fin.el" "calc/calc-forms.el" "calc/calc-frac.el"
 ;;;;;;  "calc/calc-funcs.el" "calc/calc-graph.el" "calc/calc-help.el"
 ;;;;;;  "calc/calc-incom.el" "calc/calc-keypd.el" "calc/calc-lang.el"
-;;;;;;  "calc/calc-macs.el" "calc/calc-map.el" "calc/calc-math.el"
-;;;;;;  "calc/calc-menu.el" "calc/calc-misc.el" "calc/calc-mode.el"
-;;;;;;  "calc/calc-mtx.el" "calc/calc-nlfit.el" "calc/calc-poly.el"
-;;;;;;  "calc/calc-prog.el" "calc/calc-rewr.el" "calc/calc-rules.el"
-;;;;;;  "calc/calc-sel.el" "calc/calc-stat.el" "calc/calc-store.el"
-;;;;;;  "calc/calc-stuff.el" "calc/calc-trail.el" "calc/calc-undo.el"
-;;;;;;  "calc/calc-units.el" "calc/calc-vec.el" "calc/calc-yank.el"
-;;;;;;  "calc/calcalg2.el" "calc/calcalg3.el" "calc/calccomp.el"
-;;;;;;  "calc/calcsel2.el" "calendar/cal-bahai.el" "calendar/cal-coptic.el"
-;;;;;;  "calendar/cal-french.el" "calendar/cal-html.el" "calendar/cal-islam.el"
-;;;;;;  "calendar/cal-iso.el" "calendar/cal-julian.el" "calendar/cal-loaddefs.el"
-;;;;;;  "calendar/cal-mayan.el" "calendar/cal-menu.el" "calendar/cal-move.el"
-;;;;;;  "calendar/cal-persia.el" "calendar/cal-tex.el" "calendar/cal-x.el"
-;;;;;;  "calendar/diary-loaddefs.el" "calendar/hol-loaddefs.el" "cdl.el"
-;;;;;;  "cedet/cedet-cscope.el" "cedet/cedet-files.el" "cedet/cedet-global.el"
+;;;;;;  "calc/calc-loaddefs.el" "calc/calc-macs.el" "calc/calc-map.el"
+;;;;;;  "calc/calc-math.el" "calc/calc-menu.el" "calc/calc-misc.el"
+;;;;;;  "calc/calc-mode.el" "calc/calc-mtx.el" "calc/calc-nlfit.el"
+;;;;;;  "calc/calc-poly.el" "calc/calc-prog.el" "calc/calc-rewr.el"
+;;;;;;  "calc/calc-rules.el" "calc/calc-sel.el" "calc/calc-stat.el"
+;;;;;;  "calc/calc-store.el" "calc/calc-stuff.el" "calc/calc-trail.el"
+;;;;;;  "calc/calc-undo.el" "calc/calc-units.el" "calc/calc-vec.el"
+;;;;;;  "calc/calc-yank.el" "calc/calcalg2.el" "calc/calcalg3.el"
+;;;;;;  "calc/calccomp.el" "calc/calcsel2.el" "calendar/cal-bahai.el"
+;;;;;;  "calendar/cal-coptic.el" "calendar/cal-french.el" "calendar/cal-html.el"
+;;;;;;  "calendar/cal-islam.el" "calendar/cal-iso.el" "calendar/cal-julian.el"
+;;;;;;  "calendar/cal-loaddefs.el" "calendar/cal-mayan.el" "calendar/cal-menu.el"
+;;;;;;  "calendar/cal-move.el" "calendar/cal-persia.el" "calendar/cal-tex.el"
+;;;;;;  "calendar/cal-x.el" "calendar/diary-loaddefs.el" "calendar/hol-loaddefs.el"
+;;;;;;  "cdl.el" "cedet/cedet-cscope.el" "cedet/cedet-files.el" "cedet/cedet-global.el"
 ;;;;;;  "cedet/cedet-idutils.el" "cedet/cedet.el" "cedet/ede/autoconf-edit.el"
 ;;;;;;  "cedet/ede/cpp-root.el" "cedet/ede/dired.el" "cedet/ede/emacs.el"
-;;;;;;  "cedet/ede/files.el" "cedet/ede/linux.el" "cedet/ede/locate.el"
-;;;;;;  "cedet/ede/make.el" "cedet/ede/makefile-edit.el" "cedet/ede/pconf.el"
-;;;;;;  "cedet/ede/pmake.el" "cedet/ede/proj-archive.el" "cedet/ede/proj-aux.el"
-;;;;;;  "cedet/ede/proj-comp.el" "cedet/ede/proj-elisp.el" "cedet/ede/proj-info.el"
-;;;;;;  "cedet/ede/proj-misc.el" "cedet/ede/proj-obj.el" "cedet/ede/proj-prog.el"
-;;;;;;  "cedet/ede/proj-scheme.el" "cedet/ede/proj-shared.el" "cedet/ede/proj.el"
-;;;;;;  "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/ede/files.el" "cedet/ede/linux.el" "cedet/ede/loaddefs.el"
+;;;;;;  "cedet/ede/locate.el" "cedet/ede/make.el" "cedet/ede/makefile-edit.el"
+;;;;;;  "cedet/ede/pconf.el" "cedet/ede/pmake.el" "cedet/ede/proj-archive.el"
+;;;;;;  "cedet/ede/proj-aux.el" "cedet/ede/proj-comp.el" "cedet/ede/proj-elisp.el"
+;;;;;;  "cedet/ede/proj-info.el" "cedet/ede/proj-misc.el" "cedet/ede/proj-obj.el"
+;;;;;;  "cedet/ede/proj-prog.el" "cedet/ede/proj-scheme.el" "cedet/ede/proj-shared.el"
+;;;;;;  "cedet/ede/proj.el" "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/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"
@@ -31833,13 +31846,13 @@ Zone out, completely.
 ;;;;;;  "cedet/semantic/fw.el" "cedet/semantic/grammar-wy.el" "cedet/semantic/grammar.el"
 ;;;;;;  "cedet/semantic/html.el" "cedet/semantic/ia-sb.el" "cedet/semantic/ia.el"
 ;;;;;;  "cedet/semantic/idle.el" "cedet/semantic/imenu.el" "cedet/semantic/java.el"
-;;;;;;  "cedet/semantic/lex-spp.el" "cedet/semantic/lex.el" "cedet/semantic/mru-bookmark.el"
-;;;;;;  "cedet/semantic/sb.el" "cedet/semantic/scope.el" "cedet/semantic/senator.el"
-;;;;;;  "cedet/semantic/sort.el" "cedet/semantic/symref.el" "cedet/semantic/symref/cscope.el"
-;;;;;;  "cedet/semantic/symref/filter.el" "cedet/semantic/symref/global.el"
-;;;;;;  "cedet/semantic/symref/grep.el" "cedet/semantic/symref/idutils.el"
-;;;;;;  "cedet/semantic/symref/list.el" "cedet/semantic/tag-file.el"
-;;;;;;  "cedet/semantic/tag-ls.el" "cedet/semantic/tag-write.el"
+;;;;;;  "cedet/semantic/lex-spp.el" "cedet/semantic/lex.el" "cedet/semantic/loaddefs.el"
+;;;;;;  "cedet/semantic/mru-bookmark.el" "cedet/semantic/sb.el" "cedet/semantic/scope.el"
+;;;;;;  "cedet/semantic/senator.el" "cedet/semantic/sort.el" "cedet/semantic/symref.el"
+;;;;;;  "cedet/semantic/symref/cscope.el" "cedet/semantic/symref/filter.el"
+;;;;;;  "cedet/semantic/symref/global.el" "cedet/semantic/symref/grep.el"
+;;;;;;  "cedet/semantic/symref/idutils.el" "cedet/semantic/symref/list.el"
+;;;;;;  "cedet/semantic/tag-file.el" "cedet/semantic/tag-ls.el" "cedet/semantic/tag-write.el"
 ;;;;;;  "cedet/semantic/tag.el" "cedet/semantic/texi.el" "cedet/semantic/util-modes.el"
 ;;;;;;  "cedet/semantic/util.el" "cedet/semantic/wisent.el" "cedet/semantic/wisent/comp.el"
 ;;;;;;  "cedet/semantic/wisent/java-tags.el" "cedet/semantic/wisent/javascript.el"
@@ -31851,18 +31864,18 @@ Zone out, completely.
 ;;;;;;  "cedet/srecode/el.el" "cedet/srecode/expandproto.el" "cedet/srecode/extract.el"
 ;;;;;;  "cedet/srecode/fields.el" "cedet/srecode/filters.el" "cedet/srecode/find.el"
 ;;;;;;  "cedet/srecode/getset.el" "cedet/srecode/insert.el" "cedet/srecode/java.el"
-;;;;;;  "cedet/srecode/map.el" "cedet/srecode/mode.el" "cedet/srecode/semantic.el"
-;;;;;;  "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" "ediff-diff.el" "ediff-init.el" "ediff-merg.el"
-;;;;;;  "ediff-ptch.el" "ediff-vers.el" "ediff-wind.el" "electric.el"
-;;;;;;  "emacs-lisp/assoc.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-compat.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-comp.el"
-;;;;;;  "emacs-lisp/eieio-custom.el" "emacs-lisp/eieio-datadebug.el"
+;;;;;;  "cedet/srecode/loaddefs.el" "cedet/srecode/map.el" "cedet/srecode/mode.el"
+;;;;;;  "cedet/srecode/semantic.el" "cedet/srecode/srt-wy.el" "cedet/srecode/srt.el"
+;;;;;;  "cedet/srecode/table.el" "cedet/srecode/template.el" "cedet/srecode/texi.el"
+;;;;;;  "cus-dep.el" "cus-load.el" "dframe.el" "dired-aux.el" "dired-x.el"
+;;;;;;  "dos-fns.el" "dos-vars.el" "dos-w32.el" "ediff-diff.el" "ediff-init.el"
+;;;;;;  "ediff-merg.el" "ediff-ptch.el" "ediff-vers.el" "ediff-wind.el"
+;;;;;;  "electric.el" "emacs-lisp/assoc.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-compat.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-comp.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/lmenu.el" "emacs-lisp/regi.el"
@@ -31879,18 +31892,19 @@ Zone out, completely.
 ;;;;;;  "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"
-;;;;;;  "font-setting.el" "format-spec.el" "forms-d2.el" "forms-pass.el"
-;;;;;;  "fringe.el" "generic-x.el" "gnus/auth-source.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-sum.el" "gnus/gnus-topic.el" "gnus/gnus-undo.el"
-;;;;;;  "gnus/gnus-util.el" "gnus/gnus-uu.el" "gnus/gnus-vm.el" "gnus/ietf-drums.el"
+;;;;;;  "eshell/esh-cmd.el" "eshell/esh-ext.el" "eshell/esh-groups.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" "finder-inf.el" "foldout.el" "font-setting.el"
+;;;;;;  "format-spec.el" "forms-d2.el" "forms-pass.el" "fringe.el"
+;;;;;;  "generic-x.el" "gnus/auth-source.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-sum.el"
+;;;;;;  "gnus/gnus-topic.el" "gnus/gnus-undo.el" "gnus/gnus-util.el"
+;;;;;;  "gnus/gnus-uu.el" "gnus/gnus-vm.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-encode.el"
@@ -31906,25 +31920,26 @@ Zone out, completely.
 ;;;;;;  "gnus/rfc2047.el" "gnus/rfc2104.el" "gnus/rfc2231.el" "gnus/sieve-manage.el"
 ;;;;;;  "gnus/smime.el" "gnus/spam-stat.el" "gnus/spam-wash.el" "gnus/starttls.el"
 ;;;;;;  "gnus/utf7.el" "gnus/webmail.el" "hex-util.el" "hfy-cmap.el"
-;;;;;;  "ibuf-ext.el" "international/charprop.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" "international/uni-comment.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-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" "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"
+;;;;;;  "htmlfontify.el" "ibuf-ext.el" "international/charprop.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"
+;;;;;;  "international/uni-comment.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-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" "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"
 ;;;;;;  "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"
@@ -31934,45 +31949,45 @@ Zone out, completely.
 ;;;;;;  "net/hmac-def.el" "net/hmac-md5.el" "net/imap-hash.el" "net/imap.el"
 ;;;;;;  "net/ldap.el" "net/mairix.el" "net/netrc.el" "net/newsticker.el"
 ;;;;;;  "net/ntlm.el" "net/sasl-cram.el" "net/sasl-digest.el" "net/sasl-ntlm.el"
-;;;;;;  "net/sasl.el" "net/socks.el" "net/tls.el" "net/tramp-cache.el"
-;;;;;;  "net/tramp-cmds.el" "net/tramp-compat.el" "net/tramp-fish.el"
-;;;;;;  "net/tramp-gvfs.el" "net/tramp-gw.el" "net/tramp-imap.el"
-;;;;;;  "net/tramp-smb.el" "net/tramp-uu.el" "net/trampver.el" "net/zeroconf.el"
-;;;;;;  "nxml/nxml-enc.el" "nxml/nxml-maint.el" "nxml/nxml-ns.el"
-;;;;;;  "nxml/nxml-outln.el" "nxml/nxml-parse.el" "nxml/nxml-rap.el"
-;;;;;;  "nxml/nxml-util.el" "nxml/rng-dt.el" "nxml/rng-loc.el" "nxml/rng-maint.el"
-;;;;;;  "nxml/rng-match.el" "nxml/rng-parse.el" "nxml/rng-pttrn.el"
-;;;;;;  "nxml/rng-uri.el" "nxml/rng-util.el" "nxml/xsd-regexp.el"
-;;;;;;  "org/org-bibtex.el" "org/org-colview.el" "org/org-compat.el"
-;;;;;;  "org/org-crypt.el" "org/org-datetree.el" "org/org-exp-blocks.el"
-;;;;;;  "org/org-faces.el" "org/org-gnus.el" "org/org-habit.el" "org/org-info.el"
-;;;;;;  "org/org-inlinetask.el" "org/org-install.el" "org/org-jsinfo.el"
-;;;;;;  "org/org-list.el" "org/org-mac-message.el" "org/org-macs.el"
-;;;;;;  "org/org-mew.el" "org/org-mhe.el" "org/org-mouse.el" "org/org-protocol.el"
+;;;;;;  "net/sasl.el" "net/secrets.el" "net/socks.el" "net/tls.el"
+;;;;;;  "net/tramp-cache.el" "net/tramp-cmds.el" "net/tramp-compat.el"
+;;;;;;  "net/tramp-fish.el" "net/tramp-gvfs.el" "net/tramp-gw.el"
+;;;;;;  "net/tramp-imap.el" "net/tramp-smb.el" "net/tramp-uu.el"
+;;;;;;  "net/trampver.el" "net/zeroconf.el" "nxml/nxml-enc.el" "nxml/nxml-maint.el"
+;;;;;;  "nxml/nxml-ns.el" "nxml/nxml-outln.el" "nxml/nxml-parse.el"
+;;;;;;  "nxml/nxml-rap.el" "nxml/nxml-util.el" "nxml/rng-dt.el" "nxml/rng-loc.el"
+;;;;;;  "nxml/rng-maint.el" "nxml/rng-match.el" "nxml/rng-parse.el"
+;;;;;;  "nxml/rng-pttrn.el" "nxml/rng-uri.el" "nxml/rng-util.el"
+;;;;;;  "nxml/xsd-regexp.el" "org/org-bibtex.el" "org/org-colview.el"
+;;;;;;  "org/org-compat.el" "org/org-crypt.el" "org/org-datetree.el"
+;;;;;;  "org/org-exp-blocks.el" "org/org-faces.el" "org/org-gnus.el"
+;;;;;;  "org/org-habit.el" "org/org-info.el" "org/org-inlinetask.el"
+;;;;;;  "org/org-install.el" "org/org-jsinfo.el" "org/org-list.el"
+;;;;;;  "org/org-mac-message.el" "org/org-macs.el" "org/org-mew.el"
+;;;;;;  "org/org-mhe.el" "org/org-mouse.el" "org/org-protocol.el"
 ;;;;;;  "org/org-rmail.el" "org/org-src.el" "org/org-vm.el" "org/org-w3m.el"
-;;;;;;  "org/org-wl.el" "password-cache.el" "patcomp.el" "pcvs-info.el"
-;;;;;;  "pcvs-parse.el" "pcvs-util.el" "pgg-def.el" "pgg-parse.el"
-;;;;;;  "pgg-pgp.el" "pgg-pgp5.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"
-;;;;;;  "s-region.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-history.el"
-;;;;;;  "url/url-imap.el" "url/url-methods.el" "url/url-nfs.el" "url/url-proxy.el"
-;;;;;;  "url/url-vars.el" "vc-dav.el" "vcursor.el" "vt-control.el"
-;;;;;;  "vt100-led.el" "w32-fns.el" "w32-vars.el" "x-dnd.el") (19428
-;;;;;;  55161 909254))
+;;;;;;  "org/org-wl.el" "patcomp.el" "pcvs-info.el" "pcvs-parse.el"
+;;;;;;  "pcvs-util.el" "pgg-def.el" "pgg-parse.el" "pgg-pgp.el" "pgg-pgp5.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-history.el" "url/url-imap.el" "url/url-methods.el"
+;;;;;;  "url/url-nfs.el" "url/url-proxy.el" "url/url-vars.el" "vc-dav.el"
+;;;;;;  "vcursor.el" "vt-control.el" "vt100-led.el" "w32-fns.el"
+;;;;;;  "w32-vars.el" "x-dnd.el") (19375 51700 955763))
 
 ;;;***
 \f
index 3d70c25477593655b057f44c80d083c93395d34f..4ab4b10a7c9c711ab814e4b67e6c12b1eaef03cb 100644 (file)
@@ -5,6 +5,7 @@
 ;; Author: Markus Triska <markus.triska@gmx.at>
 ;; Maintainer: FSF
 ;; Keywords: convenience
+;; Version: 0.9x
 
 ;; This file is part of GNU Emacs.
 
index 85222ce7d9e98daedbda7b79dd3f87029fd2bf92..7757a0e5b40db4d12a81dd8e112d700d0c1e03fc 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Maintainer: FSF
 ;; Keywords: internal
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
@@ -54,7 +55,7 @@
        (equal (nth 3 command-line-args) "unidata-gen.el")
        (equal (nth 4 command-line-args) "unidata-gen-files")
        ;; In case CANNOT_DUMP.
-       (equal (nth 0 command-line-args) "../src/bootstrap-emacs"))
+       (string-match "src/bootstrap-emacs" (nth 0 command-line-args)))
     (let ((dir (car load-path)))
       ;; We'll probably overflow the pure space.
       (setq purify-flag nil)
                            (expand-file-name "international" dir)
                            (expand-file-name "textmodes" dir)))))
 
+(if (eq t purify-flag)
+    ;; Hash consing saved around 11% of pure space in my tests.
+    (setq purify-flag (make-hash-table :test 'equal)))
+
 (message "Using load-path %s" load-path)
 
 (if (or (member (nth 3 command-line-args) '("dump" "bootstrap"))
       (load "dnd")
       (load "tool-bar")))
 
-(if (or (featurep 'system-font-setting) (featurep 'font-render-setting))
-    (load "font-setting"))
+(if (featurep 'dynamic-setting)
+    (load "dynamic-setting"))
 
 (if (featurep 'x)
     (progn
     (progn             ; floating pt. functions if we have float support.
       (load "emacs-lisp/float-sup")))
 
-(load "vc-hooks")
-(load "ediff-hook")
+(load "vc/vc-hooks")
+(load "vc/ediff-hook")
 (if (fboundp 'x-show-tip) (load "tooltip"))
 
 ;If you want additional libraries to be preloaded and their
 ;; At this point, we're ready to resume undo recording for scratch.
 (buffer-enable-undo "*scratch*")
 
+;; 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 (null (garbage-collect))
     (setq pure-space-overflow t))
 
            (add-name-to-file "emacs" name t)))
       (kill-emacs)))
 
-;; Avoid error if user loads some more libraries now.
-(setq purify-flag nil)
-
 ;; For machines with CANNOT_DUMP defined in config.h,
 ;; this file must be loaded each time Emacs is run.
 ;; So run the startup code now.  First, remove `-l loadup' from args.
index d0021dfed22ed1e57db201c66e5408b9ffdf31db..f1983a3e18a28c0f404bdf32e50421bf5f4a6304 100644 (file)
@@ -326,7 +326,7 @@ ARG is the interactive prefix arg."
        (locate-do-setup search-string)
        ))
     (and (not (string-equal (buffer-name) locate-buffer-name))
-       (switch-to-buffer-other-window locate-buffer-name))
+       (pop-to-buffer locate-buffer-name))
 
     (run-hooks 'dired-mode-hook)
     (dired-next-line 3)                        ;move to first matching file.
index 51b68c1ab48748c2af9fe6ea30cd5035f3913a9f..559dc5513aeb5fcfffb6edff970ece5b6b24d285 100644 (file)
@@ -291,7 +291,7 @@ The characters tab, linefeed, space, return and formfeed are not affected."
       (let (c)
        (while (re-search-forward "[\^@-\^h\^k\^n-\^_\177-\377]" nil t)
          (setq c (preceding-char))
-         (delete-backward-char 1)
+         (delete-char -1)
          (insert (if (< c ?\s)
                      (format "\\^%c" (+ c ?@))
                    (format "\\%02x" c))))))))
index 2e06155846651a75ab8b67869e579e69f951d513..4dba41e0655e58b1ccea26f7a4773c9e13a4d26a 100644 (file)
@@ -7,6 +7,7 @@
 ;; Modified by: Francis J. Wright <F.J.Wright@maths.qmw.ac.uk>
 ;; Maintainer: FSF
 ;; Keywords: unix, dired
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
@@ -235,7 +236,7 @@ that work are: A a c i r S s t u U X g G B C R n and F partly."
        (if (string-match "--dired " switches)
            (setq switches (replace-match "" nil nil switches)))
        ;; Convert SWITCHES to a list of characters.
-       (setq switches (delete ?- (append switches nil)))
+       (setq switches (delete ?\  (delete ?- (append switches nil))))
        ;; Sometimes we get ".../foo*/" as FILE.  While the shell and
        ;; `ls' don't mind, we certainly do, because it makes us think
        ;; there is no wildcard, only a directory name.
@@ -405,7 +406,11 @@ not contain `d', so that a full listing is expected."
        (setq file (substring file 0 -1)))
     (let ((fattr (file-attributes file 'string)))
       (if fattr
-         (insert (ls-lisp-format file fattr (nth 7 fattr)
+         (insert (ls-lisp-format
+                  (if (memq ?F switches)
+                      (ls-lisp-classify-file file fattr)
+                    file)
+                  fattr (nth 7 fattr)
                                  switches time-index (current-time)))
        (message "%s: doesn't exist or is inaccessible" file)
        (ding) (sit-for 2)))))          ; to show user the message!
@@ -522,29 +527,40 @@ SWITCHES is a list of characters.  Default sorting is alphabetic."
       (nreverse file-alist)
     file-alist))
 
+(defun ls-lisp-classify-file (filename fattr)
+  "Append a character to FILENAME indicating the file type.
+
+FATTR is the file attributes returned by `file-attributes' for the file.
+The file type indicators are `/' for directories, `@' for symbolic
+links, `|' for FIFOs, `=' for sockets, `*' for regular files that
+are executable, and nothing for other types of files."
+  (let* ((type (car fattr))
+        (modestr (nth 8 fattr))
+        (typestr (substring modestr 0 1)))
+    (cond
+     (type
+      (concat filename (if (eq type t) "/" "@")))
+     ((string-match "x" modestr)
+      (concat filename "*"))
+     ((string= "p" typestr)
+      (concat filename "|"))
+     ((string= "s" typestr)
+      (concat filename "="))
+     (t filename))))
+
 (defun ls-lisp-classify (filedata)
-  "Append a character to each file name indicating the file type.
-Also, for regular files that are executable, append `*'.
+  "Append a character to file name in FILEDATA indicating the file type.
+
+FILEDATA has the form (FILENAME . ATTRIBUTES), where ATTRIBUTES is the
+structure returned by `file-attributes' for that file.
+
 The file type indicators are `/' for directories, `@' for symbolic
-links, `|' for FIFOs, `=' for sockets, and nothing for regular files.
-\[But FIFOs and sockets are not recognized.]
-FILEDATA has the form (filename . `file-attributes').  Its `cadr' is t
-for directory, string (name linked to) for symbolic link, or nil."
+links, `|' for FIFOs, `=' for sockets, `*' for regular files that
+are executable, and nothing for other types of files."
   (let ((file-name (car filedata))
-        (type (cadr filedata)))
-    (cond (type
-          (cons
-           (concat (propertize file-name 'dired-filename t)
-                   (if (eq type t) "/" "@"))
-           (cdr filedata)))
-         ((string-match "x" (nth 9 filedata))
-          (cons
-           (concat (propertize file-name 'dired-filename t) "*")
-           (cdr filedata)))
-         (t
-          (cons
-           (propertize file-name 'dired-filename t)
-           (cdr filedata))))))
+        (fattr (cdr filedata)))
+    (setq file-name (propertize file-name 'dired-filename t))
+    (cons (ls-lisp-classify-file file-name fattr) fattr)))
 
 (defun ls-lisp-extension (filename)
   "Return extension of FILENAME (ignoring any version extension)
index fa45d8c6108a78adb10638a291cad9a29f137689..cbceb96fade4d84f18418147dec69fcf0c3d77f8 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Maintainer: FSF
 ;; Keywords: abbrev
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
index e131db76af88a51e78fef44dd52d939e1767919d..4d80d0213993e0b886c1860e00682ed63d6c6899 100644 (file)
@@ -221,7 +221,8 @@ If HEADER-ONLY is non-nil only decode header and return filename."
          (goto-char start)
          (when (re-search-forward binhex-begin-line end t)
             (setq work-buffer (generate-new-buffer " *binhex-work*"))
-            (with-current-buffer work-buffer (set-buffer-multibyte nil))
+           (unless (featurep 'xemacs)
+             (with-current-buffer work-buffer (set-buffer-multibyte nil)))
            (beginning-of-line)
            (setq bits 0 counter 0)
            (while tmp
index 4520ea61d03f6e11716ca0ec223563ec9d360ca5..545350170ecd1de9a3205e2262ade13e4c37e8a7 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Maintainer: FSF
 ;; Keywords: internal
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
index 5dddf00fd71ac81a1a5b16569a75d990f54be6c0..b3ec3fb4850e080598f89c3980d75be86516b916 100644 (file)
@@ -7,6 +7,7 @@
 ;; Author: K. Shane Hartman
 ;; Maintainer: FSF
 ;; Keywords: maint mail
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
   :group 'maint
   :group 'mail)
 
+(define-obsolete-variable-alias 'report-emacs-bug-pretest-address
+  'report-emacs-bug-address "24.1")
+
 (defcustom report-emacs-bug-address "bug-gnu-emacs@gnu.org"
   "Address of mailing list for GNU Emacs bugs."
   :group 'emacsbug
   :type 'string)
 
-(defcustom report-emacs-bug-pretest-address "bug-gnu-emacs@gnu.org"
-  "Address of mailing list for GNU Emacs pretest bugs."
-  :group 'emacsbug
-  :type 'string
-  :version "23.2")                ; emacs-pretest-bug -> bug-gnu-emacs
-
 (defcustom report-emacs-bug-no-confirmation nil
   "If non-nil, suppress the confirmations asked for the sake of novice users."
   :group 'emacsbug
 (declare-function x-server-vendor "xfns.c" (&optional terminal))
 (declare-function x-server-version "xfns.c" (&optional terminal))
 (declare-function message-sort-headers "message" ())
+(defvar message-strip-special-text-properties)
+
+(defun report-emacs-bug-can-use-xdg-email ()
+  "Check if xdg-email can be used, i.e. we are on Gnome, KDE or xfce4."
+  (and (getenv "DISPLAY")
+       (executable-find "xdg-email")
+       (or (getenv "GNOME_DESKTOP_SESSION_ID")
+          ;; GNOME_DESKTOP_SESSION_ID is deprecated, check on Dbus also.
+          (condition-case nil
+              (eq 0 (call-process
+                     "dbus-send" nil nil nil
+                                 "--dest=org.gnome.SessionManager"
+                                 "--print-reply"
+                                 "/org/gnome/SessionManager"
+                                 "org.gnome.SessionManager.CanShutdown"))
+            (error nil))
+          (equal (getenv "KDE_FULL_SESSION") "true")
+          (condition-case nil
+              (eq 0 (call-process
+                     "/bin/sh" nil nil nil
+                     "-c"
+                     "xprop -root _DT_SAVE_MODE|grep xfce4"))
+            (error nil)))))
+
+(defun report-emacs-bug-insert-to-mailer ()
+  (interactive)
+  (save-excursion
+    (let* ((to (progn
+                (goto-char (point-min))
+                (forward-line)
+                (and (looking-at "^To: \\(.*\\)")
+                     (match-string-no-properties 1))))
+          (subject (progn
+                     (forward-line)
+                     (and (looking-at "^Subject: \\(.*\\)")
+                          (match-string-no-properties 1))))
+          (body (progn
+                  (forward-line 2)
+                  (if (> (point-max) (point))
+                      (buffer-substring-no-properties (point) (point-max))))))
+      (if (and to subject body)
+         (start-process "xdg-email" nil "xdg-email"
+                        "--subject" subject
+                        "--body" body
+                        (concat "mailto:" to))
+       (error "Subject, To or body not found")))))
+
 
 ;;;###autoload
 (defun report-emacs-bug (topic &optional recent-keys)
@@ -89,32 +134,26 @@ Prompts for bug subject.  Leaves you in a mail buffer."
       (setq topic (concat emacs-version "; " topic))
     (when (string-match "^\\(\\([.0-9]+\\)*\\)\\.[0-9]+$" emacs-version)
       (setq topic (concat (match-string 1 emacs-version) "; " topic))))
-  ;; If there are four numbers in emacs-version (three for MS-DOS),
-  ;; this is a pretest version.
-  (let* ((pretest-p (string-match (if (eq system-type 'ms-dos)
-                                     "\\..*\\."
-                                   "\\..*\\..*\\.")
-                                 emacs-version))
-        (from-buffer (current-buffer))
-        (reporting-address (if pretest-p
-                               report-emacs-bug-pretest-address
-                             report-emacs-bug-address))
-        ;; Put these properties on semantically-void text.
-        ;; report-emacs-bug-hook deletes these regions before sending.
-        (prompt-properties '(field emacsbug-prompt
-                                   intangible but-helpful
-                                   rear-nonsticky t))
-        user-point message-end-point)
+  (let ((from-buffer (current-buffer))
+        ;; Put these properties on semantically-void text.
+        ;; report-emacs-bug-hook deletes these regions before sending.
+        (prompt-properties '(field emacsbug-prompt
+                                   intangible but-helpful
+                                   rear-nonsticky t))
+       (can-xdg-email (report-emacs-bug-can-use-xdg-email))
+        user-point message-end-point)
     (setq message-end-point
          (with-current-buffer (get-buffer-create "*Messages*")
            (point-max-marker)))
-    (compose-mail reporting-address topic)
+    (compose-mail report-emacs-bug-address topic)
     ;; The rest of this does not execute if the user was asked to
     ;; confirm and said no.
-    ;; Message-mode sorts the headers before sending.  We sort now so
-    ;; that report-emacs-bug-orig-text remains valid.  (Bug#5178)
-    (if (eq major-mode 'message-mode)
-        (message-sort-headers))
+    (when (eq major-mode 'message-mode)
+      ;; Message-mode sorts the headers before sending.  We sort now so
+      ;; that report-emacs-bug-orig-text remains valid.  (Bug#5178)
+      (message-sort-headers)
+      ;; Stop message-mode stealing the properties we will add.
+      (set (make-local-variable 'message-strip-special-text-properties) nil))
     (rfc822-goto-eoh)
     (forward-line 1)
     (let ((signature (buffer-substring (point) (point-max))))
@@ -123,7 +162,7 @@ Prompts for bug subject.  Leaves you in a mail buffer."
       (backward-char (length signature)))
     (unless report-emacs-bug-no-explanations
       ;; Insert warnings for novice users.
-      (when (string-match "@gnu\\.org$" reporting-address)
+      (when (string-match "@gnu\\.org$" report-emacs-bug-address)
        (insert "This bug report will be sent to the Free Software Foundation,\n")
        (let ((pos (point)))
          (insert "not to your local site managers!")
@@ -135,17 +174,12 @@ Prompts for bug subject.  Leaves you in a mail buffer."
       (insert " if possible, because the Emacs maintainers
 usually do not have translators to read other languages for them.\n\n")
       (insert (format "Your bug report will be posted to the %s mailing list"
-                     reporting-address))
-      ;; Nowadays all bug reports end up there.
-;;;      (if pretest-p (insert ".\n\n")
+                     report-emacs-bug-address))
        (insert ",\nand to the gnu.emacs.bug news group.\n\n"))
 
     (insert "Please describe exactly what actions triggered the bug\n"
            "and the precise symptoms of the bug.  If you can, give\n"
            "a recipe starting from `emacs -Q':\n\n")
-    ;; Stop message-mode stealing the properties we are about to add.
-    (if (boundp 'message-strip-special-text-properties)
-        (set (make-local-variable 'message-strip-special-text-properties) nil))
     (add-text-properties (save-excursion
                            (rfc822-goto-eoh)
                            (line-beginning-position 2))
@@ -240,6 +274,9 @@ usually do not have translators to read other languages for them.\n\n")
     ;; 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)
+    (if can-xdg-email
+       (define-key (current-local-map) "\C-cm"
+         'report-emacs-bug-insert-to-mailer))
     ;; Could test major-mode instead.
     (cond ((memq mail-user-agent '(message-user-agent gnus-user-agent))
            (setq report-emacs-bug-send-command "message-send-and-exit"
@@ -259,6 +296,9 @@ usually do not have translators to read other languages for them.\n\n")
                             report-emacs-bug-send-command))))
        (princ (substitute-command-keys
                "  Type \\[kill-buffer] RET to cancel (don't send it).\n"))
+       (if can-xdg-email
+           (princ (substitute-command-keys
+                   "  Type \\[report-emacs-bug-insert-to-mailer] to insert text to you preferred mail program.\n")))
        (terpri)
        (princ (substitute-command-keys
                "  Type \\[report-emacs-bug-info] to visit in Info the Emacs Manual section
index 86364ab7835ce03c19fcf6978ce1a5325c43378a..c7b48cf78edd7d1cd3fcfe1d6f29d407aa383373 100644 (file)
@@ -1,6 +1,7 @@
 ;;; hashcash.el --- Add hashcash payments to email
 
-;; Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009, 2010  Free Software Foundation
+;; Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009, 2010
+;;   Free Software Foundation
 
 ;; Written by: Paul Foley <mycroft@actrix.gen.nz> (1997-2002)
 ;; Maintainer: Paul Foley <mycroft@actrix.gen.nz>
@@ -115,8 +116,6 @@ For example, you may want to set this to '(\"-Z2\") to reduce header length."
 (require 'mail-utils)
 
 (eval-and-compile
-  (unless (fboundp 'declare-function) (defmacro declare-function (&rest r)))
-
   (if (fboundp 'point-at-bol)
       (defalias 'hashcash-point-at-bol 'point-at-bol)
     (defalias 'hashcash-point-at-bol 'line-beginning-position))
@@ -131,10 +130,10 @@ For example, you may want to set this to '(\"-Z2\") to reduce header length."
       (concat (match-string 1 addr) (match-string 2 addr))
     addr))
 
-(declare-function  message-narrow-to-headers-or-head "message" ())
-(declare-function  message-fetch-field "message" (header &optional not-all))
-(declare-function  message-goto-eoh "message" ())
-(declare-function  message-narrow-to-headers "message" ())
+(declare-function message-narrow-to-headers-or-head "message" ())
+(declare-function message-fetch-field "message" (header &optional not-all))
+(declare-function message-goto-eoh "message" ())
+(declare-function message-narrow-to-headers "message" ())
 
 (defun hashcash-token-substring ()
   (save-excursion
@@ -287,7 +286,7 @@ BUFFER defaults to the current buffer."
   "Ask user whether to wait for hashcash processes to finish."
   (interactive)
   (when (hashcash-processes-running-p (current-buffer))
-    (if (y-or-n-p 
+    (if (y-or-n-p
          "Hashcash process(es) still running; wait for them to finish? ")
        (hashcash-wait-async)
       (hashcash-cancel-async))))
index 51c490da7abe171753d1337af2a1143bd4a981a2..342d735c93920872c58270b24b9c686db6a66802 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Joe Wells <jbw@cs.bu.edu>
 ;; Maintainer: FSF
 ;; Keywords: mail
+;; Package: mail-utils
 
 ;; This file is part of GNU Emacs.
 
index 6700d6d2733425e826ce03657ba1d255987a081f..f129f29ea330ffd2f7af88f25cba9e6400c2daa1 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Karl Fogel <kfogel@red-bean.com>
 ;; Created: March, 1994
 ;; Keywords: mail, history
+;; Package: mail-utils
 
 ;; This file is part of GNU Emacs.
 
index 44967b05bc8d90f106b085d0f8d8392094704aa9..960d3c6548783a543d99e5334504e0c36ace1cbf 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Author: Erik Naggum <erik@naggum.no>
 ;; Keywords: tools, mail, news
+;; Package: mail-utils
 
 ;; This file is part of GNU Emacs.
 
index 64c7c57f8db6c416727b8ec5f78ad77759d49f35..47326b636a12490caee89390cf12b56e75992c73 100644 (file)
@@ -40,7 +40,6 @@
 (defgroup metamail nil
   "Metamail interface for Emacs."
   :group 'mail
-  :group 'hypermedia
   :group 'processes)
 
 (defcustom metamail-program-name "metamail"
index a3eee899a688c6c79547acf653a9eecba8fba6a4..33f3be30cc28b892112f1275fe3ef1fdb7297ca4 100644 (file)
@@ -4,6 +4,7 @@
 ;;   Free Software Foundation, Inc.
 ;; Keywords: email, spam, filter, rmail
 ;; Author: Eli Tziperman <eli AT deas.harvard.edu>
+;; Package: rmail
 
 ;; This file is part of GNU Emacs.
 
index fa0b7bef20799a71b84afba5f73eabbb5c4d9e87..07ea7cc0d256556b83d6a88123ef4da30fe048a0 100644 (file)
@@ -4239,7 +4239,7 @@ encoded string (and the same mask) will decode the string."
 ;;; Start of automatically extracted autoloads.
 \f
 ;;;### (autoloads (rmail-edit-current-message) "rmailedit" "rmailedit.el"
-;;;;;;  "60db8013bf16d7999914a16cda435287")
+;;;;;;  "4bf8a5cdfc921b9e30680ee71b7f9ca6")
 ;;; Generated autoloads from rmailedit.el
 
 (autoload 'rmail-edit-current-message "rmailedit" "\
@@ -4251,7 +4251,7 @@ Edit the contents of this message.
 \f
 ;;;### (autoloads (rmail-next-labeled-message rmail-previous-labeled-message
 ;;;;;;  rmail-read-label rmail-kill-label rmail-add-label) "rmailkwd"
-;;;;;;  "rmailkwd.el" "7027ce1ac922c0dd51262b641e4d42c1")
+;;;;;;  "rmailkwd.el" "112240cbb53c402294013cc49987771a")
 ;;; Generated autoloads from rmailkwd.el
 
 (autoload 'rmail-add-label "rmailkwd" "\
@@ -4294,7 +4294,7 @@ With prefix argument N moves forward N messages with these labels.
 
 ;;;***
 \f
-;;;### (autoloads (rmail-mime) "rmailmm" "rmailmm.el" "4a7502b4aeb3bd5f2111b48cc6512924")
+;;;### (autoloads (rmail-mime) "rmailmm" "rmailmm.el" "9f67f3b67de9b700b128b73c52abfefa")
 ;;; Generated autoloads from rmailmm.el
 
 (autoload 'rmail-mime "rmailmm" "\
@@ -4310,7 +4310,7 @@ attachments as specfied by `rmail-mime-attachment-dirs-alist'.
 ;;;***
 \f
 ;;;### (autoloads (set-rmail-inbox-list) "rmailmsc" "rmailmsc.el"
-;;;;;;  "b2a72d4e370f2d2b31b6f8f0794820e4")
+;;;;;;  "c3575020691d5769bcf08ecc932304c3")
 ;;; Generated autoloads from rmailmsc.el
 
 (autoload 'set-rmail-inbox-list "rmailmsc" "\
@@ -4326,7 +4326,7 @@ This applies only to the current session.
 \f
 ;;;### (autoloads (rmail-sort-by-labels rmail-sort-by-lines rmail-sort-by-correspondent
 ;;;;;;  rmail-sort-by-recipient rmail-sort-by-author rmail-sort-by-subject
-;;;;;;  rmail-sort-by-date) "rmailsort" "rmailsort.el" "5a3b5ee477d2fbf79d0c566d776a7fd4")
+;;;;;;  rmail-sort-by-date) "rmailsort" "rmailsort.el" "b96e85edd736f23f1e9d54a299268d1e")
 ;;; Generated autoloads from rmailsort.el
 
 (autoload 'rmail-sort-by-date "rmailsort" "\
@@ -4385,7 +4385,7 @@ If prefix argument REVERSE is non-nil, sorts in reverse order.
 \f
 ;;;### (autoloads (rmail-summary-by-senders rmail-summary-by-topic
 ;;;;;;  rmail-summary-by-regexp rmail-summary-by-recipients rmail-summary-by-labels
-;;;;;;  rmail-summary) "rmailsum" "rmailsum.el" "26b95919c7e1f8c5609ce7323aee77ae")
+;;;;;;  rmail-summary) "rmailsum" "rmailsum.el" "4715fb58fb191bf6b192458ea75524b2")
 ;;; Generated autoloads from rmailsum.el
 
 (autoload 'rmail-summary "rmailsum" "\
index d01773fe6c94627182540ca4f90c2d8ab65c6756..02f36fd47e74da1e196b48754dbaeb1b8d47288b 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Maintainer: FSF
 ;; Keywords: mail
+;; Package: rmail
 
 ;; This file is part of GNU Emacs.
 
index 5b9b95e5bbbbabc03db4bed0beb7b7d24f9e7250..5c44b5cafa2847d645fc0b5f3ff0012b5bcb79dc 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Maintainer: FSF
 ;; Keywords: mail
+;; Package: rmail
 
 ;; This file is part of GNU Emacs.
 
index e8ca11ee349d345658c31492dce5d001a596d838..3882c9e47c8fec6aa721c89c15447050b3aa5e4e 100644 (file)
@@ -6,6 +6,7 @@
 ;;     Alex Schroeder
 ;; Maintainer: FSF
 ;; Keywords: mail
+;; Package: rmail
 
 ;; This file is part of GNU Emacs.
 
index fe8a627fe6beed5db7d08fdd82f460f56e92945b..bbb8233d89c8113b39fb7157bab6e2d5b59427be 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Maintainer: FSF
 ;; Keywords: mail
+;; Package: rmail
 
 ;; This file is part of GNU Emacs.
 
index a6ff75e4efef78252a956fb459deca79622dc2f4..93d512336dc3b9fafdae33e50929afd416562168 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Maintainer: FSF
 ;; Keywords: mail
+;; Package: rmail
 
 ;; This file is part of GNU Emacs.
 
index f44f36bd5ee8707632cbca82940e14f04bcfed7e..f4fd52c10c7822b12cf2b98d4379f591e2c8f3fe 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Masanobu UMEDA <umerin@mse.kyutech.ac.jp>
 ;; Maintainer: FSF
 ;; Keywords: mail
+;; Package: rmail
 
 ;; This file is part of GNU Emacs.
 
index 80c65cdfb573ad27a8bf99ae3c77dba3bcc4846b..0b8abbca6a5bde010128150a46e5d7aa69bec784 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Maintainer: FSF
 ;; Keywords: mail
+;; Package: rmail
 
 ;; This file is part of GNU Emacs.
 
index f3636c6504faf92f87d99a7b6de7162f56cf2f98..1660721fe216f0a3e32a0f6d0df4e6f72e264563 100644 (file)
@@ -34,7 +34,6 @@
 
 \f
 (require 'regi)
-(require 'sendmail)    ;; For mail-header-end.
 
 ;; start user configuration variables
 ;; vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
@@ -1484,18 +1483,22 @@ non-nil."
   "Does nothing.  Use this instead of nil to get a blank header."
   ())
 
-(defun sc-no-blank-line-or-header()
+(declare-function mh-in-header-p "mh-utils" ())
+
+(defun sc-no-blank-line-or-header ()
   "Similar to `sc-no-header' except it removes the preceding blank line."
-  (if (not (bobp))
-      (if (and (eolp)
-              (progn (forward-line -1)
-                     (or (= (point) (mail-header-end))
-                         (and (eq major-mode 'mh-letter-mode)
-                              (with-no-warnings
-                                (mh-in-header-p))))))
-         (progn (forward-line)
-                (let ((kill-lines-magic t))
-                  (kill-line))))))
+  (and (not (bobp))
+       (eolp)
+       (progn (forward-line -1)
+             (or (= (point)
+                    (save-excursion
+                      (rfc822-goto-eoh)
+                      (line-beginning-position 2)))
+                 (and (eq major-mode 'mh-letter-mode)
+                      (mh-in-header-p))))
+       (progn
+        (forward-line)
+        (kill-line))))
 
 (defun sc-header-on-said ()
   "\"On <date>, <from> said:\" unless:
@@ -1616,21 +1619,20 @@ error occurs."
               (cadr err) sc-eref-style)
              (beep))))))
 
-(defun sc-electric-mode (&optional arg)
-  "
-Mode for viewing Supercite reference headers.  Commands are:
+(defun sc-electric-mode (&optional style)
+  "Mode for viewing Supercite reference headers.  Commands are:
 \n\\{sc-electric-mode-map}
 
 `sc-electric-mode' is not intended to be run interactively, but rather
 accessed through Supercite's electric reference feature.  See
-`sc-insert-reference' for more details.  Optional ARG is the initial
+`sc-insert-reference' for more details.  Optional STYLE is the initial
 header style to use, unless not supplied or invalid, in which case
 `sc-preferred-header-style' is used."
 
   (let ((info sc-mail-info))
 
     (setq sc-eref-style
-         (or (sc-valid-index-p arg)
+         (or (sc-valid-index-p style)
              (sc-valid-index-p sc-preferred-header-style)
              0))
 
index 335e1e10c473141cb9e84d8f2787f8d26198dd85..b1c2a7be41d5d661416c7f17d047e71a8816890b 100644 (file)
@@ -216,7 +216,7 @@ If FILE-NAME is non-nil, save the result to FILE-NAME."
          (skip-chars-forward non-data-chars end))
        (if file-name
             (with-temp-file file-name
-              (set-buffer-multibyte nil)
+              (unless (featurep 'xemacs) (set-buffer-multibyte nil))
               (insert (apply 'concat (nreverse result))))
          (or (markerp end) (setq end (set-marker (make-marker) end)))
          (goto-char start)
index aebb8b352e71fe61a4e5f6416fa175320002d75c..df997b7658522b8483d4059b4d8ad900051b624c 100644 (file)
@@ -32,10 +32,9 @@ srcdir = $(CURDIR)/..
 
 EMACS = $(THISDIR)/../bin/emacs.exe
 
-# Command line flags for Emacs.  This must include --multibyte,
-# otherwise some files will not compile.
+# Command line flags for Emacs.
 
-EMACSOPT = -batch --no-init-file --no-site-file --multibyte
+EMACSOPT = -batch --no-init-file --no-site-file
 
 # Extra flags to pass to the byte compiler
 BYTE_COMPILE_EXTRA_FLAGS =
@@ -114,7 +113,8 @@ WINS_BASIC=\
        play \
        progmodes \
        textmodes \
-       url
+       url \
+       vc
 
 # Directories with lisp files to compile, and to extract data from
 # (customs, autoloads, etc.)
index 658c1ebbcef6955c8a906e69ee9397154bec0f45..88d1aa7c604f88ae77e6c9d1c94e98d4ece92cd1 100644 (file)
@@ -221,6 +221,11 @@ the associated section number."
   :type '(repeat string)
   :group 'man)
 
+(defcustom Man-name-local-regexp (concat "^" (regexp-opt '("NOM" "NAME")) "$")
+  "Regexp that matches the text that precedes the command's name.
+Used in `bookmark-set' to get the default bookmark name."
+  :type 'string :group 'bookmark)
+
 (defvar manual-program "man"
   "The name of the program that produces man pages.")
 
@@ -886,7 +891,8 @@ names or descriptions.  The pattern argument is usually an
     (man man-args)))
 
 (defun Man-getpage-in-background (topic)
-  "Use TOPIC to build and fire off the manpage and cleaning command."
+  "Use TOPIC to build and fire off the manpage and cleaning command.
+Return the buffer in which the manpage will appear."
   (let* ((man-args topic)
         (bufname (concat "*Man " man-args "*"))
         (buffer  (get-buffer bufname)))
@@ -964,15 +970,16 @@ names or descriptions.  The pattern argument is usually an
                           (format "exited abnormally with code %d"
                                   exit-status)))
                (setq msg exit-status))
-           (Man-bgproc-sentinel bufname msg)))))))
+           (Man-bgproc-sentinel bufname msg)))))
+    buffer))
 
 (defun Man-notify-when-ready (man-buffer)
   "Notify the user when MAN-BUFFER is ready.
 See the variable `Man-notify-method' for the different notification behaviors."
   (let ((saved-frame (with-current-buffer man-buffer
                       Man-original-frame)))
-    (cond
-     ((eq Man-notify-method 'newframe)
+    (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
@@ -983,28 +990,27 @@ See the variable `Man-notify-method' for the different notification behaviors."
           (set-window-dedicated-p (frame-selected-window frame) t)
          (or (display-multi-frame-p frame)
              (select-frame frame)))))
-     ((eq Man-notify-method 'pushy)
+     (pushy
       (switch-to-buffer man-buffer))
-     ((eq Man-notify-method 'bully)
+     (bully
       (and (frame-live-p saved-frame)
           (select-frame saved-frame))
       (pop-to-buffer man-buffer)
       (delete-other-windows))
-     ((eq Man-notify-method 'aggressive)
+     (aggressive
       (and (frame-live-p saved-frame)
           (select-frame saved-frame))
       (pop-to-buffer man-buffer))
-     ((eq Man-notify-method 'friendly)
+     (friendly
       (and (frame-live-p saved-frame)
           (select-frame saved-frame))
       (display-buffer man-buffer 'not-this-window))
-     ((eq Man-notify-method 'polite)
+     (polite
       (beep)
       (message "Manual buffer %s is ready" (buffer-name man-buffer)))
-     ((eq Man-notify-method 'quiet)
+     (quiet
       (message "Manual buffer %s is ready" (buffer-name man-buffer)))
-     ((or (eq Man-notify-method 'meek)
-         t)
+     (t ;; meek
       (message ""))
      )))
 
@@ -1272,6 +1278,8 @@ manpage command."
 ;; ======================================================================
 ;; set up manual mode in buffer and build alists
 
+(defvar bookmark-make-record-function)
+
 (put 'Man-mode 'mode-class 'special)
 
 (defun Man-mode ()
@@ -1328,6 +1336,8 @@ The following key bindings are currently in effect in the buffer:
   (setq imenu-generic-expression (list (list nil Man-heading-regexp 0)))
   (set (make-local-variable 'outline-regexp) Man-heading-regexp)
   (set (make-local-variable 'outline-level) (lambda () 1))
+  (set (make-local-variable 'bookmark-make-record-function)
+       'Man-bookmark-make-record)
   (Man-build-page-list)
   (Man-strip-page-headers)
   (Man-unindent)
@@ -1662,6 +1672,46 @@ Specify which REFERENCE to use; default is based on word at point."
                  (setq path nil))
         (setq complete-path nil)))
     complete-path))
+
+;;; Bookmark Man Support
+(declare-function bookmark-make-record-default
+                  "bookmark" (&optional no-file no-context posn))
+(declare-function bookmark-prop-get "bookmark" (bookmark prop))
+(declare-function bookmark-default-handler "bookmark" (bmk))
+(declare-function bookmark-get-bookmark-record "bookmark" (bmk))
+
+(defun Man-default-bookmark-title ()
+  "Default bookmark name for Man or WoMan pages.
+Uses `Man-name-local-regexp'."
+  (save-excursion
+    (goto-char (point-min))
+    (when (re-search-forward Man-name-local-regexp nil t)
+      (skip-chars-forward "\n\t ")
+      (buffer-substring-no-properties (point) (line-end-position)))))
+
+(defun Man-bookmark-make-record ()
+  "Make a bookmark entry for a Man buffer."
+  `(,(Man-default-bookmark-title)
+    ,@(bookmark-make-record-default 'no-file)
+    (location . ,(concat "man " Man-arguments))
+    (man-args . ,Man-arguments)
+    (handler . Man-bookmark-jump)))
+
+;;;###autoload
+(defun Man-bookmark-jump (bookmark)
+  "Default bookmark handler for Man buffers."
+  (let* ((man-args (bookmark-prop-get bookmark 'man-args))
+         ;; Let bookmark.el do the window handling.
+         ;; This let-binding needs to be active during the call to both
+         ;; Man-getpage-in-background and accept-process-output.
+         (Man-notify-method 'meek)
+         (buf (Man-getpage-in-background man-args))
+         (proc (get-buffer-process buf)))
+    (while (and proc (eq (process-status proc) 'run))
+      (accept-process-output proc))
+    (bookmark-default-handler
+     `("" (buffer . ,buf) . ,(bookmark-get-bookmark-record bookmark)))))
+
 \f
 ;; Init the man package variables, if not already done.
 (Man-init-defvars)
index 2424647a73fb93a5c10d2e5459e79612e09607ae..6149fea4769c2592c97ce702e4cb98b34a6c831c 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: RMS
 ;; Maintainer: FSF
 ;; Keywords: internal, mouse
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
                            ;; Emacs compiled --without-x doesn't have
                            ;; x-selection-exists-p.
                            (and (fboundp 'x-selection-exists-p)
-                                (x-selection-exists-p))
+                                (x-selection-exists-p 'CLIPBOARD))
                            kill-ring)
                           (not buffer-read-only))
              :help ,(purecopy "Paste (yank) text most recently cut/copied")))
   "Make CUT, PASTE and COPY (keys and menu bar items) use the clipboard.
 Do the same for the keys of the same name."
   (interactive)
-  ;; We can't use constant list structure here because it becomes pure,
-  ;; and because it gets modified with cache data.
-  (define-key menu-bar-edit-menu [paste]
-    (cons "Paste" (cons "Paste text from clipboard" 'clipboard-yank)))
-  (define-key menu-bar-edit-menu [copy]
-    (cons "Copy" (cons "Copy text in region to the clipboard"
-                      'clipboard-kill-ring-save)))
-  (define-key menu-bar-edit-menu [cut]
-    (cons "Cut" (cons "Delete text in region and copy it to the clipboard"
-                     'clipboard-kill-region)))
-
   ;; These are Sun server keysyms for the Cut, Copy and Paste keys
   ;; (also for XFree86 on Sun keyboard):
   (define-key global-map [f20] 'clipboard-kill-region)
@@ -703,6 +693,10 @@ by \"Save Options\" in Custom buffers.")
     (when need-save
       (custom-save-all))))
 
+(define-key menu-bar-options-menu [package]
+  '(menu-item "Manage Emacs Packages" package-list-packages
+             :help "Install or uninstall additional Emacs packages"))
+
 (define-key menu-bar-options-menu [save]
   `(menu-item ,(purecopy "Save Options") menu-bar-options-save
              :help ,(purecopy "Save options set from the menu above")))
@@ -975,11 +969,100 @@ mail status in mode line"))
              :help ,(purecopy "Turn menu-bar on/off")
              :button (:toggle . (> (frame-parameter nil 'menu-bar-lines) 0))))
 
-(define-key menu-bar-showhide-menu [showhide-tool-bar]
-  `(menu-item ,(purecopy "Tool-bar") toggle-tool-bar-mode-from-frame
-             :help ,(purecopy "Turn tool-bar on/off")
-             :visible (display-graphic-p)
-             :button (:toggle . (> (frame-parameter nil 'tool-bar-lines) 0))))
+(defun menu-bar-set-tool-bar-position (position)
+  (customize-set-variable 'tool-bar-mode t)
+  (dolist (frame (frame-list))
+    (set-frame-parameter frame 'tool-bar-position position))
+  (customize-set-variable 'default-frame-alist
+                         (cons (cons 'tool-bar-position position)
+                               (assq-delete-all 'tool-bar-position
+                                                default-frame-alist))))
+
+(defun menu-bar-showhide-tool-bar-menu-customize-disable ()
+  "Do not display tool bars."
+  (interactive)
+  (customize-set-variable 'tool-bar-mode nil))
+(defun menu-bar-showhide-tool-bar-menu-customize-enable-left ()
+  "Display tool bars on the left side."
+  (interactive)
+  (menu-bar-set-tool-bar-position 'left))
+
+(defun menu-bar-showhide-tool-bar-menu-customize-enable-right ()
+  "Display tool bars on the right side."
+  (interactive)
+  (menu-bar-set-tool-bar-position 'right))
+(defun menu-bar-showhide-tool-bar-menu-customize-enable-top ()
+  "Display tool bars on the top side."
+  (interactive)
+  (menu-bar-set-tool-bar-position 'top))
+(defun menu-bar-showhide-tool-bar-menu-customize-enable-bottom ()
+  "Display tool bars on the bottom side."
+  (interactive)
+  (menu-bar-set-tool-bar-position 'bottom))
+
+(if (featurep 'move-toolbar)
+    (progn
+      (defvar menu-bar-showhide-tool-bar-menu (make-sparse-keymap "Tool-bar"))
+
+      (define-key menu-bar-showhide-tool-bar-menu [showhide-tool-bar-left]
+       `(menu-item ,(purecopy "On the left") 
+                   menu-bar-showhide-tool-bar-menu-customize-enable-left
+                   :help ,(purecopy "Tool-bar at the left side")
+                   :visible (display-graphic-p)
+                   :button 
+                   (:radio . (and tool-bar-mode 
+                                  (eq (frame-parameter nil 'tool-bar-position)
+                                      'left)))))
+
+      (define-key menu-bar-showhide-tool-bar-menu [showhide-tool-bar-right]
+       `(menu-item ,(purecopy "On the right") 
+                   menu-bar-showhide-tool-bar-menu-customize-enable-right
+                   :help ,(purecopy "Tool-bar at the right side")
+                   :visible (display-graphic-p)
+                   :button
+                   (:radio . (and tool-bar-mode 
+                                  (eq (frame-parameter nil 'tool-bar-position)
+                                      'right)))))
+
+      (define-key menu-bar-showhide-tool-bar-menu [showhide-tool-bar-bottom]
+       `(menu-item ,(purecopy "On the bottom") 
+                   menu-bar-showhide-tool-bar-menu-customize-enable-bottom
+                   :help ,(purecopy "Tool-bar at the bottom")
+                   :visible (display-graphic-p)
+                   :button
+                   (:radio . (and tool-bar-mode 
+                                  (eq (frame-parameter nil 'tool-bar-position)
+                                      'bottom)))))
+
+      (define-key menu-bar-showhide-tool-bar-menu [showhide-tool-bar-top]
+       `(menu-item ,(purecopy "On the top") 
+                   menu-bar-showhide-tool-bar-menu-customize-enable-top
+                   :help ,(purecopy "Tool-bar at the top")
+                   :visible (display-graphic-p)
+                   :button
+                   (:radio . (and tool-bar-mode 
+                                  (eq (frame-parameter nil 'tool-bar-position)
+                                      'top)))))
+
+      (define-key menu-bar-showhide-tool-bar-menu [showhide-tool-bar-none]
+       `(menu-item ,(purecopy "None") 
+                   menu-bar-showhide-tool-bar-menu-customize-disable
+                   :help ,(purecopy "Turn tool-bar off")
+                   :visible (display-graphic-p)
+                   :button (:radio . (eq tool-bar-mode nil))))
+
+      (define-key menu-bar-showhide-menu [showhide-tool-bar]
+       `(menu-item ,(purecopy "Tool-bar") ,menu-bar-showhide-tool-bar-menu
+                   :visible (display-graphic-p)))
+
+      )
+  ;; else not tool bar that can move.
+  (define-key menu-bar-showhide-menu [showhide-tool-bar]
+    `(menu-item ,(purecopy "Tool-bar") toggle-tool-bar-mode-from-frame
+               :help ,(purecopy "Turn tool-bar on/off")
+               :visible (display-graphic-p)
+               :button (:toggle . (> (frame-parameter nil 'tool-bar-lines) 0))))
+)
 
 (define-key menu-bar-options-menu [showhide]
   `(menu-item ,(purecopy "Show/Hide") ,menu-bar-showhide-menu))
@@ -1055,7 +1138,7 @@ mail status in mode line"))
 (define-key menu-bar-options-menu [cua-emulation-mode]
   (menu-bar-make-mm-toggle cua-mode
                           "Shift movement mark region (CUA)"
-                          "Use shifted movement keys to set and extend the region."
+                          "Use shifted movement keys to set and extend the region"
                           (:visible (and (boundp 'cua-enable-cua-keys)
                                          (not cua-enable-cua-keys)))))
 
@@ -1403,6 +1486,9 @@ mail status in mode line"))
 (define-key menu-bar-describe-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-bar-describe-menu [describe-package]
+  `(menu-item ,(purecopy "Describe Package...") describe-package
+              :help ,(purecopy "Display documentation of a Lisp package")))
 (define-key menu-bar-describe-menu [describe-face]
   `(menu-item ,(purecopy "Describe Face...") describe-face
               :help ,(purecopy "Display the properties of a face")))
@@ -1534,11 +1620,11 @@ key, a click, or a menu-item")))
 (define-key menu-bar-help-menu [sep2]
   menu-bar-separator)
 (define-key menu-bar-help-menu [external-packages]
-  `(menu-item ,(purecopy "External Packages") menu-bar-help-extra-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-bar-help-menu [find-emacs-packages]
-  `(menu-item ,(purecopy "Find Emacs Packages") finder-by-keyword
-             :help ,(purecopy "Find packages and features by keyword")))
+  `(menu-item ,(purecopy "Search Built-in Packages") finder-by-keyword
+             :help ,(purecopy "Find built-in packages and features by keyword")))
 (define-key menu-bar-help-menu [more-manuals]
   `(menu-item ,(purecopy "More Manuals") ,menu-bar-manuals-menu))
 (define-key menu-bar-help-menu [emacs-manual]
@@ -1923,36 +2009,33 @@ Buffers menu is regenerated."
     `(menu-item ,(purecopy "Previous History Item") previous-history-element
                :help ,(purecopy "Put previous minibuffer history element in the minibuffer"))))
 \f
-;;;###autoload
-;; This comment is taken from tool-bar.el near
-;; (put 'tool-bar-mode ...)
-;; We want to pretend the menu bar by standard is on, as this will make
-;; customize consider disabling the menu bar a customization, and save
-;; that.  We could do this for real by setting :init-value below, but
-;; that would overwrite disabling the tool bar from X resources.
-(put 'menu-bar-mode 'standard-value '(t))
-
 (define-minor-mode menu-bar-mode
   "Toggle display of a menu bar on each frame.
 This command applies to all frames that exist and frames to be
 created in the future.
 With a numeric argument, if the argument is positive,
 turn on menu bars; otherwise, turn off menu bars."
-  :init-value nil
+  :init-value t
   :global t
   :group 'frames
 
-  ;; Make menu-bar-mode and default-frame-alist consistent.
-  (modify-all-frames-parameters (list (cons 'menu-bar-lines
-                                           (if menu-bar-mode 1 0))))
-
+  ;; Turn the menu-bars on all frames on or off.
+  (let ((val (if menu-bar-mode 1 0)))
+    (dolist (frame (frame-list))
+      (set-frame-parameter frame 'menu-bar-lines val))
+    ;; If the user has given `default-frame-alist' a `menu-bar-lines'
+    ;; parameter, replace it.
+    (if (assq 'menu-bar-lines default-frame-alist)
+       (setq default-frame-alist
+             (cons (cons 'menu-bar-lines val)
+                   (assq-delete-all 'menu-bar-lines
+                                    default-frame-alist)))))
   ;; Make the message appear when Emacs is idle.  We can not call message
   ;; directly.  The minor-mode message "Menu-bar mode disabled" comes
   ;; after this function returns, overwriting any message we do here.
   (when (and (called-interactively-p 'interactive) (not menu-bar-mode))
     (run-with-idle-timer 0 nil 'message
-                        "Menu-bar mode disabled.  Use M-x menu-bar-mode to make the menu bar appear."))
-  menu-bar-mode)
+                        "Menu-bar mode disabled.  Use M-x menu-bar-mode to make the menu bar appear.")))
 
 (defun toggle-menu-bar-mode-from-frame (&optional arg)
   "Toggle menu bar on or off, based on the status of the current frame.
diff --git a/lisp/mh-e/.arch-inventory b/lisp/mh-e/.arch-inventory
deleted file mode 100644 (file)
index 2fada52..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-# Auto-generated lisp files, which ignore
-precious ^(mh-loaddefs)\.el$
-
-# arch-tag: 03c1cf02-6c80-44af-b4ec-b41b53fbf8f2
index b72478a32bde8399e05132de8cbe0056d666d0e5..ad1dbc8f024fe8e262d58cc42c381ef8159b8f15 100644 (file)
@@ -1,8 +1,20 @@
+2010-05-14  Peter S Galbraith  <psg@debian.org>
+
+       * 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.
+
 2010-05-07  Chong Yidong  <cyd@stupidchicken.com>
 
        * Version 23.2 released.
 
-2010-03-22  Juanma Barranquero  <lekktu@gmail.com>
+2010-05-03  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * mh-show.el (mh-showing-mode): Move function to mh-e.el.
+       * mh-e.el (mh-showing-mode): Use define-minor-mode.
+
+2010-03-24  Juanma Barranquero  <lekktu@gmail.com>
 
        * mh-scan.el (mh-scan-cmd-note-width): Doc fix.
        (mh-scan-format-mh, mh-scan-body-regexp, mh-scan-cur-msg-number-regexp)
        (mh-scan-subject-regexp, mh-update-scan-format)
        (mh-msg-num-width-to-column): Fix typos in docstrings.
 
+2010-03-10  Chong Yidong  <cyd@stupidchicken.com>
+
+       * Branch for 23.2.
+
 2009-12-01  Bill Wohler  <wohler@newt.com>
 
        * mh-search.el (mh-mairix-execute-search): Use mh vfolder_format.
 
 2006-06-02  Bill Wohler  <wohler@newt.com>
 
-       (mh-folder-exists-p): Change test from an empty buffer, to one
-       that contains the actual folder, since GNU mailutils' folder
+       * mh-search.el (mh-folder-exists-p): Change test from an empty buffer,
+       to one that contains the actual folder, since GNU mailutils' folder
        command displays output if the folder doesn't exist (closes SF
        #1499712).
 
        (mh-get-field): Delete ancient alias.
 
        * mh-xface.el (mh-face-foreground-compat): Move to mh-compat.el
-       and rename to mh-face-foreground
+       and rename to mh-face-foreground.
        (mh-face-background-compat): Move to mh-compat.el
        and rename to mh-face-background.
        (mh-face-display-function): Use the new names.
        (mh-identity-make-menu-no-autoload): New alias for
        mh-identity-make-menu which can be called from mh-e.el.
        (mh-identity-list-set): Move to mh-e.el.
-       (mh-identity-add-menu): New function
+       (mh-identity-add-menu): New function.
        (mh-insert-identity): Add optional argument maybe-insert so that
        local variable mh-identity-local does not have to be visible.
 
        (mh-find-path-run, mh-find-path): Move here from deprecated file
        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-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-prefix-help): Refactor to use mh-help.
        (mh-scan-good-msg-regexp, mh-scan-deleted-msg-regexp)
        (mh-scan-refiled-msg-regexp, mh-scan-cur-msg-number-regexp)
        (mh-scan-date-regexp, mh-scan-rcpt-regexp, mh-scan-body-regexp)
-       (mh-scan-subject-regexp): Sync docstrings with manual
+       (mh-scan-subject-regexp): Sync docstrings with manual.
        (mh-scan-format-regexp): Rename to
        mh-scan-sent-to-me-sender-regexp.  Drop date parenthesized
        expression.  Make expression more like the others (anchored at the
        (mh-mime-save-parts-default-directory, mh-print-background-flag)
        (mh-show-maximum-size, mh-show-use-goto-addr-flag)
        (mh-show-use-xface-flag, mh-store-default-directory)
-       (mh-summary-height, mh-delete-msg-hook
+       (mh-summary-height, mh-delete-msg-hook)
        (mh-show-hook, mh-show-mode-hook): Sync docstrings with manual.
 
        * mh-e.el (mh-scan-format-mh, mh-scan-good-msg-regexp)
index a51bd2872c3626a38afeaf42eaf856d8f637597d..a24489ca9b70f49fbcb5531e2767e396ed1d22cc 100644 (file)
 
 2005-05-28  Bill Wohler  <wohler@newt.com>
 
-        Released MH-E version 7.84.
+       Released MH-E version 7.84.
 
-         * MH-E-NEWS, README: Updated for release 7.84.
+       * MH-E-NEWS, README: Updated for release 7.84.
 
-         * mh-e.el (Version, mh-version): Updated for release 7.84.
+       * mh-e.el (Version, mh-version): Updated for release 7.84.
 
 2005-05-28  Bill Wohler  <wohler@newt.com>
 
        Synced with manual.
        (mh-junk-program): Use double-quotes on non-symbols.
 
-       * mh-pick.el: (mh-search-folder): Synced docstrings with manual.
+       * mh-pick.el (mh-search-folder): Synced docstrings with manual.
 
-       * mh-index.el: (mh-index-search, mh-pick-execute-search)
+       * mh-index.el (mh-index-search, mh-pick-execute-search)
        (mh-grep-execute-search, mh-mairix-execute-search)
        (mh-swish-execute-search, mh-swish++-execute-search)
        (mh-namazu-execute-search): Synced docstrings with manual. Note
 
        * mh-mime.el (mh-display-with-external-viewer): Checkdoc fixes.
 
-       * mh-identity.el: (mh-identity-attribution-verb-end): Stripped
+       * mh-identity.el (mh-identity-attribution-verb-end): Stripped
        trailing space; checkdoc fixes.
 
        * mh-e.el (mh-restore-desktop-buffer): Checkdoc fixes.
 
-       * mh-customize.el: (mh-inc-spool-list,
-       mh-compose-forward-as-mime-flag, defcustom): Stripped trailing
+       * mh-customize.el (mh-inc-spool-list)
+       (mh-compose-forward-as-mime-flag, defcustom): Stripped trailing
        space; checkdoc fixes.
 
        * mh-comp.el (mh-reply): Stripped trailing space.
 
        Merged in 7.4.4 changes, described below.
 
-       * mh-e.el (Version, mh-version):  Set to 7.4.4+cvs.
+       * mh-e.el (Version, mh-version): Set to 7.4.4+cvs.
 
 2004-07-10  Bill Wohler  <wohler@newt.com>
 
        (MH-E-XEMACS-OBJ): New variable to hold XEmacs object files.
        (clean): Moved XEmacs-specific code to clean-xemacs.
        (xemacs): Added clean-xemacs prerequisite. Moved down to XEmacs
-       section of file. Add target to build mh-loaddefs.el in XEmacs
+       section of file. Add target to build mh-loaddefs.el in XEmacs.
        (loaddefs-xemacs): New rule to build mh-loaddefs.el in XEmacs.
        (clean-xemacs): New target to remove XEmacs-specific files.
        (compile-xemacs): New. It allows for the '-no-autoloads' option
        mh-loaddefs.el in XEmacs.
        (XEMACS_LOADDEFS_COOKIE): Ditto.
        (XEMACS_LOADDEFS_PKG_NAME): Ditto.
-       (xemacs): Add target to build mh-loaddefs.el in XEmacs
-       (clean-xemacs): Remove `mh-loaddefs.el*'
+       (xemacs): Add target to build mh-loaddefs.el in XEmacs.
+       (clean-xemacs): Remove `mh-loaddefs.el*'.
        (loaddefs-xemacs): New rule to build mh-loaddefs.el in XEmacs.
 
 2003-11-02  Peter S Galbraith  <psg@debian.org>
        * mh-loaddefs.el: Regenerated.
 
        * mh-index.el (mh-indexer-choices): Remove option for the non-free
-       glimpse indexer (closes SF #831276).
+       glimpse indexer (closes SF #831276).
        (mh-glimpse-binary, mh-glimpse-directory)
        (mh-glimpse-execute-search, mh-glimpse-next-result): Functions
        and variables to implement glimpse support are removed.
        (mh-mml-secure-message-signencrypt): Ditto.
        (mh-mml-secure-message-sign): Ditto.
 
-       * mh-comp.el (mh-letter-menu, mh-letter-mode-help-messages,
+       * mh-comp.el (mh-letter-menu, mh-letter-mode-help-messages)
        (mh-letter-mode-map): Update to use new functions.
 
 2003-09-26  Satyaki Das  <satyakid@stanford.edu>
        (mh-alias-system-aliases): Moved here from mh-customize.el. By
        definition, "system" definitions are not user-visible, and user
        filenames are in the the Aliasfile: profile component, so this
-       variable really shouldn't be a defcustom
+       variable really shouldn't be a defcustom.
        (mh-alias-tstamp, mh-alias-filenames, mh-alias-reload)
        (mh-alias-add-alias, mh-alias-grab-from-field)
        (mh-alias-add-address-under-point, mh-alias-apropos): Merge
 
 2003-08-19  Bill Wohler  <wohler@newt.com>
 
-       * mh-seq.el: (mh-edit-pick-expr): Renamed from mh-read-pick-regexp
+       * mh-seq.el (mh-edit-pick-expr): Renamed from mh-read-pick-regexp
        since the new name is more indicative of what the function does.
        Prompt now says "Pick expression" instead of "Pick regexp".
        (mh-narrow-to-subject): Rewrote function to behave like other
        * mh-comp.el (mh-send-letter): Go to the top of the draft so that
        the user can see which header fields have been inserted. I think
        this is more important than leaving point alone or going to the
-       end to see the signature since Mail-Followup-To or Bcc or cc could
+       end to see the signature since Mail-Followup-To or Bcc or cc could
        have some deleterious effects.
 
        * mh-customize.el (mh-auto-fields-prompt-flag): New variable.
        * mh-comp.el (mh-extract-rejected-mail, mh-letter-mode-message):
        Ditto.
 
-       * mh-e.el (mh-refile-a-msg):  Ditto.
+       * mh-e.el (mh-refile-a-msg): Ditto.
 
        * mh-funcs.el (mh-undo-folder): Ditto.
 
 
 2003-07-28  Peter S Galbraith  <psg@debian.org>
 
-       * mh-comp.el (mh-insert-letter):  Remove `mh-visible-headers'
+       * mh-comp.el (mh-insert-letter): Remove `mh-visible-headers'
        operation.
 
        * mh-mime.el (mh-mm-inline-message): Same.
 
 2003-06-24  Bill Wohler  <wohler@newt.com>
 
-       * mh-e.el (Version, mh-version):  Set to 7.4.1+cvs.
+       * mh-e.el (Version, mh-version): Set to 7.4.1+cvs.
 
 2003-06-25  Bill Wohler  <wohler@newt.com>
 
 
 2003-06-24  Bill Wohler  <wohler@newt.com>
 
-       * mh-e.el (Version, mh-version):  Set to 7.4+cvs.
+       * mh-e.el (Version, mh-version): Set to 7.4+cvs.
 
 2003-06-24  Bill Wohler  <wohler@newt.com>
 
        replacement text.
        (mh-index-parse-search-regexp): Preserve case of search terms.
        This is needed to take advantage of the acronym indexing in
-       swish++ (closes SF #755718).
+       swish++ (closes SF #755718).
 
 2003-06-13  Satyaki Das  <satyakid@stanford.edu>
 
        fixes germaine to the change whereby we now check for MIME
        directives before sending.
 
-       * mh-xemacs-toolbar.el: Fixed copyright. Added Change Log comment
+       * mh-xemacs-toolbar.el: Fixed copyright. Added Change Log comment.
        (lm-verify fix). Added standard MH-E local variables. Removed
        time-stamp stuff.
 
 
 2003-04-06  Bill Wohler  <wohler@newt.com>
 
-       * mh-comp.el (mh-forward):  Updated docstrings to indicate that a
+       * mh-comp.el (mh-forward): Updated docstrings to indicate that a
        list of messages is acceptable as well.
 
        * mh-e.el (mh-delete-msg, mh-delete-msg-no-motion, mh-refile-msg)
 
 2003-04-04  Peter S Galbraith  <psg@debian.org>
 
-       * mh-e.el (mh-folder-from-address):  Minor Fix.  Wrong ending of
+       * mh-e.el (mh-folder-from-address): Minor Fix.  Wrong ending of
        `when' block.
 
 2003-04-04  Satyaki Das  <satyaki@theforce.stanford.edu>
        mh-xemacs-toolbar.el: Removed RCS keywords per Emacs conventions
        (closes SF #680731).
 
-
 2003-03-26  Satyaki Das  <satyaki@theforce.stanford.edu>
 
        * mh-index.el: Fix commentary to mention that mairix is supported
 
        * import-emacs: MH-E now has its own directory in Emacs.
 
-       * mh-e.el: (mh-version): Set to 7.2+cvs.
+       * mh-e.el (mh-version): Set to 7.2+cvs.
 
 2003-02-03  Bill Wohler  <wohler@newt.com>
 
        (mh-default-folder-prefix, mh-default-folder-must-exist-flag): In
        docstring, refer to documentation for mh-prompt-for-refile-folder
        and mh-folder-from-address.
-       (mh-highlight-citation-p, mh-compose-insertion,
-       (mh-insert-mail-followup-to-list, mh-index-program,
+       (mh-highlight-citation-p, mh-compose-insertion)
+       (mh-insert-mail-followup-to-list, mh-index-program)
        (mh-identity-default): Fixed case of tags.
 
        * mh-e.el (mh-folder-from-address): Use new variable
        (mh-alias-insert-file): New function. Return the alias file to
        write a new entry in.
        (mh-alias-address-to-alias): New function. Return the ADDRESS
-       alias if defined, or nil."
+       alias if defined, or nil.
        (mh-alias-from-has-no-alias-p): New function. Return t is From has
        no current alias set.  Used as tool-bar button enable function.
        (mh-alias-add-alias-to-file): New function. Add ALIAS for ADDRESS
        * mh-e.el (mh-add-cur-notation): New function to mark the
        current message with the mh-note-cur character.
        (mh-get-new-mail): Use mh-add-cur-notation to undo the work of
-       mh-remove-cur-notation if there was no new mail (closes SF #647681).
+       mh-remove-cur-notation if there was no new mail (closes SF #647681).
 
        * mh-e.el (mh-set-cmd-note): Do not update the default mh-cmd-note
        value (closes SF #643701).
        (mh-alias-translate): New function.  Return translation for alias,
        checking if in blind or passwd list.
        (mh-alias-letter-expand-alias): Rewrite using
-       mail-abbrev-complete-alias from mailabbrev.el
+       mail-abbrev-complete-alias from mailabbrev.el.
        (mh-alias-expand-alias-map): New variable.
        (mh-alias-ali): New function. Return formatted string of
        translated ALIAS from ali.
        mh-thread-generate-scan-lines.
 
        * mh-mime.el (font-lock): Font-lock required at compile time to
-       avoid warning about font-lock-maximum-size
+       avoid warning about font-lock-maximum-size.
        (mh-display-smileys, mh-display-emphasis): Show graphical smileys
        and emphasis only if message isn't too large.
 
 
 2002-11-13  Mark D. Baushke  <mdb@gnu.org>
 
-       * mh-identity.el (mh-insert-identity):  A value of either nil or
+       * mh-identity.el (mh-insert-identity): A value of either nil or
        "" should cause the field to be removed.
        (mh-identity-list): Update the docstring.
 
        This addresses part of SF #627015.
 
        * mh-utils.el (mh-decode-quoted-printable-flag): Renamed from
-       mh-decode-quoted-printable
+       mh-decode-quoted-printable.
        (mh-display-msg, mh-decode-quoted-printable-have-mimedecode):
        Use it.
        This addresses part of SF #627015.
        the MH pick command to give the user more information when
        choosing between mh-search-folder and mh-index-folder.
 
-       * mh-index.el (mh-index-search): Edited the docstring. Direct the
-        user to mh-index-program if necessary.
-        (mh-index-program): Edited this docstring too. Viewing the help
-        in a *Help* buffer really exposes grammatical flaws.
+       * mh-index.el (mh-index-search): Edited the docstring.  Direct the
+       user to mh-index-program if necessary.
+       (mh-index-program): Edited this docstring too.  Viewing the help
+       in a *Help* buffer really exposes grammatical flaws.
 
 2002-11-05  Peter S Galbraith  <psg@debian.org>
 
        (.PHONY): Added emacs, xemacs, autoloads, custom-loads. Broke up
        target and moved pieces into their own sections.
 
-
 2002-10-30  Peter S Galbraith  <psg@debian.org>
 
        * mh-utils.el (mh-show-font-lock-keywords): Wrap an
 2002-10-28  Peter S Galbraith  <psg@debian.org>
 
        * mh-e.el (mh-scan-subject-regexp): Add an expression to match an
-       optional bracketed number after "Re", such as in "Re[2]:"
+       optional bracketed number after "Re", such as in "Re[2]:".
        (Patch by Satyaki; I checked it and applied).
        (mh-folder-font-lock-subject): Adapt to new mh-scan-subject-regexp.
        * mh-seq.el (mh-subject-to-sequence): Ditto.
 
-       * mh-e.el (mh-folder-sequence-menu):  Remove "Toggle Subject
+       * mh-e.el (mh-folder-sequence-menu): Remove "Toggle Subject
        Thread" from menu.   mh-toggle-threads is in the Folder menu.
 
        * mh-e.el (mh-folder-sequence-menu): Minor menu text edits.
        (mh-thread-generate-scan-lines): Renamed dupl-p as dupl-flag.
        This addresses part of SF #627015.
 
-       * mh-index.el (mh-index-advance):  Renamed backward-p
+       * mh-index.el (mh-index-advance): Renamed backward-p
        local variable as backward-flag.
        (mh-index-next-button): Renamed backward-p
        argument as backward-flag.
 2002-10-22  Mark D. Baushke  <mdb@gnu.org>
 
        * mh-mime.el (mh-graphical-smileys-flag): Renamed from
-        mh-graphical-smileys-p.
-        (mh-display-smileys): Use it.
-        (mh-graphical-emphasis-flag): Renamed from
-        mh-graphical-emphasis-p.
-        (mh-display-emphasis): Use it. This addresses part of SF #627015.
+       mh-graphical-smileys-p.
+       (mh-display-smileys): Use it.
+       (mh-graphical-emphasis-flag): Renamed from mh-graphical-emphasis-p.
+       (mh-display-emphasis): Use it.  This addresses part of SF #627015.
 
 2002-10-22  Satyaki Das  <satyaki@theforce.stanford.edu>
 
        (mh-pick-mode): Set local buffer variable mh-help-messages to
        mh-pick-mode-help-messages.
 
-       * mh-index.el (mh-index-keymap): Added binding for mh-help
+       * mh-index.el (mh-index-keymap): Added binding for mh-help.
        (mh-index-folder-mode-help-messages): New variable that contains
        help messages for MH Index buffer.
        (mh-index-folder-mode): Set local buffer variable mh-help-messages
        decide how many buttons to use for replying.
 
        * mh-mime.el (mh-file-mime-type-substitutions)
-       (mh-file-mime-type-substitute):  Fix typos and doc strings.
+       (mh-file-mime-type-substitute): Fix typos and doc strings.
 
 2002-09-30  Peter S Galbraith  <psg@debian.org>
 
 2002-09-17  Peter S Galbraith  <psg@debian.org>
 
        * mh-mime.el (mh-store-mime-parts-default-directory): Renamed from
-       mh-store-mime-parts-directory
+       mh-store-mime-parts-directory.
        (mh-store-mime-parts-directory): Renamed from
        mh-store-mime-parts-directory-default.
 
        * mh-mime.el (mh-store-mime-parts-directory): New defcustom.
        Default directory to use for mh-store-mime-parts.
        (mh-store-mime-parts): New Command.  Store the MIME parts of the
-        current message.
+       current message.
        (mh-store-mime-parts-directory-default): New internal working
        variable.  Default to use for mh-store-mime-parts-directory, set
        from last use.
        * mh-e.el (mh-folder-seq-tool-bar-map): Add mh-store-mime-parts to
        toolbar.
 
-
 2002-08-22  Satyaki Das  <satyaki@theforce.stanford.edu>
 
        * mh-seq.el (mh-thread-generate-scan-lines): In threaded view,
 2002-08-19  Peter S Galbraith  <psg@debian.org>
 
        * reply-to.xpm, reply-to.pbm, reply-from.xpm, reply-from.pbm,
-       * reply-all.xpm, reply-all.pbm:  New icons for various reply methods.
+       * reply-all.xpm, reply-all.pbm: New icons for various reply methods.
        * mh-e.el (mh-folder-tool-bar-map): Split reply button into three
        that won't prompt for "from", "to" and "all".
        * mh-comp.el (mh-reply): Put variable reply-to in the interactive
        to `mh-mml-to-mime' in `mh-send-letter'.
        (mh-mml-secure-message-sign-pgpmime): New function.
        Front end to mml-secure-message-sign-pgpmime.
-       (mh-mml-secure-message-encrypt-pgpmime):  New function.
+       (mh-mml-secure-message-encrypt-pgpmime): New function.
        Front end to mml-secure-message-encrypt-pgpmime.
 
        * mh-comp.el (mh-send-letter): automatic call to `mh-mml-to-mime'
        if mh-mml-compose-insert-p is set.
        (mh-letter-mode-map): Add keys for new mh-mime functions above.
-       * mh-comp.el:  Added autoloads for new mh-mime functions above.
+       * mh-comp.el: Added autoloads for new mh-mime functions above.
 
 2002-06-17  Peter S Galbraith  <psg@debian.org>
 
        compiler warnings.
 
        * mh-e.el (compilation): Code rearrangement and extra autoloads to
-       remove compiler warnings
+       remove compiler warnings.
        (mh-quit): Add call to mh-destroy-postponed-handles to remove
        handles that are associated with external viewers. Also fixed a
        bug that I accidentally introduced by adding an extra line when
        (clean): New target that blows away MH-E-OBJ.
        (dist): Added $(MH-E-OBJ) to tarball.
 
-
        Attempt to quiet compilation errors to a dull roar.
 
        * mh-e.el: Require easymenu, added autoload of info.
        * mh-comp.el: Require mh-e and easymenu, moved autoloads to top of
        file.
 
-
-       * Makefile: (EMACS): New constant to hold emacs calling sequence.
+       * Makefile (EMACS): New constant to hold emacs calling sequence.
        (install): Renamed to install-emacs.
        (compile): New target to compile all files.
        (dist): Make dependent on compile.
 2001-11-29  Peter S Galbraith  <psg@debian.org>
 
        * mh-e.el (mh-folder-font-lock-subject): New fontifier function
-       for subject lines in folder-mode
+       for subject lines in folder-mode.
        (mh-scan-followup-regexp): Deleted obsolete regexp.  Use
        mh-scan-subject-regexp instead.
        (mh-folder-font-lock-keywords): Use mh-folder-font-lock-subject
 
 2001-11-29  Jeffrey C Honig  <jch@honig.net>
 
-       * mh-utils.el: (mh-find-progs): Change mh-find-progs to rely on
+       * mh-utils.el (mh-find-progs): Change mh-find-progs to rely on
        the existence of mhparam.  The location of mhparam is used to find
        `mh-progs'.  It uses the libdir and etcdir to find the
        `mh-lib-progs' and `mh-lib' directories.  If etcdir doesn't return
        set mh-page-to-next-msg-p to t. The second time the end of page is
        hit, go to the next message.
 
-       * mh-utils.el: (mh-show-msg): Initialize mh-page-to-next-msg-p to
+       * mh-utils.el (mh-show-msg): Initialize mh-page-to-next-msg-p to
        nil.
 
 2001-11-27  Bill Wohler  <wohler@newt.com>
 2001-11-20  Peter S Galbraith  <psg@debian.org>
 
        * mh-comp.el (mh-letter-mode): Make font-lock-defaults a local variable
-       * mh-e.el (mh-folder-mode):  Same.
-       * mh-utils.el (mh-show-mode):  Same.
+       * mh-e.el (mh-folder-mode): Same.
+       * mh-utils.el (mh-show-mode): Same.
 
        * mh-e.el (mh-scan-msg-num-regexp): Delete variable and replace
        with mh-good-msg-regexp.
        * mh-e.el (mh-refile-msg): Mark messages in region for refiling if
        mark is active and in transient-mark-mode.
        * mh-e.el (mh-undo): Undo message marks for refile or deletion if
-       region if mark is active and in transient-mark-mode.
+       region if mark is active and in transient-mark-mode.
 
 2001-11-06  Peter S Galbraith  <psg@debian.org>
 
index 5f472322ff9f44d222ef3a00d4a681ffeaf0742d..2856c630fd0627b5c384f1c7d7bf4d5f6f70e4c6 100644 (file)
@@ -234,7 +234,7 @@ returns the string unchanged if not defined. The same is done here."
         (let ((user-arg (if user "-user" "-nouser")))
           (mh-exec-cmd-quiet t "ali" user-arg "-nolist" alias))
         (goto-char (point-max))
-        (if (looking-at "^$") (delete-backward-char 1))
+        (if (looking-at "^$") (delete-char -1))
         (buffer-substring (point-min)(point-max)))
     (error (progn
              (message "%s" (error-message-string err))
index 3bb1e34325391662d534fb41d306651137a0f582..762aad86080ea73b77ff04d48cf9a1de2df167b8 100644 (file)
@@ -905,6 +905,9 @@ letter."
   (mh-identity-make-menu)
   (mh-identity-add-menu)
 
+  ;; Cleanup possibly RFC2047 encoded subject header
+  (mh-decode-message-subject)
+
   ;; Insert extra fields.
   (mh-insert-x-mailer)
   (mh-insert-x-face)
index 3639920f5142330f7d4be38eda0907c9582f7019..9a2bccbc96751098d96affac167451fb473901a8 100644 (file)
@@ -287,8 +287,10 @@ Elements have the form (SEQUENCE . MESSAGES).")
 (defvar mh-show-buffer nil
   "Buffer that displays message for this folder.")
 
-(defvar mh-showing-mode nil
-  "If non-nil, show the message in a separate window.")
+(define-minor-mode mh-showing-mode
+  "Minor mode to show the message in a separate window."
+  ;; FIXME: maybe this should be moved to mh-show.el.
+  :lighter " Show")
 
 (defvar mh-view-ops nil
   "Stack of operations that change the folder view.
index a60f31e3ac2de28683597151fc5351e194780343..8d47af40ebd0ea359046becb3d50a60a1810808f 100644 (file)
@@ -507,6 +507,15 @@ decoding the same message multiple times."
     (let ((buffer-read-only nil))
       (rfc2047-decode-region (point-min) (mh-mail-header-end)))))
 
+;;;###mh-autoload
+(defun mh-decode-message-subject ()
+  "Decode RFC2047 encoded message header fields."
+  (when mh-decode-mime-flag
+    (save-excursion
+      (let ((buffer-read-only nil))
+        (rfc2047-decode-region (progn (mh-goto-header-field "subject:") (point))
+                               (progn (mh-header-field-end) (point)))))))
+
 ;;;###mh-autoload
 (defun mh-mime-display (&optional pre-dissected-handles)
   "Display (and possibly decode) MIME handles.
index f361e049efb5c784aecafbf76d55bd19a0d9b153..7a1f41bf932ad3c3e7b12e59cbe9f77600280238 100644 (file)
@@ -1511,7 +1511,7 @@ construct the base name."
       (delete-char 1))
     (goto-char (point-max))
     (while (and (not (bobp)) (memq (char-before) '(?  ?\t ?\n ?\r ?_)))
-      (delete-backward-char 1))
+      (delete-char -1))
     (subst-char-in-region (point-min) (point-max) ?  ?_ t)
     (subst-char-in-region (point-min) (point-max) ?\t ?_ t)
     (subst-char-in-region (point-min) (point-max) ?\n ?_ t)
index 766b6982d98dba59848e7da60045096afe1353fa..58d52205079053c375a613675770dece4a126634 100644 (file)
@@ -169,16 +169,6 @@ displayed."
         (apply #'mh-speed-flists t folders)))
     (run-hooks 'mh-show-hook)))
 
-;;;###mh-autoload
-(defun mh-showing-mode (&optional arg)
-  "Change whether messages should be displayed.
-
-With ARG, display messages if ARG is positive, otherwise don't display them."
-  (setq mh-showing-mode
-        (if (null arg)
-            (not mh-showing-mode)
-          (> (prefix-numeric-value arg) 0))))
-
 ;;;###mh-autoload
 (defun mh-start-of-uncleaned-message ()
   "Position uninteresting headers off the top of the window."
index 5887a3445bc14cfffdf7afa0dd737947344d8717..5ff1ecc9b070e4e171c9d0c3df6df369cc82b39d 100644 (file)
@@ -3,8 +3,8 @@
 ;; Copyright (C) 1998, 2001, 2002, 2003, 2004, 2005,
 ;;   2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
-;; Author: Sam Steingold <sds@usa.net>
-;; Maintainer: Sam Steingold <sds@usa.net>
+;; Author: Sam Steingold <sds@gnu.org>
+;; Maintainer: Sam Steingold <sds@gnu.org>
 ;; Created: 1998-05-18
 ;; Keywords: utilities
 
@@ -205,7 +205,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) 
+  (multiple-value-bind (sec min hrs)
       (values-list (decode-time))
     (- (* 24 60 60) (* 60 60 hrs) (* 60 min) sec)))
 
index 93a222053f6c2f9df375fcca7797160805ff242e..f7dc035a8866d79be908f6afe2508dd9cd7cca65 100644 (file)
@@ -3,6 +3,7 @@
 ;; Copyright (C) 2008, 2009, 2010  Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
@@ -76,6 +77,9 @@
 ;;     the provided string (as is the case in filecache.el), in which
 ;;     case partial-completion (for example) doesn't make any sense
 ;;     and neither does the completions-first-difference highlight.
+;;   - indicate how to display the completions in *Completions* (turn
+;;     \n into something else, add special boundaries between
+;;     completions).  E.g. when completing from the kill-ring.
 
 ;; - make partial-completion-mode obsolete:
 ;;   - (?) <foo.h> style completion for file names.
@@ -407,6 +411,12 @@ Furthermore, for completions that are done step by step in subfields,
 the method is applied to all the preceding fields that do not yet match.
 E.g. C-x C-f /u/mo/s TAB could complete to /usr/monnier/src.
 Additionally the user can use the char \"*\" as a glob pattern.")
+    (substring
+     completion-substring-try-completion completion-substring-all-completions
+     "Completion of the string taken as a substring.
+I.e. when completing \"foo_bar\" (where _ is the position of point),
+it will consider all completions candidates matching the glob
+pattern \"*foo*bar*\".")
     (initials
      completion-initials-try-completion completion-initials-all-completions
      "Completion of acronyms and initialisms.
@@ -483,6 +493,18 @@ Moves point to the end of the new text."
   (insert newtext)
   (delete-region (point) (+ (point) (- end beg))))
 
+(defcustom completion-cycle-threshold nil
+  "Number of completion candidates below which cycling is used.
+Depending on this setting `minibuffer-complete' may use cycling,
+like `minibuffer-force-complete'.
+If nil, cycling is never used.
+If t, cycling is always used.
+If an integer, cycling is used as soon as there are fewer completion
+candidates than this number."
+  :type '(choice (const :tag "No cycling" nil)
+          (const :tag "Always cycle" t)
+          (integer :tag "Threshold")))
+
 (defun completion--do-completion (&optional try-completion-function)
   "Do the completion and return a summary of what happened.
 M = completion was performed, the text was Modified.
@@ -542,14 +564,43 @@ E = after completion we now have an Exact match.
           ;; It did find a match.  Do we match some possibility exactly now?
           (let ((exact (test-completion completion
                                        minibuffer-completion-table
-                                       minibuffer-completion-predicate)))
-            (if completed
+                                       minibuffer-completion-predicate))
+                (comps
+                 ;; Check to see if we want to do cycling.  We do it
+                 ;; here, after having performed the normal completion,
+                 ;; so as to take advantage of the difference between
+                 ;; try-completion and all-completions, for things
+                 ;; like completion-ignored-extensions.
+                 (when (and completion-cycle-threshold
+                            ;; Check that the completion didn't make
+                            ;; us jump to a different boundary.
+                            (or (not completed)
+                                (< (car (completion-boundaries
+                                         (substring completion 0 comp-pos)
+                                         minibuffer-completion-table
+                                         minibuffer-completion-predicate
+                                         ""))
+                                   comp-pos)))
+                   (completion-all-sorted-completions))))
+            (setq completion-all-sorted-completions nil)
+            (cond
+             ((and (not (ignore-errors
+                          ;; This signal an (intended) error if comps is too
+                          ;; short or if completion-cycle-threshold is t.
+                          (consp (nthcdr completion-cycle-threshold comps))))
+                   ;; More than 1, so there's something to cycle.
+                   (consp (cdr comps)))
+              ;; Fewer than completion-cycle-threshold remaining
+              ;; completions: let's cycle.
+              (setq completed t exact t)
+              (setq completion-all-sorted-completions comps)
+              (minibuffer-force-complete))
+             (completed
                 ;; We could also decide to refresh the completions,
                 ;; if they're displayed (and assuming there are
                 ;; completions left).
-                (minibuffer-hide-completions)
+              (minibuffer-hide-completions))
               ;; Show the completion table, if requested.
-              (cond
                ((not exact)
                 (if (case completion-auto-help
                       (lazy (eq this-command last-command))
@@ -560,7 +611,7 @@ E = after completion we now have an Exact match.
                ;; means we've already given a "Next char not unique" message
                ;; and the user's hit TAB again, so now we give him help.
                ((eq this-command last-command)
-                (if completion-auto-help (minibuffer-completion-help)))))
+              (if completion-auto-help (minibuffer-completion-help))))
 
             (minibuffer--bitset completed t exact))))))))
 
@@ -574,21 +625,26 @@ scroll the window of possible completions."
   ;; If the previous command was not this,
   ;; mark the completion buffer obsolete.
   (unless (eq this-command last-command)
+    (setq completion-all-sorted-completions nil)
     (setq minibuffer-scroll-window nil))
 
-  (let ((window minibuffer-scroll-window))
+  (cond
     ;; If there's a fresh completion window with a live buffer,
     ;; and this command is repeated, scroll that window.
-    (if (window-live-p window)
+   ((window-live-p minibuffer-scroll-window)
+    (let ((window minibuffer-scroll-window))
         (with-current-buffer (window-buffer window)
           (if (pos-visible-in-window-p (point-max) window)
              ;; If end is in view, scroll up to the beginning.
              (set-window-start window (point-min) nil)
            ;; Else scroll down one screen.
            (scroll-other-window))
-         nil)
-
-      (case (completion--do-completion)
+        nil)))
+   ;; If we're cycling, keep on cycling.
+   (completion-all-sorted-completions
+    (minibuffer-force-complete)
+    t)
+   (t (case (completion--do-completion)
         (#b000 nil)
         (#b001 (minibuffer-message "Sole completion")
                t)
@@ -836,13 +892,13 @@ Return nil if there is no valid completion, else t."
 (defface completions-annotations '((t :inherit italic))
   "Face to use for annotations in the *Completions* buffer.")
 
-(defcustom completions-format nil
+(defcustom completions-format 'horizontal
   "Define the appearance and sorting of completions.
 If the value is `vertical', display completions sorted vertically
 in columns in the *Completions* buffer.
-If the value is `horizontal' or nil, display completions sorted
+If the value is `horizontal', display completions sorted
 horizontally in alphabetical order, rather than down the screen."
-  :type '(choice (const nil) (const horizontal) (const vertical))
+  :type '(choice (const horizontal) (const vertical))
   :group 'minibuffer
   :version "23.2")
 
@@ -1051,7 +1107,8 @@ variables.")
   "Display a list of possible completions of the current minibuffer contents."
   (interactive)
   (message "Making completion list...")
-  (let* ((start (field-beginning))
+  (let* ((non-essential t)
+        (start (field-beginning))
          (string (field-string))
          (completions (completion-all-completions
                        string
@@ -1150,7 +1207,7 @@ Point needs to be somewhere between START and END."
           (call-interactively 'minibuffer-complete)
         (delete-overlay ol)))))
 
-(defvar completion-at-point-functions nil
+(defvar completion-at-point-functions '(tags-completion-at-point-function)
   "Special hook to find the completion table for the thing at point.
 It is called without any argument and should return either nil,
 or a function of no argument to perform completion (discouraged),
@@ -1162,24 +1219,31 @@ Currently supported properties are:
  `:predicate'           a predicate that completion candidates need to satisfy.
  `:annotation-function' the value to use for `completion-annotate-function'.")
 
-(defun completion-at-point ()
-  "Complete the thing at point according to local mode.
-This runs the hook `completion-at-point-functions' until a member returns
-non-nil."
-  (interactive)
-  (let ((res (run-hook-with-args-until-success
-              'completion-at-point-functions)))
-    (cond
-     ((functionp res) (funcall res))
-     (res
-      (let* ((plist (nthcdr 3 res))
-             (start (nth 0 res))
-             (end (nth 1 res))
-             (completion-annotate-function
-              (or (plist-get plist :annotation-function)
-                  completion-annotate-function)))
-        (completion-in-region start end (nth 2 res)
-                              (plist-get plist :predicate)))))))
+(defun completion-at-point (&optional arg)
+  "Perform completion on the text around point.
+The completion method is determined by `completion-at-point-functions'.
+
+With a prefix argument, this command does completion within
+the collection of symbols listed in the index of the manual for the
+language you are using."
+  (interactive "P")
+  (if arg
+      (info-complete-symbol)
+    (let ((res (run-hook-with-args-until-success
+               'completion-at-point-functions)))
+      (cond
+       ((functionp res) (funcall res))
+       (res
+       (let* ((plist (nthcdr 3 res))
+              (start (nth 0 res))
+              (end (nth 1 res))
+              (completion-annotate-function
+               (or (plist-get plist :annotation-function)
+                   completion-annotate-function)))
+         (completion-in-region start end (nth 2 res)
+                               (plist-get plist :predicate))))))))
+
+(define-obsolete-function-alias 'complete-symbol 'completion-at-point "24.1")
 
 ;;; Key bindings.
 
@@ -1279,12 +1343,19 @@ same as `substitute-in-file-name'."
    ((eq (car-safe action) 'boundaries)
     (let ((start (length (file-name-directory string)))
           (end (string-match-p "/" (cdr action))))
-      (list* 'boundaries start end)))
-
-     ((eq action 'lambda)
-      (if (zerop (length string))
-          nil    ;Not sure why it's here, but it probably doesn't harm.
-        (funcall (or pred 'file-exists-p) string)))
+      (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)))
+
+   ((eq action 'lambda)
+    (if (zerop (length string))
+        nil    ;Not sure why it's here, but it probably doesn't harm.
+      (funcall (or pred 'file-exists-p) string)))
 
    (t
       (let* ((name (file-name-nondirectory string))
@@ -1332,19 +1403,20 @@ 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
-    ;; completion-file-name-table and then fix them up, because it
-    ;; would require us to track the relationship between `str' and
+    ;; 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.
-    (let ((start (length (file-name-directory string)))
-          (end (string-match-p "/" (cdr action))))
-      (list* 'boundaries start end)))
+    ;; 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
+   (t
     (let* ((default-directory
              (if (stringp pred)
                  ;; It used to be that `pred' was abused to pass `dir'
@@ -1356,7 +1428,9 @@ except that it passes the file name through `substitute-in-file-name'."
                     (substitute-in-file-name string)
                   (error string)))
            (comp (completion-file-name-table
-                  str (or pred read-file-name-predicate) action)))
+                  str
+                 (with-no-warnings (or pred read-file-name-predicate))
+                 action)))
 
       (cond
        ((stringp comp)
@@ -1686,6 +1760,12 @@ Return the new suffix."
     ;; Nothing to merge.
     suffix))
 
+(defun completion-basic--pattern (beforepoint afterpoint bounds)
+  (delete
+   "" (list (substring beforepoint (car bounds))
+            'point
+            (substring afterpoint 0 (cdr bounds)))))
+
 (defun completion-basic-try-completion (string table pred point)
   (let* ((beforepoint (substring string 0 point))
          (afterpoint (substring string point))
@@ -1702,10 +1782,8 @@ Return the new suffix."
              (length completion))))
       (let* ((suffix (substring afterpoint (cdr bounds)))
              (prefix (substring beforepoint 0 (car bounds)))
-             (pattern (delete
-                       "" (list (substring beforepoint (car bounds))
-                                'point
-                                (substring afterpoint 0 (cdr bounds)))))
+             (pattern (completion-basic--pattern
+                       beforepoint afterpoint bounds))
              (all (completion-pcm--all-completions prefix pattern table pred)))
         (if minibuffer-completing-file-name
             (setq all (completion-pcm--filename-try-filter all)))
@@ -1715,12 +1793,8 @@ Return the new suffix."
   (let* ((beforepoint (substring string 0 point))
          (afterpoint (substring string point))
          (bounds (completion-boundaries beforepoint table pred afterpoint))
-         (suffix (substring afterpoint (cdr bounds)))
          (prefix (substring beforepoint 0 (car bounds)))
-         (pattern (delete
-                   "" (list (substring beforepoint (car bounds))
-                            'point
-                            (substring afterpoint 0 (cdr bounds)))))
+         (pattern (completion-basic--pattern beforepoint afterpoint bounds))
          (all (completion-pcm--all-completions prefix pattern table pred)))
     (completion-hilit-commonality all point (car bounds))))
 
@@ -1753,6 +1827,14 @@ expression (not containing character ranges like `a-z')."
   :group 'minibuffer
   :type 'string)
 
+(defcustom completion-pcm-complete-word-inserts-delimiters nil
+  "Treat the SPC or - inserted by `minibuffer-complete-word' as delimiters.
+Those chars are treated as delimiters iff this variable is non-nil.
+I.e. if non-nil, M-x SPC will just insert a \"-\" in the minibuffer, whereas
+if nil, it will list all possible commands in *Completions* because none of
+the commands start with a \"-\" or a SPC."
+  :type 'boolean)
+
 (defun completion-pcm--pattern-trivial-p (pattern)
   (and (stringp (car pattern))
        ;; It can be followed by `point' and "" and still be trivial.
@@ -1765,7 +1847,7 @@ expression (not containing character ranges like `a-z')."
 (defun completion-pcm--string->pattern (string &optional point)
   "Split STRING into a pattern.
 A pattern is a list where each element is either a string
-or a symbol chosen among `any', `star', `point'."
+or a symbol chosen among `any', `star', `point', `prefix'."
   (if (and point (< point (length string)))
       (let ((prefix (substring string 0 point))
             (suffix (substring string point)))
@@ -1778,11 +1860,12 @@ or a symbol chosen among `any', `star', `point'."
 
       (while (and (setq p (string-match completion-pcm--delim-wild-regex
                                         string p))
-                  ;; If the char was added by minibuffer-complete-word, then
-                  ;; don't treat it as a delimiter, otherwise "M-x SPC"
-                  ;; ends up inserting a "-" rather than listing
-                  ;; all completions.
-                  (not (get-text-property p 'completion-try-word string)))
+                  (or completion-pcm-complete-word-inserts-delimiters
+                      ;; If the char was added by minibuffer-complete-word,
+                      ;; then don't treat it as a delimiter, otherwise
+                      ;; "M-x SPC" ends up inserting a "-" rather than listing
+                      ;; all completions.
+                      (not (get-text-property p 'completion-try-word string))))
         ;; Usually, completion-pcm--delim-wild-regex matches a delimiter,
         ;; meaning that something can be added *before* it, but it can also
         ;; match a prefix and postfix, in which case something can be added
@@ -1808,11 +1891,10 @@ or a symbol chosen among `any', `star', `point'."
          (concat "\\`"
                  (mapconcat
                   (lambda (x)
-                    (case x
-                      ((star any point)
-                       (if (if (consp group) (memq x group) group)
-                           "\\(.*?\\)" ".*?"))
-                      (t (regexp-quote x))))
+                    (cond
+                     ((stringp x) (regexp-quote x))
+                     ((if (consp group) (memq x group) group) "\\(.*?\\)")
+                    (t ".*?")))
                   pattern
                   ""))))
     ;; Avoid pathological backtracking.
@@ -1967,6 +2049,17 @@ filter out additional entries (because TABLE migth not obey PRED)."
       (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))))
+
+(defun completion--common-suffix (strs)
+  "Return the common suffix of the strings STRS."
+  (completion--sreverse
+   (try-completion
+    ""
+    (mapcar 'completion--sreverse strs))))
+
 (defun completion-pcm--merge-completions (strs pattern)
   "Extract the commonality in STRS, with the help of PATTERN."
   ;; When completing while ignoring case, we want to try and avoid
@@ -2028,7 +2121,17 @@ filter out additional entries (because TABLE migth not obey PRED)."
                 ;; `any' into a `star' because the surrounding context has
                 ;; changed such that string->pattern wouldn't add an `any'
                 ;; here any more.
-                (unless unique (push elem res))
+                (unless unique
+                  (push elem res)
+                  (when (memq elem '(star point prefix))
+                    ;; Extract common suffix additionally to common prefix.
+                    ;; Only do it for `point', `star', and `prefix' since for
+                    ;; `any' it could lead to a merged completion that
+                    ;; doesn't itself match the candidates.
+                    (let ((suffix (completion--common-suffix comps)))
+                      (assert (stringp suffix))
+                      (unless (equal suffix "")
+                        (push suffix res)))))
                 (setq fixed "")))))
         ;; We return it in reverse order.
         res)))))
@@ -2037,8 +2140,7 @@ filter out additional entries (because TABLE migth not obey PRED)."
   (mapconcat (lambda (x) (cond
                      ((stringp x) x)
                      ((eq x 'star) "*")
-                     ((eq x 'any) "")
-                     ((eq x 'point) "")))
+                     (t "")))           ;any, point, prefix.
              pattern
              ""))
 
@@ -2080,6 +2182,7 @@ filter out additional entries (because TABLE migth not obey PRED)."
              (pointpat (or (memq 'point mergedpat)
                            (memq 'any   mergedpat)
                            (memq 'star  mergedpat)
+                           ;; Not `prefix'.
                           mergedpat))
              ;; New pos from the start.
              (newpos (length (completion-pcm--pattern->string pointpat)))
@@ -2097,7 +2200,38 @@ filter out additional entries (because TABLE migth not obey PRED)."
            'completion-pcm--filename-try-filter))
     (completion-pcm--merge-try pattern all prefix suffix)))
 
-;;; Initials completion
+;;; Substring completion
+;; Mostly derived from the code of `basic' completion.
+
+(defun completion-substring--all-completions (string table pred point)
+  (let* ((beforepoint (substring string 0 point))
+         (afterpoint (substring string point))
+         (bounds (completion-boundaries beforepoint table pred afterpoint))
+         (suffix (substring afterpoint (cdr bounds)))
+         (prefix (substring beforepoint 0 (car bounds)))
+         (basic-pattern (completion-basic--pattern
+                         beforepoint afterpoint bounds))
+         (pattern (if (not (stringp (car basic-pattern)))
+                      basic-pattern
+                    (cons 'prefix basic-pattern)))
+         (all (completion-pcm--all-completions prefix pattern table pred)))
+    (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)
+    (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)
+    (when all
+      (nconc (completion-pcm--hilit-commonality pattern all)
+             (length prefix)))))
+
+;; Initials completion
 ;; Complete /ums to /usr/monnier/src or lch to list-command-history.
 
 (defun completion-initials-expand (str table pred)
index 4b2e78a3137b4f4bec0407143b95918eef88e974..6f32a3eb90fa62a5aafedfe474033434e79beb92 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Maintainer: FSF
 ;; Keywords: convenience
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
index d7f4c9bd2228324a6c937be227543510981dd2aa..bd3054a5b941fcccba96d051dfcabb336f5f25b9 100644 (file)
 ;;   that the X primary selection is used.  Under other windowing systems,
 ;;   alternate functions are used, which simply store the selection value
 ;;   in a variable.
-;;
-;; * You can change the selection highlight face by altering the properties
-;;   of mouse-drag-overlay, eg.
-;;
-;;     (overlay-put mouse-drag-overlay 'face 'bold)
 
 ;;; Code:
 
@@ -293,8 +288,7 @@ primary selection and region."
   (overlay-put mouse-secondary-overlay 'face 'secondary-selection))
 
 (defconst mouse-sel-selection-alist
-  '((PRIMARY mouse-drag-overlay mouse-sel-primary-thing)
-    (SECONDARY mouse-secondary-overlay mouse-sel-secondary-thing))
+  '((SECONDARY mouse-secondary-overlay mouse-sel-secondary-thing))
   "Alist associating selections with variables.
 Each element is of the form:
 
index be63f1d73d2eab186ca576394b2d58d52fd4e76c..01f96e1ef86e12401afc72d247b6109d9c43b761 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Maintainer: FSF
 ;; Keywords: hardware, mouse
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
   :type 'boolean
   :group 'mouse)
 
-(defcustom mouse-drag-copy-region t
+(defcustom mouse-drag-copy-region nil
   "If non-nil, mouse drag copies region to kill-ring."
   :type 'boolean
-  :version "22.1"
+  :version "24.1"
   :group 'mouse)
 
 (defcustom mouse-1-click-follows-link 450
@@ -697,9 +698,6 @@ This should be bound to a mouse drag event."
        (window-system)
        (sit-for 1))
     (push-mark)
-    ;; If `select-active-regions' is non-nil, `set-mark' sets the
-    ;; primary selection to the buffer's region, overriding the role
-    ;; of `copy-region-as-kill'; that's why we did the copy first.
     (set-mark (point))
     (if (numberp end) (goto-char end))
     (mouse-set-region-1)))
@@ -772,13 +770,6 @@ Upon exit, point is at the far edge of the newly visible text."
     (or (eq window (selected-window))
        (goto-char opoint))))
 
-;; Create an overlay and immediately delete it, to get "overlay in no buffer".
-(defconst mouse-drag-overlay
-  (let ((ol (make-overlay (point-min) (point-min))))
-    (delete-overlay ol)
-    (overlay-put ol 'face 'region)
-    ol))
-
 (defvar mouse-selection-click-count 0)
 
 (defvar mouse-selection-click-count-buffer nil)
@@ -886,8 +877,7 @@ at the same position."
   (let (mp pos)
     (if (and mouse-1-click-follows-link
             (stringp msg)
-            (save-match-data
-              (string-match "^mouse-2" msg))
+            (string-match-p "\\`mouse-2" msg)
             (setq mp (mouse-pixel-position))
             (consp (setq pos (cdr mp)))
             (car pos) (>= (car pos) 0)
@@ -905,33 +895,14 @@ at the same position."
                    "mouse-1" (substring msg 7)))))))
   msg)
 
-(defun mouse-move-drag-overlay (ol start end mode)
-  (unless (= start end)
-    ;; Go to START first, so that when we move to END, if it's in the middle
-    ;; of intangible text, point jumps in the direction away from START.
-    ;; Don't do it if START=END otherwise a single click risks selecting
-    ;; a region if it's on intangible text.  This exception was originally
-    ;; only applied on entry to mouse-drag-region, which had the problem
-    ;; that a tiny move during a single-click would cause the intangible
-    ;; text to be selected.
-    (goto-char start)
-    (goto-char end)
-    (setq end (point)))
-  (let ((range (mouse-start-end start end mode)))
-    (move-overlay ol (car range) (nth 1 range))))
-
 (defun mouse-drag-track (start-event  &optional
                                      do-mouse-drag-region-post-process)
     "Track mouse drags by highlighting area between point and cursor.
-The region will be defined with mark and point, and the overlay
-will be deleted after return.  DO-MOUSE-DRAG-REGION-POST-PROCESS
-should only be used by mouse-drag-region."
+The region will be defined with mark and point.
+DO-MOUSE-DRAG-REGION-POST-PROCESS should only be used by
+`mouse-drag-region'."
   (mouse-minibuffer-check start-event)
   (setq mouse-selection-click-count-buffer (current-buffer))
-  ;; We must call deactivate-mark before repositioning point.
-  ;; Otherwise, for select-active-regions non-nil, we get the wrong
-  ;; selection if the user drags a region, clicks elsewhere to
-  ;; reposition point, then middle-clicks to paste the selection.
   (deactivate-mark)
   (let* ((original-window (selected-window))
          ;; We've recorded what we needed from the current buffer and
@@ -965,165 +936,146 @@ should only be used by mouse-drag-region."
         ;; 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))
+        (automatic-hscrolling nil)
+        event end end-point)
+
     (setq mouse-selection-click-count click-count)
     ;; In case the down click is in the middle of some intangible text,
     ;; use the end of that text, and put it in START-POINT.
     (if (< (point) start-point)
        (goto-char start-point))
     (setq start-point (point))
-    (if remap-double-click ;; Don't expand mouse overlay in links
+    (if remap-double-click
        (setq click-count 0))
-    (mouse-move-drag-overlay mouse-drag-overlay start-point start-point
-                             click-count)
-    (overlay-put mouse-drag-overlay 'window start-window)
-    (let (event end end-point last-end-point)
-      (track-mouse
-       (while (progn
-                (setq event (read-event))
-                 (or (mouse-movement-p event)
-                     (memq (car-safe event) '(switch-frame select-window))))
-          (if (memq (car-safe event) '(switch-frame select-window))
-             nil
-           ;; 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))
-             (redisplay))
-           (setq end (event-end event)
-                 end-point (posn-point end))
-           (if (numberp end-point)
-               (setq last-end-point end-point))
-
-           (cond
-            ;; Are we moving within the original window?
-            ((and (eq (posn-window end) start-window)
+
+    ;; Activate the region, using `mouse-start-end' to determine where
+    ;; to put point and mark (e.g., double-click will select a word).
+    (setq transient-mark-mode
+         (if (eq transient-mark-mode 'lambda)
+             '(only)
+           (cons 'only transient-mark-mode)))
+    (let ((range (mouse-start-end start-point start-point click-count)))
+      (push-mark (nth 0 range) t t)
+      (goto-char (nth 1 range)))
+
+    ;; Track the mouse until we get a non-movement event.
+    (track-mouse
+      (while (progn
+              (setq event (read-event))
+              (or (mouse-movement-p event)
+                  (memq (car-safe event) '(switch-frame select-window))))
+       (unless (memq (car-safe event) '(switch-frame select-window))
+         ;; 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))
+           (redisplay))
+         (setq end (event-end event)
+               end-point (posn-point end))
+         (if (and (eq (posn-window end) start-window)
                   (integer-or-marker-p end-point))
-              (mouse-move-drag-overlay mouse-drag-overlay start-point end-point click-count))
-
-            (t
-             (let ((mouse-row (cdr (cdr (mouse-position)))))
-                (cond
-                 ((null mouse-row))
-                 ((< mouse-row top)
-                  (mouse-scroll-subr start-window (- mouse-row top)
-                                     mouse-drag-overlay start-point))
-                 ((>= mouse-row bottom)
-                  (mouse-scroll-subr start-window (1+ (- mouse-row bottom))
-                                     mouse-drag-overlay start-point)))))))))
-
-      ;; In case we did not get a mouse-motion event
-      ;; for the final move of the mouse before a drag event
-      ;; pretend that we did get one.
-      (when (and (memq 'drag (event-modifiers (car-safe event)))
-                 (setq end (event-end event)
-                      end-point (posn-point end))
+             (mouse--drag-set-mark-and-point start-point
+                                             end-point click-count)
+           (let ((mouse-row (cdr (cdr (mouse-position)))))
+             (cond
+              ((null mouse-row))
+              ((< mouse-row top)
+               (mouse-scroll-subr start-window (- mouse-row top)
+                                  nil start-point))
+              ((>= mouse-row bottom)
+               (mouse-scroll-subr start-window (1+ (- mouse-row bottom))
+                                  nil start-point))))))))
+
+    ;; Handle the terminating event if possible.
+    (when (consp event)
+      ;; Ensure that point is on the end of the last event.
+      (when (and (setq end-point (posn-point (event-end event)))
                 (eq (posn-window end) start-window)
-                (integer-or-marker-p end-point))
-        (mouse-move-drag-overlay mouse-drag-overlay start-point end-point click-count))
-
-      ;; Handle the terminating event
-      (if (consp event)
-         (let* ((fun (key-binding (vector (car event))))
-                (do-multi-click   (and (> (event-click-count event) 0)
-                                       (functionp fun)
-                                       (not (memq fun
-                                                  '(mouse-set-point
-                                                    mouse-set-region))))))
-           ;; Run the binding of the terminating up-event, if possible.
-           (if (and (not (= (overlay-start mouse-drag-overlay)
-                            (overlay-end mouse-drag-overlay)))
-                    (not do-multi-click))
-               (let* ((stop-point
-                       (if (numberp (posn-point (event-end event)))
-                           (posn-point (event-end event))
-                         last-end-point))
-                      ;; The end that comes from where we ended the drag.
-                      ;; Point goes here.
-                      (region-termination
-                       (if (and stop-point (< stop-point start-point))
-                           (overlay-start mouse-drag-overlay)
-                         (overlay-end mouse-drag-overlay)))
-                      ;; The end that comes from where we started the drag.
-                      ;; Mark goes there.
-                      (region-commencement
-                       (- (+ (overlay-end mouse-drag-overlay)
-                             (overlay-start mouse-drag-overlay))
-                          region-termination))
-                      last-command this-command)
-                 ;; We copy the region before setting the mark so
-                 ;; that `select-active-regions' can override
-                 ;; `copy-region-as-kill'.
-                 (and mouse-drag-copy-region
-                      do-mouse-drag-region-post-process
-                      (let (deactivate-mark)
-                        (copy-region-as-kill region-commencement
-                                             region-termination)))
-                 (push-mark region-commencement t t)
-                 (goto-char region-termination)
-                 (if (not do-mouse-drag-region-post-process)
-                     ;; Skip all post-event handling, return immediately.
-                     (delete-overlay mouse-drag-overlay)
-                   (let ((buffer (current-buffer)))
-                     (mouse-show-mark)
-                     ;; mouse-show-mark can call read-event,
-                     ;; and that means the Emacs server could switch buffers
-                     ;; under us.  If that happened,
-                     ;; avoid trying to use the region.
-                     (and (mark t) mark-active
-                          (eq buffer (current-buffer))
-                          (mouse-set-region-1)))))
-              ;; Run the binding of the terminating up-event.
-             ;; If a multiple click is not bound to mouse-set-point,
-             ;; cancel the effects of mouse-move-drag-overlay to
-             ;; avoid producing wrong results.
-             (if do-multi-click (goto-char start-point))
-              (delete-overlay mouse-drag-overlay)
-              (when (and (functionp fun)
-                        (= start-hscroll (window-hscroll start-window))
-                        ;; Don't run the up-event handler if the
-                        ;; window start changed in a redisplay after
-                        ;; the mouse-set-point for the down-mouse
-                        ;; event at the beginning of this function.
-                        ;; When the window start has changed, the
-                        ;; up-mouse event will contain a different
-                        ;; position due to the new window contents,
-                        ;; and point is set again.
-                        (or end-point
-                            (= (window-start start-window)
-                               start-window-start)))
-               (when (and on-link
-                          (or (not end-point) (= end-point start-point))
-                          (consp event)
-                          (or remap-double-click
-                              (and
-                               (not (eq mouse-1-click-follows-link 'double))
-                               (= click-count 0)
-                               (= (event-click-count event) 1)
-                               (or (not (integerp mouse-1-click-follows-link))
-                                   (let ((t0 (posn-timestamp (event-start start-event)))
-                                         (t1 (posn-timestamp (event-end event))))
-                                     (and (integerp t0) (integerp t1)
-                                          (if (> mouse-1-click-follows-link 0)
-                                              (<= (- t1 t0) mouse-1-click-follows-link)
-                                            (< (- t0 t1) mouse-1-click-follows-link))))))))
-                 ;; If we rebind to mouse-2, reselect previous selected window,
-                 ;; so that the mouse-2 event runs in the same
-                 ;; situation as if user had clicked it directly.
-                 ;; Fixes the bug reported by juri@jurta.org on 2005-12-27.
-                 (if (or (vectorp on-link) (stringp on-link))
-                     (setq event (aref on-link 0))
-                   (select-window original-window)
-                   (setcar event 'mouse-2)
-                   ;; If this mouse click 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)))
-               (push event unread-command-events))))
-
-        ;; Case where the end-event is not a cons cell (it's just a boring
-        ;; char-key-press).
-       (delete-overlay mouse-drag-overlay)))))
+                (integer-or-marker-p end-point)
+                (/= start-point end-point))
+       (mouse--drag-set-mark-and-point start-point
+                                       end-point click-count))
+
+      ;; Find its binding.
+      (let* ((fun (key-binding (vector (car event))))
+            (do-multi-click (and (> (event-click-count event) 0)
+                                 (functionp fun)
+                                 (not (memq fun '(mouse-set-point
+                                                  mouse-set-region))))))
+       (if (and (/= (mark) (point))
+                (not do-multi-click))
+
+           ;; If point has moved, finish the drag.
+           (let* (last-command this-command)
+             (and mouse-drag-copy-region
+                  do-mouse-drag-region-post-process
+                  (let (deactivate-mark)
+                    (copy-region-as-kill (mark) (point)))))
+
+         ;; If point hasn't moved, run the binding of the
+         ;; terminating up-event.
+         (if do-multi-click
+             (goto-char start-point)
+           (deactivate-mark))
+         (when (and (functionp fun)
+                    (= start-hscroll (window-hscroll start-window))
+                    ;; Don't run the up-event handler if the window
+                    ;; start changed in a redisplay after the
+                    ;; mouse-set-point for the down-mouse event at
+                    ;; the beginning of this function.  When the
+                    ;; window start has changed, the up-mouse event
+                    ;; contains a different position due to the new
+                    ;; window contents, and point is set again.
+                    (or end-point
+                        (= (window-start start-window)
+                           start-window-start)))
+           (when (and on-link
+                      (= start-point (point))
+                      (mouse--remap-link-click-p start-event event))
+             ;; If we rebind to mouse-2, reselect previous selected
+             ;; window, so that the mouse-2 event runs in the same
+             ;; situation as if user had clicked it directly.  Fixes
+             ;; the bug reported by juri@jurta.org on 2005-12-27.
+             (if (or (vectorp on-link) (stringp on-link))
+                 (setq event (aref on-link 0))
+               (select-window original-window)
+               (setcar event 'mouse-2)
+               ;; If this mouse click 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)))
+           (push event unread-command-events)))))))
+
+(defun mouse--drag-set-mark-and-point (start click click-count)
+  (let* ((range (mouse-start-end start click click-count))
+        (beg (nth 0 range))
+        (end (nth 1 range)))
+    (cond ((eq (mark) beg)
+          (goto-char end))
+         ((eq (mark) end)
+          (goto-char beg))
+         ((< click (mark))
+          (set-mark end)
+          (goto-char beg))
+         (t
+          (set-mark beg)
+          (goto-char end)))))
+
+(defun mouse--remap-link-click-p (start-event end-event)
+  (or (and (eq mouse-1-click-follows-link 'double)
+          (= (event-click-count start-event) 2))
+      (and
+       (not (eq mouse-1-click-follows-link 'double))
+       (= (event-click-count start-event) 1)
+       (= (event-click-count end-event) 1)
+       (or (not (integerp mouse-1-click-follows-link))
+          (let ((t0 (posn-timestamp (event-start start-event)))
+                (t1 (posn-timestamp (event-end   end-event))))
+            (and (integerp t0) (integerp t1)
+                 (if (> mouse-1-click-follows-link 0)
+                     (<= (- t1 t0) mouse-1-click-follows-link)
+                   (< (- t0 t1) mouse-1-click-follows-link))))))))
+
 \f
 ;; Commands to handle xterm-style multiple clicks.
 (defun mouse-skip-word (dir)
@@ -1224,8 +1176,7 @@ If MODE is 2 then do the same for lines."
         ((= mode 2)
         (list (save-excursion
                 (goto-char start)
-                (beginning-of-line 1)
-                (point))
+                (line-beginning-position 1))
               (save-excursion
                 (goto-char end)
                 (forward-line 1)
@@ -1263,74 +1214,6 @@ If MODE is 2 then do the same for lines."
 
 ;; Momentarily show where the mark is, if highlighting doesn't show it.
 
-(defcustom mouse-region-delete-keys '([delete] [deletechar] [backspace])
-  "List of keys that should cause the mouse region to be deleted."
-  :group 'mouse
-  :type '(repeat key-sequence))
-
-(defun mouse-show-mark ()
-  (let ((inhibit-quit t)
-       (echo-keystrokes 0)
-       event events key ignore
-       (x-lost-selection-functions
-        (when (boundp 'x-lost-selection-functions)
-           (copy-sequence x-lost-selection-functions))))
-    (add-hook 'x-lost-selection-functions
-             (lambda (seltype)
-               (when (eq seltype 'PRIMARY)
-                  (setq ignore t)
-                  (throw 'mouse-show-mark t))))
-    (if transient-mark-mode
-       (delete-overlay mouse-drag-overlay)
-      (move-overlay mouse-drag-overlay (point) (mark t)))
-    (catch 'mouse-show-mark
-      ;; In this loop, execute scroll bar and switch-frame events.
-      ;; Should we similarly handle `select-window' events?  --Stef
-      ;; Also ignore down-events that are undefined.
-      (while (progn (setq event (read-event))
-                   (setq events (append events (list event)))
-                   (setq key (apply 'vector events))
-                   (or (and (consp event)
-                            (eq (car event) 'switch-frame))
-                       (and (consp event)
-                            (eq (posn-point (event-end event))
-                                'vertical-scroll-bar))
-                       (and (memq 'down (event-modifiers event))
-                            (not (key-binding key))
-                            (not (mouse-undouble-last-event events))
-                            (not (member key mouse-region-delete-keys)))))
-       (and (consp event)
-            (or (eq (car event) 'switch-frame)
-                (eq (posn-point (event-end event))
-                    'vertical-scroll-bar))
-            (let ((keys (vector 'vertical-scroll-bar event)))
-              (and (key-binding keys)
-                   (progn
-                     (call-interactively (key-binding keys)
-                                         nil keys)
-                     (setq events nil)))))))
-    ;; If we lost the selection, just turn off the highlighting.
-    (unless ignore
-      ;; For certain special keys, delete the region.
-      (if (member key mouse-region-delete-keys)
-         (progn
-           ;; Since notionally this is a separate command,
-           ;; run all the hooks that would be run if it were
-           ;; executed separately.
-           (run-hooks 'post-command-hook)
-           (setq last-command this-command)
-           (setq this-original-command 'delete-region)
-           (setq this-command (or (command-remapping this-original-command)
-                                  this-original-command))
-           (run-hooks 'pre-command-hook)
-           (call-interactively this-command))
-       ;; Otherwise, unread the key so it gets executed normally.
-       (setq unread-command-events
-             (nconc events unread-command-events))))
-    (setq quit-flag nil)
-    (unless transient-mark-mode
-      (delete-overlay mouse-drag-overlay))))
-
 (defun mouse-set-mark (click)
   "Set mark at the position clicked on with the mouse.
 Display cursor at that position for a second.
@@ -1365,9 +1248,7 @@ Also move point to one end of the text thus inserted (normally the end),
 and set mark at the beginning.
 Prefix arguments are interpreted as with \\[yank].
 If `mouse-yank-at-point' is non-nil, insert at point
-regardless of where you click.
-If `select-active-regions' is non-nil, the mark is deactivated
-before inserting the text."
+regardless of where you click."
   (interactive "e\nP")
   ;; Give temporary modes such as isearch a chance to turn off.
   (run-hooks 'mouse-leave-buffer-hook)
@@ -1388,15 +1269,23 @@ regardless of where you click."
   (interactive "e")
   ;; Give temporary modes such as isearch a chance to turn off.
   (run-hooks 'mouse-leave-buffer-hook)
+  ;; Without this, confusing things happen upon e.g. inserting into
+  ;; the middle of an active region.
   (when select-active-regions
-    ;; Without this, confusing things happen upon e.g. inserting into
-    ;; the middle of an active region.
-    (deactivate-mark))
+    (let (select-active-regions)
+      (deactivate-mark)))
   (or mouse-yank-at-point (mouse-set-point click))
-  (let ((primary (x-get-selection 'PRIMARY)))
+  (let ((primary
+        (cond
+         ((fboundp 'x-get-selection-value) ; MS-DOS and MS-Windows
+          (or (x-get-selection-value)
+              (x-get-selection 'PRIMARY)))
+         ;; FIXME: What about xterm-mouse-mode etc.?
+         (t
+          (x-get-selection 'PRIMARY)))))
     (if primary
-        (insert (x-get-selection 'PRIMARY))
-      (error "No primary selection"))))
+        (insert primary)
+      (error "No selection is available"))))
 
 (defun mouse-kill-ring-save (click)
   "Copy the region between point and the mouse click in the kill ring.
@@ -1404,15 +1293,13 @@ This does not delete the region; it acts like \\[kill-ring-save]."
   (interactive "e")
   (mouse-set-mark-fast click)
   (let (this-command last-command)
-    (kill-ring-save (point) (mark t)))
-  (mouse-show-mark))
+    (kill-ring-save (point) (mark t))))
 
 ;; This function used to delete the text between point and the mouse
 ;; whenever it was equal to the front of the kill ring, but some
 ;; people found that confusing.
 
-;; A list (TEXT START END), describing the text and position of the last
-;; invocation of mouse-save-then-kill.
+;; The position of the last invocation of `mouse-save-then-kill'.
 (defvar mouse-save-then-kill-posn nil)
 
 (defun mouse-save-then-kill-delete-region (beg end)
@@ -1450,100 +1337,76 @@ This does not delete the region; it acts like \\[kill-ring-save]."
   (undo-boundary))
 
 (defun mouse-save-then-kill (click)
-  "Save text to point in kill ring; the second time, kill the text.
-If the text between point and the mouse is the same as what's
-at the front of the kill ring, this deletes the text.
-Otherwise, it adds the text to the kill ring, like \\[kill-ring-save],
-which prepares for a second click to delete the text.
-
-If you have selected words or lines, this command extends the
-selection through the word or line clicked on.  If you do this
-again in a different position, it extends the selection again.
-If you do this twice in the same position, the selection is killed."
+  "Set the region according to CLICK; the second time, kill it.
+CLICK should be a mouse click event.
+
+If the region is inactive, activate it temporarily.  Set mark at
+the original point, and move point to the position of CLICK.
+
+If the region is already active, adjust it.  Normally, do this by
+moving point or mark, whichever is closer, to CLICK.  But if you
+have selected whole words or lines, move point or mark to the
+word or line boundary closest to CLICK instead.
+
+If this command is called a second consecutive time with the same
+CLICK position, kill the region."
   (interactive "e")
-  (let ((before-scroll
-        (with-current-buffer (window-buffer (posn-window (event-start click)))
-          point-before-scroll)))
-    (mouse-minibuffer-check click)
-    (let ((click-posn (posn-point (event-start click)))
-         ;; Don't let a subsequent kill command append to this one:
-         ;; prevent setting this-command to kill-region.
-         (this-command this-command))
-      (if (and (with-current-buffer
-                   (window-buffer (posn-window (event-start click)))
-                (and (mark t) (> (mod mouse-selection-click-count 3) 0)
-                     ;; Don't be fooled by a recent click in some other buffer.
-                     (eq mouse-selection-click-count-buffer
-                         (current-buffer)))))
-         (if (not (and (eq last-command 'mouse-save-then-kill)
-                       (equal click-posn
-                              (car (cdr-safe (cdr-safe mouse-save-then-kill-posn))))))
-             ;; Find both ends of the object selected by this click.
-             (let* ((range
-                     (mouse-start-end click-posn click-posn
-                                      mouse-selection-click-count)))
-               ;; Move whichever end is closer to the click.
-               ;; That's what xterm does, and it seems reasonable.
-               (if (< (abs (- click-posn (mark t)))
-                      (abs (- click-posn (point))))
-                   (set-mark (car range))
-                 (goto-char (nth 1 range)))
-               ;; We have already put the old region in the kill ring.
-               ;; Replace it with the extended region.
-               ;; (It would be annoying to make a separate entry.)
-               (kill-new (buffer-substring (point) (mark t)) t)
-               (mouse-set-region-1)
-               ;; Arrange for a repeated mouse-3 to kill this region.
-               (setq mouse-save-then-kill-posn
-                     (list (car kill-ring) (point) click-posn))
-               (mouse-show-mark))
-           ;; If we click this button again without moving it,
-           ;; that time kill.
-           (mouse-save-then-kill-delete-region (mark) (point))
-           (setq mouse-selection-click-count 0)
-           (setq mouse-save-then-kill-posn nil))
-       (if (and (eq last-command 'mouse-save-then-kill)
-                mouse-save-then-kill-posn
-                (eq (car mouse-save-then-kill-posn) (car kill-ring))
-                (equal (cdr mouse-save-then-kill-posn) (list (point) click-posn)))
-           ;; If this is the second time we've called
-           ;; mouse-save-then-kill, delete the text from the buffer.
-           (progn
-             (mouse-save-then-kill-delete-region (point) (mark))
-             ;; After we kill, another click counts as "the first time".
-             (setq mouse-save-then-kill-posn nil))
-         ;; This is not a repetition.
-         ;; We are adjusting an old selection or creating a new one.
-         (if (or (and (eq last-command 'mouse-save-then-kill)
-                      mouse-save-then-kill-posn)
-                 (and mark-active transient-mark-mode)
-                 (and (memq last-command
-                            '(mouse-drag-region mouse-set-region))
-                      (or mark-even-if-inactive
-                          (not transient-mark-mode))))
-             ;; We have a selection or suitable region, so adjust it.
-             (let* ((posn (event-start click))
-                    (new (posn-point posn)))
-               (select-window (posn-window posn))
-               (if (numberp new)
-                   (progn
-                     ;; Move whichever end of the region is closer to the click.
-                     ;; That is what xterm does, and it seems reasonable.
-                     (if (<= (abs (- new (point))) (abs (- new (mark t))))
-                         (goto-char new)
-                       (set-mark new))
-                     (setq deactivate-mark nil)))
-               (kill-new (buffer-substring (point) (mark t)) t))
-           ;; Set the mark where point is, then move where clicked.
-           (mouse-set-mark-fast click)
-           (if before-scroll
-               (goto-char before-scroll))
-           (exchange-point-and-mark)   ;Why??? --Stef
-           (kill-new (buffer-substring (point) (mark t))))
-          (mouse-show-mark)
-         (mouse-set-region-1)
-         (setq mouse-save-then-kill-posn
-               (list (car kill-ring) (point) click-posn)))))))
+  (mouse-minibuffer-check click)
+  (let* ((posn     (event-start click))
+        (click-pt (posn-point posn))
+        (window   (posn-window posn))
+        (buf      (window-buffer window))
+        ;; Don't let a subsequent kill command append to this one.
+        (this-command this-command)
+        ;; Check if the user has multi-clicked to select words/lines.
+        (click-count
+         (if (and (eq mouse-selection-click-count-buffer buf)
+                  (with-current-buffer buf (mark t)))
+             mouse-selection-click-count
+           0)))
+    (cond
+     ((not (numberp click-pt)) nil)
+     ;; If the user clicked without moving point, kill the region.
+     ;; This also resets `mouse-selection-click-count'.
+     ((and (eq last-command 'mouse-save-then-kill)
+          (eq click-pt mouse-save-then-kill-posn)
+          (eq window (selected-window)))
+      (kill-region (mark t) (point))
+      (setq mouse-selection-click-count 0)
+      (setq mouse-save-then-kill-posn nil))
+
+     ;; Otherwise, if there is a suitable region, adjust it by moving
+     ;; one end (whichever is closer) to CLICK-PT.
+     ((or (with-current-buffer buf (region-active-p))
+         (and (eq window (selected-window))
+              (mark t)
+              (or (and (eq last-command 'mouse-save-then-kill)
+                       mouse-save-then-kill-posn)
+                  (and (memq last-command '(mouse-drag-region
+                                            mouse-set-region))
+                       (or mark-even-if-inactive
+                           (not transient-mark-mode))))))
+      (select-window window)
+      (let* ((range (mouse-start-end click-pt click-pt click-count)))
+       (if (< (abs (- click-pt (mark t)))
+              (abs (- click-pt (point))))
+           (set-mark (car range))
+         (goto-char (nth 1 range)))
+       (setq deactivate-mark nil)
+       (mouse-set-region-1)
+       ;; Arrange for a repeated mouse-3 to kill the region.
+       (setq mouse-save-then-kill-posn click-pt)))
+
+     ;; Otherwise, set the mark where point is and move to CLICK-PT.
+     (t
+      (select-window window)
+      (mouse-set-mark-fast click)
+      (let ((before-scroll (with-current-buffer buf point-before-scroll)))
+       (if before-scroll (goto-char before-scroll)))
+      (exchange-point-and-mark)
+      (mouse-set-region-1)
+      (setq mouse-save-then-kill-posn click-pt)))))
+
 \f
 (global-set-key [M-mouse-1] 'mouse-start-secondary)
 (global-set-key [M-drag-mouse-1] 'mouse-set-secondary)
@@ -1623,9 +1486,6 @@ The function returns a non-nil value if it creates a secondary selection."
          ;; of one word or line.
          (let ((range (mouse-start-end start-point start-point click-count)))
            (set-marker mouse-secondary-start nil)
-            ;; Why the double move?  --Stef
-           ;; (move-overlay mouse-secondary-overlay 1 1
-           ;;            (window-buffer start-window))
            (move-overlay mouse-secondary-overlay (car range) (nth 1 range)
                          (window-buffer start-window)))
        ;; Single-press: cancel any preexisting secondary selection.
@@ -1693,7 +1553,7 @@ regardless of where you click."
   (or mouse-yank-at-point (mouse-set-point click))
   (let ((secondary (x-get-selection 'SECONDARY)))
     (if secondary
-        (insert (x-get-selection 'SECONDARY))
+        (insert secondary)
       (error "No secondary selection"))))
 
 (defun mouse-kill-secondary ()
@@ -1719,117 +1579,99 @@ is to prevent accidents."
   (delete-overlay mouse-secondary-overlay))
 
 (defun mouse-secondary-save-then-kill (click)
-  "Save text to point in kill ring; the second time, kill the text.
-You must use this in a buffer where you have recently done \\[mouse-start-secondary].
-If the text between where you did \\[mouse-start-secondary] and where
-you use this command matches the text at the front of the kill ring,
-this command deletes the text.
-Otherwise, it adds the text to the kill ring, like \\[kill-ring-save],
-which prepares for a second click with this command to delete the text.
-
-If you have already made a secondary selection in that buffer,
-this command extends or retracts the selection to where you click.
-If you do this again in a different position, it extends or retracts
-again.  If you do this twice in the same position, it kills the selection."
+  "Set the secondary selection and save it to the kill ring.
+The second time, kill it.  CLICK should be a mouse click event.
+
+If you have not called `mouse-start-secondary' in the clicked
+buffer, activate the secondary selection and set it between point
+and the click position CLICK.
+
+Otherwise, adjust the bounds of the secondary selection.
+Normally, do this by moving its beginning or end, whichever is
+closer, to CLICK.  But if you have selected whole words or lines,
+adjust to the word or line boundary closest to CLICK instead.
+
+If this command is called a second consecutive time with the same
+CLICK position, kill the secondary selection."
   (interactive "e")
   (mouse-minibuffer-check click)
-  (let ((posn (event-start click))
-       (click-posn (posn-point (event-start click)))
-       ;; Don't let a subsequent kill command append to this one:
-       ;; prevent setting this-command to kill-region.
-       (this-command this-command))
-    (or (eq (window-buffer (posn-window posn))
-           (or (overlay-buffer mouse-secondary-overlay)
-               (if mouse-secondary-start
-                   (marker-buffer mouse-secondary-start))))
-       (error "Wrong buffer"))
-    (with-current-buffer (window-buffer (posn-window posn))
-      (if (> (mod mouse-secondary-click-count 3) 0)
-         (if (not (and (eq last-command 'mouse-secondary-save-then-kill)
-                       (equal click-posn
-                              (car (cdr-safe (cdr-safe mouse-save-then-kill-posn))))))
-             ;; Find both ends of the object selected by this click.
-             (let* ((range
-                     (mouse-start-end click-posn click-posn
-                                      mouse-secondary-click-count)))
-               ;; Move whichever end is closer to the click.
-               ;; That's what xterm does, and it seems reasonable.
-               (if (< (abs (- click-posn (overlay-start mouse-secondary-overlay)))
-                      (abs (- click-posn (overlay-end mouse-secondary-overlay))))
-                   (move-overlay mouse-secondary-overlay (car range)
-                                 (overlay-end mouse-secondary-overlay))
-                 (move-overlay mouse-secondary-overlay
-                               (overlay-start mouse-secondary-overlay)
-                               (nth 1 range)))
-               ;; We have already put the old region in the kill ring.
-               ;; Replace it with the extended region.
-               ;; (It would be annoying to make a separate entry.)
-               (kill-new (buffer-substring
-                          (overlay-start mouse-secondary-overlay)
-                          (overlay-end mouse-secondary-overlay)) t)
-               ;; Arrange for a repeated mouse-3 to kill this region.
-               (setq mouse-save-then-kill-posn
-                     (list (car kill-ring) (point) click-posn)))
-           ;; If we click this button again without moving it,
-           ;; that time kill.
-           (progn
-             (mouse-save-then-kill-delete-region
-              (overlay-start mouse-secondary-overlay)
-              (overlay-end mouse-secondary-overlay))
-             (setq mouse-save-then-kill-posn nil)
-             (setq mouse-secondary-click-count 0)
-             (delete-overlay mouse-secondary-overlay)))
-       (if (and (eq last-command 'mouse-secondary-save-then-kill)
-                mouse-save-then-kill-posn
-                (eq (car mouse-save-then-kill-posn) (car kill-ring))
-                (equal (cdr mouse-save-then-kill-posn) (list (point) click-posn)))
-           ;; If this is the second time we've called
-           ;; mouse-secondary-save-then-kill, delete the text from the buffer.
-           (progn
-             (mouse-save-then-kill-delete-region
-              (overlay-start mouse-secondary-overlay)
-              (overlay-end mouse-secondary-overlay))
-             (setq mouse-save-then-kill-posn nil)
-             (delete-overlay mouse-secondary-overlay))
-         (if (overlay-start mouse-secondary-overlay)
-             ;; We have a selection, so adjust it.
-             (progn
-               (if (numberp click-posn)
-                   (progn
-                     ;; Move whichever end of the region is closer to the click.
-                     ;; That is what xterm does, and it seems reasonable.
-                     (if (< (abs (- click-posn (overlay-start mouse-secondary-overlay)))
-                            (abs (- click-posn (overlay-end mouse-secondary-overlay))))
-                         (move-overlay mouse-secondary-overlay click-posn
-                                       (overlay-end mouse-secondary-overlay))
-                       (move-overlay mouse-secondary-overlay
-                                     (overlay-start mouse-secondary-overlay)
-                                     click-posn))
-                     (setq deactivate-mark nil)))
-               (if (eq last-command 'mouse-secondary-save-then-kill)
-                   ;; If the front of the kill ring comes from
-                   ;; an immediately previous use of this command,
-                   ;; replace it with the extended region.
-                   ;; (It would be annoying to make a separate entry.)
-                   (kill-new (buffer-substring
-                              (overlay-start mouse-secondary-overlay)
-                              (overlay-end mouse-secondary-overlay)) t)
-                 (let (deactivate-mark)
-                   (copy-region-as-kill (overlay-start mouse-secondary-overlay)
-                                        (overlay-end mouse-secondary-overlay)))))
-           (if mouse-secondary-start
-               ;; All we have is one end of a selection,
-               ;; so put the other end here.
-               (let ((start (+ 0 mouse-secondary-start)))
-                 (kill-ring-save start click-posn)
-                  (move-overlay mouse-secondary-overlay start click-posn))))
-         (setq mouse-save-then-kill-posn
-               (list (car kill-ring) (point) click-posn))))
-      (if (overlay-buffer mouse-secondary-overlay)
-         (x-set-selection 'SECONDARY
-                          (buffer-substring
-                           (overlay-start mouse-secondary-overlay)
-                           (overlay-end mouse-secondary-overlay)))))))
+  (let* ((posn     (event-start click))
+        (click-pt (posn-point posn))
+        (window   (posn-window posn))
+        (buf      (window-buffer window))
+        ;; Don't let a subsequent kill command append to this one.
+        (this-command this-command)
+        ;; Check if the user has multi-clicked to select words/lines.
+        (click-count
+         (if (eq (overlay-buffer mouse-secondary-overlay) buf)
+             mouse-secondary-click-count
+           0))
+        (beg (overlay-start mouse-secondary-overlay))
+        (end (overlay-end mouse-secondary-overlay)))
+
+    (cond
+     ((not (numberp click-pt)) nil)
+
+     ;; If the secondary selection is not active in BUF, activate it.
+     ((not (eq buf (or (overlay-buffer mouse-secondary-overlay)
+                      (if mouse-secondary-start
+                          (marker-buffer mouse-secondary-start)))))
+      (select-window window)
+      (setq mouse-secondary-start (make-marker))
+      (move-marker mouse-secondary-start (point))
+      (move-overlay mouse-secondary-overlay (point) click-pt buf)
+      (kill-ring-save (point) click-pt))
+
+     ;; If the user clicked without moving point, delete the secondary
+     ;; selection.  This also resets `mouse-secondary-click-count'.
+     ((and (eq last-command 'mouse-secondary-save-then-kill)
+          (eq click-pt mouse-save-then-kill-posn)
+          (eq window (selected-window)))
+      (mouse-save-then-kill-delete-region beg end)
+      (delete-overlay mouse-secondary-overlay)
+      (setq mouse-secondary-click-count 0)
+      (setq mouse-save-then-kill-posn nil))
+
+     ;; Otherwise, if there is a suitable secondary selection overlay,
+     ;; adjust it by moving one end (whichever is closer) to CLICK-PT.
+     ((and beg (eq buf (overlay-buffer mouse-secondary-overlay)))
+      (let* ((range (mouse-start-end click-pt click-pt click-count)))
+       (if (< (abs (- click-pt beg))
+              (abs (- click-pt end)))
+           (move-overlay mouse-secondary-overlay (car range) end)
+         (move-overlay mouse-secondary-overlay beg (nth 1 range))))
+      (setq deactivate-mark nil)
+      (if (eq last-command 'mouse-secondary-save-then-kill)
+         ;; If the front of the kill ring comes from an immediately
+         ;; previous use of this command, replace the entry.
+         (kill-new
+          (buffer-substring (overlay-start mouse-secondary-overlay)
+                            (overlay-end mouse-secondary-overlay))
+          t)
+       (let (deactivate-mark)
+         (copy-region-as-kill (overlay-start mouse-secondary-overlay)
+                              (overlay-end mouse-secondary-overlay))))
+      (setq mouse-save-then-kill-posn click-pt))
+
+     ;; Otherwise, set the secondary selection overlay.
+     (t
+      (select-window window)
+      (if mouse-secondary-start
+         ;; All we have is one end of a selection, so put the other
+         ;; end here.
+         (let ((start (+ 0 mouse-secondary-start)))
+           (kill-ring-save start click-pt)
+           (move-overlay mouse-secondary-overlay start click-pt)))
+      (setq mouse-save-then-kill-posn click-pt))))
+
+  ;; Finally, set the window system's secondary selection.
+  (let (str)
+    (and (overlay-buffer mouse-secondary-overlay)
+        (setq str (buffer-substring (overlay-start mouse-secondary-overlay)
+                                    (overlay-end mouse-secondary-overlay)))
+        (> (length str) 0)
+        (x-set-selection 'SECONDARY str))))
+
 \f
 (defcustom mouse-buffer-menu-maxlen 20
   "Number of buffers in one pane (submenu) of the buffer menu.
@@ -2010,332 +1852,6 @@ and selects that window."
     ;; Few buffers--put them all in one pane.
     (list (cons title alist))))
 \f
-;; These need to be rewritten for the new scroll bar implementation.
-
-;;!! ;; Commands for the scroll bar.
-;;!!
-;;!! (defun mouse-scroll-down (click)
-;;!!   (interactive "@e")
-;;!!   (scroll-down (1+ (cdr (mouse-coords click)))))
-;;!!
-;;!! (defun mouse-scroll-up (click)
-;;!!   (interactive "@e")
-;;!!   (scroll-up (1+ (cdr (mouse-coords click)))))
-;;!!
-;;!! (defun mouse-scroll-down-full ()
-;;!!   (interactive "@")
-;;!!   (scroll-down nil))
-;;!!
-;;!! (defun mouse-scroll-up-full ()
-;;!!   (interactive "@")
-;;!!   (scroll-up nil))
-;;!!
-;;!! (defun mouse-scroll-move-cursor (click)
-;;!!   (interactive "@e")
-;;!!   (move-to-window-line (1+ (cdr (mouse-coords click)))))
-;;!!
-;;!! (defun mouse-scroll-absolute (event)
-;;!!   (interactive "@e")
-;;!!   (let* ((pos (car event))
-;;!!    (position (car pos))
-;;!!    (length (car (cdr pos))))
-;;!!     (if (<= length 0) (setq length 1))
-;;!!     (let* ((scale-factor (max 1 (/ length (/ 8000000 (buffer-size)))))
-;;!!      (newpos (* (/ (* (/ (buffer-size) scale-factor)
-;;!!                       position)
-;;!!                    length)
-;;!!                 scale-factor)))
-;;!!       (goto-char newpos)
-;;!!       (recenter '(4)))))
-;;!!
-;;!! (defun mouse-scroll-left (click)
-;;!!   (interactive "@e")
-;;!!   (scroll-left (1+ (car (mouse-coords click)))))
-;;!!
-;;!! (defun mouse-scroll-right (click)
-;;!!   (interactive "@e")
-;;!!   (scroll-right (1+ (car (mouse-coords click)))))
-;;!!
-;;!! (defun mouse-scroll-left-full ()
-;;!!   (interactive "@")
-;;!!   (scroll-left nil))
-;;!!
-;;!! (defun mouse-scroll-right-full ()
-;;!!   (interactive "@")
-;;!!   (scroll-right nil))
-;;!!
-;;!! (defun mouse-scroll-move-cursor-horizontally (click)
-;;!!   (interactive "@e")
-;;!!   (move-to-column (1+ (car (mouse-coords click)))))
-;;!!
-;;!! (defun mouse-scroll-absolute-horizontally (event)
-;;!!   (interactive "@e")
-;;!!   (let* ((pos (car event))
-;;!!    (position (car pos))
-;;!!    (length (car (cdr pos))))
-;;!!   (set-window-hscroll (selected-window) 33)))
-;;!!
-;;!! (global-set-key [scroll-bar mouse-1] 'mouse-scroll-up)
-;;!! (global-set-key [scroll-bar mouse-2] 'mouse-scroll-absolute)
-;;!! (global-set-key [scroll-bar mouse-3] 'mouse-scroll-down)
-;;!!
-;;!! (global-set-key [vertical-slider mouse-1] 'mouse-scroll-move-cursor)
-;;!! (global-set-key [vertical-slider mouse-2] 'mouse-scroll-move-cursor)
-;;!! (global-set-key [vertical-slider mouse-3] 'mouse-scroll-move-cursor)
-;;!!
-;;!! (global-set-key [thumbup mouse-1] 'mouse-scroll-up-full)
-;;!! (global-set-key [thumbup mouse-2] 'mouse-scroll-up-full)
-;;!! (global-set-key [thumbup mouse-3] 'mouse-scroll-up-full)
-;;!!
-;;!! (global-set-key [thumbdown mouse-1] 'mouse-scroll-down-full)
-;;!! (global-set-key [thumbdown mouse-2] 'mouse-scroll-down-full)
-;;!! (global-set-key [thumbdown mouse-3] 'mouse-scroll-down-full)
-;;!!
-;;!! (global-set-key [horizontal-scroll-bar mouse-1] 'mouse-scroll-left)
-;;!! (global-set-key [horizontal-scroll-bar mouse-2]
-;;!!           'mouse-scroll-absolute-horizontally)
-;;!! (global-set-key [horizontal-scroll-bar mouse-3] 'mouse-scroll-right)
-;;!!
-;;!! (global-set-key [horizontal-slider mouse-1]
-;;!!           'mouse-scroll-move-cursor-horizontally)
-;;!! (global-set-key [horizontal-slider mouse-2]
-;;!!           'mouse-scroll-move-cursor-horizontally)
-;;!! (global-set-key [horizontal-slider mouse-3]
-;;!!           'mouse-scroll-move-cursor-horizontally)
-;;!!
-;;!! (global-set-key [thumbleft mouse-1] 'mouse-scroll-left-full)
-;;!! (global-set-key [thumbleft mouse-2] 'mouse-scroll-left-full)
-;;!! (global-set-key [thumbleft mouse-3] 'mouse-scroll-left-full)
-;;!!
-;;!! (global-set-key [thumbright mouse-1] 'mouse-scroll-right-full)
-;;!! (global-set-key [thumbright mouse-2] 'mouse-scroll-right-full)
-;;!! (global-set-key [thumbright mouse-3] 'mouse-scroll-right-full)
-;;!!
-;;!! (global-set-key [horizontal-scroll-bar S-mouse-2]
-;;!!           'mouse-split-window-horizontally)
-;;!! (global-set-key [mode-line S-mouse-2]
-;;!!           'mouse-split-window-horizontally)
-;;!! (global-set-key [vertical-scroll-bar S-mouse-2]
-;;!!           'mouse-split-window)
-\f
-;;!! ;;;;
-;;!! ;;;; Here are experimental things being tested.  Mouse events
-;;!! ;;;; are of the form:
-;;!! ;;;;      ((x y) window screen-part key-sequence timestamp)
-;;!! ;;
-;;!! ;;;;
-;;!! ;;;; Dynamically track mouse coordinates
-;;!! ;;;;
-;;!! ;;
-;;!! ;;(defun track-mouse (event)
-;;!! ;;  "Track the coordinates, absolute and relative, of the mouse."
-;;!! ;;  (interactive "@e")
-;;!! ;;  (while mouse-grabbed
-;;!! ;;    (let* ((pos (read-mouse-position (selected-screen)))
-;;!! ;;           (abs-x (car pos))
-;;!! ;;           (abs-y (cdr pos))
-;;!! ;;           (relative-coordinate (coordinates-in-window-p
-;;!! ;;                                 (list (car pos) (cdr pos))
-;;!! ;;                                 (selected-window))))
-;;!! ;;      (if (consp relative-coordinate)
-;;!! ;;          (message "mouse: [%d %d], (%d %d)" abs-x abs-y
-;;!! ;;                   (car relative-coordinate)
-;;!! ;;                   (car (cdr relative-coordinate)))
-;;!! ;;        (message "mouse: [%d %d]" abs-x abs-y)))))
-;;!!
-;;!! ;;
-;;!! ;; Dynamically put a box around the line indicated by point
-;;!! ;;
-;;!! ;;
-;;!! ;;(require 'backquote)
-;;!! ;;
-;;!! ;;(defun mouse-select-buffer-line (event)
-;;!! ;;  (interactive "@e")
-;;!! ;;  (let ((relative-coordinate
-;;!! ;;         (coordinates-in-window-p (car event) (selected-window)))
-;;!! ;;        (abs-y (car (cdr (car event)))))
-;;!! ;;    (if (consp relative-coordinate)
-;;!! ;;        (progn
-;;!! ;;          (save-excursion
-;;!! ;;            (move-to-window-line (car (cdr relative-coordinate)))
-;;!! ;;            (x-draw-rectangle
-;;!! ;;             (selected-screen)
-;;!! ;;             abs-y 0
-;;!! ;;             (save-excursion
-;;!! ;;                 (move-to-window-line (car (cdr relative-coordinate)))
-;;!! ;;                 (end-of-line)
-;;!! ;;                 (push-mark nil t)
-;;!! ;;                 (beginning-of-line)
-;;!! ;;                 (- (region-end) (region-beginning))) 1))
-;;!! ;;          (sit-for 1)
-;;!! ;;          (x-erase-rectangle (selected-screen))))))
-;;!! ;;
-;;!! ;;(defvar last-line-drawn nil)
-;;!! ;;(defvar begin-delim "[^ \t]")
-;;!! ;;(defvar end-delim   "[^ \t]")
-;;!! ;;
-;;!! ;;(defun mouse-boxing (event)
-;;!! ;;  (interactive "@e")
-;;!! ;;  (save-excursion
-;;!! ;;    (let ((screen (selected-screen)))
-;;!! ;;      (while (= (x-mouse-events) 0)
-;;!! ;;        (let* ((pos (read-mouse-position screen))
-;;!! ;;               (abs-x (car pos))
-;;!! ;;               (abs-y (cdr pos))
-;;!! ;;               (relative-coordinate
-;;!! ;;                (coordinates-in-window-p `(,abs-x ,abs-y)
-;;!! ;;                                         (selected-window)))
-;;!! ;;               (begin-reg nil)
-;;!! ;;               (end-reg nil)
-;;!! ;;               (end-column nil)
-;;!! ;;               (begin-column nil))
-;;!! ;;          (if (and (consp relative-coordinate)
-;;!! ;;                   (or (not last-line-drawn)
-;;!! ;;                       (not (= last-line-drawn abs-y))))
-;;!! ;;              (progn
-;;!! ;;                (move-to-window-line (car (cdr relative-coordinate)))
-;;!! ;;                (if (= (following-char) 10)
-;;!! ;;                    ()
-;;!! ;;                  (progn
-;;!! ;;                    (setq begin-reg (1- (re-search-forward end-delim)))
-;;!! ;;                    (setq begin-column (1- (current-column)))
-;;!! ;;                    (end-of-line)
-;;!! ;;                    (setq end-reg (1+ (re-search-backward begin-delim)))
-;;!! ;;                    (setq end-column (1+ (current-column)))
-;;!! ;;                    (message "%s" (buffer-substring begin-reg end-reg))
-;;!! ;;                    (x-draw-rectangle screen
-;;!! ;;                                      (setq last-line-drawn abs-y)
-;;!! ;;                                      begin-column
-;;!! ;;                                      (- end-column begin-column) 1))))))))))
-;;!! ;;
-;;!! ;;(defun mouse-erase-box ()
-;;!! ;;  (interactive)
-;;!! ;;  (if last-line-drawn
-;;!! ;;      (progn
-;;!! ;;        (x-erase-rectangle (selected-screen))
-;;!! ;;        (setq last-line-drawn nil))))
-;;!!
-;;!! ;;; (defun test-x-rectangle ()
-;;!! ;;;   (use-local-mouse-map (setq rectangle-test-map (make-sparse-keymap)))
-;;!! ;;;   (define-key rectangle-test-map mouse-motion-button-left 'mouse-boxing)
-;;!! ;;;   (define-key rectangle-test-map mouse-button-left-up 'mouse-erase-box))
-;;!!
-;;!! ;;
-;;!! ;; Here is how to do double clicking in lisp.  About to change.
-;;!! ;;
-;;!!
-;;!! (defvar double-start nil)
-;;!! (defconst double-click-interval 300
-;;!!   "Max ticks between clicks")
-;;!!
-;;!! (defun double-down (event)
-;;!!   (interactive "@e")
-;;!!   (if double-start
-;;!!       (let ((interval (- (nth 4 event) double-start)))
-;;!!   (if (< interval double-click-interval)
-;;!!       (progn
-;;!!         (backward-up-list 1)
-;;!!         ;;      (message "Interval %d" interval)
-;;!!         (sleep-for 1)))
-;;!!   (setq double-start nil))
-;;!!     (setq double-start (nth 4 event))))
-;;!!
-;;!! (defun double-up (event)
-;;!!   (interactive "@e")
-;;!!   (and double-start
-;;!!        (> (- (nth 4 event ) double-start) double-click-interval)
-;;!!        (setq double-start nil)))
-;;!!
-;;!! ;;; (defun x-test-doubleclick ()
-;;!! ;;;   (use-local-mouse-map (setq doubleclick-test-map (make-sparse-keymap)))
-;;!! ;;;   (define-key doubleclick-test-map mouse-button-left 'double-down)
-;;!! ;;;   (define-key doubleclick-test-map mouse-button-left-up 'double-up))
-;;!!
-;;!! ;;
-;;!! ;; This scrolls while button is depressed.  Use preferable in scroll bar.
-;;!! ;;
-;;!!
-;;!! (defvar scrolled-lines 0)
-;;!! (defconst scroll-speed 1)
-;;!!
-;;!! (defun incr-scroll-down (event)
-;;!!   (interactive "@e")
-;;!!   (setq scrolled-lines 0)
-;;!!   (incremental-scroll scroll-speed))
-;;!!
-;;!! (defun incr-scroll-up (event)
-;;!!   (interactive "@e")
-;;!!   (setq scrolled-lines 0)
-;;!!   (incremental-scroll (- scroll-speed)))
-;;!!
-;;!! (defun incremental-scroll (n)
-;;!!   (while (= (x-mouse-events) 0)
-;;!!     (setq scrolled-lines (1+ (* scroll-speed scrolled-lines)))
-;;!!     (scroll-down n)
-;;!!     (sit-for 300 t)))
-;;!!
-;;!! (defun incr-scroll-stop (event)
-;;!!   (interactive "@e")
-;;!!   (message "Scrolled %d lines" scrolled-lines)
-;;!!   (setq scrolled-lines 0)
-;;!!   (sleep-for 1))
-;;!!
-;;!! ;;; (defun x-testing-scroll ()
-;;!! ;;;   (let ((scrolling-map (function mouse-vertical-scroll-bar-prefix)))
-;;!! ;;;     (define-key scrolling-map mouse-button-left 'incr-scroll-down)
-;;!! ;;;     (define-key scrolling-map mouse-button-right 'incr-scroll-up)
-;;!! ;;;     (define-key scrolling-map mouse-button-left-up 'incr-scroll-stop)
-;;!! ;;;     (define-key scrolling-map mouse-button-right-up 'incr-scroll-stop)))
-;;!!
-;;!! ;;
-;;!! ;; Some playthings suitable for picture mode?  They need work.
-;;!! ;;
-;;!!
-;;!! (defun mouse-kill-rectangle (event)
-;;!!   "Kill the rectangle between point and the mouse cursor."
-;;!!   (interactive "@e")
-;;!!   (let ((point-save (point)))
-;;!!     (save-excursion
-;;!!       (mouse-set-point event)
-;;!!       (push-mark nil t)
-;;!!       (if (> point-save (point))
-;;!!     (kill-rectangle (point) point-save)
-;;!!   (kill-rectangle point-save (point))))))
-;;!!
-;;!! (defun mouse-open-rectangle (event)
-;;!!   "Kill the rectangle between point and the mouse cursor."
-;;!!   (interactive "@e")
-;;!!   (let ((point-save (point)))
-;;!!     (save-excursion
-;;!!       (mouse-set-point event)
-;;!!       (push-mark nil t)
-;;!!       (if (> point-save (point))
-;;!!     (open-rectangle (point) point-save)
-;;!!   (open-rectangle point-save (point))))))
-;;!!
-;;!! ;; Must be a better way to do this.
-;;!!
-;;!! (defun mouse-multiple-insert (n char)
-;;!!   (while (> n 0)
-;;!!     (insert char)
-;;!!     (setq n (1- n))))
-;;!!
-;;!! ;; What this could do is not finalize until button was released.
-;;!!
-;;!! (defun mouse-move-text (event)
-;;!!   "Move text from point to cursor position, inserting spaces."
-;;!!   (interactive "@e")
-;;!!   (let* ((relative-coordinate
-;;!!     (coordinates-in-window-p (car event) (selected-window))))
-;;!!     (if (consp relative-coordinate)
-;;!!   (cond ((> (current-column) (car relative-coordinate))
-;;!!          (delete-char
-;;!!           (- (car relative-coordinate) (current-column))))
-;;!!         ((< (current-column) (car relative-coordinate))
-;;!!          (mouse-multiple-insert
-;;!!           (- (car relative-coordinate) (current-column)) " "))
-;;!!         ((= (current-column) (car relative-coordinate)) (ding))))))
-\f
 (define-obsolete-function-alias
   'mouse-choose-completion 'choose-completion "23.2")
 
@@ -2557,7 +2073,7 @@ choose a font."
 (global-set-key [left-fringe mouse-1]  'mouse-set-point)
 (global-set-key [right-fringe mouse-1] 'mouse-set-point)
 
-(global-set-key [mouse-2]      'mouse-yank-at-click)
+(global-set-key [mouse-2]      'mouse-yank-primary)
 ;; Allow yanking also when the corresponding cursor is "in the fringe".
 (global-set-key [right-fringe mouse-2] 'mouse-yank-at-click)
 (global-set-key [left-fringe mouse-2] 'mouse-yank-at-click)
@@ -2578,10 +2094,6 @@ choose a font."
                   (mouse-menu-bar-map)
                 (mouse-menu-major-mode-map)))))
 
-
-;; Replaced with dragging mouse-1
-;; (global-set-key [S-mouse-1] 'mouse-set-mark)
-
 ;; Binding mouse-1 to mouse-select-window when on mode-, header-, or
 ;; vertical-line prevents Emacs from signaling an error when the mouse
 ;; button is released after dragging these lines, on non-toolkit
index 23157635d981fe29485553137a33e009de0cb822..97c5573face3dde374f0a762c455483e6da17329 100644 (file)
 
 (eval-when-compile (require 'cl))
 
-;;; Backward compatibility.
-;; This code is meant for Emacs-CVS, so to get it to run on anything else,
-;; we need to define some more things.
-
-(unless (fboundp 'tool-bar-local-item)
-  (defun tool-bar-local-item (icon def key map &rest props)
-    (define-key-after map (vector key)
-      `(menu-item ,(symbol-name key) ,def
-                  :image ,(find-image
-                           `((:type xpm :file ,(concat icon ".xpm"))))
-                  ,@props))))
-
-(unless (fboundp 'process-put)
-  (defconst mpc-process-hash (make-hash-table :weakness 'key))
-  (defun process-put (proc prop val)
-    (let ((sym (gethash proc mpc-process-hash)))
-      (unless sym
-        (setq sym (puthash proc (make-symbol "mpc-proc-sym") mpc-process-hash)))
-      (put sym prop val)))
-  (defun process-get (proc prop)
-    (let ((sym (gethash proc mpc-process-hash)))
-      (when sym (get sym prop))))
-  (defun process-plist (proc)
-    (let ((sym (gethash proc mpc-process-hash)))
-      (when sym (symbol-plist sym)))))
-(unless (fboundp 'with-local-quit)
-  (defmacro with-local-quit (&rest body)
-    `(condition-case nil (let ((inhibit-quit nil)) ,@body)
-       (quit (setq quit-flag t) nil))))
-(unless (fboundp 'balance-windows-area)
-  (defalias 'balance-windows-area 'balance-windows))
-(unless (fboundp 'posn-object) (defalias 'posn-object 'ignore))
-(unless (fboundp 'buffer-local-value)
-  (defun buffer-local-value (var buf)
-    (with-current-buffer buf (symbol-value var))))
-
-
-;;; Main code starts here.
-
 (defgroup mpc ()
   "A Client for the Music Player Daemon."
   :prefix "mpc-"
   :group 'multimedia
   :group 'applications)
 
-(defcustom mpc-browser-tags '(Genre Artist Album Playlist)
+(defcustom mpc-browser-tags '(Genre Artist|Composer|Performer
+                              Album|Playlist)
   "Tags for which a browser buffer should be created by default."
-  :type '(repeat string))
+  ;; FIXME: provide a list of tags, for completion.
+  :type '(repeat symbol))
 
 ;;; Misc utils ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
@@ -620,6 +583,19 @@ Any call to `mpc-status-refresh' may cause it to be restarted."
 ;;                       (mpc--queue-head)))
 ;;           (message "MPC's queue is out of sync"))))))
 
+(defvar mpc--find-memoize-union-tags nil)
+
+(defun mpc-cmd-flush (tag value)
+  (puthash (cons tag value) nil mpc--find-memoize)
+  (dolist (uniontag mpc--find-memoize-union-tags)
+    (if (member (symbol-name tag) (split-string (symbol-name uniontag) "|"))
+        (puthash (cons uniontag value) nil mpc--find-memoize))))
+
+
+(defun mpc-cmd-special-tag-p (tag)
+  (or (memq tag '(Playlist Search Directory))
+      (string-match "|" (symbol-name tag))))
+
 (defun mpc-cmd-find (tag value)
   "Return a list of all songs whose tag TAG has value VALUE.
 The songs are returned as alists."
@@ -628,8 +604,12 @@ The songs are returned as alists."
                (cond
                 ((eq tag 'Playlist)
                  ;; Special case for pseudo-tag playlist.
-                 (let ((l (mpc-proc-buf-to-alists
-                           (mpc-proc-cmd (list "listplaylistinfo" value))))
+                 (let ((l (condition-case err
+                              (mpc-proc-buf-to-alists
+                               (mpc-proc-cmd (list "listplaylistinfo" value)))
+                            (mpc-proc-error
+                             ;; "[50@0] {listplaylistinfo} No such playlist"
+                             nil)))
                        (i 0))
                    (mapcar (lambda (s)
                              (prog1 (cons (cons 'Pos (number-to-string i)) s)
@@ -648,6 +628,14 @@ The songs are returned as alists."
                                         (if (eq (car pair) 'directory)
                                             nil pair))
                                       pairs)))))
+                ((string-match "|" (symbol-name tag))
+                 (add-to-list 'mpc--find-memoize-union-tags tag)
+                 (let ((tag1 (intern (substring (symbol-name tag)
+                                                0 (match-beginning 0))))
+                       (tag2 (intern (substring (symbol-name tag)
+                                                (match-end 0)))))
+                   (mpc-union (mpc-cmd-find tag1 value)
+                              (mpc-cmd-find tag2 value))))
                 (t
                  (condition-case err
                      (mpc-proc-buf-to-alists
@@ -675,7 +663,7 @@ The songs are returned as alists."
       (when other-tag
         (dolist (pl (prog1 pls (setq pls nil)))
           (let ((plsongs (mpc-cmd-find 'Playlist pl)))
-            (if (not (member other-tag '(Playlist Search Directory)))
+            (if (not (mpc-cmd-special-tag-p other-tag))
                 (when (member (cons other-tag value)
                               (apply 'append plsongs))
                   (push pl pls))
@@ -743,6 +731,14 @@ The songs are returned as alists."
    ;; useful that would be tho.
    ((eq tag 'Search) (error "Not supported"))
 
+   ((string-match "|" (symbol-name tag))
+    (let ((tag1 (intern (substring (symbol-name tag)
+                                   0 (match-beginning 0))))
+          (tag2 (intern (substring (symbol-name tag)
+                                   (match-end 0)))))
+      (mpc-union (mpc-cmd-list tag1 other-tag value)
+                 (mpc-cmd-list tag2 other-tag value))))
+
    ((null other-tag)
     (condition-case nil
         (mapcar 'cdr (mpc-proc-cmd-to-alist (list "list" (symbol-name tag))))
@@ -754,7 +750,7 @@ The songs are returned as alists."
        (mpc-assq-all tag (mpc-proc-cmd-to-alist "listallinfo")))))
    (t
     (condition-case nil
-        (if (member other-tag '(Search Playlist Directory))
+        (if (mpc-cmd-special-tag-p other-tag)
             (signal 'mpc-proc-error "Not implemented")
           (mapcar 'cdr
                   (mpc-proc-cmd-to-alist
@@ -801,7 +797,7 @@ If PLAYLIST is t or nil or missing, use the main playlist."
                              (list "add" file)))
                          files)))
     (if (stringp playlist)
-        (puthash (cons 'Playlist playlist) nil mpc--find-memoize)))
+        (mpc-cmd-flush 'Playlist playlist)))
 
 (defun mpc-cmd-delete (song-poss &optional playlist)
   "Delete the songs at positions SONG-POSS from PLAYLIST.
@@ -928,6 +924,10 @@ If PLAYLIST is t or nil or missing, use the main playlist."
 ;;; Formatter ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 (defun mpc-secs-to-time (secs)
+  ;; We could use `format-seconds', but it doesn't seem worth the trouble
+  ;; because we'd still need to check (>= secs (* 60 100)) since the special
+  ;; %z only allows us to drop the large units for small values but
+  ;; not to drop the small units for large values.
   (if (stringp secs) (setq secs (string-to-number secs)))
   (if (>= secs (* 60 100))              ;More than 100 minutes.
       (format "%dh%02d" ;"%d:%02d:%02d"
@@ -1432,6 +1432,20 @@ when constructing the set of constraints."
         (with-current-buffer buf (with-local-quit (mpc-tagbrowser-refresh)))))
     (with-local-quit (mpc-songs-refresh))))
 
+(defun mpc-tagbrowser-tag-name (tag)
+  (cond
+   ((string-match "|" (symbol-name tag))
+    (let ((tag1 (intern (substring (symbol-name tag)
+                                   0 (match-beginning 0))))
+          (tag2 (intern (substring (symbol-name tag)
+                                   (match-end 0)))))
+      (concat (mpc-tagbrowser-tag-name tag1)
+              " | "
+              (mpc-tagbrowser-tag-name tag2))))
+   ((string-match "y\\'" (symbol-name tag))
+    (concat (substring (symbol-name tag) 0 -1) "ies"))
+   (t (concat (symbol-name tag) "s"))))
+
 (defun mpc-tagbrowser-buf (tag)
   (let ((buf (mpc-proc-buffer (mpc-proc) tag)))
     (if (buffer-live-p buf) buf
@@ -1446,10 +1460,7 @@ when constructing the set of constraints."
           (insert mpc-tagbrowser-all-name "\n"))
         (forward-line -1)
         (setq mpc-tag tag)
-        (setq mpc-tag-name
-              (if (string-match "y\\'" (symbol-name tag))
-                  (concat (substring (symbol-name tag) 0 -1) "ies")
-                (concat (symbol-name tag) "s")))
+        (setq mpc-tag-name (mpc-tagbrowser-tag-name tag))
         (mpc-tagbrowser-all-select)
         (mpc-tagbrowser-refresh)
         buf))))
@@ -1858,20 +1869,22 @@ This is used so that they can be compared with `eq', which is needed for
                                  (mapcar (lambda (val)
                                            (mpc-cmd-find (car cst) val))
                                          (cdr cst)))))
-                (setq active (if (null active)
-                                 (progn
+                (setq active (cond
+                              ((null active)
                                    (if (eq (car cst) 'Playlist)
                                        (setq dontsort t))
                                    vals)
-                               (if (or dontsort
+                              ((or dontsort
                                        ;; Try to preserve ordering and
                                        ;; repetitions from playlists.
                                        (not (eq (car cst) 'Playlist)))
                                    (mpc-intersection active vals
-                                                     (lambda (x) (assq 'file x)))
+                                                 (lambda (x) (assq 'file x))))
+                              (t
                                  (setq dontsort t)
                                  (mpc-intersection vals active
-                                                   (lambda (x) (assq 'file x)))))))))
+                                                 (lambda (x)
+                                                   (assq 'file x)))))))))
           (mpc-select-save
             (erase-buffer)
             ;; Sorting songs is surprisingly difficult: when comparing two
@@ -1902,9 +1915,10 @@ This is used so that they can be compared with `eq', which is needed for
               ))
           (goto-char (point-min))
           (forward-line (car curline))
-          (when (or (search-forward (cdr curline) nil t)
+          (if (or (search-forward (cdr curline) nil t)
                     (search-backward (cdr curline) nil t))
-            (beginning-of-line))
+              (beginning-of-line)
+            (goto-char (point-min)))
           (set (make-local-variable 'mpc-songs-totaltime)
                (unless (zerop totaltime)
                  (list " " (mpc-secs-to-time totaltime))))
index c505833502abc6d6fa3820a80fe77e30131b3568..2fc84c062458f826f5d8aad6a6e96bb6183bef36 100644 (file)
@@ -4,6 +4,7 @@
 ;;   2008, 2009, 2010  Free Software Foundation, Inc.
 ;; Maintainer: William M. Perry <wmperry@gnu.org>
 ;; Keywords: mouse
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
@@ -246,6 +247,8 @@ This should only be bound to mouse buttons 4 and 5."
          (run-with-timer mouse-wheel-inhibit-click-time nil
                          'mwheel-inhibit-click-timeout))))
 
+(put 'mwheel-scroll 'scroll-command t)
+
 (defvar mwheel-installed-bindings nil)
 
 ;; preloaded ;;;###autoload
index 6e46838674905c5432d0b7fd2eda55f853a840cd..dcc6ddabcdcee85aa2fca84a1a9dde274dbeee02 100644 (file)
   "Accessing remote files and directories using FTP
    made as simple and transparent as possible."
   :group 'files
+  :group 'comm
   :prefix "ange-ftp-")
 
 (defcustom ange-ftp-name-format
@@ -1733,7 +1734,10 @@ good, skip, fatal, or unknown."
                      ange-ftp-gateway-tmp-name-template
                    ange-ftp-tmp-name-template)))
 
-(defalias 'ange-ftp-del-tmp-name 'delete-file)
+(defun ange-ftp-del-tmp-name (filename)
+  "Force to delete temporary file."
+  (delete-file filename))
+
 \f
 ;;;; ------------------------------------------------------------
 ;;;; Interactive gateway program support.
@@ -3503,8 +3507,9 @@ system TYPE.")
        (file-exists-p file)
       (ange-ftp-real-file-executable-p file))))
 
-(defun ange-ftp-delete-file (file)
-  (interactive "fDelete file: ")
+(defun ange-ftp-delete-file (file &optional trash)
+  (interactive (list (read-file-name "Delete file: " nil default-directory)
+                    (null current-prefix-arg)))
   (setq file (expand-file-name file))
   (let ((parsed (ange-ftp-ftp-name file)))
     (if parsed
@@ -3522,7 +3527,7 @@ system TYPE.")
                       (format "FTP Error: \"%s\"" (cdr result))
                       file)))
          (ange-ftp-delete-file-entry file))
-      (ange-ftp-real-delete-file file))))
+      (ange-ftp-real-delete-file file trash))))
 
 (defun ange-ftp-file-modtime (file)
   "Return the modification time of remote file FILE.
@@ -3826,7 +3831,8 @@ so return the size on the remote host exactly. See RFC 3659."
     (ange-ftp-call-cont cont result line)))
 
 (defun ange-ftp-copy-file (filename newname &optional ok-if-already-exists
-                                   keep-date preserve-uid-gid)
+                                   keep-date preserve-uid-gid
+                                   preserve-selinux-context)
   (interactive "fCopy file: \nFCopy %s to file: \np")
   (ange-ftp-copy-file-internal filename
                               newname
index 3a5fa8c30a682a2b1c1c601577c543d8fc39eaf7..fb9b57b724d65555809f0ec95182c8ed8ccbb174 100644 (file)
   "Use a web browser to look at a URL."
   :prefix "browse-url-"
   :link '(emacs-commentary-link "browse-url")
-  :group 'hypermedia)
+  :group 'external
+  :group 'comm)
 
 ;;;###autoload
 (defcustom browse-url-browser-function
@@ -312,8 +313,11 @@ Defaults to the value of `browse-url-mozilla-arguments' at the time
   :type '(repeat (string :tag "Argument"))
   :group 'browse-url)
 
-;;;###autoload
-(defcustom browse-url-firefox-program (purecopy "firefox")
+(defcustom browse-url-firefox-program
+  (let ((candidates '("firefox" "iceweasel")))
+    (while (and candidates (not (executable-find (car candidates))))
+      (setq candidates (cdr candidates)))
+    (or (car candidates) "firefox"))
   "The name by which to invoke Firefox."
   :type 'string
   :group 'browse-url)
@@ -330,8 +334,7 @@ Defaults to the value of `browse-url-firefox-arguments' at the time
   :type '(repeat (string :tag "Argument"))
   :group 'browse-url)
 
-;;;###autoload
-(defcustom browse-url-galeon-program (purecopy "galeon")
+(defcustom browse-url-galeon-program "galeon"
   "The name by which to invoke Galeon."
   :type 'string
   :group 'browse-url)
@@ -889,6 +892,7 @@ The order attempted is gnome-moz-remote, Mozilla, Firefox,
 Galeon, Konqueror, Netscape, Mosaic, Lynx in an xterm, and then W3."
   (apply
    (cond
+    ((browse-url-can-use-xdg-open) 'browse-url-xdg-open)
     ((executable-find browse-url-gnome-moz-program) 'browse-url-gnome-moz)
     ((executable-find browse-url-mozilla-program) 'browse-url-mozilla)
     ((executable-find browse-url-firefox-program) 'browse-url-firefox)
@@ -902,6 +906,41 @@ Galeon, Konqueror, Netscape, Mosaic, Lynx in an xterm, and then W3."
      (lambda (&rest ignore) (error "No usable browser found"))))
    url args))
 
+(defun browse-url-can-use-xdg-open ()
+  "Check if xdg-open can be used, i.e. we are on Gnome, KDE or xfce4."
+  (and (getenv "DISPLAY")
+       (executable-find "xdg-open")
+       ;; xdg-open may call gnome-open and that does not wait for its child
+       ;; to finish.  This child may then be killed when the parent dies.
+       ;; Use nohup to work around.
+       (executable-find "nohup")
+       (or (getenv "GNOME_DESKTOP_SESSION_ID")
+          ;; GNOME_DESKTOP_SESSION_ID is deprecated, check on Dbus also.
+          (condition-case nil
+              (eq 0 (call-process
+                     "dbus-send" nil nil nil
+                                 "--dest=org.gnome.SessionManager"
+                                 "--print-reply"
+                                 "/org/gnome/SessionManager"
+                                 "org.gnome.SessionManager.CanShutdown"))
+            (error nil))
+          (equal (getenv "KDE_FULL_SESSION") "true")
+          (condition-case nil
+              (eq 0 (call-process
+                     "/bin/sh" nil nil nil
+                     "-c"
+                     "xprop -root _DT_SAVE_MODE|grep xfce4"))
+            (error nil)))))
+
+
+;;;###autoload
+(defun browse-url-xdg-open (url &optional new-window)
+  (interactive (browse-url-interactive-arg "URL: "))
+  (call-process "/bin/sh" nil nil nil
+               "-c"
+               (concat "nohup xdg-open " url
+                       ">/dev/null 2>&1 </dev/null")))
+
 ;;;###autoload
 (defun browse-url-netscape (url &optional new-window)
   "Ask the Netscape WWW browser to load URL.
index 46cbb723d76ed3a6a86f2f180286e6671c006665..8d9512d6f9fd526663e71f42c907596e8b48c0e1 100644 (file)
@@ -39,6 +39,7 @@
 (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-debug)
 (defvar dbus-registered-objects-table)
 
 (defmacro dbus-ignore-errors (&rest body)
   "Execute BODY; signal D-Bus error when `dbus-debug' is non-nil.
 Otherwise, return result of last form in BODY, or all other errors."
+  (declare (indent 0) (debug t))
   `(condition-case err
        (progn ,@body)
      (dbus-error (when dbus-debug (signal (car err) (cdr err))))))
-
-(put 'dbus-ignore-errors 'lisp-indent-function 0)
-(put 'dbus-ignore-errors 'edebug-form-spec '(form body))
 (font-lock-add-keywords 'emacs-lisp-mode '("\\<dbus-ignore-errors\\>"))
 
 (defvar dbus-event-error-hooks nil
@@ -107,15 +106,12 @@ catched in `condition-case' by `dbus-error'.")
 \f
 ;;; Hash table of registered functions.
 
-;; We create it here.  So we have a simple test in dbusbind.c, whether
-;; the Lisp code has been loaded.
-(setq dbus-registered-objects-table (make-hash-table :test 'equal))
-
 (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 the
-symbol `:system' or the symbol `:session'.  SERIAL is the serial number
-of the reply message.  See `dbus-call-method-non-blocking-handler' and
+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'.")
 
 (defun dbus-list-hash-table ()
@@ -186,8 +182,8 @@ association to the service from D-Bus."
 
 (defun dbus-unregister-service (bus service)
   "Unregister all objects related to SERVICE from D-Bus BUS.
-BUS must be either the symbol `:system' or the symbol `:session'.
-SERVICE must be a known service name."
+BUS is either a Lisp symbol, `:system' or `:session', or a string
+denoting the bus address.  SERVICE must be a known service name."
   (maphash
    (lambda (key value)
      (dolist (elt value)
@@ -352,15 +348,15 @@ EVENT is a list which starts with symbol `dbus-event':
   (dbus-event BUS TYPE SERIAL SERVICE PATH INTERFACE MEMBER HANDLER &rest ARGS)
 
 BUS identifies the D-Bus the message is coming from.  It is
-either the symbol `:system' or the symbol `:session'.  TYPE is
-the D-Bus message type which has caused the event, SERIAL is the
-serial number of the received D-Bus message.  SERVICE and PATH
-are the unique name and the object path of the D-Bus object
-emitting the message.  INTERFACE and MEMBER denote the message
-which has been sent.  HANDLER is the function which has been
-registered for this message.  ARGS are the arguments passed to
-HANDLER, when it is called during event handling in
-`dbus-handle-event'.
+either a Lisp symbol, `:system' or `:session', or a string
+denoting the bus address.  TYPE is the D-Bus message type which
+has caused the event, SERIAL is the serial number of the received
+D-Bus message.  SERVICE and PATH are the unique name and the
+object path of the D-Bus object emitting the message.  INTERFACE
+and MEMBER denote the message which has been sent.  HANDLER is
+the function which has been registered for this message.  ARGS
+are the arguments passed to HANDLER, when it is called during
+event handling in `dbus-handle-event'.
 
 This function raises a `dbus-error' signal in case the event is
 not well formed."
@@ -368,7 +364,8 @@ not well formed."
   (unless (and (listp event)
               (eq (car event) 'dbus-event)
               ;; Bus symbol.
-              (symbolp (nth 1 event))
+              (or (symbolp (nth 1 event))
+                  (stringp (nth 1 event)))
               ;; Type.
               (and (natnump (nth 2 event))
                    (< dbus-message-type-invalid (nth 2 event)))
@@ -433,9 +430,10 @@ If the HANDLER returns a `dbus-error', it is propagated as return message."
 
 (defun dbus-event-bus-name (event)
   "Return the bus name the event is coming from.
-The result is either the symbol `:system' or the symbol `:session'.
-EVENT is a D-Bus event, see `dbus-check-event'.  This function
-raises a `dbus-error' signal in case the event is not well formed."
+The result is either a Lisp symbol, `:system' or `:session', or a
+string denoting the bus address.  EVENT is a D-Bus event, see
+`dbus-check-event'.  This function raises a `dbus-error' signal
+in case the event is not well formed."
   (dbus-check-event event)
   (nth 1 event))
 
@@ -565,10 +563,11 @@ apply
   "Return all interfaces and sub-nodes of SERVICE,
 registered at object path PATH at bus BUS.
 
-BUS must be either the symbol `:system' or the symbol `:session'.
-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."
+BUS is either a Lisp symbol, `:system' or `:session', or a string
+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.
@@ -869,10 +868,11 @@ name of the property, and its value.  If there are no properties,
        (add-to-list 'result (cons (car dict) (caadr dict)) 'append)))))
 
 (defun dbus-register-property
-  (bus service path interface property access value)
+  (bus service path interface property access value &optional emits-signal)
   "Register property PROPERTY on the D-Bus BUS.
 
-BUS is either the symbol `:system' or the symbol `:session'.
+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.  It must be a
 known name.
@@ -892,7 +892,9 @@ can be changed by `dbus-set-property'.
 
 The interface \"org.freedesktop.DBus.Properties\" is added to
 PATH, including a default handler for the \"Get\", \"GetAll\" and
-\"Set\" methods of this interface."
+\"Set\" methods of this interface.  When EMITS-SIGNAL is non-nil,
+the signal \"PropertiesChanged\" is sent when the property is
+changed by `dbus-set-property'."
   (unless (member access '(:read :readwrite))
     (signal 'dbus-error (list "Access type invalid" access)))
 
@@ -911,10 +913,23 @@ PATH, including a default handler for the \"Get\", \"GetAll\" and
   (dbus-register-method
    bus service path dbus-interface-properties "Set" 'dbus-property-handler)
 
+  ;; 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)))
+     '(: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))
-       (val (list (list nil service path (cons access value)))))
+       (val
+        (list
+         (list
+          nil service path
+          (cons
+           (if emits-signal (list access :emits-signal) (list access))
+           value)))))
     (puthash key val dbus-registered-objects-table)
 
     ;; Return the object.
@@ -924,6 +939,7 @@ PATH, including a default handler for the \"Get\", \"GetAll\" and
   "Default handler for the \"org.freedesktop.DBus.Properties\" interface.
 It will be registered for all objects created by `dbus-register-object'."
   (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))
        (method (dbus-event-member-name last-input-event))
        (interface (car args))
@@ -931,25 +947,40 @@ It will be registered for all objects created by `dbus-register-object'."
     (cond
      ;; "Get" returns a variant.
      ((string-equal method "Get")
-      (let ((val (gethash (list bus interface property)
-                         dbus-registered-objects-table)))
-       (when (string-equal path (nth 2 (car val)))
-         (list (list :variant (cdar (last (car val))))))))
+      (let ((entry (gethash (list bus interface property)
+                           dbus-registered-objects-table)))
+       (when (string-equal path (nth 2 (car entry)))
+         (list (list :variant (cdar (last (car entry))))))))
 
      ;; "Set" expects a variant.
      ((string-equal method "Set")
-      (let ((val (gethash (list bus interface property)
-                         dbus-registered-objects-table)))
-       (unless (consp (car (last (car val))))
+      (let* ((value (caar (cddr args)))
+            (entry (gethash (list 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
+            ;; PATH OBJECT).  OBJECT is a cons cell of a list, which
+            ;; contains a list of annotations (like :read,
+            ;; :read-write, :emits-signal), and the value of the
+            ;; property.
+            (object (car (last (car entry)))))
+       (unless (consp object)
          (signal 'dbus-error
                  (list "Property not registered at path" property path)))
-       (unless (equal (caar (last (car val))) :readwrite)
+       (unless (member :readwrite (car object))
          (signal 'dbus-error
                  (list "Property not writable at path" property path)))
        (puthash (list bus interface property)
-                (list (append (butlast (car val))
-                              (list (cons :readwrite (caar (cddr args))))))
+                (list (append (butlast (car entry))
+                              (list (cons (car object) value))))
                 dbus-registered-objects-table)
+       ;; Send the "PropertiesChanged" signal.
+       (when (member :emits-signal (car object))
+         (dbus-send-signal
+          bus service path dbus-interface-properties "PropertiesChanged"
+          (list (list :dict-entry property (list :variant value)))
+          '(:array)))
+       ;; Return empty reply.
        :ignore))
 
      ;; "GetAll" returns "a{sv}".
index 17973cfd94ffb1ab7b226501efd823ac3097393a..d3717371927d910df43861494e0a5d79f2eafefa 100644 (file)
@@ -101,7 +101,7 @@ If nil, /etc/resolv.conf and nslookup will be consulted.")
 
 (defun dns-read-string-name (string buffer)
   (with-temp-buffer
-    (set-buffer-multibyte nil)
+    (unless (featurep 'xemacs) (set-buffer-multibyte nil))
     (insert string)
     (goto-char (point-min))
     (dns-read-name buffer)))
@@ -135,7 +135,7 @@ If nil, /etc/resolv.conf and nslookup will be consulted.")
   "Write a DNS packet according to SPEC.
 If TCP-P, the first two bytes of the package with be the length field."
   (with-temp-buffer
-    (set-buffer-multibyte nil)
+    (unless (featurep 'xemacs) (set-buffer-multibyte nil))
     (dns-write-bytes (dns-get 'id spec) 2)
     (dns-write-bytes
      (logior
@@ -186,7 +186,7 @@ If TCP-P, the first two bytes of the package with be the length field."
 
 (defun dns-read (packet)
   (with-temp-buffer
-    (set-buffer-multibyte nil)
+    (unless (featurep 'xemacs) (set-buffer-multibyte nil))
     (let ((spec nil)
           queries answers authorities additionals)
       (insert packet)
@@ -263,7 +263,7 @@ If TCP-P, the first two bytes of the package with be the length field."
        (point (point)))
     (prog1
         (with-temp-buffer
-          (set-buffer-multibyte nil)
+         (unless (featurep 'xemacs) (set-buffer-multibyte nil))
           (insert string)
           (goto-char (point-min))
           (cond
@@ -391,7 +391,7 @@ If REVERSEP, look up an IP address."
   (if (not dns-servers)
       (message "No DNS server configuration found")
     (with-temp-buffer
-      (set-buffer-multibyte nil)
+      (unless (featurep 'xemacs) (set-buffer-multibyte nil))
       (let ((process (condition-case ()
                          (dns-make-network-process (car dns-servers))
                        (error
index fe41d70a090dd38afebee6fba460317ef7be15cf..962020f2b30c37d7685c0cf461678c85431dc37a 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Oscar Figueiredo <oscar@cpe.fr>
 ;; Maintainer: Pavel Janík <Pavel@Janik.cz>
 ;; Keywords: comm
+;; Package: eudc
 
 ;; This file is part of GNU Emacs.
 
index 7aa30cfcb668351c8642558a081e9acd4de6ae62..91abac571b87d005462f44c5dcc99dfb34a29db0 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Oscar Figueiredo <oscar@cpe.fr>
 ;; Maintainer: Pavel Janík <Pavel@Janik.cz>
 ;; Keywords: comm
+;; Package: eudc
 
 ;; This file is part of GNU Emacs.
 
index 5f165ad2e25dc0f932fe582719f7335f82584d98..7798fa43d9917370adf2579f24f4651481774e1d 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Oscar Figueiredo <oscar@cpe.fr>
 ;; Maintainer: Pavel Janík <Pavel@Janik.cz>
 ;; Keywords: comm
+;; Package: eudc
 
 ;; This file is part of GNU Emacs.
 
index 5f8de5ec75156905c2483f4c70df54f09c044418..3f82816fabe7426e9b2798c6743ae7584e3cefad 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Oscar Figueiredo <oscar@cpe.fr>
 ;; Maintainer: Pavel Janík <Pavel@Janik.cz>
 ;; Keywords: comm
+;; Package: eudc
 
 ;; This file is part of GNU Emacs.
 
index 0ddfa81a5011564f20976c67d6b758a31346ab48..aa4315077e4ef6c8473f74730fa4ce6d7acd2c82 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Oscar Figueiredo <oscar@cpe.fr>
 ;; Maintainer: Pavel Janík <Pavel@Janik.cz>
 ;; Keywords: comm
+;; Package: eudc
 
 ;; This file is part of GNU Emacs.
 
index fc90be96b5d9e77a78a3def6fad23c9de1d51d18..e2ca2acaddb0ba38df19fec6096071af24167139 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Oscar Figueiredo <oscar@cpe.fr>
 ;; Maintainer: Pavel Janík <Pavel@Janik.cz>
 ;; Keywords: comm
+;; Package: eudc
 
 ;; This file is part of GNU Emacs.
 
index 8705be81b04de16c38c4e6363490f38eff0e8686..d848b9953a3594eab5171aed28df455756ce7f2b 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: John Wiegley <johnw@newartisans.com>
 ;; Maintainer: FSF
 ;; Keywords: comm
+;; Package: eudc
 
 ;; This file is part of GNU Emacs.
 
index bd2e75ced0a6ab5114616b018c705fe637ed2c30..c0e4f81d31c1c96431951e06d06b402d890aa3b8 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Oscar Figueiredo <oscar@cpe.fr>
 ;; Maintainer: Pavel Janík <Pavel@Janik.cz>
 ;; Keywords: comm
+;; Package: eudc
 
 ;; This file is part of GNU Emacs.
 
index fd8c1061bcb60bf27576d571ef79928cb56bbc14..182758aaffb2cf10457b019e15a404b3a66e3d40 100644 (file)
@@ -76,7 +76,7 @@
 (defgroup goto-address nil
   "Click to browse URL or to send to e-mail address."
   :group 'mouse
-  :group 'hypermedia)
+  :group 'comm)
 
 
 ;; I don't expect users to want fontify'ing without highlighting.
index 9cbb919abcc14b9a0bd3c285f2c9b73d9842d401..5f57ea617ba8f75c477dba4fe834c36469bdb8ad 100644 (file)
@@ -3,7 +3,7 @@
 ;; Copyright (C) 1999, 2001, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
 
 ;; Author: Shuhei KOBAYASHI <shuhei@aqua.ocn.ne.jp>
-;; Keywords: HMAC, RFC-2104
+;; Keywords: HMAC, RFC2104
 
 ;; This file is part of GNU Emacs.
 
@@ -22,7 +22,7 @@
 
 ;;; Commentary:
 
-;; This program is implemented from RFC 2104,
+;; This program is implemented from RFC2104,
 ;; "HMAC: Keyed-Hashing for Message Authentication".
 
 ;;; Code:
index 9bda79d36f0d86498c349db91589d3eb73b2cd80..045a12520a16ad03e4df88fc84cee3e6818e2ea6 100644 (file)
@@ -3,7 +3,7 @@
 ;; Copyright (C) 1999, 2001, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
 
 ;; Author: Shuhei KOBAYASHI <shuhei@aqua.ocn.ne.jp>
-;; Keywords: HMAC, RFC-2104, HMAC-MD5, MD5, KEYED-MD5, CRAM-MD5
+;; Keywords: HMAC, RFC2104, HMAC-MD5, MD5, KEYED-MD5, CRAM-MD5
 
 ;; This file is part of GNU Emacs.
 
index a47822533e568840a292fc8fe95d8840eae33106..785b02a2d414e0ef5da4a7c22b0a3beaaec4692e 100644 (file)
@@ -267,7 +267,7 @@ See also `imap-log'."
   :type 'string)
 
 (defcustom imap-read-timeout (if (string-match
-                                 "windows-nt\\|os/2\\|emx\\|cygwin"
+                                 "windows-nt\\|os/2\\|cygwin"
                                  (symbol-name system-type))
                                 1.0
                               0.1)
@@ -475,10 +475,10 @@ sure of changing the value of `foo'."
       (setcdr alist (imap-remassoc key (cdr alist)))
       alist)))
 
-(defsubst imap-disable-multibyte ()
+(defmacro imap-disable-multibyte ()
   "Enable multibyte in the current buffer."
-  (when (fboundp 'set-buffer-multibyte)
-    (set-buffer-multibyte nil)))
+  (unless (featurep 'xemacs)
+    '(set-buffer-multibyte nil)))
 
 (defsubst imap-utf7-encode (string)
   (if imap-use-utf7
@@ -2095,7 +2095,7 @@ Return nil if no complete line has arrived."
        (while (setq end (imap-find-next-line))
          (save-restriction
            (narrow-to-region (point-min) end)
-           (delete-backward-char (length imap-server-eol))
+           (delete-char (- (length imap-server-eol)))
            (goto-char (point-min))
            (unwind-protect
                (cond ((eq imap-state 'initial)
index 3445b840df832a1ebc5cb5cb52b32fe58d8021b6..99278d9ee21e53b4f6e72f647591f228cd015dec 100644 (file)
@@ -4,6 +4,7 @@
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news
+;;
 ;;  Modularized by Ted Zlatanov <tzz@lifelogs.com>
 ;;  when it was part of Gnus.
 
index 5a8f1dff5c0facf0d0e4a4ab0a4092a12e0a75a2..590363a1f65754b3b22a9200f9f55b7bfa308a18 100644 (file)
@@ -8,6 +8,7 @@
 ;; URL:         http://www.nongnu.org/newsticker
 ;; Keywords:    News, RSS, Atom
 ;; Time-stamp:  "6. Dezember 2009, 19:15:32 (ulf)"
+;; Package:     newsticker
 
 ;; ======================================================================
 
index e1bdc2cade23656a406313a3d47eaced5d041d84..a6629a40721e140fcea6cd98225271a685c24948 100644 (file)
@@ -7,6 +7,7 @@
 ;; Filename:    newst-plainview.el
 ;; URL:         http://www.nongnu.org/newsticker
 ;; Time-stamp:  "6. Dezember 2009, 19:17:02 (ulf)"
+;; Package:     newsticker
 
 ;; ======================================================================
 
index ce468235b461e7692aa9fc45a10387ef7a9f3e89..25ed65d04aec934fcd8316f5baef5b063d3a0941 100644 (file)
@@ -7,6 +7,7 @@
 ;; Filename:    newst-reader.el
 ;; URL:         http://www.nongnu.org/newsticker
 ;; Time-stamp:  "6. Dezember 2009, 19:16:38 (ulf)"
+;; Package:     newsticker
 
 ;; ======================================================================
 
index 694d2cbc200c5e7cf09f5b9a7540038e3092f65f..80df1a14f23879c3da88634261b3be4bd2afaafb 100644 (file)
@@ -8,6 +8,7 @@
 ;; URL:         http://www.nongnu.org/newsticker
 ;; Keywords:    News, RSS, Atom
 ;; Time-stamp:  "6. Dezember 2009, 19:16:00 (ulf)"
+;; Package:     newsticker
 
 ;; ======================================================================
 
index 80bc2c70a1e816ccd850eba80257762ac9cc397d..6bf0b593de3fc22bc1054d861d813c33b0be389d 100644 (file)
@@ -8,6 +8,7 @@
 ;; Created:     2007
 ;; Keywords:    News, RSS, Atom
 ;; Time-stamp:  "6. Dezember 2009, 19:17:28 (ulf)"
+;; Package:     newsticker
 
 ;; ======================================================================
 
index 1d4b35bb61c0ef3b369629d5503b55d023fb2e87..2566529d42137d66b66206a3a43c7a0659697b01 100644 (file)
@@ -9,6 +9,7 @@
 ;; Created:     17. June 2003
 ;; Keywords:    News, RSS, Atom
 ;; Time-stamp:  "6. Dezember 2009, 19:15:18 (ulf)"
+;; Version:     1.99
 
 ;; ======================================================================
 
index 500f27851f6fda3e122c9635f4b849a1fee1a506..9af6057c20c2f1337052372e3f9e59bade22fff9 100644 (file)
@@ -1,6 +1,7 @@
 ;;; rcirc.el --- default, simple IRC client.
 
-;; Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010
+;;   Free Software Foundation, Inc.
 
 ;; Author: Ryan Yeske
 ;; URL: http://www.nongnu.org/rcirc
@@ -114,15 +115,15 @@ connected to automatically."
   :type 'string
   :group 'rcirc)
 
-(defcustom rcirc-default-user-name (user-login-name)
+(defcustom rcirc-default-user-name "user"
   "Your user name sent to the server when connecting."
+  :version "24.1"                       ; changed default
   :type 'string
   :group 'rcirc)
 
-(defcustom rcirc-default-full-name (if (string= (user-full-name) "")
-                                      rcirc-default-user-name
-                                    (user-full-name))
+(defcustom rcirc-default-full-name "unknown"
   "The full name sent to the server when connecting."
+  :version "24.1"                       ; changed default
   :type 'string
   :group 'rcirc)
 
@@ -375,6 +376,9 @@ and the cdr part is used for encoding."
 (defvar rcirc-nick-name-history nil
   "History variable for \\[rcirc] call.")
 
+(defvar rcirc-user-name-history nil
+  "History variable for \\[rcirc] call.")
+
 ;;;###autoload
 (defun rcirc (arg)
   "Connect to all servers in `rcirc-server-alist'.
@@ -399,8 +403,12 @@ If ARG is non-nil, instead prompt for connection parameters."
                                (or (plist-get server-plist :nick)
                                    rcirc-default-nick)
                                'rcirc-nick-name-history))
-             (password (read-passwd "IRC Password: "
-                                    (plist-get server-plist 'password)))
+            (user-name (read-string "IRC Username: "
+                                     (or (plist-get server-plist :user-name)
+                                         rcirc-default-user-name)
+                                     'rcirc-user-name-history))
+            (password (read-passwd "IRC Password: " nil
+                                    (plist-get server-plist :password)))
             (channels (split-string
                        (read-string "IRC Channels: "
                                     (mapconcat 'identity
@@ -408,11 +416,7 @@ If ARG is non-nil, instead prompt for connection parameters."
                                                           :channels)
                                                " "))
                        "[, ]+" t)))
-
-        (when (= 0 (length password))
-          (setq password nil))
-
-       (rcirc-connect server port nick rcirc-default-user-name
+       (rcirc-connect server port nick user-name
                       rcirc-default-full-name
                       channels password))
     ;; connect to servers in `rcirc-server-alist'
@@ -466,8 +470,8 @@ If ARG is non-nil, instead prompt for connection parameters."
 (defvar rcirc-process nil)
 
 ;;;###autoload
-(defun rcirc-connect (server &optional port nick user-name full-name
-                            startup-channels password)
+(defun rcirc-connect (server &optional port nick user-name
+                             full-name startup-channels password)
   (save-excursion
     (message "Connecting to %s..." server)
     (let* ((inhibit-eol-conversion)
@@ -520,8 +524,7 @@ If ARG is non-nil, instead prompt for connection parameters."
         (rcirc-send-string process (concat "PASS " password)))
       (rcirc-send-string process (concat "NICK " nick))
       (rcirc-send-string process (concat "USER " user-name
-                                      " hostname servername :"
-                                      full-name))
+                                         " 0 * :" full-name))
 
       ;; setup ping timer if necessary
       (unless rcirc-keepalive-timer
@@ -1339,6 +1342,12 @@ Logfiles are kept in `rcirc-log-directory'."
   :type 'integer
   :group 'rcirc)
 
+(defcustom rcirc-log-process-buffers nil
+  "Non-nil if rcirc process buffers should be logged to disk."
+  :group 'rcirc
+  :type 'boolean
+  :version "24.1")
+
 (defun rcirc-last-quit-line (process nick target)
   "Return the line number where NICK left TARGET.
 Returns nil if the information is not recorded."
@@ -1504,14 +1513,21 @@ record activity."
                                     (when (not (rcirc-channel-p rcirc-target))
                                       'nick)))
 
-       (when rcirc-log-flag
+       (when (and rcirc-log-flag
+                  (or target
+                      rcirc-log-process-buffers))
          (rcirc-log process sender response target text))
 
        (sit-for 0)                     ; displayed text before hook
        (run-hook-with-args 'rcirc-print-hooks
                            process sender response target text)))))
 
-(defcustom rcirc-log-filename-function 'rcirc-generate-new-buffer-name
+(defun rcirc-generate-log-filename (process target)
+  (if target
+      (rcirc-generate-new-buffer-name process target)
+    (process-name process)))
+
+(defcustom rcirc-log-filename-function 'rcirc-generate-log-filename
   "A function to generate the filename used by rcirc's logging facility.
 
 It is called with two arguments, PROCESS and TARGET (see
@@ -1648,6 +1664,31 @@ if NICK is also on `rcirc-ignore-list-automatic'."
            rcirc-ignore-list
            (delete nick rcirc-ignore-list))))
 \f
+(defun rcirc-nickname< (s1 s2)
+  "Return t if IRC nickname S1 is less than S2, and nil otherwise.
+Operator nicknames (@) are considered less than voiced
+nicknames (+).  Any other nicknames are greater than voiced
+nicknames.  The comparison is case-insensitive."
+  (setq s1 (downcase s1)
+        s2 (downcase s2))
+  (let* ((s1-op (eq ?@ (string-to-char s1)))
+         (s2-op (eq ?@ (string-to-char s2))))
+    (if s1-op
+        (if s2-op
+            (string< (substring s1 1) (substring s2 1))
+          t)
+      (if s2-op
+          nil
+        (string< s1 s2)))))
+
+(defun rcirc-sort-nicknames-join (input sep)
+  "Return a string of sorted nicknames.
+INPUT is a string containing nicknames separated by SEP.
+This function does not alter the INPUT string."
+  (let* ((parts (split-string input sep t))
+         (sorted (sort parts 'rcirc-nickname<)))
+    (mapconcat 'identity sorted sep)))
+\f
 ;;; activity tracking
 (defvar rcirc-track-minor-mode-map (make-sparse-keymap)
   "Keymap for rcirc track minor mode.")
@@ -2561,7 +2602,8 @@ keywords when no KEYWORD is given."
          (buffer (rcirc-get-temp-buffer-create process channel)))
     (with-current-buffer buffer
       (rcirc-print process sender "NAMES" channel
-                   (buffer-substring (point-min) (point-max))))
+                   (let ((content (buffer-substring (point-min) (point-max))))
+                    (rcirc-sort-nicknames-join content " "))))
     (kill-buffer buffer)))
 
 (defun rcirc-handler-433 (process sender args text)
index 1406abecdcb8a7e9b773ba886e6fea28b37e4901..fb3f3339be5a69ab42c910f882ec9da13e2bd30e 100644 (file)
@@ -249,7 +249,7 @@ If called with a positive, numeric prefix argument, e.g.
 ``\\[universal-argument] 1 M-x rlogin-directory-tracking-mode\'',
 then do directory tracking but assume the remote filesystem is the same as
 the local system.  This only works in general if the remote machine and the
-local one share the same directories (through NFS)."
+local one share the same directories (e.g. through NFS)."
   (interactive "P")
   (cond
    ((or (null prefix)
index 9faeded5c3bbd2a27a8749b96633615d329e0fe5..ca0d84f4752ae555e54a28dd2924c2af334b3ce4 100644 (file)
@@ -5,6 +5,7 @@
 ;; Author: Daiki Ueno <ueno@unixuser.org>
 ;;     Kenichi OKADA <okada@opaopa.org>
 ;; Keywords: SASL, CRAM-MD5
+;; Package: sasl
 
 ;; This file is part of GNU Emacs.
 
index 4d839296c9ffdaf7bcd05459c126464f4c22a1c4..8e91a95d63cfa97c7444e0a31166adaacfa61c84 100644 (file)
@@ -5,6 +5,7 @@
 ;; Author: Daiki Ueno <ueno@unixuser.org>
 ;;     Kenichi OKADA <okada@opaopa.org>
 ;; Keywords: SASL, DIGEST-MD5
+;; Package: sasl
 
 ;; This file is part of GNU Emacs.
 
index 94366f1a52a094bb5aa1a2fcaacaee4d982d8690..e9622526868323940ec74033e4f0e8c753385095 100644 (file)
@@ -6,6 +6,7 @@
 ;; Keywords: SASL, NTLM
 ;; Version: 1.00
 ;; Created: February 2001
+;; Package: sasl
 
 ;; This file is part of GNU Emacs.
 
diff --git a/lisp/net/secrets.el b/lisp/net/secrets.el
new file mode 100644 (file)
index 0000000..4487407
--- /dev/null
@@ -0,0 +1,862 @@
+;;; secrets.el --- Client interface to gnome-keyring and kwallet.
+
+;; Copyright (C) 2010 Free Software Foundation, Inc.
+
+;; Author: Michael Albinus <michael.albinus@gmx.de>
+;; Keywords: comm password passphrase
+
+;; 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:
+
+;; This package provides an implementation of the Secret Service API
+;; <http://www.freedesktop.org/wiki/Specifications/secret-storage-spec>.
+;; This API is meant to make GNOME-Keyring- and KWallet-like daemons
+;; available under a common D-BUS interface and thus increase
+;; interoperability between GNOME, KDE and other applications having
+;; the need to securely store passwords and other confidential
+;; information.
+
+;; In order to activate this package, you must add the following code
+;; into your .emacs:
+;;
+;;   (require 'secrets)
+;;
+;; Afterwards, the variable `secrets-enabled' is non-nil when there is
+;; a daemon providing this interface.
+
+;; The atomic objects to be managed by the Secret Service API are
+;; secret items, which are something an application wishes to store
+;; securely.  A good example is a password that an application needs
+;; to save and use at a later date.
+
+;; Secret items are grouped in collections.  A collection is similar
+;; in concept to the terms 'keyring' or 'wallet'.  A common collection
+;; is called "login".  A collection is stored permanently under the
+;; user's permissions, and can be accessed in a user session context.
+
+;; A collection can have an alias name.  The use case for this is to
+;; set the alias "default" for a given collection, making it
+;; transparent for clients, which collection is used.  Other aliases
+;; are not supported (yet).  Since an alias is visible to all
+;; applications, this setting shall be performed with care.
+
+;; A list of all available collections is available by
+;;
+;;   (secrets-list-collections)
+;;    => ("session" "login" "ssh keys")
+
+;; The "default" alias could be set to the "login" collection by
+;;
+;;   (secrets-set-alias "login" "default")
+
+;; An alias can also be dereferenced
+;;
+;;   (secrets-get-alias "default")
+;;    => "login"
+
+;; Collections can be created and deleted.  As already said,
+;; collections are used by different applications.  Therefore, those
+;; operations shall also be performed with care.  Common collections,
+;; like "login", shall not be changed except adding or deleting secret
+;; items.
+;;
+;;   (secrets-delete-collection "my collection")
+;;   (secrets-create-collection "my collection")
+
+;; There exists a special collection called "session", which has the
+;; lifetime of the corrresponding client session (aka Emacs'
+;; lifetime).  It is created automatically when Emacs uses the Secret
+;; Service interface, and it is deleted when Emacs is killed.
+;; Therefore, it can be used to store and retrieve secret items
+;; temporarily.  This shall be preferred over creation of a persistent
+;; collection, when the information shall not live longer than Emacs.
+;; The session collection can be addressed either by the string
+;; "session", or by `nil', whenever a collection parameter is needed.
+
+;; As already said, a collection is a group of secret items.  A secret
+;; item has a label, the "secret" (which is a string), and a set of
+;; lookup attributes.  The attributes can be used to search and
+;; retrieve a secret item at a later date.
+
+;; A list of all available secret items of a collection is available by
+;;
+;;   (secrets-list-items "my collection")
+;;    => ("this item" "another item")
+
+;; Secret items can be added or deleted to a collection.  In the
+;; following examples, we use the special collection "session", which
+;; is bound to Emacs' lifetime.
+;;
+;;   (secrets-delete-item "session" "my item")
+;;   (secrets-create-item "session" "my item" "geheim"
+;;                        :user "joe" :host "remote-host")
+
+;; The string "geheim" is the secret of the secret item "my item".
+;; The secret string can be retrieved from items:
+;;
+;;   (secrets-get-secret "session" "my item")
+;;    => "geheim"
+
+;; The lookup attributes, which are specified during creation of a
+;; secret item, must be a key-value pair.  Keys are keyword symbols,
+;; starting with a colon; values are strings.  They can be retrieved
+;; from a given secret item:
+;;
+;;   (secrets-get-attribute "session" "my item" :host)
+;;    => "remote-host"
+;;
+;;   (secrets-get-attributes "session" "my item")
+;;    => ((:user . "joe") (:host ."remote-host"))
+
+;; The lookup attributes can be used for searching of items.  If you,
+;; for example, are looking for all secret items for the user "joe",
+;; you would perform
+;;
+;;   (secrets-search-items "session" :user "joe")
+;;    => ("my item" "another item")
+
+;; Interactively, collections, items and their attributes could be
+;; inspected by the command `secrets-show-secrets'.
+
+;;; Code:
+
+;; It has been tested with GNOME Keyring 2.29.92.  An implementation
+;; for KWallet will be available at
+;; svn://anonsvn.kde.org/home/kde/trunk/playground/base/ksecretservice;
+;; not tested yet.
+
+;; 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)
+
+(autoload 'tree-widget-set-theme "tree-widget")
+(autoload 'widget-create-child-and-convert "wid-edit")
+(autoload 'widget-default-value-set "wid-edit")
+(autoload 'widget-field-end "wid-edit")
+(autoload 'widget-member "wid-edit")
+(defvar tree-widget-after-toggle-functions)
+
+(defvar secrets-enabled nil
+  "Whether there is a daemon offering the Secret Service API.")
+
+(defvar secrets-debug t
+  "Write debug messages")
+
+(defconst secrets-service "org.freedesktop.secrets"
+  "The D-Bus name used to talk to Secret Service.")
+
+(defconst secrets-path "/org/freedesktop/secrets"
+  "The D-Bus root object path used to talk to Secret Service.")
+
+(defconst secrets-empty-path "/"
+  "The D-Bus object path representing an empty object.")
+
+(defsubst secrets-empty-path (path)
+  "Check, whether PATH is a valid object path.
+It returns t if not."
+  (or (not (stringp path))
+      (string-equal path secrets-empty-path)))
+
+(defconst secrets-interface-service "org.freedesktop.Secret.Service"
+  "The D-Bus interface managing sessions and collections.")
+
+;; <interface name="org.freedesktop.Secret.Service">
+;;   <property name="Collections" type="ao" access="read"/>
+;;   <method name="OpenSession">
+;;     <arg name="algorithm" type="s" direction="in"/>
+;;     <arg name="input"     type="v" direction="in"/>
+;;     <arg name="output"    type="v" direction="out"/>
+;;     <arg name="result"    type="o" direction="out"/>
+;;   </method>
+;;   <method name="CreateCollection">
+;;     <arg name="props"      type="a{sv}" direction="in"/>
+;;     <arg name="collection" type="o"     direction="out"/>
+;;     <arg name="prompt"     type="o"     direction="out"/>
+;;   </method>
+;;   <method name="SearchItems">
+;;     <arg name="attributes" type="a{ss}" direction="in"/>
+;;     <arg name="unlocked"   type="ao"    direction="out"/>
+;;     <arg name="locked"     type="ao"    direction="out"/>
+;;   </method>
+;;   <method name="Unlock">
+;;     <arg name="objects"  type="ao" direction="in"/>
+;;     <arg name="unlocked" type="ao" direction="out"/>
+;;     <arg name="prompt"   type="o"  direction="out"/>
+;;   </method>
+;;   <method name="Lock">
+;;     <arg name="objects" type="ao" direction="in"/>
+;;     <arg name="locked"  type="ao" direction="out"/>
+;;     <arg name="Prompt"  type="o"  direction="out"/>
+;;   </method>
+;;   <method name="GetSecrets">
+;;     <arg name="items"   type="ao"          direction="in"/>
+;;     <arg name="session" type="o"           direction="in"/>
+;;     <arg name="secrets" type="a{o(oayay)}" direction="out"/>
+;;   </method>
+;;   <method name="ReadAlias">
+;;     <arg name="name"       type="s" direction="in"/>
+;;     <arg name="collection" type="o" direction="out"/>
+;;   </method>
+;;   <method name="SetAlias">
+;;     <arg name="name"       type="s" direction="in"/>
+;;     <arg name="collection" type="o" direction="in"/>
+;;   </method>
+;;   <signal name="CollectionCreated">
+;;     <arg name="collection" type="o"/>
+;;   </signal>
+;;   <signal name="CollectionDeleted">
+;;     <arg name="collection" type="o"/>
+;;   </signal>
+;; </interface>
+
+(defconst secrets-interface-collection "org.freedesktop.Secret.Collection"
+  "A collection of items containing secrets.")
+
+;; <interface name="org.freedesktop.Secret.Collection">
+;;   <property name="Items"    type="ao" access="read"/>
+;;   <property name="Label"    type="s"  access="readwrite"/>
+;;   <property name="Locked"   type="s"  access="read"/>
+;;   <property name="Created"  type="t"  access="read"/>
+;;   <property name="Modified" type="t"  access="read"/>
+;;   <method name="Delete">
+;;     <arg name="prompt" type="o" direction="out"/>
+;;   </method>
+;;   <method name="SearchItems">
+;;     <arg name="attributes" type="a{ss}" direction="in"/>
+;;     <arg name="results"    type="ao"    direction="out"/>
+;;   </method>
+;;   <method name="CreateItem">
+;;     <arg name="props"   type="a{sv}"   direction="in"/>
+;;     <arg name="secret"  type="(oayay)" direction="in"/>
+;;     <arg name="replace" type="b"       direction="in"/>
+;;     <arg name="item"    type="o"       direction="out"/>
+;;     <arg name="prompt"  type="o"       direction="out"/>
+;;   </method>
+;;   <signal name="ItemCreated">
+;;     <arg name="item" type="o"/>
+;;   </signal>
+;;   <signal name="ItemDeleted">
+;;     <arg name="item" type="o"/>
+;;   </signal>
+;;   <signal name="ItemChanged">
+;;     <arg name="item" type="o"/>
+;;   </signal>
+;; </interface>
+
+(defconst secrets-session-collection-path
+  "/org/freedesktop/secrets/collection/session"
+  "The D-Bus temporary session collection object path.")
+
+(defconst secrets-interface-prompt "org.freedesktop.Secret.Prompt"
+  "A session tracks state between the service and a client application.")
+
+;; <interface name="org.freedesktop.Secret.Prompt">
+;;   <method name="Prompt">
+;;     <arg name="window-id" type="s" direction="in"/>
+;;   </method>
+;;   <method name="Dismiss"></method>
+;;   <signal name="Completed">
+;;     <arg name="dismissed" type="b"/>
+;;     <arg name="result"    type="v"/>
+;;   </signal>
+;; </interface>
+
+(defconst secrets-interface-item "org.freedesktop.Secret.Item"
+  "A collection of items containing secrets.")
+
+;; <interface name="org.freedesktop.Secret.Item">
+;;   <property name="Locked"     type="b"     access="read"/>
+;;   <property name="Attributes" type="a{ss}" access="readwrite"/>
+;;   <property name="Label"      type="s"     access="readwrite"/>
+;;   <property name="Created"    type="t"     access="read"/>
+;;   <property name="Modified"   type="t"     access="read"/>
+;;   <method name="Delete">
+;;     <arg name="prompt" type="o" direction="out"/>
+;;   </method>
+;;   <method name="GetSecret">
+;;     <arg name="session" type="o"       direction="in"/>
+;;     <arg name="secret"  type="(oayay)" direction="out"/>
+;;   </method>
+;;   <method name="SetSecret">
+;;     <arg name="secret" type="(oayay)" direction="in"/>
+;;   </method>
+;; </interface>
+;;
+;; STRUCT      secret
+;;   OBJECT PATH  session
+;;   ARRAY BYTE          parameters
+;;   ARRAY BYTE          value
+
+(defconst secrets-interface-item-type-generic "org.freedesktop.Secret.Generic"
+  "The default item type we are using.")
+
+(defconst secrets-interface-session "org.freedesktop.Secret.Session"
+  "A session tracks state between the service and a client application.")
+
+;; <interface name="org.freedesktop.Secret.Session">
+;;   <method name="Close"></method>
+;; </interface>
+
+;;; Sessions.
+
+(defvar secrets-session-path secrets-empty-path
+  "The D-Bus session path of the active session.
+A session path `secrets-empty-path' indicates there is no open session.")
+
+(defun secrets-close-session ()
+  "Close the secret service session, if any."
+  (dbus-ignore-errors
+    (dbus-call-method
+     :session secrets-service secrets-session-path
+     secrets-interface-session "Close"))
+  (setq secrets-session-path secrets-empty-path))
+
+(defun secrets-open-session (&optional reopen)
+  "Open a new session with \"plain\" algorithm.
+If there exists another active session, and REOPEN is nil, that
+session will be used.  The object path of the session will be
+returned, and it will be stored in `secrets-session-path'."
+  (when reopen (secrets-close-session))
+  (when (secrets-empty-path secrets-session-path)
+    (setq secrets-session-path
+         (cadr
+          (dbus-call-method
+           :session secrets-service secrets-path
+           secrets-interface-service "OpenSession" "plain" '(:variant "")))))
+  (when secrets-debug
+    (message "Secret Service session: %s" secrets-session-path))
+  secrets-session-path)
+
+;;; Prompts.
+
+(defvar secrets-prompt-signal nil
+  "Internal variable to catch signals from `secrets-interface-prompt'.")
+
+(defun secrets-prompt (prompt)
+  "Handle the prompt identified by object path PROMPT."
+  (unless (secrets-empty-path prompt)
+    (let ((object
+          (dbus-register-signal
+           :session secrets-service prompt
+           secrets-interface-prompt "Completed" 'secrets-prompt-handler)))
+      (dbus-call-method
+       :session secrets-service prompt
+       secrets-interface-prompt "Prompt" (frame-parameter nil 'window-id))
+      (unwind-protect
+         (progn
+           ;; Wait until the returned prompt signal has put the
+           ;; result into `secrets-prompt-signal'.
+           (while (null secrets-prompt-signal)
+             (read-event nil nil 0.1))
+           ;; Return the object(s).  It is a variant, so we must use a car.
+           (car secrets-prompt-signal))
+       ;; Cleanup.
+       (setq secrets-prompt-signal nil)
+       (dbus-unregister-object object)))))
+
+(defun secrets-prompt-handler (&rest args)
+  "Handler for signals emitted by `secrets-interface-prompt'."
+  ;; An empty object path is always identified as `secrets-empty-path'
+  ;; or `nil'.  Either we set it explicitely, or it is returned by the
+  ;; "Completed" signal.
+  (if (car args) ;; dismissed
+      (setq secrets-prompt-signal (list secrets-empty-path))
+    (setq secrets-prompt-signal (cadr args))))
+
+;;; Collections.
+
+(defvar secrets-collection-paths nil
+  "Cached D-Bus object paths of available collections.")
+
+(defun secrets-collection-handler (&rest args)
+  "Handler for signals emitted by `secrets-interface-service'."
+  (cond
+   ((string-equal (dbus-event-member-name last-input-event) "CollectionCreated")
+    (add-to-list 'secrets-collection-paths (car args)))
+   ((string-equal (dbus-event-member-name last-input-event) "CollectionDeleted")
+    (setq secrets-collection-paths
+         (delete (car args) secrets-collection-paths)))))
+
+(defun secrets-get-collections ()
+  "Return the object paths of all available collections."
+  (setq secrets-collection-paths
+       (or secrets-collection-paths
+           (dbus-get-property
+            :session secrets-service secrets-path
+            secrets-interface-service "Collections"))))
+
+(defun secrets-get-collection-properties (collection-path)
+  "Return all properties of collection identified by COLLECTION-PATH."
+  (unless (secrets-empty-path collection-path)
+    (dbus-get-all-properties
+     :session secrets-service collection-path
+     secrets-interface-collection)))
+
+(defun secrets-get-collection-property (collection-path property)
+  "Return property PROPERTY of collection identified by COLLECTION-PATH."
+  (unless (or (secrets-empty-path collection-path) (not (stringp property)))
+    (dbus-get-property
+     :session secrets-service collection-path
+     secrets-interface-collection property)))
+
+(defun secrets-list-collections ()
+  "Return a list of collection names."
+  (mapcar
+   (lambda (collection-path)
+     (if (string-equal collection-path secrets-session-collection-path)
+        "session"
+       (secrets-get-collection-property collection-path "Label")))
+   (secrets-get-collections)))
+
+(defun secrets-collection-path (collection)
+  "Return the object path of collection labelled COLLECTION.
+If COLLECTION is nil, return the session collection path.
+If there is no such COLLECTION, return nil."
+  (or
+   ;; The "session" collection.
+   (if (or (null collection) (string-equal "session" collection))
+       secrets-session-collection-path)
+   ;; Check for an alias.
+   (let ((collection-path
+         (dbus-call-method
+          :session secrets-service secrets-path
+          secrets-interface-service "ReadAlias" collection)))
+     (unless (secrets-empty-path collection-path)
+       collection-path))
+   ;; Check the collections.
+   (catch 'collection-found
+     (dolist (collection-path (secrets-get-collections) nil)
+       (when
+          (string-equal
+           collection
+           (secrets-get-collection-property collection-path "Label"))
+        (throw 'collection-found collection-path))))))
+
+(defun secrets-create-collection (collection)
+  "Create collection labelled COLLECTION if it doesn't exist.
+Return the D-Bus object path for collection."
+  (let ((collection-path (secrets-collection-path collection)))
+    ;; Create the collection.
+    (when (secrets-empty-path collection-path)
+      (setq collection-path
+           (secrets-prompt
+            (cadr
+             ;; "CreateCollection" returns the prompt path as second arg.
+             (dbus-call-method
+              :session secrets-service secrets-path
+              secrets-interface-service "CreateCollection"
+              `(:array (:dict-entry "Label" (:variant ,collection))))))))
+    ;; Return object path of the collection.
+    collection-path))
+
+(defun secrets-get-alias (alias)
+  "Return the collection name ALIAS is referencing to.
+For the time being, only the alias \"default\" is supported."
+  (secrets-get-collection-property
+   (dbus-call-method
+    :session secrets-service secrets-path
+    secrets-interface-service "ReadAlias" alias)
+   "Label"))
+
+(defun secrets-set-alias (collection alias)
+  "Set ALIAS as alias of collection labelled COLLECTION.
+For the time being, only the alias \"default\" is supported."
+  (let ((collection-path (secrets-collection-path collection)))
+    (unless (secrets-empty-path collection-path)
+      (dbus-call-method
+       :session secrets-service secrets-path
+       secrets-interface-service "SetAlias"
+       alias :object-path collection-path))))
+
+(defun secrets-unlock-collection (collection)
+  "Unlock collection labelled COLLECTION.
+If successful, return the object path of the collection."
+  (let ((collection-path (secrets-collection-path collection)))
+    (unless (secrets-empty-path collection-path)
+      (secrets-prompt
+       (cadr
+       (dbus-call-method
+        :session secrets-service secrets-path secrets-interface-service
+        "Unlock" `(:array :object-path ,collection-path)))))
+    collection-path))
+
+(defun secrets-delete-collection (collection)
+  "Delete collection labelled COLLECTION."
+  (let ((collection-path (secrets-collection-path collection)))
+    (unless (secrets-empty-path collection-path)
+      (secrets-prompt
+       (dbus-call-method
+       :session secrets-service collection-path
+       secrets-interface-collection "Delete")))))
+
+;;; Items.
+
+(defun secrets-get-items (collection-path)
+  "Return the object paths of all available items in COLLECTION-PATH."
+  (unless (secrets-empty-path collection-path)
+    (secrets-open-session)
+    (dbus-get-property
+     :session secrets-service collection-path
+     secrets-interface-collection "Items")))
+
+(defun secrets-get-item-properties (item-path)
+  "Return all properties of item identified by ITEM-PATH."
+  (unless (secrets-empty-path item-path)
+    (dbus-get-all-properties
+     :session secrets-service item-path
+     secrets-interface-item)))
+
+(defun secrets-get-item-property (item-path property)
+  "Return property PROPERTY of item identified by ITEM-PATH."
+  (unless (or (secrets-empty-path item-path) (not (stringp property)))
+    (dbus-get-property
+     :session secrets-service item-path
+     secrets-interface-item property)))
+
+(defun secrets-list-items (collection)
+  "Return a list of all item labels of COLLECTION."
+  (let ((collection-path (secrets-unlock-collection collection)))
+    (unless (secrets-empty-path collection-path)
+      (mapcar
+       (lambda (item-path)
+        (secrets-get-item-property item-path "Label"))
+       (secrets-get-items collection-path)))))
+
+(defun secrets-search-items (collection &rest attributes)
+  "Search items in COLLECTION with ATTRIBUTES.
+ATTRIBUTES are key-value pairs.  The keys are keyword symbols,
+starting with a colon.  Example:
+
+  \(secrets-create-item \"Tramp collection\" \"item\" \"geheim\"
+   :method \"sudo\" :user \"joe\" :host \"remote-host\"\)
+
+The object paths of the found items are returned as list."
+  (let ((collection-path (secrets-unlock-collection collection))
+       result props)
+    (unless (secrets-empty-path collection-path)
+      ;; Create attributes list.
+      (while (consp (cdr attributes))
+       (unless (keywordp (car attributes))
+         (error 'wrong-type-argument (car attributes)))
+       (setq props (add-to-list
+                    'props
+                    (list :dict-entry
+                          (substring (symbol-name (car attributes)) 1)
+                          (cadr attributes))
+                    'append)
+             attributes (cddr attributes)))
+      ;; Search.  The result is a list of two lists, the object paths
+      ;; of the unlocked and the locked items.
+      (setq result
+           (dbus-call-method
+            :session secrets-service collection-path
+            secrets-interface-collection "SearchItems"
+            (if props
+                (cons :array props)
+              '(:array :signature "{ss}"))))
+      ;; Return the found items.
+      (mapcar
+       (lambda (item-path) (secrets-get-item-property item-path "Label"))
+       (append (car result) (cadr result))))))
+
+(defun secrets-create-item (collection item password &rest attributes)
+  "Create a new item in COLLECTION with label ITEM and password PASSWORD.
+ATTRIBUTES are key-value pairs set for the created item.  The
+keys are keyword symbols, starting with a colon.  Example:
+
+  \(secrets-create-item \"Tramp collection\" \"item\" \"geheim\"
+   :method \"sudo\" :user \"joe\" :host \"remote-host\"\)
+
+The object path of the created item is returned."
+  (unless (member item (secrets-list-items collection))
+    (let ((collection-path (secrets-unlock-collection collection))
+         result props)
+      (unless (secrets-empty-path collection-path)
+       ;; Create attributes list.
+       (while (consp (cdr attributes))
+         (unless (keywordp (car attributes))
+           (error 'wrong-type-argument (car attributes)))
+         (setq props (add-to-list
+                      'props
+                      (list :dict-entry
+                            (substring (symbol-name (car attributes)) 1)
+                            (cadr attributes))
+                      'append)
+               attributes (cddr attributes)))
+       ;; Create the item.
+       (setq result
+             (dbus-call-method
+              :session secrets-service collection-path
+              secrets-interface-collection "CreateItem"
+              ;; Properties.
+              (append
+               `(:array
+                 (:dict-entry "Label" (:variant ,item))
+                 (:dict-entry
+                  "Type" (:variant ,secrets-interface-item-type-generic)))
+               (when props
+                 `((:dict-entry
+                    "Attributes" (:variant ,(append '(:array) props))))))
+              ;; Secret.
+              `(:struct :object-path ,secrets-session-path
+                        (:array :signature "y") ;; no parameters.
+                        ,(dbus-string-to-byte-array password))
+              ;; Do not replace. Replace does not seem to work.
+              nil))
+       (secrets-prompt (cadr result))
+       ;; Return the object path.
+       (car result)))))
+
+(defun secrets-item-path (collection item)
+  "Return the object path of item labelled ITEM in COLLECTION.
+If there is no such item, return nil."
+  (let ((collection-path (secrets-unlock-collection collection)))
+    (catch 'item-found
+      (dolist (item-path (secrets-get-items collection-path))
+       (when (string-equal item (secrets-get-item-property item-path "Label"))
+         (throw 'item-found item-path))))))
+
+(defun secrets-get-secret (collection item)
+  "Return the secret of item labelled ITEM in COLLECTION.
+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
+       (dbus-call-method
+        :session secrets-service item-path secrets-interface-item
+        "GetSecret" :object-path secrets-session-path))))))
+
+(defun secrets-get-attributes (collection item)
+  "Return the lookup attributes of item labelled ITEM in COLLECTION.
+If there is no such item, or the item has no attributes, return nil."
+  (unless (stringp collection) (setq collection "default"))
+  (let ((item-path (secrets-item-path collection item)))
+    (unless (secrets-empty-path item-path)
+      (mapcar
+       (lambda (attribute)
+        (cons (intern (concat ":" (car attribute))) (cadr attribute)))
+       (dbus-get-property
+       :session secrets-service item-path
+       secrets-interface-item "Attributes")))))
+
+(defun secrets-get-attribute (collection item attribute)
+  "Return the value of ATTRIBUTE of item labelled ITEM in COLLECTION.
+If there is no such item, or the item doesn't own this attribute, return nil."
+  (cdr (assoc attribute (secrets-get-attributes collection item))))
+
+(defun secrets-delete-item (collection item)
+  "Delete ITEM in COLLECTION."
+  (let ((item-path (secrets-item-path collection item)))
+    (unless (secrets-empty-path item-path)
+      (secrets-prompt
+       (dbus-call-method
+       :session secrets-service item-path
+       secrets-interface-item "Delete")))))
+
+;;; Visualization.
+
+(define-derived-mode secrets-mode nil "Secrets"
+  "Major mode for presenting password entries retrieved by Security Service.
+In this mode, widgets represent the search results.
+
+\\{secrets-mode-map}"
+  ;; Keymap.
+  (setq secrets-mode-map (copy-keymap special-mode-map))
+  (set-keymap-parent secrets-mode-map widget-keymap)
+  (define-key secrets-mode-map "z" 'kill-this-buffer)
+
+  ;; When we toggle, we must set temporary widgets.
+  (set (make-local-variable 'tree-widget-after-toggle-functions)
+       '(secrets-tree-widget-after-toggle-function))
+
+  (when (not (called-interactively-p 'interactive))
+    ;; Initialize buffer.
+    (setq buffer-read-only t)
+    (let ((inhibit-read-only t))
+      (erase-buffer))))
+
+;; It doesn't make sense to call it interactively.
+(put 'secrets-mode 'disabled t)
+
+;; The very first buffer created with `secrets-mode' does not have the
+;; keymap etc.  So we create a dummy buffer.  Stupid.
+(with-temp-buffer (secrets-mode))
+
+;; We autoload `secrets-show-secrets' only on systems with D-Bus support.
+;;;###autoload(when (featurep 'dbusbind)
+;;;###autoload  (autoload 'secrets-show-secrets "secrets" nil t))
+
+(defun secrets-show-secrets ()
+  "Display a list of collections from the Secret Service API.
+The collections are in tree view, that means they can be expanded
+to the corresponding secret items, which could also be expanded
+to their attributes."
+  (interactive)
+
+  ;; Check, whether the Secret Service API is enabled.
+  (if (null secrets-enabled)
+      (message "Secret Service not available")
+
+    ;; Create the search buffer.
+    (with-current-buffer (get-buffer-create "*Secrets*")
+      (switch-to-buffer-other-window (current-buffer))
+      ;; Inialize buffer with `secrets-mode'.
+      (secrets-mode)
+      (secrets-show-collections))))
+
+(defun secrets-show-collections ()
+  "Show all available collections."
+  (let ((inhibit-read-only t)
+       (alias (secrets-get-alias "default")))
+    (erase-buffer)
+    (tree-widget-set-theme "folder")
+    (dolist (coll (secrets-list-collections))
+      (widget-create
+     `(tree-widget
+       :tag ,coll
+       :collection ,coll
+       :open nil
+       :sample-face bold
+       :expander secrets-expand-collection)))))
+
+(defun secrets-expand-collection (widget)
+  "Expand items of collection shown as WIDGET."
+  (let ((coll (widget-get widget :collection)))
+    (mapcar
+     (lambda (item)
+       `(tree-widget
+        :tag ,item
+        :collection ,coll
+        :item ,item
+        :open nil
+        :sample-face bold
+        :expander secrets-expand-item))
+     (secrets-list-items coll))))
+
+(defun secrets-expand-item (widget)
+  "Expand password and attributes of item shown as WIDGET."
+  (let* ((coll (widget-get widget :collection))
+        (item (widget-get widget :item))
+        (attributes (secrets-get-attributes coll item))
+        ;; padding is needed to format attribute names.
+        (padding
+         (apply
+          'max
+          (cons
+           (1+ (length "password"))
+           (mapcar
+            ;; Atribute names have a leading ":", which will be suppressed.
+            (lambda (attribute) (length (symbol-name (car attribute))))
+            attributes)))))
+    (cons
+     ;; The password widget.
+     `(editable-field :tag "password"
+                     :secret ?*
+                     :value ,(secrets-get-secret coll item)
+                     :sample-face widget-button-pressed
+                     ;; We specify :size in order to limit the field.
+                     :size 0
+                     :format ,(concat
+                               "%{%t%}:"
+                               (make-string (- padding (length "password")) ? )
+                               "%v\n"))
+     (mapcar
+      (lambda (attribute)
+       (let ((name (substring (symbol-name (car attribute)) 1))
+             (value (cdr attribute)))
+         ;; The attribute widget.
+         `(editable-field :tag ,name
+                          :value ,value
+                          :sample-face widget-documentation
+                          ;; We specify :size in order to limit the field.
+                          :size 0
+                          :format ,(concat
+                                    "%{%t%}:"
+                                    (make-string (- padding (length name)) ? )
+                                    "%v\n"))))
+      attributes))))
+
+(defun secrets-tree-widget-after-toggle-function (widget &rest ignore)
+  "Add a temporary widget to show the password."
+  (dolist (child (widget-get widget :children))
+    (when (widget-member child :secret)
+      (goto-char (widget-field-end child))
+      (widget-insert " ")
+      (widget-create-child-and-convert
+       child 'push-button
+       :notify 'secrets-tree-widget-show-password
+       "Show password")))
+  (widget-setup))
+
+(defun secrets-tree-widget-show-password (widget &rest ignore)
+  "Show password, and remove temporary widget."
+  (let ((parent (widget-get widget :parent)))
+    (widget-put parent :secret nil)
+    (widget-default-value-set parent (widget-get parent :value))
+    (widget-setup)))
+
+;;; Initialization.
+
+(when (dbus-ping :session secrets-service 100)
+
+  ;; We must reset all variables, when there is a new instance of the
+  ;; "org.freedesktop.secrets" service.
+  (dbus-register-signal
+   :session dbus-service-dbus dbus-path-dbus
+   dbus-interface-dbus "NameOwnerChanged"
+   (lambda (&rest args)
+     (when secrets-debug (message "Secret Service has changed: %S" args))
+     (setq secrets-session-path secrets-empty-path
+          secrets-prompt-signal nil
+          secrets-collection-paths nil))
+   secrets-service)
+
+  ;; We want to refresh our cache, when there is a change in
+  ;; collections.
+  (dbus-register-signal
+   :session secrets-service secrets-path
+   secrets-interface-service "CollectionCreated"
+   'secrets-collection-handler)
+
+  (dbus-register-signal
+   :session secrets-service secrets-path
+   secrets-interface-service "CollectionDeleted"
+   'secrets-collection-handler)
+
+  ;; We shall inform, whether the secret service is enabled on this
+  ;; machine.
+  (setq secrets-enabled t))
+
+(provide 'secrets)
+
+;;; TODO:
+
+;; * secrets-debug should be structured like auth-source-debug to
+;;   prevent leaking sensitive information.  Right now I don't see
+;;   anything sensitive though.
+;; * Check, whether the dh-ietf1024-aes128-cbc-pkcs7 algorithm can be
+;;   used for the transfer of the secrets.  Currently, we use the
+;;   plain algorithm.
index ac86fabe3a979cf7664e453159964cdfc11ba26b..9c8ab4cb017d781637375f0aa0e3715a18d2cbc9 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Daniel Pittman <daniel@inanna.danann.net>
 ;;         Michael Albinus <michael.albinus@gmx.de>
 ;; Keywords: comm, processes
+;; Package: tramp
 
 ;; This file is part of GNU Emacs.
 
index 0e31360a416f0f40c2b3725d7fdb03c3551b858b..c3243083695ff3a1c829861922b3f19669abc252 100644 (file)
@@ -4,6 +4,7 @@
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 ;; Keywords: comm, processes
+;; Package: tramp
 
 ;; This file is part of GNU Emacs.
 
index 484d2be7abe9bac2e0cd7188225fe99579d1f505..92ad7811189ecb762ee59d72d407c6c78ae8894f 100644 (file)
@@ -4,6 +4,7 @@
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 ;; Keywords: comm, processes
+;; Package: tramp
 
 ;; This file is part of GNU Emacs.
 
index 632b400e2b3b38ac86264b0d825884dd074712f3..81dea724dd660762ba61f03b4eaeefb2e76685f8 100644 (file)
@@ -4,6 +4,7 @@
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 ;; Keywords: comm, processes
+;; Package: tramp
 
 ;; This file is part of GNU Emacs.
 
index 4c373cbcd8212f0b0ee478e6d265f85d340d7c73..14cf2e0adbff2d14193d5d7e3aa7c13c04ded94e 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 ;; Keywords: comm, processes
+;; Package: tramp
 
 ;; This file is part of GNU Emacs.
 
index 202eaf598357721e7292ebb292b90d4597864b53..d0814545e6e675c3dbb53b0f3e4bacce0da8cd25 100644 (file)
@@ -4,6 +4,7 @@
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 ;; Keywords: comm, processes
+;; Package: tramp
 
 ;; This file is part of GNU Emacs.
 
index d76cd3b3bce423e41ad46d4373bbe3bfd4637ae4..76f9b30f90c82bf457abdb5e14a35b8cd3b8df05 100644 (file)
@@ -4,6 +4,7 @@
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 ;; Keywords: comm, processes
+;; Package: tramp
 
 ;; This file is part of GNU Emacs.
 
index 3e8883d2e0788bba4255ade7b1a05e4a860fde94..55addf588a752917932717acf271bf286f4f9413 100644 (file)
@@ -4,6 +4,7 @@
 
 ;; Author: Teodor Zlatanov <tzz@lifelogs.com>
 ;; Keywords: mail, comm
+;; Package: tramp
 
 ;; This file is part of GNU Emacs.
 
index f1ec7a9b81c4be7b8b66c18aa6923db65bff502a..48af7d8120a1a395a5bdb870be41b9f21ece1d8c 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 ;; Keywords: comm, processes
+;; Package: tramp
 
 ;; This file is part of GNU Emacs.
 
index 897a87b0134b7741698a1f62a3b6b5ab6c225f98..a9f816be8159f949c3122ef37b635ae7d9909fe9 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Author: Kai Großjohann <kai.grossjohann@gmx.net>
 ;; Keywords: comm, terminals
+;; Package: tramp
 
 ;; This file is part of GNU Emacs.
 
index a002ebebbf247a6234f0d371c8a92224c158cad2..8725721869d9d5fcf427e643383be6669d8527d2 100644 (file)
@@ -6,6 +6,7 @@
 
 ;; Author: Kai Großjohann <kai.grossjohann@gmx.net>
 ;; Keywords: comm, processes
+;; Package: tramp
 
 ;; This file is part of GNU Emacs.
 
index 35df085bc570d8f19999fb0b60b61bef4d7af9a9..03c188006d07127eb97b17e4ce60d6119ec7c7ad 100644 (file)
 (defgroup xesam nil
   "Xesam compatible interface to search engines."
   :group 'extensions
-  :group 'hypermedia
+  :group 'comm
   :version "23.1")
 
 (defcustom xesam-query-type 'user-query
index 5d2da4673473745367fe71e6d147a52da476ac6e..957bab0d2753cffa2fbc5b360a2404cfdb43bcd5 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: code extracted from Emacs-20's simple.el
 ;; Maintainer: Stefan Monnier <monnier@iro.umontreal.ca>
 ;; Keywords: comment uncomment
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
@@ -945,12 +946,12 @@ indentation to be kept as it was before narrowing."
                   (delete-char n)
                   (setq ,bindent (- ,bindent n)))))))))))
 
-;; Compute the number of extra comment starter characters
-;; (extra semicolons in Lisp mode, extra stars in C mode, etc.)
-;; If ARG is non-nil, just follow ARG.
-;; If the comment-starter is multi-char, just follow ARG.
-;; Otherwise obey comment-add, and double it if EXTRA is non-nil.
 (defun comment-add (arg)
+  "Compute the number of extra comment starter characters
+\(extra semicolons in Lisp mode, extra stars in C mode, etc.)
+If ARG is non-nil, just follow ARG.
+If the comment starter is multi-char, just follow ARG.
+Otherwise obey `comment-add'."
   (if (and (null arg) (= (string-match "[ \t]*\\'" comment-start) 1))
       (* comment-add 1)
     (1- (prefix-numeric-value arg))))
diff --git a/lisp/notifications.el b/lisp/notifications.el
new file mode 100644 (file)
index 0000000..beb63a6
--- /dev/null
@@ -0,0 +1,272 @@
+;;; notifications.el --- Client interface to desktop notifications.
+
+;; Copyright (C) 2010 Free Software Foundation, Inc.
+
+;; Author: Julien Danjou <julien@danjou.info>
+;; Keywords: comm desktop notifications
+
+;; 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:
+
+;; This package provides an implementation of the Desktop Notifications
+;; <http://www.galago-project.org/specs/notification/>.
+
+;; In order to activate this package, you must add the following code
+;; into your .emacs:
+;;
+;;   (require 'notifications)
+
+;;; 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-application-name "Emacs"
+  "Default application name.")
+
+(defconst notifications-application-icon
+  (expand-file-name
+   "images/icons/hicolor/scalable/apps/emacs.svg"
+   data-directory)
+  "Default application icon.")
+
+(defconst notifications-service "org.freedesktop.Notifications"
+  "D-Bus notifications service name.")
+
+(defconst notifications-path "/org/freedesktop/Notifications"
+  "D-Bus notifications service path.")
+
+(defconst notifications-interface "org.freedesktop.Notifications"
+  "D-Bus notifications service path.")
+
+(defconst notifications-notify-method "Notify"
+  "D-Bus notifications service path.")
+
+(defconst notifications-close-notification-method "CloseNotification"
+  "D-Bus notifications service path.")
+
+(defconst notifications-action-signal "ActionInvoked"
+  "D-Bus notifications action signal.")
+
+(defconst notifications-closed-signal "NotificationClosed"
+  "D-Bus notifications closed signal.")
+
+(defconst notifications-closed-reason
+  '((1 expired)
+    (2 dismissed)
+    (3 close-notification)
+    (4 undefined))
+  "List of reasons why a notification has been closed.")
+
+(defvar notifications-on-action-map nil
+  "Mapping between notification and action callback functions.")
+
+(defvar notifications-on-close-map nil
+  "Mapping between notification and close callback functions.")
+
+(defun notifications-on-action-signal (id action)
+  "Dispatch signals to callback functions from `notifications-on-action-map'."
+  (let ((entry (assoc id notifications-on-action-map)))
+    (when entry
+      (funcall (cadr entry) id action)
+      (remove entry 'notifications-on-action-map))))
+
+(dbus-register-signal
+ :session
+ notifications-service
+ notifications-path
+ notifications-interface
+ notifications-action-signal
+ 'notifications-on-action-signal)
+
+(defun notifications-on-closed-signal (id reason)
+  "Dispatch signals to callback functions from `notifications-on-closed-map'."
+  (let ((entry (assoc id notifications-on-close-map)))
+    (when entry
+      (funcall (cadr entry)
+              id (cadr (assoc reason notifications-closed-reason)))
+      (remove entry 'notifications-on-close-map))))
+
+(dbus-register-signal
+ :session
+ notifications-service
+ notifications-path
+ notifications-interface
+ notifications-closed-signal
+ 'notifications-on-closed-signal)
+
+(defun notifications-notify (&rest params)
+  "Send notification via D-Bus using the Freedesktop notification protocol.
+Various PARAMS can be set:
+
+ :title          The notification title.
+ :body           The notification body text.
+ :app-name       The name of the application sending the notification.
+                 Default to `notifications-application-name'.
+ :replaces-id    The notification ID that this notification replaces.
+ :app-icon       The notification icon.
+                 Default is `notifications-application-icon'.
+                 Set to nil if you do not want any icon displayed.
+ :actions        A list of actions in the form:
+                   (KEY TITLE KEY TITLE ...)
+                 where KEY and TITLE are both strings.
+                 The default action (usually invoked by clicking the
+                 notification) should have a key named \"default\".
+                 The title can be anything, though implementations are free
+                 not to display it.
+ :timeout        The timeout time in milliseconds since the display
+                 of the notification at which the notification should
+                 automatically close.
+                 If -1, the notification's expiration time is dependent
+                 on the notification server's settings, and may vary for
+                 the type of notification.
+                 If 0, the notification never expires.
+                 Default value is -1.
+ :urgency        The urgency level.
+                 Either `low', `normal' or `critical'.
+ :category       The type of notification this is.
+ :desktop-entry  This specifies the name of the desktop filename representing
+                 the calling program.
+ :image-data     This is a raw data image format which describes the width,
+                 height, rowstride, has alpha, bits per sample, channels and
+                 image data respectively.
+ :sound-file     The path to a sound file to play when the notification pops up.
+ :suppress-sound Causes the server to suppress playing any sounds, if it has
+                 that ability.
+ :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
+                 should point to.  The \"x\" hint must also be specified.
+ :on-action      Function to call when an action is invoked.
+                 The notification id and the key of the action are passed
+                 as arguments to the function.
+ :on-close       Function to call when the notification has been closed
+                 by timeout or by the user.
+                 The function receive the notification id and the closing
+                 reason as arguments:
+                   - `expired' if the notification has expired
+                   - `dismissed' if the notification was dismissed by the user
+                   - `close-notification' if the notification was closed
+                     by a call to CloseNotification
+
+This function returns a notification id, an integer, which can be
+used to manipulate the notification item with
+`notifications-close'."
+  (let ((title (plist-get params :title))
+        (body (plist-get params :body))
+        (app-name (plist-get params :app-name))
+        (replaces-id (plist-get params :replaces-id))
+        (app-icon (plist-get params :app-icon))
+        (actions (plist-get params :actions))
+        (timeout (plist-get params :timeout))
+        ;; Hints
+        (hints '())
+        (urgency (plist-get params :urgency))
+        (category (plist-get params :category))
+        (desktop-entry (plist-get params :desktop-entry))
+        (image-data (plist-get params :image-data))
+        (sound-file (plist-get params :sound-file))
+        (suppress-sound (plist-get params :suppress-sound))
+        (x (plist-get params :x))
+        (y (plist-get params :y))
+        id)
+    ;; Build hints array
+    (when urgency
+      (add-to-list 'hints `(:dict-entry
+                            "urgency"
+                            (:variant :byte ,(case urgency
+                                               ('low 0)
+                                               ('critical 2)
+                                               (t 1)))) t))
+    (when category
+      (add-to-list 'hints `(:dict-entry
+                            "category"
+                            (:variant :string ,category)) t))
+    (when desktop-entry
+      (add-to-list 'hints `(:dict-entry
+                            "desktop-entry"
+                            (:variant :string ,desktop-entry)) t))
+    (when image-data
+      (add-to-list 'hints `(:dict-entry
+                            "image_data"
+                            (:variant :struct ,image-data)) t))
+    (when sound-file
+      (add-to-list 'hints `(:dict-entry
+                            "sound-file"
+                            (:variant :string ,sound-file)) t))
+    (when suppress-sound
+      (add-to-list 'hints `(:dict-entry
+                            "suppress-sound"
+                            (:variant :boolean ,suppress-sound)) t))
+    (when x
+      (add-to-list 'hints `(:dict-entry "x" (:variant :int32 ,x)) t))
+    (when y
+      (add-to-list 'hints `(:dict-entry "y" (:variant :int32 ,y)) t))
+
+    ;; Call Notify method
+    (setq id
+          (dbus-call-method :session
+                            notifications-service
+                            notifications-path
+                            notifications-interface
+                            notifications-notify-method
+                            :string (or app-name
+                                        notifications-application-name)
+                            :uint32 (or replaces-id 0)
+                            :string (if app-icon
+                                        (expand-file-name app-icon)
+                                      ;; If app-icon is nil because user
+                                      ;; requested it to be so, send the
+                                      ;; empty string
+                                      (if (plist-member params :app-icon)
+                                          ""
+                                        ;; Otherwise send the default icon path
+                                        notifications-application-icon))
+                            :string (or title "")
+                            :string (or body "")
+                            `(:array ,@actions)
+                            (or hints '(:array :signature "{sv}"))
+                            :int32 (or timeout -1)))
+
+    ;; Register close/action callback function
+    (let ((on-action (plist-get params :on-action))
+          (on-close (plist-get params :on-close)))
+      (when on-action
+        (add-to-list 'notifications-on-action-map (list id on-action)))
+      (when on-close
+        (add-to-list 'notifications-on-close-map (list id on-close))))
+
+    ;; Return notification id
+    id))
+
+(defun notifications-close-notification (id)
+  "Close a notification with identifier ID."
+  (dbus-call-method :session
+                    notifications-service
+                    notifications-path
+                    notifications-interface
+                    notifications-close-notification-method
+                    :int32 id))
+
+(provide 'notifications)
index 8919d920c9da729937ce48c3d1a2a143c21d0f65..b428d8bf2242b4f99f11af415fd0eb602119e29d 100644 (file)
@@ -45,8 +45,7 @@
 
 (defgroup nxml nil
   "New XML editing mode."
-  :group 'languages
-  :group 'wp)
+  :group 'languages)
 
 (defgroup nxml-faces nil
   "Faces for XML syntax highlighting."
@@ -405,6 +404,7 @@ reference.")
     (define-key map "\M-}" 'nxml-forward-paragraph)
     (define-key map "\M-h" 'nxml-mark-paragraph)
     (define-key map "\C-c\C-f" 'nxml-finish-element)
+    (define-key map "\C-c/" 'nxml-finish-element)
     (define-key map "\C-c\C-m" 'nxml-split-element)
     (define-key map "\C-c\C-b" 'nxml-balanced-close-start-tag-block)
     (define-key map "\C-c\C-i" 'nxml-balanced-close-start-tag-inline)
@@ -1370,17 +1370,21 @@ of the inserted start-tag or nil if none was inserted."
 
 (defun nxml-indent-line ()
   "Indent current line as XML."
-  (let ((indent (nxml-compute-indent))
-       (from-end (- (point-max) (point))))
-    (when (and indent
-              (/= indent (current-indentation)))
-      (beginning-of-line)
-      (let ((bol (point)))
-       (skip-chars-forward " \t")
-       (delete-region bol (point)))
-      (indent-to indent)
-      (when (> (- (point-max) from-end) (point))
-       (goto-char (- (point-max) from-end))))))
+  (let* ((savep (point))
+         (indent (condition-case nil
+                     (save-excursion
+                       (forward-line 0)
+                       (skip-chars-forward " \t")
+                       (if (>= (point) savep) (setq savep nil))
+                       (or (nxml-compute-indent) 0))
+                   (error 0))))
+    (if (not (numberp indent))
+        ;; If something funny is used (e.g. `noindent'), return it.
+        indent
+      (if (< indent 0) (setq indent 0)) ;Just in case.
+      (if savep
+          (save-excursion (indent-line-to indent))
+        (indent-line-to indent)))))
 
 (defun nxml-compute-indent ()
   "Return the indent for the line containing point."
similarity index 99%
rename from lisp/complete.el
rename to lisp/obsolete/complete.el
index ba78820a49ffa7c014382eddbdec4f56a8ee5e71..b7e9474380284f892a8621d96819db5b3db92c1f 100644 (file)
@@ -5,6 +5,8 @@
 
 ;; Author: Dave Gillespie <daveg@synaptics.com>
 ;; Keywords: abbrev convenience
+;; Obsolete-since: 24.1
+;;
 ;; Special thanks to Hallvard Furuseth for his many ideas and contributions.
 
 ;; This file is part of GNU Emacs.
@@ -697,7 +699,7 @@ GOTO-END is non-nil, however, it instead replaces up to END."
        (if (and (eq mode 'word)
                 (not PC-word-failed-flag))
            (let ((PC-word-failed-flag t))
-             (delete-backward-char 1)
+             (delete-char -1)
              (PC-do-completion 'word))
                (when abbreviated
                  (delete-region beg end)
similarity index 99%
rename from lisp/s-region.el
rename to lisp/obsolete/s-region.el
index 3bef30c2fe598eb8a0bf54d10be71088cda2ac5b..a88d1f37ee7e92b57d53fda1a6ed7f07f499ea53 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Morten Welinder <terra@diku.dk>
 ;; Keywords: terminals
 ;; Favourite-brand-of-beer: None, I hate beer.
+;; Obsolete-since: 24.1
 
 ;; This file is part of GNU Emacs.
 
index 405232742a3bc30bccda801b2f27454e221f6b17..c0b3fa567c655549b8a04d95eb5f3212434a9f96 100644 (file)
+2010-08-19  Glenn Morris  <rgm@gnu.org>
+
+       * org.el (org-outline-overlay-data, org-set-outline-overlay-data)
+       (org-save-outline-visibility): Move to org-macs.
+       * org-macs.el (org-outline-overlay-data, org-set-outline-overlay-data)
+       (org-save-outline-visibility): Move here from org.el.
+       (show-all): Autoload it.
+       * ob.el: Don't require org when compiling.
+
+2010-08-18  Glenn Morris  <rgm@gnu.org>
+
+       * ob.el: Require org when compiling.
+       (org-save-outline-visibility): Remove macro declaration.
+       * ob-emacs-lisp.el: Require ob-comint when compiling, for macros.
+       Remove unnecessary/macro declarations.
+       * org-docview.el: Require doc-view when compiling.
+       (doc-view-goto-page): Autoload rather than declaring.
+       (doc-view-current-page): Remove macro declaration.
+
+2010-08-17  Glenn Morris  <rgm@gnu.org>
+
+       * ob.el (tramp-compat-make-temp-file, org-edit-src-code)
+       (org-entry-get, org-table-import): Fix declarations.
+       (org-match-string-no-properties): Remove unnecessary declaration.
+       * ob-sh.el (org-babel-comint-in-buffer)
+       (org-babel-comint-wait-for-output, org-babel-comint-buffer-livep)
+       (org-babel-comint-with-output): Remove unnecessary declarations.
+       * ob-R.el (orgtbl-to-tsv): Fix declaration.
+       * org-list.el (org-entry-get): Fix declaration.
+
+2010-07-19  Eric Schulte  <schulte.eric@gmail.com>
+
+       * ob-C.el: New file.
+       * ob-R.el: New file.
+       * ob-asymptote.el: New file.
+       * ob-clojure.el: New file.
+       * ob-comint.el: New file.
+       * ob-css.el: New file.
+       * ob-ditaa.el: New file.
+       * ob-dot.el: New file.
+       * ob-emacs-lisp.el: New file.
+       * ob-eval.el: New file.
+       * ob-exp.el: New file.
+       * ob-gnuplot.el: New file.
+       * ob-haskell.el: New file.
+       * ob-keys.el: New file.
+       * ob-latex.el: New file.
+       * ob-lob.el: New file.
+       * ob-matlab.el: New file.
+       * ob-mscgen.el: New file.
+       * ob-ocaml.el: New file.
+       * ob-octave.el: New file.
+       * ob-perl.el: New file.
+       * ob-python.el: New file.
+       * ob-ref.el: New file.
+       * ob-ruby.el: New file.
+       * ob-sass.el: New file.
+       * ob-screen.el: New file.
+       * ob-sh.el: New file.
+       * ob-sql.el: New file.
+       * ob-sqlite.el: New file.
+       * ob-table.el: New file.
+       * ob-tangle.el: New file.
+       * ob.el: New file.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-mks.el: New file.
+       * org-capture.el: New file.
+
+2010-07-19  Christian Egli  <christian.egli@sbszh.ch>
+
+       * org-taskjuggler.el: New file.
+
+2010-07-19  Matt Lundin  <mdl@imapmail.org>
+
+       * org-agenda.el (org-search-view): Fix inclusion of agenda-archives
+       in org-agenda-text-search-extra-files.
+
+2010-07-19  David Maus  <dmaus@ictsoc.de>
+
+       * org-list.el (org-list-send-list): Locally bind variable `txt'.
+
+2010-07-19  Eric Schulte  <schulte.eric@gmail.com>
+
+       * org.el (org-reload): Now also reloading babel files.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-capture.el (org-capture-set-plist): Make sure txt is a string
+       before calling `string-match'.
+       (org-capture-templates): Fix customization type.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-latex.el (org-export-latex-preprocess): Make a special case
+       for \nbsp.
+       (org-latex-entities): Remove the entry for \nbsp.
+       (org-latex-entities-exceptions): Variable removed.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-capture.el (org-capture-refile): Do not try to manipulate
+       bookmark list.
+
+       * org.el (org-refile): Use the correct bookmark here.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-list.el (org-list-send-list): Parse list from its true beginning.
+
+       * org.el (org-ctrl-c-ctrl-c): Maybe send the list when at a list item.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org.el (org-insert-link): Correctly determine if we should use
+       a relative path.
+
+2010-07-19  Nicolas Goaziou  <n.goaziou@gmail.com>
+
+       * org-list.el (org-list-radio-list-templates): Fix templates.
+
+2010-07-19  Nicolas Goaziou  <n.goaziou@gmail.com>
+
+       * org-list.el (org-list-send-list): Regexp defining the start of
+       a radio list is now on par with the one used for radio tables.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-entities.el (org-entities-help): Add a headline for
+       the user-defined entities.
+
+2010-07-19  Dirk-Jan C. Binnema  <djcb.bulk@gmail.com>  (tiny change)
+
+       * org-agenda.el (org-agenda-action): Document capture key and add it
+       to the prompt.
+
+2010-07-19  Eric Schulte  <schulte.eric@gmail.com>
+
+       * org-latex.el (org-export-latex-listings-langs): Add (sqlite "SQL").
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-latex.el (org-export-latex-first-lines): Do not mark
+       meta lines for removal.  Do not remove BABEL config lines during export.
+
+2010-07-19  David Maus  <dmaus@ictsoc.de>
+
+       * org-capture.el (org-capture): Check if
+       `org-capture-link-is-already-stored' is bound before evaluating.
+
+2010-07-19  Eric Schulte  <schulte.eric@gmail.com>
+
+       * org.el: Add autoload for org-babel-do-load-languages.
+
+2010-07-19  Eric Schulte  <schulte.eric@gmail.com>
+
+       * org-src.el (org-src-lang-modes): Add sqlite to sql-mode.
+
+2010-07-19  David Maus  <dmaus@ictsoc.de>
+
+       * org-feed.el: Change indentation to match coding style
+       guideline.
+
+2010-07-19  David Maus  <dmaus@ictsoc.de>
+
+       * org-feed.el (org-feed-unescape, org-feed-parse-atom-feed): Load XML
+       library if necessary.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-beamer.el (org-beamer-amend-header): Standardize the
+       header cookie for the beamer extra stuff.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-beamer.el (org-beamer-amend-header): Put extra header
+       last in header.
+
+2010-07-19  David Maus  <dmaus@ictsoc.de>
+
+       * org-exp-blocks.el (org-export-blocks-format-ditaa)
+       (org-export-blocks-format-dot): Remove text properties of body before
+       calculating cache hash.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-latex.el (org-export-latex-tabular-environment): New option.
+       (org-export-latex-tables): Use `org-export-latex-tabular-environment'.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-compat.el (org-version-check): New function.
+
+       * org-indent.el (org-indent-mode): Check for exact emacs version.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-capture.el (org-capture-templates): Allow the template
+       to come from a file or function call.
+       (org-capture-place-entry): Get the template from file or function.
+
+2010-07-19  David Maus  <dmaus@ictsoc.de>
+
+       * org-agenda.el (org-agenda-bulk-action): Don't create marker for
+       position if target is entire file.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org.el (org-autoload): Autoload a few more org-table functions.
+
+2010-07-19  Eric Schulte  <schulte.eric@gmail.com>
+
+       * org.el (org-babel-load-languages): Add ob-mscgen.
+
+2010-07-19  Eric Schulte  <schulte.eric@gmail.com>
+
+       * org-latex.el (org-export-latex-tables): Format string now
+       matches options.
+
+2010-07-19  Eric Schulte  <schulte.eric@gmail.com>
+
+       * org.el (org-babel-load-languages): This variable controls which
+       languages will be loaded by org-babel.  It is customizable through
+       the customize interface.
+
+2010-07-19  Eric Schulte  <schulte.eric@gmail.com>
+
+       * org-latex.el (org-export-latex-format-image): Update number of
+       arguments to allow for an optional short-name.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-indent.el (org-indent-mode): Refuse to turn on prior to Emacs 23.2.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-capture.el (org-capture-set-target-location): Store
+       exact positions for file+regexp and file+function targets.
+       (org-capture-place-entry, org-capture-place-item)
+       (org-capture-place-table-line, org-capture-place-plain-text): Respect
+       exact positions.
+       (org-capture-finalize): Make sure we are at the beginning of a line
+       when fixing the empty lines after the entry.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org.el (org-entry-get-with-inheritance): New argument LITERAL-NIL.
+       (org-entry-get): Pass `literal-nil' into
+       `org-entry-get-with-inheritance'.
+       (org-todo): React to nil values of the LOGGING property.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org.el (org-default-notes-file): Update docstring.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org.el (org-link-frame-setup): Use `org-gnus-no-new-news' as default.
+
+2010-07-19  Eric Schulte  <schulte.eric@gmail.com>
+
+       * org-exp.el (org-export-attach-captions-and-attributes): Add
+       a shortname attribute to caption strings under the symbol name
+       org-caption-shortn.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org.el (org-switchb): Rename from `org-iswitchb'.  Improve
+       docstring.
+       (org-iswitchb): New alias.
+       (org-ido-switchb): Make alias point to `org-switchb'.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-capture.el (org-capture-fill-template): Respect
+       time-of-day preference in template prompt.
+
+2010-07-19  David Maus  <dmaus@ictsoc.de>
+
+       * org-feed.el (org-feed-unescape): Remove superfluous lambda.
+
+2010-07-19  David Maus  <dmaus@ictsoc.de>
+
+       * org-wl.el (org-wl-disable-folder-check): New customization
+       variable.
+       (org-wl-open): Disable folder check depending on
+       `org-wl-disable-folder-check'.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-capture.el (org-capture-set-target-location): Fix
+       file+function interpretation.
+
+2010-07-19  David Maus  <dmaus@ictsoc.de>
+
+       * org-feed.el (org-feed-parse-rss-entry): Unescape rss element
+       content.
+
+2010-07-19  David Maus  <dmaus@ictsoc.de>
+
+       * org-feed.el (xml-entity-alist): Declare variable
+       `xml-entity-alist' for byte compiler.
+
+2010-07-19  David Maus  <dmaus@ictsoc.de>
+
+       * org-feed.el (org-feed-unescape): New function.  Unescape
+       protected entities.
+       (org-feed-parse-atom-entry): Use function for atom:content
+       type text and html.
+
+2010-07-19  David Maus  <dmaus@ictsoc.de>
+
+       * org-feed.el (org-feed-parse-rss-feed): Ignore case of rss
+       element names.
+
+2010-07-19  Bernt Hansen  <bernt@norang.ca>
+
+       * org.el (org-time-string-to-absolute): Ignore cyclic repeater
+       when displaying items on todays agenda date.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-agenda.el (org-agenda-get-progress): Avoid reusing previous
+       value of EXTRA.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-publish.el (org-publish-initialize-cache): Make
+       timestamp directory, the entire path to it.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-exp.el (org-export-handle-comments): Make sure to check
+       for protection in the comment line, and not in the line after it.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-html.el (org-export-html-preprocess): Call org-format-latex,
+       possibly with a protect-only argument.
+
+       * org.el (org-format-latex): New argument PROTECT-ONLY.
+
+2010-07-19  Eric Schulte  <schulte.eric@gmail.com>
+
+       * org-exp.el (org-export-handle-table-metalines): This function
+       removes table specific meta-lines, now that we aren't wiping
+       everything that looks remotely like a comment at the end of the
+       export process we have to be sure to catch all of the specific lines
+       in org-exp.el.
+
+2010-07-19  Nicolas Goaziou  <n.goaziou@gmail.com>
+
+       * org-exp.el (org-export-select-backend-specific-text): Properly
+       get rid of #+Backend and #+ATTR_Backend specifics to backends not
+       matching the one we're exporting to.
+
+2010-07-19  Eric Schulte  <schulte.eric@gmail.com>
+
+       * Makefile (lisp/org-install.el): Replace babel files in
+       construction of org-install.el.
+
+2010-07-19  Eric Schulte  <schulte.eric@gmail.com>
+
+       * org-table.el (orgtbl-to-generic): Add the :remove-newlines
+       option which will strip newline characters from the text of table
+       cells and replace then with "\n".
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org.el (org-confirm-shell-link-function):
+       (org-confirm-elisp-link-function): Limit the values that can be set by
+       file variables.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org.el (org-compute-latex-and-specials-regexp): Deal with
+       string elements by discarding them.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org.el (org-iswitchb): Make sure to use at least iswitchb.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-capture.el (org-capture-position-for-last-stored)
+       (org-capture-bookmark-last-stored-position): New functions.
+       (org-capture-place-table-line): Better error catching.
+       (org-capture-place-item):
+       (org-capture-place-entry):
+       (org-capture-place-plain-text): Call
+       `org-capture-position-for-last-stored'.
+       (org-capture-finalize): Just call
+       `org-capture-bookmark-last-stored-position'.
+
+2010-07-19  Eric Schulte  <schulte.eric@gmail.com>
+
+       * org-exp.el (org-export-mark-blockquote-verse-center): Fix
+       small bug, now grabbing match data before overwritten by looking-at
+       this fixes a problem with remainders of #+end_quote lines appearing
+       in exported output.
+
+2010-07-19  David Maus  <dmaus@ictsoc.de>
+
+       * org.el (org-link-frame-setup): Add customization option for
+       Wanderlust.
+
+2010-07-19  Eric Schulte  <schulte.eric@gmail.com>
+
+       * org-latex.el (org-export-latex-fixed-width): Now check
+       org-example rather than org-protected on verbatim export, because by
+       default all ": " prefixed lines are marked protected.
+
+2010-07-19  Eric Schulte  <schulte.eric@gmail.com>
+
+       * org-latex.el (org-export-latex-fixed-width): Check for
+       protection before wrapping ": " lines as verbatim.
+
+2010-07-19  Eric Schulte  <schulte.eric@gmail.com>
+
+       * org-exp.el (org-export-handle-comments): Check for protection
+       before removing comments.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-entities.el (org-entities): Restructure the list.
+       (org-entities-help): Turn the help output into a buffer
+       in Org-mode, so that it becomes easier to find a symbol
+       in the structure.
+       (org-entities-create-table): Deal with new structure.
+
+2010-07-19  David Maus  <dmaus@ictsoc.de>
+
+       * org-agenda.el (org-write-agenda): Use backquotes to expand
+       `flet' at compile time.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org.el (org-entry-properties): Make sure that standard property
+       names are used even if the user has customized time keywords.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-macs.el (org-not-nil): Return the value if not interpreted
+       as nil.
+
+       * org.el (org-entry-get):
+       (org-entry-get-with-inheritance): Interpret the value "nil"
+       as nil for properties.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org.el (org-switch-to-buffer-other-window): Return the buffer.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-macs.el (org-not-nil): New function.
+
+       * org.el (org-block-todo-from-children-or-siblings-or-parent):
+       Use `org-not-nil' to interpret a property value of nil.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org.el (org-truely-invisible-p): New function.
+       (org-beginning-of-line): Use `org-truely-invisible-p'.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-agenda.el (org-agenda-get-timestamps): No errors
+       while getting TODO state.
+       (org-agenda-highlight-todo): No error when no keyword has
+       been matched.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org.el (org-timestamp-change): New optional argument UPDOWN.
+       Use this to identify calls from org-timestamp-up/down, so that we can
+       skip by rounding minutes in this case.
+       (org-timestamp-up):
+       (org-timestamp-down):
+       (org-timestamp-up-day):
+       (org-timestamp-down-day): Call org-timestamp-change with the
+       updown argument.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-agenda.el (org-agenda-action): Make `c' key call org-capture.
+
+       * org-capture.el: New file.
+
+       * org-compat.el (org-get-x-clipboard): Function moved here from
+       remember.el.
+
+       * org-mks.el: New file.
+
+       * org.el (org-set-regexps-and-options): Allow statistic cookies as
+       part of complex headlines.
+       (org-find-olp): New argument THIS-BUFFER.  When set, assume that the
+       OLP does not contain a file name.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org.el (org-mode): Set `comment-start' instead of changing the
+       syntax of the `#' character.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-exp.el (org-export-format-source-code-or-example): Mark examples
+       by a property.
+
+       * org-html.el (org-export-html-close-lists-maybe): Check if raw
+       HTML stuff was actually made from an example.
+
+2010-07-19  Eric Schulte  <schulte.eric@gmail.com>
+
+       * Makefile (LISPF): Let's not compile files that won't often be used.
+
+2010-07-19  Bastien Guerry  <bzg@altern.org>
+
+       * org-latex.el: Items are no longer skipped when their first line
+       ends on a protected element.
+
+       * org-list.el: Protected environments looking like lists are not
+       exported anymore.
+
+2010-07-19  Eric Schulte  <schulte.eric@gmail.com>
+
+       * org-exp-blocks.el (org-export-blocks-preprocess):
+       Cleanup trailing newline after block.
+
+2010-07-19  Bastien Guerry  <bzg@altern.org>
+
+       * org-exp.el: Comment regexp now matches documentation.  No more
+       protection check when deleting comments before export.
+
+2010-07-19  Bastien Guerry  <bzg@altern.org>
+
+       * org-exp.el (org-export-preprocess-string):
+       Now using `org-export-handle-include-files-recurse' to resolve
+       included files.
+
+2010-07-19  Bastien Guerry  <bzg@altern.org>
+
+       * org-agenda.el (org-agenda-get-deadlines):
+       (org-agenda-get-scheduled):
+       * org.el (org-time-string-to-seconds):
+       For deadline and scheduled agenda display ignore the cyclic repeater
+       when calculating how many days late the task is.  If you have a weekly
+       task and miss the date the agenda view will show more than a week late
+       now instead of resetting on the cyclic repeating date.  This makes it
+       much more obvious when you missed a repeating task after the repeater.
+
+2010-07-19  Bastien Guerry  <bzg@altern.org>
+
+       * org-exp.el (org-export-mark-blockquote-verse-center):
+       Consider environments that end at eob.
+
+2010-07-19  Mikael Fornius  <mfo@abc.se>
+
+       * org.el (org-raise-scripts): Do not fontify sub/superscripts of text
+       with face `org-special-keyword'.  Make property keys as :LAST_REPEAT:
+       display correctly.
+
+2010-07-19  Mikael Fornius  <mfo@abc.se>
+
+       * org.el (org-at-property-p): Use save-match-data macro instead of let.
+
+2010-07-19  Mikael Fornius  <mfo@abc.se>
+
+       * org.el (test): Remove unused test function.
+
+2010-07-19  Eric Schulte  <schulte.eric@gmail.com>
+
+       * org-exp-blocks.el (org-export-blocks-preprocess): Fix typo.
+
+2010-07-19  Eric Schulte  <schulte.eric@gmail.com>
+
+       * org-exp-blocks.el (org-export-blocks-postblock-hook): Add
+       documentation to and turn into a defcustom.
+
+2010-07-19  Eric Schulte  <schulte.eric@gmail.com>
+
+       * org-exp.el (org-get-file-contents): By un-setting prefix1 to ""
+       instead of to nil we avoid errors when :prefix1 is defined, but
+       prefix is not.
+
+2010-07-19  Nicolas Goaziou  <n.goaziou@gmail.com>
+
+       * org-latex.el (org-export-latex-preprocess): Environments coming
+       from latex backend specific instructions (#+LaTeX) are already
+       protected and won't be treated as normal environments.
+
+2010-07-19  Bastien Guerry  <bzg@altern.org>
+
+       * org-timer.el (org-timer-set-timer): Fix typo in the docstring.
+
+2010-07-19  Bastien Guerry  <bzg@altern.org>
+
+       * org-timer.el (org-timer-set-timer): Use a prefix argument.
+       See the docstring of the function.
+
+2010-07-19  Bastien Guerry  <bzg@altern.org>
+
+       * org-timer.el (org-timer-set-timer): Fix bug about cancelling
+       timers.
+
+2010-07-19  David Maus  <dmaus@ictsoc.de>
+
+       * org-w3m.el (org-w3m-copy-for-org-mode)
+       (org-w3m-get-next-link-start, org-w3m-get-prev-link-start):
+       Get text property directly, not using macro `w3m-anchor'.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org.el (org-emph-re): Document the match groups.
+
+2010-07-19  Bernt Hansen  <bernt@norang.ca>
+
+       * org-clock.el (org-clock-in): Set `org-clock-clocking-in' to
+       t before calling `org-clock-out', so that that function can
+       know its call context.
+
+2010-07-19  Bastien Guerry  <bzg@altern.org>
+
+       * org-timer.el (org-timer-default-timer): New variable.
+       (org-timer-set-timer): Use the new variable.  Also offer the
+       possibility to replace the current timer by a new one.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org.el (org-kill-note-or-show-branches): Hide subtree before
+       exposing the headings.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org.el (org-add-planning-info): Remove the empty line also
+       if there is no whitespace at all in there.
+
+       * org-table.el (org-table-align): Fix alignment of strings
+       with invisible characters.
+
+2010-07-19  David Maus  <dmaus@ictsoc.de>
+
+       * org.el (org-refile-cache-get): Return empty list of targets
+       when cache was cleared.
+       (org-clone-subtree-with-time-shift): Maybe create ID property
+       in cloned subtrees.
+       (org-clone-delete-id): New customization variable.
+       (org-clone-subtree-with-time-shift): Use customization
+       variable `org-clone-delete-id'.
+       (org-clone-subtree-with-time-shift): Remove empty property
+       drawer in cloned subtrees.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org.el (org-refile-use-cache): New option.
+       (org-refile-cache, org-refile-markers): New variable.
+       (org-refile-marker, org-refile-cache-clear)
+       (org-refile-cache-check-set, org-refile-cache-put)
+       (org-refile-cache-get): New function.
+       (org-get-refile-targets): Use the refile cache.
+
+       * org-clock.el (org-clock-sum): Don't include running clock if
+       the time block is wrong.
+
+2010-07-19  John Wiegley  <jwiegley@gmail.com>
+
+       * org-clock.el (org-clock-clock-in, org-clock-in): Add
+       parameter `start-time'.
+       (org-clock-resolve-clock): Add parameter `clock-out-time'.
+       If set, and resolve-to is a past time, then the clock out
+       event occurs at `clock-out-time' rather than at `resolve-to'.
+       In this case, `resolve-to' becomes the clock in time.
+       (org-clock-jump-to-current-clock): Create new global command
+       to reveal the current clock.
+       (org-clock-resolve): Add new commands g/G and j/J, and a
+       help window describing all commands and their meaning.
+       (org-clock-resolve-expert): New customization variable.
+       (org-find-open-clocks): Fix a bug that caused discovered
+       clocks not to match up with the currently active clock.
+       (org-resolve-clocks): Change the argument
+       `also-non-dangling-p' to `only-dangling-p', since due to a bug
+       this was the default behavior all along.
+
+2010-07-19  David Maus  <dmaus@ictsoc.de>
+
+       * org-id.el (org-id-uuid): New function.  Return string with
+       random (version 4) UUID.
+       (org-id-method): Make 'uuid the new default value.
+       (org-id-new): Use `org-id-uuid' if call to uuidgen program
+       does not return a UUID.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-latex.el (org-export-latex-format-image): Add support
+       for multicolumn figures in LaTeX.
+
+2010-07-19  David Maus  <dmaus@ictsoc.de>
+
+       * org.el (org-clone-subtree-with-time-shift): Remove ID
+       property of original subtree in cloned subtrees.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-exp.el (org-export-format-source-code-or-example):
+       XEmacs compatibility.
+
+       * org-latex.el (org-export-latex-tables): Accept comma in
+       align string.
+
+       * org-docbook.el (org-export-docbook-xslt-stylesheet): New option.
+       (org-export-docbook-xslt-proc-command): Fix docstring.
+       (org-export-docbook-xsl-fo-proc-command): Fix docstring.
+       (org-export-as-docbook-pdf): Improve
+       formatting of the xslt command.
+
+       * org-exp.el (org-infile-export-plist): Check for XSLT setting.
+
+       * org.el (org-file-contents): Improve error message.
+       (org-set-regexps-and-options): Remove spaces at both ends.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-docbook.el (org-export-as-docbook-pdf): Improve
+       formatting of the xslt command.
+
+2010-07-19  Sebastian Rose  <sebastian_rose@gmx.de>
+
+       * org-publish.el (org-publish-cache): Use one big hashmap for
+       each project defined in `org-publish-project-alist'.
+       (initialize-files-alist): Function removed.
+       (org-publish-validate-link): Function removed.
+       (org-publish-get-base-files): Add variable `sitemap-requested'
+       to avoid sorting where possible.
+       (org-publish-get-files): Function removed.
+       (org-publish-get-project-from-filename): Make independent of
+       file list.
+       (org-publish-file): New argument NO-CACHE.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org.el (org-beginning-of-defun, org-end-of-defun): New
+       functions.
+       (org-mode): Install the `org-beginning-of-defun' and
+       `org-end-of-defun' functions.
+       (org-pretty-entities): New option.
+       (org-toggle-pretty-entities): New command.
+       (org-fontify-entities): New function.
+       (org-startup-options): New keywords for pretty entities.
+       (org-set-font-lock-defaults): Call the pretty entities
+       function.
+
+       * org-latex.el (org-export-latex-keywords-maybe): Protect the
+       TODO markup.
+
+2010-07-19  Mikael Fornius  <mfo@abc.se>
+
+       * org-habit.el (org-habit-build-graph): Help-echo date when
+       mouse is over stars.
+
+2010-07-19  Jan Böker  <jan.boecker@jboecker.de>
+
+       * org.el (org-file-apps): Improve docstring to reflect
+       grouping matches.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org.el (org-set-startup-visibility): Fix empty line display.
+
+       * org-latex.el (org-export-latex-links): Use the formatting
+       function of the link type, if it is available.
+
+       * org-table.el (org-table-get-remote-range): Return to
+       original buffer when retrieving remote reference.
+
+       * org.el (org-display-inline-images): Do the entire buffer,
+       not just the narrowed region.  Clear the cache.
+       (org-display-inline-images): Match mode file paths.
+
+2010-07-19  David Maus  <dmaus@ictsoc.de>
+
+       * org-wl.el (org-wl-store-link-folder): Don't throw error when
+       called on WL folder group.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org.el (org-replace-escapes): Make sure the cdr is not nil.
+       (org-read-date): Make `M-v' and `C-v' scroll the popup calendar.
+       (org-mode): Revert comment syntax changes.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org.el (org-sparse-tree): Make `C-c / t' search for all TODO
+       keywords, and `C-c / T' for a specific one.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org.el (org-mode): Fix comment syntax settings.
+
+       * org-src.el (org-edit-src-allow-write-back-p): Define
+       variable.
+
+       * org.el (org-inline-image-overlays): New variable.
+       (org-toggle-inline-images, org-display-inline-images)
+       (org-remove-inline-images): New commands.
+       (org-mode-map): Define a key for `org-toggle-inline-images'.
+
+2010-07-19  David Maus  <dmaus@ictsoc.de>
+
+       * org-wl.el (org-wl-message-field): New function.  Return
+       content of header field in message entity.
+       (org-wl-store-link): Call `org-wl-store-link-folder' or
+       `org-wl-store-link-message' depending on major-mode.
+       (org-wl-store-link-folder): New function.  Store link to
+       Wanderlust folder.
+       (org-wl-store-link-message): New function.  Store link to
+       Wanderlust message.
+       (org-wl-store-link-message): Store link to message while
+       visiting message.
+       (org-wl-open): Don't try to jump to message when opening a
+       folder link.
+
+2010-07-19  David Maus  <dmaus@ictsoc.de>
+
+       * org.el (org-replace-escapes): Avoid infinite loop when
+       replace string contains escape sequence it replaces.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-crypt.el (org-crypt-key-for-heading): Use symmetric
+       encryption when now key is set.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-table.el (org-table-recalculate-buffer-tables)
+       (org-table-iterate-buffer-tables): New commands.
+
+       * org.el (org-check-for-hidden): When there is a region, skip
+       the check.
+
+2010-07-19  Dan Davison  <davison@stats.ox.ac.uk>
+
+       * org-src.el (org-edit-src-code): allow-write-back-p had
+       erroneously been omitted from let binding.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-agenda.el (org-sorting-choice): New sorting type alpha.
+       (org-cmp-alpha): New defsubst.
+       (org-em): New defsubst.
+       (org-entries-lessp): Only compute needed comparisons.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-html.el (org-format-org-table-html): Test all columns
+       for number content.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-latex.el (org-export-latex-treat-sub-super-char): Make
+       sure parenthesis matching is consistent.
+
+       * org-table.el (org-table-colgroup-line-p)
+       (org-table-cookie-line-p): New functions.
+
+       * org-exp.el (org-table-clean-before-export): Better tests for
+       colgroup and cookie lines.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-agenda.el (org-agenda-goto): Push a mark before changing
+       the position.
+
+       * org-footnote.el (org-footnote): New group.
+       (org-footnote-section)
+       (org-footnote-tag-for-non-org-mode-files): Fix typos.
+
+       * org-list.el (org-end-of-item-text-before-children): Also do
+       the right thing at the end of a file.
+
+       * org.el (org-set-packages-alist, org-get-packages-alist): New
+       function.
+       (org-export-latex-default-packages-alist)
+       (org-export-latex-packages-alist): Add extra flag to
+       each package, indicating if it should be used for snippets.
+       (org-create-formula-image): Add the snippet argument.
+       (org-splice-latex-header): New argument SNIPPET-P, pass it
+       through to `org-latex-packages-to-string'.
+       (org-latex-packages-to-string): New argument SNIPPET-P.
+
+       * org-latex.el (org-export-latex-make-header): Add the snippet
+       argument.
+
+       * org-docbook.el (org-export-as-docbook): Implement ordered
+       lists starting at some offset.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org.el (org-link-types, org-open-at-point): Add doi links.
+
+       * org-ascii.el (org-export-ascii-preprocess): Remove list
+       startcounter cookies.
+
+       * org-list.el (org-renumber-ordered-list): Respect counter
+       start values.
+
+       * org-latex.el (org-export-latex-lists): Accept ordered list
+       item offset cookie.
+
+       * org-html.el (org-export-as-html): Accept ordered list
+       item offset cookie.
+
+       * org-indent.el (org-indent-mode): Turn off `indent-tabs-mode'
+       which messes up alignment of tags.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-clock.el (org-clock-cancel, org-clock-out): Make sure
+       the modeline display is removed.
+
+       * org-exp.el (org-export-format-drawer-function): Fix
+       docstring.
+
+       * org-agenda.el (org-agenda-refile): New optional argument
+       NO-UPDATE.
+       (org-agenda-refile): Call `org-agenda-redo' unless NO-UPDATE
+       is set.
+       (org-agenda-bulk-action): Call the refile command with updates
+       suppressed - but arrange for `org-agenda-redo' to be called at
+       the end.
+
+       * org.el (org-mode): Make table mapping quiet.
+       (org-table-map-tables): New optional argument QUIETLY.
+
+       * org-ascii.el (org-export-ascii-preprocess): Make table
+       mapping quiet.
+
+       * org-html.el (org-export-as-html, org-html-level-start): Change
+       XHTML IDs to not use dots.
+
+       * org-exp.el (org-export-define-heading-targets): Change
+       XHTML IDs to not use dots.
+
+       * org-docbook.el (org-export-docbook-level-start): Change
+       XHTML IDs to not use dots.
+
+       * org-latex.el (org-export-as-latex): Make sure that the
+       result buffer is in latex-mode.
+
+       * org.el (org-shiftup-final-hook, org-shiftdown-final-hook)
+       (org-shiftleft-final-hook, org-shiftright-final-hook): New
+       hooks.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-table.el (org-table-justify-field-maybe): Make sure that
+       inserting a value does not turn a line into a hline.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-clock.el (org-clock-sum): New argument HEADLINE-FILTER.
+       (org-clock-sum): Add property to selected headlines.
+       (org-dblock-write:clocktable): Make tags matcher.
+
+       * org.el (org-set-autofill-regexps): XEmacs compatibility.
+
+       * org-latex.el (org-export-latex-set-initial-vars): Allow "-"
+       in latex class definitions.
+
+       * org.el (org-shiftup-hook, org-shiftdown-hook)
+       (org-shiftleft-hook, org-shiftright-hook): New hooks.
+
+       * org-entities.el (org-entities): Use \land and \lor for logical
+       operators.
+
+       * org.el (org-shiftmetaleft, org-shiftmetaright): Call the subtree
+       indentation commands.
+       (org-hidden-tree-error): New defsubst.
+       (org-metaleft, org-metaright): Check for hidden stuff and throw an
+       error.
+       (org-check-for-hidden): New function.
+
+       * org-list.el (org-item-re): New function.
+       (org-at-item-p): Use `org-item-re'.
+       (org-end-of-item-text-before-children): New function.
+       (org-outdent-item, org-indent-item): Arrange for leaving the
+       subtree alone.
+       (org-outdent-item-tree, org-indent-item-tree): New argument
+       NO-SUBTREE.
+       (org-indent-item-tree): Use `org-end-of-item-text-before-children'
+       to find the end for processing while ignoring the subtree.
+
+       * org-publish.el (org-publish-sitemap-sort-alphabetically)
+       (org-publish-sitemap-sort-folders)
+       (org-publish-sitemap-sort-ignore-case): New options.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-publish.el (org-publish-compare-directory-files): Fix sorting.
+
+       * org-compat.el (org-get-x-clipboard-compat): Use (featurep 'xemacs).
+
+       * org-publish.el (org-publish-project-alist): Update docstring.
+       (org-publish-file-title-cache): New variable.
+       (org-publish-initialize-files-alist): Initialize
+       `org-publish-initialize-files-alist' to nil.
+       (org-publish-sort-directory-files): New function.
+       (org-publish-projects): Access the new properties.
+       (org-publish-find-title): Use the file title cache.
+       (org-publish-find-title): Build the file title cache.
+       (org-publish-get-base-files-1): Sort files.
+       (org-publish-aux-preprocess): Do not throw an error when before
+       the first headline.  Allow an empty target, meaning to link just
+       to the file.
+       (org-publish-index-generate-theindex.inc): Check if there is
+       actually a target and only then add it to the link.
+       (org-publish-projects): Fix a remaining issue with the last commit.
+
+       * org-html.el (org-export-as-html): Treat verse as open/close
+       paragraph.
+       (org-export-html-close-lists-maybe): Allow to splice raw HTML into
+       and out of lists.
+
+2010-07-19  Dan Davison  <davison@stats.ox.ac.uk>
+
+       * org-src.el (org-edit-src-code): Allow the org-src edit buffer to
+       be used in a read-only mode.
+       (org-edit-src-code): Different message in read-only mode.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-src.el (org-edit-src-find-region-and-lang): Test for
+       table.el as late as possible.
+
+       * org-colview-xemacs.el: Make sure this file is never loaded into
+       Emacs.  Remove all tests for XEmacs.
+
+       * org-colview.el: Make sure this file is never loaded into XEmacs.
+
+       * org-agenda.el (org-highlight, org-unhighlight): Use direct
+       overlay calls.
+
+       * org.el (org-key): Apply the translations defined in
+       `org-xemacs-key-equivalents'.
+
+       * org-mouse.el (org-mode-hook): Use `org-defkey'.
+
+       * org-compat.el (org-xemacs-key-equivalents): New constant.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-inlinetask.el (org-inlinetask-defaut-state): New option.
+       (org-inlinetask-insert-task): Use `org-inlinetask-defaut-state'.
+       Obey `org-odd-levels-only'.
+
+       * org-compat.el (org-find-overlays): Use overlays-in/at.
+
+       * org.el (org-remove-empty-overlays-at)
+       (org-outline-overlay-data, org-hide-block-toggle)
+       (org-format-latex, org-context): Use overlays-in/at.
+
+       * org-src.el (org-edit-src-exit): Use overlays-in/at.
+
+       * org-agenda.el (org-agenda-mark-clocking-task)
+       (org-agenda-fontify-priorities, org-agenda-dim-blocked-tasks)
+       (org-agenda-entry-text-hide)
+       (org-agenda-fix-tags-filter-overlays-at)
+       (org-agenda-bulk-remove-overlays): Use overlays-in/at.
+
+       * org-compat.el (org-overlays-at): Function removed.
+       (org-overlays-in): Function removed.
+
+2010-07-19  Bastien Guerry  <bzg@altern.org>
+
+       * org-clock.el (org-clock-set-current): Just return the headline
+       itself, strip the TODO keyword, the priority cookie and the tags.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-compat.el (org-xemacs-without-invisibility): New macro.
+       (org-xemacs-without-invisibility): New macro.
+       (org-indent-to-column, org-indent-line-to, org-move-to-column):
+       Redefine using the macro `org-xemacs-without-invisibility'.
+
+       * org.el (org-mode, org-org-menu): Use `add-to-invisibility-spec'.
+
+       * org-table.el (orgtbl-mode): Use `add-to-invisibility-spec'.
+
+       * org-compat.el (org-make-overlay, org-delete-overlay)
+       (org-overlay-start, org-overlay-end, org-overlay-put)
+       (org-overlay-get, org-overlay-move, org-overlay-buffer): Functions
+       removed.
+       (org-add-to-invisibility-spec): Function removed.
+
+       * org-html.el (org-export-as-html-and-open): Add argument to
+       kill-buffer.
+
+       * org-habit.el (require): `calendar' is now required already by
+       org.el on top level.
+
+       * org-clock.el (require): `calendar' is now required already by
+       org.el on top level.
+
+       * org-agenda.el (require, org-timeline, org-agenda-list)
+       (org-todo-list, org-agenda-to-appt): `calendar' is now required
+       already by org.el on top level.
+
+       * org.el (org-export-latex-fix-inputenc): Declare function.
+
+       * org-agenda.el (org-agenda-goto-calendar): Do not bind obsolete
+       variables.
+
+       * org.el (calendar): Require calendar now on top level in org.el
+       and define aliases to new variables when needed.
+       (org-read-date, org-goto-calendar): Do not bind obsolete
+       variables.
+
+       * org-clock.el (org-clock-out, org-clock-cancel): Get rid of
+       compilation warning, add comment that this cannot be done with
+       `with-current-buffer'.
+
+       * org-wl.el (org-wl-open): Use `with-current-buffer'.
+
+       * org.el (overlay, org-remove-empty-overlays-at)
+       (org-outline-overlay-data, org-set-outline-overlay-data)
+       (org-show-block-all, org-hide-block-toggle)
+       (org-highlight-new-match, org-remove-occur-highlights)
+       (org-tags-overlay, org-fast-tag-selection, org-date-ovl)
+       (org-read-date, org-read-date-display, org-eval-in-calendar)
+       (org-format-latex, org-context)
+       (org-speedbar-restriction-lock-overlay)
+       (org-speedbar-set-agenda-restriction): Use the normal overlay API.
+
+       * org-table.el (org-table-add-rectangle-overlay)
+       (org-table-remove-rectangle-highlight)
+       (org-table-overlay-coordinates)
+       (org-table-toggle-coordinate-overlays): Use the normal overlay
+       API.
+
+       * org-src.el (org-edit-src-code, org-edit-fixed-width-region)
+       (org-edit-src-exit, org-src-mode-configure-edit-buffer): Use the
+       normal overlay API.
+
+       * org-colview.el (org-columns-new-overlay)
+       (org-columns-display-here, org-columns-remove-overlays)
+       (org-columns-edit-value, org-columns-next-allowed-value)
+       (org-columns-update): Use the normal overlay API.
+
+       * org-clock.el (org-clock-out, org-clock-cancel)
+       (org-clock-put-overlay, org-clock-remove-overlays): Use the normal
+       overlay API.
+
+       * org-agenda.el (org-agenda-mark-filtered-text)
+       (org-agenda-mark-clocking-task, org-agenda-fontify-priorities)
+       (org-agenda-dim-blocked-tasks, org-agenda-entry-text-show-here)
+       (org-agenda-entry-text-hide)
+       (org-agenda-restriction-lock-overlay)
+       (org-agenda-set-restriction-lock)
+       (org-agenda-filter-by-tag-hide-line)
+       (org-agenda-fix-tags-filter-overlays-at)
+       (org-agenda-filter-by-tag-show-all, org-hl)
+       (org-agenda-goto-calendar, org-agenda-bulk-mark)
+       (org-agenda-bulk-remove-overlays): Use the normal overlay API.
+
+       * org-freemind.el (org-freemind-from-org-mode-node)
+       (org-freemind-from-org-mode, )
+       (org-freemind-from-org-sparse-tree, org-freemind-to-org-mode): Use
+       interactive-p instead of called-interactively, because this is
+       backward compatible with older Emacsen I still support..
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-exp.el (org-export-define-heading-targets): Fix bug in
+       regexp finding ID and CUSTOM_ID properties.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-footnote.el (org-footnote-goto-previous-reference): Rename
+       from `org-footnote-goto-next-reference'.
+
+       * org.el (org-auto-repeat-maybe): Only record LAST_REPEAT if
+       org-log-repeat is non-nil, or if there is clocking data in the
+       entry.
+
+       * org-crypt.el (org-encrypt-entry): Improve mapping behavior.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org.el (org-align-all-tags): New command.
+
+2010-07-19  David Maus  <dmaus@ictsoc.de>
+
+       * org-wl.el (org-wl-link-remove-filter): New customizable
+       variable.  If non-nil, filter conditions are stripped when storing
+       link to message in filter folder.
+       (org-wl-shimbun-prefer-web-links): New customizable variable.  If
+       non-nil, links to shimbun messages are created as web links to
+       message source.
+       (org-wl-nntp-prefer-web-links): New customizable variable.  If
+       non-nil, links to nntp message are created as web links to gmane
+       or googlegroups.
+       (org-wl-namazu-default-index): New customizable variable.
+       Directory of namazu search index that should be used as default
+       when opening a link in a search folder.
+       (org-wl-folder-types): New constant.  Wanderlust folder type
+       indicators.
+       (org-wl-folder-type): New function.  Return type of Wanderlust
+       folder.
+       (org-wl-store-link): Create web links for shimbun or nntp messages
+       and strip filter conditions depending on customizable variables.
+       (org-wl-open): Open namazu search folder for message when called
+       with prefix.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org.el (org-remove-if, org-remove-if-not): New functions.
+       (org-open-file): Use internal remove-if functions.
+
+2010-07-19  Jan Böcker  <jan.boecker@jboecker.de>
+
+       * org.el (org-file-apps-entry-match-against-dlink-p): New function.
+       (org-file-apps-ex): Remove variable.
+       (org-open-file): Integrate org-file-apps-ex functionality back
+       into org-file-apps, and decide whether to match a regexp against
+       the link or the filename using org-file-apps-entry-uses-grouping-p.
+
+2010-07-19  Jan Böcker  <jan.boecker@jboecker.de>
+
+       * org.el (org-file-apps-ex): New variable.
+       (org-open-file): Before considering org-file-apps, first match the
+       regexps from org-file-apps-ex against the whole link.  See
+       docstring of org-file-apps-ex.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org.el (org-export-latex-default-packages-alist): Remove
+       microtype package.
+       (org-todo-repeat-to-state): New variable.
+       (org-auto-repeat-maybe): Allow user-selected target states.
+       (org-default-properties): Add the new property REPEAT_TO_STATE.
+
+2010-07-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-mobile.el (org-mobile-check-setup): Make sure that there is
+       a binary to compute checksums.
+
+2010-06-26  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-agenda.el (org-agenda-goto-calendar): Do not bind obsolete
+       variables.
+
+       * org.el (calendar): Require calendar now on top level in org.el
+       and define aliases to new variables when needed.
+       (org-read-date, org-goto-calendar): Do not bind obsolete
+       variables.
+
+2010-06-22  Glenn Morris  <rgm@gnu.org>
+
+       * org-entities.el: Add explicit utf-8 coding cookie to file with
+       utf-8 characters.
+
+2010-05-26  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * org.el (org-file-complete-link): Avoid (expand-file-name ".").
+
 2010-05-07  Chong Yidong  <cyd@stupidchicken.com>
 
-       * Version 23.2 released.
+       * Version 23.2 released.
+
+2010-05-05  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * org-table.el (orgtbl-setup):
+       * org-agenda.el (org-agenda-entry-text-mode): Simplify.
+
+2010-05-03  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * org-table.el (orgtbl-mode): Use define-minor-mode.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org.el (org-insert-link): Find the link buffer on visible frames.
+       (org-export-latex-default-packages-alist): Hyperref must be loaded
+       late.
+       (org-open-file): More care with the new matching for file links.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-latex.el (org-export-latex-preprocess): Do not yet protect
+       defined entities - these will be taken care of later.
+       (org-export-latex-special-chars): Post-process entity replacement.
+       (org-export-latex-fontify-headline): Do not yet protect defined
+       entities - these will be taken care of later.
+       (org-export-latex-tables, org-export-latex-links): Format the
+       caption properly.
+
+       * org-entities.el (org-entities-user): Fix typo.
+
+       * org.el (org-prepare-agenda-buffers): Uniquify TODO keywords.
+
+       * org-entities.el (org-entities-user): Improve docstring.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-entities.el (org-macs): Require org-macs, to be sure that we
+       have `declare-function' defined.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-latex.el (org-export-latex-classes): Update docstring.
+
+       * org.el (org-format-latex-header): Add cookies to the header.
+       (org-splice-latex-header): Implement placement according to cookies.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-publish.el (org-publish-aux-preprocess): Control case
+       sensitivity.
+
+2010-04-10  Bastien Guerry  <bzg@altern.org>
+
+       * org.el (org-splice-latex-header): Fix typo.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-latex.el (org-export-latex-make-header):
+       Use `org-splice-latex-header' to build the header.
+       (org-export-latex-classes): Update docstring.
+
+       * org.el (org-splice-latex-header): New function.
+       (org-create-formula-image): Use `org-splice-latex-header' to build
+       the header.
+
+       * org-gnus.el (org-gnus-follow-link): Handle nndoc backend.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org.el (org-export-latex-packages-alist)
+       (org-export-latex-default-packages-alist): Fix docstring to
+       reflect the expected structure.
+
+       * org-docbook.el (org-docbook-do-expand): Fix bug with variable names.
+       (org-export-docbook-finalize-table): Make use of label for tables.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-attach.el (org-attach-commit): Split on newlines.
+
+       * org.el (org-export-latex-default-packages-alist): Use list
+       instead of cons for the entries.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-entities.el (org-entity-get-representation): Catch the case
+       that there is not entry in the list.
+
+       * org-mobile.el (org-mobile-use-encryption)
+       (org-mobile-encryption-tempfile, org-mobile-encryption-password):
+       New options.
+       (org-mobile-check-setup): CHeck the encryption setup.
+       (org-mobile-copy-agenda-files, org-mobile-sumo-agenda-command)
+       (org-mobile-create-sumo-agenda): Use encryption code.
+       (org-mobile-encrypt-and-move): New function.
+       (org-mobile-encrypt-file, org-mobile-decrypt-file): New
+       functions.
+       (org-mobile-move-capture): Decrypt the capture file.
+
+       * org.el (org-entities): Require the new file.
+       (org-export-latex-default-packages-alist): New variable.
+       (org-complete): Use new entity code for completion.
+       (org-create-formula-image): Use the new packages variable.
+
+       * org-latex.el (org-export-latex-classes): Remove the standard
+       packages from the class headers.
+       (org-export-latex-make-header): Use the new package variable.
+       (org-export-latex-special-chars): Better regexp for entities, to
+       support entity name that contain numbers.
+       (org-export-latex-treat-backslash-char): Use the new entity code.
+
+       * org-html.el (org-html-do-expand): Use the new entity code.
+
+       * org-exp.el (org-export): Add the new export commands.
+       (org-html-entities): Constant removed.
+       (org-export-visible): Add the new export commands.
+
+       * org-docbook.el (org-docbook-do-expand): Use new entity code.
+
+       * org-ascii.el (org-export-ascii-entities): New variable.
+       (org-export-as-latin1, org-export-as-latin1-to-buffer)
+       (org-export-as-utf8, org-export-as-utf8-to-buffer): New commands.
+       (org-export-as-encoding): New function.
+       (org-export-ascii-preprocess): Call `org-ascii-replace-entities'.
+       (org-ascii-replace-entities): New function.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+            Ulf Stegemann  <ulf@zeitform.de>
+
+       * org-entities.el: New file.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-html.el (org-html-level-start): Catch the case that target
+       might be nil.
+
+2010-04-10  Dan Davison  <davison@stats.ox.ac.uk>
+
+       * org.el (org-appearance): Change Customize group variable name
+       from org-font-lock to org-appearance, and change tag from "Org
+       Font Lock" to "Org Appearance".
+       (org-odd-levels-only): Change Customize group variable name.
+       (org-level-color-stars-only): Change Customize group variable name.
+       (org-hide-leading-stars): Change Customize group variable name.
+       (org-hidden-keywords): Change Customize group variable name.
+       (org-fontify-done-headline): Change Customize group variable name.
+       (org-fontify-emphasized-text): Change Customize group variable name.
+       (org-fontify-whole-heading-line): Change Customize group variable name.
+       (org-highlight-latex-fragments-and-specials): Change Customize
+       group variable name.
+       (org-hide-emphasis-markers): Change Customize group variable name.
+       (org-emphasis-alist): Change Customize group variable name.
+       (org-emphasis-regexp-components): Change Customize group variable
+       name.
+       (org-modules): Remove mention of org-R.
+
+       * org-faces.el (org-faces): Change Customize group variable name.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-agenda.el (org-diary-last-run-time): New variable.
+       (org-diary): Prepare agenda buffers only if last call was some
+       time ago.
+
+       * org-html.el (org-export-html-preprocess): Replace \ref macros
+       with a link.
+       (org-format-org-table-html): Add the label as an anchor.
+
+       * org-docbook.el (org-export-docbook-format-image): Do some
+       formatting on captions.
+
+       * org-latex.el (org-export-latex-tables, org-export-latex-links):
+       Do some formatting on captions.
+
+       * org-html.el (org-export-html-format-image)
+       (org-format-org-table-html): Do some formatting on captions.
+
+2010-04-10  Dan Davison  <davison@stats.ox.ac.uk>
+
+       * org.el (org-hidden-keywords): New customizable variable.  This is
+       a list of symbols specifying which of the special keywords #+DATE,
+       #+AUTHOR, #+EMAIL and #+TITLE should be hidden by font lock.
+       (org-fontify-meta-lines-and-blocks): Changes to font-lock code
+       implementing new faces and hiding behaviour.
+
+       * org-faces.el (org-document-title): New face for #+TITLE lines.
+       (org-document-info): New face for #+DATE, #+AUTHOR, #+EMAIL lines.
+       (org-document-info-keyword): New face for #+DATE, #+AUTHOR, #+EMAIL
+       keywords.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-publish.el (org-publish-sanitize-plist): New function to
+       rename "index" properties to "sitemap".  Do this renaming
+       globally.
+       (org-publish-with-aux-preprocess-maybe): New macro.
+       (org-publish-org-to-pdf, org-publish-org-to-html): Use the new
+       macro.
+       (org-publish-aux-preprocess)
+       (org-publish-index-generate-theindex.inc): New function.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-table.el (org-table-align): Interpret <N> at fixed width,
+       not as maximum width.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-exp.el (org-export-author-info, org-export-email-info): Fix
+       docstrings.
+
+       * org-beamer.el (org-beamer-select-environment): Rename from
+       `org-beamer-set-environment-tag'.  Improve docstring.
+
+       * org-freemind.el (org-freemind-write-mm-buffer): Fix another
+       problem with odd levels.
+
+       * org-ascii.el (org-export-as-ascii): Export email only if the
+       author wants it.
+
+       * org-docbook.el (org-export-as-docbook): Export email only if the
+       author wants it.
+
+       * org-html.el (org-export-as-html): Export email only if the
+       author wants it.
+
+       * org-exp.el (org-export-email-info): New option.
+       (org-export-plist-vars): Add entry for `org-export-email'.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-table.el (org-table-goto-line): Fix typo.
+
+2010-04-10  Mikael Fornius  <mfo@abc.se>
+
+       * org.el (org-agenda-files): Typo.
+       (org-read-agenda-file-list): Add optional argument to help
+       `org-store-new-agenda-file-list' to remember un-expanded file
+       names.  Expand file names relative to `org-directory'.
+       (org-store-new-agenda-file-list): Keep un-expanded file names when
+       saving, if available.
+       (org-agenda-files): Update documentation.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-ascii.el (org-export-as-ascii): Catch the case of exporting
+       a buffer with no file name attached.
+
+       * org.el (org-log-refile): New option.
+       (org-log-note-headings): Add a heading for refiling.
+       (org-startup-options): Add keywords for logging of the refile
+       action.
+       (org-refile): Add logging action.
+       (org-add-log-note): Allow for refiling action.
+
+       * org-agenda.el (org-agenda-bulk-action): Make sure
+       `org-log-refile' is not `note' during a bulk action.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org.el (org-map-dblocks): Use save-excursion to remember the
+       position.
+
+       * org-attach.el (org-attach-commit): Remove dependence on xargs.
+       (org-attach-delete-one): Commit after deleting a file.
+
+       * org-latex.el (org-export-latex-fontify): Do not mistake table.el
+       borders for strike-through emphasis.
+
+       * org-freemind.el (org-freemind-write-mm-buffer): Simplify the
+       handling of odd levels.
+
+       * org-agenda.el (org-agenda-todo-ignore-deadlines): Document `past'
+       and `future' values.
+       (org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item):
+       Handle `past' and `future' values.
+
+       * org.el (org-read-agenda-file-list): Interpret file names
+       relative to org-directory and allow environment variables and
+       "~".
+
+       * org-latex.el (org-export-latex-special-chars): Allow a
+       parenthesis before an exponent or subscript.
+
+2010-04-10  Dan Davison  <davison@stats.ox.ac.uk>
+
+       * org-src.el (org-edit-src-exit): When returning from code edit
+       buffer, if code block is hidden, leave point at start of
+       #+begin_src line.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org.el (org-insert-heading): Do not remove all spaces if the
+       headline is empty.
+
+       * org-indent.el (org-indent): Fix group name.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-table.el (org-table-goto-column): Fix forcing a non-existing
+       column.
+       (org-table-get, org-table-put, org-table-goto-line)
+       (org-table-current-line): New functions.
+
+2010-04-10  Jan Böcker  <jan.boecker@jboecker.de>
+
+       * org.el (org-open-file): Allow regular expressions in
+       org-file-apps to capture link parameters using groups.  In a
+       command string to be executed, the parameters can be referenced
+       using %1, %2, etc.  Lisp forms can access them using
+       (match-string n link).
+       (org-apps-regexp-alist): Adopt the created regexp, as this is now
+       matched against a file: link instead of the file name.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-crypt.el (org-reveal-start-hook): Add a decryption function
+       to this hook.
+       (org-decrypt-entries, org-encrypt-entries, org-decrypt-entry): Add
+       docstrings.
+
+       * org.el (org-point-at-end-of-empty-headline)
+       (org-level-increment, org-get-previous-line-level): New function.
+       (org-cycle-level): Rewritten to be independent of when this
+       function is called.
+       (org-in-regexps-block-p): New function.
+       (org-reveal-start-hook): New hook.
+       (org-reveal): Run new hook.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-latex.el (org-export-latex-keywords): Start a new paragraph
+       after time keywords, do not add "\newline".
+
+       * org-html.el (org-export-as-html): Avoid double # in href.
+
+       * org.el (org-refile-get-location): Catch an invalid target
+       specification.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-agenda.el (org-agenda-add-entry-to-org-agenda-diary-file):
+       Make sure the behavior regarding to extracting time is
+       consistent.
+
+2010-04-10  Stephen Eglen  <stephen@gnu.org>
+
+       * org-agenda.el (org-agenda-insert-diary-extract-time): New
+       variable.
+       (org-agenda-add-entry-to-org-agenda-diary-file): Use this new
+       variable rather than `org-agenda-search-headline-for-time'.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-list.el (org-fix-bullet-type): Improve cursor positioning.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org.el (org-adaptive-fill-regexp-backup): New variable.
+       (org-set-autofill-regexps): Store a backup of
+       `adaptive-fill-regexp'.
+       (org-adaptive-fill-function): Fix filling of comments and ordered
+       lists.  If there is no other match, till try adaptive fill.
+
+2010-04-10  John Wiegley  <jwiegley@gmail.com>
+
+       * org-agenda.el (org-agenda-include-deadlines): Add new
+       customization variable to determine whether unscheduled tasks
+       should appear in the agenda solely because of their deadline.
+       Default to true, which was the previous behavior (it just wasn't
+       configurable).
+       (org-agenda-mode-map, org-agenda-view-mode-dispatch): Bind ! in
+       the agenda to show/hide deadline tasks.
+       (org-agenda-menu): Add menu option for show/hide deadlines.
+       (org-agenda-list): Make the agenda list sensitive to the value of
+       `org-agenda-include-deadlines'.
+       (org-agenda-toggle-deadlines): New function to toggle the value of
+       `org-agenda-include-deadlines' and repaint the modeline
+       indicators.
+       (org-agenda-set-mode-name): Show "Deadlines" in the agenda
+       modeline if deadline tasks are being displayed.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-table.el (org-table-eval-formula): Replace $# and @# by
+       current column and row number.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org.el (org-set-property, org-delete-property): Go back to
+       prompting for the property.
+
+       * org-latex.el (org-export-latex-make-header): Fully process
+       author line.
+       (org-export-latex-fontify-headline): Allow several arguments, not
+       just one.
+       (org-export-latex-fix-inputenc): Catch the error when
+       `latexenc-coding-system-to-inputenc' is not defined.
+
+       * org-agenda.el (org-agenda-skip-if-todo): New function.
+       (org-agenda-skip-if): Add conditions for TODO keywords.
+       (org-agenda-skip-if): Document the new todo conditions.
+
+2010-04-10  Mikael Fornius  <mfo@abc.se>
+
+       * org.el (org-at-property-p): Check if we are inside a property
+       drawer not just any drawer.
+       (org-set-property, org-delete-property): When cursor is on a
+       property key value pair do not prompt for property name instead
+       use name at cursor.
+       (org-ctrl-c-ctrl-c): Still do org-property-action when cursor is
+       on the first line of a property drawer.
+       (org-property-end-re): Spell check.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-exp.el (org-export-attach-captions-and-attributes): Add the
+       properties to the entire table, in case the first line is
+       removed.
+
+       * org-archive.el (org-archive-reversed-order): New option.
+       (org-archive-subtree, org-archive-to-archive-sibling): Use the new
+       option `org-archive-reversed-order'.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-agenda.el (org-agenda-entry-types): New variable.
+       (org-agenda-list): Use `org-agenda-entry-types'.
+       (org-agenda-custom-commands-local-options): Support for setting
+       `org-agenda-entry-types' as an option.
+       (org-diary): Shift some documentation from here to the variable
+       `org-agenda-entry-types'.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-latex.el (org-export-latex-make-header): Apply macros in
+       author field.
+
+       * org-clock.el (org-clocking-buffer, org-clocking-p): New function.
+       (org-clock-select-task, org-clock-notify-once-if-expired)
+       (org-clock-in, org-clock-out, org-clock-cancel, org-clock-goto)
+       (org-clock-out-if-current, org-clock-save): Use the new functions.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-docbook.el (org-export-as-docbook): Remove unnecessary
+       newline.
+       (org-export-as-docbook): Remove unnecessary newline.
+       (org-export-as-docbook): Fix problem with double footnote
+       reference in one place.
+
+       * org-exp.el (org-export-format-source-code-or-example): Remove
+       unnecessary newline.
+
+       * org.el (org-deadline, org-schedule): Allow rescheduling entries
+       with repeaters.
+
+       * org-table.el (org-table-convert-refs-to-rc): Better way to catch
+       function calls that look like references.
+
+       * org.el (org-open-at-point): Get link abbreviations from
+       reference buffer.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-table.el (org-table-convert-refs-to-rc): Do not read arctan2
+       as a reference.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org.el (org-link-unescape): Solve issue with lower-case escapes.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-latex.el (org-export-latex-classes): Add
+       \usepackage{latexsym} to all classes.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-html.el (org-export-as-html): Do not allow protected lines
+       into the table of contents.
+
+       * org-latex.el (org-export-latex-special-chars): Find subsequent
+       occurrences of special characters.
+       (org-export-latex-tables): Do not convert table-like stuff that is
+       protected.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-list.el (org-toggle-checkbox): No errors when updating
+       checkbox count fails because there is no heading.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-clock.el (org-clock-report-include-clocking-task): New
+       option.
+       (org-clock-sum): Add the current clocking task.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org.el (org-cycle): Print a message when in a table.el table.
+       (org-edit-special): Recognize the table.el context.
+       (org-ctrl-c-ctrl-c): Print a message when in a table.el table.
+
+       * org-src.el (org-at-table.el-p): Declare.
+       (org-edit-src-code): Handle a special case for table.el editing.
+       (org-edit-src-find-region-and-lang): Recognize the table.el
+       context.
+
+       * org-latex.el (org-export-latex-tables): Convert table.el
+       tables.
+       (org-export-latex-convert-table.el-table): New function.
+
+       * org-html.el (org-html-expand): Fix table.el export.
+
+       * org-latex.el (org-export-latex-preprocess): Protect footnotes in
+       headings.
+
+       * org-id.el (org-id-find-id-file): Fix bug when there is no hash
+       table for the id locations.
+
+       * org.el (org-read-date-analyze): Match American-style dates, like
+       5/30 or 5/13/7.  Make sure cal-iso.el is loaded.  Don't force he
+       current year when reading ISO and American dates.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org.el (org-face-from-face-or-color): New function.
+       (org-get-todo-face, org-font-lock-add-priority-faces)
+       (org-get-tag-face): Use `org-face-from-face-or-color'.
+
+       * org-faces.el (org-todo-keyword-faces, org-priority-faces): Allow
+       simple colors as values.
+       (org-faces-easy-properties): New option.
+
+       * org-agenda.el (org-agenda-set-mode-name): Show if the agenda is
+       restricted, as an agenda mode.
+       (org-agenda-fontify-priorities): Allow simple colors as values.
+
+2010-04-10  Bastien Guerry  <bzg@altern.org>
+
+       * org-timer.el (org-timer-current-timer): Rename from
+       `org-timer-last-timer'.
+       (org-timer-timer1, org-timer-timer2, org-timer-timer3): Remove.
+       (org-timer-cancel-timer, org-timer-show-remaining-time)
+       (org-timer-set-timer): Update to use only one timer.
+
+       * org.el (org-set-property): Remove useless space in the prompt.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-html.el (org-export-html-style-default): Add a default style
+       for textareas.
+
+       * org-exp.el (org-export-format-source-code-or-example): Fix
+       textarea tag.
+
+2010-04-10  Bastien Guerry  <bzg@altern.org>
+
+       * org-clock.el (org-clock-current-task): New variable to store
+       last clocked in task.
+       (org-clock-set-current, org-clock-delete-current): New functions.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-remember.el (org-remember-apply-template): Extend comment.
+       (org-remember-handler): Implement clock sibling filing.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-publish.el (org-publish-all, org-publish-current-file)
+       (org-publish-current-project): When called with prefix argument
+       FORCE, also rebuild the validation file list.
+
+       * org-latex.el (org-export-latex-preprocess): Protect footnotes in
+       section headings.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-html.el (org-export-as-html-and-open): Kill product buffer
+       if the user wants that.
+
+       * org-latex.el (org-export-as-pdf-and-open): Kill product buffer
+       if the user wants that.
+
+       * org-exp.el (org-export-kill-product-buffer-when-displayed): New
+       option.
+
+       * org-agenda.el (org-batch-agenda-csv): Use the time property
+       instead of the `time-of-day' property.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-timer.el (org-timer-start-hook, org-timer-stop-hook)
+       (org-timer-pause-hook, org-timer-set-hook)
+       (org-timer-cancel-hook): New hooks.
+       (org-timer-start): Run `org-timer-start-hook'.
+       (org-timer-pause-or-continue): Run `org-timer-pause-hook'.
+       (org-timer-stop): Run `org-timer-stop-hook'.
+       (org-timer-cancel-timers): Run `org-timer-cancel-hook'.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org.el (org-reveal): Double prefix arg shows the subtree of the
+       parent.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-agenda.el (org-search-view): Fix bug with searching full
+       words in headlines in search view.
+       (org-agenda-skip-deadline-prewarning-if-scheduled): New option.
+       (org-agenda-get-deadlines): Suppress pre-warning if the entry is
+       scheduled (if the user configures it so.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org.el (org-hide-archived-subtrees): Don't jump to end of
+       subtree if the match was not in a headline.
+       (org-inside-latex-macro-p): Allow more complex arguments.
+       (org-emphasize): Protect against use at end of buffer.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-agenda.el (org-agenda-align-tags): Avoid side effects on
+       text properties.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-agenda.el (org-agenda-todo-ignore-scheduled): More allowed
+       values.
+       (org-agenda-todo-ignore-scheduled)
+       (org-agenda-todo-ignore-deadlines): More control with different
+       allowed values.
+       (org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item):
+       Honor the new option settings.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org.el (org-get-location): Make sure the selection buffer is
+       shown in the current frame.
+
+       * org-ascii.el (org-export-ascii-table-widen-columns): New
+       option.
+       (org-export-ascii-preprocess): Realign tables to remove narrowing
+       if `org-export-ascii-table-widen-columns' is set.
+
+       * org-table.el (org-table-do-narrow): New variable.
+       (org-table-align): Narrow only if `org-table-do-narrow' is t.
+
+       * org.el (org-deadline, org-schedule): Allow updating if the
+       relevant time stamp does not have a repeater, i.e. do not require
+       that no time stamp has a repeater.
+
+       * org-agenda.el (org-agenda-align-tags): Don't add a face to the
+       new white space before the tags.
+
+       * org-latex.el (org-export-as-latex): Do nit require the buffer to
+       be visiting a file when only exporting to a buffer or string.
+       (org-export-latex-fix-inputenc): Only save the buffer is there is
+       a file name attached to it.
+
+2010-04-10  Dan Davison  <davison@stats.ox.ac.uk>
+
+       * org-src.el (org-edit-src-exit): Widen before exiting edit buffers.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org.el (org-fontify-meta-lines-and-blocks): Honor
+       `org-fontify-quote-and-verse-blocks'.
+
+       * org-faces.el (org-fontify-quote-and-verse-blocks): New option.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org.el (org-open-at-point): Also check for text property
+       org-linked-text before offering collected links.
+
+2010-04-10  Stephen Eglen  <stephen@gnu.org>
+
+       * org-agenda.el (org-agenda-add-entry-to-org-agenda-diary-file):
+       Optionally extract time specification from text and add to the
+       timestamp.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-exp.el (org-html-entities): Fix typo.
+
+       * org-latex.el (org-export-latex-make-header): Use \providecommand
+       to make sure the \alert macro is defined.
+
+       * org.el (org-format-latex-signal-error)
+       (org-create-formula-image): Use `org-format-latex-signal-error'.
+
+2010-04-10  Stephen Eglen  <stephen@gnu.org>
+
+       * org.el (org-store-link): For dired buffers, use
+       default-directory as link name if dired-get-filename returns
+       nil.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-exp.el (org-export-concatenate-multiline-links): The for
+       protectedness at beginning of match.
+
+       * org-latex.el (org-export-latex-fix-inputenc): Never leave the
+       AUTO as a coding system, instead default to utf8.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org.el (org-block-todo-from-children-or-siblings-or-parent)
+       (org-block-todo-from-checkboxes): Respect the local variable
+       value when deciding if blocking should be active.
+
+       * org-latex.el (org-export-latex-make-header): Define the align
+       macro if it is not yet defined.
+
+       * org-agenda.el (org-agenda-insert-diary-make-new-entry): Call
+       `org-insert-heading' with the INVISIBLE-OK argument.
+
+       * org-mac-message.el (org-mac-message-insert-flagged): Call
+       `org-insert-heading' with the INVISIBLE-OK argument.
+
+       * org.el (org-insert-heading): New argument INVISIBLE-OK.
+
+       * org-agenda.el (org-agenda-view-mode-dispatch): Improve the
+       prompt message.
+
+       * org-html.el (org-html-level-start): Use the
+       `html-container-class' text property to set an additional class
+       for an outline container.
+
+       * org-exp.el (org-export-remember-html-container-classes): New
+       function.
+       (org-export-preprocess-string): Call
+       `org-export-remember-html-container-classes'.
+
+       * org.el (org-cycle): Mention level cycling in the docstring.
+       (org-default-properties): Add new property HTML_CONTAINER_CLASS.
+
+       * org-remember.el (org-remember-apply-template): Do file insertion
+       first.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-habit.el (org-habit-insert-consistency-graphs): Fix a
+       problem with mis-aligned graphs when showing habits.
+
+2010-04-10  Mikael Fornius  <mfo@abc.se>
+
+       * org.el (org-assign-fast-keys): Prefer keys used in keyword name
+       when assigning.  Begin using numerical characters when all in name
+       is used up.  This is to spare alphanumeric characters for better
+       match with other keywords.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-exp.el (org-export-preprocess-hook): Improve documentation.
+
+       * org-latex.el (org-export-latex-preprocess): More consistent
+       conversion and protection of the words LaTeX and TeX.
+       (org-export-latex-fontify-headline, org-export-latex-preprocess):
+       Allow angle brackets in commands, for beamer.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-clock.el (org-clock-in): Improve the look of the clock line
+       by formatting links.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-latex.el (org-export-latex-classes): Use AUTO as the place
+       holder string for the coding system.  And improve the
+       documentation.
+       (org-export-latex-fix-inputenc): Only modify the coding system if
+       it is given by the placeholder AUTO.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-clock.el (org-task-overrun-text): New option.
+       (org-task-overrun, org-clock-update-period): New variables.
+       (org-clock-get-clock-string, org-clock-update-mode-line): Mark
+       overrun clock.
+       (org-clock-notify-once-if-expired): Check if clock is overrun.
+
+       * org-faces.el: New face `org-mode-line-clock-overrun'.
+
+2010-04-10  Jan Böcker  <jan.boecker@jboecker.de>
+
+       * org.el (org-narrow-to-subtree): Position the end of the narrowed
+       region before the line with the next heading, to prevent the user
+       from prepending text to the next headline.
+
+2010-04-10  Stephen Eglen  <stephen@gnu.org>
+
+       * org-agenda.el (org-get-time-of-day): Use
+       org-agenda-time-leading-zero to allow leading zero (rather than
+       space) for times.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-agenda.el (org-agenda-diary-entry-in-org-file): Make sure
+       org-datetree.el is loaded.
+
+       * org-datetree.el: Autoload `org-datetree-find-day-create'.
+
+       * org-latex.el (org-export-latex-hyperref-format): New option.
+       (org-export-latex-links): Use `org-export-latex-hyperref-format'.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-ctags.el (org-ctags-enable): Change order of functions.
+       (org-ctags-create-tags): Add wildcard to file name expansion.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org.el (org-entry-properties): Fix some important bugs.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org.el (org-link-unescape, org-link-escape): Only use hexlify if
+       the table is not explicitly given.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-clock.el (org-clock-out-when-done): Allow a list of keywords
+       as value.
+       (org-clock-out-if-current): Work with the new list value of
+       `org-clock-out-when-done'.
+       (org-clock-out, org-clock-out-if-current): Avoid circular logic
+       between clocking out and state changes.
+
+       * org-ctags.el (org-ctags-path-to-ctags): Better system-type test.
+
+       * org-latex.el (org-export-latex-treat-backslash-char): Do not by
+       accident protect a character that is before a backslash.
+
+2010-04-10  Paul Sexton  <eeeickythump@gmail.com>
+
+       * org-ctags.el: New file.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-agenda.el (org-diary-class): Use
+       `org-order-calendar-date-args'.
+
+       * org.el (org-order-calendar-date-args): New function.
+
+       * org-exp.el (org-export-target-internal-links): Check for
+       protectedness after the first bracket.
+
+       * org.el (org-entry-properties): Don't match wrong-case TODO
+       keywords.
+
+       * org-agenda.el (org-agenda-schedule, org-agenda-deadline):
+       Document that ARG is passed through to remove the date.
+       (org-agenda-bulk-action): Accept prefix arg and pass it on.  Do
+       not read a date when the user has given a `C-u' prefix.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-agenda.el (org-agenda-fix-displayed-tags): Fix bug when all
+       tags are hidden.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-latex.el (org-export-latex-fix-inputenc): New function.
+       (org-export-latex-inputenc-alist): New option.
+
+       * org-exp.el (org-export): New key SPC to publish enclosing
+       subtree.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-indent.el (org-indent-add-properties): Catch case when there
+       is no headline in the buffer.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-exp.el (org-html-entities): Add checkmark symbol.
+
+       * org-ascii.el (org-export-ascii-preprocess): Protect targets in
+       verbatim code for ASCII export.
+
+       * org.el (org-update-statistics-cookies): Also see checkboxes in
+       ordered lists.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-agenda.el (org-agenda-view-mode-dispatch): Define the `L'
+       key.
+
+       * org-beamer.el (org-beamer-amend-header): Change the location
+       where `org-beamer-header-extra' is inserted.
+
+       * org.el (org-compute-latex-and-specials-regexp): Don't do BIND
+       just for computing this regexp.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-beamer.el (org-beamer-frame-default-options): New option.
+       (org-beamer-sectioning): Use default options if the user does not
+       have defined any.
+       (org-beamer-fix-toc): Put a frame around the table of contents.
+
+       * org-exp.el (org-export-remove-comment-blocks-and-subtrees): Make
+       sure case-folding works well when processing comment stuff.
+
+       * org-latex.el (org-export-latex-after-save-hook): New hook.
+       (org-export-as-latex): Run the new hook.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-beamer.el (org-beamer-environments-default): Add the note
+       environments.
+       (org-beamer-after-initial-vars): Allow several BEAMER_HEADER_EXTRA
+       lines and collect and combine the content.
+       (org-beamer-after-initial-vars): Check for note tags and make sure
+       they will be seen like a property.
+
+       * org.el (org-offer-links-in-entry): Fix bug when there is a
+       single link.
+
+       * org-exp.el (org-export): Make sure the mark is activated, also
+       when `transient-mark-mode' is off.
+
+       * org-agenda.el (org-agenda-search-view-always-boolean): New option.
+       (org-agenda-search-view-search-words-only): Obsolete variable, is
+       now an alias for `org-agenda-search-view-always-boolean'.
+       (org-agenda-search-view-force-full-words): New option.
+       (org-search-view): Improve docstring, and implement a better logic
+       for Boolean and phrase searches.
+       (org-agenda-last-search-view-search-was-boolean): New variable.
+       (org-agenda-manipulate-query): Consider the type of the last
+       search when modifying the search string.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-latex.el (org-export-as-latex): Do the first letbind in the
+       right moment.
+
+       * org-agenda.el (org-get-entries-from-diary): Add the new face to
+       these entries.
+
+       * org-faces.el (org-agenda-diary): New face.
+
+       * org.el (org-make-link-regexps): Allow regexp-special characters
+       in link types.
+       (org-open-file): When in-emacs is `system', also force system
+       opening, like when the value was `(16)'.
+       (org-update-statistics-cookies): Handle entries without children.
+
+       * org-exp.el
+       (org-export-preprocess-before-normalizing-links-hook): New hook.
+       (org-export-preprocess-string): Run the new hook.
+
+       * org.el (org-offer-links-in-entry): Make RET open all links.
+
+       * org-html.el (org-export-as-html): Remove any leftover display
+       properties in the html file.
+
+       * org-wl.el (org-wl-store-link): Work-around for format bug with
+       text properties.
+
+       * org-habit.el (org-habit-insert-consistency-graphs): Turn off
+       invisibility while adding the graphs.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-remember.el (org-select-remember-template): Use C letter to
+       customize remember templates.
+
+       * org-agenda.el (org-agenda-bulk-mark, org-agenda-bulk-unmark):
+       Move cursor to next visible line.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-beamer.el (org-beamer-sectioning): Leave columns environment
+       by specifying 0 or 1 for column width.
+       (org-beamer-column-widths): Make 0 stand for 0.0.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-exp.el (org-export-mark-radio-links): Don't match inside
+       <<target>>.
+
+       * org.el (org-format-latex-header-extra): New variable.
+       (org-format-latex): Set org-format-latex-header-extra from
+       in-buffer stuff.
+       (org-format-latex): Add org-format-latex-header-extra to the
+       variables on which image creation depends.
+       (org-create-formula-image): Add the header stuff from in-buffer
+       settings.
+       (org-read-date-analyze): Base the analysis for future preference
+       on NOW, not on the default date.
+
+       * org-inlinetask.el (org-inlinetask-export-handler): Add CSS class
+       for TODO keyword in inline tasks.
+
+       * org.el (org-log-note-headings): New headings for removing
+       deadline or scheduling date.
+       (org-deadline, org-schedule): Arrange for logging when removing a
+       date.
+       (org-add-log-note): Handle deadline and scheduling removal.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-exp.el (org-export-visible): Add LaTeX/pdf export.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-agenda.el (org-diary-class): New function.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-latex.el (org-export-latex-preprocess): Do process the text
+       of a radio target.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org.el (org-entry-properties): Add TIMESTAMP properties back
+       in.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org.el (org-all-time-keywords): New variable.
+       (org-set-regexps-and-options): Set `org-all-time-keywords'.
+       (org-entry-blocked-p): New function.
+       (org-special-properties): Add BLOCKED as a new special property.
+       (org-entry-properties): New optional argument SPECIFIC, only parse
+       for this property when it is specified.
+       (org-entry-get): Pass a SPECIFIC argument to
+       `org-entry-properties'.
+
+       * org-latex.el (org-export-as-latex): Preprocess TEXT as well.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-latex.el (org-export-latex-tables): No forced line end if
+       there is no caption.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-exp.el (org-html-entities): Add Euro symbols from Marvosym
+       package.
+
+       * org-latex.el (org-export-latex-tables): Only add a caption when
+       macro in in longtable environments if one has been defined.
+
+       * org-html.el (org-export-as-html): Only take title from buffer if
+       not exporting body-only.
+
+       * org-latex.el (org-export-latex-preprocess): Better version of
+       the regular expression for protecting LaTeX macros.
+       (org-export-latex-preprocess): Start searching for macros to
+       protect from beginning of buffer.
+
+       * org-exp.el (org-export-target-internal-links): Check for
+       protectedness earlier in the string.
+
+       * org-agenda.el (org-agenda-highlight-todo): Match TODO keywords
+       case sensitively.
+
+       * org-id.el (org-id-store-link): Match TODO keywords case
+       sensitively.
+
+       * org.el (org-heading-components, org-get-outline-path)
+       (org-display-outline-path): Match TODO keywords case sensitively.
+
+       * org-latex.el (org-export-as-latex): Ignore read-only
+       properties.
+
+       * org-exp.el (org-export-preprocess-string): Remove any
+       `read-only' properties.
+
+       * org-agenda.el (org-agenda-inactive-leader): New option.
+       (org-agenda-get-timestamps): Use `org-agenda-inactive-leader'.
+       (org-tags-view): Prompt for matcher if MATCH is an empty string.
+       (org-todo-list): Prompt for matcher if ARG is an empty string.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org.el (org-open-link-functions): New hook.
+       (org-open-at-point): Run `org-open-link-functions'.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-agenda.el (org-agenda-date-prompt): Allow inactive time
+       stamps as well.
+
+       * org.el (org-inhibit-startup-visibility-stuff): New variable.
+       (org-mode): Don't do startup visibility if inhibited.
+       (org-outline-overlay-data, org-set-outline-overlay-data): New
+       functions.
+       (org-save-outline-visibility): New macro.
+       (org-log-note-headings): Document that one should not change the
+       `state' note format.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org.el (org-make-link-regexps): Capture link path into a group.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-beamer.el (org-beamer-after-initial-vars): Do not overwrite
+       the options plist.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org.el (org-startup-with-beamer-mode): New option.
+       (org-property-changed-functions)
+       (org-property-allowed-value-functions): New hooks.
+       (org-entry-put, org-property-get-allowed-values): Run the new
+       hooks.
+       (org-property-next-allowed-value): Run the new hooks.
+
+       * org-exp.el (org-export-select-backend-specific-text): Add the
+       special beamer tags.
+
+       * org-beamer.el: New file.
+
+       * org-latex.el (org-export-latex-after-initial-vars-hook): New hook.
+       (org-export-as-latex): Run
+       `org-export-latex-after-initial-vars-hook'.
+       (org-export-latex-format-toc-function)
+       (org-export-latex-make-header): Call
+       `org-export-latex-format-toc-function'.
+
+       * org.el (org-fill-template): Make template searches case sensitive.
+
+       * org-exp.el (org-export): Use "1" as a sign to export only the
+       subtree.
+
+       * org-colview-xemacs.el (org-columns-edit-value): Use
+       org-unrestricted property.
+
+       * org-colview.el (org-columns-edit-value): Use
+       org-unrestricted property.
+
+       * org.el (org-compute-property-at-point): Set org-unrestricted
+       text property if the list contains ":ETC".
+       (org-insert-property-drawer): Use
+       org-unrestricted property.
+
+       * org-exp.el
+       (org-export-preprocess-before-selecting-backend-code-hook): New hook.
+       (org-export-preprocess-string): Run
+       `org-export-preprocess-before-selecting-backend-code-hook'.
+
+       * org-xoxo.el (org-export-as-xoxo): Run `org-export-first-hook'.
+
+       * org-latex.el (org-export-region-as-latex): Run
+       `org-export-first-hook'.
+
+       * org-html.el (org-export-as-html): Run `org-export-first-hook'.
+
+       * org-docbook.el (org-export-as-docbook): Run
+       `org-export-first-hook'.
+
+       * org-ascii.el (org-export-as-ascii): Run `org-export-first-hook'.
+
+       * org-exp.el (org-export-first-hook): New hook.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-list.el (org-previous-item): Exit at the beginning of the
+       buffer.
+
+       * org-id.el (org-id-locations-save): Only write the id locations
+       if any are defined.
+
+       * org-archive.el (org-archive-all-done): Make this work in a file
+       with org-odd-levels-only set.
+
+       * org.el (org-get-refile-targets): Catch the case when a buffer
+       has no file.
+
+       * org-latex.el (org-export-as-latex): Cleanup forced line ends
+       where they are not needed.
+       (org-export-latex-subcontent): Remove unnecessary newlines.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-latex.el (org-export-latex-make-header): Remove \obeylines.
+       (org-export-latex-fontify): Fix regexp bug that takes special
+       care of protecting the right boundary characters in emphasis
+       matches.
+       (org-export-latex-preprocess): Allow multiple arguments to latex
+       macros.
+
+       * org.el (org-make-link-regexps): Use John Gruber's regexp for
+       urls.
+
+       * org-macs.el (org-re): Interpret :punct: in regexps.
+
+       * org-exp.el (org-export-replace-src-segments-and-examples): Also
+       take the final newline after the END line.
+
+       * org.el (org-clean-visibility-after-subtree-move): Only fix
+       entries that are not entirely invisible already.
+       (org-insert-link): Respect org-link-file-path-type for
+       "docview:" links in addition to "file:" links.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-exp.el (org-export-format-source-code-or-example): Avoid
+       additional extra white lines in LaTeX.
+
+       * org-list.el (org-list-parse-list): Leave empty lines after the
+       list, don't consider them as part of the list.
+
+       * org-mobile.el (org-mobile-sumo-agenda-command): Allow tagstodo
+       searches.
+
+       * org-clock.el (org-clock-select-task): Convert integer to
+       character for XEmacs.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-clock.el (org-clock-resolve): Make reading a char XEmacs
+       compatible.
+
+2010-04-10  Tassilo Horn  <tassilo@member.fsf.org>
+
+       * org.el (org-complete-tags-always-offer-all-agenda-tags): New
+       variable.
+       (org-set-tags): Use it.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-list.el (org-empty-line-terminates-plain-lists): Update
+       docstring.
+
+       * org.el (org-format-latex): Fix link creation for processed latex
+       snippets.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-footnote.el (org-footnote-normalize): Protect replacement
+       text.
+
+       * org.el (org-inside-latex-macro-p): Save match data.
+
+2010-04-10  Jan Böcker  <jan.boecker@jboecker.de>
+
+       * org-docview.el: New file.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-latex.el (org-export-latex-class-options): New variable.
+       (org-export-latex-set-initial-vars): Use the class options.
+
+       * org.el (org-forward-same-level): Stop at headings that start
+       with an invisible character.
+       (org-additional-option-like-keywords): Add LaTeX_CLASS_OPTIONS.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-footnote.el (org-footnote-normalize): Don't take optional
+       arguments in LaTeX macros as footnotes.
+
+       * org.el (org-inside-latex-macro-p): New function.
+
+       * org-latex.el (org-latex-to-pdf-process): Change customization
+       group to `org-export-pdf'.
+
+       * org-agenda.el (org-agenda-get-blocks): Look at time string also
+       on days after the first one.
+
+       * org.el (org-insert-heading): Also check for item before assuming
+       before-first-heading condition.
+
+       * org-latex.el (org-latex-to-pdf-process): Fix typo in group tag.
+       (org-export-pdf-logfiles): New option.
+       (org-export-as-pdf): Use `org-export-pdf-logfiles'.
+       (org-export-pdf-logfiles): Fix customization type.
+
+       * org.el (org-insert-link): Improve error message when there is no
+       default link to select with RET.
+
+       * org-agenda.el (org-agenda-filter-by-tag): Use char argument from
+       parameter list.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-latex.el (org-export-latex-parse-global)
+       (org-export-latex-parse-content)
+       (org-export-latex-parse-subcontent): Use
+       `org-re-search-forward-unprotected'.
+       (org-export-as-pdf): Remove log files produced by XeTeX.
+
+       * org-macs.el (org-re-search-forward-unprotected): New function.
+
+2010-04-10  James TD Smith  <ahktenzero@mohorovi.cc>
+
+       * org-colview.el (org-agenda-colview-summarize): Sort out some
+       confusion between properties and titles, which resulted in
+       agenda summaries not working if a title was set for a column.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-mobile.el (org-mobile-agendas): New option.
+       (org-mobile-sumo-agenda-command): Select the right agendas.
+
+       * org-latex.el (org-export-latex-format-image): Preserve the
+       original-indentation property.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-clock.el (org-clock-insert-selection-line): Catch error when
+       an old tasks no longer exists.
+
+       * org-latex.el (org-export-as-pdf): Remove also the .idx file.
+       (org-export-as-pdf): Don't remove the old PDF file before making
+       the new one.
+
+       * org-mouse.el (org-mouse-end-headline, org-mouse-insert-item)
+       (org-mouse-context-menu): Use `org-looking-back'.
+
+       * org.el (org-cycle-level): Use `org-looking-back'.
+
+       * org-list.el (org-cycle-item-indentation): Use
+       `org-looking-back'.
+
+       * org-compat.el (org-looking-back): New function.
+
+       * org.el (org-insert-heading): Catch before-first-headline when
+       inserting a headline.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-latex.el (org-export-latex-format-image): Indent figure
+       environment, so that it does not interrupt plain list.
+
+       * org.el (org-open-at-point): Allow long link descriptions.
+
+2010-04-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+       * org-html.el (org-export-as-html): Remove empty lines at the
+       beginning of the exported text.
+
+2010-03-12  Chong Yidong  <cyd@stupidchicken.com>
+
+       * org.el (org): Remove from hypermedia group.
+
+2010-03-10  Chong Yidong  <cyd@stupidchicken.com>
+
+       * Branch for 23.2.
 
 2010-02-15  Chong Yidong  <cyd@stupidchicken.com>
 
 
 2009-11-13  Dan Davison  <davison@stats.ox.ac.uk>
 
-       * org-exp.el (org-export-format-source-code-or-example): restrict
+       * org-exp.el (org-export-format-source-code-or-example): Restrict
        scope of preserve-indentp to the let binding.
-       (org-src): require org-src, since org-src-preserve-indentation is used.
+       (org-src): Require org-src, since org-src-preserve-indentation is used.
 
 2009-11-13  Carsten Dominik  <carsten.dominik@gmail.com>
 
        * org-timer.el (org-timer-set-timer): Set variables
        org-timer-timer[123] correctly.
 
-
        * org-mobile.el (org-mobile-files-alist): Make it work when
        `agenda-archives' is included in
        `org-agenda-text-search-extra-files'.
 
 2009-11-13  James TD Smith  <ahktenzero@mohorovi.cc>
 
-       * org-colview-xemacs.el: Add in changes from org-colview.el
+       * org-colview-xemacs.el: Add in changes from org-colview.el.
 
 2009-11-13  Dan Davison  <davison@stats.ox.ac.uk>
 
        point.
        (org-columns-compile-map): There is now an extra position in each
        entry specifying the function to use to calculate the displayed
-       value for the non-calculated properties in the column,
+       value for the non-calculated properties in the column.
        (org-columns-compute-all): Set `org-columns-time' to the current
        time so time difference calculations will work.
        (org-columns-compute): Handle column operators where the values
        used are calculated from the underlying property.
-       (org-columns-number-to-string): Handle the 'age' column format
+       (org-columns-number-to-string): Handle the 'age' column format.
        (org-columns-string-to-number): Correct the function name (was
        org-column...).  Add support for the 'age' column format.
        (org-columns-compile-format): Support the additional parameter in
        called with either `org-scheduled-string' or
        `org-deadline-string'.
 
-       * org-clock.el (org-clock-auto-clock-resolution): Renamed
+       * org-clock.el (org-clock-auto-clock-resolution): Rename from
        `org-clock-disable-clock-resolution', since negatives don't sound
        good in customization variables.
        (org-clock-in): Don't use the auto-resolution logic if the user is
        more general.
        (org-habit-parse-todo): Parse the new ".+N/N" style repeater.
 
-       * org-agenda.el (org-agenda-get-deadlines): Removed all mention of
+       * org-agenda.el (org-agenda-get-deadlines): Remove all mention of
        habits, since they don't use DEADLINE anymore.
 
        * org.el (org-repeat-re, org-display-custom-time)
-       (org-timestamp-change): Extended to support the new ".+N/N"
+       (org-timestamp-change): Extend to support the new ".+N/N"
        syntax, used for habits.
 
-       * org-clock.el (org-clock-resolve-clock): Fixed an incorrect
+       * org-clock.el (org-clock-resolve-clock): Fix an incorrect
        variable reference.
 
        * org-agenda.el (org-agenda-set-mode-name): Show Habit in the
 
        * org.el (org-file-tags): Fix docstring.
        (org-get-buffer-tags): Add the #+FILETAGS tags.
-       ("ecb"): Maks ecb show context after jumping into an Org file.
+       ("ecb"): Make ecb show context after jumping into an Org file.
 
 2009-11-13  John Wiegley  <johnw@newartisans.com>
 
        (org-agenda-get-scheduled): Display consistency graphs when
        outputting habits into the agenda.  The graphs are always relative
        to the current time.
-       (org-format-agenda-item): Added new parameter `habitp', which
+       (org-format-agenda-item): Add new parameter `habitp', which
        indicates whether we are formatting a habit or not.  Do not
        display "extra" leading information if habitp is true.
 
-       * org.el (org-repeat-re): Improved regexp to include .+ and ++
+       * org.el (org-repeat-re): Improve regexp to include .+ and ++
        leaders for repeat strings.
        (org-get-repeat): Now takes a string parameter `tagline', so the
        caller can obtain the SCHEDULED repeat, or the DEADLINE repeat.
        * org.el (org-files-list): Don't attempt to return a file name for
        Org buffers which have no associated file.
 
-       * org-agenda.el (org-agenda-do-action): Fixed a typo.
+       * org-agenda.el (org-agenda-do-action): Fix a typo.
 
 2009-11-13  Carsten Dominik  <carsten.dominik@gmail.com>
 
 
        * org-clock.el (org-clock-resolve, org-resolve-clocks)
        (org-emacs-idle-seconds): Use `org-float-time' instead of
-       `time-to-seconds'
+       `time-to-seconds'.
 
 2009-11-13  Carsten Dominik  <carsten.dominik@gmail.com>
 
        currently active clock if the user has exceeded the time returned
        by `org-user-idle-seconds', based on the value of
        `org-clock-idle-time'.
-       (org-clock-in): If, after resolving clocks,
+       (org-clock-in): If, after resolving clocks, (???)
        (org-clock-out): Cancel the `org-clock-idle-timer' on clock out.
 
        * org-clock.el (org-clock-resolve-clock): New function that
        * org-exp.el (org-export-select-backend-specific-text): Remove the
        region markers.
 
-       * org-inlinetask.el (org-inlinetask-export-handler): fix bug for
+       * org-inlinetask.el (org-inlinetask-export-handler): Fix bug for
        tasks without content.
 
        * org-clock.el: Make sure the clock-in target position does not
 
 2009-10-01  Bastien Guerry  <bzg@altern.org>
 
-       * org.el (org-check-agenda-file): Use a more explicit message
+       * org.el (org-check-agenda-file): Use a more explicit message.
 
 2009-10-01  Carsten Dominik  <carsten.dominik@gmail.com>
 
        * org-exp.el (org-export-format-source-code-or-example): Translate
        language.
 
-       * org-src.el (org-src-lang-modes): New variable
+       * org-src.el (org-src-lang-modes): New variable.
        (org-edit-src-code): Translate language.
 
        * org-exp.el (org-export-format-source-code-or-example): Deal wit
        the markup is src or example.
 
        * org-agenda.el (org-agenda-skip-scheduled-if-deadline-is-shown):
-       New option
+       New option.
        (org-agenda-get-day-entries): Remember deadline results and pass
        them on into the function getting the scheduling information.
        (org-agenda-get-scheduled): Accept deadline results as parameters
        convert current line to headline.
 
        * org-clock.el (org-clock-save-markers-for-cut-and-paste): Also
-       cheeeeeck the hd marker
+       cheeeeeck the hd marker.
        (org-clock-in): Also set the hd marker.
        (org-clock-out): Also set the hd marker.
        (org-clock-cancel): Reset markers.
        * org-faces.el (org-agenda-clocking): New face.
 
        * org-agenda.el (org-agenda-mark-clocking-task): New function.
-       (org-finalize-agenda): call `org-agenda-mark-clocking-task'.
+       (org-finalize-agenda): Call `org-agenda-mark-clocking-task'.
 
        * org.el (org-modules): Add org-track.el.
 
 2009-08-06  Bastien Guerry  <bzg@altern.org>
 
        * org.el (org-make-link-regexps): Don't exclude parentheses from
-       `org-plain-link-re'
+       `org-plain-link-re'.
        (org-cycle-internal-local): When locally cycling, switch directly
-       from CHILDREN to FOLDED if there is no subtree
+       from CHILDREN to FOLDED if there is no subtree.
        (org-cycle): Update the docstring to document the new behavior of
        `org-cycle-internal-local'.
 
        (org-set-font-lock-defaults): Call the new fontification
        function.
 
-       * org-faces.el (org-meta-line): New face
+       * org-faces.el (org-meta-line): New face.
        (org-block): New face.
 
 2009-08-06  Carsten Dominik  <carsten.dominik@gmail.com>
 
 2009-08-06  Carsten Dominik  <carsten.dominik@gmail.com>
 
-       * org-icalendar.el (org-icalendar-include-todo): New allowedvalue
+       * org-icalendar.el (org-icalendar-include-todo): New allowed value
        `unblocked'.
        (org-print-icalendar-entries): Respect the new value of
        `org-icalendar-include-todo'.
 2009-08-06  Carsten Dominik  <carsten.dominik@gmail.com>
 
        * org-exp.el (org-export, org-export-visible): Support ASCII
-       export to buffer
+       export to buffer.
        (org-export-normalize-links): Do not protect the description if it
        is explicitly given.
 
 
        * org-mouse.el: XEmacs compatibility fixes.
 
-       * org.el (org-modules): Add org-inlinetasks.el
+       * org.el (org-modules): Add org-inlinetasks.el.
        (org-cycle): Implement limiting level on cycling.
        (org-move-subtree-down): Fix bug with swapping subtrees at end of
        buffer.
        * org.el (org-emphasis-regexp-components): Allow braces in
        emphasis pre and post match.
 
-       * org-footnote.el (org-footnote-normalize): When only dorting, do
+       * org-footnote.el (org-footnote-normalize): When only sorting, do
        not insert inline notes at the end.
 
        * org.el (org-require-autoloaded-modules): Add org-docbook.el.
        (org-mouse-context-menu): Use `org-mouse-todo-menu'.
 
        * org-table.el (org-table-beginning-of-field)
-       (org-table-end-of-field): New commands
+       (org-table-end-of-field): New commands.
        (org-table-previous-field, org-table-beginning-of-field): Better
        error messages.
        (orgtbl-setup): Include `M-a' and `M-e'.
        (org-export-plist-vars): Add entries for :keywords and
        :description.
        (org-infile-export-plist): Parse for new keywords.
-       (org-get-current-options): Add new keywords
+       (org-get-current-options): Add new keywords.
        (org-export-as-html): Publish description and keywords.
 
        * org-agenda.el (org-agenda-add-entry-text-descriptive-links): New
        (org-export-latex-fontify): Catch error when org-emph-alist has
        entries that are not defined for LaTeX export.
 
-       * org-export-latex.el: renamed to org-latex.el.
+       * org-export-latex.el: Rename to org-latex.el.
 
-       * org-latex.el: renamed from org-export-latex.el.
+       * org-latex.el: Rename from org-export-latex.el.
 
        * org.el (orgstruct++-mode): New function.
        (turn-on-orgstruct++): Call `orgstruct++-mode'.
 
        * org-list.el (org-list-two-spaces-after-bullet-regexp): New
        option.
-       (org-fix-bullet-type): respect
+       (org-fix-bullet-type): Respect
        `org-list-two-spaces-after-bullet-regexp'.
 
        * org-clock.el (org-clock-load): Clean up the code.
        * org-agenda.el (org-agenda-remove-marked-text): New function.
        (org-agenda-mark-filtered-text)
        (org-agenda-unmark-filtered-text): New functions.
-       (org-write-agenda): Remove fltered text.
+       (org-write-agenda): Remove filtered text.
 
        * org.el (org-make-tags-matcher): Give access to TODO "property"
        without speed penalty.
 
        * org.el (org-insert-heading-respect-content): Force heading
        creation.
-       (org-insert-heading): keep the folding state of the heading before
+       (org-insert-heading): Keep the folding state of the heading before
        the inserted one.
 
 2008-10-26  Carsten Dominik  <dominik@science.uva.nl>
        immediately after the scheduling keywords.
 
        * org-clock.el (org-clock-in-switch-to-state): Allow this to be a
-       function
+       function.
        (org-clock-in): If `org-clock-in-switch-to-state' is a function,
        call it with the current todo state to get the state to switch to
        when clocking in.
        line.
 
        * org.el (org-get-refile-targets): Replace links with their
-       descriptions
+       descriptions.
        (org-imenu-get-tree): Replace links with their descriptions.
 
        * org-remember.el (org-remember-apply-template): Add a new
        * org.el (org-add-log-setup): Skip over drawers (properties,
        clocks etc) when adding notes.
 
-       * org-agenda.el (org-agenda-get-closed): show durations of clocked
+       * org-agenda.el (org-agenda-get-closed): Show durations of clocked
        items as well as the start and end times.
 
        * org-compat.el (org-get-x-clipboard-compat): Add a compat
 
 2008-10-12  Bastien Guerry  <bzg@altern.org>
 
-       * org-export-latex.el (org-export-latex-tables): protect exported
+       * org-export-latex.el (org-export-latex-tables): Protect exported
        tables from further special chars conversion.
        (org-export-latex-preprocess): Preserve LaTeX environments.
        (org-list-parse-list): Parse descriptive lists.
        (org-quote-chars): Remove.
        (org-export-latex-keywords-maybe): Use `replace-regexp-in-string'.
        (org-export-latex-list-beginning-re): Rename to
-       `org-list-beginning-re'
+       `org-list-beginning-re'.
        (org-list-item-begin): Rename to `org-list-item-beginning'.
 
 2008-10-12  Eric Schulte  <schulte.eric@gmail.com>
        (org-map-entries): Make sure org-agenda-archives-mode is nil.
        (org-agenda-files): Functionality of second arg changed.
 
-       * org-agenda.el (org-agenda-archives-mode): New variable
+       * org-agenda.el (org-agenda-archives-mode): New variable.
        (org-write-agenda, org-prepare-agenda, org-agenda-list)
        (org-search-view, org-todo-list, org-tags-view)
        (org-agenda-list-stuck-projects): Call `org-agenda-files' with
diff --git a/lisp/org/ob-C.el b/lisp/org/ob-C.el
new file mode 100644 (file)
index 0000000..086079f
--- /dev/null
@@ -0,0 +1,198 @@
+;;; ob-C.el --- org-babel functions for C and similar languages
+
+;; Copyright (C) 2010  Free Software Foundation, Inc.
+
+;; Author: Eric Schulte
+;; Keywords: literate programming, reproducible research
+;; Homepage: http://orgmode.org
+;; Version: 7.01
+
+;; 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:
+
+;; Org-Babel support for evaluating C code.
+;;
+;; very limited implementation:
+;; - currently only support :results output
+;; - not much in the way of error feedback
+
+;;; Code:
+(require 'ob)
+(require 'ob-eval)
+(require 'org)
+(require 'cc-mode)
+
+(declare-function org-entry-get "org"
+                 (pom property &optional inherit literal-nil))
+
+(add-to-list 'org-babel-tangle-lang-exts '("c++" . "cpp"))
+
+(defvar org-babel-default-header-args:C '())
+
+(defvar org-babel-C-compiler "gcc"
+  "Command used to compile a C source code file into an
+  executable.")
+
+(defvar org-babel-c++-compiler "g++"
+  "Command used to compile a c++ source code file into an
+  executable.")
+
+(defvar org-babel-c-variant nil
+  "Internal variable used to hold which type of C (e.g. C or C++)
+is currently being evaluated.")
+
+(defun org-babel-execute:cpp (body params)
+  "Execute BODY according to PARAMS.  This function calls
+`org-babel-execute:C'."
+  (org-babel-execute:C body params))
+
+(defun org-babel-execute:c++ (body params)
+    "Execute a block of C++ code with org-babel.  This function is
+called by `org-babel-execute-src-block'."
+  (let ((org-babel-c-variant 'cpp)) (org-babel-C-execute body params)))
+
+(defun org-babel-expand-body:c++ (body params &optional processed-params)
+  "Expand a block of C++ code with org-babel according to it's
+header arguments (calls `org-babel-C-expand')."
+  (let ((org-babel-c-variant 'cpp)) (org-babel-C-expand body params processed-params)))
+
+(defun org-babel-execute:C (body params)
+  "Execute a block of C code with org-babel.  This function is
+called by `org-babel-execute-src-block'."
+  (let ((org-babel-c-variant 'c)) (org-babel-C-execute body params)))
+
+(defun org-babel-expand-body:c (body params &optional processed-params)
+  "Expand a block of C code with org-babel according to it's
+header arguments (calls `org-babel-C-expand')."
+  (let ((org-babel-c-variant 'c)) (org-babel-C-expand body params processed-params)))
+
+(defun org-babel-C-execute (body params)
+  "This function should only be called by `org-babel-execute:C'
+or `org-babel-execute:c++'."
+  (let* ((processed-params (org-babel-process-params params))
+         (tmp-src-file (make-temp-file "org-babel-C-src" nil
+                                       (cond
+                                       ((equal org-babel-c-variant 'c) ".c")
+                                       ((equal org-babel-c-variant 'cpp) ".cpp"))))
+         (tmp-bin-file (make-temp-file "org-babel-C-bin"))
+         (tmp-out-file (make-temp-file "org-babel-C-out"))
+         (cmdline (cdr (assoc :cmdline params)))
+         (flags (cdr (assoc :flags params)))
+         (full-body (org-babel-C-expand body params))
+         (compile
+         (progn
+           (with-temp-file tmp-src-file (insert full-body))
+           (org-babel-eval
+            (format "%s -o %s %s %s"
+                    (cond
+                     ((equal org-babel-c-variant 'c) org-babel-C-compiler)
+                     ((equal org-babel-c-variant 'cpp) org-babel-c++-compiler))
+                    tmp-bin-file
+                    (mapconcat 'identity
+                               (if (listp flags) flags (list flags)) " ")
+                    tmp-src-file) ""))))
+    ((lambda (results)
+       (org-babel-reassemble-table
+       (if (member "vector" (nth 2 processed-params))
+           (let ((tmp-file (make-temp-file "ob-c")))
+             (with-temp-file tmp-file (insert results))
+             (org-babel-import-elisp-from-file tmp-file))
+         (org-babel-read results))
+       (org-babel-pick-name
+        (nth 4 processed-params) (cdr (assoc :colnames params)))
+       (org-babel-pick-name
+        (nth 5 processed-params) (cdr (assoc :rownames params)))))
+     (org-babel-trim
+       (org-babel-eval
+       (concat tmp-bin-file (if cmdline (concat " " cmdline) "")) "")))))
+
+(defun org-babel-C-expand (body params &optional processed-params)
+  "Expand a block of C or C++ code with org-babel according to
+it's header arguments."
+  (let ((vars (nth 1 (or processed-params
+                          (org-babel-process-params params))))
+        (main-p (not (string= (cdr (assoc :main params)) "no")))
+        (includes (or (cdr (assoc :includes params))
+                      (org-babel-read (org-entry-get nil "includes" t))))
+        (defines (org-babel-read
+                  (or (cdr (assoc :defines params))
+                      (org-babel-read (org-entry-get nil "defines" t))))))
+    (org-babel-trim
+     (mapconcat 'identity
+               (list
+                ;; includes
+                (mapconcat
+                 (lambda (inc) (format "#include %s" inc))
+                 (if (listp includes) includes (list includes)) "\n")
+                ;; defines
+                (mapconcat
+                 (lambda (inc) (format "#define %s" inc))
+                 (if (listp defines) defines (list defines)) "\n")
+                ;; variables
+                (mapconcat 'org-babel-C-var-to-C vars "\n")
+                ;; body
+                (if main-p
+                    (org-babel-C-ensure-main-wrap body)
+                  body) "\n") "\n"))))
+
+(defun org-babel-C-ensure-main-wrap (body)
+  "Wrap body in a \"main\" function call if none exists."
+  (if (string-match "^[ \t]*[intvod]+[ \t]*main[ \t]*(.*)" body)
+      body
+    (format "int main() {\n%s\n}\n" body)))
+
+(defun org-babel-prep-session:C (session params)
+  "This function does nothing as C is a compiled language with no
+support for sessions"
+  (error "C is a compiled languages -- no support for sessions"))
+
+(defun org-babel-load-session:C (session body params)
+  "This function does nothing as C is a compiled language with no
+support for sessions"
+  (error "C is a compiled languages -- no support for sessions"))
+
+;; helper functions
+
+(defun org-babel-C-var-to-C (pair)
+  "Convert an elisp val into a string of C code specifying a var
+of the same value."
+  ;; TODO list support
+  (let ((var (car pair))
+        (val (cdr pair)))
+    (when (symbolp val)
+      (setq val (symbol-name val))
+      (when (= (length val) 1)
+        (setq val (string-to-char val))))
+    (cond
+     ((integerp val)
+      (format "int %S = %S;" var val))
+     ((floatp val)
+      (format "double %S = %S;" var val))
+     ((or (characterp val))
+      (format "char %S = '%S';" var val))
+     ((stringp val)
+      (format "char %S[%d] = \"%s\";"
+              var (+ 1 (length val)) val))
+     (t
+      (format "u32 %S = %S;" var val)))))
+
+
+(provide 'ob-C)
+
+;; arch-tag: 8f49e462-54e3-417b-9a8d-423864893b37
+
+;;; ob-C.el ends here
diff --git a/lisp/org/ob-R.el b/lisp/org/ob-R.el
new file mode 100644 (file)
index 0000000..d990d69
--- /dev/null
@@ -0,0 +1,279 @@
+;;; ob-R.el --- org-babel functions for R code evaluation
+
+;; Copyright (C) 2009, 2010  Free Software Foundation, Inc.
+
+;; Author: Eric Schulte, Dan Davison
+;; Keywords: literate programming, reproducible research, R, statistics
+;; Homepage: http://orgmode.org
+;; Version: 7.01
+
+;; 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:
+
+;; Org-Babel support for evaluating R code
+
+;;; Code:
+(require 'ob)
+(require 'ob-ref)
+(require 'ob-comint)
+(require 'ob-eval)
+(eval-when-compile (require 'cl))
+
+(declare-function orgtbl-to-tsv "org-table" (table params))
+(declare-function R "ext:essd-r" (&optional start-args))
+(declare-function inferior-ess-send-input "ext:ess-inf" ())
+
+(defconst org-babel-header-arg-names:R
+  '(width height bg units pointsize antialias quality compression
+         res type family title fonts version paper encoding
+         pagecentre colormodel useDingbats horizontal)
+  "R-specific header arguments.")
+
+(defvar org-babel-default-header-args:R '())
+
+(defvar org-babel-R-command "R --slave --no-save"
+  "Name of command to use for executing R code.")
+
+(defun org-babel-expand-body:R (body params &optional processed-params)
+  "Expand BODY according to PARAMS, return the expanded body."
+  (let* ((processed-params (or processed-params
+                               (org-babel-process-params params)))
+        (vars (mapcar
+               (lambda (i)
+                 (cons (car (nth i (nth 1 processed-params)))
+                       (org-babel-reassemble-table
+                        (cdr (nth i (nth 1 processed-params)))
+                        (cdr (nth i (nth 4 processed-params)))
+                        (cdr (nth i (nth 5 processed-params))))))
+               (number-sequence 0 (1- (length (nth 1 processed-params))))))
+         (out-file (cdr (assoc :file params))))
+    (mapconcat ;; define any variables
+     #'org-babel-trim
+     ((lambda (inside)
+       (if out-file
+           (append
+            (list (org-babel-R-construct-graphics-device-call out-file params))
+            inside
+            (list "dev.off()"))
+         inside))
+      (append
+       (mapcar
+       (lambda (pair)
+         (org-babel-R-assign-elisp
+          (car pair) (cdr pair)
+          (equal "yes" (cdr (assoc :colnames params)))
+          (equal "yes" (cdr (assoc :rownames params)))))
+       vars)
+       (list body))) "\n")))
+
+(defun org-babel-execute:R (body params)
+  "Execute a block of R code.
+This function is called by `org-babel-execute-src-block'."
+  (save-excursion
+    (let* ((processed-params (org-babel-process-params params))
+           (result-type (nth 3 processed-params))
+           (session (org-babel-R-initiate-session
+                    (first processed-params) params))
+          (colnames-p (cdr (assoc :colnames params)))
+          (rownames-p (cdr (assoc :rownames params)))
+          (out-file (cdr (assoc :file params)))
+          (full-body (org-babel-expand-body:R body params processed-params))
+          (result
+           (org-babel-R-evaluate
+            session full-body result-type
+            (or (equal "yes" colnames-p)
+                (org-babel-pick-name (nth 4 processed-params) colnames-p))
+            (or (equal "yes" rownames-p)
+                (org-babel-pick-name (nth 5 processed-params) rownames-p)))))
+      (message "result is %S" result)
+      (or out-file result))))
+
+(defun org-babel-prep-session:R (session params)
+  "Prepare SESSION according to the header arguments specified in PARAMS."
+  (let* ((session (org-babel-R-initiate-session session params))
+        (vars (org-babel-ref-variables params))
+        (var-lines
+         (mapcar
+          (lambda (pair) (org-babel-R-assign-elisp
+                     (car pair) (cdr pair)
+                     (equal (cdr (assoc :colnames params)) "yes")
+                     (equal (cdr (assoc :rownames params)) "yes")))
+          vars)))
+    (org-babel-comint-in-buffer session
+      (mapc (lambda (var)
+              (end-of-line 1) (insert var) (comint-send-input nil t)
+              (org-babel-comint-wait-for-output session)) var-lines))
+    session))
+
+(defun org-babel-load-session:R (session body params)
+  "Load BODY into SESSION."
+  (save-window-excursion
+    (let ((buffer (org-babel-prep-session:R session params)))
+      (with-current-buffer buffer
+        (goto-char (process-mark (get-buffer-process (current-buffer))))
+        (insert (org-babel-chomp body)))
+      buffer)))
+
+;; helper functions
+
+(defun org-babel-R-quote-tsv-field (s)
+  "Quote field S for export to R."
+  (if (stringp s)
+      (concat "\"" (mapconcat 'identity (split-string s "\"") "\"\"") "\"")
+    (format "%S" s)))
+
+(defun org-babel-R-assign-elisp (name value colnames-p rownames-p)
+  "Construct R code assigning the elisp VALUE to a variable named NAME."
+  (if (listp value)
+      (let ((transition-file (make-temp-file "org-babel-R-import")))
+        ;; ensure VALUE has an orgtbl structure (depth of at least 2)
+        (unless (listp (car value)) (setq value (list value)))
+        (with-temp-file (org-babel-maybe-remote-file transition-file)
+          (insert (orgtbl-to-tsv value '(:fmt org-babel-R-quote-tsv-field)))
+          (insert "\n"))
+        (format "%s <- read.table(\"%s\", header=%s, row.names=%s, sep=\"\\t\", as.is=TRUE)"
+                name transition-file
+               (if (or (eq (nth 1 value) 'hline) colnames-p) "TRUE" "FALSE")
+               (if rownames-p "1" "NULL")))
+    (format "%s <- %s" name (org-babel-R-quote-tsv-field value))))
+
+(defun org-babel-R-initiate-session (session params)
+  "If there is not a current R process then create one."
+  (unless (string= session "none")
+    (let ((session (or session "*R*"))
+         (ess-ask-for-ess-directory (not (cdr (assoc :dir params)))))
+      (if (org-babel-comint-buffer-livep session)
+         session
+       (save-window-excursion
+         (require 'ess) (R)
+         (rename-buffer
+          (if (bufferp session)
+              (buffer-name session)
+            (if (stringp session)
+                session
+              (buffer-name))))
+         (current-buffer))))))
+
+(defun org-babel-R-construct-graphics-device-call (out-file params)
+  "Construct the call to the graphics device."
+  (let ((devices
+        '((:bmp . "bmp")
+          (:jpg . "jpeg")
+          (:jpeg . "jpeg")
+          (:tiff . "tiff")
+          (:png . "png")
+          (:svg . "svg")
+          (:pdf . "pdf")
+          (:ps . "postscript")
+          (:postscript . "postscript")))
+       (allowed-args '(:width :height :bg :units :pointsize
+                              :antialias :quality :compression :res
+                              :type :family :title :fonts :version
+                              :paper :encoding :pagecentre :colormodel
+                              :useDingbats :horizontal))
+       (device (and (string-match ".+\\.\\([^.]+\\)" out-file)
+                    (match-string 1 out-file)))
+       (extra-args (cdr (assq :R-dev-args params))) filearg args)
+    (setq device (or (and device (cdr (assq (intern (concat ":" device))
+                                           devices))) "png"))
+    (setq filearg
+         (if (member device '("pdf" "postscript" "svg")) "file" "filename"))
+    (setq args (mapconcat
+               (lambda (pair)
+                 (if (member (car pair) allowed-args)
+                     (format ",%s=%s"
+                             (substring (symbol-name (car pair)) 1)
+                             (cdr pair)) ""))
+               params ""))
+    (format "%s(%s=\"%s\"%s%s%s)"
+           device filearg out-file args
+           (if extra-args "," "") (or extra-args ""))))
+
+(defvar org-babel-R-eoe-indicator "'org_babel_R_eoe'")
+(defvar org-babel-R-eoe-output "[1] \"org_babel_R_eoe\"")
+(defvar org-babel-R-wrapper-method "main <- function ()\n{\n%s\n}
+write.table(main(), file=\"%s\", sep=\"\\t\", na=\"nil\",row.names=%s, col.names=%s, quote=FALSE)")
+(defvar org-babel-R-wrapper-lastvar "write.table(.Last.value, file=\"%s\", sep=\"\\t\", na=\"nil\",row.names=%s, col.names=%s, quote=FALSE)")
+
+(defun org-babel-R-evaluate
+  (session body result-type column-names-p row-names-p)
+  "Pass BODY to the R process in SESSION.
+If RESULT-TYPE equals 'output then return a list of the outputs
+of the statements in BODY, if RESULT-TYPE equals 'value then
+return the value of the last statement in BODY, as elisp."
+  (if (not session)
+      ;; external process evaluation
+      (case result-type
+       (output (org-babel-eval org-babel-R-command body))
+       (value
+        (let ((tmp-file (make-temp-file "org-babel-R-results-")))
+          (org-babel-eval org-babel-R-command
+                          (format org-babel-R-wrapper-method
+                                  body tmp-file
+                                  (if row-names-p "TRUE" "FALSE")
+                                  (if column-names-p
+                                      (if row-names-p "NA" "TRUE")
+                                    "FALSE")))
+          (org-babel-R-process-value-result
+           (org-babel-import-elisp-from-file
+            (org-babel-maybe-remote-file tmp-file)) column-names-p))))
+    ;; comint session evaluation
+    (case result-type
+      (value
+       (let ((tmp-file (make-temp-file "org-babel-R"))
+            broke)
+        (org-babel-comint-with-output (session org-babel-R-eoe-output)
+          (insert (mapconcat
+                   #'org-babel-chomp
+                   (list
+                    body
+                    (format org-babel-R-wrapper-lastvar
+                            tmp-file
+                            (if row-names-p "TRUE" "FALSE")
+                            (if column-names-p
+                                (if row-names-p "NA" "TRUE")
+                              "FALSE"))
+                    org-babel-R-eoe-indicator) "\n"))
+          (inferior-ess-send-input))
+        (org-babel-R-process-value-result
+         (org-babel-import-elisp-from-file
+          (org-babel-maybe-remote-file tmp-file))  column-names-p)))
+      (output
+       (mapconcat
+       #'org-babel-chomp
+       (butlast
+        (delq nil
+              (mapcar
+               #'identity
+               (org-babel-comint-with-output (session org-babel-R-eoe-output)
+                 (insert (mapconcat #'org-babel-chomp
+                                    (list body org-babel-R-eoe-indicator)
+                                    "\n"))
+                 (inferior-ess-send-input)))) 2) "\n")))))
+
+(defun org-babel-R-process-value-result (result column-names-p)
+  "R-specific processing of return value.
+Insert hline if column names in output have been requested."
+  (if column-names-p
+      (cons (car result) (cons 'hline (cdr result)))
+    result))
+
+(provide 'ob-R)
+
+;; arch-tag: cd4c7298-503b-450f-a3c2-f3e74b630237
+
+;;; ob-R.el ends here
diff --git a/lisp/org/ob-asymptote.el b/lisp/org/ob-asymptote.el
new file mode 100644 (file)
index 0000000..043bc4c
--- /dev/null
@@ -0,0 +1,161 @@
+;;; ob-asymptote.el --- org-babel functions for asymptote evaluation
+
+;; Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+
+;; Author: Eric Schulte
+;; Keywords: literate programming, reproducible research
+;; Homepage: http://orgmode.org
+;; Version: 7.01
+
+;; 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:
+
+;; Org-Babel support for evaluating asymptote source code.
+;;
+;; This differs from most standard languages in that
+;;
+;; 1) there is no such thing as a "session" in asymptote
+;;
+;; 2) we are generally only going to return results of type "file"
+;;
+;; 3) we are adding the "file" and "cmdline" header arguments, if file
+;;    is omitted then the -V option is passed to the asy command for
+;;    interactive viewing
+
+;;; Requirements:
+
+;; - The asymptote program :: http://asymptote.sourceforge.net/
+;;
+;; - asy-mode :: Major mode for editing asymptote files
+
+;;; Code:
+(require 'ob)
+(eval-when-compile (require 'cl))
+
+(declare-function orgtbl-to-generic "org-table" (table params))
+(declare-function org-combine-plists "org" (&rest plists))
+
+(add-to-list 'org-babel-tangle-lang-exts '("asymptote" . "asy"))
+
+(defvar org-babel-default-header-args:asymptote
+  '((:results . "file") (:exports . "results"))
+  "Default arguments when evaluating an Asymptote source block.")
+
+(defun org-babel-expand-body:asymptote (body params &optional processed-params)
+  "Expand BODY according to PARAMS, return the expanded body."
+  (let ((vars (nth 1 (or processed-params
+                          (org-babel-process-params params)))))
+    (concat (mapconcat 'org-babel-asymptote-var-to-asymptote vars "\n")
+           "\n" body "\n")))
+
+(defun org-babel-execute:asymptote (body params)
+  "Execute a block of Asymptote code.
+This function is called by `org-babel-execute-src-block'."
+  (let* ((processed-params (org-babel-process-params params))
+         (result-params (split-string (or (cdr (assoc :results params)) "")))
+         (out-file (cdr (assoc :file params)))
+         (format (or (and out-file
+                          (string-match ".+\\.\\(.+\\)" out-file)
+                          (match-string 1 out-file))
+                     "pdf"))
+         (cmdline (cdr (assoc :cmdline params)))
+         (in-file (make-temp-file "org-babel-asymptote"))
+         (cmd (concat "asy "
+                      (if out-file
+                          (concat "-globalwrite -f " format " -o " out-file)
+                        "-V")
+                      " " cmdline " " in-file)))
+    (with-temp-file in-file
+      (insert (org-babel-expand-body:asymptote body params processed-params)))
+    (message cmd) (shell-command cmd)
+    out-file))
+
+(defun org-babel-prep-session:asymptote (session params)
+  "Return an error if the :session header argument is set.
+Asymptote does not support sessions"
+  (error "Asymptote does not support sessions"))
+
+(defun org-babel-asymptote-var-to-asymptote (pair)
+  "Convert an elisp value into an Asymptote variable.
+The elisp value PAIR is converted into Asymptote code specifying
+a variable of the same value."
+  (let ((var (car pair))
+        (val (if (symbolp (cdr pair))
+                 (symbol-name (cdr pair))
+               (cdr pair))))
+    (cond
+     ((integerp val)
+      (format "int %S=%S;" var val))
+     ((floatp val)
+      (format "real %S=%S;" var val))
+     ((stringp val)
+      (format "string %S=\"%s\";" var val))
+     ((listp val)
+      (let* ((dimension-2-p (not (null (cdr val))))
+             (dim (if dimension-2-p "[][]" "[]"))
+             (type (org-babel-asymptote-define-type val))
+             (array (org-babel-asymptote-table-to-array
+                     val
+                     (if dimension-2-p '(:lstart "{" :lend "}," :llend "}")))))
+        (format "%S%s %S=%s;" type dim var array))))))
+
+(defun org-babel-asymptote-table-to-array (table params)
+  "Convert values of an elisp table into a string of an asymptote array.
+Empty cells are ignored."
+  (labels ((atom-to-string (table)
+                           (cond
+                            ((null table) '())
+                            ((not (listp (car table)))
+                             (cons (if (and (stringp (car table))
+                                            (not (string= (car table) "")))
+                                       (format "\"%s\"" (car table))
+                                     (format "%s" (car table)))
+                                   (atom-to-string (cdr table))))
+                            (t
+                             (cons (atom-to-string (car table))
+                                   (atom-to-string (cdr table))))))
+           ;; Remove any empty row
+           (fix-empty-lines (table)
+                            (delq nil (mapcar (lambda (l) (delq "" l)) table))))
+    (orgtbl-to-generic
+     (fix-empty-lines (atom-to-string table))
+     (org-combine-plists '(:hline nil :sep "," :tstart "{" :tend "}") params))))
+
+(defun org-babel-asymptote-define-type (data)
+  "Determine type of DATA.
+DATA is a list. Type symbol is returned as 'symbol. The type is
+usually the type of the first atom encountered, except for arrays
+of int, where every cell must be of int type."
+  (labels ((anything-but-int (el)
+                             (cond
+                              ((null el) nil)
+                              ((not (listp (car el)))
+                               (cond
+                                ((floatp (car el)) 'real)
+                                ((stringp (car el)) 'string)
+                                (t
+                                 (anything-but-int (cdr el)))))
+                              (t
+                               (or (anything-but-int (car el))
+                                   (anything-but-int (cdr el)))))))
+    (or (anything-but-int data) 'int)))
+
+(provide 'ob-asymptote)
+
+;; arch-tag: f2f5bd0d-78e8-412b-8e6c-6dadc94cc06b
+
+;;; ob-asymptote.el ends here
diff --git a/lisp/org/ob-clojure.el b/lisp/org/ob-clojure.el
new file mode 100644 (file)
index 0000000..c42d9b4
--- /dev/null
@@ -0,0 +1,316 @@
+;;; ob-clojure.el --- org-babel functions for clojure evaluation
+
+;; Copyright (C) 2009, 2010  Free Software Foundation, Inc.
+
+;; Author: Joel Boehland
+;; Keywords: literate programming, reproducible research
+;; Homepage: http://orgmode.org
+;; Version: 7.01
+
+;; 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:
+
+;;; ob support for evaluating clojure code
+
+;;; Requirements:
+
+;;; A working clojure install. This also implies a working java executable
+;;; clojure-mode
+;;; slime
+;;; swank-clojure
+
+;;; By far, the best way to install these components is by following
+;;; the directions as set out by Phil Hagelberg (Technomancy) on the
+;;; web page: http://technomancy.us/126
+
+;;; Code:
+(require 'ob)
+(require 'ob-eval)
+(eval-when-compile (require 'cl))
+
+(declare-function slime-eval-async "ext:slime" (sexp &optional cont package))
+(declare-function slime-eval "ext:slime" (sexp &optional package))
+(declare-function swank-clojure-concat-paths "ext:slime" (paths))
+(declare-function org-babel-ref-variables "ext:slime" (params))
+(declare-function slime "ext:slime" (&optional command coding-system))
+(declare-function slime-output-buffer "ext:slime" (&optional noprompt))
+(declare-function slime-filter-buffers "ext:slime" (predicate))
+
+(add-to-list 'org-babel-tangle-lang-exts '("clojure" . "clj"))
+
+(defvar org-babel-default-header-args:clojure '())
+
+(defvar org-babel-clojure-wrapper-method
+  "
+(defn spit
+  [f content]
+  (with-open [#^java.io.PrintWriter w
+                 (java.io.PrintWriter.
+                   (java.io.BufferedWriter.
+                     (java.io.OutputStreamWriter.
+                       (java.io.FileOutputStream.
+                         (java.io.File. f)))))]
+      (.print w content)))
+
+(defn main
+  []
+  %s)
+
+(spit \"%s\" (str (main)))")
+;;";; <-- syntax highlighting is messed without this double quote
+
+;;taken mostly from clojure-test-mode.el
+(defun org-babel-clojure-clojure-slime-eval (string &optional handler)
+  "Evaluate a STRING of clojure code using `slime-eval-async'."
+  (slime-eval-async `(swank:eval-and-grab-output ,string)
+                    (or handler #'identity)))
+
+(defun org-babel-clojure-slime-eval-sync (string)
+  "Evaluate a STRING of clojure code using `slime-eval'."
+  (slime-eval `(swank:eval-and-grab-output ,string)))
+
+;;taken from swank-clojure.el
+(defvar swank-clojure-binary)
+(defvar swank-clojure-classpath)
+(defvar swank-clojure-java-path)
+(defvar swank-clojure-extra-vm-args)
+(defvar swank-clojure-library-paths)
+(defvar swank-clojure-extra-classpaths)
+(defun org-babel-clojure-babel-clojure-cmd ()
+  "Create the command to start clojure according to current settings."
+  (if (and (not swank-clojure-binary) (not swank-clojure-classpath))
+      (error "%s" (concat "You must specifiy either a `swank-clojure-binary' "
+                         "or a `swank-clojure-jar-path'"))
+    (if swank-clojure-binary
+        (if (listp swank-clojure-binary)
+            swank-clojure-binary
+          (list swank-clojure-binary))
+      (delq
+       nil
+       (append
+        (list swank-clojure-java-path)
+        swank-clojure-extra-vm-args
+        (list
+         (when swank-clojure-library-paths
+           (concat "-Djava.library.path="
+                   (swank-clojure-concat-paths swank-clojure-library-paths)))
+         "-classpath"
+         (swank-clojure-concat-paths
+          (append
+           swank-clojure-classpath
+           swank-clojure-extra-classpaths))
+         "clojure.main"))))))
+
+(defun org-babel-clojure-table-or-string (results)
+  "Convert RESULTS to an elisp value.
+If RESULTS looks like a table, then convert to an Emacs-lisp
+table, otherwise return the results as a string."
+  (org-babel-read
+   (if (string-match "^\\[.+\\]$" results)
+       (org-babel-read
+        (concat "'"
+                (replace-regexp-in-string
+                 "\\[" "(" (replace-regexp-in-string
+                            "\\]" ")" (replace-regexp-in-string
+                                       ", " " " (replace-regexp-in-string
+                                                 "'" "\"" results))))))
+     results)))
+
+(defun org-babel-clojure-var-to-clojure (var)
+  "Convert an elisp value into a clojure variable.
+The elisp value VAR is converted into a string of clojure source
+code specifying a variable of the same value."
+  (if (listp var)
+      (format "'%s" var)
+    (format "%S" var)))
+
+(defun org-babel-clojure-build-full-form (body vars)
+  "Construct a clojure let form with VARS as the let variables."
+  (let ((vars-forms
+        (mapconcat ;; define any variables
+         (lambda (pair)
+           (format "%s %s"
+                   (car pair) (org-babel-clojure-var-to-clojure (cdr pair))))
+         vars "\n      "))
+       (body (org-babel-trim body)))
+    (if (> (length vars-forms) 0)
+       (format "(let [%s]\n  %s)" vars-forms body)
+      body)))
+
+(defun org-babel-prep-session:clojure (session params)
+  "Prepare SESSION according to the header arguments specified in PARAMS."
+  (require 'slime) (require 'swank-clojure)
+  (let* ((session-buf (org-babel-clojure-initiate-session session))
+         (vars (org-babel-ref-variables params))
+         (var-lines (mapcar ;; define any top level session variables
+                     (lambda (pair)
+                       (format "(def %s %s)\n" (car pair)
+                               (org-babel-clojure-var-to-clojure (cdr pair))))
+                     vars)))
+    session-buf))
+
+(defun org-babel-load-session:clojure (session body params)
+  "Load BODY into SESSION."
+  (require 'slime) (require 'swank-clojure)
+  (save-window-excursion
+    (let ((buffer (org-babel-prep-session:clojure session params)))
+      (with-current-buffer buffer
+        (goto-char (point-max))
+        (insert (org-babel-chomp body)))
+      buffer)))
+
+(defvar org-babel-clojure-buffers '())
+(defvar org-babel-clojure-pending-sessions '())
+
+(defun org-babel-clojure-session-buffer (session)
+  "Return the buffer associated with SESSION."
+  (cdr (assoc session org-babel-clojure-buffers)))
+
+(defun org-babel-clojure-initiate-session-by-key (&optional session)
+  "Initiate a clojure session in an inferior-process-buffer.
+If there is not a current inferior-process-buffer in SESSION
+then create one.  Return the initialized session."
+  (save-window-excursion
+    (let* ((session (if session
+                        (if (stringp session) (intern session)
+                          session)
+                     :default))
+           (clojure-buffer (org-babel-clojure-session-buffer session)))
+      (unless (and clojure-buffer (buffer-live-p clojure-buffer))
+        (setq org-babel-clojure-buffers
+             (assq-delete-all session org-babel-clojure-buffers))
+        (push session org-babel-clojure-pending-sessions)
+        (slime)
+        ;; we are waiting to finish setting up which will be done in
+        ;; org-babel-clojure-session-connected-hook below.
+        (let ((timeout 9))
+          (while (and (not (org-babel-clojure-session-buffer session))
+                      (< 0 timeout))
+            (message "Waiting for clojure repl for session: %s ... %i"
+                    session timeout)
+            (sit-for 1)
+            (decf timeout)))
+        (setq org-babel-clojure-pending-sessions
+              (remove session org-babel-clojure-pending-sessions))
+        (unless (org-babel-clojure-session-buffer session)
+          (error "Couldn't create slime clojure process"))
+        (setq clojure-buffer (org-babel-clojure-session-buffer session)))
+      session)))
+
+(defun org-babel-clojure-initiate-session (&optional session params)
+  "Return the slime-clojure repl buffer bound to SESSION.
+Returns nil if \"none\" is specified."
+  (require 'slime) (require 'swank-clojure)
+  (unless (and (stringp session) (string= session "none"))
+    (org-babel-clojure-session-buffer
+     (org-babel-clojure-initiate-session-by-key session))))
+
+(defun org-babel-clojure-session-connected-hook ()
+  "Finish  binding an org-babel session to a slime-clojure repl."
+  (let ((pending-session (pop org-babel-clojure-pending-sessions)))
+    (when pending-session
+      (save-excursion
+        (switch-to-buffer (slime-output-buffer))
+        (rename-buffer
+        (if (stringp pending-session)
+            pending-session (symbol-name pending-session)))
+        (org-babel-clojure-bind-session-to-repl-buffer
+        pending-session (slime-output-buffer))))))
+
+(add-hook 'slime-connected-hook 'org-babel-clojure-session-connected-hook)
+
+(defun org-babel-clojure-bind-session-to-repl-buffer (session repl-buffer)
+  "Associate SESSION with REPL-BUFFER."
+  (when (stringp session) (setq session (intern session)))
+  (setq org-babel-clojure-buffers
+        (cons (cons session repl-buffer)
+              (assq-delete-all session org-babel-clojure-buffers))))
+
+(defun org-babel-clojure-repl-buffer-pred ()
+  "Test whether the current buffer is an active slime-clojure
+repl buffer."
+  (and (buffer-live-p (current-buffer)) (eq major-mode 'slime-repl-mode)))
+
+(defun org-babel-clojure-bind-session-to-repl (session)
+  "Bind SESSION to a clojure repl."
+  (interactive "sEnter session name: ")
+  (let ((repl-bufs (slime-filter-buffers 'org-babel-clojure-repl-buffer-pred)))
+    (unless repl-bufs (error "No existing slime-clojure repl buffers exist"))
+    (let ((repl-buf (read-buffer "Choose slime-clojure repl: " repl-bufs t)))
+      (org-babel-clojure-bind-session-to-repl-buffer session repl-buf))))
+
+(defun org-babel-clojure-evaluate-external-process
+  (buffer body &optional result-type)
+  "Evaluate the body in an external process."
+  (let ((cmd (format "%s -" (mapconcat #'identity
+                                      (org-babel-clojure-babel-clojure-cmd)
+                                      " "))))
+    (case result-type
+      (output (org-babel-eval cmd body))
+      (value (let* ((tmp-file (make-temp-file "org-babel-clojure-results-")))
+              (org-babel-eval cmd (format org-babel-clojure-wrapper-method
+                                          body tmp-file tmp-file))
+              (org-babel-clojure-table-or-string
+               (org-babel-eval-read-file tmp-file)))))))
+
+(defun org-babel-clojure-evaluate-session (buffer body &optional result-type)
+  "Evaluate the body in the context of a clojure session."
+  (require 'slime) (require 'swank-clojure)
+  (let ((raw nil)
+        (results nil))
+    (with-current-buffer buffer
+      (setq raw (org-babel-clojure-slime-eval-sync body))
+      (setq results (reverse (mapcar #'org-babel-trim raw)))
+      (cond
+       ((equal result-type 'output)
+       (mapconcat #'identity (reverse (cdr results)) "\n"))
+       ((equal result-type 'value)
+       (org-babel-clojure-table-or-string (car results)))))))
+
+(defun org-babel-clojure-evaluate (buffer body &optional result-type)
+  "Pass BODY to the Clojure process in BUFFER.
+If RESULT-TYPE equals 'output then return a list of the outputs
+of the statements in BODY, if RESULT-TYPE equals 'value then
+return the value of the last statement in BODY as elisp."
+  (if buffer
+      (org-babel-clojure-evaluate-session buffer body result-type)
+    (org-babel-clojure-evaluate-external-process buffer body result-type)))
+
+(defun org-babel-expand-body:clojure (body params &optional processed-params)
+  "Expand BODY according to PARAMS, return the expanded body."
+  (org-babel-clojure-build-full-form
+   body (nth 1 (or processed-params (org-babel-process-params params)))))
+
+(defun org-babel-execute:clojure (body params)
+  "Execute a block of Clojure code."
+  (require 'slime) (require 'swank-clojure)
+  (let* ((processed-params (org-babel-process-params params))
+         (body (org-babel-expand-body:clojure body params processed-params))
+         (session (org-babel-clojure-initiate-session
+                  (first processed-params))))
+    (org-babel-reassemble-table
+     (org-babel-clojure-evaluate session body (nth 3 processed-params))
+     (org-babel-pick-name
+      (nth 4 processed-params) (cdr (assoc :colnames params)))
+     (org-babel-pick-name
+      (nth 5 processed-params) (cdr (assoc :rownames params))))))
+
+(provide 'ob-clojure)
+
+;; arch-tag: a43b33f2-653e-46b1-ac56-2805cf05b7d1
+
+;;; ob-clojure.el ends here
diff --git a/lisp/org/ob-comint.el b/lisp/org/ob-comint.el
new file mode 100644 (file)
index 0000000..732f276
--- /dev/null
@@ -0,0 +1,143 @@
+;;; ob-comint.el --- org-babel functions for interaction with comint buffers
+
+;; Copyright (C) 2009, 2010  Free Software Foundation, Inc.
+
+;; Author: Eric Schulte
+;; Keywords: literate programming, reproducible research, comint
+;; Homepage: http://orgmode.org
+;; Version: 7.01
+
+;; 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 functions build on comint to ease the sending and receiving
+;; of commands and results from comint buffers.
+
+;; Note that the buffers in this file are analogous to sessions in
+;; org-babel at large.
+
+;;; Code:
+(require 'ob)
+(require 'comint)
+(eval-when-compile (require 'cl))
+
+(defun org-babel-comint-buffer-livep (buffer)
+  "Check if BUFFER is a comint buffer with a live process."
+  (let ((buffer (if buffer (get-buffer buffer))))
+    (and buffer (buffer-live-p buffer) (get-buffer-process buffer) buffer)))
+
+(defmacro org-babel-comint-in-buffer (buffer &rest body)
+  "Check BUFFER and execute BODY.
+BUFFER is checked with `org-babel-comint-buffer-livep'.  BODY is
+executed inside the protection of `save-window-excursion' and
+`save-match-data'."
+  (declare (indent 1))
+  `(save-excursion
+     (save-match-data
+       (unless (org-babel-comint-buffer-livep ,buffer)
+         (error "buffer %s doesn't exist or has no process" ,buffer))
+       (set-buffer ,buffer)
+       ,@body)))
+
+(defmacro org-babel-comint-with-output (meta &rest body)
+  "Evaluate BODY in BUFFER and return process output.
+Will wait until EOE-INDICATOR appears in the output, then return
+all process output.  If REMOVE-ECHO and FULL-BODY are present and
+non-nil, then strip echo'd body from the returned output.  META
+should be a list containing the following where the last two
+elements are optional.
+
+ (BUFFER EOE-INDICATOR REMOVE-ECHO FULL-BODY)
+
+This macro ensures that the filter is removed in case of an error
+or user `keyboard-quit' during execution of body."
+  (declare (indent 1))
+  (let ((buffer (car meta))
+       (eoe-indicator (cadr meta))
+       (remove-echo (cadr (cdr meta)))
+       (full-body (cadr (cdr (cdr meta)))))
+    `(org-babel-comint-in-buffer ,buffer
+       (let ((string-buffer "") dangling-text raw)
+        (flet ((my-filt (text)
+                        (setq string-buffer (concat string-buffer text))))
+          ;; setup filter
+          (add-hook 'comint-output-filter-functions 'my-filt)
+          (unwind-protect
+              (progn
+                ;; got located, and save dangling text
+                (goto-char (process-mark (get-buffer-process (current-buffer))))
+                (let ((start (point))
+                      (end (point-max)))
+                  (setq dangling-text (buffer-substring start end))
+                  (delete-region start end))
+                ;; pass FULL-BODY to process
+                ,@body
+                ;; wait for end-of-evaluation indicator
+                (while (progn
+                         (goto-char comint-last-input-end)
+                         (not (save-excursion
+                                (and (re-search-forward
+                                      comint-prompt-regexp nil t)
+                                     (re-search-forward
+                                      (regexp-quote ,eoe-indicator) nil t)))))
+                  (accept-process-output (get-buffer-process (current-buffer)))
+                  ;; thought the following this would allow async
+                  ;; background running, but I was wrong...
+                  ;; (run-with-timer .5 .5 'accept-process-output
+                  ;;            (get-buffer-process (current-buffer)))
+                  )
+                ;; replace cut dangling text
+                (goto-char (process-mark (get-buffer-process (current-buffer))))
+                (insert dangling-text))
+            ;; remove filter
+            (remove-hook 'comint-output-filter-functions 'my-filt)))
+        ;; remove echo'd FULL-BODY from input
+        (if (and ,remove-echo ,full-body
+                 (string-match
+                  (replace-regexp-in-string
+                   "\n" "[\r\n]+" (regexp-quote (or ,full-body "")))
+                  string-buffer))
+            (setq raw (substring string-buffer (match-end 0))))
+        (split-string string-buffer comint-prompt-regexp)))))
+
+(defun org-babel-comint-input-command (buffer cmd)
+  "Pass CMD to BUFFER.
+The input will not be echoed."
+  (org-babel-comint-in-buffer buffer
+    (goto-char (process-mark (get-buffer-process buffer)))
+    (insert cmd)
+    (comint-send-input)
+    (org-babel-comint-wait-for-output buffer)))
+
+(defun org-babel-comint-wait-for-output (buffer)
+  "Wait until output arrives from BUFFER.
+Note: this is only safe when waiting for the result of a single
+statement (not large blocks of code)."
+  (org-babel-comint-in-buffer buffer
+    (while (progn
+             (goto-char comint-last-input-end)
+             (not (and (re-search-forward comint-prompt-regexp nil t)
+                       (goto-char (match-beginning 0))
+                       (string= (face-name (face-at-point))
+                                "comint-highlight-prompt"))))
+      (accept-process-output (get-buffer-process buffer)))))
+
+(provide 'ob-comint)
+
+;; arch-tag: 9adddce6-0864-4be3-b0b5-6c5157dc7889
+
+;;; ob-comint.el ends here
diff --git a/lisp/org/ob-css.el b/lisp/org/ob-css.el
new file mode 100644 (file)
index 0000000..0a279b2
--- /dev/null
@@ -0,0 +1,52 @@
+;;; ob-css.el --- org-babel functions for css evaluation
+
+;; Copyright (C) 2009, 2010  Free Software Foundation, Inc.
+
+;; Author: Eric Schulte
+;; Keywords: literate programming, reproducible research
+;; Homepage: http://orgmode.org
+;; Version: 7.01
+
+;; 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:
+
+;; Since CSS can't be executed, this file exists solely for tangling
+;; CSS from org-mode files.
+
+;;; Code:
+(require 'ob)
+
+(defvar org-babel-default-header-args:css '())
+
+(defun org-babel-expand-body:css (body params &optional processed-params)
+  "Expand BODY according to PARAMS, return the expanded body." body)
+
+(defun org-babel-execute:css (body params)
+  "Execute a block of CSS code.
+This function is called by `org-babel-execute-src-block'."
+ body)
+
+(defun org-babel-prep-session:css (session params)
+  "Return an error if the :session header argument is set.
+CSS does not support sessions."
+  (error "CSS sessions are nonsensical"))
+
+(provide 'ob-css)
+
+;; arch-tag: f4447e8c-50ab-41f9-b322-b7b9574d9fbe
+
+;;; ob-css.el ends here
diff --git a/lisp/org/ob-ditaa.el b/lisp/org/ob-ditaa.el
new file mode 100644 (file)
index 0000000..336eaa9
--- /dev/null
@@ -0,0 +1,72 @@
+;;; ob-ditaa.el --- org-babel functions for ditaa evaluation
+
+;; Copyright (C) 2009, 2010  Free Software Foundation, Inc.
+
+;; Author: Eric Schulte
+;; Keywords: literate programming, reproducible research
+;; Homepage: http://orgmode.org
+;; Version: 7.01
+
+;; 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:
+
+;; Org-Babel support for evaluating ditaa source code.
+;;
+;; This differs from most standard languages in that
+;;
+;; 1) there is no such thing as a "session" in ditaa
+;;
+;; 2) we are generally only going to return results of type "file"
+;;
+;; 3) we are adding the "file" and "cmdline" header arguments
+;;
+;; 4) there are no variables (at least for now)
+
+;;; Code:
+(require 'ob)
+
+(defvar org-babel-default-header-args:ditaa
+  '((:results . "file") (:exports . "results"))
+  "Default arguments for evaluating a ditaa source block.")
+
+(defun org-babel-expand-body:ditaa (body params &optional processed-params)
+  "Expand BODY according to PARAMS, return the expanded body." body)
+
+(defvar org-ditaa-jar-path)
+(defun org-babel-execute:ditaa (body params)
+  "Execute a block of Ditaa code with org-babel.
+This function is called by `org-babel-execute-src-block'."
+  (let ((result-params (split-string (or (cdr (assoc :results params)) "")))
+        (out-file (cdr (assoc :file params)))
+        (cmdline (cdr (assoc :cmdline params)))
+        (in-file (make-temp-file "org-babel-ditaa")))
+    (unless (file-exists-p org-ditaa-jar-path)
+      (error "Could not find ditaa.jar at %s" org-ditaa-jar-path))
+    (with-temp-file in-file (insert body))
+    (message (concat "java -jar " org-ditaa-jar-path " " cmdline " " in-file " " out-file))
+    (shell-command (concat "java -jar " (shell-quote-argument org-ditaa-jar-path) " " cmdline " " in-file " " out-file))
+    out-file))
+
+(defun org-babel-prep-session:ditaa (session params)
+  "Return an error because ditaa does not support sessions."
+  (error "Ditaa does not support sessions"))
+
+(provide 'ob-ditaa)
+
+;; arch-tag: 492cd006-07d9-4fac-bef6-5bb60b48842e
+
+;;; ob-ditaa.el ends here
diff --git a/lisp/org/ob-dot.el b/lisp/org/ob-dot.el
new file mode 100644 (file)
index 0000000..4657fb8
--- /dev/null
@@ -0,0 +1,87 @@
+;;; ob-dot.el --- org-babel functions for dot evaluation
+
+;; Copyright (C) 2009, 2010  Free Software Foundation, Inc.
+
+;; Author: Eric Schulte
+;; Keywords: literate programming, reproducible research
+;; Homepage: http://orgmode.org
+;; Version: 7.01
+
+;; 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:
+
+;; Org-Babel support for evaluating dot source code.
+;;
+;; For information on dot see http://www.graphviz.org/
+;;
+;; This differs from most standard languages in that
+;;
+;; 1) there is no such thing as a "session" in dot
+;;
+;; 2) we are generally only going to return results of type "file"
+;;
+;; 3) we are adding the "file" and "cmdline" header arguments
+;;
+;; 4) there are no variables (at least for now)
+
+;;; Code:
+(require 'ob)
+(require 'ob-eval)
+
+(defvar org-babel-default-header-args:dot
+  '((:results . "file") (:exports . "results"))
+  "Default arguments to use when evaluating a dot source block.")
+
+(defun org-babel-expand-body:dot (body params &optional processed-params)
+  "Expand BODY according to PARAMS, return the expanded body."
+  (let ((vars (nth 1 (or processed-params
+                        (org-babel-process-params params)))))
+    (mapc
+     (lambda (pair)
+       (let ((name (symbol-name (car pair)))
+            (value (cdr pair)))
+        (setq body
+              (replace-regexp-in-string
+               (concat "\$" (regexp-quote name))
+               (if (stringp value) value (format "%S" value))
+               body))))
+     vars)
+    body))
+
+(defun org-babel-execute:dot (body params)
+  "Execute a block of Dot code with org-babel.
+This function is called by `org-babel-execute-src-block'."
+  (let ((processed-params (org-babel-process-params params))
+       (result-params (split-string (or (cdr (assoc :results params)) "")))
+        (out-file (cdr (assoc :file params)))
+        (cmdline (cdr (assoc :cmdline params)))
+        (cmd (or (cdr (assoc :cmd params)) "dot"))
+        (in-file (make-temp-file "org-babel-dot")))
+    (with-temp-file in-file
+      (insert (org-babel-expand-body:dot body params processed-params)))
+    (org-babel-eval (concat cmd " " in-file " " cmdline " -o " out-file) "")
+    out-file))
+
+(defun org-babel-prep-session:dot (session params)
+  "Return an error because Dot does not support sessions."
+  (error "Dot does not support sessions"))
+
+(provide 'ob-dot)
+
+;; arch-tag: 817d0516-7b47-4f77-a8b2-2aadd8e4d0e2
+
+;;; ob-dot.el ends here
diff --git a/lisp/org/ob-emacs-lisp.el b/lisp/org/ob-emacs-lisp.el
new file mode 100644 (file)
index 0000000..2ec729f
--- /dev/null
@@ -0,0 +1,71 @@
+;;; ob-emacs-lisp.el --- org-babel functions for emacs-lisp code evaluation
+
+;; Copyright (C) 2009, 2010  Free Software Foundation, Inc
+
+;; Author: Eric Schulte
+;; Keywords: literate programming, reproducible research
+;; Homepage: http://orgmode.org
+;; Version: 7.01
+
+;; 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:
+
+;; Org-Babel support for evaluating emacs-lisp code
+
+;;; Code:
+(require 'ob)
+(eval-when-compile (require 'ob-comint))
+
+(defvar org-babel-default-header-args:emacs-lisp
+  '((:hlines . "yes") (:colnames . "no"))
+  "Default arguments for evaluating an emacs-lisp source block.")
+
+(declare-function orgtbl-to-generic "org-table" (table params))
+
+(defun org-babel-expand-body:emacs-lisp (body params &optional processed-params)
+  "Expand BODY according to PARAMS, return the expanded body."
+  (let* ((processed-params (or processed-params (org-babel-process-params params)))
+         (vars (nth 1 processed-params))
+         (result-params (nth 2 processed-params))
+         (print-level nil) (print-length nil)
+         (body (if (> (length vars) 0)
+                  (concat "(let ("
+                        (mapconcat
+                         (lambda (var) (format "%S" (print `(,(car var) ',(cdr var)))))
+                         vars "\n      ")
+                        ")\n" body ")")
+                body)))
+    (if (or (member "code" result-params)
+           (member "pp" result-params))
+       (concat "(pp " body ")") body)))
+
+(defun org-babel-execute:emacs-lisp (body params)
+  "Execute a block of emacs-lisp code with Babel."
+  (save-window-excursion
+    (let ((processed-params (org-babel-process-params params)))
+      (org-babel-reassemble-table
+       (eval (read (format "(progn %s)"
+                          (org-babel-expand-body:emacs-lisp
+                           body params processed-params))))
+       (org-babel-pick-name (nth 4 processed-params) (cdr (assoc :colnames params)))
+       (org-babel-pick-name (nth 5 processed-params) (cdr (assoc :rownames params)))))))
+
+(provide 'ob-emacs-lisp)
+
+;; arch-tag: e9a3acca-dc84-472a-9f5a-23c35befbcd6
+
+;;; ob-emacs-lisp.el ends here
diff --git a/lisp/org/ob-eval.el b/lisp/org/ob-eval.el
new file mode 100644 (file)
index 0000000..dea39f1
--- /dev/null
@@ -0,0 +1,255 @@
+;;; ob-run.el --- org-babel functions for external code evaluation
+
+;; Copyright (C) 2009, 2010  Free Software Foundation, Inc.
+
+;; Author: Eric Schulte
+;; Keywords: literate programming, reproducible research, comint
+;; Homepage: http://orgmode.org
+;; Version: 7.01
+
+;; 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 functions build existing Emacs support for executing external
+;; shell commands.
+
+;;; Code:
+(require 'ob)
+(eval-when-compile (require 'cl))
+
+(defun org-babel-eval-error-notify (exit-code stderr)
+  "Open a buffer to display STDERR and a message with the value of EXIT-CODE."
+  (let ((buf (get-buffer-create "*Org-Babel Error Output*")))
+    (with-current-buffer buf
+      (goto-char (point-max))
+      (save-excursion (insert stderr)))
+    (display-buffer buf))
+  (message "Babel evaluation exited with code %S" exit-code))
+
+(defun org-babel-eval (cmd body)
+  "Run CMD on BODY.
+If CMD succeeds then return it's results, otherwise display
+STDERR with `org-babel-eval-error-notify'."
+  (let ((err-buff (get-buffer-create "*Org-Babel Error*")) exit-code)
+    (with-current-buffer err-buff (erase-buffer))
+    (with-temp-buffer
+      (insert body)
+      (setq exit-code
+           (org-babel-shell-command-on-region
+            (point-min) (point-max) cmd t 'replace err-buff))
+      (if (or (not (numberp exit-code)) (> exit-code 0))
+         (progn
+           (with-current-buffer err-buff
+             (org-babel-eval-error-notify exit-code (buffer-string)))
+           nil)
+       (buffer-string)))))
+
+(defun org-babel-eval-read-file (file)
+  "Return the contents of FILE as a string."
+  (with-temp-buffer (insert-file-contents
+                    (org-babel-maybe-remote-file file))
+                   (buffer-string)))
+
+(defun org-babel-shell-command-on-region (start end command
+                                     &optional output-buffer replace
+                                     error-buffer display-error-buffer)
+  "Execute COMMAND in an inferior shell with region as input.
+
+Fixes bugs in the emacs 23.1.1 version of `shell-command-on-region'
+
+Normally display output (if any) in temp buffer `*Shell Command Output*';
+Prefix arg means replace the region with it.  Return the exit code of
+COMMAND.
+
+To specify a coding system for converting non-ASCII characters in
+the input and output to the shell command, use
+\\[universal-coding-system-argument] before this command.  By
+default, the input (from the current buffer) is encoded in the
+same coding system that will be used to save the file,
+`buffer-file-coding-system'.  If the output is going to replace
+the region, then it is decoded from that same coding system.
+
+The noninteractive arguments are START, END, COMMAND,
+OUTPUT-BUFFER, REPLACE, ERROR-BUFFER, and DISPLAY-ERROR-BUFFER.
+Noninteractive callers can specify coding systems by binding
+`coding-system-for-read' and `coding-system-for-write'.
+
+If the command generates output, the output may be displayed
+in the echo area or in a buffer.
+If the output is short enough to display in the echo area
+\(determined by the variable `max-mini-window-height' if
+`resize-mini-windows' is non-nil), it is shown there.  Otherwise
+it is displayed in the buffer `*Shell Command Output*'.  The output
+is available in that buffer in both cases.
+
+If there is output and an error, a message about the error
+appears at the end of the output.
+
+If there is no output, or if output is inserted in the current buffer,
+then `*Shell Command Output*' is deleted.
+
+If the optional fourth argument OUTPUT-BUFFER is non-nil,
+that says to put the output in some other buffer.
+If OUTPUT-BUFFER is a buffer or buffer name, put the output there.
+If OUTPUT-BUFFER is not a buffer and not nil,
+insert output in the current buffer.
+In either case, the output is inserted after point (leaving mark after it).
+
+If REPLACE, the optional fifth argument, is non-nil, that means insert
+the output in place of text from START to END, putting point and mark
+around it.
+
+If optional sixth argument ERROR-BUFFER is non-nil, it is a buffer
+or buffer name to which to direct the command's standard error output.
+If it is nil, error output is mingled with regular output.
+If DISPLAY-ERROR-BUFFER is non-nil, display the error buffer if there
+were any errors.  (This is always t, interactively.)
+In an interactive call, the variable `shell-command-default-error-buffer'
+specifies the value of ERROR-BUFFER."
+  (interactive (let (string)
+                (unless (mark)
+                  (error "The mark is not set now, so there is no region"))
+                ;; Do this before calling region-beginning
+                ;; and region-end, in case subprocess output
+                ;; relocates them while we are in the minibuffer.
+                (setq string (read-shell-command "Shell command on region: "))
+                ;; call-interactively recognizes region-beginning and
+                ;; region-end specially, leaving them in the history.
+                (list (region-beginning) (region-end)
+                      string
+                      current-prefix-arg
+                      current-prefix-arg
+                      shell-command-default-error-buffer
+                      t)))
+  (let ((error-file
+        (if error-buffer
+            (make-temp-file
+             (expand-file-name "scor"
+                               (or (unless (featurep 'xemacs)
+                                     small-temporary-file-directory)
+                                   temporary-file-directory)))
+          nil))
+       exit-status)
+    (if (or replace
+           (and output-buffer
+                (not (or (bufferp output-buffer) (stringp output-buffer)))))
+       ;; Replace specified region with output from command.
+       (let ((swap (and replace (< start end))))
+         ;; Don't muck with mark unless REPLACE says we should.
+         (goto-char start)
+         (and replace (push-mark (point) 'nomsg))
+         (setq exit-status
+               (call-process-region start end shell-file-name t
+                                    (if error-file
+                                        (list output-buffer error-file)
+                                      t)
+                                    nil shell-command-switch command))
+         ;; It is rude to delete a buffer which the command is not using.
+         ;; (let ((shell-buffer (get-buffer "*Shell Command Output*")))
+         ;;   (and shell-buffer (not (eq shell-buffer (current-buffer)))
+         ;;     (kill-buffer shell-buffer)))
+         ;; Don't muck with mark unless REPLACE says we should.
+         (and replace swap (exchange-point-and-mark)))
+      ;; No prefix argument: put the output in a temp buffer,
+      ;; replacing its entire contents.
+      (let ((buffer (get-buffer-create
+                    (or output-buffer "*Shell Command Output*"))))
+       (unwind-protect
+           (if (eq buffer (current-buffer))
+               ;; If the input is the same buffer as the output,
+               ;; delete everything but the specified region,
+               ;; then replace that region with the output.
+               (progn (setq buffer-read-only nil)
+                      (delete-region (max start end) (point-max))
+                      (delete-region (point-min) (min start end))
+                      (setq exit-status
+                            (call-process-region (point-min) (point-max)
+                                                 shell-file-name t
+                                                 (if error-file
+                                                     (list t error-file)
+                                                   t)
+                                                 nil shell-command-switch
+                                                 command)))
+             ;; Clear the output buffer, then run the command with
+             ;; output there.
+             (let ((directory default-directory))
+               (with-current-buffer buffer
+                 (setq buffer-read-only nil)
+                 (if (not output-buffer)
+                     (setq default-directory directory))
+                 (erase-buffer)))
+             (setq exit-status
+                   (call-process-region start end shell-file-name nil
+                                        (if error-file
+                                            (list buffer error-file)
+                                          buffer)
+                                        nil shell-command-switch command)))
+         ;; Report the output.
+         (with-current-buffer buffer
+           (setq mode-line-process
+                 (cond ((null exit-status)
+                        " - Error")
+                       ((stringp exit-status)
+                        (format " - Signal [%s]" exit-status))
+                       ((not (equal 0 exit-status))
+                        (format " - Exit [%d]" exit-status)))))
+         (if (with-current-buffer buffer (> (point-max) (point-min)))
+             ;; There's some output, display it
+             (display-message-or-buffer buffer)
+           ;; No output; error?
+           (let ((output
+                  (if (and error-file
+                           (< 0 (nth 7 (file-attributes error-file))))
+                      "some error output"
+                    "no output")))
+             (cond ((null exit-status)
+                    (message "(Shell command failed with error)"))
+                   ((equal 0 exit-status)
+                    (message "(Shell command succeeded with %s)"
+                             output))
+                   ((stringp exit-status)
+                    (message "(Shell command killed by signal %s)"
+                             exit-status))
+                   (t
+                    (message "(Shell command failed with code %d and %s)"
+                             exit-status output))))
+           ;; Don't kill: there might be useful info in the undo-log.
+           ;; (kill-buffer buffer)
+           ))))
+
+    (when (and error-file (file-exists-p error-file))
+      (if (< 0 (nth 7 (file-attributes error-file)))
+         (with-current-buffer (get-buffer-create error-buffer)
+           (let ((pos-from-end (- (point-max) (point))))
+             (or (bobp)
+                 (insert "\f\n"))
+             ;; Do no formatting while reading error file,
+             ;; because that can run a shell command, and we
+             ;; don't want that to cause an infinite recursion.
+             (format-insert-file error-file nil)
+             ;; Put point after the inserted errors.
+             (goto-char (- (point-max) pos-from-end)))
+           (and display-error-buffer
+                (display-buffer (current-buffer)))))
+      (delete-file error-file))
+    exit-status))
+
+(provide 'ob-eval)
+
+;; arch-tag: 5328b17f-957d-42d9-94da-a2952682d04d
+
+;;; ob-comint.el ends here
diff --git a/lisp/org/ob-exp.el b/lisp/org/ob-exp.el
new file mode 100644 (file)
index 0000000..4c07488
--- /dev/null
@@ -0,0 +1,313 @@
+;;; ob-exp.el --- Exportation of org-babel source blocks
+
+;; Copyright (C) 2009, 2010  Free Software Foundation, Inc.
+
+;; Author: Eric Schulte, Dan Davison
+;; Keywords: literate programming, reproducible research
+;; Homepage: http://orgmode.org
+;; Version: 7.01
+
+;; 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:
+
+;; See the online documentation for more information
+;; 
+;;   http://orgmode.org/worg/org-contrib/babel/
+
+;;; Code:
+(require 'ob)
+(require 'org-exp-blocks)
+(eval-when-compile
+  (require 'cl))
+
+(defvar obe-marker nil)
+(defvar org-current-export-file)
+(defvar org-babel-lob-one-liner-regexp)
+(defvar org-babel-ref-split-regexp)
+(declare-function org-babel-lob-get-info "ob-lob" ())
+(declare-function org-babel-ref-literal "ob-ref" (ref))
+
+(add-to-list 'org-export-interblocks '(src org-babel-exp-inline-src-blocks))
+(add-to-list 'org-export-interblocks '(lob org-babel-exp-lob-one-liners))
+(add-hook 'org-export-blocks-postblock-hook 'org-exp-res/src-name-cleanup)
+
+(org-export-blocks-add-block '(src org-babel-exp-src-blocks nil))
+
+(defcustom org-export-babel-evaluate t
+  "Switch controlling code evaluation during export.
+When set to nil no code will be exported as part of the export
+process."
+  :group 'org-babel
+  :type 'boolean)
+(put 'org-export-babel-evaluate 'safe-local-variable (lambda (x) (eq x nil)))
+
+(defvar org-babel-function-def-export-keyword "function"
+  "The keyword to substitute for the source name line on export.
+When exporting a source block function, this keyword will
+appear in the exported version in the place of source name
+line. A source block is considered to be a source block function
+if the source name is present and is followed by a parenthesized
+argument list. The parentheses may be empty or contain
+whitespace. An example is the following which generates n random
+\(uniform) numbers.
+
+#+source: rand(n)
+#+begin_src R
+  runif(n)
+#+end_src")
+
+(defvar org-babel-function-def-export-indent 4
+  "Number of characters to indent a source block on export.
+When exporting a source block function, the block contents will
+be indented by this many characters. See
+`org-babel-function-def-export-name' for the definition of a
+source block function.")
+
+(defun org-babel-exp-src-blocks (body &rest headers)
+  "Process source block for export.
+Depending on the 'export' headers argument in replace the source
+code block with...
+
+both ---- display the code and the results
+
+code ---- the default, display the code inside the block but do
+          not process
+
+results - just like none only the block is run on export ensuring
+          that it's results are present in the org-mode buffer
+
+none ----- do not display either code or results upon export"
+  (interactive)
+  (message "org-babel-exp processing...")
+  (save-excursion
+    (goto-char (match-beginning 0))
+    (let* ((info (org-babel-get-src-block-info))
+          (params (nth 2 info)))
+      ;; bail if we couldn't get any info from the block
+      (when info
+       ;; expand noweb references in the original file
+       (setf (nth 1 info)
+             (if (and (cdr (assoc :noweb params))
+                      (string= "yes" (cdr (assoc :noweb params))))
+                 (org-babel-expand-noweb-references
+                  info (get-file-buffer org-current-export-file))
+               (nth 1 info))))
+      (org-babel-exp-do-export info 'block))))
+
+(defun org-babel-exp-inline-src-blocks (start end)
+  "Process inline source blocks between START and END for export.
+See `org-babel-exp-src-blocks' for export options, currently the
+options and are taken from `org-babel-default-inline-header-args'."
+  (interactive)
+  (save-excursion
+    (goto-char start)
+    (while (and (< (point) end)
+                (re-search-forward org-babel-inline-src-block-regexp end t))
+      (let* ((info (save-match-data (org-babel-parse-inline-src-block-match)))
+            (params (nth 2 info))
+            (replacement
+             (save-match-data
+               (if (org-babel-in-example-or-verbatim)
+                   (buffer-substring (match-beginning 0) (match-end 0))
+                 ;; expand noweb references in the original file
+                 (setf (nth 1 info)
+                       (if (and (cdr (assoc :noweb params))
+                                (string= "yes" (cdr (assoc :noweb params))))
+                           (org-babel-expand-noweb-references
+                            info (get-file-buffer org-current-export-file))
+                         (nth 1 info)))
+                 (org-babel-exp-do-export info 'inline)))))
+       (setq end (+ end (- (length replacement) (length (match-string 1)))))
+       (replace-match replacement t t nil 1)))))
+
+(defun org-exp-res/src-name-cleanup ()
+  "Clean up #+results and #+srcname lines for export.
+This function should only be called after all block processing
+has taken place."
+  (interactive)
+  (save-excursion
+    (goto-char (point-min))
+    (while (org-re-search-forward-unprotected
+           (concat
+            "\\("org-babel-src-name-regexp"\\|"org-babel-result-regexp"\\)")
+           nil t)
+      (delete-region
+       (progn (beginning-of-line) (point))
+       (progn (end-of-line) (+ 1 (point)))))))
+
+(defun org-babel-in-example-or-verbatim ()
+  "Return true if point is in example or verbatim code.
+Example and verbatim code include escaped portions of
+an org-mode buffer code that should be treated as normal
+org-mode text."
+  (or (org-in-indented-comment-line) 
+      (save-excursion
+       (save-match-data
+         (goto-char (point-at-bol))
+         (looking-at "[ \t]*:[ \t]")))
+      (org-in-regexps-block-p "^[ \t]*#\\+begin_src" "^[ \t]*#\\+end_src")))
+
+(defun org-babel-exp-lob-one-liners (start end)
+  "Process Library of Babel calls between START and END for export.
+See `org-babel-exp-src-blocks' for export options. Currently the
+options are taken from `org-babel-default-header-args'."
+  (interactive)
+  (let (replacement)
+    (save-excursion
+      (goto-char start)
+      (while (and (< (point) end)
+                 (re-search-forward org-babel-lob-one-liner-regexp nil t))
+       (setq replacement
+             (let ((lob-info (org-babel-lob-get-info)))
+               (save-match-data
+                 (org-babel-exp-do-export
+                  (list "emacs-lisp" "results"
+                        (org-babel-merge-params
+                         org-babel-default-header-args
+                         (org-babel-parse-header-arguments
+                          (org-babel-clean-text-properties
+                           (concat ":var results="
+                                   (mapconcat #'identity
+                                              (butlast lob-info) " ")))))
+                        (car (last lob-info)))
+                  'lob))))
+       (setq end (+ end (- (length replacement) (length (match-string 0)))))
+       (replace-match replacement t t)))))
+
+(defun org-babel-exp-do-export (info type)
+  "Return a string with the exported content of a code block.
+The function respects the value of the :exports header argument."
+  (flet ((silently () (let ((session (cdr (assoc :session (nth 2 info)))))
+                       (when (and session
+                                  (not (equal "none" session))
+                                  (not (assoc :noeval (nth 2 info))))
+                         (org-babel-exp-results info type 'silent))))
+        (clean () (org-babel-remove-result info)))
+    (case (intern (or (cdr (assoc :exports (nth 2 info))) "code"))
+      ('none (silently) (clean) "")
+      ('code (silently) (clean) (org-babel-exp-code info type))
+      ('results (org-babel-exp-results info type))
+      ('both (concat (org-babel-exp-code info type)
+                    "\n\n"
+                    (org-babel-exp-results info type))))))
+
+(defvar backend)
+(defun org-babel-exp-code (info type)
+  "Prepare and return code in the current code block for export.
+Code is prepared in a manner suitable for exportat by
+org-mode.  This function is called by `org-babel-exp-do-export'.
+The code block is not evaluated."
+  (let ((lang (nth 0 info))
+        (body (nth 1 info))
+        (switches (nth 3 info))
+        (name (nth 4 info))
+        (args (mapcar
+              #'cdr
+              (org-remove-if-not (lambda (el) (eq :var (car el))) (nth 2 info)))))
+    (case type
+      ('inline (format "=%s=" body))
+      ('block
+         (let ((str
+                (format "#+BEGIN_SRC %s %s\n%s%s#+END_SRC\n" lang switches body
+                        (if (and body (string-match "\n$" body))
+                            "" "\n"))))
+           (when name
+             (add-text-properties
+              0 (length str)
+              (list 'org-caption
+                    (format "%s(%s)"
+                            name
+                            (mapconcat #'identity args ", ")))
+              str))
+           str))
+      ('lob
+       (let ((call-line (and (string-match "results=" (car args))
+                            (substring (car args) (match-end 0)))))
+        (cond
+         ((eq backend 'html)
+          (format "\n#+HTML: <label class=\"org-src-name\">%s</label>\n"
+                  call-line))
+         ((format ": %s\n" call-line))))))))
+
+(defun org-babel-exp-results (info type &optional silent)
+  "Evaluate and return the results of the current code block for export.
+Results are prepared in a manner suitable for export by org-mode.
+This function is called by `org-babel-exp-do-export'.  The code
+block will be evaluated.  Optional argument SILENT can be used to
+inhibit insertion of results into the buffer."
+  (if org-export-babel-evaluate
+      (let ((lang (nth 0 info))
+           (body (nth 1 info))
+           (params
+            ;; lets ensure that we lookup references in the original file
+            (mapcar
+             (lambda (pair)
+               (if (and org-current-export-file
+                        (eq (car pair) :var)
+                        (string-match org-babel-ref-split-regexp (cdr pair))
+                        (equal :ob-must-be-reference
+                               (org-babel-ref-literal
+                                (match-string 2 (cdr pair)))))
+                   `(:var . ,(concat (match-string 1 (cdr pair))
+                                     "=" org-current-export-file
+                                     ":" (match-string 2 (cdr pair))))
+                 pair))
+             (nth 2 info))))
+       ;; skip code blocks which we can't evaluate
+       (if (fboundp (intern (concat "org-babel-execute:" lang)))
+           (case type
+             ('inline
+               (let ((raw (org-babel-execute-src-block
+                           nil info '((:results . "silent"))))
+                     (result-params (split-string
+                                     (cdr (assoc :results params)))))
+                 (unless silent
+                   (cond ;; respect the value of the :results header argument
+                    ((member "file" result-params)
+                     (org-babel-result-to-file raw))
+                    ((or (member "raw" result-params)
+                         (member "org" result-params))
+                     (format "%s" raw))
+                    ((member "code" result-params)
+                     (format "src_%s{%s}" lang raw))
+                    (t
+                     (if (stringp raw)
+                         (if (= 0 (length raw)) "=(no results)="
+                           (format "%s" raw))
+                       (format "%S" raw)))))))
+             ('block
+                 (org-babel-execute-src-block
+                  nil info (org-babel-merge-params
+                            params
+                            `((:results . ,(if silent "silent" "replace")))))
+               "")
+             ('lob
+              (save-excursion
+                (re-search-backward org-babel-lob-one-liner-regexp nil t)
+                (org-babel-execute-src-block
+                 nil info (org-babel-merge-params
+                           params
+                           `((:results . ,(if silent "silent" "replace")))))
+                "")))
+         ""))
+    ""))
+
+(provide 'ob-exp)
+
+;; arch-tag: 523abf4c-76d1-44ed-9f27-e3bddf34bf0f
+
+;;; ob-exp.el ends here
diff --git a/lisp/org/ob-gnuplot.el b/lisp/org/ob-gnuplot.el
new file mode 100644 (file)
index 0000000..40543d7
--- /dev/null
@@ -0,0 +1,229 @@
+;;; ob-gnuplot.el --- org-babel functions for gnuplot evaluation
+
+;; Copyright (C) 2009, 2010  Free Software Foundation, Inc.
+
+;; Author: Eric Schulte
+;; Keywords: literate programming, reproducible research
+;; Homepage: http://orgmode.org
+;; Version: 7.01
+
+;; 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:
+
+;; Org-Babel support for evaluating gnuplot source code.
+;;
+;; This differs from most standard languages in that
+;;
+;; 1) we are generally only going to return results of type "file"
+;;
+;; 2) we are adding the "file" and "cmdline" header arguments
+
+;;; Requirements:
+
+;; - gnuplot :: http://www.gnuplot.info/
+;; 
+;; - gnuplot-mode :: http://cars9.uchicago.edu/~ravel/software/gnuplot-mode.html
+
+;;; Code:
+(require 'ob)
+(require 'ob-ref)
+(require 'ob-comint)
+(eval-when-compile (require 'cl))
+
+(declare-function org-time-string-to-time "org" (s))
+(declare-function org-combine-plists "org" (&rest plists))
+(declare-function orgtbl-to-generic "org-table" (table params))
+(declare-function gnuplot-mode "ext:gnuplot-mode" ())
+(declare-function gnuplot-send-string-to-gnuplot "ext:gnuplot-mode" (str txt))
+(declare-function gnuplot-send-buffer-to-gnuplot "ext:gnuplot-mode" ())
+
+(defvar org-babel-default-header-args:gnuplot
+  '((:results . "file") (:exports . "results") (:session . nil))
+  "Default arguments to use when evaluating a gnuplot source block.")
+
+(defvar org-babel-gnuplot-timestamp-fmt nil)
+
+(defun org-babel-gnuplot-process-vars (params)
+  "Extract variables from PARAMS and process the variables.
+Dumps all vectors into files and returns an association list
+of variable names and the related value to be used in the gnuplot
+code."
+  (mapcar
+   (lambda (pair)
+     (cons
+      (car pair) ;; variable name
+      (if (listp (cdr pair)) ;; variable value
+          (org-babel-gnuplot-table-to-data
+           (cdr pair) (make-temp-file "org-babel-gnuplot") params)
+        (cdr pair))))
+   (org-babel-ref-variables params)))
+
+(defun org-babel-expand-body:gnuplot (body params &optional processed-params)
+  "Expand BODY according to PARAMS, return the expanded body."
+  (save-window-excursion
+    (let* ((vars (org-babel-gnuplot-process-vars params))
+           (out-file (cdr (assoc :file params)))
+           (term (or (cdr (assoc :term params))
+                     (when out-file (file-name-extension out-file))))
+           (cmdline (cdr (assoc :cmdline params)))
+           (title (plist-get params :title))
+           (lines (plist-get params :line))
+           (sets (plist-get params :set))
+           (x-labels (plist-get params :xlabels))
+           (y-labels (plist-get params :ylabels))
+           (timefmt (plist-get params :timefmt))
+           (time-ind (or (plist-get params :timeind)
+                         (when timefmt 1)))
+           output)
+      (flet ((add-to-body (text)
+                          (setq body (concat text "\n" body))))
+        ;; append header argument settings to body
+        (when title (add-to-body (format "set title '%s'" title))) ;; title
+        (when lines (mapc (lambda (el) (add-to-body el)) lines)) ;; line
+        (when sets
+          (mapc (lambda (el) (add-to-body (format "set %s" el))) sets))
+        (when x-labels
+          (add-to-body
+           (format "set xtics (%s)"
+                   (mapconcat (lambda (pair)
+                                (format "\"%s\" %d" (cdr pair) (car pair)))
+                              x-labels ", "))))
+        (when y-labels
+          (add-to-body
+           (format "set ytics (%s)"
+                   (mapconcat (lambda (pair)
+                                (format "\"%s\" %d" (cdr pair) (car pair)))
+                              y-labels ", "))))
+        (when time-ind
+          (add-to-body "set xdata time")
+          (add-to-body (concat "set timefmt \""
+                               (or timefmt
+                                   "%Y-%m-%d-%H:%M:%S") "\"")))
+        (when out-file (add-to-body (format "set output \"%s\"" out-file)))
+        (when term (add-to-body (format "set term %s" term)))
+        ;; insert variables into code body: this should happen last
+        ;; placing the variables at the *top* of the code in case their
+        ;; values are used later
+        (add-to-body (mapconcat
+                      (lambda (pair) (format "%s = \"%s\"" (car pair) (cdr pair)))
+                      vars "\n"))
+        ;; replace any variable names preceded by '$' with the actual
+        ;; value of the variable
+        (mapc (lambda (pair)
+                (setq body (replace-regexp-in-string
+                            (format "\\$%s" (car pair)) (cdr pair) body)))
+              vars))
+      body)))
+
+(defun org-babel-execute:gnuplot (body params)
+  "Execute a block of Gnuplot code.
+This function is called by `org-babel-execute-src-block'."
+  (require 'gnuplot)
+  (let ((session (cdr (assoc :session params)))
+        (result-type (cdr (assoc :results params)))
+        (out-file (cdr (assoc :file params)))
+        (body (org-babel-expand-body:gnuplot body params))
+       output)
+    (save-window-excursion
+      ;; evaluate the code body with gnuplot
+      (if (string= session "none")
+          (let ((script-file (make-temp-file "org-babel-gnuplot-script")))
+            (with-temp-file script-file
+              (insert (concat body "\n")))
+            (message "gnuplot \"%s\"" script-file)
+            (setq output
+                  (shell-command-to-string (format "gnuplot \"%s\"" script-file)))
+            (message output))
+        (with-temp-buffer
+          (insert (concat body "\n"))
+          (gnuplot-mode)
+          (gnuplot-send-buffer-to-gnuplot)))
+      (if (member "output" (split-string result-type))
+          output
+        out-file))))
+
+(defun org-babel-prep-session:gnuplot (session params)
+  "Prepare SESSION according to the header arguments in PARAMS."
+  (let* ((session (org-babel-gnuplot-initiate-session session))
+         (vars (org-babel-ref-variables params))
+         (var-lines (mapcar
+                     (lambda (pair) (format "%s = \"%s\"" (car pair) (cdr pair)))
+                     vars)))
+    (message "%S" session)
+    (org-babel-comint-in-buffer session
+      (mapc (lambda (var-line)
+              (insert var-line) (comint-send-input nil t)
+              (org-babel-comint-wait-for-output session)
+              (sit-for .1) (goto-char (point-max))) var-lines))
+    session))
+
+(defun org-babel-load-session:gnuplot (session body params)
+  "Load BODY into SESSION."
+  (save-window-excursion
+    (let ((buffer (org-babel-prep-session:gnuplot session params)))
+      (with-current-buffer buffer
+        (goto-char (process-mark (get-buffer-process (current-buffer))))
+        (insert (org-babel-chomp body)))
+      buffer)))
+
+(defvar gnuplot-buffer)
+(defun org-babel-gnuplot-initiate-session (&optional session params)
+  "Initiate a gnuplot session.
+If there is not a current inferior-process-buffer in SESSION
+then create one.  Return the initialized session.  The current
+`gnuplot-mode' doesn't provide support for multiple sessions."
+  (require 'gnuplot)
+  (unless (string= session "none")
+    (save-window-excursion
+      (gnuplot-send-string-to-gnuplot "" "line")
+      gnuplot-buffer)))
+
+(defun org-babel-gnuplot-quote-timestamp-field (s)
+  "Convert S from timestamp to Unix time and export to gnuplot."
+  (format-time-string org-babel-gnuplot-timestamp-fmt (org-time-string-to-time s)))
+
+(defvar org-table-number-regexp)
+(defvar org-ts-regexp3)
+(defun org-babel-gnuplot-quote-tsv-field (s)
+  "Quote S for export to gnuplot."
+  (unless (stringp s)
+    (setq s (format "%s" s)))
+  (if (string-match org-table-number-regexp s) s
+    (if (string-match org-ts-regexp3 s)
+       (org-babel-gnuplot-quote-timestamp-field s)
+      (concat "\"" (mapconcat 'identity (split-string s "\"") "\"\"") "\""))))
+
+(defun org-babel-gnuplot-table-to-data (table data-file params)
+  "Export TABLE to DATA-FILE in a format readable by gnuplot.
+Pass PARAMS through to `orgtbl-to-generic' when exporting TABLE."
+  (with-temp-file data-file
+    (make-local-variable 'org-babel-gnuplot-timestamp-fmt)
+    (setq org-babel-gnuplot-timestamp-fmt (or
+                                           (plist-get params :timefmt)
+                                           "%Y-%m-%d-%H:%M:%S"))
+    (insert (orgtbl-to-generic
+            table
+            (org-combine-plists
+             '(:sep "\t" :fmt org-babel-gnuplot-quote-tsv-field)
+             params))))
+  data-file)
+
+(provide 'ob-gnuplot)
+
+;; arch-tag: 50490ace-a9e1-4b29-a6e5-0db9f16c610b
+
+;;; ob-gnuplot.el ends here
diff --git a/lisp/org/ob-haskell.el b/lisp/org/ob-haskell.el
new file mode 100644 (file)
index 0000000..e080334
--- /dev/null
@@ -0,0 +1,230 @@
+;;; ob-haskell.el --- org-babel functions for haskell evaluation
+
+;; Copyright (C) 2009, 2010  Free Software Foundation, Inc.
+
+;; Author: Eric Schulte
+;; Keywords: literate programming, reproducible research
+;; Homepage: http://orgmode.org
+;; Version: 7.01
+
+;; 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:
+
+;; Org-Babel support for evaluating haskell source code.  This one will
+;; be sort of tricky because haskell programs must be compiled before
+;; they can be run, but haskell code can also be run through an
+;; interactive interpreter.
+;;
+;; For now lets only allow evaluation using the haskell interpreter.
+
+;;; Requirements:
+
+;; - haskell-mode :: http://www.iro.umontreal.ca/~monnier/elisp/#haskell-mode
+;;
+;; - inf-haskell :: http://www.iro.umontreal.ca/~monnier/elisp/#haskell-mode
+;;
+;; - (optionally) lhs2tex :: http://people.cs.uu.nl/andres/lhs2tex/
+
+;;; Code:
+(require 'ob)
+(require 'ob-comint)
+(require 'comint)
+(eval-when-compile (require 'cl))
+
+(declare-function org-remove-indentation "org" (code &optional n))
+(declare-function haskell-mode "ext:haskell-mode" ())
+(declare-function run-haskell "ext:inf-haskell" (&optional arg))
+(declare-function inferior-haskell-load-file
+                 "ext:inf-haskell" (&optional reload))
+
+(add-to-list 'org-babel-tangle-lang-exts '("haskell" . "hs"))
+
+(defvar org-babel-default-header-args:haskell '())
+
+(defvar org-babel-haskell-lhs2tex-command "lhs2tex")
+
+(defvar org-babel-haskell-eoe "\"org-babel-haskell-eoe\"")
+
+(defun org-babel-expand-body:haskell (body params &optional processed-params)
+  "Expand BODY according to PARAMS, return the expanded body."
+  (let ((vars (nth 1 (or processed-params (org-babel-process-params params)))))
+    (concat
+     (mapconcat
+      (lambda (pair) (format "let %s = %s"
+                       (car pair)
+                       (org-babel-haskell-var-to-haskell (cdr pair))))
+      vars "\n") "\n" body "\n")))
+
+(defun org-babel-execute:haskell (body params)
+  "Execute a block of Haskell code."
+  (let* ((processed-params (org-babel-process-params params))
+         (session (nth 0 processed-params))
+         (vars (nth 1 processed-params))
+         (result-type (nth 3 processed-params))
+         (full-body (org-babel-expand-body:haskell body params processed-params))
+         (session (org-babel-haskell-initiate-session session params))
+         (raw (org-babel-comint-with-output
+                 (session org-babel-haskell-eoe t full-body)
+                (insert (org-babel-trim full-body))
+                (comint-send-input nil t)
+                (insert org-babel-haskell-eoe)
+                (comint-send-input nil t)))
+         (results (mapcar
+                   #'org-babel-haskell-read-string
+                   (cdr (member org-babel-haskell-eoe
+                                (reverse (mapcar #'org-babel-trim raw)))))))
+    (org-babel-reassemble-table
+     (cond 
+      ((equal result-type 'output)
+       (mapconcat #'identity (reverse (cdr results)) "\n"))
+      ((equal result-type 'value)
+       (org-babel-haskell-table-or-string (car results))))
+     (org-babel-pick-name (nth 4 processed-params) (cdr (assoc :colnames params)))
+     (org-babel-pick-name (nth 5 processed-params) (cdr (assoc :rownames params))))))
+
+(defun org-babel-haskell-read-string (string)
+  "Strip \\\"s from around a haskell string."
+  (if (string-match "^\"\\([^\000]+\\)\"$" string)
+      (match-string 1 string)
+    string))
+
+(defun org-babel-haskell-initiate-session (&optional session params)
+  "Initiate a haskell session.
+If there is not a current inferior-process-buffer in SESSION
+then create one.  Return the initialized session."
+  (require 'inf-haskell)
+  (or (get-buffer "*haskell*")
+      (save-window-excursion (run-haskell) (sleep-for 0.25) (current-buffer))))
+
+(defun org-babel-load-session:haskell
+  (session body params &optional processed-params)
+  "Load BODY into SESSION."
+  (save-window-excursion
+    (let* ((buffer (org-babel-prep-session:haskell
+                   session params processed-params))
+           (load-file (concat (make-temp-file "org-babel-haskell-load") ".hs")))
+      (with-temp-buffer
+        (insert body) (write-file load-file)
+        (haskell-mode) (inferior-haskell-load-file))
+      buffer)))
+
+(defun org-babel-prep-session:haskell
+  (session params &optional processed-params)
+  "Prepare SESSION according to the header arguments in PARAMS."
+  (save-window-excursion
+    (let ((pp (or processed-params (org-babel-process-params params)))
+         (buffer (org-babel-haskell-initiate-session session)))
+      (org-babel-comint-in-buffer buffer
+       (mapc
+        (lambda (pair)
+          (insert (format "let %s = %s"
+                          (car pair)
+                          (org-babel-haskell-var-to-haskell (cdr pair))))
+          (comint-send-input nil t))
+        (nth 1 pp)))
+      (current-buffer))))
+
+(defun org-babel-haskell-table-or-string (results)
+  "Convert RESULTS to an Emacs-lisp table or string.
+If RESULTS look like a table, then convert them into an
+Emacs-lisp table, otherwise return the results as a string."
+  (org-babel-read
+   (if (and (stringp results) (string-match "^\\[.+\\]$" results))
+       (org-babel-read
+        (concat "'"
+                (replace-regexp-in-string
+                 "\\[" "(" (replace-regexp-in-string
+                            "\\]" ")" (replace-regexp-in-string
+                                       "," " " (replace-regexp-in-string
+                                                "'" "\"" results))))))
+     results)))
+
+(defun org-babel-haskell-var-to-haskell (var)
+  "Convert an elisp value VAR into a haskell variable.
+The elisp VAR is converted to a string of haskell source code
+specifying a variable of the same value."
+  (if (listp var)
+      (concat "[" (mapconcat #'org-babel-haskell-var-to-haskell var ", ") "]")
+    (format "%S" var)))
+
+(defvar org-src-preserve-indentation)
+(defun org-babel-haskell-export-to-lhs (&optional arg)
+  "Export to a .lhs file with all haskell code blocks escaped.
+When called with a prefix argument the resulting
+.lhs file will be exported to a .tex file.  This function will
+create two new files, base-name.lhs and base-name.tex where
+base-name is the name of the current org-mode file.
+
+Note that all standard Babel literate programming
+constructs (header arguments, no-web syntax etc...) are ignored."
+  (interactive "P")
+  (let* ((contents (buffer-string))
+         (haskell-regexp
+          (concat "^\\([ \t]*\\)#\\+begin_src[ \t]haskell*\\(.*\\)?[\r\n]"
+                  "\\([^\000]*?\\)[\r\n][ \t]*#\\+end_src.*"))
+         (base-name (file-name-sans-extension (buffer-file-name)))
+         (tmp-file (make-temp-file "ob-haskell"))
+         (tmp-org-file (concat tmp-file ".org"))
+         (tmp-tex-file (concat tmp-file ".tex"))
+         (lhs-file (concat base-name ".lhs"))
+         (tex-file (concat base-name ".tex"))
+         (command (concat org-babel-haskell-lhs2tex-command " " lhs-file " > " tex-file))
+         (preserve-indentp org-src-preserve-indentation)
+         indentation)
+    ;; escape haskell source-code blocks
+    (with-temp-file tmp-org-file
+      (insert contents)
+      (goto-char (point-min))
+      (while (re-search-forward haskell-regexp nil t)
+        (save-match-data (setq indentation (length (match-string 1))))
+        (replace-match (save-match-data
+                         (concat
+                          "#+begin_latex\n\\begin{code}\n"
+                          (if (or preserve-indentp
+                                  (string-match "-i" (match-string 2)))
+                              (match-string 3)
+                            (org-remove-indentation (match-string 3)))
+                          "\n\\end{code}\n#+end_latex\n"))
+                       t t)
+        (indent-code-rigidly (match-beginning 0) (match-end 0) indentation)))
+    (save-excursion
+      ;; export to latex w/org and save as .lhs
+      (find-file tmp-org-file) (funcall 'org-export-as-latex nil)
+      (kill-buffer)
+      (delete-file tmp-org-file)
+      (find-file tmp-tex-file)
+      (goto-char (point-min)) (forward-line 2)
+      (insert "%include polycode.fmt\n")
+      ;; ensure all \begin/end{code} statements start at the first column
+      (while (re-search-forward "^[ \t]+\\\\begin{code}[^\000]+\\\\end{code}" nil t)
+        (replace-match (save-match-data (org-remove-indentation (match-string 0)))
+                       t t))
+      (setq contents (buffer-string))
+      (save-buffer) (kill-buffer))
+    (delete-file tmp-tex-file)
+    ;; save org exported latex to a .lhs file
+    (with-temp-file lhs-file (insert contents))
+    (if (not arg)
+        (find-file lhs-file)
+      ;; process .lhs file with lhs2tex
+      (message "running %s" command) (shell-command command) (find-file tex-file))))
+
+(provide 'ob-haskell)
+
+;; arch-tag: b53f75f3-ba1a-4b05-82d9-a2a0d4e70804
+
+;;; ob-haskell.el ends here
diff --git a/lisp/org/ob-keys.el b/lisp/org/ob-keys.el
new file mode 100644 (file)
index 0000000..3f8e83b
--- /dev/null
@@ -0,0 +1,89 @@
+;;; ob-keys.el --- key bindings for org-babel
+
+;; Copyright (C) 2009, 2010  Free Software Foundation, Inc.
+
+;; Author: Eric Schulte
+;; Keywords: literate programming, reproducible research
+;; Homepage: http://orgmode.org
+;; Version: 7.01
+
+;; 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:
+
+;; Add org-babel keybindings to the org-mode keymap for exposing
+;; org-babel functions.  These will all share a common prefix.  See
+;; the value of `org-babel-key-bindings' for a list of interactive
+;; functions and their associated keys.
+
+;;; Code:
+(require 'ob)
+
+(defvar org-babel-key-prefix "\C-c\C-v"
+  "The key prefix for Babel interactive key-bindings.
+See `org-babel-key-bindings' for the list of interactive babel
+functions which are assigned key bindings, and see
+`org-babel-map' for the actual babel keymap.")
+
+(defvar org-babel-map (make-sparse-keymap)
+  "The keymap for interactive Babel functions.")
+
+;;;###autoload
+(defun org-babel-describe-bindings ()
+  "Describe all keybindings behind `org-babel-key-prefix'."
+  (interactive)
+  (describe-bindings org-babel-key-prefix))
+
+(defvar org-babel-key-bindings
+  '(("p" . org-babel-previous-src-block)
+    ("\C-p" . org-babel-previous-src-block)
+    ("n" . org-babel-next-src-block)
+    ("\C-n" . org-babel-next-src-block)
+    ("e" . org-babel-execute-src-block)
+    ("\C-e" . org-babel-execute-src-block)
+    ("o" . org-babel-open-src-block-result)
+    ("\C-o" . org-babel-open-src-block-result)
+    ("\C-v" . org-babel-expand-src-block)
+    ("v" . org-babel-expand-src-block)
+    ("g" . org-babel-goto-named-src-block)
+    ("r" . org-babel-goto-named-result)
+    ("\C-r" . org-babel-goto-named-result)
+    ("\C-b" . org-babel-execute-buffer)
+    ("b" . org-babel-execute-buffer)
+    ("\C-s" . org-babel-execute-subtree)
+    ("s" . org-babel-execute-subtree)
+    ("\C-t" . org-babel-tangle)
+    ("t" . org-babel-tangle)
+    ("\C-f" . org-babel-tangle-file)
+    ("f" . org-babel-tangle-file)
+    ("\C-l" . org-babel-lob-ingest)
+    ("l" . org-babel-lob-ingest)
+    ("\C-z" . org-babel-switch-to-session)
+    ("z" . org-babel-switch-to-session)
+    ("\C-a" . org-babel-sha1-hash)
+    ("a" . org-babel-sha1-hash)
+    ("h" . org-babel-describe-bindings))
+  "Alist of key bindings and interactive Babel functions.
+This list associates interactive Babel functions
+with keys.  Each element of this list will add an entry to the
+`org-babel-map' using the letter key which is the `car' of the
+a-list placed behind the generic `org-babel-key-prefix'.")
+
+(provide 'ob-keys)
+
+;; arch-tag: 01e348ee-4906-46fa-839a-6b7b6f989048
+
+;;; ob-keys.el ends here
diff --git a/lisp/org/ob-latex.el b/lisp/org/ob-latex.el
new file mode 100644 (file)
index 0000000..e5b0146
--- /dev/null
@@ -0,0 +1,158 @@
+;;; ob-latex.el --- org-babel functions for latex "evaluation"
+
+;; Copyright (C) 2009, 2010  Free Software Foundation, Inc.
+
+;; Author: Eric Schulte
+;; Keywords: literate programming, reproducible research
+;; Homepage: http://orgmode.org
+;; Version: 7.01
+
+;; 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:
+
+;; Org-Babel support for evaluating LaTeX source code.
+;;
+;; Currently on evaluation this returns raw LaTeX code, unless a :file
+;; header argument is given in which case small png or pdf files will
+;; be created directly form the latex source code.
+
+;;; Code:
+(require 'ob)
+
+(declare-function org-create-formula-image "org" (string tofile options buffer))
+(declare-function org-splice-latex-header "org"
+                 (tpl def-pkg pkg snippets-p &optional extra))
+(declare-function org-export-latex-fix-inputenc "org-latex" ())
+
+(add-to-list 'org-babel-tangle-lang-exts '("latex" . "tex"))
+
+(defvar org-babel-default-header-args:latex
+  '((:results . "latex") (:exports . "results"))
+  "Default arguments to use when evaluating a LaTeX source block.")
+
+(defun org-babel-expand-body:latex (body params &optional processed-params)
+  "Expand BODY according to PARAMS, return the expanded body."
+  (mapc (lambda (pair) ;; replace variables
+          (setq body
+                (replace-regexp-in-string
+                 (regexp-quote (format "%S" (car pair)))
+                 (if (stringp (cdr pair))
+                     (cdr pair) (format "%S" (cdr pair)))
+                 body))) (nth 1 (org-babel-process-params params)))
+  body)
+
+(defvar org-format-latex-options)
+(defvar org-export-latex-packages-alist)
+(defun org-babel-execute:latex (body params)
+  "Execute a block of Latex code with Babel.
+This function is called by `org-babel-execute-src-block'."
+  (setq body (org-babel-expand-body:latex body params))
+  (if (cdr (assoc :file params))
+      (let ((out-file (cdr (assoc :file params)))
+            (tex-file (make-temp-file "org-babel-latex" nil ".tex"))
+            (pdfheight (cdr (assoc :pdfheight params)))
+            (pdfwidth (cdr (assoc :pdfwidth params)))
+            (in-buffer (not (string= "no" (cdr (assoc :buffer params)))))
+            (org-export-latex-packages-alist
+             (append (cdr (assoc :packages params))
+                     org-export-latex-packages-alist)))
+        (cond
+         ((string-match "\\.png$" out-file)
+          (org-create-formula-image
+           body out-file org-format-latex-options in-buffer))
+         ((string-match "\\.pdf$" out-file)
+          (org-babel-latex-body-to-tex-file tex-file body pdfheight pdfwidth)
+          (when (file-exists-p out-file) (delete-file out-file))
+          (rename-file (org-babel-latex-tex-to-pdf tex-file) out-file))
+         ((string-match "\\.\\([^\\.]+\\)$" out-file)
+          (error "can not create %s files, please specify a .png or .pdf file"
+                (match-string 1 out-file))))
+        out-file)
+    body))
+
+(defvar org-format-latex-header)
+(defvar org-format-latex-header-extra)
+(defvar org-export-latex-packages-alist)
+(defvar org-export-latex-default-packages-alist)
+(defun org-babel-latex-body-to-tex-file (tex-file body &optional height width)
+  "Place the contents of BODY into TEX-FILE.
+Extracted from `org-create-formula-image' in org.el."
+  (with-temp-file tex-file
+    (insert (org-splice-latex-header
+              org-format-latex-header
+              (delq
+               nil
+               (mapcar
+                (lambda (el) (unless (and (listp el) (string= "hyperref" (cadr el)))
+                          el))
+                org-export-latex-default-packages-alist))
+              org-export-latex-packages-alist
+              org-format-latex-header-extra)
+            (if height (concat "\n" (format "\\pdfpageheight %s" height)) "")
+            (if width (concat "\n" (format "\\pdfpagewidth %s" width)) "")
+            (if org-format-latex-header-extra
+                (concat "\n" org-format-latex-header-extra)
+              "")
+            "\n\\begin{document}\n" body "\n\\end{document}\n")
+    (org-export-latex-fix-inputenc)))
+
+(defvar org-export-pdf-logfiles)
+(defvar org-latex-to-pdf-process)
+(defvar org-export-pdf-remove-logfiles)
+(defun org-babel-latex-tex-to-pdf (tex-file)
+  "Generate a pdf file according to the contents TEX-FILE.
+Extracted from `org-export-as-pdf' in org-latex.el."
+  (let* ((wconfig (current-window-configuration))
+         (default-directory (file-name-directory tex-file))
+         (base (file-name-sans-extension tex-file))
+         (pdffile (concat base ".pdf"))
+         (cmds org-latex-to-pdf-process)
+         (outbuf (get-buffer-create "*Org PDF LaTeX Output*"))
+         cmd)
+    (if (and cmds (symbolp cmds))
+        (funcall cmds tex-file)
+      (while cmds
+        (setq cmd (pop cmds))
+        (while (string-match "%b" cmd)
+          (setq cmd (replace-match
+                     (save-match-data
+                       (shell-quote-argument base))
+                     t t cmd)))
+        (while (string-match "%s" cmd)
+          (setq cmd (replace-match
+                     (save-match-data
+                       (shell-quote-argument tex-file))
+                     t t cmd)))
+        (shell-command cmd outbuf outbuf)))
+    (if (not (file-exists-p pdffile))
+        (error "PDF file was not produced from %s" tex-file)
+      (set-window-configuration wconfig)
+      (when org-export-pdf-remove-logfiles
+        (dolist (ext org-export-pdf-logfiles)
+          (setq tex-file (concat base "." ext))
+          (and (file-exists-p tex-file) (delete-file tex-file))))
+      pdffile)))
+
+(defun org-babel-prep-session:latex (session params)
+  "Return an error because LaTeX doesn't support sesstions."
+  (error "LaTeX does not support sessions"))
+
+(provide 'ob-latex)
+
+;; arch-tag: 1f13f7e2-26de-4c24-9274-9f331d4c6ff3
+
+;;; ob-latex.el ends here
diff --git a/lisp/org/ob-lob.el b/lisp/org/ob-lob.el
new file mode 100644 (file)
index 0000000..f806668
--- /dev/null
@@ -0,0 +1,116 @@
+;;; ob-lob.el --- functions supporting the Library of Babel
+
+;; Copyright (C) 2009, 2010  Free Software Foundation, Inc.
+
+;; Author: Eric Schulte, Dan Davison
+;; Keywords: literate programming, reproducible research
+;; Homepage: http://orgmode.org
+;; Version: 7.01
+
+;; 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:
+
+;; See the online documentation for more information
+;; 
+;;   http://orgmode.org/worg/org-contrib/babel/
+
+;;; Code:
+(require 'ob)
+(require 'ob-table)
+
+(defvar org-babel-library-of-babel nil
+  "Library of source-code blocks.
+This is an association list.  Populate the library by adding
+files to `org-babel-lob-files'.")
+
+(defcustom org-babel-lob-files '()
+  "Files used to populate the `org-babel-library-of-babel'.
+To add files to this list use the `org-babel-lob-ingest' command."
+  :group 'org-babel
+  :type 'list)
+
+;;;###autoload
+(defun org-babel-lob-ingest (&optional file)
+  "Add all source-blocks defined in FILE to `org-babel-library-of-babel'."
+  (interactive "f")
+  (org-babel-map-src-blocks file
+    (let* ((info (org-babel-get-src-block-info))
+          (source-name (intern (nth 4 info))))
+      (when source-name
+        (setq org-babel-library-of-babel
+              (cons (cons source-name info)
+                    (assq-delete-all source-name org-babel-library-of-babel)))))))
+
+(defconst org-babel-lob-call-aliases '("lob" "call")
+  "Aliases to call a source block function.
+If you change the value of this variable then your files may
+  become unusable by other org-babel users, and vice versa.")
+
+(defconst org-babel-lob-one-liner-regexp
+  (concat "^\\([ \t]*\\)#\\+\\(?:"
+         (mapconcat #'regexp-quote org-babel-lob-call-aliases "\\|")
+         "\\):[ \t]+\\([^\(\)\n]+\\)\(\\([^\n]*\\)\)[ \t]*\\([^\n]*\\)")
+  "Regexp to match calls to predefined source block functions.")
+
+;; functions for executing lob one-liners
+;;;###autoload
+(defun org-babel-lob-execute-maybe ()
+  "Execute a Library of Babel source block, if appropriate.
+Detect if this is context for a Library Of Babel source block and
+if so then run the appropriate source block from the Library."
+  (interactive)
+  (let ((info (org-babel-lob-get-info)))
+    (if (nth 0 info) (progn (org-babel-lob-execute info) t) nil)))
+
+(add-hook 'org-ctrl-c-ctrl-c-hook 'org-babel-lob-execute-maybe)
+
+;;;###autoload
+(defun org-babel-lob-get-info ()
+  "Return a Library of Babel function call as a string.
+
+This function is analogous to org-babel-get-src-block-name. For
+both functions, after they are called, (match-string 1) matches
+the function name, and (match-string 2) matches the function
+arguments inside the parentheses. I think perhaps these functions
+should be renamed to bring out this similarity, perhaps involving
+the word 'call'."
+  (let ((case-fold-search t))
+    (save-excursion
+      (beginning-of-line 1)
+      (if (looking-at org-babel-lob-one-liner-regexp)
+          (append (mapcar #'org-babel-clean-text-properties 
+                         (list (format "%s(%s)" (match-string 2) (match-string 3))
+                               (match-string 4)))
+                 (list (length (match-string 1))))))))
+  
+(defun org-babel-lob-execute (info)
+  "Execute the lob call specified by INFO."
+  (let ((params (org-babel-merge-params
+                org-babel-default-header-args
+                (org-babel-params-from-buffer)
+                 (org-babel-params-from-properties)
+                (org-babel-parse-header-arguments
+                 (org-babel-clean-text-properties
+                  (concat ":var results=" (mapconcat #'identity (butlast info) " ")))))))
+    (org-babel-execute-src-block
+     nil (list "emacs-lisp" "results" params nil nil (nth 2 info)))))
+
+(provide 'ob-lob)
+
+;; arch-tag: ce0712c9-2147-4019-ba3f-42341b8b474b
+
+;;; ob-lob.el ends here
diff --git a/lisp/org/ob-matlab.el b/lisp/org/ob-matlab.el
new file mode 100644 (file)
index 0000000..0728edf
--- /dev/null
@@ -0,0 +1,48 @@
+;;; ob-matlab.el --- org-babel support for matlab evaluation
+
+;; Copyright (C) 2010  Free Software Foundation, Inc.
+
+;; Author: Dan Davison
+;; Keywords: literate programming, reproducible research
+;; Homepage: http://orgmode.org
+;; Version: 7.01
+
+;; 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:
+
+;; Functions that are common to org-babel support for matlab and
+;; octave are in org-babel-octave.el
+
+;;; Requirements:
+
+;; Matlab
+
+;; matlab.el required for interactive emacs sessions and matlab-mode
+;; major mode for source code editing buffer
+;; http://matlab-emacs.sourceforge.net/
+
+;;; Code:
+(require 'ob)
+(require 'ob-octave)
+
+;; see ob-octave for matlab implementation
+
+(provide 'ob-matlab)
+
+;; arch-tag: 6b234299-c1f7-4eb1-ace8-7b93344065ac
+
+;;; ob-matlab.el ends here
diff --git a/lisp/org/ob-mscgen.el b/lisp/org/ob-mscgen.el
new file mode 100644 (file)
index 0000000..a78e0b6
--- /dev/null
@@ -0,0 +1,89 @@
+;;; ob-msc.el --- org-babel functions for mscgen evaluation
+
+;; Copyright (C) 2010  Free Software Foundation, Inc.
+
+;; Author: Juan Pechiar
+;; Keywords: literate programming, reproducible research
+;; Homepage: http://orgmode.org
+;; Version: 7.01
+
+;; 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:
+;;
+;; This software provides EMACS org-babel export support for message
+;; sequence charts. The mscgen utility is used for processing the
+;; sequence definition, and must therefore be installed in the system.
+;;
+;; Mscgen is available and documented at
+;; http://www.mcternan.me.uk/mscgen/index.html
+;;
+;; This code is directly inspired by Eric Schulte's ob-dot.el
+;;
+;; Example:
+;;
+;; #+begin_src mscgen :file example.png
+;; msc {
+;;  A,B;
+;;  A -> B [ label = "send message" ];
+;;  A <- B [ label = "get answer" ];
+;; }
+;; #+end_src
+;;
+;; Header for alternative file type:
+;;
+;; #+begin_src mscgen :file ex2.svg :filetype svg
+
+;; This differs from most standard languages in that
+;;
+;; 1) there is no such thing as a "session" in mscgen
+;; 2) we are generally only going to return results of type "file"
+;; 3) we are adding the "file" and "filetype" header arguments
+;; 4) there are no variables
+
+;;; Code:
+(require 'ob)
+(require 'ob-eval)
+
+(defvar org-babel-default-header-args:mscgen
+  '((:results . "file") (:exports . "results"))
+  "Default arguments to use when evaluating a mscgen source block.")
+
+(defun org-babel-expand-body:mscgen (body params &optional processed-params)
+  "Expand BODY according to PARAMS, return the expanded body." body)
+
+(defun org-babel-execute:mscgen (body params)
+  "Execute a block of Mscgen code with Babel.
+This function is called by `org-babel-execute-src-block'.
+Default filetype is png. Modify by setting :filetype parameter to
+mscgen supported formats."
+  (let* ((out-file (or (cdr (assoc :file params)) "output.png" ))
+         (filetype (or (cdr (assoc :filetype params)) "png" )))
+    (unless (cdr (assoc :file params))
+      (error "
+ERROR: no output file specified. Add \":file name.png\" to the src header"))
+    (org-babel-eval (concat "mscgen -T " filetype " -o " out-file) body)
+    out-file))
+
+(defun org-babel-prep-session:mscgen (session params)
+  "Raise an error because Mscgen doesn't support sessions."
+  (error "Mscgen does not support sessions"))
+
+(provide 'ob-mscgen)
+
+;; arch-tag: 74695b1e-715f-4b5a-a3a9-d78ee39ba5c8
+
+;;; ob-msc.el ends here
diff --git a/lisp/org/ob-ocaml.el b/lisp/org/ob-ocaml.el
new file mode 100644 (file)
index 0000000..f5add5c
--- /dev/null
@@ -0,0 +1,158 @@
+;;; ob-ocaml.el --- org-babel functions for ocaml evaluation
+
+;; Copyright (C) 2009, 2010  Free Software Foundation, Inc.
+
+;; Author: Eric Schulte
+;; Keywords: literate programming, reproducible research
+;; Homepage: http://orgmode.org
+;; Version: 7.01
+
+;; 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:
+
+;; Org-Babel support for evaluating ocaml source code.  This one will
+;; be sort of tricky because ocaml programs must be compiled before
+;; they can be run, but ocaml code can also be run through an
+;; interactive interpreter.
+;;
+;; For now lets only allow evaluation using the ocaml interpreter.
+
+;;; Requirements:
+
+;; - tuareg-mode :: http://www-rocq.inria.fr/~acohen/tuareg/
+
+;;; Code:
+(require 'ob)
+(require 'ob-comint)
+(require 'comint)
+(eval-when-compile (require 'cl))
+
+(declare-function tuareg-run-caml "ext:tuareg" ())
+(declare-function tuareg-interactive-send-input "ext:tuareg" ())
+
+(add-to-list 'org-babel-tangle-lang-exts '("ocaml" . "ml"))
+
+(defvar org-babel-default-header-args:ocaml '())
+
+(defvar org-babel-ocaml-eoe-indicator "\"org-babel-ocaml-eoe\";;")
+(defvar org-babel-ocaml-eoe-output "org-babel-ocaml-eoe")
+
+(defun org-babel-expand-body:ocaml (body params &optional processed-params)
+  "Expand BODY according to PARAMS, return the expanded body."
+  (let ((vars (nth 1 (or processed-params (org-babel-process-params params)))))
+    (concat
+     (mapconcat
+      (lambda (pair) (format "let %s = %s;;" (car pair)
+                       (org-babel-ocaml-elisp-to-ocaml (cdr pair))))
+      vars "\n") "\n" body "\n")))
+
+(defun org-babel-execute:ocaml (body params)
+  "Execute a block of Ocaml code with Babel."
+  (let* ((processed-params (org-babel-process-params params))
+         (vars (nth 1 processed-params))
+         (full-body (org-babel-expand-body:ocaml body params processed-params))
+         (session (org-babel-prep-session:ocaml
+                  (cdr (assoc :session params)) params))
+         (raw (org-babel-comint-with-output
+                 (session org-babel-ocaml-eoe-output t full-body)
+               (insert
+                (concat
+                 (org-babel-chomp full-body)"\n"org-babel-ocaml-eoe-indicator))
+               (tuareg-interactive-send-input)))
+        (clean
+         (car (let ((re (regexp-quote org-babel-ocaml-eoe-output)) out)
+                (delq nil (mapcar (lambda (line)
+                                    (if out
+                                        (progn (setq out nil) line)
+                                      (when (string-match re line)
+                                        (progn (setq out t) nil))))
+                                (mapcar #'org-babel-trim (reverse raw))))))))
+    (org-babel-reassemble-table
+     (org-babel-ocaml-parse-output (org-babel-trim clean))
+     (org-babel-pick-name
+      (nth 4 processed-params) (cdr (assoc :colnames params)))
+     (org-babel-pick-name
+      (nth 5 processed-params) (cdr (assoc :rownames params))))))
+
+(defvar tuareg-interactive-buffer-name)
+(defun org-babel-prep-session:ocaml (session params)
+  "Prepare SESSION according to the header arguments in PARAMS."
+  (require 'tuareg)
+  (let ((tuareg-interactive-buffer-name (if (and (not (string= session "none"))
+                                                 (not (string= session "default"))
+                                                 (stringp session))
+                                            session
+                                          tuareg-interactive-buffer-name)))
+    (save-window-excursion (tuareg-run-caml)
+                           (get-buffer tuareg-interactive-buffer-name))))
+
+(defun org-babel-ocaml-elisp-to-ocaml (val)
+  "Return a string of ocaml code which evaluates to VAL."
+  (if (listp val)
+      (concat "[|" (mapconcat #'org-babel-ocaml-elisp-to-ocaml val "; ") "|]")
+    (format "%S" val)))
+
+(defun org-babel-ocaml-parse-output (output)
+  "Parse OUTPUT.
+OUTPUT is string output from an ocaml process."
+  (let ((regexp "%s = \\(.+\\)$"))
+    (cond
+     ((string-match (format regexp "string") output)
+      (org-babel-read (match-string 1 output)))
+     ((or (string-match (format regexp "int") output)
+          (string-match (format regexp "float") output))
+      (string-to-number (match-string 1 output)))
+     ((string-match (format regexp "list") output)
+      (org-babel-ocaml-read-list (match-string 1 output)))
+     ((string-match (format regexp "array") output)
+      (org-babel-ocaml-read-array (match-string 1 output)))
+     (t (message "don't recognize type of %s" output) output))))
+
+(defun org-babel-ocaml-read-list (results)
+  "Convert RESULTS into an elisp table or string.
+If the results look like a table, then convert them into an
+Emacs-lisp table, otherwise return the results as a string."
+  (org-babel-read
+   (if (and (stringp results) (string-match "^\\[.+\\]$" results))
+       (org-babel-read
+        (replace-regexp-in-string
+         "\\[" "(" (replace-regexp-in-string
+                    "\\]" ")" (replace-regexp-in-string
+                               "; " " " (replace-regexp-in-string
+                                         "'" "\"" results)))))
+     results)))
+
+(defun org-babel-ocaml-read-array (results)
+  "Convert RESULTS into an elisp table or string.
+If the results look like a table, then convert them into an
+Emacs-lisp table, otherwise return the results as a string."
+  (org-babel-read
+   (if (and (stringp results) (string-match "^\\[.+\\]$" results))
+       (org-babel-read
+       (concat
+        "'" (replace-regexp-in-string
+             "\\[|" "(" (replace-regexp-in-string
+                         "|\\]" ")" (replace-regexp-in-string
+                                     "; " " " (replace-regexp-in-string
+                                               "'" "\"" results))))))
+     results)))
+
+(provide 'ob-ocaml)
+
+;; arch-tag: 2e815f4d-365e-4d69-b1df-dd17fdd7b7b7
+
+;;; ob-ocaml.el ends here
diff --git a/lisp/org/ob-octave.el b/lisp/org/ob-octave.el
new file mode 100644 (file)
index 0000000..2cdbaa0
--- /dev/null
@@ -0,0 +1,266 @@
+;;; ob-octave.el --- org-babel functions for octave and matlab evaluation
+
+;; Copyright (C) 2010  Free Software Foundation, Inc.
+
+;; Author: Dan Davison
+;; Keywords: literate programming, reproducible research
+;; Homepage: http://orgmode.org
+;; Version: 7.01
+
+;; 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:
+
+;;; Requirements:
+
+;; octave
+;; octave-mode.el and octave-inf.el come with GNU emacs
+
+;;; Code:
+(require 'ob)
+(require 'ob-ref)
+(require 'ob-comint)
+(require 'ob-eval)
+(eval-when-compile (require 'cl))
+
+(declare-function matlab-shell "ext:matlab-mode")
+(declare-function matlab-shell-run-region "ext:matlab-mode")
+
+(defvar org-babel-default-header-args:matlab '())
+(defvar org-babel-default-header-args:octave '())
+
+(defvar org-babel-matlab-shell-command "matlab -nosplash"
+  "Shell command to run matlab as an external process.")
+(defvar org-babel-octave-shell-command "octave -q"
+  "Shell command to run octave as an external process.")
+
+(defun org-babel-expand-body:matlab (body params &optional processed-params)
+  "Expand BODY according to PARAMS, return the expanded body."
+  (org-babel-expand-body:octave body params processed-params))
+(defun org-babel-expand-body:octave (body params &optional processed-params)
+  "Expand BODY according to PARAMS, return the expanded body."
+  (let ((vars (nth 1 (or processed-params (org-babel-process-params params)))))
+    (concat
+     (mapconcat
+      (lambda (pair)
+        (format "%s=%s"
+                (car pair)
+                (org-babel-octave-var-to-octave (cdr pair))))
+      vars "\n") "\n" body "\n")))
+
+(defvar org-babel-matlab-with-emacs-link nil
+  "If non-nil use matlab-shell-run-region for session evaluation.
+  This will use EmacsLink if (matlab-with-emacs-link) evaluates
+  to a non-nil value.")
+
+(defvar org-babel-matlab-emacs-link-wrapper-method
+   "%s
+if ischar(ans), fid = fopen('%s', 'w'); fprintf(fid, '%%s\\n', ans); fclose(fid);
+else, save -ascii %s ans
+end
+delete('%s')
+")
+(defvar org-babel-octave-wrapper-method
+  "%s
+if ischar(ans), fid = fopen('%s', 'w'); fprintf(fid, '%%s\\n', ans); fclose(fid);
+else, save -ascii %s ans
+end")
+
+(defvar org-babel-octave-eoe-indicator "\'org_babel_eoe\'")
+
+(defvar org-babel-octave-eoe-output "ans = org_babel_eoe")
+
+(defun org-babel-execute:matlab (body params)
+  "Execute a block of matlab code with Babel."
+  (require 'matlab)
+  (org-babel-execute:octave body params 'matlab))
+(defun org-babel-execute:octave (body params &optional matlabp)
+  "Execute a block of octave code with Babel."
+  (let* ((processed-params (org-babel-process-params params))
+         (session
+         (funcall (intern (format "org-babel-%s-initiate-session"
+                                  (if matlabp "matlab" "octave")))
+                  (nth 0 processed-params) params))
+         (vars (nth 1 processed-params))
+         (result-params (nth 2 processed-params))
+         (result-type (nth 3 processed-params))
+        (out-file (cdr (assoc :file params)))
+        (augmented-body
+         (org-babel-expand-body:octave body params processed-params))
+        (result (org-babel-octave-evaluate
+                 session augmented-body result-type matlabp)))
+    (or out-file
+        (org-babel-reassemble-table
+         result
+         (org-babel-pick-name
+         (nth 4 processed-params) (cdr (assoc :colnames params)))
+         (org-babel-pick-name
+         (nth 5 processed-params) (cdr (assoc :rownames params)))))))
+
+(defun org-babel-prep-session:matlab (session params)
+  "Prepare SESSION according to PARAMS."
+  (require 'matlab)
+  (org-babel-prep-session:octave session params 'matlab))
+(defun org-babel-octave-var-to-octave (var)
+  "Convert an emacs-lisp value into an octave variable.
+Converts an emacs-lisp variable into a string of octave code
+specifying a variable of the same value."
+  (if (listp var)
+      (concat "[" (mapconcat #'org-babel-octave-var-to-octave var ", ") "]")
+    (format "%S" var)))
+
+(defun org-babel-prep-session:octave (session params &optional matlabp)
+  "Prepare SESSION according to the header arguments specified in PARAMS."
+  (let* ((session (org-babel-octave-initiate-session session params matlabp))
+         (vars (org-babel-ref-variables params))
+         (var-lines (mapcar
+                     (lambda (pair)
+                       (format "%s=%s"
+                               (car pair)
+                               (org-babel-octave-var-to-octave (cdr pair))))
+                     vars)))
+    (org-babel-comint-in-buffer session
+      (mapc (lambda (var)
+              (end-of-line 1) (insert var) (comint-send-input nil t)
+              (org-babel-comint-wait-for-output session)) var-lines))
+    session))
+
+(defun org-babel-matlab-initiate-session (&optional session params)
+  "Create a matlab inferior process buffer.
+If there is not a current inferior-process-buffer in SESSION then
+create. Return the initialized session."
+  (require 'matlab)
+  (org-babel-octave-initiate-session session params 'matlab))
+(defun org-babel-octave-initiate-session (&optional session params matlabp)
+  "Create an octave inferior process buffer.
+If there is not a current inferior-process-buffer in SESSION then
+create. Return the initialized session."
+  (require 'octave-inf)
+  (unless (string= session "none")
+    (let ((session (or session
+                      (if matlabp "*Inferior Matlab*" "*Inferior Octave*"))))
+      (if (org-babel-comint-buffer-livep session) session
+       (save-window-excursion
+         (if matlabp (unless org-babel-matlab-with-emacs-link (matlab-shell))
+           (run-octave))
+         (rename-buffer (if (bufferp session) (buffer-name session)
+                          (if (stringp session) session (buffer-name))))
+         (current-buffer))))))
+
+(defun org-babel-octave-evaluate
+  (session body result-type lang &optional matlabp)
+  "Pass BODY to the octave process in SESSION.
+If RESULT-TYPE equals 'output then return the outputs of the
+statements in BODY, if RESULT-TYPE equals 'value then return the
+value of the last statement in BODY, as elisp."
+  (if session
+      (org-babel-octave-evaluate-session session body result-type matlabp)
+    (org-babel-octave-evaluate-external-process body result-type matlabp)))
+
+(defun org-babel-octave-evaluate-external-process (body result-type matlabp)
+  "Evaluate BODY in an external octave process."
+  (let ((cmd (if matlabp
+                org-babel-matlab-shell-command
+              org-babel-octave-shell-command)))
+    (case result-type
+      (output (org-babel-eval cmd body))
+      (value (let ((tmp-file (make-temp-file "org-babel-results-")))
+              (org-babel-eval
+               cmd
+               (format org-babel-octave-wrapper-method body tmp-file tmp-file))
+              (org-babel-eval-read-file tmp-file))))))
+
+(defun org-babel-octave-evaluate-session
+  (session body result-type &optional matlabp)
+  "Evaluate BODY in SESSION."
+  (let* ((tmp-file (make-temp-file "org-babel-results-"))
+        (wait-file (make-temp-file "org-babel-matlab-emacs-link-wait-signal-"))
+        (full-body
+         (case result-type
+           (output
+            (mapconcat
+             #'org-babel-chomp
+             (list body org-babel-octave-eoe-indicator) "\n"))
+           (value
+            (if (and matlabp org-babel-matlab-with-emacs-link)
+                (concat
+                 (format org-babel-matlab-emacs-link-wrapper-method
+                         body tmp-file tmp-file wait-file) "\n")
+              (mapconcat
+               #'org-babel-chomp
+               (list (format org-babel-octave-wrapper-method
+                             body tmp-file tmp-file)
+                     org-babel-octave-eoe-indicator) "\n")))))
+        (raw (if (and matlabp org-babel-matlab-with-emacs-link)
+                 (save-window-excursion
+                   (with-temp-buffer
+                     (insert full-body)
+                     (write-region "" 'ignored wait-file nil nil nil 'excl)
+                     (matlab-shell-run-region (point-min) (point-max))
+                     (message "Waiting for Matlab Emacs Link")
+                     (while (file-exists-p wait-file) (sit-for 0.01))
+                     "")) ;; matlab-shell-run-region doesn't seem to
+                          ;; make *matlab* buffer contents easily
+                          ;; available, so :results output currently
+                          ;; won't work
+               (org-babel-comint-with-output
+                   (session
+                    (if matlabp
+                        org-babel-octave-eoe-indicator
+                      org-babel-octave-eoe-output)
+                    t full-body)
+                 (insert full-body) (comint-send-input nil t)))) results)
+    (case result-type
+      (value
+       (org-babel-octave-import-elisp-from-file
+       (org-babel-maybe-remote-file tmp-file)))
+      (output
+       (progn
+        (setq results
+              (if matlabp
+                  (cdr (reverse (delq "" (mapcar
+                                          #'org-babel-octave-read-string
+                                          (mapcar #'org-babel-trim raw)))))
+                (cdr (member org-babel-octave-eoe-output
+                             (reverse (mapcar
+                                       #'org-babel-octave-read-string
+                                       (mapcar #'org-babel-trim raw)))))))
+        (mapconcat #'identity (reverse results) "\n"))))))
+
+(defun org-babel-octave-import-elisp-from-file (file-name)
+  "Import data from FILE-NAME.
+This removes initial blank and comment lines and then calls
+`org-babel-import-elisp-from-file'."
+  (let ((temp-file (make-temp-file "org-babel-results-")) beg end)
+    (with-temp-file temp-file
+      (insert-file-contents file-name)
+      (re-search-forward "^[ \t]*[^# \t]" nil t)
+      (if (< (setq beg (point-min))
+            (setq end (point-at-bol)))
+         (delete-region beg end)))
+    (org-babel-import-elisp-from-file temp-file)))
+
+(defun org-babel-octave-read-string (string)
+  "Strip \\\"s from around octave string"
+  (if (string-match "^\"\\([^\000]+\\)\"$" string)
+      (match-string 1 string)
+    string))
+
+(provide 'ob-octave)
+
+;; arch-tag: d8e5f68b-ba13-440a-a495-b653e989e704
+
+;;; ob-octave.el ends here
diff --git a/lisp/org/ob-perl.el b/lisp/org/ob-perl.el
new file mode 100644 (file)
index 0000000..bfba158
--- /dev/null
@@ -0,0 +1,120 @@
+;;; ob-perl.el --- org-babel functions for perl evaluation
+
+;; Copyright (C) 2009, 2010  Free Software Foundation
+
+;; Author: Dan Davison, Eric Schulte
+;; Keywords: literate programming, reproducible research
+;; Homepage: http://orgmode.org
+;; Version: 7.01
+
+;; 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:
+
+;; Org-Babel support for evaluating perl source code.
+
+;;; Code:
+(require 'ob)
+(require 'ob-eval)
+(eval-when-compile (require 'cl))
+
+(add-to-list 'org-babel-tangle-lang-exts '("perl" . "pl"))
+
+(defvar org-babel-default-header-args:perl '())
+
+(defvar org-babel-perl-command "perl"
+  "Name of command to use for executing perl code.")
+
+(defun org-babel-expand-body:perl (body params &optional processed-params)
+  "Expand BODY according to PARAMS, return the expanded body."
+  (let ((vars (nth 1 (or processed-params (org-babel-process-params params)))))
+    (concat
+     (mapconcat ;; define any variables
+      (lambda (pair)
+        (format "$%s=%s;"
+                (car pair)
+                (org-babel-perl-var-to-perl (cdr pair))))
+      vars "\n") "\n" (org-babel-trim body) "\n")))
+
+(defun org-babel-execute:perl (body params)
+  "Execute a block of Perl code with Babel.
+This function is called by `org-babel-execute-src-block'."
+  (let* ((processed-params (org-babel-process-params params))
+         (session (nth 0 processed-params))
+         (vars (nth 1 processed-params))
+         (result-params (nth 2 processed-params))
+         (result-type (nth 3 processed-params))
+         (full-body (org-babel-expand-body:perl
+                     body params processed-params))
+       (session (org-babel-perl-initiate-session session)))
+    (org-babel-reassemble-table
+     (org-babel-perl-evaluate session full-body result-type)
+     (org-babel-pick-name
+      (nth 4 processed-params) (cdr (assoc :colnames params)))
+     (org-babel-pick-name
+      (nth 5 processed-params) (cdr (assoc :rownames params))))))
+
+(defun org-babel-prep-session:perl (session params)
+  "Prepare SESSION according to the header arguments in PARAMS."
+  (error "Sessions are not supported for Perl."))
+
+;; helper functions
+
+(defun org-babel-perl-var-to-perl (var)
+  "Convert an elisp value to a perl variable.
+The elisp value, VAR, is converted to a string of perl source code
+specifying a var of the same value."
+  (if (listp var)
+      (concat "[" (mapconcat #'org-babel-perl-var-to-perl var ", ") "]")
+    (format "%S" var)))
+
+(defvar org-babel-perl-buffers '(:default . nil))
+
+(defun org-babel-perl-initiate-session (&optional session params)
+  "Return nil because sessions are not supported by perl"
+nil)
+
+(defvar org-babel-perl-wrapper-method
+  "
+sub main {
+%s
+}
+@r = main;
+open(o, \">%s\");
+print o join(\"\\n\", @r), \"\\n\"")
+
+(defvar org-babel-perl-pp-wrapper-method
+  nil)
+
+(defun org-babel-perl-evaluate (session body &optional result-type)
+  "Pass BODY to the Perl process in SESSION.
+If RESULT-TYPE equals 'output then return a list of the outputs
+of the statements in BODY, if RESULT-TYPE equals 'value then
+return the value of the last statement in BODY, as elisp."
+  (when session (error "Sessions are not supported for Perl."))
+  (case result-type
+    (output (org-babel-eval org-babel-perl-command body))
+    (value (let ((tmp-file (make-temp-file "org-babel-perl-results-")))
+            (org-babel-eval
+             org-babel-perl-command
+             (format org-babel-perl-wrapper-method body tmp-file))
+            (org-babel-eval-read-file tmp-file)))))
+
+(provide 'ob-perl)
+
+;; arch-tag: 88ef9396-d857-4dc3-8946-5a72bdfa2337
+
+;;; ob-perl.el ends here
diff --git a/lisp/org/ob-python.el b/lisp/org/ob-python.el
new file mode 100644 (file)
index 0000000..c082188
--- /dev/null
@@ -0,0 +1,276 @@
+;;; ob-python.el --- org-babel functions for python evaluation
+
+;; Copyright (C) 2009, 2010  Free Software Foundation
+
+;; Author: Eric Schulte, Dan Davison
+;; Keywords: literate programming, reproducible research
+;; Homepage: http://orgmode.org
+;; Version: 7.01
+
+;; 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:
+
+;; Org-Babel support for evaluating python source code.
+
+;;; Code:
+(require 'ob)
+(require 'ob-ref)
+(require 'ob-comint)
+(require 'ob-eval)
+(eval-when-compile (require 'cl))
+
+(declare-function org-remove-indentation "org" )
+(declare-function py-shell "ext:python-mode" (&optional argprompt))
+(declare-function run-python "ext:python" (&optional cmd noshow new))
+
+(add-to-list 'org-babel-tangle-lang-exts '("python" . "py"))
+
+(defvar org-babel-default-header-args:python '())
+
+(defvar org-babel-python-command "python"
+  "Name of command for executing python code.")
+
+(defvar org-babel-python-mode (if (featurep 'xemacs) 'python-mode 'python)
+  "Preferred python mode for use in running python interactively.")
+
+(defun org-babel-expand-body:python (body params &optional processed-params)
+  "Expand BODY according to PARAMS, return the expanded body."
+  (concat
+   (mapconcat ;; define any variables
+    (lambda (pair)
+      (format "%s=%s"
+              (car pair)
+              (org-babel-python-var-to-python (cdr pair))))
+    (nth 1 (or processed-params (org-babel-process-params params))) "\n")
+   "\n" (org-babel-trim body) "\n"))
+
+(defun org-babel-execute:python (body params)
+  "Execute a block of Python code with Babel.
+This function is called by `org-babel-execute-src-block'."
+  (let* ((processed-params (org-babel-process-params params))
+         (session (org-babel-python-initiate-session (first processed-params)))
+         (result-params (nth 2 processed-params))
+         (result-type (nth 3 processed-params))
+         (full-body (org-babel-expand-body:python
+                     body params processed-params))
+         (result (org-babel-python-evaluate
+                 session full-body result-type result-params)))
+    (or (cdr (assoc :file params))
+        (org-babel-reassemble-table
+         result
+         (org-babel-pick-name (nth 4 processed-params)
+                             (cdr (assoc :colnames params)))
+         (org-babel-pick-name (nth 5 processed-params)
+                             (cdr (assoc :rownames params)))))))
+
+(defun org-babel-prep-session:python (session params)
+  "Prepare SESSION according to the header arguments in PARAMS."
+  (let* ((session (org-babel-python-initiate-session session))
+         (vars (org-babel-ref-variables params))
+         (var-lines (mapcar ;; define any variables
+                     (lambda (pair)
+                       (format "%s=%s"
+                               (car pair)
+                               (org-babel-python-var-to-python (cdr pair))))
+                     vars)))
+    (org-babel-comint-in-buffer session
+      (mapc (lambda (var)
+              (end-of-line 1) (insert var) (comint-send-input)
+              (org-babel-comint-wait-for-output session)) var-lines))
+    session))
+
+(defun org-babel-load-session:python (session body params)
+  "Load BODY into SESSION."
+  (save-window-excursion
+    (let ((buffer (org-babel-prep-session:python session params)))
+      (with-current-buffer buffer
+        (goto-char (process-mark (get-buffer-process (current-buffer))))
+        (insert (org-babel-chomp body)))
+      buffer)))
+
+;; helper functions
+
+(defun org-babel-python-var-to-python (var)
+  "Convert an elisp value to a python variable.
+Convert an elisp value, VAR, into a string of python source code
+specifying a variable of the same value."
+  (if (listp var)
+      (concat "[" (mapconcat #'org-babel-python-var-to-python var ", ") "]")
+    (if (equal var 'hline)
+       "None"
+      (format
+       (if (and (stringp var) (string-match "[\n\r]" var)) "\"\"%S\"\"" "%S")
+       var))))
+
+(defun org-babel-python-table-or-string (results)
+  "Convert RESULTS into an appropriate elisp value.
+If the results look like a list or tuple, then convert them into an
+Emacs-lisp table, otherwise return the results as a string."
+  ((lambda (res)
+     (if (listp res)
+        (mapcar (lambda (el) (if (equal el 'None) 'hline el)) res)
+       res))
+   (org-babel-read
+   (if (or (string-match "^\\[.+\\]$" results)
+          (string-match "^(.+)$" results))
+       (org-babel-read
+        (concat "'"
+                (replace-regexp-in-string
+                 "\\[" "(" (replace-regexp-in-string
+                            "\\]" ")" (replace-regexp-in-string
+                                       ", " " " (replace-regexp-in-string
+                                                 "'" "\"" results t))))))
+     results))))
+
+(defvar org-babel-python-buffers '((:default . nil)))
+
+(defun org-babel-python-session-buffer (session)
+  "Return the buffer associated with SESSION."
+  (cdr (assoc session org-babel-python-buffers)))
+
+(defun org-babel-python-initiate-session-by-key (&optional session)
+  "Initiate a python session.
+If there is not a current inferior-process-buffer in SESSION
+then create.  Return the initialized session."
+  (require org-babel-python-mode)
+  (save-window-excursion
+    (let* ((session (if session (intern session) :default))
+           (python-buffer (org-babel-python-session-buffer session)))
+      (cond
+       ((and (equal 'python org-babel-python-mode)
+            (fboundp 'run-python)) ; python.el
+       (run-python))
+       ((and (equal 'python-mode org-babel-python-mode)
+            (fboundp 'py-shell)) ; python-mode.el
+       ;; `py-shell' creates a buffer whose name is the value of
+       ;; `py-which-bufname' with '*'s at the beginning and end
+       (let* ((bufname (if python-buffer
+                           (replace-regexp-in-string ;; zap surrounding *
+                            "^\\*\\([^*]+\\)\\*$" "\\1" python-buffer)
+                         (concat "Python-" (symbol-name session))))
+              (py-which-bufname bufname))
+         (py-shell)
+         (setq python-buffer (concat "*" bufname "*"))))
+       (t
+       (error "No function available for running an inferior python.")))
+      (setq org-babel-python-buffers
+           (cons (cons session python-buffer)
+                 (assq-delete-all session org-babel-python-buffers)))
+      session)))
+
+(defun org-babel-python-initiate-session (&optional session params)
+  "Create a session named SESSION according to PARAMS."
+  (unless (string= session "none")
+    (org-babel-python-session-buffer
+     (org-babel-python-initiate-session-by-key session))))
+
+(defvar org-babel-python-eoe-indicator "'org_babel_python_eoe'"
+  "A string to indicate that evaluation has completed.")
+(defvar org-babel-python-wrapper-method
+  "
+def main():
+%s
+
+open('%s', 'w').write( str(main()) )")
+(defvar org-babel-python-pp-wrapper-method
+  "
+import pprint
+def main():
+%s
+
+open('%s', 'w').write( pprint.pformat(main()) )")
+
+(defun org-babel-python-evaluate
+  (buffer body &optional result-type result-params)
+  "Pass BODY to the Python process in BUFFER.
+If RESULT-TYPE equals 'output then return a list of the outputs
+of the statements in BODY, if RESULT-TYPE equals 'value then
+return the value of the last statement in BODY, as elisp."
+  (if (not buffer)
+      ;; external process evaluation
+      (case result-type
+       (output (org-babel-eval org-babel-python-command body))
+       (value (let ((tmp-file (make-temp-file "org-babel-python-results-")))
+                (org-babel-eval org-babel-python-command
+                                (format
+                                 (if (member "pp" result-params)
+                                     org-babel-python-pp-wrapper-method
+                                   org-babel-python-wrapper-method)
+                                 (mapconcat
+                                  (lambda (line) (format "\t%s" line))
+                                  (split-string
+                                   (org-remove-indentation
+                                    (org-babel-trim body))
+                                   "[\r\n]") "\n")
+                                 tmp-file))
+                ((lambda (raw)
+                   (if (or (member "code" result-params)
+                           (member "pp" result-params))
+                       raw
+                     (org-babel-python-table-or-string raw)))
+                 (org-babel-eval-read-file tmp-file)))))
+    ;; comint session evaluation
+    (flet ((dump-last-value (tmp-file pp)
+           (mapc
+            (lambda (statement) (insert statement) (comint-send-input))
+            (if pp
+                (list
+                 "import pp"
+                 (format "open('%s', 'w').write(pprint.pformat(_))" tmp-file))
+              (list (format "open('%s', 'w').write(str(_))" tmp-file)))))
+          (input-body (body)
+           (mapc (lambda (statement) (insert statement) (comint-send-input))
+                 (split-string (org-babel-trim body) "[\r\n]+"))
+           (comint-send-input) (comint-send-input)))
+      (case result-type
+       (output
+        (mapconcat
+         #'org-babel-trim
+         (butlast
+          (org-babel-comint-with-output
+              (buffer org-babel-python-eoe-indicator t body)
+            (let ((comint-process-echoes nil))
+              (input-body body)
+              (insert org-babel-python-eoe-indicator)
+              (comint-send-input))) 2) "\n"))
+       (value
+        ((lambda (results)
+           (if (or (member "code" result-params) (member "pp" result-params))
+               results
+             (org-babel-python-table-or-string results)))
+         (let ((tmp-file (make-temp-file "org-babel-python-results-")))
+           (org-babel-comint-with-output
+               (buffer org-babel-python-eoe-indicator t body)
+             (let ((comint-process-echoes nil))
+               (input-body body)
+               (dump-last-value tmp-file (member "pp" result-params))
+               (comint-send-input) (comint-send-input)
+               (insert org-babel-python-eoe-indicator)
+               (comint-send-input)))
+           (org-babel-eval-read-file tmp-file))))))))
+
+(defun org-babel-python-read-string (string)
+  "Strip 's from around python string"
+  (if (string-match "^'\\([^\000]+\\)'$" string)
+      (match-string 1 string)
+    string))
+
+(provide 'ob-python)
+
+;; arch-tag: f19b6c3d-dfcb-4a1a-9ce0-45ade1ebc212
+
+;;; ob-python.el ends here
diff --git a/lisp/org/ob-ref.el b/lisp/org/ob-ref.el
new file mode 100644 (file)
index 0000000..4c344e6
--- /dev/null
@@ -0,0 +1,242 @@
+;;; ob-ref.el --- org-babel functions for referencing external data
+
+;; Copyright (C) 2009, 2010  Free Software Foundation, Inc.
+
+;; Author: Eric Schulte, Dan Davison
+;; Keywords: literate programming, reproducible research
+;; Homepage: http://orgmode.org
+;; Version: 7.01
+
+;; 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:
+
+;; Functions for referencing data from the header arguments of a
+;; org-babel block.  The syntax of such a reference should be
+
+;;   #+VAR: variable-name=file:resource-id
+
+;; - variable-name :: the name of the variable to which the value
+;;                    will be assigned
+
+;; - file :: path to the file containing the resource, or omitted if
+;;           resource is in the current file
+
+;; - resource-id :: the id or name of the resource
+
+;; So an example of a simple src block referencing table data in the
+;; same file would be
+
+;;  #+TBLNAME: sandbox
+;;  | 1 |         2 | 3 |
+;;  | 4 | org-babel | 6 |
+;;
+;;  #+begin_src emacs-lisp :var table=sandbox
+;;    (message table)
+;;  #+end_src
+
+;;; Code:
+(require 'ob)
+(eval-when-compile
+  (require 'cl))
+
+(declare-function org-remove-if-not "org" (predicate seq))
+(declare-function org-at-table-p "org" (&optional table-type))
+(declare-function org-count "org" (CL-ITEM CL-SEQ))
+
+(defun org-babel-ref-variables (params)
+  "Convert PARAMS to variable names and values.
+Takes a parameter alist, and return an alist of variable names,
+and the emacs-lisp representation of the related value."
+  (let ((assignments
+        (delq nil (mapcar (lambda (pair) (if (eq (car pair) :var) (cdr pair))) params)))
+       (others
+         (delq nil (mapcar (lambda (pair) (unless (eq :var (car pair)) pair)) params))))
+    (mapcar (lambda (assignment) (org-babel-ref-parse assignment)) assignments)))
+
+(defvar org-babel-ref-split-regexp
+  "[ \f\t\n\r\v]*\\(.+?\\)[ \f\t\n\r\v]*=[ \f\t\n\r\v]*\\(.+\\)[ \f\t\n\r\v]*")
+
+(defun org-babel-ref-parse (assignment &optional params)
+  "Parse a variable ASSIGNMENT in a header argument.
+If the right hand side of the assignment has a literal value
+return that value, otherwise interpret as a reference to an
+external resource and find it's value using
+`org-babel-ref-resolve-reference'.  Return a list with two
+elements.  The first element of the list will be the name of the
+variable, and the second will be an emacs-lisp representation of
+the value of the variable."
+  (if (string-match org-babel-ref-split-regexp assignment)
+      (let ((var (match-string 1 assignment))
+            (ref (match-string 2 assignment)))
+        (cons (intern var)
+             ((lambda (val)
+                (if (equal :ob-must-be-reference val)
+                    (org-babel-ref-resolve-reference ref params)
+                  val)) (org-babel-ref-literal ref))))))
+
+(defun org-babel-ref-literal (ref)
+  "Return the value of REF if it is a literal value.
+Determine if the right side of a header argument variable
+assignment is a literal value or is a reference to some external
+resource.  REF should be a string of the right hand side of the
+assignment.  If REF is literal then return it's value, otherwise
+return nil."
+  (let ((out (org-babel-read ref)))
+    (if (equal out ref)
+        (if (string-match "^\".+\"$" ref)
+            (read ref)
+         :ob-must-be-reference)
+      out)))
+
+(defvar org-babel-library-of-babel)
+(defun org-babel-ref-resolve-reference (ref &optional params)
+  "Resolve the reference REF and return its value."
+  (save-excursion
+    (let ((case-fold-search t)
+          type args new-refere new-referent result lob-info split-file split-ref
+          index index-row index-col)
+      ;; if ref is indexed grab the indices -- beware nested indices
+      (when (and (string-match "\\[\\(.+\\)\\]" ref)
+                (let ((str (substring ref 0 (match-beginning 0))))
+                  (= (org-count ?( str) (org-count ?) str))))
+        (setq index (match-string 1 ref))
+        (setq ref (substring ref 0 (match-beginning 0))))
+      ;; assign any arguments to pass to source block
+      (when (string-match "^\\(.+?\\)\(\\(.*\\)\)$" ref)
+        (setq new-refere (match-string 1 ref))
+        (setq new-referent (match-string 2 ref))
+        ;; (message "new-refere=%S, new-referent=%S" new-refere new-referent) ;; debugging
+        (when (> (length new-refere) 0)
+          (if (> (length new-referent) 0)
+              (setq args (mapcar (lambda (ref) (cons :var ref))
+                                 (org-babel-ref-split-args new-referent))))
+          ;; (message "args=%S" args) ;; debugging
+          (setq ref new-refere)))
+      (when (string-match "^\\(.+\\):\\(.+\\)$" ref)
+        (setq split-file (match-string 1 ref))
+        (setq split-ref (match-string 2 ref))
+        (find-file split-file) (setq ref split-ref))
+      (save-restriction
+       (widen)
+       (goto-char (point-min))
+       (if (let ((result_regexp (concat "^[ \t]*#\\+\\(TBLNAME\\|RESNAME\\|RESULTS\\):[ \t]*"
+                                        (regexp-quote ref) "[ \t]*$"))
+                 (regexp (concat org-babel-src-name-regexp
+                                 (regexp-quote ref) "\\(\(.*\)\\)?" "[ \t]*$")))
+             ;; goto ref in the current buffer
+             (or (and (not args)
+                      (or (re-search-forward result_regexp nil t)
+                          (re-search-backward result_regexp nil t)))
+                 (re-search-forward regexp nil t)
+                 (re-search-backward regexp nil t)
+                 ;; check the Library of Babel
+                 (setq lob-info (cdr (assoc (intern ref) org-babel-library-of-babel)))))
+           (unless lob-info (goto-char (match-beginning 0)))
+         ;; ;; TODO: allow searching for names in other buffers
+         ;; (setq id-loc (org-id-find ref 'marker)
+         ;;       buffer (marker-buffer id-loc)
+         ;;       loc (marker-position id-loc))
+         ;; (move-marker id-loc nil)
+         (error "reference '%s' not found in this buffer" ref))
+       (if lob-info
+           (setq type 'lob)
+         (while (not (setq type (org-babel-ref-at-ref-p)))
+           (forward-line 1)
+           (beginning-of-line)
+           (if (or (= (point) (point-min)) (= (point) (point-max)))
+               (error "reference not found"))))
+       (setq params (org-babel-merge-params params args '((:results . "silent"))))
+       (setq result
+             (case type
+               ('results-line (org-babel-read-result))
+               ('table (org-babel-read-table))
+               ('file (org-babel-read-link))
+               ('source-block (org-babel-execute-src-block nil nil params))
+               ('lob (org-babel-execute-src-block nil lob-info params))))
+       (if (symbolp result)
+           (format "%S" result)
+         (if (and index (listp result))
+             (org-babel-ref-index-list index result)
+           result))))))
+
+(defun org-babel-ref-index-list (index lis)
+  "Return the subset of LIS indexed by INDEX.
+
+Indices are 0 based and negative indices count from the end of
+LIS, so 0 references the first element of LIS and -1 references
+the last.  If INDEX is separated by \",\"s then each \"portion\"
+is assumed to index into the next deepest nesting or dimension.
+
+A valid \"portion\" can consist of either an integer index, two
+integers separated by a \":\" in which case the entire range is
+returned, or an empty string or \"*\" both of which are
+interpreted to mean the entire range and as such are equivalent
+to \"0:-1\"."
+  (if (and (> (length index) 0) (string-match "^\\([^,]*\\),?" index))
+      (let ((ind-re "\\(\\([-[:digit:]]+\\):\\([-[:digit:]]+\\)\\|\*\\)")
+           (length (length lis))
+            (portion (match-string 1 index))
+            (remainder (substring index (match-end 0))))
+        (flet ((wrap (num) (if (< num 0) (+ length num) num))
+               (open (ls) (if (and (listp ls) (= (length ls) 1)) (car ls) ls)))
+          (open
+           (mapcar
+            (lambda (sub-lis) (org-babel-ref-index-list remainder sub-lis))
+            (if (or (= 0 (length portion)) (string-match ind-re portion))
+                (mapcar
+                (lambda (n) (nth n lis))
+                (apply 'number-sequence
+                       (if (and (> (length portion) 0) (match-string 2 portion))
+                           (list
+                            (wrap (string-to-number (match-string 2 portion)))
+                            (wrap (string-to-number (match-string 3 portion))))
+                         (list (wrap 0) (wrap -1)))))
+              (list (nth (wrap (string-to-number portion)) lis)))))))
+    lis))
+
+(defun org-babel-ref-split-args (arg-string)
+  "Split ARG-STRING into top-level arguments of balanced parenthesis."
+  (let ((index 0) (depth 0) (buffer "") holder return)
+    ;; crawl along string, splitting at any ","s which are on the top level
+    (while (< index (length arg-string))
+      (setq holder (substring arg-string index (+ 1 index)))
+      (setq buffer (concat buffer holder))
+      (setq index (+ 1 index))
+      (cond
+       ((string= holder ",")
+        (when (= depth 0)
+          (setq return (reverse (cons (substring buffer 0 -1) return)))
+          (setq buffer "")))
+       ((or (string= holder "(") (string= holder "[")) (setq depth (+ depth 1)))
+       ((or (string= holder ")") (string= holder "]")) (setq depth (- depth 1)))))
+    (mapcar #'org-babel-trim (reverse (cons buffer return)))))
+
+(defvar org-bracket-link-regexp)
+(defun org-babel-ref-at-ref-p ()
+  "Return the type of reference located at point.
+Return nil if none of the supported reference types are found.
+Supported reference types are tables and source blocks."
+  (cond ((org-at-table-p) 'table)
+        ((looking-at "^[ \t]*#\\+BEGIN_SRC") 'source-block)
+        ((looking-at org-bracket-link-regexp) 'file)
+        ((looking-at org-babel-result-regexp) 'results-line)))
+
+(provide 'ob-ref)
+
+;; arch-tag: ace4a4f4-ea38-4dac-8fe6-6f52fcc43b6d
+
+;;; ob-ref.el ends here
diff --git a/lisp/org/ob-ruby.el b/lisp/org/ob-ruby.el
new file mode 100644 (file)
index 0000000..e557c80
--- /dev/null
@@ -0,0 +1,254 @@
+;;; ob-ruby.el --- org-babel functions for ruby evaluation
+
+;; Copyright (C) 2009, 2010  Free Software Foundation
+
+;; Author: Eric Schulte
+;; Keywords: literate programming, reproducible research
+;; Homepage: http://orgmode.org
+;; Version: 7.01
+
+;; 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:
+
+;; Org-Babel support for evaluating ruby source code.
+
+;;; Requirements:
+
+;; - ruby and irb executables :: http://www.ruby-lang.org/
+;; 
+;; - ruby-mode :: Can be installed through ELPA, or from
+;;   http://github.com/eschulte/rinari/raw/master/util/ruby-mode.el
+;;   
+;; - inf-ruby mode :: Can be installed through ELPA, or from
+;;   http://github.com/eschulte/rinari/raw/master/util/inf-ruby.el
+
+;;; Code:
+(require 'ob)
+(require 'ob-ref)
+(require 'ob-comint)
+(require 'ob-eval)
+(eval-when-compile (require 'cl))
+
+(declare-function run-ruby "ext:inf-ruby" (&optional command name))
+
+(add-to-list 'org-babel-tangle-lang-exts '("ruby" . "rb"))
+
+(defvar org-babel-default-header-args:ruby '())
+
+(defvar org-babel-ruby-command "ruby"
+  "Name of command to use for executing ruby code.")
+
+(defun org-babel-expand-body:ruby (body params &optional processed-params)
+  "Expand BODY according to PARAMS, return the expanded body."
+  (require 'inf-ruby)
+  (let ((vars (nth 1 (or processed-params (org-babel-process-params params)))))
+    (concat
+     (mapconcat ;; define any variables
+      (lambda (pair)
+        (format "%s=%s"
+                (car pair)
+                (org-babel-ruby-var-to-ruby (cdr pair))))
+      vars "\n") "\n" body "\n")))
+
+(defun org-babel-execute:ruby (body params)
+  "Execute a block of Ruby code with Babel.
+This function is called by `org-babel-execute-src-block'."
+  (let* ((processed-params (org-babel-process-params params))
+         (session (org-babel-ruby-initiate-session (first processed-params)))
+         (result-params (nth 2 processed-params))
+         (result-type (nth 3 processed-params))
+         (full-body (org-babel-expand-body:ruby
+                     body params processed-params))
+         (result (org-babel-ruby-evaluate
+                 session full-body result-type result-params)))
+    (or (cdr (assoc :file params))
+        (org-babel-reassemble-table
+         result
+         (org-babel-pick-name (nth 4 processed-params)
+                             (cdr (assoc :colnames params)))
+         (org-babel-pick-name (nth 5 processed-params)
+                             (cdr (assoc :rownames params)))))))
+
+(defun org-babel-prep-session:ruby (session params)
+  "Prepare SESSION according to the header arguments specified in PARAMS."
+  ;; (message "params=%S" params) ;; debugging
+  (let* ((session (org-babel-ruby-initiate-session session))
+         (vars (org-babel-ref-variables params))
+         (var-lines (mapcar ;; define any variables
+                     (lambda (pair)
+                       (format "%s=%s"
+                               (car pair)
+                               (org-babel-ruby-var-to-ruby (cdr pair))))
+                     vars)))
+    (org-babel-comint-in-buffer session
+      (sit-for .5) (goto-char (point-max))
+      (mapc (lambda (var)
+              (insert var) (comint-send-input nil t)
+              (org-babel-comint-wait-for-output session)
+              (sit-for .1) (goto-char (point-max))) var-lines))
+    session))
+
+(defun org-babel-load-session:ruby (session body params)
+  "Load BODY into SESSION."
+  (save-window-excursion
+    (let ((buffer (org-babel-prep-session:ruby session params)))
+      (with-current-buffer buffer
+        (goto-char (process-mark (get-buffer-process (current-buffer))))
+        (insert (org-babel-chomp body)))
+      buffer)))
+
+;; helper functions
+
+(defun org-babel-ruby-var-to-ruby (var)
+  "Convert VAR into a ruby variable.
+Convert an elisp value into a string of ruby source code
+specifying a variable of the same value."
+  (if (listp var)
+      (concat "[" (mapconcat #'org-babel-ruby-var-to-ruby var ", ") "]")
+    (format "%S" var)))
+
+(defun org-babel-ruby-table-or-string (results)
+  "Convert RESULTS into an appropriate elisp value.
+If RESULTS look like a table, then convert them into an
+Emacs-lisp table, otherwise return the results as a string."
+  (org-babel-read
+   (if (and (stringp results) (string-match "^\\[.+\\]$" results))
+       (org-babel-read
+        (concat "'"
+                (replace-regexp-in-string
+                 "\\[" "(" (replace-regexp-in-string
+                            "\\]" ")" (replace-regexp-in-string
+                                       ", " " " (replace-regexp-in-string
+                                                "'" "\"" results))))))
+     results)))
+
+(defun org-babel-ruby-initiate-session (&optional session params)
+  "Initiate a ruby session.
+If there is not a current inferior-process-buffer in SESSION
+then create one.  Return the initialized session."
+  (require 'inf-ruby)
+  (unless (string= session "none")
+    (let ((session-buffer (save-window-excursion
+                           (run-ruby nil session) (current-buffer))))
+      (if (org-babel-comint-buffer-livep session-buffer)
+         (progn (sit-for .25) session-buffer)
+        (sit-for .5)
+        (org-babel-ruby-initiate-session session)))))
+
+(defvar org-babel-ruby-eoe-indicator ":org_babel_ruby_eoe"
+  "String to indicate that evaluation has completed.")
+(defvar org-babel-ruby-f-write
+  "File.open('%s','w'){|f| f.write((_.class == String) ? _ : _.inspect)}")
+(defvar org-babel-ruby-pp-f-write
+  "File.open('%s','w'){|f| $stdout = f; pp(results); $stdout = orig_out}")
+(defvar org-babel-ruby-wrapper-method
+  "
+def main()
+%s
+end
+results = main()
+File.open('%s', 'w'){ |f| f.write((results.class == String) ? results : results.inspect) }
+")
+(defvar org-babel-ruby-pp-wrapper-method
+  "
+require 'pp'
+def main()
+%s
+end
+results = main()
+File.open('%s', 'w') do |f|
+  $stdout = f
+  pp results
+end
+")
+
+(defun org-babel-ruby-evaluate
+  (buffer body &optional result-type result-params)
+  "Pass BODY to the Ruby process in BUFFER.
+If RESULT-TYPE equals 'output then return a list of the outputs
+of the statements in BODY, if RESULT-TYPE equals 'value then
+return the value of the last statement in BODY, as elisp."
+  (if (not buffer)
+      ;; external process evaluation
+      (case result-type
+       (output (org-babel-eval org-babel-ruby-command body))
+       (value (let ((tmp-file (make-temp-file "org-babel-ruby-results-")))
+                (org-babel-eval org-babel-ruby-command
+                                (format (if (member "pp" result-params)
+                                            org-babel-ruby-pp-wrapper-method
+                                          org-babel-ruby-wrapper-method)
+                                        body tmp-file))
+                ((lambda (raw)
+                   (if (or (member "code" result-params)
+                           (member "pp" result-params))
+                       raw
+                     (org-babel-ruby-table-or-string raw)))
+                 (org-babel-eval-read-file tmp-file)))))
+    ;; comint session evaluation
+    (case result-type
+      (output
+       (mapconcat
+       #'identity
+       (butlast
+        (split-string
+         (mapconcat
+          #'org-babel-trim
+          (butlast
+           (org-babel-comint-with-output
+               (buffer org-babel-ruby-eoe-indicator t body)
+             (mapc
+              (lambda (line)
+                (insert (org-babel-chomp line)) (comint-send-input nil t))
+              (list body org-babel-ruby-eoe-indicator))
+             (comint-send-input nil t)) 2)
+          "\n") "[\r\n]")) "\n"))
+      (value
+       ((lambda (results)
+         (if (or (member "code" result-params) (member "pp" result-params))
+             results
+           (org-babel-ruby-table-or-string results)))
+       (let* ((tmp-file (make-temp-file "org-babel-ruby-results-"))
+              (ppp (or (member "code" result-params)
+                       (member "pp" result-params))))
+         (org-babel-comint-with-output
+             (buffer org-babel-ruby-eoe-indicator t body)
+           (when ppp (insert "require 'pp';") (comint-send-input nil t))
+           (mapc
+            (lambda (line)
+              (insert (org-babel-chomp line)) (comint-send-input nil t))
+            (append
+             (list body)
+             (if (not ppp)
+                 (list (format org-babel-ruby-f-write tmp-file))
+               (list
+                "results=_" "require 'pp'" "orig_out = $stdout"
+                (format org-babel-ruby-pp-f-write tmp-file)))
+             (list org-babel-ruby-eoe-indicator)))
+           (comint-send-input nil t))
+         (org-babel-eval-read-file tmp-file)))))))
+
+(defun org-babel-ruby-read-string (string)
+  "Strip \\\"s from around a ruby string."
+  (if (string-match "^\"\\([^\000]+\\)\"$" string)
+      (match-string 1 string)
+    string))
+
+(provide 'ob-ruby)
+
+;; arch-tag: 3e9726db-4520-49e2-b263-e8f571ac88f5
+
+;;; ob-ruby.el ends here
diff --git a/lisp/org/ob-sass.el b/lisp/org/ob-sass.el
new file mode 100644 (file)
index 0000000..87f9ff4
--- /dev/null
@@ -0,0 +1,70 @@
+;;; ob-sass.el --- org-babel functions for the sass css generation language
+
+;; Copyright (C) 2009, 2010  Free Software Foundation, Inc.
+
+;; Author: Eric Schulte
+;; Keywords: literate programming, reproducible research
+;; Homepage: http://orgmode.org
+;; Version: 7.01
+
+;; 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:
+
+;; For more information on sass see http://sass-lang.com/
+;;
+;; This accepts a 'file' header argument which is the target of the
+;; compiled sass.  The default output type for sass evaluation is
+;; either file (if a 'file' header argument was given) or scalar if no
+;; such header argument was supplied.
+;;
+;; A 'cmdline' header argument can be supplied to pass arguments to
+;; the sass command line.
+
+;;; Requirements:
+
+;; - sass-mode :: http://github.com/nex3/haml/blob/master/extra/sass-mode.el
+
+;;; Code:
+(require 'ob)
+
+(defvar org-babel-default-header-args:sass '())
+
+(defun org-babel-expand-body:sass (body params &optional processed-params)
+  "Expand BODY according to PARAMS, return the expanded body." body)
+
+(defun org-babel-execute:sass (body params)
+  "Execute a block of Sass code with Babel.
+This function is called by `org-babel-execute-src-block'."
+  (let* ((result-params (split-string (or (cdr (assoc :results params)) "")))
+         (file (cdr (assoc :file params)))
+         (out-file (or file (make-temp-file "org-babel-sass-out")))
+         (cmdline (cdr (assoc :cmdline params)))
+         (in-file (make-temp-file "org-babel-sass-in"))
+         (cmd (concat "sass " (or cmdline "") in-file " " out-file)))
+    (with-temp-file in-file
+      (insert (org-babel-expand-body:sass body params))) (shell-command cmd)
+    (or file (with-temp-buffer (insert-file-contents out-file) (buffer-string)))))
+
+(defun org-babel-prep-session:sass (session params)
+  "Raise an error because sass does not support sessions."
+  (error "Sass does not support sessions"))
+
+(provide 'ob-sass)
+
+;; arch-tag: 2954b169-eef4-45ce-a8e5-3e619f0f07ac
+
+;;; ob-sass.el ends here
diff --git a/lisp/org/ob-screen.el b/lisp/org/ob-screen.el
new file mode 100644 (file)
index 0000000..7e575aa
--- /dev/null
@@ -0,0 +1,154 @@
+;;; ob-screen.el --- org-babel support for interactive terminal
+
+;; Copyright (C) 2009, 2010  Free Software Foundation
+
+;; Author: Benjamin Andresen
+;; Keywords: literate programming, interactive shell
+;; Homepage: http://orgmode.org
+;; Version: 7.01
+
+;; 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:
+
+;; Org-Babel support for interactive terminals. Mostly shell scripts.
+;; Heavily inspired by 'eev' from Eduardo Ochs
+;;
+;; Adding :cmd and :terminal as header arguments
+;; :terminal must support the -T (title) and -e (command) parameter
+;;
+;; You can test the default setup. (xterm + sh) with
+;; M-x org-babel-screen-test RET
+
+;;; Code:
+(require 'ob)
+(require 'ob-ref)
+
+(defvar org-babel-screen-location "screen"
+  "The command location for screen. 
+In case you want to use a different screen than one selected by your $PATH")
+
+(defvar org-babel-default-header-args:screen
+  '((:results . "silent") (:session . "default") (:cmd . "sh") (:terminal . "xterm"))
+  "Default arguments to use when running screen source blocks.")
+
+(defun org-babel-expand-body:screen (body params &optional processed-params)
+  "Expand BODY according to PARAMS, return the expanded body." body)
+
+(defun org-babel-execute:screen (body params)
+  "Send a block of code via screen to a terminal using Babel.
+\"default\" session is be used when none is specified."
+  (message "Sending source code block to interactive terminal session...")
+  (save-window-excursion
+    (let* ((processed-params (org-babel-process-params params))
+           (session (nth 0 processed-params))
+           (socket (org-babel-screen-session-socketname session)))
+      (unless socket (org-babel-prep-session:screen session params))
+      (org-babel-screen-session-execute-string
+       session (org-babel-expand-body:screen body params)))))
+
+(defun org-babel-prep-session:screen (session params)
+  "Prepare SESSION according to the header arguments specified in PARAMS."
+  (let* ((processed-params (org-babel-process-params params))
+         (session (nth 0 processed-params))
+         (vars (nth 1 processed-params))
+         (socket (org-babel-screen-session-socketname session))
+         (vars (org-babel-ref-variables params))
+         (cmd (cdr (assoc :cmd params)))
+         (terminal (cdr (assoc :terminal params)))
+         (process-name (concat "org-babel: terminal (" session ")")))
+    (apply 'start-process process-name "*Messages*"
+           terminal `("-T" ,(concat "org-babel: " session) "-e" ,org-babel-screen-location
+                           "-c" "/dev/null" "-mS" ,(concat "org-babel-session-" session)
+                           ,cmd))
+    ;; XXX: Is there a better way than the following?
+    (while (not (org-babel-screen-session-socketname session))
+      ;; wait until screen session is available before returning
+      )))
+
+;; helper functions
+
+(defun org-babel-screen-session-execute-string (session body)
+  "If SESSION exists, send BODY to it."
+  (let ((socket (org-babel-screen-session-socketname session)))
+    (when socket
+      (let ((tmpfile (org-babel-screen-session-write-temp-file session body)))
+        (apply 'start-process (concat "org-babel: screen (" session ")") "*Messages*"
+               org-babel-screen-location
+               `("-S" ,socket "-X" "eval" "msgwait 0"
+                      ,(concat "readreg z " tmpfile)
+                      "paste z"))))))
+
+(defun org-babel-screen-session-socketname (session)
+  "Check if SESSION exists by parsing output of \"screen -ls\"."
+  (let* ((screen-ls (shell-command-to-string "screen -ls"))
+         (sockets (delq
+                  nil
+                   (mapcar
+                   (lambda (x)
+                     (when (string-match (rx (or "(Attached)" "(Detached)")) x)
+                       x))
+                   (split-string screen-ls "\n"))))
+         (match-socket (car
+                       (delq
+                        nil
+                        (mapcar
+                         (lambda (x)
+                           (when (string-match
+                                  (concat "org-babel-session-" session) x)
+                             x))
+                         sockets)))))
+    (when match-socket (car (split-string match-socket)))))
+
+(defun org-babel-screen-session-write-temp-file (session body)
+  "Save BODY in a temp file that is named after SESSION."
+  (let ((tmpfile (concat "/tmp/screen.org-babel-session-" session)))
+    (with-temp-file tmpfile
+      (insert body)
+
+      ;; org-babel has superflous spaces
+      (goto-char (point-min))
+      (delete-matching-lines "^ +$"))
+    tmpfile))
+
+(defun org-babel-screen-test ()
+  "Test if the default setup works.
+The terminal should shortly flicker."
+  (interactive)
+  (let* ((session "org-babel-testing")
+         (random-string (format "%s" (random 99999)))
+         (tmpfile "/tmp/org-babel-screen.test")
+         (body (concat "echo '" random-string "' > " tmpfile "\nexit\n"))
+         process tmp-string)
+    (org-babel-execute:screen body org-babel-default-header-args:screen)
+    ;; XXX: need to find a better way to do the following
+    (while (not (file-readable-p tmpfile))
+      ;; do something, otherwise this will be optimized away
+      (format "org-babel-screen: File not readable yet."))
+    (setq tmp-string (with-temp-buffer
+                       (insert-file-contents-literally tmpfile)
+                       (buffer-substring (point-min) (point-max))))
+    (delete-file tmpfile)
+    (message (concat "org-babel-screen: Setup "
+                     (if (string-match random-string tmp-string)
+                         "WORKS."
+                         "DOESN'T work.")))))
+
+(provide 'ob-screen)
+
+;; arch-tag: 908e5afe-89a0-4f27-b982-23f1f2e3bac9
+
+;;; ob-screen.el ends here
diff --git a/lisp/org/ob-sh.el b/lisp/org/ob-sh.el
new file mode 100644 (file)
index 0000000..072bc91
--- /dev/null
@@ -0,0 +1,185 @@
+;;; ob-sh.el --- org-babel functions for shell evaluation
+
+;; Copyright (C) 2009, 2010  Free Software Foundation, Inc.
+
+;; Author: Eric Schulte
+;; Keywords: literate programming, reproducible research
+;; Homepage: http://orgmode.org
+;; Version: 7.01
+
+;; 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:
+
+;; Org-Babel support for evaluating shell source code.
+
+;;; Code:
+(require 'ob)
+(require 'ob-comint)
+(require 'ob-eval)
+(require 'shell)
+(eval-when-compile (require 'cl))
+
+(declare-function org-babel-ref-variables "ob-ref" (params))
+(declare-function orgtbl-to-generic "org-table" (table params))
+
+(defvar org-babel-default-header-args:sh '())
+
+(defvar org-babel-sh-command "sh"
+  "Command used to invoke a shell.
+This will be passed to  `shell-command-on-region'")
+
+(defun org-babel-expand-body:sh (body params &optional processed-params)
+  "Expand BODY according to PARAMS, return the expanded body."
+  (let ((vars (nth 1 (or processed-params (org-babel-process-params params))))
+        (sep (cdr (assoc :separator params))))
+    (concat
+   (mapconcat ;; define any variables
+    (lambda (pair)
+      (format "%s=%s"
+              (car pair)
+              (org-babel-sh-var-to-sh (cdr pair) sep)))
+    vars "\n") "\n" body "\n\n")))
+
+(defun org-babel-execute:sh (body params)
+  "Execute a block of Shell commands with Babel.
+This function is called by `org-babel-execute-src-block'."
+  (let* ((processed-params (org-babel-process-params params))
+         (session (org-babel-sh-initiate-session (nth 0 processed-params)))
+         (result-params (nth 2 processed-params)) 
+         (full-body (org-babel-expand-body:sh
+                     body params processed-params)))
+    (org-babel-reassemble-table
+     (org-babel-sh-evaluate session full-body result-params)
+     (org-babel-pick-name
+      (nth 4 processed-params) (cdr (assoc :colnames params)))
+     (org-babel-pick-name
+      (nth 5 processed-params) (cdr (assoc :rownames params))))))
+
+(defun org-babel-prep-session:sh (session params)
+  "Prepare SESSION according to the header arguments specified in PARAMS."
+  (let* ((session (org-babel-sh-initiate-session session))
+         (vars (org-babel-ref-variables params))
+         (sep (cdr (assoc :separator params)))
+         (var-lines (mapcar ;; define any variables
+                     (lambda (pair)
+                       (format "%s=%s"
+                               (car pair)
+                               (org-babel-sh-var-to-sh (cdr pair) sep)))
+                     vars)))
+    (org-babel-comint-in-buffer session
+      (mapc (lambda (var)
+              (insert var) (comint-send-input nil t)
+              (org-babel-comint-wait-for-output session)) var-lines))
+    session))
+
+(defun org-babel-load-session:sh (session body params)
+  "Load BODY into SESSION."
+  (save-window-excursion
+    (let ((buffer (org-babel-prep-session:sh session params)))
+      (with-current-buffer buffer
+        (goto-char (process-mark (get-buffer-process (current-buffer))))
+        (insert (org-babel-chomp body)))
+      buffer)))
+
+;; helper functions
+
+(defun org-babel-sh-var-to-sh (var &optional sep)
+  "Convert an elisp value to a shell variable.
+Convert an elisp var into a string of shell commands specifying a
+var of the same value."
+  (if (listp var)
+      (flet ((deep-string (el)
+                          (if (listp el)
+                              (mapcar #'deep-string el)
+                           (org-babel-sh-var-to-sh el sep))))
+       (format "$(cat <<BABEL_TABLE\n%s\nBABEL_TABLE\n)"
+               (orgtbl-to-generic
+                (deep-string var) (list :sep (or sep "\t")))))
+    (if (stringp var)
+       (if (string-match "[\n\r]" var)
+           (format "$(cat <<BABEL_STRING\n%s\nBABEL_STRING\n)" var)
+         (format "%s" var))
+      (format "%S" var))))
+
+(defun org-babel-sh-table-or-results (results)
+  "Convert RESULTS to an appropriate elisp value.
+If the results look like a table, then convert them into an
+Emacs-lisp table, otherwise return the results as a string."
+  (org-babel-read
+   (if (string-match "^\\[.+\\]$" results)
+       (org-babel-read
+        (concat "'"
+                (replace-regexp-in-string
+                 "\\[" "(" (replace-regexp-in-string
+                            "\\]" ")" (replace-regexp-in-string
+                                       ", " " " (replace-regexp-in-string
+                                                 "'" "\"" results))))))
+     results)))
+
+(defun org-babel-sh-initiate-session (&optional session params)
+  "Initiate a session named SESSION according to PARAMS."
+  (when (and session (not (string= session "none")))
+    (save-window-excursion
+      (or (org-babel-comint-buffer-livep session)
+          (progn (shell session) (get-buffer (current-buffer)))))))
+
+(defvar org-babel-sh-eoe-indicator "echo 'org_babel_sh_eoe'"
+  "String to indicate that evaluation has completed.")
+(defvar org-babel-sh-eoe-output "org_babel_sh_eoe"
+  "String to indicate that evaluation has completed.")
+
+(defun org-babel-sh-evaluate (session body &optional result-params)
+  "Pass BODY to the Shell process in BUFFER.
+If RESULT-TYPE equals 'output then return a list of the outputs
+of the statements in BODY, if RESULT-TYPE equals 'value then
+return the value of the last statement in BODY."
+  ((lambda (results)
+     (if (or (member "scalar" result-params)
+            (member "output" result-params))
+        results
+       (let ((tmp-file (make-temp-file "org-babel-sh")))
+        (with-temp-file tmp-file (insert results))
+        (org-babel-import-elisp-from-file tmp-file))))
+   (if (not session)
+       (org-babel-eval org-babel-sh-command (org-babel-trim body))
+     (let ((tmp-file (make-temp-file "org-babel-sh")))
+       (mapconcat
+       #'org-babel-sh-strip-weird-long-prompt
+       (mapcar
+        #'org-babel-trim
+        (butlast
+         (org-babel-comint-with-output
+             (session org-babel-sh-eoe-output t body)
+           (mapc
+            (lambda (line)
+              (insert line) (comint-send-input nil t) (sleep-for 0.25))
+            (append
+             (split-string (org-babel-trim body) "\n")
+             (list org-babel-sh-eoe-indicator))))
+         2)) "\n")))))
+
+(defun org-babel-sh-strip-weird-long-prompt (string)
+  "Remove prompt cruft from a string of shell output."
+  (while (string-match "^% +[\r\n$]+ *" string)
+    (setq string (substring string (match-end 0))))
+  string)
+
+(provide 'ob-sh)
+
+;; arch-tag: 416dd531-c230-4b0a-a5bf-8d948f990f2d
+
+;;; ob-sh.el ends here
diff --git a/lisp/org/ob-sql.el b/lisp/org/ob-sql.el
new file mode 100644 (file)
index 0000000..184c755
--- /dev/null
@@ -0,0 +1,90 @@
+;;; ob-sql.el --- org-babel functions for sql evaluation
+
+;; Copyright (C) 2009, 2010  Free Software Foundation, Inc.
+
+;; Author: Eric Schulte
+;; Keywords: literate programming, reproducible research
+;; Homepage: http://orgmode.org
+;; Version: 7.01
+
+;; 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:
+
+;; Org-Babel support for evaluating sql source code.
+;;
+;; SQL is somewhat unique in that there are many different engines for
+;; the evaluation of sql (Mysql, PostgreSQL, etc...), so much of this
+;; file will have to be implemented engine by engine.
+;;
+;; Also SQL evaluation generally takes place inside of a database.
+;;
+;; For now lets just allow a generic ':cmdline' header argument.
+;;
+;; TODO:
+;;
+;; - support for sessions
+;; - add more useful header arguments (user, passwd, database, etc...)
+;; - support for more engines (currently only supports mysql)
+;; - what's a reasonable way to drop table data into SQL?
+;; 
+
+;;; Code:
+(require 'ob)
+(eval-when-compile (require 'cl))
+
+(declare-function org-table-import "org-table" (file arg))
+
+(defvar org-babel-default-header-args:sql '())
+
+(defun org-babel-expand-body:sql (body params &optional processed-params)
+  "Expand BODY according to PARAMS, return the expanded body." body)
+
+(defun org-babel-execute:sql (body params)
+  "Execute a block of Sql code with Babel.
+This function is called by `org-babel-execute-src-block'."
+  (let* ((result-params (split-string (or (cdr (assoc :results params)) "")))
+        (processed-params (org-babel-process-params params))
+         (cmdline (cdr (assoc :cmdline params)))
+         (engine (cdr (assoc :engine params)))
+         (in-file (make-temp-file "org-babel-sql-in"))
+         (out-file (or (cdr (assoc :out-file params))
+                       (make-temp-file "org-babel-sql-out")))
+         (command (case (intern engine)
+                    ('mysql (format "mysql %s -e \"source %s\" > %s"
+                                    (or cmdline "") in-file out-file))
+                    (t (error "no support for the %s sql engine" engine)))))
+    (with-temp-file in-file
+      (insert (org-babel-expand-body:sql body params)))
+    (message command)
+    (shell-command command)
+    (with-temp-buffer
+      (org-table-import out-file nil)
+      (org-babel-reassemble-table
+       (org-table-to-lisp)
+       (org-babel-pick-name (nth 4 processed-params) (cdr (assoc :colnames params)))
+       (org-babel-pick-name (nth 5 processed-params) (cdr (assoc :rownames params)))))))
+
+
+(defun org-babel-prep-session:sql (session params)
+  "Raise an error because Sql sessions aren't implemented."
+  (error "sql sessions not yet implemented"))
+
+(provide 'ob-sql)
+
+;; arch-tag: a43ff944-6de1-4566-a83c-626814e3dad2
+
+;;; ob-sql.el ends here
diff --git a/lisp/org/ob-sqlite.el b/lisp/org/ob-sqlite.el
new file mode 100644 (file)
index 0000000..7d6930a
--- /dev/null
@@ -0,0 +1,152 @@
+;;; ob-sqlite.el --- org-babel functions for sqlite database interaction
+
+;; Copyright (C) 2010  Free Software Foundation
+
+;; Author: Eric Schulte
+;; Keywords: literate programming, reproducible research
+;; Homepage: http://orgmode.org
+;; Version: 7.01
+
+;; 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:
+
+;; Org-Babel support for evaluating sqlite source code.
+
+;;; Code:
+(require 'ob)
+(require 'ob-ref)
+
+(declare-function org-fill-template "org" (template alist))
+(declare-function org-table-convert-region "org-table"
+                 (beg0 end0 &optional separator))
+(declare-function orgtbl-to-csv "org-table" (TABLE PARAMS))
+
+(defvar org-babel-default-header-args:sqlite '())
+
+(defvar org-babel-header-arg-names:sqlite
+  '(db header echo bail csv column html line list separator nullvalue)
+  "Sqlite specific header args.")
+
+(defun org-babel-expand-body:sqlite (body params &optional processed-params)
+  (org-babel-sqlite-expand-vars
+   body (or (nth 1 processed-params) (org-babel-ref-variables params))))
+
+(defvar org-babel-sqlite3-command "sqlite3")
+
+(defun org-babel-execute:sqlite (body params)
+  "Execute a block of Sqlite code with Babel.
+This function is called by `org-babel-execute-src-block'."
+  (let ((result-params (split-string (or (cdr (assoc :results params)) "")))
+       (vars (org-babel-ref-variables params))
+       (db (cdr (assoc :db params)))
+       (separator (cdr (assoc :separator params)))
+       (nullvalue (cdr (assoc :nullvalue params)))
+       (headers-p (equal "yes" (cdr (assoc :colnames params))))
+       (others (delq nil (mapcar
+                          (lambda (arg) (car (assoc arg params)))
+                          (list :header :echo :bail :column
+                                :csv :html :line :list))))
+       exit-code)
+    (unless db (error "ob-sqlite: can't evaluate without a database."))
+    (with-temp-buffer
+      (insert
+       (shell-command-to-string
+       (org-fill-template
+        "%cmd -init %body %header %separator %nullvalue %others %csv %db "
+        (list
+         (cons "body" ((lambda (sql-file)
+                         (with-temp-file sql-file
+                           (insert (org-babel-expand-body:sqlite
+                                    body nil (list nil vars))))
+                         sql-file)
+                       (make-temp-file "ob-sqlite-sql")))
+         (cons "cmd" org-babel-sqlite3-command)
+         (cons "header" (if headers-p "-header" "-noheader"))
+         (cons "separator"
+               (if separator (format "-separator %s" separator) ""))
+         (cons "nullvalue"
+               (if nullvalue (format "-nullvalue %s" nullvalue) ""))
+         (cons "others"
+               (mapconcat
+                (lambda (arg) (format "-%s" (substring (symbol-name arg) 1)))
+                others " "))
+         ;; for easy table parsing, default header type should be -csv
+         (cons "csv" (if (or (member :csv others) (member :column others)
+                             (member :line others) (member :list others)
+                             (member :html others) separator)
+                         ""
+                       "-csv"))
+         (cons "db " db)))))
+      (if (or (member "scalar" result-params)
+             (member "html" result-params)
+             (member "code" result-params)
+             (equal (point-min) (point-max)))
+         (buffer-string)
+       (org-table-convert-region (point-min) (point-max))
+       (org-babel-sqlite-table-or-scalar
+        (org-babel-sqlite-offset-colnames
+         (org-table-to-lisp) headers-p))))))
+
+(defun org-babel-sqlite-expand-vars (body vars)
+  "Expand the variables held in VARS in BODY."
+  (mapc
+   (lambda (pair)
+     (setq body
+          (replace-regexp-in-string
+           (format "\$%s" (car pair))
+           ((lambda (val)
+              (if (listp val)
+                  ((lambda (data-file)
+                     (with-temp-file data-file
+                       (insert (orgtbl-to-csv
+                                val '(:fmt (lambda (el) (if (stringp el)
+                                                       el
+                                                     (format "%S" el)))))))
+                     data-file)
+                   (make-temp-file "ob-sqlite-data"))
+                (format "%S" val)))
+            (cdr pair))
+           body)))
+   vars)
+  body)
+
+(defun org-babel-sqlite-table-or-scalar (result)
+  "If RESULT looks like a trivial table, then unwrap it."
+  (if (and (equal 1 (length result))
+          (equal 1 (length (car result))))
+      (org-babel-read (caar result))
+    (mapcar (lambda (row)
+             (if (equal 'hline row)
+                 'hline
+               (mapcar #'org-babel-read row))) result)))
+
+(defun org-babel-sqlite-offset-colnames (table headers-p)
+  "If HEADERS-P is non-nil then offset the first row as column names."
+  (if headers-p
+      (cons (car table) (cons 'hline (cdr table)))
+    table))
+
+(defun org-babel-prep-session:sqlite (session params)
+  "Raise an error because support for sqlite sessions isn't implemented.
+Prepare SESSION according to the header arguments specified in PARAMS."
+  (error "sqlite sessions not yet implemented"))
+
+(provide 'ob-sqlite)
+
+;; arch-tag: 5c03d7f2-0f72-48b8-bbd1-35aafea248ac
+
+;;; ob-sqlite.el ends here
diff --git a/lisp/org/ob-table.el b/lisp/org/ob-table.el
new file mode 100644 (file)
index 0000000..f150655
--- /dev/null
@@ -0,0 +1,109 @@
+;;; ob-table.el --- support for calling org-babel functions from tables
+
+;; Copyright (C) 2009, 2010  Free Software Foundation, Inc.
+
+;; Author: Eric Schulte
+;; Keywords: literate programming, reproducible research
+;; Homepage: http://orgmode.org
+;; Version: 7.01
+
+;; 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:
+
+;; Should allow calling functions from org-mode tables using the
+;; function `sbe' as so...
+
+;; #+begin_src emacs-lisp :results silent
+;;   (defun fibbd (n) (if (< n 2) 1 (+ (fibbd (- n 1)) (fibbd (- n 2)))))
+;; #+end_src
+
+;; #+srcname: fibbd
+;; #+begin_src emacs-lisp :var n=2 :results silent
+;; (fibbd n)
+;; #+end_src
+
+;; | original | fibbd  |
+;; |----------+--------|
+;; |        0 |        |
+;; |        1 |        |
+;; |        2 |        |
+;; |        3 |        |
+;; |        4 |        |
+;; |        5 |        |
+;; |        6 |        |
+;; |        7 |        |
+;; |        8 |        |
+;; |        9 |        |
+;; #+TBLFM: $2='(sbe 'fibbd (n $1))
+
+;;; Code:
+(require 'ob)
+
+(defun org-babel-table-truncate-at-newline (string)
+  "Replace newline character with ellipses.
+If STRING ends in a newline character, then remove the newline
+character and replace it with ellipses."
+  (if (and (stringp string) (string-match "[\n\r]" string))
+      (concat (substring string 0 (match-beginning 0)) "...")
+    string))
+
+(defmacro sbe (source-block &rest variables)
+  "Return the results of calling SOURCE-BLOCK with VARIABLES.
+Each element of VARIABLES should be a two
+element list, whose first element is the name of the variable and
+second element is a string of its value.  The following call to
+`sbe' would be equivalent to the following source code block.
+
+ (sbe 'source-block (n $2) (m 3))
+
+#+begin_src emacs-lisp :var results=source-block(n=val_at_col_2, m=3) :results silent
+results
+#+end_src
+
+NOTE: by default string variable names are interpreted as
+references to source-code blocks, to force interpretation of a
+cell's value as a string, prefix the identifier with two \"$\"s
+rather than a single \"$\" (i.e. \"$$2\" instead of \"$2\" in the
+example above."
+  (let ((variables (mapcar
+                    (lambda (var)
+                      (if (and (= 3 (length var)) (eq (nth 1 var) '$))
+                          (list (car var) (format "\"%s\"" (last var)))
+                        var))
+                    variables)))
+    (unless (stringp source-block) (setq source-block (symbol-name source-block)))
+    (org-babel-table-truncate-at-newline ;; org-table cells can't be multi-line
+     (if (and source-block (> (length source-block) 0))
+         (let ((params
+                (eval `(org-babel-parse-header-arguments
+                        (concat ":var results="
+                                ,source-block
+                                "("
+                                (mapconcat (lambda (var-spec)
+                                             (format "%S=%s" (nth 0 var-spec) (nth 1 var-spec)))
+                                           ',variables ", ")
+                                ")")))))
+           (org-babel-execute-src-block
+            nil (list "emacs-lisp" "results"
+                      (org-babel-merge-params '((:results . "silent")) params))))
+       ""))))
+
+(provide 'ob-table)
+
+;; arch-tag: 4234cc7c-4fc8-4e92-abb0-2892de1a493b
+
+;;; ob-table.el ends here
diff --git a/lisp/org/ob-tangle.el b/lisp/org/ob-tangle.el
new file mode 100644 (file)
index 0000000..85f69ed
--- /dev/null
@@ -0,0 +1,300 @@
+;;; ob-tangle.el --- extract source code from org-mode files
+
+;; Copyright (C) 2009, 2010  Free Software Foundation, Inc.
+
+;; Author: Eric Schulte
+;; Keywords: literate programming, reproducible research
+;; Homepage: http://orgmode.org
+;; Version: 7.01
+
+;; 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:
+
+;; Extract the code from source blocks out into raw source-code files.
+
+;;; Code:
+(require 'ob)
+(require 'org-src)
+(eval-when-compile
+  (require 'cl))
+
+(declare-function org-link-escape "org" (text &optional table))
+(declare-function org-heading-components "org" ())
+
+(defcustom org-babel-tangle-lang-exts
+  '(("emacs-lisp" . "el"))
+  "Alist mapping languages to their file extensions.
+The key is the language name, the value is the string that should
+be inserted as the extension commonly used to identify files
+written in this language.  If no entry is found in this list,
+then the name of the language is used."
+  :group 'org-babel-tangle
+  :type '(repeat
+         (cons
+          (string "Language name")
+          (string "File Extension"))))
+
+(defcustom org-babel-post-tangle-hook nil
+  "Hook run in code files tangled by `org-babel-tangle'."
+  :group 'org-babel
+  :type 'hook)
+
+(defmacro org-babel-with-temp-filebuffer (file &rest body)
+  "Open FILE into a temporary buffer execute BODY there like
+`progn', then kill the FILE buffer returning the result of
+evaluating BODY."
+  (declare (indent 1))
+  (let ((temp-result (make-symbol "temp-result"))
+       (temp-file (make-symbol "temp-file")))
+    `(let (,temp-result ,temp-file)
+       (find-file ,file)
+       (setf ,temp-file (current-buffer))
+       (setf ,temp-result (progn ,@body))
+       (kill-buffer ,temp-file)
+       ,temp-result)))
+
+;;;###autoload
+(defun org-babel-load-file (file)
+  "Load Emacs Lisp source code blocks in the Org-mode FILE.
+This function exports the source code using
+`org-babel-tangle' and then loads the resulting file using
+`load-file'."
+  (flet ((age (file)
+              (float-time
+               (time-subtract (current-time)
+                              (nth 5 (or (file-attributes (file-truename file))
+                                         (file-attributes file)))))))
+    (let* ((base-name (file-name-sans-extension file))
+           (exported-file (concat base-name ".el")))
+      ;; tangle if the org-mode file is newer than the elisp file
+      (unless (and (file-exists-p exported-file)
+                  (> (age file) (age exported-file)))
+        (org-babel-tangle-file file exported-file "emacs-lisp"))
+      (load-file exported-file)
+      (message "loaded %s" exported-file))))
+
+;;;###autoload
+(defun org-babel-tangle-file (file &optional target-file lang)
+  "Extract the bodies of source code blocks in FILE.
+Source code blocks are extracted with `org-babel-tangle'.
+Optional argument TARGET-FILE can be used to specify a default
+export file for all source blocks.  Optional argument LANG can be
+used to limit the exported source code blocks by language."
+  (interactive "fFile to tangle: \nP")
+  (let ((visited-p (get-file-buffer (expand-file-name file)))
+       to-be-removed)
+    (save-window-excursion
+      (find-file file)
+      (setq to-be-removed (current-buffer))
+      (org-babel-tangle target-file lang))
+    (unless visited-p
+      (kill-buffer to-be-removed))))
+
+(defun org-babel-tangle-publish (_ filename pub-dir)
+  "Tangle FILENAME and place the results in PUB-DIR."
+  (mapc (lambda (el) (copy-file el pub-dir t)) (org-babel-tangle-file filename)))
+
+;;;###autoload
+(defun org-babel-tangle (&optional target-file lang)
+  "Write code blocks to source-specific files.
+Extract the bodies of all source code blocks from the current
+file into their own source-specific files.  Optional argument
+TARGET-FILE can be used to specify a default export file for all
+source blocks.  Optional argument LANG can be used to limit the
+exported source code blocks by language."
+  (interactive)
+  (save-buffer)
+  (save-excursion
+    (let ((block-counter 0)
+         (org-babel-default-header-args
+          (if target-file
+              (org-babel-merge-params org-babel-default-header-args
+                                      (list (cons :tangle target-file)))
+            org-babel-default-header-args))
+          path-collector)
+      (mapc ;; map over all languages
+       (lambda (by-lang)
+         (let* ((lang (car by-lang))
+                (specs (cdr by-lang))
+               (ext (or (cdr (assoc lang org-babel-tangle-lang-exts)) lang))
+                (lang-f (intern
+                        (concat
+                         (or (and (cdr (assoc lang org-src-lang-modes))
+                                  (symbol-name
+                                   (cdr (assoc lang org-src-lang-modes))))
+                             lang)
+                         "-mode")))
+                she-banged)
+           (mapc
+            (lambda (spec)
+              (flet ((get-spec (name)
+                               (cdr (assoc name (nth 2 spec)))))
+                (let* ((tangle (get-spec :tangle))
+                       (she-bang ((lambda (sheb) (when (> (length sheb) 0) sheb))
+                                 (get-spec :shebang)))
+                       (base-name (cond
+                                  ((string= "yes" tangle)
+                                   (file-name-sans-extension
+                                    (buffer-file-name)))
+                                  ((string= "no" tangle) nil)
+                                  ((> (length tangle) 0) tangle)))
+                       (file-name (when base-name
+                                    ;; decide if we want to add ext to base-name
+                                    (if (and ext (string= "yes" tangle))
+                                        (concat base-name "." ext) base-name))))
+                  (when file-name
+                    ;; delete any old versions of file
+                    (when (and (file-exists-p file-name)
+                               (not (member file-name path-collector)))
+                      (delete-file file-name))
+                    ;; drop source-block to file
+                    (with-temp-buffer
+                      (when (fboundp lang-f) (funcall lang-f))
+                      (when (and she-bang (not (member file-name she-banged)))
+                        (insert (concat she-bang "\n"))
+                        (setq she-banged (cons file-name she-banged)))
+                      (org-babel-spec-to-string spec)
+                     ;; We avoid append-to-file as it does not work with tramp.
+                     (let ((content (buffer-string)))
+                       (with-temp-buffer
+                         (if (file-exists-p file-name)
+                             (insert-file-contents file-name))
+                         (goto-char (point-max))
+                         (insert content)
+                         (write-region nil nil file-name))))
+                   ;; if files contain she-bangs, then make the executable
+                   (when she-bang (set-file-modes file-name ?\755))
+                    ;; update counter
+                    (setq block-counter (+ 1 block-counter))
+                    (add-to-list 'path-collector file-name)))))
+            specs)))
+       (org-babel-tangle-collect-blocks lang))
+      (message "tangled %d code block%s" block-counter
+               (if (= block-counter 1) "" "s"))
+      ;; run `org-babel-post-tangle-hook' in all tangled files
+      (when org-babel-post-tangle-hook
+       (mapc
+        (lambda (file)
+          (org-babel-with-temp-filebuffer file
+            (run-hooks 'org-babel-post-tangle-hook)))
+        path-collector))
+      path-collector)))
+
+(defun org-babel-tangle-clean ()
+  "Remove comments inserted by `org-babel-tangle'.
+Call this function inside of a source-code file generated by
+`org-babel-tangle' to remove all comments inserted automatically
+by `org-babel-tangle'.  Warning, this comment removes any lines
+containing constructs which resemble org-mode file links or noweb
+references."
+  (interactive)
+  (goto-char (point-min))
+  (while (or (re-search-forward "\\[\\[file:.*\\]\\[.*\\]\\]" nil t)
+             (re-search-forward "<<[^[:space:]]*>>" nil t))
+    (delete-region (save-excursion (beginning-of-line 1) (point))
+                   (save-excursion (end-of-line 1) (forward-char 1) (point)))))
+
+(defvar org-stored-links)
+(defun org-babel-tangle-collect-blocks (&optional lang)
+  "Collect source blocks in the current Org-mode file.
+Return an association list of source-code block specifications of
+the form used by `org-babel-spec-to-string' grouped by language.
+Optional argument LANG can be used to limit the collected source
+code blocks by language."
+  (let ((block-counter 1) (current-heading "") blocks)
+    (org-babel-map-src-blocks (buffer-file-name)
+      ((lambda (new-heading)
+        (if (not (string= new-heading current-heading))
+            (progn
+              (setq block-counter 1)
+              (setq current-heading new-heading))
+          (setq block-counter (+ 1 block-counter))))
+       (replace-regexp-in-string "[ \t]" "-"
+                                (nth 4 (org-heading-components))))
+      (let* ((link (progn (call-interactively 'org-store-link)
+                          (org-babel-clean-text-properties
+                          (car (pop org-stored-links)))))
+             (info (org-babel-get-src-block-info))
+             (source-name (intern (or (nth 4 info)
+                                      (format "%s:%d"
+                                             current-heading block-counter))))
+             (src-lang (nth 0 info))
+            (expand-cmd (intern (concat "org-babel-expand-body:" src-lang)))
+             (params (nth 2 info))
+             by-lang)
+        (unless (string= (cdr (assoc :tangle params)) "no") ;; skip
+          (unless (and lang (not (string= lang src-lang))) ;; limit by language
+            ;; add the spec for this block to blocks under it's language
+            (setq by-lang (cdr (assoc src-lang blocks)))
+            (setq blocks (delq (assoc src-lang blocks) blocks))
+            (setq blocks
+                  (cons
+                   (cons src-lang
+                         (cons (list link source-name params
+                                     ((lambda (body)
+                                        (if (assoc :no-expand params)
+                                            body
+                                          (funcall
+                                          (if (fboundp expand-cmd)
+                                              expand-cmd
+                                            'org-babel-expand-body:generic)
+                                           body
+                                           params)))
+                                      (if (and (cdr (assoc :noweb params))
+                                               (string=
+                                               "yes"
+                                               (cdr (assoc :noweb params))))
+                                          (org-babel-expand-noweb-references
+                                          info)
+                                       (nth 1 info))))
+                               by-lang)) blocks))))))
+    ;; ensure blocks in the correct order
+    (setq blocks
+          (mapcar
+          (lambda (by-lang) (cons (car by-lang) (reverse (cdr by-lang))))
+          blocks))
+    blocks))
+
+(defun org-babel-spec-to-string (spec)
+  "Insert SPEC into the current file.
+Insert the source-code specified by SPEC into the current
+source code file.  This function uses `comment-region' which
+assumes that the appropriate major-mode is set.  SPEC has the
+form
+
+  (link source-name params body)"
+  (let ((link (nth 0 spec))
+       (source-name (nth 1 spec))
+       (body (nth 3 spec))
+       (commentable (string= (cdr (assoc :comments (nth 2 spec))) "yes")))
+    (flet ((insert-comment (text)
+                          (when commentable
+                            (insert "\n")
+                            (comment-region (point)
+                                            (progn (insert text) (point)))
+                            (end-of-line nil)
+                            (insert "\n"))))
+      (insert-comment (format "[[%s][%s]]" (org-link-escape link) source-name))
+      (insert (format "\n%s\n" (replace-regexp-in-string
+                               "^," "" (org-babel-chomp body))))
+      (insert-comment (format "%s ends here" source-name)))))
+
+(provide 'ob-tangle)
+
+;; arch-tag: 413ced93-48f5-4216-86e4-3fc5df8c8f24
+
+;;; ob-tangle.el ends here
diff --git a/lisp/org/ob.el b/lisp/org/ob.el
new file mode 100644 (file)
index 0000000..a58fb4e
--- /dev/null
@@ -0,0 +1,1592 @@
+;;; ob.el --- working with code blocks in org-mode
+
+;; Copyright (C) 2009, 2010  Free Software Foundation, Inc.
+
+;; Author: Eric Schulte, Dan Davison
+;; Keywords: literate programming, reproducible research
+;; Homepage: http://orgmode.org
+;; Version: 7.01
+
+;; 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:
+
+;; See the online documentation for more information
+;;
+;;   http://orgmode.org/worg/org-contrib/babel/
+
+;;; Code:
+(eval-when-compile
+  (require 'cl))
+(require 'org-macs)
+
+(defvar org-babel-call-process-region-original)
+(declare-function show-all "outline" ())
+(declare-function tramp-compat-make-temp-file "tramp-compat"
+                  (filename &optional dir-flag))
+(declare-function tramp-dissect-file-name "tramp" (name &optional nodefault))
+(declare-function tramp-file-name-user "tramp" (vec))
+(declare-function tramp-file-name-host "tramp" (vec))
+(declare-function org-icompleting-read "org" (&rest args))
+(declare-function org-edit-src-code "org-src"
+                  (&optional context code edit-buffer-name))
+(declare-function org-open-at-point "org" (&optional in-emacs reference-buffer))
+(declare-function org-narrow-to-subtree "org" ())
+(declare-function org-entry-get "org" (pom property &optional inherit literal-nil))
+(declare-function org-make-options-regexp "org" (kwds &optional extra))
+(declare-function org-do-remove-indentation "org" (&optional n))
+(declare-function org-show-context "org" (&optional key))
+(declare-function org-at-table-p "org" (&optional table-type))
+(declare-function org-cycle "org" (&optional arg))
+(declare-function org-uniquify "org" (list))
+(declare-function org-table-import "org-table" (file arg))
+(declare-function org-add-hook "org-compat" (hook function &optional append local))
+(declare-function org-table-align "org-table" ())
+(declare-function org-table-end "org-table" (&optional table-type))
+(declare-function orgtbl-to-generic "org-table" (table params))
+(declare-function orgtbl-to-orgtbl "org-table" (table params))
+(declare-function org-babel-lob-get-info "ob-lob" nil)
+(declare-function org-babel-ref-split-args "ob-ref" (arg-string))
+(declare-function org-babel-ref-variables "ob-ref" (params))
+(declare-function org-babel-ref-resolve-reference "ob-ref" (ref &optional params))
+
+(defgroup org-babel nil
+  "Code block evaluation and management in `org-mode' documents."
+  :tag "Babel"
+  :group 'org)
+
+(defcustom org-confirm-babel-evaluate t
+  "Confirm before evaluation.
+Require confirmation before interactively evaluating code
+blocks in Org-mode buffers.  The default value of this variable
+is t, meaning confirmation is required for any code block
+evaluation.  This variable can be set to nil to inhibit any
+future confirmation requests.  This variable can also be set to a
+function which takes two arguments the language of the code block
+and the body of the code block.  Such a function should then
+return a non-nil value if the user should be prompted for
+execution or nil if no prompt is required.
+
+Warning: Disabling confirmation may result in accidental
+evaluation of potentially harmful code.  It may be advisable
+remove code block execution from C-c C-c as further protection
+against accidental code block evaluation.  The
+`org-babel-no-eval-on-ctrl-c-ctrl-c' variable can be used to
+remove code block execution from the C-c C-c keybinding."
+    :group 'org-babel
+    :type '(choice boolean function))
+;; don't allow this variable to be changed through file settings
+(put 'org-confirm-babel-evaluate 'safe-local-variable (lambda (x) (eq x t)))
+
+(defcustom org-babel-no-eval-on-ctrl-c-ctrl-c nil
+  "Remove code block evaluation from the C-c C-c key binding."
+  :group 'org-babel
+  :type 'boolean)
+
+(defvar org-babel-src-name-regexp
+  "^[ \t]*#\\+\\(srcname\\|source\\|function\\):[ \t]*"
+  "Regular expression used to match a source name line.")
+
+(defvar org-babel-src-name-w-name-regexp
+  (concat org-babel-src-name-regexp
+         "\\([^ ()\f\t\n\r\v]+\\)\\(\(\\(.*\\)\)\\|\\)")
+  "Regular expression matching source name lines with a name.")
+
+(defvar org-babel-src-block-regexp
+  (concat
+   ;; (1) indentation                     (2) lang
+   "^\\([ \t]*\\)#\\+begin_src[ \t]+\\([^ \f\t\n\r\v]+\\)[ \t]*"
+   ;; (3) switches
+   "\\([^\":\n]*\"[^\"\n*]*\"[^\":\n]*\\|[^\":\n]*\\)"
+   ;; (4) header arguments
+   "\\([^\n]*\\)\n"
+   ;; (5) body
+   "\\([^\000]+?\n\\)[ \t]*#\\+end_src")
+  "Regexp used to identify code blocks.")
+
+(defvar org-babel-inline-src-block-regexp
+  (concat
+   ;; (1) replacement target (2) lang
+   "[ \f\t\n\r\v]\\(src_\\([^ \f\t\n\r\v]+\\)"
+   ;; (3,4) (unused, headers)
+   "\\(\\|\\[\\(.*?\\)\\]\\)"
+   ;; (5) body
+   "{\\([^\f\n\r\v]+?\\)}\\)")
+  "Regexp used to identify inline src-blocks.")
+
+(defun org-babel-get-src-block-info (&optional header-vars-only)
+  "Get information on the current source block.
+
+Returns a list
+ (language body header-arguments-alist switches name function-args indent).
+Unless HEADER-VARS-ONLY is non-nil, any variable
+references provided in 'function call style' (i.e. in a
+parenthesised argument list following the src block name) are
+added to the header-arguments-alist."
+  (let ((case-fold-search t) head info args indent)
+    (if (setq head (org-babel-where-is-src-block-head))
+        (save-excursion
+         (goto-char head)
+         (setq info (org-babel-parse-src-block-match))
+         (setq indent (car (last info)))
+         (setq info (butlast info))
+         (forward-line -1)
+         (if (and (looking-at org-babel-src-name-w-name-regexp)
+                  (match-string 2))
+             (progn
+               (setq info (append info (list (org-babel-clean-text-properties
+                                              (match-string 2)))))
+               ;; Note that e.g. "name()" and "name( )" result in
+               ;; ((:var . "")).  We maintain that behaviour, and the
+               ;; resulting non-nil sixth element is relied upon in
+               ;; org-babel-exp-code to detect a functional-style
+               ;; block in those cases. However, "name" without any
+               ;; parentheses would result in the same thing, so we
+               ;; explicitly avoid that.
+               (if (setq args (match-string 4))
+                   (setq info
+                         (append info (list
+                                       (mapcar
+                                        (lambda (ref) (cons :var ref))
+                                        (org-babel-ref-split-args args))))))
+               (unless header-vars-only
+                 (setf (nth 2 info)
+                       (org-babel-merge-params (nth 5 info) (nth 2 info)))))
+           (setq info (append info (list nil nil))))
+         (append info (list indent)))
+      (if (save-excursion ;; inline source block
+            (re-search-backward "[ \f\t\n\r\v]" nil t)
+            (looking-at org-babel-inline-src-block-regexp))
+          (org-babel-parse-inline-src-block-match)
+        nil))))
+
+(defun org-babel-confirm-evaluate (info)
+  "Confirm evaluation of the code block INFO.
+This behavior can be suppressed by setting the value of
+`org-confirm-babel-evaluate' to nil, in which case all future
+interactive code block evaluations will proceed without any
+confirmation from the user.
+
+Note disabling confirmation may result in accidental evaluation
+of potentially harmful code."
+  (let* ((eval (cdr (assoc :eval (nth 2 info))))
+        (query (or (equal eval "query")
+                   (and (functionp org-confirm-babel-evaluate)
+                        (funcall org-confirm-babel-evaluate
+                                 (nth 0 info) (nth 1 info)))
+                   org-confirm-babel-evaluate)))
+    (when (or (equal eval "never")
+             (and query
+                  (not (yes-or-no-p
+                        (format "Evaluate this%scode on your system? "
+                                (if info (format " %s " (nth 0 info)) " "))))))
+      (error "evaluation aborted"))))
+
+;;;###autoload
+(defun org-babel-execute-src-block-maybe ()
+  "Conditionally execute a source block.
+Detect if this is context for a Babel src-block and if so
+then run `org-babel-execute-src-block'."
+  (interactive)
+  (if (not org-babel-no-eval-on-ctrl-c-ctrl-c)
+      (let ((info (org-babel-get-src-block-info)))
+       (if info
+           (progn (org-babel-execute-src-block current-prefix-arg info) t) nil))
+    nil))
+(add-hook 'org-ctrl-c-ctrl-c-hook 'org-babel-execute-src-block-maybe)
+
+;;;###autoload
+(defun org-babel-expand-src-block-maybe ()
+  "Conditionally expand a source block.
+Detect if this is context for a org-babel src-block and if so
+then run `org-babel-expand-src-block'."
+  (interactive)
+  (let ((info (org-babel-get-src-block-info)))
+    (if info
+       (progn (org-babel-expand-src-block current-prefix-arg info) t)
+      nil)))
+
+;;;###autoload
+(defun org-babel-load-in-session-maybe ()
+  "Conditionally load a source block in a session.
+Detect if this is context for a org-babel src-block and if so
+then run `org-babel-load-in-session'."
+  (interactive)
+  (let ((info (org-babel-get-src-block-info)))
+    (if info
+       (progn (org-babel-load-in-session current-prefix-arg info) t)
+      nil)))
+
+(add-hook 'org-metaup-hook 'org-babel-load-in-session-maybe)
+
+;;;###autoload
+(defun org-babel-pop-to-session-maybe ()
+  "Conditionally pop to a session.
+Detect if this is context for a org-babel src-block and if so
+then run `org-babel-pop-to-session'."
+  (interactive)
+  (let ((info (org-babel-get-src-block-info)))
+    (if info (progn (org-babel-pop-to-session current-prefix-arg info) t) nil)))
+
+(add-hook 'org-metadown-hook 'org-babel-pop-to-session-maybe)
+
+(defconst org-babel-header-arg-names
+  '(cache cmdline colnames dir exports file noweb results
+         session tangle var noeval comments)
+  "Common header arguments used by org-babel.
+Note that individual languages may define their own language
+specific header arguments as well.")
+
+(defvar org-babel-default-header-args
+  '((:session . "none") (:results . "replace") (:exports . "code")
+    (:cache . "no") (:noweb . "no") (:hlines . "no") (:tangle . "no"))
+  "Default arguments to use when evaluating a source block.")
+
+(defvar org-babel-default-inline-header-args
+  '((:session . "none") (:results . "silent") (:exports . "results"))
+  "Default arguments to use when evaluating an inline source block.")
+
+(defvar org-babel-current-buffer-properties)
+(make-variable-buffer-local 'org-babel-current-buffer-properties)
+
+(defvar org-babel-result-regexp
+  "^[ \t]*#\\+res\\(ults\\|name\\)\\(\\[\\([[:alnum:]]+\\)\\]\\)?\\:[ \t]*"
+  "Regular expression used to match result lines.
+If the results are associated with a hash key then the hash will
+be saved in the second match data.")
+
+(defvar org-babel-result-w-name-regexp
+  (concat org-babel-result-regexp
+         "\\([^ ()\f\t\n\r\v]+\\)\\(\(\\(.*\\)\)\\|\\)"))
+
+(defvar org-babel-min-lines-for-block-output 10
+  "The minimum number of lines for block output.
+If number of lines of output is equal to or exceeds this
+value, the output is placed in a #+begin_example...#+end_example
+block. Otherwise the output is marked as literal by inserting
+colons at the starts of the lines. This variable only takes
+effect if the :results output option is in effect.")
+
+(defvar org-babel-noweb-error-langs nil
+  "Languages for which Babel will raise literate programming errors.
+List of languages for which errors should be raised when the
+source code block satisfying a noweb reference in this language
+can not be resolved.")
+
+(defvar org-babel-hash-show 4
+  "Number of initial characters to show of a hidden results hash.")
+
+(defvar org-babel-after-execute-hook nil
+  "Hook for functions to be called after `org-babel-execute-src-block'")
+(defun org-babel-named-src-block-regexp-for-name (name)
+  "This generates a regexp used to match a src block named NAME."
+  (concat org-babel-src-name-regexp (regexp-quote name) "[ \t\n]*"
+         (substring org-babel-src-block-regexp 1)))
+
+;;; functions
+(defvar call-process-region)
+;;;###autoload
+(defun org-babel-execute-src-block (&optional arg info params)
+  "Execute the current source code block.
+Insert the results of execution into the buffer.  Source code
+execution and the collection and formatting of results can be
+controlled through a variety of header arguments.
+
+Optionally supply a value for INFO in the form returned by
+`org-babel-get-src-block-info'.
+
+Optionally supply a value for PARAMS which will be merged with
+the header arguments specified at the front of the source code
+block."
+  (interactive)
+  (let* ((info (or info (org-babel-get-src-block-info)))
+        ;; note the `evaluation-confirmed' variable is currently not
+        ;; used, but could be used later to avoid the need for
+        ;; chaining confirmations
+        (evaluation-confirmed (org-babel-confirm-evaluate info))
+         (lang (nth 0 info))
+        (params (setf (nth 2 info)
+                       (sort (org-babel-merge-params (nth 2 info) params)
+                             (lambda (el1 el2) (string< (symbol-name (car el1))
+                                                   (symbol-name (car el2)))))))
+         (new-hash
+          (if (and (cdr (assoc :cache params))
+                   (string= "yes" (cdr (assoc :cache params))))
+              (org-babel-sha1-hash info)))
+         (old-hash (org-babel-result-hash info))
+         (body (setf (nth 1 info)
+                    (if (and (cdr (assoc :noweb params))
+                              (string= "yes" (cdr (assoc :noweb params))))
+                         (org-babel-expand-noweb-references info)
+                      (nth 1 info))))
+         (result-params (split-string (or (cdr (assoc :results params)) "")))
+         (result-type (cond ((member "output" result-params) 'output)
+                           ((member "value" result-params) 'value)
+                           (t 'value)))
+         (cmd (intern (concat "org-babel-execute:" lang)))
+        (dir (cdr (assoc :dir params)))
+        (default-directory
+          (or (and dir (file-name-as-directory dir)) default-directory))
+        (org-babel-call-process-region-original
+         (if (boundp 'org-babel-call-process-region-original) org-babel-call-process-region-original
+           (symbol-function 'call-process-region)))
+        (indent (car (last info)))
+         result)
+    (unwind-protect
+        (flet ((call-process-region (&rest args)
+                 (apply 'org-babel-tramp-handle-call-process-region args)))
+          (unless (fboundp cmd)
+            (error "No org-babel-execute function for %s!" lang))
+          (if (and (not arg) new-hash (equal new-hash old-hash))
+              (save-excursion ;; return cached result
+                (goto-char (org-babel-where-is-src-block-result nil info))
+                (end-of-line 1) (forward-char 1)
+                (setq result (org-babel-read-result))
+                (message (replace-regexp-in-string "%" "%%"
+                                                   (format "%S" result))) result)
+            (message "executing %s code block%s..."
+                    (capitalize lang)
+                    (if (nth 4 info) (format " (%s)" (nth 4 info)) ""))
+           (setq result (funcall cmd body params))
+            (if (eq result-type 'value)
+                (setq result (if (and (or (member "vector" result-params)
+                                          (member "table" result-params))
+                                      (not (listp result)))
+                                 (list (list result))
+                               result)))
+            (org-babel-insert-result
+            result result-params info new-hash indent lang)
+            (run-hooks 'org-babel-after-execute-hook)
+            result))
+      (setq call-process-region 'org-babel-call-process-region-original))))
+
+(defun org-babel-expand-body:generic (body params &optional processed-params)
+  "Expand BODY with PARAMS.
+Expand a block of code with org-babel according to it's header
+arguments.  This generic implementation of body expansion is
+called for languages which have not defined their own specific
+org-babel-expand-body:lang function." body)
+
+;;;###autoload
+(defun org-babel-expand-src-block (&optional arg info params)
+  "Expand the current source code block.
+Expand according to the source code block's header
+arguments and pop open the results in a preview buffer."
+  (interactive)
+  (let* ((info (or info (org-babel-get-src-block-info)))
+         (lang (nth 0 info))
+        (params (setf (nth 2 info)
+                       (sort (org-babel-merge-params (nth 2 info) params)
+                             (lambda (el1 el2) (string< (symbol-name (car el1))
+                                                   (symbol-name (car el2)))))))
+         (body (setf (nth 1 info)
+                    (if (and (cdr (assoc :noweb params))
+                              (string= "yes" (cdr (assoc :noweb params))))
+                        (org-babel-expand-noweb-references info) (nth 1 info))))
+         (cmd (intern (concat "org-babel-expand-body:" lang)))
+         (expanded (funcall (if (fboundp cmd) cmd 'org-babel-expand-body:generic)
+                            body params)))
+    (org-edit-src-code
+     nil expanded (concat "*Org-Babel Preview " (buffer-name) "[ " lang " ]*"))))
+
+;;;###autoload
+(defun org-babel-load-in-session (&optional arg info)
+  "Load the body of the current source-code block.
+Evaluate the header arguments for the source block before
+entering the session.  After loading the body this pops open the
+session."
+  (interactive)
+  (let* ((info (or info (org-babel-get-src-block-info)))
+         (lang (nth 0 info))
+         (body (nth 1 info))
+         (params (nth 2 info))
+         (session (cdr (assoc :session params)))
+        (cmd (intern (concat "org-babel-load-session:" lang))))
+    (unless (fboundp cmd)
+      (error "No org-babel-load-session function for %s!" lang))
+    (pop-to-buffer (funcall cmd session body params))
+    (end-of-line 1)))
+
+;;;###autoload
+(defun org-babel-switch-to-session (&optional arg info)
+  "Switch to the session of the current source-code block.
+If called with a prefix argument then evaluate the header arguments
+for the source block before entering the session. Copy the body
+of the source block to the kill ring."
+  (interactive)
+  (let* ((info (or info (org-babel-get-src-block-info)))
+         (lang (nth 0 info))
+         (body (nth 1 info))
+         (params (nth 2 info))
+         (session (cdr (assoc :session params)))
+        (dir (cdr (assoc :dir params)))
+        (default-directory
+          (or (and dir (file-name-as-directory dir)) default-directory))
+        (cmd (intern (format "org-babel-%s-initiate-session" lang)))
+        (cmd2 (intern (concat "org-babel-prep-session:" lang))))
+    (unless (fboundp cmd)
+      (error "No org-babel-initiate-session function for %s!" lang))
+    ;; copy body to the kill ring
+    (with-temp-buffer (insert (org-babel-trim body))
+                      (copy-region-as-kill (point-min) (point-max)))
+    ;; if called with a prefix argument, then process header arguments
+    (unless (fboundp cmd2)
+      (error "No org-babel-prep-session function for %s!" lang))
+    (when arg (funcall cmd2 session params))
+    ;; just to the session using pop-to-buffer
+    (pop-to-buffer (funcall cmd session params))
+    (end-of-line 1)))
+
+(defalias 'org-babel-pop-to-session 'org-babel-switch-to-session)
+
+(defvar org-bracket-link-regexp)
+;;;###autoload
+(defun org-babel-open-src-block-result (&optional re-run)
+  "If `point' is on a src block then open the results of the
+source code block, otherwise return nil.  With optional prefix
+argument RE-RUN the source-code block is evaluated even if
+results already exist."
+  (interactive "P")
+  (when (org-babel-get-src-block-info)
+    (save-excursion
+      ;; go to the results, if there aren't any then run the block
+      (goto-char (or (and (not re-run) (org-babel-where-is-src-block-result))
+                     (progn (org-babel-execute-src-block)
+                            (org-babel-where-is-src-block-result))))
+      (end-of-line 1)
+      (while (looking-at "[\n\r\t\f ]") (forward-char 1))
+      ;; open the results
+      (if (looking-at org-bracket-link-regexp)
+          ;; file results
+          (org-open-at-point)
+        (let ((results (org-babel-read-result)))
+          (flet ((echo-res (result)
+                           (if (stringp result) result (format "%S" result))))
+            (pop-to-buffer (get-buffer-create "org-babel-results"))
+            (delete-region (point-min) (point-max))
+            (if (listp results)
+                ;; table result
+                (insert (orgtbl-to-generic results '(:sep "\t" :fmt echo-res)))
+              ;; scalar result
+              (insert (echo-res results))))))
+      t)))
+
+;;;###autoload
+(defun org-babel-execute-buffer (&optional arg)
+  "Execute source code blocks in a buffer.
+Call `org-babel-execute-src-block' on every source block in
+the current buffer."
+  (interactive "P")
+  (save-excursion
+    (org-save-outline-visibility t
+      (goto-char (point-min))
+      (show-all)
+      (while (re-search-forward org-babel-src-block-regexp nil t)
+       (let ((pos-end (match-end 0)))
+         (goto-char (match-beginning 0))
+         (org-babel-execute-src-block arg)
+         (goto-char pos-end))))))
+
+;;;###autoload
+(defun org-babel-execute-subtree (&optional arg)
+  "Execute source code blocks in a subtree.
+Call `org-babel-execute-src-block' on every source block in
+the current subtree."
+  (interactive "P")
+  (save-restriction
+    (save-excursion
+      (org-narrow-to-subtree)
+      (org-babel-execute-buffer)
+      (widen))))
+
+;;;###autoload
+(defun org-babel-sha1-hash (&optional info)
+  "Generate an sha1 hash based on the value of info."
+  (interactive)
+  (let* ((info (or info (org-babel-get-src-block-info)))
+         (hash (sha1 (format "%s-%s" (mapconcat (lambda (arg) (format "%S" arg))
+                                                (nth 2 info) ":")
+                             (nth 1 info)))))
+    (when (interactive-p) (message hash))
+    hash))
+
+(defun org-babel-result-hash (&optional info)
+  "Return the in-buffer hash associated with INFO."
+  (org-babel-where-is-src-block-result nil info)
+  (org-babel-clean-text-properties (match-string 3)))
+
+(defun org-babel-hide-hash ()
+  "Hide the hash in the current results line.
+Only the initial `org-babel-hash-show' characters of the hash
+will remain visible."
+  (add-to-invisibility-spec '(org-babel-hide-hash . t))
+  (save-excursion
+    (when (and (re-search-forward org-babel-result-regexp nil t)
+               (match-string 3))
+      (let* ((start (match-beginning 3))
+             (hide-start (+ org-babel-hash-show start))
+             (end (match-end 3))
+             (hash (match-string 3))
+             ov1 ov2)
+        (setq ov1 (make-overlay start hide-start))
+        (setq ov2 (make-overlay hide-start end))
+        (overlay-put ov2 'invisible 'org-babel-hide-hash)
+        (overlay-put ov1 'babel-hash hash)))))
+
+(defun org-babel-hide-all-hashes ()
+  "Hide the hash in the current buffer.
+Only the initial `org-babel-hash-show' characters of each hash
+will remain visible.  This function should be called as part of
+the `org-mode-hook'."
+  (save-excursion
+    (while (re-search-forward org-babel-result-regexp nil t)
+      (goto-char (match-beginning 0))
+      (org-babel-hide-hash)
+      (goto-char (match-end 0)))))
+(add-hook 'org-mode-hook 'org-babel-hide-all-hashes)
+
+(defun org-babel-hash-at-point (&optional point)
+  "Return the value of the hash at POINT.
+The hash is also added as the last element of the kill ring.
+This can be called with C-c C-c."
+  (interactive)
+  (let ((hash (car (delq nil (mapcar
+                             (lambda (ol) (overlay-get ol 'babel-hash))
+                              (overlays-at (or point (point))))))))
+    (when hash (kill-new hash) (message hash))))
+(add-hook 'org-ctrl-c-ctrl-c-hook 'org-babel-hash-at-point)
+
+(defun org-babel-result-hide-spec ()
+  "Hide portions of results lines.
+Add `org-babel-hide-result' as an invisibility spec for hiding
+portions of results lines."
+  (add-to-invisibility-spec '(org-babel-hide-result . t)))
+(add-hook 'org-mode-hook 'org-babel-result-hide-spec)
+
+(defvar org-babel-hide-result-overlays nil
+  "Overlays hiding results.")
+
+(defun org-babel-result-hide-all ()
+  "Fold all results in the current buffer."
+  (interactive)
+  (org-babel-show-result-all)
+  (save-excursion
+    (while (re-search-forward org-babel-result-regexp nil t)
+      (save-excursion (goto-char (match-beginning 0))
+                      (org-babel-hide-result-toggle-maybe)))))
+
+(defun org-babel-show-result-all ()
+  "Unfold all results in the current buffer."
+  (mapc 'delete-overlay org-babel-hide-result-overlays)
+  (setq org-babel-hide-result-overlays nil))
+
+;;;###autoload
+(defun org-babel-hide-result-toggle-maybe ()
+  "Toggle visibility of result at point."
+  (interactive)
+  (let ((case-fold-search t))
+    (if (save-excursion
+          (beginning-of-line 1)
+          (looking-at org-babel-result-regexp))
+        (progn (org-babel-hide-result-toggle)
+               t) ;; to signal that we took action
+      nil))) ;; to signal that we did not
+
+(defun org-babel-hide-result-toggle (&optional force)
+  "Toggle the visibility of the current result."
+  (interactive)
+  (save-excursion
+    (beginning-of-line)
+    (if (re-search-forward org-babel-result-regexp nil t)
+        (let ((start (progn (beginning-of-line 2) (- (point) 1)))
+              (end (progn (goto-char (- (org-babel-result-end) 1)) (point)))
+              ov)
+          (if (memq t (mapcar (lambda (overlay)
+                                (eq (overlay-get overlay 'invisible)
+                                   'org-babel-hide-result))
+                              (overlays-at start)))
+              (if (or (not force) (eq force 'off))
+                  (mapc (lambda (ov)
+                          (when (member ov org-babel-hide-result-overlays)
+                            (setq org-babel-hide-result-overlays
+                                  (delq ov org-babel-hide-result-overlays)))
+                          (when (eq (overlay-get ov 'invisible)
+                                    'org-babel-hide-result)
+                            (delete-overlay ov)))
+                        (overlays-at start)))
+            (setq ov (make-overlay start end))
+            (overlay-put ov 'invisible 'org-babel-hide-result)
+            ;; make the block accessible to isearch
+            (overlay-put
+             ov 'isearch-open-invisible
+             (lambda (ov)
+               (when (member ov org-babel-hide-result-overlays)
+                 (setq org-babel-hide-result-overlays
+                       (delq ov org-babel-hide-result-overlays)))
+               (when (eq (overlay-get ov 'invisible)
+                         'org-babel-hide-result)
+                 (delete-overlay ov))))
+            (push ov org-babel-hide-result-overlays)))
+      (error "Not looking at a result line"))))
+
+;; org-tab-after-check-for-cycling-hook
+(add-hook 'org-tab-first-hook 'org-babel-hide-result-toggle-maybe)
+;; Remove overlays when changing major mode
+(add-hook 'org-mode-hook
+         (lambda () (org-add-hook 'change-major-mode-hook
+                             'org-babel-show-result-all 'append 'local)))
+
+(defmacro org-babel-map-src-blocks (file &rest body)
+  "Evaluate BODY forms on each source-block in FILE."
+  (declare (indent 1))
+  `(let ((visited-p (get-file-buffer (expand-file-name ,file)))
+        to-be-removed)
+     (save-window-excursion
+       (find-file ,file)
+       (setq to-be-removed (current-buffer))
+       (goto-char (point-min))
+       (while (re-search-forward org-babel-src-block-regexp nil t)
+         (goto-char (match-beginning 0))
+         (save-match-data ,@body)
+         (goto-char (match-end 0))))
+     (unless visited-p
+       (kill-buffer to-be-removed))))
+
+(defvar org-file-properties)
+(defun org-babel-params-from-properties (&optional lang)
+  "Retrieve parameters specified as properties.
+Return an association list of any source block params which
+may be specified in the properties of the current outline entry."
+  (save-match-data
+    (let (val sym)
+      (delq nil
+           (mapcar
+            (lambda (header-arg)
+              (and (setq val
+                         (or (condition-case nil
+                                 (org-entry-get (point) header-arg t)
+                               (error nil))
+                             (cdr (assoc header-arg org-file-properties))))
+                   (cons (intern (concat ":" header-arg)) val)))
+            (mapcar
+             'symbol-name
+             (append
+              org-babel-header-arg-names
+              (progn
+                (setq sym (intern (concat "org-babel-header-arg-names:" lang)))
+                (and (boundp sym) (eval sym))))))))))
+
+(defun org-babel-params-from-buffer ()
+  "Retrieve per-buffer parameters.
+ Return an association list of any source block params which
+may be specified at the top of the current buffer."
+  (or org-babel-current-buffer-properties
+      (setq org-babel-current-buffer-properties
+           (save-match-data
+             (save-excursion
+               (save-restriction
+                 (widen)
+                 (goto-char (point-min))
+                 (when (re-search-forward
+                        (org-make-options-regexp (list "BABEL")) nil t)
+                   (org-babel-parse-header-arguments
+                    (org-match-string-no-properties 2)))))))))
+
+(defvar org-src-preserve-indentation)
+(defun org-babel-parse-src-block-match ()
+  "Parse the results from a match of the `org-babel-src-block-regexp'."
+  (let* ((block-indentation (length (match-string 1)))
+        (lang (org-babel-clean-text-properties (match-string 2)))
+         (lang-headers (intern (concat "org-babel-default-header-args:" lang)))
+        (switches (match-string 3))
+         (body (org-babel-clean-text-properties (match-string 5)))
+        (preserve-indentation (or org-src-preserve-indentation
+                                  (string-match "-i\\>" switches))))
+    (list lang
+          ;; get block body less properties, protective commas, and indentation
+          (with-temp-buffer
+            (save-match-data
+              (insert (org-babel-strip-protective-commas body))
+             (unless preserve-indentation (org-do-remove-indentation))
+              (buffer-string)))
+         (org-babel-merge-params
+          org-babel-default-header-args
+          (org-babel-params-from-buffer)
+           (org-babel-params-from-properties lang)
+          (if (boundp lang-headers) (eval lang-headers) nil)
+          (org-babel-parse-header-arguments
+            (org-babel-clean-text-properties (or (match-string 4) ""))))
+         switches
+         block-indentation)))
+
+(defun org-babel-parse-inline-src-block-match ()
+  "Parse the results from a match of the `org-babel-inline-src-block-regexp'."
+  (let* ((lang (org-babel-clean-text-properties (match-string 2)))
+         (lang-headers (intern (concat "org-babel-default-header-args:" lang))))
+    (list lang
+          (org-babel-strip-protective-commas
+           (org-babel-clean-text-properties (match-string 5)))
+          (org-babel-merge-params
+           org-babel-default-inline-header-args
+          (org-babel-params-from-buffer)
+           (org-babel-params-from-properties lang)
+           (if (boundp lang-headers) (eval lang-headers) nil)
+           (org-babel-parse-header-arguments
+            (org-babel-clean-text-properties (or (match-string 4) "")))))))
+
+(defun org-babel-parse-header-arguments (arg-string)
+  "Parse a string of header arguments returning an alist."
+  (if (> (length arg-string) 0)
+      (delq nil
+           (mapcar
+            (lambda (arg)
+              (if (string-match
+                    "\\([^ \f\t\n\r\v]+\\)[ \f\t\n\r\v]+\\([^ \f\t\n\r\v]+.*\\)"
+                    arg)
+                  (cons (intern (concat ":" (match-string 1 arg)))
+                         (let ((raw (org-babel-chomp (match-string 2 arg))))
+                           (if (org-babel-number-p raw)
+                               raw (org-babel-read raw))))
+                (cons (intern (concat ":" arg)) nil)))
+            (split-string (concat " " arg-string) "[ \f\t\n\r\v]+:" t)))))
+
+(defun org-babel-process-params (params)
+  "Parse params and resolve references.
+
+Return a list (session vars result-params result-type colnames rownames)."
+  (let* ((session (cdr (assoc :session params)))
+         (vars-and-names (org-babel-disassemble-tables
+                          (org-babel-ref-variables params)
+                          (cdr (assoc :hlines params))
+                          (cdr (assoc :colnames params))
+                          (cdr (assoc :rownames params))))
+         (vars     (car   vars-and-names))
+         (colnames (cadr  vars-and-names))
+         (rownames (caddr vars-and-names))
+        (result-params (split-string (or (cdr (assoc :results params)) "")))
+        (result-type (cond ((member "output" result-params) 'output)
+                           ((member "value" result-params) 'value)
+                           (t 'value))))
+    (list session vars result-params result-type colnames rownames)))
+
+;; row and column names
+(defun org-babel-del-hlines (table)
+  "Remove all 'hlines from TABLE."
+  (remove 'hline table))
+
+(defun org-babel-get-colnames (table)
+  "Return the column names of TABLE.
+Return a cons cell, the `car' of which contains the TABLE less
+colnames, and the `cdr' of which contains a list of the column
+names."
+  (if (equal 'hline (nth 1 table))
+      (cons (cddr table) (car table))
+    (cons (cdr table) (car table))))
+
+(defun org-babel-get-rownames (table)
+  "Return the row names of TABLE.
+Return a cons cell, the `car' of which contains the TABLE less
+colnames, and the `cdr' of which contains a list of the column
+names.  Note: this function removes any hlines in TABLE."
+  (flet ((trans (table) (apply #'mapcar* #'list table)))
+    (let* ((width (apply 'max (mapcar (lambda (el) (if (listp el) (length el) 0)) table)))
+           (table (trans (mapcar (lambda (row)
+                                   (if (not (equal row 'hline))
+                                       row
+                                     (setq row '())
+                                     (dotimes (n width) (setq row (cons 'hline row)))
+                                     row))
+                                 table))))
+      (cons (mapcar (lambda (row) (if (equal (car row) 'hline) 'hline row))
+                    (trans (cdr table)))
+            (remove 'hline (car table))))))
+
+(defun org-babel-put-colnames (table colnames)
+  "Add COLNAMES to TABLE if they exist."
+  (if colnames (apply 'list colnames 'hline table) table))
+
+(defun org-babel-put-rownames (table rownames)
+  "Add ROWNAMES to TABLE if they exist."
+  (if rownames
+      (mapcar (lambda (row)
+                (if (listp row)
+                    (cons (or (pop rownames) "") row)
+                  row)) table)
+    table))
+
+(defun org-babel-pick-name (names selector)
+  "Select one out of an alist of row or column names."
+  (when names
+    (if (and selector (symbolp selector) (not (equal t selector)))
+        (cdr (assoc selector names))
+      (if (integerp selector)
+          (nth (- selector 1) names)
+        (cdr (car (last names)))))))
+
+(defun org-babel-disassemble-tables (vars hlines colnames rownames)
+  "Parse tables for further processing.
+Process the variables in VARS according to the HLINES,
+ROWNAMES and COLNAMES header arguments.  Return a list consisting
+of the vars, cnames and rnames."
+  (let (cnames rnames)
+    (list
+     (mapcar
+      (lambda (var)
+        (when (listp (cdr var))
+          (when (and (not (equal colnames "no"))
+                     (or colnames (and (equal (nth 1 (cdr var)) 'hline)
+                                       (not (member 'hline (cddr (cdr var)))))))
+            (let ((both (org-babel-get-colnames (cdr var))))
+              (setq cnames (cons (cons (car var) (cdr both))
+                                 cnames))
+              (setq var (cons (car var) (car both)))))
+          (when (and rownames (not (equal rownames "no")))
+            (let ((both (org-babel-get-rownames (cdr var))))
+              (setq rnames (cons (cons (car var) (cdr both))
+                                 rnames))
+              (setq var (cons (car var) (car both)))))
+          (when (and hlines (not (equal hlines "yes")))
+            (setq var (cons (car var) (org-babel-del-hlines (cdr var))))))
+        var)
+      vars)
+     cnames rnames)))
+
+(defun org-babel-reassemble-table (table colnames rownames)
+  "Add column and row names to a table.
+Given a TABLE and set of COLNAMES and ROWNAMES add the names
+to the table for reinsertion to org-mode."
+  (if (listp table)
+      ((lambda (table)
+         (if (and colnames (listp (car table)) (= (length (car table))
+                                                  (length colnames)))
+             (org-babel-put-colnames table colnames) table))
+       (if (and rownames (= (length table) (length rownames)))
+           (org-babel-put-rownames table rownames) table))
+    table))
+
+(defun org-babel-where-is-src-block-head ()
+  "Find where the current source block begins.
+Return the point at the beginning of the current source
+block.  Specifically at the beginning of the #+BEGIN_SRC line.
+If the point is not on a source block then return nil."
+  (let ((initial (point)) top bottom)
+    (or
+     (save-excursion ;; on a source name line
+       (beginning-of-line 1)
+       (and (looking-at org-babel-src-name-regexp) (forward-line 1)
+            (looking-at org-babel-src-block-regexp)
+            (point)))
+     (save-excursion ;; on a #+begin_src line
+       (beginning-of-line 1)
+       (and (looking-at org-babel-src-block-regexp)
+            (point)))
+     (save-excursion ;; inside a src block
+       (and
+        (re-search-backward "^[ \t]*#\\+begin_src" nil t) (setq top (point))
+        (re-search-forward "^[ \t]*#\\+end_src" nil t) (setq bottom (point))
+        (< top initial) (< initial bottom)
+        (progn (goto-char top) (beginning-of-line 1)
+              (looking-at org-babel-src-block-regexp))
+        (point))))))
+
+;;;###autoload
+(defun org-babel-goto-named-src-block (name)
+  "Go to a named source-code block."
+  (interactive
+   (let ((completion-ignore-case t))
+     (list (org-icompleting-read "source-block name: "
+                                (org-babel-src-block-names) nil t))))
+  (let ((point (org-babel-find-named-block name)))
+    (if point
+        ;; taken from `org-open-at-point'
+        (progn (goto-char point) (org-show-context))
+      (message "source-code block '%s' not found in this buffer" name))))
+
+(defun org-babel-find-named-block (name)
+  "Find a named source-code block.
+Return the location of the source block identified by source
+NAME, or nil if no such block exists. Set match data according to
+org-babel-named-src-block-regexp."
+  (save-excursion
+    (let ((case-fold-search t)
+         (regexp (org-babel-named-src-block-regexp-for-name name)) msg)
+      (goto-char (point-min))
+      (when (or (re-search-forward regexp nil t)
+                (re-search-backward regexp nil t))
+        (match-beginning 0)))))
+
+(defun org-babel-src-block-names (&optional file)
+  "Returns the names of source blocks in FILE or the current buffer."
+  (save-excursion
+    (when file (find-file file)) (goto-char (point-min))
+    (let (names)
+      (while (re-search-forward org-babel-src-name-w-name-regexp nil t)
+       (setq names (cons (org-babel-clean-text-properties (match-string 2))
+                         names)))
+      names)))
+
+;;;###autoload
+(defun org-babel-goto-named-result (name)
+  "Go to a named result."
+  (interactive
+   (let ((completion-ignore-case t))
+     (list (org-icompleting-read "source-block name: "
+                                (org-babel-result-names) nil t))))
+  (let ((point (org-babel-find-named-result name)))
+    (if point
+        ;; taken from `org-open-at-point'
+        (progn (goto-char point) (org-show-context))
+      (message "result '%s' not found in this buffer" name))))
+
+(defun org-babel-find-named-result (name)
+  "Find a named result.
+Return the location of the result named NAME in the current
+buffer or nil if no such result exists."
+  (save-excursion
+    (goto-char (point-min))
+    (when (re-search-forward
+           (concat org-babel-result-regexp
+                   "[ \t]" (regexp-quote name) "[ \t\n\f\v\r]") nil t)
+      (beginning-of-line 0) (point))))
+
+(defun org-babel-result-names (&optional file)
+  "Returns the names of results in FILE or the current buffer."
+  (save-excursion
+    (when file (find-file file)) (goto-char (point-min))
+    (let (names)
+      (while (re-search-forward org-babel-result-w-name-regexp nil t)
+       (setq names (cons (org-babel-clean-text-properties (match-string 4))
+                         names)))
+      names)))
+
+;;;###autoload
+(defun org-babel-next-src-block (&optional arg)
+  "Jump to the next source block.
+With optional prefix argument ARG, jump forward ARG many source blocks."
+  (interactive "P")
+  (when (looking-at org-babel-src-block-regexp) (forward-char 1))
+  (re-search-forward org-babel-src-block-regexp nil nil (or arg 1))
+  (goto-char (match-beginning 0)) (org-show-context))
+
+;;;###autoload
+(defun org-babel-previous-src-block (&optional arg)
+  "Jump to the previous source block.
+With optional prefix argument ARG, jump backward ARG many source blocks."
+  (interactive "P")
+  (re-search-backward org-babel-src-block-regexp nil nil (or arg 1))
+  (goto-char (match-beginning 0)) (org-show-context))
+
+(defvar org-babel-lob-one-liner-regexp)
+(defun org-babel-where-is-src-block-result (&optional insert info hash indent)
+  "Find where the current source block results begin.
+Return the point at the beginning of the result of the current
+source block.  Specifically at the beginning of the results line.
+If no result exists for this block then create a results line
+following the source block."
+  (save-excursion
+    (let* ((on-lob-line (progn (beginning-of-line 1)
+                              (looking-at org-babel-lob-one-liner-regexp)))
+          (name (if on-lob-line
+                    (nth 0 (org-babel-lob-get-info))
+                  (nth 4 (or info (org-babel-get-src-block-info)))))
+          (head (unless on-lob-line (org-babel-where-is-src-block-head)))
+          found beg end)
+      (when head (goto-char head))
+      (setq
+       found ;; was there a result (before we potentially insert one)
+       (or
+       (and
+        ;; named results:
+        ;; - return t if it is found, else return nil
+        ;; - if it does not need to be rebuilt, then don't set end
+        ;; - if it does need to be rebuilt then do set end
+        name (setq beg (org-babel-find-named-result name))
+        (prog1 beg
+          (when (and hash (not (string= hash (match-string 3))))
+            (goto-char beg) (setq end beg) ;; beginning of result
+            (forward-line 1)
+            (delete-region end (org-babel-result-end)) nil)))
+       (and
+        ;; unnamed results:
+        ;; - return t if it is found, else return nil
+        ;; - if it is found, and the hash doesn't match, delete and set end
+        (or on-lob-line (re-search-forward "^[ \t]*#\\+end_src" nil t))
+        (progn (end-of-line 1)
+               (if (eobp) (insert "\n") (forward-char 1))
+               (setq end (point))
+               (or (and (not name)
+                        (progn ;; unnamed results line already exists
+                          (re-search-forward "[^ \f\t\n\r\v]" nil t)
+                          (beginning-of-line 1)
+                          (looking-at
+                           (concat org-babel-result-regexp "\n")))
+                        (prog1 (point)
+                          ;; must remove and rebuild if hash!=old-hash
+                          (if (and hash (not (string= hash (match-string 3))))
+                              (prog1 nil
+                                (forward-line 1)
+                                (delete-region
+                                 end (org-babel-result-end)))
+                            (setq end nil)))))))))
+      (if (and insert end)
+         (progn
+           (goto-char end)
+           (unless beg
+             (if (looking-at "[\n\r]") (forward-char 1) (insert "\n")))
+           (insert (concat
+                    (if indent
+                        (mapconcat
+                         (lambda (el) " ")
+                         (number-sequence 1 indent) "")
+                      "")
+                    "#+results"
+                    (when hash (concat "["hash"]"))
+                    ":"
+                    (when name (concat " " name)) "\n"))
+           (unless beg (insert "\n") (backward-char))
+           (beginning-of-line 0)
+           (if hash (org-babel-hide-hash))
+           (point))
+       found))))
+
+(defvar org-block-regexp)
+(defun org-babel-read-result ()
+  "Read the result at `point' into emacs-lisp."
+  (let ((case-fold-search t) result-string)
+    (cond
+     ((org-at-table-p) (org-babel-read-table))
+     ((looking-at org-bracket-link-regexp) (org-babel-read-link))
+     ((looking-at org-block-regexp) (org-babel-trim (match-string 4)))
+     ((looking-at "^[ \t]*: ")
+      (setq result-string
+           (org-babel-trim
+            (mapconcat (lambda (line)
+                          (if (and (> (length line) 1)
+                                   (string-match "^[ \t]*: \\(.+\\)" line))
+                              (match-string 1 line)
+                            line))
+                       (split-string
+                        (buffer-substring
+                          (point) (org-babel-result-end)) "[\r\n]+")
+                       "\n")))
+      (or (org-babel-number-p result-string) result-string))
+     ((looking-at org-babel-result-regexp)
+      (save-excursion (forward-line 1) (org-babel-read-result))))))
+
+(defun org-babel-read-table ()
+  "Read the table at `point' into emacs-lisp."
+  (mapcar (lambda (row)
+            (if (and (symbolp row) (equal row 'hline)) row
+              (mapcar #'org-babel-read row)))
+          (org-table-to-lisp)))
+
+(defvar org-link-types-re)
+(defun org-babel-read-link ()
+  "Read the link at `point' into emacs-lisp.
+If the path of the link is a file path it is expanded using
+`expand-file-name'."
+  (let* ((case-fold-search t)
+         (raw (and (looking-at org-bracket-link-regexp)
+                   (org-babel-clean-text-properties (match-string 1))))
+         (type (and (string-match org-link-types-re raw)
+                    (match-string 1 raw))))
+    (cond
+     ((not type) (expand-file-name raw))
+     ((string= type "file")
+      (and (string-match "file\\(.*\\):\\(.+\\)" raw)
+           (expand-file-name (match-string 2 raw))))
+     (t raw))))
+
+(defun org-babel-insert-result
+  (result &optional result-params info hash indent lang)
+  "Insert RESULT into the current buffer.
+By default RESULT is inserted after the end of the
+current source block.  With optional argument RESULT-PARAMS
+controls insertion of results in the org-mode file.
+RESULT-PARAMS can take the following values...
+
+replace - (default option) insert results after the source block
+          replacing any previously inserted results
+
+silent -- no results are inserted
+
+file ---- the results are interpreted as a file path, and are
+          inserted into the buffer using the Org-mode file syntax
+
+raw ----- results are added directly to the org-mode file.  This
+          is a good option if you code block will output org-mode
+          formatted text.
+
+org ----- this is the same as the 'raw' option
+
+html ---- results are added inside of a #+BEGIN_HTML block.  This
+          is a good option if you code block will output html
+          formatted text.
+
+latex --- results are added inside of a #+BEGIN_LATEX block.
+          This is a good option if you code block will output
+          latex formatted text.
+
+code ---- the results are extracted in the syntax of the source
+          code of the language being evaluated and are added
+          inside of a #+BEGIN_SRC block with the source-code
+          language set appropriately.  Note this relies on the
+          optional LANG argument."
+  (if (stringp result)
+      (progn
+        (setq result (org-babel-clean-text-properties result))
+        (when (member "file" result-params)
+          (setq result (org-babel-result-to-file result))))
+    (unless (listp result) (setq result (format "%S" result))))
+  (if (= (length result) 0)
+      (if (member "value" result-params)
+         (message "No result returned by source block")
+       (message "Source block produced no output"))
+    (if (and result-params (member "silent" result-params))
+        (progn
+         (message (replace-regexp-in-string "%" "%%" (format "%S" result)))
+         result)
+      (when (and (stringp result) ;; ensure results end in a newline
+                 (not (or (string-equal (substring result -1) "\n")
+                          (string-equal (substring result -1) "\r"))))
+        (setq result (concat result "\n")))
+      (save-excursion
+       (let ((existing-result (org-babel-where-is-src-block-result
+                               t info hash indent))
+             (results-switches
+               (cdr (assoc :results_switches (nth 2 info))))
+             beg end)
+         (when existing-result
+           (goto-char existing-result)
+           (save-excursion
+             (re-search-forward "#" nil t)
+             (setq indent (- (current-column) 1)))
+           (forward-line 1)
+           (setq beg (point))
+           (cond
+            ((member "replace" result-params)
+             (delete-region (point) (org-babel-result-end)))
+            ((member "append" result-params)
+             (goto-char (org-babel-result-end)) (setq beg (point)))
+            ((member "prepend" result-params) ;; already there
+             )))
+         (setq results-switches
+                (if results-switches (concat " " results-switches) ""))
+         (cond
+          ;; assume the result is a table if it's not a string
+          ((not (stringp result))
+           (insert (concat (orgtbl-to-orgtbl
+                            (if (or (eq 'hline (car result))
+                                    (and (listp (car result))
+                                         (listp (cdr (car result)))))
+                                result (list result))
+                            '(:fmt (lambda (cell) (format "%s" cell)))) "\n"))
+           (goto-char beg) (when (org-at-table-p) (org-table-align)))
+          ((member "file" result-params)
+           (insert result))
+          ((member "html" result-params)
+           (insert (format "#+BEGIN_HTML%s\n%s#+END_HTML\n"
+                            results-switches result)))
+          ((member "latex" result-params)
+           (insert (format "#+BEGIN_LaTeX%s\n%s#+END_LaTeX\n"
+                            results-switches result)))
+          ((member "code" result-params)
+           (insert (format "#+BEGIN_SRC %s%s\n%s#+END_SRC\n"
+                            (or lang "none") results-switches result)))
+          ((or (member "raw" result-params) (member "org" result-params))
+           (save-excursion (insert result)) (if (org-at-table-p) (org-cycle)))
+          (t
+           (org-babel-examplize-region
+            (point) (progn (insert result) (point)) results-switches)))
+         ;; possibly indent the results to match the #+results line
+         (setq end (if (listp result) (org-table-end) (point)))
+         (when (and indent (> indent 0)
+                    ;; in this case `table-align' does the work for us
+                    (not (and (listp result)
+                              (member "append" result-params))))
+           (indent-rigidly beg end indent))))
+      (message "finished"))))
+
+(defun org-babel-remove-result (&optional info)
+  "Remove the result of the current source block."
+  (interactive)
+  (let ((location (org-babel-where-is-src-block-result nil info)) start)
+    (when location
+      (save-excursion
+        (goto-char location) (setq start (point)) (forward-line 1)
+        (delete-region start (org-babel-result-end))))))
+
+(defun org-babel-result-end ()
+  "Return the point at the end of the current set of results"
+  (save-excursion
+    (if (org-at-table-p)
+        (progn (goto-char (org-table-end)) (point))
+      (let ((case-fold-search t))
+        (cond
+         ((looking-at "[ \t]*#\\+begin_latex")
+          (re-search-forward "[ \t]*#\\+end_latex" nil t)
+          (forward-line 1))
+         ((looking-at "[ \t]*#\\+begin_html")
+          (re-search-forward "[ \t]*#\\+end_html" nil t)
+          (forward-line 1))
+         ((looking-at "[ \t]*#\\+begin_example")
+          (re-search-forward "[ \t]*#\\+end_example" nil t)
+          (forward-line 1))
+         ((looking-at "[ \t]*#\\+begin_src")
+          (re-search-forward "[ \t]*#\\+end_src" nil t)
+          (forward-line 1))
+         (t (progn (while (looking-at "[ \t]*\\(: \\|\\[\\[\\)")
+                     (forward-line 1))))))
+      (point))))
+
+(defun org-babel-result-to-file (result)
+  "Convert RESULT into an `org-mode' link.
+If the `default-directory' is different from the containing
+file's directory then expand relative links."
+  (format
+   "[[file:%s]]"
+   (if (and default-directory
+            buffer-file-name
+            (not (string= (expand-file-name default-directory)
+                          (expand-file-name
+                           (file-name-directory buffer-file-name)))))
+       (expand-file-name result default-directory)
+     result)))
+
+(defun org-babel-examplize-region (beg end &optional results-switches)
+  "Comment out region using the ': ' org example quote."
+  (interactive "*r")
+  (let ((size (count-lines beg end)))
+    (save-excursion
+      (cond ((= size 0)
+            (error (concat "This should be impossible:"
+                            "a newline was appended to result if missing")))
+           ((< size org-babel-min-lines-for-block-output)
+            (goto-char beg)
+            (dotimes (n size)
+              (beginning-of-line 1) (insert ": ") (forward-line 1)))
+           (t
+            (goto-char beg)
+            (insert (if results-switches
+                         (format "#+begin_example%s\n" results-switches)
+                       "#+begin_example\n"))
+            (forward-char (- end beg))
+            (insert "#+end_example\n"))))))
+
+(defun org-babel-merge-params (&rest plists)
+  "Combine all parameter association lists in PLISTS.
+Later elements of PLISTS override the values of previous element.
+This takes into account some special considerations for certain
+parameters when merging lists."
+  (let ((results-exclusive-groups
+        '(("file" "vector" "table" "scalar" "raw" "org"
+            "html" "latex" "code" "pp")
+          ("replace" "silent" "append" "prepend")
+          ("output" "value")))
+       (exports-exclusive-groups
+        '(("code" "results" "both" "none")))
+       params results exports tangle noweb cache vars var ref shebang comments)
+    (flet ((e-merge (exclusive-groups &rest result-params)
+             ;; maintain exclusivity of mutually exclusive parameters
+             (let (output)
+               (mapc (lambda (new-params)
+                       (mapc (lambda (new-param)
+                               (mapc (lambda (exclusive-group)
+                                       (when (member new-param exclusive-group)
+                                         (mapcar (lambda (excluded-param)
+                                                   (setq output
+                                                         (delete
+                                                          excluded-param
+                                                          output)))
+                                                 exclusive-group)))
+                                     exclusive-groups)
+                               (setq output (org-uniquify
+                                             (cons new-param output))))
+                             new-params))
+                     result-params)
+               output)))
+      (mapc (lambda (plist)
+              (mapc (lambda (pair)
+                      (case (car pair)
+                        (:var
+                         ;; we want only one specification per variable
+                         (when (string-match
+                                (concat "^\\([^= \f\t\n\r\v]+\\)[ \t]*="
+                                        "[ \t]*\\([^\f\n\r\v]+\\)$") (cdr pair))
+                           ;; TODO: When is this not true?
+                           (setq var (intern (match-string 1 (cdr pair)))
+                                 ref (match-string 2 (cdr pair))
+                                 vars (cons (cons var ref)
+                                            (assq-delete-all var vars)))))
+                        (:results
+                         (setq results
+                              (e-merge results-exclusive-groups
+                                        results (split-string (cdr pair)))))
+                       (:file
+                        (when (cdr pair)
+                          (setq results (e-merge results-exclusive-groups
+                                                  results '("file")))
+                          (unless (or (member "both" exports)
+                                       (member "none" exports)
+                                       (member "code" exports))
+                            (setq exports (e-merge exports-exclusive-groups
+                                                    exports '("results"))))
+                          (setq params
+                                 (cons pair
+                                       (assq-delete-all (car pair) params)))))
+                        (:exports
+                         (setq exports
+                               (e-merge exports-exclusive-groups
+                                        exports (split-string (cdr pair)))))
+                        (:tangle ;; take the latest -- always overwrite
+                         (setq tangle (or (list (cdr pair)) tangle)))
+                        (:noweb
+                         (setq noweb
+                               (e-merge '(("yes" "no")) noweb
+                                        (split-string (or (cdr pair) "")))))
+                        (:cache
+                         (setq cache
+                               (e-merge '(("yes" "no")) cache
+                                        (split-string (or (cdr pair) "")))))
+                        (:shebang ;; take the latest -- always overwrite
+                         (setq shebang (or (list (cdr pair)) shebang)))
+                        (:comments
+                         (setq comments
+                               (e-merge '(("yes" "no")) comments
+                                        (split-string (or (cdr pair) "")))))
+                        (t ;; replace: this covers e.g. :session
+                         (setq params
+                               (cons pair
+                                     (assq-delete-all (car pair) params))))))
+                    plist))
+            plists))
+    (setq vars (mapcar (lambda (pair) (format "%s=%s" (car pair) (cdr pair))) vars))
+    (while vars (setq params (cons (cons :var (pop vars)) params)))
+    (cons (cons :comments (mapconcat 'identity comments " "))
+          (cons (cons :shebang (mapconcat 'identity shebang " "))
+                (cons (cons :cache (mapconcat 'identity cache " "))
+                      (cons (cons :noweb (mapconcat 'identity noweb " "))
+                            (cons (cons :tangle (mapconcat 'identity tangle " "))
+                                  (cons (cons :exports
+                                              (mapconcat 'identity exports " "))
+                                        (cons
+                                         (cons :results
+                                               (mapconcat 'identity results " "))
+                                         params)))))))))
+
+(defun org-babel-expand-noweb-references (&optional info parent-buffer)
+  "Expand Noweb references in the body of the current source code block.
+
+For example the following reference would be replaced with the
+body of the source-code block named 'example-block'.
+
+<<example-block>>
+
+Note that any text preceding the <<foo>> construct on a line will
+be interposed between the lines of the replacement text.  So for
+example if <<foo>> is placed behind a comment, then the entire
+replacement text will also be commented.
+
+This function must be called from inside of the buffer containing
+the source-code block which holds BODY.
+
+In addition the following syntax can be used to insert the
+results of evaluating the source-code block named 'example-block'.
+
+<<example-block()>>
+
+Any optional arguments can be passed to example-block by placing
+the arguments inside the parenthesis following the convention
+defined by `org-babel-lob'.  For example
+
+<<example-block(a=9)>>
+
+would set the value of argument \"a\" equal to \"9\".  Note that
+these arguments are not evaluated in the current source-code
+block but are passed literally to the \"example-block\"."
+  (let* ((parent-buffer (or parent-buffer (current-buffer)))
+         (info (or info (org-babel-get-src-block-info)))
+         (lang (nth 0 info))
+         (body (nth 1 info))
+         (new-body "") index source-name evaluate prefix)
+    (flet ((nb-add (text)
+                   (setq new-body (concat new-body text))))
+      (with-temp-buffer
+        (insert body) (goto-char (point-min))
+        (setq index (point))
+        (while (and (re-search-forward "<<\\(.+?\\)>>" nil t))
+          (save-match-data (setf source-name (match-string 1)))
+          (save-match-data (setq evaluate (string-match "\(.*\)" source-name)))
+          (save-match-data
+            (setq prefix
+                  (buffer-substring (match-beginning 0)
+                                    (save-excursion
+                                      (beginning-of-line 1) (point)))))
+          ;; add interval to new-body (removing noweb reference)
+          (goto-char (match-beginning 0))
+          (nb-add (buffer-substring index (point)))
+          (goto-char (match-end 0))
+          (setq index (point))
+          (nb-add (with-current-buffer parent-buffer
+                   (mapconcat ;; interpose PREFIX between every line
+                     #'identity
+                     (split-string
+                      (if evaluate
+                          (let ((raw (org-babel-ref-resolve-reference
+                                      source-name nil)))
+                            (if (stringp raw) raw (format "%S" raw)))
+                       (save-restriction
+                         (widen)
+                         (let ((point (org-babel-find-named-block
+                                       source-name)))
+                           (if point
+                               (save-excursion
+                                 (goto-char point)
+                                 (org-babel-trim
+                                  (org-babel-expand-noweb-references
+                                   (org-babel-get-src-block-info))))
+                             ;; optionally raise an error if named
+                             ;; source-block doesn't exist
+                             (if (member lang org-babel-noweb-error-langs)
+                                 (error "%s"
+                                        (concat
+                                         "<<" source-name ">> "
+                                         "could not be resolved (see "
+                                         "`org-babel-noweb-error-langs')"))
+                               "")))))
+                     "[\n\r]") (concat "\n" prefix)))))
+        (nb-add (buffer-substring index (point-max)))))
+    new-body))
+
+(defun org-babel-clean-text-properties (text)
+  "Strip all properties from text return."
+  (when text
+    (set-text-properties 0 (length text) nil text) text))
+
+(defun org-babel-strip-protective-commas (body)
+  "Strip protective commas from bodies of source blocks."
+  (replace-regexp-in-string "^,#" "#" body))
+
+(defun org-babel-read (cell)
+  "Convert the string value of CELL to a number if appropriate.
+Otherwise if cell looks like lisp (meaning it starts with a
+\"(\" or a \"'\") then read it as lisp, otherwise return it
+unmodified as a string.
+
+This is taken almost directly from `org-read-prop'."
+  (if (and (stringp cell) (not (equal cell "")))
+      (or (org-babel-number-p cell)
+          (if (or (equal "(" (substring cell 0 1))
+                  (equal "'" (substring cell 0 1))
+                  (equal "`" (substring cell 0 1)))
+              (eval (read cell))
+            (progn (set-text-properties 0 (length cell) nil cell) cell)))
+    cell))
+
+(defun org-babel-number-p (string)
+  "Return t if STRING represents a number."
+  (if (and (string-match "^-?[0-9]*\\.?[0-9]*$" string)
+           (= (length (substring string (match-beginning 0)
+                                (match-end 0)))
+             (length string)))
+      (string-to-number string)))
+
+(defun org-babel-import-elisp-from-file (file-name)
+  "Read the results located at FILE-NAME into an elisp table.
+If the table is trivial, then return it as a scalar."
+  (let (result)
+    (save-window-excursion
+      (with-temp-buffer
+       (condition-case nil
+           (progn
+             (org-table-import file-name nil)
+             (delete-file file-name)
+             (setq result (mapcar (lambda (row)
+                                    (mapcar #'org-babel-string-read row))
+                                  (org-table-to-lisp))))
+         (error nil)))
+      (if (null (cdr result)) ;; if result is trivial vector, then scalarize it
+         (if (consp (car result))
+             (if (null (cdr (car result)))
+                 (caar result)
+               result)
+           (car result))
+       result))))
+
+(defun org-babel-string-read (cell)
+  "Strip nested \"s from around strings."
+  (org-babel-read (or (and (stringp cell)
+                           (string-match "\\\"\\(.+\\)\\\"" cell)
+                           (match-string 1 cell))
+                      cell)))
+
+(defun org-babel-reverse-string (string)
+  "Return the reverse of STRING."
+  (apply 'string (reverse (string-to-list string))))
+
+(defun org-babel-chomp (string &optional regexp)
+  "Strip trailing spaces and carriage returns from STRING.
+Default regexp used is \"[ \f\t\n\r\v]\" but can be
+overwritten by specifying a regexp as a second argument."
+  (let ((regexp (or regexp "[ \f\t\n\r\v]")))
+    (while (and (> (length string) 0)
+                (string-match regexp (substring string -1)))
+      (setq string (substring string 0 -1)))
+    string))
+
+(defun org-babel-trim (string &optional regexp)
+  "Strip leading and trailing spaces and carriage returns from STRING.
+Like `org-babel-chomp' only it runs on both the front and back
+of the string."
+  (org-babel-chomp (org-babel-reverse-string
+                    (org-babel-chomp (org-babel-reverse-string string) regexp))
+                   regexp))
+
+(defvar org-babel-org-babel-call-process-region-original nil)
+(defun org-babel-tramp-handle-call-process-region
+  (start end program &optional delete buffer display &rest args)
+  "Use tramp to handle call-process-region.
+Fixes a bug in `tramp-handle-call-process-region'."
+  (if (and (featurep 'tramp) (file-remote-p default-directory))
+      (let ((tmpfile (tramp-compat-make-temp-file "")))
+       (write-region start end tmpfile)
+       (when delete (delete-region start end))
+       (unwind-protect
+           ;;  (apply 'call-process program tmpfile buffer display args)
+            ;; bug in tramp
+           (apply 'process-file program tmpfile buffer display args)
+         (delete-file tmpfile)))
+    ;; org-babel-call-process-region-original is the original emacs definition. It
+    ;; is in scope from the let binding in org-babel-execute-src-block
+    (apply org-babel-call-process-region-original
+           start end program delete buffer display args)))
+
+(defun org-babel-maybe-remote-file (file)
+  "Conditionally parse information on a remote connnection.
+If FILE specifies a remove file, then parse the information on
+the remote connection."
+  (if (file-remote-p default-directory)
+      (let* ((vec (tramp-dissect-file-name default-directory))
+             (user (tramp-file-name-user vec))
+             (host (tramp-file-name-host vec)))
+        (concat "/" user (when user "@") host ":" file))
+    file))
+
+(provide 'ob)
+
+;; arch-tag: 01a7ebee-06c5-4ee4-a709-e660d28c0af1
+
+;;; ob.el ends here
index 22399e9a8a382be8e44b3d43629274385da661d2..a3d288065d3bca0ff8abb68826496131e2a82e8c 100644 (file)
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33x
+;; Version: 7.01
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -32,8 +32,7 @@
 
 (require 'org)
 (eval-when-compile
-  (require 'cl)
-  (require 'calendar))
+  (require 'cl))
 
 (declare-function diary-add-to-list "diary-lib"
                   (date string specifier &optional marker globcolor literal))
@@ -88,7 +87,7 @@ only needed when the text to be killed contains more than N non-white lines."
          (integer :tag "When more than N lines")))
 
 (defcustom org-agenda-compact-blocks nil
-  "Non-nil means, make the block agenda more compact.
+  "Non-nil means make the block agenda more compact.
 This is done by leaving out unnecessary lines."
   :group 'org-agenda
   :type 'boolean)
@@ -108,7 +107,7 @@ If it is a character, it will be repeated to fill the window width."
  :group 'org-agenda)
 
 (defcustom org-agenda-with-colors t
-  "Non-nil means, use colors in agenda views."
+  "Non-nil means use colors in agenda views."
   :group 'org-agenda-export
   :type 'boolean)
 
@@ -143,13 +142,13 @@ specifies the maximum number of lines that will be added for each entry
 that is listed in the agenda view.
 
 Note that this variable is not used during display, only when exporting
-the agenda.  For agenda display, see org-agenda-entry-text-mode and the
-variable `org-agenda-entry-text-maxlines'."
+the agenda.  For agenda display, see the variables `org-agenda-entry-text-mode'
+and `org-agenda-entry-text-maxlines'."
   :group 'org-agenda
   :type 'integer)
 
 (defcustom org-agenda-add-entry-text-descriptive-links t
-  "Non-nil means, export org-links as descriptive links in agenda added text.
+  "Non-nil means export org-links as descriptive links in agenda added text.
 This variable applies to the text added to the agenda when
 `org-agenda-add-entry-text-maxlines' is larger than 0.
 When this variable nil, the URL will (also) be shown."
@@ -198,6 +197,11 @@ you can \"misuse\" it to also add other text to the header.  However,
   :group 'org-export-html
   :type 'string)
 
+(defcustom org-agenda-persistent-filter nil
+  "When set, keep filters from one agenda view to the next."
+  :group 'org-agenda
+  :type 'boolean)
+
 (defgroup org-agenda-custom-commands nil
  "Options concerning agenda views in Org-mode."
  :tag "Org Agenda Custom Commands"
@@ -212,6 +216,7 @@ you can \"misuse\" it to also add other text to the header.  However,
     (const todo-state-up) (const todo-state-down)
     (const effort-up) (const effort-down)
     (const habit-up) (const habit-down)
+    (const alpha-up) (const alpha-down)
     (const user-defined-up) (const user-defined-down))
   "Sorting choices.")
 
@@ -258,6 +263,13 @@ you can \"misuse\" it to also add other text to the header.  However,
                   (const :format "" quote)
                   (repeat
                    (string :tag "+tag or -tag"))))
+           (list :tag "Set daily/weekly entry types"
+                 (const org-agenda-entry-types)
+                 (set :greedy t :value (:deadline :scheduled :timestamp :sexp)
+                      (const :deadline)
+                      (const :scheduled)
+                      (const :timestamp)
+                      (const :sexp)))
            (list :tag "Standard skipping condition"
                  :value (org-agenda-skip-function '(org-agenda-skip-entry-if))
                  (const org-agenda-skip-function)
@@ -273,6 +285,24 @@ you can \"misuse\" it to also add other text to the header.  However,
                             :tag "Condition type"
                             (list :tag "Regexp matches" :inline t (const :format "" 'regexp) (regexp))
                             (list :tag "Regexp does not match" :inline t (const :format "" 'notregexp) (regexp))
+                            (list :tag "TODO state is" :inline t
+                                  (const 'todo)
+                                  (choice
+                                   (const :tag "any not-done state" 'todo)
+                                   (const :tag "any done state" 'done)
+                                   (const :tag "any state" 'any)
+                                   (list :tag "Keyword list"
+                                         (const :format "" quote)
+                                         (repeat (string :tag "Keyword")))))
+                            (list :tag "TODO state is not" :inline t
+                                  (const 'nottodo)
+                                  (choice
+                                   (const :tag "any not-done state" 'todo)
+                                   (const :tag "any done state" 'done)
+                                   (const :tag "any state" 'any)
+                                   (list :tag "Keyword list"
+                                         (const :format "" quote)
+                                         (repeat (string :tag "Keyword")))))
                             (const :tag "scheduled" 'scheduled)
                             (const :tag "not scheduled" 'notscheduled)
                             (const :tag "deadline" 'deadline)
@@ -499,20 +529,20 @@ this one will be used."
   :group 'org-agenda)
 
 (defvar org-agenda-archives-mode nil
-  "Non-nil means, the agenda will include archived items.
+  "Non-nil means the agenda will include archived items.
 If this is the symbol `trees', trees in the selected agenda scope
 that are marked with the ARCHIVE tag will be included anyway.  When this is
 t, also all archive files associated with the current selection of agenda
 files will be included.")
 
 (defcustom org-agenda-skip-comment-trees t
-  "Non-nil means, skip trees that start with the COMMENT keyword.
+  "Non-nil means skip trees that start with the COMMENT keyword.
 When nil, these trees are also scanned by agenda commands."
   :group 'org-agenda-skip
   :type 'boolean)
 
 (defcustom org-agenda-todo-list-sublevels t
-  "Non-nil means, check also the sublevels of a TODO entry for TODO entries.
+  "Non-nil means check also the sublevels of a TODO entry for TODO entries.
 When nil, the sublevels of a TODO entry are not checked, resulting in
 potentially much shorter TODO lists."
   :group 'org-agenda-skip
@@ -520,7 +550,7 @@ potentially much shorter TODO lists."
   :type 'boolean)
 
 (defcustom org-agenda-todo-ignore-with-date nil
-  "Non-nil means, don't show entries with a date in the global todo list.
+  "Non-nil means don't show entries with a date in the global todo list.
 You can use this if you prefer to mark mere appointments with a TODO keyword,
 but don't want them to show up in the TODO list.
 When this is set, it also covers deadlines and scheduled items, the settings
@@ -532,27 +562,73 @@ See also the variable `org-agenda-tags-todo-honor-ignore-options'."
   :type 'boolean)
 
 (defcustom org-agenda-todo-ignore-scheduled nil
-  "Non-nil means, don't show scheduled entries in the global todo list.
-The idea behind this is that by scheduling it, you have already taken care
-of this item.
+  "Non-nil means, ignore some scheduled TODO items when making TODO list.
+This applies when creating the global todo list.
+Valid values are:
+
+past     Don't show entries scheduled today or in the past.
+
+future   Don't show entries scheduled in the future.
+         The idea behind this is that by scheduling it, you don't want to
+         think about it until the scheduled date.
+
+all      Don't show any scheduled entries in the global todo list.
+         The idea behind this is that by scheduling it, you have already
+         \"taken care\" of this item.
+
+t        Same as `all', for backward compatibility.
+
 See also `org-agenda-todo-ignore-with-date'.
-See also the variable `org-agenda-tags-todo-honor-ignore-options'."
+See also the variable `org-agenda-tags-todo-honor-ignore-options' if you want
+to make his option also apply to the tags-todo list."
   :group 'org-agenda-skip
   :group 'org-agenda-todo-list
-  :type 'boolean)
+  :type '(choice
+         (const :tag "Ignore future-scheduled todos" future)
+         (const :tag "Ignore past- or present-scheduled todos" past)
+         (const :tag "Ignore all scheduled todos" all)
+         (const :tag "Ignore all scheduled todos (compatibility)" t)
+         (const :tag "Show scheduled todos" nil)))
 
 (defcustom org-agenda-todo-ignore-deadlines nil
-  "Non-nil means, don't show near deadline entries in the global todo list.
-Near means closer than `org-deadline-warning-days' days.
-The idea behind this is that such items will appear in the agenda anyway.
+  "Non-nil means ignore some deadlined TODO items when making TODO list.
+There are different motivations for using different values, please think
+carefully when configuring this variable.
+
+This applies when creating the global todo list.
+Valid values are:
+
+near    Don't show near deadline entries.  A deadline is near when it is
+        closer than `org-deadline-warning-days' days.  The idea behind this
+        is that such items will appear in the agenda anyway.
+
+far     Don't show TODO entries where a deadline has been defined, but
+        the deadline is not near.  This is useful if you don't want to
+        use the todo list to figure out what to do now.
+
+past    Don't show entries with a deadline timestamp for today or in the past.
+
+future  Don't show entries with a deadline timestamp in the future, not even
+        when they become `near' ones.  Use it with caution.
+
+all     Ignore all TODO entries that do have a deadline.
+
+t       Same as `near', for backward compatibility.
+
 See also `org-agenda-todo-ignore-with-date'.
-See also the variable `org-agenda-tags-todo-honor-ignore-options'."
+See also the variable `org-agenda-tags-todo-honor-ignore-options' if you want
+to make his option also apply to the tags-todo list."
   :group 'org-agenda-skip
   :group 'org-agenda-todo-list
-  :type 'boolean)
+  :type '(choice
+         (const :tag "Ignore near deadlines" near)
+         (const :tag "Ignore near deadlines (compatibility)" t)
+         (const :tag "Ignore far deadlines" far)
+         (const :tag "Ignore all TODOs with a deadlines" all)
+         (const :tag "Show all TODOs, even if they have a deadline" nil)))
 
 (defcustom org-agenda-tags-todo-honor-ignore-options nil
-  "Non-nil means, honor todo-list ...ignore options also in tags-todo search.
+  "Non-nil means honor todo-list ...ignore options also in tags-todo search.
 The variables
    `org-agenda-todo-ignore-with-date',
    `org-agenda-todo-ignore-scheduled'
@@ -603,6 +679,24 @@ deadlines are always turned off when the item is DONE."
   :group 'org-agenda-daily/weekly
   :type 'boolean)
 
+(defcustom org-agenda-skip-deadline-prewarning-if-scheduled nil
+  "Non-nil means skip deadline prewarning when entry is also scheduled.
+This will apply on all days where a prewarning for the deadline would
+be shown, but not at the day when the entry is actually due.  On that day,
+the deadline will be shown anyway.
+This variable may be set to nil, t, or a number which will then give
+the number of days before the actual deadline when the prewarnings
+should resume.
+This can be used in a workflow where the first showing of the deadline will
+trigger you to schedule it, and then you don't want to be reminded of it
+because you will take care of it on the day when scheduled."
+  :group 'org-agenda-skip
+  :group 'org-agenda-daily/weekly
+  :type '(choice
+         (const :tag "Alwas show prewarning" nil)
+         (const :tag "Remove prewarning if entry is scheduled" t)
+         (integer :tag "Restart prewarning N days before deadline")))
+
 (defcustom org-agenda-skip-additional-timestamps-same-entry t
   "When nil, multiple same-day timestamps in entry make multiple agenda lines.
 When non-nil, after the search for timestamps has matched once in an
@@ -617,7 +711,7 @@ entry, the rest of the entry will not be searched."
   :type 'boolean)
 
 (defcustom org-agenda-dim-blocked-tasks t
-  "Non-nil means, dim blocked tasks in the agenda display.
+  "Non-nil means dim blocked tasks in the agenda display.
 This causes some overhead during agenda construction, but if you
 have turned on `org-enforce-todo-dependencies',
 `org-enforce-todo-checkbox-dependencies', or any other blocking
@@ -639,7 +733,7 @@ will only be dimmed."
          (const :tag "Make invisible" invisible)))
 
 (defcustom org-timeline-show-empty-dates 3
-  "Non-nil means, `org-timeline' also shows dates without an entry.
+  "Non-nil means `org-timeline' also shows dates without an entry.
 When nil, only the days which actually have entries are shown.
 When t, all days between the first and the last date are shown.
 When an integer, show also empty dates, but if there is a gap of more than
@@ -661,19 +755,19 @@ N days, just insert a special line indicating the size of the gap."
   :type 'hook)
 
 (defcustom org-agenda-mouse-1-follows-link nil
-  "Non-nil means, mouse-1 on a link will follow the link in the agenda.
+  "Non-nil means mouse-1 on a link will follow the link in the agenda.
 A longer mouse click will still set point.  Does not work on XEmacs.
 Needs to be set before org.el is loaded."
   :group 'org-agenda-startup
   :type 'boolean)
 
 (defcustom org-agenda-start-with-follow-mode nil
-  "The initial value of follow-mode in a newly created agenda window."
+  "The initial value of follow mode in a newly created agenda window."
   :group 'org-agenda-startup
   :type 'boolean)
 
 (defcustom org-agenda-show-outline-path t
-  "Non-il means, show outline path in echo area after line motion."
+  "Non-nil means show outline path in echo area after line motion."
   :group 'org-agenda-startup
   :type 'boolean)
 
@@ -707,7 +801,7 @@ have been removed when this is called, as will any matches for regular
 expressions listed in `org-agenda-entry-text-exclude-regexps'.")
 
 (defvar org-agenda-include-inactive-timestamps nil
-  "Non-nil means, include inactive time stamps in agenda and timeline.")
+  "Non-nil means include inactive time stamps in agenda and timeline.")
 
 (defgroup org-agenda-windows nil
   "Options concerning the windows used by the Agenda in Org Mode."
@@ -740,7 +834,7 @@ It only matters if `org-agenda-window-setup' is `reorganize-frame'."
   :type '(cons (number :tag "Minimum") (number :tag "Maximum")))
 
 (defcustom org-agenda-restore-windows-after-quit nil
-  "Non-nil means, restore window configuration open exiting agenda.
+  "Non-nil means restore window configuration open exiting agenda.
 Before the window configuration is changed for displaying the agenda,
 the current status is recorded.  When the agenda is exited with
 `q' or `x' and this option is set, the old state is restored.  If
@@ -757,7 +851,7 @@ Custom commands can set this variable in the options section."
   :type 'integer)
 
 (defcustom org-agenda-start-on-weekday 1
-  "Non-nil means, start the overview always on the specified weekday.
+  "Non-nil means start the overview always on the specified weekday.
 0 denotes Sunday, 1 denotes Monday etc.
 When nil, always start on the current day.
 Custom commands can set this variable in the options section."
@@ -766,7 +860,7 @@ Custom commands can set this variable in the options section."
                 (integer :tag "Weekday No.")))
 
 (defcustom org-agenda-show-all-dates t
-  "Non-nil means, `org-agenda' shows every day in the selected range.
+  "Non-nil means `org-agenda' shows every day in the selected range.
 When nil, only the days which actually have entries are shown."
   :group 'org-agenda-daily/weekly
   :type 'boolean)
@@ -805,6 +899,12 @@ This function makes sure that dates are aligned for easy reading."
     (format "%-10s %2d %s %4d%s"
            dayname day monthname year weekstring)))
 
+(defcustom org-agenda-time-leading-zero nil
+  "Non-nil means use leading zero for military times in agenda.
+For example, 9:30am would become 09:30 rather than  9:30."
+  :group 'org-agenda-daily/weekly
+  :type 'boolean)
+
 (defcustom org-agenda-weekend-days '(6 0)
   "Which days are weekend?
 These days get the special face `org-agenda-date-weekend' in the agenda
@@ -825,6 +925,12 @@ Custom commands can set this variable in the options section."
   :group 'org-agenda-daily/weekly
   :type 'boolean)
 
+(defcustom org-agenda-include-deadlines t
+  "If non-nil, include entries within their deadline warning period.
+Custom commands can set this variable in the options section."
+  :group 'org-agenda-daily/weekly
+  :type 'boolean)
+
 (defcustom org-agenda-include-all-todo nil
   "Set  means weekly/daily agenda will always contain all TODO entries.
 The TODO entries will be listed at the top of the agenda, before
@@ -834,7 +940,7 @@ This option is deprecated, it is better to define a block agenda instead."
   :type 'boolean)
 
 (defcustom org-agenda-repeating-timestamp-show-all t
-  "Non-nil means, show all occurrences of a repeating stamp in the agenda.
+  "Non-nil means show all occurrences of a repeating stamp in the agenda.
 When nil, only one occurrence is shown, either today or the
 nearest into the future."
   :group 'org-agenda-daily/weekly
@@ -861,7 +967,7 @@ the agenda to display all available LOG items temporarily."
   :type '(set :greedy t (const closed) (const clock) (const state)))
 
 (defcustom org-agenda-log-mode-add-notes t
-  "Non-nil means, add first line of notes to log entries in agenda views.
+  "Non-nil means add first line of notes to log entries in agenda views.
 If a log item like a state change or a clock entry is associated with
 notes, the first line of these notes will be added to the entry in the
 agenda display."
@@ -891,14 +997,40 @@ current display in the agenda."
   :group 'org-agenda-daily/weekly
   :type 'plist)
 
-(defcustom org-agenda-search-view-search-words-only nil
-  "Non-nil means, the search string is interpreted as individual words
-The search then looks for each word separately in each entry and
-selects entries that have matches for all words.
-When nil, matching as loose words will only take place if the first
-word is preceded by + or -.  If that is not the case, the search
-string will just be matched as a substring in the entry, but with
-each space character allowing for any whitespace, including newlines."
+(defcustom org-agenda-search-view-always-boolean nil
+  "Non-nil means the search string is interpreted as individual parts.
+
+The search string for search view can either be interpreted as a phrase,
+or as a list of snippets that define a boolean search for a number of
+strings.
+
+When this is non-nil, the string will be split on whitespace, and each
+snippet will be searched individually, and all must match in order to
+select an entry.  A snippet is then a single string of non-white
+characters, or a string in double quotes, or a regexp in {} braces.
+If a snippet is preceded by \"-\", the snippet must *not* match.
+\"+\" is syntactic sugar for positive selection.  Each snippet may
+be found as a full word or a partial word, but see the variable
+`org-agenda-search-view-force-full-words'.
+
+When this is nil, search will look for the entire search phrase as one,
+with each space character matching any amount of whitespace, including
+line breaks.
+
+Even when this is nil, you can still switch to Boolean search dynamically
+by preceding the first snippet with \"+\" or \"-\".  If the first snippet
+is a regexp marked with braces like \"{abc}\", this will also switch to
+boolean search."
+  :group 'org-agenda-search-view
+  :type 'boolean)
+
+(if (fboundp 'defvaralias)
+    (defvaralias 'org-agenda-search-view-search-words-only
+      'org-agenda-search-view-always-boolean))
+
+(defcustom org-agenda-search-view-force-full-words nil
+  "Non-nil means, search words must be matches as complete words.
+When nil, they may also match part of a word."
   :group 'org-agenda-search-view
   :type 'boolean)
 
@@ -908,7 +1040,7 @@ each space character allowing for any whitespace, including newlines."
   :group 'org-agenda)
 
 (defcustom org-agenda-search-headline-for-time t
-  "Non-nil means, search headline for a time-of-day.
+  "Non-nil means search headline for a time-of-day.
 If the headline contains a time-of-day in one format or another, it will
 be used to sort the entry into the time sequence of items for a day.
 Some people have time stamps in the headline that refer to the creation
@@ -919,7 +1051,7 @@ for a time."
   :type 'boolean)
 
 (defcustom org-agenda-use-time-grid t
-  "Non-nil means, show a time grid in the agenda schedule.
+  "Non-nil means show a time grid in the agenda schedule.
 A time grid is a set of lines for specific times (like every two hours between
 8:00 and 20:00).  The items scheduled for a day at specific times are
 sorted in between these lines.
@@ -993,6 +1125,8 @@ user-defined-up    Sort according to `org-agenda-cmp-user-defined', high last.
 user-defined-down  Sort according to `org-agenda-cmp-user-defined', high first.
 habit-up           Put entries that are habits first
 habit-down         Put entries that are habits last
+alpha-up           Sort headlines alphabetically
+alpha-down         Sort headlines alphabetically, reversed
 
 The different possibilities will be tried in sequence, and testing stops
 if one comparison returns a \"not-equal\".  For example, the default
@@ -1036,7 +1170,7 @@ part of an agenda sorting strategy."
   :type 'symbol)
 
 (defcustom org-sort-agenda-notime-is-late t
-  "Non-nil means, items without time are considered late.
+  "Non-nil means items without time are considered late.
 This is only relevant for sorting.  When t, items which have no explicit
 time like 15:30 will be considered as 99:01, i.e. later than any items which
 do have a time.  When nil, the default time is before 0:00.  You can use this
@@ -1046,7 +1180,7 @@ agenda entries."
   :type 'boolean)
 
 (defcustom org-sort-agenda-noeffort-is-high t
-  "Non-nil means, items without effort estimate are sorted as high effort.
+  "Non-nil means items without effort estimate are sorted as high effort.
 This also applies when filtering an agenda view with respect to the
 < or > effort operator.  Then, tasks with no effort defined will be treated
 as tasks with high effort.
@@ -1151,7 +1285,7 @@ range, respectively."
                  (function))))
 
 (defcustom org-agenda-scheduled-leaders '("Scheduled: " "Sched.%2dx: ")
-  "Text preceeding scheduled items in the agenda view.
+  "Text preceding scheduled items in the agenda view.
 This is a list with two strings.  The first applies when the item is
 scheduled on the current day.  The second applies when it has been scheduled
 previously, it may contain a %d indicating that this is the nth time that
@@ -1163,8 +1297,16 @@ that passed since this item was scheduled first."
          (string :tag "Scheduled today     ")
          (string :tag "Scheduled previously")))
 
+(defcustom org-agenda-inactive-leader "["
+  "Text preceding item pulled into the agenda by inactive time stamps.
+These entries are added to the agenda when pressing \"[\"."
+  :group 'org-agenda-line-format
+  :type '(list
+         (string :tag "Scheduled today     ")
+         (string :tag "Scheduled previously")))
+
 (defcustom org-agenda-deadline-leaders '("Deadline:  " "In %3d d.: ")
-  "Text preceeding deadline items in the agenda view.
+  "Text preceding deadline items in the agenda view.
 This is a list with two strings.  The first applies when the item has its
 deadline on the current day.  The second applies when it is in the past or
 in the future, it may contain %d to capture how many days away the deadline
@@ -1177,7 +1319,7 @@ is (was)."
                  (function))))
 
 (defcustom org-agenda-remove-times-when-in-prefix t
-  "Non-nil means, remove duplicate time specifications in agenda items.
+  "Non-nil means remove duplicate time specifications in agenda items.
 When the format `org-agenda-prefix-format' contains a `%t' specifier, a
 time-of-day specification in a headline or diary entry is extracted and
 placed into the prefix.  If this option is non-nil, the original specification
@@ -1185,7 +1327,7 @@ placed into the prefix.  If this option is non-nil, the original specification
 11:30-4pm) will be removed for agenda display.  This makes the agenda less
 cluttered.
 The option can be t or nil.  It may also be the symbol `beg', indicating
-that the time should only be removed what it is located at the beginning of
+that the time should only be removed when it is located at the beginning of
 the headline/diary entry."
   :group 'org-agenda-line-format
   :type '(choice
@@ -1193,6 +1335,11 @@ the headline/diary entry."
          (const :tag "Never" nil)
          (const :tag "When at beginning of entry" beg)))
 
+(defcustom org-agenda-remove-timeranges-from-blocks nil
+  "Non-nil means remove time ranges specifications in agenda
+items that span on several days."
+  :group 'org-agenda-line-format
+  :type 'boolean)
 
 (defcustom org-agenda-default-appointment-duration nil
   "Default duration for appointments that only have a starting time.
@@ -1204,14 +1351,14 @@ When non-nil, this must be the number of minutes, e.g. 60 for one hour."
          (const :tag "No default duration")))
 
 (defcustom org-agenda-show-inherited-tags t
-  "Non-nil means, show inherited tags in each agenda line."
+  "Non-nil means show inherited tags in each agenda line."
   :group 'org-agenda-line-format
   :type 'boolean)
 
 (defcustom org-agenda-hide-tags-regexp nil
   "Regular expression used to filter away specific tags in agenda views.
 This means that these tags will be present, but not be shown in the agenda
-line.  Secondayt filltering will still work on the hidden tags.
+line.  Secondary filtering will still work on the hidden tags.
 Nil means don't hide any tags."
   :group 'org-agenda-line-format
   :type '(choice
@@ -1219,7 +1366,7 @@ Nil means don't hide any tags."
          (string :tag "Regexp   ")))
 
 (defcustom org-agenda-remove-tags nil
-  "Non-nil means, remove the tags from the headline copy in the agenda.
+  "Non-nil means remove the tags from the headline copy in the agenda.
 When this is the symbol `prefix', only remove tags when
 `org-agenda-prefix-format' contains a `%T' specifier."
   :group 'org-agenda-line-format
@@ -1244,16 +1391,18 @@ it means that the tags should be flushright to that column.  For example,
     (defvaralias 'org-agenda-align-tags-to-column 'org-agenda-tags-column))
 
 (defcustom org-agenda-fontify-priorities 'cookies
-  "Non-nil means, highlight low and high priorities in agenda.
+  "Non-nil means highlight low and high priorities in agenda.
 When t, the highest priority entries are bold, lowest priority italic.
-However, settings in org-priority-faces will overrule these faces.
+However, settings in `org-priority-faces' will overrule these faces.
 When this variable is the symbol `cookies', only fontify the
 cookies, not the entire task.
 This may also be an association list of priority faces, whose
 keys are the character values of `org-highest-priority',
 `org-default-priority', and `org-lowest-priority' (the default values
-are ?A, ?B, and ?C, respectively).  The face may be a named face,
-or a list like `(:background \"Red\")'."
+are ?A, ?B, and ?C, respectively).  The face may be a named face, a
+color as a string, or a list like `(:background \"Red\")'.
+If it is a color, the variable `org-faces-easy-properties'
+determines if it is a foreground or a background color."
   :group 'org-agenda-line-format
   :type '(choice
          (const :tag "Never" nil)
@@ -1261,7 +1410,9 @@ or a list like `(:background \"Red\")'."
          (const :tag "Cookies only" cookies)
          (repeat :tag "Specify"
                  (list (character :tag "Priority" :value ?A)
-                       (sexp :tag "face")))))
+                       (choice    :tag "Face    "
+                                  (string :tag "Color")
+                                  (sexp :tag "Face"))))))
 
 (defgroup org-agenda-column-view nil
   "Options concerning column view in the agenda."
@@ -1269,12 +1420,12 @@ or a list like `(:background \"Red\")'."
   :group 'org-agenda)
 
 (defcustom org-agenda-columns-show-summaries t
-  "Non-nil means, show summaries for columns displayed in the agenda view."
+  "Non-nil means show summaries for columns displayed in the agenda view."
   :group 'org-agenda-column-view
   :type 'boolean)
 
 (defcustom org-agenda-columns-remove-prefix-from-item t
-  "Non-nil means, remove the prefix from a headline for agenda column view.
+  "Non-nil means remove the prefix from a headline for agenda column view.
 The special ITEM field in the columns format contains the current line, with
 all information shown in other columns (like the TODO state or a tag).
 When this variable is non-nil, also the agenda prefix will be removed from
@@ -1284,7 +1435,7 @@ headline can be shown in the limited width of the field."
   :type 'boolean)
 
 (defcustom org-agenda-columns-compute-summary-properties t
-  "Non-nil means, recompute all summary properties before column view.
+  "Non-nil means recompute all summary properties before column view.
 When column view in the agenda is listing properties that have a summary
 operator, it can go to all relevant buffers and recompute the summaries
 there.  This can mean overhead for the agenda column view, but is necessary
@@ -1295,7 +1446,7 @@ computations are current."
   :type 'boolean)
 
 (defcustom org-agenda-columns-add-appointments-to-effort-sum nil
-  "Non-nil means, the duration of an appointment will add to day effort.
+  "Non-nil means the duration of an appointment will add to day effort.
 The property to which appointment durations will be added is the one given
 in the option `org-effort-property'.  If an appointment does not have
 an end time, `org-agenda-default-appointment-duration' will be used.  If that
@@ -1309,7 +1460,10 @@ estimate."
 The sole argument to the function, which is called once for each
 possible tag, is a string giving the name of the tag.  The
 function should return either nil if the tag should be included
-as normal, or \"-<TAG>\" to exclude the tag."
+as normal, or \"-<TAG>\" to exclude the tag.
+Note that for the purpose of tag filtering, only the lower-case version of
+all tags will be considered, so that this function will only ever see
+the lower-case version of all tags."
   :group 'org-agenda
   :type 'function)
 
@@ -1342,7 +1496,7 @@ works you probably want to add it to `org-agenda-custom-commands' for good."
 (defvar org-agenda-redo-command nil)
 (defvar org-agenda-query-string nil)
 (defvar org-agenda-mode-hook nil
-  "Hook for org-agenda-mode, run after the mode is turned on.")
+  "Hook for `org-agenda-mode', run after the mode is turned on.")
 (defvar org-agenda-type nil)
 (defvar org-agenda-force-single-file nil)
 (defvar org-agenda-bulk-marked-entries) ;; Defined further down in this file
@@ -1456,6 +1610,7 @@ The following commands are available:
 (org-defkey org-agenda-mode-map "l" 'org-agenda-log-mode)
 (org-defkey org-agenda-mode-map "v" 'org-agenda-view-mode-dispatch)
 (org-defkey org-agenda-mode-map "D" 'org-agenda-toggle-diary)
+(org-defkey org-agenda-mode-map "!" 'org-agenda-toggle-deadlines)
 (org-defkey org-agenda-mode-map "G" 'org-agenda-toggle-time-grid)
 (org-defkey org-agenda-mode-map "r" 'org-agenda-redo)
 (org-defkey org-agenda-mode-map "g" 'org-agenda-redo)
@@ -1519,10 +1674,8 @@ The following commands are available:
 (org-defkey org-agenda-mode-map "\C-c\C-x\C-mg"    'org-mobile-pull)
 (org-defkey org-agenda-mode-map "\C-c\C-x\C-mp"    'org-mobile-push)
 
-(org-defkey org-agenda-mode-map
-  (if (featurep 'xemacs) [(button2)] [(mouse-2)]) 'org-agenda-goto-mouse)
-(org-defkey org-agenda-mode-map
-  (if (featurep 'xemacs) [(button3)] [(mouse-3)]) 'org-agenda-show-mouse)
+(org-defkey org-agenda-mode-map [mouse-2] 'org-agenda-goto-mouse)
+(org-defkey org-agenda-mode-map [mouse-3] 'org-agenda-show-mouse)
 (when org-agenda-mouse-1-follows-link
   (org-defkey org-agenda-mode-map [follow-link] 'mouse-face))
 (easy-menu-define org-agenda-menu org-agenda-mode-map "Agenda menu"
@@ -1556,6 +1709,9 @@ The following commands are available:
      ["Include Diary" org-agenda-toggle-diary
       :style toggle :selected org-agenda-include-diary
       :active (org-agenda-check-type nil 'agenda)]
+     ["Include Deadlines" org-agenda-toggle-deadlines
+      :style toggle :selected org-agenda-include-deadlines
+      :active (org-agenda-check-type nil 'agenda)]
      ["Use Time Grid" org-agenda-toggle-time-grid
       :style toggle :selected org-agenda-use-time-grid
       :active (org-agenda-check-type nil 'agenda)]
@@ -1674,7 +1830,7 @@ The following commands are available:
 ;;; Agenda undo
 
 (defvar org-agenda-allow-remote-undo t
-  "Non-nil means, allow remote undo from the agenda buffer.")
+  "Non-nil means allow remote undo from the agenda buffer.")
 (defvar org-agenda-undo-list nil
   "List of undoable operations in the agenda since last refresh.")
 (defvar org-agenda-undo-has-started-in nil
@@ -1820,7 +1976,6 @@ Pressing `<' twice means to restrict to the current subtree or region
            (move-marker org-agenda-restrict-end
                         (progn (org-end-of-subtree t)))))))
 
-      (require 'calendar)  ; FIXME: can we avoid this for some commands?
       ;; For example the todo list should not need it (but does...)
       (cond
        ((setq entry (assoc keys org-agenda-custom-commands))
@@ -2109,7 +2264,7 @@ s   Search for keywords                 C   Configure custom agenda commands
 If CMD-KEY is a string of length 1, it is used as a key in
 `org-agenda-custom-commands' and triggers this command.  If it is a
 longer string it is used as a tags/todo match string.
-Paramters are alternating variable names and values that will be bound
+Parameters are alternating variable names and values that will be bound
 before running the agenda command."
   (let (pars)
     (while parameters
@@ -2137,7 +2292,7 @@ before running the agenda command."
 If CMD-KEY is a string of length 1, it is used as a key in
 `org-agenda-custom-commands' and triggers this command.  If it is a
 longer string it is used as a tags/todo match string.
-Paramters are alternating variable names and values that will be bound
+Parameters are alternating variable names and values that will be bound
 before running the agenda command.
 
 The output gives a line for each selected agenda item.  Each
@@ -2186,14 +2341,14 @@ agenda-day   The day in the agenda where this is listed"
          (princ
           (org-encode-for-stdout
            (mapconcat 'org-agenda-export-csv-mapper
-                      '(org-category txt type todo tags date time-of-day extra
+                      '(org-category txt type todo tags date time extra
                                      priority-letter priority agenda-day)
                      ",")))
          (princ "\n"))))))
 
 (defun org-fix-agenda-info (props)
-  "Make sure all properties on an agenda item have a canonical form,
-so the export commands can easily use it."
+  "Make sure all properties on an agenda item have a canonical form.
+This ensures the export commands can easily use it."
   (let (tmp re)
     (when (setq tmp (plist-get props 'tags))
       (setq props (plist-put props 'tags (mapconcat 'identity tmp ":"))))
@@ -2299,7 +2454,7 @@ higher priority settings."
    ((string-match "\\.html?\\'" file) (require 'htmlize))
    ((string-match "\\.ps\\'" file) (require 'ps-print)))
   (org-let (if nosettings nil org-agenda-exporter-settings)
-    '(save-excursion
+    `(save-excursion
        (save-window-excursion
         (org-agenda-mark-filtered-text)
         (let ((bs (copy-sequence (buffer-string))) beg)
@@ -2331,14 +2486,14 @@ higher priority settings."
               (message "HTML written to %s" file))
              ((string-match "\\.ps\\'" file)
               (require 'ps-print)
-              (flet ((ps-get-buffer-name () "Agenda View"))
-                (ps-print-buffer-with-faces file))
+              ,(flet ((ps-get-buffer-name () "Agenda View"))
+                 (ps-print-buffer-with-faces file))
               (message "Postscript written to %s" file))
              ((string-match "\\.pdf\\'" file)
               (require 'ps-print)
-              (flet ((ps-get-buffer-name () "Agenda View"))
-                (ps-print-buffer-with-faces
-                 (concat (file-name-sans-extension file) ".ps")))
+              ,(flet ((ps-get-buffer-name () "Agenda View"))
+                 (ps-print-buffer-with-faces
+                  (concat (file-name-sans-extension file) ".ps")))
               (call-process "ps2pdf" nil nil nil
                             (expand-file-name
                              (concat (file-name-sans-extension file) ".ps"))
@@ -2371,9 +2526,9 @@ higher priority settings."
   (let ((inhibit-read-only t))
     (mapc
      (lambda (o)
-       (when (equal (org-overlay-buffer o) (current-buffer))
+       (when (equal (overlay-buffer o) (current-buffer))
         (put-text-property
-         (org-overlay-start o) (org-overlay-end o)
+         (overlay-start o) (overlay-end o)
          'org-filtered t)))
      org-agenda-filter-overlays)))
 
@@ -2559,7 +2714,7 @@ removed from the entry content.  Currently only `planning' is allowed here."
 (defvar org-agenda-filter nil)
 (defvar org-agenda-filter-preset nil
   "A preset of the tags filter used for secondary agenda filtering.
-This must be a list of strings, each string must be a single tag preceeded
+This must be a list of strings, each string must be a single tag preceded
 by \"+\" or \"-\".
 This variable should not be set directly, but agenda custom commands can
 bind it in the options section.")
@@ -2568,7 +2723,8 @@ bind it in the options section.")
   (setq org-todo-keywords-for-agenda nil)
   (setq org-done-keywords-for-agenda nil)
   (setq org-drawers-for-agenda nil)
-  (setq org-agenda-filter nil)
+  (unless org-agenda-persistent-filter
+    (setq org-agenda-filter nil))
   (put 'org-agenda-filter :preset-filter org-agenda-filter-preset)
   (if org-agenda-multi
       (progn
@@ -2643,16 +2799,16 @@ bind it in the options section.")
          (org-habit-insert-consistency-graphs))
       (run-hooks 'org-finalize-agenda-hook)
       (setq org-agenda-type (org-get-at-bol 'org-agenda-type))
-      (when (get 'org-agenda-filter :preset-filter)
+      (when (or org-agenda-filter (get 'org-agenda-filter :preset-filter))
        (org-agenda-filter-apply org-agenda-filter))
       )))
 
 (defun org-agenda-mark-clocking-task ()
   "Mark the current clock entry in the agenda if it is present."
   (mapc (lambda (o)
-         (if (eq (org-overlay-get o 'type) 'org-agenda-clocking)
-             (org-delete-overlay o)))
-       (org-overlays-in (point-min) (point-max)))
+         (if (eq (overlay-get o 'type) 'org-agenda-clocking)
+             (delete-overlay o)))
+       (overlays-in (point-min) (point-max)))
   (when (marker-buffer org-clock-hd-marker)
     (save-excursion
       (goto-char (point-min))
@@ -2661,18 +2817,18 @@ bind it in the options section.")
          (goto-char s)
          (when (equal (org-get-at-bol 'org-hd-marker)
                       org-clock-hd-marker)
-           (setq ov (org-make-overlay (point-at-bol) (1+ (point-at-eol))))
-           (org-overlay-put ov 'type 'org-agenda-clocking)
-           (org-overlay-put ov 'face 'org-agenda-clocking)
-           (org-overlay-put ov 'help-echo
+           (setq ov (make-overlay (point-at-bol) (1+ (point-at-eol))))
+           (overlay-put ov 'type 'org-agenda-clocking)
+           (overlay-put ov 'face 'org-agenda-clocking)
+           (overlay-put ov 'help-echo
                             "The clock is running in this item")))))))
 
 (defun org-agenda-fontify-priorities ()
   "Make highest priority lines bold, and lowest italic."
   (interactive)
-  (mapc (lambda (o) (if (eq (org-overlay-get o 'org-type) 'org-priority)
-                       (org-delete-overlay o)))
-       (org-overlays-in (point-min) (point-max)))
+  (mapc (lambda (o) (if (eq (overlay-get o 'org-type) 'org-priority)
+                       (delete-overlay o)))
+       (overlays-in (point-min) (point-max)))
   (save-excursion
     (let ((inhibit-read-only t)
          b e p ov h l)
@@ -2687,21 +2843,25 @@ bind it in the options section.")
              e (if (eq org-agenda-fontify-priorities 'cookies)
                    (match-end 0)
                  (point-at-eol))
-             ov (org-make-overlay b e))
-       (org-overlay-put
+             ov (make-overlay b e))
+       (overlay-put
         ov 'face
-        (cond ((cdr (assoc p org-priority-faces)))
+        (cond ((org-face-from-face-or-color
+                'priority nil
+                (cdr (assoc p org-priority-faces))))
               ((and (listp org-agenda-fontify-priorities)
-                    (cdr (assoc p org-agenda-fontify-priorities))))
+                    (org-face-from-face-or-color
+                     'priority nil
+                     (cdr (assoc p org-agenda-fontify-priorities)))))
               ((equal p l) 'italic)
               ((equal p h) 'bold)))
-       (org-overlay-put ov 'org-type 'org-priority)))))
+       (overlay-put ov 'org-type 'org-priority)))))
 
 (defun org-agenda-dim-blocked-tasks ()
   "Dim currently blocked TODO's in the agenda display."
-  (mapc (lambda (o) (if (eq (org-overlay-get o 'org-type) 'org-blocked-todo)
-                       (org-delete-overlay o)))
-       (org-overlays-in (point-min) (point-max)))
+  (mapc (lambda (o) (if (eq (overlay-get o 'org-type) 'org-blocked-todo)
+                       (delete-overlay o)))
+       (overlays-in (point-min) (point-max)))
   (save-excursion
     (let ((inhibit-read-only t)
          (org-depend-tag-blocked nil)
@@ -2730,11 +2890,11 @@ bind it in the options section.")
                        (max (point-min) (1- (point-at-bol)))
                      (point-at-bol))
                  e (point-at-eol)
-                 ov (org-make-overlay b e))
+                 ov (make-overlay b e))
            (if invis1
-               (org-overlay-put ov 'invisible t)
-             (org-overlay-put ov 'face 'org-agenda-dimmed-todo-face))
-           (org-overlay-put ov 'org-type 'org-blocked-todo)))))))
+               (overlay-put ov 'invisible t)
+             (overlay-put ov 'face 'org-agenda-dimmed-todo-face))
+           (overlay-put ov 'org-type 'org-blocked-todo)))))))
 
 (defvar org-agenda-skip-function nil
   "Function to be called at each match during agenda construction.
@@ -2745,7 +2905,7 @@ This may also be a Lisp form, it will be evaluated.
 Never set this variable using `setq' or so, because then it will apply
 to all future agenda commands.  Instead, bind it with `let' to scope
 it dynamically into the agenda-constructing command.  A good way to set
-it is through options in org-agenda-custom-commands.")
+it is through options in `org-agenda-custom-commands'.")
 
 (defun org-agenda-skip ()
   "Throw to `:skip' in places that should be skipped.
@@ -2807,10 +2967,10 @@ no longer in use."
                            (org-agenda-get-some-entry-text
                             m org-agenda-entry-text-maxlines "    > "))))
     (when (string-match "\\S-" txt)
-      (setq o (org-make-overlay (point-at-bol) (point-at-eol)))
-      (org-overlay-put o 'evaporate t)
-      (org-overlay-put o 'org-overlay-type 'agenda-entry-content)
-      (org-overlay-put o 'after-string txt))))
+      (setq o (make-overlay (point-at-bol) (point-at-eol)))
+      (overlay-put o 'evaporate t)
+      (overlay-put o 'org-overlay-type 'agenda-entry-content)
+      (overlay-put o 'after-string txt))))
 
 (defun org-agenda-entry-text-show ()
   "Add entry context for all agenda lines."
@@ -2827,10 +2987,10 @@ no longer in use."
   "Remove any shown entry context."
   (delq nil
        (mapcar (lambda (o)
-                 (if (eq (org-overlay-get o 'org-overlay-type)
+                 (if (eq (overlay-get o 'org-overlay-type)
                          'agenda-entry-content)
-                     (progn (org-delete-overlay o) t)))
-               (org-overlays-in (point-min) (point-max)))))
+                     (progn (delete-overlay o) t)))
+               (overlays-in (point-min) (point-max)))))
 
 ;;; Agenda timeline
 
@@ -2844,7 +3004,6 @@ under the current date.
 If the buffer contains an active region, only check the region for
 dates."
   (interactive "P")
-  (require 'calendar)
   (org-compile-prefix-format 'timeline)
   (org-set-sorting-strategy 'timeline)
   (let* ((dopast t)
@@ -2976,11 +3135,44 @@ When EMPTY is non-nil, also include days without any entries."
 (defvar org-agenda-start-day nil  ; dynamically scoped parameter
 "Custom commands can set this variable in the options section.")
 (defvar org-agenda-last-arguments nil
-  "The arguments of the previous call to org-agenda")
+  "The arguments of the previous call to `org-agenda'.")
 (defvar org-starting-day nil) ; local variable in the agenda buffer
 (defvar org-agenda-span nil) ; local variable in the agenda buffer
 (defvar org-include-all-loc nil) ; local variable
 
+(defvar org-agenda-entry-types '(:deadline :scheduled :timestamp :sexp)
+  "List of types searched for when creating the daily/weekly agenda.
+This variable is a list of symbols that controls the types of
+items that appear in the daily/weekly agenda.  Allowed symbols in this
+list are are
+
+   :timestamp    List items containing a date stamp or date range matching
+                 the selected date.  This includes sexp entries in
+                 angular brackets.
+
+   :sexp         List entries resulting from plain diary-like sexps.
+
+   :deadline     List deadline due on that date.  When the date is today,
+                 also list any deadlines past due, or due within
+                `org-deadline-warning-days'.  `:deadline' must appear before
+                 `:scheduled' if the setting of
+                 `org-agenda-skip-scheduled-if-deadline-is-shown' is to have
+                 any effect.
+
+   :scheduled    List all items which are scheduled for the given date.
+                The diary for *today* also contains items which were
+                scheduled earlier and are not yet marked DONE.
+
+By default, all four types are turned on.
+
+Never set this variable globally using `setq', because then it
+will apply to all future agenda commands.  Instead, bind it with
+`let' to scope it dynamically into the the agenda-constructing
+command.  A good way to set it is through options in
+`org-agenda-custom-commands'.  For a more flexible (though
+somewhat less efficient) way of determining what is included in
+the daily/weekly agenda, see `org-agenda-skip-function'.")
+
 ;;;###autoload
 (defun org-agenda-list (&optional include-all start-day ndays)
   "Produce a daily/weekly view from all files in variable `org-agenda-files'.
@@ -3013,7 +3205,6 @@ given in `org-agenda-start-on-weekday'."
   (setq org-agenda-last-arguments (list include-all start-day ndays))
   (org-compile-prefix-format 'agenda)
   (org-set-sorting-strategy 'agenda)
-  (require 'calendar)
   (let* ((org-agenda-start-on-weekday
          (if (or (equal ndays 7) (and (null ndays) (equal 7 org-agenda-ndays)))
              org-agenda-start-on-weekday nil))
@@ -3104,18 +3295,22 @@ given in `org-agenda-start-on-weekday'."
       (while (setq file (pop files))
        (catch 'nextfile
          (org-check-agenda-file file)
-         (cond
-          ((eq org-agenda-show-log 'only)
-           (setq rtn (org-agenda-get-day-entries
-                      file date :closed)))
-          (org-agenda-show-log
-           (setq rtn (org-agenda-get-day-entries
-                      file date
-                      :deadline :scheduled :timestamp :sexp :closed)))
-          (t
-           (setq rtn (org-agenda-get-day-entries
-                      file date
-                      :deadline :scheduled :sexp :timestamp))))
+         (let ((org-agenda-entry-types org-agenda-entry-types))
+           (unless org-agenda-include-deadlines
+             (setq org-agenda-entry-types
+                   (delq :deadline org-agenda-entry-types)))
+           (cond
+            ((eq org-agenda-show-log 'only)
+             (setq rtn (org-agenda-get-day-entries
+                        file date :closed)))
+            (org-agenda-show-log
+             (setq rtn (apply 'org-agenda-get-day-entries
+                              file date
+                              (append '(:closed) org-agenda-entry-types))))
+            (t
+             (setq rtn (apply 'org-agenda-get-day-entries
+                              file date
+                              org-agenda-entry-types)))))
          (setq rtnall (append rtnall rtn))))
       (if org-agenda-include-diary
          (let ((org-agenda-search-headline-for-time t))
@@ -3195,11 +3390,11 @@ that when \"+Ameli\" is searched as a work, it will also match \"Ameli's\"")
     (modify-syntax-entry ?` "." org-search-syntax-table))
   org-search-syntax-table)
 
+(defvar org-agenda-last-search-view-search-was-boolean nil)
+
 ;;;###autoload
 (defun org-search-view (&optional todo-only string edit-at)
-  "Show all entries that contain words or regular expressions.
-If the first character of the search string is an asterisks,
-search only the headlines.
+  "Show all entries that contain a phrase or words or regular expressions.
 
 With optional prefix argument TODO-ONLY, only consider entries that are
 TODO entries.  The argument STRING can be used to pass a default search
@@ -3207,28 +3402,37 @@ string into this function.  If EDIT-AT is non-nil, it means that the
 user should get a chance to edit this string, with cursor at position
 EDIT-AT.
 
-The search string is broken into \"words\" by splitting at whitespace.
-Depending on the variable `org-agenda-search-view-search-words-only'
-and on whether the first character in the search string is \"+\" or \"-\",
-The string is then interpreted either as a substring with variable amounts
-of whitespace, or as a list or individual words that should be matched.
-
-The default is a substring match, where each space in the search string
-can expand to an arbitrary amount of whitespace, including newlines.
-
-If matching individual words, these words are then interpreted as a
-boolean expression with logical AND.  Words prefixed with a minus must
-not occur in the entry. Words without a prefix or prefixed with a plus
-must occur in the entry.  Matching is case-insensitive and the words
-are enclosed by word delimiters.
-
-Words enclosed by curly braces are interpreted as regular expressions
-that must or must not match in the entry.
-
-If the search string starts with an asterisk, search only in headlines.
-If (possibly after the leading star) the search string starts with an
-exclamation mark, this also means to look at TODO entries only, an effect
-that can also be achieved with a prefix argument.
+The search string can be viewed either as a phrase that should be found as
+is, or it can be broken into a number of snippets, each of which must match
+in a Boolean way to select an entry.  The default depends on the variable
+`org-agenda-search-view-always-boolean'.
+Even if this is turned off (the default) you can always switch to
+Boolean search dynamically by preceding the first word with  \"+\" or \"-\".
+
+The default is a direct search of the whole phrase, where each space in
+the search string can expand to an arbitrary amount of whitespace,
+including newlines.
+
+If using a Boolean search, the search string is split on whitespace and
+each snippet is searched separately, with logical AND to select an entry.
+Words prefixed with a minus must *not* occur in the entry.  Words without
+a prefix or prefixed with a plus must occur in the entry.  Matching is
+case-insensitive.  Words are enclosed by word delimiters (i.e. they must
+match whole words, not parts of a word) if
+`org-agenda-search-view-force-full-words' is set (default is nil).
+
+Boolean search snippets enclosed by curly braces are interpreted as
+regular expressions that must or (when preceded with \"-\") must not
+match in the entry.  Snippets enclosed into double quotes will be taken
+as a whole, to include whitespace.
+
+- If the search string starts with an asterisk, search only in headlines.
+- If (possibly after the leading star) the search string starts with an
+  exclamation mark, this also means to look at TODO entries only, an effect
+  that can also be achieved with a prefix argument.
+- If (possibly after star and exclamation mark) the search string starts
+  with a colon, this will mean that the (non-regexp) snippets of the
+  Boolean search must match as full words.
 
 This command searches the agenda files, and in addition the files listed
 in `org-agenda-text-search-extra-files'."
@@ -3243,17 +3447,22 @@ in `org-agenda-text-search-extra-files'."
                      'org-complex-heading-regexp org-complex-heading-regexp
                      'mouse-face 'highlight
                      'help-echo (format "mouse-2 or RET jump to location")))
+        (full-words org-agenda-search-view-force-full-words)
+        (org-agenda-text-search-extra-files org-agenda-text-search-extra-files)
         regexp rtn rtnall files file pos
-        marker category tags c neg re as-words
+        marker category tags c neg re boolean
         ee txt beg end words regexps+ regexps- hdl-only buffer beg1 str)
     (unless (and (not edit-at)
                 (stringp string)
                 (string-match "\\S-" string))
-      (setq string (read-string "[+-]Word/{Regexp} ...: "
-                               (cond
-                                ((integerp edit-at) (cons string edit-at))
-                                (edit-at string))
-                               'org-agenda-search-history)))
+      (setq string (read-string
+                   (if org-agenda-search-view-always-boolean
+                       "[+-]Word/{Regexp} ...: "
+                     "Phrase, or [+-]Word/{Regexp} ...: ")
+                   (cond
+                    ((integerp edit-at) (cons string edit-at))
+                    (edit-at string))
+                   'org-agenda-search-history)))
     (org-set-local 'org-todo-only todo-only)
     (setq org-agenda-redo-command
          (list 'org-search-view (if todo-only t nil) string
@@ -3267,21 +3476,41 @@ in `org-agenda-text-search-extra-files'."
     (when (equal (string-to-char words) ?!)
       (setq todo-only t
            words (substring words 1)))
-    (if (or org-agenda-search-view-search-words-only
-           (member (string-to-char string) '(?- ?+)))
-       (setq as-words t))
+    (when (equal (string-to-char words) ?:)
+      (setq full-words t
+           words (substring words 1)))
+    (if (or org-agenda-search-view-always-boolean
+           (member (string-to-char words) '(?- ?+ ?\{)))
+       (setq boolean t))
     (setq words (org-split-string words))
-    (if as-words
+    (setq org-agenda-last-search-view-search-was-boolean boolean)
+    (when boolean
+      (let (wds w)
+       (while (setq w (pop words))
+         (if (or (equal (substring w 0 1) "\"")
+                 (and (> (length w) 1)
+                      (member (substring w 0 1) '("+" "-"))
+                      (equal (substring w 1 2) "\"")))
+             (while (and words (not (equal (substring w -1) "\"")))
+               (setq w (concat w " " (pop words)))))
+         (and (string-match "\\`\\([-+]?\\)\"" w)
+              (setq w (replace-match "\\1" nil nil w)))
+         (and (equal (substring w -1) "\"") (setq w (substring w 0 -1)))
+         (push w wds))
+       (setq words (nreverse wds))))
+    (if boolean
        (mapc (lambda (w)
                (setq c (string-to-char w))
                (if (equal c ?-)
                    (setq neg t w (substring w 1))
                  (if (equal c ?+)
                      (setq neg nil w (substring w 1))
-                 (setq neg nil)))
+                   (setq neg nil)))
                (if (string-match "\\`{.*}\\'" w)
                    (setq re (substring w 1 -1))
-                 (setq re (concat "\\<" (regexp-quote (downcase w)) "\\>")))
+                 (if full-words
+                     (setq re (concat "\\<" (regexp-quote (downcase w)) "\\>"))
+                   (setq re (regexp-quote (downcase w)))))
                (if neg (push re regexps-) (push re regexps+)))
              words)
       (push (mapconcat (lambda (w) (regexp-quote w)) words "\\s-+")
@@ -3397,16 +3626,16 @@ in `org-agenda-text-search-extra-files'."
 
 ;;;###autoload
 (defun org-todo-list (arg)
-  "Show all TODO entries from all agenda file in a single list.
+  "Show all (not done) TODO entries from all agenda file in a single list.
 The prefix arg can be used to select a specific TODO keyword and limit
 the list to these.  When using \\[universal-argument], you will be prompted
 for a keyword.  A numeric prefix directly selects the Nth keyword in
 `org-todo-keywords-1'."
   (interactive "P")
-  (require 'calendar)
   (org-compile-prefix-format 'todo)
   (org-set-sorting-strategy 'todo)
   (org-prepare-agenda "TODO")
+  (if (and (stringp arg) (not (string-match "\\S-" arg))) (setq arg nil))
   (let* ((today (time-to-days (current-time)))
         (date (calendar-gregorian-from-absolute today))
         (kwds org-todo-keywords-for-agenda)
@@ -3475,11 +3704,12 @@ The prefix arg TODO-ONLY limits the search to TODO entries."
   (org-compile-prefix-format 'tags)
   (org-set-sorting-strategy 'tags)
   (let* ((org-tags-match-list-sublevels
-;??????          (if todo-only t org-tags-match-list-sublevels))
          org-tags-match-list-sublevels)
         (completion-ignore-case t)
         rtn rtnall files file pos matcher
         buffer)
+    (when (and (stringp match) (not (string-match "\\S-" match)))
+      (setq match nil))
     (setq matcher (org-make-tags-matcher match)
          match (car matcher) matcher (cdr matcher))
     (org-prepare-agenda (concat "TAGS " match))
@@ -3548,7 +3778,7 @@ This variable should not be set directly, but custom commands can bind it
 in the options section.")
 
 (defun org-agenda-skip-entry-when-regexp-matches ()
-  "Checks if the current entry contains match for `org-agenda-skip-regexp'.
+  "Check if the current entry contains match for `org-agenda-skip-regexp'.
 If yes, it returns the end position of this entry, causing agenda commands
 to skip the entry but continuing the search in the subtree.  This is a
 function that can be put into `org-agenda-skip-function' for the duration
@@ -3560,7 +3790,7 @@ of a command."
     (and skip end)))
 
 (defun org-agenda-skip-subtree-when-regexp-matches ()
-  "Checks if the current subtree contains match for `org-agenda-skip-regexp'.
+  "Check if the current subtree contains match for `org-agenda-skip-regexp'.
 If yes, it returns the end position of this tree, causing agenda commands
 to skip this subtree.  This is a function that can be put into
 `org-agenda-skip-function' for the duration of a command."
@@ -3571,7 +3801,7 @@ to skip this subtree.  This is a function that can be put into
     (and skip end)))
 
 (defun org-agenda-skip-entry-when-regexp-matches-in-subtree ()
-  "Checks if the current subtree contains match for `org-agenda-skip-regexp'.
+  "Check if the current subtree contains match for `org-agenda-skip-regexp'.
 If yes, it returns the end position of the current entry (NOT the tree),
 causing agenda commands to skip the entry but continuing the search in
 the subtree.  This is a function that can be put into
@@ -3610,10 +3840,26 @@ timestamp     Check if there is a timestamp (also deadline or scheduled)
 nottimestamp  Check if there is no timestamp (also deadline or scheduled)
 regexp        Check if regexp matches
 notregexp     Check if regexp does not match.
+todo          Check if TODO keyword matches
+nottodo       Check if TODO keyword does not match
 
 The regexp is taken from the conditions list, it must come right after
 the `regexp' or `notregexp' element.
 
+`todo' and `nottodo' accept as an argument a list of todo
+keywords, which may include \"*\" to match any todo keyword.
+
+    (org-agenda-skip-entry-if 'todo '(\"TODO\" \"WAITING\"))
+
+would skip all entries with \"TODO\" or \"WAITING\" keywords.
+
+Instead of a list a keyword class may be given
+
+    (org-agenda-skip-entry-if 'nottodo 'done)
+
+would skip entries that haven't been marked with any of \"DONE\"
+keywords. Possible classes are: `todo', `done', `any'.
+
 If any of these conditions is met, this function returns the end point of
 the entity, causing the search to continue from there.  This is a function
 that can be put into `org-agenda-skip-function' for the duration of a command."
@@ -3643,9 +3889,45 @@ that can be put into `org-agenda-skip-function' for the duration of a command."
           (re-search-forward (nth 1 m) end t))
       (and (setq m (memq 'notregexp conditions))
           (stringp (nth 1 m))
-          (not (re-search-forward (nth 1 m) end t))))
+          (not (re-search-forward (nth 1 m) end t)))
+      (and (or
+           (setq m (memq 'todo conditions))
+           (setq m (memq 'nottodo conditions)))
+          (org-agenda-skip-if-todo m end)))
      end)))
 
+(defun org-agenda-skip-if-todo (args end)
+  "Helper function for `org-agenda-skip-if', do not use it directly.
+ARGS is a list with first element either `todo' or `nottodo'.
+The remainder is either a list of TODO keywords, or a state symbol
+`todo' or `done' or `any'."
+  (let ((kw (car args))
+       (arg (cadr args))
+       todo-wds todo-re)
+    (setq todo-wds
+         (org-uniquify
+          (cond
+           ((listp arg)   ;; list of keywords
+            (if (member "*" arg)
+                (mapcar 'substring-no-properties org-todo-keywords-1)
+              arg))
+           ((symbolp arg) ;; keyword class name
+            (cond
+             ((eq arg 'todo)
+              (org-delete-all org-done-keywords
+                              (mapcar 'substring-no-properties
+                                      org-todo-keywords-1)))
+             ((eq arg 'done) org-done-keywords)
+             ((eq arg 'any)
+              (mapcar 'substring-no-properties org-todo-keywords-1)))))))
+    (setq todo-re
+         (concat "^\\*+[ \t]+\\<\\("
+                 (mapconcat 'identity todo-wds  "\\|")
+                 "\\)\\>"))
+    (if (eq kw 'todo)
+       (re-search-forward todo-re end t)
+      (not (re-search-forward todo-re end t)))))
+
 ;;;###autoload
 (defun org-agenda-list-stuck-projects (&rest ignore)
   "Create agenda view for projects that are stuck.
@@ -3706,7 +3988,6 @@ MATCH is being ignored."
   "Get the (Emacs Calendar) diary entries for DATE."
   (require 'diary-lib)
   (let* ((diary-fancy-buffer "*temporary-fancy-diary-buffer*")
-        (fancy-diary-buffer diary-fancy-buffer)
         (diary-display-hook '(fancy-diary-display))
         (diary-display-function 'fancy-diary-display)
         (pop-up-frames nil)
@@ -3744,7 +4025,7 @@ MATCH is being ignored."
               (setq x (org-format-agenda-item "" x "Diary" nil 'time))
               ;; Extend the text properties to the beginning of the line
               (org-add-props x (text-properties-at (1- (length x)) x)
-                'type "diary" 'date date))
+                'type "diary" 'date date 'face 'org-agenda-diary))
             entries)))))
 
 (defvar org-agenda-cleanup-fancy-diary-hook nil
@@ -3811,33 +4092,16 @@ Needed to avoid empty dates which mess up holiday display."
       (apply 'diary-add-to-list args)
     (apply 'add-to-diary-list args)))
 
+(defvar org-diary-last-run-time nil)
+
 ;;;###autoload
 (defun org-diary (&rest args)
   "Return diary information from org-files.
 This function can be used in a \"sexp\" diary entry in the Emacs calendar.
 It accesses org files and extracts information from those files to be
 listed in the diary.  The function accepts arguments specifying what
-items should be listed.  The following arguments are allowed:
-
-   :timestamp    List the headlines of items containing a date stamp or
-                date range matching the selected date.  Deadlines will
-                also be listed, on the expiration day.
-
-   :sexp         List entries resulting from diary-like sexps.
-
-   :deadline     List any deadlines past due, or due within
-                `org-deadline-warning-days'.  The listing occurs only
-                in the diary for *today*, not at any other date.  If
-                an entry is marked DONE, it is no longer listed.
-
-   :scheduled    List all items which are scheduled for the given date.
-                The diary for *today* also contains items which were
-                scheduled earlier and are not yet marked DONE.
-
-   :todo         List all TODO items from the org-file.  This may be a
-                long list - so this is not turned on by default.
-                Like deadlines, these entries only show up in the
-                diary for *today*, not at any other date.
+items should be listed.  For a list of arguments allowed here, see the
+variable `org-agenda-entry-types'.
 
 The call in the diary file should look like this:
 
@@ -3867,8 +4131,14 @@ function from a program - use `org-agenda-get-day-entries' instead."
   (let* ((files (if (and entry (stringp entry) (string-match "\\S-" entry))
                    (list entry)
                  (org-agenda-files t)))
+        (time (org-float-time))
         file rtn results)
-    (org-prepare-agenda-buffers files)
+    (when (or (not org-diary-last-run-time)
+             (> (- time
+                   org-diary-last-run-time)
+                3))
+      (org-prepare-agenda-buffers files))
+    (setq org-diary-last-run-time time)
     ;; If this is called during org-agenda, don't return any entries to
     ;; the calendar.  Org Agenda will list these entries itself.
     (if org-disable-agenda-to-diary (setq files nil))
@@ -3986,8 +4256,9 @@ the documentation of `org-diary'."
     (nreverse ee)))
 
 ;;;###autoload
-(defun org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item (&optional end)
-  "Do we have a reason to ignore this todo entry because it has a time stamp?"
+(defun org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item
+  (&optional end)
+  "Do we have a reason to ignore this TODO entry because it has a time stamp?"
   (when (or org-agenda-todo-ignore-with-date
            org-agenda-todo-ignore-scheduled
            org-agenda-todo-ignore-deadlines)
@@ -3996,10 +4267,24 @@ the documentation of `org-diary'."
       (or (and org-agenda-todo-ignore-with-date
               (re-search-forward org-ts-regexp end t))
          (and org-agenda-todo-ignore-scheduled
-              (re-search-forward org-scheduled-time-regexp end t))
+              (re-search-forward org-scheduled-time-regexp end t)
+              (cond
+               ((eq org-agenda-todo-ignore-scheduled 'future)
+                (> (org-days-to-time (match-string 1)) 0))
+               ((eq org-agenda-todo-ignore-scheduled 'past)
+                (<= (org-days-to-time (match-string 1)) 0))
+               (t)))
          (and org-agenda-todo-ignore-deadlines
               (re-search-forward org-deadline-time-regexp end t)
-              (org-deadline-close (match-string 1)))))))
+              (cond
+               ((memq org-agenda-todo-ignore-deadlines '(t all)) t)
+               ((eq org-agenda-todo-ignore-deadlines 'far)
+                (not (org-deadline-close (match-string 1))))
+               ((eq org-agenda-todo-ignore-deadlines 'future)
+                (> (org-days-to-time (match-string 1)) 0))
+               ((eq org-agenda-todo-ignore-deadlines 'past)
+                (<= (org-days-to-time (match-string 1)) 0))
+               (t (org-deadline-close (match-string 1)))))))))
 
 (defconst org-agenda-no-heading-message
   "No heading for this item in buffer or region.")
@@ -4064,7 +4349,7 @@ the documentation of `org-diary'."
              clockp (and org-agenda-include-inactive-timestamps
                          (or (string-match org-clock-string tmp)
                              (string-match "]-+\\'" tmp)))
-             todo-state (org-get-todo-state)
+             todo-state (ignore-errors (org-get-todo-state))
              donep (member todo-state org-done-keywords))
        (if (or scheduledp deadlinep closedp clockp
                (and donep org-agenda-skip-timestamp-if-done))
@@ -4083,7 +4368,7 @@ the documentation of `org-diary'."
            (looking-at "\\*+[ \t]+\\([^\r\n]+\\)")
            (setq head (match-string 1))
            (setq txt (org-format-agenda-item
-                      (if inactivep "[" nil)
+                      (if inactivep org-agenda-inactive-leader nil)
                       head category tags timestr nil
                       remove-re)))
          (setq priority (org-get-priority txt))
@@ -4141,6 +4426,30 @@ the documentation of `org-diary'."
          (push txt ee))))
     (nreverse ee)))
 
+(defun org-diary-class (m1 d1 y1 m2 d2 y2 dayname &rest skip-weeks)
+  "Entry applies if date is between dates on DAYNAME, but skips SKIP-WEEKS.
+The order of the first 2 times 3 arguments depends on the variable
+`calendar-date-style' or, if that is not defined, on `european-calendar-style'.
+So for American calendars, give this as MONTH DAY YEAR, for European as
+DAY MONTH YEAR, and for ISO as YEAR MONTH DAY.
+DAYNAME is a number between 0 (Sunday) and 6 (Saturday).  SKIP-WEEKS
+is any number of ISO weeks in the block period for which the item should
+be skipped."
+  (let* ((date1 (calendar-absolute-from-gregorian
+                (org-order-calendar-date-args m1 d1 y1)))
+        (date2 (calendar-absolute-from-gregorian
+                (org-order-calendar-date-args m2 d2 y2)))
+        (d (calendar-absolute-from-gregorian date)))
+    (and
+     (<= date1 d)
+     (<= d date2)
+     (= (calendar-day-of-week date) dayname)
+     (or (not skip-weeks)
+        (progn
+          (require 'cal-iso)
+          (not (member (car (calendar-iso-from-absolute d)) skip-weeks))))
+     entry)))
+
 (defalias 'org-get-closed 'org-agenda-get-progress)
 (defun org-agenda-get-progress ()
   "Return the logged TODO entries for agenda display."
@@ -4198,15 +4507,15 @@ the documentation of `org-diary'."
                     (setq clocked (match-string 2 rest)))
            (setq clocked "-")))
        (save-excursion
+         (setq extra nil)
          (cond
-          ((not org-agenda-log-mode-add-notes) (setq extra nil))
+          ((not org-agenda-log-mode-add-notes))
           (statep
            (and (looking-at ".*\n[ \t]*\\([^-\n \t].*?\\)[ \t]*$")
                 (setq extra (match-string 1))))
           (clockp
            (and (looking-at ".*\n[ \t]*-[ \t]+\\([^-\n \t].*?\\)[ \t]*$")
-                (setq extra (match-string 1))))
-          (t (setq extra nil)))
+                (setq extra (match-string 1)))))
          (if (not (re-search-backward "^\\*+ " nil t))
              (setq txt org-agenda-no-heading-message)
            (goto-char (match-beginning 0))
@@ -4248,11 +4557,22 @@ the documentation of `org-diary'."
         (todayp (org-agenda-todayp date)) ; DATE bound by calendar
         (d1 (calendar-absolute-from-gregorian date))  ; DATE bound by calendar
         d2 diff dfrac wdays pos pos1 category tags
+        suppress-prewarning
         ee txt head face s todo-state upcomingp donep timestr)
     (goto-char (point-min))
     (while (re-search-forward regexp nil t)
+      (setq suppress-prewarning nil)
       (catch :skip
        (org-agenda-skip)
+       (when (and org-agenda-skip-deadline-prewarning-if-scheduled
+                  (save-match-data
+                    (string-match org-scheduled-time-regexp
+                                  (buffer-substring (point-at-bol)
+                                                    (point-at-eol)))))
+         (setq suppress-prewarning
+               (if (integerp org-agenda-skip-deadline-prewarning-if-scheduled)
+                   org-agenda-skip-deadline-prewarning-if-scheduled
+                 0)))
        (setq s (match-string 1)
              txt nil
              pos (1- (match-beginning 1))
@@ -4260,7 +4580,10 @@ the documentation of `org-diary'."
                  (match-string 1) d1 'past
                  org-agenda-repeating-timestamp-show-all)
              diff (- d2 d1)
-             wdays (org-get-wdays s)
+             wdays (if suppress-prewarning
+                       (let ((org-deadline-warning-days suppress-prewarning))
+                         (org-get-wdays s))
+                     (org-get-wdays s))
              dfrac (/ (* 1.0 (- wdays diff)) (max wdays 1))
              upcomingp (and todayp (> diff 0)))
        ;; When to show a deadline in the calendar:
@@ -4472,13 +4795,20 @@ FRACTION is what fraction of the head-warning time has passed."
                (setq tags (org-get-tags-at))
                (looking-at "\\*+[ \t]+\\([^\r\n]+\\)")
                (setq head (match-string 1))
-               (setq txt (org-format-agenda-item
-                          (format
-                           (nth (if (= d1 d2) 0 1)
-                                org-agenda-timerange-leaders)
-                           (1+ (- d0 d1)) (1+ (- d2 d1)))
-                          head category tags
-                          (if (= d0 d1) timestr))))
+               (let ((remove-re
+                      (if org-agenda-remove-timeranges-from-blocks
+                          (concat
+                           "<" (regexp-quote s1) ".*?>"
+                           "--"
+                           "<" (regexp-quote s2) ".*?>")
+                        nil)))
+                 (setq txt (org-format-agenda-item
+                            (format
+                             (nth (if (= d1 d2) 0 1)
+                                  org-agenda-timerange-leaders)
+                             (1+ (- d0 d1)) (1+ (- d2 d1)))
+                            head category tags
+                            timestr nil remove-re))))
              (org-add-props txt props
                'org-marker marker 'org-hd-marker hdmarker
                'type "block" 'date date
@@ -4501,9 +4831,9 @@ The flag is set if the currently compiled format contains a `%T'.")
   "A flag, set by `org-compile-prefix-format'.
 The flag is set if the currently compiled format contains a `%e'.")
 (defvar org-prefix-category-length nil
-  "Used by `org-compile-prefix-format' to remember the category field widh.")
+  "Used by `org-compile-prefix-format' to remember the category field width.")
 (defvar org-prefix-category-max-length nil
-  "Used by `org-compile-prefix-format' to remember the category field widh.")
+  "Used by `org-compile-prefix-format' to remember the category field width.")
 
 (defun org-format-agenda-item (extra txt &optional category tags dotime
                                     noprefix remove-re habitp)
@@ -4665,16 +4995,16 @@ The modified list may contain inherited tags, and tags matched by
   (when (or add-inherited hide-re)
     (if (string-match (org-re "\\([ \t]+\\)\\(:[[:alnum:]_@:]+:\\)[ \t]*$") txt)
        (setq txt (substring txt 0 (match-beginning 0))))
+    (setq tags
+         (delq nil
+               (mapcar (lambda (tg)
+                         (if (or (and hide-re (string-match hide-re tg))
+                                 (and (not add-inherited)
+                                      (get-text-property 0 'inherited tg)))
+                             nil
+                           tg))
+                       tags)))
     (when tags
-      (setq tags
-           (delq nil
-                 (mapcar (lambda (tg)
-                           (if (or (and hide-re (string-match hide-re tg))
-                                   (and (not add-inherited)
-                                        (get-text-property 0 'inherited tg)))
-                               nil
-                             tg))
-                         tags)))
       (let ((have-i (get-text-property 0 'inherited (car tags)))
            i)
        (setq txt (concat txt " :"
@@ -4805,6 +5135,8 @@ HH:MM."
                    (mod h1 24) h1))
            (t0 (+ (* 100 h2) m))
            (t1 (concat (if (>= h1 24) "+" " ")
+                       (if (and org-agenda-time-leading-zero
+                                (< t0 1000)) "0" "")
                        (if (< t0 100) "0" "")
                        (if (< t0 10)  "0" "")
                        (int-to-string t0))))
@@ -4819,6 +5151,7 @@ HH:MM."
 
 (defun org-agenda-highlight-todo (x)
   (let ((org-done-keywords org-done-keywords-for-agenda)
+       (case-fold-search nil)
         re pl)
     (if (eq x 'line)
        (save-excursion
@@ -4841,11 +5174,12 @@ HH:MM."
         (or (match-end 1) (match-end 0)) (match-end 0)
         (list 'face (org-get-todo-face (match-string 2 x)))
         x)
-       (setq x (concat (substring x 0 (match-end 1))
-                       (format org-agenda-todo-keyword-format
-                               (match-string 2 x))
-                       (org-add-props " " (text-properties-at 0 x))
-                       (substring x (match-end 3)))))
+       (when (match-end 1)
+         (setq x (concat (substring x 0 (match-end 1))
+                         (format org-agenda-todo-keyword-format
+                                 (match-string 2 x))
+                         (org-add-props " " (text-properties-at 0 x))
+                         (substring x (match-end 3))))))
       x)))
 
 (defsubst org-cmp-priority (a b)
@@ -4896,6 +5230,28 @@ HH:MM."
          ((< lb la) +1)
          (t nil))))
 
+(defsubst org-cmp-alpha (a b)
+  "Compare the headlines, alphabetically."
+  (let* ((pla (get-text-property 0 'prefix-length a))
+        (plb (get-text-property 0 'prefix-length b))
+        (ta (and pla (substring a pla)))
+        (tb (and plb (substring b plb))))
+    (when pla
+      (if (string-match (concat "\\`[ \t]*" (or (get-text-property 0 'org-todo-regexp a) "")
+                               "\\([ \t]*\\[[a-zA-Z0-9]\\]\\)? *") ta)
+         (setq ta (substring ta (match-end 0))))
+      (setq ta (downcase ta)))
+    (when plb
+      (if (string-match (concat "\\`[ \t]*" (or (get-text-property 0 'org-todo-regexp b) "")
+                               "\\([ \t]*\\[[a-zA-Z0-9]\\]\\)? *") tb)
+         (setq tb (substring tb (match-end 0))))
+      (setq tb (downcase tb)))
+    (cond ((not ta) +1)
+         ((not tb) -1)
+         ((string-lessp ta tb) -1)
+         ((string-lessp tb ta) +1)
+         (t nil))))
+
 (defsubst org-cmp-tag (a b)
   "Compare the string values of the first tags of A and B."
   (let ((ta (car (last (get-text-property 1 'tags a))))
@@ -4923,25 +5279,39 @@ HH:MM."
          ((and (not ha) hb) +1)
          (t nil))))
 
+(defsubst org-em (x y list) (or (memq x list) (memq y list)))
+
 (defun org-entries-lessp (a b)
   "Predicate for sorting agenda entries."
   ;; The following variables will be used when the form is evaluated.
   ;; So even though the compiler complains, keep them.
-  (let* ((time-up (org-cmp-time a b))
-        (time-down (if time-up (- time-up) nil))
-        (priority-up (org-cmp-priority a b))
-        (priority-down (if priority-up (- priority-up) nil))
-        (effort-up (org-cmp-effort a b))
-        (effort-down (if effort-up (- effort-up) nil))
-        (category-up (org-cmp-category a b))
-        (category-down (if category-up (- category-up) nil))
-        (category-keep (if category-up +1 nil))
-        (tag-up (org-cmp-tag a b))
-        (tag-down (if tag-up (- tag-up) nil))
-        (todo-state-up (org-cmp-todo-state a b))
+  (let* ((ss org-agenda-sorting-strategy-selected)
+        (time-up         (and (org-em 'time-up 'time-down ss)
+                              (org-cmp-time a b)))
+        (time-down       (if time-up (- time-up) nil))
+        (priority-up     (and (org-em 'priority-up 'priority-down ss)
+                              (org-cmp-priority a b)))
+        (priority-down   (if priority-up (- priority-up) nil))
+        (effort-up       (and (org-em 'effort-up 'effort-down ss)
+                              (org-cmp-effort a b)))
+        (effort-down     (if effort-up (- effort-up) nil))
+        (category-up     (and (or (org-em 'category-up 'category-down ss)
+                                  (memq 'category-keep ss))
+                              (org-cmp-category a b)))
+        (category-down   (if category-up (- category-up) nil))
+        (category-keep   (if category-up +1 nil))
+        (tag-up          (and (org-em 'tag-up 'tag-down ss)
+                              (org-cmp-tag a b)))
+        (tag-down        (if tag-up (- tag-up) nil))
+        (todo-state-up   (and (org-em 'todo-state-up 'todo-state-down ss)
+                              (org-cmp-todo-state a b)))
         (todo-state-down (if todo-state-up (- todo-state-up) nil))
-        (habit-up (org-cmp-habit-p a b))
-        (habit-down (if habit-up (- habit-up) nil))
+        (habit-up        (and (org-em 'habit-up 'habit-down ss)
+                              (org-cmp-habit-p a b)))
+        (habit-down      (if habit-up (- habit-up) nil))
+        (alpha-up        (and (org-em 'alpha-up 'alpha-down ss)
+                              (org-cmp-alpha a b)))
+        (alpha-down      (if alpha-up (- alpha-up) nil))
         user-defined-up user-defined-down)
     (if (and org-agenda-cmp-user-defined
             (functionp org-agenda-cmp-user-defined))
@@ -4954,12 +5324,12 @@ HH:MM."
 
 ;;; Agenda restriction lock
 
-(defvar org-agenda-restriction-lock-overlay (org-make-overlay 1 1)
+(defvar org-agenda-restriction-lock-overlay (make-overlay 1 1)
   "Overlay to mark the headline to which agenda commands are restricted.")
-(org-overlay-put org-agenda-restriction-lock-overlay
-                'face 'org-agenda-restriction-lock)
-(org-overlay-put org-agenda-restriction-lock-overlay
-                'help-echo "Agendas are currently limited to this subtree.")
+(overlay-put org-agenda-restriction-lock-overlay
+            'face 'org-agenda-restriction-lock)
+(overlay-put org-agenda-restriction-lock-overlay
+            'help-echo "Agendas are currently limited to this subtree.")
 (org-detach-overlay org-agenda-restriction-lock-overlay)
 
 (defun org-agenda-set-restriction-lock (&optional type)
@@ -4982,7 +5352,7 @@ in the file.  Otherwise, restriction will be to the current subtree."
        (put 'org-agenda-files 'org-restrict
             (list (buffer-file-name (buffer-base-buffer))))
        (org-back-to-heading t)
-       (org-move-overlay org-agenda-restriction-lock-overlay (point) (point-at-eol))
+       (move-overlay org-agenda-restriction-lock-overlay (point) (point-at-eol))
        (move-marker org-agenda-restrict-begin (point))
        (move-marker org-agenda-restrict-end
                     (save-excursion (org-end-of-subtree t)))
@@ -5071,8 +5441,9 @@ Org-mode buffers visited directly by the user will not be touched."
   (org-agenda-quit))
 
 (defun org-agenda-execute (arg)
-  "Execute another agenda command, keeping same window.\\<global-map>
-So this is just a shortcut for `\\[org-agenda]', available in the agenda."
+  "Execute another agenda command, keeping same window.
+So this is just a shortcut for \\<global-map>`\\[org-agenda]', available
+in the agenda."
   (interactive "P")
   (let ((org-agenda-window-setup 'current-window))
     (org-agenda arg)))
@@ -5127,7 +5498,7 @@ to switch to narrowing."
         (effort-prompt "")
         (inhibit-read-only t)
         (current org-agenda-filter)
-        char a n tag)
+        a n tag)
     (unless char
       (message
        "%s by tag [%s ], [TAB], %s[/]:off, [+-]:narrow, [>=<?]:effort: "
@@ -5168,9 +5539,8 @@ to switch to narrowing."
       (org-agenda-filter-by-tag-show-all)
       (when org-agenda-auto-exclude-function
        (setq org-agenda-filter '())
-       (dolist (tag org-tag-alist-for-agenda)
-         (let ((modifier (funcall org-agenda-auto-exclude-function
-                                  (car tag))))
+       (dolist (tag (org-agenda-get-represented-tags))
+         (let ((modifier (funcall org-agenda-auto-exclude-function tag)))
            (if modifier
                (push modifier org-agenda-filter))))
        (if (not (null org-agenda-filter))
@@ -5197,6 +5567,17 @@ to switch to narrowing."
       (org-agenda-filter-apply org-agenda-filter))
      (t (error "Invalid tag selection character %c" char)))))
 
+(defun org-agenda-get-represented-tags ()
+  "Get a list of all tags currently represented in the agenda."
+  (let (p tags)
+    (save-excursion
+      (goto-char (point-min))
+      (while (setq p (next-single-property-change (point) 'tags))
+       (goto-char p)
+       (mapc (lambda (x) (add-to-list 'tags x))
+             (get-text-property (point) 'tags))))
+    tags))
+
 (defun org-agenda-filter-by-tag-refine (strip &optional char)
   "Refine the current filter.  See `org-agenda-filter-by-tag."
   (interactive "P")
@@ -5219,7 +5600,7 @@ to switch to narrowing."
 
 (defun org-agenda-filter-effort-form (e)
   "Return the form to compare the effort of the current line with what E says.
-E looks line \"+<2:25\"."
+E looks like \"+<2:25\"."
   (let (op)
     (setq e (substring e 1))
     (setq op (string-to-char e) e (substring e 1))
@@ -5258,25 +5639,25 @@ If the line does not have an effort defined, return nil."
 
 (defun org-agenda-filter-by-tag-hide-line ()
   (let (ov)
-    (setq ov (org-make-overlay (max (point-min) (1- (point-at-bol)))
+    (setq ov (make-overlay (max (point-min) (1- (point-at-bol)))
                               (point-at-eol)))
-    (org-overlay-put ov 'invisible t)
-    (org-overlay-put ov 'type 'tags-filter)
+    (overlay-put ov 'invisible t)
+    (overlay-put ov 'type 'tags-filter)
     (push ov org-agenda-filter-overlays)))
 
 (defun org-agenda-fix-tags-filter-overlays-at (&optional pos)
   (setq pos (or pos (point)))
   (save-excursion
-    (dolist (ov (org-overlays-at pos))
-      (when (and (org-overlay-get ov 'invisible)
-                (eq (org-overlay-get ov 'type) 'tags-filter))
+    (dolist (ov (overlays-at pos))
+      (when (and (overlay-get ov 'invisible)
+                (eq (overlay-get ov 'type) 'tags-filter))
        (goto-char pos)
-       (if (< (org-overlay-start ov) (point-at-eol))
-           (org-move-overlay ov (point-at-eol)
-                             (org-overlay-end ov)))))))
+       (if (< (overlay-start ov) (point-at-eol))
+           (move-overlay ov (point-at-eol)
+                             (overlay-end ov)))))))
 
 (defun org-agenda-filter-by-tag-show-all ()
-  (mapc 'org-delete-overlay org-agenda-filter-overlays)
+  (mapc 'delete-overlay org-agenda-filter-overlays)
   (setq org-agenda-filter-overlays nil)
   (setq org-agenda-filter nil)
   (setq org-agenda-filter-form nil)
@@ -5284,22 +5665,22 @@ If the line does not have an effort defined, return nil."
 
 (defun org-agenda-manipulate-query-add ()
   "Manipulate the query by adding a search term with positive selection.
-Positive selection means, the term must be matched for selection of an entry."
+Positive selection means the term must be matched for selection of an entry."
   (interactive)
   (org-agenda-manipulate-query ?\[))
 (defun org-agenda-manipulate-query-subtract ()
   "Manipulate the query by adding a search term with negative selection.
-Negative selection means, term must not be matched for selection of an entry."
+Negative selection means term must not be matched for selection of an entry."
   (interactive)
   (org-agenda-manipulate-query ?\]))
 (defun org-agenda-manipulate-query-add-re ()
   "Manipulate the query by adding a search regexp with positive selection.
-Positive selection means, the regexp must match for selection of an entry."
+Positive selection means the regexp must match for selection of an entry."
   (interactive)
   (org-agenda-manipulate-query ?\{))
 (defun org-agenda-manipulate-query-subtract-re ()
   "Manipulate the query by adding a search regexp with negative selection.
-Negative selection means, regexp must not match for selection of an entry."
+Negative selection means regexp must not match for selection of an entry."
   (interactive)
   (org-agenda-manipulate-query ?\}))
 (defun org-agenda-manipulate-query (char)
@@ -5311,8 +5692,10 @@ Negative selection means, regexp must not match for selection of an entry."
    ((eq org-agenda-type 'search)
     (org-add-to-string
      'org-agenda-query-string
-     (cdr (assoc char '((?\[ . " +") (?\] . " -")
-                       (?\{ . " +{}") (?\} . " -{}")))))
+     (if org-agenda-last-search-view-search-was-boolean
+        (cdr (assoc char '((?\[ . " +") (?\] . " -")
+                           (?\{ . " +{}") (?\} . " -{}"))))
+       " "))
     (setq org-agenda-redo-command
          (list 'org-search-view
                org-todo-only
@@ -5397,8 +5780,9 @@ With prefix ARG, go backward that many times the current span."
 (defun org-agenda-view-mode-dispatch ()
   "Call one of the view mode commands."
   (interactive)
-  (message "View: [d]ay [w]eek [m]onth [y]ear [l]og [L]og-all [a]rch-trees [A]rch-files
-       clock[R]eport   time[G]rid   [[]inactive  [E]ntryText   include[D]iary")
+  (message "View: [d]ay [w]eek [m]onth [y]ear                         [q]uit/abort
+      time[G]rid     [[]inactive [f]ollow [l]og [L]og-all   [E]ntryText
+      [a]rch-trees   [A]rch-files    clock[R]eport   include[D]iary")
   (let ((a (read-char-exclusive)))
     (case a
       (?d (call-interactively 'org-agenda-day-view))
@@ -5406,6 +5790,7 @@ With prefix ARG, go backward that many times the current span."
       (?m (call-interactively 'org-agenda-month-view))
       (?y (call-interactively 'org-agenda-year-view))
       (?l (call-interactively 'org-agenda-log-mode))
+      (?L (org-agenda-log-mode '(4)))
       ((?F ?f) (call-interactively 'org-agenda-follow-mode))
       (?a (call-interactively 'org-agenda-archives-mode))
       (?A (org-agenda-archives-mode 'files))
@@ -5413,6 +5798,7 @@ With prefix ARG, go backward that many times the current span."
       ((?E ?e) (call-interactively 'org-agenda-entry-text-mode))
       (?G (call-interactively 'org-agenda-toggle-time-grid))
       (?D (call-interactively 'org-agenda-toggle-diary))
+      (?\! (call-interactively 'org-agenda-toggle-deadlines))
       (?\[ (let ((org-agenda-include-inactive-timestamps t))
             (org-agenda-check-type t 'timeline 'agenda)
             (org-agenda-redo))
@@ -5546,17 +5932,16 @@ so that the date SD will be in that range."
       (error "No previous date before this line in this buffer")))
 
 ;; Initialize the highlight
-(defvar org-hl (org-make-overlay 1 1))
-(org-overlay-put org-hl 'face 'highlight)
+(defvar org-hl (make-overlay 1 1))
+(overlay-put org-hl 'face 'highlight)
 
 (defun org-highlight (begin end &optional buffer)
   "Highlight a region with overlay."
-  (funcall (if (featurep 'xemacs) 'set-extent-endpoints 'move-overlay)
-          org-hl begin end (or buffer (current-buffer))))
+  (move-overlay org-hl begin end (or buffer (current-buffer))))
 
 (defun org-unhighlight ()
   "Detach overlay INDEX."
-  (funcall (if (featurep 'xemacs) 'detach-extent 'delete-overlay) org-hl))
+  (org-detach-overlay org-hl))
 
 ;; FIXME this is currently not used.
 (defun org-highlight-until-next-command (beg end &optional buffer)
@@ -5581,9 +5966,8 @@ so that the date SD will be in that range."
 (defun org-agenda-entry-text-mode (&optional arg)
   "Toggle entry text mode in an agenda buffer."
   (interactive "P")
-  (if (integerp arg)
-      (setq org-agenda-entry-text-mode t)
-    (setq org-agenda-entry-text-mode (not org-agenda-entry-text-mode)))
+  (setq org-agenda-entry-text-mode (or (integerp arg)
+                                       (not org-agenda-entry-text-mode)))
   (org-agenda-entry-text-hide)
   (and org-agenda-entry-text-mode
        (let ((org-agenda-entry-text-maxlines
@@ -5650,6 +6034,16 @@ When called with a prefix argument, include all archive files as well."
   (message "Diary inclusion turned %s"
           (if org-agenda-include-diary "on" "off")))
 
+(defun org-agenda-toggle-deadlines ()
+  "Toggle diary inclusion in an agenda buffer."
+  (interactive)
+  (org-agenda-check-type t 'agenda)
+  (setq org-agenda-include-deadlines (not org-agenda-include-deadlines))
+  (org-agenda-redo)
+  (org-agenda-set-mode-name)
+  (message "Deadlines inclusion turned %s"
+          (if org-agenda-include-deadlines "on" "off")))
+
 (defun org-agenda-toggle-time-grid ()
   "Toggle time grid in an agenda buffer."
   (interactive)
@@ -5664,11 +6058,13 @@ When called with a prefix argument, include all archive files as well."
   "Set the mode name to indicate all the small mode settings."
   (setq mode-name
        (concat "Org-Agenda"
+               (if (get 'org-agenda-files 'org-restrict) " []" "")
                (if (equal org-agenda-ndays 1) " Day"    "")
                (if (equal org-agenda-ndays 7) " Week"   "")
                (if org-agenda-follow-mode     " Follow" "")
                (if org-agenda-entry-text-mode " ETxt"   "")
                (if org-agenda-include-diary   " Diary"  "")
+               (if org-agenda-include-deadlines " Ddl"  "")
                (if org-agenda-use-time-grid   " Grid"   "")
                (if (and (boundp 'org-habit-show-habits)
                         org-habit-show-habits) " Habit"   "")
@@ -5697,7 +6093,7 @@ When called with a prefix argument, include all archive files as well."
                               'org-agenda-type))))
 
 (defun org-agenda-next-line ()
-  "Move cursor to the next line, and show if follow-mode is active."
+  "Move cursor to the next line, and show if follow mode is active."
   (interactive)
   (call-interactively 'next-line)
   (org-agenda-do-context-action))
@@ -5710,7 +6106,7 @@ When called with a prefix argument, include all archive files as well."
   (org-agenda-do-context-action))
 
 (defun org-agenda-do-context-action ()
-  "Show outline path and, maybe, follow-mode window."
+  "Show outline path and, maybe, follow mode window."
   (let ((m (org-get-at-bol 'org-marker)))
     (if (and org-agenda-follow-mode m)
        (org-agenda-show))
@@ -5744,6 +6140,7 @@ and by additional input from the age of a schedules or deadline entry."
         (pos (marker-position marker)))
     (switch-to-buffer-other-window buffer)
     (widen)
+    (push-mark)
     (goto-char pos)
     (when (org-mode-p)
       (org-show-context 'agenda)
@@ -5860,7 +6257,7 @@ If this information is not given, the function uses the tree at point."
              (delete-region (point-at-bol) (1+ (point-at-eol)))))
          (beginning-of-line 0))))))
 
-(defun org-agenda-refile (&optional goto rfloc)
+(defun org-agenda-refile (&optional goto rfloc no-update)
   "Refile the item at point."
   (interactive "P")
   (if (equal goto '(16))
@@ -5879,7 +6276,8 @@ If this information is not given, the function uses the tree at point."
            (widen)
            (goto-char marker)
            (org-remove-subtree-entries-from-agenda)
-           (org-refile goto buffer rfloc)))))))
+           (org-refile goto buffer rfloc)))))
+    (unless no-update (org-agenda-redo))))
 
 (defun org-agenda-open-link (&optional arg)
   "Follow the link in the current line, if any.
@@ -6089,8 +6487,8 @@ docstring of `org-agenda-show-1'."
 This calls the command `org-tree-to-indirect-buffer' from the original
 Org-mode buffer.
 With numerical prefix arg ARG, go up to this level and then take that tree.
-With a C-u prefix, make a separate frame for this tree (i.e. don't use the
-dedicated frame)."
+With a \\[universal-argument] prefix, make a separate frame for this tree (i.e. don't
+use the dedicated frame)."
   (interactive)
   (org-agenda-check-no-diary)
   (let* ((marker (or (org-get-at-bol 'org-marker)
@@ -6256,7 +6654,8 @@ If FORCE-TAGS is non nil, the car of it returns the new tags."
        (goto-char (match-beginning 1))
        (insert (org-add-props
                    (make-string (max 1 (- c (current-column))) ?\ )
-                   (text-properties-at (point)))))
+                   (plist-put (copy-sequence (text-properties-at (point)))
+                              'face nil))))
       (goto-char (point-min))
       (org-font-lock-add-tag-faces (point-max)))))
 
@@ -6523,14 +6922,15 @@ be used to request time specification in the time stamp."
       (with-current-buffer buffer
        (widen)
        (goto-char pos)
-       (if (not (org-at-timestamp-p))
+       (if (not (org-at-timestamp-p t))
            (error "Cannot find time stamp"))
-       (org-time-stamp arg))
+       (org-time-stamp arg (equal (char-after (match-beginning 0)) ?\[)))
       (org-agenda-show-new-time marker org-last-changed-timestamp))
     (message "Time stamp changed to %s" org-last-changed-timestamp)))
 
 (defun org-agenda-schedule (arg)
-  "Schedule the item at point."
+  "Schedule the item at point.
+Arg is passed through to `org-schedule'."
   (interactive "P")
   (org-agenda-check-type t 'agenda 'timeline 'todo 'tags 'search)
   (org-agenda-check-no-diary)
@@ -6551,7 +6951,8 @@ be used to request time specification in the time stamp."
     (message "Item scheduled for %s" ts)))
 
 (defun org-agenda-deadline (arg)
-  "Schedule the item at point."
+  "Schedule the item at point.
+Arg is passed through to `org-deadline'."
   (interactive "P")
   (org-agenda-check-type t 'agenda 'timeline 'todo 'tags 'search)
   (org-agenda-check-no-diary)
@@ -6577,13 +6978,14 @@ m     Mark the entry at point for an agenda action
 s     Schedule the marked entry to the date at the cursor
 d     Set the deadline of the marked entry to the date at the cursor
 r     Call `org-remember' with cursor date as the default date
+c     Call `org-capture' with cursor date as the default date
 SPC   Show marked entry in other window
 TAB   Visit marked entry in other window
 
 The cursor may be at a date in the calendar, or in the Org agenda."
   (interactive)
   (let (ans)
-    (message "Select action: [m]ark | [s]chedule [d]eadline [r]emember [ ]show")
+    (message "Select action: [m]ark | [s]chedule [d]eadline [r]emember [c]apture [ ]show")
     (setq ans (read-char-exclusive))
     (cond
      ((equal ans ?m)
@@ -6604,6 +7006,8 @@ The cursor may be at a date in the calendar, or in the Org agenda."
       (org-agenda-do-action '(org-deadline nil org-overriding-default-time)))
      ((equal ans ?r)
       (org-agenda-do-action '(org-remember) t))
+     ((equal ans ?c)
+      (org-agenda-do-action '(org-capture) t))
      ((equal ans ?\ )
       (let ((cw (selected-window)))
        (org-switch-to-buffer-other-window
@@ -6719,6 +7123,7 @@ The cursor may be at a date in the calendar, or in the Org agenda."
      ((equal char ?j)
       (org-switch-to-buffer-other-window
        (find-file-noselect org-agenda-diary-file))
+      (require 'org-datetree)
       (org-datetree-find-date-create d1)
       (org-reveal t))
      (t (error "Invalid selection character `%c'" char)))))
@@ -6734,6 +7139,11 @@ top-level    as top-level entries at the end of the file."
          (const :tag "in a date tree" date-tree)
          (const :tag "as top level at end of file" top-level)))
 
+(defcustom org-agenda-insert-diary-extract-time nil
+  "Non-nil means extract any time specification from the diary entry."
+  :group 'org-agenda
+  :type 'boolean)
+
 (defun org-agenda-add-entry-to-org-agenda-diary-file (type text &optional d1 d2)
   "Add a diary entry with TYPE to `org-agenda-diary-file'.
 If TEXT is not empty, it will become the headline of the new entry, and
@@ -6761,20 +7171,37 @@ the resulting entry will not be shown.  When TEXT is empty, switch to
       (let ((calendar-date-display-form
             (if (if (boundp 'calendar-date-style)
                     (eq calendar-date-style 'european)
-                  european-calendar-style) ; Emacs 22
+                  (org-bound-and-true-p european-calendar-style)) ; Emacs 22
                 '(day " " month " " year)
               '(month " " day " " year))))
 
        (insert (format "%%%%(diary-anniversary %s) %s"
                        (calendar-date-string d1 nil t) text))))
      ((eq type 'day)
-      (if (eq org-agenda-insert-diary-strategy 'top-level)
-         (org-agenda-insert-diary-as-top-level text)
-       (require 'org-datetree)
-       (org-datetree-find-date-create d1)
-       (org-agenda-insert-diary-make-new-entry text))
-      (org-insert-time-stamp (org-time-from-absolute
-                             (calendar-absolute-from-gregorian d1)))
+      (let ((org-prefix-has-time t)
+           (org-agenda-time-leading-zero t)
+           fmt time time2)
+       (if org-agenda-insert-diary-extract-time
+           ;; Use org-format-agenda-item to parse text for a time-range and
+           ;; remove it.  FIXME: This is a hack, we should refactor
+           ;; that function to make time extraction available separately
+           (setq fmt (org-format-agenda-item nil text nil nil t)
+                 time (get-text-property 0 'time fmt)
+                 time2 (if (> (length time) 0)
+                           ;; split-string removes trailing ...... if
+                           ;; no end time given.  First space
+                           ;; separates time from date.
+                           (concat " " (car (split-string time "\\.")))
+                         nil)
+                 text (get-text-property 0 'txt fmt)))
+       (if (eq org-agenda-insert-diary-strategy 'top-level)
+           (org-agenda-insert-diary-as-top-level text)
+         (require 'org-datetree)
+         (org-datetree-find-date-create d1)
+         (org-agenda-insert-diary-make-new-entry text))
+       (org-insert-time-stamp (org-time-from-absolute
+                               (calendar-absolute-from-gregorian d1))
+                              nil nil nil nil time2))
       (end-of-line 0))
      ((eq type 'block)
       (if (> (calendar-absolute-from-gregorian d1)
@@ -6823,7 +7250,7 @@ a timestamp can be added there."
     (org-back-over-empty-lines)
     (or (looking-at "[ \t]*$")
        (progn (insert "\n") (backward-char 1)))
-    (org-insert-heading)
+    (org-insert-heading nil t)
     (org-do-demote)
     (setq col (current-column))
     (insert text "\n")
@@ -6940,9 +7367,7 @@ argument, latitude and longitude will be prompted for."
         (date (calendar-gregorian-from-absolute day))
         (calendar-move-hook nil)
         (calendar-view-holidays-initially-flag nil)
-        (calendar-view-diary-initially-flag nil)
-        (view-calendar-holidays-initially nil)
-        (view-diary-entries-initially nil))
+        (calendar-view-diary-initially-flag nil))
     (calendar)
     (calendar-goto-date date)))
 
@@ -7001,12 +7426,14 @@ This is a command that has to be installed in `calendar-mode-map'."
     (unless (org-agenda-bulk-marked-p)
       (unless m (error "Nothing to mark at point"))
       (push m org-agenda-bulk-marked-entries)
-      (setq ov (org-make-overlay (point-at-bol) (+ 2 (point-at-bol))))
+      (setq ov (make-overlay (point-at-bol) (+ 2 (point-at-bol))))
       (org-overlay-display ov "> "
                           (org-get-todo-face "TODO")
                           'evaporate)
-      (org-overlay-put ov 'type 'org-marked-entry-overlay))
+      (overlay-put ov 'type 'org-marked-entry-overlay))
     (beginning-of-line 2)
+    (while (and (get-char-property (point) 'invisible) (not (eobp)))
+      (beginning-of-line 2))
     (message "%d entries marked for bulk action"
             (length org-agenda-bulk-marked-entries))))
 
@@ -7020,6 +7447,8 @@ This is a command that has to be installed in `calendar-mode-map'."
          (delete (org-get-at-bol 'org-hd-marker)
                  org-agenda-bulk-marked-entries)))
   (beginning-of-line 2)
+  (while (and (get-char-property (point) 'invisible) (not (eobp)))
+    (beginning-of-line 2))
   (message "%d entries marked for bulk action"
           (length org-agenda-bulk-marked-entries)))
 
@@ -7038,9 +7467,9 @@ This only removes the overlays, it does not remove the markers
 from the list in `org-agenda-bulk-marked-entries'."
   (interactive)
   (mapc (lambda (ov)
-         (and (eq (org-overlay-get ov 'type) 'org-marked-entry-overlay)
-              (org-delete-overlay ov)))
-       (org-overlays-in (or beg (point-min)) (or end (point-max)))))
+         (and (eq (overlay-get ov 'type) 'org-marked-entry-overlay)
+              (delete-overlay ov)))
+       (overlays-in (or beg (point-min)) (or end (point-max)))))
 
 (defun org-agenda-bulk-remove-all-marks ()
   "Remove all marks in the agenda buffer.
@@ -7050,14 +7479,17 @@ This will remove the markers, and the overlays."
   (setq org-agenda-bulk-marked-entries nil)
   (org-agenda-bulk-remove-overlays (point-min) (point-max)))
 
-(defun org-agenda-bulk-action ()
-  "Execute an remote-editing action on all marked entries."
-  (interactive)
+(defun org-agenda-bulk-action (&optional arg)
+  "Execute an remote-editing action on all marked entries.
+The prefix arg is passed through to the command if possible."
+  (interactive "P")
   (unless org-agenda-bulk-marked-entries
     (error "No entries are marked"))
   (message "Bulk: [r]efile [$]archive [A]rch->sib [t]odo [+/-]tag [s]chedule [d]eadline")
   (let* ((action (read-char-exclusive))
+        (org-log-refile (if org-log-refile 'time nil))
         (entries (reverse org-agenda-bulk-marked-entries))
+        redo-at-end
         cmd rfloc state e tag pos (cnt 0) (cntskip 0))
     (cond
      ((equal action ?$)
@@ -7071,13 +7503,15 @@ This will remove the markers, and the overlays."
                   "Refile to: "
                   (marker-buffer (car org-agenda-bulk-marked-entries))
                   org-refile-allow-creating-parent-nodes))
-      (setcar (nthcdr 3 rfloc)
-             (move-marker (make-marker) (nth 3 rfloc)
-                          (or (get-file-buffer (nth 1 rfloc))
-                              (find-buffer-visiting (nth 1 rfloc))
-                              (error "This should not happen"))))
+      (if (nth 3 rfloc)
+         (setcar (nthcdr 3 rfloc)
+                 (move-marker (make-marker) (nth 3 rfloc)
+                              (or (get-file-buffer (nth 1 rfloc))
+                                  (find-buffer-visiting (nth 1 rfloc))
+                                  (error "This should not happen")))))
 
-      (setq cmd (list 'org-agenda-refile nil (list 'quote rfloc))))
+      (setq cmd (list 'org-agenda-refile nil (list 'quote rfloc) t)
+           redo-at-end t))
 
      ((equal action ?t)
       (setq state (org-icompleting-read
@@ -7098,17 +7532,18 @@ This will remove the markers, and the overlays."
       (setq cmd `(org-agenda-set-tags ,tag ,(if (eq action ?+) ''on ''off))))
 
      ((memq action '(?s ?d))
-      (let* ((date (org-read-date
-                   nil nil nil
-                   (if (eq action ?s) "(Re)Schedule to" "Set Deadline to")))
-            (ans org-read-date-final-answer)
+      (let* ((date (unless arg
+                    (org-read-date
+                     nil nil nil
+                     (if (eq action ?s) "(Re)Schedule to" "Set Deadline to"))))
+            (ans (if arg nil org-read-date-final-answer))
             (c1 (if (eq action ?s) 'org-agenda-schedule 'org-agenda-deadline)))
        (setq cmd `(let* ((bound (fboundp 'read-string))
                          (old (and bound (symbol-function 'read-string))))
                     (unwind-protect
                         (progn
                           (fset 'read-string (lambda (&rest ignore) ,ans))
-                          (call-interactively ',c1))
+                          (eval '(,c1 arg)))
                       (if bound
                           (fset 'read-string old)
                         (fmakunbound 'read-string)))))))
@@ -7137,6 +7572,7 @@ This will remove the markers, and the overlays."
        (setq cnt (1+ cnt))))
     (setq org-agenda-bulk-marked-entries nil)
     (org-agenda-bulk-remove-all-marks)
+    (when redo-at-end (org-agenda-redo))
     (message "Acted on %d entries%s"
             cnt
             (if (= cntskip 0)
@@ -7216,7 +7652,6 @@ either 'headline or 'category.  For example:
 will only add headlines containing IMPORTANT or headlines
 belonging to the \"Work\" category."
   (interactive "P")
-  (require 'calendar)
   (if refresh (setq appt-time-msg-list nil))
   (if (eq filter t)
       (setq filter (read-from-minibuffer "Regexp filter: ")))
index 03f5e5d5a80b445222ae13cd1f09684cd5aeac52..31ae488d4d89ee92354dae719f1066fa6892c17d 100644 (file)
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33x
+;; Version: 7.01
 ;;
 ;; This file is part of GNU Emacs.
 ;;
   :type '(choice
          (const org-archive-subtree)
          (const org-archive-to-archive-sibling)
-         (const org-archive-set-tag)))  
+         (const org-archive-set-tag)))
+
+(defcustom org-archive-reversed-order nil
+  "Non-nil means make the tree first child under the archive heading, not last."
+  :group 'org-archive
+  :type 'boolean)
 
 (defcustom org-archive-sibling-heading "Archive"
   "Name of the local archive sibling that is used to archive entries locally.
@@ -50,7 +55,7 @@ See `org-archive-to-archive-sibling' for more information."
   :type 'string)
 
 (defcustom org-archive-mark-done nil
-  "Non-nil means, mark entries as DONE when they are moved to the archive file.
+  "Non-nil means mark entries as DONE when they are moved to the archive file.
 This can be a string to set the keyword to use.  When t, Org-mode will
 use the first keyword in its list that means done."
   :group 'org-archive
@@ -60,7 +65,7 @@ use the first keyword in its list that means done."
          (string :tag "Use this keyword")))
 
 (defcustom org-archive-stamp-time t
-  "Non-nil means, add a time stamp to entries moved to an archive file.
+  "Non-nil means add a time stamp to entries moved to an archive file.
 This variable is obsolete and has no effect anymore, instead add or remove
 `time' from the variable `org-archive-save-context-info'."
   :group 'org-archive
@@ -273,7 +278,11 @@ this heading."
                  (end-of-line 0))
                ;; Make the subtree visible
                (show-subtree)
-               (org-end-of-subtree t)
+               (if org-archive-reversed-order
+                   (progn
+                     (org-back-to-heading t)
+                     (outline-next-heading))
+                 (org-end-of-subtree t))
                (skip-chars-backward " \t\r\n")
                (and (looking-at "[ \t\r\n]*")
                     (replace-match "\n\n")))
@@ -355,7 +364,9 @@ sibling does not exist, it will be created at the end of the subtree."
        (beginning-of-line 0)
        (org-toggle-tag org-archive-tag 'on))
       (beginning-of-line 1)
-      (org-end-of-subtree t t)
+      (if org-archive-reversed-order
+         (outline-next-heading)
+       (org-end-of-subtree t t))
       (save-excursion
        (goto-char pos)
        (let ((this-command this-command)) (org-cut-subtree)))
@@ -389,7 +400,8 @@ When TAG is non-nil, don't move trees, but mark them with the ARCHIVE tag."
        (progn
          (setq re1 (concat "^" (regexp-quote
                                 (make-string
-                                 (1+ (- (match-end 0) (match-beginning 0) 1))
+                                 (+ (- (match-end 0) (match-beginning 0) 1)
+                                    (if org-odd-levels-only 2 1))
                                  ?*))
                            " "))
          (move-marker begm (point))
index 13603ce51340398705fa6cfdc6fc6a3456addd26..730f8bdfa4114c928f54bc3039163e1c411c0a6b 100644 (file)
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33x
+;; Version: 7.01
 ;;
 ;; This file is part of GNU Emacs.
 ;;
 ;;
 ;;; Commentary:
 
+;;; Code:
+
 (require 'org-exp)
+
 (eval-when-compile
   (require 'cl))
 
@@ -52,19 +55,34 @@ Org-mode file."
   :type '(repeat character))
 
 (defcustom org-export-ascii-links-to-notes t
-  "Non-nil means, convert links to notes before the next headline.
+  "Non-nil means convert links to notes before the next headline.
 When nil, the link will be exported in place.  If the line becomes long
 in this way, it will be wrapped."
   :group 'org-export-ascii
   :type 'boolean)
 
 (defcustom org-export-ascii-table-keep-all-vertical-lines nil
-  "Non-nil means, keep all vertical lines in ASCII tables.
+  "Non-nil means keep all vertical lines in ASCII tables.
 When nil, vertical lines will be removed except for those needed
 for column grouping."
   :group 'org-export-ascii
   :type 'boolean)
 
+(defcustom org-export-ascii-table-widen-columns t
+  "Non-nil means widen narrowed columns for export.
+When nil, narrowed columns will look in ASCII export just like in org-mode,
+i.e. with \"=>\" as ellipsis."
+  :group 'org-export-ascii
+  :type 'boolean)
+
+(defvar org-export-ascii-entities 'ascii
+  "The ascii representation to be used during ascii export.
+Possible values are:
+
+ascii     Only use plain ASCII characters
+latin1    Include Latin-1 character
+utf8      Use all UTF-8 characters")
+
 ;;; Hooks
 
 (defvar org-export-ascii-final-hook nil
@@ -74,6 +92,41 @@ for column grouping."
 
 (defvar org-ascii-current-indentation nil) ; For communication
 
+;;;###autoload
+(defun org-export-as-latin1 (&rest args)
+  "Like `org-export-as-ascii', use latin1 encoding for special symbols."
+  (interactive)
+  (org-export-as-encoding 'org-export-as-ascii (interactive-p)
+                         'latin1 args))
+
+;;;###autoload
+(defun org-export-as-latin1-to-buffer (&rest args)
+  "Like `org-export-as-ascii-to-buffer', use latin1 encoding for symbols."
+  (interactive)
+  (org-export-as-encoding 'org-export-as-ascii-to-buffer (interactive-p)
+                         'latin1 args))
+
+;;;###autoload
+(defun org-export-as-utf8 (&rest args)
+  "Like `org-export-as-ascii', use use encoding for special symbols."
+  (interactive)
+  (org-export-as-encoding 'org-export-as-ascii (interactive-p)
+                         'utf8 args))
+
+;;;###autoload
+(defun org-export-as-utf8-to-buffer (&rest args)
+  "Like `org-export-as-ascii-to-buffer', use utf8 encoding for symbols."
+  (interactive)
+  (org-export-as-encoding 'org-export-as-ascii-to-buffer (interactive-p)
+                         'utf8 args))
+
+(defun org-export-as-encoding (command interactivep encoding &rest args)
+  (let ((org-export-ascii-entities encoding))
+    (if interactivep
+       (call-interactively command)
+      (apply command args))))
+
+
 ;;;###autoload
 (defun org-export-as-ascii-to-buffer (arg)
   "Call `org-export-as-ascii` with output to a temporary buffer.
@@ -156,6 +209,7 @@ resulting ASCII as a string.  When BODY-ONLY is set, don't produce
 the file header and footer.  When PUB-DIR is set, use this as the
 publishing directory."
   (interactive "P")
+  (run-hooks 'org-export-first-hook)
   (setq-default org-todo-line-regexp org-todo-line-regexp)
   (let* ((opt-plist (org-combine-plists (org-default-export-plist)
                                        ext-plist
@@ -181,6 +235,11 @@ publishing directory."
                          (if subtree-p
                              (org-export-add-subtree-options opt-plist rbeg)
                            opt-plist)))
+        ;; The following two are dynamically scoped into other
+        ;; routines below.
+        (org-current-export-dir
+         (or pub-dir (org-export-directory :html opt-plist)))
+        (org-current-export-file buffer-file-name)
         (custom-times org-display-custom-times)
         (org-ascii-current-indentation '(0 . 0))
         (level 0) line txt
@@ -219,8 +278,10 @@ publishing directory."
                    (and (not
                          (plist-get opt-plist :skip-before-1st-heading))
                         (org-export-grab-title-from-buffer))
-                   (file-name-sans-extension
-                    (file-name-nondirectory bfname))))
+                   (and (buffer-file-name)
+                        (file-name-sans-extension
+                         (file-name-nondirectory bfname)))
+                   "UNTITLED"))
         (email (plist-get opt-plist :email))
         (language (plist-get opt-plist :language))
         (quote-re0 (concat "^[ \t]*" org-quote-string "\\>"))
@@ -287,7 +348,9 @@ publishing directory."
       (if (and (or author email)
               org-export-author-info)
          (insert(concat (nth 1 lang-words) ": " (or author "")
-                         (if email (concat " <" email ">") "")
+                         (if (and org-export-email-info
+                                  email (string-match "\\S-" email))
+                             (concat " <" email ">") "")
                          "\n")))
 
       (cond
@@ -481,19 +544,36 @@ publishing directory."
       (current-buffer))))
 
 (defun org-export-ascii-preprocess (parameters)
-  "Do extra work for ASCII export"
+  "Do extra work for ASCII export."
+  ;;
+  ;; Realign tables to get rid of narrowing
+  (when org-export-ascii-table-widen-columns
+    (let ((org-table-do-narrow nil))
+      (goto-char (point-min))
+      (org-ascii-replace-entities)
+      (goto-char (point-min))
+      (org-table-map-tables
+       (lambda () (org-if-unprotected (org-table-align)))
+       'quietly)))
   ;; Put quotes around verbatim text
   (goto-char (point-min))
   (while (re-search-forward org-verbatim-re nil t)
-    (goto-char (match-end 2))
-    (backward-delete-char 1) (insert "'")
-    (goto-char (match-beginning 2))
-    (delete-char 1) (insert "`")
-    (goto-char (match-end 2)))
+    (org-if-unprotected-at (match-beginning 4)
+      (goto-char (match-end 2))
+      (backward-delete-char 1) (insert "'")
+      (goto-char (match-beginning 2))
+      (delete-char 1) (insert "`")
+      (goto-char (match-end 2))))
   ;; Remove target markers
   (goto-char (point-min))
   (while (re-search-forward  "<<<?\\([^<>]*\\)>>>?\\([ \t]*\\)" nil t)
-    (replace-match "\\1\\2")))
+    (org-if-unprotected-at (match-beginning 1)
+      (replace-match "\\1\\2")))
+  ;; Remove list start counters
+  (goto-char (point-min))
+  (while (re-search-forward  "\\[@start:[0-9]+\\] ?" nil t)
+    (org-if-unprotected
+     (replace-match ""))))
 
 (defun org-html-expand-for-ascii (line)
   "Handle quoted HTML for ASCII export."
@@ -503,6 +583,15 @@ publishing directory."
        (setq line (replace-match "" nil nil line))))
   line)
 
+(defun org-ascii-replace-entities ()
+  "Replace entities with the ASCII representation."
+  (let (e)
+    (while (re-search-forward "\\\\\\([a-zA-Z]+[0-9]*\\)" nil t)
+      (org-if-unprotected-at (match-beginning 1)
+       (setq e (org-entity-get-representation (match-string 1)
+                                              org-export-ascii-entities))
+       (and e (replace-match e t t))))))
+
 (defun org-export-ascii-wrap (line where)
   "Wrap LINE at or before WHERE."
   (let ((ind (org-get-indentation line))
index 692631b64c17f465be86543b4decdccf7b3bf99f..573244beed4ef53f6d0ac97d07db84488c5a47ce 100644 (file)
@@ -4,7 +4,7 @@
 
 ;; Author: John Wiegley <johnw@newartisans.com>
 ;; Keywords: org data task
-;; Version: 6.33x
+;; Version: 7.01
 
 ;; This file is part of GNU Emacs.
 ;;
@@ -92,7 +92,7 @@ ln    create a hard link.  Note that this is not supported
   :type 'boolean)
 
 (defcustom org-attach-allow-inheritance t
-  "Non-nil means, allow attachment directories be inherited."
+  "Non-nil means allow attachment directories be inherited."
   :group 'org-attach
   :type 'boolean)
 
@@ -241,12 +241,17 @@ the ATTACH_DIR property) their own attachment directory."
   "Commit changes to git if `org-attach-directory' is properly initialized.
 This checks for the existence of a \".git\" directory in that directory."
   (let ((dir (expand-file-name org-attach-directory)))
-    (if (file-exists-p (expand-file-name ".git" dir))
-       (shell-command
-        (concat "(cd " dir "; "
-                " git add .; "
-                " git ls-files --deleted -z | xargs -0 git rm; "
-                " git commit -m 'Synchronized attachments')")))))
+    (when (file-exists-p (expand-file-name ".git" dir))
+      (with-temp-buffer
+       (cd dir)
+       (shell-command "git add .")
+       (shell-command "git ls-files --deleted" t)
+       (mapc '(lambda (file)
+                (unless (string= file "")
+                  (shell-command
+                   (concat "git rm \"" file "\""))))
+             (split-string (buffer-string) "\n"))
+       (shell-command "git commit -m 'Synchronized attachments'")))))
 
 (defun org-attach-tag (&optional off)
   "Turn the autotag on or (if OFF is set) off."
@@ -322,7 +327,8 @@ The attachment is created as an Emacs buffer."
     (setq file (expand-file-name file attach-dir))
     (unless (file-exists-p file)
       (error "No such attachment: %s" file))
-    (delete-file file)))
+    (delete-file file)
+    (org-attach-commit)))
 
 (defun org-attach-delete-all (&optional force)
   "Delete all attachments from the current task.
index 1a91b5e7265ef09e30173f0e3f85661a75660131..0d7b5fa086a0ba111bf9fbdabfaba0d8760af17b 100644 (file)
@@ -7,7 +7,7 @@
 ;;         Thomas Baumann <thomas dot baumann at ch dot tum dot de>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33x
+;; Version: 7.01
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -207,7 +207,7 @@ date year)."
 (defun org-bbdb-export (path desc format)
   "Create the export version of a BBDB link specified by PATH or DESC.
 If exporting to either HTML or LaTeX FORMAT the link will be
-italicised, in all other cases it is left unchanged."
+italicized, in all other cases it is left unchanged."
   (cond
    ((eq format 'html) (format "<i>%s</i>" (or desc path)))
    ((eq format 'latex) (format "\\textit{%s}" (or desc path)))
diff --git a/lisp/org/org-beamer.el b/lisp/org/org-beamer.el
new file mode 100644 (file)
index 0000000..06853b8
--- /dev/null
@@ -0,0 +1,636 @@
+;;; org-beamer.el --- Beamer-specific LaTeX export for org-mode
+;;
+;; Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+;;
+;; Version: 7.01
+;; Author: Carsten Dominik <carsten.dominik AT gmail DOT com>
+;; Maintainer: Carsten Dominik <carsten.dominik AT gmail DOT com>
+;; Keywords: org, wp, tex
+
+;; 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:
+;;
+;; This library implement the special treatment needed by using the
+;; beamer class during LaTeX export.
+
+;;; Code:
+
+(require 'org)
+(require 'org-exp)
+
+(defvar org-export-latex-header)
+(defvar org-export-latex-options-plist)
+(defvar org-export-opt-plist)
+
+(defgroup org-beamer nil
+  "Options specific for using the beamer class in LaTeX export."
+  :tag "Org Beamer"
+  :group 'org-export-latex)
+
+(defcustom org-beamer-use-parts nil
+  ""
+  :group 'org-beamer
+  :type 'boolean)
+
+(defcustom org-beamer-frame-level 1
+  "The level that should be interpreted as a frame.
+The levels above this one will be translated into a sectioning structure.
+Setting this to 2 will allow sections, 3 will allow subsections as well.
+You can set this to 4 as well, if you at the same time set
+`org-beamer-use-parts' to make the top levels `\part'."
+  :group 'org-beamer
+  :type '(choice
+         (const :tag "Frames need a BEAMER_env property" nil)
+         (integer :tag "Specific level makes a frame")))
+
+(defcustom org-beamer-frame-default-options ""
+  "Default options string to use for frames, should contains the [brackets].
+And example for this is \"[allowframebreaks]\"."
+  :group 'org-beamer
+  :type '(string :tag "[options]"))
+
+(defcustom org-beamer-column-view-format
+  "%45ITEM %10BEAMER_env(Env) %10BEAMER_envargs(Env Args) %4BEAMER_col(Col) %8BEAMER_extra(Extra)"
+  "Default column view format that should be used to fill the template."
+  :group 'org-beamer
+  :type '(choice
+         (const  :tag "Do not insert Beamer column view format" nil)
+         (string :tag "Beamer column view format")))
+
+(defcustom org-beamer-themes
+  "\\usetheme{default}\\usecolortheme{default}"
+  "Default string to be used for extra heading stuff in beamer presentations.
+When a beamer template is filled, this will be the default for
+BEAMER_HEADER_EXTRA, which will be inserted just before \\begin{document}."
+  :group 'org-beamer
+  :type '(choice
+         (const  :tag "Do not insert Beamer themes" nil)
+         (string :tag "Beamer themes")))
+
+(defconst org-beamer-column-widths
+  "0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 0.0 :ETC"
+"The column widths that should be installed as allowed property values.")
+
+(defconst org-beamer-transitions
+  "\transblindsvertical \transblindshorizontal \transboxin \transboxout \transdissolve \transduration \transglitter \transsplithorizontalin \transsplithorizontalout \transsplitverticalin \transsplitverticalout \transwipe :ETC"
+  "Transitions available for beamer.
+These are just a completion help.")
+
+(defconst org-beamer-environments-default
+  '(("frame"          "f" "dummy- special handling hard coded" "dummy")
+    ("columns"        "C" "\\begin{columns}%o %% %h%x"         "\\end{columns}")
+    ("column"         "c" "\\begin{column}%o{%h\\textwidth}%x" "\\end{column}")
+    ("block"          "b" "\\begin{block}%a{%h}%x"             "\\end{block}")
+    ("alertblock"     "a" "\\begin{alertblock}%a{%h}%x"        "\\end{alertblock}")
+    ("verse"          "v" "\\begin{verse}%a %% %h%x"           "\\end{verse}")
+    ("quotation"      "q" "\\begin{quotation}%a %% %h%x"       "\\end{quotation}")
+    ("quote"          "Q" "\\begin{quote}%a %% %h%x"           "\\end{quote}")
+    ("structureenv"   "s" "\\begin{structureenv}%a %% %h%x"    "\\end{structureenv}")
+    ("theorem"        "t" "\\begin{theorem}%a%U%x"             "\\end{theorem}")
+    ("definition"     "d" "\\begin{definition}%a%U%x"          "\\end{definition}")
+    ("example"        "e" "\\begin{example}%a%U%x"             "\\end{example}")
+    ("proof"          "p" "\\begin{proof}%a%U%x"               "\\end{proof}")
+    ("beamercolorbox" "o" "\\begin{beamercolorbox}%o{%h}%x"    "\\end{beamercolorbox}")
+    ("normal"         "h" "%h" "") ; Emit the heading as normal text
+    ("note"           "n" "\\note%o%a{%h"                      "}")
+    ("noteNH"         "N" "\\note%o%a{"                        "}") ; note, ignore heading
+    ("ignoreheading"  "i" "%%%% %h" ""))
+  "Environments triggered by properties in Beamer export.
+These are the defaults - for user definitions, see
+`org-beamer-environments-extra'.
+\"normal\" is a special fake environment, which emit the heading as
+normal text. It is needed when an environment should be surrounded
+by normal text.  Since beamer export converts nodes into environments,
+you need to have a node to end the environment.
+For example
+
+   ** a frame
+      some text
+   *** Blocktitle :B_block:
+       inside the block
+   *** After the block :B_normal:
+       continuing here
+   ** next frame")
+
+(defcustom org-beamer-environments-extra nil
+  "Environments triggered by tags in Beamer export.
+Each entry has 4 elements:
+
+name    Name of the environment
+key     Selection key for `org-beamer-select-environment'
+open    The opening template for the environment, with the following escapes
+        %a   the action/overlay specification
+        %A   the default action/overlay specification
+        %o   the options argument of the template
+        %h   the headline text
+        %H   if there is headline text, that text in {} braces
+        %U   if there is headline text, that text in [] brackets
+close   The closing string of the environment."
+
+  :group 'org-beamer
+  :type '(repeat
+         (list
+          (string :tag "Environment")
+          (string :tag "Selection key")
+          (string :tag "Begin")
+          (string :tag "End"))))
+
+(defvar org-beamer-frame-level-now nil)
+(defvar org-beamer-header-extra nil)
+(defvar org-beamer-export-is-beamer-p nil)
+(defvar org-beamer-inside-frame-at-level nil)
+(defvar org-beamer-columns-open nil)
+(defvar org-beamer-column-open nil)
+
+(defun org-beamer-cleanup-column-width (width)
+  "Make sure the width is not empty, and that it has a unit."
+  (setq width (org-trim (or width "")))
+  (unless (string-match "\\S-" width) (setq width "0.5"))
+  (if (string-match "\\`[.0-9]+\\'" width)
+      (setq width (concat width "\\textwidth")))
+  width)
+
+(defun org-beamer-open-column (&optional width opt)
+  (org-beamer-close-column-maybe)
+  (setq org-beamer-column-open t)
+  (setq width (org-beamer-cleanup-column-width width))
+  (insert (format "\\begin{column}%s{%s}\n" (or opt "") width)))
+(defun org-beamer-close-column-maybe ()
+  (when org-beamer-column-open
+    (setq org-beamer-column-open nil)
+    (insert "\\end{column}\n")))
+(defun org-beamer-open-columns-maybe (&optional opts)
+  (unless org-beamer-columns-open
+    (setq org-beamer-columns-open t)
+    (insert (format "\\begin{columns}%s\n" (or opts "")))))
+(defun org-beamer-close-columns-maybe ()
+  (org-beamer-close-column-maybe)
+  (when org-beamer-columns-open
+    (setq org-beamer-columns-open nil)
+    (insert "\\end{columns}\n")))
+
+(defun org-beamer-select-environment ()
+  "Select the environment to be used by beamer for this entry.
+While this uses (for convenience) a tag selection interface, the result
+of this command will be that the BEAMER_env *property* of the entry is set.
+
+In addition to this, the command will also set a tag as a visual aid, but
+the tag does not have any semantic meaning."
+  (interactive)
+  (let* ((envs (append org-beamer-environments-extra
+                      org-beamer-environments-default))
+        (org-tag-alist
+         (append '((:startgroup))
+                 (mapcar (lambda (e) (cons (concat "B_" (car e))
+                                           (string-to-char (nth 1 e))))
+                         envs)
+                 '((:endgroup))
+                 '(("BMCOL" . ?|))))
+        (org-fast-tag-selection-single-key t))
+    (org-set-tags)
+    (let ((tags (or (ignore-errors (org-get-tags-string)) "")))
+      (cond
+       ((equal org-last-tag-selection-key ?|)
+       (if (string-match ":BMCOL:" tags)
+           (org-set-property "BEAMER_col" (read-string "Column width: "))
+         (org-delete-property "BEAMER_col")))
+       ((string-match (concat ":B_\\("
+                             (mapconcat 'car envs "\\|")
+                             "\\):")
+                     tags)
+       (org-entry-put nil "BEAMER_env" (match-string 1 tags)))
+       (t (org-entry-delete nil "BEAMER_env"))))))
+
+
+(defun org-beamer-sectioning (level text)
+  "Return the sectioning entry for the current headline.
+LEVEL is the reduced level of the headline.
+TEXT is the text of the headline, everything except the leading stars.
+The return value is a cons cell.  The car is the headline text, usually
+just TEXT, but possibly modified if options have been extracted from the
+text.  The cdr is the sectioning entry, similar to what is given
+in org-export-latex-classes."
+  (let* ((frame-level (or org-beamer-frame-level-now org-beamer-frame-level))
+        (default
+          (if org-beamer-use-parts
+              '((1 . ("\\part{%s}" . "\\part*{%s}"))
+                (2 . ("\\section{%s}" . "\\section*{%s}"))
+                (3 . ("\\subsection{%s}" . "\\subsection*{%s}")))
+            '((1 . ("\\section{%s}" . "\\section*{%s}"))
+              (2 . ("\\subsection{%s}" . "\\subsection*{%s}")))))
+        (envs (append org-beamer-environments-extra
+                      org-beamer-environments-default))
+        (props (org-get-text-property-any 0 'org-props text))
+        (in "") (out "") option action defaction environment extra
+        columns-option column-option
+        env have-text ass tmp)
+    (if (= frame-level 0) (setq frame-level nil))
+    (when (and org-beamer-inside-frame-at-level
+              (<= level org-beamer-inside-frame-at-level))
+      (setq org-beamer-inside-frame-at-level nil))
+    (when (setq tmp (org-beamer-assoc-not-empty "BEAMER_col" props))
+      (if (and (string-match "\\`[0-9.]+\\'" tmp)
+              (or (= (string-to-number tmp) 1.0)
+                  (= (string-to-number tmp) 0.0)))
+         ;; column width 1 means cloase columns, go back to full width
+         (org-beamer-close-columns-maybe)
+       (when (setq ass (assoc "BEAMER_envargs" props))
+         (let (case-fold-search)
+           (when (string-match "C\\(\\[[^][]*\\]\\)" (cdr ass))
+             (setq columns-option (match-string 1 (cdr ass)))
+             (setcdr ass (replace-match "" t t (cdr ass))))
+           (when (string-match "c\\(\\[[^][]*\\]\\)" (cdr ass))
+             (setq column-option (match-string 1 (cdr ass)))
+             (setcdr ass (replace-match "" t t (cdr ass))))))
+       (org-beamer-open-columns-maybe columns-option)
+       (org-beamer-open-column tmp column-option)))
+    (cond
+     ((or (equal (cdr (assoc "BEAMER_env" props)) "frame")
+         (and frame-level (= level frame-level)))
+      ;; A frame
+      (org-beamer-get-special props)
+
+      (setq in (org-fill-template
+               "\\begin{frame}%a%A%o%T%S%x"
+               (list (cons "a" (or action ""))
+                     (cons "A" (or defaction ""))
+                     (cons "o" (or option org-beamer-frame-default-options ""))
+                     (cons "x" (if extra (concat "\n" extra) ""))
+                     (cons "h" "%s")
+                     (cons "T" (if (string-match "\\S-" text)
+                                   "\n\\frametitle{%s}" ""))
+                     (cons "S" (if (string-match "\\\\\\\\" text)
+                                   "\n\\framesubtitle{%s}" ""))))
+           out (copy-sequence "\\end{frame}"))
+      (org-add-props out
+         '(org-insert-hook org-beamer-close-columns-maybe))
+      (setq org-beamer-inside-frame-at-level level)
+      (cons text (list in out in out)))
+     ((and (setq env (cdr (assoc "BEAMER_env" props)))
+          (setq ass (assoc env envs)))
+      ;; A beamer environment selected by the BEAMER_env property
+      (if (string-match "[ \t]+:[ \t]*$" text)
+         (setq text (replace-match "" t t text)))
+      (if (member env '("note" "noteNH"))
+         ;; There should be no labels in a note, so we remove the targets
+         ;; FIXME???
+         (remove-text-properties 0 (length text) '(target nil) text))
+      (org-beamer-get-special props)
+      (setq text (org-trim text))
+      (setq have-text (string-match "\\S-" text))
+      (setq in (org-fill-template
+               (nth 2 ass)
+               (list (cons "a" (or action ""))
+                     (cons "A" (or defaction ""))
+                     (cons "o" (or option ""))
+                     (cons "x" (if extra (concat "\n" extra) ""))
+                     (cons "h" "%s")
+                     (cons "H" (if have-text (concat "{" text "}") ""))
+                     (cons "U" (if have-text (concat "[" text "]") ""))))
+           out (nth 3 ass))
+      (cond
+       ((equal out "\\end{columns}")
+       (setq org-beamer-columns-open t)
+       (setq out (org-add-props (copy-sequence out)
+                     '(org-insert-hook
+                       (lambda ()
+                         (org-beamer-close-column-maybe)
+                         (setq org-beamer-columns-open nil))))))
+       ((equal out "\\end{column}")
+       (org-beamer-open-columns-maybe)))
+      (cons text (list in out in out)))
+     ((and (not org-beamer-inside-frame-at-level)
+          (or (not frame-level)
+              (< level frame-level))
+          (assoc level default))
+      ;; Normal sectioning
+      (cons text (cdr (assoc level default))))
+     (t nil))))
+
+(defvar extra)
+(defvar option)
+(defvar action)
+(defvar defaction)
+(defvar environment)
+(defun org-beamer-get-special (props)
+  "Extract an option, action, and default action string from text.
+The variables option, action, defaction, extra are all scoped into
+this function dynamically."
+  (let (tmp)
+    (setq environment (org-beamer-assoc-not-empty "BEAMER_env" props))
+    (setq extra (org-beamer-assoc-not-empty "BEAMER_extra" props))
+    (when extra
+      (setq extra (replace-regexp-in-string "\\\\n" "\n" extra)))
+    (setq tmp (org-beamer-assoc-not-empty "BEAMER_envargs" props))
+    (when tmp
+      (setq tmp (copy-sequence tmp))
+      (if (string-match "\\[<[^][<>]*>\\]" tmp)
+         (setq defaction (match-string 0 tmp)
+               tmp (replace-match "" t t tmp)))
+      (if (string-match "\\[[^][]*\\]" tmp)
+         (setq option (match-string 0 tmp)
+               tmp (replace-match "" t t tmp)))
+      (if (string-match "<[^<>]*>" tmp)
+         (setq action (match-string 0 tmp)
+               tmp (replace-match "" t t tmp))))))
+
+(defun org-beamer-assoc-not-empty (elt list)
+  (let ((tmp (cdr (assoc elt list))))
+    (and tmp (string-match "\\S-" tmp) tmp)))
+
+
+(defvar org-beamer-mode-map (make-sparse-keymap)
+  "The keymap for `org-beamer-mode'.")
+(define-key org-beamer-mode-map "\C-c\C-b" 'org-beamer-select-environment)
+
+(define-minor-mode org-beamer-mode
+  "Special support for editing Org-mode files made to export to beamer."
+  nil " Bm" nil)
+(when (fboundp 'font-lock-add-keywords)
+  (font-lock-add-keywords
+   'org-mode
+   '((":\\(B_[a-z]+\\|BMCOL\\):" 1 'org-beamer-tag prepend))
+   'prepent))
+
+(defun org-beamer-place-default-actions-for-lists ()
+  "Find default overlay specifications in items, and move them.
+The need to be after the begin statement of the environment."
+  (when org-beamer-export-is-beamer-p
+    (let (dovl)
+      (goto-char (point-min))
+      (while (re-search-forward
+             "^[ \t]*\\\\begin{\\(itemize\\|enumerate\\|desctiption\\)}[ \t\n]*\\\\item\\>\\( ?\\(<[^<>\n]*>\\|\\[[^][\n*]\\]\\)\\)?[ \t]*\\S-" nil t)
+       (if (setq dovl (cdr (assoc "BEAMER_dovl"
+                                  (get-text-property (match-end 0)
+                                                     'org-props))))
+           (save-excursion
+             (goto-char (1+ (match-end 1)))
+             (insert dovl)))))))
+
+(defun org-beamer-amend-header ()
+  "Add `org-beamer-header-extra' to the LaTeX herder.
+If the file contains the string BEAMER-HEADER-EXTRA-HERE on a line
+by itself, it will be replaced with `org-beamer-header-extra'.  If not,
+the value will be inserted right after the documentclass statement."
+  (when (and org-beamer-export-is-beamer-p
+            org-beamer-header-extra)
+    (goto-char (point-min))
+    (cond
+     ((re-search-forward
+       "^[ \t]*\\[?BEAMER-HEADER-EXTRA\\(-HERE\\)?\\]?[ \t]*$" nil t)
+      (replace-match org-beamer-header-extra t t)
+      (or (bolp) (insert "\n")))
+     ((re-search-forward "^[ \t]*\\\\begin{document}" nil t)
+      (beginning-of-line 1)
+      (insert org-beamer-header-extra)
+      (or (bolp) (insert "\n"))))))
+
+(defcustom org-beamer-fragile-re "^[ \t]*\\\\begin{\\(verbatim\\|lstlisting\\)}"
+  "If this regexp matches in a frame, the frame is marked as fragile."
+  :group 'org-beamer
+  :type 'regexp)
+
+(defface org-beamer-tag '((t (:box (:line-width 1 :color grey40))))
+  "The special face for beamer tags."
+  :group 'org-beamer)
+
+
+;; Functions to initialize and post-process
+;; These fuctions will be hooked into various places in the export process
+
+(defun org-beamer-initialize-open-trackers ()
+  "Reset variables that track if certain environments are open during export."
+  (setq org-beamer-columns-open nil)
+  (setq org-beamer-column-open nil)
+  (setq org-beamer-inside-frame-at-level nil)
+  (setq org-beamer-export-is-beamer-p nil))
+
+(defun org-beamer-after-initial-vars ()
+  "Find special settings for beamer and store them.
+The effect is that these values will be accessible during export."
+  ;; First verify that we are exporting using the beamer class
+  (setq org-beamer-export-is-beamer-p
+       (string-match "\\\\documentclass\\(\\[[^][]*?\\]\\)?{beamer}"
+                     org-export-latex-header))
+  (when org-beamer-export-is-beamer-p
+    ;; Find the frame level
+    (setq org-beamer-frame-level-now
+         (or (and (org-region-active-p)
+                  (save-excursion
+                    (goto-char (region-beginning))
+                    (and (looking-at org-complex-heading-regexp)
+                         (org-entry-get nil "BEAMER_FRAME_LEVEL" 'selective))))
+             (save-excursion
+               (save-restriction
+                 (widen)
+                 (goto-char (point-min))
+                 (and (re-search-forward
+                       "^#\\+BEAMER_FRAME_LEVEL:[ \t]*\\(.*?\\)[ \t]*$" nil t)
+                      (match-string 1))))
+             (plist-get org-export-latex-options-plist :beamer-frame-level)
+             org-beamer-frame-level))
+    ;; Normalize the value so that the functions can trust the value
+    (cond
+     ((not org-beamer-frame-level-now)
+      (setq org-beamer-frame-level-now nil))
+     ((stringp org-beamer-frame-level-now)
+      (setq org-beamer-frame-level-now
+           (string-to-number org-beamer-frame-level-now))))
+    ;; Find the header additons, most likely theme commands
+    (setq org-beamer-header-extra
+         (or (and (org-region-active-p)
+                  (save-excursion
+                    (goto-char (region-beginning))
+                    (and (looking-at org-complex-heading-regexp)
+                         (org-entry-get nil "BEAMER_HEADER_EXTRA"
+                                        'selective))))
+             (save-excursion
+               (save-restriction
+                 (widen)
+                 (let ((txt ""))
+                   (goto-char (point-min))
+                   (while (re-search-forward
+                           "^#\\+BEAMER_HEADER_EXTRA:[ \t]*\\(.*?\\)[ \t]*$"
+                           nil t)
+                     (setq txt (concat txt "\n" (match-string 1))))
+                   (if (> (length txt) 0) (substring txt 1)))))
+             (plist-get org-export-latex-options-plist
+                        :beamer-header-extra)))
+    (let ((inhibit-read-only t)
+         (case-fold-search nil)
+         props)
+      (org-unmodified
+       (remove-text-properties (point-min) (point-max) '(org-props nil))
+       (org-map-entries
+       '(progn
+          (setq props (org-entry-properties nil 'standard))
+          (if (and (not (assoc "BEAMER_env" props))
+                   (looking-at ".*?:B_\\(note\\(NH\\)?\\):"))
+              (push (cons "BEAMER_env" (match-string 1)) props))
+          (put-text-property (point-at-bol) (point-at-eol) 'org-props props)))
+       (setq org-export-latex-options-plist
+            (plist-put org-export-latex-options-plist :tags nil))))))
+
+(defun org-beamer-auto-fragile-frames ()
+  "Mark any frames containing verbatim environments as fragile.
+This function will run in the final LaTeX document."
+  (when org-beamer-export-is-beamer-p
+    (let (opts)
+      (goto-char (point-min))
+      ;; Find something that might be fragile
+      (while (re-search-forward org-beamer-fragile-re nil t)
+       (save-excursion
+         ;; Are we inside a frame here?
+         (when (and (re-search-backward "^[ \t]*\\\\\\(begin\\|end\\){frame}"
+                                        nil t)
+                    (equal (match-string 1) "begin"))
+           ;; yes, inside a frame, make sure "fragile" is one of the options
+           (goto-char (match-end 0))
+           (if (not (looking-at "\\[.*?\\]"))
+               (insert "[fragile]")
+             (setq opts (substring (match-string 0) 1 -1))
+             (delete-region (match-beginning 0) (match-end 0))
+             (setq opts (org-split-string opts ","))
+             (add-to-list 'opts "fragile")
+             (insert "[" (mapconcat 'identity opts ",") "]"))))))))
+
+(defcustom org-beamer-outline-frame-title "Outline"
+  "Default title of a frame containing an outline."
+  :group 'org-beamer
+  :type '(string :tag "Outline frame title")
+)
+
+(defcustom org-beamer-outline-frame-options nil
+  "Outline frame options appended after \\begin{frame}.
+You might want to put e.g. [allowframebreaks=0.9] here.  Remember to
+include square brackets."
+  :group 'org-beamer
+  :type '(string :tag "Outline frame options")
+)
+
+(defun org-beamer-fix-toc ()
+  "Fix the table of contents by removing the vspace line."
+  (when org-beamer-export-is-beamer-p
+    (save-excursion
+      (goto-char (point-min))
+      (when (re-search-forward "\\(\\\\setcounter{tocdepth.*\n\\\\tableofcontents.*\n\\)\\(\\\\vspace\\*.*\\)"
+                              nil t)
+       (replace-match
+        (concat "\\\\begin{frame}" org-beamer-outline-frame-options
+                "\n\\\\frametitle{"
+                org-beamer-outline-frame-title
+                "}\n\\1\\\\end{frame}")
+        t nil)))))
+
+(defun org-beamer-property-changed (property value)
+  "Track the BEAMER_env property with tags."
+  (cond
+   ((equal property "BEAMER_env")
+    (save-excursion
+      (org-back-to-heading t)
+      (let ((tags (org-get-tags)))
+       (setq tags (delq nil (mapcar (lambda (x)
+                                      (if (string-match "^B_" x) nil x))
+                                    tags)))
+       (org-set-tags-to tags))
+      (when (and value (stringp value) (string-match "\\S-" value))
+       (org-toggle-tag (concat "B_" value) 'on))))
+   ((equal property "BEAMER_col")
+    (org-toggle-tag "BMCOL" (if (and value (string-match "\\S-" value))
+                               'on 'off)))))
+
+(defun org-beamer-select-beamer-code ()
+  "Take code marked for BEAMER and turn it into marked for LaTeX."
+  (when org-beamer-export-is-beamer-p
+    (goto-char (point-min))
+    (while (re-search-forward
+           "^\\([ \]*#\\+\\(begin_\\|end_\\)?\\)\\(beamer\\)\\>" nil t)
+      (replace-match "\\1latex"))))
+
+;; OK, hook all these functions into appropriate places
+(add-hook 'org-export-first-hook
+         'org-beamer-initialize-open-trackers)
+(add-hook 'org-property-changed-functions
+         'org-beamer-property-changed)
+(add-hook 'org-export-latex-after-initial-vars-hook
+         'org-beamer-after-initial-vars)
+(add-hook 'org-export-latex-final-hook
+         'org-beamer-place-default-actions-for-lists)
+(add-hook 'org-export-latex-final-hook
+         'org-beamer-auto-fragile-frames)
+(add-hook 'org-export-latex-final-hook
+         'org-beamer-fix-toc)
+(add-hook 'org-export-latex-final-hook
+         'org-beamer-amend-header)
+(add-hook 'org-export-preprocess-before-selecting-backend-code-hook
+         'org-beamer-select-beamer-code)
+
+(defun org-insert-beamer-options-template (kind)
+  "Insert a settings template, to make sure users do this right."
+  (interactive (progn
+                (message "Current [s]ubtree or [g]lobal?")
+                (if (equal (read-char-exclusive) ?g)
+                    (list 'global)
+                  (list 'subtree))))
+  (if (eq kind 'subtree)
+      (progn
+       (org-back-to-heading t)
+       (org-reveal)
+       (org-entry-put nil "LaTeX_CLASS" "beamer")
+       (org-entry-put nil "LaTeX_CLASS_OPTIONS" "[presentation]")
+       (org-entry-put nil "EXPORT_FILE_NAME" "presentation.pdf")
+       (org-entry-put nil "BEAMER_FRAME_LEVEL" (number-to-string
+                                                org-beamer-frame-level))
+       (when org-beamer-themes
+         (org-entry-put nil "BEAMER_HEADER_EXTRA" org-beamer-themes))
+       (when org-beamer-column-view-format
+         (org-entry-put nil "COLUMNS" org-beamer-column-view-format))
+       (org-entry-put nil "BEAMER_col_ALL" "0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 :ETC"))
+    (insert "#+LaTeX_CLASS: beamer\n")
+    (insert "#+LaTeX_CLASS_OPTIONS: [presentation]\n")
+    (insert (format "#+BEAMER_FRAME_LEVEL: %d\n" org-beamer-frame-level) "\n")
+    (when org-beamer-themes
+      (insert "#+BEAMER_HEADER_EXTRA: " org-beamer-themes "\n"))
+    (when org-beamer-column-view-format
+      (insert "#+COLUMNS: " org-beamer-column-view-format "\n"))
+    (insert "#+PROPERTY: BEAMER_col_ALL 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 :ETC\n")))
+
+
+(defun org-beamer-allowed-property-values (property)
+  "Supply allowed values for BEAMER properties."
+  (cond
+   ((and (equal property "BEAMER_env")
+        (not (org-entry-get nil (concat property "_ALL") 'inherit)))
+    ;; If no allowed values for BEAMER_env have been defined,
+    ;; supply all defined environments
+    (mapcar 'car (append org-beamer-environments-extra
+                        org-beamer-environments-default)))
+   ((and (equal property "BEAMER_col")
+        (not (org-entry-get nil (concat property "_ALL") 'inherit)))
+    ;; If no allowed values for BEAMER_col have been defined,
+    ;; supply some
+    '("0.1" "0.2" "0.3" "0.4" "0.5" "0.6" "0.7" "0.8" "0.9" "" ":ETC"))
+   (t nil)))
+
+(add-hook 'org-property-allowed-value-functions
+         'org-beamer-allowed-property-values)
+
+(provide 'org-beamer)
+
+;; arch-tag: 68bac91a-a946-43a3-8173-a9269306f67c
+
+;;; org-beamer.el ends here
index 7f9d99a180dd89512761ba85e58b1f9c8d7f7ecb..f7f6595f5a1d35b0771c536a0197660f2882eb2c 100644 (file)
@@ -5,7 +5,7 @@
 ;; Author: Bastien Guerry <bzg at altern dot org>
 ;;         Carsten Dominik <carsten dot dominik at gmail dot com>
 ;; Keywords: org, wp, remember
-;; Version: 6.33x
+;; Version: 7.01
 ;;
 ;; This file is part of GNU Emacs.
 ;;
diff --git a/lisp/org/org-capture.el b/lisp/org/org-capture.el
new file mode 100644 (file)
index 0000000..c6197d6
--- /dev/null
@@ -0,0 +1,1321 @@
+;;; org-capture.el --- Fast note taking in Org-mode
+
+;; Copyright (C) 2010  Free Software Foundation, Inc.
+
+;; Author: Carsten Dominik <carsten at orgmode dot org>
+;; Keywords: outlines, hypermedia, calendar, wp
+;; Homepage: http://orgmode.org
+;; Version: 7.01
+;;
+;; 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:
+
+;; This file contains an alternative implementation of the same functionality
+;; that is also provided by org-remember.el.  The implementation is more
+;; streamlined, can produce more target types (e.g. plain list items or
+;; table lines).  Also, it does not use a temporary buffer for editing
+;; the captured entry - instead it uses an indirect buffer that visits
+;; the new entry already in the target buffer (this was an idea by Samuel
+;; Wales).  John Wiegley's excellent `remember.el' is not needed for this
+;; implementation, even though we borrow heavily from its ideas.
+
+;; This implementation heavily draws on ideas by James TD Smith and
+;; Samuel Wales, and, of cause, uses John Wiegley's remember.el as inspiration.
+
+;;; TODO
+
+;; - find a clever way to not always insert an annotation maybe a
+;;   predicate function that can check for conditions for %a to be
+;;   used.  This could be one of the properties.
+
+;; - Should there be plist members that arrange for properties to be
+;;   asked for, like James proposed in his RFC?
+
+;;; Code:
+
+(eval-when-compile
+  (require 'cl))
+(require 'org)
+(require 'org-mks)
+
+(declare-function org-datetree-find-date-create "org-datetree"
+                 (DATE &optional KEEP-RESTRICTION))
+(declare-function org-table-get-specials "org-table" ())
+(declare-function org-table-goto-line "org-table" (N))
+(defvar org-remember-default-headline)
+(defvar org-remember-templates)
+(defvar org-table-hlines)
+
+(defvar org-capture-clock-was-started nil
+  "Internal flag, noting if the clock was started.")
+
+(defvar org-capture-last-stored-marker (make-marker)
+  "Marker pointing to the entry most recently stored with `org-capture'.")
+
+;; The following variable is scoped dynamically by org-protocol
+;; to indicate that the link properties have already been stored
+(defvar org-capture-link-is-already-stored nil)
+
+(defgroup org-capture nil
+  "Options concerning capturing new entries."
+  :tag "Org Capture"
+  :group 'org)
+
+(defcustom org-capture-templates nil
+  "Templates for the creation of new entries.
+
+Each entry is a list with the following items:
+
+keys         The keys that will select the template, as a string, characters
+             only, for example \"a\" for a template to be selected with a
+             single key, or \"bt\" for selection with two keys.  When using
+             several keys, keys using the same prefix key must be together
+             in the list and preceded by a 2-element entry explaining the
+             prefix key, for example
+
+                     (\"b\" \"Templates for marking stuff to buy\")
+
+             The \"C\" key is used by default for quick access to the
+             customization of the template variable.  But if you want to use
+             that key for a template, you can.
+
+description  A short string describing the template, will be shown during
+             selection.
+
+type         The type of entry.  Valid types are:
+               entry       an Org-mode node, with a headline. Will be
+                           filed as the child of the target entry or as
+                           a top-level entry.
+               item        a plain list item, will be placed in the
+                           first plain list at the target
+                           location.
+               checkitem   a checkbox item.  This differs from the
+                           plain list item only is so far as it uses a
+                           different default template.
+               table-line  a new line in the first table at target location.
+               plain       text to be inserted as it is.
+
+target       Specification of where the captured item should be placed.
+             In Org-mode files, targets usually define a node.  Entries will
+             become children of this node, other types will be added to the
+             table or list in the body of this node.
+
+             Valid values are:
+
+             (file \"path/to/file\")
+                 Text will be placed at the beginning or end of that file
+
+             (id \"id of existing org entry\")
+                 File as child of this entry, or in the body of the entry
+
+             (file+headline \"path/to/file\" \"node headline\")
+                 Fast configuration if the target heading is unique in the file
+
+             (file+olp \"path/to/file\" \"Level 1 heading\" \"Level 2\" ...)
+                 For non-unique headings, the full path is safer
+
+             (file+regexp  \"path/to/file\" \"regexp to find location\")
+                 File to the entry matching regexp
+
+             (file+datetree \"path/to/file\")
+                 Will create a heading in a date tree
+
+             (file+function \"path/to/file\" function-finding-location)
+                 A function to find the right location in the file
+
+             (clock)
+                File to the entry that is currently being clocked
+
+             (function function-finding-location)
+                Most general way, write your own function to find both
+                file and location
+
+template     The template for creating the capture item.  If you leave this
+             empty, an appropriate default template will be used.  See below
+             for more details.  Instead of a string, this may also be one of
+
+                 (file \"/path/to/template-file\")
+                 (function function-returning-the-template)
+
+             in order to get a template from a file, or dynamically
+             from a function.
+
+The rest of the entry is a property list of additional options.  Recognized
+properties are:
+
+ :prepend            Normally newly captured information will be appended at
+                     the target location (last child, last table line,
+                     last list item...).  Setting this property will
+                     change that.
+
+ :immediate-finish   When set, do not offer to edit the information, just
+                     file it away immediately.  This makes sense if the
+                     template only needs information that can be added
+                     automatically.
+
+ :empty-lines        Set this to the number of lines the should be inserted
+                     before and after the new item.  Default 0, only common
+                     other value is 1.
+
+ :clock-in           Start the clock in this item.
+
+ :clock-resume       Start the interrupted clock when finishing the capture.
+
+ :unnarrowed         Do not narrow the target buffer, simply show the
+                     full buffer.  Default is to narrow it so that you
+                     only see the new stuff.
+
+ :table-line-pos     Specification of the location in the table where the
+                     new line should be inserted.  It looks like \"II-3\"
+                     which means that the new line should become the third
+                     line before the second horizontal separator line.
+
+The template defines the text to be inserted.  Often this is an org-mode
+entry (so the first line should start with a star) that will be filed as a
+child of the target headline.  It can also be freely formatted text.
+Furthermore, the following %-escapes will be replaced with content:
+
+  %^{prompt}  prompt the user for a string and replace this sequence with it.
+              A default value and a completion table ca be specified like this:
+              %^{prompt|default|completion2|completion3|...}
+  %t          time stamp, date only
+  %T          time stamp with date and time
+  %u, %U      like the above, but inactive time stamps
+  %^t         like %t, but prompt for date.  Similarly %^T, %^u, %^U.
+              You may define a prompt like %^{Please specify birthday
+  %n          user name (taken from `user-full-name')
+  %a          annotation, normally the link created with `org-store-link'
+  %i          initial content, copied from the active region.  If %i is
+              indented, the entire inserted text will be indented as well.
+  %c          current kill ring head
+  %x          content of the X clipboard
+  %^C         interactive selection of which kill or clip to use
+  %^L         like %^C, but insert as link
+  %k          title of currently clocked task
+  %K          link to currently clocked task
+  %^g         prompt for tags, with completion on tags in target file
+  %^G         prompt for tags, with completion on all tags in all agenda files
+  %^{prop}p   prompt the user for a value for property `prop'
+  %:keyword   specific information for certain link types, see below
+  %[pathname] insert the contents of the file given by `pathname'
+  %(sexp)     evaluate elisp `(sexp)' and replace with the result
+
+  %?          After completing the template, position cursor here.
+
+Apart from these general escapes, you can access information specific to the
+link type that is created.  For example, calling `org-capture' in emails
+or gnus will record the author and the subject of the message, which you
+can access with \"%:author\" and \"%:subject\", respectively.  Here is a
+complete list of what is recorded for each link type.
+
+Link type          |  Available information
+-------------------+------------------------------------------------------
+bbdb               |  %:type %:name %:company
+vm, wl, mh, rmail  |  %:type %:subject %:message-id
+                   |  %:from %:fromname %:fromaddress
+                   |  %:to   %:toname   %:toaddress
+                   |  %:fromto (either \"to NAME\" or \"from NAME\")
+gnus               |  %:group, for messages also all email fields
+w3, w3m            |  %:type %:url
+info               |  %:type %:file %:node
+calendar           |  %:type %:date"
+  :group 'org-capture
+  :type
+  '(repeat
+    (choice :value ("" "" entry (file "~/org/notes.org") "")
+     (list :tag "Multikey description"
+          (string :tag "Keys       ")
+          (string :tag "Description"))
+     (list :tag "Template entry"
+          (string :tag "Keys           ")
+          (string :tag "Description    ")
+          (choice :tag "Capture Type   " :value entry
+                  (const :tag "Org entry" entry)
+                  (const :tag "Plain list item" item)
+                  (const :tag "Checkbox item" checkitem)
+                  (const :tag "Plain text" plain)
+                  (const :tag "Table line" table-line))
+          (choice :tag "Target location"
+                  (list :tag "File"
+                        (const :format "" file)
+                        (file :tag "  File"))
+                  (list :tag "ID"
+                        (const :format "" id)
+                        (string :tag "  ID"))
+                  (list :tag "File & Headline"
+                        (const :format "" file+headline)
+                        (file   :tag "  File    ")
+                        (string :tag "  Headline"))
+                  (list :tag "File & Outline path"
+                        (const :format "" file+olp)
+                        (file   :tag "  File    ")
+                        (repeat :tag "Outline path" :inline t
+                                (string :tag "Headline")))
+                  (list :tag "File & Regexp"
+                        (const :format "" file+regexp)
+                        (file   :tag "  File  ")
+                        (regexp :tag "  Regexp"))
+                  (list :tag "File & Date tree"
+                        (const :format "" file+datetree)
+                        (file :tag "  File"))
+                  (list :tag "File & function"
+                        (const :format "" file+function)
+                        (file :tag "  File    ")
+                        (sexp :tag "  Function"))
+                  (list :tag "Current clocking task"
+                        (const :format "" clock))
+                  (list :tag "Function"
+                        (const :format "" function)
+                        (sexp :tag "  Function")))
+          (choice :tag "Template"
+                  (string)
+                  (list :tag "File"
+                        (const :format "" file)
+                        (file :tag "Template file"))
+                  (list :tag "Function"
+                        (const :format "" function)
+                        (file :tag "Template function")))
+          (plist :inline t
+                 ;; Give the most common options as checkboxes
+                 :options (((const :format "%v " :prepend) (const t))
+                           ((const :format "%v " :immediate-finish) (const t))
+                           ((const :format "%v " :empty-lines) (const 1))
+                           ((const :format "%v " :clock-in) (const t))
+                           ((const :format "%v " :clock-resume) (const t))
+                           ((const :format "%v " :unnarrowed) (const t))))))))
+
+(defcustom org-capture-before-finalize-hook nil
+  "Hook that is run right before a remember process is finalized.
+The remember buffer is still current when this hook runs."
+  :group 'org-capture
+  :type 'hook)
+
+;;; The property list for keeping information about the capture process
+
+(defvar org-capture-plist nil
+  "Plist for the current capture process, global, to avoid having to pass it.")
+(defvar org-capture-current-plist nil
+  "Local variable holding the plist in a capture buffer.
+This is used to store the plist for use when finishing a capture process.
+Another such process might have changed the global variable by then.")
+
+(defun org-capture-put (&rest stuff)
+  (while stuff
+    (setq org-capture-plist (plist-put org-capture-plist
+                                      (pop stuff) (pop stuff)))))
+(defun org-capture-get (prop &optional local)
+  (plist-get (if local org-capture-current-plist org-capture-plist) prop))
+
+(defun org-capture-member (prop)
+  (plist-get org-capture-plist prop))
+
+;;; The minor mode
+
+(defvar org-capture-mode-map (make-sparse-keymap)
+  "Keymap for `org-capture-mode', a minor mode.
+Use this map to set additional keybindings for when Org-mode is used
+for a Remember buffer.")
+
+(defvar org-capture-mode-hook nil
+  "Hook for the minor `org-capture-mode'.")
+
+(define-minor-mode org-capture-mode
+  "Minor mode for special key bindings in a remember buffer."
+  nil " Rem" org-capture-mode-map
+  (org-set-local
+   'header-line-format
+   "Capture buffer.  Finish `C-c C-c', refile `C-c C-w', abort `C-c C-k'.")
+  (run-hooks 'org-capture-mode-hook))
+(define-key org-capture-mode-map "\C-c\C-c" 'org-capture-finalize)
+(define-key org-capture-mode-map "\C-c\C-k" 'org-capture-kill)
+(define-key org-capture-mode-map "\C-c\C-w" 'org-capture-refile)
+
+;;; The main commands
+
+;;;###autoload
+(defun org-capture (&optional goto keys)
+  "Capture something.
+\\<org-capture-mode-map>
+This will let you select a template from `org-capture-templates', and then
+file the newly captured information.  The text is immediately inserted
+at the target location, and an indirect buffer is shown where you can
+edit it.  Pressing \\[org-capture-finalize] brings you back to the previous state
+of Emacs, so that you can continue your work.
+
+When called interactively with a \\[universal-argument] prefix argument GOTO, don't capture
+anything, just go to the file/headline where the selected template
+stores its notes.  With a double prefix argument \
+\\[universal-argument] \\[universal-argument], go to the last note
+stored.
+
+When called with a `C-0' (zero) prefix, insert a template at point.
+
+Lisp programs can set KEYS to a string associated with a template in
+`org-capture-templates'.  In this case, interactive selection will be
+bypassed."
+  (interactive "P")
+  (cond
+   ((equal goto '(4)) (org-capture-goto-target))
+   ((equal goto '(16)) (org-capture-goto-last-stored))
+   (t
+    ;; FIXME: Are these needed?
+    (let* ((orig-buf (current-buffer))
+          (annotation (if (and (boundp 'org-capture-link-is-already-stored)
+                               org-capture-link-is-already-stored)
+                          (plist-get org-store-link-plist :annotation)
+                        (org-store-link nil)))
+          (initial (and (org-region-active-p)
+                        (buffer-substring (point) (mark))))
+          (entry (org-capture-select-template keys)))
+      (cond
+       ((equal entry "C")
+       (customize-variable 'org-capture-templates))
+       ((equal entry "q")
+       (error "Abort"))
+       (t
+       (org-capture-set-plist entry)
+       (org-capture-get-template)
+       (org-capture-put :original-buffer orig-buf :annotation annotation
+                        :initial initial)
+       (org-capture-put :default-time
+                        (or org-overriding-default-time
+                            (org-current-time)))
+       (org-capture-set-target-location)
+       (condition-case error
+           (org-capture-put :template (org-capture-fill-template))
+         ((error quit)
+          (if (get-buffer "*Capture*") (kill-buffer "*Capture*"))
+          (error "Capture abort: %s" error)))
+
+       (if (equal goto 0)
+           ;;insert at point
+           (org-capture-insert-template-here)
+         (condition-case error
+             (org-capture-place-template)
+           ((error quit)
+            (if (and (buffer-base-buffer (current-buffer))
+                     (string-match "\\`CAPTURE-" (buffer-name)))
+                (kill-buffer (current-buffer)))
+            (set-window-configuration (org-capture-get :return-to-wconf))
+            (error "Capture template `%s': %s"
+                   (org-capture-get :key)
+                   (nth 1 error))))
+         (if (org-capture-get :immediate-finish)
+             (org-capture-finalize)
+           (if (and (org-mode-p)
+                    (org-capture-get :clock-in))
+               (condition-case nil
+                   (progn
+                     (if (org-clock-is-active)
+                         (org-capture-put :interrupted-clock
+                                          (copy-marker org-clock-marker)))
+                     (org-clock-in)
+                     (org-set-local 'org-capture-clock-was-started t))
+                 (error
+                  "Could not start the clock in this capture buffer")))))))))))
+
+
+(defun org-capture-get-template ()
+  "Get the template from a file or a function if necessary."
+  (let ((txt (org-capture-get :template)) file)
+    (cond
+     ((and (listp txt) (eq (car txt) 'file))
+      (if (file-exists-p
+          (setq file (expand-file-name (nth 1 txt) org-directory)))
+         (setq txt (org-file-contents file))
+       (setq txt (format "* Template file %s not found" (nth 1 txt)))))
+     ((and (listp txt) (eq (car txt) 'function))
+      (if (fboundp (nth 1 txt))
+         (setq txt (funcall (nth 1 txt)))
+       (setq txt (format "* Template function %s not found" (nth 1 txt)))))
+     ((not txt) (setq txt ""))
+     ((stringp txt))
+     (t (setq txt "* Invalid capture template")))
+    (org-capture-put :template txt)))
+
+(defun org-capture-finalize ()
+  "Finalize the capture process."
+  (interactive)
+  (unless (and org-capture-mode
+              (buffer-base-buffer (current-buffer)))
+    (error "This does not seem to be a capture buffer for Org-mode"))
+
+  ;; Did we start the clock in this capture buffer?
+  (when (and org-capture-clock-was-started
+            org-clock-marker (marker-buffer org-clock-marker)
+            (equal (marker-buffer org-clock-marker) (buffer-base-buffer))
+            (> org-clock-marker (point-min))
+            (< org-clock-marker (point-max)))
+    ;; Looks like the clock we started is still running.  Clock out.
+    (let (org-log-note-clock-out) (org-clock-out))
+    (when (and (org-capture-get :clock-resume 'local)
+              (markerp (org-capture-get :interrupted-clock 'local))
+              (buffer-live-p (marker-buffer
+                              (org-capture-get :interrupted-clock 'local))))
+      (org-with-point-at (org-capture-get :interrupted-clock 'local)
+       (org-clock-in))
+      (message "Interrupted clock has been resumed")))
+
+  (let ((beg (point-min))
+       (end (point-max))
+       (abort-note nil))
+    (widen)
+
+    (if org-note-abort
+       (let ((m1 (org-capture-get :begin-marker 'local))
+             (m2 (org-capture-get :end-marker 'local)))
+         (if (and m1 m2 (= m1 beg) (= m2 end))
+             (progn
+               (setq abort-note 'clean)
+               (kill-region m1 m2))
+           (setq abort-note 'dirty)))
+
+      ;; Make sure that the empty lines after are correct
+      (when (and (> (point-max) end) ; indeed, the buffer was still narrowed
+                (member (org-capture-get :type 'local)
+                        '(entry item checkitem plain)))
+       (save-excursion
+         (goto-char end)
+         (or (bolp) (newline))
+         (org-capture-empty-lines-after
+          (or (org-capture-get :empty-lines 'local) 0))))
+      ;; Postprocessing:  Update Statistics cookies, do the sorting
+      (when (org-mode-p)
+       (save-excursion
+         (when (ignore-errors (org-back-to-heading))
+           (org-update-parent-todo-statistics)
+           (org-update-checkbox-count)))
+       ;; FIXME Here we should do the sorting
+       ;; If we have added a table line, maybe recompute?
+       (when (and (eq (org-capture-get :type 'local) 'table-line)
+                  (org-at-table-p))
+         (if (org-table-get-stored-formulas)
+             (org-table-recalculate 'all) ;; FIXME: Should we iterate???
+           (org-table-align)))
+       )
+      ;; Store this place as the last one where we stored something
+      ;; Do the marking in the base buffer, so that it makes sense after
+      ;; the indirect buffer has been killed.
+      (org-capture-bookmark-last-stored-position)
+
+      ;; Run the hook
+      (run-hooks 'org-capture-before-finalize-hook)
+      )
+
+    ;; Kill the indirect buffer
+    (save-buffer)
+    (let ((return-wconf (org-capture-get :return-to-wconf 'local)))
+      (kill-buffer (current-buffer))
+      ;; Restore the window configuration before capture
+      (set-window-configuration return-wconf))
+    (when abort-note
+      (cond
+       ((equal abort-note 'clean)
+       (message "Capture process aborted and target file cleaned up"))
+       ((equal abort-note 'dirty)
+       (error "Capture process aborted, but target buffer could not be cleaned up correctly"))))))
+
+(defun org-capture-refile ()
+  "Finalize the current capture and then refile the entry.
+Refiling is done from the base buffer, because the indirect buffer is then
+already gone."
+  (interactive)
+  (unless (eq (org-capture-get :type 'local) 'entry)
+    (error
+     "Refiling from a capture buffer makes only sense for `entry'-type templates"))
+  (let ((pos (point))
+       (base (buffer-base-buffer (current-buffer)))
+       (org-refile-for-capture t))
+    (org-capture-finalize)
+    (save-window-excursion
+      (with-current-buffer (or base (current-buffer))
+       (save-excursion
+         (save-restriction
+           (widen)
+           (goto-char pos)
+           (call-interactively 'org-refile)))))))
+
+(defun org-capture-kill ()
+  "Abort the current capture process."
+  (interactive)
+  ;; FIXME: This does not do the right thing, we need to remove the new stuff
+  ;; By hand it is easy: undo, then kill the buffer
+  (let ((org-note-abort t) (org-capture-before-finalize-hook nil))
+    (org-capture-finalize)))
+
+(defun org-capture-goto-last-stored ()
+  "Go to the location where the last remember note was stored."
+  (interactive)
+  (org-goto-marker-or-bmk org-capture-last-stored-marker
+                         "org-capture-last-stored")
+  (message "This is the last note stored by a capture process"))
+
+;;; Supporting functions for handling the process
+
+(defun org-capture-set-target-location (&optional target)
+  "Find target buffer and position and store then in the property list."
+  (let ((target-entry-p t))
+    (setq target (or target (org-capture-get :target)))
+    (save-excursion
+      (cond
+       ((eq (car target) 'file)
+       (set-buffer (org-capture-target-buffer (nth 1 target)))
+       (setq target-entry-p nil))
+
+       ((eq (car target) 'id)
+       (let ((loc (org-id-find (nth 1 target))))
+         (if (not loc)
+             (error "Cannot find target ID \"%s\"" (nth 1 target))
+           (set-buffer (org-capture-target-buffer (car loc)))
+           (goto-char (cdr loc)))))
+
+       ((eq (car target) 'file+headline)
+       (set-buffer (org-capture-target-buffer (nth 1 target)))
+       (let ((hd (nth 2 target)))
+         (goto-char (point-min))
+         (if (re-search-forward
+              (format org-complex-heading-regexp-format (regexp-quote hd))
+              nil t)
+             (goto-char (point-at-bol))
+           (goto-char (point-max))
+           (or (bolp) (insert "\n"))
+           (insert "* " hd "\n")
+           (beginning-of-line 0))))
+
+       ((eq (car target) 'file+olp)
+       (let ((m (org-find-olp (cdr target))))
+         (set-buffer (marker-buffer m))
+         (goto-char m)))
+
+       ((eq (car target) 'file+regexp)
+       (set-buffer (org-capture-target-buffer (nth 1 target)))
+       (goto-char (point-min))
+       (if (re-search-forward (nth 2 target) nil t)
+           (progn
+             (goto-char (if (org-capture-get :prepend)
+                            (match-beginning 0) (match-end 0)))
+             (org-capture-put :exact-position (point))
+             (setq target-entry-p (and (org-mode-p) (org-at-heading-p))))
+         (error "No match for target regexp in file %s" (nth 1 target))))
+
+       ((eq (car target) 'file+datetree)
+       (require 'org-datetree)
+       (set-buffer (org-capture-target-buffer (nth 1 target)))
+       ;; Make a date tree entry, with the current date (or yesterday,
+       ;; if we are extending dates for a couple of hours)
+       (org-datetree-find-date-create
+        (calendar-gregorian-from-absolute
+         (if org-overriding-default-time
+             (time-to-days org-overriding-default-time)
+           (time-to-days
+            (time-subtract (current-time)
+                           (list 0 (* 3600 org-extend-today-until) 0)))))))
+
+       ((eq (car target) 'file+function)
+       (set-buffer (org-capture-target-buffer (nth 1 target)))
+       (funcall (nth 2 target))
+       (org-capture-put :exact-position (point))
+       (setq target-entry-p (and (org-mode-p) (org-at-heading-p))))
+
+       ((eq (car target) 'function)
+       (funcall (nth 1 target))
+       (org-capture-put :exact-position (point))
+       (setq target-entry-p (and (org-mode-p) (org-at-heading-p))))
+
+       ((eq (car target) 'clock)
+       (if (and (markerp org-clock-hd-marker)
+                (marker-buffer org-clock-hd-marker))
+           (progn (set-buffer (marker-buffer org-clock-hd-marker))
+                  (goto-char org-clock-hd-marker))
+         (error "No running clock that could be used as capture target")))
+
+       (t (error "Invalid capture target specification")))
+
+      (org-capture-put :buffer (current-buffer) :pos (point)
+                      :target-entry-p target-entry-p))))
+
+(defun org-capture-target-buffer (file)
+  "Get a buffer for FILE."
+  (or (org-find-base-buffer-visiting file)
+      (find-file-noselect (expand-file-name file org-directory))))
+
+(defun org-capture-steal-local-variables (buffer)
+  "Install Org-mode local variables."
+  (mapc (lambda (v)
+         (ignore-errors (org-set-local (car v) (cdr v))))
+       (buffer-local-variables buffer)))
+
+(defun org-capture-place-template ()
+  "Insert the template at the target location, and display the buffer."
+  (org-capture-put :return-to-wconf (current-window-configuration))
+  (delete-other-windows)
+  (org-switch-to-buffer-other-window
+   (org-capture-get-indirect-buffer (org-capture-get :buffer) "CAPTURE"))
+  (show-all)
+  (goto-char (org-capture-get :pos))
+  (org-set-local 'org-capture-target-marker
+                (move-marker (make-marker) (point)))
+  (let* ((template (org-capture-get :template))
+        (type (org-capture-get :type)))
+    (case type
+      ((nil entry) (org-capture-place-entry))
+      (table-line (org-capture-place-table-line))
+      (plain (org-capture-place-plain-text))
+      (item  (org-capture-place-item))))
+  (org-capture-mode 1)
+  (org-set-local 'org-capture-current-plist org-capture-plist))
+
+(defun org-capture-place-entry ()
+  "Place the template as a new Org entry."
+  (let* ((txt (org-capture-get :template))
+        (reversed (org-capture-get :prepend))
+        (target-entry-p (org-capture-get :target-entry-p))
+        level beg end file)
+
+    (cond
+     ((org-capture-get :exact-position)
+      (goto-char (org-capture-get :exact-position)))
+     ((not target-entry-p)
+      ;; Insert as top-level entry, either at beginning or at end of file
+      (setq level 1)
+      (if reversed
+         (progn (goto-char (point-min))
+                (outline-next-heading))
+       (goto-char (point-max))
+       (or (bolp) (insert "\n"))))
+     (t
+      ;; Insert as a child of the current entry
+      (and (looking-at "\\*+")
+          (setq level (- (match-end 0) (match-beginning 0))))
+      (setq level (org-get-valid-level (or level 1) 1))
+      (if reversed
+         (progn
+           (outline-next-heading)
+           (or (bolp) (insert "\n")))
+       (org-end-of-subtree t t)
+       (or (bolp) (insert "\n")))))
+    (org-capture-empty-lines-before)
+    (setq beg (point))
+    (org-paste-subtree level txt 'for-yank)
+    (org-capture-empty-lines-after 1)
+    (org-capture-position-for-last-stored beg)
+    (outline-next-heading)
+    (setq end (point))
+    (org-capture-mark-kill-region beg (1- end))
+    (org-capture-narrow beg (1- end))
+    (if (re-search-forward "%\\?" end t) (replace-match ""))))
+
+(defun org-capture-place-item ()
+  "Place the template as a new plain list item."
+  (let* ((txt (org-capture-get :template))
+        (target-entry-p (org-capture-get :target-entry-p))
+        (ind 0)
+        beg end)
+    (cond
+     ((org-capture-get :exact-position)
+      (goto-char (org-capture-get :exact-position)))
+     ((not target-entry-p)
+      ;; Insert as top-level entry, either at beginning or at end of file
+      (setq beg (point-min) end (point-max)))
+     (t
+      (setq beg (1+ (point-at-eol))
+           end (save-excursion (outline-next-heading) (point)))))
+    (if (org-capture-get :prepend)
+       (progn
+         (goto-char beg)
+         (if (re-search-forward (concat "^" (org-item-re)) nil t)
+             (progn
+               (goto-char (match-beginning 0))
+               (setq ind (org-get-indentation)))
+           (goto-char end)
+           (setq ind 0)))
+      (goto-char end)
+      (if (re-search-backward (concat "^" (org-item-re)) nil t)
+         (progn
+           (setq ind (org-get-indentation))
+           (org-end-of-item))
+       (setq ind 0)))
+    ;; Remove common indentation
+    (setq txt (org-remove-indentation txt))
+    ;; Make sure this is indeed an item
+    (unless (string-match (concat "\\`" (org-item-re)) txt)
+      (setq txt (concat "- "
+                       (mapconcat 'identity (split-string txt "\n")
+                                  "\n  "))))
+    ;; Set the correct indentation, depending on context
+    (setq ind (make-string ind ?\ ))
+    (setq txt (concat ind
+                     (mapconcat 'identity (split-string txt "\n")
+                                (concat "\n" ind))
+                     "\n"))
+    ;; Insert, with surrounding empty lines
+    (org-capture-empty-lines-before)
+    (setq beg (point))
+    (insert txt)
+    (or (bolp) (insert "\n"))
+    (org-capture-empty-lines-after 1)
+    (org-capture-position-for-last-stored beg)
+    (forward-char 1)
+    (setq end (point))
+    (org-capture-mark-kill-region beg (1- end))
+    (org-capture-narrow beg (1- end))
+    (if (re-search-forward "%\\?" end t) (replace-match ""))))
+
+(defun org-capture-place-table-line ()
+  "Place the template as a table line."
+  (require 'org-table)
+  (let* ((txt (org-capture-get :template))
+        (target-entry-p (org-capture-get :target-entry-p))
+        (table-line-pos (org-capture-get :table-line-pos))
+        ind beg end)
+    (cond
+     ((org-capture-get :exact-position)
+      (goto-char (org-capture-get :exact-position)))
+     ((not target-entry-p)
+      ;; Table is not necessarily under a heading
+      (setq beg (point-min) end (point-max)))
+     (t
+      ;; WE are at a heading, limit search to the body
+      (setq beg (1+ (point-at-eol))
+           end (save-excursion (outline-next-heading) (point)))))
+    (if (re-search-forward org-table-dataline-regexp end t)
+       (let ((b (org-table-begin)) (e (org-table-end)))
+         (goto-char e)
+         (if (looking-at "[ \t]*#\\+TBLFM:")
+             (forward-line 1))
+         (narrow-to-region b (point)))
+      (goto-char end)
+      (insert "\n|   |\n|----|\n|    |\n")
+      (narrow-to-region (1+ end) (point)))
+    ;; We are narrowed to the table, or to an empty line if there was no table
+
+    ;; Check if the template is good
+    (if (not (string-match org-table-dataline-regexp txt))
+       (setq txt "| %?Bad template |\n"))
+    (cond
+     ((and table-line-pos
+          (string-match "\\(I+\\)\\([-+][0-9]\\)" table-line-pos))
+      ;; we have a complex line specification
+      (goto-char (point-min))
+      (let ((nh (- (match-end 1) (match-beginning 1)))
+           (delta (string-to-number (match-string 2 table-line-pos)))
+           ll)
+       ;; The user wants a special position in the table
+       (org-table-get-specials)
+       (setq ll (ignore-errors (aref org-table-hlines nh)))
+       (unless ll (error "Invalid table line specification \"%s\""
+                         table-line-pos))
+       (setq ll (+ ll delta (if (< delta 0) 0 -1)))
+       (org-goto-line ll)
+       (org-table-insert-row 'below)
+       (beginning-of-line 1)
+       (delete-region (point) (1+ (point-at-eol)))
+       (setq beg (point))
+       (insert txt)
+       (setq end (point))))
+     ((org-capture-get :prepend)
+      (goto-char (point-min))
+      (re-search-forward org-table-hline-regexp nil t)
+      (beginning-of-line 1)
+      (re-search-forward org-table-dataline-regexp nil t)
+      (beginning-of-line 1)
+      (setq beg (point))
+      (org-table-insert-row)
+      (beginning-of-line 1)
+      (delete-region (point) (1+ (point-at-eol)))
+      (insert txt)
+      (setq end (point)))
+     (t
+      (goto-char (point-max))
+      (re-search-backward org-table-dataline-regexp nil t)
+      (beginning-of-line 1)
+      (org-table-insert-row 'below)
+      (beginning-of-line 1)
+      (delete-region (point) (1+ (point-at-eol)))
+      (setq beg (point))
+      (insert txt)
+      (setq end (point))))
+    (goto-char beg)
+    (org-capture-position-for-last-stored 'table-line)
+    (if (re-search-forward "%\\?" end t) (replace-match ""))
+    (org-table-align)))
+
+(defun org-capture-place-plain-text ()
+  "Place the template plainly."
+  (let* ((txt (org-capture-get :template))
+        beg end)
+    (goto-char (cond
+               ((org-capture-get :exact-position))
+               ((org-capture-get :prepend) (point-min))
+               (t (point-max))))
+    (or (bolp) (newline))
+    (org-capture-empty-lines-before)
+    (setq beg (point))
+    (insert txt)
+    (org-capture-empty-lines-after 1)
+    (org-capture-position-for-last-stored beg)
+    (setq end (point))
+    (org-capture-mark-kill-region beg (1- end))
+    (org-capture-narrow beg (1- end))
+    (if (re-search-forward "%\\?" end t) (replace-match ""))))
+
+(defun org-capture-mark-kill-region (beg end)
+  "Mark the region that will have to be killed when aborting capture."
+  (let ((m1 (move-marker (make-marker) beg))
+       (m2 (move-marker (make-marker) end)))
+    (org-capture-put :begin-marker m1)
+    (org-capture-put :end-marker m2)))
+
+(defun org-capture-position-for-last-stored (where)
+  "Memorize the position that should later become the position of last capture."
+  (cond
+   ((integerp where)
+    (org-capture-put :position-for-last-stored
+                    (move-marker (make-marker) where
+                                 (or (buffer-base-buffer (current-buffer))
+                                     (current-buffer)))))
+   ((eq where 'table-line)
+    (org-capture-put :position-for-last-stored
+                    (list 'table-line
+                          (org-table-current-dline))))
+   (t (error "This should not happen"))))
+
+(defun org-capture-bookmark-last-stored-position ()
+  "Bookmark the last-captured position."
+  (let* ((where (org-capture-get :position-for-last-stored 'local))
+        (pos (cond
+              ((markerp where)
+               (prog1 (marker-position where)
+                 (move-marker where nil)))
+              ((and (listp where) (eq (car where) 'table-line))
+               (if (org-at-table-p)
+                   (save-excursion
+                     (org-table-goto-line (nth 1 where))
+                     (point-at-bol))
+                 (point))))))
+    (with-current-buffer (buffer-base-buffer (current-buffer))
+      (save-excursion
+       (save-restriction
+         (widen)
+         (goto-char pos)
+         (bookmark-set "org-capture-last-stored")
+         (move-marker org-capture-last-stored-marker (point)))))))
+
+(defun org-capture-narrow (beg end)
+  "Narrow, unless configuration says not to narrow."
+  (unless (org-capture-get :unnarrowed)
+    (narrow-to-region beg end)
+    (goto-char beg)))
+
+(defun org-capture-empty-lines-before (&optional n)
+  "Arrange for the correct number of empty lines before the insertion point.
+Point will be after the empty lines, so insertion can directly be done."
+  (setq n (or n (org-capture-get :empty-lines) 0))
+  (let ((pos (point)))
+    (org-back-over-empty-lines)
+    (delete-region (point) pos)
+    (newline n)))
+
+(defun org-capture-empty-lines-after (&optional n)
+  "Arrange for the correct number of empty lines after the inserted string.
+Point will remain at the first line after the inserted text."
+  (setq n (or n (org-capture-get :empty-lines) 0))
+  (org-back-over-empty-lines)
+  (while (looking-at "[ \t]*\n") (replace-match ""))
+  (let ((pos (point)))
+    (newline n)
+    (goto-char pos)))
+
+(defvar org-clock-marker) ; Defined in org.el
+;;;###autoload
+(defun org-capture-insert-template-here ()
+  (let* ((template (org-capture-get :template))
+        (type  (org-capture-get :type))
+        beg end pp)
+    (or (bolp) (newline))
+    (setq beg (point))
+    (cond
+     ((and (eq type 'entry) (org-mode-p))
+      (org-paste-subtree nil template t))
+     ((and (memq type '(item checkitem))
+          (org-mode-p)
+          (save-excursion (skip-chars-backward " \t\n")
+                          (setq pp (point))
+                          (org-in-item-p)))
+      (goto-char pp)
+      (org-insert-item)
+      (skip-chars-backward " ")
+      (skip-chars-backward "-+*0123456789).")
+      (delete-region (point) (point-at-eol))
+      (setq beg (point))
+      (org-remove-indentation template)
+      (insert template)
+      (org-capture-empty-lines-after)
+      (goto-char beg)
+      (org-maybe-renumber-ordered-list)
+      (org-end-of-item)
+      (setq end (point)))
+     (t (insert template)))
+    (setq end (point))
+    (goto-char beg)
+    (if (re-search-forward "%\\?" end t)
+       (replace-match ""))))
+
+(defun org-capture-set-plist (entry)
+  "Initialize the property list from the template definition."
+  (setq org-capture-plist (copy-sequence (nthcdr 5 entry)))
+  (org-capture-put :key (car entry) :description (nth 1 entry)
+                  :target (nth 3 entry))
+  (let ((txt (nth 4 entry)) (type (or (nth 2 entry) 'entry)))
+    (when (or (not txt) (and (stringp txt) (not (string-match "\\S-" txt))))
+      ;; The template may be empty or omitted for special types.
+      ;; Here we insert the default templates for such cases.
+      (cond
+       ((eq type 'item) (setq txt "- %?"))
+       ((eq type 'checkitem) (setq txt "- [ ] %?"))
+       ((eq type 'table-line) (setq txt "| %? |"))
+       ((member type '(nil entry)) (setq txt "* %?\n  %a"))))
+    (org-capture-put :template txt :type type)))
+
+(defun org-capture-goto-target (&optional template-key)
+  "Go to the target location of a capture template.
+The user is queried for the template."
+  (interactive)
+  (let* (org-select-template-temp-major-mode
+        (entry (org-capture-select-template template-key)))
+    (unless entry
+      (error "No capture template selected"))
+    (org-capture-set-plist entry)
+    (org-capture-set-target-location)
+    (switch-to-buffer (org-capture-get :buffer))
+    (goto-char (org-capture-get :pos))))
+
+(defun org-capture-get-indirect-buffer (&optional buffer prefix)
+  "Make an indirect buffer for a capture process.
+Use PREFIX as a prefix for the name of the indirect buffer."
+  (setq buffer (or buffer (current-buffer)))
+  (let ((n 1) (base (buffer-name buffer)) bname)
+    (setq bname (concat prefix "-" base))
+    (while (buffer-live-p (get-buffer bname))
+      (setq bname (concat prefix "-" (number-to-string (incf n)) "-" base)))
+    (condition-case nil
+        (make-indirect-buffer buffer bname 'clone)
+      (error (make-indirect-buffer buffer bname)))))
+
+
+;;; The template code
+
+(defun org-capture-select-template (&optional keys)
+  "Select a capture template.
+Lisp programs can force the template by setting KEYS to a string."
+  (when org-capture-templates
+    (if keys
+       (or (assoc keys org-capture-templates)
+           (error "No capture template referred to by \"%s\" keys" keys))
+      (if (= 1 (length org-capture-templates))
+         (car org-capture-templates)
+       (org-mks org-capture-templates
+                "Select a capture template\n========================="
+                "Template key: "
+                '(("C" "Customize org-capture-templates")
+                  ("q" "Abort")))))))
+
+(defun org-capture-fill-template (&optional template initial annotation)
+  "Fill a template and return the filled template as a string.
+The template may still contain \"%?\" for cursor positioning."
+  (setq template (or template (org-capture-get :template)))
+  (when (stringp initial)
+    (setq initial (org-no-properties initial))
+    (remove-text-properties 0 (length initial) '(read-only t) initial))
+  (let* ((buffer (org-capture-get :buffer))
+        (file (buffer-file-name (or (buffer-base-buffer buffer) buffer)))
+        (ct (org-capture-get :default-time))
+        (dct (decode-time ct))
+        (ct1
+         (if (< (nth 2 dct) org-extend-today-until)
+             (encode-time 0 59 23 (1- (nth 3 dct)) (nth 4 dct) (nth 5 dct))
+           ct))
+        (plist-p (if org-store-link-plist t nil))
+        (v-c (and (> (length kill-ring) 0) (current-kill 0)))
+        (v-x (or (org-get-x-clipboard 'PRIMARY)
+                 (org-get-x-clipboard 'CLIPBOARD)
+                 (org-get-x-clipboard 'SECONDARY)))
+        (v-t (format-time-string (car org-time-stamp-formats) ct))
+        (v-T (format-time-string (cdr org-time-stamp-formats) ct))
+        (v-u (concat "[" (substring v-t 1 -1) "]"))
+        (v-U (concat "[" (substring v-T 1 -1) "]"))
+        ;; `initial' and `annotation' might habe been passed.
+        ;; But if the property list has them, we prefer those values
+        (v-i (or (plist-get org-store-link-plist :initial)
+                 initial
+                 (org-capture-get :initial)
+                 ""))
+        (v-a (or (plist-get org-store-link-plist :annotation)
+                 annotation
+                 (org-capture-get :annotation)
+                 ""))
+        ;; Is the link empty?  Then we do not want it...
+        (v-a (if (equal v-a "[[]]") "" v-a))
+        (clipboards (remove nil (list v-i
+                                      (org-get-x-clipboard 'PRIMARY)
+                                      (org-get-x-clipboard 'CLIPBOARD)
+                                      (org-get-x-clipboard 'SECONDARY)
+                                      v-c)))
+        (v-A (if (and v-a
+                      (string-match
+                       "\\[\\(\\[.*?\\]\\)\\(\\[.*?\\]\\)?\\]" v-a))
+                 (replace-match "[\\1[%^{Link description}]]" nil nil v-a)
+               v-a))
+        (v-n user-full-name)
+        (v-k (if (marker-buffer org-clock-marker)
+                 (org-substring-no-properties org-clock-heading)))
+        (v-K (if (marker-buffer org-clock-marker)
+                 (org-make-link-string
+                  (buffer-file-name (marker-buffer org-clock-marker))
+                  org-clock-heading)))
+        v-I
+        (org-startup-folded nil)
+        (org-inhibit-startup t)
+        org-time-was-given org-end-time-was-given x
+        prompt completions char time pos default histvar)
+
+    (setq org-store-link-plist
+         (plist-put org-store-link-plist :annotation v-a)
+         org-store-link-plist
+         (plist-put org-store-link-plist :initial v-i))
+
+    (unless template (setq template "") (message "No template") (ding)
+           (sit-for 1))
+    (save-window-excursion
+      (delete-other-windows)
+      (switch-to-buffer (get-buffer-create "*Capture*"))
+      (erase-buffer)
+      (insert template)
+      (goto-char (point-min))
+      (org-capture-steal-local-variables buffer)
+      (setq buffer-file-name nil)
+
+      ;; %[] Insert contents of a file.
+      (goto-char (point-min))
+      (while (re-search-forward "%\\[\\(.+\\)\\]" nil t)
+       (unless (org-capture-escaped-%)
+         (let ((start (match-beginning 0))
+               (end (match-end 0))
+               (filename (expand-file-name (match-string 1))))
+           (goto-char start)
+           (delete-region start end)
+           (condition-case error
+               (insert-file-contents filename)
+             (error (insert (format "%%![Couldn't insert %s: %s]"
+                                    filename error)))))))
+      ;; %() embedded elisp
+      (goto-char (point-min))
+      (while (re-search-forward "%\\((.+)\\)" nil t)
+       (unless (org-capture-escaped-%)
+         (goto-char (match-beginning 0))
+         (let ((template-start (point)))
+           (forward-char 1)
+           (let ((result
+                  (condition-case error
+                      (eval (read (current-buffer)))
+                    (error (format "%%![Error: %s]" error)))))
+             (delete-region template-start (point))
+             (insert result)))))
+
+      ;; Simple %-escapes
+      (while (re-search-forward "%\\([tTuUaiAcxkKI]\\)" nil t)
+       (unless (org-capture-escaped-%)
+         (when (and initial (equal (match-string 0) "%i"))
+           (save-match-data
+             (let* ((lead (buffer-substring
+                           (point-at-bol) (match-beginning 0))))
+               (setq v-i (mapconcat 'identity
+                                    (org-split-string initial "\n")
+                                    (concat "\n" lead))))))
+         (replace-match
+          (or (eval (intern (concat "v-" (match-string 1)))) "")
+          t t)))
+
+      ;; From the property list
+      (when plist-p
+       (goto-char (point-min))
+       (while (re-search-forward "%\\(:[-a-zA-Z]+\\)" nil t)
+         (unless (org-capture-escaped-%)
+           (and (setq x (or (plist-get org-store-link-plist
+                                       (intern (match-string 1))) ""))
+                (replace-match x t t)))))
+
+      ;; Turn on org-mode in temp buffer, set local variables
+      ;; This is to support completion in interactive prompts
+      (let ((org-inhibit-startup t)) (org-mode))
+      ;; Interactive template entries
+      (goto-char (point-min))
+      (while (re-search-forward "%^\\({\\([^}]*\\)}\\)?\\([gGtTuUCLp]\\)?"
+                               nil t)
+       (unless (org-capture-escaped-%)
+         (setq char (if (match-end 3) (match-string 3))
+               prompt (if (match-end 2) (match-string 2)))
+         (goto-char (match-beginning 0))
+         (replace-match "")
+         (setq completions nil default nil)
+         (when prompt
+           (setq completions (org-split-string prompt "|")
+                 prompt (pop completions)
+                 default (car completions)
+                 histvar (intern (concat
+                                  "org-capture-template-prompt-history::"
+                                  (or prompt "")))
+                 completions (mapcar 'list completions)))
+         (cond
+          ((member char '("G" "g"))
+           (let* ((org-last-tags-completion-table
+                   (org-global-tags-completion-table
+                    (if (equal char "G")
+                        (org-agenda-files)
+                      (and file (list file)))))
+                  (org-add-colon-after-tag-completion t)
+                  (ins (org-icompleting-read
+                        (if prompt (concat prompt ": ") "Tags: ")
+                        'org-tags-completion-function nil nil nil
+                        'org-tags-history)))
+             (setq ins (mapconcat 'identity
+                                  (org-split-string
+                                   ins (org-re "[^[:alnum:]_@]+"))
+                                      ":"))
+             (when (string-match "\\S-" ins)
+               (or (equal (char-before) ?:) (insert ":"))
+               (insert ins)
+               (or (equal (char-after) ?:) (insert ":")))))
+          ((equal char "C")
+           (cond ((= (length clipboards) 1) (insert (car clipboards)))
+                 ((> (length clipboards) 1)
+                  (insert (read-string "Clipboard/kill value: "
+                                       (car clipboards) '(clipboards . 1)
+                                       (car clipboards))))))
+          ((equal char "L")
+           (cond ((= (length clipboards) 1)
+                  (org-insert-link 0 (car clipboards)))
+                 ((> (length clipboards) 1)
+                  (org-insert-link 0 (read-string "Clipboard/kill value: "
+                                                  (car clipboards)
+                                                  '(clipboards . 1)
+                                                  (car clipboards))))))
+          ((equal char "p")
+           (let*
+               ((prop (org-substring-no-properties prompt))
+                (pall (concat prop "_ALL"))
+                (allowed
+                 (with-current-buffer
+                     (get-buffer (file-name-nondirectory file))
+                   (or (cdr (assoc pall org-file-properties))
+                       (cdr (assoc pall org-global-properties))
+                       (cdr (assoc pall org-global-properties-fixed)))))
+                (existing (with-current-buffer
+                              (get-buffer (file-name-nondirectory file))
+                            (mapcar 'list (org-property-values prop))))
+                (propprompt (concat "Value for " prop ": "))
+                (val (if allowed
+                         (org-completing-read
+                          propprompt
+                          (mapcar 'list (org-split-string allowed
+                                                          "[ \t]+"))
+                          nil 'req-match)
+                       (org-completing-read-no-i propprompt
+                                                 existing nil nil
+                                                 "" nil ""))))
+             (org-set-property prop val)))
+          (char
+           ;; These are the date/time related ones
+           (setq org-time-was-given (equal (upcase char) char))
+           (setq time (org-read-date (equal (upcase char) char) t nil
+                                     prompt))
+           (if (equal (upcase char) char) (setq org-time-was-given t))
+           (org-insert-time-stamp time org-time-was-given
+                                  (member char '("u" "U"))
+                                  nil nil (list org-end-time-was-given)))
+          (t
+           (let (org-completion-use-ido)
+             (insert (org-completing-read-no-i
+                      (concat (if prompt prompt "Enter string")
+                              (if default (concat " [" default "]"))
+                              ": ")
+                      completions nil nil nil histvar default)))))))
+      ;; Make sure there are no empty lines before the text, and that
+      ;; it ends with a newline character
+      (goto-char (point-min))
+      (while (looking-at "[ \t]*\n") (replace-match ""))
+      (if (re-search-forward "[ \t\n]*\\'" nil t) (replace-match "\n"))
+      ;; Return the expanded tempate and kill the temporary buffer
+      (untabify (point-min) (point-max))
+      (set-buffer-modified-p nil)
+      (prog1 (buffer-string) (kill-buffer (current-buffer))))))
+
+(defun org-capture-escaped-% ()
+  "Check if % was escaped - if yes, unescape it now."
+  (if (equal (char-before (match-beginning 0)) ?\\)
+      (progn
+       (delete-region (1- (match-beginning 0)) (match-beginning 0))
+       t)
+    nil))
+
+;;;###autoload
+(defun org-capture-import-remember-templates ()
+  "Set org-capture-templates to be similar to `org-remember-templates'."
+  (interactive)
+  (when (and (yes-or-no-p
+             "Import old remember templates into org-capture-templates? ")
+            (yes-or-no-p
+             "Note that this will remove any templates currently defined in `org-capture-templates'.  Do you still want to go ahead? "))
+    (require 'org-remember)
+    (setq org-capture-templates
+         (mapcar
+          (lambda (entry)
+            (let ((desc (car entry))
+                  (key (char-to-string (nth 1 entry)))
+                  (template (nth 2 entry))
+                  (file (or (nth 3 entry) org-default-notes-file))
+                  (position (or (nth 4 entry) org-remember-default-headline))
+                  (type 'entry)
+                  (prepend org-reverse-note-order)
+                  immediate target)
+              (cond
+               ((member position '(top bottom))
+                (setq target (list 'file file)
+                      prepend (eq position 'top)))
+               ((eq position 'date-tree)
+                (setq target (list 'file+datetree file)
+                      prepend nil))
+               (t (setq target (list 'file+headline file position))))
+
+              (when (string-match "%!" template)
+                (setq template (replace-match "" t t template)
+                      immediate t))
+
+              (append (list key desc type target template)
+                      (if prepend '(:prepend t))
+                      (if immediate '(:immediate-finish t)))))
+
+          org-remember-templates))))
+
+(provide 'org-capture)
+
+;; arch-tag: 986bf41b-8ada-4e28-bf20-e8388a7205a0
+
+;;; org-capture.el ends here
+
+
index 144741174cec65a491a2612267ec134305ed2b1a..f451cf807920d71f3c67f0c8c7e5d16a55dfd298 100644 (file)
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33x
+;; Version: 7.01
 ;;
 ;; This file is part of GNU Emacs.
 ;;
 ;; This file contains the time clocking code for Org-mode
 
 (require 'org)
+;;; Code:
+
 (eval-when-compile
-  (require 'cl)
-  (require 'calendar))
+  (require 'cl))
 
 (declare-function calendar-absolute-from-iso    "cal-iso"    (&optional date))
 (defvar org-time-stamp-formats)
@@ -63,20 +64,27 @@ which see."
 
 (defcustom org-clock-out-when-done t
   "When non-nil, clock will be stopped when the clocked entry is marked DONE.
-A nil value means, clock will keep running until stopped explicitly with
-`C-c C-x C-o', or until the clock is started in a different item."
+DONE here means any DONE-like state.
+A nil value means clock will keep running until stopped explicitly with
+`C-c C-x C-o', or until the clock is started in a different item.
+Instead of t, this can also be a list of TODO states that should trigger
+clocking out."
   :group 'org-clock
-  :type 'boolean)
+  :type '(choice
+         (const :tag "No" nil)
+         (const :tag "Yes, when done" t)
+         (repeat :tag "State list"
+                 (string :tag "TODO keyword"))))
 
 (defcustom org-clock-out-remove-zero-time-clocks nil
-  "Non-nil means, remove the clock line when the resulting time is zero."
+  "Non-nil means remove the clock line when the resulting time is zero."
   :group 'org-clock
   :type 'boolean)
 
 (defcustom org-clock-in-switch-to-state nil
   "Set task to a special todo state while clocking it.
 The value should be the state to which the entry should be
-switched. If the value is a function, it must take one
+switched.  If the value is a function, it must take one
 parameter (the current TODO state of the item) and return the
 state to switch it to."
   :group 'org-clock
@@ -89,7 +97,7 @@ state to switch it to."
 (defcustom org-clock-out-switch-to-state nil
   "Set task to a special todo state after clocking out.
 The value should be the state to which the entry should be
-switched. If the value is a function, it must take one
+switched.  If the value is a function, it must take one
 parameter (the current TODO state of the item) and return the
 state to switch it to."
   :group 'org-clock
@@ -105,7 +113,7 @@ state to switch it to."
   :type 'integer)
 
 (defcustom org-clock-goto-may-find-recent-task t
-  "Non-nil means, `org-clock-goto' can go to recent task if no active clock."
+  "Non-nil means `org-clock-goto' can go to recent task if no active clock."
   :group 'org-clock
   :type 'boolean)
 
@@ -117,7 +125,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 modeline.  0 means no limit."
   :group 'org-clock
   :type 'integer)
 
@@ -129,8 +137,8 @@ the clock can be resumed from that point."
   :type 'boolean)
 
 (defcustom org-clock-persist nil
-  "When non-nil, save the running clock when emacs is closed.
-The clock is resumed when emacs restarts.
+  "When non-nil, save the running clock when Emacs is closed.
+The clock is resumed when Emacs restarts.
 When this is t, both the running clock, and the entire clock
 history are saved.  When this is the symbol `clock', only the
 running clock is saved.
@@ -193,6 +201,17 @@ auto     Automatically, either `all', or `repeat' for repeating tasks"
          (const :tag "All task time" all)
          (const :tag "Automatically, `all' or since `repeat'" auto)))
 
+(defcustom org-task-overrun-text nil
+  "The extra modeline text that should 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,
+also using the face `org-mode-line-clock-overrun'."
+  :group 'org-clock
+  :type '(choice
+         (const :tag "Just mark the time string" nil)
+         (string :tag "Text to prepend")))
+
 (defcustom org-show-notification-handler nil
   "Function or program to send notification with.
 The function or program will be called with the notification
@@ -222,6 +241,16 @@ string as argument."
          (const :tag "Always" t)
          (const :tag "When no clock is running" when-no-clock-is-running)))
 
+(defcustom org-clock-report-include-clocking-task nil
+  "When non-nil, include the current clocking task time in clock reports."
+  :group 'org-clock
+  :type 'boolean)
+
+(defcustom org-clock-resolve-expert nil
+  "Non-nil means do not show the splash buffer with the clock resolver."
+  :group 'org-clock
+  :type 'boolean)
+
 (defvar org-clock-in-prepare-hook nil
   "Hook run when preparing the clock.
 This hook is run before anything happens to the task that
@@ -250,11 +279,11 @@ to add an effort property.")
 (defvar org-clock-heading-for-remember "")
 (defvar org-clock-start-time "")
 
-(defvar org-clock-left-over-time nil
+(defvar org-clock-leftover-time nil
   "If non-nil, user cancelled a clock; this is when leftover time started.")
 
 (defvar org-clock-effort ""
-  "Effort estimate of the currently clocking task")
+  "Effort estimate of the currently clocking task.")
 
 (defvar org-clock-total-time nil
   "Holds total time, spent previously on currently clocked item.
@@ -287,7 +316,10 @@ of a different task.")
 (defun org-clock-history-push (&optional pos buffer)
   "Push a marker to the clock history."
   (setq org-clock-history-length (max 1 (min 35 org-clock-history-length)))
-  (let ((m (move-marker (make-marker) (or pos (point)) buffer)) n l)
+  (let ((m (move-marker (make-marker)
+                       (or pos (point)) (org-base-buffer
+                                         (or buffer (current-buffer)))))
+       n l)
     (while (setq n (member m org-clock-history))
       (move-marker (car n) nil))
     (setq org-clock-history
@@ -310,6 +342,14 @@ of a different task.")
   (mapc (lambda (m) (org-check-and-save-marker m beg end))
        org-clock-history))
 
+(defun org-clocking-buffer ()
+  "Return the clocking buffer if we are currently clocking a task or nil."
+  (marker-buffer org-clock-marker))
+
+(defun org-clocking-p ()
+  "Return t when clocking a task."
+  (not (equal (org-clocking-buffer) nil)))
+
 (defun org-clock-select-task (&optional prompt)
   "Select a task that recently was associated with clocking."
   (interactive)
@@ -326,7 +366,7 @@ of a different task.")
        (insert (org-add-props "The task interrupted by starting the last one\n" nil 'face 'bold))
        (setq s (org-clock-insert-selection-line ?i org-clock-interrupted-task))
        (push s sel-list))
-      (when (marker-buffer org-clock-marker)
+      (when (org-clocking-p)
        (insert (org-add-props "Current Clocking Task\n" nil 'face 'bold))
        (setq s (org-clock-insert-selection-line ?c org-clock-marker))
        (push s sel-list))
@@ -339,6 +379,7 @@ of a different task.")
                    (if (< i 10)
                        (+ i ?0)
                      (+ i (- ?A 10))) m))
+          (if (fboundp 'int-to-char) (setf (car s) (int-to-char (car s))))
           (push s sel-list)))
        org-clock-history)
       (org-fit-window-to-buffer)
@@ -360,56 +401,82 @@ pointing to it."
        (save-excursion
          (save-restriction
            (widen)
-           (goto-char marker)
-           (setq file (buffer-file-name (marker-buffer marker))
-                 cat (or (org-get-category)
-                         (progn (org-refresh-category-properties)
-                                (org-get-category)))
-                 heading (org-get-heading 'notags)
-                 prefix (save-excursion
-                          (org-back-to-heading t)
-                          (looking-at "\\*+ ")
-                          (match-string 0))
-                 task (substring
-                       (org-fontify-like-in-org-mode
-                        (concat prefix heading)
-                        org-odd-levels-only)
-                       (length prefix))))))
+           (ignore-errors
+             (goto-char marker)
+             (setq file (buffer-file-name (marker-buffer marker))
+                   cat (or (org-get-category)
+                           (progn (org-refresh-category-properties)
+                                  (org-get-category)))
+                   heading (org-get-heading 'notags)
+                   prefix (save-excursion
+                            (org-back-to-heading t)
+                            (looking-at "\\*+ ")
+                            (match-string 0))
+                   task (substring
+                         (org-fontify-like-in-org-mode
+                          (concat prefix heading)
+                          org-odd-levels-only)
+                         (length prefix)))))))
       (when (and cat task)
        (insert (format "[%c] %-15s %s\n" i cat task))
        (cons i marker)))))
 
+(defvar org-task-overrun nil
+  "Internal flag indicating if the clock has overrun the planned time.")
+(defvar org-clock-update-period 60
+  "Number of seconds between mode line clock string updates.")
+
 (defun org-clock-get-clock-string ()
-  "Form a clock-string, that will be show in the mode line.
-If an effort estimate was defined for current item, use
+  "Form a clock-string, that will be shown in the mode line.
+If an effort estimate was defined for the current item, use
 01:30/01:50 format (clocked/estimated).
 If not, show simply the clocked time like 01:50."
   (let* ((clocked-time (org-clock-get-clocked-time))
         (h (floor clocked-time 60))
         (m (- clocked-time (* 60 h))))
-    (if (and org-clock-effort)
-       (let* ((effort-in-minutes (org-hh:mm-string-to-minutes org-clock-effort))
+    (if org-clock-effort
+       (let* ((effort-in-minutes
+               (org-hh:mm-string-to-minutes org-clock-effort))
               (effort-h (floor effort-in-minutes 60))
-              (effort-m (- effort-in-minutes (* effort-h 60))))
-         (format (concat "-[" org-time-clocksum-format "/" org-time-clocksum-format " (%s)]")
-                 h m effort-h effort-m  org-clock-heading))
-      (format (concat "-[" org-time-clocksum-format " (%s)]")
-             h m org-clock-heading))))
+              (effort-m (- effort-in-minutes (* effort-h 60)))
+              (work-done-str
+               (org-propertize
+                (format org-time-clocksum-format h m)
+                'face (if (and org-task-overrun (not org-task-overrun-text))
+                          'org-mode-line-clock-overrun 'org-mode-line-clock)))
+              (effort-str (format org-time-clocksum-format effort-h effort-m))
+              (clockstr (org-propertize
+                         (concat  "[%s/" effort-str
+                                  "] (" (replace-regexp-in-string "%" "%%" org-clock-heading) ")")
+                         'face 'org-mode-line-clock)))
+         (format clockstr work-done-str))
+      (org-propertize (format
+                      (concat "[" org-time-clocksum-format " (%s)]")
+                      h m org-clock-heading)
+                     'face 'org-mode-line-clock))))
 
 (defun org-clock-update-mode-line ()
+  (if org-clock-effort
+      (org-clock-notify-once-if-expired)
+    (setq org-task-overrun nil))
   (setq org-mode-line-string
        (org-propertize
         (let ((clock-string (org-clock-get-clock-string))
               (help-text "Org-mode clock is running.\nmouse-1 shows a menu\nmouse-2 will jump to task"))
           (if (and (> org-clock-string-limit 0)
                    (> (length clock-string) org-clock-string-limit))
-              (org-propertize (substring clock-string 0 org-clock-string-limit)
-                              'help-echo (concat help-text ": " org-clock-heading))
+              (org-propertize
+               (substring clock-string 0 org-clock-string-limit)
+               'help-echo (concat help-text ": " org-clock-heading))
             (org-propertize clock-string 'help-echo help-text)))
         'local-map org-clock-mode-line-map
         'mouse-face (if (featurep 'xemacs) 'highlight 'mode-line-highlight)
-        'face 'org-mode-line-clock))
-  (if org-clock-effort (org-clock-notify-once-if-expired))
+        ))
+  (if (and org-task-overrun org-task-overrun-text)
+      (setq org-mode-line-string
+           (concat (org-propertize
+                    org-task-overrun-text
+                    'face 'org-mode-line-clock-overrun) org-mode-line-string)))
   (force-mode-line-update))
 
 (defun org-clock-get-clocked-time ()
@@ -443,7 +510,8 @@ the mode line."
        ;; A string.  See if it is a delta
        (setq sign (string-to-char value))
        (if (member sign '(?- ?+))
-          (setq current (org-hh:mm-string-to-minutes (substring current 1)))
+          (setq current (org-hh:mm-string-to-minutes current)
+                value (substring value 1))
         (setq current 0))
        (setq value (org-hh:mm-string-to-minutes value))
        (if (equal ?- sign)
@@ -461,10 +529,13 @@ the mode line."
 (defun org-clock-notify-once-if-expired ()
   "Show notification if we spent more time than we estimated before.
 Notification is shown only once."
-  (when (marker-buffer org-clock-marker)
+  (when (org-clocking-p)
     (let ((effort-in-minutes (org-hh:mm-string-to-minutes org-clock-effort))
          (clocked-time (org-clock-get-clocked-time)))
-      (if (>= clocked-time effort-in-minutes)
+      (if (setq org-task-overrun
+               (if (or (null effort-in-minutes) (zerop effort-in-minutes))
+                   nil
+                 (>= clocked-time effort-in-minutes)))
          (unless org-clock-notification-was-shown
            (setq org-clock-notification-was-shown t)
            (org-notify
@@ -526,7 +597,7 @@ Use alsa's aplay tool if available."
       (save-excursion
        (goto-char (point-min))
        (while (re-search-forward "CLOCK: \\(\\[.*?\\]\\)$" nil t)
-         (push (cons (copy-marker (1- (match-end 1)) t)
+         (push (cons (copy-marker (match-end 1) t)
                      (org-time-string-to-time (match-string 1))) clocks))))
     clocks))
 
@@ -563,12 +634,12 @@ This macro also protects the current active clock from being altered."
 
 (put 'org-with-clock 'lisp-indent-function 1)
 
-(defsubst org-clock-clock-in (clock &optional resume)
+(defsubst org-clock-clock-in (clock &optional resume start-time)
   "Clock in to the clock located by CLOCK.
 If necessary, clock-out of the currently active clock."
   (org-with-clock-position clock
     (let ((org-clock-in-resume (or resume org-clock-in-resume)))
-      (org-clock-in))))
+      (org-clock-in nil start-time))))
 
 (defsubst org-clock-clock-out (clock &optional fail-quietly at-time)
   "Clock out of the clock located by CLOCK."
@@ -594,39 +665,10 @@ If necessary, clock-out of the currently active clock."
 (defvar org-clock-resolving-clocks nil)
 (defvar org-clock-resolving-clocks-due-to-idleness nil)
 
-(defun org-clock-resolve-clock (clock resolve-to &optional close-p
-                                     restart-p fail-quietly)
+(defun org-clock-resolve-clock (clock resolve-to clock-out-time
+                                     &optional close-p restart-p fail-quietly)
   "Resolve `CLOCK' given the time `RESOLVE-TO', and the present.
-`CLOCK' is a cons cell of the form (MARKER START-TIME).
-This routine can do one of many things:
-
-  if `RESOLVE-TO' is nil
-    if `CLOSE-P' is non-nil, give an error
-    if this clock is the active clock, cancel it
-    else delete the clock line (as if it never happened)
-    if `RESTART-P' is non-nil, start a new clock
-
-  else if `RESOLVE-TO' is the symbol `now'
-    if `RESTART-P' is non-nil, give an error
-    if `CLOSE-P' is non-nil, clock out the entry and
-       if this clock is the active clock, stop it
-    else if this clock is the active clock, do nothing
-    else if there is no active clock, resume this clock
-    else ask to cancel the active clock, and if so,
-         resume this clock after cancelling it
-
-  else if `RESOLVE-TO' is some date in the future
-    give an error about `RESOLVE-TO' being invalid
-
-  else if `RESOLVE-TO' is some date in the past
-    if `RESTART-P' is non-nil, give an error
-    if `CLOSE-P' is non-nil, enter a closing time and
-       if this clock is the active clock, stop it
-    else if this clock is the active clock, enter a
-       closing time, stop the current clock, then
-       start a new clock for the same item
-    else just enter a closing time for this clock
-       and then start a new clock for the same item"
+`CLOCK' is a cons cell of the form (MARKER START-TIME)."
   (let ((org-clock-resolving-clocks t))
     (cond
      ((null resolve-to)
@@ -648,11 +690,41 @@ This routine can do one of many things:
      (t
       (if restart-p
          (error "RESTART-P is not valid here"))
-      (org-clock-clock-out clock fail-quietly resolve-to)
+      (org-clock-clock-out clock fail-quietly (or clock-out-time
+                                                 resolve-to))
       (unless org-clock-clocking-in
        (if close-p
-           (setq org-clock-left-over-time resolve-to)
-         (org-clock-clock-in clock)))))))
+           (setq org-clock-leftover-time (and (null clock-out-time)
+                                              resolve-to))
+         (org-clock-clock-in clock nil (and clock-out-time
+                                            resolve-to))))))))
+
+(defun org-clock-jump-to-current-clock (&optional effective-clock)
+  (interactive)
+  (let ((clock (or effective-clock (cons org-clock-marker
+                                        org-clock-start-time))))
+    (unless (marker-buffer (car clock))
+      (error "No clock is currently running"))
+    (org-with-clock clock (org-clock-goto))
+    (with-current-buffer (marker-buffer (car clock))
+      (goto-char (car clock))
+      (if org-clock-into-drawer
+         (let ((logbook
+                (if (stringp org-clock-into-drawer)
+                    (concat ":" org-clock-into-drawer ":")
+                  ":LOGBOOK:")))
+           (ignore-errors
+             (outline-flag-region
+              (save-excursion
+                (outline-back-to-heading t)
+                (search-forward logbook)
+                (goto-char (match-beginning 0)))
+              (save-excursion
+                (outline-back-to-heading t)
+                (search-forward logbook)
+                (search-forward ":END:")
+                (goto-char (match-end 0)))
+              nil)))))))
 
 (defun org-clock-resolve (clock &optional prompt-fn last-valid fail-quietly)
   "Resolve an open org-mode clock.
@@ -678,44 +750,66 @@ was started."
          (save-window-excursion
            (save-excursion
              (unless org-clock-resolving-clocks-due-to-idleness
-               (org-with-clock clock (org-clock-goto))
-               (with-current-buffer (marker-buffer (car clock))
-                 (goto-char (car clock))
-                 (if org-clock-into-drawer
-                     (let ((logbook
-                            (if (stringp org-clock-into-drawer)
-                                (concat ":" org-clock-into-drawer ":")
-                              ":LOGBOOK:")))
-                       (ignore-errors
-                         (outline-flag-region
-                          (save-excursion
-                            (outline-back-to-heading t)
-                            (search-forward logbook)
-                            (goto-char (match-beginning 0)))
-                          (save-excursion
-                            (outline-back-to-heading t)
-                            (search-forward logbook)
-                            (search-forward ":END:")
-                            (goto-char (match-end 0)))
-                          nil))))))
+               (org-clock-jump-to-current-clock clock))
+             (unless org-clock-resolve-expert
+               (with-output-to-temp-buffer "*Org Clock*"
+                 (princ "Select a Clock Resolution Command:
+
+i/q/C-g  Ignore this question; the same as keeping all the idle time.
+
+k/K      Keep X minutes of the idle time (default is all).  If this
+         amount is less than the default, you will be clocked out
+         that many minutes after the time that idling began, and then
+         clocked back in at the present time.
+g/G      Indicate that you \"got back\" X minutes ago.  This is quite
+         different from 'k': it clocks you out from the beginning of
+         the idle period and clock you back in X minutes ago.
+s/S      Subtract the idle time from the current clock.  This is the
+         same as keeping 0 minutes.
+C        Cancel the open timer altogether.  It will be as though you
+         never clocked in.
+j/J      Jump to the current clock, to make manual adjustments.
+
+For all these options, using uppercase makes your final state
+to be CLOCKED OUT.")))
+             (org-fit-window-to-buffer (get-buffer-window "*Org Clock*"))
              (let (char-pressed)
-               (while (null char-pressed)
+               (when (featurep 'xemacs)
+                 (message (concat (funcall prompt-fn clock)
+                                  " [jkKgGsScCiq]? "))
+                 (setq char-pressed (read-char-exclusive)))
+               (while (or (null char-pressed)
+                          (and (not (memq char-pressed
+                                          '(?k ?K ?g ?G ?s ?S ?C
+                                               ?j ?J ?i ?q)))
+                               (or (ding) t)))
                  (setq char-pressed
                        (read-char (concat (funcall prompt-fn clock)
-                                          " [(kK)eep (sS)ubtract (C)ancel]? ")
+                                          " [jkKgGSscCiq]? ")
                                   nil 45)))
-               char-pressed))))
-        (default (floor (/ (org-float-time
-                            (time-subtract (current-time) last-valid)) 60)))
-        (keep (and (memq ch '(?k ?K))
-                   (read-number "Keep how many minutes? " default)))
+               (and (not (memq char-pressed '(?i ?q))) char-pressed)))))
+        (default
+          (floor (/ (org-float-time
+                     (time-subtract (current-time) last-valid)) 60)))
+        (keep
+         (and (memq ch '(?k ?K))
+              (read-number "Keep how many minutes? " default)))
+        (gotback
+         (and (memq ch '(?g ?G))
+              (read-number "Got back how many minutes ago? " default)))
         (subtractp (memq ch '(?s ?S)))
         (barely-started-p (< (- (org-float-time last-valid)
                                 (org-float-time (cdr clock))) 45))
         (start-over (and subtractp barely-started-p)))
-    (if (or (null ch)
-           (not (memq ch '(?k ?K ?s ?S ?C))))
-       (message "")
+    (cond
+     ((memq ch '(?j ?J))
+      (if (eq ch ?J)
+         (org-clock-resolve-clock clock 'now nil t nil fail-quietly))
+      (org-clock-jump-to-current-clock clock))
+     ((or (null ch)
+         (not (memq ch '(?k ?K ?g ?G ?s ?S ?C))))
+      (message ""))
+     (t
       (org-clock-resolve-clock
        clock (cond
              ((or (eq ch ?C)
@@ -724,21 +818,29 @@ was started."
                   ;; time...
                   start-over)
               nil)
-             (subtractp
+             ((or subtractp
+                  (and gotback (= gotback 0)))
               last-valid)
-             ((= keep default)
+             ((or (and keep (= keep default))
+                  (and gotback (= gotback default)))
               'now)
+             (keep
+              (time-add last-valid (seconds-to-time (* 60 keep))))
+             (gotback
+              (time-subtract (current-time)
+                             (seconds-to-time (* 60 gotback))))
              (t
-              (time-add last-valid (seconds-to-time (* 60 keep)))))
-       (memq ch '(?K ?S))
+              (error "Unexpected, please report this as a bug")))
+       (and gotback last-valid)
+       (memq ch '(?K ?G ?S))
        (and start-over
-           (not (memq ch '(?K ?S ?C))))
-       fail-quietly))))
+           (not (memq ch '(?K ?G ?S ?C))))
+       fail-quietly)))))
 
-(defun org-resolve-clocks (&optional also-non-dangling-p prompt-fn last-valid)
+(defun org-resolve-clocks (&optional only-dangling-p prompt-fn last-valid)
   "Resolve all currently open org-mode clocks.
-If `also-non-dangling-p' is non-nil, also ask to resolve
-non-dangling (i.e., currently open and valid) clocks."
+If `only-dangling-p' is non-nil, only ask to resolve dangling
+\(i.e., not currently open and valid) clocks."
   (interactive "P")
   (unless org-clock-resolving-clocks
     (let ((org-clock-resolving-clocks t))
@@ -747,7 +849,7 @@ non-dangling (i.e., currently open and valid) clocks."
          (dolist (clock clocks)
            (let ((dangling (or (not (org-clock-is-active))
                                (/= (car clock) org-clock-marker))))
-             (unless (and (not dangling) (not also-non-dangling-p))
+             (if (or (not only-dangling-p) dangling)
                (org-clock-resolve
                 clock
                 (or prompt-fn
@@ -769,27 +871,23 @@ non-dangling (i.e., currently open and valid) clocks."
       0)))
 
 (defun org-mac-idle-seconds ()
-  "Return the current Mac idle time in seconds"
+  "Return the current Mac idle time in seconds."
   (string-to-number (shell-command-to-string "ioreg -c IOHIDSystem | perl -ane 'if (/Idle/) {$idle=(pop @F)/1000000000; print $idle; last}'")))
 
 (defun org-x11-idle-seconds ()
-  "Return the current X11 idle time in seconds"
+  "Return the current X11 idle time in seconds."
   (/ (string-to-number (shell-command-to-string "x11idle")) 1000))
 
 (defun org-user-idle-seconds ()
   "Return the number of seconds the user has been idle for.
 This routine returns a floating point number."
-  (if (or (eq system-type 'darwin) (eq window-system 'x))
-      (let ((emacs-idle (org-emacs-idle-seconds)))
-       ;; If Emacs has been idle for longer than the user's
-       ;; `org-clock-idle-time' value, check whether the whole system has
-       ;; really been idle for that long.
-       (if (> emacs-idle (* 60 org-clock-idle-time))
-           (min emacs-idle (if (eq system-type 'darwin)
-                               (org-mac-idle-seconds)
-                             (org-x11-idle-seconds)))
-         emacs-idle))
-    (org-emacs-idle-seconds)))
+  (cond
+   ((eq system-type 'darwin)
+    (org-mac-idle-seconds))
+   ((eq window-system 'x)
+    (org-x11-idle-seconds))
+   (t
+    (org-emacs-idle-seconds))))
 
 (defvar org-clock-user-idle-seconds)
 
@@ -800,11 +898,11 @@ if the user really wants to stay clocked in after being idle for
 so long."
   (when (and org-clock-idle-time (not org-clock-resolving-clocks)
             org-clock-marker)
-    (let ((org-clock-user-idle-seconds (org-user-idle-seconds))
-         (org-clock-user-idle-start
-          (time-subtract (current-time)
-                         (seconds-to-time org-clock-user-idle-seconds)))
-         (org-clock-resolving-clocks-due-to-idleness t))
+    (let* ((org-clock-user-idle-seconds (org-user-idle-seconds))
+          (org-clock-user-idle-start
+           (time-subtract (current-time)
+                          (seconds-to-time org-clock-user-idle-seconds)))
+          (org-clock-resolving-clocks-due-to-idleness t))
       (if (> org-clock-user-idle-seconds (* 60 org-clock-idle-time))
          (org-clock-resolve
           (cons org-clock-marker
@@ -818,27 +916,29 @@ so long."
                         60.0))))
           org-clock-user-idle-start)))))
 
-(defun org-clock-in (&optional select)
+(defun org-clock-in (&optional select start-time)
   "Start the clock on the current item.
 If necessary, clock-out of the currently active clock.
-With prefix arg SELECT, offer a list of recently clocked tasks to
-clock into.  When SELECT is `C-u C-u', clock into the current task and mark
+With a prefix argument SELECT (\\[universal-argument]), offer a list of \
+recently clocked tasks to
+clock into.  When SELECT is \\[universal-argument] \\[universal-argument], \
+clock into the current task and mark
 is as the default task, a special task that will always be offered in
 the clocking selection, associated with the letter `d'."
   (interactive "P")
   (setq org-clock-notification-was-shown nil)
   (catch 'abort
     (let ((interrupting (and (not org-clock-resolving-clocks-due-to-idleness)
-                            (marker-buffer org-clock-marker)))
+                            (org-clocking-p)))
          ts selected-task target-pos (msg-extra "")
-         (left-over (and (not org-clock-resolving-clocks)
-                         org-clock-left-over-time)))
+         (leftover (and (not org-clock-resolving-clocks)
+                         org-clock-leftover-time)))
       (when (and org-clock-auto-clock-resolution
                 (or (not interrupting)
                     (eq t org-clock-auto-clock-resolution))
                 (not org-clock-clocking-in)
                 (not org-clock-resolving-clocks))
-       (setq org-clock-left-over-time nil)
+       (setq org-clock-leftover-time nil)
        (let ((org-clock-clocking-in t))
          (org-resolve-clocks)))        ; check if any clocks are dangling
       (when (equal select '(4))
@@ -849,15 +949,30 @@ the clocking selection, associated with the letter `d'."
       (when interrupting
        ;; We are interrupting the clocking of a different task.
        ;; Save a marker to this task, so that we can go back.
-       (move-marker org-clock-interrupted-task
-                    (marker-position org-clock-marker)
-                    (marker-buffer org-clock-marker))
-       (org-clock-out t))
-      
+       ;; First check if we are trying to clock into the same task!
+       (if (save-excursion
+               (unless selected-task
+                 (org-back-to-heading t))
+               (and (equal (marker-buffer org-clock-hd-marker)
+                           (if selected-task
+                               (marker-buffer selected-task)
+                             (current-buffer)))
+                    (= (marker-position org-clock-hd-marker)
+                       (if selected-task
+                           (marker-position selected-task)
+                         (point)))))
+           (message "Clock continues in \"%s\"" org-clock-heading)
+         (progn
+           (move-marker org-clock-interrupted-task
+                        (marker-position org-clock-marker)
+                        (org-clocking-buffer))
+           (let ((org-clock-clocking-in t))
+             (org-clock-out t)))))
+
       (when (equal select '(16))
        ;; Mark as default clocking task
        (org-clock-mark-default-task))
-      
+
       ;; Clock in at which position?
       (setq target-pos
            (if (and (eobp) (not (org-on-heading-p)))
@@ -878,6 +993,7 @@ the clocking selection, associated with the letter `d'."
            (org-back-to-heading t)
            (or interrupting (move-marker org-clock-interrupted-task nil))
            (org-clock-history-push)
+           (org-clock-set-current)
            (cond ((functionp org-clock-in-switch-to-state)
                   (looking-at org-complex-heading-regexp)
                   (let ((newstate (funcall org-clock-in-switch-to-state
@@ -898,7 +1014,9 @@ the clocking selection, associated with the letter `d'."
                              (functionp org-clock-heading-function))
                         (funcall org-clock-heading-function))
                        ((looking-at org-complex-heading-regexp)
-                        (match-string 4))
+                        (replace-regexp-in-string
+                         "\\[\\[.*?\\]\\[\\(.*?\\)\\]\\]" "\\1"
+                         (match-string 4)))
                        (t "???")))
            (setq org-clock-heading (org-propertize org-clock-heading
                                                    'face nil))
@@ -939,13 +1057,14 @@ the clocking selection, associated with the letter `d'."
              (setq org-clock-total-time (org-clock-sum-current-item
                                          (org-clock-get-sum-start)))
              (setq org-clock-start-time
-                   (or (and left-over
+                   (or (and leftover
                             (y-or-n-p
                              (format
                               "You stopped another clock %d mins ago; start this one from then? "
                               (/ (- (org-float-time (current-time))
-                                    (org-float-time left-over)) 60)))
-                            left-over)
+                                    (org-float-time leftover)) 60)))
+                            leftover)
+                       start-time
                        (current-time)))
              (setq ts (org-insert-time-stamp org-clock-start-time
                                              'with-hm 'inactive))))
@@ -963,7 +1082,9 @@ the clocking selection, associated with the letter `d'."
              (cancel-timer org-clock-mode-line-timer)
              (setq org-clock-mode-line-timer nil))
            (setq org-clock-mode-line-timer
-                 (run-with-timer 60 60 'org-clock-update-mode-line))
+                 (run-with-timer org-clock-update-period
+                                 org-clock-update-period
+                                 'org-clock-update-mode-line))
            (when org-clock-idle-timer
              (cancel-timer org-clock-idle-timer)
              (setq org-clock-idle-timer nil))
@@ -972,6 +1093,15 @@ the clocking selection, associated with the letter `d'."
            (message "Clock starts at %s - %s" ts msg-extra)
            (run-hooks 'org-clock-in-hook)))))))
 
+(defvar org-clock-current-task nil
+  "Task currently clocked in.")
+(defun org-clock-set-current ()
+  "Set `org-clock-current-task' to the task currently clocked in."
+  (setq org-clock-current-task (nth 4 (org-heading-components))))
+(defun org-clock-delete-current ()
+  "Reset `org-clock-current-task' to nil."
+  (setq org-clock-current-task nil))
+
 (defun org-clock-mark-default-task ()
   "Mark current task as default task."
   (interactive)
@@ -1104,11 +1234,14 @@ line and position cursor in that line."
 If there is no running clock, throw an error, unless FAIL-QUIETLY is set."
   (interactive)
   (catch 'exit
-    (if (not (marker-buffer org-clock-marker))
-       (if fail-quietly (throw 'exit t) (error "No active clock")))
+    (when (not (org-clocking-p))
+      (setq global-mode-string
+           (delq 'org-mode-line-string global-mode-string))
+      (force-mode-line-update)
+      (if fail-quietly (throw 'exit t) (error "No active clock")))
     (let (ts te s h m remove)
-      (save-excursion
-       (set-buffer (marker-buffer org-clock-marker))
+      (save-excursion ; Do not replace this with `with-current-buffer'.
+       (with-no-warnings (set-buffer (org-clocking-buffer)))
        (save-restriction
          (widen)
          (goto-char org-clock-marker)
@@ -1151,7 +1284,8 @@ If there is no running clock, throw an error, unless FAIL-QUIETLY is set."
          (when org-clock-out-switch-to-state
            (save-excursion
              (org-back-to-heading t)
-             (let ((org-inhibit-logging t))
+             (let ((org-inhibit-logging t)
+                   (org-clock-out-when-done nil))
                (cond
                 ((functionp org-clock-out-switch-to-state)
                  (looking-at org-complex-heading-regexp)
@@ -1166,15 +1300,19 @@ If there is no running clock, throw an error, unless FAIL-QUIETLY is set."
          (force-mode-line-update)
          (message (concat "Clock stopped at %s after HH:MM = " org-time-clocksum-format "%s") te h m
                   (if remove " => LINE REMOVED" ""))
-          (run-hooks 'org-clock-out-hook))))))
+          (run-hooks 'org-clock-out-hook)
+         (org-clock-delete-current))))))
 
 (defun org-clock-cancel ()
-  "Cancel the running clock be removing the start timestamp."
+  "Cancel the running clock by removing the start timestamp."
   (interactive)
-  (if (not (marker-buffer org-clock-marker))
-      (error "No active clock"))
-  (save-excursion
-    (set-buffer (marker-buffer org-clock-marker))
+  (when (not (org-clocking-p))
+    (setq global-mode-string
+         (delq 'org-mode-line-string global-mode-string))
+    (force-mode-line-update)
+    (error "No active clock"))
+  (save-excursion ; Do not replace this with `with-current-buffer'.
+    (with-no-warnings (set-buffer (org-clocking-buffer)))
     (goto-char org-clock-marker)
     (delete-region (1- (point-at-bol)) (point-at-eol))
     ;; Just in case, remove any empty LOGBOOK left over
@@ -1196,7 +1334,7 @@ With prefix arg SELECT, offer recently clocked tasks for selection."
             (select
              (or (org-clock-select-task "Select task to go to: ")
                  (error "No task selected")))
-            ((marker-buffer org-clock-marker) org-clock-marker)
+            ((org-clocking-p) org-clock-marker)
             ((and org-clock-goto-may-find-recent-task
                   (car org-clock-history)
                   (marker-buffer (car org-clock-history)))
@@ -1210,6 +1348,7 @@ With prefix arg SELECT, offer recently clocked tasks for selection."
     (org-back-to-heading t)
     (org-cycle-hide-drawers 'children)
     (recenter)
+    (org-reveal)
     (if recent
        (message "No running clock, this is the most recently clocked task"))
     (run-hooks 'org-clock-goto-hook)))
@@ -1218,10 +1357,13 @@ With prefix arg SELECT, offer recently clocked tasks for selection."
   "Holds the file total time in minutes, after a call to `org-clock-sum'.")
 (make-variable-buffer-local 'org-clock-file-total-minutes)
 
-(defun org-clock-sum (&optional tstart tend)
+(defun org-clock-sum (&optional tstart tend headline-filter)
   "Sum the times for each subtree.
 Puts the resulting times in minutes as a text property on each headline.
-TSTART and TEND can mark a time range to be considered."
+TSTART and TEND can mark a time range to be considered.  HEADLINE-FILTER is a
+zero-arg function that, if specified, is called for each headline in the time
+range with point at the headline.  Headlines for which HEADLINE-FILTER returns
+nil are excluded from the clock summation."
   (interactive)
   (let* ((bmp (buffer-modified-p))
         (re (concat "^\\(\\*+\\)[ \t]\\|^[ \t]*"
@@ -1237,7 +1379,9 @@ TSTART and TEND can mark a time range to be considered."
     (if (stringp tend) (setq tend (org-time-string-to-seconds tend)))
     (if (consp tstart) (setq tstart (org-float-time tstart)))
     (if (consp tend) (setq tend (org-float-time tend)))
-    (remove-text-properties (point-min) (point-max) '(:org-clock-minutes t))
+    (remove-text-properties (point-min) (point-max)
+                            '(:org-clock-minutes t
+                              :org-clock-force-headline-inclusion t))
     (save-excursion
       (goto-char (point-max))
       (while (re-search-backward re nil t)
@@ -1259,20 +1403,50 @@ TSTART and TEND can mark a time range to be considered."
          (setq t1 (+ t1 (string-to-number (match-string 5))
                      (* 60 (string-to-number (match-string 4))))))
         (t ;; A headline
-         (setq level (- (match-end 1) (match-beginning 1)))
-         (when (or (> t1 0) (> (aref ltimes level) 0))
-           (loop for l from 0 to level do
-                 (aset ltimes l (+ (aref ltimes l) t1)))
-           (setq t1 0 time (aref ltimes level))
-           (loop for l from level to (1- lmax) do
-                 (aset ltimes l 0))
-           (goto-char (match-beginning 0))
-           (put-text-property (point) (point-at-eol) :org-clock-minutes time)))))
+         ;; Add the currently clocking item time to the total
+         (when (and org-clock-report-include-clocking-task
+                    (equal (org-clocking-buffer) (current-buffer))
+                    (equal (marker-position org-clock-hd-marker) (point))
+                    tstart
+                    tend
+                    (>= (org-float-time org-clock-start-time) tstart)
+                    (<= (org-float-time org-clock-start-time) tend))
+           (let ((time (floor (- (org-float-time)
+                                 (org-float-time org-clock-start-time)) 60)))
+             (setq t1 (+ t1 time))))
+         (let* ((headline-forced
+                 (get-text-property (point)
+                                     :org-clock-force-headline-inclusion))
+                 (headline-included
+                  (or (null headline-filter)
+                      (save-excursion
+                        (save-match-data (funcall headline-filter))))))
+           (setq level (- (match-end 1) (match-beginning 1)))
+           (when (or (> t1 0) (> (aref ltimes level) 0))
+             (when (or headline-included headline-forced)
+                (if headline-included
+                    (loop for l from 0 to level do
+                          (aset ltimes l (+ (aref ltimes l) t1))))
+               (setq time (aref ltimes level))
+               (goto-char (match-beginning 0))
+               (put-text-property (point) (point-at-eol) :org-clock-minutes time)
+                (if headline-filter
+                    (save-excursion
+                      (save-match-data
+                        (while
+                            (> (funcall outline-level) 1)
+                          (outline-up-heading 1 t)
+                          (put-text-property
+                           (point) (point-at-eol)
+                           :org-clock-force-headline-inclusion t))))))
+             (setq t1 0)
+             (loop for l from level to (1- lmax) do
+                   (aset ltimes l 0)))))))
       (setq org-clock-file-total-minutes (aref ltimes 0)))
     (set-buffer-modified-p bmp)))
 
 (defun org-clock-sum-current-item (&optional tstart)
-  "Returns time, clocked on current item in total"
+  "Return time, clocked on current item in total."
   (save-excursion
     (save-restriction
       (org-narrow-to-subtree)
@@ -1328,7 +1502,7 @@ will be easy to remove."
     (org-move-to-column c)
     (unless (eolp) (skip-chars-backward "^ \t"))
     (skip-chars-backward " \t")
-    (setq ov (org-make-overlay (1- (point)) (point-at-eol))
+    (setq ov (make-overlay (1- (point)) (point-at-eol))
          tx (concat (buffer-substring (1- (point)) (point))
                     (make-string (+ off (max 0 (- c (current-column)))) ?.)
                     (org-add-props (if org-time-clocksum-use-fractional
@@ -1342,9 +1516,9 @@ will be easy to remove."
                         (list 'face 'org-clock-overlay))
                     ""))
     (if (not (featurep 'xemacs))
-       (org-overlay-put ov 'display tx)
-      (org-overlay-put ov 'invisible t)
-      (org-overlay-put ov 'end-glyph (make-glyph tx)))
+       (overlay-put ov 'display tx)
+      (overlay-put ov 'invisible t)
+      (overlay-put ov 'end-glyph (make-glyph tx)))
     (push ov org-clock-overlays)))
 
 (defun org-clock-remove-overlays (&optional beg end noremove)
@@ -1353,7 +1527,7 @@ BEG and END are ignored.  If NOREMOVE is nil, remove this function
 from the `before-change-functions' in the current buffer."
   (interactive)
   (unless org-inhibit-highlight-removal
-    (mapc 'org-delete-overlay org-clock-overlays)
+    (mapc 'delete-overlay org-clock-overlays)
     (setq org-clock-overlays nil)
     (unless noremove
       (remove-hook 'before-change-functions
@@ -1365,16 +1539,20 @@ from the `before-change-functions' in the current buffer."
 This is used to stop the clock after a TODO entry is marked DONE,
 and is only done if the variable `org-clock-out-when-done' is not nil."
   (when (and org-clock-out-when-done
-            (member state org-done-keywords)
-            (equal (or (buffer-base-buffer (marker-buffer org-clock-marker))
-                       (marker-buffer org-clock-marker))
+            (or (and (eq t org-clock-out-when-done)
+                     (member state org-done-keywords))
+                (and (listp org-clock-out-when-done)
+                     (member state org-clock-out-when-done)))
+            (equal (or (buffer-base-buffer (org-clocking-buffer))
+                       (org-clocking-buffer))
                    (or (buffer-base-buffer (current-buffer))
                        (current-buffer)))
             (< (point) org-clock-marker)
             (> (save-excursion (outline-next-heading) (point))
                org-clock-marker))
     ;; Clock out, but don't accept a logging message for this.
-    (let ((org-log-note-clock-out nil))
+    (let ((org-log-note-clock-out nil)
+         (org-clock-out-switch-to-state nil))
       (org-clock-out))))
 
 (add-hook 'org-after-todo-state-change-hook
@@ -1583,6 +1761,8 @@ the currently selected interval size."
           (te (plist-get params :tend))
           (block (plist-get params :block))
           (link (plist-get params :link))
+          (tags (plist-get params :tags))
+          (matcher (if tags (cdr (org-make-tags-matcher tags))))
           ipos time p level hlc hdl tsp props content recalc formula pcol
           cc beg end pos tbl tbl1 range-text rm-file-column scope-is-list st)
       (setq org-clock-file-total-minutes nil)
@@ -1664,7 +1844,14 @@ the currently selected interval size."
        (goto-char pos)
 
        (unless scope-is-list
-         (org-clock-sum ts te)
+         (org-clock-sum ts te
+                        (unless (null matcher)
+                          (lambda ()
+                            (let ((tags-list
+                                   (org-split-string
+                                    (or (org-entry-get (point) "ALLTAGS") "")
+                                    ":")))
+                              (eval matcher)))))
          (goto-char (point-min))
          (setq st t)
          (while (or (and (bobp) (prog1 st (setq st nil))
@@ -1768,7 +1955,8 @@ the currently selected interval size."
            (org-table-recalculate 'all))
          (when rm-file-column
            (forward-char 1)
-           (org-table-delete-column)))))))
+           (org-table-delete-column))
+         total-time)))))
 
 (defun org-clocktable-steps (params)
   (let* ((p1 (copy-sequence params))
@@ -1776,8 +1964,9 @@ the currently selected interval size."
         (te (plist-get p1 :tend))
         (step0 (plist-get p1 :step))
         (step (cdr (assoc step0 '((day . 86400) (week . 604800)))))
+        (stepskip0 (plist-get p1 :stepskip0))
         (block (plist-get p1 :block))
-        cc range-text)
+        cc range-text step-time)
     (when block
       (setq cc (org-clock-special-range block nil t)
            ts (car cc) te (nth 1 cc) range-text (nth 2 cc)))
@@ -1798,8 +1987,14 @@ the currently selected interval size."
                                    (seconds-to-time (setq ts (+ ts step))))))
       (insert "\n" (if (eq step0 'day) "Daily report: " "Weekly report starting on: ")
              (plist-get p1 :tstart) "\n")
-      (org-dblock-write:clocktable p1)
+      (setq step-time (org-dblock-write:clocktable p1))
       (re-search-forward "#\\+END:")
+      (when (and (equal step-time 0) stepskip0)
+       ;; Remove the empty table
+       (delete-region (point-at-bol)
+                      (save-excursion
+                        (re-search-backward "^\\(Daily\\|Weekly\\) report" nil t)
+                        (point))))
       (end-of-line 0))))
 
 (defun org-clocktable-add-file (file table)
@@ -1857,7 +2052,7 @@ The details of what will be saved are regulated by the variable
                          system-name (format-time-string
                                       (cdr org-time-stamp-formats))))
          (if (and (memq org-clock-persist '(t clock))
-                  (setq b (marker-buffer org-clock-marker))
+                  (setq b (org-clocking-buffer))
                   (setq b (or (buffer-base-buffer b) b))
                   (buffer-live-p b)
                   (buffer-file-name b)
@@ -1866,7 +2061,7 @@ The details of what will be saved are regulated by the variable
                                         (substring-no-properties org-clock-heading)
                                         ") "))))
              (insert "(setq resume-clock '(\""
-                     (buffer-file-name (marker-buffer org-clock-marker))
+                     (buffer-file-name (org-clocking-buffer))
                      "\" . " (int-to-string (marker-position org-clock-marker))
                      "))\n"))
          ;; Store clocked task history. Tasks are stored reversed to make
@@ -1932,7 +2127,7 @@ The details of what will be saved are regulated by the variable
 
 ;;;###autoload
 (defun org-clock-persistence-insinuate ()
-  "Set up hooks for clock persistence"
+  "Set up hooks for clock persistence."
   (add-hook 'org-mode-hook 'org-clock-load)
   (add-hook 'kill-emacs-hook 'org-clock-save))
 
index 4786be665caf2a66138f17e707b45ec9977f1d85..8e45fdf3e3c86fa7a294863186d09c408a78909f 100644 (file)
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33x
+;; Version: 7.01
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -36,6 +36,9 @@
 (declare-function org-agenda-redo "org-agenda" ())
 (declare-function org-agenda-do-context-action "org-agenda" ())
 
+(when (featurep 'xemacs)
+  (error "Do not load this file into XEmacs, use 'org-colview-xemacs.el'."))
+
 ;;; Column View
 
 (defvar org-columns-overlays nil
@@ -146,8 +149,8 @@ This is the compiled version of the format.")
 
 (defun org-columns-new-overlay (beg end &optional string face)
   "Create a new column overlay and add it to the list."
-  (let ((ov (org-make-overlay beg end)))
-    (org-overlay-put ov 'face (or face 'secondary-selection))
+  (let ((ov (make-overlay beg end)))
+    (overlay-put ov 'face (or face 'secondary-selection))
     (org-overlay-display ov string face)
     (push ov org-columns-overlays)
     ov))
@@ -220,12 +223,12 @@ This is the compiled version of the format.")
       (org-unmodified
        (setq ov (org-columns-new-overlay
                 beg (setq beg (1+ beg)) string (if dateline face1 face)))
-       (org-overlay-put ov 'keymap org-columns-map)
-       (org-overlay-put ov 'org-columns-key property)
-       (org-overlay-put ov 'org-columns-value (cdr ass))
-       (org-overlay-put ov 'org-columns-value-modified modval)
-       (org-overlay-put ov 'org-columns-pom pom)
-       (org-overlay-put ov 'org-columns-format f))
+       (overlay-put ov 'keymap org-columns-map)
+       (overlay-put ov 'org-columns-key property)
+       (overlay-put ov 'org-columns-value (cdr ass))
+       (overlay-put ov 'org-columns-value-modified modval)
+       (overlay-put ov 'org-columns-pom pom)
+       (overlay-put ov 'org-columns-format f))
       (if (or (not (char-after beg))
              (equal (char-after beg) ?\n))
          (let ((inhibit-read-only t))
@@ -235,12 +238,12 @@ This is the compiled version of the format.")
       ;; Make the rest of the line disappear.
       (org-unmodified
        (setq ov (org-columns-new-overlay beg (point-at-eol)))
-       (org-overlay-put ov 'invisible t)
-       (org-overlay-put ov 'keymap org-columns-map)
-       (org-overlay-put ov 'intangible t)
+       (overlay-put ov 'invisible t)
+       (overlay-put ov 'keymap org-columns-map)
+       (overlay-put ov 'intangible t)
        (push ov org-columns-overlays)
-       (setq ov (org-make-overlay (1- (point-at-eol)) (1+ (point-at-eol))))
-       (org-overlay-put ov 'keymap org-columns-map)
+       (setq ov (make-overlay (1- (point-at-eol)) (1+ (point-at-eol))))
+       (overlay-put ov 'keymap org-columns-map)
        (push ov org-columns-overlays)
        (let ((inhibit-read-only t))
         (put-text-property (max (point-min) (1- (point-at-bol)))
@@ -298,7 +301,7 @@ for the duration of the command.")
     (org-add-hook 'post-command-hook 'org-columns-hscoll-title nil 'local)))
 
 (defun org-columns-hscoll-title ()
-  "Set the header-line-format so that it scrolls along with the table."
+  "Set the `header-line-format' so that it scrolls along with the table."
   (sit-for .0001) ; need to force a redisplay to update window-hscroll
   (when (not (= (window-hscroll) org-columns-previous-hscroll))
     (setq header-line-format
@@ -323,7 +326,7 @@ for the duration of the command.")
       (move-marker org-columns-begin-marker nil)
       (move-marker org-columns-top-level-marker nil)
       (org-unmodified
-       (mapc 'org-delete-overlay org-columns-overlays)
+       (mapc 'delete-overlay org-columns-overlays)
        (setq org-columns-overlays nil)
        (let ((inhibit-read-only t))
         (remove-text-properties (point-min) (point-max) '(read-only t))))
@@ -459,10 +462,16 @@ Where possible, use the standard interface for changing this line."
      ((equal key "SCHEDULED")
       (setq eval '(org-with-point-at pom
                    (call-interactively 'org-schedule))))
+     ((equal key "BEAMER_env")
+      (setq eval '(org-with-point-at pom
+                   (call-interactively 'org-beamer-set-environment-tag))))
      (t
       (setq allowed (org-property-get-allowed-values pom key 'table))
       (if allowed
-         (setq nval (org-icompleting-read "Value: " allowed nil t))
+         (setq nval (org-icompleting-read
+                     "Value: " allowed nil
+                     (not (get-text-property 0 'org-unrestricted
+                                             (caar allowed)))))
        (setq nval (read-string "Edit: " value)))
       (setq nval (org-trim nval))
       (when (not (equal nval value))
@@ -489,7 +498,7 @@ Where possible, use the standard interface for changing this line."
              (progn
                (setq org-columns-overlays
                      (org-delete-all line-overlays org-columns-overlays))
-               (mapc 'org-delete-overlay line-overlays)
+               (mapc 'delete-overlay line-overlays)
                (org-columns-eval eval))
            (org-columns-display-here)))
        (org-move-to-column col)
@@ -618,7 +627,7 @@ an integer, select that value."
            (progn
              (setq org-columns-overlays
                    (org-delete-all line-overlays org-columns-overlays))
-             (mapc 'org-delete-overlay line-overlays)
+             (mapc 'delete-overlay line-overlays)
              (org-columns-eval '(org-entry-put pom key nval)))
          (org-columns-display-here)))
       (org-move-to-column col)
@@ -740,17 +749,17 @@ around it."
      (lambda (x) (- org-columns-time x))))
   "Operator <-> format,function,calc  map.
 Used to compile/uncompile columns format and completing read in
-interactive function org-columns-new.
+interactive function `org-columns-new'.
 
 operator    string used in #+COLUMNS definition describing the
            summary type
 format      symbol describing summary type selected interactively in
-           org-columns-new and internally in
-           org-columns-number-to-string and
-           org-columns-string-to-number
+           `org-columns-new' and internally in
+           `org-columns-number-to-string' and
+           `org-columns-string-to-number'
 function    called with a list of values as argument to calculate
            the summary value
-calc        function called on every element before summarizing. This is
+calc        function called on every element before summarizing.  This is
            optional and should only be specified if needed")
 
 (defun org-columns-new (&optional prop title width op fmt fun &rest rest)
@@ -912,15 +921,15 @@ Don't set this, this is meant for dynamic scoping.")
   (let (fmt val pos)
     (save-excursion
       (mapc (lambda (ov)
-             (when (equal (org-overlay-get ov 'org-columns-key) property)
-               (setq pos (org-overlay-start ov))
+             (when (equal (overlay-get ov 'org-columns-key) property)
+               (setq pos (overlay-start ov))
                (goto-char pos)
                (when (setq val (cdr (assoc property
                                            (get-text-property
                                             (point-at-bol) 'org-summaries))))
-                 (setq fmt (org-overlay-get ov 'org-columns-format))
-                 (org-overlay-put ov 'org-columns-value val)
-                 (org-overlay-put ov 'display (format fmt val)))))
+                 (setq fmt (overlay-get ov 'org-columns-format))
+                 (overlay-put ov 'org-columns-value val)
+                 (overlay-put ov 'display (format fmt val)))))
            org-columns-overlays))))
 
 (defun org-columns-compute (property)
@@ -1103,8 +1112,7 @@ operator     the operator if any
 format       the output format for computed results, derived from operator
 printf       a printf format for computed values
 fun          the lisp function to compute summary values, derived from operator
-calc         function to get values from base elements
-"
+calc         function to get values from base elements"
   (let ((start 0) width prop title op op-match f printf fun calc)
     (setq org-columns-current-fmt-compiled nil)
     (while (string-match
@@ -1377,10 +1385,11 @@ and tailing newline characters."
 This will add overlays to the date lines, to show the summary for each day."
   (let* ((fmt (mapcar (lambda (x)
                        (if (equal (car x) "CLOCKSUM")
-                           (list "CLOCKSUM" (nth 2 x) nil 'add_times nil '+ 'identity)
-                         (cdr x)))
+                           (list "CLOCKSUM" (nth 1 x) (nth 2 x) ":" 'add_times
+                                 nil '+ nil)
+                         x))
                      org-columns-current-fmt-compiled))
-        line c c1 stype calc sumfunc props lsum entries prop v)
+        line c c1 stype calc sumfunc props lsum entries prop v title)
     (catch 'exit
       (when (delq nil (mapcar 'cadr fmt))
        ;; OK, at least one summation column, it makes sense to try this
@@ -1404,9 +1413,10 @@ This will add overlays to the date lines, to show the summary for each day."
                    (mapcar
                     (lambda (f)
                       (setq prop (car f)
-                            stype (nth 3 f)
-                            sumfunc (nth 5 f)
-                            calc (or (nth 6 f) 'identity))
+                            title (nth 1 f)
+                            stype (nth 4 f)
+                            sumfunc (nth 6 f)
+                            calc (or (nth 7 f) 'identity))
                       (cond
                        ((equal prop "ITEM")
                         (cons prop (buffer-substring (point-at-bol)
@@ -1471,7 +1481,7 @@ This will add overlays to the date lines, to show the summary for each day."
                  (org-columns-compute (car fm)))))))))))
 
 (defun org-format-time-period (interval)
-  "Convert time in fractional days to days/hours/minutes/seconds"
+  "Convert time in fractional days to days/hours/minutes/seconds."
   (if (numberp interval)
     (let* ((days (floor interval))
           (frac-hours (* 24 (- interval days)))
index 5ba62214be14501e04bfdddc91caba2eb3f10706..1b96b8d05356df36378de33eb9362a70aae5c2b4 100644 (file)
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33x
+;; Version: 7.01
 ;;
 ;; This file is part of GNU Emacs.
 ;;
 (declare-function find-library-name "find-func"  (library))
 (declare-function w32-focus-frame "term/w32-win" (frame))
 
-(defconst org-xemacs-p (featurep 'xemacs)) ; not used by org.el itself
+;; The following constant is for backward compatibility.  We do not use
+;; it in org-mode, because the Byte compiler evaluates (featurep 'xemacs)
+;; at compilation time and can therefore optimize code better.
+(defconst org-xemacs-p (featurep 'xemacs))
 (defconst org-format-transports-properties-p
   (let ((x "a"))
     (add-text-properties 0 1 '(test t) x)
@@ -86,25 +89,44 @@ any other entries, and any resulting duplicates will be removed entirely."
    (t specs)))
 (put 'org-compatible-face 'lisp-indent-function 1)
 
+(defun org-version-check (version feature level)
+  (let* ((v1 (mapcar 'string-to-number (split-string version "[.]")))
+        (v2 (mapcar 'string-to-number (split-string emacs-version "[.]")))
+        (rmaj (or (nth 0 v1) 99))
+        (rmin (or (nth 1 v1) 99))
+        (rbld (or (nth 2 v1) 99))
+        (maj (or (nth 0 v2) 0))
+        (min (or (nth 1 v2) 0))
+        (bld (or (nth 2 v2) 0)))
+    (if (or (< maj rmaj)
+           (and (= maj rmaj)
+                (< min rmin))
+           (and (= maj rmaj)
+                (= min rmin)
+                (< bld rbld)))
+       (if (eq level :predicate)
+           ;; just return if we have the version
+           nil
+         (let ((msg (format "Emacs %s or greater is recommended for %s"
+                            version feature)))
+           (display-warning 'org msg level)
+           t))
+      t)))
+
 ;;;; Emacs/XEmacs compatibility
 
+;; Keys
+(defconst org-xemacs-key-equivalents
+  '(([mouse-1] . [button1])
+    ([mouse-2] . [button2])
+    ([mouse-3] . [button3])
+    ([C-mouse-4] . [(control mouse-4)])
+    ([C-mouse-5] . [(control mouse-5)]))
+  "Translation alist for a couple of keys.")
+
 ;; Overlay compatibility functions
-(defun org-make-overlay (beg end &optional buffer)
-  (if (featurep 'xemacs)
-      (make-extent beg end buffer)
-    (make-overlay beg end buffer)))
-(defun org-delete-overlay (ovl)
-  (if (featurep 'xemacs) (progn (delete-extent ovl) nil) (delete-overlay ovl)))
 (defun org-detach-overlay (ovl)
   (if (featurep 'xemacs) (detach-extent ovl) (delete-overlay ovl)))
-(defun org-move-overlay (ovl beg end &optional buffer)
-  (if (featurep 'xemacs)
-      (set-extent-endpoints ovl beg end (or buffer (current-buffer)))
-    (move-overlay ovl beg end buffer)))
-(defun org-overlay-put (ovl prop value)
-  (if (featurep 'xemacs)
-      (set-extent-property ovl prop value)
-    (overlay-put ovl prop value)))
 (defun org-overlay-display (ovl text &optional face evap)
   "Make overlay OVL display TEXT with face FACE."
   (if (featurep 'xemacs)
@@ -124,32 +146,24 @@ any other entries, and any resulting duplicates will be removed entirely."
     (if face (org-add-props text nil 'face face))
     (overlay-put ovl 'before-string text)
     (if evap (overlay-put ovl 'evaporate t))))
-(defun org-overlay-get (ovl prop)
-  (if (featurep 'xemacs)
-      (extent-property ovl prop)
-    (overlay-get ovl prop)))
-(defun org-overlays-at (pos)
-  (if (featurep 'xemacs) (extents-at pos) (overlays-at pos)))
-(defun org-overlays-in (&optional start end)
-  (if (featurep 'xemacs)
-      (extent-list nil start end)
-    (overlays-in start end)))
-(defun org-overlay-start (o)
-  (if (featurep 'xemacs) (extent-start-position o) (overlay-start o)))
-(defun org-overlay-end (o)
-  (if (featurep 'xemacs) (extent-end-position o) (overlay-end o)))
-(defun org-overlay-buffer (o)
-  (if (featurep 'xemacs) (extent-buffer o) (overlay-buffer o)))
 (defun org-find-overlays (prop &optional pos delete)
   "Find all overlays specifying PROP at POS or point.
 If DELETE is non-nil, delete all those overlays."
-  (let ((overlays (org-overlays-at (or pos (point))))
+  (let ((overlays (overlays-at (or pos (point))))
        ov found)
     (while (setq ov (pop overlays))
-      (if (org-overlay-get ov prop)
-          (if delete (org-delete-overlay ov) (push ov found))))
+      (if (overlay-get ov prop)
+          (if delete (delete-overlay ov) (push ov found))))
     found))
 
+(defun org-get-x-clipboard (value)
+  "Get the value of the x clipboard, compatible with XEmacs, and GNU Emacs 21."
+  (if (eq window-system 'x)
+      (let ((x (org-get-x-clipboard-compat value)))
+       (if x (org-no-properties x)))))
+
+;; Miscellaneous functions
+
 (defun org-add-hook (hook function &optional append local)
   "Add-hook, compatible with both Emacsen."
   (if (and local (featurep 'xemacs))
@@ -170,7 +184,7 @@ that will be added to PLIST.  Returns the string that was modified."
   "Fit WINDOW to the buffer, but only if it is not a side-by-side window.
 WINDOW defaults to the selected window.  MAX-HEIGHT and MIN-HEIGHT are
 passed through to `fit-window-to-buffer'.  If SHRINK-ONLY is set, call
-`shrink-window-if-larger-than-buffer' instead, the hight limit are
+`shrink-window-if-larger-than-buffer' instead, the height limit is
 ignored in this case."
   (cond ((if (fboundp 'window-full-width-p)
             (not (window-full-width-p window))
@@ -206,19 +220,6 @@ Works on both Emacs and XEmacs."
 
 ;; Invisibility compatibility
 
-(defun org-add-to-invisibility-spec (arg)
-  "Add elements to `buffer-invisibility-spec'.
-See documentation for `buffer-invisibility-spec' for the kind of elements
-that can be added."
-  (cond
-   ((fboundp 'add-to-invisibility-spec)
-    (add-to-invisibility-spec arg))
-   ((or (null buffer-invisibility-spec) (eq buffer-invisibility-spec t))
-    (setq buffer-invisibility-spec (list arg)))
-   (t
-    (setq buffer-invisibility-spec
-         (cons arg buffer-invisibility-spec)))))
-
 (defun org-remove-from-invisibility-spec (arg)
   "Remove elements from `buffer-invisibility-spec'."
   (if (fboundp 'remove-from-invisibility-spec)
@@ -233,62 +234,42 @@ that can be added."
       (member arg buffer-invisibility-spec)
     nil))
 
+(defmacro org-xemacs-without-invisibility (&rest body)
+  "Turn off exents with invisibility while executing BODY."
+  `(let ((ext-inv (extent-list nil (point-at-bol) (point-at-eol)
+                              'all-extents-closed-open 'invisible))
+        ext-inv-specs)
+     (dolist (ext ext-inv)
+       (when (extent-property ext 'invisible)
+        (add-to-list 'ext-inv-specs (list ext (extent-property
+                                               ext 'invisible)))
+        (set-extent-property ext 'invisible nil)))
+     ,@body
+     (dolist (ext-inv-spec ext-inv-specs)
+       (set-extent-property (car ext-inv-spec) 'invisible
+                           (cadr ext-inv-spec)))))
+
 (defun org-indent-to-column (column &optional minimum buffer)
   "Work around a bug with extents with invisibility in XEmacs."
   (if (featurep 'xemacs)
-      (let ((ext-inv (extent-list
-                     nil (point-at-bol) (point-at-eol)
-                     'all-extents-closed-open 'invisible))
-           ext-inv-specs)
-       (dolist (ext ext-inv)
-         (when (extent-property ext 'invisible)
-           (add-to-list 'ext-inv-specs (list ext (extent-property
-                                                  ext 'invisible)))
-           (set-extent-property ext 'invisible nil)))
-       (indent-to-column column minimum buffer)
-       (dolist (ext-inv-spec ext-inv-specs)
-         (set-extent-property (car ext-inv-spec) 'invisible
-                              (cadr ext-inv-spec))))
+      (org-xemacs-without-invisibility (indent-to-column column minimum buffer))
     (indent-to-column column minimum)))
 
 (defun org-indent-line-to (column)
   "Work around a bug with extents with invisibility in XEmacs."
   (if (featurep 'xemacs)
-      (let ((ext-inv (extent-list
-                     nil (point-at-bol) (point-at-eol)
-                     'all-extents-closed-open 'invisible))
-           ext-inv-specs)
-       (dolist (ext ext-inv)
-         (when (extent-property ext 'invisible)
-           (add-to-list 'ext-inv-specs (list ext (extent-property
-                                                  ext 'invisible)))
-           (set-extent-property ext 'invisible nil)))
-       (indent-line-to column)
-       (dolist (ext-inv-spec ext-inv-specs)
-         (set-extent-property (car ext-inv-spec) 'invisible
-                              (cadr ext-inv-spec))))
+      (org-xemacs-without-invisibility (indent-line-to column))
     (indent-line-to column)))
 
 (defun org-move-to-column (column &optional force buffer)
   (if (featurep 'xemacs)
-      (let ((ext-inv (extent-list
-                     nil (point-at-bol) (point-at-eol)
-                     'all-extents-closed-open 'invisible))
-           ext-inv-specs)
-       (dolist (ext ext-inv)
-         (when (extent-property ext 'invisible)
-           (add-to-list 'ext-inv-specs (list ext (extent-property ext
-                                                                  'invisible)))
-           (set-extent-property ext 'invisible nil)))
-       (move-to-column column force buffer)
-       (dolist (ext-inv-spec ext-inv-specs)
-         (set-extent-property (car ext-inv-spec) 'invisible
-                              (cadr ext-inv-spec))))
+      (org-xemacs-without-invisibility (move-to-column column force buffer))
     (move-to-column column force)))
 
 (defun org-get-x-clipboard-compat (value)
-  "Get the clipboard value on XEmacs or Emacs 21"
-  (cond (org-xemacs-p (org-no-warnings (get-selection-no-error value)))
+  "Get the clipboard value on XEmacs or Emacs 21."
+  (cond ((featurep 'xemacs)
+        (org-no-warnings (get-selection-no-error value)))
        ((fboundp 'x-get-selection)
         (condition-case nil
             (or (x-get-selection value 'UTF8_STRING)
@@ -362,6 +343,52 @@ TIME defaults to the current time."
       (time-to-seconds (or time (current-time)))
     (float-time time)))
 
+(defun org-string-match-p (&rest args)
+  (if (fboundp 'string-match-p)
+      (apply 'string-match-p args)
+    (save-match-data
+      (apply 'string-match args))))
+
+(defun org-looking-at-p (&rest args)
+  (if (fboundp 'looking-at-p)
+      (apply 'looking-at-p args)
+    (save-match-data
+      (apply 'looking-at-p args))))
+
+; XEmacs does not have `looking-back'.
+(if (fboundp 'looking-back)
+    (defalias 'org-looking-back 'looking-back)
+  (defun org-looking-back (regexp &optional limit greedy)
+    "Return non-nil if text before point matches regular expression REGEXP.
+Like `looking-at' except matches before point, and is slower.
+LIMIT if non-nil speeds up the search by specifying a minimum
+starting position, to avoid checking matches that would start
+before LIMIT.
+
+If GREEDY is non-nil, extend the match backwards as far as
+possible, stopping when a single additional previous character
+cannot be part of a match for REGEXP.  When the match is
+extended, its starting position is allowed to occur before
+LIMIT."
+    (let ((start (point))
+         (pos
+          (save-excursion
+            (and (re-search-backward (concat "\\(?:" regexp "\\)\\=") limit t)
+                 (point)))))
+      (if (and greedy pos)
+         (save-restriction
+           (narrow-to-region (point-min) start)
+           (while (and (> pos (point-min))
+                       (save-excursion
+                         (goto-char pos)
+                         (backward-char 1)
+                         (looking-at (concat "\\(?:"  regexp "\\)\\'"))))
+             (setq pos (1- pos)))
+           (save-excursion
+             (goto-char pos)
+             (looking-at (concat "\\(?:"  regexp "\\)\\'")))))
+      (not (null pos)))))
+
 (provide 'org-compat)
 
 ;; arch-tag: a0a0579f-e68c-4bdf-9e55-93768b846bbe
index e4c096cd2099260a1ec9cc17f4a691dd137723fd..d93981227e5e8c0ba3c9c529ab91619b17a661eb 100644 (file)
@@ -4,7 +4,7 @@
 
 ;; Emacs Lisp Archive Entry
 ;; Filename: org-crypt.el
-;; Version: 6.33x
+;; Version: 7.01
 ;; Keywords: org-mode
 ;; Author: John Wiegley <johnw@gnu.org>
 ;; Maintainer: Peter Jones <pjones@pmade.com>
@@ -45,6 +45,7 @@
 ;;    decrypt it.  This makes it possible to leave secure notes that
 ;;    only the intended recipient can read in a shared-org-mode-files
 ;;    scenario.
+;;    If the key is not set, org-crypt will default to symmetric encryption.
 ;;
 ;; 3. To later decrypt an entry, use `org-decrypt-entries' or
 ;;    `org-decrypt-entry'.  It might be useful to bind this to a key,
@@ -66,6 +67,8 @@
 
 (require 'org)
 
+;;; Code:
+
 (declare-function epg-decrypt-string "epg" (context cipher))
 (declare-function epg-list-keys "epg" (context &optional name mode))
 (declare-function epg-make-context "epg"
   :tag "Org Crypt" :group 'org)
 
 (defcustom org-crypt-tag-matcher "crypt"
-  "The tag matcher used to find headings whose contents should be
-encrypted.  See the \"Match syntax\" section of the org manual
-for more details."
+  "The tag matcher used to find headings whose contents should be encrypted.
+
+See the \"Match syntax\" section of the org manual for more details."
   :type 'string :group 'org-crypt)
 
 (defcustom org-crypt-key nil
-  "The default key to use when encrypting the contents of a
-heading.  This can also be overridden in the CRYPTKEY property."
+  "The default key to use when encrypting the contents of a heading.
+
+This setting can also be overridden in the CRYPTKEY property."
   :type 'string :group 'org-crypt)
 
 (defun org-crypt-key-for-heading ()
-  "Returns the encryption key for the current heading."
+  "Return the encryption key for the current heading."
   (save-excursion
     (org-back-to-heading t)
-    (or (org-entry-get nil "CRYPTKEY" 'selective) 
+    (or (org-entry-get nil "CRYPTKEY" 'selective)
         org-crypt-key
         (and (boundp 'epa-file-encrypt-to) epa-file-encrypt-to)
-        (error "No crypt key set"))))
+        (message "No crypt key set, using symmetric encryption."))))
 
 (defun org-encrypt-entry ()
   "Encrypt the content of the current headline."
@@ -105,71 +109,77 @@ heading.  This can also be overridden in the CRYPTKEY property."
   (require 'epg)
   (save-excursion
     (org-back-to-heading t)
-    (forward-line)
-    (when (not (looking-at "-----BEGIN PGP MESSAGE-----"))
-      (let ((folded (org-invisible-p))
-           (epg-context (epg-make-context nil t t))
-           (crypt-key (org-crypt-key-for-heading))
-           (beg (point))
-           end encrypted-text)
-       (org-end-of-subtree t t)
-       (org-back-over-empty-lines)
-        (setq end (point)
-              encrypted-text
-              (epg-encrypt-string 
-               epg-context
-               (buffer-substring-no-properties beg end)
-               (epg-list-keys epg-context crypt-key)))
-        (delete-region beg end)
-        (insert encrypted-text)
-       (when folded
-         (save-excursion
-           (org-back-to-heading t)
-           (hide-subtree)))
-        nil))))
+    (let ((start-heading (point)))
+      (forward-line)
+      (when (not (looking-at "-----BEGIN PGP MESSAGE-----"))
+        (let ((folded (org-invisible-p))
+              (epg-context (epg-make-context nil t t))
+              (crypt-key (org-crypt-key-for-heading))
+              (beg (point))
+              end encrypted-text)
+          (goto-char start-heading)
+          (org-end-of-subtree t t)
+          (org-back-over-empty-lines)
+          (setq end (point)
+                encrypted-text
+                (epg-encrypt-string
+                 epg-context
+                 (buffer-substring-no-properties beg end)
+                 (epg-list-keys epg-context crypt-key)))
+          (delete-region beg end)
+          (insert encrypted-text)
+          (when folded
+            (goto-char start-heading)
+            (hide-subtree))
+          nil)))))
 
 (defun org-decrypt-entry ()
+  "Decrypt the content of the current headline."
   (interactive)
   (require 'epg)
-  (save-excursion
-    (org-back-to-heading t)
-    (forward-line)
-    (when (looking-at "-----BEGIN PGP MESSAGE-----")
-      (let* ((beg (point))
-             (end (save-excursion 
-                    (search-forward "-----END PGP MESSAGE-----")
-                    (forward-line)
-                    (point)))
-             (epg-context (epg-make-context nil t t))
-             (decrypted-text 
-             (decode-coding-string
-              (epg-decrypt-string
-               epg-context
-               (buffer-substring-no-properties beg end))
-              'utf-8)))
-        (delete-region beg end)
-        (insert decrypted-text)
-        nil))))
+  (unless (org-before-first-heading-p)
+    (save-excursion
+      (org-back-to-heading t)
+      (forward-line)
+      (when (looking-at "-----BEGIN PGP MESSAGE-----")
+       (let* ((beg (point))
+              (end (save-excursion
+                     (search-forward "-----END PGP MESSAGE-----")
+                     (forward-line)
+                     (point)))
+              (epg-context (epg-make-context nil t t))
+              (decrypted-text
+               (decode-coding-string
+                (epg-decrypt-string
+                 epg-context
+                 (buffer-substring-no-properties beg end))
+                'utf-8)))
+         (delete-region beg end)
+         (insert decrypted-text)
+         nil)))))
 
 (defun org-encrypt-entries ()
+  "Encrypt all top-level entries in the current buffer."
   (interactive)
   (org-scan-tags
    'org-encrypt-entry
    (cdr (org-make-tags-matcher org-crypt-tag-matcher))))
 
 (defun org-decrypt-entries ()
+  "Decrypt all entries in the current buffer."
   (interactive)
-  (org-scan-tags 
+  (org-scan-tags
    'org-decrypt-entry
    (cdr (org-make-tags-matcher org-crypt-tag-matcher))))
 
 (defun org-crypt-use-before-save-magic ()
-  "Adds a hook that will automatically encrypt entries before a
-file is saved to disk."
-  (add-hook 
-   'org-mode-hook 
+  "Add a hook to automatically encrypt entries before a file is saved to disk."
+  (add-hook
+   'org-mode-hook
    (lambda () (add-hook 'before-save-hook 'org-encrypt-entries nil t))))
-  
+
+(add-hook 'org-reveal-start-hook 'org-decrypt-entry)
+
 (provide 'org-crypt)
 
 ;; arch-tag: 8202ed2c-221e-4001-9e4b-54674a7e846e
diff --git a/lisp/org/org-ctags.el b/lisp/org/org-ctags.el
new file mode 100644 (file)
index 0000000..fc6b192
--- /dev/null
@@ -0,0 +1,541 @@
+;;; org-ctags.el - Integrate Emacs "tags" facility with org mode.
+;;
+;; Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+
+;; Author: Paul Sexton <eeeickythump@gmail.com>
+;; Version: 7.01
+
+;; Keywords: org, wp
+;; Version: 7.01
+;;
+;; 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/>.
+
+;;
+;; Synopsis
+;; ========
+;;
+;; Allows org-mode to make use of the Emacs `etags' system. Defines tag
+;; destinations in org-mode files as any text between <<double angled
+;; brackets>>. This allows the tags-generation program `exuberant ctags' to
+;; parse these files and create tag tables that record where these
+;; destinations are found. Plain [[links]] in org mode files which do not have
+;; <<matching destinations>> within the same file will then be interpreted as
+;; links to these 'tagged' destinations, allowing seamless navigation between
+;; multiple org-mode files. Topics can be created in any org mode file and
+;; will always be found by plain links from other files. Other file types
+;; recognised by ctags (source code files, latex files, etc) will also be
+;; available as destinations for plain links, and similarly, org-mode links
+;; will be available as tags from source files. Finally, the function
+;; `org-ctags-find-tag-interactive' lets you choose any known tag, using
+;; autocompletion, and quickly jump to it.
+;;
+;; Installation
+;; ============
+;;
+;; Install org mode
+;; Ensure org-ctags.el is somewhere in your emacs load path.
+;; Download and install Exuberant ctags -- "http://ctags.sourceforge.net/"
+;; Edit your .emacs file (see next section) and load emacs.
+
+;; To put in your init file (.emacs):
+;; ==================================
+;;
+;; Assuming you already have org mode installed and set up:
+;;
+;;    (setq org-ctags-path-to-ctags "/path/to/ctags/executable")
+;;    (add-hook 'org-mode-hook
+;;      (lambda ()
+;;        (define-key org-mode-map "\C-co" 'org-ctags-find-tag-interactive)))
+;;
+;; By default, with org-ctags loaded, org will first try and visit the tag
+;; with the same name as the link; then, if unsuccessful, ask the user if
+;; he/she wants to rebuild the 'TAGS' database and try again; then ask if
+;; the user wishes to append 'tag' as a new toplevel heading at the end of
+;; the buffer; and finally, defer to org's default behaviour which is to
+;; search the entire text of the current buffer for 'tag'.
+;;
+;; This behaviour can be modified by changing the value of
+;; ORG-CTAGS-OPEN-LINK-FUNCTIONS. For example I have the following in my
+;; .emacs, which describes the same behaviour as the above paragraph with
+;; one difference:
+;;
+;; (setq org-ctags-open-link-functions
+;;       '(org-ctags-find-tag
+;;         org-ctags-ask-rebuild-tags-file-then-find-tag
+;;         org-ctags-ask-append-topic
+;;         org-ctags-fail-silently))  ; <-- prevents org default behaviour
+;;
+;;
+;; Usage
+;; =====
+;;
+;; When you click on a link "[[foo]]" and org cannot find a matching "<<foo>>"
+;; in the current buffer, the tags facility will take over. The file TAGS in
+;; the active directory is examined to see if the tags facility knows about
+;; "<<foo>>" in any other files. If it does, the matching file will be opened
+;; and the cursor will jump to the position of "<<foo>>" in that file.
+;;
+;; User-visible functions:
+;; - `org-ctags-find-tag-interactive': type a tag (plain link) name and visit
+;;   it. With autocompletion. Bound to ctrl-O in the above setup.
+;; - All the etags functions should work. These include:
+;;
+;;      M-.    `find-tag' -- finds the tag at point
+;;
+;;      C-M-.  find-tag based on regular expression
+;;
+;;      M-x tags-search RET -- like C-M-. but searches through ENTIRE TEXT
+;;             of ALL the files referenced in the TAGS file. A quick way to
+;;             search through an entire 'project'.
+;;
+;;      M-*    "go back" from a tag jump. Like `org-mark-ring-goto'.
+;;             You may need to bind this key yourself with (eg)
+;;             (global-set-key (kbd "<M-kp-multiply>") 'pop-tag-mark)
+;;
+;;      (see etags chapter in Emacs manual for more)
+;;
+;;
+;; Keeping the TAGS file up to date
+;; ================================
+;;
+;; Tags mode has no way of knowing that you have created new tags by typing in
+;; your org-mode buffer.  New tags make it into the TAGS file in 3 ways:
+;;
+;; 1. You re-run (org-ctags-create-tags "directory") to rebuild the file.
+;; 2. You put the function `org-ctags-ask-rebuild-tags-file-then-find-tag' in
+;;    your `org-open-link-functions' list, as is done in the setup
+;;    above. This will cause the TAGS file to be rebuilt whenever a link
+;;    cannot be found. This may be slow with large file collections however.
+;; 3. You run the following from the command line (all 1 line):
+;;
+;;      ctags --langdef=orgmode --langmap=orgmode:.org
+;;        --regex-orgmode="/<<([^>]+)>>/\1/d,definition/"
+;;          -f /your/path/TAGS -e -R /your/path/*.org
+;;
+;; If you are paranoid, you might want to run (org-ctags-create-tags
+;; "/path/to/org/files") at startup, by including the following toplevel form
+;; in .emacs. However this can cause a pause of several seconds if ctags has
+;; to scan lots of files.
+;;
+;;     (progn
+;;       (message "-- rebuilding tags tables...")
+;;       (mapc 'org-create-tags tags-table-list))
+
+;;; Code:
+
+(eval-when-compile (require 'cl))
+
+(require 'org)
+
+(defgroup org-ctags nil
+  "Options concerning use of ctags within org mode."
+  :tag "Org-Ctags"
+  :group 'org-link)
+
+(defvar org-ctags-enabled-p t
+  "Activate ctags support in org mode?")
+
+(defvar org-ctags-tag-regexp "/<<([^>]+)>>/\\1/d,definition/"
+  "Regexp expression used by ctags external program.
+The regexp matches tag destinations in org-mode files.
+Format is: /REGEXP/TAGNAME/FLAGS,TAGTYPE/
+See the ctags documentation for more information.")
+
+(defcustom org-ctags-path-to-ctags
+  (case system-type
+    (windows-nt "ctags.exe")
+    (darwin "ctags-exuberant")
+    (t "ctags-exuberant"))
+  "Full path to the ctags executable file."
+  :group 'org-ctags
+  :type 'file)
+
+(defcustom org-ctags-open-link-functions
+  '(org-ctags-find-tag
+    org-ctags-ask-rebuild-tags-file-then-find-tag
+    org-ctags-ask-append-topic)
+  "List of functions to be prepended to ORG-OPEN-LINK-FUNCTIONS when ORG-CTAGS is active."
+  :group 'org-ctags
+  :type 'hook
+  :options '(org-ctags-find-tag
+             org-ctags-ask-rebuild-tags-file-then-find-tag
+             org-ctags-rebuild-tags-file-then-find-tag
+             org-ctags-ask-append-topic
+             org-ctags-append-topic
+             org-ctags-ask-visit-buffer-or-file
+             org-ctags-visit-buffer-or-file
+             org-ctags-fail-silently))
+
+
+(defvar org-ctags-tag-list nil
+  "List of all tags in the active TAGS file.
+Created as a local variable in each buffer.")
+
+(defcustom org-ctags-new-topic-template
+  "* <<%t>>\n\n\n\n\n\n"
+  "Text to insert when creating a new org file via opening a hyperlink.
+The following patterns are replaced in the string:
+    `%t' - replaced with the capitalized title of the hyperlink"
+  :group 'org-ctags
+  :type 'string)
+
+
+(add-hook 'org-mode-hook
+          (lambda ()
+            (when (and org-ctags-enabled-p
+                       (buffer-file-name))
+              ;; Make sure this file's directory is added to default
+              ;; directories in which to search for tags.
+              (let ((tags-filename
+                     (expand-file-name
+                      (concat (file-name-directory (buffer-file-name))
+                              "/TAGS"))))
+                (when (file-exists-p tags-filename)
+                  (visit-tags-table tags-filename))))))
+
+
+(defadvice visit-tags-table (after org-ctags-load-tag-list activate compile)
+  (when (and org-ctags-enabled-p tags-file-name)
+    (set (make-local-variable 'org-ctags-tag-list)
+         (org-ctags-all-tags-in-current-tags-table))))
+
+
+(defun org-ctags-enable ()
+  (put 'org-mode 'find-tag-default-function 'org-ctags-find-tag-at-point)
+  (setq org-ctags-enabled-p t)
+  (dolist (fn org-ctags-open-link-functions)
+    (add-hook 'org-open-link-functions fn t)))
+
+
+;;; General utility functions.  ===============================================
+;; These work outside org-ctags mode.
+
+(defun org-ctags-get-filename-for-tag (tag)
+  "TAG is a string.  Search the active TAGS file for a matching tag.
+If the tag is found, return a list containing the filename, line number, and
+buffer position where the tag is found."
+  (interactive "sTag: ")
+  (unless tags-file-name
+    (call-interactively (visit-tags-table)))
+  (save-excursion
+    (visit-tags-table-buffer 'same)
+    (when tags-file-name
+      (with-current-buffer (get-file-buffer tags-file-name)
+        (goto-char (point-min))
+        (cond
+         ((re-search-forward (format "^.*\7f%s\ 1\\([0-9]+\\),\\([0-9]+\\)$"
+                                     (regexp-quote tag)) nil t)
+          (let ((line (string-to-number (match-string 1)))
+                (pos (string-to-number (match-string 2))))
+            (cond
+             ((re-search-backward "\f\n\\(.*\\),[0-9]+\n")
+              (list (match-string 1) line pos))
+             (t              ; can't find a file name preceding the matched
+                             ; tag??
+              (error "Malformed TAGS file: %s" (buffer-name))))))
+         (t                               ; tag not found
+          nil))))))
+
+
+(defun org-ctags-all-tags-in-current-tags-table ()
+  "Read all tags defined in the active TAGS file, into a list of strings.
+Return the list."
+  (interactive)
+  (let ((taglist nil))
+    (unless tags-file-name
+      (call-interactively (visit-tags-table)))
+    (save-excursion
+      (visit-tags-table-buffer 'same)
+      (with-current-buffer (get-file-buffer tags-file-name)
+        (goto-char (point-min))
+        (while (re-search-forward "^.*\7f\\(.*\\)\ 1\\([0-9]+\\),\\([0-9]+\\)$"
+                                  nil t)
+          (push (substring-no-properties (match-string 1)) taglist)))
+      taglist)))
+
+
+(defun org-ctags-string-search-and-replace (search replace string)
+  "Replace all instances of SEARCH with REPLACE in STRING."
+  (replace-regexp-in-string (regexp-quote search) replace string t t))
+
+
+(defun y-or-n-minibuffer (prompt)
+  (let ((use-dialog-box nil))
+    (y-or-n-p prompt)))
+
+
+;;; Internal functions =======================================================
+
+
+(defun org-ctags-open-file (name &optional title)
+  "Visit or create a file called `NAME.org', and insert a new topic.
+The new topic will be titled NAME (or TITLE if supplied)."
+  (interactive "sFile name: ")
+  (let ((filename (substitute-in-file-name (expand-file-name name))))
+    (condition-case v
+        (progn
+          (org-open-file name t)
+          (message "Opened file OK")
+          (goto-char (point-max))
+          (insert (org-ctags-string-search-and-replace
+                   "%t" (capitalize (or title name))
+                   org-ctags-new-topic-template))
+          (message "Inserted new file text OK")
+          (org-mode-restart))
+      (error (error "Error %S in org-ctags-open-file" v)))))
+
+
+;;;; Misc interoperability with etags system =================================
+
+
+(defadvice find-tag (before org-ctags-set-org-mark-before-finding-tag
+                           activate compile)
+  "Before trying to find a tag, save our current position on org mark ring."
+  (save-excursion
+    (if (and (org-mode-p) org-ctags-enabled-p)
+        (org-mark-ring-push))))
+
+
+
+(defun org-ctags-find-tag-at-point ()
+  "Determine default tag to search for, based on text at point.
+If there is no plausible default, return nil."
+  (let (from to bound)
+    (when (or (ignore-errors
+               ;; Look for hyperlink around `point'.
+               (save-excursion
+                 (search-backward "[[") (setq from (+ 2 (point))))
+               (save-excursion
+                  (goto-char from)
+                 (search-forward "]") (setq to (- (point) 1)))
+               (and (> to from) (>= (point) from) (<= (point) to)))
+              (progn
+               ;; Look at text around `point'.
+               (save-excursion
+                 (skip-syntax-backward "w_") (setq from (point)))
+               (save-excursion
+                 (skip-syntax-forward "w_") (setq to (point)))
+               (> to from))
+             ;; Look between `line-beginning-position' and `point'.
+             (save-excursion
+               (and (setq bound (line-beginning-position))
+                    (skip-syntax-backward "^w_" bound)
+                    (> (setq to (point)) bound)
+                    (skip-syntax-backward "w_")
+                    (setq from (point))))
+             ;; Look between `point' and `line-end-position'.
+             (save-excursion
+               (and (setq bound (line-end-position))
+                    (skip-syntax-forward "^w_" bound)
+                    (< (setq from (point)) bound)
+                    (skip-syntax-forward "w_")
+                    (setq to (point)))))
+      (buffer-substring-no-properties from to))))
+
+
+;;; Functions for use with 'org-open-link-functions' hook =================
+
+
+(defun org-ctags-find-tag (name)
+  "This function is intended to be used in ORG-OPEN-LINK-FUNCTIONS.
+Look for a tag called `NAME' in the current TAGS table.  If it is found,
+visit the file and location where the tag is found."
+  (interactive "sTag: ")
+  (let ((old-buf (current-buffer))
+        (old-pnt (point-marker))
+        (old-mark (copy-marker (mark-marker))))
+    (condition-case nil
+        (progn (find-tag name)
+               t)
+      (error
+       ;; only restore old location if find-tag raises error
+       (set-buffer old-buf)
+       (goto-char old-pnt)
+       (set-marker (mark-marker) old-mark)
+       nil))))
+
+
+(defun org-ctags-visit-buffer-or-file (name &optional create)
+  "This function is intended to be used in ORG-OPEN-LINK-FUNCTIONS.
+Visit buffer named `NAME.org'.  If there is no such buffer, visit the file
+with the same name if it exists.  If the file does not exist, then behavior
+depends on the value of CREATE.
+
+If CREATE is nil (default), then return nil.  Do not create a new file.
+If CREATE is t, create the new file and visit it.
+If CREATE is the symbol `ask', then ask the user if they wish to create
+the new file."
+  (interactive)
+  (let ((filename (concat (substitute-in-file-name
+                           (expand-file-name name))
+                          ".org")))
+    (cond
+     ((get-buffer (concat name ".org"))
+      ;; Buffer is already open
+      (switch-to-buffer (get-buffer (concat name ".org"))))
+     ((file-exists-p filename)
+      ;; File exists but is not open --> open it
+      (message "Opening existing org file `%S'..."
+               filename)
+      (org-open-file filename t))
+     ((or (eql create t)
+          (and (eql create 'ask)
+               (y-or-n-p (format "File `%s.org' not found; create?" name))))
+      (org-ctags-open-file filename name))
+     (t ;; File does not exist, and we don't want to create it.
+      nil))))
+
+
+(defun org-ctags-ask-visit-buffer-or-file (name)
+  "This function is intended to be used in ORG-OPEN-LINK-FUNCTIONS.
+Wrapper for org-ctags-visit-buffer-or-file, which ensures the user is
+asked before creating a new file."
+  (org-ctags-visit-buffer-or-file name 'ask))
+
+
+(defun org-ctags-append-topic (name &optional narrowp)
+  "This function is intended to be used in ORG-OPEN-LINK-FUNCTIONS.
+Append a new toplevel heading to the end of the current buffer. The
+heading contains NAME surrounded by <<angular brackets>>, thus making
+the heading a destination for the tag `NAME'."
+  (interactive "sTopic: ")
+  (widen)
+  (goto-char (point-max))
+  (newline 2)
+  (message "Adding topic in buffer %s" (buffer-name))
+  (insert (org-ctags-string-search-and-replace
+           "%t" (capitalize name) org-ctags-new-topic-template))
+  (backward-char 4)
+  (org-update-radio-target-regexp)
+  (end-of-line)
+  (forward-line 2)
+  (when narrowp
+    ;;(org-tree-to-indirect-buffer 1)  ;; opens new frame
+    (org-narrow-to-subtree))
+  t)
+
+
+(defun org-ctags-ask-append-topic (name &optional narrowp)
+  "This function is intended to be used in ORG-OPEN-LINK-FUNCTIONS.
+Wrapper for org-ctags-append-topic, which first asks the user if they want
+to append a new topic."
+  (if (y-or-n-p (format "Topic `%s' not found; append to end of buffer?"
+                        name))
+      (org-ctags-append-topic name narrowp)
+    nil))
+
+
+(defun org-ctags-rebuild-tags-file-then-find-tag (name)
+  "This function is intended to be used in ORG-OPEN-LINK-FUNCTIONS.
+Like ORG-CTAGS-FIND-TAG, but calls the external ctags program first,
+to rebuild (update) the TAGS file."
+  (unless tags-file-name
+    (call-interactively (visit-tags-table)))
+  (when (buffer-file-name)
+    (org-ctags-create-tags))
+  (org-ctags-find-tag name))
+
+
+(defun org-ctags-ask-rebuild-tags-file-then-find-tag (name)
+  "This function is intended to be used in ORG-OPEN-LINK-FUNCTIONS.
+Wrapper for org-ctags-rebuild-tags-file-then-find-tag."
+  (if (and (buffer-file-name)
+             (y-or-n-p
+              (format
+               "Tag `%s' not found.  Rebuild table `%s/TAGS' and look again?"
+               name
+               (file-name-directory (buffer-file-name)))))
+    (org-ctags-rebuild-tags-file-then-find-tag name)
+    nil))
+
+
+(defun org-ctags-fail-silently (name)
+  "This function is intended to be used in ORG-OPEN-LINK-FUNCTIONS.
+Put as the last function in the list if you want to prevent org's default
+behavior of free text search."
+  t)
+
+
+;;; User-visible functions ===================================================
+
+
+(defun org-ctags-create-tags (&optional directory-name)
+  "(Re)create tags file in the directory of the active buffer.
+The file will contain tag definitions for all the files in the
+directory and its subdirectories which are recognized by ctags.
+This will include files ending in `.org' as well as most other
+source files (.C, .H, .EL, .LISP, etc).  All the resulting tags
+end up in one file, called TAGS, located in the directory.  This
+function may take several seconds to finish if the directory or
+its subdirectories contain large numbers of taggable files."
+  (interactive)
+  (assert (buffer-file-name))
+  (let ((dir-name (or directory-name
+                      (file-name-directory (buffer-file-name))))
+        (exitcode nil))
+    (save-excursion
+      (setq exitcode
+            (shell-command
+             (format (concat "%s --langdef=orgmode --langmap=orgmode:.org "
+                             "--regex-orgmode=\"%s\" -f \"%s\" -e -R \"%s\"")
+                     org-ctags-path-to-ctags
+                     org-ctags-tag-regexp
+                     (expand-file-name (concat dir-name "/TAGS"))
+                     (expand-file-name (concat dir-name "/*")))))
+      (cond
+       ((eql 0 exitcode)
+        (set (make-local-variable 'org-ctags-tag-list)
+             (org-ctags-all-tags-in-current-tags-table)))
+       (t
+        ;; This seems to behave differently on Linux, so just ignore
+        ;; error codes for now
+        ;;(error "Calling ctags executable resulted in error code: %s"
+        ;;       exitcode)
+        nil)))))
+
+
+(defvar org-ctags-find-tag-history nil
+  "History of tags visited by org-ctags-find-tag-interactive.")
+
+(defun org-ctags-find-tag-interactive ()
+  "Prompt for the name of a tag, with autocompletion, then visit the named tag.
+Uses `ido-mode' if available.
+If the user enters a string that does not match an existing tag, create
+a new topic."
+  (interactive)
+  (let* ((completing-read-fn (if (fboundp 'ido-completing-read)
+                                 'ido-completing-read
+                               'completing-read))
+         (tag (funcall completing-read-fn "Topic: " org-ctags-tag-list
+                       nil 'confirm nil 'org-ctags-find-tag-history)))
+    (when tag
+      (cond
+       ((member tag org-ctags-tag-list)
+        ;; Existing tag
+        (push tag org-ctags-find-tag-history)
+        (find-tag tag))
+       (t
+        ;; New tag
+        (run-hook-with-args-until-success
+               'org-open-link-functions tag))))))
+
+
+(org-ctags-enable)
+
+(provide 'org-ctags)
+
+;; arch-tag: 4b1ddd5a-8529-4b17-bcde-96a922d26343
+;;; org-ctags.el ends here
index c57fdc5f9928d23ce70764fc07b56499c1a103aa..331d6d6a1d148db149f43bbd3ff4e2039507a86c 100644 (file)
@@ -5,7 +5,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33x
+;; Version: 7.01
 ;;
 ;; This file is part of GNU Emacs.
 ;;
 (defvar org-datetree-base-level 1
   "The level at which years should be placed in the date tree.
 This is normally one, but if the buffer has an entry with a DATE_TREE
-property, the date tree will become a subtree under that entry, so the
-base level will be properly adjusted.")
+property (any value), the date tree will become a subtree under that entry,
+so the base level will be properly adjusted.")
 
+;;;###autoload
 (defun org-datetree-find-date-create (date &optional keep-restriction)
   "Find or create an entry for DATE.
 If KEEP-RESTRICTION is non-nil, do not widen the buffer.
-When it is nit, the buffer will be widened to make sure an existing date
+When it is nil, the buffer will be widened to make sure an existing date
 tree can be found."
   (let ((year (nth 2 date))
        (month (car date))
index afc91daf3c257b16795f637fd074b78e3c198e20..12ab96deff9d7bf25f230e69cd4a9d658a75586e 100644 (file)
@@ -4,7 +4,7 @@
 ;;
 ;; Emacs Lisp Archive Entry
 ;; Filename: org-docbook.el
-;; Version: 6.33x
+;; Version: 7.01
 ;; Author: Baoqiu Cui <cbaoqiu AT yahoo DOT com>
 ;; Maintainer: Baoqiu Cui <cbaoqiu AT yahoo DOT com>
 ;; Keywords: org, wp, docbook
@@ -26,7 +26,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/>.
 
-;; Commentary:
+;;; Commentary:
 ;;
 ;; This library implements a DocBook exporter for org-mode.  The basic
 ;; idea and design is very similar to what `org-export-as-html' has.
@@ -76,6 +76,7 @@
 (require 'org)
 (require 'org-exp)
 (require 'org-html)
+(require 'format-spec)
 
 ;;; Variables:
 
@@ -141,8 +142,8 @@ people work on the same document."
   :type 'string)
 
 (defcustom org-export-docbook-footnote-id-prefix "fn-"
-  "The prefix of footnote IDs used during exporting.  Like
-`org-export-docbook-section-id-prefix', this variable can help
+  "The prefix of footnote IDs used during exporting.
+Like `org-export-docbook-section-id-prefix', this variable can help
 avoid same set of footnote IDs being used multiple times."
   :group 'org-export-docbook
   :type 'string)
@@ -154,7 +155,7 @@ avoid same set of footnote IDs being used multiple times."
     ("=" "<code>" "</code>")
     ("~" "<literal>" "</literal>")
     ("+" "<emphasis role=\"strikethrough\">" "</emphasis>"))
-  "Alist of DocBook expressions to convert emphasis fontifiers.
+  "A list of DocBook expressions to convert emphasis fontifiers.
 Each element of the list is a list of three elements.
 The first element is the character used as a marker for fontification.
 The second element is a formatting string to wrap fontified text with.
@@ -183,32 +184,39 @@ default, but users can override them using `#+ATTR_DocBook:'."
   :group 'org-export-docbook
   :type 'coding-system)
 
+(defcustom org-export-docbook-xslt-stylesheet nil
+  "File name of the XSLT stylesheet used by DocBook exporter.
+This XSLT stylesheet is used by
+`org-export-docbook-xslt-proc-command' to generate the Formatting
+Object (FO) files.  You can use either `fo/docbook.xsl' that
+comes with DocBook, or any customization layer you may have."
+  :group 'org-export-docbook
+  :type 'string)
+
 (defcustom org-export-docbook-xslt-proc-command nil
-  "XSLT processor command used by DocBook exporter.
-This is the command used to process a DocBook XML file to
-generate the formatting object (FO) file.
+  "Format of XSLT processor command used by DocBook exporter.
+This command is used to process a DocBook XML file to generate
+the Formatting Object (FO) file.
 
 The value of this variable should be a format control string that
-includes two `%s' arguments: the first one is for the output FO
-file name, and the second one is for the input DocBook XML file
-name.
+includes three arguments: `%i', `%o', and `%s'.  During exporting
+time, `%i' is replaced by the input DocBook XML file name, `%o'
+is replaced by the output FO file name, and `%s' is replaced by
+`org-export-docbook-xslt-stylesheet' (or the #+XSLT option if it
+is specified in the Org file).
 
 For example, if you use Saxon as the XSLT processor, you may want
 to set the variable to
 
-  \"java com.icl.saxon.StyleSheet -o %s %s /path/to/docbook.xsl\"
+  \"java com.icl.saxon.StyleSheet -o %o %i %s\"
 
 If you use Xalan, you can set it to
 
-  \"java org.apache.xalan.xslt.Process -out %s -in %s -xsl /path/to/docbook.xsl\"
+  \"java org.apache.xalan.xslt.Process -out %o -in %i -xsl %s\"
 
 For xsltproc, the following string should work:
 
-  \"xsltproc --output %s /path/to/docbook.xsl %s\"
-
-You need to replace \"/path/to/docbook.xsl\" with the actual path
-to the DocBook stylesheet file on your machine.  You can also
-replace it with your own customization layer if you have one.
+  \"xsltproc --output %o %s %i\"
 
 You can include additional stylesheet parameters in this command.
 Just make sure that they meet the syntax requirement of each
@@ -217,18 +225,19 @@ processor."
   :type 'string)
 
 (defcustom org-export-docbook-xsl-fo-proc-command nil
-  "XSL-FO processor command used by DocBook exporter.
-This is the command used to process a formatting object (FO) file
-to generate the PDF file.
+  "Format of XSL-FO processor command used by DocBook exporter.
+This command is used to process a Formatting Object (FO) file to
+generate the PDF file.
 
 The value of this variable should be a format control string that
-includes two `%s' arguments: the first one is for the input FO
-file name, and the second one is for the output PDF file name.
+includes two arguments: `%i' and `%o'.  During exporting time,
+`%i' is replaced by the input FO file name, and `%o' is replaced
+by the output PDF file name.
 
 For example, if you use FOP as the XSL-FO processor, you can set
 the variable to
 
-  \"fop %s %s\""
+  \"fop %i %o\""
   :group 'org-export-docbook
   :type 'string)
 
@@ -333,13 +342,18 @@ in a window.  A non-interactive call will only return the buffer."
   "Export as DocBook XML file, and generate PDF file."
   (interactive "P")
   (if (or (not org-export-docbook-xslt-proc-command)
-         (not (string-match "%s.+%s" org-export-docbook-xslt-proc-command)))
+         (not (string-match "%[ios].+%[ios].+%[ios]" org-export-docbook-xslt-proc-command)))
       (error "XSLT processor command is not set correctly"))
   (if (or (not org-export-docbook-xsl-fo-proc-command)
-         (not (string-match "%s.+%s" org-export-docbook-xsl-fo-proc-command)))
+         (not (string-match "%[io].+%[io]" org-export-docbook-xsl-fo-proc-command)))
       (error "XSL-FO processor command is not set correctly"))
   (message "Exporting to PDF...")
   (let* ((wconfig (current-window-configuration))
+        (opt-plist
+         (org-export-process-option-filters
+          (org-combine-plists (org-default-export-plist)
+                              ext-plist
+                              (org-infile-export-plist))))
         (docbook-buf (org-export-as-docbook hidden ext-plist
                                             to-buffer body-only pub-dir))
         (filename (buffer-file-name docbook-buf))
@@ -348,10 +362,17 @@ in a window.  A non-interactive call will only return the buffer."
         (pdffile (concat base ".pdf")))
     (and (file-exists-p pdffile) (delete-file pdffile))
     (message "Processing DocBook XML file...")
-    (shell-command (format org-export-docbook-xslt-proc-command
-                          fofile (shell-quote-argument filename)))
-    (shell-command (format org-export-docbook-xsl-fo-proc-command
-                          fofile pdffile))
+    (shell-command (format-spec org-export-docbook-xslt-proc-command
+                               (format-spec-make
+                                ?i (shell-quote-argument filename)
+                                ?o (shell-quote-argument fofile)
+                                ?s (shell-quote-argument
+                                    (or (plist-get opt-plist :xslt)
+                                        org-export-docbook-xslt-stylesheet)))))
+    (shell-command (format-spec org-export-docbook-xsl-fo-proc-command
+                               (format-spec-make
+                                ?i (shell-quote-argument fofile)
+                                ?o (shell-quote-argument pdffile))))
     (message "Processing DocBook file...done")
     (if (not (file-exists-p pdffile))
        (error "PDF file was not produced")
@@ -384,6 +405,8 @@ header and footer, simply return the content of the document (all
 top-level sections).  When PUB-DIR is set, use this as the
 publishing directory."
   (interactive "P")
+  (run-hooks 'org-export-first-hook)
+
   ;; Make sure we have a file name when we need it.
   (when (and (not (or to-buffer body-only))
             (not buffer-file-name))
@@ -531,7 +554,7 @@ publishing directory."
         table-buffer table-orig-buffer
         ind item-type starter didclose
         rpl path attr caption label desc descp desc1 desc2 link
-        fnc item-tag
+        fnc item-tag initial-number
         footref-seen footnote-list
         id-file
         )
@@ -609,7 +632,9 @@ publishing directory."
   </info>\n"
                 (org-docbook-expand title)
                 firstname othername surname
-                (if email (concat "<email>" email "</email>") "")
+                (if (and org-export-email-info
+                         email (string-match "\\S-" email))
+                    (concat "<email>" email "</email>") "")
                 )))
 
       (org-init-section-numbers)
@@ -622,7 +647,7 @@ publishing directory."
 
          ;; End of quote section?
          (when (and inquote (string-match "^\\*+ " line))
-           (insert "]]>\n</programlisting>\n")
+           (insert "]]></programlisting>\n")
            (org-export-docbook-open-para)
            (setq inquote nil))
          ;; Inside a quote section?
@@ -642,7 +667,7 @@ publishing directory."
                      (not (string-match "^[ \t]*\\(:.*\\)"
                                         (car lines))))
              (setq infixed nil)
-             (insert "]]>\n</programlisting>\n")
+             (insert "]]></programlisting>\n")
              (org-export-docbook-open-para))
            (throw 'nextline nil))
 
@@ -910,7 +935,8 @@ publishing directory."
            (while (string-match "\\([^* \t].*?\\)\\[\\([0-9]+\\)\\]" line start)
              (if (get-text-property (match-beginning 2) 'org-protected line)
                  (setq start (match-end 2))
-               (let ((num (match-string 2 line)))
+               (let* ((num (match-string 2 line))
+                      (footnote-def (assoc num footnote-list)))
                  (if (assoc num footref-seen)
                      (setq line (replace-match
                                  (format "%s<footnoteref linkend=\"%s%s\"/>"
@@ -922,9 +948,10 @@ publishing directory."
                                        (match-string 1 line)
                                        org-export-docbook-footnote-id-prefix
                                        num
-                                       (save-match-data
-                                         (org-docbook-expand
-                                          (cdr (assoc num footnote-list)))))
+                                       (if footnote-def
+                                           (save-match-data
+                                             (org-docbook-expand (cdr footnote-def)))
+                                         (format "FOOTNOTE DEFINITION NOT FOUND: %s" num)))
                                t t line))
                    (push (cons num 1) footref-seen))))))
 
@@ -992,7 +1019,11 @@ publishing directory."
                    starter (if (match-beginning 2)
                                (substring (match-string 2 line) 0 -1))
                    line (substring line (match-beginning 5))
-                   item-tag nil)
+                   item-tag nil
+                   initial-number nil)
+             (if (string-match "\\`\\[@start:\\([0-9]+\\)\\][ \t]?" line)
+                 (setq initial-number (match-string 1 line)
+                       line (replace-match "" t t line)))
              (if (and starter (string-match "\\(.*?\\) ::[ \t]*" line))
                  (setq item-type "d"
                        item-tag (match-string 1 line)
@@ -1025,7 +1056,18 @@ publishing directory."
                (org-export-docbook-close-para-maybe)
                (insert (cond
                         ((equal item-type "u") "<itemizedlist>\n<listitem>\n")
-                        ((equal item-type "o") "<orderedlist>\n<listitem>\n")
+                        ((equal item-type "o")
+                         ;; Check for a specific start number.  If it
+                         ;; is specified, we use the ``override''
+                         ;; attribute of element <listitem> to pass the
+                         ;; info to DocBook.  We could also use the
+                         ;; ``startingnumber'' attribute of element
+                         ;; <orderedlist>, but the former works on both
+                         ;; DocBook 5.0 and prior versions.
+                         (if initial-number
+                             (format "<orderedlist>\n<listitem override=\"%s\">\n"
+                                     initial-number)
+                           "<orderedlist>\n<listitem>\n"))
                         ((equal item-type "d")
                          (format "<variablelist>\n<varlistentry><term>%s</term><listitem>\n" item-tag))))
                ;; For DocBook, we need to open a para right after tag
@@ -1090,7 +1132,7 @@ publishing directory."
 
       ;; Properly close all local lists and other lists
       (when inquote
-       (insert "]]>\n</programlisting>\n")
+       (insert "]]></programlisting>\n")
        (org-export-docbook-open-para))
       (when in-local-list
        ;; Close any local lists before inserting a new header line
@@ -1119,6 +1161,13 @@ publishing directory."
              "[ \r\n\t]*\\(<para>\\)[ \r\n\t]*</para>[ \r\n\t]*" nil t)
        (when (not (get-text-property (match-beginning 1) 'org-protected))
          (replace-match "\n")
+         ;; Avoid empty <listitem></listitem> caused by inline tasks.
+         ;; We should add an empty para to make everything valid.
+         (when (and (looking-at "</listitem>")
+                    (save-excursion
+                      (backward-char (length "<listitem>\n"))
+                      (looking-at "<listitem>")))
+           (insert "<para></para>"))
          (backward-char 1)))
       ;; Fill empty sections with <para></para>.  This is to make sure
       ;; that the DocBook document generated is valid and well-formed.
@@ -1215,7 +1264,8 @@ When TITLE is nil, just close all open levels."
       (setq section-number (org-section-number level))
       (insert (format "\n<section xml:id=\"%s%s\">\n<title>%s</title>"
                      org-export-docbook-section-id-prefix
-                     section-number title))
+                     (replace-regexp-in-string "\\." "_" section-number)
+                     title))
       (org-export-docbook-open-para))))
 
 (defun org-docbook-expand (string)
@@ -1246,16 +1296,14 @@ string, don't modify these."
   (if org-export-with-sub-superscripts
       (setq s (org-export-docbook-convert-sub-super s)))
   (if org-export-with-TeX-macros
-      (let ((start 0) wd ass)
+      (let ((start 0) wd rep)
        (while (setq start (string-match "\\\\\\([a-zA-Z]+\\)\\({}\\)?"
                                         s start))
          (if (get-text-property (match-beginning 0) 'org-protected s)
              (setq start (match-end 0))
            (setq wd (match-string 1 s))
-           (if (setq ass (assoc wd org-html-entities))
-               (setq s (replace-match (or (cdr ass)
-                                          (concat "&" (car ass) ";"))
-                                      t t s))
+           (if (setq rep (org-entity-get-representation wd 'html))
+               (setq s (replace-match rep t t s))
              (setq start (+ start (length wd))))))))
   s)
 
@@ -1312,6 +1360,7 @@ string, don't modify these."
           (label (org-find-text-property-in-string 'org-label src))
           (default-attr org-export-docbook-default-image-attributes)
           tmp)
+      (setq caption (and caption (org-html-do-expand caption)))
       (while (setq tmp (pop default-attr))
        (if (not (string-match (concat (car tmp) "=") attr))
            (setq attr (concat attr " " (car tmp) "=" (cdr tmp)))))
@@ -1337,18 +1386,33 @@ string, don't modify these."
        (replace-match ""))))
 
 (defun org-export-docbook-finalize-table (table)
-  "Change TABLE to informaltable if caption does not exist.
+  "Clean up TABLE and turn it into DocBook format.
+This function adds a label to the table if it is available, and
+also changes TABLE to informaltable if caption does not exist.
 TABLE is a string containing the HTML code generated by
 `org-format-table-html' for a table in Org-mode buffer."
-  (if (string-match
-       "^<table \\(\\(.\\|\n\\)+\\)<caption></caption>\n\\(\\(.\\|\n\\)+\\)</table>"
-       table)
-      (replace-match (concat "<informaltable "
-                            (match-string 1 table)
-                            (match-string 3 table)
-                            "</informaltable>")
-                    nil nil table)
-    table))
+  (let (table-with-label)
+    ;; Get the label if it exists, and move it into the <table> element.
+    (setq table-with-label
+         (if (string-match
+              "^<table \\(\\(.\\|\n\\)+\\)<a name=\"\\(.+\\)\" id=\".+\"></a>\n\\(\\(.\\|\n\\)+\\)</table>"
+              table)
+             (replace-match (concat "<table xml:id=\"" (match-string 3 table) "\" "
+                                    (match-string 1 table)
+                                    (match-string 4 table)
+                                    "</table>")
+                            nil nil table)
+           table))
+    ;; Change <table> into <informaltable> if caption does not exist.
+    (if (string-match
+        "^<table \\(\\(.\\|\n\\)+\\)<caption></caption>\n\\(\\(.\\|\n\\)+\\)</table>"
+        table-with-label)
+       (replace-match (concat "<informaltable "
+                              (match-string 1 table-with-label)
+                              (match-string 3 table-with-label)
+                              "</informaltable>")
+                      nil nil table-with-label)
+      table-with-label)))
 
 ;; Note: This function is very similar to
 ;; org-export-html-convert-sub-super.  They can be merged in the future.
diff --git a/lisp/org/org-docview.el b/lisp/org/org-docview.el
new file mode 100644 (file)
index 0000000..0ef5df0
--- /dev/null
@@ -0,0 +1,90 @@
+;;; org-docview.el --- support for links to doc-view-mode buffers
+
+;; Copyright (C) 2009, 2010  Free Software Foundation, Inc.
+
+;; Author: Jan Böcker <jan.boecker at jboecker dot de>
+;; Keywords: outlines, hypermedia, calendar, wp
+;; Homepage: http://orgmode.org
+;; Version: 7.01
+;;
+;; 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:
+
+;; This file implements links to open files in doc-view-mode.
+;; Org-mode loads this module by default - if this is not what you want,
+;; configure the variable `org-modules'.
+
+;; The links take the form
+;;
+;;    docview:<file path>::<page number>
+;;
+;; for example: [[docview:~/.elisp/org/doc/org.pdf::1][Org-Mode Manual]]
+;;
+;; Autocompletion for inserting links is supported; you will be
+;; prompted for a file and a page number.
+;;
+;; If you use org-store-link in a doc-view mode buffer, the stored
+;; link will point to the current page.
+
+;;; Code:
+
+
+(require 'org)
+(eval-when-compile (require 'doc-view))        ; doc-view-current-page macro
+
+(autoload 'doc-view-goto-page "doc-view")
+
+(org-add-link-type "docview" 'org-docview-open)
+(add-hook 'org-store-link-functions 'org-docview-store-link)
+
+(defun org-docview-open (link)
+  (when (string-match "\\(.*\\)::\\([0-9]+\\)$"  link)
+    (let* ((path (match-string 1 link))
+          (page (string-to-number (match-string 2 link))))
+      (org-open-file path 1) ;; let org-mode open the file (in-emacs = 1)
+      ;; to ensure org-link-frame-setup is respected
+      (doc-view-goto-page page)
+      )))
+
+(defun org-docview-store-link ()
+  "Store a link to a docview buffer."
+  (when (eq major-mode 'doc-view-mode)
+    ;; This buffer is in doc-view-mode
+    (let* ((path buffer-file-name)
+          (page (doc-view-current-page))
+          (link (concat "docview:" path "::" (number-to-string page)))
+          (description ""))
+      (org-store-link-props
+       :type "docview"
+       :link link
+       :description path))))
+
+(defun org-docview-complete-link ()
+  "Use the existing file name completion for file.
+Links to get the file name, then ask the user for the page number
+and append it."
+  (concat (replace-regexp-in-string "^file:" "docview:" (org-file-complete-link))
+         "::"
+         (read-from-minibuffer "Page:" "1")))
+
+
+(provide 'org-docview)
+
+;; arch-tag: dd147a78-cce1-481b-b40a-15869417debe
+
+;;; org-docview.el ends here
diff --git a/lisp/org/org-entities.el b/lisp/org/org-entities.el
new file mode 100644 (file)
index 0000000..70c88af
--- /dev/null
@@ -0,0 +1,573 @@
+;;; org-entities.el --- Support for special entities in Org-mode
+
+;; Copyright (C) 2010 Free Software Foundation, Inc.
+
+;; Author: Carsten Dominik <carsten at orgmode dot org>,
+;;         Ulf Stegemann <ulf at zeitform dot de>
+;; Keywords: outlines, calendar, wp
+;; Homepage: http://orgmode.org
+;; Version: 7.01
+;;
+;; 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 'org-macs)
+
+(declare-function org-table-align "org-table" ())
+
+(eval-when-compile
+  (require 'cl))
+
+(defgroup org-entities nil
+  "Options concerning entities in Org-mode."
+  :tag "Org Entities"
+  :group 'org)
+
+(defcustom org-entities-ascii-explanatory nil
+  "Non-nil means replace special entities in ASCII.
+For example, this will replace \"\\nsup\" with \"[not a superset of]\"
+in backends where the corresponding character is not available."
+  :group 'org-entities
+  :type 'boolean)
+
+(defcustom org-entities-user nil
+  "User-defined entities used in Org-mode to produce special characters.
+Each entry in this list is a list of strings.  It associates the name
+of the entity that can be inserted into an Org file as \\name with the
+appropriate replacements for the different export backends.  The order
+of the fields is the following
+
+name                 As a string, without the leading backslash
+LaTeX replacement    In ready LaTeX, no further processing will take place
+LaTeX mathp          A Boolean, either t or nil.  t if this entity needs
+                     to be in math mode.
+HTML replacement     In ready HTML, no further processing will take place.
+                     Usually this will be an &...; entity.
+ASCII replacement    Plain ASCII, no extensions.  Symbols that cannot be
+                     represented will be left as they are, but see the.
+                     variable `org-entities-ascii-explanatory'.
+Latin1 replacement   Use the special characters available in latin1.
+utf-8 replacement    Use the special characters available in utf-8.
+
+If you define new entities here that require specific LaTeX packages to be
+loaded, add these packages to `org-export-latex-packages-alist'."
+  :group 'org-entities
+  :type '(repeat
+         (list
+          (string :tag "name  ")
+          (string :tag "LaTeX ")
+          (boolean :tag "Require LaTeX math?")
+          (string :tag "HTML  ")
+          (string :tag "ASCII ")
+          (string :tag "Latin1")
+          (string :tag "utf-8 "))))
+
+(defconst org-entities
+  '(
+    "* Letters"
+    "** Latin"
+    ("Agrave" "\\`{A}" nil "&Agrave;" "A" "À" "À")
+    ("agrave" "\\`{a}" nil "&agrave;" "a" "à" "à")
+    ("Aacute" "\\'{A}" nil "&Aacute;" "A" "Á" "Á")
+    ("aacute" "\\'{a}" nil "&aacute;" "a" "á" "á")
+    ("Acirc" "\\^{A}" nil "&Acirc;" "A" "Â" "Â")
+    ("acirc" "\\^{a}" nil "&acirc;" "a" "â" "â")
+    ("Atilde" "\\~{A}" nil "&Atilde;" "A" "Ã" "Ã")
+    ("atilde" "\\~{a}" nil "&atilde;" "a" "ã" "ã")
+    ("Auml" "\\\"{A}" nil "&Auml;" "Ae" "Ä" "Ä")
+    ("auml" "\\\"{a}" nil "&auml;" "ae" "ä" "ä")
+    ("Aring" "\\AA{}" nil "&Aring;" "A" "Å" "Å")
+    ("AA" "\\AA{}" nil "&Aring;" "A" "Å" "Å")
+    ("aring" "\\aa{}" nil "&aring;" "a" "å" "å")
+    ("AElig" "\\AE{}" nil "&AElig;" "AE" "Æ" "Æ")
+    ("aelig" "\\ae{}" nil "&aelig;" "ae" "æ" "æ")
+    ("Ccedil" "\\c{C}" nil "&Ccedil;" "C" "Ç" "Ç")
+    ("ccedil" "\\c{c}" nil "&ccedil;" "c" "ç" "ç")
+    ("Egrave" "\\`{E}" nil "&Egrave;" "E" "È" "È")
+    ("egrave" "\\`{e}" nil "&egrave;" "e" "è" "è")
+    ("Eacute" "\\'{E}" nil "&Eacute;" "E" "É" "É")
+    ("eacute" "\\'{e}" nil "&eacute;" "e" "é" "é")
+    ("Ecirc" "\\^{E}" nil "&Ecirc;" "E" "Ê" "Ê")
+    ("ecirc" "\\^{e}" nil "&ecirc;" "e" "ê" "ê")
+    ("Euml" "\\\"{E}" nil "&Euml;" "E" "Ë" "Ë")
+    ("euml" "\\\"{e}" nil "&euml;" "e" "ë" "ë")
+    ("Igrave" "\\`{I}" nil "&Igrave;" "I" "Ì" "Ì")
+    ("igrave" "\\`{i}" nil "&igrave;" "i" "ì" "ì")
+    ("Iacute" "\\'{I}" nil "&Iacute;" "I" "Í" "Í")
+    ("iacute" "\\'{i}" nil "&iacute;" "i" "í" "í")
+    ("Icirc" "\\^{I}" nil "&Icirc;" "I" "Î" "Î")
+    ("icirc" "\\^{i}" nil "&icirc;" "i" "î" "î")
+    ("Iuml" "\\\"{I}" nil "&Iuml;" "I" "Ï" "Ï")
+    ("iuml" "\\\"{i}" nil "&iuml;" "i" "ï" "ï")
+    ("Ntilde" "\\~{N}" nil "&Ntilde;" "N" "Ñ" "Ñ")
+    ("ntilde" "\\~{n}" nil "&ntilde;" "n" "ñ" "ñ")
+    ("Ograve" "\\`{O}" nil "&Ograve;" "O" "Ò" "Ò")
+    ("ograve" "\\`{o}" nil "&ograve;" "o" "ò" "ò")
+    ("Oacute" "\\'{O}" nil "&Oacute;" "O" "Ó" "Ó")
+    ("oacute" "\\'{o}" nil "&oacute;" "o" "ó" "ó")
+    ("Ocirc" "\\^{O}" nil "&Ocirc;" "O" "Ô" "Ô")
+    ("ocirc" "\\^{o}" nil "&ocirc;" "o" "ô" "ô")
+    ("Otilde" "\\~{O}" nil "&Otilde;" "O" "Õ" "Õ")
+    ("otilde" "\\~{o}" nil "&otilde;" "o" "õ" "õ")
+    ("Ouml" "\\\"{O}" nil "&Ouml;" "Oe" "Ö" "Ö")
+    ("ouml" "\\\"{o}" nil "&ouml;" "oe" "ö" "ö")
+    ("Oslash" "\\O" nil "&Oslash;" "O" "Ø" "Ø")
+    ("oslash" "\\o{}" nil "&oslash;" "o" "ø" "ø")
+    ("OElig" "\\OE{}" nil "&OElig;" "OE" "OE" "Œ")
+    ("oelig" "\\oe{}" nil "&oelig;" "oe" "oe" "œ")
+    ("Scaron" "\\v{S}" nil "&Scaron;" "S" "S" "Š")
+    ("scaron" "\\v{s}" nil "&scaron;" "s" "s" "š")
+    ("szlig" "\\ss{}" nil "&szlig;" "ss" "ß" "ß")
+    ("Ugrave" "\\`{U}" nil "&Ugrave;" "U" "Ù" "Ù")
+    ("ugrave" "\\`{u}" nil "&ugrave;" "u" "ù" "ù")
+    ("Uacute" "\\'{U}" nil "&Uacute;" "U" "Ú" "Ú")
+    ("uacute" "\\'{u}" nil "&uacute;" "u" "ú" "ú")
+    ("Ucirc" "\\^{U}" nil "&Ucirc;" "U" "Û" "Û")
+    ("ucirc" "\\^{u}" nil "&ucirc;" "u" "û" "û")
+    ("Uuml" "\\\"{U}" nil "&Uuml;" "Ue" "Ü" "Ü")
+    ("uuml" "\\\"{u}" nil "&uuml;" "ue" "ü" "ü")
+    ("Yacute" "\\'{Y}" nil "&Yacute;" "Y" "Ý" "Ý")
+    ("yacute" "\\'{y}" nil "&yacute;" "y" "ý" "ý")
+    ("Yuml" "\\\"{Y}" nil "&Yuml;" "Y" "Y" "Ÿ")
+    ("yuml" "\\\"{y}" nil "&yuml;" "y" "ÿ" "ÿ")
+
+    "** Latin (special face)"
+    ("fnof" "\\textit{f}" nil "&fnof;" "f" "f" "ƒ")
+    ("real" "\\Re" t "&real;" "R" "R" "ℜ")
+    ("image" "\\Im" t "&image;" "I" "I" "ℑ")
+    ("weierp" "\\wp" t "&weierp;" "P" "P" "℘")
+
+    "** Greek"
+    ("Alpha" "A" nil "&Alpha;" "Alpha" "Alpha" "Α")
+    ("alpha" "\\alpha" t "&alpha;" "alpha" "alpha" "α")
+    ("Beta" "B" nil "&Beta;" "Beta" "Beta" "Β")
+    ("beta" "\\beta" t "&beta;" "beta" "beta" "β")
+    ("Gamma" "\\Gamma" t "&Gamma;" "Gamma" "Gamma" "Γ")
+    ("gamma" "\\gamma" t "&gamma;" "gamma" "gamma" "γ")
+    ("Delta" "\\Delta" t "&Delta;" "Delta" "Gamma" "Δ")
+    ("delta" "\\delta" t "&delta;" "delta" "delta" "δ")
+    ("Epsilon" "E" nil "&Epsilon;" "Epsilon" "Epsilon" "Ε")
+    ("epsilon" "\\epsilon" t "&epsilon;" "epsilon" "epsilon" "ε")
+    ("varepsilon" "\\varepsilon" t "&epsilon;" "varepsilon" "varepsilon" "ε")
+    ("Zeta" "Z" nil "&Zeta;" "Zeta" "Zeta" "Ζ")
+    ("zeta" "\\zeta" t "&zeta;" "zeta" "zeta" "ζ")
+    ("Eta" "H" nil "&Eta;" "Eta" "Eta" "Η")
+    ("eta" "\\eta" t "&eta;" "eta" "eta" "η")
+    ("Theta" "\\Theta" t "&Theta;" "Theta" "Theta" "Θ")
+    ("theta" "\\theta" t "&theta;" "theta" "theta" "θ")
+    ("thetasym" "\\vartheta" t "&thetasym;" "theta" "theta" "ϑ")
+    ("vartheta" "\\vartheta" t "&thetasym;" "theta" "theta" "ϑ")
+    ("Iota" "I" nil "&Iota;" "Iota" "Iota" "Ι")
+    ("iota" "\\iota" t "&iota;" "iota" "iota" "ι")
+    ("Kappa" "K" nil "&Kappa;" "Kappa" "Kappa" "Κ")
+    ("kappa" "\\kappa" t "&kappa;" "kappa" "kappa" "κ")
+    ("Lambda" "\\Lambda" t "&Lambda;" "Lambda" "Lambda" "Λ")
+    ("lambda" "\\lambda" t "&lambda;" "lambda" "lambda" "λ")
+    ("Mu" "M" nil "&Mu;" "Mu" "Mu" "Μ")
+    ("mu" "\\mu" t "&mu;" "mu" "mu" "μ")
+    ("nu" "\\nu" t "&nu;" "nu" "nu" "ν")
+    ("Nu" "N" nil "&Nu;" "Nu" "Nu" "Ν")
+    ("Xi" "\\Xi" t "&Xi;" "Xi" "Xi" "Ξ")
+    ("xi" "\\xi" t "&xi;" "xi" "xi" "ξ")
+    ("Omicron" "O" nil "&Omicron;" "Omicron" "Omicron" "Ο")
+    ("omicron" "\\textit{o}" nil "&omicron;" "omicron" "omicron" "ο")
+    ("Pi" "\\Pi" t "&Pi;" "Pi" "Pi" "Π")
+    ("pi" "\\pi" t "&pi;" "pi" "pi" "π")
+    ("Rho" "P" nil "&Rho;" "Rho" "Rho" "Ρ")
+    ("rho" "\\rho" t "&rho;" "rho" "rho" "ρ")
+    ("Sigma" "\\Sigma" t "&Sigma;" "Sigma" "Sigma" "Σ")
+    ("sigma" "\\sigma" t "&sigma;" "sigma" "sigma" "σ")
+    ("sigmaf" "\\varsigma" t "&sigmaf;" "sigmaf" "sigmaf" "ς")
+    ("varsigma" "\\varsigma" t "&sigmaf;" "varsigma" "varsigma" "ς")
+    ("Tau" "T" nil "&Tau;" "Tau" "Tau" "Τ")
+    ("Upsilon" "\\Upsilon" t "&Upsilon;" "Upsilon" "Upsilon" "Υ")
+    ("upsih" "\\Upsilon" t "&upsih;" "upsilon" "upsilon" "ϒ")
+    ("upsilon" "\\upsilon" t "&upsilon;" "upsilon" "upsilon" "υ")
+    ("Phi" "\\Phi" t "&Phi;" "Phi" "Phi" "Φ")
+    ("phi" "\\phi" t "&phi;" "phi" "phi" "φ")
+    ("Chi" "X" nil "&Chi;" "Chi" "Chi" "Χ")
+    ("chi" "\\chi" t "&chi;" "chi" "chi" "χ")
+    ("acutex" "\\acute x" t "&acute;x" "'x" "'x" "𝑥́")
+    ("Psi" "\\Psi" t "&Psi;" "Psi" "Psi" "Ψ")
+    ("psi" "\\psi" t "&psi;" "psi" "psi" "ψ")
+    ("tau" "\\tau" t "&tau;" "tau" "tau" "τ")
+    ("Omega" "\\Omega" t "&Omega;" "Omega" "Omega" "Ω")
+    ("omega" "\\omega" t "&omega;" "omega" "omega" "ω")
+    ("piv" "\\varpi" t "&piv;" "omega-pi" "omega-pi" "ϖ")
+    ("partial" "\\partial" t "&part;" "[partial differential]" "[partial differential]" "∂")
+
+    "** Hebrew"
+    ("alefsym" "\\aleph" t "&alefsym;" "aleph" "aleph" "ℵ")
+
+    "** Dead languages"
+    ("ETH" "\\DH{}" nil "&ETH;" "D" "Ð" "Ð")
+    ("eth" "\\dh{}" nil "&eth;" "dh" "ð" "ð")
+    ("THORN" "\\TH{}" nil "&THORN;" "TH" "Þ" "Þ")
+    ("thorn" "\\th{}" nil "&thorn;" "th" "þ" "þ")
+
+    "* Punctuation"
+    "** Dots and Marks"
+    ("dots" "\\dots{}" nil "&hellip;" "..." "..." "…")
+    ("hellip" "\\dots{}" nil "&hellip;" "..." "..." "…")
+    ("middot" "\\textperiodcentered{}" nil "&middot;" "." "·" "·")
+    ("iexcl" "!`" nil "&iexcl;" "!" "¡" "¡")
+    ("iquest" "?`" nil "&iquest;" "?" "¿" "¿")
+
+    "** Dash-like"
+    ("shy" "\\-" nil "&shy;" "" "" "")
+    ("ndash" "--" nil "&ndash;" "-" "-" "–")
+    ("mdash" "---" nil "&mdash;" "--" "--" "—")
+
+    "** Quotations"
+    ("quot" "\\textquotedbl{}" nil "&quot;" "\"" "\"" "\"")
+    ("acute" "\\textasciiacute{}" nil "&acute;" "'" "´" "´")
+    ("ldquo" "\\textquotedblleft{}" nil "&ldquo;" "\"" "\"" "“")
+    ("rdquo" "\\textquotedblright{}" nil "&rdquo;" "\"" "\"" "”")
+    ("bdquo" "\\quotedblbase{}" nil "&bdquo;" "\"" "\"" "„")
+    ("lsquo" "\\textquoteleft{}" nil "&lsquo;" "`" "`" "‘")
+    ("rsquo" "\\textquoteright{}" nil "&rsquo;" "'" "'" "’")
+    ("sbquo" "\\quotesinglbase{}" nil "&sbquo;" "," "," "‚")
+    ("laquo" "\\guillemotleft{}" nil "&laquo;" "<<" "«" "«")
+    ("raquo" "\\guillemotright{}" nil "&raquo;" ">>" "»" "»")
+    ("lsaquo" "\\guilsinglleft{}" nil "&lsaquo;" "<" "<" "‹")
+    ("rsaquo" "\\guilsinglright{}" nil "&rsaquo;" ">" ">" "›")
+
+    "* Other"
+    "** Misc. (often used)"
+    ("circ" "\\circ" t "&circ;" "^" "^" "ˆ")
+    ("vert" "\\vert{}" t "&#124;" "|" "|" "|")
+    ("brvbar" "\\textbrokenbar{}" nil "&brvbar;" "|" "¦" "¦")
+    ("sect" "\\S" nil "&sect;" "paragraph" "§" "§")
+    ("amp" "\\&" nil "&amp;" "&" "&" "&")
+    ("lt" "\\textless{}" nil "&lt;" "<" "<" "<")
+    ("gt" "\\textgreater{}" nil "&gt;" ">" ">" ">")
+    ("tilde" "\\~{}" nil "&tilde;" "~" "~" "~")
+    ("dagger" "\\textdagger{}" nil "&dagger;" "[dagger]" "[dagger]" "†")
+    ("Dagger" "\\textdaggerdbl{}" nil "&Dagger;" "[doubledagger]" "[doubledagger]" "‡")
+
+    "** Whitespace"
+    ("nbsp" "~" nil "&nbsp;" " " " " " ")
+    ("ensp" "\\hspace*{.5em}" nil "&ensp;" " " " " " ")
+    ("emsp" "\\hspace*{1em}" nil "&emsp;" " " " " " ")
+    ("thinsp" "\\hspace*{.2em}" nil "&thinsp;" " " " " " ")
+
+    "** Currency"
+    ("curren" "\\textcurrency{}" nil "&curren;" "curr." "¤" "¤")
+    ("cent" "\\textcent{}" nil "&cent;" "cent" "¢" "¢")
+    ("pound" "\\pounds{}" nil "&pound;" "pound" "£" "£")
+    ("yen" "\\textyen{}" nil "&yen;" "yen" "¥" "¥")
+    ("euro" "\\texteuro{}" nil "&euro;" "EUR" "EUR" "€")
+    ("EUR" "\\EUR{}" nil "&euro;" "EUR" "EUR" "€")
+    ("EURdig" "\\EURdig{}" nil "&euro;" "EUR" "EUR" "€")
+    ("EURhv" "\\EURhv{}" nil "&euro;" "EUR" "EUR" "€")
+    ("EURcr" "\\EURcr{}" nil "&euro;" "EUR" "EUR" "€")
+    ("EURtm" "\\EURtm{}" nil "&euro;" "EUR" "EUR" "€")
+
+    "** Property Marks"
+    ("copy" "\\textcopyright{}" nil "&copy;" "(c)" "©" "©")
+    ("reg" "\\textregistered{}" nil "&reg;" "(r)" "®" "®")
+    ("trade" "\\texttrademark{}" nil "&trade;" "TM" "TM" "™")
+
+    "** Science et al."
+    ("minus" "\\minus" t "&minus;" "-" "-" "−")
+    ("pm" "\\textpm{}" nil "&plusmn;" "+-" "±" "±")
+    ("plusmn" "\\textpm{}" nil "&plusmn;" "+-" "±" "±")
+    ("times" "\\texttimes{}" nil "&times;" "*" "×" "×")
+    ("frasl" "/" nil "&frasl;" "/" "/" "⁄")
+    ("div" "\\textdiv{}" nil "&divide;" "/" "÷" "÷")
+    ("frac12" "\\textonehalf{}" nil "&frac12;" "1/2" "½" "½")
+    ("frac14" "\\textonequarter{}" nil "&frac14;" "1/4" "¼" "¼")
+    ("frac34" "\\textthreequarters{}" nil "&frac34;" "3/4" "¾" "¾")
+    ("permil" "\\textperthousand{}" nil "&permil;" "per thousand" "per thousand" "‰")
+    ("sup1" "\\textonesuperior{}" nil "&sup1;" "^1" "¹" "¹")
+    ("sup2" "\\texttwosuperior{}" nil "&sup2;" "^2" "²" "²")
+    ("sup3" "\\textthreesuperior{}" nil "&sup3;" "^3" "³" "³")
+    ("radic" "\\sqrt{\\,}" t "&radic;" "[square root]" "[square root]" "√")
+    ("sum" "\\sum" t "&sum;" "[sum]" "[sum]" "∑")
+    ("prod" "\\prod" t "&prod;" "[product]" "[n-ary product]" "∏")
+    ("micro" "\\textmu{}" nil "&micro;" "micro" "µ" "µ")
+    ("macr" "\\textasciimacron{}" nil "&macr;" "[macron]" "¯" "¯")
+    ("deg" "\\textdegree{}" nil "deg" "degree" "°" "°")
+    ("prime" "\\prime" t "&prime;" "'" "'" "′")
+    ("Prime" "\\prime{}\\prime" t "&Prime;" "''" "''" "″")
+    ("infin" "\\propto" t "&infin;" "[infinity]" "[infinity]" "∞")
+    ("infty" "\\infty" t "&infin;" "[infinity]" "[infinity]" "∞")
+    ("prop" "\\propto" t "&prop;" "[proportional to]" "[proportional to]" "∝")
+    ("proptp" "\\propto" t "&prop;" "[proportional to]" "[proportional to]" "∝")
+    ("not" "\\textlnot{}" nil "&not;" "[angled dash]" "¬" "¬")
+    ("land" "\\land" t "&and;" "[logical and]" "[logical and]" "∧")
+    ("wedge" "\\wedge" t "&and;" "[logical and]" "[logical and]" "∧")
+    ("lor" "\\lor" t "&or;" "[logical or]" "[logical or]" "∨")
+    ("vee" "\\vee" t "&or;" "[logical or]" "[logical or]" "∨")
+    ("cap" "\\cap" t "&cap;" "[intersection]" "[intersection]" "∩")
+    ("cup" "\\cup" t "&cup;" "[union]" "[union]" "∪")
+    ("int" "\\int" t "&int;" "[integral]" "[integral]" "∫")
+    ("there4" "\\therefore" t "&there4;" "[therefore]" "[therefore]" "∴")
+    ("sim" "\\sim" t "&sim;" "~" "~" "∼")
+    ("cong" "\\cong" t "&cong;" "[approx. equal to]" "[approx. equal to]" "≅")
+    ("simeq" "\\simeq" t "&cong;"  "[approx. equal to]" "[approx. equal to]" "≅")
+    ("asymp" "\\asymp" t "&asymp;" "[almost equal to]" "[almost equal to]" "≈")
+    ("approx" "\\approx" t "&asymp;" "[almost equal to]" "[almost equal to]" "≈")
+    ("ne" "\\ne" t "&ne;" "[not equal to]" "[not equal to]" "≠")
+    ("neq" "\\neq" t "&ne;" "[not equal to]" "[not equal to]" "≠")
+    ("equiv" "\\equiv" t "&equiv;" "[identical to]" "[identical to]" "≡")
+    ("le" "\\le" t "&le;" "<=" "<=" "≤")
+    ("ge" "\\ge" t "&ge;" ">=" ">=" "≥")
+    ("sub" "\\subset" t "&sub;" "[subset of]" "[subset of]" "⊂")
+    ("subset" "\\subset" t "&sub;" "[subset of]" "[subset of]" "⊂")
+    ("sup" "\\supset" t "&sup;" "[superset of]" "[superset of]" "⊃")
+    ("supset" "\\supset" t "&sup;" "[superset of]" "[superset of]" "⊃")
+    ("nsub" "\\not\\subset" t "&nsub;" "[not a subset of]" "[not a subset of" "⊄")
+    ("sube" "\\subseteq" t "&sube;" "[subset of or equal to]" "[subset of or equal to]" "⊆")
+    ("nsup" "\\not\\supset" t "&nsup;" "[not a superset of]" "[not a superset of]" "⊅")
+    ("supe" "\\supseteq" t "&supe;" "[superset of or equal to]" "[superset of or equal to]" "⊇")
+    ("forall" "\\forall" t "&forall;" "[for all]" "[for all]" "∀")
+    ("exist" "\\exists" t "&exist;" "[there exists]" "[there exists]" "∃")
+    ("exists" "\\exists" t "&exist;" "[there exists]" "[there exists]" "∃")
+    ("empty" "\\empty" t "&empty;" "[empty set]" "[empty set]" "∅")
+    ("emptyset" "\\emptyset" t "&empty;" "[empty set]" "[empty set]" "∅")
+    ("isin" "\\in" t "&isin;" "[element of]" "[element of]" "∈")
+    ("in" "\\in" t "&isin;" "[element of]" "[element of]" "∈")
+    ("notin" "\\notin" t "&notin;" "[not an element of]" "[not an element of]" "∉")
+    ("ni" "\\ni" t "&ni;" "[contains as member]" "[contains as member]" "∋")
+    ("nabla" "\\nabla" t "&nabla;" "[nabla]" "[nabla]" "∇")
+    ("ang" "\\angle" t "&ang;" "[angle]" "[angle]" "∠")
+    ("angle" "\\angle" t "&ang;" "[angle]" "[angle]" "∠")
+    ("perp" "\\perp" t "&perp;" "[up tack]" "[up tack]" "⊥")
+    ("sdot" "\\cdot" t "&sdot;" "[dot]" "[dot]" "⋅")
+    ("cdot" "\\cdot" t "&sdot;" "[dot]" "[dot]" "⋅")
+    ("lceil" "\\lceil" t "&lceil;" "[left ceiling]" "[left ceiling]" "⌈")
+    ("rceil" "\\rceil" t "&rceil;" "[right ceiling]" "[right ceiling]" "⌉")
+    ("lfloor" "\\lfloor" t "&lfloor;" "[left floor]" "[left floor]" "⌊")
+    ("rfloor" "\\rfloor" t "&rfloor;" "[right floor]" "[right floor]" "⌋")
+    ("lang" "\\langle" t "&lang;" "<" "<" "⟨")
+    ("rang" "\\rangle" t "&rang;" ">" ">" "⟩")
+
+    "** Arrows"
+    ("larr" "\\leftarrow" t "&larr;" "<-" "<-" "←")
+    ("leftarrow" "\\leftarrow" t "&larr;"  "<-" "<-" "←")
+    ("gets" "\\gets" t "&larr;"  "<-" "<-" "←")
+    ("lArr" "\\Leftarrow" t "&lArr;" "<=" "<=" "⇐")
+    ("Leftarrow" "\\Leftarrow" t "&lArr;" "<=" "<=" "⇐")
+    ("uarr" "\\uparrow" t "&uarr;" "[uparrow]" "[uparrow]" "↑")
+    ("uparrow" "\\uparrow" t "&uarr;" "[uparrow]" "[uparrow]" "↑")
+    ("uArr" "\\Uparrow" t "&uArr;" "[dbluparrow]" "[dbluparrow]" "⇑")
+    ("Uparrow" "\\Uparrow" t "&uArr;" "[dbluparrow]" "[dbluparrow]" "⇑")
+    ("rarr" "\\rightarrow" t "&rarr;" "->" "->" "→")
+    ("to" "\\to" t "&rarr;" "->" "->" "→")
+    ("rightarrow" "\\rightarrow" t "&rarr;"  "->" "->" "→")
+    ("rArr" "\\Rightarrow" t "&rArr;" "=>" "=>" "⇒")
+    ("Rightarrow" "\\Rightarrow" t "&rArr;" "=>" "=>" "⇒")
+    ("darr" "\\downarrow" t "&darr;" "[downarrow]" "[downarrow]" "↓")
+    ("downarrow" "\\downarrow" t "&darr;" "[downarrow]" "[downarrow]" "↓")
+    ("dArr" "\\Downarrow" t "&dArr;" "[dbldownarrow]" "[dbldownarrow]" "⇓")
+    ("Downarrow" "\\Downarrow" t "&dArr;" "[dbldownarrow]" "[dbldownarrow]" "⇓")
+    ("harr" "\\leftrightarrow" t "&harr;" "<->" "<->" "↔")
+    ("leftrightarrow" "\\leftrightarrow" t "&harr;"  "<->" "<->" "↔")
+    ("hArr" "\\Leftrightarrow" t "&hArr;" "<=>" "<=>" "⇔")
+    ("Leftrightarrow" "\\Leftrightarrow" t "&hArr;" "<=>" "<=>" "⇔")
+    ("crarr" "\\hookleftarrow" t "&crarr;" "<-'" "<-'" "↵")
+    ("hookleftarrow" "\\hookleftarrow" t "&crarr;"  "<-'" "<-'" "↵")
+
+    "** Function names"
+    ("arccos" "\\arccos" t "arccos" "arccos" "arccos" "arccos")
+    ("arcsin" "\\arcsin" t "arcsin" "arcsin" "arcsin" "arcsin")
+    ("arctan" "\\arctan" t "arctan" "arctan" "arctan" "arctan")
+    ("arg" "\\arg" t "arg" "arg" "arg" "arg")
+    ("cos" "\\cos" t "cos" "cos" "cos" "cos")
+    ("cosh" "\\cosh" t "cosh" "cosh" "cosh" "cosh")
+    ("cot" "\\cot" t "cot" "cot" "cot" "cot")
+    ("coth" "\\coth" t "coth" "coth" "coth" "coth")
+    ("csc" "\\csc" t "csc" "csc" "csc" "csc")
+    ("deg" "\\deg" t "&deg;" "deg" "deg" "deg")
+    ("det" "\\det" t "det" "det" "det" "det")
+    ("dim" "\\dim" t "dim" "dim" "dim" "dim")
+    ("exp" "\\exp" t "exp" "exp" "exp" "exp")
+    ("gcd" "\\gcd" t "gcd" "gcd" "gcd" "gcd")
+    ("hom" "\\hom" t "hom" "hom" "hom" "hom")
+    ("inf" "\\inf" t "inf" "inf" "inf" "inf")
+    ("ker" "\\ker" t "ker" "ker" "ker" "ker")
+    ("lg" "\\lg" t "lg" "lg" "lg" "lg")
+    ("lim" "\\lim" t "lim" "lim" "lim" "lim")
+    ("liminf" "\\liminf" t "liminf" "liminf" "liminf" "liminf")
+    ("limsup" "\\limsup" t "limsup" "limsup" "limsup" "limsup")
+    ("ln" "\\ln" t "ln" "ln" "ln" "ln")
+    ("log" "\\log" t "log" "log" "log" "log")
+    ("max" "\\max" t "max" "max" "max" "max")
+    ("min" "\\min" t "min" "min" "min" "min")
+    ("Pr" "\\Pr" t "Pr" "Pr" "Pr" "Pr")
+    ("sec" "\\sec" t "sec" "sec" "sec" "sec")
+    ("sin" "\\sin" t "sin" "sin" "sin" "sin")
+    ("sinh" "\\sinh" t "sinh" "sinh" "sinh" "sinh")
+    ("sup" "\\sup" t "&sup;" "sup" "sup" "sup")
+    ("tan" "\\tan" t "tan" "tan" "tan" "tan")
+    ("tanh" "\\tanh" t "tanh" "tanh" "tanh" "tanh")
+
+    "** Signs & Symbols"
+    ("bull" "\\textbullet{}" nil "&bull;" "*" "*" "•")
+    ("bullet" "\\textbullet{}" nil "&bull;" "*" "*" "•")
+    ("star" "\\star" t "*" "*" "*" "⋆")
+    ("lowast" "\\ast" t "&lowast;" "*" "*" "∗")
+    ("ast" "\\ast" t "&lowast;" "*" "*" "*")
+    ("odot" "\\odot" t "o" "[circled dot]" "[circled dot]" "ʘ")
+    ("oplus" "\\oplus" t "&oplus;" "[circled plus]" "[circled plus]" "⊕")
+    ("otimes" "\\otimes" t "&otimes;" "[circled times]" "[circled times]" "⊗")
+    ("checkmark" "\\checkmark" t "&#10003;" "[checkmark]" "[checkmark]" "✓")
+
+    "** Miscellaneous (seldom used)"
+    ("para" "\\P{}" nil "&para;" "[pilcrow]" "¶" "¶")
+    ("ordf" "\\textordfeminine{}" nil "&ordf;" "_a_" "ª" "ª")
+    ("ordm" "\\textordmasculine{}" nil "&ordm;" "_o_" "º" "º")
+    ("cedil" "\\c{}" nil "&cedil;" "[cedilla]" "¸" "¸")
+    ("oline" "\\overline{~}" t "&oline;" "[overline]" "¯" "‾")
+    ("uml" "\\textasciidieresis{}" nil "&uml;" "[diaeresis]" "¨" "¨")
+    ("zwnj" "\\/{}" nil "&zwnj;" "" "" "‌")
+    ("zwj" "" nil "&zwj;" "" "" "‍")
+    ("lrm" "" nil "&lrm;" "" "" "‎")
+    ("rlm" "" nil "&rlm;" "" "" "‏")
+
+    "** Smilies"
+    ("smile" "\\smile" t "&#9786;" ":-)" ":-)" "⌣")
+    ("smiley" "\\smiley{}" nil "&#9786;" ":-)" ":-)" "☺")
+    ("blacksmile" "\\blacksmiley{}" nil "&#9787;" ":-)" ":-)" "☻")
+    ("sad" "\\frownie{}" nil "&#9785;" ":-(" ":-(" "☹")
+
+    "** Suits"
+    ("clubs" "\\clubsuit" t "&clubs;" "[clubs]" "[clubs]" "♣")
+    ("clubsuit" "\\clubsuit" t "&clubs;" "[clubs]" "[clubs]" "♣")
+    ("spades" "\\spadesuit" t "&spades;" "[spades]" "[spades]" "♠")
+    ("spadesuit" "\\spadesuit" t "&spades;" "[spades]" "[spades]" "♠")
+    ("hearts" "\\heartsuit" t "&hearts;" "[hearts]" "[hearts]" "♥")
+    ("heartsuit" "\\heartsuit" t "&heartsuit;" "[hearts]" "[hearts]" "♥")
+    ("diams" "\\diamondsuit" t "&diams;" "[diamonds]" "[diamonds]" "♦")
+    ("diamondsuit" "\\diamondsuit" t "&diams;" "[diamonds]" "[diamonds]" "♦")
+    ("Diamond" "\\diamond" t "&diamond;" "[diamond]" "[diamond]" "⋄")
+    ("loz" "\\diamond" t "&loz;" "[lozenge]" "[lozenge]" "◊")
+    )
+  "Default entities used in Org-mode to produce special characters.
+For details see `org-entities-user'.")
+
+(defsubst org-entity-get (name)
+  "Get the proper association for NAME from the entity lists.
+This first checks the user list, then the built-in list."
+  (or (assoc name org-entities-user)
+      (assoc name org-entities)))
+
+(defun org-entity-get-representation (name kind)
+  "Get the correct representation of entity NAME for export type KIND.
+Kind can be any of `latex', `html', `ascii', `latin1', or `utf8'."
+  (let* ((e (org-entity-get name))
+        (n (cdr (assq kind '((latex . 1) (html . 3) (ascii . 4)
+                             (latin1 . 5) (utf8 . 6)))))
+        (r (and e n (nth n e))))
+    (if (and e r
+            (not org-entities-ascii-explanatory)
+            (memq kind '(ascii latin1 utf8))
+            (= (string-to-char r) ?\[))
+       (concat "\\" name)
+      r)))
+
+(defsubst org-entity-latex-math-p (name)
+  "Does entity NAME require math mode in LaTeX?"
+  (nth 2 (org-entity-get name)))
+
+;; Helpfunctions to create a table for orgmode.org/worg/org-symbols.org
+
+(defun org-entities-create-table ()
+  "Create an org-mode table with all entities."
+  (interactive)
+  (let ((ll org-entities)
+       (pos (point))
+       e latex mathp html latin utf8 name ascii)
+    (insert "|Name|LaTeX code|LaTeX|HTML code |HTML|ASCII|Latin1|UTF-8\n|-\n")
+    (while ll
+      (when (listp e)
+       (setq e (pop ll))
+       (setq name (car e)
+             latex (nth 1 e)
+             mathp (nth 2 e)
+             html (nth 3 e)
+             ascii (nth 4 e)
+             latin (nth 5 e)
+             utf8 (nth 6 e))
+       (if (equal ascii "|") (setq ascii "\\vert"))
+       (if (equal latin "|") (setq latin "\\vert"))
+       (if (equal utf8  "|") (setq utf8  "\\vert"))
+       (if (equal ascii "=>") (setq ascii "= >"))
+       (if (equal latin "=>") (setq latin "= >"))
+       (insert "|" name
+               "|" (format "=%s=" latex)
+               "|" (format (if mathp "$%s$" "$\\mbox{%s}$")
+                           latex)
+               "|" (format "=%s=" html) "|" html
+               "|" ascii "|" latin "|" utf8
+               "|\n")))
+    (goto-char pos)
+    (org-table-align)))
+
+(defun org-entities-help ()
+  "Create a Help buffer with all available entities."
+  (interactive)
+  (with-output-to-temp-buffer "*Org Entity Help*"
+    (princ "Org-mode entities\n=================\n\n")
+    (let ((ll (append '("* User-defined additions (variable org-entities-user)")
+                     org-entities-user
+                     org-entities))
+         e latex mathp html latin utf8 name ascii
+         (lastwasstring t)
+         (head (concat
+                "\n"
+                "   Symbol   Org entity        LaTeX code             HTML code\n"
+                "   -----------------------------------------------------------\n")))
+      (while ll
+       (setq e (pop ll))
+       (if (stringp e)
+           (progn
+             (princ e)
+             (princ "\n")
+             (setq lastwasstring t))
+         (if lastwasstring (princ head))
+         (setq lastwasstring nil)
+         (setq name (car e)
+               latex (nth 1 e)
+               html (nth 3 e)
+               utf8 (nth 6 e))
+         (princ (format "   %-8s \\%-16s %-22s %-13s\n"
+                        utf8 name latex html))))))
+  (with-current-buffer "*Org Entity Help*"
+    (org-mode))
+  (select-window (get-buffer-window "*Org Entity Help*")))
+
+
+(defun replace-amp ()
+  "Postprocess HTML file to unescape the ampersand."
+  (interactive)
+  (while (re-search-forward "<td>&amp;\\([^<;]+;\\)" nil t)
+    (replace-match (concat "<td>&" (match-string 1)) t t)))
+
+(provide 'org-entities)
+
+;; Local variables:
+;; coding: utf-8
+;; End:
+
+;; arch-tag: e6bd163f-7419-4009-9c93-a74623016424
+
+;;; org-entities.el ends here
index fd0dbca4e2dc74de5218f793bc346b3d454935a1..4676f5b1aaf3166cd972d20659c37c0b45edcaed 100644 (file)
@@ -4,6 +4,7 @@
 ;;   Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
+;; Version: 7.01
 
 ;; This file is part of GNU Emacs.
 ;;
@@ -67,6 +68,8 @@
 ;; `org-export-blocks-add-block' to add your block type to
 ;; `org-export-blocks'.
 
+;;; Code:
+
 (eval-when-compile
   (require 'cl))
 (require 'org)
   '((comment org-export-blocks-format-comment t)
     (ditaa org-export-blocks-format-ditaa nil)
     (dot org-export-blocks-format-dot nil))
-  "Use this a-list to associate block types with block exporting
-functions.  The type of a block is determined by the text
-immediately following the '#+BEGIN_' portion of the block header.
-Each block export function should accept three argumets..."
+  "Use this alist to associate block types with block exporting functions.
+The type of a block is determined by the text immediately
+following the '#+BEGIN_' portion of the block header.  Each block
+export function should accept three arguments."
   :group 'org-export-general
   :type '(repeat
          (list
@@ -105,14 +108,14 @@ Each block export function should accept three argumets..."
   :set 'org-export-blocks-set)
 
 (defun org-export-blocks-add-block (block-spec)
-  "Add a new block type to `org-export-blocks'.  BLOCK-SPEC
-should be a three element list the first element of which should
-indicate the name of the block, the second element should be the
-formatting function called by `org-export-blocks-preprocess' and
-the third element a flag indicating whether these types of blocks
-should be fontified in org-mode buffers (see
-`org-protecting-blocks').  For example the BLOCK-SPEC for ditaa
-blocks is as follows...
+  "Add a new block type to `org-export-blocks'.
+BLOCK-SPEC should be a three element list the first element of
+which should indicate the name of the block, the second element
+should be the formatting function called by
+`org-export-blocks-preprocess' and the third element a flag
+indicating whether these types of blocks should be fontified in
+org-mode buffers (see `org-protecting-blocks').  For example the
+BLOCK-SPEC for ditaa blocks is as follows.
 
   (ditaa org-export-blocks-format-ditaa nil)"
   (unless (member block-spec org-export-blocks)
@@ -121,25 +124,28 @@ blocks is as follows...
 
 (defcustom org-export-interblocks
   '()
-  "Use this a-list to associate block types with block exporting
-functions.  The type of a block is determined by the text
-immediately following the '#+BEGIN_' portion of the block header.
-Each block export function should accept three argumets..."
+  "Use this a-list to associate block types with block exporting functions.
+The type of a block is determined by the text immediately
+following the '#+BEGIN_' portion of the block header.  Each block
+export function should accept three arguments."
   :group 'org-export-general
   :type 'alist)
 
 (defcustom org-export-blocks-witheld
   '(hidden)
-  "List of block types (see `org-export-blocks') which should not
-be exported."
+  "List of block types (see `org-export-blocks') which should not be exported."
   :group 'org-export-general
   :type 'list)
 
-(defvar org-export-blocks-postblock-hooks nil "")
+(defcustom org-export-blocks-postblock-hook nil
+  "Run after blocks have been processed with `org-export-blocks-preprocess'."
+  :group 'org-export-general
+  :type 'hook)
 
 (defun org-export-blocks-html-quote (body &optional open close)
-  "Protext BODY from org html export.  The optional OPEN and
-CLOSE tags will be inserted around BODY."
+  "Protect BODY from org html export.
+The optional OPEN and CLOSE tags will be inserted around BODY."
+
   (concat
    "\n#+BEGIN_HTML\n"
    (or open "")
@@ -148,8 +154,8 @@ CLOSE tags will be inserted around BODY."
    "#+END_HTML\n"))
 
 (defun org-export-blocks-latex-quote (body &optional open close)
-  "Protext BODY from org latex export.  The optional OPEN and
-CLOSE tags will be inserted around BODY."
+  "Protect BODY from org latex export.
+The optional OPEN and CLOSE tags will be inserted around BODY."
   (concat
    "\n#+BEGIN_LaTeX\n"
    (or open "")
@@ -158,22 +164,21 @@ CLOSE tags will be inserted around BODY."
    "#+END_LaTeX\n"))
 
 (defun org-export-blocks-preprocess ()
-  "Export all blocks according to the `org-export-blocks' block
-exportation alist.  Does not export block types specified in
-specified in BLOCKS which default to the value of
-`org-export-blocks-witheld'."
+  "Export all blocks according to the `org-export-blocks' block export alist.
+Does not export block types specified in specified in BLOCKS
+which defaults to the value of `org-export-blocks-witheld'."
   (interactive)
   (save-window-excursion
     (let ((case-fold-search t)
          (types '())
-         indentation type func start body headers preserve-indent)
+         indentation type func start body headers preserve-indent progress-marker)
       (flet ((interblock (start end)
                         (mapcar (lambda (pair) (funcall (second pair) start end))
                                 org-export-interblocks)))
        (goto-char (point-min))
        (setq start (point))
        (while (re-search-forward
-               "^\\([ \t]*\\)#\\+begin_\\(\\S-+\\)[ \t]*\\(.*\\)?[\r\n]\\([^\000]*?\\)[\r\n][ \t]*#\\+end_\\S-+.*" nil t)
+               "^\\([ \t]*\\)#\\+begin_\\(\\S-+\\)[ \t]*\\(.*\\)?[\r\n]\\([^\000]*?\\)[\r\n][ \t]*#\\+end_\\S-+.*[\r\n]?" nil t)
           (setq indentation (length (match-string 1)))
          (setq type (intern (downcase (match-string 2))))
          (setq headers (save-match-data (org-split-string (match-string 3) "[ \t]+")))
@@ -183,15 +188,18 @@ specified in BLOCKS which default to the value of
            (setq body (save-match-data (org-remove-indentation body))))
          (unless (memq type types) (setq types (cons type types)))
          (save-match-data (interblock start (match-beginning 0)))
-         (if (setq func (cadr (assoc type org-export-blocks)))
-             (progn
-                (replace-match (save-match-data
+         (when (setq func (cadr (assoc type org-export-blocks)))
+            (let ((replacement (save-match-data
                                  (if (memq type org-export-blocks-witheld) ""
-                                   (apply func body headers))) t t)
+                                   (apply func body headers)))))
+              (when replacement
+                (replace-match replacement t t)
                 (unless preserve-indent
-                 (indent-code-rigidly (match-beginning 0) (match-end 0) indentation))))
+                  (indent-code-rigidly
+                   (match-beginning 0) (match-end 0) indentation)))))
          (setq start (match-end 0)))
-       (interblock start (point-max))))))
+       (interblock start (point-max))
+       (run-hooks 'org-export-blocks-postblock-hook)))))
 
 (add-hook 'org-export-preprocess-hook 'org-export-blocks-preprocess)
 
@@ -209,7 +217,7 @@ specified in BLOCKS which default to the value of
                               (expand-file-name
                                "../contrib"
                                (file-name-directory (or load-file-name buffer-file-name)))))))
-  "Path to the ditaa jar executable")
+  "Path to the ditaa jar executable.")
 
 (defun org-export-blocks-format-ditaa (body &rest headers)
   "Pass block BODY to the ditaa utility creating an image.
@@ -219,13 +227,15 @@ passed to the ditaa utility as command line arguments."
   (message "ditaa-formatting...")
   (let* ((args (if (cdr headers) (mapconcat 'identity (cdr headers) " ")))
          (data-file (make-temp-file "org-ditaa"))
-         (hash (sha1 (prin1-to-string (list body args))))
-         (raw-out-file (if headers (car headers)))
-         (out-file-parts (if (string-match "\\(.+\\)\\.\\([^\\.]+\\)$" raw-out-file)
-                             (cons (match-string 1 raw-out-file)
-                                   (match-string 2 raw-out-file))
-                           (cons raw-out-file "png")))
-         (out-file (concat (car out-file-parts) "_" hash "." (cdr out-file-parts))))
+        (hash (progn
+                (set-text-properties 0 (length body) nil body)
+                (sha1 (prin1-to-string (list body args)))))
+        (raw-out-file (if headers (car headers)))
+        (out-file-parts (if (string-match "\\(.+\\)\\.\\([^\\.]+\\)$" raw-out-file)
+                            (cons (match-string 1 raw-out-file)
+                                  (match-string 2 raw-out-file))
+                          (cons raw-out-file "png")))
+        (out-file (concat (car out-file-parts) "_" hash "." (cdr out-file-parts))))
     (unless (file-exists-p org-ditaa-jar-path)
       (error (format "Could not find ditaa.jar at %s" org-ditaa-jar-path)))
     (setq body (if (string-match "^\\([^:\\|:[^ ]\\)" body)
@@ -279,13 +289,15 @@ digraph data_relationships {
   (message "dot-formatting...")
   (let* ((args (if (cdr headers) (mapconcat 'identity (cdr headers) " ")))
          (data-file (make-temp-file "org-ditaa"))
-         (hash (sha1 (prin1-to-string (list body args))))
-         (raw-out-file (if headers (car headers)))
-         (out-file-parts (if (string-match "\\(.+\\)\\.\\([^\\.]+\\)$" raw-out-file)
-                             (cons (match-string 1 raw-out-file)
-                                   (match-string 2 raw-out-file))
-                           (cons raw-out-file "png")))
-         (out-file (concat (car out-file-parts) "_" hash "." (cdr out-file-parts))))
+        (hash (progn
+                (set-text-properties 0 (length body) nil body)
+                (sha1 (prin1-to-string (list body args)))))
+        (raw-out-file (if headers (car headers)))
+        (out-file-parts (if (string-match "\\(.+\\)\\.\\([^\\.]+\\)$" raw-out-file)
+                            (cons (match-string 1 raw-out-file)
+                                  (match-string 2 raw-out-file))
+                          (cons raw-out-file "png")))
+        (out-file (concat (car out-file-parts) "_" hash "." (cdr out-file-parts))))
     (cond
      ((or htmlp latexp docbookp)
       (unless (file-exists-p out-file)
index f87fd785d9631d32346d0161146e5823dd74ae4d..c3f27cf0e15b5e1b6c4d183fba18573bd24147ee 100644 (file)
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33x
+;; Version: 7.01
 ;;
 ;; This file is part of GNU Emacs.
 ;;
 ;;
 ;;; Commentary:
 
+;;; Code:
+
 (require 'org)
 (require 'org-macs)
 (require 'org-agenda)
 (require 'org-exp-blocks)
+(require 'ob-exp)
 (require 'org-src)
+
 (eval-when-compile
   (require 'cl))
 
@@ -42,6 +46,8 @@
 (declare-function org-export-htmlize-region-for-paste "org-html" (beg end))
 (declare-function htmlize-buffer "ext:htmlize" (&optional buffer))
 (declare-function org-inlinetask-remove-END-maybe "org-inlinetask" ())
+(declare-function org-table-cookie-line-p "org-table" (line))
+(declare-function org-table-colgroup-line-p "org-table" (line))
 (autoload 'org-export-generic "org-export-generic" "Export using the generic exporter" t)
 (defgroup org-export nil
   "Options for exporting org-listings."
@@ -54,7 +60,7 @@
   :group 'org-export)
 
 (defcustom org-export-allow-BIND 'confirm
-  "Non-nil means, allow #+BIND to define local variable values for export.
+  "Non-nil means allow #+BIND to define local variable values for export.
 This is a potential security risk, which is why the user must confirm the
 use of these lines."
   :group 'org-export-general
@@ -67,7 +73,7 @@ use of these lines."
 (defvar org-export-publishing-directory nil)
 
 (defcustom org-export-show-temporary-export-buffer t
-  "Non-nil means, show buffer after exporting to temp buffer.
+  "Non-nil means show buffer after exporting to temp buffer.
 When Org exports to a file, the buffer visiting that file is ever
 shown, but remains buried.  However, when exporting to a temporary
 buffer, that buffer is popped up in a second window.  When this variable
@@ -76,7 +82,14 @@ is nil, the buffer remains buried also in these cases."
   :type 'boolean)
 
 (defcustom org-export-copy-to-kill-ring t
-  "Non-nil means, exported stuff will also be pushed onto the kill ring."
+  "Non-nil means exported stuff will also be pushed onto the kill ring."
+  :group 'org-export-general
+  :type 'boolean)
+
+(defcustom org-export-kill-product-buffer-when-displayed nil
+  "Non-nil means kill the product buffer if it is displayed immediately.
+This applied to the commands `org-export-html-and-open' and
+`org-export-as-pdf-and-open'."
   :group 'org-export-general
   :type 'boolean)
 
@@ -86,9 +99,10 @@ This works by starting up a separate Emacs process visiting the same file
 and doing the export from there.
 Not all export commands are affected by this - only the ones which
 actually write to a file, and that do not depend on the buffer state.
-
+\\<org-mode-map>
 If this option is nil, you can still get background export by calling
-`org-export' with a double prefix arg: `C-u C-u C-c C-e'.
+`org-export' with a double prefix arg: \
+\\[universal-argument] \\[universal-argument] \\[org-export].
 
 If this option is t, the double prefix can be used to exceptionally
 force an export command into the current process."
@@ -114,7 +128,7 @@ This is without condition, so even subtrees inside that carry one of the
 
 ;; FIXME: rename, this is a general variable
 (defcustom org-export-html-expand t
-  "Non-nil means, for HTML export, treat @<...> as HTML tag.
+  "Non-nil means for HTML export, treat @<...> as HTML tag.
 When nil, these tags will be exported as plain text and therefore
 not be interpreted by a browser.
 
@@ -124,7 +138,7 @@ This option can also be set with the +OPTIONS line, e.g. \"@:nil\"."
   :type 'boolean)
 
 (defcustom org-export-with-special-strings t
-  "Non-nil means, interpret \"\-\", \"--\" and \"---\" for export.
+  "Non-nil means interpret \"\-\", \"--\" and \"---\" for export.
 When this option is turned on, these strings will be exported as:
 
   Org   HTML       LaTeX
@@ -198,7 +212,7 @@ This is best set with the #+KEYWORDS line in a file, it does not make
 sense to set this globally.")
 
 (defcustom org-export-skip-text-before-1st-heading nil
-  "Non-nil means, skip all text before the first headline when exporting.
+  "Non-nil means skip all text before the first headline when exporting.
 When nil, that text is exported as well."
   :group 'org-export-general
   :type 'boolean)
@@ -214,7 +228,7 @@ This option can also be set with the +OPTIONS line, e.g. \"H:2\"."
   :type 'integer)
 
 (defcustom org-export-with-section-numbers t
-  "Non-nil means, add section numbers to headlines when exporting.
+  "Non-nil means add section numbers to headlines when exporting.
 
 This option can also be set with the +OPTIONS line, e.g. \"num:t\"."
   :group 'org-export-general
@@ -224,7 +238,7 @@ This option can also be set with the +OPTIONS line, e.g. \"num:t\"."
   "Format of section numbers for export.
 The variable has two components.
 1. A list of lists, each indicating a counter type and a separator.
-   The counter type can be any of \"1\", \"A\", \"a\", \"I\", or \"a\".
+   The counter type can be any of \"1\", \"A\", \"a\", \"I\", or \"i\".
    It causes causes numeric, alphabetic, or roman counters, respectively.
    The separator is only used if another counter for a subsection is being
    added.
@@ -241,7 +255,7 @@ The variable has two components.
          (string :tag "Terminator")))
 
 (defcustom org-export-with-toc t
-  "Non-nil means, create a table of contents in exported files.
+  "Non-nil means create a table of contents in exported files.
 The TOC contains headlines with levels up to`org-export-headline-levels'.
 When an integer, include levels up to N in the toc, this may then be
 different from `org-export-headline-levels', but it will not be allowed
@@ -263,24 +277,24 @@ or \"toc:3\"."
          (integer :tag "TOC to level")))
 
 (defcustom org-export-mark-todo-in-toc nil
-  "Non-nil means, mark TOC lines that contain any open TODO items."
+  "Non-nil means mark TOC lines that contain any open TODO items."
   :group 'org-export-general
   :type 'boolean)
 
 (defcustom org-export-with-todo-keywords t
-  "Non-nil means, include TODO keywords in export.
+  "Non-nil means include TODO keywords in export.
 When nil, remove all these keywords from the export."
   :group 'org-export-general
   :type 'boolean)
 
 (defcustom org-export-with-priority nil
-  "Non-nil means, include priority cookies in export.
+  "Non-nil means include priority cookies in export.
 When nil, remove priority cookies for export."
   :group 'org-export-general
   :type 'boolean)
 
 (defcustom org-export-preserve-breaks nil
-  "Non-nil means, preserve all line breaks when exporting.
+  "Non-nil means preserve all line breaks when exporting.
 Normally, in HTML output paragraphs will be reformatted.  In ASCII
 export, line breaks will always be preserved, regardless of this variable.
 
@@ -302,21 +316,29 @@ headline  Only export the headline, but skip the tree below it."
          (const :tag "entirely" t)))
 
 (defcustom org-export-author-info t
-  "Non-nil means, insert author name and email into the exported file.
+  "Non-nil means insert author name and email into the exported file.
+
+This option can also be set with the +OPTIONS line,
+e.g. \"author:nil\"."
+  :group 'org-export-general
+  :type 'boolean)
+
+(defcustom org-export-email-info nil
+  "Non-nil means insert author name and email into the exported file.
 
 This option can also be set with the +OPTIONS line,
-e.g. \"author-info:nil\"."
+e.g. \"email:t\"."
   :group 'org-export-general
   :type 'boolean)
 
 (defcustom org-export-creator-info t
-  "Non-nil means, the postamble should contain a creator sentence.
+  "Non-nil means the postamble should contain a creator sentence.
 This sentence is \"HTML generated by org-mode XX in emacs XXX\"."
   :group 'org-export-general
   :type 'boolean)
 
 (defcustom org-export-time-stamp-file t
-  "Non-nil means, insert a time stamp into the exported file.
+  "Non-nil means insert a time stamp into the exported file.
 The time stamp shows when the file was created.
 
 This option can also be set with the +OPTIONS line,
@@ -347,7 +369,7 @@ This option can also be set with the +OPTIONS line, e.g. \"tags:nil\"."
          (const :tag "On" t)))
 
 (defcustom org-export-with-drawers nil
-  "Non-nil means, export with drawers like the property drawer.
+  "Non-nil means export with drawers like the property drawer.
 When t, all drawers are exported.  This may also be a list of
 drawer names to export."
   :group 'org-export-general
@@ -357,9 +379,19 @@ drawer names to export."
          (repeat :tag "Selected drawers"
                  (string :tag "Drawer name"))))
 
+(defvar org-export-first-hook nil
+  "Hook called as the first thing in each exporter.
+Point will be still in the original buffer.
+Good for general initialization")
+
 (defvar org-export-preprocess-hook nil
   "Hook for preprocessing an export buffer.
-Pretty much the first thing when exporting is running this hook.")
+Pretty much the first thing when exporting is running this hook.
+Point will be in a temporary buffer that contains a copy of
+the original buffer, or of the section that is being export.
+All the other hooks in the org-export-preprocess... category
+also work in that temporary buffer, already modified by various
+stages of the processing.")
 
 (defvar org-export-preprocess-after-include-files-hook nil
   "Hook for preprocessing an export buffer.
@@ -371,11 +403,24 @@ This is run after selection of trees to be exported has happened.
 This selection includes tags-based selection, as well as removal
 of commented and archived trees.")
 
+(defvar org-export-preprocess-after-headline-targets-hook nil
+  "Hook for preprocessing export buffer.
+This is run just after the headline targets have been defined and
+the target-alist has been set up.")
+
+(defvar org-export-preprocess-before-selecting-backend-code-hook nil
+  "Hook for preprocessing an export buffer.
+This is run just before backend-specific blocks get selected.")
+
 (defvar org-export-preprocess-after-blockquote-hook nil
   "Hook for preprocessing an export buffer.
 This is run after blockquote/quote/verse/center have been marked
 with cookies.")
 
+(defvar org-export-preprocess-before-normalizing-links-hook nil
+  "Hook for preprocessing an export buffer.
+This hook is run before links are normalized.")
+
 (defvar org-export-preprocess-before-backend-specifics-hook nil
   "Hook run before backend-specific functions are called during preprocessing.")
 
@@ -390,7 +435,7 @@ returning the buffer string to the backend.")
   :group 'org-export)
 
 (defcustom org-export-with-emphasize t
-  "Non-nil means, interpret *word*, /word/, and _word_ as emphasized text.
+  "Non-nil means interpret *word*, /word/, and _word_ as emphasized text.
 If the export target supports emphasizing text, the word will be
 typeset in bold, italic, or underlined, respectively.  Works only for
 single words, but you can say: I *really* *mean* *this*.
@@ -408,41 +453,13 @@ This option can also be set with the +OPTIONS line, e.g. \"f:nil\"."
   :group 'org-export-translation
   :type 'boolean)
 
-(defcustom org-export-with-sub-superscripts t
-  "Non-nil means, interpret \"_\" and \"^\" for export.
-When this option is turned on, you can use TeX-like syntax for sub- and
-superscripts.  Several characters after \"_\" or \"^\" will be
-considered as a single item - so grouping with {} is normally not
-needed.  For example, the following things will be parsed as single
-sub- or superscripts.
-
- 10^24   or   10^tau     several digits will be considered 1 item.
- 10^-12  or   10^-tau    a leading sign with digits or a word
- x^2-y^3                 will be read as x^2 - y^3, because items are
-                        terminated by almost any nonword/nondigit char.
- x_{i^2} or   x^(2-i)    braces or parenthesis do grouping.
-
-Still, ambiguity is possible - so when in doubt use {} to enclose the
-sub/superscript.  If you set this variable to the symbol `{}',
-the braces are *required* in order to trigger interpretations as
-sub/superscript.  This can be helpful in documents that need \"_\"
-frequently in plain text.
-
-Not all export backends support this, but HTML does.
-
-This option can also be set with the +OPTIONS line, e.g. \"^:nil\"."
-  :group 'org-export-translation
-  :type '(choice
-         (const :tag "Always interpret" t)
-         (const :tag "Only with braces" {})
-         (const :tag "Never interpret" nil)))
-
 (defcustom org-export-with-TeX-macros t
-  "Non-nil means, interpret simple TeX-like macros when exporting.
+  "Non-nil means interpret simple TeX-like macros when exporting.
 For example, HTML export converts \\alpha to &alpha; and \\AA to &Aring;.
 Not only real TeX macros will work here, but the standard HTML entities
 for math can be used as macro names as well.  For a list of supported
-names in HTML export, see the constant `org-html-entities'.
+names in HTML export, see the constant `org-entities' and the user option
+`org-entities-user'.
 Not all export backends support this.
 
 This option can also be set with the +OPTIONS line, e.g. \"TeX:nil\"."
@@ -451,7 +468,7 @@ This option can also be set with the +OPTIONS line, e.g. \"TeX:nil\"."
   :type 'boolean)
 
 (defcustom org-export-with-LaTeX-fragments nil
-  "Non-nil means, convert LaTeX fragments to images when exporting to HTML.
+  "Non-nil means convert LaTeX fragments to images when exporting to HTML.
 When set, the exporter will find LaTeX environments if the \\begin line is
 the first non-white thing on a line.  It will also find the math delimiters
 like $a=b$ and \\( a=b \\) for inline math,  $$a=b$$ and \\[ a=b \\] for
@@ -466,7 +483,7 @@ is not available on all systems."
   :type 'boolean)
 
 (defcustom org-export-with-fixed-width t
-  "Non-nil means, lines starting with \":\" will be in fixed width font.
+  "Non-nil means lines starting with \":\" will be in fixed width font.
 This can be used to have pre-formatted text, fragments of code etc.  For
 example:
   : ;; Some Lisp examples
@@ -479,12 +496,6 @@ This option can also be set with the +OPTIONS line, e.g. \"::nil\"."
   :group 'org-export-translation
   :type 'boolean)
 
-(defcustom org-match-sexp-depth 3
-  "Number of stacked braces for sub/superscript matching.
-This has to be set before loading org.el to be effective."
-  :group 'org-export-translation
-  :type 'integer)
-
 (defgroup org-export-tables nil
   "Options for exporting tables in Org-mode."
   :tag "Org Export Tables"
@@ -505,7 +516,7 @@ This option can also be set with the +OPTIONS line, e.g. \"|:nil\"."
   :type 'boolean)
 
 (defcustom org-export-highlight-first-table-line t
-  "Non-nil means, highlight the first table line.
+  "Non-nil means highlight the first table line.
 In HTML export, this means use <th> instead of <td>.
 In tables created with table.el, this applies to the first table line.
 In Org-mode tables, all lines before the first horizontal separator
@@ -523,13 +534,14 @@ the values of constants may be useful to have."
   :type 'boolean)
 
 (defcustom org-export-prefer-native-exporter-for-tables nil
-  "Non-nil means, always export tables created with table.el natively.
-Natively means, use the HTML code generator in table.el.
+  "Non-nil means always export tables created with table.el natively.
+Natively means use the HTML code generator in table.el.
 When nil, Org-mode's own HTML generator is used when possible (i.e. if
 the table does not use row- or column-spanning).  This has the
 advantage, that the automatic HTML conversions for math symbols and
 sub/superscripts can be applied.  Org-mode's HTML generator is also
-much faster."
+much faster.  The LaTeX exporter always use the native exporter for
+table.el tables."
   :group 'org-export-tables
   :type 'boolean)
 
@@ -581,6 +593,7 @@ much faster."
     (:fixed-width            ":"         org-export-with-fixed-width)
     (:timestamps             "<"         org-export-with-timestamps)
     (:author-info            "author"    org-export-author-info)
+    (:email-info             "email"     org-export-email-info)
     (:creator-info           "creator"   org-export-creator-info)
     (:time-stamp-file        "timestamp" org-export-time-stamp-file)
     (:tables                 "|"         org-export-with-tables)
@@ -661,7 +674,7 @@ modified) list.")
                    "LINK_UP" "LINK_HOME" "SETUPFILE" "STYLE"
                    "LATEX_HEADER" "LATEX_CLASS"
                    "EXPORT_SELECT_TAGS" "EXPORT_EXCLUDE_TAGS"
-                   "KEYWORDS" "DESCRIPTION" "MACRO" "BIND")
+                   "KEYWORDS" "DESCRIPTION" "MACRO" "BIND" "XSLT")
                  (mapcar 'car org-export-inbuffer-options-extra))))
            p key val text options a pr style
            latex-header latex-class macros letbind
@@ -697,6 +710,8 @@ modified) list.")
            (setq options (concat val " " options)))
           ((string-equal key "BIND")
            (push (read (concat "(" val ")")) letbind))
+          ((string-equal key "XSLT")
+           (setq p (plist-put p :xslt val)))
           ((string-equal key "LINK_UP")
            (setq p (plist-put p :link-up val)))
           ((string-equal key "LINK_HOME")
@@ -772,9 +787,10 @@ security risks."
 
 (defun org-install-letbind ()
   "Install the values from #+BIND lines as local variables."
-  (let ((letbind (plist-get org-export-opt-plist :let-bind)))
-    (while letbind
-      (org-set-local (caar letbind) (nth 1 (pop letbind))))))
+  (let ((letbind (plist-get org-export-opt-plist :let-bind))
+       pair)
+    (while (setq pair (pop letbind))
+      (org-set-local (car pair) (nth 1 pair)))))
 
 (defun org-export-add-options-to-plist (p options)
   "Parse an OPTIONS line and set values in the property list P."
@@ -831,33 +847,35 @@ in the background.  This will be done only for commands that write
 to a file.  For details see the docstring of `org-export-run-in-background'.
 
 The prefix argument ARG will be passed to the exporter.  However, if
-ARG is a double universal prefix `C-u C-u', that means to inverse the
+ARG is a double universal prefix \\[universal-argument] \\[universal-argument], \
+that means to inverse the
 value of `org-export-run-in-background'."
   (interactive "P")
   (let* ((bg (org-xor (equal arg '(16)) org-export-run-in-background))
+        subtree-p
         (help "[t]   insert the export option template
 \[v]   limit export to visible part of outline tree
+\[1]   only export the current subtree
+\[SPC] publish enclosing subtree (with LaTeX_CLASS or EXPORT_FILE_NAME prop)
 
-\[a] export as ASCII   [A] to temporary buffer
+\[a/n/u] export as ASCII/Latin-1/UTF-8         [A/N/U] to temporary buffer
 
-\[h] export as HTML    [H] to temporary buffer   [R] export region
+\[h] export as HTML      [H] to temporary buffer   [R] export region
 \[b] export as HTML and open in browser
 
-\[l] export as LaTeX   [L] to temporary buffer
-\[p] export as LaTeX and process to PDF
-\[d] export as LaTeX, process to PDF, and open the resulting PDF document
+\[l] export as LaTeX     [L] to temporary buffer
+\[p] export as LaTeX and process to PDF            [d] ... and open PDF file
 
-\[D] export as DocBook
-\[V] export as DocBook, process to PDF, and open the resulting PDF document
+\[D] export as DocBook   [V] export as DocBook, process to PDF, and open
 
-\[m] export as Freemind mind map
+\[j] export as TaskJuggler                         [J] ... and open
 
+\[m] export as Freemind mind map
 \[x] export as XOXO
 \[g] export using Wes Hardaker's generic exporter
 
 \[i] export current file as iCalendar file
-\[I] export all agenda files as iCalendar files
-\[c] export agenda files into combined iCalendar file
+\[I] export all agenda files as iCalendar files   [c] ...as one combined file
 
 \[F] publish current file          [P] publish current project
 \[X] publish a project...          [E] publish every projects")
@@ -866,6 +884,10 @@ value of `org-export-run-in-background'."
            (?v org-export-visible nil)
            (?a org-export-as-ascii t)
            (?A org-export-as-ascii-to-buffer t)
+           (?n org-export-as-latin1 t)
+           (?N org-export-as-latin1-to-buffer t)
+           (?u org-export-as-utf8 t)
+           (?U org-export-as-utf8-to-buffer t)
            (?h org-export-as-html t)
            (?b org-export-as-html-and-open t)
            (?H org-export-as-html-to-buffer nil)
@@ -874,6 +896,8 @@ value of `org-export-run-in-background'."
            (?g org-export-generic t)
            (?D org-export-as-docbook t)
            (?V org-export-as-docbook-pdf-and-open t)
+           (?j org-export-as-taskjuggler t)
+           (?J org-export-as-taskjuggler-and-open t)
            (?m org-export-as-freemind t)
            (?l org-export-as-latex t)
            (?p org-export-as-pdf t)
@@ -886,7 +910,8 @@ value of `org-export-run-in-background'."
            (?P org-publish-current-project t)
            (?X org-publish t)
            (?E org-publish-all t)))
-        r1 r2 ass)
+        r1 r2 ass
+        (cpos (point)) (cbuf (current-buffer)) bpos)
     (save-excursion
       (save-window-excursion
        (delete-other-windows)
@@ -895,7 +920,25 @@ value of `org-export-run-in-background'."
        (org-fit-window-to-buffer (get-buffer-window
                                   "*Org Export/Publishing Help*"))
        (message "Select command: ")
-       (setq r1 (read-char-exclusive))))
+       (setq r1 (read-char-exclusive))
+       (when (eq r1 ?1)
+         (setq subtree-p t)
+         (message "Select command (for subtree): ")
+         (setq r1 (read-char-exclusive)))
+       (when (eq r1 ?\ )
+         (let ((case-fold-search t))
+           (if (re-search-backward
+                "^[ \t]+\\(:latex_class:\\|:export_title:\\)[ \t]+\\S-"
+                nil t)
+               (progn
+                 (org-back-to-heading t)
+                 (setq subtree-p t)
+                 (setq bpos (point))
+                 (message "Select command (for subtree): ")
+                 (setq r1 (read-char-exclusive)))
+             (error "No enclosing node with LaTeX_CLASS or EXPORT_FILE_NAME")
+             )))))
+    (and bpos (goto-char bpos))
     (setq r2 (if (< r1 27) (+ r1 96) r1))
     (unless (setq ass (assq r2 cmds))
       (error "No command associated with key %c" r1))
@@ -916,322 +959,30 @@ value of `org-export-run-in-background'."
          (set-process-sentinel p 'org-export-process-sentinel)
          (message "Background process \"%s\": started" p))
       ;; background processing not requested, or not possible
-      (call-interactively (nth 1 ass)))))
+      (if subtree-p (progn (outline-mark-subtree) (activate-mark)))
+      (call-interactively (nth 1 ass))
+      (when (and bpos (get-buffer-window cbuf))
+       (let ((cw (selected-window)))
+         (select-window (get-buffer-window cbuf))
+         (goto-char cpos)
+         (deactivate-mark)
+         (select-window cw))))))
 
 (defun org-export-process-sentinel (process status)
   (if (string-match "\n+\\'" status)
       (setq status (substring status 0 -1)))
   (message "Background process \"%s\": %s" process status))
 
-(defconst org-html-entities
-  '(("nbsp")
-    ("iexcl")
-    ("cent")
-    ("pound")
-    ("curren")
-    ("yen")
-    ("brvbar")
-    ("vert" . "&#124;")
-    ("sect")
-    ("uml")
-    ("copy")
-    ("ordf")
-    ("laquo")
-    ("not")
-    ("shy")
-    ("reg")
-    ("macr")
-    ("deg")
-    ("pm" . "&plusmn;")
-    ("plusmn")
-    ("sup2")
-    ("sup3")
-    ("acute")
-    ("micro")
-    ("para")
-    ("middot")
-    ("odot"."o")
-    ("star"."*")
-    ("cedil")
-    ("sup1")
-    ("ordm")
-    ("raquo")
-    ("frac14")
-    ("frac12")
-    ("frac34")
-    ("iquest")
-    ("Agrave")
-    ("Aacute")
-    ("Acirc")
-    ("Atilde")
-    ("Auml")
-    ("Aring") ("AA"."&Aring;")
-    ("AElig")
-    ("Ccedil")
-    ("Egrave")
-    ("Eacute")
-    ("Ecirc")
-    ("Euml")
-    ("Igrave")
-    ("Iacute")
-    ("Icirc")
-    ("Iuml")
-    ("ETH")
-    ("Ntilde")
-    ("Ograve")
-    ("Oacute")
-    ("Ocirc")
-    ("Otilde")
-    ("Ouml")
-    ("times")
-    ("Oslash")
-    ("Ugrave")
-    ("Uacute")
-    ("Ucirc")
-    ("Uuml")
-    ("Yacute")
-    ("THORN")
-    ("szlig")
-    ("agrave")
-    ("aacute")
-    ("acirc")
-    ("atilde")
-    ("auml")
-    ("aring")
-    ("aelig")
-    ("ccedil")
-    ("egrave")
-    ("eacute")
-    ("ecirc")
-    ("euml")
-    ("igrave")
-    ("iacute")
-    ("icirc")
-    ("iuml")
-    ("eth")
-    ("ntilde")
-    ("ograve")
-    ("oacute")
-    ("ocirc")
-    ("otilde")
-    ("ouml")
-    ("divide")
-    ("oslash")
-    ("ugrave")
-    ("uacute")
-    ("ucirc")
-    ("uuml")
-    ("yacute")
-    ("thorn")
-    ("yuml")
-    ("fnof")
-    ("Alpha")
-    ("Beta")
-    ("Gamma")
-    ("Delta")
-    ("Epsilon")
-    ("Zeta")
-    ("Eta")
-    ("Theta")
-    ("Iota")
-    ("Kappa")
-    ("Lambda")
-    ("Mu")
-    ("Nu")
-    ("Xi")
-    ("Omicron")
-    ("Pi")
-    ("Rho")
-    ("Sigma")
-    ("Tau")
-    ("Upsilon")
-    ("Phi")
-    ("Chi")
-    ("Psi")
-    ("Omega")
-    ("alpha")
-    ("beta")
-    ("gamma")
-    ("delta")
-    ("epsilon")
-    ("varepsilon"."&epsilon;")
-    ("zeta")
-    ("eta")
-    ("theta")
-    ("iota")
-    ("kappa")
-    ("lambda")
-    ("mu")
-    ("nu")
-    ("xi")
-    ("omicron")
-    ("pi")
-    ("rho")
-    ("sigmaf") ("varsigma"."&sigmaf;")
-    ("sigma")
-    ("tau")
-    ("upsilon")
-    ("phi")
-    ("chi")
-    ("psi")
-    ("omega")
-    ("thetasym") ("vartheta"."&thetasym;")
-    ("upsih")
-    ("piv")
-    ("bull") ("bullet"."&bull;")
-    ("hellip") ("dots"."&hellip;")
-    ("prime")
-    ("Prime")
-    ("oline")
-    ("frasl")
-    ("weierp")
-    ("image")
-    ("real")
-    ("trade")
-    ("alefsym")
-    ("larr") ("leftarrow"."&larr;") ("gets"."&larr;")
-    ("uarr") ("uparrow"."&uarr;")
-    ("rarr") ("to"."&rarr;") ("rightarrow"."&rarr;")
-    ("darr")("downarrow"."&darr;")
-    ("harr") ("leftrightarrow"."&harr;")
-    ("crarr") ("hookleftarrow"."&crarr;") ; has round hook, not quite CR
-    ("lArr") ("Leftarrow"."&lArr;")
-    ("uArr") ("Uparrow"."&uArr;")
-    ("rArr") ("Rightarrow"."&rArr;")
-    ("dArr") ("Downarrow"."&dArr;")
-    ("hArr") ("Leftrightarrow"."&hArr;")
-    ("forall")
-    ("part") ("partial"."&part;")
-    ("exist") ("exists"."&exist;")
-    ("empty") ("emptyset"."&empty;")
-    ("nabla")
-    ("isin") ("in"."&isin;")
-    ("notin")
-    ("ni")
-    ("prod")
-    ("sum")
-    ("minus")
-    ("lowast") ("ast"."&lowast;")
-    ("radic")
-    ("prop") ("proptp"."&prop;")
-    ("infin") ("infty"."&infin;")
-    ("ang") ("angle"."&ang;")
-    ("and") ("wedge"."&and;")
-    ("or") ("vee"."&or;")
-    ("cap")
-    ("cup")
-    ("int")
-    ("there4")
-    ("sim")
-    ("cong") ("simeq"."&cong;")
-    ("asymp")("approx"."&asymp;")
-    ("ne") ("neq"."&ne;")
-    ("equiv")
-    ("le")
-    ("ge")
-    ("sub") ("subset"."&sub;")
-    ("sup") ("supset"."&sup;")
-    ("nsub")
-    ("sube")
-    ("supe")
-    ("oplus")
-    ("otimes")
-    ("perp")
-    ("sdot") ("cdot"."&sdot;")
-    ("lceil")
-    ("rceil")
-    ("lfloor")
-    ("rfloor")
-    ("lang")
-    ("rang")
-    ("loz") ("Diamond"."&loz;")
-    ("spades") ("spadesuit"."&spades;")
-    ("clubs") ("clubsuit"."&clubs;")
-    ("hearts") ("diamondsuit"."&hearts;")
-    ("diams") ("diamondsuit"."&diams;")
-    ("smile"."&#9786;") ("blacksmile"."&#9787;") ("sad"."&#9785;")
-    ("quot")
-    ("amp")
-    ("lt")
-    ("gt")
-    ("OElig")
-    ("oelig")
-    ("Scaron")
-    ("scaron")
-    ("Yuml")
-    ("circ")
-    ("tilde")
-    ("ensp")
-    ("emsp")
-    ("thinsp")
-    ("zwnj")
-    ("zwj")
-    ("lrm")
-    ("rlm")
-    ("ndash")
-    ("mdash")
-    ("lsquo")
-    ("rsquo")
-    ("sbquo")
-    ("ldquo")
-    ("rdquo")
-    ("bdquo")
-    ("dagger")
-    ("Dagger")
-    ("permil")
-    ("lsaquo")
-    ("rsaquo")
-    ("euro")
-
-    ("arccos"."arccos")
-    ("arcsin"."arcsin")
-    ("arctan"."arctan")
-    ("arg"."arg")
-    ("cos"."cos")
-    ("cosh"."cosh")
-    ("cot"."cot")
-    ("coth"."coth")
-    ("csc"."csc")
-    ("deg"."deg")
-    ("det"."det")
-    ("dim"."dim")
-    ("exp"."exp")
-    ("gcd"."gcd")
-    ("hom"."hom")
-    ("inf"."inf")
-    ("ker"."ker")
-    ("lg"."lg")
-    ("lim"."lim")
-    ("liminf"."liminf")
-    ("limsup"."limsup")
-    ("ln"."ln")
-    ("log"."log")
-    ("max"."max")
-    ("min"."min")
-    ("Pr"."Pr")
-    ("sec"."sec")
-    ("sin"."sin")
-    ("sinh"."sinh")
-    ("sup"."sup")
-    ("tan"."tan")
-    ("tanh"."tanh")
-    )
-  "Entities for TeX->HTML translation.
-Entries can be like (\"ent\"), in which case \"\\ent\" will be translated to
-\"&ent;\".  An entry can also be a dotted pair like (\"ent\".\"&other;\").
-In that case, \"\\ent\" will be translated to \"&other;\".
-The list contains HTML entities for Latin-1, Greek and other symbols.
-It is supplemented by a number of commonly used TeX macros with appropriate
-translations.  There is currently no way for users to extend this.")
-
 ;;; General functions for all backends
 
 (defvar org-export-target-aliases nil
   "Alist of targets with invisible aliases.")
 (defvar org-export-preferred-target-alist nil
   "Alist of section id's with preferred aliases.")
+(defvar org-export-id-target-alist nil
+  "Alist of section id's with preferred aliases.")
 (defvar org-export-code-refs nil
-  "Alist of code references and line numbers")
+  "Alist of code references and line numbers.")
 
 (defun org-export-preprocess-string (string &rest parameters)
   "Cleanup STRING so that that the true exported has a more consistent source.
@@ -1254,15 +1005,20 @@ on this string to produce the exported version."
         (outline-regexp "\\*+ ")
         target-alist rtn)
 
-    (setq org-export-target-aliases nil)
-    (setq org-export-preferred-target-alist nil)
-    (setq org-export-code-refs nil)
+    (setq org-export-target-aliases nil
+         org-export-preferred-target-alist nil
+         org-export-id-target-alist nil
+         org-export-code-refs nil)
 
     (with-current-buffer (get-buffer-create " org-mode-tmp")
       (erase-buffer)
       (insert string)
       (setq case-fold-search t)
 
+      (let ((inhibit-read-only t))
+       (remove-text-properties (point-min) (point-max)
+                               '(read-only t)))
+
       ;; Remove license-to-kill stuff
       ;; The caller marks some stuff for killing, stuff that has been
       ;; used to create the page title, for example.
@@ -1282,7 +1038,7 @@ on this string to produce the exported version."
       (untabify (point-min) (point-max))
 
       ;; Handle include files, and call a hook
-      (org-export-handle-include-files)
+      (org-export-handle-include-files-recurse)
       (run-hooks 'org-export-preprocess-after-include-files-hook)
 
       ;; Get rid of archived trees
@@ -1309,6 +1065,11 @@ on this string to produce the exported version."
       ;; Find all headings and compute the targets for them
       (setq target-alist (org-export-define-heading-targets target-alist))
 
+      (run-hooks 'org-export-preprocess-after-headline-targets-hook)
+
+      ;; Find HTML special classes for headlines
+      (org-export-remember-html-container-classes)
+
       ;; Get rid of drawers
       (org-export-remove-or-extract-drawers
        drawers (plist-get parameters :drawers) backend)
@@ -1333,6 +1094,7 @@ on this string to produce the exported version."
 
       ;; Select and protect backend specific stuff, throw away stuff
       ;; that is specific for other backends
+      (run-hooks 'org-export-preprocess-before-selecting-backend-code-hook)
       (org-export-select-backend-specific-text backend)
 
       ;; Protect quoted subtrees
@@ -1364,6 +1126,7 @@ on this string to produce the exported version."
 
       ;; Normalize links: Convert angle and plain links into bracket links
       ;; and expand link abbreviations
+      (run-hooks 'org-export-preprocess-before-normalizing-links-hook)
       (org-export-normalize-links)
 
       ;; Find all internal links.  If they have a fuzzy match (i.e. not
@@ -1403,6 +1166,9 @@ on this string to produce the exported version."
       ;; Remove or replace comments
       (org-export-handle-comments (plist-get parameters :comments))
 
+      ;; Remove #+TBLFM and #+TBLNAME lines
+      (org-export-handle-table-metalines)
+      
       ;; Run the final hook
       (run-hooks 'org-export-preprocess-final-hook)
 
@@ -1421,38 +1187,48 @@ on this string to produce the exported version."
 
 (defun org-export-define-heading-targets (target-alist)
   "Find all headings and define the targets for them.
-The new targets are added to TARGET-ALIST, which is also returned."
+The new targets are added to TARGET-ALIST, which is also returned.
+Also find all ID and CUSTOM_ID properties and store them."
   (goto-char (point-min))
   (org-init-section-numbers)
   (let ((re (concat "^" org-outline-regexp
-                   "\\| [ \t]*:\\(ID\\|CUSTOM_ID\\):[ \t]*\\([^ \t\r\n]+\\)"))
+                   "\\|"
+                   "^[ \t]*:\\(ID\\|CUSTOM_ID\\):[ \t]*\\([^ \t\r\n]+\\)"))
        level target last-section-target a id)
     (while (re-search-forward re nil t)
-      (if (match-end 2)
-         (progn
-           (setq id (org-match-string-no-properties 2))
-           (push (cons id target) target-alist)
-           (setq a (or (assoc last-section-target org-export-target-aliases)
-                       (progn
-                         (push (list last-section-target)
-                               org-export-target-aliases)
-                         (car org-export-target-aliases))))
-           (push (caar target-alist) (cdr a))
-           (when (equal (match-string 1) "CUSTOM_ID")
-             (if (not (assoc last-section-target
-                             org-export-preferred-target-alist))
-                 (push (cons last-section-target id)
-                       org-export-preferred-target-alist))))
-       (setq level (org-reduced-level
-                    (save-excursion (goto-char (point-at-bol))
-                                    (org-outline-level))))
-       (setq target (org-solidify-link-text
-                     (format "sec-%s" (org-section-number level))))
-       (setq last-section-target target)
-       (push (cons target target) target-alist)
-       (add-text-properties
-        (point-at-bol) (point-at-eol)
-        (list 'target target)))))
+      (org-if-unprotected-at (match-beginning 0)
+       (if (match-end 2)
+           (progn
+             (setq id (org-match-string-no-properties 2))
+             (push (cons id target) target-alist)
+             (setq a (or (assoc last-section-target org-export-target-aliases)
+                         (progn
+                           (push (list last-section-target)
+                                 org-export-target-aliases)
+                           (car org-export-target-aliases))))
+             (push (caar target-alist) (cdr a))
+             (when (equal (match-string 1) "CUSTOM_ID")
+               (if (not (assoc last-section-target
+                               org-export-preferred-target-alist))
+                   (push (cons last-section-target id)
+                         org-export-preferred-target-alist)))
+             (when (equal (match-string 1) "ID")
+               (if (not (assoc last-section-target
+                               org-export-id-target-alist))
+                   (push (cons last-section-target (concat "ID-" id))
+                         org-export-id-target-alist))))
+         (setq level (org-reduced-level
+                      (save-excursion (goto-char (point-at-bol))
+                                      (org-outline-level))))
+         (setq target (org-solidify-link-text
+                       (format "sec-%s" (replace-regexp-in-string
+                                         "\\." "_"
+                                         (org-section-number level)))))
+         (setq last-section-target target)
+         (push (cons target target) target-alist)
+         (add-text-properties
+          (point-at-bol) (point-at-eol)
+          (list 'target target))))))
   target-alist)
 
 (defun org-export-handle-invisible-targets (target-alist)
@@ -1488,7 +1264,7 @@ This function also handles the id links, if they have a match in
 the current file."
   (goto-char (point-min))
   (while (re-search-forward org-bracket-link-regexp nil t)
-    (org-if-unprotected
+    (org-if-unprotected-at (1+ (match-beginning 0))
      (let* ((md (match-data))
            (desc (match-end 2))
            (link (org-link-unescape (match-string 1)))
@@ -1535,12 +1311,23 @@ the current file."
         (unless desc (insert "][" link))
         (add-text-properties pos (point) props))))))
 
+(defun org-export-remember-html-container-classes ()
+  "Store the HTML_CONTAINER_CLASS properties in a text property."
+  (goto-char (point-min))
+  (let (class)
+    (while (re-search-forward
+           "^[ \t]*:HTML_CONTAINER_CLASS:[ \t]+\\(\\S-+\\)" nil t)
+      (setq class (match-string 1))
+      (save-excursion
+       (org-back-to-heading t)
+       (put-text-property (point-at-bol) (point-at-eol) 'html-container-class class)))))
+
 (defvar org-export-format-drawer-function nil
   "Function to be called to format the contents of a drawer.
 The function must accept three parameters:
-  BACKEND  one of the symbols html, docbook, latex, ascii, xoxo
   NAME     the drawer name, like \"PROPERTIES\"
   CONTENT  the content of the drawer.
+  BACKEND  one of the symbols html, docbook, latex, ascii, xoxo
 The function should return the text to be inserted into the buffer.
 If this is nil, `org-export-format-drawer' is used as a default.")
 
@@ -1739,6 +1526,7 @@ from the buffer."
   (let ((formatters
         '((docbook "DOCBOOK" "BEGIN_DOCBOOK" "END_DOCBOOK")
           (html "HTML" "BEGIN_HTML" "END_HTML")
+          (beamer "BEAMER" "BEGIN_BEAMER" "END_BEAMER")
           (ascii "ASCII" "BEGIN_ASCII" "END_ASCII")
           (latex "LaTeX" "BEGIN_LaTeX" "END_LaTeX")))
        (case-fold-search t)
@@ -1746,15 +1534,25 @@ from the buffer."
 
     (while formatters
       (setq fmt (pop formatters))
-      (when (eq (car fmt) backend)
-       ;; This is selected code, put it into the file for real
-       (goto-char (point-min))
-       (while (re-search-forward (concat "^\\([ \t]*\\)#\\+" (cadr fmt)
-                                         ":[ \t]*\\(.*\\)") nil t)
+      ;; Handle #+Backend: stuff
+      (goto-char (point-min))
+      (while (re-search-forward (concat "^\\([ \t]*\\)#\\+" (cadr fmt)
+                                       ":[ \t]*\\(.*\\)") nil t)
+       (if (not (eq (car fmt) backend))
+           (delete-region (point-at-bol) (min (1+ (point-at-eol)) (point-max)))
          (replace-match "\\1\\2" t)
          (add-text-properties
           (point-at-bol) (min (1+ (point-at-eol)) (point-max))
           '(org-protected t))))
+      ;; Delete #+attr_Backend: stuff of another backend. Those
+      ;; matching the current backend will be taken care of by
+      ;; `org-export-attach-captions-and-attributes'
+      (goto-char (point-min))
+      (while (re-search-forward (concat "^\\([ \t]*\\)#\\+attr_" (cadr fmt)
+                                       ":[ \t]*\\(.*\\)") nil t)
+       (when (not (eq (car fmt) backend))
+         (delete-region (point-at-bol) (min (1+ (point-at-eol)) (point-max)))))
+      ;; Handle #+begin_Backend and #+end_Backend stuff
       (goto-char (point-min))
       (while (re-search-forward (concat "^[ \t]*#\\+" (caddr fmt) "\\>.*\n?")
                                nil t)
@@ -1788,8 +1586,8 @@ These special cookies will later be interpreted by the backend."
       (setq beg (match-beginning 0)
            beg1 (1+ (match-end 0)))
       (when (re-search-forward (concat "^[ \t]*#\\+end_" type "\\>.*") nil t)
-       (setq end (1+ (point-at-eol))
-             end1 (1- (match-beginning 0)))
+       (setq end1 (1- (match-beginning 0))
+             end (+ (point-at-eol) (if (looking-at "\n$") 1 0)))
        (setq content (org-remove-indentation (buffer-substring beg1 end1)))
        (setq content (concat "ORG-" (upcase t1) "-START\n"
                              content "\n"
@@ -1811,38 +1609,55 @@ table line.  If it is a link, add it to the line containing the link."
                    "\\|"
                    "^[ \t]*#\\+label:[ \t]+\\(.*\\)"
                    "\\|"
-                   "^[ \t]*|[^-]"
+                   "^[ \t]*\\(|[^-]\\)"
                    "\\|"
                    "^[ \t]*\\[\\[.*\\]\\][ \t]*$"))
-       cap attr label)
+       cap shortn attr label end)
     (while (re-search-forward re nil t)
       (cond
        ((match-end 1)
-       (setq cap (concat cap (if cap " " "") (org-trim (match-string 1)))))
+       (progn
+         (setq cap (concat cap (if cap " " "") (org-trim (match-string 1))))
+         (when (string-match "\\[\\(.*\\)\\]{\\(.*\\)}" cap)
+           (setq shortn (match-string 1 cap)
+                 cap (match-string 2 cap)))
+         (delete-region (point-at-bol) (min (1+ (point-at-eol)) (point-max)))))
        ((match-end 2)
-       (setq attr (concat attr (if attr " " "") (org-trim (match-string 2)))))
+       (progn
+         (setq attr (concat attr (if attr " " "") (org-trim (match-string 2))))
+         (delete-region (point-at-bol) (min (1+ (point-at-eol)) (point-max)))))
        ((match-end 3)
-       (setq label (org-trim (match-string 3))))
+       (progn
+         (setq label (org-trim (match-string 3)))
+         (delete-region (point-at-bol) (min (1+ (point-at-eol)) (point-max)))))
        (t
-       (add-text-properties (point-at-bol) (point-at-eol)
+       (setq end (if (match-end 4)
+                     (let ((ee (org-table-end)))
+                       (prog1 (1- (marker-position ee)) (move-marker ee nil)))
+                   (point-at-eol)))
+       (add-text-properties (point-at-bol) end
                             (list 'org-caption cap
+                                  'org-caption-shortn shortn
                                   'org-attributes attr
                                   'org-label label))
        (if label (push (cons label label) target-alist))
+       (goto-char end)
        (setq cap nil attr nil label nil)))))
   target-alist)
 
 (defun org-export-remove-comment-blocks-and-subtrees ()
   "Remove the comment environment, and also commented subtrees."
   (let ((re-commented (concat "^\\*+[ \t]+" org-comment-string "\\>"))
-       (case-fold-search nil))
+       case-fold-search)
     ;; Remove comment environment
     (goto-char (point-min))
+    (setq case-fold-search t)
     (while (re-search-forward
-           "^#\\+BEGIN_COMMENT[ \t]*\n[^\000]*?^#\\+END_COMMENT\\>.*" nil t)
+           "^#\\+begin_comment[ \t]*\n[^\000]*?^#\\+end_comment\\>.*" nil t)
       (replace-match "" t t))
     ;; Remove subtrees that are commented
     (goto-char (point-min))
+    (setq case-fold-search nil)
     (while (re-search-forward re-commented nil t)
       (goto-char (match-beginning 0))
       (delete-region (point) (org-end-of-subtree t)))))
@@ -1851,21 +1666,36 @@ table line.  If it is a link, add it to the line containing the link."
   "Remove comments, or convert to backend-specific format.
 COMMENTSP can be a format string for publishing comments.
 When it is nil, all comments will be removed."
-  (let ((re "^\\(#\\|[ \t]*#\\+\\)\\(.*\n?\\)")
+  (let ((re "^\\(#\\|[ \t]*#\\+ \\)\\(.*\n?\\)")
        pos)
     (goto-char (point-min))
     (while (or (looking-at re)
               (re-search-forward re nil t))
       (setq pos (match-beginning 0))
-      (if (and commentsp
-              (not (equal (char-before (match-end 1)) ?+)))
-         (progn (add-text-properties
-                 (match-beginning 0) (match-end 0) '(org-protected t))
-                (replace-match (format commentsp (match-string 2)) t t))
+      (if (get-text-property pos 'org-protected)
+         (goto-char (1+ pos))
+       (if (and commentsp
+                (not (equal (char-before (match-end 1)) ?+)))
+           (progn (add-text-properties
+                   (match-beginning 0) (match-end 0) '(org-protected t))
+                  (replace-match (format commentsp (match-string 2)) t t))
+         (goto-char (1+ pos))
+         (replace-match "")
+         (goto-char (max (point-min) (1- pos))))))))
+
+(defun org-export-handle-table-metalines ()
+  "Remove table specific metalines #+TBLNAME: and #+TBLFM:."
+  (let ((re "^[ \t]*#\\+TBL\\(NAME\\|FM\\):\\(.*\n?\\)")
+       pos)
+    (goto-char (point-min))
+    (while (or (looking-at re)
+              (re-search-forward re nil t))
+      (setq pos (match-beginning 0))
+      (if (get-text-property (point) 'org-protected)
+         (goto-char (1+ pos))
        (goto-char (1+ pos))
-       (org-if-unprotected
-        (replace-match "")
-        (goto-char (max (point-min) (1- pos))))))))
+       (replace-match "")
+       (goto-char (max (point-min) (1- pos)))))))
 
 (defun org-export-mark-radio-links ()
   "Find all matches for radio targets and turn them into internal links."
@@ -1877,7 +1707,8 @@ When it is nil, all comments will be removed."
        (unless
            (save-match-data
              (or (org-in-regexp org-bracket-link-regexp)
-                 (org-in-regexp org-plain-link-re)))
+                 (org-in-regexp org-plain-link-re)
+                 (org-in-regexp "<<[^<>]+>>")))
          (org-if-unprotected
           (replace-match "\\1[[\\2]]")))))))
 
@@ -1885,22 +1716,23 @@ When it is nil, all comments will be removed."
   "Remove tables lines that are used for internal purposes."
   (goto-char (point-min))
   (while (re-search-forward "^[ \t]*|" nil t)
-    (beginning-of-line 1)
-    (if (or (looking-at "[ \t]*| *[!_^] *|")
-           (not 
-            (memq
-             nil
-             (mapcar
-              (lambda (f)
-                (or (= (length f) 0)
-                    (string-match
-                     "\\`<\\([0-9]\\|[rl]\\|[rl][0-9]+\\)>\\'" f)))
-              (org-split-string ;; FIXME, can't we do this without splitting???
-               (buffer-substring (point-at-bol) (point-at-eol))
-               "[ \t]*|[ \t]*")))))
-       (delete-region (max (point-min) (1- (point-at-bol)))
-                      (point-at-eol))
-      (end-of-line 1))))
+    (org-if-unprotected-at (1- (point))
+      (beginning-of-line 1)
+      (if (or (looking-at "[ \t]*| *[!_^] *|")
+             (not
+              (memq
+               nil
+               (mapcar
+                (lambda (f)
+                  (or (= (length f) 0)
+                      (string-match
+                       "\\`<\\([0-9]\\|[rl]\\|[rl][0-9]+\\)>\\'" f)))
+                (org-split-string ;; FIXME, can't we do without splitting???
+                 (buffer-substring (point-at-bol) (point-at-eol))
+                 "[ \t]*|[ \t]*")))))
+         (delete-region (max (point-min) (1- (point-at-bol)))
+                        (point-at-eol))
+       (end-of-line 1)))))
 
 (defun org-export-protect-sub-super (s)
   (save-match-data
@@ -1962,7 +1794,7 @@ This is to make sure that the line-processing export backends
 can work correctly."
   (goto-char (point-min))
   (while (re-search-forward "\\(\\(\\[\\|\\]\\)\\[[^]]*?\\)[ \t]*\n[ \t]*\\([^]]*\\]\\(\\[\\|\\]\\)\\)" nil t)
-    (org-if-unprotected
+    (org-if-unprotected-at (match-beginning 1)
      (replace-match "\\1 \\3")
      (goto-char (match-beginning 0)))))
 
@@ -2181,7 +2013,7 @@ TYPE must be a string, any of:
 (defun org-export-handle-include-files ()
   "Include the contents of include files, with proper formatting."
   (let ((case-fold-search t)
-       params file markup lang start end prefix prefix1 switches)
+       params file markup lang start end prefix prefix1 switches all)
     (goto-char (point-min))
     (while (re-search-forward "^#\\+INCLUDE:?[ \t]+\\(.*\\)" nil t)
       (setq params (read (concat "(" (match-string 1) ")"))
@@ -2198,6 +2030,7 @@ TYPE must be a string, any of:
              (not (file-exists-p file))
              (not (file-readable-p file)))
          (insert (format "CANNOT INCLUDE FILE %s" file))
+       (setq all (cons file all))
        (when markup
          (if (equal (downcase markup) "src")
              (setq start (format "#+begin_src %s %s\n"
@@ -2210,7 +2043,20 @@ TYPE must be a string, any of:
        (insert (org-get-file-contents (expand-file-name file)
                                       prefix prefix1 markup))
        (or (bolp) (newline))
-       (insert (or end ""))))))
+       (insert (or end ""))))
+    all))
+
+(defun org-export-handle-include-files-recurse ()
+  "Recursively include files aborting on circular inclusion."
+  (let ((now (list org-current-export-file)) all)
+    (while now
+      (setq all (append now all))
+      (setq now (org-export-handle-include-files))
+      (let ((intersection
+            (delq nil
+                  (mapcar (lambda (el) (when (member el all) el)) now))))
+       (when intersection
+         (error "Recursive #+INCLUDE: %S" intersection))))))
 
 (defun org-get-file-contents (file &optional prefix prefix1 markup)
   "Get the contents of FILE and return them as a string.
@@ -2225,7 +2071,7 @@ take care of the block they are in."
       (goto-char (point-min))
       (while (not (eobp))
        (insert (or prefix1 prefix))
-       (setq prefix1 nil)
+       (setq prefix1 "")
        (beginning-of-line 2)))
     (buffer-string)
     (when (member markup '("src" "example"))
@@ -2263,24 +2109,36 @@ in the list) and remove property and value from the list in LISTVAR."
   "Replace source code segments with special code for export."
   (setq org-export-last-code-line-counter-value 0)
   (let ((case-fold-search t)
-       lang code trans opts indent)
+       lang code trans opts indent caption)
     (goto-char (point-min))
     (while (re-search-forward
-           "\\(^\\([ \t]*\\)#\\+BEGIN_SRC:?[ \t]+\\([^ \t\n]+\\)\\(.*\\)\n\\([^\000]+?\n\\)[ \t]*#\\+END_SRC.*\\)\\|\\(^\\([ \t]*\\)#\\+BEGIN_EXAMPLE:?\\(?:[ \t]+\\(.*\\)\\)?\n\\([^\000]+?\n\\)[ \t]*#\\+END_EXAMPLE.*\\)"
+           "\\(^\\([ \t]*\\)#\\+BEGIN_SRC:?\\([ \t]+\\([^ \t\n]+\\)\\)?\\(.*\\)\n\\([^\000]+?\n\\)[ \t]*#\\+END_SRC.*\n?\\)\\|\\(^\\([ \t]*\\)#\\+BEGIN_EXAMPLE:?\\(?:[ \t]+\\(.*\\)\\)?\n\\([^\000]+?\n\\)[ \t]*#\\+END_EXAMPLE.*\n?\\)"
            nil t)
       (if (match-end 1)
-         ;; src segments
-         (setq lang (match-string 3)
-               opts (match-string 4)
-               code (match-string 5)
-               indent (length (match-string 2)))
+         (if (not (match-string 4))
+             (error "Source block missing language specification: %s"
+                    (let* ((body (match-string 6))
+                           (nothing (message "body:%s" body))
+                           (preview (or (and (string-match
+                                              "^[ \t]*\\([^\n\r]*\\)" body)
+                                             (match-string 1 body)) body)))
+                      (if (> (length preview) 35)
+                          (concat (substring preview 0 32) "...")
+                        preview)))
+           ;; src segments
+           (setq lang (match-string 4)
+                 opts (match-string 5)
+                 code (match-string 6)
+                 indent (length (match-string 2))
+                 caption (get-text-property 0 'org-caption (match-string 0))))
        (setq lang nil
-             opts (match-string 8)
-             code (match-string 9)
-             indent (length (match-string 7))))
+             opts (match-string 9)
+             code (match-string 10)
+             indent (length (match-string 8))
+              caption (get-text-property 0 'org-caption (match-string 0))))
 
       (setq trans (org-export-format-source-code-or-example
-                  backend lang code opts indent))
+                  backend lang code opts indent caption))
       (replace-match trans t t))))
 
 (defvar htmlp)  ;; dynamically scoped
@@ -2290,7 +2148,7 @@ in the list) and remove property and value from the list in LISTVAR."
 (defvar org-export-latex-listings-langs) ;; defined in org-latex.el
 
 (defun org-export-format-source-code-or-example
-  (backend lang code &optional opts indent)
+  (backend lang code &optional opts indent caption)
   "Format CODE from language LANG and return it formatted for export.
 If LANG is nil, do not add any fontification.
 OPTS contains formatting options, like `-n' for triggering numbering lines,
@@ -2341,13 +2199,15 @@ INDENT was the original indentation of the block."
              (concat "\n#+BEGIN_DOCBOOK\n"
                      (org-add-props (concat "<programlisting><![CDATA["
                                             rtn
-                                            "]]>\n</programlisting>\n")
-                         '(org-protected t))
+                                            "]]></programlisting>\n")
+                         '(org-protected t org-example t))
                      "#+END_DOCBOOK\n"))
             ((eq backend 'html)
              ;; We are exporting to HTML
              (when lang
-               (require 'htmlize nil t)
+               (if (featurep 'xemacs)
+                   (require 'htmlize)
+                 (require 'htmlize nil t))
                (when (not (fboundp 'htmlize-region-for-paste))
                  ;; we do not have htmlize.el, or an old version of it
                  (setq lang nil)
@@ -2378,12 +2238,22 @@ INDENT was the original indentation of the block."
                            (org-export-htmlize-region-for-paste
                             (point-min) (point-max))))
                    (if (string-match "<pre\\([^>]*\\)>\n*" rtn)
-                       (setq rtn (replace-match
-                                  (format "<pre class=\"src src-%s\">\n" lang)
-                                  t t rtn))))
+                       (setq rtn
+                              (concat
+                               (if caption
+                                   (concat
+                                    "<div class=\"org-src-container\">"
+                                    (format
+                                     "<label class=\"org-src-name\">%s</label>"
+                                     caption))
+                                 "")
+                               (replace-match
+                                (format "<pre class=\"src src-%s\">\n" lang)
+                                t t rtn)
+                               (if caption "</div>" "")))))
                (if textareap
                    (setq rtn (concat
-                              (format "<p>\n<textarea cols=\"%d\" rows=\"%d\" overflow-x:scroll >\n"
+                              (format "<p>\n<textarea cols=\"%d\" rows=\"%d\">"
                                       cols rows)
                               rtn "</textarea>\n</p>\n"))
                  (with-temp-buffer
@@ -2400,10 +2270,10 @@ INDENT was the original indentation of the block."
                                                   cont rpllbl fmt)))
              (if (string-match "\\(\\`<[^>]*>\\)\n" rtn)
                  (setq rtn (replace-match "\\1" t nil rtn)))
-             (concat "\n#+BEGIN_HTML\n" (org-add-props rtn '(org-protected t)) "\n#+END_HTML\n\n"))
+             (concat "\n#+BEGIN_HTML\n" (org-add-props rtn '(org-protected t org-example t)) "\n#+END_HTML\n\n"))
             ((eq backend 'latex)
              (setq rtn (org-export-number-lines rtn 'latex 0 0 num cont rpllbl fmt))
-             (concat "\n#+BEGIN_LaTeX\n"
+             (concat "#+BEGIN_LaTeX\n"
                      (org-add-props
                           (if org-export-latex-listings
                               (concat
@@ -2417,17 +2287,20 @@ INDENT was the original indentation of the block."
                                               org-export-latex-listings-langs))
                                             lang)))
                                      (format "\\lstset{language=%s}\n" lstlang))
-                                 "")
+                                 "\n")
+                               (when caption
+                                 (format "\n%s $\\equiv$ \n" caption))
                                "\\begin{lstlisting}\n"
                                rtn "\\end{lstlisting}\n")
                             (concat (car org-export-latex-verbatim-wrap)
                                     rtn (cdr org-export-latex-verbatim-wrap)))
-                         '(org-protected t))
-                     "#+END_LaTeX\n\n"))
+                         '(org-protected t org-example t))
+                     "#+END_LaTeX\n"))
             ((eq backend 'ascii)
              ;; This is not HTML or LaTeX, so just make it an example.
              (setq rtn (org-export-number-lines rtn 'ascii 0 0 num cont rpllbl fmt))
-             (concat "#+BEGIN_ASCII\n"
+             (concat caption "\n"
+                      "#+BEGIN_ASCII\n"
                      (org-add-props
                          (concat
                           (mapconcat
@@ -2435,7 +2308,7 @@ INDENT was the original indentation of the block."
                            (org-split-string rtn "\n")
                            "\n")
                           "\n")
-                         '(org-protected t))
+                         '(org-protected t org-example t))
                      "#+END_ASCII\n"))))
       (org-add-props rtn nil 'original-indentation indent))))
 
@@ -2538,22 +2411,27 @@ INDENT was the original indentation of the block."
 (defun org-export-visible (type arg)
   "Create a copy of the visible part of the current buffer, and export it.
 The copy is created in a temporary buffer and removed after use.
-TYPE is the final key (as a string) that also select the export command in
-the `C-c C-e' export dispatcher.
+TYPE is the final key (as a string) that also selects the export command in
+the \\<org-mode-map>\\[org-export] export dispatcher.
 As a special case, if the you type SPC at the prompt, the temporary
 org-mode file will not be removed but presented to you so that you can
 continue to use it.  The prefix arg ARG is passed through to the exporting
 command."
   (interactive
    (list (progn
-          (message "Export visible: [a]SCII  [h]tml  [b]rowse HTML [H/R]uffer with HTML  [D]ocBook  [x]OXO  [ ]keep buffer")
+          (message "Export visible: [a]SCII  [h]tml  [b]rowse HTML [H/R]buffer with HTML  [D]ocBook  [l]atex  [p]df  [d]view pdf  [L]atex buffer  [x]OXO  [ ]keep buffer")
           (read-char-exclusive))
         current-prefix-arg))
-  (if (not (member type '(?a ?\C-a ?b ?\C-b ?h ?D ?x ?\ )))
+  (if (not (member type '(?a ?n ?u ?\C-a ?b ?\C-b ?h ?D ?x ?\ ?l ?p ?d ?L)))
       (error "Invalid export key"))
   (let* ((binding (cdr (assoc type
-                             '((?a . org-export-as-ascii)
+                             '(
+                               (?a . org-export-as-ascii)
                                (?A . org-export-as-ascii-to-buffer)
+                               (?n . org-export-as-latin1)
+                               (?N . org-export-as-latin1-to-buffer)
+                               (?u . org-export-as-utf8)
+                               (?U . org-export-as-utf8-to-buffer)
                                (?\C-a . org-export-as-ascii)
                                (?b . org-export-as-html-and-open)
                                (?\C-b . org-export-as-html-and-open)
@@ -2561,6 +2439,12 @@ command."
                                (?H . org-export-as-html-to-buffer)
                                (?R . org-export-region-as-html)
                                (?D . org-export-as-docbook)
+
+                               (?l . org-export-as-latex)
+                               (?p . org-export-as-pdf)
+                               (?d . org-export-as-pdf-and-open)
+                               (?L . org-export-as-latex-to-buffer)
+
                                (?x . org-export-as-xoxo)))))
         (keepp (equal type ?\ ))
         (file buffer-file-name)
@@ -2655,7 +2539,8 @@ directory."
                          filename)))
         (backup-inhibited t)
         (buffer (find-file-noselect filename))
-        (region (buffer-string)))
+        (region (buffer-string))
+         str-ret)
     (save-excursion
       (switch-to-buffer buffer)
       (erase-buffer)
@@ -2701,7 +2586,11 @@ directory."
            (write-file (concat filename ".html")))
          (kill-buffer newbuf)))
       (set-buffer-modified-p nil)
-      (kill-buffer (current-buffer)))))
+      (if (equal to-buffer 'string)
+          (progn (setq str-ret (buffer-string))
+                 (kill-buffer (current-buffer))
+                 str-ret)
+        (kill-buffer (current-buffer))))))
 
 (defvar org-archive-location)  ;; gets loaded with the org-archive require.
 (defun org-get-current-options ()
@@ -2723,6 +2612,7 @@ Does include HTML export options as well as TODO and CATEGORY stuff."
 #+EXPORT_EXCLUDE_TAGS: %s
 #+LINK_UP:   %s
 #+LINK_HOME: %s
+#+XSLT: 
 #+CATEGORY:  %s
 #+SEQ_TODO:  %s
 #+TYP_TODO:  %s
@@ -2815,13 +2705,16 @@ If yes remove the column and the special lines."
                                "^[ \t]*| *\\([\#!$*_^ /]\\) *|")
                              x)))
             lines))
+      ;; No special marking column
       (progn
        (setq org-table-clean-did-remove-column nil)
        (delq nil
              (mapcar
               (lambda (x)
                 (cond
-                 ((string-match  "^[ \t]*| */ *|" x)
+                 ((org-table-colgroup-line-p x)
+                  ;; This line contains colgroup info, extract it
+                  ;; and then discard the line
                   (setq org-table-colgroup-info
                         (mapcar (lambda (x)
                                   (cond ((member x '("<" "&lt;")) :start)
@@ -2830,14 +2723,20 @@ If yes remove the column and the special lines."
                                         (t nil)))
                                 (org-split-string x "[ \t]*|[ \t]*")))
                   nil)
+                 ((org-table-cookie-line-p x)
+                  ;; This line contains formatting cookies, discard it
+                  nil)
                  (t x)))
               lines)))
+    ;; there is a special marking column
     (setq org-table-clean-did-remove-column t)
     (delq nil
          (mapcar
           (lambda (x)
             (cond
-             ((string-match  "^[ \t]*| */ *|" x)
+             ((org-table-colgroup-line-p x)
+              ;; This line contains colgroup info, extract it
+              ;; and then discard the line
               (setq org-table-colgroup-info
                     (mapcar (lambda (x)
                               (cond ((member x '("<" "&lt;")) :start)
@@ -2846,8 +2745,12 @@ If yes remove the column and the special lines."
                                     (t nil)))
                             (cdr (org-split-string x "[ \t]*|[ \t]*"))))
               nil)
+             ((org-table-cookie-line-p x)
+              ;; This line contains formatting cookies, discard it
+              nil)
              ((string-match "^[ \t]*| *[!_^/] *|" x)
-              nil) ; ignore this line
+              ;; ignore this line
+              nil)
              ((or (string-match "^\\([ \t]*\\)|-+\\+" x)
                   (string-match "^\\([ \t]*\\)|[^|]*|" x))
               ;; remove the first column
@@ -2869,41 +2772,6 @@ If yes remove the column and the special lines."
     (setq s (replace-match "" t t s)))
   s)
 
-(defun org-create-multibrace-regexp (left right n)
-  "Create a regular expression which will match a balanced sexp.
-Opening delimiter is LEFT, and closing delimiter is RIGHT, both given
-as single character strings.
-The regexp returned will match the entire expression including the
-delimiters.  It will also define a single group which contains the
-match except for the outermost delimiters.  The maximum depth of
-stacked delimiters is N.  Escaping delimiters is not possible."
-  (let* ((nothing (concat "[^" left right "]*?"))
-        (or "\\|")
-        (re nothing)
-        (next (concat "\\(?:" nothing left nothing right "\\)+" nothing)))
-    (while (> n 1)
-      (setq n (1- n)
-           re (concat re or next)
-           next (concat "\\(?:" nothing left next right "\\)+" nothing)))
-    (concat left "\\(" re "\\)" right)))
-
-(defvar org-match-substring-regexp
-  (concat
-   "\\([^\\]\\)\\([_^]\\)\\("
-   "\\(" (org-create-multibrace-regexp "{" "}" org-match-sexp-depth) "\\)"
-   "\\|"
-   "\\(" (org-create-multibrace-regexp "(" ")" org-match-sexp-depth) "\\)"
-   "\\|"
-   "\\(\\(?:\\*\\|[-+]?[^-+*!@#$%^_ \t\r\n,:\"?<>~;./{}=()]+\\)\\)\\)")
-  "The regular expression matching a sub- or superscript.")
-
-(defvar org-match-substring-with-braces-regexp
-  (concat
-   "\\([^\\]\\)\\([_^]\\)\\("
-   "\\(" (org-create-multibrace-regexp "{" "}" org-match-sexp-depth) "\\)"
-   "\\)")
-  "The regular expression matching a sub- or superscript, forcing braces.")
-
 
 (defun org-get-text-property-any (pos prop &optional object)
   (or (get-text-property pos prop object)
index 2e5e63199a05a86ad9d68daa0c6eb37b9ab8bb55..740f2629f2bec58d49079a0c98feba47d7e7119c 100644 (file)
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33x
+;; Version: 7.01
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -49,7 +49,7 @@
 (defgroup org-faces nil
   "Faces in Org-mode."
   :tag "Org Faces"
-  :group 'org-font-lock)
+  :group 'org-appearance)
 
 (defface org-hide
   '((((background light)) (:foreground "white"))
@@ -338,29 +338,53 @@ This face is only used if `org-fontify-done-headline' is set.  If applies
 to the part of the headline after the DONE keyword."
   :group 'org-faces)
 
+(defcustom org-faces-easy-properties
+  '((todo . :foreground) (tag . :foreground) (priority . :foreground))
+  "The property changes by easy faces.
+This is an alist, the keys show the area of application, the values
+can be `:foreground' or `:background'.  A color string for special
+keywords will then be interpreted as either foreground or background
+color."
+  :group 'org-faces
+  :group 'org-todo
+  :type '(repeat
+         (cons (choice (const todo) (const tag) (const priority))
+               (choice (const :foreground) (const :background)))))
+
 (defcustom org-todo-keyword-faces nil
   "Faces for specific TODO keywords.
 This is a list of cons cells, with TODO keywords in the car
-and faces in the cdr.  The face can be a symbol, or a property
-list of attributes, like (:foreground \"blue\" :weight bold :underline t)."
+and faces in the cdr.  The face can be a symbol, a color
+as a string (in which case the rest is inherited from the `org-todo' face),
+or a property list of attributes, like
+   (:foreground \"blue\" :weight bold :underline t).
+If it is a color string, the variable `org-faces-easy-properties'
+determines if it is a foreground or a background color."
   :group 'org-faces
   :group 'org-todo
   :type '(repeat
          (cons
-          (string :tag "keyword")
-          (sexp :tag "face"))))
+          (string :tag "Keyword")
+          (choice :tag "Face   "
+           (string :tag "Color")
+           (sexp :tag "Face")))))
 
 (defcustom org-priority-faces nil
   "Faces for specific Priorities.
 This is a list of cons cells, with priority character in the car
-and faces in the cdr.  The face can be a symbol, or a property
-list of attributes, like (:foreground \"blue\" :weight bold :underline t)."
+and faces in the cdr.  The face can be a symbol, a color as
+as a string, or a property list of attributes, like
+    (:foreground \"blue\" :weight bold :underline t).
+If it is a color string, the variable `org-faces-easy-properties'
+determines if it is a foreground or a background color."
   :group 'org-faces
   :group 'org-todo
   :type '(repeat
          (cons
           (character :tag "Priority")
-          (sexp :tag "face"))))
+          (choice    :tag "Face    "
+           (string :tag "Color")
+           (sexp :tag "Face")))))
 
 (defvar org-tags-special-faces-re nil)
 (defun org-set-tag-faces (var value)
@@ -378,15 +402,16 @@ list of attributes, like (:foreground \"blue\" :weight bold :underline t)."
 
 
 (org-copy-face 'org-todo 'org-checkbox-statistics-todo
-              "Face used for unfinished checkbox statistics.")
+  "Face used for unfinished checkbox statistics.")
 
 (org-copy-face 'org-done 'org-checkbox-statistics-done
-              "Face used for finished checkbox statistics.")
+  "Face used for finished checkbox statistics.")
 
 (defcustom org-tag-faces nil
   "Faces for specific tags.
 This is a list of cons cells, with tags in the car and faces in the cdr.
-The face can be a symbol, or a property list of attributes,
+The face can be a symbol, a foreground color (in which case the rest is
+inherited from the `org-tag' face) or a property list of attributes,
 like (:foreground \"blue\" :weight bold :underline t).
 If you set this variable through customize, it will immediately be effective
 in new buffers and in modified lines.
@@ -397,8 +422,10 @@ changes."
   :set 'org-set-tag-faces
   :type '(repeat
          (cons
-          (string :tag "Tag")
-          (sexp :tag "Face"))))
+          (string :tag "Tag ")
+          (choice :tag "Face"
+           (string :tag "Foreground color")
+           (sexp :tag "Face")))))
 
 (defface org-table ;; originally copied from font-lock-function-name-face
   (org-compatible-face nil
@@ -431,7 +458,7 @@ changes."
        (:foreground "green"))
       (((class color) (min-colors 8) (background dark))
        (:foreground "yellow"))))
-  "Face for fixed-with text like code snippets."
+  "Face for fixed-width text like code snippets."
   :group 'org-faces
   :version "22.1")
 
@@ -441,6 +468,34 @@ changes."
   :group 'org-faces
   :version "22.1")
 
+(defface org-document-title
+  '((((class color) (background light)) (:foreground "midnight blue" :weight bold :height 1.44))
+    (((class color) (background dark)) (:foreground "pale turquoise" :weight bold :height 1.44))
+    (t (:weight bold :height 1.44)))
+  "Face for document title, i.e. that which follows the #+TITLE: keyword."
+  :group 'org-faces)
+
+(defface org-document-info
+  '((((class color) (background light)) (:foreground "midnight blue"))
+    (((class color) (background dark)) (:foreground "pale turquoise"))
+    (t nil))
+  "Face for document date, author and email; i.e. that which
+follows a #+DATE:, #+AUTHOR: or #+EMAIL: keyword."
+  :group 'org-faces)
+
+(defface org-document-info-keyword
+  (org-compatible-face 'shadow
+    '((((class color grayscale) (min-colors 88) (background light))
+       (:foreground "grey50"))
+      (((class color grayscale) (min-colors 88) (background dark))
+       (:foreground "grey70"))
+      (((class color) (min-colors 8) (background light))
+       (:foreground "green"))
+      (((class color) (min-colors 8) (background dark))
+       (:foreground "yellow"))))
+  "Face for #+TITLE:, #+AUTHOR:, #+EMAIL: and #+DATE: keywords."
+  :group 'org-faces)
+
 (defface org-block
   (org-compatible-face 'shadow
     '((((class color grayscale) (min-colors 88) (background light))
@@ -474,6 +529,13 @@ changes."
 (org-copy-face 'org-block 'org-verse
    "Face for #+BEGIN_VERSE ... #+END_VERSE blocks.")
 
+(defcustom org-fontify-quote-and-verse-blocks nil
+  "Non-nil means, add a special face to #+begin_quote and #+begin_verse block.
+When nil, format these as normal Org.  This is the default, because the
+content of these blocks will still be treated as Org syntax."
+  :group 'org-faces
+  :type 'boolean)
+
 (defface org-clock-overlay ;; copied from secondary-selection
   (org-compatible-face nil
     '((((class color) (min-colors 88) (background light))
@@ -502,17 +564,17 @@ changes."
   :group 'org-faces)
 
 (org-copy-face 'org-agenda-structure 'org-agenda-date
-              "Face used in agenda for normal days.")
+  "Face used in agenda for normal days.")
 
 (org-copy-face 'org-agenda-date 'org-agenda-date-today
-              "Face used in agenda for today."
-              :weight 'bold :italic 't)
+  "Face used in agenda for today."
+  :weight 'bold :italic 't)
 
 (org-copy-face 'secondary-selection 'org-agenda-clocking
-              "Face marking the current clock item in the agenda.")
+  "Face marking the current clock item in the agenda.")
 
 (org-copy-face 'org-agenda-date 'org-agenda-date-weekend
-              "Face used in agenda for weekend days.
+  "Face used in agenda for weekend days.
 See the variable `org-agenda-weekend-days' for a definition of which days
 belong to the weekend."
               :weight 'bold)
@@ -538,7 +600,7 @@ belong to the weekend."
 (defface org-agenda-dimmed-todo-face
   '((((background light)) (:foreground "grey50"))
     (((background dark)) (:foreground "grey50")))
-  "Face used to dimm blocked tasks in the agenda."
+  "Face used to dim blocked tasks in the agenda."
   :group 'org-faces)
 
 (defface org-scheduled-previously
@@ -605,6 +667,12 @@ month and 365.24 days for a year)."
   "Face used for time grids."
   :group 'org-faces)
 
+(defface org-agenda-diary
+  (org-compatible-face 'default
+    nil)
+  "Face used for agenda entries that come from the Emacs diary."
+  :group 'org-faces)
+
 (defconst org-level-faces
   '(org-level-1 org-level-2 org-level-3 org-level-4
     org-level-5 org-level-6 org-level-7 org-level-8
@@ -634,7 +702,10 @@ If it is less than 8, the level-1 face gets re-used for level N+1 etc."
   :group 'org-faces)
 
 (org-copy-face 'modeline 'org-mode-line-clock
-              "Face used for clock display in mode line.")
+  "Face used for clock display in mode line.")
+(org-copy-face 'modeline 'org-mode-line-clock-overrun
+  "Face used for clock display for overrun tasks in mode line."
+  :background "red")
 
 (provide 'org-faces)
 
index df1e187e40d0319600d02dc1916ae55340d9adb4..9d14daea9dfd2bfff361340853082796915cfbcc 100644 (file)
@@ -5,7 +5,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33x
+;; Version: 7.01
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -45,7 +45,7 @@
 ;;  With this setup, the command `M-x org-feed-update-all' will
 ;;  collect new entries in the feed at the given URL and create
 ;;  entries as subheadings under the "ReQall Entries" heading in the
-;;  file "~/org-feeds.org".  Each feed should normally have its own
+;;  file "~/org/feeds.org".  Each feed should normally have its own
 ;;  heading - however see the `:drawer' parameter.
 ;;
 ;;  Besides these standard elements that need to be specified for each
@@ -83,8 +83,8 @@
 ;;
 ;;       #+DRAWERS: PROPERTIES LOGBOOK FEEDSTATUS
 ;;
-;;  Acknowledgements
-;;  ----------------
+;;  Acknowledgments
+;;  ---------------
 ;;
 ;;  org-feed.el is based on ideas by Brad Bozarth who implemented a
 ;;  similar mechanism using shell and awk scripts.
@@ -99,6 +99,7 @@
 (declare-function xml-get-children "xml" (node child-name))
 (declare-function xml-get-attribute "xml" (node attribute))
 (declare-function xml-get-attribute-or-nil "xml" (node attribute))
+(defvar xml-entity-alist)
 
 (defgroup org-feed  nil
   "Options concerning RSS feeds as inputs for Org files."
@@ -165,10 +166,11 @@ Here are the keyword-value pair allows in `org-feed-alist'.
      When the handler is called, point will be at the feed headline.
 
 :parse-feed function
-     This function gets passed a buffer, and should return a list of entries,
-     each being a property list containing the `:guid' and `:item-full-text'
-     keys.  The default is `org-feed-parse-rss-feed'; `org-feed-parse-atom-feed'
-     is an alternative.
+     This function gets passed a buffer, and should return a list
+     of entries, each being a property list containing the
+     `:guid' and `:item-full-text' keys.  The default is
+     `org-feed-parse-rss-feed'; `org-feed-parse-atom-feed' is an
+     alternative.
 
 :parse-entry function
      This function gets passed an entry as returned by the parse-feed
@@ -199,12 +201,12 @@ Here are the keyword-value pair allows in `org-feed-alist'.
                    (list :inline t :tag "Changed items"
                          (const :changed-handler)
                          (symbol :tag "Handler Function"))
-                    (list :inline t :tag "Parse Feed"
-                          (const :parse-feed)
-                          (symbol :tag "Parse Feed Function"))
-                    (list :inline t :tag "Parse Entry"
-                          (const :parse-entry)
-                          (symbol :tag "Parse Entry Function"))
+                   (list :inline t :tag "Parse Feed"
+                         (const :parse-feed)
+                         (symbol :tag "Parse Feed Function"))
+                   (list :inline t :tag "Parse Entry"
+                         (const :parse-entry)
+                         (symbol :tag "Parse Entry Function"))
                    )))))
 
 (defcustom org-feed-drawer "FEEDSTATUS"
@@ -234,7 +236,7 @@ following special escapes are valid as well:
   :type '(string :tag "Template"))
 
 (defcustom org-feed-save-after-adding t
-  "Non-nil means, save buffer after adding new feed items."
+  "Non-nil means save buffer after adding new feed items."
   :group 'org-feed
   :type 'boolean)
 
@@ -267,6 +269,17 @@ have been saved."
 (defvar org-feed-buffer "*Org feed*"
   "The buffer used to retrieve a feed.")
 
+(defun org-feed-unescape (s)
+  "Unescape protected entities in S."
+  (require 'xml)
+  (let ((re (concat "&\\("
+                   (mapconcat 'car xml-entity-alist "\\|")
+                   "\\);")))
+    (while (string-match re s)
+      (setq s (replace-match
+              (cdr (assoc (match-string 1 s) xml-entity-alist)) nil nil s)))
+    s))
+
 ;;;###autoload
 (defun org-feed-update-all ()
   "Get inbox items from all feeds in `org-feed-alist'."
@@ -302,10 +315,10 @@ it can be a list structured like an entry in `org-feed-alist'."
                        org-feed-default-template))
          (drawer (or (nth 1 (memq :drawer feed))
                      org-feed-drawer))
-          (parse-feed (or (nth 1 (memq :parse-feed feed))
-                          'org-feed-parse-rss-feed))
-          (parse-entry (or (nth 1 (memq :parse-entry feed))
-                           'org-feed-parse-rss-entry))
+         (parse-feed (or (nth 1 (memq :parse-feed feed))
+                         'org-feed-parse-rss-feed))
+         (parse-entry (or (nth 1 (memq :parse-entry feed))
+                          'org-feed-parse-rss-entry))
          feed-buffer inbox-pos new-formatted
          entries old-status status new changed guid-alist e guid olds)
       (setq feed-buffer (org-feed-get-feed url))
@@ -321,10 +334,11 @@ it can be a list structured like an entry in `org-feed-alist'."
          (setq old-status (org-feed-read-previous-status inbox-pos drawer))
          ;; Add the "handled" status to the appropriate entries
          (setq entries (mapcar (lambda (e)
-                                 (setq e (plist-put e :handled
-                                                    (nth 1 (assoc
-                                                            (plist-get e :guid)
-                                                            old-status)))))
+                                 (setq e
+                                       (plist-put e :handled
+                                                  (nth 1 (assoc
+                                                          (plist-get e :guid)
+                                                          old-status)))))
                                entries))
          ;; Find out which entries are new and which are changed
          (dolist (e entries)
@@ -579,11 +593,12 @@ Assumes headers are indeed present!"
   "Parse BUFFER for RSS feed entries.
 Returns a list of entries, with each entry a property list,
 containing the properties `:guid' and `:item-full-text'."
-  (let (entries beg end item guid entry)
+  (let ((case-fold-search t)
+       entries beg end item guid entry)
     (with-current-buffer buffer
       (widen)
       (goto-char (point-min))
-      (while (re-search-forward "<item>" nil t)
+      (while (re-search-forward "<item\\>.*?>" nil t)
        (setq beg (point)
              end (and (re-search-forward "</item>" nil t)
                       (match-beginning 0)))
@@ -605,7 +620,7 @@ containing the properties `:guid' and `:item-full-text'."
                              nil t)
       (setq entry (plist-put entry
                             (intern (concat ":" (match-string 1)))
-                            (match-string 2))))
+                            (org-feed-unescape (match-string 2)))))
     (goto-char (point-min))
     (unless (re-search-forward "isPermaLink[ \t]*=[ \t]*\"false\"" nil t)
       (setq entry (plist-put entry :guid-permalink t))))
@@ -618,14 +633,15 @@ containing the properties `:guid' and `:item-full-text'.
 
 The `:item-full-text' property actually contains the sexp
 formatted as a string, not the original XML data."
+  (require 'xml)
   (with-current-buffer buffer
     (widen)
     (let ((feed (car (xml-parse-region (point-min) (point-max)))))
       (mapcar
        (lambda (entry)
-         (list
-          :guid (car (xml-node-children (car (xml-get-children entry 'id))))
-          :item-full-text (prin1-to-string entry)))
+        (list
+         :guid (car (xml-node-children (car (xml-get-children entry 'id))))
+         :item-full-text (prin1-to-string entry)))
        (xml-get-children feed 'entry)))))
 
 (defun org-feed-parse-atom-entry (entry)
@@ -633,28 +649,36 @@ formatted as a string, not the original XML data."
   (let ((xml (car (read-from-string (plist-get entry :item-full-text)))))
     ;; Get first <link href='foo'/>.
     (setq entry (plist-put entry :link
-                           (xml-get-attribute
-                            (car (xml-get-children xml 'link))
-                            'href)))
+                          (xml-get-attribute
+                           (car (xml-get-children xml 'link))
+                           'href)))
     ;; Add <title/> as :title.
     (setq entry (plist-put entry :title
-                           (car (xml-node-children
-                                 (car (xml-get-children xml 'title))))))
+                          (org-feed-unescape
+                           (car (xml-node-children
+                                 (car (xml-get-children xml 'title)))))))
     (let* ((content (car (xml-get-children xml 'content)))
-           (type (xml-get-attribute-or-nil content 'type)))
+          (type (xml-get-attribute-or-nil content 'type)))
       (when content
-        (cond
-         ((string= type "text")
-          ;; We like plain text.
-          (setq entry (plist-put entry :description (car (xml-node-children content)))))
-         ((string= type "html")
-          ;; TODO: convert HTML to Org markup.
-          (setq entry (plist-put entry :description (car (xml-node-children content)))))
-         ((string= type "xhtml")
-          ;; TODO: convert XHTML to Org markup.
-          (setq entry (plist-put entry :description (prin1-to-string (xml-node-children content)))))
-         (t
-          (setq entry (plist-put entry :description (format "Unknown '%s' content." type)))))))
+       (cond
+        ((string= type "text")
+         ;; We like plain text.
+         (setq entry (plist-put entry :description
+                                (org-feed-unescape
+                                 (car (xml-node-children content))))))
+        ((string= type "html")
+         ;; TODO: convert HTML to Org markup.
+         (setq entry (plist-put entry :description
+                                (org-feed-unescape
+                                 (car (xml-node-children content))))))
+        ((string= type "xhtml")
+         ;; TODO: convert XHTML to Org markup.
+         (setq entry (plist-put entry :description
+                                (prin1-to-string
+                                 (xml-node-children content)))))
+        (t
+         (setq entry (plist-put entry :description
+                                (format "Unknown '%s' content." type)))))))
     entry))
 
 (provide 'org-feed)
index 5731daa066e0f41efe6865bcb9b775e3fe14873c..2a2c4c0f4269b8300b502a71a74c56451387082b 100644 (file)
@@ -5,7 +5,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33x
+;; Version: 7.01
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -47,6 +47,7 @@
 (declare-function org-back-to-heading "org" (&optional invisible-ok))
 (declare-function org-end-of-subtree "org"  (&optional invisible-ok to-heading))
 (declare-function org-in-verbatim-emphasis "org" ())
+(declare-function org-inside-latex-macro-p "org" ())
 (defvar org-odd-levels-only) ;; defined in org.el
 
 (defconst org-footnote-re
   (org-re "^\\(\\[\\([0-9]+\\|fn:[-_[:word:]]+\\)\\]\\)")
   "Regular expression matching the definition of a footnote.")
 
+(defgroup org-footnote nil
+  "Footnotes in Org-mode."
+  :tag "Org Footnote"
+  :group 'org)
+
 (defcustom org-footnote-section "Footnotes"
   "Outline heading containing footnote definitions before export.
 This can be nil, to place footnotes locally at the end of the current
@@ -74,7 +80,7 @@ automatically, i.e. when creating the footnote, and when sorting the notes.
 However, by hand you may place definitions *anywhere*.
 If this is a string, during export, all subtrees starting with this
 heading will be removed after extracting footnote definitions."
-  :group 'org-footnotes
+  :group 'org-footnote
   :type '(choice
          (string :tag "Collect footnotes under heading")
          (const :tag "Define footnotes locally" nil)))
@@ -86,11 +92,11 @@ as in Org-mode.  Outside Org-mode, new footnotes are always placed at
 the end of the file.  When you normalize the notes, any line containing
 only this tag will be removed, a new one will be inserted at the end
 of the file, followed by the collected and normalized footnotes."
-  :group 'org-footnotes
+  :group 'org-footnote
   :type 'string)
 
 (defcustom org-footnote-define-inline nil
-  "Non-nil means, define footnotes inline, at reference location.
+  "Non-nil means define footnotes inline, at reference location.
 When nil, footnotes will be defined in a special section near
 the end of the document.  When t, the [fn:label:definition] notation
 will be used to define the footnote at the reference position."
@@ -98,7 +104,7 @@ will be used to define the footnote at the reference position."
   :type 'boolean)
 
 (defcustom org-footnote-auto-label t
-  "Non-nil means, define automatically new labels for footnotes.
+  "Non-nil means define automatically new labels for footnotes.
 Possible values are:
 
 nil        prompt the user for each label
@@ -115,7 +121,7 @@ plain      Automatically create plain number labels like [1]"
          (const :tag "Create automatic [N]" plain)))
 
 (defcustom org-footnote-auto-adjust nil
-  "Non-nil means, automatically adjust footnotes after insert/delete.
+  "Non-nil means automatically adjust footnotes after insert/delete.
 When this is t, after each insertion or deletion of a footnote,
 simple fn:N footnotes will be renumbered, and all footnotes will be sorted.
 If you want to have just sorting or just renumbering, set this variable
@@ -132,7 +138,7 @@ The main values of this variable can be set with in-buffer options:
          (const :tag "Renumber and Sort" t)))
 
 (defcustom org-footnote-fill-after-inline-note-extraction nil
-  "Non-nil means, fill paragraphs after extracting footnotes.
+  "Non-nil means fill paragraphs after extracting footnotes.
 When extracting inline footnotes, the lengths of lines can change a lot.
 When this option is set, paragraphs from which an inline footnote has been
 extracted will be filled again."
@@ -181,25 +187,25 @@ with start and label of the footnote if there is a definition at point."
       (org-show-context 'link-search)
       (message "Edit definition and go back with `C-c &' or, if unique, with `C-c C-c'."))))
 
-(defun org-footnote-goto-next-reference (label)
-  "Find the definition of the footnote with label LABEL."
+(defun org-footnote-goto-previous-reference (label)
+  "Find the next previous of the footnote with label LABEL."
   (interactive "sLabel: ")
   (org-mark-ring-push)
   (setq label (org-footnote-normalize-label label))
   (let ((re (format ".\\[%s[]:]" label))
        (p0 (point)) pos)
     (save-excursion
-      (setq pos (or (re-search-forward re nil t)
-                   (and (goto-char (point-min))
-                        (re-search-forward re nil t))
+      (setq pos (or (re-search-backward re nil t)
+                   (and (goto-char (point-max))
+                        (re-search-backward re nil t))
                    (and (progn (widen) t)
                         (goto-char p0)
-                        (re-search-forward re nil t))
-                   (and (goto-char (point-min))
+                        (re-search-backward re nil t))
+                   (and (goto-char (point-max))
                         (re-search-forward re nil t)))))
     (if pos
        (progn
-         (goto-char pos)
+         (goto-char (match-end 0))
          (org-show-context 'link-search))
       (error "Cannot find reference of footnote %s" label))))
 
@@ -338,7 +344,7 @@ With prefix arg SPECIAL, offer additional commands in a menu."
          (org-footnote-goto-definition (nth 1 tmp))
        (goto-char (match-beginning 4))))
      ((setq tmp (org-footnote-at-definition-p))
-      (org-footnote-goto-next-reference (nth 1 tmp)))
+      (org-footnote-goto-previous-reference (nth 1 tmp)))
      (t (org-footnote-new)))))
 
 ;;;###autoload
@@ -366,7 +372,8 @@ referenced sequence."
       ;; Now find footnote references, and extract the definitions
       (goto-char (point-min))
       (while (re-search-forward org-footnote-re nil t)
-       (unless (or (org-in-commented-line) (org-in-verbatim-emphasis))
+       (unless (or (org-in-commented-line) (org-in-verbatim-emphasis)
+                   (org-inside-latex-macro-p))
          (org-if-unprotected
           (setq def (match-string 4)
                 idef def
@@ -397,13 +404,13 @@ referenced sequence."
                   (skip-chars-backward " \t\n\t")
                   (delete-region (1+ (point)) (match-beginning 0))))))
           (unless sort-only
-            (replace-match (concat before "[" marker "]"))
+            (replace-match (concat before "[" marker "]") t t)
             (and idef
                  org-footnote-fill-after-inline-note-extraction
                  (fill-paragraph)))
           (if (not a) (push (list ref marker def (if idef t nil))
                             ref-table)))))
-      
+
       ;; First find and remove the footnote section
       (goto-char (point-min))
       (cond
index ce923502ae92469085e67bfcd4479cd0dff8cfb2..06285e4b7d139fc224adaee9105deadd2616808b 100644 (file)
@@ -5,7 +5,7 @@
 ;; Author: Lennart Borgman (lennart O borgman A gmail O com)
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33x
+;; Version: 6.35i
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -81,6 +81,7 @@
 
 (require 'xml)
 (require 'org)
+(require 'rx)
 (require 'org-exp)
 (eval-when-compile (require 'cl))
 
@@ -240,7 +241,7 @@ The characters \"&<> will be escaped."
                       ;; file is utf-8:
                       ;;
                       ;; (format "&#x%x;" (- cc ;; ?\x800))
-                     (format "&#x%x" (encode-char cc 'ucs))
+                     (format "&#x%x;" (encode-char cc 'ucs))
                       ))))
     fm-str))
 
@@ -561,11 +562,10 @@ Otherwise give an error say the file exists."
              (num-top2-nodes 0)
              num-left-nodes
              (unclosed-nodes 0)
+            (odd-only org-odd-levels-only)
              (first-time t)
              (current-level 1)
              base-level
-             skipping-odd
-             (skipped-odd 0)
              prev-node-end
              rich-text
              unfinished-tag
@@ -671,21 +671,6 @@ Otherwise give an error say the file exists."
                 (setq next-node-start (match-beginning 0))
                 (setq next-m2 (match-string-no-properties 2))
                 (setq next-level (length next-m1))
-                (when (> next-level current-level)
-                  (if (not (and org-odd-levels-only
-                                (/= (mod current-level 2) 0)
-                                (= next-level (+ 2 current-level))))
-                      (setq skipping-odd nil)
-                    (setq skipping-odd t)
-                    (setq skipped-odd (1+ skipped-odd)))
-                  (unless (or (= next-level (1+ current-level))
-                              skipping-odd)
-                    (if (or org-odd-levels-only
-                            (/= next-level (+ 2 current-level)))
-                        (error "Next level step > +1 for node ending at line %s" (line-number-at-pos))
-                      (error "Next level step = +2 for node ending at line %s, forgot org-odd-levels-only?"
-                             (line-number-at-pos)))
-                    ))
                 (setq next-children-visible
                       (not (eq 'outline
                                (get-char-property (line-end-position) 'invisible))))
@@ -698,11 +683,8 @@ Otherwise give an error say the file exists."
                   (while (>= current-level next-level)
                     (with-current-buffer mm-buffer
                       (insert "</node>\n")
-                      (setq current-level (1- current-level))
-                      (when (< 0 skipped-odd)
-                        (setq skipped-odd (1- skipped-odd))
-                        (setq current-level (1- current-level)))
-                      )))
+                      (setq current-level
+                           (- current-level (if odd-only 2 1))))))
                 (setq this-node-end (1+ next-node-end))
                 (setq this-m2 next-m2)
                 (setq current-level next-level)
@@ -725,7 +707,8 @@ Otherwise give an error say the file exists."
           (with-current-buffer mm-buffer
             (while (> current-level base-level)
               (insert "</node>\n")
-              (setq current-level (1- current-level))
+             (setq current-level
+                   (- current-level (if odd-only 2 1)))
               ))
           (with-current-buffer mm-buffer
             (insert "</map>")
index 0fc61963f7756da9cbd6ed84fa0e371f8e34d821..f2fca8c29f42175b9dabb5c4968a7a4a69463549 100644 (file)
@@ -7,7 +7,7 @@
 ;;         Tassilo Horn <tassilo at member dot fsf dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33x
+;; Version: 7.01
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -48,7 +48,7 @@
   (defvaralias 'org-usenet-links-prefer-google 'org-gnus-prefer-web-links))
 
 (defcustom org-gnus-prefer-web-links nil
-  "Non-nil means, `org-store-link' will create web links to Google groups.
+  "If non-nil, `org-store-link' creates web links to Google groups or Gmane.
 When nil, Gnus will be used for such links.
 Using a prefix arg to the command \\[org-store-link] (`org-store-link')
 negates this setting for the duration of the command."
@@ -120,22 +120,26 @@ If `org-store-link' was called with a prefix arg the meaning of
 
    ((memq major-mode '(gnus-summary-mode gnus-article-mode))
     (let* ((group gnus-newsgroup-name)
-          (header (with-current-buffer gnus-summary-buffer
+          (header (with-current-buffer gnus-summary-buffer
                     (gnus-summary-article-header)))
           (from (mail-header-from header))
           (message-id (org-remove-angle-brackets (mail-header-id header)))
           (date (mail-header-date header))
-          (subject (mail-header-subject header))
-           (to (cdr (assq 'To (mail-header-extra header))))
-           newsgroups x-no-archive desc link)
+          (subject (copy-sequence (mail-header-subject header)))
+          (to (cdr (assq 'To (mail-header-extra header))))
+          newsgroups x-no-archive desc link)
+      ;; Remove text properties of subject string to avoid Emacs bug
+      ;; #3506
+      (set-text-properties 0 (length subject) nil subject)
+
       ;; Fetching an article is an expensive operation; newsgroup and
       ;; x-no-archive are only needed for web links.
       (when (org-xor current-prefix-arg org-gnus-prefer-web-links)
-        ;; Make sure the original article buffer is up-to-date
-        (save-window-excursion (gnus-summary-select-article))
-        (setq to (or to (gnus-fetch-original-field "To"))
-              newsgroups (gnus-fetch-original-field "Newsgroups")
-              x-no-archive (gnus-fetch-original-field "x-no-archive")))
+       ;; Make sure the original article buffer is up-to-date
+       (save-window-excursion (gnus-summary-select-article))
+       (setq to (or to (gnus-fetch-original-field "To"))
+             newsgroups (gnus-fetch-original-field "Newsgroups")
+             x-no-archive (gnus-fetch-original-field "x-no-archive")))
       (org-store-link-props :type "gnus" :from from :subject subject
                            :message-id message-id :group group :to to)
       (setq desc (org-email-link-description)
@@ -169,19 +173,28 @@ If `org-store-link' was called with a prefix arg the meaning of
   (cond ((and group article)
         (gnus-activate-group group t)
         (condition-case nil
-            (let ((articles 1)
-                  group-opened)
-              (while (and (not group-opened)
-                          ;; stop on integer overflows
-                          (> articles 0))
-                (setq group-opened (gnus-group-read-group articles nil group)
-                      articles (if (< articles 16)
-                                   (1+ articles)
-                                 (* articles 2))))
-              (if group-opened
-                  (gnus-summary-goto-article article nil t)
-                (message "Couldn't follow gnus link.  %s"
-                         "The summary couldn't be opened.")))
+            (let ((backend (car (gnus-find-method-for-group group))))
+              (cond
+               ((eq backend 'nndoc)
+                (if (gnus-group-read-group t nil group)
+                    (gnus-summary-goto-article article nil t)
+                  (message "Couldn't follow gnus link.  %s"
+                           "The summary couldn't be opened.")))
+               (t
+                (let ((articles 1)
+                      group-opened)
+                  (while (and (not group-opened)
+                              ;; stop on integer overflows
+                              (> articles 0))
+                    (setq group-opened (gnus-group-read-group
+                                        articles nil group)
+                          articles (if (< articles 16)
+                                       (1+ articles)
+                                     (* articles 2))))
+                  (if group-opened
+                      (gnus-summary-goto-article article nil t)
+                    (message "Couldn't follow gnus link.  %s"
+                             "The summary couldn't be opened."))))))
           (quit (message "Couldn't follow gnus link.  %s"
                          "The linked group is empty."))))
        (group (gnus-group-jump-to-group group))))
index 47b0647893f84b2a618d9ee41451413735603789..71e0a9583f134fbd13f50e95ca4230fbcfeb330b 100644 (file)
@@ -5,7 +5,7 @@
 ;; Author: John Wiegley <johnw at gnu dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33x
+;; Version: 7.01
 ;;
 ;; This file is part of GNU Emacs.
 ;;
 
 ;; This file contains the habit tracking code for Org-mode
 
+;;; Code:
+
 (require 'org)
 (require 'org-agenda)
+
 (eval-when-compile
-  (require 'cl)
-  (require 'calendar))
+  (require 'cl))
 
 (defgroup org-habit nil
   "Options concerning habit tracking in Org-mode."
@@ -67,52 +69,52 @@ relative to the current effective date."
   :type 'boolean)
 
 (defface org-habit-clear-face
-  '((((background light)) (:background "slateblue"))
+  '((((background light)) (:background "#8270f9"))
     (((background dark)) (:background "blue")))
   "Face for days on which a task shouldn't be done yet."
   :group 'org-habit
   :group 'org-faces)
 (defface org-habit-clear-future-face
-  '((((background light)) (:background "powderblue"))
+  '((((background light)) (:background "#d6e4fc"))
     (((background dark)) (:background "midnightblue")))
   "Face for future days on which a task shouldn't be done yet."
   :group 'org-habit
   :group 'org-faces)
 
 (defface org-habit-ready-face
-  '((((background light)) (:background "green"))
+  '((((background light)) (:background "#4df946"))
     (((background dark)) (:background "forestgreen")))
   "Face for days on which a task should start to be done."
   :group 'org-habit
   :group 'org-faces)
 (defface org-habit-ready-future-face
-  '((((background light)) (:background "palegreen"))
+  '((((background light)) (:background "#acfca9"))
     (((background dark)) (:background "darkgreen")))
   "Face for days on which a task should start to be done."
   :group 'org-habit
   :group 'org-faces)
 
 (defface org-habit-alert-face
-  '((((background light)) (:background "yellow"))
+  '((((background light)) (:background "#f5f946"))
     (((background dark)) (:background "gold")))
   "Face for days on which a task is due."
   :group 'org-habit
   :group 'org-faces)
 (defface org-habit-alert-future-face
-  '((((background light)) (:background "palegoldenrod"))
+  '((((background light)) (:background "#fafca9"))
     (((background dark)) (:background "darkgoldenrod")))
   "Face for days on which a task is due."
   :group 'org-habit
   :group 'org-faces)
 
 (defface org-habit-overdue-face
-  '((((background light)) (:background "red"))
+  '((((background light)) (:background "#f9372d"))
     (((background dark)) (:background "firebrick")))
   "Face for days on which a task is overdue."
   :group 'org-habit
   :group 'org-faces)
 (defface org-habit-overdue-future-face
-  '((((background light)) (:background "mistyrose"))
+  '((((background light)) (:background "#fc9590"))
     (((background dark)) (:background "darkred")))
   "Face for days on which a task is overdue."
   :group 'org-habit
@@ -179,8 +181,10 @@ This list represents a \"habit\" for the rest of this module."
 (defsubst org-habit-deadline (habit)
   (let ((deadline (nth 2 habit)))
     (or deadline
-       (+ (org-habit-scheduled habit)
-          (1- (org-habit-scheduled-repeat habit))))))
+       (if (nth 3 habit)
+           (+ (org-habit-scheduled habit)
+              (1- (org-habit-scheduled-repeat habit)))
+         (org-habit-scheduled habit)))))
 (defsubst org-habit-deadline-repeat (habit)
   (or (nth 3 habit)
       (org-habit-scheduled-repeat habit)))
@@ -281,9 +285,16 @@ current time."
                       donep)))
             markedp face)
        (if donep
-           (progn
+           (let ((done-time (time-add
+                             starting
+                             (days-to-time
+                              (- start (time-to-days starting))))))
+
              (aset graph index ?*)
              (setq markedp t)
+             (put-text-property
+              index (1+ index) 'help-echo
+              (format-time-string (org-time-stamp-format) done-time) graph)
              (while (and done-dates
                          (= start (car done-dates)))
                (setq last-done-date (car done-dates)
@@ -305,6 +316,7 @@ current time."
 (defun org-habit-insert-consistency-graphs (&optional line)
   "Insert consistency graph for any habitual tasks."
   (let ((inhibit-read-only t) l c
+       (buffer-invisibility-spec '(org-link))
        (moment (time-subtract (current-time)
                               (list 0 (* 3600 org-extend-today-until) 0))))
     (save-excursion
index 2682d2398987a54a2e704329b55218c2dde4e24a..e20b92147fc0e1b0419127f41a70ad142e289a78 100644 (file)
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33x
+;; Version: 7.01
 ;;
 ;; This file is part of GNU Emacs.
 ;;
 ;;
 ;;; Commentary:
 
+;;; Code:
+
 (require 'org-exp)
+
 (eval-when-compile (require 'cl))
 
 (declare-function org-id-find-id-file "org-id" (id))
@@ -57,7 +60,7 @@ by the footnotes themselves."
   :type 'string)
 
 (defcustom org-export-html-coding-system nil
-  "Coding system for HTML export, defaults to buffer-file-coding-system."
+  "Coding system for HTML export, defaults to `buffer-file-coding-system'."
   :group 'org-export-html
   :type 'coding-system)
 
@@ -81,7 +84,7 @@ and corresponding declarations."
                        (string :tag "Declaration")))))
 
 (defcustom org-export-html-style-include-scripts t
-  "Non-nil means, include the javascript snippets in exported HTML files.
+  "Non-nil means include the JavaScript snippets in exported HTML files.
 The actual script is defined in `org-export-html-scripts' and should
 not be modified."
   :group 'org-export-html
@@ -110,7 +113,7 @@ not be modified."
  }
 /*]]>*///-->
 </script>"
-"Basic javascript that is needed by HTML files produced by Org-mode.")
+"Basic JavaScript that is needed by HTML files produced by Org-mode.")
 
 (defconst org-export-html-style-default
 "<style type=\"text/css\">
@@ -137,6 +140,7 @@ not be modified."
   dt { font-weight: bold; }
   div.figure { padding: 0.5em; }
   div.figure p { text-align: center; }
+  textarea { overflow-x: auto; }
   .linenr { font-size:smaller }
   .code-highlighted {background-color:#ffff00;}
   .org-info-js_info-navigation { border-style:none; }
@@ -153,7 +157,7 @@ have the default style included, customize the variable
 `org-export-html-style-include-default'.")
 
 (defcustom org-export-html-style-include-default t
-  "Non-nil means, include the default style in exported HTML files.
+  "Non-nil means include the default style in exported HTML files.
 The actual style is defined in `org-export-html-style-default' and should
 not be modified.  Use the variables `org-export-html-style' to add
 your own style information."
@@ -206,20 +210,20 @@ settings with <style>...</style> tags."
 (put 'org-export-html-style-extra 'safe-local-variable 'stringp)
 
 (defcustom org-export-html-tag-class-prefix ""
-  "Prefix to clas names for TODO keywords.
+  "Prefix to class names for TODO keywords.
 Each tag gets a class given by the tag itself, with this prefix.
 The default prefix is empty because it is nice to just use the keyword
 as a class name.  But if you get into conflicts with other, existing
-CSS classes, then this prefic can be very useful."
+CSS classes, then this prefix can be very useful."
   :group 'org-export-html
   :type 'string)
 
 (defcustom org-export-html-todo-kwd-class-prefix ""
-  "Prefix to clas names for TODO keywords.
+  "Prefix to class names for TODO keywords.
 Each TODO keyword gets a class given by the keyword itself, with this prefix.
 The default prefix is empty because it is nice to just use the keyword
 as a class name.  But if you get into conflicts with other, existing
-CSS classes, then this prefic can be very useful."
+CSS classes, then this prefix can be very useful."
   :group 'org-export-html
   :type 'string)
 
@@ -234,10 +238,11 @@ CSS classes, then this prefic can be very useful."
  |
  <a accesskey=\"H\" href=\"%s\"> HOME </a>
 </div>"
-  "Snippet used to insert the HOME and UP links.  This is a format,
-the first %s will receive the UP link, the second the HOME link.
-If both `org-export-html-link-up' and `org-export-html-link-home' are
-empty, the entire snippet will be ignored."
+  "Snippet used to insert the HOME and UP links.
+This is a format string, the first %s will receive the UP link,
+the second the HOME link.  If both `org-export-html-link-up' and
+`org-export-html-link-home' are empty, the entire snippet will be
+ignored."
   :group 'org-export-html
   :type 'string)
 
@@ -253,7 +258,7 @@ document title."
   :type 'string)
 
 (defcustom org-export-html-link-org-files-as-html t
-  "Non-nil means, make file links to `file.org' point to `file.html'.
+  "Non-nil means make file links to `file.org' point to `file.html'.
 When org-mode is exporting an org-mode file to HTML, links to
 non-html files are directly put into a href tag in HTML.
 However, links to other Org-mode files (recognized by the
@@ -265,7 +270,7 @@ When nil, the links still point to the plain `.org' file."
   :type 'boolean)
 
 (defcustom org-export-html-inline-images 'maybe
-  "Non-nil means, inline images into exported HTML pages.
+  "Non-nil means inline images into exported HTML pages.
 This is done using an <img> tag.  When nil, an anchor with href is used to
 link to the image.  If this option is `maybe', then images in links with
 an empty description will be inlined, while images with a description will
@@ -333,13 +338,13 @@ will give even lines the class \"tr-even\" and odd lines the class \"tr-odd\"."
 
 
 (defcustom org-export-html-table-use-header-tags-for-first-column nil
-  "Non-nil means, format column one in tables with header tags.
+  "Non-nil means format column one in tables with header tags.
 When nil, also column one will use data tags."
   :group 'org-export-tables
   :type 'boolean)
 
 (defcustom org-export-html-validation-link nil
-  "Non-nil means, add validationlink to postamble of HTML exported files."
+  "Non-nil means add validation link to postamble of HTML exported files."
   :group 'org-export-html
   :type '(choice
          (const :tag "Nothing" nil)
@@ -348,9 +353,10 @@ When nil, also column one will use data tags."
 
 
 (defcustom org-export-html-with-timestamp nil
-  "If non-nil, write `org-export-html-html-helper-timestamp'
-into the exported HTML text.  Otherwise, the buffer will just be saved
-to a file."
+  "If non-nil, write timestamp into the exported HTML text.
+If non-nil Write `org-export-html-html-helper-timestamp' into the
+exported HTML text.  Otherwise, the buffer will just be saved to
+a file."
   :group 'org-export-html
   :type 'boolean)
 
@@ -404,10 +410,10 @@ with a link to this URL."
 ;;; Variables, constants, and parameter plists
 
 (defvar org-export-html-preamble nil
-  "Preamble, to be inserted just before <body>.  Set by publishing functions.
+  "Preamble, to be inserted just after <body>.  Set by publishing functions.
 This may also be a function, building and inserting the preamble.")
 (defvar org-export-html-postamble nil
-  "Preamble, to be inserted just after </body>.  Set by publishing functions.
+  "Preamble, to be inserted just before </body>.  Set by publishing functions.
 This may also be a function, building and inserting the postamble.")
 (defvar org-export-html-auto-preamble t
   "Should default preamble be inserted?  Set by publishing functions.")
@@ -420,20 +426,30 @@ This may also be a function, building and inserting the postamble.")
   "Hook run during HTML export, after blockquote, verse, center are done.")
 
 (defvar org-export-html-final-hook nil
-  "Hook run during HTML export, after blockquote, verse, center are done.")
+  "Hook run at the end of HTML export, in the new buffer.")
 
 ;;; HTML export
 
 (defun org-export-html-preprocess (parameters)
-  ;; Convert LaTeX fragments to images
+  "Convert LaTeX fragments to images."
   (when (and org-current-export-file
             (plist-get parameters :LaTeX-fragments))
     (org-format-latex
      (concat "ltxpng/" (file-name-sans-extension
                        (file-name-nondirectory
                         org-current-export-file)))
-     org-current-export-dir nil "Creating LaTeX image %s"))
-  (message "Exporting..."))
+     org-current-export-dir nil "Creating LaTeX image %s"
+     nil nil (eq (plist-get parameters :LaTeX-fragments) 'verbatim)))
+  (goto-char (point-min))
+  (let (label l1)
+    (while (re-search-forward "\\\\ref{\\([^{}\n]+\\)}" nil t)
+      (org-if-unprotected-at (match-beginning 1)
+       (setq label (match-string 1))
+       (save-match-data
+         (if (string-match "\\`[a-z]\\{1,10\\}:\\(.+\\)" label)
+             (setq l1 (substring label (match-beginning 1)))
+           (setq l1 label)))
+       (replace-match (format "[[#%s][%s]]" label l1) t t)))))
 
 ;;;###autoload
 (defun org-export-as-html-and-open (arg)
@@ -443,11 +459,14 @@ The prefix ARG specifies how many levels of the outline should become
 headlines.  The default is 3.  Lower levels will become bulleted lists."
   (interactive "P")
   (org-export-as-html arg 'hidden)
-  (org-open-file buffer-file-name))
+  (org-open-file buffer-file-name)
+  (when org-export-kill-product-buffer-when-displayed
+    (kill-buffer (current-buffer))))
 
 ;;;###autoload
 (defun org-export-as-html-batch ()
-  "Call `org-export-as-html', may be used in batch processing as
+  "Call the function `org-export-as-html'.
+This function can be used in batch processing as:
 emacs   --batch
         --load=$HOME/lib/emacs/org.el
         --eval \"(setq org-export-headline-levels 2)\"
@@ -521,6 +540,131 @@ in a window.  A non-interactive call will only return the buffer."
 
 (defvar html-table-tag nil) ; dynamically scoped into this.
 (defvar org-par-open nil)
+
+;;; org-html-cvt-link-fn
+(defconst org-html-cvt-link-fn
+   nil
+   "Function to convert link URLs to exportable URLs.
+Takes two arguments, TYPE and PATH.
+Returns exportable url as (TYPE PATH), or nil to signal that it
+didn't handle this case.
+Intended to be locally bound around a call to `org-export-as-html'." )
+
+(defun org-html-cvt-org-as-html (opt-plist type path)
+   "Convert an org filename to an equivalent html filename.
+If TYPE is not file, just return `nil'.
+See variable `org-export-html-link-org-files-as-html'"
+
+   (save-match-data
+      (and
+        org-export-html-link-org-files-as-html
+        (string= type "file")
+        (string-match "\\.org$" path)
+        (progn
+           (list
+              "http"
+              (concat
+                 (substring path 0 (match-beginning 0))
+                 "."
+                 (plist-get opt-plist :html-extension)))))))
+
+
+;;; org-html-should-inline-p
+(defun org-html-should-inline-p (filename descp)
+   "Return non-nil if link FILENAME should be inlined.
+The decision to inline the FILENAME link is based on the current
+settings.  DESCP is the boolean of whether there was a link
+description.  See variables `org-export-html-inline-images' and
+`org-export-html-inline-image-extensions'."
+   (declare (special
+            org-export-html-inline-images
+            org-export-html-inline-image-extensions))
+   (or
+      (eq t org-export-html-inline-images)
+      (and
+        org-export-html-inline-images
+        (not descp)))
+   (org-file-image-p
+      filename org-export-html-inline-image-extensions))
+
+;;; org-html-make-link
+(defun org-html-make-link (opt-plist type path fragment desc attr
+                            may-inline-p)
+   "Make an HTML link.
+OPT-PLIST is an options list.
+TYPE is the device-type of the link (THIS://foo.html)
+PATH is the path of the link (http://THIS#locationx)
+FRAGMENT is the fragment part of the link, if any (foo.html#THIS)
+DESC is the link description, if any.
+ATTR is a string of other attributes of the a element.
+MAY-INLINE-P allows inlining it as an image."
+
+   (declare (special org-par-open))
+   (save-match-data
+      (let* ((filename path)
+              ;;First pass.  Just sanity stuff.
+              (components-1
+                 (cond
+                    ((string= type "file")
+                       (list
+                          type
+                          ;;Substitute just if original path was absolute.
+                          ;;(Otherwise path must remain relative)
+                          (if (file-name-absolute-p path)
+                             (expand-file-name path)
+                             path)))
+                    ((string= type "")
+                       (list nil path))
+                    (t (list type path))))
+
+              ;;Second pass.  Components converted so they can refer
+              ;;to a remote site.
+              (components-2
+                 (or
+                    (and org-html-cvt-link-fn
+                       (apply org-html-cvt-link-fn
+                          opt-plist components-1))
+                    (apply #'org-html-cvt-org-as-html
+                       opt-plist components-1)
+                    components-1))
+              (type    (first  components-2))
+              (thefile (second components-2)))
+
+
+        ;;Third pass.  Build final link except for leading type
+        ;;spec.
+        (cond
+           ((or
+               (not type)
+               (string= type "http")
+               (string= type "https"))
+              (if fragment
+                 (setq thefile (concat thefile "#" fragment))))
+
+           (t))
+
+        ;;Final URL-build, for all types.
+        (setq thefile
+           (let
+              ((str (org-export-html-format-href thefile)))
+             (if (and type (not (string= "file" type))
+                      (org-string-match-p "^//" str))
+                 (concat type ":" str)
+                 str)))
+
+        (if (and
+               may-inline-p
+               ;;Can't inline a URL with a fragment.
+               (not fragment))
+           (progn
+              (message "image %s %s" thefile org-par-open)
+              (org-export-html-format-image thefile org-par-open))
+           (concat
+              "<a href=\"" thefile "\"" attr ">"
+              (org-export-html-format-desc desc)
+              "</a>")))))
+
+;;; org-export-as-html
 ;;;###autoload
 (defun org-export-as-html (arg &optional hidden ext-plist
                               to-buffer body-only pub-dir)
@@ -539,6 +683,7 @@ the file header and footer, simply return the content of
 <body>...</body>, without even the body tags themselves.  When
 PUB-DIR is set, use this as the publishing directory."
   (interactive "P")
+  (run-hooks 'org-export-first-hook)
 
   ;; Make sure we have a file name when we need it.
   (when (and (not (or to-buffer body-only))
@@ -624,7 +769,8 @@ PUB-DIR is set, use this as the publishing directory."
         (author      (plist-get opt-plist :author))
         (title       (or (and subtree-p (org-export-get-title-from-subtree))
                          (plist-get opt-plist :title)
-                         (and (not
+                         (and (not body-only)
+                              (not
                                (plist-get opt-plist :skip-before-1st-heading))
                               (org-export-grab-title-from-buffer))
                          (and buffer-file-name
@@ -696,7 +842,7 @@ PUB-DIR is set, use this as the publishing directory."
         table-buffer table-orig-buffer
         ind item-type starter didclose
         rpl path attr desc descp desc1 desc2 link
-        snumber fnc item-tag
+        snumber fnc item-tag initial-number
         footnotes footref-seen
         id-file href
         )
@@ -775,7 +921,7 @@ lang=\"%s\" xml:lang=\"%s\">
                      "")
                  (or charset "iso-8859-1"))
                 language language
-                (org-html-expand title)
+                title
                 (or charset "iso-8859-1")
                 date author description keywords
                 style
@@ -804,7 +950,8 @@ lang=\"%s\" xml:lang=\"%s\">
            (push "<ul>\n<li>" thetoc)
            (setq lines
                  (mapcar '(lambda (line)
-                   (if (string-match org-todo-line-regexp line)
+                   (if (and (string-match org-todo-line-regexp line)
+                            (not (get-text-property 0 'org-protected line)))
                        ;; This is a headline
                        (progn
                          (setq have-headings t)
@@ -856,7 +1003,9 @@ lang=\"%s\" xml:lang=\"%s\">
                                              t t line)))
                                (while (string-match "&lt;\\(&lt;\\)+\\|&gt;\\(&gt;\\)+" txt)
                                  (setq txt (replace-match "" t t txt)))
-                               (setq href (format "sec-%s" snumber))
+                               (setq href
+                                     (replace-regexp-in-string
+                                      "\\." "_" (format "sec-%s" snumber)))
                                (setq href (or (cdr (assoc href org-export-preferred-target-alist)) href))
                                (push
                                 (format
@@ -944,10 +1093,12 @@ lang=\"%s\" xml:lang=\"%s\">
          (when (equal "ORG-VERSE-START" line)
            (org-close-par-maybe)
            (insert "\n<p class=\"verse\">\n")
+           (setq org-par-open t)
            (setq inverse t)
            (throw 'nextline nil))
          (when (equal "ORG-VERSE-END" line)
            (insert "</p>\n")
+           (setq org-par-open nil)
            (org-open-par)
            (setq inverse nil)
            (throw 'nextline nil))
@@ -999,7 +1150,7 @@ lang=\"%s\" xml:lang=\"%s\">
                                  "\" class=\"target\">" (match-string 1 line)
                                  "@</a> ")
                          t t line)))))
-           
+
          (setq line (org-html-handle-time-stamps line))
 
          ;; replace "&" by "&amp;", "<" and ">" by "&lt;" and "&gt;"
@@ -1027,70 +1178,79 @@ lang=\"%s\" xml:lang=\"%s\">
                  desc2 (if (match-end 2) (concat type ":" path) path)
                  descp (and desc1 (not (equal desc1 desc2)))
                  desc (or desc1 desc2))
-           ;; Make an image out of the description if that is so wanted
+            ;; Make an image out of the description if that is so wanted
            (when (and descp (org-file-image-p
-                             desc org-export-html-inline-image-extensions))
-             (save-match-data
-               (if (string-match "^file:" desc)
-                   (setq desc (substring desc (match-end 0)))))
-             (setq desc (org-add-props
+                               desc org-export-html-inline-image-extensions))
+              (save-match-data
+                 (if (string-match "^file:" desc)
+                    (setq desc (substring desc (match-end 0)))))
+              (setq desc (org-add-props
                             (concat "<img src=\"" desc "\"/>")
                             '(org-protected t))))
-           ;; FIXME: do we need to unescape here somewhere?
            (cond
             ((equal type "internal")
-             (setq rpl
-                   (concat
-                    "<a href=\""
-                    (if (= (string-to-char path) ?#) "" "#")
-                    (org-solidify-link-text
-                     (save-match-data (org-link-unescape path)) nil)
-                    "\"" attr ">"
-                    (org-export-html-format-desc desc)
-                    "</a>")))
+               (let
+                  ((frag-0
+                      (if (= (string-to-char path) ?#)
+                         (substring path 1)
+                         path)))
+                  (setq rpl
+                     (org-html-make-link
+                        opt-plist
+                        ""
+                        ""
+                        (org-solidify-link-text
+                           (save-match-data (org-link-unescape frag-0))
+                           nil)
+                        desc attr nil))))
             ((and (equal type "id")
                   (setq id-file (org-id-find-id-file path)))
              ;; This is an id: link to another file (if it was the same file,
              ;; it would have become an internal link...)
              (save-match-data
                (setq id-file (file-relative-name
-                              id-file (file-name-directory org-current-export-file)))
-               (setq id-file (concat (file-name-sans-extension id-file)
-                                     "." html-extension))
-               (setq rpl (concat "<a href=\"" id-file "#"
-                                 (if (org-uuidgen-p path) "ID-")
-                                 path "\""
-                                 attr ">"
-                                 (org-export-html-format-desc desc)
-                                 "</a>"))))
+                                id-file
+                                (file-name-directory org-current-export-file)))
+               (setq rpl
+                  (org-html-make-link opt-plist
+                     "file" id-file
+                     (concat (if (org-uuidgen-p path) "ID-") path)
+                      desc
+                     attr
+                     nil))))
             ((member type '("http" "https"))
-             ;; standard URL, just check if we need to inline an image
-             (if (and (or (eq t org-export-html-inline-images)
-                          (and org-export-html-inline-images (not descp)))
-                      (org-file-image-p
-                       path org-export-html-inline-image-extensions))
-                 (setq rpl (org-export-html-format-image
-                            (concat type ":" path) org-par-open))
-               (setq link (concat type ":" path))
-               (setq rpl (concat "<a href=\""
-                                 (org-export-html-format-href link)
-                                 "\"" attr ">"
-                                 (org-export-html-format-desc desc)
-                                 "</a>"))))
+               ;; standard URL, can inline as image
+               (setq rpl
+                  (org-html-make-link opt-plist
+                     type path nil
+                     desc
+                     attr
+                     (org-html-should-inline-p path descp))))
             ((member type '("ftp" "mailto" "news"))
-             ;; standard URL
-             (setq link (concat type ":" path))
-             (setq rpl (concat "<a href=\""
-                               (org-export-html-format-href link)
-                               "\"" attr ">"
-                               (org-export-html-format-desc desc)
-                               "</a>")))
+               ;; standard URL, can't inline as image
+               (setq rpl
+                  (org-html-make-link opt-plist
+                     type path nil
+                     desc
+                     attr
+                     nil)))
 
             ((string= type "coderef")
-             (setq rpl (format "<a href=\"#coderef-%s\" class=\"coderef\" onmouseover=\"CodeHighlightOn(this, 'coderef-%s');\" onmouseout=\"CodeHighlightOff(this, 'coderef-%s');\">%s</a>"
-                               path path path
-                               (format (org-export-get-coderef-format path (and descp desc))
-                                       (cdr (assoc path org-export-code-refs))))))
+               (let*
+                  ((coderef-str (format "coderef-%s" path))
+                     (attr-1
+                        (format "class=\"coderef\" onmouseover=\"CodeHighlightOn(this, '%s');\" onmouseout=\"CodeHighlightOff(this, '%s');\""
+                           coderef-str coderef-str)))
+                  (setq rpl
+                     (org-html-make-link opt-plist
+                        type "" coderef-str
+                        (format
+                           (org-export-get-coderef-format
+                              path
+                              (and descp desc))
+                           (cdr (assoc path org-export-code-refs)))
+                        attr-1
+                        nil))))
 
             ((functionp (setq fnc (nth 2 (assoc type org-link-protocols))))
              ;; The link protocol has a function for format the link
@@ -1099,50 +1259,55 @@ lang=\"%s\" xml:lang=\"%s\">
                      (funcall fnc (org-link-unescape path) desc1 'html))))
 
             ((string= type "file")
-             ;; FILE link
-             (let* ((filename path)
-                    (abs-p (file-name-absolute-p filename))
-                    thefile file-is-image-p search)
+               ;; FILE link
                (save-match-data
-                 (if (string-match "::\\(.*\\)" filename)
-                     (setq search (match-string 1 filename)
-                           filename (replace-match "" t nil filename)))
-                 (setq valid
-                       (if (functionp link-validate)
-                           (funcall link-validate filename current-dir)
-                         t))
-                 (setq file-is-image-p
-                       (org-file-image-p
-                        filename org-export-html-inline-image-extensions))
-                 (setq thefile (if abs-p (expand-file-name filename) filename))
-                 (when (and org-export-html-link-org-files-as-html
-                            (string-match "\\.org$" thefile))
-                   (setq thefile (concat (substring thefile 0
-                                                    (match-beginning 0))
-                                         "." html-extension))
-                   (if (and search
-                            ;; make sure this is can be used as target search
-                            (not (string-match "^[0-9]*$" search))
-                            (not (string-match "^\\*" search))
-                            (not (string-match "^/.*/$" search)))
-                       (setq thefile (concat thefile "#"
-                                             (org-solidify-link-text
-                                              (org-link-unescape search)))))
-                   (when (string-match "^file:" desc)
-                     (setq desc (replace-match "" t t desc))
-                     (if (string-match "\\.org$" desc)
-                         (setq desc (replace-match "" t t desc))))))
-               (setq rpl (if (and file-is-image-p
-                                  (or (eq t org-export-html-inline-images)
-                                      (and org-export-html-inline-images
-                                           (not descp))))
-                             (progn
-                               (message "image %s %s" thefile org-par-open)
-                               (org-export-html-format-image thefile org-par-open))
-                           (concat "<a href=\"" thefile "\"" attr ">"
-                                   (org-export-html-format-desc desc)
-                                   "</a>")))
-               (if (not valid) (setq rpl desc))))
+                  (let*
+                     ((components
+                         (if
+                            (string-match "::\\(.*\\)" path)
+                            (list
+                               (replace-match "" t nil path)
+                               (match-string 1 path))
+                            (list path nil)))
+
+                        ;;The proper path, without a fragment
+                        (path-1
+                           (first components))
+
+                        ;;The raw fragment
+                        (fragment-0
+                           (second components))
+
+                        ;;Check the fragment.  If it can't be used as
+                        ;;target fragment we'll pass nil instead.
+                        (fragment-1
+                           (if
+                              (and fragment-0
+                                 (not (string-match "^[0-9]*$" fragment-0))
+                                 (not (string-match "^\\*" fragment-0))
+                                 (not (string-match "^/.*/$" fragment-0)))
+                              (org-solidify-link-text
+                                 (org-link-unescape fragment-0))
+                              nil))
+                        (desc-2
+                           ;;Description minus "file:" and ".org"
+                           (if (string-match "^file:" desc)
+                              (let
+                                 ((desc-1 (replace-match "" t t desc)))
+                                 (if (string-match "\\.org$" desc-1)
+                                    (replace-match "" t t desc-1)
+                                    desc-1))
+                              desc)))
+
+                     (setq rpl
+                        (if
+                           (and
+                              (functionp link-validate)
+                              (not (funcall link-validate path-1 current-dir)))
+                           desc
+                           (org-html-make-link opt-plist
+                              "file" path-1 fragment-1 desc-2 attr
+                              (org-html-should-inline-p path-1 descp)))))))
 
             (t
              ;; just publish the path, as default
@@ -1263,7 +1428,11 @@ lang=\"%s\" xml:lang=\"%s\">
                    starter (if (match-beginning 2)
                                (substring (match-string 2 line) 0 -1))
                    line (substring line (match-beginning 5))
+                   initial-number nil
                    item-tag nil)
+             (if (string-match "\\`\\[@start:\\([0-9]+\\)\\][ \t]?" line)
+                 (setq initial-number (match-string 1 line)
+                       line (replace-match "" t t line)))
              (if (and starter (string-match "\\(.*?\\) ::[ \t]*" line))
                  (setq item-type "d"
                        item-tag (match-string 1 line)
@@ -1288,11 +1457,15 @@ lang=\"%s\" xml:lang=\"%s\">
               ((and starter
                     (or (not in-local-list)
                         (> ind (car local-list-indent))))
+               ;; check for a specified start number
                ;; Start new (level of) list
                (org-close-par-maybe)
                (insert (cond
                         ((equal item-type "u") "<ul>\n<li>\n")
-                        ((equal item-type "o") "<ol>\n<li>\n")
+                        ((equal item-type "o")
+                         (if initial-number
+                             (format "<ol start=%s>\n<li>\n" initial-number)
+                           "<ol>\n<li>\n"))
                         ((equal item-type "d")
                          (format "<dl>\n<dt>%s</dt><dd>\n" item-tag))))
                (push item-type local-list-type)
@@ -1402,7 +1575,7 @@ lang=\"%s\" xml:lang=\"%s\">
          (when (and org-export-author-info author)
            (insert "<p class=\"author\"> "
                    (nth 1 lang-words) ": " author "\n")
-           (when email
+           (when (and org-export-email-info email (string-match "\\S-" email))
              (if (listp (split-string email ",+ *"))
                  (mapc (lambda(e)
                          (insert "<a href=\"mailto:" e "\">&lt;"
@@ -1469,6 +1642,12 @@ lang=\"%s\" xml:lang=\"%s\">
          (delete-region beg end)
          (insert (format "<span style=\"visibility:hidden;\">%s</span>"
                          (make-string n ?x)))))
+      ;; Remove empty lines at the beginning of the file.
+      (goto-char (point-min))
+      (when (looking-at "\\s-+\n") (replace-match ""))
+      ;; Remove display properties
+      (remove-text-properties (point-min) (point-max) '(display t))
+      ;; Run the hook
       (run-hooks 'org-export-html-final-hook)
       (or to-buffer (save-buffer))
       (goto-char (point-min))
@@ -1506,10 +1685,12 @@ lang=\"%s\" xml:lang=\"%s\">
   "Create image tag with source and attributes."
   (save-match-data
     (if (string-match "^ltxpng/" src)
-       (format "<img src=\"%s\"/>" src)
+       (format "<img src=\"%s\" alt=\"%s\"/>"
+                src (org-find-text-property-in-string 'org-latex-src src))
       (let* ((caption (org-find-text-property-in-string 'org-caption src))
             (attr (org-find-text-property-in-string 'org-attributes src))
             (label (org-find-text-property-in-string 'org-label src)))
+       (setq caption (and caption (org-html-do-expand caption)))
        (concat
        (if caption
            (format "%s<div %sclass=\"figure\">
@@ -1585,16 +1766,10 @@ lang=\"%s\" xml:lang=\"%s\">
     ;; column and the special lines
     (setq lines (org-table-clean-before-export lines)))
 
-  (let* ((caption (or (get-text-property 0 'org-caption (car lines))
-                     (get-text-property (or (next-single-property-change
-                                             0 'org-caption (car lines))
-                                            0)
-                                        'org-caption (car lines))))
-        (attributes (or (get-text-property 0 'org-attributes (car lines))
-                        (get-text-property (or (next-single-property-change
-                                                0 'org-attributes (car lines))
-                                               0)
-                                           'org-attributes (car lines))))
+  (let* ((caption (org-find-text-property-in-string 'org-caption (car lines)))
+        (label (org-find-text-property-in-string 'org-label (car lines)))
+        (attributes (org-find-text-property-in-string 'org-attributes
+                                                      (car lines)))
         (html-table-tag (org-export-splice-attributes
                          html-table-tag attributes))
         (head (and org-export-highlight-first-table-line
@@ -1602,8 +1777,9 @@ lang=\"%s\" xml:lang=\"%s\">
                               (lambda (x) (string-match "^[ \t]*|-" x))
                               (cdr lines)))))
 
-        (nline 0) fnum i
+        (nline 0) fnum nfields i
         tbopen line fields html gr colgropen rowstart rowend)
+    (setq caption (and caption (org-html-do-expand caption)))
     (if splice (setq head nil))
     (unless splice (push (if head "<thead>" "<tbody>") html))
     (setq tbopen t)
@@ -1619,7 +1795,8 @@ lang=\"%s\" xml:lang=\"%s\">
              (throw 'next-line t)))
        ;; Break the line into fields
        (setq fields (org-split-string line "[ \t]*|[ \t]*"))
-       (unless fnum (setq fnum (make-vector (length fields) 0)))
+       (unless fnum (setq fnum (make-vector (length fields) 0)
+                          nfields (length fnum)))
        (setq nline (1+ nline) i -1
              rowstart (eval (car org-export-table-row-tags))
              rowend (eval (cdr org-export-table-row-tags)))
@@ -1627,7 +1804,7 @@ lang=\"%s\" xml:lang=\"%s\">
                      (mapconcat
                       (lambda (x)
                         (setq i (1+ i))
-                        (if (and (< i nline)
+                        (if (and (< i nfields) ; make sure no rogue line causes an error here
                                  (string-match org-table-number-regexp x))
                             (incf (aref fnum i)))
                         (cond
@@ -1676,6 +1853,8 @@ lang=\"%s\" xml:lang=\"%s\">
       ;; DocBook document, we want to always include the caption to make
       ;; DocBook XML file valid.
       (push (format "<caption>%s</caption>" (or caption "")) html)
+      (when label (push (format "<a name=\"%s\" id=\"%s\"></a>" label label)
+                       html))
       (push html-table-tag html))
     (concat (mapconcat 'identity html "\n") "\n")))
 
@@ -1845,7 +2024,7 @@ that uses these same face definitions."
   (goto-char (point-min)))
 
 (defun org-html-protect (s)
-  ;; convert & to &amp;, < to &lt; and > to &gt;
+  "convert & to &amp;, < to &lt; and > to &gt;"
   (let ((start 0))
     (while (string-match "&" s start)
       (setq s (replace-match "&amp;" t t s)
@@ -1860,19 +2039,21 @@ that uses these same face definitions."
   s)
 
 (defun org-html-expand (string)
-  "Prepare STRING for HTML export.  Applies all active conversions.
+  "Prepare STRING for HTML export.  Apply all active conversions.
 If there are links in the string, don't modify these."
   (let* ((re (concat org-bracket-link-regexp "\\|"
                     (org-re "[ \t]+\\(:[[:alnum:]_@:]+:\\)[ \t]*$")))
         m s l res)
-    (while (setq m (string-match re string))
-      (setq s (substring string 0 m)
-           l (match-string 0 string)
-           string (substring string (match-end 0)))
-      (push (org-html-do-expand s) res)
-      (push l res))
-    (push (org-html-do-expand string) res)
-    (apply 'concat (nreverse res))))
+    (if (string-match "^[ \t]*\\+-[-+]*\\+[ \t]*$" string)
+       string
+      (while (setq m (string-match re string))
+       (setq s (substring string 0 m)
+             l (match-string 0 string)
+             string (substring string (match-end 0)))
+       (push (org-html-do-expand s) res)
+       (push l res))
+      (push (org-html-do-expand string) res)
+      (apply 'concat (nreverse res)))))
 
 (defun org-html-do-expand (s)
   "Apply all active conversions to translate special ASCII to HTML."
@@ -1887,16 +2068,14 @@ If there are links in the string, don't modify these."
   (if org-export-with-sub-superscripts
       (setq s (org-export-html-convert-sub-super s)))
   (if org-export-with-TeX-macros
-      (let ((start 0) wd ass)
-       (while (setq start (string-match "\\\\\\([a-zA-Z]+\\)\\({}\\)?"
+      (let ((start 0) wd rep)
+       (while (setq start (string-match "\\\\\\([a-zA-Z]+[0-9]*\\)\\({}\\)?"
                                         s start))
          (if (get-text-property (match-beginning 0) 'org-protected s)
              (setq start (match-end 0))
            (setq wd (match-string 1 s))
-           (if (setq ass (assoc wd org-html-entities))
-               (setq s (replace-match (or (cdr ass)
-                                          (concat "&" (car ass) ";"))
-                                      t t s))
+           (if (setq rep (org-entity-get-representation wd 'html))
+               (setq s (replace-match rep t t s))
              (setq start (+ start (length wd))))))))
   s)
 
@@ -1974,10 +2153,18 @@ If there are links in the string, don't modify these."
 (defvar local-list-indent)
 (defvar local-list-type)
 (defun org-export-html-close-lists-maybe (line)
-  (let ((ind (or (get-text-property 0 'original-indentation line)))
-;               (and (string-match "\\S-" line)
-;                    (org-get-indentation line))))
-       didclose)
+  "Close local lists based on the original indentation of the line."
+  (let* ((rawhtml (and in-local-list
+                      (get-text-property 0 'org-protected line)
+                      (not (get-text-property 0 'org-example line))))
+        ;; rawhtml means: This was between #+begin_html..#+end_html
+        ;; originally, thus it excludes stuff that was a source code example
+        ;; Actually, this code seems wrong, I don't know why it works, but
+        ;; it seems to work.... So keep it like this for now.
+         (ind (if rawhtml
+                 (org-get-indentation line)
+               (get-text-property 0 'original-indentation line)))
+        didclose)
     (when ind
       (while (and in-local-list
                  (<= ind (car local-list-indent)))
@@ -1994,11 +2181,14 @@ If there are links in the string, don't modify these."
 When TITLE is nil, just close all open levels."
   (org-close-par-maybe)
   (let* ((target (and title (org-get-text-property-any 0 'target title)))
-        (extra-targets (assoc target org-export-target-aliases))
-        (preferred (cdr (assoc target org-export-preferred-target-alist)))
+        (extra-targets (and target
+                            (assoc target org-export-target-aliases)))
+        (extra-class (and title (org-get-text-property-any 0 'html-container-class title)))
+        (preferred (and target
+                        (cdr (assoc target org-export-preferred-target-alist))))
         (remove (or preferred target))
         (l org-level-max)
-        snumber href suffix)
+        snumber snu href suffix)
     (setq extra-targets (remove remove extra-targets))
     (setq extra-targets
          (mapconcat (lambda (x)
@@ -2047,7 +2237,8 @@ When TITLE is nil, just close all open levels."
                          extra-targets title "<br/>\n")
                (insert "<ul>\n<li>" title "<br/>\n"))))
        (aset org-levels-open (1- level) t)
-       (setq snumber (org-section-number level))
+       (setq snumber (org-section-number level)
+             snu (replace-regexp-in-string "\\." "_" snumber))
        (setq level (+ level org-export-html-toplevel-hlevel -1))
        (if (and org-export-with-section-numbers (not body-only))
            (setq title (concat
@@ -2055,11 +2246,12 @@ When TITLE is nil, just close all open levels."
                                 level snumber)
                         " " title)))
        (unless (= head-count 1) (insert "\n</div>\n"))
-       (setq href (cdr (assoc (concat "sec-" snumber) org-export-preferred-target-alist)))
-       (setq suffix (or href snumber))
-       (setq href (or href (concat "sec-" snumber)))
-       (insert (format "\n<div id=\"outline-container-%s\" class=\"outline-%d\">\n<h%d id=\"%s\">%s%s</h%d>\n<div class=\"outline-text-%d\" id=\"text-%s\">\n"
-                       suffix level level href
+       (setq href (cdr (assoc (concat "sec-" snu) org-export-preferred-target-alist)))
+       (setq suffix (or href snu))
+       (setq href (or href (concat "sec-" snu)))
+       (insert (format "\n<div id=\"outline-container-%s\" class=\"outline-%d%s\">\n<h%d id=\"%s\">%s%s</h%d>\n<div class=\"outline-text-%d\" id=\"text-%s\">\n"
+                       suffix level (if extra-class (concat " " extra-class) "")
+                       level href
                        extra-targets
                        title level level suffix))
        (org-open-par)))))
index 29f358712fe71eb8abeecbee0eee6e945937addf..1c4d7d6ac5bcb02317cebad9df2ce3b565881875 100644 (file)
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33x
+;; Version: 7.01
 ;;
 ;; This file is part of GNU Emacs.
 ;;
 ;;
 ;;; Commentary:
 
+;;; Code:
+
 (require 'org-exp)
 
+(eval-when-compile
+  (require 'cl))
+
 (declare-function org-bbdb-anniv-export-ical "org-bbdb" nil)
 
 (defgroup org-export-icalendar nil
@@ -47,8 +52,13 @@ The file name should be absolute, the file will be overwritten without warning."
   :group 'org-export-icalendar
   :type 'string)
 
+(defcustom org-icalendar-combined-description nil
+  "Calendar description for the combined iCalendar representing all agenda files."
+  :group 'org-export-icalendar
+  :type 'string)
+
 (defcustom org-icalendar-use-plain-timestamp t
-  "Non-nil means, make an event from every plain time stamp."
+  "Non-nil means make an event from every plain time stamp."
   :group 'org-export-icalendar
   :type 'boolean)
 
@@ -104,7 +114,7 @@ all-tags    All tags, including inherited ones."
           (const :tag "All tags, including inherited ones" all-tags))))
 
 (defcustom org-icalendar-include-todo nil
-  "Non-nil means, export to iCalendar files should also cover TODO items.
+  "Non-nil means export to iCalendar files should also cover TODO items.
 Valid values are:
 nil         don't include any TODO items
 t           include all TODO items that are not in a DONE state
@@ -129,13 +139,13 @@ up in the ics file.  But for normal iCalendar export, you can use this
 for whatever you need.")
 
 (defcustom org-icalendar-include-bbdb-anniversaries nil
-  "Non-nil means, a combined iCalendar files should include anniversaries.
+  "Non-nil means a combined iCalendar files should include anniversaries.
 The anniversaries are define in the BBDB database."
   :group 'org-export-icalendar
   :type 'boolean)
 
 (defcustom org-icalendar-include-sexps t
-  "Non-nil means, export to iCalendar files should also cover sexp entries.
+  "Non-nil means export to iCalendar files should also cover sexp entries.
 These are entries like in the diary, but directly in an Org-mode file."
   :group 'org-export-icalendar
   :type 'boolean)
@@ -152,12 +162,12 @@ The text will be inserted into the DESCRIPTION field."
          (integer :tag "Max characters")))
 
 (defcustom org-icalendar-store-UID nil
-  "Non-nil means, store any created UIDs in properties.
+  "Non-nil means store any created UIDs in properties.
 The iCalendar standard requires that all entries have a unique identifier.
 Org will create these identifiers as needed.  When this variable is non-nil,
 the created UIDs will be stored in the ID property of the entry.  Then the
 next time this entry is exported, it will be exported with the same UID,
-superceding the previous form of it.  This is essential for
+superseding the previous form of it.  This is essential for
 synchronization services.
 This variable is not turned on by default because we want to avoid creating
 a property drawer in every entry if people are only playing with this feature,
@@ -185,7 +195,7 @@ file, but with extension `.ics'."
 
 ;;;###autoload
 (defun org-export-icalendar-all-agenda-files ()
-  "Export all files in `org-agenda-files' to iCalendar .ics files.
+  "Export all files in the variable `org-agenda-files' to iCalendar .ics files.
 Each iCalendar file will be located in the same directory as the Org-mode
 file, but with extension `.ics'."
   (interactive)
@@ -511,11 +521,12 @@ whitespace, newlines, drawers, and timestamps, and cut it down to MAXLENGTH
 characters."
   (if (not s)
       nil
-    (when is-body
+    (if is-body
       (let ((re (concat "\\(" org-drawer-regexp "\\)[^\000]*?:END:.*\n?"))
            (re2 (concat "^[ \t]*" org-keyword-time-regexp ".*\n?")))
        (while (string-match re s) (setq s (replace-match "" t t s)))
-       (while (string-match re2 s) (setq s (replace-match "" t t s)))))
+       (while (string-match re2 s) (setq s (replace-match "" t t s))))
+      (setq s (replace-regexp-in-string "[[:space:]]+" " " s)))
     (let ((start 0))
       (while (string-match "\\([,;]\\)" s start)
        (setq start (+ (match-beginning 0) 2)
@@ -563,14 +574,16 @@ not used right now."
        (name (or name "unknown"))
        (timezone (if (> (length org-icalendar-timezone) 0)
                      org-icalendar-timezone
-                   (cadr (current-time-zone)))))
+                   (cadr (current-time-zone))))
+       (description org-icalendar-combined-description))
     (princ
      (format "BEGIN:VCALENDAR
 VERSION:2.0
 X-WR-CALNAME:%s
 PRODID:-//%s//Emacs with Org-mode//EN
 X-WR-TIMEZONE:%s
-CALSCALE:GREGORIAN\n" name user timezone))))
+X-WR-CALDESC:%s
+CALSCALE:GREGORIAN\n" name user timezone description))))
 
 (defun org-finish-icalendar-file ()
   "Finish an iCalendar file by inserting the END statement."
@@ -581,22 +594,24 @@ CALSCALE:GREGORIAN\n" name user timezone))))
 KEYWORD is added in front, to make a complete line like DTSTART....
 When INC is non-nil, increase the hour by two (if time string contains
 a time), or the day by one (if it does not contain a time)."
-  (let ((t1 (org-parse-time-string s 'nodefault))
+  (let ((t1 (ignore-errors (org-parse-time-string s 'nodefault)))
        t2 fmt have-time time)
-    (if (and (car t1) (nth 1 t1) (nth 2 t1))
-       (setq t2 t1 have-time t)
-      (setq t2 (org-parse-time-string s)))
-    (let ((s (car t2))   (mi (nth 1 t2)) (h (nth 2 t2))
-         (d (nth 3 t2)) (m  (nth 4 t2)) (y (nth 5 t2)))
-      (when inc
-       (if have-time
-           (if org-agenda-default-appointment-duration
-               (setq mi (+ org-agenda-default-appointment-duration mi))
-             (setq h (+ 2 h)))
-         (setq d (1+ d))))
-      (setq time (encode-time s mi h d m y)))
-    (setq fmt (if have-time ":%Y%m%dT%H%M%S" ";VALUE=DATE:%Y%m%d"))
-    (concat keyword (format-time-string fmt time))))
+    (if (not t1)
+       ""
+      (if (and (car t1) (nth 1 t1) (nth 2 t1))
+         (setq t2 t1 have-time t)
+       (setq t2 (org-parse-time-string s)))
+      (let ((s (car t2))   (mi (nth 1 t2)) (h (nth 2 t2))
+           (d (nth 3 t2)) (m  (nth 4 t2)) (y (nth 5 t2)))
+       (when inc
+         (if have-time
+             (if org-agenda-default-appointment-duration
+                 (setq mi (+ org-agenda-default-appointment-duration mi))
+               (setq h (+ 2 h)))
+           (setq d (1+ d))))
+       (setq time (encode-time s mi h d m y)))
+      (setq fmt (if have-time ":%Y%m%dT%H%M%S" ";VALUE=DATE:%Y%m%d"))
+      (concat keyword (format-time-string fmt time)))))
 
 (provide 'org-icalendar)
 
index 512c9a898dbfad52a409a388ff0ad92fb11c7e43..d16e5d81c8e3c92127325e32531fd10fc76862b8 100644 (file)
@@ -5,7 +5,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33x
+;; Version: 7.01
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -37,8 +37,9 @@
 ;; time of the ID, with microsecond accuracy.  This virtually
 ;; guarantees globally unique identifiers, even if several people are
 ;; creating IDs at the same time in files that will eventually be used
-;; together.  As an external method `uuidgen' is supported, if installed
-;; on the system.
+;; together.
+;;
+;; By default Org uses UUIDs as global unique identifiers.
 ;;
 ;; This file defines the following API:
 ;;
@@ -68,6 +69,8 @@
 ;;        Find the location of an entry with specific id.
 ;;
 
+;;; Code:
+
 (require 'org)
 
 (declare-function message-make-fqdn "message" ())
   :group 'org-id
   :type 'string)
 
-(defcustom org-id-method
-  (condition-case nil
-      (if (string-match "\\`[-0-9a-fA-F]\\{36\\}\\'"
-                       (org-trim (shell-command-to-string
-                                  org-id-uuid-program)))
-         'uuidgen
-       'org)
-    (error 'org))
+(defcustom org-id-method 'uuid
   "The method that should be used to create new IDs.
 
-If `uuidgen' is available on the system, it will be used as the default method.
-if not, the method `org' is used.
 An ID will consist of the optional prefix specified in `org-id-prefix',
 and a unique part created by the method this variable specifies.
 
@@ -105,11 +99,13 @@ org        Org's own internal method, using an encoding of the current time to
            microsecond accuracy, and optionally the current domain of the
            computer.  See the variable `org-id-include-domain'.
 
-uuidgen    Call the external command uuidgen."
+uuid       Create random (version 4) UUIDs.  If the program defined in
+           `org-id-uuid-program' is available it is used to create the ID.
+           Otherwise an internal functions is used."
   :group 'org-id
   :type '(choice
          (const :tag "Org's internal method" org)
-         (const :tag "external: uuidgen" uuidgen)))
+         (const :tag "external: uuidgen" uuid)))
 
 (defcustom org-id-prefix nil
   "The prefix for IDs.
@@ -123,7 +119,7 @@ to have no space characters in them."
          (string :tag "Prefix")))
 
 (defcustom org-id-include-domain nil
-  "Non-nil means, add the domain name to new IDs.
+  "Non-nil means add the domain name to new IDs.
 This ensures global uniqueness of IDs, and is also suggested by
 RFC 2445 in combination with RFC 822.  This is only relevant if
 `org-id-method' is `org'.  When uuidgen is used, the domain will never
@@ -135,7 +131,7 @@ people to make this necessary."
   :type 'boolean)
 
 (defcustom org-id-track-globally t
-  "Non-nil means, track IDs through files, so that links work globally.
+  "Non-nil means track IDs through files, so that links work globally.
 This work by maintaining a hash table for IDs and writing this table
 to disk when exiting Emacs.  Because of this, it works best if you use
 a single Emacs process, not many.
@@ -178,7 +174,7 @@ This variable is only relevant when `org-id-track-globally' is set."
            (file))))
 
 (defcustom org-id-search-archives t
-  "Non-nil means, search also the archive files of agenda files for entries.
+  "Non-nil means search also the archive files of agenda files for entries.
 This is a possibility to reduce overhead, but it means that entries moved
 to the archives can no longer be found by ID.
 This variable is only relevant when `org-id-track-globally' is set."
@@ -306,8 +302,10 @@ So a typical ID could look like \"Org:4nd91V40HI\"."
         unique)
     (if (equal prefix ":") (setq prefix ""))
     (cond
-     ((eq org-id-method 'uuidgen)
-      (setq unique (org-trim (shell-command-to-string org-id-uuid-program))))
+     ((memq org-id-method '(uuidgen uuid))
+      (setq unique (org-trim (shell-command-to-string org-id-uuid-program)))
+      (unless (org-uuidgen-p unique)
+       (setq unique (org-id-uuid))))
      ((eq org-id-method 'org)
       (let* ((etime (org-id-reverse-string (org-id-time-to-b36)))
             (postfix (if org-id-include-domain
@@ -318,6 +316,30 @@ So a typical ID could look like \"Org:4nd91V40HI\"."
      (t (error "Invalid `org-id-method'")))
     (concat prefix unique)))
 
+(defun org-id-uuid ()
+  "Return string with random (version 4) UUID."
+  (let ((rnd (md5 (format "%s%s%s%s%s%s%s"
+                         (random t)
+                         (current-time)
+                         (user-uid)
+                         (emacs-pid)
+                         (user-full-name)
+                         user-mail-address
+                         (recent-keys)))))
+    (format "%s-%s-4%s-%s%s-%s"
+           (substring rnd 0 8)
+           (substring rnd 8 12)
+           (substring rnd 13 16)
+           (format "%x"
+                   (logior
+                    #b10000000
+                    (logand
+                     #b10111111
+                     (string-to-number
+                      (substring rnd 16 18) 16))))
+           (substring rnd 18 20)
+           (substring rnd 20 32))))
+
 (defun org-id-reverse-string (s)
   (mapconcat 'char-to-string (nreverse (string-to-list s)) ""))
 
@@ -466,7 +488,7 @@ When CHECK is given, prepare detailed information about duplicate IDs."
 
 (defun org-id-locations-save ()
   "Save `org-id-locations' in `org-id-locations-file'."
-  (when org-id-track-globally
+  (when (and org-id-track-globally org-id-locations)
     (let ((out (if (hash-table-p org-id-locations)
                   (org-id-hash-to-alist org-id-locations)
                 org-id-locations)))
@@ -545,7 +567,9 @@ When CHECK is given, prepare detailed information about duplicate IDs."
 (defun org-id-find-id-file (id)
   "Query the id database for the file in which this ID is located."
   (unless org-id-locations (org-id-locations-load))
-  (or (gethash id org-id-locations)
+  (or (and org-id-locations
+          (hash-table-p org-id-locations)
+          (gethash id org-id-locations))
       ;; ball back on current buffer
       (buffer-file-name (or (buffer-base-buffer (current-buffer))
                            (current-buffer)))))
@@ -576,6 +600,7 @@ optional argument MARKERP, return the position as a new marker."
   "Store a link to the current entry, using its ID."
   (interactive)
   (let* ((link (org-make-link "id:" (org-id-get-create)))
+        (case-fold-search nil)
         (desc (save-excursion
                 (org-back-to-heading t)
                 (or (and (looking-at org-complex-heading-regexp)
index d3fcec4c26f46f4e1364b9e16e0338e406e29019..d88688d19ba5c32a60a24a84a4acc0a035f85eaa 100644 (file)
@@ -4,7 +4,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33x
+;; Version: 7.01
 ;;
 ;; This file is part of GNU Emacs.
 ;;
 ;; by adding text properties to a buffer to make sure lines are
 ;; indented according to outline structure.
 
+;;; Code:
+
 (require 'org-macs)
 (require 'org-compat)
 (require 'org)
+
 (eval-when-compile
   (require 'cl))
 
-
 (defgroup org-indent nil
   "Options concerning dynamic virtual outline indentation."
-  :tag "Org Structure"
+  :tag "Org Indent"
   :group 'org)
 
 (defconst org-indent-max 40
-  "Maximum indentation in characters")
+  "Maximum indentation in characters.")
 (defconst org-indent-max-levels 40
-  "Maximum indentation in characters")
+  "Maximum indentation in characters.")
 
 (defvar org-indent-strings nil
   "Vector with all indentation strings.
@@ -53,7 +55,7 @@ It will be set in `org-indent-initialize'.")
   "Vector with all indentation star strings.
 It will be set in `org-indent-initialize'.")
 (defvar org-hide-leading-stars-before-indent-mode nil
-  "Used locally")
+  "Used locally.")
 
 (defcustom org-indent-boundary-char ?\   ; comment to protect space char
   "The end of the virtual indentation strings, a single-character string.
@@ -67,13 +69,15 @@ it may be prettier to customize the org-indent face."
   :type 'character)
 
 (defcustom org-indent-mode-turns-off-org-adapt-indentation t
-  "Non-nil means, turning on org-indent-mode turns off indentation adaptation.
+  "Non-nil means setting the variable `org-indent-mode' will \
+turn off indentation adaptation.
 For details see the variable `org-adapt-indentation'."
   :group 'org-indent
   :type 'boolean)
 
 (defcustom org-indent-mode-turns-on-hiding-stars t
-  "Non-nil means, turning on org-indent-mode turns on `org-hide-leading-stars'."
+  "Non-nil means setting the variable `org-indent-mode' will \
+turn on `org-hide-leading-stars'."
   :group 'org-indent
   :type 'boolean)
 
@@ -127,44 +131,57 @@ Internally this works by adding `line-prefix' properties to all non-headlines.
 These properties are updated locally in idle time.
 FIXME:  How to update when broken?"
   nil " Ind" nil
-  (if (org-bound-and-true-p org-inhibit-startup)
-      (setq org-indent-mode nil)
-    (if org-indent-mode
-       (progn
-         (or org-indent-strings (org-indent-initialize))
-         (when org-indent-mode-turns-off-org-adapt-indentation
-           (org-set-local 'org-adapt-indentation nil))
-         (when org-indent-mode-turns-on-hiding-stars
-           (org-set-local 'org-hide-leading-stars-before-indent-mode
-                          org-hide-leading-stars)
-           (org-set-local 'org-hide-leading-stars t))
-         (make-local-variable 'buffer-substring-filters)
-         (add-to-list 'buffer-substring-filters
-                      'org-indent-remove-properties-from-string)
-         (org-add-hook 'org-after-demote-entry-hook
-                       'org-indent-refresh-section nil 'local)
-         (org-add-hook 'org-after-promote-entry-hook
-                       'org-indent-refresh-section nil 'local)
-         (org-add-hook 'org-font-lock-hook
-                       'org-indent-refresh-to nil 'local)
-         (and font-lock-mode (org-restart-font-lock))
-         )
-      (save-excursion
-       (save-restriction
-         (org-indent-remove-properties (point-min) (point-max))
-         (kill-local-variable 'org-adapt-indentation)
-         (when (boundp 'org-hide-leading-stars-before-indent-mode)
-           (org-set-local 'org-hide-leading-stars
-                          org-hide-leading-stars-before-indent-mode))
-         (setq buffer-substring-filters
-               (delq 'org-indent-remove-properties-from-string
-                     buffer-substring-filters))
-         (remove-hook 'org-after-promote-entry-hook
-                      'org-indent-refresh-section 'local)
-         (remove-hook 'org-after-demote-entry-hook
-                      'org-indent-refresh-section 'local)
-         (and font-lock-mode (org-restart-font-lock))
-         (redraw-display))))))
+  (cond
+   ((org-bound-and-true-p org-inhibit-startup)
+    (setq org-indent-mode nil))
+   ((and org-indent-mode (featurep 'xemacs))
+    (message "org-indent-mode does not work in XEmacs - refused to turn it on")
+    (setq org-indent-mode nil))
+   ((and org-indent-mode
+        (not (org-version-check "23.1.50" "Org Indent mode" :predicate)))
+    (message "org-indent-mode is can crash Emacs 23.1 - refused to turn it on!")
+    (ding)
+    (sit-for 1)
+    (setq org-indent-mode nil))
+   (org-indent-mode
+    ;; mode was turned on.
+    (org-set-local 'indent-tabs-mode nil)
+    (or org-indent-strings (org-indent-initialize))
+    (when org-indent-mode-turns-off-org-adapt-indentation
+      (org-set-local 'org-adapt-indentation nil))
+    (when org-indent-mode-turns-on-hiding-stars
+      (org-set-local 'org-hide-leading-stars-before-indent-mode
+                    org-hide-leading-stars)
+      (org-set-local 'org-hide-leading-stars t))
+    (make-local-variable 'buffer-substring-filters)
+    (add-to-list 'buffer-substring-filters
+                'org-indent-remove-properties-from-string)
+    (org-add-hook 'org-after-demote-entry-hook
+                 'org-indent-refresh-section nil 'local)
+    (org-add-hook 'org-after-promote-entry-hook
+                 'org-indent-refresh-section nil 'local)
+    (org-add-hook 'org-font-lock-hook
+                 'org-indent-refresh-to nil 'local)
+    (and font-lock-mode (org-restart-font-lock))
+    )
+   (t
+    ;; mode was turned off (or we refused to turn it on)
+    (save-excursion
+      (save-restriction
+       (org-indent-remove-properties (point-min) (point-max))
+       (kill-local-variable 'org-adapt-indentation)
+       (when (boundp 'org-hide-leading-stars-before-indent-mode)
+         (org-set-local 'org-hide-leading-stars
+                        org-hide-leading-stars-before-indent-mode))
+       (setq buffer-substring-filters
+             (delq 'org-indent-remove-properties-from-string
+                   buffer-substring-filters))
+       (remove-hook 'org-after-promote-entry-hook
+                    'org-indent-refresh-section 'local)
+       (remove-hook 'org-after-demote-entry-hook
+                    'org-indent-refresh-section 'local)
+       (and font-lock-mode (org-restart-font-lock))
+       (redraw-display))))))
 
 
 (defface org-indent
@@ -227,7 +244,7 @@ Assumes that BEG is at the beginning of a line."
              b  e (list 'line-prefix (aref org-indent-strings n)
                         'wrap-prefix (aref org-indent-strings n))))
           (setq b (1+ (point-at-eol))
-                n (* level org-indent-indentation-per-level))))))))
+                n (* (or level 0) org-indent-indentation-per-level))))))))
 
 (defun org-indent-refresh-section ()
   "Refresh indentation properties in the current outline section.
index 1b620714abdb4067dbac286436dbf6842d74942d..3c6bf7d2ca436c56a7225503ed984329a5cfecf0 100644 (file)
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33x
+;; Version: 7.01
 ;;
 ;; This file is part of GNU Emacs.
 ;;
index 8334057a0b546237cb627c404634b551d6bbed38..43d59b0b5583d36968152e4b29f63beac4c3eed3 100644 (file)
@@ -5,7 +5,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33x
+;; Version: 7.01
 
 ;; This file is part of GNU Emacs.
 
@@ -33,7 +33,7 @@
 ;; and properties.  However, these nodes are treated specially by the
 ;; visibility cycling and export commands.
 ;;
-;; Visibility cycling exempts these nodes from cycling. So whenever their
+;; Visibility cycling exempts these nodes from cycling.  So whenever their
 ;; parent is opened, so are these tasks.  This will only work with
 ;; `org-cycle', so if you are also using other commands to show/hide
 ;; entries, you will occasionally find these tasks to behave like
@@ -74,8 +74,7 @@
 ;;
 ;; C-c C-x t      Insert a new inline task with END line
 
-
-;;; Code
+;;; Code:
 
 (require 'org)
 
@@ -94,7 +93,7 @@ the value of this variable."
   :type 'boolean)
 
 (defcustom org-inlinetask-export t
-  "Non-nil means, export inline tasks.
+  "Non-nil means export inline tasks.
 When nil, they will not be exported."
   :group 'org-inlinetask
   :type 'boolean)
@@ -105,12 +104,28 @@ When nil, they will not be exported."
 (defvar org-complex-heading-regexp)
 (defvar org-property-end-re)
 
-(defun org-inlinetask-insert-task ()
-  "Insert an inline task."
-  (interactive)
+(defcustom org-inlinetask-defaut-state nil
+  "Non-nil means make inline tasks have a TODO keyword initially.
+This should be the state `org-inlinetask-insert-task' should use by
+default, or nil of no state should be assigned."
+  :group 'org-inlinetask
+  :type '(choice
+         (const :tag "No state" nil)
+         (string :tag "Specific state")))
+
+(defun org-inlinetask-insert-task (&optional no-state)
+  "Insert an inline task.
+If prefix arg NO-STATE is set, ignore `org-inlinetask-defaut-state'."
+  (interactive "P")
   (or (bolp) (newline))
-  (insert (make-string org-inlinetask-min-level ?*) " \n"
-         (make-string org-inlinetask-min-level ?*) " END\n")
+  (let ((indent org-inlinetask-min-level))
+    (if org-odd-levels-only
+        (setq indent (- (* 2 indent) 1)))
+    (insert (make-string indent ?*)
+            (if (or no-state (not org-inlinetask-defaut-state))
+               " \n"
+             (concat " " org-inlinetask-defaut-state " \n"))
+            (make-string indent ?*) " END\n"))
   (end-of-line -1))
 (define-key org-mode-map "\C-c\C-xt" 'org-inlinetask-insert-task)
 
@@ -149,7 +164,17 @@ Either remove headline and meta data, or do special formatting."
        (when (string-match org-complex-heading-regexp headline)
          (setq headline (concat
                          (if (match-end 2)
-                             (concat (match-string 2 headline) " ") "")
+                             (concat
+                              (org-add-props
+                                  (format
+                                   "@<span class=\"%s %s\"> %s@</span>"
+                                   (if (member (match-string 2 headline)
+                                               org-done-keywords)
+                                       "done" "todo")
+                                   (match-string 2 headline)
+                                   (match-string 2 headline))
+                                  nil 'org-protected t)
+                              " ") "")
                          (match-string 4 headline)))
          (when content
            (if (not (string-match "\\S-" content))
@@ -232,5 +257,4 @@ Either remove headline and meta data, or do special formatting."
 
 (provide 'org-inlinetask)
 
-;; arch-tag: 59fdac51-8bcc-469e-a21e-6897dd6697bb
 ;;; org-inlinetask.el ends here
index d1822d05c05781ec3d11268feb5c10cd8ec3f2aa..3e3631ae979adc62dc1a536a2717db2010500813 100644 (file)
@@ -4,7 +4,7 @@
 ;;
 ;; Author: Philip Jackson <emacs@shellarchive.co.uk>
 ;; Keywords: erc, irc, link, org
-;; Version: 6.33x
+;; Version: 7.01
 ;;
 ;; This file is part of GNU Emacs.
 ;;
index a3158adec3f51abdb068e337974f1b2023b07217..de0f46d52935e38782fe43fdf23ff968ad3a46fb 100644 (file)
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33x
+;; Version: 7.01
 ;;
 ;; This file is part of GNU Emacs.
 ;;
 ;;
 ;;; Commentary:
 
-;; This file implements the support for Sebastian Rose's Javascript
+;; This file implements the support for Sebastian Rose's JavaScript
 ;; org-info.js to display an org-mode file exported to HTML in an
 ;; Info-like way, or using folding similar to the outline structure
 ;; org org-mode itself.
 
-;; Documentation for using this module is in the Org manual. The script
+;; Documentation for using this module is in the Org manual.  The script
 ;; itself is documented by Sebastian Rose in a file distributed with
 ;; the script.  FIXME: Accurate pointers!
 
@@ -87,7 +87,7 @@ line in the buffer.  See also the variable `org-infojs-options'."
 (defcustom org-infojs-options
   (mapcar (lambda (x) (cons (car x) (nth 2 x)))
          org-infojs-opts-table)
-  "Options settings for the INFOJS Javascript.
+  "Options settings for the INFOJS JavaScript.
 Each of the options must have an entry in `org-export-html/infojs-opts-table'.
 The value can either be a string that will be passed to the script, or
 a property.  This property is then assumed to be a property that is defined
index ffec1be7a561fbaab9a56aa70dfcc6bb8c2f5c69..55444c08bbe44dd052112e58b46627320a29b516 100644 (file)
@@ -4,7 +4,7 @@
 ;;
 ;; Emacs Lisp Archive Entry
 ;; Filename: org-latex.el
-;; Version: 6.33x
+;; Version: 7.01
 ;; Author: Bastien Guerry <bzg AT altern DOT org>
 ;; Maintainer: Carsten Dominik <carsten.dominik AT gmail DOT com>
 ;; Keywords: org, wp, tex
 (require 'org)
 (require 'org-exp)
 (require 'org-macs)
+(require 'org-beamer)
 
 ;;; Variables:
 (defvar org-export-latex-class nil)
+(defvar org-export-latex-class-options nil)
 (defvar org-export-latex-header nil)
 (defvar org-export-latex-append-header nil)
 (defvar org-export-latex-options-plist nil)
 
 (defcustom org-export-latex-classes
   '(("article"
-     "\\documentclass[11pt]{article}
-\\usepackage[utf8]{inputenc}
-\\usepackage[T1]{fontenc}
-\\usepackage{graphicx}
-\\usepackage{longtable}
-\\usepackage{float}
-\\usepackage{wrapfig}
-\\usepackage{soul}
-\\usepackage{amssymb}
-\\usepackage{hyperref}"
+     "\\documentclass[11pt]{article}"
      ("\\section{%s}" . "\\section*{%s}")
      ("\\subsection{%s}" . "\\subsection*{%s}")
      ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
      ("\\paragraph{%s}" . "\\paragraph*{%s}")
      ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
     ("report"
-     "\\documentclass[11pt]{report}
-\\usepackage[utf8]{inputenc}
-\\usepackage[T1]{fontenc}
-\\usepackage{graphicx}
-\\usepackage{longtable}
-\\usepackage{float}
-\\usepackage{wrapfig}
-\\usepackage{soul}
-\\usepackage{amssymb}
-\\usepackage{hyperref}"
+     "\\documentclass[11pt]{report}"
      ("\\part{%s}" . "\\part*{%s}")
      ("\\chapter{%s}" . "\\chapter*{%s}")
      ("\\section{%s}" . "\\section*{%s}")
      ("\\subsection{%s}" . "\\subsection*{%s}")
      ("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
     ("book"
-     "\\documentclass[11pt]{book}
-\\usepackage[utf8]{inputenc}
-\\usepackage[T1]{fontenc}
-\\usepackage{graphicx}
-\\usepackage{longtable}
-\\usepackage{float}
-\\usepackage{wrapfig}
-\\usepackage{soul}
-\\usepackage{amssymb}
-\\usepackage{hyperref}"
+     "\\documentclass[11pt]{book}"
      ("\\part{%s}" . "\\part*{%s}")
      ("\\chapter{%s}" . "\\chapter*{%s}")
      ("\\section{%s}" . "\\section*{%s}")
      ("\\subsection{%s}" . "\\subsection*{%s}")
-     ("\\subsubsection{%s}" . "\\subsubsection*{%s}")))
+     ("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
+    ("beamer"
+     "\\documentclass{beamer}"
+     org-beamer-sectioning
+     ))
   "Alist of LaTeX classes and associated header and structure.
 If #+LaTeX_CLASS is set in the buffer, use its value and the
 associated information.  Here is the structure of each cell:
@@ -145,11 +124,60 @@ associated information.  Here is the structure of each cell:
     (numbered-section . unnumbered-section\)
     ...\)
 
-A %s formatter is mandatory in each section string and will be
-replaced by the title of the section.
+The header string
+-----------------
+
+The HEADER-STRING is the header that will be inserted into the LaTeX file.
+It should contain the \\documentclass macro, and anything else that is needed
+for this setup.  To this header, the following commands will be added:
+
+- Calls to \\usepackage for all packages mentioned in the variables
+  `org-export-latex-default-packages-alist' and
+  `org-export-latex-packages-alist'.  Thus, your header definitions should
+  avoid to also request these packages.
+
+- Lines specified via \"#+LaTeX_HEADER:\"
+
+If you need more control about the sequence in which the header is built
+up, or if you want to exclude one of these building blocks for a particular
+class, you can use the following macro-like placeholders.
+
+ [DEFAULT-PACKAGES]      \\usepackage statements for default packages
+ [NO-DEFAULT-PACKAGES]   do not include any of the default packages
+ [PACKAGES]              \\usepackage statements for packages
+ [NO-PACKAGES]           do not include the packages
+ [EXTRA]                 the stuff from #+LaTeX_HEADER
+ [NO-EXTRA]              do not include #+LaTeX_HEADER stuff
+ [BEAMER-HEADER-EXTRA]   the beamer extra headers
+
+So a header like
+
+  \\documentclass{article}
+  [NO-DEFAULT-PACKAGES]
+  [EXTRA]
+  \\providecommand{\\alert}[1]{\\textbf{#1}}
+  [PACKAGES]
+
+will omit the default packages, and will include the #+LaTeX_HEADER lines,
+then have a call to \\providecommand, and then place \\usepackage commands
+based on the content of `org-export-latex-packages-alist'.
+
+If your header or `org-export-latex-default-packages-alist' inserts
+\"\\usepackage[AUTO]{inputenc}\", AUTO will automatically be replaced with
+a coding system derived from `buffer-file-coding-system'.  See also the
+variable `org-export-latex-inputenc-alist' for a way to influence this
+mechanism.
+
+The sectioning structure
+------------------------
+
+The sectioning structure of the class is given by the elements following
+the header string.  For each sectioning level, a number of strings is
+specified.  A %s formatter is mandatory in each section string and will
+be replaced by the title of the section.
 
 Instead of a cons cell (numbered . unnumbered), you can also provide a list
-of 2-4 elements,
+of 2 or 4 elements,
 
   (numbered-open numbered-close)
 
@@ -157,9 +185,15 @@ or
 
   (numbered-open numbered-close unnumbered-open unnumbered-close)
 
-providing opening and closing strings for an environment that should
+providing opening and closing strings for a LaTeX environment that should
 represent the document section.  The opening clause should have a %s
-to represent the section title."
+to represent the section title.
+
+Instead of a list of sectioning commands, you can also specify a
+function name.  That function will be called with two parameters,
+the (reduced) level of the headline, and the headline text.  The function
+must return a cons cell with the (possibly modified) headline text, and the
+sectioning list in the cdr."
   :group 'org-export-latex
   :type '(repeat
          (list (string :tag "LaTeX class")
@@ -167,13 +201,29 @@ to represent the section title."
                (repeat :tag "Levels" :inline t
                        (choice
                         (cons :tag "Heading"
-                              (string :tag "numbered")
-                              (string :tag "unnumbered)"))
+                              (string :tag "  numbered")
+                              (string :tag "unnumbered"))
                         (list :tag "Environment"
-                              (string :tag "Opening (numbered)  ")
-                              (string :tag "Closing (numbered)  ")
+                              (string :tag "Opening   (numbered)")
+                              (string :tag "Closing   (numbered)")
                               (string :tag "Opening (unnumbered)")
-                              (string :tag "Closing (unnumbered)")))))))
+                              (string :tag "Closing (unnumbered)"))
+                        (function :tag "Hook computing sectioning"))))))
+
+(defcustom org-export-latex-inputenc-alist nil
+  "Alist of inputenc coding system names, and what should really be used.
+For example, adding an entry
+
+      (\"utf8\" . \"utf8x\")
+
+will cause \\usepackage[utf8x]{inputenc} to be used for buffers that
+are written as utf8 files."
+  :group 'org-export-latex
+  :type '(repeat
+         (cons
+          (string :tag "Derived from buffer")
+          (string :tag "Use this instead"))))
+
 
 (defcustom org-export-latex-emphasis-alist
   '(("*" "\\textbf{%s}" nil)
@@ -240,6 +290,13 @@ markup defined, the first one in the association list will be used."
   :group 'org-export-latex
   :type 'string)
 
+(defcustom org-export-latex-hyperref-format "\\href{%s}{%s}"
+  "A printf format string to be applied to hyperref links.
+The format must contain two %s instances.  The first will be filled with
+the link, the second with the link description."
+  :group 'org-export-latex
+  :type 'string)
+
 (defcustom org-export-latex-tables-verbatim nil
   "When non-nil, tables are exported verbatim."
   :group 'org-export-latex
@@ -305,7 +362,7 @@ Defaults to \\begin{verbatim} and \\end{verbatim}."
               (string :tag "Close")))
 
 (defcustom org-export-latex-listings nil
-  "Non-nil means, export source code using the listings package.
+  "Non-nil means export source code using the listings package.
 This package will fontify source code, possibly even with color.
 If you want to use this, you also need to make LaTeX use the
 listings package, and if you want to have color, the color
@@ -328,7 +385,7 @@ for example using customize, or with something like
     (shell-script "bash")
     (gnuplot "Gnuplot")
     (ocaml "Caml") (caml "Caml")
-    (sql "SQL"))
+    (sql "SQL") (sqlite "sql"))
   "Alist mapping languages to their listing language counterpart.
 The key is a symbol, the major mode symbol without the \"-mode\".
 The value is the string that should be inserted as the language parameter
@@ -343,7 +400,7 @@ hurt if it is present."
 
 (defcustom org-export-latex-remove-from-headlines
   '(:todo nil :priority nil :tags nil)
-  "A plist of keywords to remove from headlines. OBSOLETE.
+  "A plist of keywords to remove from headlines.  OBSOLETE.
 Non-nil means remove this keyword type from the headline.
 
 Don't remove the keys, just change their values.
@@ -359,6 +416,11 @@ and `org-export-with-tags' instead."
   :group 'org-export-latex
   :type 'string)
 
+(defcustom org-export-latex-tabular-environment "tabular"
+  "Default environment used to build tables."
+  :group 'org-export-latex
+  :type 'string)
+
 (defcustom org-export-latex-inline-image-extensions
   '("pdf" "jpeg" "jpg" "png" "ps" "eps")
   "Extensions of image files that can be inlined into LaTeX.
@@ -370,13 +432,13 @@ allowed.  The default we use here encompasses both."
   :type '(repeat (string :tag "Extension")))
 
 (defcustom org-export-latex-coding-system nil
-  "Coding system for the exported LaTex file."
+  "Coding system for the exported LaTeX file."
   :group 'org-export-latex
   :type 'coding-system)
 
 (defgroup org-export-pdf nil
   "Options for exporting Org-mode files to PDF, via LaTeX."
-  :tag "Org Export LaTeX"
+  :tag "Org Export PDF"
   :group 'org-export-latex
   :group 'org-export)
 
@@ -395,25 +457,39 @@ result, and it also does not do any error checking.
 Alternatively, this may be a Lisp function that does the processing, so you
 could use this to apply the machinery of AUCTeX or the Emacs LaTeX mode.
 This function should accept the file name as its single argument."
-  :group 'org-export-latex
+  :group 'org-export-pdf
   :type '(choice (repeat :tag "Shell command sequence"
                  (string :tag "Shell command"))
                 (function)))
 
+(defcustom org-export-pdf-logfiles
+  '("aux" "idx" "log" "out" "toc" "nav" "snm" "vrb")
+  "The list of file extensions to consider as LaTeX logfiles."
+  :group 'org-export-pdf
+  :type '(repeat (string :tag "Extension")))
+
 (defcustom org-export-pdf-remove-logfiles t
-  "Non-nil means, remove the logfiles produced by PDF production.
+  "Non-nil means remove the logfiles produced by PDF production.
 These are the .aux, .log, .out, and .toc files."
   :group 'org-export-pdf
   :type 'boolean)
 
 ;;; Hooks
 
+(defvar org-export-latex-after-initial-vars-hook nil
+  "Hook run before LaTeX export.
+The exact moment is after the initial variables like org-export-latex-class
+have been determined from the environment.")
+
 (defvar org-export-latex-after-blockquotes-hook nil
   "Hook run during LaTeX export, after blockquote, verse, center are done.")
 
 (defvar org-export-latex-final-hook nil
   "Hook run in the finalized LaTeX buffer.")
 
+(defvar org-export-latex-after-save-hook nil
+  "Hook run in the finalized LaTeX buffer, after it has been saved.")
+
 ;;; Autoload functions:
 
 ;;;###autoload
@@ -510,10 +586,13 @@ non-nil, create a buffer with that name and export to that
 buffer.  If TO-BUFFER is the symbol `string', don't leave any
 buffer behind but just return the resulting LaTeX as a string.
 When BODY-ONLY is set, don't produce the file header and footer,
-simply return the content of \begin{document}...\end{document},
-without even the \begin{document} and \end{document} commands.
+simply return the content of \\begin{document}...\\end{document},
+without even the \\begin{document} and \\end{document} commands.
 when PUB-DIR is set, use this as the publishing directory."
   (interactive "P")
+  (when (and (not body-only) arg (listp arg)) (setq body-only t))
+  (run-hooks 'org-export-first-hook)
+
   ;; Make sure we have a file name when we need it.
   (when (and (not (or to-buffer body-only))
             (not buffer-file-name))
@@ -525,10 +604,14 @@ when PUB-DIR is set, use this as the publishing directory."
 
   (message "Exporting to LaTeX...")
   (org-unmodified
-   (remove-text-properties (point-min) (point-max)
-                          '(:org-license-to-kill nil)))
+   (let ((inhibit-read-only t))
+     (remove-text-properties (point-min) (point-max)
+                            '(:org-license-to-kill nil))))
   (org-update-radio-target-regexp)
   (org-export-latex-set-initial-vars ext-plist arg)
+  (setq org-export-opt-plist org-export-latex-options-plist)
+  (org-install-letbind)
+  (run-hooks 'org-export-latex-after-initial-vars-hook)
   (let* ((wcf (current-window-configuration))
         (opt-plist org-export-latex-options-plist)
         (region-p (org-region-active-p))
@@ -547,27 +630,40 @@ when PUB-DIR is set, use this as the publishing directory."
                              (org-export-add-subtree-options opt-plist rbeg)
                            opt-plist)))
         ;; Make sure the variable contains the updated values.
-        (org-export-latex-options-plist opt-plist)
+        (org-export-latex-options-plist (setq org-export-opt-plist opt-plist))
+        ;; The following two are dynamically scoped into other
+        ;; routines below.
+        (org-current-export-dir
+         (or pub-dir (org-export-directory :html opt-plist)))
+        (org-current-export-file buffer-file-name)
         (title (or (and subtree-p (org-export-get-title-from-subtree))
                    (plist-get opt-plist :title)
                    (and (not
                          (plist-get opt-plist :skip-before-1st-heading))
                         (org-export-grab-title-from-buffer))
-                   (file-name-sans-extension
-                    (file-name-nondirectory buffer-file-name))))
-        (filename (concat (file-name-as-directory
-                           (or pub-dir
-                               (org-export-directory :LaTeX ext-plist)))
-                          (file-name-sans-extension
-                           (or (and subtree-p
-                                    (org-entry-get rbeg "EXPORT_FILE_NAME" t))
-                               (file-name-nondirectory ;sans-extension
-                                buffer-file-name)))
-                          ".tex"))
-        (filename (if (equal (file-truename filename)
-                             (file-truename buffer-file-name))
-                      (concat filename ".tex")
-                    filename))
+                   (and buffer-file-name
+                        (file-name-sans-extension
+                         (file-name-nondirectory buffer-file-name)))
+                   "No Title"))
+        (filename
+         (and (not to-buffer)
+              (concat
+               (file-name-as-directory
+                (or pub-dir
+                    (org-export-directory :LaTeX ext-plist)))
+               (file-name-sans-extension
+                (or (and subtree-p
+                         (org-entry-get rbeg "EXPORT_FILE_NAME" t))
+                    (file-name-nondirectory ;sans-extension
+                     (or buffer-file-name
+                         (error "Don't know which export file to use")))))
+               ".tex")))
+        (filename
+         (and filename
+              (if (equal (file-truename filename)
+                         (file-truename (or buffer-file-name "dummy.org")))
+                  (concat filename ".tex")
+                filename)))
         (buffer (if to-buffer
                     (cond
                      ((eq to-buffer 'string) (get-buffer-create
@@ -602,6 +698,24 @@ when PUB-DIR is set, use this as the publishing directory."
         (region (buffer-substring
                  (if region-p (region-beginning) (point-min))
                  (if region-p (region-end) (point-max))))
+        (text
+         (and text (string-match "\\S-" text)
+              (org-export-preprocess-string
+               text
+               :emph-multiline t
+               :for-LaTeX t
+               :comments nil
+               :tags (plist-get opt-plist :tags)
+               :priority (plist-get opt-plist :priority)
+               :footnotes (plist-get opt-plist :footnotes)
+               :drawers (plist-get opt-plist :drawers)
+               :timestamps (plist-get opt-plist :timestamps)
+               :todo-keywords (plist-get opt-plist :todo-keywords)
+               :add-text nil
+               :skip-before-1st-heading skip
+               :select-tags nil
+               :exclude-tags nil
+               :LaTeX-fragments nil)))
         (string-for-export
          (org-export-preprocess-string
           region
@@ -656,6 +770,11 @@ when PUB-DIR is set, use this as the publishing directory."
     ;; finalization
     (unless body-only (insert "\n\\end{document}"))
 
+    ;; Attach description terms to the \item macro
+    (goto-char (point-min))
+    (while (re-search-forward "^[ \t]*\\\\item\\([ \t]+\\)\\[" nil t)
+      (delete-region (match-beginning 1) (match-end 1)))
+
     ;; Relocate the table of contents
     (goto-char (point-min))
     (when (re-search-forward "\\[TABLE-OF-CONTENTS\\]" nil t)
@@ -666,8 +785,25 @@ when PUB-DIR is set, use this as the publishing directory."
       (and (re-search-forward "\\[TABLE-OF-CONTENTS\\]" nil t)
           (replace-match "\\tableofcontents" t t)))
 
+    ;; Cleanup forced line ends in items where they are not needed
+    (goto-char (point-min))
+    (while (re-search-forward
+           "^[ \t]*\\\\item\\>.*\\(\\\\\\\\\\)[ \t]*\\(\n\\\\label.*\\)*\n\\\\begin"
+           nil t)
+      (delete-region (match-beginning 1) (match-end 1)))
+    (goto-char (point-min))
+    (while (re-search-forward
+           "^[ \t]*\\\\item\\>.*\\(\\\\\\\\\\)[ \t]*\\(\n\\\\label.*\\)*"
+           nil t)
+      (if (looking-at "[\n \t]+")
+         (replace-match "\n")))
+
     (run-hooks 'org-export-latex-final-hook)
-    (or to-buffer (save-buffer))
+    (if to-buffer
+       (unless (eq major-mode 'latex-mode) (latex-mode))
+      (save-buffer))
+    (org-export-latex-fix-inputenc)
+    (run-hooks 'org-export-latex-after-save-hook)
     (goto-char (point-min))
     (or (org-export-push-to-kill-ring "LaTeX")
        (message "Exporting to LaTeX...done"))
@@ -698,10 +834,9 @@ when PUB-DIR is set, use this as the publishing directory."
                       (re-search-forward "\\\\bibliography{" nil t))))
         cmd)
     (with-current-buffer outbuf (erase-buffer))
-    (and (file-exists-p pdffile) (delete-file pdffile))
     (message "Processing LaTeX file...")
     (if (and cmds (symbolp cmds))
-       (funcall cmds file)
+       (funcall cmds (shell-quote-argument file))
       (while cmds
        (setq cmd (pop cmds))
        (while (string-match "%b" cmd)
@@ -720,7 +855,7 @@ when PUB-DIR is set, use this as the publishing directory."
        (error "PDF file was not produced")
       (set-window-configuration wconfig)
       (when org-export-pdf-remove-logfiles
-       (dolist (ext '("aux" "log" "out" "toc"))
+       (dolist (ext org-export-pdf-logfiles)
          (setq file (concat base "." ext))
          (and (file-exists-p file) (delete-file file))))
       (message "Exporting to PDF...done")
@@ -732,7 +867,12 @@ when PUB-DIR is set, use this as the publishing directory."
   (interactive "P")
   (let ((pdffile (org-export-as-pdf arg)))
     (if pdffile
-       (org-open-file pdffile)
+       (progn
+         (org-open-file pdffile)
+         (when org-export-kill-product-buffer-when-displayed
+           (kill-buffer (find-buffer-visiting
+                         (concat (file-name-sans-extension (buffer-file-name))
+                                 ".tex")))))
       (error "PDF file was not produced"))))
 
 ;;; Parsing functions:
@@ -745,7 +885,7 @@ Return a list reflecting the document structure."
     (goto-char (point-min))
     (let* ((cnt 0) output
           (depth org-export-latex-sectioning-depth))
-      (while (re-search-forward
+      (while (org-re-search-forward-unprotected
              (concat "^\\(\\(?:\\*\\)\\{"
                      (number-to-string (+ (if odd 2 1) level))
                      "\\}\\) \\(.*\\)$")
@@ -753,7 +893,7 @@ Return a list reflecting the document structure."
              (when (> level 0)
                (save-excursion
                  (save-match-data
-                   (re-search-forward
+                   (org-re-search-forward-unprotected
                     (concat "^\\(\\(?:\\*\\)\\{"
                             (number-to-string level)
                             "\\}\\) \\(.*\\)$") nil t)))) t)
@@ -765,7 +905,7 @@ Return a list reflecting the document structure."
            (narrow-to-region
             (point)
             (save-match-data
-              (if (re-search-forward
+              (if (org-re-search-forward-unprotected
                    (concat "^\\(\\(?:\\*\\)\\{"
                            (number-to-string (+ (if odd 2 1) level))
                            "\\}\\) \\(.*\\)$") nil t)
@@ -789,7 +929,7 @@ Return a list reflecting the document structure."
 (defun org-export-latex-parse-content ()
   "Extract the content of a section."
   (let ((beg (point))
-       (end (if (re-search-forward "^\\(\\*\\)+ .*$" nil t)
+       (end (if (org-re-search-forward-unprotected "^\\(\\*\\)+ .*$" nil t)
                 (progn (beginning-of-line) (point))
               (point-max))))
     (buffer-substring beg end)))
@@ -797,7 +937,7 @@ Return a list reflecting the document structure."
 (defun org-export-latex-parse-subcontent (level odd)
   "Extract the subcontent of a section at LEVEL.
 If ODD Is non-nil, assume subcontent only contains odd sections."
-  (if (not (re-search-forward
+  (if (not (org-re-search-forward-unprotected
            (concat "^\\(\\(?:\\*\\)\\{"
                    (number-to-string (+ (if odd 4 2) level))
                    "\\}\\) \\(.*\\)$")
@@ -824,8 +964,7 @@ and its content."
 (defun org-export-latex-subcontent (subcontent num)
   "Export each cell of SUBCONTENT to LaTeX.
 If NUM, export sections as numerical sections."
-  (let* ((heading (org-export-latex-fontify-headline
-                  (cdr (assoc 'heading subcontent))))
+  (let* ((heading (cdr (assoc 'heading subcontent)))
         (level (- (cdr (assoc 'level subcontent))
                   org-export-latex-add-level))
         (occur (number-to-string (cdr (assoc 'occur subcontent))))
@@ -833,32 +972,61 @@ If NUM, export sections as numerical sections."
         (subcontent (cadr (assoc 'subcontent subcontent)))
         (label (org-get-text-property-any 0 'target heading))
         (label-list (cons label (cdr (assoc label
-                                            org-export-target-aliases)))))
+                                            org-export-target-aliases))))
+        (sectioning org-export-latex-sectioning)
+        (depth org-export-latex-sectioning-depth)
+        main-heading sub-heading)
+    (when (symbolp (car sectioning))
+      (setq sectioning (funcall (car sectioning) level heading))
+      (when sectioning
+       (setq heading (car sectioning)
+             sectioning (cdr sectioning)
+             ;; target property migh have changed...
+             label (org-get-text-property-any 0 'target heading)
+             label-list (cons label (cdr (assoc label
+                                                org-export-target-aliases)))))
+      (if sectioning (setq sectioning (make-list 10 sectioning)))
+      (setq depth (if sectioning 10000 0)))
+    (if (string-match "[ \t]*\\\\\\\\[ \t]*" heading)
+       (setq main-heading (substring heading 0 (match-beginning 0))
+             sub-heading (substring heading (match-end 0))))
+    (setq heading (org-export-latex-fontify-headline heading)
+         sub-heading (and sub-heading
+                          (org-export-latex-fontify-headline sub-heading))
+         main-heading (and main-heading
+                           (org-export-latex-fontify-headline main-heading)))
     (cond
      ;; Normal conversion
-     ((<= level org-export-latex-sectioning-depth)
-      (let* ((sec (nth (1- level) org-export-latex-sectioning))
+     ((<= level depth)
+      (let* ((sec (nth (1- level) sectioning))
             start end)
        (if (consp (cdr sec))
            (setq start (nth (if num 0 2) sec)
                  end (nth (if num 1 3) sec))
          (setq start (if num (car sec) (cdr sec))))
-       (insert (format start heading) "\n")
+       (insert (format start (if main-heading main-heading heading)
+                       (or sub-heading "")))
+       (insert "\n")
        (when label
          (insert (mapconcat (lambda (l) (format "\\label{%s}" l))
                             label-list "\n") "\n"))
        (insert (org-export-latex-content content))
        (cond ((stringp subcontent) (insert subcontent))
-             ((listp subcontent) (org-export-latex-sub subcontent)))
-       (if end (insert end "\n"))))
+             ((listp subcontent)
+              (while (org-looking-back "\n\n") (backward-delete-char 1))
+              (org-export-latex-sub subcontent)))
+       (when (and end (string-match "[^ \t]" end))
+         (let ((hook (org-get-text-property-any 0 'org-insert-hook end)))
+           (and (functionp hook) (funcall hook)))
+         (insert end "\n"))))
      ;; At a level under the hl option: we can drop this subsection
-     ((> level org-export-latex-sectioning-depth)
+     ((> level depth)
       (cond ((eq org-export-latex-low-levels 'description)
             (if (string-match "% ends low level$"
                               (buffer-substring (point-at-bol 0) (point)))
                 (delete-region (point-at-bol 0) (point))
               (insert "\\begin{description}\n"))
-            (insert (format "\n\\item[%s]%s~\n\n"
+            (insert (format "\n\\item[%s]%s~\n"
                             heading
                             (if label (format "\\label{%s}" label) "")))
             (insert (org-export-latex-content content))
@@ -871,7 +1039,7 @@ If NUM, export sections as numerical sections."
                 (delete-region (point-at-bol 0) (point))
               (insert (format "\\begin{%s}\n"
                               (symbol-name org-export-latex-low-levels))))
-            (insert (format "\n\\item %s\\\\\n%s\n"
+            (insert (format "\n\\item %s\\\\\n%s%%"
                             heading
                             (if label (format "\\label{%s}" label) "")))
             (insert (org-export-latex-content content))
@@ -926,10 +1094,23 @@ LEVEL indicates the default depth for export."
              (save-restriction
                (widen)
                (goto-char (point-min))
-               (and (re-search-forward "^#\\+LaTeX_CLASS:[ \t]*\\([a-zA-Z]+\\)" nil t)
+               (and (re-search-forward "^#\\+LaTeX_CLASS:[ \t]*\\(-[a-zA-Z]+\\)" nil t)
                     (match-string 1))))
            (plist-get org-export-latex-options-plist :latex-class)
            org-export-latex-default-class)
+       org-export-latex-class-options
+       (or (and (org-region-active-p)
+                (save-excursion
+                  (goto-char (region-beginning))
+                  (and (looking-at org-complex-heading-regexp)
+                       (org-entry-get nil "LaTeX_CLASS_OPTIONS" 'selective))))
+           (save-excursion
+             (save-restriction
+               (widen)
+               (goto-char (point-min))
+               (and (re-search-forward "^#\\+LaTeX_CLASS_OPTIONS:[ \t]*\\(.*?\\)[ \t]*$" nil t)
+                    (match-string 1))))
+           (plist-get org-export-latex-options-plist :latex-class-options))
        org-export-latex-class
        (or (car (assoc org-export-latex-class org-export-latex-classes))
            (error "No definition for class `%s' in `org-export-latex-classes'"
@@ -943,32 +1124,42 @@ LEVEL indicates the default depth for export."
            (let ((hl-levels
                   (plist-get org-export-latex-options-plist :headline-levels))
                  (sec-depth (length org-export-latex-sectioning)))
-             (if (> hl-levels sec-depth) sec-depth hl-levels)))))
+             (if (> hl-levels sec-depth) sec-depth hl-levels))))
+  (when (and org-export-latex-class-options
+            (string-match "\\S-" org-export-latex-class-options)
+            (string-match "^[ \t]*\\(\\\\documentclass\\)\\(\\[.*?\\]\\)?"
+                          org-export-latex-header))
+    (setq org-export-latex-header
+         (concat (substring org-export-latex-header 0 (match-end 1))
+                 org-export-latex-class-options
+                 (substring org-export-latex-header (match-end 0))))))
+
+(defvar org-export-latex-format-toc-function
+  'org-export-latex-format-toc-default
+  "The function formatting returning the string to create the table of contents.
+The function mus take one parameter, the depth of the table of contents.")
 
 (defun org-export-latex-make-header (title opt-plist)
   "Make the LaTeX header and return it as a string.
 TITLE is the current title from the buffer or region.
 OPT-PLIST is the options plist for current buffer."
   (let ((toc (plist-get opt-plist :table-of-contents))
-       (author (plist-get opt-plist :author)))
+       (author (org-export-apply-macros-in-string
+                (plist-get opt-plist :author))))
     (concat
      (if (plist-get opt-plist :time-stamp-file)
         (format-time-string "%% Created %Y-%m-%d %a %H:%M\n"))
-     ;; insert LaTeX custom header
-     (org-export-apply-macros-in-string org-export-latex-header)
-     "\n"
-     ;; insert information on LaTeX packages
-     (when org-export-latex-packages-alist
-       (mapconcat (lambda(p)
-                   (if (equal "" (car p))
-                       (format "\\usepackage{%s}" (cadr p))
-                     (format "\\usepackage[%s]{%s}"
-                             (car p) (cadr p))))
-                 org-export-latex-packages-alist "\n"))
-     ;; insert additional commands in the header
-     (org-export-apply-macros-in-string
-      (plist-get opt-plist :latex-header-extra))
+     ;; insert LaTeX custom header and packages from the list
+     (org-splice-latex-header
+      (org-export-apply-macros-in-string org-export-latex-header)
+      org-export-latex-default-packages-alist
+      org-export-latex-packages-alist nil
+      (org-export-apply-macros-in-string
+       (plist-get opt-plist :latex-header-extra)))
+     ;; append another special variable
      (org-export-apply-macros-in-string org-export-latex-append-header)
+     ;; define align if not yet defined
+     "\n\\providecommand{\\alert}[1]{\\textbf{#1}}"
      ;; insert the title
      (format
       "\n\n\\title{%s}\n"
@@ -980,7 +1171,7 @@ OPT-PLIST is the options plist for current buffer."
         (format "\\author{%s}\n"
                 (org-export-latex-fontify-headline (or author user-full-name)))
        (format "%%\\author{%s}\n"
-              (or author user-full-name)))
+              (org-export-latex-fontify-headline (or author user-full-name))))
      ;; insert the date
      (format "\\date{%s}\n"
             (format-time-string
@@ -997,13 +1188,15 @@ OPT-PLIST is the options plist for current buffer."
      ;; table of contents
      (when (and org-export-with-toc
                (plist-get opt-plist :section-numbers))
-       (cond ((numberp toc)
-             (format "\\setcounter{tocdepth}{%s}\n\\tableofcontents\n\\vspace*{1cm}\n"
-                     (min toc (plist-get opt-plist :headline-levels))))
-            (toc (format "\\setcounter{tocdepth}{%s}\n\\tableofcontents\n\\vspace*{1cm}\n"
-                         (plist-get opt-plist :headline-levels)))))
-     (when (plist-get opt-plist :preserve-breaks)
-       "\\obeylines\n"))))
+       (funcall org-export-latex-format-toc-function
+               (cond ((numberp toc)
+                      (min toc (plist-get opt-plist :headline-levels)))
+                     (toc  (plist-get opt-plist :headline-levels))))))))
+
+(defun org-export-latex-format-toc-default (depth)
+  (when depth
+    (format "\\setcounter{tocdepth}{%s}\n\\tableofcontents\n\\vspace*{1cm}\n"
+           depth)))
 
 (defun org-export-latex-first-lines (opt-plist &optional beg end)
   "Export the first lines before first headline.
@@ -1028,8 +1221,16 @@ If END is non-nil, it is the end of the region."
            :timestamps (plist-get opt-plist :timestamps)
            :footnotes (plist-get opt-plist :footnotes)))
        (org-unmodified
-        (add-text-properties pt (max pt (1- end))
-                             '(:org-license-to-kill t)))))))
+        (let ((inhibit-read-only t)
+              (limit (max pt (1- end))))
+          (add-text-properties pt limit
+                               '(:org-license-to-kill t))
+          (save-excursion
+            (goto-char pt)
+            (while (re-search-forward "^[ \t]*#+.*\n?" limit t)
+              (remove-text-properties (match-beginning 0) (match-end 0)
+                               '(:org-license-to-kill t))))))))))
+              
 
 (defvar org-export-latex-header-defs nil
   "The header definitions that might be used in the LaTeX body.")
@@ -1101,7 +1302,8 @@ links, keywords, lists, tables, fixed-width"
                        (cdr todo-markup) (car todo-markup)))
                   (t (cdr (or (assoc (match-string 1) todo-markup)
                               (car todo-markup))))))
-       (replace-match (format fmt (match-string 1)) t t)))
+       (replace-match (org-export-latex-protect-string
+                       (format fmt (match-string 1))) t t)))
     ;; convert priority string
     (when (re-search-forward "\\[\\\\#.\\]" nil t)
       (if (plist-get remove-list :priority)
@@ -1127,13 +1329,20 @@ links, keywords, lists, tables, fixed-width"
     ;; the beginning of the buffer - inserting "\n" is safe here though.
     (insert "\n" string)
     (goto-char (point-min))
-    (let ((re (concat "\\\\[a-zA-Z]+\\(?:"
-                     "\\[.*\\]"
-                     "\\)?"
-                     (org-create-multibrace-regexp "{" "}" 3))))
+    (let ((re (concat "\\\\\\([a-zA-Z]+\\)"
+                     "\\(?:<[^<>\n]*>\\)*"
+                     "\\(?:\\[[^][\n]*?\\]\\)*"
+                     "\\(?:<[^<>\n]*>\\)*"
+                     "\\("
+                     (org-create-multibrace-regexp "{" "}" 3)
+                     "\\)\\{1,3\\}")))
       (while (re-search-forward re nil t)
-       (unless (save-excursion (goto-char (match-beginning 0))
-                               (equal (char-after (point-at-bol)) ?#))
+       (unless (or
+                ;; check for comment line
+                (save-excursion (goto-char (match-beginning 0))
+                                (org-in-indented-comment-line))
+                ;; Check if this is a defined entity, so that is may need conversion
+                (org-entity-get (match-string 1)))
          (add-text-properties (match-beginning 0) (match-end 0)
                               '(org-protected t)))))
     (when (plist-get org-export-latex-options-plist :emphasize)
@@ -1192,7 +1401,8 @@ See the `org-export-latex.el' code for a complete conversion table."
                     (if (equal (match-string 1) "\\")
                         (replace-match (match-string 2) t t)
                       (replace-match (concat (match-string 1) "\\"
-                                             (match-string 2)) t t)))
+                                             (match-string 2)) t t)
+                      (backward-char 1)))
                    ((equal (match-string 2) "...")
                     (replace-match
                      (concat (match-string 1)
@@ -1216,7 +1426,19 @@ See the `org-export-latex.el' code for a complete conversion table."
                                            (org-export-latex-treat-backslash-char
                                             (match-string 1)
                                             (or (match-string 3) "")))
-                                         "") t t))
+                                         "") t t)
+                      (when (and (get-text-property (1- (point)) 'org-entity)
+                                 (looking-at "{}"))
+                        ;; OK, this was an entity replacement, and the user
+                        ;; had terminated the entity with {}.  Make sure
+                        ;; {} is protected as well, and remove the extra {}
+                        ;; inserted by the conversion.
+                        (put-text-property (point) (+ 2 (point)) 'org-protected t)
+                        (if (save-excursion (goto-char (max (- (point) 2) (point-min)))
+                                            (looking-at "{}"))
+                            (replace-match ""))
+                        (forward-char 2))
+                      (backward-char 1))
                      ((member (match-string 2) '("_" "^"))
                       (replace-match (or (save-match-data
                                            (org-export-latex-treat-sub-super-char
@@ -1227,8 +1449,8 @@ See the `org-export-latex.el' code for a complete conversion table."
                       (backward-char 1)))))))
        '(;"^\\([^\n$]*?\\|^\\)\\(\\\\?\\$\\)\\([^\n$]*\\)$"
          "\\(\\(\\\\?\\$\\)\\)"
-         "\\([a-za-z0-9]+\\|[ \t\n]\\|\\b\\|\\\\\\)\\(_\\|\\^\\)\\({[^{}]+}\\|[a-za-z0-9]+\\|[ \t\n]\\|[:punct:]\\|)\\|{[a-za-z0-9]+}\\|([a-za-z0-9]+)\\)"
-         "\\(.\\|^\\)\\(\\\\\\)\\([ \t\n]\\|[a-zA-Z&#%{}\"]+\\)"
+         "\\([a-zA-Z0-9()]+\\|[ \t\n]\\|\\b\\|\\\\\\)\\(_\\|\\^\\)\\({[^{}]+}\\|[a-zA-Z0-9]+\\|[ \t\n]\\|[:punct:]\\|)\\|{[a-zA-Z0-9]+}\\|([a-zA-Z0-9]+)\\)"
+         "\\(.\\|^\\)\\(\\\\\\)\\([ \t\n]\\|\\([&#%{}\"]\\|[a-zA-Z][a-zA-Z0-9]*\\)\\)"
          "\\(.\\|^\\)\\(&\\)"
          "\\(.\\|^\\)\\(#\\)"
          "\\(.\\|^\\)\\(%\\)"
@@ -1264,7 +1486,9 @@ Convert CHAR depending on STRING-BEFORE and STRING-AFTER."
               ((and (> (length string-after) 1)
                     (or (eq subsup t)
                         (and (equal subsup '{}) (eq (string-to-char string-after) ?\{)))
-                    (string-match "[({]?\\([^)}]+\\)[)}]?" string-after))
+                    (or (string-match "[{]?\\([^}]+\\)[}]?" string-after)
+                        (string-match "[(]?\\([^)]+\\)[)]?" string-after)))
+
                (org-export-latex-protect-string
                 (format "%s$%s{%s}$" string-before char
                         (if (and (> (match-end 1) (1+ (match-beginning 1)))
@@ -1280,29 +1504,35 @@ Convert CHAR depending on STRING-BEFORE and STRING-AFTER."
 (defun org-export-latex-treat-backslash-char (string-before string-after)
   "Convert the \"$\" special character to LaTeX.
 The conversion is made depending of STRING-BEFORE and STRING-AFTER."
-  (cond ((member (list string-after) org-html-entities)
-        ;; backslash is part of a special entity (like "\alpha")
-        (concat string-before "$\\"
-                (or (cdar (member (list string-after) org-html-entities))
-                    string-after) "$"))
-       ((and (not (string-match "^[ \n\t]" string-after))
-             (not (string-match "[ \t]\\'\\|^" string-before)))
-        ;; backslash is inside a word
-        (org-export-latex-protect-string
-         (concat string-before "\\textbackslash{}" string-after)))
-       ((not (or (equal string-after "")
-                 (string-match "^[ \t\n]" string-after)))
-        ;; backslash might escape a character (like \#) or a user TeX
-        ;; macro (like \setcounter)
-        (org-export-latex-protect-string
-         (concat string-before "\\" string-after)))
-       ((and (string-match "^[ \t\n]" string-after)
-             (string-match "[ \t\n]\\'" string-before))
-        ;; backslash is alone, convert it to $\backslash$
-        (org-export-latex-protect-string
-         (concat string-before "\\textbackslash{}" string-after)))
-       (t (org-export-latex-protect-string
-           (concat string-before "\\textbackslash{}" string-after)))))
+  (let  ((ass (org-entity-get string-after)))
+    (cond
+     (ass (org-add-props
+             (if (nth 2 ass)
+                 (concat string-before
+                         (org-export-latex-protect-string
+                          (concat "$" (nth 1 ass) "$")))
+               (concat string-before (org-export-latex-protect-string
+                                      (nth 1 ass))))
+             nil 'org-entity t))
+     ((and (not (string-match "^[ \n\t]" string-after))
+          (not (string-match "[ \t]\\'\\|^" string-before)))
+      ;; backslash is inside a word
+      (concat string-before
+             (org-export-latex-protect-string
+              (concat "\\textbackslash{}" string-after))))
+     ((not (or (equal string-after "")
+              (string-match "^[ \t\n]" string-after)))
+      ;; backslash might escape a character (like \#) or a user TeX
+      ;; macro (like \setcounter)
+      (concat string-before
+             (org-export-latex-protect-string (concat "\\" string-after))))
+     ((and (string-match "^[ \t\n]" string-after)
+          (string-match "[ \t\n]\\'" string-before))
+      ;; backslash is alone, convert it to $\backslash$
+      (org-export-latex-protect-string
+       (concat string-before "\\textbackslash{}" string-after)))
+     (t (org-export-latex-protect-string
+        (concat string-before "\\textbackslash{}" string-after))))))
 
 (defun org-export-latex-keywords ()
   "Convert special keywords to LaTeX."
@@ -1312,34 +1542,42 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
                           (match-string 0)) t t)
     (save-excursion
       (beginning-of-line 1)
-      (unless (looking-at ".*\\\\newline[ \t]*$")
+      (unless (looking-at ".*\n[ \t]*\n")
        (end-of-line 1)
-       (insert "\\newline")))))
+       (insert "\n")))))
 
 (defun org-export-latex-fixed-width (opt)
   "When OPT is non-nil convert fixed-width sections to LaTeX."
   (goto-char (point-min))
   (while (re-search-forward "^[ \t]*:\\([ \t]\\|$\\)" nil t)
-    (if opt
-       (progn (goto-char (match-beginning 0))
-              (insert "\\begin{verbatim}\n")
-              (while (looking-at "^\\([ \t]*\\):\\(\\([ \t]\\|$\\).*\\)$")
-                (replace-match (concat (match-string 1)
-                                       (match-string 2)) t t)
-                (forward-line))
-              (insert "\\end{verbatim}\n\n"))
-      (progn (goto-char (match-beginning 0))
-            (while (looking-at "^\\([ \t]*\\):\\(\\([ \t]\\|$\\).*\\)$")
-              (replace-match (concat "%" (match-string 1)
-                                     (match-string 2)) t t)
-              (forward-line))))))
-
+    (unless (get-text-property (point) 'org-example)
+     (if opt
+        (progn (goto-char (match-beginning 0))
+               (insert "\\begin{verbatim}\n")
+               (while (looking-at "^\\([ \t]*\\):\\(\\([ \t]\\|$\\).*\\)$")
+                 (replace-match (concat (match-string 1)
+                                        (match-string 2)) t t)
+                 (forward-line))
+               (insert "\\end{verbatim}\n\n"))
+       (progn (goto-char (match-beginning 0))
+             (while (looking-at "^\\([ \t]*\\):\\(\\([ \t]\\|$\\).*\\)$")
+               (replace-match (concat "%" (match-string 1)
+                                      (match-string 2)) t t)
+               (forward-line)))))))
 
 (defvar org-table-last-alignment) ; defined in org-table.el
 (defvar org-table-last-column-widths) ; defined in org-table.el
 (declare-function orgtbl-to-latex "org-table" (table params) t)
 (defun org-export-latex-tables (insert)
   "Convert tables to LaTeX and INSERT it."
+  ;; First, get the table.el tables
+  (goto-char (point-min))
+  (while (re-search-forward "^[ \t]*\\(\\+-[-+]*\\+\\)[ \t]*\n[ \t]*|" nil t)
+    (org-if-unprotected
+     (require 'table)
+     (org-export-latex-convert-table.el-table)))
+
+  ;; And now the Org-mode tables
   (goto-char (point-min))
   (while (re-search-forward "^\\([ \t]*\\)|" nil t)
     (org-if-unprotected-at (1- (point))
@@ -1351,7 +1589,7 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
              (org-table-last-column-widths (copy-sequence
                                             org-table-last-column-widths))
              fnum fields line lines olines gr colgropen line-fmt align
-             caption label attr floatp longtblp)
+             caption shortn label attr floatp longtblp)
         (if org-export-latex-tables-verbatim
             (let* ((tbl (concat "\\begin{verbatim}\n" raw-table
                                 "\\end{verbatim}\n")))
@@ -1360,6 +1598,8 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
           (progn
             (setq caption (org-find-text-property-in-string
                            'org-caption raw-table)
+                 shortn (org-find-text-property-in-string
+                         'org-caption-shortn raw-table)
                   attr (org-find-text-property-in-string
                         'org-attributes raw-table)
                   label (org-find-text-property-in-string
@@ -1367,9 +1607,10 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
                   longtblp (and attr (stringp attr)
                                 (string-match "\\<longtable\\>" attr))
                   align (and attr (stringp attr)
-                             (string-match "\\<align=\\([^ \t\n\r,]+\\)" attr)
+                             (string-match "\\<align=\\([^ \t\n\r]+\\)" attr)
                              (match-string 1 attr))
                   floatp (or caption label))
+           (setq caption (and caption (org-export-latex-fontify-headline caption)))
             (setq lines (org-split-string raw-table "\n"))
             (apply 'delete-region (list beg end))
             (when org-export-table-remove-special-lines
@@ -1424,15 +1665,17 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
                         (if longtblp
                             (concat "\\begin{longtable}{" align "}\n")
                           (if floatp "\\begin{table}[htb]\n"))
-                        (if (or floatp longtblp)
+                        (if floatp
                             (format
-                             "\\caption{%s%s}"
-                             (if label (concat "\\\label{" label "}") "")
+                             "\\caption%s{%s}"
+                             (if shortn (concat "[" shortn "]") "")
                              (or caption "")))
-                        (if longtblp "\\\\\n" "\n")
+                        (if (and longtblp caption) "\\\\\n" "\n")
                         (if (and org-export-latex-tables-centered (not longtblp))
                             "\\begin{center}\n")
-                        (if (not longtblp) (concat "\\begin{tabular}{" align "}\n"))
+                        (if (not longtblp)
+                           (format "\\begin{%s}{%s}\n"
+                                   org-export-latex-tabular-environment align))
                         (orgtbl-to-latex
                          lines
                          `(:tstart nil :tend nil
@@ -1444,7 +1687,9 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
 \\endfoot
 \\endlastfoot" (length org-table-last-alignment))
                                              nil)))
-                        (if (not longtblp) (concat "\n\\end{tabular}"))
+                        (if (not longtblp)
+                           (format "\n\\end{%s}"
+                                   org-export-latex-tabular-environment))
                         (if longtblp "\n" (if org-export-latex-tables-centered
                                               "\n\\end{center}\n" "\n"))
                         (if longtblp
@@ -1452,6 +1697,58 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
                           (if floatp "\\end{table}"))))
                       "\n\n"))))))))
 
+(defun org-export-latex-convert-table.el-table ()
+  "Replace table.el table at point with LaTeX code."
+  (let (tbl caption shortn label line floatp attr align rmlines)
+    (setq line (buffer-substring (point-at-bol) (point-at-eol))
+         label (org-get-text-property-any 0 'org-label line)
+         caption (org-get-text-property-any 0 'org-caption line)
+         shortn (org-get-text-property-any 0 'org-caption-shortn line)
+         attr (org-get-text-property-any 0 'org-attributes line)
+         align (and attr (stringp attr)
+                    (string-match "\\<align=\\([^ \t\n\r,]+\\)" attr)
+                    (match-string 1 attr))
+         rmlines (and attr (stringp attr)
+                      (string-match "\\<rmlines\\>" attr))
+         floatp (or label caption))
+    (and (get-buffer "*org-export-table*")
+        (kill-buffer (get-buffer "*org-export-table*")))
+    (table-generate-source 'latex "*org-export-table*" "caption")
+    (setq tbl (with-current-buffer "*org-export-table*"
+               (buffer-string)))
+    (while (string-match "^%.*\n" tbl)
+      (setq tbl (replace-match "" t t tbl)))
+    ;; fix the hlines
+    (when rmlines
+      (let ((n 0) lines)
+       (setq lines (mapcar (lambda (x)
+                             (if (string-match "^\\\\hline$" x)
+                                 (progn
+                                   (setq n (1+ n))
+                                   (if (= n 2) x nil))
+                               x))
+                           (org-split-string tbl "\n")))
+       (setq tbl (mapconcat 'identity (delq nil lines) "\n"))))
+    (when (and align (string-match "\\\\begin{tabular}{.*}" tbl))
+      (setq tbl (replace-match (concat "\\begin{tabular}{" align "}")
+                              t t tbl)))
+    (and (get-buffer "*org-export-table*")
+        (kill-buffer (get-buffer "*org-export-table*")))
+    (beginning-of-line 0)
+    (while (looking-at "[ \t]*\\(|\\|\\+-\\)")
+      (delete-region (point) (1+ (point-at-eol))))
+    (when org-export-latex-tables-centered
+      (setq tbl (concat "\\begin{center}\n" tbl "\\end{center}")))
+    (when floatp
+      (setq tbl (concat "\\begin{table}\n"
+                       (format "\\caption%s{%s%s}\n"
+                               (if shortn (format "[%s]" shortn) "")
+                               (if label (format "\\label{%s}" label) "")
+                               (or caption ""))
+                       tbl
+                       "\n\\end{table}\n")))
+    (insert (org-export-latex-protect-string tbl))))
+
 (defun org-export-latex-fontify ()
   "Convert fontification to LaTeX."
   (goto-char (point-min))
@@ -1468,12 +1765,17 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
       (unless (or (and (get-text-property (- (point) 2) 'org-protected)
                       (not (get-text-property
                             (- (point) 2) 'org-verbatim-emph)))
+                 (equal (char-after (match-beginning 3))
+                        (char-after (1+ (match-beginning 3))))
                  (save-excursion
                    (goto-char (match-beginning 1))
                    (save-match-data
                      (and (org-at-table-p)
                           (string-match
-                           "[|\n]" (buffer-substring beg end))))))
+                           "[|\n]" (buffer-substring beg end)))))
+                 (and (equal (match-string 3) "+")
+                      (save-match-data
+                        (string-match "\\`-+\\'" (match-string 4)))))
        (setq s (match-string 4))
        (setq rpl (concat (match-string 1)
                          (org-export-latex-emph-format (cadr emph)
@@ -1482,7 +1784,7 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
        (if (caddr emph)
            (setq rpl (org-export-latex-protect-string rpl))
          (save-match-data
-           (if (string-match "\\`.\\(\\\\[a-z]+{\\)\\(.*\\)\\(}\\).?\\'" rpl)
+           (if (string-match "\\`.?\\(\\\\[a-z]+{\\)\\(.*\\)\\(}\\).?\\'" rpl)
                (progn
                  (add-text-properties (match-beginning 1) (match-end 1)
                                       '(org-protected t) rpl)
@@ -1541,10 +1843,11 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
                          "file")))
            (coderefp (equal type "coderef"))
            (caption (org-find-text-property-in-string 'org-caption raw-path))
+           (shortn (org-find-text-property-in-string 'org-caption-shortn raw-path))
            (attr (or (org-find-text-property-in-string 'org-attributes raw-path)
                      (plist-get org-export-latex-options-plist :latex-image-options)))
            (label (org-find-text-property-in-string 'org-label raw-path))
-           imgp radiop
+           imgp radiop fnc
            ;; define the path of the link
            (path (cond
                   ((member type '("coderef"))
@@ -1573,11 +1876,12 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
                                       raw-path))))))))
        ;; process with link inserting
        (apply 'delete-region remove)
+       (setq caption (and caption (org-export-latex-fontify-headline caption)))
        (cond ((and imgp
                   (plist-get org-export-latex-options-plist :inline-images))
              ;; OK, we need to inline an image
              (insert
-              (org-export-latex-format-image raw-path caption label attr)))
+              (org-export-latex-format-image raw-path caption label attr shortn)))
             (coderefp
              (insert (format
                       (org-export-get-coderef-format path desc)
@@ -1589,27 +1893,37 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
                              (org-remove-initial-hash
                               (org-solidify-link-text raw-path))
                              desc)))
-            (path 
+            (path
              (when (org-at-table-p)
                ;; There is a strange problem when we have a link in a table,
                ;; ampersands then cause a problem.  I think this must be
                ;; a LaTeX issue, but we here implement a work-around anyway.
                (setq path (org-export-latex-protect-amp path)
                      desc (org-export-latex-protect-amp desc)))
-             (insert (format "\\href{%s}{%s}" path desc)))
+             (insert (format org-export-latex-hyperref-format path desc)))
+
+            ((functionp (setq fnc (nth 2 (assoc type org-link-protocols))))
+             ;; The link protocol has a function for formatting the link
+             (insert
+              (save-match-data
+                (funcall fnc (org-link-unescape raw-path) desc 'latex))))
+
             (t (insert "\\texttt{" desc "}")))))))
 
 
-(defun org-export-latex-format-image (path caption label attr)
+(defun org-export-latex-format-image (path caption label attr &optional shortn)
   "Format the image element, depending on user settings."
-  (let (floatp wrapp placement figenv)
+  (let (ind floatp wrapp multicolumnp placement figenv)
     (setq floatp (or caption label))
+    (setq ind (org-get-text-property-any 0 'original-indentation path))
     (when (and attr (stringp attr))
       (if (string-match "[ \t]*\\<wrap\\>" attr)
          (setq wrapp t floatp nil attr (replace-match "" t t attr)))
       (if (string-match "[ \t]*\\<float\\>" attr)
-         (setq wrapp nil floatp t attr (replace-match "" t t attr))))
-    
+         (setq wrapp nil floatp t attr (replace-match "" t t attr)))
+      (if (string-match "[ \t]*\\<multicolumn\\>" attr)
+         (setq multicolumnp t attr (replace-match "" t t attr))))
+
     (setq placement
          (cond
           (wrapp "{l}{0.5\\textwidth}")
@@ -1630,8 +1944,13 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
           (wrapp "\\begin{wrapfigure}%placement
 \\centering
 \\includegraphics[%attr]{%path}
-\\caption{%labelcmd%caption}
+\\caption%shortn{%labelcmd%caption}
 \\end{wrapfigure}")
+          (multicolumnp "\\begin{figure*}%placement
+\\centering
+\\includegraphics[%attr]{%path}
+\\caption{%labelcmd%caption}
+\\end{figure*}")
           (floatp "\\begin{figure}%placement
 \\centering
 \\includegraphics[%attr]{%path}
@@ -1639,20 +1958,29 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
 \\end{figure}")
           (t "\\includegraphics[%attr]{%path}")))
 
+
+    (setq figenv (mapconcat 'identity (split-string figenv "\n")
+                           (save-excursion (beginning-of-line 1)
+                                           (looking-at "[ \t]*")
+                                           (concat "\n" (match-string 0)))))
+
     (if (and (not label) (not caption)
             (string-match "^\\\\caption{.*\n" figenv))
        (setq figenv (replace-match "" t t figenv)))
-    (org-fill-template
-     figenv
-     (list (cons "path"
-                (if (file-name-absolute-p path)
-                    (expand-file-name path)
-                  path))
-          (cons "attr" attr)
-          (cons "labelcmd" (if label (format "\\label{%s}"
-                                             label)""))
-          (cons "caption" (or caption ""))
-          (cons "placement" (or placement ""))))))
+    (org-add-props
+       (org-fill-template
+        figenv
+        (list (cons "path"
+                    (if (file-name-absolute-p path)
+                        (expand-file-name path)
+                      path))
+              (cons "attr" attr)
+              (cons "shortn" (if shortn (format "[%s]" shortn) ""))
+              (cons "labelcmd" (if label (format "\\label{%s}"
+                                                 label)""))
+              (cons "caption" (or caption ""))
+              (cons "placement" (or placement ""))))
+       nil 'original-indentation ind)))
 
 (defun org-export-latex-protect-amp (s)
   (while (string-match "\\([^\\\\]\\)\\(&\\)" s)
@@ -1666,7 +1994,6 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
     s))
 (defvar org-latex-entities)   ; defined below
 (defvar org-latex-entities-regexp)   ; defined below
-(defvar org-latex-entities-exceptions)   ; defined below
 
 (defun org-export-latex-preprocess (parameters)
   "Clean stuff in the LaTeX export."
@@ -1679,7 +2006,8 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
   ;; Preserve latex environments
   (goto-char (point-min))
   (while (re-search-forward "^[ \t]*\\\\begin{\\([a-zA-Z]+\\*?\\)}" nil t)
-    (let* ((start (progn (beginning-of-line) (point)))
+    (org-if-unprotected
+     (let* ((start (progn (beginning-of-line) (point)))
           (end (and (re-search-forward
                      (concat "^[ \t]*\\\\end{"
                              (regexp-quote (match-string 1))
@@ -1687,7 +2015,7 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
                     (point-at-eol))))
       (if end
          (add-text-properties start end '(org-protected t))
-       (goto-char (point-at-eol)))))
+       (goto-char (point-at-eol))))))
 
   ;; Preserve math snippets
 
@@ -1705,13 +2033,15 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
          (setq beg (+ (match-beginning 0) off) end (- (match-end 0) 0))
          (add-text-properties beg end '(org-protected t org-latex-math t))))))
 
-  ;; Convert LaTeX to \LaTeX{}
+  ;; Convert LaTeX to \LaTeX{} and TeX to \TeX{}
   (goto-char (point-min))
   (let ((case-fold-search nil))
-    (while (re-search-forward "\\([^+_]\\)LaTeX" nil t)
-      (org-if-unprotected
-       (replace-match (org-export-latex-protect-string
-                      (concat (match-string 1) "\\LaTeX{}")) t t))))
+    (while (re-search-forward "\\<\\(\\(La\\)?TeX\\)\\>" nil t)
+      (unless (eq (char-before (match-beginning 1)) ?\\)
+       (org-if-unprotected-1
+        (replace-match (org-export-latex-protect-string
+                        (concat "\\" (match-string 1)
+                                "{}")) t t)))))
 
   ;; Convert blockquotes
   (goto-char (point-min))
@@ -1759,25 +2089,36 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
      (replace-match (org-export-latex-protect-string "\\hrule") t t)))
 
   ;; Protect LaTeX commands like \command[...]{...} or \command{...}
-  (let ((re (concat "\\\\[a-zA-Z]+\\(?:"
-                   "\\[.*\\]"
-                   "\\)?"
-                   (org-create-multibrace-regexp "{" "}" 3))))
+  (goto-char (point-min))
+  (let ((re (concat
+            "\\\\\\([a-zA-Z]+\\)"
+            "\\(?:<[^<>\n]*>\\)*"
+            "\\(?:\\[[^][\n]*?\\]\\)*"
+            "\\(?:<[^<>\n]*>\\)*"
+            "\\(" (org-create-multibrace-regexp "{" "}" 3) "\\)\\{1,3\\}")))
     (while (re-search-forward re nil t)
-      (unless (save-excursion (goto-char (match-beginning 0))
-                             (equal (char-after (point-at-bol)) ?#))
+      (unless (or
+              ;; check for comment line
+              (save-excursion (goto-char (match-beginning 0))
+                              (org-in-indented-comment-line))
+              ;; Check if this is a defined entity, so that is may need conversion
+              (org-entity-get (match-string 1))
+              )
        (add-text-properties (match-beginning 0) (match-end 0)
                             '(org-protected t)))))
 
+  ;; Special case for \nbsp
+  (goto-char (point-min))
+  (while (re-search-forward "\\\\nbsp\\({}\\|\\>\\)" nil t)
+    (org-if-unprotected
+     (replace-match (org-export-latex-protect-string "~"))))
+
   ;; Protect LaTeX entities
   (goto-char (point-min))
-  (let (a)
-    (while (re-search-forward org-latex-entities-regexp nil t)
-      (if (setq a (assoc (match-string 0) org-latex-entities-exceptions))
-         (replace-match (org-add-props (nth 1 a) nil 'org-protected t)
-                        t t)
-       (add-text-properties (match-beginning 0) (match-end 0)
-                            '(org-protected t)))))
+  (while (re-search-forward org-latex-entities-regexp nil t)
+    (org-if-unprotected
+     (add-text-properties (match-beginning 0) (match-end 0)
+                         '(org-protected t))))
 
   ;; Replace radio links
   (goto-char (point-min))
@@ -1786,10 +2127,12 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
                  ">>>?\\((INVISIBLE)\\)?") nil t)
     (org-if-unprotected-at (+ (match-beginning 0) 2)
      (replace-match
-      (org-export-latex-protect-string
-       (format "\\label{%s}%s" (save-match-data (org-solidify-link-text
-                                                (match-string 1)))
-              (if (match-string 2) "" (match-string 1)))) t t)))
+      (concat
+       (org-export-latex-protect-string
+       (format "\\label{%s}" (save-match-data (org-solidify-link-text
+                                               (match-string 1)))))
+       (if (match-string 2) "" (match-string 1)))
+      t t)))
 
   ;; Delete @<...> constructs
   ;; Thanks to Daniel Clemente for this regexp
@@ -1832,6 +2175,10 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
                 (add-text-properties (1- (length footnote-rpl))
                                      (length footnote-rpl)
                                      '(org-protected t) footnote-rpl)
+                (if (org-on-heading-p)
+                     (setq footnote-rpl
+                           (concat (org-export-latex-protect-string "\\protect")
+                                   footnote-rpl)))
                 (insert footnote-rpl)))
             )))))
 
@@ -1842,17 +2189,44 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
       (org-if-unprotected
        (replace-match "")))))
 
+(defun org-export-latex-fix-inputenc ()
+  "Set the coding system in inputenc to what the buffer is."
+  (let* ((cs buffer-file-coding-system)
+        (opt (or (ignore-errors (latexenc-coding-system-to-inputenc cs))
+                 "utf8")))
+    (when opt
+      ;; Translate if that is requested
+      (setq opt (or (cdr (assoc opt org-export-latex-inputenc-alist)) opt))
+      ;; find the \usepackage statement and replace the option
+      (goto-char (point-min))
+      (while (re-search-forward "\\\\usepackage\\[\\(AUTO\\)\\]{inputenc}"
+                               nil t)
+       (goto-char (match-beginning 1))
+       (delete-region (match-beginning 1) (match-end 1))
+       (insert opt))
+      (and buffer-file-name
+          (save-buffer)))))
+
 ;;; List handling:
 
 (defun org-export-latex-lists ()
   "Convert plain text lists in current buffer into LaTeX lists."
-  (goto-char (point-min))
-  (while (re-search-forward org-list-beginning-re nil t)
-    (org-if-unprotected
-     (beginning-of-line)
-     (insert (org-list-to-latex (org-list-parse-list t)
-                               org-export-latex-list-parameters))
-     "\n")))
+  (let (res)
+    (goto-char (point-min))
+    (while (org-re-search-forward-unprotected org-list-beginning-re nil t)
+      (beginning-of-line)
+      (setq res (org-list-to-latex (org-list-parse-list t)
+                                  org-export-latex-list-parameters))
+      (while (string-match "^\\(\\\\item[ \t]+\\)\\[@start:\\([0-9]+\\)\\]"
+                          res)
+       (setq res (replace-match
+                  (concat (format "\\setcounter{enumi}{%d}"
+                                  (1- (string-to-number
+                                       (match-string 2 res))))
+                          "\n"
+                          (match-string 1 res))
+                  t t res)))
+      (insert res "\n"))))
 
 (defconst org-latex-entities
  '("\\!"
@@ -1959,7 +2333,6 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
    "\\medskip"
    "\\multicolumn"
    "\\multiput"
-   ("\\nbsp" "~")
    "\\newcommand"
    "\\newcounter"
    "\\newenvironment"
@@ -2031,14 +2404,9 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
    "\\vspace")
  "A list of LaTeX commands to be protected when performing conversion.")
 
-(defvar org-latex-entities-exceptions nil)
-
 (defconst org-latex-entities-regexp
   (let (names rest)
     (dolist (x org-latex-entities)
-      (when (consp x)
-       (add-to-list 'org-latex-entities-exceptions x)
-       (setq x (car x)))
       (if (string-match "[a-zA-Z]$" x)
          (push x names)
        (push x rest)))
index 5d1da8a861cdc395b98b48a7152ec996d01c01a2..19ba1a963955b89a52da5224ec459d51d53d2eba 100644 (file)
@@ -7,7 +7,7 @@
 ;;        Bastien Guerry <bzg AT altern DOT org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33x
+;; Version: 7.01
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -31,6 +31,8 @@
 
 ;;; Code:
 
+(eval-when-compile
+  (require 'cl))
 (require 'org-macs)
 (require 'org-compat)
 
@@ -49,7 +51,8 @@
 (declare-function org-get-indentation "org" (&optional line))
 (declare-function org-timer-item "org-timer" (&optional arg))
 (declare-function org-combine-plists "org" (&rest plists))
-(declare-function org-entry-get "org" (pom property &optional inherit))
+(declare-function org-entry-get "org"
+                 (pom property &optional inherit literal-nil))
 (declare-function org-narrow-to-subtree "org" ())
 (declare-function org-show-subtree "org" ())
 
@@ -84,7 +87,29 @@ heading will be exposed in a children' view."
 (defcustom org-list-demote-modify-bullet nil
   "Default bullet type installed when demoting an item.
 This is an association list, for each bullet type, this alist will point
-to the bulled that should be used when this item is demoted."
+to the bullet that should be used when this item is demoted.
+For example,
+
+ (setq org-list-demote-modify-bullet
+       '((\"+\" . \"-\") (\"-\" . \"+\") (\"*\" . \"+\")))
+
+will make
+
+  + Movies
+    + Silence of the Lambs
+    + My Cousin Vinny
+  + Books
+    + The Hunt for Red October
+    + The Road to Omaha
+
+into
+
+  + Movies
+    - Silence of the Lambs
+    - My Cousin Vinny
+  + Books
+    - The Hunt for Red October
+    - The Road to Omaha"
   :group 'org-plain-lists
   :type '(repeat
          (cons
@@ -119,19 +144,21 @@ When a string, it will be used as a regular expression.    When the bullet
 type of a list is changed, the new bullet type will be matched against this
 regexp.         If it matches, there will be two spaces instead of one after
 the bullet in each item of he list."
-  :group 'org-plain-list
+  :group 'org-plain-lists
   :type '(choice
          (const :tag "never" nil)
          (regexp)))
 
 (defcustom org-empty-line-terminates-plain-lists nil
-  "Non-nil means, an empty line ends all plain list levels.
+  "Non-nil means an empty line ends all plain list levels.
+This is currently effective only during export.  It should also have
+an effect for indentation and plain list folding, but it does not.
 When nil, empty lines are part of the preceding item."
   :group 'org-plain-lists
   :type 'boolean)
 
 (defcustom org-auto-renumber-ordered-lists t
-  "Non-nil means, automatically renumber ordered plain lists.
+  "Non-nil means automatically renumber ordered plain lists.
 Renumbering happens when the sequence have been changed with
 \\[org-shiftmetaup] or \\[org-shiftmetadown].  After other editing commands,
 use \\[org-ctrl-c-ctrl-c] to trigger renumbering."
@@ -139,7 +166,7 @@ use \\[org-ctrl-c-ctrl-c] to trigger renumbering."
   :type 'boolean)
 
 (defcustom org-provide-checkbox-statistics t
-  "Non-nil means, update checkbox statistics after insert and toggle.
+  "Non-nil means update checkbox statistics after insert and toggle.
 When this is set, checkbox statistics is updated each time you
 either insert a new checkbox with \\[org-insert-todo-heading] or
 toggle a checkbox with \\[org-ctrl-c-ctrl-c]."
@@ -147,7 +174,7 @@ toggle a checkbox with \\[org-ctrl-c-ctrl-c]."
   :type 'boolean)
 
 (defcustom org-hierarchical-checkbox-statistics t
-  "Non-nil means, checkbox statistics counts only the state of direct children.
+  "Non-nil means checkbox statistics counts only the state of direct children.
 When nil, all boxes below the cookie are counted.
 This can be set to nil on a per-node basis using a COOKIE_DATA property
 with the word \"recursive\" in the value."
@@ -169,19 +196,19 @@ When the indentation would be larger than this, it will become
 % END RECEIVE ORGLST %n
 \\begin{comment}
 #+ORGLST: SEND %n org-list-to-latex
-| | |
+-
 \\end{comment}\n")
     (texinfo-mode "@c BEGIN RECEIVE ORGLST %n
 @c END RECEIVE ORGLST %n
 @ignore
 #+ORGLST: SEND %n org-list-to-texinfo
-| | |
+-
 @end ignore\n")
     (html-mode "<!-- BEGIN RECEIVE ORGLST %n -->
 <!-- END RECEIVE ORGLST %n -->
 <!--
 #+ORGLST: SEND %n org-list-to-html
-| | |
+-
 -->\n"))
   "Templates for radio lists in different major modes.
 All occurrences of %n in a template will be replaced with the name of the
@@ -195,17 +222,25 @@ list, obtained by prompting the user."
 
 ;;; Plain list items
 
+(defun org-item-re (&optional general)
+  "Return the correct regular expression for plain lists.
+If GENERAL is non-nil, return the general regexp independent of the value
+of `org-plain-list-ordered-item-terminator'."
+  (cond
+   ((or general (eq org-plain-list-ordered-item-terminator t))
+    "\\([ \t]*\\([-+]\\|\\([0-9]+[.)]\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)")
+   ((= org-plain-list-ordered-item-terminator ?.)
+    "\\([ \t]*\\([-+]\\|\\([0-9]+\\.\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)")
+   ((= org-plain-list-ordered-item-terminator ?\))
+    "\\([ \t]*\\([-+]\\|\\([0-9]+)\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)")
+   (t (error "Invalid value of `org-plain-list-ordered-item-terminator'"))))
+
 (defun org-at-item-p ()
   "Is point in a line starting a hand-formatted item?"
-  (let ((llt org-plain-list-ordered-item-terminator))
-    (save-excursion
-      (goto-char (point-at-bol))
-      (looking-at
-       (cond
-       ((eq llt t)  "\\([ \t]*\\([-+]\\|\\([0-9]+[.)]\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)")
-       ((= llt ?.)  "\\([ \t]*\\([-+]\\|\\([0-9]+\\.\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)")
-       ((= llt ?\)) "\\([ \t]*\\([-+]\\|\\([0-9]+)\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)")
-       (t (error "Invalid value of `org-plain-list-ordered-item-terminator'")))))))
+
+  (save-excursion
+    (goto-char (point-at-bol))
+    (looking-at (org-item-re))))
 
 (defun org-at-item-bullet-p ()
   "Is point at the bullet of a plain list item?"
@@ -214,7 +249,7 @@ list, obtained by prompting the user."
        (< (point) (match-end 0))))
 
 (defun org-in-item-p ()
-  "It the cursor inside a plain list item.
+  "Is the cursor inside a plain list item.
 Does not have to be the first line."
   (save-excursion
     (condition-case nil
@@ -432,7 +467,9 @@ the whole buffer."
          (recursive
           (or (not org-hierarchical-checkbox-statistics)
               (string-match "\\<recursive\\>"
-                            (or (org-entry-get nil "COOKIE_DATA") ""))))
+                            (or (ignore-errors
+                                  (org-entry-get nil "COOKIE_DATA"))
+                                ""))))
          (cstat 0)
          )
      (when all
@@ -586,6 +623,17 @@ If the cursor is not in an item, throw an error."
       (goto-char pos)
       (error "Not in an item"))))
 
+(defun org-end-of-item-text-before-children ()
+  "Move to the end of the item text, stops before the first child if any.
+Assumes that the cursor is in the first line of an item."
+  (goto-char
+   (min (save-excursion (org-end-of-item) (point))
+       (save-excursion
+         (goto-char (point-at-eol))
+         (if (re-search-forward (concat "^" (org-item-re t)) nil 'move)
+             (match-beginning 0)
+           (point-max))))))
+
 (defun org-next-item ()
   "Move to the beginning of the next item in the current plain list.
 Error if not at a plain list, or if this is the last item in the list."
@@ -614,7 +662,8 @@ Error if not at a plain list, or if this is the first item in the list."
        (if (looking-at "[ \t]*$")
            nil
          (if (<= (setq ind1 (org-get-indentation)) ind)
-             (throw 'exit t)))))
+             (throw 'exit t)))
+       (if (bobp) (throw 'exit t))))
     (condition-case nil
        (if (or (not (org-at-item-p))
                (< ind1 (1- ind)))
@@ -818,6 +867,10 @@ with something like \"1.\" or \"2)\"."
     (setq bobp (bobp))
     (looking-at "[ \t]*[0-9]+\\([.)]\\)")
     (setq fmt (concat "%d" (or (match-string 1) ".")))
+    (save-excursion
+      (goto-char (match-end 0))
+      (if (looking-at "[ \t]*\\[@start:\\([0-9]+\\)")
+         (setq n (1- (string-to-number (match-string 1))))))
     (beginning-of-line 0)
     ;; walk forward and replace these numbers
     (catch 'exit
@@ -847,7 +900,7 @@ Also, fix the indentation."
   (interactive)
   (unless (org-at-item-p) (error "This is not a list"))
   (let ((line (org-current-line))
-       (col (current-column))
+       (chars-from-eol (- (point-at-eol) (point)))
        (ind (current-indentation))
        ind1 bullet oldbullet)
     ;; find where this list begins
@@ -878,7 +931,7 @@ Also, fix the indentation."
          (org-shift-item-indentation (- (length bullet)
                                         (length oldbullet))))))
     (org-goto-line line)
-    (org-move-to-column col)
+    (goto-char (max (point-at-bol) (- (point-at-eol) chars-from-eol)))
     (if (string-match "[0-9]" bullet)
        (org-renumber-ordered-list 1))))
 
@@ -956,12 +1009,24 @@ I.e. to the text after the last item."
 (defvar org-last-indent-end-marker (make-marker))
 
 (defun org-outdent-item (arg)
-  "Outdent a local list item."
+  "Outdent a local list item, but not its children."
   (interactive "p")
-  (org-indent-item (- arg)))
+  (org-indent-item-tree (- arg) 'no-subtree))
 
 (defun org-indent-item (arg)
-  "Indent a local list item."
+  "Indent a local list item, but not its children."
+  (interactive "p")
+  (org-indent-item-tree arg 'no-subtree))
+
+(defun org-outdent-item-tree (arg &optional no-subtree)
+  "Outdent a local list item including its children.
+If NO-SUBTREE is set, only outdent the item itself, not its children."
+  (interactive "p")
+  (org-indent-item-tree (- arg) no-subtree))
+
+(defun org-indent-item-tree (arg &optional no-subtree)
+  "Indent a local list item including its children.
+If NO-SUBTREE is set, only indent the item itself, not its children."
   (interactive "p")
   (and (org-region-active-p) (org-cursor-to-region-beginning))
   (unless (org-at-item-p)
@@ -970,12 +1035,15 @@ I.e. to the text after the last item."
     (setq firstp (org-first-list-item-p))
     (save-excursion
       (setq end (and (org-region-active-p) (region-end)))
-      (if (memq last-command '(org-shiftmetaright org-shiftmetaleft))
+      (if (and (memq last-command '(org-shiftmetaright org-shiftmetaleft))
+              (memq this-command '(org-shiftmetaright org-shiftmetaleft)))
          (setq beg org-last-indent-begin-marker
                end org-last-indent-end-marker)
        (org-beginning-of-item)
        (setq beg (move-marker org-last-indent-begin-marker (point)))
-       (org-end-of-item)
+       (if no-subtree
+           (org-end-of-item-text-before-children)
+         (org-end-of-item))
        (setq end (move-marker org-last-indent-end-marker (or end (point)))))
       (goto-char beg)
       (setq ind-bul (org-item-indent-positions)
@@ -1049,7 +1117,7 @@ Assumes cursor in item line."
        (org-adapt-indentation nil))
     (cond
      ((and (looking-at "[ \t]*$")
-          (looking-back "^\\([ \t]*\\)\\([-+*]\\|[0-9]+[).]\\)[ \t]+"))
+          (org-looking-back "^\\([ \t]*\\)\\([-+*]\\|[0-9]+[).]\\)[ \t]+"))
       (setq this-command 'org-cycle-item-indentation)
       (if (eq last-command 'org-cycle-item-indentation)
          (condition-case nil
@@ -1081,7 +1149,10 @@ Return a list containing first level items as strings and
 sublevels as a list of strings."
   (let* ((item-beginning (org-list-item-beginning))
         (start (car item-beginning))
-        (end (org-list-end (cdr item-beginning)))
+        (end (save-excursion
+               (goto-char (org-list-end (cdr item-beginning)))
+               (org-back-over-empty-lines)
+               (point)))
         output itemsep ltype)
     (while (re-search-forward org-list-beginning-re end t)
       (goto-char (match-beginning 3))
@@ -1100,7 +1171,7 @@ sublevels as a list of strings."
                                    (match-beginning 0)) end))))
             (item (buffer-substring
                    (point)
-                   (or (and (re-search-forward
+                   (or (and (org-re-search-forward-unprotected
                              org-list-beginning-re end t)
                             (goto-char (match-beginning 0)))
                        (goto-char end))))
@@ -1207,36 +1278,34 @@ this list."
     (save-excursion
       (org-list-goto-true-beginning)
       (beginning-of-line 0)
-      (unless (looking-at "#\\+ORGLST: *SEND +\\([a-zA-Z0-9_]+\\) +\\([^ \t\r\n]+\\)\\( +.*\\)?")
+      (unless (looking-at "[ \t]*#\\+ORGLST[: \t][ \t]*SEND[ \t]+\\([^ \t\r\n]+\\)[ \t]+\\([^ \t\r\n]+\\)\\([ \t]+.*\\)?")
        (if maybe
            (throw 'exit nil)
          (error "Don't know how to transform this list"))))
     (let* ((name (match-string 1))
           (transform (intern (match-string 2)))
           (item-beginning (org-list-item-beginning))
-          (txt (buffer-substring-no-properties
-                (car item-beginning)
-                (org-list-end (cdr item-beginning))))
-          (list (org-list-parse-list))
-          beg)
+          (list (save-excursion (org-list-goto-true-beginning)
+                                (org-list-parse-list)))
+          txt beg)
       (unless (fboundp transform)
        (error "No such transformation function %s" transform))
-      (setq txt (funcall transform list))
-      ;; Find the insertion place
-      (save-excursion
-       (goto-char (point-min))
-       (unless (re-search-forward
-                (concat "BEGIN RECEIVE ORGLST +" name "\\([ \t]\\|$\\)") nil t)
-         (error "Don't know where to insert translated list"))
-       (goto-char (match-beginning 0))
-       (beginning-of-line 2)
-       (setq beg (point))
-       (unless (re-search-forward (concat "END RECEIVE ORGLST +" name) nil t)
-         (error "Cannot find end of insertion region"))
-       (beginning-of-line 1)
-       (delete-region beg (point))
-       (goto-char beg)
-       (insert txt "\n"))
+      (let ((txt (funcall transform list)))
+       ;; Find the insertion place
+       (save-excursion
+         (goto-char (point-min))
+         (unless (re-search-forward
+                  (concat "BEGIN RECEIVE ORGLST +" name "\\([ \t]\\|$\\)") nil t)
+           (error "Don't know where to insert translated list"))
+         (goto-char (match-beginning 0))
+         (beginning-of-line 2)
+         (setq beg (point))
+         (unless (re-search-forward (concat "END RECEIVE ORGLST +" name) nil t)
+           (error "Cannot find end of insertion region"))
+         (beginning-of-line 1)
+         (delete-region beg (point))
+         (goto-char beg)
+         (insert txt "\n")))
       (message "List converted and installed at receiver location"))))
 
 (defun org-list-to-generic (list params)
@@ -1318,7 +1387,7 @@ Valid parameters PARAMS are
 
 (defun org-list-to-latex (list &optional params)
   "Convert LIST into a LaTeX list.
-LIST is as returnd by `org-list-parse-list'.  PARAMS is a property list
+LIST is as returned by `org-list-parse-list'.  PARAMS is a property list
 with overruling parameters for `org-list-to-generic'."
   (org-list-to-generic
    list
@@ -1335,7 +1404,7 @@ with overruling parameters for `org-list-to-generic'."
 
 (defun org-list-to-html (list &optional params)
   "Convert LIST into a HTML list.
-LIST is as returnd by `org-list-parse-list'.  PARAMS is a property list
+LIST is as returned by `org-list-parse-list'.  PARAMS is a property list
 with overruling parameters for `org-list-to-generic'."
   (org-list-to-generic
    list
@@ -1352,7 +1421,7 @@ with overruling parameters for `org-list-to-generic'."
 
 (defun org-list-to-texinfo (list &optional params)
   "Convert LIST into a Texinfo list.
-LIST is as returnd by `org-list-parse-list'.  PARAMS is a property list
+LIST is as returned by `org-list-parse-list'.  PARAMS is a property list
 with overruling parameters for `org-list-to-generic'."
   (org-list-to-generic
    list
index ff0098ee11469a76f3758e1228fc0068bb0c3488..06591703da9848bc7e7c7819bdcb4743037024d1 100644 (file)
@@ -5,7 +5,7 @@
 ;; Author: John Wiegley <johnw@gnu.org>
 ;;         Christopher Suckling <suckling at gmail dot com>
 
-;; Version: 6.33x
+;; Version: 7.01
 ;; Keywords: outlines, hypermedia, calendar, wp
 
 ;; This file is part of GNU Emacs.
@@ -39,7 +39,7 @@
 ;; messages selected in Mail.app.
 
 ;; (org-mac-message-insert-flagged) searches within an org-mode buffer
-;; for a specific heading, creating it if it doesn't exist. Any
+;; for a specific heading, creating it if it doesn't exist.  Any
 ;; message:// links within the first level of the heading are deleted
 ;; and replaced with links to flagged messages.
 
@@ -53,7 +53,7 @@
   :group 'org-link)
 
 (defcustom org-mac-mail-account "customize"
-  "The Mail.app account in which to search for flagged messages"
+  "The Mail.app account in which to search for flagged messages."
   :group 'org-mac-flagged-mail
   :type 'string)
 
@@ -81,7 +81,7 @@ This will use the command `open' with the message URL."
                 "open" (concat "message://<" (substring message-id 2) ">")))
 
 (defun as-get-selected-mail ()
-  "AppleScript to create links to selected messages in Mail.app"
+  "AppleScript to create links to selected messages in Mail.app."
   (do-applescript
    (concat
     "tell application \"Mail\"\n"
@@ -97,7 +97,7 @@ This will use the command `open' with the message URL."
     "end tell")))
 
 (defun as-get-flagged-mail ()
-  "AppleScript to create links to flagged messages in Mail.app"
+  "AppleScript to create links to flagged messages in Mail.app."
   (do-applescript
    (concat
     ;; Is Growl installed?
@@ -179,7 +179,7 @@ The Org-syntax text will be pushed to the kill ring, and also returned."
 
 (defun org-mac-message-insert-selected ()
   "Insert a link to the messages currently selected in Mail.app.
-This will use applescript to get the message-id and the subject of the
+This will use AppleScript to get the message-id and the subject of the
 active mail in Mail.app and make a link out of it."
   (interactive)
   (insert (org-mac-message-get-links "s")))
@@ -209,7 +209,7 @@ list of message:// links to flagged mail after heading."
            (insert "\n" (org-mac-message-get-links "f")))
        (goto-char (point-max))
        (insert "\n")
-       (org-insert-heading)
+       (org-insert-heading nil t)
        (insert org-heading "\n" (org-mac-message-get-links "f"))))))
 
 (provide 'org-mac-message)
index 1bfc2aed30760e2889bdeff5c203017db6db817a..212fae4fcc9237f189e85e78402968eef294841d 100644 (file)
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33x
+;; Version: 7.01
 ;;
 ;; This file is part of GNU Emacs.
 ;;
   "Return the value of symbol VAR if it is bound, else nil."
   `(and (boundp (quote ,var)) ,var))
 
+(defun org-not-nil (v)
+  "If V not nil, and also not the string \"nil\", then return V.
+Otherwise return nil."
+  (and v (not (equal v "nil")) v))
+
 (defmacro org-unmodified (&rest body)
   "Execute body without changing `buffer-modified-p'.
 Also, do not record undo information."
@@ -63,6 +68,8 @@ Also, do not record undo information."
            (setq ss (replace-match "a-zA-Z0-9" t t ss)))
          (while (string-match "\\[:alpha:\\]" ss)
            (setq ss (replace-match "a-zA-Z" t t ss)))
+         (while (string-match "\\[:punct:\\]" ss)
+           (setq ss (replace-match "\001-@[-`{-~" t t ss)))
          ss))
     s))
 
@@ -85,7 +92,7 @@ Also, do not record undo information."
 
 (defmacro org-maybe-intangible (props)
   "Add '(intangible t) to PROPS if Emacs version is earlier than Emacs 22.
-In emacs 21, invisible text is not avoided by the command loop, so the
+In Emacs 21, invisible text is not avoided by the command loop, so the
 intangible property is needed to make sure point skips this text.
 In Emacs 22, this is not necessary.  The intangible text property has
 led to problems with flyspell.  These problems are fixed in flyspell.el,
@@ -123,6 +130,14 @@ We use a macro so that the test can happen at compilation time."
      ,@body))
 (put 'org-if-unprotected-at 'lisp-indent-function 1)
 
+(defun org-re-search-forward-unprotected (&rest args)
+  "Like re-search-forward, but stop only in unprotected places."
+  (catch 'exit
+    (while t
+      (unless (apply 're-search-forward args)
+       (throw 'exit nil))
+      (unless (get-text-property (match-beginning 0) 'org-protected)
+       (throw 'exit (point))))))
 
 (defmacro org-with-remote-undo (_buffer &rest _body)
   "Execute BODY while recording undo information in two buffers."
@@ -152,7 +167,8 @@ We use a macro so that the test can happen at compilation time."
   `(let ((inhibit-read-only t)) ,@body))
 
 (defconst org-rm-props '(invisible t face t keymap t intangible t mouse-face t
-                                  rear-nonsticky t mouse-map t fontified t)
+                                  rear-nonsticky t mouse-map t fontified t
+                                  org-emphasis t)
   "Properties to remove when a string without properties is wanted.")
 
 (defsubst org-match-string-no-properties (num &optional string)
@@ -260,7 +276,6 @@ This is in contrast to merely setting it to 0."
       (setq plist (cddr plist)))
     p))
 
-
 (defun org-replace-match-keep-properties (newtext &optional fixedcase
                                                  literal string)
   "Like `replace-match', but add the text properties found original text."
@@ -277,7 +292,7 @@ This is in contrast to merely setting it to 0."
 (defvar org-inlinetask-min-level) ; defined in org-inlinetask.el
 (defun org-get-limited-outline-regexp ()
   "Return outline-regexp with limited number of levels.
-The number of levels is controlled by "
+The number of levels is controlled by `org-inlinetask-min-level'"
   (if (or (not (org-mode-p)) (not (featurep 'org-inlinetask)))
 
       outline-regexp
@@ -285,6 +300,66 @@ The number of levels is controlled by "
           (nstars (if org-odd-levels-only (1- (* limit-level 2)) limit-level)))
       (format "\\*\\{1,%d\\} " nstars))))
 
+
+;;; Saving and restoring visibility
+
+(defun org-outline-overlay-data (&optional use-markers)
+  "Return a list of the locations of all outline overlays.
+The are overlays with the `invisible' property value `outline'.
+The return values is a list of cons cells, with start and stop
+positions for each overlay.
+If USE-MARKERS is set, return the positions as markers."
+  (let (beg end)
+    (save-excursion
+      (save-restriction
+       (widen)
+       (delq nil
+             (mapcar (lambda (o)
+                       (when (eq (overlay-get o 'invisible) 'outline)
+                         (setq beg (overlay-start o)
+                               end (overlay-end o))
+                         (and beg end (> end beg)
+                              (if use-markers
+                                  (cons (move-marker (make-marker) beg)
+                                        (move-marker (make-marker) end))
+                                (cons beg end)))))
+                     (overlays-in (point-min) (point-max))))))))
+
+(autoload 'show-all "outline" nil t)
+
+(defun org-set-outline-overlay-data (data)
+  "Create visibility overlays for all positions in DATA.
+DATA should have been made by `org-outline-overlay-data'."
+  (let (o)
+    (save-excursion
+      (save-restriction
+       (widen)
+       (show-all)
+       (mapc (lambda (c)
+               (setq o (make-overlay (car c) (cdr c)))
+               (overlay-put o 'invisible 'outline))
+             data)))))
+
+(defmacro org-save-outline-visibility (use-markers &rest body)
+  "Save and restore outline visibility around BODY.
+If USE-MARKERS is non-nil, use markers for the positions.
+This means that the buffer may change while running BODY,
+but it also means that the buffer should stay alive
+during the operation, because otherwise all these markers will
+point nowhere."
+  (declare (indent 1))
+  `(let ((data (org-outline-overlay-data ,use-markers)))
+     (unwind-protect
+        (progn
+          ,@body
+          (org-set-outline-overlay-data data))
+       (when ,use-markers
+        (mapc (lambda (c)
+                (and (markerp (car c)) (move-marker (car c) nil))
+                (and (markerp (cdr c)) (move-marker (cdr c) nil)))
+              data)))))
+
+
 (provide 'org-macs)
 
 ;; arch-tag: 7e6a73ce-aac9-4fc0-9b30-ce6f89dc6668
index ba8de96f9c6a116b360f22c2b6f40cb9fc6ad45d..92ac2342dae63649c8b1ef735c503ce2f7bc62be 100644 (file)
@@ -5,7 +5,7 @@
 ;; Author: Tokuya Kameshima <kames at fa2 dot so-net dot ne dot jp>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33x
+;; Version: 7.01
 
 ;; This file is part of GNU Emacs.
 
index 0af426d39fdaed0fe5f533b24475e5636829b9b3..91551cd828f14185614c1f5142d495381063f099 100644 (file)
@@ -6,7 +6,7 @@
 ;; Author: Thomas Baumann <thomas dot baumann at ch dot tum dot de>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33x
+;; Version: 7.01
 ;;
 ;; This file is part of GNU Emacs.
 ;;
diff --git a/lisp/org/org-mks.el b/lisp/org/org-mks.el
new file mode 100644 (file)
index 0000000..4a56761
--- /dev/null
@@ -0,0 +1,137 @@
+;;; org-mks.el --- Multi-key-selection for Org-mode
+
+;; Copyright (C) 2010  Free Software Foundation, Inc.
+
+;; Author: Carsten Dominik <carsten at orgmode dot org>
+;; Keywords: outlines, hypermedia, calendar, wp
+;; Homepage: http://orgmode.org
+;; Version: 7.01
+;;
+;; 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 'org)
+(eval-when-compile
+  (require 'cl))
+
+(defun org-mks (table title &optional prompt specials)
+  "Select a member of an alist with multiple keys.
+TABLE is the alist which should contain entries where the car is a string.
+There should be two types of entries.
+
+1. prefix descriptions like (\"a\" \"Description\")
+   This indicates that `a' is a prefix key for multi-letter selection, and
+   that there are entries following with keys like \"ab\", \"ax\"...
+
+2. Selectable members must have more than two elements, with the first
+   being the string of keys that lead to selecting it, and the second a
+   short description string of the item.
+
+The command will then make a temporary buffer listing all entries
+that can be selected with a single key, and all the single key
+prefixes.  When you press the key for a single-letter entry, it is selected.
+When you press a prefix key, the commands (and maybe further prefixes)
+under this key will be shown and offered for selection.
+
+TITLE will be placed over the selection in the temporary buffer,
+PROMPT will be used when prompting for a key.  SPECIAL is an alist with
+also (\"key\" \"description\") entries.  When one of these is selection,
+only the bare key is returned."
+  (setq prompt (or prompt "Select: "))
+  (let (tbl orig-table dkey ddesc des-keys allowed-keys
+           current prefix rtn re pressed buffer (inhibit-quit t))
+    (save-window-excursion
+      (setq buffer (org-switch-to-buffer-other-window "*Org Select*"))
+      (setq orig-table table)
+      (catch 'exit
+       (while t
+         (erase-buffer)
+         (insert title "\n\n")
+         (setq tbl table
+               des-keys nil
+               allowed-keys nil)
+         (setq prefix (if current (concat current " ") ""))
+         (while tbl
+           (cond
+            ((and (= 2 (length (car tbl))) (= (length (caar tbl)) 1))
+             ;; This is a description on this level
+             (setq dkey (caar tbl) ddesc (cadar tbl))
+             (pop tbl)
+             (push dkey des-keys)
+             (push dkey allowed-keys)
+             (insert prefix "[" dkey "]" "..." "  " ddesc "..." "\n")
+             ;; Skip keys which are below this prefix
+             (setq re (concat "\\`" (regexp-quote dkey)))
+             (while (and tbl (string-match re (caar tbl))) (pop tbl)))
+            ((= 2 (length (car tbl)))
+             ;; Not yet a usable description, skip it
+             )
+            (t
+             ;; usable entry on this level
+             (insert prefix "[" (caar tbl) "]" "     " (nth 1 (car tbl)) "\n")
+             (push (caar tbl) allowed-keys)
+             (pop tbl))))
+         (when specials
+           (insert "-------------------------------------------------------------------------------\n")
+           (let ((sp specials))
+             (while sp
+               (insert (format "[%s]     %s\n"
+                               (caar sp) (nth 1 (car sp))))
+               (push (caar sp) allowed-keys)
+               (pop sp))))
+         (push "\C-g" allowed-keys)
+         (goto-char (point-min))
+         (if (not (pos-visible-in-window-p (point-max)))
+             (org-fit-window-to-buffer))
+         (message prompt)
+         (setq pressed (char-to-string (read-char-exclusive)))
+         (while (not (member pressed allowed-keys))
+           (message "Invalid key `%s'" pressed) (sit-for 1)
+           (message prompt)
+           (setq pressed (char-to-string (read-char-exclusive))))
+         (when (equal pressed "\C-g")
+           (kill-buffer buffer)
+           (error "Abort"))
+         (when (and (not (assoc pressed table))
+                    (not (member pressed des-keys))
+                    (assoc pressed specials))
+           (throw 'exit (setq rtn pressed)))
+         (unless (member pressed des-keys)
+           (throw 'exit (setq rtn (rassoc (cdr (assoc pressed table))
+                                          orig-table))))
+         (setq current (concat current pressed))
+         (setq table (mapcar
+                      (lambda (x)
+                        (if (and (> (length (car x)) 1)
+                                 (equal (substring (car x) 0 1) pressed))
+                            (cons (substring (car x) 1) (cdr x))
+                          nil))
+                      table))
+         (setq table (remove nil table)))))
+    (when buffer (kill-buffer buffer))
+    rtn))
+
+(provide 'org-mks)
+
+;; arch-tag: 4ea90d0e-c6e4-4684-bd61-baf878712f9f
+
+;;; org-mks.el ends here
index 121c2fd0308aec0b619f9493081c325ec30c48f7..e9c1ad2bf3f8d9f573cde067b22efa8a2cd46036 100644 (file)
@@ -4,7 +4,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33x
+;; Version: 7.01
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -33,6 +33,8 @@
 
 (require 'org)
 (require 'org-agenda)
+;;; Code:
+
 (eval-when-compile (require 'cl))
 
 (defgroup org-mobile nil
@@ -47,7 +49,7 @@ directly.  Directories will be search for files with the extension `.org'.
 In addition to this, the list may also contain the following symbols:
 
 org-agenda-files
-     This means, include the complete, unrestricted list of files given in
+     This means include the complete, unrestricted list of files given in
      the variable `org-agenda-files'.
 org-agenda-text-search-extra-files
      Include the files given in the variable
@@ -65,6 +67,35 @@ org-agenda-text-search-extra-files
   :group 'org-mobile
   :type 'directory)
 
+(defcustom org-mobile-use-encryption nil
+  "Non-nil means keep only encrypted files on the WebDAV server.
+Encryption uses AES-256, with a password given in
+`org-mobile-encryption-password'.
+When nil, plain files are kept on the server.
+Turning on encryption requires to set the same password in the MobileOrg
+application.  Before turning this on, check of MobileOrg does already
+support it - at the time of this writing it did not yet."
+  :group 'org-mobile
+  :type 'boolean)
+
+(defcustom org-mobile-encryption-tempfile "~/orgtmpcrypt"
+  "File that is being used as a temporary file for encryption.
+This must be local file on your local machine (not on the WebDAV server).
+You might want to put this file into a directory where only you have access."
+  :group 'org-mobile
+  :type 'directory)
+
+(defcustom org-mobile-encryption-password ""
+  "Password for encrypting files uploaded to the server.
+This is a single password which is used for AES-256 encryption.  The same
+password must also be set in the MobileOrg application.  All Org files,
+including mobileorg.org will be encrypted using this password.
+Note that, when Org runs the encryption commands, the password could
+be visible on your system with the `ps' command.  So this method is only
+intended to keep the files secure on the server, not on your own machine."
+  :group 'org-mobile
+  :type '(string :tag "Password"))
+
 (defcustom org-mobile-inbox-for-pull "~/org/from-mobile.org"
   "The file where captured notes and flags will be appended to.
 During the execution of `org-mobile-pull', the file
@@ -85,13 +116,29 @@ should point to this file."
   :group 'org-mobile
   :type 'file)
 
+(defcustom org-mobile-agendas 'all
+  "The agendas that should be pushed to MobileOrg.
+Allowed values:
+
+default  the weekly agenda and the global TODO list
+custom   all custom agendas defined by the user
+all      the custom agendas and the default ones
+list     a list of selection key(s) as string."
+  :group 'org-mobile
+  :type '(choice
+         (const :tag "Default Agendas" default)
+         (const :tag "Custom Agendas" custom)
+         (const :tag "Default and Custom Agendas" all)
+         (repeat :tag "Selected"
+                 (string :tag "Selection Keys"))))
+
 (defcustom org-mobile-force-id-on-agenda-items t
   "Non-nil means make all agenda items carry and ID."
   :group 'org-mobile
   :type 'boolean)
 
 (defcustom org-mobile-force-mobile-change nil
-  "Non-nil means, force the change made on the mobile device.
+  "Non-nil means force the change made on the mobile device.
 So even if there have been changes to the computer version of the entry,
 force the new value set on the mobile.
 When nil, mark the entry from the mobile with an error message.
@@ -247,15 +294,14 @@ create all custom agenda views, for upload to the mobile phone."
          (kill-buffer a-buffer)
        (let ((cw (selected-window)))
          (select-window (get-buffer-window a-buffer))
-         
          (org-agenda-redo)
          (select-window cw)))))
   (message "Files for mobile viewer staged"))
-  
+
 (defvar org-mobile-before-process-capture-hook nil
   "Hook that is run after content was moved to `org-mobile-inbox-for-pull'.
-The inbox file is in the current buffer, and the buffer is arrowed to the
-new captured data.")
+The inbox file is visited by the current buffer, and the buffer is
+narrowed to the newly captured data.")
 
 ;;;###autoload
 (defun org-mobile-pull ()
@@ -305,7 +351,19 @@ agenda view showing the flagged items."
               (file-exists-p
                (file-name-directory org-mobile-inbox-for-pull)))
     (error
-     "Variable `org-mobile-inbox-for-pull' must point to a file in an existing directory")))
+     "Variable `org-mobile-inbox-for-pull' must point to a file in an existing directory"))
+  (unless (and org-mobile-checksum-binary
+              (string-match "\\S-" org-mobile-checksum-binary))
+    (error "No executable found to compute checksums"))
+  (when org-mobile-use-encryption
+    (unless (string-match "\\S-" org-mobile-encryption-password)
+      (error
+       "To use encryption, you must set `org-mobile-encryption-password'"))
+    (unless (file-writable-p org-mobile-encryption-tempfile)
+      (error "Cannot write to encryption tempfile %s"
+            org-mobile-encryption-tempfile))
+    (unless (executable-find "openssl")
+      (error "openssl is needed to encrypt files"))))
 
 (defun org-mobile-create-index-file ()
   "Write the index file in the WebDAV directory."
@@ -314,7 +372,7 @@ agenda view showing the flagged items."
        (def-todo (default-value 'org-todo-keywords))
        (def-tags (default-value 'org-tag-alist))
        file link-name todo-kwds done-kwds tags drawers entry kwds dwds twds)
-    
+
     (org-prepare-agenda-buffers (mapcar 'car files-alist))
     (setq done-kwds (org-uniquify org-done-keywords-for-agenda))
     (setq todo-kwds (org-delete-all
@@ -385,7 +443,9 @@ agenda view showing the flagged items."
              target-dir (file-name-directory target-path))
        (unless (file-directory-p target-dir)
          (make-directory target-dir 'parents))
-       (copy-file file target-path 'ok-if-exists)
+       (if org-mobile-use-encryption
+           (org-mobile-encrypt-and-move file target-path)
+         (copy-file file target-path 'ok-if-exists))
        (setq check (shell-command-to-string
                     (concat org-mobile-checksum-binary " "
                             (shell-quote-argument (expand-file-name file)))))
@@ -426,8 +486,22 @@ The table of checksums is written to the file mobile-checksums."
                        ((not (nth 1 x)) (cons (car x) (cons "" (cddr x))))
                        (t (cons (car x) (cons "" (cdr x))))))
                org-agenda-custom-commands)))
-       new e key desc type match settings cmds gkey gdesc gsettings cnt)
-    (while (setq e (pop custom-list))
+       (default-list '(("a" "Agenda" agenda) ("t" "All TODO" alltodo)))
+       thelist new e key desc type match settings cmds gkey gdesc gsettings cnt)
+    (cond
+     ((eq org-mobile-agendas 'custom)
+      (setq thelist custom-list))
+     ((eq org-mobile-agendas 'default)
+      (setq thelist default-list))
+     ((eq org-mobile-agendas 'all)
+      (setq thelist custom-list)
+      (unless (assoc "t" thelist) (push '("t" "ALL TODO" alltodo) thelist))
+      (unless (assoc "a" thelist) (push '("a" "Agenda" agenda) thelist)))
+     ((listp org-mobile-agendas)
+      (setq thelist (append custom-list default-list))
+      (setq thelist (delq nil (mapcar (lambda (k) (assoc k thelist))
+                                     org-mobile-agendas)))))
+    (while (setq e (pop thelist))
       (cond
        ((stringp (cdr e))
        ;; this is a description entry - skip it
@@ -438,7 +512,12 @@ The table of checksums is written to the file mobile-checksums."
        ((memq (nth 2 e) '(todo-tree tags-tree occur-tree))
        ;; These are trees, not really agenda commands
        )
-       ((memq (nth 2 e) '(agenda todo tags))
+       ((and (memq (nth 2 e) '(todo tags tags-todo))
+            (or (null (nth 3 e))
+                (not (string-match "\\S-" (nth 3 e)))))
+       ;; These would be interactive because the match string is empty
+       )
+       ((memq (nth 2 e) '(agenda alltodo todo tags tags-todo))
        ;; a normal command
        (setq key (car e) desc (nth 1 e) type (nth 2 e) match (nth 3 e)
              settings (nth 4 e))
@@ -541,26 +620,66 @@ The table of checksums is written to the file mobile-checksums."
   (interactive)
   (let* ((file (expand-file-name "agendas.org"
                                 org-mobile-directory))
+        (file1 (if org-mobile-use-encryption
+                   org-mobile-encryption-tempfile
+                 file))
         (sumo (org-mobile-sumo-agenda-command))
         (org-agenda-custom-commands
-         (list (append sumo (list (list file)))))
+         (list (append sumo (list (list file1)))))
         (org-mobile-creating-agendas t))
-    (unless (file-writable-p file)
-      (error "Cannot write to file %s" file))
+    (unless (file-writable-p file1)
+      (error "Cannot write to file %s" file1))
     (when sumo
-      (org-store-agenda-views))))
+      (org-store-agenda-views))
+    (when org-mobile-use-encryption
+      (org-mobile-encrypt-file file1 file)
+      (delete-file file1))))
+
+(defun org-mobile-encrypt-and-move (infile outfile)
+  "Encrypt INFILE locally to INFILE_enc, then move it to OUTFILE.
+We do this in two steps so that remote paths will work, even if the
+encryption program does not understand them."
+  (let ((encfile (concat infile "_enc")))
+    (org-mobile-encrypt-file infile encfile)
+    (when outfile
+      (copy-file encfile outfile 'ok-if-exists)
+      (delete-file encfile))))
+
+(defun org-mobile-encrypt-file (infile outfile)
+  "Encrypt INFILE to OUTFILE, using `org-mobile-encryption-password'."
+  (shell-command
+   (format "openssl enc -aes-256-cbc -salt -pass %s -in %s -out %s"
+          (shell-quote-argument (concat "pass:" org-mobile-encryption-password))
+          (shell-quote-argument (expand-file-name infile))
+          (shell-quote-argument (expand-file-name outfile)))))
+
+(defun org-mobile-decrypt-file (infile outfile)
+  "Decrypt INFILE to OUTFILE, using `org-mobile-encryption-password'."
+  (shell-command
+   (format "openssl enc -d -aes-256-cbc -salt -pass %s -in %s -out %s"
+          (shell-quote-argument (concat "pass:" org-mobile-encryption-password))
+          (shell-quote-argument (expand-file-name infile))
+          (shell-quote-argument (expand-file-name outfile)))))
 
 (defun org-mobile-move-capture ()
   "Move the contents of the capture file to the inbox file.
 Return a marker to the location where the new content has been added.
 If nothing new has been added, return nil."
   (interactive)
-  (let ((inbox-buffer (find-file-noselect org-mobile-inbox-for-pull))
-       (capture-buffer (find-file-noselect
-                        (expand-file-name org-mobile-capture-file
-                                          org-mobile-directory)))
-       (insertion-point (make-marker))
-       not-empty content)
+  (let* ((encfile nil)
+        (capture-file (expand-file-name org-mobile-capture-file
+                                        org-mobile-directory))
+        (inbox-buffer (find-file-noselect org-mobile-inbox-for-pull))
+        (capture-buffer
+         (if (not org-mobile-use-encryption)
+             (find-file-noselect capture-file)
+           (delete-file org-mobile-encryption-tempfile)
+           (setq encfile (concat org-mobile-encryption-tempfile "_enc"))
+           (copy-file capture-file encfile)
+           (org-mobile-decrypt-file encfile org-mobile-encryption-tempfile)
+           (find-file-noselect org-mobile-encryption-tempfile)))
+        (insertion-point (make-marker))
+        not-empty content)
     (with-current-buffer capture-buffer
       (setq content (buffer-string))
       (setq not-empty (string-match "\\S-" content))
@@ -577,9 +696,13 @@ If nothing new has been added, return nil."
        (save-buffer)
        (org-mobile-update-checksum-for-capture-file (buffer-string))))
     (kill-buffer capture-buffer)
+    (when org-mobile-use-encryption
+      (org-mobile-encrypt-and-move org-mobile-encryption-tempfile
+                                  capture-file))
     (if not-empty insertion-point)))
 
 (defun org-mobile-update-checksum-for-capture-file (buffer-string)
+  "Find the checksum line and modify it to match BUFFER-STRING."
   (let* ((file (expand-file-name "checksums.dat" org-mobile-directory))
         (buffer (find-file-noselect file)))
     (when buffer
@@ -781,42 +904,6 @@ FIXME: Hmmm, not sure if we can make his work against the
 auto-correction feature.  Needs a bit more thinking.  So this function
 is currently a noop.")
 
-
-(defun org-find-olp (path)
-  "Return  a marker pointing to the entry at outline path OLP.
-If anything goes wrong, the return value will instead an error message,
-as a string."
-  (let* ((file (pop path))
-        (buffer (find-file-noselect file))
-        (level 1)
-        (lmin 1)
-        (lmax 1)
-        limit re end found pos heading cnt)
-    (unless buffer (error "File not found :%s" file))
-    (with-current-buffer buffer
-      (save-excursion
-       (save-restriction
-         (widen)
-         (setq limit (point-max))
-         (goto-char (point-min))
-         (while (setq heading (pop path))
-           (setq re (format org-complex-heading-regexp-format
-                            (regexp-quote heading)))
-           (setq cnt 0 pos (point))
-           (while (re-search-forward re end t)
-             (setq level (- (match-end 1) (match-beginning 1)))
-             (if (and (>= level lmin) (<= level lmax))
-                 (setq found (match-beginning 0) cnt (1+ cnt))))
-           (when (= cnt 0) (error "Heading not found on level %d: %s"
-                                  lmax heading))
-           (when (> cnt 1) (error "Heading not unique on level %d: %s"
-                                  lmax heading))
-           (goto-char found)
-           (setq lmin (1+ level) lmax (+ lmin (if org-odd-levels-only 1 0)))
-           (setq end (save-excursion (org-end-of-subtree t t))))
-         (when (org-on-heading-p)
-           (move-marker (make-marker) (point))))))))
-
 (defun org-mobile-locate-entry (link)
   (if (string-match "\\`id:\\(.*\\)$" link)
       (org-id-find (match-string 1 link) 'marker)
@@ -856,7 +943,7 @@ be returned that indicates what went wrong."
        (org-todo (or new 'none)) t)
        (t (error "State before change was expected as \"%s\", but is \"%s\""
                 old current))))
-      
+
      ((eq what 'tags)
       (setq current (org-get-tags)
            new1 (and new (org-split-string new ":+"))
@@ -869,7 +956,7 @@ be returned that indicates what went wrong."
        (org-set-tags-to new1) t)
        (t (error "Tags before change were expected as \"%s\", but are \"%s\""
                 (or old "") (or current "")))))
-     
+
      ((eq what 'priority)
       (when (looking-at org-complex-heading-regexp)
        (setq current (and (match-end 3) (substring (match-string 3) 2 3)))
@@ -895,7 +982,7 @@ be returned that indicates what went wrong."
          (delete-region (point) (+ (point) (length current)))
          (org-set-tags nil 'align))
         (t (error "Heading changed in MobileOrg and on the computer")))))
-     
+
      ((eq what 'body)
       (setq current (buffer-substring (min (1+ (point-at-eol)) (point-max))
                                      (save-excursion (outline-next-heading)
@@ -915,7 +1002,6 @@ be returned that indicates what went wrong."
                                        (point))))
        t)
        (t (error "Body was changed in MobileOrg and on the computer")))))))
-       
 
 (defun org-mobile-tags-same-p (list1 list2)
   "Are the two tag lists the same?"
index c7457a64fda198672a4555ceb12fb39934ec9dae..12a7dcb85afdec5200df0d63a11bc7474d2517f6 100644 (file)
@@ -4,7 +4,7 @@
 ;;
 ;; Author: Piotr Zielinski <piotr dot zielinski at gmail dot com>
 ;; Maintainer: Carsten Dominik <carsten at orgmode dot org>
-;; Version: 6.33x
+;; Version: 7.01
 ;;
 ;; This file is part of GNU Emacs.
 ;;
 ;;
 ;; Versions 0.01 -- 0.07: (I don't remember)
 
+;;; Code:
+
 (eval-when-compile (require 'cl))
 (require 'org)
 
@@ -189,7 +191,7 @@ Changing this variable requires a restart of Emacs to get activated."
   (interactive)
   (end-of-line)
   (skip-chars-backward "\t ")
-  (when (looking-back ":[A-Za-z]+:")
+  (when (org-looking-back ":[A-Za-z]+:")
     (skip-chars-backward ":A-Za-z")
     (skip-chars-backward "\t ")))
 
@@ -225,7 +227,7 @@ this function is called.  Otherwise, the current major mode menu is used."
     (mouse-save-then-kill event)))
 
 (defun org-mouse-line-position ()
-  "Returns `:beginning' or `:middle' or `:end', depending on the point position.
+  "Return `:beginning' or `:middle' or `:end', depending on the point position.
 
 If the point is at the end of the line, return `:end'.
 If the point is separated from the beginning of the line only by white
@@ -290,7 +292,7 @@ ITEMFORMAT governs formatting of the elements of KEYWORDS.  If it
 is a function, it is invoked with the keyword as the only
 argument.  If it is a string, it is interpreted as the format
 string to (format ITEMFORMAT keyword).  If it is neither a string
-nor a function, elements of KEYWORDS are used directly. "
+nor a function, elements of KEYWORDS are used directly."
   (mapcar
    `(lambda (keyword)
      (vector (cond
@@ -342,8 +344,7 @@ ITEMFORMAT governs formatting of the elements of KEYWORDS.  If it
 is a function, it is invoked with the keyword as the only
 argument.  If it is a string, it is interpreted as the format
 string to (format ITEMFORMAT keyword).  If it is neither a string
-nor a function, elements of KEYWORDS are used directly.
-"
+nor a function, elements of KEYWORDS are used directly."
   (setq group (or group 0))
   (let ((replace (org-mouse-match-closure
                  (if nosurround 'replace-match
@@ -432,7 +433,7 @@ SCHEDULED: or DEADLINE: or ANYTHINGLIKETHIS:"
       (lambda (kwd) (equal state kwd))))))
 
 (defun org-mouse-tag-menu ()           ;todo
-  "Create the tags menu"
+  "Create the tags menu."
   (append
    (let ((tags (org-get-tags)))
      (org-mouse-keyword-menu
@@ -585,7 +586,8 @@ SCHEDULED: or DEADLINE: or ANYTHINGLIKETHIS:"
        (org-next-item)))))
 
 (defun org-mouse-bolp ()
-  "Returns true if there only spaces, tabs, and '*',  between the beginning of line and the point"
+  "Return true if there only spaces, tabs, and '*' before point.
+This means, between the beginning of line and the point."
   (save-excursion
     (skip-chars-backward " \t*") (bolp)))
 
@@ -607,7 +609,7 @@ SCHEDULED: or DEADLINE: or ANYTHINGLIKETHIS:"
     (:end                              ; insert text here
      (skip-chars-backward " \t")
      (kill-region (point) (point-at-eol))
-     (unless (looking-back org-mouse-punctuation)
+     (unless (org-looking-back org-mouse-punctuation)
        (insert (concat org-mouse-punctuation " ")))))
 
   (insert text)
@@ -674,7 +676,7 @@ SCHEDULED: or DEADLINE: or ANYTHINGLIKETHIS:"
                                      'org-mode-restart))))
    ((or (eolp)
        (and (looking-at "\\(  \\|\t\\)\\(+:[0-9a-zA-Z_:]+\\)?\\(  \\|\t\\)+$")
-            (looking-back "  \\|\t")))
+            (org-looking-back "  \\|\t")))
     (org-mouse-popup-global-menu))
    ((get-context :checkbox)
     (popup-menu
@@ -909,18 +911,18 @@ SCHEDULED: or DEADLINE: or ANYTHINGLIKETHIS:"
      (setq org-mouse-context-menu-function 'org-mouse-context-menu)
 
      (when (memq 'context-menu org-mouse-features)
-       (define-key org-mouse-map (if (featurep 'xemacs) [button3] [mouse-3]) nil)
-       (define-key org-mode-map [mouse-3] 'org-mouse-show-context-menu))
-     (define-key org-mode-map [down-mouse-1] 'org-mouse-down-mouse)
+       (org-defkey org-mouse-map [mouse-3] nil)
+       (org-defkey org-mode-map [mouse-3] 'org-mouse-show-context-menu))
+     (org-defkey org-mode-map [down-mouse-1] 'org-mouse-down-mouse)
      (when (memq 'context-menu org-mouse-features)
-       (define-key org-mouse-map [C-drag-mouse-1] 'org-mouse-move-tree)
-       (define-key org-mouse-map [C-down-mouse-1] 'org-mouse-move-tree-start))
+       (org-defkey org-mouse-map [C-drag-mouse-1] 'org-mouse-move-tree)
+       (org-defkey org-mouse-map [C-down-mouse-1] 'org-mouse-move-tree-start))
      (when (memq 'yank-link org-mouse-features)
-       (define-key org-mode-map [S-mouse-2] 'org-mouse-yank-link)
-       (define-key org-mode-map [drag-mouse-3] 'org-mouse-yank-link))
+       (org-defkey org-mode-map [S-mouse-2] 'org-mouse-yank-link)
+       (org-defkey org-mode-map [drag-mouse-3] 'org-mouse-yank-link))
      (when (memq 'move-tree org-mouse-features)
-       (define-key org-mouse-map [drag-mouse-3] 'org-mouse-move-tree)
-       (define-key org-mouse-map [down-mouse-3] 'org-mouse-move-tree-start))
+       (org-defkey org-mouse-map [drag-mouse-3] 'org-mouse-move-tree)
+       (org-defkey org-mouse-map [down-mouse-3] 'org-mouse-move-tree-start))
 
      (when (memq 'activate-stars org-mouse-features)
        (font-lock-add-keywords
@@ -1131,13 +1133,11 @@ SCHEDULED: or DEADLINE: or ANYTHINGLIKETHIS:"
 (add-hook 'org-agenda-mode-hook
    '(lambda ()
      (setq org-mouse-context-menu-function 'org-mouse-agenda-context-menu)
-     (define-key org-agenda-mode-map
-       (if (featurep 'xemacs) [button3] [mouse-3])
-       'org-mouse-show-context-menu)
-     (define-key org-agenda-mode-map [down-mouse-3] 'org-mouse-move-tree-start)
-     (define-key org-agenda-mode-map (if (featurep 'xemacs) [(control mouse-4)] [C-mouse-4]) 'org-agenda-earlier)
-     (define-key org-agenda-mode-map (if (featurep 'xemacs) [(control mouse-5)] [C-mouse-5]) 'org-agenda-later)
-     (define-key org-agenda-mode-map [drag-mouse-3]
+     (org-defkey org-agenda-mode-map [mouse-3] 'org-mouse-show-context-menu)
+     (org-defkey org-agenda-mode-map [down-mouse-3] 'org-mouse-move-tree-start)
+     (org-defkey org-agenda-mode-map [C-mouse-4] 'org-agenda-earlier)
+     (org-defkey org-agenda-mode-map [C-mouse-5] 'org-agenda-later)
+     (org-defkey org-agenda-mode-map [drag-mouse-3]
        '(lambda (event) (interactive "e")
          (case (org-mouse-get-gesture event)
            (:left (org-agenda-earlier 1))
@@ -1147,4 +1147,4 @@ SCHEDULED: or DEADLINE: or ANYTHINGLIKETHIS:"
 
 ;; arch-tag: ff1ae557-3529-41a3-95c6-baaebdcc280f
 
-;;; org-mouse.el ends-here
+;;; org-mouse.el ends here
index 2e1f6c8f6ccedce7edc3bee3df62aba32367f60a..c6953f11d37ea13bbafe6c48b2c61f6716f4fb9c 100644 (file)
@@ -5,7 +5,7 @@
 ;; Author: Eric Schulte <schulte dot eric at gmail dot com>
 ;; Keywords: tables, plotting
 ;; Homepage: http://orgmode.org
-;; Version: 6.33x
+;; Version: 7.01
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -44,7 +44,7 @@
   '((:plot-type . 2d)
     (:with . lines)
     (:ind . 0))
-  "Default options to gnuplot used by `org-plot/gnuplot'")
+  "Default options to gnuplot used by `org-plot/gnuplot'.")
 
 (defvar org-plot-timestamp-fmt nil)
 
@@ -134,7 +134,7 @@ Pass PARAMS through to `orgtbl-to-generic' when exporting TABLE."
 
 (defun org-plot/gnuplot-to-grid-data (table data-file params)
   "Export the data in TABLE to DATA-FILE for gnuplot.
-This means, in a format appropriate for grid plotting by gnuplot.
+This means in a format appropriate for grid plotting by gnuplot.
 PARAMS specifies which columns of TABLE should be plotted as independent
 and dependant variables."
   (interactive)
@@ -250,8 +250,9 @@ manner suitable for prepending to a user-specified script."
                 (setf plot-lines
                       (cons
                        (format plot-str data-file
-                               (or (and (not text-ind) ind
-                                        (> ind 0) (format "%d:" ind)) "")
+                               (or (and ind (> ind 0)
+                                         (not text-ind)
+                                         (format "%d:" ind)) "")
                                (+ 1 col)
                                (if text-ind (format ":xticlabel(%d)" ind) "")
                                with
@@ -271,7 +272,7 @@ manner suitable for prepending to a user-specified script."
 ;; facade functions
 ;;;###autoload
 (defun org-plot/gnuplot (&optional params)
-  "Plot table using gnuplot. Gnuplot options can be specified with PARAMS.
+  "Plot table using gnuplot.  Gnuplot options can be specified with PARAMS.
 If not given options will be taken from the +PLOT
 line directly before or after the table."
   (interactive)
@@ -300,7 +301,7 @@ line directly before or after the table."
        (setf table (delq 'hline (cdr table)))) ;; clean non-data from table
       ;; collect options
       (save-excursion (while (and (equal 0 (forward-line -1))
-                                 (looking-at "#\\+"))
+                                 (looking-at "[[:space:]]*#\\+"))
                        (setf params (org-plot/collect-options params))))
       ;; dump table to datafile (very different for grid)
       (case (plist-get params :plot-type)
@@ -320,7 +321,6 @@ line directly before or after the table."
                           (mapcar (lambda (row) (nth ind row)) table)))) 0)
              (plist-put params :timeind t)
            ;; check for text ind column
-
            (if (or (string= (plist-get params :with) "hist")
                    (> (length
                        (delq 0 (mapcar
index 59f08f1dfa2dac44aea2f84224965fa9ef3904f5..2c6345ab817215e7072ef81a9bc24659afab9d0e 100644 (file)
@@ -9,7 +9,7 @@
 ;; Author: Ross Patterson <me AT rpatterson DOT net>
 ;; Maintainer: Sebastian Rose <sebastian_rose AT gmx DOT de>
 ;; Keywords: org, emacsclient, wp
-;; Version: 6.33x
+;; Version: 7.01
 
 ;; This file is part of GNU Emacs.
 ;;
@@ -31,8 +31,8 @@
 ;;
 ;; Intercept calls from emacsclient to trigger custom actions.
 ;;
-;; This is done by advising `server-visit-files' to scann the list of filenames
-;; for `org-protocol-the-protocol' and sub-procols defined in
+;; This is done by advising `server-visit-files' to scan the list of filenames
+;; for `org-protocol-the-protocol' and sub-protocols defined in
 ;; `org-protocol-protocol-alist' and `org-protocol-protocol-alist-default'.
 ;;
 ;; Any application that supports calling external programs with an URL
@@ -58,7 +58,7 @@
 ;;       (setq org-protocol-protocol-alist
 ;;             '(("my-protocol"
 ;;                :protocol "my-protocol"
-;;                :function my-protocol-handler-fuction)))
+;;                :function my-protocol-handler-function)))
 ;;
 ;;       A "sub-protocol" will be found in URLs like this:
 ;;
 ;;     URLs to local filenames defined in `org-protocol-project-alist'.
 ;;
 ;;   * `org-protocol-store-link' stores an Org-link (if Org-mode is present) and
-;;     pushes the browsers URL to the `kill-ring' for yanking. This handler is
+;;     pushes the browsers URL to the `kill-ring' for yanking.  This handler is
 ;;     triggered through the sub-protocol \"store-link\".
 ;;
-;;   * Call `org-protocol-remember' by using the sub-protocol \"remember\".  If
-;;     Org-mode is loaded, emacs will pop-up a remember buffer and fill the
-;;     template with the data provided. I.e. the browser's URL is inserted as an
-;;     Org-link of which the page title will be the description part. If text
+;;   * Call `org-protocol-capture' by using the sub-protocol \"capture\".  If
+;;     Org-mode is loaded, Emacs will pop-up a capture buffer and fill the
+;;     template with the data provided.  I.e. the browser's URL is inserted as an
+;;     Org-link of which the page title will be the description part.  If text
 ;;     was select in the browser, that text will be the body of the entry.
 ;;
+;;   * Call `org-protocol-remember' by using the sub-protocol \"remember\".
+;;     This is provided for backward compatibility.
+;;     You may read `org-capture' as `org-remember' throughout this file if
+;;     you still use `org-remember'.
+;;
 ;; You may use the same bookmark URL for all those standard handlers and just
 ;; adjust the sub-protocol used:
 ;;
 ;;           encodeURIComponent(document.title)+'/'+
 ;;           encodeURIComponent(window.getSelection())
 ;;
-;; The handler for the sub-protocol \"remember\" detects an optional template
+;; The handler for the sub-protocol \"capture\" detects an optional template
 ;; char that, if present, triggers the use of a special template.
 ;; Example:
 ;;
 (eval-when-compile
   (require 'cl))
 
-(declare-function org-publish-initialize-files-alist "org-publish"
-                 (&optional refresh))
 (declare-function org-publish-get-project-from-filename "org-publish"
                  (filename &optional up))
 (declare-function server-edit "server" (&optional arg))
@@ -143,6 +146,7 @@ for `org-protocol-the-protocol' and sub-procols defined in
 
 (defconst org-protocol-protocol-alist-default
   '(("org-remember"    :protocol "remember"    :function org-protocol-remember :kill-client t)
+    ("org-capture"     :protocol "capture"     :function org-protocol-capture  :kill-client t)
     ("org-store-link"  :protocol "store-link"  :function org-protocol-store-link)
     ("org-open-source" :protocol "open-source" :function org-protocol-open-source))
   "Default protocols to use.
@@ -151,18 +155,19 @@ See `org-protocol-protocol-alist' for a description of this variable.")
 
 (defconst org-protocol-the-protocol "org-protocol"
   "This is the protocol to detect if org-protocol.el is loaded.
-`org-protocol-protocol-alist-default' and `org-protocol-protocol-alist' hold the
-sub-protocols that trigger the required action. You will have to define just one
-protocol handler OS-wide (MS-Windows) or per application (Linux). That protocol
-handler should call emacsclient.")
+`org-protocol-protocol-alist-default' and `org-protocol-protocol-alist' hold
+the sub-protocols that trigger the required action.  You will have to define
+just one protocol handler OS-wide (MS-Windows) or per application (Linux).
+That protocol handler should call emacsclient.")
 
 
 ;;; User variables:
 
 (defcustom org-protocol-reverse-list-of-files t
-  "* The filenames passed on the commandline are passed to the emacs-server in
-reversed order. Set to `t' (default) to re-reverse the list, i.e. use the
-sequence on the command line. If nil, the sequence of the filenames is
+  "* Non-nil means re-reverse the list of filenames passed on the command line.
+The filenames passed on the command line are passed to the emacs-server in
+reverse order.  Set to t (default) to re-reverse the list, i.e. use the
+sequence on the command line.  If nil, the sequence of the filenames is
 unchanged."
   :group 'org-protocol
   :type 'boolean)
@@ -225,7 +230,7 @@ protocol - protocol to detect in a filename without trailing colon and slashes.
            If you define a protocol \"my-protocol\", `org-protocol-check-filename-for-protocol'
            will search filenames for \"org-protocol:/my-protocol:/\"
            and trigger your action for every match. `org-protocol' is defined in
-           `org-protocol-the-protocol'. Double and tripple slashes are compressed
+           `org-protocol-the-protocol'. Double and triple slashes are compressed
            to one by emacsclient.
 
 function - function that handles requests with protocol and takes exactly one
@@ -239,7 +244,7 @@ function - function that handles requests with protocol and takes exactly one
 
 kill-client - If t, kill the client immediately, once the sub-protocol is
            detected. This is necessary for actions that can be interrupted by
-           `C-g' to avoid dangeling emacsclients. Note, that all other command
+           `C-g' to avoid dangling emacsclients. Note, that all other command
            line arguments but the this one will be discarded, greedy handlers
            still receive the whole list of arguments though.
 
@@ -248,10 +253,10 @@ Here is an example:
   (setq org-protocol-protocol-alist
       '((\"my-protocol\"
          :protocol \"my-protocol\"
-         :function my-protocol-handler-fuction)
+         :function my-protocol-handler-function)
         (\"your-protocol\"
          :protocol \"your-protocol\"
-         :function your-protocol-handler-fuction)))"
+         :function your-protocol-handler-function)))"
   :group 'org-protocol
   :type '(alist))
 
@@ -260,11 +265,10 @@ Here is an example:
   :group 'org-protocol
   :type 'string)
 
-
 ;;; Helper functions:
 
 (defun org-protocol-sanitize-uri (uri)
-  "emacsclient compresses double and tripple slashes.
+  "emacsclient compresses double and triple slashes.
 Slashes are sanitized to double slashes here."
   (when (string-match "^\\([a-z]+\\):/" uri)
     (let* ((splitparts (split-string uri "/+")))
@@ -273,12 +277,13 @@ Slashes are sanitized to double slashes here."
 
 
 (defun org-protocol-split-data(data &optional unhexify separator)
-  "Split, what a org-protocol handler function gets as only argument.
-data is that one argument. Data is splitted at each occurrence of separator
- (regexp). If no separator is specified or separator is nil, assume \"/+\".
-The results of that splitting are return as a list. If unhexify is non-nil,
-hex-decode each split part. If unhexify is a function, use that function to
-decode each split part."
+  "Split, what an org-protocol handler function gets as only argument.
+DATA is that one argument. DATA is split at each occurrence of
+SEPARATOR (regexp). If no SEPARATOR is specified or SEPARATOR is
+nil, assume \"/+\".  The results of that splitting are returned
+as a list. If UNHEXIFY is non-nil, hex-decode each split part. If
+UNHEXIFY is a function, use that function to decode each split
+part."
   (let* ((sep (or separator "/+"))
          (split-parts (split-string data sep)))
     (if unhexify
@@ -316,7 +321,7 @@ encodeURIComponent. E.g. `%C3%B6' is the german Umlaut `ü'."
 
 
 (defun org-protocol-unhex-compound (hex)
-  "Unhexify unicode hex-chars. E.g. `%C3%B6' is the german Umlaut `ü'."
+  "Unhexify unicode hex-chars. E.g. `%C3%B6' is the German Umlaut `ü'."
   (let* ((bytes (remove "" (split-string hex "%")))
         (ret "")
         (eat 0)
@@ -412,9 +417,9 @@ This function transforms it into a flat list."
 ;;; Standard protocol handlers:
 
 (defun org-protocol-store-link (fname)
-  "Process an org-protocol://store-link:// style url
-and store a browser URL as an org link. Also pushes the links URL to the
-`kill-ring'.
+  "Process an org-protocol://store-link:// style url.
+Additionally store a browser URL as an org link. Also pushes the
+link's URL to the `kill-ring'.
 
 The location for a browser's bookmark has to look like this:
 
@@ -443,50 +448,75 @@ The sub-protocol used to reach this function is set in
 (defun org-protocol-remember  (info)
   "Process an org-protocol://remember:// style url.
 
+The location for a browser's bookmark has to look like this:
+
+  javascript:location.href='org-protocol://remember://'+ \\
+        encodeURIComponent(location.href)+'/' \\
+        encodeURIComponent(document.title)+'/'+ \\
+        encodeURIComponent(window.getSelection())
+
+See the docs for `org-protocol-capture' for more information."
+
+  (if (and (boundp 'org-stored-links)
+           (or (fboundp 'org-capture))
+          (org-protocol-do-capture info 'org-remember))
+      (message "Org-mode not loaded."))
+  nil)
+
+(defun org-protocol-capture  (info)
+  "Process an org-protocol://capture:// style url.
+
 The sub-protocol used to reach this function is set in
 `org-protocol-protocol-alist'.
 
 This function detects an URL, title and optional text, separated by '/'
 The location for a browser's bookmark has to look like this:
 
-  javascript:location.href='org-protocol://remember://'+ \\
+  javascript:location.href='org-protocol://capture://'+ \\
         encodeURIComponent(location.href)+'/' \\
         encodeURIComponent(document.title)+'/'+ \\
         encodeURIComponent(window.getSelection())
 
 By default, it uses the character `org-protocol-default-template-key',
-which should be associated with a template in `org-remember-templates'.
+which should be associated with a template in `org-capture-templates'.
 But you may prepend the encoded URL with a character and a slash like so:
 
-  javascript:location.href='org-protocol://org-store-link://b/'+ ...
+  javascript:location.href='org-protocol://capture://b/'+ ...
 
 Now template ?b will be used."
-
   (if (and (boundp 'org-stored-links)
-           (fboundp 'org-remember))
-      (let* ((parts (org-protocol-split-data info t))
-             (template (or (and (= 1 (length (car parts))) (pop parts))
-                          org-protocol-default-template-key))
-             (url (org-protocol-sanitize-uri (car parts)))
-             (type (if (string-match "^\\([a-z]+\\):" url)
-                       (match-string 1 url)))
-             (title (cadr parts))
-             (region (caddr parts))
-             (orglink (org-make-link-string url title))
-             remember-annotation-functions)
-        (setq org-stored-links
-              (cons (list url title) org-stored-links))
-        (kill-new orglink)
-        (org-store-link-props :type type
-                              :link url
-                              :description title
-                              :initial region)
-        (raise-frame)
-        (org-remember nil (string-to-char template)))
-
-    (message "Org-mode not loaded."))
+           (or (fboundp 'org-capture))
+          (org-protocol-do-capture info 'org-capture))
+      (message "Org-mode not loaded."))
   nil)
 
+(defun org-protocol-do-capture (info capture-func)
+  "Support `org-capture' and `org-remember' alike.
+CAPTURE-FUNC is either the symbol `org-remember' or `org-capture'."
+  (let* ((parts (org-protocol-split-data info t))
+        (template (or (and (= 1 (length (car parts))) (pop parts))
+                      org-protocol-default-template-key))
+        (url (org-protocol-sanitize-uri (car parts)))
+        (type (if (string-match "^\\([a-z]+\\):" url)
+                  (match-string 1 url)))
+        (title(or (cadr parts) ""))
+        (region (or (caddr parts) ""))
+        (orglink (org-make-link-string
+                  url (if (string-match "[^[:space:]]" title) title url)))
+        (org-capture-link-is-already-stored t) ;; avoid call to org-store-link
+        remember-annotation-functions)
+    (setq org-stored-links
+         (cons (list url title) org-stored-links))
+    (kill-new orglink)
+    (org-store-link-props :type type
+                         :link url
+                         :description title
+                         :annotation orglink
+                         :initial region)
+    (raise-frame)
+    (funcall capture-func nil template)))
+
+
 (defun org-protocol-open-source (fname)
   "Process an org-protocol://open-source:// style url.
 
@@ -560,7 +590,7 @@ This is, how the matching is done:
 
 protocol and sub-protocol are regexp-quoted.
 
-If a matching protcol is found, the protcol is stripped from fname and the
+If a matching protocol is found, the protocol is stripped from fname and the
 result is passed to the protocols function as the only parameter. If the
 function returns nil, the filename is removed from the list of filenames
 passed from emacsclient to the server.
@@ -613,11 +643,10 @@ as filename."
 (defun org-protocol-create-for-org ()
   "Create a org-protocol project for the current file's Org-mode project.
 This works, if the file visited is part of a publishing project in
-`org-publish-project-alist'. This functions calls `org-protocol-create' to do
+`org-publish-project-alist'.  This function calls `org-protocol-create' to do
 most of the work."
   (interactive)
   (require 'org-publish)
-  (org-publish-initialize-files-alist)
   (let ((all (or (org-publish-get-project-from-filename buffer-file-name))))
     (if all (org-protocol-create (cdr all))
       (message "Not in an org-project. Did mean %s?"
index b13fda9d27b803cdb57b1d50e28968fdd2be1152..943bbca6b7ba48aedfbc3ed9d9c661f597bb0784 100644 (file)
@@ -1,10 +1,11 @@
 ;;; org-publish.el --- publish related org-mode files as a website
-;; Copyright (C) 2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
+;; Copyright (C) 2006, 2007, 2008, 2009, 2010
+;;          Free Software Foundation, Inc.
 
 ;; Author: David O'Toole <dto@gnu.org>
 ;; Maintainer: Carsten Dominik <carsten DOT dominik AT gmail DOT com>
 ;; Keywords: hypermedia, outlines, wp
-;; Version: 6.33x
+;; Version: 7.01
 
 ;; This file is part of GNU Emacs.
 ;;
@@ -31,7 +32,7 @@
 ;; + Publish all one's org-files to HTML or PDF
 ;; + Upload HTML, images, attachments and other files to a web server
 ;; + Exclude selected private pages from publishing
-;; + Publish a clickable index of pages
+;; + Publish a clickable sitemap of pages
 ;; + Manage local timestamps for publishing only changed files
 ;; + Accept plugin functions to extend range of publishable content
 ;;
 
 ;;; Code:
 
+
+(defun org-publish-sanitize-plist (plist)
+  (mapcar (lambda (x)
+           (or (cdr (assq x '((:index-filename . :sitemap-filename)
+                              (:index-title . :sitemap-title)
+                              (:index-function . :sitemap-function)
+                              (:index-style . :sitemap-style)
+                              (:auto-index . :auto-sitemap))))
+               x))
+         plist))
+
 (eval-when-compile
   (require 'cl))
 (require 'org)
@@ -112,9 +124,11 @@ project for publishing.  For example, you could call GNU Make on a
 certain makefile, to ensure published files are built up to date.
 
   :preparation-function   Function to be called before publishing
-                          this project.
+                          this project.  This may also be a list
+                          of functions.
   :completion-function    Function to be called after publishing
-                          this project.
+                          this project.  This may also be a list
+                          of functions.
 
 Some properties control details of the Org publishing process,
 and are equivalent to the corresponding user variables listed in
@@ -144,28 +158,42 @@ learn more about their use and default values.
   :author                `user-full-name'
   :email                 `user-mail-address'
 
-The following properties may be used to control publishing of an
-index of files or summary page for a given project.
+The following properties may be used to control publishing of a
+sitemap of files or summary page for a given project.
 
-  :auto-index            Whether to publish an index during
+  :auto-sitemap           Whether to publish a sitemap during
                          `org-publish-current-project' or `org-publish-all'.
-  :index-filename        Filename for output of index.  Defaults
+  :sitemap-filename      Filename for output of sitemap.  Defaults
                          to 'sitemap.org' (which becomes 'sitemap.html').
-  :index-title           Title of index page.  Defaults to name of file.
-  :index-function        Plugin function to use for generation of index.
-                         Defaults to `org-publish-org-index', which
+  :sitemap-title         Title of sitemap page.  Defaults to name of file.
+  :sitemap-function      Plugin function to use for generation of sitemap.
+                         Defaults to `org-publish-org-sitemap', which
                          generates a plain list of links to all files
                          in the project.
-  :index-style           Can be `list' (index is just an itemized list
+  :sitemap-style         Can be `list' (sitemap is just an itemized list
                          of the titles of the files involved) or
                          `tree' (the directory structure of the source
-                         files is reflected in the index).  Defaults to
-                         `tree'."
+                         files is reflected in the sitemap).  Defaults to
+                         `tree'.
+
+  If you create a sitemap file, adjust the sorting like this:
+
+  :sitemap-sort-folders    Where folders should appear in the sitemap.
+                           Set this to `first' (default) or `last' to
+                           display folders first or last, respectively.
+                           Any other value will mix files and folders.
+  :sitemap-alphabetically  The site map is normally sorted alphabetically.
+                           Set this explicitly to nil to turn off sorting.
+  :sitemap-ignore-case     Should sorting be case-sensitive?  Default nil.
+
+The following properties control the creation of a concept index.
+
+  :makeindex             Create a concept index."
   :group 'org-publish
   :type 'alist)
 
 (defcustom org-publish-use-timestamps-flag t
-  "When non-nil, use timestamp checking to publish only changed files.
+  "Non-nil means use timestamp checking to publish only changed files.
 When nil, do no timestamp checking and always publish all files."
   :group 'org-publish
   :type 'boolean)
@@ -177,7 +205,7 @@ When nil, do no timestamp checking and always publish all files."
   :type 'directory)
 
 (defcustom org-publish-list-skipped-files t
-  "Non-nil means, show message about files *not* published."
+  "Non-nil means show message about files *not* published."
   :group 'org-publish
   :type 'boolean)
 
@@ -194,6 +222,34 @@ Any changes made by this hook will be saved."
   :group 'org-publish
   :type 'hook)
 
+(defcustom org-publish-sitemap-sort-alphabetically t
+  "Should sitemaps be sorted alphabetically by default?
+
+You can overwrite this default per project in your
+`org-publish-project-alist', using `:sitemap-alphabetically'."
+  :group 'org-publish
+  :type 'boolean)
+
+(defcustom org-publish-sitemap-sort-folders 'first
+  "A symbol, denoting if folders are sorted first in sitemaps.
+Possible values are `first', `last', and nil.
+If `first', folders will be sorted before files.
+If `last', folders are sorted to the end after the files.
+Any other value will not mix files and folders.
+
+You can overwrite this default per project in your
+`org-publish-project-alist', using `:sitemap-sort-folders'."
+  :group 'org-publish
+  :type 'symbol)
+
+(defcustom org-publish-sitemap-sort-ignore-case nil
+  "Sort sitemaps case insensitively by default?
+
+You can overwrite this default per project in your
+`org-publish-project-alist', using `:sitemap-ignore-case'."
+  :group 'org-publish
+  :type 'boolean)
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Timestamp-related functions
 
@@ -201,29 +257,19 @@ Any changes made by this hook will be saved."
   "Return path to timestamp file for filename FILENAME."
   (setq filename (concat filename "::" (or pub-dir "") "::"
                         (format "%s" (or pub-func ""))))
-  (concat (file-name-as-directory org-publish-timestamp-directory)
-         "X" (if (fboundp 'sha1) (sha1 filename) (md5 filename))))
+  (concat "X" (if (fboundp 'sha1) (sha1 filename) (md5 filename))))
 
 (defun org-publish-needed-p (filename &optional pub-dir pub-func true-pub-dir)
-  "Return `t' if FILENAME should be published in PUB-DIR using PUB-FUNC.
-TRUE-PUB-DIR is there the file will truely end up.  Currently we are not using
+  "Return t if FILENAME should be published in PUB-DIR using PUB-FUNC.
+TRUE-PUB-DIR is where the file will truly end up.  Currently we are not using
 this - maybe it can eventually be used to check if the file is present at
 the target location, and how old it is.  Right ow we cannot do this, because
 we do not know under what file name the file will be stored - the publishing
 function can still decide about that independently."
   (let ((rtn
         (if org-publish-use-timestamps-flag
-            (if (file-exists-p org-publish-timestamp-directory)
-                ;; first handle possible wrong timestamp directory
-                (if (not (file-directory-p org-publish-timestamp-directory))
-                    (error "Org publish timestamp: %s is not a directory"
-                           org-publish-timestamp-directory)
-                  ;; there is a timestamp, check if FILENAME is newer
-                  (file-newer-than-file-p
-                   filename (org-publish-timestamp-filename
-                             filename pub-dir pub-func)))
-              (make-directory org-publish-timestamp-directory)
-              t)
+            (org-publish-cache-file-needs-publishing
+             filename pub-dir pub-func)
           ;; don't use timestamps, always return t
           t)))
     (if rtn
@@ -235,55 +281,33 @@ function can still decide about that independently."
 (defun org-publish-update-timestamp (filename &optional pub-dir pub-func)
   "Update publishing timestamp for file FILENAME.
 If there is no timestamp, create one."
-  (let ((timestamp-file (org-publish-timestamp-filename
-                        filename pub-dir pub-func))
-       newly-created-timestamp)
-    (if (not (file-exists-p timestamp-file))
-       ;; create timestamp file if needed
-       (with-temp-buffer
-         (make-directory (file-name-directory timestamp-file) t)
-         (write-file timestamp-file)
-         (setq newly-created-timestamp t)))
-    ;; Emacs 21 doesn't have `set-file-times'
-    (if (and (fboundp 'set-file-times)
-            (not newly-created-timestamp))
-       (set-file-times timestamp-file)
-      (call-process "touch" nil 0 nil (expand-file-name timestamp-file)))))
+  (let ((key (org-publish-timestamp-filename filename pub-dir pub-func))
+       (stamp (org-publish-cache-ctime-of-src filename)))
+    (org-publish-cache-set key stamp)))
 
 (defun org-publish-remove-all-timestamps ()
-  "Remove all files in the timstamp directory."
+  "Remove all files in the timestamp directory."
   (let ((dir org-publish-timestamp-directory)
        files)
     (when (and (file-exists-p dir)
               (file-directory-p dir))
-      (mapc 'delete-file (directory-files dir 'full "[^.]\\'")))))
+      (mapc 'delete-file (directory-files dir 'full "[^.]\\'"))
+      (org-publish-reset-cache))))
 
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; Mapping files to project names
-
-(defvar org-publish-files-alist nil
-  "Alist of files and their parent projects.
-Each element of this alist is of the form:
-
-  (file-name . project-name)")
+;;;
 
 (defvar org-publish-initial-buffer nil
   "The buffer `org-publish' has been called from.")
 (defvar org-publish-temp-files nil
   "Temporary list of files to be published.")
 
-(defun org-publish-initialize-files-alist (&optional refresh)
-  "Set `org-publish-files-alist' if it is not set.
-Also set it if the optional argument REFRESH is non-nil."
-  (interactive "P")
-  (when (or refresh (not org-publish-files-alist))
-    (setq org-publish-files-alist
-         (org-publish-get-files org-publish-project-alist))))
+;; Here, so you find the variable right before it's used the first time:
+(defvar org-publish-cache nil
+  "This will cache timestamps and titles for files in publishing projects.
+Blocks could hash sha1 values here.")
 
-(defun org-publish-validate-link (link &optional directory)
-  "Check if LINK points to a file in the current project."
-  (assoc (expand-file-name link directory) org-publish-files-alist))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Compatibility aliases
@@ -306,27 +330,11 @@ This is a compatibility function for Emacsen without `delete-dups'."
     list))
 
 (declare-function org-publish-delete-dups "org-publish" (list))
+(declare-function find-lisp-find-files "find-lisp" (directory regexp))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Getting project information out of org-publish-project-alist
 
-(defun org-publish-get-files (projects-alist &optional no-exclusion)
-  "Return the list of all publishable files for PROJECTS-ALIST.
-If NO-EXCLUSION is non-nil, don't exclude files."
-  (let (all-files)
-    ;; add all projects
-    (mapc
-     (lambda(p)
-       (let* ((exclude (plist-get (cdr p) :exclude))
-             (files (and p (org-publish-get-base-files p exclude))))
-        ;; add all files from this project
-        (mapc (lambda(f)
-                (add-to-list 'all-files
-                             (cons (expand-file-name f) (car p))))
-              files)))
-     (org-publish-expand-projects projects-alist))
-    all-files))
-
 (defun org-publish-expand-projects (projects-alist)
   "Expand projects in PROJECTS-ALIST.
 This splices all the components into the list."
@@ -340,6 +348,42 @@ This splices all the components into the list."
        (push p rtn)))
     (nreverse (org-publish-delete-dups (delq nil rtn)))))
 
+
+(defvar sitemap-alphabetically)
+(defvar sitemap-sort-folders)
+(defvar sitemap-ignore-case)
+(defvar sitemap-requested)
+(defun org-publish-compare-directory-files (a b)
+  "Predicate for `sort', that sorts folders-first/last and alphabetically."
+  (let ((retval t))
+    (when (or sitemap-alphabetically sitemap-sort-folders)
+      ;; First we sort alphabetically:
+      (when sitemap-alphabetically
+        (let* ((adir (file-directory-p a))
+               (aorg (and (string-match "\\.org$" a) (not adir)))
+               (bdir (file-directory-p b))
+               (borg (and (string-match "\\.org$" b) (not bdir)))
+               (A (if aorg
+                      (concat (file-name-directory a)
+                              (org-publish-find-title a)) a))
+               (B (if borg
+                      (concat (file-name-directory b)
+                              (org-publish-find-title b)) b)))
+          (setq retval (if sitemap-ignore-case
+                          (not (string-lessp (upcase B) (upcase A)))
+                        (not (string-lessp B A))))))
+
+      ;; Directory-wise wins:
+      (when sitemap-sort-folders
+        ;; a is directory, b not:
+        (cond
+         ((and (file-directory-p a) (not (file-directory-p b)))
+          (setq retval (equal sitemap-sort-folders 'first)))
+          ;; a is not a directory, but b is:
+         ((and (not (file-directory-p a)) (file-directory-p b))
+          (setq retval (equal sitemap-sort-folders 'last))))))
+    retval))
+
 (defun org-publish-get-base-files-1 (base-dir &optional recurse match skip-file skip-dir)
   "Set `org-publish-temp-files' with files from BASE-DIR directory.
 If RECURSE is non-nil, check BASE-DIR recursively.  If MATCH is
@@ -358,8 +402,12 @@ matching the regexp SKIP-DIR when recursing through BASE-DIR."
                          (and skip-file (string-match skip-file fnd))
                          (not (file-exists-p (file-truename f)))
                          (not (string-match match fnd)))
+
                (pushnew f org-publish-temp-files)))))
-       (directory-files base-dir t (unless recurse match))))
+       (if sitemap-requested
+           (sort (directory-files base-dir t (unless recurse match))
+                 'org-publish-compare-directory-files)
+         (directory-files base-dir t (unless recurse match)))))
 
 (defun org-publish-get-base-files (project &optional exclude-regexp)
   "Return a list of all files in PROJECT.
@@ -371,9 +419,29 @@ matching filenames."
         (include-list (plist-get project-plist :include))
         (recurse (plist-get project-plist :recursive))
         (extension (or (plist-get project-plist :base-extension) "org"))
+        ;; sitemap-... variables are dynamically scoped for
+        ;; org-publish-compare-directory-files:
+        (sitemap-requested
+         (plist-get project-plist :auto-sitemap))
+        (sitemap-sort-folders
+         (if (plist-member project-plist :sitemap-sort-folders)
+             (plist-get project-plist :sitemap-sort-folders)
+           org-publish-sitemap-sort-folders))
+        (sitemap-alphabetically
+         (if (plist-member project-plist :sitemap-alphabetically)
+             (plist-get project-plist :sitemap-alphabetically)
+           org-publish-sitemap-sort-alphabetically))
+        (sitemap-ignore-case
+         (if (plist-member project-plist :sitemap-ignore-case)
+             (plist-get project-plist :sitemap-ignore-case)
+           org-publish-sitemap-sort-ignore-case))
         (match (if (eq extension 'any)
                     "^[^\\.]"
                  (concat "^[^\\.].*\\.\\(" extension "\\)$"))))
+    ;; Make sure sitemap-sort-folders' has an accepted value
+    (unless (memq sitemap-sort-folders '(first last))
+      (setq sitemap-sort-folders nil))
+
     (setq org-publish-temp-files nil)
     (org-publish-get-base-files-1 base-dir recurse match
                                  ;; FIXME distinguish exclude regexp
@@ -387,9 +455,27 @@ matching filenames."
     org-publish-temp-files))
 
 (defun org-publish-get-project-from-filename (filename &optional up)
-  "Return the project FILENAME belongs."
-  (let* ((project-name (cdr (assoc (expand-file-name filename)
-                                  org-publish-files-alist))))
+  "Return the project that FILENAME belongs to."
+  (let* ((filename (expand-file-name filename))
+        project-name)
+
+    (catch 'p-found
+      (dolist (prj org-publish-project-alist)
+       (unless (plist-get (cdr prj) :components)
+         ;; [[info:org:Selecting%20files]] shows how this is supposed to work:
+         (let* ((r (plist-get (cdr prj) :recursive))
+                (b (expand-file-name (plist-get (cdr prj) :base-directory)))
+                (x (or (plist-get (cdr prj) :base-extension) "org"))
+                (e (plist-get (cdr prj) :exclude))
+                (i (plist-get (cdr prj) :include))
+                (xm (concat "^" b (if r ".+" "[^/]+") "\\.\\(" x "\\)$")))
+           (when (or
+                  (and i (string-match i filename))
+                  (and
+                   (not (and e (string-match e filename)))
+                   (string-match xm filename)))
+             (setq project-name (car prj))
+             (throw 'p-found project-name))))))
     (when up
       (dolist (prj org-publish-project-alist)
        (if (member project-name (plist-get (cdr prj) :components))
@@ -426,8 +512,8 @@ PUB-DIR is the publishing directory."
                   (buffer-live-p export-buf-or-file))
          (set-buffer export-buf-or-file)
          ;; run hooks after export and save export
-         (and (run-hooks 'org-publish-after-export-hook)
-              (if (buffer-modified-p) (save-buffer)))
+         (progn (run-hooks 'org-publish-after-export-hook)
+                (if (buffer-modified-p) (save-buffer)))
          (kill-buffer export-buf-or-file))
        ;; maybe restore buffer's content
        (set-buffer init-buf)
@@ -439,20 +525,33 @@ PUB-DIR is the publishing directory."
        (unless visiting
          (kill-buffer init-buf))))))
 
+(defmacro org-publish-with-aux-preprocess-maybe (&rest body)
+  "Execute BODY with a modified hook to preprocess for index."
+  `(let ((org-export-preprocess-after-headline-targets-hook
+        (if (plist-get project-plist :makeindex)
+            (cons 'org-publish-aux-preprocess
+                  org-export-preprocess-after-headline-targets-hook)
+          org-export-preprocess-after-headline-targets-hook)))
+     ,@body))
+
+(defvar project-plist)
 (defun org-publish-org-to-latex (plist filename pub-dir)
   "Publish an org file to LaTeX.
 See `org-publish-org-to' to the list of arguments."
-  (org-publish-org-to "latex" plist filename pub-dir))
+  (org-publish-with-aux-preprocess-maybe
+   (org-publish-org-to "latex" plist filename pub-dir)))
 
 (defun org-publish-org-to-pdf (plist filename pub-dir)
   "Publish an org file to PDF (via LaTeX).
 See `org-publish-org-to' to the list of arguments."
-  (org-publish-org-to "pdf" plist filename pub-dir))
+  (org-publish-with-aux-preprocess-maybe
+   (org-publish-org-to "pdf" plist filename pub-dir)))
 
 (defun org-publish-org-to-html (plist filename pub-dir)
   "Publish an org file to HTML.
 See `org-publish-org-to' to the list of arguments."
-  (org-publish-org-to "html" plist filename pub-dir))
+  (org-publish-with-aux-preprocess-maybe
+    (org-publish-org-to "html" plist filename pub-dir)))
 
 (defun org-publish-org-to-org (plist filename pub-dir)
   "Publish an org file to HTML.
@@ -474,20 +573,17 @@ See `org-publish-org-to' to the list of arguments."
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Publishing files, sets of files, and indices
 
-(defun org-publish-file (filename &optional project)
-  "Publish file FILENAME from PROJECT."
+(defun org-publish-file (filename &optional project no-cache)
+  "Publish file FILENAME from PROJECT.
+If NO-CACHE is not nil, do not initialize org-publish-cache and
+write it to disk.  This is needed, since this function is used to
+publish single files, when entire projects are published.
+See `org-publish-projects'."
   (let* ((project
          (or project
              (or (org-publish-get-project-from-filename filename)
-                 (if (y-or-n-p
-                      (format "%s is not in a project.  Re-read the list of projects files? "
-                              (abbreviate-file-name filename)))
-                     ;; If requested, re-initialize the list of projects files
-                     (progn (org-publish-initialize-files-alist t)
-                            (or (org-publish-get-project-from-filename filename)
-                                (error "File %s not part of any known project"
-                                       (abbreviate-file-name filename))))
-                   (error "Can't publish file outside of a project")))))
+                 (error "File %s not part of any known project"
+                        (abbreviate-file-name filename)))))
         (project-plist (cdr project))
         (ftname (file-truename filename))
         (publishing-function
@@ -498,6 +594,10 @@ See `org-publish-org-to' to the list of arguments."
         (pub-dir (file-name-as-directory
                   (file-truename (plist-get project-plist :publishing-directory))))
         tmp-pub-dir)
+
+    (unless no-cache
+      (org-publish-initialize-cache (car project)))
+
     (setq tmp-pub-dir
          (file-name-directory
           (concat pub-dir
@@ -514,35 +614,47 @@ See `org-publish-org-to' to the list of arguments."
                                  tmp-pub-dir)
        (funcall publishing-function project-plist filename tmp-pub-dir)
        (org-publish-update-timestamp
-        filename pub-dir publishing-function)))))
+        filename pub-dir publishing-function)))
+    (unless no-cache (org-publish-write-cache-file))))
 
 (defun org-publish-projects (projects)
   "Publish all files belonging to the PROJECTS alist.
-If :auto-index is set, publish the index too."
+If :auto-sitemap is set, publish the sitemap too.
+If :makeindex is set, also produce a file theindex.org."
   (mapc
    (lambda (project)
+     ;; Each project uses it's own cache file:
+     (org-publish-initialize-cache (car project))
      (let*
         ((project-plist (cdr project))
          (exclude-regexp (plist-get project-plist :exclude))
-         (index-p (plist-get project-plist :auto-index))
-         (index-filename (or (plist-get project-plist :index-filename)
-                             "sitemap.org"))
-         (index-function (or (plist-get project-plist :index-function)
-                             'org-publish-org-index))
+         (sitemap-p (plist-get project-plist :auto-sitemap))
+         (sitemap-filename (or (plist-get project-plist :sitemap-filename)
+                               "sitemap.org"))
+         (sitemap-function (or (plist-get project-plist :sitemap-function)
+                               'org-publish-org-sitemap))
          (preparation-function (plist-get project-plist :preparation-function))
          (completion-function (plist-get project-plist :completion-function))
          (files (org-publish-get-base-files project exclude-regexp)) file)
-       (when preparation-function (funcall preparation-function))
-       (if index-p (funcall index-function project index-filename))
+       (when preparation-function (run-hooks 'preparation-function))
+       (if sitemap-p (funcall sitemap-function project sitemap-filename))
        (while (setq file (pop files))
-        (org-publish-file file project))
-       (when completion-function (funcall completion-function))))
+        (org-publish-file file project t))
+       (when (plist-get project-plist :makeindex)
+        (org-publish-index-generate-theindex.inc
+         (plist-get project-plist :base-directory))
+        (org-publish-file (expand-file-name
+                           "theindex.org"
+                           (plist-get project-plist :base-directory))
+                          project t))
+       (when completion-function (run-hooks 'completion-function))
+     (org-publish-write-cache-file)))
    (org-publish-expand-projects projects)))
 
-(defun org-publish-org-index (project &optional index-filename)
-  "Create an index of pages in set defined by PROJECT.
-Optionally set the filename of the index with INDEX-FILENAME.
-Default for INDEX-FILENAME is 'sitemap.org'."
+(defun org-publish-org-sitemap (project &optional sitemap-filename)
+  "Create a sitemap of pages in set defined by PROJECT.
+Optionally set the filename of the sitemap with SITEMAP-FILENAME.
+Default for SITEMAP-FILENAME is 'sitemap.org'."
   (let* ((project-plist (cdr project))
         (dir (file-name-as-directory
               (plist-get project-plist :base-directory)))
@@ -550,28 +662,28 @@ Default for INDEX-FILENAME is 'sitemap.org'."
         (indent-str (make-string 2 ?\ ))
         (exclude-regexp (plist-get project-plist :exclude))
         (files (nreverse (org-publish-get-base-files project exclude-regexp)))
-        (index-filename (concat dir (or index-filename "sitemap.org")))
-        (index-title (or (plist-get project-plist :index-title)
-                         (concat "Index for project " (car project))))
-        (index-style (or (plist-get project-plist :index-style)
+        (sitemap-filename (concat dir (or sitemap-filename "sitemap.org")))
+        (sitemap-title (or (plist-get project-plist :sitemap-title)
+                         (concat "Sitemap for project " (car project))))
+        (sitemap-style (or (plist-get project-plist :sitemap-style)
                          'tree))
-        (visiting (find-buffer-visiting index-filename))
-        (ifn (file-name-nondirectory index-filename))
-        file index-buffer)
-    (with-current-buffer (setq index-buffer
-                              (or visiting (find-file index-filename)))
+        (visiting (find-buffer-visiting sitemap-filename))
+        (ifn (file-name-nondirectory sitemap-filename))
+        file sitemap-buffer)
+    (with-current-buffer (setq sitemap-buffer
+                              (or visiting (find-file sitemap-filename)))
       (erase-buffer)
-      (insert (concat "#+TITLE: " index-title "\n\n"))
+      (insert (concat "#+TITLE: " sitemap-title "\n\n"))
       (while (setq file (pop files))
        (let ((fn (file-name-nondirectory file))
              (link (file-relative-name file dir))
              (oldlocal localdir))
-         ;; index shouldn't index itself
-         (unless (equal (file-truename index-filename)
+         ;; sitemap shouldn't list itself
+         (unless (equal (file-truename sitemap-filename)
                         (file-truename file))
-           (if (eq index-style 'list)
-               (message "Generating list-style index for %s" index-title)
-             (message "Generating tree-style index for %s" index-title)
+           (if (eq sitemap-style 'list)
+               (message "Generating list-style sitemap for %s" sitemap-title)
+             (message "Generating tree-style sitemap for %s" sitemap-title)
              (setq localdir (concat (file-name-as-directory dir)
                                     (file-name-directory link)))
              (unless (string= localdir oldlocal)
@@ -600,11 +712,13 @@ Default for INDEX-FILENAME is 'sitemap.org'."
                            (org-publish-find-title file)
                            "]]\n")))))
       (save-buffer))
-    (or visiting (kill-buffer index-buffer))))
+    (or visiting (kill-buffer sitemap-buffer))))
 
 (defun org-publish-find-title (file)
-  "Find the title of file in project."
-  (let* ((visiting (find-buffer-visiting file))
+  "Find the title of FILE in project."
+  (or
+   (org-publish-cache-get-file-property file :title nil t)
+   (let* ((visiting (find-buffer-visiting file))
         (buffer (or visiting (find-file-noselect file)))
         title)
     (with-current-buffer buffer
@@ -618,7 +732,8 @@ Default for INDEX-FILENAME is 'sitemap.org'."
                  (file-name-nondirectory (file-name-sans-extension file))))))
     (unless visiting
       (kill-buffer buffer))
-    title))
+    (org-publish-cache-set-file-property file :title title)
+    title)))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Interactive publishing functions
@@ -640,7 +755,12 @@ Default for INDEX-FILENAME is 'sitemap.org'."
   (save-window-excursion
     (let* ((org-publish-use-timestamps-flag
            (if force nil org-publish-use-timestamps-flag)))
-      (org-publish-projects (list project)))))
+      (org-publish-projects
+       (if (stringp project)
+          ;; If this function is called in batch mode,
+          ;; project is still a string here.
+          (list (assoc project org-publish-project-alist))
+          (list project))))))
 
 ;;;###autoload
 (defun org-publish-all (&optional force)
@@ -650,18 +770,18 @@ directory and force publishing all files."
   (interactive "P")
   (when force
     (org-publish-remove-all-timestamps))
-  (org-publish-initialize-files-alist)
+  ;;  (org-publish-initialize-files-alist force)
   (save-window-excursion
     (let ((org-publish-use-timestamps-flag
           (if force nil org-publish-use-timestamps-flag)))
       (org-publish-projects org-publish-project-alist))))
 
+
 ;;;###autoload
 (defun org-publish-current-file (&optional force)
   "Publish the current file.
 With prefix argument, force publish the file."
   (interactive "P")
-  (org-publish-initialize-files-alist)
   (save-window-excursion
     (let ((org-publish-use-timestamps-flag
           (if force nil org-publish-use-timestamps-flag)))
@@ -673,17 +793,245 @@ With prefix argument, force publish the file."
 With a prefix argument, force publishing of all files in
 the project."
   (interactive "P")
-  (org-publish-initialize-files-alist)
   (save-window-excursion
     (let ((project (org-publish-get-project-from-filename (buffer-file-name) 'up))
          (org-publish-use-timestamps-flag
           (if force nil org-publish-use-timestamps-flag)))
       (if (not project)
          (error "File %s is not part of any known project" (buffer-file-name)))
+      ;; FIXME: force is not used here?
       (org-publish project))))
 
-(provide 'org-publish)
 
+;;; Index generation
+
+(defvar backend) ; dynamically scoped
+(defun org-publish-aux-preprocess ()
+  "Find index entries and write them to an .orgx file."
+  (let ((case-fold-search t)
+       entry index target)
+    (goto-char (point-min))
+    (while
+       (and
+        (re-search-forward "^[ \t]*#\\+index:[ \t]*\\(.*?\\)[ \t]*$" nil t)
+        (> (match-end 1) (match-beginning 1)))
+      (setq entry (match-string 1))
+      (when (eq backend 'latex)
+       (replace-match (format "\\index{%s}" entry) t t))
+      (save-excursion
+       (ignore-errors (org-back-to-heading t))
+       (setq target (get-text-property (point) 'target))
+       (setq target (or (cdr (assoc target org-export-preferred-target-alist))
+                        (cdr (assoc target org-export-id-target-alist))
+                        target ""))
+       (push (cons entry target) index)))
+    (with-temp-file
+       (concat (file-name-sans-extension org-current-export-file) ".orgx")
+      (dolist (entry (nreverse index))
+       (insert (format "INDEX: (%s) %s\n" (cdr entry) (car entry)))))))
+
+(defun org-publish-index-generate-theindex.inc (directory)
+  "Generate the index from all .orgx files in the current directory and below."
+  (require 'find-lisp)
+  (let* ((fulldir (file-name-as-directory
+                  (expand-file-name directory)))
+        (full-files (find-lisp-find-files directory "\\.orgx\\'"))
+        (re (concat "\\`" fulldir))
+        (files (mapcar (lambda (f) (if (string-match re f)
+                                       (substring f (match-end 0))
+                                     f))
+                       full-files))
+        (default-directory directory)
+        index origfile buf target entry ibuffer
+        main last-main letter last-letter file sub link tgext)
+    ;; `files' contains the list of relative file names
+    (dolist (file files)
+      (setq origfile (substring file 0 -1))
+      (setq buf (find-file-noselect file))
+      (with-current-buffer buf
+       (goto-char (point-min))
+       (while (re-search-forward "^INDEX: (\\(.*?\\)) \\(.*\\)" nil t)
+         (setq target (match-string 1)
+               entry (match-string 2))
+         (push (list entry origfile target) index)))
+      (kill-buffer buf))
+    (setq index (sort index (lambda (a b) (string< (downcase (car a))
+                                                  (downcase (car b))))))
+    (setq ibuffer (find-file-noselect (expand-file-name "theindex.inc" directory)))
+    (with-current-buffer ibuffer
+      (erase-buffer)
+      (insert "* Index\n")
+      (setq last-letter nil)
+      (dolist (idx index)
+       (setq entry (car idx) file (nth 1 idx) target (nth 2 idx))
+       (if (and (stringp target) (string-match "\\S-" target))
+           (setq tgext (concat "::#" target))
+         (setq tgext ""))
+       (setq letter (upcase (substring entry 0 1)))
+       (when (not (equal letter last-letter))
+         (insert "** " letter "\n")
+         (setq last-letter letter))
+       (if (string-match "!" entry)
+           (setq main (substring entry 0 (match-beginning 0))
+                 sub (substring entry (match-end 0)))
+         (setq main nil sub nil last-main nil))
+       (when (and main (not (equal main last-main)))
+         (insert "   - " main "\n")
+         (setq last-main main))
+       (setq link (concat "[[file:" file tgext "]"
+                          "[" (or sub entry) "]]"))
+       (if (and main sub)
+           (insert "     - " link "\n")
+         (insert "   - " link "\n")))
+      (save-buffer))
+    (kill-buffer ibuffer)
+
+    (let ((index-file (expand-file-name "theindex.org" directory)))
+      (unless (file-exists-p index-file)
+       (setq ibuffer (find-file-noselect index-file))
+       (with-current-buffer ibuffer
+         (erase-buffer)
+         (insert "\n\n#+include: \"theindex.inc\"\n\n")
+         (save-buffer))
+       (kill-buffer ibuffer)))))
+
+
+;; Caching functions:
+
+(defun org-publish-write-cache-file (&optional free-cache)
+  "Write `org-publish-cache' to file.
+If FREE-CACHE, empty the cache."
+  (unless org-publish-cache
+    (error "%s" "`org-publish-write-cache-file' called, but no cache present"))
+
+  (let ((cache-file (org-publish-cache-get ":cache-file:")))
+    (unless cache-file
+      (error
+       "%s" "Cannot find cache-file name in `org-publish-write-cache-file'"))
+    (with-temp-file cache-file
+      (let ((print-level nil)
+           (print-length nil))
+       (insert "(setq org-publish-cache (make-hash-table :test 'equal :weakness nil :size 100))\n")
+       (maphash (lambda (k v)
+                  (insert
+                   (format (concat "(puthash %S "
+                                   (if (or (listp v) (symbolp v))
+                                       "'" "")
+                                   "%S org-publish-cache)\n") k v)))
+                org-publish-cache)))
+    (when free-cache (org-publish-reset-cache))))
+
+(defun org-publish-initialize-cache (project-name)
+  "Initialize the projects cache if not initialized yet and return it."
+
+  (unless project-name
+    (error "%s%s" "Cannot initialize `org-publish-cache' without projects name"
+          " in `org-publish-initialize-cache'"))
+
+  (unless (file-exists-p org-publish-timestamp-directory)
+    (make-directory org-publish-timestamp-directory t))
+  (if (not (file-directory-p org-publish-timestamp-directory))
+      (error "Org publish timestamp: %s is not a directory"
+            org-publish-timestamp-directory))
+
+  (unless (and org-publish-cache
+              (string= (org-publish-cache-get ":project:") project-name))
+    (let* ((cache-file (concat
+                       (expand-file-name org-publish-timestamp-directory)
+                       project-name
+                       ".cache"))
+          (cexists (file-exists-p cache-file)))
+
+      (when org-publish-cache
+       (org-publish-reset-cache))
+
+      (if cexists
+         (load-file cache-file)
+       (setq org-publish-cache
+             (make-hash-table :test 'equal :weakness nil :size 100))
+       (org-publish-cache-set ":project:" project-name)
+       (org-publish-cache-set ":cache-file:" cache-file))
+      (unless cexists (org-publish-write-cache-file nil))))
+  org-publish-cache)
+
+(defun org-publish-reset-cache ()
+  "Empty org-publish-cache and reset it nil."
+  (message "%s" "Resetting org-publish-cache")
+  (if (hash-table-p org-publish-cache)
+      (clrhash org-publish-cache))
+  (setq org-publish-cache nil))
+
+(defun org-publish-cache-file-needs-publishing (filename &optional pub-dir pub-func)
+  "Check the timestamp of the last publishing of FILENAME.
+Return `t', if the file needs publishing"
+  (unless org-publish-cache
+    (error "%s" "`org-publish-cache-file-needs-publishing' called, but no cache present"))
+  (let* ((key (org-publish-timestamp-filename filename pub-dir pub-func))
+        (pstamp (org-publish-cache-get key)))
+    (if (null pstamp)
+       t
+      (let ((ctime (org-publish-cache-ctime-of-src filename)))
+       (< pstamp ctime)))))
+
+(defun org-publish-cache-set-file-property (filename property value &optional project-name)
+  "Set the VALUE for a PROPERTY of file FILENAME in publishing cache to VALUE.
+Use cache file of PROJECT-NAME.  If the entry does not exist, it will be
+created.  Return VALUE."
+  ;; Evtl. load the requested cache file:
+  (if project-name (org-publish-initialize-cache project-name))
+  (let ((pl (org-publish-cache-get filename)))
+    (if pl
+       (progn
+         (plist-put pl property value)
+         value)
+      (org-publish-cache-get-file-property
+       filename property value nil project-name))))
+
+(defun org-publish-cache-get-file-property
+  (filename property &optional default no-create project-name)
+  "Return the value for a PROPERTY of file FILENAME in publishing cache.
+Use cache file of PROJECT-NAME. Return the value of that PROPERTY or
+DEFAULT, if the value does not yet exist.
+If the entry will be created, unless NO-CREATE is not nil."
+  ;; Evtl. load the requested cache file:
+  (if project-name (org-publish-initialize-cache project-name))
+  (let ((pl (org-publish-cache-get filename))
+       (retval nil))
+    (if pl
+       (if (plist-member pl property)
+           (setq retval (plist-get pl property))
+         (setq retval default))
+      ;; no pl yet:
+      (unless no-create
+       (org-publish-cache-set filename (list property default)))
+      (setq retval default))
+    retval))
+
+(defun org-publish-cache-get (key)
+  "Return the value stored in `org-publish-cache' for key KEY.
+Returns nil, if no value or nil is found, or the cache does not
+exist."
+  (unless org-publish-cache
+    (error "%s" "`org-publish-cache-get' called, but no cache present"))
+  (gethash key org-publish-cache))
+
+(defun org-publish-cache-set (key value)
+  "Store KEY VALUE pair in `org-publish-cache'.
+Returns value on success, else nil."
+  (unless org-publish-cache
+    (error "%s" "`org-publish-cache-set' called, but no cache present"))
+  (puthash key value org-publish-cache))
+
+(defun org-publish-cache-ctime-of-src (filename)
+  "Get the files ctime as integer."
+  (let ((src-attr (file-attributes filename)))
+    (+
+     (lsh (car (nth 5 src-attr)) 16)
+     (cadr (nth 5 src-attr)))))
+
+
+
+(provide 'org-publish)
 
 ;; arch-tag: 72807f3c-8af0-4a6b-8dca-c3376eb25adb
 
index 7df860cccbce56464d8e4de38e975f4bdc1af783..d8252b65c3d1cb5282345e2729c2c8ee6112486a 100644 (file)
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33x
+;; Version: 7.01
 ;;
 ;; This file is part of GNU Emacs.
 ;;
   :group 'org)
 
 (defcustom org-remember-store-without-prompt t
-  "Non-nil means, `C-c C-c' stores remember note without further prompts.
+  "Non-nil means \\<org-remember-mode-map>\\[org-remember-finalize] \
+stores the remember note without further prompts.
 It then uses the file and headline specified by the template or (if the
 template does not specify them) by the variables `org-default-notes-file'
 and `org-remember-default-headline'.  To force prompting anyway, use
-`C-u C-c C-c' to file the note.
+\\[universal-argument] \\[org-remember-finalize] to file the note.
 
-When this variable is nil, `C-c C-c' gives you the prompts, and
-`C-u C-c C-c' triggers the fasttrack."
+When this variable is nil, \\[org-remember-finalize] gives you the prompts, and
+\\[universal-argument] \\[org-remember-finalize] triggers the fasttrack."
   :group 'org-remember
   :type 'boolean)
 
@@ -94,10 +95,10 @@ You can set this on a per-template basis with the variable
 (defcustom org-remember-templates nil
   "Templates for the creation of remember buffers.
 When nil, just let remember make the buffer.
-When non-nil, this is a list of 5-element lists.  In each entry, the first
-element is the name of the template, which should be a single short word.
-The second element is a character, a unique key to select this template.
-The third element is the template.
+When non-nil, this is a list of (up to) 6-element lists.  In each entry,
+the first element is the name of the template, which should be a single
+short word.  The second element is a character, a unique key to select
+this template.  The third element is the template.
 
 The fourth element is optional and can specify a destination file for
 remember items created with this template.  The default file is given
@@ -114,41 +115,44 @@ An optional sixth element specifies the contexts in which the template
 will be offered to the user.  This element can be a list of major modes
 or a function, and the template will only be offered if `org-remember'
 is called from a mode in the list, or if the function returns t.
-Templates that specify t or nil for the context will be always be added
+Templates that specify t or nil for the context will always be added
 to the list of selectable templates.
 
 The template specifies the structure of the remember buffer.  It should have
 a first line starting with a star, to act as the org-mode headline.
 Furthermore, the following %-escapes will be replaced with content:
 
-  %^{prompt}  Prompt the user for a string and replace this sequence with it.
-              A default value and a completion table ca be specified like this:
+  %^{PROMPT}  prompt the user for a string and replace this sequence with it.
+              A default value and a completion table can be specified like this:
               %^{prompt|default|completion2|completion3|...}
+              The arrow keys access a prompt-specific history.
+  %a          annotation, normally the link created with `org-store-link'
+  %A          like %a, but prompt for the description part
+  %i          initial content, copied from the active region.  If %i is
+              indented, the entire inserted text will be indented as well.
   %t          time stamp, date only
   %T          time stamp with date and time
   %u, %U      like the above, but inactive time stamps
   %^t         like %t, but prompt for date.  Similarly %^T, %^u, %^U.
-              You may define a prompt like %^{Please specify birthday
+              You may define a prompt like %^{Please specify birthday}t
   %n          user name (taken from `user-full-name')
-  %a          annotation, normally the link created with org-store-link
-  %i          initial content, copied from the active region.  If %i is 
-              indented, the entire inserted text will be indented as well.
   %c          current kill ring head
   %x          content of the X clipboard
-  %^C         Interactive selection of which kill or clip to use
-  %^L         Like %^C, but insert as link
-  %k          title of currently clocked task
-  %K          link to currently clocked task
-  %^g         prompt for tags, with completion on tags in target file
-  %^G         prompt for tags, with completion all tags in all agenda files
-  %^{prop}p   Prompt the user for a value for property `prop'
   %:keyword   specific information for certain link types, see below
-  %[pathname] insert the contents of the file given by `pathname'
-  %(sexp)     evaluate elisp `(sexp)' and replace with the result
-  %!          Store this note immediately after filling the template
-  %&          Visit note immediately after storing it
-
-  %?          After completing the template, position cursor here.
+  %^C         interactive selection of which kill or clip to use
+  %^L         like %^C, but insert as link
+  %k          title of the currently clocked task
+  %K          link to the currently clocked task
+  %^g         prompt for tags, completing tags in the target file
+  %^G         prompt for tags, completing all tags in all agenda files
+  %^{PROP}p   Prompt the user for a value for property PROP
+  %[PATHNAME] insert the contents of the file given by PATHNAME
+  %(SEXP)     evaluate elisp `(SEXP)' and replace with the result
+  %!          store this note immediately after completing the template\
+              \\<org-remember-mode-map>
+              (skipping the \\[org-remember-finalize] that normally triggers storing)
+  %&          jump to target location immediately after storing note
+  %?          after completing the template, position cursor here.
 
 Apart from these general escapes, you can access information specific to the
 link type that is created.  For example, calling `remember' in emails or gnus
@@ -211,7 +215,7 @@ The remember buffer is still current when this hook runs."
   :type 'hook)
 
 (defvar org-remember-mode-map (make-sparse-keymap)
-  "Keymap for org-remember-mode, a minor mode.
+  "Keymap for `org-remember-mode', a minor mode.
 Use this map to set additional keybindings for when Org-mode is used
 for a Remember buffer.")
 (defvar org-remember-mode-hook nil
@@ -225,11 +229,11 @@ for a Remember buffer.")
 (define-key org-remember-mode-map "\C-c\C-k" 'org-remember-kill)
 
 (defcustom org-remember-clock-out-on-exit 'query
-  "Non-nil means, stop the clock when exiting a clocking remember buffer.
+  "Non-nil means stop the clock when exiting a clocking remember buffer.
 This only applies if the clock is running in the remember buffer.  If the
 clock is not stopped, it continues to run in the storage location.
 Instead of nil or t, this may also be the symbol `query' to prompt the
-user each time a remember buffer with a running clock is filed away.  "
+user each time a remember buffer with a running clock is filed away."
   :group 'org-remember
   :type '(choice
          (const :tag "Never" nil)
@@ -248,7 +252,7 @@ See also `org-remember-auto-remove-backup-files'."
          (directory :tag "Directory")))
 
 (defcustom org-remember-auto-remove-backup-files t
-  "Non-nil means, remove remember backup files after successfully storage.
+  "Non-nil means remove remember backup files after successfully storage.
 When remember is finished successfully, with storing the note at the
 desired target, remove the backup files related to this remember process
 and show a message about remaining backup files, from previous, unfinished
@@ -265,7 +269,7 @@ Set this to nil if you find that you don't need the warning.
 
 If you cancel remember calls frequently and know when they
 contain useful information (because you know that you made an
-error or emacs crashed, for example) nil is more useful.  In the
+error or Emacs crashed, for example) nil is more useful.  In the
 opposite case, the default, t, is more useful."
   :group 'org-remember
   :type 'boolean)
@@ -351,7 +355,7 @@ RET at beg-of-buf -> Append to file as level 2 headline
                         org-force-remember-template-char))
                      (t
                       (setq msg (format
-                                 "Select template: %s"
+                                 "Select template: %s%s"
                                  (mapconcat
                                   (lambda (x)
                                     (cond
@@ -362,13 +366,17 @@ RET at beg-of-buf -> Append to file as level 2 headline
                                       (format "[%c]%s" (car x)
                                               (substring (nth 1 x) 1)))
                                      (t (format "[%c]%s" (car x) (nth 1 x)))))
-                                  templates " ")))
+                                  templates " ")
+                                 (if (assoc ?C templates)
+                                     ""
+                                   " [C]customize templates")))
                       (let ((inhibit-quit t) char0)
                         (while (not char0)
                           (message msg)
                           (setq char0 (read-char-exclusive))
                           (when (and (not (assoc char0 templates))
-                                     (not (equal char0 ?\C-g)))
+                                     (not (equal char0 ?\C-g))
+                                     (not (equal char0 ?C)))
                             (message "No such template \"%c\"" char0)
                             (ding) (sit-for 1)
                             (setq char0 nil)))
@@ -376,15 +384,14 @@ RET at beg-of-buf -> Append to file as level 2 headline
                           (jump-to-register remember-register)
                           (kill-buffer remember-buffer)
                           (error "Abort"))
+                        (when (not (assoc char0 templates))
+                          (jump-to-register remember-register)
+                          (kill-buffer remember-buffer)
+                          (customize-variable 'org-remember-templates)
+                          (error "Customize templates"))
                         char0))))))
       (cddr (assoc char templates)))))
 
-(defun org-get-x-clipboard (value)
-  "Get the value of the x clipboard, compatible with XEmacs, and GNU Emacs 21."
-  (if (eq window-system 'x)
-      (let ((x (org-get-x-clipboard-compat value)))
-       (if x (org-no-properties x)))))
-
 ;;;###autoload
 (defun org-remember-apply-template (&optional use-char skip-interactive)
   "Initialize *remember* buffer with template, invoke `org-mode'.
@@ -470,7 +477,7 @@ to be run from that hook to function properly."
 ## C-u C-c C-c  like C-c C-c, and immediately visit note at target location
 ## C-0 C-c C-c  \"%s\" -> \"* %s\"
 ## %s  to select file and header location interactively.
-## C-2 C-c C-c  as child of the currently clocked item
+## C-2 C-c C-c  as child (C-3: as sibling) of the currently clocked item
 ## To switch templates, use `\\[org-remember]'.  To abort use `C-c C-k'.\n\n"
                  (if org-remember-store-without-prompt "    C-c C-c" "    C-1 C-c C-c")
                  (abbreviate-file-name (or file org-default-notes-file))
@@ -479,9 +486,22 @@ to be run from that hook to function properly."
                  (or (cdr org-remember-previous-location) "???")
                  (if org-remember-store-without-prompt "C-1 C-c C-c" "        C-c C-c"))))
        (insert tpl)
-       (goto-char (point-min))
 
+       ;; %[] Insert contents of a file.
+       (goto-char (point-min))
+       (while (re-search-forward "%\\[\\(.+\\)\\]" nil t)
+         (unless (org-remember-escaped-%)
+           (let ((start (match-beginning 0))
+                 (end (match-end 0))
+                 (filename (expand-file-name (match-string 1))))
+             (goto-char start)
+             (delete-region start end)
+             (condition-case error
+                 (insert-file-contents filename)
+               (error (insert (format "%%![Couldn't insert %s: %s]"
+                                      filename error)))))))
        ;; Simple %-escapes
+       (goto-char (point-min))
        (while (re-search-forward "%\\([tTuUaiAcxkKI]\\)" nil t)
          (unless (org-remember-escaped-%)
            (when (and initial (equal (match-string 0) "%i"))
@@ -495,19 +515,6 @@ to be run from that hook to function properly."
             (or (eval (intern (concat "v-" (match-string 1)))) "")
             t t)))
 
-       ;; %[] Insert contents of a file.
-       (goto-char (point-min))
-       (while (re-search-forward "%\\[\\(.+\\)\\]" nil t)
-         (unless (org-remember-escaped-%)
-           (let ((start (match-beginning 0))
-                 (end (match-end 0))
-                 (filename (expand-file-name (match-string 1))))
-             (goto-char start)
-             (delete-region start end)
-             (condition-case error
-                 (insert-file-contents filename)
-               (error (insert (format "%%![Couldn't insert %s: %s]"
-                                      filename error)))))))
        ;; %() embedded elisp
        (goto-char (point-min))
        (while (re-search-forward "%\\((.+)\\)" nil t)
@@ -718,9 +725,11 @@ from that hook."
 If there is an active region, make sure remember uses it as initial content
 of the remember buffer.
 
-When called interactively with a `C-u' prefix argument GOTO, don't remember
+When called interactively with a \\[universal-argument] \
+prefix argument GOTO, don't remember
 anything, just go to the file/headline where the selected template usually
-stores its notes.  With a double prefix arg `C-u C-u', go to the last
+stores its notes.  With a double prefix argument \
+\\[universal-argument] \\[universal-argument], go to the last
 note stored by remember.
 
 Lisp programs can set ORG-FORCE-REMEMBER-TEMPLATE-CHAR to a character
@@ -792,21 +801,24 @@ The user is queried for the template."
 When the template has specified a file and a headline, the entry is filed
 there, or in the location defined by `org-default-notes-file' and
 `org-remember-default-headline'.
-
+\\<org-remember-mode-map>
 If no defaults have been defined, or if the current prefix argument
-is 1 (so you must use `C-1 C-c C-c' to exit remember), an interactive
+is 1 (using C-1 \\[org-remember-finalize] to exit remember), an interactive
 process is used to select the target location.
 
-When the prefix is 0 (i.e. when remember is exited with `C-0 C-c C-c'),
+When the prefix is 0 (i.e. when remember is exited with \
+C-0 \\[org-remember-finalize]),
 the entry is filed to the same location as the previous note.
 
-When the prefix is 2 (i.e. when remember is exited with `C-2 C-c C-c'),
+When the prefix is 2 (i.e. when remember is exited with \
+C-2 \\[org-remember-finalize]),
 the entry is filed as a subentry of the entry where the clock is
 currently running.
 
-When `C-u' has been used as prefix argument, the note is stored and emacs
-moves point to the new location of the note, so that editing can be
-continued there (similar to inserting \"%&\" into the template).
+When \\[universal-argument] has been used as prefix argument, the
+note is stored and Emacs moves point to the new location of the
+note, so that editing can be continued there (similar to
+inserting \"%&\" into the template).
 
 Before storing the note, the function ensures that the text has an
 org-mode-style headline, i.e. a first line that starts with
@@ -860,6 +872,7 @@ See also the variable `org-reverse-note-order'."
           (previousp (and (member current-prefix-arg '((16) 0))
                           org-remember-previous-location))
           (clockp (equal current-prefix-arg 2))
+          (clocksp (equal current-prefix-arg 3))
           (fastp (org-xor (equal current-prefix-arg 1)
                           org-remember-store-without-prompt))
           (file (cond
@@ -882,7 +895,7 @@ See also the variable `org-reverse-note-order'."
              visiting (and file (org-find-base-buffer-visiting file))
              heading (cdr org-remember-previous-location)
              fastp t))
-      (when clockp
+      (when (or clockp clocksp)
        (setq file (buffer-file-name (marker-buffer org-clock-marker))
              visiting (and file (org-find-base-buffer-visiting file))
              heading org-clock-heading-for-remember
@@ -1015,7 +1028,9 @@ See also the variable `org-reverse-note-order'."
                               (beginning-of-line 2)
                             (end-of-line 1)
                             (insert "\n"))))
-                    (org-paste-subtree (org-get-valid-level level 1) txt)
+                    (org-paste-subtree (if clocksp
+                                           level
+                                         (org-get-valid-level level 1)) txt)
                     (and org-auto-align-tags (org-set-tags nil t))
                     (bookmark-set "org-remember-last-stored")
                     (move-marker org-remember-last-stored-marker (point)))
index 98cdcde1d2085ad3ae28b8cf049159adc6cf13aa..4ddfadaafa5a0e3ca0fddd0c2cad3800b4303960 100644 (file)
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33x
+;; Version: 7.01
 ;;
 ;; This file is part of GNU Emacs.
 ;;
index 25e7f9dcd122d8366cb6226e52115c6d93eef402..453f3b0b534ba9a0469de0c28912a4f9feac12b5 100644 (file)
@@ -8,7 +8,7 @@
 ;;         Dan Davison <davison at stats dot ox dot ac dot uk>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33x
+;; Version: 7.01
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -38,6 +38,7 @@
   (require 'cl))
 
 (declare-function org-do-remove-indentation "org" (&optional n))
+(declare-function org-at-table.el-p "org" ())
 (declare-function org-get-indentation "org" (&optional line))
 (declare-function org-switch-to-buffer-other-window "org" (&rest args))
 
@@ -62,7 +63,7 @@ there are kept outside the narrowed region."
   "The default coderef format.
 This format string will be used to search for coderef labels in literal
 examples (EXAMPLE and SRC blocks).  The format can be overwritten in
-an individual literal example with the -f option, like
+an individual literal example with the -l option, like
 
 #+BEGIN_SRC pascal +n -r -l \"((%s))\"
 ...
@@ -86,10 +87,11 @@ These are the regions where each line starts with a colon."
          (function :tag "Other (specify)")))
 
 (defcustom org-src-preserve-indentation nil
-  "If non-nil, leading whitespace characters in source code
-blocks are preserved on export, and when switching between the
-org buffer and the language mode edit buffer. If this variable
-is nil then, after editing with \\[org-edit-src-code], the
+  "If non-nil preserve leading whitespace characters on export.
+If non-nil leading whitespace characters in source code blocks
+are preserved on export, and when switching between the org
+buffer and the language mode edit buffer.  If this variable is nil
+then, after editing with \\[org-edit-src-code], the
 minimum (across-lines) number of leading whitespace characters
 are removed from all lines, and the code block is uniformly
 indented according to the value of `org-edit-src-content-indentation'."
@@ -100,7 +102,7 @@ indented according to the value of `org-edit-src-content-indentation'."
   "Indentation for the content of a source code block.
 This should be the number of spaces added to the indentation of the #+begin
 line in order to compute the indentation of the block content after
-editing it with \\[org-edit-src-code]. Has no effect if
+editing it with \\[org-edit-src-code].  Has no effect if
 `org-src-preserve-indentation' is non-nil."
   :group 'org-edit-structure
   :type 'integer)
@@ -113,7 +115,6 @@ When nil, the message will only be shown intermittently in the echo area."
   :group 'org-edit-structure
   :type 'boolean)
 
-
 (defcustom org-src-window-setup 'reorganize-frame
   "How the source code edit buffer should be displayed.
 Possible values for this option are:
@@ -146,7 +147,7 @@ but which mess up the display of a snippet in Org exported files.")
 
 (defcustom org-src-lang-modes
   '(("ocaml" . tuareg) ("elisp" . emacs-lisp) ("ditaa" . artist)
-    ("asymptote" . asy) ("dot" . fundamental))
+    ("asymptote" . asy) ("dot" . fundamental) ("sqlite" . sql))
   "Alist mapping languages to their major mode.
 The key is the language name, the value is the string that should
 be inserted as the name of the major mode.  For many languages this is
@@ -166,6 +167,7 @@ For example, there is no ocaml-mode in Emacs, but the mode to use is
 (define-key org-src-mode-map "\C-c'" 'org-edit-src-exit)
 (defvar org-edit-src-force-single-line nil)
 (defvar org-edit-src-from-org-mode nil)
+(defvar org-edit-src-allow-write-back-p t)
 (defvar org-edit-src-picture nil)
 (defvar org-edit-src-beg-marker nil)
 (defvar org-edit-src-end-marker nil)
@@ -187,12 +189,12 @@ This minor mode is turned on in two situations:
 There is a mode hook, and keybindings for `org-edit-src-exit' and
 `org-edit-src-save'")
 
-(defun org-edit-src-code (&optional context)
+(defun org-edit-src-code (&optional context code edit-buffer-name)
   "Edit the source code example at point.
 The example is copied to a separate buffer, and that buffer is switched
 to the correct language mode.  When done, exit with \\[org-edit-src-exit].
 This will remove the original code in the Org buffer, and replace it with
-the edited version. Optional argument CONTEXT is used by 
+the edited version. Optional argument CONTEXT is used by
 \\[org-edit-src-save] when calling this function."
   (interactive)
   (unless (eq context 'save)
@@ -200,19 +202,22 @@ the edited version. Optional argument CONTEXT is used by
   (let ((line (org-current-line))
        (col (current-column))
        (case-fold-search t)
-       (msg (substitute-command-keys
-             "Edit, then exit with C-c ' (C-c and single quote)"))
        (info (org-edit-src-find-region-and-lang))
        (org-mode-p (eq major-mode 'org-mode))
        (beg (make-marker))
        (end (make-marker))
        (preserve-indentation org-src-preserve-indentation)
-       block-nindent total-nindent ovl lang lang-f single lfmt code begline buffer)
+       (allow-write-back-p (null code))
+       block-nindent total-nindent ovl lang lang-f single lfmt begline buffer msg)
     (if (not info)
        nil
       (setq beg (move-marker beg (nth 0 info))
            end (move-marker end (nth 1 info))
-           code (buffer-substring-no-properties beg end)
+           msg (if allow-write-back-p
+                   (substitute-command-keys
+                    "Edit, then exit with C-c ' (C-c and single quote)")
+                 "Exit with C-c ' (C-c and single quote)")
+           code (or code (buffer-substring-no-properties beg end))
            lang (or (cdr (assoc (nth 2 info) org-src-lang-modes))
                      (nth 2 info))
            lang (if (symbolp lang) (symbol-name lang) lang)
@@ -221,6 +226,13 @@ the edited version. Optional argument CONTEXT is used by
            block-nindent (nth 5 info)
            lang-f (intern (concat lang "-mode"))
            begline (save-excursion (goto-char beg) (org-current-line)))
+      (if (equal lang-f 'table.el-mode)
+         (setq lang-f (lambda ()
+                        (text-mode)
+                        (if (org-bound-and-true-p flyspell-mode)
+                            (flyspell-mode -1))
+                        (table-recognize)
+                        (org-set-local 'org-edit-src-content-indentation 0))))
       (unless (functionp lang-f)
        (error "No such language mode: %s" lang-f))
       (org-goto-line line)
@@ -231,20 +243,21 @@ the edited version. Optional argument CONTEXT is used by
        (when buffer
          (with-current-buffer buffer
            (if (boundp 'org-edit-src-overlay)
-               (org-delete-overlay org-edit-src-overlay)))
+               (delete-overlay org-edit-src-overlay)))
          (kill-buffer buffer))
        (setq buffer (generate-new-buffer
-                     (org-src-construct-edit-buffer-name (buffer-name) lang)))
-       (setq ovl (org-make-overlay beg end))
-       (org-overlay-put ovl 'edit-buffer buffer)
-       (org-overlay-put ovl 'help-echo "Click with mouse-1 to switch to buffer editing this segment")
-       (org-overlay-put ovl 'face 'secondary-selection)
-       (org-overlay-put ovl
-                        'keymap
-                        (let ((map (make-sparse-keymap)))
-                          (define-key map [mouse-1] 'org-edit-src-continue)
-                          map))
-       (org-overlay-put ovl :read-only "Leave me alone")
+                     (or edit-buffer-name
+                         (org-src-construct-edit-buffer-name (buffer-name) lang))))
+       (setq ovl (make-overlay beg end))
+       (overlay-put ovl 'edit-buffer buffer)
+       (overlay-put ovl 'help-echo "Click with mouse-1 to switch to buffer editing this segment")
+       (overlay-put ovl 'face 'secondary-selection)
+       (overlay-put ovl
+                    'keymap
+                    (let ((map (make-sparse-keymap)))
+                      (define-key map [mouse-1] 'org-edit-src-continue)
+                      map))
+       (overlay-put ovl :read-only "Leave me alone")
        (org-src-switch-to-buffer buffer 'edit)
        (if (eq single 'macro-definition)
            (setq code (replace-regexp-in-string "\\\\n" "\n" code t t)))
@@ -257,6 +270,7 @@ the edited version. Optional argument CONTEXT is used by
          (funcall lang-f))
        (set (make-local-variable 'org-edit-src-force-single-line) single)
        (set (make-local-variable 'org-edit-src-from-org-mode) org-mode-p)
+       (set (make-local-variable 'org-edit-src-allow-write-back-p) allow-write-back-p)
        (set (make-local-variable 'org-src-preserve-indentation) preserve-indentation)
        (when lfmt
          (set (make-local-variable 'org-coderef-label-format) lfmt))
@@ -313,7 +327,7 @@ the edited version. Optional argument CONTEXT is used by
      (switch-to-buffer buffer))))
 
 (defun org-src-construct-edit-buffer-name (org-buffer-name lang)
-  "Construct the buffer name for a source editing buffer"
+  "Construct the buffer name for a source editing buffer."
   (concat "*Org Src " org-buffer-name "[ " lang " ]*"))
 
 (defun org-edit-src-find-buffer (beg end)
@@ -374,22 +388,22 @@ the fragment in the Org-mode buffer."
        (when buffer
          (with-current-buffer buffer
            (if (boundp 'org-edit-src-overlay)
-               (org-delete-overlay org-edit-src-overlay)))
+               (delete-overlay org-edit-src-overlay)))
          (kill-buffer buffer))
        (setq buffer (generate-new-buffer
                      (org-src-construct-edit-buffer-name
                       (buffer-name) "Fixed Width")))
-       (setq ovl (org-make-overlay beg end))
-       (org-overlay-put ovl 'face 'secondary-selection)
-       (org-overlay-put ovl 'edit-buffer buffer)
-       (org-overlay-put ovl 'help-echo "Click with mouse-1 to switch to buffer editing this segment")
-       (org-overlay-put ovl 'face 'secondary-selection)
-       (org-overlay-put ovl
+       (setq ovl (make-overlay beg end))
+       (overlay-put ovl 'face 'secondary-selection)
+       (overlay-put ovl 'edit-buffer buffer)
+       (overlay-put ovl 'help-echo "Click with mouse-1 to switch to buffer editing this segment")
+       (overlay-put ovl 'face 'secondary-selection)
+       (overlay-put ovl
                         'keymap
                         (let ((map (make-sparse-keymap)))
                           (define-key map [mouse-1] 'org-edit-src-continue)
                           map))
-       (org-overlay-put ovl :read-only "Leave me alone")
+       (overlay-put ovl :read-only "Leave me alone")
        (switch-to-buffer buffer)
        (insert code)
        (remove-text-properties (point-min) (point-max)
@@ -399,7 +413,7 @@ the fragment in the Org-mode buffer."
         ((eq org-edit-fixed-width-region-mode 'artist-mode)
          (fundamental-mode)
          (artist-mode 1))
-       (t (funcall org-edit-fixed-width-region-mode)))
+        (t (funcall org-edit-fixed-width-region-mode)))
        (set (make-local-variable 'org-edit-src-force-single-line) nil)
        (set (make-local-variable 'org-edit-src-from-org-mode) org-mode-p)
        (set (make-local-variable 'org-edit-src-picture) t)
@@ -482,7 +496,16 @@ the language, a switch telling if the content should be in a single line."
                        (throw 'exit
                               (list (match-end 0) end
                                     (org-edit-src-get-lang lang)
-                                    single lfmt ind))))))))))))
+                                    single lfmt ind)))))))))
+      (when (org-at-table.el-p)
+       (re-search-backward "^[\t]*[^ \t|\\+]" nil t)
+       (setq beg (1+ (point-at-eol)))
+       (goto-char beg)
+       (or (re-search-forward "^[\t]*[^ \t|\\+]" nil t)
+           (progn (goto-char (point-max)) (newline)))
+       (setq end (point-at-bol))
+       (setq ind (org-edit-src-get-indentation beg))
+       (throw 'exit (list beg end 'table.el nil nil ind))))))
 
 (defun org-edit-src-get-lang (lang)
   "Extract the src language."
@@ -505,7 +528,7 @@ the language, a switch telling if the content should be in a single line."
        (match-string 1 s))))
 
 (defun org-edit-src-get-indentation (pos)
-  "Count leading whitespace characters on line"
+  "Count leading whitespace characters on line."
   (save-match-data
     (goto-char pos)
     (org-get-indentation)))
@@ -513,8 +536,9 @@ the language, a switch telling if the content should be in a single line."
 (defun org-edit-src-exit (&optional context)
   "Exit special edit and protect problematic lines."
   (interactive)
-  (unless org-edit-src-from-org-mode
-    (error "This is not a sub-editing buffer, something is wrong..."))
+  (unless (org-bound-and-true-p org-edit-src-from-org-mode)
+    (error "This is not a sub-editing buffer, something is wrong"))
+  (widen)
   (let* ((beg org-edit-src-beg-marker)
         (end org-edit-src-end-marker)
         (ovl org-edit-src-overlay)
@@ -524,59 +548,70 @@ the language, a switch telling if the content should be in a single line."
         (total-nindent (+ (or org-edit-src-block-indentation 0)
                           org-edit-src-content-indentation))
         (preserve-indentation org-src-preserve-indentation)
+        (allow-write-back-p (org-bound-and-true-p org-edit-src-allow-write-back-p))
         (delta 0) code line col indent)
-    (untabify (point-min) (point-max))
-    (save-excursion
-      (goto-char (point-min))
-      (if (looking-at "[ \t\n]*\n") (replace-match ""))
-      (unless macro
-       (if (re-search-forward "\n[ \t\n]*\\'" nil t) (replace-match ""))))
+    (when allow-write-back-p
+      (unless preserve-indentation (untabify (point-min) (point-max)))
+      (save-excursion
+       (goto-char (point-min))
+       (if (looking-at "[ \t\n]*\n") (replace-match ""))
+       (unless macro
+         (if (re-search-forward "\n[ \t\n]*\\'" nil t) (replace-match "")))))
     (setq line (if (org-bound-and-true-p org-edit-src-force-single-line)
                   1
                 (org-current-line))
          col (current-column))
-    (when single
-      (goto-char (point-min))
-      (if (re-search-forward "\\s-+\\'" nil t) (replace-match ""))
-      (goto-char (point-min))
-      (let ((cnt 0))
-       (while (re-search-forward "\n" nil t)
-         (setq cnt (1+ cnt))
-         (replace-match (if macro "\\n" " ") t t))
-       (when (and macro (> cnt 0))
-         (goto-char (point-max)) (insert "\\n")))
-      (goto-char (point-min))
-      (if (looking-at "\\s-*") (replace-match " ")))
-    (when (org-bound-and-true-p org-edit-src-from-org-mode)
-      (goto-char (point-min))
-      (while (re-search-forward
-             (if (org-mode-p) "^\\(.\\)" "^\\([*]\\|[ \t]*#\\+\\)") nil t)
-       (if (eq (org-current-line) line) (setq delta (1+ delta)))
-       (replace-match ",\\1")))
-    (when (org-bound-and-true-p org-edit-src-picture)
-      (setq preserve-indentation nil)
-      (untabify (point-min) (point-max))
-      (goto-char (point-min))
-      (while (re-search-forward "^" nil t)
-       (replace-match ": ")))
-    (unless (or single preserve-indentation (= total-nindent 0))
-      (setq indent (make-string total-nindent ?\ ))
-      (goto-char (point-min))
-      (while (re-search-forward "^" nil t)
-       (replace-match indent)))
-    (if (org-bound-and-true-p org-edit-src-picture)
-       (setq total-nindent (+ total-nindent 2)))
-    (setq code (buffer-string))
-    (set-buffer-modified-p nil)
+    (when allow-write-back-p
+      (when single
+       (goto-char (point-min))
+       (if (re-search-forward "\\s-+\\'" nil t) (replace-match ""))
+       (goto-char (point-min))
+       (let ((cnt 0))
+         (while (re-search-forward "\n" nil t)
+           (setq cnt (1+ cnt))
+           (replace-match (if macro "\\n" " ") t t))
+         (when (and macro (> cnt 0))
+           (goto-char (point-max)) (insert "\\n")))
+       (goto-char (point-min))
+       (if (looking-at "\\s-*") (replace-match " ")))
+      (when (org-bound-and-true-p org-edit-src-from-org-mode)
+       (goto-char (point-min))
+       (while (re-search-forward
+               (if (org-mode-p) "^\\(.\\)" "^\\([*]\\|[ \t]*#\\+\\)") nil t)
+         (if (eq (org-current-line) line) (setq delta (1+ delta)))
+         (replace-match ",\\1")))
+      (when (org-bound-and-true-p org-edit-src-picture)
+       (setq preserve-indentation nil)
+       (untabify (point-min) (point-max))
+       (goto-char (point-min))
+       (while (re-search-forward "^" nil t)
+         (replace-match ": ")))
+      (unless (or single preserve-indentation (= total-nindent 0))
+       (setq indent (make-string total-nindent ?\ ))
+       (goto-char (point-min))
+       (while (re-search-forward "^" nil t)
+         (replace-match indent)))
+      (if (org-bound-and-true-p org-edit-src-picture)
+         (setq total-nindent (+ total-nindent 2)))
+      (setq code (buffer-string))
+      (set-buffer-modified-p nil))
     (org-src-switch-to-buffer (marker-buffer beg) (or context 'exit))
     (kill-buffer buffer)
     (goto-char beg)
-    (delete-region beg end)
-    (insert code)
-    (goto-char beg)
-    (if single (just-one-space))
-    (org-goto-line (1- (+ (org-current-line) line)))
-    (org-move-to-column (if preserve-indentation col (+ col total-nindent delta)))
+    (when allow-write-back-p
+      (delete-region beg end)
+      (insert code)
+      (goto-char beg)
+      (if single (just-one-space)))
+    (if (memq t (mapcar (lambda (overlay)
+                         (eq (overlay-get overlay 'invisible)
+                             'org-hide-block))
+                       (overlays-at (point))))
+       ;; Block is hidden; put point at start of block
+       (beginning-of-line 0)
+      ;; Block is visible, put point where it was in the code buffer
+      (org-goto-line (1- (+ (org-current-line) line)))
+      (org-move-to-column (if preserve-indentation col (+ col total-nindent delta))))
     (move-marker beg nil)
     (move-marker end nil))
   (unless (eq context 'save)
@@ -601,15 +636,21 @@ the language, a switch telling if the content should be in a single line."
     (message (or msg ""))))
 
 (defun org-src-mode-configure-edit-buffer ()
-  (when org-edit-src-from-org-mode
-    (setq buffer-offer-save t)
-    (setq buffer-file-name
-         (concat (buffer-file-name (marker-buffer org-edit-src-beg-marker))
-                 "[" (buffer-name) "]"))
-    (set (if (featurep 'xemacs) 'write-contents-hooks 'write-contents-functions)
-        '(org-edit-src-save))
+  (when (org-bound-and-true-p org-edit-src-from-org-mode)
     (org-add-hook 'kill-buffer-hook
-                 '(lambda () (org-delete-overlay org-edit-src-overlay)) nil 'local)))
+                 '(lambda () (delete-overlay org-edit-src-overlay)) nil 'local)
+    (if (org-bound-and-true-p org-edit-src-allow-write-back-p)
+       (progn
+         (setq buffer-offer-save t)
+         (setq buffer-file-name
+               (concat (buffer-file-name (marker-buffer org-edit-src-beg-marker))
+                       "[" (buffer-name) "]"))
+         (if (featurep 'xemacs)
+             (progn
+               (make-variable-buffer-local 'write-contents-hooks) ; needed only for 21.4
+               (setq write-contents-hooks '(org-edit-src-save)))
+           (setq write-contents-functions '(org-edit-src-save))))
+      (setq buffer-read-only t))))
 
 (org-add-hook 'org-src-mode-hook 'org-src-mode-configure-edit-buffer)
 
index bedcc9a507408882d946626af9526a05c31665f5..6a7120e0e55f5c9f4d98fc6e8c86cff08068ca30 100644 (file)
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33x
+;; Version: 7.01
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -49,7 +49,7 @@
 (defvar constants-unit-system)
 
 (defcustom orgtbl-optimized (eq org-enable-table-editor 'optimized)
-  "Non-nil means, use the optimized table editor version for `orgtbl-mode'.
+  "Non-nil means use the optimized table editor version for `orgtbl-mode'.
 In the optimized version, the table editor takes over all simple keys that
 normally just insert a character.  In tables, the characters are inserted
 in a way to minimize disturbing the table structure (i.e. in overwrite mode
@@ -142,14 +142,14 @@ alignment to the right border applies."
   :group 'org-table)
 
 (defcustom org-table-automatic-realign t
-  "Non-nil means, automatically re-align table when pressing TAB or RETURN.
+  "Non-nil means automatically re-align table when pressing TAB or RETURN.
 When nil, aligning is only done with \\[org-table-align], or after column
 removal/insertion."
   :group 'org-table-editing
   :type 'boolean)
 
 (defcustom org-table-auto-blank-field t
-  "Non-nil means, automatically blank table field when starting to type into it.
+  "Non-nil means automatically blank table field when starting to type into it.
 This only happens when typing immediately after a field motion
 command (TAB, S-TAB or RET).
 Only relevant when `org-enable-table-editor' is equal to `optimized'."
@@ -157,7 +157,7 @@ Only relevant when `org-enable-table-editor' is equal to `optimized'."
   :type 'boolean)
 
 (defcustom org-table-tab-jumps-over-hlines t
-  "Non-nil means, tab in the last column of a table with jump over a hline.
+  "Non-nil means tab in the last column of a table with jump over a hline.
 If a horizontal separator line is following the current line,
 `org-table-next-field' can either create a new row before that line, or jump
 over the line.  When this option is nil, a new line will be created before
@@ -183,7 +183,7 @@ t:      accept as input and present for editing"
          (const :tag "Convert user input, don't offer during editing" 'from)))
 
 (defcustom org-table-copy-increment t
-  "Non-nil means, increment when copying current field with \\[org-table-copy-down]."
+  "Non-nil means increment when copying current field with \\[org-table-copy-down]."
   :group 'org-table-calculation
   :type 'boolean)
 
@@ -196,7 +196,7 @@ t:      accept as input and present for editing"
     calc-date-format (YYYY "-" MM "-" DD " " Www (" " hh ":" mm))
     calc-display-working-message t
     )
-  "List with Calc mode settings for use in calc-eval for table formulas.
+  "List with Calc mode settings for use in `calc-eval' for table formulas.
 The list must contain alternating symbols (Calc modes variables and values).
 Don't remove any of the default settings, just change the values.  Org-mode
 relies on the variables to be present in the list."
@@ -204,7 +204,7 @@ relies on the variables to be present in the list."
   :type 'plist)
 
 (defcustom org-table-formula-evaluate-inline t
-  "Non-nil means, TAB and RET evaluate a formula in current table field.
+  "Non-nil means TAB and RET evaluate a formula in current table field.
 If the current field starts with an equal sign, it is assumed to be a formula
 which should be evaluated as described in the manual and in the documentation
 string of the command `org-table-eval-formula'.  This feature requires the
@@ -215,7 +215,7 @@ the command \\[org-table-eval-formula]."
   :type 'boolean)
 
 (defcustom org-table-formula-use-constants t
-  "Non-nil means, interpret constants in formulas in tables.
+  "Non-nil means interpret constants in formulas in tables.
 A constant looks like `$c' or `$Grav' and will be replaced before evaluation
 by the value given in `org-table-formula-constants', or by a value obtained
 from the `constants.el' package."
@@ -241,8 +241,8 @@ Constants can also be defined on a per-file basis using a line like
                (string :tag "value"))))
 
 (defcustom org-table-allow-automatic-line-recalculation t
-  "Non-nil means, lines marked with |#| or |*| will be recomputed automatically.
-Automatically means, when TAB or RET or C-c C-c are pressed in the line."
+  "Non-nil means lines marked with |#| or |*| will be recomputed automatically.
+Automatically means when TAB or RET or C-c C-c are pressed in the line."
   :group 'org-table-calculation
   :type 'boolean)
 
@@ -252,7 +252,7 @@ Automatically means, when TAB or RET or C-c C-c are pressed in the line."
   :type 'boolean)
 
 (defcustom org-table-relative-ref-may-cross-hline t
-  "Non-nil means, relative formula references may cross hlines.
+  "Non-nil means relative formula references may cross hlines.
 Here are the allowed values:
 
 nil    Relative references may not cross hlines.  They will reference the
@@ -276,10 +276,11 @@ portability of tables."
   :group 'org-table)
 
 (defcustom org-table-export-default-format "orgtbl-to-tsv"
-  "Default export parameters for org-table-export. These can be
-overridden on for a specific table by setting the TABLE_EXPORT_FORMAT
-property.  See the manual section on orgtbl radio tables for the different
-export transformations and available parameters."
+  "Default export parameters for `org-table-export'.
+These can be overridden for a specific table by setting the
+TABLE_EXPORT_FORMAT property.  See the manual section on orgtbl
+radio tables for the different export transformations and
+available parameters."
   :group 'org-table-import-export
   :type 'string)
 
@@ -290,8 +291,7 @@ export transformations and available parameters."
 (defconst org-table-calculate-mark-regexp "^[ \t]*| *[!$^_#*] *\\(|\\|$\\)"
   "Detects a table line marked for automatic recalculation.")
 (defconst org-table-border-regexp "^[ \t]*[^| \t]"
-  "Searching from within a table (any type) this finds the first line
-outside the table.")
+  "Searching from within a table (any type) this finds the first line outside the table.")
 (defvar org-table-last-highlighted-reference nil)
 (defvar org-table-formula-history nil)
 
@@ -305,11 +305,11 @@ outside the table.")
   "Alist with locations of named fields.")
 
 (defvar org-table-current-line-types nil
-  "Table row types, non-nil only for the duration of a comand.")
+  "Table row types, non-nil only for the duration of a command.")
 (defvar org-table-current-begin-line nil
-  "Table begin line, non-nil only for the duration of a comand.")
+  "Table begin line, non-nil only for the duration of a command.")
 (defvar org-table-current-begin-pos nil
-  "Table begin position, non-nil only for the duration of a comand.")
+  "Table begin position, non-nil only for the duration of a command.")
 (defvar org-table-dlines nil
   "Vector of data line line numbers in the current table.")
 (defvar org-table-hlines nil
@@ -327,6 +327,33 @@ outside the table.")
    "\\(" "@?[-0-9I$&]+" "\\|" "[a-zA-Z]\\{1,2\\}\\([0-9]+\\|&\\)" "\\|" "\\$[a-zA-Z0-9]+" "\\)")
   "Match a range for reference display.")
 
+(defun org-table-colgroup-line-p (line)
+  "Is this a table line colgroup information?"
+  (save-match-data
+    (and (string-match "[<>]\\|&[lg]t;" line)
+        (string-match "\\`[ \t]*|[ \t]*/[ \t]*\\(|[ \t<>0-9|lgt&;]+\\)\\'"
+                      line)
+        (not (delq
+              nil
+              (mapcar
+               (lambda (s)
+                 (not (member s '("" "<" ">" "<>" "&lt;" "&gt;" "&lt;&gt;"))))
+               (org-split-string (match-string 1 line) "[ \t]*|[ \t]*")))))))
+
+(defun org-table-cookie-line-p (line)
+  "Is this a table line with only alignment/width cookies?"
+
+  (save-match-data
+    (and (string-match "[<>]\\|&[lg]t;" line)
+        (or (string-match "\\`[ \t]*|[ \t]*/[ \t]*\\(|[ \t<>0-9|lgt&;]+\\)\\'" line)
+            (string-match "\\(\\`[ \t<>lr0-9|gt&;]+\\'\\)" line))
+        (not (delq nil (mapcar
+                        (lambda (s)
+                          (not (or (equal s "")
+                                   (string-match "\\`<\\([lr]?[0-9]+\\|[lr]\\)>\\'" s)
+                                   (string-match "\\`&lt;\\([lr]?[0-9]+\\|[lr]\\)&gt;\\'" s))))
+                        (org-split-string (match-string 1 line) "[ \t]*|[ \t]*")))))))
+
 (defconst org-table-translate-regexp
   (concat "\\(" "@[-0-9I$]+" "\\|" "[a-zA-Z]\\{1,2\\}\\([0-9]+\\|&\\)" "\\)")
   "Match a reference that needs translation, for reference display.")
@@ -470,7 +497,7 @@ FILE can be the output file name.  If not given, it will be taken from
 a TABLE_EXPORT_FILE property in the current entry or higher up in the
 hierarchy, or the user will be prompted for a file name.
 FORMAT can be an export format, of the same kind as it used when
-orgtbl-mode sends a table in a different format.  The default format can
+`orgtbl-mode' sends a table in a different format.  The default format can
 be found in the variable `org-table-export-default-format', but the function
 first checks if there is an export format specified in a TABLE_EXPORT_FORMAT
 property, locally or anywhere up in the hierarchy."
@@ -567,7 +594,7 @@ This is being used to correctly align a single field after TAB or RET.")
   "List of max width of fields in each column.
 This is being used to correctly align a single field after TAB or RET.")
 (defvar org-table-formula-debug nil
-  "Non-nil means, debug table formulas.
+  "Non-nil means debug table formulas.
 When nil, simply write \"#ERROR\" in corrupted fields.")
 (make-variable-buffer-local 'org-table-formula-debug)
 (defvar org-table-overlay-coordinates nil
@@ -575,6 +602,7 @@ When nil, simply write \"#ERROR\" in corrupted fields.")
 (make-variable-buffer-local 'org-table-overlay-coordinates)
 
 (defvar org-last-recalc-line nil)
+(defvar org-table-do-narrow t)   ; for dynamic scoping
 (defconst org-narrow-column-arrow "=>"
   "Used as display property in narrowed table columns.")
 
@@ -601,7 +629,8 @@ When nil, simply write \"#ERROR\" in corrupted fields.")
                 (make-string sp2 ?\ ) "%%%s%ds" (make-string sp1 ?\ ) "|"))
         (hfmt1 (concat
                 (make-string sp2 ?-) "%s" (make-string sp1 ?-) "+"))
-        emptystrings links dates emph narrow falign falign1 fmax f1 len c e)
+        emptystrings links dates emph raise narrow
+        falign falign1 fmax f1 len c e space)
     (untabify beg end)
     (remove-text-properties beg end '(org-cwidth t org-dwidth t display t))
     ;; Check if we have links or dates
@@ -611,6 +640,9 @@ When nil, simply write \"#ERROR\" in corrupted fields.")
     (setq emph (and org-hide-emphasis-markers
                    (re-search-forward org-emph-re end t)))
     (goto-char beg)
+    (setq raise (and org-use-sub-superscripts
+                   (re-search-forward org-match-substring-regexp end t)))
+    (goto-char beg)
     (setq dates (and org-display-custom-times
                     (re-search-forward org-ts-regexp-both end t)))
     ;; Make sure the link properties are right
@@ -618,10 +650,12 @@ When nil, simply write \"#ERROR\" in corrupted fields.")
     ;; Make sure the date properties are right
     (when dates (goto-char beg) (while (org-activate-dates end)))
     (when emph (goto-char beg) (while (org-do-emphasis-faces end)))
+    (when raise (goto-char beg) (while (org-raise-scripts end)))
 
     ;; Check if we are narrowing any columns
     (goto-char beg)
-    (setq narrow (and org-format-transports-properties-p
+    (setq narrow (and org-table-do-narrow
+                     org-format-transports-properties-p
                      (re-search-forward "<[rl]?[0-9]+>" end t)))
     (goto-char beg)
     (setq falign (re-search-forward "<[rl][0-9]*>" end t))
@@ -660,13 +694,14 @@ When nil, simply write \"#ERROR\" in corrupted fields.")
     (while (< (setq i (1+ i)) maxfields)   ;; Loop over all columns
       (setq column (mapcar (lambda (x) (or (nth i x) "")) fields))
       ;; Check if there is an explicit width specified
+      (setq fmax nil)
       (when (or narrow falign)
        (setq c column fmax nil falign1 nil)
        (while c
          (setq e (pop c))
          (when (and (stringp e) (string-match "^<\\([rl]\\)?\\([0-9]+\\)?>$" e))
            (if (match-end 1) (setq falign1 (match-string 1 e)))
-           (if (match-end 2)
+           (if (and org-table-do-narrow (match-end 2))
                (setq fmax (string-to-number (match-string 2 e)) c nil))))
        ;; Find fields that are wider than fmax, and shorten them
        (when fmax
@@ -685,7 +720,8 @@ When nil, simply write \"#ERROR\" in corrupted fields.")
                                       (list 'display org-narrow-column-arrow)
                                       xx)))))
       ;; Get the maximum width for each column
-      (push (apply 'max 1 (mapcar 'org-string-width column)) lengths)
+      (push (apply 'max (or fmax 1) 1 (mapcar 'org-string-width column))
+           lengths)
       ;; Get the fraction of numbers, to decide about alignment of the column
       (if falign1
          (push (equal (downcase falign1) "r") typenums)
@@ -705,16 +741,22 @@ When nil, simply write \"#ERROR\" in corrupted fields.")
 
     ;; With invisible characters, `format' does not get the field width right
     ;; So we need to make these fields wide by hand.
-    (when (or links emph)
+    (when (or links emph raise)
       (loop for i from 0 upto (1- maxfields) do
            (setq len (nth i lengths))
            (loop for j from 0 upto (1- (length fields)) do
                  (setq c (nthcdr i (car (nthcdr j fields))))
                  (if (and (stringp (car c))
-                          (text-property-any 0 (length (car c)) 'invisible 'org-link (car c))
-;                         (string-match org-bracket-link-regexp (car c))
+                          (or (text-property-any 0 (length (car c))
+                                                 'invisible 'org-link (car c))
+                              (text-property-any 0 (length (car c))
+                                                 'org-dwidth t (car c)))
                           (< (org-string-width (car c)) len))
-                     (setcar c (concat (car c) (make-string (- len (org-string-width (car c))) ?\ )))))))
+                     (progn
+                       (setq space (make-string (- len (org-string-width (car c))) ?\ ))
+                       (setcar c (if (nth i typenums)
+                                     (concat space (car c))
+                                   (concat (car c) space))))))))
 
     ;; Compute the formats needed for output of the table
     (setq rfmt (concat indent "|") hfmt (concat indent "|"))
@@ -760,14 +802,6 @@ When nil, simply write \"#ERROR\" in corrupted fields.")
     (setq org-table-may-need-update nil)
     ))
 
-
-
-
-
-
-
-
-
 (defun org-table-begin (&optional table-type)
   "Find the beginning of the table and return its position.
 With argument TABLE-TYPE, go to the beginning of a table.el-type table."
@@ -826,6 +860,7 @@ Optional argument NEW may specify text to replace the current field content."
                  (if (<= (length new) l)      ;; FIXME: length -> str-width?
                      (setq n (format f new))
                    (setq n (concat new "|") org-table-may-need-update t)))
+             (if (equal (string-to-char n) ?-) (setq n (concat " " n)))
              (or (equal n o)
                  (let (org-table-may-need-update)
                    (replace-match n t t))))
@@ -1003,6 +1038,47 @@ This actually throws an error, so it aborts the current command."
 (defvar org-table-clip nil
   "Clipboard for table regions.")
 
+(defun org-table-get (line column)
+  "Get the field in table line LINE, column COLUMN.
+If LINE is larger than the number of data lines in the table, the function
+returns nil.  However, if COLUMN is too large, we will simply return an
+empty string.
+If LINE is nil, use the current line.
+If column is nil, use the current column."
+  (setq column (or column (org-table-current-column)))
+  (save-excursion
+    (and (or (not line) (org-table-goto-line line))
+        (org-trim (org-table-get-field column)))))
+
+(defun org-table-put (line column value &optional align)
+  "Put VALUE into line LINE, column COLUMN.
+When ALIGN is set, also realign the table."
+  (setq column (or column (org-table-current-column)))
+  (prog1 (save-excursion
+          (and (or (not line) (org-table-goto-line line))
+               (progn (org-table-goto-column column nil 'force) t)
+               (org-table-get-field column value)))
+    (and align (org-table-align))))
+
+(defun org-table-current-line ()
+  "Return the index of the current data line."
+  (let ((pos (point)) (end (org-table-end)) (cnt 0))
+    (save-excursion
+      (goto-char (org-table-begin))
+      (while (and (re-search-forward org-table-dataline-regexp end t)
+                 (setq cnt (1+ cnt))
+                 (< (point-at-eol) pos))))
+    cnt))
+
+(defun org-table-goto-line (N)
+  "Go to the Nth data line in the current table.
+Return t when the line exists, nil if it does not exist."
+  (goto-char (org-table-begin))
+  (let ((end (org-table-end)) (cnt 0))
+    (while (and (re-search-forward org-table-dataline-regexp end t)
+               (< (setq cnt (1+ cnt)) N)))
+    (= cnt N)))
+
 (defun org-table-blank-field ()
   "Blank the current table field or active region."
   (interactive)
@@ -1083,7 +1159,7 @@ is always the old value."
 
 (defun org-table-current-dline ()
   "Find out what table data line we are in.
-Only datalines count for this."
+Only data lines count for this."
   (interactive)
   (if (interactive-p) (org-table-check-inside-data-field))
   (save-excursion
@@ -1102,22 +1178,20 @@ of the field.
 If there are less than N fields, just go to after the last delimiter.
 However, when FORCE is non-nil, create new columns if necessary."
   (interactive "p")
-  (let ((pos (point-at-eol)))
-    (beginning-of-line 1)
-    (when (> n 0)
-      (while (and (> (setq n (1- n)) -1)
-                 (or (search-forward "|" pos t)
-                     (and force
-                          (progn (end-of-line 1)
-                                 (skip-chars-backward "^|")
-                                 (insert " | "))))))
-;                                  (backward-char 2) t)))))
-      (when (and force (not (looking-at ".*|")))
-       (save-excursion (end-of-line 1) (insert " | ")))
-      (if on-delim
-         (backward-char 1)
-       (if (looking-at " ") (forward-char 1))))))
-
+  (beginning-of-line 1)
+  (when (> n 0)
+    (while (and (> (setq n (1- n)) -1)
+               (or (search-forward "|" (point-at-eol) t)
+                   (and force
+                        (progn (end-of-line 1)
+                               (skip-chars-backward "^|")
+                               (insert " | ")
+                               t)))))
+    (when (and force (not (looking-at ".*|")))
+      (save-excursion (end-of-line 1) (insert " | ")))
+    (if on-delim
+       (backward-char 1)
+      (if (looking-at " ") (forward-char 1)))))
 
 (defun org-table-insert-column ()
   "Insert a new column into the table."
@@ -1146,7 +1220,7 @@ However, when FORCE is non-nil, create new columns if necessary."
     (org-table-fix-formulas "$LR" nil (1- col) 1)))
 
 (defun org-table-find-dataline ()
-  "Find a dataline in the current table, which is needed for column commands."
+  "Find a data line in the current table, which is needed for column commands."
   (if (and (org-at-table-p)
           (not (org-at-table-hline-p)))
       t
@@ -1686,23 +1760,6 @@ the table and kill the editing buffer."
     (org-table-align)
     (message "New field value inserted")))
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 (defvar org-timecnt) ; dynamically scoped parameter
 
 (defun org-table-sum (&optional beg end nlast)
@@ -1787,7 +1844,7 @@ If NLAST is a number, only the NLAST fields will actually be summed."
   "Return the formula active for the current field.
 Assumes that specials are in place.
 If KEY is given, return the key to this formula.
-Otherwise return the formula preceeded with \"=\" or \":=\"."
+Otherwise return the formula preceded with \"=\" or \":=\"."
   (let* ((name (car (rassoc (list (org-current-line)
                                  (org-table-current-column))
                            org-table-named-field-locations)))
@@ -2243,6 +2300,20 @@ not overwrite the stored one."
        (setq form (copy-sequence formula)
              lispp (and (> (length form) 2)(equal (substring form 0 2) "'(")))
        (if (and lispp literal) (setq lispp 'literal))
+
+       ;; Insert row and column number of formula result field
+       (while (string-match "[@$]#" form)
+         (setq form
+               (replace-match
+                (format "%d"
+                        (save-match-data
+                          (if (equal (substring form (match-beginning 0)
+                                                (1+ (match-beginning 0)))
+                                     "@")
+                              (org-table-current-dline)
+                            (org-table-current-column))))
+                t t form)))
+
        ;; Check for old vertical references
        (setq form (org-table-rewrite-old-row-references form))
        ;; Insert remote references
@@ -2315,7 +2386,7 @@ $1->    %s\n" orig formula form0 form))
          (org-fit-window-to-buffer bw)
          (unless (and (interactive-p) (not ndown))
            (unless (let (inhibit-redisplay)
-                     (y-or-n-p "Debugging Formula. Continue to next? "))
+                     (y-or-n-p "Debugging Formula.  Continue to next? "))
              (org-table-align)
              (error "Abort"))
            (delete-window bw)
@@ -2340,7 +2411,7 @@ $1->    %s\n" orig formula form0 form))
   "Get a calc vector from a column, according to descriptor DESC.
 Optional arguments TBEG and COL can give the beginning of the table and
 the current column, to avoid unnecessary parsing.
-HIGHLIGHT means, just highlight the range."
+HIGHLIGHT means just highlight the range."
   (if (not (equal (string-to-char desc) ?@))
       (setq desc (concat "@" desc)))
   (save-excursion
@@ -2412,7 +2483,7 @@ and TABLE is a vector with line types."
         ;;                     1  2          3           4  5          6
         (and (not (match-end 3)) (not (match-end 6)))
         (and (match-end 3) (match-end 6) (not (match-end 5))))
-       (error "invalid row descriptor `%s'" desc))
+       (error "Invalid row descriptor `%s'" desc))
     (let* ((hdir (and (match-end 2) (match-string 2 desc)))
           (hn (if (match-end 3) (- (match-end 3) (match-beginning 3)) nil))
           (odir (and (match-end 5) (match-string 5 desc)))
@@ -2426,7 +2497,7 @@ and TABLE is a vector with line types."
            (setq i 0 hdir "+")
            (if (eq (aref table 0) 'hline) (setq hn (1- hn)))))
       (if (and (not hn) on (not odir))
-         (error "should never happen");;(aref org-table-dlines on)
+         (error "Should never happen");;(aref org-table-dlines on)
        (if (and hn (> hn 0))
            (setq i (org-table-find-row-type table i 'hline (equal hdir "-")
                                             nil hn cline desc)))
@@ -2497,7 +2568,8 @@ LISPP means to return something appropriate for a Lisp list."
 (defun org-table-recalculate (&optional all noalign)
   "Recalculate the current table line by applying all stored formulas.
 With prefix arg ALL, do this for all lines in the table.
-With the prefix argument ALL is `(16)' (a double `C-c C-u' prefix), or if
+With the prefix argument ALL is `(16)' \
+\(a double \\[universal-prefix] \\[universal-prefix] prefix), or if
 it is the symbol `iterate', recompute the table until it no longer changes.
 If NOALIGN is not nil, do not re-align the table after the computations
 are done.  This is typically used internally to save time, if it is
@@ -2625,6 +2697,36 @@ known that the table will be realigned a little later anyway."
          (throw 'exit t)))
       (error "No convergence after %d iterations" i))))
 
+(defun org-table-recalculate-buffer-tables ()
+  "Recalculate all tables in the current buffer."
+  (interactive)
+  (save-excursion
+    (save-restriction
+      (widen)
+      (org-table-map-tables (lambda () (org-table-recalculate t)) t))))
+
+(defun org-table-iterate-buffer-tables ()
+  "Iterate all tables in the buffer, to converge inter-table dependencies."
+ (interactive)
+ (let* ((imax 10)
+        (checksum (md5 (buffer-string)))
+
+        c1
+        (i imax))
+   (save-excursion
+     (save-restriction
+       (widen)
+       (catch 'exit
+        (while (> i 0)
+          (setq i (1- i))
+          (org-table-map-tables (lambda () (org-table-recalculate t)) t)
+          (if (equal checksum (setq c1 (md5 (buffer-string))))
+              (progn
+                (message "Convergence after %d iterations" (- imax i))
+                (throw 'exit t))
+            (setq checksum c1)))
+        (error "No convergence after %d iterations" imax))))))
+
 (defun org-table-formula-substitute-names (f)
   "Replace $const with values in string F."
   (let ((start 0) a (f1 f) (pp (/= (string-to-char f) ?')))
@@ -2663,6 +2765,7 @@ Parameters get priority."
     (org-defkey map "\C-x\C-s"      'org-table-fedit-finish)
     (org-defkey map "\C-c\C-s"      'org-table-fedit-finish)
     (org-defkey map "\C-c\C-c"      'org-table-fedit-finish)
+    (org-defkey map "\C-c'"         'org-table-fedit-finish)
     (org-defkey map "\C-c\C-q"      'org-table-fedit-abort)
     (org-defkey map "\C-c?"        'org-table-show-reference)
     (org-defkey map [(meta shift up)]    'org-table-fedit-line-up)
@@ -2759,7 +2862,7 @@ Parameters get priority."
     (if (eq org-table-use-standard-references t)
        (org-table-fedit-toggle-ref-type))
     (org-goto-line startline)
-    (message "Edit formulas and finish with `C-c C-c'.  See menu for more commands.")))
+    (message "Edit formulas, finish with `C-c C-c' or `C-c ' '.  See menu for more commands.")))
 
 (defun org-table-fedit-post-command ()
   (when (not (memq this-command '(lisp-complete-symbol)))
@@ -2797,6 +2900,12 @@ full TBLFM line."
             (not (equal ?. (aref s (max (- (match-beginning 0) 2) 0)))))
        ;; 3.e5 or something like this.
        (setq start (match-end 0)))
+       ((or (> (- (match-end 1) (match-beginning 1)) 2)
+           ;; (member (match-string 1 s)
+           ;;      '("arctan" "exp" "expm" "lnp" "log" "stir"))
+           )
+       ;; function name, just advance
+       (setq start (match-end 0)))
        (t
        (setq start (match-beginning 0)
              s (replace-match
@@ -2901,7 +3010,7 @@ For example:  28 -> AB."
       (org-rematch-and-replace 5 (eq dir 'left))))))
 
 (defun org-rematch-and-replace (n &optional decr hline)
-  "Re-match the group N, and replace it with the shifted refrence."
+  "Re-match the group N, and replace it with the shifted reference."
   (or (match-end n) (error "Cannot shift reference in this direction"))
   (goto-char (match-beginning n))
   (and (looking-at (regexp-quote (match-string n)))
@@ -2909,7 +3018,7 @@ For example:  28 -> AB."
                      t t)))
 
 (defun org-table-shift-refpart (ref &optional decr hline)
-  "Shift a refrence part REF.
+  "Shift a reference part REF.
 If DECR is set, decrease the references row/column, else increase.
 If HLINE is set, this may be a hline reference, it certainly is not
 a translation reference."
@@ -2977,7 +3086,7 @@ With prefix ARG, apply the new formulas to the table."
     (select-window sel-win)
     (goto-char pos)
     (unless (org-at-table-p)
-      (error "Lost table position - cannot install formulae"))
+      (error "Lost table position - cannot install formulas"))
     (org-table-store-formulas eql)
     (move-marker pos nil)
     (kill-buffer "*Edit Formulas*")
@@ -3219,8 +3328,8 @@ Use COMMAND to do the motion, repeat if necessary to end up in a data line."
 
 (defun org-table-add-rectangle-overlay (beg end &optional face)
   "Add a new overlay."
-  (let ((ov (org-make-overlay beg end)))
-    (org-overlay-put ov 'face (or face 'secondary-selection))
+  (let ((ov (make-overlay beg end)))
+    (overlay-put ov 'face (or face 'secondary-selection))
     (push ov org-table-rectangle-overlays)))
 
 (defun org-table-highlight-rectangle (&optional beg end face)
@@ -3255,7 +3364,7 @@ Use COMMAND to do the motion, repeat if necessary to end up in a data line."
   "Remove the rectangle overlays."
   (unless org-inhibit-highlight-removal
     (remove-hook 'before-change-functions 'org-table-remove-rectangle-highlight)
-    (mapc 'org-delete-overlay org-table-rectangle-overlays)
+    (mapc 'delete-overlay org-table-rectangle-overlays)
     (setq org-table-rectangle-overlays nil)))
 
 (defvar org-table-coordinate-overlays nil
@@ -3265,14 +3374,14 @@ Use COMMAND to do the motion, repeat if necessary to end up in a data line."
 (defun org-table-overlay-coordinates ()
   "Add overlays to the table at point, to show row/column coordinates."
   (interactive)
-  (mapc 'org-delete-overlay org-table-coordinate-overlays)
+  (mapc 'delete-overlay org-table-coordinate-overlays)
   (setq org-table-coordinate-overlays nil)
   (save-excursion
     (let ((id 0) (ih 0) hline eol s1 s2 str ic ov beg)
       (goto-char (org-table-begin))
       (while (org-at-table-p)
        (setq eol (point-at-eol))
-       (setq ov (org-make-overlay (point-at-bol) (1+ (point-at-bol))))
+       (setq ov (make-overlay (point-at-bol) (1+ (point-at-bol))))
        (push ov org-table-coordinate-overlays)
        (setq hline (looking-at org-table-hline-regexp))
        (setq str (if hline (format "I*%-2d" (setq ih (1+ ih)))
@@ -3286,7 +3395,7 @@ Use COMMAND to do the motion, repeat if necessary to end up in a data line."
                  s1 (concat "$" (int-to-string ic))
                  s2 (org-number-to-letters ic)
                  str (if (eq org-table-use-standard-references t) s2 s1))
-           (setq ov (org-make-overlay beg (+ beg (length str))))
+           (setq ov (make-overlay beg (+ beg (length str))))
            (push ov org-table-coordinate-overlays)
            (org-overlay-display ov str 'org-special-keyword 'evaporate)))
        (beginning-of-line 2)))))
@@ -3300,7 +3409,7 @@ Use COMMAND to do the motion, repeat if necessary to end up in a data line."
   (if (and (org-at-table-p) org-table-overlay-coordinates)
       (org-table-align))
   (unless org-table-overlay-coordinates
-    (mapc 'org-delete-overlay org-table-coordinate-overlays)
+    (mapc 'delete-overlay org-table-coordinate-overlays)
     (setq org-table-coordinate-overlays nil)))
 
 (defun org-table-toggle-formula-debugger ()
@@ -3338,10 +3447,6 @@ Use COMMAND to do the motion, repeat if necessary to end up in a data line."
 ;; active, this binding is ignored inside tables and replaced with a
 ;; modified self-insert.
 
-(defvar orgtbl-mode nil
-  "Variable controlling `orgtbl-mode', a minor mode enabling the `org-mode'
-table editor in arbitrary modes.")
-(make-variable-buffer-local 'orgtbl-mode)
 
 (defvar orgtbl-mode-map (make-keymap)
   "Keymap for `orgtbl-mode'.")
@@ -3352,7 +3457,7 @@ table editor in arbitrary modes.")
   (orgtbl-mode 1))
 
 (defvar org-old-auto-fill-inhibit-regexp nil
-  "Local variable used by `orgtbl-mode'")
+  "Local variable used by `orgtbl-mode'.")
 
 (defconst orgtbl-line-start-regexp
   "[ \t]*\\(|\\|#\\+\\(TBLFM\\|ORGTBL\\|TBLNAME\\):\\)"
@@ -3361,51 +3466,54 @@ table editor in arbitrary modes.")
 (defconst orgtbl-extra-font-lock-keywords
   (list (list (concat "^" orgtbl-line-start-regexp ".*")
              0 (quote 'org-table) 'prepend))
-  "Extra font-lock-keywords to be added when orgtbl-mode is active.")
+  "Extra `font-lock-keywords' to be added when `orgtbl-mode' is active.")
+
+;; Install it as a minor mode.
+(put 'orgtbl-mode :included t)
+(put 'orgtbl-mode :menu-tag "Org Table Mode")
 
 ;;;###autoload
-(defun orgtbl-mode (&optional arg)
+(define-minor-mode orgtbl-mode
   "The `org-mode' table editor as a minor mode for use in other modes."
-  (interactive)
+  :lighter " OrgTbl" :keymap orgtbl-mode-map
   (org-load-modules-maybe)
-  (if (org-mode-p)
-      ;; Exit without error, in case some hook functions calls this
-      ;; by accident in org-mode.
-      (message "Orgtbl-mode is not useful in org-mode, command ignored")
-    (setq orgtbl-mode
-         (if arg (> (prefix-numeric-value arg) 0) (not orgtbl-mode)))
-    (if orgtbl-mode
-       (progn
-         (and (orgtbl-setup) (defun orgtbl-setup () nil))
-         ;; Make sure we are first in minor-mode-map-alist
-         (let ((c (assq 'orgtbl-mode minor-mode-map-alist)))
-           (and c (setq minor-mode-map-alist
-                        (cons c (delq c minor-mode-map-alist)))))
-         (org-set-local (quote org-table-may-need-update) t)
-         (org-add-hook 'before-change-functions 'org-before-change-function
-                       nil 'local)
-         (org-set-local 'org-old-auto-fill-inhibit-regexp
-                        auto-fill-inhibit-regexp)
-         (org-set-local 'auto-fill-inhibit-regexp
-                        (if auto-fill-inhibit-regexp
-                            (concat orgtbl-line-start-regexp "\\|"
-                                    auto-fill-inhibit-regexp)
-                          orgtbl-line-start-regexp))
-         (org-add-to-invisibility-spec '(org-cwidth))
-         (when (fboundp 'font-lock-add-keywords)
-           (font-lock-add-keywords nil orgtbl-extra-font-lock-keywords)
-           (org-restart-font-lock))
-         (easy-menu-add orgtbl-mode-menu)
-         (run-hooks 'orgtbl-mode-hook))
-      (setq auto-fill-inhibit-regexp org-old-auto-fill-inhibit-regexp)
-      (org-table-cleanup-narrow-column-properties)
-      (org-remove-from-invisibility-spec '(org-cwidth))
-      (remove-hook 'before-change-functions 'org-before-change-function t)
-      (when (fboundp 'font-lock-remove-keywords)
-       (font-lock-remove-keywords nil orgtbl-extra-font-lock-keywords)
-       (org-restart-font-lock))
-      (easy-menu-remove orgtbl-mode-menu)
-      (force-mode-line-update 'all))))
+  (cond
+   ((org-mode-p)
+    ;; Exit without error, in case some hook functions calls this
+    ;; by accident in org-mode.
+    (message "Orgtbl-mode is not useful in org-mode, command ignored"))
+   (orgtbl-mode
+    (and (orgtbl-setup) (defun orgtbl-setup () nil)) ;; FIXME: Yuck!?!
+    ;; Make sure we are first in minor-mode-map-alist
+    (let ((c (assq 'orgtbl-mode minor-mode-map-alist)))
+      ;; FIXME: maybe it should use emulation-mode-map-alists?
+      (and c (setq minor-mode-map-alist
+                   (cons c (delq c minor-mode-map-alist)))))
+    (org-set-local (quote org-table-may-need-update) t)
+    (org-add-hook 'before-change-functions 'org-before-change-function
+                  nil 'local)
+    (org-set-local 'org-old-auto-fill-inhibit-regexp
+                   auto-fill-inhibit-regexp)
+    (org-set-local 'auto-fill-inhibit-regexp
+                   (if auto-fill-inhibit-regexp
+                       (concat orgtbl-line-start-regexp "\\|"
+                               auto-fill-inhibit-regexp)
+                     orgtbl-line-start-regexp))
+    (add-to-invisibility-spec '(org-cwidth))
+    (when (fboundp 'font-lock-add-keywords)
+      (font-lock-add-keywords nil orgtbl-extra-font-lock-keywords)
+      (org-restart-font-lock))
+    (easy-menu-add orgtbl-mode-menu))
+   (t
+    (setq auto-fill-inhibit-regexp org-old-auto-fill-inhibit-regexp)
+    (org-table-cleanup-narrow-column-properties)
+    (org-remove-from-invisibility-spec '(org-cwidth))
+    (remove-hook 'before-change-functions 'org-before-change-function t)
+    (when (fboundp 'font-lock-remove-keywords)
+      (font-lock-remove-keywords nil orgtbl-extra-font-lock-keywords)
+      (org-restart-font-lock))
+    (easy-menu-remove orgtbl-mode-menu)
+    (force-mode-line-update 'all))))
 
 (defun org-table-cleanup-narrow-column-properties ()
   "Remove all properties related to narrow-column invisibility."
@@ -3420,11 +3528,6 @@ table editor in arbitrary modes.")
     (while (setq s (text-property-any s (point-max) 'invisible 'org-cwidth))
       (remove-text-properties s (1+ s) '(invisible t)))))
 
-;; Install it as a minor mode.
-(put 'orgtbl-mode :included t)
-(put 'orgtbl-mode :menu-tag "Org Table Mode")
-(add-minor-mode 'orgtbl-mode " OrgTbl" orgtbl-mode-map)
-
 (defun orgtbl-make-binding (fun n &rest keys)
   "Create a function for binding in the table minor mode.
 FUN is the command to call inside a table.  N is used to create a unique
@@ -3459,34 +3562,33 @@ to execute outside of tables."
   "Setup orgtbl keymaps."
   (let ((nfunc 0)
        (bindings
-        (list
-         '([(meta shift left)]  org-table-delete-column)
-         '([(meta left)]        org-table-move-column-left)
-         '([(meta right)]       org-table-move-column-right)
-         '([(meta shift right)] org-table-insert-column)
-         '([(meta shift up)]    org-table-kill-row)
-         '([(meta shift down)]  org-table-insert-row)
-         '([(meta up)]          org-table-move-row-up)
-         '([(meta down)]        org-table-move-row-down)
-         '("\C-c\C-w"           org-table-cut-region)
-         '("\C-c\M-w"           org-table-copy-region)
-         '("\C-c\C-y"           org-table-paste-rectangle)
-         '("\C-c-"              org-table-insert-hline)
-         '("\C-c}"              org-table-toggle-coordinate-overlays)
-         '("\C-c{"              org-table-toggle-formula-debugger)
-         '("\C-m"               org-table-next-row)
-         '([(shift return)]     org-table-copy-down)
-         '("\C-c?"              org-table-field-info)
-         '("\C-c "              org-table-blank-field)
-         '("\C-c+"              org-table-sum)
-         '("\C-c="              org-table-eval-formula)
-         '("\C-c'"              org-table-edit-formulas)
-         '("\C-c`"              org-table-edit-field)
-         '("\C-c*"              org-table-recalculate)
-         '("\C-c^"              org-table-sort-lines)
-         '("\M-a"               org-table-beginning-of-field)
-         '("\M-e"               org-table-end-of-field)
-         '([(control ?#)]       org-table-rotate-recalc-marks)))
+        '(([(meta shift left)]  org-table-delete-column)
+          ([(meta left)]        org-table-move-column-left)
+          ([(meta right)]       org-table-move-column-right)
+          ([(meta shift right)] org-table-insert-column)
+          ([(meta shift up)]    org-table-kill-row)
+          ([(meta shift down)]  org-table-insert-row)
+          ([(meta up)]          org-table-move-row-up)
+          ([(meta down)]        org-table-move-row-down)
+          ("\C-c\C-w"           org-table-cut-region)
+          ("\C-c\M-w"           org-table-copy-region)
+          ("\C-c\C-y"           org-table-paste-rectangle)
+          ("\C-c-"              org-table-insert-hline)
+          ("\C-c}"              org-table-toggle-coordinate-overlays)
+          ("\C-c{"              org-table-toggle-formula-debugger)
+          ("\C-m"               org-table-next-row)
+          ([(shift return)]     org-table-copy-down)
+          ("\C-c?"              org-table-field-info)
+          ("\C-c "              org-table-blank-field)
+          ("\C-c+"              org-table-sum)
+          ("\C-c="              org-table-eval-formula)
+          ("\C-c'"              org-table-edit-formulas)
+          ("\C-c`"              org-table-edit-field)
+          ("\C-c*"              org-table-recalculate)
+          ("\C-c^"              org-table-sort-lines)
+          ("\M-a"               org-table-beginning-of-field)
+          ("\M-e"               org-table-end-of-field)
+          ([(control ?#)]       org-table-rotate-recalc-marks)))
        elt key fun cmd)
     (while (setq elt (pop bindings))
       (setq nfunc (1+ nfunc))
@@ -3731,13 +3833,13 @@ overwritten, and the table is not marked as requiring realignment."
     (funcall func table nil)))
 
 (defun orgtbl-gather-send-defs ()
-  "Gathers a plist of :name, :transform, :params for each destination before
+  "Gather a plist of :name, :transform, :params for each destination before
 a radio table."
   (save-excursion
     (goto-char (org-table-begin))
     (let (rtn)
       (beginning-of-line 0)
-      (while (looking-at "[ \t]*#\\+ORGTBL[: \t][ \t]*SEND +\\([a-zA-Z0-9_]+\\) +\\([^ \t\r\n]+\\)\\( +.*\\)?")
+      (while (looking-at "[ \t]*#\\+ORGTBL[: \t][ \t]*SEND[ \t]+\\([^ \t\r\n]+\\)[ \t]+\\([^ \t\r\n]+\\)\\([ \t]+.*\\)?")
        (let ((name (org-no-properties (match-string 1)))
              (transform (intern (match-string 2)))
              (params (if (match-end 3)
@@ -3888,17 +3990,17 @@ First element has index 0, or I0 if given."
 (defvar *orgtbl-rtn* nil
   "Formatting routines push the output lines here.")
 ;; Formatting parameters for the current table section.
-(defvar *orgtbl-hline* nil "Text used for horizontal lines")
-(defvar *orgtbl-sep* nil "Text used as a column separator")
-(defvar *orgtbl-default-fmt* nil "Default format for each entry")
-(defvar *orgtbl-fmt* nil "Format for each entry")
-(defvar *orgtbl-efmt* nil "Format for numbers")
-(defvar *orgtbl-lfmt* nil "Format for an entire line, overrides fmt")
-(defvar *orgtbl-llfmt* nil "Specializes lfmt for the last row")
-(defvar *orgtbl-lstart* nil "Text starting a row")
-(defvar *orgtbl-llstart* nil "Specializes lstart for the last row")
-(defvar *orgtbl-lend* nil "Text ending a row")
-(defvar *orgtbl-llend* nil "Specializes lend for the last row")
+(defvar *orgtbl-hline* nil "Text used for horizontal lines.")
+(defvar *orgtbl-sep* nil "Text used as a column separator.")
+(defvar *orgtbl-default-fmt* nil "Default format for each entry.")
+(defvar *orgtbl-fmt* nil "Format for each entry.")
+(defvar *orgtbl-efmt* nil "Format for numbers.")
+(defvar *orgtbl-lfmt* nil "Format for an entire line, overrides fmt.")
+(defvar *orgtbl-llfmt* nil "Specializes lfmt for the last row.")
+(defvar *orgtbl-lstart* nil "Text starting a row.")
+(defvar *orgtbl-llstart* nil "Specializes lstart for the last row.")
+(defvar *orgtbl-lend* nil "Text ending a row.")
+(defvar *orgtbl-llend* nil "Specializes lend for the last row.")
 
 (defsubst orgtbl-get-fmt (fmt i)
   "Retrieve the format from FMT corresponding to the Ith column."
@@ -4018,6 +4120,7 @@ directly by `orgtbl-send-table'.  See manual."
   (let* ((splicep (plist-get params :splice))
         (hline (plist-get params :hline))
         (remove-nil-linesp (plist-get params :remove-nil-lines))
+        (remove-newlines (plist-get params :remove-newlines))
         (*orgtbl-hline* hline)
         (*orgtbl-table* table)
         (*orgtbl-sep* (plist-get params :sep))
@@ -4072,9 +4175,13 @@ directly by `orgtbl-send-table'.  See manual."
        (let ((tend (orgtbl-eval-str (plist-get params :tend))))
          (if tend (push tend *orgtbl-rtn*)))))
 
-    (mapconcat 'identity (nreverse (if remove-nil-linesp
-                                      (remq nil *orgtbl-rtn*)
-                                    *orgtbl-rtn*)) "\n")))
+    (mapconcat (if remove-newlines
+                  (lambda (tend)
+                    (replace-regexp-in-string "[\n\r\t\f]" "\\\\n" tend))
+                'identity)
+              (nreverse (if remove-nil-linesp
+                            (remq nil *orgtbl-rtn*)
+                          *orgtbl-rtn*)) "\n")))
 
 (defun orgtbl-to-tsv (table params)
   "Convert the orgtbl-mode table to TAB separated material."
@@ -4125,7 +4232,7 @@ this function is called."
     (orgtbl-to-generic table (org-combine-plists params2 params))))
 
 (defun orgtbl-to-html (table params)
-  "Convert the orgtbl-mode TABLE to LaTeX.
+  "Convert the orgtbl-mode TABLE to HTML.
 TABLE is a list, each entry either the symbol `hline' for a horizontal
 separator line, or a list of fields for that line.
 PARAMS is a property list of parameters that can influence the conversion.
@@ -4200,6 +4307,7 @@ and :tend suppress strings without splicing; they can be set to
 provide ORGTBL directives for the generated table."
   (let* ((params2
          (list
+          :remove-newlines t
           :tstart nil :tend nil
           :hline "|---"
           :sep " | "
@@ -4247,23 +4355,23 @@ list of the fields in the rectangle ."
              (setq buffer (marker-buffer id-loc)
                    loc (marker-position id-loc))
              (move-marker id-loc nil)))
-         (switch-to-buffer buffer)
-         (save-excursion
-           (save-restriction
-             (widen)
-             (goto-char loc)
-             (forward-char 1)
-             (unless (and (re-search-forward "^\\(\\*+ \\)\\|[ \t]*|" nil t)
-                          (not (match-beginning 1)))
-               (error "Cannot find a table at NAME or ID %s" name-or-id))
-             (setq tbeg (point-at-bol))
-             (org-table-get-specials)
-             (setq form (org-table-formula-substitute-names form))
-             (if (and (string-match org-table-range-regexp form)
-                      (> (length (match-string 0 form)) 1))
-                 (save-match-data
-                   (org-table-get-range (match-string 0 form) tbeg 1))
-               form))))))))
+         (with-current-buffer buffer
+           (save-excursion
+             (save-restriction
+               (widen)
+               (goto-char loc)
+               (forward-char 1)
+               (unless (and (re-search-forward "^\\(\\*+ \\)\\|[ \t]*|" nil t)
+                            (not (match-beginning 1)))
+                 (error "Cannot find a table at NAME or ID %s" name-or-id))
+               (setq tbeg (point-at-bol))
+               (org-table-get-specials)
+               (setq form (org-table-formula-substitute-names form))
+               (if (and (string-match org-table-range-regexp form)
+                        (> (length (match-string 0 form)) 1))
+                   (save-match-data
+                     (org-table-get-range (match-string 0 form) tbeg 1))
+                 form)))))))))
 
 (provide 'org-table)
 
diff --git a/lisp/org/org-taskjuggler.el b/lisp/org/org-taskjuggler.el
new file mode 100644 (file)
index 0000000..da9e156
--- /dev/null
@@ -0,0 +1,648 @@
+;;; org-taskjuggler.el --- TaskJuggler exporter for org-mode
+;;
+;; Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+;;
+;; Emacs Lisp Archive Entry
+;; Filename: org-taskjuggler.el
+;; Version: 7.01
+;; Author: Christian Egli
+;; Maintainer: Christian Egli
+;; Keywords: org, taskjuggler, project planning
+;; Description: Converts an org-mode buffer into a taskjuggler project plan
+;; URL:
+
+;; 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:
+;;
+;; This library implements a TaskJuggler exporter for org-mode.
+;; TaskJuggler uses a text format to define projects, tasks and
+;; resources, so it is a natural fit for org-mode. It can produce all
+;; sorts of reports for tasks or resources in either HTML, CSV or PDF.
+;; The current version of TaskJuggler requires KDE but the next
+;; version is implemented in Ruby and should therefore run on any
+;; platform.
+;;
+;; The exporter is a bit different from other exporters, such as the
+;; HTML and LaTeX exporters for example, in that it does not export
+;; all the nodes of a document or strictly follow the order of the
+;; nodes in the document.
+;;
+;; Instead the TaskJuggler exporter looks for a tree that defines the
+;; tasks and a optionally tree that defines the resources for this
+;; project. It then creates a TaskJuggler file based on these trees
+;; and the attributes defined in all the nodes.
+;;
+;; * Installation
+;;
+;; Put this file into your load-path and the following line into your
+;; ~/.emacs:
+;;
+;;   (require 'org-taskjuggler)
+;;
+;; The interactive functions are similar to those of the HTML and LaTeX
+;; exporters:
+;;
+;; M-x `org-export-as-taskjuggler'
+;; M-x `org-export-as-taskjuggler-and-open'
+;;
+;; * Tasks
+;;
+;; Let's illustrate the usage with a small example. Create your tasks
+;; as you usually do with org-mode. Assign efforts to each task using
+;; properties (it's easiest to do this in the column view). You should
+;; end up with something similar to the example by Peter Jones in
+;; http://www.contextualdevelopment.com/static/artifacts/articles/2008/project-planning/project-planning.org.
+;; Now mark the top node of your tasks with a tag named
+;; "taskjuggler_project" (or whatever you customized
+;; `org-export-taskjuggler-project-tag' to). You are now ready to
+;; export the project plan with `org-export-as-taskjuggler-and-open'
+;; which will export the project plan and open a gant chart in
+;; TaskJugglerUI.
+;;
+;; * Resources
+;; 
+;; Next you can define resources and assign those to work on specific
+;; tasks. You can group your resources hierarchically. Tag the top
+;; node of the resources with "taskjuggler_resource" (or whatever you
+;; customized `org-export-taskjuggler-resource-tag' to). You can
+;; optionally assign an identifier (named "resource_id") to the
+;; resources (using the standard org properties commands) or you can
+;; let the exporter generate identifiers automatically (the exporter
+;; picks the first word of the headline as the identifier as long as
+;; it is unique, see the documentation of
+;; `org-taskjuggler-get-unique-id'). Using that identifier you can
+;; then allocate resources to tasks. This is again done with the
+;; "allocate" property on the tasks. Do this in column view or when on
+;; the task type
+;;
+;;  C-c C-x p allocate RET <resource_id> RET
+;;
+;; Once the allocations are done you can again export to TaskJuggler
+;; and check in the Resource Allocation Graph which person is working
+;; on what task at what time.
+;;
+;; * Export of properties
+;;
+;; The exporter also takes TODO state information into consideration,
+;; i.e. if a task is marked as done it will have the corresponding
+;; attribute in TaskJuggler ("complete 100"). Also it will export any
+;; property on a task resource or resource node which is known to
+;; TaskJuggler, such as limits, vacation, shift, booking, efficiency,
+;; journalentry, rate for resources or account, start, note, duration,
+;; end, journalentry, milestone, reference, responsible, scheduling,
+;; etc for tasks.
+;;
+;; * Dependencies
+;; 
+;; The exporter will handle dependencies that are defined in the tasks
+;; either with the ORDERED attribute (see TODO dependencies in the Org
+;; mode manual) or with the BLOCKER attribute (see org-depend.el) or
+;; alternatively with a depends attribute. Both the BLOCKER and the
+;; depends attribute can be either "previous-sibling" or a reference
+;; to an identifier (named "task_id") which is defined for another
+;; task in the project. BLOCKER and the depends attribute can define
+;; multiple dependencies separated by either space or comma. You can
+;; also specify optional attributes on the dependency by simply
+;; appending it. The following examples should illustrate this:
+;;
+;; * Training material
+;;   :PROPERTIES:
+;;   :task_id:  training_material
+;;   :ORDERED:  t
+;;   :END:
+;; ** Markup Guidelines
+;;    :PROPERTIES:
+;;    :Effort:   2.0
+;;    :END:
+;; ** Workflow Guidelines
+;;    :PROPERTIES:
+;;    :Effort:   2.0
+;;    :END:
+;; * Presentation
+;;   :PROPERTIES:
+;;   :Effort:   2.0
+;;   :BLOCKER:  training_material { gapduration 1d } some_other_task
+;;   :END:
+;; 
+;;;; * TODO
+;;   - Use SCHEDULED and DEADLINE information (not just start and end
+;;     properties).
+;;   - Look at org-file-properties, org-global-properties and
+;;     org-global-properties-fixed
+;;   - What about property inheritance and org-property-inherit-p?
+;;   - Use TYPE_TODO as an way to assign resources
+;;   - Make sure multiple dependency definitions (i.e. BLOCKER on
+;;     previous-sibling and on a specific task_id) in multiple
+;;     attributes are properly exported.
+;;
+;;; Code:
+
+(eval-when-compile
+  (require 'cl))
+
+(require 'org)
+(require 'org-exp)
+
+;;; User variables:
+
+(defgroup org-export-taskjuggler nil
+  "Options for exporting Org-mode files to TaskJuggler."
+  :tag "Org Export TaskJuggler"
+  :group 'org-export)
+
+(defcustom org-export-taskjuggler-extension ".tjp"
+  "Extension of TaskJuggler files."
+  :group 'org-export-taskjuggler
+  :type 'string)
+
+(defcustom org-export-taskjuggler-project-tag "taskjuggler_project"
+  "Tag, property or todo used to find the tree containing all
+the tasks for the project."
+  :group 'org-export-taskjuggler
+  :type 'string)
+
+(defcustom org-export-taskjuggler-resource-tag "taskjuggler_resource"
+  "Tag, property or todo used to find the tree containing all the
+resources for the project."
+  :group 'org-export-taskjuggler
+  :type 'string)
+
+(defcustom org-export-taskjuggler-default-project-version "1.0"
+  "Default version string for the project."
+  :group 'org-export-taskjuggler
+  :type 'string)
+
+(defcustom org-export-taskjuggler-default-project-duration 280
+  "Default project duration if no start and end date have been defined
+in the root node of the task tree, i.e. the tree that has been marked
+with `org-export-taskjuggler-project-tag'"
+  :group 'org-export-taskjuggler
+  :type 'integer)
+
+(defcustom org-export-taskjuggler-default-reports 
+  '("taskreport \"Gantt Chart\" {
+  headline \"Project Gantt Chart\"
+  columns hierarchindex, name, start, end, effort, duration, completed, chart
+  timeformat \"%Y-%m-%d\"
+  hideresource 1
+  loadunit shortauto
+}"
+"resourcereport \"Resource Graph\" {
+  headline \"Resource Allocation Graph\"
+  columns no, name, utilization, freeload, chart
+  loadunit shortauto
+  sorttasks startup
+  hidetask ~isleaf()
+}")
+  "Default reports for the project."
+  :group 'org-export-taskjuggler
+  :type '(repeat (string :tag "Report")))
+
+(defcustom org-export-taskjuggler-default-global-properties 
+  "shift s40 \"Part time shift\" {
+  workinghours wed, thu, fri off
+}
+"
+  "Default global properties for the project. Here you typically
+define global properties such as shifts, accounts, rates,
+vacation, macros and flags. Any property that is allowed within
+the TaskJuggler file can be inserted. You could for example
+include another TaskJuggler file. 
+
+The global properties are inserted after the project declaration
+but before any resource and task declarations."
+  :group 'org-export-taskjuggler
+  :type '(string :tag "Preamble"))
+
+;;; Hooks
+
+(defvar org-export-taskjuggler-final-hook nil
+  "Hook run at the end of TaskJuggler export, in the new buffer.")
+
+;;; Autoload functions:
+
+;; avoid compiler warning about free variable
+(defvar org-export-taskjuggler-old-level)
+
+;;;###autoload
+(defun org-export-as-taskjuggler ()
+  "Export parts of the current buffer as a TaskJuggler file.
+The exporter looks for a tree with tag, property or todo that
+matches `org-export-taskjuggler-project-tag' and takes this as
+the tasks for this project. The first node of this tree defines
+the project properties such as project name and project period.
+If there is a tree with tag, property or todo that matches
+`org-export-taskjuggler-resource-tag' this three is taken as
+resources for the project. If no resources are specified, a
+default resource is created and allocated to the project. Also
+the taskjuggler project will be created with default reports as
+defined in `org-export-taskjuggler-default-reports'."
+  (interactive)
+
+  (message "Exporting...")
+  (setq-default org-done-keywords org-done-keywords)
+  (let* ((tasks
+         (org-taskjuggler-resolve-dependencies
+          (org-taskjuggler-assign-task-ids 
+           (org-map-entries 
+            '(org-taskjuggler-components) 
+            org-export-taskjuggler-project-tag nil 'archive 'comment))))
+        (resources
+         (org-taskjuggler-assign-resource-ids
+          (org-map-entries 
+           '(org-taskjuggler-components) 
+           org-export-taskjuggler-resource-tag nil 'archive 'comment)))
+        (filename (expand-file-name
+                   (concat
+                    (file-name-sans-extension
+                     (file-name-nondirectory buffer-file-name))
+                    org-export-taskjuggler-extension)))
+        (buffer (find-file-noselect filename))
+        (org-export-taskjuggler-old-level 0)
+        task resource)
+    (unless tasks
+      (error "No tasks specified"))
+    ;; add a default resource
+    (unless resources
+      (setq resources 
+           `((("resource_id" . ,(user-login-name)) 
+              ("headline" . ,user-full-name) 
+              ("level" . 1)))))
+    ;; add a default allocation to the first task if none was given
+    (unless (assoc "allocate" (car tasks))
+      (let ((task (car tasks))
+           (resource-id (cdr (assoc "resource_id" (car resources)))))
+       (setcar tasks (push (cons "allocate" resource-id) task))))
+    ;; add a default start date to the first task if none was given
+    (unless (assoc "start" (car tasks))
+      (let ((task (car tasks))
+           (time-string (format-time-string "%Y-%m-%d")))
+       (setcar tasks (push (cons "start" time-string) task))))
+    ;; add a default version if none was given
+    (unless (assoc "version" (car tasks))
+      (let ((task (car tasks))
+           (version org-export-taskjuggler-default-project-version))
+       (setcar tasks (push (cons "version" version) task))))
+    (with-current-buffer buffer
+      (erase-buffer)
+      (org-taskjuggler-open-project (car tasks))
+      (insert org-export-taskjuggler-default-global-properties)
+      (insert "\n")
+      (dolist (resource resources)
+       (let ((level (cdr (assoc "level" resource))))
+         (org-taskjuggler-close-maybe level)
+         (org-taskjuggler-open-resource resource)
+         (setq org-export-taskjuggler-old-level level)))
+      (org-taskjuggler-close-maybe 1)
+      (setq org-export-taskjuggler-old-level 0)
+      (dolist (task tasks)
+       (let ((level (cdr (assoc "level" task))))
+         (org-taskjuggler-close-maybe level)
+         (org-taskjuggler-open-task task)
+         (setq org-export-taskjuggler-old-level level)))
+      (org-taskjuggler-close-maybe 1)
+      (org-taskjuggler-insert-reports)
+      (save-buffer)
+      (or (org-export-push-to-kill-ring "TaskJuggler")
+         (message "Exporting... done"))
+      (current-buffer))))
+
+;;;###autoload
+(defun org-export-as-taskjuggler-and-open ()
+  "Export the current buffer as a TaskJuggler file and open it
+with the TaskJuggler GUI."
+  (interactive)
+  (let* ((file-name (buffer-file-name (org-export-as-taskjuggler)))
+        (process-name "TaskJugglerUI")
+        (command (concat process-name " " file-name)))
+    (start-process-shell-command process-name nil command)))
+
+(defun org-taskjuggler-parent-is-ordered-p ()
+  "Return true if the parent of the current node has a property
+\"ORDERED\". Return nil otherwise."
+  (save-excursion
+    (and (org-up-heading-safe) (org-entry-get (point) "ORDERED"))))
+
+(defun org-taskjuggler-components ()
+  "Return an alist containing all the pertinent information for
+the current node such as the headline, the level, todo state
+information, all the properties, etc."
+  (let* ((props (org-entry-properties))
+        (components (org-heading-components))
+        (level (nth 1 components))
+        (headline (nth 4 components))
+        (parent-ordered (org-taskjuggler-parent-is-ordered-p)))
+    (push (cons "level" level) props)
+    (push (cons "headline" headline) props)
+    (push (cons "parent-ordered" parent-ordered) props)))
+
+(defun org-taskjuggler-assign-task-ids (tasks)
+  "Given a list of tasks return the same list assigning a unique id
+and the full path to each task. Taskjuggler takes hierarchical ids.
+For that reason we have to make ids locally unique and we have to keep
+a path to the current task."
+  (let ((previous-level 0)
+       unique-ids unique-id
+       path
+       task resolved-tasks tmp)
+    (dolist (task tasks resolved-tasks)
+      (let ((level (cdr (assoc "level" task))))
+       (cond
+        ((< previous-level level) 
+         (setq unique-id (org-taskjuggler-get-unique-id task (car unique-ids)))
+         (dotimes (tmp (- level previous-level))
+           (push (list unique-id) unique-ids)
+           (push unique-id path)))
+        ((= previous-level level) 
+         (setq unique-id (org-taskjuggler-get-unique-id task (car unique-ids)))
+         (push unique-id (car unique-ids))
+         (setcar path unique-id))
+        ((> previous-level level) 
+         (dotimes (tmp (- previous-level level))
+           (pop unique-ids)
+           (pop path))
+         (setq unique-id (org-taskjuggler-get-unique-id task (car unique-ids)))
+         (push unique-id (car unique-ids))
+         (setcar path unique-id)))
+       (push (cons "unique-id" unique-id) task)
+       (push (cons "path" (mapconcat 'identity (reverse path) ".")) task)
+       (setq previous-level level)
+       (setq resolved-tasks (append resolved-tasks (list task)))))))
+
+(defun org-taskjuggler-assign-resource-ids (resources &optional unique-ids)
+  "Given a list of resources return the same list, assigning a
+unique id to each resource."
+  (cond
+   ((null resources) nil)
+   (t 
+    (let* ((resource (car resources))
+          (unique-id (org-taskjuggler-get-unique-id resource unique-ids)))
+      (push (cons "unique-id" unique-id) resource)
+      (cons resource 
+           (org-taskjuggler-assign-resource-ids (cdr resources) 
+                                                (cons unique-id unique-ids)))))))
+
+(defun org-taskjuggler-resolve-dependencies (tasks)
+  (let ((previous-level 0)
+       siblings
+       task resolved-tasks)
+    (dolist (task tasks resolved-tasks)
+      (let* ((level (cdr (assoc "level" task)))
+            (depends (cdr (assoc "depends" task)))
+            (parent-ordered (cdr (assoc "parent-ordered" task)))
+            (blocker (cdr (assoc "BLOCKER" task)))
+            (blocked-on-previous 
+             (and blocker (string-match "previous-sibling" blocker)))
+            (dependencies
+             (org-taskjuggler-resolve-explicit-dependencies
+              (append 
+               (and depends (org-taskjuggler-tokenize-dependencies depends))
+               (and blocker (org-taskjuggler-tokenize-dependencies blocker))) 
+              tasks))
+             previous-sibling)
+       ; update previous sibling info
+       (cond
+        ((< previous-level level) 
+         (dotimes (tmp (- level previous-level))
+           (push task siblings)))
+        ((= previous-level level)
+         (setq previous-sibling (car siblings))
+         (setcar siblings task))
+        ((> previous-level level) 
+         (dotimes (tmp (- previous-level level))
+           (pop siblings))
+         (setq previous-sibling (car siblings))
+         (setcar siblings task)))
+       ; insert a dependency on previous sibling if the parent is
+       ; ordered or if the tasks has a BLOCKER attribute with value "previous-sibling"
+       (when (or (and previous-sibling parent-ordered) blocked-on-previous)
+         (push (format "!%s" (cdr (assoc "unique-id" previous-sibling))) dependencies))
+       ; store dependency information
+       (when dependencies 
+         (push (cons "depends" (mapconcat 'identity dependencies ", ")) task))
+       (setq previous-level level)
+       (setq resolved-tasks (append resolved-tasks (list task)))))))
+
+(defun org-taskjuggler-tokenize-dependencies (dependencies)
+  "Split a dependency property value DEPENDENCIES into the
+individual dependencies and return them as a list while keeping
+the optional arguments (such as gapduration) for the
+dependencies. A dependency will have to match `[-a-zA-Z0-9_]+'."
+  (cond 
+   ((string-match "^ *$" dependencies) nil)
+   ((string-match "^[ \t]*\\([-a-zA-Z0-9_]+\\([ \t]*{[^}]+}\\)?\\)[ \t,]*" dependencies)
+    (cons 
+     (substring dependencies (match-beginning 1) (match-end 1))
+     (org-taskjuggler-tokenize-dependencies (substring dependencies (match-end 0)))))
+   (t (error (format "invalid dependency id %s" dependencies)))))
+
+(defun org-taskjuggler-resolve-explicit-dependencies (dependencies tasks)
+  "For each dependency in DEPENDENCIES try to find a
+corresponding task with a matching property \"task_id\" in TASKS.
+Return a list containing the resolved links for all DEPENDENCIES
+where a matching tasks was found. If the dependency is
+\"previous-sibling\" it is ignored (as this is dealt with in
+`org-taskjuggler-resolve-dependencies'). If there is no matching
+task the dependency is ignored and a warning is displayed ."
+  (unless (null dependencies)
+    (let* 
+       ;; the dependency might have optional attributes such as "{
+       ;; gapduration 5d }", so only use the first string as id for the
+       ;; dependency
+       ((dependency (car dependencies))
+        (id (car (split-string dependency)))
+        (optional-attributes 
+         (mapconcat 'identity (cdr (split-string dependency)) " "))
+        (path (org-taskjuggler-find-task-with-id id tasks)))
+      (cond 
+       ;; ignore previous sibling dependencies
+       ((equal (car dependencies) "previous-sibling")
+       (org-taskjuggler-resolve-explicit-dependencies (cdr dependencies) tasks))
+       ;; if the id is found in another task use its path
+       ((not (null path)) 
+       (cons (mapconcat 'identity (list path optional-attributes) " ")
+             (org-taskjuggler-resolve-explicit-dependencies 
+              (cdr dependencies) tasks)))
+       ;; warn about dangling dependency but otherwise ignore it
+       (t (display-warning 
+          'org-export-taskjuggler 
+          (format "No task with matching property \"task_id\" found for id %s" id))
+         (org-taskjuggler-resolve-explicit-dependencies (cdr dependencies) tasks))))))
+
+(defun org-taskjuggler-find-task-with-id (id tasks)
+  "Find ID in tasks. If found return the path of task. Otherwise
+return nil."
+  (let ((task-id (cdr (assoc "task_id" (car tasks))))
+       (path (cdr (assoc "path" (car tasks)))))
+    (cond 
+     ((null tasks) nil)
+     ((equal task-id id) path)
+     (t (org-taskjuggler-find-task-with-id id (cdr tasks))))))
+
+(defun org-taskjuggler-get-unique-id (item unique-ids)
+  "Return a unique id for an ITEM which can be a task or a resource.
+The id is derived from the headline and made unique against
+UNIQUE-IDS. If the (downcased) first token of the headline is not
+unique try to add more (downcased) tokens of the headline or
+finally add more underscore characters (\"_\")."
+  (let* ((headline (cdr (assoc "headline" item)))
+        (parts (split-string headline))
+        (id (org-taskjuggler-clean-id (downcase (pop parts)))))
+    ; try to add more parts of the headline to make it unique
+    (while (member id unique-ids)
+      (setq id (concat id "_" (org-taskjuggler-clean-id (downcase (pop parts))))))
+    ; if its still not unique add "_"
+    (while (member id unique-ids)
+      (setq id (concat id "_")))
+    id))
+       
+(defun org-taskjuggler-clean-id (id)
+  "Clean and return ID to make it acceptable for taskjuggler."
+  (and id (replace-regexp-in-string "[^a-zA-Z0-9_]" "_" id)))
+
+(defun org-taskjuggler-open-project (project)
+  "Insert the beginning of a project declaration. All valid
+attributes from the PROJECT alist are inserted. If no end date is
+specified it is calculated
+`org-export-taskjuggler-default-project-duration' days from now."
+  (let* ((unique-id (cdr (assoc "unique-id" project)))
+       (headline (cdr (assoc "headline" project)))
+       (version (cdr (assoc "version" project)))
+       (start (cdr (assoc "start" project)))
+       (end (cdr (assoc "end" project))))
+    (insert 
+     (format "project %s \"%s\" \"%s\" %s +%sd {\n }\n"
+            unique-id headline version start
+            org-export-taskjuggler-default-project-duration))))
+
+(defun org-taskjuggler-filter-and-join (items)
+  "Filter all nil elements from ITEMS and join the remaining ones
+with separator \"\n\"."
+  (let ((filtered-items (remq nil items)))
+    (and filtered-items (mapconcat 'identity filtered-items "\n"))))
+  
+(defun org-taskjuggler-get-attributes (item attributes)
+  "Return all attribute as a single formated string. ITEM is an
+alist representing either a resource or a task. ATTRIBUTES is a
+list of symbols. Only entries from ITEM are considered that are
+listed in ATTRIBUTES."
+  (org-taskjuggler-filter-and-join 
+   (mapcar
+    (lambda (attribute) 
+      (org-taskjuggler-filter-and-join 
+       (org-taskjuggler-get-attribute item attribute)))
+    attributes)))
+
+(defun org-taskjuggler-get-attribute (item attribute)
+  "Return a list of strings containing the properly formatted
+taskjuggler declaration for a given ATTRIBUTE in ITEM (an alist).
+If the ATTRIBUTE is not in ITEM return nil."
+  (cond 
+   ((null item) nil)
+   ((equal (symbol-name attribute) (car (car item)))
+    (cons (format "%s %s" (symbol-name attribute) (cdr (car item)))
+         (org-taskjuggler-get-attribute (cdr item) attribute)))
+   (t (org-taskjuggler-get-attribute (cdr item) attribute))))
+
+(defun org-taskjuggler-open-resource (resource)
+  "Insert the beginning of a resource declaration. All valid
+attributes from the RESOURCE alist are inserted. If the RESOURCE
+defines a property \"resource_id\" it will be used as the id for
+this resource. Otherwise it will use the ID property. If neither
+is defined it will calculate a unique id for the resource using
+`org-taskjuggler-get-unique-id'."
+  (let ((id (org-taskjuggler-clean-id 
+            (or (cdr (assoc "resource_id" resource)) 
+                (cdr (assoc "ID" resource)) 
+                (cdr (assoc "unique-id" resource)))))
+       (headline (cdr (assoc "headline" resource)))
+       (attributes '(limits vacation shift booking efficiency journalentry rate)))
+    (insert 
+     (concat 
+      "resource " id " \"" headline "\" {\n "
+      (org-taskjuggler-get-attributes resource attributes) "\n"))))
+
+(defun org-taskjuggler-clean-effort (effort)
+  "Translate effort strings into a format acceptable to taskjuggler,
+i.e. REAL UNIT. If the effort string is something like 5:30 it
+will be assumed to be hours and will be translated into 5.5h.
+Otherwise if it contains something like 3.0 it is assumed to be
+days and will be translated into 3.0d. Other formats that
+taskjuggler supports (like weeks, months and years) are currently
+not supported."
+  (cond 
+   ((null effort) effort)
+   ((string-match "\\([0-9]+\\):\\([0-9]+\\)" effort) 
+    (let ((hours (string-to-number (match-string 1 effort)))
+         (minutes (string-to-number (match-string 2 effort))))
+      (format "%dh" (+ hours (/ minutes 60.0)))))
+   ((string-match "\\([0-9]+\\).\\([0-9]+\\)" effort) (concat effort "d"))
+   (t (error "Not a valid effort (%s)" effort))))
+
+(defun org-taskjuggler-get-priority (priority)
+  "Return a priority between 1 and 1000 based on PRIORITY, an
+org-mode priority string."
+  (max 1 (/ (* 1000 (- org-lowest-priority (string-to-char priority))) 
+           (- org-lowest-priority org-highest-priority))))
+
+(defun org-taskjuggler-open-task (task)
+  (let* ((unique-id (cdr (assoc "unique-id" task)))
+       (headline (cdr (assoc "headline" task)))
+       (effort (org-taskjuggler-clean-effort (cdr (assoc org-effort-property task))))
+       (depends (cdr (assoc "depends" task)))
+       (allocate (cdr (assoc "allocate" task)))
+       (priority-raw (cdr (assoc "PRIORITY" task)))
+       (priority (and priority-raw (org-taskjuggler-get-priority priority-raw)))
+       (state (cdr (assoc "TODO" task)))
+       (complete (or (and (member state org-done-keywords) "100") 
+                     (cdr (assoc "complete" task))))
+       (parent-ordered (cdr (assoc "parent-ordered" task)))
+       (previous-sibling (cdr (assoc "previous-sibling" task)))
+       (attributes 
+        '(account start note duration endbuffer endcredit end
+          flags journalentry length maxend maxstart milestone
+          minend minstart period reference responsible
+          scheduling startbuffer startcredit statusnote)))
+    (insert
+     (concat 
+      "task " unique-id " \"" headline "\" {\n" 
+      (if (and parent-ordered previous-sibling)
+         (format " depends %s\n" previous-sibling)
+       (and depends (format " depends %s\n" depends)))
+      (and allocate (format " purge allocations\n allocate %s\n" allocate))
+      (and complete (format " complete %s\n" complete))
+      (and effort (format " effort %s\n" effort))
+      (and priority (format " priority %s\n" priority))
+      
+      (org-taskjuggler-get-attributes task attributes)
+      "\n"))))
+
+(defun org-taskjuggler-close-maybe (level)
+  (while (> org-export-taskjuggler-old-level level) 
+    (insert "}\n")
+    (setq org-export-taskjuggler-old-level (1- org-export-taskjuggler-old-level)))
+  (when (= org-export-taskjuggler-old-level level)
+    (insert "}\n")))
+
+(defun org-taskjuggler-insert-reports ()
+  (let (report)
+    (dolist (report org-export-taskjuggler-default-reports)
+      (insert report "\n"))))
+
+(provide 'org-taskjuggler)
+
+;;; org-taskjuggler.el ends here
index f26060d4564b75818344941c67c47acbf464c845..b773274e93b6adc0dcbbf05c8c3c9362c96900b1 100644 (file)
@@ -5,7 +5,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33x
+;; Version: 7.01
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -27,6 +27,8 @@
 
 ;; This file contains the relative timer code for Org-mode
 
+;;; Code:
+
 (require 'org)
 
 (declare-function org-show-notification "org-clock" (parameters))
@@ -48,6 +50,30 @@ the value of the relative timer."
   :group 'org-time
   :type 'string)
 
+(defcustom org-timer-default-timer 0
+  "The default timer when a timer is set.
+When 0, the user is prompted for a value."
+  :group 'org-time
+  :type 'number)
+
+(defvar org-timer-start-hook nil
+  "Hook run after relative timer is started.")
+
+(defvar org-timer-stop-hook nil
+  "Hook run before relative timer is stopped.")
+
+(defvar org-timer-pause-hook nil
+  "Hook run before relative timer is paused.")
+
+(defvar org-timer-set-hook nil
+  "Hook run after countdown timer is set.")
+
+(defvar org-timer-done-hook nil
+  "Hook run after countdown timer reaches zero.")
+
+(defvar org-timer-cancel-hook nil
+  "Hook run before countdown timer is canceled.")
+
 ;;;###autoload
 (defun org-timer-start (&optional offset)
   "Set the starting time for the relative timer to now.
@@ -78,14 +104,16 @@ the region 0:00:00."
          (setq delta (org-timer-hms-to-secs (org-timer-fix-incomplete s)))))
        (setq org-timer-start-time
              (seconds-to-time
-              (- (org-float-time) (org-timer-hms-to-secs s)))))
+              (- (org-float-time) delta))))
       (org-timer-set-mode-line 'on)
       (message "Timer start time set to %s, current value is %s"
               (format-time-string "%T" org-timer-start-time)
-              (org-timer-secs-to-hms (or delta 0))))))
+              (org-timer-secs-to-hms (or delta 0)))
+      (run-hooks 'org-timer-start-hook))))
 
 (defun org-timer-pause-or-continue (&optional stop)
-  "Pause or continue the relative timer.  With prefix arg, stop it entirely."
+  "Pause or continue the relative timer.
+With prefix arg STOP, stop it entirely."
   (interactive "P")
   (cond
    (stop (org-timer-stop))
@@ -103,6 +131,7 @@ the region 0:00:00."
     (message "Timer continues at %s" (org-timer-value-string)))
    (t
     ;; pause timer
+    (run-hooks 'org-timer-pause-hook)
     (setq org-timer-pause-time (current-time))
     (org-timer-set-mode-line 'pause)
     (message "Timer paused at %s" (org-timer-value-string)))))
@@ -110,6 +139,7 @@ the region 0:00:00."
 (defun org-timer-stop ()
   "Stop the relative timer."
   (interactive)
+  (run-hooks 'org-timer-stop-hook)
   (setq org-timer-start-time nil
        org-timer-pause-time nil)
   (org-timer-set-mode-line 'off))
@@ -118,8 +148,9 @@ the region 0:00:00."
 (defun org-timer (&optional restart)
   "Insert a H:MM:SS string from the timer into the buffer.
 The first time this command is used, the timer is started.  When used with
-a `C-u' prefix, force restarting the timer.
-When used with a double prefix arg `C-u C-u', change all the timer string
+a \\[universal-argument] prefix, force restarting the timer.
+When used with a double prefix argument \
+\\[universal-argument] \\universal-argument], change all the timer string
 in the region by a fixed amount.  This can be used to recalibrate a timer
 that was not started at the correct moment."
   (interactive "P")
@@ -254,45 +285,61 @@ VALUE can be `on', `off', or `pause'."
          (concat " <" (substring (org-timer-value-string) 0 -1) ">"))
     (force-mode-line-update)))
 
-(defvar org-timer-timer1 nil)
-(defvar org-timer-timer2 nil)
-(defvar org-timer-timer3 nil)
-(defvar org-timer-last-timer nil)
-
-(defun org-timer-cancel-timers ()
-  "Reset all timers."
+(defvar org-timer-current-timer nil)
+(defun org-timer-cancel-timer ()
+  "Cancel the current timer."
   (interactive)
-  (mapc (lambda(timer)
-         (when (eval timer)
-           (cancel-timer timer)
-           (setq timer nil)))
-       '(org-timer-timer1
-         org-timer-timer2
-         org-timer-timer3))
-  (message "All timers reset"))
+  (when (eval org-timer-current-timer)
+    (run-hooks 'org-timer-cancel-hook)
+    (cancel-timer org-timer-current-timer)
+    (setq org-timer-current-timer nil))
+  (message "Last timer canceled"))
 
 (defun org-timer-show-remaining-time ()
   "Display the remaining time before the timer ends."
   (interactive)
   (require 'time)
-  (if (and (not org-timer-timer1)
-          (not org-timer-timer2)
-          (not org-timer-timer3))
+  (if (not org-timer-current-timer)
       (message "No timer set")
     (let* ((rtime (decode-time
-                  (time-subtract (timer--time org-timer-last-timer)
+                  (time-subtract (timer--time org-timer-current-timer)
                                  (current-time))))
           (rsecs (nth 0 rtime))
           (rmins (nth 1 rtime)))
-      (message "%d minutes %d seconds left before next time out"
+      (message "%d minute(s) %d seconds left before next time out"
               rmins rsecs))))
 
+(defun bzg-test (&optional test)
+  (interactive "P")
+  test)
+
 ;;;###autoload
-(defun org-timer-set-timer (minutes)
-  "Set a timer."
-  (interactive "sTime out in (min)? ")
-  (if (not (string-match "[0-9]+" minutes))
-      (org-timer-show-remaining-time)
+(defun org-timer-set-timer (&optional opt)
+  "Prompt for a duration and set a timer.
+
+If `org-timer-default-timer' is not zero, suggest this value as
+the default duration for the timer.  If a timer is already set,
+prompt the use if she wants to replace it.
+
+Called with a numeric prefix argument, use this numeric value as
+the duration of the timer.
+
+Called with a `C-u' prefix arguments, use `org-timer-default-timer'
+without prompting the user for a duration.
+
+With two `C-u' prefix arguments, use `org-timer-default-timer'
+without prompting the user for a duration and automatically
+replace any running timer."
+  (interactive "P")
+  (let ((minutes (or (and (numberp opt) (number-to-string opt))
+                    (and (listp opt) (not (null opt))
+                         (number-to-string org-timer-default-timer))
+                    (read-from-minibuffer
+                     "How many minutes left? "
+                     (if (not (eq org-timer-default-timer 0))
+                         (number-to-string org-timer-default-timer))))))
+    (if (not (string-match "[0-9]+" minutes))
+       (org-timer-show-remaining-time)
     (let* ((mins (string-to-number (match-string 0 minutes)))
           (secs (* mins 60))
           (hl (cond
@@ -311,16 +358,21 @@ VALUE can be `on', `off', or `pause'."
                 (org-get-heading))
                (t (error "Not in an Org buffer"))))
           timer-set)
-      (mapcar (lambda(timer)
-               (when (not (or (eval timer) timer-set))
-                 (setq timer-set t)
-                 (setq org-timer-last-timer
-                       (run-with-timer
-                       secs nil 'org-notify (format "%s: time out" hl) t))
-                 (set timer org-timer-last-timer)))
-             '(org-timer-timer1
-               org-timer-timer2
-               org-timer-timer3)))))
+      (if (or (and org-timer-current-timer
+                  (or (equal opt '(16))
+                      (y-or-n-p "Replace current timer? ")))
+             (not org-timer-current-timer))
+         (progn
+           (when org-timer-current-timer
+             (cancel-timer org-timer-current-timer))
+           (setq org-timer-current-timer
+                 (run-with-timer
+                  secs nil `(lambda ()
+                              (setq org-timer-current-timer nil)
+                              (org-notify ,(format "%s: time out" hl) t)
+                              (run-hooks 'org-timer-done-hook))))
+           (run-hooks 'org-timer-set-hook))
+       (message "No timer set"))))))
 
 (provide 'org-timer)
 
index fc7fcd8947ebf596ff29f7911608152c4a7c3d22..4a28df6caa05b5dceddd4196ff66235502affe93 100644 (file)
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33x
+;; Version: 7.01
 ;;
 ;; This file is part of GNU Emacs.
 ;;
index 59aba5c236607cdc402143f99b1f01a3aa878e02..b457156f57336b0478d08fb3bd4320a45364319b 100644 (file)
@@ -5,7 +5,7 @@
 ;; Author: Andy Stewart <lazycat dot manatee at gmail dot com>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33x
+;; Version: 7.01
 ;;
 ;; This file is part of GNU Emacs.
 ;;
 ;; This file implements copying HTML content from a w3m buffer and
 ;; transforming the text on the fly so that it can be pasted into
 ;; an org-mode buffer with hot links.  It will also work for regions
-;; in gnus buffers that have ben washed with w3m.
+;; in gnus buffers that have been washed with w3m.
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;
-;;; Acknowledgements:
+;;; Acknowledgments:
 
 ;; Richard Riley <rileyrgdev at googlemail dot com>
 ;;
@@ -40,8 +40,9 @@
 ;;      proposed by Richard, I'm just coding it.
 ;;
 
+;;; Code:
+
 (require 'org)
-(declare-function w3m-anchor "ext:w3m-util" (position))
 
 (defun org-w3m-copy-for-org-mode ()
   "Copy current buffer content or active region with `org-mode' style links.
@@ -68,7 +69,7 @@ so that it can be yanked into an Org-mode buffer with links working correctly."
         ;; store current point before jump next anchor
         (setq temp-position (point))
         ;; move to next anchor when current point is not at anchor
-        (or (w3m-anchor (point)) (org-w3m-get-next-link-start))
+        (or (get-text-property (point) 'w3m-href-anchor) (org-w3m-get-next-link-start))
         (if (<= (point) transform-end)  ; if point is inside transform bound
             (progn
               ;; get content between two links.
@@ -77,7 +78,7 @@ so that it can be yanked into an Org-mode buffer with links working correctly."
                                                (buffer-substring
                                                 temp-position (point)))))
               ;; get link location at current point.
-              (setq link-location (w3m-anchor (point)))
+              (setq link-location (get-text-property (point) 'w3m-href-anchor))
               ;; get link title at current point.
               (setq link-title (buffer-substring (point)
                                                  (org-w3m-get-anchor-end)))
@@ -115,7 +116,7 @@ so that it can be yanked into an Org-mode buffer with links working correctly."
     (while (next-single-property-change (point) 'w3m-anchor-sequence)
       ;; jump to next anchor
       (goto-char (next-single-property-change (point) 'w3m-anchor-sequence))
-      (when (w3m-anchor (point))
+      (when (get-text-property (point) 'w3m-href-anchor)
         ;; return point when current is valid link
         (throw 'reach nil))))
   (point))
@@ -126,7 +127,7 @@ so that it can be yanked into an Org-mode buffer with links working correctly."
     (while (previous-single-property-change (point) 'w3m-anchor-sequence)
       ;; jump to previous anchor
       (goto-char (previous-single-property-change (point) 'w3m-anchor-sequence))
-      (when (w3m-anchor (point))
+      (when (get-text-property (point) 'w3m-href-anchor)
         ;; return point when current is valid link
         (throw 'reach nil))))
   (point))
index 2c8374a7b89b43bb90fe1666ab6fd0991c80d002..4d2f8ec1280f17ea558c4b96abb654098138038f 100644 (file)
@@ -4,9 +4,10 @@
 ;;   Free Software Foundation, Inc.
 
 ;; Author: Tokuya Kameshima <kames at fa2 dot so-net dot ne dot jp>
+;;         David Maus <dmaus at ictsoc dot de>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33x
+;; Version: 7.01
 ;;
 ;; This file is part of GNU Emacs.
 ;;
  :group 'org-link)
 
 (defcustom org-wl-link-to-refile-destination t
- "Create a link to the refile destination if the message is marked as refile."
- :group 'org-wl
- :type 'boolean)
+  "Create a link to the refile destination if the message is marked as refile."
+  :group 'org-wl
+  :type 'boolean)
+
+(defcustom org-wl-link-remove-filter nil
+  "Remove filter condition if message is filter folder."
+  :group 'org-wl
+  :type 'boolean)
+
+(defcustom org-wl-shimbun-prefer-web-links nil
+  "If non-nil create web links for shimbun messages."
+  :group 'org-wl
+  :type 'boolean)
+
+(defcustom org-wl-nntp-prefer-web-links nil
+  "If non-nil create web links for nntp messages.
+When folder name contains string \"gmane\" link to gmane,
+googlegroups otherwise."
+  :type 'boolean
+  :group 'org-wl)
+
+(defcustom org-wl-disable-folder-check t
+  "Disable check for new messages when open a link."
+  :type 'boolean
+  :group 'org-wl)
+
+(defcustom org-wl-namazu-default-index nil
+  "Default namazu search index."
+  :type 'directory
+  :group 'org-wl)
 
 ;; Declare external functions and variables
 (declare-function elmo-folder-exists-p "ext:elmo" (folder) t)
 (declare-function wl-summary-registered-temp-mark "ext:wl-action" (number))
 (declare-function wl-folder-goto-folder-subr "ext:wl-folder"
                  (&optional folder sticky))
+(declare-function wl-folder-get-petname "ext:wl-folder" (name))
+(declare-function wl-folder-get-entity-from-buffer "ext:wl-folder"
+                 (&optional getid))
+(declare-function wl-folder-buffer-group-p "ext:wl-folder")
 (defvar wl-init)
 (defvar wl-summary-buffer-elmo-folder)
 (defvar wl-summary-buffer-folder-name)
+(defvar wl-folder-group-regexp)
+(defvar wl-auto-check-folder-name)
+
+(defconst org-wl-folder-types
+  '(("%" . imap) ("-" . nntp) ("+" . mh) ("=" . spool)
+    ("$" . archive) ("&" . pop) ("@" . shimbun) ("[" . search)
+    ("*" . multi) ("/" . filter) ("|" . pipe) ("'" . internal))
+  "List of folder indicators.  See Wanderlust manual, section 3.")
 
 ;; Install the link type
 (org-add-link-type "wl" 'org-wl-open)
 (add-hook 'org-store-link-functions 'org-wl-store-link)
 
 ;; Implementation
+
+(defun org-wl-folder-type (folder)
+  "Return symbol that indicates the type of FOLDER.
+FOLDER is the wanderlust folder name.  The first character of the
+folder name determines the the folder type."
+  (let* ((indicator (substring folder 0 1))
+        (type (cdr (assoc indicator org-wl-folder-types))))
+    ;; maybe access or file folder
+    (when (not type)
+      (setq type
+           (cond
+            ((and (>= (length folder) 5)
+                  (string= (substring folder 0 5) "file:"))
+             'file)
+            ((and (>= (length folder) 7)
+                  (string= (substring folder 0 7) "access:"))
+             'access)
+            (t
+             nil))))
+    type))
+
+(defun org-wl-message-field (field entity)
+  "Return content of FIELD in ENTITY.
+FIELD is a symbol of a rfc822 message header field.
+ENTITY is a message entity."
+  (let ((content (elmo-message-entity-field entity field)))
+    (if (listp content) (car content) content)))
+
 (defun org-wl-store-link ()
- "Store a link to a WL folder or message."
- (when (eq major-mode 'wl-summary-mode)
-   (let* ((msgnum (wl-summary-message-number))
-          (mark-info (wl-summary-registered-temp-mark msgnum))
-          (folder-name
-           (if (and org-wl-link-to-refile-destination
-                    mark-info
-                    (equal (nth 1 mark-info) "o")) ; marked as refile
-               (nth 2 mark-info)
-             wl-summary-buffer-folder-name))
-          (message-id (elmo-message-field wl-summary-buffer-elmo-folder
-                                          msgnum 'message-id))
-          (wl-message-entity
-           (if (fboundp 'elmo-message-entity)
-               (elmo-message-entity
-                wl-summary-buffer-elmo-folder msgnum)
-             (elmo-msgdb-overview-get-entity
-              msgnum (wl-summary-buffer-msgdb))))
-          (from (let ((from-field (elmo-message-entity-field wl-message-entity
-                                                             'from)))
-                  (if (listp from-field)
-                      (car from-field)
-                    from-field)))
-          (to (let ((to-field (elmo-message-entity-field wl-message-entity
-                                                         'to)))
-                (if (listp to-field)
-                    (car to-field)
-                  to-field)))
-          (subject (let (wl-thr-indent-string wl-parent-message-entity)
-                     (wl-summary-line-subject)))
-          desc link)
-     (org-store-link-props :type "wl" :from from :to to
-                           :subject subject :message-id message-id)
-     (setq message-id (org-remove-angle-brackets message-id))
-     (setq desc (org-email-link-description))
-     (setq link (org-make-link "wl:" folder-name
-                               "#" message-id))
-     (org-add-link-props :link link :description desc)
-     link)))
+  "Store a link to a WL message or folder."
+  (cond
+   ((memq major-mode '(wl-summary-mode mime-view-mode))
+    (org-wl-store-link-message))
+   ((eq major-mode 'wl-folder-mode)
+    (org-wl-store-link-folder))
+   (t
+    nil)))
+
+(defun org-wl-store-link-folder ()
+  "Store a link to a WL folder."
+  (let* ((folder (wl-folder-get-entity-from-buffer))
+        (petname (wl-folder-get-petname folder))
+        (link (org-make-link "wl:" folder)))
+    (save-excursion
+      (beginning-of-line)
+      (unless (and (wl-folder-buffer-group-p)
+                  (looking-at wl-folder-group-regexp))
+       (org-store-link-props :type "wl" :description petname
+                             :link link)
+       link))))
+
+(defun org-wl-store-link-message ()
+  "Store a link to a WL message."
+  (save-excursion
+    (let ((buf (if (eq major-mode 'wl-summary-mode)
+                  (current-buffer)
+                (and (boundp 'wl-message-buffer-cur-summary-buffer)
+                     wl-message-buffer-cur-summary-buffer))))
+      (when buf
+       (with-current-buffer buf
+         (let* ((msgnum (wl-summary-message-number))
+                (mark-info (wl-summary-registered-temp-mark msgnum))
+                (folder-name
+                 (if (and org-wl-link-to-refile-destination
+                          mark-info
+                          (equal (nth 1 mark-info) "o")) ; marked as refile
+                     (nth 2 mark-info)
+                   wl-summary-buffer-folder-name))
+                (folder-type (org-wl-folder-type folder-name))
+                (wl-message-entity
+                 (if (fboundp 'elmo-message-entity)
+                     (elmo-message-entity
+                      wl-summary-buffer-elmo-folder msgnum)
+                   (elmo-msgdb-overview-get-entity
+                    msgnum (wl-summary-buffer-msgdb))))
+                (message-id
+                 (org-wl-message-field 'message-id wl-message-entity))
+                (from (org-wl-message-field 'from wl-message-entity))
+                (to (org-wl-message-field 'to wl-message-entity))
+                (xref (org-wl-message-field 'xref wl-message-entity))
+                (subject (org-wl-message-field 'subject wl-message-entity))
+                desc link)
+
+           ;; remove text properties of subject string to avoid possible bug
+           ;; when formatting the subject
+           ;; (Emacs bug #5306, fixed)
+           (set-text-properties 0 (length subject) nil subject)
+
+           ;; maybe remove filter condition
+           (when (and (eq folder-type 'filter) org-wl-link-remove-filter)
+             (while (eq (org-wl-folder-type folder-name) 'filter)
+               (setq folder-name
+                     (replace-regexp-in-string "^/[^/]+/" "" folder-name))))
+
+           ;; maybe create http link
+           (cond
+            ((and (eq folder-type 'shimbun)
+                  org-wl-shimbun-prefer-web-links xref)
+             (org-store-link-props :type "http" :link xref :description subject
+                                   :from from :to to :message-id message-id
+                                   :subject subject))
+            ((and (eq folder-type 'nntp) org-wl-nntp-prefer-web-links)
+             (setq link
+                   (format
+                    (if (string-match "gmane\\." folder-name)
+                        "http://mid.gmane.org/%s"
+                      "http://groups.google.com/groups/search?as_umsgid=%s")
+                    (org-fixup-message-id-for-http message-id)))
+             (org-store-link-props :type "http" :link link :description subject
+                                   :from from :to to :message-id message-id
+                                   :subject subject))
+            (t
+             (org-store-link-props :type "wl" :from from :to to
+                                   :subject subject :message-id message-id)
+             (setq message-id (org-remove-angle-brackets message-id))
+             (setq desc (org-email-link-description))
+             (setq link (org-make-link "wl:" folder-name "#" message-id))
+             (org-add-link-props :link link :description desc)))
+           (or link xref)))))))
 
 (defun org-wl-open (path)
- "Follow the WL message link specified by PATH."
- (require 'wl)
- (unless wl-init (wl))
- ;; XXX: The imap-uw's MH folder names start with "%#".
- (if (not (string-match "\\`\\(\\(?:%#\\)?[^#]+\\)\\(#\\(.*\\)\\)?" path))
-     (error "Error in Wanderlust link"))
- (let ((folder (match-string 1 path))
-       (article (match-string 3 path)))
-   (if (not (elmo-folder-exists-p (org-no-warnings
-                                  (wl-folder-get-elmo-folder folder))))
-       (error "No such folder: %s" folder))
-   (let ((old-buf (current-buffer))
-         (old-point (point-marker)))
-     (wl-folder-goto-folder-subr folder)
-     (save-excursion
-       ;; XXX: `wl-folder-goto-folder-subr' moves point to the
-       ;; beginning of the current line.  So, restore the point
-       ;; in the old buffer.
-       (set-buffer old-buf)
-       (goto-char old-point))
-     (and (wl-summary-jump-to-msg-by-message-id (org-add-angle-brackets
-                                                 article))
-          (wl-summary-redisplay)))))
+  "Follow the WL message link specified by PATH.
+When called with one prefix, open message in namazu search folder
+with `org-wl-namazu-default-index' as search index.  When called
+with two prefixes or `org-wl-namazu-default-index' is nil, ask
+for namazu index."
+  (require 'wl)
+  (let ((wl-auto-check-folder-name
+        (if org-wl-disable-folder-check
+            'none
+          wl-auto-check-folder-name)))
+    (unless wl-init (wl))
+    ;; XXX: The imap-uw's MH folder names start with "%#".
+    (if (not (string-match "\\`\\(\\(?:%#\\)?[^#]+\\)\\(#\\(.*\\)\\)?" path))
+       (error "Error in Wanderlust link"))
+    (let ((folder (match-string 1 path))
+         (article (match-string 3 path)))
+      ;; maybe open message in namazu search folder
+      (when current-prefix-arg
+       (setq folder (concat "[" article "]"
+                            (if (and (equal current-prefix-arg '(4))
+                                     org-wl-namazu-default-index)
+                                org-wl-namazu-default-index
+                              (read-directory-name "Namazu index: ")))))
+      (if (not (elmo-folder-exists-p (org-no-warnings
+                                     (wl-folder-get-elmo-folder folder))))
+         (error "No such folder: %s" folder))
+      (let ((old-buf (current-buffer))
+           (old-point (point-marker)))
+       (wl-folder-goto-folder-subr folder)
+       (with-current-buffer old-buf
+         ;; XXX: `wl-folder-goto-folder-subr' moves point to the
+         ;; beginning of the current line.  So, restore the point
+         ;; in the old buffer.
+         (goto-char old-point))
+       (and article (wl-summary-jump-to-msg-by-message-id (org-add-angle-brackets
+                                                           article))
+            (wl-summary-redisplay))))))
 
 (provide 'org-wl)
 
index e117bea0c2901762c98239124004be687d2a09ba..af501058e860bbcf1e14ee018f4bccf73a44da0f 100644 (file)
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33x
+;; Version: 7.01
 ;;
 ;; This file is part of GNU Emacs.
 ;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;
 ;;; Commentary:
+;; XOXO export
 
-(require 'org-exp)
+;;; Code:
 
-;;; XOXO export
+(require 'org-exp)
 
 (defvar org-export-xoxo-final-hook nil
   "Hook run after XOXO export, in the new buffer.")
@@ -43,6 +44,7 @@
   "Export the org buffer as XOXO.
 The XOXO buffer is named *xoxo-<source buffer name>*"
   (interactive (list (current-buffer)))
+  (run-hooks 'org-export-first-hook)
   ;; A quickie abstraction
 
   ;; Output everything as XOXO
index a404551f3cb8e0c276ffc5988691bc82b64992ad..a2965e87d2234777887c45d4940e66f832d9ddb1 100644 (file)
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33x
+;; Version: 7.01
 ;;
 ;; This file is part of GNU Emacs.
 ;;
 
 (eval-when-compile
   (require 'cl)
-  (require 'gnus-sum)
-  (require 'calendar))
+  (require 'gnus-sum))
+
+(require 'calendar)
+;; Emacs 22 calendar compatibility:  Make sure the new variables are available
+(when (fboundp 'defvaralias)
+  (unless (boundp 'calendar-view-holidays-initially-flag)
+    (defvaralias 'calendar-view-holidays-initially-flag
+      'view-calendar-holidays-initially))
+  (unless (boundp 'calendar-view-diary-initially-flag)
+    (defvaralias 'calendar-view-diary-initially-flag
+      'view-diary-entries-initially))
+  (unless (boundp 'diary-fancy-buffer)
+    (defvaralias 'diary-fancy-buffer 'fancy-diary-buffer)))
+
 ;; For XEmacs, noutline is not yet provided by outline.el, so arrange for
 ;; the file noutline.el being loaded.
 (if (featurep 'xemacs) (condition-case nil (require 'noutline)))
 (require 'time-date)
 (unless (fboundp 'time-subtract) (defalias 'time-subtract 'subtract-time))
 (require 'easymenu)
+(require 'overlay)
 
 (require 'org-macs)
+(require 'org-entities)
 (require 'org-compat)
 (require 'org-faces)
 (require 'org-list)
 (require 'org-src)
 (require 'org-footnote)
 
+;; babel
+(require 'ob)
+(require 'ob-table)
+(require 'ob-lob)
+(require 'ob-ref)
+(require 'ob-tangle)
+(require 'ob-comint)
+(require 'ob-keys)
+
+;; load languages based on value of `org-babel-load-languages'
+(defvar org-babel-load-languages)
+;;;###autoload
+(defun org-babel-do-load-languages (sym value)
+  "Load the languages defined in `org-babel-load-languages'."
+  (set-default sym value)
+  (mapc (lambda (pair)
+         (let ((active (cdr pair)) (lang (symbol-name (car pair))))
+           (if active
+               (progn
+                 (require (intern (concat "ob-" lang))))
+             (progn
+               (funcall 'fmakunbound
+                        (intern (concat "org-babel-execute:" lang)))
+               (funcall 'fmakunbound
+                        (intern (concat "org-babel-expand-body:" lang)))))))
+       org-babel-load-languages))
+
+(defcustom org-babel-load-languages '((emacs-lisp . t))
+  "Languages which can be evaluated in Org-mode buffers.
+This list can be used to load support for any of the languages
+below, note that each language will depend on a different set of
+system executables and/or Emacs modes.  When a language is
+\"loaded\", then code blocks in that language can be evaluated
+with `org-babel-execute-src-block' bound by default to C-c
+C-c (note the `org-babel-no-eval-on-ctrl-c-ctrl-c' variable can
+be set to remove code block evaluation from the C-c C-c
+keybinding.  By default only Emacs Lisp (which has no
+requirements) is loaded."
+  :group 'org-babel
+  :set 'org-babel-do-load-languages
+  :type '(alist :tag "Babel Languages"
+               :key-type
+               (choice
+                (const :tag "C" C)
+                (const :tag "R" R)
+                (const :tag "Asymptote" asymptote)
+                (const :tag "Clojure" clojure)
+                (const :tag "CSS" css)
+                (const :tag "Ditaa" ditaa)
+                (const :tag "Dot" dot)
+                (const :tag "Emacs Lisp" emacs-lisp)
+                (const :tag "Gnuplot" gnuplot)
+                (const :tag "Haskell" haskell)
+                (const :tag "Latex" latex)
+                (const :tag "Matlab" matlab)
+                (const :tag "Mscgen" mscgen)
+                (const :tag "Ocaml" ocaml)
+                (const :tag "Octave" octave)
+                (const :tag "Perl" perl)
+                (const :tag "Python" python)
+                (const :tag "Ruby" ruby)
+                (const :tag "Sass" sass)
+                (const :tag "Screen" screen)
+                (const :tag "Shell Script" sh)
+                (const :tag "Sql" sql)
+                (const :tag "Sqlite" sqlite))
+               :value-type (boolean :tag "Activate" :value t)))
+
 ;;;; Customization variables
+(defcustom org-clone-delete-id nil
+  "Remove ID property of clones of a subtree.
+When non-nil, clones of a subtree don't inherit the ID property.
+Otherwise they inherit the ID property with a new unique
+identifier."
+  :type 'boolean
+  :group 'org-id)
 
 ;;; Version
 
-(defconst org-version "6.33x"
+(defconst org-version "7.01"
   "The version number of the file org.el.")
 
 (defun org-version (&optional here)
@@ -134,7 +223,6 @@ With prefix arg HERE, insert it at point."
   "Outline-based notes management and organizer."
   :tag "Org"
   :group 'outlines
-  :group 'hypermedia
   :group 'calendar)
 
 (defcustom org-mode-hook nil
@@ -170,7 +258,7 @@ With prefix arg HERE, insert it at point."
   (let ((a (member 'org-infojs org-modules)))
     (and a (setcar a 'org-jsinfo))))
 
-(defcustom org-modules '(org-bbdb org-bibtex org-gnus org-info org-jsinfo org-irc org-mew org-mhe org-rmail org-vm org-w3m org-wl)
+(defcustom org-modules '(org-bbdb org-bibtex org-docview org-gnus org-info org-jsinfo org-irc org-mew org-mhe org-rmail org-vm org-w3m org-wl)
   "Modules that should always be loaded together with org.el.
 If a description starts with <C>, the file is not part of Emacs
 and loading it will require that you have downloaded and properly installed
@@ -189,6 +277,8 @@ to add the symbol `xyz', and the package must have a call to
        (const :tag "   bbdb:              Links to BBDB entries" org-bbdb)
        (const :tag "   bibtex:            Links to BibTeX entries" org-bibtex)
        (const :tag "   crypt:             Encryption of subtrees" org-crypt)
+       (const :tag "   ctags:             Access to Emacs tags with links" org-ctags)
+       (const :tag "   docview:           Links to doc-view buffers" org-docview)
        (const :tag "   gnus:              Links to GNUS folders/messages" org-gnus)
        (const :tag "   id:                Global IDs for identifying entries" org-id)
        (const :tag "   info:              Links to Info nodes" org-info)
@@ -226,24 +316,26 @@ to add the symbol `xyz', and the package must have a call to
        (const :tag "C  learn:             SuperMemo's incremental learning algorithm" org-learn)
        (const :tag "C  mairix:            Hook mairix search into Org-mode for different MUAs" org-mairix)
        (const :tag "C  mac-iCal           Imports events from iCal.app to the Emacs diary" org-mac-iCal)
+       (const :tag "C  mac-link-grabber   Grab links and URLs from various Mac applications" org-mac-link-grabber)
        (const :tag "C  man:               Support for links to manpages in Org-mode" org-man)
        (const :tag "C  mtags:             Support for muse-like tags" org-mtags)
        (const :tag "C  panel:             Simple routines for us with bad memory" org-panel)
-       (const :tag "C  R:                 Computation using the R language" org-R)
        (const :tag "C  registry:          A registry for Org-mode links" org-registry)
        (const :tag "C  org2rem:           Convert org appointments into reminders" org2rem)
        (const :tag "C  screen:            Visit screen sessions through Org-mode links" org-screen)
+       (const :tag "C  secretary:         Team management with org-mode" org-secretary)
        (const :tag "C  special-blocks:    Turn blocks into LaTeX envs and HTML divs" org-special-blocks)
        (const :tag "C  sqlinsert:         Convert Org-mode tables to SQL insertions" orgtbl-sqlinsert)
        (const :tag "C  toc:               Table of contents for Org-mode buffer" org-toc)
        (const :tag "C  track:             Keep up with Org-mode development" org-track)
+       (const :tag "C  TaskJuggler:       Export tasks to a TaskJuggler project" org-taskjuggler)
        (repeat :tag "External packages" :inline t (symbol :tag "Package"))))
 
 (defcustom org-support-shift-select nil
-  "Non-nil means, make shift-cursor commands select text when possible.
+  "Non-nil means make shift-cursor commands select text when possible.
 
 In Emacs 23, when `shift-select-mode' is on, shifted cursor keys start
-selecting a region, or enlarge thusly regions started in this way.
+selecting a region, or enlarge regions started in this way.
 In Org-mode, in special contexts, these same keys are used for other
 purposes, important enough to compete with shift selection.  Org tries
 to balance these needs by supporting `shift-select-mode' outside these
@@ -288,7 +380,7 @@ is Emacs 23 only."
   :group 'org)
 
 (defcustom org-startup-folded t
-  "Non-nil means, entering Org-mode will switch to OVERVIEW.
+  "Non-nil means entering Org-mode will switch to OVERVIEW.
 This can also be configured on a per-file basis by adding one of
 the following lines anywhere in the buffer:
 
@@ -304,14 +396,14 @@ the following lines anywhere in the buffer:
          (const :tag "show everything, even drawers" showeverything)))
 
 (defcustom org-startup-truncated t
-  "Non-nil means, entering Org-mode will set `truncate-lines'.
+  "Non-nil means entering Org-mode will set `truncate-lines'.
 This is useful since some lines containing links can be very long and
 uninteresting.  Also tables look terrible when wrapped."
   :group 'org-startup
   :type 'boolean)
 
 (defcustom org-startup-indented nil
-  "Non-nil means, turn on `org-indent-mode' on startup.
+  "Non-nil means turn on `org-indent-mode' on startup.
 This can also be configured on a per-file basis by adding one of
 the following lines anywhere in the buffer:
 
@@ -322,8 +414,51 @@ the following lines anywhere in the buffer:
          (const :tag "Not" nil)
          (const :tag "Globally (slow on startup in large files)" t)))
 
+(defcustom org-use-sub-superscripts t
+  "Non-nil means interpret \"_\" and \"^\" for export.
+When this option is turned on, you can use TeX-like syntax for sub- and
+superscripts.  Several characters after \"_\" or \"^\" will be
+considered as a single item - so grouping with {} is normally not
+needed.  For example, the following things will be parsed as single
+sub- or superscripts.
+
+ 10^24   or   10^tau     several digits will be considered 1 item.
+ 10^-12  or   10^-tau    a leading sign with digits or a word
+ x^2-y^3                 will be read as x^2 - y^3, because items are
+                        terminated by almost any nonword/nondigit char.
+ x_{i^2} or   x^(2-i)    braces or parenthesis do grouping.
+
+Still, ambiguity is possible - so when in doubt use {} to enclose the
+sub/superscript.  If you set this variable to the symbol `{}',
+the braces are *required* in order to trigger interpretations as
+sub/superscript.  This can be helpful in documents that need \"_\"
+frequently in plain text.
+
+Not all export backends support this, but HTML does.
+
+This option can also be set with the +OPTIONS line, e.g. \"^:nil\"."
+  :group 'org-startup
+  :group 'org-export-translation
+  :type '(choice
+         (const :tag "Always interpret" t)
+         (const :tag "Only with braces" {})
+         (const :tag "Never interpret" nil)))
+
+(if (fboundp 'defvaralias)
+    (defvaralias 'org-export-with-sub-superscripts 'org-use-sub-superscripts))
+
+
+(defcustom org-startup-with-beamer-mode nil
+  "Non-nil means turn on `org-beamer-mode' on startup.
+This can also be configured on a per-file basis by adding one of
+the following lines anywhere in the buffer:
+
+   #+STARTUP: beamer"
+  :group 'org-startup
+  :type 'boolean)
+
 (defcustom org-startup-align-all-tables nil
-  "Non-nil means, align all tables when visiting a file.
+  "Non-nil means align all tables when visiting a file.
 This is useful when the column width in tables is forced with <N> cookies
 in table fields.  Such tables will look correct only after the first re-align.
 This can also be configured on a per-file basis by adding one of
@@ -360,10 +495,10 @@ become effective."
   :type 'boolean)
 
 (defcustom org-use-extra-keys nil
-  "Non-nil means use extra key sequence definitions for certain
-commands.  This happens automatically if you run XEmacs or if
-window-system is nil.  This variable lets you do the same
-manually.  You must set it before loading org.
+  "Non-nil means use extra key sequence definitions for certain commands.
+This happens automatically if you run XEmacs or if `window-system'
+is nil.  This variable lets you do the same manually.  You must
+set it before loading org.
 
 Example: on Carbon Emacs 22 running graphically, with an external
 keyboard on a Powerbook, the default way of setting M-left might
@@ -394,14 +529,17 @@ therefore you'll have to restart Emacs to apply it after changing."
 
 (defun org-key (key)
   "Select key according to `org-replace-disputed-keys' and `org-disputed-keys'.
-Or return the original if not disputed."
-  (if org-replace-disputed-keys
-      (let* ((nkey (key-description key))
-            (x (org-find-if (lambda (x)
-                              (equal (key-description (car x)) nkey))
-                            org-disputed-keys)))
-       (if x (cdr x) key))
-    key))
+Or return the original if not disputed.
+Also apply the translations defined in `org-xemacs-key-equivalents'."
+  (when org-replace-disputed-keys
+    (let* ((nkey (key-description key))
+          (x (org-find-if (lambda (x)
+                            (equal (key-description (car x)) nkey))
+                          org-disputed-keys)))
+      (setq key (if x (cdr x) key))))
+  (when (featurep 'xemacs)
+    (setq key (or (cdr (assoc key org-xemacs-key-equivalents)) key)))
+  key)
 
 (defun org-find-if (predicate seq)
   (catch 'exit
@@ -514,7 +652,7 @@ After a match, group 1 contains the repeat expression.")
   "Contexts for the reveal options.")
 
 (defcustom org-show-hierarchy-above '((default . t))
-  "Non-nil means, show full hierarchy when revealing a location.
+  "Non-nil means show full hierarchy when revealing a location.
 Org-mode often shows locations in an org-mode file which might have
 been invisible before.  When this is set, the hierarchy of headings
 above the exposed location is shown.
@@ -534,7 +672,7 @@ contexts.  Valid contexts are
   :type org-context-choice)
 
 (defcustom org-show-following-heading '((default . nil))
-  "Non-nil means, show following heading when revealing a location.
+  "Non-nil means show following heading when revealing a location.
 Org-mode often shows locations in an org-mode file which might have
 been invisible before.  When this is set, the heading following the
 match is shown.
@@ -547,7 +685,7 @@ contexts.  See `org-show-hierarchy-above' for valid contexts."
   :type org-context-choice)
 
 (defcustom org-show-siblings '((default . nil) (isearch t))
-  "Non-nil means, show all sibling heading when revealing a location.
+  "Non-nil means show all sibling heading when revealing a location.
 Org-mode often shows locations in an org-mode file which might have
 been invisible before.  When this is set, the sibling of the current entry
 heading are all made visible.  If `org-show-hierarchy-above' is t,
@@ -563,7 +701,7 @@ contexts.  See `org-show-hierarchy-above' for valid contexts."
   :type org-context-choice)
 
 (defcustom org-show-entry-below '((default . nil))
-  "Non-nil means, show the entry below a headline when revealing a location.
+  "Non-nil means show the entry below a headline when revealing a location.
 Org-mode often shows locations in an org-mode file which might have
 been invisible before.  When this is set, the text below the headline that is
 exposed is also shown.
@@ -594,7 +732,7 @@ new-frame        Make a new frame each time.  Note that in this case
          (const :tag "One dedicated frame" dedicated-frame)))
 
 (defcustom org-use-speed-commands nil
-  "Non-nil means, activate single letter commands at beginning of a headline.
+  "Non-nil means activate single letter commands at beginning of a headline.
 This may also be a function to test for appropriate locations where speed
 commands should be active."
   :group 'org-structure
@@ -614,7 +752,7 @@ The cdr is either a command to be called interactively, a function
 to be called, or a form to be evaluated.
 An entry that is just a list with a single string will be interpreted
 as a descriptive headline that will be added when listing the speed
-copmmands in the Help buffer using the `?' speed command."
+commands in the Help buffer using the `?' speed command."
     :group 'org-structure
     :type '(repeat :value ("k" . ignore)
            (choice :value ("k" . ignore)
@@ -631,7 +769,7 @@ copmmands in the Help buffer using the `?' speed command."
   :group 'org-structure)
 
 (defcustom org-cycle-skip-children-state-if-no-children t
-  "Non-nil means, skip CHILDREN state in entries that don't have any."
+  "Non-nil means skip CHILDREN state in entries that don't have any."
   :group 'org-cycle
   :type 'boolean)
 
@@ -668,7 +806,7 @@ Drawers can be defined on the per-file basis with a line like:
   :type '(repeat (string :tag "Drawer Name")))
 
 (defcustom org-hide-block-startup nil
-  "Non-nil means, , entering Org-mode will fold all blocks.
+  "Non-nil means entering Org-mode will fold all blocks.
 This can also be set in on a per-file basis with
 
 #+STARTUP: hideblocks
@@ -680,7 +818,8 @@ This can also be set in on a per-file basis with
 (defcustom org-cycle-global-at-bob nil
   "Cycle globally if cursor is at beginning of buffer and not at a headline.
 This makes it possible to do global cycling without having to use S-TAB or
-C-u TAB.  For this special case to work, the first line of the buffer
+\\[universal-argument] TAB.  For this special case to work, the first line \
+of the buffer
 must not be a headline - it may be empty or some other text.  When used in
 this way, `org-cycle-hook' is disables temporarily, to make sure the
 cursor stays at the beginning of the buffer.
@@ -690,11 +829,11 @@ of the buffer."
   :type 'boolean)
 
 (defcustom org-cycle-level-after-item/entry-creation t
-  "Non-nil means, cycle entry level or item indentation in new empty entries.
+  "Non-nil means cycle entry level or item indentation in new empty entries.
 
 When the cursor is at the end of an empty headline, i.e with only stars
 and maybe a TODO keyword, TAB will then switch the entry to become a child,
-and then all possible anchestor states, before returning to the original state.
+and then all possible ancestor states, before returning to the original state.
 This makes data entry extremely fast:  M-RET to create a new headline,
 on TAB to make it a child, two or more tabs to make it a (grand-)uncle.
 
@@ -727,7 +866,7 @@ If you leave an empty line between the end of a subtree and the following
 headline, this empty line is hidden when the subtree is folded.
 Org-mode will leave (exactly) one empty line visible if the number of
 empty lines is equal or larger to the number given in this variable.
-So the default 2 means, at least 2 empty lines after the end of a subtree
+So the default 2 means at least 2 empty lines after the end of a subtree
 are needed to produce free space between a collapsed subtree and the
 following headline.
 
@@ -768,7 +907,7 @@ the values `folded', `children', or `subtree'."
   :group 'org-structure)
 
 (defcustom org-odd-levels-only nil
-  "Non-nil means, skip even levels and only use odd levels for the outline.
+  "Non-nil means skip even levels and only use odd levels for the outline.
 This has the effect that two stars are being added/taken away in
 promotion/demotion commands.  It also influences how levels are
 handled by the exporters.
@@ -780,11 +919,11 @@ lines to the buffer:
    #+STARTUP: odd
    #+STARTUP: oddeven"
   :group 'org-edit-structure
-  :group 'org-font-lock
+  :group 'org-appearance
   :type 'boolean)
 
 (defcustom org-adapt-indentation t
-  "Non-nil means, adapt indentation to outline node level.
+  "Non-nil means adapt indentation to outline node level.
 
 When this variable is set, Org assumes that you write outlines by
 indenting text in each node to align with the headline (after the stars).
@@ -857,8 +996,20 @@ When t, the following will happen while the cursor is in the headline:
   :group 'org-edit-structure
   :type 'boolean)
 
+(defcustom org-ctrl-k-protect-subtree nil
+  "Non-nil means, do not delete a hidden subtree with C-k.
+When set to the symbol `error', simply throw an error when C-k is
+used to kill (part-of) a headline that has hidden text behind it.
+Any other non-nil value will result in a query to the user, if it is
+OK to kill that hidden subtree.  When nil, kill without remorse."
+  :group 'org-edit-structure
+  :type '(choice
+         (const :tag "Do not protect hidden subtrees" nil)
+         (const :tag "Protect hidden subtrees with a security query" t)
+         (const :tag "Never kill a hidden subtree with C-k" error)))
+
 (defcustom org-yank-folded-subtrees t
-  "Non-nil means, when yanking subtrees, fold them.
+  "Non-nil means when yanking subtrees, fold them.
 If the kill is a single subtree, or a sequence of subtrees, i.e. if
 it starts with a heading and all other headings in it are either children
 or siblings, then fold all the subtrees.  However, do this only if no
@@ -867,14 +1018,14 @@ text after the yank would be swallowed into a folded tree by this action."
   :type 'boolean)
 
 (defcustom org-yank-adjusted-subtrees nil
-  "Non-nil means, when yanking subtrees, adjust the level.
+  "Non-nil means when yanking subtrees, adjust the level.
 With this setting, `org-paste-subtree' is used to insert the subtree, see
 this function for details."
   :group 'org-edit-structure
   :type 'boolean)
 
 (defcustom org-M-RET-may-split-line '((default . t))
-  "Non-nil means, M-RET will split the line at the cursor position.
+  "Non-nil means M-RET will split the line at the cursor position.
 When nil, it will go to the end of the line before making a
 new line.
 You may also set this option in a different way for different
@@ -901,7 +1052,7 @@ default   the value to be used for all contexts not explicitly
 
 
 (defcustom org-insert-heading-respect-content nil
-  "Non-nil means, insert new headings after the current subtree.
+  "Non-nil means insert new headings after the current subtree.
 When nil, the new heading is created directly after the current line.
 The commands \\[org-insert-heading-respect-content] and
 \\[org-insert-todo-heading-respect-content] turn this variable on
@@ -933,16 +1084,15 @@ is ignored and no empty line is inserted, to keep the list in tact."
   :type 'hook)
 
 (defcustom org-enable-fixed-width-editor t
-  "Non-nil means, lines starting with \":\" are treated as fixed-width.
-This currently only means, they are never auto-wrapped.
+  "Non-nil means lines starting with \":\" are treated as fixed-width.
+This currently only means they are never auto-wrapped.
 When nil, such lines will be treated like ordinary lines.
 See also the QUOTE keyword."
   :group 'org-edit-structure
   :type 'boolean)
 
-
 (defcustom org-goto-auto-isearch t
-  "Non-nil means, typing characters in org-goto starts incremental search."
+  "Non-nil means typing characters in `org-goto' starts incremental search."
   :group 'org-edit-structure
   :type 'boolean)
 
@@ -952,14 +1102,14 @@ See also the QUOTE keyword."
   :group 'org-structure)
 
 (defcustom org-highlight-sparse-tree-matches t
-  "Non-nil means, highlight all matches that define a sparse tree.
+  "Non-nil means highlight all matches that define a sparse tree.
 The highlights will automatically disappear the next time the buffer is
 changed by an edit command."
   :group 'org-sparse-trees
   :type 'boolean)
 
 (defcustom org-remove-highlights-with-change t
-  "Non-nil means, any change to the buffer will remove temporary highlights.
+  "Non-nil means any change to the buffer will remove temporary highlights.
 Such highlights are created by `org-occur' and `org-clock-display'.
 When nil, `C-c C-c needs to be used to get rid of the highlights.
 The highlights created by `org-preview-latex-fragment' always need
@@ -993,7 +1143,7 @@ This also applied for speedbar access."
   :group 'org)
 
 (defcustom org-enable-table-editor 'optimized
-  "Non-nil means, lines starting with \"|\" are handled by the table editor.
+  "Non-nil means lines starting with \"|\" are handled by the table editor.
 When nil, such lines will be treated like ordinary lines.
 
 When equal to the symbol `optimized', the table editor will be optimized to
@@ -1032,7 +1182,7 @@ This is configurable, because there is some impact on typing performance."
   :type 'boolean)
 
 (defcustom org-table-tab-recognizes-table.el t
-  "Non-nil means, TAB will automatically notice a table.el table.
+  "Non-nil means TAB will automatically notice a table.el table.
 When it sees such a table, it moves point into it and - if necessary -
 calls `table-recognize-table'."
   :group 'org-table-editing
@@ -1077,7 +1227,7 @@ See the manual for examples."
            (function)))))
 
 (defcustom org-descriptive-links t
-  "Non-nil means, hide link part and only show description of bracket links.
+  "Non-nil means hide link part and only show description of bracket links.
 Bracket links are like [[link][description]].  This variable sets the initial
 state in new org-mode buffers.  The setting can then be toggled on a
 per-buffer basis from the Org->Hyperlinks menu."
@@ -1128,11 +1278,11 @@ Changing this variable requires a restart of Emacs to become effective."
              (const :tag "Footnotes" footnote)))
 
 (defcustom org-make-link-description-function nil
-  "Function to use to generate link descriptions from links. If
-nil the link location will be used. This function must take two
-parameters; the first is the link and the second the description
-org-insert-link has generated, and should return the description
-to use."
+  "Function to use to generate link descriptions from links.
+If nil the link location will be used.  This function must take
+two parameters; the first is the link and the second the
+description `org-insert-link' has generated, and should return the
+description to use."
   :group 'org-link
   :type 'function)
 
@@ -1174,7 +1324,7 @@ It should match if the message is from the user him/herself."
   :type 'regexp)
 
 (defcustom org-link-to-org-use-id 'create-if-interactive-and-no-custom-id
-  "Non-nil means, storing a link to an Org file will use entry IDs.
+  "Non-nil means storing a link to an Org file will use entry IDs.
 
 Note that before this variable is even considered, org-id must be loaded,
 so please customize `org-modules' and turn it on.
@@ -1214,7 +1364,7 @@ nil   Never use an ID to make a link, instead link using a text search for
          (const :tag "Do not use ID to create link" nil)))
 
 (defcustom org-context-in-file-links t
-  "Non-nil means, file links from `org-store-link' contain context.
+  "Non-nil means file links from `org-store-link' contain context.
 A search string will be added to the file name with :: as separator and
 used to find the context when the link is activated by the command
 `org-open-at-point'.
@@ -1224,7 +1374,7 @@ negates this setting for the duration of the command."
   :type 'boolean)
 
 (defcustom org-keep-stored-link-after-insertion nil
-  "Non-nil means, keep link in list for entire session.
+  "Non-nil means keep link in list for entire session.
 
 The command `org-store-link' adds a link pointing to the current
 location to an internal list.  These links accumulate during a session.
@@ -1261,7 +1411,7 @@ links created by planner."
   :type 'hook)
 
 (defcustom org-tab-follows-link nil
-  "Non-nil means, on links TAB will follow the link.
+  "Non-nil means on links TAB will follow the link.
 Needs to be set before org.el is loaded.
 This really should not be used, it does not make sense, and the
 implementation is bad."
@@ -1269,29 +1419,29 @@ implementation is bad."
   :type 'boolean)
 
 (defcustom org-return-follows-link nil
-  "Non-nil means, on links RET will follow the link.
-Needs to be set before org.el is loaded."
+  "Non-nil means on links RET will follow the link."
   :group 'org-link-follow
   :type 'boolean)
 
 (defcustom org-mouse-1-follows-link
   (if (boundp 'mouse-1-click-follows-link) mouse-1-click-follows-link t)
-  "Non-nil means, mouse-1 on a link will follow the link.
+  "Non-nil means mouse-1 on a link will follow the link.
 A longer mouse click will still set point.  Does not work on XEmacs.
 Needs to be set before org.el is loaded."
   :group 'org-link-follow
   :type 'boolean)
 
 (defcustom org-mark-ring-length 4
-  "Number of different positions to be recorded in the ring
+  "Number of different positions to be recorded in the ring.
 Changing this requires a restart of Emacs to work correctly."
   :group 'org-link-follow
   :type 'integer)
 
 (defcustom org-link-frame-setup
   '((vm . vm-visit-folder-other-frame)
-    (gnus . gnus-other-frame)
-    (file . find-file-other-window))
+    (gnus . org-gnus-no-new-news)
+    (file . find-file-other-window)
+    (wl . wl-other-frame))
   "Setup the frame configuration for following links.
 When following a link with Emacs, it may often be useful to display
 this link in another window or frame.  This variable can be used to
@@ -1307,6 +1457,9 @@ For FILE, use any of
     `find-file'
     `find-file-other-window'
     `find-file-other-frame'
+For Wanderlust use any of
+    `wl'
+    `wl-other-frame'
 For the calendar, use the variable `calendar-setup'.
 For BBDB, it is currently only possible to display the matches in
 another window."
@@ -1326,13 +1479,18 @@ another window."
                (choice
                 (const find-file)
                 (const find-file-other-window)
-                (const find-file-other-frame)))))
+                (const find-file-other-frame)))
+         (cons (const wl)
+               (choice
+                (const wl)
+                (const wl-other-frame)))))
 
 (defcustom org-display-internal-link-with-indirect-buffer nil
-  "Non-nil means, use indirect buffer to display infile links.
+  "Non-nil means use indirect buffer to display infile links.
 Activating internal links (from one location in a file to another location
 in the same file) normally just jumps to the location.  When the link is
-activated with a C-u prefix (or with mouse-3), the link is displayed in
+activated with a \\[universal-argument] prefix (or with mouse-3), the link \
+is displayed in
 another window.  When this option is set, the other window actually displays
 an indirect buffer clone of the current buffer, to avoid any visibility
 changes to the current buffer."
@@ -1340,7 +1498,7 @@ changes to the current buffer."
   :type 'boolean)
 
 (defcustom org-open-non-existing-files nil
-  "Non-nil means, `org-open-file' will open non-existing files.
+  "Non-nil means `org-open-file' will open non-existing files.
 When nil, an error will be generated.
 This variable applies only to external applications because they
 might choke on non-existing files.  If the link is to a file that
@@ -1349,7 +1507,7 @@ will be opened in Emacs, the variable is ignored."
   :type 'boolean)
 
 (defcustom org-open-directory-means-index-dot-org nil
-  "Non-nil means, a link to a directory really means to index.org.
+  "Non-nil means a link to a directory really means to index.org.
 When nil, following a directory link will run dired or open a finder/explorer
 window on that directory."
   :group 'org-link-follow
@@ -1357,7 +1515,7 @@ window on that directory."
 
 (defcustom org-link-mailto-program '(browse-url "mailto:%a?subject=%s")
   "Function and arguments to call for following mailto links.
-This is a list with the first element being a lisp function, and the
+This is a list with the first element being a Lisp function, and the
 remaining elements being arguments to the function.  In string arguments,
 %a will be replaced by the address, and %s will be replaced by the subject
 if one was given like in <mailto:arthur@galaxy.org::this subject>."
@@ -1369,7 +1527,7 @@ if one was given like in <mailto:arthur@galaxy.org::this subject>."
          (cons :tag "other" (function) (repeat :tag "argument" sexp))))
 
 (defcustom org-confirm-shell-link-function 'yes-or-no-p
-  "Non-nil means, ask for confirmation before executing shell links.
+  "Non-nil means ask for confirmation before executing shell links.
 Shell links can be dangerous: just think about a link
 
      [[shell:rm -rf ~/*][Google Search]]
@@ -1384,9 +1542,12 @@ single keystroke rather than having to type \"yes\"."
          (const :tag "with yes-or-no (safer)" yes-or-no-p)
          (const :tag "with y-or-n (faster)" y-or-n-p)
          (const :tag "no confirmation (dangerous)" nil)))
+(put 'org-confirm-shell-link-function
+     'safe-local-variable
+     '(lambda (x) (member x '(yes-or-no-p y-or-n-p))))
 
 (defcustom org-confirm-elisp-link-function 'yes-or-no-p
-  "Non-nil means, ask for confirmation before executing Emacs Lisp links.
+  "Non-nil means ask for confirmation before executing Emacs Lisp links.
 Elisp links can be dangerous: just think about a link
 
      [[elisp:(shell-command \"rm -rf ~/*\")][Google Search]]
@@ -1401,6 +1562,9 @@ single keystroke rather than having to type \"yes\"."
          (const :tag "with yes-or-no (safer)" yes-or-no-p)
          (const :tag "with y-or-n (faster)" y-or-n-p)
          (const :tag "no confirmation (dangerous)" nil)))
+(put 'org-confirm-shell-link-function
+     'safe-local-variable
+     '(lambda (x) (member x '(yes-or-no-p y-or-n-p))))
 
 (defconst org-file-apps-defaults-gnu
   '((remote . emacs)
@@ -1452,9 +1616,37 @@ you can use this variable to set the application for a given file
 extension.  The entries in this list are cons cells where the car identifies
 files and the cdr the corresponding command.  Possible values for the
 file identifier are
- \"regex\"     Regular expression matched against the file name.  For backward
-               compatibility, this can also be a string with only alphanumeric
-               characters, which is then interpreted as an extension.
+ \"string\"    A string as a file identifier can be interpreted in different
+               ways, depending on its contents:
+
+               - Alphanumeric characters only:
+                 Match links with this file extension.
+                 Example: (\"pdf\" . \"evince %s\")
+                          to open PDFs with evince.
+
+               - Regular expression: Match links where the
+                 filename matches the regexp.  If you want to
+                 use groups here, use shy groups.
+
+                 Example: (\"\\.x?html\\'\" . \"firefox %s\")
+                          (\"\\(?:xhtml\\|html\\)\" . \"firefox %s\")
+                          to open *.html and *.xhtml with firefox.
+
+               - Regular expression which contains (non-shy) groups:
+                 Match links where the whole link, including \"::\", and
+                 anything after that, matches the regexp.
+                 In a custom command string, %1, %2, etc. are replaced with
+                 the parts of the link that were matched by the groups.
+                 For backwards compatibility, if a command string is given
+                 that does not use any of the group matches, this case is
+                 handled identically to the second one (i.e. match against
+                 file name only).
+                 In a custom lisp form, you can access the group matches with
+                 (match-string n link).
+
+                 Example: (\"\\.pdf::\\(\\d+\\)\\'\" . \"evince -p %1 %s\")
+                     to open [[file:document.pdf::5]] with evince at page 5.
+
  `directory'   Matches a directory
  `remote'      Matches a remote file, accessible through tramp or efs.
                Remote files most likely should be visited through Emacs
@@ -1468,7 +1660,7 @@ file identifier are
  `system'      The system command to open files, like `open' on Windows
                and Mac OS X, and mailcap under GNU/Linux.  This is the command
                that will be selected if you call `C-c C-o' with a double
-               `C-u C-u' prefix.
+               \\[universal-argument] \\[universal-argument] prefix.
 
 Possible values for the command are:
  `emacs'       The file will be visited by the current Emacs process.
@@ -1507,6 +1699,8 @@ For more examples, see the system specific constants
                        (string :tag "Command")
                        (sexp :tag "Lisp form")))))
 
+
+
 (defgroup org-refile nil
   "Options concerning refiling entries in Org-mode."
   :tag "Org Refile"
@@ -1530,10 +1724,8 @@ following situations:
 
 (defcustom org-default-notes-file (convert-standard-filename "~/.notes")
   "Default target for storing notes.
-Used by the hooks for remember.el.  This can be a string, or nil to mean
-the value of `remember-data-file'.
-You can set this on a per-template basis with the variable
-`org-remember-templates'."
+Used as a fall back file for org-remember.el and org-capture.el, for
+templates that do not specify a target file."
   :group 'org-refile
   :group 'org-remember
   :type '(choice
@@ -1555,12 +1747,12 @@ outline-path-completion  Headlines in the current buffer are offered via
          (const :tag "Outline-path-completion" outline-path-completion)))
 
 (defcustom org-goto-max-level 5
-  "Maximum level to be considered when running org-goto with refile interface."
+  "Maximum target level when running `org-goto' with refile interface."
   :group 'org-refile
   :type 'integer)
 
 (defcustom org-reverse-note-order nil
-  "Non-nil means, store new notes at the beginning of a file or entry.
+  "Non-nil means store new notes at the beginning of a file or entry.
 When nil, new notes will be filed to the end of a file or entry.
 This can also be a list with cons cells of regular expressions that
 are matched against file names, and values."
@@ -1572,13 +1764,40 @@ are matched against file names, and values."
          (repeat :tag "By file name regexp"
                  (cons regexp boolean))))
 
+(defcustom org-log-refile nil
+  "Information to record when a task is refiled.
+
+Possible values are:
+
+nil     Don't add anything
+time    Add a time stamp to the task
+note    Prompt for a note and add it with template `org-log-note-headings'
+
+This option can also be set with on a per-file-basis with
+
+   #+STARTUP: nologrefile
+   #+STARTUP: logrefile
+   #+STARTUP: lognoterefile
+
+You can have local logging settings for a subtree by setting the LOGGING
+property to one or more of these keywords.
+
+When bulk-refiling from the agenda, the value `note' is forbidden and
+will temporarily be changed to `time'."
+  :group 'org-refile
+  :group 'org-progress
+  :type '(choice
+         (const :tag "No logging" nil)
+         (const :tag "Record timestamp" time)
+         (const :tag "Record timestamp with note." note)))
+
 (defcustom org-refile-targets nil
   "Targets for refiling entries with \\[org-refile].
 This is list of cons cells.  Each cell contains:
 - a specification of the files to be considered, either a list of files,
   or a symbol whose function or variable value will be used to retrieve
   a file name or a list of file names.  If you use `org-agenda-files' for
-  that, all agenda files will be scanned for targets.  Nil means, consider
+  that, all agenda files will be scanned for targets.  Nil means consider
   headings in the current buffer.
 - A specification of how to find candidate refile targets.  This may be
   any of:
@@ -1597,7 +1816,7 @@ This is list of cons cells.  Each cell contains:
     order in hierarchy, not to the number of stars.
 
 You can set the variable `org-refile-target-verify-function' to a function
-to verify each headline found by the simple critery above.
+to verify each headline found by the simple criteria above.
 
 When this variable is nil, all top-level headlines in the current buffer
 are used, equivalent to the value `((nil . (:level . 1))'."
@@ -1629,8 +1848,19 @@ of the subtree."
   :group 'org-refile
   :type 'function)
 
+(defcustom org-refile-use-cache nil
+  "Non-nil means cache refile targets to speed up the process.
+The cache for a particular file will be updated automatically when
+the buffer has been killed, or when any of the marker used for flagging
+refile targets no longer points at a live buffer.
+If you have added new entries to a buffer that might themselves be targets,
+you need to clear the cache manually by pressing `C-0 C-c C-w' or, if you
+find that easier, `C-u C-u C-u C-c C-w'."
+  :group 'org-refile
+  :type 'boolean)
+
 (defcustom org-refile-use-outline-path nil
-  "Non-nil means, provide refile targets as paths.
+  "Non-nil means provide refile targets as paths.
 So a level 3 headline will be available as level1/level2/level3.
 
 When the value is `file', also include the file name (without directory)
@@ -1646,7 +1876,7 @@ the file name, to get entries inserted as top level in the file.
          (const :tag "Start with full file path" full-file-path)))
 
 (defcustom org-outline-path-complete-in-steps t
-  "Non-nil means, complete the outline path in hierarchical steps.
+  "Non-nil means complete the outline path in hierarchical steps.
 When Org-mode uses the refile interface to select an outline path
 \(see variable `org-refile-use-outline-path'), the completion of
 the path can be done is a single go, or if can be done in steps down
@@ -1658,7 +1888,7 @@ fast, while still showing the whole path to the entry."
   :type 'boolean)
 
 (defcustom org-refile-allow-creating-parent-nodes nil
-  "Non-nil means, allow to create new nodes as refile targets.
+  "Non-nil means allow to create new nodes as refile targets.
 New nodes are then created by adding \"/new node name\" to the completion
 of an existing node.  When the value of this variable is `confirm',
 new node creation must be confirmed by the user (recommended)
@@ -1688,9 +1918,8 @@ heading."
   '(
     (:tag "Sequence (cycling hits every state)" sequence)
     (:tag "Type     (cycling directly to DONE)" type))
-  "The available interpretation symbols for customizing
- `org-todo-keywords'.
- Interested libraries should add to this list.")
+  "The available interpretation symbols for customizing `org-todo-keywords'.
+Interested libraries should add to this list.")
 
 (defcustom org-todo-keywords '((sequence "TODO" "DONE"))
   "List of TODO entry keyword sequences and their interpretation.
@@ -1716,7 +1945,7 @@ Each keyword can optionally specify a character for fast state selection
 \(in combination with the variable `org-use-fast-todo-selection')
 and specifiers for state change logging, using the same syntax
 that is used in the \"#+TODO:\" lines.  For example, \"WAIT(w)\" says
-that the WAIT state can be selected with the \"w\" key. \"WAIT(w!)\"
+that the WAIT state can be selected with the \"w\" key.  \"WAIT(w!)\"
 indicates to record a time stamp each time this state is selected.
 
 Each keyword may also specify if a timestamp or a note should be
@@ -1794,7 +2023,7 @@ more information."
                 (const type)))
 
 (defcustom org-use-fast-todo-selection t
-  "Non-nil means, use the fast todo selection scheme with C-c C-t.
+  "Non-nil means use the fast todo selection scheme with C-c C-t.
 This variable describes if and under what circumstances the cycling
 mechanism for TODO keywords will be replaced by a single-key, direct
 selection scheme.
@@ -1818,7 +2047,7 @@ by a letter in parenthesis, like TODO(t)."
          (const :tag "Only with C-u C-c C-t" prefix)))
 
 (defcustom org-provide-todo-statistics t
-  "Non-nil means, update todo statistics after insert and toggle.
+  "Non-nil means update todo statistics after insert and toggle.
 ALL-HEADLINES means update todo statistics by including headlines
 with no TODO keyword as well, counting them as not done.
 A list of TODO keywords means the same, but skip keywords that are
@@ -1835,7 +2064,7 @@ current entry each time a todo state is changed."
          (other :tag "No TODO statistics" nil)))
 
 (defcustom org-hierarchical-todo-statistics t
-  "Non-nil means, TODO statistics covers just direct children.
+  "Non-nil means TODO statistics covers just direct children.
 When nil, all entries in the subtree are considered.
 This has only an effect if `org-provide-todo-statistics' is set.
 To set this to nil for only a single subtree, use a COOKIE_DATA
@@ -1880,7 +2109,7 @@ TODO state changes
 :to    new state, like in :from")
 
 (defcustom org-enforce-todo-dependencies nil
-  "Non-nil means, undone TODO entries will block switching the parent to DONE.
+  "Non-nil means undone TODO entries will block switching the parent to DONE.
 Also, if a parent has an :ORDERED: property, switching an entry to DONE will
 be blocked if any prior sibling is not yet done.
 Finally, if the parent is blocked because of ordered siblings of its own,
@@ -1899,7 +2128,7 @@ to change is while Emacs is running is through the customize interface."
   :type 'boolean)
 
 (defcustom org-enforce-todo-checkbox-dependencies nil
-  "Non-nil means, unchecked boxes will block switching the parent to DONE.
+  "Non-nil means unchecked boxes will block switching the parent to DONE.
 When this is nil, checkboxes have no influence on switching TODO states.
 When non-nil, you first need to check off all check boxes before the TODO
 entry can be switched to DONE.
@@ -1917,7 +2146,7 @@ to change is while Emacs is running is through the customize interface."
   :type 'boolean)
 
 (defcustom org-treat-insert-todo-heading-as-state-change nil
-  "Non-nil means, inserting a TODO heading is treated as state change.
+  "Non-nil means inserting a TODO heading is treated as state change.
 So when the command \\[org-insert-todo-heading] is used, state change
 logging will apply if appropriate.  When nil, the new TODO item will
 be inserted directly, and no logging will take place."
@@ -1925,7 +2154,7 @@ be inserted directly, and no logging will take place."
   :type 'boolean)
 
 (defcustom org-treat-S-cursor-todo-selection-as-state-change t
-  "Non-nil means, switching TODO states with S-cursor counts as state change.
+  "Non-nil means switching TODO states with S-cursor counts as state change.
 This is the default behavior.  However, setting this to nil allows a
 convenient way to select a TODO state and bypass any logging associated
 with that."
@@ -2029,7 +2258,7 @@ property to one or more of these keywords."
          (const :tag "Record timestamp with note." note)))
 
 (defcustom org-log-note-clock-out nil
-  "Non-nil means, record a note when clocking out of an item.
+  "Non-nil means record a note when clocking out of an item.
 This can also be configured on a per-file basis by adding one of
 the following lines anywhere in the buffer:
 
@@ -2040,7 +2269,7 @@ the following lines anywhere in the buffer:
   :type 'boolean)
 
 (defcustom org-log-done-with-time t
-  "Non-nil means, the CLOSED time stamp will contain date and time.
+  "Non-nil means the CLOSED time stamp will contain date and time.
 When nil, only the date will be recorded."
   :group 'org-progress
   :type 'boolean)
@@ -2050,17 +2279,24 @@ When nil, only the date will be recorded."
     (state . "State %-12s from %-12S %t")
     (note .  "Note taken on %t")
     (reschedule .  "Rescheduled from %S on %t")
+    (delschedule .  "Not scheduled, was %S on %t")
     (redeadline .  "New deadline from %S on %t")
+    (deldeadline .  "Removed deadline, was %S on %t")
+    (refile . "Refiled on %t")
     (clock-out . ""))
   "Headings for notes added to entries.
 The value is an alist, with the car being a symbol indicating the note
 context, and the cdr is the heading to be used.  The heading may also be the
 empty string.
 %t in the heading will be replaced by a time stamp.
+%T will be an active time stamp instead the default inactive one
 %s will be replaced by the new TODO state, in double quotes.
 %S will be replaced by the old TODO state, in double quotes.
 %u will be replaced by the user name.
-%U will be replaced by the full user name."
+%U will be replaced by the full user name.
+
+In fact, it is not a good idea to change the `state' entry, because
+agenda log mode depends on the format of these entries."
   :group  'org-todo
   :group  'org-progress
   :type '(list :greedy t
@@ -2070,14 +2306,17 @@ empty string.
                       state) string)
          (cons (const :tag "Heading when just taking a note" note) string)
          (cons (const :tag "Heading when clocking out" clock-out) string)
+         (cons (const :tag "Heading when an item is no longer scheduled" delschedule) string)
          (cons (const :tag "Heading when rescheduling" reschedule) string)
-         (cons (const :tag "Heading when changing deadline" redeadline) string)))
+         (cons (const :tag "Heading when changing deadline"  redeadline) string)
+         (cons (const :tag "Heading when deleting a deadline" deldeadline) string)
+         (cons (const :tag "Heading when refiling" refile) string)))
 
 (unless (assq 'note org-log-note-headings)
   (push '(note . "%t") org-log-note-headings))
 
 (defcustom org-log-into-drawer nil
-  "Non-nil means, insert state change notes and time stamps into a drawer.
+  "Non-nil means insert state change notes and time stamps into a drawer.
 When nil, state changes notes will be inserted after the headline and
 any scheduling and clock lines, but not inside a drawer.
 
@@ -2113,7 +2352,7 @@ used instead of the default value."
      (t p))))
 
 (defcustom org-log-state-notes-insert-after-drawers nil
-  "Non-nil means, insert state change notes after any drawers in entry.
+  "Non-nil means insert state change notes after any drawers in entry.
 Only the drawers that *immediately* follow the headline and the
 deadline/scheduled line are skipped.
 When nil, insert notes right after the heading and perhaps the line
@@ -2126,16 +2365,25 @@ set."
   :type 'boolean)
 
 (defcustom org-log-states-order-reversed t
-  "Non-nil means, the latest state change note will be directly after heading.
-When nil, the notes will be orderer according to time."
+  "Non-nil means the latest state note will be directly after heading.
+When nil, the state change notes will be ordered according to time."
   :group 'org-todo
   :group 'org-progress
   :type 'boolean)
 
+(defcustom org-todo-repeat-to-state nil
+  "The TODO state to which a repeater should return the repeating task.
+By default this is the first task in a TODO sequence, or the previous state
+in a TODO_TYP set.  But you can specify another task here.
+alternatively, set the :REPEAT_TO_STATE: property of the entry."
+  :group 'org-todo
+  :type '(choice (const :tag "Head of sequence" nil)
+                (string :tag "Specific state")))
+
 (defcustom org-log-repeat 'time
-  "Non-nil means, record moving through the DONE state when triggering repeat.
+  "Non-nil means record moving through the DONE state when triggering repeat.
 An auto-repeating task is immediately switched back to TODO when
-marked DONE. If you are not logging state changes (by adding \"@\"
+marked DONE.  If you are not logging state changes (by adding \"@\"
 or \"!\" to the TODO keyword definition), or set `org-log-done' to
 record a closing note, there will be no record of the task moving
 through DONE. This variable forces taking a note anyway.
@@ -2166,7 +2414,7 @@ property to one or more of these keywords."
   :group 'org-todo)
 
 (defcustom org-enable-priority-commands t
-  "Non-nil means, priority commands are active.
+  "Non-nil means priority commands are active.
 When nil, these commands will be disabled, so that you never accidentally
 set a priority."
   :group 'org-priorities
@@ -2191,7 +2439,7 @@ This is the priority an item get if no explicit priority is given."
   :type 'character)
 
 (defcustom org-priority-start-cycle-with-default t
-  "Non-nil means, start with default priority when starting to cycle.
+  "Non-nil means start with default priority when starting to cycle.
 When this is nil, the first step in the cycle will be (depending on the
 command used) one higher or lower that the default priority."
   :group 'org-priorities
@@ -2203,7 +2451,7 @@ command used) one higher or lower that the default priority."
   :group 'org)
 
 (defcustom org-insert-labeled-timestamps-at-point nil
-  "Non-nil means, SCHEDULED and DEADLINE timestamps are inserted at point.
+  "Non-nil means SCHEDULED and DEADLINE timestamps are inserted at point.
 When nil, these labeled time stamps are forces into the second line of an
 entry, just after the headline.  When scheduling from the global TODO list,
 the time stamp will always be forced into the second line."
@@ -2224,12 +2472,12 @@ of N minutes, as given by the second value.
 When a setting is 0 or 1, insert the time unmodified.  Useful rounding
 numbers should be factors of 60, so for example 5, 10, 15.
 
-When this is larger than 1, you can still force an exact time-stamp by using
-a double prefix argument to a time-stamp command like `C-c .' or `C-c !',
+When this is larger than 1, you can still force an exact time stamp by using
+a double prefix argument to a time stamp command like `C-c .' or `C-c !',
 and by using a prefix arg to `S-up/down' to specify the exact number
 of minutes to shift."
   :group 'org-time
-  :get '(lambda (var) ; Make sure all entries have 5 elements
+  :get '(lambda (var) ; Make sure both elements are there
          (if (integerp (default-value var))
              (list (default-value var) 5)
            (default-value var)))
@@ -2244,7 +2492,7 @@ of minutes to shift."
              org-time-stamp-rounding-minutes)))
 
 (defcustom org-display-custom-times nil
-  "Non-nil means, overlay custom formats over all time stamps.
+  "Non-nil means overlay custom formats over all time stamps.
 The formats are defined through the variable `org-time-stamp-custom-formats'.
 To turn this on on a per-file basis, insert anywhere in the file:
    #+STARTUP: customtime"
@@ -2272,8 +2520,8 @@ commands, if custom time display is turned on at the time of export."
       f)))
 
 (defcustom org-time-clocksum-format "%d:%02d"
-  "The format string used when creating CLOCKSUM lines, or when
-org-mode generates a time duration."
+  "The format string used when creating CLOCKSUM lines.
+This is also used when org-mode generates a time duration."
   :group 'org-time
   :type 'string)
 
@@ -2301,11 +2549,11 @@ Custom commands can set this variable in the options section."
   :type 'integer)
 
 (defcustom org-read-date-prefer-future t
-  "Non-nil means, assume future for incomplete date input from user.
+  "Non-nil means assume future for incomplete date input from user.
 This affects the following situations:
 1. The user gives a month but not a year.
-   For example, if it is april and you enter \"feb 2\", this will be read
-   as feb 2, *next* year.  \"May 5\", however, will be this year.
+   For example, if it is April and you enter \"feb 2\", this will be read
+   as Feb 2, *next* year.  \"May 5\", however, will be this year.
 2. The user gives a day, but no month.
    For example, if today is the 15th, and you enter \"3\", Org-mode will
    read this as the third of *next* month.  However, if you enter \"17\",
@@ -2328,13 +2576,13 @@ used as defaults."
          (const :tag "Check month, day, and time" time)))
 
 (defcustom org-read-date-display-live t
-  "Non-nil means, display current interpretation of date prompt live.
+  "Non-nil means display current interpretation of date prompt live.
 This display will be in an overlay, in the minibuffer."
   :group 'org-time
   :type 'boolean)
 
 (defcustom org-read-date-popup-calendar t
-  "Non-nil means, pop up a calendar when prompting for a date.
+  "Non-nil means pop up a calendar when prompting for a date.
 In the calendar, the date can be selected with mouse-1.  However, the
 minibuffer will also be active, and you can simply enter the date as well.
 When nil, only the minibuffer will be available."
@@ -2367,13 +2615,13 @@ be the favorite working time of John Wiegley :-)"
   :type 'integer)
 
 (defcustom org-edit-timestamp-down-means-later nil
-  "Non-nil means, S-down will increase the time in a time stamp.
+  "Non-nil means S-down will increase the time in a time stamp.
 When nil, S-up will increase."
   :group 'org-time
   :type 'boolean)
 
 (defcustom org-calendar-follow-timestamp-change t
-  "Non-nil means, make the calendar window follow timestamp changes.
+  "Non-nil means make the calendar window follow timestamp changes.
 When a timestamp is modified and the calendar window is visible, it will be
 moved to the new date."
   :group 'org-time
@@ -2425,6 +2673,20 @@ To disable these tags on a per-file basis, insert anywhere in the file:
           (const :tag "End radio group" (:endgroup))
           (const :tag "New line" (:newline)))))
 
+(defcustom org-complete-tags-always-offer-all-agenda-tags nil
+  "If non-nil, always offer completion for all tags of all agenda files.
+Instead of customizing this variable directly, you might want to
+set it locally for remember buffers, because there no list of
+tags in that file can be created dynamically (there are none).
+
+  (add-hook 'org-remember-mode-hook
+            (lambda ()
+              (set (make-local-variable
+                    'org-complete-tags-always-offer-all-agenda-tags)
+                   t)))"
+  :group 'org-tags
+  :type 'boolean)
+
 (defvar org-file-tags nil
   "List of tags that can be inherited by all entries in the file.
 The tags will be inherited if the variable `org-use-tag-inheritance'
@@ -2432,7 +2694,7 @@ says they should be.
 This variable is populated from #+FILETAGS lines.")
 
 (defcustom org-use-fast-tag-selection 'auto
-  "Non-nil means, use fast tag selection scheme.
+  "Non-nil means use fast tag selection scheme.
 This is a special interface to select and deselect tags with single keys.
 When nil, fast selection is never used.
 When the symbol `auto', fast selection is used if and only if selection
@@ -2447,7 +2709,7 @@ automatically if necessary."
          (const :tag "When selection characters are configured" 'auto)))
 
 (defcustom org-fast-tag-selection-single-key nil
-  "Non-nil means, fast tag selection exits after first change.
+  "Non-nil means fast tag selection exits after first change.
 When nil, you have to press RET to exit it.
 During fast tag selection, you can toggle this flag with `C-c'.
 This variable can also have the value `expert'.  In this case, the window
@@ -2459,7 +2721,7 @@ displaying the tags menu is not even shown, until you press C-c again."
          (const :tag "Expert" expert)))
 
 (defvar org-fast-tag-selection-include-todo nil
-  "Non-nil means, fast tags selection interface will also offer TODO states.
+  "Non-nil means fast tags selection interface will also offer TODO states.
 This is an undocumented feature, you should not rely on it.")
 
 (defcustom org-tags-column (if (featurep 'xemacs) -76 -77)
@@ -2471,7 +2733,7 @@ it means that the tags should be flushright to that column.  For example,
   :type 'integer)
 
 (defcustom org-auto-align-tags t
-  "Non-nil means, realign tags after pro/demotion of TODO state change.
+  "Non-nil means realign tags after pro/demotion of TODO state change.
 These operations change the length of a headline and therefore shift
 the tags around.  With this options turned on, after each such operation
 the tags are again aligned to `org-tags-column'."
@@ -2479,7 +2741,7 @@ the tags are again aligned to `org-tags-column'."
   :type 'boolean)
 
 (defcustom org-use-tag-inheritance t
-  "Non-nil means, tags in levels apply also for sublevels.
+  "Non-nil means tags in levels apply also for sublevels.
 When nil, only the tags directly given in a specific line apply there.
 This may also be a list of tags that should be inherited, or a regexp that
 matches tags that should be inherited.  Additional control is possible
@@ -2541,7 +2803,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 function as a comparator."
   :group 'org-tags
   :type '(choice
          (const :tag "No sorting" nil)
@@ -2570,9 +2832,9 @@ lined-up with respect to each other."
   :type 'string)
 
 (defcustom org-use-property-inheritance nil
-  "Non-nil means, properties apply also for sublevels.
+  "Non-nil means properties apply also for sublevels.
 
-This setting is chiefly used during property searches. Turning it on can
+This setting is chiefly used during property searches.  Turning it on can
 cause significant overhead when doing a search, which is why it is not
 on by default.
 
@@ -2714,7 +2976,9 @@ If an entry is a directory, all files in that directory that are matched by
 
 If the value of the variable is not a list but a single file name, then
 the list of agenda files is actually stored and maintained in that file, one
-agenda file per line."
+agenda file per line.  In this file paths can be given relative to
+`org-directory'.  Tilde expansion and environment variable substitution
+are also made."
   :group 'org-agenda
   :type '(choice
          (repeat :tag "List of files and directories" file)
@@ -2832,13 +3096,19 @@ This is a property list with the following properties:
   :group 'org-latex
   :type 'plist)
 
+(defcustom org-format-latex-signal-error t
+  "Non-nil means signal an error when image creation of LaTeX snippets fails.
+When nil, just push out a message."
+  :group 'org-latex
+  :type 'boolean)
+
 (defcustom org-format-latex-header "\\documentclass{article}
-\\usepackage{amssymb}
 \\usepackage[usenames]{color}
 \\usepackage{amsmath}
-\\usepackage{latexsym}
 \\usepackage[mathscr]{eucal}
 \\pagestyle{empty}             % do not remove
+\[PACKAGES]
+\[DEFAULT-PACKAGES]
 % The settings below are copied from fullpage.sty
 \\setlength{\\textwidth}{\\paperwidth}
 \\addtolength{\\textwidth}{-3cm}
@@ -2854,25 +3124,111 @@ This is a property list with the following properties:
 \\addtolength{\\topmargin}{-2.54cm}"
   "The document header used for processing LaTeX fragments.
 It is imperative that this header make sure that no page number
-appears on the page."
+appears on the page.  The package defined in the variables
+`org-export-latex-default-packages-alist' and `org-export-latex-packages-alist'
+will either replace the placeholder \"[PACKAGES]\" in this header, or they
+will be appended."
   :group 'org-latex
   :type 'string)
 
-;; The following variable is defined here because is it also used
+(defvar org-format-latex-header-extra nil)
+
+(defun org-set-packages-alist (var val)
+  "Set the packages alist and make sure it has 3 elements per entry."
+  (set var (mapcar (lambda (x)
+                    (if (and (consp x) (= (length x) 2))
+                        (list (car x) (nth 1 x) t)
+                      x))
+                  val)))
+
+(defun org-get-packages-alist (var)
+
+  "Get the packages alist and make sure it has 3 elements per entry."
+  (mapcar (lambda (x)
+           (if (and (consp x) (= (length x) 2))
+               (list (car x) (nth 1 x) t)
+             x))
+         (default-value var)))
+
+;; The following variables are defined here because is it also used
 ;; when formatting latex fragments.  Originally it was part of the
 ;; LaTeX exporter, which is why the name includes "export".
+(defcustom org-export-latex-default-packages-alist
+  '(("AUTO" "inputenc"  t)
+    ("T1"   "fontenc"   t)
+    (""     "fixltx2e"  nil)
+    (""     "graphicx"  t)
+    (""     "longtable" nil)
+    (""     "float"     nil)
+    (""     "wrapfig"   nil)
+    (""     "soul"      t)
+    (""     "t1enc"     t)
+    (""     "textcomp"  t)
+    (""     "marvosym"  t)
+    (""     "wasysym"   t)
+    (""     "latexsym"  t)
+    (""     "amssymb"   t)
+    (""     "hyperref"  nil)
+    "\\tolerance=1000"
+    )
+  "Alist of default packages to be inserted in the header.
+Change this only if one of the packages here causes an incompatibility
+with another package you are using.
+The packages in this list are needed by one part or another of Org-mode
+to function properly.
+
+- inputenc, fontenc, t1enc: for basic font and character selection
+- textcomp, marvosymb, wasysym, latexsym, amssym: for various symbols used
+  for interpreting the entities in `org-entities'.  You can skip some of these
+  packages if you don't use any of the symbols in it.
+- graphicx: for including images
+- float, wrapfig: for figure placement
+- longtable: for long tables
+- hyperref: for cross references
+
+Therefore you should not modify this variable unless you know what you
+are doing.  The one reason to change it anyway is that you might be loading
+some other package that conflicts with one of the default packages.
+Each cell is of the format \( \"options\" \"package\" snippet-flag\).
+If SNIPPET-FLAG is t, the package also needs to be included when
+compiling LaTeX snippets into images for inclusion into HTML."
+  :group 'org-export-latex
+  :set 'org-set-packages-alist
+  :get 'org-get-packages-alist
+  :type '(repeat
+         (choice
+          (list :tag "options/package pair"
+                (string :tag "options")
+                (string :tag "package")
+                (boolean :tag "Snippet"))
+          (string :tag "A line of LaTeX"))))
+
 (defcustom org-export-latex-packages-alist nil
-  "Alist of packages to be inserted in the header.
-Each cell is of the format \( \"option\" . \"package\" \)."
+  "Alist of packages to be inserted in every LaTeX header.
+These will be inserted after `org-export-latex-default-packages-alist'.
+Each cell is of the format \( \"options\" \"package\" snippet-flag \).
+SNIPPET-FLAG, when t, indicates that this package is also needed when
+turning LaTeX snippets into images for inclusion into HTML.
+Make sure that you only list packages here which:
+- you want in every file
+- do not conflict with the default packages in
+  `org-export-latex-default-packages-alist'
+- do not conflict with the setup in `org-format-latex-header'."
   :group 'org-export-latex
+  :set 'org-set-packages-alist
+  :get 'org-get-packages-alist
   :type '(repeat
-         (list
-          (string :tag "option")
-          (string :tag "package"))))
+         (choice
+          (list :tag "options/package pair"
+                (string :tag "options")
+                (string :tag "package")
+                (boolean :tag "Snippet"))
+          (string :tag "A line of LaTeX"))))
 
-(defgroup org-font-lock nil
-  "Font-lock settings for highlighting in Org-mode."
-  :tag "Org Font Lock"
+
+(defgroup org-appearance nil
+  "Settings for Org-mode appearance."
+  :tag "Org Appearance"
   :group 'org)
 
 (defcustom org-level-color-stars-only nil
@@ -2880,11 +3236,11 @@ Each cell is of the format \( \"option\" . \"package\" \)."
 When nil, the entire headline is fontified.
 Changing it requires restart of `font-lock-mode' to become effective
 also in regions already fontified."
-  :group 'org-font-lock
+  :group 'org-appearance
   :type 'boolean)
 
 (defcustom org-hide-leading-stars nil
-  "Non-nil means, hide the first N-1 stars in a headline.
+  "Non-nil means hide the first N-1 stars in a headline.
 This works by using the face `org-hide' for these stars.  This
 face is white for a light background, and black for a dark
 background.  You may have to customize the face `org-hide' to
@@ -2896,42 +3252,70 @@ lines to the buffer:
 
    #+STARTUP: hidestars
    #+STARTUP: showstars"
-  :group 'org-font-lock
+  :group 'org-appearance
   :type 'boolean)
 
+(defcustom org-hidden-keywords nil
+  "List of keywords that should be hidden when typed in the org buffer.
+For example, add #+TITLE to this list in order to make the
+document title appear in the buffer without the initial #+TITLE:
+keyword."
+  :group 'org-appearance
+  :type '(set (const :tag "#+AUTHOR" author)
+             (const :tag "#+DATE" date)
+             (const :tag "#+EMAIL" email)
+             (const :tag "#+TITLE"  title)))
+
 (defcustom org-fontify-done-headline nil
-  "Non-nil means, change the face of a headline if it is marked DONE.
+  "Non-nil means change the face of a headline if it is marked DONE.
 Normally, only the TODO/DONE keyword indicates the state of a headline.
 When this is non-nil, the headline after the keyword is set to the
 `org-headline-done' as an additional indication."
-  :group 'org-font-lock
+  :group 'org-appearance
   :type 'boolean)
 
 (defcustom org-fontify-emphasized-text t
   "Non-nil means fontify *bold*, /italic/ and _underlined_ text.
 Changing this variable requires a restart of Emacs to take effect."
-  :group 'org-font-lock
+  :group 'org-appearance
   :type 'boolean)
 
 (defcustom org-fontify-whole-heading-line nil
   "Non-nil means fontify the whole line for headings.
 This is useful when setting a background color for the
 org-level-* faces."
-  :group 'org-font-lock
+  :group 'org-appearance
   :type 'boolean)
 
 (defcustom org-highlight-latex-fragments-and-specials nil
-  "Non-nil means, fontify what is treated specially by the exporters."
-  :group 'org-font-lock
+  "Non-nil means fontify what is treated specially by the exporters."
+  :group 'org-appearance
   :type 'boolean)
 
 (defcustom org-hide-emphasis-markers nil
   "Non-nil mean font-lock should hide the emphasis marker characters."
-  :group 'org-font-lock
+  :group 'org-appearance
+  :type 'boolean)
+
+(defcustom org-pretty-entities nil
+  "Non-nil means show entities as UTF8 characters.
+When nil, the \\name form remains in the buffer."
+  :group 'org-appearance
+  :type 'boolean)
+
+(defcustom org-pretty-entities-include-sub-superscripts t
+  "Non-nil means, pretty entity display includes formatting sub/superscripts."
+  :group 'org-appearance
   :type 'boolean)
 
 (defvar org-emph-re nil
-  "Regular expression for matching emphasis.")
+  "Regular expression for matching emphasis.
+After a match, the match groups contain these elements:
+1  The character before the proper match, or empty at beginning of line
+2  The proper match, including the leading and trailing markers
+3  The leading marker like * or /, indicating the type of highlighting
+4  The text between the emphasis markers, not including the markers
+5  The character after the match, empty at the end of a line")
 (defvar org-verbatim-re nil
   "Regular expression for matching verbatim text.")
 (defvar org-emphasis-regexp-components) ; defined just below
@@ -3008,7 +3392,7 @@ body-regexp  A regexp like \".\" to match a body character.  Don't use
 newline      The maximum number of newlines allowed in an emphasis exp.
 
 Use customize to modify this, or restart Emacs after changing it."
-  :group 'org-font-lock
+  :group 'org-appearance
   :set 'org-set-emph-re
   :type '(list
          (sexp    :tag "Allowed chars in pre      ")
@@ -3033,8 +3417,9 @@ example *bold*, _underlined_ and /italic/.  This variable sets the marker
 characters, the face to be used by font-lock for highlighting in Org-mode
 Emacs buffers, and the HTML tags to be used for this.
 For LaTeX export, see the variable `org-export-latex-emphasis-alist'.
+For DocBook export, see the variable `org-export-docbook-emphasis-alist'.
 Use customize to modify this, or restart Emacs after changing it."
-  :group 'org-font-lock
+  :group 'org-appearance
   :set 'org-set-emph-re
   :type '(repeat
          (list
@@ -3059,7 +3444,7 @@ This is needed for font-lock setup.")
   :group 'org)
 
 (defcustom org-completion-use-ido nil
-  "Non-nil means, use ido completion wherever possible.
+  "Non-nil means use ido completion wherever possible.
 Note that `ido-mode' must be active for this variable to be relevant.
 If you decide to turn this variable on, you might well want to turn off
 `org-outline-path-complete-in-steps'.
@@ -3068,7 +3453,7 @@ See also `org-completion-use-iswitchb'."
   :type 'boolean)
 
 (defcustom org-completion-use-iswitchb nil
-  "Non-nil means, use iswitchb completion wherever possible.
+  "Non-nil means use iswitchb completion wherever possible.
 Note that `iswitchb-mode' must be active for this variable to be relevant.
 If you decide to turn this variable on, you might well want to turn off
 `org-outline-path-complete-in-steps'.
@@ -3078,7 +3463,7 @@ Note that this variable has only an effect if `org-completion-use-ido' is nil."
 
 (defcustom org-completion-fallback-command 'hippie-expand
   "The expansion command called by \\[org-complete] in normal context.
-Normal means, no org-mode-specific context."
+Normal means no org-mode-specific context."
   :group 'org-completion
   :type 'function)
 
@@ -3128,6 +3513,7 @@ Normal means, no org-mode-specific context."
 (declare-function org-indent-mode "org-indent" (&optional arg))
 (declare-function parse-time-string "parse-time" (string))
 (declare-function org-attach-reveal "org-attach" (&optional if-exists))
+(declare-function org-export-latex-fix-inputenc "org-latex" ())
 (defvar remember-data-file)
 (defvar texmathp-why)
 (declare-function speedbar-line-directory "speedbar" (&optional depth))
@@ -3144,18 +3530,18 @@ Normal means, no org-mode-specific context."
 ;; by the functions setting up org-mode or checking for table context.
 
 (defconst org-table-any-line-regexp "^[ \t]*\\(|\\|\\+-[-+]\\)"
-  "Detects an org-type or table-type table.")
+  "Detect an org-type or table-type table.")
 (defconst org-table-line-regexp "^[ \t]*|"
-  "Detects an org-type table line.")
+  "Detect an org-type table line.")
 (defconst org-table-dataline-regexp "^[ \t]*|[^-]"
-  "Detects an org-type table line.")
+  "Detect an org-type table line.")
 (defconst org-table-hline-regexp "^[ \t]*|-"
-  "Detects an org-type table hline.")
+  "Detect an org-type table hline.")
 (defconst org-table1-hline-regexp "^[ \t]*\\+-[-+]"
-  "Detects a table-type table hline.")
+  "Detect a table-type table hline.")
 (defconst org-table-any-border-regexp "^[ \t]*[^|+ \t]"
-  "Searching from within a table (any type) this finds the first line
-outside the table.")
+  "Detect the first line outside a table when searching from within it.
+This works for both table types.")
 
 ;; Autoload the functions in org-table.el that are needed by functions here.
 
@@ -3182,7 +3568,9 @@ outside the table.")
    org-table-rotate-recalc-marks org-table-sort-lines org-table-sum
    org-table-toggle-coordinate-overlays
    org-table-toggle-formula-debugger org-table-wrap-region
-   orgtbl-mode turn-on-orgtbl org-table-to-lisp)))
+   orgtbl-mode turn-on-orgtbl org-table-to-lisp
+   orgtbl-to-generic orgtbl-to-tsv orgtbl-to-csv orgtbl-to-latex
+   orgtbl-to-orgtbl orgtbl-to-html orgtbl-to-texinfo)))
 
 (defun org-at-table-p (&optional table-type)
   "Return t if the cursor is inside an org-type table.
@@ -3222,7 +3610,7 @@ If TABLE-TYPE is non-nil, also check for table.el-type tables."
                    (message "recognizing table.el table...")
                    (table-recognize-table)
                    (message "recognizing table.el table...done")))
-             (error "This should not happen..."))
+             (error "This should not happen"))
            t)
        nil)
     nil))
@@ -3237,21 +3625,22 @@ If TABLE-TYPE is non-nil, also check for table.el-type tables."
 
 (defvar org-table-clean-did-remove-column nil)
 
-(defun org-table-map-tables (function)
+(defun org-table-map-tables (function &optional quietly)
   "Apply FUNCTION to the start of all tables in the buffer."
   (save-excursion
     (save-restriction
       (widen)
       (goto-char (point-min))
       (while (re-search-forward org-table-any-line-regexp nil t)
-       (message "Mapping tables: %d%%" (/ (* 100.0 (point)) (buffer-size)))
+       (unless quietly
+         (message "Mapping tables: %d%%" (/ (* 100.0 (point)) (buffer-size))))
        (beginning-of-line 1)
        (when (looking-at org-table-line-regexp)
          (save-excursion (funcall function))
          (or (looking-at org-table-line-regexp)
              (forward-char 1)))
        (re-search-forward org-table-any-border-regexp nil 1))))
-  (message "Mapping tables: done"))
+  (unless quietly (message "Mapping tables: done")))
 
 ;; Declare and autoload functions from org-exp.el  & Co
 
@@ -3267,16 +3656,27 @@ If TABLE-TYPE is non-nil, also check for table.el-type tables."
                '(org-export-as-ascii org-export-ascii-preprocess
                  org-export-as-ascii-to-buffer org-replace-region-by-ascii
                  org-export-region-as-ascii))
+  (org-autoload "org-latex"
+               '(org-export-as-latex-batch org-export-as-latex-to-buffer
+                  org-replace-region-by-latex org-export-region-as-latex
+                 org-export-as-latex org-export-as-pdf
+                 org-export-as-pdf-and-open))
   (org-autoload "org-html"
                '(org-export-as-html-and-open
                  org-export-as-html-batch org-export-as-html-to-buffer
                  org-replace-region-by-html org-export-region-as-html
                  org-export-as-html))
+  (org-autoload "org-docbook"
+               '(org-export-as-docbook-batch org-export-as-docbook-to-buffer
+                 org-replace-region-by-docbook org-export-region-as-docbook
+                 org-export-as-docbook-pdf org-export-as-docbook-pdf-and-open
+                 org-export-as-docbook))
   (org-autoload "org-icalendar"
                '(org-export-icalendar-this-file
                  org-export-icalendar-all-agenda-files
                  org-export-icalendar-combine-agenda-files))
-  (org-autoload "org-xoxo" '(org-export-as-xoxo)))
+  (org-autoload "org-xoxo" '(org-export-as-xoxo))
+  (org-autoload "org-beamer" '(org-beamer-mode org-beamer-sectioning)))
 
 ;; Declare and autoload functions from org-agenda.el
 
@@ -3294,6 +3694,11 @@ If TABLE-TYPE is non-nil, also check for table.el-type tables."
                '(org-remember-insinuate org-remember-annotation
    org-remember-apply-template org-remember org-remember-handler)))
 
+(eval-and-compile
+  (org-autoload "org-capture"
+               '(org-capture org-capture-insert-template-here
+                  org-capture-import-remember-templates)))
+
 ;; Autoload org-clock.el
 
 
@@ -3487,7 +3892,7 @@ get the proper fontification."
   :type 'string)
 
 (defcustom org-agenda-skip-archived-trees t
-  "Non-nil means, the agenda will skip any items located in archived trees.
+  "Non-nil means the agenda will skip any items located in archived trees.
 An archived tree is a tree marked with the tag ARCHIVE.  The use of this
 variable is no longer recommended, you should leave it at the value t.
 Instead, use the key `v' to cycle the archives-mode in the agenda."
@@ -3496,13 +3901,13 @@ Instead, use the key `v' to cycle the archives-mode in the agenda."
   :type 'boolean)
 
 (defcustom org-columns-skip-archived-trees t
-  "Non-nil means, ignore archived trees when creating column view."
+  "Non-nil means ignore archived trees when creating column view."
   :group 'org-archive
   :group 'org-properties
   :type 'boolean)
 
 (defcustom org-cycle-open-archived-trees nil
-  "Non-nil means, `org-cycle' will open archived trees.
+  "Non-nil means `org-cycle' will open archived trees.
 An archived tree is a tree marked with the tag ARCHIVE.
 When nil, archived trees will stay folded.  You can still open them with
 normal outline commands like `show-all', but not with the cycling commands."
@@ -3545,8 +3950,9 @@ collapsed state."
     (let* ((re (concat ":" org-archive-tag ":")))
       (goto-char beg)
       (while (re-search-forward re end t)
-       (and (org-on-heading-p) (org-flag-subtree t))
-       (org-end-of-subtree t)))))
+       (when (org-on-heading-p)
+         (org-flag-subtree t)
+         (org-end-of-subtree t))))))
 
 (defun org-flag-subtree (flag)
   (save-excursion
@@ -3659,11 +4065,14 @@ Also put tags into group 4 if tags are present.")
   "Matches any of the 3 keywords, together with the time stamp.")
 (make-variable-buffer-local 'org-keyword-time-not-clock-regexp)
 (defvar org-maybe-keyword-time-regexp nil
-  "Matches a timestamp, possibly preceeded by a keyword.")
+  "Matches a timestamp, possibly preceded by a keyword.")
 (make-variable-buffer-local 'org-maybe-keyword-time-regexp)
 (defvar org-planning-or-clock-line-re nil
   "Matches a line with planning or clock info.")
 (make-variable-buffer-local 'org-planning-or-clock-line-re)
+(defvar org-all-time-keywords nil
+  "List of time keywords.")
+(make-variable-buffer-local 'org-all-time-keywords)
 
 (defconst org-plain-time-of-day-regexp
   (concat
@@ -3735,6 +4144,9 @@ After a match, the following groups carry important information:
     ("logredeadline" org-log-redeadline time)
     ("lognoteredeadline" org-log-redeadline note)
     ("nologredeadline" org-log-redeadline nil)
+    ("logrefile" org-log-refile time)
+    ("lognoterefile" org-log-refile note)
+    ("nologrefile" org-log-refile nil)
     ("fninline" org-footnote-define-inline t)
     ("nofninline" org-footnote-define-inline nil)
     ("fnlocal" org-footnote-section nil)
@@ -3748,7 +4160,10 @@ After a match, the following groups carry important information:
     ("constSI" constants-unit-system SI)
     ("noptag" org-tag-persistent-alist nil)
     ("hideblocks" org-hide-block-startup t)
-    ("nohideblocks" org-hide-block-startup nil))
+    ("nohideblocks" org-hide-block-startup nil)
+    ("beamer" org-startup-with-beamer-mode t)
+    ("entitiespretty" org-pretty-entities t)
+    ("entitiesplain" org-pretty-entities nil))
   "Variable associated with STARTUP options for org-mode.
 Each element is a list of three items: The startup options as written
 in the #+STARTUP line, the corresponding variable, and the value to
@@ -3771,11 +4186,13 @@ means to push this value onto the list in the variable.")
     (let ((re (org-make-options-regexp
               '("CATEGORY" "TODO" "COLUMNS"
                 "STARTUP" "ARCHIVE" "FILETAGS" "TAGS" "LINK" "PRIORITIES"
-                "CONSTANTS" "PROPERTY" "DRAWERS" "SETUPFILE")
+                "CONSTANTS" "PROPERTY" "DRAWERS" "SETUPFILE" "LATEX_CLASS"
+                "OPTIONS")
               "\\(?:[a-zA-Z][0-9a-zA-Z_]*_TODO\\)"))
          (splitre "[ \t]+")
+         (scripts org-use-sub-superscripts)
          kwds kws0 kwsa key log value cat arch tags const links hw dws
-         tail sep kws1 prio props ftags drawers
+         tail sep kws1 prio props ftags drawers beamer-p
          ext-setup-or-nil setup-contents (start 0))
       (save-excursion
        (save-restriction
@@ -3788,10 +4205,9 @@ means to push this value onto the list in the variable.")
                          (re-search-forward re nil t)))
            (setq key (upcase (match-string 1 ext-setup-or-nil))
                  value (org-match-string-no-properties 2 ext-setup-or-nil))
+           (if (stringp value) (setq value (org-trim value)))
            (cond
             ((equal key "CATEGORY")
-             (if (string-match "[ \t]+$" value)
-                 (setq value (replace-match "" t t value)))
              (setq cat value))
             ((member key '("SEQ_TODO" "TODO"))
              (push (cons 'sequence (org-split-string value splitre)) kwds))
@@ -3842,10 +4258,14 @@ means to push this value onto the list in the variable.")
                      (set (make-local-variable var) (symbol-value var))
                      (add-to-list var val))))))
             ((equal key "ARCHIVE")
-             (string-match " *$" value)
-             (setq arch (replace-match "" t t value))
+             (setq arch value)
              (remove-text-properties 0 (length arch)
                                      '(face t fontified t) arch))
+            ((equal key "LATEX_CLASS")
+             (setq beamer-p (equal value "beamer")))
+            ((equal key "OPTIONS")
+             (if (string-match "\\([ \t]\\|\\`\\)\\^:\\(t\\|nil\\|{}\\)" value)
+                 (setq scripts (read (match-string 2 value)))))
             ((equal key "SETUPFILE")
              (setq setup-contents (org-file-contents
                                    (expand-file-name
@@ -3858,6 +4278,7 @@ means to push this value onto the list in the variable.")
                              "\n" setup-contents "\n"
                              (substring ext-setup-or-nil start)))))
             ))))
+      (org-set-local 'org-use-sub-superscripts scripts)
       (when cat
        (org-set-local 'org-category (intern cat))
        (push (cons "CATEGORY" cat) props))
@@ -3984,7 +4405,11 @@ means to push this value onto the list in the variable.")
            org-complex-heading-regexp-format
            (concat "^\\(\\*+\\)[ \t]+\\(?:\\("
                    (mapconcat 'regexp-quote org-todo-keywords-1 "\\|")
-                   "\\)\\>\\)?\\(?:[ \t]*\\(\\[#.\\]\\)\\)?[ \t]*\\(%s\\)"
+                   "\\)\\>\\)?"
+                   "\\(?:[ \t]*\\(\\[#.\\]\\)\\)?"
+                   "\\(?:[ \t]*\\(?:\\[[0-9%%/]+\\]\\)\\)?" ;; stats cookie
+                   "[ \t]*\\(%s\\)"
+                   "\\(?:[ \t]*\\(?:\\[[0-9%%/]+\\]\\)\\)?" ;; stats cookie
                    "\\(?:[ \t]+\\(:[[:alnum:]_@:]+:\\)\\)?[ \t]*$")
            org-nl-done-regexp
            (concat "\n\\*+[ \t]+"
@@ -4033,6 +4458,10 @@ means to push this value onto the list in the variable.")
                    "\\|" org-deadline-string
                    "\\|" org-closed-string "\\|" org-clock-string
                    "\\)\\>\\)")
+           org-all-time-keywords
+           (mapcar (lambda (w) (substring w 0 -1))
+                   (list org-scheduled-string org-deadline-string
+                         org-clock-string org-closed-string))
            )
       (org-compute-latex-and-specials-regexp)
       (org-set-font-lock-defaults))))
@@ -4043,10 +4472,10 @@ means to push this value onto the list in the variable.")
          (not (file-readable-p file)))
       (if noerror
          (progn
-           (message "Cannot read file %s" file)
+           (message "Cannot read file \"%s\"" file)
            (ding) (sit-for 2)
            "")
-       (error "Cannot read file %s" file))
+       (error "Cannot read file \"%s\"" file))
     (with-temp-buffer
       (insert-file-contents file)
       (buffer-string))))
@@ -4073,30 +4502,24 @@ This will extract info from a string like \"WAIT(w@/!)\"."
              x))
          list))
 
-;; FIXME: this could be done much better, using second characters etc.
 (defun org-assign-fast-keys (alist)
   "Assign fast keys to a keyword-key alist.
 Respect keys that are already there."
-  (let (new e k c c1 c2 (char ?a))
+  (let (new e (alt ?0))
     (while (setq e (pop alist))
-      (cond
-       ((equal e '(:startgroup)) (push e new))
-       ((equal e '(:endgroup)) (push e new))
-       ((equal e '(:newline)) (push e new))
-       (t
-       (setq k (car e) c2 nil)
-       (if (cdr e)
-           (setq c (cdr e))
-         ;; automatically assign a character.
-         (setq c1 (string-to-char
-                   (downcase (substring
-                              k (if (= (string-to-char k) ?@) 1 0)))))
-         (if (or (rassoc c1 new) (rassoc c1 alist))
-             (while (or (rassoc char new) (rassoc char alist))
-               (setq char (1+ char)))
-           (setq c2 c1))
-         (setq c (or c2 char)))
-       (push (cons k c) new))))
+      (if (or (memq (car e) '(:newline :endgroup :startgroup))
+             (cdr e)) ;; Key already assigned.
+         (push e new)
+       (let ((clist (string-to-list (downcase (car e))))
+             (used (append new alist)))
+         (when (= (car clist) ?@)
+           (pop clist))
+         (while (and clist (rassoc (car clist) used))
+           (pop clist))
+         (unless clist
+           (while (rassoc alt used)
+             (incf alt)))
+         (push (cons (car e) (or (car clist) alt)) new))))
     (nreverse new)))
 
 ;;; Some variables used in various places
@@ -4117,7 +4540,7 @@ This is for getting out of special buffers like remember.")
 (defvar date)
 
 ;; Defined somewhere in this file, but used before definition.
-(defvar org-html-entities)
+(defvar org-entities)     ;; defined in org-entities.el
 (defvar org-struct-menu)
 (defvar org-org-menu)
 (defvar org-tbl-menu)
@@ -4125,7 +4548,7 @@ This is for getting out of special buffers like remember.")
 ;;;; Define the Org-mode
 
 (if (and (not (keymapp outline-mode-map)) (featurep 'allout))
-    (error "Conflict with outdated version of allout.el.  Load org.el before allout.el, or upgrade to newer allout, for example by switching to Emacs 22."))
+    (error "Conflict with outdated version of allout.el.  Load org.el before allout.el, or upgrade to newer allout, for example by switching to Emacs 22"))
 
 
 ;; We use a before-change function to check if a table might need
@@ -4139,6 +4562,7 @@ This variable is set by `org-before-change-function'.
   (setq org-table-may-need-update t))
 (defvar org-mode-map)
 (defvar org-inhibit-startup nil)        ; Dynamically-scoped param.
+(defvar org-inhibit-startup-visibility-stuff nil) ; Dynamically-scoped param.
 (defvar org-agenda-keep-modes nil)      ; Dynamically-scoped param.
 (defvar org-inhibit-logging nil)        ; Dynamically-scoped param.
 (defvar org-inhibit-blocking nil)       ; Dynamically-scoped param.
@@ -4171,7 +4595,7 @@ The following commands are available:
   ;; we switch another buffer into org-mode.
   (if (featurep 'xemacs)
       (when (boundp 'outline-mode-menu-heading)
-       ;; Assume this is Greg's port, it used easymenu
+       ;; Assume this is Greg's port, it uses easymenu
        (easy-menu-remove outline-mode-menu-heading)
        (easy-menu-remove outline-mode-menu-show)
        (easy-menu-remove outline-mode-menu-hide))
@@ -4183,9 +4607,9 @@ The following commands are available:
   (easy-menu-add org-org-menu)
   (easy-menu-add org-tbl-menu)
   (org-install-agenda-files-menu)
-  (if org-descriptive-links (org-add-to-invisibility-spec '(org-link)))
-  (org-add-to-invisibility-spec '(org-cwidth))
-  (org-add-to-invisibility-spec '(org-hide-block . t))
+  (if org-descriptive-links (add-to-invisibility-spec '(org-link)))
+  (add-to-invisibility-spec '(org-cwidth))
+  (add-to-invisibility-spec '(org-hide-block . t))
   (when (featurep 'xemacs)
     (org-set-local 'line-move-ignore-invisible t))
   (org-set-local 'outline-regexp org-outline-regexp)
@@ -4208,7 +4632,6 @@ The following commands are available:
     (org-set-tag-faces 'org-tag-faces org-tag-faces))
   ;; Calc embedded
   (org-set-local 'calc-embedded-open-mode "# ")
-  (modify-syntax-entry ?# "<")
   (modify-syntax-entry ?@ "w")
   (if org-startup-truncated (setq truncate-lines t))
   (org-set-local 'font-lock-unfontify-region-function
@@ -4223,6 +4646,9 @@ The following commands are available:
   (org-set-autofill-regexps)
   (setq indent-line-function 'org-indent-line-function)
   (org-update-radio-target-regexp)
+  ;; Beginning/end of defun
+  (org-set-local 'beginning-of-defun-function 'org-beginning-of-defun)
+  (org-set-local 'end-of-defun-function 'org-end-of-defun)
   ;; Make sure dependence stuff works reliably, even for users who set it
   ;; too late :-(
   (if org-enforce-todo-dependencies
@@ -4237,7 +4663,7 @@ The following commands are available:
                 'org-block-todo-from-checkboxes))
 
   ;; Comment characters
-;  (org-set-local 'comment-start "#") ;; FIXME: this breaks wrapping
+  (org-set-local 'comment-start "#")
   (org-set-local 'comment-padding " ")
 
   ;; Align options lines
@@ -4260,21 +4686,24 @@ The following commands are available:
     (org-set-local 'outline-isearch-open-invisible-function
                   (lambda (&rest ignore) (org-show-context 'isearch))))
 
+  ;; Turn on org-beamer-mode?
+  (and org-startup-with-beamer-mode (org-beamer-mode 1))
+
   ;; If empty file that did not turn on org-mode automatically, make it to.
   (if (and org-insert-mode-line-in-empty-file
           (interactive-p)
           (= (point-min) (point-max)))
       (insert "#    -*- mode: org -*-\n\n"))
-
   (unless org-inhibit-startup
     (when org-startup-align-all-tables
       (let ((bmp (buffer-modified-p)))
-       (org-table-map-tables 'org-table-align)
+       (org-table-map-tables 'org-table-align 'quietly)
        (set-buffer-modified-p bmp)))
     (when org-startup-indented
       (require 'org-indent)
       (org-indent-mode 1))
-    (org-set-startup-visibility)))
+    (unless org-inhibit-startup-visibility-stuff
+      (org-set-startup-visibility))))
 
 (when (fboundp 'abbrev-table-put)
   (abbrev-table-put org-mode-abbrev-table
@@ -4295,10 +4724,8 @@ The following commands are available:
 ;;;; Font-Lock stuff, including the activators
 
 (defvar org-mouse-map (make-sparse-keymap))
-(org-defkey org-mouse-map
-  (if (featurep 'xemacs) [button2] [mouse-2]) 'org-open-at-mouse)
-(org-defkey org-mouse-map
-  (if (featurep 'xemacs) [button3] [mouse-3]) 'org-find-file-at-mouse)
+(org-defkey org-mouse-map [mouse-2] 'org-open-at-mouse)
+(org-defkey org-mouse-map [mouse-3] 'org-find-file-at-mouse)
 (when org-mouse-1-follows-link
   (org-defkey org-mouse-map [follow-link] 'mouse-face))
 (when org-tab-follows-link
@@ -4309,7 +4736,7 @@ The following commands are available:
 
 (defconst org-non-link-chars "]\t\n\r<>")
 (defvar org-link-types '("http" "https" "ftp" "mailto" "file" "news"
-                          "shell" "elisp"))
+                          "shell" "elisp" "doi"))
 (defvar org-link-types-re nil
    "Matches a link that has a url-like prefix like \"http:\"")
 (defvar org-link-re-with-space nil
@@ -4333,49 +4760,91 @@ Here is what the match groups contain after a match:
 4: [desc]
 5: desc")
 (defvar org-bracket-link-analytic-regexp++ nil
-  "Like org-bracket-link-analytic-regexp, but include coderef internal type.")
+  "Like `org-bracket-link-analytic-regexp', but include coderef internal type.")
 (defvar org-any-link-re nil
   "Regular expression matching any link.")
 
+(defcustom org-match-sexp-depth 3
+  "Number of stacked braces for sub/superscript matching.
+This has to be set before loading org.el to be effective."
+  :group 'org-export-translation ; ??????????????????????????/
+  :type 'integer)
+
+(defun org-create-multibrace-regexp (left right n)
+  "Create a regular expression which will match a balanced sexp.
+Opening delimiter is LEFT, and closing delimiter is RIGHT, both given
+as single character strings.
+The regexp returned will match the entire expression including the
+delimiters.  It will also define a single group which contains the
+match except for the outermost delimiters.  The maximum depth of
+stacked delimiters is N.  Escaping delimiters is not possible."
+  (let* ((nothing (concat "[^" left right "]*?"))
+        (or "\\|")
+        (re nothing)
+        (next (concat "\\(?:" nothing left nothing right "\\)+" nothing)))
+    (while (> n 1)
+      (setq n (1- n)
+           re (concat re or next)
+           next (concat "\\(?:" nothing left next right "\\)+" nothing)))
+    (concat left "\\(" re "\\)" right)))
+
+(defvar org-match-substring-regexp
+  (concat
+   "\\([^\\]\\)\\([_^]\\)\\("
+   "\\(" (org-create-multibrace-regexp "{" "}" org-match-sexp-depth) "\\)"
+   "\\|"
+   "\\(" (org-create-multibrace-regexp "(" ")" org-match-sexp-depth) "\\)"
+   "\\|"
+   "\\(\\(?:\\*\\|[-+]?[^-+*!@#$%^_ \t\r\n,:\"?<>~;./{}=()]+\\)\\)\\)")
+  "The regular expression matching a sub- or superscript.")
+
+(defvar org-match-substring-with-braces-regexp
+  (concat
+   "\\([^\\]\\)\\([_^]\\)\\("
+   "\\(" (org-create-multibrace-regexp "{" "}" org-match-sexp-depth) "\\)"
+   "\\)")
+  "The regular expression matching a sub- or superscript, forcing braces.")
+
 (defun org-make-link-regexps ()
   "Update the link regular expressions.
 This should be called after the variable `org-link-types' has changed."
   (setq org-link-types-re
        (concat
-        "\\`\\(" (mapconcat 'identity org-link-types "\\|") "\\):")
+        "\\`\\(" (mapconcat 'regexp-quote org-link-types "\\|") "\\):")
        org-link-re-with-space
        (concat
-        "<?\\(" (mapconcat 'identity org-link-types "\\|") "\\):"
+        "<?\\(" (mapconcat 'regexp-quote org-link-types "\\|") "\\):"
         "\\([^" org-non-link-chars " ]"
         "[^" org-non-link-chars "]*"
         "[^" org-non-link-chars " ]\\)>?")
        org-link-re-with-space2
        (concat
-        "<?\\(" (mapconcat 'identity org-link-types "\\|") "\\):"
+        "<?\\(" (mapconcat 'regexp-quote org-link-types "\\|") "\\):"
         "\\([^" org-non-link-chars " ]"
         "[^\t\n\r]*"
         "[^" org-non-link-chars " ]\\)>?")
        org-link-re-with-space3
        (concat
-        "<?\\(" (mapconcat 'identity org-link-types "\\|") "\\):"
+        "<?\\(" (mapconcat 'regexp-quote org-link-types "\\|") "\\):"
         "\\([^" org-non-link-chars " ]"
         "[^\t\n\r]*\\)")
        org-angle-link-re
        (concat
-        "<\\(" (mapconcat 'identity org-link-types "\\|") "\\):"
+        "<\\(" (mapconcat 'regexp-quote org-link-types "\\|") "\\):"
         "\\([^" org-non-link-chars " ]"
         "[^" org-non-link-chars "]*"
         "\\)>")
        org-plain-link-re
        (concat
-        "\\<\\(" (mapconcat 'identity org-link-types "\\|") "\\):"
-        "\\([^]\t\n\r<>() ]+[^]\t\n\r<>,.;() ]\\)")
+        "\\<\\(" (mapconcat 'regexp-quote org-link-types "\\|") "\\):"
+        (org-re "\\([^ \t\n()<>]+\\(?:([[:word:]0-9]+)\\|\\([^[:punct:] \t\n]\\|/\\)\\)\\)"))
+       ;;       "\\([^]\t\n\r<>() ]+[^]\t\n\r<>,.;() ]\\)")
        org-bracket-link-regexp
        "\\[\\[\\([^][]+\\)\\]\\(\\[\\([^][]+\\)\\]\\)?\\]"
        org-bracket-link-analytic-regexp
        (concat
         "\\[\\["
-        "\\(\\(" (mapconcat 'identity org-link-types "\\|") "\\):\\)?"
+        "\\(\\(" (mapconcat 'regexp-quote org-link-types "\\|") "\\):\\)?"
         "\\([^]]+\\)"
         "\\]"
         "\\(\\[" "\\([^]]+\\)" "\\]\\)?"
@@ -4383,7 +4852,7 @@ This should be called after the variable `org-link-types' has changed."
        org-bracket-link-analytic-regexp++
        (concat
         "\\[\\["
-        "\\(\\(" (mapconcat 'identity (cons "coderef" org-link-types) "\\|") "\\):\\)?"
+        "\\(\\(" (mapconcat 'regexp-quote (cons "coderef" org-link-types) "\\|") "\\):\\)?"
         "\\([^]]+\\)"
         "\\]"
         "\\(\\[" "\\([^]]+\\)" "\\]\\)?"
@@ -4440,7 +4909,7 @@ The time stamps may be either active or inactive.")
                 (org-remove-flyspell-overlays-in
                  (match-beginning 0) (match-end 0)))
            (add-text-properties (match-beginning 2) (match-end 2)
-                                '(font-lock-multiline t))
+                                '(font-lock-multiline t org-emphasis t))
            (when org-hide-emphasis-markers
              (add-text-properties (match-end 4) (match-beginning 5)
                                   '(invisible org-link))
@@ -4495,8 +4964,9 @@ will be prompted for."
                (string-match (concat "[" (nth 0 erc) "\n]")
                              (char-to-string (char-before (point)))))
       (insert " "))
-    (unless (string-match (concat "[" (nth 1 erc) "\n]")
-                         (char-to-string (char-after (point))))
+    (unless (or (eobp)
+               (string-match (concat "[" (nth 1 erc) "\n]")
+                             (char-to-string (char-after (point)))))
       (insert " ") (backward-char 1))
     (insert string)
     (and move (backward-char 1))))
@@ -4556,7 +5026,7 @@ will be prompted for."
                                 '(font-lock-fontified t face org-block))
            t)
           ((and (match-end 4) (equal dc3 "begin"))
-           ;; Truely a block
+           ;; Truly a block
            (setq block-type (downcase (match-string 5))
                  quoting (member block-type org-protecting-blocks))
            (when (re-search-forward
@@ -4574,11 +5044,23 @@ will be prompted for."
              (cond
               (quoting
                (add-text-properties beg1 end1 '(face org-block)))
+              ((not org-fontify-quote-and-verse-blocks))
               ((string= block-type "quote")
                (add-text-properties beg1 end1 '(face org-quote)))
               ((string= block-type "verse")
                (add-text-properties beg1 end1 '(face org-verse))))
              t))
+          ((member dc1 '("title:" "author:" "email:" "date:"))
+           (add-text-properties
+            beg (match-end 3)
+            (if (member (intern (substring dc1 0 -1)) org-hidden-keywords)
+                '(font-lock-fontified t invisible t)
+              '(font-lock-fontified t face org-document-info-keyword)))
+           (add-text-properties
+            (match-beginning 6) (match-end 6)
+            (if (string-equal dc1 "title:")
+                '(font-lock-fontified t face org-document-title)
+              '(font-lock-fontified t face org-document-info))))
           ((not (member (char-after beg) '(?\  ?\t)))
            ;; just any other in-buffer setting, but not indented
            (add-text-properties
@@ -4586,7 +5068,8 @@ will be prompted for."
             '(font-lock-fontified t face org-meta-line))
            t)
           ((or (member dc1 '("begin:" "end:" "caption:" "label:"
-                             "orgtbl:" "tblfm:" "tblname:"))
+                             "orgtbl:" "tblfm:" "tblname:" "result:"
+                             "results:" "source:" "srcname:" "call:"))
                (and (match-end 4) (equal dc3 "attr")))
            (add-text-properties
             beg (match-end 0)
@@ -4742,6 +5225,7 @@ will be prompted for."
        ((matchers (plist-get org-format-latex-options :matchers))
         (latexs (delq nil (mapcar (lambda (x) (if (member (car x) matchers) x))
                                   org-latex-regexps)))
+        (org-export-allow-BIND nil)
         (options (org-combine-plists (org-default-export-plist)
                                      (org-infile-export-plist)))
         (org-export-with-sub-superscripts (plist-get options :sub-superscript))
@@ -4763,12 +5247,17 @@ will be prompted for."
          (if org-export-with-TeX-macros
              (list (concat "\\\\"
                            (regexp-opt
-                            (append (mapcar 'car org-html-entities)
-                                    (if (boundp 'org-latex-entities)
-                                        (mapcar (lambda (x)
-                                                  (or (car-safe x) x))
-                                                org-latex-entities)
-                                      nil))
+                            (append
+
+                             (delq nil
+                                   (mapcar 'car-safe
+                                           (append org-entities-user
+                                                   org-entities)))
+                             (if (boundp 'org-latex-entities)
+                                 (mapcar (lambda (x)
+                                           (or (car-safe x) x))
+                                         org-latex-entities)
+                               nil))
                             'words))) ; FIXME
            ))
     ;;                 (list "\\\\\\(?:[a-zA-Z]+\\)")))
@@ -4807,7 +5296,7 @@ will be prompted for."
       rtn)))
 
 (defun org-restart-font-lock ()
-  "Restart font-lock-mode, to force refontification."
+  "Restart `font-lock-mode', to force refontification."
   (when (and (boundp 'font-lock-mode) font-lock-mode)
     (font-lock-mode -1)
     (font-lock-mode 1)))
@@ -4842,7 +5331,7 @@ between words."
 (defun org-activate-tags (limit)
   (if (re-search-forward (org-re "^\\*+.*[ \t]\\(:[[:alnum:]_@:]+:\\)[ \r\n]") limit t)
       (progn
-       (org-remove-flyspell-overlays-in (match-beginning 0) (match-end 0))
+       (org-remove-flyspell-overlays-in (match-beginning 1) (match-end 1))
        (add-text-properties (match-beginning 1) (match-end 1)
                             (list 'mouse-face 'highlight
                                   'keymap org-mouse-map))
@@ -4852,7 +5341,7 @@ between words."
 (defun org-outline-level ()
   "Compute the outline level of the heading at point.
 This function assumes that the cursor is at the beginning of a line matched
-by outline-regexp.  Otherwise it returns garbage.
+by `outline-regexp'.  Otherwise it returns garbage.
 If this is called at a normal headline, the level is the number of stars.
 Use `org-reduced-level' to remove the effect of `org-odd-levels'.
 For plain list items, if they are matched by `outline-regexp', this returns
@@ -4952,6 +5441,8 @@ For plain list items, if they are matched by `outline-regexp', this returns
                 '(1 'org-archived prepend))
           ;; Specials
           '(org-do-latex-and-special-faces)
+          '(org-fontify-entities)
+          '(org-raise-scripts)
           ;; Code
           '(org-activate-code (1 'org-code t))
           ;; COMMENT
@@ -4969,8 +5460,41 @@ For plain list items, if they are matched by `outline-regexp', this returns
                   '(org-font-lock-keywords t nil nil backward-paragraph))
     (kill-local-variable 'font-lock-keywords) nil))
 
+(defun org-toggle-pretty-entities ()
+  "Toggle the composition display of entities as UTF8 characters."
+  (interactive)
+  (org-set-local 'org-pretty-entities (not org-pretty-entities))
+  (org-restart-font-lock)
+  (if org-pretty-entities
+      (message "Entities are displayed as UTF8 characers")
+    (save-restriction
+      (widen)
+      (decompose-region (point-min) (point-max))
+      (message "Entities are displayed plain"))))
+
+(defun org-fontify-entities (limit)
+  "Find an entity to fontify."
+  (let (ee)
+    (when org-pretty-entities
+      (catch 'match
+       (while (re-search-forward
+               "\\\\\\([a-zA-Z][a-zA-Z0-9]*\\)\\($\\|[^[:alnum:]\n]\\)"
+               limit t)
+         (if (and (not (org-in-indented-comment-line))
+                  (setq ee (org-entity-get (match-string 1)))
+                  (= (length (nth 6 ee)) 1))
+             (progn
+               (add-text-properties
+                (match-beginning 0) (match-end 1)
+                (list 'font-lock-fontified t))
+               (compose-region (match-beginning 0) (match-end 1)
+                               (nth 6 ee) nil)
+               (backward-char 1)
+               (throw 'match t))))
+       nil))))
+
 (defun org-fontify-like-in-org-mode (s &optional odd-levels)
-  "Fontify string S like in Org-mode"
+  "Fontify string S like in Org-mode."
   (with-temp-buffer
     (insert s)
     (let ((org-odd-levels-only odd-levels))
@@ -4995,10 +5519,20 @@ For plain list items, if they are matched by `outline-regexp', this returns
   "Get the right face for a TODO keyword KWD.
 If KWD is a number, get the corresponding match group."
   (if (numberp kwd) (setq kwd (match-string kwd)))
-  (or (cdr (assoc kwd org-todo-keyword-faces))
+  (or (org-face-from-face-or-color
+       'todo 'org-todo (cdr (assoc kwd org-todo-keyword-faces)))
       (and (member kwd org-done-keywords) 'org-done)
       'org-todo))
 
+(defun org-face-from-face-or-color (context inherit face-or-color)
+  "Create a face list that inherits INHERIT, but sets the foreground color.
+When FACE-OR-COLOR is not a string, just return it."
+  (if (stringp face-or-color)
+      (list :inherit inherit
+           (cdr (assoc context org-faces-easy-properties))
+           face-or-color)
+    face-or-color))
+
 (defun org-font-lock-add-tag-faces (limit)
   "Add the special tag faces."
   (when (and org-tag-faces org-tags-special-faces-re)
@@ -5013,8 +5547,10 @@ If KWD is a number, get the corresponding match group."
   (while (re-search-forward "\\[#\\([A-Z0-9]\\)\\]" limit t)
     (add-text-properties
      (match-beginning 0) (match-end 0)
-     (list 'face (or (cdr (assoc (char-after (match-beginning 1))
-                                org-priority-faces))
+     (list 'face (or (org-face-from-face-or-color
+                     'priority 'org-special-keyword
+                     (cdr (assoc (char-after (match-beginning 1))
+                                 org-priority-faces)))
                     'org-special-keyword)
           'font-lock-fontified t))))
 
@@ -5022,7 +5558,8 @@ If KWD is a number, get the corresponding match group."
   "Get the right face for a TODO keyword KWD.
 If KWD is a number, get the corresponding match group."
   (if (numberp kwd) (setq kwd (match-string kwd)))
-  (or (cdr (assoc kwd org-tag-faces))
+  (or (org-face-from-face-or-color
+       'tag 'org-tag (cdr (assoc kwd org-tag-faces)))
       'org-tag))
 
 (defun org-unfontify-region (beg end &optional maybe_loudly)
@@ -5032,6 +5569,7 @@ If KWD is a number, get the corresponding match group."
         (inhibit-read-only t) (inhibit-point-motion-hooks t)
         (inhibit-modification-hooks t)
         deactivate-mark buffer-file-name buffer-file-truename)
+    (decompose-region beg end)
     (remove-text-properties
      beg end
      (if org-indent-mode
@@ -5039,10 +5577,69 @@ If KWD is a number, get the corresponding match group."
         '(mouse-face t keymap t org-linked-text t
                      invisible t intangible t
                      line-prefix t wrap-prefix t
-                     org-no-flyspell t)
+                     org-no-flyspell t org-emphasis t)
        '(mouse-face t keymap t org-linked-text t
                    invisible t intangible t
-                   org-no-flyspell t)))))
+                   org-no-flyspell t org-emphasis t)))
+    (org-remove-font-lock-display-properties beg end)))
+
+(defconst org-script-display  '(((raise -0.3) (height 0.7))
+                               ((raise 0.3)  (height 0.7))
+                               ((raise -0.5))
+                               ((raise 0.5)))
+  "Display properties for showing superscripts and subscripts.")
+
+(defun org-remove-font-lock-display-properties (beg end)
+  "Remove specific display properties that have been added by font lock.
+The will remove the raise properties that are used to show superscripts
+and subscripts."
+  (let (next prop)
+    (while (< beg end)
+      (setq next (next-single-property-change beg 'display nil end)
+           prop (get-text-property beg 'display))
+      (if (member prop org-script-display)
+         (put-text-property beg next 'display nil))
+      (setq beg next))))
+
+(defun org-raise-scripts (limit)
+  "Add raise properties to sub/superscripts."
+  (when (and org-pretty-entities org-pretty-entities-include-sub-superscripts)
+    (if (re-search-forward
+        (if (eq org-use-sub-superscripts t)
+            org-match-substring-regexp
+          org-match-substring-with-braces-regexp)
+        limit t)
+       (let* ((pos (point)) table-p comment-p
+              (mpos (match-beginning 3))
+              (emph-p (get-text-property mpos 'org-emphasis))
+              (link-p (get-text-property mpos 'mouse-face))
+              (keyw-p (eq 'org-special-keyword (get-text-property mpos 'face))))
+         (goto-char (point-at-bol))
+         (setq table-p (org-looking-at-p org-table-dataline-regexp)
+               comment-p (org-looking-at-p "[ \t]*#"))
+         (goto-char pos)
+         ;; FIXME: Should we go back one character here, for a_b^c
+         ;; (goto-char (1- pos)) ;????????????????????
+         (if (or comment-p emph-p link-p keyw-p)
+             t
+           (put-text-property (match-beginning 3) (match-end 0)
+                              'display
+                              (if (equal (char-after (match-beginning 2)) ?^)
+                                  (nth (if table-p 3 1) org-script-display)
+                                (nth (if table-p 2 0) org-script-display)))
+           (add-text-properties (match-beginning 2) (match-end 2)
+                                (list 'invisible t
+                                      'org-dwidth t 'org-dwidth-n 1))
+           (if (and (eq (char-after (match-beginning 3)) ?{)
+                    (eq (char-before (match-end 3)) ?}))
+               (progn
+                 (add-text-properties
+                  (match-beginning 3) (1+ (match-beginning 3))
+                  (list 'invisible t 'org-dwidth t 'org-dwidth-n 1))
+                 (add-text-properties
+                  (1- (match-end 3)) (match-end 3)
+                  (list 'invisible t 'org-dwidth t 'org-dwidth-n 1))))
+           t)))))
 
 ;;;; Visibility cycling, including org-goto and indirect buffer
 
@@ -5086,6 +5683,12 @@ in special contexts.
   3. SUBTREE:  Show the entire subtree, including body text.
   If there is no subtree, switch directly from CHILDREN to FOLDED.
 
+- When point is at the beginning of an empty headline and the variable
+  `org-cycle-level-after-item/entry-creation' is set, cycle the level
+  of the headline by demoting and promoting it to likely levels.  This
+  speeds up creation document structure by pressing TAB once or several
+  times right after creating a new headline.
+
 - When there is a numeric prefix, go up to a heading with level ARG, do
   a `show-subtree' and return to the previous cursor position.  If ARG
   is negative, go up that many levels.
@@ -5146,11 +5749,11 @@ in special contexts.
 
        ((org-at-table-p 'any)
        ;; Enter the table or move to the next field in the table
-       (or (org-table-recognize-table.el)
-           (progn
-             (if arg (org-table-edit-field t)
-               (org-table-justify-field-maybe)
-               (call-interactively 'org-table-next-field)))))
+       (if (org-at-table.el-p)
+           (message "Use C-c ' to edit table.el tables")
+         (if arg (org-table-edit-field t)
+           (org-table-justify-field-maybe)
+           (call-interactively 'org-table-next-field))))
 
        ((run-hook-with-args-until-success
         'org-tab-after-check-for-table-hook))
@@ -5261,7 +5864,6 @@ in special contexts.
          (while (and (not (eobp)) ;; this is like `next-line'
                      (get-char-property (1- (point)) 'invisible))
            (goto-char (next-single-char-property-change (point) 'invisible))
-;;;???     (or (bolp) (beginning-of-line 2))))
            (and (eolp) (beginning-of-line 2))))
        (setq eol (point)))
       (outline-end-of-heading)   (setq eoh (point))
@@ -5323,7 +5925,7 @@ in special contexts.
 ;;;###autoload
 (defun org-global-cycle (&optional arg)
   "Cycle the global visibility.  For details see `org-cycle'.
-With C-u prefix arg, switch to startup visibility.
+With \\[universal-argument] prefix arg, switch to startup visibility.
 With a numeric prefix, show all headlines up to that level."
   (interactive "P")
   (let ((org-cycle-include-plain-lists
@@ -5352,7 +5954,7 @@ With a numeric prefix, show all headlines up to that level."
     (org-set-visibility-according-to-property 'no-cleanup)
     (org-cycle-hide-archived-subtrees 'all)
     (org-cycle-hide-drawers 'all)
-    (org-cycle-show-empty-lines 'all)))
+    (org-cycle-show-empty-lines t)))
 
 (defun org-set-visibility-according-to-property (&optional no-cleanup)
   "Switch subtree visibilities according to :VISIBILITY: property."
@@ -5436,11 +6038,11 @@ This function is the default value of the hook `org-cycle-hook'."
   "Remove outline overlays that do not contain non-white stuff."
   (mapc
    (lambda (o)
-     (and (eq 'outline (org-overlay-get o 'invisible))
-         (not (string-match "\\S-" (buffer-substring (org-overlay-start o)
-                                                       (org-overlay-end o))))
-         (org-delete-overlay o)))
-   (org-overlays-at pos)))
+     (and (eq 'outline (overlay-get o 'invisible))
+         (not (string-match "\\S-" (buffer-substring (overlay-start o)
+                                                     (overlay-end o))))
+         (delete-overlay o)))
+   (overlays-at pos)))
 
 (defun org-clean-visibility-after-subtree-move ()
   "Fix visibility issues after moving a subtree."
@@ -5466,7 +6068,9 @@ This function is the default value of the hook `org-cycle-hook'."
          ;; Properly fold already folded siblings
          (goto-char (point-min))
          (while (re-search-forward re nil t)
-           (if (save-excursion (goto-char (point-at-eol)) (org-invisible-p))
+           (if (and (not (org-invisible-p))
+                    (save-excursion
+                      (goto-char (point-at-eol)) (org-invisible-p)))
                (hide-entry))))
        (org-cycle-show-empty-lines 'overview)
        (org-cycle-hide-drawers 'overview)))))
@@ -5580,12 +6184,13 @@ open and agenda-wise Org files."
 
 (defun org-first-headline-recenter (&optional N)
   "Move cursor to the first headline and recenter the headline.
-Optional argument N means, put the headline into the Nth line of the window."
+Optional argument N means put the headline into the Nth line of the window."
   (goto-char (point-min))
   (when (re-search-forward (concat "^\\(" outline-regexp "\\)") nil t)
     (beginning-of-line)
     (recenter (prefix-numeric-value N))))
 
+
 ;;; Folding of blocks
 
 (defconst org-block-regexp
@@ -5598,9 +6203,8 @@ Optional argument N means, put the headline into the Nth line of the window."
 (make-variable-buffer-local 'org-hide-block-overlays)
 
 (defun org-block-map (function &optional start end)
-  "Call func at the head of all source blocks in the current
-buffer.  Optional arguments START and END can be used to limit
-the range."
+  "Call FUNCTION at the head of all source blocks in the current buffer.
+Optional arguments START and END can be used to limit the range."
   (let ((start (or start (point-min)))
         (end (or end (point-max))))
     (save-excursion
@@ -5623,7 +6227,8 @@ the range."
 
 (defun org-show-block-all ()
   "Unfold all blocks in the current buffer."
-  (mapc 'org-delete-overlay org-hide-block-overlays)
+  (interactive)
+  (mapc 'delete-overlay org-hide-block-overlays)
   (setq org-hide-block-overlays nil))
 
 (defun org-hide-block-toggle-maybe ()
@@ -5647,30 +6252,30 @@ the range."
               (end (match-end 0)) ;; end of entire body
               ov)
           (if (memq t (mapcar (lambda (overlay)
-                                (eq (org-overlay-get overlay 'invisible)
+                                (eq (overlay-get overlay 'invisible)
                                    'org-hide-block))
-                              (org-overlays-at start)))
+                              (overlays-at start)))
               (if (or (not force) (eq force 'off))
                   (mapc (lambda (ov)
                           (when (member ov org-hide-block-overlays)
                             (setq org-hide-block-overlays
                                   (delq ov org-hide-block-overlays)))
-                          (when (eq (org-overlay-get ov 'invisible)
+                          (when (eq (overlay-get ov 'invisible)
                                     'org-hide-block)
-                            (org-delete-overlay ov)))
-                        (org-overlays-at start)))
-            (setq ov (org-make-overlay start end))
-            (org-overlay-put ov 'invisible 'org-hide-block)
+                            (delete-overlay ov)))
+                        (overlays-at start)))
+            (setq ov (make-overlay start end))
+            (overlay-put ov 'invisible 'org-hide-block)
             ;; make the block accessible to isearch
-            (org-overlay-put
+            (overlay-put
              ov 'isearch-open-invisible
              (lambda (ov)
                (when (member ov org-hide-block-overlays)
                  (setq org-hide-block-overlays
                        (delq ov org-hide-block-overlays)))
-               (when (eq (org-overlay-get ov 'invisible)
+               (when (eq (overlay-get ov 'invisible)
                          'org-hide-block)
-                 (org-delete-overlay ov))))
+                 (delete-overlay ov))))
             (push ov org-hide-block-overlays)))
       (error "Not looking at a source block"))))
 
@@ -5776,7 +6381,11 @@ or nil."
        (isearch-hide-immediately nil)
        (isearch-search-fun-function
         (lambda () 'org-goto-local-search-headings))
-       (org-goto-selected-point org-goto-exit-command))
+       (org-goto-selected-point org-goto-exit-command)
+       (pop-up-frames nil)
+       (special-display-buffer-names nil)
+       (special-display-regexps nil)
+       (special-display-function nil))
     (save-excursion
       (save-window-excursion
        (delete-other-windows)
@@ -5883,10 +6492,12 @@ With numerical prefix ARG, go up to this level and then take that tree.
 If ARG is negative, go up that many levels.
 If `org-indirect-buffer-display' is not `new-frame', the command removes the
 indirect buffer previously made with this command, to avoid proliferation of
-indirect buffers.  However, when you call the command with a `C-u' prefix, or
+indirect buffers.  However, when you call the command with a \
+\\[universal-argument] prefix, or
 when `org-indirect-buffer-display' is `new-frame', the last buffer
 is kept so that you can work with several indirect buffers at the same time.
-If `org-indirect-buffer-display' is `dedicated-frame', the C-u prefix also
+If `org-indirect-buffer-display' is `dedicated-frame', the \
+\\[universal-argument] prefix also
 requests that a new frame be made for the new buffer, so that the dedicated
 frame is not changed."
   (interactive "P")
@@ -5903,7 +6514,9 @@ frame is not changed."
          (outline-up-heading 1 t)))
       (setq beg (point)
            heading (org-get-heading))
-      (org-end-of-subtree t t) (setq end (point)))
+      (org-end-of-subtree t t)
+      (if (org-on-heading-p) (backward-char 1))
+      (setq end (point)))
     (if (and (buffer-live-p org-last-indirect-buffer)
             (not (eq org-indirect-buffer-display 'new-frame))
             (not arg))
@@ -5965,21 +6578,26 @@ frame is not changed."
         (save-match-data
           (looking-at "[ \t]*$")))))
 
-(defun org-insert-heading (&optional force-heading)
+(defun org-insert-heading (&optional force-heading invisible-ok)
   "Insert a new heading or item with same depth at point.
 If point is in a plain list and FORCE-HEADING is nil, create a new list item.
 If point is at the beginning of a headline, insert a sibling before the
 current headline.  If point is not at the beginning, do not split the line,
-but create the new headline after the current line."
+but create the new headline after the current line.
+When INVISIBLE-OK is set, stop at invisible headlines when going back.
+This is important for non-interactive uses of the command."
   (interactive "P")
-  (if (= (buffer-size) 0)
+  (if (or (= (buffer-size) 0)
+         (and (not (save-excursion (and (ignore-errors (org-back-to-heading invisible-ok))
+                                        (org-on-heading-p))))
+              (not (org-in-item-p))))
       (insert "\n* ")
     (when (or force-heading (not (org-insert-item)))
       (let* ((empty-line-p nil)
             (head (save-excursion
                     (condition-case nil
                         (progn
-                          (org-back-to-heading)
+                          (org-back-to-heading invisible-ok)
                           (setq empty-line-p (org-previous-line-empty-p))
                           (match-string 0))
                       (error "*"))))
@@ -6032,6 +6650,9 @@ but create the new headline after the current line."
              (setq pos (point-at-bol))
              (or split (end-of-line 1))
              (delete-horizontal-space)
+             (if (string-match "\\`\\*+\\'"
+                               (buffer-substring (point-at-bol) (point)))
+                 (insert " "))
              (newline (if blank 2 1))
              (when tags
                (save-excursion
@@ -6073,7 +6694,7 @@ This is a list with the following elements:
 - the tags string, or nil."
   (save-excursion
     (org-back-to-heading t)
-    (if (looking-at org-complex-heading-regexp)
+    (if (let (case-fold-search) (looking-at org-complex-heading-regexp))
        (list (length (match-string 1))
              (org-reduced-level (length (match-string 1)))
              (org-match-string-no-properties 2)
@@ -6226,11 +6847,30 @@ The level is the number of stars at the beginning of the headline."
          (funcall outline-level))
       (error nil))))
 
+(defun org-get-previous-line-level ()
+  "Return the outline depth of the last headline before the current line.
+Returns 0 for the first headline in the buffer, and nil if before the
+first headline."
+  (let ((current-level (org-current-level))
+       (prev-level (when (> (line-number-at-pos) 1)
+                     (save-excursion
+                       (beginning-of-line 0)
+                       (org-current-level)))))
+    (cond ((null current-level) nil) ; Before first headline
+         ((null prev-level) 0)      ; At first headline
+         (prev-level))))
+
 (defun org-reduced-level (l)
   "Compute the effective level of a heading.
 This takes into account the setting of `org-odd-levels-only'."
   (if org-odd-levels-only (1+ (floor (/ l 2))) l))
 
+(defun org-level-increment ()
+  "Return the number of stars that will be added or removed at a
+time to headlines when structure editing, based on the value of
+`org-odd-levels-only'."
+  (if org-odd-levels-only 2 1))
+
 (defun org-get-valid-level (level &optional change)
   "Rectify a level change under the influence of `org-odd-levels-only'
 LEVEL is a current level, CHANGE is by how much the level should be
@@ -6278,30 +6918,41 @@ in the region."
     (if org-adapt-indentation (org-fixup-indentation diff))
     (run-hooks 'org-after-demote-entry-hook)))
 
-(defvar org-tab-ind-state nil)
-
 (defun org-cycle-level ()
+  "Cycle the level of an empty headline through possible states.
+This goes first to child, then to parent, level, then up the hierarchy.
+After top level, it switches back to sibling level."
+  (interactive)
   (let ((org-adapt-indentation nil))
-    (when (and (looking-at "[ \t]*$")
-              (looking-back
-               (concat "^\\(\\*+\\)[ \t]+\\(" org-todo-regexp "\\)?[ \t]*")))
-      (setq this-command 'org-cycle-level)
-      (if (eq last-command 'org-cycle-level)
-         (condition-case nil
-             (progn (org-do-promote)
-                    (if (equal org-tab-ind-state (org-current-level))
-                        (org-do-promote)))
-           (error
-            (progn
-              (save-excursion
-                (beginning-of-line 1)
-                (and (looking-at "\\*+")
-                     (replace-match
-                      (make-string org-tab-ind-state ?*))))
-              (setq this-command 'org-cycle))))
-       (setq org-tab-ind-state (- (match-end 1) (match-beginning 1)))
-       (org-do-demote))
-      t)))
+    (when (org-point-at-end-of-empty-headline)
+      (setq this-command 'org-cycle-level) ; Only needed for caching
+      (let ((cur-level (org-current-level))
+            (prev-level (org-get-previous-line-level)))
+        (cond
+         ;; If first headline in file, promote to top-level.
+         ((= prev-level 0)
+          (loop repeat (/ (- cur-level 1) (org-level-increment))
+                do (org-do-promote)))
+         ;; If same level as prev, demote one.
+         ((= prev-level cur-level)
+          (org-do-demote))
+         ;; If parent is top-level, promote to top level if not already.
+         ((= prev-level 1)
+          (loop repeat (/ (- cur-level 1) (org-level-increment))
+                do (org-do-promote)))
+         ;; If top-level, return to prev-level.
+         ((= cur-level 1)
+          (loop repeat (/ (- prev-level 1) (org-level-increment))
+                do (org-do-demote)))
+         ;; If less than prev-level, promote one.
+         ((< cur-level prev-level)
+          (org-do-promote))
+         ;; If deeper than prev-level, promote until higher than
+         ;; prev-level.
+         ((> cur-level prev-level)
+          (loop repeat (+ 1 (/ (- cur-level prev-level) (org-level-increment)))
+                do (org-do-promote))))
+        t))))
 
 (defun org-map-tree (fun)
   "Call FUN for every heading underneath the current one."
@@ -6331,7 +6982,7 @@ in the region."
        (funcall fun)))))
 
 (defun org-fixup-indentation (diff)
-  "Change the indentation in the current entry by DIFF
+  "Change the indentation in the current entry by DIFF.
 However, if any line in the current entry has no indentation, or if it
 would end up with no indentation after the change, nothing at all is done."
   (save-excursion
@@ -6369,10 +7020,11 @@ level 5 etc."
          (end-of-line 1))))))
 
 (defun org-convert-to-oddeven-levels ()
-  "Convert an org-mode file with only odd levels to one with odd and even levels.
-This promotes level 3 to level 2, level 5 to level 3 etc.  If the file contains a
-section with an even level, conversion would destroy the structure of the file.  An error
-is signaled in this case."
+  "Convert an org-mode file with only odd levels to one with odd/even levels.
+This promotes level 3 to level 2, level 5 to level 3 etc.  If the
+file contains a section with an even level, conversion would
+destroy the structure of the file.  An error is signaled in this
+case."
   (interactive)
   (goto-char (point-min))
   ;; First check if there are no even levels
@@ -6707,20 +7359,26 @@ If yes, remember the marker and the distance to BEG."
     (save-match-data
       (narrow-to-region
        (progn (org-back-to-heading t) (point))
-       (progn (org-end-of-subtree t t) (point))))))
+       (progn (org-end-of-subtree t t)
+             (if (org-on-heading-p) (backward-char 1))
+             (point))))))
+
+(eval-when-compile
+  (defvar org-property-drawer-re))
 
 (defun org-clone-subtree-with-time-shift (n &optional shift)
   "Clone the task (subtree) at point N times.
 The clones will be inserted as siblings.
 
-In interactive use, the user will be prompted for the number of clones
-to be produced, and for a time SHIFT, which may be a repeater as used
-in time stamps, for example `+3d'.
+In interactive use, the user will be prompted for the number of
+clones to be produced, and for a time SHIFT, which may be a
+repeater as used in time stamps, for example `+3d'.
 
-When a valid repeater is given and the entry contains any time stamps,
-the clones will become a sequence in time, with time stamps in the
-subtree shifted for each clone produced.  If SHIFT is nil or the
-empty string, time stamps will be left alone.
+When a valid repeater is given and the entry contains any time
+stamps, the clones will become a sequence in time, with time
+stamps in the subtree shifted for each clone produced.  If SHIFT
+is nil or the empty string, time stamps will be left alone.  The
+ID property of the original subtree is removed.
 
 If the original subtree did contain time stamps with a repeater,
 the following will happen:
@@ -6734,7 +7392,7 @@ the following will happen:
 I this way you can spell out a number of instances of a repeating task,
 and still retain the repeater to cover future instances of the task."
   (interactive "nNumber of clones to produce: \nsDate shift per clone (e.g. +1w, empty to copy unchanged): ")
-  (let (beg end template task
+  (let (beg end template task idprop
            shift-n shift-what doshift nmin nmax (n-no-remove -1))
     (if (not (and (integerp n) (> n 0)))
        (error "Invalid number of replications %s" n))
@@ -6751,6 +7409,7 @@ and still retain the repeater to cover future instances of the task."
     (setq nmin 1 nmax n)
     (org-back-to-heading t)
     (setq beg (point))
+    (setq idprop (org-entry-get nil "ID"))
     (org-end-of-subtree t t)
     (or (bolp) (insert "\n"))
     (setq end (point))
@@ -6762,12 +7421,18 @@ and still retain the repeater to cover future instances of the task."
       (setq nmin 0 nmax (1+ nmax) n-no-remove nmax))
     (goto-char end)
     (loop for n from nmin to nmax do
-         (if (not doshift)
-             (setq task template)
-           (with-temp-buffer
-             (insert template)
-             (org-mode)
-             (goto-char (point-min))
+         ;; prepare clone
+         (with-temp-buffer
+           (insert template)
+           (org-mode)
+           (goto-char (point-min))
+           (and idprop (if org-clone-delete-id
+                           (org-entry-delete nil "ID")
+                         (org-id-get-create t)))
+           (while (re-search-forward org-property-drawer-re nil t)
+             (org-remove-empty-drawer-at "PROPERTIES" (point)))
+           (goto-char (point-min))
+           (when doshift
              (while (re-search-forward org-ts-regexp-both nil t)
                (org-timestamp-change (* n shift-n) shift-what))
              (unless (= n n-no-remove)
@@ -6776,8 +7441,8 @@ and still retain the repeater to cover future instances of the task."
                  (save-excursion
                    (goto-char (match-beginning 0))
                    (if (looking-at "<[^<>\n]+\\( +\\+[0-9]+[dwmy]\\)")
-                       (delete-region (match-beginning 1) (match-end 1))))))
-             (setq task (buffer-string))))
+                       (delete-region (match-beginning 1) (match-end 1)))))))
+           (setq task (buffer-string)))
          (insert task))
     (goto-char beg)))
 
@@ -6821,7 +7486,7 @@ Sorting can be alphabetically, numerically, by date/time as given by
 a time stamp, by a property or by priority.
 
 The command prompts for the sorting type unless it has been given to the
-function through the SORTING-TYPE argument, which needs to a character,
+function through the SORTING-TYPE argument, which needs to be a character,
 \(?n ?N ?a ?A ?t ?T ?s ?S ?d ?D ?p ?P ?r ?R ?f ?F).  Here is the
 precise meaning of each character:
 
@@ -7114,15 +7779,15 @@ If WITH-CASE is non-nil, the sorting will be case-sensitive."
   "Keymap for the minor `orgstruct-mode'.")
 
 (defvar org-local-vars nil
-  "List of local variables, for use by `orgstruct-mode'")
+  "List of local variables, for use by `orgstruct-mode'.")
 
 ;;;###autoload
 (define-minor-mode orgstruct-mode
-  "Toggle the minor more `orgstruct-mode'.
-This mode is for using Org-mode structure commands in other modes.
-The following key behave as if Org-mode was active, if the cursor
-is on a headline, or on a plain list item (both in the definition
-of Org-mode).
+  "Toggle the minor mode `orgstruct-mode'.
+This mode is for using Org-mode structure commands in other
+modes.  The following keys behave as if Org-mode were active, if
+the cursor is on a headline, or on a plain list item (both as
+defined by Org-mode).
 
 M-up        Move entry/item up
 M-down     Move entry/item down
@@ -7173,7 +7838,7 @@ major mode, for example with \\[normal-mode]."
       (org-set-local 'orgstruct-is-++ t))))
 
 (defvar orgstruct-is-++ nil
-  "Is orgstruct-mode in ++ version in the current-buffer?")
+  "Is `orgstruct-mode' in ++ version in the current-buffer?")
 (make-variable-buffer-local 'orgstruct-is-++)
 
 ;;;###autoload
@@ -7415,7 +8080,7 @@ If yes, it should return a non-nil value after a calling
 `org-store-link-props' with a list of properties and values.
 Special properties are:
 
-:type         The link prefix. like \"http\".  This must be given.
+:type         The link prefix, like \"http\".  This must be given.
 :link         The link, like \"http://www.astro.uva.nl/~dominik\".
               This is obligatory as well.
 :description  Optional default description for the second pair
@@ -7501,7 +8166,9 @@ For file links, arg negates `org-context-in-file-links'."
                   (get-text-property (point) 'org-marker))))
        (when m
          (org-with-point-at m
-           (call-interactively 'org-store-link)))))
+           (if (interactive-p)
+               (call-interactively 'org-store-link)
+             (org-store-link nil))))))
 
      ((eq major-mode 'calendar-mode)
       (let ((cd (calendar-cursor-to-date)))
@@ -7540,11 +8207,14 @@ For file links, arg negates `org-context-in-file-links'."
 
      ((eq major-mode 'dired-mode)
       ;; link to the file in the current line
-      (setq cpltxt (concat "file:"
-                          (abbreviate-file-name
-                           (expand-file-name
-                            (dired-get-filename nil t))))
-           link (org-make-link cpltxt)))
+      (let ((file (dired-get-filename nil t)))
+       (setq file (if file
+                      (abbreviate-file-name
+                       (expand-file-name (dired-get-filename nil t)))
+                    ;; otherwise, no file so use current directory.
+                    default-directory))
+       (setq cpltxt (concat "file:" file)
+             link (org-make-link cpltxt))))
 
      ((and buffer-file-name (org-mode-p))
       (setq custom-id (ignore-errors (org-entry-get nil "CUSTOM_ID")))
@@ -7755,7 +8425,7 @@ according to FMT (default from `org-email-link-description-format')."
     (?\371 . "%F9")  ; `u
     (?\373 . "%FB")  ; ^u
     (?\;   . "%3B")
-    (??    . "%3F")
+;;  (??    . "%3F")
     (?=    . "%3D")
     (?+    . "%2B")
     )
@@ -7771,7 +8441,7 @@ This is the list that is used before handing over to the browser.")
 
 (defun org-link-escape (text &optional table)
   "Escape characters in TEXT that are problematic for links."
-  (if org-url-encoding-use-url-hexify
+  (if (and org-url-encoding-use-url-hexify (not table))
       (url-hexify-string text)
     (setq table (or table org-link-escape-chars))
     (when text
@@ -7788,16 +8458,18 @@ This is the list that is used before handing over to the browser.")
 
 (defun org-link-unescape (text &optional table)
   "Reverse the action of `org-link-escape'."
-  (if org-url-encoding-use-url-hexify
+  (if (and org-url-encoding-use-url-hexify (not table))
       (url-unhex-string text)
     (setq table (or table org-link-escape-chars))
     (when text
-      (let ((re (mapconcat (lambda (x) (regexp-quote (cdr x)))
+      (let ((case-fold-search t)
+           (re (mapconcat (lambda (x) (regexp-quote (downcase (cdr x))))
                           table "\\|")))
        (while (string-match re text)
          (setq text
                (replace-match
-                (char-to-string (car (rassoc (match-string 0 text) table)))
+                (char-to-string (car (rassoc (upcase (match-string 0 text))
+                                             table)))
                 t t text)))
        text))))
 
@@ -7807,6 +8479,12 @@ This is the list that is used before handing over to the browser.")
 
 (defun org-fixup-message-id-for-http (s)
   "Replace special characters in a message id, so it can be used in an http query."
+  (when (string-match "%" s)
+    (setq s (mapconcat (lambda (c)
+                        (if (eq c ?%)
+                            "%25"
+                          (char-to-string c)))
+                      s "")))
   (while (string-match "<" s)
     (setq s (replace-match "%3C" t t s)))
   (while (string-match ">" s)
@@ -7899,7 +8577,7 @@ Use TAB to complete link prefixes, then RET for type-specific completion support
                    (if (nth 1 x) (concat (car x) " (" (nth 1 x) ")") (car x)))
                  (reverse org-stored-links) "\n"))))
       (let ((cw (selected-window)))
-       (select-window (get-buffer-window "*Org Links*"))
+       (select-window (get-buffer-window "*Org Links*" 'visible))
        (setq truncate-lines t)
        (unless (pos-visible-in-window-p (point-max))
          (org-fit-window-to-buffer))
@@ -7924,6 +8602,8 @@ Use TAB to complete link prefixes, then RET for type-specific completion support
                     nil nil nil
                     'tmphist
                     (car (car org-stored-links)))))
+           (if (not (string-match "\\S-" link))
+               (error "No link selected"))
            (if (or (member link all-prefixes)
                    (and (equal ":" (substring link -1))
                         (member (substring link 0 -1) all-prefixes)
@@ -7956,8 +8636,9 @@ Use TAB to complete link prefixes, then RET for type-specific completion support
              (setq link search)))))
 
     ;; Check if we can/should use a relative path.  If yes, simplify the link
-    (when (string-match "^file:\\(.*\\)" link)
-      (let* ((path (match-string 1 link))
+    (when (string-match "^\\(file:\\|docview:\\)\\(.*\\)" link)
+      (let* ((type (match-string 1 link))
+            (path (match-string 2 link))
             (origpath path)
             (case-fold-search nil))
        (cond
@@ -7971,14 +8652,15 @@ Use TAB to complete link prefixes, then RET for type-specific completion support
         (t
          (save-match-data
            (if (string-match (concat "^" (regexp-quote
-                                          (file-name-as-directory
-                                           (expand-file-name "."))))
+                                          (expand-file-name
+                                           (file-name-as-directory
+                                            default-directory))))
                              (expand-file-name path))
                ;; We are linking a file with relative path name.
                (setq path (substring (expand-file-name path)
                                      (match-end 0)))
              (setq path (abbreviate-file-name (expand-file-name path)))))))
-       (setq link (concat "file:" path))
+       (setq link (concat type path))
        (if (equal desc origpath)
            (setq desc path))))
 
@@ -8097,6 +8779,23 @@ from."
 
 (defvar org-link-search-failed nil)
 
+(defvar org-open-link-functions nil
+  "Hook for functions finding a plain text link.
+These functions must take a single argument, the link content.
+They will be called for links that look like [[link text][description]]
+when LINK TEXT does not have a protocol like \"http:\" and does not look
+like a filename (e.g. \"./blue.png\").
+
+These functions will be called *before* Org attempts to resolve the
+link by doing text searches in the current buffer - so if you want a
+link \"[[target]]\" to still find \"<<target>>\", your function should
+handle this as a special case.
+
+When the function does handle the link, it must return a non-nil value.
+If it decides that it is not responsible for this link, it must return
+nil to indicate that that Org-mode can continue with other options
+like exact and fuzzy text search.")
+
 (defun org-next-link ()
   "Move forward to the next link.
 If the link is in hidden text, expose it."
@@ -8209,6 +8908,10 @@ Org-mode syntax."
        (org-mode)
        (insert s)
        (goto-char (point-min))
+       (when reference-buffer
+         (setq org-link-abbrev-alist-local
+               (with-current-buffer reference-buffer
+                 org-link-abbrev-alist-local)))
        (org-open-at-point arg reference-buffer)))))
 
 (defun org-open-at-point (&optional in-emacs reference-buffer)
@@ -8220,6 +8923,8 @@ optional argument IN-EMACS is non-nil, Emacs will visit the file.
 With a double prefix argument, try to open outside of Emacs, in the
 application the system uses for this file type."
   (interactive "P")
+  ;; if in a code block, then open the block's results
+  (unless (call-interactively #'org-babel-open-src-block-result)
   (org-load-modules-maybe)
   (move-marker org-open-link-marker (point))
   (setq org-window-config-before-follow-link (current-window-configuration))
@@ -8230,7 +8935,8 @@ application the system uses for this file type."
               (concat org-plain-link-re "\\|"
                       org-bracket-link-regexp "\\|"
                       org-angle-link-re "\\|"
-                      "[ \t]:[^ \t\n]+:[ \t]*$"))))
+                      "[ \t]:[^ \t\n]+:[ \t]*$")))
+        (not (get-text-property (point) 'org-linked-text)))
     (or (org-offer-links-in-entry in-emacs)
        (progn (require 'org-attach) (org-attach-reveal 'if-exists))))
    ((org-at-timestamp-p t) (org-follow-timestamp-link))
@@ -8241,7 +8947,7 @@ application the system uses for this file type."
       (catch 'match
        (save-excursion
          (skip-chars-forward "^]\n\r")
-         (when (org-in-regexp org-bracket-link-regexp)
+         (when (org-in-regexp org-bracket-link-regexp 1)
            (setq link (org-extract-attributes
                        (org-link-unescape (org-match-string-no-properties 1))))
            (while (string-match " *\n *" link)
@@ -8325,24 +9031,16 @@ application the system uses for this file type."
          (browse-url (concat type ":" (org-link-escape
                                        path org-link-escape-chars-browser))))
 
+        ((string= type "doi")
+         (browse-url (concat "http://dx.doi.org/"
+                              (org-link-escape
+                               path org-link-escape-chars-browser))))
+
         ((member type '("message"))
          (browse-url (concat type ":" path)))
 
         ((string= type "tags")
          (org-tags-view in-emacs path))
-        ((string= type "thisfile")
-         (if in-emacs
-             (switch-to-buffer-other-window
-              (org-get-buffer-for-internal-link (current-buffer)))
-           (org-mark-ring-push))
-         (let ((cmd `(org-link-search
-                      ,path
-                      ,(cond ((equal in-emacs '(4)) 'occur)
-                             ((equal in-emacs '(16)) 'org-occur)
-                             (t nil))
-                      ,pos)))
-           (condition-case nil (eval cmd)
-             (error (progn (widen) (eval cmd))))))
 
         ((string= type "tree-match")
          (org-occur (concat "\\[" (regexp-quote path) "\\]")))
@@ -8387,10 +9085,28 @@ application the system uses for this file type."
                           (call-interactively (read cmd))))
              (error "Abort"))))
 
+        ((and (string= type "thisfile")
+              (run-hook-with-args-until-success
+               'org-open-link-functions path)))
+
+        ((string= type "thisfile")
+         (if in-emacs
+             (switch-to-buffer-other-window
+              (org-get-buffer-for-internal-link (current-buffer)))
+           (org-mark-ring-push))
+         (let ((cmd `(org-link-search
+                      ,path
+                      ,(cond ((equal in-emacs '(4)) 'occur)
+                             ((equal in-emacs '(16)) 'org-occur)
+                             (t nil))
+                      ,pos)))
+           (condition-case nil (eval cmd)
+             (error (progn (widen) (eval cmd))))))
+
         (t
          (browse-url-at-point)))))))
   (move-marker org-open-link-marker nil)
-  (run-hook-with-args 'org-follow-link-hook))
+  (run-hook-with-args 'org-follow-link-hook)))
 
 (defun org-offer-links-in-entry (&optional nth zero)
   "Offer links in the current entry and follow the selected link.
@@ -8418,7 +9134,7 @@ there is one, offer it as link number zero."
      ((null links)
       (message "No links"))
      ((equal (length links) 1)
-      (setq link (car links)))
+      (setq link (list (car links))))
      ((and (integerp nth) (>= (length links) (if have-zero (1+ nth) nth)))
       (setq link (nth (if have-zero nth (1- nth)) links)))
      (t ; we have to select a link
@@ -8437,19 +9153,44 @@ there is one, offer it as link number zero."
                                       (match-string 1 l))))))
                  links))
          (org-fit-window-to-buffer (get-buffer-window "*Select Link*"))
-         (message "Select link to open:")
+         (message "Select link to open, RET to open all:")
          (setq c (read-char-exclusive))
          (and (get-buffer "*Select Link*") (kill-buffer "*Select Link*"))))
       (when (equal c ?q) (error "Abort"))
-      (setq nth (- c ?0))
-      (if have-zero (setq nth (1+ nth)))
-      (unless (and (integerp nth) (>= (length links) nth))
-       (error "Invalid link selection"))
-      (setq link (nth (1- nth) links))))
+      (if (equal c ?\C-m)
+         (setq link links)
+       (setq nth (- c ?0))
+       (if have-zero (setq nth (1+ nth)))
+       (unless (and (integerp nth) (>= (length links) nth))
+         (error "Invalid link selection"))
+       (setq link (list (nth (1- nth) links))))))
     (if link
-       (progn (org-open-link-from-string link in-emacs (current-buffer)) t)
+       (let ((buf (current-buffer)))
+         (dolist (l link)
+           (org-open-link-from-string l in-emacs buf))
+         t)
       nil)))
 
+;; Add special file links that specify the way of opening
+
+(org-add-link-type "file+sys" 'org-open-file-with-system)
+(org-add-link-type "file+emacs" 'org-open-file-with-emacs)
+(defun org-open-file-with-system (path)
+  "Open file at PATH using the system way of opening it."
+  (org-open-file path 'system))
+(defun org-open-file-with-emacs (path)
+  "Open file at PATH in Emacs."
+  (org-open-file path 'emacs))
+(defun org-remove-file-link-modifiers ()
+  "Remove the file link modifiers in `file+sys:' and `file+emacs:' links."
+  (goto-char (point-min))
+  (while (re-search-forward "\\<file\\+\\(sys\\|emacs\\):" nil t)
+    (org-if-unprotected
+     (replace-match "file:" t t))))
+(eval-after-load "org-exp"
+  '(add-hook 'org-export-preprocess-before-normalizing-links-hook
+            'org-remove-file-link-modifiers))
+
 ;;;; Time estimates
 
 (defun org-get-effort (&optional pom)
@@ -8464,8 +9205,8 @@ These functions are called in turn with point at the location to
 which the link should point.
 
 A function in the hook should first test if it would like to
-handle this file type, for example by checking the major-mode or
-the file extension.  If it decides not to handle this file, it
+handle this file type, for example by checking the `major-mode'
+or the file extension.  If it decides not to handle this file, it
 should just return nil to give other functions a chance.  If it
 does handle the file, it must return the search string to be used
 when following the link.  The search string will be part of the
@@ -8486,8 +9227,8 @@ buffer with \\[org-insert-link].")
 Functions added to this hook must accept a single argument, the
 search string that was part of the file link, the part after the
 double colon.  The function must first check if it would like to
-handle this search, for example by checking the major-mode or the
-file extension.  If it decides not to handle this search, it
+handle this search, for example by checking the `major-mode' or
+the file extension.  If it decides not to handle this search, it
 should just return nil to give other functions a chance.  If it
 does handle the search, it must return a non-nil value to keep
 other functions from trying.
@@ -8759,18 +9500,23 @@ entry for this file type, and if yes, the corresponding command is launched.
 If no application is found, Emacs simply visits the file.
 
 With optional prefix argument IN-EMACS, Emacs will visit the file.
-With a double C-c C-u prefix arg, Org tries to avoid opening in Emacs
-and o use an external application to visit the file.
-
-Optional LINE specifies a line to go to, optional SEARCH a string to
-search for.  If LINE or SEARCH is given, the file will always be
-opened in Emacs.
+With a double \\[universal-argument] \\[universal-argument] \
+prefix arg, Org tries to avoid opening in Emacs
+and to use an external application to visit the file.
+
+Optional LINE specifies a line to go to, optional SEARCH a string
+to search for.  If LINE or SEARCH is given, the file will be
+opened in Emacs, unless an entry from org-file-apps that makes
+use of groups in a regexp matches.
 If the file does not exist, an error is thrown."
-  (setq in-emacs (or in-emacs line search))
   (let* ((file (if (equal path "")
                   buffer-file-name
                 (substitute-in-file-name (expand-file-name path))))
-        (apps (append org-file-apps (org-default-apps)))
+        (file-apps (append org-file-apps (org-default-apps)))
+        (apps (org-remove-if
+               'org-file-apps-entry-match-against-dlink-p file-apps))
+        (apps-dlink (org-remove-if-not
+                     'org-file-apps-entry-match-against-dlink-p file-apps))
         (remp (and (assq 'remote apps) (org-file-remote-p file)))
         (dirp (if remp nil (file-directory-p file)))
         (file (if (and dirp org-open-directory-means-index-dot-org)
@@ -8778,21 +9524,41 @@ If the file does not exist, an error is thrown."
                 file))
         (a-m-a-p (assq 'auto-mode apps))
         (dfile (downcase file))
+        ;; reconstruct the original file: link from the PATH, LINE and SEARCH args
+        (link (cond ((and (eq line nil)
+                           (eq search nil))
+                      file)
+                     (line
+                     (concat file "::" (number-to-string line)))
+                    (search
+                     (concat file "::" search))))
+        (dlink (downcase link))
         (old-buffer (current-buffer))
         (old-pos (point))
         (old-mode major-mode)
-        ext cmd)
+        ext cmd link-match-data)
     (if (string-match "^.*\\.\\([a-zA-Z0-9]+\\.gz\\)$" dfile)
        (setq ext (match-string 1 dfile))
       (if (string-match "^.*\\.\\([a-zA-Z0-9]+\\)$" dfile)
          (setq ext (match-string 1 dfile))))
     (cond
-     ((equal in-emacs '(16))
+     ((member in-emacs '((16) system))
       (setq cmd (cdr (assoc 'system apps))))
      (in-emacs (setq cmd 'emacs))
      (t
       (setq cmd (or (and remp (cdr (assoc 'remote apps)))
                    (and dirp (cdr (assoc 'directory apps)))
+                   ; first, try matching against apps-dlink
+                   ; if we get a match here, store the match data for later
+                   (let ((match (assoc-default dlink apps-dlink
+                                               'string-match)))
+                     (if match
+                         (progn (setq link-match-data (match-data))
+                                match)
+                       (progn (setq in-emacs (or in-emacs line search))
+                              nil))) ; if we have no match in apps-dlink,
+                                     ; always open the file in emacs if line or search
+                                     ; is given (for backwards compatibility)
                    (assoc-default dfile (org-apps-regexp-alist apps a-m-a-p)
                                   'string-match)
                    (cdr (assoc ext apps))
@@ -8824,6 +9590,19 @@ If the file does not exist, an error is thrown."
                     (shell-quote-argument
                      (convert-standard-filename file)))
                   t t cmd)))
+
+      ;; Replace "%1", "%2" etc. in command with group matches from regex
+      (save-match-data
+       (let ((match-index 1)
+             (number-of-groups (- (/ (length link-match-data) 2) 1)))
+         (set-match-data link-match-data)
+         (while (<= match-index number-of-groups)
+           (let ((regex (concat "%" (number-to-string match-index)))
+                 (replace-with (match-string match-index dlink)))
+             (while (string-match regex cmd)
+               (setq cmd (replace-match replace-with t t cmd))))
+           (setq match-index (+ match-index 1)))))
+
       (save-window-excursion
        (start-process-shell-command cmd nil cmd)
        (and (boundp 'org-wait) (numberp org-wait) (sit-for org-wait))
@@ -8836,13 +9615,34 @@ If the file does not exist, an error is thrown."
        (if search (org-link-search search))))
      ((consp cmd)
       (let ((file (convert-standard-filename file)))
-       (eval cmd)))
+       (save-match-data
+         (set-match-data link-match-data)
+         (eval cmd))))
      (t (funcall (cdr (assq 'file org-link-frame-setup)) file)))
     (and (org-mode-p) (eq old-mode 'org-mode)
         (or (not (equal old-buffer (current-buffer)))
             (not (equal old-pos (point))))
         (org-mark-ring-push old-pos old-buffer))))
 
+(defun org-file-apps-entry-match-against-dlink-p (entry)
+  "This function returns non-nil if `entry' uses a regular
+expression which should be matched against the whole link by
+org-open-file.
+
+It assumes that is the case when the entry uses a regular
+expression which has at least one grouping construct and the
+action is either a lisp form or a command string containing
+'%1', i.e. using at least one subexpression match as a
+parameter."
+  (let ((selector (car entry))
+       (action (cdr entry)))
+    (if (stringp selector)
+       (and (> (regexp-opt-depth selector) 0)
+            (or (and (stringp action)
+                     (string-match "%[0-9]" action))
+                (consp action)))
+      nil)))
+
 (defun org-default-apps ()
   "Return the default applications for this operating system."
   (cond
@@ -8917,12 +9717,64 @@ on the system \"/user@host:\"."
 (defvar org-agenda-new-buffers nil
   "Buffers created to visit agenda files.")
 
+(defvar org-refile-cache nil
+  "Cache for refile targets.")
+
+
+(defvar org-refile-markers nil
+  "All the markers used for caching refile locations.")
+
+(defun org-refile-marker (pos)
+  "Get a new refile marker, but only if caching is in use."
+  (if (not org-refile-use-cache)
+      pos
+    (let ((m (make-marker)))
+      (move-marker m pos)
+      (push m org-refile-markers)
+      m)))
+
+(defun org-refile-cache-clear ()
+  "Clear the refile cache and disable all the markers."
+  (mapc (lambda (m) (move-marker m nil)) org-refile-markers)
+  (setq org-refile-markers nil)
+  (setq org-refile-cache nil)
+  (message "Refile cache has been cleared"))
+
+(defun org-refile-cache-check-set (set)
+  "Check if all the markers in the cache still have live buffers."
+  (let (marker)
+    (catch 'exit
+      (while (and set (setq marker (nth 3 (pop set))))
+       ;; if org-refile-use-outline-path is 'file, marker may be nil
+       (when (and marker (null (marker-buffer marker)))
+         (message "not found") (sit-for 3)
+         (throw 'exit nil)))
+      t)))
+
+(defun org-refile-cache-put (set &rest identifiers)
+  "Push the refile targets SET into the cache, under IDENTIFIERS."
+  (let* ((key (sha1 (prin1-to-string identifiers)))
+        (entry (assoc key org-refile-cache)))
+    (if entry
+       (setcdr entry set)
+      (push (cons key set) org-refile-cache))))
+
+(defun org-refile-cache-get (&rest identifiers)
+  "Retrieve the cached value for refile targets given by IDENTIFIERS."
+  (cond
+   ((not org-refile-cache) nil)
+   ((not org-refile-use-cache) (org-refile-cache-clear) nil)
+   (t
+    (let ((set (cdr (assoc (sha1 (prin1-to-string identifiers))
+                          org-refile-cache))))
+      (and set (org-refile-cache-check-set set) set)))))
+
 (defun org-get-refile-targets (&optional default-buffer)
   "Produce a table with refile targets."
   (let ((case-fold-search nil)
        ;; otherwise org confuses "TODO" as a kw and "Todo" as a word
        (entries (or org-refile-targets '((nil . (:level . 1)))))
-       targets txt re files f desc descre fast-path-p level pos0)
+       targets tgs txt re files f desc descre fast-path-p level pos0)
     (message "Getting targets...")
     (with-current-buffer (or default-buffer (current-buffer))
       (while (setq entry (pop entries))
@@ -8961,46 +9813,64 @@ on the system \"/user@host:\"."
        (while (setq f (pop files))
          (with-current-buffer
              (if (bufferp f) f (org-get-agenda-file-buffer f))
-           (if (bufferp f) (setq f (buffer-file-name (buffer-base-buffer f))))
-           (setq f (expand-file-name f))
-           (if (eq org-refile-use-outline-path 'file)
-               (push (list (file-name-nondirectory f) f nil nil) targets))
-           (save-excursion
-             (save-restriction
-               (widen)
-               (goto-char (point-min))
-               (while (re-search-forward descre nil t)
-                 (goto-char (setq pos0 (point-at-bol)))
-                 (catch 'next
-                   (when org-refile-target-verify-function
-                     (save-match-data
-                       (or (funcall org-refile-target-verify-function)
-                           (throw 'next t))))
-                   (when (looking-at org-complex-heading-regexp)
-                     (setq level (org-reduced-level (- (match-end 1) (match-beginning 1)))
-                           txt (org-link-display-format (match-string 4))
-                           re (concat "^" (regexp-quote
-                                           (buffer-substring (match-beginning 1)
-                                                             (match-end 4)))))
-                     (if (match-end 5) (setq re (concat re "[ \t]+"
-                                                        (regexp-quote
-                                                         (match-string 5)))))
-                     (setq re (concat re "[ \t]*$"))
-                     (when org-refile-use-outline-path
-                       (setq txt (mapconcat 'org-protect-slash
-                                            (append
-                                             (if (eq org-refile-use-outline-path 'file)
-                                                 (list (file-name-nondirectory
-                                                        (buffer-file-name (buffer-base-buffer))))
-                                               (if (eq org-refile-use-outline-path 'full-file-path)
-                                                   (list (buffer-file-name (buffer-base-buffer)))))
-                                             (org-get-outline-path fast-path-p level txt)
-                                             (list txt))
-                                            "/")))
-                     (push (list txt f re (point)) targets)))
-                 (when (= (point) pos0)
-                   ;; verification function has not moved point
-                   (goto-char (point-at-eol))))))))))
+           (or
+            (setq tgs (org-refile-cache-get (buffer-file-name) descre))
+            (progn
+              (if (bufferp f) (setq f (buffer-file-name
+                                       (buffer-base-buffer f))))
+              (setq f (and f (expand-file-name f)))
+              (if (eq org-refile-use-outline-path 'file)
+                  (push (list (file-name-nondirectory f) f nil nil) tgs))
+              (save-excursion
+                (save-restriction
+                  (widen)
+                  (goto-char (point-min))
+                  (while (re-search-forward descre nil t)
+                    (goto-char (setq pos0 (point-at-bol)))
+                    (catch 'next
+                      (when org-refile-target-verify-function
+                        (save-match-data
+                          (or (funcall org-refile-target-verify-function)
+                              (throw 'next t))))
+                      (when (looking-at org-complex-heading-regexp)
+                        (setq level (org-reduced-level
+                                     (- (match-end 1) (match-beginning 1)))
+                              txt (org-link-display-format (match-string 4))
+                              re (concat "^" (regexp-quote
+                                              (buffer-substring
+                                               (match-beginning 1)
+                                               (match-end 4)))))
+                        (if (match-end 5) (setq re (concat
+                                                    re "[ \t]+"
+                                                    (regexp-quote
+                                                     (match-string 5)))))
+                        (setq re (concat re "[ \t]*$"))
+                        (when org-refile-use-outline-path
+                          (setq txt (mapconcat
+                                     'org-protect-slash
+                                     (append
+                                      (if (eq org-refile-use-outline-path
+                                              'file)
+                                          (list (file-name-nondirectory
+                                                 (buffer-file-name
+                                                  (buffer-base-buffer))))
+                                        (if (eq org-refile-use-outline-path
+                                                'full-file-path)
+                                            (list (buffer-file-name
+                                                   (buffer-base-buffer)))))
+                                      (org-get-outline-path fast-path-p
+                                                            level txt)
+                                      (list txt))
+                                     "/")))
+                        (push (list txt f re (org-refile-marker (point)))
+                              tgs)))
+                    (when (= (point) pos0)
+                      ;; verification function has not moved point
+                      (goto-char (point-at-eol))))))))
+           (when org-refile-use-cache
+             (org-refile-cache-put tgs (buffer-file-name) descre))
+           (setq targets (append tgs targets))
+           ))))
     (message "Getting targets...done")
     (nreverse targets)))
 
@@ -9013,9 +9883,10 @@ on the system \"/user@host:\"."
 
 (defun org-get-outline-path (&optional fastp level heading)
   "Return the outline path to the current entry, as a list.
-The parameters FASTP, LEVEL, and HEADING are for use be a scanner
+
+The parameters FASTP, LEVEL, and HEADING are for use by a scanner
 routine which makes outline path derivations for an entire file,
-avoiding backtracing."
+avoiding backtracing.  Refile target collection makes use of that."
   (if fastp
       (progn
        (if (> level 19)
@@ -9025,7 +9896,7 @@ avoiding backtracing."
        (prog1
            (delq nil (append org-olpa nil))
          (aset org-olpa level heading)))
-    (let (rtn)
+    (let (rtn case-fold-search)
       (save-excursion
        (save-restriction
          (widen)
@@ -9035,7 +9906,7 @@ avoiding backtracing."
          rtn)))))
 
 (defun org-format-outline-path (path &optional width prefix)
-  "Format the outlie path PATH for display.
+  "Format the outline path PATH for display.
 Width is the maximum number of characters that is available.
 Prefix is a prefix to be included in the returned string,
 such as the file name."
@@ -9075,8 +9946,9 @@ such as the file name."
 (defun org-display-outline-path (&optional file current)
   "Display the current outline path in the echo area."
   (interactive "P")
-  (let ((bfn (buffer-file-name (buffer-base-buffer)))
-       (path (and (org-mode-p) (org-get-outline-path))))
+  (let* ((bfn (buffer-file-name (buffer-base-buffer)))
+        (case-fold-search nil)
+        (path (and (org-mode-p) (org-get-outline-path))))
     (if current (setq path (append path
                                   (save-excursion
                                     (org-back-to-heading t)
@@ -9096,6 +9968,7 @@ such as the file name."
 Note that this is still *before* the stuff will be removed from
 the *old* location.")
 
+(defvar org-capture-last-stored-marker)
 (defun org-refile (&optional goto default-buffer rfloc)
   "Move the entry at point to another heading.
 The list of target headings is compiled using the information in
@@ -9107,113 +9980,130 @@ Depending on `org-reverse-note-order', the new subitem will either be the
 first or the last subitem.
 
 If there is an active region, all entries in that region will be moved.
-However, the region must fulfil the requirement that the first heading
+However, the region must fulfill the requirement that the first heading
 is the first one sets the top-level of the moved text - at most siblings
 below it are allowed.
 
 With prefix arg GOTO, the command will only visit the target location,
 not actually move anything.
-With a double prefix `C-u C-u', go to the location where the last refiling
+With a double prefix arg \\[universal-argument] \\[universal-argument], \
+go to the location where the last refiling
 operation has put the subtree.
 With a prefix argument of `2', refile to the running clock.
 
 RFLOC can be a refile location obtained in a different way.
 
-See also `org-refile-use-outline-path' and `org-completion-use-ido'"
+See also `org-refile-use-outline-path' and `org-completion-use-ido'.
+
+If you are using target caching (see `org-refile-use-cache'),
+You have to clear the target cache in order to find new targets.
+This can be done with a 0 prefix: `C-0 C-c C-w'"
   (interactive "P")
-  (let* ((cbuf (current-buffer))
-        (regionp (org-region-active-p))
-        (region-start (and regionp (region-beginning)))
-        (region-end (and regionp (region-end)))
-        (region-length (and regionp (- region-end region-start)))
-        (filename (buffer-file-name (buffer-base-buffer cbuf)))
-        pos it nbuf file re level reversed)
-    (setq last-command nil)
-    (when regionp
-      (goto-char region-start)
-      (or (bolp) (goto-char (point-at-bol)))
-      (setq region-start (point))
-      (unless (org-kill-is-subtree-p
-              (buffer-substring region-start region-end))
-       (error "The region is not a (sequence of) subtree(s)")))
-    (if (equal goto '(16))
-       (org-refile-goto-last-stored)
-      (when (or
-            (and (equal goto 2)
-                 org-clock-hd-marker (marker-buffer org-clock-hd-marker)
-                 (prog1
-                     (setq it (list (or org-clock-heading "running clock")
-                                    (buffer-file-name
-                                     (marker-buffer org-clock-hd-marker))
-                                    ""
-                                    (marker-position org-clock-hd-marker)))
-                   (setq goto nil)))
-            (setq it (or rfloc
-                         (save-excursion
-                           (org-refile-get-location
-                            (if goto "Goto: " "Refile to: ") default-buffer
-                            org-refile-allow-creating-parent-nodes)))))
-       (setq file (nth 1 it)
-             re (nth 2 it)
-             pos (nth 3 it))
-       (if (and (not goto)
-                pos
-                (equal (buffer-file-name) file)
-                (if regionp
-                    (and (>= pos region-start)
-                         (<= pos region-end))
-                  (and (>= pos (point))
-                       (< pos (save-excursion
-                                (org-end-of-subtree t t))))))
-           (error "Cannot refile to position inside the tree or region"))
-
-       (setq nbuf (or (find-buffer-visiting file)
-                      (find-file-noselect file)))
-       (if goto
-           (progn
-             (switch-to-buffer nbuf)
-             (goto-char pos)
-             (org-show-context 'org-goto))
-         (if regionp
+  (if (member goto '(0 (64)))
+      (org-refile-cache-clear)
+    (let* ((cbuf (current-buffer))
+          (regionp (org-region-active-p))
+          (region-start (and regionp (region-beginning)))
+          (region-end (and regionp (region-end)))
+          (region-length (and regionp (- region-end region-start)))
+          (filename (buffer-file-name (buffer-base-buffer cbuf)))
+          pos it nbuf file re level reversed)
+      (setq last-command nil)
+      (when regionp
+       (goto-char region-start)
+       (or (bolp) (goto-char (point-at-bol)))
+       (setq region-start (point))
+       (unless (org-kill-is-subtree-p
+                (buffer-substring region-start region-end))
+         (error "The region is not a (sequence of) subtree(s)")))
+      (if (equal goto '(16))
+         (org-refile-goto-last-stored)
+       (when (or
+              (and (equal goto 2)
+                   org-clock-hd-marker (marker-buffer org-clock-hd-marker)
+                   (prog1
+                       (setq it (list (or org-clock-heading "running clock")
+                                      (buffer-file-name
+                                       (marker-buffer org-clock-hd-marker))
+                                      ""
+                                      (marker-position org-clock-hd-marker)))
+                     (setq goto nil)))
+              (setq it (or rfloc
+                           (save-excursion
+                             (org-refile-get-location
+                              (if goto "Goto: " "Refile to: ") default-buffer
+                              org-refile-allow-creating-parent-nodes)))))
+         (setq file (nth 1 it)
+               re (nth 2 it)
+               pos (nth 3 it))
+         (if (and (not goto)
+                  pos
+                  (equal (buffer-file-name) file)
+                  (if regionp
+                      (and (>= pos region-start)
+                           (<= pos region-end))
+                    (and (>= pos (point))
+                         (< pos (save-excursion
+                                  (org-end-of-subtree t t))))))
+             (error "Cannot refile to position inside the tree or region"))
+
+         (setq nbuf (or (find-buffer-visiting file)
+                        (find-file-noselect file)))
+         (if goto
              (progn
-               (org-kill-new (buffer-substring region-start region-end))
-               (org-save-markers-in-region region-start region-end))
-           (org-copy-subtree 1 nil t))
-         (with-current-buffer (setq nbuf (or (find-buffer-visiting file)
-                                             (find-file-noselect file)))
-           (setq reversed (org-notes-order-reversed-p))
-           (save-excursion
-             (save-restriction
-               (widen)
-               (if pos
-                   (progn
-                     (goto-char pos)
-                     (looking-at outline-regexp)
-                     (setq level (org-get-valid-level (funcall outline-level) 1))
-                     (goto-char
-                      (if reversed
-                          (or (outline-next-heading) (point-max))
-                        (or (save-excursion (org-get-next-sibling))
-                            (org-end-of-subtree t t)
-                            (point-max)))))
-                 (setq level 1)
-                 (if (not reversed)
-                     (goto-char (point-max))
-                   (goto-char (point-min))
-                   (or (outline-next-heading) (goto-char (point-max)))))
-               (if (not (bolp)) (newline))
-               (bookmark-set "org-refile-last-stored")
-               (org-paste-subtree level)
-               (if (fboundp 'deactivate-mark) (deactivate-mark))
-               (run-hooks 'org-after-refile-insert-hook))))
-         (if regionp
-             (delete-region (point) (+ (point) region-length))
-           (org-cut-subtree))
-         (when (featurep 'org-inlinetask)
-           (org-inlinetask-remove-END-maybe))
-         (setq org-markers-to-move nil)
-         (message "Refiled to \"%s\"" (car it))))))
-  (org-reveal))
+               (switch-to-buffer nbuf)
+               (goto-char pos)
+               (org-show-context 'org-goto))
+           (if regionp
+               (progn
+                 (org-kill-new (buffer-substring region-start region-end))
+                 (org-save-markers-in-region region-start region-end))
+             (org-copy-subtree 1 nil t))
+           (with-current-buffer (setq nbuf (or (find-buffer-visiting file)
+                                               (find-file-noselect file)))
+             (setq reversed (org-notes-order-reversed-p))
+             (save-excursion
+               (save-restriction
+                 (widen)
+                 (if pos
+                     (progn
+                       (goto-char pos)
+                       (looking-at outline-regexp)
+                       (setq level (org-get-valid-level (funcall outline-level) 1))
+                       (goto-char
+                        (if reversed
+                            (or (outline-next-heading) (point-max))
+                          (or (save-excursion (org-get-next-sibling))
+                              (org-end-of-subtree t t)
+                              (point-max)))))
+                   (setq level 1)
+                   (if (not reversed)
+                       (goto-char (point-max))
+                     (goto-char (point-min))
+                     (or (outline-next-heading) (goto-char (point-max)))))
+                 (if (not (bolp)) (newline))
+                 (org-paste-subtree level)
+                 (when org-log-refile
+                   (org-add-log-setup 'refile nil nil 'findpos
+                                      org-log-refile)
+                   (unless (eq org-log-refile 'note)
+                     (save-excursion (org-add-log-note))))
+                 (and org-auto-align-tags (org-set-tags nil t))
+                 (bookmark-set "org-refile-last-stored")
+                 ;; If we are refiling for capture, make sure that the
+                 ;; last-capture pointers point here
+                 (when (org-bound-and-true-p org-refile-for-capture)
+                   (bookmark-set "org-capture-last-stored-marker")
+                   (move-marker org-capture-last-stored-marker (point)))
+                 (if (fboundp 'deactivate-mark) (deactivate-mark))
+                 (run-hooks 'org-after-refile-insert-hook))))
+           (if regionp
+               (delete-region (point) (+ (point) region-length))
+             (org-cut-subtree))
+           (when (featurep 'org-inlinetask)
+             (org-inlinetask-remove-END-maybe))
+           (setq org-markers-to-move nil)
+           (message "Refiled to \"%s\" in file %s" (car it) file)))))))
 
 (defun org-refile-goto-last-stored ()
   "Go to the location where the last refile was stored."
@@ -9265,15 +10155,19 @@ See also `org-refile-use-outline-path' and `org-completion-use-ido'"
            (if (equal (car org-refile-history) (nth 1 org-refile-history))
                (pop org-refile-history)))
          pa)
-      (when (string-match "\\`\\(.*\\)/\\([^/]+\\)\\'" answ)
-       (setq parent (match-string 1 answ)
-             child (match-string 2 answ))
-       (setq parent-target (or (assoc parent tbl) (assoc (concat parent "/") tbl)))
-       (when (and parent-target
-                  (or (eq new-nodes t)
-                      (and (eq new-nodes 'confirm)
-                           (y-or-n-p (format "Create new node \"%s\"? " child)))))
-         (org-refile-new-child parent-target child))))))
+      (if (string-match "\\`\\(.*\\)/\\([^/]+\\)\\'" answ)
+         (progn
+           (setq parent (match-string 1 answ)
+                 child (match-string 2 answ))
+           (setq parent-target (or (assoc parent tbl)
+                                   (assoc (concat parent "/") tbl)))
+           (when (and parent-target
+                      (or (eq new-nodes t)
+                          (and (eq new-nodes 'confirm)
+                               (y-or-n-p (format "Create new node \"%s\"? "
+                                                 child)))))
+             (org-refile-new-child parent-target child)))
+       (error "Invalid target location")))))
 
 (defun org-refile-new-child (parent-target child)
   "Use refile target PARENT-TARGET to add new CHILD below it."
@@ -9398,16 +10292,15 @@ the property list including an extra property :name with the block name."
 (defun org-map-dblocks (&optional command)
   "Apply COMMAND to all dynamic blocks in the current buffer.
 If COMMAND is not given, use `org-update-dblock'."
-  (let ((cmd (or command 'org-update-dblock))
-       pos)
+  (let ((cmd (or command 'org-update-dblock)))
     (save-excursion
       (goto-char (point-min))
       (while (re-search-forward org-dblock-start-re nil t)
-       (goto-char (setq pos (match-beginning 0)))
-       (condition-case nil
-           (funcall cmd)
-         (error (message "Error during update of dynamic block")))
-       (goto-char pos)
+       (goto-char (match-beginning 0))
+        (save-excursion
+          (condition-case nil
+              (funcall cmd)
+            (error (message "Error during update of dynamic block"))))
        (unless (re-search-forward org-dblock-end-re nil t)
          (error "Dynamic block not terminated"))))))
 
@@ -9423,7 +10316,7 @@ blocks in the buffer."
     (org-update-dblock)))
 
 (defun org-update-dblock ()
-  "Update the dynamic block at point
+  "Update the dynamic block at point.
 This means to empty the block, parse for parameters and then call
 the correct writing function."
   (save-window-excursion
@@ -9476,7 +10369,8 @@ This function can be used in a hook."
 (defconst org-additional-option-like-keywords
   '("BEGIN_HTML"  "END_HTML"  "HTML:" "ATTR_HTML"
     "BEGIN_DocBook"  "END_DocBook"  "DocBook:" "ATTR_DocBook"
-    "BEGIN_LaTeX" "END_LaTeX" "LaTeX:" "LATEX_HEADER:" "LATEX_CLASS:" "ATTR_LaTeX"
+    "BEGIN_LaTeX" "END_LaTeX" "LaTeX:" "LATEX_HEADER:"
+    "LATEX_CLASS:" "LATEX_CLASS_OPTIONS:" "ATTR_LaTeX"
     "BEGIN:" "END:"
     "ORGTBL" "TBLFM:" "TBLNAME:"
     "BEGIN_EXAMPLE" "END_EXAMPLE"
@@ -9517,12 +10411,12 @@ This function can be used in a hook."
     )
   "Structure completion elements.
 This is a list of abbreviation keys and values.  The value gets inserted
-it you type @samp{.} followed by the key and then the completion key,
+if you type `<' followed by the key and then press the completion key,
 usually `M-TAB'.  %file will be replaced by a file name after prompting
 for the file using completion.
 There are two templates for each key, the first uses the original Org syntax,
 the second uses Emacs Muse-like syntax tags.  These Muse-like tags become
-the default when the /org-mtags.el/ module has been loaded. See also the
+the default when the /org-mtags.el/ module has been loaded.  See also the
 variable `org-mtags-prefer-muse-templates'.
 This is an experimental feature, it is undecided if it is going to stay in."
   :group 'org-completion
@@ -9636,7 +10530,7 @@ At all other locations, this simply calls the value of
                                  org-link-abbrev-alist))
                    (texp
                     (setq type :tex)
-                    org-html-entities)
+                    (append org-entities-user org-entities))
                    ((string-match "\\`\\*+[ \t]+\\'"
                                   (buffer-substring (point-at-bol) beg))
                     (setq type :todo)
@@ -9742,15 +10636,13 @@ this is nil.")
 
 (defvar org-todo-setup-filter-hook nil
   "Hook for functions that pre-filter todo specs.
-
-Each function takes a todo spec and returns either `nil' or the spec
+Each function takes a todo spec and returns either nil or the spec
 transformed into canonical form." )
 
 (defvar org-todo-get-default-hook nil
   "Hook for functions that get a default item for todo.
-
 Each function takes arguments (NEW-MARK OLD-MARK) and returns either
-`nil' or a string to be used for the todo mark." )
+nil or a string to be used for the todo mark." )
 
 (defvar org-agenda-headline-snapshot-before-repeat)
 
@@ -9767,10 +10659,12 @@ So for this example: when the item starts with TODO, it is changed to DONE.
 When it starts with DONE, the DONE is removed.  And when neither TODO nor
 DONE are present, add TODO at the beginning of the heading.
 
-With C-u prefix arg, use completion to determine the new state.
+With \\[universal-argument] prefix arg, use completion to determine the new \
+state.
 With numeric prefix arg, switch to that state.
-With a double C-u prefix, switch to the next set of TODO keywords (nextset).
-With a triple C-u prefix, circumvent any state blocking.
+With a double \\[universal-argument] prefix, switch to the next set of TODO \
+keywords (nextset).
+With a triple \\[universal-argument] prefix, circumvent any state blocking.
 
 For calling through lisp, arg is also interpreted in the following way:
 'none             -> empty state
@@ -9798,7 +10692,7 @@ For calling through lisp, arg is also interpreted in the following way:
            (looking-at " *"))
        (let* ((match-data (match-data))
               (startpos (point-at-bol))
-              (logging (save-match-data (org-entry-get nil "LOGGING" t)))
+              (logging (save-match-data (org-entry-get nil "LOGGING" t t)))
               (org-log-done org-log-done)
               (org-log-repeat org-log-repeat)
               (org-todo-log-states org-todo-log-states)
@@ -9980,54 +10874,56 @@ changes.  Such blocking occurs when:
   3. The parent of the task is blocked because it has siblings that should
      be done first, or is child of a block grandparent TODO entry."
 
-  (catch 'dont-block
-    ;; If this is not a todo state change, or if this entry is already DONE,
-    ;; do not block
-    (when (or (not (eq (plist-get change-plist :type) 'todo-state-change))
-             (member (plist-get change-plist :from)
-                     (cons 'done org-done-keywords))
-             (member (plist-get change-plist :to)
-                     (cons 'todo org-not-done-keywords))
-             (not (plist-get change-plist :to)))
-      (throw 'dont-block t))
-    ;; If this task has children, and any are undone, it's blocked
-    (save-excursion
-      (org-back-to-heading t)
-      (let ((this-level (funcall outline-level)))
-       (outline-next-heading)
-       (let ((child-level (funcall outline-level)))
-         (while (and (not (eobp))
-                     (> child-level this-level))
-           ;; this todo has children, check whether they are all
-           ;; completed
-           (if (and (not (org-entry-is-done-p))
-                    (org-entry-is-todo-p))
-               (throw 'dont-block nil))
-           (outline-next-heading)
-           (setq child-level (funcall outline-level))))))
-    ;; Otherwise, if the task's parent has the :ORDERED: property, and
-    ;; any previous siblings are undone, it's blocked
-    (save-excursion
-      (org-back-to-heading t)
-      (let* ((pos (point))
-            (parent-pos (and (org-up-heading-safe) (point))))
-       (if (not parent-pos) (throw 'dont-block t)) ; no parent
-       (when (and (org-entry-get (point) "ORDERED")
-                  (forward-line 1)
-                  (re-search-forward org-not-done-heading-regexp pos t))
-         (throw 'dont-block nil)) ; block, there is an older sibling not done.
-       ;; Search further up the hierarchy, to see if an anchestor is blocked
-       (while t
-         (goto-char parent-pos)
-         (if (not (looking-at org-not-done-heading-regexp))
-             (throw 'dont-block t)) ; do not block, parent is not a TODO
-         (setq pos (point))
-         (setq parent-pos (and (org-up-heading-safe) (point)))
+  (if (not org-enforce-todo-dependencies)
+      t ; if locally turned off don't block
+    (catch 'dont-block
+      ;; If this is not a todo state change, or if this entry is already DONE,
+      ;; do not block
+      (when (or (not (eq (plist-get change-plist :type) 'todo-state-change))
+               (member (plist-get change-plist :from)
+                       (cons 'done org-done-keywords))
+               (member (plist-get change-plist :to)
+                       (cons 'todo org-not-done-keywords))
+               (not (plist-get change-plist :to)))
+       (throw 'dont-block t))
+      ;; If this task has children, and any are undone, it's blocked
+      (save-excursion
+       (org-back-to-heading t)
+       (let ((this-level (funcall outline-level)))
+         (outline-next-heading)
+         (let ((child-level (funcall outline-level)))
+           (while (and (not (eobp))
+                       (> child-level this-level))
+             ;; this todo has children, check whether they are all
+             ;; completed
+             (if (and (not (org-entry-is-done-p))
+                      (org-entry-is-todo-p))
+                 (throw 'dont-block nil))
+             (outline-next-heading)
+             (setq child-level (funcall outline-level))))))
+      ;; Otherwise, if the task's parent has the :ORDERED: property, and
+      ;; any previous siblings are undone, it's blocked
+      (save-excursion
+       (org-back-to-heading t)
+       (let* ((pos (point))
+              (parent-pos (and (org-up-heading-safe) (point))))
          (if (not parent-pos) (throw 'dont-block t)) ; no parent
-         (when (and (org-entry-get (point) "ORDERED")
+         (when (and (org-not-nil (org-entry-get (point) "ORDERED"))
                     (forward-line 1)
                     (re-search-forward org-not-done-heading-regexp pos t))
-           (throw 'dont-block nil))))))) ; block, older sibling not done.
+           (throw 'dont-block nil))  ; block, there is an older sibling not done.
+         ;; Search further up the hierarchy, to see if an anchestor is blocked
+         (while t
+           (goto-char parent-pos)
+           (if (not (looking-at org-not-done-heading-regexp))
+               (throw 'dont-block t))  ; do not block, parent is not a TODO
+           (setq pos (point))
+           (setq parent-pos (and (org-up-heading-safe) (point)))
+           (if (not parent-pos) (throw 'dont-block t)) ; no parent
+           (when (and (org-not-nil (org-entry-get (point) "ORDERED"))
+                      (forward-line 1)
+                      (re-search-forward org-not-done-heading-regexp pos t))
+             (throw 'dont-block nil)))))))) ; block, older sibling not done.
 
 (defcustom org-track-ordered-property-with-tag nil
   "Should the ORDERED property also be shown as a tag?
@@ -10071,30 +10967,44 @@ See variable `org-track-ordered-property-with-tag'."
   "Block turning an entry into a TODO, using checkboxes.
 This checks whether the current task should be blocked from state
 changes because there are unchecked boxes in this entry."
-  (catch 'dont-block
-    ;; If this is not a todo state change, or if this entry is already DONE,
-    ;; do not block
-    (when (or (not (eq (plist-get change-plist :type) 'todo-state-change))
-             (member (plist-get change-plist :from)
-                     (cons 'done org-done-keywords))
-             (member (plist-get change-plist :to)
-                     (cons 'todo org-not-done-keywords))
-             (not (plist-get change-plist :to)))
-      (throw 'dont-block t))
-    ;; If this task has checkboxes that are not checked, it's blocked
-    (save-excursion
-      (org-back-to-heading t)
-      (let ((beg (point)) end)
-       (outline-next-heading)
-       (setq end (point))
-       (goto-char beg)
-       (if (re-search-forward "^[ \t]*\\([-+*]\\|[0-9]+[.)]\\)[ \t]+\\[[- ]\\]"
-                              end t)
-           (progn
-             (if (boundp 'org-blocked-by-checkboxes)
-                 (setq org-blocked-by-checkboxes t))
-             (throw 'dont-block nil)))))
-    t)) ; do not block
+  (if (not org-enforce-todo-checkbox-dependencies)
+      t ; if locally turned off don't block
+    (catch 'dont-block
+      ;; If this is not a todo state change, or if this entry is already DONE,
+      ;; do not block
+      (when (or (not (eq (plist-get change-plist :type) 'todo-state-change))
+               (member (plist-get change-plist :from)
+                       (cons 'done org-done-keywords))
+               (member (plist-get change-plist :to)
+                       (cons 'todo org-not-done-keywords))
+               (not (plist-get change-plist :to)))
+       (throw 'dont-block t))
+      ;; If this task has checkboxes that are not checked, it's blocked
+      (save-excursion
+       (org-back-to-heading t)
+       (let ((beg (point)) end)
+         (outline-next-heading)
+         (setq end (point))
+         (goto-char beg)
+         (if (re-search-forward "^[ \t]*\\([-+*]\\|[0-9]+[.)]\\)[ \t]+\\[[- ]\\]"
+                                end t)
+             (progn
+               (if (boundp 'org-blocked-by-checkboxes)
+                   (setq org-blocked-by-checkboxes t))
+               (throw 'dont-block nil)))))
+      t))) ; do not block
+
+(defun org-entry-blocked-p ()
+  "Is the current entry blocked?"
+  (if (org-entry-get nil "NOBLOCKING")
+      nil ;; Never block this entry
+    (not
+     (run-hook-with-args-until-failure
+      'org-blocker-hook
+      (list :type 'todo-state-change
+           :position (point)
+           :from 'todo
+           :to 'done)))))
 
 (defun org-update-statistics-cookies (all)
   "Update the statistics cookie, either from TODO or from checkboxes.
@@ -10116,8 +11026,9 @@ This should be called with the cursor in a line with a statistics cookie."
                      (outline-next-heading)
                      (if (org-on-heading-p) (setq l2 (org-outline-level)))
                      (point)))
-         (if (and (save-excursion (re-search-forward
-                                   "^[ \t]*[-+*] \\[[- X]\\]" end t))
+         (if (and (save-excursion
+                    (re-search-forward
+                     "^[ \t]*\\([-+*]\\|[0-9]+[.)]\\) \\[[- X]\\]" end t))
                   (not (save-excursion (re-search-forward
                                         ":COOKIE_DATA:.*\\<todo\\>" end t))))
              (org-update-checkbox-count)
@@ -10125,7 +11036,12 @@ This should be called with the cursor in a line with a statistics cookie."
                (progn
                  (goto-char end)
                  (org-update-parent-todo-statistics))
-             (error "No data for statistics cookie"))))
+             (goto-char pos)
+             (beginning-of-line 1)
+             (while (re-search-forward
+                     "\\(\\(\\[[0-9]*%\\]\\)\\|\\(\\[[0-9]*/[0-9]*\\]\\)\\)"
+                     (point-at-eol) t)
+               (replace-match (if (match-end 2) "[100%]" "[0/0]") t t)))))
        (goto-char pos)
        (move-marker pos nil)))))
 
@@ -10398,12 +11314,17 @@ This function is run automatically after each state change to a DONE state."
         (org-log-done nil)
         (org-todo-log-states nil)
         (nshiftmax 10) (nshift 0)
-        re type n what ts time)
+        re type n what ts time to-state)
     (when repeat
       (if (eq org-log-repeat t) (setq org-log-repeat 'state))
-      (org-todo (if (eq interpret 'type) last-state head))
-      (org-entry-put nil "LAST_REPEAT" (format-time-string
-                                       (org-time-stamp-format t t)))
+      (setq to-state (or (org-entry-get nil "REPEAT_TO_STATE")
+                        org-todo-repeat-to-state))
+      (unless (and to-state (member to-state org-todo-keywords-1))
+       (setq to-state (if (eq interpret 'type) last-state head)))
+      (org-todo to-state)
+      (when (or org-log-repeat (org-entry-get nil "CLOCK"))
+       (org-entry-put nil "LAST_REPEAT" (format-time-string
+                                         (org-time-stamp-format t t))))
       (when org-log-repeat
        (if (or (memq 'org-add-log-note (default-value 'post-command-hook))
                (memq 'org-add-log-note post-command-hook))
@@ -10488,20 +11409,37 @@ With argument REMOVE, remove any deadline from the item.
 When TIME is set, it should be an internal time specification, and the
 scheduling will use the corresponding date."
   (interactive "P")
-  (let ((old-date (org-entry-get nil "DEADLINE")))
+  (let* ((old-date (org-entry-get nil "DEADLINE"))
+        (repeater (and old-date
+                       (string-match "\\([.+]+[0-9]+[dwmy]\\) ?" old-date)
+                       (match-string 1 old-date))))
     (if remove
        (progn
+         (when (and old-date org-log-redeadline)
+           (org-add-log-setup 'deldeadline nil old-date 'findpos
+                              org-log-redeadline))
          (org-remove-timestamp-with-keyword org-deadline-string)
          (message "Item no longer has a deadline."))
-      (if (org-get-repeat)
-         (error "Cannot change deadline on task with repeater, please do that by hand")
-       (org-add-planning-info 'deadline time 'closed)
-       (when (and old-date org-log-redeadline
-                  (not (equal old-date
-                              (substring org-last-inserted-timestamp 1 -1))))
-         (org-add-log-setup 'redeadline nil old-date 'findpos
-                            org-log-redeadline))
-       (message "Deadline on %s" org-last-inserted-timestamp)))))
+      (org-add-planning-info 'deadline time 'closed)
+      (when (and old-date org-log-redeadline
+                (not (equal old-date
+                            (substring org-last-inserted-timestamp 1 -1))))
+       (org-add-log-setup 'redeadline nil old-date 'findpos
+                          org-log-redeadline))
+      (when repeater
+       (save-excursion
+         (org-back-to-heading t)
+         (when (re-search-forward (concat org-deadline-string " "
+                                          org-last-inserted-timestamp)
+                                  (save-excursion
+                                    (outline-next-heading) (point)) t)
+           (goto-char (1- (match-end 0)))
+           (insert " " repeater)
+           (setq org-last-inserted-timestamp
+                 (concat (substring org-last-inserted-timestamp 0 -1)
+                         " " repeater
+                         (substring org-last-inserted-timestamp -1))))))
+      (message "Deadline on %s" org-last-inserted-timestamp))))
 
 (defun org-schedule (&optional remove time)
   "Insert the SCHEDULED: string with a timestamp to schedule a TODO item.
@@ -10509,20 +11447,37 @@ With argument REMOVE, remove any scheduling date from the item.
 When TIME is set, it should be an internal time specification, and the
 scheduling will use the corresponding date."
   (interactive "P")
-  (let ((old-date (org-entry-get nil "SCHEDULED")))
+  (let* ((old-date (org-entry-get nil "SCHEDULED"))
+        (repeater (and old-date
+                       (string-match "\\([.+]+[0-9]+[dwmy]\\) ?" old-date)
+                       (match-string 1 old-date))))
     (if remove
        (progn
+         (when (and old-date org-log-reschedule)
+           (org-add-log-setup 'delschedule nil old-date 'findpos
+                              org-log-reschedule))
          (org-remove-timestamp-with-keyword org-scheduled-string)
          (message "Item is no longer scheduled."))
-      (if (org-get-repeat)
-         (error "Cannot reschedule task with repeater, please do that by hand")
-       (org-add-planning-info 'scheduled time 'closed)
-       (when (and old-date org-log-reschedule
-                  (not (equal old-date
-                              (substring org-last-inserted-timestamp 1 -1))))
-         (org-add-log-setup 'reschedule nil old-date 'findpos
-                            org-log-reschedule))
-       (message "Scheduled to %s" org-last-inserted-timestamp)))))
+      (org-add-planning-info 'scheduled time 'closed)
+      (when (and old-date org-log-reschedule
+                (not (equal old-date
+                            (substring org-last-inserted-timestamp 1 -1))))
+       (org-add-log-setup 'reschedule nil old-date 'findpos
+                          org-log-reschedule))
+      (when repeater
+       (save-excursion
+         (org-back-to-heading t)
+         (when (re-search-forward (concat org-scheduled-string " "
+                                          org-last-inserted-timestamp)
+                                  (save-excursion
+                                    (outline-next-heading) (point)) t)
+           (goto-char (1- (match-end 0)))
+           (insert " " repeater)
+           (setq org-last-inserted-timestamp
+                 (concat (substring org-last-inserted-timestamp 0 -1)
+                         " " repeater
+                         (substring org-last-inserted-timestamp -1))))))
+      (message "Scheduled to %s" org-last-inserted-timestamp))))
 
 (defun org-get-scheduled-time (pom &optional inherit)
   "Get the scheduled time as a time tuple, of a format suitable
@@ -10533,7 +11488,7 @@ returns nil."
       (apply 'encode-time (org-parse-time-string time)))))
 
 (defun org-get-deadline-time (pom &optional inherit)
-  "Get the deadine as a time tuple, of a format suitable for
+  "Get the deadline as a time tuple, of a format suitable for
 calling org-deadline with, or if there is no scheduling, returns
 nil."
   (let ((time (org-entry-get pom "DEADLINE" inherit)))
@@ -10651,7 +11606,7 @@ be removed."
              (end-of-line 1))
            (goto-char (point-min))
            (widen)
-           (if (and (looking-at "[ \t]+\n")
+           (if (and (looking-at "[ \t]*\n")
                     (equal (char-before) ?\n))
                (delete-region (1- (point)) (point-at-eol)))
            ts))))))
@@ -10766,8 +11721,14 @@ EXTRA is additional text that will be inserted into the notes buffer."
                              (or org-log-note-state "")))
                     ((eq org-log-note-purpose 'reschedule)
                      "rescheduling")
+                    ((eq org-log-note-purpose 'delschedule)
+                     "no longer scheduled")
                     ((eq org-log-note-purpose 'redeadline)
                      "changing deadline")
+                    ((eq org-log-note-purpose 'deldeadline)
+                     "removing deadline")
+                    ((eq org-log-note-purpose 'refile)
+                     "refiling")
                     ((eq org-log-note-purpose 'note)
                      "this entry")
                     (t (error "This should not happen")))))
@@ -10795,6 +11756,9 @@ EXTRA is additional text that will be inserted into the notes buffer."
                   (cons "%t" (format-time-string
                               (org-time-stamp-format 'long 'inactive)
                               (current-time)))
+                  (cons "%T" (format-time-string
+                              (org-time-stamp-format 'long nil)
+                              (current-time)))
                   (cons "%s" (if org-log-note-state
                                  (concat "\"" org-log-note-state "\"")
                                ""))
@@ -10849,7 +11813,8 @@ POS may also be a marker."
 This command can create sparse trees.  You first need to select the type
 of match used to create the tree:
 
-t      Show entries with a specific TODO keyword.
+t      Show all TODO entries.
+T      Show entries with a specific TODO keyword.
 m      Show entries selected by a tags/property match.
 p      Enter a property name and its value (both with completion on existing
        names/values) and show entries with that property.
@@ -10859,7 +11824,7 @@ b      Show deadlines and scheduled items before a date.
 a      Show deadlines and scheduled items after a date."
   (interactive "P")
   (let (ans kwd value)
-    (message "Sparse tree: [/]regexp [t]odo-kwd [m]atch [p]roperty [d]eadlines [b]efore-date [a]fter-date")
+    (message "Sparse tree: [/]regexp [t]odo [T]odo-kwd [m]atch [p]roperty [d]eadlines\n             [b]efore-date [a]fter-date")
     (setq ans (read-char-exclusive))
     (cond
      ((equal ans ?d)
@@ -10869,6 +11834,8 @@ a      Show deadlines and scheduled items after a date."
      ((equal ans ?a)
       (call-interactively 'org-check-after-date))
      ((equal ans ?t)
+      (org-show-todo-tree nil))
+     ((equal ans ?T)
       (org-show-todo-tree '(4)))
      ((member ans '(?T ?m))
       (call-interactively 'org-match-sparse-tree))
@@ -10940,7 +11907,7 @@ that the match should indeed be shown."
     cnt))
 
 (defun org-show-context (&optional key)
-  "Make sure point and context and visible.
+  "Make sure point and context are visible.
 How much context is shown depends upon the variables
 `org-show-hierarchy-above', `org-show-following-heading'. and
 `org-show-siblings'."
@@ -10971,6 +11938,9 @@ How much context is shown depends upon the variables
            (org-flag-heading nil)
            (when siblings-p (org-show-siblings))))))))
 
+(defvar org-reveal-start-hook nil
+  "Hook run before revealing a location.")
+
 (defun org-reveal (&optional siblings)
   "Show current entry, hierarchy above it, and the following headline.
 This can be used to show a consistent set of context around locations
@@ -10979,17 +11949,26 @@ not t for the search context.
 
 With optional argument SIBLINGS, on each level of the hierarchy all
 siblings are shown.  This repairs the tree structure to what it would
-look like when opened with hierarchical calls to `org-cycle'."
+look like when opened with hierarchical calls to `org-cycle'.
+With double optional argument \\[universal-argument] \\[universal-argument], \
+go to the parent and show the
+entire tree."
   (interactive "P")
+  (run-hooks 'org-reveal-start-hook)
   (let ((org-show-hierarchy-above t)
        (org-show-following-heading t)
        (org-show-siblings (if siblings t org-show-siblings)))
-    (org-show-context nil)))
+    (org-show-context nil))
+  (when (equal siblings '(16))
+    (save-excursion
+      (when (org-up-heading-safe)
+       (org-show-subtree)
+       (run-hook-with-args 'org-cycle-hook 'subtree)))))
 
 (defun org-highlight-new-match (beg end)
   "Highlight from BEG to END and mark the highlight is an occur headline."
-  (let ((ov (org-make-overlay beg end)))
-    (org-overlay-put ov 'face 'secondary-selection)
+  (let ((ov (make-overlay beg end)))
+    (overlay-put ov 'face 'secondary-selection)
     (push ov org-occur-highlights)))
 
 (defun org-remove-occur-highlights (&optional beg end noremove)
@@ -10998,7 +11977,7 @@ BEG and END are ignored.  If NOREMOVE is nil, remove this function
 from the `before-change-functions' in the current buffer."
   (interactive)
   (unless org-inhibit-highlight-removal
-    (mapc 'org-delete-overlay org-occur-highlights)
+    (mapc 'delete-overlay org-occur-highlights)
     (setq org-occur-highlights nil)
     (setq org-occur-parameters nil)
     (unless noremove
@@ -11501,7 +12480,7 @@ epoch to the beginning of today (00:00)."
   (delq nil list))
 
 (defvar org-add-colon-after-tag-completion nil)  ;; dynamically scoped param
-(defvar org-tags-overlay (org-make-overlay 1 1))
+(defvar org-tags-overlay (make-overlay 1 1))
 (org-detach-overlay org-tags-overlay)
 
 (defun org-get-local-tags-at (&optional pos)
@@ -11654,6 +12633,16 @@ If DATA is nil or the empty string, any tags will be removed."
       (if (looking-at ".*?\\([ \t]+\\)$")
          (delete-region (match-beginning 1) (match-end 1))))))
 
+(defun org-align-all-tags ()
+  "Align the tags i all headings."
+  (interactive)
+  (save-excursion
+    (or (ignore-errors (org-back-to-heading t))
+       (outline-next-heading))
+    (if (org-on-heading-p)
+       (org-set-tags t)
+      (message "No headings"))))
+
 (defun org-set-tags (&optional arg just-align)
   "Set the tags for the current headline.
 With prefix ARG, realign all tags in headings in the current buffer."
@@ -11677,7 +12666,9 @@ With prefix ARG, realign all tags in headings in the current buffer."
        ;; Get a new set of tags from the user
        (save-excursion
          (setq table (append org-tag-persistent-alist
-                             (or org-tag-alist (org-get-buffer-tags)))
+                             (or org-tag-alist (org-get-buffer-tags))
+                             (and org-complete-tags-always-offer-all-agenda-tags
+                                  (org-global-tags-completion-table (org-agenda-files))))
                org-last-tags-completion-table table
                current-tags (org-split-string current ":")
                inherited-tags (nreverse
@@ -11719,7 +12710,8 @@ With prefix ARG, realign all tags in headings in the current buffer."
        (if (equal tags "")
            (setq rpl "")
          (goto-char (match-beginning 0))
-         (setq c0 (current-column) p0 (point)
+         (setq c0 (current-column) p0 (if (equal (char-before) ?*)
+                                          (1+ (point)) (point))
                c1 (max (1+ c0) (if (> org-tags-column 0)
                                    org-tags-column
                                  (- (- org-tags-column) (length tags))))
@@ -11822,6 +12814,7 @@ This works in the agenda, and also in an org-mode buffer."
       (put-text-property 0 (length s) 'face '(secondary-selection org-tag) s)
       (org-overlay-display org-tags-overlay (concat prefix s)))))
 
+(defvar org-last-tag-selection-key nil)
 (defun org-fast-tag-selection (current inherited table &optional todo-table)
   "Fast tag selection with single keys.
 CURRENT is the current list of tags in the headline, INHERITED is the
@@ -11863,7 +12856,7 @@ Returns the new tags string, or nil to not change the current settings."
               (if (> (current-column) org-tags-column)
                   " "
                 (make-string (- org-tags-column (current-column)) ?\ ))))))
-    (org-move-overlay org-tags-overlay ov-start ov-end)
+    (move-overlay org-tags-overlay ov-start ov-end)
     (save-window-excursion
       (if expert
          (set-buffer (get-buffer-create " *Org tags*"))
@@ -11936,6 +12929,7 @@ Returns the new tags string, or nil to not change the current settings."
                         (if (not groups) "no " "")
                         (if expert " [C-c]:window" (if exit-after-next " [C-c]:single" " [C-c]:multi")))
                (setq c (let ((inhibit-quit t)) (read-char-exclusive)))
+               (setq org-last-tag-selection-key c)
                (cond
                 ((= c ?\r) (throw 'exit t))
                 ((= c ?!)
@@ -12159,7 +13153,7 @@ a *different* entry, you cannot use these techniques."
 
 (defconst org-special-properties
   '("TODO" "TAGS" "ALLTAGS" "DEADLINE" "SCHEDULED" "CLOCK" "CLOSED" "PRIORITY"
-    "TIMESTAMP" "TIMESTAMP_IA")
+    "TIMESTAMP" "TIMESTAMP_IA" "BLOCKED")
   "The special properties valid in Org-mode.
 
 These are properties that are not defined in the property drawer,
@@ -12170,8 +13164,8 @@ but in some other way.")
     "LOCATION" "LOGGING" "COLUMNS" "VISIBILITY"
     "TABLE_EXPORT_FORMAT" "TABLE_EXPORT_FILE"
     "EXPORT_FILE_NAME" "EXPORT_TITLE" "EXPORT_AUTHOR" "EXPORT_DATE"
-    "ORDERED" "NOBLOCKING" "COOKIE_DATA" "LOG_INTO_DRAWER"
-    "CLOCK_MODELINE_TOTAL" "STYLE")
+    "ORDERED" "NOBLOCKING" "COOKIE_DATA" "LOG_INTO_DRAWER" "REPEAT_TO_STATE"
+    "CLOCK_MODELINE_TOTAL" "STYLE" "HTML_CONTAINER_CLASS")
   "Some properties that are used by Org-mode for various purposes.
 Being in this list makes sure that they are offered for completion.")
 
@@ -12179,7 +13173,7 @@ Being in this list makes sure that they are offered for completion.")
   "Regular expression matching the first line of a property drawer.")
 
 (defconst org-property-end-re "^[ \t]*:END:[ \t]*$"
-  "Regular expression matching the first line of a property drawer.")
+  "Regular expression matching the last line of a property drawer.")
 
 (defconst org-clock-drawer-start-re "^[ \t]*:CLOCK:[ \t]*$"
   "Regular expression matching the first line of a property drawer.")
@@ -12256,13 +13250,15 @@ allowed value."
     (message "%s is now %s" prop val)))
 
 (defun org-at-property-p ()
-  "Is the cursor in a property line?"
-  ;; FIXME: Does not check if we are actually in the drawer.
-  ;; FIXME: also returns true on any drawers.....
-  ;; This is used by C-c C-c for property action.
+  "Is cursor inside a property drawer?"
   (save-excursion
     (beginning-of-line 1)
-    (looking-at (org-re "^[ \t]*\\(:\\([[:alpha:]][[:alnum:]_-]*\\):\\)[ \t]*\\(.*\\)"))))
+    (when (looking-at (org-re "^[ \t]*\\(:\\([[:alpha:]][[:alnum:]_-]*\\):\\)[ \t]*\\(.*\\)"))
+      (save-match-data ;; Used by calling procedures
+       (let ((p (point))
+             (range (unless (org-before-first-heading-p)
+                      (org-get-property-block))))
+         (and range (<= (car range) p) (< p (cdr range))))))))
 
 (defun org-get-property-block (&optional beg end force)
   "Return the (beg . end) range of the body of the property drawer.
@@ -12293,7 +13289,7 @@ If the drawer does not exist and FORCE is non-nil, create the drawer."
          (insert ":END:\n"))
        (cons beg end)))))
 
-(defun org-entry-properties (&optional pom which)
+(defun org-entry-properties (&optional pom which specific)
   "Get all properties of the entry at point-or-marker POM.
 This includes the TODO keyword, the tags, time strings for deadline,
 scheduled, and clocking, and any additional properties defined in the
@@ -12301,12 +13297,16 @@ entry.  The return value is an alist, keys may occur multiple times
 if the property key was used several times.
 POM may also be nil, in which case the current entry is used.
 If WHICH is nil or `all', get all properties.  If WHICH is
-`special' or `standard', only get that subclass."
+`special' or `standard', only get that subclass.  If WHICH
+is a string only get exactly this property.  Specific can be a string, the
+specific property we are interested in.  Specifying it can speed
+things up because then unnecessary parsing is avoided."
   (setq which (or which 'all))
   (org-with-point-at pom
     (let ((clockstr (substring org-clock-string 0 -1))
-         (excluded '("TODO" "TAGS" "ALLTAGS" "PRIORITY"))
-         beg end range props sum-props key value string clocksum)
+         (excluded '("TODO" "TAGS" "ALLTAGS" "PRIORITY" "BLOCKED"))
+         (case-fold-search nil)
+         beg end range props sum-props key key1 value string clocksum)
       (save-excursion
        (when (condition-case nil
                  (and (org-mode-p) (org-back-to-heading t))
@@ -12319,31 +13319,53 @@ If WHICH is nil or `all', get all properties.  If WHICH is
          (when (memq which '(all special))
            ;; Get the special properties, like TODO and tags
            (goto-char beg)
-           (when (and (looking-at org-todo-line-regexp) (match-end 2))
+           (when (and (or (not specific) (string= specific "TODO"))
+                      (looking-at org-todo-line-regexp) (match-end 2))
              (push (cons "TODO" (org-match-string-no-properties 2)) props))
-           (when (looking-at org-priority-regexp)
+           (when (and (or (not specific) (string= specific "PRIORITY"))
+                      (looking-at org-priority-regexp))
              (push (cons "PRIORITY" (org-match-string-no-properties 2)) props))
-           (when (and (setq value (org-get-tags-string))
+           (when (and (or (not specific) (string= specific "TAGS"))
+                      (setq value (org-get-tags-string))
                       (string-match "\\S-" value))
              (push (cons "TAGS" value) props))
-           (when (setq value (org-get-tags-at))
-             (push (cons "ALLTAGS" (concat ":" (mapconcat 'identity value ":") ":"))
+           (when (and (or (not specific) (string= specific "ALLTAGS"))
+                      (setq value (org-get-tags-at)))
+             (push (cons "ALLTAGS" (concat ":" (mapconcat 'identity value ":")
+                                           ":"))
                    props))
-           (while (re-search-forward org-maybe-keyword-time-regexp end t)
-             (setq key (if (match-end 1) (substring (org-match-string-no-properties 1) 0 -1))
-                   string (if (equal key clockstr)
-                              (org-no-properties
-                               (org-trim
-                                (buffer-substring
-                                 (match-beginning 3) (goto-char (point-at-eol)))))
-                            (substring (org-match-string-no-properties 3) 1 -1)))
-             (unless key
-               (if (= (char-after (match-beginning 3)) ?\[)
-                   (setq key "TIMESTAMP_IA")
-                 (setq key "TIMESTAMP")))
-             (when (or (equal key clockstr) (not (assoc key props)))
-               (push (cons key string) props)))
-
+           (when (or (not specific) (string= specific "BLOCKED"))
+             (push (cons "BLOCKED" (if (org-entry-blocked-p) "t" "")) props))
+           (when (or (not specific)
+                     (member specific
+                             '("SCHEDULED" "DEADLINE" "CLOCK" "CLOSED"
+                               "TIMESTAMP" "TIMESTAMP_IA")))
+             (while (re-search-forward org-maybe-keyword-time-regexp end t)
+               (setq key (if (match-end 1)
+                             (substring (org-match-string-no-properties 1)
+                                        0 -1))
+                     string (if (equal key clockstr)
+                                (org-no-properties
+                                 (org-trim
+                                  (buffer-substring
+                                   (match-beginning 3) (goto-char
+                                                        (point-at-eol)))))
+                              (substring (org-match-string-no-properties 3)
+                                         1 -1)))
+               ;; Get the correct property name from the key.  This is
+               ;; necessary if the user has configured time keywords.
+               (setq key1 (concat key ":"))
+               (cond
+                ((not key)
+                 (setq key
+                       (if (= (char-after (match-beginning 3)) ?\[)
+                           "TIMESTAMP_IA" "TIMESTAMP")))
+                ((equal key1 org-scheduled-string) (setq key "SCHEDULED"))
+                ((equal key1 org-deadline-string)  (setq key "DEADLINE"))
+                ((equal key1 org-closed-string)    (setq key "CLOSED"))
+                ((equal key1 org-clock-string)     (setq key "CLOCK")))
+               (when (or (equal key "CLOCK") (not (assoc key props)))
+                 (push (cons key string) props))))
            )
 
          (when (memq which '(all standard))
@@ -12370,22 +13392,27 @@ If WHICH is nil or `all', get all properties.  If WHICH is
            (push (cons "CATEGORY" value) props))
          (append sum-props (nreverse props)))))))
 
-(defun org-entry-get (pom property &optional inherit)
+(defun org-entry-get (pom property &optional inherit literal-nil)
   "Get value of PROPERTY for entry at point-or-marker POM.
 If INHERIT is non-nil and the entry does not have the property,
 then also check higher levels of the hierarchy.
 If INHERIT is the symbol `selective', use inheritance only if the setting
 in `org-use-property-inheritance' selects PROPERTY for inheritance.
 If the property is present but empty, the return value is the empty string.
-If the property is not present at all, nil is returned."
+If the property is not present at all, nil is returned.
+
+If LITERAL-NIL is set, return the string value \"nil\" as a string,
+do not interpret it as the list atom nil.  This is used for inheritance
+when a \"nil\" value can supersede a non-nil value higher up the hierarchy."
   (org-with-point-at pom
     (if (and inherit (if (eq inherit 'selective)
                         (org-property-inherit-p property)
                       t))
-       (org-entry-get-with-inheritance property)
+       (org-entry-get-with-inheritance property literal-nil)
       (if (member property org-special-properties)
-         ;; We need a special property.  Use brute force, get all properties.
-         (cdr (assoc property (org-entry-properties nil 'special)))
+         ;; We need a special property.  Use `org-entry-properties' to
+         ;; retrieve it, but specify the wanted property
+         (cdr (assoc property (org-entry-properties nil 'special property)))
        (let ((range (org-get-property-block)))
          (if (and range
                   (goto-char (car range))
@@ -12394,7 +13421,9 @@ If the property is not present at all, nil is returned."
                    (cdr range) t))
              ;; Found the property, return it.
              (if (match-end 1)
-                 (org-match-string-no-properties 1)
+                 (if literal-nil
+                     (org-match-string-no-properties 1)
+                   (org-not-nil (org-match-string-no-properties 1)))
                "")))))))
 
 (defun org-property-or-variable-value (var &optional inherit)
@@ -12489,8 +13518,12 @@ no match, the marker will point nowhere.
 Note that also `org-entry-get' calls this function, if the INHERIT flag
 is set.")
 
-(defun org-entry-get-with-inheritance (property)
-  "Get entry property, and search higher levels if not present."
+(defun org-entry-get-with-inheritance (property &optional literal-nil)
+  "Get entry property, and search higher levels if not present.
+The search will stop at the first ancestor which has the property defined.
+If the value found is \"nil\", return nil to show that the property
+should be considered as undefined (this is the meaning of nil here).
+However, if LITERAL-NIL is set, return the string value \"nil\" instead."
   (move-marker org-entry-property-inherited-from nil)
   (let (tmp)
     (save-excursion
@@ -12498,15 +13531,21 @@ is set.")
        (widen)
        (catch 'ex
          (while t
-           (when (setq tmp (org-entry-get nil property))
+           (when (setq tmp (org-entry-get nil property nil 'literal-nil))
              (org-back-to-heading t)
              (move-marker org-entry-property-inherited-from (point))
              (throw 'ex tmp))
            (or (org-up-heading-safe) (throw 'ex nil)))))
-      (or tmp
-         (cdr (assoc property org-file-properties))
-         (cdr (assoc property org-global-properties))
-         (cdr (assoc property org-global-properties-fixed))))))
+      (setq tmp (or tmp
+                   (cdr (assoc property org-file-properties))
+                   (cdr (assoc property org-global-properties))
+                   (cdr (assoc property org-global-properties-fixed))))
+      (if literal-nil tmp (org-not-nil tmp)))))
+
+(defvar org-property-changed-functions nil
+  "Hook called when the value of a property has changed.
+Each hook function should accept two arguments, the name of the property
+and the new value.")
 
 (defun org-entry-put (pom property value)
   "Set PROPERTY to VALUE for entry at point-or-marker POM."
@@ -12560,7 +13599,8 @@ is set.")
            (org-indent-line-function)
            (insert ":" property ":"))
          (and value (insert " " value))
-         (org-indent-line-function)))))))
+         (org-indent-line-function)))))
+    (run-hook-with-args 'org-property-changed-functions property value)))
 
 (defun org-buffer-property-keys (&optional include-specials include-defaults include-columns)
   "Get all property keys in the current buffer.
@@ -12680,16 +13720,17 @@ in the current file."
                                          keys)))
                      prop0)))
          (cur (org-entry-get nil prop))
+         (prompt (concat prop " value"
+                         (if (and cur (string-match "\\S-" cur))
+                             (concat " [" cur "]") "") ": "))
          (allowed (org-property-get-allowed-values nil prop 'table))
          (existing (mapcar 'list (org-property-values prop)))
          (val (if allowed
-                  (org-completing-read "Value: " allowed nil 'req-match)
+                  (org-completing-read prompt allowed nil
+                     (not (get-text-property 0 'org-unrestricted
+                                             (caar allowed))))
                 (let (org-completion-use-ido org-completion-use-iswitchb)
-                  (org-completing-read
-                   (concat "Value " (if (and cur (string-match "\\S-" cur))
-                                       (concat "[" cur "]") "")
-                           ": ")
-                   existing nil nil "" nil cur)))))
+                  (org-completing-read prompt existing nil nil "" nil cur)))))
      (list prop (if (equal val "") cur val))))
   (unless (equal (org-entry-get nil property) value)
     (org-entry-put nil property value)))
@@ -12698,8 +13739,8 @@ in the current file."
   "In the current entry, delete PROPERTY."
   (interactive
    (let* ((completion-ignore-case t)
-         (prop (org-icompleting-read
-                "Property: " (org-entry-properties nil 'standard))))
+         (prop (org-icompleting-read "Property: "
+                                     (org-entry-properties nil 'standard))))
      (list prop)))
   (message "Property %s %s" property
           (if (org-entry-delete nil property)
@@ -12741,6 +13782,15 @@ then applies it to the property in the column format's scope."
       (error "No operator defined for property %s" prop))
     (org-columns-compute prop)))
 
+(defvar org-property-allowed-value-functions nil
+  "Hook for functions supplying allowed values for a specific property.
+The functions must take a single argument, the name of the property, and
+return a flat list of allowed values.  If \":ETC\" is one of
+the values, this means that these values are intended as defaults for
+completion, but that other values should be allowed too.
+The functions must return nil if they are not responsible for this
+property.")
+
 (defun org-property-get-allowed-values (pom property &optional table)
   "Get allowed values for the property PROPERTY.
 When TABLE is non-nil, return an alist that can directly be used for
@@ -12756,9 +13806,10 @@ completion."
          (push (char-to-string n) vals)
          (setq n (1- n)))))
      ((member property org-special-properties))
+     ((setq vals (run-hook-with-args-until-success
+                 'org-property-allowed-value-functions property)))
      (t
       (setq vals (org-entry-get pom (concat property "_ALL") 'inherit))
-
       (when (and vals (string-match "\\S-" vals))
        (setq vals (car (read-from-string (concat "(" vals ")"))))
        (setq vals (mapcar (lambda (x)
@@ -12767,6 +13818,9 @@ completion."
                                   ((symbolp x) (symbol-name x))
                                   (t "???")))
                           vals)))))
+    (when (member ":ETC" vals)
+      (setq vals (remove ":ETC" vals))
+      (org-add-props (car vals) '(org-unrestricted t)))
     (if table (mapcar 'list vals) vals)))
 
 (defun org-property-previous-allowed-value (&optional previous)
@@ -12797,7 +13851,53 @@ completion."
     (replace-match (concat " :" key ": " nval) t t)
     (org-indent-line-function)
     (beginning-of-line 1)
-    (skip-chars-forward " \t")))
+    (skip-chars-forward " \t")
+    (run-hook-with-args 'org-property-changed-functions key nval)))
+
+(defun org-find-olp (path &optional this-buffer)
+  "Return a marker pointing to the entry at outline path OLP.
+If anything goes wrong, throw an error.
+You can wrap this call to catch the error like this:
+
+  (condition-case msg
+      (org-mobile-locate-entry (match-string 4))
+    (error (nth 1 msg)))
+
+The return value will then be either a string with the error message,
+or a marker if everything is OK.
+
+If THIS-BUFFER is set, the outline path does not contain a file,
+only headings."
+  (let* ((file (if this-buffer buffer-file-name (pop path)))
+        (buffer (if this-buffer (current-buffer) (find-file-noselect file)))
+        (level 1)
+        (lmin 1)
+        (lmax 1)
+        limit re end found pos heading cnt)
+    (unless buffer (error "File not found :%s" file))
+    (with-current-buffer buffer
+      (save-excursion
+       (save-restriction
+         (widen)
+         (setq limit (point-max))
+         (goto-char (point-min))
+         (while (setq heading (pop path))
+           (setq re (format org-complex-heading-regexp-format
+                            (regexp-quote heading)))
+           (setq cnt 0 pos (point))
+           (while (re-search-forward re end t)
+             (setq level (- (match-end 1) (match-beginning 1)))
+             (if (and (>= level lmin) (<= level lmax))
+                 (setq found (match-beginning 0) cnt (1+ cnt))))
+           (when (= cnt 0) (error "Heading not found on level %d: %s"
+                                  lmax heading))
+           (when (> cnt 1) (error "Heading not unique on level %d: %s"
+                                  lmax heading))
+           (goto-char found)
+           (setq lmin (1+ level) lmax (+ lmin (if org-odd-levels-only 1 0)))
+           (setq end (save-excursion (org-end-of-subtree t t))))
+         (when (org-on-heading-p)
+           (move-marker (make-marker) (point))))))))
 
 (defun org-find-entry-with-id (ident)
   "Locate the entry that contains the ID property with exact value IDENT.
@@ -12905,8 +14005,8 @@ So these are more for recording a certain time/date."
   (interactive "P")
   (org-time-stamp arg 'inactive))
 
-(defvar org-date-ovl (org-make-overlay 1 1))
-(org-overlay-put org-date-ovl 'face 'org-warning)
+(defvar org-date-ovl (make-overlay 1 1))
+(overlay-put org-date-ovl 'face 'org-warning)
 (org-detach-overlay org-date-ovl)
 
 (defvar org-ans1) ; dynamically scoped parameter
@@ -12927,10 +14027,15 @@ The prompt will suggest to enter an ISO date, but you can also enter anything
 which will at least partially be understood by `parse-time-string'.
 Unrecognized parts of the date will default to the current day, month, year,
 hour and minute.  If this command is called to replace a timestamp at point,
-of to enter the second timestamp of a range, the default time is taken from the
-existing stamp.  For example,
+of to enter the second timestamp of a range, the default time is taken
+from the existing stamp.  Furthermore, the command prefers the future,
+so if you are giving a date where the year is not given, and the day-month
+combination is already past in the current year, it will assume you
+mean next year.  For details, see the manual.  A few examples:
+
   3-2-5         --> 2003-02-05
   feb 15        --> currentyear-02-15
+  2/15          --> currentyear-02-15
   sep 12 9      --> 2009-09-12
   12:45         --> today 12:45
   22 sept 0:34  --> currentyear-09-22 0:34
@@ -12983,11 +14088,10 @@ user."
                    (setq def (apply 'encode-time defdecode)
                          defdecode (decode-time def)))))
         (calendar-frame-setup nil)
+        (calendar-setup nil)
         (calendar-move-hook nil)
         (calendar-view-diary-initially-flag nil)
-        (view-diary-entries-initially nil)
         (calendar-view-holidays-initially-flag nil)
-        (view-calendar-holidays-initially nil)
         (timestr (format-time-string
                   (if with-time "%Y-%m-%d %H:%M" "%Y-%m-%d") def))
         (prompt (concat (if prompt (concat prompt " ") "")
@@ -13008,10 +14112,8 @@ user."
                 (map (copy-keymap calendar-mode-map))
                 (minibuffer-local-map (copy-keymap minibuffer-local-map)))
            (org-defkey map (kbd "RET") 'org-calendar-select)
-           (org-defkey map (if (featurep 'xemacs) [button1] [mouse-1])
-                       'org-calendar-select-mouse)
-           (org-defkey map (if (featurep 'xemacs) [button2] [mouse-2])
-                       'org-calendar-select-mouse)
+           (org-defkey map [mouse-1] 'org-calendar-select-mouse)
+           (org-defkey map [mouse-2] 'org-calendar-select-mouse)
            (org-defkey minibuffer-local-map [(meta shift left)]
                        (lambda () (interactive)
                          (org-eval-in-calendar '(calendar-backward-month 1))))
@@ -13054,6 +14156,14 @@ user."
            (org-defkey minibuffer-local-map "<"
                        (lambda () (interactive)
                          (org-eval-in-calendar '(scroll-calendar-right 1))))
+           (org-defkey minibuffer-local-map "\C-v"
+                       (lambda () (interactive)
+                         (org-eval-in-calendar
+                          '(calendar-scroll-left-three-months 1))))
+           (org-defkey minibuffer-local-map "\M-v"
+                       (lambda () (interactive)
+                         (org-eval-in-calendar
+                          '(calendar-scroll-right-three-months 1))))
            (run-hooks 'org-read-date-minibuffer-setup-hook)
            (unwind-protect
                (progn
@@ -13068,7 +14178,7 @@ user."
              (remove-hook 'post-command-hook 'org-read-date-display)
              (use-local-map old-map)
              (when org-read-date-overlay
-               (org-delete-overlay org-read-date-overlay)
+               (delete-overlay org-read-date-overlay)
                (setq org-read-date-overlay nil)))))))
 
      (t ; Naked prompt only
@@ -13076,7 +14186,7 @@ user."
          (setq ans (read-string prompt default-input
                                 'org-read-date-history timestr))
        (when org-read-date-overlay
-         (org-delete-overlay org-read-date-overlay)
+         (delete-overlay org-read-date-overlay)
          (setq org-read-date-overlay nil)))))
 
     (setq final (org-read-date-analyze ans def defdecode))
@@ -13098,7 +14208,7 @@ user."
   "Display the current date prompt interpretation in the minibuffer."
   (when org-read-date-display-live
     (when org-read-date-overlay
-      (org-delete-overlay org-read-date-overlay))
+      (delete-overlay org-read-date-overlay))
     (let ((p (point)))
       (end-of-line 1)
       (while (not (equal (buffer-substring
@@ -13126,15 +14236,16 @@ user."
       (when org-read-date-analyze-futurep
        (setq txt (concat txt " (=>F)")))
       (setq org-read-date-overlay
-           (org-make-overlay (1- (point-at-eol)) (point-at-eol)))
+           (make-overlay (1- (point-at-eol)) (point-at-eol)))
       (org-overlay-display org-read-date-overlay txt 'secondary-selection))))
 
 (defun org-read-date-analyze (ans def defdecode)
-  "Analyse the combined answer of the date prompt."
+  "Analyze the combined answer of the date prompt."
   ;; FIXME: cleanup and comment
-  (let (delta deltan deltaw deltadef year month day
-             hour minute second wday pm h2 m2 tl wday1
-             iso-year iso-weekday iso-week iso-year iso-date futurep)
+  (let ((nowdecode (decode-time (current-time)))
+       delta deltan deltaw deltadef year month day
+       hour minute second wday pm h2 m2 tl wday1
+       iso-year iso-weekday iso-week iso-year iso-date futurep kill-year)
     (setq org-read-date-analyze-futurep nil)
     (when (string-match "\\`[ \t]*\\.[ \t]*\\'" ans)
       (setq ans "+0"))
@@ -13149,22 +14260,38 @@ user."
     ;; If yes, store the info and postpone interpreting it until the rest
     ;; of the parsing is done
     (when (string-match "\\<\\(?:\\([0-9]+\\)-\\)?[wW]\\([0-9]\\{1,2\\}\\)\\(?:-\\([0-6]\\)\\)?\\([ \t]\\|$\\)" ans)
-      (setq iso-year (if (match-end 1) (org-small-year-to-year (string-to-number (match-string 1 ans))))
-           iso-weekday (if (match-end 3) (string-to-number (match-string 3 ans)))
+      (setq iso-year (if (match-end 1)
+                        (org-small-year-to-year
+                         (string-to-number (match-string 1 ans))))
+           iso-weekday (if (match-end 3)
+                           (string-to-number (match-string 3 ans)))
            iso-week (string-to-number (match-string 2 ans)))
       (setq ans (replace-match "" t t ans)))
 
-    ;; Help matching ISO dates with single digit month ot day, like 2006-8-11.
+    ;; Help matching ISO dates with single digit month or day, like 2006-8-11.
     (when (string-match
           "^ *\\(\\([0-9]+\\)-\\)?\\([0-1]?[0-9]\\)-\\([0-3]?[0-9]\\)\\([^-0-9]\\|$\\)" ans)
       (setq year (if (match-end 2)
                     (string-to-number (match-string 2 ans))
-                  (string-to-number (format-time-string "%Y")))
+                  (progn (setq kill-year t)
+                         (string-to-number (format-time-string "%Y"))))
            month (string-to-number (match-string 3 ans))
            day (string-to-number (match-string 4 ans)))
       (if (< year 100) (setq year (+ 2000 year)))
       (setq ans (replace-match (format "%04d-%02d-%02d\\5" year month day)
                               t nil ans)))
+    ;; Help matching american dates, like 5/30 or 5/30/7
+    (when (string-match
+          "^ *\\(0?[1-9]\\|1[012]\\)/\\(0?[1-9]\\|[12][0-9]\\|3[01]\\)\\(/\\([0-9]+\\)\\)?\\([^/0-9]\\|$\\)" ans)
+      (setq year (if (match-end 4)
+                    (string-to-number (match-string 4 ans))
+                  (progn (setq kill-year t)
+                         (string-to-number (format-time-string "%Y"))))
+           month (string-to-number (match-string 1 ans))
+           day (string-to-number (match-string 2 ans)))
+      (if (< year 100) (setq year (+ 2000 year)))
+      (setq ans (replace-match (format "%04d-%02d-%02d\\5" year month day)
+                              t nil ans)))
     ;; Help matching am/pm times, because `parse-time-string' does not do that.
     ;; If there is a time with am/pm, and *no* time without it, we convert
     ;; so that matching will be successful.
@@ -13207,13 +14334,13 @@ user."
          day (or (nth 3 tl) (nth 3 defdecode))
          month (or (nth 4 tl)
                    (if (and org-read-date-prefer-future
-                            (nth 3 tl) (< (nth 3 tl) (nth 3 defdecode)))
-                       (prog1 (1+ (nth 4 defdecode)) (setq futurep t))
+                            (nth 3 tl) (< (nth 3 tl) (nth 3 nowdecode)))
+                       (prog1 (1+ (nth 4 nowdecode)) (setq futurep t))
                      (nth 4 defdecode)))
-         year (or (nth 5 tl)
+         year (or (and (not kill-year) (nth 5 tl))
                   (if (and org-read-date-prefer-future
-                           (nth 4 tl) (< (nth 4 tl) (nth 4 defdecode)))
-                      (prog1 (1+ (nth 5 defdecode)) (setq futurep t))
+                           (nth 4 tl) (< (nth 4 tl) (nth 4 nowdecode)))
+                      (prog1 (1+ (nth 5 nowdecode)) (setq futurep t))
                     (nth 5 defdecode)))
          hour (or (nth 2 tl) (nth 2 defdecode))
          minute (or (nth 1 tl) (nth 1 defdecode))
@@ -13222,14 +14349,14 @@ user."
 
     (when (and (eq org-read-date-prefer-future 'time)
               (not (nth 3 tl)) (not (nth 4 tl)) (not (nth 5 tl))
-              (equal day (nth 3 defdecode))
-              (equal month (nth 4 defdecode))
-              (equal year (nth 5 defdecode))
+              (equal day (nth 3 nowdecode))
+              (equal month (nth 4 nowdecode))
+              (equal year (nth 5 nowdecode))
               (nth 2 tl)
-              (or (< (nth 2 tl) (nth 2 defdecode))
-                  (and (= (nth 2 tl) (nth 2 defdecode))
+              (or (< (nth 2 tl) (nth 2 nowdecode))
+                  (and (= (nth 2 tl) (nth 2 nowdecode))
                        (nth 1 tl)
-                       (< (nth 1 tl) (nth 1 defdecode)))))
+                       (< (nth 1 tl) (nth 1 nowdecode)))))
       (setq day (1+ day)
            futurep t))
 
@@ -13237,6 +14364,7 @@ user."
     (cond
      (iso-week
       ;; There was an iso week
+      (require 'cal-iso)
       (setq futurep nil)
       (setq year (or iso-year year)
            day (or iso-weekday wday 1)
@@ -13316,6 +14444,23 @@ DEF-FLAG   is t when a double ++ or -- indicates shift relative to
            (list delta "d" rel))
        (list (* n (if (= dir ?-) -1 1)) what rel)))))
 
+(defun org-order-calendar-date-args (arg1 arg2 arg3)
+  "Turn a user-specified date into the internal representation.
+The internal representation needed by the calendar is (month day year).
+This is a wrapper to handle the brain-dead convention in calendar that
+user function argument order change dependent on argument order."
+  (if (boundp 'calendar-date-style)
+      (cond
+       ((eq calendar-date-style 'american)
+       (list arg1 arg2 arg3))
+       ((eq calendar-date-style 'european)
+       (list arg2 arg1 arg3))
+       ((eq calendar-date-style 'iso)
+       (list arg2 arg3 arg1)))
+    (if (org-bound-and-true-p european-calendar-style)
+       (list arg2 arg1 arg3)
+      (list arg1 arg2 arg3))))
+
 (defun org-eval-in-calendar (form &optional keepdate)
   "Eval FORM in the calendar window and return to current window.
 Also, store the cursor date in variable org-ans2."
@@ -13327,7 +14472,7 @@ Also, store the cursor date in variable org-ans2."
       (let* ((date (calendar-cursor-to-date))
             (time (encode-time 0 0 0 (nth 1 date) (nth 0 date) (nth 2 date))))
        (setq org-ans2 (format-time-string "%Y-%m-%d" time))))
-    (org-move-overlay org-date-ovl (1- (point)) (1+ (point)) (current-buffer))
+    (move-overlay org-date-ovl (1- (point)) (1+ (point)) (current-buffer))
     (select-window sw)
     (org-select-frame-set-input-focus sf)))
 
@@ -13343,7 +14488,7 @@ This is used by `org-read-date' in a temporary keymap for the calendar buffer."
 
 (defun org-insert-time-stamp (time &optional with-hm inactive pre post extra)
   "Insert a date stamp for the date given by the internal TIME.
-WITH-HM means, use the stamp format that includes the time of the day.
+WITH-HM means use the stamp format that includes the time of the day.
 INACTIVE means use square brackets instead of angular ones, so that the
 stamp will not contribute to the agenda.
 PRE and POST are optional strings to be inserted before and after the
@@ -13621,7 +14766,7 @@ days in order to avoid rounding problems."
 
 (defun org-time-string-to-absolute (s &optional daynr prefer show-all)
   "Convert a time stamp to an absolute day number.
-If there is a specifyer for a cyclic time stamp, get the closest date to
+If there is a specifier for a cyclic time stamp, get the closest date to
 DAYNR.
 PREFER and SHOW-ALL are passed through to `org-closest-date'.
 the variable date is bound by the calendar when this is called."
@@ -13734,7 +14879,7 @@ When SHOW-ALL is nil, only return the current occurrence of a time stamp."
       (if (string-match "\\(\\+[0-9]+\\)\\([dwmy]\\)" change)
          (setq dn (string-to-number (match-string 1 change))
                dw (cdr (assoc (match-string 2 change) a1)))
-       (error "Invalid change specifyer: %s" change))
+       (error "Invalid change specifier: %s" change))
       (if (eq dw 'week) (setq dw 'day dn (* 7 dn)))
       (cond
        ((eq dw 'day)
@@ -13780,7 +14925,7 @@ When SHOW-ALL is nil, only return the current occurrence of a time stamp."
         (t (if (= cday n1) n1 n2)))))))
 
 (defun org-date-to-gregorian (date)
-  "Turn any specification of DATE into a gregorian date for the calendar."
+  "Turn any specification of DATE into a Gregorian date for the calendar."
   (cond ((integerp date) (calendar-gregorian-from-absolute date))
        ((and (listp date) (= (length date) 3)) date)
        ((stringp date)
@@ -13812,7 +14957,7 @@ If the cursor is on the year, change the year.  If it is on the month or
 the day, change that.
 With prefix ARG, change by that many units."
   (interactive "p")
-  (org-timestamp-change (prefix-numeric-value arg)))
+  (org-timestamp-change (prefix-numeric-value arg) nil 'updown))
 
 (defun org-timestamp-down (&optional arg)
   "Decrease the date item at the cursor by one.
@@ -13820,7 +14965,7 @@ If the cursor is on the year, change the year.  If it is on the month or
 the day, change that.
 With prefix ARG, change by that many units."
   (interactive "p")
-  (org-timestamp-change (- (prefix-numeric-value arg))))
+  (org-timestamp-change (- (prefix-numeric-value arg)) nil 'updown))
 
 (defun org-timestamp-up-day (&optional arg)
   "Increase the date in the time stamp by one day.
@@ -13829,7 +14974,7 @@ With prefix ARG, change that many days."
   (if (and (not (org-at-timestamp-p t))
           (org-on-heading-p))
       (org-todo 'up)
-    (org-timestamp-change (prefix-numeric-value arg) 'day)))
+    (org-timestamp-change (prefix-numeric-value arg) 'day 'updown)))
 
 (defun org-timestamp-down-day (&optional arg)
   "Decrease the date in the time stamp by one day.
@@ -13838,7 +14983,7 @@ With prefix ARG, change that many days."
   (if (and (not (org-at-timestamp-p t))
           (org-on-heading-p))
       (org-todo 'down)
-    (org-timestamp-change (- (prefix-numeric-value arg)) 'day)))
+    (org-timestamp-change (- (prefix-numeric-value arg)) 'day) 'updown))
 
 (defun org-at-timestamp-p (&optional inactive-ok)
   "Determine if the cursor is in or at a timestamp."
@@ -13883,7 +15028,7 @@ With prefix ARG, change that many days."
       (message "Timestamp is now %sactive"
               (if (equal (char-after beg) ?<) "" "in")))))
 
-(defun org-timestamp-change (n &optional what)
+(defun org-timestamp-change (n &optional what updown)
   "Change the date in the time stamp at point.
 The date will be changed by N times WHAT.  WHAT can be `day', `month',
 `year', `minute', `second'.  If WHAT is not given, the cursor position
@@ -13914,8 +15059,10 @@ in the timestamp determines what will be changed."
       (if (string-match "^.\\{10\\}.*?[0-9]+:[0-9][0-9]" ts)
          (setq with-hm t))
       (setq time0 (org-parse-time-string ts))
-      (when (and (eq org-ts-what 'minute)
-                (eq current-prefix-arg nil))
+      (when (and updown
+                (eq org-ts-what 'minute)
+                (not current-prefix-arg))
+       ;; This looks like s-up and s-down.  Change by one rounding step.
        (setq n (* dm (cond ((> n 0) 1) ((< n 0) -1) (t 0))))
        (when (not (= 0 (setq rem (% (nth 1 time0) dm))))
          (setcar (cdr time0) (+ (nth 1 time0)
@@ -14012,9 +15159,7 @@ A prefix ARG can be used to force the current date."
   (let ((tsr org-ts-regexp) diff
        (calendar-move-hook nil)
        (calendar-view-holidays-initially-flag nil)
-       (view-calendar-holidays-initially nil)
-       (calendar-view-diary-initially-flag nil)
-       (view-diary-entries-initially nil))
+       (calendar-view-diary-initially-flag nil))
     (if (or (org-at-timestamp-p)
            (save-excursion
              (beginning-of-line 1)
@@ -14104,21 +15249,31 @@ changes from another.  I believe the procedure must be like this:
 ;;;; Agenda files
 
 ;;;###autoload
-(defun org-iswitchb (&optional arg)
-  "Use `org-icompleting-read' to prompt for an Org buffer to switch to.
+(defun org-switchb (&optional arg)
+  "Switch between Org buffers.
 With a prefix argument, restrict available to files.
-With two prefix arguments, restrict available buffers to agenda files."
+With two prefix arguments, restrict available buffers to agenda files.
+
+Defaults to `iswitchb' for buffer name completion.
+Set `org-completion-use-ido' to make it use ido instead."
   (interactive "P")
   (let ((blist (cond ((equal arg '(4))  (org-buffer-list 'files))
                      ((equal arg '(16)) (org-buffer-list 'agenda))
-                     (t                 (org-buffer-list)))))
+                     (t                 (org-buffer-list))))
+       (org-completion-use-iswitchb org-completion-use-iswitchb)
+       (org-completion-use-ido org-completion-use-ido))
+    (unless (or org-completion-use-ido org-completion-use-iswitchb)
+      (setq org-completion-use-iswitchb t))
     (switch-to-buffer
      (org-icompleting-read "Org buffer: "
-                              (mapcar 'list (mapcar 'buffer-name blist))
-                              nil t))))
+                          (mapcar 'list (mapcar 'buffer-name blist))
+                          nil t))))
 
+;;; Define some older names previously used for this functionality
 ;;;###autoload
-(defalias 'org-ido-switchb 'org-iswitchb)
+(defalias 'org-ido-switchb 'org-switchb)
+;;;###autoload
+(defalias 'org-iswitchb 'org-switchb)
 
 (defun org-buffer-list (&optional predicate exclude-tmp)
   "Return a list of Org buffers.
@@ -14162,7 +15317,7 @@ If EXCLUDE-TMP is non-nil, ignore temporary buffers."
   "Get the list of agenda files.
 Optional UNRESTRICTED means return the full list even if a restriction
 is currently in place.
-When ARCHIVES is t, include all archive files hat are really being
+When ARCHIVES is t, include all archive files that are really being
 used by the agenda files.  If ARCHIVE is `ifmode', do this only if
 `org-agenda-archives-mode' is t."
   (let ((files
@@ -14189,6 +15344,13 @@ used by the agenda files.  If ARCHIVE is `ifmode', do this only if
       (setq files (org-add-archive-files files)))
     files))
 
+(defun org-agenda-file-p (&optional file)
+  "Return non-nil, if FILE is an agenda file.
+If FILE is omitted, use the file associated with the current
+buffer."
+  (member (or file (buffer-file-name))
+          (org-agenda-files t)))
+
 (defun org-edit-agenda-file-list ()
   "Edit the list of agenda files.
 Depending on setup, this either uses customize to edit the variable
@@ -14215,24 +15377,41 @@ the buffer and restores the previous window configuration."
 (defun org-store-new-agenda-file-list (list)
   "Set new value for the agenda file list and save it correctly."
   (if (stringp org-agenda-files)
-      (let ((f org-agenda-files) b)
-       (while (setq b (find-buffer-visiting f)) (kill-buffer b))
-       (with-temp-file f
-         (insert (mapconcat 'identity list "\n") "\n")))
+      (let ((fe (org-read-agenda-file-list t)) b u)
+       (while (setq b (find-buffer-visiting org-agenda-files))
+         (kill-buffer b))
+       (with-temp-file org-agenda-files
+         (insert
+          (mapconcat
+           (lambda (f) ;; Keep un-expanded entries.
+             (if (setq u (assoc f fe))
+                 (cdr u)
+               f))
+           list "\n")
+          "\n")))
     (let ((org-mode-hook nil) (org-inhibit-startup t)
          (org-insert-mode-line-in-empty-file nil))
       (setq org-agenda-files list)
       (customize-save-variable 'org-agenda-files org-agenda-files))))
 
-(defun org-read-agenda-file-list ()
-  "Read the list of agenda files from a file."
+(defun org-read-agenda-file-list (&optional pair-with-expansion)
+  "Read the list of agenda files from a file.
+If PAIR-WITH-EXPANSION is t return pairs with un-expanded
+filenames, used by `org-store-new-agenda-file-list' to write back
+un-expanded file names."
   (when (file-directory-p org-agenda-files)
     (error "`org-agenda-files' cannot be a single directory"))
   (when (stringp org-agenda-files)
     (with-temp-buffer
       (insert-file-contents org-agenda-files)
-      (org-split-string (buffer-string) "[ \t\r\n]*?[\r\n][ \t\r\n]*"))))
-
+      (mapcar
+       (lambda (f)
+        (let ((e (expand-file-name (substitute-in-file-name f)
+                                   org-directory)))
+          (if pair-with-expansion
+              (cons e f)
+            e)))
+       (org-split-string (buffer-string) "[ \t\r\n]*?[\r\n][ \t\r\n]*")))))
 
 ;;;###autoload
 (defun org-cycle-agenda-files ()
@@ -14280,7 +15459,7 @@ end of the list."
 (defun org-remove-file (&optional file)
   "Remove current file from the list of files in variable `org-agenda-files'.
 These are the files which are being checked for agenda entries.
-Optional argument FILE means, use this file instead of the current."
+Optional argument FILE means use this file instead of the current."
   (interactive)
   (let* ((org-agenda-skip-unavailable-files nil)
         (file (or file buffer-file-name))
@@ -14382,6 +15561,8 @@ When a buffer is unmodified, it is just killed.  When modified, it is saved
                (add-text-properties
                 (match-beginning 0) (org-end-of-subtree t) pc)))
            (set-buffer-modified-p bmp)))))
+    (setq org-todo-keywords-for-agenda
+          (org-uniquify org-todo-keywords-for-agenda))
     (setq org-todo-keyword-alist-for-agenda
          (org-uniquify org-todo-keyword-alist-for-agenda)
          org-tag-alist-for-agenda (org-uniquify org-tag-alist-for-agenda))))
@@ -14477,6 +15658,11 @@ looks only before point, not after."
        (goto-char pos)
        (if dd-on (cons "$$" m))))))
 
+(defun org-inside-latex-macro-p ()
+  "Is point inside a LaTeX macro or its arguments?"
+  (save-match-data
+    (org-in-regexp
+     "\\\\[a-zA-Z]+\\*?\\(\\(\\[[^][\n{}]*\\]\\)\\|\\({[^{}\n]*}\\)\\)*")))
 
 (defun org-try-cdlatex-tab ()
   "Check if it makes sense to execute `cdlatex-tab', and do it if yes.
@@ -14519,7 +15705,7 @@ Revert to the normal definition outside of these fragments."
 
 (defun org-remove-latex-fragment-image-overlays ()
   "Remove all overlays with LaTeX fragment images in current buffer."
-  (mapc 'org-delete-overlay org-latex-fragment-image-overlays)
+  (mapc 'delete-overlay org-latex-fragment-image-overlays)
   (setq org-latex-fragment-image-overlays nil))
 
 (defun org-preview-latex-fragment (&optional subtree)
@@ -14528,7 +15714,8 @@ If the cursor is in a LaTeX fragment, create the image and overlay
 it over the source code.  If there is no fragment at point, display
 all fragments in the current text, from one headline to the next.  With
 prefix SUBTREE, display all fragments in the current subtree.  With a
-double prefix `C-u C-u', or when the cursor is before the first headline,
+double prefix arg \\[universal-argument] \\[universal-argument], or when \
+the cursor is before the first headline,
 display all fragments in the buffer.
 The images can be removed again with \\[org-ctrl-c-ctrl-c]."
   (interactive "P")
@@ -14574,7 +15761,8 @@ The images can be removed again with \\[org-ctrl-c-ctrl-c]."
     ("$$" "\\$\\$[^\000]*?\\$\\$" 0 nil))
   "Regular expressions for matching embedded LaTeX.")
 
-(defun org-format-latex (prefix &optional dir overlays msg at forbuffer)
+(defun org-format-latex (prefix &optional dir overlays msg at
+                               forbuffer protect-only)
   "Replace LaTeX fragments with links to an image, and produce images.
 Some of the options can be changed using the variable
 `org-format-latex-options'."
@@ -14585,6 +15773,8 @@ Some of the options can be changed using the variable
         (opt org-format-latex-options)
         (matchers (plist-get opt :matchers))
         (re-list org-latex-regexps)
+        (org-format-latex-header-extra
+         (plist-get (org-infile-export-plist) :latex-header-extra))
         (cnt 0) txt hash link beg end re e checkdir
         executables-checked
         m n block linkfile movefile ov)
@@ -14602,56 +15792,63 @@ Some of the options can be changed using the variable
                         (not (eq (get-char-property (match-beginning n)
                                                     'org-overlay-type)
                                  'org-latex-overlay))))
-           (setq txt (match-string n)
-                 beg (match-beginning n) end (match-end n)
-                 cnt (1+ cnt)
-                 link (concat block "[[file:" linkfile "]]" block))
-           (let (print-length print-level) ; make sure full list is printed
-             (setq hash (sha1 (prin1-to-string
-                               (list org-format-latex-header
-                                     org-export-latex-packages-alist
-                                     org-format-latex-options
-                                     forbuffer txt)))
-                   linkfile (format "%s_%s.png" prefix hash)
-                   movefile (format "%s_%s.png" absprefix hash)))
-           (if msg (message msg cnt))
-           (goto-char beg)
-           (unless checkdir ; make sure the directory exists
-             (setq checkdir t)
-             (or (file-directory-p todir) (make-directory todir)))
-
-           (unless executables-checked
-             (org-check-external-command
-              "latex" "needed to convert LaTeX fragments to images")
-             (org-check-external-command
-              "dvipng" "needed to convert LaTeX fragments to images")
-             (setq executables-checked t))
-
-            (unless (file-exists-p movefile)
-              (org-create-formula-image
-               txt movefile opt forbuffer))
-           (if overlays
-               (progn
-                 (mapc (lambda (o)
-                         (if (eq (org-overlay-get o 'org-overlay-type)
-                                 'org-latex-overlay)
-                             (org-delete-overlay o)))
-                       (org-overlays-in beg end))
-                 (setq ov (org-make-overlay beg end))
-                 (org-overlay-put ov 'org-overlay-type 'org-latex-overlay)
-                 (if (featurep 'xemacs)
-                     (progn
-                       (org-overlay-put ov 'invisible t)
-                       (org-overlay-put
-                        ov 'end-glyph
-                        (make-glyph (vector 'png :file movefile))))
-                   (org-overlay-put
-                    ov 'display
-                    (list 'image :type 'png :file movefile :ascent 'center)))
-                 (push ov org-latex-fragment-image-overlays)
-                 (goto-char end))
-             (delete-region beg end)
-             (insert link))))))))
+           (if protect-only
+               (add-text-properties (match-beginning n) (match-end n)
+                                    '(org-protected t))
+             (setq txt (match-string n)
+                   beg (match-beginning n) end (match-end n)
+                   cnt (1+ cnt))
+             (let (print-length print-level) ; make sure full list is printed
+               (setq hash (sha1 (prin1-to-string
+                                 (list org-format-latex-header
+                                       org-format-latex-header-extra
+                                       org-export-latex-default-packages-alist
+                                       org-export-latex-packages-alist
+                                       org-format-latex-options
+                                       forbuffer txt)))
+                     linkfile (format "%s_%s.png" prefix hash)
+                     movefile (format "%s_%s.png" absprefix hash)))
+             (setq link (concat block "[[file:" linkfile "]]" block))
+             (if msg (message msg cnt))
+             (goto-char beg)
+             (unless checkdir ; make sure the directory exists
+               (setq checkdir t)
+               (or (file-directory-p todir) (make-directory todir)))
+             
+             (unless executables-checked
+               (org-check-external-command
+                "latex" "needed to convert LaTeX fragments to images")
+               (org-check-external-command
+                "dvipng" "needed to convert LaTeX fragments to images")
+               (setq executables-checked t))
+             
+             (unless (file-exists-p movefile)
+               (org-create-formula-image
+                txt movefile opt forbuffer))
+             (if overlays
+                 (progn
+                   (mapc (lambda (o)
+                           (if (eq (overlay-get o 'org-overlay-type)
+                                   'org-latex-overlay)
+                               (delete-overlay o)))
+                         (overlays-in beg end))
+                   (setq ov (make-overlay beg end))
+                   (overlay-put ov 'org-overlay-type 'org-latex-overlay)
+                   (if (featurep 'xemacs)
+                       (progn
+                         (overlay-put ov 'invisible t)
+                         (overlay-put
+                          ov 'end-glyph
+                          (make-glyph (vector 'png :file movefile))))
+                     (overlay-put
+                      ov 'display
+                      (list 'image :type 'png :file movefile :ascent 'center)))
+                   (push ov org-latex-fragment-image-overlays)
+                   (goto-char end))
+               (delete-region beg end)
+               (insert (org-add-props link
+                           (list 'org-latex-src
+                                 (replace-regexp-in-string "\"" "" txt))))))))))))
 
 ;; This function borrows from Ganesh Swami's latex2png.el
 (defun org-create-formula-image (string tofile options buffer)
@@ -14677,17 +15874,14 @@ Some of the options can be changed using the variable
     (if (eq fg 'default) (setq fg (org-dvipng-color :foreground)))
     (if (eq bg 'default) (setq bg (org-dvipng-color :background)))
     (with-temp-file texfile
-      (insert org-format-latex-header
-             (if org-export-latex-packages-alist
-                 (concat "\n"
-                         (mapconcat (lambda(p)
-                                      (if (equal "" (car p))
-                                          (format "\\usepackage{%s}" (cadr p))
-                                        (format "\\usepackage[%s]{%s}"
-                                                (car p) (cadr p))))
-                                    org-export-latex-packages-alist "\n"))
-               "")
-             "\n\\begin{document}\n" string "\n\\end{document}\n"))
+      (insert (org-splice-latex-header
+              org-format-latex-header
+              org-export-latex-default-packages-alist
+              org-export-latex-packages-alist t
+              org-format-latex-header-extra))
+      (insert "\n\\begin{document}\n" string "\n\\end{document}\n")
+      (require 'org-latex)
+      (org-export-latex-fix-inputenc))
     (let ((dir default-directory))
       (condition-case nil
          (progn
@@ -14707,13 +15901,75 @@ Some of the options can be changed using the variable
                        dvifile)
        (error nil))
       (if (not (file-exists-p pngfile))
-         (progn (message "Failed to create png file from %s" texfile) nil)
+         (if org-format-latex-signal-error
+             (error "Failed to create png file from %s" texfile)
+           (message "Failed to create png file from %s" texfile)
+           nil)
        ;; Use the requested file name and clean up
        (copy-file pngfile tofile 'replace)
        (loop for e in '(".dvi" ".tex" ".aux" ".log" ".png") do
              (delete-file (concat texfilebase e)))
        pngfile))))
 
+(defun org-splice-latex-header (tpl def-pkg pkg snippets-p &optional extra)
+  "Fill a LaTeX header template TPL.
+In the template, the following place holders will be recognized:
+
+ [DEFAULT-PACKAGES]      \\usepackage statements for DEF-PKG
+ [NO-DEFAULT-PACKAGES]   do not include DEF-PKG
+ [PACKAGES]              \\usepackage statements for PKG
+ [NO-PACKAGES]           do not include PKG
+ [EXTRA]                 the string EXTRA
+ [NO-EXTRA]              do not include EXTRA
+
+For backward compatibility, if both the positive and the negative place
+holder is missing, the positive one (without the \"NO-\") will be
+assumed to be present at the end of the template.
+DEF-PKG and PKG are assumed to be alists of options/packagename lists.
+EXTRA is a string.
+SNIPPETS-P indicates if this is run to create snippet images for HTML."
+  (let (rpl (end ""))
+    (if (string-match "^[ \t]*\\[\\(NO-\\)?DEFAULT-PACKAGES\\][ \t]*\n?" tpl)
+       (setq rpl (if (or (match-end 1) (not def-pkg))
+                     "" (org-latex-packages-to-string def-pkg snippets-p t))
+             tpl (replace-match rpl t t tpl))
+      (if def-pkg (setq end (org-latex-packages-to-string def-pkg snippets-p))))
+
+    (if (string-match "\\[\\(NO-\\)?PACKAGES\\][ \t]*\n?" tpl)
+       (setq rpl (if (or (match-end 1) (not pkg))
+                     "" (org-latex-packages-to-string pkg snippets-p t))
+             tpl (replace-match rpl t t tpl))
+      (if pkg (setq end
+                   (concat end "\n"
+                           (org-latex-packages-to-string pkg snippets-p)))))
+
+    (if (string-match "\\[\\(NO-\\)?EXTRA\\][ \t]*\n?" tpl)
+       (setq rpl (if (or (match-end 1) (not extra))
+                     "" (concat extra "\n"))
+             tpl (replace-match rpl t t tpl))
+      (if (and extra (string-match "\\S-" extra))
+         (setq end (concat end "\n" extra))))
+
+    (if (string-match "\\S-" end)
+       (concat tpl "\n" end)
+      tpl)))
+
+(defun org-latex-packages-to-string (pkg &optional snippets-p newline)
+  "Turn an alist of packages into a string with the \\usepackage macros."
+  (setq pkg (mapconcat (lambda(p)
+                        (cond
+                         ((stringp p) p)
+                         ((and snippets-p (>= (length p) 3) (not (nth 2 p)))
+                          (format "%% Package %s omitted" (cadr p)))
+                         ((equal "" (car p))
+                          (format "\\usepackage{%s}" (cadr p)))
+                         (t
+                          (format "\\usepackage[%s]{%s}"
+                                  (car p) (cadr p)))))
+                      pkg
+                      "\n"))
+  (if newline (concat pkg "\n") pkg))
+
 (defun org-dvipng-color (attr)
   "Return an rgb color specification for dvipng."
   (apply 'format "rgb %s %s %s"
@@ -14724,6 +15980,80 @@ Some of the options can be changed using the variable
   "Return string to be used as color value for an RGB component."
   (format "%g" (/ value 65535.0)))
 
+;; Image display
+
+
+(defvar org-inline-image-overlays nil)
+(make-variable-buffer-local 'org-inline-image-overlays)
+
+(defun org-toggle-inline-images (&optional include-linked)
+  "Toggle the display of inline images.
+INCLUDE-LINKED is passed to `org-display-inline-images'."
+  (interactive "P")
+  (if org-inline-image-overlays
+      (progn
+       (org-remove-inline-images)
+       (message "Inline image display turned off"))
+    (org-display-inline-images include-linked)
+    (if org-inline-image-overlays
+       (message "%d images displayed inline"
+                (length org-inline-image-overlays))
+      (message "No images to display inline"))))
+
+(defun org-display-inline-images (&optional include-linked refresh beg end)
+  "Display inline images.
+Normally only links without a description part are inlined, because this
+is how it will work for export.  When INCLUDE-LINKED is set, also links
+with a description part will be inlined.  This can be nice for a quick
+look at those images, but it does not reflect what exported files will look
+like.
+When REFRESH is set, refresh existing images between BEG and END.
+This will create new image displays only if necessary.
+BEG and END default to the buffer boundaries."
+  (interactive "P")
+  (unless refresh
+    (org-remove-inline-images)
+    (clear-image-cache))
+  (save-excursion
+    (save-restriction
+      (widen)
+      (setq beg (or beg (point-min)) end (or end (point-max)))
+      (goto-char (point-min))
+      (let ((re (concat "\\[\\[\\(\\(file:\\)\\|\\([./~]\\)\\)\\([-+~.:/\\_0-9a-zA-Z ]+"
+                       (substring (org-image-file-name-regexp) 0 -2)
+                       "\\)\\]" (if include-linked "" "\\]")))
+           old file ov img)
+       (while (re-search-forward re end t)
+         (setq old (get-char-property-and-overlay (match-beginning 1)
+                                                  'org-image-overlay))
+         (setq file (expand-file-name
+                     (concat (or (match-string 3) "") (match-string 4))))
+         (when (file-exists-p file)
+           (if (and (car-safe old) refresh)
+               (image-refresh (overlay-get (cdr old) 'display))
+             (setq img (create-image file))
+             (when img
+               (setq ov (make-overlay (match-beginning 0) (match-end 0)))
+               (overlay-put ov 'display img)
+               (overlay-put ov 'face 'default)
+               (overlay-put ov 'org-image-overlay t)
+               (overlay-put ov 'modification-hooks
+                            (list 'org-display-inline-modification-hook))
+               (push ov org-inline-image-overlays)))))))))
+
+(defun org-display-inline-modification-hook (ov after beg end &optional len)
+  "Remove inline-display overlay if a corresponding region is modified."
+  (let ((inhibit-modification-hooks t))
+    (when (and ov after)
+      (delete ov org-inline-image-overlays)
+      (delete-overlay ov))))
+
+(defun org-remove-inline-images ()
+  "Remove inline display of images."
+  (interactive)
+  (mapc 'delete-overlay org-inline-image-overlays)
+  (setq org-inline-image-overlays nil))
+
 ;;;; Key bindings
 
 ;; Make `C-c C-x' a prefix key
@@ -14765,6 +16095,12 @@ Some of the options can be changed using the variable
 (org-defkey org-mode-map [(control shift right)] 'org-shiftcontrolright)
 (org-defkey org-mode-map [(control shift left)]  'org-shiftcontrolleft)
 
+;; Babel keys
+(define-key org-mode-map org-babel-key-prefix org-babel-map)
+(mapc (lambda (pair)
+        (define-key org-babel-map (car pair) (cdr pair)))
+      org-babel-key-bindings)
+
 ;;; Extra keys for tty access.
 ;;  We only set them when really needed because otherwise the
 ;;  menus don't show the simple keys
@@ -14822,7 +16158,6 @@ Some of the options can be changed using the variable
 (org-defkey org-mode-map "\C-c\C-s" 'org-schedule)
 (org-defkey org-mode-map "\C-c\C-d" 'org-deadline)
 (org-defkey org-mode-map "\C-c;"    'org-toggle-comment)
-(org-defkey org-mode-map "\C-c\C-v" 'org-show-todo-tree)
 (org-defkey org-mode-map "\C-c\C-w" 'org-refile)
 (org-defkey org-mode-map "\C-c/"    'org-sparse-tree)   ; Minor-mode reserved
 (org-defkey org-mode-map "\C-c\\"   'org-match-sparse-tree) ; Minor-mode res.
@@ -14893,6 +16228,8 @@ Some of the options can be changed using the variable
 (org-defkey org-mode-map "\C-c\C-x\C-r" 'org-clock-report)
 (org-defkey org-mode-map "\C-c\C-x\C-u" 'org-dblock-update)
 (org-defkey org-mode-map "\C-c\C-x\C-l" 'org-preview-latex-fragment)
+(org-defkey org-mode-map "\C-c\C-x\C-v" 'org-toggle-inline-images)
+(org-defkey org-mode-map "\C-c\C-x\\"   'org-toggle-pretty-entities)
 (org-defkey org-mode-map "\C-c\C-x\C-b" 'org-toggle-checkbox)
 (org-defkey org-mode-map "\C-c\C-xp"    'org-set-property)
 (org-defkey org-mode-map "\C-c\C-xe"    'org-set-effort)
@@ -15178,8 +16515,9 @@ See `org-ctrl-c-ctrl-c-hook' for more information.
 This hook runs as the first action when TAB is pressed, even before
 `org-cycle' messes around with the `outline-regexp' to cater for
 inline tasks and plain list item folding.
-If any function in this hook returns t, not other actions like table
-field motion visibility cycling will be done.")
+If any function in this hook returns t, any other actions that
+would have been caused by TAB (such as table field motion or visibility
+cycling) will not occur.")
 
 (defvar org-tab-after-check-for-table-hook nil
   "Hook for functions to attach themselves to TAB.
@@ -15230,6 +16568,34 @@ See `org-ctrl-c-ctrl-c-hook' for more information.")
 (defvar org-metareturn-hook nil
   "Hook for functions attaching themselves to `M-RET'.
 See `org-ctrl-c-ctrl-c-hook' for more information.")
+(defvar org-shiftup-hook nil
+  "Hook for functions attaching themselves to `S-up'.
+See `org-ctrl-c-ctrl-c-hook' for more information.")
+(defvar org-shiftup-final-hook nil
+  "Hook for functions attaching themselves to `S-up'.
+This one runs after all other options except shift-select have been excluded.
+See `org-ctrl-c-ctrl-c-hook' for more information.")
+(defvar org-shiftdown-hook nil
+  "Hook for functions attaching themselves to `S-down'.
+See `org-ctrl-c-ctrl-c-hook' for more information.")
+(defvar org-shiftdown-final-hook nil
+  "Hook for functions attaching themselves to `S-down'.
+This one runs after all other options except shift-select have been excluded.
+See `org-ctrl-c-ctrl-c-hook' for more information.")
+(defvar org-shiftleft-hook nil
+  "Hook for functions attaching themselves to `S-left'.
+See `org-ctrl-c-ctrl-c-hook' for more information.")
+(defvar org-shiftleft-final-hook nil
+  "Hook for functions attaching themselves to `S-left'.
+This one runs after all other options except shift-select have been excluded.
+See `org-ctrl-c-ctrl-c-hook' for more information.")
+(defvar org-shiftright-hook nil
+  "Hook for functions attaching themselves to `S-right'.
+See `org-ctrl-c-ctrl-c-hook' for more information.")
+(defvar org-shiftright-final-hook nil
+  "Hook for functions attaching themselves to `S-right'.
+This one runs after all other options except shift-select have been excluded.
+See `org-ctrl-c-ctrl-c-hook' for more information.")
 
 (defun org-modifier-cursor-error ()
   "Throw an error, a modified cursor command was applied in wrong context."
@@ -15270,7 +16636,7 @@ See the individual commands for more information."
    ((run-hook-with-args-until-success 'org-shiftmetaleft-hook))
    ((org-at-table-p) (call-interactively 'org-table-delete-column))
    ((org-on-heading-p) (call-interactively 'org-promote-subtree))
-   ((org-at-item-p) (call-interactively 'org-outdent-item))
+   ((org-at-item-p) (call-interactively 'org-outdent-item-tree))
    (t (org-modifier-cursor-error))))
 
 (defun org-shiftmetaright ()
@@ -15283,7 +16649,7 @@ See the individual commands for more information."
    ((run-hook-with-args-until-success 'org-shiftmetaright-hook))
    ((org-at-table-p) (call-interactively 'org-table-insert-column))
    ((org-on-heading-p) (call-interactively 'org-demote-subtree))
-   ((org-at-item-p) (call-interactively 'org-indent-item))
+   ((org-at-item-p) (call-interactively 'org-indent-item-tree))
    (t (org-modifier-cursor-error))))
 
 (defun org-shiftmetaup (&optional arg)
@@ -15312,6 +16678,10 @@ commands for more information."
    ((org-at-item-p) (call-interactively 'org-move-item-down))
    (t (org-modifier-cursor-error))))
 
+(defsubst org-hidden-tree-error ()
+  (error
+   "Hidden subtree, open with TAB or use subtree command M-S-<left>/<right>"))
+
 (defun org-metaleft (&optional arg)
   "Promote heading or move table column to left.
 Calls `org-do-promote' or `org-table-move-column', depending on context.
@@ -15326,12 +16696,14 @@ See the individual commands for more information."
             (save-excursion
               (goto-char (region-beginning))
               (org-on-heading-p))))
+    (when (org-check-for-hidden 'headlines) (org-hidden-tree-error))
     (call-interactively 'org-do-promote))
    ((or (org-at-item-p)
        (and (org-region-active-p)
             (save-excursion
               (goto-char (region-beginning))
               (org-at-item-p))))
+    (when (org-check-for-hidden 'items) (org-hidden-tree-error))
     (call-interactively 'org-outdent-item))
    (t (call-interactively 'backward-word))))
 
@@ -15349,15 +16721,44 @@ See the individual commands for more information."
             (save-excursion
               (goto-char (region-beginning))
               (org-on-heading-p))))
+    (when (org-check-for-hidden 'headlines) (org-hidden-tree-error))
     (call-interactively 'org-do-demote))
    ((or (org-at-item-p)
        (and (org-region-active-p)
             (save-excursion
               (goto-char (region-beginning))
               (org-at-item-p))))
+    (when (org-check-for-hidden 'items) (org-hidden-tree-error))
     (call-interactively 'org-indent-item))
    (t (call-interactively 'forward-word))))
 
+(defun org-check-for-hidden (what)
+  "Check if there are hidden headlines/items in the current visual line.
+WHAT can be either `headlines' or `items'.  If the current line is
+an outline or item heading and it has a folded subtree below it,
+this function returns t, nil otherwise."
+  (let ((re (cond
+            ((eq what 'headlines) (concat "^" org-outline-regexp))
+            ((eq what 'items) (concat "^" (org-item-re t)))
+            (t (error "This should not happen"))))
+       beg end)
+    (save-excursion
+      (catch 'exit
+       (unless (org-region-active-p)
+         (setq beg (point-at-bol))
+         (beginning-of-line 2)
+         (while (and (not (eobp)) ;; this is like `next-line'
+                     (get-char-property (1- (point)) 'invisible))
+           (beginning-of-line 2))
+         (setq end (point))
+         (goto-char beg)
+         (goto-char (point-at-eol))
+         (setq end (max end (point)))
+         (while (re-search-forward re end t)
+           (if (get-char-property (match-beginning 0) 'invisible)
+               (throw 'exit t))))
+       nil))))
+
 (defun org-metaup (&optional arg)
   "Move subtree up or move table row up.
 Calls `org-move-subtree-up' or `org-table-move-row' or
@@ -15390,6 +16791,7 @@ Calls `org-timestamp-up' or `org-priority-up', or `org-previous-item',
 depending on context.  See the individual commands for more information."
   (interactive "P")
   (cond
+   ((run-hook-with-args-until-success 'org-shiftup-hook))
    ((and org-support-shift-select (org-region-active-p))
     (org-call-for-shift-select 'previous-line))
    ((org-at-timestamp-p t)
@@ -15402,6 +16804,7 @@ depending on context.  See the individual commands for more information."
    ((and (not org-support-shift-select) (org-at-item-p))
     (call-interactively 'org-previous-item))
    ((org-clocktable-try-shift 'up arg))
+   ((run-hook-with-args-until-success 'org-shiftup-final-hook))
    (org-support-shift-select
     (org-call-for-shift-select 'previous-line))
    (t (org-shiftselect-error))))
@@ -15412,6 +16815,7 @@ Calls `org-timestamp-down' or `org-priority-down', or `org-next-item'
 depending on context.  See the individual commands for more information."
   (interactive "P")
   (cond
+   ((run-hook-with-args-until-success 'org-shiftdown-hook))
    ((and org-support-shift-select (org-region-active-p))
     (org-call-for-shift-select 'next-line))
    ((org-at-timestamp-p t)
@@ -15424,6 +16828,7 @@ depending on context.  See the individual commands for more information."
    ((and (not org-support-shift-select) (org-at-item-p))
     (call-interactively 'org-next-item))
    ((org-clocktable-try-shift 'down arg))
+   ((run-hook-with-args-until-success 'org-shiftdown-final-hook))
    (org-support-shift-select
     (org-call-for-shift-select 'next-line))
    (t (org-shiftselect-error))))
@@ -15439,6 +16844,7 @@ Depending on context, this does one of the following:
 - on a clocktable definition line, move time block into the future"
   (interactive "P")
   (cond
+   ((run-hook-with-args-until-success 'org-shiftright-hook))
    ((and org-support-shift-select (org-region-active-p))
     (org-call-for-shift-select 'forward-char))
    ((org-at-timestamp-p t) (call-interactively 'org-timestamp-up-day))
@@ -15458,6 +16864,7 @@ Depending on context, this does one of the following:
         (org-at-property-p))
     (call-interactively 'org-property-next-allowed-value))
    ((org-clocktable-try-shift 'right arg))
+   ((run-hook-with-args-until-success 'org-shiftright-final-hook))
    (org-support-shift-select
     (org-call-for-shift-select 'forward-char))
    (t (org-shiftselect-error))))
@@ -15473,6 +16880,7 @@ Depending on context, this does one of the following:
 - on a clocktable definition line, move time block into the past"
   (interactive "P")
   (cond
+   ((run-hook-with-args-until-success 'org-shiftleft-hook))
    ((and org-support-shift-select (org-region-active-p))
     (org-call-for-shift-select 'backward-char))
    ((org-at-timestamp-p t) (call-interactively 'org-timestamp-down-day))
@@ -15492,6 +16900,7 @@ Depending on context, this does one of the following:
         (org-at-property-p))
     (call-interactively 'org-property-previous-allowed-value))
    ((org-clocktable-try-shift 'left arg))
+   ((run-hook-with-args-until-success 'org-shiftleft-final-hook))
    (org-support-shift-select
     (org-call-for-shift-select 'backward-char))
    (t (org-shiftselect-error))))
@@ -15554,22 +16963,33 @@ See the individual commands for more information."
       (org-table-paste-rectangle)
     (org-paste-subtree arg)))
 
-(defun org-edit-special ()
+(defun org-edit-special (&optional arg)
   "Call a special editor for the stuff at point.
 When at a table, call the formula editor with `org-table-edit-formulas'.
 When at the first line of an src example, call `org-edit-src-code'.
 When in an #+include line, visit the include file.  Otherwise call
 `ffap' to visit the file at point."
   (interactive)
-  (cond
-   ((org-at-table-p)
-    (call-interactively 'org-table-edit-formulas))
+  ;; possibly prep session before editing source
+  (when arg
+    (let* ((info (org-babel-get-src-block-info))
+           (lang (nth 0 info))
+           (params (nth 2 info))
+           (session (cdr (assoc :session params))))
+      (when (and info session) ;; we are in a source-code block with a session
+        (funcall
+         (intern (concat "org-babel-prep-session:" lang)) session params))))
+  (cond ;; proceed with `org-edit-special'
    ((save-excursion
       (beginning-of-line 1)
       (looking-at "\\(?:#\\+\\(?:setupfile\\|include\\):?[ \t]+\"?\\|[ \t]*<include\\>.*?file=\"\\)\\([^\"\n>]+\\)"))
     (find-file (org-trim (match-string 1))))
    ((org-edit-src-code))
    ((org-edit-fixed-width-region))
+   ((org-at-table.el-p)
+    (org-edit-src-code))
+   ((org-at-table-p)
+    (call-interactively 'org-table-edit-formulas))
    (t (call-interactively 'ffap))))
 
 
@@ -15602,9 +17022,6 @@ This command does many different things, depending on context:
 
 - If the cursor is a the beginning of a dynamic block, update it.
 
-- If the cursor is inside a table created by the table.el package,
-  activate that table.
-
 - If the current buffer is a remember buffer, close note and file
   it.  A prefix argument of 1 files to the default location
   without further interaction.  A prefix argument of 2 files to
@@ -15616,7 +17033,13 @@ This command does many different things, depending on context:
 - If the cursor is on a numbered item in a plain list, renumber the
   ordered list.
 
-- If the cursor is on a checkbox, toggle it."
+- If the cursor is on a checkbox, toggle it.
+
+- If the cursor is on a code block, evaluate it.  The variable
+  `org-confirm-babel-evaluate' can be used to control prompting
+  before code block evaluation, by default every code block
+  evaluation requires confirmation.  Code block evaluation can be
+  inhibited by setting `org-babel-no-eval-on-ctrl-c-ctrl-c'."
   (interactive "P")
   (let  ((org-enable-table-editor t))
     (cond
@@ -15631,7 +17054,8 @@ This command does many different things, depending on context:
           (fboundp org-finish-function))
       (funcall org-finish-function))
      ((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-hook))
-     ((org-at-property-p)
+     ((or (looking-at org-property-start-re)
+         (org-at-property-p))
       (call-interactively 'org-property-action))
      ((org-on-target-p) (call-interactively 'org-update-radio-target-regexp))
      ((and (org-in-regexp "\\[\\([0-9]*%\\|[0-9]*/[0-9]*\\)\\]")
@@ -15639,10 +17063,7 @@ This command does many different things, depending on context:
       (call-interactively 'org-update-statistics-cookies))
      ((org-on-heading-p) (call-interactively 'org-set-tags))
      ((org-at-table.el-p)
-      (require 'table)
-      (beginning-of-line 1)
-      (re-search-forward "|" (save-excursion (end-of-line 2) (point)))
-      (call-interactively 'table-recognize-table))
+      (message "Use C-c ' to edit table.el tables"))
      ((org-at-table-p)
       (org-table-maybe-eval-formula)
       (if arg
@@ -15653,11 +17074,13 @@ This command does many different things, depending on context:
          (org-footnote-at-definition-p))
       (call-interactively 'org-footnote-action))
      ((org-at-item-checkbox-p)
-      (call-interactively 'org-toggle-checkbox))
+      (call-interactively 'org-toggle-checkbox)
+      (org-list-send-list 'maybe))
      ((org-at-item-p)
       (if arg
          (call-interactively 'org-toggle-checkbox)
-       (call-interactively 'org-maybe-renumber-ordered-list)))
+       (call-interactively 'org-maybe-renumber-ordered-list))
+      (org-list-send-list 'maybe))
      ((save-excursion (beginning-of-line 1) (looking-at org-dblock-start-re))
       ;; Dynamic block
       (beginning-of-line 1)
@@ -15674,9 +17097,9 @@ This command does many different things, depending on context:
          (if (org-at-table-p)
              (org-call-with-arg 'org-table-recalculate (or arg t)))))
        (t
-;      (org-set-regexps-and-options)
-;      (org-restart-font-lock)
-       (let ((org-inhibit-startup t)) (org-mode-restart))
+       (let ((org-inhibit-startup-visibility-stuff t)
+             (org-startup-align-all-tables nil))
+         (org-save-outline-visibility 'use-markers (org-mode-restart)))
        (message "Local setup has been refreshed"))))
      ((org-clock-update-time-maybe))
      (t (error "C-c C-c can do nothing useful at this location")))))
@@ -15692,7 +17115,9 @@ Also updates the keyword regular expressions."
   "If this is a Note buffer, abort storing the note.  Else call `show-branches'."
   (interactive)
   (if (not org-finish-function)
-      (call-interactively 'show-branches)
+      (progn
+       (hide-subtree)
+       (call-interactively 'show-branches))
     (let ((org-note-abort t))
       (funcall org-finish-function))))
 
@@ -15987,7 +17412,7 @@ See the individual commands for more information."
      ["Previous link" org-previous-link t]
      "--"
      ["Descriptive Links"
-      (progn (org-add-to-invisibility-spec '(org-link)) (org-restart-font-lock))
+      (progn (add-to-invisibility-spec '(org-link)) (org-restart-font-lock))
       :style radio
       :selected (member '(org-link) buffer-invisibility-spec)]
      ["Literal Links"
@@ -16004,8 +17429,8 @@ See the individual commands for more information."
       ["Complete Keyword" org-complete (assq :todo-keyword (org-context))]
       ["Next keyword set" org-shiftcontrolright (and (> (length org-todo-sets) 1) (org-on-heading-p))]
       ["Previous keyword set" org-shiftcontrolright (and (> (length org-todo-sets) 1) (org-on-heading-p))])
-     ["Show TODO Tree" org-show-todo-tree t]
-     ["Global TODO list" org-todo-list t]
+     ["Show TODO Tree" org-show-todo-tree :active t :keys "C-c / t"]
+     ["Global TODO list" org-todo-list :active t :keys "C-c a t"]
      "--"
      ["Enforce dependencies" (customize-variable 'org-enforce-todo-dependencies)
       :selected org-enforce-todo-dependencies :style toggle :active t]
@@ -16099,7 +17524,9 @@ See the individual commands for more information."
                (not org-export-with-LaTeX-fragments))
        (require 'org-exp))
       :style toggle :selected (and (boundp 'org-export-with-LaTeX-fragments)
-                                  org-export-with-LaTeX-fragments)])
+                                  org-export-with-LaTeX-fragments)]
+     "--"
+     ["Template for BEAMER" org-insert-beamer-options-template t])
     "--"
     ("MobileOrg"
      ["Push Files and Views" org-mobile-push t]
@@ -16232,8 +17659,18 @@ With prefix arg UNCOMPILED, load the uncompiled versions."
         (dir-org-contrib (ignore-errors
                           (file-name-directory
                            (org-find-library-name "org-contribdir"))))
+        (babel-files
+         (mapcar (lambda (el) (concat "ob" (when el (format "-%s" el)) ".el"))
+                 (append (list nil "comint" "eval" "exp" "keys"
+                                   "lob" "ref" "table" "tangle")
+                         (delq nil
+                               (mapcar
+                                (lambda (lang)
+                                  (when (cdr lang) (symbol-name (car lang))))
+                                org-babel-load-languages)))))
         (files
          (append (directory-files dir-org t file-re)
+                 babel-files
                  (and dir-org-contrib
                       (directory-files dir-org-contrib t file-re))))
         (remove-re (concat (if (featurep 'xemacs)
@@ -16300,9 +17737,7 @@ With prefix arg UNCOMPILED, load the uncompiled versions."
   "Display the given MESSAGE as a warning."
   (if (fboundp 'display-warning)
       (display-warning 'org message
-                       (if (featurep 'xemacs)
-                           'warning
-                         :warning))
+                       (if (featurep 'xemacs) 'warning :warning))
     (let ((buf (get-buffer-create "*Org warnings*")))
       (with-current-buffer buf
         (goto-char (point-max))
@@ -16316,6 +17751,13 @@ With prefix arg UNCOMPILED, load the uncompiled versions."
   "Is point in a line starting with `#'?"
   (equal (char-after (point-at-bol)) ?#))
 
+(defun org-in-indented-comment-line ()
+  "Is point in a line starting with `#' after some white space?"
+  (save-excursion
+    (save-match-data
+      (goto-char (point-at-bol))
+      (looking-at "[ \t]*#"))))
+
 (defun org-in-verbatim-emphasis ()
   (save-match-data
     (and (org-in-regexp org-emph-re 2) (member (match-string 3) '("=" "~")))))
@@ -16440,7 +17882,8 @@ N may optionally be the number of spaces to remove."
 
 (defun org-fill-template (template alist)
   "Find each %key of ALIST in TEMPLATE and replace it."
-  (let (entry key value)
+  (let ((case-fold-search nil)
+       entry key value)
     (setq alist (sort (copy-sequence alist)
                      (lambda (a b) (< (length (car a)) (length (car b))))))
     (while (setq entry (pop alist))
@@ -16622,11 +18065,11 @@ and :keyword."
                         (mapcar
                          (lambda (x)
                            (if (memq x org-latex-fragment-image-overlays) x))
-                         (org-overlays-at (point))))))
+                         (overlays-at (point))))))
       (push (list :latex-fragment
-                 (org-overlay-start o) (org-overlay-end o)) clist)
+                 (overlay-start o) (overlay-end o)) clist)
       (push (list :latex-preview
-                 (org-overlay-start o) (org-overlay-end o)) clist))
+                 (overlay-start o) (overlay-end o)) clist))
      ((org-inside-LaTeX-fragment-p)
       ;; FIXME: positions wrong.
       (push (list :latex-fragment (point) (point)) clist)))
@@ -16664,6 +18107,17 @@ really on, so that the block visually is on the match."
              (throw 'exit t)))
        nil))))
 
+(defun org-in-regexps-block-p (start-re end-re)
+  "Return t if the current point is between matches of START-RE and END-RE.
+This will also return to if point is on one of the two matches."
+  (interactive)
+  (let ((p (point)))
+    (save-excursion
+      (and (or (org-at-regexp-p start-re)
+              (re-search-backward start-re nil t))
+          (re-search-forward end-re nil t)
+          (>= (point) p)))))
+
 (defun org-occur-in-agenda-files (regexp &optional nlines)
   "Call `multi-occur' with buffers for all agenda files."
   (interactive "sOrg-files matching: \np")
@@ -16731,6 +18185,33 @@ for the search purpose."
     (setq list (delete (pop elts) list)))
   list)
 
+(defun org-count (cl-item cl-seq)
+  "Count the number of occurrences of ITEM in SEQ.
+Taken from `count' in cl-seq.el with all keyword arguments removed."
+  (let ((cl-end (length cl-seq)) (cl-start 0) (cl-count 0)  cl-x)
+    (when (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 (equal cl-item cl-x) (setq cl-count (1+ cl-count)))
+      (setq cl-start (1+ cl-start)))
+    cl-count))
+
+(defun org-remove-if (predicate seq)
+  "Remove everything from SEQ that fulfills PREDICATE."
+  (let (res e)
+    (while seq
+      (setq e (pop seq))
+      (if (not (funcall predicate e)) (push e res)))
+    (nreverse res)))
+
+(defun org-remove-if-not (predicate seq)
+  "Remove everything from SEQ that does not fulfill PREDICATE."
+  (let (res e)
+    (while seq
+      (setq e (pop seq))
+      (if (funcall predicate e) (push e res)))
+    (nreverse res)))
+
 (defun org-back-over-empty-lines ()
   "Move backwards over whitespace, to the beginning of the first empty line.
 Returns the number of empty lines passed."
@@ -16746,7 +18227,7 @@ Returns the number of empty lines passed."
 (defun org-point-in-group (point group &optional context)
   "Check if POINT is in match-group GROUP.
 If CONTEXT is non-nil, return a list with CONTEXT and the boundaries of the
-match.  If the match group does ot exist or point is not inside it,
+match.  If the match group does not exist or point is not inside it,
 return nil."
   (and (match-beginning group)
        (>= point (match-beginning group))
@@ -16757,7 +18238,8 @@ return nil."
 
 (defun org-switch-to-buffer-other-window (&rest args)
   "Switch to buffer in a second window on the current frame.
-In particular, do not allow pop-up frames."
+In particular, do not allow pop-up frames.
+Returns the newly created buffer."
   (let (pop-up-frames special-display-buffer-names special-display-regexps
                      special-display-function)
     (apply 'switch-to-buffer-other-window args)))
@@ -16808,17 +18290,27 @@ TABLE is an association list with keys like \"%a\" and string values.
 The sequences in STRING may contain normal field width and padding information,
 for example \"%-5s\".  Replacements happen in the sequence given by TABLE,
 so values can contain further %-escapes if they are define later in TABLE."
-  (let ((case-fold-search nil)
-       e re rpl)
-    (while (setq e (pop table))
+  (let ((tbl (copy-alist table))
+       (case-fold-search nil)
+        (pchg 0)
+        e re rpl)
+    (while (setq e (pop tbl))
       (setq re (concat "%-?[0-9.]*" (substring (car e) 1)))
+      (when (and (cdr e) (string-match re (cdr e)))
+        (let ((sref (substring (cdr e) (match-beginning 0) (match-end 0)))
+              (safe "SREF"))
+          (add-text-properties 0 3 (list 'sref sref) safe)
+          (setcdr e (replace-match safe t t (cdr e)))))
       (while (string-match re string)
-       (setq rpl (format (concat (substring (match-string 0 string) 0 -1) "s")
-                         (cdr e)))
-       (setq string (replace-match rpl t t string))))
+        (setq rpl (format (concat (substring (match-string 0 string) 0 -1) "s")
+                          (cdr e)))
+        (setq string (replace-match rpl t t string))))
+    (while (setq pchg (next-property-change pchg string))
+      (let ((sref (get-text-property pchg 'sref string)))
+       (when (and sref (string-match "SREF" string pchg))
+         (setq string (replace-match sref t t string)))))
     string))
 
-
 (defun org-sublist (list start end)
   "Return a section of LIST, from START to END.
 Counting starts at 1."
@@ -16970,6 +18462,12 @@ which make use of the date at the cursor."
                       t t))
     (org-move-to-column column)))
 
+(defvar org-adaptive-fill-regexp-backup adaptive-fill-regexp
+  "Variable to store copy of `adaptive-fill-regexp'.
+Since `adaptive-fill-regexp' is set to never match, we need to
+store a backup of its value before entering `org-mode' so that
+the functionality can be provided as a fall-back.")
+
 (defun org-set-autofill-regexps ()
   (interactive)
   ;; In the paragraph separator we include headlines, because filling
@@ -17005,8 +18503,11 @@ which make use of the date at the cursor."
   ;; and fixed-width regions are not wrapped.  That function will pass
   ;; through to `fill-paragraph' when appropriate.
   (org-set-local 'fill-paragraph-function 'org-fill-paragraph)
-  ; Adaptive filling: To get full control, first make sure that
+  ;; Adaptive filling: To get full control, first make sure that
   ;; `adaptive-fill-regexp' never matches.  Then install our own matcher.
+  (unless (local-variable-p 'adaptive-fill-regexp (current-buffer))
+    (org-set-local 'org-adaptive-fill-regexp-backup
+                   adaptive-fill-regexp))
   (org-set-local 'adaptive-fill-regexp "\000")
   (org-set-local 'adaptive-fill-function
                 'org-adaptive-fill-function)
@@ -17035,8 +18536,11 @@ which make use of the date at the cursor."
   "Return a fill prefix for org-mode files.
 In particular, this makes sure hanging paragraphs for hand-formatted lists
 work correctly."
-  (cond ((looking-at "#[ \t]+")
-        (match-string 0))
+  (cond
+   ;; Comment line
+   ((looking-at "#[ \t]+")
+    (match-string-no-properties 0))
+   ;; Description list
        ((looking-at "[ \t]*\\([-*+] .*? :: \\)")
         (save-excursion
           (if (> (match-end 1) (+ (match-beginning 1)
@@ -17044,11 +18548,14 @@ work correctly."
               (goto-char (+ (match-beginning 1) 5))
             (goto-char (match-end 0)))
           (make-string (current-column) ?\ )))
-       ((looking-at "[ \t]*\\([-*+] \\|[0-9]+[.)]  ?\\)?")
+    ;; Ordered or unordered list
+       ((looking-at "[ \t]*\\([-*+] \\|[0-9]+[.)]  ?\\)")
         (save-excursion
           (goto-char (match-end 0))
           (make-string (current-column) ?\ )))
-       (t nil)))
+    ;; Other text
+    ((looking-at org-adaptive-fill-regexp-backup)
+     (match-string-no-properties 0))))
 
 ;;; Other stuff.
 
@@ -17149,8 +18656,8 @@ beyond the end of the headline."
       (if (bobp)
          nil
        (backward-char 1)
-       (if (org-invisible-p)
-           (while (and (not (bobp)) (org-invisible-p))
+       (if (org-truely-invisible-p)
+           (while (and (not (bobp)) (org-truely-invisible-p))
              (backward-char 1)
              (beginning-of-line 1))
          (forward-char 1))))
@@ -17246,6 +18753,11 @@ depending on context."
    ((or (not org-special-ctrl-k)
        (bolp)
        (not (org-on-heading-p)))
+    (if (and (get-char-property (min (point-max) (point-at-eol)) 'invisible)
+            org-ctrl-k-protect-subtree)
+       (if (or (eq org-ctrl-k-protect-subtree 'error)
+               (not (y-or-n-p "Kill hidden subtree along with headline? ")))
+           (error "C-k aborted - would kill hidden subtree")))
     (call-interactively 'kill-line))
    ((looking-at (org-re ".*?\\S-\\([ \t]+\\(:[[:alnum:]_@:]+:\\)\\)[ \t]*$"))
     (kill-region (point) (match-beginning 1))
@@ -17273,7 +18785,8 @@ org-yank-adjusted-subtrees
     *visible* surrounding headings.
 
 Any prefix to this command will cause `yank' to be called directly with
-no special treatment.  In particular, a simple `C-u' prefix will just
+no special treatment.  In particular, a simple \\[universal-argument] prefix \
+will just
 plainly yank the text as it is.
 
 \[1] The test checks if the first non-white line is a heading
@@ -17363,6 +18876,17 @@ interactive command with similar behavior."
       (outline-invisible-p)
     (get-char-property (point) 'invisible)))
 
+(defun org-truely-invisible-p ()
+  "Check if point is at a character currently not visible.
+This version does not only check the character property, but also
+`visible-mode'."
+  ;; Early versions of noutline don't have `outline-invisible-p'.
+  (if (org-bound-and-true-p visible-mode)
+      nil
+    (if (fboundp 'outline-invisible-p)
+       (outline-invisible-p)
+      (get-char-property (point) 'invisible))))
+
 (defun org-invisible-p2 ()
   "Check if point is at a character currently not visible."
   (save-excursion
@@ -17379,6 +18903,13 @@ interactive command with similar behavior."
     (error (error "Before first headline at position %d in buffer %s"
                  (point) (current-buffer)))))
 
+(defun org-beginning-of-defun ()
+  "Go to the beginning of the subtree, i.e. back to the heading."
+  (org-back-to-heading))
+(defun org-end-of-defun ()
+  "Go to the end of the subtree."
+  (org-end-of-subtree nil t))
+
 (defun org-before-first-heading-p ()
   "Before first heading?"
   (save-excursion
@@ -17389,6 +18920,15 @@ interactive command with similar behavior."
 (defun org-at-heading-p (&optional ignored)
   (outline-on-heading-p t))
 
+(defun org-point-at-end-of-empty-headline ()
+  "If point is at the end of an empty headline, return t, else nil.
+If the heading only contains a TODO keyword, it is still still considered
+empty."
+  (and (looking-at "[ \t]*$")
+       (save-excursion
+         (beginning-of-line 1)
+         (looking-at (concat "^\\(\\*+\\)[ \t]+\\(" org-todo-regexp
+                            "\\)?[ \t]*$")))))
 (defun org-at-heading-or-item-p ()
   (or (org-on-heading-p) (org-at-item-p)))
 
@@ -17567,7 +19107,7 @@ Stop at the first and last subheadings of a superior heading."
                  (setq l (- (match-end 0) (match-beginning 0) 1))
                  (= l level)
                  (not invisible-ok)
-                 (org-invisible-p))
+                 (progn (backward-char 1) (org-invisible-p)))
        (if (< l level) (setq arg 1)))
       (setq arg (1- arg)))
     (beginning-of-line 1)))
@@ -17714,11 +19254,11 @@ if no description is present"
 
 ;; Speedbar support
 
-(defvar org-speedbar-restriction-lock-overlay (org-make-overlay 1 1)
+(defvar org-speedbar-restriction-lock-overlay (make-overlay 1 1)
   "Overlay marking the agenda restriction line in speedbar.")
-(org-overlay-put org-speedbar-restriction-lock-overlay
+(overlay-put org-speedbar-restriction-lock-overlay
                 'face 'org-agenda-restriction-lock)
-(org-overlay-put org-speedbar-restriction-lock-overlay
+(overlay-put org-speedbar-restriction-lock-overlay
                 'help-echo "Agendas are currently limited to this item.")
 (org-detach-overlay org-speedbar-restriction-lock-overlay)
 
@@ -17751,8 +19291,8 @@ To get rid of the restriction, use \\[org-agenda-remove-restriction-lock]."
          (error "Cannot restrict to non-Org-mode file"))
        (org-agenda-set-restriction-lock 'file)))
      (t (error "Don't know how to restrict Org-mode's agenda")))
-    (org-move-overlay org-speedbar-restriction-lock-overlay
-                     (point-at-bol) (point-at-eol))
+    (move-overlay org-speedbar-restriction-lock-overlay
+                 (point-at-bol) (point-at-eol))
     (setq current-prefix-arg nil)
     (org-agenda-maybe-redo)))
 
@@ -17766,7 +19306,6 @@ To get rid of the restriction, use \\[org-agenda-remove-restriction-lock]."
      (add-hook 'speedbar-visiting-tag-hook
               (lambda () (and (org-mode-p) (org-show-context 'org-goto))))))
 
-
 ;;; Fixes and Hacks for problems with other packages
 
 ;; Make flyspell not check words in links, to not mess up our keymap
@@ -17849,4 +19388,3 @@ Still experimental, may disappear in the future."
 ;; arch-tag: e77da1a7-acc7-4336-b19e-efa25af3f9fd
 
 ;;; org.el ends here
-
index b5d3d7987144475350581d8f58a67f7e80a0e6be..ed7d5f33a35c8311217bbd7b5c6f95e86dbc4374 100644 (file)
@@ -41,7 +41,7 @@
 (defgroup outlines nil
   "Support for hierarchical outlining."
   :prefix "outline-"
-  :group 'editing)
+  :group 'wp)
 
 (defcustom outline-regexp "[*\^L]+"
   "Regular expression to match the beginning of a heading.
@@ -915,7 +915,11 @@ Show the heading too, if it is currently invisible."
        (lambda ()
         (if (<= (funcall outline-level) levels)
             (outline-show-heading)))
-       beg end)))
+       beg end)
+      ;; Finally unhide any trailing newline.
+      (goto-char (point-max))
+      (if (and (bolp) (not (bobp)) (outline-invisible-p (1- (point))))
+          (outline-flag-region (1- (point)) (point) nil))))
   (run-hooks 'outline-view-change-hook))
 
 (defun hide-other ()
index 301201ea0ebe8a5450831016b99f2072f82f6b8c..7c07642a1f39948bb17fd83a639319b9d19fa3fa 100644 (file)
@@ -1,7 +1,7 @@
 ;;; password-cache.el --- Read passwords, possibly using a password cache.
 
-;; Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
-;;   Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
+;;   2010  Free Software Foundation, Inc.
 
 ;; Author: Simon Josefsson <simon@josefsson.org>
 ;; Created: 2003-12-21
 
 ;;; Code:
 
+;; Options are autoloaded since they are used by eg mml-sec.el.
+
+;;;###autoload
 (defcustom password-cache t
   "Whether to cache passwords."
   :group 'password
   :type 'boolean)
 
+;;;###autoload
 (defcustom password-cache-expiry 16
   "How many seconds passwords are cached, or nil to disable expiring.
 Whether passwords are cached at all is controlled by `password-cache'."
@@ -101,7 +105,7 @@ remove incorrect ones from the cache."
 
 (defun password-cache-remove (key)
   "Remove password indexed by KEY from password cache.
-This is typically run be a timer setup from `password-cache-add',
+This is typically run by a timer setup from `password-cache-add',
 but can be invoked at any time to forcefully remove passwords
 from the cache.  This may be useful when it has been detected
 that a password is invalid, so that `password-read' query the
index 510caa3a876ce1cbd7cc8ea3542c0e245bb6d372..095326e9c8e5d18df3760bd98d4d8817470d1304 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Maintainer: FSF
 ;; Keywords: internal
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
index 8b394826e63133afb76a5e93d971c897d2f97e4d..98d1e47666919aac518fed7b054df6ba8550da72 100644 (file)
@@ -4,6 +4,7 @@
 ;;   2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
+;; Package: pcomplete
 
 ;; This file is part of GNU Emacs.
 
index accab1dea9d9ef6670f29586880af33f93e48c31..df1f055506c94779b0b20b710fe1cbc34e501382 100644 (file)
@@ -3,6 +3,8 @@
 ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
+;; Package: pcomplete
+
 ;; This file is part of GNU Emacs.
 
 ;; GNU Emacs is free software: you can redistribute it and/or modify
index 67ef8e76aad7525e9b3cbe49e8903d83331c3585..59c084fffaefec81e6051fe8f9fc39bf33ce1880 100644 (file)
@@ -3,6 +3,8 @@
 ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
+;; Package: pcomplete
+
 ;; This file is part of GNU Emacs.
 
 ;; GNU Emacs is free software: you can redistribute it and/or modify
index 754d7ce7434c73fe66e042463ed561aa5e670788..7960141f03ee985808aed1a4ae715a3b296b10e7 100644 (file)
@@ -3,6 +3,8 @@
 ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
 ;;   2008, 2009, 2010  Free Software Foundation, Inc.
 
+;; Package: pcomplete
+
 ;; This file is part of GNU Emacs.
 
 ;; GNU Emacs is free software: you can redistribute it and/or modify
index 9282fe87b5a12c2356ab524789935d0063d4cb6a..f2c19ca71c4361406fee27c87a3689e95327547c 100644 (file)
@@ -3,6 +3,8 @@
 ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
+;; Package: pcomplete
+
 ;; This file is part of GNU Emacs.
 
 ;; GNU Emacs is free software: you can redistribute it and/or modify
index 80f09492fee4c0c9b8211e015cc3f0a8cdaad933..cd216ad8d364f81c37b01a8193fe8984376dbbfc 100644 (file)
@@ -444,12 +444,14 @@ in the same way as TABLE completes strings of the form (concat S2 S)."
 ;; 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
-(defun pcomplete-std-complete ()
+(defun pcomplete-completions-at-point ()
   "Provide standard completion using pcomplete's completion tables.
 Same as `pcomplete' but using the standard completion UI."
-  (interactive)
   ;; FIXME: it only completes the text before point, whereas the
   ;; standard UI may also consider text after point.
+  ;; FIXME: the `pcomplete' UI may be used internally during
+  ;; pcomplete-completions and then throw to `pcompleted', thus
+  ;; imposing the pcomplete UI over the standard UI.
   (catch 'pcompleted
     (let* ((pcomplete-stub)
            pcomplete-seen pcomplete-norm-func
@@ -516,7 +518,7 @@ Same as `pcomplete' but using the standard completion UI."
                                (directory-file-name f))
                       pcomplete-seen))))))
 
-      (completion-in-region
+      (list
        beg (point)
        ;; Add a space at the end of completion.  Use a terminator-regexp
        ;; that never matches since the terminator cannot appear
@@ -527,7 +529,14 @@ Same as `pcomplete' but using the standard completion UI."
                           (cons pcomplete-termination-string
                                 "\\`a\\`")
                           table))
-       pred))))
+       :predicate pred))))
+
+ ;; 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
+(defun pcomplete-std-complete ()
+  (let ((completion-at-point-functions '(pcomplete-completions-at-point)))
+    (completion-at-point)))
 
 ;;; Pcomplete's native UI.
 
@@ -544,7 +553,7 @@ completion functions list (it should occur fairly early in the list)."
                                pcomplete-expand-and-complete
                                pcomplete-reverse)))
       (progn
-       (delete-backward-char pcomplete-last-completion-length)
+       (delete-char (- pcomplete-last-completion-length))
        (if (eq this-command 'pcomplete-reverse)
            (progn
               (push (car (last pcomplete-current-completions))
@@ -607,7 +616,7 @@ This will modify the current buffer."
     (pcomplete)
     (when (and pcomplete-current-completions
               (> (length pcomplete-current-completions) 0)) ;??
-      (delete-backward-char pcomplete-last-completion-length)
+      (delete-char (- pcomplete-last-completion-length))
       (while pcomplete-current-completions
        (unless (pcomplete-insert-entry
                 "" (car pcomplete-current-completions) t
@@ -630,7 +639,7 @@ This will modify the current buffer."
   (when (and pcomplete-cycle-completions
             pcomplete-current-completions
             (eq last-command 'pcomplete-argument))
-    (delete-backward-char pcomplete-last-completion-length)
+    (delete-char (- pcomplete-last-completion-length))
     (setq pcomplete-current-completions nil
          pcomplete-last-completion-raw nil))
   (let ((pcomplete-show-list t))
@@ -1113,7 +1122,7 @@ generate the completions list.  This means that the hook
 (defmacro pcomplete-here* (&optional form stub form-only)
   "An alternate form which does not participate in argument paring."
   (declare (debug t))
-  `(pcomplete-here (lambda () ,form) ,stub t ,form-only))
+  `(pcomplete-here ,form ,stub t ,form-only))
 
 ;; display support
 
@@ -1198,7 +1207,7 @@ Returns non-nil if a space was appended at the end."
       ;; 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-backward-char (length (pcomplete-quote-argument stub)))
+      (delete-char (- (length (pcomplete-quote-argument stub))))
       ;; if there is already a backslash present to handle the first
       ;; character, don't bother quoting it
       (when (eq (char-before) ?\\)
index c506d579283b61aee3928cb8210f78a34f04c0e0..949b6aecb50cc2fa2eae37d7cf7ebefeeaa7bcb0 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Daiki Ueno <ueno@unixuser.org>
 ;; Created: 1999/11/02
 ;; Keywords: PGP, OpenPGP, GnuPG
+;; Package: pgg
 
 ;; This file is part of GNU Emacs.
 
index e8375fe58fe2c9ab13d0e830cfebad0ec78ffcf6..5d66f78e45ba486a7aafafd2e4629740f322c1e0 100644 (file)
@@ -4,10 +4,11 @@
 ;;   2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
-;; Symmetric encryption and gpg-agent support added by: 
+;; Symmetric encryption and gpg-agent support added by:
 ;;   Sascha Wilde <wilde@sha-bang.de>
 ;; Created: 1999/10/28
 ;; Keywords: PGP, OpenPGP, GnuPG
+;; Package: pgg
 
 ;; This file is part of GNU Emacs.
 
index b0f2a815cbdff97b31790af5a36954a225c50a4d..501dea56388469a8abffeb0675c01cdec44d8346 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Daiki Ueno <ueno@unixuser.org>
 ;; Created: 1999/10/28
 ;; Keywords: PGP, OpenPGP, GnuPG
+;; Package: pgg
 
 ;; This file is part of GNU Emacs.
 
 (defun pgg-parse-armor (string)
   (with-temp-buffer
     (buffer-disable-undo)
-    (if (fboundp 'set-buffer-multibyte)
-       (set-buffer-multibyte nil))
+    (unless (featurep 'xemacs)
+      (set-buffer-multibyte nil))
     (insert string)
     (pgg-decode-armor-region (point-min)(point))))
 
index c1c9249a736660682ce9a5790c6afad5af737b7a..4c5119fc8d747303f6f0cd4012f6e8611daa012a 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Daiki Ueno <ueno@unixuser.org>
 ;; Created: 1999/11/02
 ;; Keywords: PGP, OpenPGP
+;; Package: pgg
 
 ;; This file is part of GNU Emacs.
 
index cb2cfd915fb1e0dc551c899fa143a65f2ba5525b..1b063bf312e93a6b255ac6b1e27727cea52bed11 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Daiki Ueno <ueno@unixuser.org>
 ;; Created: 1999/11/02
 ;; Keywords: PGP, OpenPGP
+;; Package: pgg
 
 ;; This file is part of GNU Emacs.
 
index 7364d3782ac2b8e63ecd515749d4268efe873ac6..8209dc1608f518bdc73a3985e7180a3e1a4cefb3 100644 (file)
@@ -475,8 +475,8 @@ signer's public key from `pgg-default-keyserver-address'."
          (if (null signature) nil
            (with-temp-buffer
              (buffer-disable-undo)
-             (if (fboundp 'set-buffer-multibyte)
-                 (set-buffer-multibyte nil))
+             (unless (featurep 'xemacs)
+               (set-buffer-multibyte nil))
              (insert-file-contents signature)
              (cdr (assq 2 (pgg-decode-armor-region
                            (point-min)(point-max)))))))
index 897832d21950da0be45f87823f6f4728bcb28d4b..83186c424426f3e55f06956611aece787043e4b5 100644 (file)
@@ -1060,7 +1060,7 @@ if it can't, it signals an error."
 ;;          (insert ?\()
 ;;          (while (setq undo-map (pop undo-rec))
 ;;            (insert (cdr undo-map) (car undo-map) ?\ ))
-;;          (delete-backward-char 1)
+;;          (delete-char -1)
 ;;          (insert ")\n"))))))
 
 ;; arch-tag: 8f094d88-ffe1-4f99-afe3-a5e81dd939d9
index e18d4bdc2928efdba623bbdc62c01e0b50c715a0..dbe3317a02026c68adddc670d7585f42648b9b98 100644 (file)
@@ -102,59 +102,60 @@ One useful value to include is `turn-on-font-lock' to highlight the pieces."
   "*Number of lines between the Gomoku board and the top of the window.")
 
 
-(defvar gomoku-mode-map nil
+(defvar gomoku-mode-map
+  (let ((map (make-sparse-keymap)))
+
+    ;; Key bindings for cursor motion.
+    (define-key map "y" 'gomoku-move-nw)                   ; y
+    (define-key map "u" 'gomoku-move-ne)                   ; u
+    (define-key map "b" 'gomoku-move-sw)                   ; b
+    (define-key map "n" 'gomoku-move-se)                   ; n
+    (define-key map "h" 'backward-char)                            ; h
+    (define-key map "l" 'forward-char)                     ; l
+    (define-key map "j" 'gomoku-move-down)                 ; j
+    (define-key map "k" 'gomoku-move-up)                   ; k
+
+    (define-key map [kp-7] 'gomoku-move-nw)
+    (define-key map [kp-9] 'gomoku-move-ne)
+    (define-key map [kp-1] 'gomoku-move-sw)
+    (define-key map [kp-3] 'gomoku-move-se)
+    (define-key map [kp-4] 'backward-char)
+    (define-key map [kp-6] 'forward-char)
+    (define-key map [kp-2] 'gomoku-move-down)
+    (define-key map [kp-8] 'gomoku-move-up)
+
+    (define-key map "\C-n" 'gomoku-move-down)              ; C-n
+    (define-key map "\C-p" 'gomoku-move-up)                ; C-p
+
+    ;; Key bindings for entering Human moves.
+    (define-key map "X" 'gomoku-human-plays)               ; X
+    (define-key map "x" 'gomoku-human-plays)               ; x
+    (define-key map " " 'gomoku-human-plays)               ; SPC
+    (define-key map "\C-m" 'gomoku-human-plays)                    ; RET
+    (define-key map "\C-c\C-p" 'gomoku-human-plays)        ; C-c C-p
+    (define-key map "\C-c\C-b" 'gomoku-human-takes-back)    ; C-c C-b
+    (define-key map "\C-c\C-r" 'gomoku-human-resigns)      ; C-c C-r
+    (define-key map "\C-c\C-e" 'gomoku-emacs-plays)        ; C-c C-e
+
+    (define-key map [kp-enter] 'gomoku-human-plays)
+    (define-key map [insert] 'gomoku-human-plays)
+    (define-key map [down-mouse-1] 'gomoku-click)
+    (define-key map [drag-mouse-1] 'gomoku-click)
+    (define-key map [mouse-1] 'gomoku-click)
+    (define-key map [down-mouse-2] 'gomoku-click)
+    (define-key map [mouse-2] 'gomoku-mouse-play)
+    (define-key map [drag-mouse-2] 'gomoku-mouse-play)
+
+    (define-key map [remap previous-line] 'gomoku-move-up)
+    (define-key map [remap next-line] 'gomoku-move-down)
+    (define-key map [remap move-beginning-of-line] 'gomoku-beginning-of-line)
+    (define-key map [remap move-end-of-line] 'gomoku-end-of-line)
+    (define-key map [remap undo] 'gomoku-human-takes-back)
+    (define-key map [remap advertised-undo] 'gomoku-human-takes-back)
+    map)
+
   "Local keymap to use in Gomoku mode.")
 
-(if gomoku-mode-map nil
-  (setq gomoku-mode-map (make-sparse-keymap))
-
-  ;; Key bindings for cursor motion.
-  (define-key gomoku-mode-map "y" 'gomoku-move-nw)             ; y
-  (define-key gomoku-mode-map "u" 'gomoku-move-ne)             ; u
-  (define-key gomoku-mode-map "b" 'gomoku-move-sw)             ; b
-  (define-key gomoku-mode-map "n" 'gomoku-move-se)             ; n
-  (define-key gomoku-mode-map "h" 'backward-char)              ; h
-  (define-key gomoku-mode-map "l" 'forward-char)               ; l
-  (define-key gomoku-mode-map "j" 'gomoku-move-down)           ; j
-  (define-key gomoku-mode-map "k" 'gomoku-move-up)             ; k
-
-  (define-key gomoku-mode-map [kp-7] 'gomoku-move-nw)
-  (define-key gomoku-mode-map [kp-9] 'gomoku-move-ne)
-  (define-key gomoku-mode-map [kp-1] 'gomoku-move-sw)
-  (define-key gomoku-mode-map [kp-3] 'gomoku-move-se)
-  (define-key gomoku-mode-map [kp-4] 'backward-char)
-  (define-key gomoku-mode-map [kp-6] 'forward-char)
-  (define-key gomoku-mode-map [kp-2] 'gomoku-move-down)
-  (define-key gomoku-mode-map [kp-8] 'gomoku-move-up)
-
-  (define-key gomoku-mode-map "\C-n" 'gomoku-move-down)                ; C-n
-  (define-key gomoku-mode-map "\C-p" 'gomoku-move-up)          ; C-p
-
-  ;; Key bindings for entering Human moves.
-  (define-key gomoku-mode-map "X" 'gomoku-human-plays)         ; X
-  (define-key gomoku-mode-map "x" 'gomoku-human-plays)         ; x
-  (define-key gomoku-mode-map " " 'gomoku-human-plays)         ; SPC
-  (define-key gomoku-mode-map "\C-m" 'gomoku-human-plays)      ; RET
-  (define-key gomoku-mode-map "\C-c\C-p" 'gomoku-human-plays)  ; C-c C-p
-  (define-key gomoku-mode-map "\C-c\C-b" 'gomoku-human-takes-back) ; C-c C-b
-  (define-key gomoku-mode-map "\C-c\C-r" 'gomoku-human-resigns)        ; C-c C-r
-  (define-key gomoku-mode-map "\C-c\C-e" 'gomoku-emacs-plays)  ; C-c C-e
-
-  (define-key gomoku-mode-map [kp-enter] 'gomoku-human-plays)
-  (define-key gomoku-mode-map [insert] 'gomoku-human-plays)
-  (define-key gomoku-mode-map [down-mouse-1] 'gomoku-click)
-  (define-key gomoku-mode-map [drag-mouse-1] 'gomoku-click)
-  (define-key gomoku-mode-map [mouse-1] 'gomoku-click)
-  (define-key gomoku-mode-map [down-mouse-2] 'gomoku-click)
-  (define-key gomoku-mode-map [mouse-2] 'gomoku-mouse-play)
-  (define-key gomoku-mode-map [drag-mouse-2] 'gomoku-mouse-play)
-
-  (define-key gomoku-mode-map [remap previous-line] 'gomoku-move-up)
-  (define-key gomoku-mode-map [remap next-line] 'gomoku-move-down)
-  (define-key gomoku-mode-map [remap move-beginning-of-line] 'gomoku-beginning-of-line)
-  (define-key gomoku-mode-map [remap move-end-of-line] 'gomoku-end-of-line)
-  (define-key gomoku-mode-map [remap undo] 'gomoku-human-takes-back)
-  (define-key gomoku-mode-map [remap advertised-undo] 'gomoku-human-takes-back))
 
 (defvar gomoku-emacs-won ()
   "For making font-lock use the winner's face for the line.")
@@ -182,28 +183,20 @@ One useful value to include is `turn-on-font-lock' to highlight the pieces."
 ;; allow View Mode to be activated in its buffer.
 (put 'gomoku-mode 'mode-class 'special)
 
-(defun gomoku-mode ()
+(define-derived-mode gomoku-mode nil "Gomoku"
   "Major mode for playing Gomoku against Emacs.
 You and Emacs play in turn by marking a free square.  You mark it with X
 and Emacs marks it with O.  The winner is the first to get five contiguous
 marks horizontally, vertically or in diagonal.
-
+\\<gomoku-mode-map>
 You play by moving the cursor over the square you choose and hitting \\[gomoku-human-plays].
 
-Other useful commands:
-\\{gomoku-mode-map}
-Entry to this mode calls the value of `gomoku-mode-hook' if that value
-is non-nil."
-  (interactive)
-  (kill-all-local-variables)
-  (setq major-mode 'gomoku-mode
-       mode-name "Gomoku")
+Other useful commands:\n
+\\{gomoku-mode-map}"
   (gomoku-display-statistics)
-  (use-local-map gomoku-mode-map)
   (make-local-variable 'font-lock-defaults)
   (setq font-lock-defaults '(gomoku-font-lock-keywords t))
-  (toggle-read-only t)
-  (run-mode-hooks 'gomoku-mode-hook))
+  (toggle-read-only t))
 \f
 ;;;
 ;;; THE BOARD.
index d38c5e44cc8d847732112e6af4acaa77151b1a09..68d1590e57110491ea5fbf4141211791ecce764d 100644 (file)
@@ -35,7 +35,7 @@
 ;; ;;;;;;;;;;;;; customization variables ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 (defgroup tetris nil
-  "Play a game of tetris."
+  "Play a game of Tetris."
   :prefix "tetris-"
   :group 'games)
 
 
 (defcustom tetris-update-speed-function
   'tetris-default-update-speed-function
-  "Function run whenever the Tetris score changes
+  "Function run whenever the Tetris score changes.
 Called with two arguments: (SHAPES ROWS)
-SHAPES is the number of shapes which have been dropped
-ROWS is the number of rows which have been completed
+SHAPES is the number of shapes which have been dropped.
+ROWS is the number of rows which have been completed.
 
 If the return value is a number, it is used as the timer period."
   :group 'tetris
@@ -76,13 +76,12 @@ If the return value is a number, it is used as the timer period."
   :type 'hook)
 
 (defcustom tetris-tty-colors
-  [nil "blue" "white" "yellow" "magenta" "cyan" "green" "red"]
-  "Vector of colors of the various shapes in text mode
-Element 0 is ignored."
+  ["blue" "white" "yellow" "magenta" "cyan" "green" "red"]
+  "Vector of colors of the various shapes in text mode."
   :group 'tetris
   :type (let ((names `("Shape 1" "Shape 2" "Shape 3"
                       "Shape 4" "Shape 5" "Shape 6" "Shape 7"))
-             (result `(vector (const nil))))
+             (result nil))
          (while names
            (add-to-list 'result
                         (cons 'choice
@@ -96,9 +95,8 @@ Element 0 is ignored."
          result))
 
 (defcustom tetris-x-colors
-  [nil [0 0 1] [0.7 0 1] [1 1 0] [1 0 1] [0 1 1] [0 1 0] [1 0 0]]
-  "Vector of colors of the various shapes
-Element 0 is ignored."
+  [[0 0 1] [0.7 0 1] [1 1 0] [1 0 1] [0 1 1] [0 1 0] [1 0 0]]
+  "Vector of colors of the various shapes."
   :group 'tetris
   :type 'sexp)
 
@@ -196,51 +194,44 @@ Element 0 is ignored."
 ;; ;;;;;;;;;;;;; constants ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 (defconst tetris-shapes
-  [[[[1 1 0 0] [1 1 0 0] [1 1 0 0] [1 1 0 0]]
-    [[1 1 0 0] [1 1 0 0] [1 1 0 0] [1 1 0 0]]
-    [[0 0 0 0] [0 0 0 0] [0 0 0 0] [0 0 0 0]]
-    [[0 0 0 0] [0 0 0 0] [0 0 0 0] [0 0 0 0]]]
-
-   [[[2 2 2 0] [0 2 0 0] [2 0 0 0] [2 2 0 0]]
-    [[0 0 2 0] [0 2 0 0] [2 2 2 0] [2 0 0 0]]
-    [[0 0 0 0] [2 2 0 0] [0 0 0 0] [2 0 0 0]]
-    [[0 0 0 0] [0 0 0 0] [0 0 0 0] [0 0 0 0]]]
-
-   [[[3 3 3 0] [3 3 0 0] [0 0 3 0] [3 0 0 0]]
-    [[3 0 0 0] [0 3 0 0] [3 3 3 0] [3 0 0 0]]
-    [[0 0 0 0] [0 3 0 0] [0 0 0 0] [3 3 0 0]]
-    [[0 0 0 0] [0 0 0 0] [0 0 0 0] [0 0 0 0]]]
-
-   [[[4 4 0 0] [0 4 0 0] [4 4 0 0] [0 4 0 0]]
-    [[0 4 4 0] [4 4 0 0] [0 4 4 0] [4 4 0 0]]
-    [[0 0 0 0] [4 0 0 0] [0 0 0 0] [4 0 0 0]]
-    [[0 0 0 0] [0 0 0 0] [0 0 0 0] [0 0 0 0]]]
-
-   [[[0 5 5 0] [5 0 0 0] [0 5 5 0] [5 0 0 0]]
-    [[5 5 0 0] [5 5 0 0] [5 5 0 0] [5 5 0 0]]
-    [[0 0 0 0] [0 5 0 0] [0 0 0 0] [0 5 0 0]]
-    [[0 0 0 0] [0 0 0 0] [0 0 0 0] [0 0 0 0]]]
-
-   [[[0 6 0 0] [6 0 0 0] [6 6 6 0] [0 6 0 0]]
-    [[6 6 6 0] [6 6 0 0] [0 6 0 0] [6 6 0 0]]
-    [[0 0 0 0] [6 0 0 0] [0 0 0 0] [0 6 0 0]]
-    [[0 0 0 0] [0 0 0 0] [0 0 0 0] [0 0 0 0]]]
-
-   [[[7 7 7 7] [7 0 0 0] [7 7 7 7] [7 0 0 0]]
-    [[0 0 0 0] [7 0 0 0] [0 0 0 0] [7 0 0 0]]
-    [[0 0 0 0] [7 0 0 0] [0 0 0 0] [7 0 0 0]]
-    [[0 0 0 0] [7 0 0 0] [0 0 0 0] [7 0 0 0]]]])
+  [[[[0  0] [1  0] [0  1] [1  1]]]  
+   
+   [[[0  0] [1  0] [2  0] [2  1]] 
+    [[1 -1] [1  0] [1  1] [0  1]] 
+    [[0 -1] [0  0] [1  0] [2  0]] 
+    [[1 -1] [2 -1] [1  0] [1  1]]] 
+   
+   [[[0  0] [1  0] [2  0] [0  1]] 
+    [[0 -1] [1 -1] [1  0] [1  1]] 
+    [[2 -1] [0  0] [1  0] [2  0]] 
+    [[1 -1] [1  0] [1  1] [2  1]]]  
+   
+   [[[0  0] [1  0] [1  1] [2  1]] 
+    [[1  0] [0  1] [1  1] [0  2]]]
+   
+   [[[1  0] [2  0] [0  1] [1  1]] 
+    [[0  0] [0  1] [1  1] [1  2]]]  
+   
+   [[[1  0] [0  1] [1  1] [2  1]] 
+    [[1  0] [1  1] [2  1] [1  2]]                
+    [[0  1] [1  1] [2  1] [1  2]] 
+    [[1  0] [0  1] [1  1] [1  2]]]
+   
+   [[[0  0] [1  0] [2  0] [3  0]]
+    [[1 -1] [1  0] [1  1] [1  2]]]]
+  "Each shape is described by a vector that contains the coordinates of 
+each one of its four blocks.")
 
 ;;the scoring rules were taken from "xtetris".  Blocks score differently
 ;;depending on their rotation
 
 (defconst tetris-shape-scores
-  [ [6 6 6 6] [6 7 6 7] [6 7 6 7] [6 7 6 7] [6 7 6 7] [5 5 6 5] [5 8 5 8]] )
+  [[6] [6 7 6 7] [6 7 6 7] [6 7] [6 7] [5 5 6 5] [5 8]] )
 
 (defconst tetris-shape-dimensions
   [[2 2] [3 2] [3 2] [3 2] [3 2] [3 2] [4 1]])
 
-(defconst tetris-blank 0)
+(defconst tetris-blank 7)
 
 (defconst tetris-border 8)
 
@@ -274,22 +265,22 @@ Element 0 is ignored."
 ;; ;;;;;;;;;;;;; keymaps ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 (defvar tetris-mode-map
-  (make-sparse-keymap 'tetris-mode-map))
-
-(define-key tetris-mode-map "n"                'tetris-start-game)
-(define-key tetris-mode-map "q"                'tetris-end-game)
-(define-key tetris-mode-map "p"                'tetris-pause-game)
-
-(define-key tetris-mode-map " "                'tetris-move-bottom)
-(define-key tetris-mode-map [left]     'tetris-move-left)
-(define-key tetris-mode-map [right]    'tetris-move-right)
-(define-key tetris-mode-map [up]       'tetris-rotate-prev)
-(define-key tetris-mode-map [down]     'tetris-rotate-next)
+  (let ((map (make-sparse-keymap 'tetris-mode-map)))
+    (define-key map "n"                'tetris-start-game)
+    (define-key map "q"                'tetris-end-game)
+    (define-key map "p"                'tetris-pause-game)
+
+    (define-key map " "                'tetris-move-bottom)
+    (define-key map [left]     'tetris-move-left)
+    (define-key map [right]    'tetris-move-right)
+    (define-key map [up]       'tetris-rotate-prev)
+    (define-key map [down]     'tetris-rotate-next)
+    map))
 
 (defvar tetris-null-map
-  (make-sparse-keymap 'tetris-null-map))
-
-(define-key tetris-null-map "n"                'tetris-start-game)
+  (let ((map (make-sparse-keymap 'tetris-null-map)))
+    (define-key map "n"                'tetris-start-game)
+    map))
 
 ;; ;;;;;;;;;;;;;;;; game functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
@@ -299,7 +290,7 @@ Element 0 is ignored."
       (aset options c
            (cond ((= c tetris-blank)
                    tetris-blank-options)
-                  ((and (>= c 1) (<= c 7))
+                  ((and (>= c 0) (<= c 6))
                   (append
                    tetris-cell-options
                    `((((glyph color-x) ,(aref tetris-x-colors c))
@@ -320,20 +311,16 @@ Element 0 is ignored."
                           tetris-n-rows nil)))
        (and (numberp period) period))))
 
-(defun tetris-get-shape-cell (x y)
-  (aref (aref (aref (aref tetris-shapes
-                         tetris-shape)
-                   y)
-             tetris-rot)
-       x))
+(defun tetris-get-shape-cell (block)
+  (aref (aref  (aref tetris-shapes
+                     tetris-shape) tetris-rot)
+        block))
 
 (defun tetris-shape-width ()
-  (aref (aref tetris-shape-dimensions tetris-shape)
-       (% tetris-rot 2)))
+  (aref (aref tetris-shape-dimensions tetris-shape) 0))
 
-(defun tetris-shape-height ()
-  (aref (aref tetris-shape-dimensions tetris-shape)
-       (- 1 (% tetris-rot 2))))
+(defun tetris-shape-rotations ()
+  (length (aref tetris-shapes tetris-shape)))
 
 (defun tetris-draw-score ()
   (let ((strings (vector (format "Shapes: %05d" tetris-n-shapes)
@@ -365,52 +352,58 @@ Element 0 is ignored."
     (tetris-update-score)))
 
 (defun tetris-draw-next-shape ()
-  (loop for y from 0 to 3 do
-       (loop for x from 0 to 3 do
-             (gamegrid-set-cell (+ tetris-next-x x)
-                                (+ tetris-next-y y)
-                                (let ((tetris-shape tetris-next-shape)
-                                      (tetris-rot 0))
-                                  (tetris-get-shape-cell x y))))))
+  (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))))
 
 (defun tetris-draw-shape ()
-  (loop for y from 0 to (1- (tetris-shape-height)) do
-       (loop for x from 0 to (1- (tetris-shape-width)) do
-             (let ((c (tetris-get-shape-cell x y)))
-               (if (/= c tetris-blank)
-                   (gamegrid-set-cell (+ tetris-top-left-x
-                                         tetris-pos-x
-                                         x)
-                                      (+ tetris-top-left-y
-                                         tetris-pos-y
-                                         y)
-                                      c))))))
+  (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))))
 
 (defun tetris-erase-shape ()
-  (loop for y from 0 to (1- (tetris-shape-height)) do
-       (loop for x from 0 to (1- (tetris-shape-width)) do
-             (let ((c (tetris-get-shape-cell x y))
-                   (px (+ tetris-top-left-x tetris-pos-x x))
-                   (py (+ tetris-top-left-y tetris-pos-y y)))
-               (if (/= c tetris-blank)
-                   (gamegrid-set-cell px py tetris-blank))))))
+  (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))))
 
 (defun tetris-test-shape ()
   (let ((hit nil))
-    (loop for y from 0 to (1- (tetris-shape-height)) do
-         (loop for x from 0 to (1- (tetris-shape-width)) do
-               (unless hit
-                 (setq hit
-                       (let* ((c (tetris-get-shape-cell x y))
-                             (xx (+ tetris-pos-x x))
-                             (yy (+ tetris-pos-y y))
-                             (px (+ tetris-top-left-x xx))
-                             (py (+ tetris-top-left-y yy)))
-                         (and (/= c tetris-blank)
-                              (or (>= xx tetris-width)
-                                  (>= yy tetris-height)
-                                  (/= (gamegrid-get-cell px py)
-                                      tetris-blank))))))))
+    (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))))))
     hit))
 
 (defun tetris-full-row (y)
@@ -508,35 +501,32 @@ Drops the shape one square, testing for collision."
            (tetris-shape-done)))))
 
 (defun tetris-move-bottom ()
-  "Drops the shape to the bottom of the playing area"
+  "Drop the shape to the bottom of the playing area."
   (interactive)
-  (if (not tetris-paused)
-      (let ((hit nil))
-        (tetris-erase-shape)
-        (while (not hit)
-          (setq tetris-pos-y (1+ tetris-pos-y))
-          (setq hit (tetris-test-shape)))
-        (setq tetris-pos-y (1- tetris-pos-y))
-        (tetris-draw-shape)
-        (tetris-shape-done))))
+  (unless tetris-paused
+    (let ((hit nil))
+      (tetris-erase-shape)
+      (while (not hit)
+        (setq tetris-pos-y (1+ tetris-pos-y))
+        (setq hit (tetris-test-shape)))
+      (setq tetris-pos-y (1- tetris-pos-y))
+      (tetris-draw-shape)
+      (tetris-shape-done))))
 
 (defun tetris-move-left ()
-  "Moves the shape one square to the left"
+  "Move the shape one square to the left."
   (interactive)
-  (unless (or (= tetris-pos-x 0)
-              tetris-paused)
+  (unless tetris-paused
     (tetris-erase-shape)
     (setq tetris-pos-x (1- tetris-pos-x))
     (if (tetris-test-shape)
-       (setq tetris-pos-x (1+ tetris-pos-x)))
+        (setq tetris-pos-x (1+ tetris-pos-x)))
     (tetris-draw-shape)))
 
 (defun tetris-move-right ()
-  "Moves the shape one square to the right"
+  "Move the shape one square to the right."
   (interactive)
-  (unless (or (= (+ tetris-pos-x (tetris-shape-width))
-                 tetris-width)
-              tetris-paused)
+  (unless tetris-paused
     (tetris-erase-shape)
     (setq tetris-pos-x (1+ tetris-pos-x))
     (if (tetris-test-shape)
@@ -544,35 +534,38 @@ Drops the shape one square, testing for collision."
     (tetris-draw-shape)))
 
 (defun tetris-rotate-prev ()
-  "Rotates the shape clockwise"
+  "Rotate the shape clockwise."
   (interactive)
-  (if (not tetris-paused)
-      (progn (tetris-erase-shape)
-             (setq tetris-rot (% (+ 1 tetris-rot) 4))
-             (if (tetris-test-shape)
-                 (setq tetris-rot (% (+ 3 tetris-rot) 4)))
-             (tetris-draw-shape))))
+  (unless tetris-paused
+      (tetris-erase-shape)
+      (setq tetris-rot (% (+ 1 tetris-rot) 
+                          (tetris-shape-rotations)))
+      (if (tetris-test-shape)
+          (setq tetris-rot (% (+ 3 tetris-rot) 
+                              (tetris-shape-rotations))))
+      (tetris-draw-shape)))
 
 (defun tetris-rotate-next ()
-  "Rotates the shape anticlockwise"
+  "Rotate the shape anticlockwise."
   (interactive)
-  (if (not tetris-paused)
-      (progn
+  (unless tetris-paused
         (tetris-erase-shape)
-        (setq tetris-rot (% (+ 3 tetris-rot) 4))
+        (setq tetris-rot (% (+ 3 tetris-rot)
+                            (tetris-shape-rotations)))
         (if (tetris-test-shape)
-            (setq tetris-rot (% (+ 1 tetris-rot) 4)))
-        (tetris-draw-shape))))
+            (setq tetris-rot (% (+ 1 tetris-rot)
+                                (tetris-shape-rotations))))
+        (tetris-draw-shape)))
 
 (defun tetris-end-game ()
-  "Terminates the current game"
+  "Terminate the current game."
   (interactive)
   (gamegrid-kill-timer)
   (use-local-map tetris-null-map)
   (gamegrid-add-score tetris-score-file tetris-score))
 
 (defun tetris-start-game ()
-  "Starts a new game of Tetris"
+  "Start a new game of Tetris."
   (interactive)
   (tetris-reset-game)
   (use-local-map tetris-mode-map)
@@ -581,7 +574,7 @@ Drops the shape one square, testing for collision."
     (gamegrid-start-timer period 'tetris-update-game)))
 
 (defun tetris-pause-game ()
-  "Pauses (or resumes) the current game"
+  "Pause (or resume) the current game."
   (interactive)
   (setq tetris-paused (not tetris-paused))
   (message (and tetris-paused "Game paused (press p to resume)")))
@@ -591,21 +584,13 @@ Drops the shape one square, testing for collision."
 
 (put 'tetris-mode 'mode-class 'special)
 
-(defun tetris-mode ()
-  "A mode for playing Tetris.
-
-tetris-mode keybindings:
-   \\{tetris-mode-map}
-"
-  (kill-all-local-variables)
+(define-derived-mode tetris-mode nil "Tetris"
+  "A mode for playing Tetris."
 
   (add-hook 'kill-buffer-hook 'gamegrid-kill-timer nil t)
 
   (use-local-map tetris-null-map)
 
-  (setq major-mode 'tetris-mode)
-  (setq mode-name "Tetris")
-
   (unless (featurep 'emacs)
     (setq mode-popup-menu
          '("Tetris Commands"
@@ -617,12 +602,12 @@ tetris-mode keybindings:
            ["Resume"           tetris-pause-game
             (and (tetris-active-p) tetris-paused)])))
 
+  (setq show-trailing-whitespace nil)
+
   (setq gamegrid-use-glyphs tetris-use-glyphs)
   (setq gamegrid-use-color tetris-use-color)
 
-  (gamegrid-init (tetris-display-options))
-
-  (run-mode-hooks 'tetris-mode-hook))
+  (gamegrid-init (tetris-display-options)))
 
 ;;;###autoload
 (defun tetris ()
@@ -645,6 +630,8 @@ tetris-mode keybindings:
 "
   (interactive)
 
+  (select-window (or (get-buffer-window tetris-buffer-name)
+                    (selected-window)))
   (switch-to-buffer tetris-buffer-name)
   (gamegrid-kill-timer)
   (tetris-mode)
index cf22be164d99bd7fedce5386a7a50f07e4709f37..4fa5a8c39206b6dc5e28f1b7b15bd3114ae41b04 100644 (file)
 
 ;;; Code:
 
-(require 'timer)
-(require 'tabify)
-(eval-when-compile (require 'cl))
-
 (defvar zone-timer nil
   "The timer we use to decide when to zone out, or nil if none.")
 
@@ -210,19 +206,20 @@ If the element is a function or a list of a function and a number,
     (insert s)))
 
 (defun zone-shift-left ()
-  (let (s)
+  (let ((inhibit-point-motion-hooks t)
+        s)
     (while (not (eobp))
       (unless (eolp)
         (setq s (buffer-substring (point) (1+ (point))))
         (delete-char 1)
         (end-of-line)
         (insert s))
-      (forward-char 1))))
+      (ignore-errors (forward-char 1)))))
 
 (defun zone-shift-right ()
   (goto-char (point-max))
-  (end-of-line)
-  (let (s)
+  (let ((inhibit-point-motion-hooks t)
+        s)
     (while (not (bobp))
       (unless (bolp)
         (setq s (buffer-substring (1- (point)) (point)))
@@ -348,15 +345,8 @@ If the element is a function or a list of a function and a number,
     (let ((np (+ 2 (random 5)))
           (pm (point-max)))
       (while (< np pm)
-        (goto-char np)
-        (let ((prec (preceding-char))
-              (props (text-properties-at (1- (point)))))
-          (insert (if (zerop (random 2))
-                      (upcase prec)
-                    (downcase prec)))
-          (set-text-properties (1- (point)) (point) props))
-        (backward-char 2)
-        (delete-char 1)
+        (funcall (if (zerop (random 2)) 'upcase-region
+                   'downcase-region) (1- np) np)
         (setq np (+ np (1+ (random 5))))))
     (goto-char (point-min))
     (sit-for 0 2)))
@@ -365,13 +355,14 @@ If the element is a function or a list of a function and a number,
 ;;;; rotating
 
 (defun zone-line-specs ()
-  (let (ret)
+  (let ((ok t)
+        ret)
     (save-excursion
       (goto-char (window-start))
-      (while (< (point) (window-end))
+      (while (and ok (< (point) (window-end)))
         (when (looking-at "[\t ]*\\([^\n]+\\)")
           (setq ret (cons (cons (match-beginning 1) (match-end 1)) ret)))
-        (forward-line 1)))
+        (setq ok (zerop (forward-line 1)))))
     ret))
 
 (defun zone-pgm-rotate (&optional random-style)
@@ -404,6 +395,7 @@ If the element is a function or a list of a function and a number,
             (setq cut 1 paste 2)
           (setq cut 2 paste 1))
         (goto-char (aref ent cut))
+        (setq aamt (min aamt (- (point-max) (point))))
         (setq txt (buffer-substring (point) (+ (point) aamt)))
         (delete-char aamt)
         (goto-char (aref ent paste))
@@ -447,19 +439,19 @@ If the element is a function or a list of a function and a number,
          (hmm (cond
                ((string-match "[a-z]" c-string) (upcase c-string))
                ((string-match "[A-Z]" c-string) (downcase c-string))
-               (t (propertize " " 'display `(space :width ,cw-ceil))))))
-    (do ((i 0 (1+ i))
-         (wait 0.5 (* wait 0.8)))
-        ((= i 20))
+               (t (propertize " " 'display `(space :width ,cw-ceil)))))
+         (wait 0.5))
+    (dotimes (i 20)
       (goto-char pos)
       (delete-char 1)
       (insert (if (= 0 (% i 2)) hmm c-string))
-      (zone-park/sit-for wbeg wait))
+      (zone-park/sit-for wbeg (setq wait (* wait 0.8))))
     (delete-char -1) (insert c-string)))
 
 (defun zone-fill-out-screen (width height)
   (let ((start (window-start))
-       (line (make-string width 32)))
+       (line (make-string width 32))
+       (inhibit-point-motion-hooks t))
     (goto-char start)
     ;; fill out rectangular ws block
     (while (progn (end-of-line)
@@ -473,8 +465,7 @@ If the element is a function or a list of a function and a number,
     (let ((nl (- height (count-lines (point-min) (point)))))
       (when (> nl 0)
        (setq line (concat line "\n"))
-       (do ((i 0 (1+ i)))
-           ((= i nl))
+        (dotimes (i nl)
          (insert line))))
     (goto-char start)
     (recenter 0)
@@ -589,11 +580,12 @@ If the element is a function or a list of a function and a number,
 
 (defun zone-pgm-stress ()
   (goto-char (point-min))
-  (let (lines)
-    (while (< (point) (point-max))
+  (let ((ok t)
+        lines)
+    (while (and ok (< (point) (point-max)))
       (let ((p (point)))
-        (forward-line 1)
-        (setq lines (cons (buffer-substring p (point)) lines))))
+        (setq ok (zerop (forward-line 1))
+              lines (cons (buffer-substring p (point)) lines))))
     (sit-for 5)
     (zone-hiding-modeline
      (let ((msg "Zoning... (zone-pgm-stress)"))
@@ -673,7 +665,8 @@ If nil, `zone-pgm-random-life' chooses a value from 0-3 (inclusive).")
       (setq c (point))
       (move-to-column 9)
       (setq col (cons (buffer-substring (point) c) col))
-      (end-of-line 0)
+;      (let ((inhibit-point-motion-hooks t))
+        (end-of-line 0);)
       (forward-char -10))
     (let ((life-patterns (vector
                           (if (and col (search-forward "@" max t))
index 95f9f6babf3bc37953347b6a1f17e272b5fa609c..227f202fef0294a1420c8e25b9df4d910d6eabe2 100644 (file)
@@ -1645,7 +1645,7 @@ ARG is the prefix the user entered with \\[universal-argument]."
                     (insert " ")
                     (ada-adjust-case)
                     ;; horrible dekludge
-                    (delete-backward-char 1)
+                    (delete-char -1)
                     ;; some special keys and their bindings
                     (cond
                      ((eq lastk ?\n)
index 0ae93c392a71e92673bb03822a6e08231eea132a..630f83e58aab64483c17639aed4df23582488592 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Emmanuel Briot <briot@gnat.com>
 ;; Maintainer: Stephen Leake <stephen_leake@stephe-leake.org>
 ;; Keywords: languages, ada, project file
+;; Package: ada-mode
 
 ;; This file is part of GNU Emacs.
 
index 103bc093bdb3adf3f7972af21967ccc63694d18b..b618b26c73a84e856e8b890c8127b4d16595daeb 100644 (file)
@@ -9,6 +9,7 @@
 ;;     Rolf Ebert <ebert@waporo.muc.de>
 ;; Maintainer: Stephen Leake <stephen_leake@stephe-leake.org>
 ;; Keywords: languages, ada
+;; Package: ada-mode
 
 ;; This file is part of GNU Emacs.
 
index bf836b20eee57f95016818179d9978bccd2b8006..73c31f08cd32f31aa63a0cd2d7fe423932f64381 100644 (file)
@@ -8,6 +8,7 @@
 ;;      Emmanuel Briot <briot@gnat.com>
 ;; Maintainer: Stephen Leake <stephen_leake@stephe-leake.org>
 ;; Keywords: languages ada xref
+;; Package: ada-mode
 
 ;; This file is part of GNU Emacs.
 
@@ -108,10 +109,9 @@ the Ada mode project."
   :type 'string :group 'ada)
 
 (defcustom ada-prj-ada-project-path-sep
-  (if (or (equal system-type 'windows-nt)
-         (equal system-type 'ms-dos))
-      ";"
-    ":")
+  (cond ((boundp 'path-separator) path-separator) ; 20.3+
+       ((memq system-type '(windows-nt ms-dos)) ";")
+       (t ":"))
   "Default separator for ada_project_path project variable."
   :type 'string :group 'ada)
 
@@ -381,9 +381,9 @@ Assumes environment variable ADA_PROJECT_PATH is set properly."
          (forward-line 1) ; first directory in list
          (while (not (looking-at "^$")) ; terminate on blank line
            (back-to-indentation) ; skip whitespace
-           (if (looking-at "<Current_Directory>")
-               (add-to-list 'src-dir  (expand-file-name "."))
-             (add-to-list 'src-dir
+           (add-to-list 'src-dir
+                         (if (looking-at "<Current_Directory>")
+                             default-directory
                           (expand-file-name
                            (buffer-substring-no-properties
                             (point) (line-end-position)))))
@@ -395,9 +395,9 @@ Assumes environment variable ADA_PROJECT_PATH is set properly."
          (forward-line 1)
          (while (not (looking-at "^$"))
            (back-to-indentation)
-           (if (looking-at "<Current_Directory>")
-               (add-to-list 'obj-dir (expand-file-name "."))
-             (add-to-list 'obj-dir
+           (add-to-list 'obj-dir
+                         (if (looking-at "<Current_Directory>")
+                             default-directory
                           (expand-file-name
                            (buffer-substring-no-properties
                             (point) (line-end-position)))))
index 4e93c5478815893da703683b9839db3007c83df0..9b24ac7a1f4b1738682eb23d4a73c4080d692426 100644 (file)
@@ -5,7 +5,7 @@
 
 ;; Author: Christoph.Wedler@sap.com
 ;; Keywords: languages, ANTLR, code generator
-;; Version: (see `antlr-version' below)
+;; Version: 2.2c
 ;; X-URL: http://antlr-mode.sourceforge.net/
 
 ;; This file is part of GNU Emacs.
index 0ce7d780d1fbae52d0dd66b8af959e8e7eb2ba37..f5fef76a009a4085b707bdf5238729695b5c1af3 100644 (file)
   "Additional expressions to highlight in Assembler mode.")
 
 ;;;###autoload
-(defun asm-mode ()
+(define-derived-mode asm-mode prog-mode "Assembler"
   "Major mode for editing typical assembler code.
 Features a private abbrev table and the following bindings:
 
@@ -128,13 +128,8 @@ Turning on Asm mode runs the hook `asm-mode-hook' at the end of initialization.
 
 Special commands:
 \\{asm-mode-map}"
-  (interactive)
-  (kill-all-local-variables)
-  (setq mode-name "Assembler")
-  (setq major-mode 'asm-mode)
   (setq local-abbrev-table asm-mode-abbrev-table)
-  (make-local-variable 'font-lock-defaults)
-  (setq font-lock-defaults '(asm-font-lock-keywords))
+  (set (make-local-variable 'font-lock-defaults) '(asm-font-lock-keywords))
   (set (make-local-variable 'indent-line-function) 'asm-indent-line)
   ;; Stay closer to the old TAB behavior (was tab-to-tab-stop).
   (set (make-local-variable 'tab-always-indent) nil)
@@ -157,8 +152,7 @@ Special commands:
   (setq comment-end-skip "[ \t]*\\(\\s>\\|\\*+/\\)")
   (make-local-variable 'comment-end)
   (setq comment-end "")
-  (setq fill-prefix "\t")
-  (run-mode-hooks 'asm-mode-hook))
+  (setq fill-prefix "\t"))
 
 (defun asm-indent-line ()
   "Auto-indent the current line."
index d0cc5541b8af1464925bad746c6866483bc01b0e..4897581252fe1ae457e5d9fa1b10881ac062e45f 100644 (file)
 (defvar bug-reference-url-format nil
   "Format used to turn a bug number into a URL.
 The bug number is supplied as a string, so this should have a single %s.
-There is no default setting for this, it must be set per file.")
+This can also be a function designator; it is called without arguments
+ and should return a string.
+It can use `match-string' to get parts matched against
+`bug-reference-bug-regexp', specifically:
+ 1. issue kind (bug, patch, rfe &c)
+ 2. issue number.
+
+There is no default setting for this, it must be set per file.
+If you set it to a symbol in the file Local Variables section,
+you need to add a `bug-reference-url-format' property to it:
+\(put 'my-bug-reference-url-format 'bug-reference-url-format t)
+so that it is considered safe, see `enable-local-variables'.")
 
 ;;;###autoload
-(put 'bug-reference-url-format 'safe-local-variable 'stringp)
+(put 'bug-reference-url-format 'safe-local-variable
+     (lambda (s)
+       (or (stringp s)
+           (and (symbolp s)
+                (get s 'bug-reference-url-format)))))
 
 (defconst bug-reference-bug-regexp
-  "\\(?:[Bb]ug ?#\\|PR [a-z-+]+/\\)\\([0-9]+\\)"
+  "\\([Bb]ug ?#\\|[Pp]atch ?#\\|RFE ?#\\|PR [a-z-+]+/\\)\\([0-9]+\\)"
   "Regular expression which matches bug references.")
 
 (defun bug-reference-set-overlay-properties ()
@@ -87,9 +102,11 @@ There is no default setting for this, it must be set per file.")
            (overlay-put overlay 'category 'bug-reference)
            ;; Don't put a link if format is undefined
            (when bug-reference-url-format
-             (overlay-put overlay 'bug-reference-url
-                          (format bug-reference-url-format
-                                  (match-string-no-properties 1))))))))))
+              (overlay-put overlay 'bug-reference-url
+                           (if (stringp bug-reference-url-format)
+                               (format bug-reference-url-format
+                                       (match-string-no-properties 2))
+                             (funcall bug-reference-url-format))))))))))
 
 ;; Taken from button.el.
 (defun bug-reference-push-button (&optional pos use-mouse-action)
index e52a0d70e488aa46147030997eb80b3d10069dd0..8224db79aceb4e6ee886164139c7f9fa20710b5d 100644 (file)
@@ -12,8 +12,8 @@
 ;;             1985 Richard M. Stallman
 ;; Maintainer: bug-cc-mode@gnu.org
 ;; Created:    22-Apr-1997 (split from cc-mode.el)
-;; Version:    See cc-mode.el
-;; Keywords:   c languages oop
+;; Keywords:   c languages
+;; Package:    cc-mode
 
 ;; This file is part of GNU Emacs.
 
index 25dc27a08ea831917bb6819ed86f0d417f4a6800..6c7db25612de13d6e061b776575b7c5a42177254 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Alan Mackenzie <acm@muc.de> (originally based on awk-mode.el)
 ;; Maintainer: FSF
 ;; Keywords: AWK, cc-mode, unix, languages
+;; Package: cc-mode
 
 ;; This file is part of GNU Emacs.
 
 
 ;; REGEXPS USED FOR FINDING THE POSITION OF A "virtual semicolon"
 (defconst c-awk-_-harmless-nonws-char-re "[^#/\"\\\\\n\r \t]")
-;;;; NEW VERSION!  (which will be restricted to the current line)
+;; NEW VERSION!  (which will be restricted to the current line)
 (defconst c-awk-one-line-non-syn-ws*-re
   (concat "\\([ \t]*"
               "\\(" c-awk-_-harmless-nonws-char-re "\\|"
         (insert-char ?\n 1) ; ...artificial eol is needed for comment detection.
         (setq extra-nl t))
       (prog1 (c-awk-get-NL-prop-prev-line do-lim)
-        (if extra-nl (delete-backward-char 1))))))
+        (if extra-nl (delete-char -1))))))
 
 (defsubst c-awk-prev-line-incomplete-p (&optional do-lim)
   ;; Is there an incomplete statement at the end of the previous line?
   ;; This function might do hidden buffer changes.
   (memq (c-awk-get-NL-prop-cur-line do-lim) '(?\\ ?\{)))
 
-;;;; NOTES ON "VIRTUAL SEMICOLONS"
-;;;;
-;;;; A "virtual semicolon" is what terminates a statement when there is no ;
-;;;; or } to do the job.  Like point, it is considered to lie _between_ two
-;;;; characters.  As from mid-March 2004, it is considered to lie just after
-;;;; the last non-syntactic-whitespace character on the line; (previously, it
-;;;; was considered an attribute of the EOL on the line).  A real semicolon
-;;;; never counts as a virtual one.
+;; NOTES ON "VIRTUAL SEMICOLONS"
+;;
+;; A "virtual semicolon" is what terminates a statement when there is no ;
+;; or } to do the job.  Like point, it is considered to lie _between_ two
+;; characters.  As from mid-March 2004, it is considered to lie just after
+;; the last non-syntactic-whitespace character on the line; (previously, it
+;; was considered an attribute of the EOL on the line).  A real semicolon
+;; never counts as a virtual one.
 
 (defun c-awk-at-vsemi-p (&optional pos)
   ;; Is there a virtual semicolon at POS (or POINT)?
index cde38d872b0d98a09f74b37bbdd6a701afd38fbf..597267d4e5db2c79e90cd327a1bcb9817b56e4f9 100644 (file)
@@ -6,8 +6,8 @@
 ;; Author:     Martin Stjernholm
 ;; Maintainer: bug-cc-mode@gnu.org
 ;; Created:    15-Jul-2000
-;; Version:    See cc-mode.el
-;; Keywords:   c languages oop
+;; Keywords:   c languages
+;; Package:    cc-mode
 
 ;; This file is part of GNU Emacs.
 
index 4eade6edf585bb8d45326efea0353cf8a21668be..b17703b03052df1b50018b864c13d9c2bb8b5454 100644 (file)
@@ -12,8 +12,8 @@
 ;;             1985 Richard M. Stallman
 ;; Maintainer: bug-cc-mode@gnu.org
 ;; Created:    22-Apr-1997 (split from cc-mode.el)
-;; Version:    See cc-mode.el
-;; Keywords:   c languages oop
+;; Keywords:   c languages
+;; Package:    cc-mode
 
 ;; This file is part of GNU Emacs.
 
@@ -1086,104 +1086,76 @@ numeric argument is supplied, or the point is inside a literal."
 
   (interactive "*P")
   (let ((c-echo-syntactic-information-p nil)
-       final-pos close-paren-inserted)
+       final-pos close-paren-inserted found-delim)
 
     (self-insert-command (prefix-numeric-value arg))
     (setq final-pos (point))
 
-    (c-save-buffer-state (c-parse-and-markup-<>-arglists
-                         c-restricted-<>-arglists
-                         <-pos)
+;;;; 2010-01-31: There used to be code here to put a syntax-table text
+;;;; property on the new < or > and its mate (if any) when they are template
+;;;; parens.  This is now done in an after-change function.
 
-      (when c-recognize-<>-arglists
-       (if (eq last-command-event ?<)
-           (when (and (progn
-                        (backward-char)
-                        (= (point)
-                           (progn
-                             (c-beginning-of-current-token)
-                             (point))))
+    ;; Indent the line if appropriate.
+    (when (and c-electric-flag c-syntactic-indentation c-recognize-<>-arglists)
+      (setq found-delim
+           (if (eq last-command-event ?<)
+               ;; If a <, basically see if it's got "template" before it .....
+               (or (and (progn
+                          (backward-char)
+                          (= (point)
+                             (progn (c-beginning-of-current-token) (point))))
+                        (progn
+                          (c-backward-token-2)
+                          (looking-at c-opt-<>-sexp-key)))
+                   ;; ..... or is a C++ << operator.
+                   (and (c-major-mode-is 'c++-mode)
+                        (progn
+                          (goto-char (1- final-pos))
+                          (c-beginning-of-current-token)
+                          (looking-at "<<"))
+                        (>= (match-end 0) final-pos)))
+
+             ;; It's a >.  Either a C++ >> operator. ......
+             (or (and (c-major-mode-is 'c++-mode)
                       (progn
-                        (c-backward-token-2)
-                        (looking-at c-opt-<>-sexp-key)))
-             (c-mark-<-as-paren (1- final-pos)))
-
-         ;; It's a ">".  Check if there's an earlier "<" which either has
-         ;; open paren syntax already or that can be recognized as an arglist
-         ;; together with this ">".  Note that this won't work in cases like
-         ;; "template <x, a < b, y>" but they ought to be rare.
-
-         (save-restriction
-           ;; Narrow to avoid that `c-forward-<>-arglist' below searches past
-           ;; our position.
-           (narrow-to-region (point-min) final-pos)
-
-           (while (and
-                   (progn
-                     (goto-char final-pos)
-                     (c-syntactic-skip-backward "^<;}" nil t)
-                     (eq (char-before) ?<))
-                   (progn
-                     (backward-char)
-                     ;; If the "<" already got open paren syntax we know we
-                     ;; have the matching closer.  Handle it and exit the
-                     ;; loop.
-                     (if (looking-at "\\s\(")
-                         (progn
-                           (c-mark->-as-paren (1- final-pos))
-                           (setq close-paren-inserted t)
-                           nil)
-                       t))
+                        (goto-char (1- final-pos))
+                        (c-beginning-of-current-token)
+                        (looking-at ">>"))
+                      (>= (match-end 0) final-pos))
+                 ;; ...., or search back for a < which isn't already marked as an
+                 ;; opening template delimiter.
+                 (save-restriction
+                   (widen)
+                   ;; Narrow to avoid `c-forward-<>-arglist' below searching past
+                   ;; our position.
+                   (narrow-to-region (point-min) final-pos)
+                   (goto-char final-pos)
+                   (while
+                       (and
+                        (progn
+                          (c-syntactic-skip-backward "^<;}" nil t)
+                          (eq (char-before) ?<))
+                        (progn
+                          (backward-char)
+                          (looking-at "\\s\("))))
+                   (and (eq (char-after) ?<)
+                        (not (looking-at "\\s\("))
+                        (progn (c-backward-syntactic-ws)
+                               (c-simple-skip-symbol-backward))
+                        (or (looking-at c-opt-<>-sexp-key)
+                            (not (looking-at c-keywords-regexp)))))))))
 
-                   (progn
-                     (setq <-pos (point))
-                     (c-backward-syntactic-ws)
-                     (c-simple-skip-symbol-backward))
-                   (or (looking-at c-opt-<>-sexp-key)
-                       (not (looking-at c-keywords-regexp)))
-
-                   (let ((c-parse-and-markup-<>-arglists t)
-                         c-restricted-<>-arglists
-                         (containing-sexp
-                          (c-most-enclosing-brace (c-parse-state))))
-                     (when (and containing-sexp
-                                (progn (goto-char containing-sexp)
-                                       (eq (char-after) ?\())
-                                (not (eq (get-text-property (point) 'c-type)
-                                         'c-decl-arg-start)))
-                       (setq c-restricted-<>-arglists t))
-                     (goto-char <-pos)
-                     (c-forward-<>-arglist nil))
-
-                   ;; Loop here if the "<" we found above belongs to a nested
-                   ;; angle bracket sexp.  When we start over we'll find the
-                   ;; previous or surrounding sexp.
-                   (if (< (point) final-pos)
-                       t
-                     (setq close-paren-inserted t)
-                     nil)))))))
     (goto-char final-pos)
-
-    ;; Indent the line if appropriate.
-    (when (and c-electric-flag c-syntactic-indentation)
-      (backward-char)
-      (when (prog1 (or (looking-at "\\s\(\\|\\s\)")
-                      (and (c-major-mode-is 'c++-mode)
-                           (progn
-                             (c-beginning-of-current-token)
-                             (looking-at "<<\\|>>"))
-                           (= (match-end 0) final-pos)))
-             (goto-char final-pos))
-       (indent-according-to-mode)))
-
-    (when (and close-paren-inserted
-              (not executing-kbd-macro)
-              blink-paren-function)
-      ;; Note: Most paren blink functions, such as the standard
-      ;; `blink-matching-open', currently doesn't handle paren chars
-      ;; marked with text properties very well.  Maybe we should avoid
-      ;; this call for the time being?
-      (funcall blink-paren-function))))
+    (when found-delim
+      (indent-according-to-mode)
+      (when (and (eq (char-before) ?>)
+                (not executing-kbd-macro)
+                blink-paren-function)
+           ;; Note: Most paren blink functions, such as the standard
+           ;; `blink-matching-open', currently doesn't handle paren chars
+           ;; marked with text properties very well.  Maybe we should avoid
+           ;; this call for the time being?
+           (funcall blink-paren-function)))))
 
 (defun c-electric-paren (arg)
   "Insert a parenthesis.
@@ -1529,6 +1501,11 @@ defun."
   (interactive "p")
   (or arg (setq arg 1))
 
+  (or (not (eq this-command 'c-beginning-of-defun))
+      (eq last-command 'c-beginning-of-defun)
+      (and transient-mark-mode mark-active)
+      (push-mark))
+
   (c-save-buffer-state
       (beginning-of-defun-function end-of-defun-function
        (start (point))
@@ -1632,6 +1609,11 @@ the open-parenthesis that starts a defun; see `beginning-of-defun'."
   (interactive "p")
   (or arg (setq arg 1))
 
+  (or (not (eq this-command 'c-end-of-defun))
+      (eq last-command 'c-end-of-defun)
+      (and transient-mark-mode mark-active)
+      (push-mark))
+
   (c-save-buffer-state
       (beginning-of-defun-function end-of-defun-function
        (start (point))
@@ -3992,16 +3974,17 @@ command to conveniently insert and align the necessary backslashes."
                    ;; "Invalid search bound (wrong side of point)"
                    ;; error in the subsequent re-search.  Maybe
                    ;; another fix would be needed (2007-12-08).
-                   (and (> (- (cdr c-lit-limits) 2) (point))
+                   (or (<= (- (cdr c-lit-limits) 2) (point))
+                       (and 
                         (search-forward-regexp
                          (concat "\\=[ \t]*\\(" c-current-comment-prefix "\\)")
                          (- (cdr c-lit-limits) 2) t)
                         (not (search-forward-regexp
                               "\\(\\s \\|\\sw\\)"
                               (- (cdr c-lit-limits) 2) 'limit))
-                            ;; The comment ender IS on its own line.  Exclude
-                            ;; this line from the filling.
-                        (set-marker end (c-point 'bol))))
+                        ;; The comment ender IS on its own line.  Exclude
+                        ;; this line from the filling.
+                        (set-marker end (c-point 'bol)))))
 
                ;; The comment ender is hanging.  Replace all space between it
                ;; and the last word either by one or two 'x's (when
@@ -4018,6 +4001,14 @@ command to conveniently insert and align the necessary backslashes."
                                       (goto-char ender-start)
                                       (current-column)))
                       (point-rel (- ender-start here))
+                      (sentence-ends-comment
+                       (save-excursion
+                         (goto-char ender-start)
+                         (and (search-backward-regexp
+                               (c-sentence-end) (c-point 'bol) t)
+                              (goto-char (match-end 0))
+                         (looking-at "[ \t]*")
+                         (= (match-end 0) ender-start))))
                       spaces)
 
                  (save-excursion
@@ -4060,7 +4051,9 @@ command to conveniently insert and align the necessary backslashes."
                              (setq spaces
                                    (max
                                     (min spaces
-                                         (if sentence-end-double-space 2 1))
+                                         (if (and sentence-ends-comment
+                                                  sentence-end-double-space)
+                                             2 1))
                                     1)))
                          ;; Insert the filler first to keep marks right.
                          (insert-char ?x spaces t)
@@ -4270,8 +4263,11 @@ Optional prefix ARG means justify paragraph as well."
   (let ((fill-paragraph-function
         ;; Avoid infinite recursion.
         (if (not (eq fill-paragraph-function 'c-fill-paragraph))
-            fill-paragraph-function)))
-    (c-mask-paragraph t nil 'fill-paragraph arg))
+            fill-paragraph-function))
+       (start-point (point-marker)))
+    (c-mask-paragraph
+     t nil (lambda () (fill-region-as-paragraph (point-min) (point-max) arg)))
+    (goto-char start-point))
   ;; Always return t.  This has the effect that if filling isn't done
   ;; above, it isn't done at all, and it's therefore effectively
   ;; disabled in normal code.
index 59a336f3c692b0a2d89745bae67e82fe10bda5d8..adfac2f5f9e569897734eeb8c728baac7a8f5f88 100644 (file)
@@ -8,8 +8,8 @@
 ;;            1994-1999 Barry A. Warsaw
 ;; Maintainer: bug-cc-mode@gnu.org
 ;; Created:    August 1994, split from cc-mode.el
-;; Version:    See cc-mode.el
-;; Keywords:   c languages oop
+;; Keywords:   c languages
+;; Package:    cc-mode
 
 ;; This file is part of GNU Emacs.
 
index 39036b743c68bdbd064e14047f8a056d81d9737c..147a0e2dc2a621b04d08439fc7be799e91cfbd63 100644 (file)
@@ -12,8 +12,8 @@
 ;;             1985 Richard M. Stallman
 ;; Maintainer: bug-cc-mode@gnu.org
 ;; Created:    22-Apr-1997 (split from cc-mode.el)
-;; Version:    See cc-mode.el
-;; Keywords:   c languages oop
+;; Keywords:   c languages
+;; Package:    cc-mode
 
 ;; This file is part of GNU Emacs.
 
@@ -1029,6 +1029,44 @@ MODE is either a mode symbol or a list of mode symbols."
     ;; Emacs.
     `(remove-text-properties ,from ,to '(,property nil))))
 
+(defmacro c-search-forward-char-property (property value &optional limit)
+  "Search forward for a text-property PROPERTY having value VALUE.
+LIMIT bounds the search.  The comparison is done with `equal'.
+
+Leave point just after the character, and set the match data on
+this character, and return point.  If VALUE isn't found, Return
+nil; point is then left undefined."
+  `(let ((place (point)))
+     (while
+        (and
+         (< place ,(or limit '(point-max)))
+         (not (equal (get-text-property place ,property) ,value)))
+       (setq place (next-single-property-change
+                   place ,property nil ,(or limit '(point-max)))))
+     (when (< place ,(or limit '(point-max)))
+       (goto-char place)
+       (search-forward-regexp ".")     ; to set the match-data.
+       (point))))
+
+(defmacro c-search-backward-char-property (property value &optional limit)
+  "Search backward for a text-property PROPERTY having value VALUE.
+LIMIT bounds the search.  The comparison is done with `equal'.
+
+Leave point just before the character, set the match data on this
+character, and return point.  If VALUE isn't found, Return nil;
+point is then left undefined."
+  `(let ((place (point)))
+     (while
+        (and
+         (> place ,(or limit '(point-min)))
+         (not (equal (get-text-property (1- place) ,property) ,value)))
+       (setq place (previous-single-property-change
+                   place ,property nil ,(or limit '(point-min)))))
+     (when (> place ,(or limit '(point-max)))
+       (goto-char place)
+       (search-backward-regexp ".")    ; to set the match-data.
+       (point))))
+
 (defun c-clear-char-property-with-value-function (from to property value)
   "Remove all text-properties PROPERTY from the region (FROM, TO)
 which have the value VALUE, as tested by `equal'.  These
@@ -1044,7 +1082,7 @@ been put there by c-put-char-property.  POINT remains unchanged."
            (setq place (next-single-property-change place property nil to)))
          (< place to))
       (setq end-place (next-single-property-change place property nil to))
-      (put-text-property place end-place property nil)
+      (remove-text-properties place end-place (cons property nil))
       ;; Do we have to do anything with stickiness here?
       (setq place end-place))))
 
@@ -1145,23 +1183,117 @@ been put there by c-put-char-property.  POINT remains unchanged."
        (goto-char (point-max)))))
 
 (defconst c-<-as-paren-syntax '(4 . ?>))
+(put 'c-<-as-paren-syntax 'syntax-table c-<-as-paren-syntax)
 
 (defsubst c-mark-<-as-paren (pos)
-  ;; Mark the "<" character at POS as an sexp list opener using the
-  ;; syntax-table property.
+  ;; Mark the "<" character at POS as a template opener using the
+  ;; `syntax-table' property via the `category' property.
   ;;
-  ;; This function does a hidden buffer change.
-  (c-put-char-property pos 'syntax-table c-<-as-paren-syntax))
+  ;; This function does a hidden buffer change.  Note that we use
+  ;; indirection through the `category' text property.  This allows us to
+  ;; toggle the property in all template brackets simultaneously and
+  ;; cheaply.  We use this, for instance, in `c-parse-state'.
+  (c-put-char-property pos 'category 'c-<-as-paren-syntax))
 
 (defconst c->-as-paren-syntax '(5 . ?<))
+(put 'c->-as-paren-syntax 'syntax-table c->-as-paren-syntax)
 
 (defsubst c-mark->-as-paren (pos)
   ;; Mark the ">" character at POS as an sexp list closer using the
   ;; syntax-table property.
   ;;
-  ;; This function does a hidden buffer change.
-  (c-put-char-property pos 'syntax-table c->-as-paren-syntax))
-
+  ;; This function does a hidden buffer change.  Note that we use
+  ;; indirection through the `category' text property.  This allows us to
+  ;; toggle the property in all template brackets simultaneously and
+  ;; cheaply.  We use this, for instance, in `c-parse-state'.
+  (c-put-char-property pos 'category 'c->-as-paren-syntax))
+
+(defsubst c-unmark-<->-as-paren (pos)
+  ;; Unmark the "<" or "<" character at POS as an sexp list opener using
+  ;; the syntax-table property indirectly through the `category' text
+  ;; property.
+  ;;
+  ;; This function does a hidden buffer change.  Note that we use
+  ;; indirection through the `category' text property.  This allows us to
+  ;; toggle the property in all template brackets simultaneously and
+  ;; cheaply.  We use this, for instance, in `c-parse-state'.
+  (c-clear-char-property pos 'category))
+
+(defsubst c-suppress-<->-as-parens ()
+  ;; Suppress the syntactic effect of all marked < and > as parens.  Note
+  ;; that this effect is NOT buffer local.  You should probably not use
+  ;; this directly, but only through the macro
+  ;; `c-with-<->-as-parens-suppressed'
+  (put 'c-<-as-paren-syntax 'syntax-table nil)
+  (put 'c->-as-paren-syntax 'syntax-table nil))
+
+(defsubst c-restore-<->-as-parens ()
+  ;; Restore the syntactic effect of all marked <s and >s as parens.  This
+  ;; has no effect on unmarked <s and >s
+  (put 'c-<-as-paren-syntax 'syntax-table c-<-as-paren-syntax)
+  (put 'c->-as-paren-syntax 'syntax-table c->-as-paren-syntax))
+
+(defmacro c-with-<->-as-parens-suppressed (&rest forms)
+  ;; Like progn, except that the paren property is suppressed on all
+  ;; template brackets whilst they are running.  This macro does a hidden
+  ;; buffer change.
+  `(unwind-protect
+       (progn
+        (c-suppress-<->-as-parens)
+        ,@forms)
+     (c-restore-<->-as-parens)))
+
+;;;;;;;;;;;;;;;
+
+(defconst c-cpp-delimiter '(14)) ; generic comment syntax
+;; This is the value of the `category' text property placed on every #
+;; which introduces a CPP construct and every EOL (or EOB, or character
+;; preceding //, etc.) which terminates it.  We can instantly "comment
+;; out" all CPP constructs by giving `c-cpp-delimiter' a syntax-table
+;; propery '(14) (generic comment delimiter).
+(defmacro c-set-cpp-delimiters (beg end)
+  ;; This macro does a hidden buffer change.
+  `(progn
+     (c-put-char-property ,beg 'category 'c-cpp-delimiter)
+     (if (< ,end (point-max))
+        (c-put-char-property ,end 'category 'c-cpp-delimiter))))
+(defmacro c-clear-cpp-delimiters (beg end)
+  ;; This macro does a hidden buffer change.
+  `(progn
+     (c-clear-char-property ,beg 'category)
+     (if (< ,end (point-max))
+        (c-clear-char-property ,end 'category))))
+
+(defsubst c-comment-out-cpps ()
+  ;; Render all preprocessor constructs syntactically commented out.
+  (put 'c-cpp-delimiter 'syntax-table c-cpp-delimiter))
+(defsubst c-uncomment-out-cpps ()
+  ;; Restore the syntactic visibility of preprocessor constructs.
+  (put 'c-cpp-delimiter 'syntax-table nil))
+
+(defmacro c-with-cpps-commented-out (&rest forms)
+  ;; Execute FORMS... whilst the syntactic effect of all characters in
+  ;; all CPP regions is suppressed.  In particular, this is to suppress
+  ;; the syntactic significance of parens/braces/brackets to functions
+  ;; such as `scan-lists' and `parse-partial-sexp'.
+  `(unwind-protect
+       (c-save-buffer-state ()
+          (c-comment-out-cpps)
+          ,@forms)
+     (c-save-buffer-state ()
+       (c-uncomment-out-cpps))))
+
+(defmacro c-with-all-but-one-cpps-commented-out (beg end &rest forms)
+  ;; Execute FORMS... whilst the syntactic effect of all characters in
+  ;; every CPP region APART FROM THE ONE BETWEEN BEG and END is
+  ;; suppressed.
+  `(unwind-protect
+       (c-save-buffer-state ()
+        (c-clear-cpp-delimiters ,beg ,end)
+        ,`(c-with-cpps-commented-out ,@forms))
+     (c-save-buffer-state ()
+       (c-set-cpp-delimiters ,beg ,end))))
+\f
 (defsubst c-intersect-lists (list alist)
   ;; return the element of ALIST that matches the first element found
   ;; in LIST.  Uses assq.
index 9c04920a2086e0cfbe2864c9f9de94130142688f..e389007065af4859b9cc70bff6cfb9b3862bce1b 100644 (file)
@@ -1,8 +1,8 @@
 ;;; cc-engine.el --- core syntax guessing engine for CC mode
 
 ;; Copyright (C) 1985, 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-;;   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
-;;   Free Software Foundation, Inc.
+;;   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
+;;   2010  Free Software Foundation, Inc.
 
 ;; Authors:    2001- Alan Mackenzie
 ;;             1998- Martin Stjernholm
@@ -12,8 +12,8 @@
 ;;             1985 Richard M. Stallman
 ;; Maintainer: bug-cc-mode@gnu.org
 ;; Created:    22-Apr-1997 (split from cc-mode.el)
-;; Version:    See cc-mode.el
-;; Keywords:   c languages oop
+;; Keywords:   c languages
+;; Package:    cc-mode
 
 ;; This file is part of GNU Emacs.
 
 ;; Note: This doc is for internal use only.  Other packages should not
 ;; assume that these text properties are used as described here.
 ;;
+;; 'category
+;;   Used for "indirection".  With its help, some other property can
+;;   be cheaply and easily switched on or off everywhere it occurs.
+;;
 ;; 'syntax-table
 ;;   Used to modify the syntax of some characters.  It is used to
 ;;   mark the "<" and ">" of angle bracket parens with paren syntax, and
@@ -256,6 +260,27 @@ comment at the start of cc-engine.el for more info."
             (forward-char)
             t))))
 
+(defun c-syntactic-end-of-macro ()
+  ;; Go to the end of a CPP directive, or a "safe" pos just before.
+  ;;
+  ;; This is normally the end of the next non-escaped line.  A "safe"
+  ;; position is one not within a string or comment.  (The EOL on a line
+  ;; comment is NOT "safe").
+  ;;
+  ;; This function must only be called from the beginning of a CPP construct.
+  ;;
+  ;; Note that this function might do hidden buffer changes.  See the comment
+  ;; at the start of cc-engine.el for more info.
+  (let* ((here (point))
+        (there (progn (c-end-of-macro) (point)))
+        (s (parse-partial-sexp here there)))
+    (while (and (or (nth 3 s)   ; in a string
+                   (nth 4 s))   ; in a comment (maybe at end of line comment)
+               (> there here))  ; No infinite loops, please.
+      (setq there (1- (nth 8 s)))
+      (setq s (parse-partial-sexp here there)))
+    (point)))
+
 (defun c-forward-over-cpp-define-id ()
   ;; Assuming point is at the "#" that introduces a preprocessor
   ;; directive, it's moved forward to the end of the identifier which is
@@ -1947,10 +1972,18 @@ comment at the start of cc-engine.el for more info."
 \f
 ;; A system for finding noteworthy parens before the point.
 
+(defconst c-state-cache-too-far 5000)
+;; A maximum comfortable scanning distance, e.g. between
+;; `c-state-cache-good-pos' and "HERE" (where we call c-parse-state).  When
+;; this distance is exceeded, we take "emergency meausures", e.g. by clearing
+;; the cache and starting again from point-min or a beginning of defun.  This
+;; value can be tuned for efficiency or set to a lower value for testing.
+
 (defvar c-state-cache nil)
 (make-variable-buffer-local 'c-state-cache)
 ;; The state cache used by `c-parse-state' to cut down the amount of
-;; searching.  It's the result from some earlier `c-parse-state' call.
+;; searching.  It's the result from some earlier `c-parse-state' call.  See
+;; `c-parse-state''s doc string for details of its structure.
 ;;
 ;; The use of the cached info is more effective if the next
 ;; `c-parse-state' call is on a line close by the one the cached state
@@ -1959,18 +1992,12 @@ comment at the start of cc-engine.el for more info."
 ;; most effective if `c-parse-state' is used on each line while moving
 ;; forward.
 
-(defvar c-state-cache-start 1)
-(make-variable-buffer-local 'c-state-cache-start)
-;; This is (point-min) when `c-state-cache' was calculated, since a
-;; change of narrowing is likely to affect the parens that are visible
-;; before the point.
-
 (defvar c-state-cache-good-pos 1)
 (make-variable-buffer-local 'c-state-cache-good-pos)
-;; This is a position where `c-state-cache' is known to be correct.
-;; It's a position inside one of the recorded unclosed parens or the
-;; top level, but not further nested inside any literal or subparen
-;; that is closed before the last recorded position.
+;; This is a position where `c-state-cache' is known to be correct, or
+;; nil (see below).  It's a position inside one of the recorded unclosed
+;; parens or the top level, but not further nested inside any literal or
+;; subparen that is closed before the last recorded position.
 ;;
 ;; The exact position is chosen to try to be close to yet earlier than
 ;; the position where `c-state-cache' will be called next.  Right now
@@ -1978,313 +2005,1074 @@ comment at the start of cc-engine.el for more info."
 ;; closing paren (of any type) before the line on which
 ;; `c-parse-state' was called.  That is chosen primarily to work well
 ;; with refontification of the current line.
+;;
+;; 2009-07-28: When `c-state-point-min' and the last position where
+;; `c-parse-state' or for which `c-invalidate-state-cache' was called, are
+;; both in the same literal, there is no such "good position", and
+;; c-state-cache-good-pos is then nil.  This is the ONLY circumstance in which
+;; it can be nil.  In this case, `c-state-point-min-literal' will be non-nil.
+;;
+;; 2009-06-12: In a brace desert, c-state-cache-good-pos may also be in
+;; the middle of the desert, as long as it is not within a brace pair
+;; recorded in `c-state-cache' or a paren/bracket pair.
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; We maintain a simple cache of positions which aren't in a literal, so as to
+;; speed up testing for non-literality.
+(defconst c-state-nonlit-pos-interval 10000)
+;; The approximate interval between entries in `c-state-nonlit-pos-cache'.
+
+(defvar c-state-nonlit-pos-cache nil)
+(make-variable-buffer-local 'c-state-nonlit-pos-cache)
+;; A list of buffer positions which are known not to be in a literal.  This is
+;; ordered with higher positions at the front of the list.  Only those which
+;; are less than `c-state-nonlit-pos-cache-limit' are valid.
+
+(defvar c-state-nonlit-pos-cache-limit 1)
+(make-variable-buffer-local 'c-state-nonlit-pos-cache-limit)
+;; An upper limit on valid entries in `c-state-nonlit-pos-cache'.  This is
+;; reduced by buffer changes, and increased by invocations of
+;; `c-state-literal-at'.
+
+(defsubst c-state-pp-to-literal (from to)
+  ;; Do a parse-partial-sexp from FROM to TO, returning the bounds of any
+  ;; literal at TO as a cons, otherwise NIL.
+  ;; FROM must not be in a literal, and the buffer should already be wide
+  ;; enough.
+  (save-excursion
+    (let ((s (parse-partial-sexp from to)))
+      (when (or (nth 3 s) (nth 4 s))   ; in a string or comment
+       (parse-partial-sexp (point) (point-max)
+                           nil                  ; TARGETDEPTH
+                           nil                  ; STOPBEFORE
+                           s                    ; OLDSTATE
+                           'syntax-table)       ; stop at end of literal
+       (cons (nth 8 s) (point))))))
+
+(defun c-state-literal-at (here)
+  ;; If position HERE is inside a literal, return (START . END), the
+  ;; boundaries of the literal (which may be outside the accessible bit of the
+  ;; buffer).  Otherwise, return nil.
+  ;;
+  ;; This function is almost the same as `c-literal-limits'.  It differs in
+  ;; that it is a lower level function, and that it rigourously follows the
+  ;; syntax from BOB, whereas `c-literal-limits' uses a "local" safe position.
+  (save-restriction
+    (widen)
+    (save-excursion
+      (let ((c c-state-nonlit-pos-cache)
+           pos npos lit)
+       ;; Trim the cache to take account of buffer changes.
+       (while (and c (> (car c) c-state-nonlit-pos-cache-limit))
+         (setq c (cdr c)))
+       (setq c-state-nonlit-pos-cache c)
+
+       (while (and c (> (car c) here))
+         (setq c (cdr c)))
+       (setq pos (or (car c) (point-min)))
+
+       (while (<= (setq npos (+ pos c-state-nonlit-pos-interval))
+                  here)
+         (setq lit (c-state-pp-to-literal pos npos))
+         (setq pos (or (cdr lit) npos)) ; end of literal containing npos.
+         (setq c-state-nonlit-pos-cache (cons pos c-state-nonlit-pos-cache)))
+
+       (if (> pos c-state-nonlit-pos-cache-limit)
+           (setq c-state-nonlit-pos-cache-limit pos))
+       (if (< pos here)
+           (setq lit (c-state-pp-to-literal pos here)))
+       lit))))
+
+(defsubst c-state-lit-beg (pos)
+  ;; Return the start of the literal containing POS, or POS itself.
+  (or (car (c-state-literal-at pos))
+      pos))
+
+(defsubst c-state-cache-non-literal-place (pos state)
+  ;; Return a position outside of a string/comment at or before POS.
+  ;; STATE is the parse-partial-sexp state at POS.
+  (if (or (nth 3 state)                        ; in a string?
+         (nth 4 state))                ; in a comment?
+      (nth 8 state)
+    pos))
 
-(defsubst c-invalidate-state-cache (pos)
-  ;; Invalidate all info on `c-state-cache' that applies to the buffer
-  ;; at POS or higher.  This is much like `c-whack-state-after', but
-  ;; it never changes a paren pair element into an open paren element.
-  ;; Doing that would mean that the new open paren wouldn't have the
-  ;; required preceding paren pair element.
-  (while (and (or c-state-cache
-                 (when (< pos c-state-cache-good-pos)
-                   (setq c-state-cache-good-pos 1)
-                   nil))
-             (let ((elem (car c-state-cache)))
-               (if (consp elem)
-                   (or (< pos (cdr elem))
-                       (when (< pos c-state-cache-good-pos)
-                         (setq c-state-cache-good-pos (cdr elem))
-                         nil))
-                 (or (<= pos elem)
-                     (when (< pos c-state-cache-good-pos)
-                       (setq c-state-cache-good-pos (1+ elem))
-                       nil)))))
-    (setq c-state-cache (cdr c-state-cache))))
-
-(defun c-get-fallback-start-pos (here)
-  ;; Return the start position for building `c-state-cache' from
-  ;; scratch.
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Stuff to do with point-min, and coping with any literal there.
+(defvar c-state-point-min 1)
+(make-variable-buffer-local 'c-state-point-min)
+;; This is (point-min) when `c-state-cache' was last calculated.  A change of
+;; narrowing is likely to affect the parens that are visible before the point.
+
+(defvar c-state-point-min-lit-type nil)
+(make-variable-buffer-local 'c-state-point-min-lit-type)
+(defvar c-state-point-min-lit-start nil)
+(make-variable-buffer-local 'c-state-point-min-lit-start)
+;; These two variables define the literal, if any, containing point-min.
+;; Their values are, respectively, 'string, c, or c++, and the start of the
+;; literal.  If there's no literal there, they're both nil.
+
+(defvar c-state-min-scan-pos 1)
+(make-variable-buffer-local 'c-state-min-scan-pos)
+;; This is the earliest buffer-pos from which scanning can be done.  It is
+;; either the end of the literal containing point-min, or point-min itself.
+;; It becomes nil if the buffer is changed earlier than this point.
+(defun c-state-get-min-scan-pos ()
+  ;; Return the lowest valid scanning pos.  This will be the end of the
+  ;; literal enclosing point-min, or point-min itself.
+  (or c-state-min-scan-pos
+      (save-restriction
+       (save-excursion
+         (widen)
+         (goto-char c-state-point-min-lit-start)
+         (if (eq c-state-point-min-lit-type 'string)
+             (forward-sexp)
+           (forward-comment 1))
+         (setq c-state-min-scan-pos (point))))))
+
+(defun c-state-mark-point-min-literal ()
+  ;; Determine the properties of any literal containing POINT-MIN, setting the
+  ;; variables `c-state-point-min-lit-type', `c-state-point-min-lit-start',
+  ;; and `c-state-min-scan-pos' accordingly.  The return value is meaningless.
+  (let ((p-min (point-min))
+       lit)
+    (save-restriction
+      (widen)
+      (setq lit (c-state-literal-at p-min))
+      (if lit
+         (setq c-state-point-min-lit-type
+               (save-excursion
+                 (goto-char (car lit))
+                 (cond
+                  ((looking-at c-block-comment-start-regexp) 'c)
+                  ((looking-at c-line-comment-starter) 'c++)
+                  (t 'string)))
+               c-state-point-min-lit-start (car lit)
+               c-state-min-scan-pos (cdr lit))
+       (setq c-state-point-min-lit-type nil
+             c-state-point-min-lit-start nil
+             c-state-min-scan-pos p-min)))))
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; A variable which signals a brace dessert - helpful for reducing the number
+;; of fruitless backward scans.
+(defvar c-state-brace-pair-desert nil)
+(make-variable-buffer-local 'c-state-brace-pair-desert)
+;; Used only in `c-append-lower-brace-pair-to-state-cache'.  It is set when an
+;; that defun has searched backwards for a brace pair and not found one.  Its
+;; value is either nil or a cons (PA . FROM), where PA is the position of the
+;; enclosing opening paren/brace/bracket which bounds the backwards search (or
+;; nil when at top level) and FROM is where the backward search started.  It
+;; is reset to nil in `c-invalidate-state-cache'.
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Lowish level functions/macros which work directly on `c-state-cache', or a
+;; list of like structure.
+(defmacro c-state-cache-top-lparen (&optional cache)
+  ;; Return the address of the top left brace/bracket/paren recorded in CACHE
+  ;; (default `c-state-cache') (or nil).
+  (let ((cash (or cache 'c-state-cache)))
+    `(if (consp (car ,cash))
+        (caar ,cash)
+       (car ,cash))))
+
+(defmacro c-state-cache-top-paren (&optional cache)
+  ;; Return the address of the latest brace/bracket/paren (whether left or
+  ;; right) recorded in CACHE (default `c-state-cache') or nil.
+  (let ((cash (or cache 'c-state-cache)))
+    `(if (consp (car ,cash))
+        (cdar ,cash)
+       (car ,cash))))
+
+(defmacro c-state-cache-after-top-paren (&optional cache)
+  ;; Return the position just after the latest brace/bracket/paren (whether
+  ;; left or right) recorded in CACHE (default `c-state-cache') or nil.
+  (let ((cash (or cache 'c-state-cache)))
+    `(if (consp (car ,cash))
+        (cdar ,cash)
+       (and (car ,cash)
+           (1+ (car ,cash))))))
+
+(defun c-get-cache-scan-pos (here)
+  ;; From the state-cache, determine the buffer position from which we might
+  ;; scan forward to HERE to update this cache.  This position will be just
+  ;; after a paren/brace/bracket recorded in the cache, if possible, otherwise
+  ;; return the earliest position in the accessible region which isn't within
+  ;; a literal.  If the visible portion of the buffer is entirely within a
+  ;; literal, return NIL.
+  (let ((c c-state-cache) elt)
+    ;(while (>= (or (c-state-cache-top-lparen c) 1) here)
+    (while (and c
+               (>= (c-state-cache-top-lparen c) here))
+      (setq c (cdr c)))
+
+    (setq elt (car c))
+    (cond
+     ((consp elt)
+      (if (> (cdr elt) here)
+         (1+ (car elt))
+       (cdr elt)))
+     (elt (1+ elt))
+     ((<= (c-state-get-min-scan-pos) here)
+      (c-state-get-min-scan-pos))
+     (t nil))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Variables which keep track of preprocessor constructs.
+(defvar c-state-old-cpp-beg nil)
+(make-variable-buffer-local 'c-state-old-cpp-beg)
+(defvar c-state-old-cpp-end nil)
+(make-variable-buffer-local 'c-state-old-cpp-end)
+;; These are the limits of the macro containing point at the previous call of
+;; `c-parse-state', or nil.
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Defuns which analyse the buffer, yet don't change `c-state-cache'.
+(defun c-get-fallback-scan-pos (here)
+  ;; Return a start position for building `c-state-cache' from
+  ;; scratch.  This will be at the top level, 2 defuns back.
   (save-excursion
     ;; Go back 2 bods, but ignore any bogus positions returned by
     ;; beginning-of-defun (i.e. open paren in column zero).
     (goto-char here)
     (let ((cnt 2))
       (while (not (or (bobp) (zerop cnt)))
-       (c-beginning-of-defun-1)
+       (c-beginning-of-defun-1)        ; Pure elisp BOD.
        (if (eq (char-after) ?\{)
            (setq cnt (1- cnt)))))
     (point)))
 
-(defun c-parse-state ()
-  ;; Find and record all noteworthy parens between some good point
-  ;; earlier in the file and point.  That good point is at least the
-  ;; beginning of the top-level construct we are in, or the beginning
-  ;; of the preceding top-level construct if we aren't in one.
-  ;;
-  ;; The returned value is a list of the noteworthy parens with the
-  ;; last one first.  If an element in the list is an integer, it's
-  ;; the position of an open paren which has not been closed before
-  ;; the point.  If an element is a cons, it gives the position of a
-  ;; closed brace paren pair; the car is the start paren position and
-  ;; the cdr is the position following the closing paren.  Only the
-  ;; last closed brace paren pair before each open paren and before
-  ;; the point is recorded, and thus the state never contains two cons
-  ;; elements in succession.
+(defun c-state-balance-parens-backwards (here- here+ top)
+  ;; Return the position of the opening paren/brace/bracket before HERE- which
+  ;; matches the outermost close p/b/b between HERE+ and TOP.  Except when
+  ;; there's a macro, HERE- and HERE+ are the same.  Like this:
+  ;;
+  ;;     ............................................
+  ;;     |                                          |
+  ;;     (    [ ( .........#macro.. )      ( )  ]  )
+  ;;     ^                 ^     ^                         ^
+  ;;     |                 |     |                         |
+  ;;   return            HERE- HERE+                      TOP
+  ;;
+  ;; If there aren't enough opening paren/brace/brackets, return the position
+  ;; of the outermost one found, or HERE- if there are none.  If there are no
+  ;; closeing p/b/bs between HERE+ and TOP, return HERE-.  HERE-/+ and TOP
+  ;; must not be inside literals.  Only the accessible portion of the buffer
+  ;; will be scanned.
+
+  ;; PART 1: scan from `here+' up to `top', accumulating ")"s which enclose
+  ;; `here'.  Go round the next loop each time we pass over such a ")".         These
+  ;; probably match "("s before `here-'.
+  (let (pos pa ren+1 lonely-rens)
+    (save-excursion
+      (save-restriction
+       (narrow-to-region (point-min) top) ; This can move point, sometimes.
+       (setq pos here+)
+       (c-safe
+         (while
+             (setq ren+1 (scan-lists pos 1 1)) ; might signal
+           (setq lonely-rens (cons ren+1 lonely-rens)
+                 pos ren+1)))))
+
+      ;; PART 2: Scan back before `here-' searching for the "("s
+      ;; matching/mismatching the ")"s found above. We only need to direct the
+      ;; caller to scan when we've encountered unmatched right parens.
+    (setq pos here-)
+    (when lonely-rens
+      (c-safe
+       (while
+           (and lonely-rens            ; actual values aren't used.
+                (setq pa (scan-lists pos -1 1)))
+         (setq pos pa)
+         (setq lonely-rens (cdr lonely-rens)))))
+    pos))
+
+(defun c-parse-state-get-strategy (here good-pos)
+  ;; Determine the scanning strategy for adjusting `c-parse-state', attempting
+  ;; to minimise the amount of scanning.  HERE is the pertinent position in
+  ;; the buffer, GOOD-POS is a position where `c-state-cache' (possibly with
+  ;; its head trimmed) is known to be good, or nil if there is no such
+  ;; position.
+  ;;
+  ;; The return value is a list, one of the following:
+  ;;
+  ;; o - ('forward CACHE-POS START-POINT) - scan forward from START-POINT,
+  ;;                                        which is not less than CACHE-POS.
+  ;; o - ('backward CACHE-POS nil) - scan backwards (from HERE).
+  ;; o - ('BOD nil START-POINT) - scan forwards from START-POINT, which is at the
+  ;;   top level.
+  ;; o - ('IN-LIT nil nil) - point is inside the literal containing point-min.
+  ;; , where CACHE-POS is the highest position recorded in `c-state-cache' at
+  ;; or below HERE.
+  (let ((cache-pos (c-get-cache-scan-pos here))        ; highest position below HERE in cache (or 1)
+       BOD-pos             ; position of 2nd BOD before HERE.
+       strategy            ; 'forward, 'backward, 'BOD, or 'IN-LIT.
+       start-point
+       how-far)                        ; putative scanning distance.
+    (setq good-pos (or good-pos (c-state-get-min-scan-pos)))
+    (cond
+     ((< here (c-state-get-min-scan-pos))
+      (setq strategy 'IN-LIT
+           start-point nil
+           cache-pos nil
+           how-far 0))
+     ((<= good-pos here)
+      (setq strategy 'forward
+           start-point (max good-pos cache-pos)
+           how-far (- here start-point)))
+     ((< (- good-pos here) (- here cache-pos)) ; FIXME!!! ; apply some sort of weighting.
+      (setq strategy 'backward
+           how-far (- good-pos here)))
+     (t
+      (setq strategy 'forward
+             how-far (- here cache-pos)
+             start-point cache-pos)))
+
+    ;; Might we be better off starting from the top level, two defuns back,
+    ;; instead?
+    (when (> how-far c-state-cache-too-far)
+      (setq BOD-pos (c-get-fallback-scan-pos here)) ; somewhat EXPENSIVE!!!
+      (if (< (- here BOD-pos) how-far)
+         (setq strategy 'BOD
+               start-point BOD-pos)))
+
+    (list
+     strategy
+     (and (memq strategy '(forward backward)) cache-pos)
+     (and (memq strategy '(forward BOD)) start-point))))
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Routines which change `c-state-cache' and associated values.
+(defun c-renarrow-state-cache ()
+  ;; The region (more precisely, point-min) has changed since we
+  ;; calculated `c-state-cache'.  Amend `c-state-cache' accordingly.
+  (if (< (point-min) c-state-point-min)
+      ;; If point-min has MOVED BACKWARDS then we drop the state completely.
+      ;; It would be possible to do a better job here and recalculate the top
+      ;; only.
+      (progn
+       (c-state-mark-point-min-literal)
+       (setq c-state-cache nil
+             c-state-cache-good-pos c-state-min-scan-pos
+             c-state-brace-pair-desert nil))
+
+    ;; point-min has MOVED FORWARD.
+
+    ;; Is the new point-min inside a (different) literal?
+    (unless (and c-state-point-min-lit-start ; at prev. point-min
+                (< (point-min) (c-state-get-min-scan-pos)))
+      (c-state-mark-point-min-literal))
+
+    ;; Cut off a bit of the tail from `c-state-cache'.
+    (let ((ptr (cons nil c-state-cache))
+         pa)
+      (while (and (setq pa (c-state-cache-top-lparen (cdr ptr)))
+                 (>= pa (point-min)))
+       (setq ptr (cdr ptr)))
+
+      (when (consp ptr)
+       (if (eq (cdr ptr) c-state-cache)
+           (setq c-state-cache nil
+                 c-state-cache-good-pos c-state-min-scan-pos)
+         (setcdr ptr nil)
+         (setq c-state-cache-good-pos (1+ (c-state-cache-top-lparen))))
+       )))
+
+  (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.
+  ;;
+  ;; Return non-nil when this has been done.
+  ;;
+  ;; 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.
+  (save-excursion
+    (save-restriction
+      (let ((bra from) ce              ; Positions of "{" and "}".
+           new-cons
+           (cache-pos (c-state-cache-top-lparen)) ; might be nil.
+           (macro-start-or-from
+            (progn (goto-char from)
+                   (c-beginning-of-macro)
+                   (point))))
+       (or upper-lim (setq upper-lim from))
+
+       ;; If we're essentially repeating a fruitless search, just give up.
+       (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
+                  (> from (cdr c-state-brace-pair-desert)))
+             (narrow-to-region (cdr c-state-brace-pair-desert) (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
+         ;; back over a sequence of unmatched close brace/paren/bracket each
+         ;; time round.
+         (while
+             (progn
+               (c-safe
+                 (while
+                     (and (setq ce (scan-lists bra -1 -1)) ; back past )/]/}; might signal
+                          (setq bra (scan-lists ce -1 1)) ; back past (/[/{; might signal
+                          (or (> ce upper-lim)
+                              (not (eq (char-after bra) ?\{))
+                              (and (goto-char bra)
+                                   (c-beginning-of-macro)
+                                   (< (point) macro-start-or-from))))))
+               (and ce (< ce bra)))
+           (setq bra ce))      ; If we just backed over an unbalanced closing
+                                       ; brace, ignore it.
+
+         (if (and ce (< bra ce) (eq (char-after bra) ?\{))
+             ;; We've found the desired brace-pair.
+             (progn
+               (setq new-cons (cons bra (1+ ce)))
+               (cond
+                ((consp (car c-state-cache))
+                 (setcar c-state-cache new-cons))
+                ((and (numberp (car c-state-cache)) ; probably never happens
+                      (< ce (car c-state-cache)))
+                 (setcdr c-state-cache
+                         (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.
+           (setq c-state-brace-pair-desert (cons cache-pos from))))))))
+
+(defsubst c-state-push-any-brace-pair (bra+1 macro-start-or-here)
+  ;; If BRA+1 is nil, do nothing.  Otherwise, BRA+1 is the buffer position
+  ;; following a {, and that brace has a (mis-)matching } (or ]), and we
+  ;; "push" "a" brace pair onto `c-state-cache'.
+  ;;
+  ;; Here "push" means overwrite the top element if it's itself a brace-pair,
+  ;; otherwise push it normally.
+  ;;
+  ;; The brace pair we push is normally the one surrounding BRA+1, but if the
+  ;; latter is inside a macro, not being a macro containing
+  ;; MACRO-START-OR-HERE, we scan backwards through the buffer for a non-macro
+  ;; base pair.  This latter case is assumed to be rare.
+  ;;
+  ;; Note: POINT is not preserved in this routine.
+  (if bra+1
+      (if (or (> bra+1 macro-start-or-here)
+             (progn (goto-char bra+1)
+                    (not (c-beginning-of-macro))))
+         (setq c-state-cache
+               (cons (cons (1- bra+1)
+                           (scan-lists bra+1 1 1))
+                     (if (consp (car c-state-cache))
+                         (cdr c-state-cache)
+                       c-state-cache)))
+       ;; N.B.  This defsubst codes one method for the simple, normal case,
+       ;; and a more sophisticated, slower way for the general case.  Don't
+       ;; eliminate this defsubst - it's a speed optimisation.
+       (c-append-lower-brace-pair-to-state-cache (1- bra+1)))))
+
+(defun c-append-to-state-cache (from)
+  ;; Scan the buffer from FROM to (point-max), adding elements into
+  ;; `c-state-cache' for braces etc.  Return a candidate for
+  ;; `c-state-cache-good-pos'.
+  ;;
+  ;; FROM must be after the latest brace/paren/bracket in `c-state-cache', if
+  ;; any.  Typically, it is immediately after it.  It must not be inside a
+  ;; literal.
+  (let ((here-bol (c-point 'bol (point-max)))
+       (macro-start-or-here
+        (save-excursion (goto-char (point-max))
+                        (if (c-beginning-of-macro)
+                            (point)
+                          (point-max))))
+       pa+1                  ; pos just after an opening PAren (or brace).
+       (ren+1 from)          ; usually a pos just after an closing paREN etc.
+                             ; Is actually the pos. to scan for a (/{/[ from,
+                             ; which sometimes is after a silly )/}/].
+       paren+1               ; Pos after some opening or closing paren.
+       paren+1s              ; A list of `paren+1's; used to determine a
+                             ; good-pos.
+       bra+1 ce+1            ; just after L/R bra-ces.
+       bra+1s                ; list of OLD values of bra+1.
+       mstart)               ; start of a macro.
+
+    (save-excursion
+      ;; Each time round the following loop, we enter a succesively deeper
+      ;; level of brace/paren nesting.  (Except sometimes we "continue at
+      ;; the existing level".)  `pa+1' is a pos inside an opening
+      ;; brace/paren/bracket, usually just after it.
+      (while
+         (progn
+           ;; Each time round the next loop moves forward over an opening then
+           ;; a closing brace/bracket/paren.  This loop is white hot, so it
+           ;; plays ugly tricks to go fast.  DON'T PUT ANYTHING INTO THIS
+           ;; LOOP WHICH ISN'T ABSOLUTELY NECESSARY!!!  It terminates when a
+           ;; call of `scan-lists' signals an error, which happens when there
+           ;; are no more b/b/p's to scan.
+           (c-safe
+             (while t
+               (setq pa+1 (scan-lists ren+1 1 -1) ; Into (/{/[; might signal
+                     paren+1s (cons pa+1 paren+1s))
+               (setq ren+1 (scan-lists pa+1 1 1)) ; Out of )/}/]; might signal
+               (if (and (eq (char-before pa+1) ?{)) ; Check for a macro later.
+                   (setq bra+1 pa+1))
+               (setcar paren+1s ren+1)))
+
+           (if (and pa+1 (> pa+1 ren+1))
+               ;; We've just entered a deeper nesting level.
+               (progn
+                 ;; Insert the brace pair (if present) and the single open
+                 ;; paren/brace/bracket into `c-state-cache' It cannot be
+                 ;; inside a macro, except one around point, because of what
+                 ;; `c-neutralize-syntax-in-CPP' has done.
+                 (c-state-push-any-brace-pair bra+1 macro-start-or-here)
+                 ;; Insert the opening brace/bracket/paren position.
+                 (setq c-state-cache (cons (1- pa+1) c-state-cache))
+                 ;; Clear admin stuff for the next more nested part of the scan.
+                 (setq ren+1 pa+1  pa+1 nil  bra+1 nil  bra+1s nil)
+                 t)                    ; Carry on the loop
+
+             ;; All open p/b/b's at this nesting level, if any, have probably
+             ;; been closed by matching/mismatching ones.  We're probably
+             ;; finished - we just need to check for having found an
+             ;; unmatched )/}/], which we ignore.  Such a )/}/] can't be in a
+             ;; macro, due the action of `c-neutralize-syntax-in-CPP'.
+             (c-safe (setq ren+1 (scan-lists ren+1 1 1)))))) ; acts as loop control.
+
+      ;; Record the final, innermost, brace-pair if there is one.
+      (c-state-push-any-brace-pair bra+1 macro-start-or-here)
+
+      ;; Determine a good pos
+      (while (and (setq paren+1 (car paren+1s))
+                 (> (if (> paren+1 macro-start-or-here)
+                        paren+1
+                      (goto-char paren+1)
+                      (setq mstart (and (c-beginning-of-macro)
+                                        (point)))
+                      (or mstart paren+1))
+                    here-bol))
+       (setq paren+1s (cdr paren+1s)))
+      (cond
+       ((and paren+1 mstart)
+       (min paren+1 mstart))
+       (paren+1)
+       (t from)))))
+
+(defun c-remove-stale-state-cache (good-pos pps-point)
+  ;; Remove stale entries from the `c-cache-state', i.e. those which will
+  ;; not be in it when it is amended for position (point-max).
+  ;; Additionally, the "outermost" open-brace entry before (point-max)
+  ;; will be converted to a cons if the matching close-brace is scanned.
+  ;;
+  ;; GOOD-POS is a "maximal" "safe position" - there must be no open
+  ;; parens/braces/brackets between GOOD-POS and (point-max).
+  ;;
+  ;; As a second thing, calculate the result of parse-partial-sexp at
+  ;; PPS-POINT, w.r.t. GOOD-POS.  The motivation here is that
+  ;; `c-state-cache-good-pos' may become PPS-POINT, but the caller may need to
+  ;; adjust it to get outside a string/comment.  (Sorry about this!  The code
+  ;; needs to be FAST).
+  ;;
+  ;; Return a list (GOOD-POS SCAN-BACK-POS PPS-STATE), where
+  ;; o - GOOD-POS is a position where the new value `c-state-cache' is known
+  ;;   to be good (we aim for this to be as high as possible);
+  ;; o - SCAN-BACK-POS, if not nil, indicates there may be a brace pair
+  ;;   preceding POS which needs to be recorded in `c-state-cache'.  It is a
+  ;;   position to scan backwards from.
+  ;; o - PPS-STATE is the parse-partial-sexp state at PPS-POINT.
+  (save-restriction
+    (narrow-to-region 1 (point-max))
+    (save-excursion
+      (let* ((in-macro-start   ; start of macro containing (point-max) or nil.
+             (save-excursion
+               (goto-char (point-max))
+               (and (c-beginning-of-macro)
+                    (point))))
+            (good-pos-actual-macro-start ; Start of macro containing good-pos
+                                       ; or nil
+             (and (< good-pos (point-max))
+                  (save-excursion
+                    (goto-char good-pos)
+                    (and (c-beginning-of-macro)
+                         (point)))))
+            (good-pos-actual-macro-end ; End of this macro, (maybe
+                                       ; (point-max)), or nil.
+             (and good-pos-actual-macro-start
+                  (save-excursion
+                    (goto-char good-pos-actual-macro-start)
+                    (c-end-of-macro)
+                    (point))))
+            pps-state                  ; Will be 9 or 10 elements long.
+            pos
+            upper-lim     ; ,beyond which `c-state-cache' entries are removed
+            scan-back-pos
+            pair-beg pps-point-state target-depth)
+
+       ;; Remove entries beyond (point-max).  Also remove any entries inside
+       ;; a macro, unless (point-max) is in the same macro.
+       (setq upper-lim
+             (if (or (null c-state-old-cpp-beg)
+                     (and (> (point-max) c-state-old-cpp-beg)
+                          (< (point-max) c-state-old-cpp-end)))
+                 (point-max)
+               (min (point-max) c-state-old-cpp-beg)))
+       (while (and c-state-cache (>= (c-state-cache-top-lparen) upper-lim))
+         (setq c-state-cache (cdr c-state-cache)))
+       ;; If `upper-lim' is inside the last recorded brace pair, remove its
+       ;; RBrace and indicate we'll need to search backwards for a previous
+       ;; brace pair.
+       (when (and c-state-cache
+                  (consp (car c-state-cache))
+                  (> (cdar c-state-cache) upper-lim))
+         (setcar c-state-cache (caar c-state-cache))
+         (setq scan-back-pos (car c-state-cache)))
+
+       ;; The next loop jumps forward out of a nested level of parens each
+       ;; time round; the corresponding elements in `c-state-cache' are
+       ;; removed.  `pos' is just after the brace-pair or the open paren at
+       ;; (car c-state-cache).  There can be no open parens/braces/brackets
+       ;; between `good-pos'/`good-pos-actual-macro-start' and (point-max),
+       ;; due to the interface spec to this function.
+       (setq pos (if (and good-pos-actual-macro-end
+                          (not (eq good-pos-actual-macro-start
+                                   in-macro-start)))
+                     (1+ good-pos-actual-macro-end) ; get outside the macro as
+                                       ; marked by a `category' text property.
+                   good-pos))
+       (goto-char pos)
+       (while (and c-state-cache
+                   (< (point) (point-max)))
+         (cond
+          ((null pps-state)            ; first time through
+           (setq target-depth -1))
+          ((eq (car pps-state) target-depth) ; found closing ),},]
+           (setq target-depth (1- (car pps-state))))
+          ;; Do nothing when we've merely reached pps-point.
+          )
+
+         ;; Scan!
+         (setq pps-state
+               (parse-partial-sexp
+                (point) (if (< (point) pps-point) pps-point (point-max))
+                target-depth
+                nil pps-state))
+
+         (if (= (point) pps-point)
+             (setq pps-point-state pps-state))
+
+         (when (eq (car pps-state) target-depth)
+           (setq pos (point))       ; POS is now just after an R-paren/brace.
+           (cond
+            ((and (consp (car c-state-cache))
+                  (eq (point) (cdar c-state-cache)))
+               ;; We've just moved out of the paren pair containing the brace-pair
+               ;; at (car c-state-cache).  `pair-beg' is where the open paren is,
+               ;; and is potentially where the open brace of a cons in
+               ;; c-state-cache will be.
+             (setq pair-beg (car-safe (cdr c-state-cache))
+                   c-state-cache (cdr-safe (cdr c-state-cache)))) ; remove {}pair + containing Lparen.
+            ((numberp (car c-state-cache))
+             (setq pair-beg (car c-state-cache)
+                   c-state-cache (cdr c-state-cache))) ; remove this
+                                       ; containing Lparen
+            ((numberp (cadr c-state-cache))
+             (setq pair-beg (cadr c-state-cache)
+                   c-state-cache (cddr c-state-cache))) ; Remove a paren pair
+                                       ; together with enclosed brace pair.
+            ;; (t nil)                 ; Ignore an unmated Rparen.
+            )))
+
+       (if (< (point) pps-point)
+           (setq pps-state (parse-partial-sexp (point) pps-point
+                                               nil nil ; TARGETDEPTH, STOPBEFORE
+                                               pps-state)))
+
+       ;; If the last paren pair we moved out of was actually a brace pair,
+       ;; insert it into `c-state-cache'.
+       (when (and pair-beg (eq (char-after pair-beg) ?{))
+         (if (consp (car-safe c-state-cache))
+             (setq c-state-cache (cdr c-state-cache)))
+         (setq c-state-cache (cons (cons pair-beg pos)
+                                   c-state-cache)))
+
+       (list pos scan-back-pos pps-state)))))
+
+(defun c-remove-stale-state-cache-backwards (here cache-pos)
+  ;; Strip stale elements of `c-state-cache' by moving backwards through the
+  ;; buffer, and inform the caller of the scenario detected.
+  ;;
+  ;; HERE is the position we're setting `c-state-cache' for.
+  ;; CACHE-POS is just after the latest recorded position in `c-state-cache'
+  ;;   before HERE, or a position at or near point-min which isn't in a
+  ;;   literal.
+  ;;
+  ;; This function must only be called only when (> `c-state-cache-good-pos'
+  ;; HERE).  Usually the gap between CACHE-POS and HERE is large.  It is thus
+  ;; optimised to eliminate (or minimise) scanning between these two
+  ;; positions.
+  ;;
+  ;; Return a three element list (GOOD-POS SCAN-BACK-POS FWD-FLAG), where:
+  ;; o - GOOD-POS is a "good position", where `c-state-cache' is valid, or
+  ;;   could become so after missing elements are inserted into
+  ;;   `c-state-cache'.  This is JUST AFTER an opening or closing
+  ;;   brace/paren/bracket which is already in `c-state-cache' or just before
+  ;;   one otherwise.  exceptionally (when there's no such b/p/b handy) the BOL
+  ;;   before `here''s line, or the start of the literal containing it.
+  ;; o - SCAN-BACK-POS, if non-nil, indicates there may be a brace pair
+  ;;   preceding POS which isn't recorded in `c-state-cache'.  It is a position
+  ;;   to scan backwards from.
+  ;; o - FWD-FLAG, if non-nil, indicates there may be parens/braces between
+  ;;   POS and HERE which aren't recorded in `c-state-cache'.
+  ;;
+  ;; The comments in this defun use "paren" to mean parenthesis or square
+  ;; bracket (as contrasted with a brace), and "(" and ")" likewise.
+  ;;
+  ;;    .   {..} (..) (..)  ( .. {   }  ) (...)    ( ....          .  ..)
+  ;;    |                   |       |   |     |                    |
+  ;;    CP                  E      here D     C                   good
+  (let ((pos c-state-cache-good-pos)
+       pa ren         ; positions of "(" and ")"
+       dropped-cons ; whether the last element dropped from `c-state-cache'
+                    ; was a cons (representing a brace-pair)
+       good-pos                        ; see above.
+       lit         ; (START . END) of a literal containing some point.
+       here-lit-start here-lit-end     ; bounds of literal containing `here'
+                                       ; or `here' itself.
+       here- here+                  ; start/end of macro around HERE, or HERE
+       (here-bol (c-point 'bol here))
+       (too-far-back (max (- here c-state-cache-too-far) 1)))
+
+    ;; Remove completely irrelevant entries from `c-state-cache'.
+    (while (and c-state-cache
+               (>= (setq pa (c-state-cache-top-lparen)) here))
+      (setq dropped-cons (consp (car c-state-cache)))
+      (setq c-state-cache (cdr c-state-cache))
+      (setq pos pa))
+    ;; At this stage, (> pos here);
+    ;; (< (c-state-cache-top-lparen) here)  (or is nil).
+
+    (cond
+     ((and (consp (car c-state-cache))
+          (> (cdar c-state-cache) here))
+      ;; CASE 1: The top of the cache is a brace pair which now encloses
+      ;; `here'.  As good-pos, return the address. of the "{".  Since we've no
+      ;; knowledge of what's inside these braces, we have no alternative but
+      ;; to direct the caller to scan the buffer from the opening brace.
+      (setq pos (caar c-state-cache))
+      (setcar c-state-cache pos)
+      (list (1+ pos) pos t)) ; return value.  We've just converted a brace pair
+                            ; entry into a { entry, so the caller needs to
+                            ; search for a brace pair before the {.
+
+     ;; `here' might be inside a literal.  Check for this.
+     ((progn
+       (setq lit (c-state-literal-at here)
+             here-lit-start (or (car lit) here)
+             here-lit-end (or (cdr lit) here))
+       ;; Has `here' just "newly entered" a macro?
+       (save-excursion
+         (goto-char here-lit-start)
+         (if (and (c-beginning-of-macro)
+                  (or (null c-state-old-cpp-beg)
+                      (not (= (point) c-state-old-cpp-beg))))
+             (progn
+               (setq here- (point))
+               (c-end-of-macro)
+               (setq here+ (point)))
+           (setq here- here-lit-start
+                 here+ here-lit-end)))
+
+       ;; `here' might be nested inside any depth of parens (or brackets but
+       ;; not braces).  Scan backwards to find the outermost such opening
+       ;; paren, if there is one.  This will be the scan position to return.
+       (save-restriction
+         (narrow-to-region cache-pos (point-max))
+         (setq pos (c-state-balance-parens-backwards here- here+ pos)))
+       nil))                           ; for the cond
+
+     ((< pos here-lit-start)
+      ;; CASE 2: Address of outermost ( or [ which now encloses `here', but
+      ;; didn't enclose the (previous) `c-state-cache-good-pos'.  If there is
+      ;; a brace pair preceding this, it will already be in `c-state-cache',
+      ;; unless there was a brace pair after it, i.e. there'll only be one to
+      ;; scan for if we've just deleted one.
+      (list pos (and dropped-cons pos) t)) ; Return value.
+
+      ;; `here' isn't enclosed in a (previously unrecorded) bracket/paren.
+      ;; Further forward scanning isn't needed, but we still need to find a
+      ;; GOOD-POS.  Step out of all enclosing "("s on HERE's line.
+     ((progn
+       (save-restriction
+         (narrow-to-region here-bol (point-max))
+         (setq pos here-lit-start)
+         (c-safe (while (setq pa (scan-lists pos -1 1))
+                   (setq pos pa))))    ; might signal
+       nil))                           ; for the cond
+
+     ((setq ren (c-safe-scan-lists pos -1 -1 too-far-back))
+       ;; CASE 3: After a }/)/] before `here''s BOL.
+      (list (1+ ren) (and dropped-cons pos) nil)) ; Return value
+
+     (t
+      ;; CASE 4; Best of a bad job: BOL before `here-bol', or beginning of
+      ;; literal containing it.
+      (setq good-pos (c-state-lit-beg (c-point 'bopl here-bol)))
+      (list good-pos (and dropped-cons good-pos) nil)))))
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Externally visible routines.
+
+(defun c-state-cache-init ()
+  (setq c-state-cache nil
+       c-state-cache-good-pos 1
+       c-state-nonlit-pos-cache nil
+       c-state-nonlit-pos-cache-limit 1
+       c-state-brace-pair-desert nil
+       c-state-point-min 1
+       c-state-point-min-lit-type nil
+       c-state-point-min-lit-start nil
+       c-state-min-scan-pos 1
+       c-state-old-cpp-beg nil
+       c-state-old-cpp-end nil)
+  (c-state-mark-point-min-literal))
+
+(defun c-invalidate-state-cache-1 (here)
+  ;; Invalidate all info on `c-state-cache' that applies to the buffer at HERE
+  ;; or higher and set `c-state-cache-good-pos' accordingly.  The cache is
+  ;; left in a consistent state.
+  ;;
+  ;; This is much like `c-whack-state-after', but it never changes a paren
+  ;; pair element into an open paren element.  Doing that would mean that the
+  ;; new open paren wouldn't have the required preceding paren pair element.
+  ;;
+  ;; This function is called from c-after-change.
+
+  ;; The cache of non-literals:
+  (if (< here c-state-nonlit-pos-cache-limit)
+      (setq c-state-nonlit-pos-cache-limit here))
+
+  ;; `c-state-cache':
+  ;; Case 1: if `here' is in a literal containing point-min, everything
+  ;; becomes (or is already) nil.
+  (if (or (null c-state-cache-good-pos)
+         (< here (c-state-get-min-scan-pos)))
+      (setq c-state-cache nil
+           c-state-cache-good-pos nil
+           c-state-min-scan-pos nil)
+
+;;; Truncate `c-state-cache' and set `c-state-cache-good-pos' to a value below
+;;; `here'.  To maintain its consistency, we may need to insert a new brace
+;;; pair.
+    (let ((here-bol (c-point 'bol here))
+         too-high-pa             ; recorded {/(/[ next above here, or nil.
+         dropped-cons            ; was the last removed element a brace pair?
+         pa)
+      ;; The easy bit - knock over-the-top bits off `c-state-cache'.
+      (while (and c-state-cache
+                 (>= (setq pa (c-state-cache-top-paren)) here))
+       (setq dropped-cons (consp (car c-state-cache))
+             too-high-pa (c-state-cache-top-lparen)
+             c-state-cache (cdr c-state-cache)))
+
+      ;; Do we need to add in an earlier brace pair, having lopped one off?
+      (if (and dropped-cons
+              (< too-high-pa (+ here c-state-cache-too-far)))
+         (c-append-lower-brace-pair-to-state-cache too-high-pa here-bol))
+      (setq c-state-cache-good-pos (or (c-state-cache-after-top-paren)
+                                      (c-state-get-min-scan-pos)))))
+
+  ;; The brace-pair desert marker:
+  (when (car c-state-brace-pair-desert)
+    (if (< here (car c-state-brace-pair-desert))
+       (setq c-state-brace-pair-desert nil)
+      (if (< here (cdr c-state-brace-pair-desert))
+         (setcdr c-state-brace-pair-desert here)))))
+
+(defun c-parse-state-1 ()
+  ;; Find and record all noteworthy parens between some good point earlier in
+  ;; the file and point.  That good point is at least the beginning of the
+  ;; top-level construct we are in, or the beginning of the preceding
+  ;; top-level construct if we aren't in one.
+  ;;
+  ;; The returned value is a list of the noteworthy parens with the last one
+  ;; first.  If an element in the list is an integer, it's the position of an
+  ;; open paren (of any type) which has not been closed before the point.  If
+  ;; an element is a cons, it gives the position of a closed BRACE paren
+  ;; pair[*]; the car is the start brace position and the cdr is the position
+  ;; following the closing brace.  Only the last closed brace paren pair
+  ;; before each open paren and before the point is recorded, and thus the
+  ;; state never contains two cons elements in succession.  When a close brace
+  ;; has no matching open brace (e.g., the matching brace is outside the
+  ;; visible region), it is not represented in the returned value.
+  ;;
+  ;; [*] N.B. The close "brace" might be a mismatching close bracket or paren.
+  ;; This defun explicitly treats mismatching parens/braces/brackets as
+  ;; matching.  It is the open brace which makes it a "brace" pair.
+  ;;
+  ;; If POINT is within a macro, open parens and brace pairs within
+  ;; THIS macro MIGHT be recorded.  This depends on whether their
+  ;; syntactic properties have been suppressed by
+  ;; `c-neutralize-syntax-in-CPP'.  This might need fixing (2008-12-11).
   ;;
   ;; Currently no characters which are given paren syntax with the
   ;; syntax-table property are recorded, i.e. angle bracket arglist
   ;; parens are never present here.  Note that this might change.
   ;;
   ;; BUG: This function doesn't cope entirely well with unbalanced
-  ;; parens in macros.  E.g. in the following case the brace before
-  ;; the macro isn't balanced with the one after it:
+  ;; parens in macros.  (2008-12-11: this has probably been resolved
+  ;; by the function `c-neutralize-syntax-in-CPP'.)  E.g. in the
+  ;; following case the brace before the macro isn't balanced with the
+  ;; one after it:
   ;;
   ;;     {
   ;;     #define X {
   ;;     }
   ;;
+  ;; Note to maintainers: this function DOES get called with point
+  ;; within comments and strings, so don't assume it doesn't!
+  ;;
   ;; This function might do hidden buffer changes.
+  (let* ((here (point))
+        (here-bopl (c-point 'bopl))
+        strategy            ; 'forward, 'backward etc..
+        ;; Candidate positions to start scanning from:
+        cache-pos           ; highest position below HERE already existing in
+                            ; cache (or 1).
+        good-pos
+        start-point
+        bopl-state
+        res
+        scan-backward-pos scan-forward-p) ; used for 'backward.
+    ;; If POINT-MIN has changed, adjust the cache
+    (unless (= (point-min) c-state-point-min)
+      (c-renarrow-state-cache))
+
+    ;; Strategy?
+    (setq res (c-parse-state-get-strategy here c-state-cache-good-pos)
+         strategy (car res)
+         cache-pos (cadr res)
+         start-point (nth 2 res))
+
+    (when (eq strategy 'BOD)
+      (setq c-state-cache nil
+           c-state-cache-good-pos start-point))
+
+    ;; SCAN!
+    (save-restriction
+      (cond
+       ((memq strategy '(forward BOD))
+       (narrow-to-region (point-min) here)
+       (setq res (c-remove-stale-state-cache start-point here-bopl))
+       (setq cache-pos (car res)
+             scan-backward-pos (cadr res)
+             bopl-state (car (cddr res))) ; will be nil if (< here-bopl
+                                       ; start-point)
+       (if scan-backward-pos
+           (c-append-lower-brace-pair-to-state-cache scan-backward-pos))
+       (setq good-pos
+             (c-append-to-state-cache cache-pos))
+       (setq c-state-cache-good-pos
+             (if (and bopl-state
+                      (< good-pos (- here c-state-cache-too-far)))
+                 (c-state-cache-non-literal-place here-bopl bopl-state)
+               good-pos)))
+
+       ((eq strategy 'backward)
+       (setq res (c-remove-stale-state-cache-backwards here cache-pos)
+             good-pos (car res)
+             scan-backward-pos (cadr res)
+             scan-forward-p (car (cddr res)))
+       (if scan-backward-pos
+           (c-append-lower-brace-pair-to-state-cache
+            scan-backward-pos))
+       (setq c-state-cache-good-pos
+             (if scan-forward-p
+                 (progn (narrow-to-region (point-min) here)
+                        (c-append-to-state-cache good-pos))
+
+               (c-get-cache-scan-pos good-pos))))
+
+       (t ; (eq strategy 'IN-LIT)
+       (setq c-state-cache nil
+             c-state-cache-good-pos nil)))))
+
+  c-state-cache)
+
+(defun c-invalidate-state-cache (here)
+  ;; This is a wrapper over `c-invalidate-state-cache-1'.
+  ;;
+  ;; It suppresses the syntactic effect of the < and > (template) brackets and
+  ;; of all parens in preprocessor constructs, except for any such construct
+  ;; containing point.  We can then call `c-invalidate-state-cache-1' without
+  ;; worrying further about macros and template delimiters.
+  (c-with-<->-as-parens-suppressed
+   (if (and c-state-old-cpp-beg
+           (< c-state-old-cpp-beg here))
+       (c-with-all-but-one-cpps-commented-out
+       c-state-old-cpp-beg
+       (min c-state-old-cpp-end here)
+       (c-invalidate-state-cache-1 here))
+     (c-with-cpps-commented-out
+      (c-invalidate-state-cache-1 here)))))
 
-  (save-restriction
-    (let* ((here (point))
-          (here-bol (c-point 'bol))
-          (c-macro-start (c-query-macro-start))
-          (in-macro-start (or c-macro-start (point)))
-          old-state last-pos brace-pair-open brace-pair-close
-          pos save-pos)
-      (c-invalidate-state-cache here)
-
-      ;; If the minimum position has changed due to narrowing then we
-      ;; have to fix the tail of `c-state-cache' accordingly.
-      (unless (= c-state-cache-start (point-min))
-       (if (> (point-min) c-state-cache-start)
-           ;; If point-min has moved forward then we just need to cut
-           ;; off a bit of the tail.
-           (let ((ptr (cons nil c-state-cache)) elem)
-             (while (and (setq elem (car-safe (cdr ptr)))
-                         (>= (if (consp elem) (car elem) elem)
-                             (point-min)))
-               (setq ptr (cdr ptr)))
-             (when (consp ptr)
-               (if (eq (cdr ptr) c-state-cache)
-                   (setq c-state-cache nil
-                         c-state-cache-good-pos 1)
-                 (setcdr ptr nil))))
-         ;; If point-min has moved backward then we drop the state
-         ;; completely.  It's possible to do a better job here and
-         ;; recalculate the top only.
-         (setq c-state-cache nil
-               c-state-cache-good-pos 1))
-       (setq c-state-cache-start (point-min)))
-
-      ;; Get the latest position we know are directly inside the
-      ;; closest containing paren of the cached state.
-      (setq last-pos (and c-state-cache
-                         (if (consp (car c-state-cache))
-                             (cdr (car c-state-cache))
-                           (1+ (car c-state-cache)))))
-      (if (or (not last-pos)
-             (< last-pos c-state-cache-good-pos))
-         (setq last-pos c-state-cache-good-pos)
-       ;; Take the opportunity to move the cached good position
-       ;; further down.
-       (if (< last-pos here-bol)
-           (setq c-state-cache-good-pos last-pos)))
+(defun c-parse-state ()
+  ;; This is a wrapper over `c-parse-state-1'.  See that function for a
+  ;; description of the functionality and return value.
+  ;;
+  ;; It suppresses the syntactic effect of the < and > (template) brackets and
+  ;; of all parens in preprocessor constructs, except for any such construct
+  ;; containing point.  We can then call `c-parse-state-1' without worrying
+  ;; further about macros and template delimiters.
+  (let (here-cpp-beg here-cpp-end)
+    (save-excursion
+      (when (c-beginning-of-macro)
+       (setq here-cpp-beg (point))
+       (unless
+           (> (setq here-cpp-end (c-syntactic-end-of-macro))
+              here-cpp-beg)
+         (setq here-cpp-beg nil  here-cpp-end nil))))
+    ;; FIXME!!! Put in a `condition-case' here to protect the integrity of the
+    ;; subsystem.
+    (prog1
+       (c-with-<->-as-parens-suppressed
+        (if (and here-cpp-beg (> here-cpp-end here-cpp-beg))
+            (c-with-all-but-one-cpps-commented-out
+             here-cpp-beg here-cpp-end
+             (c-parse-state-1))
+          (c-with-cpps-commented-out
+           (c-parse-state-1))))
+      (setq c-state-old-cpp-beg (and here-cpp-beg (copy-marker here-cpp-beg t))
+           c-state-old-cpp-end (and here-cpp-end (copy-marker here-cpp-end t)))
+      )))
 
-      ;; Check if `last-pos' is in a macro.  If it is, and we're not
-      ;; in the same macro, we must discard everything on
-      ;; `c-state-cache' that is inside the macro before using it.
-      (save-excursion
-       (goto-char last-pos)
-       (when (and (c-beginning-of-macro)
-                  (/= (point) in-macro-start))
-         (c-invalidate-state-cache (point))
-         ;; Set `last-pos' again just like above except that there's
-         ;; no use looking at `c-state-cache-good-pos' here.
-         (setq last-pos (if c-state-cache
-                            (if (consp (car c-state-cache))
-                                (cdr (car c-state-cache))
-                              (1+ (car c-state-cache)))
-                          1))))
-
-      ;; If we've moved very far from the last cached position then
-      ;; it's probably better to redo it from scratch, otherwise we
-      ;; might spend a lot of time searching from `last-pos' down to
-      ;; here.
-      (when (< last-pos (- here 20000))
-       ;; First get the fallback start position.  If it turns out
-       ;; that it's so far back that the cached state is closer then
-       ;; we'll keep it afterall.
-       (setq pos (c-get-fallback-start-pos here))
-       (if (<= pos last-pos)
-           (setq pos nil)
-         (setq last-pos nil
-               c-state-cache nil
-               c-state-cache-good-pos 1)))
-
-      ;; Find the start position for the forward search.  (Can't
-      ;; search in the backward direction since the point might be in
-      ;; some kind of literal.)
-
-      (unless pos
-       (setq old-state c-state-cache)
-
-       ;; There's a cached state with a containing paren.  Pop off
-       ;; the stale containing sexps from it by going forward out of
-       ;; parens as far as possible.
-       (narrow-to-region (point-min) here)
-       (let (placeholder pair-beg)
-         (while (and c-state-cache
-                     (setq placeholder
-                           (c-up-list-forward last-pos)))
-           (setq last-pos placeholder)
-           (if (consp (car c-state-cache))
-               (setq pair-beg (car-safe (cdr c-state-cache))
-                     c-state-cache (cdr-safe (cdr c-state-cache)))
-             (setq pair-beg (car c-state-cache)
-                   c-state-cache (cdr c-state-cache))))
-
-         (when (and pair-beg (eq (char-after pair-beg) ?{))
-           ;; The last paren pair we moved out from was a brace
-           ;; pair.  Modify the state to record this as a closed
-           ;; pair now.
-           (if (consp (car-safe c-state-cache))
-               (setq c-state-cache (cdr c-state-cache)))
-           (setq c-state-cache (cons (cons pair-beg last-pos)
-                                     c-state-cache))))
-
-       ;; Check if the preceding balanced paren is within a
-       ;; macro; it should be ignored if we're outside the
-       ;; macro.  There's no need to check any further upwards;
-       ;; if the macro contains an unbalanced opening paren then
-       ;; we're smoked anyway.
-       (when (and (<= (point) in-macro-start)
-                  (consp (car c-state-cache)))
-         (save-excursion
-           (goto-char (car (car c-state-cache)))
-           (when (c-beginning-of-macro)
-             (setq here (point)
-                   c-state-cache (cdr c-state-cache)))))
-
-       (unless (eq c-state-cache old-state)
-         ;; Have to adjust the cached good position if state has been
-         ;; popped off.
-         (setq c-state-cache-good-pos
-               (if c-state-cache
-                   (if (consp (car c-state-cache))
-                       (cdr (car c-state-cache))
-                     (1+ (car c-state-cache)))
-                 1)
-               old-state c-state-cache))
-
-       (when c-state-cache
-         (setq pos last-pos)))
-
-      ;; Get the fallback start position.
-      (unless pos
-       (setq pos (c-get-fallback-start-pos here)
-             c-state-cache nil
-             c-state-cache-good-pos 1))
-
-      (narrow-to-region (point-min) here)
-
-      (while pos
-       (setq save-pos pos
-             brace-pair-open nil)
-
-       ;; Find the balanced brace pairs.  This loop is hot, so it
-       ;; does ugly tricks to go faster.
-       (c-safe
-         (let (set-good-pos set-brace-pair)
-           (while t
-             (setq last-pos nil
-                   last-pos (scan-lists pos 1 -1)) ; Might signal.
-             (setq pos (scan-lists last-pos 1 1) ; Might signal.
-                   set-good-pos (< pos here-bol)
-                   set-brace-pair (eq (char-before last-pos) ?{))
-
-             ;; Update the cached good position and record the brace
-             ;; pair, whichever is applicable for the paren we've
-             ;; just jumped over.  But first check that it isn't
-             ;; inside a macro and the point isn't inside the same
-             ;; one.
-             (when (and (or set-good-pos set-brace-pair)
-                        (or (>= pos in-macro-start)
-                            (save-excursion
-                              (goto-char pos)
-                              (not (c-beginning-of-macro)))))
-               (if set-good-pos
-                   (setq c-state-cache-good-pos pos))
-               (if set-brace-pair
-                   (setq brace-pair-open last-pos
-                         brace-pair-close pos))))))
-
-       ;; Record the last brace pair.
-       (when brace-pair-open
-         (let ((head (car-safe c-state-cache)))
-           (if (consp head)
-               (progn
-                 (setcar head (1- brace-pair-open))
-                 (setcdr head brace-pair-close))
-             (setq c-state-cache (cons (cons (1- brace-pair-open)
-                                             brace-pair-close)
-                                       c-state-cache)))))
-
-       (if last-pos
-           ;; Prepare to loop, but record the open paren only if it's
-           ;; outside a macro or within the same macro as point, and
-           ;; if it is a legitimate open paren and not some character
-           ;; that got an open paren syntax-table property.
-           (progn
-             (setq pos last-pos)
-             (when (and (or (>= last-pos in-macro-start)
-                            (save-excursion
-                              (goto-char last-pos)
-                              (not (c-beginning-of-macro))))
-                        ;; Check for known types of parens that we
-                        ;; want to record.  The syntax table is not to
-                        ;; be trusted here since the caller might be
-                        ;; using e.g. `c++-template-syntax-table'.
-                        (memq (char-before last-pos) '(?{ ?\( ?\[)))
-               (if (< last-pos here-bol)
-                   (setq c-state-cache-good-pos last-pos))
-               (setq c-state-cache (cons (1- last-pos) c-state-cache))))
-
-         (if (setq last-pos (c-up-list-forward pos))
-             ;; Found a close paren without a corresponding opening
-             ;; one.  Maybe we didn't go back far enough, so try to
-             ;; scan backward for the start paren and then start over.
-             (progn
-               (setq pos (c-up-list-backward pos)
-                     c-state-cache nil
-                     c-state-cache-good-pos c-state-cache-start)
-               (when (or (not pos)
-                         ;; Emacs (up to at least 21.2) can get confused by
-                         ;; open parens in column zero inside comments: The
-                         ;; sexp functions can then misbehave and bring us
-                         ;; back to the same point again.  Check this so that
-                         ;; we don't get an infinite loop.
-                         (>= pos save-pos))
-                 (setq pos last-pos
-                       c-parsing-error
-                       (format "Unbalanced close paren at line %d"
-                               (1+ (count-lines (point-min)
-                                                (c-point 'bol last-pos)))))))
-           (setq pos nil))))
-
-      ;;(message "c-parse-state: %S end: %S" c-state-cache c-state-cache-good-pos)
-      c-state-cache)))
-
-;; Debug tool to catch cache inconsistencies.
+;; Debug tool to catch cache inconsistencies.  This is called from
+;; 000tests.el.
 (defvar c-debug-parse-state nil)
 (unless (fboundp 'c-real-parse-state)
   (fset 'c-real-parse-state (symbol-function 'c-parse-state)))
 (cc-bytecomp-defun c-real-parse-state)
 (defun c-debug-parse-state ()
-  (let ((res1 (c-real-parse-state)) res2)
+  (let ((here (point)) (res1 (c-real-parse-state)) res2)
     (let ((c-state-cache nil)
-         (c-state-cache-start 1)
-         (c-state-cache-good-pos 1))
+         (c-state-cache-good-pos 1)
+         (c-state-nonlit-pos-cache nil)
+         (c-state-nonlit-pos-cache-limit 1)
+         (c-state-brace-pair-desert nil)
+         (c-state-point-min 1)
+         (c-state-point-min-lit-type nil)
+         (c-state-point-min-lit-start nil)
+         (c-state-min-scan-pos 1)
+         (c-state-old-cpp-beg nil)
+         (c-state-old-cpp-end nil))
       (setq res2 (c-real-parse-state)))
     (unless (equal res1 res2)
       ;; The cache can actually go further back due to the ad-hoc way
@@ -2296,10 +3084,11 @@ comment at the start of cc-engine.el for more info."
        (while (not (or (bobp) (eq (char-after) ?{)))
          (c-beginning-of-defun-1))
        (unless (equal (c-whack-state-before (point) res1) res2)
-         (message (concat "c-parse-state inconsistency: "
+         (message (concat "c-parse-state inconsistency at %s: "
                           "using cache: %s, from scratch: %s")
-                  res1 res2))))
+                  here res1 res2))))
     res1))
+
 (defun c-toggle-parse-state-debug (&optional arg)
   (interactive "P")
   (setq c-debug-parse-state (c-calculate-state arg c-debug-parse-state))
@@ -2310,6 +3099,7 @@ comment at the start of cc-engine.el for more info."
 (when c-debug-parse-state
   (c-toggle-parse-state-debug 1))
 
+\f
 (defun c-whack-state-before (bufpos paren-state)
   ;; Whack off any state information from PAREN-STATE which lies
   ;; before BUFPOS.  Not destructive on PAREN-STATE.
@@ -4109,7 +4899,190 @@ comment at the start of cc-engine.el for more info."
        )))
 
 \f
-;; Handling of small scale constructs like types and names.
+;; Setting and removing syntax properties on < and > in languages (C++
+;; and Java) where they can be template/generic delimiters as well as
+;; their normal meaning of "less/greater than".
+
+;; Normally, < and > have syntax 'punctuation'.  When they are found to
+;; be delimiters, they are marked as such with the category properties
+;; c-<-as-paren-syntax, c->-as-paren-syntax respectively.
+
+;; STRATEGY:
+;;
+;; It is impossible to determine with certainty whether a <..> pair in
+;; C++ is two comparison operators or is template delimiters, unless
+;; one duplicates a lot of a C++ compiler.  For example, the following
+;; code fragment:
+;;
+;;     foo (a < b, c > d) ;
+;;
+;; could be a function call with two integer parameters (each a
+;; relational expression), or it could be a constructor for class foo
+;; taking one parameter d of templated type "a < b, c >".  They are
+;; somewhat easier to distinguish in Java.
+;;
+;; The strategy now (2010-01) adopted is to mark and unmark < and
+;; > IN MATCHING PAIRS ONLY.  [Previously, they were marked
+;; individually when their context so indicated.  This gave rise to
+;; intractible problems when one of a matching pair was deleted, or
+;; pulled into a literal.]
+;;
+;; At each buffer change, the syntax-table properties are removed in a
+;; before-change function and reapplied, when needed, in an
+;; after-change function.  It is far more important that the
+;; properties get removed when they they are spurious than that they
+;; be present when wanted.
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(defun c-clear-<-pair-props (&optional pos)
+  ;; POS (default point) is at a < character.  If it is marked with
+  ;; open paren syntax-table text property, remove the property,
+  ;; together with the close paren property on the matching > (if
+  ;; any).
+  (save-excursion
+    (if pos
+       (goto-char pos)
+      (setq pos (point)))
+    (when (equal (c-get-char-property (point) 'syntax-table)
+                c-<-as-paren-syntax)
+      (with-syntax-table c-no-parens-syntax-table ; ignore unbalanced [,{,(,..
+       (c-go-list-forward))
+      (when (equal (c-get-char-property (1- (point)) 'syntax-table)
+                  c->-as-paren-syntax) ; should always be true.
+       (c-clear-char-property (1- (point)) 'category))
+      (c-clear-char-property pos 'category))))
+
+(defun c-clear->-pair-props (&optional pos)
+  ;; POS (default point) is at a > character.  If it is marked with
+  ;; close paren syntax-table property, remove the property, together
+  ;; with the open paren property on the matching < (if any).
+  (save-excursion
+    (if pos
+       (goto-char pos)
+      (setq pos (point)))
+    (when (equal (c-get-char-property (point) 'syntax-table)
+                c->-as-paren-syntax)
+      (with-syntax-table c-no-parens-syntax-table ; ignore unbalanced [,{,(,..
+       (c-go-up-list-backward))
+      (when (equal (c-get-char-property (point) 'syntax-table)
+                       c-<-as-paren-syntax) ; should always be true.
+       (c-clear-char-property (point) 'category))
+      (c-clear-char-property pos 'category))))
+
+(defun c-clear-<>-pair-props (&optional pos)
+  ;; POS (default point) is at a < or > character.  If it has an
+  ;; open/close paren syntax-table property, remove this property both
+  ;; from the current character and its partner (which will also be
+  ;; thusly marked).
+  (cond
+   ((eq (char-after) ?\<)
+    (c-clear-<-pair-props pos))
+   ((eq (char-after) ?\>)
+    (c-clear->-pair-props pos))
+   (t (c-benign-error
+       "c-clear-<>-pair-props called from wrong position"))))
+
+(defun c-clear-<-pair-props-if-match-after (lim &optional pos)
+  ;; POS (default point) is at a < character.  If it is both marked
+  ;; with open/close paren syntax-table property, and has a matching >
+  ;; (also marked) which is after LIM, remove the property both from
+  ;; the current > and its partner.  Return t when this happens, nil
+  ;; when it doesn't.
+  (save-excursion
+    (if pos
+       (goto-char pos)
+      (setq pos (point)))
+    (when (equal (c-get-char-property (point) 'syntax-table)
+                c-<-as-paren-syntax)
+      (with-syntax-table c-no-parens-syntax-table ; ignore unbalanced [,{,(,..
+       (c-go-list-forward))
+      (when (and (>= (point) lim)
+                (equal (c-get-char-property (1- (point)) 'syntax-table)
+                       c->-as-paren-syntax)) ; should always be true.
+       (c-unmark-<->-as-paren (1- (point)))
+       (c-unmark-<->-as-paren pos))
+      t)))
+
+(defun c-clear->-pair-props-if-match-before (lim &optional pos)
+  ;; POS (default point) is at a > character.  If it is both marked
+  ;; with open/close paren syntax-table property, and has a matching <
+  ;; (also marked) which is before LIM, remove the property both from
+  ;; the current < and its partner.  Return t when this happens, nil
+  ;; when it doesn't.
+  (save-excursion
+    (if pos
+       (goto-char pos)
+      (setq pos (point)))
+    (when (equal (c-get-char-property (point) 'syntax-table)
+                c->-as-paren-syntax)
+      (with-syntax-table c-no-parens-syntax-table ; ignore unbalanced [,{,(,..
+       (c-go-up-list-backward))
+      (when (and (<= (point) lim)
+                (equal (c-get-char-property (point) 'syntax-table)
+                       c-<-as-paren-syntax)) ; should always be true.
+       (c-unmark-<->-as-paren (point))
+       (c-unmark-<->-as-paren pos))
+      t)))
+
+;; Set by c-common-init in cc-mode.el.
+(defvar c-new-BEG)
+(defvar c-new-END)
+
+(defun c-before-change-check-<>-operators (beg end)
+  ;; Unmark certain pairs of "< .... >" which are currently marked as
+  ;; template/generic delimiters.  (This marking is via syntax-table
+  ;; text properties).
+  ;;
+  ;; These pairs are those which are in the current "statement" (i.e.,
+  ;; the region between the {, }, or ; before BEG and the one after
+  ;; END), and which enclose any part of the interval (BEG END).
+  ;;
+  ;; Note that in C++ (?and Java), template/generic parens cannot
+  ;; enclose a brace or semicolon, so we use these as bounds on the
+  ;; region we must work on.
+  ;;
+  ;; This function is called from before-change-functions (via
+  ;; c-get-state-before-change-functions).  Thus the buffer is widened,
+  ;; and point is undefined, both at entry and exit.
+  ;;
+  ;; FIXME!!!  This routine ignores the possibility of macros entirely.
+  ;; 2010-01-29.
+  (save-excursion
+    (let ((beg-lit-limits (progn (goto-char beg) (c-literal-limits)))
+         (end-lit-limits (progn (goto-char end) (c-literal-limits)))
+         new-beg new-end need-new-beg need-new-end)
+      ;; Locate the barrier before the changed region
+      (goto-char  (if beg-lit-limits (car beg-lit-limits) beg))
+      (c-syntactic-skip-backward "^;{}" (max (- beg 2048) (point-min)))
+      (setq new-beg (point))
+
+      ;; Remove the syntax-table properties from each pertinent <...> pair.
+      ;; Firsly, the ones with the < before beg and > after beg.
+      (while (c-search-forward-char-property 'category 'c-<-as-paren-syntax beg)
+       (if (c-clear-<-pair-props-if-match-after beg (1- (point)))
+           (setq need-new-beg t)))
+
+      ;; Locate the barrier after END.
+      (goto-char (if end-lit-limits (cdr end-lit-limits) end))
+      (c-syntactic-re-search-forward "[;{}]"
+                                    (min (+ end 2048) (point-max)) 'end)
+      (setq new-end (point))
+
+      ;; Remove syntax-table properties from the remaining pertinent <...>
+      ;; pairs, those with a > after end and < before end.
+      (while (c-search-backward-char-property 'category 'c->-as-paren-syntax end)
+       (if (c-clear->-pair-props-if-match-before end)
+           (setq need-new-end t)))
+
+      ;; Extend the fontification region, if needed.
+      (when need-new-beg
+       (goto-char new-beg)
+       (c-forward-syntactic-ws)
+       (and (< (point) c-new-BEG) (setq c-new-BEG (point))))
+
+      (when need-new-end
+       (and (> new-end c-new-END) (setq c-new-END new-end))))))
+
+
 
 (defun c-after-change-check-<>-operators (beg end)
   ;; This is called from `after-change-functions' when
@@ -4131,7 +5104,7 @@ comment at the start of cc-engine.el for more info."
                 (< beg (setq beg (match-end 0))))
        (while (progn (skip-chars-forward "^<>" beg)
                      (< (point) beg))
-         (c-clear-char-property (point) 'syntax-table)
+         (c-clear-<>-pair-props)
          (forward-char))))
 
     (when (< beg end)
@@ -4146,9 +5119,13 @@ comment at the start of cc-engine.el for more info."
                   (< end (setq end (match-end 0))))
          (while (progn (skip-chars-forward "^<>" end)
                        (< (point) end))
-           (c-clear-char-property (point) 'syntax-table)
+           (c-clear-<>-pair-props)
            (forward-char)))))))
 
+
+\f
+;; Handling of small scale constructs like types and names.
+
 ;; Dynamically bound variable that instructs `c-forward-type' to also
 ;; treat possible types (i.e. those that it normally returns 'maybe or
 ;; 'found for) as actual types (and always return 'found for them).
@@ -4393,6 +5370,9 @@ comment at the start of cc-engine.el for more info."
       (goto-char safe-pos)
       t)))
 
+;; cc-mode requires cc-fonts.
+(declare-function c-fontify-recorded-types-and-refs "cc-fonts" ())
+
 (defun c-forward-<>-arglist (all-types)
   ;; The point is assumed to be at a "<".  Try to treat it as the open
   ;; paren of an angle bracket arglist and move forward to the
@@ -4428,6 +5408,7 @@ comment at the start of cc-engine.el for more info."
                  ;; `nconc' doesn't mind that the tail of
                  ;; `c-record-found-types' is t.
                  (nconc c-record-found-types c-record-type-identifiers)))
+           (if (c-major-mode-is 'java-mode) (c-fontify-recorded-types-and-refs))
          t)
 
       (goto-char start)
@@ -4447,7 +5428,6 @@ comment at the start of cc-engine.el for more info."
        ;; List that collects the positions after the argument
        ;; separating ',' in the arglist.
        arg-start-pos)
-
     ;; If the '<' has paren open syntax then we've marked it as an angle
     ;; bracket arglist before, so skip to the end.
     (if (and (not c-parse-and-markup-<>-arglists)
@@ -4458,7 +5438,6 @@ comment at the start of cc-engine.el for more info."
          (if (and (c-go-up-list-forward)
                   (eq (char-before) ?>))
              t
-
            ;; Got unmatched paren angle brackets.  We don't clear the paren
            ;; syntax properties and retry, on the basis that it's very
            ;; unlikely that paren angle brackets become operators by code
@@ -4468,70 +5447,51 @@ comment at the start of cc-engine.el for more info."
            nil))
 
       (forward-char)
+
       (unless (looking-at c-<-op-cont-regexp)
-       (while (and
+               (while (and
                (progn
+                     (c-forward-syntactic-ws)
+                (let ((orig-record-found-types c-record-found-types))
+                  (when (or (and c-record-type-identifiers all-types)
+                            (c-major-mode-is 'java-mode))
+                    ;; All encountered identifiers are types, so set the
+                    ;; promote flag and parse the type.
+                    (progn
+                      (c-forward-syntactic-ws)
+                      (if (looking-at "\\?")
+                          (forward-char)
+                        (when (looking-at c-identifier-start)
+                          (let ((c-promote-possible-types t)
+                                (c-record-found-types t))
+                            (c-forward-type))))
 
-                 (when c-record-type-identifiers
-                   (if all-types
-
-                       ;; All encountered identifiers are types, so set the
-                       ;; promote flag and parse the type.
-                       (progn
-                         (c-forward-syntactic-ws)
-                         (when (looking-at c-identifier-start)
-                           (let ((c-promote-possible-types t))
-                             (c-forward-type))))
-
-                     ;; Check if this arglist argument is a sole type.  If
-                     ;; it's known then it's recorded in
-                     ;; `c-record-type-identifiers'.  If it only is found
-                     ;; then it's recorded in `c-record-found-types' which we
-                     ;; might roll back if it turns out that this isn't an
-                     ;; angle bracket arglist afterall.
-                     (when (memq (char-before) '(?, ?<))
-                       (let ((orig-record-found-types c-record-found-types))
-                         (c-forward-syntactic-ws)
-                         (and (memq (c-forward-type) '(known found))
-                              (not (looking-at "[,>]"))
-                              ;; A found type was recorded but it's not the
-                              ;; only thing in the arglist argument, so reset
-                              ;; `c-record-found-types'.
-                              (setq c-record-found-types
-                                    orig-record-found-types))))))
+                    (c-forward-syntactic-ws)
 
-                 (setq pos (point))
-                 (or (when (eq (char-after) ?>)
-                       ;; Must check for '>' at the very start separately,
-                       ;; since the regexp below has to avoid ">>" without
-                       ;; using \\=.
-                       (forward-char)
-                       t)
-
-                     ;; Note: These regexps exploit the match order in \| so
-                     ;; that "<>" is matched by "<" rather than "[^>:-]>".
-                     (c-syntactic-re-search-forward
-                      (if c-restricted-<>-arglists
-                          ;; Stop on ',', '|', '&', '+' and '-' to catch
-                          ;; common binary operators that could be between
-                          ;; two comparison expressions "a<b" and "c>d".
-                          "[<;{},|&+-]\\|\\([^>:-]>\\)"
-                        ;; Otherwise we still stop on ',' to find the
-                        ;; argument start positions.
-                        "[<;{},]\\|\\([^>:-]>\\)")
-                      nil 'move t t 1)
-
-                     ;; If the arglist starter has lost its open paren
-                     ;; syntax but not the closer, we won't find the
-                     ;; closer above since we only search in the
-                     ;; balanced sexp.  In that case we stop just short
-                     ;; of it so check if the following char is the closer.
-                     (when (eq (char-after) ?>)
-                       (forward-char)
-                       t)))
+                    (when (or (looking-at "extends")
+                              (looking-at "super"))
+                      (forward-word)
+                      (c-forward-syntactic-ws)
+                      (let ((c-promote-possible-types t)
+                           (c-record-found-types t))
+                        (c-forward-type)
+                        (c-forward-syntactic-ws))))))
+
+                     (setq pos (point))
+
+                     (or
+                      ;; Note: These regexps exploit the match order in \| so
+                      ;; that "<>" is matched by "<" rather than "[^>:-]>".
+                      (c-syntactic-re-search-forward
+                       ;; Stop on ',', '|', '&', '+' and '-' to catch
+                       ;; common binary operators that could be between
+                       ;; two comparison expressions "a<b" and "c>d".
+                       "[<;{},|+&-]\\|[>)]"
+                       nil t t)
+                      t))
 
-               (cond
-                ((eq (char-before) ?>)
+                   (cond
+                    ((eq (char-before) ?>)
                  ;; Either an operator starting with '>' or the end of
                  ;; the angle bracket arglist.
 
@@ -4553,7 +5513,6 @@ comment at the start of cc-engine.el for more info."
 
                 ((eq (char-before) ?<)
                  ;; Either an operator starting with '<' or a nested arglist.
-
                  (setq pos (point))
                  (let (id-start id-end subres keyword-match)
                    (if (if (looking-at c-<-op-cont-regexp)
@@ -4573,14 +5532,14 @@ comment at the start of cc-engine.el for more info."
                              (when (or (setq keyword-match
                                              (looking-at c-opt-<>-sexp-key))
                                        (not (looking-at c-keywords-regexp)))
-                               (setq id-start (point))))
-
-                           (setq subres
-                                 (let ((c-record-type-identifiers nil)
-                                       (c-record-found-types nil))
-                                   (c-forward-<>-arglist-recur
-                                    (and keyword-match
-                                         (c-keyword-member
+                                   (setq id-start (point))))
+
+                               (setq subres
+                                     (let ((c-promote-possible-types t)
+                                           (c-record-found-types t))
+                                       (c-forward-<>-arglist-recur
+                                        (and keyword-match
+                                             (c-keyword-member
                                           (c-keyword-sym (match-string 1))
                                           'c-<>-type-kwds)))))
                            )))
@@ -4601,14 +5560,16 @@ comment at the start of cc-engine.el for more info."
                                   (c-forward-syntactic-ws)
                                   (looking-at c-opt-identifier-concat-key)))
                            (c-record-ref-id (cons id-start id-end))
-                         (c-record-type-id (cons id-start id-end))))))
-                 t)
-
-                ((and (eq (char-before) ?,)
-                      (not c-restricted-<>-arglists))
-                 ;; Just another argument.  Record the position.  The
-                 ;; type check stuff that made us stop at it is at
-                 ;; the top of the loop.
+                             (c-record-type-id (cons id-start id-end))))))
+                     t)
+
+               ((and (not c-restricted-<>-arglists)
+                     (or (and (eq (char-before) ?&)
+                              (not (eq (char-after) ?&)))
+                         (eq (char-before) ?,)))
+                     ;; Just another argument.  Record the position.  The
+                     ;; type check stuff that made us stop at it is at
+                     ;; the top of the loop.
                  (setq arg-start-pos (cons (point) arg-start-pos)))
 
                 (t
@@ -4617,7 +5578,6 @@ comment at the start of cc-engine.el for more info."
                  ;; it's useless to try to find a surrounding arglist
                  ;; if we're nested.
                  (throw 'angle-bracket-arglist-escape nil))))))
-
       (if res
          (or c-record-found-types t)))))
 
@@ -4820,9 +5780,8 @@ comment at the start of cc-engine.el for more info."
              ((and c-recognize-<>-arglists
                    (eq (char-after) ?<))
               ;; Maybe an angle bracket arglist.
-
-              (when (let (c-record-type-identifiers
-                          c-record-found-types)
+              (when (let ((c-record-type-identifiers t)
+                          (c-record-found-types t))
                       (c-forward-<>-arglist nil))
 
                 (c-add-type start (1+ pos))
@@ -4871,6 +5830,9 @@ comment at the start of cc-engine.el for more info."
   ;; `c-record-type-identifiers' is non-nil.
   ;;
   ;; This function might do hidden buffer changes.
+  (when (looking-at "<")
+    (c-forward-<>-arglist t)
+    (c-forward-syntactic-ws))
 
   (let ((start (point)) pos res name-res id-start id-end id-range)
 
@@ -5070,6 +6032,18 @@ comment at the start of cc-engine.el for more info."
 
     res))
 
+(defun c-forward-annotation ()
+  ;; Used for Java code only at the moment.  Assumes point is on the
+  ;; @, moves forward an annotation.  returns nil if there is no
+  ;; annotation at point.
+  (and (looking-at "@")
+       (progn (forward-char) t)
+       (c-forward-type)
+       (progn (c-forward-syntactic-ws) t)
+       (if (looking-at "(")
+          (c-go-list-forward)
+         t)))
+
 \f
 ;; Handling of large scale constructs like statements and declarations.
 
@@ -5239,6 +6213,9 @@ comment at the start of cc-engine.el for more info."
        (save-rec-type-ids c-record-type-identifiers)
        (save-rec-ref-ids c-record-ref-identifiers))
 
+    (while (c-forward-annotation)
+      (c-forward-syntactic-ws))
+
     ;; Check for a type.  Unknown symbols are treated as possible
     ;; types, but they could also be specifiers disguised through
     ;; macros like __INLINE__, so we recognize both types and known
@@ -5572,13 +6549,14 @@ comment at the start of cc-engine.el for more info."
                ;; CASE 3
                (when (= (point) start)
                  ;; Got a plain list of identifiers.  If a colon follows it's
-                 ;; a valid label.  Otherwise the last one probably is the
-                 ;; declared identifier and we should back up to the previous
-                 ;; type, providing it isn't a cast.
-                 (if (eq (char-after) ?:)
-                     ;; If we've found a specifier keyword then it's a
-                     ;; declaration regardless.
-                     (throw 'at-decl-or-cast (eq at-decl-or-cast t))
+                  ;; a valid label.  Otherwise the last one probably is the
+                  ;; declared identifier and we should back up to the previous
+                  ;; type, providing it isn't a cast.
+                  (if (and (eq (char-after) ?:)
+                           (not (c-major-mode-is 'java-mode)))
+                      ;; If we've found a specifier keyword then it's a
+                      ;; declaration regardless.
+                      (throw 'at-decl-or-cast (eq at-decl-or-cast t))
                    (setq backup-if-not-cast t)
                    (throw 'at-decl-or-cast t)))
 
@@ -7539,7 +8517,7 @@ comment at the start of cc-engine.el for more info."
   ;;
   ;; This function might do hidden buffer changes.
 
-  (let (special-brace-list)
+  (let (special-brace-list placeholder)
     (goto-char indent-point)
     (skip-chars-forward " \t")
 
@@ -7646,6 +8624,22 @@ comment at the start of cc-engine.el for more info."
       (c-add-stmt-syntax 'func-decl-cont nil t
                         containing-sexp paren-state))
 
+     ;;CASE F: continued statement and the only preceding items are
+     ;;annotations.
+     ((and (c-major-mode-is 'java-mode)
+          (setq placeholder (point))
+            (c-beginning-of-statement-1)
+            (progn
+              (while (and (c-forward-annotation)
+                          (< (point) placeholder))
+                (c-forward-syntactic-ws))
+              t)
+            (prog1
+                (>= (point) placeholder)
+              (goto-char placeholder)))
+       (c-beginning-of-statement-1 containing-sexp)
+       (c-add-syntax 'annotation-var-cont (point)))
+
      ;; CASE D: continued statement.
      (t
       (c-beginning-of-statement-1 containing-sexp)
@@ -7745,7 +8739,6 @@ comment at the start of cc-engine.el for more info."
        (when (and containing-sexp
                   (eq (char-after containing-sexp) ?\())
          (setq c-stmt-delim-chars c-stmt-delim-chars-with-comma))
-
        ;; cache char before and after indent point, and move point to
        ;; the most likely position to perform the majority of tests
        (goto-char indent-point)
@@ -8495,23 +9488,36 @@ comment at the start of cc-engine.el for more info."
            (c-add-syntax 'objc-method-args-cont placeholder))
 
           ;; CASE 5L: we are at the first argument of a template
-          ;; arglist that begins on the previous line.
-          ((and c-recognize-<>-arglists
-                (eq (char-before) ?<)
-                (setq placeholder (1- (point)))
-                (not (and c-overloadable-operators-regexp
-                          (c-after-special-operator-id lim))))
-           (c-beginning-of-statement-1 (c-safe-position (point) paren-state))
-           (c-add-syntax 'template-args-cont (c-point 'boi) placeholder))
-
-          ;; CASE 5Q: we are at a statement within a macro.
-          (macro-start
-           (c-beginning-of-statement-1 containing-sexp)
-           (c-add-stmt-syntax 'statement nil t containing-sexp paren-state))
-
-          ;; CASE 5M: we are at a topmost continuation line
-          (t
-           (c-beginning-of-statement-1 (c-safe-position (point) paren-state))
+        ;; arglist that begins on the previous line.
+        ((and c-recognize-<>-arglists
+              (eq (char-before) ?<)
+              (not (and c-overloadable-operators-regexp
+                        (c-after-special-operator-id lim))))
+         (c-beginning-of-statement-1 (c-safe-position (point) paren-state))
+         (c-add-syntax 'template-args-cont (c-point 'boi)))
+
+        ;; CASE 5Q: we are at a statement within a macro.
+        (macro-start
+         (c-beginning-of-statement-1 containing-sexp)
+         (c-add-stmt-syntax 'statement nil t containing-sexp paren-state))
+
+     ;;CASE 5N: We are at a tompmost continuation line and the only
+     ;;preceding items are annotations.
+        ((and (c-major-mode-is 'java-mode)
+              (setq placeholder (point))
+           (c-beginning-of-statement-1)
+           (progn
+                (while (and (c-forward-annotation))
+              (c-forward-syntactic-ws))
+            t)
+          (prog1
+             (>= (point) placeholder)
+             (goto-char placeholder)))
+      (c-add-syntax 'annotation-top-cont (c-point 'boi)))
+
+        ;; CASE 5M: we are at a topmost continuation line
+        (t
+         (c-beginning-of-statement-1 (c-safe-position (point) paren-state))
            (when (c-major-mode-is 'objc-mode)
              (setq placeholder (point))
              (while (and (c-forward-objc-directive)
@@ -8522,43 +9528,20 @@ comment at the start of cc-engine.el for more info."
            (c-add-syntax 'topmost-intro-cont (c-point 'boi)))
           ))
 
-        ;; (CASE 6 has been removed.)
 
-        ;; CASE 19: line is an expression, not a statement, and is directly
-        ;; contained by a template delimiter.  Most likely, we are in a
-        ;; template arglist within a statement.  This case is based on CASE
-        ;; 7.  At some point in the future, we may wish to create more
-        ;; syntactic symbols such as `template-intro',
-        ;; `template-cont-nonempty', etc., and distinguish between them as we
-        ;; do for `arglist-intro' etc. (2009-12-07).
-        ((and c-recognize-<>-arglists
-              (setq containing-< (c-up-list-backward indent-point containing-sexp))
-              (eq (char-after containing-<) ?\<))
-         (setq placeholder (c-point 'boi containing-<))
-         (goto-char containing-sexp)   ; Most nested Lbrace/Lparen (but not
-                                       ; '<') before indent-point.
-         (if (>= (point) placeholder)
-             (progn
-               (forward-char)
-               (skip-chars-forward " \t"))
-           (goto-char placeholder))
-         (c-add-stmt-syntax 'template-args-cont (list containing-<) t
-                            (c-most-enclosing-brace c-state-cache (point))
-                            paren-state))
-                            
+       ;; (CASE 6 has been removed.)
 
-        ;; CASE 7: line is an expression, not a statement.  Most
-        ;; likely we are either in a function prototype or a function
-        ;; call argument list, or a template argument list.
-        ((not (or (and c-special-brace-lists
-                       (save-excursion
-                         (goto-char containing-sexp)
-                         (c-looking-at-special-brace-list)))
-                  (eq (char-after containing-sexp) ?{)
-                  (eq (char-after containing-sexp) ?<)))
-         (cond
+       ;; CASE 7: line is an expression, not a statement.  Most
+       ;; likely we are either in a function prototype or a function
+       ;; call argument list
+       ((not (or (and c-special-brace-lists
+                     (save-excursion
+                       (goto-char containing-sexp)
+                       (c-looking-at-special-brace-list)))
+                (eq (char-after containing-sexp) ?{)))
+       (cond
 
-          ;; CASE 7A: we are looking at the arglist closing paren.
+        ;; CASE 7A: we are looking at the arglist closing paren.
           ;; C.f. case 7F.
           ((memq char-after-ip '(?\) ?\]))
            (goto-char containing-sexp)
@@ -8570,12 +9553,34 @@ comment at the start of cc-engine.el for more info."
                  (skip-chars-forward " \t"))
              (goto-char placeholder))
            (c-add-stmt-syntax 'arglist-close (list containing-sexp) t
-                              (c-most-enclosing-brace paren-state (point))
-                              paren-state))
+                            (c-most-enclosing-brace paren-state (point))
+                            paren-state))
 
-          ;; CASE 7B: Looking at the opening brace of an
-          ;; in-expression block or brace list.  C.f. cases 4, 16A
-          ;; and 17E.
+        ;; CASE 19: line is an expression, not a statement, and is directly
+        ;; contained by a template delimiter.  Most likely, we are in a
+        ;; template arglist within a statement.  This case is based on CASE
+        ;; 7.  At some point in the future, we may wish to create more
+        ;; syntactic symbols such as `template-intro',
+        ;; `template-cont-nonempty', etc., and distinguish between them as we
+        ;; do for `arglist-intro' etc. (2009-12-07).
+        ((and c-recognize-<>-arglists
+            (setq containing-< (c-up-list-backward indent-point containing-sexp))
+            (eq (char-after containing-<) ?\<))
+       (setq placeholder (c-point 'boi containing-<))
+       (goto-char containing-sexp)     ; Most nested Lbrace/Lparen (but not
+                                       ; '<') before indent-point.
+       (if (>= (point) placeholder)
+           (progn
+             (forward-char)
+             (skip-chars-forward " \t"))
+         (goto-char placeholder))
+       (c-add-stmt-syntax 'template-args-cont (list containing-<) t
+                          (c-most-enclosing-brace c-state-cache (point))
+                          paren-state))
+
+        ;; CASE 7B: Looking at the opening brace of an
+        ;; in-expression block or brace list.  C.f. cases 4, 16A
+        ;; and 17E.
           ((and (eq char-after-ip ?{)
                 (progn
                   (setq placeholder (c-inside-bracelist-p (point)
index 80783670f66e154f44890423c86116cd818efc70..72703b9a5e49405a9a1dc28257e0a3c88e4885cb 100644 (file)
@@ -6,8 +6,8 @@
 ;;             2002- Martin Stjernholm
 ;; Maintainer: bug-cc-mode@gnu.org
 ;; Created:    07-Jan-2002
-;; Version:    See cc-mode.el
-;; Keywords:   c languages oop
+;; Keywords:   c languages
+;; Package:    cc-mode
 
 ;; This file is part of GNU Emacs.
 
         (unless (face-property-instance oldface 'reverse)
           (invert-face newface)))))
 
+(defvar c-annotation-face (make-face 'c-annotation-face)
+  "Face used to highlight annotations in java-mode and other modes that may wish to use it.")
+(set-face-foreground 'c-annotation-face "blue")
+
 (eval-and-compile
   ;; We need the following functions during compilation since they're
   ;; called when the `c-lang-defconst' initializers are evaluated.
@@ -426,7 +430,8 @@ stuff.  Used on level 1 and higher."
                                   (progn
                                     (c-mark-<-as-paren beg)
                                     (c-mark->-as-paren end))
-                                (c-clear-char-property beg 'syntax-table)))
+                                ;; (c-clear-char-property beg 'syntax-table)
+                                (c-clear-char-property beg 'category)))
                             nil)))))))
 
              ;; #define.
@@ -1537,6 +1542,9 @@ higher."
               '((c-fontify-types-and-refs ((c-promote-possible-types t))
                   (c-forward-keyword-clause 1)
                   (if (> (point) limit) (goto-char limit))))))))
+
+      ,@(when (c-major-mode-is 'java-mode)
+         `((eval . (list "\\<\\(@[a-zA-Z0-9]+\\)\\>" 1 c-annotation-face))))
       ))
 
 (c-lang-defconst c-matchers-1
index ac6ff40b4c06dcef2bb773df17ac4c6d3b614f82..5cd5c0b95ca7bf6e240e760098d9ffe72b7f5e94 100644 (file)
@@ -12,8 +12,8 @@
 ;;             1985 Richard M. Stallman
 ;; Maintainer: bug-cc-mode@gnu.org
 ;; Created:    22-Apr-1997 (split from cc-mode.el)
-;; Version:    See cc-mode.el
-;; Keywords:   c languages oop
+;; Keywords:   c languages
+;; Package:    cc-mode
 
 ;; This file is part of GNU Emacs.
 
@@ -359,7 +359,7 @@ The syntax tables aren't stored directly since they're quite large."
        (let ((table (make-syntax-table)))
         (c-populate-syntax-table table)
         ;; Mode specific syntaxes.
-        ,(cond ((c-major-mode-is 'objc-mode)
+        ,(cond ((or (c-major-mode-is 'objc-mode) (c-major-mode-is 'java-mode))
                 ;; Let '@' be part of symbols in ObjC to cope with
                 ;; its compiler directives as single keyword tokens.
                 ;; This is then necessary since it's assumed that
@@ -382,7 +382,7 @@ The syntax tables aren't stored directly since they're quite large."
   ;; '<' and '>' characters.  Therefore this syntax table might go
   ;; away when CC Mode handles templates correctly everywhere.
   t   nil
-  c++ `(lambda ()
+  (java c++) `(lambda ()
         (let ((table (funcall ,(c-lang-const c-make-mode-syntax-table))))
           (modify-syntax-entry ?< "(>" table)
           (modify-syntax-entry ?> ")<" table)
@@ -391,6 +391,27 @@ The syntax tables aren't stored directly since they're quite large."
   (and (c-lang-const c++-make-template-syntax-table)
        (funcall (c-lang-const c++-make-template-syntax-table))))
 
+(c-lang-defconst c-no-parens-syntax-table
+  ;; A variant of the standard syntax table which is used to find matching
+  ;; "<"s and ">"s which have been marked as parens using syntax table
+  ;; properties.  The other paren characters (e.g. "{", ")" "]") are given a
+  ;; non-paren syntax here. so that the list commands will work on "< ... >"
+  ;; even when there's unbalanced other parens inside them.
+  ;;
+  ;; This variable is nil for languages which don't have template stuff.
+  t  `(lambda ()
+       (if (c-lang-const c-recognize-<>-arglists)
+           (let ((table (funcall ,(c-lang-const c-make-mode-syntax-table))))
+             (modify-syntax-entry ?\( "." table)
+             (modify-syntax-entry ?\) "." table)
+             (modify-syntax-entry ?\[ "." table)
+             (modify-syntax-entry ?\] "." table)
+             (modify-syntax-entry ?\{ "." table)
+             (modify-syntax-entry ?\} "." table)
+             table))))
+(c-lang-defvar c-no-parens-syntax-table
+              (funcall (c-lang-const c-no-parens-syntax-table)))
+
 (c-lang-defconst c-identifier-syntax-modifications
   "A list that describes the modifications that should be done to the
 mode syntax table to get a syntax table that matches all identifiers
@@ -404,7 +425,7 @@ the new syntax, as accepted by `modify-syntax-entry'."
   ;; it as an indentifier character since it's often used in various
   ;; machine generated identifiers.
   t    '((?_ . "w") (?$ . "w"))
-  objc (append '((?@ . "w"))
+  (objc java) (append '((?@ . "w"))
               (c-lang-const c-identifier-syntax-modifications))
   awk  '((?_ . "w")))
 (c-lang-defvar c-identifier-syntax-modifications
@@ -423,26 +444,36 @@ the new syntax, as accepted by `modify-syntax-entry'."
 classifies symbol constituents like '_' and '$' as word constituents,
 so that all identifiers are recognized as words.")
 
-(c-lang-defconst c-get-state-before-change-function
-  "If non-nil, a function called from c-before-change-hook.
-Typically it will record enough state to allow
+(c-lang-defconst c-get-state-before-change-functions
+  ;; For documentation see the following c-lang-defvar of the same name.
+  ;; The value here may be a list of functions or a single function.
+  t nil
+  c++ '(c-extend-region-for-CPP c-before-change-check-<>-operators)
+  (c objc) 'c-extend-region-for-CPP
+  ;; java 'c-before-change-check-<>-operators
+  awk 'c-awk-record-region-clear-NL)
+(c-lang-defvar c-get-state-before-change-functions
+              (let ((fs (c-lang-const c-get-state-before-change-functions)))
+                 (if (listp fs)
+                     fs
+                   (list fs)))
+  "If non-nil, a list of functions called from c-before-change-hook.
+Typically these will record enough state to allow
 `c-before-font-lock-function' to extend the region to fontify,
 and may do such things as removing text-properties which must be
 recalculated.
 
-It takes 2 parameters, the BEG and END supplied to every
+These functions will be run in the order given.  Each of them
+takes 2 parameters, the BEG and END supplied to every
 before-change function; on entry, the buffer will have been
 widened and match-data will have been saved; point is undefined
 on both entry and exit; the return value is ignored.
 
-When the mode is initialized, this function is called with
-parameters \(point-min) and \(point-max)."
-  t nil
-  (c c++ objc) 'c-extend-region-for-CPP
-  awk 'c-awk-record-region-clear-NL)
-(c-lang-defvar c-get-state-before-change-function
-              (c-lang-const c-get-state-before-change-function))
-  
+The functions are called even when font locking isn't enabled.
+
+When the mode is initialized, the functions are called with
+parameters \(point-min) and \(point-max).")
+
 (c-lang-defconst c-before-font-lock-function
   "If non-nil, a function called just before font locking.
 Typically it will extend the region about to be fontified \(see
@@ -461,7 +492,7 @@ The function is called even when font locking is disabled.
 When the mode is initialized, this function is called with
 parameters \(point-min), \(point-max) and <buffer size>."
   t nil
-  (c c++ objc) 'c-extend-and-neutralize-syntax-in-CPP
+  (c c++ objc) 'c-neutralize-syntax-in-and-mark-CPP
   awk 'c-awk-extend-and-syntax-tablify-region)
 (c-lang-defvar c-before-font-lock-function
               (c-lang-const c-before-font-lock-function))
@@ -471,9 +502,10 @@ parameters \(point-min), \(point-max) and <buffer size>."
 
 (c-lang-defconst c-symbol-start
   "Regexp that matches the start of a symbol, i.e. any identifier or
-keyword.  It's unspecified how far it matches.  Does not contain a \\|
+keyword.  It's unspecified how far it matches. Does not contain a \\|
 operator at the top level."
   t    (concat "[" c-alpha "_]")
+  java (concat "[" c-alpha "_@]")
   objc (concat "[" c-alpha "@]")
   pike (concat "[" c-alpha "_`]"))
 (c-lang-defvar c-symbol-start (c-lang-const c-symbol-start))
@@ -828,7 +860,7 @@ since CC Mode treats every identifier as an expression."
 
       ;; Primary.
       ,@(c-lang-const c-identifier-ops)
-      ,@(cond ((c-major-mode-is 'c++-mode)
+      ,@(cond ((or (c-major-mode-is 'c++-mode) (c-major-mode-is 'java-mode))
               `((postfix-if-paren "<" ">"))) ; Templates.
              ((c-major-mode-is 'pike-mode)
               `((prefix "global" "predef")))
@@ -1087,6 +1119,7 @@ operators."
                    t
                    "\\`<."
                    (lambda (op) (substring op 1)))))
+
 (c-lang-defvar c-<-op-cont-regexp (c-lang-const c-<-op-cont-regexp))
 
 (c-lang-defconst c->-op-cont-regexp
@@ -1096,7 +1129,13 @@ operators."
       (c-filter-ops (c-lang-const c-all-op-syntax-tokens)
                    t
                    "\\`>."
-                   (lambda (op) (substring op 1)))))
+                   (lambda (op) (substring op 1))))
+  java (c-make-keywords-re nil
+        (c-filter-ops (c-lang-const c-all-op-syntax-tokens)
+                      t
+                      "\\`>[^>]\\|\\`>>[^>]"
+                      (lambda (op) (substring op 1)))))
+
 (c-lang-defvar c->-op-cont-regexp (c-lang-const c->-op-cont-regexp))
 
 (c-lang-defconst c-stmt-delim-chars
@@ -1597,7 +1636,7 @@ following identifier as a type; the keyword must also be present on
   c++  '("class" "struct" "union")
   objc '("struct" "union"
         "@interface" "@implementation" "@protocol")
-  java '("class" "interface")
+  java '("class" "@interface" "interface")
   idl  '("component" "eventtype" "exception" "home" "interface" "struct"
         "union" "valuetype"
         ;; In CORBA PSDL:
@@ -1620,7 +1659,7 @@ If any of these also are on `c-type-list-kwds', `c-ref-list-kwds',
 `c-<>-type-kwds', or `c-<>-arglist-kwds' then the associated clauses
 will be handled."
   t    '("enum")
-  (java awk) nil)
+  (awk) nil)
 
 (c-lang-defconst c-brace-list-key
   ;; Regexp matching the start of declarations where the following
@@ -1741,7 +1780,7 @@ will be handled."
         "bindsTo" "delegatesTo" "implements" "proxy" "storedOn")
   ;; Note: "const" is not used in Java, but it's still a reserved keyword.
   java '("abstract" "const" "final" "native" "private" "protected" "public"
-        "static" "strictfp" "synchronized" "transient" "volatile")
+        "static" "strictfp" "synchronized" "transient" "volatile" "@[A-Za-z0-9]+")
   pike '("final" "inline" "local" "nomask" "optional" "private" "protected"
         "public" "static" "variant"))
 
@@ -1827,7 +1866,11 @@ one of `c-type-list-kwds', `c-ref-list-kwds',
 
 (c-lang-defconst c-prefix-spec-kwds-re
   ;; Adorned regexp of `c-prefix-spec-kwds'.
-  t (c-make-keywords-re t (c-lang-const c-prefix-spec-kwds)))
+  t (c-make-keywords-re t (c-lang-const c-prefix-spec-kwds))
+  java (replace-regexp-in-string
+     "\\\\\\[" "["
+     (replace-regexp-in-string "\\\\\\+" "+" (c-make-keywords-re t (c-lang-const c-prefix-spec-kwds)))))
+
 (c-lang-defvar c-prefix-spec-kwds-re (c-lang-const c-prefix-spec-kwds-re))
 
 (c-lang-defconst c-specifier-key
@@ -1919,7 +1962,7 @@ or variable identifier (that's being defined)."
   t    nil
   c++  '("operator")
   objc '("@class")
-  java '("import" "new" "extends" "implements" "throws")
+  java '("import" "new" "extends" "super" "implements" "throws")
   idl  '("manages" "native" "primarykey" "supports"
         ;; In CORBA PSDL:
         "as" "implements" "of" "scope")
@@ -2468,7 +2511,7 @@ more info."
   ;; in all languages except Java for when a cpp macro definition
   ;; begins with a declaration.
   t "\\([\{\}\(\);,]+\\)"
-  java "\\([\{\}\(;,]+\\)"
+  java "\\([\{\}\(;,<]+\\)"
   ;; Match "<" in C++ to get the first argument in a template arglist.
   ;; In that case there's an additional check in `c-find-decl-spots'
   ;; that it got open paren syntax.
@@ -2728,7 +2771,7 @@ It's undefined whether identifier syntax (see `c-identifier-syntax-table')
 is in effect or not."
   t nil
   (c c++ objc pike) "\\(\\.\\.\\.\\)"
-  java (concat "\\(\\[" (c-lang-const c-simple-ws) "*\\]\\)"))
+  java (concat "\\(\\[" (c-lang-const c-simple-ws) "*\\]\\|\\.\\.\\.\\)"))
 (c-lang-defvar c-opt-type-suffix-key (c-lang-const c-opt-type-suffix-key))
 
 (c-lang-defvar c-known-type-key
index ae346afa5481014c491ec92f1a205f35eb416708..e27335e1f58ad293cc8c4bef6c19cb9d5779629b 100644 (file)
@@ -11,8 +11,8 @@
 ;;             1985 Richard M. Stallman
 ;; Maintainer: bug-cc-mode@gnu.org
 ;; Created:    22-Apr-1997 (split from cc-mode.el)
-;; Version:    See cc-mode.el
-;; Keywords:   c languages oop
+;; Keywords:   c languages
+;; Package:    cc-mode
 
 ;; This file is part of GNU Emacs.
 
index 6b0d3f8b423f089592c399530fce8eaf182e27e5..6a76a65782944fb4e037e65f7d4339f5ab379b4c 100644 (file)
@@ -1,8 +1,8 @@
 ;;; cc-mode.el --- major mode for editing C and similar languages
 
 ;; Copyright (C) 1985, 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-;;   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
-;;   Free Software Foundation, Inc.
+;;   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
+;;   2010  Free Software Foundation, Inc.
 
 ;; Authors:    2003- Alan Mackenzie
 ;;             1998- Martin Stjernholm
@@ -12,7 +12,7 @@
 ;;             1985 Richard M. Stallman
 ;; Maintainer: bug-cc-mode@gnu.org
 ;; Created:    a long, long, time ago. adapted from the original c-mode.el
-;; Keywords:   c languages oop
+;; Keywords:   c languages
 
 ;; This file is part of GNU Emacs.
 
@@ -410,7 +410,7 @@ preferably use the `c-mode-menu' language constant directly."
 ;; temporary changes in some font lock support modes, causing extra
 ;; unnecessary work and font lock glitches due to interactions between
 ;; various text properties.
-;; 
+;;
 ;; (2007-02-12): The macro `combine-after-change-calls' ISN'T used any
 ;; more.
 
@@ -451,18 +451,18 @@ preferably use the `c-mode-menu' language constant directly."
                              end (point))))))))
 
 ;; c-maybe-stale-found-type records a place near the region being
-;; changed where an element of `found-types' might become stale.  It 
+;; changed where an element of `found-types' might become stale.  It
 ;; is set in c-before-change and is either nil, or has the form:
 ;;
 ;;   (c-decl-id-start "foo" 97 107  " (* ooka) " "o"), where
-;;   
+;;
 ;; o - `c-decl-id-start' is the c-type text property value at buffer
 ;;   pos 96.
-;; 
+;;
 ;; o - 97 107 is the region potentially containing the stale type -
 ;;   this is delimited by a non-nil c-type text property at 96 and
 ;;   either another one or a ";", "{", or "}" at 107.
-;; 
+;;
 ;; o - " (* ooka) " is the (before change) buffer portion containing
 ;;   the suspect type (here "ooka").
 ;;
@@ -517,9 +517,12 @@ that requires a literal mode spec at compile time."
   (make-local-variable 'fill-paragraph-function)
   (setq fill-paragraph-function 'c-fill-paragraph)
 
+  ;; Initialise the cache of brace pairs, and opening braces/brackets/parens.
+  (c-state-cache-init)
+
   (when (or c-recognize-<>-arglists
            (c-major-mode-is 'awk-mode)
-           (c-major-mode-is '(c-mode c++-mode objc-mode)))
+           (c-major-mode-is '(java-mode c-mode c++-mode objc-mode)))
     ;; We'll use the syntax-table text property to change the syntax
     ;; of some chars for this language, so do the necessary setup for
     ;; that.
@@ -613,6 +616,15 @@ that requires a literal mode spec at compile time."
     (font-lock-mode 0)
     (font-lock-mode 1)))
 
+;; Buffer local variables defining the region to be fontified by a font lock
+;; after-change function.  They are set in c-after-change to
+;; after-change-function's BEG and END, and may be modified by a
+;; `c-before-font-lock-function'.
+(defvar c-new-BEG 0)
+(make-variable-buffer-local 'c-new-BEG)
+(defvar c-new-END 0)
+(make-variable-buffer-local 'c-new-END)
+
 (defun c-common-init (&optional mode)
   "Common initialization for all CC Mode modes.
 In addition to the work done by `c-basic-common-init' and
@@ -637,9 +649,13 @@ compatible with old code; callers should always specify it."
   ;; Starting a mode is a sort of "change".  So call the change functions...
   (save-restriction
     (widen)
+    (setq c-new-BEG (point-min))
+    (setq c-new-END (point-max))
     (save-excursion
-      (if c-get-state-before-change-function
-         (funcall c-get-state-before-change-function (point-min) (point-max)))
+      (if c-get-state-before-change-functions
+         (mapc (lambda (fn)
+                 (funcall fn (point-min) (point-max)))
+               c-get-state-before-change-functions))
       (if c-before-font-lock-function
          (funcall c-before-font-lock-function (point-min) (point-max)
                   (- (point-max) (point-min))))))
@@ -655,6 +671,17 @@ compatible with old code; callers should always specify it."
       (and (cdr rfn)
           (setq require-final-newline mode-require-final-newline)))))
 
+(defun c-count-cfss (lv-alist)
+  ;; LV-ALIST is an alist like `file-local-variables-alist'.  Count how many
+  ;; elements with the key `c-file-style' there are in it.
+  (let ((elt-ptr lv-alist) elt (cownt 0))
+    (while elt-ptr
+      (setq elt (car elt-ptr)
+           elt-ptr (cdr elt-ptr))
+      (when (eq (car elt) 'c-file-style)
+       (setq cownt (1+ cownt))))
+    cownt))
+                                                         
 (defun c-before-hack-hook ()
   "Set the CC Mode style and \"offsets\" when in the buffer's local variables.
 They are set only when, respectively, the pseudo variables
@@ -671,7 +698,15 @@ This function is called from the hook `before-hack-local-variables-hook'."
              (delq mode-cons file-local-variables-alist)))
       (when stile
        (or (stringp stile) (error "c-file-style is not a string"))
-       (c-set-style stile))
+       (if (boundp 'dir-local-variables-alist)
+           ;; Determine whether `c-file-style' was set in the file's local
+           ;; variables or in a .dir-locals.el (a directory setting).
+           (let ((cfs-in-file-and-dir-count
+                  (c-count-cfss file-local-variables-alist))
+                 (cfs-in-dir-count (c-count-cfss dir-local-variables-alist)))
+             (c-set-style stile
+                          (= cfs-in-file-and-dir-count cfs-in-dir-count)))
+         (c-set-style stile)))
       (when offsets
        (mapc
         (lambda (langentry)
@@ -777,7 +812,7 @@ Note that the style variables are always made local to the buffer."
 
 (defmacro c-run-mode-hooks (&rest hooks)
   ;; Emacs 21.1 has introduced a system with delayed mode hooks that
-  ;; require the use of the new function `run-mode-hooks'.
+  ;; requires the use of the new function `run-mode-hooks'.
   (if (cc-bytecomp-fboundp 'run-mode-hooks)
       `(run-mode-hooks ,@hooks)
     `(progn ,@(mapcar (lambda (hook) `(run-hooks ,hook)) hooks))))
@@ -785,15 +820,6 @@ Note that the style variables are always made local to the buffer."
 \f
 ;;; Change hooks, linking with Font Lock.
 
-;; Buffer local variables defining the region to be fontified by a font lock
-;; after-change function.  They are set in c-after-change to
-;; after-change-function's BEG and END, and may be modified by a
-;; `c-before-font-lock-function'.
-(defvar c-new-BEG 0)
-(make-variable-buffer-local 'c-new-BEG)
-(defvar c-new-END 0)
-(make-variable-buffer-local 'c-new-END)
-
 ;; Buffer local variables recording Beginning/End-of-Macro position before a
 ;; change, when a macro straddles, respectively, the BEG or END (or both) of
 ;; the change region.  Otherwise these have the values BEG/END.
@@ -810,16 +836,18 @@ Note that the style variables are always made local to the buffer."
   ;; has already been widened, and match-data saved.  The return value is
   ;; meaningless.
   ;;
-  ;; This function is the C/C++/ObjC value of
-  ;; `c-get-state-before-change-function' and is called exclusively as a
+  ;; This function is in the C/C++/ObjC values of
+  ;; `c-get-state-before-change-functions' and is called exclusively as a
   ;; before change function.
   (goto-char beg)
   (c-beginning-of-macro)
   (setq c-old-BOM (point))
 
   (goto-char end)
-  (if (c-beginning-of-macro)
-    (c-end-of-macro))
+  (when (c-beginning-of-macro)
+    (c-end-of-macro)
+    (or (eobp) (forward-char)))         ; Over the terminating NL which may be marked
+                                ; with a c-cpp-delimiter category property
   (setq c-old-EOM (point)))
 
 (defun c-neutralize-CPP-line (beg end)
@@ -848,7 +876,7 @@ Note that the style variables are always made local to the buffer."
              t)
             (t nil)))))))
 
-(defun c-extend-and-neutralize-syntax-in-CPP (begg endd old-len)
+(defun c-neutralize-syntax-in-and-mark-CPP (begg endd old-len)
   ;; (i) Extend the font lock region to cover all changed preprocessor
   ;; regions; it does this by setting the variables `c-new-BEG' and
   ;; `c-new-END' to the new boundaries.
@@ -857,10 +885,15 @@ Note that the style variables are always made local to the buffer."
   ;; extended changed region.  "Restore" lines which were CPP lines before the
   ;; change and are no longer so; these can be located from the Buffer local
   ;; variables `c-old-BOM' and `c-old-EOM'.
-  ;; 
+  ;;
+  ;; (iii) Mark every CPP construct by placing a `category' property value
+  ;; `c-cpp-delimiter' at its start and end.  The marked characters are the
+  ;; opening # and usually the terminating EOL, but sometimes the character
+  ;; before a comment/string delimiter.
+  ;;
   ;; That is, set syntax-table properties on characters that would otherwise
   ;; interact syntactically with those outside the CPP line(s).
-  ;; 
+  ;;
   ;; This function is called from an after-change function, BEGG ENDD and
   ;; OLD-LEN being the standard parameters.  It prepares the buffer for font
   ;; locking, hence must get called before `font-lock-after-change-function'.
@@ -871,32 +904,36 @@ Note that the style variables are always made local to the buffer."
   ;; This function is the C/C++/ObjC value of `c-before-font-lock-function'.
   ;;
   ;; Note: SPEED _MATTERS_ IN THIS FUNCTION!!!
-  ;; 
+  ;;
   ;; This function might make hidden buffer changes.
-  (c-save-buffer-state (limits mbeg+1)
+  (c-save-buffer-state (limits)
     ;; First determine the region, (c-new-BEG c-new-END), which will get font
     ;; locked.  It might need "neutralizing".  This region may not start
     ;; inside a string, comment, or macro.
     (goto-char c-old-BOM)        ; already set to old start of macro or begg.
     (setq c-new-BEG
-         (if (setq limits (c-literal-limits))
-             (cdr limits)          ; go forward out of any string or comment.
-           (point)))
+         (min c-new-BEG
+              (if (setq limits (c-state-literal-at (point)))
+                  (cdr limits)     ; go forward out of any string or comment.
+                (point))))
 
     (goto-char endd)
-    (if (setq limits (c-literal-limits))
+    (if (setq limits (c-state-literal-at (point)))
        (goto-char (car limits)))  ; go backward out of any string or comment.
     (if (c-beginning-of-macro)
        (c-end-of-macro))
-    (setq c-new-END (max (+ (- c-old-EOM old-len) (- endd begg))
-                  (point)))
+    (setq c-new-END (max c-new-END
+                        (+ (- c-old-EOM old-len) (- endd begg))
+                        (point)))
 
-    ;; Clear any existing punctuation properties.
+    ;; Clear all old relevant properties.
     (c-clear-char-property-with-value c-new-BEG c-new-END 'syntax-table '(1))
+    (c-clear-char-property-with-value c-new-BEG c-new-END 'category 'c-cpp-delimiter)
+    ;; FIXME!!!  What about the "<" and ">" category properties?  2009-11-16
 
     ;; Add needed properties to each CPP construct in the region.
     (goto-char c-new-BEG)
-    (let ((pps-position c-new-BEG)  pps-state)
+    (let ((pps-position c-new-BEG)  pps-state mbeg)
       (while (and (< (point) c-new-END)
                  (search-forward-regexp c-anchored-cpp-prefix c-new-END t))
        ;; If we've found a "#" inside a string/comment, ignore it.
@@ -905,18 +942,24 @@ Note that the style variables are always made local to the buffer."
              pps-position (point))
        (unless (or (nth 3 pps-state)   ; in a string?
                    (nth 4 pps-state))  ; in a comment?
-         (setq mbeg+1 (point))
-         (c-end-of-macro)        ; Do we need to go forward 1 char here?  No!
-         (c-neutralize-CPP-line mbeg+1 (point))
-         (setq pps-position (point))))))) ; no need to update pps-state.
+         (goto-char (match-beginning 0))
+         (setq mbeg (point))
+         (if (> (c-syntactic-end-of-macro) mbeg)
+             (progn
+               (c-neutralize-CPP-line mbeg (point))
+               (c-set-cpp-delimiters mbeg (point))
+               ;(setq pps-position (point))
+               )
+           (forward-line))           ; no infinite loop with, e.g., "#//"
+         )))))
 
 (defun c-before-change (beg end)
-  ;; Function to be put on `before-change-function'.  Primarily, this calls
-  ;; the language dependent `c-get-state-before-change-function'.  It is
+  ;; Function to be put on `before-change-functions'.  Primarily, this calls
+  ;; the language dependent `c-get-state-before-change-functions'.  It is
   ;; otherwise used only to remove stale entries from the `c-found-types'
   ;; cache, and to record entries which a `c-after-change' function might
   ;; confirm as stale.
-  ;; 
+  ;;
   ;; Note that this function must be FAST rather than accurate.  Note
   ;; also that it only has any effect when font locking is enabled.
   ;; We exploit this by checking for font-lock-*-face instead of doing
@@ -990,8 +1033,10 @@ Note that the style variables are always made local to the buffer."
        ;; larger than (beg end).
        (setq c-new-BEG beg
              c-new-END end)
-       (if c-get-state-before-change-function
-           (funcall c-get-state-before-change-function beg end))
+       (if c-get-state-before-change-functions
+           (mapc (lambda (fn)
+                   (funcall fn beg end))
+                 c-get-state-before-change-functions))
        ))))
 
 (defun c-after-change (beg end old-len)
@@ -1025,6 +1070,14 @@ Note that the style variables are always made local to the buffer."
          (when (> beg end)
            (setq beg end)))
 
+       ;; C-y is capable of spuriously converting category properties
+       ;; c-</>-as-paren-syntax into hard syntax-table properties.  Remove
+       ;; these when it happens.
+       (c-clear-char-property-with-value beg end 'syntax-table
+                                         c-<-as-paren-syntax)
+       (c-clear-char-property-with-value beg end 'syntax-table
+                                         c->-as-paren-syntax)
+
        (c-trim-found-types beg end old-len) ; maybe we don't need all of these.
        (c-invalidate-sws-region-after beg end)
        (c-invalidate-state-cache beg)
index ec9ffe346244c6a9f35fb3e330da79958f5c6cac..48120563b29eadeeb586e5a8efc2716d7326d312 100644 (file)
@@ -12,8 +12,8 @@
 ;;             1985 Richard M. Stallman
 ;; Maintainer: bug-cc-mode@gnu.org
 ;; Created:    22-Apr-1997 (split from cc-mode.el)
-;; Version:    See cc-mode.el
-;; Keywords:   c languages oop
+;; Keywords:   c languages
+;; Package:    cc-mode
 
 ;; This file is part of GNU Emacs.
 
index 82015687cb2e5714b68ad86fd06956287e2444cb..e965cc219282b85d28f7861f308bd73eda74e360 100644 (file)
@@ -12,8 +12,8 @@
 ;;             1985 Richard M. Stallman
 ;; Maintainer: bug-cc-mode@gnu.org
 ;; Created:    22-Apr-1997 (split from cc-mode.el)
-;; Version:    See cc-mode.el
-;; Keywords:   c languages oop
+;; Keywords:   c languages
+;; Package:    cc-mode
 
 ;; This file is part of GNU Emacs.
 
@@ -1056,9 +1056,13 @@ can always override the use of `c-default-style' by making calls to
        ;; Anchor pos: Boi at the topmost intro line.
        (knr-argdecl           . 0)
        ;; Anchor pos: At the beginning of the first K&R argdecl.
-       (topmost-intro         . 0)
+       (topmost-intro        . 0)
        ;; Anchor pos: Bol at the last line of previous construct.
        (topmost-intro-cont    . c-lineup-topmost-intro-cont)
+       ;;Anchor pos: Bol at the topmost annotation line
+       (annotation-top-cont   .   0)
+       ;;Anchor pos: Bol at the topmost annotation line
+       (annotation-var-cont   .   +)
        ;; Anchor pos: Boi at the topmost intro line.
        (member-init-intro     . +)
        ;; Anchor pos: Boi at the func decl arglist open.
@@ -1285,12 +1289,16 @@ Here is the current list of valid syntactic element symbols:
                            between them; in C++ and Java, throws declarations
                            and other things can appear in this context.
  knr-argdecl-intro      -- First line of a K&R C argument declaration.
- knr-argdecl            -- Subsequent lines in a K&R C argument declaration.
- topmost-intro          -- The first line in a topmost construct definition.
- topmost-intro-cont     -- Topmost definition continuation lines.
- member-init-intro      -- First line in a member initialization list.
- member-init-cont       -- Subsequent member initialization list lines.
- inher-intro            -- First line of a multiple inheritance list.
+ knr-argdecl           -- Subsequent lines in a K&R C argument declaration.
+ topmost-intro         -- The first line in a topmost construct definition.
+ topmost-intro-cont    -- Topmost definition continuation lines.
+ annotation-top-cont    -- Topmost definition continuation line where only
+                          annotations are on previous lines.
+ annotation-var-cont    -- A continuation of a C (or like) statement where
+                          only annotations are on previous lines.
+ member-init-intro     -- First line in a member initialization list.
+ member-init-cont      -- Subsequent member initialization list lines.
+ inher-intro           -- First line of a multiple inheritance list.
  inher-cont             -- Subsequent multiple inheritance lines.
  block-open             -- Statement block open brace.
  block-close            -- Statement block close brace.
@@ -1376,7 +1384,7 @@ Here is the current list of valid syntactic element symbols:
   '(defun-block-intro block-open block-close statement statement-cont
     statement-block-intro statement-case-intro statement-case-open
     substatement substatement-open substatement-label case-label label
-    do-while-closure else-clause catch-clause inlambda))
+    do-while-closure else-clause catch-clause inlambda annotation-var-cont))
 
 (defcustom c-style-variables-are-local-p t
   "*Whether style variables should be buffer local by default.
@@ -1577,7 +1585,7 @@ names)."))
   :group 'c)
 
 (defcustom java-font-lock-extra-types
-  (list (concat "[" c-upper "]\\sw*[" c-lower "]\\sw*"))
+  (list (concat "[" c-upper "]\\sw*[" c-lower "]\\sw"))
   (c-make-font-lock-extra-types-blurb "Java" "java-mode" (concat
 "For example, a value of (\"[" c-upper "]\\\\sw*[" c-lower "]\\\\sw*\") means
 capitalized words are treated as type names (the requirement for a
index c8f9834cf646ab117d0fe12c280999ccf97a739a..a909006e0c05fa4c2dc134014dbcdb6d5b4d8525 100644 (file)
@@ -196,6 +196,10 @@ of[ \t]+\"?\\([a-zA-Z]?:?[^\":\n]+\\)\"?:" 3 2 nil (1))
      "^\"\\([^,\" \n\t]+\\)\", line \\([0-9]+\\)\
 \\(?:[(. pos]+\\([0-9]+\\))?\\)?[:.,; (-]\\( warning:\\|[-0-9 ]*(W)\\)?" 1 2 3 (4))
 
+    (cucumber
+     "\\(?:^cucumber\\(?: -p [^[:space:]]+\\)?\\|#\\)\
+\\(?: \\)\\([^\(].*\\):\\([1-9][0-9]*\\)" 1 2)
+
     (edg-1
      "^\\([^ \n]+\\)(\\([0-9]+\\)): \\(?:error\\|warnin\\(g\\)\\|remar\\(k\\)\\)"
      1 2 nil (3 . 4))
@@ -223,6 +227,10 @@ of[ \t]+\"?\\([a-zA-Z]?:?[^\":\n]+\\)\"?:" 3 2 nil (1))
      "^[-[:alnum:]_/ ]+: \\(?:\\(?:[sS]evere\\|[eE]rror\\|[wW]arnin\\(g\\)\\|[iI]nf\\(o\\)\\)[0-9 ]*: \\)?\
 \\([^,\" \n\t]+\\)\\(?:, line\\|:\\) \\([0-9]+\\):" 3 4 nil (1 . 2))
 
+    (ruby
+     "^[\t ]*\\(?:from \\)?\
+\\([^\(\n][^[:space:]\n]*\\):\\([1-9][0-9]*\\)\\(:in `.*'\\)?.*$" 1 2)
+
     (java
      "^\\(?:[ \t]+at \\|==[0-9]+== +\\(?:at\\|b\\(y\\)\\)\\).+(\\([^()\n]+\\):\\([0-9]+\\))$" 2 3 nil (1))
 
@@ -325,6 +333,9 @@ during global destruction\\.$\\)" 1 2)
      "\\(?:Parse\\|Fatal\\) error: \\(.*\\) in \\(.*\\) on line \\([0-9]+\\)"
      2 3 nil nil)
 
+    (ruby-Test::Unit
+     "[\t ]*\\[\\([^\(].*\\):\\([1-9][0-9]*\\)\\(\\]\\)?:$" 1 2)
+
     (rxp
      "^\\(?:Error\\|Warnin\\(g\\)\\):.*\n.* line \\([0-9]+\\) char\
  \\([0-9]+\\) of file://\\(.+\\)"
@@ -583,6 +594,21 @@ Otherwise, it saves all modified buffers without asking."
   :type 'boolean
   :group 'compilation)
 
+(defcustom compilation-save-buffers-predicate nil
+  "The second argument (PRED) passed to `save-some-buffers' before compiling.
+E.g., one can set this to
+  (lambda ()
+    (string-prefix-p my-compilation-root (file-truename (buffer-file-name))))
+to limit saving to files located under `my-compilation-root'.
+Note, that, in general, `compilation-directory' cannot be used instead
+of `my-compilation-root' here."
+  :type '(choice
+          (const :tag "Default (save all file-visiting buffers)" nil)
+          (const :tag "Save all buffers" t)
+          function)
+  :group 'compilation
+  :version "24.1")
+
 ;;;###autoload
 (defcustom compilation-search-path '(nil)
   "List of directories to search for source files named in error messages.
@@ -733,6 +759,9 @@ Faces `compilation-error-face', `compilation-warning-face',
   "If non-nil, automatically jump to the next error encountered.")
 (make-variable-buffer-local 'compilation-auto-jump-to-next)
 
+(defvar compilation-buffer-modtime nil
+  "The buffer modification time, for buffers not associated with files.")
+(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.")
@@ -1094,7 +1123,8 @@ to a function that generates a unique name."
     (consp current-prefix-arg)))
   (unless (equal command (eval compile-command))
     (setq compile-command command))
-  (save-some-buffers (not compilation-ask-about-save) nil)
+  (save-some-buffers (not compilation-ask-about-save)
+                     compilation-save-buffers-predicate)
   (setq-default compilation-directory default-directory)
   (compilation-start command comint))
 
@@ -1105,7 +1135,8 @@ If this is run in a Compilation mode buffer, re-use the arguments from the
 original use.  Otherwise, recompile using `compile-command'.
 If the optional argument `edit-command' is non-nil, the command can be edited."
   (interactive "P")
-  (save-some-buffers (not compilation-ask-about-save) nil)
+  (save-some-buffers (not compilation-ask-about-save)
+                     compilation-save-buffers-predicate)
   (let ((default-directory (or compilation-directory default-directory)))
     (when edit-command
       (setcar compilation-arguments
@@ -1217,7 +1248,8 @@ Returns the compilation buffer created."
        ;; Then evaluate a cd command if any, but don't perform it yet, else
        ;; start-command would do it again through the shell: (cd "..") AND
        ;; sh -c "cd ..; make"
-       (cd (if (string-match "^\\s *cd\\(?:\\s +\\(\\S +?\\)\\)?\\s *[;&\n]" command)
+       (cd (if (string-match "\\`\\s *cd\\(?:\\s +\\(\\S +?\\)\\)?\\s *[;&\n]"
+                             command)
                (if (match-end 1)
                    (substitute-env-vars (match-string 1 command))
                  "~")
@@ -1244,7 +1276,8 @@ Returns the compilation buffer created."
             (set (make-local-variable 'compilation-auto-jump-to-next) t))
        ;; Output a mode setter, for saving and later reloading this buffer.
        (insert "-*- mode: " name-of-mode
-               "; default-directory: " (prin1-to-string default-directory)
+               "; default-directory: "
+                (prin1-to-string (abbreviate-file-name default-directory))
                " -*-\n"
                (format "%s started at %s\n\n"
                        mode-name
@@ -1566,6 +1599,7 @@ Runs `compilation-mode-hook' with `run-mode-hooks' (which see).
        mode-name (or name-of-mode "Compilation"))
   (set (make-local-variable 'page-delimiter)
        compilation-page-delimiter)
+  (set (make-local-variable 'compilation-buffer-modtime) nil)
   (compilation-setup)
   (setq buffer-read-only t)
   (run-mode-hooks 'compilation-mode-hook))
@@ -1781,6 +1815,7 @@ and runs `compilation-filter-hook'."
               (unless comint-inhibit-carriage-motion
                 (comint-carriage-motion (process-mark proc) (point)))
               (set-marker (process-mark proc) (point))
+              (set (make-local-variable 'compilation-buffer-modtime) (current-time))
               (run-hooks 'compilation-filter-hook))
          (goto-char pos)
           (narrow-to-region min max)
@@ -1950,16 +1985,11 @@ This is the value of `next-error-function' in Compilation buffers."
     ;; (`omake -P' polls filesystem for changes and recompiles when needed
     ;;  in the same process and buffer).
     ;; So, recalculate all markers for that file.
-    (unless (and (nth 3 loc) (marker-buffer (nth 3 loc))
-                 ;; There may be no timestamp info if the loc is a `fake-loc'.
-                 ;; So we skip the time-check here, although we should maybe
-                 ;; change `compilation-fake-loc' to add timestamp info.
-                 (or (null (nth 4 loc))
-                     (equal (nth 4 loc)
-                            (setq timestamp
-                                  (with-current-buffer
-                                      (marker-buffer (nth 3 loc))
-                                    (visited-file-modtime))))))
+    (unless (and (nth 3 loc) (marker-buffer (nth 3 loc)) (nthcdr 4 loc)
+                 ;; There may be no timestamp info if the loc is a `fake-loc',
+                 ;; but we just checked that the file has been visited before!
+                 (equal (nth 4 loc)
+                        (setq timestamp compilation-buffer-modtime)))
       (with-current-buffer (compilation-find-file marker (caar (nth 2 loc))
                                                  (cadr (car (nth 2 loc))))
        (save-restriction
@@ -2064,7 +2094,7 @@ and overlay is highlighted between MK and END-MK."
                 pre-existing
               (let ((display-buffer-reuse-frames t)
                     (pop-up-windows t))
-               ;; Pop up a window.
+               ;; Pop up a window.
                 (display-buffer (marker-buffer msg)))))
         (highlight-regexp (with-current-buffer (marker-buffer msg)
                             ;; also do this while we change buffer
index 2f751f2a0dc2f3c5f72f04eb2ad2a4e5d9cc77c1..d69cce76faa86f0a6a35785ce62a02d8d89e269d 100644 (file)
@@ -8980,6 +8980,18 @@ do extra unwind via `cperl-unwind-to-safe'."
     (substring v (match-beginning 1) (match-end 1)))
   "Version of IZ-supported CPerl package this file is based on.")
 
+(defun cperl-mode-unload-function ()
+  "Unload the Cperl mode library."
+  (let ((new-mode (if (eq (symbol-function 'perl-mode) 'cperl-mode)
+                     'fundamental-mode
+                   'perl-mode)))
+    (dolist (buf (buffer-list))
+      (with-current-buffer buf
+       (when (eq major-mode 'cperl-mode)
+         (funcall new-mode)))))
+  ;; continue standard unloading
+  nil)
+
 (provide 'cperl-mode)
 
 ;; arch-tag: 42e5b19b-e187-4537-929f-1a7408980ce6
index e4b380995d5eb7c31ed26b1d1b2df9c2528e9ecd..00c11086ce1cdeb55486ba7a9d89216fd55529a0 100644 (file)
@@ -6,7 +6,7 @@
 ;; Author: Anders Lindgren <andersl@andersl.com>
 ;; Keywords: c, languages, faces
 ;; X-Url: http://www.andersl.com/emacs
-;; Version: 1.3.1  1999-12-13
+;; Version: 1.3.1
 
 ;; This file is part of GNU Emacs.
 
index 04a04184ed245cc673524a0620961d9c7571ecb2..ead8b5db38f06cf4d8145dc4336b952a8ce3707a 100644 (file)
@@ -1549,13 +1549,11 @@ Also remove the continuation mark if easily detected."
   (interactive "*P")
   (delete-indentation arg)
   (let ((type (dcl-get-line-type)))
-    (if (and (or (equal type '$)
-                (equal type '-)
-                (equal type 'empty-$))
+    (if (and (member type '($ - empty-$))
             (not (bobp))
-            (= (char-after (1- (point))) ?-))
+            (= (char-before) ?-))
        (progn
-         (delete-backward-char 1)
+         (delete-char -1)
          (fixup-whitespace)))))
 
 
index 1e5f1f506b3235806388ca1c55cbbfbbc282a304..2558456bc077ebc300e0f0ea333972dd6d8350f4 100644 (file)
@@ -628,7 +628,9 @@ routine.")
 (defun delphi-token-at (p)
   ;; Returns the token from parsing text at point p.
   (when (and (<= (point-min) p) (<= p (point-max)))
-     (cond ((delphi-literal-token-at p))
+     (cond ((delphi-char-token-at p ?\n 'newline))
+
+           ((delphi-literal-token-at p))
 
            ((delphi-space-token-at p))
 
@@ -638,7 +640,6 @@ routine.")
            ((delphi-char-token-at p ?\) 'close-group))
            ((delphi-char-token-at p ?\[ 'open-group))
            ((delphi-char-token-at p ?\] 'close-group))
-           ((delphi-char-token-at p ?\n 'newline))
            ((delphi-char-token-at p ?\; 'semicolon))
            ((delphi-char-token-at p ?. 'dot))
            ((delphi-char-token-at p ?, 'comma))
@@ -888,7 +889,24 @@ non-delphi buffer. Set to nil in a delphi buffer.  To override, just do:
           (setq token (delphi-block-start token)))
 
          ;; Regular block start found.
-         ((delphi-is token-kind delphi-block-statements) (throw 'done token))
+         ((delphi-is token-kind delphi-block-statements)
+          (throw 'done
+                 ;; As a special case, when a "case" block appears
+                 ;; within a record declaration (to denote a variant
+                 ;; part), the record declaration should be considered
+                 ;; the enclosing block.
+                 (if (eq 'case token-kind)
+                     (let ((enclosing-token
+                            (delphi-block-start token
+                                                'stop-on-class)))
+                       (if
+                           (eq 'record
+                               (delphi-token-kind enclosing-token))
+                           (if stop-on-class
+                               enclosing-token
+                             (delphi-previous-token enclosing-token))
+                         token))
+                   token)))
 
          ;; A class/record start also begins a block.
          ((delphi-composite-type-start token last-token)
@@ -1058,6 +1076,7 @@ non-delphi buffer. Set to nil in a delphi buffer.  To override, just do:
         (token-kind nil)
         (from-kind (delphi-token-kind from-token))
         (last-colon nil)
+        (last-of nil)
         (last-token nil))
     (catch 'done
       (while token
@@ -1101,9 +1120,17 @@ non-delphi buffer. Set to nil in a delphi buffer.  To override, just do:
          ;; Ignore whitespace.
          ((delphi-is token-kind delphi-whitespace))
 
-         ;; Remember any ':' we encounter, since that affects how we indent to
-         ;; a case statement.
-         ((eq 'colon token-kind) (setq last-colon token))
+         ;; Remember any "of" we encounter, since that affects how we
+         ;; indent to a case statement within a record declaration
+         ;; (i.e. a variant part).
+         ((eq 'of token-kind)
+          (setq last-of token))
+
+         ;; Remember any ':' we encounter (until we reach an "of"),
+         ;; since that affects how we indent to case statements in
+         ;; general.
+         ((eq 'colon token-kind)
+          (unless last-of (setq last-colon token)))
 
          ;; A case statement delimits a previous statement. We indent labels
          ;; specially.
index 17173bd0458f5df24b4f6d07244197478c99a711..a8741a30cf2aadd7b9622629f7a6384673411233 100644 (file)
@@ -7,6 +7,7 @@
 ;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br>
 ;; Keywords: wp, ebnf, PostScript
 ;; Version: 1.2
+;; Package: ebnf2ps
 
 ;; This file is part of GNU Emacs.
 
index 3c71f29b2360bcc6626f6efea17d332035608233..45f2fe727e876107821d9a4cf743e8046031ebd8 100644 (file)
@@ -7,6 +7,7 @@
 ;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br>
 ;; Keywords: wp, ebnf, PostScript
 ;; Version: 1.10
+;; Package: ebnf2ps
 
 ;; This file is part of GNU Emacs.
 
index 2bd527a022217df6cc5165cf47b6e022ac2401dd..2ca38406d4f86fb6c35bfbc02b47c34e85c619ab 100644 (file)
@@ -7,6 +7,7 @@
 ;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br>
 ;; Keywords: wp, ebnf, PostScript
 ;; Version: 1.1
+;; Package: ebnf2ps
 
 ;; This file is part of GNU Emacs.
 
index 901c80a7225f8cfb7b17e2fc850d3c7671d85130..dd94f9e638afc3311300f366f305d47b4a9975c1 100644 (file)
@@ -7,6 +7,7 @@
 ;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br>
 ;; Keywords: wp, ebnf, PostScript
 ;; Version: 1.2
+;; Package: ebnf2ps
 
 ;; This file is part of GNU Emacs.
 
index ad5683cb7f5945fc4757f49c48815d54e85e680c..fa1592bb17f0540e4de320546156a6a96624bf40 100644 (file)
@@ -7,6 +7,7 @@
 ;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br>
 ;; Keywords: wp, ebnf, PostScript
 ;; Version: 1.9
+;; Package: ebnf2ps
 
 ;; This file is part of GNU Emacs.
 
index a9c4838d9e1107302ed261e21ba08274349a37b5..b005d95a80683fc2e5d482762b34ef50c37047b6 100644 (file)
@@ -7,6 +7,7 @@
 ;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br>
 ;; Keywords: wp, ebnf, PostScript
 ;; Version: 1.0
+;; Package: ebnf2ps
 
 ;; This file is part of GNU Emacs.
 
index e2a35dbc9435ebfb48af7fe48848cd72ad23d54b..a7f1851cffb496f9e2c865e1a0650ed57290192f 100644 (file)
@@ -7,6 +7,7 @@
 ;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br>
 ;; Keywords: wp, ebnf, PostScript
 ;; Version: 1.4
+;; Package: ebnf2ps
 
 ;; This file is part of GNU Emacs.
 
index 23e175cbe7d67509c403af8b79e6cdd1a5a888fd..2018a71574ec4d2ada7b55a053bb600d4a88f005 100644 (file)
@@ -40,6 +40,7 @@ If you set this variable, do not also set `tags-table-list'.
 Use the `etags' program to make a tags table file.")
 ;; Make M-x set-variable tags-file-name like M-x visit-tags-table.
 ;;;###autoload (put 'tags-file-name 'variable-interactive (purecopy "fVisit tags table: "))
+;;;###autoload (put 'tags-file-name 'safe-local-variable 'stringp)
 
 (defgroup etags nil "Tags tables."
   :group 'tools)
@@ -423,9 +424,9 @@ Returns non-nil if it is a valid table."
   (if (get-file-buffer file)
       ;; The file is already in a buffer.  Check for the visited file
       ;; having changed since we last used it.
-      (let (win)
+      (progn
        (set-buffer (get-file-buffer file))
-       (setq win (or verify-tags-table-function (tags-table-mode)))
+        (or verify-tags-table-function (tags-table-mode))
        (if (or (verify-visited-file-modtime (current-buffer))
                ;; Decide whether to revert the file.
                ;; revert-without-query can say to revert
@@ -787,6 +788,30 @@ tags table and its (recursively) included tags tables."
           (let ((enable-recursive-minibuffers t))
             (visit-tags-table-buffer))
           (complete-with-action action (tags-completion-table) string pred))))))
+
+;;;###autoload (defun tags-completion-at-point-function ()
+;;;###autoload   (if (or tags-table-list tags-file-name)
+;;;###autoload       (progn
+;;;###autoload         (load "etags")
+;;;###autoload         (tags-completion-at-point-function))))
+
+(defun tags-completion-at-point-function ()
+  "Using tags, return a completion table for the text around point.
+If no tags table is loaded, do nothing and return nil."
+  (when (or tags-table-list tags-file-name)
+    (let ((completion-ignore-case (if (memq tags-case-fold-search '(t nil))
+                                     tags-case-fold-search
+                                   case-fold-search))
+         (pattern (funcall (or find-tag-default-function
+                               (get major-mode 'find-tag-default-function)
+                               'find-tag-default)))
+         beg)
+      (when pattern
+       (save-excursion
+         (search-backward pattern) ;FIXME: will fail if we're inside pattern.
+         (setq beg (point))
+         (forward-char (length pattern))
+         (list beg (point) (tags-lazy-completion-table)))))))
 \f
 (defun find-tag-tag (string)
   "Read a tag name, with defaulting and completion."
@@ -2039,20 +2064,10 @@ for \\[find-tag] (which see)."
       (error "%s"
             (substitute-command-keys
              "No tags table loaded; try \\[visit-tags-table]")))
-  (let ((completion-ignore-case (if (memq tags-case-fold-search '(t nil))
-                                   tags-case-fold-search
-                                 case-fold-search))
-       (pattern (funcall (or find-tag-default-function
-                             (get major-mode 'find-tag-default-function)
-                             'find-tag-default)))
-        (comp-table (tags-lazy-completion-table))
-       beg)
-    (or pattern
-       (error "Nothing to complete"))
-    (search-backward pattern)
-    (setq beg (point))
-    (forward-char (length pattern))
-    (completion-in-region beg (point) comp-table)))
+  (let ((comp-data (tags-completion-at-point-function)))
+    (if (null comp-data)
+       (error "Nothing to complete")
+      (apply 'completion-in-region comp-data))))
 
 (dolist (x '("^No tags table in use; use .* to select one$"
             "^There is no default tag$"
index 0a3c96d789428e9b119f2924a10beef5e34e90af..64c716208e9ea15ff2124c546b4a8822a27f10ba 100644 (file)
@@ -1008,7 +1008,7 @@ Set subexpression 1 in the match-data to the name of the type."
   :regexp "\\(?:[^[:word:]_`]\\|^\\)\\(`?[[:word:]_]+\\)[^[:word:]_]*")
 \f
 ;;;###autoload
-(defun f90-mode ()
+(define-derived-mode f90-mode prog-mode "F90"
   "Major mode for editing Fortran 90,95 code in free format.
 For fixed format code, use `fortran-mode'.
 
@@ -1065,13 +1065,9 @@ Variables controlling indentation style and extra features:
 
 Turning on F90 mode calls the value of the variable `f90-mode-hook'
 with no args, if that value is non-nil."
-  (interactive)
-  (kill-all-local-variables)
-  (setq major-mode 'f90-mode
-        mode-name "F90"
-        local-abbrev-table f90-mode-abbrev-table)
-  (set-syntax-table f90-mode-syntax-table)
-  (use-local-map f90-mode-map)
+  :group 'f90
+  :syntax-table f90-mode-syntax-table
+  :abbrev-table f90-mode-abbrev-table
   (set (make-local-variable 'indent-line-function) 'f90-indent-line)
   (set (make-local-variable 'indent-region-function) 'f90-indent-region)
   (set (make-local-variable 'require-final-newline) mode-require-final-newline)
@@ -1094,8 +1090,7 @@ with no args, if that value is non-nil."
        'f90-beginning-of-subprogram)
   (set (make-local-variable 'end-of-defun-function) 'f90-end-of-subprogram)
   (set (make-local-variable 'add-log-current-defun-function)
-       #'f90-current-defun)
-  (run-mode-hooks 'f90-mode-hook))
+       #'f90-current-defun))
 
 \f
 ;; Inline-functions.
index 3784ba787c4fbae998fe6f8db5e51170256f7466..c37744bfe454b0d4bdf77962092fe4057bb48bb8 100644 (file)
@@ -778,7 +778,7 @@ Used in the Fortran entry in `hs-special-modes-alist'.")
 
 \f
 ;;;###autoload
-(defun fortran-mode ()
+(define-derived-mode fortran-mode prog-mode "Fortran"
   "Major mode for editing Fortran code in fixed format.
 For free format code, use `f90-mode'.
 
@@ -848,13 +848,9 @@ Variables controlling indentation style and extra features:
 
 Turning on Fortran mode calls the value of the variable `fortran-mode-hook'
 with no args, if that value is non-nil."
-  (interactive)
-  (kill-all-local-variables)
-  (setq major-mode 'fortran-mode
-        mode-name "Fortran"
-        local-abbrev-table fortran-mode-abbrev-table)
-  (set-syntax-table fortran-mode-syntax-table)
-  (use-local-map fortran-mode-map)
+  :group 'fortran
+  :syntax-table fortran-mode-syntax-table
+  :abbrev-table fortran-mode-abbrev-table
   (set (make-local-variable 'indent-line-function) 'fortran-indent-line)
   (set (make-local-variable 'indent-region-function)
        (lambda (start end)
@@ -906,8 +902,7 @@ with no args, if that value is non-nil."
        #'fortran-current-defun)
   (set (make-local-variable 'dabbrev-case-fold-search) 'case-fold-search)
   (set (make-local-variable 'gud-find-expr-function) 'fortran-gud-find-expr)
-  (add-hook 'hack-local-variables-hook 'fortran-hack-local-variables nil t)
-  (run-mode-hooks 'fortran-mode-hook))
+  (add-hook 'hack-local-variables-hook 'fortran-hack-local-variables nil t))
 
 \f
 (defun fortran-line-length (nchars &optional global)
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
new file mode 100644 (file)
index 0000000..5b98ff4
--- /dev/null
@@ -0,0 +1,4195 @@
+;;; gdb-mi.el --- User Interface for running GDB
+
+;; Copyright (C) 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
+
+;; Author: Nick Roberts <nickrob@gnu.org>
+;; Maintainer: FSF
+;; Keywords: unix, tools
+
+;; This file is part of GNU Emacs.
+
+;; Homepage: http://www.emacswiki.org/emacs/GDB-MI
+
+;; 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/>.
+
+;;; Credits:
+
+;; This file was written by by Nick Roberts following the general design
+;; used in gdb-ui.el for Emacs 22.1 - 23.1.  It is currently being developed
+;; by Dmitry Dzhus <dima@sphinx.net.ru> as part of the Google Summer
+;; of Code 2009 Project "Emacs GDB/MI migration".
+
+;;; Commentary:
+
+;; This mode acts as a graphical user interface to GDB.  You can interact with
+;; GDB through the GUD buffer in the usual way, but there are also further
+;; buffers which control the execution and describe the state of your program.
+;; It separates the input/output of your program from that of GDB and displays
+;; expressions and their current values in their own buffers.  It also uses
+;; features of Emacs 21 such as the fringe/display margin for breakpoints, and
+;; the toolbar (see the GDB Graphical Interface section in the Emacs info
+;; manual).
+
+;; M-x gdb will start the debugger.
+
+;; This file uses GDB/MI as the primary interface to GDB.  It is still under
+;; development and is part of a process to migrate Emacs from annotations (as
+;; used in gdb-ui.el) to GDB/MI.  It runs gdb with GDB/MI (-interp=mi) and
+;; access CLI using "-interpreter-exec console cli-command".  This code works
+;; without gdb-ui.el and uses MI tokens instead of queues. Eventually MI
+;; should be asynchronous.
+
+;; This mode will PARTLY WORK WITH RECENT GDB RELEASES (status in modeline
+;; doesn't update properly when execution commands are issued from GUD buffer)
+;; and WORKS BEST when GDB runs asynchronously: maint set linux-async on.
+;;
+;; You need development version of GDB 7.0 for the thread buffer to work.
+
+;; This file replaces gdb-ui.el and is for development with GDB.  Use the
+;; release branch of Emacs 22 for the latest version of gdb-ui.el.
+
+;; Windows Platforms:
+
+;; If you are using Emacs and GDB on Windows you will need to flush the buffer
+;; explicitly in your program if you want timely display of I/O in Emacs.
+;; Alternatively you can make the output stream unbuffered, for example, by
+;; using a macro:
+
+;;           #ifdef UNBUFFERED
+;;          setvbuf (stdout, (char *) NULL, _IONBF, 0);
+;;          #endif
+
+;; and compiling with -DUNBUFFERED while debugging.
+
+;; If you are using Cygwin GDB and find that the source is not being displayed
+;; in Emacs when you step through it, possible solutions are to:
+
+;;   1) Use Cygwin X Windows and Cygwin Emacs.
+;;        (Since 22.1 Emacs builds under Cygwin.)
+;;   2) Use MinGW GDB instead.
+;;   3) Use cygwin-mount.el
+
+;;; Mac OSX:
+
+;; GDB in Emacs on Mac OSX works best with FSF GDB as Apple have made
+;; some changes to the version that they include as part of Mac OSX.
+;; This requires GDB version 7.0 or later (estimated release date Aug 2009)
+;; as earlier versions don not compile on Mac OSX.
+
+;;; Known Bugs:
+
+;; 1) Stack buffer doesn't parse MI output if you stop in a routine without
+;;    line information, e.g., a routine in libc (just a TODO item).
+
+;; TODO:
+;; 2) Watch windows to work with threads.
+;; 3) Use treebuffer.el instead of the speedbar for watch-expressions?
+;; 4) Mark breakpoint locations on scroll-bar of source buffer?
+
+;;; Code:
+
+(require 'gud)
+(require 'json)
+(require 'bindat)
+(eval-when-compile (require 'cl))
+
+(defvar tool-bar-map)
+(defvar speedbar-initial-expansion-list-name)
+(defvar speedbar-frame)
+
+(defvar        gdb-memory-address "main")
+(defvar        gdb-memory-last-address nil
+  "Last successfully accessed memory address.")
+(defvar        gdb-memory-next-page nil
+  "Address of next memory page for program memory buffer.")
+(defvar        gdb-memory-prev-page nil
+  "Address of previous memory page for program memory buffer.")
+
+(defvar gdb-thread-number nil
+  "Main current thread.
+
+Invalidation triggers use this variable to query GDB for
+information on the specified thread by wrapping GDB/MI commands
+in `gdb-current-context-command'.
+
+This variable may be updated implicitly by GDB via `gdb-stopped'
+or explicitly by `gdb-select-thread'.
+
+Only `gdb-setq-thread-number' should be used to change this
+value.")
+
+(defvar gdb-frame-number nil
+  "Selected frame level for main current thread.
+
+Updated according to the following rules:
+
+When a thread is selected or current thread stops, set to \"0\".
+
+When current thread goes running (and possibly exits eventually),
+set to nil.
+
+May be manually changed by user with `gdb-select-frame'.")
+
+(defvar gdb-frame-address nil "Identity of frame for watch expression.")
+
+;; Used to show overlay arrow in source buffer. All set in
+;; gdb-get-main-selected-frame. Disassembly buffer should not use
+;; these but rely on buffer-local thread information instead.
+(defvar gdb-selected-frame nil
+  "Name of selected function for main current thread.")
+(defvar gdb-selected-file nil
+  "Name of selected file for main current thread.")
+(defvar gdb-selected-line nil
+  "Number of selected line for main current thread.")
+
+(defvar gdb-threads-list nil
+  "Associative list of threads provided by \"-thread-info\" MI command.
+
+Keys are thread numbers (in strings) and values are structures as
+returned from -thread-info by `gdb-json-partial-output'. Updated in
+`gdb-thread-list-handler-custom'.")
+
+(defvar gdb-running-threads-count nil
+  "Number of currently running threads.
+
+Nil means that no information is available.
+
+Updated in `gdb-thread-list-handler-custom'.")
+
+(defvar gdb-stopped-threads-count nil
+  "Number of currently stopped threads.
+
+See also `gdb-running-threads-count'.")
+
+(defvar gdb-breakpoints-list nil
+  "Associative list of breakpoints provided by \"-break-list\" MI command.
+
+Keys are breakpoint numbers (in string) and values are structures
+as returned from \"-break-list\" by `gdb-json-partial-output'
+\(\"body\" field is used). Updated in
+`gdb-breakpoints-list-handler-custom'.")
+
+(defvar gdb-current-language nil)
+(defvar gdb-var-list nil
+  "List of variables in watch window.
+Each element has the form (VARNUM EXPRESSION NUMCHILD TYPE VALUE STATUS HAS_MORE FP)
+where STATUS is nil (`unchanged'), `changed' or `out-of-scope', FP the frame
+address for root variables.")
+(defvar gdb-main-file nil "Source file from which program execution begins.")
+
+;; Overlay arrow markers
+(defvar gdb-stack-position nil)
+(defvar gdb-thread-position nil)
+(defvar gdb-disassembly-position nil)
+
+(defvar gdb-location-alist nil
+  "Alist of breakpoint numbers and full filenames.  Only used for files that
+Emacs can't find.")
+(defvar gdb-active-process nil
+  "GUD tooltips display variable values when t, and macro definitions otherwise.")
+(defvar gdb-error "Non-nil when GDB is reporting an error.")
+(defvar gdb-macro-info nil
+  "Non-nil if GDB knows that the inferior includes preprocessor macro info.")
+(defvar gdb-register-names nil "List of register names.")
+(defvar gdb-changed-registers nil
+  "List of changed register numbers (strings).")
+(defvar gdb-buffer-fringe-width nil)
+(defvar gdb-last-command nil)
+(defvar gdb-prompt-name nil)
+(defvar gdb-token-number 0)
+(defvar gdb-handler-alist '())
+(defvar gdb-handler-number nil)
+(defvar gdb-source-file-list nil
+  "List of source files for the current executable.")
+(defvar gdb-first-done-or-error t)
+(defvar gdb-source-window nil)
+(defvar gdb-inferior-status nil)
+(defvar gdb-continuation nil)
+(defvar gdb-version nil)
+(defvar gdb-filter-output nil
+  "Message to be shown in GUD console.
+
+This variable is updated in `gdb-done-or-error' and returned by
+`gud-gdbmi-marker-filter'.")
+
+(defvar gdb-non-stop nil
+  "Indicates whether current GDB session is using non-stop mode.
+
+It is initialized to `gdb-non-stop-setting' at the beginning of
+every GDB session.")
+
+(defvar gdb-buffer-type nil
+  "One of the symbols bound in `gdb-buffer-rules'.")
+(make-variable-buffer-local 'gdb-buffer-type)
+
+(defvar gdb-output-sink 'nil
+  "The disposition of the output of the current gdb command.
+Possible values are these symbols:
+
+    `user' -- gdb output should be copied to the GUD buffer
+              for the user to see.
+
+    `emacs' -- output should be collected in the partial-output-buffer
+              for subsequent processing by a command.  This is the
+              disposition of output generated by commands that
+              gdb mode sends to gdb on its own behalf.")
+
+;; Pending triggers prevent congestion: Emacs won't send two similar
+;; consecutive requests.
+
+(defvar gdb-pending-triggers '()
+  "A list of trigger functions which have not yet been handled.
+
+Elements are either function names or pairs (buffer . function)")
+
+(defmacro gdb-add-pending (item)
+  `(push ,item gdb-pending-triggers))
+(defmacro gdb-pending-p (item)
+  `(member ,item gdb-pending-triggers))
+(defmacro gdb-delete-pending (item)
+  `(setq gdb-pending-triggers
+         (delete ,item gdb-pending-triggers)))
+
+(defmacro gdb-wait-for-pending (&rest body)
+  "Wait until `gdb-pending-triggers' is empty and evaluate FORM.
+
+This function checks `gdb-pending-triggers' value every
+`gdb-wait-for-pending' seconds."
+  (run-with-timer
+   0.5 nil
+   `(lambda ()
+      (if (not gdb-pending-triggers)
+          (progn ,@body)
+        (gdb-wait-for-pending ,@body)))))
+
+;; Publish-subscribe
+
+(defmacro gdb-add-subscriber (publisher subscriber)
+  "Register new PUBLISHER's SUBSCRIBER.
+
+SUBSCRIBER must be a pair, where cdr is a function of one
+argument (see `gdb-emit-signal')."
+  `(add-to-list ',publisher ,subscriber t))
+
+(defmacro gdb-delete-subscriber (publisher subscriber)
+  "Unregister SUBSCRIBER from PUBLISHER."
+  `(setq ,publisher (delete ,subscriber
+                            ,publisher)))
+
+(defun gdb-get-subscribers (publisher)
+  publisher)
+
+(defun gdb-emit-signal (publisher &optional signal)
+  "Call cdr for each subscriber of PUBLISHER with SIGNAL as argument."
+  (dolist (subscriber (gdb-get-subscribers publisher))
+    (funcall (cdr subscriber) signal)))
+
+(defvar gdb-buf-publisher '()
+  "Used to invalidate GDB buffers by emitting a signal in
+`gdb-update'.
+
+Must be a list of pairs with cars being buffers and cdr's being
+valid signal handlers.")
+
+(defgroup gdb nil
+  "GDB graphical interface"
+  :group 'tools
+  :link '(info-link "(emacs)GDB Graphical Interface")
+  :version "23.2")
+
+(defgroup gdb-non-stop nil
+  "GDB non-stop debugging settings"
+  :group 'gdb
+  :version "23.2")
+
+(defgroup gdb-buffers nil
+  "GDB buffers"
+  :group 'gdb
+  :version "23.2")
+
+(defcustom gdb-debug-log-max 128
+  "Maximum size of `gdb-debug-log'.  If nil, size is unlimited."
+  :group 'gdb
+  :type '(choice (integer :tag "Number of elements")
+                (const   :tag "Unlimited" nil))
+  :version "22.1")
+
+(defcustom gdb-non-stop-setting t
+  "When in non-stop mode, stopped threads can be examined while
+other threads continue to execute.
+
+GDB session needs to be restarted for this setting to take
+effect."
+  :type 'boolean
+  :group 'gdb-non-stop
+  :version "23.2")
+
+;; TODO Some commands can't be called with --all (give a notice about
+;; it in setting doc)
+(defcustom gdb-gud-control-all-threads t
+  "When enabled, GUD execution commands affect all threads when
+in non-stop mode. Otherwise, only current thread is affected."
+  :type 'boolean
+  :group 'gdb-non-stop
+  :version "23.2")
+
+(defcustom gdb-switch-reasons t
+  "List of stop reasons which cause Emacs to switch to the thread
+which caused the stop. When t, switch to stopped thread no matter
+what the reason was. When nil, never switch to stopped thread
+automatically.
+
+This setting is used in non-stop mode only. In all-stop mode,
+Emacs always switches to the thread which caused the stop."
+  ;; exited, exited-normally and exited-signalled are not
+  ;; thread-specific stop reasons and therefore are not included in
+  ;; this list
+  :type '(choice
+          (const :tag "All reasons" t)
+          (set :tag "Selection of reasons..."
+               (const :tag "A breakpoint was reached." "breakpoint-hit")
+               (const :tag "A watchpoint was triggered." "watchpoint-trigger")
+               (const :tag "A read watchpoint was triggered." "read-watchpoint-trigger")
+               (const :tag "An access watchpoint was triggered." "access-watchpoint-trigger")
+               (const :tag "Function finished execution." "function-finished")
+               (const :tag "Location reached." "location-reached")
+               (const :tag "Watchpoint has gone out of scope" "watchpoint-scope")
+               (const :tag "End of stepping range reached." "end-stepping-range")
+               (const :tag "Signal received (like interruption)." "signal-received"))
+          (const :tag "None" nil))
+  :group 'gdb-non-stop
+  :version "23.2"
+  :link '(info-link "(gdb)GDB/MI Async Records"))
+
+(defcustom gdb-stopped-hooks nil
+  "This variable holds a list of functions to be called whenever
+GDB stops.
+
+Each function takes one argument, a parsed MI response, which
+contains fields of corresponding MI *stopped async record:
+
+    ((stopped-threads . \"all\")
+     (thread-id . \"1\")
+     (frame (line . \"38\")
+            (fullname . \"/home/sphinx/projects/gsoc/server.c\")
+            (file . \"server.c\")
+            (args ((value . \"0x804b038\")
+                   (name . \"arg\")))
+            (func . \"hello\")
+            (addr . \"0x0804869e\"))
+     (reason . \"end-stepping-range\"))
+
+Note that \"reason\" is only present in non-stop debugging mode.
+
+`bindat-get-field' may be used to access the fields of response.
+
+Each function is called after the new current thread was selected
+and GDB buffers were updated in `gdb-stopped'."
+  :type '(repeat function)
+  :group 'gdb
+  :version "23.2"
+  :link '(info-link "(gdb)GDB/MI Async Records"))
+
+(defcustom gdb-switch-when-another-stopped t
+  "When nil, Emacs won't switch to stopped thread if some other
+stopped thread is already selected."
+  :type 'boolean
+  :group 'gdb-non-stop
+  :version "23.2")
+
+(defcustom gdb-stack-buffer-locations t
+  "Show file information or library names in stack buffers."
+  :type 'boolean
+  :group 'gdb-buffers
+  :version "23.2")
+
+(defcustom gdb-stack-buffer-addresses nil
+  "Show frame addresses in stack buffers."
+  :type 'boolean
+  :group 'gdb-buffers
+  :version "23.2")
+
+(defcustom gdb-thread-buffer-verbose-names t
+  "Show long thread names in threads buffer."
+  :type 'boolean
+  :group 'gdb-buffers
+  :version "23.2")
+
+(defcustom gdb-thread-buffer-arguments t
+  "Show function arguments in threads buffer."
+  :type 'boolean
+  :group 'gdb-buffers
+  :version "23.2")
+
+(defcustom gdb-thread-buffer-locations t
+  "Show file information or library names in threads buffer."
+  :type 'boolean
+  :group 'gdb-buffers
+  :version "23.2")
+
+(defcustom gdb-thread-buffer-addresses nil
+  "Show addresses for thread frames in threads buffer."
+  :type 'boolean
+  :group 'gdb-buffers
+  :version "23.2")
+
+(defcustom gdb-show-threads-by-default nil
+  "Show threads list buffer instead of breakpoints list by
+default."
+  :type 'boolean
+  :group 'gdb-buffers
+  :version "23.2")
+
+(defvar gdb-debug-log nil
+  "List of commands sent to and replies received from GDB.
+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
+  :group 'gdb
+  :version "22.1")
+
+(defcustom gdb-cpp-define-alist-program "gcc -E -dM -"
+  "Shell command for generating a list of defined macros in a source file.
+This list is used to display the #define directive associated
+with an identifier as a tooltip.  It works in a debug session with
+GDB, when `gud-tooltip-mode' is t.
+
+Set `gdb-cpp-define-alist-flags' for any include paths or
+predefined macros."
+  :type 'string
+  :group 'gdb
+  :version "22.1")
+
+(defcustom gdb-cpp-define-alist-flags ""
+  "Preprocessor flags for `gdb-cpp-define-alist-program'."
+  :type 'string
+  :group 'gdb
+  :version "22.1")
+
+ (defcustom gdb-create-source-file-list t
+   "Non-nil means create a list of files from which the executable was built.
+ Set this to nil if the GUD buffer displays \"initializing...\" in the mode
+ line for a long time when starting, possibly because your executable was
+ built from a large number of files.  This allows quicker initialization
+ but means that these files are not automatically enabled for debugging,
+ e.g., you won't be able to click in the fringe to set a breakpoint until
+ execution has already stopped there."
+   :type 'boolean
+   :group 'gdb
+   :version "23.1")
+
+(defcustom gdb-show-main nil
+  "Non-nil means display source file containing the main routine at startup.
+Also display the main routine in the disassembly buffer if present."
+  :type 'boolean
+  :group 'gdb
+  :version "22.1")
+
+(defun gdb-force-mode-line-update (status)
+  (let ((buffer gud-comint-buffer))
+    (if (and buffer (buffer-name buffer))
+       (with-current-buffer buffer
+         (setq mode-line-process
+               (format ":%s [%s]"
+                       (process-status (get-buffer-process buffer)) status))
+         ;; 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."
+  (interactive)
+  (setq gdb-gud-control-all-threads t)
+  ;; Actually forcing the tool-bar to update.
+  (force-mode-line-update)
+  (message "Now in non-stop/A mode."))
+
+(defun gdb-control-current-thread ()
+  "Switch to non-stop/T mode."
+  (interactive)
+  (setq gdb-gud-control-all-threads nil)
+  ;; Actually forcing the tool-bar to update.
+  (force-mode-line-update)
+  (message "Now in non-stop/T mode."))
+
+(defun gdb-find-watch-expression ()
+  (let* ((var (nth (- (line-number-at-pos (point)) 2) gdb-var-list))
+        (varnum (car var)) expr array)
+    (string-match "\\(var[0-9]+\\)\\.\\(.*\\)" varnum)
+    (let ((var1 (assoc (match-string 1 varnum) gdb-var-list)) var2 varnumlet
+         (component-list (split-string (match-string 2 varnum) "\\." t)))
+      (setq expr (nth 1 var1))
+      (setq varnumlet (car var1))
+      (dolist (component component-list)
+       (setq var2 (assoc varnumlet gdb-var-list))
+       (setq expr (concat expr
+                          (if (string-match ".*\\[[0-9]+\\]$" (nth 3 var2))
+                              (concat "[" component "]")
+                            (concat "." component))))
+       (setq varnumlet (concat varnumlet "." component)))
+      expr)))
+
+;; noall is used for commands which don't take --all, but only
+;; --thread.
+(defun gdb-gud-context-command (command &optional noall)
+  "When `gdb-non-stop' is t, add --thread option to COMMAND if
+`gdb-gud-control-all-threads' is nil and --all option otherwise.
+If NOALL is t, always add --thread option no matter what
+`gdb-gud-control-all-threads' value is.
+
+When `gdb-non-stop' is nil, return COMMAND unchanged."
+  (if gdb-non-stop
+      (if (and gdb-gud-control-all-threads
+               (not noall)
+              (string-equal gdb-version "7.0+"))
+          (concat command " --all ")
+        (gdb-current-context-command command))
+    command))
+
+(defmacro gdb-gud-context-call (cmd1 &optional cmd2 noall noarg)
+  "`gud-call' wrapper which adds --thread/--all options between
+CMD1 and CMD2. NOALL is the same as in `gdb-gud-context-command'.
+
+NOARG must be t when this macro is used outside `gud-def'"
+  `(gud-call
+    (concat (gdb-gud-context-command ,cmd1 ,noall) " " ,cmd2)
+    ,(when (not noarg) 'arg)))
+
+;;;###autoload
+(defun gdb (command-line)
+  "Run gdb on program FILE in buffer *gud-FILE*.
+The directory containing FILE becomes the initial working directory
+and source-file directory for your debugger.
+
+If `gdb-many-windows' is nil (the default value) then gdb just
+pops 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 inferior.
+
+If `gdb-many-windows' is t, regardless of the value of
+`gdb-show-main', the layout below will appear.  Keybindings are
+shown in some of the buffers.
+
+Watch expressions appear in the speedbar/slowbar.
+
+The following commands help control operation :
+
+`gdb-many-windows'    - Toggle the number of windows gdb uses.
+`gdb-restore-windows' - To restore the window layout.
+
+See Info node `(emacs)GDB Graphical Interface' for a more
+detailed description of this mode.
+
+
++----------------------------------------------------------------------+
+|                               GDB Toolbar                            |
++-----------------------------------+----------------------------------+
+| GUD buffer (I/O of GDB)           | Locals buffer                    |
+|                                   |                                  |
+|                                   |                                  |
+|                                   |                                  |
++-----------------------------------+----------------------------------+
+| Source buffer                     | I/O buffer (of debugged program) |
+|                                   | (comint-mode)                    |
+|                                   |                                  |
+|                                   |                                  |
+|                                   |                                  |
+|                                   |                                  |
+|                                   |                                  |
+|                                   |                                  |
++-----------------------------------+----------------------------------+
+| Stack buffer                      | Breakpoints buffer               |
+| RET      gdb-select-frame         | SPC    gdb-toggle-breakpoint     |
+|                                   | RET    gdb-goto-breakpoint       |
+|                                   | D      gdb-delete-breakpoint     |
++-----------------------------------+----------------------------------+"
+  ;;
+  (interactive (list (gud-query-cmdline 'gdb)))
+
+  (when (and gud-comint-buffer
+          (buffer-name gud-comint-buffer)
+          (get-buffer-process gud-comint-buffer)
+          (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba)))
+       (gdb-restore-windows)
+       (error
+        "Multiple debugging requires restarting in text command mode"))
+  ;;
+  (gud-common-init command-line nil 'gud-gdbmi-marker-filter)
+  (set (make-local-variable 'gud-minor-mode) 'gdbmi)
+  (setq comint-input-sender 'gdb-send)
+
+  (gud-def gud-tbreak "tbreak %f:%l" "\C-t"
+          "Set temporary breakpoint at current line.")
+  (gud-def gud-jump
+          (progn (gud-call "tbreak %f:%l") (gud-call "jump %f:%l"))
+          "\C-j" "Set execution address to current line.")
+
+  (gud-def gud-up     "up %p"     "<" "Up N stack frames (numeric arg).")
+  (gud-def gud-down   "down %p"   ">" "Down N stack frames (numeric arg).")
+  (gud-def gud-print  "print %e"  "\C-p" "Evaluate C expression at point.")
+  (gud-def gud-pstar  "print* %e" nil
+          "Evaluate C dereferenced pointer expression at point.")
+
+  (gud-def gud-step   (gdb-gud-context-call "-exec-step" "%p" t)
+           "\C-s"
+          "Step one source line with display.")
+  (gud-def gud-stepi  (gdb-gud-context-call "-exec-step-instruction" "%p" t)
+           "\C-i"
+          "Step one instruction with display.")
+  (gud-def gud-next   (gdb-gud-context-call "-exec-next" "%p" t)
+           "\C-n"
+          "Step one line (skip functions).")
+  (gud-def gud-nexti  (gdb-gud-context-call "-exec-next-instruction" "%p" t)
+           nil
+          "Step one instruction (skip functions).")
+  (gud-def gud-cont   (gdb-gud-context-call "-exec-continue")
+           "\C-r"
+          "Continue with display.")
+  (gud-def gud-finish (gdb-gud-context-call "-exec-finish" nil t)
+           "\C-f"
+          "Finish executing current function.")
+  (gud-def gud-run    "-exec-run"
+           nil
+           "Run the program.")
+
+  (gud-def gud-break (if (not (string-match "Disassembly" mode-name))
+                        (gud-call "break %f:%l" arg)
+                      (save-excursion
+                        (beginning-of-line)
+                        (forward-char 2)
+                        (gud-call "break *%a" arg)))
+          "\C-b" "Set breakpoint at current line or address.")
+
+  (gud-def gud-remove (if (not (string-match "Disassembly" mode-name))
+                         (gud-call "clear %f:%l" arg)
+                       (save-excursion
+                         (beginning-of-line)
+                         (forward-char 2)
+                         (gud-call "clear *%a" arg)))
+          "\C-d" "Remove breakpoint at current line or address.")
+
+  ;; -exec-until doesn't support --all yet
+  (gud-def gud-until  (if (not (string-match "Disassembly" mode-name))
+                         (gud-call "-exec-until %f:%l" arg)
+                       (save-excursion
+                         (beginning-of-line)
+                         (forward-char 2)
+                         (gud-call "-exec-until *%a" arg)))
+          "\C-u" "Continue to current line or address.")
+  ;; TODO Why arg here?
+  (gud-def
+   gud-go (gud-call (if gdb-active-process
+                        (gdb-gud-context-command "-exec-continue")
+                      "-exec-run") arg)
+   nil "Start or continue execution.")
+
+  ;; For debugging Emacs only.
+  (gud-def gud-pp
+          (gud-call
+           (concat
+            "pp1 " (if (eq (buffer-local-value
+                            'major-mode (window-buffer)) 'speedbar-mode)
+                       (gdb-find-watch-expression) "%e")) arg)
+          nil   "Print the Emacs s-expression.")
+
+  (define-key gud-minor-mode-map [left-margin mouse-1]
+    'gdb-mouse-set-clear-breakpoint)
+  (define-key gud-minor-mode-map [left-fringe mouse-1]
+    'gdb-mouse-set-clear-breakpoint)
+   (define-key gud-minor-mode-map [left-margin C-mouse-1]
+    'gdb-mouse-toggle-breakpoint-margin)
+  (define-key gud-minor-mode-map [left-fringe C-mouse-1]
+    'gdb-mouse-toggle-breakpoint-fringe)
+
+  (define-key gud-minor-mode-map [left-margin drag-mouse-1]
+    'gdb-mouse-until)
+  (define-key gud-minor-mode-map [left-fringe drag-mouse-1]
+    'gdb-mouse-until)
+  (define-key gud-minor-mode-map [left-margin mouse-3]
+    'gdb-mouse-until)
+  (define-key gud-minor-mode-map [left-fringe mouse-3]
+    'gdb-mouse-until)
+
+  (define-key gud-minor-mode-map [left-margin C-drag-mouse-1]
+    'gdb-mouse-jump)
+  (define-key gud-minor-mode-map [left-fringe C-drag-mouse-1]
+    'gdb-mouse-jump)
+  (define-key gud-minor-mode-map [left-fringe C-mouse-3]
+    'gdb-mouse-jump)
+  (define-key gud-minor-mode-map [left-margin C-mouse-3]
+    'gdb-mouse-jump)
+
+  (local-set-key "\C-i" 'gud-gdb-complete-command)
+  (setq gdb-first-prompt t)
+  (setq gud-running nil)
+
+  (gdb-update)
+
+  (run-hooks 'gdb-mode-hook))
+
+(defun gdb-init-1 ()
+  ;; (re-)initialise
+  (setq gdb-selected-frame nil
+       gdb-frame-number nil
+        gdb-thread-number nil
+       gdb-var-list nil
+       gdb-pending-triggers nil
+       gdb-output-sink 'user
+       gdb-location-alist nil
+       gdb-source-file-list nil
+       gdb-last-command nil
+       gdb-token-number 0
+       gdb-handler-alist '()
+       gdb-handler-number nil
+       gdb-prompt-name nil
+       gdb-first-done-or-error t
+       gdb-buffer-fringe-width (car (window-fringes))
+       gdb-debug-log nil
+       gdb-source-window nil
+       gdb-inferior-status nil
+       gdb-continuation nil
+        gdb-buf-publisher '()
+        gdb-threads-list '()
+        gdb-breakpoints-list '()
+        gdb-register-names '()
+        gdb-non-stop gdb-non-stop-setting)
+  ;;
+  (setq gdb-buffer-type 'gdbmi)
+  ;;
+  (gdb-force-mode-line-update
+   (propertize "initializing..." 'face font-lock-variable-name-face))
+
+  (gdb-get-buffer-create 'gdb-inferior-io)
+  (gdb-clear-inferior-io)
+  (set-process-filter (get-process "gdb-inferior") 'gdb-inferior-filter)
+  (gdb-input
+   ;; Needs GDB 6.4 onwards
+   (list (concat "-inferior-tty-set "
+                (or
+                 ;; The process can run on a remote host.
+                 (process-get (get-process "gdb-inferior") 'remote-tty)
+                 (process-tty-name (get-process "gdb-inferior"))))
+        'ignore))
+  (if (eq window-system 'w32)
+      (gdb-input (list "-gdb-set new-console off" 'ignore)))
+  (gdb-input (list "-gdb-set height 0" 'ignore))
+
+  (when gdb-non-stop
+    (gdb-input (list "-gdb-set non-stop 1" 'gdb-non-stop-handler)))
+
+  ;; find source file and compilation directory here
+  (gdb-input
+   ; Needs GDB 6.2 onwards.
+   (list "-file-list-exec-source-files" 'gdb-get-source-file-list))
+  (if gdb-create-source-file-list
+      (gdb-input
+        ; Needs GDB 6.0 onwards.
+       (list "-file-list-exec-source-file" 'gdb-get-source-file)))
+  (gdb-input
+   (list "-gdb-show prompt" 'gdb-get-prompt)))
+
+(defun gdb-non-stop-handler ()
+  (goto-char (point-min))
+  (if (re-search-forward "No symbol" nil t)
+      (progn
+       (message "This version of GDB doesn't support non-stop mode.  Turning it off.")
+       (setq gdb-non-stop nil)
+       (setq gdb-version "pre-7.0"))
+    (setq gdb-version "7.0+")
+    (gdb-input (list "-gdb-set target-async 1" 'ignore))
+    (gdb-input (list "-enable-pretty-printing" 'ignore))))
+
+(defvar gdb-define-alist nil "Alist of #define directives for GUD tooltips.")
+
+(defun gdb-create-define-alist ()
+  "Create an alist of #define directives for GUD tooltips."
+  (let* ((file (buffer-file-name))
+        (output
+         (with-output-to-string
+           (with-current-buffer standard-output
+             (and file
+                  (file-exists-p file)
+                  ;; call-process doesn't work with remote file names.
+                  (not (file-remote-p default-directory))
+                  (call-process shell-file-name file
+                                (list t nil) nil "-c"
+                                (concat gdb-cpp-define-alist-program " "
+                                        gdb-cpp-define-alist-flags))))))
+       (define-list (split-string output "\n" t))
+       (name))
+    (setq gdb-define-alist nil)
+    (dolist (define define-list)
+      (setq name (nth 1 (split-string define "[( ]")))
+      (push (cons name define) gdb-define-alist))))
+
+(declare-function tooltip-show "tooltip" (text &optional use-echo-area))
+(defvar tooltip-use-echo-area)
+
+(defun gdb-tooltip-print (expr)
+   (with-current-buffer (gdb-get-buffer 'gdb-partial-output-buffer)
+     (goto-char (point-min))
+     (if (re-search-forward ".*value=\\(\".*\"\\)" nil t)
+        (tooltip-show
+         (concat expr " = " (read (match-string 1)))
+         (or gud-tooltip-echo-area tooltip-use-echo-area
+             (not (display-graphic-p)))))))
+
+;; If expr is a macro for a function don't print because of possible dangerous
+;; side-effects. Also printing a function within a tooltip generates an
+;; unexpected starting annotation (phase error).
+(defun gdb-tooltip-print-1 (expr)
+  (with-current-buffer (gdb-get-buffer 'gdb-partial-output-buffer)
+    (goto-char (point-min))
+    (if (search-forward "expands to: " nil t)
+       (unless (looking-at "\\S-+.*(.*).*")
+         (gdb-input
+          (list  (concat "-data-evaluate-expression " expr)
+                 `(lambda () (gdb-tooltip-print ,expr))))))))
+
+(defun gdb-init-buffer ()
+  (set (make-local-variable 'gud-minor-mode) 'gdbmi)
+  (set (make-local-variable 'tool-bar-map) gud-tool-bar-map)
+  (when gud-tooltip-mode
+    (make-local-variable 'gdb-define-alist)
+    (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))))))
+
+(defun gdb-mouse-until (event)
+  "Continue running until a source line past the current line.
+The destination source line can be selected either by clicking
+with mouse-3 on the fringe/margin or dragging the arrow
+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"))))))
+
+(defun gdb-mouse-jump (event)
+  "Set execution address/line.
+The destination source line can be selected either by clicking with C-mouse-3
+on the fringe/margin or dragging the arrow with C-mouse-1 (default bindings).
+Unlike `gdb-mouse-until' the destination address can be before the current
+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")))))))
+
+(defcustom gdb-show-changed-values t
+  "If non-nil change the face of out of scope variables and changed values.
+Out of scope variables are suppressed with `shadow' face.
+Changed values are highlighted with the face `font-lock-warning-face'."
+  :type 'boolean
+  :group 'gdb
+  :version "22.1")
+
+(defcustom gdb-max-children 40
+  "Maximum number of children before expansion requires confirmation."
+  :type 'integer
+  :group 'gdb
+  :version "22.1")
+
+(defcustom gdb-delete-out-of-scope t
+  "If non-nil delete watch expressions automatically when they go out of scope."
+  :type 'boolean
+  :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
+  :group 'gdb
+  :version "22.1")
+
+(defcustom gdb-use-colon-colon-notation nil
+  "If non-nil use FUN::VAR format to display variables in the speedbar."
+  :type 'boolean
+  :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)
+
+(declare-function tooltip-identifier-from-point "tooltip" (point))
+
+(defun gud-watch (&optional arg event)
+  "Watch expression at point.
+With arg, enter name of variable to be watched in the minibuffer."
+  (interactive (list current-prefix-arg last-input-event))
+  (let ((minor-mode (buffer-local-value 'gud-minor-mode gud-comint-buffer)))
+    (if (eq minor-mode 'gdbmi)
+       (progn
+         (if event (posn-set-point (event-end event)))
+         (require 'tooltip)
+         (save-selected-window
+           (let ((expr
+                  (if arg
+                      (completing-read "Name of variable: "
+                                       'gud-gdb-complete-command)
+                    (if (and transient-mark-mode mark-active)
+                        (buffer-substring (region-beginning) (region-end))
+                      (concat (if (eq major-mode 'gdb-registers-mode) "$")
+                              (tooltip-identifier-from-point (point)))))))
+             (set-text-properties 0 (length expr) nil expr)
+             (gdb-input
+              (list (concat"-var-create - * "  expr "")
+                    `(lambda () (gdb-var-create-handler ,expr)))))))
+      (message "gud-watch is a no-op in this mode."))))
+
+(defun gdb-var-create-handler (expr)
+  (let* ((result (gdb-json-partial-output)))
+    (if (not (bindat-get-field result 'msg))
+        (let ((var
+              (list (bindat-get-field result 'name)
+                    (if (and (string-equal gdb-current-language "c")
+                             gdb-use-colon-colon-notation gdb-selected-frame)
+                        (setq expr (concat gdb-selected-frame "::" expr))
+                      expr)
+                    (bindat-get-field result 'numchild)
+                    (bindat-get-field result 'type)
+                    (bindat-get-field result 'value)
+                    nil
+                    (bindat-get-field result 'has_more)
+                     gdb-frame-address)))
+         (push var gdb-var-list)
+         (speedbar 1)
+         (unless (string-equal
+                  speedbar-initial-expansion-list-name "GUD")
+           (speedbar-change-initial-expansion-list "GUD")))
+      (message-box "No symbol \"%s\" in current context." expr))))
+
+(defun gdb-speedbar-update ()
+  (when (and (boundp 'speedbar-frame) (frame-live-p speedbar-frame)
+            (not (gdb-pending-p 'gdb-speedbar-timer)))
+    ;; Dummy command to update speedbar even when idle.
+    (gdb-input (list "-environment-pwd" 'gdb-speedbar-timer-fn))
+    ;; Keep gdb-pending-triggers non-nil till end.
+    (gdb-add-pending 'gdb-speedbar-timer)))
+
+(defun gdb-speedbar-timer-fn ()
+  (if gdb-speedbar-auto-raise
+      (raise-frame speedbar-frame))
+  (gdb-delete-pending 'gdb-speedbar-timer)
+  (speedbar-timer-fn))
+
+(defun gdb-var-evaluate-expression-handler (varnum changed)
+  (goto-char (point-min))
+  (re-search-forward ".*value=\\(\".*\"\\)" nil t)
+  (let ((var (assoc varnum gdb-var-list)))
+    (when var
+      (if changed (setcar (nthcdr 5 var) 'changed))
+      (setcar (nthcdr 4 var) (read (match-string 1)))))
+  (gdb-speedbar-update))
+
+; Uses "-var-list-children --all-values".  Needs GDB 6.1 onwards.
+(defun gdb-var-list-children (varnum)
+  (gdb-input
+   (list (concat "-var-update " varnum) 'ignore))
+  (gdb-input
+   (list (concat "-var-list-children --all-values "
+               varnum)
+            `(lambda () (gdb-var-list-children-handler ,varnum)))))
+
+(defun gdb-var-list-children-handler (varnum)
+  (let* ((var-list nil)
+        (output (bindat-get-field (gdb-json-partial-output "child")))
+        (children (bindat-get-field output 'children)))
+   (catch 'child-already-watched
+      (dolist (var gdb-var-list)
+       (if (string-equal varnum (car var))
+           (progn
+             ;; With dynamic varobjs numchild may have increased.
+             (setcar (nthcdr 2 var) (bindat-get-field output 'numchild))
+             (push var var-list)
+             (dolist (child children)
+               (let ((varchild (list (bindat-get-field child 'name)
+                                     (bindat-get-field child 'exp)
+                                     (bindat-get-field child 'numchild)
+                                     (bindat-get-field child 'type)
+                                     (bindat-get-field child 'value)
+                                     nil
+                                     (bindat-get-field child 'has_more))))
+                 (if (assoc (car varchild) gdb-var-list)
+                     (throw 'child-already-watched nil))
+                 (push varchild var-list))))
+         (push var var-list)))
+      (setq gdb-var-list (nreverse var-list))))
+  (gdb-speedbar-update))
+
+(defun gdb-var-set-format (format)
+  "Set the output format for a variable displayed in the speedbar."
+  (let* ((var (nth (- (count-lines (point-min) (point)) 2) gdb-var-list))
+        (varnum (car var)))
+    (gdb-input
+     (list (concat "-var-set-format " varnum " " format) 'ignore))
+    (gdb-var-update)))
+
+(defun gdb-var-delete-1 (var varnum)
+  (gdb-input
+   (list (concat "-var-delete " varnum) 'ignore))
+  (setq gdb-var-list (delq var gdb-var-list))
+  (dolist (varchild gdb-var-list)
+    (if (string-match (concat (car var) "\\.") (car varchild))
+       (setq gdb-var-list (delq varchild gdb-var-list)))))
+
+(defun gdb-var-delete ()
+  "Delete watch expression at point from the speedbar."
+  (interactive)
+  (let ((text (speedbar-line-text)))
+    (string-match "\\(\\S-+\\)" text)
+       (let* ((var (nth (- (count-lines (point-min) (point)) 2) gdb-var-list))
+             (varnum (car var)))
+        (if (string-match "\\." (car var))
+            (message-box "Can only delete a root expression")
+          (gdb-var-delete-1 var varnum)))))
+
+(defun gdb-var-delete-children (varnum)
+  "Delete children of variable object at point from the speedbar."
+  (gdb-input
+   (list (concat "-var-delete -c " varnum) 'ignore)))
+
+(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: "))
+    (gdb-input
+     (list (concat "-var-assign " varnum " " value)
+          `(lambda () (gdb-edit-value-handler ,value))))))
+
+(defconst gdb-error-regexp "\\^error,msg=\\(\".+\"\\)")
+
+(defun gdb-edit-value-handler (value)
+  (goto-char (point-min))
+  (if (re-search-forward gdb-error-regexp nil t)
+      (message-box "Invalid number or expression (%s)" value)))
+
+; Uses "-var-update --all-values".  Needs GDB 6.4 onwards.
+(defun gdb-var-update ()
+  (if (not (gdb-pending-p 'gdb-var-update))
+      (gdb-input
+       (list "-var-update --all-values *" 'gdb-var-update-handler)))
+  (gdb-add-pending 'gdb-var-update))
+
+(defun gdb-var-update-handler ()
+  (let ((changelist (bindat-get-field (gdb-json-partial-output) 'changelist)))
+    (dolist (var gdb-var-list)
+      (setcar (nthcdr 5 var) nil))
+    (let ((temp-var-list gdb-var-list))
+      (dolist (change changelist)
+       (let* ((varnum (bindat-get-field change 'name))
+              (var (assoc varnum gdb-var-list))
+              (new-num (bindat-get-field change 'new_num_children)))
+         (when var
+           (let ((scope (bindat-get-field change 'in_scope))
+                 (has-more (bindat-get-field change 'has_more)))
+             (cond ((string-equal scope "false")
+                    (if gdb-delete-out-of-scope
+                        (gdb-var-delete-1 var varnum)
+                      (setcar (nthcdr 5 var) 'out-of-scope)))
+                   ((string-equal scope "true")
+                    (setcar (nthcdr 6 var) has-more)
+                    (when (and (or (not has-more)
+                                   (string-equal has-more "0"))
+                               (not new-num)
+                               (string-equal (nth 2 var) "0"))
+                      (setcar (nthcdr 4 var)
+                              (bindat-get-field change 'value))
+                      (setcar (nthcdr 5 var) 'changed)))
+                   ((string-equal scope "invalid")
+                    (gdb-var-delete-1 var varnum)))))
+         (let ((var-list nil) var1
+               (children (bindat-get-field change 'new_children)))
+           (if new-num
+               (progn
+                 (setq var1 (pop temp-var-list))
+                 (while var1
+                   (if (string-equal varnum (car var1))
+                       (let ((new (string-to-number new-num))
+                             (previous (string-to-number (nth 2 var1))))
+                         (setcar (nthcdr 2 var1) new-num)
+                         (push var1 var-list)
+                         (cond ((> new previous)
+                                ;; Add new children to list.
+                                (dotimes (dummy previous)
+                                  (push (pop temp-var-list) var-list))
+                                (dolist (child children)
+                                  (let ((varchild
+                                         (list (bindat-get-field child 'name)
+                                               (bindat-get-field child 'exp)
+                                               (bindat-get-field child 'numchild)
+                                               (bindat-get-field child 'type)
+                                               (bindat-get-field child 'value)
+                                               'changed
+                                               (bindat-get-field child 'has_more))))
+                                    (push varchild var-list))))
+                               ;; Remove deleted children from list.
+                               ((< new previous)
+                                (dotimes (dummy new)
+                                    (push (pop temp-var-list) var-list))
+                                (dotimes (dummy (- previous new))
+                                    (pop temp-var-list)))))
+                     (push var1 var-list))
+                   (setq var1 (pop temp-var-list)))
+                 (setq gdb-var-list (nreverse var-list)))))))))
+  (setq gdb-pending-triggers
+       (delq 'gdb-var-update gdb-pending-triggers))
+  (gdb-speedbar-update))
+
+(defun gdb-speedbar-expand-node (text token indent)
+  "Expand the node the user clicked on.
+TEXT is the text of the button we clicked on, a + or - item.
+TOKEN is data related to this node.
+INDENT is the current indentation depth."
+  (cond ((string-match "+" text)        ;expand this node
+        (let* ((var (assoc token gdb-var-list))
+               (expr (nth 1 var)) (children (nth 2 var)))
+          (if (or (<= (string-to-number children) gdb-max-children)
+                  (y-or-n-p
+                   (format "%s has %s children. Continue? " expr children)))
+              (gdb-var-list-children token))))
+       ((string-match "-" text)        ;contract this node
+        (dolist (var gdb-var-list)
+          (if (string-match (concat token "\\.") (car var))
+              (setq gdb-var-list (delq var gdb-var-list))))
+        (gdb-var-delete-children token)
+        (speedbar-change-expand-button-char ?+)
+        (speedbar-delete-subblock indent))
+       (t (error "Ooops...  not sure what to do")))
+  (speedbar-center-buffer-smartly))
+
+(defun gdb-get-target-string ()
+  (with-current-buffer gud-comint-buffer
+    gud-target-name))
+\f
+
+;;
+;; gdb buffers.
+;;
+;; Each buffer has a TYPE -- a symbol that identifies the function
+;; of that particular buffer.
+;;
+;; The usual gdb interaction buffer is given the type `gdbmi' and
+;; is constructed specially.
+;;
+;; Others are constructed by gdb-get-buffer-create and
+;; named according to the rules set forth in the gdb-buffer-rules
+
+(defvar gdb-buffer-rules '())
+
+(defun gdb-rules-name-maker (rules-entry)
+  (cadr rules-entry))
+(defun gdb-rules-buffer-mode (rules-entry)
+  (nth 2 rules-entry))
+(defun gdb-rules-update-trigger (rules-entry)
+  (nth 3 rules-entry))
+
+(defun gdb-update-buffer-name ()
+  "Rename current buffer according to name-maker associated with
+it in `gdb-buffer-rules'."
+  (let ((f (gdb-rules-name-maker (assoc gdb-buffer-type
+                                        gdb-buffer-rules))))
+    (when f (rename-buffer (funcall f)))))
+
+(defun gdb-current-buffer-rules ()
+  "Get `gdb-buffer-rules' entry for current buffer type."
+  (assoc gdb-buffer-type gdb-buffer-rules))
+
+(defun gdb-current-buffer-thread ()
+  "Get thread object of current buffer from `gdb-threads-list'.
+
+When current buffer is not bound to any thread, return main
+thread."
+  (cdr (assoc gdb-thread-number gdb-threads-list)))
+
+(defun gdb-current-buffer-frame ()
+  "Get current stack frame object for thread of current buffer."
+  (bindat-get-field (gdb-current-buffer-thread) 'frame))
+
+(defun gdb-buffer-type (buffer)
+  "Get value of `gdb-buffer-type' for BUFFER."
+  (with-current-buffer buffer
+    gdb-buffer-type))
+
+(defun gdb-buffer-shows-main-thread-p ()
+  "Return t if current GDB buffer shows main selected thread and
+is not bound to it."
+  (current-buffer)
+  (not (local-variable-p 'gdb-thread-number)))
+
+(defun gdb-get-buffer (buffer-type &optional thread)
+  "Get a specific GDB buffer.
+
+In that buffer, `gdb-buffer-type' must be equal to BUFFER-TYPE
+and `gdb-thread-number' (if provided) must be equal to THREAD."
+  (catch 'found
+    (dolist (buffer (buffer-list) nil)
+      (with-current-buffer buffer
+        (when (and (eq gdb-buffer-type buffer-type)
+                   (or (not thread)
+                       (equal gdb-thread-number thread)))
+          (throw 'found buffer))))))
+
+(defun gdb-get-buffer-create (buffer-type &optional thread)
+  "Create a new GDB buffer of the type specified by BUFFER-TYPE.
+The buffer-type should be one of the cars in `gdb-buffer-rules'.
+
+If THREAD is non-nil, it is assigned to `gdb-thread-number'
+buffer-local variable of the new buffer.
+
+Buffer mode and name are selected according to buffer type.
+
+If buffer has trigger associated with it in `gdb-buffer-rules',
+this trigger is subscribed to `gdb-buf-publisher' and called with
+'update argument."
+  (or (gdb-get-buffer buffer-type thread)
+      (let ((rules (assoc buffer-type gdb-buffer-rules))
+            (new (generate-new-buffer "limbo")))
+       (with-current-buffer new
+         (let ((mode (gdb-rules-buffer-mode rules))
+                (trigger (gdb-rules-update-trigger rules)))
+           (when mode (funcall mode))
+           (setq gdb-buffer-type buffer-type)
+            (when thread
+              (set (make-local-variable 'gdb-thread-number) thread))
+           (set (make-local-variable 'gud-minor-mode)
+                (buffer-local-value 'gud-minor-mode gud-comint-buffer))
+           (set (make-local-variable 'tool-bar-map) gud-tool-bar-map)
+            (rename-buffer (funcall (gdb-rules-name-maker rules)))
+           (when trigger
+              (gdb-add-subscriber gdb-buf-publisher
+                                  (cons (current-buffer)
+                                        (gdb-bind-function-to-buffer trigger (current-buffer))))
+              (funcall trigger 'start))
+            (current-buffer))))))
+
+(defun gdb-bind-function-to-buffer (expr buffer)
+  "Return a function which will evaluate EXPR in BUFFER."
+  `(lambda (&rest args)
+     (with-current-buffer ,buffer
+       (apply ',expr args))))
+
+;; Used to define all gdb-frame-*-buffer functions except
+;; `gdb-frame-io-buffer'
+(defmacro def-gdb-frame-for-buffer (name buffer &optional doc)
+  "Define a function NAME which shows gdb BUFFER in a separate frame.
+
+DOC is an optional documentation string."
+  `(defun ,name (&optional thread)
+     ,(when doc doc)
+     (interactive)
+     (let ((special-display-regexps (append special-display-regexps '(".*")))
+           (special-display-frame-alist gdb-frame-parameters))
+       (display-buffer (gdb-get-buffer-create ,buffer thread)))))
+
+(defmacro def-gdb-display-buffer (name buffer &optional doc)
+  "Define a function NAME which shows gdb BUFFER.
+
+DOC is an optional documentation string."
+  `(defun ,name (&optional thread)
+     ,(when doc doc)
+     (interactive)
+     (gdb-display-buffer
+      (gdb-get-buffer-create ,buffer thread) t)))
+
+;; Used to display windows with thread-bound buffers
+(defmacro def-gdb-preempt-display-buffer (name buffer &optional doc
+                                              split-horizontal)
+  `(defun ,name (&optional thread)
+     ,(when doc doc)
+     (message thread)
+     (gdb-preempt-existing-or-display-buffer
+      (gdb-get-buffer-create ,buffer thread)
+      ,split-horizontal)))
+
+;; This assoc maps buffer type symbols to rules.  Each rule is a list of
+;; at least one and possible more functions.  The functions have these
+;; roles in defining a buffer type:
+;;
+;;     NAME - Return a name for this  buffer type.
+;;
+;; The remaining function(s) are optional:
+;;
+;;     MODE - called in a new buffer with no arguments, should establish
+;;           the proper mode for the buffer.
+;;
+
+(defun gdb-set-buffer-rules (buffer-type &rest rules)
+  (let ((binding (assoc buffer-type gdb-buffer-rules)))
+    (if binding
+       (setcdr binding rules)
+      (push (cons buffer-type rules)
+           gdb-buffer-rules))))
+
+(defun gdb-parent-mode ()
+  "Generic mode to derive all other GDB buffer modes from."
+  (kill-all-local-variables)
+  (setq buffer-read-only t)
+  (buffer-disable-undo)
+  ;; Delete buffer from gdb-buf-publisher when it's killed
+  ;; (if it has an associated update trigger)
+  (add-hook
+   'kill-buffer-hook
+   (function
+    (lambda ()
+      (let ((trigger (gdb-rules-update-trigger
+                      (gdb-current-buffer-rules))))
+        (when trigger
+          (gdb-delete-subscriber
+           gdb-buf-publisher
+           ;; This should match gdb-add-subscriber done in
+           ;; gdb-get-buffer-create
+           (cons (current-buffer)
+                 (gdb-bind-function-to-buffer trigger (current-buffer))))))))
+   nil t))
+
+;; Partial-output buffer : This accumulates output from a command executed on
+;; behalf of emacs (rather than the user).
+;;
+(gdb-set-buffer-rules 'gdb-partial-output-buffer
+                     'gdb-partial-output-name)
+
+(defun gdb-partial-output-name ()
+  (concat " *partial-output-"
+         (gdb-get-target-string)
+         "*"))
+
+\f
+(gdb-set-buffer-rules 'gdb-inferior-io
+                     'gdb-inferior-io-name
+                     'gdb-inferior-io-mode)
+
+(defun gdb-inferior-io-name ()
+  (concat "*input/output of "
+         (gdb-get-target-string)
+         "*"))
+
+(defun gdb-display-io-buffer ()
+  "Display IO of debugged program in a separate window."
+  (interactive)
+  (gdb-display-buffer
+   (gdb-get-buffer-create 'gdb-inferior-io) t))
+
+(defconst gdb-frame-parameters
+  '((height . 14) (width . 80)
+    (unsplittable . t)
+    (tool-bar-lines . nil)
+    (menu-bar-lines . nil)
+    (minibuffer . nil)))
+
+(defun gdb-frame-io-buffer ()
+  "Display IO of debugged program in a new frame."
+  (interactive)
+  (let ((special-display-regexps (append special-display-regexps '(".*")))
+       (special-display-frame-alist gdb-frame-parameters))
+    (display-buffer (gdb-get-buffer-create 'gdb-inferior-io))))
+
+(defvar gdb-inferior-io-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map "\C-c\C-c" 'gdb-io-interrupt)
+    (define-key map "\C-c\C-z" 'gdb-io-stop)
+    (define-key map "\C-c\C-\\" 'gdb-io-quit)
+    (define-key map "\C-c\C-d" 'gdb-io-eof)
+    (define-key map "\C-d" 'gdb-io-eof)
+    map))
+
+;; We want to use comint because it has various nifty and familiar features.
+(define-derived-mode gdb-inferior-io-mode comint-mode "Inferior I/O"
+  "Major mode for gdb inferior-io.
+
+The following commands are available:
+\\{gdb-inferior-io-mode-map}"
+
+  :syntax-table nil :abbrev-table nil
+
+(make-comint-in-buffer "gdb-inferior" (current-buffer)  nil))
+
+(defun gdb-inferior-filter (proc string)
+  (unless (string-equal string "")
+    (gdb-display-buffer (gdb-get-buffer-create 'gdb-inferior-io) t))
+  (with-current-buffer (gdb-get-buffer-create 'gdb-inferior-io)
+    (comint-output-filter proc string)))
+
+(defun gdb-io-interrupt ()
+  "Interrupt the program being debugged."
+  (interactive)
+  (interrupt-process
+   (get-buffer-process gud-comint-buffer) comint-ptyp))
+
+(defun gdb-io-quit ()
+  "Send quit signal to the program being debugged."
+  (interactive)
+  (quit-process
+   (get-buffer-process gud-comint-buffer) comint-ptyp))
+
+(defun gdb-io-stop ()
+  "Stop the program being debugged."
+  (interactive)
+  (stop-process
+   (get-buffer-process gud-comint-buffer) comint-ptyp))
+
+(defun gdb-io-eof ()
+  "Send end-of-file to the program being debugged."
+  (interactive)
+  (process-send-eof
+   (get-buffer-process gud-comint-buffer)))
+
+(defun gdb-clear-inferior-io ()
+  (with-current-buffer (gdb-get-buffer-create 'gdb-inferior-io)
+    (erase-buffer)))
+\f
+
+(defconst breakpoint-xpm-data
+  "/* XPM */
+static char *magick[] = {
+/* columns rows colors chars-per-pixel */
+\"10 10 2 1\",
+\"  c red\",
+\"+ c None\",
+/* pixels */
+\"+++    +++\",
+\"++      ++\",
+\"+        +\",
+\"          \",
+\"          \",
+\"          \",
+\"          \",
+\"+        +\",
+\"++      ++\",
+\"+++    +++\",
+};"
+  "XPM data used for breakpoint icon.")
+
+(defconst breakpoint-enabled-pbm-data
+  "P1
+10 10\",
+0 0 0 0 1 1 1 1 0 0 0 0
+0 0 0 1 1 1 1 1 1 0 0 0
+0 0 1 1 1 1 1 1 1 1 0 0
+0 1 1 1 1 1 1 1 1 1 1 0
+0 1 1 1 1 1 1 1 1 1 1 0
+0 1 1 1 1 1 1 1 1 1 1 0
+0 1 1 1 1 1 1 1 1 1 1 0
+0 0 1 1 1 1 1 1 1 1 0 0
+0 0 0 1 1 1 1 1 1 0 0 0
+0 0 0 0 1 1 1 1 0 0 0 0"
+  "PBM data used for enabled breakpoint icon.")
+
+(defconst breakpoint-disabled-pbm-data
+  "P1
+10 10\",
+0 0 1 0 1 0 1 0 0 0
+0 1 0 1 0 1 0 1 0 0
+1 0 1 0 1 0 1 0 1 0
+0 1 0 1 0 1 0 1 0 1
+1 0 1 0 1 0 1 0 1 0
+0 1 0 1 0 1 0 1 0 1
+1 0 1 0 1 0 1 0 1 0
+0 1 0 1 0 1 0 1 0 1
+0 0 1 0 1 0 1 0 1 0
+0 0 0 1 0 1 0 1 0 0"
+  "PBM data used for disabled breakpoint icon.")
+
+(defvar breakpoint-enabled-icon nil
+  "Icon for enabled breakpoint in display margin.")
+
+(defvar breakpoint-disabled-icon nil
+  "Icon for disabled breakpoint in display margin.")
+
+(declare-function define-fringe-bitmap "fringe.c"
+                 (bitmap bits &optional height width align))
+
+(and (display-images-p)
+     ;; Bitmap for breakpoint in fringe
+     (define-fringe-bitmap 'breakpoint
+       "\x3c\x7e\xff\xff\xff\xff\x7e\x3c")
+     ;; Bitmap for gud-overlay-arrow in fringe
+     (define-fringe-bitmap 'hollow-right-triangle
+       "\xe0\x90\x88\x84\x84\x88\x90\xe0"))
+
+(defface breakpoint-enabled
+  '((t
+     :foreground "red1"
+     :weight bold))
+  "Face for enabled breakpoint icon in fringe."
+  :group 'gdb)
+
+(defface breakpoint-disabled
+  '((((class color) (min-colors 88)) :foreground "grey70")
+    ;; Ensure that on low-color displays that we end up something visible.
+    (((class color) (min-colors 8) (background light))
+     :foreground "black")
+    (((class color) (min-colors 8) (background dark))
+     :foreground "white")
+    (((type tty) (class mono))
+     :inverse-video t)
+    (t :background "gray"))
+  "Face for disabled breakpoint icon in fringe."
+  :group 'gdb)
+
+\f
+(defun gdb-send (proc string)
+  "A comint send filter for gdb."
+  (with-current-buffer gud-comint-buffer
+    (let ((inhibit-read-only t))
+      (remove-text-properties (point-min) (point-max) '(face))))
+  ;; mimic <RET> key to repeat previous command in GDB
+  (if (not (string= "" string))
+      (setq gdb-last-command string)
+    (if gdb-last-command (setq string gdb-last-command)))
+  (if gdb-enable-debug
+      (push (cons 'mi-send (concat string "\n")) gdb-debug-log))
+  (if (string-match "^-" string)
+      ;; MI command
+      (progn
+       (setq gdb-first-done-or-error t)
+       (process-send-string proc (concat string "\n")))
+    ;; CLI command
+    (if (string-match "\\\\$" string)
+       (setq gdb-continuation (concat gdb-continuation string "\n"))
+      (setq gdb-first-done-or-error t)
+      (process-send-string proc (concat "-interpreter-exec console \""
+                                       gdb-continuation string "\"\n"))
+      (setq gdb-continuation nil))))
+
+(defun gdb-input (item)
+  (if gdb-enable-debug (push (cons 'send-item item) gdb-debug-log))
+  (setq gdb-token-number (1+ gdb-token-number))
+  (setcar item (concat (number-to-string gdb-token-number) (car item)))
+  (push (cons gdb-token-number (car (cdr item))) gdb-handler-alist)
+  (process-send-string (get-buffer-process gud-comint-buffer)
+                      (concat (car item) "\n")))
+
+;; NOFRAME is used for gud execution control commands
+(defun gdb-current-context-command (command)
+  "Add --thread to gdb COMMAND when needed."
+  (if (and gdb-thread-number
+          (string-equal gdb-version "7.0+"))
+      (concat command " --thread " gdb-thread-number)
+    command))
+
+(defun gdb-current-context-buffer-name (name)
+  "Add thread information and asterisks to string NAME.
+
+If `gdb-thread-number' is nil, just wrap NAME in asterisks."
+  (concat "*" name
+          (if (local-variable-p 'gdb-thread-number)
+              (format " (bound to thread %s)" gdb-thread-number)
+            "")
+          "*"))
+
+(defun gdb-current-context-mode-name (mode)
+  "Add thread information to MODE which is to be used as
+`mode-name'."
+  (concat mode
+          (if gdb-thread-number
+              (format " [thread %s]" gdb-thread-number)
+            "")))
+\f
+
+(defcustom gud-gdb-command-name "gdb -i=mi"
+  "Default command to execute an executable under the GDB debugger."
+  :type 'string
+  :group 'gdb)
+
+(defun gdb-resync()
+  (setq gud-running nil)
+  (setq gdb-output-sink 'user)
+  (setq gdb-pending-triggers nil))
+
+(defun gdb-update ()
+  "Update buffers showing status of debug session."
+  (when gdb-first-prompt
+    (gdb-force-mode-line-update
+     (propertize "initializing..." 'face font-lock-variable-name-face))
+    (gdb-init-1)
+    (setq gdb-first-prompt nil))
+
+  (gdb-get-main-selected-frame)
+  ;; We may need to update gdb-threads-list so we can use
+  (gdb-get-buffer-create 'gdb-threads-buffer)
+  ;; gdb-break-list is maintained in breakpoints handler
+  (gdb-get-buffer-create 'gdb-breakpoints-buffer)
+
+  (gdb-emit-signal gdb-buf-publisher 'update)
+
+  (gdb-get-changed-registers)
+
+  (when (and (boundp 'speedbar-frame) (frame-live-p speedbar-frame))
+    (dolist (var gdb-var-list)
+      (setcar (nthcdr 5 var) nil))
+    (gdb-var-update)))
+
+;; gdb-setq-thread-number and gdb-update-gud-running are decoupled
+;; because we may need to update current gud-running value without
+;; changing current thread (see gdb-running)
+(defun gdb-setq-thread-number (number)
+  "Only this function must be used to change `gdb-thread-number'
+value to NUMBER, because `gud-running' and `gdb-frame-number'
+need to be updated appropriately when current thread changes."
+  ;; GDB 6.8 and earlier always output thread-id="0" when stopping.
+  (unless (string-equal number "0") (setq gdb-thread-number number))
+  (setq gdb-frame-number "0")
+  (gdb-update-gud-running))
+
+(defun gdb-update-gud-running ()
+  "Set `gud-running' according to the state of current thread.
+
+`gdb-frame-number' is set to 0 if current thread is now stopped.
+
+Note that when `gdb-gud-control-all-threads' is t, `gud-running'
+cannot be reliably used to determine whether or not execution
+control buttons should be shown in menu or toolbar. Use
+`gdb-running-threads-count' and `gdb-stopped-threads-count'
+instead.
+
+For all-stop mode, thread information is unavailable while target
+is running."
+  (let ((old-value gud-running))
+    (setq gud-running
+          (string= (bindat-get-field (gdb-current-buffer-thread) 'state)
+                   "running"))
+    ;; 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"))))
+
+(defun gdb-show-run-p ()
+  "Return t if \"Run/continue\" should be shown on the toolbar."
+  (or (not gdb-active-process)
+      (and (or
+            (not gdb-gud-control-all-threads)
+            (not gdb-non-stop))
+           (not gud-running))
+      (and gdb-gud-control-all-threads
+           (> gdb-stopped-threads-count 0))))
+
+(defun gdb-show-stop-p ()
+  "Return t if \"Stop\" should be shown on the toolbar."
+  (or (and (or
+            (not gdb-gud-control-all-threads)
+            (not gdb-non-stop))
+           gud-running)
+      (and gdb-gud-control-all-threads
+           (> gdb-running-threads-count 0))))
+
+;; GUD displays the selected GDB frame.  This might might not be the current
+;; GDB frame (after up, down etc).  If no GDB frame is visible but the last
+;; visited breakpoint is, use that window.
+(defun gdb-display-source-buffer (buffer)
+  (let* ((last-window (if gud-last-last-frame
+                        (get-buffer-window
+                         (gud-find-file (car gud-last-last-frame)))))
+        (source-window (or last-window
+                           (if (and gdb-source-window
+                                    (window-live-p gdb-source-window))
+                               gdb-source-window))))
+    (when source-window
+      (setq gdb-source-window source-window)
+      (set-window-buffer source-window buffer))
+    source-window))
+
+(defun gdb-car< (a b)
+  (< (car a) (car b)))
+
+(defvar gdbmi-record-list
+  '((gdb-gdb . "(gdb) \n")
+    (gdb-done . "\\([0-9]*\\)\\^done,?\\(.*?\\)\n")
+    (gdb-starting . "\\([0-9]*\\)\\^running\n")
+    (gdb-error . "\\([0-9]*\\)\\^error,\\(.*?\\)\n")
+    (gdb-console . "~\\(\".*?\"\\)\n")
+    (gdb-internals . "&\\(\".*?\"\\)\n")
+    (gdb-stopped . "\\*stopped,?\\(.*?\\)\n")
+    (gdb-running . "\\*running,\\(.*?\n\\)")
+    (gdb-thread-created . "=thread-created,\\(.*?\n\\)")
+    (gdb-thread-selected . "=thread-selected,\\(.*?\\)\n")
+    (gdb-thread-exited . "=thread-exited,\\(.*?\n\\)")
+    (gdb-ignored-notification . "=[-[:alpha:]]+,?\\(.*?\\)\n")
+    (gdb-shell . "\\(\\(?:^.+\n\\)+\\)")))
+
+(defun gud-gdbmi-marker-filter (string)
+  "Filter GDB/MI output."
+
+  ;; Record transactions if logging is enabled.
+  (when gdb-enable-debug
+    (push (cons 'recv string) gdb-debug-log)
+    (if (and gdb-debug-log-max
+            (> (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
+  (setq gud-marker-acc (concat gud-marker-acc string))
+
+  ;; Start accumulating output for the GUD buffer
+  (setq gdb-filter-output "")
+  (let ((output-record) (output-record-list))
+
+    ;; Process all the complete markers in this chunk.
+    (dolist (gdbmi-record gdbmi-record-list)
+      (while (string-match (cdr gdbmi-record) gud-marker-acc)
+       (push (list (match-beginning 0)
+                   (car gdbmi-record)
+                   (match-string 1 gud-marker-acc)
+                   (match-string 2 gud-marker-acc)
+                   (match-end 0))
+             output-record-list)
+       (setq gud-marker-acc
+             (concat (substring gud-marker-acc 0 (match-beginning 0))
+                     ;; Pad with spaces to preserve position.
+                     (make-string (length (match-string 0 gud-marker-acc)) 32)
+                     (substring gud-marker-acc (match-end 0))))))
+
+    (setq output-record-list (sort output-record-list 'gdb-car<))
+
+    (dolist (output-record output-record-list)
+      (let ((record-type (cadr output-record))
+           (arg1 (nth 2 output-record))
+           (arg2 (nth 3 output-record)))
+       (if (eq record-type 'gdb-error)
+           (gdb-done-or-error arg2 arg1 'error)
+         (if (eq record-type 'gdb-done)
+             (gdb-done-or-error arg2 arg1 'done)
+           ;; Suppress "No registers." since GDB 6.8 and earlier duplicates MI
+           ;; error message on internal stream.  Don't print to GUD buffer.
+           (unless (and (eq record-type 'gdb-internals)
+                    (string-equal (read arg1) "No registers.\n"))
+             (funcall record-type arg1))))))
+
+    (setq gdb-output-sink 'user)
+    ;; Remove padding.
+    (string-match "^ *" gud-marker-acc)
+    (setq gud-marker-acc (substring gud-marker-acc (match-end 0)))
+
+    gdb-filter-output))
+
+(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))))
+
+(defun gdb-ignored-notification (output-field))
+
+;; gdb-invalidate-threads is defined to accept 'update-threads signal
+(defun gdb-thread-created (output-field))
+(defun gdb-thread-exited (output-field)
+  "Handle =thread-exited async record: unset `gdb-thread-number'
+ if current thread exited and update threads list."
+   (let* ((thread-id (bindat-get-field (gdb-json-string output-field) 'id)))
+     (if (string= gdb-thread-number thread-id)
+         (gdb-setq-thread-number nil))
+     ;; When we continue current thread and it quickly exits,
+     ;; gdb-pending-triggers left after gdb-running disallow us to
+     ;; properly call -thread-info without --thread option. Thus we
+     ;; need to use gdb-wait-for-pending.
+     (gdb-wait-for-pending
+      (gdb-emit-signal gdb-buf-publisher 'update-threads))))
+
+(defun gdb-thread-selected (output-field)
+  "Handler for =thread-selected MI output record.
+
+Sets `gdb-thread-number' to new id."
+  (let* ((result (gdb-json-string output-field))
+         (thread-id (bindat-get-field result 'id)))
+    (gdb-setq-thread-number thread-id)
+    ;; Typing `thread N` in GUD buffer makes GDB emit `^done` followed
+    ;; by `=thread-selected` notification. `^done` causes `gdb-update`
+    ;; as usually. Things happen to fast and second call (from
+    ;; gdb-thread-selected handler) gets cut off by our beloved
+    ;; gdb-pending-triggers.
+    ;; Solution is `gdb-wait-for-pending` macro: it guarantees that its
+    ;; body will get executed when `gdb-pending-triggers` is empty.
+    (gdb-wait-for-pending
+     (gdb-update))))
+
+(defun gdb-running (output-field)
+  (let* ((thread-id (bindat-get-field (gdb-json-string output-field) 'thread-id)))
+    ;; We reset gdb-frame-number to nil if current thread has gone
+    ;; running. This can't be done in gdb-thread-list-handler-custom
+    ;; because we need correct gdb-frame-number by the time
+    ;; -thread-info command is sent.
+    (when (or (string-equal thread-id "all")
+              (string-equal thread-id gdb-thread-number))
+      (setq gdb-frame-number nil)))
+  (setq gdb-inferior-status "running")
+  (gdb-force-mode-line-update
+   (propertize gdb-inferior-status 'face font-lock-type-face))
+  (when (not gdb-non-stop)
+    (setq gud-running t))
+  (setq gdb-active-process t)
+  (gdb-emit-signal gdb-buf-publisher 'update-threads))
+
+(defun gdb-starting (output-field)
+  ;; CLI commands don't emit ^running at the moment so use gdb-running too.
+  (setq gdb-inferior-status "running")
+  (gdb-force-mode-line-update
+   (propertize gdb-inferior-status 'face font-lock-type-face))
+  (setq gdb-active-process t)
+  (setq gud-running t)
+  ;; GDB doesn't seem to respond to -thread-info before first stop or
+  ;; thread exit (even in non-stop mode), so this is useless.
+  ;; Behaviour may change in the future.
+  (gdb-emit-signal gdb-buf-publisher 'update-threads))
+
+;; -break-insert -t didn't give a reason before gdb 6.9
+
+(defun gdb-stopped (output-field)
+  "Given the contents of *stopped MI async record, select new
+current thread and update GDB buffers."
+  ;; Reason is available with target-async only
+  (let* ((result (gdb-json-string output-field))
+         (reason (bindat-get-field result 'reason))
+         (thread-id (bindat-get-field result 'thread-id)))
+
+    ;; -data-list-register-names needs to be issued for any stopped
+    ;; thread
+    (when (not gdb-register-names)
+      (gdb-input
+       (list (concat "-data-list-register-names"
+                    (if (string-equal gdb-version "7.0+")
+                        (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)))))
+
+    (setq gdb-inferior-status (or reason "unknown"))
+    (gdb-force-mode-line-update
+     (propertize gdb-inferior-status 'face font-lock-warning-face))
+    (if (string-equal reason "exited-normally")
+       (setq gdb-active-process nil))
+
+    ;; Select new current thread.
+
+    ;; Don't switch if we have no reasons selected
+    (when gdb-switch-reasons
+      ;; Switch from another stopped thread only if we have
+      ;; gdb-switch-when-another-stopped:
+      (when (or gdb-switch-when-another-stopped
+                (not (string= "stopped"
+                              (bindat-get-field (gdb-current-buffer-thread) 'state))))
+        ;; Switch if current reason has been selected or we have no
+        ;; reasons
+        (if (or (eq gdb-switch-reasons t)
+                (member reason gdb-switch-reasons))
+             (when (not (string-equal gdb-thread-number thread-id))
+               (message (concat "Switched to thread " thread-id))
+               (gdb-setq-thread-number thread-id))
+          (message (format "Thread %s stopped" thread-id)))))
+
+  ;; Print "(gdb)" to GUD console
+  (when gdb-first-done-or-error
+    (setq gdb-filter-output (concat gdb-filter-output gdb-prompt-name)))
+
+  ;; In non-stop, we update information as soon as another thread gets
+  ;; stopped
+  (when (or gdb-first-done-or-error
+            gdb-non-stop)
+    ;; In all-stop this updates gud-running properly as well.
+    (gdb-update)
+    (setq gdb-first-done-or-error nil))
+  (run-hook-with-args 'gdb-stopped-hooks result)))
+
+;; Remove the trimmings from log stream containing debugging messages
+;; being produced by GDB's internals, use warning face and send to GUD
+;; buffer.
+(defun gdb-internals (output-field)
+  (setq gdb-filter-output
+       (gdb-concat-output
+        gdb-filter-output
+        (let ((error-message
+               (read output-field)))
+          (put-text-property
+           0 (length error-message)
+           'face font-lock-warning-face
+           error-message)
+          error-message))))
+
+;; Remove the trimmings from the console stream and send to GUD buffer
+;; (frontend MI commands should not print to this stream)
+(defun gdb-console (output-field)
+   (setq gdb-filter-output
+       (gdb-concat-output
+        gdb-filter-output
+        (read output-field))))
+
+(defun gdb-done-or-error (output-field token-number type)
+  (if (string-equal token-number "")
+      ;; Output from command entered by user
+      (progn
+       (setq gdb-output-sink 'user)
+       (setq token-number nil)
+       ;; MI error - send to minibuffer
+       (when (eq type 'error)
+            ;; Skip "msg=" from `output-field'
+           (message (read (substring output-field 4)))
+           ;; Don't send to the console twice.  (If it is a console error
+           ;; it is also in the console stream.)
+           (setq output-field nil)))
+    ;; Output from command from frontend.
+    (setq gdb-output-sink 'emacs))
+
+  (gdb-clear-partial-output)
+  (when gdb-first-done-or-error
+    (unless (or token-number gud-running)
+      (setq gdb-filter-output (concat gdb-filter-output gdb-prompt-name)))
+    (gdb-update)
+    (setq gdb-first-done-or-error nil))
+
+  (setq gdb-filter-output
+       (gdb-concat-output gdb-filter-output output-field))
+
+  (if token-number
+      (progn
+       (with-current-buffer
+           (gdb-get-buffer-create 'gdb-partial-output-buffer)
+         (funcall
+          (cdr (assoc (string-to-number token-number) gdb-handler-alist))))
+       (setq gdb-handler-alist
+             (assq-delete-all token-number gdb-handler-alist)))))
+
+(defun gdb-concat-output (so-far new)
+  (let ((sink gdb-output-sink))
+    (cond
+     ((eq sink 'user) (concat so-far new))
+     ((eq sink 'emacs)
+      (gdb-append-to-partial-output new)
+      so-far))))
+
+(defun gdb-append-to-partial-output (string)
+  (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer)
+    (goto-char (point-max))
+    (insert string)))
+
+(defun gdb-clear-partial-output ()
+  (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer)
+    (erase-buffer)))
+
+(defun gdb-jsonify-buffer (&optional fix-key fix-list)
+  "Prepare GDB/MI output in current buffer for parsing with `json-read'.
+
+Field names are wrapped in double quotes and equal signs are
+replaced with semicolons.
+
+If FIX-KEY is non-nil, strip all \"FIX-KEY=\" occurences from
+partial output. This is used to get rid of useless keys in lists
+in MI messages, e.g.: [key=.., key=..]. -stack-list-frames and
+-break-info are examples of MI commands which issue such
+responses.
+
+If FIX-LIST is non-nil, \"FIX-LIST={..}\" is replaced with
+\"FIX-LIST=[..]\" prior to parsing. This is used to fix broken
+-break-info output when it contains breakpoint script field
+incompatible with GDB/MI output syntax."
+  (save-excursion
+    (goto-char (point-min))
+    (when fix-key
+      (save-excursion
+        (while (re-search-forward (concat "[\\[,]\\(" fix-key "=\\)") nil t)
+          (replace-match "" nil nil nil 1))))
+    (when fix-list
+      (save-excursion
+        ;; Find positions of braces which enclose broken list
+        (while (re-search-forward (concat fix-list "={\"") nil t)
+          (let ((p1 (goto-char (- (point) 2)))
+                (p2 (progn (forward-sexp)
+                           (1- (point)))))
+            ;; Replace braces with brackets
+            (save-excursion
+              (goto-char p1)
+              (delete-char 1)
+              (insert "[")
+              (goto-char p2)
+              (delete-char 1)
+              (insert "]"))))))
+    (goto-char (point-min))
+    (insert "{")
+    (while (re-search-forward
+           "\\([[:alnum:]-_]+\\)=\\({\\|\\[\\|\"\"\\|\".*?[^\\]\"\\)" nil t)
+      (replace-match "\"\\1\":\\2" nil nil))
+    (goto-char (point-max))
+    (insert "}")))
+
+(defun gdb-json-read-buffer (&optional fix-key fix-list)
+  "Prepare and parse GDB/MI output in current buffer with `json-read'.
+
+FIX-KEY and FIX-LIST work as in `gdb-jsonify-buffer'."
+  (gdb-jsonify-buffer fix-key fix-list)
+  (save-excursion
+    (goto-char (point-min))
+    (let ((json-array-type 'list))
+      (json-read))))
+
+(defun gdb-json-string (string &optional fix-key fix-list)
+  "Prepare and parse STRING containing GDB/MI output with `json-read'.
+
+FIX-KEY and FIX-LIST work as in `gdb-jsonify-buffer'."
+  (with-temp-buffer
+    (insert string)
+    (gdb-json-read-buffer fix-key fix-list)))
+
+(defun gdb-json-partial-output (&optional fix-key fix-list)
+  "Prepare and parse gdb-partial-output-buffer with `json-read'.
+
+FIX-KEY and FIX-KEY work as in `gdb-jsonify-buffer'."
+  (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer)
+    (gdb-json-read-buffer fix-key fix-list)))
+
+(defun gdb-line-posns (line)
+  "Return a pair of LINE beginning and end positions."
+  (let ((offset (1+ (- line (line-number-at-pos)))))
+    (cons
+     (line-beginning-position offset)
+     (line-end-position offset))))
+
+(defmacro gdb-mark-line (line variable)
+  "Set VARIABLE marker to point at beginning of LINE.
+
+If current window has no fringes, inverse colors on LINE.
+
+Return position where LINE begins."
+  `(save-excursion
+     (let* ((posns (gdb-line-posns ,line))
+            (start-posn (car posns))
+            (end-posn (cdr posns)))
+       (set-marker ,variable (copy-marker start-posn))
+       (when (not (> (car (window-fringes)) 0))
+         (put-text-property start-posn end-posn
+                            'font-lock-face '(:inverse-video t)))
+       start-posn)))
+
+(defun gdb-pad-string (string padding)
+  (format (concat "%" (number-to-string padding) "s") string))
+
+;; 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
+  (column-sizes nil)
+  (rows nil)
+  (row-properties nil)
+  (right-align nil))
+
+(defun gdb-mapcar* (function &rest seqs)
+  "Apply FUNCTION to each element of SEQS, and make a list of the results.
+If there are several SEQS, FUNCTION is called with that many
+arugments, and mapping stops as sson as the shortest list runs
+out."
+  (let ((shortest (apply #'min (mapcar #'length seqs))))
+    (mapcar (lambda (i)
+              (apply function
+                     (mapcar
+                      (lambda (seq)
+                        (nth i seq))
+                      seqs)))
+            (number-sequence 0 (1- shortest)))))
+
+(defun gdb-table-add-row (table row &optional properties)
+  "Add ROW of string to TABLE and recalculate column sizes.
+
+When non-nil, PROPERTIES will be added to the whole row when
+calling `gdb-table-string'."
+  (let ((rows (gdb-table-rows table))
+        (row-properties (gdb-table-row-properties table))
+        (column-sizes (gdb-table-column-sizes table))
+        (right-align (gdb-table-right-align table)))
+    (when (not column-sizes)
+      (setf (gdb-table-column-sizes table)
+            (make-list (length row) 0)))
+    (setf (gdb-table-rows table)
+          (append rows (list row)))
+    (setf (gdb-table-row-properties table)
+          (append row-properties (list properties)))
+    (setf (gdb-table-column-sizes table)
+          (gdb-mapcar* (lambda (x s)
+                     (let ((new-x
+                            (max (abs x) (string-width (or s "")))))
+                       (if right-align new-x (- new-x))))
+                   (gdb-table-column-sizes table)
+                   row))
+    ;; Avoid trailing whitespace at eol
+    (if (not (gdb-table-right-align table))
+        (setcar (last (gdb-table-column-sizes table)) 0))))
+
+(defun gdb-table-string (table &optional sep)
+  "Return TABLE as a string with columns separated with SEP."
+  (let ((column-sizes (gdb-table-column-sizes table))
+        (res ""))
+    (mapconcat
+     'identity
+     (gdb-mapcar*
+      (lambda (row properties)
+        (apply 'propertize
+               (mapconcat 'identity
+                          (gdb-mapcar* (lambda (s x) (gdb-pad-string s x))
+                                       row column-sizes)
+                          sep)
+               properties))
+      (gdb-table-rows table)
+      (gdb-table-row-properties table))
+     "\n")))
+
+;; bindat-get-field goes deep, gdb-get-many-fields goes wide
+(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)))))))
+
+(defmacro def-gdb-auto-update-trigger (trigger-name gdb-command
+                                                    handler-name
+                                                    &optional signal-list)
+  "Define a trigger TRIGGER-NAME which sends GDB-COMMAND and sets
+HANDLER-NAME as its handler. HANDLER-NAME is bound to current
+buffer with `gdb-bind-function-to-buffer'.
+
+If SIGNAL-LIST is non-nil, GDB-COMMAND is sent only when the
+defined trigger is called with an argument from SIGNAL-LIST. It's
+not recommended to define triggers with empty SIGNAL-LIST.
+Normally triggers should respond at least to 'update signal.
+
+Normally the trigger defined by this command must be called from
+the buffer where HANDLER-NAME must work. This should be done so
+that buffer-local thread number may be used in GDB-COMMAND (by
+calling `gdb-current-context-command').
+`gdb-bind-function-to-buffer' is used to achieve this, see
+`gdb-get-buffer-create'.
+
+Triggers defined by this command are meant to be used as a
+trigger argument when describing buffer types with
+`gdb-set-buffer-rules'."
+  `(defun ,trigger-name (&optional signal)
+     (when
+         (or (not ,signal-list)
+             (memq signal ,signal-list))
+       (when (not (gdb-pending-p
+                   (cons (current-buffer) ',trigger-name)))
+         (gdb-input
+          (list ,gdb-command
+                (gdb-bind-function-to-buffer ',handler-name (current-buffer))))
+         (gdb-add-pending (cons (current-buffer) ',trigger-name))))))
+
+;; Used by disassembly buffer only, the rest use
+;; def-gdb-trigger-and-handler
+(defmacro def-gdb-auto-update-handler (handler-name trigger-name custom-defun
+                                                    &optional nopreserve)
+  "Define a handler HANDLER-NAME for TRIGGER-NAME with CUSTOM-DEFUN.
+
+Handlers are normally called from the buffers they put output in.
+
+Delete ((current-buffer) . TRIGGER-NAME) from
+`gdb-pending-triggers', erase current buffer and evaluate
+CUSTOM-DEFUN. Then `gdb-update-buffer-name' is called.
+
+If NOPRESERVE is non-nil, window point is not restored after CUSTOM-DEFUN."
+  `(defun ,handler-name ()
+     (gdb-delete-pending (cons (current-buffer) ',trigger-name))
+     (let* ((buffer-read-only nil)
+            (window (get-buffer-window (current-buffer) 0))
+            (start (window-start window))
+            (p (window-point window)))
+       (erase-buffer)
+       (,custom-defun)
+       (gdb-update-buffer-name)
+       ,(when (not nopreserve)
+          '(set-window-start window start)
+          '(set-window-point window p)))))
+
+(defmacro def-gdb-trigger-and-handler (trigger-name gdb-command
+                                      handler-name custom-defun
+                                       &optional signal-list)
+  "Define trigger and handler.
+
+TRIGGER-NAME trigger is defined to send GDB-COMMAND. See
+`def-gdb-auto-update-trigger'.
+
+HANDLER-NAME handler uses customization of CUSTOM-DEFUN. See
+`def-gdb-auto-update-handler'."
+  `(progn
+     (def-gdb-auto-update-trigger ,trigger-name
+       ,gdb-command
+       ,handler-name ,signal-list)
+     (def-gdb-auto-update-handler ,handler-name
+       ,trigger-name ,custom-defun)))
+
+\f
+
+;; Breakpoint buffer : This displays the output of `-break-list'.
+(def-gdb-trigger-and-handler
+  gdb-invalidate-breakpoints "-break-list"
+  gdb-breakpoints-list-handler gdb-breakpoints-list-handler-custom
+  '(start update))
+
+(gdb-set-buffer-rules
+ 'gdb-breakpoints-buffer
+ 'gdb-breakpoints-buffer-name
+ 'gdb-breakpoints-mode
+ 'gdb-invalidate-breakpoints)
+
+(defun gdb-breakpoints-list-handler-custom ()
+  (let ((breakpoints-list (bindat-get-field
+                           (gdb-json-partial-output "bkpt" "script")
+                           'BreakpointTable 'body))
+        (table (make-gdb-table)))
+    (setq gdb-breakpoints-list nil)
+    (gdb-table-add-row table '("Num" "Type" "Disp" "Enb" "Addr" "Hits" "What"))
+    (dolist (breakpoint breakpoints-list)
+      (add-to-list 'gdb-breakpoints-list
+                   (cons (bindat-get-field breakpoint 'number)
+                         breakpoint))
+      (let ((at (bindat-get-field breakpoint 'at))
+            (pending (bindat-get-field breakpoint 'pending))
+            (func (bindat-get-field breakpoint 'func))
+           (type (bindat-get-field breakpoint 'type)))
+      (gdb-table-add-row table
+       (list
+        (bindat-get-field breakpoint 'number)
+        type
+        (bindat-get-field breakpoint 'disp)
+        (let ((flag (bindat-get-field breakpoint 'enabled)))
+          (if (string-equal flag "y")
+              (propertize "y" 'font-lock-face  font-lock-warning-face)
+            (propertize "n" 'font-lock-face  font-lock-comment-face)))
+        (bindat-get-field breakpoint 'addr)
+        (bindat-get-field breakpoint 'times)
+       (if (string-match ".*watchpoint" type)
+           (bindat-get-field breakpoint 'what)
+         (or pending at
+             (concat "in "
+                     (propertize func 'font-lock-face font-lock-function-name-face)
+                     (gdb-frame-location breakpoint)))))
+       ;; Add clickable properties only for breakpoints with file:line
+       ;; information
+       (append (list 'gdb-breakpoint breakpoint)
+               (when func '(help-echo "mouse-2, RET: visit breakpoint"
+                            mouse-face highlight))))))
+    (insert (gdb-table-string table " "))
+    (gdb-place-breakpoints)))
+
+;; Put breakpoint icons in relevant margins (even those set in the GUD buffer).
+(defun gdb-place-breakpoints ()
+  (let ((flag) (bptno))
+    ;; Remove all breakpoint-icons in source buffers but not assembler buffer.
+    (dolist (buffer (buffer-list))
+      (with-current-buffer buffer
+       (if (and (eq gud-minor-mode 'gdbmi)
+                (not (string-match "\\` ?\\*.+\\*\\'" (buffer-name))))
+           (gdb-remove-breakpoint-icons (point-min) (point-max)))))
+    (dolist (breakpoint gdb-breakpoints-list)
+      (let* ((breakpoint (cdr breakpoint)) ; gdb-breakpoints-list is
+                                           ; an associative list
+             (line (bindat-get-field breakpoint 'line)))
+        (when line
+          (let ((file (bindat-get-field breakpoint 'fullname))
+                (flag (bindat-get-field breakpoint 'enabled))
+                (bptno (bindat-get-field breakpoint 'number)))
+            (unless (file-exists-p file)
+              (setq file (cdr (assoc bptno gdb-location-alist))))
+            (if (and file
+                     (not (string-equal file "File not found")))
+                (with-current-buffer
+                    (find-file-noselect file 'nowarn)
+                  (gdb-init-buffer)
+                  ;; Only want one breakpoint icon at each location.
+                  (gdb-put-breakpoint-icon (string-equal flag "y") bptno
+                                           (string-to-number line)))
+              (gdb-input
+               (list (concat "list " file ":1")
+                     'ignore))
+              (gdb-input
+               (list "-file-list-exec-source-file"
+                     `(lambda () (gdb-get-location
+                                  ,bptno ,line ,flag)))))))))))
+
+(defvar gdb-source-file-regexp "fullname=\"\\(.*?\\)\"")
+
+(defun gdb-get-location (bptno line flag)
+  "Find the directory containing the relevant source file.
+Put in buffer and place breakpoint icon."
+  (goto-char (point-min))
+  (catch 'file-not-found
+    (if (re-search-forward gdb-source-file-regexp nil t)
+       (delete (cons bptno "File not found") gdb-location-alist)
+       (push (cons bptno (match-string 1)) gdb-location-alist)
+      (gdb-resync)
+      (unless (assoc bptno gdb-location-alist)
+       (push (cons bptno "File not found") gdb-location-alist)
+       (message-box "Cannot find source file for breakpoint location.
+Add directory to search path for source files using the GDB command, dir."))
+      (throw 'file-not-found nil))
+    (with-current-buffer (find-file-noselect (match-string 1))
+      (gdb-init-buffer)
+      ;; only want one breakpoint icon at each location
+      (gdb-put-breakpoint-icon (eq flag ?y) bptno (string-to-number line)))))
+
+(add-hook 'find-file-hook 'gdb-find-file-hook)
+
+(defun gdb-find-file-hook ()
+  "Set up buffer for debugging if file is part of the source code
+of the current session."
+  (if (and (buffer-name gud-comint-buffer)
+          ;; in case gud or gdb-ui is just loaded
+          gud-comint-buffer
+          (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer)
+              'gdbmi))
+      (if (member buffer-file-name gdb-source-file-list)
+         (with-current-buffer (find-buffer-visiting buffer-file-name)
+           (gdb-init-buffer)))))
+
+(declare-function gud-remove "gdb-mi" t t) ; gud-def
+(declare-function gud-break  "gdb-mi" t t) ; gud-def
+(declare-function fringe-bitmaps-at-pos "fringe.c" (&optional pos window))
+
+(defun gdb-mouse-set-clear-breakpoint (event)
+  "Set/clear breakpoint in left fringe/margin at mouse click.
+If not in a source or disassembly buffer just set point."
+  (interactive "e")
+  (mouse-minibuffer-check event)
+  (let ((posn (event-end event)))
+    (with-selected-window (posn-window posn)
+      (if (or (buffer-file-name) (eq major-mode 'gdb-disassembly-mode))
+         (if (numberp (posn-point posn))
+             (save-excursion
+               (goto-char (posn-point posn))
+               (if (or (posn-object posn)
+                       (eq (car (fringe-bitmaps-at-pos (posn-point posn)))
+                           'breakpoint))
+                   (gud-remove nil)
+                 (gud-break nil)))))
+      (posn-set-point posn))))
+
+(defun gdb-mouse-toggle-breakpoint-margin (event)
+  "Enable/disable breakpoint in left margin with mouse click."
+  (interactive "e")
+  (mouse-minibuffer-check event)
+  (let ((posn (event-end event)))
+    (if (numberp (posn-point posn))
+       (with-selected-window (posn-window posn)
+         (save-excursion
+           (goto-char (posn-point posn))
+           (if (posn-object posn)
+               (gud-basic-call
+                (let ((bptno (get-text-property
+                              0 'gdb-bptno (car (posn-string posn)))))
+                  (concat
+                   (if (get-text-property
+                        0 'gdb-enabled (car (posn-string posn)))
+                       "-break-disable "
+                     "-break-enable ")
+                   bptno)))))))))
+
+(defun gdb-mouse-toggle-breakpoint-fringe (event)
+  "Enable/disable breakpoint in left fringe with mouse click."
+  (interactive "e")
+  (mouse-minibuffer-check event)
+  (let* ((posn (event-end event))
+        (pos (posn-point posn))
+        obj)
+    (when (numberp pos)
+      (with-selected-window (posn-window posn)
+       (with-current-buffer (window-buffer (selected-window))
+         (goto-char pos)
+         (dolist (overlay (overlays-in pos pos))
+           (when (overlay-get overlay 'put-break)
+             (setq obj (overlay-get overlay 'before-string))))
+         (when (stringp obj)
+           (gud-basic-call
+            (concat
+             (if (get-text-property 0 'gdb-enabled obj)
+                 "-break-disable "
+               "-break-enable ")
+              (get-text-property 0 'gdb-bptno obj)))))))))
+
+(defun gdb-breakpoints-buffer-name ()
+  (concat "*breakpoints of " (gdb-get-target-string) "*"))
+
+(def-gdb-display-buffer
+ gdb-display-breakpoints-buffer
+ 'gdb-breakpoints-buffer
+ "Display status of user-settable breakpoints.")
+
+(def-gdb-frame-for-buffer
+ gdb-frame-breakpoints-buffer
+ 'gdb-breakpoints-buffer
+ "Display status of user-settable breakpoints in a new frame.")
+
+(defvar gdb-breakpoints-mode-map
+  (let ((map (make-sparse-keymap))
+       (menu (make-sparse-keymap "Breakpoints")))
+    (define-key menu [quit] '("Quit"   . gdb-delete-frame-or-window))
+    (define-key menu [goto] '("Goto"   . gdb-goto-breakpoint))
+    (define-key menu [delete] '("Delete" . gdb-delete-breakpoint))
+    (define-key menu [toggle] '("Toggle" . gdb-toggle-breakpoint))
+    (suppress-keymap map)
+    (define-key map [menu-bar breakpoints] (cons "Breakpoints" menu))
+    (define-key map " " 'gdb-toggle-breakpoint)
+    (define-key map "D" 'gdb-delete-breakpoint)
+    ;; Don't bind "q" to kill-this-buffer as we need it for breakpoint icons.
+    (define-key map "q" 'gdb-delete-frame-or-window)
+    (define-key map "\r" 'gdb-goto-breakpoint)
+    (define-key map "\t" '(lambda ()
+                            (interactive)
+                            (gdb-set-window-buffer
+                             (gdb-get-buffer-create 'gdb-threads-buffer) t)))
+    (define-key map [mouse-2] 'gdb-goto-breakpoint)
+    (define-key map [follow-link] 'mouse-face)
+    map))
+
+(defun gdb-delete-frame-or-window ()
+  "Delete frame if there is only one window.  Otherwise delete the window."
+  (interactive)
+  (if (one-window-p) (delete-frame)
+    (delete-window)))
+
+;;from make-mode-line-mouse-map
+(defun gdb-make-header-line-mouse-map (mouse function) "\
+Return a keymap with single entry for mouse key MOUSE on the header line.
+MOUSE is defined to run function FUNCTION with no args in the buffer
+corresponding to the mode line clicked."
+  (let ((map (make-sparse-keymap)))
+    (define-key map (vector 'header-line mouse) function)
+    (define-key map (vector 'header-line 'down-mouse-1) 'ignore)
+    map))
+
+(defmacro gdb-propertize-header (name buffer help-echo mouse-face face)
+  `(propertize ,name
+              'help-echo ,help-echo
+              'mouse-face ',mouse-face
+              'face ',face
+              'local-map
+              (gdb-make-header-line-mouse-map
+               'mouse-1
+               (lambda (event) (interactive "e")
+                 (save-selected-window
+                   (select-window (posn-window (event-start event)))
+                    (gdb-set-window-buffer
+                     (gdb-get-buffer-create ',buffer) t) )))))
+
+\f
+;; uses "-thread-info". Needs GDB 7.0 onwards.
+;;; Threads view
+
+(defun gdb-threads-buffer-name ()
+  (concat "*threads of " (gdb-get-target-string) "*"))
+
+(def-gdb-display-buffer
+ gdb-display-threads-buffer
+ 'gdb-threads-buffer
+ "Display GDB threads.")
+
+(def-gdb-frame-for-buffer
+ gdb-frame-threads-buffer
+ 'gdb-threads-buffer
+ "Display GDB threads in a new frame.")
+
+(def-gdb-trigger-and-handler
+  gdb-invalidate-threads (gdb-current-context-command "-thread-info")
+  gdb-thread-list-handler gdb-thread-list-handler-custom
+  '(start update update-threads))
+
+(gdb-set-buffer-rules
+ 'gdb-threads-buffer
+ 'gdb-threads-buffer-name
+ 'gdb-threads-mode
+ 'gdb-invalidate-threads)
+
+(defvar gdb-threads-font-lock-keywords
+  '(("in \\([^ ]+\\)"  (1 font-lock-function-name-face))
+    (" \\(stopped\\)"  (1 font-lock-warning-face))
+    (" \\(running\\)"  (1 font-lock-string-face))
+    ("\\(\\(\\sw\\|[_.]\\)+\\)="  (1 font-lock-variable-name-face)))
+  "Font lock keywords used in `gdb-threads-mode'.")
+
+(defvar gdb-threads-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map "\r" 'gdb-select-thread)
+    (define-key map "f" 'gdb-display-stack-for-thread)
+    (define-key map "F" 'gdb-frame-stack-for-thread)
+    (define-key map "l" 'gdb-display-locals-for-thread)
+    (define-key map "L" 'gdb-frame-locals-for-thread)
+    (define-key map "r" 'gdb-display-registers-for-thread)
+    (define-key map "R" 'gdb-frame-registers-for-thread)
+    (define-key map "d" 'gdb-display-disassembly-for-thread)
+    (define-key map "D" 'gdb-frame-disassembly-for-thread)
+    (define-key map "i" 'gdb-interrupt-thread)
+    (define-key map "c" 'gdb-continue-thread)
+    (define-key map "s" 'gdb-step-thread)
+    (define-key map "\t" '(lambda ()
+                            (interactive)
+                            (gdb-set-window-buffer
+                             (gdb-get-buffer-create 'gdb-breakpoints-buffer) t)))
+    (define-key map [mouse-2] 'gdb-select-thread)
+    (define-key map [follow-link] 'mouse-face)
+    map))
+
+(defvar gdb-threads-header
+  (list
+   (gdb-propertize-header "Breakpoints" gdb-breakpoints-buffer
+                         "mouse-1: select" mode-line-highlight mode-line-inactive)
+   " "
+   (gdb-propertize-header "Threads" gdb-threads-buffer
+                         nil nil mode-line)))
+
+(define-derived-mode gdb-threads-mode gdb-parent-mode "Threads"
+  "Major mode for GDB threads.
+
+\\{gdb-threads-mode-map}"
+  (setq gdb-thread-position (make-marker))
+  (add-to-list 'overlay-arrow-variable-list 'gdb-thread-position)
+  (setq header-line-format gdb-threads-header)
+  (set (make-local-variable 'font-lock-defaults)
+       '(gdb-threads-font-lock-keywords))
+  (run-mode-hooks 'gdb-threads-mode-hook)
+  'gdb-invalidate-threads)
+
+(defun gdb-thread-list-handler-custom ()
+  (let ((threads-list (bindat-get-field (gdb-json-partial-output) 'threads))
+        (table (make-gdb-table))
+        (marked-line nil))
+    (setq gdb-threads-list nil)
+    (setq gdb-running-threads-count 0)
+    (setq gdb-stopped-threads-count 0)
+    (set-marker gdb-thread-position nil)
+
+    (dolist (thread (reverse threads-list))
+      (let ((running (string-equal (bindat-get-field thread 'state) "running")))
+      (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))
+
+      (gdb-table-add-row table
+       (list
+        (bindat-get-field thread 'id)
+        (concat
+         (if gdb-thread-buffer-verbose-names
+             (concat (bindat-get-field thread 'target-id) " ") "")
+         (bindat-get-field thread 'state)
+         ;; Include frame information for stopped threads
+         (if (not running)
+             (concat
+              " in " (bindat-get-field thread 'frame 'func)
+              (if gdb-thread-buffer-arguments
+                  (concat
+                   " ("
+                   (let ((args (bindat-get-field thread 'frame 'args)))
+                     (mapconcat
+                      (lambda (arg)
+                        (apply 'format `("%s=%s" ,@(gdb-get-many-fields arg 'name 'value))))
+                      args ","))
+                   ")")
+                "")
+              (if gdb-thread-buffer-locations
+                  (gdb-frame-location (bindat-get-field thread 'frame)) "")
+              (if gdb-thread-buffer-addresses
+                  (concat " at " (bindat-get-field thread 'frame 'addr)) ""))
+           "")))
+       (list
+        'gdb-thread thread
+        'mouse-face 'highlight
+        'help-echo "mouse-2, RET: select thread")))
+      (when (string-equal gdb-thread-number
+                          (bindat-get-field thread 'id))
+        (setq marked-line (length gdb-threads-list))))
+    (insert (gdb-table-string table " "))
+    (when marked-line
+      (gdb-mark-line marked-line gdb-thread-position)))
+  ;; We update gud-running here because we need to make sure that
+  ;; gdb-threads-list is up-to-date
+  (gdb-update-gud-running)
+  (gdb-emit-signal gdb-buf-publisher 'update-disassembly))
+
+(defmacro def-gdb-thread-buffer-command (name custom-defun &optional doc)
+  "Define a NAME command which will act upon thread on the current line.
+
+CUSTOM-DEFUN may use locally bound `thread' variable, which will
+be the value of 'gdb-thread property of the current line. If
+'gdb-thread is nil, error is signaled."
+  `(defun ,name (&optional event)
+     ,(when doc doc)
+     (interactive (list last-input-event))
+     (if event (posn-set-point (event-end event)))
+     (save-excursion
+       (beginning-of-line)
+       (let ((thread (get-text-property (point) 'gdb-thread)))
+         (if thread
+             ,custom-defun
+           (error "Not recognized as thread line"))))))
+
+(defmacro def-gdb-thread-buffer-simple-command (name buffer-command &optional doc)
+  "Define a NAME which will call BUFFER-COMMAND with id of thread
+on the current line."
+  `(def-gdb-thread-buffer-command ,name
+     (,buffer-command (bindat-get-field thread 'id))
+     ,doc))
+
+(def-gdb-thread-buffer-command gdb-select-thread
+  (let ((new-id (bindat-get-field thread 'id)))
+    (gdb-setq-thread-number new-id)
+    (gdb-input (list (concat "-thread-select " new-id) 'ignore))
+    (gdb-update))
+  "Select the thread at current line of threads buffer.")
+
+(def-gdb-thread-buffer-simple-command
+  gdb-display-stack-for-thread
+  gdb-preemptively-display-stack-buffer
+  "Display stack buffer for the thread at current line.")
+
+(def-gdb-thread-buffer-simple-command
+  gdb-display-locals-for-thread
+  gdb-preemptively-display-locals-buffer
+  "Display locals buffer for the thread at current line.")
+
+(def-gdb-thread-buffer-simple-command
+  gdb-display-registers-for-thread
+  gdb-preemptively-display-registers-buffer
+  "Display registers buffer for the thread at current line.")
+
+(def-gdb-thread-buffer-simple-command
+  gdb-display-disassembly-for-thread
+  gdb-preemptively-display-disassembly-buffer
+  "Display disassembly buffer for the thread at current line.")
+
+(def-gdb-thread-buffer-simple-command
+  gdb-frame-stack-for-thread
+  gdb-frame-stack-buffer
+  "Display a new frame with stack buffer for the thread at
+current line.")
+
+(def-gdb-thread-buffer-simple-command
+  gdb-frame-locals-for-thread
+  gdb-frame-locals-buffer
+  "Display a new frame with locals buffer for the thread at
+current line.")
+
+(def-gdb-thread-buffer-simple-command
+  gdb-frame-registers-for-thread
+  gdb-frame-registers-buffer
+  "Display a new frame with registers buffer for the thread at
+current line.")
+
+(def-gdb-thread-buffer-simple-command
+  gdb-frame-disassembly-for-thread
+  gdb-frame-disassembly-buffer
+  "Display a new frame with disassembly buffer for the thread at
+current line.")
+
+(defmacro def-gdb-thread-buffer-gud-command (name gud-command &optional doc)
+  "Define a NAME which will execute GUD-COMMAND with
+`gdb-thread-number' locally bound to id of thread on the current
+line."
+  `(def-gdb-thread-buffer-command ,name
+     (if gdb-non-stop
+         (let ((gdb-thread-number (bindat-get-field thread 'id))
+               (gdb-gud-control-all-threads nil))
+           (call-interactively #',gud-command))
+       (error "Available in non-stop mode only, customize `gdb-non-stop-setting'"))
+     ,doc))
+
+(def-gdb-thread-buffer-gud-command
+  gdb-interrupt-thread
+  gud-stop-subjob
+  "Interrupt thread at current line.")
+
+(def-gdb-thread-buffer-gud-command
+  gdb-continue-thread
+  gud-cont
+  "Continue thread at current line.")
+
+(def-gdb-thread-buffer-gud-command
+  gdb-step-thread
+  gud-step
+  "Step thread at current line.")
+
+\f
+;;; Memory view
+
+(defcustom gdb-memory-rows 8
+  "Number of data rows in memory window."
+  :type 'integer
+  :group 'gud
+  :version "23.2")
+
+(defcustom gdb-memory-columns 4
+  "Number of data columns in memory window."
+  :type 'integer
+  :group 'gud
+  :version "23.2")
+
+(defcustom gdb-memory-format "x"
+  "Display format of data items in memory window."
+  :type '(choice (const :tag "Hexadecimal" "x")
+                (const :tag "Signed decimal" "d")
+                (const :tag "Unsigned decimal" "u")
+                (const :tag "Octal" "o")
+                (const :tag "Binary" "t"))
+  :group 'gud
+  :version "22.1")
+
+(defcustom gdb-memory-unit 4
+  "Unit size of data items in memory window."
+  :type '(choice (const :tag "Byte" 1)
+                (const :tag "Halfword" 2)
+                (const :tag "Word" 4)
+                (const :tag "Giant word" 8))
+  :group 'gud
+  :version "23.2")
+
+(def-gdb-trigger-and-handler
+  gdb-invalidate-memory
+  (format "-data-read-memory %s %s %d %d %d"
+          gdb-memory-address
+          gdb-memory-format
+          gdb-memory-unit
+          gdb-memory-rows
+          gdb-memory-columns)
+  gdb-read-memory-handler
+  gdb-read-memory-custom
+  '(start update))
+
+(gdb-set-buffer-rules
+ 'gdb-memory-buffer
+ 'gdb-memory-buffer-name
+ 'gdb-memory-mode
+ 'gdb-invalidate-memory)
+
+(defun gdb-memory-column-width (size format)
+  "Return length of string with memory unit of SIZE in FORMAT.
+
+SIZE is in bytes, as in `gdb-memory-unit'. FORMAT is a string as
+in `gdb-memory-format'."
+  (let ((format-base (cdr (assoc format
+                                 '(("x" . 16)
+                                   ("d" . 10) ("u" . 10)
+                                   ("o" . 8)
+                                   ("t" . 2))))))
+    (if format-base
+        (let ((res (ceiling (log (expt 2.0 (* size 8)) format-base))))
+          (cond ((string-equal format "x")
+                 (+ 2 res)) ; hexadecimal numbers have 0x in front
+                ((or (string-equal format "d")
+                     (string-equal format "o"))
+                 (1+ res))
+                (t res)))
+      (error "Unknown format"))))
+
+(defun gdb-read-memory-custom ()
+  (let* ((res (gdb-json-partial-output))
+         (err-msg (bindat-get-field res 'msg)))
+    (if (not err-msg)
+        (let ((memory (bindat-get-field res 'memory)))
+          (setq gdb-memory-address (bindat-get-field res 'addr))
+          (setq gdb-memory-next-page (bindat-get-field res 'next-page))
+          (setq gdb-memory-prev-page (bindat-get-field res 'prev-page))
+          (setq gdb-memory-last-address gdb-memory-address)
+        (dolist (row memory)
+          (insert (concat (bindat-get-field row 'addr) ":"))
+          (dolist (column (bindat-get-field row 'data))
+            (insert (gdb-pad-string column
+                                    (+ 2 (gdb-memory-column-width
+                                          gdb-memory-unit
+                                          gdb-memory-format)))))
+          (newline)))
+      ;; Show last page instead of empty buffer when out of bounds
+      (progn
+        (let ((gdb-memory-address gdb-memory-last-address))
+          (gdb-invalidate-memory 'update)
+          (error err-msg))))))
+
+(defvar gdb-memory-mode-map
+  (let ((map (make-sparse-keymap)))
+    (suppress-keymap map t)
+    (define-key map "q" 'kill-this-buffer)
+    (define-key map "n" 'gdb-memory-show-next-page)
+    (define-key map "p" 'gdb-memory-show-previous-page)
+    (define-key map "a" 'gdb-memory-set-address)
+    (define-key map "t" 'gdb-memory-format-binary)
+    (define-key map "o" 'gdb-memory-format-octal)
+    (define-key map "u" 'gdb-memory-format-unsigned)
+    (define-key map "d" 'gdb-memory-format-signed)
+    (define-key map "x" 'gdb-memory-format-hexadecimal)
+    (define-key map "b" 'gdb-memory-unit-byte)
+    (define-key map "h" 'gdb-memory-unit-halfword)
+    (define-key map "w" 'gdb-memory-unit-word)
+    (define-key map "g" 'gdb-memory-unit-giant)
+    (define-key map "R" 'gdb-memory-set-rows)
+    (define-key map "C" 'gdb-memory-set-columns)
+     map))
+
+(defun gdb-memory-set-address-event (event)
+  "Handle a click on address field in memory buffer header."
+  (interactive "e")
+  (save-selected-window
+    (select-window (posn-window (event-start event)))
+    (gdb-memory-set-address)))
+
+;; Non-event version for use within keymap
+(defun gdb-memory-set-address ()
+  "Set the start memory address."
+  (interactive)
+  (let ((arg (read-from-minibuffer "Memory address: ")))
+    (setq gdb-memory-address arg))
+  (gdb-invalidate-memory 'update))
+
+(defmacro def-gdb-set-positive-number (name variable echo-string &optional doc)
+  "Define a function NAME which reads new VAR value from minibuffer."
+  `(defun ,name (event)
+     ,(when doc doc)
+     (interactive "e")
+     (save-selected-window
+       (select-window (posn-window (event-start event)))
+       (let* ((arg (read-from-minibuffer ,echo-string))
+              (count (string-to-number arg)))
+         (if (<= count 0)
+             (error "Positive number only")
+           (customize-set-variable ',variable count)
+           (gdb-invalidate-memory 'update))))))
+
+(def-gdb-set-positive-number
+  gdb-memory-set-rows
+  gdb-memory-rows
+  "Rows: "
+  "Set the number of data rows in memory window.")
+
+(def-gdb-set-positive-number
+  gdb-memory-set-columns
+  gdb-memory-columns
+  "Columns: "
+  "Set the number of data columns in memory window.")
+
+(defmacro def-gdb-memory-format (name format doc)
+  "Define a function NAME to switch memory buffer to use FORMAT.
+
+DOC is an optional documentation string."
+  `(defun ,name () ,(when doc doc)
+     (interactive)
+     (customize-set-variable 'gdb-memory-format ,format)
+     (gdb-invalidate-memory 'update)))
+
+(def-gdb-memory-format
+  gdb-memory-format-binary "t"
+  "Set the display format to binary.")
+
+(def-gdb-memory-format
+  gdb-memory-format-octal "o"
+  "Set the display format to octal.")
+
+(def-gdb-memory-format
+  gdb-memory-format-unsigned "u"
+  "Set the display format to unsigned decimal.")
+
+(def-gdb-memory-format
+  gdb-memory-format-signed "d"
+  "Set the display format to decimal.")
+
+(def-gdb-memory-format
+  gdb-memory-format-hexadecimal "x"
+  "Set the display format to hexadecimal.")
+
+(defvar gdb-memory-format-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map [header-line down-mouse-3] 'gdb-memory-format-menu-1)
+    map)
+  "Keymap to select format in the header line.")
+
+(defvar gdb-memory-format-menu (make-sparse-keymap "Format")
+  "Menu of display formats in the header line.")
+
+(define-key gdb-memory-format-menu [binary]
+  '(menu-item "Binary" gdb-memory-format-binary
+             :button (:radio . (equal gdb-memory-format "t"))))
+(define-key gdb-memory-format-menu [octal]
+  '(menu-item "Octal" gdb-memory-format-octal
+             :button (:radio . (equal gdb-memory-format "o"))))
+(define-key gdb-memory-format-menu [unsigned]
+  '(menu-item "Unsigned Decimal" gdb-memory-format-unsigned
+             :button (:radio . (equal gdb-memory-format "u"))))
+(define-key gdb-memory-format-menu [signed]
+  '(menu-item "Signed Decimal" gdb-memory-format-signed
+             :button (:radio . (equal gdb-memory-format "d"))))
+(define-key gdb-memory-format-menu [hexadecimal]
+  '(menu-item "Hexadecimal" gdb-memory-format-hexadecimal
+             :button (:radio . (equal gdb-memory-format "x"))))
+
+(defun gdb-memory-format-menu (event)
+  (interactive "@e")
+  (x-popup-menu event gdb-memory-format-menu))
+
+(defun gdb-memory-format-menu-1 (event)
+  (interactive "e")
+  (save-selected-window
+    (select-window (posn-window (event-start event)))
+    (let* ((selection (gdb-memory-format-menu event))
+          (binding (and selection (lookup-key gdb-memory-format-menu
+                                              (vector (car selection))))))
+      (if binding (call-interactively binding)))))
+
+(defmacro def-gdb-memory-unit (name unit-size doc)
+  "Define a function NAME to switch memory unit size to UNIT-SIZE.
+
+DOC is an optional documentation string."
+  `(defun ,name () ,(when doc doc)
+     (interactive)
+     (customize-set-variable 'gdb-memory-unit ,unit-size)
+     (gdb-invalidate-memory 'update)))
+
+(def-gdb-memory-unit gdb-memory-unit-giant 8
+  "Set the unit size to giant words (eight bytes).")
+
+(def-gdb-memory-unit gdb-memory-unit-word 4
+  "Set the unit size to words (four bytes).")
+
+(def-gdb-memory-unit gdb-memory-unit-halfword 2
+  "Set the unit size to halfwords (two bytes).")
+
+(def-gdb-memory-unit gdb-memory-unit-byte 1
+  "Set the unit size to bytes.")
+
+(defmacro def-gdb-memory-show-page (name address-var &optional doc)
+  "Define a function NAME which show new address in memory buffer.
+
+The defined function switches Memory buffer to show address
+stored in ADDRESS-VAR variable.
+
+DOC is an optional documentation string."
+  `(defun ,name
+     ,(when doc doc)
+     (interactive)
+     (let ((gdb-memory-address ,address-var))
+       (gdb-invalidate-memory))))
+
+(def-gdb-memory-show-page gdb-memory-show-previous-page
+  gdb-memory-prev-page)
+
+(def-gdb-memory-show-page gdb-memory-show-next-page
+  gdb-memory-next-page)
+
+(defvar gdb-memory-unit-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map [header-line down-mouse-3] 'gdb-memory-unit-menu-1)
+    map)
+  "Keymap to select units in the header line.")
+
+(defvar gdb-memory-unit-menu (make-sparse-keymap "Unit")
+  "Menu of units in the header line.")
+
+(define-key gdb-memory-unit-menu [giantwords]
+  '(menu-item "Giant words" gdb-memory-unit-giant
+             :button (:radio . (equal gdb-memory-unit 8))))
+(define-key gdb-memory-unit-menu [words]
+  '(menu-item "Words" gdb-memory-unit-word
+             :button (:radio . (equal gdb-memory-unit 4))))
+(define-key gdb-memory-unit-menu [halfwords]
+  '(menu-item "Halfwords" gdb-memory-unit-halfword
+             :button (:radio . (equal gdb-memory-unit 2))))
+(define-key gdb-memory-unit-menu [bytes]
+  '(menu-item "Bytes" gdb-memory-unit-byte
+             :button (:radio . (equal gdb-memory-unit 1))))
+
+(defun gdb-memory-unit-menu (event)
+  (interactive "@e")
+  (x-popup-menu event gdb-memory-unit-menu))
+
+(defun gdb-memory-unit-menu-1 (event)
+  (interactive "e")
+  (save-selected-window
+    (select-window (posn-window (event-start event)))
+    (let* ((selection (gdb-memory-unit-menu event))
+          (binding (and selection (lookup-key gdb-memory-unit-menu
+                                              (vector (car selection))))))
+      (if binding (call-interactively binding)))))
+
+(defvar gdb-memory-font-lock-keywords
+  '(;; <__function.name+n>
+    ("<\\(\\(\\sw\\|[_.]\\)+\\)\\(\\+[0-9]+\\)?>" (1 font-lock-function-name-face))
+    )
+  "Font lock keywords used in `gdb-memory-mode'.")
+
+(defvar gdb-memory-header
+  '(:eval
+    (concat
+     "Start address["
+     (propertize "-"
+                  'face font-lock-warning-face
+                  'help-echo "mouse-1: decrement address"
+                  'mouse-face 'mode-line-highlight
+                  'local-map (gdb-make-header-line-mouse-map
+                              'mouse-1
+                              #'gdb-memory-show-previous-page))
+     "|"
+     (propertize "+"
+                  'face font-lock-warning-face
+                  'help-echo "mouse-1: increment address"
+                 'mouse-face 'mode-line-highlight
+                 'local-map (gdb-make-header-line-mouse-map
+                             'mouse-1
+                             #'gdb-memory-show-next-page))
+    "]: "
+    (propertize gdb-memory-address
+                 'face font-lock-warning-face
+                 'help-echo "mouse-1: set start address"
+                 'mouse-face 'mode-line-highlight
+                 'local-map (gdb-make-header-line-mouse-map
+                             'mouse-1
+                             #'gdb-memory-set-address-event))
+    "  Rows: "
+    (propertize (number-to-string gdb-memory-rows)
+                 'face font-lock-warning-face
+                 'help-echo "mouse-1: set number of columns"
+                 'mouse-face 'mode-line-highlight
+                 'local-map (gdb-make-header-line-mouse-map
+                             'mouse-1
+                             #'gdb-memory-set-rows))
+    "  Columns: "
+    (propertize (number-to-string gdb-memory-columns)
+                 'face font-lock-warning-face
+                 'help-echo "mouse-1: set number of columns"
+                 'mouse-face 'mode-line-highlight
+                 'local-map (gdb-make-header-line-mouse-map
+                             'mouse-1
+                             #'gdb-memory-set-columns))
+    "  Display Format: "
+    (propertize gdb-memory-format
+                 'face font-lock-warning-face
+                 'help-echo "mouse-3: select display format"
+                 'mouse-face 'mode-line-highlight
+                 'local-map gdb-memory-format-map)
+    "  Unit Size: "
+    (propertize (number-to-string gdb-memory-unit)
+                 'face font-lock-warning-face
+                 'help-echo "mouse-3: select unit size"
+                 'mouse-face 'mode-line-highlight
+                 'local-map gdb-memory-unit-map)))
+  "Header line used in `gdb-memory-mode'.")
+
+(define-derived-mode gdb-memory-mode gdb-parent-mode "Memory"
+  "Major mode for examining memory.
+
+\\{gdb-memory-mode-map}"
+  (setq header-line-format gdb-memory-header)
+  (set (make-local-variable 'font-lock-defaults)
+       '(gdb-memory-font-lock-keywords))
+  (run-mode-hooks 'gdb-memory-mode-hook)
+  'gdb-invalidate-memory)
+
+(defun gdb-memory-buffer-name ()
+  (concat "*memory of " (gdb-get-target-string) "*"))
+
+(def-gdb-display-buffer
+  gdb-display-memory-buffer
+  'gdb-memory-buffer
+  "Display memory contents.")
+
+(defun gdb-frame-memory-buffer ()
+  "Display memory contents in a new frame."
+  (interactive)
+  (let* ((special-display-regexps (append special-display-regexps '(".*")))
+        (special-display-frame-alist
+         `((left-fringe . 0)
+            (right-fringe . 0)
+            (width . 83)
+            ,@gdb-frame-parameters)))
+    (display-buffer (gdb-get-buffer-create 'gdb-memory-buffer))))
+
+\f
+;;; Disassembly view
+
+(defun gdb-disassembly-buffer-name ()
+  (gdb-current-context-buffer-name
+   (concat "disassembly of " (gdb-get-target-string))))
+
+(def-gdb-display-buffer
+ gdb-display-disassembly-buffer
+ 'gdb-disassembly-buffer
+ "Display disassembly for current stack frame.")
+
+(def-gdb-preempt-display-buffer
+  gdb-preemptively-display-disassembly-buffer
+  'gdb-disassembly-buffer)
+
+(def-gdb-frame-for-buffer
+ gdb-frame-disassembly-buffer
+ 'gdb-disassembly-buffer
+ "Display disassembly in a new frame.")
+
+(def-gdb-auto-update-trigger gdb-invalidate-disassembly
+  (let* ((frame (gdb-current-buffer-frame))
+         (file (bindat-get-field frame 'fullname))
+         (line (bindat-get-field frame 'line)))
+    (when file
+      (format "-data-disassemble -f %s -l %s -n -1 -- 0" file line)))
+  gdb-disassembly-handler
+  ;; We update disassembly only after we have actual frame information
+  ;; about all threads, so no there's `update' signal in this list
+  '(start update-disassembly))
+
+(def-gdb-auto-update-handler
+  gdb-disassembly-handler
+  gdb-invalidate-disassembly
+  gdb-disassembly-handler-custom
+  t)
+
+(gdb-set-buffer-rules
+ 'gdb-disassembly-buffer
+ 'gdb-disassembly-buffer-name
+ 'gdb-disassembly-mode
+ 'gdb-invalidate-disassembly)
+
+(defvar gdb-disassembly-font-lock-keywords
+  '(;; <__function.name+n>
+    ("<\\(\\(\\sw\\|[_.]\\)+\\)\\(\\+[0-9]+\\)?>"
+     (1 font-lock-function-name-face))
+    ;; 0xNNNNNNNN <__function.name+n>: opcode
+    ("^0x[0-9a-f]+ \\(<\\(\\(\\sw\\|[_.]\\)+\\)\\+[0-9]+>\\)?:[ \t]+\\(\\sw+\\)"
+     (4 font-lock-keyword-face))
+    ;; %register(at least i386)
+    ("%\\sw+" . font-lock-variable-name-face)
+    ("^\\(Dump of assembler code for function\\) \\(.+\\):"
+     (1 font-lock-comment-face)
+     (2 font-lock-function-name-face))
+    ("^\\(End of assembler dump\\.\\)" . font-lock-comment-face))
+  "Font lock keywords used in `gdb-disassembly-mode'.")
+
+(defvar gdb-disassembly-mode-map
+  ;; TODO
+  (let ((map (make-sparse-keymap)))
+    (suppress-keymap map)
+    (define-key map "q" 'kill-this-buffer)
+     map))
+
+(define-derived-mode gdb-disassembly-mode gdb-parent-mode "Disassembly"
+  "Major mode for GDB disassembly information.
+
+\\{gdb-disassembly-mode-map}"
+  ;; TODO Rename overlay variable for disassembly mode
+  (add-to-list 'overlay-arrow-variable-list 'gdb-disassembly-position)
+  (setq fringes-outside-margins t)
+  (set (make-local-variable 'gdb-disassembly-position) (make-marker))
+  (set (make-local-variable 'font-lock-defaults)
+       '(gdb-disassembly-font-lock-keywords))
+  (run-mode-hooks 'gdb-disassembly-mode-hook)
+  'gdb-invalidate-disassembly)
+
+(defun gdb-disassembly-handler-custom ()
+  (let* ((instructions (bindat-get-field (gdb-json-partial-output) 'asm_insns))
+         (address (bindat-get-field (gdb-current-buffer-frame) 'addr))
+         (pos 1)
+         (table (make-gdb-table))
+         (marked-line nil))
+      (dolist (instr instructions)
+      (gdb-table-add-row table
+       (list
+        (bindat-get-field instr 'address)
+        (apply 'format `("<%s+%s>:" ,@(gdb-get-many-fields instr 'func-name 'offset)))
+        (bindat-get-field instr 'inst)))
+      (when (string-equal (bindat-get-field instr 'address)
+                          address)
+        (progn
+          (setq marked-line (length (gdb-table-rows table)))
+          (setq fringe-indicator-alist
+                (if (string-equal gdb-frame-number "0")
+                    nil
+                  '((overlay-arrow . hollow-right-triangle)))))))
+      (insert (gdb-table-string table " "))
+      (gdb-disassembly-place-breakpoints)
+      ;; Mark current position with overlay arrow and scroll window to
+      ;; that point
+      (when marked-line
+        (let ((window (get-buffer-window (current-buffer) 0)))
+          (set-window-point window (gdb-mark-line marked-line gdb-disassembly-position))))
+      (setq mode-name
+            (gdb-current-context-mode-name
+            (concat "Disassembly: "
+                    (bindat-get-field (gdb-current-buffer-frame) 'func))))))
+
+(defun gdb-disassembly-place-breakpoints ()
+  (gdb-remove-breakpoint-icons (point-min) (point-max))
+  (dolist (breakpoint gdb-breakpoints-list)
+    (let* ((breakpoint (cdr breakpoint))
+           (bptno (bindat-get-field breakpoint 'number))
+           (flag (bindat-get-field breakpoint 'enabled))
+           (address (bindat-get-field breakpoint 'addr)))
+      (save-excursion
+        (goto-char (point-min))
+        (if (re-search-forward (concat "^" address) nil t)
+            (gdb-put-breakpoint-icon (string-equal flag "y") bptno))))))
+
+\f
+(defvar gdb-breakpoints-header
+  (list
+   (gdb-propertize-header "Breakpoints" gdb-breakpoints-buffer
+                         nil nil mode-line)
+   " "
+   (gdb-propertize-header "Threads" gdb-threads-buffer
+                         "mouse-1: select" mode-line-highlight mode-line-inactive)))
+
+;;; Breakpoints view
+(define-derived-mode gdb-breakpoints-mode gdb-parent-mode "Breakpoints"
+  "Major mode for gdb breakpoints.
+
+\\{gdb-breakpoints-mode-map}"
+  (setq header-line-format gdb-breakpoints-header)
+  (run-mode-hooks 'gdb-breakpoints-mode-hook)
+  'gdb-invalidate-breakpoints)
+
+(defun gdb-toggle-breakpoint ()
+  "Enable/disable breakpoint at current line of breakpoints buffer."
+  (interactive)
+  (save-excursion
+    (beginning-of-line)
+    (let ((breakpoint (get-text-property (point) 'gdb-breakpoint)))
+      (if breakpoint
+          (gud-basic-call
+           (concat (if (string-equal "y" (bindat-get-field breakpoint 'enabled))
+                       "-break-disable "
+                     "-break-enable ")
+                   (bindat-get-field breakpoint 'number)))
+        (error "Not recognized as break/watchpoint line")))))
+
+(defun gdb-delete-breakpoint ()
+  "Delete the breakpoint at current line of breakpoints buffer."
+  (interactive)
+  (save-excursion
+  (beginning-of-line)
+  (let ((breakpoint (get-text-property (point) 'gdb-breakpoint)))
+    (if breakpoint
+        (gud-basic-call (concat "-break-delete " (bindat-get-field breakpoint 'number)))
+      (error "Not recognized as break/watchpoint line")))))
+
+(defun gdb-goto-breakpoint (&optional event)
+  "Go to the location of breakpoint at current line of
+breakpoints buffer."
+  (interactive (list last-input-event))
+  (if event (posn-set-point (event-end event)))
+  ;; Hack to stop gdb-goto-breakpoint displaying in GUD buffer.
+  (let ((window (get-buffer-window gud-comint-buffer)))
+    (if window (save-selected-window  (select-window window))))
+  (save-excursion
+  (beginning-of-line)
+  (let ((breakpoint (get-text-property (point) 'gdb-breakpoint)))
+    (if breakpoint
+       (let ((bptno (bindat-get-field breakpoint 'number))
+             (file  (bindat-get-field breakpoint 'fullname))
+             (line  (bindat-get-field breakpoint 'line)))
+         (save-selected-window
+           (let* ((buffer (find-file-noselect
+                        (if (file-exists-p file) file
+                          (cdr (assoc bptno gdb-location-alist)))))
+                  (window (or (gdb-display-source-buffer buffer)
+                              (display-buffer buffer))))
+             (setq gdb-source-window window)
+             (with-current-buffer buffer
+               (goto-char (point-min))
+               (forward-line (1- (string-to-number line)))
+               (set-window-point window (point))))))
+      (error "Not recognized as break/watchpoint line")))))
+
+\f
+;; Frames buffer.  This displays a perpetually correct bactrack trace.
+;;
+(def-gdb-trigger-and-handler
+  gdb-invalidate-frames (gdb-current-context-command "-stack-list-frames")
+  gdb-stack-list-frames-handler gdb-stack-list-frames-custom
+  '(start update))
+
+(gdb-set-buffer-rules
+ 'gdb-stack-buffer
+ 'gdb-stack-buffer-name
+ 'gdb-frames-mode
+ 'gdb-invalidate-frames)
+
+(defun gdb-frame-location (frame)
+  "Return \" of file:line\" or \" of library\" for structure FRAME.
+
+FRAME must have either \"file\" and \"line\" members or \"from\"
+member."
+  (let ((file (bindat-get-field frame 'file))
+        (line (bindat-get-field frame 'line))
+        (from (bindat-get-field frame 'from)))
+    (let ((res (or (and file line (concat file ":" line))
+                   from)))
+      (if res (concat " of " res) ""))))
+
+(defun gdb-stack-list-frames-custom ()
+  (let ((stack (bindat-get-field (gdb-json-partial-output "frame") 'stack))
+        (table (make-gdb-table)))
+    (set-marker gdb-stack-position nil)
+         (dolist (frame stack)
+           (gdb-table-add-row table
+            (list
+             (bindat-get-field frame 'level)
+             "in"
+             (concat
+              (bindat-get-field frame 'func)
+              (if gdb-stack-buffer-locations
+                  (gdb-frame-location frame) "")
+              (if gdb-stack-buffer-addresses
+                  (concat " at " (bindat-get-field frame 'addr)) "")))
+            `(mouse-face highlight
+              help-echo "mouse-2, RET: Select frame"
+              gdb-frame ,frame)))
+         (insert (gdb-table-string table " ")))
+  (when (and gdb-frame-number
+             (gdb-buffer-shows-main-thread-p))
+    (gdb-mark-line (1+ (string-to-number gdb-frame-number))
+                   gdb-stack-position))
+  (setq mode-name
+        (gdb-current-context-mode-name "Frames")))
+
+(defun gdb-stack-buffer-name ()
+  (gdb-current-context-buffer-name
+   (concat "stack frames of " (gdb-get-target-string))))
+
+(def-gdb-display-buffer
+ gdb-display-stack-buffer
+ 'gdb-stack-buffer
+ "Display backtrace of current stack.")
+
+(def-gdb-preempt-display-buffer
+  gdb-preemptively-display-stack-buffer
+  'gdb-stack-buffer nil t)
+
+(def-gdb-frame-for-buffer
+ gdb-frame-stack-buffer
+ 'gdb-stack-buffer
+ "Display backtrace of current stack in a new frame.")
+
+(defvar gdb-frames-mode-map
+  (let ((map (make-sparse-keymap)))
+    (suppress-keymap map)
+    (define-key map "q" 'kill-this-buffer)
+    (define-key map "\r" 'gdb-select-frame)
+    (define-key map [mouse-2] 'gdb-select-frame)
+    (define-key map [follow-link] 'mouse-face)
+    map))
+
+(defvar gdb-frames-font-lock-keywords
+  '(("in \\([^ ]+\\)"  (1 font-lock-function-name-face)))
+  "Font lock keywords used in `gdb-frames-mode'.")
+
+(define-derived-mode gdb-frames-mode gdb-parent-mode "Frames"
+  "Major mode for gdb call stack.
+
+\\{gdb-frames-mode-map}"
+  (setq gdb-stack-position (make-marker))
+  (add-to-list 'overlay-arrow-variable-list 'gdb-stack-position)
+  (setq truncate-lines t)  ;; Make it easier to see overlay arrow.
+  (set (make-local-variable 'font-lock-defaults)
+       '(gdb-frames-font-lock-keywords))
+  (run-mode-hooks 'gdb-frames-mode-hook)
+  'gdb-invalidate-frames)
+
+(defun gdb-select-frame (&optional event)
+  "Select the frame and display the relevant source."
+  (interactive (list last-input-event))
+  (if event (posn-set-point (event-end event)))
+  (let ((frame (get-text-property (point) 'gdb-frame)))
+    (if frame
+        (if (gdb-buffer-shows-main-thread-p)
+            (let ((new-level (bindat-get-field frame 'level)))
+              (setq gdb-frame-number new-level)
+              (gdb-input (list (concat "-stack-select-frame " new-level) 'ignore))
+              (gdb-update))
+          (error "Could not select frame for non-current thread"))
+      (error "Not recognized as frame line"))))
+
+\f
+;; Locals buffer.
+;; uses "-stack-list-locals --simple-values". Needs GDB 6.1 onwards.
+(def-gdb-trigger-and-handler
+  gdb-invalidate-locals
+  (concat (gdb-current-context-command "-stack-list-locals") " --simple-values")
+  gdb-locals-handler gdb-locals-handler-custom
+  '(start update))
+
+(gdb-set-buffer-rules
+ 'gdb-locals-buffer
+ 'gdb-locals-buffer-name
+ 'gdb-locals-mode
+ 'gdb-invalidate-locals)
+
+(defvar gdb-locals-watch-map
+  (let ((map (make-sparse-keymap)))
+    (suppress-keymap map)
+    (define-key map "\r" 'gud-watch)
+    (define-key map [mouse-2] 'gud-watch)
+    map)
+ "Keymap to create watch expression of a complex data type local variable.")
+
+(defvar gdb-edit-locals-map-1
+  (let ((map (make-sparse-keymap)))
+    (suppress-keymap map)
+    (define-key map "\r" 'gdb-edit-locals-value)
+    (define-key map [mouse-2] 'gdb-edit-locals-value)
+    map)
+ "Keymap to edit value of a simple data type local variable.")
+
+(defun gdb-edit-locals-value (&optional event)
+  "Assign a value to a variable displayed in the locals buffer."
+  (interactive (list last-input-event))
+  (save-excursion
+    (if event (posn-set-point (event-end event)))
+    (beginning-of-line)
+    (let* ((var (bindat-get-field
+                 (get-text-property (point) 'gdb-local-variable) 'name))
+          (value (read-string (format "New value (%s): " var))))
+      (gud-basic-call
+       (concat  "-gdb-set variable " var " = " value)))))
+
+;; Dont display values of arrays or structures.
+;; These can be expanded using gud-watch.
+(defun gdb-locals-handler-custom ()
+  (let ((locals-list (bindat-get-field (gdb-json-partial-output) 'locals))
+        (table (make-gdb-table)))
+    (dolist (local locals-list)
+      (let ((name (bindat-get-field local 'name))
+            (value (bindat-get-field local 'value))
+            (type (bindat-get-field local 'type)))
+        (if (or (not value)
+                (string-match "\\0x" value))
+            (add-text-properties 0 (length name)
+                           `(mouse-face highlight
+                             help-echo "mouse-2: create watch expression"
+                             local-map ,gdb-locals-watch-map)
+                           name)
+          (add-text-properties 0 (length value)
+                               `(mouse-face highlight
+                               help-echo "mouse-2: edit value"
+                               local-map ,gdb-edit-locals-map-1)
+                               value))
+        (gdb-table-add-row
+         table
+         (list
+          (propertize type 'font-lock-face font-lock-type-face)
+          (propertize name 'font-lock-face font-lock-variable-name-face)
+          value)
+         `(gdb-local-variable ,local))))
+    (insert (gdb-table-string table " "))
+    (setq mode-name
+          (gdb-current-context-mode-name
+          (concat "Locals: " (bindat-get-field (gdb-current-buffer-frame) 'func))))))
+
+(defvar gdb-locals-header
+  (list
+   (gdb-propertize-header "Locals" gdb-locals-buffer
+                         nil nil mode-line)
+   " "
+   (gdb-propertize-header "Registers" gdb-registers-buffer
+                         "mouse-1: select" mode-line-highlight mode-line-inactive)))
+
+(defvar gdb-locals-mode-map
+  (let ((map (make-sparse-keymap)))
+    (suppress-keymap map)
+    (define-key map "q" 'kill-this-buffer)
+    (define-key map "\t" '(lambda ()
+                            (interactive)
+                            (gdb-set-window-buffer
+                             (gdb-get-buffer-create
+                              'gdb-registers-buffer
+                              gdb-thread-number) t)))
+     map))
+
+(define-derived-mode gdb-locals-mode gdb-parent-mode "Locals"
+  "Major mode for gdb locals.
+
+\\{gdb-locals-mode-map}"
+  (setq header-line-format gdb-locals-header)
+  (run-mode-hooks 'gdb-locals-mode-hook)
+  'gdb-invalidate-locals)
+
+(defun gdb-locals-buffer-name ()
+  (gdb-current-context-buffer-name
+   (concat "locals of " (gdb-get-target-string))))
+
+(def-gdb-display-buffer
+ gdb-display-locals-buffer
+ 'gdb-locals-buffer
+ "Display local variables of current stack and their values.")
+
+(def-gdb-preempt-display-buffer
+ gdb-preemptively-display-locals-buffer
+ 'gdb-locals-buffer nil t)
+
+(def-gdb-frame-for-buffer
+ gdb-frame-locals-buffer
+ 'gdb-locals-buffer
+ "Display local variables of current stack and their values in a new frame.")
+
+\f
+;; Registers buffer.
+
+(def-gdb-trigger-and-handler
+  gdb-invalidate-registers
+  (concat (gdb-current-context-command "-data-list-register-values") " x")
+  gdb-registers-handler
+  gdb-registers-handler-custom
+  '(start update))
+
+(gdb-set-buffer-rules
+ 'gdb-registers-buffer
+ 'gdb-registers-buffer-name
+ 'gdb-registers-mode
+ 'gdb-invalidate-registers)
+
+(defun gdb-registers-handler-custom ()
+  (when gdb-register-names
+    (let ((register-values (bindat-get-field (gdb-json-partial-output) 'register-values))
+          (table (make-gdb-table)))
+      (dolist (register register-values)
+        (let* ((register-number (bindat-get-field register 'number))
+               (value (bindat-get-field register 'value))
+               (register-name (nth (string-to-number register-number)
+                                   gdb-register-names)))
+          (gdb-table-add-row
+           table
+           (list
+            (propertize register-name 'font-lock-face font-lock-variable-name-face)
+            (if (member register-number gdb-changed-registers)
+                (propertize value 'font-lock-face font-lock-warning-face)
+              value))
+           `(mouse-face highlight
+                        help-echo "mouse-2: edit value"
+                        gdb-register-name ,register-name))))
+      (insert (gdb-table-string table " ")))
+    (setq mode-name
+          (gdb-current-context-mode-name "Registers"))))
+
+(defun gdb-edit-register-value (&optional event)
+  "Assign a value to a register displayed in the registers buffer."
+  (interactive (list last-input-event))
+  (save-excursion
+    (if event (posn-set-point (event-end event)))
+    (beginning-of-line)
+    (let* ((var (bindat-get-field
+                 (get-text-property (point) 'gdb-register-name)))
+          (value (read-string (format "New value (%s): " var))))
+      (gud-basic-call
+       (concat  "-gdb-set variable $" var " = " value)))))
+
+(defvar gdb-registers-mode-map
+  (let ((map (make-sparse-keymap)))
+    (suppress-keymap map)
+    (define-key map "\r" 'gdb-edit-register-value)
+    (define-key map [mouse-2] 'gdb-edit-register-value)
+    (define-key map "q" 'kill-this-buffer)
+    (define-key map "\t" '(lambda ()
+                            (interactive)
+                            (gdb-set-window-buffer
+                             (gdb-get-buffer-create
+                              'gdb-locals-buffer
+                              gdb-thread-number) t)))
+    map))
+
+(defvar gdb-registers-header
+  (list
+   (gdb-propertize-header "Locals" gdb-locals-buffer
+                         "mouse-1: select" mode-line-highlight mode-line-inactive)
+   " "
+   (gdb-propertize-header "Registers" gdb-registers-buffer
+                         nil nil mode-line)))
+
+(define-derived-mode gdb-registers-mode gdb-parent-mode "Registers"
+  "Major mode for gdb registers.
+
+\\{gdb-registers-mode-map}"
+  (setq header-line-format gdb-registers-header)
+  (run-mode-hooks 'gdb-registers-mode-hook)
+  'gdb-invalidate-registers)
+
+(defun gdb-registers-buffer-name ()
+  (gdb-current-context-buffer-name
+   (concat "registers of " (gdb-get-target-string))))
+
+(def-gdb-display-buffer
+ gdb-display-registers-buffer
+ 'gdb-registers-buffer
+ "Display integer register contents.")
+
+(def-gdb-preempt-display-buffer
+  gdb-preemptively-display-registers-buffer
+ 'gdb-registers-buffer nil t)
+
+(def-gdb-frame-for-buffer
+ gdb-frame-registers-buffer
+ 'gdb-registers-buffer
+  "Display integer register contents in a new frame.")
+
+;; Needs GDB 6.4 onwards (used to fail with no stack).
+(defun gdb-get-changed-registers ()
+  (if (and (gdb-get-buffer 'gdb-registers-buffer)
+          (not (gdb-pending-p 'gdb-get-changed-registers)))
+      (progn
+       (gdb-input
+        (list
+         "-data-list-changed-registers"
+         'gdb-changed-registers-handler))
+       (gdb-add-pending 'gdb-get-changed-registers))))
+
+(defun gdb-changed-registers-handler ()
+  (gdb-delete-pending 'gdb-get-changed-registers)
+  (setq gdb-changed-registers nil)
+  (dolist (register-number (bindat-get-field (gdb-json-partial-output) 'changed-registers))
+    (push register-number gdb-changed-registers)))
+
+(defun gdb-register-names-handler ()
+  ;; Don't use gdb-pending-triggers because this handler is called
+  ;; only once (in gdb-init-1)
+  (setq gdb-register-names nil)
+  (dolist (register-name (bindat-get-field (gdb-json-partial-output) 'register-names))
+    (push register-name gdb-register-names))
+  (setq gdb-register-names (reverse gdb-register-names)))
+\f
+
+(defun gdb-get-source-file-list ()
+  "Create list of source files for current GDB session.
+If buffers already exist for any of these files, gud-minor-mode
+is set in them."
+  (goto-char (point-min))
+  (while (re-search-forward gdb-source-file-regexp nil t)
+    (push (match-string 1) gdb-source-file-list))
+  (dolist (buffer (buffer-list))
+    (with-current-buffer buffer
+      (when (member buffer-file-name gdb-source-file-list)
+       (gdb-init-buffer))))
+  (gdb-force-mode-line-update
+   (propertize "ready" 'face font-lock-variable-name-face)))
+
+(defun gdb-get-main-selected-frame ()
+  "Trigger for `gdb-frame-handler' which uses main current
+thread. Called from `gdb-update'."
+  (if (not (gdb-pending-p 'gdb-get-main-selected-frame))
+      (progn
+       (gdb-input
+        (list (gdb-current-context-command "-stack-info-frame") 'gdb-frame-handler))
+       (gdb-add-pending 'gdb-get-main-selected-frame))))
+
+(defun gdb-frame-handler ()
+  "Sets `gdb-selected-frame' and `gdb-selected-file' to show
+overlay arrow in source buffer."
+  (gdb-delete-pending 'gdb-get-main-selected-frame)
+  (let ((frame (bindat-get-field (gdb-json-partial-output) 'frame)))
+    (when frame
+      (setq gdb-selected-frame (bindat-get-field frame 'func))
+      (setq gdb-selected-file (bindat-get-field frame 'fullname))
+      (setq gdb-frame-number (bindat-get-field frame 'level))
+      (setq gdb-frame-address (bindat-get-field frame 'addr))
+      (let ((line (bindat-get-field frame 'line)))
+        (setq gdb-selected-line (and line (string-to-number line)))
+        (when (and gdb-selected-file gdb-selected-line)
+          (setq gud-last-frame (cons gdb-selected-file gdb-selected-line))
+          (gud-display-frame)))
+      (if gud-overlay-arrow-position
+          (let ((buffer (marker-buffer gud-overlay-arrow-position))
+                (position (marker-position gud-overlay-arrow-position)))
+            (when buffer
+              (with-current-buffer buffer
+                (setq fringe-indicator-alist
+                      (if (string-equal gdb-frame-number "0")
+                          nil
+                        '((overlay-arrow . hollow-right-triangle))))
+                (setq gud-overlay-arrow-position (make-marker))
+                (set-marker gud-overlay-arrow-position position))))))))
+
+(defvar gdb-prompt-name-regexp "value=\"\\(.*?\\)\"")
+
+(defun gdb-get-prompt ()
+  "Find prompt for GDB session."
+  (goto-char (point-min))
+  (setq gdb-prompt-name nil)
+  (re-search-forward gdb-prompt-name-regexp nil t)
+  (setq gdb-prompt-name (match-string 1))
+  ;; Insert first prompt.
+  (setq gdb-filter-output (concat gdb-filter-output gdb-prompt-name)))
+
+;;;; Window management
+(defun gdb-display-buffer (buf dedicated &optional frame)
+  "Show buffer BUF.
+
+If BUF is already displayed in some window, show it, deiconifying
+the frame if necessary. Otherwise, find least recently used
+window and show BUF there, if the window is not used for GDB
+already, in which case that window is splitted first."
+  (let ((answer (get-buffer-window buf (or frame 0))))
+    (if answer
+       (display-buffer buf nil (or frame 0)) ;Deiconify the frame if necessary.
+      (let ((window (get-lru-window)))
+       (if (eq (buffer-local-value 'gud-minor-mode (window-buffer window))
+                 'gdbmi)
+           (let* ((largest (get-largest-window))
+                  (cur-size (window-height largest)))
+             (setq answer (split-window largest))
+             (set-window-buffer answer buf)
+             (set-window-dedicated-p answer dedicated)
+             answer)
+         (set-window-buffer window buf)
+         window)))))
+
+(defun gdb-preempt-existing-or-display-buffer (buf &optional split-horizontal)
+  "Find window displaying a buffer with the same
+`gdb-buffer-type' as BUF and show BUF there. If no such window
+exists, just call `gdb-display-buffer' for BUF. If the window
+found is already dedicated, split window according to
+SPLIT-HORIZONTAL and show BUF in the new window."
+  (if buf
+      (when (not (get-buffer-window buf))
+        (let* ((buf-type (gdb-buffer-type buf))
+               (existing-window
+                (get-window-with-predicate
+                 #'(lambda (w)
+                     (and (eq buf-type
+                              (gdb-buffer-type (window-buffer w)))
+                          (not (window-dedicated-p w)))))))
+          (if existing-window
+              (set-window-buffer existing-window buf)
+            (let ((dedicated-window
+                   (get-window-with-predicate
+                    #'(lambda (w)
+                        (eq buf-type
+                            (gdb-buffer-type (window-buffer w)))))))
+              (if dedicated-window
+                  (set-window-buffer
+                   (split-window dedicated-window nil split-horizontal) buf)
+                (gdb-display-buffer buf t))))))
+    (error "Null buffer")))
+\f
+;;; Shared keymap initialization:
+
+(let ((menu (make-sparse-keymap "GDB-Windows")))
+  (define-key gud-menu-map [displays]
+    `(menu-item "GDB-Windows" ,menu
+               :visible (eq gud-minor-mode 'gdbmi)))
+  (define-key menu [gdb] '("Gdb" . gdb-display-gdb-buffer))
+  (define-key menu [threads] '("Threads" . gdb-display-threads-buffer))
+  (define-key menu [memory] '("Memory" . gdb-display-memory-buffer))
+  (define-key menu [disassembly]
+    '("Disassembly" . gdb-display-disassembly-buffer))
+  (define-key menu [registers] '("Registers" . gdb-display-registers-buffer))
+  (define-key menu [inferior]
+    '("IO" . gdb-display-io-buffer))
+  (define-key menu [locals] '("Locals" . gdb-display-locals-buffer))
+  (define-key menu [frames] '("Stack" . gdb-display-stack-buffer))
+  (define-key menu [breakpoints]
+    '("Breakpoints" . gdb-display-breakpoints-buffer)))
+
+(let ((menu (make-sparse-keymap "GDB-Frames")))
+  (define-key gud-menu-map [frames]
+    `(menu-item "GDB-Frames" ,menu
+               :visible (eq gud-minor-mode 'gdbmi)))
+  (define-key menu [gdb] '("Gdb" . gdb-frame-gdb-buffer))
+  (define-key menu [threads] '("Threads" . gdb-frame-threads-buffer))
+  (define-key menu [memory] '("Memory" . gdb-frame-memory-buffer))
+  (define-key menu [disassembly] '("Disassembly" . gdb-frame-disassembly-buffer))
+  (define-key menu [registers] '("Registers" . gdb-frame-registers-buffer))
+  (define-key menu [inferior]
+    '("IO" . gdb-frame-io-buffer))
+  (define-key menu [locals] '("Locals" . gdb-frame-locals-buffer))
+  (define-key menu [frames] '("Stack" . gdb-frame-stack-buffer))
+  (define-key menu [breakpoints]
+    '("Breakpoints" . gdb-frame-breakpoints-buffer)))
+
+(let ((menu (make-sparse-keymap "GDB-MI")))
+  (define-key menu [gdb-customize]
+  '(menu-item "Customize" (lambda () (interactive) (customize-group 'gdb))
+             :help "Customize Gdb Graphical Mode options."))
+  (define-key menu [gdb-many-windows]
+  '(menu-item "Display Other Windows" gdb-many-windows
+             :help "Toggle display of locals, stack and breakpoint information"
+             :button (:toggle . gdb-many-windows)))
+  (define-key menu [gdb-restore-windows]
+  '(menu-item "Restore Window Layout" gdb-restore-windows
+             :help "Restore standard layout for debug session."))
+  (define-key menu [sep1]
+    '(menu-item "--"))
+  (define-key menu [all-threads]
+    '(menu-item "GUD controls all threads"
+                (lambda ()
+                  (interactive)
+                  (setq gdb-gud-control-all-threads t))
+                :help "GUD start/stop commands apply to all threads"
+                :button (:radio . gdb-gud-control-all-threads)))
+  (define-key menu [current-thread]
+    '(menu-item "GUD controls current thread"
+                (lambda ()
+                  (interactive)
+                  (setq gdb-gud-control-all-threads nil))
+                :help "GUD start/stop commands apply to current thread only"
+                :button (:radio . (not gdb-gud-control-all-threads))))
+  (define-key menu [sep2]
+    '(menu-item "--"))
+  (define-key menu [gdb-customize-reasons]
+    '(menu-item "Customize switching..."
+                (lambda ()
+                  (interactive)
+                  (customize-option 'gdb-switch-reasons))))
+  (define-key menu [gdb-switch-when-another-stopped]
+    (menu-bar-make-toggle gdb-toggle-switch-when-another-stopped gdb-switch-when-another-stopped
+                          "Automatically switch to stopped thread"
+                          "GDB thread switching %s"
+                          "Switch to stopped thread"))
+  (define-key gud-menu-map [mi]
+    `(menu-item "GDB-MI" ,menu :visible (eq gud-minor-mode 'gdbmi))))
+
+;; TODO Fit these into tool-bar-local-item-from-menu call in gud.el.
+;; GDB-MI menu will need to be moved to gud.el. We can't use
+;; tool-bar-local-item-from-menu here because it appends new buttons
+;; to toolbar from right to left while we want our A/T throttle to
+;; show up right before Run button.
+(define-key-after gud-tool-bar-map [all-threads]
+  '(menu-item "Switch to non-stop/A mode" gdb-control-all-threads
+              :image (find-image '((:type xpm :file "gud/thread.xpm")))
+              :visible (and (eq gud-minor-mode 'gdbmi)
+                            gdb-non-stop
+                            (not gdb-gud-control-all-threads)))
+  'run)
+
+(define-key-after gud-tool-bar-map [current-thread]
+  '(menu-item "Switch to non-stop/T mode" gdb-control-current-thread
+              :image (find-image '((:type xpm :file "gud/all.xpm")))
+              :visible (and (eq gud-minor-mode 'gdbmi)
+                            gdb-non-stop
+                            gdb-gud-control-all-threads))
+  'all-threads)
+
+(defun gdb-frame-gdb-buffer ()
+  "Display GUD buffer in a new frame."
+  (interactive)
+  (let ((special-display-regexps (append special-display-regexps '(".*")))
+       (special-display-frame-alist
+        (remove '(menu-bar-lines) (remove '(tool-bar-lines)
+                                          gdb-frame-parameters)))
+       (same-window-regexps nil))
+    (display-buffer gud-comint-buffer)))
+
+(defun gdb-display-gdb-buffer ()
+  "Display GUD buffer."
+  (interactive)
+  (let ((same-window-regexps nil))
+    (select-window (display-buffer gud-comint-buffer nil 0))))
+
+(defun gdb-set-window-buffer (name &optional ignore-dedicated)
+  "Set buffer of selected window to NAME and dedicate window.
+
+When IGNORE-DEDICATED is non-nil, buffer is set even if selected
+window is dedicated."
+  (when ignore-dedicated
+    (set-window-dedicated-p (selected-window) nil))
+  (set-window-buffer (selected-window) (get-buffer name))
+  (set-window-dedicated-p (selected-window) t))
+
+(defun gdb-setup-windows ()
+  "Layout the window pattern for `gdb-many-windows'."
+  (gdb-display-locals-buffer)
+  (gdb-display-stack-buffer)
+  (delete-other-windows)
+  (gdb-display-breakpoints-buffer)
+  (delete-other-windows)
+  ; Don't dedicate.
+  (pop-to-buffer gud-comint-buffer)
+  (split-window nil ( / ( * (window-height) 3) 4))
+  (split-window nil ( / (window-height) 3))
+  (split-window-horizontally)
+  (other-window 1)
+  (gdb-set-window-buffer (gdb-locals-buffer-name))
+  (other-window 1)
+  (switch-to-buffer
+       (if gud-last-last-frame
+          (gud-find-file (car gud-last-last-frame))
+        (if gdb-main-file
+            (gud-find-file gdb-main-file)
+          ;; Put buffer list in window if we
+          ;; can't find a source file.
+          (list-buffers-noselect))))
+  (setq gdb-source-window (selected-window))
+  (split-window-horizontally)
+  (other-window 1)
+  (gdb-set-window-buffer
+   (gdb-get-buffer-create 'gdb-inferior-io))
+  (other-window 1)
+  (gdb-set-window-buffer (gdb-stack-buffer-name))
+  (split-window-horizontally)
+  (other-window 1)
+  (gdb-set-window-buffer (if gdb-show-threads-by-default
+                             (gdb-threads-buffer-name)
+                           (gdb-breakpoints-buffer-name)))
+  (other-window 1))
+
+(defcustom gdb-many-windows nil
+  "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
+  :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")))
+  (if (and gud-comint-buffer
+          (buffer-name gud-comint-buffer))
+      (condition-case nil
+         (gdb-restore-windows)
+       (error nil))))
+
+(defun gdb-restore-windows ()
+  "Restore the basic arrangement of windows used by gdb.
+This arrangement depends on the value of `gdb-many-windows'."
+  (interactive)
+  (pop-to-buffer gud-comint-buffer)    ;Select the right window and frame.
+    (delete-other-windows)
+  (if gdb-many-windows
+      (gdb-setup-windows)
+    (when (or gud-last-last-frame gdb-show-main)
+      (split-window)
+      (other-window 1)
+      (switch-to-buffer
+       (if gud-last-last-frame
+          (gud-find-file (car gud-last-last-frame))
+        (gud-find-file gdb-main-file)))
+      (setq gdb-source-window (selected-window))
+      (other-window 1))))
+
+(defun gdb-reset ()
+  "Exit a debugging session cleanly.
+Kills the gdb buffers, and resets variables and the source buffers."
+  (dolist (buffer (buffer-list))
+    (unless (eq buffer gud-comint-buffer)
+      (with-current-buffer buffer
+       (if (eq gud-minor-mode 'gdbmi)
+           (if (string-match "\\` ?\\*.+\\*\\'" (buffer-name))
+               (kill-buffer nil)
+             (gdb-remove-breakpoint-icons (point-min) (point-max) t)
+             (setq gud-minor-mode nil)
+             (kill-local-variable 'tool-bar-map)
+             (kill-local-variable 'gdb-define-alist))))))
+  (setq gdb-disassembly-position nil)
+  (setq overlay-arrow-variable-list
+       (delq 'gdb-disassembly-position overlay-arrow-variable-list))
+  (setq fringe-indicator-alist '((overlay-arrow . right-triangle)))
+  (setq gdb-stack-position nil)
+  (setq overlay-arrow-variable-list
+       (delq 'gdb-stack-position overlay-arrow-variable-list))
+  (setq gdb-thread-position nil)
+  (setq overlay-arrow-variable-list
+       (delq 'gdb-thread-position overlay-arrow-variable-list))
+  (if (boundp 'speedbar-frame) (speedbar-timer-fn))
+  (setq gud-running nil)
+  (setq gdb-active-process nil)
+  (remove-hook 'after-save-hook 'gdb-create-define-alist t))
+
+(defun gdb-get-source-file ()
+  "Find the source file where the program starts and display it with related
+buffers, if required."
+  (goto-char (point-min))
+  (if (re-search-forward gdb-source-file-regexp nil t)
+      (setq gdb-main-file (match-string 1)))
+ (if gdb-many-windows
+      (gdb-setup-windows)
+   (gdb-get-buffer-create 'gdb-breakpoints-buffer)
+   (if gdb-show-main
+       (let ((pop-up-windows t))
+        (display-buffer (gud-find-file gdb-main-file))))))
+
+;;from put-image
+(defun gdb-put-string (putstring pos &optional dprop &rest sprops)
+  "Put string PUTSTRING in front of POS in the current buffer.
+PUTSTRING is displayed by putting an overlay into the current buffer with a
+`before-string' string that has a `display' property whose value is
+PUTSTRING."
+  (let ((string (make-string 1 ?x))
+       (buffer (current-buffer)))
+    (setq putstring (copy-sequence putstring))
+    (let ((overlay (make-overlay pos pos buffer))
+         (prop (or dprop
+                   (list (list 'margin 'left-margin) putstring))))
+      (put-text-property 0 1 'display prop string)
+      (if sprops
+         (add-text-properties 0 1 sprops string))
+      (overlay-put overlay 'put-break t)
+      (overlay-put overlay 'before-string string))))
+
+;;from remove-images
+(defun gdb-remove-strings (start end &optional buffer)
+  "Remove strings between START and END in BUFFER.
+Remove only strings that were put in BUFFER with calls to `gdb-put-string'.
+BUFFER nil or omitted means use the current buffer."
+  (unless buffer
+    (setq buffer (current-buffer)))
+  (dolist (overlay (overlays-in start end))
+    (when (overlay-get overlay 'put-break)
+         (delete-overlay overlay))))
+
+(defun gdb-put-breakpoint-icon (enabled bptno &optional line)
+  (let* ((posns (gdb-line-posns (or line (line-number-at-pos))))
+         (start (- (car posns) 1))
+         (end (+ (cdr posns) 1))
+         (putstring (if enabled "B" "b"))
+         (source-window (get-buffer-window (current-buffer) 0)))
+    (add-text-properties
+     0 1 '(help-echo "mouse-1: clear bkpt, mouse-3: enable/disable bkpt")
+     putstring)
+    (if enabled
+       (add-text-properties
+        0 1 `(gdb-bptno ,bptno gdb-enabled t) putstring)
+      (add-text-properties
+       0 1 `(gdb-bptno ,bptno gdb-enabled nil) putstring))
+    (gdb-remove-breakpoint-icons start end)
+    (if (display-images-p)
+       (if (>= (or left-fringe-width
+                   (if source-window (car (window-fringes source-window)))
+                   gdb-buffer-fringe-width) 8)
+           (gdb-put-string
+            nil (1+ start)
+            `(left-fringe breakpoint
+                          ,(if enabled
+                               'breakpoint-enabled
+                             'breakpoint-disabled))
+            'gdb-bptno bptno
+            'gdb-enabled enabled)
+         (when (< left-margin-width 2)
+           (save-current-buffer
+             (setq left-margin-width 2)
+             (if source-window
+                 (set-window-margins
+                  source-window
+                  left-margin-width right-margin-width))))
+         (put-image
+          (if enabled
+              (or breakpoint-enabled-icon
+                  (setq breakpoint-enabled-icon
+                        (find-image `((:type xpm :data
+                                             ,breakpoint-xpm-data
+                                             :ascent 100 :pointer hand)
+                                      (:type pbm :data
+                                             ,breakpoint-enabled-pbm-data
+                                             :ascent 100 :pointer hand)))))
+            (or breakpoint-disabled-icon
+                (setq breakpoint-disabled-icon
+                      (find-image `((:type xpm :data
+                                           ,breakpoint-xpm-data
+                                           :conversion disabled
+                                           :ascent 100 :pointer hand)
+                                    (:type pbm :data
+                                           ,breakpoint-disabled-pbm-data
+                                           :ascent 100 :pointer hand))))))
+          (+ start 1)
+          putstring
+          'left-margin))
+      (when (< left-margin-width 2)
+       (save-current-buffer
+         (setq left-margin-width 2)
+         (let ((window (get-buffer-window (current-buffer) 0)))
+           (if window
+             (set-window-margins
+              window left-margin-width right-margin-width)))))
+      (gdb-put-string
+       (propertize putstring
+                  'face (if enabled 'breakpoint-enabled 'breakpoint-disabled))
+       (1+ start)))))
+
+(defun gdb-remove-breakpoint-icons (start end &optional remove-margin)
+  (gdb-remove-strings start end)
+  (if (display-images-p)
+      (remove-images start end))
+  (when remove-margin
+    (setq left-margin-width 0)
+    (let ((window (get-buffer-window (current-buffer) 0)))
+      (if window
+         (set-window-margins
+          window left-margin-width right-margin-width)))))
+
+(provide 'gdb-mi)
+
+;; arch-tag: 1b41ea2b-f364-4cec-8f35-e02e4fe01912
+;;; gdb-mi.el ends here
diff --git a/lisp/progmodes/gdb-ui.el b/lisp/progmodes/gdb-ui.el
deleted file mode 100644 (file)
index aa4cfab..0000000
+++ /dev/null
@@ -1,4158 +0,0 @@
-;;; gdb-ui.el --- User Interface for running GDB
-
-;; Author: Nick Roberts <nickrob@gnu.org>
-;; Maintainer: FSF
-;; Keywords: unix, tools
-
-;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
-;; 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/>.
-
-;;; Commentary:
-
-;; This mode acts as a graphical user interface to GDB.  You can interact with
-;; GDB through the GUD buffer in the usual way, but there are also further
-;; buffers which control the execution and describe the state of your program.
-;; It separates the input/output of your program from that of GDB, if
-;; required, and watches expressions in the speedbar.  It also uses features of
-;; Emacs 21 such as the fringe/display margin for breakpoints, and the toolbar
-;; (see the GDB Graphical Interface section in the Emacs info manual).
-
-;; By default, M-x gdb will start the debugger.
-
-;; This file has evolved from gdba.el that was included with GDB 5.0 and
-;; written by Tom Lord and Jim Kingdon.  It uses GDB's annotation interface.
-;; You don't need to know about annotations to use this mode as a debugger,
-;; but if you are interested developing the mode itself, see the Annotations
-;; section in the GDB info manual.
-
-;; GDB developers plan to make the annotation interface obsolete.  A new
-;; interface called GDB/MI (machine interface) has been designed to replace it.
-;; Some GDB/MI commands are used in this file through the CLI command
-;; 'interpreter mi <mi-command>'.  To help with the process of fully migrating
-;; Emacs from annotations to GDB/MI, there is an experimental package called
-;; gdb-mi in the Emacs Lisp Package Archive ("http://tromey.com/elpa/").  It
-;; comprises of modified gud.el and a file called gdb-mi.el which replaces
-;; gdb-ui.el.  When installed, this overrides the current files and invoking
-;; M-x gdb will use GDB/MI directly (starts with "gdb -i=mi").  When deleted
-;; ('d' followed by 'x' in Package Menu mode), the files are deleted and old
-;; functionality restored.  This provides a convenient way to review the
-;; current status/contribute to its improvement.  For someone who just wants to
-;; use GDB, however, the current mode in Emacs 22 is a much better option.
-;; There is also a file, also called gdb-mi.el, a version of which is included
-;; the GDB distribution.  This will probably only work with versions
-;; distributed with GDB 6.5 or later.  Unlike the version in ELPA it works on
-;; top of gdb-ui.el and you can only start it with M-x gdbmi.
-
-;; This mode SHOULD WORK WITH GDB 5.0 or later but you will NEED AT LEAST
-;; GDB 6.0 to use watch expressions.  It works best with GDB 6.4 or later
-;; where watch expressions will update more quickly.
-
-;;; Windows Platforms:
-
-;; If you are using Emacs and GDB on Windows you will need to flush the buffer
-;; explicitly in your program if you want timely display of I/O in Emacs.
-;; Alternatively you can make the output stream unbuffered, for example, by
-;; using a macro:
-
-;;           #ifdef UNBUFFERED
-;;          setvbuf (stdout, (char *) NULL, _IONBF, 0);
-;;          #endif
-
-;; and compiling with -DUNBUFFERED while debugging.
-
-;; If you are using Cygwin GDB and find that the source is not being displayed
-;; in Emacs when you step through it, possible solutions are to:
-
-;;   1) Use Cygwin X Windows and Cygwin Emacs.
-;;        (Since 22.1 Emacs builds under Cygwin.)
-;;   2) Use MinGW GDB instead.
-;;   3) Use cygwin-mount.el
-
-;;; Mac OSX:
-
-;; GDB in Emacs on Mac OSX works best with FSF GDB as Apple have made
-;; some changes to the version that they include as part of Mac OSX.
-;; This requires GDB version 7.0 or later (estimated release date June 2009)
-;; as earlier versions don not compile on Mac OSX.
-
-;;; Known Bugs:
-
-;; 1) Cannot handle multiple debug sessions.
-;; 2) If you wish to call procedures from your program in GDB
-;;    e.g "call myproc ()", "p mysquare (5)" then use level 2 annotations
-;;    "gdb --annotate=2 myprog" to keep source buffer/selected frame fixed.
-;; 3) After detaching from a process, clicking on the "GO" icon on toolbar
-;;    (gud-go) sends "continue" to GDB (should be "run").
-
-;;; TODO:
-
-;; 1) Use MI command -data-read-memory for memory window.
-;; 2) Use tree-buffer.el (from ECB) instead of the speedbar for
-;;    watch-expressions?  Handling of watch-expressions needs to be
-;;    overhauled to work for large arrays/structures by creating variable
-;;    objects for visible watch-expressions only.
-;; 3) Mark breakpoint locations on scroll-bar of source buffer?
-
-;;; Code:
-
-(require 'gud)
-(require 'json)
-(require 'bindat)
-
-(defvar tool-bar-map)
-(defvar speedbar-initial-expansion-list-name)
-(defvar speedbar-frame)
-
-(defvar gdb-pc-address nil "Initialization for Assembler buffer.
-Set to \"main\" at start if `gdb-show-main' is t.")
-(defvar gdb-frame-address nil "Identity of frame for watch expression.")
-(defvar gdb-previous-frame-pc-address nil)
-(defvar gdb-memory-address "main")
-(defvar gdb-previous-frame nil)
-(defvar gdb-selected-frame nil)
-(defvar gdb-frame-number nil)
-(defvar gdb-current-language nil)
-(defvar gdb-var-list nil
-  "List of variables in watch window.
-Each element has the form (VARNUM EXPRESSION NUMCHILD TYPE VALUE STATUS HAS_MORE FP)
-where STATUS is nil (`unchanged'), `changed' or `out-of-scope', FP the frame
-address for root variables.")
-(defvar gdb-main-file nil "Source file from which program execution begins.")
-(defvar gud-old-arrow nil)
-(defvar gdb-thread-indicator nil)
-(defvar gdb-overlay-arrow-position nil)
-(defvar gdb-stack-position nil)
-(defvar gdb-server-prefix nil)
-(defvar gdb-flush-pending-output nil)
-(defvar gdb-location-alist nil
-  "Alist of breakpoint numbers and full filenames.
-Only used for files that Emacs can't find.")
-(defvar gdb-active-process nil
-  "GUD tooltips display variable values when t, and macro definitions otherwise.")
-(defvar gdb-recording nil
-  "If t, then record session for playback and reverse execution")
-(defvar gdb-error "Non-nil when GDB is reporting an error.")
-(defvar gdb-macro-info nil
-  "Non-nil if GDB knows that the inferior includes preprocessor macro info.")
-(defvar gdb-buffer-fringe-width nil)
-(defvar gdb-signalled nil)
-(defvar gdb-source-window nil)
-(defvar gdb-inferior-status nil)
-(defvar gdb-continuation nil)
-(defvar gdb-look-up-stack nil)
-(defvar gdb-frame-begin nil
-  "Non-nil when GDB generates frame-begin annotation.")
-(defvar gdb-printing t)
-(defvar gdb-parent-bptno-enabled nil)
-(defvar gdb-ready nil)
-(defvar gdb-stack-update nil)
-(defvar gdb-early-user-input nil)
-
-(defvar gdb-buffer-type nil
-  "One of the symbols bound in `gdb-buffer-rules'.")
-(make-variable-buffer-local 'gdb-buffer-type)
-
-(defvar gdb-input-queue ()
-  "A list of gdb command objects.")
-
-(defvar gdb-prompting nil
-  "True when gdb is idle with no pending input.")
-
-(defvar gdb-output-sink nil
-  "The disposition of the output of the current gdb command.
-Possible values are these symbols:
-
-    `user' -- gdb output should be copied to the GUD buffer
-              for the user to see.
-
-    `inferior' -- gdb output should be copied to the inferior-io buffer.
-
-    `pre-emacs' -- output should be ignored util the post-prompt
-                   annotation is received.  Then the output-sink
-                  becomes:...
-    `emacs' -- output should be collected in the partial-output-buffer
-              for subsequent processing by a command.  This is the
-              disposition of output generated by commands that
-              gdb mode sends to gdb on its own behalf.
-    `post-emacs' -- ignore output until the prompt annotation is
-                   received, then go to USER disposition.
-
-gdba (gdb-ui.el) uses all five values, gdbmi (gdb-mi.el) only two
-\(`user' and `emacs').")
-
-(defvar gdb-current-item nil
-  "The most recent command item sent to gdb.")
-
-(defvar gdb-pending-triggers '()
-  "A list of trigger functions that have run later than their output handlers.")
-
-(defvar gdb-first-post-prompt nil)
-(defvar gdb-version nil)
-(defvar gdb-locals-font-lock-keywords nil)
-(defvar gdb-source-file-list nil
-  "List of source files for the current executable.")
-(defconst gdb-error-regexp "\\^error,msg=\"\\(.+\\)\"")
-
-(defvar gdb-locals-font-lock-keywords-1
-  '(;; var = (struct struct_tag) value
-    ( "\\(^\\(\\sw\\|[_.]\\)+\\) += +(\\(struct\\) \\(\\(\\sw\\|[_.]\\)+\\)"
-      (1 font-lock-variable-name-face)
-      (3 font-lock-keyword-face)
-      (4 font-lock-type-face))
-    ;; var = (type) value
-    ( "\\(^\\(\\sw\\|[_.]\\)+\\) += +(\\(\\(\\sw\\|[_.]\\)+\\)"
-      (1 font-lock-variable-name-face)
-      (3 font-lock-type-face))
-    ;; var = val
-    ( "\\(^\\(\\sw\\|[_.]\\)+\\) += +[^(]"
-      (1 font-lock-variable-name-face)))
-  "Font lock keywords used in `gdb-local-mode'.")
-
-(defvar gdb-locals-font-lock-keywords-2
-  '(;; var = type value
-    ( "\\(^\\(\\sw\\|[_.]\\)+\\)\t+\\(\\(\\sw\\|[_.]\\)+\\)"
-      (1 font-lock-variable-name-face)
-      (3 font-lock-type-face)))
-  "Font lock keywords used in `gdb-local-mode'.")
-
-;; Variables for GDB 6.4+
-(defvar gdb-register-names nil "List of register names.")
-(defvar gdb-changed-registers nil
-  "List of changed register numbers (strings).")
-
-;;;###autoload
-(defun gdb (command-line)
-  "Run gdb on program FILE in buffer *gud-FILE*.
-The directory containing FILE becomes the initial working
-directory and source-file directory for your debugger.
-
-If `gdb-many-windows' is nil (the default value) then gdb just
-pops 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 inferior.
-
-If `gdb-many-windows' is t, regardless of the value of
-`gdb-show-main', the layout below will appear unless
-`gdb-use-separate-io-buffer' is nil when the source buffer
-occupies the full width of the frame.  Keybindings are shown in
-some of the buffers.
-
-Watch expressions appear in the speedbar/slowbar.
-
-The following commands help control operation :
-
-`gdb-many-windows'    - Toggle the number of windows gdb uses.
-`gdb-restore-windows' - To restore the window layout.
-
-See Info node `(emacs)GDB Graphical Interface' for a more
-detailed description of this mode.
-
-+----------------------------------------------------------------------+
-|                               GDB Toolbar                            |
-+-----------------------------------+----------------------------------+
-|  GUD buffer (I/O of GDB)          |  Locals buffer                   |
-|-----------------------------------+----------------------------------+
-|                                   |                                  |
-|  Source buffer                    |  I/O buffer for debugged program |
-|                                   |                                  |
-|-----------------------------------+----------------------------------+
-|  Stack buffer                     |  Breakpoints/threads buffer      |
-+-----------------------------------+----------------------------------+
-
-The option \"--annotate=3\" must be included in this value.  To
-run GDB in text command mode, use `gud-gdb'.  You need to use
-text command mode to debug multiple programs within one Emacs
-session."
-  (interactive (list (gud-query-cmdline 'gdb)))
-
-  (when (and gud-comint-buffer
-          (buffer-name gud-comint-buffer)
-          (get-buffer-process gud-comint-buffer)
-          (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba)))
-       (gdb-restore-windows)
-       (error
-        "Multiple debugging requires restarting in text command mode"))
-
-  (gud-common-init command-line nil 'gud-gdba-marker-filter)
-  (set (make-local-variable 'gud-minor-mode) 'gdba)
-  (setq comint-input-sender 'gdb-send)
-
-  (gud-def gud-break  "break %f:%l"  "\C-b" "Set breakpoint at current line.")
-  (gud-def gud-tbreak "tbreak %f:%l" "\C-t"
-          "Set temporary breakpoint at current line.")
-  (gud-def gud-remove "clear %f:%l" "\C-d" "Remove breakpoint at current line.")
-  (gud-def gud-step   "step %p"     "\C-s" "Step one source line with display.")
-  (gud-def gud-stepi  "stepi %p"    "\C-i" "Step one instruction with display.")
-  (gud-def gud-next   "next %p"     "\C-n" "Step one line (skip functions).")
-  (gud-def gud-nexti  "nexti %p" nil   "Step one instruction (skip functions).")
-  (gud-def gud-cont   "continue"     "\C-r" "Continue with display.")
-  (gud-def gud-finish "finish"   "\C-f" "Finish executing current function.")
-  (gud-def gud-jump
-          (progn (gud-call "tbreak %f:%l") (gud-call "jump %f:%l"))
-          "\C-j" "Set execution address to current line.")
-
-  (gud-def gud-rstep   "reverse-step %p"  nil "Reverse step one source line with display.")
-  (gud-def gud-rstepi  "reverse-stepi %p" nil "Reverse step one instruction with display.")
-  (gud-def gud-rnext   "reverse-next %p"  nil "Reverse step one line (skip functions).")
-  (gud-def gud-rnexti  "reverse-nexti %p" nil "Reverse step one instruction (skip functions).")
-  (gud-def gud-rcont   "reverse-continue" nil "Reverse continue with display.")
-  (gud-def gud-rfinish "reverse-finish"   nil "Reverse finish executing current function.")
-
-  (gud-def gud-up     "up %p"     "<" "Up N stack frames (numeric arg).")
-  (gud-def gud-down   "down %p"   ">" "Down N stack frames (numeric arg).")
-  (gud-def gud-print  "print %e"  "\C-p" "Evaluate C expression at point.")
-  (gud-def gud-pstar  "print* %e" nil
-          "Evaluate C dereferenced pointer expression at point.")
-
-  ;; For debugging Emacs only.
-  (gud-def gud-pv "pv1 %e"      "\C-v" "Print the value of the lisp variable.")
-
-  (gud-def gud-until  "until %l" "\C-u" "Continue to current line.")
-  (gud-def gud-run    "run"     nil    "Run the program.")
-
-  (local-set-key "\C-i" 'gud-gdb-complete-command)
-  (setq comint-prompt-regexp "^(.*gdb[+]?) *")
-  (setq paragraph-start comint-prompt-regexp)
-  (setq gdb-output-sink 'user)
-  (setq gdb-first-prompt t)
-  (setq gud-running nil)
-  (setq gdb-ready nil)
-  (setq gdb-stack-update nil)
-  (setq gdb-flush-pending-output nil)
-  (setq gdb-early-user-input nil)
-  (setq gud-filter-pending-text nil)
-  (gdb-thread-identification)
-  (run-hooks 'gdb-mode-hook))
-
-;; Keep as an alias for compatibility with Emacs 22.1.
-;;;###autoload
-(defalias 'gdba 'gdb)
-
-(defgroup gdb nil
-  "Gdb Graphical Mode options specifically for running Gdb in Emacs."
-  :group 'processes
-  :group 'tools)
-
-(defcustom gdb-debug-log-max 128
-  "Maximum size of `gdb-debug-log'.  If nil, size is unlimited."
-  :group 'gdb
-  :type '(choice (integer :tag "Number of elements")
-                (const   :tag "Unlimited" nil))
-  :version "22.1")
-
-(defvar gdb-debug-log nil
-  "List of commands sent to and replies received from GDB.
-Most recent commands are listed first.  This list stores only the last
-`gdb-debug-log-max' values.  This variable is used to debug GDB-UI.")
-
-;;;###autoload
-(defcustom gdb-enable-debug nil
-  "Non-nil means record the process input and output in `gdb-debug-log'."
-  :type 'boolean
-  :group 'gdb
-  :version "22.1")
-
-(defcustom gdb-cpp-define-alist-program "gcc -E -dM -"
-  "Shell command for generating a list of defined macros in a source file.
-This list is used to display the #define directive associated
-with an identifier as a tooltip.  It works in a debug session with
-GDB, when `gud-tooltip-mode' is t.
-
-Set `gdb-cpp-define-alist-flags' for any include paths or
-predefined macros."
-  :type 'string
-  :group 'gdb
-  :version "22.1")
-
-(defcustom gdb-cpp-define-alist-flags ""
-  "Preprocessor flags for `gdb-cpp-define-alist-program'."
-  :type 'string
-  :group 'gdb
-  :version "22.1")
-
-(defcustom gdb-create-source-file-list t
-  "Non-nil means create a list of files from which the executable was built.
-Set this to nil if the GUD buffer displays \"initializing...\" in the mode
-line for a long time when starting, possibly because your executable was
-built from a large number of files.  This allows quicker initialization
-but means that these files are not automatically enabled for debugging,
-e.g., you won't be able to click in the fringe to set a breakpoint until
-execution has already stopped there."
-  :type 'boolean
-  :group 'gdb
-  :version "23.1")
-
-(defcustom gdb-show-main nil
-  "Non-nil means display source file containing the main routine at startup.
-Also display the main routine in the disassembly buffer if present."
-  :type 'boolean
-  :group 'gdb
-  :version "22.1")
-
-(defcustom gdb-many-windows nil
-  "If nil, just pop up the GUD buffer unless `gdb-show-main' is t.
-In this case start 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 `gdba'."
-  :type 'boolean
-  :group 'gdb
-  :version "22.1")
-
-(defcustom gdb-use-separate-io-buffer nil
-  "Non-nil means display output from the debugged program in a separate buffer."
-  :type 'boolean
-  :group 'gdb
-  :version "22.1")
-
-(defun gdb-force-mode-line-update (status)
-  (let ((buffer gud-comint-buffer))
-    (if (and buffer (buffer-name buffer))
-       (with-current-buffer buffer
-         (setq mode-line-process
-               (format ":%s [%s]"
-                       (process-status (get-buffer-process buffer)) status))
-         ;; 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"))))
-
-(defun gdb-many-windows (arg)
-  "Toggle the number of windows in the basic arrangement.
-With prefix argument ARG, display additional buffers if ARG is positive,
-otherwise use a single window."
-  (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")))
-  (if (and gud-comint-buffer
-          (buffer-name gud-comint-buffer))
-      (condition-case nil
-         (gdb-restore-windows)
-       (error nil))))
-
-(defun gdb-use-separate-io-buffer (arg)
-  "Toggle separate IO for debugged program.
-With prefix argument ARG, use separate IO if ARG is positive,
-otherwise do not."
-  (interactive "P")
-  (setq gdb-use-separate-io-buffer
-       (if (null arg)
-           (not gdb-use-separate-io-buffer)
-         (> (prefix-numeric-value arg) 0)))
-  (message (format "Separate IO %sabled"
-                  (if gdb-use-separate-io-buffer "en" "dis")))
-  (if (and gud-comint-buffer
-          (buffer-name gud-comint-buffer))
-      (condition-case nil
-         (if gdb-use-separate-io-buffer
-             (if gdb-many-windows (gdb-restore-windows))
-           (kill-buffer (gdb-inferior-io-name)))
-       (error nil))))
-
-(defvar gdb-define-alist nil "Alist of #define directives for GUD tooltips.")
-
-(defun gdb-create-define-alist ()
-  "Create an alist of #define directives for GUD tooltips."
-  (let* ((file (buffer-file-name))
-        (output
-         (with-output-to-string
-           (with-current-buffer standard-output
-             (and file
-                  (file-exists-p file)
-                  ;; call-process doesn't work with remote file names.
-                  (not (file-remote-p default-directory))
-                  (call-process shell-file-name file
-                                (list t nil) nil "-c"
-                                (concat gdb-cpp-define-alist-program " "
-                                        gdb-cpp-define-alist-flags))))))
-       (define-list (split-string output "\n" t)) (name))
-    (setq gdb-define-alist nil)
-    (dolist (define define-list)
-      (setq name (nth 1 (split-string define "[( ]")))
-      (push (cons name define) gdb-define-alist))))
-
-(declare-function tooltip-show "tooltip" (text &optional use-echo-area))
-(defvar tooltip-use-echo-area)
-
-(defun gdb-tooltip-print (expr)
-  (tooltip-show
-   (with-current-buffer (gdb-get-buffer 'gdb-partial-output-buffer)
-     (goto-char (point-min))
-     (let ((string
-           (if (search-forward "=" nil t)
-               (concat expr (buffer-substring (- (point) 2) (point-max)))
-             (buffer-string))))
-       ;; remove newline for gud-tooltip-echo-area
-       (substring string 0 (- (length string) 1))))
-   (or gud-tooltip-echo-area tooltip-use-echo-area
-   (not (display-graphic-p)))))
-
-;; If expr is a macro for a function don't print because of possible dangerous
-;; side-effects.  Also printing a function within a tooltip generates an
-;; unexpected starting annotation (phase error).
-(defun gdb-tooltip-print-1 (expr)
-  (with-current-buffer (gdb-get-buffer 'gdb-partial-output-buffer)
-    (goto-char (point-min))
-    (if (search-forward "expands to: " nil t)
-       (unless (looking-at "\\S-+.*(.*).*")
-         (gdb-enqueue-input
-          (list  (concat gdb-server-prefix "print " expr "\n")
-                 `(lambda () (gdb-tooltip-print ,expr))))))))
-
-(defconst gdb-source-file-regexp "\\(.+?\\), \\|\\([^, \n].*$\\)")
-
-(defun gdb-init-buffer ()
-  (set (make-local-variable 'gud-minor-mode)
-       (buffer-local-value 'gud-minor-mode gud-comint-buffer))
-  (set (make-local-variable 'tool-bar-map) gud-tool-bar-map)
-  (when gud-tooltip-mode
-    (make-local-variable 'gdb-define-alist)
-    (gdb-create-define-alist)
-    (add-hook 'after-save-hook 'gdb-create-define-alist nil t)))
-
-(defun gdb-set-gud-minor-mode-existing-buffers ()
-  "Create list of source files for current GDB session."
-  (goto-char (point-min))
-  (when (search-forward "read in on demand:" nil t)
-    (while (re-search-forward gdb-source-file-regexp nil t)
-      (push (file-name-nondirectory (or (match-string 1) (match-string 2)))
-           gdb-source-file-list))
-    (dolist (buffer (buffer-list))
-      (with-current-buffer buffer
-       (when (and buffer-file-name
-                  (member (file-name-nondirectory buffer-file-name)
-                          gdb-source-file-list))
-         (gdb-init-buffer)))))
-  (gdb-force-mode-line-update
-   (propertize "ready" 'face font-lock-variable-name-face)))
-
-(defun gdb-find-watch-expression ()
-  (let* ((var (nth (- (line-number-at-pos (point)) 2) gdb-var-list))
-        (varnum (car var)) expr array)
-    (string-match "\\(var[0-9]+\\)\\.\\(.*\\)" varnum)
-    (let ((var1 (assoc (match-string 1 varnum) gdb-var-list)) var2 varnumlet
-         (component-list (split-string (match-string 2 varnum) "\\." t)))
-      (setq expr (nth 1 var1))
-      (setq varnumlet (car var1))
-      (dolist (component component-list)
-       (setq var2 (assoc varnumlet gdb-var-list))
-       (setq expr (concat expr
-                          (if (string-match ".*\\[[0-9]+\\]$" (nth 3 var2))
-                              (concat "[" component "]")
-                            (concat "." component))))
-       (setq varnumlet (concat varnumlet "." component)))
-      expr)))
-
-(defun gdb-toggle-recording ()
-"Start/stop recording of debug session."
-  (interactive)
-  (if gud-running
-      (message-box "Recording cannot be started or stopped while your program is still running")
-      (gdb-enqueue-input
-       (list (concat gdb-server-prefix
-                    (if gdb-recording "record stop\n" "target record\n"))
-            'gdb-recording-handler))))
-
-;; Convenience function for tool bar.
-(defalias 'gdb-toggle-recording-1 'gdb-toggle-recording)
-
-(defun gdb-recording-handler ()
-  (goto-char (point-min))
-  (if (re-search-forward "current architecture doesn't support record function" nil t)
-      (message-box "Not enabled.  The current architecture doesn't support the process record function.")
-    (goto-char (point-min))
-    (if (re-search-forward "Undefined target command" nil t)
-       (message-box "Not enabled.  Process record requires GDB 7.0 onwards.")
-      (goto-char (point-min))
-      (if (re-search-forward "the program is not being run" nil t)
-         (message-box "Not enabled.  Starting process recording requires an active target (running process).")
-       (setq gdb-recording (not gdb-recording))
-       ;; Actually forcing the tool-bar to update.
-       (force-mode-line-update)))))
-
-(defun gdb-init-1 ()
-  (gud-def gud-break (if (not (string-match "Machine" mode-name))
-                        (gud-call "break %f:%l" arg)
-                      (save-excursion
-                        (beginning-of-line)
-                        (forward-char 2)
-                        (gud-call "break *%a" arg)))
-          "\C-b" "Set breakpoint at current line or address.")
-  ;;
-  (gud-def gud-remove (if (not (string-match "Machine" mode-name))
-                         (gud-call "clear %f:%l" arg)
-                       (save-excursion
-                         (beginning-of-line)
-                         (forward-char 2)
-                         (gud-call "clear *%a" arg)))
-          "\C-d" "Remove breakpoint at current line or address.")
-  ;;
-  (gud-def gud-until (if (not (string-match "Machine" mode-name))
-                        (gud-call "until %f:%l" arg)
-                      (save-excursion
-                        (beginning-of-line)
-                        (forward-char 2)
-                        (gud-call "until *%a" arg)))
-          "\C-u" "Continue to current line or address.")
-  ;;
-  (gud-def gud-go (gud-call (if gdb-active-process "continue" "run") arg)
-          nil "Start or continue execution.")
-
-  ;; For debugging Emacs only.
-  (gud-def gud-pp
-          (gud-call
-           (concat
-            "pp1 " (if (eq (buffer-local-value
-                            'major-mode (window-buffer)) 'speedbar-mode)
-                       (gdb-find-watch-expression) "%e")) arg)
-          nil   "Print the Emacs s-expression.")
-
-  (define-key gud-minor-mode-map [left-margin mouse-1]
-    'gdb-mouse-set-clear-breakpoint)
-  (define-key gud-minor-mode-map [left-fringe mouse-1]
-    'gdb-mouse-set-clear-breakpoint)
-   (define-key gud-minor-mode-map [left-margin C-mouse-1]
-    'gdb-mouse-toggle-breakpoint-margin)
-  (define-key gud-minor-mode-map [left-fringe C-mouse-1]
-    'gdb-mouse-toggle-breakpoint-fringe)
-
-  (define-key gud-minor-mode-map [left-margin drag-mouse-1]
-    'gdb-mouse-until)
-  (define-key gud-minor-mode-map [left-fringe drag-mouse-1]
-    'gdb-mouse-until)
-  (define-key gud-minor-mode-map [left-margin mouse-3]
-    'gdb-mouse-until)
-  (define-key gud-minor-mode-map [left-fringe mouse-3]
-    'gdb-mouse-until)
-
-  (define-key gud-minor-mode-map [left-margin C-drag-mouse-1]
-    'gdb-mouse-jump)
-  (define-key gud-minor-mode-map [left-fringe C-drag-mouse-1]
-    'gdb-mouse-jump)
-  (define-key gud-minor-mode-map [left-fringe C-mouse-3]
-    'gdb-mouse-jump)
-  (define-key gud-minor-mode-map [left-margin C-mouse-3]
-    'gdb-mouse-jump)
-
-  ;; (re-)initialize
-  (setq gdb-pc-address (if gdb-show-main "main" nil))
-  (setq gdb-previous-frame-pc-address nil
-       gdb-memory-address "main"
-       gdb-previous-frame nil
-       gdb-selected-frame nil
-       gdb-current-language nil
-       gdb-frame-number nil
-       gdb-var-list nil
-       gdb-main-file nil
-       gdb-first-post-prompt t
-       gdb-prompting nil
-       gdb-input-queue nil
-       gdb-current-item nil
-       gdb-pending-triggers nil
-       gdb-output-sink 'user
-       gdb-server-prefix "server "
-       gdb-location-alist nil
-       gdb-source-file-list nil
-       gdb-error nil
-       gdb-macro-info nil
-       gdb-buffer-fringe-width (car (window-fringes))
-       gdb-debug-log nil
-       gdb-signalled nil
-       gdb-source-window nil
-       gdb-inferior-status nil
-       gdb-continuation nil
-       gdb-look-up-stack nil
-        gdb-frame-begin nil
-       gdb-printing t
-       gud-old-arrow nil
-       gdb-thread-indicator nil
-       gdb-register-names nil
-       gdb-recording nil)
-
-  (setq gdb-buffer-type 'gdba)
-
-  (if gdb-use-separate-io-buffer (gdb-clear-inferior-io))
-
-  (if (eq system-type 'darwin)
-      (gdb-enqueue-input (list "server show version\n" 'gdb-apple-test)))
-
-  ;; Hack to see test for GDB 6.4+ (-stack-info-frame was implemented in 6.4)
-  (gdb-enqueue-input (list "server interpreter mi -stack-info-frame\n"
-                          'gdb-get-version)))
-
-(defun gdb-init-2 ()
-  (if (eq window-system 'w32)
-      (gdb-enqueue-input (list "set new-console off\n" 'ignore)))
-  (gdb-enqueue-input (list "set height 0\n" 'ignore))
-  (gdb-enqueue-input (list "set width 0\n" 'ignore))
-
-  (if (string-equal gdb-version "pre-6.4")
-      (if gdb-create-source-file-list
-       (gdb-enqueue-input (list (concat gdb-server-prefix "info sources\n")
-                                'gdb-set-gud-minor-mode-existing-buffers))
-       (setq gdb-locals-font-lock-keywords gdb-locals-font-lock-keywords-1))
-    ; Needs GDB 6.2 onwards.
-    (if gdb-create-source-file-list
-       (gdb-enqueue-input
-        (list "server interpreter mi \"-file-list-exec-source-files\"\n"
-              'gdb-set-gud-minor-mode-existing-buffers-1)))
-    (setq gdb-locals-font-lock-keywords gdb-locals-font-lock-keywords-2)
-    ; Needs GDB 7.0 onwards.
-    (gdb-enqueue-input
-     (list "server interpreter mi -enable-pretty-printing\n" 'ignore)))
-
-  ;; Find source file and compilation directory here.
-  ;; Works for C, C++, Fortran and Ada but not Java (GDB 6.4)
-  (gdb-enqueue-input (list "server list\n" 'ignore))
-  (gdb-enqueue-input (list "server list MAIN__\n" 'ignore))
-  (gdb-enqueue-input (list "server info source\n" 'gdb-source-info)))
-
-;; Workaround for some Apple versions of GDB that add ^M at EOL
-;; after the command "server interpreter mi -stack-info-frame".
-(defun gdb-apple-test ()
-  (goto-char (point-min))
-  (if (re-search-forward "(Apple version " nil t)
-      (let* ((process (get-buffer-process gud-comint-buffer))
-            (coding-systems (process-coding-system process)))
-       (set-process-coding-system process
-                                  (coding-system-change-eol-conversion
-                                   (car coding-systems) 'dos)
-                                  (cdr coding-systems)))))
-
-(defun gdb-get-version ()
-  (goto-char (point-min))
-  (if (re-search-forward "Undefined\\( mi\\)* command:" nil t)
-      (setq gdb-version "pre-6.4")
-    (setq gdb-version "6.4+"))
-  (gdb-init-2))
-
-(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))))))
-
-(defun gdb-mouse-until (event)
-  "Continue running until a source line past the current line.
-The destination source line can be selected either by clicking
-with mouse-3 on the fringe/margin or dragging the arrow
-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-overlay-arrow-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"))))))
-
-(defun gdb-mouse-jump (event)
-  "Set execution address/line.
-The destination source line can be selected either by clicking with C-mouse-3
-on the fringe/margin or dragging the arrow with C-mouse-1 (default bindings).
-Unlike `gdb-mouse-until' the destination address can be before the current
-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-overlay-arrow-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")))))))
-
-(defcustom gdb-speedbar-auto-raise nil
-  "If non-nil raise speedbar every time display of watch expressions is\
- updated."
-  :type 'boolean
-  :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"))))
-
-(defcustom gdb-use-colon-colon-notation nil
-  "If non-nil use FUN::VAR format to display variables in the speedbar."
-  :type 'boolean
-  :group 'gdb
-  :version "22.1")
-
-(define-key gud-minor-mode-map "\C-c\C-w" 'gud-watch)
-(define-key global-map (concat gud-key-prefix "\C-w") 'gud-watch)
-
-(declare-function tooltip-identifier-from-point "tooltip" (point))
-
-(defun gud-watch (&optional arg event)
-  "Watch expression at point.
-With arg, enter name of variable to be watched in the minibuffer."
-  (interactive (list current-prefix-arg last-input-event))
-  (let ((minor-mode (buffer-local-value 'gud-minor-mode gud-comint-buffer)))
-    (if (memq minor-mode '(gdbmi gdba))
-       (progn
-         (if event (posn-set-point (event-end event)))
-         (require 'tooltip)
-         (save-selected-window
-           (let ((expr
-                  (if arg
-                      (completing-read "Name of variable: "
-                                       'gud-gdb-complete-command)
-                    (if (and transient-mark-mode mark-active)
-                        (buffer-substring (region-beginning) (region-end))
-                      (concat (if (eq major-mode 'gdb-registers-mode) "$")
-                              (tooltip-identifier-from-point (point)))))))
-             (set-text-properties 0 (length expr) nil expr)
-             (gdb-enqueue-input
-              (list
-               (if (eq minor-mode 'gdba)
-                   (concat
-                    "server interpreter mi \"-var-create - * "  expr "\"\n")
-                 (concat"-var-create - * "  expr "\n"))
-               `(lambda () (gdb-var-create-handler ,expr)))))))
-      (message "gud-watch is a no-op in this mode."))))
-
-(declare-function speedbar-change-initial-expansion-list "speedbar" (new-default))
-
-(defun gdb-var-create-handler (expr)
-  (let* ((result (gdb-json-partial-output)))
-    (if (not (bindat-get-field result 'msg))
-        (let ((var
-              (list (bindat-get-field result 'name)
-                    (if (and (string-equal gdb-current-language "c")
-                             gdb-use-colon-colon-notation gdb-selected-frame)
-                        (setq expr (concat gdb-selected-frame "::" expr))
-                      expr)
-                    (bindat-get-field result 'numchild)
-                    (bindat-get-field result 'type)
-                    (bindat-get-field result 'value)
-                    nil
-                    (bindat-get-field result 'has_more)
-                     gdb-frame-address)))
-         (push var gdb-var-list)
-         (speedbar 1)
-         (unless (string-equal
-                  speedbar-initial-expansion-list-name "GUD")
-           (speedbar-change-initial-expansion-list "GUD")))
-      (message-box "No symbol \"%s\" in current context." expr))))
-
-(declare-function speedbar-timer-fn "speedbar" ())
-
-(defun gdb-speedbar-update ()
-  (when (and (boundp 'speedbar-frame) (frame-live-p speedbar-frame)
-            (not (member 'gdb-speedbar-timer gdb-pending-triggers)))
-    ;; Dummy command to update speedbar even when idle.
-    (gdb-enqueue-input (list "server pwd\n" 'gdb-speedbar-timer-fn))
-    ;; Keep gdb-pending-triggers non-nil till end.
-    (push 'gdb-speedbar-timer gdb-pending-triggers)))
-
-(defun gdb-speedbar-timer-fn ()
-  (if gdb-speedbar-auto-raise
-      (raise-frame speedbar-frame))
-  (setq gdb-pending-triggers
-       (delq 'gdb-speedbar-timer gdb-pending-triggers))
-  (speedbar-timer-fn))
-
-(defun gdb-var-evaluate-expression-handler (varnum changed)
-  (goto-char (point-min))
-  (re-search-forward "\\(.+\\)\\^done,value=\\(\".*\"\\)" nil t)
-  (setq gdb-pending-triggers
-       (delq (string-to-number (match-string 1)) gdb-pending-triggers))
-  (let ((var (assoc varnum gdb-var-list)))
-    (when var
-      (if changed (setcar (nthcdr 5 var) 'changed))
-      (setcar (nthcdr 4 var) (read (match-string 2)))))
-  (gdb-speedbar-update))
-
-(defun gdb-var-list-children (varnum)
-  (gdb-enqueue-input
-   (list (concat "server interpreter mi \"-var-list-children " varnum "\"\n")
-        `(lambda () (gdb-var-list-children-handler ,varnum)))))
-
-(defconst gdb-var-list-children-regexp
-  "child={.*?name=\"\\(.*?\\)\".*?,exp=\"\\(.*?\\)\".*?,\
-numchild=\"\\(.*?\\)\"\\(}\\|.*?,\\(type=\"\\(.*?\\)\"\\)?.*?}\\)")
-
-(defun gdb-var-list-children-handler (varnum)
-  (goto-char (point-min))
-  (let ((var-list nil))
-    (catch 'child-already-watched
-      (dolist (var gdb-var-list)
-       (if (string-equal varnum (car var))
-           (progn
-             (push var var-list)
-             (while (re-search-forward gdb-var-list-children-regexp nil t)
-               (let ((varchild (list (match-string 1)
-                                     (match-string 2)
-                                     (match-string 3)
-                                     (match-string 6)
-                                     nil nil)))
-                 (if (assoc (car varchild) gdb-var-list)
-                     (throw 'child-already-watched nil))
-                 (push varchild var-list)
-                 (gdb-enqueue-input
-                  (list
-                   (concat
-                    "server interpreter mi \"0-var-evaluate-expression "
-                    (car varchild) "\"\n")
-                   `(lambda () (gdb-var-evaluate-expression-handler
-                                ,(car varchild) nil)))))))
-         (push var var-list)))
-      (setq gdb-var-list (nreverse var-list)))))
-
-(defun gdb-var-update ()
-  (when (not (member 'gdb-var-update gdb-pending-triggers))
-    (gdb-enqueue-input
-     (list "server interpreter mi \"-var-update *\"\n"
-          'gdb-var-update-handler))
-    (push 'gdb-var-update gdb-pending-triggers)))
-
-(defconst gdb-var-update-regexp
-  "{.*?name=\"\\(.*?\\)\".*?,in_scope=\"\\(.*?\\)\".*?,\
-type_changed=\".*?\".*?}")
-
-(defun gdb-var-update-handler ()
-  (dolist (var gdb-var-list)
-    (setcar (nthcdr 5 var) nil))
-  (goto-char (point-min))
-  (let ((n 0))
-    (while (re-search-forward gdb-var-update-regexp nil t)
-      (let ((varnum (match-string 1)))
-       (if  (string-equal (match-string 2) "false")
-           (let ((var (assoc varnum gdb-var-list)))
-             (if var (setcar (nthcdr 5 var) 'out-of-scope)))
-         (setq n (1+ n))
-         (push n gdb-pending-triggers)
-         (gdb-enqueue-input
-          (list
-           (concat "server interpreter mi \"" (number-to-string n)
-                   "-var-evaluate-expression " varnum "\"\n")
-         `(lambda () (gdb-var-evaluate-expression-handler ,varnum t))))))))
-  (setq gdb-pending-triggers
-       (delq 'gdb-var-update gdb-pending-triggers)))
-
-(defun gdb-var-set-format (format)
-  "Set the output format for a variable displayed in the speedbar."
-  (let* ((var (nth (- (count-lines (point-min) (point)) 2) gdb-var-list))
-        (varnum (car var)))
-    (gdb-enqueue-input
-     (list
-      (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba)
-         (concat "server interpreter mi \"-var-set-format "
-                 varnum " " format "\"\n")
-       (concat "-var-set-format " varnum " " format "\n"))
-          `(lambda () (gdb-var-set-format-handler ,varnum))))))
-
-(defconst gdb-var-set-format-regexp
-  "format=\"\\(.*?\\)\",.*value=\"\\(.*?\\)\"")
-
-(defun gdb-var-set-format-handler (varnum)
-  (goto-char (point-min))
-  (if (re-search-forward gdb-var-set-format-regexp nil t)
-      (let ((var (assoc varnum gdb-var-list)))
-       (setcar (nthcdr 4 var) (match-string 2))
-       (gdb-var-update-1))))
-
-(defun gdb-var-delete-1 (var varnum)
-  (gdb-enqueue-input
-   (list
-    (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba)
-       (concat "server interpreter mi \"-var-delete " varnum "\"\n")
-      (concat "-var-delete " varnum "\n"))
-    'ignore))
-  (setq gdb-var-list (delq var gdb-var-list))
-  (dolist (varchild gdb-var-list)
-    (if (string-match (concat (car var) "\\.") (car varchild))
-       (setq gdb-var-list (delq varchild gdb-var-list)))))
-
-(defun gdb-var-delete ()
-  "Delete watch expression at point from the speedbar."
-  (interactive)
-  (if (memq (buffer-local-value 'gud-minor-mode gud-comint-buffer)
-           '(gdbmi gdba))
-      (let* ((var (nth (- (count-lines (point-min) (point)) 2) gdb-var-list))
-            (varnum (car var)))
-       (if (string-match "\\." (car var))
-           (message-box "Can only delete a root expression")
-         (gdb-var-delete-1 var varnum)))))
-
-(defun gdb-var-delete-children (varnum)
-  "Delete children of variable object at point from the speedbar."
-  (gdb-enqueue-input
-   (list
-    (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba)
-       (concat "server interpreter mi \"-var-delete -c " varnum "\"\n")
-      (concat "-var-delete -c " varnum "\n")) 'ignore)))
-
-(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: "))
-    (gdb-enqueue-input
-     (list
-      (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba)
-         (concat "server interpreter mi \"-var-assign "
-                 varnum " " value "\"\n")
-       (concat "-var-assign " varnum " " value "\n"))
-          `(lambda () (gdb-edit-value-handler ,value))))))
-
-(defun gdb-edit-value-handler (value)
-  (goto-char (point-min))
-  (if (re-search-forward gdb-error-regexp nil t)
-      (message-box "Invalid number or expression (%s)" value)))
-
-(defcustom gdb-show-changed-values t
-  "If non-nil change the face of out of scope variables and changed values.
-Out of scope variables are suppressed with `shadow' face.
-Changed values are highlighted with the face `font-lock-warning-face'."
-  :type 'boolean
-  :group 'gdb
-  :version "22.1")
-
-(defcustom gdb-max-children 40
-  "Maximum number of children before expansion requires confirmation."
-  :type 'integer
-  :group 'gdb
-  :version "22.1")
-
-(defcustom gdb-delete-out-of-scope t
-  "If non-nil delete watch expressions automatically when they go out of scope."
-  :type 'boolean
-  :group 'gdb
-  :version "22.2")
-
-(declare-function speedbar-change-expand-button-char "speedbar" (char))
-(declare-function speedbar-delete-subblock "speedbar" (indent))
-(declare-function speedbar-center-buffer-smartly "speedbar" ())
-
-(defun gdb-speedbar-expand-node (text token indent)
-  "Expand the node the user clicked on.
-TEXT is the text of the button we clicked on, a + or - item.
-TOKEN is data related to this node.
-INDENT is the current indentation depth."
-  (if (and gud-comint-buffer (buffer-name gud-comint-buffer))
-      (progn
-       (cond ((string-match "+" text)  ;expand this node
-              (let* ((var (assoc token gdb-var-list))
-                     (expr (nth 1 var)) (children (nth 2 var)))
-                (if (or (<= (string-to-number children) gdb-max-children)
-                         (y-or-n-p
-                          (format
-                           "%s has %s children.  Continue? " expr children)))
-                    (if (and (eq (buffer-local-value
-                                  'gud-minor-mode gud-comint-buffer) 'gdba)
-                             (string-equal gdb-version "pre-6.4"))
-                        (gdb-var-list-children token)
-                      (gdb-var-list-children-1 token)))))
-             ((string-match "-" text)  ;contract this node
-              (dolist (var gdb-var-list)
-                (if (string-match (concat token "\\.") (car var))
-                    (setq gdb-var-list (delq var gdb-var-list))))
-              (gdb-var-delete-children token)
-              (speedbar-change-expand-button-char ?+)
-              (speedbar-delete-subblock indent))
-             (t (error "Ooops...  not sure what to do")))
-       (speedbar-center-buffer-smartly))
-    (message-box "GUD session has been killed")))
-
-(defun gdb-get-target-string ()
-  (with-current-buffer gud-comint-buffer
-    gud-target-name))
-\f
-
-;;
-;; gdb buffers.
-;;
-;; Each buffer has a TYPE -- a symbol that identifies the function
-;; of that particular buffer.
-;;
-;; The usual gdb interaction buffer is given the type `gdba' and
-;; is constructed specially.
-;;
-;; Others are constructed by gdb-get-buffer-create and
-;; named according to the rules set forth in the gdb-buffer-rules-assoc
-
-(defvar gdb-buffer-rules-assoc '())
-
-(defun gdb-get-buffer (key)
-  "Return the gdb buffer tagged with type KEY.
-The key should be one of the cars in `gdb-buffer-rules-assoc'."
-  (save-excursion
-    (gdb-look-for-tagged-buffer key (buffer-list))))
-
-(defun gdb-get-buffer-create (key)
-  "Create a new gdb buffer of the type specified by KEY.
-The key should be one of the cars in `gdb-buffer-rules-assoc'."
-  (or (gdb-get-buffer key)
-      (let* ((rules (assoc key gdb-buffer-rules-assoc))
-            (name (funcall (gdb-rules-name-maker rules)))
-            (new (get-buffer-create name)))
-       (with-current-buffer new
-         (let ((trigger))
-           (if (cdr (cdr rules))
-               (setq trigger (funcall (car (cdr (cdr rules))))))
-           (setq gdb-buffer-type key)
-           (set (make-local-variable 'gud-minor-mode)
-                (buffer-local-value 'gud-minor-mode gud-comint-buffer))
-           (set (make-local-variable 'tool-bar-map) gud-tool-bar-map)
-           (if trigger (funcall trigger)))
-         new))))
-
-(defun gdb-rules-name-maker (rules) (car (cdr rules)))
-
-(defun gdb-look-for-tagged-buffer (key bufs)
-  (let ((retval nil))
-    (while (and (not retval) bufs)
-      (set-buffer (car bufs))
-      (if (eq gdb-buffer-type key)
-         (setq retval (car bufs)))
-      (setq bufs (cdr bufs)))
-    retval))
-
-;;
-;; This assoc maps buffer type symbols to rules.  Each rule is a list of
-;; at least one and possible more functions.  The functions have these
-;; roles in defining a buffer type:
-;;
-;;     NAME - Return a name for this  buffer type.
-;;
-;; The remaining function(s) are optional:
-;;
-;;     MODE - called in a new buffer with no arguments, should establish
-;;           the proper mode for the buffer.
-;;
-
-(defun gdb-set-buffer-rules (buffer-type &rest rules)
-  (let ((binding (assoc buffer-type gdb-buffer-rules-assoc)))
-    (if binding
-       (setcdr binding rules)
-      (push (cons buffer-type rules)
-           gdb-buffer-rules-assoc))))
-
-;; GUD buffers are an exception to the rules
-(gdb-set-buffer-rules 'gdba 'error)
-
-;; Partial-output buffer : This accumulates output from a command executed on
-;; behalf of emacs (rather than the user).
-;;
-(gdb-set-buffer-rules 'gdb-partial-output-buffer
-                     'gdb-partial-output-name)
-
-(defun gdb-partial-output-name ()
-  (concat " *partial-output-"
-         (gdb-get-target-string)
-         "*"))
-
-\f
-(gdb-set-buffer-rules 'gdb-inferior-io
-                     'gdb-inferior-io-name
-                     'gdb-inferior-io-mode)
-
-(defun gdb-inferior-io-name ()
-  (concat "*input/output of "
-         (gdb-get-target-string)
-         "*"))
-
-(defun gdb-display-separate-io-buffer ()
-  "Display IO of debugged program in a separate window."
-  (interactive)
-  (if gdb-use-separate-io-buffer
-      (gdb-display-buffer
-       (gdb-get-buffer-create 'gdb-inferior-io) t)))
-
-(defconst gdb-frame-parameters
-  '((height . 14) (width . 80)
-    (unsplittable . t)
-    (tool-bar-lines . nil)
-    (menu-bar-lines . nil)
-    (minibuffer . nil)))
-
-(defun gdb-frame-separate-io-buffer ()
-  "Display IO of debugged program in a new frame."
-  (interactive)
-  (if gdb-use-separate-io-buffer
-      (let ((special-display-regexps (append special-display-regexps '(".*")))
-           (special-display-frame-alist gdb-frame-parameters))
-       (display-buffer (gdb-get-buffer-create 'gdb-inferior-io)))))
-
-(defvar gdb-inferior-io-mode-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map "\C-c\C-c" 'gdb-separate-io-interrupt)
-    (define-key map "\C-c\C-z" 'gdb-separate-io-stop)
-    (define-key map "\C-c\C-\\" 'gdb-separate-io-quit)
-    (define-key map "\C-c\C-d" 'gdb-separate-io-eof)
-    (define-key map "\C-d" 'gdb-separate-io-eof)
-    map))
-
-(define-derived-mode gdb-inferior-io-mode comint-mode "Inferior I/O"
-  "Major mode for gdb inferior-io."
-  :syntax-table nil :abbrev-table nil
-  ;; We want to use comint because it has various nifty and familiar
-  ;; features.  We don't need a process, but comint wants one, so create
-  ;; a dummy one.
-  (make-comint-in-buffer
-   (substring (buffer-name) 1 (- (length (buffer-name)) 1))
-   (current-buffer) "hexl")
-  (setq comint-input-sender 'gdb-inferior-io-sender))
-
-(defun gdb-inferior-io-sender (proc string)
-  ;; PROC is the pseudo-process created to satisfy comint.
-  (with-current-buffer (process-buffer proc)
-    (setq proc (get-buffer-process gud-comint-buffer))
-    (process-send-string proc string)
-    (process-send-string proc "\n")))
-
-(defun gdb-separate-io-interrupt ()
-  "Interrupt the program being debugged."
-  (interactive)
-  (interrupt-process
-   (get-buffer-process gud-comint-buffer) comint-ptyp))
-
-(defun gdb-separate-io-quit ()
-  "Send quit signal to the program being debugged."
-  (interactive)
-  (quit-process
-   (get-buffer-process gud-comint-buffer) comint-ptyp))
-
-(defun gdb-separate-io-stop ()
-  "Stop the program being debugged."
-  (interactive)
-  (stop-process
-   (get-buffer-process gud-comint-buffer) comint-ptyp))
-
-(defun gdb-separate-io-eof ()
-  "Send end-of-file to the program being debugged."
-  (interactive)
-  (process-send-eof
-   (get-buffer-process gud-comint-buffer)))
-\f
-
-;; gdb communications
-;;
-
-;; INPUT: things sent to gdb
-;;
-;; The queues are lists.  Each element is either a string (indicating user or
-;; user-like input) or a list of the form:
-;;
-;;    (INPUT-STRING  HANDLER-FN)
-;;
-;; The handler function will be called from the partial-output buffer when the
-;; command completes.  This is the way to write commands which invoke gdb
-;; commands autonomously.
-;;
-;; These lists are consumed tail first.
-;;
-
-(defun gdb-send (proc string)
-  "A comint send filter for gdb.
-This filter may simply queue input for a later time."
-  (if gdb-ready
-      (progn
-       (with-current-buffer gud-comint-buffer
-         (let ((inhibit-read-only t))
-           (remove-text-properties (point-min) (point-max) '(face))))
-       (if gud-running
-           (progn
-             (let ((item (concat string "\n")))
-               (if gdb-enable-debug (push (cons 'send item) gdb-debug-log))
-               (process-send-string proc item)))
-         (if (string-match "\\\\\\'" string)
-             (setq gdb-continuation (concat gdb-continuation string "\n"))
-           (let ((item (concat
-                        gdb-continuation string
-                        (if (not comint-input-sender-no-newline) "\n"))))
-             (gdb-enqueue-input item)
-             (setq gdb-continuation nil)))))
-    (push (concat string "\n")  gdb-early-user-input)))
-
-;; Note: Stuff enqueued here will be sent to the next prompt, even if it
-;; is a query, or other non-top-level prompt.
-
-(defun gdb-enqueue-input (item)
-  (if (not gud-running)
-      (if gdb-prompting
-         (progn
-           (gdb-send-item item)
-           (setq gdb-prompting nil))
-       (push item gdb-input-queue))))
-
-(defun gdb-dequeue-input ()
-  (let ((queue gdb-input-queue))
-    (if queue
-       (let ((last (car (last queue))))
-         (unless (nbutlast queue) (setq gdb-input-queue '()))
-         last)
-      ;; This should be nil here anyway but set it just to make sure.
-      (setq gdb-pending-triggers nil))))
-
-(defun gdb-send-item (item)
-  (setq gdb-flush-pending-output nil)
-  (if gdb-enable-debug (push (cons 'send-item item) gdb-debug-log))
-  (setq gdb-current-item item)
-  (let ((process (get-buffer-process gud-comint-buffer)))
-    (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba)
-       (if (stringp item)
-           (progn
-             (setq gdb-output-sink 'user)
-             (process-send-string process item))
-         (progn
-           (gdb-clear-partial-output)
-           (setq gdb-output-sink 'pre-emacs)
-           (process-send-string process
-                                (car item))))
-      ;; case: eq gud-minor-mode 'gdbmi
-      (gdb-clear-partial-output)
-      (setq gdb-output-sink 'emacs)
-      (process-send-string process (car item)))))
-\f
-;;
-;; output -- things gdb prints to emacs
-;;
-;; GDB output is a stream interrupted by annotations.
-;; Annotations can be recognized by their beginning
-;; with \C-j\C-z\C-z<tag><opt>\C-j
-;;
-;; The tag is a string obeying symbol syntax.
-;;
-;; The optional part `<opt>' can be either the empty string
-;; or a space followed by more data relating to the annotation.
-;; For example, the SOURCE annotation is followed by a filename,
-;; line number and various useless goo.  This data must not include
-;; any newlines.
-;;
-
-(defcustom gud-gdb-command-name "gdb --annotate=3"
-  "Default command to execute an executable under the GDB debugger.
-The option \"--annotate=3\" must be included in this value if you
-want the GDB Graphical Interface."
-  :type 'string
-  :group 'gud
-  :version "22.1")
-
-(defvar gdb-annotation-rules
-  '(("pre-prompt" gdb-pre-prompt)
-    ("prompt" gdb-prompt)
-    ("commands" gdb-subprompt)
-    ("overload-choice" gdb-subprompt)
-    ("query" gdb-subprompt)
-    ;; Need this prompt for GDB 6.1
-    ("nquery" gdb-subprompt)
-    ("prompt-for-continue" gdb-subprompt)
-    ("post-prompt" gdb-post-prompt)
-    ("source" gdb-source)
-    ("starting" gdb-starting)
-    ("exited" gdb-exited)
-    ("signalled" gdb-signalled)
-    ("signal" gdb-signal)
-    ("breakpoint" gdb-stopping)
-    ("watchpoint" gdb-stopping)
-    ("frame-begin" gdb-frame-begin)
-    ("stopped" gdb-stopped)
-    ("error-begin" gdb-error)
-    ("error" gdb-error)
-    ("new-thread" (lambda (ignored)
-                   (gdb-get-buffer-create 'gdb-threads-buffer)))
-    ("thread-changed" gdb-thread-changed))
-  "An assoc mapping annotation tags to functions which process them.")
-
-(defun gdb-resync()
-  (setq gdb-flush-pending-output t)
-  (setq gud-running nil)
-  (gdb-force-mode-line-update
-   (propertize "stopped" 'face font-lock-warning-face))
-  (setq gdb-output-sink 'user)
-  (setq gdb-input-queue nil)
-  (setq gdb-pending-triggers nil)
-  (setq gdb-prompting t))
-
-(defconst gdb-source-spec-regexp
-  "\\(.*\\):\\([0-9]*\\):[0-9]*:[a-z]*:0x0*\\([a-f0-9]*\\)")
-
-;; Do not use this except as an annotation handler.
-(defun gdb-source (args)
-  (string-match gdb-source-spec-regexp args)
-  ;; Extract the frame position from the marker.
-  (setq gud-last-frame
-       (cons
-        (match-string 1 args)
-        (string-to-number (match-string 2 args))))
-  (setq gdb-pc-address (match-string 3 args))
-  ;; cover for auto-display output which comes *before*
-  ;; stopped annotation
-  (if (eq gdb-output-sink 'inferior) (setq gdb-output-sink 'user)))
-
-(defun gdb-pre-prompt (ignored)
-  "An annotation handler for `pre-prompt'.
-This terminates the collection of output from a previous command if that
-happens to be in effect."
-  (setq gdb-error nil)
-  (let ((sink gdb-output-sink))
-    (cond
-     ((eq sink 'user) t)
-     ((eq sink 'emacs)
-      (setq gdb-output-sink 'post-emacs))
-     (t
-      (gdb-resync)
-      (error "Phase error in gdb-pre-prompt (got %s)" sink)))))
-
-(defun gdb-prompt (ignored)
-  "An annotation handler for `prompt'.
-This sends the next command (if any) to gdb."
-  (when gdb-first-prompt
-    (gdb-force-mode-line-update
-     (propertize "initializing..." 'face font-lock-variable-name-face))
-    (gdb-init-1)
-    (setq gdb-first-prompt nil))
-  (let ((sink gdb-output-sink))
-    (cond
-     ((eq sink 'user) t)
-     ((eq sink 'post-emacs)
-      (setq gdb-output-sink 'user)
-      (let ((handler
-            (car (cdr gdb-current-item))))
-       (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer)
-         (funcall handler))))
-     (t
-      (gdb-resync)
-      (error "Phase error in gdb-prompt (got %s)" sink))))
-  (let ((input (gdb-dequeue-input)))
-    (if input
-       (gdb-send-item input)
-      (progn
-       (setq gdb-prompting t)
-       (gud-display-frame)
-       (setq gdb-early-user-input (nreverse gdb-early-user-input))
-       (while gdb-early-user-input
-           (gdb-enqueue-input (car gdb-early-user-input))
-           (setq gdb-early-user-input (cdr gdb-early-user-input)))))))
-
-(defun gdb-subprompt (ignored)
-  "An annotation handler for non-top-level prompts."
-  (setq gdb-prompting t))
-
-(defun gdb-starting (ignored)
-  "An annotation handler for `starting'.
-This says that I/O for the subprocess is now the program being debugged,
-not GDB."
-  (setq gdb-active-process t)
-  (setq gdb-printing t)
-  (let ((sink gdb-output-sink))
-    (cond
-     ((eq sink 'user)
-      (progn
-       (setq gud-running t)
-       (setq gdb-stack-update t)
-       ;; Temporarily set gud-running to nil to force "info stack" onto queue.
-       (let ((gud-running nil))
-         (gdb-invalidate-frames)
-         (unless (or gdb-register-names
-                     (string-equal gdb-version "pre-6.4"))
-           (gdb-enqueue-input
-            (list "server interpreter mi -data-list-register-names\n"
-                  'gdb-get-register-names))))
-       (setq gdb-inferior-status "running")
-       (setq gdb-signalled nil)
-       (gdb-force-mode-line-update
-        (propertize gdb-inferior-status 'face font-lock-type-face))
-       (gdb-remove-text-properties)
-       (setq gud-old-arrow gud-overlay-arrow-position)
-       (setq gud-overlay-arrow-position nil)
-       (setq gdb-overlay-arrow-position nil)
-       (setq gdb-stack-position nil)
-       (if gdb-use-separate-io-buffer
-           (setq gdb-output-sink 'inferior))))
-     (t
-      (gdb-resync)
-      (error "Unexpected `starting' annotation")))))
-
-(defun gdb-signal (ignored)
-  (setq gdb-inferior-status "signal")
-  (gdb-force-mode-line-update
-   (propertize gdb-inferior-status 'face font-lock-warning-face))
-  (gdb-stopping ignored))
-
-(defun gdb-stopping (ignored)
-  "An annotation handler for `breakpoint' and other annotations.
-They say that I/O for the subprocess is now GDB, not the program
-being debugged."
-  (if gdb-use-separate-io-buffer
-      (let ((sink gdb-output-sink))
-       (cond
-        ((eq sink 'inferior)
-         (setq gdb-output-sink 'user))
-        (t
-         (gdb-resync)
-         (error "Unexpected stopping annotation"))))))
-
-(defun gdb-exited (ignored)
-  "An annotation handler for `exited' and `signalled'.
-They say that I/O for the subprocess is now GDB, not the program
-being debugged and that the program is no longer running.  This
-function is used to change the focus of GUD tooltips to #define
-directives."
-  (setq gdb-active-process nil)
-  (setq gud-overlay-arrow-position nil)
-  (setq gdb-overlay-arrow-position nil)
-  (setq gdb-stack-position nil)
-  (setq gud-old-arrow nil)
-  (setq gdb-inferior-status "exited")
-  (gdb-force-mode-line-update
-   (propertize gdb-inferior-status 'face font-lock-warning-face))
-  (gdb-stopping ignored))
-
-(defun gdb-signalled (ignored)
-  (setq gdb-signalled t))
-
-(defun gdb-frame-begin (ignored)
-  (setq gdb-frame-begin t)
-  (setq gdb-printing nil)
-  (let ((sink gdb-output-sink))
-    (cond
-     ((eq sink 'inferior)
-      (setq gdb-output-sink 'user))
-     ((eq sink 'user) t)
-     ((eq sink 'emacs) t)
-     (t
-      (gdb-resync)
-      (error "Unexpected frame-begin annotation (%S)" sink)))))
-
-(defcustom gdb-same-frame (not focus-follows-mouse)
-  "Non-nil means pop up GUD buffer in same frame."
-  :group 'gdb
-  :type 'boolean
-  :version "22.1")
-
-(defcustom gdb-find-source-frame nil
-  "Non-nil means try to find a source frame further up stack e.g after signal."
-  :group 'gdb
-  :type 'boolean
-  :version "22.1")
-
-(defun gdb-find-source-frame (arg)
-  "Toggle looking for a source frame further up call stack.
-The code associated with current (innermost) frame may not have
-been compiled with debug information, e.g., C library routine.
-With prefix argument ARG, look for a source frame further up
-stack to display in the source buffer if ARG is positive,
-otherwise don't look further up."
-  (interactive "P")
-  (setq gdb-find-source-frame
-       (if (null arg)
-           (not gdb-find-source-frame)
-         (> (prefix-numeric-value arg) 0)))
-  (message (format "Looking for source frame %sabled"
-                  (if gdb-find-source-frame "en" "dis"))))
-
-(defun gdb-stopped (ignored)
-  "An annotation handler for `stopped'.
-It is just like `gdb-stopping', except that if we already set the output
-sink to `user' in `gdb-stopping', that is fine."
-  (setq gud-running nil)
-  (unless (or gud-overlay-arrow-position gud-last-frame)
-    (if (and gdb-frame-begin gdb-printing)
-       (setq gud-overlay-arrow-position gud-old-arrow)
-    ;;Pop up GUD buffer to display current frame when it doesn't have source
-    ;;information i.e if not compiled with -g as with libc routines generally.
-    (if gdb-same-frame
-       (gdb-display-gdb-buffer)
-      (gdb-frame-gdb-buffer))
-    (if gdb-find-source-frame
-    ;;Try to find source further up stack e.g after signal.
-       (setq gdb-look-up-stack
-             (if (gdb-get-buffer 'gdb-stack-buffer)
-                 'keep
-               (progn
-                 (gdb-get-buffer-create 'gdb-stack-buffer)
-                 (gdb-invalidate-frames)
-                 'delete))))))
-  (unless (member gdb-inferior-status '("exited" "signal"))
-    (setq gdb-active-process t) ;Just for attaching case.
-    (setq gdb-inferior-status "stopped")
-    (gdb-force-mode-line-update
-     (propertize gdb-inferior-status 'face font-lock-warning-face)))
-  (let ((sink gdb-output-sink))
-    (cond
-     ((eq sink 'inferior)
-      (setq gdb-output-sink 'user))
-     ((eq sink 'user) t)
-     (t
-      (gdb-resync)
-      (error "Unexpected stopped annotation"))))
-  (if gdb-signalled (gdb-exited ignored)))
-
-(defun gdb-error (ignored)
-  (setq gdb-error (not gdb-error)))
-
-(defun gdb-thread-changed (ignored)
-  (gdb-frames-force-update))
-
-(defun gdb-post-prompt (ignored)
-  "An annotation handler for `post-prompt'.
-This begins the collection of output from the current command if that
-happens to be appropriate."
-  ;; Don't add to queue if there outstanding items or gdb-version is not known
-  ;; yet.
-  (unless (or gdb-pending-triggers gdb-first-post-prompt)
-    (gdb-get-selected-frame)
-    (gdb-invalidate-frames)
-    ;; Regenerate breakpoints buffer in case it has been inadvertantly deleted.
-    (gdb-get-buffer-create 'gdb-breakpoints-buffer)
-    (gdb-invalidate-breakpoints)
-    ;; Do this through gdb-get-selected-frame -> gdb-frame-handler
-    ;; so gdb-pc-address is updated.
-    ;; (gdb-invalidate-assembler)
-
-    (if (string-equal gdb-version "pre-6.4")
-       (gdb-invalidate-registers)
-      (gdb-get-changed-registers)
-      (gdb-invalidate-registers-1))
-
-    (gdb-invalidate-memory)
-    (if (string-equal gdb-version "pre-6.4")
-       (gdb-invalidate-locals)
-      (gdb-invalidate-locals-1))
-
-    (gdb-invalidate-threads)
-    (unless (or (null gdb-var-list)
-            (eq system-type 'darwin)) ;Breaks on Darwin's GDB-5.3.
-      ;; FIXME: with GDB-6 on Darwin, this might very well work.
-      ;; Only needed/used with speedbar/watch expressions.
-      (when (and (boundp 'speedbar-frame) (frame-live-p speedbar-frame))
-       (if (string-equal gdb-version "pre-6.4")
-           (gdb-var-update)
-         (gdb-var-update-1)))))
-  (setq gdb-first-post-prompt nil)
-  (let ((sink gdb-output-sink))
-    (cond
-     ((eq sink 'user) t)
-     ((eq sink 'pre-emacs)
-      (setq gdb-output-sink 'emacs))
-     (t
-      (gdb-resync)
-      (error "Phase error in gdb-post-prompt (got %s)" sink)))))
-
-(defconst gdb-buffer-list
-'(gdb-stack-buffer gdb-locals-buffer gdb-registers-buffer gdb-threads-buffer))
-
-(defun gdb-remove-text-properties ()
-  (dolist (buffertype gdb-buffer-list)
-    (let ((buffer (gdb-get-buffer buffertype)))
-      (if buffer
-         (with-current-buffer buffer
-           (let ((inhibit-read-only t))
-             (remove-text-properties
-              (point-min) (point-max) '(mouse-face nil help-echo nil))))))))
-
-;; GUD displays the selected GDB frame.  This might might not be the current
-;; GDB frame (after up, down etc).  If no GDB frame is visible but the last
-;; visited breakpoint is, use that window.
-(defun gdb-display-source-buffer (buffer)
-  (let* ((last-window (if gud-last-last-frame
-                        (get-buffer-window
-                         (gud-find-file (car gud-last-last-frame)))))
-        (source-window (or last-window
-                           (if (and gdb-source-window
-                                    (window-live-p gdb-source-window))
-                               gdb-source-window))))
-    (when source-window
-      (setq gdb-source-window source-window)
-      (set-window-buffer source-window buffer))
-    source-window))
-
-;; Derived from gud-gdb-marker-regexp
-(defvar gdb-fullname-regexp
-  (concat "\\(.:?[^" ":" "\n]*\\)" ":" "\\([0-9]*\\)" ":" ".*"))
-
-(defun gud-gdba-marker-filter (string)
-  "A gud marker filter for gdb.  Handle a burst of output from GDB."
-  (if gdb-flush-pending-output
-      nil
-    (when gdb-enable-debug
-       (push (cons 'recv string) gdb-debug-log)
-       (if (and gdb-debug-log-max
-                (> (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.
-    (setq gud-marker-acc (concat gud-marker-acc string))
-    ;; Start accumulating output for the GUD buffer.
-    (let ((output ""))
-      ;;
-      ;; Process all the complete markers in this chunk.
-      (while (string-match "\n\032\032\\(.*\\)\n" gud-marker-acc)
-       (let ((annotation (match-string 1 gud-marker-acc))
-             (before (substring gud-marker-acc 0 (match-beginning 0)))
-             (after (substring gud-marker-acc (match-end 0))))
-         ;;
-         ;; Parse the tag from the annotation, and maybe its arguments.
-         (string-match "\\(\\S-*\\) ?\\(.*\\)" annotation)
-         (let* ((annotation-type (match-string 1 annotation))
-                (annotation-arguments (match-string 2 annotation))
-                (annotation-rule (assoc annotation-type
-                                        gdb-annotation-rules)))
-
-           ;; Stuff prior to the match is just ordinary output.
-           ;; It is either concatenated to OUTPUT or directed
-           ;; elsewhere.
-           (setq output (gdb-concat-output output before))
-
-           ;; Take that stuff off the gud-marker-acc.
-           (setq gud-marker-acc after)
-
-           ;; Call the handler for this annotation.
-           (if annotation-rule
-               (funcall (car (cdr annotation-rule))
-                        annotation-arguments))
-
-           ;; Else the annotation is not recognized.  Ignore it silently,
-           ;; so that GDB can add new annotations without causing
-           ;; us to blow up.
-           )))
-
-      ;; Does the remaining text end in a partial line?
-      ;; If it does, then keep part of the gud-marker-acc until we get more.
-      (if (string-match "\n\\'\\|\n\032\\'\\|\n\032\032.*\\'"
-                       gud-marker-acc)
-         (progn
-           ;; Everything before the potential marker start can be output.
-           (setq output
-                 (gdb-concat-output output
-                                    (substring gud-marker-acc 0
-                                               (match-beginning 0))))
-           ;;
-           ;; Everything after, we save, to combine with later input.
-           (setq gud-marker-acc (substring gud-marker-acc
-                                           (match-beginning 0))))
-       ;;
-       ;; In case we know the gud-marker-acc contains no partial annotations:
-       (progn
-         (setq output (gdb-concat-output output gud-marker-acc))
-         (setq gud-marker-acc "")))
-      output)))
-
-(defun gdb-concat-output (so-far new)
-  (if gdb-error
-      (put-text-property 0 (length new) 'face font-lock-warning-face new))
-  (let ((sink gdb-output-sink))
-    (cond
-     ((eq sink 'user) (concat so-far new))
-     ((or (eq sink 'pre-emacs) (eq sink 'post-emacs)) so-far)
-     ((eq sink 'emacs)
-      (gdb-append-to-partial-output new)
-      so-far)
-     ((eq sink 'inferior)
-      (gdb-append-to-inferior-io new)
-      so-far)
-     (t
-      (gdb-resync)
-      (error "Bogon output sink %S" sink)))))
-
-(defun gdb-append-to-partial-output (string)
-  (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer)
-    (goto-char (point-max))
-    (insert string)))
-
-(defun gdb-clear-partial-output ()
-  (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer)
-    (erase-buffer)))
-
-(defun gdb-append-to-inferior-io (string)
-  (with-current-buffer (gdb-get-buffer-create 'gdb-inferior-io)
-    (goto-char (point-max))
-    (insert-before-markers string))
-  (if (not (string-equal string ""))
-      (gdb-display-buffer (gdb-get-buffer-create 'gdb-inferior-io) t)))
-
-(defun gdb-clear-inferior-io ()
-  (with-current-buffer (gdb-get-buffer-create 'gdb-inferior-io)
-    (erase-buffer)))
-
-(defun gdb-jsonify-buffer (&optional fix-key fix-list)
-  "Prepare GDB/MI output in current buffer for parsing with `json-read'.
-
-Field names are wrapped in double quotes and equal signs are
-replaced with semicolons.
-
-If FIX-KEY is non-nil, strip all \"FIX-KEY=\" occurrences from
-partial output.  This is used to get rid of useless keys in lists
-in MI messages, e.g.: [key=.., key=..].  -stack-list-frames and
--break-info are examples of MI commands which issue such
-responses.
-
-If FIX-LIST is non-nil, \"FIX-LIST={..}\" is replaced with
-\"FIX-LIST=[..]\" prior to parsing.  This is used to fix broken
--break-info output when it contains breakpoint script field
-incompatible with GDB/MI output syntax."
-  (save-excursion
-    (goto-char (point-min))
-    ;; Sometimes missing symbol information precedes "^done" record.
-    (re-search-forward "[[:ascii:]]*?\\^done," nil t)
-    (replace-match "")
-    (re-search-forward "(gdb) \n" nil t)
-    (replace-match "")
-    (goto-char (point-min))
-    (when fix-key
-      (save-excursion
-        (while (re-search-forward (concat "[\\[,]\\(" fix-key "=\\)") nil t)
-          (replace-match "" nil nil nil 1))))
-    (when fix-list
-      (save-excursion
-        ;; Find positions of braces which enclose broken list
-        (while (re-search-forward (concat fix-list "={\"") nil t)
-          (let ((p1 (goto-char (- (point) 2)))
-                (p2 (progn (forward-sexp)
-                           (1- (point)))))
-            ;; Replace braces with brackets
-            (save-excursion
-              (goto-char p1)
-              (delete-char 1)
-              (insert "[")
-              (goto-char p2)
-              (delete-char 1)
-              (insert "]"))))))
-    (goto-char (point-min))
-    (insert "{")
-    (while (re-search-forward
-           "\\([[:alnum:]-_]+\\)=\\({\\|\\[\\|\"\"\\|\".*?[^\\]\"\\)" nil t)
-      (replace-match "\"\\1\":\\2" nil nil))
-    (goto-char (point-max))
-    (insert "}")))
-
-(defun gdb-json-read-buffer (&optional fix-key fix-list)
-  "Prepare and parse GDB/MI output in current buffer with `json-read'.
-
-FIX-KEY and FIX-LIST work as in `gdb-jsonify-buffer'."
-  (gdb-jsonify-buffer fix-key fix-list)
-  (save-excursion
-    (goto-char (point-min))
-    (let ((json-array-type 'list))
-      (json-read))))
-
-(defun gdb-json-partial-output (&optional fix-key fix-list)
-  "Prepare and parse gdb-partial-output-buffer with `json-read'.
-
-FIX-KEY and FIX-KEY work as in `gdb-jsonify-buffer'."
-  (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer)
-    (gdb-json-read-buffer fix-key fix-list)))
-\f
-
-;; One trick is to have a command who's output is always available in a buffer
-;; of it's own, and is always up to date.  We build several buffers of this
-;; type.
-;;
-;; There are two aspects to this: gdb has to tell us when the output for that
-;; command might have changed, and we have to be able to run the command
-;; behind the user's back.
-;;
-;; The output phasing associated with the variable gdb-output-sink
-;; help us to run commands behind the user's back.
-;;
-;; Below is the code for specificly managing buffers of output from one
-;; command.
-;;
-
-;; The trigger function is suitable for use in the assoc GDB-ANNOTATION-RULES
-;; It adds an input for the command we are tracking.  It should be the
-;; annotation rule binding of whatever gdb sends to tell us this command
-;; might have changed it's output.
-;;
-;; NAME is the function name.  DEMAND-PREDICATE tests if output is really needed.
-;; GDB-COMMAND is a string of such.  OUTPUT-HANDLER is the function bound to the
-;; input in the input queue (see comment about ``gdb communications'' above).
-
-(defmacro def-gdb-auto-update-trigger (name demand-predicate gdb-command
-                                           output-handler)
-  `(defun ,name (&optional ignored)
-     (if (and ,demand-predicate
-             (not (member ',name
-                          gdb-pending-triggers)))
-        (progn
-          (gdb-enqueue-input
-           (list ,gdb-command ',output-handler))
-          (push ',name gdb-pending-triggers)))))
-
-(defmacro def-gdb-auto-update-handler (name trigger buf-key custom-defun)
-  `(defun ,name ()
-     (setq gdb-pending-triggers
-      (delq ',trigger
-           gdb-pending-triggers))
-     (let ((buf (gdb-get-buffer ',buf-key)))
-       (and buf
-           (with-current-buffer buf
-             (let* ((window (get-buffer-window buf 0))
-                    (start (window-start window))
-                    (p (if window (window-point window) (point)))
-                   (buffer-read-only nil))
-               (erase-buffer)
-               (insert-buffer-substring (gdb-get-buffer-create
-                                         'gdb-partial-output-buffer))
-               (if window
-                   (progn
-                     (set-window-start window start)
-                     (set-window-point window p))
-                 (goto-char p))))))
-     ;; put customisation here
-     (,custom-defun)))
-
-(defmacro def-gdb-auto-updated-buffer (buffer-key
-                                      trigger-name gdb-command
-                                      output-handler-name custom-defun)
-  `(progn
-     (def-gdb-auto-update-trigger ,trigger-name
-       ;; The demand predicate:
-       (gdb-get-buffer ',buffer-key)
-       ,gdb-command
-       ,output-handler-name)
-     (def-gdb-auto-update-handler ,output-handler-name
-       ,trigger-name ,buffer-key ,custom-defun)))
-
-\f
-;;
-;; Breakpoint buffer : This displays the output of `info breakpoints'.
-;;
-(gdb-set-buffer-rules 'gdb-breakpoints-buffer
-                     'gdb-breakpoints-buffer-name
-                     'gdb-breakpoints-mode)
-
-(def-gdb-auto-updated-buffer gdb-breakpoints-buffer
-  ;; This defines the auto update rule for buffers of type
-  ;; `gdb-breakpoints-buffer'.
-  ;;
-  ;; It defines a function to serve as the annotation handler that
-  ;; handles the `foo-invalidated' message.  That function is called:
-  gdb-invalidate-breakpoints
-  ;;
-  ;; To update the buffer, this command is sent to gdb.
-  "server info breakpoints\n"
-  ;;
-  ;; This also defines a function to be the handler for the output
-  ;; from the command above.  That function will copy the output into
-  ;; the appropriately typed buffer.  That function will be called:
-  gdb-info-breakpoints-handler
-  ;; buffer specific functions
-  gdb-info-breakpoints-custom)
-
-(defconst breakpoint-xpm-data
-  "/* XPM */
-static char *magick[] = {
-/* columns rows colors chars-per-pixel */
-\"10 10 2 1\",
-\"  c red\",
-\"+ c None\",
-/* pixels */
-\"+++    +++\",
-\"++      ++\",
-\"+        +\",
-\"          \",
-\"          \",
-\"          \",
-\"          \",
-\"+        +\",
-\"++      ++\",
-\"+++    +++\",
-};"
-  "XPM data used for breakpoint icon.")
-
-(defconst breakpoint-enabled-pbm-data
-  "P1
-10 10\",
-0 0 0 0 1 1 1 1 0 0 0 0
-0 0 0 1 1 1 1 1 1 0 0 0
-0 0 1 1 1 1 1 1 1 1 0 0
-0 1 1 1 1 1 1 1 1 1 1 0
-0 1 1 1 1 1 1 1 1 1 1 0
-0 1 1 1 1 1 1 1 1 1 1 0
-0 1 1 1 1 1 1 1 1 1 1 0
-0 0 1 1 1 1 1 1 1 1 0 0
-0 0 0 1 1 1 1 1 1 0 0 0
-0 0 0 0 1 1 1 1 0 0 0 0"
-  "PBM data used for enabled breakpoint icon.")
-
-(defconst breakpoint-disabled-pbm-data
-  "P1
-10 10\",
-0 0 1 0 1 0 1 0 0 0
-0 1 0 1 0 1 0 1 0 0
-1 0 1 0 1 0 1 0 1 0
-0 1 0 1 0 1 0 1 0 1
-1 0 1 0 1 0 1 0 1 0
-0 1 0 1 0 1 0 1 0 1
-1 0 1 0 1 0 1 0 1 0
-0 1 0 1 0 1 0 1 0 1
-0 0 1 0 1 0 1 0 1 0
-0 0 0 1 0 1 0 1 0 0"
-  "PBM data used for disabled breakpoint icon.")
-
-(defvar breakpoint-enabled-icon nil
-  "Icon for enabled breakpoint in display margin.")
-
-(defvar breakpoint-disabled-icon nil
-  "Icon for disabled breakpoint in display margin.")
-
-(declare-function define-fringe-bitmap "fringe.c"
-                 (bitmap bits &optional height width align))
-
-(and (display-images-p)
-     ;; Bitmap for breakpoint in fringe
-     (define-fringe-bitmap 'breakpoint
-       "\x3c\x7e\xff\xff\xff\xff\x7e\x3c")
-     ;; Bitmap for gud-overlay-arrow in fringe
-     (define-fringe-bitmap 'hollow-right-triangle
-       "\xe0\x90\x88\x84\x84\x88\x90\xe0"))
-
-(defface breakpoint-enabled
-  '((t
-     :foreground "red1"
-     :weight bold))
-  "Face for enabled breakpoint icon in fringe."
-  :group 'gdb)
-
-(defface breakpoint-disabled
-  '((((class color) (min-colors 88)) :foreground "grey70")
-    ;; Ensure that on low-color displays that we end up something visible.
-    (((class color) (min-colors 8) (background light))
-     :foreground "black")
-    (((class color) (min-colors 8) (background dark))
-     :foreground "white")
-    (((type tty) (class mono))
-     :inverse-video t)
-    (t :background "gray"))
-  "Face for disabled breakpoint icon in fringe."
-  :group 'gdb)
-
-(defconst gdb-breakpoint-regexp
-  "\\(?:\\([0-9]+\\).*?\\(?:point\\|catch\\s-+\\S-+\\)\\s-+\\S-+\\|\\([0-9]+\\.[0-9]+\\)\\)\\s-+\\(.\\)\\s-+")
-
-;; Put breakpoint icons in relevant margins (even those set in the GUD buffer).
-(defun gdb-info-breakpoints-custom ()
-  (let ((flag) (bptno))
-    ;; Remove all breakpoint-icons in source buffers but not assembler buffer.
-    (dolist (buffer (buffer-list))
-      (with-current-buffer buffer
-       (if (and (memq gud-minor-mode '(gdba gdbmi))
-                (not (string-match "\\` ?\\*.+\\*\\'" (buffer-name))))
-           (gdb-remove-breakpoint-icons (point-min) (point-max)))))
-    (with-current-buffer (gdb-get-buffer 'gdb-breakpoints-buffer)
-      (save-excursion
-       (let ((buffer-read-only nil))
-         (goto-char (point-min))
-         (while (< (point) (- (point-max) 1))
-           (forward-line 1)
-           (if (looking-at gdb-breakpoint-regexp)
-               (progn
-                 (setq bptno (or (match-string 1) (match-string 2)))
-                 (setq flag (char-after (match-beginning 3)))
-                 (if (match-string 1)
-                     (setq gdb-parent-bptno-enabled (eq flag ?y)))
-                 (add-text-properties
-                  (match-beginning 3) (match-end 3)
-                  (if (eq flag ?y)
-                      '(face font-lock-warning-face)
-                    '(face font-lock-type-face)))
-                 (let ((bl (point))
-                       (el (line-end-position)))
-                   (when (re-search-forward " in \\(.*\\) at" el t)
-                     (add-text-properties
-                      (match-beginning 1) (match-end 1)
-                      '(face font-lock-function-name-face)))
-                   (if (re-search-forward
-                        ".*\\s-+\\(\\S-+\\):\\([0-9]+\\)$" el t)
-                       (let ((line (match-string 2))
-                             (file (match-string 1)))
-                         (add-text-properties bl el
-                              '(mouse-face highlight
-                                help-echo "mouse-2, RET: visit breakpoint"))
-                         (unless (file-exists-p file)
-                           (setq file (cdr (assoc bptno gdb-location-alist))))
-                         (if (and file
-                                  (not (string-equal file "File not found")))
-                             (with-current-buffer
-                                 (find-file-noselect file 'nowarn)
-                               (gdb-init-buffer)
-                               ;; Only want one breakpoint icon at each
-                               ;; location.
-                               (save-excursion
-                                 (goto-char (point-min))
-                                 (forward-line (1- (string-to-number line)))
-                                 (gdb-put-breakpoint-icon (eq flag ?y) bptno)))
-                           (gdb-enqueue-input
-                            (list
-                             (concat gdb-server-prefix "list "
-                                     (match-string-no-properties 1) ":1\n")
-                             'ignore))
-                           (gdb-enqueue-input
-                            (list (concat gdb-server-prefix "info source\n")
-                                  `(lambda () (gdb-get-location
-                                               ,bptno ,line ,flag))))))
-                     (if (re-search-forward
-                          "<\\(\\(\\sw\\|[_.]\\)+\\)\\(\\+[0-9]+\\)?>"
-                          el t)
-                         (add-text-properties
-                          (match-beginning 1) (match-end 1)
-                          '(face font-lock-function-name-face))
-                       (end-of-line)
-                       (re-search-backward "\\s-\\(\\S-*\\)"
-                                           bl t)
-                       (add-text-properties
-                        (match-beginning 1) (match-end 1)
-                        '(face font-lock-variable-name-face)))))))
-           (end-of-line))))))
-  (if (gdb-get-buffer 'gdb-assembler-buffer) (gdb-assembler-custom))
-
-  ;; Breakpoints buffer is always present.  Hack to just update
-  ;; current frame if there's been no execution.
-  (if gdb-stack-update
-      (setq gdb-stack-update nil)
-    (if (gdb-get-buffer 'gdb-stack-buffer) (gdb-info-stack-custom))))
-
-(declare-function gud-remove "gdb-ui" t t) ; gud-def
-(declare-function gud-break  "gdb-ui" t t) ; gud-def
-(declare-function fringe-bitmaps-at-pos "fringe.c" (&optional pos window))
-
-(defun gdb-mouse-set-clear-breakpoint (event)
-  "Set/clear breakpoint in left fringe/margin at mouse click.
-If not in a source or disassembly buffer just set point."
-  (interactive "e")
-  (mouse-minibuffer-check event)
-  (let ((posn (event-end event)))
-    (with-selected-window (posn-window posn)
-      (if (or (buffer-file-name) (eq major-mode 'gdb-assembler-mode))
-         (if (numberp (posn-point posn))
-             (save-excursion
-               (goto-char (posn-point posn))
-               (if (or (posn-object posn)
-                       (eq (car (fringe-bitmaps-at-pos (posn-point posn)))
-                           'breakpoint))
-                   (gud-remove nil)
-                 (gud-break nil)))))
-      (posn-set-point posn))))
-
-(defun gdb-mouse-toggle-breakpoint-margin (event)
-  "Enable/disable breakpoint in left margin with mouse click."
-  (interactive "e")
-  (mouse-minibuffer-check event)
-  (let ((posn (event-end event)))
-    (if (numberp (posn-point posn))
-       (with-selected-window (posn-window posn)
-         (save-excursion
-           (goto-char (posn-point posn))
-           (if (posn-object posn)
-               (let* ((bptno (get-text-property
-                              0 'gdb-bptno (car (posn-string posn)))))
-                 (string-match "\\([0-9+]\\)*" bptno)
-                 (gdb-enqueue-input
-                  (list
-                   (concat gdb-server-prefix
-                           (if (get-text-property
-                                0 'gdb-enabled (car (posn-string posn)))
-                               "disable "
-                             "enable ")
-                           (match-string 1 bptno) "\n")
-                  'ignore)))))))))
-
-(defun gdb-mouse-toggle-breakpoint-fringe (event)
-  "Enable/disable breakpoint in left fringe with mouse click."
-  (interactive "e")
-  (mouse-minibuffer-check event)
-  (let* ((posn (event-end event))
-        (pos (posn-point posn))
-        obj)
-    (when (numberp pos)
-      (with-selected-window (posn-window posn)
-       (with-current-buffer (window-buffer (selected-window))
-         (goto-char pos)
-         (dolist (overlay (overlays-in pos pos))
-           (when (overlay-get overlay 'put-break)
-             (setq obj (overlay-get overlay 'before-string))))
-         (when (stringp obj)
-           (let* ((bptno (get-text-property 0 'gdb-bptno obj)))
-             (string-match "\\([0-9+]\\)*" bptno)
-             (gdb-enqueue-input
-              (list
-               (concat gdb-server-prefix
-                       (if (get-text-property 0 'gdb-enabled obj)
-                           "disable "
-                         "enable ")
-                       (match-string 1 bptno) "\n")
-               'ignore)))))))))
-
-(defun gdb-breakpoints-buffer-name ()
-  (with-current-buffer gud-comint-buffer
-    (concat "*breakpoints of " (gdb-get-target-string) "*")))
-
-(defun gdb-display-breakpoints-buffer ()
-  "Display status of user-settable breakpoints."
-  (interactive)
-  (gdb-display-buffer
-   (gdb-get-buffer-create 'gdb-breakpoints-buffer) t))
-
-(defun gdb-frame-breakpoints-buffer ()
-  "Display status of user-settable breakpoints in a new frame."
-  (interactive)
-  (let ((special-display-regexps (append special-display-regexps '(".*")))
-       (special-display-frame-alist gdb-frame-parameters))
-    (display-buffer (gdb-get-buffer-create 'gdb-breakpoints-buffer))))
-
-(defvar gdb-breakpoints-mode-map
-  (let ((map (make-sparse-keymap))
-       (menu (make-sparse-keymap "Breakpoints")))
-    (define-key menu [quit] '("Quit"   . gdb-delete-frame-or-window))
-    (define-key menu [goto] '("Goto"   . gdb-goto-breakpoint))
-    (define-key menu [delete] '("Delete" . gdb-delete-breakpoint))
-    (define-key menu [toggle] '("Toggle" . gdb-toggle-breakpoint))
-    (suppress-keymap map)
-    (define-key map [menu-bar breakpoints] (cons "Breakpoints" menu))
-    (define-key map " " 'gdb-toggle-breakpoint)
-    (define-key map "D" 'gdb-delete-breakpoint)
-    ;; Don't bind "q" to kill-this-buffer as we need it for breakpoint icons.
-    (define-key map "q" 'gdb-delete-frame-or-window)
-    (define-key map "\r" 'gdb-goto-breakpoint)
-    (define-key map [mouse-2] 'gdb-goto-breakpoint)
-    (define-key map [follow-link] 'mouse-face)
-    map))
-
-(defun gdb-delete-frame-or-window ()
-  "Delete frame if there is only one window.  Otherwise delete the window."
-  (interactive)
-  (if (one-window-p) (delete-frame)
-    (delete-window)))
-
-;;from make-mode-line-mouse-map
-(defun gdb-make-header-line-mouse-map (mouse function) "\
-Return a keymap with single entry for mouse key MOUSE on the header line.
-MOUSE is defined to run function FUNCTION with no args in the buffer
-corresponding to the mode line clicked."
-  (let ((map (make-sparse-keymap)))
-    (define-key map (vector 'header-line mouse) function)
-    (define-key map (vector 'header-line 'down-mouse-1) 'ignore)
-    map))
-
-(defmacro gdb-propertize-header (name buffer help-echo mouse-face face)
-  `(propertize ,name
-              'help-echo ,help-echo
-              'mouse-face ',mouse-face
-              'face ',face
-              'local-map
-              (gdb-make-header-line-mouse-map
-               'mouse-1
-               (lambda (event) (interactive "e")
-                 (save-selected-window
-                   (select-window (posn-window (event-start event)))
-                   (set-window-dedicated-p (selected-window) nil)
-                   (switch-to-buffer
-                    (gdb-get-buffer-create ',buffer))
-                   (setq header-line-format(gdb-set-header ',buffer))
-                   (set-window-dedicated-p (selected-window) t))))))
-
-(defun gdb-set-header (buffer)
-  (cond ((eq buffer 'gdb-locals-buffer)
-        (list
-         (gdb-propertize-header "Locals" gdb-locals-buffer
-                                nil nil mode-line)
-         " "
-         (gdb-propertize-header "Registers" gdb-registers-buffer
-                                "mouse-1: select" mode-line-highlight mode-line-inactive)))
-       ((eq buffer 'gdb-registers-buffer)
-        (list
-         (gdb-propertize-header "Locals" gdb-locals-buffer
-                                "mouse-1: select" mode-line-highlight mode-line-inactive)
-         " "
-         (gdb-propertize-header "Registers" gdb-registers-buffer
-                                nil nil mode-line)))
-       ((eq buffer 'gdb-breakpoints-buffer)
-        (list
-         (gdb-propertize-header "Breakpoints" gdb-breakpoints-buffer
-                                nil nil mode-line)
-         " "
-         (gdb-propertize-header "Threads" gdb-threads-buffer
-                                "mouse-1: select" mode-line-highlight mode-line-inactive)))
-       ((eq buffer 'gdb-threads-buffer)
-        (list
-         (gdb-propertize-header "Breakpoints" gdb-breakpoints-buffer
-                                "mouse-1: select" mode-line-highlight mode-line-inactive)
-         " "
-         (gdb-propertize-header "Threads" gdb-threads-buffer
-                                nil nil mode-line)))))
-
-(defvar gdb-breakpoints-header
-  (list
-   (gdb-propertize-header "Breakpoints" gdb-breakpoints-buffer
-                         nil nil mode-line)
-   " "
-   (gdb-propertize-header "Threads" gdb-threads-buffer
-                         "mouse-1: select" mode-line-highlight mode-line-inactive)))
-
-(defun gdb-breakpoints-mode ()
-  "Major mode for gdb breakpoints.
-
-\\{gdb-breakpoints-mode-map}"
-  (kill-all-local-variables)
-  (setq major-mode 'gdb-breakpoints-mode)
-  (setq mode-name "Breakpoints")
-  (use-local-map gdb-breakpoints-mode-map)
-  (setq buffer-read-only t)
-  (buffer-disable-undo)
-  (setq header-line-format gdb-breakpoints-header)
-  (run-mode-hooks 'gdb-breakpoints-mode-hook)
-  (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba)
-      'gdb-invalidate-breakpoints
-    'gdbmi-invalidate-breakpoints))
-
-(defun gdb-toggle-breakpoint ()
-  "Enable/disable breakpoint at current line."
-  (interactive)
-  (save-excursion
-    (beginning-of-line 1)
-    (if (looking-at gdb-breakpoint-regexp)
-       (gdb-enqueue-input
-        (list
-         (concat gdb-server-prefix
-                 (if (eq ?y (char-after (match-beginning 3)))
-                     "disable "
-                   "enable ")
-                 (or (match-string 1) (match-string 2)) "\n") 'ignore))
-      (error "Not recognized as break/watchpoint line"))))
-
-(defun gdb-delete-breakpoint ()
-  "Delete the breakpoint at current line."
-  (interactive)
-  (save-excursion
-    (beginning-of-line 1)
-    (if (looking-at gdb-breakpoint-regexp)
-       (if (match-string 1)
-           (gdb-enqueue-input
-            (list
-             (concat gdb-server-prefix "delete " (match-string 1) "\n")
-             'ignore))
-         (message-box "This breakpoint cannot be deleted on its own."))
-      (error "Not recognized as break/watchpoint line"))))
-
-(defun gdb-goto-breakpoint (&optional event)
-  "Display the breakpoint location specified at current line."
-  (interactive (list last-input-event))
-  (if event (posn-set-point (event-end event)))
-  (save-excursion
-    (beginning-of-line 1)
-    (if (looking-at "\\([0-9]+\\.?[0-9]*\\) .*\\s-+\\(\\S-+\\):\\([0-9]+\\)$")
-       (let ((bptno (match-string 1))
-             (file  (match-string 2))
-             (line  (match-string 3)))
-         (save-selected-window
-           (let* ((buffer (find-file-noselect
-                        (if (file-exists-p file) file
-                          (cdr (assoc bptno gdb-location-alist)))))
-                  (window (or (gdb-display-source-buffer buffer)
-                              (display-buffer buffer))))
-             (setq gdb-source-window window)
-             (with-current-buffer buffer
-               (goto-char (point-min))
-               (forward-line (1- (string-to-number line)))
-               (set-window-point window (point))))))
-      (error "No location specified"))))
-\f
-
-;; Frames buffer.  This displays a perpetually correct backtrace
-;; (from the command `where').
-;;
-;; Alas, if your stack is deep, it is costly.
-;;
-(defcustom gdb-max-frames 40
-  "Maximum number of frames displayed in call stack."
-  :type 'integer
-  :group 'gdb
-  :version "22.1")
-
-(gdb-set-buffer-rules 'gdb-stack-buffer
-                     'gdb-stack-buffer-name
-                     'gdb-frames-mode)
-
-(def-gdb-auto-updated-buffer gdb-stack-buffer
-  gdb-invalidate-frames
-  (concat "server info stack " (number-to-string gdb-max-frames) "\n")
-  gdb-info-stack-handler
-  gdb-info-stack-custom)
-
-;; This may be more important for embedded targets where unwinding the
-;; stack may take a long time.
-(defadvice gdb-invalidate-frames (around gdb-invalidate-frames-advice
-                                        (&optional ignored) activate compile)
-  "Only queue \"info stack\" if execution has occurred."
-  (if gdb-stack-update ad-do-it))
-
-(defun gdb-info-stack-custom ()
-  (with-current-buffer (gdb-get-buffer 'gdb-stack-buffer)
-    (let (move-to)
-      (save-excursion
-       (unless (eq gdb-look-up-stack 'delete)
-         (let ((buffer-read-only nil)
-               bl el)
-           (goto-char (point-min))
-           (while (< (point) (point-max))
-             (setq bl (line-beginning-position)
-                   el (line-end-position))
-             (when (looking-at "#")
-               (add-text-properties bl el
-                   '(mouse-face highlight
-                                help-echo "mouse-2, RET: Select frame")))
-             (goto-char bl)
-             (when (looking-at "^#\\([0-9]+\\)")
-               (when (string-equal (match-string 1) gdb-frame-number)
-                 (if (gud-tool-bar-item-visible-no-fringe)
-                     (progn
-                       (put-text-property bl (+ bl 4)
-                                          'face '(:inverse-video t))
-                       (setq move-to bl))
-                   (or gdb-stack-position
-                       (setq gdb-stack-position (make-marker)))
-                   (set-marker gdb-stack-position (point))
-                   (setq move-to gdb-stack-position)))
-               (when (re-search-forward "\\([^ ]+\\) (" el t)
-                 (put-text-property (match-beginning 1) (match-end 1)
-                                    'face font-lock-function-name-face)
-                 (setq bl (match-end 0))
-                 (while (re-search-forward "<\\([^>]+\\)>" el t)
-                   (put-text-property (match-beginning 1) (match-end 1)
-                                      'face font-lock-function-name-face))
-                 (goto-char bl)
-                 (while (re-search-forward "\\(\\(\\sw\\|[_.]\\)+\\)=" el t)
-                   (put-text-property (match-beginning 1) (match-end 1)
-                                      'face font-lock-variable-name-face))))
-             (forward-line 1))
-           (forward-line -1)
-           (when (looking-at "(More stack frames follow...)")
-             (add-text-properties
-              (match-beginning 0) (match-end 0)
-              '(mouse-face highlight
-                gdb-max-frames t
-                help-echo
-                  "mouse-2, RET: customize gdb-max-frames to see more frames"
-                )))))
-       (when gdb-look-up-stack
-         (goto-char (point-min))
-         (when (re-search-forward "\\(\\S-+?\\):\\([0-9]+\\)" nil t)
-           (let ((start (line-beginning-position))
-                 (file (match-string 1))
-                 (line (match-string 2)))
-             (re-search-backward "^#*\\([0-9]+\\)" start t)
-             (gdb-enqueue-input
-              (list (concat gdb-server-prefix "frame "
-                            (match-string 1) "\n") 'gdb-set-hollow))
-             (gdb-enqueue-input
-              (list (concat gdb-server-prefix "frame 0\n") 'ignore))))))
-      (when move-to
-       (let ((window (get-buffer-window (current-buffer) 0)))
-         (when window
-           (with-selected-window window
-             (goto-char move-to)
-             (unless (pos-visible-in-window-p)
-               (recenter '(center)))))))))
-  (if (eq gdb-look-up-stack 'delete)
-      (kill-buffer (gdb-get-buffer 'gdb-stack-buffer)))
-  (setq gdb-look-up-stack nil))
-
-(defun gdb-set-hollow ()
-  (if gud-last-last-frame
-      (with-current-buffer (gud-find-file (car gud-last-last-frame))
-       (setq fringe-indicator-alist
-             '((overlay-arrow . hollow-right-triangle))))))
-
-(defun gdb-stack-buffer-name ()
-  (with-current-buffer gud-comint-buffer
-    (concat "*stack frames of " (gdb-get-target-string) "*")))
-
-(defun gdb-display-stack-buffer ()
-  "Display backtrace of current stack."
-  (interactive)
-  (gdb-display-buffer
-   (gdb-get-buffer-create 'gdb-stack-buffer) t))
-
-(defun gdb-frame-stack-buffer ()
-  "Display backtrace of current stack in a new frame."
-  (interactive)
-  (let ((special-display-regexps (append special-display-regexps '(".*")))
-       (special-display-frame-alist gdb-frame-parameters))
-    (display-buffer (gdb-get-buffer-create 'gdb-stack-buffer))))
-
-(defvar gdb-frames-mode-map
-  (let ((map (make-sparse-keymap)))
-    (suppress-keymap map)
-    (define-key map "q" 'kill-this-buffer)
-    (define-key map "\r" 'gdb-frames-select)
-    (define-key map "F" 'gdb-frames-force-update)
-    (define-key map [mouse-2] 'gdb-frames-select)
-    (define-key map [follow-link] 'mouse-face)
-    map))
-
-(declare-function gdbmi-invalidate-frames "ext:gdb-mi" nil t)
-
-(defun gdb-frames-force-update ()
-  "Force update of call stack.
-Use when the displayed call stack gets out of sync with the
-actual one, e.g after using the Gdb command \"return\" or setting
-$pc directly from the GUD buffer.  This command isn't normally needed."
-  (interactive)
-  (setq gdb-stack-update t)
-  (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba)
-      (gdb-invalidate-frames)
-    (gdbmi-invalidate-frames)))
-
-(defun gdb-frames-mode ()
-  "Major mode for gdb call stack.
-
-\\{gdb-frames-mode-map}"
-  (kill-all-local-variables)
-  (setq major-mode 'gdb-frames-mode)
-  (setq mode-name "Frames")
-  (setq gdb-stack-position nil)
-  (add-to-list 'overlay-arrow-variable-list 'gdb-stack-position)
-  (setq truncate-lines t)  ;; Make it easier to see overlay arrow.
-  (setq buffer-read-only t)
-  (buffer-disable-undo)
-  (gdb-thread-identification)
-  (use-local-map gdb-frames-mode-map)
-  (run-mode-hooks 'gdb-frames-mode-hook)
-  (setq gdb-stack-update t)
-  (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba)
-      'gdb-invalidate-frames
-    'gdbmi-invalidate-frames))
-
-(defun gdb-get-frame-number ()
-  (save-excursion
-    (end-of-line)
-    (let* ((start (line-beginning-position))
-          (pos (re-search-backward "^#*\\([0-9]+\\)" start t))
-          (n (or (and pos (match-string 1)) "0")))
-      n)))
-
-(defun gdb-frames-select (&optional event)
-  "Select the frame and display the relevant source."
-  (interactive (list last-input-event))
-  (if event (posn-set-point (event-end event)))
-  (if (get-text-property (point) 'gdb-max-frames)
-      (progn
-       (message-box "After setting gdb-max-frames, you need to enter\n\
-another GDB command e.g pwd, to see new frames")
-      (customize-variable-other-window 'gdb-max-frames))
-    (gdb-enqueue-input
-     (list (concat gdb-server-prefix "frame "
-                  (gdb-get-frame-number) "\n") 'ignore))))
-\f
-
-;; Threads buffer.  This displays a selectable thread list.
-;;
-(gdb-set-buffer-rules 'gdb-threads-buffer
-                     'gdb-threads-buffer-name
-                     'gdb-threads-mode)
-
-(def-gdb-auto-updated-buffer gdb-threads-buffer
-  gdb-invalidate-threads
-  (concat gdb-server-prefix "info threads\n")
-  gdb-info-threads-handler
-  gdb-info-threads-custom)
-
-(defun gdb-info-threads-custom ()
-  (with-current-buffer (gdb-get-buffer 'gdb-threads-buffer)
-    (let ((buffer-read-only nil))
-      (save-excursion
-       (goto-char (point-min))
-       (if (re-search-forward "\\* \\([0-9]+\\)" nil t)
-           (setq gdb-thread-indicator
-                 (propertize (concat " [" (match-string 1) "]")
-                             ; FIXME: this help-echo doesn't work
-                             'help-echo "thread id")))
-       (goto-char (point-min))
-       (while (< (point) (point-max))
-         (unless (looking-at "No ")
-           (add-text-properties (line-beginning-position) (line-end-position)
-                                '(mouse-face highlight
-                                help-echo "mouse-2, RET: select thread")))
-         (forward-line 1))))))
-
-(defun gdb-threads-buffer-name ()
-  (with-current-buffer gud-comint-buffer
-    (concat "*threads of " (gdb-get-target-string) "*")))
-
-(defun gdb-display-threads-buffer ()
-  "Display IDs of currently known threads."
-  (interactive)
-  (gdb-display-buffer
-   (gdb-get-buffer-create 'gdb-threads-buffer) t))
-
-(defun gdb-frame-threads-buffer ()
-  "Display IDs of currently known threads in a new frame."
-  (interactive)
-  (let ((special-display-regexps (append special-display-regexps '(".*")))
-       (special-display-frame-alist gdb-frame-parameters))
-    (display-buffer (gdb-get-buffer-create 'gdb-threads-buffer))))
-
-(defvar gdb-threads-mode-map
-  (let ((map (make-sparse-keymap)))
-    (suppress-keymap map)
-    (define-key map "q" 'kill-this-buffer)
-    (define-key map "\r" 'gdb-threads-select)
-    (define-key map [mouse-2] 'gdb-threads-select)
-    (define-key map [follow-link] 'mouse-face)
-    map))
-
-(defvar gdb-threads-font-lock-keywords
-  '((") +\\([^ ]+\\) ("  (1 font-lock-function-name-face))
-    ("in \\([^ ]+\\) ("  (1 font-lock-function-name-face))
-    ("\\(\\(\\sw\\|[_.]\\)+\\)="  (1 font-lock-variable-name-face)))
-  "Font lock keywords used in `gdb-threads-mode'.")
-
-(defun gdb-threads-mode ()
-  "Major mode for gdb threads.
-
-\\{gdb-threads-mode-map}"
-  (kill-all-local-variables)
-  (setq major-mode 'gdb-threads-mode)
-  (setq mode-name "Threads")
-  (setq buffer-read-only t)
-  (buffer-disable-undo)
-  (setq header-line-format gdb-breakpoints-header)
-  (use-local-map gdb-threads-mode-map)
-  (set (make-local-variable 'font-lock-defaults)
-       '(gdb-threads-font-lock-keywords))
-  (run-mode-hooks 'gdb-threads-mode-hook)
-  ;; Force "info threads" onto queue.
-  (lambda () (let ((gud-running nil)) (gdb-invalidate-threads))))
-
-(defun gdb-get-thread-number ()
-  (save-excursion
-    (re-search-backward "^\\s-*\\([0-9]*\\)" nil t)
-    (match-string-no-properties 1)))
-
-(defun gdb-threads-select (&optional event)
-  "Select the thread and display the relevant source."
-  (interactive (list last-input-event))
-  (if event (posn-set-point (event-end event)))
-  (setq gdb-stack-update t)
-  (gdb-enqueue-input
-   (list (concat gdb-server-prefix "thread "
-                (gdb-get-thread-number) "\n") 'ignore))
-  (gud-display-frame))
-
-(defun gdb-thread-identification ()
-  (setq mode-line-buffer-identification
-       (list (car mode-line-buffer-identification)
-             '(gdb-thread-indicator gdb-thread-indicator))))
-\f
-;; Registers buffer.
-;;
-(defcustom gdb-all-registers nil
-  "Non-nil means include floating-point registers."
-  :type 'boolean
-  :group 'gdb
-  :version "22.1")
-
-(gdb-set-buffer-rules 'gdb-registers-buffer
-                     'gdb-registers-buffer-name
-                     'gdb-registers-mode)
-
-(def-gdb-auto-updated-buffer gdb-registers-buffer
-  gdb-invalidate-registers
-  (concat
-   gdb-server-prefix "info " (if gdb-all-registers "all-") "registers\n")
-  gdb-info-registers-handler
-  gdb-info-registers-custom)
-
-(defun gdb-info-registers-custom ()
-  (with-current-buffer (gdb-get-buffer 'gdb-registers-buffer)
-    (save-excursion
-      (let ((buffer-read-only nil)
-           start end)
-       (goto-char (point-min))
-       (while (< (point) (point-max))
-         (setq start (line-beginning-position))
-         (setq end (line-end-position))
-         (when (looking-at "^[^ ]+")
-           (unless (string-equal (match-string 0) "The")
-             (put-text-property start (match-end 0)
-                                'face font-lock-variable-name-face)
-             (add-text-properties start end
-                                  '(help-echo "mouse-2: edit value"
-                                    mouse-face highlight))))
-         (forward-line 1))))))
-
-(defun gdb-edit-register-value (&optional event)
-  (interactive (list last-input-event))
-  (save-excursion
-    (if event (posn-set-point (event-end event)))
-    (beginning-of-line)
-    (let* ((register (current-word))
-         (value (read-string (format "New value (%s): " register))))
-      (gdb-enqueue-input
-       (list (concat gdb-server-prefix "set $" register "=" value "\n")
-            'ignore)))))
-
-(defvar gdb-registers-mode-map
-  (let ((map (make-sparse-keymap)))
-    (suppress-keymap map)
-    (define-key map "\r" 'gdb-edit-register-value)
-    (define-key map [mouse-2] 'gdb-edit-register-value)
-    (define-key map " " 'gdb-all-registers)
-    (define-key map "q" 'kill-this-buffer)
-     map))
-
-(defvar gdb-locals-header
-  (list
-   (gdb-propertize-header "Locals" gdb-locals-buffer
-                         nil nil mode-line)
-   " "
-   (gdb-propertize-header "Registers" gdb-registers-buffer
-                         "mouse-1: select" mode-line-highlight mode-line-inactive)))
-
-
-(defun gdb-registers-mode ()
-  "Major mode for gdb registers.
-
-\\{gdb-registers-mode-map}"
-  (kill-all-local-variables)
-  (setq major-mode 'gdb-registers-mode)
-  (setq mode-name "Registers")
-  (setq header-line-format gdb-locals-header)
-  (setq buffer-read-only t)
-  (buffer-disable-undo)
-  (gdb-thread-identification)
-  (use-local-map gdb-registers-mode-map)
-  (run-mode-hooks 'gdb-registers-mode-hook)
-  (if (string-equal gdb-version "pre-6.4")
-      (progn
-       (if gdb-all-registers (setq mode-name "Registers:All"))
-       'gdb-invalidate-registers)
-    'gdb-invalidate-registers-1))
-
-(defun gdb-registers-buffer-name ()
-  (with-current-buffer gud-comint-buffer
-    (concat "*registers of " (gdb-get-target-string) "*")))
-
-(defun gdb-display-registers-buffer ()
-  "Display integer register contents."
-  (interactive)
-  (gdb-display-buffer
-   (gdb-get-buffer-create 'gdb-registers-buffer) t))
-
-(defun gdb-frame-registers-buffer ()
-  "Display integer register contents in a new frame."
-  (interactive)
-  (let ((special-display-regexps (append special-display-regexps '(".*")))
-       (special-display-frame-alist gdb-frame-parameters))
-    (display-buffer (gdb-get-buffer-create 'gdb-registers-buffer))))
-
-(defun gdb-all-registers ()
-  "Toggle the display of floating-point registers (pre GDB 6.4 only)."
-  (interactive)
-  (when (string-equal gdb-version "pre-6.4")
-    (if gdb-all-registers
-       (progn
-         (setq gdb-all-registers nil)
-         (with-current-buffer (gdb-get-buffer-create 'gdb-registers-buffer)
-           (setq mode-name "Registers")))
-      (setq gdb-all-registers t)
-      (with-current-buffer (gdb-get-buffer-create 'gdb-registers-buffer)
-       (setq mode-name "Registers:All")))
-    (message (format "Display of floating-point registers %sabled"
-                    (if gdb-all-registers "en" "dis")))
-    (gdb-invalidate-registers)))
-\f
-
-;; Memory buffer.
-;;
-(defcustom gdb-memory-repeat-count 32
-  "Number of data items in memory window."
-  :type 'integer
-  :group 'gdb
-  :version "22.1")
-
-(defcustom gdb-memory-format "x"
-  "Display format of data items in memory window."
-  :type '(choice (const :tag "Hexadecimal" "x")
-                (const :tag "Signed decimal" "d")
-                (const :tag "Unsigned decimal" "u")
-                (const :tag "Octal" "o")
-                (const :tag "Binary" "t"))
-  :group 'gdb
-  :version "22.1")
-
-(defcustom gdb-memory-unit "w"
-  "Unit size of data items in memory window."
-  :type '(choice (const :tag "Byte" "b")
-                (const :tag "Halfword" "h")
-                (const :tag "Word" "w")
-                (const :tag "Giant word" "g"))
-  :group 'gdb
-  :version "22.1")
-
-(gdb-set-buffer-rules 'gdb-memory-buffer
-                     'gdb-memory-buffer-name
-                     'gdb-memory-mode)
-
-(def-gdb-auto-updated-buffer gdb-memory-buffer
-  gdb-invalidate-memory
-  (concat gdb-server-prefix "x/" (number-to-string gdb-memory-repeat-count)
-         gdb-memory-format gdb-memory-unit " " gdb-memory-address "\n")
-  gdb-read-memory-handler
-  gdb-read-memory-custom)
-
-(defun gdb-read-memory-custom ()
-  (save-excursion
-    (goto-char (point-min))
-    (if (looking-at "0x[[:xdigit:]]+")
-       (setq gdb-memory-address (match-string 0)))))
-
-(defvar gdb-memory-mode-map
-  (let ((map (make-sparse-keymap)))
-    (suppress-keymap map)
-    (define-key map "S" 'gdb-memory-set-address)
-    (define-key map "N" 'gdb-memory-set-repeat-count)
-    (define-key map "q" 'kill-this-buffer)
-     map))
-
-(defun gdb-memory-set-address (&optional event)
-  "Set the start memory address."
-  (interactive)
-  (let ((arg (read-from-minibuffer "Start address: ")))
-    (setq gdb-memory-address arg))
-    (gdb-invalidate-memory))
-
-(defun gdb-memory-set-repeat-count (&optional event)
-  "Set the number of data items in memory window."
-  (interactive)
-  (let* ((arg (read-from-minibuffer "Repeat count: "))
-        (count (string-to-number arg)))
-    (if (<= count 0)
-       (error "Positive numbers only")
-      (customize-set-variable 'gdb-memory-repeat-count count)
-      (gdb-invalidate-memory))))
-
-(defun gdb-memory-format-binary ()
-  "Set the display format to binary."
-  (interactive)
-  (customize-set-variable 'gdb-memory-format "t")
-  (gdb-invalidate-memory))
-
-(defun gdb-memory-format-octal ()
-  "Set the display format to octal."
-  (interactive)
-  (customize-set-variable 'gdb-memory-format "o")
-  (gdb-invalidate-memory))
-
-(defun gdb-memory-format-unsigned ()
-  "Set the display format to unsigned decimal."
-  (interactive)
-  (customize-set-variable 'gdb-memory-format "u")
-  (gdb-invalidate-memory))
-
-(defun gdb-memory-format-signed ()
-  "Set the display format to decimal."
-  (interactive)
-  (customize-set-variable 'gdb-memory-format "d")
-  (gdb-invalidate-memory))
-
-(defun gdb-memory-format-hexadecimal ()
-  "Set the display format to hexadecimal."
-  (interactive)
-  (customize-set-variable 'gdb-memory-format "x")
-  (gdb-invalidate-memory))
-
-(defvar gdb-memory-format-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map [header-line down-mouse-3] 'gdb-memory-format-menu-1)
-    map)
-  "Keymap to select format in the header line.")
-
-(defvar gdb-memory-format-menu (make-sparse-keymap "Format")
-  "Menu of display formats in the header line.")
-
-(define-key gdb-memory-format-menu [binary]
-  '(menu-item "Binary" gdb-memory-format-binary
-             :button (:radio . (equal gdb-memory-format "t"))))
-(define-key gdb-memory-format-menu [octal]
-  '(menu-item "Octal" gdb-memory-format-octal
-             :button (:radio . (equal gdb-memory-format "o"))))
-(define-key gdb-memory-format-menu [unsigned]
-  '(menu-item "Unsigned Decimal" gdb-memory-format-unsigned
-             :button (:radio . (equal gdb-memory-format "u"))))
-(define-key gdb-memory-format-menu [signed]
-  '(menu-item "Signed Decimal" gdb-memory-format-signed
-             :button (:radio . (equal gdb-memory-format "d"))))
-(define-key gdb-memory-format-menu [hexadecimal]
-  '(menu-item "Hexadecimal" gdb-memory-format-hexadecimal
-             :button (:radio . (equal gdb-memory-format "x"))))
-
-(defun gdb-memory-format-menu (event)
-  (interactive "@e")
-  (x-popup-menu event gdb-memory-format-menu))
-
-(defun gdb-memory-format-menu-1 (event)
-  (interactive "e")
-  (save-selected-window
-    (select-window (posn-window (event-start event)))
-    (let* ((selection (gdb-memory-format-menu event))
-          (binding (and selection (lookup-key gdb-memory-format-menu
-                                              (vector (car selection))))))
-      (if binding (call-interactively binding)))))
-
-(defun gdb-memory-unit-giant ()
-  "Set the unit size to giant words (eight bytes)."
-  (interactive)
-  (customize-set-variable 'gdb-memory-unit "g")
-  (gdb-invalidate-memory))
-
-(defun gdb-memory-unit-word ()
-  "Set the unit size to words (four bytes)."
-  (interactive)
-  (customize-set-variable 'gdb-memory-unit "w")
-  (gdb-invalidate-memory))
-
-(defun gdb-memory-unit-halfword ()
-  "Set the unit size to halfwords (two bytes)."
-  (interactive)
-  (customize-set-variable 'gdb-memory-unit "h")
-  (gdb-invalidate-memory))
-
-(defun gdb-memory-unit-byte ()
-  "Set the unit size to bytes."
-  (interactive)
-  (customize-set-variable 'gdb-memory-unit "b")
-  (gdb-invalidate-memory))
-
-(defvar gdb-memory-unit-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map [header-line down-mouse-3] 'gdb-memory-unit-menu-1)
-    map)
-  "Keymap to select units in the header line.")
-
-(defvar gdb-memory-unit-menu (make-sparse-keymap "Unit")
-  "Menu of units in the header line.")
-
-(define-key gdb-memory-unit-menu [giantwords]
-  '(menu-item "Giant words" gdb-memory-unit-giant
-             :button (:radio . (equal gdb-memory-unit "g"))))
-(define-key gdb-memory-unit-menu [words]
-  '(menu-item "Words" gdb-memory-unit-word
-             :button (:radio . (equal gdb-memory-unit "w"))))
-(define-key gdb-memory-unit-menu [halfwords]
-  '(menu-item "Halfwords" gdb-memory-unit-halfword
-             :button (:radio . (equal gdb-memory-unit "h"))))
-(define-key gdb-memory-unit-menu [bytes]
-  '(menu-item "Bytes" gdb-memory-unit-byte
-             :button (:radio . (equal gdb-memory-unit "b"))))
-
-(defun gdb-memory-unit-menu (event)
-  (interactive "@e")
-  (x-popup-menu event gdb-memory-unit-menu))
-
-(defun gdb-memory-unit-menu-1 (event)
-  (interactive "e")
-  (save-selected-window
-    (select-window (posn-window (event-start event)))
-    (let* ((selection (gdb-memory-unit-menu event))
-          (binding (and selection (lookup-key gdb-memory-unit-menu
-                                              (vector (car selection))))))
-      (if binding (call-interactively binding)))))
-
-(defvar gdb-memory-font-lock-keywords
-  '(;; <__function.name+n>
-    ("<\\(\\(\\sw\\|[_.]\\)+\\)\\(\\+[0-9]+\\)?>" (1 font-lock-function-name-face))
-    )
-  "Font lock keywords used in `gdb-memory-mode'.")
-
-(defun gdb-memory-mode ()
-  "Major mode for examining memory.
-
-\\{gdb-memory-mode-map}"
-  (kill-all-local-variables)
-  (setq major-mode 'gdb-memory-mode)
-  (setq mode-name "Memory")
-  (setq buffer-read-only t)
-  (buffer-disable-undo)
-  (use-local-map gdb-memory-mode-map)
-  (setq header-line-format
-       '(:eval
-         (concat
-          "Start address["
-          (propertize
-           "-"
-           'face font-lock-warning-face
-           'help-echo "mouse-1: decrement address"
-           'mouse-face 'mode-line-highlight
-           'local-map
-           (gdb-make-header-line-mouse-map
-            'mouse-1
-            (lambda () (interactive)
-              (let ((gdb-memory-address
-                     ;; Let GDB do the arithmetic.
-                     (concat
-                      gdb-memory-address " - "
-                      (number-to-string
-                       (* gdb-memory-repeat-count
-                          (cond ((string= gdb-memory-unit "b") 1)
-                                ((string= gdb-memory-unit "h") 2)
-                                ((string= gdb-memory-unit "w") 4)
-                                ((string= gdb-memory-unit "g") 8)))))))
-                (gdb-invalidate-memory)))))
-          "|"
-          (propertize "+"
-                      'face font-lock-warning-face
-                      'help-echo "mouse-1: increment address"
-                      'mouse-face 'mode-line-highlight
-                      'local-map (gdb-make-header-line-mouse-map
-                                  'mouse-1
-                                  (lambda () (interactive)
-                                    (let ((gdb-memory-address nil))
-                                      (gdb-invalidate-memory)))))
-          "]: "
-          (propertize gdb-memory-address
-                      'face font-lock-warning-face
-                      'help-echo "mouse-1: set start address"
-                      'mouse-face 'mode-line-highlight
-                      'local-map (gdb-make-header-line-mouse-map
-                                  'mouse-1
-                                  #'gdb-memory-set-address))
-          "  Repeat Count: "
-          (propertize (number-to-string gdb-memory-repeat-count)
-                      'face font-lock-warning-face
-                      'help-echo "mouse-1: set repeat count"
-                      'mouse-face 'mode-line-highlight
-                      'local-map (gdb-make-header-line-mouse-map
-                                  'mouse-1
-                                  #'gdb-memory-set-repeat-count))
-          "  Display Format: "
-          (propertize gdb-memory-format
-                      'face font-lock-warning-face
-                      'help-echo "mouse-3: select display format"
-                      'mouse-face 'mode-line-highlight
-                      'local-map gdb-memory-format-map)
-          "  Unit Size: "
-          (propertize gdb-memory-unit
-                      'face font-lock-warning-face
-                      'help-echo "mouse-3: select unit size"
-                      'mouse-face 'mode-line-highlight
-                      'local-map gdb-memory-unit-map))))
-  (set (make-local-variable 'font-lock-defaults)
-       '(gdb-memory-font-lock-keywords))
-  (run-mode-hooks 'gdb-memory-mode-hook)
-  'gdb-invalidate-memory)
-
-(defun gdb-memory-buffer-name ()
-  (with-current-buffer gud-comint-buffer
-    (concat "*memory of " (gdb-get-target-string) "*")))
-
-(defun gdb-display-memory-buffer ()
-  "Display memory contents."
-  (interactive)
-  (gdb-display-buffer
-   (gdb-get-buffer-create 'gdb-memory-buffer) t))
-
-(defun gdb-frame-memory-buffer ()
-  "Display memory contents in a new frame."
-  (interactive)
-  (let* ((special-display-regexps (append special-display-regexps '(".*")))
-        (special-display-frame-alist
-         (cons '(left-fringe . 0)
-               (cons '(right-fringe . 0)
-                     (cons '(width . 83) gdb-frame-parameters)))))
-    (display-buffer (gdb-get-buffer-create 'gdb-memory-buffer))))
-\f
-
-;; Locals buffer.
-;;
-(gdb-set-buffer-rules 'gdb-locals-buffer
-                     'gdb-locals-buffer-name
-                     'gdb-locals-mode)
-
-(def-gdb-auto-update-trigger gdb-invalidate-locals
-  (gdb-get-buffer 'gdb-locals-buffer)
-  "server info locals\n"
-  gdb-info-locals-handler)
-
-(defvar gdb-locals-watch-map
-  (let ((map (make-sparse-keymap)))
-    (suppress-keymap map)
-    (define-key map "\r" (lambda () (interactive)
-                          (beginning-of-line)
-                          (gud-watch)))
-    (define-key map [mouse-2] (lambda (event) (interactive "e")
-                               (mouse-set-point event)
-                               (beginning-of-line)
-                               (gud-watch)))
-    map)
-  "Keymap to create watch expression of a complex data type local variable.")
-
-(defconst gdb-struct-string
-  (concat (propertize "[struct/union]"
-                     'mouse-face 'highlight
-                     'help-echo "mouse-2: create watch expression"
-                     'local-map gdb-locals-watch-map) "\n"))
-
-(defconst gdb-array-string
-  (concat " " (propertize "[array]"
-                         'mouse-face 'highlight
-                         'help-echo "mouse-2: create watch expression"
-                         'local-map gdb-locals-watch-map) "\n"))
-
-;; Abbreviate for arrays and structures.
-;; These can be expanded using gud-display.
-(defun gdb-info-locals-handler ()
-  (setq gdb-pending-triggers (delq 'gdb-invalidate-locals
-                                 gdb-pending-triggers))
-  (let ((buf (gdb-get-buffer 'gdb-partial-output-buffer)))
-    (with-current-buffer buf
-      (goto-char (point-min))
-      ;; Need this in case "set print pretty" is on.
-      (while (re-search-forward "^[ }].*\n" nil t)
-       (replace-match "" nil nil))
-      (goto-char (point-min))
-      (while (re-search-forward "{\\(.*=.*\n\\|\n\\)" nil t)
-       (replace-match gdb-struct-string nil nil))
-      (goto-char (point-min))
-      (while (re-search-forward "\\s-*{[^.].*\n" nil t)
-       (replace-match gdb-array-string nil nil))))
-  (let ((buf (gdb-get-buffer 'gdb-locals-buffer)))
-    (and buf
-        (with-current-buffer buf
-             (let* ((window (get-buffer-window buf 0))
-                    (start (window-start window))
-                    (p (window-point window))
-                    (buffer-read-only nil))
-                (erase-buffer)
-                (insert-buffer-substring (gdb-get-buffer-create
-                                          'gdb-partial-output-buffer))
-               (set-window-start window start)
-               (set-window-point window p)))))
-  (run-hooks 'gdb-info-locals-hook))
-
-(defvar gdb-locals-mode-map
-  (let ((map (make-sparse-keymap)))
-    (suppress-keymap map)
-    (define-key map "q" 'kill-this-buffer)
-     map))
-
-(defun gdb-locals-mode ()
-  "Major mode for gdb locals.
-
-\\{gdb-locals-mode-map}"
-  (kill-all-local-variables)
-  (setq major-mode 'gdb-locals-mode)
-  (setq mode-name (concat "Locals:" gdb-selected-frame))
-  (use-local-map gdb-locals-mode-map)
-  (setq buffer-read-only t)
-  (buffer-disable-undo)
-  (setq header-line-format gdb-locals-header)
-  (gdb-thread-identification)
-  (set (make-local-variable 'font-lock-defaults)
-       '(gdb-locals-font-lock-keywords))
-  (run-mode-hooks 'gdb-locals-mode-hook)
-  (if (and (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba)
-          (string-equal gdb-version "pre-6.4"))
-      'gdb-invalidate-locals
-    'gdb-invalidate-locals-1))
-
-(defun gdb-locals-buffer-name ()
-  (with-current-buffer gud-comint-buffer
-    (concat "*locals of " (gdb-get-target-string) "*")))
-
-(defun gdb-display-locals-buffer ()
-  "Display local variables of current stack and their values."
-  (interactive)
-  (gdb-display-buffer
-   (gdb-get-buffer-create 'gdb-locals-buffer) t))
-
-(defun gdb-frame-locals-buffer ()
-  "Display local variables of current stack and their values in a new frame."
-  (interactive)
-  (let ((special-display-regexps (append special-display-regexps '(".*")))
-       (special-display-frame-alist gdb-frame-parameters))
-    (display-buffer (gdb-get-buffer-create 'gdb-locals-buffer))))
-\f
-
-;;;; Window management
-(defun gdb-display-buffer (buf dedicated &optional frame)
-  (let ((answer (get-buffer-window buf (or frame 0))))
-    (if answer
-       (display-buffer buf nil (or frame 0)) ;Deiconify the frame if necessary.
-      (let ((window (get-lru-window)))
-       (if (memq (buffer-local-value 'gud-minor-mode (window-buffer window))
-                 '(gdba gdbmi))
-           (let* ((largest (get-largest-window))
-                  (cur-size (window-height largest)))
-             (setq answer (split-window largest))
-             (set-window-buffer answer buf)
-             (set-window-dedicated-p answer dedicated)
-             answer)
-         (set-window-buffer window buf)
-         window)))))
-
-\f
-;;; Shared keymap initialization:
-
-(let ((menu (make-sparse-keymap "GDB-Windows")))
-  (define-key gud-menu-map [displays]
-    `(menu-item "GDB-Windows" ,menu
-               :help "Open a GDB-UI buffer in a new window."
-               :visible (memq gud-minor-mode '(gdbmi gdba))))
-  (define-key menu [gdb] '("Gdb" . gdb-display-gdb-buffer))
-  (define-key menu [threads] '("Threads" . gdb-display-threads-buffer))
-  (define-key menu [inferior]
-    '(menu-item "Separate IO" gdb-display-separate-io-buffer
-               :enable gdb-use-separate-io-buffer))
-  (define-key menu [memory] '("Memory" . gdb-display-memory-buffer))
-  (define-key menu [registers] '("Registers" . gdb-display-registers-buffer))
-  (define-key menu [disassembly]
-    '("Disassembly" . gdb-display-assembler-buffer))
-  (define-key menu [breakpoints]
-    '("Breakpoints" . gdb-display-breakpoints-buffer))
-  (define-key menu [locals] '("Locals" . gdb-display-locals-buffer))
-  (define-key menu [frames] '("Stack" . gdb-display-stack-buffer)))
-
-(let ((menu (make-sparse-keymap "GDB-Frames")))
-  (define-key gud-menu-map [frames]
-    `(menu-item "GDB-Frames" ,menu
-               :help "Open a GDB-UI buffer in a new frame."
-               :visible (memq gud-minor-mode '(gdbmi gdba))))
-  (define-key menu [gdb] '("Gdb" . gdb-frame-gdb-buffer))
-  (define-key menu [threads] '("Threads" . gdb-frame-threads-buffer))
-  (define-key menu [memory] '("Memory" . gdb-frame-memory-buffer))
-  (define-key menu [inferior]
-    '(menu-item "Separate IO" gdb-frame-separate-io-buffer
-               :enable gdb-use-separate-io-buffer))
-  (define-key menu [registers] '("Registers" . gdb-frame-registers-buffer))
-  (define-key menu [disassembly] '("Disassembly" . gdb-frame-assembler-buffer))
-  (define-key menu [breakpoints]
-    '("Breakpoints" . gdb-frame-breakpoints-buffer))
-  (define-key menu [locals] '("Locals" . gdb-frame-locals-buffer))
-  (define-key menu [frames] '("Stack" . gdb-frame-stack-buffer)))
-
-(let ((menu (make-sparse-keymap "GDB-UI/MI")))
-  (define-key gud-menu-map [ui]
-    `(menu-item (if (eq gud-minor-mode 'gdba) "GDB-UI" "GDB-MI")
-               ,menu :visible (memq gud-minor-mode '(gdbmi gdba))))
-  (define-key menu [gdb-customize]
-  '(menu-item "Customize" (lambda () (interactive) (customize-group 'gdb))
-             :help "Customize Gdb Graphical Mode options."))
-  (define-key menu [gdb-find-source-frame]
-  '(menu-item "Look For Source Frame" gdb-find-source-frame
-             :visible (eq gud-minor-mode 'gdba)
-             :help "Toggle looking for source frame further up call stack."
-             :button (:toggle . gdb-find-source-frame)))
-  (define-key menu [gdb-use-separate-io]
-  '(menu-item "Separate IO" gdb-use-separate-io-buffer
-             :visible (eq gud-minor-mode 'gdba)
-             :help "Toggle separate IO for debugged program."
-             :button (:toggle . gdb-use-separate-io-buffer)))
-  (define-key menu [gdb-many-windows]
-  '(menu-item "Display Other Windows" gdb-many-windows
-             :help "Toggle display of locals, stack and breakpoint information."
-             :button (:toggle . gdb-many-windows)))
-  (define-key menu [gdb-restore-windows]
-  '(menu-item "Restore Window Layout" gdb-restore-windows
-             :help "Restore standard layout for debug session.")))
-
-(defun gdb-frame-gdb-buffer ()
-  "Display GUD buffer in a new frame."
-  (interactive)
-  (let ((special-display-regexps (append special-display-regexps '(".*")))
-       (special-display-frame-alist
-        (remove '(menu-bar-lines) (remove '(tool-bar-lines)
-                                          gdb-frame-parameters)))
-       (same-window-regexps nil))
-    (display-buffer gud-comint-buffer)))
-
-(defun gdb-display-gdb-buffer ()
-  "Display GUD buffer."
-  (interactive)
-  (let ((same-window-regexps nil))
-    (select-window (display-buffer gud-comint-buffer nil 0))))
-
-(defun gdb-set-window-buffer (name)
-  (set-window-buffer (selected-window) (get-buffer name))
-  (set-window-dedicated-p (selected-window) t))
-
-(defun gdb-setup-windows ()
-  "Layout the window pattern for `gdb-many-windows'."
-  (gdb-display-locals-buffer)
-  (gdb-display-stack-buffer)
-  (delete-other-windows)
-  (gdb-display-breakpoints-buffer)
-  (delete-other-windows)
-  ; Don't dedicate.
-  (pop-to-buffer gud-comint-buffer)
-  (split-window nil ( / ( * (window-height) 3) 4))
-  (split-window nil ( / (window-height) 3))
-  (split-window-horizontally)
-  (other-window 1)
-  (gdb-set-window-buffer (gdb-locals-buffer-name))
-  (other-window 1)
-  (switch-to-buffer
-       (if gud-last-last-frame
-          (gud-find-file (car gud-last-last-frame))
-        (if gdb-main-file
-            (gud-find-file gdb-main-file)
-          ;; Put buffer list in window if we
-          ;; can't find a source file.
-          (list-buffers-noselect))))
-  (setq gdb-source-window (selected-window))
-  (when gdb-use-separate-io-buffer
-    (split-window-horizontally)
-    (other-window 1)
-    (gdb-set-window-buffer
-     (gdb-get-buffer-create 'gdb-inferior-io)))
-  (other-window 1)
-  (gdb-set-window-buffer (gdb-stack-buffer-name))
-  (split-window-horizontally)
-  (other-window 1)
-  (gdb-set-window-buffer (gdb-breakpoints-buffer-name))
-  (other-window 1))
-
-(defun gdb-restore-windows ()
-  "Restore the basic arrangement of windows used by gdba.
-This arrangement depends on the value of `gdb-many-windows'."
-  (interactive)
-  (pop-to-buffer gud-comint-buffer)    ;Select the right window and frame.
-    (delete-other-windows)
-  (if gdb-many-windows
-      (gdb-setup-windows)
-    (when (or gud-last-last-frame gdb-show-main)
-      (split-window)
-      (other-window 1)
-      (switch-to-buffer
-       (if gud-last-last-frame
-          (gud-find-file (car gud-last-last-frame))
-        (gud-find-file gdb-main-file)))
-      (setq gdb-source-window (selected-window))
-      (other-window 1))))
-
-(defun gdb-reset ()
-  "Exit a debugging session cleanly.
-Kills the gdb buffers, and resets variables and the source buffers."
-  (dolist (buffer (buffer-list))
-    (unless (eq buffer gud-comint-buffer)
-      (with-current-buffer buffer
-       (if (memq gud-minor-mode '(gdbmi gdba))
-           (if (string-match "\\` ?\\*.+\\*\\'" (buffer-name))
-               (kill-buffer nil)
-             (gdb-remove-breakpoint-icons (point-min) (point-max) t)
-             (setq gud-minor-mode nil)
-             (kill-local-variable 'tool-bar-map)
-             (kill-local-variable 'gdb-define-alist))))))
-  (setq gdb-overlay-arrow-position nil)
-  (setq overlay-arrow-variable-list
-       (delq 'gdb-overlay-arrow-position overlay-arrow-variable-list))
-  (setq fringe-indicator-alist '((overlay-arrow . right-triangle)))
-  (setq gdb-stack-position nil)
-  (setq overlay-arrow-variable-list
-       (delq 'gdb-stack-position overlay-arrow-variable-list))
-  (if (boundp 'speedbar-frame) (speedbar-timer-fn))
-  (setq gud-running nil)
-  (setq gdb-active-process nil)
-  (setq gdb-var-list nil)
-  (remove-hook 'after-save-hook 'gdb-create-define-alist t))
-
-(defun gdb-source-info ()
-  "Find the source file where the program starts and display it with related
-buffers."
-  (goto-char (point-min))
-  (if (and (search-forward "Located in " nil t)
-          (looking-at "\\S-+"))
-      (setq gdb-main-file (match-string 0)))
-  (goto-char (point-min))
-  (if (search-forward "Includes preprocessor macro info." nil t)
-      (setq gdb-macro-info t))
-  (if gdb-many-windows
-      (gdb-setup-windows)
-   (gdb-get-buffer-create 'gdb-breakpoints-buffer)
-   (if (and gdb-show-main gdb-main-file)
-       (let ((pop-up-windows t))
-        (display-buffer (gud-find-file gdb-main-file)))))
- (setq gdb-ready t))
-
-(defun gdb-get-location (bptno line flag)
-  "Find the directory containing the relevant source file.
-Put in buffer and place breakpoint icon."
-  (goto-char (point-min))
-  (catch 'file-not-found
-    (if (search-forward "Located in " nil t)
-       (when (looking-at "\\S-+")
-         (delete (cons bptno "File not found") gdb-location-alist)
-         (push (cons bptno (match-string 0)) gdb-location-alist))
-      (gdb-resync)
-      (unless (assoc bptno gdb-location-alist)
-       (push (cons bptno "File not found") gdb-location-alist)
-       (message-box "Cannot find source file for breakpoint location.\n\
-Add directory to search path for source files using the GDB command, dir."))
-      (throw 'file-not-found nil))
-    (with-current-buffer
-       (find-file-noselect (match-string 0))
-      (gdb-init-buffer)
-      ;; only want one breakpoint icon at each location
-      (save-excursion
-       (goto-char (point-min))
-       (forward-line (1- (string-to-number line)))
-       (gdb-put-breakpoint-icon (eq flag ?y) bptno)))))
-
-(add-hook 'find-file-hook 'gdb-find-file-hook)
-
-(defun gdb-find-file-hook ()
-  "Set up buffer for debugging if file is part of the source code
-of the current session."
-  (if (and (buffer-name gud-comint-buffer)
-          ;; in case gud or gdb-ui is just loaded
-          gud-comint-buffer
-          (memq (buffer-local-value 'gud-minor-mode gud-comint-buffer)
-              '(gdba gdbmi)))
-      ;;Pre GDB 6.3 "info sources" doesn't give absolute file name.
-      (if (member (if (string-equal gdb-version "pre-6.4")
-                     (file-name-nondirectory buffer-file-name)
-                   buffer-file-name)
-                 gdb-source-file-list)
-         (with-current-buffer (find-buffer-visiting buffer-file-name)
-           (gdb-init-buffer)))))
-
-;;from put-image
-(defun gdb-put-string (putstring pos &optional dprop &rest sprops)
-  "Put string PUTSTRING in front of POS in the current buffer.
-PUTSTRING is displayed by putting an overlay into the current buffer with a
-`before-string' string that has a `display' property whose value is
-PUTSTRING."
-  (let ((string (make-string 1 ?x))
-       (buffer (current-buffer)))
-    (setq putstring (copy-sequence putstring))
-    (let ((overlay (make-overlay pos pos buffer))
-         (prop (or dprop
-                   (list (list 'margin 'left-margin) putstring))))
-      (put-text-property 0 1 'display prop string)
-      (if sprops
-         (add-text-properties 0 1 sprops string))
-      (overlay-put overlay 'put-break t)
-      (overlay-put overlay 'before-string string))))
-
-;;from remove-images
-(defun gdb-remove-strings (start end &optional buffer)
-  "Remove strings between START and END in BUFFER.
-Remove only strings that were put in BUFFER with calls to `gdb-put-string'.
-BUFFER nil or omitted means use the current buffer."
-  (unless buffer
-    (setq buffer (current-buffer)))
-  (dolist (overlay (overlays-in start end))
-    (when (overlay-get overlay 'put-break)
-         (delete-overlay overlay))))
-
-(defun gdb-put-breakpoint-icon (enabled bptno)
-  (if (string-match "[0-9+]+\\." bptno)
-      (setq enabled gdb-parent-bptno-enabled))
-  (let ((start (- (line-beginning-position) 1))
-       (end (+ (line-end-position) 1))
-       (putstring (if enabled "B" "b"))
-       (source-window (get-buffer-window (current-buffer) 0)))
-    (add-text-properties
-     0 1 '(help-echo "mouse-1: clear bkpt, mouse-3: enable/disable bkpt")
-     putstring)
-    (if enabled
-       (add-text-properties
-        0 1 `(gdb-bptno ,bptno gdb-enabled t) putstring)
-      (add-text-properties
-       0 1 `(gdb-bptno ,bptno gdb-enabled nil) putstring))
-    (gdb-remove-breakpoint-icons start end)
-    (if (display-images-p)
-       (if (>= (or left-fringe-width
-                   (if source-window (car (window-fringes source-window)))
-                   gdb-buffer-fringe-width) 8)
-           (gdb-put-string
-            nil (1+ start)
-            `(left-fringe breakpoint
-                          ,(if enabled
-                               'breakpoint-enabled
-                             'breakpoint-disabled))
-            'gdb-bptno bptno
-            'gdb-enabled enabled)
-         (when (< left-margin-width 2)
-           (save-current-buffer
-             (setq left-margin-width 2)
-             (if source-window
-                 (set-window-margins
-                  source-window
-                  left-margin-width right-margin-width))))
-         (put-image
-          (if enabled
-              (or breakpoint-enabled-icon
-                  (setq breakpoint-enabled-icon
-                        (find-image `((:type xpm :data
-                                             ,breakpoint-xpm-data
-                                             :ascent 100 :pointer hand)
-                                      (:type pbm :data
-                                             ,breakpoint-enabled-pbm-data
-                                             :ascent 100 :pointer hand)))))
-            (or breakpoint-disabled-icon
-                (setq breakpoint-disabled-icon
-                      (find-image `((:type xpm :data
-                                           ,breakpoint-xpm-data
-                                           :conversion disabled
-                                           :ascent 100 :pointer hand)
-                                    (:type pbm :data
-                                           ,breakpoint-disabled-pbm-data
-                                           :ascent 100 :pointer hand))))))
-          (+ start 1)
-          putstring
-          'left-margin))
-      (when (< left-margin-width 2)
-       (save-current-buffer
-         (setq left-margin-width 2)
-         (let ((window (get-buffer-window (current-buffer) 0)))
-           (if window
-               (set-window-margins
-                window left-margin-width right-margin-width)))))
-      (gdb-put-string
-       (propertize putstring
-                  'face (if enabled 'breakpoint-enabled 'breakpoint-disabled))
-       (1+ start)))))
-
-(defun gdb-remove-breakpoint-icons (start end &optional remove-margin)
-  (gdb-remove-strings start end)
-  (if (display-images-p)
-      (remove-images start end))
-  (when remove-margin
-    (setq left-margin-width 0)
-    (let ((window (get-buffer-window (current-buffer) 0)))
-      (if window
-         (set-window-margins
-          window left-margin-width right-margin-width)))))
-
-\f
-;;
-;; Assembler buffer.
-;;
-(gdb-set-buffer-rules 'gdb-assembler-buffer
-                     'gdb-assembler-buffer-name
-                     'gdb-assembler-mode)
-
-;; We can't use def-gdb-auto-update-handler because we don't want to use
-;; window-start but keep the overlay arrow/current line visible.
-(defun gdb-assembler-handler ()
-  (setq gdb-pending-triggers
-       (delq 'gdb-invalidate-assembler
-             gdb-pending-triggers))
-  (let ((buf (gdb-get-buffer 'gdb-partial-output-buffer)))
-    (with-current-buffer buf
-      (goto-char (point-min))
-      ;; The disassemble command in GDB 7.1 onwards displays an overlay arrow.
-      (while (re-search-forward "\\(^   0x\\|=> 0x\\)" nil t)
-       (replace-match "0x" nil nil))))
-  (let ((buf (gdb-get-buffer 'gdb-assembler-buffer)))
-    (and buf
-        (with-current-buffer buf
-          (let* ((window (get-buffer-window buf 0))
-                 (p (window-point window))
-                 (buffer-read-only nil))
-            (erase-buffer)
-            (insert-buffer-substring (gdb-get-buffer-create
-                                         'gdb-partial-output-buffer))
-            (set-window-point window p)))))
-  ;; put customisation here
-  (gdb-assembler-custom))
-
-(defun gdb-assembler-custom ()
-  (let ((buffer (gdb-get-buffer 'gdb-assembler-buffer))
-       (pos 1) (address) (flag) (bptno))
-    (with-current-buffer buffer
-      (save-excursion
-       (if (not (equal gdb-pc-address "main"))
-           (progn
-             (goto-char (point-min))
-             (if (and gdb-pc-address
-                      (search-forward gdb-pc-address nil t))
-                 (progn
-                   (setq pos (point))
-                   (beginning-of-line)
-                   (setq fringe-indicator-alist
-                         (if (string-equal gdb-frame-number "0")
-                             nil
-                           '((overlay-arrow . hollow-right-triangle))))
-                   (or gdb-overlay-arrow-position
-                       (setq gdb-overlay-arrow-position (make-marker)))
-                   (set-marker gdb-overlay-arrow-position (point))))))
-       ;; remove all breakpoint-icons in assembler buffer before updating.
-       (gdb-remove-breakpoint-icons (point-min) (point-max))))
-    (with-current-buffer (gdb-get-buffer 'gdb-breakpoints-buffer)
-      (goto-char (point-min))
-      (while (< (point) (- (point-max) 1))
-       (forward-line 1)
-       (when (looking-at
-              "\\([0-9]+\\.?[0-9]*\\).*?\\s-+\\(.\\)\\s-+0x0*\\(\\S-+\\)")
-         (setq bptno (match-string 1))
-         (setq flag (char-after (match-beginning 2)))
-         (setq address (match-string 3))
-         (with-current-buffer buffer
-           (save-excursion
-             (goto-char (point-min))
-             (if (re-search-forward (concat "^0x0*" address) nil t)
-                 (gdb-put-breakpoint-icon (eq flag ?y) bptno)))))))
-    (if (not (equal gdb-pc-address "main"))
-       (with-current-buffer buffer
-         (set-window-point (get-buffer-window buffer 0) pos)))))
-
-(defvar gdb-assembler-mode-map
-  (let ((map (make-sparse-keymap)))
-    (suppress-keymap map)
-    (define-key map "q" 'kill-this-buffer)
-     map))
-
-(defvar gdb-assembler-font-lock-keywords
-  '(;; <__function.name+n>
-    ("<\\(\\(\\sw\\|[_.]\\)+\\)\\(\\+[0-9]+\\)?>"
-     (1 font-lock-function-name-face))
-    ;; 0xNNNNNNNN <__function.name+n>: opcode
-    ("^0x[0-9a-f]+ \\(<\\(\\(\\sw\\|[_.]\\)+\\)\\+[0-9]+>\\)?:[ \t]+\\(\\sw+\\)"
-     (4 font-lock-keyword-face))
-    ;; %register(at least i386)
-    ("%\\sw+" . font-lock-variable-name-face)
-    ("^\\(Dump of assembler code for function\\) \\(.+\\):"
-     (1 font-lock-comment-face)
-     (2 font-lock-function-name-face))
-    ("^\\(End of assembler dump\\.\\)" . font-lock-comment-face))
-  "Font lock keywords used in `gdb-assembler-mode'.")
-
-(defun gdb-assembler-mode ()
-  "Major mode for viewing code assembler.
-
-\\{gdb-assembler-mode-map}"
-  (kill-all-local-variables)
-  (setq major-mode 'gdb-assembler-mode)
-  (setq mode-name (concat "Machine:" gdb-selected-frame))
-  (setq gdb-overlay-arrow-position nil)
-  (add-to-list 'overlay-arrow-variable-list 'gdb-overlay-arrow-position)
-  (setq fringes-outside-margins t)
-  (setq buffer-read-only t)
-  (buffer-disable-undo)
-  (gdb-thread-identification)
-  (use-local-map gdb-assembler-mode-map)
-  (gdb-invalidate-assembler)
-  (set (make-local-variable 'font-lock-defaults)
-       '(gdb-assembler-font-lock-keywords))
-  (run-mode-hooks 'gdb-assembler-mode-hook)
-  'gdb-invalidate-assembler)
-
-(defun gdb-assembler-buffer-name ()
-  (with-current-buffer gud-comint-buffer
-    (concat "*disassembly of " (gdb-get-target-string) "*")))
-
-(defun gdb-display-assembler-buffer ()
-  "Display disassembly view."
-  (interactive)
-  (setq gdb-previous-frame nil)
-  (gdb-display-buffer
-   (gdb-get-buffer-create 'gdb-assembler-buffer) t))
-
-(defun gdb-frame-assembler-buffer ()
-  "Display disassembly view in a new frame."
-  (interactive)
-  (setq gdb-previous-frame nil)
-  (let ((special-display-regexps (append special-display-regexps '(".*")))
-       (special-display-frame-alist gdb-frame-parameters))
-    (display-buffer (gdb-get-buffer-create 'gdb-assembler-buffer))))
-
-;; modified because if gdb-pc-address has changed value a new command
-;; must be enqueued to update the buffer with the new output
-(defun gdb-invalidate-assembler (&optional ignored)
-  (if (gdb-get-buffer 'gdb-assembler-buffer)
-      (progn
-       (unless (and gdb-selected-frame
-                    (string-equal gdb-selected-frame gdb-previous-frame))
-         (if (or (not (member 'gdb-invalidate-assembler
-                              gdb-pending-triggers))
-                 (not (equal (string-to-number gdb-pc-address)
-                             (string-to-number
-                              gdb-previous-frame-pc-address))))
-         (progn
-           ;; take previous disassemble command, if any, off the queue
-           (with-current-buffer gud-comint-buffer
-             (let ((queue gdb-input-queue))
-               (dolist (item queue)
-                 (if (equal (cdr item) '(gdb-assembler-handler))
-                     (setq gdb-input-queue
-                           (delete item gdb-input-queue))))))
-           (gdb-enqueue-input
-            (list
-             (concat gdb-server-prefix "disassemble " gdb-pc-address "\n")
-                  'gdb-assembler-handler))
-           (push 'gdb-invalidate-assembler gdb-pending-triggers)
-           (setq gdb-previous-frame-pc-address gdb-pc-address)
-           (setq gdb-previous-frame gdb-selected-frame)))))))
-
-(defun gdb-get-selected-frame ()
-  (if (not (member 'gdb-get-selected-frame gdb-pending-triggers))
-      (progn
-       (if (string-equal gdb-version "pre-6.4")
-           (gdb-enqueue-input
-            (list (concat gdb-server-prefix "info frame\n")
-                  'gdb-frame-handler))
-         (gdb-enqueue-input
-           (list "server interpreter mi -stack-info-frame\n"
-                 'gdb-frame-handler-1)))
-       (push 'gdb-get-selected-frame gdb-pending-triggers))))
-
-(defun gdb-frame-handler ()
-  (setq gdb-pending-triggers
-       (delq 'gdb-get-selected-frame gdb-pending-triggers))
-  (goto-char (point-min))
-  (when (re-search-forward
-       "Stack level \\([0-9]+\\), frame at \\(0x[[:xdigit:]]+\\)" nil t)
-    (setq gdb-frame-number (match-string 1))
-    (setq gdb-frame-address (match-string 2)))
-  (goto-char (point-min))
-  (when (re-search-forward ".*=\\s-+\\(\\S-*\\)\\s-+in\\s-+\\(.*?\\)\
-\\(?: (\\(\\S-+?\\):[0-9]+?)\\)*; "
-     nil t)
-    (setq gdb-selected-frame (match-string 2))
-    (if (gdb-get-buffer 'gdb-locals-buffer)
-       (with-current-buffer (gdb-get-buffer 'gdb-locals-buffer)
-         (setq mode-name (concat "Locals:" gdb-selected-frame))))
-    (if (gdb-get-buffer 'gdb-assembler-buffer)
-       (with-current-buffer (gdb-get-buffer 'gdb-assembler-buffer)
-         (setq mode-name (concat "Machine:" gdb-selected-frame))))
-    (setq gdb-pc-address (match-string 1))
-    (if (and (match-string 3) gud-overlay-arrow-position)
-      (let ((buffer (marker-buffer gud-overlay-arrow-position))
-           (position (marker-position gud-overlay-arrow-position)))
-       (when (and buffer
-                  (string-equal (file-name-nondirectory
-                                 (buffer-file-name buffer))
-                                (file-name-nondirectory (match-string 3))))
-         (with-current-buffer buffer
-           (setq fringe-indicator-alist
-                 (if (string-equal gdb-frame-number "0")
-                     nil
-                   '((overlay-arrow . hollow-right-triangle))))
-           (set-marker gud-overlay-arrow-position position))))))
-  (goto-char (point-min))
-  (if (re-search-forward " source language \\(\\S-+\\)\." nil t)
-      (setq gdb-current-language (match-string 1)))
-  (gdb-invalidate-assembler))
-
-\f
-;; Code specific to GDB 6.4
-(defconst gdb-source-file-regexp-1 "fullname=\"\\(.*?\\)\"")
-
-(defun gdb-set-gud-minor-mode-existing-buffers-1 ()
-  "Create list of source files for current GDB session.
-If buffers already exist for any of these files, `gud-minor-mode'
-is set in them."
-  (goto-char (point-min))
-  (while (re-search-forward gdb-source-file-regexp-1 nil t)
-    (push (match-string 1) gdb-source-file-list))
-  (dolist (buffer (buffer-list))
-    (with-current-buffer buffer
-      (when (member buffer-file-name gdb-source-file-list)
-       (gdb-init-buffer))))
-  (gdb-force-mode-line-update
-   (propertize "ready" 'face font-lock-variable-name-face)))
-
-;; Used for -stack-info-frame but could be used for -stack-list-frames too.
-(defconst gdb-stack-list-frames-regexp
-".*?level=\"\\(.*?\\)\".*?,addr=\"\\(.*?\\)\".*?,func=\"\\(.*?\\)\",\
-\\(?:.*?file=\".*?\".*?,fullname=\"\\(.*?\\)\".*?,line=\"\\(.*?\\)\".*?}\\|\
-from=\"\\(.*?\\)\"\\)")
-
-(defun gdb-frame-handler-1 ()
-  (setq gdb-pending-triggers
-       (delq 'gdb-get-selected-frame gdb-pending-triggers))
-  (goto-char (point-min))
-    (when (re-search-forward gdb-stack-list-frames-regexp nil t)
-      (setq gdb-frame-number (match-string 1))
-      (setq gdb-pc-address (match-string 2))
-      (setq gdb-selected-frame (match-string 3))
-      (if (gdb-get-buffer 'gdb-locals-buffer)
-         (with-current-buffer (gdb-get-buffer 'gdb-locals-buffer)
-           (setq mode-name (concat "Locals:" gdb-selected-frame))))
-      (if (gdb-get-buffer 'gdb-assembler-buffer)
-         (with-current-buffer (gdb-get-buffer 'gdb-assembler-buffer)
-           (setq mode-name (concat "Machine:" gdb-selected-frame)))))
-    (if (and (match-string 4) (match-string 5) gud-overlay-arrow-position)
-       (let ((buffer (marker-buffer gud-overlay-arrow-position))
-             (position (marker-position gud-overlay-arrow-position)))
-         (when (and buffer
-                    (string-equal (file-name-nondirectory
-                                   (buffer-file-name buffer))
-                                  (file-name-nondirectory (match-string 4))))
-           (with-current-buffer buffer
-             (setq fringe-indicator-alist
-                   (if (string-equal gdb-frame-number "0")
-                       nil
-                     '((overlay-arrow . hollow-right-triangle))))
-             (set-marker gud-overlay-arrow-position position)))))
-  (gdb-invalidate-assembler))
-
-; Uses "-var-list-children --all-values".  Needs GDB 6.4 onwards.
-(defun gdb-var-list-children-1 (varnum)
-  (gdb-enqueue-input
-   (list
-    (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba)
-       (concat "server interpreter mi \"-var-list-children --all-values \\\""
-               varnum "\\\"\"\n")
-      (concat "-var-list-children --all-values \"" varnum "\"\n"))
-    `(lambda () (gdb-var-list-children-handler-1 ,varnum)))))
-
-(defun gdb-var-list-children-handler-1 (varnum)
-  (let* ((var-list nil)
-        (output (bindat-get-field (gdb-json-partial-output "child")))
-        (children (bindat-get-field output 'children)))
-   (catch 'child-already-watched
-      (dolist (var gdb-var-list)
-       (if (string-equal varnum (car var))
-           (progn
-             ;; With dynamic varobjs numchild may have increased.
-             (setcar (nthcdr 2 var) (bindat-get-field output 'numchild))
-             (push var var-list)
-             (dolist (child children)
-               (let ((varchild (list (bindat-get-field child 'name)
-                                     (bindat-get-field child 'exp)
-                                     (bindat-get-field child 'numchild)
-                                     (bindat-get-field child 'type)
-                                     (bindat-get-field child 'value)
-                                     nil
-                                     (bindat-get-field child 'has_more))))
-                 (if (assoc (car varchild) gdb-var-list)
-                     (throw 'child-already-watched nil))
-                 (push varchild var-list))))
-         (push var var-list)))
-      (setq gdb-var-list (nreverse var-list))))
-  (gdb-speedbar-update))
-
-; Uses "-var-update --all-values".  Needs GDB 6.4 onwards.
-(defun gdb-var-update-1 ()
-  (if (not (member 'gdb-var-update gdb-pending-triggers))
-      (progn
-       (gdb-enqueue-input
-        (list
-         (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba)
-             "server interpreter mi \"-var-update --all-values *\"\n"
-           "-var-update --all-values *\n")
-         'gdb-var-update-handler-1))
-       (push 'gdb-var-update gdb-pending-triggers))))
-
-(defun gdb-var-update-handler-1 ()
-  (let ((changelist (bindat-get-field (gdb-json-partial-output) 'changelist)))
-    (dolist (var gdb-var-list)
-      (setcar (nthcdr 5 var) nil))
-    (let ((temp-var-list gdb-var-list))
-      (dolist (change changelist)
-       (let* ((varnum (bindat-get-field change 'name))
-              (var (assoc varnum gdb-var-list))
-              (new-num (bindat-get-field change 'new_num_children)))
-         (when var
-           (let ((scope (bindat-get-field change 'in_scope))
-                 (has-more (bindat-get-field change 'has_more)))
-             (cond ((string-equal scope "false")
-                    (if gdb-delete-out-of-scope
-                        (gdb-var-delete-1 var varnum)
-                      (setcar (nthcdr 5 var) 'out-of-scope)))
-                   ((string-equal scope "true")
-                    (setcar (nthcdr 6 var) has-more)
-                    (when (and (or (not has-more)
-                                   (string-equal has-more "0"))
-                               (not new-num)
-                               (string-equal (nth 2 var) "0"))
-                      (setcar (nthcdr 4 var)
-                              (bindat-get-field change 'value))
-                      (setcar (nthcdr 5 var) 'changed)))
-                   ((string-equal scope "invalid")
-                    (gdb-var-delete-1 var varnum)))))
-         (let ((var-list nil) var1
-               (children (bindat-get-field change 'new_children)))
-           (if new-num
-               (progn
-                 (setq var1 (pop temp-var-list))
-                 (while var1
-                   (if (string-equal varnum (car var1))
-                       (let ((new (string-to-number new-num))
-                             (previous (string-to-number (nth 2 var1))))
-                         (setcar (nthcdr 2 var1) new-num)
-                         (push var1 var-list)
-                         (cond ((> new previous)
-                                ;; Add new children to list.
-                                (dotimes (dummy previous)
-                                  (push (pop temp-var-list) var-list))
-                                (dolist (child children)
-                                  (let ((varchild
-                                         (list (bindat-get-field child 'name)
-                                               (bindat-get-field child 'exp)
-                                               (bindat-get-field child 'numchild)
-                                               (bindat-get-field child 'type)
-                                               (bindat-get-field child 'value)
-                                               'changed
-                                               (bindat-get-field child 'has_more))))
-                                    (push varchild var-list))))
-                               ;; Remove deleted children from list.
-                               ((< new previous)
-                                (dotimes (dummy new)
-                                    (push (pop temp-var-list) var-list))
-                                (dotimes (dummy (- previous new))
-                                    (pop temp-var-list)))))
-                     (push var1 var-list))
-                   (setq var1 (pop temp-var-list)))
-                 (setq gdb-var-list (nreverse var-list)))))))))
-  (setq gdb-pending-triggers
-       (delq 'gdb-var-update gdb-pending-triggers))
-  (gdb-speedbar-update))
-
-;; Registers buffer.
-;;
-(gdb-set-buffer-rules 'gdb-registers-buffer
-                     'gdb-registers-buffer-name
-                     'gdb-registers-mode)
-
-(def-gdb-auto-update-trigger gdb-invalidate-registers-1
-  (gdb-get-buffer 'gdb-registers-buffer)
-  (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba)
-      "server interpreter mi \"-data-list-register-values x\"\n"
-    "-data-list-register-values x\n")
-    gdb-data-list-register-values-handler)
-
-(defconst gdb-data-list-register-values-regexp
-  "{.*?number=\"\\(.*?\\)\".*?,value=\"\\(.*?\\)\".*?}")
-
-(defun gdb-data-list-register-values-handler ()
-  (setq gdb-pending-triggers (delq 'gdb-invalidate-registers-1
-                                  gdb-pending-triggers))
-  (goto-char (point-min))
-  (if (re-search-forward gdb-error-regexp nil t)
-      (let ((err (match-string 1)))
-       (with-current-buffer (gdb-get-buffer 'gdb-registers-buffer)
-         (let ((buffer-read-only nil))
-           (erase-buffer)
-           (put-text-property 0 (length err) 'face font-lock-warning-face err)
-           (insert err)
-           (goto-char (point-min)))))
-    (let ((register-list (reverse gdb-register-names))
-         (register nil) (register-string nil) (register-values nil))
-      (goto-char (point-min))
-      (while (re-search-forward gdb-data-list-register-values-regexp nil t)
-       (setq register (pop register-list))
-       (setq register-string (concat register "\t" (match-string 2) "\n"))
-       (if (member (match-string 1) gdb-changed-registers)
-           (put-text-property 0 (length register-string)
-                              'face 'font-lock-warning-face
-                              register-string))
-       (setq register-values
-             (concat register-values register-string)))
-      (let ((buf (gdb-get-buffer 'gdb-registers-buffer)))
-       (with-current-buffer buf
-         (let* ((window (get-buffer-window buf 0))
-                (start (window-start window))
-                (p (if window (window-point window) (point)))
-                (buffer-read-only nil))
-           (erase-buffer)
-           (insert register-values)
-           (if window
-               (progn
-                 (set-window-start window start)
-                 (set-window-point window p))
-             (goto-char p)))))))
-  (gdb-data-list-register-values-custom))
-
-(defun gdb-data-list-register-values-custom ()
-  (with-current-buffer (gdb-get-buffer 'gdb-registers-buffer)
-    (save-excursion
-      (let ((buffer-read-only nil)
-           start end)
-       (goto-char (point-min))
-       (while (< (point) (point-max))
-         (setq start (line-beginning-position))
-         (setq end (line-end-position))
-         (when (looking-at "^[^\t]+")
-           (unless (string-equal (match-string 0) "No registers.")
-             (put-text-property start (match-end 0)
-                                'face font-lock-variable-name-face)
-             (add-text-properties start end
-                                  '(help-echo "mouse-2: edit value"
-                                    mouse-face highlight))))
-         (forward-line 1))))))
-
-;; Needs GDB 6.4 onwards (used to fail with no stack).
-(defun gdb-get-changed-registers ()
-  (if (and (gdb-get-buffer 'gdb-registers-buffer)
-          (not (member 'gdb-get-changed-registers gdb-pending-triggers)))
-      (progn
-       (gdb-enqueue-input
-        (list
-         (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba)
-             "server interpreter mi -data-list-changed-registers\n"
-           "-data-list-changed-registers\n")
-         'gdb-get-changed-registers-handler))
-       (push 'gdb-get-changed-registers gdb-pending-triggers))))
-
-(defconst gdb-data-list-register-names-regexp "\"\\(.*?\\)\"")
-
-(defun gdb-get-changed-registers-handler ()
-  (setq gdb-pending-triggers
-       (delq 'gdb-get-changed-registers gdb-pending-triggers))
-  (setq gdb-changed-registers nil)
-  (goto-char (point-min))
-  (while (re-search-forward gdb-data-list-register-names-regexp nil t)
-    (push (match-string 1) gdb-changed-registers)))
-\f
-
-;; Locals buffer.
-;;
-;; uses "-stack-list-locals --simple-values".  Needs GDB 6.1 onwards.
-(gdb-set-buffer-rules 'gdb-locals-buffer
-                     'gdb-locals-buffer-name
-                     'gdb-locals-mode)
-
-(def-gdb-auto-update-trigger gdb-invalidate-locals-1
-  (gdb-get-buffer 'gdb-locals-buffer)
-  (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba)
-      "server interpreter mi -\"stack-list-locals --simple-values\"\n"
-    "-stack-list-locals --simple-values\n")
-  gdb-stack-list-locals-handler)
-
-(defconst gdb-stack-list-locals-regexp
-  "{.*?name=\"\\(.*?\\)\".*?,type=\"\\(.*?\\)\"")
-
-(defvar gdb-locals-watch-map-1
-  (let ((map (make-sparse-keymap)))
-    (suppress-keymap map)
-    (define-key map "\r" 'gud-watch)
-    (define-key map [mouse-2] 'gud-watch)
-    map)
-  "Keymap to create watch expression of a complex data type local variable.")
-
-(defvar gdb-edit-locals-map-1
-  (let ((map (make-sparse-keymap)))
-    (suppress-keymap map)
-    (define-key map "\r" 'gdb-edit-locals-value)
-    (define-key map [mouse-2] 'gdb-edit-locals-value)
-    map)
-  "Keymap to edit value of a simple data type local variable.")
-
-(defun gdb-edit-locals-value (&optional event)
-  "Assign a value to a variable displayed in the locals buffer."
-  (interactive (list last-input-event))
-  (save-excursion
-    (if event (posn-set-point (event-end event)))
-    (beginning-of-line)
-    (let* ((var (current-word))
-          (value (read-string (format "New value (%s): " var))))
-      (gdb-enqueue-input
-       (list (concat  gdb-server-prefix "set variable " var " = " value "\n")
-            'ignore)))))
-
-;; Dont display values of arrays or structures.
-;; These can be expanded using gud-watch.
-(defun gdb-stack-list-locals-handler ()
-  (setq gdb-pending-triggers (delq 'gdb-invalidate-locals-1
-                                 gdb-pending-triggers))
-  (goto-char (point-min))
-  (if (re-search-forward gdb-error-regexp nil t)
-      (let ((err (match-string 1)))
-       (with-current-buffer (gdb-get-buffer 'gdb-locals-buffer)
-         (let ((buffer-read-only nil))
-           (erase-buffer)
-           (insert err)
-           (goto-char (point-min)))))
-    (let (local locals-list)
-      (goto-char (point-min))
-      (while (re-search-forward gdb-stack-list-locals-regexp nil t)
-       (let ((local (list (match-string 1)
-                          (match-string 2)
-                          nil)))
-         (if (looking-at ",value=\\(\".*\"\\).*?}")
-             (setcar (nthcdr 2 local) (read (match-string 1))))
-         (push local locals-list)))
-      (let ((buf (gdb-get-buffer 'gdb-locals-buffer)))
-       (and buf (with-current-buffer buf
-                  (let* ((window (get-buffer-window buf 0))
-                         (start (window-start window))
-                         (p (if window (window-point window) (point)))
-                         (buffer-read-only nil) (name) (value))
-                    (erase-buffer)
-                    (dolist (local locals-list)
-                      (setq name (car local))
-                      (setq value (nth 2 local))
-                      (if (or (not value)
-                              (string-match "^\\0x" value))
-                          (add-text-properties 0 (length name)
-                               `(mouse-face highlight
-                                 help-echo "mouse-2: create watch expression"
-                                 local-map ,gdb-locals-watch-map-1)
-                               name)
-                        (add-text-properties 0 (length value)
-                             `(mouse-face highlight
-                               help-echo "mouse-2: edit value"
-                               local-map ,gdb-edit-locals-map-1)
-                             value))
-                      (insert
-                       (concat name "\t" (nth 1 local)
-                               "\t" value "\n")))
-                    (if window
-                        (progn
-                          (set-window-start window start)
-                          (set-window-point window p))
-                      (goto-char p)))))))))
-
-(defun gdb-get-register-names ()
-  "Create a list of register names."
-  (goto-char (point-min))
-  (while (re-search-forward gdb-data-list-register-names-regexp nil t)
-    (push (match-string 1) gdb-register-names)))
-
-(provide 'gdb-ui)
-
-;; arch-tag: e9fb00c5-74ef-469f-a088-37384caae352
-;;; gdb-ui.el ends here
index de94620c737660bef6b459eb34c914594257b587..3f5fa543813926addb61a4cf38ca968ab31013f1 100644 (file)
@@ -781,12 +781,17 @@ substitution string.  Note dynamic scoping of variables.")
                  (file-name-nondirectory bn)))
         (default-alias
           (and fn
-               (let ((aliases grep-files-aliases)
+               (let ((aliases (remove (assoc "all" grep-files-aliases)
+                                      grep-files-aliases))
                      alias)
                  (while aliases
                    (setq alias (car aliases)
                          aliases (cdr aliases))
-                   (if (string-match (wildcard-to-regexp (cdr alias)) fn)
+                   (if (string-match (mapconcat
+                                      'wildcard-to-regexp
+                                      (split-string (cdr alias) nil t)
+                                      "\\|")
+                                     fn)
                        (setq aliases nil)
                      (setq alias nil)))
                  (cdr alias))))
index bee7a062f64a6bb17c53af3cbbe0e067586cc296..d20a14682c7a8b89e3084fbbcea4250833df14dd 100644 (file)
 (require 'comint)
 
 (defvar gdb-active-process)
-(defvar gdb-recording)
 (defvar gdb-define-alist)
 (defvar gdb-macro-info)
-(defvar gdb-server-prefix)
 (defvar gdb-show-changed-values)
 (defvar gdb-source-window)
 (defvar gdb-var-list)
@@ -126,77 +124,52 @@ Used to grey out relevant toolbar icons.")
                (throw 'info-found nil))))
        nil 0)
       (select-frame (make-frame)))
-    (if (memq gud-minor-mode '(gdbmi gdba))
+    (if (eq gud-minor-mode 'gdbmi)
        (info "(emacs)GDB Graphical Interface")
       (info "(emacs)Debuggers"))))
 
 (defun gud-tool-bar-item-visible-no-fringe ()
   (not (or (eq (buffer-local-value 'major-mode (window-buffer)) 'speedbar-mode)
-          (and (memq gud-minor-mode '(gdbmi gdba))
+          (eq (buffer-local-value 'major-mode (window-buffer)) 'gdb-memory-mode)
+          (and (eq gud-minor-mode 'gdbmi)
                (> (car (window-fringes)) 0)))))
 
+(declare-function gdb-gud-context-command "gdb-mi.el")
+
 (defun gud-stop-subjob ()
   (interactive)
   (with-current-buffer gud-comint-buffer
-    (if (string-equal gud-target-name "emacs")
-       (comint-stop-subjob)
-      (if (eq gud-minor-mode 'jdb)
-         (gud-call "suspend")
-       (comint-interrupt-subjob)))))
+    (cond ((string-equal gud-target-name "emacs")
+           (comint-stop-subjob))
+          ((eq gud-minor-mode 'jdb)
+           (gud-call "suspend"))
+          ((eq gud-minor-mode 'gdbmi)
+           (gud-call (gdb-gud-context-command "-exec-interrupt")))
+          (t
+           (comint-interrupt-subjob)))))
 
 (easy-mmode-defmap gud-menu-map
   '(([help]     "Info (debugger)" . gud-goto-info)
-    ([rfinish] menu-item "Reverse Finish Function" gud-rfinish
-                  :enable (not gud-running)
-                 :visible (and gdb-recording
-                               (eq gud-minor-mode 'gdba)))
-    ([rstepi]  menu-item "Reverse Step Instruction" gud-rstepi
-                  :enable (not gud-running)
-                 :visible (and gdb-recording
-                               (eq gud-minor-mode 'gdba)))
-    ([rnexti]  menu-item "Reverse Next Instruction" gud-rnexti
-                  :enable (not gud-running)
-                 :visible (and gdb-recording
-                               (eq gud-minor-mode 'gdba)))
-    ([rstep]   menu-item "Reverse Step Line" gud-rstep
-                  :enable (not gud-running)
-                 :visible (and gdb-recording
-                               (eq gud-minor-mode 'gdba)))
-    ([rnext]   menu-item "Reverse Next Line" gud-rnext
-                  :enable (not gud-running)
-                 :visible (and gdb-recording
-                               (eq gud-minor-mode 'gdba)))
-    ([rcont]   menu-item "Reverse Continue" gud-rcont
-                  :enable (not gud-running)
-                 :visible (and gdb-recording
-                               (eq gud-minor-mode 'gdba)))
-    ([recstart] menu-item "Start Recording" gdb-toggle-recording-1
-                 :visible (and (not gdb-recording)
-                               (eq gud-minor-mode 'gdba)))
-    ([recstop] menu-item "Stop Recording" gdb-toggle-recording
-                 :visible (and gdb-recording
-                               (eq gud-minor-mode 'gdba)))
     ([tooltips] menu-item "Show GUD tooltips" gud-tooltip-mode
                   :enable (and (not emacs-basic-display)
                               (display-graphic-p)
                               (fboundp 'x-show-tip))
                  :visible (memq gud-minor-mode
-                               '(gdbmi gdba dbx sdb xdb pdb))
+                               '(gdbmi dbx sdb xdb pdb))
                  :button (:toggle . gud-tooltip-mode))
     ([refresh] "Refresh" . gud-refresh)
     ([run]     menu-item "Run" gud-run
                   :enable (not gud-running)
                  :visible (memq gud-minor-mode '(gdbmi gdb dbx jdb)))
     ([go]      menu-item (if gdb-active-process "Continue" "Run") gud-go
-                 :visible (and (not gud-running)
-                               (eq gud-minor-mode 'gdba)))
+                 :visible (and (eq gud-minor-mode 'gdbmi)
+                                (gdb-show-run-p)))
     ([stop]    menu-item "Stop" gud-stop-subjob
-                 :visible (or (not (memq gud-minor-mode '(gdba pdb)))
-                              (and gud-running
-                                   (eq gud-minor-mode 'gdba))))
+                 :visible (or (not (memq gud-minor-mode '(gdbmi pdb)))
+                              (gdb-show-stop-p)))
     ([until]   menu-item "Continue to selection" gud-until
                   :enable (not gud-running)
-                 :visible (and (memq gud-minor-mode '(gdbmi gdba gdb perldb))
+                 :visible (and (memq gud-minor-mode '(gdbmi gdb perldb))
                                (gud-tool-bar-item-visible-no-fringe)))
     ([remove]  menu-item "Remove Breakpoint" gud-remove
                   :enable (not gud-running)
@@ -204,50 +177,52 @@ Used to grey out relevant toolbar icons.")
     ([tbreak]  menu-item "Temporary Breakpoint" gud-tbreak
                   :enable (not gud-running)
                  :visible (memq gud-minor-mode
-                               '(gdbmi gdba gdb sdb xdb)))
+                               '(gdbmi gdb sdb xdb)))
     ([break]   menu-item "Set Breakpoint" gud-break
                   :enable (not gud-running)
                  :visible (gud-tool-bar-item-visible-no-fringe))
     ([up]      menu-item "Up Stack" gud-up
                  :enable (not gud-running)
                  :visible (memq gud-minor-mode
-                                '(gdbmi gdba gdb dbx xdb jdb pdb)))
+                                '(gdbmi gdb dbx xdb jdb pdb)))
     ([down]    menu-item "Down Stack" gud-down
                  :enable (not gud-running)
                  :visible (memq gud-minor-mode
-                                '(gdbmi gdba gdb dbx xdb jdb pdb)))
+                                '(gdbmi gdb dbx xdb jdb pdb)))
     ([pp]      menu-item "Print S-expression" gud-pp
                   :enable (and (not gud-running)
                                  gdb-active-process)
                  :visible (and (string-equal
                                 (buffer-local-value
                                  'gud-target-name gud-comint-buffer) "emacs")
-                               (eq gud-minor-mode 'gdba)))
-    ([print*]  menu-item "Print Dereference" gud-pstar
+                               (eq gud-minor-mode 'gdbmi)))
+    ([print*]  menu-item (if (eq gud-minor-mode 'jdb)
+                             "Dump object"
+                           "Print Dereference") gud-pstar
                   :enable (not gud-running)
-                 :visible (memq gud-minor-mode '(gdbmi gdba gdb)))
+                 :visible (memq gud-minor-mode '(gdbmi gdb jdb)))
     ([print]   menu-item "Print Expression" gud-print
                   :enable (not gud-running))
     ([watch]   menu-item "Watch Expression" gud-watch
                  :enable (not gud-running)
-                 :visible (memq gud-minor-mode '(gdbmi gdba)))
+                 :visible (eq gud-minor-mode 'gdbmi))
     ([finish]  menu-item "Finish Function" gud-finish
                   :enable (not gud-running)
                  :visible (memq gud-minor-mode
-                                '(gdbmi gdba gdb xdb jdb pdb)))
+                                '(gdbmi gdb xdb jdb pdb)))
     ([stepi]   menu-item "Step Instruction" gud-stepi
                   :enable (not gud-running)
-                 :visible (memq gud-minor-mode '(gdbmi gdba gdb dbx)))
+                 :visible (memq gud-minor-mode '(gdbmi gdb dbx)))
     ([nexti]   menu-item "Next Instruction" gud-nexti
                   :enable (not gud-running)
-                 :visible (memq gud-minor-mode '(gdbmi gdba gdb dbx)))
+                 :visible (memq gud-minor-mode '(gdbmi gdb dbx)))
     ([step]    menu-item "Step Line" gud-step
                   :enable (not gud-running))
     ([next]    menu-item "Next Line" gud-next
                   :enable (not gud-running))
     ([cont]    menu-item "Continue" gud-cont
                   :enable (not gud-running)
-                 :visible (not (eq gud-minor-mode 'gdba))))
+                 :visible (not (eq gud-minor-mode 'gdbmi))))
   "Menu for `gud-mode'."
   :name "Gud")
 
@@ -269,21 +244,22 @@ Used to grey out relevant toolbar icons.")
        . (,(propertize "next" 'face 'font-lock-doc-face) . gud-next))
        ([menu-bar until] menu-item
        ,(propertize "until" 'face 'font-lock-doc-face) gud-until
-                 :visible (memq gud-minor-mode '(gdbmi gdba gdb perldb)))
+                 :visible (memq gud-minor-mode '(gdbmi gdb perldb)))
        ([menu-bar cont] menu-item
        ,(propertize "cont" 'face 'font-lock-doc-face) gud-cont
-       :visible (not (eq gud-minor-mode 'gdba)))
+       :visible (not (eq gud-minor-mode 'gdbmi)))
        ([menu-bar run] menu-item
        ,(propertize "run" 'face 'font-lock-doc-face) gud-run
        :visible (memq gud-minor-mode '(gdbmi gdb dbx jdb)))
        ([menu-bar go] menu-item
        ,(propertize " go " 'face 'font-lock-doc-face) gud-go
-       :visible (and (not gud-running)
-                     (eq gud-minor-mode 'gdba)))
+       :visible (and (eq gud-minor-mode 'gdbmi)
+                      (gdb-show-run-p)))
        ([menu-bar stop] menu-item
        ,(propertize "stop" 'face 'font-lock-doc-face) gud-stop-subjob
-       :visible (and gud-running
-                    (eq gud-minor-mode 'gdba)))
+       :visible (or (and (eq gud-minor-mode 'gdbmi)
+                          (gdb-show-stop-p))
+                    (not (eq gud-minor-mode 'gdbmi))))
        ([menu-bar print]
        . (,(propertize "print" 'face 'font-lock-doc-face) . gud-print))
        ([menu-bar tools] . undefined)
@@ -322,14 +298,6 @@ Used to grey out relevant toolbar icons.")
                 (gud-stepi . "gud/stepi")
                 (gud-up . "gud/up")
                 (gud-down . "gud/down")
-                (gdb-toggle-recording-1 . "gud/recstart")
-                (gdb-toggle-recording . "gud/recstop")
-                (gud-rcont . "gud/rcont")
-                (gud-rnext . "gud/rnext")
-                (gud-rstep . "gud/rstep")
-                (gud-rfinish . "gud/rfinish")
-                (gud-rnexti . "gud/rnexti")
-                (gud-rstepi . "gud/rstepi")
                 (gud-goto-info . "info"))
               map)
       (tool-bar-local-item-from-menu
@@ -354,7 +322,7 @@ Uses `gud-<MINOR-MODE>-directories' to find the source files."
        (setq directories (cdr directories)))
       result)))
 
-(declare-function gdb-create-define-alist "gdb-ui" ())
+(declare-function gdb-create-define-alist "gdb-mi" ())
 
 (defun gud-find-file (file)
   ;; Don't get confused by double slashes in the name that comes from GDB.
@@ -370,7 +338,7 @@ Uses `gud-<MINOR-MODE>-directories' to find the source files."
        (set (make-local-variable 'gud-minor-mode) minor-mode)
        (set (make-local-variable 'tool-bar-map) gud-tool-bar-map)
        (when (and gud-tooltip-mode
-                  (memq gud-minor-mode '(gdbmi gdba)))
+                  (eq gud-minor-mode 'gdbmi))
          (make-local-variable 'gdb-define-alist)
          (unless  gdb-define-alist (gdb-create-define-alist))
          (add-hook 'after-save-hook 'gdb-create-define-alist nil t))
@@ -499,21 +467,21 @@ The value t means that there is no stack, and we are in display-file mode.")
 
 (defvar gud-speedbar-menu-items
   '(["Jump to stack frame" speedbar-edit-line
-     :visible (not (memq (buffer-local-value 'gud-minor-mode gud-comint-buffer)
-                   '(gdbmi gdba)))]
+     :visible (not (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer)
+                   'gdbmi))]
     ["Edit value" speedbar-edit-line
-     :visible (memq (buffer-local-value 'gud-minor-mode gud-comint-buffer)
-                   '(gdbmi gdba))]
+     :visible (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer)
+                   'gdbmi)]
     ["Delete expression" gdb-var-delete
-     :visible (memq (buffer-local-value 'gud-minor-mode gud-comint-buffer)
-                   '(gdbmi gdba))]
+     :visible (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer)
+                   'gdbmi)]
     ["Auto raise frame" gdb-speedbar-auto-raise
      :style toggle :selected gdb-speedbar-auto-raise
-     :visible (memq (buffer-local-value 'gud-minor-mode gud-comint-buffer)
-                   '(gdbmi gdba))]
+     :visible (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer)
+                   'gdbmi)]
     ("Output Format"
-     :visible (memq (buffer-local-value 'gud-minor-mode gud-comint-buffer)
-                   '(gdbmi gdba))
+     :visible (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer)
+                   'gdbmi)
      ["Binary" (gdb-var-set-format "binary") t]
      ["Natural" (gdb-var-set-format  "natural") t]
      ["Hexadecimal" (gdb-var-set-format "hexadecimal") t]))
@@ -542,7 +510,7 @@ required by the caller."
          (start (window-start window))
          (p (window-point window)))
       (cond
-       ((memq minor-mode '(gdbmi gdba))
+       ((eq minor-mode 'gdbmi)
        (erase-buffer)
        (insert "Watch Expressions:\n")
        (let ((var-list gdb-var-list) parent)
@@ -632,7 +600,7 @@ required by the caller."
                 (car frame)
                 'speedbar-file-face
                 'speedbar-highlight-face
-                (cond ((memq minor-mode '(gdbmi gdba gdb))
+                (cond ((memq minor-mode '(gdbmi gdb))
                        'gud-gdb-goto-stackframe)
                       (t (error "Should never be here")))
                 frame t))))
@@ -689,8 +657,6 @@ The option \"--fullname\" must be included in this value."
        ;; Set the accumulator to the remaining text.
        gud-marker-acc (substring gud-marker-acc (match-end 0))))
 
-    ;; Check for annotations and change gud-minor-mode to 'gdba if
-    ;; they are found.
     (while (string-match "\n\032\032\\(.*\\)\n" gud-marker-acc)
       (let ((match (match-string 1 gud-marker-acc)))
 
@@ -754,10 +720,10 @@ The option \"--fullname\" must be included in this value."
 (defvar gud-filter-pending-text nil
   "Non-nil means this is text that has been saved for later in `gud-filter'.")
 
-;; If in gdba mode, gdb-ui is loaded.
-(declare-function gdb-restore-windows "gdb-ui" ())
+;; If in gdb mode, gdb-mi is loaded.
+(declare-function gdb-restore-windows "gdb-mi" ())
 
-;; The old gdb command (text command mode).  The new one is in gdb-ui.el.
+;; The old gdb command (text command mode).  The new one is in gdb-mi.el.
 ;;;###autoload
 (defun gud-gdb (command-line)
   "Run gdb on program FILE in buffer *gud-FILE*.
@@ -768,10 +734,10 @@ directory and source-file directory for your debugger."
   (when (and gud-comint-buffer
           (buffer-name gud-comint-buffer)
           (get-buffer-process gud-comint-buffer)
-          (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba)))
-       (gdb-restore-windows)
-       (error
-        "Multiple debugging requires restarting in text command mode"))
+          (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdbmi)))
+    (gdb-restore-windows)
+    (error
+     "Multiple debugging requires restarting in text command mode"))
 
   (gud-common-init command-line nil 'gud-gdb-marker-filter)
   (set (make-local-variable 'gud-minor-mode) 'gdb)
@@ -2547,7 +2513,7 @@ comint mode, which see."
        (setq w (cdr w)))
       (if w
          (setcar w
-                 (if (file-remote-p default-directory)
+                 (if (file-remote-p file)
                      ;; Tramp has already been loaded if we are here.
                      (setq file (tramp-file-name-localname
                                  (tramp-dissect-file-name file)))
@@ -2642,7 +2608,7 @@ It is saved for when this flag is not set.")
 (defvar gud-overlay-arrow-position nil)
 (add-to-list 'overlay-arrow-variable-list 'gud-overlay-arrow-position)
 
-(declare-function gdb-reset "gdb-ui" ())
+(declare-function gdb-reset "gdb-mi" ())
 
 (defun gud-sentinel (proc msg)
   (cond ((null (buffer-name (process-buffer proc)))
@@ -2654,14 +2620,14 @@ It is saved for when this flag is not set.")
                  (string-equal speedbar-initial-expansion-list-name "GUD"))
             (speedbar-change-initial-expansion-list
              speedbar-previously-used-expansion-list-name))
-        (if (memq gud-minor-mode-type '(gdbmi gdba))
+        (if (eq gud-minor-mode-type 'gdbmi)
             (gdb-reset)
           (gud-reset)))
        ((memq (process-status proc) '(signal exit))
         ;; Stop displaying an arrow in a source file.
         (setq gud-overlay-arrow-position nil)
-        (if (memq (buffer-local-value 'gud-minor-mode gud-comint-buffer)
-                  '(gdba gdbmi))
+        (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer)
+                  'gdbmi)
             (gdb-reset)
           (gud-reset))
         (let* ((obuf (current-buffer)))
@@ -2692,7 +2658,9 @@ It is saved for when this flag is not set.")
 (defun gud-kill-buffer-hook ()
   (setq gud-minor-mode-type gud-minor-mode)
   (condition-case nil
-      (kill-process (get-buffer-process (current-buffer)))
+      (progn
+       (kill-process (get-buffer-process (current-buffer)))
+       (delete-process (get-process "gdb-inferior")))
     (error nil)))
 
 (defun gud-reset ()
@@ -2715,8 +2683,8 @@ Obeying it means displaying in another window the specified file and line."
 
 (declare-function global-hl-line-highlight  "hl-line" ())
 (declare-function hl-line-highlight         "hl-line" ())
-(declare-function gdb-display-source-buffer "gdb-ui"  (buffer))
-(declare-function gdb-display-buffer "gdb-ui" (buf dedicated &optional size))
+(declare-function gdb-display-source-buffer "gdb-mi"  (buffer))
+(declare-function gdb-display-buffer "gdb-mi" (buf dedicated &optional size))
 
 ;; Make sure the file named TRUE-FILE is in a buffer that appears on the screen
 ;; and that its line LINE is visible.
@@ -2732,7 +2700,7 @@ Obeying it means displaying in another window the specified file and line."
            (gud-find-file true-file)))
         (window (and buffer
                      (or (get-buffer-window buffer)
-                         (if (memq gud-minor-mode '(gdbmi gdba))
+                         (if (eq gud-minor-mode 'gdbmi)
                              (or (if (get-buffer-window buffer 'visible)
                                      (display-buffer buffer nil 'visible))
                                  (unless (gdb-display-source-buffer buffer)
@@ -2769,7 +2737,7 @@ Obeying it means displaying in another window the specified file and line."
                   (goto-char pos))))
          (when window
            (set-window-point window gud-overlay-arrow-position)
-           (if (memq gud-minor-mode '(gdbmi gdba))
+           (if (eq gud-minor-mode 'gdbmi)
                (setq gdb-source-window window)))))))
 
 ;; The gud-call function must do the right thing whether its invoking
@@ -2875,7 +2843,7 @@ Obeying it means displaying in another window the specified file and line."
             (forward-line 0))
           (if (looking-at comint-prompt-regexp)
               (set-marker gud-delete-prompt-marker (point)))
-          (if (memq gud-minor-mode '(gdbmi gdba))
+          (if (eq gud-minor-mode 'gdbmi)
               (apply comint-input-sender (list proc command))
             (process-send-string proc (concat command "\n"))))))))
 
@@ -3301,14 +3269,14 @@ Treats actions as defuns."
   (gud-tooltip-activate-mouse-motions-if-enabled)
   (if (and gud-comint-buffer
           (buffer-name gud-comint-buffer); gud-comint-buffer might be killed
-          (memq (buffer-local-value 'gud-minor-mode gud-comint-buffer)
-                '(gdbmi gdba)))
+          (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer)
+                'gdbmi))
       (if gud-tooltip-mode
          (progn
            (dolist (buffer (buffer-list))
              (unless (eq buffer gud-comint-buffer)
                (with-current-buffer buffer
-                 (when (and (memq gud-minor-mode '(gdbmi gdba))
+                 (when (and (eq gud-minor-mode 'gdbmi)
                             (not (string-match "\\`\\*.+\\*\\'"
                                                (buffer-name))))
                    (make-local-variable 'gdb-define-alist)
@@ -3433,8 +3401,8 @@ With arg, dereference expr if ARG is positive, otherwise do not derereference."
 ; Larger arrays (say 400 elements) are displayed in
 ; the tooltip incompletely and spill over into the gud buffer.
 ; Switching the process-filter creates timing problems and
-; it may be difficult to do better. Using annotations as in
-; gdb-ui.el gets round this problem.
+; it may be difficult to do better. Using GDB/MI as in
+; gdb-mi.el gets round this problem.
 (defun gud-tooltip-process-output (process output)
   "Process debugger output and show it in a tooltip window."
   (set-process-filter process gud-tooltip-original-filter)
@@ -3444,12 +3412,12 @@ With arg, dereference expr if ARG is positive, otherwise do not derereference."
 (defun gud-tooltip-print-command (expr)
   "Return a suitable command to print the expression EXPR."
   (case gud-minor-mode
-       (gdba (concat "server print " expr))
-       ((dbx gdbmi) (concat "print " expr))
+       (gdbmi (concat "-data-evaluate-expression " expr))
+       (dbx (concat "print " expr))
        ((xdb pdb) (concat "p " expr))
        (sdb (concat expr "/"))))
 
-(declare-function gdb-enqueue-input "gdb-ui" (item))
+(declare-function gdb-input "gdb-mi" (item))
 (declare-function tooltip-expr-to-print "tooltip" (event))
 (declare-function tooltip-event-buffer "tooltip" (event))
 
@@ -3469,12 +3437,12 @@ This function must return nil if it doesn't handle EVENT."
               (buffer-name gud-comint-buffer); might be killed
               (setq process (get-buffer-process gud-comint-buffer))
               (posn-point (event-end event))
-              (or (and (eq gud-minor-mode 'gdba) (not gdb-active-process))
+              (or (and (eq gud-minor-mode 'gdbmi) (not gdb-active-process))
                   (progn (setq gud-tooltip-event event)
                          (eval (cons 'and gud-tooltip-display)))))
       (let ((expr (tooltip-expr-to-print event)))
        (when expr
-         (if (and (eq gud-minor-mode 'gdba)
+         (if (and (eq gud-minor-mode 'gdbmi)
                   (not gdb-active-process))
              (progn
                (with-current-buffer (tooltip-event-buffer event)
@@ -3492,13 +3460,13 @@ This function must return nil if it doesn't handle EVENT."
                (message-box "Using GUD tooltips in this mode is unsafe\n\
 so they have been disabled."))
              (unless (null cmd) ; CMD can be nil if unknown debugger
-               (if (memq gud-minor-mode '(gdba gdbmi))
+               (if (eq gud-minor-mode 'gdbmi)
                      (if gdb-macro-info
-                         (gdb-enqueue-input
+                         (gdb-input
                           (list (concat
-                                 gdb-server-prefix "macro expand " expr "\n")
+                                 "server macro expand " expr "\n")
                                 `(lambda () (gdb-tooltip-print-1 ,expr))))
-                       (gdb-enqueue-input
+                       (gdb-input
                         (list  (concat cmd "\n")
                                 `(lambda () (gdb-tooltip-print ,expr)))))
                  (setq gud-tooltip-original-filter (process-filter process))
index 696853e09299c73a3b88242a5fc23ebb69e16de2..95acc4277361c5d95b83105d08a0b04b2934e2d9 100644 (file)
@@ -7,6 +7,7 @@
 ;; Maintainer: J.D. Smith <jdsmith@as.arizona.edu>
 ;; Version: 1.2
 ;; Keywords: languages
+;; Package: idlwave
 
 ;; This file is part of GNU Emacs.
 
index f6eff9c3cfff043093ab3f5c5da7e5dd9f38d302..850d68e918f8450a9e32774f9bebf8f0fb5085c9 100644 (file)
@@ -6,7 +6,8 @@
 ;; Authors: J.D. Smith <jdsmith@as.arizona.edu>
 ;;          Carsten Dominik <dominik@science.uva.nl>
 ;; Maintainer: J.D. Smith <jdsmith@as.arizona.edu>
-;; Version: 6.1_em22
+;; Version: 6.1.22
+;; Package: idlwave
 
 ;; This file is part of GNU Emacs.
 
index dbe6f179e5b04e6d52e56e0811c1a1a0fb1599a6..3acd396e9cde2ee6b36ca62733341a7c8ed14090 100644 (file)
@@ -7,8 +7,9 @@
 ;;          Carsten Dominik <dominik@astro.uva.nl>
 ;;          Chris Chase <chase@att.com>
 ;; Maintainer: J.D. Smith <jdsmith@as.arizona.edu>
-;; Version: 6.1_em22
+;; Version: 6.1.22
 ;; Keywords: processes
+;; Package: idlwave
 
 ;; This file is part of GNU Emacs.
 
index 395cfd54045c4395040af0eaea5c1f95595b283c..474065451d70b6bb70c95568da8daefbcb55301a 100644 (file)
@@ -5,8 +5,9 @@
 
 ;; Author: Carsten Dominik <dominik@astro.uva.nl>
 ;; Maintainer: J.D. Smith <jdsmith@as.arizona.edu>
-;; Version: 6.1_em22
+;; Version: 6.1.22
 ;; Keywords: processes
+;; Package: idlwave
 
 ;; This file is part of GNU Emacs.
 
index b2858f1479df0fbeacd4a3c901a18c828e9bda63..dc85d094810a6a45c6675eac2e4c71fb0f42a155 100644 (file)
@@ -7,7 +7,7 @@
 ;;          Carsten Dominik <dominik@science.uva.nl>
 ;;          Chris Chase <chase@att.com>
 ;; Maintainer: J.D. Smith <jdsmith@as.arizona.edu>
-;; Version: 6.1_em22
+;; Version: 6.1.22
 ;; Keywords: languages
 
 ;; This file is part of GNU Emacs.
@@ -1370,6 +1370,7 @@ list order matters since matching an assignment statement exactly is
 not possible without parsing.  Thus assignment statement become just
 the leftover unidentified statements containing an equal sign.")
 
+;; FIXME: This var seems to only ever be set, but never actually used!
 (defvar idlwave-fill-function 'auto-fill-function
   "IDL mode auto fill function.")
 
index 60ed14afbaca6e34921db8df26a7106750f84b2c..5e854f852e1cf8ea212a494c83dcdcda65e72d8b 100644 (file)
@@ -7,7 +7,7 @@
 ;; Maintainer: Daniel Colascione <dan.colascione@gmail.com>
 ;; Version: 9
 ;; Date: 2009-07-25
-;; Keywords: languages, oop, javascript
+;; Keywords: languages, javascript
 
 ;; This file is part of GNU Emacs.
 
@@ -431,11 +431,32 @@ Match group 1 is the name of the macro.")
   :group 'js)
 
 (defcustom js-expr-indent-offset 0
-  "Number of additional spaces used for indentation of continued expressions.
+  "Number of additional spaces for indenting continued expressions.
 The value must be no less than minus `js-indent-level'."
   :type 'integer
   :group 'js)
 
+(defcustom js-paren-indent-offset 0
+  "Number of additional spaces for indenting expressions in parentheses.
+The value must be no less than minus `js-indent-level'."
+  :type 'integer
+  :group 'js
+  :version "24.1")
+
+(defcustom js-square-indent-offset 0
+  "Number of additional spaces for indenting expressions in square braces.
+The value must be no less than minus `js-indent-level'."
+  :type 'integer
+  :group 'js
+  :version "24.1")
+
+(defcustom js-curly-indent-offset 0
+  "Number of additional spaces for indenting expressions in curly braces.
+The value must be no less than minus `js-indent-level'."
+  :type 'integer
+  :group 'js
+  :version "24.1")
+
 (defcustom js-auto-indent-flag t
   "Whether to automatically indent when typing punctuation characters.
 If non-nil, the characters {}();,: also indent the current line
@@ -1769,14 +1790,17 @@ nil."
           ((eq (char-after) ?#) 0)
           ((save-excursion (js--beginning-of-macro)) 4)
           ((nth 1 parse-status)
+          ;; A single closing paren/bracket should be indented at the
+          ;; same level as the opening statement. Same goes for
+          ;; "case" and "default".
            (let ((same-indent-p (looking-at
                                  "[]})]\\|\\_<case\\_>\\|\\_<default\\_>"))
                  (continued-expr-p (js--continued-expression-p)))
-             (goto-char (nth 1 parse-status))
+             (goto-char (nth 1 parse-status)) ; go to the opening char
              (if (looking-at "[({[]\\s-*\\(/[/*]\\|$\\)")
-                 (progn
+                 (progn ; nothing following the opening paren/bracket
                    (skip-syntax-backward " ")
-                  (when (eq (char-before) ?\)) (backward-list))
+                   (when (eq (char-before) ?\)) (backward-list))
                    (back-to-indentation)
                    (cond (same-indent-p
                           (current-column))
@@ -1784,7 +1808,14 @@ nil."
                           (+ (current-column) (* 2 js-indent-level)
                              js-expr-indent-offset))
                          (t
-                          (+ (current-column) js-indent-level))))
+                          (+ (current-column) js-indent-level
+                             (case (char-after (nth 1 parse-status))
+                               (?\( js-paren-indent-offset)
+                               (?\[ js-square-indent-offset)
+                               (?\{ js-curly-indent-offset))))))
+               ;; If there is something following the opening
+               ;; paren/bracket, everything else should be indented at
+               ;; the same level.
                (unless same-indent-p
                  (forward-char)
                  (skip-chars-forward " \t"))
@@ -3268,7 +3299,7 @@ If one hasn't been set, or if it's stale, prompt for a new one."
 ;;; Main Function
 
 ;;;###autoload
-(define-derived-mode js-mode nil "js"
+(define-derived-mode js-mode prog-mode "js"
   "Major mode for editing JavaScript.
 
 Key bindings:
index d45ecd47907cdfd0105b65445f0590b04835aa36..362a1db6c1068d015428298ea4f9a52463a8d280 100644 (file)
@@ -281,8 +281,7 @@ not be enclosed in { } or ( )."
   "Regex used to highlight makepp rule action lines in font lock mode.")
 
 (defconst makefile-bsdmake-rule-action-regex
-  (progn (string-match "-@" makefile-rule-action-regex)
-        (replace-match "-+@" t t makefile-rule-action-regex))
+  (replace-regexp-in-string "-@" "-+@" makefile-rule-action-regex)
   "Regex used to highlight BSD rule action lines in font lock mode.")
 
 ;; Note that the first and second subexpression is used by font lock.  Note
@@ -521,25 +520,25 @@ not be enclosed in { } or ( )."
     ("Macro Assignment" ,makefile-macroassign-regex 1))
   "Imenu generic expression for Makefile mode.  See `imenu-generic-expression'.")
 
-;;; ------------------------------------------------------------
-;;; The following configurable variables are used in the
-;;; up-to-date overview .
-;;; The standard configuration assumes that your `make' program
-;;; can be run in question/query mode using the `-q' option, this
-;;; means that the command
-;;;
-;;;    make -q foo
-;;;
-;;; should return an exit status of zero if the target `foo' is
-;;; up to date and a nonzero exit status otherwise.
-;;; Many makes can do this although the docs/manpages do not mention
-;;; it. Try it with your favourite one.  GNU make, System V make, and
-;;; Dennis Vadura's DMake have no problems.
-;;; Set the variable `makefile-brave-make' to the name of the
-;;; make utility that does this on your system.
-;;; To understand what this is all about see the function definition
-;;; of `makefile-query-by-make-minus-q' .
-;;; ------------------------------------------------------------
+;; ------------------------------------------------------------
+;; The following configurable variables are used in the
+;; up-to-date overview .
+;; The standard configuration assumes that your `make' program
+;; can be run in question/query mode using the `-q' option, this
+;; means that the command
+;;
+;;    make -q foo
+;;
+;; should return an exit status of zero if the target `foo' is
+;; up to date and a nonzero exit status otherwise.
+;; Many makes can do this although the docs/manpages do not mention
+;; it. Try it with your favourite one.  GNU make, System V make, and
+;; Dennis Vadura's DMake have no problems.
+;; Set the variable `makefile-brave-make' to the name of the
+;; make utility that does this on your system.
+;; To understand what this is all about see the function definition
+;; of `makefile-query-by-make-minus-q' .
+;; ------------------------------------------------------------
 
 (defcustom makefile-brave-make "make"
   "*How to invoke make, for `makefile-query-targets'.
@@ -574,11 +573,8 @@ The function must satisfy this calling convention:
 
 ;;; --- end of up-to-date-overview configuration ------------------
 
-(defvar makefile-mode-abbrev-table nil
+(define-abbrev-table 'makefile-mode-abbrev-table ()
   "Abbrev table in use in Makefile buffers.")
-(if makefile-mode-abbrev-table
-    ()
-  (define-abbrev-table 'makefile-mode-abbrev-table ()))
 
 (defvar makefile-mode-map
   (let ((map (make-sparse-keymap))
@@ -706,15 +702,13 @@ The function must satisfy this calling convention:
     (modify-syntax-entry ?\n ">     " st)
     st))
 
-(defvar makefile-imake-mode-syntax-table (copy-syntax-table
-                                         makefile-mode-syntax-table))
-(if makefile-imake-mode-syntax-table
-    ()
-  (modify-syntax-entry ?/  ". 14" makefile-imake-mode-syntax-table)
-  (modify-syntax-entry ?*  ". 23" makefile-imake-mode-syntax-table)
-  (modify-syntax-entry ?#  "'" makefile-imake-mode-syntax-table)
-  (modify-syntax-entry ?\n ". b" makefile-imake-mode-syntax-table))
-
+(defvar makefile-imake-mode-syntax-table
+  (let ((st (make-syntax-table makefile-mode-syntax-table)))
+    (modify-syntax-entry ?/  ". 14" st)
+    (modify-syntax-entry ?*  ". 23" st)
+    (modify-syntax-entry ?#  "'"    st)
+    (modify-syntax-entry ?\n ". b"  st)
+    st))
 
 ;;; ------------------------------------------------------------
 ;;; Internal variables.
@@ -774,7 +768,7 @@ The function must satisfy this calling convention:
 ;;; ------------------------------------------------------------
 
 ;;;###autoload
-(defun makefile-mode ()
+(define-derived-mode makefile-mode prog-mode "Makefile"
   "Major mode for editing standard Makefiles.
 
 If you are editing a file for a different make, try one of the
@@ -858,9 +852,6 @@ Makefile mode can be configured by modifying the following variables:
    List of special targets. You will be offered to complete
    on one of those in the minibuffer whenever you enter a `.'.
    at the beginning of a line in Makefile mode."
-
-  (interactive)
-  (kill-all-local-variables)
   (add-hook 'write-file-functions
            'makefile-warn-suspicious-lines nil t)
   (add-hook 'write-file-functions
@@ -874,59 +865,44 @@ Makefile mode can be configured by modifying the following variables:
   (make-local-variable 'makefile-need-macro-pickup)
 
   ;; Font lock.
-  (make-local-variable 'font-lock-defaults)
-  (setq font-lock-defaults
-       ;; SYNTAX-BEGIN set to backward-paragraph to avoid slow-down
-       ;; near the end of a large buffer, due to parse-partial-sexp's
-       ;; trying to parse all the way till the beginning of buffer.
-       '(makefile-font-lock-keywords
-         nil nil
-         ((?$ . "."))
-         backward-paragraph
-         (font-lock-syntactic-keywords
-          . makefile-font-lock-syntactic-keywords)))
+  (set (make-local-variable 'font-lock-defaults)
+       ;; SYNTAX-BEGIN set to backward-paragraph to avoid slow-down
+       ;; near the end of a large buffer, due to parse-partial-sexp's
+       ;; trying to parse all the way till the beginning of buffer.
+       '(makefile-font-lock-keywords
+         nil nil
+         ((?$ . "."))
+         backward-paragraph
+         (font-lock-syntactic-keywords
+          . makefile-font-lock-syntactic-keywords)))
 
   ;; Add-log.
-  (make-local-variable 'add-log-current-defun-function)
-  (setq add-log-current-defun-function 'makefile-add-log-defun)
+  (set (make-local-variable 'add-log-current-defun-function)
+       'makefile-add-log-defun)
 
   ;; Imenu.
-  (make-local-variable 'imenu-generic-expression)
-  (setq imenu-generic-expression makefile-imenu-generic-expression)
+  (set (make-local-variable 'imenu-generic-expression)
+       makefile-imenu-generic-expression)
 
   ;; Dabbrev.
-  (make-local-variable 'dabbrev-abbrev-skip-leading-regexp)
-  (setq dabbrev-abbrev-skip-leading-regexp "\\$")
+  (set (make-local-variable 'dabbrev-abbrev-skip-leading-regexp) "\\$")
 
   ;; Other abbrevs.
   (setq local-abbrev-table makefile-mode-abbrev-table)
 
   ;; Filling.
-  (make-local-variable 'fill-paragraph-function)
-  (setq fill-paragraph-function 'makefile-fill-paragraph)
+  (set (make-local-variable 'fill-paragraph-function) 'makefile-fill-paragraph)
 
   ;; Comment stuff.
-  (make-local-variable 'comment-start)
-  (setq comment-start "#")
-  (make-local-variable 'comment-end)
-  (setq comment-end "")
-  (make-local-variable 'comment-start-skip)
-  (setq comment-start-skip "#+[ \t]*")
+  (set (make-local-variable 'comment-start) "#")
+  (set (make-local-variable 'comment-end) "")
+  (set (make-local-variable 'comment-start-skip) "#+[ \t]*")
 
   ;; Make sure TAB really inserts \t.
   (set (make-local-variable 'indent-line-function) 'indent-to-left-margin)
 
-  ;; become the current major mode
-  (setq major-mode 'makefile-mode)
-  (setq mode-name "Makefile")
-
-  ;; Activate keymap and syntax table.
-  (use-local-map makefile-mode-map)
-  (set-syntax-table makefile-mode-syntax-table)
-
   ;; Real TABs are important in makefiles
-  (setq indent-tabs-mode t)
-  (run-mode-hooks 'makefile-mode-hook))
+  (setq indent-tabs-mode t))
 
 ;; These should do more than just differentiate font-lock.
 ;;;###autoload
index 5b1fc71247792576e321316bdee6c04725197592..ecb8461a9f28869b97e5452e5c757f9ee75d5498 100644 (file)
@@ -7,7 +7,7 @@
 ;; Maintainer: Pieter E.J. Pareit <pieter.pareit@gmail.com>
 ;; Created: 09 Nov 2002
 ;; Version: 0.1
-;; Keywords: languages Knuth mix mixal asm mixvm "The Art Of Computer Programming"
+;; Keywords: languages, Knuth, mix, mixal, asm, mixvm, The Art Of Computer Programming
 
 ;; This file is part of GNU Emacs.
 
index 8e64d5689d1915e9338237a76034316133e67654..c526a634d86e0b1542d7c3c779be6b8f2359ae6c 100644 (file)
@@ -7,6 +7,7 @@
 ;; Author: John Eaton <jwe@bevo.che.wisc.edu>
 ;; Maintainer: Kurt Hornik <Kurt.Hornik@wu-wien.ac.at>
 ;; Keywords: languages
+;; Package: octave-mod
 
 ;; This file is part of GNU Emacs.
 
index eb84be601de6326a74dd70455eeb0bc1ecadfac3..0fb4356051b1886577db9fff7733ccd018439f94 100644 (file)
@@ -4,7 +4,7 @@
 ;; Free Software Foundation, Inc.
 
 ;; Author: Kurt Hornik <Kurt.Hornik@wu-wien.ac.at>
-;; Author: John Eaton <jwe@bevo.che.wisc.edu>
+;; Author: John Eaton <jwe@octave.org>
 ;; Maintainer: Kurt Hornik <Kurt.Hornik@wu-wien.ac.at>
 ;; Keywords: languages
 
@@ -92,7 +92,7 @@ All Octave abbrevs start with a grave accent (`)."
 (defvar octave-comment-char ?#
   "Character to start an Octave comment.")
 (defvar octave-comment-start
-  (string octave-comment-char ?\ )
+  (string octave-comment-char ?\s)
   "String to insert to start a new Octave in-line comment.")
 (defvar octave-comment-start-skip "\\s<+\\s-*"
   "Regexp to match the start of an Octave comment up to its body.")
@@ -161,8 +161,8 @@ parenthetical grouping.")
   (list
    ;; Fontify all builtin keywords.
    (cons (concat "\\<\\("
-                (mapconcat 'identity octave-reserved-words "\\|")
-                (mapconcat 'identity octave-text-functions "\\|")
+                (regexp-opt (append octave-reserved-words
+                                     octave-text-functions))
                 "\\)\\>")
         'font-lock-keyword-face)
    ;; Fontify all builtin operators.
@@ -171,9 +171,7 @@ parenthetical grouping.")
             'font-lock-builtin-face
           'font-lock-preprocessor-face))
    ;; Fontify all builtin variables.
-   (cons (concat "\\<\\("
-                (mapconcat 'identity octave-variables "\\|")
-                "\\)\\>")
+   (cons (concat "\\<" (regexp-opt octave-variables) "\\>")
         'font-lock-variable-name-face)
    ;; Fontify all function declarations.
    (list octave-function-header-regexp
@@ -181,6 +179,30 @@ parenthetical grouping.")
         '(3 font-lock-function-name-face nil t)))
   "Additional Octave expressions to highlight.")
 
+(defvar octave-font-lock-syntactic-keywords
+  ;; Try to distinguish the string-quotes from the transpose-quotes.
+  '(("[[({,; ]\\('\\)" (1 "\"'"))
+    (octave-font-lock-close-quotes)))
+
+(defun octave-font-lock-close-quotes (limit)
+  "Fix the syntax-table of the closing quotes of single-quote strings."
+  ;; Freely inspired from perl-font-lock-special-syntactic-constructs.
+  (let ((state (syntax-ppss)))
+    (while (< (point) limit)
+      (cond
+       ((eq (nth 3 state) ?\')
+        ;; A '..' string.
+        (save-excursion
+          (when (and (or (looking-at "\\('\\)")
+                         (re-search-forward "[^\\]\\(?:\\\\\\\\\\)*\\('\\)"
+                                            nil t))
+                     (not (eobp)))
+            (put-text-property (match-beginning 1) (match-end 1)
+                               'syntax-table (string-to-syntax "\"'"))))))
+
+      (setq state (parse-partial-sexp (point) limit nil nil state
+                                     'syntax-table)))))
+
 (defcustom inferior-octave-buffer "*Inferior Octave*"
   "Name of buffer for running an inferior Octave process."
   :type 'string
@@ -194,26 +216,17 @@ parenthetical grouping.")
     (define-key map ";" 'octave-electric-semi)
     (define-key map " " 'octave-electric-space)
     (define-key map "\n" 'octave-reindent-then-newline-and-indent)
-    (define-key map "\e;" 'octave-indent-for-comment)
     (define-key map "\e\n" 'octave-indent-new-comment-line)
-    (define-key map "\e\t" 'octave-complete-symbol)
-    (define-key map "\M-\C-a" 'octave-beginning-of-defun)
-    (define-key map "\M-\C-e" 'octave-end-of-defun)
-    (define-key map "\M-\C-h" 'octave-mark-defun)
     (define-key map "\M-\C-q" 'octave-indent-defun)
-    (define-key map "\C-c;" 'octave-comment-region)
-    (define-key map "\C-c:" 'octave-uncomment-region)
     (define-key map "\C-c\C-b" 'octave-submit-bug-report)
     (define-key map "\C-c\C-p" 'octave-previous-code-line)
     (define-key map "\C-c\C-n" 'octave-next-code-line)
     (define-key map "\C-c\C-a" 'octave-beginning-of-line)
     (define-key map "\C-c\C-e" 'octave-end-of-line)
-    (define-key map "\C-c\M-\C-n" 'octave-forward-block)
-    (define-key map "\C-c\M-\C-p" 'octave-backward-block)
-    (define-key map "\C-c\M-\C-u" 'octave-backward-up-block)
-    (define-key map "\C-c\M-\C-d" 'octave-down-block)
+    (define-key map [remap down-list] 'smie-down-list)
     (define-key map "\C-c\M-\C-h" 'octave-mark-block)
-    (define-key map "\C-c]" 'octave-close-block)
+    (define-key map "\C-c]" 'smie-close-block)
+    (define-key map "\C-c/" 'smie-close-block)
     (define-key map "\C-c\C-f" 'octave-insert-defun)
     (define-key map "\C-c\C-h" 'octave-help)
     (define-key map "\C-c\C-il" 'octave-send-line)
@@ -234,7 +247,9 @@ parenthetical grouping.")
   "Keymap used in Octave mode.")
 
 
-(defvar octave-mode-menu
+
+(easy-menu-define octave-mode-menu octave-mode-map
+  "Menu for Octave mode."
   '("Octave"
     ("Lines"
       ["Previous Code Line"    octave-previous-code-line t]
@@ -243,16 +258,9 @@ parenthetical grouping.")
       ["End of Continuation"   octave-end-of-line t]
       ["Split Line at Point"   octave-indent-new-comment-line t])
     ("Blocks"
-      ["Next Block"            octave-forward-block t]
-      ["Previous Block"                octave-backward-block t]
-      ["Down Block"            octave-down-block t]
-      ["Up Block"              octave-backward-up-block t]
       ["Mark Block"            octave-mark-block t]
-      ["Close Block"           octave-close-block t])
+      ["Close Block"           smie-close-block t])
     ("Functions"
-      ["Begin of Function"     octave-beginning-of-defun t]
-      ["End of Function"       octave-end-of-defun t]
-      ["Mark Function"         octave-mark-defun t]
       ["Indent Function"       octave-indent-defun t]
       ["Insert Function"       octave-insert-defun t])
     "-"
@@ -266,16 +274,17 @@ parenthetical grouping.")
       ["Kill Process"          octave-kill-process t])
     "-"
     ["Indent Line"             indent-according-to-mode t]
-    ["Complete Symbol"         octave-complete-symbol t]
+    ["Complete Symbol"         completion-at-point t]
     "-"
-    ["Toggle Abbrev Mode"      abbrev-mode t]
-    ["Toggle Auto-Fill Mode"   auto-fill-mode t]
+    ["Toggle Abbrev Mode"      abbrev-mode
+     :style toggle :selected abbrev-mode]
+    ["Toggle Auto-Fill Mode"   auto-fill-mode
+     :style toggle :selected auto-fill-function]
     "-"
     ["Submit Bug Report"       octave-submit-bug-report t]
     "-"
-    ["Describe Octave Mode"    octave-describe-major-mode t]
-    ["Lookup Octave Index"     octave-help t])
-  "Menu for Octave mode.")
+    ["Describe Octave Mode"    describe-mode t]
+    ["Lookup Octave Index"     info-lookup-symbol t]))
 
 (defvar octave-mode-syntax-table
   (let ((table (make-syntax-table)))
@@ -297,8 +306,16 @@ parenthetical grouping.")
     (modify-syntax-entry ?\" "\"" table)
     (modify-syntax-entry ?. "w"   table)
     (modify-syntax-entry ?_ "w"   table)
-    (modify-syntax-entry ?\% "<"  table)
-    (modify-syntax-entry ?\# "<"  table)
+    ;; The "b" flag only applies to the second letter of the comstart
+    ;; and the first letter of the comend, i.e. the "4b" below is ineffective.
+    ;; If we try to put `b' on the single-line comments, we get a similar
+    ;; problem where the % and # chars appear as first chars of the 2-char
+    ;; comend, so the multi-line ender is also turned into style-b.
+    ;; So we need the new "c" comment style.
+    (modify-syntax-entry ?\% "< 13"  table)
+    (modify-syntax-entry ?\# "< 13"  table)
+    (modify-syntax-entry ?\{ "(} 2c"  table)
+    (modify-syntax-entry ?\} "){ 4c"  table)
     (modify-syntax-entry ?\n ">"  table)
     table)
   "Syntax table in use in `octave-mode' buffers.")
@@ -319,15 +336,12 @@ Non-nil means show matching begin of block when inserting a space,
 newline or semicolon after an else or end keyword."
   :type 'boolean
   :group 'octave)
+
 (defcustom octave-block-offset 2
   "Extra indentation applied to statements in Octave block structures."
   :type 'integer
   :group 'octave)
 
-(defvar octave-block-begin-regexp
-  (concat "\\<\\("
-         (mapconcat 'identity octave-begin-keywords "\\|")
-         "\\)\\>"))
 (defvar octave-block-else-regexp
   (concat "\\<\\("
          (mapconcat 'identity octave-else-keywords "\\|")
@@ -336,19 +350,17 @@ newline or semicolon after an else or end keyword."
   (concat "\\<\\("
          (mapconcat 'identity octave-end-keywords "\\|")
          "\\)\\>"))
-(defvar octave-block-begin-or-end-regexp
-  (concat octave-block-begin-regexp "\\|" octave-block-end-regexp))
 (defvar octave-block-else-or-end-regexp
   (concat octave-block-else-regexp "\\|" octave-block-end-regexp))
 (defvar octave-block-match-alist
   '(("do" . ("until"))
-    ("for" . ("endfor" "end"))
-    ("function" . ("endfunction"))
-    ("if" . ("else" "elseif" "endif" "end"))
-    ("switch" . ("case" "otherwise" "endswitch" "end"))
-    ("try" . ("catch" "end_try_catch"))
-    ("unwind_protect" . ("unwind_protect_cleanup" "end_unwind_protect"))
-    ("while" . ("endwhile" "end")))
+    ("for" . ("end" "endfor"))
+    ("function" . ("end" "endfunction"))
+    ("if" . ("else" "elseif" "end" "endif"))
+    ("switch" . ("case" "otherwise" "end" "endswitch"))
+    ("try" . ("catch" "end" "end_try_catch"))
+    ("unwind_protect" . ("unwind_protect_cleanup" "end" "end_unwind_protect"))
+    ("while" . ("end" "endwhile")))
   "Alist with Octave's matching block keywords.
 Has Octave's begin keywords as keys and a list of the matching else or
 end keywords as associated values.")
@@ -361,8 +373,11 @@ end keywords as associated values.")
   "Extra indentation applied to Octave continuation lines."
   :type 'integer
   :group 'octave)
+(eval-and-compile
+  (defconst octave-continuation-marker-regexp "\\\\\\|\\.\\.\\."))
 (defvar octave-continuation-regexp
-  "[^#%\n]*\\(\\\\\\|\\.\\.\\.\\)\\s-*\\(\\s<.*\\)?$")
+  (concat "[^#%\n]*\\(" octave-continuation-marker-regexp
+          "\\)\\s-*\\(\\s<.*\\)?$"))
 (defcustom octave-continuation-string "\\"
   "Character string used for Octave continuation lines.  Normally \\."
   :type 'string
@@ -400,8 +415,145 @@ Non-nil means always go to the next Octave code line after sending."
   :group 'octave)
 
 \f
+;;; SMIE indentation
+
+(require 'smie)
+
+(defconst octave-operator-table
+  '((assoc ";" "\n") (assoc ",") ; The doc claims they have equal precedence!?
+    (right "=" "+=" "-=" "*=" "/=")
+    (assoc "&&") (assoc "||") ; The doc claims they have equal precedence!?
+    (assoc "&") (assoc "|")   ; The doc claims they have equal precedence!?
+    (nonassoc "<" "<=" "==" ">=" ">" "!=" "~=")
+    (nonassoc ":")                      ;No idea what this is.
+    (assoc "+" "-")
+    (assoc "*" "/" "\\" ".\\" ".*" "./")
+    (nonassoc "'" ".'")
+    (nonassoc "++" "--" "!" "~")        ;And unary "+" and "-".
+    (right "^" "**" ".^" ".**")
+    ;; It's not really an operator, but for indentation purposes it
+    ;; could be convenient to treat it as one.
+    (assoc "...")))
+
+(defconst octave-smie-op-levels
+  (smie-prec2-levels
+   (smie-merge-prec2s
+    (smie-bnf-precedence-table
+     '((atom)
+       ;; We can't distinguish the first element in a sequence with
+       ;; precedence grammars, so we can't distinguish the condition
+       ;; if the `if' from the subsequent body, for example.
+       ;; This has to be done later in the indentation rules.
+       (exp (exp "\n" exp)
+            ;; We need to mention at least one of the operators in this part
+            ;; of the grammar: if the BNF and the operator table have
+            ;; no overlap, SMIE can't know how they relate.
+            (exp ";" exp)
+            ("try" exp "catch" exp "end_try_catch")
+            ("try" exp "catch" exp "end")
+            ("unwind_protect" exp
+             "unwind_protect_cleanup" exp "end_unwind_protect")
+            ("unwind_protect" exp "unwind_protect_cleanup" exp "end")
+            ("for" exp "endfor")
+            ("for" exp "end")
+            ("do" exp "until" atom)
+            ("while" exp "endwhile")
+            ("while" exp "end")
+            ("if" exp "endif")
+            ("if" exp "else" exp "endif")
+            ("if" exp "elseif" exp "else" exp "endif")
+            ("if" exp "elseif" exp "elseif" exp "else" exp "endif")
+            ("if" exp "elseif" exp "elseif" exp "else" exp "end")
+            ("switch" exp "case" exp "endswitch")
+            ("switch" exp "case" exp "otherwise" exp "endswitch")
+            ("switch" exp "case" exp "case" exp "otherwise" exp "endswitch")
+            ("switch" exp "case" exp "case" exp "otherwise" exp "end")
+            ("function" exp "endfunction")
+            ("function" exp "end"))
+       ;; (fundesc (atom "=" atom))
+       )
+     '((assoc "\n" ";")))
+
+    (smie-precs-precedence-table
+     (append octave-operator-table
+             '((nonassoc " -dummy- "))) ;Bogus anchor at the end.
+     ))))
+
+;; Tokenizing needs to be refined so that ";;" is treated as two
+;; tokens and also so as to recognize the \n separator (and
+;; corresponding continuation lines).
+
+(defconst octave-operator-regexp
+  (regexp-opt (apply 'append (mapcar 'cdr octave-operator-table))))
+
+(defun octave-smie-backward-token ()
+  (let ((pos (point)))
+    (forward-comment (- (point)))
+    (cond
+     ((and (not (eq (char-before) ?\;)) ;Coalesce ";" and "\n".
+           (> pos (line-end-position))
+           (if (looking-back octave-continuation-marker-regexp (- (point) 3))
+               (progn
+                 (goto-char (match-beginning 0))
+                 (forward-comment (- (point)))
+                 nil)
+             t)
+           ;; Ignore it if it's within parentheses.
+           (let ((ppss (syntax-ppss)))
+             (not (and (nth 1 ppss)
+                       (eq ?\( (char-after (nth 1 ppss)))))))
+      (skip-chars-forward " \t")
+      ;; Why bother distinguishing \n and ;?
+      ";") ;;"\n"
+     ((and (looking-back octave-operator-regexp (- (point) 3) 'greedy)
+           ;; Don't mistake a string quote for a transpose.
+           (not (looking-back "\\s\"" (1- (point)))))
+      (goto-char (match-beginning 0))
+      (match-string-no-properties 0))
+     (t
+      (smie-default-backward-token)))))
+
+(defun octave-smie-forward-token ()
+  (skip-chars-forward " \t")
+  (when (looking-at (eval-when-compile
+                      (concat "\\(" octave-continuation-marker-regexp
+                              "\\)[ \t]*\\($\\|[%#]\\)")))
+    (goto-char (match-end 1))
+    (forward-comment 1))
+  (cond
+   ((and (looking-at "$\\|[%#]")
+         ;; Ignore it if it's within parentheses.
+         (prog1 (let ((ppss (syntax-ppss)))
+                  (not (and (nth 1 ppss)
+                            (eq ?\( (char-after (nth 1 ppss))))))
+           (forward-comment (point-max))))
+    ;; Why bother distinguishing \n and ;?
+    ";") ;;"\n"
+   ((looking-at ";[ \t]*\\($\\|[%#]\\)")
+    ;; Combine the ; with the subsequent \n.
+    (goto-char (match-beginning 1))
+    (forward-comment 1)
+    ";")
+   ((and (looking-at octave-operator-regexp)
+         ;; Don't mistake a string quote for a transpose.
+         (not (looking-at "\\s\"")))
+    (goto-char (match-end 0))
+    (match-string-no-properties 0))
+   (t
+    (smie-default-forward-token))))
+
+(defconst octave-smie-indent-rules
+  '((";"
+     (:parent ("function" "if" "while" "else" "elseif" "for" "otherwise"
+               "case" "try" "catch" "unwind_protect" "unwind_protect_cleanup")
+      ;; FIXME: don't hardcode 2.
+      (+ parent octave-block-offset))
+     ;; (:parent "switch" 4) ;For (invalid) code between switch and case.
+     0)
+    ((:before . "case") octave-block-offset)))
+
 ;;;###autoload
-(defun octave-mode ()
+(define-derived-mode octave-mode prog-mode "Octave"
   "Major mode for editing Octave code.
 
 This mode makes it easier to write Octave code by helping with
@@ -484,57 +636,60 @@ an Octave mode buffer.
 This automatically sets up a mail buffer with version information
 already added.  You just need to add a description of the problem,
 including a reproducible test case and send the message."
-  (interactive)
-  (kill-all-local-variables)
-
-  (use-local-map octave-mode-map)
-  (setq major-mode 'octave-mode)
-  (setq mode-name "Octave")
   (setq local-abbrev-table octave-abbrev-table)
-  (set-syntax-table octave-mode-syntax-table)
-
-  (make-local-variable 'indent-line-function)
-  (setq indent-line-function 'octave-indent-line)
-
-  (make-local-variable 'comment-start)
-  (setq comment-start octave-comment-start)
-  (make-local-variable 'comment-end)
-  (setq comment-end "")
-  (make-local-variable 'comment-column)
-  (setq comment-column 32)
-  (make-local-variable 'comment-start-skip)
-  (setq comment-start-skip "\\s<+\\s-*")
-  (make-local-variable 'comment-indent-function)
-  (setq comment-indent-function 'octave-comment-indent)
-
-  (make-local-variable 'parse-sexp-ignore-comments)
-  (setq parse-sexp-ignore-comments t)
-  (make-local-variable 'paragraph-start)
-  (setq paragraph-start (concat "\\s-*$\\|" page-delimiter))
-  (make-local-variable 'paragraph-separate)
-  (setq paragraph-separate paragraph-start)
-  (make-local-variable 'paragraph-ignore-fill-prefix)
-  (setq paragraph-ignore-fill-prefix t)
-  (make-local-variable 'fill-paragraph-function)
-  (setq fill-paragraph-function 'octave-fill-paragraph)
-  (make-local-variable 'adaptive-fill-regexp)
-  (setq adaptive-fill-regexp nil)
-  (make-local-variable 'fill-column)
-  (setq fill-column 72)
-  (make-local-variable 'normal-auto-fill-function)
-  (setq normal-auto-fill-function 'octave-auto-fill)
-
-  (make-local-variable 'font-lock-defaults)
-  (setq font-lock-defaults '(octave-font-lock-keywords nil nil))
-
-  (make-local-variable 'imenu-generic-expression)
-  (setq imenu-generic-expression octave-mode-imenu-generic-expression
-        imenu-case-fold-search nil)
-
-  (octave-add-octave-menu)
+
+  (smie-setup octave-smie-op-levels octave-smie-indent-rules)
+  (set (make-local-variable 'smie-indent-basic) 'octave-block-offset)
+  (set (make-local-variable 'smie-backward-token-function)
+       'octave-smie-backward-token)
+  (set (make-local-variable 'smie-forward-token-function)
+       'octave-smie-forward-token)
+  (set (make-local-variable 'forward-sexp-function)
+       'smie-forward-sexp-command)
+  (set (make-local-variable 'smie-closer-alist)
+       (mapcar (lambda (elem) (cons (car elem) (car (last elem))))
+               octave-block-match-alist))
+
+  (set (make-local-variable 'comment-start) octave-comment-start)
+  (set (make-local-variable 'comment-end) "")
+  ;; Don't set it here: it's not really a property of the language,
+  ;; just a personal preference of the author.
+  ;; (set (make-local-variable 'comment-column) 32)
+  (set (make-local-variable 'comment-start-skip) "\\s<+\\s-*")
+  (set (make-local-variable 'comment-add) 1)
+
+  (set (make-local-variable 'parse-sexp-ignore-comments) t)
+  (set (make-local-variable 'paragraph-start)
+       (concat "\\s-*$\\|" page-delimiter))
+  (set (make-local-variable 'paragraph-separate) paragraph-start)
+  (set (make-local-variable 'paragraph-ignore-fill-prefix) t)
+  (set (make-local-variable 'fill-paragraph-function) 'octave-fill-paragraph)
+  ;; FIXME: Why disable it?
+  ;; (set (make-local-variable 'adaptive-fill-regexp) nil)
+  ;; Again, this is not a property of the language, don't set it here.
+  ;; (set (make-local-variable 'fill-column) 72)
+  (set (make-local-variable 'normal-auto-fill-function) 'octave-auto-fill)
+
+  (set (make-local-variable 'font-lock-defaults)
+       '(octave-font-lock-keywords nil nil nil nil
+         (font-lock-syntactic-keywords . octave-font-lock-syntactic-keywords)
+         (parse-sexp-lookup-properties . t)))
+
+  (set (make-local-variable 'imenu-generic-expression)
+       octave-mode-imenu-generic-expression)
+  (set (make-local-variable 'imenu-case-fold-search) nil)
+
+  (add-hook 'completion-at-point-functions
+            'octave-completion-at-point-function nil t)
+  (set (make-local-variable 'beginning-of-defun-function)
+       'octave-beginning-of-defun)
+
+  (easy-menu-add octave-mode-menu)
   (octave-initialize-completions)
   (run-mode-hooks 'octave-mode-hook))
 
+(defvar info-lookup-mode)
+
 (defun octave-help ()
   "Get help on Octave symbols from the Octave info files.
 Look up symbol in the function, operator and variable indices of the info files."
@@ -542,74 +697,31 @@ Look up symbol in the function, operator and variable indices of the info files.
     (call-interactively 'info-lookup-symbol)))
 \f
 ;;; Miscellaneous useful functions
-(defun octave-describe-major-mode ()
-  "Describe the current major mode."
-  (interactive)
-  (describe-function major-mode))
 
 (defsubst octave-in-comment-p ()
   "Return t if point is inside an Octave comment."
-  (interactive)
   (save-excursion
+    ;; FIXME: use syntax-ppss?
     (nth 4 (parse-partial-sexp (line-beginning-position) (point)))))
 
 (defsubst octave-in-string-p ()
   "Return t if point is inside an Octave string."
-  (interactive)
   (save-excursion
+    ;; FIXME: use syntax-ppss?
     (nth 3 (parse-partial-sexp (line-beginning-position) (point)))))
 
 (defsubst octave-not-in-string-or-comment-p ()
   "Return t if point is not inside an Octave string or comment."
+  ;; FIXME: Use syntax-ppss?
   (let ((pps (parse-partial-sexp (line-beginning-position) (point))))
     (not (or (nth 3 pps) (nth 4 pps)))))
 
-(defun octave-in-block-p ()
-  "Return t if point is inside an Octave block.
-The block is taken to start at the first letter of the begin keyword and
-to end after the end keyword."
-  (let ((pos (point)))
-    (save-excursion
-      (condition-case nil
-         (progn
-           (skip-syntax-forward "w")
-           (octave-up-block -1)
-           (octave-forward-block)
-           t)
-       (error nil))
-      (< pos (point)))))
 
 (defun octave-looking-at-kw (regexp)
   "Like `looking-at', but sets `case-fold-search' nil."
   (let ((case-fold-search nil))
     (looking-at regexp)))
 
-(defun octave-re-search-forward-kw (regexp count)
-  "Like `re-search-forward', but sets `case-fold-search' nil, and moves point."
-  (let ((case-fold-search nil))
-    (re-search-forward regexp nil 'move count)))
-
-(defun octave-re-search-backward-kw (regexp count)
-  "Like `re-search-backward', but sets `case-fold-search' nil, and moves point."
-  (let ((case-fold-search nil))
-    (re-search-backward regexp nil 'move count)))
-
-(defun octave-in-defun-p ()
-  "Return t if point is inside an Octave function declaration.
-The function is taken to start at the `f' of `function' and to end after
-the end keyword."
-  (let ((pos (point)))
-    (save-excursion
-      (or (and (octave-looking-at-kw "\\<function\\>")
-              (octave-not-in-string-or-comment-p))
-         (and (octave-beginning-of-defun)
-              (condition-case nil
-                  (progn
-                    (octave-forward-block)
-                    t)
-                (error nil))
-              (< pos (point)))))))
-
 (defun octave-maybe-insert-continuation-string ()
   (if (or (octave-in-comment-p)
          (save-excursion
@@ -619,147 +731,8 @@ the end keyword."
     (delete-horizontal-space)
     (insert (concat " " octave-continuation-string))))
 
-;;; Comments
-(defun octave-comment-region (beg end &optional arg)
-  "Comment or uncomment each line in the region as Octave code.
-See `comment-region'."
-  (interactive "r\nP")
-  (let ((comment-start (char-to-string octave-comment-char)))
-    (comment-region beg end arg)))
-
-(defun octave-uncomment-region (beg end &optional arg)
-  "Uncomment each line in the region as Octave code."
-  (interactive "r\nP")
-  (or arg (setq arg 1))
-  (octave-comment-region beg end (- arg)))
-
 \f
 ;;; Indentation
-(defun calculate-octave-indent ()
-  "Return appropriate indentation for current line as Octave code.
-Returns an integer (the column to indent to) unless the line is a
-comment line with fixed goal golumn.  In that case, returns a list whose
-car is the column to indent to, and whose cdr is the current indentation
-level."
-  (let ((is-continuation-line
-        (save-excursion
-          (if (zerop (octave-previous-code-line))
-              (looking-at octave-continuation-regexp))))
-       (icol 0))
-    (save-excursion
-      (beginning-of-line)
-      ;; If we can move backward out one level of parentheses, take 1
-      ;; plus the indentation of that parenthesis.  Otherwise, go back
-      ;; to the beginning of the previous code line, and compute the
-      ;; offset this line gives.
-      (if (condition-case nil
-             (progn
-               (up-list -1)
-               t)
-           (error nil))
-         (setq icol (+ 1 (current-column)))
-       (if (zerop (octave-previous-code-line))
-           (progn
-             (octave-beginning-of-line)
-             (back-to-indentation)
-             (setq icol (current-column))
-             (let ((bot (point))
-                   (eol (line-end-position)))
-               (while (< (point) eol)
-                 (if (octave-not-in-string-or-comment-p)
-                     (cond
-                      ((octave-looking-at-kw "\\<switch\\>")
-                       (setq icol (+ icol (* 2 octave-block-offset))))
-                      ((octave-looking-at-kw octave-block-begin-regexp)
-                       (setq icol (+ icol octave-block-offset)))
-                      ((octave-looking-at-kw octave-block-else-regexp)
-                       (if (= bot (point))
-                           (setq icol (+ icol octave-block-offset))))
-                      ((octave-looking-at-kw octave-block-end-regexp)
-                       (if (and (not (= bot (point)))
-                                ;; special case for `end' keyword,
-                                ;; applied to all keywords
-                                (not (octave-end-as-array-index-p)))
-                           (setq icol (- icol
-                                         (octave-block-end-offset)))))))
-                 (forward-char)))
-             (if is-continuation-line
-                 (setq icol (+ icol octave-continuation-offset)))))))
-    (save-excursion
-      (back-to-indentation)
-      (cond
-       ((and (octave-looking-at-kw octave-block-else-regexp)
-            (octave-not-in-string-or-comment-p))
-       (setq icol (- icol octave-block-offset)))
-       ((and (octave-looking-at-kw octave-block-end-regexp)
-            (octave-not-in-string-or-comment-p))
-       (setq icol (- icol (octave-block-end-offset))))
-       ((or (looking-at "\\s<\\s<\\s<\\S<")
-           (octave-before-magic-comment-p))
-       (setq icol (list 0 icol)))
-       ((looking-at "\\s<\\S<")
-       (setq icol (list comment-column icol)))))
-    icol))
-
-;; FIXME: this should probably also make sure we are actually looking
-;; at the "end" keyword.
-(defun octave-end-as-array-index-p ()
-  (save-excursion
-    (condition-case nil
-       ;; Check if point is between parens
-       (progn (up-list 1) t)
-      (error nil))))
-
-(defun octave-block-end-offset ()
-  (save-excursion
-    (octave-backward-up-block 1)
-    (* octave-block-offset
-       (if (string-match (match-string 0) "switch") 2 1))))
-
-(defun octave-before-magic-comment-p ()
-  (save-excursion
-    (beginning-of-line)
-    (and (bobp) (looking-at "\\s-*#!"))))
-
-(defun octave-comment-indent ()
-  (if (or (looking-at "\\s<\\s<\\s<")
-         (octave-before-magic-comment-p))
-      0
-    (if (looking-at "\\s<\\s<")
-       (calculate-octave-indent)
-      (skip-syntax-backward " ")
-      (max (if (bolp) 0 (+ 1 (current-column)))
-          comment-column))))
-
-(defun octave-indent-for-comment ()
-  "Maybe insert and indent an Octave comment.
-If there is no comment already on this line, create a code-level comment
-\(started by two comment characters) if the line is empty, or an in-line
-comment (started by one comment character) otherwise.
-Point is left after the start of the comment which is properly aligned."
-  (interactive)
-  (beginning-of-line)
-  (if (looking-at "^\\s-*$")
-      (insert octave-block-comment-start)
-    (indent-for-comment))
-  (indent-according-to-mode))
-
-(defun octave-indent-line (&optional arg)
-  "Indent current line as Octave code.
-With optional ARG, use this as offset unless this line is a comment with
-fixed goal column."
-  (interactive)
-  (or arg (setq arg 0))
-  (let ((icol (calculate-octave-indent))
-       (relpos (- (current-column) (current-indentation))))
-    (if (listp icol)
-       (setq icol (car icol))
-      (setq icol (+ icol arg)))
-    (if (< icol 0)
-       (error "Unmatched end keyword")
-      (indent-line-to icol)
-      (if (> relpos 0)
-         (move-to-column (+ icol relpos))))))
 
 (defun octave-indent-new-comment-line ()
   "Break Octave line at point, continuing comment if within one.
@@ -781,7 +754,7 @@ The new line is properly indented."
   "Properly indent the Octave function which contains point."
   (interactive)
   (save-excursion
-    (octave-mark-defun)
+    (mark-defun)
     (message "Indenting function...")
     (indent-region (point) (mark) nil))
   (message "Indenting function...done."))
@@ -861,129 +834,17 @@ does not end in `...' or `\\' or is inside an open parenthesis list."
                    (zerop (forward-line 1)))))
     (end-of-line)))
 
-(defun octave-scan-blocks (count depth)
-  "Scan from point by COUNT Octave begin-end blocks.
-Returns the character number of the position thus found.
-
-If DEPTH is nonzero, block depth begins counting from that value.
-Only places where the depth in blocks becomes zero are candidates for
-stopping; COUNT such places are counted.
-
-If the beginning or end of the buffer is reached and the depth is wrong,
-an error is signaled."
-  (let ((min-depth (if (> depth 0) 0 depth))
-       (inc (if (> count 0) 1 -1)))
-    (save-excursion
-      (while (/= count 0)
-       (catch 'foo
-         (while (or (octave-re-search-forward-kw
-                     octave-block-begin-or-end-regexp inc)
-                    (if (/= depth 0)
-                        (error "Unbalanced block")))
-           (if (octave-not-in-string-or-comment-p)
-               (progn
-                 (cond
-                  ((match-end 1)
-                   (setq depth (+ depth inc)))
-                  ((match-end 2)
-                   (setq depth (- depth inc))))
-                 (if (< depth min-depth)
-                     (error "Containing expression ends prematurely"))
-                 (if (= depth 0)
-                     (throw 'foo nil))))))
-       (setq count (- count inc)))
-      (point))))
-
-(defun octave-forward-block (&optional arg)
-  "Move forward across one balanced Octave begin-end block.
-With argument, do it that many times.
-Negative arg -N means move backward across N blocks."
-  (interactive "p")
-  (or arg (setq arg 1))
-  (goto-char (or (octave-scan-blocks arg 0) (buffer-end arg))))
-
-(defun octave-backward-block (&optional arg)
-  "Move backward across one balanced Octave begin-end block.
-With argument, do it that many times.
-Negative arg -N means move forward across N blocks."
-  (interactive "p")
-  (or arg (setq arg 1))
-  (octave-forward-block (- arg)))
-
-(defun octave-down-block (arg)
-  "Move forward down one begin-end block level of Octave code.
-With argument, do this that many times.
-A negative argument means move backward but still go down a level.
-In Lisp programs, an argument is required."
-  (interactive "p")
-  (let ((inc (if (> arg 0) 1 -1)))
-    (while (/= arg 0)
-      (goto-char (or (octave-scan-blocks inc -1)
-                    (buffer-end arg)))
-      (setq arg (- arg inc)))))
-
-(defun octave-backward-up-block (arg)
-  "Move backward out of one begin-end block level of Octave code.
-With argument, do this that many times.
-A negative argument means move forward but still to a less deep spot.
-In Lisp programs, an argument is required."
-  (interactive "p")
-  (octave-up-block (- arg)))
-
-(defun octave-up-block (arg)
-  "Move forward out of one begin-end block level of Octave code.
-With argument, do this that many times.
-A negative argument means move backward but still to a less deep spot.
-In Lisp programs, an argument is required."
-  (interactive "p")
-  (let ((inc (if (> arg 0) 1 -1)))
-    (while (/= arg 0)
-      (goto-char (or (octave-scan-blocks inc 1)
-                    (buffer-end arg)))
-      (setq arg (- arg inc)))))
-
 (defun octave-mark-block ()
   "Put point at the beginning of this Octave block, mark at the end.
 The block marked is the one that contains point or follows point."
   (interactive)
-  (let ((pos (point)))
-    (if (or (and (octave-in-block-p)
-                (skip-syntax-forward "w"))
-           (condition-case nil
-               (progn
-                 (octave-down-block 1)
-                 (octave-in-block-p))
-             (error nil)))
-       (progn
-         (octave-up-block -1)
-         (push-mark (point))
-         (octave-forward-block)
-         (exchange-point-and-mark))
-      (goto-char pos)
-      (message "No block to mark found"))))
-
-(defun octave-close-block ()
-  "Close the current Octave block on a separate line.
-An error is signaled if no block to close is found."
-  (interactive)
-  (let (bb-keyword)
-    (condition-case nil
-       (progn
-         (save-excursion
-           (octave-backward-up-block 1)
-           (setq bb-keyword (buffer-substring-no-properties
-                             (match-beginning 1) (match-end 1))))
-         (if (save-excursion
-               (beginning-of-line)
-               (looking-at "^\\s-*$"))
-             (indent-according-to-mode)
-           (octave-reindent-then-newline-and-indent))
-         (insert (car (reverse
-                       (assoc bb-keyword
-                              octave-block-match-alist))))
-         (octave-reindent-then-newline-and-indent)
-         t)
-      (error (message "No block to close found")))))
+  (unless (or (looking-at "\\s(")
+              (save-excursion
+                (let* ((token (funcall smie-forward-token-function))
+                       (level (assoc token smie-op-levels)))
+                  (and level (null (cadr level))))))
+    (backward-up-list 1))
+  (mark-sexp))
 
 (defun octave-blink-matching-block-open ()
   "Blink the matching Octave begin block keyword.
@@ -1003,12 +864,12 @@ Signal an error if the keywords are incompatible."
            (setq eb-keyword
                  (buffer-substring-no-properties
                   (match-beginning 1) (match-end 1)))
-           (octave-backward-up-block 1))
+           (backward-up-list 1))
           ((match-end 2)
            (setq eb-keyword
                  (buffer-substring-no-properties
                   (match-beginning 2) (match-end 2)))
-           (octave-backward-block)))
+           (backward-sexp 1)))
          (setq pos (match-end 0)
                bb-keyword
                (buffer-substring-no-properties
@@ -1038,16 +899,16 @@ Signal an error if the keywords are incompatible."
 With positive ARG, do it that many times.  Negative argument -N means
 move forward to Nth following beginning of a function.
 Returns t unless search stops at the beginning or end of the buffer."
-  (interactive "p")
   (let* ((arg (or arg 1))
         (inc (if (> arg 0) 1 -1))
-        (found))
+        (found nil)
+         (case-fold-search nil))
     (and (not (eobp))
-        (not (and (> arg 0) (octave-looking-at-kw "\\<function\\>")))
+        (not (and (> arg 0) (looking-at "\\<function\\>")))
         (skip-syntax-forward "w"))
     (while (and (/= arg 0)
                (setq found
-                     (octave-re-search-backward-kw "\\<function\\>" inc)))
+                     (re-search-backward "\\<function\\>" inc)))
       (if (octave-not-in-string-or-comment-p)
          (setq arg (- arg inc))))
     (if found
@@ -1055,40 +916,6 @@ Returns t unless search stops at the beginning or end of the buffer."
          (and (< inc 0) (goto-char (match-beginning 0)))
          t))))
 
-(defun octave-end-of-defun (&optional arg)
-  "Move forward to the end of an Octave function.
-With positive ARG, do it that many times.  Negative argument -N means
-move back to Nth preceding end of a function.
-
-An end of a function occurs right after the end keyword matching the
-`function' keyword that starts the function."
-  (interactive "p")
-  (or arg (setq arg 1))
-  (and (< arg 0) (skip-syntax-backward "w"))
-  (and (> arg 0) (skip-syntax-forward "w"))
-  (if (octave-in-defun-p)
-      (setq arg (- arg 1)))
-  (if (= arg 0) (setq arg -1))
-  (if (octave-beginning-of-defun (- arg))
-      (octave-forward-block)))
-
-(defun octave-mark-defun ()
-  "Put point at the beginning of this Octave function, mark at its end.
-The function marked is the one containing point or following point."
-  (interactive)
-  (let ((pos (point)))
-    (if (or (octave-in-defun-p)
-           (and (octave-beginning-of-defun -1)
-                (octave-in-defun-p)))
-       (progn
-         (skip-syntax-forward "w")
-         (octave-beginning-of-defun)
-         (push-mark (point))
-         (octave-end-of-defun)
-         (exchange-point-and-mark))
-      (goto-char pos)
-      (message "No function to mark found"))))
-
 \f
 ;;; Filling
 (defun octave-auto-fill ()
@@ -1153,81 +980,73 @@ otherwise."
       (not give-up))))
 
 (defun octave-fill-paragraph (&optional arg)
- "Fill paragraph of Octave code, handling Octave comments."
- ;; FIXME: now that the default fill-paragraph takes care of similar issues,
- ;; this seems obsolete.  --Stef
- (interactive "P")
- (save-excursion
-   (let ((end (progn (forward-paragraph) (point)))
-        (beg (progn
-               (forward-paragraph -1)
-               (skip-chars-forward " \t\n")
-               (beginning-of-line)
-               (point)))
-        (cfc (current-fill-column))
-        (ind (calculate-octave-indent))
-        comment-prefix)
-     (save-restriction
-       (goto-char beg)
-       (narrow-to-region beg end)
-       (if (listp ind) (setq ind (nth 1 ind)))
-       (while (not (eobp))
-        (condition-case nil
-            (octave-indent-line ind)
-          (error nil))
-        (if (and (> ind 0)
-                 (not
-                  (save-excursion
-                    (beginning-of-line)
-                    (looking-at "^\\s-*\\($\\|\\s<+\\)"))))
-            (setq ind 0))
-        (move-to-column cfc)
-        ;; First check whether we need to combine non-empty comment lines
-        (if (and (< (current-column) cfc)
-                 (octave-in-comment-p)
-                 (not (save-excursion
-                        (beginning-of-line)
-                        (looking-at "^\\s-*\\s<+\\s-*$"))))
-            ;; This is a nonempty comment line which does not extend
-            ;; past the fill column.  If it is followed by a nonempty
-            ;; comment line with the same comment prefix, try to
-            ;; combine them, and repeat this until either we reach the
-            ;; fill-column or there is nothing more to combine.
-            (progn
-              ;; Get the comment prefix
-              (save-excursion
-                (beginning-of-line)
-                (while (and (re-search-forward "\\s<+")
-                            (not (octave-in-comment-p))))
-                (setq comment-prefix (match-string 0)))
-              ;; And keep combining ...
-              (while (and (< (current-column) cfc)
-                          (save-excursion
-                            (forward-line 1)
-                            (and (looking-at
-                                  (concat "^\\s-*"
-                                          comment-prefix
-                                          "\\S<"))
-                                 (not (looking-at
-                                       (concat "^\\s-*"
-                                               comment-prefix
-                                               "\\s-*$"))))))
-                (delete-char 1)
-                (re-search-forward comment-prefix)
-                (delete-region (match-beginning 0) (match-end 0))
-                (fixup-whitespace)
-                (move-to-column cfc))))
-        ;; We might also try to combine continued code lines>  Perhaps
-        ;; some other time ...
-        (skip-chars-forward "^ \t\n")
-        (delete-horizontal-space)
-        (if (or (< (current-column) cfc)
-                (and (= (current-column) cfc) (eolp)))
-            (forward-line 1)
-          (if (not (eolp)) (insert " "))
-          (or (octave-auto-fill)
-              (forward-line 1)))))
-     t)))
+  "Fill paragraph of Octave code, handling Octave comments."
+  ;; FIXME: difference with generic fill-paragraph:
+  ;; - code lines are only split, never joined.
+  ;; - \n that end comments are never removed.
+  ;; - insert continuation marker when splitting code lines.
+  (interactive "P")
+  (save-excursion
+    (let ((end (progn (forward-paragraph) (copy-marker (point) t)))
+          (beg (progn
+                 (forward-paragraph -1)
+                 (skip-chars-forward " \t\n")
+                 (beginning-of-line)
+                 (point)))
+          (cfc (current-fill-column))
+          comment-prefix)
+      (goto-char beg)
+      (while (< (point) end)
+        (condition-case nil
+            (indent-according-to-mode)
+          (error nil))
+        (move-to-column cfc)
+        ;; First check whether we need to combine non-empty comment lines
+        (if (and (< (current-column) cfc)
+                 (octave-in-comment-p)
+                 (not (save-excursion
+                        (beginning-of-line)
+                        (looking-at "^\\s-*\\s<+\\s-*$"))))
+            ;; This is a nonempty comment line which does not extend
+            ;; past the fill column.  If it is followed by a nonempty
+            ;; comment line with the same comment prefix, try to
+            ;; combine them, and repeat this until either we reach the
+            ;; fill-column or there is nothing more to combine.
+            (progn
+              ;; Get the comment prefix
+              (save-excursion
+                (beginning-of-line)
+                (while (and (re-search-forward "\\s<+")
+                            (not (octave-in-comment-p))))
+                (setq comment-prefix (match-string 0)))
+              ;; And keep combining ...
+              (while (and (< (current-column) cfc)
+                          (save-excursion
+                            (forward-line 1)
+                            (and (looking-at
+                                  (concat "^\\s-*"
+                                          comment-prefix
+                                          "\\S<"))
+                                 (not (looking-at
+                                       (concat "^\\s-*"
+                                               comment-prefix
+                                               "\\s-*$"))))))
+                (delete-char 1)
+                (re-search-forward comment-prefix)
+                (delete-region (match-beginning 0) (match-end 0))
+                (fixup-whitespace)
+                (move-to-column cfc))))
+        ;; We might also try to combine continued code lines>  Perhaps
+        ;; some other time ...
+        (skip-chars-forward "^ \t\n")
+        (delete-horizontal-space)
+        (if (or (< (current-column) cfc)
+                (and (= (current-column) cfc) (eolp)))
+            (forward-line 1)
+          (if (not (eolp)) (insert " "))
+          (or (octave-auto-fill)
+              (forward-line 1))))
+      t)))
 
 \f
 ;;; Completions
@@ -1236,34 +1055,37 @@ otherwise."
   (if octave-completion-alist
       ()
     (setq octave-completion-alist
-         (mapcar '(lambda (var) (cons var var))
-                 (append octave-reserved-words
-                         octave-text-functions
-                         octave-variables)))))
+          (append octave-reserved-words
+                  octave-text-functions
+                  octave-variables))))
+
+(defun octave-completion-at-point-function ()
+  "Find the text to complete and the corresponding table."
+  (let* ((beg (save-excursion (backward-sexp 1) (point)))
+         (end (point)))
+    (if (< beg (point))
+        ;; Extend region past point, if applicable.
+        (save-excursion (goto-char beg) (forward-sexp 1)
+                        (setq end (max end (point)))))
+    (list beg end octave-completion-alist)))
 
 (defun octave-complete-symbol ()
   "Perform completion on Octave symbol preceding point.
 Compare that symbol against Octave's reserved words and builtin
 variables."
   (interactive)
-  (let* ((end (point))
-        (beg (save-excursion (backward-sexp 1) (point))))
-    (completion-in-region beg end octave-completion-alist)))
-
+  (apply 'completion-in-region (octave-completion-at-point-function)))
 \f
 ;;; Electric characters && friends
 (defun octave-reindent-then-newline-and-indent ()
   "Reindent current Octave line, insert newline, and indent the new line.
 If Abbrev mode is on, expand abbrevs first."
+  ;; FIXME: None of this is Octave-specific.
   (interactive)
   (if abbrev-mode (expand-abbrev))
   (if octave-blink-matching-block
       (octave-blink-matching-block-open))
-  (save-excursion
-    (delete-region (point) (progn (skip-chars-backward " \t") (point)))
-    (indent-according-to-mode))
-  (insert "\n")
-  (indent-according-to-mode))
+  (reindent-then-newline-and-indent))
 
 (defun octave-electric-semi ()
   "Insert a semicolon in Octave mode.
@@ -1323,51 +1145,27 @@ Note that all Octave mode abbrevs start with a grave accent."
            (list-abbrevs))
        (setq unread-command-events (list c))))))
 
-(defun octave-insert-defun (name args vals)
+(define-skeleton octave-insert-defun
   "Insert an Octave function skeleton.
 Prompt for the function's name, arguments and return values (to be
 entered without parens)."
-  (interactive
-   (list
-    (read-from-minibuffer "Function name: "
-                         (substring (buffer-name) 0 -2))
-    (read-from-minibuffer "Arguments: ")
-    (read-from-minibuffer "Return values: ")))
-  (let ((string (format "%s %s (%s)"
-                       (cond
-                        ((string-equal vals "")
-                         vals)
-                        ((string-match "[ ,]" vals)
-                         (concat " [" vals "] ="))
-                        (t
-                         (concat " " vals " =")))
-                       name
-                       args))
-       (prefix octave-block-comment-start))
-    (if (not (bobp)) (newline))
-    (insert "function" string)
-    (indent-according-to-mode)
-    (newline 2)
-    (insert prefix "usage: " string)
-    (reindent-then-newline-and-indent)
-    (insert prefix)
-    (reindent-then-newline-and-indent)
-    (insert prefix)
-    (indent-according-to-mode)
-    (save-excursion
-      (newline 2)
-      (insert "endfunction")
-      (indent-according-to-mode))))
-
-\f
-;;; Menu
-(defun octave-add-octave-menu ()
-  "Add the `Octave' menu to the menu bar in Octave mode."
-  (require 'easymenu)
-  (easy-menu-define octave-mode-menu-map octave-mode-map
-                   "Menu keymap for Octave mode." octave-mode-menu)
-  (easy-menu-add octave-mode-menu-map octave-mode-map))
-
+  (let* ((defname (substring (buffer-name) 0 -2))
+         (name (read-string (format "Function name (default %s): " defname)
+                            nil nil defname))
+         (args (read-string "Arguments: "))
+         (vals (read-string "Return values: ")))
+    (format "%s%s (%s)"
+            (cond
+             ((string-equal vals "") vals)
+             ((string-match "[ ,]" vals) (concat "[" vals "] = "))
+             (t (concat vals " = ")))
+            name
+            args))
+  \n "function " > str \n \n
+  octave-block-comment-start "usage: " str \n
+  octave-block-comment-start \n octave-block-comment-start
+  \n _ \n
+  "endfunction" > \n)
 \f
 ;;; Communication with the inferior Octave process
 (defun octave-kill-process ()
@@ -1434,7 +1232,7 @@ entered without parens)."
   "Send current Octave function to the inferior Octave process."
   (interactive)
   (save-excursion
-    (octave-mark-defun)
+    (mark-defun)
     (octave-send-region (point) (mark))))
 
 (defun octave-send-line (&optional arg)
index 197b41506bd1718adf22efa9741d914f4828de0c..77e334ca8d861493f77450c257120ec6944f7169 100644 (file)
@@ -31,6 +31,7 @@
 
 (defvar comint-prompt-regexp)
 (defvar comint-process-echoes)
+(require 'smie)
 
 (defgroup prolog nil
   "Major mode for editing and running Prolog under Emacs."
@@ -98,6 +99,61 @@ When nil, send actual operating system end of file."
 (defvar prolog-mode-abbrev-table nil)
 (define-abbrev-table 'prolog-mode-abbrev-table ())
 
+(defconst prolog-smie-op-levels
+  ;; Rather than construct the operator levels table from the BNF,
+  ;; we directly provide the operator precedences from GNU Prolog's
+  ;; manual.  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)
+    )
+  "Precedence levels of infix operators.")
+
+(defconst prolog-smie-indent-rules
+  '((":-")
+    ("->"))
+  "Prolog indentation rules.")
+
 (defun prolog-mode-variables ()
   (make-local-variable 'paragraph-separate)
   (setq paragraph-separate (concat "%%\\|$\\|" page-delimiter)) ;'%%..'
@@ -105,8 +161,10 @@ When nil, send actual operating system end of file."
   (setq paragraph-ignore-fill-prefix t)
   (make-local-variable 'imenu-generic-expression)
   (setq imenu-generic-expression '((nil "^\\sw+" 0)))
-  (make-local-variable 'indent-line-function)
-  (setq indent-line-function 'prolog-indent-line)
+  (smie-setup prolog-smie-op-levels prolog-smie-indent-rules)
+  (set (make-local-variable 'forward-sexp-function)
+       'smie-forward-sexp-command)
+  (set (make-local-variable 'smie-indent-basic) prolog-indent-width)
   (make-local-variable 'comment-start)
   (setq comment-start "%")
   (make-local-variable 'comment-start-skip)
@@ -122,7 +180,7 @@ When nil, send actual operating system end of file."
     (define-key map "\C-c\C-l" 'inferior-prolog-load-file)
     (define-key map "\C-c\C-z" 'switch-to-prolog)
     map))
+
 (easy-menu-define prolog-mode-menu prolog-mode-map "Menu for Prolog mode."
   ;; Mostly copied from scheme-mode's menu.
   ;; Not tremendously useful, but it's a start.
@@ -136,85 +194,18 @@ When nil, send actual operating system end of file."
     ))
 
 ;;;###autoload
-(defun prolog-mode ()
+(define-derived-mode prolog-mode prog-mode "Prolog"
   "Major mode for editing Prolog code for Prologs.
 Blank lines and `%%...' separate paragraphs.  `%'s start comments.
 Commands:
 \\{prolog-mode-map}
 Entry to this mode calls the value of `prolog-mode-hook'
 if that value is non-nil."
-  (interactive)
-  (kill-all-local-variables)
-  (use-local-map prolog-mode-map)
-  (set-syntax-table prolog-mode-syntax-table)
-  (setq major-mode 'prolog-mode)
-  (setq mode-name "Prolog")
   (prolog-mode-variables)
   (set (make-local-variable 'comment-add) 1)
-  ;; font lock
   (setq font-lock-defaults '(prolog-font-lock-keywords
                              nil nil nil
-                             beginning-of-line))
-  (run-mode-hooks 'prolog-mode-hook))
-
-(defun prolog-indent-line ()
-  "Indent current line as Prolog code.
-With argument, indent any additional lines of the same clause
-rigidly along with this one (not yet)."
-  (interactive "p")
-  (let ((indent (prolog-indent-level))
-       (pos (- (point-max) (point))))
-    (beginning-of-line)
-    (indent-line-to indent)
-    (if (> (- (point-max) pos) (point))
-       (goto-char (- (point-max) pos)))))
-
-(defun prolog-indent-level ()
-  "Compute Prolog indentation level."
-  (save-excursion
-    (beginning-of-line)
-    (skip-chars-forward " \t")
-    (cond
-     ((looking-at "%%%") 0)            ;Large comment starts
-     ((looking-at "%[^%]") comment-column) ;Small comment starts
-     ((bobp) 0)                                ;Beginning of buffer
-     (t
-      (let ((empty t) ind more less)
-       (if (looking-at ")")
-           (setq less t)               ;Find close
-         (setq less nil))
-       ;; See previous indentation
-       (while empty
-         (forward-line -1)
-         (beginning-of-line)
-         (if (bobp)
-             (setq empty nil)
-           (skip-chars-forward " \t")
-           (if (not (or (looking-at "%[^%]") (looking-at "\n")))
-               (setq empty nil))))
-       (if (bobp)
-           (setq ind 0)                ;Beginning of buffer
-         (setq ind (current-column)))  ;Beginning of clause
-       ;; See its beginning
-       (if (looking-at "%%[^%]")
-           ind
-         ;; Real prolog code
-         (if (looking-at "(")
-             (setq more t)             ;Find open
-           (setq more nil))
-         ;; See its tail
-         (end-of-prolog-clause)
-         (or (bobp) (forward-char -1))
-         (cond ((looking-at "[,(;>]")
-                (if (and more (looking-at "[^,]"))
-                    (+ ind prolog-indent-width) ;More indentation
-                  (max tab-width ind))) ;Same indentation
-               ((looking-at "-") tab-width) ;TAB
-               ((or less (looking-at "[^.]"))
-                (max (- ind prolog-indent-width) 0)) ;Less indentation
-               (t 0))                  ;No indentation
-         )))
-     )))
+                             beginning-of-line)))
 
 (defun end-of-prolog-clause ()
   "Go to end of clause in this line."
index 93a559258fad2766e322bb9a72582e03a3de07ab..9b83f77d3b8e7e15ec5dde9f0c25d387af423e26 100644 (file)
@@ -6,7 +6,7 @@
 ;; Author:     Peter Kleiweg <p.c.j.kleiweg@rug.nl>
 ;; Maintainer: Peter Kleiweg <p.c.j.kleiweg@rug.nl>
 ;; Created:    20 Aug 1997
-;; Version:    1.1h, 16 Jun 2005
+;; Version:    1.1h
 ;; Keywords:   PostScript, languages
 
 ;; Yoni Rabkin <yoni@rabkins.net> contacted the maintainer of this
@@ -39,6 +39,7 @@
 (defconst ps-mode-version "1.1h, 16 Jun 2005")
 (defconst ps-mode-maintainer-address "Peter Kleiweg <p.c.j.kleiweg@rug.nl>")
 
+(require 'comint)
 (require 'easymenu)
 
 ;; Define core `PostScript' group.
@@ -431,12 +432,11 @@ If nil, use `temporary-file-directory'."
 
 (unless ps-run-mode-map
   (setq ps-run-mode-map (make-sparse-keymap))
+  (set-keymap-parent ps-run-mode-map comint-mode-map)
   (define-key ps-run-mode-map "\C-c\C-q" 'ps-run-quit)
   (define-key ps-run-mode-map "\C-c\C-k" 'ps-run-kill)
   (define-key ps-run-mode-map "\C-c\C-e" 'ps-run-goto-error)
-  (define-key ps-run-mode-map [mouse-2] 'ps-run-mouse-goto-error)
-  (define-key ps-run-mode-map "\r" 'ps-run-newline)
-  (define-key ps-run-mode-map [return] 'ps-run-newline))
+  (define-key ps-run-mode-map [mouse-2] 'ps-run-mouse-goto-error))
 
 \f
 ;; Syntax table.
@@ -681,7 +681,7 @@ defines the beginning of a group. These tokens are:  {  [  <<"
     (if (or (not ps-mode-auto-indent)
            (< ps-mode-tab 1)
            (not (re-search-backward "^[ \t]+\\=" nil t)))
-       (delete-backward-char 1)
+       (call-interactively 'delete-backward-char)
       (setq target (ps-mode-target-column))
       (while (> column target)
        (setq target (+ target ps-mode-tab)))
@@ -718,12 +718,9 @@ defines the beginning of a group. These tokens are:  {  [  <<"
   (blink-matching-open))
 
 (defun ps-mode-other-newline ()
-  "Perform newline in `*ps run*' buffer."
+  "Perform newline in `*ps-run*' buffer."
   (interactive)
-  (let ((buf (current-buffer)))
-    (set-buffer "*ps run*")
-    (ps-run-newline)
-    (set-buffer buf)))
+  (ps-run-send-string ""))
 
 \f
 ;; Print PostScript.
@@ -980,7 +977,7 @@ plus the usually uncoded characters inserted on positions 1 through 28."
 \f
 ;; Interactive PostScript interpreter.
 
-(define-derived-mode ps-run-mode fundamental-mode "Interactive PS"
+(define-derived-mode ps-run-mode comint-mode "Interactive PS"
   "Major mode in interactive PostScript window.
 This mode is invoked from `ps-mode' and should not be called directly.
 
@@ -1014,20 +1011,23 @@ This mode is invoked from `ps-mode' and should not be called directly.
       (setq init-file (ps-run-make-tmp-filename))
       (write-region (concat ps-run-init "\n") 0 init-file)
       (setq init-file (list init-file)))
-    (pop-to-buffer "*ps run*")
+    (pop-to-buffer "*ps-run*")
     (ps-run-mode)
     (when (process-status "ps-run")
       (delete-process "ps-run"))
     (erase-buffer)
     (setq command (append command init-file))
     (insert (mapconcat 'identity command " ") "\n")
-    (apply 'start-process "ps-run" "*ps run*" command)
+    (apply 'make-comint "ps-run" (car command) nil (cdr command))
+    (with-current-buffer "*ps-run*"
+      (use-local-map ps-run-mode-map)
+      (setq comint-prompt-regexp ps-run-prompt))
     (select-window oldwin)))
 
 (defun ps-run-quit ()
   "Quit interactive PostScript."
   (interactive)
-  (ps-run-send-string "quit" t)
+  (ps-run-send-string "quit")
   (ps-run-cleanup))
 
 (defun ps-run-kill ()
@@ -1039,9 +1039,9 @@ This mode is invoked from `ps-mode' and should not be called directly.
 (defun ps-run-clear ()
   "Clear/reset PostScript graphics."
   (interactive)
-  (ps-run-send-string "showpage" t)
+  (ps-run-send-string "showpage")
   (sit-for 1)
-  (ps-run-send-string "" t))
+  (ps-run-send-string ""))
 
 (defun ps-run-buffer ()
   "Send buffer to PostScript interpreter."
@@ -1056,7 +1056,7 @@ This mode is invoked from `ps-mode' and should not be called directly.
   (let ((f (ps-run-make-tmp-filename)))
     (set-marker ps-run-mark begin)
     (write-region begin end f)
-    (ps-run-send-string (format "(%s) run" f) t)))
+    (ps-run-send-string (format "(%s) run" f))))
 
 (defun ps-run-boundingbox ()
   "View BoundingBox."
@@ -1104,17 +1104,15 @@ grestore
 " x1 y1 x2 y1 x2 y2 x1 y2)
      0
      f)
-    (ps-run-send-string (format "(%s) run" f) t)
+    (ps-run-send-string (format "(%s) run" f))
     (set-buffer buf)))
 
-(defun ps-run-send-string (string &optional echo)
+(defun ps-run-send-string (string)
   (let ((oldwin (selected-window)))
-    (pop-to-buffer "*ps run*")
-    (goto-char (point-max))
-    (when echo
-      (insert string "\n"))
-    (set-marker (process-mark (get-process "ps-run")) (point))
-    (process-send-string "ps-run" (concat string "\n"))
+    (pop-to-buffer "*ps-run*")
+    (comint-goto-process-mark)
+    (insert string)
+    (comint-send-input)
     (select-window oldwin)))
 
 (defun ps-run-make-tmp-filename ()
@@ -1140,18 +1138,6 @@ grestore
   (mouse-set-point event)
   (ps-run-goto-error))
 
-(defun ps-run-newline ()
-  "Process newline in PostScript interpreter window."
-  (interactive)
-  (end-of-line)
-  (insert "\n")
-  (forward-line -1)
-  (when (looking-at ps-run-prompt)
-    (goto-char (match-end 0)))
-  (looking-at ".*")
-  (goto-char (1+ (match-end 0)))
-  (ps-run-send-string (buffer-substring (match-beginning 0) (match-end 0))))
-
 (defun ps-run-goto-error ()
   "Jump to buffer position read as integer at point.
 Use line numbers if `ps-run-error-line-numbers' is not nil"
index ed2a3236be10280143963f513d4f2f60ebeb2916..2f65ffa1e17ed9d441c7780d7178dec4887062ec 100644 (file)
@@ -579,6 +579,33 @@ having to restart the program."
   "Queue of Python temp files awaiting execution.
 Currently-active file is at the head of the list.")
 
+(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")
+
 (defvar python-pdbtrack-is-tracking-p nil)
 
 (defconst python-pdbtrack-stack-entry-regexp
@@ -1311,13 +1338,9 @@ See `python-check-command' for the default."
 \f
 ;;;; Inferior mode stuff (following cmuscheme).
 
-;; Fixme: Make sure we can work with IPython.
-
 (defcustom python-python-command "python"
   "Shell command to run Python interpreter.
-Any arguments can't contain whitespace.
-Note that IPython may not work properly; it must at least be used
-with the `-cl' flag, i.e. use `ipython -cl'."
+Any arguments can't contain whitespace."
   :group 'python
   :type 'string)
 
@@ -1395,6 +1418,23 @@ local value.")
 ;; 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?
@@ -1417,14 +1457,12 @@ For running multiple processes in multiple buffers, see `run-python' and
 
 \\{inferior-python-mode-map}"
   :group 'python
+  (require 'ansi-color) ; for ipython
   (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)
-  ;; Still required by `comint-redirect-send-command', for instance
-  ;; (and we need to match things like `>>> ... >>> '):
-  (set (make-local-variable 'comint-prompt-regexp)
-       (rx line-start (1+ (and (or (repeat 3 (any ">.")) "(Pdb)") " "))))
+  (python--set-prompt-regexp)
   (set (make-local-variable 'compilation-error-regexp-alist)
        python-compilation-regexp-alist)
   (compilation-shell-minor-mode 1))
@@ -1521,12 +1559,12 @@ Don't save anything for STR matching `inferior-python-filter-regexp'."
                                     cmd)))
     (unless (shell-command-to-string cmd)
       (error "Can't run Python command `%s'" cmd))
-    (let* ((res (shell-command-to-string (concat cmd " --version"))))
-      (string-match "Python \\([0-9]\\)\\.\\([0-9]\\)" res)
-      (unless (and (equal "2" (match-string 1 res))
-                  (match-beginning 2)
-                  (>= (string-to-number (match-string 2 res)) 2))
-       (error "Only Python versions >= 2.2 and < 3.0 supported")))
+    (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
@@ -1549,6 +1587,7 @@ buffer for a list of commands.)"
   (interactive (if current-prefix-arg
                   (list (read-string "Run Python: " python-command) nil t)
                 (list python-command)))
+  (require 'ansi-color) ; for ipython
   (unless cmd (setq cmd python-command))
   (python-check-version cmd)
   (setq python-command cmd)
@@ -1566,8 +1605,10 @@ buffer for a list of commands.)"
                              (if path (concat path path-separator))
                              data-directory)
                      process-environment))
-              ;; Suppress use of pager for help output:
-              (process-connection-type nil))
+               ;; 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)))
@@ -1623,7 +1664,12 @@ buffer for a list of commands.)"
   ;; non-ASCII.
   (interactive "r")
   (let* ((f (make-temp-file "py"))
-        (command (format "emacs.eexecfile(%S)" f))
+        (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)
@@ -1823,7 +1869,9 @@ 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 ">>> \\=" nil t)))))
+      (save-match-data
+       (re-search-backward (concat python--prompt-regexp " *\\=")
+                           nil t)))))
 
 ;; Fixme:  Is there anything reasonable we can do with random methods?
 ;; (Currently only works with functions.)
@@ -2237,6 +2285,7 @@ the if condition."
 (eval-when-compile
   ;; Define a user-level skeleton and add it to the abbrev table.
 (defmacro def-python-skeleton (name &rest elements)
+  (declare (indent 2))
   (let* ((name (symbol-name name))
         (function (intern (concat "python-insert-" name))))
     `(progn
@@ -2249,7 +2298,6 @@ the if condition."
        (define-skeleton ,function
         ,(format "Insert Python \"%s\" template." name)
         ,@elements)))))
-(put 'def-python-skeleton 'lisp-indent-function 2)
 
 ;; From `skeleton-further-elements' set below:
 ;;  `<': outdent a level;
@@ -2539,9 +2587,7 @@ Runs `jython-mode-hook' after `python-mode-hook'."
   "Watch output for Python prompt and exec next file waiting in queue.
 This function is appropriate for `comint-output-filter-functions'."
   ;; TBD: this should probably use split-string
-  (when (and (or (string-equal string ">>> ")
-                (and (>= (length string) 5)
-                     (string-equal (substring string -5) "\n>>> ")))
+  (when (and (string-match python--prompt-regexp string)
             python-file-queue)
     (condition-case nil
         (delete-file (car python-file-queue))
@@ -2753,6 +2799,7 @@ comint believe the user typed this string so that
          (funcall (process-filter proc) proc msg))
       (set-buffer curbuf))
     (process-send-string proc cmd)))
+
 ;;;###autoload
 (defun python-shell (&optional argprompt)
   "Start an interactive Python interpreter in another window.
@@ -2792,6 +2839,7 @@ interaction between undo and process filters; the same problem exists in
 non-Python process buffers using the default (Emacs-supplied) process
 filter."
   (interactive "P")
+  (require 'ansi-color) ; For ipython
   ;; Set the default shell if not already set
   (when (null python-which-shell)
     (python-toggle-shells python-default-interpreter))
@@ -2808,10 +2856,9 @@ filter."
                               ))))
     (switch-to-buffer-other-window
      (apply 'make-comint python-which-bufname python-which-shell nil args))
-    (make-local-variable 'comint-prompt-regexp)
     (set-process-sentinel (get-buffer-process (current-buffer))
                           'python-sentinel)
-    (setq comint-prompt-regexp "^>>> \\|^[.][.][.] \\|^(pdb) ")
+    (python--set-prompt-regexp)
     (add-hook 'comint-output-filter-functions
              'python-comint-output-filter-function nil t)
     ;; pdbtrack
index 59d85e60eefd84284420373bd644a2903693aa79..0b92234bf1cc1f59a877b8e469d4f7e07fe03f0b 100644 (file)
 
 (eval-when-compile (require 'cl))
 
+(defgroup ruby nil
+  "Major mode for editing Ruby code."
+  :prefix "ruby-"
+  :group 'languages)
+
 (defconst ruby-keyword-end-re
   (if (string-match "\\_>" "ruby")
       "\\_>"
@@ -166,7 +171,6 @@ This should only be called after matching against `ruby-here-doc-end-re'."
     (define-key map (kbd "M-C-n") 'ruby-end-of-block)
     (define-key map (kbd "M-C-h") 'ruby-mark-defun)
     (define-key map (kbd "M-C-q") 'ruby-indent-exp)
-    (define-key map (kbd "TAB")   'ruby-indent-line)
     (define-key map (kbd "C-M-h") 'backward-kill-word)
     (define-key map (kbd "C-j")   'reindent-then-newline-and-indent)
     (define-key map (kbd "C-m")   'newline)
@@ -1390,6 +1394,8 @@ The variable `ruby-indent-level' controls the amount of indentation.
   (setq major-mode 'ruby-mode)
   (ruby-mode-variables)
 
+  (set (make-local-variable 'indent-line-function)
+       'ruby-indent-line)
   (set (make-local-variable 'imenu-create-index-function)
        'ruby-imenu-create-index)
   (set (make-local-variable 'add-log-current-defun-function)
index ce8a34220e49d2d91200a0faafb5136dcd67e010..da143db5ffba870c4de133d89e16ad471f9e0409 100644 (file)
     ;; Special characters
     (modify-syntax-entry ?, "'   " st)
     (modify-syntax-entry ?@ "'   " st)
-    (modify-syntax-entry ?# "' 14b" st)
+    (modify-syntax-entry ?# "' 14" st)
     (modify-syntax-entry ?\\ "\\   " st)
     st))
 \f
index 610fa14489ab17191bea3569582da806894a6496..9041bd502593ce536b147b6a77d75323da62c6e7 100644 (file)
@@ -411,11 +411,7 @@ the car and cdr are the same symbol.")
     (modify-syntax-entry (pop list) (pop list) table))
   table)
 
-(defvar sh-mode-syntax-table nil
-  "The syntax table to use for Shell-Script mode.
-This is buffer-local in every such buffer.")
-
-(defvar sh-mode-default-syntax-table
+(defvar sh-mode-syntax-table
   (sh-mode-syntax-table ()
        ?\# "<"
        ?\n ">#"
@@ -436,7 +432,8 @@ This is buffer-local in every such buffer.")
        ?= "."
        ?< "."
        ?> ".")
-  "Default syntax table for shell mode.")
+  "The syntax table to use for Shell-Script mode.
+This is buffer-local in every such buffer.")
 
 (defvar sh-mode-syntax-table-input
   '((sh . nil))
@@ -611,7 +608,7 @@ sign.  See `sh-feature'."
 (defvar sh-header-marker nil
   "When non-nil is the end of header for prepending by \\[sh-execute-region].
 That command is also used for setting this variable.")
-
+(make-variable-buffer-local 'sh-header-marker)
 
 (defcustom sh-beginning-of-command
   "\\([;({`|&]\\|\\`\\|[^\\]\n\\)[ \t]*\\([/~[:alnum:]:]\\)"
@@ -1480,7 +1477,7 @@ frequently editing existing scripts with different styles.")
 ;; mode-command and utility functions
 
 ;;;###autoload
-(defun sh-mode ()
+(define-derived-mode sh-mode prog-mode "Shell-script"
   "Major mode for editing shell scripts.
 This mode works for many shells, since they all have roughly the same syntax,
 as far as commands, arguments, variables, pipes, comments etc. are concerned.
@@ -1533,62 +1530,41 @@ indicate what shell it is use `sh-alias-alist' to translate.
 
 If your shell gives error messages with line numbers, you can use \\[executable-interpret]
 with your script for an edit-interpret-debug cycle."
-  (interactive)
-  (kill-all-local-variables)
-  (setq major-mode 'sh-mode
-       mode-name "Shell-script")
-  (use-local-map sh-mode-map)
-  (make-local-variable 'skeleton-end-hook)
-  (make-local-variable 'paragraph-start)
-  (make-local-variable 'paragraph-separate)
-  (make-local-variable 'comment-start)
-  (make-local-variable 'comment-start-skip)
-  (make-local-variable 'require-final-newline)
-  (make-local-variable 'sh-header-marker)
   (make-local-variable 'sh-shell-file)
   (make-local-variable 'sh-shell)
-  (make-local-variable 'skeleton-pair-alist)
-  (make-local-variable 'skeleton-pair-filter-function)
-  (make-local-variable 'comint-dynamic-complete-functions)
-  (make-local-variable 'comint-prompt-regexp)
-  (make-local-variable 'font-lock-defaults)
-  (make-local-variable 'skeleton-filter-function)
-  (make-local-variable 'skeleton-newline-indent-rigidly)
-  (make-local-variable 'sh-shell-variables)
-  (make-local-variable 'sh-shell-variables-initialized)
-  (make-local-variable 'imenu-generic-expression)
-  (make-local-variable 'sh-indent-supported-here)
-  (make-local-variable 'skeleton-pair-default-alist)
-  (setq skeleton-pair-default-alist sh-skeleton-pair-default-alist)
-  (setq skeleton-end-hook (lambda ()
-                           (or (eolp) (newline) (indent-relative)))
-       paragraph-start (concat page-delimiter "\\|$")
-       paragraph-separate paragraph-start
-       comment-start "# "
-       comment-start-skip "#+[\t ]*"
-       local-abbrev-table sh-mode-abbrev-table
-       comint-dynamic-complete-functions sh-dynamic-complete-functions
-       ;; we can't look if previous line ended with `\'
-       comint-prompt-regexp "^[ \t]*"
-       imenu-case-fold-search nil
-       font-lock-defaults
-       `((sh-font-lock-keywords
-          sh-font-lock-keywords-1 sh-font-lock-keywords-2)
-         nil nil
-         ((?/ . "w") (?~ . "w") (?. . "w") (?- . "w") (?_ . "w")) nil
-         (font-lock-syntactic-keywords . sh-font-lock-syntactic-keywords)
-         (font-lock-syntactic-face-function
-          . sh-font-lock-syntactic-face-function))
-       skeleton-pair-alist '((?` _ ?`))
-       skeleton-pair-filter-function 'sh-quoted-p
-       skeleton-further-elements '((< '(- (min sh-indentation
-                                               (current-column)))))
-       skeleton-filter-function 'sh-feature
-       skeleton-newline-indent-rigidly t
-       sh-indent-supported-here nil)
+
+  (set (make-local-variable 'skeleton-pair-default-alist)
+       sh-skeleton-pair-default-alist)
+  (set (make-local-variable 'skeleton-end-hook)
+       (lambda () (or (eolp) (newline) (indent-relative))))
+
+  (set (make-local-variable 'paragraph-start) (concat page-delimiter "\\|$"))
+  (set (make-local-variable 'paragraph-separate) paragraph-start)
+  (set (make-local-variable 'comment-start) "# ")
+  (set (make-local-variable 'comment-start-skip) "#+[\t ]*")
+  (set (make-local-variable 'local-abbrev-table) sh-mode-abbrev-table)
+  (set (make-local-variable 'comint-dynamic-complete-functions)
+       sh-dynamic-complete-functions)
+  ;; we can't look if previous line ended with `\'
+  (set (make-local-variable 'comint-prompt-regexp) "^[ \t]*")
+  (set (make-local-variable 'imenu-case-fold-search) nil)
+  (set (make-local-variable 'font-lock-defaults)
+       `((sh-font-lock-keywords
+          sh-font-lock-keywords-1 sh-font-lock-keywords-2)
+         nil nil
+         ((?/ . "w") (?~ . "w") (?. . "w") (?- . "w") (?_ . "w")) nil
+         (font-lock-syntactic-keywords . sh-font-lock-syntactic-keywords)
+         (font-lock-syntactic-face-function
+          . sh-font-lock-syntactic-face-function)))
+  (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]+\\)"))
-  (set (make-local-variable 'parse-sexp-ignore-comments) t)
   ;; Parse or insert magic number for exec, and set all variables depending
   ;; on the shell thus determined.
   (sh-set-shell
@@ -1613,8 +1589,7 @@ with your script for an edit-interpret-debug cycle."
           "sh")
          (t
           sh-shell-file))
-   nil nil)
-  (run-mode-hooks 'sh-mode-hook))
+   nil nil))
 
 ;;;###autoload
 (defalias 'shell-script-mode 'sh-mode)
@@ -1743,21 +1718,20 @@ Calls the value of `sh-set-shell-hook' if set."
                                  no-query-flag insert-flag)))
   (let ((tem (sh-feature sh-require-final-newline)))
     (if (eq tem t)
-       (setq require-final-newline mode-require-final-newline)))
-  (setq
-       mode-line-process (format "[%s]" sh-shell)
-       sh-shell-variables nil
-       sh-shell-variables-initialized nil
-       imenu-generic-expression (sh-feature sh-imenu-generic-expression))
-  (make-local-variable 'sh-mode-syntax-table)
+       (set (make-local-variable 'require-final-newline)
+             mode-require-final-newline)))
+  (setq mode-line-process (format "[%s]" sh-shell))
+  (set (make-local-variable 'sh-shell-variables) nil)
+  (set (make-local-variable 'sh-shell-variables-initialized) nil)
+  (set (make-local-variable 'imenu-generic-expression)
+       (sh-feature sh-imenu-generic-expression))
   (let ((tem (sh-feature sh-mode-syntax-table-input)))
-    (setq sh-mode-syntax-table
-         (if tem (apply 'sh-mode-syntax-table tem)
-           sh-mode-default-syntax-table)))
-  (set-syntax-table sh-mode-syntax-table)
+    (when tem
+      (set (make-local-variable 'sh-mode-syntax-table)
+           (apply 'sh-mode-syntax-table tem))
+      (set-syntax-table sh-mode-syntax-table)))
   (dolist (var (sh-feature sh-variables))
     (sh-remember-variable var))
-  (make-local-variable 'indent-line-function)
   (if (setq sh-indent-supported-here (sh-feature sh-indent-supported))
       (progn
        (message "Setting up indent for shell type %s" sh-shell)
@@ -1770,7 +1744,7 @@ Calls the value of `sh-set-shell-hook' if set."
        (message "setting up indent stuff")
        ;; sh-mode has already made indent-line-function local
        ;; but do it in case this is called before that.
-       (setq indent-line-function 'sh-indent-line)
+       (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))
@@ -2233,10 +2207,9 @@ STRING        This is ignored for the purposes of calculating
       ;; Note: setting result to t means we are done and will return nil.
       ;;(This function never returns just t.)
       (cond
-       ((or (and (boundp 'font-lock-string-face) (not (bobp))
-                (eq (get-text-property (1- (point)) 'face)
-                    font-lock-string-face))
+       ((or (nth 3 (syntax-ppss (point)))
            (eq (get-text-property (point) 'face) sh-heredoc-face))
+       ;; String continuation -- don't indent
        (setq result t)
        (setq have-result t))
        ((looking-at "\\s-*#")          ; was (equal this-kw "#")
@@ -3469,20 +3442,15 @@ CODE can be nil, t or `lambda'.
 nil means to return the best completion of STRING, or nil if there is none.
 t means to return a list of all possible completions of STRING.
 `lambda' means to return t if STRING is a valid completion as it stands."
-  (let ((sh-shell-variables
+  (let ((vars
         (with-current-buffer sh-add-buffer
           (or sh-shell-variables-initialized
               (sh-shell-initialize-variables))
           (nconc (mapcar (lambda (var)
-                           (let ((name
-                                  (substring var 0 (string-match "=" var))))
-                             (cons name name)))
+                            (substring var 0 (string-match "=" var)))
                          process-environment)
                  sh-shell-variables))))
-    (case code
-      ((nil) (try-completion string sh-shell-variables predicate))
-      (lambda (test-completion string sh-shell-variables predicate))
-      (t (all-completions string sh-shell-variables predicate)))))
+    (complete-with-action code vars string predicate)))
 
 (defun sh-add (var delta)
   "Insert an addition of VAR and prefix DELTA for Bourne (type) shell."
index 3f842903b0d97532bb14cc412394e4c10563507d..f8d1a6aca977fa4e4fe61c723b1600142d9cd252 100644 (file)
@@ -330,7 +330,7 @@ for SIMULA mode to function correctly."
   (popup-menu (cons (concat mode-name " Mode Commands") simula-mode-menu)))
 
 ;;;###autoload
-(define-derived-mode simula-mode nil "Simula"
+(define-derived-mode simula-mode prog-mode "Simula"
   "Major mode for editing SIMULA code.
 \\{simula-mode-map}
 Variables controlling indentation style:
index e79b13f3fe21c2daecb869556fd2017e6eb0dfdc..e44504688f2ef7c499db2abc995bb9570b79bc70 100644 (file)
@@ -5,7 +5,7 @@
 
 ;; Author: Alex Schroeder <alex@gnu.org>
 ;; Maintainer: Michael Mauger <mmaug@yahoo.com>
-;; Version: 2.0.2
+;; Version: 2.5
 ;; Keywords: comm languages processes
 ;; URL: http://savannah.gnu.org/cgi-bin/viewcvs/emacs/emacs/lisp/progmodes/sql.el
 ;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?SqlMode
 ;; identifiers; ms (Microsoft SQLServer) also supports identifiers
 ;; enclosed within brackets [].
 
-;; ChangeLog available on request.
-
 ;;; Product Support:
 
 ;; To add support for additional SQL products the following steps
 ;; must be followed ("xyz" is the name of the product in the examples
 ;; below):
 
-;; 1) Add the product to `sql-product' choice list.
+;; 1) Add the product to the list of known products.
 
-;;     (const :tag "XyzDB" xyz)
+;;     (sql-add-product 'xyz "XyzDB"
+;;                             '(:free-software t))
 
-;; 2) Add an entry to the `sql-product-alist' list.
+;; 2) Define font lock settings.  All ANSI keywords will be
+;;    highlighted automatically, so only product specific keywords
+;;    need to be defined here.
 
-;;     (xyz
-;;      :font-lock sql-mode-xyz-font-lock-keywords
-;;      :sqli-login (user password server database)
-;;      :sqli-connect sql-connect-xyz
-;;      :sqli-prompt-regexp "^xyzdb> "
-;;      :sqli-prompt-length 7
-;;      :sqli-input-sender nil
-;;      :syntax-alist ((?# . "w")))
+;;     (defvar my-sql-mode-xyz-font-lock-keywords
+;;       '(("\\b\\(red\\|orange\\|yellow\\)\\b"
+;;          . font-lock-keyword-face))
+;;       "XyzDB SQL keywords used by font-lock.")
 
-;; 3) Add customizable values for the product interpreter and options.
+;;     (sql-set-product-feature 'xyz
+;;                              :font-lock
+;;                              'my-sql-mode-xyz-font-lock-keywords)
 
-;;     ;; Customization for XyzDB
-;;
-;;     (defcustom sql-xyz-program "ixyz"
-;;       "*Command to start ixyz by XyzDB."
+;; 3) Define any special syntax characters including comments and
+;;    identifier characters.
+
+;;     (sql-set-product-feature 'xyz
+;;                              :syntax-alist ((?# . "w")))
+
+;; 4) Define the interactive command interpreter for the database
+;;    product.
+
+;;     (defcustom my-sql-xyz-program "ixyz"
+;;       "Command to start ixyz by XyzDB."
 ;;       :type 'file
 ;;       :group 'SQL)
 ;;
-;;     (defcustom sql-xyz-options '("-X" "-Y" "-Z")
-;;       "*List of additional options for `sql-xyz-program'."
-;;       :type '(repeat string)
+;;     (sql-set-product-feature 'xyz
+;;                              :sqli-program 'my-sql-xyz-program)
+;;     (sql-set-product-feature 'xyz
+;;                              :prompt-regexp "^xyzdb> ")
+;;     (sql-set-product-feature 'xyz
+;;                              :prompt-length 7)
+
+;; 5) Define login parameters and command line formatting.
+
+;;     (defcustom my-sql-xyz-login-params '(user password server database)
+;;       "Login parameters to needed to connect to XyzDB."
+;;       :type 'sql-login-params
 ;;       :group 'SQL)
+;;
+;;     (sql-set-product-feature 'xyz
+;;                              :sqli-login 'my-sql-xyz-login-params)
 
-;; 4) Add an entry to SQL->Product submenu.
-
-;;     ["XyzDB" sql-highlight-xyz-keywords
-;;      :style radio
-;;      :selected (eq sql-product 'xyz)]
-
-;; 5) Add the font-lock specifications.  At a minimum, default to
-;;    using ANSI keywords.  See sql-mode-oracle-font-lock-keywords for
-;;    a more complex example.
-
-;;     (defvar sql-mode-xyz-font-lock-keywords nil
-;;       "XyzDB SQL keywords used by font-lock.")
-
-;; 6) Add a product highlighting function.
-
-;;     (defun sql-highlight-xyz-keywords ()
-;;       "Highlight XyzDB keywords."
-;;       (interactive)
-;;       (sql-set-product 'xyz))
-
-;; 7) Add an autoloaded SQLi function.
-
-;;     ;;;###autoload
-;;     (defun sql-xyz ()
-;;       "Run ixyz by XyzDB as an inferior process."
-;;       (interactive)
-;;       (sql-product-interactive 'xyz))
-
-;; 8) Add a connect function which formats the command line arguments
-;;    and starts the product interpreter in a comint buffer.  See the
-;;    existing connect functions for examples of the types of
-;;    processing available.
+;;     (defcustom my-sql-xyz-options '("-X" "-Y" "-Z")
+;;       "List of additional options for `sql-xyz-program'."
+;;       :type '(repeat string)
+;;       :group 'SQL)
+;;
+;;     (sql-set-product-feature 'xyz
+;;                              :sqli-options 'my-sql-xyz-options))
 
-;;     (defun sql-connect-xyz ()
-;;       "Create comint buffer and connect to XyzDB using the login
-;;     parameters and command options."
+;;     (defun my-sql-comint-xyz (product options)
+;;       "Connect ti XyzDB in a comint buffer."
 ;;
 ;;         ;; Do something with `sql-user', `sql-password',
 ;;         ;; `sql-database', and `sql-server'.
-;;         (let ((params sql-xyz-options))
+;;         (let ((params options))
 ;;           (if (not (string= "" sql-server))
 ;;              (setq params (append (list "-S" sql-server) params)))
 ;;           (if (not (string= "" sql-database))
 ;;               (setq params (append (list "-P" sql-password) params)))
 ;;           (if (not (string= "" sql-user))
 ;;               (setq params (append (list "-U" sql-user) params)))
-;;           (set-buffer (apply 'make-comint "SQL" sql-xyz-program
-;;                              nil params))))
+;;           (sql-comint product params)))
+;;
+;;     (sql-set-product-feature 'xyz
+;;                              :sqli-comint-func 'my-sql-comint-xyz)
+
+;; 6) Define a convienence function to invoke the SQL interpreter.
 
-;; 9) Save and compile sql.el.
+;;     (defun my-sql-xyz ()
+;;       "Run ixyz by XyzDB as an inferior process."
+;;       (interactive)
+;;       (sql-product-interactive 'xyz))
 
 ;;; To Do:
 
-;; Add better hilight support for other brands; there is a bias towards
-;; Oracle because that's what I use at work.  Anybody else just send in
-;; your lists of reserved words, keywords and builtin functions!  As
-;; long as I don't receive any feedback, everything is hilighted with
-;; ANSI keywords only.  I received the list of ANSI keywords from a
-;; user; if you know of any changes, let me know.
+;; Improve keyword highlighting for individual products.  I have tried
+;; to update those database that I use.  Feel free to send me updates,
+;; or direct me to the reference manuals for your favorite database.
+
+;; When there are no keywords defined, the ANSI keywords are
+;; highlighted.  ANSI keywords are highlighted even if the keyword is
+;; not used for your current product.  This should help identify
+;; portability concerns.
+
+;; Add different highlighting levels.
 
-;; Add different hilighting levels.
+;; Add support for listing available tables or the columns in a table.
 
 ;;; Thanks to all the people who helped me out:
 
-;; Alex Schroeder <alex@gnu.org>
+;; Alex Schroeder <alex@gnu.org> -- the original author
 ;; Kai Blauberg <kai.blauberg@metla.fi>
 ;; <ibalaban@dalet.com>
 ;; Yair Friedman <yfriedma@JohnBryce.Co.Il>
 ;; Michael Mauger <mmaug@yahoo.com> -- improved product support
 ;; Drew Adams <drew.adams@oracle.com> -- Emacs 20 support
 ;; Harald Maier <maierh@myself.com> -- sql-send-string
-;; Stefan Monnier <monnier@iro.umontreal.ca> -- font-lock corrections
+;; Stefan Monnier <monnier@iro.umontreal.ca> -- font-lock corrections; code polish
 
 \f
 
   (require 'regexp-opt))
 (require 'custom)
 (eval-when-compile ;; needed in Emacs 19, 20
-  (setq max-specpdl-size 2000))
+  (setq max-specpdl-size (max max-specpdl-size 2000)))
 
 (defvar font-lock-keyword-face)
 (defvar font-lock-set-defaults)
 (defgroup SQL nil
   "Running a SQL interpreter from within Emacs buffers."
   :version "20.4"
+  :group 'languages
   :group 'processes)
 
 ;; These four variables will be used as defaults, if set.
 
 (defcustom sql-user ""
-  "*Default username."
+  "Default username."
   :type 'string
-  :group 'SQL)
+  :group 'SQL
+  :safe 'stringp)
 
 (defcustom sql-password ""
-  "*Default password.
+  "Default password.
 
 Storing your password in a textfile such as ~/.emacs could be dangerous.
 Customizing your password will store it in your ~/.emacs file."
   :type 'string
-  :group 'SQL)
+  :group 'SQL
+  :risky t)
 
 (defcustom sql-database ""
-  "*Default database."
+  "Default database."
   :type 'string
-  :group 'SQL)
+  :group 'SQL
+  :safe 'stringp)
 
 (defcustom sql-server ""
-  "*Default server or host."
+  "Default server or host."
   :type 'string
-  :group 'SQL)
+  :group 'SQL
+  :safe 'stringp)
+
+(defcustom sql-port nil
+  "Default server or host."
+  :version "24.1"
+  :type 'number
+  :group 'SQL
+  :safe 'numberp)
+
+;; Login parameter type
+
+(define-widget 'sql-login-params 'lazy
+  "Widget definition of the login parameters list"
+  :tag "Login Parameters"
+  :type '(repeat (choice
+                  (const user)
+                  (const password)
+                  (choice :tag "server"
+                          (const server)
+                          (list :tag "file"
+                                (const :format "" server)
+                                (const :format "" :file)
+                                regexp)
+                          (list :tag "completion"
+                                (const :format "" server)
+                                (const :format "" :completion)
+                                (restricted-sexp
+                                 :match-alternatives (listp symbolp))))
+                  (choice :tag "database"
+                          (const database)
+                          (list :tag "file"
+                                (const :format "" database)
+                                (const :format "" :file)
+                                regexp)
+                          (list :tag "completion"
+                                (const :format "" database)
+                                (const :format "" :completion)
+                                (restricted-sexp
+                                 :match-alternatives (listp symbolp))))
+                  (const port))))
 
 ;; SQL Product support
 
 (defvar sql-interactive-product nil
   "Product under `sql-interactive-mode'.")
 
+(defvar sql-connection nil
+  "Connection name if interactive session started by `sql-connect'.")
+
 (defvar sql-product-alist
   '((ansi
      :name "ANSI"
      :font-lock sql-mode-ansi-font-lock-keywords)
+
     (db2
      :name "DB2"
      :font-lock sql-mode-db2-font-lock-keywords
-     :sqli-login nil
-     :sqli-connect sql-connect-db2
-     :sqli-prompt-regexp "^db2 => "
-     :sqli-prompt-length 7)
+     :sqli-program sql-db2-program
+     :sqli-options sql-db2-options
+     :sqli-login sql-db2-login-params
+     :sqli-comint-func sql-comint-db2
+     :prompt-regexp "^db2 => "
+     :prompt-length 7
+     :prompt-cont-regexp "^db2 (cont\.) => "
+     :input-filter sql-escape-newlines-filter)
+
     (informix
+     :name "Informix"
      :font-lock sql-mode-informix-font-lock-keywords
-     :sqli-login (database)
-     :sqli-connect sql-connect-informix
-     :sqli-prompt-regexp "^SQL> "
-     :sqli-prompt-length 5)
+     :sqli-program sql-informix-program
+     :sqli-options sql-informix-options
+     :sqli-login sql-informix-login-params
+     :sqli-comint-func sql-comint-informix
+     :prompt-regexp "^> "
+     :prompt-length 2
+     :syntax-alist ((?{ . "<") (?} . ">")))
+
     (ingres
+     :name "Ingres"
      :font-lock sql-mode-ingres-font-lock-keywords
-     :sqli-login (database)
-     :sqli-connect sql-connect-ingres
-     :sqli-prompt-regexp "^\* "
-     :sqli-prompt-length 2)
+     :sqli-program sql-ingres-program
+     :sqli-options sql-ingres-options
+     :sqli-login sql-ingres-login-params
+     :sqli-comint-func sql-comint-ingres
+     :prompt-regexp "^\* "
+     :prompt-length 2
+     :prompt-cont-regexp "^\* ")
+
     (interbase
+     :name "Interbase"
      :font-lock sql-mode-interbase-font-lock-keywords
-     :sqli-login (user password database)
-     :sqli-connect sql-connect-interbase
-     :sqli-prompt-regexp "^SQL> "
-     :sqli-prompt-length 5)
+     :sqli-program sql-interbase-program
+     :sqli-options sql-interbase-options
+     :sqli-login sql-interbase-login-params
+     :sqli-comint-func sql-comint-interbase
+     :prompt-regexp "^SQL> "
+     :prompt-length 5)
+
     (linter
+     :name "Linter"
      :font-lock sql-mode-linter-font-lock-keywords
-     :sqli-login (user password database server)
-     :sqli-connect sql-connect-linter
-     :sqli-prompt-regexp "^SQL>"
-     :sqli-prompt-length 4)
+     :sqli-program sql-linter-program
+     :sqli-options sql-linter-options
+     :sqli-login sql-linter-login-params
+     :sqli-comint-func sql-comint-linter
+     :prompt-regexp "^SQL>"
+     :prompt-length 4)
+
     (ms
-     :name "MS SQLServer"
+     :name "Microsoft"
      :font-lock sql-mode-ms-font-lock-keywords
-     :sqli-login (user password server database)
-     :sqli-connect sql-connect-ms
-     :sqli-prompt-regexp "^[0-9]*>"
-     :sqli-prompt-length 5
-     :syntax-alist ((?@ . "w")))
+     :sqli-program sql-ms-program
+     :sqli-options sql-ms-options
+     :sqli-login sql-ms-login-params
+     :sqli-comint-func sql-comint-ms
+     :prompt-regexp "^[0-9]*>"
+     :prompt-length 5
+     :syntax-alist ((?@ . "w"))
+     :terminator ("^go" . "go"))
+
     (mysql
      :name "MySQL"
+     :free-software t
      :font-lock sql-mode-mysql-font-lock-keywords
-     :sqli-login (user password database server)
-     :sqli-connect sql-connect-mysql
-     :sqli-prompt-regexp "^mysql> "
-     :sqli-prompt-length 6)
+     :sqli-program sql-mysql-program
+     :sqli-options sql-mysql-options
+     :sqli-login sql-mysql-login-params
+     :sqli-comint-func sql-comint-mysql
+     :prompt-regexp "^mysql> "
+     :prompt-length 6
+     :prompt-cont-regexp "^    -> "
+     :input-filter sql-remove-tabs-filter)
+
     (oracle
+     :name "Oracle"
      :font-lock sql-mode-oracle-font-lock-keywords
-     :sqli-login (user password database)
-     :sqli-connect sql-connect-oracle
-     :sqli-prompt-regexp "^SQL> "
-     :sqli-prompt-length 5
-     :syntax-alist ((?$ . "w") (?# . "w")))
+     :sqli-program sql-oracle-program
+     :sqli-options sql-oracle-options
+     :sqli-login sql-oracle-login-params
+     :sqli-comint-func sql-comint-oracle
+     :prompt-regexp "^SQL> "
+     :prompt-length 5
+     :prompt-cont-regexp "^\\s-*\\d+> "
+     :syntax-alist ((?$ . "w") (?# . "w"))
+     :terminator ("\\(^/\\|;\\)" . "/")
+     :input-filter sql-placeholders-filter)
+
     (postgres
+     :name "Postgres"
+     :free-software t
      :font-lock sql-mode-postgres-font-lock-keywords
-     :sqli-login (user database server)
-     :sqli-connect sql-connect-postgres
-     :sqli-prompt-regexp "^.*[#>] *"
-     :sqli-prompt-length 5)
+     :sqli-program sql-postgres-program
+     :sqli-options sql-postgres-options
+     :sqli-login sql-postgres-login-params
+     :sqli-comint-func sql-comint-postgres
+     :prompt-regexp "^.*=[#>] "
+     :prompt-length 5
+     :prompt-cont-regexp "^.*-[#>] "
+     :input-filter sql-remove-tabs-filter
+     :terminator ("\\(^[\\]g\\|;\\)" . ";"))
+
     (solid
+     :name "Solid"
      :font-lock sql-mode-solid-font-lock-keywords
-     :sqli-login (user password server)
-     :sqli-connect sql-connect-solid
-     :sqli-prompt-regexp "^"
-     :sqli-prompt-length 0)
+     :sqli-program sql-solid-program
+     :sqli-options sql-solid-options
+     :sqli-login sql-solid-login-params
+     :sqli-comint-func sql-comint-solid
+     :prompt-regexp "^"
+     :prompt-length 0)
+
     (sqlite
      :name "SQLite"
+     :free-software t
      :font-lock sql-mode-sqlite-font-lock-keywords
-     :sqli-login (database)
-     :sqli-connect sql-connect-sqlite
-     :sqli-prompt-regexp "^sqlite> "
-     :sqli-prompt-length 8)
+     :sqli-program sql-sqlite-program
+     :sqli-options sql-sqlite-options
+     :sqli-login sql-sqlite-login-params
+     :sqli-comint-func sql-comint-sqlite
+     :prompt-regexp "^sqlite> "
+     :prompt-length 8
+     :prompt-cont-regexp "^   ...> "
+     :terminator ";")
+
     (sybase
+     :name "Sybase"
      :font-lock sql-mode-sybase-font-lock-keywords
-     :sqli-login (server user password database)
-     :sqli-connect sql-connect-sybase
-     :sqli-prompt-regexp "^SQL> "
-     :sqli-prompt-length 5
-     :syntax-alist ((?@ . "w")))
+     :sqli-program sql-sybase-program
+     :sqli-options sql-sybase-options
+     :sqli-login sql-sybase-login-params
+     :sqli-comint-func sql-comint-sybase
+     :prompt-regexp "^SQL> "
+     :prompt-length 5
+     :syntax-alist ((?@ . "w"))
+     :terminator ("^go" . "go"))
     )
-  "This variable contains a list of product features for each of the
-SQL products handled by `sql-mode'.  Without an entry in this list a
-product will not be properly highlighted and will not support
-`sql-interactive-mode'.
+  "An alist of product specific configuration settings.
+
+Without an entry in this list a product will not be properly
+highlighted and will not support `sql-interactive-mode'.
 
 Each element in the list is in the following format:
 
  \(PRODUCT FEATURE VALUE ...)
 
-where PRODUCT is the appropriate value of `sql-product'.  The product
-name is then followed by FEATURE-VALUE pairs.  If a FEATURE is not
-specified, its VALUE is treated as nil.  FEATURE must be one of the
-following:
+where PRODUCT is the appropriate value of `sql-product'.  The
+product name is then followed by FEATURE-VALUE pairs.  If a
+FEATURE is not specified, its VALUE is treated as nil.  FEATURE
+may be any one of the following:
+
+ :name                  string containing the displayable name of
+                        the product.
+
+ :free-software         is the product Free (as in Freedom) software?
 
  :font-lock             name of the variable containing the product
                         specific font lock highlighting patterns.
 
- :sqli-login            a list of login parameters (i.e., user,
-                        password, database and server) needed to
-                        connect to the database.
+ :sqli-program          name of the variable containing the product
+                        specific interactive program name.
 
- :sqli-connect          the name of a function which accepts no
+ :sqli-options          name of the variable containing the list
+                        of product specific options.
+
+ :sqli-login            name of the variable containing the list of
+                        login parameters (i.e., user, password,
+                        database and server) needed to connect to
+                        the database.
+
+ :sqli-comint-func      name of a function which accepts no
                         parameters that will use the values of
                         `sql-user', `sql-password',
                         `sql-database' and `sql-server' to open a
@@ -385,19 +510,99 @@ following:
                         database.  Do product specific
                         configuration of comint in this function.
 
- :sqli-prompt-regexp    a regular expression string that matches
+ :prompt-regexp         regular expression string that matches
                         the prompt issued by the product
-                        interpreter.  (Not needed in 21.3+)
+                        interpreter.
+
+ :prompt-length         length of the prompt on the line.
+
+ :prompt-cont-regexp    regular expression string that matches
+                        the continuation prompt issued by the
+                        product interpreter.
+
+ :input-filter          function which can filter strings sent to
+                        the command interpreter.  It is also used
+                        by the `sql-send-string',
+                        `sql-send-region', `sql-send-paragraph'
+                        and `sql-send-buffer' functions.  The
+                        function is passed the string sent to the
+                        command interpreter and must return the
+                        filtered string.  May also be a list of
+                        such functions.
+
+ :terminator            the terminator to be sent after a
+                        `sql-send-string', `sql-send-region',
+                        `sql-send-paragraph' and
+                        `sql-send-buffer' command.  May be the
+                        literal string or a cons of a regexp to
+                        match an existing terminator in the
+                        string and the terminator to be used if
+                        its absent.  By default \";\".
+
+ :syntax-alist          alist of syntax table entries to enable
+                        special character treatment by font-lock
+                        and imenu.
+
+Other features can be stored but they will be ignored.  However,
+you can develop new functionality which is product independent by
+using `sql-get-product-feature' to lookup the product specific
+settings.")
+
+(defvar sql-indirect-features
+  '(:font-lock :sqli-program :sqli-options :sqli-login))
 
- :sqli-prompt-length    the length of the prompt on the line.(Not
-                        needed in 21.3+)
-
- :syntax-alist          an alist of syntax table entries to enable
-                        special character treatment by font-lock and
-                        imenu. ")
+;;;###autoload
+(defcustom sql-connection-alist nil
+  "An alist of connection parameters for interacting with a SQL
+  product.
+
+Each element of the alist is as follows:
+
+  \(CONNECTION \(SQL-VARIABLE VALUE) ...)
+
+Where CONNECTION is a symbol identifying the connection, SQL-VARIABLE
+is the symbol name of a SQL mode variable, and VALUE is the value to
+be assigned to the variable.
+
+The most common SQL-VARIABLE settings associated with a connection
+are:
+
+  `sql-product'
+  `sql-user'
+  `sql-password'
+  `sql-port'
+  `sql-server'
+  `sql-database'
+
+If a SQL-VARIABLE is part of the connection, it will not be
+prompted for during login."
+
+  :type `(alist :key-type (string :tag "Connection")
+                :value-type
+                (set
+                 (group (const :tag "Product"  sql-product)
+                        (choice
+                         ,@(mapcar (lambda (prod-info)
+                                     `(const :tag
+                                             ,(or (plist-get (cdr prod-info) :name)
+                                                  (capitalize (symbol-name (car prod-info))))
+                                             (quote ,(car prod-info))))
+                                   sql-product-alist)))
+                 (group (const :tag "Username" sql-user)     string)
+                 (group (const :tag "Password" sql-password) string)
+                 (group (const :tag "Server"   sql-server)   string)
+                 (group (const :tag "Database" sql-database) string)
+                 (group (const :tag "Port"     sql-port)     integer)
+                 (repeat :inline t
+                         (list :tab "Other"
+                               (symbol :tag " Variable Symbol")
+                               (sexp   :tag "Value Expression")))))
+  :version "24.1"
+  :group 'SQL)
 
+;;;###autoload
 (defcustom sql-product 'ansi
-  "*Select the SQL database product used so that buffers can be
+  "Select the SQL database product used so that buffers can be
 highlighted properly when you open them."
   :type `(choice
           ,@(mapcar (lambda (prod-info)
@@ -406,9 +611,10 @@ highlighted properly when you open them."
                                    (capitalize (symbol-name (car prod-info))))
                               ,(car prod-info)))
                     sql-product-alist))
-  :group 'SQL)
+  :group 'SQL
+  :safe 'symbolp)
 
-;; misc customization of sql.el behavior
+;; misc customization of sql.el behaviour
 
 (defcustom sql-electric-stuff nil
   "Treat some input as electric.
@@ -424,14 +630,44 @@ current input in the SQLi buffer to the process."
   :version "20.8"
   :group 'SQL)
 
-(defcustom sql-pop-to-buffer-after-send-region nil
-  "*If t, pop to the buffer SQL statements are sent to.
+(defcustom sql-send-terminator nil
+  "When non-nil, add a terminator to text sent to the SQL interpreter.
+
+When text is sent to the SQL interpreter (via `sql-send-string',
+`sql-send-region', `sql-send-paragraph' or `sql-send-buffer'), a
+command terminator can be automatically sent as well.  The
+terminator is not sent, if the string sent already ends with the
+terminator.
+
+If this value is t, then the default command terminator for the
+SQL interpreter is sent.  If this value is a string, then the
+string is sent.
+
+If the value is a cons cell of the form (PAT . TERM), then PAT is
+a regexp used to match the terminator in the string and TERM is
+the terminator to be sent.  This form is useful if the SQL
+interpreter has more than one way of submitting a SQL command.
+The PAT regexp can match any of them, and TERM is the way we do
+it automatically."
+
+  :type '(choice (const  :tag "No Terminator" nil)
+                (const  :tag "Default Terminator" t)
+                (string :tag "Terminator String")
+                (cons   :tag "Terminator Pattern and String"
+                        (string :tag "Terminator Pattern")
+                        (string :tag "Terminator String")))
+  :version "22.2"
+  :group 'SQL)
 
-After a call to `sql-send-region' or `sql-send-buffer',
-the window is split and the SQLi buffer is shown.  If this
-variable is not nil, that buffer's window will be selected
-by calling `pop-to-buffer'.  If this variable is nil, that
-buffer is shown using `display-buffer'."
+(defcustom sql-pop-to-buffer-after-send-region nil
+  "When non-nil, pop to the buffer SQL statements are sent to.
+
+After a call to `sql-sent-string', `sql-send-region',
+`sql-send-paragraph' or `sql-send-buffer', the window is split
+and the SQLi buffer is shown.  If this variable is not nil, that
+buffer's window will be selected by calling `pop-to-buffer'.  If
+this variable is nil, that buffer is shown using
+`display-buffer'."
   :type 'boolean
   :group 'SQL)
 
@@ -445,6 +681,7 @@ buffer is shown using `display-buffer'."
     ("Functions" "^\\s-*\\(create\\s-+\\(\\w+\\s-+\\)*\\)?function\\s-+\\(\\w+\\)" 3)
     ("Procedures" "^\\s-*\\(create\\s-+\\(\\w+\\s-+\\)*\\)?proc\\(edure\\)?\\s-+\\(\\w+\\)" 4)
     ("Packages" "^\\s-*create\\s-+\\(\\w+\\s-+\\)*package\\s-+\\(body\\s-+\\)?\\(\\w+\\)" 3)
+    ("Types" "^\\s-*create\\s-+\\(\\w+\\s-+\\)*type\\s-+\\(body\\s-+\\)?\\(\\w+\\)" 3)
     ("Indexes" "^\\s-*create\\s-+\\(\\w+\\s-+\\)*index\\s-+\\(\\w+\\)" 2)
     ("Tables/Views" "^\\s-*create\\s-+\\(\\w+\\s-+\\)*\\(table\\|view\\)\\s-+\\(\\w+\\)" 3))
   "Define interesting points in the SQL buffer for `imenu'.
@@ -457,7 +694,7 @@ a local variable.")
 ;; history file
 
 (defcustom sql-input-ring-file-name nil
-  "*If non-nil, name of the file to read/write input history.
+  "If non-nil, name of the file to read/write input history.
 
 You have to set this variable if you want the history of your commands
 saved from one Emacs session to the next.  If this variable is set,
@@ -474,7 +711,7 @@ Note that the size of the input history is determined by the variable
   :group 'SQL)
 
 (defcustom sql-input-ring-separator "\n--\n"
-  "*Separator between commands in the history file.
+  "Separator between commands in the history file.
 
 If set to \"\\n\", each line in the history file will be interpreted as
 one command.  Multi-line commands are split into several commands when
@@ -492,17 +729,17 @@ commands when the input history is read, as if you had set
 ;; The usual hooks
 
 (defcustom sql-interactive-mode-hook '()
-  "*Hook for customizing `sql-interactive-mode'."
+  "Hook for customizing `sql-interactive-mode'."
   :type 'hook
   :group 'SQL)
 
 (defcustom sql-mode-hook '()
-  "*Hook for customizing `sql-mode'."
+  "Hook for customizing `sql-mode'."
   :type 'hook
   :group 'SQL)
 
 (defcustom sql-set-sqli-hook '()
-  "*Hook for reacting to changes of `sql-buffer'.
+  "Hook for reacting to changes of `sql-buffer'.
 
 This is called by `sql-set-sqli-buffer' when the value of `sql-buffer'
 is changed."
@@ -512,142 +749,187 @@ is changed."
 ;; Customization for Oracle
 
 (defcustom sql-oracle-program "sqlplus"
-  "*Command to start sqlplus by Oracle.
+  "Command to start sqlplus by Oracle.
 
 Starts `sql-interactive-mode' after doing some setup.
 
-On Windows, \"sqlplus\" usually starts the sqlplus \"GUI\".  In order to
-start the sqlplus console, use \"plus33\" or something similar.  You
-will find the file in your Orant\\bin directory.
-
-The program can also specify a TCP connection.  See `make-comint'."
+On Windows, \"sqlplus\" usually starts the sqlplus \"GUI\".  In order
+to start the sqlplus console, use \"plus33\" or something similar.
+You will find the file in your Orant\\bin directory."
   :type 'file
   :group 'SQL)
 
 (defcustom sql-oracle-options nil
-  "*List of additional options for `sql-oracle-program'."
+  "List of additional options for `sql-oracle-program'."
   :type '(repeat string)
   :version "20.8"
   :group 'SQL)
 
-;; Customization for SQLite
+(defcustom sql-oracle-login-params '(user password database)
+  "List of login parameters needed to connect to Oracle."
+  :type 'sql-login-params
+  :version "24.1"
+  :group 'SQL)
 
-(defcustom sql-sqlite-program "sqlite"
-  "*Command to start SQLite.
+(defcustom sql-oracle-scan-on t
+  "Non-nil if placeholders should be replaced in Oracle SQLi.
 
-Starts `sql-interactive-mode' after doing some setup.
+When non-nil, Emacs will scan text sent to sqlplus and prompt
+for replacement text for & placeholders as sqlplus does.  This
+is needed on Windows where sqlplus output is buffered and the
+prompts are not shown until after the text is entered.
+
+You will probably want to issue the following command in sqlplus
+to be safe:
+
+    SET SCAN OFF"
+  :type 'boolean
+  :group 'SQL)
 
-The program can also specify a TCP connection.  See `make-comint'."
+;; Customization for SQLite
+
+(defcustom sql-sqlite-program "sqlite3"
+  "Command to start SQLite.
+
+Starts `sql-interactive-mode' after doing some setup."
   :type 'file
   :group 'SQL)
 
 (defcustom sql-sqlite-options nil
-  "*List of additional options for `sql-sqlite-program'."
+  "List of additional options for `sql-sqlite-program'."
   :type '(repeat string)
   :version "20.8"
   :group 'SQL)
 
+(defcustom sql-sqlite-login-params '((database :file ".*\\.db"))
+  "List of login parameters needed to connect to SQLite."
+  :type 'sql-login-params
+  :version "24.1"
+  :group 'SQL)
+
 ;; Customization for MySql
 
 (defcustom sql-mysql-program "mysql"
-  "*Command to start mysql by TcX.
+  "Command to start mysql by TcX.
 
-Starts `sql-interactive-mode' after doing some setup.
-
-The program can also specify a TCP connection.  See `make-comint'."
+Starts `sql-interactive-mode' after doing some setup."
   :type 'file
   :group 'SQL)
 
 (defcustom sql-mysql-options nil
-  "*List of additional options for `sql-mysql-program'.
+  "List of additional options for `sql-mysql-program'.
 The following list of options is reported to make things work
 on Windows: \"-C\" \"-t\" \"-f\" \"-n\"."
   :type '(repeat string)
   :version "20.8"
   :group 'SQL)
 
+(defcustom sql-mysql-login-params '(user password database server)
+  "List of login parameters needed to connect to MySql."
+  :type 'sql-login-params
+  :version "24.1"
+  :group 'SQL)
+
 ;; Customization for Solid
 
 (defcustom sql-solid-program "solsql"
-  "*Command to start SOLID SQL Editor.
+  "Command to start SOLID SQL Editor.
 
-Starts `sql-interactive-mode' after doing some setup.
-
-The program can also specify a TCP connection.  See `make-comint'."
+Starts `sql-interactive-mode' after doing some setup."
   :type 'file
   :group 'SQL)
 
-;; Customization for SyBase
+(defcustom sql-solid-login-params '(user password server)
+  "List of login parameters needed to connect to Solid."
+  :type 'sql-login-params
+  :version "24.1"
+  :group 'SQL)
 
-(defcustom sql-sybase-program "isql"
-  "*Command to start isql by SyBase.
+;; Customization for Sybase
 
-Starts `sql-interactive-mode' after doing some setup.
+(defcustom sql-sybase-program "isql"
+  "Command to start isql by Sybase.
 
-The program can also specify a TCP connection.  See `make-comint'."
+Starts `sql-interactive-mode' after doing some setup."
   :type 'file
   :group 'SQL)
 
 (defcustom sql-sybase-options nil
-  "*List of additional options for `sql-sybase-program'.
+  "List of additional options for `sql-sybase-program'.
 Some versions of isql might require the -n option in order to work."
   :type '(repeat string)
   :version "20.8"
   :group 'SQL)
 
+(defcustom sql-sybase-login-params '(server user password database)
+  "List of login parameters needed to connect to Sybase."
+  :type 'sql-login-params
+  :version "24.1"
+  :group 'SQL)
+
 ;; Customization for Informix
 
 (defcustom sql-informix-program "dbaccess"
-  "*Command to start dbaccess by Informix.
-
-Starts `sql-interactive-mode' after doing some setup.
+  "Command to start dbaccess by Informix.
 
-The program can also specify a TCP connection.  See `make-comint'."
+Starts `sql-interactive-mode' after doing some setup."
   :type 'file
   :group 'SQL)
 
+(defcustom sql-informix-login-params '(database)
+  "List of login parameters needed to connect to Informix."
+  :type 'sql-login-params
+  :version "24.1"
+  :group 'SQL)
+
 ;; Customization for Ingres
 
 (defcustom sql-ingres-program "sql"
-  "*Command to start sql by Ingres.
-
-Starts `sql-interactive-mode' after doing some setup.
+  "Command to start sql by Ingres.
 
-The program can also specify a TCP connection.  See `make-comint'."
+Starts `sql-interactive-mode' after doing some setup."
   :type 'file
   :group 'SQL)
 
+(defcustom sql-ingres-login-params '(database)
+  "List of login parameters needed to connect to Ingres."
+  :type 'sql-login-params
+  :version "24.1"
+  :group 'SQL)
+
 ;; Customization for Microsoft
 
 (defcustom sql-ms-program "osql"
-  "*Command to start osql by Microsoft.
-
-Starts `sql-interactive-mode' after doing some setup.
+  "Command to start osql by Microsoft.
 
-The program can also specify a TCP connection.  See `make-comint'."
+Starts `sql-interactive-mode' after doing some setup."
   :type 'file
   :group 'SQL)
 
 (defcustom sql-ms-options '("-w" "300" "-n")
   ;; -w is the linesize
-  "*List of additional options for `sql-ms-program'."
+  "List of additional options for `sql-ms-program'."
   :type '(repeat string)
   :version "22.1"
   :group 'SQL)
 
+(defcustom sql-ms-login-params '(user password server database)
+  "List of login parameters needed to connect to Microsoft."
+  :type 'sql-login-params
+  :version "24.1"
+  :group 'SQL)
+
 ;; Customization for Postgres
 
 (defcustom sql-postgres-program "psql"
   "Command to start psql by Postgres.
 
-Starts `sql-interactive-mode' after doing some setup.
-
-The program can also specify a TCP connection.  See `make-comint'."
+Starts `sql-interactive-mode' after doing some setup."
   :type 'file
   :group 'SQL)
 
 (defcustom sql-postgres-options '("-P" "pager=off")
-  "*List of additional options for `sql-postgres-program'.
+  "List of additional options for `sql-postgres-program'.
 The default setting includes the -P option which breaks older versions
 of the psql client (such as version 6.5.3).  The -P option is equivalent
 to the --pset option.  If you want the psql to prompt you for a user
@@ -658,55 +940,75 @@ add your name with a \"-U\" prefix (such as \"-Umark\") to the list."
   :version "20.8"
   :group 'SQL)
 
+(defcustom sql-postgres-login-params '(user database server)
+  "List of login parameters needed to connect to Postgres."
+  :type 'sql-login-params
+  :version "24.1"
+  :group 'SQL)
+
 ;; Customization for Interbase
 
 (defcustom sql-interbase-program "isql"
-  "*Command to start isql by Interbase.
+  "Command to start isql by Interbase.
 
-Starts `sql-interactive-mode' after doing some setup.
-
-The program can also specify a TCP connection.  See `make-comint'."
+Starts `sql-interactive-mode' after doing some setup."
   :type 'file
   :group 'SQL)
 
 (defcustom sql-interbase-options nil
-  "*List of additional options for `sql-interbase-program'."
+  "List of additional options for `sql-interbase-program'."
   :type '(repeat string)
   :version "20.8"
   :group 'SQL)
 
+(defcustom sql-interbase-login-params '(user password database)
+  "List of login parameters needed to connect to Interbase."
+  :type 'sql-login-params
+  :version "24.1"
+  :group 'SQL)
+
 ;; Customization for DB2
 
 (defcustom sql-db2-program "db2"
-  "*Command to start db2 by IBM.
+  "Command to start db2 by IBM.
 
-Starts `sql-interactive-mode' after doing some setup.
-
-The program can also specify a TCP connection.  See `make-comint'."
+Starts `sql-interactive-mode' after doing some setup."
   :type 'file
   :group 'SQL)
 
 (defcustom sql-db2-options nil
-  "*List of additional options for `sql-db2-program'."
+  "List of additional options for `sql-db2-program'."
   :type '(repeat string)
   :version "20.8"
   :group 'SQL)
 
+(defcustom sql-db2-login-params nil
+  "List of login parameters needed to connect to DB2."
+  :type 'sql-login-params
+  :version "24.1"
+  :group 'SQL)
+
 ;; Customization for Linter
 
 (defcustom sql-linter-program "inl"
-  "*Command to start inl by RELEX.
+  "Command to start inl by RELEX.
 
 Starts `sql-interactive-mode' after doing some setup."
   :type 'file
   :group 'SQL)
 
 (defcustom sql-linter-options nil
-  "*List of additional options for `sql-linter-program'."
+  "List of additional options for `sql-linter-program'."
   :type '(repeat string)
   :version "21.3"
   :group 'SQL)
 
+(defcustom sql-linter-login-params '(user password database server)
+  "Login parameters to needed to connect to Linter."
+  :type 'sql-login-params
+  :version "24.1"
+  :group 'SQL)
+
 \f
 
 ;;; Variables which do not need customization
@@ -720,6 +1022,9 @@ Starts `sql-interactive-mode' after doing some setup."
 (defvar sql-server-history nil
   "History of servers used.")
 
+(defvar sql-port-history nil
+  "History of ports used.")
+
 ;; Passwords are not kept in a history.
 
 (defvar sql-buffer nil
@@ -741,6 +1046,9 @@ You can change `sql-prompt-regexp' on `sql-interactive-mode-hook'.")
 
 You can change `sql-prompt-length' on `sql-interactive-mode-hook'.")
 
+(defvar sql-prompt-cont-regexp nil
+  "Prompt pattern of statement continuation prompts.")
+
 (defvar sql-alternate-buffer-name nil
   "Buffer-local string used to possibly rename the SQLi buffer.
 
@@ -773,6 +1081,7 @@ Based on `comint-mode-map'.")
     (define-key map (kbd "C-c C-r") 'sql-send-region)
     (define-key map (kbd "C-c C-s") 'sql-send-string)
     (define-key map (kbd "C-c C-b") 'sql-send-buffer)
+    (define-key map (kbd "C-c C-i") 'sql-product-interactive)
     map)
   "Mode map used for `sql-mode'.")
 
@@ -784,16 +1093,24 @@ Based on `comint-mode-map'.")
  `("SQL"
    ["Send Paragraph" sql-send-paragraph (and (buffer-live-p sql-buffer)
                                             (get-buffer-process sql-buffer))]
-   ["Send Region" sql-send-region (and (or (and (boundp 'mark-active); Emacs
-                                               mark-active)
-                                          (mark t)); XEmacs
+   ["Send Region" sql-send-region (and mark-active
                                       (buffer-live-p sql-buffer)
                                       (get-buffer-process sql-buffer))]
    ["Send Buffer" sql-send-buffer (and (buffer-live-p sql-buffer)
                                       (get-buffer-process sql-buffer))]
-   ["Send String" sql-send-string t]
-   ["--" nil nil]
-   ["Start SQLi session" sql-product-interactive (sql-product-feature :sqli-connect)]
+   ["Send String" sql-send-string (and (buffer-live-p sql-buffer)
+                                      (get-buffer-process sql-buffer))]
+   "--"
+   ["Start SQLi session" sql-product-interactive
+    :visible (not sql-connection-alist)
+    :enable (sql-get-product-feature sql-product :sqli-comint-func)]
+   ("Start..."
+    :visible sql-connection-alist
+    :filter sql-connection-menu-filter
+    "--"
+    ["New SQLi Session" sql-product-interactive (sql-get-product-feature sql-product :sqli-comint-func)])
+   ["--"
+    :visible sql-connection-alist]
    ["Show SQLi buffer" sql-show-sqli-buffer t]
    ["Set SQLi buffer" sql-set-sqli-buffer t]
    ["Pop to SQLi buffer after send"
@@ -821,7 +1138,8 @@ Based on `comint-mode-map'.")
  sql-interactive-mode-menu sql-interactive-mode-map
  "Menu for `sql-interactive-mode'."
  '("SQL"
-   ["Rename Buffer" sql-rename-buffer t]))
+   ["Rename Buffer" sql-rename-buffer t]
+   ["Save Connection" sql-save-connection (not sql-connection)]))
 
 ;; Abbreviations -- if you want more of them, define them in your
 ;; ~/.emacs file.  Abbrevs have to be enabled in your ~/.emacs, too.
@@ -886,25 +1204,64 @@ The pattern matches the name in a CREATE, DROP or ALTER
 statement.  The format of variable should be a valid
 `font-lock-keywords' entry.")
 
-(defmacro sql-keywords-re (&rest keywords)
-  "Compile-time generation of regexp matching any one of KEYWORDS."
-  `(eval-when-compile
-     (concat "\\b"
-            (regexp-opt ',keywords t)
-            "\\b")))
+;; While there are international and American standards for SQL, they
+;; are not followed closely, and most vendors offer significant
+;; capabilities beyond those defined in the standard specifications.
+
+;; SQL mode provides support for hilighting based on the product.  In
+;; addition to hilighting the product keywords, any ANSI keywords not
+;; used by the product are also hilighted.  This will help identify
+;; keywords that could be restricted in future versions of the product
+;; or might be a problem if ported to another product.
+
+;; To reduce the complexity and size of the regular expressions
+;; generated to match keywords, ANSI keywords are filtered out of
+;; product keywords if they are equivalent.  To do this, we define a
+;; function `sql-font-lock-keywords-builder' that removes any keywords
+;; that are matched by the ANSI patterns and results in the same face
+;; being applied.  For this to work properly, we must play some games
+;; with the execution and compile time behavior.  This code is a
+;; little tricky but works properly.
+
+;; When defining the keywords for individual products you should
+;; include all of the keywords that you want matched.  The filtering
+;; against the ANSI keywords will be automatic if you use the
+;; `sql-font-lock-keywords-builder' function and follow the
+;; implementation pattern used for the other products in this file.
 
-(defvar sql-mode-ansi-font-lock-keywords
-  (let ((ansi-funcs (sql-keywords-re
-"abs" "avg" "bit_length" "cardinality" "cast" "char_length"
-"character_length" "coalesce" "convert" "count" "current_date"
-"current_path" "current_role" "current_time" "current_timestamp"
-"current_user" "extract" "localtime" "localtimestamp" "lower" "max"
-"min" "mod" "nullif" "octet_length" "overlay" "placing" "session_user"
-"substring" "sum" "system_user" "translate" "treat" "trim" "upper"
-"user"
-))
+(eval-when-compile
+  (defvar sql-mode-ansi-font-lock-keywords)
+  (setq sql-mode-ansi-font-lock-keywords nil))
+
+(eval-and-compile
+  (defun sql-font-lock-keywords-builder (face boundaries &rest keywords)
+    "Generation of regexp matching any one of KEYWORDS."
+
+    (let ((bdy (or boundaries '("\\b" . "\\b")))
+         kwd)
+
+      ;; Remove keywords that are defined in ANSI
+      (setq kwd keywords)
+      (dolist (k keywords)
+       (catch 'next
+         (dolist (a sql-mode-ansi-font-lock-keywords)
+           (when (and (eq face (cdr a))
+                      (eq (string-match (car a) k 0) 0)
+                      (eq (match-end 0) (length k)))
+             (setq kwd (delq k kwd))
+             (throw 'next nil)))))
+
+      ;; Create a properly formed font-lock-keywords item
+      (cons (concat (car bdy)
+                   (regexp-opt kwd t)
+                   (cdr bdy))
+           face))))
 
-       (ansi-non-reserved (sql-keywords-re
+(eval-when-compile
+  (setq sql-mode-ansi-font-lock-keywords
+       (list
+        ;; ANSI Non Reserved keywords
+        (sql-font-lock-keywords-builder 'font-lock-keyword-face nil
 "ada" "asensitive" "assignment" "asymmetric" "atomic" "between"
 "bitvar" "called" "catalog_name" "chain" "character_set_catalog"
 "character_set_name" "character_set_schema" "checked" "class_origin"
@@ -932,9 +1289,9 @@ statement.  The format of variable should be a valid
 "trigger_name" "trigger_schema" "type" "uncommitted" "unnamed"
 "user_defined_type_catalog" "user_defined_type_name"
 "user_defined_type_schema"
-))
-
-       (ansi-reserved (sql-keywords-re
+)
+        ;; ANSI Reserved keywords
+        (sql-font-lock-keywords-builder 'font-lock-keyword-face nil
 "absolute" "action" "add" "admin" "after" "aggregate" "alias" "all"
 "allocate" "alter" "and" "any" "are" "as" "asc" "assertion" "at"
 "authorization" "before" "begin" "both" "breadth" "by" "call"
@@ -970,21 +1327,29 @@ statement.  The format of variable should be a valid
 "trigger" "true" "under" "union" "unique" "unknown" "unnest" "update"
 "usage" "using" "value" "values" "variable" "view" "when" "whenever"
 "where" "with" "without" "work" "write" "year"
-))
+)
 
-       (ansi-types (sql-keywords-re
+        ;; ANSI Functions
+        (sql-font-lock-keywords-builder 'font-lock-builtin-face nil
+"abs" "avg" "bit_length" "cardinality" "cast" "char_length"
+"character_length" "coalesce" "convert" "count" "current_date"
+"current_path" "current_role" "current_time" "current_timestamp"
+"current_user" "extract" "localtime" "localtimestamp" "lower" "max"
+"min" "mod" "nullif" "octet_length" "overlay" "placing" "session_user"
+"substring" "sum" "system_user" "translate" "treat" "trim" "upper"
+"user"
+)
+        ;; ANSI Data Types
+        (sql-font-lock-keywords-builder 'font-lock-type-face nil
 "array" "binary" "bit" "blob" "boolean" "char" "character" "clob"
 "date" "dec" "decimal" "double" "float" "int" "integer" "interval"
 "large" "national" "nchar" "nclob" "numeric" "object" "precision"
 "real" "ref" "row" "scope" "smallint" "time" "timestamp" "varchar"
 "varying" "zone"
-)))
-
-    `((,ansi-non-reserved . font-lock-keyword-face)
-      (,ansi-reserved     . font-lock-keyword-face)
-      (,ansi-funcs        . font-lock-builtin-face)
-      (,ansi-types        . font-lock-type-face)))
+))))
 
+(defvar sql-mode-ansi-font-lock-keywords
+  (eval-when-compile sql-mode-ansi-font-lock-keywords)
   "ANSI SQL keywords used by font-lock.
 
 This variable is used by `sql-mode' and `sql-interactive-mode'.  The
@@ -994,7 +1359,54 @@ you define your own `sql-mode-ansi-font-lock-keywords'.  You may want
 to add functions and PL/SQL keywords.")
 
 (defvar sql-mode-oracle-font-lock-keywords
-  (let ((oracle-functions (sql-keywords-re
+  (eval-when-compile
+    (list
+     ;; Oracle SQL*Plus Commands
+     (cons
+      (concat
+       "^\\(?:\\(?:" (regexp-opt '(
+"@" "@@" "accept" "append" "archive" "attribute" "break"
+"btitle" "change" "clear" "column" "connect" "copy" "define"
+"del" "describe" "disconnect" "edit" "execute" "exit" "get" "help"
+"host" "input" "list" "password" "pause" "print" "prompt" "recover"
+"remark" "repfooter" "repheader" "run" "save" "show" "shutdown"
+"spool" "start" "startup" "store" "timing" "ttitle" "undefine"
+"variable" "whenever"
+) t)
+
+       "\\)\\|"
+       "\\(?:compute\\s-+\\(?:avg\\|cou\\|min\\|max\\|num\\|sum\\|std\\|var\\)\\)\\|"
+       "\\(?:set\\s-+\\("
+
+       (regexp-opt
+       '("appi" "appinfo" "array" "arraysize" "auto" "autocommit"
+         "autop" "autoprint" "autorecovery" "autot" "autotrace" "blo"
+         "blockterminator" "buffer" "closecursor" "cmds" "cmdsep"
+         "colsep" "com" "compatibility" "con" "concat" "constraint"
+         "constraints" "copyc" "copycommit" "copytypecheck" "database"
+         "def" "define" "document" "echo" "editf" "editfile" "emb"
+         "embedded" "esc" "escape" "feed" "feedback" "flagger" "flu"
+         "flush" "hea" "heading" "heads" "headsep" "instance" "lin"
+         "linesize" "lobof" "loboffset" "logsource" "long" "longc"
+         "longchunksize" "maxdata" "newp" "newpage" "null" "num"
+         "numf" "numformat" "numwidth" "pages" "pagesize" "pau"
+         "pause" "recsep" "recsepchar" "role" "scan" "serveroutput"
+         "shift" "shiftinout" "show" "showmode" "space" "sqlbl"
+         "sqlblanklines" "sqlc" "sqlcase" "sqlco" "sqlcontinue" "sqln"
+         "sqlnumber" "sqlp" "sqlpluscompat" "sqlpluscompatibility"
+         "sqlpre" "sqlprefix" "sqlprompt" "sqlt" "sqlterminator"
+         "statement_id" "suf" "suffix" "tab" "term" "termout" "ti"
+         "time" "timi" "timing" "transaction" "trim" "trimout" "trims"
+         "trimspool" "truncate" "und" "underline" "ver" "verify" "wra"
+         "wrap")) "\\)\\)"
+
+       "\\)\\b.*"
+       )
+      'font-lock-doc-face)
+     '("^[ \t]*rem\\(?:ark\\)?.*" . font-lock-comment-face)
+
+     ;; Oracle Functions
+     (sql-font-lock-keywords-builder 'font-lock-builtin-face nil
 "abs" "acos" "add_months" "ascii" "asciistr" "asin" "atan" "atan2"
 "avg" "bfilename" "bin_to_num" "bitand" "cast" "ceil" "chartorowid"
 "chr" "coalesce" "compose" "concat" "convert" "corr" "cos" "cosh"
@@ -1025,9 +1437,9 @@ to add functions and PL/SQL keywords.")
 "userenv" "var_pop" "var_samp" "variance" "vsize" "width_bucket" "xml"
 "xmlagg" "xmlattribute" "xmlcolattval" "xmlconcat" "xmlelement"
 "xmlforest" "xmlsequence" "xmltransform"
-))
-
-       (oracle-keywords (sql-keywords-re
+)
+     ;; Oracle Keywords
+     (sql-font-lock-keywords-builder 'font-lock-keyword-face nil
 "abort" "access" "accessed" "account" "activate" "add" "admin"
 "advise" "after" "agent" "aggregate" "all" "allocate" "allow" "alter"
 "always" "analyze" "ancillary" "and" "any" "apply" "archive"
@@ -1113,22 +1525,29 @@ to add functions and PL/SQL keywords.")
 "use" "using" "validate" "validation" "value" "values" "variable"
 "varray" "version" "view" "wait" "when" "whenever" "where" "with"
 "without" "wnds" "wnps" "work" "write" "xmldata" "xmlschema" "xmltype"
-))
-
-       (oracle-types (sql-keywords-re
+)
+     ;; Oracle Data Types
+     (sql-font-lock-keywords-builder 'font-lock-type-face nil
 "bfile" "blob" "byte" "char" "character" "clob" "date" "dec" "decimal"
 "double" "float" "int" "integer" "interval" "long" "national" "nchar"
 "nclob" "number" "numeric" "nvarchar2" "precision" "raw" "real"
 "rowid" "second" "smallint" "time" "timestamp" "urowid" "varchar"
 "varchar2" "varying" "year" "zone"
-))
+)
 
-       (plsql-functions (sql-keywords-re
+     ;; Oracle PL/SQL Attributes
+     (sql-font-lock-keywords-builder 'font-lock-builtin-face '("" . "\\b")
 "%bulk_rowcount" "%found" "%isopen" "%notfound" "%rowcount" "%rowtype"
-"%type" "extend" "prior"
-))
+"%type"
+)
+
+     ;; Oracle PL/SQL Functions
+     (sql-font-lock-keywords-builder 'font-lock-builtin-face nil
+"extend" "prior"
+)
 
-       (plsql-keywords (sql-keywords-re
+     ;; Oracle PL/SQL Keywords
+     (sql-font-lock-keywords-builder 'font-lock-keyword-face nil
 "autonomous_transaction" "bulk" "char_base" "collect" "constant"
 "cursor" "declare" "do" "elsif" "exception_init" "execute" "exit"
 "extends" "false" "fetch" "forall" "goto" "hour" "if" "interface"
@@ -1136,14 +1555,16 @@ to add functions and PL/SQL keywords.")
 "separate" "serially_reusable" "sql" "sqlcode" "sqlerrm" "subtype"
 "the" "timezone_abbr" "timezone_hour" "timezone_minute"
 "timezone_region" "true" "varrying" "while"
-))
+)
 
-       (plsql-type (sql-keywords-re
+     ;; Oracle PL/SQL Data Types
+     (sql-font-lock-keywords-builder 'font-lock-type-face nil
 "binary_integer" "boolean" "naturaln" "pls_integer" "positive"
 "positiven" "record" "signtype" "string"
-))
+)
 
-       (plsql-warning (sql-keywords-re
+     ;; Oracle PL/SQL Exceptions
+     (sql-font-lock-keywords-builder 'font-lock-warning-face nil
 "access_into_null" "case_not_found" "collection_is_null"
 "cursor_already_open" "dup_val_on_index" "invalid_cursor"
 "invalid_number" "login_denied" "no_data_found" "not_logged_on"
@@ -1151,55 +1572,7 @@ to add functions and PL/SQL keywords.")
 "subscript_beyond_count" "subscript_outside_limit" "sys_invalid_rowid"
 "timeout_on_resource" "too_many_rows" "value_error" "zero_divide"
 "exception" "notfound"
-))
-
-       (sqlplus-commands
-        (eval-when-compile (concat "^\\(\\("
-                                   (regexp-opt '(
-"@" "@@" "accept" "append" "archive" "attribute" "break"
-"btitle" "change" "clear" "column" "connect" "copy" "define"
-"del" "describe" "disconnect" "edit" "execute" "exit" "get" "help"
-"host" "input" "list" "password" "pause" "print" "prompt" "recover"
-"remark" "repfooter" "repheader" "run" "save" "show" "shutdown"
-"spool" "start" "startup" "store" "timing" "ttitle" "undefine"
-"variable" "whenever"
-
-) t)
-
-   "\\)\\|"
-   "\\(compute\\s-+\\(avg\\|cou\\|min\\|max\\|num\\|sum\\|std\\|var\\)\\)\\|"
-   "\\(set\\s-+\\(appi\\(nfo\\)?\\|array\\(size\\)?\\|"
-   "auto\\(commit\\)?\\|autop\\(rint\\)?\\|autorecovery\\|"
-   "autot\\(race\\)?\\|blo\\(ckterminator\\)?\\|cmds\\(ep\\)?\\|"
-   "colsep\\|com\\(patibility\\)?\\|con\\(cat\\)?\\|"
-   "copyc\\(ommit\\)?\\|copytypecheck\\|def\\(ine\\)?\\|"
-   "describe\\|echo\\|editf\\(ile\\)?\\|emb\\(edded\\)?\\|"
-   "esc\\(ape\\)?\\|feed\\(back\\)?\\|flagger\\|"
-   "flu\\(sh\\)?\\|hea\\(ding\\)?\\|heads\\(ep\\)?\\|"
-   "instance\\|lin\\(esize\\)?\\|lobof\\(fset\\)?\\|"
-   "logsource\\|long\\|longc\\(hunksize\\)?\\|mark\\(up\\)?\\|"
-   "newp\\(age\\)?\\|null\\|numf\\(ormat\\)?\\|"
-   "num\\(width\\)?\\|pages\\(ize\\)?\\|pau\\(se\\)?\\|"
-   "recsep\\|recsepchar\\|serverout\\(put\\)?\\|"
-   "shift\\(inout\\)?\\|show\\(mode\\)?\\|"
-   "sqlbl\\(anklines\\)?\\|sqlc\\(ase\\)?\\|"
-   "sqlco\\(ntinue\\)?\\|sqln\\(umber\\)?\\|"
-   "sqlpluscompat\\(ibility\\)?\\|sqlpre\\(fix\\)?\\|"
-   "sqlp\\(rompt\\)?\\|sqlt\\(erminator\\)?\\|"
-   "suf\\(fix\\)?\\|tab\\|term\\(out\\)?\\|ti\\(me\\)?\\|"
-   "timi\\(ng\\)?\\|trim\\(out\\)?\\|trims\\(pool\\)?\\|"
-   "und\\(erline\\)?\\|ver\\(ify\\)?\\|wra\\(p\\)?\\)\\)\\)"
-   "\\b.*$"
-   ))))
-
-    `((,sqlplus-commands . font-lock-doc-face)
-      (,oracle-functions . font-lock-builtin-face)
-      (,oracle-keywords  . font-lock-keyword-face)
-      (,oracle-types     . font-lock-type-face)
-      (,plsql-functions  . font-lock-builtin-face)
-      (,plsql-keywords   . font-lock-keyword-face)
-      (,plsql-type       . font-lock-type-face)
-      (,plsql-warning    . font-lock-warning-face)))
+)))
 
   "Oracle SQL keywords used by font-lock.
 
@@ -1210,7 +1583,10 @@ you define your own `sql-mode-oracle-font-lock-keywords'.  You may want
 to add functions and PL/SQL keywords.")
 
 (defvar sql-mode-postgres-font-lock-keywords
-  (let ((pg-funcs (sql-keywords-re
+  (eval-when-compile
+    (list
+     ;; Postgres Functions
+     (sql-font-lock-keywords-builder 'font-lock-builtin-face nil
 "abbrev" "abs" "acos" "age" "area" "ascii" "asin" "atab2" "atan"
 "atan2" "avg" "bit_length" "both" "broadcast" "btrim" "cbrt" "ceil"
 "center" "char_length" "chr" "coalesce" "col_description" "convert"
@@ -1235,9 +1611,9 @@ to add functions and PL/SQL keywords.")
 "substring" "sum" "tan" "timeofday" "to_ascii" "to_char" "to_date"
 "to_hex" "to_number" "to_timestamp" "trailing" "translate" "trim"
 "trunc" "upper" "variance" "version" "width"
-))
-
-       (pg-reserved (sql-keywords-re
+)
+     ;; Postgres Reserved
+     (sql-font-lock-keywords-builder 'font-lock-keyword-face nil
 "abort" "access" "add" "after" "aggregate" "alignment" "all" "alter"
 "analyze" "and" "any" "as" "asc" "assignment" "authorization"
 "backward" "basetype" "before" "begin" "between" "binary" "by" "cache"
@@ -1272,9 +1648,10 @@ to add functions and PL/SQL keywords.")
 "usage" "user" "using" "vacuum" "valid" "validator" "values"
 "variable" "verbose" "view" "volatile" "when" "where" "with" "without"
 "work"
-))
+)
 
-       (pg-types (sql-keywords-re
+     ;; Postgres Data Types
+     (sql-font-lock-keywords-builder 'font-lock-type-face nil
 "anyarray" "bigint" "bigserial" "bit" "boolean" "box" "bytea" "char"
 "character" "cidr" "circle" "cstring" "date" "decimal" "double"
 "float4" "float8" "inet" "int2" "int4" "int8" "integer" "internal"
@@ -1285,10 +1662,6 @@ to add functions and PL/SQL keywords.")
 "timestamp" "varchar" "varying" "void" "zone"
 )))
 
-  `((,pg-funcs    . font-lock-builtin-face)
-    (,pg-reserved . font-lock-keyword-face)
-    (,pg-types    . font-lock-type-face)))
-
   "Postgres SQL keywords used by font-lock.
 
 This variable is used by `sql-mode' and `sql-interactive-mode'.  The
@@ -1297,7 +1670,10 @@ function `regexp-opt'.  Therefore, take a look at the source before
 you define your own `sql-mode-postgres-font-lock-keywords'.")
 
 (defvar sql-mode-linter-font-lock-keywords
-  (let ((linter-keywords (sql-keywords-re
+  (eval-when-compile
+    (list
+     ;; Linter Keywords
+     (sql-font-lock-keywords-builder 'font-lock-keyword-face nil
 "autocommit" "autoinc" "autorowid" "cancel" "cascade" "channel"
 "committed" "count" "countblob" "cross" "current" "data" "database"
 "datafile" "datafiles" "datesplit" "dba" "dbname" "default" "deferred"
@@ -1322,9 +1698,10 @@ you define your own `sql-mode-postgres-font-lock-keywords'.")
 "trigger_info_size" "true" "trunc" "uncommitted" "unicode" "unknown"
 "unlimited" "unlisted" "user" "utf8" "value" "varying" "volumes"
 "wait" "windows_code" "workspace" "write" "xml"
-))
+)
 
-       (linter-reserved (sql-keywords-re
+     ;; Linter Reserved
+     (sql-font-lock-keywords-builder 'font-lock-keyword-face nil
 "access" "action" "add" "address" "after" "all" "alter" "always" "and"
 "any" "append" "as" "asc" "ascic" "async" "at_begin" "at_end" "audit"
 "aud_obj_name_len" "backup" "base" "before" "between" "blobfile"
@@ -1342,16 +1719,10 @@ you define your own `sql-mode-postgres-font-lock-keywords'.")
 "start" "stop" "sync" "synchronize" "synonym" "sysdate" "table" "then"
 "to" "union" "unique" "unlock" "until" "update" "using" "values"
 "view" "when" "where" "with" "without"
-))
+)
 
-       (linter-types (sql-keywords-re
-"bigint" "bitmap" "blob" "boolean" "char" "character" "date"
-"datetime" "dec" "decimal" "double" "float" "int" "integer" "nchar"
-"number" "numeric" "real" "smallint" "varbyte" "varchar" "byte"
-"cursor" "long"
-))
-
-       (linter-functions (sql-keywords-re
+     ;; Linter Functions
+     (sql-font-lock-keywords-builder 'font-lock-builtin-face nil
 "abs" "acos" "asin" "atan" "atan2" "avg" "ceil" "cos" "cosh" "divtime"
 "exp" "floor" "getbits" "getblob" "getbyte" "getlong" "getraw"
 "getstr" "gettext" "getword" "hextoraw" "lenblob" "length" "log"
@@ -1362,12 +1733,15 @@ you define your own `sql-mode-postgres-font-lock-keywords'.")
 "to_gmtime" "to_localtime" "to_number" "trim" "upper" "decode"
 "substr" "substring" "chr" "dayname" "days" "greatest" "hex" "initcap"
 "instr" "least" "multime" "replace" "width"
-)))
+)
 
-    `((,linter-keywords  . font-lock-keyword-face)
-      (,linter-reserved  . font-lock-keyword-face)
-      (,linter-functions . font-lock-builtin-face)
-      (,linter-types     . font-lock-type-face)))
+     ;; Linter Data Types
+     (sql-font-lock-keywords-builder 'font-lock-type-face nil
+"bigint" "bitmap" "blob" "boolean" "char" "character" "date"
+"datetime" "dec" "decimal" "double" "float" "int" "integer" "nchar"
+"number" "numeric" "real" "smallint" "varbyte" "varchar" "byte"
+"cursor" "long"
+)))
 
   "Linter SQL keywords used by font-lock.
 
@@ -1376,7 +1750,29 @@ regular expressions are created during compilation by calling the
 function `regexp-opt'.")
 
 (defvar sql-mode-ms-font-lock-keywords
-  (let ((ms-reserved (sql-keywords-re
+  (eval-when-compile
+    (list
+     ;; MS isql/osql Commands
+     (cons
+      (concat
+       "^\\(?:\\(?:set\\s-+\\(?:"
+       (regexp-opt '(
+"datefirst" "dateformat" "deadlock_priority" "lock_timeout"
+"concat_null_yields_null" "cursor_close_on_commit"
+"disable_def_cnst_chk" "fips_flagger" "identity_insert" "language"
+"offsets" "quoted_identifier" "arithabort" "arithignore" "fmtonly"
+"nocount" "noexec" "numeric_roundabort" "parseonly"
+"query_governor_cost_limit" "rowcount" "textsize" "ansi_defaults"
+"ansi_null_dflt_off" "ansi_null_dflt_on" "ansi_nulls" "ansi_padding"
+"ansi_warnings" "forceplan" "showplan_all" "showplan_text"
+"statistics" "implicit_transactions" "remote_proc_transactions"
+"transaction" "xact_abort"
+) t)
+       "\\)\\)\\|go\\s-*\\|use\\s-+\\|setuser\\s-+\\|dbcc\\s-+\\).*$")
+      'font-lock-doc-face)
+
+     ;; MS Reserved
+     (sql-font-lock-keywords-builder 'font-lock-keyword-face nil
 "absolute" "add" "all" "alter" "and" "any" "as" "asc" "authorization"
 "avg" "backup" "begin" "between" "break" "browse" "bulk" "by"
 "cascade" "case" "check" "checkpoint" "close" "clustered" "coalesce"
@@ -1409,19 +1805,10 @@ function `regexp-opt'.")
 "updlock" "use" "user" "values" "view" "waitfor" "when" "where"
 "while" "with" "work" "writetext" "collate" "function" "openxml"
 "returns"
-))
+)
 
-       (ms-types (sql-keywords-re
-"binary" "bit" "char" "character" "cursor" "datetime" "dec" "decimal"
-"double" "float" "image" "int" "integer" "money" "national" "nchar"
-"ntext" "numeric" "numeric" "nvarchar" "precision" "real"
-"smalldatetime" "smallint" "smallmoney" "text" "timestamp" "tinyint"
-"uniqueidentifier" "varbinary" "varchar" "varying"
-))
-
-       (ms-vars "\\b@[a-zA-Z0-9_]*\\b")
-
-       (ms-functions (sql-keywords-re
+     ;; MS Functions
+     (sql-font-lock-keywords-builder 'font-lock-builtin-face nil
 "@@connections" "@@cpu_busy" "@@cursor_rows" "@@datefirst" "@@dbts"
 "@@error" "@@fetch_status" "@@identity" "@@idle" "@@io_busy"
 "@@langid" "@@language" "@@lock_timeout" "@@max_connections"
@@ -1450,30 +1837,19 @@ function `regexp-opt'.")
 "suser_id" "suser_name" "suser_sid" "suser_sname" "system_user" "tan"
 "textptr" "textvalid" "typeproperty" "unicode" "upper" "user"
 "user_id" "user_name" "var" "varp" "year"
-))
+)
 
-       (ms-commands
-        (eval-when-compile
-          (concat "^\\(\\(set\\s-+\\("
-                  (regexp-opt '(
-"datefirst" "dateformat" "deadlock_priority" "lock_timeout"
-"concat_null_yields_null" "cursor_close_on_commit"
-"disable_def_cnst_chk" "fips_flagger" "identity_insert" "language"
-"offsets" "quoted_identifier" "arithabort" "arithignore" "fmtonly"
-"nocount" "noexec" "numeric_roundabort" "parseonly"
-"query_governor_cost_limit" "rowcount" "textsize" "ansi_defaults"
-"ansi_null_dflt_off" "ansi_null_dflt_on" "ansi_nulls" "ansi_padding"
-"ansi_warnings" "forceplan" "showplan_all" "showplan_text"
-"statistics" "implicit_transactions" "remote_proc_transactions"
-"transaction" "xact_abort"
-) t)
-                  "\\)\\)\\|go\\s-*\\|use\\s-+\\|setuser\\s-+\\|dbcc\\s-+\\).*$"))))
+     ;; MS Variables
+     '("\\b@[a-zA-Z0-9_]*\\b" . font-lock-variable-name-face)
 
-    `((,ms-commands  . font-lock-doc-face)
-      (,ms-reserved  . font-lock-keyword-face)
-      (,ms-functions . font-lock-builtin-face)
-      (,ms-vars      . font-lock-variable-name-face)
-      (,ms-types     . font-lock-type-face)))
+     ;; MS Types
+     (sql-font-lock-keywords-builder 'font-lock-type-face nil
+"binary" "bit" "char" "character" "cursor" "datetime" "dec" "decimal"
+"double" "float" "image" "int" "integer" "money" "national" "nchar"
+"ntext" "numeric" "numeric" "nvarchar" "precision" "real"
+"smalldatetime" "smallint" "smallmoney" "text" "timestamp" "tinyint"
+"uniqueidentifier" "varbinary" "varchar" "varying"
+)))
 
   "Microsoft SQLServer SQL keywords used by font-lock.
 
@@ -1523,7 +1899,10 @@ function `regexp-opt'.  Therefore, take a look at the source before
 you define your own `sql-mode-solid-font-lock-keywords'.")
 
 (defvar sql-mode-mysql-font-lock-keywords
-  (let ((mysql-funcs (sql-keywords-re
+  (eval-when-compile
+    (list
+     ;; MySQL Functions
+     (sql-font-lock-keywords-builder 'font-lock-builtin-face nil
 "ascii" "avg" "bdmpolyfromtext" "bdmpolyfromwkb" "bdpolyfromtext"
 "bdpolyfromwkb" "benchmark" "bin" "bit_and" "bit_length" "bit_or"
 "bit_xor" "both" "cast" "char_length" "character_length" "coalesce"
@@ -1546,9 +1925,10 @@ you define your own `sql-mode-solid-font-lock-keywords'.")
 "release_lock" "repeat" "replace" "reverse" "rpad" "rtrim" "soundex"
 "space" "std" "stddev" "substring" "substring_index" "sum" "sysdate"
 "trailing" "trim" "ucase" "unix_timestamp" "upper" "user" "variance"
-))
+)
 
-       (mysql-keywords (sql-keywords-re
+     ;; MySQL Keywords
+     (sql-font-lock-keywords-builder 'font-lock-keyword-face nil
 "action" "add" "after" "against" "all" "alter" "and" "as" "asc"
 "auto_increment" "avg_row_length" "bdb" "between" "by" "cascade"
 "case" "change" "character" "check" "checksum" "close" "collate"
@@ -1574,9 +1954,10 @@ you define your own `sql-mode-solid-font-lock-keywords'.")
 "then" "to" "transaction" "truncate" "type" "uncommitted" "union"
 "unique" "unlock" "update" "use" "using" "values" "when" "where"
 "with" "write" "xor"
-))
+)
 
-       (mysql-types (sql-keywords-re
+     ;; MySQL Data Types
+     (sql-font-lock-keywords-builder 'font-lock-type-face nil
 "bigint" "binary" "bit" "blob" "bool" "boolean" "char" "curve" "date"
 "datetime" "dec" "decimal" "double" "enum" "fixed" "float" "geometry"
 "geometrycollection" "int" "integer" "line" "linearring" "linestring"
@@ -1588,10 +1969,6 @@ you define your own `sql-mode-solid-font-lock-keywords'.")
 "zerofill"
 )))
 
-    `((,mysql-funcs    . font-lock-builtin-face)
-      (,mysql-keywords . font-lock-keyword-face)
-      (,mysql-types    . font-lock-type-face)))
-
   "MySQL SQL keywords used by font-lock.
 
 This variable is used by `sql-mode' and `sql-interactive-mode'.  The
@@ -1599,7 +1976,51 @@ regular expressions are created during compilation by calling the
 function `regexp-opt'.  Therefore, take a look at the source before
 you define your own `sql-mode-mysql-font-lock-keywords'.")
 
-(defvar sql-mode-sqlite-font-lock-keywords nil
+(defvar sql-mode-sqlite-font-lock-keywords
+  (eval-when-compile
+    (list
+     ;; SQLite Keyword
+     (sql-font-lock-keywords-builder 'font-lock-keyword-face nil
+"abort" "action" "add" "after" "all" "alter" "analyze" "and" "as"
+"asc" "attach" "autoincrement" "before" "begin" "between" "by"
+"cascade" "case" "cast" "check" "collate" "column" "commit" "conflict"
+"constraint" "create" "cross" "database" "default" "deferrable"
+"deferred" "delete" "desc" "detach" "distinct" "drop" "each" "else"
+"end" "escape" "except" "exclusive" "exists" "explain" "fail" "for"
+"foreign" "from" "full" "glob" "group" "having" "if" "ignore"
+"immediate" "in" "index" "indexed" "initially" "inner" "insert"
+"instead" "intersect" "into" "is" "isnull" "join" "key" "left" "like"
+"limit" "match" "natural" "no" "not" "notnull" "null" "of" "offset"
+"on" "or" "order" "outer" "plan" "pragma" "primary" "query" "raise"
+"references" "regexp" "reindex" "release" "rename" "replace"
+"restrict" "right" "rollback" "row" "savepoint" "select" "set" "table"
+"temp" "temporary" "then" "to" "transaction" "trigger" "union"
+"unique" "update" "using" "vacuum" "values" "view" "virtual" "when"
+"where"
+)
+     ;; SQLite Data types
+     (sql-font-lock-keywords-builder 'font-lock-type-face nil
+"int" "integer" "tinyint" "smallint" "mediumint" "bigint" "unsigned"
+"big" "int2" "int8" "character" "varchar" "varying" "nchar" "native"
+"nvarchar" "text" "clob" "blob" "real" "double" "precision" "float"
+"numeric" "number" "decimal" "boolean" "date" "datetime"
+)
+     ;; SQLite Functions
+     (sql-font-lock-keywords-builder 'font-lock-builtin-face nil
+;; Core functions
+"abs" "changes" "coalesce" "glob" "ifnull" "hex" "last_insert_rowid"
+"length" "like" "load_extension" "lower" "ltrim" "max" "min" "nullif"
+"quote" "random" "randomblob" "replace" "round" "rtrim" "soundex"
+"sqlite_compileoption_get" "sqlite_compileoption_used"
+"sqlite_source_id" "sqlite_version" "substr" "total_changes" "trim"
+"typeof" "upper" "zeroblob"
+;; Date/time functions
+"time" "julianday" "strftime"
+"current_date" "current_time" "current_timestamp"
+;; Aggregate functions
+"avg" "count" "group_concat" "max" "min" "sum" "total"
+)))
+
   "SQLite SQL keywords used by font-lock.
 
 This variable is used by `sql-mode' and `sql-interactive-mode'.  The
@@ -1626,45 +2047,139 @@ highlighting rules in SQL mode.")
 
 ;;; SQL Product support functions
 
-(defun sql-product-feature (feature &optional product)
-  "Lookup `feature' needed to support the current SQL product.
+(defun sql-add-product (product display &rest plist)
+  "Add support for a database product in `sql-mode'.
+
+Add PRODUCT to `sql-product-alist' which enables `sql-mode' to
+properly support syntax highlighting and interactive interaction.
+DISPLAY is the name of the SQL product that will appear in the
+menu bar and in messages.  PLIST initializes the product
+configuration."
+
+  ;; Don't do anything if the product is already supported
+  (if (assoc product sql-product-alist)
+      (message "Product `%s' is already defined" product)
+
+    ;; Add product to the alist
+    (add-to-list 'sql-product-alist `((,product :name ,display . ,plist)))
+    ;; Add a menu item to the SQL->Product menu
+    (easy-menu-add-item sql-mode-menu '("Product")
+                       ;; Each product is represented by a radio
+                       ;; button with it's display name.
+                       `[,display
+                         (sql-set-product ',product)
+                        :style radio
+                        :selected (eq sql-product ',product)]
+                       ;; Maintain the product list in
+                       ;; (case-insensitive) alphabetic order of the
+                       ;; display names.  Loop thru each keymap item
+                       ;; looking for an item whose display name is
+                       ;; after this product's name.
+                       (let ((next-item)
+                             (down-display (downcase display)))
+                         (map-keymap (lambda (k b)
+                                       (when (and (not next-item)
+                                                  (string-lessp down-display
+                                                                (downcase (cadr b))))
+                                         (setq next-item k)))
+                                     (easy-menu-get-map sql-mode-menu '("Product")))
+                         next-item))
+    product))
+
+(defun sql-del-product (product)
+  "Remove support for PRODUCT in `sql-mode'."
+
+  ;; Remove the menu item based on the display name
+  (easy-menu-remove-item sql-mode-menu '("Product") (sql-get-product-feature product :name))
+  ;; Remove the product alist item
+  (setq sql-product-alist (assq-delete-all product sql-product-alist))
+  nil)
+
+(defun sql-set-product-feature (product feature newvalue)
+  "Set FEATURE of database PRODUCT to NEWVALUE.
+
+The PRODUCT must be a symbol which identifies the database
+product.  The product must have already exist on the product
+list.  See `sql-add-product' to add new products.  The FEATURE
+argument must be a plist keyword accepted by
+`sql-product-alist'."
+
+  (let* ((p (assoc product sql-product-alist))
+         (v (plist-get (cdr p) feature)))
+    (if p
+        (if (and
+             (member feature sql-indirect-features)
+             (symbolp v))
+            (set v newvalue)
+          (setcdr p (plist-put (cdr p) feature newvalue)))
+      (message "`%s' is not a known product; use `sql-add-product' to add it first." product))))
+
+(defun sql-get-product-feature (product feature &optional fallback not-indirect)
+  "Lookup FEATURE associated with a SQL PRODUCT.
+
+If the FEATURE is nil for PRODUCT, and FALLBACK is specified,
+then the FEATURE associated with the FALLBACK product is
+returned.
+
+If the FEATURE is in the list `sql-indirect-features', and the
+NOT-INDIRECT parameter is not set, then the value of the symbol
+stored in the connect alist is returned.
 
 See `sql-product-alist' for a list of products and supported features."
-  (plist-get
-   (cdr (assoc (or product sql-product)
-              sql-product-alist))
-   feature))
+  (let* ((p (assoc product sql-product-alist))
+         (v (plist-get (cdr p) feature)))
+
+    (if p
+        ;; If no value and fallback, lookup feature for fallback
+        (if (and (not v)
+                 fallback
+                 (not (eq product fallback)))
+            (sql-get-product-feature fallback feature)
+
+          (if (and
+               (member feature sql-indirect-features)
+               (not not-indirect)
+               (symbolp v))
+              (symbol-value v)
+            v))
+      (message "`%s' is not a known product; use `sql-add-product' to add it first." product)
+      nil)))
 
 (defun sql-product-font-lock (keywords-only imenu)
-  "Sets `font-lock-defaults' and `font-lock-keywords' based on
-the product-specific keywords and syntax-alists defined in
-`sql-product-alist'."
+  "Configure font-lock and imenu with product-specific settings.
+
+The KEYWORDS-ONLY flag is passed to font-lock to specify whether
+only keywords should be hilighted and syntactic hilighting
+skipped.  The IMENU flag indicates whether `imenu-mode' should
+also be configured."
+
   (let
       ;; Get the product-specific syntax-alist.
       ((syntax-alist
        (append
-        (sql-product-feature :syntax-alist)
+        (sql-get-product-feature sql-product :syntax-alist)
         '((?_ . "w") (?. . "w")))))
 
     ;; Get the product-specific keywords.
     (setq sql-mode-font-lock-keywords
          (append
           (unless (eq sql-product 'ansi)
-            (eval (sql-product-feature :font-lock)))
+            (sql-get-product-feature sql-product :font-lock))
           ;; Always highlight ANSI keywords
-          (eval (sql-product-feature :font-lock 'ansi))
+          (sql-get-product-feature 'ansi :font-lock)
           ;; Fontify object names in CREATE, DROP and ALTER DDL
           ;; statements
           (list sql-mode-font-lock-object-name)))
 
     ;; Setup font-lock.  Force re-parsing of `font-lock-defaults'.
-    (set (make-local-variable 'font-lock-set-defaults) nil)
+    (kill-local-variable 'font-lock-set-defaults)
     (setq font-lock-defaults (list 'sql-mode-font-lock-keywords
                                   keywords-only t syntax-alist))
 
     ;; Force font lock to reinitialize if it is already on
     ;; Otherwise, we can wait until it can be started.
     (when (and (fboundp 'font-lock-mode)
+              (boundp 'font-lock-mode)
               font-lock-mode)
       (font-lock-mode-internal nil)
       (font-lock-mode-internal t))
@@ -1681,13 +2196,13 @@ the product-specific keywords and syntax-alists defined in
 
     ;; Setup imenu; it needs the same syntax-alist.
     (when imenu
-       (setq imenu-syntax-alist syntax-alist))))
+      (setq imenu-syntax-alist syntax-alist))))
 
 ;;;###autoload
 (defun sql-add-product-keywords (product keywords &optional append)
   "Add highlighting KEYWORDS for SQL PRODUCT.
 
-PRODUCT should be a symbol, the name of a sql product, such as
+PRODUCT should be a symbol, the name of a SQL product, such as
 `oracle'.  KEYWORDS should be a list; see the variable
 `font-lock-keywords'.  By default they are added at the beginning
 of the current highlighting list.  If optional argument APPEND is
@@ -1703,36 +2218,53 @@ For example:
 adds a fontification pattern to fontify identifiers ending in
 `_t' as data types."
 
-  (let ((font-lock (sql-product-feature :font-lock product))
-       old)
-    (setq old (eval font-lock))
-    (set font-lock
+  (let* ((sql-indirect-features nil)
+         (font-lock-var (sql-get-product-feature product :font-lock))
+         (old-val))
+
+    (setq old-val (symbol-value font-lock-var))
+    (set font-lock-var
         (if (eq append 'set)
             keywords
           (if append
-              (append old keywords)
-            (append keywords old))))))
+              (append old-val keywords)
+            (append keywords old-val))))))
+
+(defun sql-for-each-login (login-params body)
+  "Iterates through login parameters and returns a list of results."
+
+  (delq nil
+        (mapcar
+         (lambda (param)
+           (let ((token (or (and (listp param) (car param)) param))
+                 (type  (or (and (listp param) (nth 1 param)) nil))
+                 (arg   (or (and (listp param) (nth 2 param)) nil)))
+
+             (funcall body token type arg)))
+         login-params)))
 
 \f
 
 ;;; Functions to switch highlighting
 
 (defun sql-highlight-product ()
-  "Turn on the appropriate font highlighting for the SQL product selected."
+  "Turn on the font highlighting for the SQL product selected."
   (when (derived-mode-p 'sql-mode)
     ;; Setup font-lock
     (sql-product-font-lock nil t)
 
     ;; Set the mode name to include the product.
-    (setq mode-name (concat "SQL[" (prin1-to-string sql-product) "]"))))
+    (setq mode-name (concat "SQL[" (or (sql-get-product-feature sql-product :name)
+                                      (symbol-name sql-product)) "]"))))
 
 (defun sql-set-product (product)
-  "Set `sql-product' to product and enable appropriate highlighting."
+  "Set `sql-product' to PRODUCT and enable appropriate highlighting."
   (interactive
-   (list (completing-read "Enter SQL product: "
+   (list (completing-read "SQL product: "
                           (mapcar (lambda (info) (symbol-name (car info)))
                                   sql-product-alist)
-                          nil 'require-match)))
+                          nil 'require-match
+                          (or (and sql-product (symbol-name sql-product)) "ansi"))))
   (if (stringp product) (setq product (intern product)))
   (when (not (assoc product sql-product-alist))
     (error "SQL product %s is not supported; treated as ANSI" product)
@@ -1784,6 +2316,30 @@ the regular expression `comint-prompt-regexp', a buffer local variable."
     (newline))
   (indent-according-to-mode))
 
+(defun sql-help-list-products (indent freep)
+  "Generate listing of products available for use under SQLi.
+
+List products with :free-softare attribute set to FREEP.  Indent
+each line with INDENT."
+
+  (let (sqli-func doc)
+    (setq doc "")
+    (dolist (p sql-product-alist)
+      (setq sqli-func (intern (concat "sql-" (symbol-name (car p)))))
+
+      (if (and (fboundp sqli-func)
+              (eq (sql-get-product-feature (car p) :free-software) freep))
+       (setq doc
+             (concat doc
+                     indent
+                     (or (sql-get-product-feature (car p) :name)
+                         (symbol-name (car p)))
+                     ":\t"
+                     "\\["
+                     (symbol-name sqli-func)
+                     "]\n"))))
+    doc))
+
 ;;;###autoload
 (defun sql-help ()
   "Show short help for the SQL modes.
@@ -1793,24 +2349,17 @@ usually named `*SQL*'.  The name of the major mode is SQLi.
 
 Use the following commands to start a specific SQL interpreter:
 
-    PostGres: \\[sql-postgres]
-    MySQL: \\[sql-mysql]
-    SQLite: \\[sql-sqlite]
+    \\\\FREE
 
 Other non-free SQL implementations are also supported:
 
-    Solid: \\[sql-solid]
-    Oracle: \\[sql-oracle]
-    Informix: \\[sql-informix]
-    Sybase: \\[sql-sybase]
-    Ingres: \\[sql-ingres]
-    Microsoft: \\[sql-ms]
-    DB2: \\[sql-db2]
-    Interbase: \\[sql-interbase]
-    Linter: \\[sql-linter]
+    \\\\NONFREE
 
 But we urge you to choose a free implementation instead of these.
 
+You can also use \\[sql-product-interactive] to invoke the
+interpreter for the current `sql-product'.
+
 Once you have the SQLi buffer, you can enter SQL statements in the
 buffer.  The output generated is appended to the buffer and a new prompt
 is generated.  See the In/Out menu in the SQLi buffer for some functions
@@ -1825,12 +2374,68 @@ In this SQL buffer (SQL mode), you can send the region or the entire
 buffer to the interactive SQL buffer (SQLi mode).  The results are
 appended to the SQLi buffer without disturbing your SQL buffer."
   (interactive)
+
+  ;; Insert references to loaded products into the help buffer string
+  (let ((doc (documentation 'sql-help t))
+       changedp)
+    (setq changedp nil)
+
+    ;; Insert FREE software list
+    (when (string-match "^\\(\\s-*\\)[\\\\][\\\\]FREE\\s-*\n" doc 0)
+      (setq doc (replace-match (sql-help-list-products (match-string 1 doc) t)
+                              t t doc 0)
+           changedp t))
+
+    ;; Insert non-FREE software list
+    (when (string-match "^\\(\\s-*\\)[\\\\][\\\\]NONFREE\\s-*\n" doc 0)
+      (setq doc (replace-match (sql-help-list-products (match-string 1 doc) nil)
+                              t t doc 0)
+           changedp t))
+
+    ;; If we changed the help text, save the change so that the help
+    ;; sub-system will see it
+    (when changedp
+      (put 'sql-help 'function-documentation doc)))
+
+  ;; Call help on this function
   (describe-function 'sql-help))
 
 (defun sql-read-passwd (prompt &optional default)
   "Read a password using PROMPT.  Optional DEFAULT is password to start with."
   (read-passwd prompt nil default))
 
+(defun sql-get-login-ext (prompt last-value history-var type arg)
+  "Prompt user with extended login parameters.
+
+If TYPE is nil, then the user is simply prompted for a string
+value.
+
+If TYPE is `:file', then the user is prompted for a file
+name that must match the regexp pattern specified in the ARG
+argument.
+
+If TYPE is `:completion', then the user is prompted for a string
+specified by ARG.  (ARG is used as the PREDICATE argument to
+`completing-read'.)"
+  (cond
+   ((eq type nil)
+    (read-from-minibuffer prompt last-value nil nil history-var))
+
+   ((eq type :file)
+    (let ((use-dialog-box nil))
+      (expand-file-name
+       (read-file-name prompt
+                       (file-name-directory last-value) nil t
+                       (file-name-nondirectory last-value)
+                       (if arg
+                           `(lambda (f)
+                              (string-match (concat "\\<" ,arg "\\>")
+                                            (file-name-nondirectory f)))
+                         nil)))))
+
+   ((eq type :completion)
+    (completing-read prompt arg nil t last-value history-var))))
+
 (defun sql-get-login (&rest what)
   "Get username, password and database from the user.
 
@@ -1840,37 +2445,59 @@ Usernames, servers and databases are stored in `sql-user-history',
 `sql-server-history' and `database-history'.  Passwords are not stored
 in a history.
 
-Parameter WHAT is a list of the arguments passed to this function.
-The function asks for the username if WHAT contains symbol `user', for
-the password if it contains symbol `password', for the server if it
-contains symbol `server', and for the database if it contains symbol
-`database'.  The members of WHAT are processed in the order in which
-they are provided.
+Parameter WHAT is a list of tokens passed as arguments in the
+function call.  The function asks for the username if WHAT
+contains the symbol `user', for the password if it contains the
+symbol `password', for the server if it contains the symbol
+`server', and for the database if it contains the symbol
+`database'.  The members of WHAT are processed in the order in
+which they are provided.
+
+The tokens for `database' and `server' may also be lists to
+control or limit the values that can be supplied.  These can be
+of the form:
+
+  \(database :file \".+\\\\.EXT\")
+  \(database :completion FUNCTION)
+
+The `server' token supports the same forms.
 
 In order to ask the user for username, password and database, call the
 function like this: (sql-get-login 'user 'password 'database)."
   (interactive)
-  (while what
-    (cond
-     ((eq (car what) 'user)            ; user
-      (setq sql-user
-           (read-from-minibuffer "User: " sql-user nil nil
-                                 sql-user-history)))
-     ((eq (car what) 'password)                ; password
-      (setq sql-password
-           (sql-read-passwd "Password: " sql-password)))
-     ((eq (car what) 'server)          ; server
-      (setq sql-server
-           (read-from-minibuffer "Server: " sql-server nil nil
-                                 sql-server-history)))
-     ((eq (car what) 'database)                ; database
-      (setq sql-database
-           (read-from-minibuffer "Database: " sql-database nil nil
-                                 sql-database-history))))
-    (setq what (cdr what))))
+    (mapcar
+     (lambda (w)
+       (let ((token (or (and (listp w) (car w)) w))
+             (type  (or (and (listp w) (nth 1 w)) nil))
+             (arg   (or (and (listp w) (nth 2 w)) nil)))
+
+         (cond
+          ((eq token 'user)            ; user
+           (setq sql-user
+                 (read-from-minibuffer "User: " sql-user nil nil
+                                       'sql-user-history)))
+
+          ((eq token 'password)                ; password
+           (setq sql-password
+                 (sql-read-passwd "Password: " sql-password)))
+
+          ((eq token 'server)          ; server
+           (setq sql-server
+                 (sql-get-login-ext "Server: " sql-server
+                                    'sql-server-history type arg)))
+
+          ((eq token 'database)                ; database
+           (setq sql-database
+                 (sql-get-login-ext "Database: " sql-database
+                                    'sql-database-history type arg)))
+
+          ((eq token 'port)            ; port
+           (setq sql-port
+                 (read-number "Port: " sql-port))))))
+       what))
 
 (defun sql-find-sqli-buffer ()
-  "Return the current default SQLi buffer or nil.
+  "Returns the current default SQLi buffer or nil.
 In order to qualify, the SQLi buffer must be alive,
 be in `sql-interactive-mode' and have a process."
   (let ((default-buffer (default-value 'sql-buffer)))
@@ -1957,17 +2584,70 @@ variable `sql-buffer'.  See `sql-help' on how to create such a buffer."
   "Return a string that can be used to rename a SQLi buffer.
 
 This is used to set `sql-alternate-buffer-name' within
-`sql-interactive-mode'."
-  (concat (if (string= "" sql-user)
-             (if (string= "" (user-login-name))
-                 ()
-               (concat (user-login-name) "/"))
-           (concat sql-user "/"))
-         (if (string= "" sql-database)
-             (if (string= "" sql-server)
-                 (system-name)
-               sql-server)
-           sql-database)))
+`sql-interactive-mode'.
+
+If the session was started with `sql-connect' then the alternate
+name would be the name of the connection.
+
+Otherwise, it uses the parameters identified by the :sqlilogin
+parameter.
+
+If all else fails, the alternate name would be the user and
+server/database name."
+
+  (let ((name ""))
+
+    ;; Build a name using the :sqli-login setting
+    (setq name
+          (apply 'concat
+                 (cdr
+                  (apply 'append nil
+                         (sql-for-each-login
+                          (sql-get-product-feature sql-product :sqli-login)
+                          (lambda (token type arg)
+                            (cond
+                             ((eq token 'user)
+                              (unless (string= "" sql-user)
+                                (list "/" sql-user)))
+                             ((eq token 'port)
+                              (unless (= 0 sql-port)
+                                (list ":" sql-port)))
+                             ((eq token 'server)
+                              (unless (string= "" sql-server)
+                                (list "."
+                                      (if (eq type :file)
+                                          (file-name-nondirectory sql-server)
+                                        sql-server))))
+                             ((eq token 'database)
+                              (when (string= "" sql-database)
+                                (list "@"
+                                      (if (eq type :file)
+                                         (file-name-nondirectory sql-database)
+                                        sql-database))))
+
+                             ((eq token 'password) nil)
+                             (t                    nil))))))))
+
+    ;; If there's a connection, use it and the name thus far
+    (if sql-connection
+        (format "<%s>%s" sql-connection (or name ""))
+
+      ;; If there is no name, try to create something meaningful
+      (if (string= "" (or name ""))
+          (concat
+           (if (string= "" sql-user)
+               (if (string= "" (user-login-name))
+                   ()
+                 (concat (user-login-name) "/"))
+             (concat sql-user "/"))
+           (if (string= "" sql-database)
+               (if (string= "" sql-server)
+               (system-name)
+               sql-server)
+             sql-database))
+
+        ;; Use the name we've got
+        name))))
 
 (defun sql-rename-buffer ()
   "Rename a SQLi buffer."
@@ -1980,7 +2660,7 @@ Inserts SELECT or commas if appropriate."
   (interactive)
   (let ((column))
     (save-excursion
-      (setq column (buffer-substring
+      (setq column (buffer-substring-no-properties
                  (progn (forward-char 1) (backward-sexp 1) (point))
                  (progn (forward-sexp 1) (point))))
       (goto-char (point-max))
@@ -2011,62 +2691,143 @@ Inserts SELECT or commas if appropriate."
 (defvar sql-placeholder-history nil
   "History of placeholder values used.")
 
-(defun sql-query-placeholders-and-send (proc string)
-  "Send to PROC input STRING, maybe replacing placeholders.
-Placeholders are words starting with an ampersand like &this.
-This function is used for `comint-input-sender' if using
-`sql-oracle' on Windows."
-  (while (string-match "&\\(\\sw+\\)" string)
-    (setq string (replace-match
-                 (read-from-minibuffer
-                  (format "Enter value for %s: " (match-string 1 string))
-                  nil nil nil sql-placeholder-history)
-                 t t string)))
-  (comint-send-string proc string)
-  (if comint-input-sender-no-newline
-      (if (not (string-equal string ""))
-         (process-send-eof))
-    (comint-send-string proc "\n")))
+(defun sql-placeholders-filter (string)
+  "Replace placeholders in STRING.
+Placeholders are words starting with an ampersand like &this."
+
+  (when sql-oracle-scan-on
+    (while (string-match "&\\(\\sw+\\)" string)
+      (setq string (replace-match
+                   (read-from-minibuffer
+                    (format "Enter value for %s: " (match-string 1 string))
+                    nil nil nil 'sql-placeholder-history)
+                   t t string))))
+  string)
 
 ;; Using DB2 interactively, newlines must be escaped with " \".
 ;; The space before the backslash is relevant.
-(defun sql-escape-newlines-and-send (proc string)
-  "Send to PROC input STRING, escaping newlines if necessary.
+(defun sql-escape-newlines-filter (string)
+  "Escape newlines in STRING.
 Every newline in STRING will be preceded with a space and a backslash."
   (let ((result "") (start 0) mb me)
     (while (string-match "\n" string start)
       (setq mb (match-beginning 0)
-           me (match-end 0))
-      (if (and (> mb 1)
-              (string-equal " \\" (substring string (- mb 2) mb)))
-         (setq result (concat result (substring string start me)))
-       (setq result (concat result (substring string start mb) " \\\n")))
-      (setq start me))
-    (setq result (concat result (substring string start)))
-    (comint-send-string proc result)
-    (if comint-input-sender-no-newline
-       (if (not (string-equal string ""))
-           (process-send-eof))
-      (comint-send-string proc "\n"))))
+           me (match-end 0)
+           result (concat result
+                          (substring string start mb)
+                          (if (and (> mb 1)
+                                   (string-equal " \\" (substring string (- mb 2) mb)))
+                              "" " \\\n"))
+           start me))
+    (concat result (substring string start))))
 
 \f
 
+;;; Input sender for SQLi buffers
+
+(defvar sql-output-newline-count 0
+  "Number of newlines in the input string.
+
+Allows the suppression of continuation prompts.")
+
+(defvar sql-output-by-send nil
+  "Non-nil if the command in the input was generated by `sql-send-string'.")
+
+(defun sql-input-sender (proc string)
+  "Send STRING to PROC after applying filters."
+
+  (let* ((product (with-current-buffer (process-buffer proc) sql-product))
+        (filter  (sql-get-product-feature product :input-filter)))
+
+    ;; Apply filter(s)
+    (cond
+     ((not filter)
+      nil)
+     ((functionp filter)
+      (setq string (funcall filter string)))
+     ((listp filter)
+      (mapc (lambda (f) (setq string (funcall f string))) filter))
+     (t nil))
+
+    ;; Count how many newlines in the string
+    (setq sql-output-newline-count 0)
+    (mapc (lambda (ch)
+            (when (eq ch ?\n)
+              (setq sql-output-newline-count (1+ sql-output-newline-count))))
+          string)
+
+    ;; Send the string
+    (comint-simple-send proc string)))
+
+;;; Strip out continuation prompts
+
+(defun sql-interactive-remove-continuation-prompt (oline)
+  "Strip out continuation prompts out of the OLINE.
+
+Added to the `comint-preoutput-filter-functions' hook in a SQL
+interactive buffer.  If `sql-outut-newline-count' is greater than
+zero, then an output line matching the continuation prompt is filtered
+out.  If the count is one, then the prompt is replaced with a newline
+to force the output from the query to appear on a new line."
+  (if (and sql-prompt-cont-regexp
+           sql-output-newline-count
+           (numberp sql-output-newline-count)
+           (>= sql-output-newline-count 1))
+      (progn
+        (while (and oline
+                    sql-output-newline-count
+                    (> sql-output-newline-count 0)
+                    (string-match sql-prompt-cont-regexp oline))
+
+          (setq oline
+                (replace-match (if (and
+                                    (= 1 sql-output-newline-count)
+                                    sql-output-by-send)
+                                   "\n" "")
+                               nil nil oline)
+                sql-output-newline-count
+                (1- sql-output-newline-count)))
+        (if (= sql-output-newline-count 0)
+            (setq sql-output-newline-count nil))
+        (setq sql-output-by-send nil))
+    (setq sql-output-newline-count nil))
+  oline)
+
 ;;; Sending the region to the SQLi buffer.
 
+(defun sql-send-string (str)
+  "Send the string STR to the SQL process."
+  (interactive "sSQL Text: ")
+
+  (let ((comint-input-sender-no-newline nil)
+        (s (replace-regexp-in-string "[[:space:]\n\r]+\\'" "" str)))
+    (if (buffer-live-p sql-buffer)
+       (progn
+         ;; Ignore the hoping around...
+         (save-excursion
+           ;; Set product context
+           (with-current-buffer sql-buffer
+             ;; Send the string (trim the trailing whitespace)
+             (sql-input-sender (get-buffer-process sql-buffer) s)
+
+             ;; Send a command terminator if we must
+             (if sql-send-terminator
+                 (sql-send-magic-terminator sql-buffer s sql-send-terminator))
+
+             (message "Sent string to buffer %s." (buffer-name sql-buffer))))
+
+         ;; Display the sql buffer
+         (if sql-pop-to-buffer-after-send-region
+             (pop-to-buffer sql-buffer)
+           (display-buffer sql-buffer)))
+
+    ;; We don't have no stinkin' sql
+    (message "No SQL process started."))))
+
 (defun sql-send-region (start end)
   "Send a region to the SQL process."
   (interactive "r")
-  (if (buffer-live-p sql-buffer)
-      (save-excursion
-       (comint-send-region sql-buffer start end)
-       (if (string-match "\n$" (buffer-substring start end))
-           ()
-         (comint-send-string sql-buffer "\n"))
-       (message "Sent string to buffer %s." (buffer-name sql-buffer))
-       (if sql-pop-to-buffer-after-send-region
-           (pop-to-buffer sql-buffer)
-         (display-buffer sql-buffer)))
-    (message "No SQL process started.")))
+  (sql-send-string (buffer-substring-no-properties start end)))
 
 (defun sql-send-paragraph ()
   "Send the current paragraph to the SQL process."
@@ -2084,18 +2845,40 @@ Every newline in STRING will be preceded with a space and a backslash."
   (interactive)
   (sql-send-region (point-min) (point-max)))
 
-(defun sql-send-string (str)
-  "Send a string to the SQL process."
-  (interactive "sSQL Text: ")
-  (if (buffer-live-p sql-buffer)
-      (save-excursion
-        (comint-send-string sql-buffer str)
-        (comint-send-string sql-buffer "\n")
-        (message "Sent string to buffer %s." (buffer-name sql-buffer))
-        (if sql-pop-to-buffer-after-send-region
-            (pop-to-buffer sql-buffer)
-          (display-buffer sql-buffer)))
-    (message "No SQL process started.")))
+(defun sql-send-magic-terminator (buf str terminator)
+  "Send TERMINATOR to buffer BUF if its not present in STR."
+  (let (comint-input-sender-no-newline pat term)
+    ;; If flag is merely on(t), get product-specific terminator
+    (if (eq terminator t)
+       (setq terminator (sql-get-product-feature sql-product :terminator)))
+
+    ;; If there is no terminator specified, use default ";"
+    (unless terminator
+      (setq terminator ";"))
+
+    ;; Parse the setting into the pattern and the terminator string
+    (cond ((stringp terminator)
+          (setq pat (regexp-quote terminator)
+                term terminator))
+         ((consp terminator)
+          (setq pat (car terminator)
+                term (cdr terminator)))
+         (t
+          nil))
+
+    ;; Check to see if the pattern is present in the str already sent
+    (unless (and pat term
+                (string-match (concat pat "\\'") str))
+      (comint-simple-send (get-buffer-process buf) term)
+      (setq sql-output-newline-count
+            (if sql-output-newline-count
+                (1+ sql-output-newline-count)
+              1)))
+    (setq sql-output-by-send t)))
+
+(defun sql-remove-tabs-filter (str)
+  "Replace tab characters with spaces."
+  (replace-regexp-in-string "\t" " " str nil t))
 
 (defun sql-toggle-pop-to-buffer-after-send-region (&optional value)
   "Toggle `sql-pop-to-buffer-after-send-region'.
@@ -2106,7 +2889,7 @@ If given the optional parameter VALUE, sets
   (if value
       (setq sql-pop-to-buffer-after-send-region value)
     (setq sql-pop-to-buffer-after-send-region
-         (null sql-pop-to-buffer-after-send-region ))))
+         (null sql-pop-to-buffer-after-send-region))))
 
 \f
 
@@ -2249,24 +3032,29 @@ you entered, right above the output it created.
 \(setq comint-output-filter-functions
        \(function (lambda (STR) (comint-show-output))))"
   (delay-mode-hooks (comint-mode))
+
   ;; Get the `sql-product' for this interactive session.
   (set (make-local-variable 'sql-product)
        (or sql-interactive-product
           sql-product))
+
   ;; Setup the mode.
   (setq major-mode 'sql-interactive-mode)
-  (setq mode-name (concat "SQLi[" (prin1-to-string sql-product) "]"))
+  (setq mode-name (concat "SQLi[" (or (sql-get-product-feature sql-product :name)
+                                     (symbol-name sql-product)) "]"))
   (use-local-map sql-interactive-mode-map)
   (if sql-interactive-mode-menu
       (easy-menu-add sql-interactive-mode-menu)) ; XEmacs
   (set-syntax-table sql-mode-syntax-table)
   (make-local-variable 'sql-mode-font-lock-keywords)
   (make-local-variable 'font-lock-defaults)
+
   ;; Note that making KEYWORDS-ONLY nil will cause havoc if you try
   ;; SELECT 'x' FROM DUAL with SQL*Plus, because the title of the column
   ;; will have just one quote.  Therefore syntactic hilighting is
   ;; disabled for interactive buffers.  No imenu support.
   (sql-product-font-lock t nil)
+
   ;; Enable commenting and uncommenting of the region.
   (make-local-variable 'comment-start)
   (setq comment-start "--")
@@ -2276,21 +3064,35 @@ you entered, right above the output it created.
   (setq abbrev-all-caps 1)
   ;; Exiting the process will call sql-stop.
   (set-process-sentinel (get-buffer-process sql-buffer) 'sql-stop)
+  ;; Save the connection name
+  (make-local-variable 'sql-connection)
   ;; Create a usefull name for renaming this buffer later.
   (make-local-variable 'sql-alternate-buffer-name)
   (setq sql-alternate-buffer-name (sql-make-alternate-buffer-name))
   ;; User stuff.  Initialize before the hook.
   (set (make-local-variable 'sql-prompt-regexp)
-       (sql-product-feature :sqli-prompt-regexp))
+       (sql-get-product-feature sql-product :prompt-regexp))
   (set (make-local-variable 'sql-prompt-length)
-       (sql-product-feature :sqli-prompt-length))
+       (sql-get-product-feature sql-product :prompt-length))
+  (set (make-local-variable 'sql-prompt-cont-regexp)
+       (sql-get-product-feature sql-product :prompt-cont-regexp))
+  (make-local-variable 'sql-output-newline-count)
+  (make-local-variable 'sql-output-by-send)
+  (add-hook 'comint-preoutput-filter-functions
+            'sql-interactive-remove-continuation-prompt nil t)
   (make-local-variable 'sql-input-ring-separator)
   (make-local-variable 'sql-input-ring-file-name)
-  ;; Run hook.
+  ;; Run the mode hook (along with comint's hooks).
   (run-mode-hooks 'sql-interactive-mode-hook)
   ;; Set comint based on user overrides.
-  (setq comint-prompt-regexp sql-prompt-regexp)
+  (setq comint-prompt-regexp
+        (if sql-prompt-cont-regexp
+            (concat "\\(" sql-prompt-regexp
+                    "\\|" sql-prompt-cont-regexp "\\)")
+          sql-prompt-regexp))
   (setq left-margin sql-prompt-length)
+  ;; Install input sender
+  (set (make-local-variable 'comint-input-sender) 'sql-input-sender)
   ;; People wanting a different history file for each
   ;; buffer/process/client/whatever can change separator and file-name
   ;; on the sql-interactive-mode-hook.
@@ -2316,33 +3118,214 @@ Sentinels will always get the two parameters PROCESS and EVENT."
 
 \f
 
+;;; Connection handling
+
+;;;###autoload
+(defun sql-connect (connection)
+  "Connect to an interactive session using CONNECTION settings.
+
+See `sql-connection-alist' to see how to define connections and
+their settings.
+
+The user will not be prompted for any login parameters if a value
+is specified in the connection settings."
+
+  ;; Prompt for the connection from those defined in the alist
+  (interactive
+   (if sql-connection-alist
+       (list
+        (let ((completion-ignore-case t))
+          (completing-read "Connection: "
+                           (mapcar (lambda (c) (car c))
+                                   sql-connection-alist)
+                           nil t nil nil '(()))))
+     nil))
+
+  ;; Are there connections defined
+  (if sql-connection-alist
+      ;; Was one selected
+      (when connection
+        ;; Get connection settings
+        (let ((connect-set  (assoc connection sql-connection-alist)))
+          ;; Settings are defined
+          (if connect-set
+              ;; Set the desired parameters
+              (eval `(let*
+                         (,@(cdr connect-set)
+                          ;; :sqli-login params variable
+                          (param-var    (sql-get-product-feature sql-product
+                                                                 :sqli-login nil t))
+                          ;; :sqli-login params value
+                          (login-params (sql-get-product-feature sql-product
+                                                                 :sqli-login))
+                          ;; which params are in the connection
+                          (set-params   (mapcar
+                                         (lambda (v)
+                                           (cond
+                                            ((eq (car v) 'sql-user)     'user)
+                                            ((eq (car v) 'sql-password) 'password)
+                                            ((eq (car v) 'sql-server)   'server)
+                                            ((eq (car v) 'sql-database) 'database)
+                                            ((eq (car v) 'sql-port)     'port)
+                                            (t                          (car v))))
+                                         (cdr connect-set)))
+                          ;; the remaining params (w/o the connection params)
+                          (rem-params   (sql-for-each-login
+                                         login-params
+                                         (lambda (token type arg)
+                                           (unless (member token set-params)
+                                                    (if (or type arg)
+                                                        (list token type arg)
+                                                      token)))))
+                          ;; Remember the connection
+                          (sql-connection connection))
+
+                       ;; Set the remaining parameters and start the
+                       ;; interactive session
+                       (eval `(let ((,param-var ',rem-params))
+                                (sql-product-interactive sql-product)))))
+            (message "SQL Connection <%s> does not exist" connection)
+            nil)))
+    (message "No SQL Connections defined")
+    nil))
+
+(defun sql-save-connection (name)
+  "Captures the connection information of the current SQLi session.
+
+The information is appended to `sql-connection-alist' and
+optionally is saved to the user's init file."
+
+  (interactive "sNew connection name: ")
+
+  (if sql-connection
+      (message "This session was started by a connection; it's already been saved.")
+
+    (let ((login (sql-get-product-feature sql-product :sqli-login))
+          (alist sql-connection-alist)
+          connect)
+
+      ;; Remove the existing connection if the user says so
+      (when (and (assoc name alist)
+                 (yes-or-no-p (format "Replace connection definition <%s>? " name)))
+        (setq alist (assq-delete-all name alist)))
+
+      ;; Add the new connection if it doesn't exist
+      (if (assoc name alist)
+          (message "Connection <%s> already exists" name)
+        (setq connect
+              (append (list name)
+                      (sql-for-each-login
+                       `(product ,@login)
+                       (lambda (token type arg)
+                         (cond
+                          ((eq token 'product)  `(sql-product  ',sql-product))
+                          ((eq token 'user)     `(sql-user     ,sql-user))
+                          ((eq token 'database) `(sql-database ,sql-database))
+                          ((eq token 'server)   `(sql-server   ,sql-server))
+                          ((eq token 'port)     `(sql-port     ,sql-port)))))))
+
+        (setq alist (append alist (list connect)))
+
+        ;; confirm whether we want to save the connections
+        (if (yes-or-no-p "Save the connections for future sessions? ")
+            (customize-save-variable 'sql-connection-alist alist)
+          (customize-set-variable 'sql-connection-alist alist))))))
+
+(defun sql-connection-menu-filter (tail)
+  "Generates menu entries for using each connection."
+  (append
+   (mapcar
+    (lambda (conn)
+      (vector
+       (format "Connection <%s>" (car conn))
+       (list 'sql-connect (car conn))
+       t))
+    sql-connection-alist)
+   tail))
+
+\f
+
 ;;; Entry functions for different SQL interpreters.
 
 ;;;###autoload
 (defun sql-product-interactive (&optional product)
-  "Run product interpreter as an inferior process.
+  "Run PRODUCT interpreter as an inferior process.
 
 If buffer `*SQL*' exists but no process is running, make a new process.
 If buffer exists and a process is running, just switch to buffer `*SQL*'.
 
 \(Type \\[describe-mode] in the SQL buffer for a list of commands.)"
-  (interactive)
-  (setq product (or product sql-product))
-  (when (sql-product-feature :sqli-connect product)
-    (if (comint-check-proc "*SQL*")
-       (pop-to-buffer "*SQL*")
-      ;; Get credentials.
-      (apply 'sql-get-login (sql-product-feature :sqli-login product))
-      ;; Connect to database.
-      (message "Login...")
-      (funcall (sql-product-feature :sqli-connect product))
-      ;; Set SQLi mode.
-      (setq sql-interactive-product product)
-      (setq sql-buffer (current-buffer))
-      (sql-interactive-mode)
-      ;; All done.
-      (message "Login...done")
-      (pop-to-buffer sql-buffer))))
+  (interactive "P")
+
+  (setq product
+        (cond
+         ((equal product '(4))          ; Universal arg, prompt for product
+          (intern (completing-read "SQL product: "
+                                   (mapcar (lambda (info) (symbol-name (car info)))
+                                           sql-product-alist)
+                                   nil 'require-match
+                                   (or (and sql-product (symbol-name sql-product)) "ansi"))))
+         ((and product                  ; Product specified
+               (symbolp product)) product)
+         (t sql-product)))              ; Default to sql-product
+
+  (if product
+      (when (sql-get-product-feature product :sqli-comint-func)
+        (if (and sql-buffer
+                 (buffer-live-p sql-buffer)
+                 (comint-check-proc sql-buffer))
+            (pop-to-buffer sql-buffer)
+
+          ;; Is the current buffer in sql-mode and
+          ;; there is a buffer local setting of sql-buffer
+          (let* ((start-buffer
+                  (and (derived-mode-p 'sql-mode)
+                       (current-buffer)))
+                 (start-sql-buffer
+                  (and start-buffer
+                       (let (found)
+                         (dolist (var (buffer-local-variables))
+                           (and (consp var)
+                                (eq (car var) 'sql-buffer)
+                                (buffer-live-p (cdr var))
+                                (get-buffer-process (cdr var))
+                                (setq found (cdr var))))
+                         found)))
+                 new-sqli-buffer)
+
+            ;; Get credentials.
+            (apply 'sql-get-login (sql-get-product-feature product :sqli-login))
+
+            ;; Connect to database.
+            (message "Login...")
+            (funcall (sql-get-product-feature product :sqli-comint-func)
+                     product
+                     (sql-get-product-feature product :sqli-options))
+
+            ;; Set SQLi mode.
+            (setq sql-interactive-product product
+                  new-sqli-buffer (current-buffer)
+                  sql-buffer new-sqli-buffer)
+            (sql-interactive-mode)
+
+            ;; Set `sql-buffer' in the start buffer
+            (when (and start-buffer (not start-sql-buffer))
+              (with-current-buffer start-buffer
+                (setq sql-buffer new-sqli-buffer)))
+
+            ;; All done.
+            (message "Login...done")
+            (pop-to-buffer sql-buffer))))
+    (message "No default SQL product defined.  Set `sql-product'.")))
+
+(defun sql-comint (product params)
+  "Set up a comint buffer to run the SQL processor.
+
+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)))
+    (set-buffer
+     (apply 'make-comint "SQL" program nil params))))
 
 ;;;###autoload
 (defun sql-oracle ()
@@ -2371,33 +3354,29 @@ The default comes from `process-coding-system-alist' and
   (interactive)
   (sql-product-interactive 'oracle))
 
-(defun sql-connect-oracle ()
-  "Create comint buffer and connect to Oracle using the login
-parameters and command options."
+(defun sql-comint-oracle (product options)
+  "Create comint buffer and connect to Oracle."
   ;; Produce user/password@database construct.  Password without user
   ;; is meaningless; database without user/password is meaningless,
   ;; because "@param" will ask sqlplus to interpret the script
   ;; "param".
-  (let ((parameter
-         (if (not (string= "" sql-user))
-             (if (not (string= "" sql-password))
-                 (concat sql-user "/" sql-password)
-               sql-user))))
+  (let ((parameter nil))
+    (if (not (string= "" sql-user))
+       (if (not (string= "" sql-password))
+           (setq parameter (concat sql-user "/" sql-password))
+         (setq parameter sql-user)))
     (if (and parameter (not (string= "" sql-database)))
        (setq parameter (concat parameter "@" sql-database)))
-    (setq parameter (if parameter
-                        (nconc (list parameter) sql-oracle-options)
-                      sql-oracle-options))
-    (set-buffer (apply 'make-comint "SQL" sql-oracle-program nil parameter))
-    ;; SQL*Plus is buffered on Windows; this handles &placeholders.
-    (if (eq window-system 'w32)
-       (setq comint-input-sender 'sql-query-placeholders-and-send))))
+    (if parameter
+       (setq parameter (nconc (list parameter) options))
+      (setq parameter options))
+    (sql-comint product parameter)))
 
 \f
 
 ;;;###autoload
 (defun sql-sybase ()
-  "Run isql by SyBase as an inferior process.
+  "Run isql by Sybase as an inferior process.
 
 If buffer `*SQL*' exists but no process is running, make a new process.
 If buffer exists and a process is running, just switch to buffer
@@ -2422,12 +3401,11 @@ The default comes from `process-coding-system-alist' and
   (interactive)
   (sql-product-interactive 'sybase))
 
-(defun sql-connect-sybase ()
-  "Create comint buffer and connect to Sybase using the login
-parameters and command options."
+(defun sql-comint-sybase (product options)
+  "Create comint buffer and connect to Sybase."
   ;; Put all parameters to the program (if defined) in a list and call
   ;; make-comint.
-  (let ((params sql-sybase-options))
+  (let ((params options))
     (if (not (string= "" sql-server))
        (setq params (append (list "-S" sql-server) params)))
     (if (not (string= "" sql-database))
@@ -2436,8 +3414,7 @@ parameters and command options."
        (setq params (append (list "-P" sql-password) params)))
     (if (not (string= "" sql-user))
        (setq params (append (list "-U" sql-user) params)))
-    (set-buffer (apply 'make-comint "SQL" sql-sybase-program
-                      nil params))))
+    (sql-comint product params)))
 
 \f
 
@@ -2466,13 +3443,15 @@ The default comes from `process-coding-system-alist' and
   (interactive)
   (sql-product-interactive 'informix))
 
-(defun sql-connect-informix ()
-  "Create comint buffer and connect to Informix using the login
-parameters and command options."
+(defun sql-comint-informix (product options)
+  "Create comint buffer and connect to Informix."
   ;; username and password are ignored.
-  (set-buffer (if (string= "" sql-database)
-                  (make-comint "SQL" sql-informix-program nil)
-                (make-comint "SQL" sql-informix-program nil sql-database "-"))))
+  (let ((db (if (string= "" sql-database)
+               "-"
+             (if (string= "" sql-server)
+                 sql-database
+               (concat sql-database "@" sql-server)))))
+    (sql-comint product (append `(,db "-") options))))
 
 \f
 
@@ -2505,18 +3484,16 @@ The default comes from `process-coding-system-alist' and
   (interactive)
   (sql-product-interactive 'sqlite))
 
-(defun sql-connect-sqlite ()
-  "Create comint buffer and connect to SQLite using the login
-parameters and command options."
+(defun sql-comint-sqlite (product options)
+  "Create comint buffer and connect to SQLite."
   ;; Put all parameters to the program (if defined) in a list and call
   ;; make-comint.
   (let ((params))
     (if (not (string= "" sql-database))
-       (setq params (append (list sql-database) params)))
-    (if (not (null sql-sqlite-options))
-       (setq params (append sql-sqlite-options params)))
-    (set-buffer (apply 'make-comint "SQL" sql-sqlite-program
-                      nil params))))
+       (setq params (append (list (expand-file-name sql-database))
+                             params)))
+    (setq params (append options params))
+    (sql-comint product params)))
 
 \f
 
@@ -2549,9 +3526,8 @@ The default comes from `process-coding-system-alist' and
   (interactive)
   (sql-product-interactive 'mysql))
 
-(defun sql-connect-mysql ()
-  "Create comint buffer and connect to MySQL using the login
-parameters and command options."
+(defun sql-comint-mysql (product options)
+  "Create comint buffer and connect to MySQL."
   ;; Put all parameters to the program (if defined) in a list and call
   ;; make-comint.
   (let ((params))
@@ -2559,14 +3535,14 @@ parameters and command options."
        (setq params (append (list sql-database) params)))
     (if (not (string= "" sql-server))
        (setq params (append (list (concat "--host=" sql-server)) params)))
+    (if (and sql-port (numberp sql-port))
+       (setq params (append (list (concat "--port=" (number-to-string sql-port))) params)))
     (if (not (string= "" sql-password))
        (setq params (append (list (concat "--password=" sql-password)) params)))
     (if (not (string= "" sql-user))
        (setq params (append (list (concat "--user=" sql-user)) params)))
-    (if (not (null sql-mysql-options))
-       (setq params (append sql-mysql-options params)))
-    (set-buffer (apply 'make-comint "SQL" sql-mysql-program
-                      nil params))))
+    (setq params (append options params))
+    (sql-comint product params)))
 
 \f
 
@@ -2596,20 +3572,18 @@ The default comes from `process-coding-system-alist' and
   (interactive)
   (sql-product-interactive 'solid))
 
-(defun sql-connect-solid ()
-  "Create comint buffer and connect to Solid using the login
-parameters and command options."
+(defun sql-comint-solid (product options)
+  "Create comint buffer and connect to Solid."
   ;; Put all parameters to the program (if defined) in a list and call
   ;; make-comint.
-  (let ((params))
+  (let ((params options))
     ;; It only makes sense if both username and password are there.
     (if (not (or (string= "" sql-user)
                 (string= "" sql-password)))
        (setq params (append (list sql-user sql-password) params)))
     (if (not (string= "" sql-server))
        (setq params (append (list sql-server) params)))
-    (set-buffer (apply 'make-comint "SQL" sql-solid-program
-                      nil params))))
+    (sql-comint product params)))
 
 \f
 
@@ -2638,13 +3612,14 @@ The default comes from `process-coding-system-alist' and
   (interactive)
   (sql-product-interactive 'ingres))
 
-(defun sql-connect-ingres ()
-  "Create comint buffer and connect to Ingres using the login
-parameters and command options."
+(defun sql-comint-ingres (product options)
+  "Create comint buffer and connect to Ingres."
   ;; username and password are ignored.
-  (set-buffer (if (string= "" sql-database)
-                  (make-comint "SQL" sql-ingres-program nil)
-                (make-comint "SQL" sql-ingres-program nil sql-database))))
+  (sql-comint product
+               (append (if (string= "" sql-database)
+                           nil
+                         (list sql-database))
+                       options)))
 
 \f
 
@@ -2675,12 +3650,11 @@ The default comes from `process-coding-system-alist' and
   (interactive)
   (sql-product-interactive 'ms))
 
-(defun sql-connect-ms ()
-  "Create comint buffer and connect to Microsoft using the login
-parameters and command options."
+(defun sql-comint-ms (product options)
+  "Create comint buffer and connect to Microsoft SQL Server."
   ;; Put all parameters to the program (if defined) in a list and call
   ;; make-comint.
-  (let ((params sql-ms-options))
+  (let ((params options))
     (if (not (string= "" sql-server))
         (setq params (append (list "-S" sql-server) params)))
     (if (not (string= "" sql-database))
@@ -2696,8 +3670,7 @@ parameters and command options."
        ;; If -P is passed to ISQL as the last argument without a
        ;; password, it's considered null.
        (setq params (append params (list "-P")))))
-    (set-buffer (apply 'make-comint "SQL" sql-ms-program
-                      nil params))))
+    (sql-comint product params)))
 
 \f
 
@@ -2733,23 +3706,21 @@ Try to set `comint-output-filter-functions' like this:
   (interactive)
   (sql-product-interactive 'postgres))
 
-(defun sql-connect-postgres ()
-  "Create comint buffer and connect to Postgres using the login
-parameters and command options."
+(defun sql-comint-postgres (product options)
+  "Create comint buffer and connect to Postgres."
   ;; username and password are ignored.  Mark Stosberg suggest to add
   ;; the database at the end.  Jason Beegan suggest using --pset and
   ;; pager=off instead of \\o|cat.  The later was the solution by
   ;; Gregor Zych.  Jason's suggestion is the default value for
   ;; sql-postgres-options.
-  (let ((params sql-postgres-options))
+  (let ((params options))
     (if (not (string= "" sql-database))
        (setq params (append params (list sql-database))))
     (if (not (string= "" sql-server))
        (setq params (append (list "-h" sql-server) params)))
     (if (not (string= "" sql-user))
        (setq params (append (list "-U" sql-user) params)))
-    (set-buffer (apply 'make-comint "SQL" sql-postgres-program
-                      nil params))))
+    (sql-comint product params)))
 
 \f
 
@@ -2779,20 +3750,18 @@ The default comes from `process-coding-system-alist' and
   (interactive)
   (sql-product-interactive 'interbase))
 
-(defun sql-connect-interbase ()
-  "Create comint buffer and connect to Interbase using the login
-parameters and command options."
+(defun sql-comint-interbase (product options)
+  "Create comint buffer and connect to Interbase."
   ;; Put all parameters to the program (if defined) in a list and call
   ;; make-comint.
-  (let ((params sql-interbase-options))
+  (let ((params options))
     (if (not (string= "" sql-user))
        (setq params (append (list "-u" sql-user) params)))
     (if (not (string= "" sql-password))
        (setq params (append (list "-p" sql-password) params)))
     (if (not (string= "" sql-database))
         (setq params (cons sql-database params))) ; add to the front!
-    (set-buffer (apply 'make-comint "SQL" sql-interbase-program
-                      nil params))))
+    (sql-comint product params)))
 
 \f
 
@@ -2826,15 +3795,14 @@ The default comes from `process-coding-system-alist' and
   (interactive)
   (sql-product-interactive 'db2))
 
-(defun sql-connect-db2 ()
-  "Create comint buffer and connect to DB2 using the login
-parameters and command options."
+(defun sql-comint-db2 (product options)
+  "Create comint buffer and connect to DB2."
   ;; Put all parameters to the program (if defined) in a list and call
   ;; make-comint.
-  (set-buffer (apply 'make-comint "SQL" sql-db2-program
-                    nil sql-db2-options))
-  ;; Properly escape newlines when DB2 is interactive.
-  (setq comint-input-sender 'sql-escape-newlines-and-send))
+  (sql-comint product options)
+)
+;;   ;; Properly escape newlines when DB2 is interactive.
+;;   (setq comint-input-sender 'sql-escape-newlines-and-send))
 
 ;;;###autoload
 (defun sql-linter ()
@@ -2847,7 +3815,7 @@ If buffer exists and a process is running, just switch to buffer
 Interpreter used comes from variable `sql-linter-program' - usually `inl'.
 Login uses the variables `sql-user', `sql-password', `sql-database' and
 `sql-server' as defaults, if set.  Additional command line parameters
-can be stored in the list `sql-linter-options'. Run inl -h to get help on
+can be stored in the list `sql-linter-options'.  Run inl -h to get help on
 parameters.
 
 `sql-database' is used to set the LINTER_MBX environment variable for
@@ -2863,12 +3831,13 @@ input.  See `sql-interactive-mode'.
   (interactive)
   (sql-product-interactive 'linter))
 
-(defun sql-connect-linter ()
-  "Create comint buffer and connect to Linter using the login
-parameters and command options."
+(defun sql-comint-linter (product options)
+  "Create comint buffer and connect to Linter."
   ;; Put all parameters to the program (if defined) in a list and call
   ;; make-comint.
-  (let ((params sql-linter-options) (login nil) (old-mbx (getenv "LINTER_MBX")))
+  (let ((params options)
+        (login nil)
+        (old-mbx (getenv "LINTER_MBX")))
     (if (not (string= "" sql-user))
        (setq login (concat sql-user "/" sql-password)))
     (setq params (append (list "-u" login) params))
@@ -2877,8 +3846,7 @@ parameters and command options."
     (if (string= "" sql-database)
        (setenv "LINTER_MBX" nil)
       (setenv "LINTER_MBX" sql-database))
-    (set-buffer (apply 'make-comint "SQL" sql-linter-program nil
-                      params))
+    (sql-comint product params)
     (setenv "LINTER_MBX" old-mbx)))
 
 \f
@@ -2887,3 +3855,4 @@ parameters and command options."
 
 ;; arch-tag: 7e1fa1c4-9ca2-402e-87d2-83a5eccb7ac3
 ;;; sql.el ends here
+
index 4081791ae2e8474188ef2ad06e0d7742cd562fb4..7df42c8b9a2585c53babb639f72c534bc6e63a14 100644 (file)
@@ -76,7 +76,7 @@
 ;; the old `c-forward-into-nomenclature' originally contributed by
 ;; Terry_Glanfield dot Southern at rxuk dot xerox dot com.
 
-;; TODO: ispell-word and subword oriented C-w in isearch.
+;; TODO: ispell-word.
 
 ;;; Code:
 
index 58b8be8c7ba8e6fad46c48594ce48b6dd6132973..29096a23046d467f39eab5c21007c8360b9308e2 100644 (file)
@@ -545,7 +545,7 @@ Uses variables `tcl-proc-regexp' and `tcl-keyword-list'."
 ;;
 
 ;;;###autoload
-(define-derived-mode tcl-mode nil "Tcl"
+(define-derived-mode tcl-mode prog-mode "Tcl"
   "Major mode for editing Tcl code.
 Expression and list commands understand all Tcl brackets.
 Tab indents for Tcl code.
index 4a704b0416cf1e57dc1d3d58aef1f35ddfcca63c..5e7699b35435145f6336d7841b3a15281b559a1d 100644 (file)
@@ -79,7 +79,7 @@
 ;; .emacs, or in your site's site-load.el
 
 ; (autoload 'verilog-mode "verilog-mode" "Verilog mode" t )
-; (add-to-list 'auto-mode-alist '("\\.[ds]?v\\'" . verilog-mode))
+; (add-to-list 'auto-mode-alist '("\\.[ds]?vh?\\'" . verilog-mode))
 
 ;; If you want to customize Verilog mode to fit your needs better,
 ;; you may add these lines (the values of the variables presented
 ;;; Code:
 
 ;; This variable will always hold the version number of the mode
-(defconst verilog-mode-version "556"
+(defconst verilog-mode-version "565"
   "Version of this Verilog mode.")
-(defconst verilog-mode-release-date "2009-12-10-GNU"
+(defconst verilog-mode-release-date "2010-03-01-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.")
@@ -2116,7 +2116,8 @@ find the errors."
      `(
        "endmodule" "endprimitive" "endinterface" "endpackage" "endprogram" "endclass"
        ))))
-(defconst verilog-disable-fork-re "disable\\s-+fork")
+(defconst verilog-disable-fork-re "disable\\s-+fork\\>")
+(defconst verilog-fork-wait-re "fork\\s-+wait\\>")
 (defconst verilog-extended-case-re "\\(unique\\s-+\\|priority\\s-+\\)?case[xz]?")
 (defconst verilog-extended-complete-re
   (concat "\\(\\<extern\\s-+\\|\\<virtual\\s-+\\|\\<protected\\s-+\\)*\\(\\<function\\>\\|\\<task\\>\\)"
@@ -2198,6 +2199,11 @@ find the errors."
      "unique" "unsigned" "use" "uwire" "var" "vectored" "virtual" "void"
      "wait" "wait_order" "wand" "weak0" "weak1" "while" "wildcard"
      "wire" "with" "within" "wor" "xnor" "xor"
+     ;; 1800-2009
+     "accept_on" "checker" "endchecker" "eventually" "global" "implies"
+     "let" "nexttime" "reject_on" "restrict" "s_always" "s_eventually"
+     "s_nexttime" "s_until" "s_until_with" "strong" "sync_accept_on"
+     "sync_reject_on" "unique0" "until" "until_with" "untyped" "weak"
  )
  "List of Verilog keywords.")
 
@@ -2314,7 +2320,7 @@ See also `verilog-font-lock-extra-types'.")
             "and" "bit" "buf" "bufif0" "bufif1" "cmos" "defparam"
             "event" "genvar" "inout" "input" "integer" "localparam"
             "logic" "mailbox" "nand" "nmos" "not" "notif0" "notif1" "or"
-            "output" "parameter" "pmos" "pull0" "pull1" "pullup"
+            "output" "parameter" "pmos" "pull0" "pull1" "pulldown" "pullup"
             "rcmos" "real" "realtime" "reg" "rnmos" "rpmos" "rtran"
             "rtranif0" "rtranif1" "semaphore" "signed" "struct" "supply"
             "supply0" "supply1" "time" "tran" "tranif0" "tranif1"
@@ -2328,7 +2334,7 @@ See also `verilog-font-lock-extra-types'.")
           '("surefire" "synopsys" "rtl_synthesis" "verilint" "leda" "0in") nil
            )))
 
-       (verilog-p1800-keywords
+       (verilog-1800-2005-keywords
        (eval-when-compile
          (verilog-regexp-opt
           '("alias" "assert" "assume" "automatic" "before" "bind"
@@ -2352,6 +2358,15 @@ See also `verilog-font-lock-extra-types'.")
             "wait_order" "weak0" "weak1" "wildcard" "with" "within"
             ) nil )))
 
+       (verilog-1800-2009-keywords
+       (eval-when-compile
+         (verilog-regexp-opt
+          '("accept_on" "checker" "endchecker" "eventually" "global"
+            "implies" "let" "nexttime" "reject_on" "restrict" "s_always"
+            "s_eventually" "s_nexttime" "s_until" "s_until_with" "strong"
+            "sync_accept_on" "sync_reject_on" "unique0" "until"
+            "until_with" "untyped" "weak" ) nil )))
+
        (verilog-ams-keywords
        (eval-when-compile
          (verilog-regexp-opt
@@ -2403,11 +2418,17 @@ See also `verilog-font-lock-extra-types'.")
                 'font-lock-type-face))
         (cons (concat "\\<\\(" verilog-type-font-keywords "\\)\\>")
           'font-lock-type-face)
-        ;; Fontify IEEE-P1800 keywords appropriately
+        ;; Fontify IEEE-1800-2005 keywords appropriately
         (if verilog-highlight-p1800-keywords
-            (cons (concat "\\<\\(" verilog-p1800-keywords "\\)\\>")
+            (cons (concat "\\<\\(" verilog-1800-2005-keywords "\\)\\>")
                   'verilog-font-lock-p1800-face)
-          (cons (concat "\\<\\(" verilog-p1800-keywords "\\)\\>")
+          (cons (concat "\\<\\(" verilog-1800-2005-keywords "\\)\\>")
+                'font-lock-type-face))
+        ;; Fontify IEEE-1800-2009 keywords appropriately
+        (if verilog-highlight-p1800-keywords
+            (cons (concat "\\<\\(" verilog-1800-2009-keywords "\\)\\>")
+                  'verilog-font-lock-p1800-face)
+          (cons (concat "\\<\\(" verilog-1800-2009-keywords "\\)\\>")
                 'font-lock-type-face))
         ;; Fontify Verilog-AMS keywords
         (cons (concat "\\<\\(" verilog-ams-keywords "\\)\\>")
@@ -2580,20 +2601,28 @@ Use filename, if current buffer being edited shorten to just buffer name."
        (setq md 3) ;; ender is third item in regexp
        )
        ((match-end 4)
-       ;; might be "disable fork"
-       (if (or
-            (looking-at verilog-disable-fork-re)
-            (and (looking-at "fork")
-                 (progn
-                   (forward-word -1)
-                   (looking-at verilog-disable-fork-re))))
-           (progn
-             (goto-char (match-end 0))
-             (forward-word 1)
-             (setq reg nil))
-         (progn
-           ;; Search forward for matching join
-           (setq reg "\\(\\<fork\\>\\)\\|\\(\\<join\\(_any\\|_none\\)?\\>\\)" ))))
+       ;; might be "disable fork" or "fork wait"
+       (let
+           (here)
+         (if (looking-at verilog-fork-wait-re)
+             (progn  ;; it is a fork wait; ignore it
+               (goto-char (match-end 0))
+               (setq reg nil))
+           (if (or
+                (looking-at verilog-disable-fork-re)
+                (and (looking-at "fork")
+                     (progn
+                       (setq here (point)) ;; sometimes a fork is just a fork
+                       (forward-word -1)
+                       (looking-at verilog-disable-fork-re))))
+               (progn ;; it is a disable fork; ignore it
+                 (goto-char (match-end 0))
+                 (forward-word 1)
+                 (setq reg nil))
+             (progn ;; it is a nice simple fork
+               (goto-char here)   ;; return from looking for "disable fork"
+               ;; Search forward for matching join
+               (setq reg "\\(\\<fork\\>\\)\\|\\(\\<join\\(_any\\|_none\\)?\\>\\)" ))))))
        ((match-end 6)
        ;; Search forward for matching endclass
        (setq reg "\\(\\<class\\>\\)\\|\\(\\<endclass\\>\\)" ))
@@ -2641,15 +2670,31 @@ Use filename, if current buffer being edited shorten to just buffer name."
               (forward-word 1))
          (catch 'skip
            (if (eq nest 'yes)
-               (let ((depth 1))
+               (let ((depth 1)
+                     here)
                  (while (verilog-re-search-forward reg nil 'move)
                    (cond
-                    ((match-end md) ; the closer in reg, so we are climbing out
+                    ((match-end md) ; a closer in regular expression, so we are climbing out
                      (setq depth (1- depth))
                      (if (= 0 depth) ; we are out!
                          (throw 'skip 1)))
-                    ((match-end 1) ; the opener in reg, so we are deeper now
-                     (setq depth (1+ depth))))))
+                    ((match-end 1) ; an opener in the r-e, so we are in deeper now
+                     (setq here (point)) ; remember where we started
+                     (goto-char (match-beginning 1))
+                     (cond
+                      ((looking-at verilog-fork-wait-re)
+                       (goto-char (match-end 0))) ; false alarm
+                      ((if (or
+                            (looking-at verilog-disable-fork-re)
+                            (and (looking-at "fork")
+                                 (progn
+                                   (forward-word -1)
+                                   (looking-at verilog-disable-fork-re))))
+                           (progn ;; it is a disable fork; another false alarm
+                             (goto-char (match-end 0)))
+                         (progn ;; it is a simple fork (or has nothing to do with fork)
+                           (goto-char here)
+                           (setq depth (1+ depth))))))))))
              (if (verilog-re-search-forward reg nil 'move)
                  (throw 'skip 1))))))
 
@@ -4532,8 +4577,9 @@ Return a list of two elements: (INDENT-TYPE INDENT-LEVEL)."
             ((match-end 4)  ; *sigh* could be "disable fork"
              (let ((here (point)))
                (verilog-beg-of-statement)
-               (if (looking-at verilog-disable-fork-re)
-                   t ; is disable fork, this is a normal statement
+               (if (or (looking-at verilog-disable-fork-re)
+                       (looking-at verilog-fork-wait-re))
+                   t ; this is a normal statement
                  (progn ; or is fork, starts a new block
                    (goto-char here)
                    (throw 'nesting 'block)))))
@@ -4882,31 +4928,13 @@ Set point to where line starts."
          (goto-char back)
          t))))))))
 
-(defun verilog-backward-syntactic-ws (&optional bound)
-  "Backward skip over syntactic whitespace for Emacs 19.
-Optional BOUND limits search."
-  (save-restriction
-    (let* ((bound (or bound (point-min))) (here bound) )
-      (if (< bound (point))
-         (progn
-           (narrow-to-region bound (point))
-           (while (/= here (point))
-             (setq here (point))
-             (verilog-skip-backward-comments))))))
-  t)
+(defun verilog-backward-syntactic-ws ()
+  (verilog-skip-backward-comments)
+  (forward-comment (- (buffer-size))))
 
-(defun verilog-forward-syntactic-ws (&optional bound)
-  "Forward skip over syntactic whitespace for Emacs 19.
-Optional BOUND limits search."
-  (save-restriction
-    (let* ((bound (or bound (point-max)))
-          (here bound))
-      (if (> bound (point))
-         (progn
-           (narrow-to-region (point) bound)
-           (while (/= here (point))
-             (setq here (point))
-             (forward-comment (buffer-size))))))))
+(defun verilog-forward-syntactic-ws ()
+  (verilog-skip-forward-comment-p)
+  (forward-comment (buffer-size)))
 
 (defun verilog-backward-ws&directives (&optional bound)
   "Backward skip over syntactic whitespace and compiler directives for Emacs 19.
@@ -5119,14 +5147,11 @@ Optional BOUND limits search."
               (search-backward "/*")
               (skip-chars-backward " \t\n\f")
               t)
-             ((and (not (bobp))
-                   (= (char-before) ?\/)
-                   (= (char-before (1- (point))) ?\*))
-              (goto-char (- (point) 2))
-              t)
-             (t
-              (skip-chars-backward " \t\n\f")
-              nil)))))))
+             ((if (and (not (bobp))
+                       (= (char-before) ?\/)
+                       (= (char-before (1- (point))) ?\*))
+                  (goto-char (- (point) 2))
+                (/= (skip-chars-backward " \t\n\f") 0)))))))))
 
 (defun verilog-skip-forward-comment-p ()
   "If in comment, move to end and return true."
@@ -5134,16 +5159,18 @@ Optional BOUND limits search."
     (progn
       (setq state (save-excursion (verilog-syntax-ppss)))
       (cond
-       ((nth 3 state)
+       ((nth 3 state)                   ;Inside string
        t)
        ((nth 7 state)                  ;Inside // comment
        (end-of-line)
        (forward-char 1)
        t)
        ((nth 4 state)                  ;Inside any comment
+       (search-forward "*/")
+       (skip-chars-forward " \t\n\f")
        t)
        (t
-       nil)))))
+       (skip-chars-forward " \t\n\f"))))))
 
 (defun verilog-indent-line-relative ()
   "Cheap version of indent line.
@@ -5376,108 +5403,143 @@ ARG is ignored, for `comment-indent-function' compatibility."
   "Line up declarations around point.
 Be verbose about progress unless optional QUIET set."
   (interactive)
-  (save-excursion
-    (if (progn
-          (verilog-beg-of-statement-1)
-          (and (not (verilog-in-directive-p)) ;; could have `define input foo
-               (not (verilog-parenthesis-depth)) ;; could be in a #(param block  )
+  (let* ((m1 (make-marker))
+         (e (point))
+        el
+         r
+        (here (point))
+         ind
+         start
+         startpos
+         end
+         endpos
+         base-ind
+         )
+    (save-excursion
+      (if (progn
+;          (verilog-beg-of-statement-1)
+          (beginning-of-line)
+          (verilog-forward-syntactic-ws)          
+          (and (not (verilog-in-directive-p))    ;; could have `define input foo
                (looking-at verilog-declaration-re)))
-        (let* ((m1 (make-marker))
-               (e (point))
-               (r)
-               (here (point))
-               ;; Start of declaration range
-               (start
-                (progn
-                  (verilog-beg-of-statement-1)
-                  (while (and (looking-at verilog-declaration-re)
-                              (not (bobp)))
-                    (skip-chars-backward " \t")
-                    (setq e (point))
-                    (beginning-of-line)
-                    (verilog-backward-syntactic-ws)
-                    (backward-char)
-                    (verilog-beg-of-statement-1))
-                  e))
-               ;; End of declaration range
-               (end
-                (progn
-                  (goto-char here)
-                  (verilog-end-of-statement)
-                  (setq e (point))     ;Might be on last line
-                  (verilog-forward-syntactic-ws)
-                  (while (looking-at verilog-declaration-re)
-                    ;;(beginning-of-line)
-                    (verilog-end-of-statement)
-                    (setq e (point))
-                    (verilog-forward-syntactic-ws))
-                  e))
-               (edpos (set-marker (make-marker) end))
-               (ind)
-               (base-ind
-                (progn
-                  (goto-char start)
-                  (verilog-do-indent (verilog-calculate-indent))
-                  (verilog-forward-ws&directives)
-                  (current-column))))
-          (goto-char start)
-          (if (and (not quiet)
-                   (> (- end start) 100))
-              (message "Lining up declarations..(please stand by)"))
-          ;; Get the beginning of line indent first
-          (while (progn (setq e (marker-position edpos))
-                        (< (point) e))
-            (cond
-             ( (save-excursion (skip-chars-backward " \t")
-                               (bolp))
-               (verilog-forward-ws&directives)
-               (indent-line-to base-ind)
-               (verilog-forward-ws&directives)
-               (verilog-re-search-forward "[ \t\n\f]" e 'move))
-             (t
-              (just-one-space)
-              (verilog-re-search-forward "[ \t\n\f]" e 'move)))
-            ;;(forward-line)
-            )
-          ;; Now find biggest prefix
-          (setq ind (verilog-get-lineup-indent start edpos))
-          ;; Now indent each line.
-          (goto-char start)
-          (while (progn (setq e (marker-position edpos))
-                        (setq r (- e (point)))
-                        (> r 0))
-            (setq e (point))
-            (unless quiet (message "%d" r))
-            (verilog-indent-line)
-            (cond
-             ((or (and verilog-indent-declaration-macros
-                       (looking-at verilog-declaration-re-2-macro))
-                  (looking-at verilog-declaration-re-2-no-macro))
-              (let ((p (match-end 0)))
-                (set-marker m1 p)
-                (if (verilog-re-search-forward "[[#`]" p 'move)
-                    (progn
-                      (forward-char -1)
-                      (just-one-space)
-                      (goto-char (marker-position m1))
-                      (just-one-space)
-                      (indent-to ind))
-                  (progn
-                    (just-one-space)
-                    (indent-to ind)))))
-             ((verilog-continued-line-1 start)
-              (goto-char e)
-              (indent-line-to ind))
-             ((verilog-in-struct-p)
-              ;; could have a declaration of a user defined item
-              (goto-char e)
-              (verilog-end-of-statement))
-             (t                ; Must be comment or white space
-              (goto-char e)
-              (verilog-forward-ws&directives)
-              (forward-line -1)))
-            (forward-line 1))
-          (unless quiet (message ""))))))
+         (progn
+           (if (verilog-parenthesis-depth)  
+               ;; in an argument list or parameter block               
+               (setq el (backward-up-list -1)                
+                     start (progn
+                             (goto-char e)
+                             (backward-up-list 1)
+                             (forward-line) ;; ignore ( input foo,
+                             (verilog-re-search-forward verilog-declaration-re el 'move)
+                             (goto-char (match-beginning 0))
+                             (skip-chars-backward " \t")
+                             (point))
+                     startpos (set-marker (make-marker) start)
+                     end (progn
+                           (goto-char start)
+                           (backward-up-list -1)
+                           (forward-char -1)
+                           (verilog-backward-syntactic-ws)
+                           (point))
+                     endpos (set-marker (make-marker) end)
+                     base-ind (progn
+                                (goto-char start)
+                                (verilog-do-indent (verilog-calculate-indent))
+                                (verilog-forward-ws&directives)
+                                (current-column))
+                     )
+             ;; in a declaration block (not in argument list)
+             (setq 
+              start (progn
+                      (verilog-beg-of-statement-1)
+                      (while (and (looking-at verilog-declaration-re)
+                                  (not (bobp)))
+                        (skip-chars-backward " \t")
+                        (setq e (point))
+                        (beginning-of-line)
+                        (verilog-backward-syntactic-ws)
+                        (backward-char)
+                        (verilog-beg-of-statement-1))
+                      e)
+              startpos (set-marker (make-marker) start)
+              end (progn
+                    (goto-char here)
+                    (verilog-end-of-statement)
+                    (setq e (point))   ;Might be on last line
+                    (verilog-forward-syntactic-ws)
+                    (while (looking-at verilog-declaration-re)
+                      ;;(beginning-of-line)
+                      (verilog-end-of-statement)
+                      (setq e (point))
+                      (verilog-forward-syntactic-ws))
+                    e)
+              endpos (set-marker (make-marker) end)
+              base-ind (progn
+                         (goto-char start)
+                         (verilog-do-indent (verilog-calculate-indent))
+                         (verilog-forward-ws&directives)
+                         (current-column))))
+           ;; OK, start and end are set
+           (goto-char (marker-position startpos))
+           (if (and (not quiet)
+                    (> (- end start) 100))
+               (message "Lining up declarations..(please stand by)"))
+           ;; Get the beginning of line indent first
+           (while (progn (setq e (marker-position endpos))
+                         (< (point) e))
+             (cond
+              ((save-excursion (skip-chars-backward " \t") 
+                               (bolp))
+                (verilog-forward-ws&directives)
+                (indent-line-to base-ind)
+                (verilog-forward-ws&directives)
+                (if (< (point) e)
+                    (verilog-re-search-forward "[ \t\n\f]" e 'move)))
+              (t
+               (just-one-space)
+               (verilog-re-search-forward "[ \t\n\f]" e 'move)))
+             ;;(forward-line)
+             )
+           ;; Now find biggest prefix
+           (setq ind (verilog-get-lineup-indent (marker-position startpos) endpos))
+           ;; Now indent each line.
+           (goto-char (marker-position startpos))
+           (while (progn (setq e (marker-position endpos))
+                         (setq r (- e (point)))
+                         (> r 0))
+             (setq e (point))
+             (unless quiet (message "%d" r))
+             (verilog-indent-line)
+             (verilog-forward-ws&directives)
+             (cond
+              ((or (and verilog-indent-declaration-macros
+                        (looking-at verilog-declaration-re-2-macro))
+                   (looking-at verilog-declaration-re-2-no-macro))
+               (let ((p (match-end 0)))
+                 (set-marker m1 p)
+                 (if (verilog-re-search-forward "[[#`]" p 'move)
+                     (progn
+                       (forward-char -1)
+                       (just-one-space)
+                       (goto-char (marker-position m1))
+                       (just-one-space)
+                       (indent-to ind))
+                   (progn
+                     (just-one-space)
+                     (indent-to ind)))))
+              ((verilog-continued-line-1 (marker-position startpos))
+               (goto-char e)
+               (indent-line-to ind))
+              ((verilog-in-struct-p)
+               ;; could have a declaration of a user defined item
+               (goto-char e)
+               (verilog-end-of-statement))
+              (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-pretty-expr (&optional quiet myre)
   "Line up expressions around point, optionally QUIET with regexp MYRE."
@@ -5486,7 +5548,8 @@ Be verbose about progress unless optional QUIET set."
     (if (or (eq myre nil)
            (string-equal myre ""))
        (setq myre "\\(<\\|:\\)?="))
-    (setq myre (concat "\\(^[^;#:<=>]*\\)\\(" myre "\\)"))
+    ;; want to match the first <= |  := | = 
+    (setq myre (concat "\\(^.*?\\)\\(" myre "\\)"))
     (let ((rexp(concat "^\\s-*" verilog-complete-reg)))
       (beginning-of-line)
       (if (and (not (looking-at rexp ))
@@ -5529,7 +5592,7 @@ Be verbose about progress unless optional QUIET set."
                       (beginning-of-line)
                       )
                     e))
-                 (edpos (set-marker (make-marker) end))
+                 (endpos (set-marker (make-marker) end))
                  (ind)
                  )
             (goto-char start)
@@ -5539,7 +5602,7 @@ Be verbose about progress unless optional QUIET set."
                 (message "Lining up expressions..(please stand by)"))
 
             ;; Set indent to minimum throughout region
-            (while (< (point) (marker-position edpos))
+            (while (< (point) (marker-position endpos))
               (beginning-of-line)
               (verilog-just-one-space myre)
               (end-of-line)
@@ -5547,11 +5610,11 @@ Be verbose about progress unless optional QUIET set."
               )
 
             ;; Now find biggest prefix
-            (setq ind (verilog-get-lineup-indent-2 myre start edpos))
+            (setq ind (verilog-get-lineup-indent-2 myre start endpos))
 
             ;; Now indent each line.
             (goto-char start)
-            (while (progn (setq e (marker-position edpos))
+            (while (progn (setq e (marker-position endpos))
                           (setq r (- e (point)))
                           (> r 0))
               (setq e (point))
@@ -5679,7 +5742,8 @@ Region is defined by B and EDPOS."
        ;; No lineup-string found
        (goto-char b)
        (end-of-line)
-       (skip-chars-backward " \t")
+       (verilog-backward-syntactic-ws)
+       ;;(skip-chars-backward " \t")
        (1+ (current-column))))))
 
 (defun verilog-get-lineup-indent-2 (myre b edpos)
@@ -5747,7 +5811,7 @@ it displays a list of all possible completions.")
   '(
     "and" "buf" "bufif0" "bufif1" "cmos" "defparam" "inout" "input"
     "integer" "localparam" "logic" "mailbox" "nand" "nmos" "nor" "not" "notif0"
-    "notif1" "or" "output" "parameter" "pmos" "pull0" "pull1" "pullup"
+    "notif1" "or" "output" "parameter" "pmos" "pull0" "pull1" "pulldown" "pullup"
     "rcmos" "real" "realtime" "reg" "rnmos" "rpmos" "rtran" "rtranif0"
     "rtranif1" "semaphore" "time" "tran" "tranif0" "tranif1" "tri" "tri0" "tri1"
     "triand" "trior" "trireg" "wand" "wire" "wor" "xnor" "xor"
@@ -6974,7 +7038,7 @@ Return the list of signals found, using submodi to look up each port."
                 (verilog-read-sub-decls-expr
                  submoddecls comment port
                  (buffer-substring
-                  (point) (1- (progn (backward-char 1) ; start at (
+                  (point) (1- (progn (search-backward "(") ; start at (
                                      (forward-sexp 1) (point)))))))) ; expr
        ;;
        (forward-line 1)))))
@@ -8747,6 +8811,8 @@ Avoid declaring ports manually, as it makes code harder to maintain."
 (defvar vl-name  nil "See `verilog-auto-inst'.") ; Prevent compile warning
 (defvar vl-width nil "See `verilog-auto-inst'.") ; Prevent compile warning
 (defvar vl-dir   nil "See `verilog-auto-inst'.") ; Prevent compile warning
+(defvar vl-bits  nil "See `verilog-auto-inst'.") ; Prevent compile warning
+(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.
@@ -8762,6 +8828,8 @@ If PAR-VALUES replace final strings with these parameter values."
         (vl-name (verilog-sig-name port-st))
         (vl-width (verilog-sig-width port-st))
         (vl-modport (verilog-sig-modport port-st))
+        (vl-mbits (if (verilog-sig-multidim port-st) 
+                       (verilog-sig-multidim-string port-st) ""))
         (vl-bits (if (or verilog-auto-inst-vector
                          (not (assoc port vector-skip-list))
                          (not (equal (verilog-sig-bits port-st)
@@ -9110,6 +9178,7 @@ Lisp Templates:
 
        vl-name        Name portion of the input/output port.
        vl-bits        Bus bits portion of the input/output port ('[2:0]').
+       vl-mbits       Multidimensional array bits for port ('[2:0][3:0]').
        vl-width       Width of the input/output port ('3' for [2:0]).
                        May be a (...) expression if bits isn't a constant.
        vl-dir         Direction of the pin input/output/inout/interface.
@@ -9236,11 +9305,11 @@ For more information see the \\[verilog-faq] and forums at URL
                 (delete-char 1)
                 (insert ");")
                 (search-forward "\n")  ;; Added by inst-port
-                (delete-backward-char 1)
+                (delete-char -1)
                 (if (search-forward ")" nil t) ;; From user, moved up a line
-                    (delete-backward-char 1))
+                    (delete-char -1))
                 (if (search-forward ";" nil t) ;; Don't error if user had syntax error and forgot it
-                    (delete-backward-char 1)))))))))
+                    (delete-char -1)))))))))
 
 (defun verilog-auto-inst-param ()
   "Expand AUTOINSTPARAM statements, as part of \\[verilog-auto].
@@ -9343,9 +9412,9 @@ Templates:
                 (delete-char 1)
                 (insert ")")
                 (search-forward "\n")  ;; Added by inst-port
-                (delete-backward-char 1)
+                (delete-char -1)
                 (if (search-forward ")" nil t) ;; From user, moved up a line
-                    (delete-backward-char 1)))))))))
+                    (delete-char -1)))))))))
 
 (defun verilog-auto-reg ()
   "Expand AUTOREG statements, as part of \\[verilog-auto].
index 1210592af1852f37d622c37c27b1f76ae3df35a8..4ff9cf92b8d3252a823888e02ed839604f9b7997 100644 (file)
@@ -199,21 +199,6 @@ Examples:
   "Customizations for modes."
   :group 'vhdl)
 
-(defcustom vhdl-electric-mode t
-  "*Non-nil enables electrification (automatic template generation).
-If nil, template generators can still be invoked through key bindings and
-menu.  Is indicated in the modeline by \"/e\" after the mode name and can be
-toggled by `\\[vhdl-electric-mode]'."
-  :type 'boolean
-  :group 'vhdl-mode)
-
-(defcustom vhdl-stutter-mode t
-  "*Non-nil enables stuttering.
-Is indicated in the modeline by \"/s\" after the mode name and can be toggled
-by `\\[vhdl-stutter-mode]'."
-  :type 'boolean
-  :group 'vhdl-mode)
-
 (defcustom vhdl-indent-tabs-mode nil
   "*Non-nil means indentation can insert tabs.
 Overrides local variable `indent-tabs-mode'."
@@ -3466,13 +3451,11 @@ 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))
-             (vhdl-mode-line-update))
+                                     (not vhdl-electric-mode)))
        :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))
-             (vhdl-mode-line-update))
+                                     (not vhdl-stutter-mode)))
        :style toggle :selected vhdl-stutter-mode :keys "C-c C-m C-s"]
       ["Indent Tabs Mode"
        (progn (customize-set-variable 'vhdl-indent-tabs-mode
@@ -4670,7 +4653,10 @@ Key bindings:
   (interactive)
   (kill-all-local-variables)
   (setq major-mode 'vhdl-mode)
-  (setq mode-name "VHDL")
+  (setq mode-name '("VHDL"
+                    (vhdl-electric-mode "/" (vhdl-stutter-mode "/"))
+                    (vhdl-electric-mode "e")
+                    (vhdl-stutter-mode "s")))
 
   ;; set maps and tables
   (use-local-map vhdl-mode-map)
@@ -4737,7 +4723,6 @@ Key bindings:
   ;; miscellaneous
   (vhdl-ps-print-init)
   (vhdl-write-file-hooks-init)
-  (vhdl-mode-line-update)
   (message "VHDL Mode %s.%s" vhdl-version
           (if noninteractive "" "  See menu for documentation and release notes."))
 
@@ -4757,8 +4742,7 @@ Key bindings:
   (vhdl-write-file-hooks-init)
   (vhdl-update-mode-menu)
   (vhdl-hideshow-init)
-  (run-hooks 'menu-bar-update-hook)
-  (vhdl-mode-line-update))
+  (run-hooks 'menu-bar-update-hook))
 
 (defun vhdl-write-file-hooks-init ()
   "Add/remove hooks when buffer is saved."
@@ -8010,7 +7994,7 @@ buffer."
                       (condition-case () (forward-sexp)
                         (error (goto-char (point-max))))
                       (< (point) end))
-          (delete-backward-char 1))
+          (delete-char -1))
         ;; add closing parenthesis
         (when (> (point) end)
           (goto-char end)
@@ -8055,31 +8039,15 @@ project is defined."
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;  Enabling/disabling
 
-(defun vhdl-mode-line-update ()
-  "Update the modeline string for VHDL major mode."
-  (setq mode-name (concat "VHDL"
-                         (and (or vhdl-electric-mode vhdl-stutter-mode) "/")
-                         (and vhdl-electric-mode "e")
-                         (and vhdl-stutter-mode "s")))
-  (force-mode-line-update t))
-
-(defun vhdl-electric-mode (arg)
+(define-minor-mode vhdl-electric-mode
   "Toggle VHDL electric mode.
 Turn on if ARG positive, turn off if ARG negative, toggle if ARG zero or nil."
-  (interactive "P")
-  (setq vhdl-electric-mode
-       (cond ((or (not arg) (zerop arg)) (not vhdl-electric-mode))
-             ((> arg 0) t) (t nil)))
-  (vhdl-mode-line-update))
+  :global t)
 
-(defun vhdl-stutter-mode (arg)
+(define-minor-mode vhdl-stutter-mode
   "Toggle VHDL stuttering mode.
 Turn on if ARG positive, turn off if ARG negative, toggle if ARG zero or nil."
-  (interactive "P")
-  (setq vhdl-stutter-mode
-       (cond ((or (not arg) (zerop arg)) (not vhdl-stutter-mode))
-             ((> arg 0) t) (t nil)))
-  (vhdl-mode-line-update))
+  :global t)
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Stuttering
@@ -8137,7 +8105,7 @@ Turn on if ARG positive, turn off if ARG negative, toggle if ARG zero or nil."
   (interactive "p")
   (if (and vhdl-stutter-mode (= count 1) (not (vhdl-in-literal)))
       (if (= (preceding-char) last-input-event)
-         (progn (delete-backward-char 1) (insert-char ?\" 1))
+         (progn (delete-char -1) (insert-char ?\" 1))
        (insert-char ?\' 1))
     (self-insert-command count)))
 
@@ -8204,7 +8172,7 @@ Turn on if ARG positive, turn off if ARG negative, toggle if ARG zero or nil."
       (unless (vhdl-template-field
               (concat "[type" (and (vhdl-standard-p 'ams) " or nature") "]")
               nil t)
-       (delete-backward-char 3))
+       (delete-char -3))
       (vhdl-insert-keyword " IS ")
       (vhdl-template-field "name" ";")
       (vhdl-comment-insert-inline))))
@@ -8568,7 +8536,7 @@ a configuration declaration if not within a design unit."
               (vhdl-template-field "library name" "." nil nil nil nil
                                    (vhdl-work-library))
               (vhdl-template-field "configuration name" ";"))
-             (t (delete-backward-char 1) (insert ";") t))))))
+             (t (delete-char -1) (insert ";") t))))))
 
 
 (defun vhdl-template-configuration-decl ()
@@ -8735,7 +8703,7 @@ a configuration declaration if not within a design unit."
        (vhdl-insert-keyword " OPEN ")
        (unless (vhdl-template-field "[READ_MODE | WRITE_MODE | APPEND_MODE]"
                                     nil t)
-         (delete-backward-char 6)))
+         (delete-char -6)))
       (vhdl-insert-keyword " IS ")
       (when (vhdl-standard-p '87)
        (vhdl-template-field "[IN | OUT]" " " t))
@@ -9063,7 +9031,7 @@ otherwise."
              (insert "\n")
              (indent-to margin))
            (delete-region end-pos (point))
-           (delete-backward-char 1)
+           (delete-char -1)
            (insert ")")
            (when vhdl-auto-align (vhdl-align-region-groups start (point) 1))
            t)
@@ -9437,7 +9405,7 @@ otherwise."
     (vhdl-insert-keyword "REPORT ")
     (if (equal "\"\"" (vhdl-template-field
                       "string expression" nil t start (point) t))
-       (delete-backward-char 2)
+       (delete-char -2)
       (setq start (point))
       (vhdl-insert-keyword " SEVERITY ")
       (unless (vhdl-template-field "[NOTE | WARNING | ERROR | FAILURE]" nil t)
@@ -9585,7 +9553,7 @@ otherwise."
                    "[scalar type | ARRAY | RECORD | ACCESS | FILE]" nil t)
                   ""))))
        (cond ((equal definition "")
-              (delete-backward-char 4)
+              (delete-char -4)
               (insert ";"))
              ((equal definition "ARRAY")
               (delete-region (point) (progn (forward-word -1) (point)))
@@ -10085,13 +10053,13 @@ If starting after end-comment-column, start a new line."
       (if (not (or (and string (progn (insert string) t))
                   (vhdl-template-field "[comment]" nil t)))
          (delete-region position (point))
-       (while (= (preceding-char) ? ) (delete-backward-char 1))
-;      (when (> (current-column) end-comment-column)
-;        (setq position (point-marker))
-;        (re-search-backward "-- ")
-;        (insert "\n")
-;        (indent-to comment-column)
-;        (goto-char position))
+       (while (= (preceding-char) ?\ ) (delete-char -1))
+       ;; (when (> (current-column) end-comment-column)
+       ;;   (setq position (point-marker))
+       ;;   (re-search-backward "-- ")
+       ;;   (insert "\n")
+       ;;   (indent-to comment-column)
+       ;;   (goto-char position))
        ))))
 
 (defun vhdl-comment-block ()
@@ -10224,7 +10192,7 @@ Point is left between them."
     (when semicolon-pos (goto-char semicolon-pos))
     (if not-empty
        (progn (delete-char 1) (insert ")"))
-      (delete-backward-char 2))))
+      (delete-char -2))))
 
 (defun vhdl-template-generic-list (optional &optional no-value)
   "Read from user a generic spec argument list."
@@ -12533,7 +12501,7 @@ File statistics: \"%s\"\n\
        (add-hook 'hs-minor-mode-hook 'hs-hide-all)
       (remove-hook 'hs-minor-mode-hook 'hs-hide-all))
     (hs-minor-mode arg)
-    (vhdl-mode-line-update)))          ; hack to update menu bar
+    (force-mode-line-update)))         ; hack to update menu bar
 
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
index 65ec4bf101ab8283f2eb8631ee89963b438f917b..585b5f9eb69b4b755516c92103ef35160ed969cf 100644 (file)
@@ -15,6 +15,7 @@
 ;; Author: Kenichi Handa <handa@m17n.org>
 ;; (according to ack.texi)
 ;; Keywords: wp, BDF, font, PostScript
+;; Package: ps-print
 
 ;; This file is part of GNU Emacs.
 
index 5e045bccf9a47bc414b1b34484d0c90d21aeb46b..c27ee251e08ea4771bd10cc42f20d50209a6ea0b 100644 (file)
@@ -8,6 +8,7 @@
 ;;     Vinicius Jose Latorre <viniciusjl@ig.com.br>
 ;; Keywords: wp, print, PostScript
 ;; X-URL: http://www.emacswiki.org/cgi-bin/wiki/ViniciusJoseLatorre
+;; Package: ps-print
 
 ;; This file is part of GNU Emacs.
 
index 51c4cc20bece59e97814c2cede2d55cfb8dcb663..df779fde39d2e30056c5e6c6ed4460afa5548b01 100644 (file)
@@ -8,6 +8,7 @@
 ;; Maintainer: Kenichi Handa <handa@m17n.org> (multi-byte characters)
 ;;     Vinicius Jose Latorre <viniciusjl@ig.com.br>
 ;; Keywords: wp, print, PostScript, multibyte, mule
+;; Package: ps-print
 
 ;; This file is part of GNU Emacs.
 
index 0efac03f7d50089a54306b0bd536f8579586456b..02e43ef3f0c5910e50edbb5c48526ee9dc54e158 100644 (file)
@@ -1497,7 +1497,7 @@ Please send all bug fixes and enhancements to
   "Support for printing and PostScript."
   :tag "PostScript"
   :version "20"
-  :group 'emacs)
+  :group 'external)
 
 (defgroup ps-print nil
   "PostScript generator for Emacs."
@@ -6656,7 +6656,7 @@ If FACE is not a valid face name, use default face."
 ;; But autoload them here to make the separation invisible.
 \f
 ;;;### (autoloads (ps-mule-end-job ps-mule-begin-job ps-mule-initialize
-;;;;;;  ps-multibyte-buffer) "ps-mule" "ps-mule.el" "9187df3473401876e0df4937c311fbaf")
+;;;;;;  ps-multibyte-buffer) "ps-mule" "ps-mule.el" "d2fcad95db7404989362657faf744796")
 ;;; Generated autoloads from ps-mule.el
 
 (defvar ps-multibyte-buffer nil "\
index 5ad1c6855d00bdd89b9a7514fbd87a05ec43a78c..9fab290fc524119b06b73417554460ce1476e5ca 100644 (file)
@@ -10,6 +10,7 @@
 ;;     Vinicius Jose Latorre <viniciusjl@ig.com.br>
 ;; Keywords: wp, print, PostScript
 ;; X-URL: http://www.emacswiki.org/cgi-bin/wiki/ViniciusJoseLatorre
+;; Package: ps-print
 
 ;; This file is part of GNU Emacs.
 
index facc6d5185860e2412031823cd12a2ce485f4ef4..665840899108649048693a6f3f2019b71aab58bb 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Maintainer: Didier Verna <didier@xemacs.org>
 ;; Keywords: internal
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
index 1a6d84d2c17dbdd9715dc4f1a18cf17c6b0ca297..97b6eb0dfc8349e33acd6b799aec4f3573d2e061 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Maintainer: FSF
 ;; Keywords: internal
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
index edebbe24a840eb32a01dc7e83dec3e2dc971452d..eddaf4f020eae8317015b8cf7093ada94fe2108b 100644 (file)
@@ -5,7 +5,7 @@
 
 ;; Author: Will Mengarini <seldon@eskimo.com>
 ;; Created: Mo 02 Mar 98
-;; Version: 0.51, We 13 May 98
+;; Version: 0.51
 ;; Keywords: convenience, vi, repeat
 
 ;; This file is part of GNU Emacs.
index 12263cf5aa6fc89270d36b7fa67b85dac3a099c4..baea2820433e1c409b0943d5c56abdc4b9068f9d 100644 (file)
@@ -5,6 +5,7 @@
 ;;   Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
   :type 'boolean
   :group 'matching)
 
-(defvar query-replace-history nil)
+(defvar query-replace-history nil
+  "Default history list for query-replace commands.
+See `query-replace-from-history-variable' and
+`query-replace-to-history-variable'.")
 
 (defvar query-replace-defaults nil
   "Default values of FROM-STRING and TO-STRING for `query-replace'.
@@ -394,12 +398,13 @@ Fourth and fifth arg START and END specify the region to operate on."
                    (car regexp-search-ring)
                  (read-from-minibuffer "Map query replace (regexp): "
                                        nil nil nil
-                                       'query-replace-history nil t)))
+                                       query-replace-from-history-variable
+                                       nil t)))
          (to (read-from-minibuffer
               (format "Query replace %s with (space-separated strings): "
                       (query-replace-descr from))
               nil nil nil
-              'query-replace-history from t)))
+              query-replace-to-history-variable from t)))
      (list from to
           (and current-prefix-arg
                (prefix-numeric-value current-prefix-arg))
@@ -1001,32 +1006,6 @@ which means to discard all text properties."
   :group 'matching
   :version "22.1")
 
-(defun occur-accumulate-lines (count &optional keep-props)
-  (save-excursion
-    (let ((forwardp (> count 0))
-         result beg end)
-      (while (not (or (zerop count)
-                     (if forwardp
-                         (eobp)
-                       (bobp))))
-       (setq count (+ count (if forwardp -1 1)))
-       (setq beg (line-beginning-position)
-             end (line-end-position))
-       (if (and keep-props (if (boundp 'jit-lock-mode) jit-lock-mode)
-                (text-property-not-all beg end 'fontified t))
-           (if (fboundp 'jit-lock-fontify-now)
-               (jit-lock-fontify-now beg end)))
-       (push
-        (if (and keep-props (not (eq occur-excluded-properties t)))
-            (let ((str (buffer-substring beg end)))
-              (remove-list-of-text-properties
-               0 (length str) occur-excluded-properties str)
-              str)
-          (buffer-substring-no-properties beg end))
-        result)
-       (forward-line (if forwardp 1 -1)))
-      (nreverse result))))
-
 (defun occur-read-primary-args ()
   (list (read-regexp "List lines matching regexp"
                     (car regexp-history))
@@ -1035,7 +1014,7 @@ which means to discard all text properties."
 
 (defun occur-rename-buffer (&optional unique-p interactive-p)
   "Rename the current *Occur* buffer to *Occur: original-buffer-name*.
-Here `original-buffer-name' is the buffer name were Occur was originally run.
+Here `original-buffer-name' is the buffer name where Occur was originally run.
 When given the prefix argument, or called non-interactively, the renaming
 will not clobber the existing buffer(s) of that name, but use
 `generate-new-buffer-name' instead.  You can add this to `occur-hook'
@@ -1052,7 +1031,7 @@ invoke `occur'."
 
 (defun occur (regexp &optional nlines)
   "Show all lines in the current buffer containing a match for REGEXP.
-This function can not handle matches that span more than one line.
+If a match spreads across multiple lines, all those lines are shown.
 
 Each line is displayed with NLINES lines before and after, or -NLINES
 before if NLINES is negative.
@@ -1162,12 +1141,15 @@ See also `multi-occur'."
                      (not (eq occur-excluded-properties t)))))
          (let* ((bufcount (length active-bufs))
                 (diff (- (length bufs) bufcount)))
-           (message "Searched %d buffer%s%s; %s match%s for `%s'"
+           (message "Searched %d buffer%s%s; %s match%s%s"
                     bufcount (if (= bufcount 1) "" "s")
                     (if (zerop diff) "" (format " (%d killed)" diff))
                     (if (zerop count) "no" (format "%d" count))
                     (if (= count 1) "" "es")
-                    regexp))
+                    ;; Don't display regexp if with remaining text
+                    ;; it is longer than window-width.
+                    (if (> (+ (length regexp) 42) (window-width))
+                        "" (format " for `%s'" (query-replace-descr regexp)))))
          (setq occur-revert-arguments (list regexp nlines bufs))
           (if (= count 0)
               (kill-buffer occur-buf)
@@ -1177,12 +1159,6 @@ See also `multi-occur'."
             (set-buffer-modified-p nil)
             (run-hooks 'occur-hook)))))))
 
-(defun occur-engine-add-prefix (lines)
-  (mapcar
-   #'(lambda (line)
-       (concat "       :" line "\n"))
-   lines))
-
 (defun occur-engine (regexp buffers out-buf nlines case-fold-search
                            title-face prefix-face match-face keep-props)
   (with-current-buffer out-buf
@@ -1193,12 +1169,15 @@ See also `multi-occur'."
        (when (buffer-live-p buf)
          (let ((matches 0)     ;; count of matched lines
                (lines 1)       ;; line count
+               (prev-after-lines nil)  ;; context lines of prev match
+               (prev-lines nil)        ;; line number of prev match endpt
                (matchbeg 0)
                (origpt nil)
                (begpt nil)
                (endpt nil)
                (marker nil)
                (curstring "")
+               (ret nil)
                (inhibit-field-text-motion t)
                (headerpt (with-current-buffer out-buf (point))))
            (with-current-buffer buf
@@ -1214,24 +1193,17 @@ See also `multi-occur'."
                  (when (setq endpt (re-search-forward regexp nil t))
                    (setq matches (1+ matches)) ;; increment match count
                    (setq matchbeg (match-beginning 0))
-                   (setq lines (+ lines (1- (count-lines origpt endpt))))
+                   ;; Get beginning of first match line and end of the last.
                    (save-excursion
                      (goto-char matchbeg)
-                     (setq begpt (line-beginning-position)
-                           endpt (line-end-position)))
+                     (setq begpt (line-beginning-position))
+                     (goto-char endpt)
+                     (setq endpt (line-end-position)))
+                   ;; Sum line numbers up to the first match line.
+                   (setq lines (+ lines (count-lines origpt begpt)))
                    (setq marker (make-marker))
                    (set-marker marker matchbeg)
-                   (if (and keep-props
-                            (if (boundp 'jit-lock-mode) jit-lock-mode)
-                            (text-property-not-all begpt endpt 'fontified t))
-                       (if (fboundp 'jit-lock-fontify-now)
-                           (jit-lock-fontify-now begpt endpt)))
-                   (if (and keep-props (not (eq occur-excluded-properties t)))
-                       (progn
-                         (setq curstring (buffer-substring begpt endpt))
-                         (remove-list-of-text-properties
-                          0 (length curstring) occur-excluded-properties curstring))
-                     (setq curstring (buffer-substring-no-properties begpt endpt)))
+                   (setq curstring (occur-engine-line begpt endpt keep-props))
                    ;; Highlight the matches
                    (let ((len (length curstring))
                          (start 0))
@@ -1248,24 +1220,33 @@ See also `multi-occur'."
                         curstring)
                        (setq start (match-end 0))))
                    ;; Generate the string to insert for this match
-                   (let* ((out-line
+                   (let* ((match-prefix
+                           ;; Using 7 digits aligns tabs properly.
+                           (apply #'propertize (format "%7d:" lines)
+                                  (append
+                                   (when prefix-face
+                                     `(font-lock-face prefix-face))
+                                   `(occur-prefix t mouse-face (highlight)
+                                                  occur-target ,marker follow-link t
+                                                  help-echo "mouse-2: go to this occurrence"))))
+                          (match-str
+                           ;; We don't put `mouse-face' on the newline,
+                           ;; because that loses.  And don't put it
+                           ;; on context lines to reduce flicker.
+                           (propertize curstring 'mouse-face (list 'highlight)
+                                       'occur-target marker
+                                       'follow-link t
+                                       'help-echo
+                                       "mouse-2: go to this occurrence"))
+                          (out-line
                            (concat
-                            ;; Using 7 digits aligns tabs properly.
-                            (apply #'propertize (format "%7d:" lines)
-                                   (append
-                                    (when prefix-face
-                                      `(font-lock-face prefix-face))
-                                    `(occur-prefix t mouse-face (highlight)
-                                      occur-target ,marker follow-link t
-                                      help-echo "mouse-2: go to this occurrence")))
-                            ;; We don't put `mouse-face' on the newline,
-                            ;; because that loses.  And don't put it
-                            ;; on context lines to reduce flicker.
-                            (propertize curstring 'mouse-face (list 'highlight)
-                                        'occur-target marker
-                                        'follow-link t
-                                        'help-echo
-                                        "mouse-2: go to this occurrence")
+                            match-prefix
+                            ;; Add non-numeric prefix to all non-first lines
+                            ;; of multi-line matches.
+                            (replace-regexp-in-string
+                             "\n"
+                             "\n       :"
+                             match-str)
                             ;; Add marker at eol, but no mouse props.
                             (propertize "\n" 'occur-target marker)))
                           (data
@@ -1273,30 +1254,47 @@ See also `multi-occur'."
                                ;; The simple display style
                                out-line
                              ;; The complex multi-line display style.
-                             (occur-context-lines out-line nlines keep-props)
-                             )))
+                             (setq ret (occur-context-lines
+                                        out-line nlines keep-props begpt endpt
+                                        lines prev-lines prev-after-lines))
+                             ;; Set first elem of the returned list to `data',
+                             ;; and the second elem to `prev-after-lines'.
+                             (setq prev-after-lines (nth 1 ret))
+                             (nth 0 ret))))
                      ;; Actually insert the match display data
                      (with-current-buffer out-buf
                        (let ((beg (point))
-                             (end (progn (insert data) (point))))
-                         (unless (= nlines 0)
-                           (insert "-------\n")))))
+                             (end (progn (insert data) (point)))))))
                    (goto-char endpt))
                  (if endpt
                      (progn
-                       (setq lines (1+ lines))
+                       ;; Sum line numbers between first and last match lines.
+                       (setq lines (+ lines (count-lines begpt endpt)
+                                      ;; Add 1 for empty last match line since
+                                      ;; count-lines returns 1 line less.
+                                      (if (and (bolp) (eolp)) 1 0)))
                        ;; On to the next match...
                        (forward-line 1))
-                   (goto-char (point-max))))))
+                   (goto-char (point-max)))
+                 (setq prev-lines (1- lines)))
+               ;; Flush remaining context after-lines.
+               (when prev-after-lines
+                 (with-current-buffer out-buf
+                   (insert (apply #'concat (occur-engine-add-prefix
+                                            prev-after-lines)))))))
            (when (not (zerop matches)) ;; is the count zero?
              (setq globalcount (+ globalcount matches))
              (with-current-buffer out-buf
                (goto-char headerpt)
                (let ((beg (point))
                      end)
-                 (insert (format "%d match%s for \"%s\" in buffer: %s\n"
+                 (insert (format "%d match%s%s in buffer: %s\n"
                                  matches (if (= matches 1) "" "es")
-                                 regexp (buffer-name buf)))
+                                 ;; Don't display regexp for multi-buffer.
+                                 (if (> (length buffers) 1)
+                                     "" (format " for \"%s\""
+                                                (query-replace-descr regexp)))
+                                 (buffer-name buf)))
                  (setq end (point))
                  (add-text-properties beg end
                                       (append
@@ -1304,6 +1302,18 @@ See also `multi-occur'."
                                          `(font-lock-face ,title-face))
                                        `(occur-title ,buf))))
                (goto-char (point-min)))))))
+      ;; Display total match count and regexp for multi-buffer.
+      (when (and (not (zerop globalcount)) (> (length buffers) 1))
+       (goto-char (point-min))
+       (let ((beg (point))
+             end)
+         (insert (format "%d match%s total for \"%s\":\n"
+                         globalcount (if (= globalcount 1) "" "es")
+                         (query-replace-descr regexp)))
+         (setq end (point))
+         (add-text-properties beg end (when title-face
+                                        `(font-lock-face ,title-face))))
+       (goto-char (point-min)))
       (if coding
          ;; CODING is buffer-file-coding-system of the first buffer
          ;; that locally binds it.  Let's use it also for the output
@@ -1312,21 +1322,98 @@ See also `multi-occur'."
       ;; Return the number of matches
       globalcount)))
 
+(defun occur-engine-line (beg end &optional keep-props)
+  (if (and keep-props (if (boundp 'jit-lock-mode) jit-lock-mode)
+          (text-property-not-all beg end 'fontified t))
+      (if (fboundp 'jit-lock-fontify-now)
+         (jit-lock-fontify-now beg end)))
+  (if (and keep-props (not (eq occur-excluded-properties t)))
+      (let ((str (buffer-substring beg end)))
+       (remove-list-of-text-properties
+        0 (length str) occur-excluded-properties str)
+       str)
+    (buffer-substring-no-properties beg end)))
+
+(defun occur-engine-add-prefix (lines)
+  (mapcar
+   #'(lambda (line)
+       (concat "       :" line "\n"))
+   lines))
+
+(defun occur-accumulate-lines (count &optional keep-props pt)
+  (save-excursion
+    (when pt
+      (goto-char pt))
+    (let ((forwardp (> count 0))
+         result beg end moved)
+      (while (not (or (zerop count)
+                     (if forwardp
+                         (eobp)
+                       (and (bobp) (not moved)))))
+       (setq count (+ count (if forwardp -1 1)))
+       (setq beg (line-beginning-position)
+             end (line-end-position))
+       (push (occur-engine-line beg end keep-props) result)
+       (setq moved (= 0 (forward-line (if forwardp 1 -1)))))
+      (nreverse result))))
+
 ;; Generate context display for occur.
 ;; OUT-LINE is the line where the match is.
 ;; NLINES and KEEP-PROPS are args to occur-engine.
+;; LINES is line count of the current match,
+;; PREV-LINES is line count of the previous match,
+;; PREV-AFTER-LINES is a list of after-context lines of the previous match.
 ;; Generate a list of lines, add prefixes to all but OUT-LINE,
 ;; then concatenate them all together.
-(defun occur-context-lines (out-line nlines keep-props)
-  (apply #'concat
-        (nconc
-         (occur-engine-add-prefix
-          (nreverse (cdr (occur-accumulate-lines
-                          (- (1+ (abs nlines))) keep-props))))
-         (list out-line)
-         (if (> nlines 0)
-             (occur-engine-add-prefix
-              (cdr (occur-accumulate-lines (1+ nlines) keep-props)))))))
+(defun occur-context-lines (out-line nlines keep-props begpt endpt
+                                    lines prev-lines prev-after-lines)
+  ;; Find after- and before-context lines of the current match.
+  (let ((before-lines
+        (nreverse (cdr (occur-accumulate-lines
+                        (- (1+ (abs nlines))) keep-props begpt))))
+       (after-lines
+        (cdr (occur-accumulate-lines
+              (1+ nlines) keep-props endpt)))
+       separator)
+
+    ;; Combine after-lines of the previous match
+    ;; with before-lines of the current match.
+
+    (when prev-after-lines
+      ;; Don't overlap prev after-lines with current before-lines.
+      (if (>= (+ prev-lines (length prev-after-lines))
+             (- lines      (length before-lines)))
+         (setq prev-after-lines
+               (butlast prev-after-lines
+                        (- (length prev-after-lines)
+                           (- lines prev-lines (length before-lines) 1))))
+       ;; Separate non-overlapping context lines with a dashed line.
+       (setq separator "-------\n")))
+
+    (when prev-lines
+      ;; Don't overlap current before-lines with previous match line.
+      (if (<= (- lines (length before-lines))
+             prev-lines)
+         (setq before-lines
+               (nthcdr (- (length before-lines)
+                          (- lines prev-lines 1))
+                       before-lines))
+       ;; Separate non-overlapping before-context lines.
+       (unless (> nlines 0)
+         (setq separator "-------\n"))))
+
+    (list
+     ;; Return a list where the first element is the output line.
+     (apply #'concat
+           (append
+            (and prev-after-lines
+                 (occur-engine-add-prefix prev-after-lines))
+            (and separator (list separator))
+            (occur-engine-add-prefix before-lines)
+            (list out-line)))
+     ;; And the second element is the list of context after-lines.
+     (if (> nlines 0) after-lines))))
+
 \f
 ;; It would be nice to use \\[...], but there is no reasonable way
 ;; to make that display both SPC and Y.
@@ -1896,6 +1983,9 @@ make, or the user didn't cancel the call."
            (isearch-case-fold-search case-fold)
            (isearch-forward t)
            (isearch-error nil))
+       ;; Set isearch-word to nil because word-replace is regexp-based,
+       ;; so `isearch-search-fun' should not use `word-search-forward'.
+       (if (and isearch-word isearch-regexp) (setq isearch-word nil))
        (isearch-lazy-highlight-new-loop range-beg range-end))))
 
 (defun replace-dehighlight ()
index 9838ade89f1c39665e90a66e7f3233b313d94d16..ff5c8807de59e53e7f48006bf224fcb0e401c9db 100644 (file)
@@ -49,7 +49,7 @@
 
 (defgroup reveal nil
   "Reveal hidden text on the fly."
-  :group 'editing)
+  :group 'convenience)
 
 (defcustom reveal-around-mark t
   "Reveal text around the mark, if active."
index 7c2cf0f96f570178c9c435badd1abaf4b9158aca..fa7a93361562e0b842e68f125804a8d4af1b38f3 100644 (file)
@@ -5,6 +5,7 @@
 ;;
 ;; Author: Miles Bader <miles@gnu.org>
 ;; Keywords: convenience minibuffer
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
index e3895efac8ac7ce814b117511bad2663758ad939..1c809bbd7e06426daf0dfb69d5deff2400b76859 100644 (file)
@@ -549,22 +549,37 @@ This variable is expected to be made buffer-local by modes.")
   "`header-line-format' used in ruler mode.
 Call `ruler-mode-ruler-function' to compute the ruler value.")
 
+;;;###autoload
+(defvar ruler-mode nil
+  "Non-nil if Ruler mode is enabled.
+Use the command `ruler-mode' to change this variable.")
+(make-variable-buffer-local 'ruler-mode)
+
+(defun ruler--save-header-line-format ()
+  "Install the header line format for Ruler mode.
+Unless Ruler mode is already enabled, save the old header line
+format first."
+  (when (and (not ruler-mode)
+            (local-variable-p 'header-line-format)
+            (not (local-variable-p 'ruler-mode-header-line-format-old)))
+    (set (make-local-variable 'ruler-mode-header-line-format-old)
+        header-line-format))
+  (setq header-line-format ruler-mode-header-line-format))
+
 ;;;###autoload
 (define-minor-mode ruler-mode
-  "Display a ruler in the header line if ARG > 0."
+  "Toggle Ruler mode.
+In Ruler mode, Emacs displays a ruler in the header line."
   nil nil
   ruler-mode-map
   :group 'ruler-mode
+  :variable (ruler-mode
+            . (lambda (enable)
+                (when enable
+                  (ruler--save-header-line-format))
+                (setq ruler-mode enable)))
   (if ruler-mode
-      (progn
-        ;; When `ruler-mode' is on save previous header line format
-        ;; and install the ruler header line format.
-        (when (and (local-variable-p 'header-line-format)
-                  (not (local-variable-p 'ruler-mode-header-line-format-old)))
-          (set (make-local-variable 'ruler-mode-header-line-format-old)
-               header-line-format))
-        (setq header-line-format ruler-mode-header-line-format)
-        (add-hook 'post-command-hook 'force-mode-line-update nil t))
+      (add-hook 'post-command-hook 'force-mode-line-update nil t)
     ;; When `ruler-mode' is off restore previous header line format if
     ;; the current one is the ruler header line format.
     (when (eq header-line-format ruler-mode-header-line-format)
index eebc5ec942bf8cc9d871f0ba4cfbbcc855d0453a..15c841ac9c7154ff49c50c3d87e663400387e42f 100644 (file)
   :version "22.1"
   :group 'minibuffer)
 
-;;;###autoload
-(defcustom savehist-mode nil
-  "Mode for automatic saving of minibuffer history.
-Set this by calling the `savehist-mode' function or using the customize
-interface."
-  :type 'boolean
-  :set (lambda (symbol value) (savehist-mode (or value 0)))
-  :initialize 'custom-initialize-default
-  :require 'savehist
-  :group 'savehist)
-
 (defcustom savehist-save-minibuffer-history t
   "If non-nil, save all recorded minibuffer histories.
 If you want to save only specific histories, use `savehist-save-hook' to
@@ -181,7 +170,7 @@ minibuffer history.")
 ;; Functions.
 
 ;;;###autoload
-(defun savehist-mode (arg)
+(define-minor-mode savehist-mode
   "Toggle savehist-mode.
 Positive ARG turns on `savehist-mode'.  When on, savehist-mode causes
 minibuffer history to be saved periodically and when exiting Emacs.
@@ -191,11 +180,7 @@ previous minibuffer history to be loaded from `savehist-file'.
 This mode should normally be turned on from your Emacs init file.
 Calling it at any other time replaces your current minibuffer histories,
 which is probably undesirable."
-  (interactive "P")
-  (setq savehist-mode
-       (if (null arg)
-           (not savehist-mode)
-         (> (prefix-numeric-value arg) 0)))
+  :global t
   (if (not savehist-mode)
       (savehist-uninstall)
     (when (and (not savehist-loaded)
@@ -214,11 +199,7 @@ which is probably undesirable."
         (setq savehist-mode nil)
         (savehist-uninstall)
         (signal (car errvar) (cdr errvar)))))
-    (savehist-install)
-    (run-hooks 'savehist-mode-hook))
-  ;; Return the new setting.
-  savehist-mode)
-(add-minor-mode 'savehist-mode "")
+    (savehist-install)))
 
 (defun savehist-load ()
   "Load the variables stored in `savehist-file' and turn on `savehist-mode'.
index 458e2be07a1f5855cc9d9cae2bf3ba690a81f5d7..4f9747cb90a76b07247734c8a8522d8519c9004e 100644 (file)
@@ -90,9 +90,9 @@
         (call-interactively 'scroll-all-scroll-down-all))
        ((eq this-command 'previous-line)
         (call-interactively 'scroll-all-scroll-up-all))
-       ((eq this-command 'scroll-up)
+       ((memq this-command '(scroll-up scroll-up-command))
         (call-interactively 'scroll-all-page-down-all))
-       ((eq this-command 'scroll-down)
+       ((memq this-command '(scroll-down scroll-down-command))
         (call-interactively 'scroll-all-page-up-all))
        ((eq this-command 'beginning-of-buffer)
         (call-interactively 'scroll-all-beginning-of-buffer-all))
index 3f763fc59dad2e2d12e2a66bbdbffdde5fc99044..8b8edab0009a4d52673bda4f72cf4b4fe268f5e4 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Maintainer: FSF
 ;; Keywords: hardware
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
@@ -29,6 +30,7 @@
 ;;; Code:
 
 (require 'mouse)
+(eval-when-compile (require 'cl))
 
 \f
 ;;;; Utilities.
@@ -79,9 +81,6 @@ SIDE must be the symbol `left' or `right'."
   "Non-nil means `set-scroll-bar-mode' should really do something.
 This is nil while loading `scroll-bar.el', and t afterward.")
 
-(defun set-scroll-bar-mode-1 (ignore value)
-  (set-scroll-bar-mode value))
-
 (defun set-scroll-bar-mode (value)
   "Set `scroll-bar-mode' to VALUE and put the new value into effect."
   (if scroll-bar-mode
@@ -107,27 +106,23 @@ Setting the variable with a customization buffer also takes effect."
   ;; The default value for :initialize would try to use :set
   ;; when processing the file in cus-dep.el.
   :initialize 'custom-initialize-default
-  :set 'set-scroll-bar-mode-1)
+  :set (lambda (sym val) (set-scroll-bar-mode val)))
 
 ;; We just set scroll-bar-mode, but that was the default.
 ;; If it is set again, that is for real.
 (setq scroll-bar-mode-explicit t)
 
-(defun scroll-bar-mode (&optional flag)
+(defun get-scroll-bar-mode () scroll-bar-mode)
+(defsetf get-scroll-bar-mode set-scroll-bar-mode)
+(define-minor-mode scroll-bar-mode
   "Toggle display of vertical scroll bars on all frames.
 This command applies to all frames that exist and frames to be
 created in the future.
 With a numeric argument, if the argument is positive
 turn on scroll bars; otherwise turn off scroll bars."
-  (interactive "P")
-
-  ;; Tweedle the variable according to the argument.
-  (set-scroll-bar-mode (if (if (null flag)
-                              (not scroll-bar-mode)
-                            (setq flag (prefix-numeric-value flag))
-                            (or (not (numberp flag)) (> flag 0)))
-                          (or previous-scroll-bar-mode
-                              default-frame-scroll-bars))))
+  :variable (eq (get-scroll-bar-mode)
+                (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 e8a0125f554a8af07c7ee90a3237233061a4440e..f0e88d03612fe963cc31d74c95719713e9a14a31 100644 (file)
@@ -344,7 +344,8 @@ If CLIENT is non-nil, add a description of it to the logged message."
   ;; for possible servers before doing anything, so it *should* be ours.
   (and (process-contact proc :server)
        (eq (process-status proc) 'closed)
-       (ignore-errors (delete-file (process-get proc :server-file))))
+       (ignore-errors
+       (delete-file (process-get proc :server-file))))
   (server-log (format "Status changed to %s: %s" (process-status proc) msg) proc)
   (server-delete-client proc))
 
@@ -517,7 +518,9 @@ To force-start a server, do \\[server-force-delete] and then
       ;; Delete the socket files made by previous server invocations.
       (if (not (eq t (server-running-p server-name)))
          ;; Remove any leftover socket or authentication file
-         (ignore-errors (delete-file server-file))
+         (ignore-errors
+          (let (delete-by-moving-to-trash)
+            (delete-file server-file)))
        (setq server-mode nil) ;; already set by the minor mode code
        (display-warning
         'server
@@ -574,7 +577,7 @@ server or call `M-x server-force-delete' to forcibly disconnect it.")
                   (loop
                      ;; The auth key is a 64-byte string of random chars in the
                      ;; range `!'..`~'.
-                     for i below 64
+                     repeat 64
                      collect (+ 33 (random 94)) into auth
                      finally return (concat auth))))
              (process-put server-process :auth-key auth-key)
@@ -600,7 +603,7 @@ NAME defaults to `server-name'.  With argument, ask for NAME."
                                    server-auth-dir
                                  server-socket-dir))))
     (condition-case nil
-       (progn
+       (let (delete-by-moving-to-trash)
          (delete-file file)
          (message "Connection file %S deleted" file))
       (file-error
@@ -708,7 +711,7 @@ Server mode runs a process that accepts commands from the
                                      (number-to-string (emacs-pid)) "\n"))
     frame))
 
-(defun server-create-window-system-frame (display nowait proc)
+(defun server-create-window-system-frame (display nowait proc parent-id)
   (add-to-list 'frame-inherited-parameters 'client)
   (if (not (fboundp 'make-frame-on-display))
       (progn
@@ -724,12 +727,14 @@ Server mode runs a process that accepts commands from the
     (let* ((params `((client . ,(if nowait 'nowait proc))
                      ;; This is a leftover, see above.
                      (environment . ,(process-get proc 'env))))
-           (frame (make-frame-on-display
-                   (or display
-                       (frame-parameter nil 'display)
-                       (getenv "DISPLAY")
-                       (error "Please specify display"))
-                   params)))
+          (display (or display
+                       (frame-parameter nil 'display)
+                       (getenv "DISPLAY")
+                       (error "Please specify display")))
+          frame)
+      (if parent-id
+         (push (cons 'parent-id (string-to-number parent-id)) params))
+      (setq frame (make-frame-on-display display params))
       (server-log (format "%s created" frame) proc)
       (select-frame frame)
       (process-put proc 'frame frame)
@@ -897,15 +902,16 @@ The following commands are accepted by the client:
                (coding-system (and (default-value 'enable-multibyte-characters)
                                    (or file-name-coding-system
                                        default-file-name-coding-system)))
-               nowait ; t if emacsclient does not want to wait for us.
-               frame ; The frame that was opened for the client (if any).
-               display              ; Open the frame on this display.
-               dontkill       ; t if the client should not be killed.
+               nowait     ; t if emacsclient does not want to wait for us.
+               frame      ; Frame opened for the client (if any).
+               display    ; Open frame on this display.
+               parent-id  ; Window ID for XEmbed
+               dontkill   ; t if client should not be killed.
                commands
                dir
                use-current-frame
-               tty-name       ;nil, `window-system', or the tty name.
-               tty-type             ;string.
+               tty-name   nil, `window-system', or the tty name.
+               tty-type   string.
                files
                filepos
                command-line-args-left
@@ -932,6 +938,12 @@ The following commands are accepted by the client:
                  (setq display (pop command-line-args-left))
                   (if (zerop (length display)) (setq display nil)))
 
+                ;; -parent-id ID:
+                ;; Open X frame within window ID, via XEmbed.
+                ((and (equal "-parent-id" arg) command-line-args-left)
+                 (setq parent-id (pop command-line-args-left))
+                  (if (zerop (length parent-id)) (setq parent-id nil)))
+
                 ;; -window-system:  Open a new X frame.
                 ((equal "-window-system" arg)
                   (setq dontkill t)
@@ -1036,7 +1048,8 @@ The following commands are accepted by the client:
                    (setq tty-name nil tty-type nil)
                    (if display (server-select-display display)))
                   ((eq tty-name 'window-system)
-                   (server-create-window-system-frame display nowait proc))
+                   (server-create-window-system-frame display nowait proc
+                                                      parent-id))
                   ;; When resuming on a tty, tty-name is nil.
                   (tty-name
                    (server-create-tty-frame tty-name tty-type proc))))
@@ -1080,9 +1093,7 @@ The following commands are accepted by the client:
     (condition-case err
         (let* ((buffers
                 (when files
-                  (run-hooks 'pre-command-hook)
-                  (prog1 (server-visit-files files proc nowait)
-                    (run-hooks 'post-command-hook)))))
+                  (server-visit-files files proc nowait))))
 
           (mapc 'funcall (nreverse commands))
 
@@ -1153,8 +1164,13 @@ so don't mark these buffers specially, just visit them normally."
               (obuf (get-file-buffer filen)))
          (add-to-history 'file-name-history filen)
          (if (null obuf)
-              (set-buffer (find-file-noselect filen))
+             (progn
+               (run-hooks 'pre-command-hook)  
+               (set-buffer (find-file-noselect filen)))
             (set-buffer obuf)
+           ;; separately for each file, in sync with post-command hooks,
+           ;; with the new buffer current:
+           (run-hooks 'pre-command-hook)  
             (cond ((file-exists-p filen)
                    (when (not (verify-visited-file-modtime obuf))
                      (revert-buffer t nil)))
@@ -1166,7 +1182,9 @@ so don't mark these buffers specially, just visit them normally."
             (unless server-buffer-clients
               (setq server-existing-buffer t)))
           (server-goto-line-column (cdr file))
-          (run-hooks 'server-visit-hook))
+          (run-hooks 'server-visit-hook)
+         ;; hooks may be specific to current buffer:
+         (run-hooks 'post-command-hook)) 
        (unless nowait
          ;; When the buffer is killed, inform the clients.
          (add-hook 'kill-buffer-hook 'server-kill-buffer nil t)
index 1db7a2835f4339ec22a670859cc30b679f36438c..351af62783e0f6a3dc768c6119d1d2f9032f69c0 100644 (file)
@@ -95,7 +95,7 @@ If this variable is set to nil, use internal function only."
       (setq prog sha1-program
            args nil))
     (with-temp-buffer
-      (set-buffer-multibyte nil)
+      (unless (featurep 'xemacs) (set-buffer-multibyte nil))
       (insert string)
       (apply (function call-process-region)
             (point-min) (point-max)
index 4b93af48beaf527726bce4a5e6d363de2f20dda2..a35c14e2fa7ca729764e8ffd368b76c35ccb7fd2 100644 (file)
@@ -340,6 +340,7 @@ Thus, this does not include the shell's current directory.")
        (define-key shell-mode-map "\C-c\C-f" 'shell-forward-command)
        (define-key shell-mode-map "\C-c\C-b" 'shell-backward-command)
        (define-key shell-mode-map "\t" 'comint-dynamic-complete)
+       (define-key shell-mode-map (kbd "M-RET") 'shell-resync-dirs)
        (define-key shell-mode-map "\M-?"
         'comint-dynamic-list-filename-completions)
        (define-key shell-mode-map [menu-bar completion]
index d5065b73ff9f019dc16997a7efaafcf0cc0920f1..a029ef74f44c630a865d39863d932e9d0f4422de 100644 (file)
@@ -6,6 +6,7 @@
 
 ;; Maintainer: FSF
 ;; Keywords: internal
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
@@ -401,8 +402,7 @@ location."
 Other major modes are defined by comparison with this one."
   (interactive)
   (kill-all-local-variables)
-  (unless delay-mode-hooks
-    (run-hooks 'after-change-major-mode-hook)))
+  (run-mode-hooks 'fundamental-mode-hook))
 
 ;; Special major modes to view specially formatted data rather than files.
 
@@ -423,6 +423,26 @@ Other major modes are defined by comparison with this one."
   "Parent major mode from which special major modes should inherit."
   (setq buffer-read-only t))
 
+;; Major mode meant to be the parent of programming modes.
+
+(defvar prog-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map [?\C-\M-q] 'prog-indent-sexp)
+    map)
+  "Keymap used for programming modes.")
+
+(defun prog-indent-sexp ()
+  "Indent the expression after point."
+  (interactive)
+  (let ((start (point))
+        (end (save-excursion (forward-sexp 1) (point))))
+    (indent-region start end nil)))
+
+(define-derived-mode prog-mode fundamental-mode "Prog"
+  "Major mode for editing programming language source code."
+  (set (make-local-variable 'require-final-newline) mode-require-final-newline)
+  (set (make-local-variable 'parse-sexp-ignore-comments) t))
+
 ;; Making and deleting lines.
 
 (defvar hard-newline (propertize "\n" 'hard t 'rear-nonsticky '(hard))
@@ -840,6 +860,78 @@ Don't use this command in Lisp programs!
         (overlay-recenter (point))
         (recenter -3))))
 
+(defcustom delete-active-region t
+  "Whether single-char deletion commands delete an active region.
+This has an effect only if Transient Mark mode is enabled, and
+affects `delete-forward-char' and `delete-backward-char', though
+not `delete-char'.
+
+If the value is the symbol `kill', the active region is killed
+instead of deleted."
+  :type '(choice (const :tag "Delete active region" t)
+                 (const :tag "Kill active region" kill)
+                 (const :tag "Do ordinary deletion" nil))
+  :group 'editing
+  :version "24.1")
+
+(defun delete-backward-char (n &optional killflag)
+  "Delete the previous N characters (following if N is negative).
+If Transient Mark mode is enabled, the mark is active, and N is 1,
+delete the text in the region and deactivate the mark instead.
+To disable this, set `delete-active-region' to nil.
+
+Optional second arg KILLFLAG, if non-nil, means to kill (save in
+kill ring) instead of delete.  Interactively, N is the prefix
+arg, and KILLFLAG is set if N is explicitly specified.
+
+In Overwrite mode, single character backward deletion may replace
+tabs with spaces so as to back over columns, unless point is at
+the end of the line."
+  (interactive "p\nP")
+  (unless (integerp n)
+    (signal 'wrong-type-argument (list 'integerp n)))
+  (cond ((and (use-region-p)
+             delete-active-region
+             (= n 1))
+        ;; If a region is active, kill or delete it.
+        (if (eq delete-active-region 'kill)
+            (kill-region (region-beginning) (region-end))
+          (delete-region (region-beginning) (region-end))))
+       ;; In Overwrite mode, maybe untabify while deleting
+       ((null (or (null overwrite-mode)
+                  (<= n 0)
+                  (memq (char-before) '(?\t ?\n))
+                  (eobp)
+                  (eq (char-after) ?\n)))
+        (let* ((ocol (current-column))
+               (val (delete-char (- n) killflag)))
+          (save-excursion
+            (insert-char ?\s (- ocol (current-column)) nil))))
+       ;; Otherwise, do simple deletion.
+       (t (delete-char (- n) killflag))))
+
+(defun delete-forward-char (n &optional killflag)
+  "Delete the following N characters (previous if N is negative).
+If Transient Mark mode is enabled, the mark is active, and N is 1,
+delete the text in the region and deactivate the mark instead.
+To disable this, set `delete-active-region' to nil.
+
+Optional second arg KILLFLAG non-nil means to kill (save in kill
+ring) instead of delete.  Interactively, N is the prefix arg, and
+KILLFLAG is set if N was explicitly specified."
+  (interactive "p\nP")
+  (unless (integerp n)
+    (signal 'wrong-type-argument (list 'integerp n)))
+  (cond ((and (use-region-p)
+             delete-active-region
+             (= n 1))
+        ;; If a region is active, kill or delete it.
+        (if (eq delete-active-region 'kill)
+            (kill-region (region-beginning) (region-end))
+          (delete-region (region-beginning) (region-end))))
+       ;; Otherwise, do simple deletion.
+       (t (delete-char n killflag))))
+
 (defun mark-whole-buffer ()
   "Put point at beginning and mark at end of buffer.
 You probably should not use this function in Lisp programs;
@@ -1212,6 +1304,40 @@ to get different commands to edit and resubmit."
       (if command-history
          (error "Argument %d is beyond length of command history" arg)
        (error "There are no previous complex commands to repeat")))))
+
+(defun read-extended-command ()
+  "Read command name to invoke in `execute-extended-command'."
+  (minibuffer-with-setup-hook
+      (lambda ()
+       (set (make-local-variable 'minibuffer-default-add-function)
+            (lambda ()
+              ;; Get a command name at point in the original buffer
+              ;; to propose it after M-n.
+              (with-current-buffer (window-buffer (minibuffer-selected-window))
+                (and (commandp (function-called-at-point))
+                     (format "%S" (function-called-at-point)))))))
+    ;; Read a string, completing from and restricting to the set of
+    ;; all defined commands.  Don't provide any initial input.
+    ;; Save the command read on the extended-command history list.
+    (completing-read
+     (concat (cond
+             ((eq current-prefix-arg '-) "- ")
+             ((and (consp current-prefix-arg)
+                   (eq (car current-prefix-arg) 4)) "C-u ")
+             ((and (consp current-prefix-arg)
+                   (integerp (car current-prefix-arg)))
+              (format "%d " (car current-prefix-arg)))
+             ((integerp current-prefix-arg)
+              (format "%d " current-prefix-arg)))
+            ;; This isn't strictly correct if `execute-extended-command'
+            ;; is bound to anything else (e.g. [menu]).
+            ;; It could use (key-description (this-single-command-keys)),
+            ;; but actually a prompt other than "M-x" would be confusing,
+            ;; because "M-x" is a well-known prompt to read a command
+            ;; and it serves as a shorthand for "Extended command: ".
+            "M-x ")
+     obarray 'commandp t nil 'extended-command-history)))
+
 \f
 (defvar minibuffer-history nil
   "Default minibuffer history list.
@@ -2073,7 +2199,11 @@ to `shell-command-history'."
 
 Like `shell-command' but if COMMAND doesn't end in ampersand, adds `&'
 surrounded by whitespace and executes the command asynchronously.
-The output appears in the buffer `*Async Shell Command*'."
+The output appears in the buffer `*Async Shell Command*'.
+
+In Elisp, you will often be better served by calling `start-process'
+directly, since it offers more control and does not impose the use of a
+shell (with its need to quote arguments)."
   (interactive
    (list
     (read-shell-command "Async shell command: " nil nil
@@ -2134,7 +2264,11 @@ If the optional third argument ERROR-BUFFER is non-nil, it is a buffer
 or buffer name to which to direct the command's standard error output.
 If it is nil, error output is mingled with regular output.
 In an interactive call, the variable `shell-command-default-error-buffer'
-specifies the value of ERROR-BUFFER."
+specifies the value of ERROR-BUFFER.
+
+In Elisp, you will often be better served by calling `call-process' or
+`start-process' directly, since it offers more control and does not impose
+the use of a shell (with its need to quote arguments)."
 
   (interactive
    (list
@@ -2691,6 +2825,60 @@ These commands include \\[set-mark-command] and \\[start-kbd-macro]."
   (reset-this-command-lengths)
   (restore-overriding-map))
 \f
+;; This function is here rather than in subr.el because it uses CL.
+(defmacro with-wrapper-hook (var args &rest body)
+  "Run BODY wrapped with the VAR hook.
+VAR is a special hook: its functions are called with a first argument
+which is the \"original\" code (the BODY), so the hook function can wrap
+the original function, or call it any number of times (including not calling
+it at all).  This is similar to an `around' advice.
+VAR is normally a symbol (a variable) in which case it is treated like
+a hook, with a buffer-local and a global part.  But it can also be an
+arbitrary expression.
+ARGS is a list of variables which will be passed as additional arguments
+to each function, after the initial argument, and which the first argument
+expects to receive when called."
+  (declare (indent 2) (debug t))
+  ;; We need those two gensyms because CL's lexical scoping is not available
+  ;; for function arguments :-(
+  (let ((funs (make-symbol "funs"))
+        (global (make-symbol "global"))
+        (argssym (make-symbol "args")))
+    ;; Since the hook is a wrapper, the loop has to be done via
+    ;; recursion: a given hook function will call its parameter in order to
+    ;; continue looping.
+    `(labels ((runrestofhook (,funs ,global ,argssym)
+                 ;; `funs' holds the functions left on the hook and `global'
+                 ;; holds the functions left on the global part of the hook
+                 ;; (in case the hook is local).
+                 (lexical-let ((funs ,funs)
+                               (global ,global))
+                   (if (consp funs)
+                       (if (eq t (car funs))
+                           (runrestofhook
+                            (append global (cdr funs)) nil ,argssym)
+                         (apply (car funs)
+                                (lambda (&rest ,argssym)
+                                 (runrestofhook (cdr funs) global ,argssym))
+                                ,argssym))
+                     ;; Once there are no more functions on the hook, run
+                     ;; the original body.
+                     (apply (lambda ,args ,@body) ,argssym)))))
+       (runrestofhook ,var
+                      ;; The global part of the hook, if any.
+                      ,(if (symbolp var)
+                           `(if (local-variable-p ',var)
+                                (default-value ',var)))
+                      (list ,@args)))))
+
+(defvar filter-buffer-substring-functions nil
+  "Wrapper hook around `filter-buffer-substring'.
+The functions on this special hook are called with 4 arguments:
+  NEXT-FUN BEG END DELETE
+NEXT-FUN is a function of 3 arguments (BEG END DELETE)
+that performs the default operation.  The other 3 arguments are like
+the ones passed to `filter-buffer-substring'.")
+
 (defvar buffer-substring-filters nil
   "List of filter functions for `filter-buffer-substring'.
 Each function must accept a single argument, a string, and return
@@ -2700,46 +2888,34 @@ the next.  The return value of the last function is used as the
 return value of `filter-buffer-substring'.
 
 If this variable is nil, no filtering is performed.")
+(make-obsolete-variable 'buffer-substring-filters
+                        'filter-buffer-substring-functions "24.1")
 
-(defun filter-buffer-substring (beg end &optional delete noprops)
+(defun filter-buffer-substring (beg end &optional delete)
   "Return the buffer substring between BEG and END, after filtering.
-The buffer substring is passed through each of the filter
-functions in `buffer-substring-filters', and the value from the
-last filter function is returned.  If `buffer-substring-filters'
-is nil, the buffer substring is returned unaltered.
+The filtering is performed by `filter-buffer-substring-functions'.
 
 If DELETE is non-nil, the text between BEG and END is deleted
 from the buffer.
 
-If NOPROPS is non-nil, final string returned does not include
-text properties, while the string passed to the filters still
-includes text properties from the buffer text.
-
-Point is temporarily set to BEG before calling
-`buffer-substring-filters', in case the functions need to know
-where the text came from.
-
 This function should be used instead of `buffer-substring',
 `buffer-substring-no-properties', or `delete-and-extract-region'
 when you want to allow filtering to take place.  For example,
-major or minor modes can use `buffer-substring-filters' to
+major or minor modes can use `filter-buffer-substring-functions' to
 extract characters that are special to a buffer, and should not
 be copied into other buffers."
-  (cond
-   ((or delete buffer-substring-filters)
-    (save-excursion
-      (goto-char beg)
-      (let ((string (if delete (delete-and-extract-region beg end)
-                     (buffer-substring beg end))))
-       (dolist (filter buffer-substring-filters)
-         (setq string (funcall filter string)))
-       (if noprops
-           (set-text-properties 0 (length string) nil string))
-       string)))
-   (noprops
-    (buffer-substring-no-properties beg end))
-   (t
-    (buffer-substring beg end))))
+  (with-wrapper-hook filter-buffer-substring-functions (beg end delete)
+    (cond
+     ((or delete buffer-substring-filters)
+      (save-excursion
+        (goto-char beg)
+        (let ((string (if delete (delete-and-extract-region beg end)
+                        (buffer-substring beg end))))
+          (dolist (filter buffer-substring-filters)
+            (setq string (funcall filter string)))
+          string)))
+     (t
+      (buffer-substring beg end)))))
 
 
 ;;;; Window system cut and paste hooks.
@@ -2851,24 +3027,27 @@ argument should still be a \"useful\" string for such uses."
     (if yank-handler
        (signal 'args-out-of-range
                (list string "yank-handler specified for empty string"))))
-  (when (and kill-do-not-save-duplicates
-             (equal string (car kill-ring)))
-    (setq replace t))
-  (if (fboundp 'menu-bar-update-yank-menu)
-      (menu-bar-update-yank-menu string (and replace (car kill-ring))))
+  (unless (and kill-do-not-save-duplicates
+              (equal string (car kill-ring)))
+    (if (fboundp 'menu-bar-update-yank-menu)
+       (menu-bar-update-yank-menu string (and replace (car kill-ring)))))
   (when save-interprogram-paste-before-kill
     (let ((interprogram-paste (and interprogram-paste-function
                                    (funcall interprogram-paste-function))))
       (when interprogram-paste
-        (if (listp interprogram-paste)
-            (dolist (s (nreverse interprogram-paste))
-              (push s kill-ring))
-            (push interprogram-paste kill-ring)))))
-  (if (and replace kill-ring)
-      (setcar kill-ring string)
-    (push string kill-ring)
-    (if (> (length kill-ring) kill-ring-max)
-       (setcdr (nthcdr (1- kill-ring-max) kill-ring) nil)))
+        (dolist (s (if (listp interprogram-paste)
+                      (nreverse interprogram-paste)
+                    (list interprogram-paste)))
+         (unless (and kill-do-not-save-duplicates
+                      (equal s (car kill-ring)))
+           (push s kill-ring))))))
+  (unless (and kill-do-not-save-duplicates
+              (equal string (car kill-ring)))
+    (if (and replace kill-ring)
+       (setcar kill-ring string)
+      (push string kill-ring)
+      (if (> (length kill-ring) kill-ring-max)
+         (setcdr (nthcdr (1- kill-ring-max) kill-ring) nil))))
   (setq kill-ring-yank-pointer kill-ring)
   (if interprogram-cut-function
       (funcall interprogram-cut-function string (not replace))))
@@ -3471,18 +3650,18 @@ START and END specify the portion of the current buffer to be copied."
   (interactive
    (list (read-buffer "Append to buffer: " (other-buffer (current-buffer) t))
         (region-beginning) (region-end)))
-  (let ((oldbuf (current-buffer)))
-    (let* ((append-to (get-buffer-create buffer))
-           (windows (get-buffer-window-list append-to t t))
-           point)
-      (save-excursion
-       (with-current-buffer append-to
-         (setq point (point))
-         (barf-if-buffer-read-only)
-         (insert-buffer-substring oldbuf start end)
-         (dolist (window windows)
-           (when (= (window-point window) point)
-             (set-window-point window (point)))))))))
+  (let* ((oldbuf (current-buffer))
+         (append-to (get-buffer-create buffer))
+         (windows (get-buffer-window-list append-to t t))
+         point)
+    (save-excursion
+      (with-current-buffer append-to
+        (setq point (point))
+        (barf-if-buffer-read-only)
+        (insert-buffer-substring oldbuf start end)
+        (dolist (window windows)
+          (when (= (window-point window) point)
+            (set-window-point window (point))))))))
 
 (defun prepend-to-buffer (buffer start end)
   "Prepend to specified buffer the text of the region.
@@ -3538,29 +3717,30 @@ a mistake; see the documentation of `set-mark'."
       (marker-position (mark-marker))
     (signal 'mark-inactive nil)))
 
-(defcustom select-active-regions nil
-  "If non-nil, an active region automatically becomes the window selection."
-  :type 'boolean
-  :group 'killing
-  :version "23.1")
-
 (declare-function x-selection-owner-p "xselect.c" (&optional selection))
 
-;; Many places set mark-active directly, and several of them failed to also
-;; run deactivate-mark-hook.  This shorthand should simplify.
 (defsubst deactivate-mark (&optional force)
   "Deactivate the mark by setting `mark-active' to nil.
 Unless FORCE is non-nil, this function does nothing if Transient
 Mark mode is disabled.
 This function also runs `deactivate-mark-hook'."
   (when (or transient-mark-mode force)
-    ;; Copy the latest region into the primary selection, if desired.
-    (and select-active-regions
-        mark-active
-        (display-selections-p)
-        (x-selection-owner-p 'PRIMARY)
-        (x-set-selection 'PRIMARY (buffer-substring-no-properties
-                                   (region-beginning) (region-end))))
+    (when (and (if (eq select-active-regions 'only)
+                  (eq (car-safe transient-mark-mode) 'only)
+                select-active-regions)
+              (region-active-p)
+              (display-selections-p))
+      ;; The var `saved-region-selection', if non-nil, is the text in
+      ;; the region prior to the last command modifying the buffer.
+      ;; Set the selection to that, or to the current region.
+      (cond (saved-region-selection
+            (x-set-selection 'PRIMARY saved-region-selection)
+            (setq saved-region-selection nil))
+           ((/= (region-beginning) (region-end))
+            (x-set-selection 'PRIMARY
+                             (buffer-substring-no-properties
+                              (region-beginning)
+                              (region-end))))))
     (if (and (null force)
             (or (eq transient-mark-mode 'lambda)
                 (and (eq (car-safe transient-mark-mode) 'only)
@@ -3578,10 +3758,7 @@ This function also runs `deactivate-mark-hook'."
   (when (mark t)
     (setq mark-active t)
     (unless transient-mark-mode
-      (setq transient-mark-mode 'lambda))
-    (when (and select-active-regions
-              (display-selections-p))
-      (x-set-selection 'PRIMARY (current-buffer)))))
+      (setq transient-mark-mode 'lambda))))
 
 (defun set-mark (pos)
   "Set this buffer's mark to POS.  Don't use this function!
@@ -3604,9 +3781,6 @@ store it in a Lisp variable.  Example:
       (progn
        (setq mark-active t)
        (run-hooks 'activate-mark-hook)
-       (when (and select-active-regions
-                  (display-selections-p))
-         (x-set-selection 'PRIMARY (current-buffer)))
        (set-marker (mark-marker) pos (current-buffer)))
     ;; Normally we never clear mark-active except in Transient Mark mode.
     ;; But when we actually clear out the mark value too, we must
@@ -3690,8 +3864,6 @@ Display `Mark set' unless the optional second arg NOMSG is non-nil."
        (push-mark nil nomsg t)
       (setq mark-active t)
       (run-hooks 'activate-mark-hook)
-      (and select-active-regions (display-selections-p)
-          (x-set-selection 'PRIMARY (current-buffer)))
       (unless nomsg
        (message "Mark activated")))))
 
@@ -3881,8 +4053,8 @@ deactivate it, and restore the variable `transient-mark-mode' to
 its earlier value."
   (cond ((and shift-select-mode this-command-keys-shift-translated)
          (unless (and mark-active
-                      (eq (car-safe transient-mark-mode) 'only))
-           (setq transient-mark-mode
+                     (eq (car-safe transient-mark-mode) 'only))
+          (setq transient-mark-mode
                  (cons 'only
                        (unless (eq transient-mark-mode 'lambda)
                          transient-mark-mode)))
@@ -3945,6 +4117,14 @@ the current accessible part of the buffer.
 If `widen-automatically' is nil, these commands will do something else
 as a fallback, and won't change the buffer bounds.")
 
+(defvar non-essential nil
+  "Whether the currently executing code is performing an essential task.
+This variable should be non-nil only when running code which should not
+disturb the user.  E.g. it can be used to prevent Tramp from prompting the
+user for a password when we are simply scanning a set of files in the
+background or displaying possible completions before the user even asked
+for it.")
+
 (defun pop-global-mark ()
   "Pop off global mark ring and jump to the top location."
   (interactive)
@@ -4008,9 +4188,10 @@ and more reliable (no dependence on goal column, etc.)."
            (insert (if use-hard-newlines hard-newline "\n")))
        (line-move arg nil nil try-vscroll))
     (if (called-interactively-p 'interactive)
-       (condition-case nil
+       (condition-case err
            (line-move arg nil nil try-vscroll)
-         ((beginning-of-buffer end-of-buffer) (ding)))
+         ((beginning-of-buffer end-of-buffer)
+          (signal (car err) (cdr err))))
       (line-move arg nil nil try-vscroll)))
   nil)
 
@@ -4038,9 +4219,10 @@ to use and more reliable (no dependence on goal column, etc.)."
   (interactive "^p\np")
   (or arg (setq arg 1))
   (if (called-interactively-p 'interactive)
-      (condition-case nil
+      (condition-case err
          (line-move (- arg) nil nil try-vscroll)
-       ((beginning-of-buffer end-of-buffer) (ding)))
+       ((beginning-of-buffer end-of-buffer)
+        (signal (car err) (cdr err))))
     (line-move (- arg) nil nil try-vscroll))
   nil)
 
@@ -4478,6 +4660,9 @@ rests."
               (let ((goal-column 0)
                     (line-move-visual nil))
                 (and (line-move arg t)
+                     ;; With bidi reordering, we may not be at bol,
+                     ;; so make sure we are.
+                     (skip-chars-backward "^\n")
                      (not (bobp))
                      (progn
                        (while (and (not (bobp)) (invisible-p (1- (point))))
@@ -4740,52 +4925,7 @@ This also turns on `word-wrap' in the buffer."
 (define-globalized-minor-mode global-visual-line-mode
   visual-line-mode turn-on-visual-line-mode
   :lighter " vl")
-\f
-(defun scroll-other-window-down (lines)
-  "Scroll the \"other window\" down.
-For more details, see the documentation for `scroll-other-window'."
-  (interactive "P")
-  (scroll-other-window
-   ;; Just invert the argument's meaning.
-   ;; We can do that without knowing which window it will be.
-   (if (eq lines '-) nil
-     (if (null lines) '-
-       (- (prefix-numeric-value lines))))))
-
-(defun beginning-of-buffer-other-window (arg)
-  "Move point to the beginning of the buffer in the other window.
-Leave mark at previous position.
-With arg N, put point N/10 of the way from the true beginning."
-  (interactive "P")
-  (let ((orig-window (selected-window))
-       (window (other-window-for-scrolling)))
-    ;; We use unwind-protect rather than save-window-excursion
-    ;; because the latter would preserve the things we want to change.
-    (unwind-protect
-       (progn
-         (select-window window)
-         ;; Set point and mark in that window's buffer.
-         (with-no-warnings
-          (beginning-of-buffer arg))
-         ;; Set point accordingly.
-         (recenter '(t)))
-      (select-window orig-window))))
-
-(defun end-of-buffer-other-window (arg)
-  "Move point to the end of the buffer in the other window.
-Leave mark at previous position.
-With arg N, put point N/10 of the way from the true end."
-  (interactive "P")
-  ;; See beginning-of-buffer-other-window for comments.
-  (let ((orig-window (selected-window))
-       (window (other-window-for-scrolling)))
-    (unwind-protect
-       (progn
-         (select-window window)
-         (with-no-warnings
-          (end-of-buffer arg))
-         (recenter '(t)))
-      (select-window orig-window))))
+
 \f
 (defun transpose-chars (arg)
   "Interchange characters around point, moving forward one character.
@@ -5148,7 +5288,7 @@ Some major modes set this.")
 (put 'auto-fill-function 'safe-local-variable 'null)
 ;; FIXME: turn into a proper minor mode.
 ;; Add a global minor mode version of it.
-(defun auto-fill-mode (&optional arg)
+(define-minor-mode auto-fill-mode
   "Toggle Auto Fill mode.
 With ARG, turn Auto Fill mode on if and only if ARG is positive.
 In Auto Fill mode, inserting a space at a column beyond `current-fill-column'
@@ -5156,14 +5296,7 @@ automatically breaks the line at a previous space.
 
 The value of `normal-auto-fill-function' specifies the function to use
 for `auto-fill-function' when turning Auto Fill mode on."
-  (interactive "P")
-  (prog1 (setq auto-fill-function
-              (if (if (null arg)
-                      (not auto-fill-function)
-                      (> (prefix-numeric-value arg) 0))
-                  normal-auto-fill-function
-                  nil))
-    (force-mode-line-update)))
+  :variable (eq auto-fill-function normal-auto-fill-function))
 
 ;; This holds a document string used to document auto-fill-mode.
 (defun auto-fill-function ()
@@ -5262,7 +5395,7 @@ if long lines are truncated."
 (defvar overwrite-mode-binary (purecopy " Bin Ovwrt")
   "The string displayed in the mode line when in binary overwrite mode.")
 
-(defun overwrite-mode (arg)
+(define-minor-mode overwrite-mode
   "Toggle overwrite mode.
 With prefix argument ARG, turn overwrite mode on if ARG is positive,
 otherwise turn it off.  In overwrite mode, printing characters typed
@@ -5271,14 +5404,9 @@ it to the right.  At the end of a line, such characters extend 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."
-  (interactive "P")
-  (setq overwrite-mode
-       (if (if (null arg) (not overwrite-mode)
-             (> (prefix-numeric-value arg) 0))
-           'overwrite-mode-textual))
-  (force-mode-line-update))
+  :variable (eq overwrite-mode 'overwrite-mode-textual))
 
-(defun binary-overwrite-mode (arg)
+(define-minor-mode binary-overwrite-mode
   "Toggle binary overwrite mode.
 With prefix argument ARG, turn binary overwrite mode on if ARG is
 positive, otherwise turn it off.  In binary overwrite mode, printing
@@ -5291,13 +5419,7 @@ replaces the text at the cursor, just as 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'."
-  (interactive "P")
-  (setq overwrite-mode
-       (if (if (null arg)
-               (not (eq overwrite-mode 'overwrite-mode-binary))
-             (> (prefix-numeric-value arg) 0))
-           'overwrite-mode-binary))
-  (force-mode-line-update))
+  :variable (eq overwrite-mode 'overwrite-mode-binary))
 
 (define-minor-mode line-number-mode
   "Toggle Line Number mode.
@@ -5323,6 +5445,26 @@ With ARG, turn Size Indication mode on if ARG is positive,
 otherwise turn it off.  When Size Indication mode is enabled, the
 size of the accessible part of the buffer appears in the mode line."
   :global t :group 'mode-line)
+
+(define-minor-mode auto-save-mode
+  "Toggle auto-saving of contents of current buffer.
+With prefix argument ARG, turn auto-saving on if positive, else off."
+  :variable ((and buffer-auto-save-file-name
+                  ;; If auto-save is off because buffer has shrunk,
+                  ;; then toggling should turn it on.
+                  (>= buffer-saved-size 0))
+             . (lambda (val)
+                 (setq buffer-auto-save-file-name
+                       (cond
+                        ((null val) nil)
+                        ((and buffer-file-name auto-save-visited-file-name
+                              (not buffer-read-only))
+                         buffer-file-name)
+                        (t (make-auto-save-file-name))))))
+  ;; If -1 was stored here, to temporarily turn off saving,
+  ;; turn it back on.
+  (and (< buffer-saved-size 0)
+       (setq buffer-saved-size 0)))
 \f
 (defgroup paren-blinking nil
   "Blinking matching of parens and expressions."
@@ -5391,7 +5533,9 @@ it skips the contents of comments that end before point."
                        (and parse-sexp-ignore-comments
                             (not blink-matching-paren-dont-ignore-comments))))
                   (condition-case ()
-                      (scan-sexps oldpos -1)
+                      (progn
+                        (forward-sexp -1)
+                        (point))
                     (error nil))))))
           (matching-paren
             (and blinkpos
@@ -5475,7 +5619,10 @@ it skips the contents of comments that end before point."
 During execution of Lisp code, this character causes a quit directly.
 At top-level, as an editor command, this simply beeps."
   (interactive)
-  (deactivate-mark)
+  ;; Avoid adding the region to the window selection.
+  (setq saved-region-selection nil)
+  (let (select-active-regions)
+    (deactivate-mark))
   (if (fboundp 'kmacro-keyboard-quit)
       (kmacro-keyboard-quit))
   (setq defining-kbd-macro nil)
@@ -5495,12 +5642,12 @@ cancel the use of the current buffer (for special-purpose buffers),
 or go back to just one window (by deleting all but the selected window)."
   (interactive)
   (cond ((eq last-command 'mode-exited) nil)
+       ((region-active-p)
+        (deactivate-mark))
        ((> (minibuffer-depth) 0)
         (abort-recursive-edit))
        (current-prefix-arg
         nil)
-       ((region-active-p)
-        (deactivate-mark))
        ((> (recursion-depth) 0)
         (exit-recursive-edit))
        (buffer-quit-function
@@ -6426,6 +6573,7 @@ call `normal-erase-is-backspace-mode' (which see) instead."
        (if (if (eq normal-erase-is-backspace 'maybe)
                (and (not noninteractive)
                     (or (memq system-type '(ms-dos windows-nt))
+                       (memq window-system '(ns))
                         (and (memq window-system '(x))
                              (fboundp 'x-backspace-delete-keys-p)
                              (x-backspace-delete-keys-p))
@@ -6437,7 +6585,7 @@ call `normal-erase-is-backspace-mode' (which see) instead."
              normal-erase-is-backspace)
            1 0)))))
 
-(defun normal-erase-is-backspace-mode (&optional arg)
+(define-minor-mode normal-erase-is-backspace-mode
   "Toggle the Erase and Delete mode of the Backspace and Delete keys.
 
 With numeric ARG, turn the mode on if and only if ARG is positive.
@@ -6467,13 +6615,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'."
-  (interactive "P")
-  (let ((enabled (or (and arg (> (prefix-numeric-value arg) 0))
-                    (not (or arg
-                              (eq 1 (terminal-parameter
-                                     nil 'normal-erase-is-backspace)))))))
-    (set-terminal-parameter nil 'normal-erase-is-backspace
-                           (if enabled 1 0))
+  :variable (eq (terminal-parameter
+                 nil 'normal-erase-is-backspace) 1)
+  (let ((enabled (eq 1 (terminal-parameter
+                        nil 'normal-erase-is-backspace))))
 
     (cond ((or (memq window-system '(x w32 ns pc))
               (memq system-type '(ms-dos windows-nt)))
@@ -6509,7 +6654,6 @@ See also `normal-erase-is-backspace'."
             (keyboard-translate ?\C-h ?\C-h)
             (keyboard-translate ?\C-? ?\C-?))))
 
-    (run-hooks 'normal-erase-is-backspace-hook)
     (if (called-interactively-p 'interactive)
        (message "Delete key deletes %s"
                 (if (eq 1 (terminal-parameter nil 'normal-erase-is-backspace))
@@ -6546,52 +6690,6 @@ the first N arguments are fixed at the values with which this function
 was called."
   (lexical-let ((fun fun) (args1 args))
     (lambda (&rest args2) (apply fun (append args1 args2)))))
-
-;; This function is here rather than in subr.el because it uses CL.
-(defmacro with-wrapper-hook (var args &rest body)
-  "Run BODY wrapped with the VAR hook.
-VAR is a special hook: its functions are called with a first argument
-which is the \"original\" code (the BODY), so the hook function can wrap
-the original function, or call it any number of times (including not calling
-it at all).  This is similar to an `around' advice.
-VAR is normally a symbol (a variable) in which case it is treated like
-a hook, with a buffer-local and a global part.  But it can also be an
-arbitrary expression.
-ARGS is a list of variables which will be passed as additional arguments
-to each function, after the initial argument, and which the first argument
-expects to receive when called."
-  (declare (indent 2) (debug t))
-  ;; We need those two gensyms because CL's lexical scoping is not available
-  ;; for function arguments :-(
-  (let ((funs (make-symbol "funs"))
-        (global (make-symbol "global"))
-        (argssym (make-symbol "args")))
-    ;; Since the hook is a wrapper, the loop has to be done via
-    ;; recursion: a given hook function will call its parameter in order to
-    ;; continue looping.
-    `(labels ((runrestofhook (,funs ,global ,argssym)
-                 ;; `funs' holds the functions left on the hook and `global'
-                 ;; holds the functions left on the global part of the hook
-                 ;; (in case the hook is local).
-                 (lexical-let ((funs ,funs)
-                               (global ,global))
-                   (if (consp funs)
-                       (if (eq t (car funs))
-                           (runrestofhook
-                            (append global (cdr funs)) nil ,argssym)
-                         (apply (car funs)
-                                (lambda (&rest ,argssym)
-                                 (runrestofhook (cdr funs) global ,argssym))
-                                ,argssym))
-                     ;; Once there are no more functions on the hook, run
-                     ;; the original body.
-                     (apply (lambda ,args ,@body) ,argssym)))))
-       (runrestofhook ,var
-                      ;; The global part of the hook, if any.
-                      ,(if (symbolp var)
-                           `(if (local-variable-p ',var)
-                                (default-value ',var)))
-                      (list ,@args)))))
 \f
 ;; Minibuffer prompt stuff.
 
index b228b5031b29bfe211bfacff696660c0d0a31cdf..28798b1a3b2c92bbe994ee12fd38c87105543793 100644 (file)
@@ -358,7 +358,7 @@ automatically, and you are prompted to fill in the variable parts.")))
             (< element 0))
        (if skeleton-untabify
            (backward-delete-char-untabify (- element))
-         (delete-backward-char (- element)))
+         (delete-char element))
       (insert (if (not literal)
                  (funcall skeleton-transformation-function element)
                element))))
index 60c1ff6b170d40452c74923940a437e8cf7cfede..5e732b398f30e51ddfbdb7d28c206c1b3cf43833 100644 (file)
@@ -1644,8 +1644,8 @@ Files can be renamed to new names or moved to new directories."
     (if (speedbar-y-or-n-p (format "Delete %s? " f) t)
        (progn
          (if (file-directory-p f)
-             (delete-directory f)
-           (delete-file f))
+             (delete-directory f t t)
+           (delete-file f t))
          (speedbar-message "Okie dokie.")
          (let ((p (point)))
            (speedbar-refresh)
index 87f1a00bd542ca89b596c32023a2e6441a13bc3f..c029eff54cfee19a64264a7229d4569c228b827d 100644 (file)
@@ -6,6 +6,7 @@
 
 ;; Maintainer: FSF
 ;; Keywords: internal
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
@@ -785,15 +786,16 @@ opening the first frame (e.g. open a connection to an X server).")
                 argi (match-string 1 argi)))
        (when (string-match "\\`--." orig-argi)
          (let ((completion (try-completion argi longopts)))
-           (if (eq completion t)
-               (setq argi (substring argi 1))
-             (if (stringp completion)
-                 (let ((elt (assoc completion longopts)))
-                   (or elt
-                       (error "Option `%s' is ambiguous" argi))
-                   (setq argi (substring (car elt) 1)))
-               (setq argval nil
-                      argi orig-argi)))))
+           (cond ((eq completion t)
+                  (setq argi (substring argi 1)))
+                 ((stringp completion)
+                  (let ((elt (assoc completion longopts)))
+                    (unless elt
+                      (error "Option `%s' is ambiguous" argi))
+                    (setq argi (substring (car elt) 1))))
+                 (t
+                  (setq argval nil
+                        argi orig-argi)))))
        (cond
         ;; The --display arg is handled partly in C, partly in Lisp.
         ;; When it shows up here, we just put it back to be handled
@@ -878,10 +880,33 @@ opening the first frame (e.g. open a connection to an X server).")
 
   (run-hooks 'before-init-hook)
 
-  ;; Under X Window, this creates the X frame and deletes the terminal frame.
+  ;; Under X, this creates the X frame and deletes the terminal frame.
   (unless (daemonp)
+    ;; Enable or disable the tool-bar and menu-bar.
+    ;; While we're at it, set `no-blinking-cursor' too.
+    (cond
+     ((or noninteractive emacs-basic-display)
+      (setq menu-bar-mode nil
+           tool-bar-mode nil
+           no-blinking-cursor t))
+     ;; Check X resources if available.
+     ((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)))))
     (frame-initialize))
 
+  (when (fboundp 'x-create-frame)
+    ;; Set up the tool-bar (even in tty frames, since Emacs might open a
+    ;; graphical frame later).
+    (unless noninteractive
+      (tool-bar-setup)))
+
   ;; Turn off blinking cursor if so specified in X resources.  This is here
   ;; only because all other settings of no-blinking-cursor are here.
   (unless (or noninteractive
@@ -891,25 +916,6 @@ opening the first frame (e.g. open a connection to an X server).")
                                '("off" "false")))))
     (setq no-blinking-cursor t))
 
-  ;; If frame was created with a menu bar, set menu-bar-mode on.
-  (unless (or noninteractive
-             emacs-basic-display
-              (and (memq initial-window-system '(x w32))
-                   (<= (frame-parameter nil 'menu-bar-lines) 0)))
-    (menu-bar-mode 1))
-
-  (unless (or noninteractive (not (fboundp 'tool-bar-mode)))
-    ;; Set up the tool-bar.  Do this even in tty frames, so that there
-    ;; is a tool-bar if Emacs later opens a graphical frame.
-    (if (or emacs-basic-display
-           (and (numberp (frame-parameter nil 'tool-bar-lines))
-                (<= (frame-parameter nil 'tool-bar-lines) 0)))
-       ;; On a graphical display with the toolbar disabled via X
-       ;; resources, set up the toolbar without enabling it.
-       (tool-bar-setup)
-      ;; Otherwise, enable tool-bar-mode.
-      (tool-bar-mode 1)))
-
   ;; Re-evaluate predefined variables whose initial value depends on
   ;; the runtime context.
   (mapc 'custom-reevaluate-setting
@@ -1166,6 +1172,9 @@ the `--debug-init' option to view a complete error backtrace."
                 (eq face-ignored-fonts old-face-ignored-fonts))
       (clear-face-cache)))
 
+  ;; Load ELPA packages.
+  (and user-init-file package-enable-at-startup (package-initialize))
+
   (setq after-init-time (current-time))
   (run-hooks 'after-init-hook)
 
@@ -2224,6 +2233,11 @@ A fancy display is used on graphic displays, normal otherwise."
                     (move-to-column (1- cl1-column)))
                   (setq cl1-column 0))
 
+                 ;; These command lines now have no effect.
+                 ((string-match "\\`--?\\(no-\\)?\\(uni\\|multi\\)byte$" argi)
+                  (display-warning 'initialization
+                                   (format "Ignoring obsolete arg %s" argi)))
+
                  ((equal argi "--")
                   (setq just-files t))
                  (t
index a4a0996a7261c9da760627ef5f3a1ad960ee8098..83cf7211906a4712c92b8f30a287e81e612e7dc0 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Maintainer: FSF
 ;; Keywords: internal
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
@@ -1056,7 +1057,6 @@ is converted into a string by expressing it in decimal."
 (make-obsolete-variable 'default-line-spacing 'line-spacing "23.2")
 (make-obsolete-variable 'default-abbrev-mode 'abbrev-mode "23.2")
 (make-obsolete-variable 'default-ctl-arrow 'ctl-arrow "23.2")
-(make-obsolete-variable 'default-direction-reversed 'direction-reversed "23.2")
 (make-obsolete-variable 'default-truncate-lines 'truncate-lines "23.2")
 (make-obsolete-variable 'default-left-margin 'left-margin "23.2")
 (make-obsolete-variable 'default-tab-width 'tab-width "23.2")
@@ -1091,7 +1091,11 @@ is converted into a string by expressing it in decimal."
 (make-obsolete 'process-filter-multibyte-p nil "23.1")
 (make-obsolete 'set-process-filter-multibyte nil "23.1")
 
-(make-obsolete-variable 'directory-sep-char "do not use it." "21.1")
+(defconst directory-sep-char ?/
+  "Directory separator character for built-in functions that return file names.
+The value is always ?/.")
+(make-obsolete-variable 'directory-sep-char "do not use it, just use `/'." "21.1")
+
 (make-obsolete-variable
  'mode-line-inverse-video
  "use the appropriate faces instead."
@@ -1479,8 +1483,7 @@ If TOGGLE has a `:menu-tag', that is used for the menu item's label."
              (let ((rest (cdr found)))
                (setcdr found nil)
                (nconc found (list (list toggle name)) rest))
-           (setq minor-mode-alist (cons (list toggle name)
-                                        minor-mode-alist)))))))
+           (push (list toggle name) minor-mode-alist))))))
   ;; Add the toggle to the minor-modes menu if requested.
   (when (get toggle :included)
     (define-key mode-line-mode-menu
@@ -1509,8 +1512,7 @@ If TOGGLE has a `:menu-tag', that is used for the menu item's label."
              (let ((rest (cdr found)))
                (setcdr found nil)
                (nconc found (list (cons toggle keymap)) rest))
-           (setq minor-mode-map-alist (cons (cons toggle keymap)
-                                            minor-mode-map-alist))))))))
+           (push (cons toggle keymap) minor-mode-map-alist)))))))
 \f
 ;;; Load history
 
@@ -1628,6 +1630,7 @@ Return nil if there isn't one."
              load-elt (and loads (car loads)))))
     load-elt))
 
+(put 'eval-after-load 'lisp-indent-function 1)
 (defun eval-after-load (file form)
   "Arrange that, if FILE is ever loaded, FORM will be run at that time.
 If FILE is already loaded, evaluate FORM right now.
@@ -2711,7 +2714,7 @@ nor the buffer list."
   "Create a new buffer, evaluate BODY there, and write the buffer to FILE.
 The value returned is the value of the last form in BODY.
 See also `with-temp-buffer'."
-  (declare (debug t))
+  (declare (indent 1) (debug t))
   (let ((temp-file (make-symbol "temp-file"))
        (temp-buffer (make-symbol "temp-buffer")))
     `(let ((,temp-file ,file)
@@ -2733,7 +2736,7 @@ The value returned is the value of the last form in BODY.
 MESSAGE is written to the message log buffer if `message-log-max' is non-nil.
 If MESSAGE is nil, the echo area and message log buffer are unchanged.
 Use a MESSAGE of \"\" to temporarily clear the echo area."
-  (declare (debug t))
+  (declare (debug t) (indent 1))
   (let ((current-message (make-symbol "current-message"))
        (temp-message (make-symbol "with-temp-message")))
     `(let ((,temp-message ,message)
@@ -2763,7 +2766,7 @@ See also `with-temp-file' and `with-output-to-string'."
                 (kill-buffer ,temp-buffer)))))))
 
 (defmacro with-silent-modifications (&rest body)
-  "Execute BODY, pretending it does not modifies the buffer.
+  "Execute BODY, pretending it does not modify the buffer.
 If BODY performs real modifications to the buffer's text, other
 than cosmetic ones, undo data may become corrupted.
 Typically used around modifications of text-properties which do not really
@@ -3225,7 +3228,7 @@ that can be added."
 The syntax table of the current buffer is saved, BODY is evaluated, and the
 saved table is restored, even in case of an abnormal exit.
 Value is what BODY returns."
-  (declare (debug t))
+  (declare (debug t) (indent 1))
   (let ((old-table (make-symbol "table"))
        (old-buffer (make-symbol "buffer")))
     `(let ((,old-table (syntax-table))
@@ -3414,51 +3417,59 @@ The properties used on SYMBOL are `composefunc', `sendfunc',
 ;; digits of precision, it doesn't really matter here.  On the other
 ;; hand, it greatly simplifies the code.
 
-(defsubst progress-reporter-update (reporter value)
+(defsubst progress-reporter-update (reporter &optional value)
   "Report progress of an operation in the echo area.
-However, if the change since last echo area update is too small
-or not enough time has passed, then do nothing (see
-`make-progress-reporter' for details).
-
-First parameter, REPORTER, should be the result of a call to
-`make-progress-reporter'.  Second, VALUE, determines the actual
-progress of operation; it must be between MIN-VALUE and MAX-VALUE
-as passed to `make-progress-reporter'.
-
-This function is very inexpensive, you may not bother how often
-you call it."
-  (when (>= value (car reporter))
-    (progress-reporter-do-update reporter value)))
+REPORTER should be the result of a call to `make-progress-reporter'.
 
-(defun make-progress-reporter (message min-value max-value
-                                      &optional current-value
-                                      min-change min-time)
-  "Return progress reporter object to be used with `progress-reporter-update'.
-
-MESSAGE is shown in the echo area.  When at least 1% of operation
-is complete, the exact percentage will be appended to the
-MESSAGE.  When you call `progress-reporter-done', word \"done\"
-is printed after the MESSAGE.  You can change MESSAGE of an
-existing progress reporter with `progress-reporter-force-update'.
-
-MIN-VALUE and MAX-VALUE designate starting (0% complete) and
-final (100% complete) states of operation.  The latter should be
-larger; if this is not the case, then simply negate all values.
-Optional CURRENT-VALUE specifies the progress by the moment you
-call this function.  You should omit it or set it to nil in most
-cases since it defaults to MIN-VALUE.
-
-Optional MIN-CHANGE determines the minimal change in percents to
-report (default is 1%.)  Optional MIN-TIME specifies the minimal
-time before echo area updates (default is 0.2 seconds.)  If
-`float-time' function is not present, then time is not tracked
-at all.  If OS is not capable of measuring fractions of seconds,
-then this parameter is effectively rounded up."
+If REPORTER is a numerical progress reporter---i.e. if it was
+ made using non-nil MIN-VALUE and MAX-VALUE arguments to
+ `make-progress-reporter'---then VALUE should be a number between
+ MIN-VALUE and MAX-VALUE.
+
+If REPORTER is a non-numerical reporter, VALUE should be nil.
+
+This function is relatively inexpensive.  If the change since
+last update is too small or insufficient time has passed, it does
+nothing."
+  (when (or (not (numberp value))      ; For pulsing reporter
+           (>= value (car reporter))) ; For numerical reporter
+    (progress-reporter-do-update reporter value)))
 
+(defun make-progress-reporter (message &optional min-value max-value
+                                      current-value min-change min-time)
+  "Return progress reporter object for use with `progress-reporter-update'.
+
+MESSAGE is shown in the echo area, with a status indicator
+appended to the end.  When you call `progress-reporter-done', the
+word \"done\" is printed after the MESSAGE.  You can change the
+MESSAGE of an existing progress reporter by calling
+`progress-reporter-force-update'.
+
+MIN-VALUE and MAX-VALUE, if non-nil, are starting (0% complete)
+and final (100% complete) states of operation; the latter should
+be larger.  In this case, the status message shows the percentage
+progress.
+
+If MIN-VALUE and/or MAX-VALUE is omitted or nil, the status
+message shows a \"spinning\", non-numeric indicator.
+
+Optional CURRENT-VALUE is the initial progress; the default is
+MIN-VALUE.
+Optional MIN-CHANGE is the minimal change in percents to report;
+the default is 1%.
+CURRENT-VALUE and MIN-CHANGE do not have any effect if MIN-VALUE
+and/or MAX-VALUE are nil.
+
+Optional MIN-TIME specifies the minimum interval time between
+echo area updates (default is 0.2 seconds.)  If the function
+`float-time' is not present, time is not tracked at all.  If the
+OS is not capable of measuring fractions of seconds, this
+parameter is effectively rounded up."
   (unless min-time
     (setq min-time 0.2))
   (let ((reporter
-        (cons min-value ;; Force a call to `message' now
+        ;; Force a call to `message' now
+        (cons (or min-value 0)
               (vector (if (and (fboundp 'float-time)
                                (>= min-time 0.02))
                           (float-time) nil)
@@ -3470,12 +3481,11 @@ then this parameter is effectively rounded up."
     (progress-reporter-update reporter (or current-value min-value))
     reporter))
 
-(defun progress-reporter-force-update (reporter value &optional new-message)
+(defun progress-reporter-force-update (reporter &optional value new-message)
   "Report progress of an operation in the echo area unconditionally.
 
-First two parameters are the same as for
-`progress-reporter-update'.  Optional NEW-MESSAGE allows you to
-change the displayed message."
+The first two arguments are the same as in `progress-reporter-update'.
+NEW-MESSAGE, if non-nil, sets a new message for the reporter."
   (let ((parameters (cdr reporter)))
     (when new-message
       (aset parameters 3 new-message))
@@ -3483,15 +3493,15 @@ change the displayed message."
       (aset parameters 0 (float-time)))
     (progress-reporter-do-update reporter value)))
 
+(defvar progress-reporter--pulse-characters ["-" "\\" "|" "/"]
+  "Characters to use for pulsing progress reporters.")
+
 (defun progress-reporter-do-update (reporter value)
   (let* ((parameters   (cdr reporter))
+        (update-time  (aref parameters 0))
         (min-value    (aref parameters 1))
         (max-value    (aref parameters 2))
-        (one-percent  (/ (- max-value min-value) 100.0))
-        (percentage   (if (= max-value min-value)
-                          0
-                        (truncate (/ (- value min-value) one-percent))))
-        (update-time  (aref parameters 0))
+        (text         (aref parameters 3))
         (current-time (float-time))
         (enough-time-passed
          ;; See if enough time has passed since the last update.
@@ -3499,26 +3509,41 @@ change the displayed message."
              (when (>= current-time update-time)
                ;; Calculate time for the next update
                (aset parameters 0 (+ update-time (aref parameters 5)))))))
-    ;;
-    ;; Calculate NEXT-UPDATE-VALUE.  If we are not going to print
-    ;; message this time because not enough time has passed, then use
-    ;; 1 instead of MIN-CHANGE.  This makes delays between echo area
-    ;; updates closer to MIN-TIME.
-    (setcar reporter
-           (min (+ min-value (* (+ percentage
-                                   (if enough-time-passed
-                                       (aref parameters 4) ;; MIN-CHANGE
-                                     1))
-                                one-percent))
-                max-value))
-    (when (integerp value)
-      (setcar reporter (ceiling (car reporter))))
-    ;;
-    ;; Only print message if enough time has passed
-    (when enough-time-passed
-      (if (> percentage 0)
-         (message "%s%d%%" (aref parameters 3) percentage)
-       (message "%s" (aref parameters 3))))))
+    (cond ((and min-value max-value)
+          ;; Numerical indicator
+          (let* ((one-percent (/ (- max-value min-value) 100.0))
+                 (percentage  (if (= max-value min-value)
+                                  0
+                                (truncate (/ (- value min-value)
+                                             one-percent)))))
+            ;; Calculate NEXT-UPDATE-VALUE.  If we are not printing
+            ;; message because not enough time has passed, use 1
+            ;; instead of MIN-CHANGE.  This makes delays between echo
+            ;; area updates closer to MIN-TIME.
+            (setcar reporter
+                    (min (+ min-value (* (+ percentage
+                                            (if enough-time-passed
+                                                ;; MIN-CHANGE
+                                                (aref parameters 4)
+                                              1))
+                                         one-percent))
+                         max-value))
+            (when (integerp value)
+              (setcar reporter (ceiling (car reporter))))
+            ;; Only print message if enough time has passed
+            (when enough-time-passed
+              (if (> percentage 0)
+                  (message "%s%d%%" text percentage)
+                (message "%s" text)))))
+         ;; Pulsing indicator
+         (enough-time-passed
+          (let ((index (mod (1+ (car reporter)) 4))
+                (message-log-max nil))
+            (setcar reporter index)
+            (message "%s %s"
+                     text
+                     (aref progress-reporter--pulse-characters
+                           index)))))))
 
 (defun progress-reporter-done (reporter)
   "Print reporter's message followed by word \"done\" in echo area."
@@ -3561,11 +3586,11 @@ Usually the separator is \".\", but it can be any other string.")
 
 
 (defconst version-regexp-alist
-  '(("^[-_+ ]?a\\(lpha\\)?$"   . -3)
+  '(("^[-_+ ]?alpha$"   . -3)
     ("^[-_+]$"                 . -3) ; treat "1.2.3-20050920" and "1.2-3" as alpha releases
     ("^[-_+ ]cvs$"             . -3)   ; treat "1.2.3-CVS" as alpha release
-    ("^[-_+ ]?b\\(eta\\)?$"    . -2)
-    ("^[-_+ ]?\\(pre\\|rc\\)$" . -1))
+    ("^[-_+ ]?beta$"    . -2)
+    ("^[-_+ ]?\\(pre\\|rcc\\)$" . -1))
   "*Specify association between non-numeric version and its priority.
 
 This association is used to handle version string like \"1.0pre2\",
@@ -3658,8 +3683,13 @@ See documentation for `version-separator' and `version-regexp-alist'."
            (setq al version-regexp-alist)
            (while (and al (not (string-match (caar al) s)))
              (setq al (cdr al)))
-           (or al (error "Invalid version syntax: '%s'" ver))
-           (setq lst (cons (cdar al) lst)))))
+           (cond (al
+                  (push (cdar al) lst))
+                 ;; Convert 22.3a to 22.3.1.
+                 ((string-match "^[-_+ ]?\\([a-zA-Z]\\)$" s)
+                  (push (- (aref (downcase (match-string 1 s)) 0) ?a -1)
+                        lst))
+                 (t (error "Invalid version syntax: '%s'" ver))))))
       (if (null lst)
          (error "Invalid version syntax: '%s'" ver)
        (nreverse lst)))))
index c8cf877cb9cfa2806da103ad081c3b3bda0ae754..591a9432fe589ad342b5cb7518ea5f4bced7a283 100644 (file)
@@ -4,6 +4,7 @@
 ;;   2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
index be9af8e293d1b34f24763379d2b03bb7375fa5b6..f8b9cf09fba2fd361b2f38c270f2ff830895d65e 100644 (file)
@@ -137,7 +137,6 @@ This information is useful, but it takes screen space away from file names."
 (defvar tar-parse-info nil)
 (defvar tar-superior-buffer nil)
 (defvar tar-superior-descriptor nil)
-(defvar tar-subfile-mode nil)
 (defvar tar-file-name-coding-system nil)
 
 (put 'tar-superior-buffer 'permanent-local t)
@@ -672,29 +671,21 @@ See also: variables `tar-update-datestamp' and `tar-anal-blocksize'.
      (signal (car err) (cdr err)))))
 
 
-(defun tar-subfile-mode (p)
+(define-minor-mode tar-subfile-mode
   "Minor mode for editing an element of a tar-file.
 This mode arranges for \"saving\" this buffer to write the data
 into the tar-file buffer that it came from.  The changes will actually
 appear on disk when you save the tar-file's buffer."
-  (interactive "P")
+  ;; Don't do this, because it is redundant and wastes mode line space.
+  ;; :lighter " TarFile"
+  nil nil nil
   (or (and (boundp 'tar-superior-buffer) tar-superior-buffer)
       (error "This buffer is not an element of a tar file"))
-  ;; Don't do this, because it is redundant and wastes mode line space.
-  ;;  (or (assq 'tar-subfile-mode minor-mode-alist)
-  ;;      (setq minor-mode-alist (append minor-mode-alist
-  ;;                                (list '(tar-subfile-mode " TarFile")))))
-  (make-local-variable 'tar-subfile-mode)
-  (setq tar-subfile-mode
-       (if (null p)
-           (not tar-subfile-mode)
-           (> (prefix-numeric-value p) 0)))
   (cond (tar-subfile-mode
         (add-hook 'write-file-functions 'tar-subfile-save-buffer nil t)
         ;; turn off auto-save.
         (auto-save-mode -1)
-        (setq buffer-auto-save-file-name nil)
-        (run-hooks 'tar-subfile-mode-hook))
+        (setq buffer-auto-save-file-name nil))
        (t
         (remove-hook 'write-file-functions 'tar-subfile-save-buffer t))))
 
@@ -852,14 +843,12 @@ appear on disk when you save the tar-file's buffer."
           (set (make-local-variable 'tar-superior-descriptor) descriptor)
           (setq buffer-read-only read-only-p)
           (tar-subfile-mode 1)))
-      (if view-p
-         (view-buffer
-          buffer (and just-created 'kill-buffer-if-not-modified))
-       (if (eq other-window-p 'display)
-           (display-buffer buffer)
-         (if other-window-p
-             (switch-to-buffer-other-window buffer)
-           (switch-to-buffer buffer)))))))
+      (cond
+       (view-p
+       (view-buffer buffer (and just-created 'kill-buffer-if-not-modified)))
+       ((eq other-window-p 'display) (display-buffer buffer))
+       (other-window-p (switch-to-buffer-other-window buffer))
+       (t (switch-to-buffer buffer))))))
 
 
 (defun tar-extract-other-window ()
index 2223ff2587d6c36e68b192b27f4c61d44e22ccba..d5e0d149ae56da242c0e3860f239ad1188fe27df 100644 (file)
@@ -1170,7 +1170,7 @@ Entry to this mode runs the hooks on `term-mode-hook'."
            (let* ((str (car cur)) (len (length str)) (start (- (point) len)))
              (if (and (>= start (point-min))
                       (string= str (buffer-substring start (point))))
-                 (progn (delete-backward-char len)
+                 (progn (delete-char (- len))
                         (setq term-kill-echo-list (cdr cur))
                         (setq term-current-column nil)
                         (setq term-current-row nil)
index ccdd47be47007859f1fa2a12fd23a213ae564a56..25ba41a23c27a1c4c4a1e59e7fb260cbaacc1290 100644 (file)
@@ -204,91 +204,168 @@ This function returns ARGS minus the arguments that have been processed."
 ;; of grey.
 
 (defvar x-colors
-  (purecopy 
-   '("gray100" "gray99" "gray98" "gray97" "gray96" "gray95" "gray94" "gray93" "gray92"
-    "gray91" "gray90" "gray89" "gray88" "gray87" "gray86" "gray85" "gray84" "gray83"
-    "gray82" "gray81" "gray80" "gray79" "gray78" "gray77" "gray76" "gray75" "gray74"
-    "gray73" "gray72" "gray71" "gray70" "gray69" "gray68" "gray67" "gray66" "gray65"
-    "gray64" "gray63" "gray62" "gray61" "gray60" "gray59" "gray58" "gray57" "gray56"
-    "gray55" "gray54" "gray53" "gray52" "gray51" "gray50" "gray49" "gray48" "gray47"
-    "gray46" "gray45" "gray44" "gray43" "gray42" "gray41" "gray40" "gray39" "gray38"
-    "gray37" "gray36" "gray35" "gray34" "gray33" "gray32" "gray31" "gray30" "gray29"
-    "gray28" "gray27" "gray26" "gray25" "gray24" "gray23" "gray22" "gray21" "gray20"
-    "gray19" "gray18" "gray17" "gray16" "gray15" "gray14" "gray13" "gray12" "gray11"
-    "gray10" "gray9" "gray8" "gray7" "gray6" "gray5" "gray4" "gray3" "gray2" "gray1"
-    "gray0" "LightPink1" "LightPink2" "LightPink3" "LightPink4" "pink1" "pink2" "pink3"
-    "pink4" "PaleVioletRed1" "PaleVioletRed2" "PaleVioletRed3" "PaleVioletRed4"
-    "LavenderBlush1" "LavenderBlush2" "LavenderBlush3" "LavenderBlush4" "VioletRed1"
-    "VioletRed2" "VioletRed3" "VioletRed4" "HotPink1" "HotPink2" "HotPink3" "HotPink4"
-    "DeepPink1" "DeepPink2" "DeepPink3" "DeepPink4" "maroon1" "maroon2" "maroon3"
-    "maroon4" "orchid1" "orchid2" "orchid3" "orchid4" "plum1" "plum2" "plum3" "plum4"
-    "thistle1" "thistle2" "thistle3" "thistle4" "MediumOrchid1" "MediumOrchid2"
-    "MediumOrchid3" "MediumOrchid4" "DarkOrchid1" "DarkOrchid2" "DarkOrchid3"
-    "DarkOrchid4" "purple1" "purple2" "purple3" "purple4" "MediumPurple1"
-    "MediumPurple2" "MediumPurple3" "MediumPurple4" "SlateBlue1" "SlateBlue2"
-    "SlateBlue3" "SlateBlue4" "RoyalBlue1" "RoyalBlue2" "RoyalBlue3" "RoyalBlue4"
-    "LightSteelBlue1" "LightSteelBlue2" "LightSteelBlue3" "LightSteelBlue4" "SlateGray1"
-    "SlateGray2" "SlateGray3" "SlateGray4" "DodgerBlue1" "DodgerBlue2" "DodgerBlue3"
-    "DodgerBlue4" "SteelBlue1" "SteelBlue2" "SteelBlue3" "SteelBlue4" "SkyBlue1"
-    "SkyBlue2" "SkyBlue3" "SkyBlue4" "LightSkyBlue1" "LightSkyBlue2" "LightSkyBlue3"
-    "LightSkyBlue4" "LightBlue1" "LightBlue2" "LightBlue3" "LightBlue4" "CadetBlue1"
-    "CadetBlue2" "CadetBlue3" "CadetBlue4" "azure1" "azure2" "azure3" "azure4"
-    "LightCyan1" "LightCyan2" "LightCyan3" "LightCyan4" "PaleTurquoise1"
-    "PaleTurquoise2" "PaleTurquoise3" "PaleTurquoise4" "DarkSlateGray1" "DarkSlateGray2"
-    "DarkSlateGray3" "DarkSlateGray4" "aquamarine1" "aquamarine2" "aquamarine3"
-    "aquamarine4" "SeaGreen1" "SeaGreen2" "SeaGreen3" "SeaGreen4" "honeydew1"
-    "honeydew2" "honeydew3" "honeydew4" "DarkSeaGreen1" "DarkSeaGreen2" "DarkSeaGreen3"
-    "DarkSeaGreen4" "PaleGreen1" "PaleGreen2" "PaleGreen3" "PaleGreen4"
-    "DarkOliveGreen1" "DarkOliveGreen2" "DarkOliveGreen3" "DarkOliveGreen4" "OliveDrab1"
-    "OliveDrab2" "OliveDrab3" "OliveDrab4" "ivory1" "ivory2" "ivory3" "ivory4"
-    "LightYellow1" "LightYellow2" "LightYellow3" "LightYellow4" "khaki1" "khaki2"
-    "khaki3" "khaki4" "LemonChiffon1" "LemonChiffon2" "LemonChiffon3" "LemonChiffon4"
-    "LightGoldenrod1" "LightGoldenrod2" "LightGoldenrod3" "LightGoldenrod4" "cornsilk1"
-    "cornsilk2" "cornsilk3" "cornsilk4" "goldenrod1" "goldenrod2" "goldenrod3"
-    "goldenrod4" "DarkGoldenrod1" "DarkGoldenrod2" "DarkGoldenrod3" "DarkGoldenrod4"
-    "wheat1" "wheat2" "wheat3" "wheat4" "NavajoWhite1" "NavajoWhite2" "NavajoWhite3"
-    "NavajoWhite4" "burlywood1" "burlywood2" "burlywood3" "burlywood4" "AntiqueWhite1"
-    "AntiqueWhite2" "AntiqueWhite3" "AntiqueWhite4" "bisque1" "bisque2" "bisque3"
-    "bisque4" "tan1" "tan2" "tan3" "tan4" "PeachPuff1" "PeachPuff2" "PeachPuff3"
-    "PeachPuff4" "seashell1" "seashell2" "seashell3" "seashell4" "chocolate1"
-    "chocolate2" "chocolate3" "chocolate4" "sienna1" "sienna2" "sienna3" "sienna4"
-    "LightSalmon1" "LightSalmon2" "LightSalmon3" "LightSalmon4" "salmon1" "salmon2"
-    "salmon3" "salmon4" "coral1" "coral2" "coral3" "coral4" "tomato1" "tomato2"
-    "tomato3" "tomato4" "MistyRose1" "MistyRose2" "MistyRose3" "MistyRose4" "snow1"
-    "snow2" "snow3" "snow4" "RosyBrown1" "RosyBrown2" "RosyBrown3" "RosyBrown4"
-    "IndianRed1" "IndianRed2" "IndianRed3" "IndianRed4" "firebrick1" "firebrick2"
-    "firebrick3" "firebrick4" "brown1" "brown2" "brown3" "brown4" "magenta1" "magenta2"
-    "magenta3" "magenta4" "blue1" "blue2" "blue3" "blue4" "DeepSkyBlue1" "DeepSkyBlue2"
-    "DeepSkyBlue3" "DeepSkyBlue4" "turquoise1" "turquoise2" "turquoise3" "turquoise4"
-    "cyan1" "cyan2" "cyan3" "cyan4" "SpringGreen1" "SpringGreen2" "SpringGreen3"
-    "SpringGreen4" "green1" "green2" "green3" "green4" "chartreuse1" "chartreuse2"
-    "chartreuse3" "chartreuse4" "yellow1" "yellow2" "yellow3" "yellow4" "gold1" "gold2"
-    "gold3" "gold4" "orange1" "orange2" "orange3" "orange4" "DarkOrange1" "DarkOrange2"
-    "DarkOrange3" "DarkOrange4" "OrangeRed1" "OrangeRed2" "OrangeRed3" "OrangeRed4"
-    "red1" "red2" "red3" "red4" "lavender blush" "ghost white" "lavender" "alice blue"
-    "azure" "light cyan" "mint cream" "honeydew" "ivory" "light goldenrod yellow"
-    "light yellow" "beige" "floral white" "old lace" "blanched almond" "moccasin"
-    "papaya whip" "bisque" "antique white" "linen" "peach puff" "seashell" "misty rose"
-    "snow" "light pink" "pink" "hot pink" "deep pink" "maroon" "pale violet red"
-    "violet red" "medium violet red" "violet" "plum" "thistle" "orchid" "medium orchid"
-    "dark orchid" "purple" "blue violet" "medium purple" "light slate blue"
-    "medium slate blue" "slate blue" "dark slate blue" "midnight blue" "navy"
-    "dark blue" "light steel blue" "cornflower blue" "dodger blue" "royal blue"
-    "light slate gray" "slate gray" "dark slate gray" "steel blue" "cadet blue"
-    "light sky blue" "sky blue" "light blue" "powder blue" "pale turquoise"
-    "turquoise" "medium turquoise" "dark turquoise"  "dark cyan" "aquamarine"
-    "medium aquamarine" "light sea green"
-    "medium sea green" "sea green" "dark sea green" "pale green" "lime green"
-    "dark green" "forest green" "light green" "green yellow" "yellow green" "olive drab"
-    "dark olive green" "lemon chiffon" "khaki" "dark khaki" "cornsilk"
-    "pale goldenrod" "light goldenrod" "goldenrod" "dark goldenrod" "wheat"
-    "navajo white" "tan" "burlywood" "sandy brown" "peru" "chocolate" "saddle brown"
-    "sienna" "rosy brown" "dark salmon" "coral" "tomato" "light salmon" "salmon"
-    "light coral" "indian red" "firebrick" "brown" "dark red" "magenta"
-    "dark magenta" "dark violet" "medium blue" "blue" "deep sky blue"
-    "cyan" "medium spring green" "spring green" "green" "lawn green" "chartreuse"
-    "yellow" "gold" "orange" "dark orange" "orange red" "red" "white" "white smoke"
-    "gainsboro" "light gray" "gray" "dark gray" "dim gray" "black" ))
+  (purecopy
+   '("gray100" "grey100" "gray99" "grey99" "gray98" "grey98" "gray97"
+     "grey97" "gray96" "grey96" "gray95" "grey95" "gray94" "grey94"
+     "gray93" "grey93" "gray92" "grey92" "gray91" "grey91" "gray90"
+     "grey90" "gray89" "grey89" "gray88" "grey88" "gray87" "grey87"
+     "gray86" "grey86" "gray85" "grey85" "gray84" "grey84" "gray83"
+     "grey83" "gray82" "grey82" "gray81" "grey81" "gray80" "grey80"
+     "gray79" "grey79" "gray78" "grey78" "gray77" "grey77" "gray76"
+     "grey76" "gray75" "grey75" "gray74" "grey74" "gray73" "grey73"
+     "gray72" "grey72" "gray71" "grey71" "gray70" "grey70" "gray69"
+     "grey69" "gray68" "grey68" "gray67" "grey67" "gray66" "grey66"
+     "gray65" "grey65" "gray64" "grey64" "gray63" "grey63" "gray62"
+     "grey62" "gray61" "grey61" "gray60" "grey60" "gray59" "grey59"
+     "gray58" "grey58" "gray57" "grey57" "gray56" "grey56" "gray55"
+     "grey55" "gray54" "grey54" "gray53" "grey53" "gray52" "grey52"
+     "gray51" "grey51" "gray50" "grey50" "gray49" "grey49" "gray48"
+     "grey48" "gray47" "grey47" "gray46" "grey46" "gray45" "grey45"
+     "gray44" "grey44" "gray43" "grey43" "gray42" "grey42" "gray41"
+     "grey41" "gray40" "grey40" "gray39" "grey39" "gray38" "grey38"
+     "gray37" "grey37" "gray36" "grey36" "gray35" "grey35" "gray34"
+     "grey34" "gray33" "grey33" "gray32" "grey32" "gray31" "grey31"
+     "gray30" "grey30" "gray29" "grey29" "gray28" "grey28" "gray27"
+     "grey27" "gray26" "grey26" "gray25" "grey25" "gray24" "grey24"
+     "gray23" "grey23" "gray22" "grey22" "gray21" "grey21" "gray20"
+     "grey20" "gray19" "grey19" "gray18" "grey18" "gray17" "grey17"
+     "gray16" "grey16" "gray15" "grey15" "gray14" "grey14" "gray13"
+     "grey13" "gray12" "grey12" "gray11" "grey11" "gray10" "grey10"
+     "gray9" "grey9" "gray8" "grey8" "gray7" "grey7" "gray6" "grey6"
+     "gray5" "grey5" "gray4" "grey4" "gray3" "grey3" "gray2" "grey2"
+     "gray1" "grey1" "gray0" "grey0"
+     "LightPink1" "LightPink2" "LightPink3" "LightPink4"
+     "pink1" "pink2" "pink3" "pink4"
+     "PaleVioletRed1" "PaleVioletRed2" "PaleVioletRed3" "PaleVioletRed4"
+     "LavenderBlush1" "LavenderBlush2" "LavenderBlush3" "LavenderBlush4"
+     "VioletRed1" "VioletRed2" "VioletRed3" "VioletRed4"
+     "HotPink1" "HotPink2" "HotPink3" "HotPink4"
+     "DeepPink1" "DeepPink2" "DeepPink3" "DeepPink4"
+     "maroon1" "maroon2" "maroon3" "maroon4"
+     "orchid1" "orchid2" "orchid3" "orchid4"
+     "plum1" "plum2" "plum3" "plum4"
+     "thistle1" "thistle2" "thistle3" "thistle4"
+     "MediumOrchid1" "MediumOrchid2" "MediumOrchid3" "MediumOrchid4"
+     "DarkOrchid1" "DarkOrchid2" "DarkOrchid3" "DarkOrchid4"
+     "purple1" "purple2" "purple3" "purple4"
+     "MediumPurple1" "MediumPurple2" "MediumPurple3" "MediumPurple4"
+     "SlateBlue1" "SlateBlue2" "SlateBlue3" "SlateBlue4"
+     "RoyalBlue1" "RoyalBlue2" "RoyalBlue3" "RoyalBlue4"
+     "LightSteelBlue1" "LightSteelBlue2" "LightSteelBlue3" "LightSteelBlue4"
+     "SlateGray1" "SlateGray2" "SlateGray3" "SlateGray4"
+     "DodgerBlue1" "DodgerBlue2" "DodgerBlue3" "DodgerBlue4"
+     "SteelBlue1" "SteelBlue2" "SteelBlue3" "SteelBlue4"
+     "SkyBlue1" "SkyBlue2" "SkyBlue3" "SkyBlue4"
+     "LightSkyBlue1" "LightSkyBlue2" "LightSkyBlue3" "LightSkyBlue4"
+     "LightBlue1" "LightBlue2" "LightBlue3" "LightBlue4"
+     "CadetBlue1" "CadetBlue2" "CadetBlue3" "CadetBlue4"
+     "azure1" "azure2" "azure3" "azure4"
+     "LightCyan1" "LightCyan2" "LightCyan3" "LightCyan4"
+     "PaleTurquoise1" "PaleTurquoise2" "PaleTurquoise3" "PaleTurquoise4"
+     "DarkSlateGray1" "DarkSlateGray2" "DarkSlateGray3" "DarkSlateGray4"
+     "aquamarine1" "aquamarine2" "aquamarine3" "aquamarine4"
+     "SeaGreen1" "SeaGreen2" "SeaGreen3" "SeaGreen4"
+     "honeydew1" "honeydew2" "honeydew3" "honeydew4"
+     "DarkSeaGreen1" "DarkSeaGreen2" "DarkSeaGreen3" "DarkSeaGreen4"
+     "PaleGreen1" "PaleGreen2" "PaleGreen3" "PaleGreen4"
+     "DarkOliveGreen1" "DarkOliveGreen2" "DarkOliveGreen3" "DarkOliveGreen4"
+     "OliveDrab1" "OliveDrab2" "OliveDrab3" "OliveDrab4"
+     "ivory1" "ivory2" "ivory3" "ivory4"
+     "LightYellow1" "LightYellow2" "LightYellow3" "LightYellow4"
+     "khaki1" "khaki2" "khaki3" "khaki4"
+     "LemonChiffon1" "LemonChiffon2" "LemonChiffon3" "LemonChiffon4"
+     "LightGoldenrod1" "LightGoldenrod2" "LightGoldenrod3" "LightGoldenrod4"
+     "cornsilk1" "cornsilk2" "cornsilk3" "cornsilk4"
+     "goldenrod1" "goldenrod2" "goldenrod3" "goldenrod4"
+     "DarkGoldenrod1" "DarkGoldenrod2" "DarkGoldenrod3" "DarkGoldenrod4"
+     "wheat1" "wheat2" "wheat3" "wheat4"
+     "NavajoWhite1" "NavajoWhite2" "NavajoWhite3" "NavajoWhite4"
+     "burlywood1" "burlywood2" "burlywood3" "burlywood4"
+     "AntiqueWhite1" "AntiqueWhite2" "AntiqueWhite3" "AntiqueWhite4"
+     "bisque1" "bisque2" "bisque3" "bisque4"
+     "tan1" "tan2" "tan3" "tan4"
+     "PeachPuff1" "PeachPuff2" "PeachPuff3" "PeachPuff4"
+     "seashell1" "seashell2" "seashell3" "seashell4"
+     "chocolate1" "chocolate2" "chocolate3" "chocolate4"
+     "sienna1" "sienna2" "sienna3" "sienna4"
+     "LightSalmon1" "LightSalmon2" "LightSalmon3" "LightSalmon4"
+     "salmon1" "salmon2" "salmon3" "salmon4"
+     "coral1" "coral2" "coral3" "coral4"
+     "tomato1" "tomato2" "tomato3" "tomato4"
+     "MistyRose1" "MistyRose2" "MistyRose3" "MistyRose4"
+     "snow1" "snow2" "snow3" "snow4"
+     "RosyBrown1" "RosyBrown2" "RosyBrown3" "RosyBrown4"
+     "IndianRed1" "IndianRed2" "IndianRed3" "IndianRed4"
+     "firebrick1" "firebrick2" "firebrick3" "firebrick4"
+     "brown1" "brown2" "brown3" "brown4"
+     "magenta1" "magenta2" "magenta3" "magenta4"
+     "blue1" "blue2" "blue3" "blue4"
+     "DeepSkyBlue1" "DeepSkyBlue2" "DeepSkyBlue3" "DeepSkyBlue4"
+     "turquoise1" "turquoise2" "turquoise3" "turquoise4"
+     "cyan1" "cyan2" "cyan3" "cyan4"
+     "SpringGreen1" "SpringGreen2" "SpringGreen3" "SpringGreen4"
+     "green1" "green2" "green3" "green4"
+     "chartreuse1" "chartreuse2" "chartreuse3" "chartreuse4"
+     "yellow1" "yellow2" "yellow3" "yellow4"
+     "gold1" "gold2" "gold3" "gold4"
+     "orange1" "orange2" "orange3" "orange4"
+     "DarkOrange1" "DarkOrange2" "DarkOrange3" "DarkOrange4"
+     "OrangeRed1" "OrangeRed2" "OrangeRed3" "OrangeRed4"
+     "red1" "red2" "red3" "red4"
+     "lavender blush" "LavenderBlush" "ghost white" "GhostWhite"
+     "lavender" "alice blue" "AliceBlue" "azure" "light cyan"
+     "LightCyan" "mint cream" "MintCream" "honeydew" "ivory"
+     "light goldenrod yellow" "LightGoldenrodYellow" "light yellow"
+     "LightYellow" "beige" "floral white" "FloralWhite" "old lace"
+     "OldLace" "blanched almond" "BlanchedAlmond" "moccasin"
+     "papaya whip" "PapayaWhip" "bisque" "antique white"
+     "AntiqueWhite" "linen" "peach puff" "PeachPuff" "seashell"
+     "misty rose" "MistyRose" "snow" "light pink" "LightPink" "pink"
+     "hot pink" "HotPink" "deep pink" "DeepPink" "maroon"
+     "pale violet red" "PaleVioletRed" "violet red" "VioletRed"
+     "medium violet red" "MediumVioletRed" "violet" "plum" "thistle"
+     "orchid" "medium orchid" "MediumOrchid" "dark orchid"
+     "DarkOrchid" "purple" "blue violet" "BlueViolet" "medium purple"
+     "MediumPurple" "light slate blue" "LightSlateBlue"
+     "medium slate blue" "MediumSlateBlue" "slate blue" "SlateBlue"
+     "dark slate blue" "DarkSlateBlue" "midnight blue" "MidnightBlue"
+     "navy" "navy blue" "NavyBlue" "dark blue" "DarkBlue"
+     "light steel blue" "LightSteelBlue" "cornflower blue"
+     "CornflowerBlue" "dodger blue" "DodgerBlue" "royal blue"
+     "RoyalBlue" "light slate gray" "light slate grey"
+     "LightSlateGray" "LightSlateGrey" "slate gray" "slate grey"
+     "SlateGray" "SlateGrey" "dark slate gray" "dark slate grey"
+     "DarkSlateGray" "DarkSlateGrey" "steel blue" "SteelBlue"
+     "cadet blue" "CadetBlue" "light sky blue" "LightSkyBlue"
+     "sky blue" "SkyBlue" "light blue" "LightBlue" "powder blue"
+     "PowderBlue" "pale turquoise" "PaleTurquoise" "turquoise"
+     "medium turquoise" "MediumTurquoise" "dark turquoise"
+     "DarkTurquoise"  "dark cyan" "DarkCyan" "aquamarine"
+     "medium aquamarine" "MediumAquamarine" "light sea green"
+     "LightSeaGreen" "medium sea green" "MediumSeaGreen" "sea green"
+     "SeaGreen" "dark sea green" "DarkSeaGreen" "pale green"
+     "PaleGreen" "lime green" "LimeGreen" "dark green" "DarkGreen"
+     "forest green" "ForestGreen" "light green" "LightGreen"
+     "green yellow" "GreenYellow" "yellow green" "YellowGreen"
+     "olive drab" "OliveDrab" "dark olive green" "DarkOliveGreen"
+     "lemon chiffon" "LemonChiffon" "khaki" "dark khaki" "DarkKhaki"
+     "cornsilk" "pale goldenrod" "PaleGoldenrod" "light goldenrod"
+     "LightGoldenrod" "goldenrod" "dark goldenrod" "DarkGoldenrod"
+     "wheat" "navajo white" "NavajoWhite" "tan" "burlywood"
+     "sandy brown" "SandyBrown" "peru" "chocolate" "saddle brown"
+     "SaddleBrown" "sienna" "rosy brown" "RosyBrown" "dark salmon"
+     "DarkSalmon" "coral" "tomato" "light salmon" "LightSalmon"
+     "salmon" "light coral" "LightCoral" "indian red" "IndianRed"
+     "firebrick" "brown" "dark red" "DarkRed" "magenta"
+     "dark magenta" "DarkMagenta" "dark violet" "DarkViolet"
+     "medium blue" "MediumBlue" "blue" "deep sky blue" "DeepSkyBlue"
+     "cyan" "medium spring green" "MediumSpringGreen" "spring green"
+     "SpringGreen" "green" "lawn green" "LawnGreen" "chartreuse"
+     "yellow" "gold" "orange" "dark orange" "DarkOrange" "orange red"
+     "OrangeRed" "red" "white" "white smoke" "WhiteSmoke" "gainsboro"
+     "light gray" "light grey" "LightGray" "LightGrey" "gray" "grey"
+     "dark gray" "dark grey" "DarkGray" "DarkGrey" "dim gray"
+     "dim grey" "DimGray" "DimGrey" "black"))
   "List of basic colors available on color displays.
 For X, the list comes from the `rgb.txt' file,v 10.41 94/02/20.
 For Nextstep, this is a list of non-PANTONE colors returned by
index a53d0346d94359f75bdfdac3884989797a0b7971..d42632c3f231c96b47e8042ccba97b376b56499d 100644 (file)
@@ -186,14 +186,11 @@ The properties returned may include `top', `left', `height', and `width'."
 
 ;;;; Keyboard mapping.
 
-;; These tell read-char how to convert these special chars to ASCII.
-(put 'S-tab 'ascii-character (logior 16 ?\t))
-
 (defvar ns-alternatives-map
   (let ((map (make-sparse-keymap)))
     ;; Map certain keypad keys into ASCII characters
     ;; that people usually expect.
-    (define-key map [S-tab] [25])
+    (define-key map [S-tab] [backtab])
     (define-key map [M-backspace] [?\M-\d])
     (define-key map [M-delete] [?\M-\d])
     (define-key map [M-tab] [?\M-\t])
@@ -208,6 +205,7 @@ The properties returned may include `top', `left', `height', and `width'."
 (define-key global-map [?\s-,] 'customize)
 (define-key global-map [?\s-'] 'next-multiframe-window)
 (define-key global-map [?\s-`] 'other-frame)
+(define-key global-map [?\s-~] 'ns-prev-frame)
 (define-key global-map [?\s--] 'center-line)
 (define-key global-map [?\s-:] 'ispell)
 (define-key global-map [?\s-\;] 'ispell-next)
@@ -1005,7 +1003,7 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.")
 
 (defun ns-get-pasteboard ()
   "Returns the value of the pasteboard."
-  (ns-get-cut-buffer-internal 'PRIMARY))
+  (ns-get-cut-buffer-internal 'CLIPBOARD))
 
 (declare-function ns-store-cut-buffer-internal "nsselect.m" (buffer string))
 
@@ -1013,7 +1011,7 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.")
   "Store STRING into the pasteboard of the Nextstep display server."
   ;; Check the data type of STRING.
   (if (not (stringp string)) (error "Nonstring given to pasteboard"))
-  (ns-store-cut-buffer-internal 'PRIMARY string))
+  (ns-store-cut-buffer-internal 'CLIPBOARD string))
 
 ;; We keep track of the last text selected here, so we can check the
 ;; current selection against it, and avoid passing back our own text
index 389adcde6c438e3446279fe2a4e43306f35c2c2a..4476165febc72cd18400a336c455e182aa96e19c 100644 (file)
@@ -28,6 +28,8 @@
 
 ;;; Code:
 
+(eval-when-compile (require 'cl))
+
 (defvar tvi970-terminal-map
   (let ((map (make-sparse-keymap)))
 
 
 \f
 ;; Should keypad numbers send ordinary digits or distinct escape sequences?
-(defun tvi970-set-keypad-mode (&optional arg)
+(define-minor-mode tvi970-set-keypad-mode
   "Set the current mode of the TVI 970 numeric keypad.
 In ``numeric keypad mode'', the number keys on the keypad act as
 ordinary digits.  In ``alternate keypad mode'', the keys send distinct
@@ -111,12 +113,9 @@ independent of the normal number keys.
 With no argument, toggle between the two possible modes.
 With a positive argument, select alternate keypad mode.
 With a negative argument, select numeric keypad mode."
-  (interactive "P")
-  (let ((newval (if (null arg)
-                    (not (terminal-parameter nil 'tvi970-keypad-numeric))
-                  (> (prefix-numeric-value arg) 0))))
-    (set-terminal-parameter nil 'tvi970-keypad-numeric newval)
-    (send-string-to-terminal (if newval "\e=" "\e>"))))
+  :variable (terminal-parameter nil 'tvi970-keypad-numeric)
+  (send-string-to-terminal
+   (if (terminal-parameter nil 'tvi970-keypad-numeric) "\e=" "\e>")))
 
 ;; arch-tag: c1334cf0-1462-41c3-a963-c077d175f8f0
 ;;; tvi970.el ends here
index d0560702ac06ff37142a0f8324012089a4438b09..24561fe835fabe8ad83d933af0df8f06d7a0abb3 100644 (file)
   (tty-run-terminal-initialization (selected-frame) "lk201"))
 
 ;;; Controlling the screen width.
-(defvar vt100-wide-mode (= (frame-width) 132)
-  "t if vt100 is in 132-column mode.")
-
-(defun vt100-wide-mode (&optional arg)
+(define-minor-mode vt100-wide-mode
   "Toggle 132/80 column mode for vt100s.
 With positive argument, switch to 132-column mode.
 With negative argument, switch to 80-column mode."
- (interactive "P")
- (setq vt100-wide-mode
-       (if (null arg) (not vt100-wide-mode)
-         (> (prefix-numeric-value arg) 0)))
- (send-string-to-terminal (if vt100-wide-mode "\e[?3h" "\e[?3l"))
- (set-frame-width terminal-frame (if vt100-wide-mode 132 80)))
+  :global t :init-value (= (frame-width) 132)
+  (send-string-to-terminal (if vt100-wide-mode "\e[?3h" "\e[?3l"))
+  (set-frame-width terminal-frame (if vt100-wide-mode 132 80)))
 
 ;; arch-tag: 9ff41f24-a7c9-4dee-9cf2-fbaa951eb840
 ;;; vt100.el ends here
index 3208ece9c0967631eef7d5ee6d04240eeefbd3b9..65ba534de42622417a7ad8b0b2b2201dfa8d4206 100644 (file)
@@ -1219,35 +1219,27 @@ This is the actual text stored in the X cut buffer.")
   "Max number of characters to put in the cut buffer.
 It is said that overlarge strings are slow to put into the cut buffer.")
 
-(defcustom x-select-enable-clipboard nil
+(defcustom x-select-enable-clipboard t
   "Non-nil means cutting and pasting uses the clipboard.
-This is in addition to, but in preference to, the primary selection.
-
-On MS-Windows, this is non-nil by default, since Windows does not
-support other types of selections.  \(The primary selection that is
-set by Emacs is not accessible to other programs on Windows.\)"
+This is in addition to, but in preference to, the primary selection."
   :type 'boolean
-  :group 'killing)
+  :group 'killing
+  :version "24.1")
 
-(defcustom x-select-enable-primary t
+(defcustom x-select-enable-primary nil
   "Non-nil means cutting and pasting uses the primary selection."
   :type 'boolean
-  :group 'killing)
+  :group 'killing
+  :version "24.1")
 
 (defun x-select-text (text &optional push)
   "Select TEXT, a string, according to the window system.
-
-On X, put TEXT in the primary X selection.  For backward
-compatibility with older X applications, set the value of X cut
-buffer 0 as well, and if the optional argument PUSH is non-nil,
-rotate the cut buffers.  If `x-select-enable-clipboard' is
-non-nil, copy the text to the X clipboard as well.
-
-On Windows, make TEXT the current selection.  If
-`x-select-enable-clipboard' is non-nil, copy the text to the
-clipboard as well.  The argument PUSH is ignored.
-
-On Nextstep, put TEXT in the pasteboard; PUSH is ignored."
+If `x-select-enable-clipboard' is non-nil, copy TEXT to the
+clipboard.  If `x-select-enable-primary' is non-nil, put TEXT in
+the primary selection.  For backward compatibility with older X
+applications, this function also sets the value of X cut buffer
+0, and, if the optional argument PUSH is non-nil, rotates the cut
+buffers."
   ;; With multi-tty, this function may be called from a tty frame.
   (when (eq (framep (selected-frame)) 'x)
     ;; Don't send the cut buffer too much text.
@@ -1560,12 +1552,12 @@ The value nil is the same as this list:
   ;; Enable CLIPBOARD copy/paste through menu bar commands.
   (menu-bar-enable-clipboard)
 
-  ;; Override Paste so it looks at CLIPBOARD first.
-  (define-key menu-bar-edit-menu [paste]
-    (append '(menu-item "Paste" x-clipboard-yank
-                       :enable (not buffer-read-only)
-                       :help "Paste (yank) text most recently cut/copied")
-           nil))
+  ;; ;; Override Paste so it looks at CLIPBOARD first.
+  ;; (define-key menu-bar-edit-menu [paste]
+  ;;   (append '(menu-item "Paste" x-clipboard-yank
+  ;;                   :enable (not buffer-read-only)
+  ;;                   :help "Paste (yank) text most recently cut/copied")
+  ;;       nil))
 
   (setq x-initialized t))
 
index ac7a2e48a1596c6203ac074936156d6f35079b2a..e17cd9e5b2828d81060ecc625d5639a806610b90 100644 (file)
@@ -2094,7 +2094,7 @@ Formats current entry according to variable `bibtex-entry-format'."
                                 ;; if match not at left subfield boundary...
                                 (if (< (1+ (nth 1 bounds)) (match-beginning 0))
                                     (insert (bibtex-field-right-delimiter) " # ")
-                                  (delete-backward-char 1))))))))
+                                  (delete-char -1))))))))
 
                     ;; use book title of crossref'd entry
                     (if (and (memq 'inherit-booktitle format)
index 6e80b737284834d530a2fdf45f79962593d59963..bfa98e9c36f00a273ad3b294244219e713d49402 100644 (file)
 (defconst css-nmchar-re (concat "\\(?:[-[:alnum:]]\\|" css-escapes-re "\\)"))
 (defconst css-nmstart-re (concat "\\(?:[[:alpha:]]\\|" css-escapes-re "\\)"))
 (defconst css-ident-re (concat css-nmstart-re css-nmchar-re "*"))
+(defconst css-proprietary-nmstart-re ;; Vendor-specific properties.
+  "[-_]\\(?:ms\\|moz\\|o\\|webkit\\|khtml\\)-")
 (defconst css-name-re (concat css-nmchar-re "+"))
 
 (defface css-selector '((t :inherit font-lock-function-name-face))
 (defface css-property '((t :inherit font-lock-variable-name-face))
   "Face to use for properties."
   :group 'css)
+(defface css-proprietary-property '((t :inherit (css-property italic)))
+  "Face to use for vendor-specific properties.")
 
 (defvar css-font-lock-keywords
   `(("!\\s-*important" . font-lock-builtin-face)
                      ;; No face.
                      nil)))
     ;; Properties.  Again, we don't limit ourselves to css-property-ids.
-    (,(concat "\\(?:[{;]\\|^\\)[ \t]*\\(" css-ident-re "\\)\\s-*:")
-     (1 'css-property))))
+    (,(concat "\\(?:[{;]\\|^\\)[ \t]*\\("
+              "\\(?:\\(" css-proprietary-nmstart-re "\\)\\|"
+              css-nmstart-re "\\)" css-nmchar-re "*"
+              "\\)\\s-*:")
+     (1 (if (match-end 2) 'css-proprietary-property 'css-property)))))
 
 (defvar css-font-lock-defaults
   '(css-font-lock-keywords nil t))
index bb9fedad206a06e236637ef2053f37cc4fb3605a..fa011687c1cc072d6b3f71ab9566ab4ed624c13d 100644 (file)
@@ -151,6 +151,7 @@ Turning on DNS mode runs `dns-mode-hook'."
   (easy-menu-add dns-mode-menu dns-mode-map))
 
 ;;;###autoload (defalias 'zone-mode 'dns-mode)
+;;;###autoload (add-to-list 'auto-mode-alist (purecopy '("\\.zone\\'" . zone-mode)))
 
 ;; Tools.
 
index da6e02bfa2f3468e7761d053324046dcb05ac07e..be3fd5a1789b8ad0becda79771cc878ba6c6cc5b 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Maintainer: FSF
 ;; Keywords: wp
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
@@ -657,7 +658,7 @@ space does not end a sentence, so don't break a line there."
       (if (and oneleft
               (not (and use-hard-newlines
                         (get-text-property (1- (point)) 'hard))))
-         (delete-backward-char 1)
+         (delete-char -1)
        (backward-char 1)
        (setq oneleft t)))
     (setq to (copy-marker (point) t))
@@ -1289,18 +1290,16 @@ otherwise it is made canonical."
                     (skip-chars-backward " "))
                   (setq ncols (- fc endcol))
                   ;; Ncols is number of additional space chars needed
-                  (if (and (> ncols 0) (> nspaces 0) (not eop))
-                      (progn
-                        (setq curr-fracspace (+ ncols (/ (1+ nspaces) 2))
-                              count nspaces)
-                        (while (> count 0)
-                          (skip-chars-forward " ")
-                          (insert-and-inherit
-                           (make-string (/ curr-fracspace nspaces) ?\s))
-                          (search-forward " " nil t)
-                          (setq count (1- count)
-                                curr-fracspace
-                                  (+ (% curr-fracspace nspaces) ncols)))))))
+                  (when (and (> ncols 0) (> nspaces 0) (not eop))
+                     (setq curr-fracspace (+ ncols (/ nspaces 2))
+                           count nspaces)
+                     (while (> count 0)
+                       (skip-chars-forward " ")
+                       (insert-char ?\s (/ curr-fracspace nspaces) t)
+                       (search-forward " " nil t)
+                       (setq count (1- count)
+                             curr-fracspace
+                             (+ (% curr-fracspace nspaces) ncols))))))
                (t (error "Unknown justification value"))))
        (goto-char pos)
        (move-marker pos nil)))
index e5727f41e93bb09ce688d07d5a22e0ffdc1facd6..8a73a0f818ea5cad592e3608a03ad02224ada3c5 100644 (file)
@@ -199,9 +199,9 @@ Ispell's ultimate default dictionary."
 
 (defcustom flyspell-check-tex-math-command nil
   "Non-nil means check even inside TeX math environment.
-TeX math environments are discovered by the TEXMATHP that implemented
-inside the texmathp.el Emacs package.  That package may be found at:
-http://strw.leidenuniv.nl/~dominik/Tools"
+TeX math environments are discovered by `texmathp', implemented
+inside AUCTeX package.  That package may be found at
+URL `http://www.gnu.org/software/auctex/'"
   :group 'flyspell
   :type 'boolean)
 
@@ -1817,7 +1817,9 @@ misspelled words backwards."
                        (throw 'exit t)))))))
        (save-excursion
          (goto-char pos)
-         (ispell-word))
+         (ispell-word)
+         (setq flyspell-word-cache-word nil) ;; Force flyspell-word re-check
+         (flyspell-word))
       (error "No word to correct before point"))))
 
 ;;*---------------------------------------------------------------------*/
index 81b87cd5641df870ce7507df8299f9770a075051..ad591eb0e7f619d29c22227ac9a9cc13a2c41735 100644 (file)
@@ -357,21 +357,21 @@ Must be greater than 1."
   :group 'ispell)
 
 (defcustom ispell-alternate-dictionary
-  (cond ((file-exists-p "/usr/dict/web2") "/usr/dict/web2")
-       ((file-exists-p "/usr/share/dict/web2") "/usr/share/dict/web2")
-       ((file-exists-p "/usr/dict/words") "/usr/dict/words")
-       ((file-exists-p "/usr/lib/dict/words") "/usr/lib/dict/words")
-       ((file-exists-p "/usr/share/dict/words") "/usr/share/dict/words")
-       ((file-exists-p "/usr/share/lib/dict/words")
+  (cond ((file-readable-p "/usr/dict/web2") "/usr/dict/web2")
+       ((file-readable-p "/usr/share/dict/web2") "/usr/share/dict/web2")
+       ((file-readable-p "/usr/dict/words") "/usr/dict/words")
+       ((file-readable-p "/usr/lib/dict/words") "/usr/lib/dict/words")
+       ((file-readable-p "/usr/share/dict/words") "/usr/share/dict/words")
+       ((file-readable-p "/usr/share/lib/dict/words")
         "/usr/share/lib/dict/words")
-       ((file-exists-p "/sys/dict") "/sys/dict")
-       (t "/usr/dict/words"))
-  "*Alternate dictionary for spelling help."
+       ((file-readable-p "/sys/dict") "/sys/dict"))
+  "*Alternate plain word-list dictionary for spelling help."
   :type '(choice file (const :tag "None" nil))
   :group 'ispell)
 
-(defcustom ispell-complete-word-dict ispell-alternate-dictionary
-  "*Dictionary used for word completion."
+(defcustom ispell-complete-word-dict nil
+  "*Plain word-list dictionary used for word completion if
+different from `ispell-alternate-dictionary'."
   :type '(choice file (const :tag "None" nil))
   :group 'ispell)
 
@@ -660,8 +660,8 @@ re-start Emacs."
      "[^A-Za-z\241\243\246\254\257\261\263\266\274\277\306\312\321\323\346\352\361\363]"
      "[.]" nil nil nil iso-8859-2)
     ("portugues"                        ; Portuguese mode
-     "[a-zA-Z\301\302\311\323\340\341\342\351\352\355\363\343\372]"
-     "[^a-zA-Z\301\302\311\323\340\341\342\351\352\355\363\343\372]"
+     "[a-zA-Z\301\302\307\311\323\340\341\342\351\352\355\363\343\347\372]"
+     "[^a-zA-Z\301\302\307\311\323\340\341\342\351\352\355\363\343\347\372]"
      "[']" t ("-C") "~latin1" iso-8859-1)
     ("russian"                         ; Russian.aff (KOI8-R charset)
      "[\341\342\367\347\344\345\263\366\372\351\352\353\354\355\356\357\360\362\363\364\365\346\350\343\376\373\375\370\371\377\374\340\361\301\302\327\307\304\305\243\326\332\311\312\313\314\315\316\317\320\322\323\324\325\306\310\303\336\333\335\330\331\337\334\300\321]"
@@ -982,8 +982,8 @@ Assumes that value contains no whitespace."
   ;; This returns nil if the data file does not exist.
   ;; Can someone please explain the return value format when the
   ;; file does exist -- rms?
-  (let* ((lang ;; Strip out region, variant, etc.
-         (and (string-match "^[[:alpha:]]+" dict-name)
+  (let* ((lang ;; Strip out variant, etc.
+         (and (string-match "^[[:alpha:]_]+" dict-name)
               (match-string 0 dict-name)))
         (data-file
          (concat (or ispell-aspell-data-dir
@@ -1334,6 +1334,9 @@ Protects against bogus binding of `enable-multibyte-characters' in XEmacs."
 (defvar ispell-process-directory nil
   "The directory where `ispell-process' was started.")
 
+(defvar ispell-process-buffer-name nil
+  "The buffer where `ispell-process' was started.")
+
 (defvar ispell-filter nil
   "Output filter from piped calls to Ispell.")
 
@@ -2046,10 +2049,11 @@ Global `ispell-quit' set to start location to continue spell session."
                              (erase-buffer)
                              (setq count ?0
                                    skipped 0
-                                   mode-line-format
+                                   mode-line-format ;; setup the *Choices* buffer with valid data.
                                    (concat "--  %b  --  word: " new-word
-                                           "  --  dict: "
-                                           ispell-alternate-dictionary)
+                                           "  --  word-list: "
+                                           (or ispell-complete-word-dict
+                                               ispell-alternate-dictionary))
                                    miss (lookup-words new-word)
                                    choices miss
                                    line ispell-choices-win-default-height)
@@ -2264,11 +2268,20 @@ Otherwise the variable `ispell-grep-command' contains the command used to
 search for the words (usually egrep).
 
 Optional second argument contains the dictionary to use; the default is
-`ispell-alternate-dictionary'."
+`ispell-alternate-dictionary', overriden by `ispell-complete-word-dict'
+if defined."
   ;; We don't use the filter for this function, rather the result is written
   ;; into a buffer.  Hence there is no need to save the filter values.
   (if (null lookup-dict)
-      (setq lookup-dict ispell-alternate-dictionary))
+      (setq lookup-dict (or ispell-complete-word-dict
+                           ispell-alternate-dictionary)))
+
+  (if lookup-dict
+      (unless (file-readable-p lookup-dict)
+       (error "lookup-words error: Unreadable or missing plain word-list %s."
+              lookup-dict))
+    (error (concat "lookup-words error: No plain word-list found at system default "
+                  "locations.  Customize `ispell-alternate-dictionary' to set yours.")))
 
   (let* ((process-connection-type ispell-use-ptys-p)
         (wild-p (string-match "\\*" word))
@@ -2614,10 +2627,12 @@ Keeps argument list for future ispell invocations for no async support."
   "Check status of Ispell process and start if necessary."
   (if (and ispell-process
           (eq (ispell-process-status) 'run)
-          ;; If we're using a personal dictionary, ensure
-          ;; we're in the same default directory!
-          (or (not ispell-personal-dictionary)
-              (equal ispell-process-directory default-directory)))
+          ;; Unless we are using an explicit personal dictionary,
+          ;; ensure we're in the same default directory!
+          ;; Restart check for personal dictionary is done in
+          ;; `ispell-internal-change-dictionary', called from `ispell-buffer-local-dict'
+          (or (or ispell-local-pdict ispell-personal-dictionary)
+              (equal ispell-process-directory (expand-file-name default-directory))))
       (setq ispell-filter nil ispell-filter-continue nil)
     ;; may need to restart to select new personal dictionary.
     (ispell-kill-ispell t)
@@ -2625,10 +2640,22 @@ Keeps argument list for future ispell invocations for no async support."
             (or ispell-local-dictionary ispell-dictionary "default"))
     (sit-for 0)
     (setq ispell-library-directory (ispell-check-version)
-         ispell-process-directory default-directory
          ispell-process (ispell-start-process)
          ispell-filter nil
          ispell-filter-continue nil)
+    ;; When spellchecking minibuffer contents, make sure ispell process
+    ;; is not restarted every time the minibuffer is killed.
+    (if (window-minibuffer-p)
+       (if (fboundp 'minibuffer-selected-window)
+           ;; Assign ispell process to parent buffer
+           (setq ispell-process-directory (expand-file-name default-directory)
+                 ispell-process-buffer-name (window-buffer (minibuffer-selected-window)))
+         ;; Force `ispell-process-directory' to $HOME and use a dummy name
+         (setq ispell-process-directory (expand-file-name "~/")
+               ispell-process-buffer-name " * Minibuffer-has-spellcheck-enabled"))
+      ;; Not in a minibuffer
+      (setq ispell-process-directory (expand-file-name default-directory)
+           ispell-process-buffer-name (buffer-name)))
     (if ispell-async-processp
        (set-process-filter ispell-process 'ispell-filter))
     ;; protect against bogus binding of `enable-multibyte-characters' in XEmacs
@@ -2689,10 +2716,16 @@ With NO-ERROR, just return non-nil if there was no Ispell running."
       (kill-buffer ispell-session-buffer)
       (setq ispell-output-buffer nil
            ispell-session-buffer nil))
+    (setq ispell-process-buffer-name nil)
     (setq ispell-process nil)
     (message "Ispell process killed")
     nil))
 
+;; Kill ispell process when killing its associated buffer
+(add-hook 'kill-buffer-hook
+         '(lambda ()
+            (if (equal ispell-process-buffer-name (buffer-name))
+                (ispell-kill-ispell t))))
 
 ;;; 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?
@@ -3319,7 +3352,8 @@ Standard ispell choices are then available."
              (lookup-words (concat (and interior-frag "*") word
                                    (if (or interior-frag (null ispell-look-p))
                                        "*"))
-                           ispell-complete-word-dict)))
+                           (or ispell-complete-word-dict
+                               ispell-alternate-dictionary))))
     (cond ((eq possibilities t)
           (message "No word to complete"))
          ((null possibilities)
index 61ea89582b2a0d0e1b9e2b845dbce1da9ea75714..14b0b106bb3fd90a9696c2eaa3af984106c4a9a7 100644 (file)
@@ -55,6 +55,7 @@
     (define-key map "\n"  'nroff-electric-newline)
     (define-key map "\en" 'nroff-forward-text-line)
     (define-key map "\ep" 'nroff-backward-text-line)
+    (define-key map "\C-c\C-c" 'nroff-view)
     (define-key map [menu-bar nroff-mode] (cons "Nroff" menu-map))
     (define-key menu-map [nn]
       '(menu-item "Newline" nroff-electric-newline
@@ -73,6 +74,9 @@
                  nroff-electric-mode
                  :help "Auto insert closing requests if necessary"
                  :button (:toggle . nroff-electric-mode)))
+    (define-key menu-map [npm]
+      '(menu-item "Preview as man page" nroff-view
+                 :help "Run man on this file."))
     map)
   "Major mode keymap for `nroff-mode'.")
 
@@ -301,6 +305,17 @@ turns it on if arg is positive, otherwise off."
   :lighter " Electric"
   (or (derived-mode-p 'nroff-mode) (error "Must be in nroff mode")))
 
+(declare-function Man-getpage-in-background "man" (topic))
+
+(defun nroff-view ()
+  "Run man on this file."
+  (interactive)
+  (require 'man)
+  (let* ((file (buffer-file-name)))
+    (if file
+       (Man-getpage-in-background file)
+      (error "No associated file for the current buffer"))))
+
 ;; Old names that were not namespace clean.
 (define-obsolete-function-alias 'count-text-lines 'nroff-count-text-lines "22.1")
 (define-obsolete-function-alias 'forward-text-line 'nroff-forward-text-line "22.1")
index a672dc921587c918cfff0351b31501ab6d8753e9..1c213fcbea266fa46b3dd98064006373967b5fd8 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Maintainer: FSF
 ;; Keywords: wp convenience
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
index 2c698a836fe7cda8b725143def049280dc25ccea..4f1bcefa90e491c3c52524392841d768fba24c5f 100644 (file)
@@ -6,6 +6,7 @@
 
 ;; Maintainer: FSF
 ;; Keywords: wp
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
index 2673ee15457f833d662436d5e00439b7612083ab..e4ed2c8a05154b0f9672d991cc52a3a063fb5d6f 100644 (file)
@@ -34,7 +34,7 @@
 (defgroup picture nil
   "Picture mode --- editing using quarter-plane screen model."
   :prefix "picture-"
-  :group 'editing)
+  :group 'wp)
 
 (defcustom picture-rectangle-ctl ?+
   "*Character `picture-draw-rectangle' uses for top left corners."
index 498148f0de4b4c1be09ad6f9eeb17c7d6be6c530..89e8d26bc65eb17ff957162af17f78f015915b5b 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
 ;; Maintainer: auctex-devel@gnu.org
 ;; Version: 4.31
+;; Package: reftex
 
 ;; This file is part of GNU Emacs.
 
@@ -58,7 +59,7 @@ What is being used depends upon `reftex-plug-into-AUCTeX'."
       ;; Create a new label, with a temporary brace for `reftex-what-macro'
       (unwind-protect
           (progn (insert "{") (setq label (or (reftex-label nil t) "")))
-        (delete-backward-char 1)))
+        (delete-char -1)))
      ((and (not definition) (reftex-plug-flag 2))
       ;; Reference a label with RefTeX
       (setq label (reftex-reference nil t)))
index 3972a1df31c5dad33f641639510b8936129a6abf..79797b4791b95da5e8c8c33818400547e9ff2cbe 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
 ;; Maintainer: auctex-devel@gnu.org
 ;; Version: 4.31
+;; Package: reftex
 
 ;; This file is part of GNU Emacs.
 
index d15cf3f993118c5f25af79187969dc51b701ff10..39fc0f4a81ccf217c52eccab2b34db03faa5c200 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
 ;; Maintainer: auctex-devel@gnu.org
 ;; Version: 4.31
+;; Package: reftex
 
 ;; This file is part of GNU Emacs.
 
index 22e8a577d978a18fd003f46e174b783ec58aef44..dc533185b249fc8f3863a3acb0429e0b70923de7 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
 ;; Maintainer: auctex-devel@gnu.org
 ;; Version: 4.31
+;; Package: reftex
 
 ;; This file is part of GNU Emacs.
 
index 35cae5ae8744c54980cc34a1ae22d41764adc77c..dee7a31926079c22cb7ba4c570f1ed3a0ef22282 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
 ;; Maintainer: auctex-devel@gnu.org
 ;; Version: 4.31
+;; Package: reftex
 
 ;; This file is part of GNU Emacs.
 
index dc03a387082c420fb2da2fd8601f64a5a818f81e..58aaaa47a3870a8909997450f56522767b6cad1e 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
 ;; Maintainer: auctex-devel@gnu.org
 ;; Version: 4.31
+;; Package: reftex
 
 ;; This file is part of GNU Emacs.
 
index b186a1ea71303918557a35666263295c0dea60a7..23723489d1309c6000accea428e3b0537ae0dc6a 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
 ;; Maintainer: auctex-devel@gnu.org
 ;; Version: 4.31
+;; Package: reftex
 
 ;; This file is part of GNU Emacs.
 
index 90dc01a6bbe48ae3b9ef68b0dec48e0932b4d82a..bebeb1cd51ac411f2730ca1cc06eabbc4f914115 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
 ;; Maintainer: auctex-devel@gnu.org
 ;; Version: 4.31
+;; Package: reftex
 
 ;; This file is part of GNU Emacs.
 
index ae1690416b96da56246748b731c48fb554fb9f58..41ea83b077f7539410a4d1ef946d3c6a19e93f2b 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
 ;; Maintainer: auctex-devel@gnu.org
 ;; Version: 4.31
+;; Package: reftex
 
 ;; This file is part of GNU Emacs.
 
index ce0ac32492d404f4a2408f542ffdc8072dcb886e..5b83e7a43ad161b1ef0ab54766d5a82b25ac7e60 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
 ;; Maintainer: auctex-devel@gnu.org
 ;; Version: 4.31
+;; Package: reftex
 
 ;; This file is part of GNU Emacs.
 
index 66dec462b83467eca559090beee25761aa408645..b4b0a281ca6b39b16ad87d59ce4a3af1d64e9418 100644 (file)
 (defconst reftex-version "RefTeX version 4.31"
   "Version string for RefTeX.")
 
-(defvar reftex-mode nil
-  "Determines if RefTeX mode is active.")
-(make-variable-buffer-local 'reftex-mode)
-
 (defvar reftex-mode-map (make-sparse-keymap)
   "Keymap for RefTeX mode.")
 
   "Turn on RefTeX mode."
   (reftex-mode t))
 
+(put 'reftex-mode :included '(memq major-mode '(latex-mode tex-mode)))
+(put 'reftex-mode :menu-tag "RefTeX Mode")
 ;;;###autoload
-(defun reftex-mode (&optional arg)
+(define-minor-mode reftex-mode
   "Minor mode with distinct support for \\label, \\ref and \\cite in LaTeX.
 
 \\<reftex-mode-map>A Table of Contents of the entire (multifile) document with browsing
@@ -535,11 +533,7 @@ Under X, these and other functions will also be available as `Ref' menu
 on the menu bar.
 
 ------------------------------------------------------------------------------"
-
-  (interactive "P")
-  (setq reftex-mode (not (or (and (null arg) reftex-mode)
-                             (<= (prefix-numeric-value arg) 0))))
-
+  :lighter " Ref" :keymap reftex-mode-map
   (if reftex-mode
       (progn
         ;; Mode was turned on
@@ -565,24 +559,10 @@ on the menu bar.
         (modify-syntax-entry ?\' "." reftex-syntax-table-for-bib)
         (modify-syntax-entry ?\" "." reftex-syntax-table-for-bib)
         (modify-syntax-entry ?\[ "." reftex-syntax-table-for-bib)
-        (modify-syntax-entry ?\] "." reftex-syntax-table-for-bib)
-
-        (run-hooks 'reftex-mode-hook))
+        (modify-syntax-entry ?\] "." reftex-syntax-table-for-bib))
     ;; Mode was turned off
     (easy-menu-remove reftex-mode-menu)))
 
-(if (fboundp 'add-minor-mode)
-    ;; Use it so that we get the extras
-    (progn
-      (put 'reftex-mode :included '(memq major-mode '(latex-mode tex-mode)))
-      (put 'reftex-mode :menu-tag "RefTeX Mode")
-      (add-minor-mode 'reftex-mode " Ref" reftex-mode-map))
-  ;; The standard way
-  (unless (assoc 'reftex-mode minor-mode-alist)
-    (push '(reftex-mode " Ref") minor-mode-alist))
-  (unless (assoc 'reftex-mode minor-mode-map-alist)
-    (push (cons 'reftex-mode reftex-mode-map) minor-mode-map-alist)))
-
 (defvar reftex-docstruct-symbol)
 (defun reftex-kill-buffer-hook ()
   "Save RefTeX's parse file for this buffer if the information has changed."
@@ -625,11 +605,11 @@ on the menu bar.
 ;;;
 ;;; Multibuffer Variables
 ;;;
-;;; Technical notes: These work as follows: We keep just one list
-;;; of labels for each master file - this can save a lot of memory.
-;;; `reftex-master-index-list' is an alist which connects the true file name
-;;; of each master file with the symbols holding the information on that
-;;; document.  Each buffer has local variables which point to these symbols.
+;; Technical notes: These work as follows: We keep just one list
+;; of labels for each master file - this can save a lot of memory.
+;; `reftex-master-index-list' is an alist which connects the true file name
+;; of each master file with the symbols holding the information on that
+;; document.  Each buffer has local variables which point to these symbols.
 
 ;; List of variables which handle the multifile stuff.
 ;; This list is used to tie, untie, and reset these symbols.
index 3f21fbe7a2c3be2a52702f35673ee14d4bb4bd47..fd3148d3f12a4892a15f90cc440e963b5e956f53 100644 (file)
@@ -1787,7 +1787,7 @@ The TOC is inserted indented at the current column."
       (delete-region init-point (+ init-point (length initial-indent)))
 
       ;; Delete the last newline added.
-      (delete-backward-char 1)
+      (delete-char -1)
     )))
 
 (defun rst-toc-insert-node (node level indent pfx)
@@ -2585,62 +2585,132 @@ With prefix argument set the empty lines too."
   :group 'faces
   :version "21.1")
 
-(defcustom rst-block-face 'font-lock-keyword-face
+(defface rst-block '((t :inherit font-lock-keyword-face))
+  "Face used for all syntax marking up a special block."
+  :version "24.1"
+  :group 'rst-faces)
+
+(defcustom rst-block-face 'rst-block
   "All syntax marking up a special block."
+  :version "24.1"
   :group 'rst-faces
   :type '(face))
+(make-obsolete-variable 'rst-block-face
+                        "customize the face `rst-block' instead."
+                        "24.1")
+
+(defface rst-external '((t :inherit font-lock-type-face))
+  "Face used for field names and interpreted text."
+  :version "24.1"
+  :group 'rst-faces)
 
-(defcustom rst-external-face 'font-lock-type-face
+(defcustom rst-external-face 'rst-external
   "Field names and interpreted text."
+  :version "24.1"
   :group 'rst-faces
   :type '(face))
+(make-obsolete-variable 'rst-external-face
+                        "customize the face `rst-external' instead."
+                        "24.1")
 
-(defcustom rst-definition-face 'font-lock-function-name-face
+(defface rst-definition '((t :inherit font-lock-function-name-face))
+  "Face used for all other defining constructs."
+  :version "24.1"
+  :group 'rst-faces)
+
+(defcustom rst-definition-face 'rst-definition
   "All other defining constructs."
+  :version "24.1"
   :group 'rst-faces
   :type '(face))
-
-(defcustom rst-directive-face
-  ;; XEmacs compatibility
-  (if (boundp 'font-lock-builtin-face)
-      'font-lock-builtin-face
-    'font-lock-preprocessor-face)
+(make-obsolete-variable 'rst-definition-face
+                        "customize the face `rst-definition' instead."
+                        "24.1")
+
+;; XEmacs compatibility (?).
+(defface rst-directive (if (boundp 'font-lock-builtin-face)
+                           '((t :inherit font-lock-builtin-face))
+                         '((t :inherit font-lock-preprocessor-face)))
+  "Face used for directives and roles."
+  :version "24.1"
+  :group 'rst-faces)
+
+(defcustom rst-directive-face 'rst-directive
   "Directives and roles."
   :group 'rst-faces
   :type '(face))
+(make-obsolete-variable 'rst-directive-face
+                        "customize the face `rst-directive' instead."
+                        "24.1")
 
-(defcustom rst-comment-face 'font-lock-comment-face
+(defface rst-comment '((t :inherit font-lock-comment-face))
+  "Face used for comments."
+  :version "24.1"
+  :group 'rst-faces)
+
+(defcustom rst-comment-face 'rst-comment
   "Comments."
+  :version "24.1"
   :group 'rst-faces
   :type '(face))
+(make-obsolete-variable 'rst-comment-face
+                        "customize the face `rst-comment' instead."
+                        "24.1")
+
+(defface rst-emphasis1 '((t :inherit italic))
+  "Face used for simple emphasis."
+  :version "24.1"
+  :group 'rst-faces)
 
-(defcustom rst-emphasis1-face
-  ;; XEmacs compatibility
-  (if (facep 'italic)
-      ''italic
-    'italic)
+(defcustom rst-emphasis1-face 'rst-emphasis1
   "Simple emphasis."
+  :version "24.1"
   :group 'rst-faces
   :type '(face))
+(make-obsolete-variable 'rst-emphasis1-face
+                        "customize the face `rst-emphasis1' instead."
+                        "24.1")
 
-(defcustom rst-emphasis2-face
-  ;; XEmacs compatibility
-  (if (facep 'bold)
-      ''bold
-    'bold)
+(defface rst-emphasis2 '((t :inherit bold))
+  "Face used for double emphasis."
+  :version "24.1"
+  :group 'rst-faces)
+
+(defcustom rst-emphasis2-face 'rst-emphasis2
   "Double emphasis."
   :group 'rst-faces
   :type '(face))
+(make-obsolete-variable 'rst-emphasis2-face
+                        "customize the face `rst-emphasis2' instead."
+                        "24.1")
+
+(defface rst-literal '((t :inherit font-lock-string-face))
+  "Face used for literal text."
+  :version "24.1"
+  :group 'rst-faces)
 
-(defcustom rst-literal-face 'font-lock-string-face
+(defcustom rst-literal-face 'rst-literal
   "Literal text."
+  :version "24.1"
   :group 'rst-faces
   :type '(face))
+(make-obsolete-variable 'rst-literal-face
+                        "customize the face `rst-literal' instead."
+                        "24.1")
 
-(defcustom rst-reference-face 'font-lock-variable-name-face
+(defface rst-reference '((t :inherit font-lock-variable-name-face))
+  "Face used for references to a definition."
+  :version "24.1"
+  :group 'rst-faces)
+
+(defcustom rst-reference-face 'rst-reference
   "References to a definition."
+  :version "24.1"
   :group 'rst-faces
   :type '(face))
+(make-obsolete-variable 'rst-reference-face
+                        "customize the face `rst-reference' instead."
+                        "24.1")
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
@@ -2818,94 +2888,76 @@ details check the Rst Faces Defaults group."
 
      ;; Simple `Body Elements`_
      ;; `Bullet Lists`_
-     (list
-      (concat re-bol "\\([-*+]" re-blksep1 "\\)")
-      1 rst-block-face)
+     `(,(concat re-bol "\\([-*+]" re-blksep1 "\\)")
+       1 rst-block-face)
      ;; `Enumerated Lists`_
-     (list
-      (concat re-bol "\\((?\\(#\\|[0-9]+\\|[A-Za-z]\\|[IVXLCMivxlcm]+\\)[.)]"
-             re-blksep1 "\\)")
-      1 rst-block-face)
+     `(,(concat re-bol "\\((?\\(#\\|[0-9]+\\|[A-Za-z]\\|[IVXLCMivxlcm]+\\)[.)]"
+                re-blksep1 "\\)")
+       1 rst-block-face)
      ;; `Definition Lists`_ FIXME: missing
      ;; `Field Lists`_
-     (list
-      (concat re-bol "\\(:[^:\n]+:\\)" re-blksep1)
-      1 rst-external-face)
+     `(,(concat re-bol "\\(:[^:\n]+:\\)" re-blksep1)
+       1 rst-external-face)
      ;; `Option Lists`_
-     (list
-      (concat re-bol "\\(\\(\\(\\([-+/]\\|--\\)\\sw\\(-\\|\\sw\\)*"
-             "\\([ =]\\S +\\)?\\)\\(,[\t ]\\)?\\)+\\)\\($\\|[\t ]\\{2\\}\\)")
-      1 rst-block-face)
+     `(,(concat re-bol "\\(\\(\\(\\([-+/]\\|--\\)\\sw\\(-\\|\\sw\\)*"
+               "\\([ =]\\S +\\)?\\)\\(,[\t ]\\)?\\)+\\)\\($\\|[\t ]\\{2\\}\\)")
+       1 rst-block-face)
 
      ;; `Tables`_ FIXME: missing
 
      ;; All the `Explicit Markup Blocks`_
      ;; `Footnotes`_ / `Citations`_
-     (list
-      (concat re-bol "\\(" re-ems "\\[[^[\n]+\\]\\)" re-blksep1)
+     `(,(concat re-bol "\\(" re-ems "\\[[^[\n]+\\]\\)" re-blksep1)
       1 rst-definition-face)
      ;; `Directives`_ / `Substitution Definitions`_
-     (list
-      (concat re-bol "\\(" re-ems "\\)\\(\\(|[^|\n]+|[\t ]+\\)?\\)\\("
-             re-sym1 "+::\\)" re-blksep1)
-      (list 1 rst-directive-face)
-      (list 2 rst-definition-face)
-      (list 4 rst-directive-face))
+     `(,(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`_
-     (list
-      (concat re-bol "\\(" re-ems "_\\([^:\\`\n]\\|\\\\.\\|`[^`\n]+`\\)+:\\)"
-             re-blksep1)
-      1 rst-definition-face)
-     (list
-      (concat re-bol "\\(__\\)" re-blksep1)
-      1 rst-definition-face)
+     `(,(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`_
-     (list
-      (concat re-imp1 "\\(\\*\\*" re-ima2 "\\*\\*\\)" re-ims1)
-      2 rst-emphasis2-face)
+     `(,(concat re-imp1 "\\(\\*\\*" re-ima2 "\\*\\*\\)" re-ims1)
+       2 rst-emphasis2-face)
      ;; `Emphasis`_
-     (list
-      (concat re-imp1 "\\(\\*" re-ima2 "\\*\\)" re-ims1)
-      2 rst-emphasis1-face)
+     `(,(concat re-imp1 "\\(\\*" re-ima2 "\\*\\)" re-ims1)
+       2 rst-emphasis1-face)
      ;; `Inline Literals`_
-     (list
-      (concat re-imp1 "\\(``" re-imb2 "``\\)" re-ims1)
-      2 rst-literal-face)
+     `(,(concat re-imp1 "\\(``" re-imb2 "``\\)" re-ims1)
+       2 rst-literal-face)
      ;; `Inline Internal Targets`_
-     (list
-      (concat re-imp1 "\\(_`" re-imb2 "`\\)" re-ims1)
-      2 rst-definition-face)
+     `(,(concat re-imp1 "\\(_`" re-imb2 "`\\)" re-ims1)
+       2 rst-definition-face)
      ;; `Hyperlink References`_
      ;; FIXME: `Embedded URIs`_ not considered
-     (list
-      (concat re-imp1 "\\(\\(`" re-imb2 "`\\|\\(\\sw\\(\\sw\\|-\\)+\\sw\\)\\)__?\\)" re-ims1)
+     `(,(concat re-imp1 "\\(\\(`" re-imb2 "`\\|\\(\\sw\\(\\sw\\|-\\)+\\sw\\)\\)__?\\)" re-ims1)
       2 rst-reference-face)
      ;; `Interpreted Text`_
-     (list
-      (concat re-imp1 "\\(\\(:" re-sym1 "+:\\)?\\)\\(`" re-imb2 "`\\)\\(\\(:"
-             re-sym1 "+:\\)?\\)" re-ims1)
-      (list 2 rst-directive-face)
-      (list 5 rst-external-face)
-      (list 8 rst-directive-face))
+     `(,(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`_
-     (list
-      (concat re-imp1 "\\(\\[[^]]+\\]_\\)" re-ims1)
-      2 rst-reference-face)
+     `(,(concat re-imp1 "\\(\\[[^]]+\\]_\\)" re-ims1)
+       2 rst-reference-face)
      ;; `Substitution References`_
-     (list
-      (concat re-imp1 "\\(|" re-imv2 "|\\)" re-ims1)
-      2 rst-reference-face)
+     `(,(concat re-imp1 "\\(|" re-imv2 "|\\)" re-ims1)
+       2 rst-reference-face)
      ;; `Standalone Hyperlinks`_
-     (list
-      ;; FIXME: This takes it easy by using a whitespace as delimiter
-      (concat re-imp1 "\\(" re-uris1 ":\\S +\\)" re-ims1)
-      2 rst-definition-face)
-     (list
-      (concat re-imp1 "\\(" re-sym1 "+@" re-sym1 "+\\)" re-ims1)
-      2 rst-definition-face)
+     `(;; 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
 
@@ -2914,7 +2966,7 @@ details check the Rst Faces Defaults group."
       (list
        re-ado2)
       (if (not rst-mode-lazy)
-         (list 1 rst-block-face)
+         '(1 rst-block-face)
        (list
         (list 'rst-font-lock-handle-adornment
               '(progn
@@ -2934,7 +2986,7 @@ details check the Rst Faces Defaults group."
       (list
        (concat re-bol "\\(" re-ems "\\)\[^[|_]\\([^:\n]\\|:\\([^:\n]\\|$\\)\\)*$")
 
-       (list 1 rst-comment-face))
+       '(1 rst-comment-face))
       (if rst-mode-lazy
          (list
           (list 'rst-font-lock-find-unindented-line
@@ -2942,12 +2994,12 @@ details check the Rst Faces Defaults group."
                    (setq rst-font-lock-indentation-point (match-end 1))
                    (point-max))
                 nil
-                (list 0 rst-comment-face 'append)))))
+                '(0 rst-comment-face append)))))
      (append
       (list
        (concat re-bol "\\(" re-emt "\\)\\(\\s *\\)$")
-       (list 1 rst-comment-face)
-       (list 2 rst-comment-face))
+       '(1 rst-comment-face)
+       '(2 rst-comment-face))
       (if rst-mode-lazy
          (list
           (list 'rst-font-lock-find-unindented-line
@@ -2955,13 +3007,13 @@ details check the Rst Faces Defaults group."
                    (setq rst-font-lock-indentation-point 'next)
                    (point-max))
                 nil
-                (list 0 rst-comment-face 'append)))))
+                '(0 rst-comment-face append)))))
 
      ;; `Literal Blocks`_
      (append
       (list
        (concat re-bol "\\(\\([^.\n]\\|\\.[^.\n]\\).*\\)?\\(::\\)$")
-       (list 3 rst-block-face))
+       '(3 rst-block-face))
       (if rst-mode-lazy
          (list
           (list 'rst-font-lock-find-unindented-line
@@ -2969,14 +3021,14 @@ details check the Rst Faces Defaults group."
                    (setq rst-font-lock-indentation-point t)
                    (point-max))
                 nil
-                (list 0 rst-literal-face 'append)))))
+                '(0 rst-literal-face append)))))
 
     ;; `Doctest Blocks`_
     (append
      (list
       (concat re-bol "\\(>>>\\|\\.\\.\\.\\)\\(.+\\)")
-      (list 1 rst-block-face)
-      (list 2 rst-literal-face)))
+      '(1 rst-block-face)
+      '(2 rst-literal-face)))
     )))
 
 
index b9d52acdebab46c92429ea9d98f20d196a6b6064..87ffecd5d5a34090333e3ff0900c4a1df251ba78 100644 (file)
@@ -101,6 +101,11 @@ This takes effect when first loading the `sgml-mode' library.")
     (define-key map "\C-c\^?" 'sgml-delete-tag)
     (define-key map "\C-c?" 'sgml-tag-help)
     (define-key map "\C-c/" 'sgml-close-tag)
+
+    ;; Redundant keybindings, for consistency with TeX mode.
+    (define-key map "\C-c\C-o" 'sgml-tag)
+    (define-key map "\C-c\C-e" 'sgml-close-tag)
+
     (define-key map "\C-c8" 'sgml-name-8bit-mode)
     (define-key map "\C-c\C-v" 'sgml-validate)
     (when sgml-quick-keys
@@ -521,7 +526,7 @@ Behaves electrically if `sgml-quick-keys' is non-nil."
     (insert-char ?/ 1)
     (indent-according-to-mode))
    ((eq sgml-quick-keys 'close)
-    (delete-backward-char 1)
+    (delete-char -1)
     (sgml-close-tag))
    (t
     (sgml-slash-matching arg))))
@@ -578,7 +583,7 @@ encoded keyboard operation."
   (insert ?&)
   (or char
       (setq char (read-quoted-char "Enter char or octal number")))
-  (delete-backward-char 1)
+  (delete-char -1)
   (insert char)
   (undo-boundary)
   (sgml-namify-char))
@@ -596,7 +601,7 @@ Uses `sgml-char-names'."
           ((encode-char char 'ucs)))))
     (if (not name)
        (error "Don't know the name of `%c'" char)
-      (delete-backward-char 1)
+      (delete-char -1)
       (insert (format (if (numberp name) "&#%d;" "&%s;") name)))))
 
 (defun sgml-name-self ()
@@ -702,7 +707,7 @@ If QUIET, do not print a message when there are no attributes for TAG."
              (sgml-value (assoc (downcase attribute) alist))
              (setq i (1- i))))
          (if (eq (preceding-char) ?\s)
-             (delete-backward-char 1)))
+             (delete-char -1)))
        car)))
 
 (defun sgml-auto-attributes (arg)
@@ -1112,7 +1117,7 @@ See `sgml-tag-alist' for info about attribute rules."
          (setq alist (skeleton-read '(completing-read "Value: " (cdr alist))))
          (if (string< "" alist)
              (insert alist ?\")
-           (delete-backward-char 2)))
+           (delete-char -2)))
       (insert "=\"")
       (if (cdr alist)
           (insert (skeleton-read '(completing-read "Value: " alist)))
index 44933bff32794c10f6f36c56280df8f07bd80aa7..8b423ef88026f9f483faa716b941bd9ba32a6901 100644 (file)
 ;;;
 
 (defgroup table nil
-  "Text based table manipulation utilities.
-See `table-insert' for examples about how to use."
+  "Text based table manipulation utilities."
   :tag "Table"
   :prefix "table-"
-  :group 'editing
   :group 'wp
-  :group 'paragraphs
-  :group 'fill
   :version "22.1")
 
 (defgroup table-hooks nil
@@ -923,12 +919,12 @@ This is always set to nil at the entry to `table-with-cache-buffer' before execu
 (defvar table-source-info-plist nil
   "General storage for temporary information used while generating source.")
 
-;;; The following history containers not only keep the history of user
-;;; entries but also serve as the default value providers.  When an
-;;; interactive command is invoked it offers a user the latest entry
-;;; of the history as a default selection.  Therefore the values below
-;;; are the first default value when a command is invoked for the very
-;;; first time when there is no real history existing yet.
+;; The following history containers not only keep the history of user
+;; entries but also serve as the default value providers.  When an
+;; interactive command is invoked it offers a user the latest entry
+;; of the history as a default selection.  Therefore the values below
+;; are the first default value when a command is invoked for the very
+;; first time when there is no real history existing yet.
 (defvar table-cell-span-direction-history '("right"))
 (defvar table-cell-split-orientation-history '("horizontally"))
 (defvar table-cell-split-contents-to-history '("split"))
@@ -952,19 +948,19 @@ This is always set to nil at the entry to `table-with-cache-buffer' before execu
 (defvar table-capture-columns-history '(""))
 (defvar table-target-history '("cell"))
 
-;;; Some entries in `table-cell-bindings' are duplicated in
-;;; `table-command-remap-alist'.  There is a good reason for
-;;; this.  Common key like return key may be taken by some other
-;;; function than normal `newline' function.  Thus binding return key
-;;; directly for `*table--cell-newline' ensures that the correct enter
-;;; operation in a table cell.  However
-;;; `table-command-remap-alist' has an additional role than
-;;; replacing commands.  It is also used to construct a table command
-;;; list.  This list is very important because it is used to check if
-;;; the previous command was one of them in this list or not.  If the
-;;; previous command is found in the list the current command will not
-;;; refill the table cache.  If the command were not listed fast
-;;; typing can cause unwanted cache refill.
+;; Some entries in `table-cell-bindings' are duplicated in
+;; `table-command-remap-alist'.  There is a good reason for
+;; this.  Common key like return key may be taken by some other
+;; function than normal `newline' function.  Thus binding return key
+;; directly for `*table--cell-newline' ensures that the correct enter
+;; operation in a table cell.  However
+;; `table-command-remap-alist' has an additional role than
+;; replacing commands.  It is also used to construct a table command
+;; list.  This list is very important because it is used to check if
+;; the previous command was one of them in this list or not.  If the
+;; previous command is found in the list the current command will not
+;; refill the table cache.  If the command were not listed fast
+;; typing can cause unwanted cache refill.
 (defconst table-cell-bindings
   '(([(control i)]     . table-forward-cell)
     ([(control I)]     . table-backward-cell)
index 5fc92a92d37abd8a416817269c6a6c148e8f4b7f..da0c5396f2cd8d54d871011b08cb369719471b0e 100644 (file)
@@ -808,6 +808,11 @@ END is the position of the first delimiter after \verb."
     (define-key map "\C-c\C-c" 'tex-compile)
     (define-key map "\C-c\C-i" 'tex-bibtex-file)
     (define-key map "\C-c\C-o" 'latex-insert-block)
+
+    ;; Redundant keybindings, for consistency with SGML mode.
+    (define-key map "\C-c\C-t" 'latex-insert-block)
+    (define-key map "\C-c/" 'latex-close-block)
+
     (define-key map "\C-c\C-e" 'latex-close-block)
     (define-key map "\C-c\C-u" 'tex-goto-last-unclosed-latex-block)
     (define-key map "\C-c\C-m" 'tex-feed-input)
index da33df7113de4b2ff7ff6dfc44907aa1183dcb6b..577287c60bcf5511df03312c4917b1ccd3d085d2 100644 (file)
@@ -1,8 +1,8 @@
 ;;; texinfmt.el --- format Texinfo files into Info files
 
-;; Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993,
-;;   1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003,
-;;   2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
+;;   1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+;;   2008, 2009, 2010  Free Software Foundation, Inc.
 
 ;; Maintainer: Robert J. Chassell <bug-texinfo@gnu.org>
 ;; Keywords: maint, tex, docs
@@ -224,7 +224,7 @@ converted to Info is stored in a temporary buffer."
         (save-restriction
           (widen)
           (goto-char (point-min))
-          (let ((search-end (save-excursion (forward-line 100) (point))))
+          (let ((search-end (line-beginning-position 101)))
             (if (or
                  ;; Either copy header text.
                  (and
@@ -285,7 +285,7 @@ converted to Info is stored in a temporary buffer."
       (let ((filename (concat input-directory
                               (texinfo-parse-line-arg))))
         (re-search-backward "^@include")
-        (delete-region (point) (save-excursion (forward-line 1) (point)))
+        (delete-region (point) (line-beginning-position 2))
         (message "Reading included file: %s" filename)
         (save-excursion
           (save-restriction
@@ -323,8 +323,7 @@ converted to Info is stored in a temporary buffer."
 
     ;; Insert Info region title text.
     (goto-char (point-min))
-    (if (search-forward
-         "@setfilename" (save-excursion (forward-line 100) (point)) t)
+    (if (search-forward "@setfilename" (line-beginning-position 101) t)
         (progn
           (setq texinfo-command-end (point))
           (beginning-of-line)
@@ -772,13 +771,13 @@ commands."
        ((eq type '@raisesections)
         (setq level (1+ level))
         (delete-region
-         (point) (save-excursion (forward-line 1) (point))))
+         (point) (line-beginning-position 2)))
 
        ;; 2. Decrement level
        ((eq type '@lowersections)
         (setq level (1- level))
         (delete-region
-         (point) (save-excursion (forward-line 1) (point))))
+         (point) (line-beginning-position 2)))
 
        ;; Now handle structuring commands
        ((cond
@@ -1505,9 +1504,7 @@ The node is constructed automatically."
              (progn (goto-char node-name-beginning) ; skip over node command
                     (skip-chars-forward " \t")  ; and over spaces
                     (point))
-             (if (search-forward
-                  ","
-                  (save-excursion (end-of-line) (point)) t) ; bound search
+             (if (search-forward "," (line-end-position) t) ; bound search
                  (1- (point))
                (end-of-line) (point))))))
     (texinfo-discard-command)  ; remove or insert whitespace, as needed
@@ -1692,7 +1689,7 @@ Used by @refill indenting command to avoid indenting within lists, etc.")
 (put 'itemize 'texinfo-item 'texinfo-itemize-item)
 (defun texinfo-itemize-item ()
   ;; (texinfo-discard-line)   ; Did not handle text on same line as @item.
-  (delete-region (1+ (point)) (save-excursion (beginning-of-line) (point)))
+  (delete-region (1+ (point)) (line-beginning-position))
   (if (looking-at "[ \t]*[^ \t\n]+")
       ;; Text on same line as @item command.
       (insert "\b   " (nth 1 (car texinfo-stack)) " \n")
@@ -2132,10 +2129,10 @@ This command is executed when texinfmt sees @item inside @multitable."
       (narrow-to-region start end)
       ;; Remove whitespace before and after entry.
       (skip-chars-forward " ")
-      (delete-region (point) (save-excursion (beginning-of-line) (point)))
+      (delete-region (point) (line-beginning-position))
       (goto-char (point-max))
       (skip-chars-backward " ")
-      (delete-region (point) (save-excursion (end-of-line) (point)))
+      (delete-region (point) (line-end-position))
       ;; Temporarily set texinfo-stack to nil so texinfo-format-scan
       ;; does not see an unterminated @multitable.
       (let (texinfo-stack)                      ; nil
@@ -2409,16 +2406,14 @@ Use only the FILENAME arg; for Info, ignore the other arguments to @image."
   (let ((start (1- (point)))
         args)
     (skip-chars-forward " ")
-    (save-excursion (end-of-line) (setq texinfo-command-end (point)))
+    (setq texinfo-command-end (line-end-position))
     (if (not (looking-at "\\([^=]+\\)=\\(.*\\)"))
        (error "Invalid alias command")
       (push (cons
              (match-string-no-properties 1)
              (match-string-no-properties 2))
             texinfo-alias-list)
-      (texinfo-discard-command))
-    )
-  )
+      (texinfo-discard-command))))
 
 \f
 ;;; @var, @code and the like
@@ -2455,7 +2450,7 @@ Use only the FILENAME arg; for Info, ignore the other arguments to @image."
   "Insert ` ... ' around arg unless inside a table; in that case, no quotes."
   ;; `looking-at-backward' not available in v. 18.57, 20.2
   (if (not (search-backward "\b"    ; searched-for character is a control-H
-                    (save-excursion (beginning-of-line) (point))
+                    (line-beginning-position)
                     t))
       (insert "`" (texinfo-parse-arg-discard) "'")
       (insert  (texinfo-parse-arg-discard)))
@@ -2507,7 +2502,7 @@ For example, @verb\{|@|\} results in @ and
       (error "Not found: @verb start brace"))
     (delete-region texinfo-command-start (+ 2 texinfo-command-end))
     (search-forward  delimiter))
-  (delete-backward-char 1)
+  (delete-char -1)
   (unless (looking-at "}")
     (error "Not found: @verb end brace"))
   (delete-char 1))
@@ -2840,8 +2835,7 @@ Default is to leave paragraph indentation as is."
 (defun texinfo-noindent ()
   (save-excursion
     (forward-paragraph 1)
-    (if (search-backward "@refill"
-                            (save-excursion (forward-line -1) (point)) t)
+    (if (search-backward "@refill" (line-beginning-position 0) t)
         () ; leave @noindent command so @refill command knows not to indent
       ;; else
       (texinfo-discard-line))))
index 75897a2cf079acf21df0778931bae8105590f932..b6868d3a8e8c1b1c5f715031b6256efdb92adb90 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Maintainer: FSF
 ;; Keywords: wp
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
@@ -32,7 +33,7 @@
   "Normal hook run when entering Text mode and many related modes."
   :type 'hook
   :options '(turn-on-auto-fill turn-on-flyspell)
-  :group 'data)
+  :group 'wp)
 
 (defvar text-mode-variant nil
   "Non-nil if this buffer's major mode is a variant of Text mode.
index 302a8c7cd737500998c23eae60b7f198bdfd0c68..d512faefee0e81e68f062fd05f37ed690b62f303 100644 (file)
@@ -490,15 +490,10 @@ This runs the normal hook `display-time-hook' after each update."
                 'display-time-event-handler)))
 
 
-(defun display-time-world-mode ()
+(define-derived-mode display-time-world-mode nil "World clock"
   "Major mode for buffer that displays times in various time zones.
 See `display-time-world'."
-  (interactive)
-  (kill-all-local-variables)
-  (setq
-   major-mode 'display-time-world-mode
-   mode-name "World clock")
-  (use-local-map display-time-world-mode-map))
+  (setq show-trailing-whitespace nil))
 
 (defun display-time-world-display (alist)
   "Replace current buffer text with times in various zones, based on ALIST."
@@ -506,25 +501,23 @@ See `display-time-world'."
        (buffer-undo-list t))
     (erase-buffer)
     (let ((max-width 0)
-         (result ()))
+         (result ())
+         fmt)
       (unwind-protect
          (dolist (zone alist)
            (let* ((label (cadr zone))
                   (width (string-width label)))
              (set-time-zone-rule (car zone))
-             (setq result
-                   (append result
-                           (list
-                            label width
-                            (format-time-string display-time-world-time-format))))
+             (push (cons label
+                         (format-time-string display-time-world-time-format))
+                   result)
              (when (> width max-width)
                (setq max-width width))))
        (set-time-zone-rule nil))
-      (while result
-       (insert (pop result)
-               (make-string (1+ (- max-width (pop result))) ?\s)
-               (pop result) "\n")))
-    (delete-backward-char 1)))
+      (setq fmt (concat "%-" (int-to-string max-width) "s %s\n"))
+      (dolist (timedata (nreverse result))
+       (insert (format fmt (car timedata) (cdr timedata)))))
+    (delete-char -1)))
 
 ;;;###autoload
 (defun display-time-world ()
index 875eb2404336f14255769906ccae680777b69975..98aaa8fe50a0eb93bce0d5e2488b49e78797e619 100644 (file)
@@ -5,6 +5,7 @@
 ;;
 ;; Author: Dave Love <fx@gnu.org>
 ;; Keywords: mouse frames
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
@@ -48,21 +49,23 @@ With numeric ARG, display the tool bar if and only if ARG is positive.
 
 See `tool-bar-add-item' and `tool-bar-add-item-from-menu' for
 conveniently adding tool bar items."
-  :init-value nil
+  :init-value t
   :global t
   :group 'mouse
   :group 'frames
-  (if tool-bar-mode
-      (progn
-       ;; Make one tool-bar-line for any - including non-graphical -
-       ;; terminal, see Bug#1754.  If this causes problems, we should
-       ;; handle the problem in `modify-frame-parameters' or do not
-       ;; call `modify-all-frames-parameters' when toggling the tool
-       ;; bar off either.
-       (modify-all-frames-parameters (list (cons 'tool-bar-lines 1)))
-       (if (= 1 (length (default-value 'tool-bar-map))) ; not yet setup
-           (tool-bar-setup)))
-    (modify-all-frames-parameters (list (cons 'tool-bar-lines 0)))))
+  (let ((val (if tool-bar-mode 1 0)))
+    (dolist (frame (frame-list))
+      (set-frame-parameter frame 'tool-bar-lines val))
+    ;; If the user has given `default-frame-alist' a `tool-bar-lines'
+    ;; parameter, replace it.
+    (if (assq 'tool-bar-lines default-frame-alist)
+       (setq default-frame-alist
+             (cons (cons 'tool-bar-lines val)
+                   (assq-delete-all 'tool-bar-lines
+                                    default-frame-alist)))))
+  (and tool-bar-mode
+       (= 1 (length (default-value 'tool-bar-map))) ; not yet setup
+       (tool-bar-setup)))
 
 ;;;###autoload
 ;; Used in the Show/Hide menu, to have the toggle reflect the current frame.
@@ -74,17 +77,6 @@ See `tool-bar-mode' for more information."
       (tool-bar-mode (if (> (frame-parameter nil 'tool-bar-lines) 0) 0 1))
     (tool-bar-mode arg)))
 
-;;;###autoload
-;; We want to pretend the toolbar by standard is on, as this will make
-;; customize consider disabling the toolbar a customization, and save
-;; that.  We could do this for real by setting :init-value above, but
-;; that would turn on the toolbar in MS Windows where it is currently
-;; useless, and it would overwrite disabling the tool bar from X
-;; resources.  If anyone want to implement this in a cleaner way,
-;; please do so.
-;; -- Per Abrahamsen <abraham@dina.kvl.dk> 2002-02-21.
-(put 'tool-bar-mode 'standard-value '(t))
-
 (defvar tool-bar-map (make-sparse-keymap)
   "Keymap for the tool bar.
 Define this locally to override the global tool bar.")
@@ -232,6 +224,7 @@ holds a keymap."
         submap key)
     ;; We'll pick up the last valid entry in the list of keys if
     ;; there's more than one.
+    ;; FIXME: Aren't they *all* "valid"??  --Stef
     (dolist (k keys)
       ;; We're looking for a binding of the command in a submap of
       ;; the menu bar map, so the key sequence must be two or more
@@ -267,7 +260,7 @@ holds a keymap."
   ;; People say it's bad to have EXIT on the tool bar, since users
   ;; might inadvertently click that button.
   ;;(tool-bar-add-item-from-menu 'save-buffers-kill-emacs "exit")
-  (tool-bar-add-item-from-menu 'find-file "new")
+  (tool-bar-add-item-from-menu 'find-file "new" nil :label "New File")
   (tool-bar-add-item-from-menu 'menu-find-file-existing "open")
   (tool-bar-add-item-from-menu 'dired "diropen")
   (tool-bar-add-item-from-menu 'kill-this-buffer "close")
@@ -294,14 +287,15 @@ holds a keymap."
                               "paste" nil
                               :visible '(not (eq 'special (get major-mode
                                                                'mode-class))))
-  (tool-bar-add-item-from-menu 'nonincremental-search-forward "search")
+  (tool-bar-add-item-from-menu 'nonincremental-search-forward "search"
+                              nil :label "Search")
   ;;(tool-bar-add-item-from-menu 'ispell-buffer "spell")
 
   ;; There's no icon appropriate for News and we need a command rather
   ;; than a lambda for Read Mail.
   ;;(tool-bar-add-item-from-menu 'compose-mail "mail/compose")
 
-  (tool-bar-add-item-from-menu 'print-buffer "print")
+  (tool-bar-add-item-from-menu 'print-buffer "print" nil :label "Print")
 
   ;; tool-bar-add-item-from-menu itself operates on
   ;; (default-value 'tool-bar-map), but when we don't use that function,
index 344f01fa4ccf7c60e904bfa3c6f8e5146d31d684..5987b00f92efeca06ef004d64b11ed0f5758a20a 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Author: Gerd Moellmann <gerd@acm.org>
 ;; Keywords: help c mouse tools
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
index de7f7ab4a3c6e74ed0743068d6a4ee18d686624a..6961fafb3aafc5287f67d64dc4d1b1ac5d90d9b9 100644 (file)
@@ -4,6 +4,7 @@
 
 ;; Maintainer: FSF
 ;; Keywords: help, internal
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
@@ -218,8 +219,8 @@ LEFT and RIGHT are the elements to compare."
              (save-buffers-kill-terminal [?\C-x ?\C-c])
 
              ;; * SUMMARY
-             (scroll-up [?\C-v])
-             (scroll-down [?\M-v])
+             (scroll-up-command [?\C-v])
+             (scroll-down-command [?\M-v])
              (recenter-top-bottom [?\C-l])
 
              ;; * BASIC CURSOR CONTROL
@@ -252,7 +253,7 @@ LEFT and RIGHT are the elements to compare."
              ;; * INSERTING AND DELETING
              ;; C-u 8 * to insert ********.
              (delete-backward-char "\d")
-             (delete-char [?\C-d])
+             (delete-forward-char [?\C-d])
              (backward-kill-word [?\M-\d])
              (kill-word [?\M-d])
              (kill-line [?\C-k])
@@ -829,6 +830,8 @@ Run the Viper tutorial? "))
         (if old-tut-file
             (progn
               (insert-file-contents (tutorial--saved-file))
+             (let ((enable-local-variables :safe))
+               (hack-local-variables))
               (goto-char (point-min))
               (setq old-tut-point
                     (string-to-number
@@ -844,6 +847,8 @@ Run the Viper tutorial? "))
               (goto-char tutorial--point-before-chkeys)
               (setq tutorial--point-before-chkeys (point-marker)))
           (insert-file-contents (expand-file-name filename tutorial-directory))
+         (let ((enable-local-variables :safe))
+           (hack-local-variables))
           (forward-line)
           (setq tutorial--point-before-chkeys (point-marker)))
 
index 46523c22995c9e8fb0276e56c3801d6e3d8a0eaf..641215be8cf0fc341d76f822608063161ed56ba6 100644 (file)
@@ -152,13 +152,6 @@ guess a reasonably good pair of values for this variable."
   :type 'sexp
   :group 'type-break)
 
-(defcustom type-break-query-mode t
-  "Non-nil means ask whether or not to prompt user for breaks.
-If so, call the function specified in the value of the variable
-`type-break-query-function' to do the asking."
-  :type 'boolean
-  :group 'type-break)
-
 (defcustom type-break-query-function 'yes-or-no-p
   "Function to use for making query for a typing break.
 It should take a string as an argument, the prompt.
@@ -245,14 +238,6 @@ remove themselves after running.")
 \f
 ;; Mode line frobs
 
-(defcustom type-break-mode-line-message-mode nil
-  "Non-nil means put type-break related messages in the mode line.
-Otherwise, messages typically go in the echo area.
-
-See also `type-break-mode-line-format' and its members."
-  :type 'boolean
-  :group 'type-break)
-
 (defvar type-break-mode-line-format
   '(type-break-mode-line-message-mode
     (""
@@ -447,7 +432,7 @@ problems."
            (message "Type Break mode is disabled")))))
   type-break-mode)
 
-(defun type-break-mode-line-message-mode (&optional prefix)
+(define-minor-mode type-break-mode-line-message-mode
   "Enable or disable warnings in the mode line about typing breaks.
 
 A negative PREFIX argument disables this mode.
@@ -462,16 +447,9 @@ Variables controlling the display of messages in the mode line include:
         `global-mode-string'
         `type-break-mode-line-break-message'
         `type-break-mode-line-warning'"
-  (interactive "P")
-  (setq type-break-mode-line-message-mode
-        (>= (prefix-numeric-value prefix) 0))
-  (and (called-interactively-p 'interactive)
-       (if type-break-mode-line-message-mode
-           (message "type-break-mode-line-message-mode is enabled")
-         (message "type-break-mode-line-message-mode is disabled")))
-  type-break-mode-line-message-mode)
-
-(defun type-break-query-mode (&optional prefix)
+  :global t)
+
+(define-minor-mode type-break-query-mode
   "Enable or disable warnings in the mode line about typing breaks.
 
 When enabled, the user is periodically queried about whether to take a
@@ -483,14 +461,7 @@ No argument or any non-negative argument enables it.
 
 The user may also enable or disable this mode simply by setting the
 variable of the same name."
-  (interactive "P")
-  (setq type-break-query-mode
-        (>= (prefix-numeric-value prefix) 0))
-  (and (called-interactively-p 'interactive)
-       (if type-break-query-mode
-           (message "type-break-query-mode is enabled")
-         (message "type-break-query-mode is disabled")))
-  type-break-query-mode)
+  :global t)
 
 \f
 ;;; session file functions
index ddf15e243c4eeaf272af95c869443d400fbf74c2..a654b2dcfc59d3a764380c854685b37109f7756c 100644 (file)
@@ -7,6 +7,7 @@
 ;; Maintainer: FSF
 ;; Keywords: files
 ;; Created: 15 May 86
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
@@ -89,7 +90,7 @@
 
 (defgroup uniquify nil
   "Unique buffer names dependent on file name."
-  :group 'applications)
+  :group 'files)
 
 
 (defcustom uniquify-buffer-name-style nil
index f7babefc87633828a930ab29f9a857d4d275e28e..e3f76e72e3722f20bf5162e7242f379e3e322e4a 100644 (file)
@@ -1,12 +1,24 @@
-2010-07-26  Michael Albinus  <michael.albinus@gmx.de>
+2010-07-27  Michael Albinus  <michael.albinus@gmx.de>
 
        * url-http (url-http-parse-headers): Disable file name handlers at
        all (not only Tramp).  (Bug#6717)
 
-2010-07-25  Michael Albinus  <michael.albinus@gmx.de>
+2010-07-27  Michael Albinus  <michael.albinus@gmx.de>
 
        * url-http (url-http-parse-headers): Disable Tramp.  (Bug#6717)
 
+2010-07-01  Mark A. Hershberger  <mah@everybody.org>
+
+       * url-http.el (url-http-create-request): Add a CRLF on the end so
+       that POSTs with content to https urls work.  See
+       <https://bugs.launchpad.net/mediawiki-el/+bug/540759>
+
+2010-06-22  Mark A. Hershberger  <mah@everybody.org>
+
+       * url-parse.el (url-user-for-url, url-password-for-url):
+       Convenience functions that get usernames and passwords for urls
+       from auth-source functions.
+
 2010-06-12  Štěpán Němec  <stepnem@gmail.com>  (tiny change)
 
        * url-vars.el (url-privacy-level): Fix doc typo.  (Bug#6406)
 
        * Version 23.2 released.
 
+2010-05-03  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * url-dired.el (url-dired-minor-mode): Use define-minor-mode.
+
+2010-03-24  Teodor Zlatanov  <tzz@lifelogs.com>
+
+       * url-http.el (url-http-parse-headers): Fix wrong variable name.
+
+2010-03-24  Teodor Zlatanov  <tzz@lifelogs.com>
+
+       * url-http.el (url-http-codes): New variable to hold a mapping of
+       HTTP status codes' numbers, their symbolic name, and their text.
+       (url-http-parse-headers): Use it, leaving the original numeric
+       code in a comment.
+
+2010-03-19  Glenn Morris  <rgm@gnu.org>
+
+       * url.el: Move mailcap require earlier in the file.
+
+2010-03-12  Chong Yidong  <cyd@stupidchicken.com>
+
+       * url-vars.el (url): Put in comm group.
+
+2010-03-10  Chong Yidong  <cyd@stupidchicken.com>
+
+       * Branch for 23.2.
+
 2010-01-23  Chong Yidong  <cyd@stupidchicken.com>
 
        * url-util.el: Require url-vars (Bug#5459).
@@ -56,8 +95,8 @@
 2009-09-12  Chong Yidong  <cyd@stupidchicken.com>
 
        * url-methods.el (url-scheme--registering-proxy): New variable.
-       (url-scheme-register-proxy, url-scheme-get-property): Avoid
-       calling url-scheme-register-proxy in an infloop (Bug#4191).
+       (url-scheme-register-proxy, url-scheme-get-property):
+       Avoid calling url-scheme-register-proxy in an infloop (Bug#4191).
 
 2009-08-22  Glenn Morris  <rgm@gnu.org>
 
 2008-03-09  Magnus Henoch  <mange@freemail.hu>
 
        * url-http.el (url-http-chunked-encoding-after-change-function):
-       Remove superfluous CRLF at end of file.  (bug #42)
+       Remove superfluous CRLF at end of file.  (Bug #42)
 
 2008-03-02  Andreas Schwab  <schwab@suse.de>
 
index af2f4b202d94bd4315848e89c9dfc9e389f74cc5..143c5721b34d82799c1ac42a584dd149f8012e56 100644 (file)
     map)
   "Keymap used when browsing directories.")
 
-(defvar url-dired-minor-mode nil
-  "Whether we are in url-dired-minor-mode.")
-
-(make-variable-buffer-local 'url-dired-minor-mode)
-
 (defun url-dired-find-file ()
   "In dired, visit the file or directory named on this line."
   (interactive)
   (mouse-set-point event)
   (url-dired-find-file))
 
-(defun url-dired-minor-mode (&optional arg)
+(define-minor-mode url-dired-minor-mode
   "Minor mode for directory browsing."
-  (interactive "P")
-  (cond
-   ((null arg)
-    (setq url-dired-minor-mode (not url-dired-minor-mode)))
-   ((equal 0 arg)
-    (setq url-dired-minor-mode nil))
-   (t
-    (setq url-dired-minor-mode t))))
-
-(if (not (fboundp 'add-minor-mode))
-    (defun add-minor-mode (toggle name &optional keymap after toggle-fun)
-      "Add a minor mode to `minor-mode-alist' and `minor-mode-map-alist'.
-TOGGLE is a symbol which is used as the variable which toggle the minor mode,
-NAME is the name that should appear in the modeline (it should be a string
-beginning with a space), KEYMAP is a keymap to make active when the minor
-mode is active, and AFTER is the toggling symbol used for another minor
-mode.  If AFTER is non-nil, then it is used to position the new mode in the
-minor-mode alists.  TOGGLE-FUN specifies an interactive function that
-is called to toggle the mode on and off; this affects what appens when
-button2 is pressed on the mode, and when button3 is pressed somewhere
-in the list of modes.  If TOGGLE-FUN is nil and TOGGLE names an
-interactive function, TOGGLE is used as the toggle function.
-
-Example:  (add-minor-mode 'view-minor-mode \" View\" view-mode-map)"
-      (if (not (assq toggle minor-mode-alist))
-         (setq minor-mode-alist (cons (list toggle name) minor-mode-alist)))
-      (if (and keymap (not (assq toggle minor-mode-map-alist)))
-         (setq minor-mode-map-alist (cons (cons toggle keymap)
-                                          minor-mode-map-alist)))))
-
-(add-minor-mode 'url-dired-minor-mode " URL" url-dired-minor-mode-map)
+  :lighter " URL" :keymap url-dired-minor-mode-map)
 
 (defun url-find-file-dired (dir)
   "\"Edit\" directory DIR, but with additional URL-friendly bindings."
index 00cfa46ea1872b5bb5d60c34f0b87728716195da..bd0a3de98a507eb5ab59210f11dd27e55eabc3b3 100644 (file)
@@ -64,6 +64,55 @@ This is only useful when debugging the HTTP subsystem.  Setting to
 nil will explicitly close the connection to the server after every
 request.")
 
+(defconst url-http-codes
+  '((100 continue                        "Continue with request")
+    (101 switching-protocols             "Switching protocols")
+    (102 processing                      "Processing (Added by DAV)")
+    (200 OK                              "OK")
+    (201 created                         "Created")
+    (202 accepted                        "Accepted")
+    (203 non-authoritative               "Non-authoritative information")
+    (204 no-content                      "No content")
+    (205 reset-content                   "Reset content")
+    (206 partial-content                 "Partial content")
+    (207 multi-status                    "Multi-status (Added by DAV)")
+    (300 multiple-choices                "Multiple choices")
+    (301 moved-permanently               "Moved permanently")
+    (302 found                           "Found")
+    (303 see-other                       "See other")
+    (304 not-modified                    "Not modified")
+    (305 use-proxy                       "Use proxy")
+    (307 temporary-redirect              "Temporary redirect")
+    (400 bad-request                     "Bad Request")
+    (401 unauthorized                    "Unauthorized")
+    (402 payment-required                "Payment required")
+    (403 forbidden                       "Forbidden")
+    (404 not-found                       "Not found")
+    (405 method-not-allowed              "Method not allowed")
+    (406 not-acceptable                  "Not acceptable")
+    (407 proxy-authentication-required   "Proxy authentication required")
+    (408 request-timeout                 "Request time-out")
+    (409 conflict                        "Conflict")
+    (410 gone                            "Gone")
+    (411 length-required                 "Length required")
+    (412 precondition-failed             "Precondition failed")
+    (413 request-entity-too-large        "Request entity too large")
+    (414 request-uri-too-large           "Request-URI too large")
+    (415 unsupported-media-type          "Unsupported media type")
+    (416 requested-range-not-satisfiable "Requested range not satisfiable")
+    (417 expectation-failed              "Expectation failed")
+    (422 unprocessable-entity            "Unprocessable Entity (Added by DAV)")
+    (423 locked                          "Locked")
+    (424 failed-Dependency               "Failed Dependency")
+    (500 internal-server-error           "Internal server error")
+    (501 not-implemented                 "Not implemented")
+    (502 bad-gateway                     "Bad gateway")
+    (503 service-unavailable             "Service unavailable")
+    (504 gateway-timeout                 "Gateway time-out")
+    (505 http-version-not-supported      "HTTP version not supported")
+    (507 insufficient-storage            "Insufficient storage")
+"The HTTP return codes and their text."))
+
 ;(eval-when-compile
 ;; These are all macros so that they are hidden from external sight
 ;; when the file is byte-compiled.
@@ -290,7 +339,7 @@ request.")
              ;; End request
              "\r\n"
              ;; Any data
-             url-http-data))
+             url-http-data "\r\n"))
            ""))
     (url-http-debug "Request is: \n%s" request)
     request))
@@ -436,6 +485,8 @@ should be shown to the user."
   (let ((buffer (current-buffer))
        (class nil)
        (success nil)
+       ;; other status symbols: jewelry and luxury cars
+       (status-symbol (cadr (assq url-http-response-status url-http-codes)))
        ;; The filename part of a URL could be in remote file syntax,
        ;; see Bug#6717 for an example.  We disable file name
        ;; handlers, therefore.
@@ -467,8 +518,8 @@ should be shown to the user."
        ;; 205 Reset content
        ;; 206 Partial content
        ;; 207 Multi-status (Added by DAV)
-       (case url-http-response-status
-        ((204 205)
+       (case status-symbol
+        ((no-content reset-content)
          ;; No new data, just stay at the same document
          (url-mark-buffer-as-dead buffer)
          (setq success t))
@@ -489,8 +540,8 @@ should be shown to the user."
        ;; 307 Temporary redirect
        (let ((redirect-uri (or (mail-fetch-field "Location")
                               (mail-fetch-field "URI"))))
-        (case url-http-response-status
-          (300
+        (case status-symbol
+          (multiple-choices        ; 300
            ;; Quoth the spec (section 10.3.1)
            ;; -------------------------------
            ;; The requested resource corresponds to any one of a set of
@@ -507,7 +558,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)
-          ((301 302 307)
+          ((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
@@ -523,20 +574,20 @@ should be shown to the user."
                              url-http-method url-http-response-status)
              (setq url-http-method "GET"
                    url-http-data nil)))
-          (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))
-          (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))
-          (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
@@ -624,51 +675,51 @@ should be shown to the user."
        ;; 422 Unprocessable Entity (Added by DAV)
        ;; 423 Locked
        ;; 424 Failed Dependency
-       (case url-http-response-status
-        (401
+       (case 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))
-        (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"))
-        (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))
-        (404
+        (not-found                     ; 404
          ;; Not found
          (setq success t))
-        (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))
-        (406
+        (not-acceptable                ; 406
          ;; The resource identified by the request is only capable of
          ;; generating response entities which have content
          ;; characteristics nota cceptable according to the accept
          ;; headers sent in the request.
          (setq success t))
-        (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))
-        (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))
-        (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
@@ -677,11 +728,11 @@ should be shown to the user."
          ;; information for the user to recognize the source of the
          ;; conflict.
          (setq success t))
-        (410
+        (gone                          ; 410
          ;; The requested resource is no longer available at the
          ;; server and no forwarding address is known.
          (setq success t))
-        (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
@@ -691,29 +742,29 @@ should be shown to the user."
          ;; `url-http-create-request' automatically calculates the
          ;; content-length.
          (setq success t))
-        (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))
-        ((413 414)
+        ((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))
-        (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))
-        (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))
-        (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
@@ -740,16 +791,16 @@ should be shown to the user."
        ;; 507 Insufficient storage
        (setq success t)
        (case url-http-response-status
-        (501
+        (not-implemented               ; 501
          ;; The server does not support the functionality required to
          ;; fulfill the request.
          nil)
-        (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)
-        (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
@@ -758,19 +809,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)
-        (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)
-        (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)
-        (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
index e68e0791558b1ca4791f7d4e34c486c9e5884358..20432dcf7e555c1545f650ab8400375d33cce3ab 100644 (file)
@@ -25,6 +25,7 @@
 ;;; Code:
 
 (require 'url-vars)
+(require 'auth-source)
 (eval-when-compile (require 'cl))
 
 (autoload 'url-scheme-get-property "url-methods")
@@ -174,6 +175,25 @@ TYPE USER PASSWORD HOST PORTSPEC FILENAME TARGET ATTRIBUTES FULLNESS."
           (url-parse-make-urlobj
            prot user pass host port file refs attr full)))))))
 
+(defmacro url-bit-for-url (method lookfor url)
+  `(let* ((urlobj (url-generic-parse-url url))
+          (bit (funcall ,method urlobj))
+          (methods (list 'url-recreate-url
+                         'url-host)))
+     (while (and (not bit) (> (length methods) 0))
+       (setq bit
+             (auth-source-user-or-password
+              ,lookfor (funcall (pop methods) urlobj) (url-type urlobj))))
+     bit))
+
+(defun url-user-for-url (url)
+  "Attempt to use .authinfo to find a user for this URL."
+  (url-bit-for-url 'url-user "login" url))
+
+(defun url-password-for-url (url)
+  "Attempt to use .authinfo to find a password for this URL."
+  (url-bit-for-url 'url-password "password" url))
+
 (provide 'url-parse)
 
 ;; arch-tag: f338325f-71ab-4bee-93cc-78fb9a03d403
index c7df921f585b3e73509e9d9b8d73c77e16670197..65622a06e028ab7168183caf1f93f4c280ed4291 100644 (file)
@@ -30,7 +30,7 @@
 (defgroup url nil
   "Uniform Resource Locator tool."
   :version "22.1"
-  :group 'hypermedia)
+  :group 'comm)
 
 (defgroup url-file nil
   "URL storage."
index 9f47e104043b466231b6a8485f1ad60266ca6ae9..6f7b810f0ed9ba5892c55ede7067a418bca5a57a 100644 (file)
@@ -1,7 +1,7 @@
 ;;; url.el --- Uniform Resource Locator retrieval tool
 
-;; Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004,
-;;   2005, 2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
+;; Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004, 2005, 2006, 2007,
+;;   2008, 2009, 2010  Free Software Foundation, Inc.
 
 ;; Author: Bill Perry <wmperry@gnu.org>
 ;; Keywords: comm, data, processes, hypermedia
 
 (eval-when-compile (require 'cl))
 
+(require 'mailcap)
+
 (eval-when-compile
   (require 'mm-decode)
   (require 'mm-view))
 
-(require 'mailcap)
 (require 'url-vars)
 (require 'url-cookie)
 (require 'url-history)
similarity index 98%
rename from lisp/add-log.el
rename to lisp/vc/add-log.el
index ab99f6787c873abffc01b89d12c5be567c123952..23f1e33f181b60edbc00c3b59d45330a9a5b1161 100644 (file)
@@ -5,7 +5,7 @@
 ;;   Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
-;; Keywords: tools
+;; Keywords: vc tools
 
 ;; This file is part of GNU Emacs.
 
@@ -245,7 +245,7 @@ Note: The search is conducted only within 10%, at the beginning of the file."
     ;; wrongly with a non-date line existing as a random note.  In
     ;; addition, using any kind of fixed setting like this doesn't
     ;; work if a user customizes add-log-time-format.
-    ("^[0-9-]+ +\\|^\\(Sun\\|Mon\\|Tue\\|Wed\\|Thu\\|Fri\\|Sat\\) [A-z][a-z][a-z] [0-9:+ ]+"
+    ("^[0-9-]+ +\\|^ \\{11,\\}\\|^\\(Sun\\|Mon\\|Tue\\|Wed\\|Thu\\|Fri\\|Sat\\) [A-z][a-z][a-z] [0-9:+ ]+"
      (0 'change-log-date-face)
      ;; Name and e-mail; some people put e-mail in parens, not angles.
      ("\\([^<(]+?\\)[ \t]*[(<]\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)[>)]" nil nil
@@ -755,7 +755,17 @@ Optional arg BUFFER-FILE overrides `buffer-file-name'."
     (if add-log-file-name-function
        (funcall add-log-file-name-function buffer-file)
       (setq buffer-file
-            (file-relative-name buffer-file (file-name-directory log-file)))
+            (let* ((dir (file-name-directory log-file))
+                   (rel (file-relative-name buffer-file dir)))
+              ;; Sometimes with symlinks, the two buffers may have names that
+              ;; appear to belong to different directory trees.  So check the
+              ;; file-truenames, to see if we get a better result.
+              (if (not (string-match "\\`\\.\\./" rel))
+                  rel
+                (let ((new (file-relative-name (file-truename buffer-file)
+                                               (file-truename dir))))
+                  (if (< (length new) (length rel))
+                      new rel)))))
       ;; If we have a backup file, it's presumably because we're
       ;; comparing old and new versions (e.g. for deleted
       ;; functions) and we'll want to use the original name.
similarity index 99%
rename from lisp/compare-w.el
rename to lisp/vc/compare-w.el
index 866c6e3e4f897f0651e6d7cccc27332facb75c96..6e2ab7327defeecc69caed633803cc5eed4a40b0 100644 (file)
@@ -4,7 +4,7 @@
 ;;   2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
-;; Keywords: convenience files
+;; Keywords: convenience files vc
 
 ;; This file is part of GNU Emacs.
 
similarity index 98%
rename from lisp/cvs-status.el
rename to lisp/vc/cvs-status.el
index 1cc9ca9d7135f7c6c2ef050b6c844ec242a611bb..b0e66c055acc1f7b909fdd165977c981c2993dd2 100644 (file)
@@ -4,7 +4,7 @@
 ;;   2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
-;; Keywords: pcl-cvs cvs status tree tools
+;; Keywords: pcl-cvs cvs status tree vc tools
 
 ;; This file is part of GNU Emacs.
 
@@ -356,11 +356,11 @@ the list is a three-string list TAG, KIND, REV."
       tags)))
 
 (defvar font-lock-mode)
-(defun cvs-refontify (beg end)
-  (when (and (boundp 'font-lock-mode)
-            font-lock-mode
-            (fboundp 'font-lock-fontify-region))
-    (font-lock-fontify-region (1- beg) (1+ end))))
+;; (defun cvs-refontify (beg end)
+;;   (when (and (boundp 'font-lock-mode)
+;;          font-lock-mode
+;;          (fboundp 'font-lock-fontify-region))
+;;     (font-lock-fontify-region (1- beg) (1+ end))))
 
 (defun cvs-status-trees ()
   "Look for a lists of tags, and replace them with trees."
similarity index 99%
rename from lisp/diff-mode.el
rename to lisp/vc/diff-mode.el
index 27f8318f91c6e81d6fb1f1b2acfb0489d21efad6..cec4fb24616c59d062e83ee0ccd154f44cc744d6 100644 (file)
@@ -4,7 +4,7 @@
 ;;   2007, 2008, 2009, 2010  Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
-;; Keywords: convenience patch diff
+;; Keywords: convenience patch diff vc
 
 ;; This file is part of GNU Emacs.
 
@@ -97,6 +97,9 @@ when editing big diffs)."
   :options '(diff-delete-empty-files diff-make-unified)
   :group 'diff-mode)
 
+(defvar diff-vc-backend nil
+  "The VC backend that created the current Diff buffer, if any.")
+
 (defvar diff-outline-regexp
   "\\([*+][*+][*+] [^0-9]\\|@@ ...\\|\\*\\*\\* [0-9].\\|--- [0-9]..\\)")
 
@@ -138,6 +141,7 @@ when editing big diffs)."
     ;; Standard M-r is useful, so don't change M-r or M-R.
     ;;("r" . diff-restrict-view)
     ;;("R" . diff-reverse-direction)
+    ("g" . revert-buffer)
     ("q" . quit-window))
   "Basic keymap for `diff-mode', bound to various prefix keys.")
 
@@ -1287,7 +1291,9 @@ a diff with \\[diff-reverse-direction].
   (set (make-local-variable 'add-log-current-defun-function)
        'diff-current-defun)
   (set (make-local-variable 'add-log-buffer-file-name-function)
-       (lambda () (diff-find-file-name nil 'noprompt))))
+       (lambda () (diff-find-file-name nil 'noprompt)))
+  (unless (buffer-file-name)
+    (hack-dir-local-variables-non-file-buffer)))
 
 ;;;###autoload
 (define-minor-mode diff-minor-mode
similarity index 99%
rename from lisp/diff.el
rename to lisp/vc/diff.el
index 0206c17e770365411d35682f32b0059a9bae94b1..e79e72c8b0d62f78ac0c06bae4bf7142cd78b36a 100644 (file)
@@ -6,7 +6,7 @@
 ;; Author: Frank Bresz
 ;; (according to authors.el)
 ;; Maintainer: FSF
-;; Keywords: unix, tools
+;; Keywords: unix, vc, tools
 
 ;; This file is part of GNU Emacs.
 
similarity index 99%
rename from lisp/ediff-diff.el
rename to lisp/vc/ediff-diff.el
index 5695b058d27eeeedfdd9aab6d79be2a660281f9e..4316b6e4d93a0adc831711e50e4e7db54d2cdf11 100644 (file)
@@ -4,6 +4,7 @@
 ;;   2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
+;; Package: ediff
 
 ;; This file is part of GNU Emacs.
 
similarity index 99%
rename from lisp/ediff-help.el
rename to lisp/vc/ediff-help.el
index d9ca687e6b065eaa723091ed542319d93873d27f..06a600f0af4fbbb7887fb29f3d278e12b3caf77c 100644 (file)
@@ -4,6 +4,7 @@
 ;;   2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
+;; Package: ediff
 
 ;; This file is part of GNU Emacs.
 
similarity index 99%
rename from lisp/ediff-hook.el
rename to lisp/vc/ediff-hook.el
index 390538ed009f87f8d2e540bd290223ee96556584..e917d29a7b4d9cfe088ba0b00fe4a8b6abc3ed7d 100644 (file)
@@ -4,6 +4,7 @@
 ;;   2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
+;; Package: ediff
 
 ;; This file is part of GNU Emacs.
 
similarity index 99%
rename from lisp/ediff-init.el
rename to lisp/vc/ediff-init.el
index 0ea1e8c02f621e8d72a407968a3402aba84a738e..d1b40f7ee58670ec9b38bf02f25df7683663293f 100644 (file)
@@ -4,6 +4,7 @@
 ;;   2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
+;; Package: ediff
 
 ;; This file is part of GNU Emacs.
 
similarity index 99%
rename from lisp/ediff-merg.el
rename to lisp/vc/ediff-merg.el
index c4b94a02e0c1d31b88e365c86d907ab98db6149d..4c6aee15d1d7ff77b1a8a4427df7ddd611483854 100644 (file)
@@ -4,6 +4,7 @@
 ;;   2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
+;; Package: ediff
 
 ;; This file is part of GNU Emacs.
 
similarity index 99%
rename from lisp/ediff-mult.el
rename to lisp/vc/ediff-mult.el
index a2c1043049d7a342612a10b4f4d504687784f4c1..39bd06fbd9726567c6979e9a12e3fcc19173de26 100644 (file)
@@ -4,6 +4,7 @@
 ;;   2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
+;; Package: ediff
 
 ;; This file is part of GNU Emacs.
 
similarity index 99%
rename from lisp/ediff-ptch.el
rename to lisp/vc/ediff-ptch.el
index 1203747fdb7ec08ed238dd4b57d61d3e98d5e7df..b6c7f6ab7ba46992ed9bf7bcd98ef1d2cd2233dd 100644 (file)
@@ -4,6 +4,7 @@
 ;;   2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
+;; Package: ediff
 
 ;; This file is part of GNU Emacs.
 
similarity index 99%
rename from lisp/ediff-util.el
rename to lisp/vc/ediff-util.el
index 77284a19f5099815b255041b8fa0af9dfb6f8eb6..e1589e3deb483d846519de959313c18aef96cd2c 100644 (file)
@@ -4,6 +4,7 @@
 ;;   2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
+;; Package: ediff
 
 ;; This file is part of GNU Emacs.
 
similarity index 99%
rename from lisp/ediff-vers.el
rename to lisp/vc/ediff-vers.el
index e314afc24b5e31dfa13c06f974cd304e72e0092b..581aad3e4dc4ec69d783f193b9889dbdcd3e7ccb 100644 (file)
@@ -4,6 +4,7 @@
 ;;   2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
+;; Package: ediff
 
 ;; This file is part of GNU Emacs.
 
similarity index 99%
rename from lisp/ediff-wind.el
rename to lisp/vc/ediff-wind.el
index 61213c039c088f63b66948d2677dbcf1d98b29fa..8b16c5a4a121b6e4f417f4d17318ea6248679b86 100644 (file)
@@ -4,6 +4,7 @@
 ;;   2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
+;; Package: ediff
 
 ;; This file is part of GNU Emacs.
 
similarity index 99%
rename from lisp/ediff.el
rename to lisp/vc/ediff.el
index 97dc537cd7e3ed9ed4de05fa21ae4e2322b66a60..c41a6e4a1afc4ccb3b237be76562dd98a120557e 100644 (file)
@@ -5,7 +5,8 @@
 
 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
 ;; Created: February 2, 1994
-;; Keywords: comparing, merging, patching, tools, unix
+;; Keywords: comparing, merging, patching, vc, tools, unix
+;; Version: 2.81.4
 
 ;; Yoni Rabkin <yoni@rabkins.net> contacted the maintainer of this
 ;; file on 20/3/2008, and the maintainer agreed that when a bug is
similarity index 99%
rename from lisp/emerge.el
rename to lisp/vc/emerge.el
index 997077aa08f16c7de20c5510b9c8a73e5acf0694..4946df6dcd3ebd9cb76a942f13f0adb821458302 100644 (file)
@@ -5,7 +5,7 @@
 ;; This file is part of GNU Emacs.
 
 ;; Author: Dale R. Worley <worley@world.std.com>
-;; Keywords: unix, tools
+;; Keywords: unix, vc, tools
 
 ;; This software was created by Dale R. Worley and is
 ;; distributed free of charge.  It is placed in the public domain and
similarity index 80%
rename from lisp/log-edit.el
rename to lisp/vc/log-edit.el
index 10c6d480d238be04d4385e76fc76844344ca84cc..27290eeec8aae5f213b8daacc19ca6ddc2447a74 100644 (file)
@@ -4,7 +4,7 @@
 ;;   2008, 2009, 2010  Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
-;; Keywords: pcl-cvs cvs commit log
+;; Keywords: pcl-cvs cvs commit log vc
 
 ;; This file is part of GNU Emacs.
 
@@ -125,6 +125,7 @@ If SETUP is 'force, this variable has no effect."
   :type 'boolean)
 
 (defcustom log-edit-hook '(log-edit-insert-cvs-template
+                           log-edit-show-files
                           log-edit-insert-changelog)
   "Hook run at the end of `log-edit'."
   :group 'log-edit
@@ -148,12 +149,12 @@ can be obtained from `log-edit-files'."
   :type '(hook :options (log-edit-set-common-indentation
                         log-edit-add-to-changelog)))
 
-(defcustom log-edit-strip-single-file-name t
+(defcustom log-edit-strip-single-file-name nil
   "If non-nil, remove file name from single-file log entries."
   :type 'boolean
   :safe 'booleanp
   :group 'log-edit
-  :version "23.2")
+  :version "24.1")
 
 (defvar cvs-changelog-full-paragraphs t)
 (make-obsolete-variable 'cvs-changelog-full-paragraphs
@@ -188,6 +189,7 @@ when this variable is set to nil.")
 (defvar log-edit-callback nil)
 (defvar log-edit-diff-function nil)
 (defvar log-edit-listfun nil)
+
 (defvar log-edit-parent-buffer nil)
 
 ;;; Originally taken from VC-Log mode
@@ -312,15 +314,59 @@ automatically."
 ;;; Actual code
 ;;;
 
+(defface log-edit-summary '((t :inherit font-lock-function-name-face))
+  "Face for the summary in `log-edit-mode' buffers.")
+
+(defface log-edit-header '((t :inherit font-lock-keyword-face))
+  "Face for the headers in `log-edit-mode' buffers.")
+
+(defface log-edit-unknown-header '((t :inherit font-lock-comment-face))
+  "Face for unknown headers in `log-edit-mode' buffers.")
+
+(defvar log-edit-headers-alist '(("Summary" . log-edit-summary)
+                                 ("Fixes") ("Author"))
+  "AList of known headers and the face to use to highlight them.")
+
+(defconst log-edit-header-contents-regexp
+  "[ \t]*\\(.*\\(\n[ \t].*\\)*\\)\n?")
+
+(defun log-edit-match-to-eoh (limit)
+  ;; FIXME: copied from message-match-to-eoh.
+  (let ((start (point)))
+    (rfc822-goto-eoh)
+    ;; Typical situation: some temporary change causes the header to be
+    ;; incorrect, so EOH comes earlier than intended: the last lines of the
+    ;; intended headers are now not considered part of the header any more,
+    ;; so they don't have the multiline property set.  When the change is
+    ;; completed and the header has its correct shape again, the lack of the
+    ;; multiline property means we won't rehighlight the last lines of
+    ;; the header.
+    (if (< (point) start)
+        nil                             ;No header within start..limit.
+      ;; Here we disregard LIMIT so that we may extend the area again.
+      (set-match-data (list start (point)))
+      (point))))
+
 (defvar log-edit-font-lock-keywords
-  '(("\\`\\(Summary:\\)\\(.*\\)"
-     (1 font-lock-keyword-face)
-     (2 font-lock-function-name-face))))
+  ;; Copied/inspired by message-font-lock-keywords.
+  `((log-edit-match-to-eoh
+     (,(concat "^\\(\\([a-z]+\\):\\)" 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
+           'log-edit-unknown-header)
+         nil lax)
+      (3 (or (cdr (assoc (match-string 2) log-edit-headers-alist))
+             'log-edit-header)
+         nil lax)
+      (4 font-lock-warning-face)))))
 
 ;;;###autoload
-(defun log-edit (callback &optional setup params buffer &rest ignore)
+(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 `log-edit-mode'.
+\\<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].
@@ -340,8 +386,13 @@ uses the current buffer."
     (if buffer (pop-to-buffer buffer))
     (when (and log-edit-setup-invert (not (eq setup 'force)))
       (setq setup (not setup)))
-    (when setup (erase-buffer))
-    (log-edit-mode)
+    (when setup
+      (erase-buffer)
+      (insert "Summary: ")
+      (save-excursion (insert "\n\n")))
+    (if mode
+       (funcall mode)
+      (log-edit-mode))
     (set (make-local-variable 'log-edit-callback) callback)
     (if (listp params)
        (dolist (crt params)
@@ -367,8 +418,9 @@ 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))
-  (make-local-variable 'log-edit-comment-ring-index))
+       '(log-edit-font-lock-keywords t t))
+  (make-local-variable 'log-edit-comment-ring-index)
+  (hack-dir-local-variables-non-file-buffer))
 
 (defun log-edit-hide-buf (&optional buf where)
   (when (setq buf (get-buffer (or buf log-edit-files-buf)))
@@ -380,6 +432,17 @@ commands (under C-x v for VC, for example).
   "Finish editing the log message and commit the files.
 If you want to abort the commit, simply delete the buffer."
   (interactive)
+  ;; Clean up empty headers.
+  (goto-char (point-min))
+  (while (looking-at (concat "^[a-z]*:" log-edit-header-contents-regexp))
+    (let ((beg (match-beginning 0)))
+      (goto-char (match-end 0))
+      (if (string-match "\\`[ \n\t]*\\'" (match-string 1))
+          (delete-region beg (point)))))
+  ;; Get rid of leading empty lines.
+  (goto-char (point-min))
+  (when (looking-at "\\([ \t]*\n\\)+")
+    (delete-region (match-beginning 0) (match-end 0)))
   ;; Get rid of trailing empty lines
   (goto-char (point-max))
   (skip-syntax-backward " ")
@@ -437,12 +500,13 @@ If you want to abort the commit, simply delete the buffer."
   "(Un)Indent the current buffer rigidly to `log-edit-common-indent'."
   (save-excursion
     (let ((common (point-max)))
-      (goto-char (point-min))
+      (rfc822-goto-eoh)
       (while (< (point) (point-max))
         (if (not (looking-at "^[ \t]*$"))
             (setq common (min common (current-indentation))))
         (forward-line 1))
-      (indent-rigidly (point-min) (point-max)
+      (rfc822-goto-eoh)
+      (indent-rigidly (point) (point-max)
                      (- log-edit-common-indent common)))))
 
 (defun log-edit-show-diff ()
@@ -525,6 +589,10 @@ If the optional prefix arg USE-FIRST is given (via \\[universal-argument]),
 or if the command is repeated a second time in a row, use the first log entry
 regardless of user name or time."
   (interactive "P")
+  (let ((eoh (save-excursion (rfc822-goto-eoh) (point))))
+    (when (<= (point) eoh)
+      (goto-char eoh)
+      (if (looking-at "\n") (forward-char 1))))
   (let ((log-edit-changelog-use-first
         (or use-first (eq last-command 'log-edit-insert-changelog))))
     (log-edit-insert-changelog-entries (log-edit-files)))
@@ -623,7 +691,7 @@ Return non-nil if it is."
 (defun log-edit-changelog-entries (file)
   "Return the ChangeLog entries for FILE, and the ChangeLog they came from.
 The return value looks like this:
-  (LOGBUFFER (ENTRYSTART ENTRYEND) ...)
+  (LOGBUFFER (ENTRYSTART ENTRYEND) ...)
 where LOGBUFFER is the name of the ChangeLog buffer, and each
 \(ENTRYSTART . ENTRYEND\) pair is a buffer region."
   (let ((changelog-file-name
@@ -681,34 +749,85 @@ where LOGBUFFER is the name of the ChangeLog buffer, and each
 
              (cons (current-buffer) texts))))))))
 
-(defun log-edit-changelog-insert-entries (buffer regions)
-  "Insert those regions in BUFFER specified in REGIONS.
-Sort REGIONS front-to-back first."
-  (let ((regions (sort regions 'car-less-than-car))
-        (last))
-    (dolist (region regions)
-      (when (and last (< last (car region))) (newline))
-      (setq last (elt region 1))
-      (apply 'insert-buffer-substring buffer region))))
+(defun log-edit-changelog-insert-entries (buffer beg end &rest files)
+  "Insert the text from BUFFER between BEG and END.
+Rename relative filenames in the ChangeLog entry as FILES."
+  (let ((opoint (point))
+       (log-name (buffer-file-name buffer))
+       (case-fold-search nil)
+       bound)
+    (insert-buffer-substring buffer beg end)
+    (setq bound (point-marker))
+    (when log-name
+      (dolist (f files)
+       (save-excursion
+         (goto-char opoint)
+         (when (re-search-forward
+                (concat "\\(^\\|[ \t]\\)\\("
+                        (file-relative-name f (file-name-directory log-name))
+                        "\\)[, :\n]")
+                bound t)
+           (replace-match f t t nil 2)))))
+    ;; Eliminate tabs at the beginning of the line.
+    (save-excursion
+      (goto-char opoint)
+      (while (re-search-forward "^\\(\t+\\)" bound t)
+       (replace-match "")))))
 
 (defun log-edit-insert-changelog-entries (files)
   "Given a list of files FILES, insert the ChangeLog entries for them."
-  (let ((buffer-entries nil))
-
-    ;; Add each buffer to buffer-entries, and associate it with the list
-    ;; of entries we want from that file.
+  (let ((log-entries nil))
+    ;; Note that any ChangeLog entry can apply to more than one file.
+    ;; Here we construct a log-entries list with elements of the form
+    ;;   ((LOGBUFFER ENTRYSTART ENTRYEND) FILE1 FILE2...)
     (dolist (file files)
       (let* ((entries (log-edit-changelog-entries file))
-             (pair (assq (car entries) buffer-entries)))
-        (if pair
-            (setcdr pair (cvs-union (cdr pair) (cdr entries)))
-          (push entries buffer-entries))))
-
-    ;; Now map over each buffer in buffer-entries, sort the entries for
-    ;; each buffer, and extract them as strings.
-    (dolist (buffer-entry buffer-entries)
-      (log-edit-changelog-insert-entries (car buffer-entry) (cdr buffer-entry))
-      (when (cdr buffer-entry) (newline)))))
+            (buf (car entries))
+            key entry)
+       (dolist (region (cdr entries))
+         (setq key (cons buf region))
+         (if (setq entry (assoc key log-entries))
+             (setcdr entry (append (cdr entry) (list file)))
+           (push (list key file) log-entries)))))
+    ;; Now map over log-entries, and extract the strings.
+    (dolist (log-entry (nreverse log-entries))
+      (apply 'log-edit-changelog-insert-entries
+            (append (car log-entry) (cdr log-entry)))
+      (insert "\n"))))
+
+(defun log-edit-extract-headers (headers comment)
+  "Extract headers from COMMENT to form command line arguments.
+HEADERS should be an alist with elements of the form (HEADER . CMDARG)
+associating header names to the corresponding cmdline option name and the
+result is then a list of the form (MSG CMDARG1 HDRTEXT1 CMDARG2 HDRTEXT2...).
+where MSG is the remaining text from STRING.
+If \"Summary\" is not in HEADERS, then the \"Summary\" header is extracted
+anyway and put back as the first line of MSG."
+  (with-temp-buffer
+    (insert comment)
+    (rfc822-goto-eoh)
+    (narrow-to-region (point-min) (point))
+    (let ((case-fold-search t)
+          (summary ())
+          (res ()))
+      (dolist (header (if (assoc "Summary" headers) headers
+                        (cons '("Summary" . t) headers)))
+        (goto-char (point-min))
+        (while (re-search-forward (concat "^" (car header)
+                                          ":" log-edit-header-contents-regexp)
+                                  nil t)
+          (if (eq t (cdr header))
+              (setq summary (match-string 1))
+            (push (match-string 1) res)
+            (push (or (cdr header) (car header)) res))
+          (replace-match "" t t)))
+      ;; Remove header separator if the header is empty.
+      (widen)
+      (goto-char (point-min))
+      (when (looking-at "\\([ \t]*\n\\)+")
+        (delete-region (match-beginning 0) (match-end 0)))
+      (if summary (insert summary "\n"))
+      (cons (buffer-string) res))))
 
 (provide 'log-edit)
 
similarity index 99%
rename from lisp/log-view.el
rename to lisp/vc/log-view.el
index 6fbe84296719e14a5233338422f5d985f704811f..3805df2f00b856e9824c7b58d12d38e9ccda6d1f 100644 (file)
@@ -4,7 +4,7 @@
 ;;   2008, 2009, 2010  Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
-;; Keywords: rcs sccs cvs log version-control tools
+;; Keywords: rcs, sccs, cvs, log, vc, tools
 
 ;; This file is part of GNU Emacs.
 
@@ -255,7 +255,8 @@ The match group number 1 should match the revision number itself.")
        'log-view-beginning-of-defun)
   (set (make-local-variable 'end-of-defun-function)
        'log-view-end-of-defun)
-  (set (make-local-variable 'cvs-minor-wrap-function) 'log-view-minor-wrap))
+  (set (make-local-variable 'cvs-minor-wrap-function) 'log-view-minor-wrap)
+  (hack-dir-local-variables-non-file-buffer))
 
 ;;;;
 ;;;; Navigation
similarity index 99%
rename from lisp/pcvs-defs.el
rename to lisp/vc/pcvs-defs.el
index a49cd2f1ab1c08bba2bf46d2ee56b903a41a485c..7dda4533f6eda34888b34d19722cf1a7f32c9ffe 100644 (file)
@@ -6,6 +6,7 @@
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 ;; Keywords: pcl-cvs
+;; Package: pcvs
 
 ;; This file is part of GNU Emacs.
 
similarity index 99%
rename from lisp/pcvs-info.el
rename to lisp/vc/pcvs-info.el
index 198b3dd057df75585e36ea3bdc6a6862f60d93fe..1ae924ff1770059e9f919e0cca676fc340225fd0 100644 (file)
@@ -6,6 +6,7 @@
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 ;; Keywords: pcl-cvs
+;; Package: pcvs
 
 ;; This file is part of GNU Emacs.
 
similarity index 99%
rename from lisp/pcvs-parse.el
rename to lisp/vc/pcvs-parse.el
index deb11936c86946dc5542d5396af1209bbfb496c2..560a270a7313c7d93a3648b6bd02752ce89c18d4 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 ;; Keywords: pcl-cvs
+;; Package: pcvs
 
 ;; This file is part of GNU Emacs.
 
similarity index 99%
rename from lisp/pcvs-util.el
rename to lisp/vc/pcvs-util.el
index 26f4a829a5fd06c8fa7a35ac7d146cb786c9321c..595b762b2fa9be1ba554ae735a394e8e3a0e9f18 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 ;; Keywords: pcl-cvs
+;; Package: pcvs
 
 ;; This file is part of GNU Emacs.
 
similarity index 99%
rename from lisp/pcvs.el
rename to lisp/vc/pcvs.el
index 28c24847b4d55bb139273920c149c303376fbae9..305e109b6d6e217fd779cbd033b9a9cae1eb377c 100644 (file)
@@ -13,7 +13,7 @@
 ;;     (Greg Klanderman) greg@alphatech.com
 ;;     (Jari Aalto+mail.emacs) jari.aalto@poboxes.com
 ;; Maintainer: (Stefan Monnier) monnier@gnu.org
-;; Keywords: CVS, version control, release management
+;; Keywords: CVS, vc, release management
 
 ;; This file is part of GNU Emacs.
 
similarity index 98%
rename from lisp/smerge-mode.el
rename to lisp/vc/smerge-mode.el
index 732f7d19cf9d385d41230927afce34ed06a28340..6e72071b6a0b37d3e9128b00276245841bb35703 100644 (file)
@@ -4,7 +4,7 @@
 ;;   2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
-;; Keywords: tools revision-control merge diff3 cvs conflict
+;; Keywords: vc, tools, revision control, merge, diff3, cvs, conflict
 
 ;; This file is part of GNU Emacs.
 
@@ -457,8 +457,8 @@ BUF contains a plain diff between match-1 and match-3."
 
 (defun smerge-resolve (&optional safe)
   "Resolve the conflict at point intelligently.
-This relies on mode-specific knowledge and thus only works in
-some major modes.  Uses `smerge-resolve-function' to do the actual work."
+This relies on mode-specific knowledge and thus only works in some
+major modes.  Uses `smerge-resolve-function' to do the actual work."
   (interactive)
   (smerge-match-conflict)
   (smerge-remove-props (match-beginning 0) (match-end 0))
@@ -815,12 +815,12 @@ Its behavior has mainly two restrictions:
   This only matters if `smerge-refine-weight-hack' is nil.")
 
 (defvar smerge-refine-ignore-whitespace t
-  "If non-nil,Indicate that smerge-refine should try to ignore change in whitespace.")
+  "If non-nil, indicate that `smerge-refine' should try to ignore change in whitespace.")
 
 (defvar smerge-refine-weight-hack t
   "If non-nil, pass to diff as many lines as there are chars in the region.
 I.e. each atomic element (e.g. word) will be copied as many times (on different
-lines) as it has chars.  This has 2 advantages:
+lines) as it has chars.  This has two advantages:
 - if `diff' tries to minimize the number *lines* (rather than chars)
   added/removed, this adjust the weights so that adding/removing long
   symbols is considered correspondingly more costly.
@@ -919,8 +919,8 @@ chars to try and eliminate some spurious differences."
   "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.
 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."
+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."
   (let* ((buf (current-buffer))
          (pos (point))
          (file1 (make-temp-file "diff1"))
@@ -988,9 +988,9 @@ replace chars to try and eliminate some spurious differences."
 
 (defun smerge-refine (&optional part)
   "Highlight the words of the conflict that are different.
-For 3-way conflicts, highlights only 2 of the 3 parts.
-A numeric argument PART can be used to specify which 2 parts;
-repeating the command will highlight other 2 parts."
+For 3-way conflicts, highlights only two of the three parts.
+A numeric argument PART can be used to specify which two parts;
+repeating the command will highlight other two parts."
   (interactive
    (if (integerp current-prefix-arg) (list current-prefix-arg)
      (smerge-match-conflict)
@@ -1161,7 +1161,7 @@ buffer names."
 
 (defun smerge-makeup-conflict (pt1 pt2 pt3 &optional pt4)
   "Insert diff3 markers to make a new conflict.
-Uses point and mark for 2 of the relevant positions and previous marks
+Uses point and mark for two of the relevant positions and previous marks
 for the other ones.
 By default, makes up a 2-way conflict,
 with a \\[universal-argument] prefix, makes up a 3-way conflict."
@@ -1184,7 +1184,7 @@ with a \\[universal-argument] prefix, makes up a 3-way conflict."
     (insert "<<<<<<< MINE\n"))
   (if smerge-mode nil (smerge-mode 1))
   (smerge-refine))
-      
+
 
 (defconst smerge-parsep-re
   (concat smerge-begin-re "\\|" smerge-end-re "\\|"
similarity index 99%
rename from lisp/vc-annotate.el
rename to lisp/vc/vc-annotate.el
index da2f5de80df66624b24c9b836acad3728b7906ce..10b88e6f14c0b56412b9b6a864e2817aeb0c7e6d 100644 (file)
@@ -5,7 +5,8 @@
 
 ;; Author:     Martin Lorentzson  <emwson@emw.ericsson.se>
 ;; Maintainer: FSF
-;; Keywords: tools
+;; Keywords: vc tools
+;; Package: vc
 
 ;; This file is part of GNU Emacs.
 
@@ -162,7 +163,8 @@ menu items."
   (remove-from-invisibility-spec 'foo)
   (set (make-local-variable 'truncate-lines) t)
   (set (make-local-variable 'font-lock-defaults)
-       '(vc-annotate-font-lock-keywords t)))
+       '(vc-annotate-font-lock-keywords t))
+  (hack-dir-local-variables-non-file-buffer))
 
 (defun vc-annotate-toggle-annotation-visibility ()
   "Toggle whether or not the annotation is visible."
similarity index 99%
rename from lisp/vc-arch.el
rename to lisp/vc/vc-arch.el
index b99c3de687520c9ca6571122354400b3b85cf7b9..3ca9d59e3c1f273eb44b5f375cdec2bb5c4c2041 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Author:      FSF (see vc.el for full credits)
 ;; Maintainer:  Stefan Monnier <monnier@gnu.org>
+;; Package: vc
 
 ;; This file is part of GNU Emacs.
 
@@ -254,8 +255,7 @@ Only the value `maybe' can be trusted :-(."
               (buffer-substring (point-min) (1- (point-max)))))))))
 
 (defun vc-arch-workfile-unchanged-p (file)
-  "Check if FILE is unchanged by diffing against the master version.
-Return non-nil if FILE is unchanged."
+  "Stub: arch workfiles are always considered to be in a changed state,"
   nil)
 
 (defun vc-arch-state (file)
@@ -428,7 +428,7 @@ CALLBACK expects (ENTRIES &optional MORE-TO-COME); see
        (message "There are unresolved conflicts in %s"
                 (file-name-nondirectory rej))))))
 
-(defun vc-arch-checkin (files rev comment)
+(defun vc-arch-checkin (files rev comment  &optional extra-args-ignored)
   (if rev (error "Committing to a specific revision is unsupported"))
   ;; FIXME: This implementation probably only works for singleton filesets
   (let ((summary (file-relative-name (car files) (vc-arch-root (car files)))))
similarity index 92%
rename from lisp/vc-bzr.el
rename to lisp/vc/vc-bzr.el
index 8396547bdcbd5b998da94022188fd6ed3d139078..78441772bd470be089a8c151d810fdc4e42d66d9 100644 (file)
@@ -4,10 +4,11 @@
 
 ;; Author: Dave Love <fx@gnu.org>
 ;;        Riccardo Murri <riccardo.murri@gmail.com>
-;; Keywords: tools
+;; Keywords: vc tools
 ;; Created: Sept 2006
-;; Version: 2008-01-04 (Bzr revno 25)
+;; Version: 2008-01-04
 ;; URL: http://launchpad.net/vc-bzr
+;; Package: vc
 
 ;; This file is part of GNU Emacs.
 
@@ -451,11 +452,17 @@ or a superior directory.")
   "Unregister FILE from bzr."
   (vc-bzr-command "remove" nil 0 file "--keep"))
 
+(declare-function log-edit-extract-headers "log-edit" (headers string))
+
 (defun vc-bzr-checkin (files rev comment)
   "Check FILE in to bzr with log message COMMENT.
 REV non-nil gets an error."
   (if rev (error "Can't check in a specific revision with bzr"))
-  (vc-bzr-command "commit" nil 0 files "-m" comment))
+  (apply 'vc-bzr-command "commit" nil 0
+         files (cons "-m" (log-edit-extract-headers '(("Author" . "--author")
+                                                     ("Date" . "--commit-time")
+                                                      ("Fixes" . "--fixes"))
+                                                    comment))))
 
 (defun vc-bzr-find-revision (file rev buffer)
   "Fetch revision REV of file FILE and put it into BUFFER."
@@ -478,7 +485,6 @@ REV non-nil gets an error."
 (defvar log-view-font-lock-keywords)
 (defvar log-view-current-tag-function)
 (defvar log-view-per-file-logs)
-(defvar vc-short-log)
 
 (define-derived-mode vc-bzr-log-view-mode log-view-mode "Bzr-Log-View"
   (remove-hook 'log-view-mode-hook 'vc-bzr-log-view-mode) ;Deactivate the hack.
@@ -486,13 +492,13 @@ REV non-nil gets an error."
   (set (make-local-variable 'log-view-per-file-logs) nil)
   (set (make-local-variable 'log-view-file-re) "\\`a\\`")
   (set (make-local-variable 'log-view-message-re)
-       (if vc-short-log
+       (if (eq vc-log-view-type 'short)
           "^ *\\([0-9.]+\\): \\(.*?\\)[ \t]+\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}\\)\\( \\[merge\\]\\)?"
         "^ *\\(?:revno: \\([0-9.]+\\)\\|merged: .+\\)"))
   (set (make-local-variable 'log-view-font-lock-keywords)
        ;; log-view-font-lock-keywords is careful to use the buffer-local
        ;; value of log-view-message-re only since Emacs-23.
-       (if vc-short-log
+       (if (eq vc-log-view-type 'short)
         (append `((,log-view-message-re
                    (1 'log-view-message-face)
                    (2 'change-log-name)
@@ -526,6 +532,14 @@ REV non-nil gets an error."
                (list vc-bzr-log-switches)
              vc-bzr-log-switches)))))
 
+(defun vc-bzr-log-incoming (buffer remote-location)
+  (apply 'vc-bzr-command "missing" buffer 'async nil
+        (list "--theirs-only" (unless (string= remote-location "") remote-location))))
+
+(defun vc-bzr-log-outgoing (buffer remote-location)
+  (apply 'vc-bzr-command "missing" buffer 'async nil
+        (list "--mine-only" (unless (string= remote-location "") remote-location))))
+
 (defun vc-bzr-show-log-entry (revision)
   "Find entry for patch name REVISION in bzr change log buffer."
   (goto-char (point-min))
@@ -758,9 +772,11 @@ stream.  Standard error output is discarded."
 
     (define-key map [down-mouse-3] 'vc-bzr-shelve-menu)
     (define-key map "\C-k" 'vc-bzr-shelve-delete-at-point)
-    ;; (define-key map "=" 'vc-bzr-shelve-show-at-point)
-    ;; (define-key map "\C-m" 'vc-bzr-shelve-show-at-point)
+    (define-key map "=" 'vc-bzr-shelve-show-at-point)
+    (define-key map "\C-m" 'vc-bzr-shelve-show-at-point)
+    (define-key map "A" 'vc-bzr-shelve-apply-and-keep-at-point)
     (define-key map "P" 'vc-bzr-shelve-apply-at-point)
+    (define-key map "S" 'vc-bzr-shelve-snapshot)
     map))
 
 (defvar vc-bzr-shelve-menu-map
@@ -768,16 +784,22 @@ stream.  Standard error output is discarded."
     (define-key map [de]
       '(menu-item "Delete shelf" vc-bzr-shelve-delete-at-point
                  :help "Delete the current shelf"))
+    (define-key map [ap]
+      '(menu-item "Apply and keep shelf" vc-bzr-shelve-apply-and-keep-at-point
+                 :help "Apply the current shelf and keep it"))
     (define-key map [po]
       '(menu-item "Apply and remove shelf (pop)" vc-bzr-shelve-apply-at-point
                  :help "Apply the current shelf and remove it"))
-    ;; (define-key map [sh]
-    ;;   '(menu-item "Show shelve" vc-bzr-shelve-show-at-point
-    ;;                   :help "Show the contents of the current shelve"))
+    (define-key map [sh]
+      '(menu-item "Show shelve" vc-bzr-shelve-show-at-point
+                 :help "Show the contents of the current shelve"))
     map))
 
 (defvar vc-bzr-extra-menu-map
   (let ((map (make-sparse-keymap)))
+    (define-key map [bzr-sn]
+      '(menu-item "Shelve a snapshot" vc-bzr-shelve-snapshot
+                 :help "Shelve the current state of the tree and keep the current state"))
     (define-key map [bzr-sh]
       '(menu-item "Shelve..." vc-bzr-shelve
                  :help "Shelve changes"))
@@ -864,21 +886,38 @@ stream.  Standard error output is discarded."
       (vc-bzr-command "shelve" nil 0 nil "--all" "-m" name)
       (vc-resynch-buffer root t t))))
 
-;; (defun vc-bzr-shelve-show (name)
-;;   "Show the contents of shelve NAME."
-;;   (interactive "sShelve name: ")
-;;   (vc-setup-buffer "*vc-bzr-shelve*")
-;;   ;; FIXME: how can you show the contents of a shelf?
-;;   (vc-bzr-command "shelve" "*vc-bzr-shelve*" 'async nil name)
-;;   (set-buffer "*vc-bzr-shelve*")
-;;   (diff-mode)
-;;   (setq buffer-read-only t)
-;;   (pop-to-buffer (current-buffer)))
+(defun vc-bzr-shelve-show (name)
+  "Show the contents of shelve NAME."
+  (interactive "sShelve name: ")
+  (vc-setup-buffer "*vc-diff*")
+  ;; FIXME: how can you show the contents of a shelf?
+  (vc-bzr-command "unshelve" "*vc-diff*" 'async nil "--preview" name)
+  (set-buffer "*vc-diff*")
+  (diff-mode)
+  (setq buffer-read-only t)
+  (pop-to-buffer (current-buffer)))
 
 (defun vc-bzr-shelve-apply (name)
   "Apply shelve NAME and remove it afterwards."
   (interactive "sApply (and remove) shelf: ")
-  (vc-bzr-command "unshelve" "*vc-bzr-shelve*" 0 nil "--apply" name)
+  (vc-bzr-command "unshelve" nil 0 nil "--apply" name)
+  (vc-resynch-buffer (vc-bzr-root default-directory) t t))
+
+(defun vc-bzr-shelve-apply-and-keep (name)
+  "Apply shelve NAME and keep it afterwards."
+  (interactive "sApply (and keep) shelf: ")
+  (vc-bzr-command "unshelve" nil 0 nil "--apply" "--keep" name)
+  (vc-resynch-buffer (vc-bzr-root default-directory) t t))
+
+(defun vc-bzr-shelve-snapshot ()
+  "Create a stash with the current tree state."
+  (interactive)
+  (vc-bzr-command "shelve" nil 0 nil "--all" "-m"
+                 (let ((ct (current-time)))
+                   (concat
+                    (format-time-string "Snapshot on %Y-%m-%d" ct)
+                    (format-time-string " at %H:%M" ct))))
+  (vc-bzr-command "unshelve" nil 0 nil "--apply" "--keep")
   (vc-resynch-buffer (vc-bzr-root default-directory) t t))
 
 (defun vc-bzr-shelve-list ()
@@ -905,14 +944,18 @@ stream.  Standard error output is discarded."
       (vc-bzr-command "unshelve" nil 0 nil "--delete-only" shelve)
       (vc-dir-refresh))))
 
-;; (defun vc-bzr-shelve-show-at-point ()
-;;   (interactive)
-;;   (vc-bzr-shelve-show (vc-bzr-shelve-get-at-point (point))))
+(defun vc-bzr-shelve-show-at-point ()
+  (interactive)
+  (vc-bzr-shelve-show (vc-bzr-shelve-get-at-point (point))))
 
 (defun vc-bzr-shelve-apply-at-point ()
   (interactive)
   (vc-bzr-shelve-apply (vc-bzr-shelve-get-at-point (point))))
 
+(defun vc-bzr-shelve-apply-and-keep-at-point ()
+  (interactive)
+  (vc-bzr-shelve-apply-and-keep (vc-bzr-shelve-get-at-point (point))))
+
 (defun vc-bzr-shelve-menu (e)
   (interactive "e")
   (vc-dir-at-event e (popup-menu vc-bzr-shelve-menu-map e)))
@@ -930,6 +973,19 @@ stream.  Standard error output is discarded."
           (setq loglines (buffer-substring-no-properties start (point-max))))))
     vc-bzr-revisions))
 
+(defun vc-bzr-conflicted-files (dir)
+  (let ((default-directory (vc-bzr-root dir))
+        (files ()))
+    (with-temp-buffer
+      (vc-bzr-command "status" t 0 default-directory)
+      (goto-char (point-min))
+      (when (re-search-forward "^conflicts:\n" nil t)
+        (while (looking-at "  \\(?:Text conflict in \\(.*\\)\\|.*\\)\n")
+          (if (match-end 1)
+              (push (expand-file-name (match-string 1)) files))
+          (goto-char (match-end 0)))))
+    files))
+
 ;;; Revision completion
 
 (eval-and-compile
similarity index 99%
rename from lisp/vc-cvs.el
rename to lisp/vc/vc-cvs.el
index 1abef9f48b8dca7ff8a2e48c2665ee15629ec42c..ad307d3a2016c04148f9191093a67890a668259b 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Author:      FSF (see vc.el for full credits)
 ;; Maintainer:  Andre Spiegel <spiegel@gnu.org>
+;; Package: vc
 
 ;; This file is part of GNU Emacs.
 
@@ -313,7 +314,7 @@ its parents."
                   (directory-file-name dir))))
     (eq dir t)))
 
-(defun vc-cvs-checkin (files rev comment)
+(defun vc-cvs-checkin (files rev comment  &optional extra-args-ignored)
   "CVS-specific version of `vc-backend-checkin'."
   (unless (or (not rev) (vc-cvs-valid-revision-number-p rev))
     (if (not (vc-cvs-valid-symbolic-tag-name-p rev))
similarity index 99%
rename from lisp/vc-dav.el
rename to lisp/vc/vc-dav.el
index 1036f34fe799438cecbf8b8cf240a7146ad3dae5..bd495eaf4b748d81ea83e2ba2ebd0a59c6e52c6e 100644 (file)
@@ -5,6 +5,7 @@
 ;; Author: Bill Perry <wmperry@gnu.org>
 ;; Maintainer: Bill Perry <wmperry@gnu.org>
 ;; Keywords: url, vc
+;; Package: vc
 
 ;; 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
similarity index 97%
rename from lisp/vc-dir.el
rename to lisp/vc/vc-dir.el
index a32e5b35e083c0c35ab0c23e7a65d851496f748b..4397251959d3d77bec3a1bde0ba774d7412639cf 100644 (file)
@@ -4,7 +4,8 @@
 ;;   Free Software Foundation, Inc.
 
 ;; Author:   Dan Nicolaescu <dann@ics.uci.edu>
-;; Keywords: tools
+;; Keywords: vc tools
+;; Package: vc
 
 ;; This file is part of GNU Emacs.
 
@@ -188,9 +189,18 @@ See `run-hooks'."
     (define-key map [diff]
       '(menu-item "Compare with Base Version" vc-diff
                  :help "Compare file set with the base version"))
+    (define-key map [logo]
+      '(menu-item "Show Outgoing Log" vc-log-outgoing
+                 :help "Show a log of changes that will be sent with a push operation"))
+    (define-key map [logi]
+      '(menu-item "Show Incoming Log" vc-log-incoming
+                 :help "Show a log of changes that will be received with a pull operation"))
     (define-key map [log]
-     '(menu-item "Show history" vc-print-log
-     :help "List the change log of the current file set in a window"))
+      '(menu-item "Show history" vc-print-log
+                 :help "List the change log of the current file set in a window"))
+    (define-key map [rlog]
+      '(menu-item "Show Top of the Tree History " vc-print-root-log
+                 :help "List the change log for the current tree in a window"))
     ;; VC commands.
     (define-key map [sepvccmd] '("--"))
     (define-key map [update]
@@ -263,6 +273,7 @@ See `run-hooks'."
     (define-key map [mouse-2] 'vc-dir-toggle-mark)
     (define-key map [follow-link] 'mouse-face)
     (define-key map "x" 'vc-dir-hide-up-to-date)
+    (define-key map [?\C-k] 'vc-dir-kill-line)
     (define-key map "S" 'vc-dir-search) ;; FIXME: Maybe use A like dired?
     (define-key map "Q" 'vc-dir-query-replace-regexp)
     (define-key map (kbd "M-s a C-s")   'vc-dir-isearch)
@@ -300,7 +311,8 @@ If BODY uses EVENT, it should be a variable,
                                   map vc-dir-mode-map)
     (tool-bar-local-item "bookmark_add"
                         'vc-dir-toggle-mark 'vc-dir-toggle-mark map
-                        :help "Toggle mark on current item")
+                        :help "Toggle mark on current item"
+                        :label "Toggle Mark")
     (tool-bar-local-item-from-menu 'vc-dir-previous-line "left-arrow"
                                   map vc-dir-mode-map
                                   :rtl "right-arrow")
@@ -312,11 +324,14 @@ If BODY uses EVENT, it should be a variable,
     (tool-bar-local-item-from-menu 'revert-buffer "refresh"
                                   map vc-dir-mode-map)
     (tool-bar-local-item-from-menu 'nonincremental-search-forward
-                                  "search" map)
+                                  "search" map nil
+                                  :label "Search")
     (tool-bar-local-item-from-menu 'vc-dir-query-replace-regexp
-                                  "search-replace" map vc-dir-mode-map)
+                                  "search-replace" map vc-dir-mode-map
+                                  :label "Replace")
     (tool-bar-local-item-from-menu 'vc-dir-kill-dir-status-process "cancel"
-                                  map vc-dir-mode-map)
+                                  map vc-dir-mode-map
+                                  :label "Cancel")
     (tool-bar-local-item-from-menu 'quit-window "exit"
                                   map vc-dir-mode-map)
     map))
@@ -952,6 +967,7 @@ the *vc-dir* buffer.
     ;; Make sure that if the directory buffer is killed, the update
     ;; process running in the background is also killed.
     (add-hook 'kill-buffer-query-functions 'vc-dir-kill-query nil t)
+    (hack-dir-local-variables-non-file-buffer)
     (vc-dir-refresh)))
 
 (defun vc-dir-headers (backend dir)
@@ -963,7 +979,8 @@ specific headers."
    (propertize "VC backend : " 'face 'font-lock-type-face)
    (propertize (format "%s\n" backend) 'face 'font-lock-variable-name-face)
    (propertize "Working dir: " 'face 'font-lock-type-face)
-   (propertize (format "%s\n" dir) 'face 'font-lock-variable-name-face)
+   (propertize (format "%s\n" (abbreviate-file-name dir))
+               'face 'font-lock-variable-name-face)
    ;; Then the backend specific ones.
    (vc-call-backend backend 'dir-extra-headers dir)
    "\n"))
@@ -1100,6 +1117,13 @@ outside of VC) and one wants to do some operation on it."
            (ewoc-delete vc-ewoc crt))
          (setq crt prev)))))
 
+(defun vc-dir-kill-line ()
+  "Remove the current line from display."
+  (interactive)
+  (let ((crt (ewoc-locate vc-ewoc))
+        (inhibit-read-only t))
+    (ewoc-delete vc-ewoc crt)))
+
 (defun vc-dir-printer (fileentry)
   (vc-call-backend vc-dir-backend 'dir-printer fileentry))
 
@@ -1169,7 +1193,8 @@ These are the commands available for use in the file status buffer:
          nil t nil nil)))))
   (unless backend
     (setq backend (vc-responsible-backend dir)))
-  (pop-to-buffer (vc-dir-prepare-status-buffer "*vc-dir*" dir backend))
+  (let (pop-up-windows)                      ; based on cvs-examine; bug#6204
+    (pop-to-buffer (vc-dir-prepare-status-buffer "*vc-dir*" dir backend)))
   (if (derived-mode-p 'vc-dir-mode)
       (vc-dir-refresh)
     ;; FIXME: find a better way to pass the backend to `vc-dir-mode'.
similarity index 93%
rename from lisp/vc-dispatcher.el
rename to lisp/vc/vc-dispatcher.el
index 0c3820bc5298c692b2449383772e76f22799324a..b6ccae1af1bbbfb6b5b9f2f6e687fde1bc2ff983 100644 (file)
@@ -5,7 +5,8 @@
 
 ;; Author:     FSF (see below for full credits)
 ;; Maintainer: Eric S. Raymond <esr@thyrsus.com>
-;; Keywords: tools
+;; Keywords: vc tools
+;; Package: vc
 
 ;; This file is part of GNU Emacs.
 
@@ -141,7 +142,6 @@ preserve the setting."
 (defvar vc-log-operation nil)
 (defvar vc-log-after-operation-hook nil)
 (defvar vc-log-fileset)
-(defvar vc-log-extra)
 
 ;; In a log entry buffer, this is a local variable
 ;; that points to the buffer for which it was made
@@ -318,16 +318,9 @@ case, and the process object in the asynchronous case."
            (status 0))
        (when files
          (setq squeezed (nconc squeezed files)))
-       (let ((exec-path (append vc-path exec-path))
-             ;; Add vc-path to PATH for the execution of this command.
-             ;; Also, since some functions need to parse the output
+       (let (;; Since some functions need to parse the output
              ;; from external commands, set LC_MESSAGES to C.
-             (process-environment
-              (cons (concat "PATH=" (getenv "PATH")
-                            path-separator
-                            (mapconcat 'identity vc-path path-separator))
-                    (cons "LC_MESSAGES=C"
-                          process-environment)))
+             (process-environment (cons "LC_MESSAGES=C" process-environment))
              (w32-quote-process-args t))
          (if (eq okstatus 'async)
              ;; Run asynchronously.
@@ -458,7 +451,7 @@ ARG and NO-CONFIRM are passed on to `revert-buffer'."
 (make-variable-buffer-local 'vc-mode-line-hook)
 (put 'vc-mode-line-hook 'permanent-local t)
 
-(defun vc-resynch-window (file &optional keep noquery)
+(defun vc-resynch-window (file &optional keep noquery reset-vc-info)
   "If FILE is in the current buffer, either revert or unvisit it.
 The choice between revert (to see expanded keywords) and unvisit
 depends on KEEP.  NOQUERY if non-nil inhibits confirmation for
@@ -469,6 +462,8 @@ editing!"
   (and (string= buffer-file-name file)
        (if keep
           (when (file-exists-p file)
+            (when reset-vc-info
+              (vc-file-clearprops file))
             (vc-revert-buffer-internal t noquery)
 
             ;; VC operations might toggle the read-only state.  In
@@ -490,24 +485,24 @@ editing!"
 (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)
+(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))
        (with-current-buffer buffer
-         (vc-resynch-buffer fname keep noquery))))))
+         (vc-resynch-buffer fname keep noquery reset-vc-info))))))
 
-(defun vc-resynch-buffer (file &optional keep noquery)
+(defun vc-resynch-buffer (file &optional keep noquery reset-vc-info)
   "If FILE is currently visited, resynch its buffer."
   (if (string= buffer-file-name file)
-      (vc-resynch-window file keep noquery)
+      (vc-resynch-window file keep noquery reset-vc-info)
     (if (file-directory-p file)
-       (vc-resynch-buffers-in-directory file keep noquery)
+       (vc-resynch-buffers-in-directory file keep noquery reset-vc-info)
       (let ((buffer (get-file-buffer file)))
        (when buffer
          (with-current-buffer buffer
-           (vc-resynch-window file keep noquery))))))
+           (vc-resynch-window file keep noquery reset-vc-info))))))
   ;; Try to avoid unnecessary work, a *vc-dir* buffer is only present
   ;; if this is true.
   (when vc-dir-buffers
@@ -527,21 +522,26 @@ 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)
+(defun vc-log-edit (fileset mode)
   "Set up `log-edit' for use on FILE."
   (setq default-directory
        (with-current-buffer vc-parent-buffer default-directory))
   (log-edit 'vc-finish-logentry
            nil
-           `((log-edit-listfun . (lambda () ',fileset))
-             (log-edit-diff-function . (lambda () (vc-diff nil)))))
+           `((log-edit-listfun . (lambda ()
+                                    ;; FIXME: Should expand the list
+                                    ;; for directories.
+                                    (mapcar 'file-relative-name
+                                            ',fileset)))
+             (log-edit-diff-function . (lambda () (vc-diff nil))))
+           nil
+           mode)
   (set (make-local-variable 'vc-log-fileset) fileset)
-  (make-local-variable 'vc-log-extra)
   (set-buffer-modified-p nil)
   (setq buffer-file-name nil))
 
-(defun vc-start-logentry (files extra comment initial-contents msg logbuf action &optional after-hook)
-  "Accept a comment for an operation on FILES with extra data EXTRA.
+(defun vc-start-logentry (files comment initial-contents msg logbuf mode action &optional after-hook)
+  "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
 INITIAL-CONTENTS is non-nil, then COMMENT is used as the initial
@@ -549,8 +549,9 @@ contents of the log entry buffer.  If COMMENT is a string and
 INITIAL-CONTENTS is nil, do action immediately as if the user had
 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).  AFTER-HOOK specifies the local value
-for `vc-log-after-operation-hook'."
+\(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'."
   (let ((parent
          (if (vc-dispatcher-browsing)
              ;; If we are called from a directory browser, the parent buffer is
@@ -565,12 +566,11 @@ 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)
+    (vc-log-edit files mode)
     (make-local-variable 'vc-log-after-operation-hook)
     (when after-hook
       (setq vc-log-after-operation-hook after-hook))
     (setq vc-log-operation action)
-    (setq vc-log-extra extra)
     (when comment
       (erase-buffer)
       (when (stringp comment) (insert comment)))
@@ -579,7 +579,8 @@ for `vc-log-after-operation-hook'."
       (vc-finish-logentry (eq comment t)))))
 
 (declare-function vc-dir-move-to-goal-column "vc-dir" ())
-
+;; vc-finish-logentry is typically called from a log-edit buffer (see
+;; vc-start-logentry).
 (defun vc-finish-logentry (&optional nocomment)
   "Complete the operation implied by the current log entry.
 Use the contents of the current buffer as a check-in or registration
@@ -595,20 +596,21 @@ the buffer contents as a comment."
     (or (vc-dispatcher-browsing) (vc-buffer-sync)))
   (unless vc-log-operation
     (error "No log operation is pending"))
+
   ;; save the parameters held in buffer-local variables
   (let ((logbuf (current-buffer))
        (log-operation vc-log-operation)
+        ;; FIXME: When coming from VC-Dir, we should check that the
+        ;; set of selected files is still equal to vc-log-fileset,
+        ;; to avoid surprises.
        (log-fileset vc-log-fileset)
-       (log-extra vc-log-extra)
        (log-entry (buffer-string))
-       (after-hook vc-log-after-operation-hook)
-       (tmp-vc-parent-buffer vc-parent-buffer))
+       (after-hook vc-log-after-operation-hook))
     (pop-to-buffer vc-parent-buffer)
     ;; OK, do it to it
     (save-excursion
       (funcall log-operation
               log-fileset
-              log-extra
               log-entry))
     ;; Remove checkin window (after the checkin so that if that fails
     ;; we don't zap the log buffer and the typing therein).
@@ -617,9 +619,11 @@ the buffer contents as a comment."
           (delete-windows-on logbuf (selected-frame))
           ;; Kill buffer and delete any other dedicated windows/frames.
           (kill-buffer logbuf))
-         (logbuf (pop-to-buffer logbuf)
-                 (bury-buffer)
-                 (pop-to-buffer tmp-vc-parent-buffer)))
+         (logbuf
+           (with-selected-window (or (get-buffer-window logbuf 0)
+                                     (selected-window))
+             (with-current-buffer logbuf
+               (bury-buffer)))))
     ;; Now make sure we see the expanded headers
     (when log-fileset
       (mapc
similarity index 95%
rename from lisp/vc-git.el
rename to lisp/vc/vc-git.el
index 24062a0f4f6c996aa91bd7b3004b795f23b9891b..48a86454f741b2e9d770e05217fa584d88c6a136 100644 (file)
@@ -3,7 +3,8 @@
 ;; Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
 ;; Author: Alexandre Julliard <julliard@winehq.org>
-;; Keywords: tools
+;; Keywords: vc tools
+;; Package: vc
 
 ;; This file is part of GNU Emacs.
 
@@ -118,7 +119,7 @@ If nil, use the value of `vc-diff-switches'.  If t, use no switches."
   :version "23.1"
   :group 'vc)
 
-(defvar git-commits-coding-system 'utf-8
+(defvar vc-git-commits-coding-system 'utf-8
   "Default coding system for git commits.")
 
 ;;; BACKEND PROPERTIES
@@ -171,7 +172,14 @@ If nil, use the value of `vc-diff-switches'.  If t, use no switches."
 
 (defun vc-git-state (file)
   "Git-specific version of `vc-state'."
-  ;; FIXME: This can't set 'ignored yet
+  ;; FIXME: This can't set 'ignored or 'conflict yet
+  ;; The 'ignored state could be detected with `git ls-files -i -o
+  ;; --exclude-standard` It also can't set 'needs-update or
+  ;; 'needs-merge. The rough equivalent would be that upstream branch
+  ;; for current branch is in fast-forward state i.e. current branch
+  ;; is direct ancestor of corresponding upstream branch, and the file
+  ;; was modified upstream.  But we can't check that without a network
+  ;; operation.
   (if (not (vc-git-registered file))
       'unregistered
     (vc-git--call nil "add" "--refresh" "--" (file-relative-name file))
@@ -541,11 +549,16 @@ or an empty string if none."
 (defun vc-git-unregister (file)
   (vc-git-command nil 0 file "rm" "-f" "--cached" "--"))
 
+(declare-function log-edit-extract-headers "log-edit" (headers string))
 
 (defun vc-git-checkin (files rev comment)
-  (let ((coding-system-for-write git-commits-coding-system))
-    (vc-git-command nil 0 files "commit"
-                   "-m" comment "--only" "--")))
+  (let ((coding-system-for-write vc-git-commits-coding-system))
+    (apply 'vc-git-command nil 0 files
+          (nconc (list "commit" "-m")
+                  (log-edit-extract-headers '(("Author" . "--author")
+                                             ("Date" . "--date"))
+                                            comment)
+                  (list "--only" "--")))))
 
 (defun vc-git-find-revision (file rev buffer)
   (let* (process-file-side-effects
@@ -580,7 +593,7 @@ or an empty string if none."
   "Get change log associated with FILES.
 Note that using SHORTLOG requires at least Git version 1.5.6,
 for the --graph option."
-  (let ((coding-system-for-read git-commits-coding-system))
+  (let ((coding-system-for-read vc-git-commits-coding-system))
     ;; `vc-do-command' creates the buffer, but we need it before running
     ;; the command.
     (vc-setup-buffer buffer)
@@ -600,25 +613,46 @@ for the --graph option."
                (when start-revision (list start-revision))
                '("--")))))))
 
+(defun vc-git-log-outgoing (buffer remote-location)
+  (interactive)
+  (vc-git-command
+   buffer 0 nil
+   "log"
+   "--no-color" "--graph" "--decorate" "--date=short"
+   "--pretty=tformat:%d%h  %ad  %s" "--abbrev-commit"
+   (concat (if (string= remote-location "")
+              "@{upstream}"
+            remote-location)
+          "..HEAD")))
+
+(defun vc-git-log-incoming (buffer remote-location)
+  (interactive)
+  (vc-git-command nil 0 nil "fetch")
+  (vc-git-command
+   buffer 0 nil
+   "log" 
+   "--no-color" "--graph" "--decorate" "--date=short"
+   "--pretty=tformat:%d%h  %ad  %s" "--abbrev-commit"
+   (concat "HEAD.." (if (string= remote-location "")
+                       "@{upstream}"
+                     remote-location))))
+
 (defvar log-view-message-re)
 (defvar log-view-file-re)
 (defvar log-view-font-lock-keywords)
 (defvar log-view-per-file-logs)
 
-;; Dynamically bound.
-(defvar vc-short-log)
-
 (define-derived-mode vc-git-log-view-mode log-view-mode "Git-Log-View"
   (require 'add-log) ;; We need the faces add-log.
   ;; Don't have file markers, so use impossible regexp.
   (set (make-local-variable 'log-view-file-re) "\\`a\\`")
   (set (make-local-variable 'log-view-per-file-logs) nil)
   (set (make-local-variable 'log-view-message-re)
-       (if vc-short-log
+       (if (not (eq vc-log-view-type 'long))
           "^\\(?:[*/\\| ]+ \\)?\\(?: ([^)]+)\\)?\\([0-9a-z]+\\)  \\([-a-z0-9]+\\)  \\(.*\\)"
         "^commit *\\([0-9a-z]+\\)"))
   (set (make-local-variable 'log-view-font-lock-keywords)
-       (if vc-short-log
+       (if (not (eq vc-log-view-type 'long))
           '(
             ;; Same as log-view-message-re, except that we don't
             ;; want the shy group for the tag name.
@@ -681,7 +715,8 @@ or BRANCH^ (where \"^\" can be repeated)."
     (with-temp-buffer
       (vc-git-command t nil nil "for-each-ref" "--format=%(refname)")
       (goto-char (point-min))
-      (while (re-search-forward "^refs/\\(heads\\|tags\\)/\\(.*\\)$" nil t)
+      (while (re-search-forward "^refs/\\(heads\\|tags\\|remotes\\)/\\(.*\\)$"
+                                nil t)
         (push (match-string 2) table)))
     table))
 
similarity index 91%
rename from lisp/vc-hg.el
rename to lisp/vc/vc-hg.el
index c1dc6eadd862d6269af9839f1dccd271210a0664..c087a4d9e1f5e89c877ed49cd7a0e53e75d25a08 100644 (file)
@@ -3,7 +3,8 @@
 ;; Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
 ;; Author: Ivan Kanis
-;; Keywords: tools
+;; Keywords: vc tools
+;; Package: vc
 
 ;; This file is part of GNU Emacs.
 
@@ -252,33 +253,33 @@ If nil, use the value of `vc-diff-switches'.  If t, use no switches."
     (with-current-buffer
        buffer
       (apply 'vc-hg-command buffer 0 files "log"
-            (append
+            (nconc
              (when start-revision (list (format "-r%s:" start-revision)))
              (when limit (list "-l" (format "%s" limit)))
-             (when shortlog '("--style" "compact"))
+             (when shortlog (list "--style" "compact"))
              vc-hg-log-switches)))))
 
 (defvar log-view-message-re)
 (defvar log-view-file-re)
 (defvar log-view-font-lock-keywords)
 (defvar log-view-per-file-logs)
-(defvar vc-short-log)
 
 (define-derived-mode vc-hg-log-view-mode log-view-mode "Hg-Log-View"
   (require 'add-log) ;; we need the add-log faces
   (set (make-local-variable 'log-view-file-re) "\\`a\\`")
   (set (make-local-variable 'log-view-per-file-logs) nil)
   (set (make-local-variable 'log-view-message-re)
-       (if vc-short-log
-           "^\\([0-9]+\\)\\(?:\\[.*\\]\\)? +\\([0-9a-z]\\{12\\}\\) +\\(\\(?:[0-9]+\\)-\\(?:[0-9]+\\)-\\(?:[0-9]+\\) \\(?:[0-9]+\\):\\(?:[0-9]+\\) \\(?:[-+0-9]+\\)\\) +\\(.*\\)$"
+       (if (eq vc-log-view-type 'short)
+           "^\\([0-9]+\\)\\(\\[.*\\]\\)? +\\([0-9a-z]\\{12\\}\\) +\\(\\(?:[0-9]+\\)-\\(?:[0-9]+\\)-\\(?:[0-9]+\\) \\(?:[0-9]+\\):\\(?:[0-9]+\\) \\(?:[-+0-9]+\\)\\) +\\(.*\\)$"
          "^changeset:[ \t]*\\([0-9]+\\):\\(.+\\)"))
   (set (make-local-variable 'log-view-font-lock-keywords)
-       (if vc-short-log
+       (if (eq vc-log-view-type 'short)
            (append `((,log-view-message-re
                       (1 'log-view-message-face)
-                      (2 'log-view-message-face)
-                      (3 'change-log-date)
-                      (4 'change-log-name))))
+                      (2 'highlight nil lax)
+                      (3 'log-view-message-face)
+                      (4 'change-log-date)
+                      (5 'change-log-name))))
        (append
         log-view-font-lock-keywords
         '(
@@ -294,7 +295,8 @@ If nil, use the value of `vc-diff-switches'.  If t, use no switches."
           ("^user:[ \t]+\\([A-Za-z0-9_.+-]+\\(?:@[A-Za-z0-9_.-]+\\)?\\)"
            (1 'change-log-email))
           ("^date: \\(.+\\)" (1 'change-log-date))
-            ("^summary:[ \t]+\\(.+\\)" (1 'log-view-message)))))))
+         ("^tag: +\\([^ ]+\\)$" (1 'highlight))
+         ("^summary:[ \t]+\\(.+\\)" (1 'log-view-message)))))))
 
 (defun vc-hg-diff (files &optional oldvers newvers buffer)
   "Get a difference report using hg between two revisions of FILES."
@@ -419,10 +421,16 @@ COMMENT is ignored."
 ;;   "Unregister FILE from hg."
 ;;   (vc-hg-command nil nil file "remove"))
 
+(declare-function log-edit-extract-headers "log-edit" (headers string))
+
 (defun vc-hg-checkin (files rev comment)
   "Hg-specific version of `vc-backend-checkin'.
 REV is ignored."
-  (vc-hg-command nil 0 files  "commit" "-m" comment))
+  (apply 'vc-hg-command nil 0 files
+         (nconc (list "commit" "-m")
+                (log-edit-extract-headers '(("Author" . "--user")
+                                           ("Date" . "--date"))
+                                          comment))))
 
 (defun vc-hg-find-revision (file rev buffer)
   (let ((coding-system-for-read 'binary)
@@ -456,8 +464,6 @@ REV is the revision to check out into WORKFILE."
 
 (defvar vc-hg-extra-menu-map
   (let ((map (make-sparse-keymap)))
-    (define-key map [incoming] '(menu-item "Show incoming" vc-hg-incoming))
-    (define-key map [outgoing] '(menu-item "Show outgoing" vc-hg-outgoing))
     map))
 
 (defun vc-hg-extra-menu () vc-hg-extra-menu-map)
@@ -466,14 +472,6 @@ REV is the revision to check out into WORKFILE."
 
 (defvar log-view-vc-backend)
 
-(define-derived-mode vc-hg-outgoing-mode vc-hg-log-view-mode "Hg-Outgoing"
-  "Mode for browsing Hg outgoing changes."
-  (set (make-local-variable 'log-view-vc-backend) 'Hg))
-
-(define-derived-mode vc-hg-incoming-mode vc-hg-log-view-mode "Hg-Incoming"
-  "Mode for browsing Hg incoming changes."
-  (set (make-local-variable 'log-view-vc-backend) 'Hg))
-
 (defstruct (vc-hg-extra-fileinfo
             (:copier nil)
             (:constructor vc-hg-create-extra-fileinfo (rename-state extra-name))
@@ -579,33 +577,13 @@ REV is the revision to check out into WORKFILE."
      ;; (vc-hg-dir-extra-header "Global id  : " "id" "-i")
      )))
 
-;; FIXME: this adds another top level menu, instead figure out how to
-;; replace the Log-View menu.
-(easy-menu-define log-view-mode-menu vc-hg-outgoing-mode-map
-  "Hg-outgoing Display Menu"
-  `("Hg-outgoing"
-    ["Push selected"  vc-hg-push]))
-
-(easy-menu-define log-view-mode-menu vc-hg-incoming-mode-map
-  "Hg-incoming Display Menu"
-  `("Hg-incoming"
-    ["Pull selected"  vc-hg-pull]))
+(defun vc-hg-log-incoming (buffer remote-location)
+  (vc-hg-command buffer 1 nil "incoming" "-n" (unless (string= remote-location "")
+                                               remote-location)))
 
-(defun vc-hg-outgoing ()
-  (interactive)
-  (let ((bname "*Hg outgoing*")
-       (vc-short-log nil))
-    (vc-hg-command bname 1 nil "outgoing" "-n")
-    (pop-to-buffer bname)
-    (vc-hg-outgoing-mode)))
-
-(defun vc-hg-incoming ()
-  (interactive)
-  (let ((bname "*Hg incoming*")
-       (vc-short-log nil))
-    (vc-hg-command bname 0 nil "incoming" "-n")
-    (pop-to-buffer bname)
-    (vc-hg-incoming-mode)))
+(defun vc-hg-log-outgoing (buffer remote-location)
+  (vc-hg-command buffer 1 nil "outgoing" "-n" (unless (string= remote-location "")
+                                               remote-location)))
 
 (declare-function log-view-get-marked "log-view" ())
 
@@ -614,22 +592,22 @@ REV is the revision to check out into WORKFILE."
   (interactive)
   (let ((marked-list (log-view-get-marked)))
     (if marked-list
-        (vc-hg-command
-         nil 0 nil
-         (cons "push"
+        (apply #'vc-hg-command
+               nil 0 nil
+               "push"
                (apply 'nconc
-                      (mapcar (lambda (arg) (list "-r" arg)) marked-list))))
-         (error "No log entries selected for push"))))
+                      (mapcar (lambda (arg) (list "-r" arg)) marked-list)))
+      (error "No log entries selected for push"))))
 
 (defun vc-hg-pull ()
   (interactive)
   (let ((marked-list (log-view-get-marked)))
     (if marked-list
-        (vc-hg-command
-         nil 0 nil
-         (cons "pull"
+        (apply #'vc-hg-command
+               nil 0 nil
+               "pull"
                (apply 'nconc
-                      (mapcar (lambda (arg) (list "-r" arg)) marked-list))))
+                      (mapcar (lambda (arg) (list "-r" arg)) marked-list)))
       (error "No log entries selected for pull"))))
 
 ;;; Internal functions
similarity index 97%
rename from lisp/vc-hooks.el
rename to lisp/vc/vc-hooks.el
index 70369df06fe701e2f3029e005f728a3bc6b358dc..91e9b8e3cd30b571e28c924abad74cb361224a6d 100644 (file)
@@ -6,6 +6,7 @@
 
 ;; Author:     FSF (see vc.el for full credits)
 ;; Maintainer: Andre Spiegel <spiegel@gnu.org>
+;; Package: vc
 
 ;; This file is part of GNU Emacs.
 
@@ -84,13 +85,6 @@ An empty list disables VC altogether."
   :type '(repeat string)
   :group 'vc)
 
-(defcustom vc-path nil
-  "List of extra directories to search for version control commands."
-  :type '(repeat directory)
-  :group 'vc)
-
-(make-obsolete-variable 'vc-path "should not be necessary anymore." "23.2")
-
 (defcustom vc-make-backup-files nil
   "If non-nil, backups of registered files are made as with other files.
 If nil (the default), files covered by version control don't get backups."
@@ -403,7 +397,7 @@ If the argument is a list, the files must all have the same back end."
 
 
 (defun vc-backend-subdirectory-name (file)
-  "Return where the master and lock FILEs for the current directory are kept."
+  "Return where the repository for the current directory is kept."
   (symbol-name (vc-backend file)))
 
 (defun vc-name (file)
@@ -467,17 +461,20 @@ For registered files, the value returned is one of:
   'edited            The working file has been edited by the user.  If
                      locking is used for the file, this state means that
                      the current version is locked by the calling user.
+                     This status should *not* be reported for files 
+                     which have a changed mtime but the same content 
+                     as the repo copy.
 
   USER               The current version of the working file is locked by
                      some other USER (a string).
 
-  'needs-update       The file has not been edited by the user, but there is
+  'needs-update      The file has not been edited by the user, but there is
                      a more recent version on the current branch stored
-                     in the master file.
+                     in the repository.
 
   'needs-merge       The file has been edited by the user, and there is also
                      a more recent version on the current branch stored in
-                     the master file.  This state can only occur if locking
+                     the repository.  This state can only occur if locking
                      is not used for the file.
 
   'unlocked-changes  The working version of the file is not locked,
@@ -556,7 +553,7 @@ and does not employ any heuristic at all."
        unchanged))))
 
 (defun vc-default-workfile-unchanged-p (backend file)
-  "Check if FILE is unchanged by diffing against the master version.
+  "Check if FILE is unchanged by diffing against the repository version.
 Return non-nil if FILE is unchanged."
   (zerop (condition-case err
              ;; If the implementation supports it, let the output
@@ -947,6 +944,8 @@ current, and kill the buffer that visits the link."
     (define-key map "i" 'vc-register)
     (define-key map "l" 'vc-print-log)
     (define-key map "L" 'vc-print-root-log)
+    (define-key map "I" 'vc-log-incoming)
+    (define-key map "O" 'vc-log-outgoing)
     (define-key map "m" 'vc-merge)
     (define-key map "r" 'vc-retrieve-tag)
     (define-key map "s" 'vc-create-tag)
@@ -989,6 +988,12 @@ current, and kill the buffer that visits the link."
     (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")))
similarity index 97%
rename from lisp/vc-mtn.el
rename to lisp/vc/vc-mtn.el
index db9f5eb333382d57d93adad585966d727a903c0d..cb03853f8653de6d879381808c4fb20614b6fe8a 100644 (file)
@@ -3,7 +3,8 @@
 ;; Copyright (C) 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
-;; Keywords: 
+;; Keywords: vc
+;; Package: vc
 
 ;; This file is part of GNU Emacs.
 
@@ -22,7 +23,7 @@
 
 ;;; Commentary:
 
-;; 
+;;
 
 ;;; TODO:
 
@@ -172,8 +173,14 @@ If nil, use the value of `vc-diff-switches'.  If t, use no switches."
 (defun vc-mtn-responsible-p (file) (vc-mtn-root file))
 (defun vc-mtn-could-register (file) (vc-mtn-root file))
 
-(defun vc-mtn-checkin (files rev comment)
-  (vc-mtn-command nil 0 files "commit" "-m" comment))
+(declare-function log-edit-extract-headers "log-edit" (headers string))
+
+(defun vc-mtn-checkin (files rev comment  &optional extra-args-ignored)
+  (apply 'vc-mtn-command nil 0 files
+        (nconc (list "commit" "-m")
+               (log-edit-extract-headers '(("Author" . "--author")
+                                           ("Date" . "--date"))
+                                         comment))))
 
 (defun vc-mtn-find-revision (file rev buffer)
   (vc-mtn-command buffer 0 file "cat" "-r" rev))
similarity index 99%
rename from lisp/vc-rcs.el
rename to lisp/vc/vc-rcs.el
index 91cae8ed970f07634ea31c0c4ea3e75ee8f94ed1..1c3b4c00e3202277075a9ddb9b583a97fff2548d 100644 (file)
@@ -6,6 +6,7 @@
 
 ;; Author:     FSF (see vc.el for full credits)
 ;; Maintainer: Andre Spiegel <spiegel@gnu.org>
+;; Package: vc
 
 ;; This file is part of GNU Emacs.
 
@@ -348,7 +349,7 @@ whether to remove it."
         (yes-or-no-p (format "Directory %s is empty; remove it? " dir))
         (delete-directory dir))))
 
-(defun vc-rcs-checkin (files rev comment)
+(defun vc-rcs-checkin (files rev comment &optional extra-args-ignored)
   "RCS-specific version of `vc-backend-checkin'."
   (let ((switches (vc-switches 'RCS 'checkin)))
     ;; Now operate on the files
similarity index 99%
rename from lisp/vc-sccs.el
rename to lisp/vc/vc-sccs.el
index 43bbda42d3fcab141087efe57e4175d2825a454a..cf7d97e483d840cd6c1e674c307850a6cc21491a 100644 (file)
@@ -6,6 +6,7 @@
 
 ;; Author:     FSF (see vc.el for full credits)
 ;; Maintainer: Andre Spiegel <spiegel@gnu.org>
+;; Package: vc
 
 ;; This file is part of GNU Emacs.
 
@@ -235,7 +236,7 @@ expanded if `vc-keep-workfiles' is non-nil, otherwise, delete the workfile."
       (stringp (vc-sccs-search-project-dir (or (file-name-directory file) "")
                                           (file-name-nondirectory file)))))
 
-(defun vc-sccs-checkin (files rev comment)
+(defun vc-sccs-checkin (files rev comment &optional extra-args-ignored)
   "SCCS-specific version of `vc-backend-checkin'."
   (dolist (file (vc-expand-dirs files))
     (apply 'vc-sccs-do-command nil 0 "delta" (vc-name file)
similarity index 99%
rename from lisp/vc-svn.el
rename to lisp/vc/vc-svn.el
index 34ebc3bb949124fee9083c8e1c258203f1573e4e..3af6842ab443766bf9504924c3ab29b69fd1caf6 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Author:      FSF (see vc.el for full credits)
 ;; Maintainer:  Stefan Monnier <monnier@gnu.org>
+;; Package: vc
 
 ;; This file is part of GNU Emacs.
 
@@ -282,7 +283,7 @@ to the SVN command."
   "Return non-nil if FILE could be registered in SVN.
 This is only possible if SVN is responsible for FILE's directory.")
 
-(defun vc-svn-checkin (files rev comment)
+(defun vc-svn-checkin (files rev comment &optional extra-args-ignored)
   "SVN-specific version of `vc-backend-checkin'."
   (if rev (error "Committing to a specific revision is unsupported in SVN"))
   (let ((status (apply
similarity index 89%
rename from lisp/vc.el
rename to lisp/vc/vc.el
index a7d4ec663917963fb290d34feafed37f007aac11..20e56bbd42f1a99745d63ff1f58380fad31966a8 100644 (file)
@@ -6,7 +6,7 @@
 
 ;; Author:     FSF (see below for full credits)
 ;; Maintainer: Andre Spiegel <spiegel@gnu.org>
-;; Keywords: tools
+;; Keywords: vc tools
 
 ;; This file is part of GNU Emacs.
 
 ;; although you might prefer to use C-c C-a (i.e. `log-edit-insert-changelog')
 ;; from the commit buffer instead or to set `log-edit-setup-invert'.
 ;;
-;; The vc code maintains some internal state in order to reduce expensive
-;; version-control operations to a minimum.  Some names are only computed
-;; once.  If you perform version control operations with the backend while
-;; vc's back is turned, or move/rename master files while vc is running,
-;; vc may get seriously confused.  Don't do these things!
+;; When using SCCS, RCS, CVS: be careful not to do repo surgery, or
+;; operations like registrations and deletions and renames, outside VC
+;; while VC is running. The support for these systems was designed
+;; when disks were much slower, and the code maintains a lot of
+;; internal state in order to reduce expensive operations to a
+;; minimum. Thus, if you mess with the repo while VC's back is turned,
+;; VC may get seriously confused.
+;;
+;; When using Subversion or a later system, anything you do outside VC
+;; *through the VCS tools* should safely interlock with VC
+;; operations. Under these VC does little state caching, because local
+;; operations are assumed to be fast.  The dividing line is
 ;;
 ;; ADDING SUPPORT FOR OTHER BACKENDS
 ;;
 ;;
 ;;   Return non-nil if FILE is unchanged from the working revision.
 ;;   This function should do a brief comparison of FILE's contents
-;;   with those of the repository master of the working revision.  If
+;;   with those of the repository copy of the working revision.  If
 ;;   the backend does not have such a brief-comparison feature, the
 ;;   default implementation of this function can be used, which
 ;;   delegates to a full vc-BACKEND-diff.  (Note that vc-BACKEND-diff
 ;;
 ;; * checkin (files rev comment)
 ;;
-;;   Commit changes in FILES to this backend.  If REV is non-nil, that
-;;   should become the new revision number (not all backends do
-;;   anything with it).  COMMENT is used as a check-in comment.  The
-;;   implementation should pass the value of vc-checkin-switches to
-;;   the backend command.  (Note: in older versions of VC, this
-;;   command took a single file argument and not a list.)
+;;   Commit changes in FILES to this backend.  REV is a historical artifact
+;;   and should be ignored.  COMMENT is used as a check-in comment.
+;;   The implementation should pass the value of vc-checkin-switches to
+;;   the backend command.
 ;;
 ;; * find-revision (file rev buffer)
 ;;
 ;;   revision.  At this point START-REVISION is only required to work
 ;;   in conjunction with LIMIT = 1.
 ;;
+;; * log-outgoing (backend remote-location)
+;;
+;;   Insert in BUFFER the revision log for the changes that will be
+;;   sent when performing a push operation to REMOTE-LOCATION.
+;;
+;; * log-incoming (backend remote-location)
+;;
+;;   Insert in BUFFER the revision log for the changes that will be
+;;   received when performing a pull operation from REMOTE-LOCATION.
+;;
 ;; - log-view-mode ()
 ;;
 ;;   Mode to use for the output of print-log.  This defaults to
 ;;   Return the revision number that follows REV for FILE, or nil if no such
 ;;   revision exists.
 ;;
+;; - log-edit-mode ()
+;;
+;;   Turn on the mode used for editing the check in log.  This
+;;   defaults to `log-edit-mode'.  If changed, it should use a mode
+;;   derived from`log-edit-mode'.
+;;
 ;; - check-headers ()
 ;;
 ;;   Return non-nil if the current buffer contains any version headers.
 ;;   makes it possible to provide menu entries for functionality that
 ;;   is specific to a backend and which does not map to any of the VC
 ;;   generic concepts.
+;;
+;; - conflicted-files (dir)
+;;
+;;   Return the list of files where conflict resolution is needed in
+;;   the project that contains DIR.
+;;   FIXME: what should it do with non-text conflicts?
 
 ;;; Todo:
 
 ;;   display the branch name in the mode-line. Replace
 ;;   vc-cvs-sticky-tag with that.
 ;;
-;; - vc-create-tag and vc-retrieve-tag should update the
-;;   buffers that might be visiting the affected files.
-;;
 ;;;; Internal cleanups:
 ;;
 ;; - backends that care about vc-stay-local should try to take it into
@@ -767,7 +791,7 @@ is sensitive to blank lines."
 (defcustom vc-checkout-carefully (= (user-uid) 0)
   "Non-nil means be extra-careful in checkout.
 Verify that the file really is not locked
-and that its contents match what the master file says."
+and that its contents match what the repository version says."
   :type 'boolean
   :group 'vc)
 (make-obsolete-variable 'vc-checkout-carefully
@@ -889,6 +913,16 @@ Within directories, only files already under version control are noticed."
     (nreverse flattened)))
 
 (defvar vc-dir-backend)
+(defvar log-view-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 'diff-mode)     diff-vc-backend)
+       ((derived-mode-p 'dired-mode)
+        (vc-responsible-backend default-directory))
+       (vc-mode (vc-backend buffer-file-name))))
 
 (declare-function vc-dir-current-file "vc-dir" ())
 (declare-function vc-dir-deduce-fileset "vc-dir" (&optional state-model-only-files))
@@ -1030,8 +1064,7 @@ merge in the changes into your working copy."
          (state (nth 3 vc-fileset))
          ;; The backend should check that the checkout-model is consistent
          ;; among all the `files'.
-        (model (nth 4 vc-fileset))
-        revision)
+        (model (nth 4 vc-fileset)))
 
     ;; Do the right thing
     (cond
@@ -1046,11 +1079,13 @@ merge in the changes into your working copy."
       (cond
        (verbose
        ;; go to a different revision
-       (setq revision (read-string "Branch, revision, or backend to move to: "))
-       (let ((revision-downcase (downcase revision)))
+       (let* ((revision
+                (read-string "Branch, revision, or backend to move to: "))
+               (revision-downcase (downcase revision)))
          (if (member
               revision-downcase
-              (mapcar (lambda (arg) (downcase (symbol-name arg))) vc-handled-backends))
+              (mapcar (lambda (arg) (downcase (symbol-name arg)))
+                       vc-handled-backends))
              (let ((vsym (intern-soft revision-downcase)))
                (dolist (file files) (vc-transfer-file file vsym)))
            (dolist (file files)
@@ -1095,8 +1130,8 @@ merge in the changes into your working copy."
            (message "No files remain to be committed")
          (if (not verbose)
              (vc-checkin ready-for-commit backend)
-           (setq revision (read-string "New revision or backend: "))
-           (let ((revision-downcase (downcase revision)))
+           (let* ((revision (read-string "New revision or backend: "))
+                   (revision-downcase (downcase revision)))
              (if (member
                   revision-downcase
                   (mapcar (lambda (arg) (downcase (symbol-name arg)))
@@ -1341,7 +1376,7 @@ Type \\[vc-next-action] to check in changes.")
 (defun vc-checkin (files backend &optional rev comment initial-contents)
   "Check in FILES.
 The optional argument REV may be a string specifying the new revision
-level (if nil increment the current level).  COMMENT is a comment
+level (strongly deprecated).  COMMENT is a comment
 string; if omitted, a buffer is popped up to accept a comment.  If
 INITIAL-CONTENTS is non-nil, then COMMENT is used as the initial contents
 of the log entry buffer.
@@ -1355,26 +1390,30 @@ Runs the normal hooks `vc-before-checkin-hook' and `vc-checkin-hook'."
   (lexical-let
    ((backend backend))
    (vc-start-logentry
-    files rev comment initial-contents
+    files comment initial-contents
     "Enter a change comment."
     "*VC-log*"
-    (lambda (files rev 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)))
+    (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)))
 
 ;;; Additional entry points for examining version histories
@@ -1514,7 +1553,7 @@ returns t if the buffer had changes, nil otherwise."
                   (not (string= (vc-working-revision file) "0")))
               (push file filtered)
             ;; This file is added but not yet committed;
-            ;; there is no master file to diff against.
+            ;; there is no repository version to diff against.
             (if (or rev1 rev2)
                 (error "No revisions of %s exist" file)
               ;; We regard this as "changed".
@@ -1533,6 +1572,10 @@ returns t if the buffer had changes, nil otherwise."
           (message "%s" (cdr messages))
           nil)
       (diff-mode)
+      (set (make-local-variable 'diff-vc-backend) (car vc-fileset))
+      (set (make-local-variable 'revert-buffer-function)
+          `(lambda (ignore-auto noconfirm)
+             (vc-diff-internal ,async ',vc-fileset ,rev1 ,rev2 ,verbose)))
       ;; Make the *vc-diff* buffer read only, the diff-mode key
       ;; bindings are nicer for read only buffers. pcl-cvs does the
       ;; same thing.
@@ -1639,18 +1682,20 @@ saving the buffer."
       ;; that's not what we want here, we want the diff for the VC root dir.
       (call-interactively 'vc-version-diff)
     (when buffer-file-name (vc-buffer-sync not-urgent))
-    (let ((backend
-          (cond ((derived-mode-p 'vc-dir-mode)  vc-dir-backend)
-                ((derived-mode-p 'dired-mode) (vc-responsible-backend default-directory))
-                (vc-mode (vc-backend buffer-file-name))))
+    (let ((backend (vc-deduce-backend))
          rootdir working-revision)
       (unless backend
        (error "Buffer is not version controlled"))
       (setq rootdir (vc-call-backend backend 'root default-directory))
       (setq working-revision (vc-working-revision rootdir))
-      (vc-diff-internal
-       t (list backend (list rootdir) working-revision) nil nil
-       (called-interactively-p 'interactive)))))
+      ;; VC diff for the root directory produces output that is
+      ;; relative to it.  Bind default-directory to the root directory
+      ;; here, this way the *vc-diff* buffer is setup correctly, so
+      ;; relative file names work.
+      (let ((default-directory rootdir))
+       (vc-diff-internal
+        t (list backend (list rootdir) working-revision) nil nil
+        (called-interactively-p 'interactive))))))
 
 ;;;###autoload
 (defun vc-revision-other-window (rev)
@@ -1754,17 +1799,19 @@ The headers are reset to their non-expanded form."
 
 (defun vc-modify-change-comment (files rev oldcomment)
   "Edit the comment associated with the given files and revision."
-  (vc-start-logentry
-   files rev oldcomment t
-   "Enter a replacement change comment."
-   "*VC-log*"
-   (lambda (files rev comment)
-     (vc-call-backend
-      ;; Less of a kluge than it looks like; log-view mode only passes
-      ;; this function a singleton list.  Arguments left in this form in
-      ;; case the more general operation ever becomes meaningful.
-      (vc-responsible-backend (car files))
-      'modify-change-comment files rev comment))))
+  ;; Less of a kluge than it looks like; log-view mode only passes
+  ;; this function a singleton list.  Arguments left in this form in
+  ;; case the more general operation ever becomes meaningful.
+  (let ((backend (vc-responsible-backend (car files))))
+    (vc-start-logentry
+     files oldcomment t
+     "Enter a replacement change comment."
+     "*VC-log*"
+     (lambda () (vc-call-backend backend 'log-edit-mode))
+     (lexical-let ((rev rev))
+       (lambda (files comment)
+         (vc-call-backend backend
+                          'modify-change-comment files rev comment))))))
 
 ;;;###autoload
 (defun vc-merge ()
@@ -1825,6 +1872,31 @@ See Info node `Merging'."
 ;;;###autoload
 (defalias 'vc-resolve-conflicts 'smerge-ediff)
 
+;; TODO: This is OK but maybe we could integrate it better.
+;; E.g. it could be run semi-automatically (via a prompt?) when saving a file
+;; that was conflicted (i.e. upon mark-resolved).
+;; FIXME: should we add an "other-window" version?  Or maybe we should
+;; hook it inside find-file so it automatically works for
+;; find-file-other-window as well.  E.g. find-file could use a new
+;; `default-next-file' variable for its default file (M-n), and
+;; we could then set it upon mark-resolve, so C-x C-s C-x C-f M-n would
+;; automatically offer the next conflicted file.
+(defun vc-find-conflicted-file ()
+  "Visit the next conflicted file in the current project."
+  (interactive)
+  (let* ((backend (or (if buffer-file-name (vc-backend buffer-file-name))
+                      (vc-responsible-backend default-directory)
+                      (error "No VC backend")))
+         (files (vc-call-backend backend
+                                 'conflicted-files default-directory)))
+    ;; Don't try and visit the current file.
+    (if (equal (car files) buffer-file-name) (pop files))
+    (if (null files)
+        (message "No more conflicted files")
+      (find-file (pop files))
+      (message "%s more conflicted files after this one"
+               (if files (length files) "No")))))
+
 ;; Named-configuration entry points
 
 (defun vc-tag-precondition (dir)
@@ -1850,13 +1922,22 @@ the named configuration.  If the prefix argument BRANCHP is
 given, the tag is made as a new branch and the files are
 checked out in that new branch."
   (interactive
-   (list (read-file-name "Directory: " default-directory default-directory t)
-         (read-string "New tag name: ")
-        current-prefix-arg))
+   (let ((granularity
+         (vc-call-backend (vc-responsible-backend default-directory)
+                          'revision-granularity)))
+     (list
+      (if (eq granularity 'repository)
+         ;; For VC's that do not work at file level, it's pointless
+         ;; to ask for a directory, branches are created at repository level.
+         default-directory
+       (read-file-name "Directory: " default-directory default-directory t))
+      (read-string (if current-prefix-arg "New branch name: " "New tag name: "))
+      current-prefix-arg)))
   (message "Making %s... " (if branchp "branch" "tag"))
   (when (file-directory-p dir) (setq dir (file-name-as-directory dir)))
   (vc-call-backend (vc-responsible-backend dir)
                   'create-tag dir name branchp)
+  (vc-resynch-buffer dir t t t)
   (message "Making %s... done" (if branchp "branch" "tag")))
 
 ;;;###autoload
@@ -1867,8 +1948,16 @@ If locking is used for the files in DIR, then there must not be any
 locked files at or below DIR (but if NAME is empty, locked files are
 allowed and simply skipped)."
   (interactive
-   (list (read-file-name "Directory: " default-directory default-directory t)
-         (read-string "Tag name to retrieve (default latest revisions): ")))
+   (let ((granularity
+         (vc-call-backend (vc-responsible-backend default-directory)
+                          'revision-granularity)))
+     (list
+      (if (eq granularity 'repository)
+         ;; For VC's that do not work at file level, it's pointless
+         ;; to ask for a directory, branches are created at repository level.
+         default-directory
+       (read-file-name "Directory: " default-directory default-directory t))
+      (read-string "Tag name to retrieve (default latest revisions): "))))
   (let ((update (yes-or-no-p "Update any affected buffers? "))
        (msg (if (or (not name) (string= name ""))
                 (format "Updating %s... " (abbreviate-file-name dir))
@@ -1877,8 +1966,10 @@ allowed and simply skipped)."
     (message "%s" msg)
     (vc-call-backend (vc-responsible-backend dir)
                     'retrieve-tag dir name update)
+    (vc-resynch-buffer dir t t t)
     (message "%s" (concat msg "done"))))
 
+
 ;; Miscellaneous other entry points
 
 ;; FIXME: this should be a defcustom
@@ -1891,9 +1982,31 @@ If it contains `directory' then if the fileset contains a directory show a short
 If it contains `file' then show short logs for files.
 Not all VC backends support short logs!")
 
-(defvar log-view-vc-backend)
 (defvar log-view-vc-fileset)
 
+(defun vc-print-log-setup-buttons (working-revision is-start-revision limit pl-return)
+  (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))
+      (widget-create 'push-button
+                    :notify (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"
+                    "Show 2X entries")
+      (widget-insert "    ")
+      (widget-create 'push-button
+                    :notify (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, showing all entries"
+                    "Show unlimited entries"))
+    (widget-setup)))
+
 (defun vc-print-log-internal (backend files working-revision
                                       &optional is-start-revision limit)
   ;; Don't switch to the output buffer before running the command,
@@ -1901,6 +2014,8 @@ Not all VC backends support short logs!")
   ;; buffer can be accessed by the command.
   (let ((dir-present nil)
        (vc-short-log nil)
+       (buffer-name "*vc-change-log*")
+       type
        pl-return)
     (dolist (file files)
       (when (file-directory-p file)
@@ -1909,44 +2024,64 @@ Not all VC backends support short logs!")
          (not (null (if dir-present
                         (memq 'directory vc-log-short-style)
                       (memq 'file vc-log-short-style)))))
-
-    (setq pl-return (vc-call-backend
-                    backend 'print-log files "*vc-change-log*"
-                    vc-short-log (when is-start-revision working-revision) limit))
-    (pop-to-buffer "*vc-change-log*")
+    (setq type (if vc-short-log 'short 'long))
+    (lexical-let
+       ((working-revision working-revision)
+        (limit limit)
+        (shortlog vc-short-log)
+        (is-start-revision is-start-revision))
+      (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)
+        (vc-print-log-setup-buttons working-revision
+                                    is-start-revision limit ret))
+       (lambda (bk)
+        (vc-call-backend bk 'show-log-entry working-revision))))))
+
+(defvar vc-log-view-type nil
+  "Set this to differentiate the different types of logs.")
+(put 'vc-log-view-type 'permanent-local t)
+
+(defun vc-log-internal-common (backend
+                              buffer-name
+                              files
+                              type
+                              backend-func
+                              setup-buttons-func
+                              goto-location-func)
+  (let (retval)
+    (with-current-buffer (get-buffer-create buffer-name)
+      (set (make-local-variable 'vc-log-view-type) type))
+    (setq retval (funcall backend-func backend buffer-name type files))
+    (pop-to-buffer buffer-name)
     (let ((inhibit-read-only t))
       ;; log-view-mode used to be called with inhibit-read-only bound
       ;; to t, so let's keep doing it, just in case.
-      (vc-call-backend backend 'log-view-mode))
-    (set (make-local-variable 'log-view-vc-backend) backend)
-    (set (make-local-variable 'log-view-vc-fileset) files)
-
+      (vc-call-backend backend 'log-view-mode)
+      (set (make-local-variable 'log-view-vc-backend) backend)
+      (set (make-local-variable 'log-view-vc-fileset) files))
     (vc-exec-after
      `(let ((inhibit-read-only t))
-       (when (and ,limit (not ,(eq 'limit-unsupported pl-return))
-                  (not ,is-start-revision))
-         (goto-char (point-max))
-         (widget-create 'push-button
-                        :notify (lambda (&rest ignore)
-                                  (vc-print-log-internal
-                                   ',backend ',files ',working-revision nil (* 2 ,limit)))
-                        :help-echo "Show the log again, and double the number of log entries shown"
-                        "Show 2X entries")
-         (widget-insert "    ")
-         (widget-create 'push-button
-                        :notify (lambda (&rest ignore)
-                                  (vc-print-log-internal
-                                   ',backend ',files ',working-revision nil nil))
-                        :help-echo "Show the log again, showing all entries"
-                        "Show unlimited entries")
-         (widget-setup))
-
+       (funcall ',setup-buttons-func ',backend ',files ',retval)
        (shrink-window-if-larger-than-buffer)
-       ;; move point to the log entry for the working revision
-       (vc-call-backend ',backend 'show-log-entry ',working-revision)
+       (funcall ',goto-location-func ',backend)
        (setq vc-sentinel-movepoint (point))
        (set-buffer-modified-p nil)))))
 
+(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)))))
+
 ;;;###autoload
 (defun vc-print-log (&optional working-revision limit)
   "List the change log of the current fileset in a window.
@@ -1995,10 +2130,7 @@ When called interactively with a prefix argument, prompt for LIMIT."
        (list lim)))
     (t
      (list (when (> vc-log-show-limit 0) vc-log-show-limit)))))
-  (let ((backend
-        (cond ((derived-mode-p 'vc-dir-mode)  vc-dir-backend)
-              ((derived-mode-p 'dired-mode) (vc-responsible-backend default-directory))
-              (vc-mode (vc-backend buffer-file-name))))
+  (let ((backend (vc-deduce-backend))
        rootdir working-revision)
     (unless backend
       (error "Buffer is not version controlled"))
@@ -2006,6 +2138,26 @@ When called interactively with a prefix argument, prompt for LIMIT."
     (setq working-revision (vc-working-revision rootdir))
     (vc-print-log-internal backend (list rootdir) working-revision nil limit)))
 
+;;;###autoload
+(defun vc-log-incoming (&optional remote-location)
+  "Show a log of changes that will be received with a pull operation from REMOTE-LOCATION."
+  (interactive "sRemote location (empty for default): ")
+  (let ((backend (vc-deduce-backend))
+       rootdir working-revision)
+    (unless backend
+      (error "Buffer is not version controlled"))
+    (vc-incoming-outgoing-internal backend remote-location "*vc-incoming*" 'log-incoming)))
+
+;;;###autoload
+(defun vc-log-outgoing (&optional remote-location)
+  "Show a log of changes that will be sent with a push operation to REMOTE-LOCATION."
+  (interactive "sRemote location (empty for default): ")
+  (let ((backend (vc-deduce-backend))
+       rootdir working-revision)
+    (unless backend
+      (error "Buffer is not version controlled"))
+    (vc-incoming-outgoing-internal backend remote-location "*vc-outgoing*" 'log-outgoing)))
+
 ;;;###autoload
 (defun vc-revert ()
   "Revert working copies of the selected fileset to their repository contents.
@@ -2240,7 +2392,7 @@ backend to NEW-BACKEND, and unregister FILE from the current backend.
                (if unmodified-file
                    (copy-file unmodified-file file
                               'ok-if-already-exists 'keep-date)
-                 (when (y-or-n-p "Get base revision from master? ")
+                 (when (y-or-n-p "Get base revision from repository? ")
                    (vc-revert-file file))))
              (vc-call-backend new-backend 'receive-file file rev))
          (when modified-file
@@ -2327,7 +2479,7 @@ backend to NEW-BACKEND, and unregister FILE from the current backend.
 
 ;;;###autoload
 (defun vc-rename-file (old new)
-  "Rename file OLD to NEW, and rename its master file likewise."
+  "Rename file OLD to NEW in both work area and repository."
   (interactive "fVC rename file: \nFRename to: ")
   ;; in CL I would have said (setq new (merge-pathnames new old))
   (let ((old-base (file-name-nondirectory old)))
@@ -2451,6 +2603,10 @@ to provide the `find-revision' operation instead."
 
 (defalias 'vc-default-check-headers 'ignore)
 
+(declare-function log-edit-mode "log-edit" ())
+
+(defun vc-default-log-edit-mode (backend) (log-edit-mode))
+
 (defun vc-default-log-view-mode (backend) (log-view-mode))
 
 (defun vc-default-show-log-entry (backend rev)
index 3573a86ad49fe3e8af386772037c687cd21d9ca7..9e8fbf431f1cefff25045527048ab5bb30ba5e3c 100644 (file)
 (defgroup vcursor nil
   "Manipulate an alternative (\"virtual\") cursor."
   :prefix "vcursor-"
-  :group 'editing)
+  :group 'convenience)
 
 (defface vcursor
   '((((class color)) (:foreground "blue" :background "cyan" :underline t))
index 127fdec26f040b6e376e6c3003cf7e7b83210ae3..b4e2c61b57095d4bc2816db2b7d1baad3ce85145 100644 (file)
@@ -6,6 +6,7 @@
 
 ;; Maintainer: FSF
 ;; Keywords: internal
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
 
 ;;; Code:
 
-(defconst emacs-copyright "Copyright (C) 2010 Free Software Foundation, Inc." "\
-Short copyright string for this version of Emacs.")
-
-(defconst emacs-version "23.2.50" "\
-Version numbers 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.")
index 219af1b6e1ed330ba7a6237f391f9e0f5c05511e..f6698ae5a9f051b124e1ac7409fe5d562b71c832 100644 (file)
@@ -48,8 +48,7 @@
   "Peruse file or buffer without editing."
   :link '(function-link view-mode)
   :link '(custom-manual "(emacs)Misc File Ops")
-  :group 'wp
-  :group 'editing)
+  :group 'wp)
 
 (defcustom view-highlight-face 'highlight
    "The face used for highlighting the match found by View mode search."
@@ -162,14 +161,6 @@ that use View mode automatically.")
   "Overlay used to display where a search operation found its match.
 This is local in each buffer, once it is used.")
 (make-variable-buffer-local 'view-overlay)
-
-(unless (assq 'view-mode minor-mode-alist)
-  (setq minor-mode-alist
-       (cons (list 'view-mode
-                   (propertize " View"
-                               'local-map mode-line-minor-mode-keymap
-                               'help-echo "mouse-3: minor mode menu"))
-             minor-mode-alist)))
 \f
 ;; Define keymap inside defvar to make it easier to load changes.
 ;; Some redundant "less"-like key bindings below have been commented out.
@@ -231,10 +222,6 @@ This is local in each buffer, once it is used.")
     (define-key map "?" 'describe-mode)        ; Maybe do as less instead? See above.
     (define-key map "h" 'describe-mode)
     map))
-
-(or (assq 'view-mode minor-mode-map-alist)
-    (setq minor-mode-map-alist
-         (cons (cons 'view-mode view-mode-map) minor-mode-map-alist)))
 \f
 ;;; Commands that enter or exit view mode.
 
@@ -263,13 +250,7 @@ This command runs the normal hook `view-mode-hook'."
   (unless (file-exists-p file) (error "%s does not exist" file))
   (let ((had-a-buf (get-file-buffer file))
        (buffer (find-file-noselect file)))
-    (if (eq (with-current-buffer buffer
-             (get major-mode 'mode-class))
-           'special)
-       (progn
-         (switch-to-buffer buffer)
-         (message "Not using View mode because the major mode is special"))
-      (view-buffer buffer (and (not had-a-buf) 'kill-buffer-if-not-modified)))))
+    (view-buffer buffer (and (not had-a-buf) 'kill-buffer-if-not-modified))))
 
 ;;;###autoload
 (defun view-file-other-window (file)
@@ -335,10 +316,16 @@ file: Users may suspend viewing in order to modify the buffer.
 Exiting View mode will then discard the user's edits.  Setting
 EXIT-ACTION to `kill-buffer-if-not-modified' avoids this."
   (interactive "bView buffer: ")
-  (let ((undo-window (list (window-buffer) (window-start) (window-point))))
-    (switch-to-buffer buffer)
-    (view-mode-enter (cons (selected-window) (cons nil undo-window))
-                    exit-action)))
+  (if (eq (with-current-buffer buffer
+           (get major-mode 'mode-class))
+         'special)
+      (progn
+       (switch-to-buffer buffer)
+       (message "Not using View mode because the major mode is special"))
+    (let ((undo-window (list (window-buffer) (window-start) (window-point))))
+      (switch-to-buffer buffer)
+      (view-mode-enter (cons (selected-window) (cons nil undo-window))
+                      exit-action))))
 
 ;;;###autoload
 (defun view-buffer-other-window (buffer &optional not-return exit-action)
@@ -394,7 +381,7 @@ this argument instead of explicitly setting `view-exit-action'."
                     exit-action)))
 \f
 ;;;###autoload
-(defun view-mode (&optional arg)
+(define-minor-mode view-mode
   ;; In the following documentation string we have to use some explicit key
   ;; bindings instead of using the \\[] construction.  The reason for this
   ;; is that most commands have more than one key binding.
@@ -474,11 +461,8 @@ If view-mode was entered from another buffer, by \\[view-buffer],
 then \\[View-leave], \\[View-quit] and \\[View-kill-and-leave] will return to that buffer.
 
 Entry to view-mode runs the normal hook `view-mode-hook'."
-  (interactive "P")
-  (unless (and arg                     ; Do nothing if already OK.
-              (if (> (prefix-numeric-value arg) 0) view-mode (not view-mode)))
-    (if view-mode (view-mode-disable)
-      (view-mode-enable))))
+  :lighter " View" :keymap view-mode-map
+  (if view-mode (view-mode-enable) (view-mode-disable)))
 \f
 (defun view-mode-enable ()
   "Turn on View mode."
index efdf26b529c2e4ca0fa58065a5e3d599bbfd790a..e08ecf880e79547a4b3fb5380adf02942bd4195c 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Author: Geoff Voelker <voelker@cs.washington.edu>
 ;; Keywords: internal
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
@@ -253,15 +254,16 @@ You should set this to t when using a non-system shell.\n\n"))))
 ;;         (setq source-directory (file-name-as-directory
 ;;                                  (expand-file-name ".." exec-directory)))))
 
-(defun convert-standard-filename (filename)
-  "Convert a standard file's name to something suitable for the current OS.
+(defun w32-convert-standard-filename (filename)
+  "Convert a standard file's name to something suitable for MS-Windows.
 This means to guarantee valid names and perhaps to canonicalize
 certain patterns.
 
-On Windows and DOS, replace invalid characters.  On DOS, make
-sure to obey the 8.3 limitations.  On Windows, turn Cygwin names
-into native names, and also turn slashes into backslashes if the
-shell requires it (see `w32-shell-dos-semantics')."
+This function is called by `convert-standard-filename'.
+
+Replace invalid characters and turn Cygwin names into native
+names, and also turn slashes into backslashes if the shell
+requires it (see `w32-shell-dos-semantics')."
   (save-match-data
     (let ((name
           (if (string-match "\\`/cygdrive/\\([a-zA-Z]\\)/" filename)
index c1d593ea4ec5182597602e660db30b5272c5b87f..91676dd12da41f03fea38c8794bf12891fc26196 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Author: Jason Rumney <jasonr@gnu.org>
 ;; Keywords: internal
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
index 9f4b033e75fe8dde5928e09cb0d805205da11fc8..4b8b9a611733ad83efcad70f556029e6618a70f2 100644 (file)
@@ -6,7 +6,7 @@
 ;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br>
 ;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br>
 ;; Keywords: data, wp
-;; Version: 13.0
+;; Version: 13.1
 ;; X-URL: http://www.emacswiki.org/cgi-bin/wiki/ViniciusJoseLatorre
 
 ;; This file is part of GNU Emacs.
   "Visualize blanks (TAB, (HARD) SPACE and NEWLINE)."
   :link '(emacs-library-link :tag "Source Lisp File" "whitespace.el")
   :version "23.1"
-  :group 'wp
-  :group 'data)
+  :group 'convenience)
 
 
 (defcustom whitespace-style
-  '(tabs spaces trailing lines space-before-tab newline
-        indentation empty space-after-tab
-        space-mark tab-mark newline-mark)
+  '(face
+    tabs spaces trailing lines space-before-tab newline
+    indentation empty space-after-tab
+    space-mark tab-mark newline-mark)
   "Specify which kind of blank is visualized.
 
 It's a list containing some or all of the following values:
 
+   face                        enable all visualization via faces (see below).
+
    trailing            trailing blanks are visualized via faces.
+                       It has effect only if `face' (see above)
+                       is present in `whitespace-style'.
 
    tabs                        TABs are visualized via faces.
+                       It has effect only if `face' (see above)
+                       is present in `whitespace-style'.
 
    spaces              SPACEs and HARD SPACEs are visualized via
                        faces.
+                       It has effect only if `face' (see above)
+                       is present in `whitespace-style'.
 
    lines               lines which have columns beyond
                        `whitespace-line-column' are highlighted via
@@ -403,6 +411,8 @@ It's a list containing some or all of the following values:
                        Whole line is highlighted.
                        It has precedence over `lines-tail' (see
                        below).
+                       It has effect only if `face' (see above)
+                       is present in `whitespace-style'.
 
    lines-tail          lines which have columns beyond
                        `whitespace-line-column' are highlighted via
@@ -410,45 +420,69 @@ It's a list containing some or all of the following values:
                        But only the part of line which goes
                        beyond `whitespace-line-column' column.
                        It has effect only if `lines' (see above)
-                       is not present in `whitespace-style'.
+                       is not present in `whitespace-style'
+                       and if `face' (see above) is present in
+                       `whitespace-style'.
 
    newline             NEWLINEs are visualized via faces.
+                       It has effect only if `face' (see above)
+                       is present in `whitespace-style'.
 
    empty               empty lines at beginning and/or end of buffer
                        are visualized via faces.
+                       It has effect only if `face' (see above)
+                       is present in `whitespace-style'.
 
    indentation::tab    8 or more SPACEs at beginning of line are
                        visualized via faces.
+                       It has effect only if `face' (see above)
+                       is present in `whitespace-style'.
 
    indentation::space  TABs at beginning of line are visualized via
                        faces.
+                       It has effect only if `face' (see above)
+                       is present in `whitespace-style'.
 
    indentation         8 or more SPACEs at beginning of line are
                        visualized, if `indent-tabs-mode' (which see)
                        is non-nil; otherwise, TABs at beginning of
                        line are visualized via faces.
+                       It has effect only if `face' (see above)
+                       is present in `whitespace-style'.
 
    space-after-tab::tab                8 or more SPACEs after a TAB are
                                visualized via faces.
+                               It has effect only if `face' (see above)
+                               is present in `whitespace-style'.
 
    space-after-tab::space      TABs are visualized when 8 or more
                                SPACEs occur after a TAB, via faces.
+                               It has effect only if `face' (see above)
+                               is present in `whitespace-style'.
 
    space-after-tab             8 or more SPACEs after a TAB are
                                visualized, if `indent-tabs-mode'
                                (which see) is non-nil; otherwise,
                                the TABs are visualized via faces.
+                               It has effect only if `face' (see above)
+                               is present in `whitespace-style'.
 
    space-before-tab::tab       SPACEs before TAB are visualized via
                                faces.
+                               It has effect only if `face' (see above)
+                               is present in `whitespace-style'.
 
    space-before-tab::space     TABs are visualized when SPACEs occur
                                before TAB, via faces.
+                               It has effect only if `face' (see above)
+                               is present in `whitespace-style'.
 
    space-before-tab            SPACEs before TAB are visualized, if
                                `indent-tabs-mode' (which see) is
                                non-nil; otherwise, the TABs are
                                visualized via faces.
+                               It has effect only if `face' (see above)
+                               is present in `whitespace-style'.
 
    space-mark          SPACEs and HARD SPACEs are visualized via
                        display table.
@@ -487,9 +521,16 @@ So, for example, if indentation and indentation::space are
 included in `whitespace-style' list, the indentation value is
 evaluated instead of indentation::space value.
 
+One reason for not visualize spaces via faces (if `face' is not
+included in `whitespace-style') is to use exclusively for
+cleanning up a buffer.  See `whitespace-cleanup' and
+`whitespace-cleanup-region' for documentation.
+
 See also `whitespace-display-mappings' for documentation."
   :type '(repeat :tag "Kind of Blank"
                 (choice :tag "Kind of Blank Face"
+                        (const :tag "(Face) Face visualization"
+                               face)
                         (const :tag "(Face) Trailing TABs, SPACEs and HARD SPACEs"
                                trailing)
                         (const :tag "(Face) SPACEs and HARD SPACEs"
@@ -522,9 +563,9 @@ Used when `whitespace-style' includes the value `spaces'."
 
 (defface whitespace-space
   '((((class color) (background dark))
-     (:background "grey20"      :foreground "aquamarine3"))
+     (:background "grey20"      :foreground "darkgray"))
     (((class color) (background light))
-     (:background "LightYellow" :foreground "aquamarine3"))
+     (:background "LightYellow" :foreground "lightgray"))
     (t (:inverse-video t)))
   "Face used to visualize SPACE."
   :group 'whitespace)
@@ -540,9 +581,9 @@ Used when `whitespace-style' includes the value `spaces'."
 
 (defface whitespace-hspace             ; 'nobreak-space
   '((((class color) (background dark))
-     (:background "grey24"        :foreground "aquamarine3"))
+     (:background "grey24"        :foreground "darkgray"))
     (((class color) (background light))
-     (:background "LemonChiffon3" :foreground "aquamarine3"))
+     (:background "LemonChiffon3" :foreground "lightgray"))
     (t (:inverse-video t)))
   "Face used to visualize HARD SPACE."
   :group 'whitespace)
@@ -558,9 +599,9 @@ Used when `whitespace-style' includes the value `tabs'."
 
 (defface whitespace-tab
   '((((class color) (background dark))
-     (:background "grey22" :foreground "aquamarine3"))
+     (:background "grey22" :foreground "darkgray"))
     (((class color) (background light))
-     (:background "beige"  :foreground "aquamarine3"))
+     (:background "beige"  :foreground "lightgray"))
     (t (:inverse-video t)))
   "Face used to visualize TAB."
   :group 'whitespace)
@@ -867,8 +908,13 @@ Used when `whitespace-style' includes `space-after-tab',
 (defcustom whitespace-line-column 80
   "Specify column beyond which the line is highlighted.
 
+It must be an integer or nil.  If nil, the `fill-column' variable value is
+used.
+
 Used when `whitespace-style' includes `lines' or `lines-tail'."
-  :type '(integer :tag "Line Length")
+  :type '(choice :tag "Line Length Limit"
+                (integer :tag "Line Length")
+                (const :tag "Use fill-column" nil))
   :group 'whitespace)
 
 
@@ -1152,7 +1198,8 @@ See also `whitespace-newline' and `whitespace-display-mappings'."
 
 
 (defconst whitespace-style-value-list
-  '(tabs
+  '(face
+    tabs
     spaces
     trailing
     lines
@@ -1177,7 +1224,8 @@ See also `whitespace-newline' and `whitespace-display-mappings'."
 
 
 (defconst whitespace-toggle-option-alist
-  '((?t    . tabs)
+  '((?f    . face)
+    (?t    . tabs)
     (?s    . spaces)
     (?r    . trailing)
     (?l    . lines)
@@ -1257,6 +1305,7 @@ Interactively, it reads one of the following chars:
 
   CHAR MEANING
   (VIA FACES)
+   f   toggle face visualization
    t   toggle TAB visualization
    s   toggle SPACE and HARD SPACE visualization
    r   toggle trailing blanks visualization
@@ -1285,6 +1334,7 @@ Interactively, it reads one of the following chars:
 Non-interactively, ARG should be a symbol or a list of symbols.
 The valid symbols are:
 
+   face                        toggle face visualization
    tabs                        toggle TAB visualization
    spaces              toggle SPACE and HARD SPACE visualization
    trailing            toggle trailing blanks visualization
@@ -1334,6 +1384,7 @@ Interactively, it accepts one of the following chars:
 
   CHAR MEANING
   (VIA FACES)
+   f   toggle face visualization
    t   toggle TAB visualization
    s   toggle SPACE and HARD SPACE visualization
    r   toggle trailing blanks visualization
@@ -1362,6 +1413,7 @@ Interactively, it accepts one of the following chars:
 Non-interactively, ARG should be a symbol or a list of symbols.
 The valid symbols are:
 
+   face                        toggle face visualization
    tabs                        toggle TAB visualization
    spaces              toggle SPACE and HARD SPACE visualization
    trailing            toggle trailing blanks visualization
@@ -1891,9 +1943,10 @@ cleaning up these problems."
 
 (defconst whitespace-help-text
   "\
- Whitespace Toggle Options
-
- FACES
+ Whitespace Toggle Options                  | scroll up  :  SPC   or > |
+                                            | scroll down:  M-SPC or < |
+ FACES                                      \\__________________________/
+ []  f   - toggle face visualization
  []  t   - toggle TAB visualization
  []  s   - toggle SPACE and HARD SPACE visualization
  []  r   - toggle trailing blanks visualization
@@ -1967,15 +2020,13 @@ cleaning up these problems."
   "Display BUFFER in a new window."
   (goto-char (point-min))
   (set-buffer-modified-p nil)
-  (let ((size (- (window-height)
-                (max window-min-height
-                     (1+ (count-lines (point-min)
-                                      (point-max)))))))
-    (when (<= size 0)
-      (kill-buffer buffer)
-      (error "Frame height is too small; \
+  (when (< (window-height) (* 2 window-min-height))
+    (kill-buffer buffer)
+    (error "Window height is too small; \
 can't split window to display whitespace toggle options"))
-    (set-window-buffer (split-window nil size) buffer)))
+  (let ((win (split-window)))
+    (set-window-buffer win buffer)
+    (shrink-window-if-larger-than-buffer win)))
 
 
 (defun whitespace-kill-buffer (buffer-name)
@@ -1991,6 +2042,24 @@ can't split window to display whitespace toggle options"))
   (whitespace-kill-buffer whitespace-help-buffer-name))
 
 
+(defun whitespace-help-scroll (&optional up)
+  "Scroll help window, if it exists.
+
+If UP is non-nil, scroll up; otherwise, scroll down."
+  (condition-case data-help
+      (let ((buffer (get-buffer whitespace-help-buffer-name)))
+       (if buffer
+           (with-selected-window (get-buffer-window buffer)
+             (if up
+                 (scroll-up 3)
+               (scroll-down 3)))
+         (ding)))
+    ;; handler
+    ((error)
+     ;; just ignore error
+     )))
+
+
 (defun whitespace-interactive-char (local-p)
   "Interactive function to read a char and return a symbol.
 
@@ -2001,6 +2070,7 @@ It accepts one of the following chars:
 
   CHAR MEANING
   (VIA FACES)
+   f   toggle face visualization
    t   toggle TAB visualization
    s   toggle SPACE and HARD SPACE visualization
    r   toggle trailing blanks visualization
@@ -2050,9 +2120,13 @@ See also `whitespace-toggle-option-alist'."
                         (cdr
                          (assq ch whitespace-toggle-option-alist)))))
              ;; while body
-             (if (eq ch ?\?)
-                 (whitespace-help-on style)
-               (ding)))
+             (cond
+              ((eq ch ?\?)   (whitespace-help-on style))
+              ((eq ch ?\ )   (whitespace-help-scroll t))
+              ((eq ch ?\M- ) (whitespace-help-scroll))
+              ((eq ch ?>)    (whitespace-help-scroll t))
+              ((eq ch ?<)    (whitespace-help-scroll))
+              (t             (ding))))
            (whitespace-help-off)
            (message " "))              ; clean echo area
        ;; handler
@@ -2131,22 +2205,23 @@ resultant list will be returned."
 
 (defun whitespace-style-face-p ()
   "Return t if there is some visualization via face."
-  (or (memq 'tabs                    whitespace-active-style)
-      (memq 'spaces                  whitespace-active-style)
-      (memq 'trailing                whitespace-active-style)
-      (memq 'lines                   whitespace-active-style)
-      (memq 'lines-tail              whitespace-active-style)
-      (memq 'newline                 whitespace-active-style)
-      (memq 'empty                   whitespace-active-style)
-      (memq 'indentation             whitespace-active-style)
-      (memq 'indentation::tab        whitespace-active-style)
-      (memq 'indentation::space      whitespace-active-style)
-      (memq 'space-after-tab         whitespace-active-style)
-      (memq 'space-after-tab::tab    whitespace-active-style)
-      (memq 'space-after-tab::space  whitespace-active-style)
-      (memq 'space-before-tab        whitespace-active-style)
-      (memq 'space-before-tab::tab   whitespace-active-style)
-      (memq 'space-before-tab::space whitespace-active-style)))
+  (and (memq 'face whitespace-active-style)
+       (or (memq 'tabs                    whitespace-active-style)
+          (memq 'spaces                  whitespace-active-style)
+          (memq 'trailing                whitespace-active-style)
+          (memq 'lines                   whitespace-active-style)
+          (memq 'lines-tail              whitespace-active-style)
+          (memq 'newline                 whitespace-active-style)
+          (memq 'empty                   whitespace-active-style)
+          (memq 'indentation             whitespace-active-style)
+          (memq 'indentation::tab        whitespace-active-style)
+          (memq 'indentation::space      whitespace-active-style)
+          (memq 'space-after-tab         whitespace-active-style)
+          (memq 'space-after-tab::tab    whitespace-active-style)
+          (memq 'space-after-tab::space  whitespace-active-style)
+          (memq 'space-before-tab        whitespace-active-style)
+          (memq 'space-before-tab::tab   whitespace-active-style)
+          (memq 'space-before-tab::space whitespace-active-style))))
 
 
 (defun whitespace-color-on ()
@@ -2204,14 +2279,16 @@ resultant list will be returned."
        (list
        ;; Show "long" lines
        (list
-        (format
-         "^\\([^\t\n]\\{%s\\}\\|[^\t\n]\\{0,%s\\}\t\\)\\{%d\\}%s\\(.+\\)$"
-         whitespace-tab-width (1- whitespace-tab-width)
-         (/ whitespace-line-column whitespace-tab-width)
-         (let ((rem (% whitespace-line-column whitespace-tab-width)))
-           (if (zerop rem)
-               ""
-             (format ".\\{%d\\}" rem))))
+        (let ((line-column (or whitespace-line-column fill-column)))
+          (format
+           "^\\([^\t\n]\\{%s\\}\\|[^\t\n]\\{0,%s\\}\t\\)\\{%d\\}%s\\(.+\\)$"
+           whitespace-tab-width
+           (1- whitespace-tab-width)
+           (/ line-column whitespace-tab-width)
+           (let ((rem (% line-column whitespace-tab-width)))
+             (if (zerop rem)
+                 ""
+               (format ".\\{%d\\}" rem)))))
         (if (memq 'lines whitespace-active-style)
             0                          ; whole line
           2)                           ; line tail
index 698e6e805a46de223f3942061be03d799bc67f94..96e6bd236cff7f2e1c67fb2e59c8ab1a863714e7 100644 (file)
@@ -5,6 +5,7 @@
 ;;
 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
 ;; Keywords: extensions
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
index 0859f8fba5603f3b5bbd1e9c087a879098b4282c..721414b32ac236675d0a514a773925ea01c02118 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
 ;; Maintainer: FSF
 ;; Keywords: extensions
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
@@ -78,8 +79,7 @@
   :link '(custom-manual "(widget)Top")
   :link '(emacs-library-link :tag "Lisp File" "widget.el")
   :prefix "widget-"
-  :group 'extensions
-  :group 'hypermedia)
+  :group 'extensions)
 
 (defgroup widget-documentation nil
   "Options controlling the display of documentation strings."
@@ -254,7 +254,9 @@ minibuffer."
               ;; Allocate digits to disabled alternatives
               ;; so that the digit of a given alternative never varies.
               (setq next-digit (1+ next-digit)))
-            (insert "\nC-g = Quit"))
+            (insert "\nC-g = Quit")
+            (goto-char (point-min))
+            (forward-line))
           (or some-choice-enabled
               (error "None of the choices is currently meaningful"))
           (define-key map [?\C-g] 'keyboard-quit)
@@ -639,8 +641,7 @@ extension (xpm, xbm, gif, jpg, or png) located in
           (dolist (elt widget-image-conversion)
             (dolist (ext (cdr elt))
               (push (list :type (car elt) :file (concat image ext)) specs)))
-          (setq specs (nreverse specs))
-          (find-image specs)))
+          (find-image (nreverse specs))))
        (t
         ;; Oh well.
         nil)))
@@ -657,7 +658,7 @@ IMAGE should either be an image or an image file name sans extension
 
 Optional arguments DOWN and INACTIVE are used instead of IMAGE when the
 button is pressed or inactive, respectively.  These are currently ignored."
-  (if (and (display-graphic-p)
+  (if (and (featurep 'image)
           (setq image (widget-image-find image)))
       (progn (widget-put widget :suppress-face t)
             (insert-image image tag))
@@ -1337,7 +1338,7 @@ Unlike (get-char-property POS 'field), this works with empty fields too."
                     (goto-char end)
                     (while (and (eq (preceding-char) ?\s)
                                 (> (point) begin))
-                      (delete-backward-char 1)))))))
+                      (delete-char -1)))))))
        (widget-specify-secret field))
       (widget-apply field :notify field))))
 
@@ -1480,7 +1481,7 @@ If that does not exist, call the value of `widget-complete-field'."
      ;; Parse escapes in format.
      (while (re-search-forward "%\\(.\\)" nil t)
        (let ((escape (char-after (match-beginning 1))))
-        (delete-backward-char 2)
+        (delete-char -2)
         (cond ((eq escape ?%)
                (insert ?%))
               ((eq escape ?\[)
@@ -1513,7 +1514,7 @@ If that does not exist, call the value of `widget-complete-field'."
                    (setq doc-begin (point))
                    (insert doc)
                    (while (eq (preceding-char) ?\n)
-                     (delete-backward-char 1))
+                     (delete-char -1))
                    (insert ?\n)
                    (setq doc-end (point)))))
               ((eq escape ?h)
@@ -1877,6 +1878,7 @@ by some other text in the `:format' string (if specified)."
   :valid-regexp ""
   :error "Field's value doesn't match allowed forms"
   :value-create 'widget-field-value-create
+  :value-set 'widget-field-value-set
   :value-delete 'widget-field-value-delete
   :value-get 'widget-field-value-get
   :match 'widget-field-match)
@@ -1915,6 +1917,18 @@ the earlier input."
                        (widget-apply widget :value-get))
     widget))
 
+(defun widget-field-value-set (widget value)
+  "Set an editable text field WIDGET to VALUE"
+  (let ((from (widget-field-start widget))
+       (to (widget-field-text-end widget))
+       (buffer (widget-field-buffer widget))
+       (size (widget-get widget :size)))
+    (when (and from to (buffer-live-p buffer))
+      (with-current-buffer buffer
+       (goto-char from)
+       (delete-char (- to from))
+       (insert value)))))
+
 (defun widget-field-value-create (widget)
   "Create an editable text field."
   (let ((size (widget-get widget :size))
@@ -1952,7 +1966,6 @@ the earlier input."
   (let ((from (widget-field-start widget))
        (to (widget-field-text-end widget))
        (buffer (widget-field-buffer widget))
-       (size (widget-get widget :size))
        (secret (widget-get widget :secret))
        (old (current-buffer)))
     (if (and from to)
@@ -2249,7 +2262,7 @@ If the item is checked, CHOSEN is a cons whose cdr is the value."
      ;; Parse % escapes in format.
      (while (re-search-forward "%\\([bv%]\\)" nil t)
        (let ((escape (char-after (match-beginning 1))))
-        (delete-backward-char 2)
+        (delete-char -2)
         (cond ((eq escape ?%)
                (insert ?%))
               ((eq escape ?b)
@@ -2432,7 +2445,7 @@ Return an alist of (TYPE MATCH)."
      ;; Parse % escapes in format.
      (while (re-search-forward "%\\([bv%]\\)" nil t)
        (let ((escape (char-after (match-beginning 1))))
-        (delete-backward-char 2)
+        (delete-char -2)
         (cond ((eq escape ?%)
                (insert ?%))
               ((eq escape ?b)
@@ -2711,7 +2724,7 @@ Return an alist of (TYPE MATCH)."
      ;; Parse % escapes in format.
      (while (re-search-forward "%\\(.\\)" nil t)
        (let ((escape (char-after (match-beginning 1))))
-        (delete-backward-char 2)
+        (delete-char -2)
         (cond ((eq escape ?%)
                (insert ?%))
               ((eq escape ?i)
@@ -2809,11 +2822,19 @@ Return an alist of (TYPE MATCH)."
 ;;; The `visibility' Widget.
 
 (define-widget 'visibility 'item
-  "An indicator and manipulator for hidden items."
+  "An indicator and manipulator for hidden items.
+
+The following properties have special meanings for this widget:
+:on-image  Image filename or spec to display when the item is visible.
+:on        Text shown if the \"on\" image is nil or cannot be displayed.
+:off-image Image filename or spec to display when the item is hidden.
+:off       Text shown if the \"off\" image is nil cannot be displayed."
   :format "%[%v%]"
   :button-prefix ""
   :button-suffix ""
+  :on-image "down"
   :on "Hide"
+  :off-image "right"
   :off "Show"
   :value-create 'widget-visibility-value-create
   :action 'widget-toggle-action
@@ -2821,21 +2842,17 @@ Return an alist of (TYPE MATCH)."
 
 (defun widget-visibility-value-create (widget)
   ;; Insert text representing the `on' and `off' states.
-  (let ((on (widget-get widget :on))
-       (off (widget-get widget :off)))
-    (if on
-       (setq on (concat widget-push-button-prefix
-                        on
-                        widget-push-button-suffix))
-      (setq on ""))
-    (if off
-       (setq off (concat widget-push-button-prefix
-                         off
-                         widget-push-button-suffix))
-      (setq off ""))
-    (if (widget-value widget)
-       (widget-image-insert widget on "down" "down-pushed")
-      (widget-image-insert widget off "right" "right-pushed"))))
+  (let* ((val (widget-value widget))
+        (text (widget-get widget (if val :on :off)))
+        (img (widget-image-find
+              (widget-get widget (if val :on-image :off-image)))))
+    (widget-image-insert widget
+                        (if text
+                            (concat widget-push-button-prefix text
+                                    widget-push-button-suffix)
+                          "")
+                        (if img
+                            (append img '(:ascent center))))))
 
 ;;; The `documentation-link' Widget.
 ;;
@@ -2938,7 +2955,7 @@ link for that string."
                (widget-create-child-and-convert
                 widget (widget-get widget :visibility-widget)
                 :help-echo "Show or hide rest of the documentation."
-                :on "Hide Rest"
+                :on "Hide"
                 :off "More"
                 :always-active t
                 :action 'widget-parent-action
@@ -3695,6 +3712,7 @@ example:
 (define-widget 'color 'editable-field
   "Choose a color name (with sample)."
   :format "%{%t%}: %v (%{sample%})\n"
+  :value-create 'widget-color-value-create
   :size 10
   :tag "Color"
   :value "black"
@@ -3703,6 +3721,27 @@ example:
   :notify 'widget-color-notify
   :action 'widget-color-action)
 
+(defun widget-color-value-create (widget)
+  (widget-field-value-create widget)
+  (widget-insert " ")
+  (widget-create-child-and-convert
+   widget 'push-button
+   :tag "Choose" :action 'widget-color--choose-action)
+  (widget-insert " "))
+
+(defun widget-color--choose-action (widget &optional event)
+  (list-colors-display
+   nil nil
+   `(lambda (color)
+      (when (buffer-live-p ,(current-buffer))
+       (widget-value-set ',(widget-get widget :parent) color)
+       (let* ((buf (get-buffer "*Colors*"))
+              (win (get-buffer-window buf 0)))
+         (bury-buffer buf)
+         (and win (> (length (window-list)) 1)
+              (delete-window win)))
+       (pop-to-buffer ,(current-buffer))))))
+
 (defun widget-color-complete (widget)
   "Complete the color in WIDGET."
   (require 'facemenu)                  ; for facemenu-color-alist
index 3e35f6c25abd22952cb31b2f4773ba410db68f8d..962235a25d24e1344e332bb9d4651b7dcd123151 100644 (file)
@@ -7,6 +7,7 @@
 ;; Keywords: help, extensions, faces, hypermedia
 ;; Version: 1.9920
 ;; X-URL: http://www.dina.kvl.dk/~abraham/custom/
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
index 41a5d17321fd2414186b5813d0a998ac3be729bd..9a52667cea004aabcd7c1490e2e9e86206949d5d 100644 (file)
@@ -6,6 +6,7 @@
 
 ;; Maintainer: FSF
 ;; Keywords: internal
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
@@ -54,6 +55,7 @@ This macro saves and restores the current buffer, since otherwise
 its normal operation could make a different buffer current.  The
 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
@@ -1220,19 +1222,16 @@ at the front of the list of recently selected ones."
                (let ((buf (get-buffer-create buffer-or-name)))
                  (set-buffer-major-mode buf)
                  buf))))
-       (old-window (selected-window))
        (old-frame (selected-frame))
        new-window new-frame)
     (set-buffer buffer)
     (setq new-window (display-buffer buffer other-window))
-    (unless (eq new-window old-window)
-      ;; `display-buffer' has chosen another window, select it.
-      (select-window new-window norecord)
-      (setq new-frame (window-frame new-window))
-      (unless (eq new-frame old-frame)
-       ;; `display-buffer' has chosen another frame, make sure it gets
-       ;; input focus and is risen.
-       (select-frame-set-input-focus new-frame)))
+    (select-window new-window norecord)
+    (setq new-frame (window-frame new-window))
+    (unless (eq new-frame old-frame)
+      ;; `display-buffer' has chosen another frame, make sure it gets
+      ;; input focus and is risen.
+      (select-frame-set-input-focus new-frame))
     buffer))
 
 ;; I think this should be the default; I think people will prefer it--rms.
@@ -1617,6 +1616,7 @@ Otherwise, bury WINDOW's buffer, see `bury-buffer'."
        (kill-buffer buffer)
       (bury-buffer buffer))))
 
+\f
 (defvar recenter-last-op nil
   "Indicates the last recenter operation performed.
 Possible values: `top', `middle', `bottom', integer or float numbers.")
@@ -1708,6 +1708,154 @@ by `recenter-positions'."
 
 (define-key global-map [?\M-r] 'move-to-window-line-top-bottom)
 
+\f
+;;; Scrolling commands.
+
+;;; Scrolling commands which does not signal errors at top/bottom
+;;; of buffer at first key-press (instead moves to top/bottom
+;;; of buffer).
+
+(defcustom scroll-error-top-bottom nil
+  "Move point to top/bottom of buffer before signalling a scrolling error.
+A value of nil means just signal an error if no more scrolling possible.
+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
+  :version "24.1")
+
+(defun scroll-up-command (&optional arg)
+  "Scroll text of selected window upward ARG lines; or near full screen if no ARG.
+If `scroll-error-top-bottom' is non-nil and `scroll-up' cannot
+scroll window further, move cursor to the bottom line.
+When point is already on that position, then signal an error.
+A near full screen is `next-screen-context-lines' less than a full screen.
+Negative ARG means scroll downward.
+If ARG is the atom `-', scroll downward by nearly full screen."
+  (interactive "^P")
+  (cond
+   ((null scroll-error-top-bottom)
+    (scroll-up arg))
+   ((eq arg '-)
+    (scroll-down-command nil))
+   ((< (prefix-numeric-value arg) 0)
+    (scroll-down-command (- (prefix-numeric-value arg))))
+   ((eobp)
+    (scroll-up arg))                   ; signal error
+   (t
+    (condition-case nil
+       (scroll-up arg)
+      (end-of-buffer
+       (if arg
+          ;; When scrolling by ARG lines can't be done,
+          ;; move by ARG lines instead.
+          (forward-line arg)
+        ;; When ARG is nil for full-screen scrolling,
+        ;; move to the bottom of the buffer.
+        (goto-char (point-max))))))))
+
+(put 'scroll-up-command 'scroll-command t)
+
+(defun scroll-down-command (&optional arg)
+  "Scroll text of selected window down ARG lines; or near full screen if no ARG.
+If `scroll-error-top-bottom' is non-nil and `scroll-down' cannot
+scroll window further, move cursor to the top line.
+When point is already on that position, then signal an error.
+A near full screen is `next-screen-context-lines' less than a full screen.
+Negative ARG means scroll upward.
+If ARG is the atom `-', scroll upward by nearly full screen."
+  (interactive "^P")
+  (cond
+   ((null scroll-error-top-bottom)
+    (scroll-down arg))
+   ((eq arg '-)
+    (scroll-up-command nil))
+   ((< (prefix-numeric-value arg) 0)
+    (scroll-up-command (- (prefix-numeric-value arg))))
+   ((bobp)
+    (scroll-down arg))                 ; signal error
+   (t
+    (condition-case nil
+       (scroll-down arg)
+      (beginning-of-buffer
+       (if arg
+          ;; When scrolling by ARG lines can't be done,
+          ;; move by ARG lines instead.
+          (forward-line (- arg))
+        ;; When ARG is nil for full-screen scrolling,
+        ;; move to the top of the buffer.
+        (goto-char (point-min))))))))
+
+(put 'scroll-down-command 'scroll-command t)
+
+;;; Scrolling commands which scroll a line instead of full screen.
+
+(defun scroll-up-line (&optional arg)
+  "Scroll text of selected window upward ARG lines; or one line if no ARG.
+If ARG is omitted or nil, scroll upward by one line.
+This is different from `scroll-up-command' that scrolls a full screen."
+  (interactive "p")
+  (scroll-up (or arg 1)))
+
+(put 'scroll-up-line 'scroll-command t)
+
+(defun scroll-down-line (&optional arg)
+  "Scroll text of selected window down ARG lines; or one line if no ARG.
+If ARG is omitted or nil, scroll down by one line.
+This is different from `scroll-down-command' that scrolls a full screen."
+  (interactive "p")
+  (scroll-down (or arg 1)))
+
+(put 'scroll-down-line 'scroll-command t)
+
+\f
+(defun scroll-other-window-down (lines)
+  "Scroll the \"other window\" down.
+For more details, see the documentation for `scroll-other-window'."
+  (interactive "P")
+  (scroll-other-window
+   ;; Just invert the argument's meaning.
+   ;; We can do that without knowing which window it will be.
+   (if (eq lines '-) nil
+     (if (null lines) '-
+       (- (prefix-numeric-value lines))))))
+
+(defun beginning-of-buffer-other-window (arg)
+  "Move point to the beginning of the buffer in the other window.
+Leave mark at previous position.
+With arg N, put point N/10 of the way from the true beginning."
+  (interactive "P")
+  (let ((orig-window (selected-window))
+       (window (other-window-for-scrolling)))
+    ;; We use unwind-protect rather than save-window-excursion
+    ;; because the latter would preserve the things we want to change.
+    (unwind-protect
+       (progn
+         (select-window window)
+         ;; Set point and mark in that window's buffer.
+         (with-no-warnings
+          (beginning-of-buffer arg))
+         ;; Set point accordingly.
+         (recenter '(t)))
+      (select-window orig-window))))
+
+(defun end-of-buffer-other-window (arg)
+  "Move point to the end of the buffer in the other window.
+Leave mark at previous position.
+With arg N, put point N/10 of the way from the true end."
+  (interactive "P")
+  ;; See beginning-of-buffer-other-window for comments.
+  (let ((orig-window (selected-window))
+       (window (other-window-for-scrolling)))
+    (unwind-protect
+       (progn
+         (select-window window)
+         (with-no-warnings
+          (end-of-buffer arg))
+         (recenter '(t)))
+      (select-window orig-window))))
+
 \f
 (defvar mouse-autoselect-window-timer nil
   "Timer used by delayed window autoselection.")
index eb21f01e564610da6dff1486836b75f73419ff72..cc14091c2e7eaa73bb7f87530da8608a8c105c3f 100644 (file)
@@ -7,7 +7,7 @@
 ;; Maintainer: FSF
 ;; Keywords: help, unix
 ;; Adapted-By: Eli Zaretskii <eliz@gnu.org>
-;; Version: see `woman-version'
+;; Version: 0.551
 ;; URL: http://centaur.maths.qmul.ac.uk/Emacs/WoMan/
 
 ;; This file is part of GNU Emacs.
@@ -1897,6 +1897,7 @@ Argument EVENT is the invoking mouse event."
   (setq woman-emulation value)
   (woman-reformat-last-file))
 
+(defvar bookmark-make-record-function)
 (put 'woman-mode 'mode-class 'special)
 
 (defun woman-mode ()
@@ -1934,6 +1935,9 @@ See `Man-mode' for additional details."
        ;; `make-local-variable' in case imenu not yet loaded!
        woman-imenu-generic-expression)
   (set (make-local-variable 'imenu-space-replacement) " ")
+  ;; Bookmark support.
+  (set (make-local-variable 'bookmark-make-record-function)
+       'woman-bookmark-make-record)
   ;; For reformat ...
   ;; necessary when reformatting a file in its old buffer:
   (setq imenu--last-menubar-index-alist nil)
@@ -2439,7 +2443,7 @@ Preserves location of `point'."
            (while (and
                    (<= (setq N (1+ N)) 0)
                    (cond ((memq (preceding-char) '(?\  ?\t))
-                          (delete-backward-char 1) t)
+                          (delete-char -1) t)
                          ((memq (following-char) '(?\  ?\t))
                           (delete-char 1) t)
                          (t nil))))
@@ -3117,7 +3121,7 @@ If optional arg CONCAT is non-nil then join arguments."
          (if unquote (delete-char 1) (forward-char))
          (re-search-forward "\"\\|$"))
        (if (eq (preceding-char) ?\")
-           (if unquote (delete-backward-char 1))
+           (if unquote (delete-char -1))
          (WoMan-warn "Unpaired \" in .%s arguments." request)))
     ;; (re-search-forward "[^\\\n] \\|$")      ; inconsistent
     (skip-syntax-forward "^ "))
@@ -4345,7 +4349,7 @@ The variable `tab-stop-list' is a list whose elements are either left
 tab stop columns or pairs (COLUMN . TYPE) where TYPE is R or C."
   ;; Based on tab-to-tab-stop in indent.el.
   ;; R & C tabs probably not quite right!
-  (delete-backward-char 1)
+  (delete-char -1)
   (let ((tabs tab-stop-list))
     (while (and tabs (>= (current-column)
                         (woman-get-tab-stop (car tabs))))
@@ -4399,7 +4403,7 @@ Needs doing properly!"
          (delete-char 1)
          (insert woman-unpadded-space-char)
          (goto-char (match-end 0))
-         (delete-backward-char 1)
+         (delete-char -1)
          (insert-before-markers woman-unpadded-space-char)
          (subst-char-in-region
           (match-beginning 0) (match-end 0)
@@ -4519,6 +4523,37 @@ logging the message."
                    (recenter 0))))))))
   nil)                                 ; for woman-file-readable-p etc.
 
+;;; Bookmark Woman support.
+(declare-function bookmark-make-record-default
+                  "bookmark" (&optional no-file no-context posn))
+(declare-function bookmark-prop-get "bookmark" (bookmark prop))
+(declare-function bookmark-default-handler "bookmark" (bmk))
+(declare-function bookmark-get-bookmark-record "bookmark" (bmk))
+
+;; FIXME: woman.el and man.el should be better integrated so, for
+;; example, bookmarks of one can be used with the other.
+
+(defun woman-bookmark-make-record ()
+  "Make a bookmark entry for a Woman buffer."
+  `(,(Man-default-bookmark-title)
+    ,@(bookmark-make-record-default 'no-file)
+    (location . ,(concat "woman " woman-last-file-name))
+    ;; Use the same form as man's bookmarks, as much as possible.
+    (man-args . ,woman-last-file-name)
+    (handler . woman-bookmark-jump)))
+
+;;;###autoload
+(defun woman-bookmark-jump (bookmark)
+  "Default bookmark handler for Woman buffers."
+  (let* ((file (bookmark-prop-get bookmark 'man-args))
+         ;; FIXME: we need woman-find-file-noselect, since
+         ;; save-window-excursion can't protect us from the case where
+         ;; woman-find-file creates a new frame.
+         (buf  (save-window-excursion
+                 (woman-find-file file) (current-buffer))))
+    (bookmark-default-handler
+     `("" (buffer . ,buf) . ,(bookmark-get-bookmark-record bookmark)))))
+
 (provide 'woman)
 
 ;; arch-tag: eea35e90-552f-4712-a94b-d9ffd3db7651
index 6d38fd043fe8a2c945e3f6fc0e6d6cc9665d5b72..c589382e01471abf6c5878c67f74d4f8be09f265 100644 (file)
@@ -6,6 +6,7 @@
 ;; Author: Jan Djärv <jan.h.d@swipnet.se>
 ;; Maintainer: FSF
 ;; Keywords: window, drag, drop
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
index efe0f3bc1c8f25d2e1ba8276b0a2ac3d4ba83899..e7e428fea1569bbfaa1a1afc08aaf5d4cf229f47 100644 (file)
@@ -1,7 +1,256 @@
+2010-07-29  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * xlwmenu.c (abort_gracefully): Mark as NO_RETURN.
+
+2010-07-26  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * xlwmenu.h (xlwmenu_window_p, xlwmenu_redisplay): Add declarations.
+
+2010-07-12  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * Makefile.in (C_WARNINGS_SWITCH, PROFILING_CFLAGS): Set from
+       substitution.
+       (ALL_CFLAGS): Add ${C_WARNINGS_SWITCH} and ${PROFILING_CFLAGS}.
+
+2010-07-08  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * xlwmenu.c (size_menu_item): Change from K&R to prototype.
+       Change label_width and height to int.
+       (draw_arrow, draw_shadow_rectangle, draw_shadow_rhombus)
+       (draw_separator, display_menu, fit_to_screen, motion_event_is_in_menu)
+       (map_event_to_widget_value): Reformat.
+       (display_menu_item): Change from K&R to prototype.
+
+       * lwlib.c (allocate_widget_info, lw_register_widget): Change from K&R
+       to prototype.
+       (lw_internal_update_other_instances, merge_widget_value): Reformat.
+
+       * lwlib-int.h (widget_creation_function): Fix prototype.
+
+       * lwlib-Xm.c (x_print_complete_resource_name)
+       (make_destroyed_instance, free_destroyed_instance, first_child)
+       (lw_motif_widget_p, resource_motif_string, destroy_all_children)
+       (xm_arm_callback, xm_update_label, xm_update_list)
+       (xm_update_pushbutton, xm_update_cascadebutton)
+       (xm_update_toggle, xm_update_radiobox, make_menu_in_widget)
+       (update_one_menu_entry, xm_update_menu, xm_update_text)
+       (xm_update_text_field, xm_update_one_widget)
+       (xm_update_one_value, activate_button, dialog_key_cb)
+       (make_dialog, mark_dead_instance_destroyed)
+       (find_matching_instance, recenter_widget, recycle_instance)
+       (xm_create_dialog, make_menubar, remove_grabs, make_popup_menu)
+       (make_main, xm_destroy_instance, xm_popup_menu)
+       (set_min_dialog_size, xm_pop_instance, do_call)
+       (xm_internal_update_other_instances, xm_generic_callback)
+       (xm_nosel_callback, xm_pull_down_callback, xm_pop_down_callback)
+       (xm_set_keyboard_focus, xm_set_main_areas, xm_manage_resizing): Change
+       from K&R to prototype.
+
+       * lwlib-Xlw.c (x_print_complete_resource_name): Change from K&R to
+       prototype.
+       (xlw_update_one_value): Reformat.
+
+       * lwlib-Xaw.c (xaw_generic_callback, command_reset)
+       (xaw_update_one_value): Reformat.
+       (xaw_update_one_widget): Reformat and remove dead code.
+       (xaw_scrollbar_scroll, xaw_scrollbar_jump, xaw_create_scrollbar)
+       (xaw_update_scrollbar): Remove (not used).
+       (make_dialog): Change from K&R to prototype. Remove dead code.
+       (xaw_creation_table): Remove scrollbar entry.
+
+2010-07-08  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * lwlib.c (allocate_widget_instance, get_widget_info)
+       (get_widget_instance, find_instance, set_one_value)
+       (update_one_widget_instance, update_all_widget_values)
+       (lw_modify_all_widgets, lw_get_widget, lw_make_widget)
+       (lw_create_widget, lw_pop_all_widgets, lw_show_busy)
+       (lw_refigure_widget, lw_allow_resizing): Remove alternative K&R
+       declarations.
+       * lwlib-Xlw.c (xlw_update_one_widget):
+       (xlw_pop_instance): Likewise.
+       * lwlib-Xaw.c (xaw_update_one_widget, xaw_pop_instance):
+       Likewise.
+       * lwlib-Xm.c (P_): Remove.
+
+2010-07-07  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * lwlib.c (lwlib_memset, lwlib_bcopy): Remove.
+       (malloc_widget_value, free_widget_info, allocate_widget_instance)
+       (lw_separator_p): Replace lwlib_memset, lwlib_bcopy, bzero, bcmp by
+       memset, memcpy, memcmp.
+       * lwlib-utils.c (XtApplyToWidgets): Likewise.
+       * xlwmenu.c (XlwMenuInitialize): Likewise.
+       * lwlib.h (lwlib_bcopy): Remove declaration.
+
+2010-07-05  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * xlwmenu.c (XlwMenuSetValues, XlwMenuInitialize): Correct prototype.
+       (display_menu_item): Remove unused variable gi.
+       (make_windows_if_needed): Remove unused variable screen.
+       (XlwMenuRedisplay): Remove unused variable i.
+
+       * lwlib-Xaw.c: Include <ctype.h> for isdigit.
+       (fill_xft_data, set_text): Remove unused variable screen.
+       (draw_text): Cast bp to FcChar8*.
+       (find_xft_data): Return 0 if inst or xft_data is not set.
+       (wm_delete_window): Correct prototype.  Initialize widget to 0
+       and return if widget is still 0 after loop.
+
+2010-07-04  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * lwlib-Xaw.c: Convert function definitions to standard C.
+       * lwlib-Xlw.c:
+       * lwlib-utils.c:
+       * lwlib.c:
+       * lwlib.h:
+       * xlwmenu.c: Likewise.
+
+2010-07-02  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * lwlib-Xm.c: Remove __P and P_ from .c and .m files.
+       * lwlib-Xm.c:
+       * lwlib.c:
+       * xlwmenu.c: Likewise.
+
+       Remove P_ and __P macros.
+       * lwlib-Xaw.h: Remove P_ and __P macros.
+       * lwlib-Xlw.h:
+       * lwlib-Xm.h:
+       * lwlib-int.h:
+       * lwlib-utils.h:
+       * lwlib.h: Likewise.
+
+2010-05-15  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (mostlyclean): Remove references to non-existent files.
+
+2010-05-13  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * lwlib-Xaw.c (make_dialog): Remove extra arg to XtVaGetSubresources.
+
+2010-05-08  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * xlwmenu.c (XlwMenuDestroy): Remove XtDestroyWidget on subwidgets
+       (Bug #6127).
+
 2010-05-07  Chong Yidong  <cyd@stupidchicken.com>
 
        * Version 23.2 released.
 
+2010-05-06  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (CPP, LN_S, TOP, LN): Remove unused variables.
+
+2010-05-04  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (C_SWITCH_SYSTEM, C_SWITCH_MACHINE):
+       Use @C_SWITCH_SYSTEM@, @C_SWITCH_MACHINE@ instead of
+       @c_switch_system@, @c_switch_machine@.
+
+2010-04-27  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * Makefile.in (C_SWITCH_X_SYSTEM): Define using autoconf.
+
+2010-04-21  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * xlwmenu.c (expose_cb):
+       * lwlib-Xaw.c (fill_xft_data): Declarations before code.
+
+2010-04-17  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * xlwmenu.c: Include Shell.h, remove duplicate declaration of
+       XlwMenuRedisplay.
+       (display_menu_item): Replace ws->window with ws->pixmap, remove
+       call to XftDrawRect.
+       (display_menu): Remove this and that argument.
+       Remove just_compute_this_one_p. Fill pixmap at start and copy it to
+       window at end.
+       (expose_cb): New function.
+       (make_windows_if_needed): Replace XCreateWindow with XtCreatePopup.
+       Add eventhandler for expose to expose_cb.  Remove creation of xft_draw.
+       (create_pixmap_for_menu): New function.
+       (remap_menubar): Pop down menus that aren't the same as in old_stack.
+       Set width, heigh, x, y on widget with XtVaSetValues.
+       Call create_pixmap_for_menu.
+       Replace XUnmapWindow with XtPopdown.
+       Remowe two last parameters to display_menu.
+       (map_event_to_widget_value, XlwMenuRedisplay, Key, Select)
+       (pop_up_menu): Remowe two last parameters to display_menu.
+       (XlwMenuRealize): Call create_pixmap_for_menu, set w and pixmap.
+       Remove call to XftDrawCreate.
+       (XlwMenuDestroy): Free pixmap.  Call XtDestroyWidget instead of
+       XDestroyWindow.
+       (handle_motion_event): Only call handle_single_motion_event once.
+       (set_window_type): New function.
+       (make_windows_if_needed, XlwMenuRealize): Call set_window_type.
+
+       * xlwmenuP.h (window_state): Add pixmap and w.
+
+2010-04-16  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+       * xlwmenu.c (facename_changed): Put function in #ifdef HAVE_XFT.
+
+2010-04-11  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * Makefile.in (C_SWITCH_SYSTEM, C_SWITCH_MACHINE)
+       (C_SWITCH_X_SITE): Define using autoconf.
+
+2010-04-11  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * lwlib-Xaw.c (widget_xft_data): New for Xft data.
+       (fill_xft_data, openFont, get_text_width_and_height)
+       (draw_text, set_text, find_xft_data, command_press)
+       (command_reset): New functions.
+       (xaw_update_one_widget): Call set_text for dialog and buttons
+       if HAVE_XFT.  Also set internalHeight for buttons.
+       (xaw_destroy_instance): Free all Xft related data.
+       (button_actions, buttonTrans): New structures.
+       (make_dialog): Call XtAppAddActions for button_actions.
+       Find xft font to use and call fill_xft_data for widgets.
+       (xaw_create_dialog): Pass instance parameter to make_dialog.
+
+       * lwlib-int.h (_widget_instance): Add Xft data if HAVE_XFT.
+       Override translations for buttons.  If depth is 16 or more, tell
+       Xaw3d to not be nice to colormap.
+       Remove separator widget, use XtNhorizDistance on first right button
+       instead.
+
+2010-04-08  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * xlwmenu.c (xlwmenu_default_font): Make static.
+       (xlwMenuResources): Add XtNfaceName and XtNdefaultFace.
+       (string_width): Use XftTextExtentsUtf8 if HAVE_XFT.
+       (MENU_FONT_HEIGHT, MENU_FONT_ASCENT): Add versions for
+       HAVE_XFT.
+       (size_menu): Set max_rest_width in window_state structure.
+       (display_menu_item): If HAVE_XFT and xft_draw is set, use
+       XftDrawRect and XftDrawStringUtf8 to draw text.
+       (make_windows_if_needed): Set max_rest_width and xft_draw
+       in windows[i].
+       (openXftFont): New.
+       (XlwMenuInitialize): Call openXftFont if HAVE_XFT. If mw->menu.font
+       is not set, load font fixed and save it in xlwmenu_default_font.
+       (XlwMenuInitialize): Set max_rest_width and xft_draw in windows[0].
+       (XlwMenuClassInitialize): Initialize xlwmenu_default_font.
+       (XlwMenuRealize): Set xft_fg, xft_bg, xft_disabled_fg and
+       windows[0].xft_draw if xft_font is set.
+       (XlwMenuDestroy): Destroy all xft_draw and close xft_font.
+       (facename_changed): New.
+       (XlwMenuSetValues): Call facename_changed. If face name did change,
+       close old fonts and destroy xft_draw:s.  Then create new ones.
+
+       * xlwmenu.h (XtNfaceName, XtCFaceName, XtNdefaultFace,
+       XtCDefaultFace): New.
+
+       * xlwmenuP.h (_window_state): Add max_rest_width and xft_draw.
+       (_XlwMenu_part): Add faceName,xft_fg, xft_bg, xft_disabled_fg and
+       xft_font.
+
+2010-03-10  Chong Yidong  <cyd@stupidchicken.com>
+
+       * Branch for 23.2.
+
 2009-10-19  Dan Nicolaescu  <dann@ics.uci.edu>
 
        * xlwmenu.c:
 
        * xlwmenu.c (xlwMenuResources) [HAVE_X_I18N]: Use a fontset for the
        `font' resource.
-       (string_width) [HAVE_X_I18N]: Use XmbTextExtents;
+       (string_width) [HAVE_X_I18N]: Use XmbTextExtents.
        (MENU_FONT_HEIGHT, MENU_FONT_ASCENT): New macros.
        (arrow_width, toggle_button_width, size_menu_item, draw_arrow)
        (draw_toggle, draw_radio, display_menu_item): Use them.
        [USE_XAW]: Include <X11/Xaw/Paned.h>.
        (lwlib_memset, lwlib_bcopy): Explicitly declare return type.
 
-1997-12-20  Richard Stallman  <rms@delysid.gnu.org>
-
-       * lwlib-Xm.c (update_one_menu_entry):
-       Add conditional in case XmNpositionIndex is missing.
-
 1997-12-20  Richard Stallman  <rms@psilocin.gnu.org>
 
        * lwlib-Xm.c (update_one_menu_entry):
        cascade button itself.  This works around a Motif SIGSEGV in the
        function `InSharedMenuHierarchy'.
 
-1994-10-29  Richard Stallman  <rms@duality.gnu.ai.mit.edu>
-
-       * xlwmenu.c (xlwmenu_default_font): New global variable.
-       (XlwMenuInitialize): Use xlwmenu_default_font to default
-       the font if necessary.  Make mw, itself, an argument.
-
 1994-10-26  Richard Stallman  <rms@duality.gnu.ai.mit.edu>
 
        * xlwmenu.c (pop_up_menu): Pass a Display * to x_catch_errors, etc.
index 5645481d1581b524bc3059a2b2ed34a0a2c6f688..13c3f5691f17c0725ceae3a1bfef22156d436006 100644 (file)
@@ -1,6 +1,6 @@
 # Copyright (C) 1992, 1993 Lucid, Inc.
-# Copyright (C) 1994, 2001, 2002, 2003, 2004, 2005, 2006,
-#   2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1994, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+#   2009, 2010  Free Software Foundation, Inc.
 # 
 # This file is part of the Lucid Widget Library.
 # 
 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@
 
 CC=@CC@
 CFLAGS=@CFLAGS@
-CPP=@CPP@
 CPPFLAGS=@CPPFLAGS@
-LN_S=@LN_S@
 RANLIB=@RANLIB@
 # See below--@X_TOOLKIT_TYPE@ is used below.
 USE_X_TOOLKIT=@X_TOOLKIT_TYPE@
 
-              TOP = .
+AR = ar cq
+RM = rm -f
 
-               AR = ar cq
-
-               LN = ln -s
-               RM = rm -f
-
-     LUCID_OBJS = lwlib-Xlw.o xlwmenu.o lwlib-Xaw.o
-     MOTIF_OBJS = lwlib-Xm.o
+LUCID_OBJS = lwlib-Xlw.o xlwmenu.o lwlib-Xaw.o
+MOTIF_OBJS = lwlib-Xm.o
 
 TOOLKIT_DEFINES = 
-   TOOLKIT_OBJS = $(@X_TOOLKIT_TYPE@_OBJS)
+TOOLKIT_OBJS = $(@X_TOOLKIT_TYPE@_OBJS)
 
-           OBJS = lwlib.o $(TOOLKIT_OBJS) lwlib-utils.o
+OBJS = lwlib.o $(TOOLKIT_OBJS) lwlib-utils.o
 
 # ../src is needed to find config.h.
 ALL_CFLAGS= $(C_SWITCH_SYSTEM) $(C_SWITCH_X_SITE) \
-  $(C_SWITCH_X_SYSTEM) $(C_SWITCH_MACHINE) $(CFLAGS) \
+  $(C_SWITCH_X_SYSTEM) $(C_SWITCH_MACHINE) \
+  ${C_WARNINGS_SWITCH} ${PROFILING_CFLAGS} $(CFLAGS) \
   -DHAVE_CONFIG_H -Demacs -I. -I../src -I${srcdir} -I${srcdir}/../src
 
 .c.o:
@@ -78,7 +78,7 @@ lwlib-Xm.o:    lwlib-Xm.c lwlib-Xm.h lwlib.h lwlib-int.h lwlib-utils.h
 xlwmenu.o: xlwmenu.c xlwmenu.h lwlib.h xlwmenuP.h
 
 mostlyclean:
-       $(RM) *.o core errs ,* *.a .emacs_* make.log MakeOut \#*
+       $(RM) *.o core liblw.a \#*
 
 clean: mostlyclean
 distclean: clean
index 2af44cd2e1d8d89c626065c9ff4c3490328cabf8..2e08dd12bd0d088f7d8878124c7b068a35b9c1bf 100644 (file)
@@ -26,6 +26,7 @@ Boston, MA 02110-1301, USA.  */
 
 #include <stdio.h>
 #include <setjmp.h>
+#include <ctype.h>
 
 #include "../src/lisp.h"
 
@@ -54,111 +55,259 @@ Boston, MA 02110-1301, USA.  */
 
 #include <X11/Xatom.h>
 
-static void xaw_generic_callback (/*Widget, XtPointer, XtPointer*/);
+#ifdef HAVE_XFT
+#include <X11/Xft/Xft.h>
+
+struct widget_xft_data
+{
+  Widget widget;
+  XftFont *xft_font;
+  XftDraw *xft_draw;
+  XftColor xft_fg, xft_bg;
+  int p_width, p_height;
+  Pixmap p;
+};
+
+
+#endif
+
+static void xaw_generic_callback (Widget widget,
+                                  XtPointer closure,
+                                  XtPointer call_data);
 
 
 Boolean
-lw_xaw_widget_p (widget)
-     Widget widget;
+lw_xaw_widget_p (Widget widget)
 {
   return (XtIsSubclass (widget, scrollbarWidgetClass) ||
          XtIsSubclass (widget, dialogWidgetClass));
 }
 
-#if 0
+
+#ifdef HAVE_XFT
 static void
-xaw_update_scrollbar (instance, widget, val)
-     widget_instance *instance;
-     Widget widget;
-     widget_value *val;
+fill_xft_data (struct widget_xft_data *data, Widget widget, XftFont *font)
 {
-  if (val->scrollbar_data)
+  Pixel bg, fg;
+  XColor colors[2];
+
+  data->widget = widget;
+  data->xft_font = font;
+  XtVaGetValues (widget,
+                 XtNbackground, &bg,
+                 XtNforeground, &fg,
+                 NULL);
+
+  colors[0].pixel = data->xft_fg.pixel = fg;
+  colors[1].pixel = data->xft_bg.pixel = bg;
+  XQueryColors (XtDisplay (widget),
+                DefaultColormapOfScreen (XtScreen (widget)),
+                colors, 2);
+
+  data->xft_fg.color.alpha = 0xFFFF;
+  data->xft_fg.color.red = colors[0].red;
+  data->xft_fg.color.green = colors[0].green;
+  data->xft_fg.color.blue = colors[0].blue;
+  data->xft_bg.color.alpha = 0xFFFF;
+  data->xft_bg.color.red = colors[1].red;
+  data->xft_bg.color.green = colors[1].green;
+  data->xft_bg.color.blue = colors[1].blue;
+
+  data->p = None;
+  data->xft_draw = 0;
+  data->p_width = data->p_height = 0;
+}
+
+static XftFont*
+openFont (Widget widget, char *name)
+{
+  char *fname = name;
+  int screen = XScreenNumberOfScreen (XtScreen (widget));
+  int len = strlen (fname), i = len-1;
+  XftFont *fn;
+
+  /* Try to convert Gtk-syntax (Sans 9) to Xft syntax Sans-9.  */
+  while (i > 0 && isdigit (fname[i]))
+    --i;
+  if (fname[i] == ' ')
     {
-      scrollbar_values *data = val->scrollbar_data;
-      Dimension height, width;
-      Dimension pos_x, pos_y;
-      int widget_shown, widget_topOfThumb;
-      float new_shown, new_topOfThumb;
-
-      XtVaGetValues (widget,
-                    XtNheight, &height,
-                    XtNwidth, &width,
-                    XtNx, &pos_x,
-                    XtNy, &pos_y,
-                    XtNtopOfThumb, &widget_topOfThumb,
-                    XtNshown, &widget_shown,
-                    NULL);
-
-      /*
-       * First size and position the scrollbar widget.
-       * We need to position it to second-guess the Paned widget's notion
-       * of what should happen when the WMShell gets resized.
-       */
-      if (height != data->scrollbar_height || pos_y != data->scrollbar_pos)
-       {
-         XtConfigureWidget (widget, pos_x, data->scrollbar_pos,
-                            width, data->scrollbar_height, 0);
+      fname = xstrdup (name);
+      fname[i] = '-';
+    }
 
-         XtVaSetValues (widget,
-                        XtNlength, data->scrollbar_height,
-                        XtNthickness, width,
-                        NULL);
-       }
+  fn = XftFontOpenName (XtDisplay (widget), screen, fname);
+  if (fname != name) free (fname);
+
+  return fn;
+}
+
+static int
+get_text_width_and_height (Widget widget, char *text,
+                           XftFont *xft_font,
+                           int *height)
+{
+  int w = 0, h = 0;
+  char *bp = text;
+  
+  while (bp && *bp != '\0')
+    {
+      XGlyphInfo gi;
+      char *cp = strchr (bp, '\n');
+      XftTextExtentsUtf8 (XtDisplay (widget), xft_font,
+                          (FcChar8 *) bp,
+                          cp ? cp - bp : strlen (bp),
+                          &gi);
+      bp = cp ? cp + 1 : NULL;
+      h += xft_font->height;
+      if (w < gi.width) w = gi.width;
+    }
+
+  *height = h;
+  return w;
+}
+
+static void
+draw_text (struct widget_xft_data *data, char *lbl, int inverse)
+{
+  Screen *sc = XtScreen (data->widget);
+  int screen = XScreenNumberOfScreen (sc);
+  int y = data->xft_font->ascent;
+  int x = inverse ? 0 : 2;
+  char *bp = lbl;
+
+  data->xft_draw = XftDrawCreate (XtDisplay (data->widget),
+                                  data->p,
+                                  DefaultVisual (XtDisplay (data->widget),
+                                                 screen),
+                                  DefaultColormapOfScreen (sc));
+  XftDrawRect (data->xft_draw,
+               inverse ? &data->xft_fg : &data->xft_bg,
+               0, 0, data->p_width, data->p_height);
+
+  if (!inverse) y += 2;
+  while (bp && *bp != '\0')
+    {
+      char *cp = strchr (bp, '\n');
+      XftDrawStringUtf8 (data->xft_draw,
+                         inverse ? &data->xft_bg : &data->xft_fg,
+                         data->xft_font, x, y,
+                         (FcChar8 *) bp,
+                         cp ? cp - bp : strlen (bp));
+      bp = cp ? cp + 1 : NULL;
+      /* 1.2 gives reasonable line spacing.  */
+      y += data->xft_font->height * 1.2;
+    }
+
+}
+
+
+static void
+set_text (struct widget_xft_data *data, Widget toplevel, char *lbl, int margin)
+{
+  int width, height;
+
+  width = get_text_width_and_height (data->widget, lbl, data->xft_font,
+                                     &height);
+  data->p_width = width + margin;
+  data->p_height = height + margin;
+
+  data->p = XCreatePixmap (XtDisplay (data->widget),
+                           XtWindow (toplevel),
+                           data->p_width,
+                           data->p_height,
+                           DefaultDepthOfScreen (XtScreen (data->widget)));
+  draw_text (data, lbl, 0);
+  XtVaSetValues (data->widget, XtNbitmap, data->p, NULL);
+}
 
-      /*
-       * Now the size the scrollbar's slider.
-       */
-      new_shown = (float) data->slider_size /
-       (float) (data->maximum - data->minimum);
+static struct widget_xft_data *
+find_xft_data (Widget widget)
+{
+  widget_instance *inst = NULL;
+  Widget parent = XtParent (widget);
+  struct widget_xft_data *data = NULL;
+  int nr;
+  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;
 
-      new_topOfThumb = (float) (data->slider_position - data->minimum) /
-       (float) (data->maximum - data->minimum);
+  for (nr = 0; data == NULL && nr < inst->nr_xft_data; ++nr) 
+    {
+      if (inst->xft_data[nr].widget == widget) 
+        data = &inst->xft_data[nr];
+    }
 
-      if (new_shown > 1.0)
-       new_shown = 1.0;
-      if (new_shown < 0)
-       new_shown = 0;
+  return data;
+}
 
-      if (new_topOfThumb > 1.0)
-       new_topOfThumb = 1.0;
-      if (new_topOfThumb < 0)
-       new_topOfThumb = 0;
+static void
+command_press (Widget widget,
+               XEvent* event,
+               String *params,
+               Cardinal *num_params)
+{
+  struct widget_xft_data *data = find_xft_data (widget);
+  if (data) 
+    {
+      char *lbl;
+      /* Since this isn't used for rectangle buttons, use it to for armed.  */
+      XtVaSetValues (widget, XtNcornerRoundPercent, 1, NULL);
 
-      if (new_shown != widget_shown || new_topOfThumb != widget_topOfThumb)
-       XawScrollbarSetThumb (widget, new_topOfThumb, new_shown);
+      XtVaGetValues (widget, XtNlabel, &lbl, NULL);
+      draw_text (data, lbl, 1);
     }
 }
-#endif
 
-void
-#ifdef PROTOTYPES
-xaw_update_one_widget (widget_instance *instance, Widget widget,
-                      widget_value *val, Boolean deep_p)
-#else
-xaw_update_one_widget (instance, widget, val, deep_p)
-     widget_instance *instance;
-     Widget widget;
-     widget_value *val;
-     Boolean deep_p;
-#endif
+static void
+command_reset (Widget widget,
+               XEvent* event,
+               String *params,
+               Cardinal *num_params)
 {
-#if 0
-  if (XtIsSubclass (widget, scrollbarWidgetClass))
+  struct widget_xft_data *data = find_xft_data (widget);
+  if (data) 
     {
-      xaw_update_scrollbar (instance, widget, val);
+      Dimension cr;
+      XtVaGetValues (widget, XtNcornerRoundPercent, &cr, NULL);
+      if (cr == 1) 
+        {
+          char *lbl;
+          XtVaSetValues (widget, XtNcornerRoundPercent, 0, NULL);
+          XtVaGetValues (widget, XtNlabel, &lbl, NULL);
+          draw_text (data, lbl, 0);
+        }
     }
+}
+
+
 #endif
+
+void
+xaw_update_one_widget (widget_instance *instance,
+                       Widget widget,
+                      widget_value *val,
+                       Boolean deep_p)
+{
   if (XtIsSubclass (widget, dialogWidgetClass))
     {
-      Arg al[1];
-      int ac = 0;
-      XtSetArg (al[ac], XtNlabel, val->contents->value); ac++;
-      XtSetValues (widget,  al, ac);
+
+#ifdef HAVE_XFT
+      if (instance->xft_data && instance->xft_data[0].xft_font)
+        {
+          set_text (&instance->xft_data[0], instance->parent,
+                    val->contents->value, 10);
+        }
+#endif
+      XtVaSetValues (widget, XtNlabel, val->contents->value, NULL);
     }
   else if (XtIsSubclass (widget, commandWidgetClass))
     {
       Dimension bw = 0;
-      Arg al[3];
+      Arg al[10];
+      int ac = 0;
 
       XtVaGetValues (widget, XtNborderWidth, &bw, NULL);
       if (bw == 0)
@@ -174,20 +323,39 @@ xaw_update_one_widget (instance, widget, val, deep_p)
        }
 
       XtSetSensitive (widget, val->enabled);
-      XtSetArg (al[0], XtNlabel, val->value);
+      XtSetArg (al[ac], XtNlabel, val->value);ac++;
       /* Force centered button text.  Se above. */
-      XtSetArg (al[1], XtNjustify, XtJustifyCenter);
-      XtSetValues (widget, al, 2);
+      XtSetArg (al[ac], XtNjustify, XtJustifyCenter);ac++;
+#ifdef HAVE_XFT
+      if (instance->xft_data && instance->xft_data[0].xft_font)
+        {
+          int th;
+          int nr;
+          for (nr = 0; nr < instance->nr_xft_data; ++nr)
+            if (instance->xft_data[nr].widget == widget)
+              break;
+          if (nr < instance->nr_xft_data)
+            {
+              set_text (&instance->xft_data[nr], instance->parent,
+                        val->value, 6);
+
+              /* Must set internalHeight to twice the highlight thickness,
+                 or else it gets overwritten by our pixmap.  Probably a bug.  */
+              XtVaGetValues (widget, XtNhighlightThickness, &th, NULL);
+              XtSetArg (al[ac], XtNinternalHeight, 2*th);ac++;
+            }
+        }
+#endif
+      XtSetValues (widget, al, ac);
       XtRemoveAllCallbacks (widget, XtNcallback);
       XtAddCallback (widget, XtNcallback, xaw_generic_callback, instance);
     }
 }
 
 void
-xaw_update_one_value (instance, widget, val)
-     widget_instance *instance;
-     Widget widget;
-     widget_value *val;
+xaw_update_one_value (widget_instance *instance,
+                      Widget widget,
+                      widget_value *val)
 {
   /* This function is not used by the scrollbars and those are the only
      Athena widget implemented at the moment so do nothing. */
@@ -195,9 +363,30 @@ xaw_update_one_value (instance, widget, val)
 }
 
 void
-xaw_destroy_instance (instance)
-     widget_instance *instance;
+xaw_destroy_instance (widget_instance *instance)
 {
+#ifdef HAVE_XFT
+  if (instance->xft_data) 
+    {
+      int 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) 
+            {
+              XtVaSetValues (instance->xft_data[i].widget, XtNbitmap, None,
+                             NULL);
+              XFreePixmap (XtDisplay (instance->widget),
+                           instance->xft_data[i].p);
+            }
+        }
+      if (instance->xft_data[0].xft_font)
+        XftFontClose (XtDisplay (instance->widget),
+                      instance->xft_data[0].xft_font);
+      free (instance->xft_data);
+    }
+#endif
   if (XtIsSubclass (instance->widget, dialogWidgetClass))
     /* Need to destroy the Shell too. */
     XtDestroyWidget (XtParent (instance->widget));
@@ -206,22 +395,14 @@ xaw_destroy_instance (instance)
 }
 
 void
-xaw_popup_menu (widget, event)
-     Widget widget;
-     XEvent *event;
+xaw_popup_menu (Widget widget, XEvent *event)
 {
   /* An Athena menubar has not been implemented. */
   return;
 }
 
 void
-#ifdef PROTOTYPES
 xaw_pop_instance (widget_instance *instance, Boolean up)
-#else
-xaw_pop_instance (instance, up)
-     widget_instance *instance;
-     Boolean up;
-#endif
 {
   Widget widget = instance->widget;
 
@@ -292,24 +473,39 @@ static char overrideTrans[] =
 /* Dialogs pop down on any key press */
 static char dialogOverride[] =
        "<KeyPress>Escape:      lwlib_delete_dialog()";
-static void wm_delete_window();
+static void wm_delete_window (Widget w,
+                              XEvent *event,
+                              String *params,
+                              Cardinal *num_params);
 static XtActionsRec xaw_actions [] = {
   {"lwlib_delete_dialog", wm_delete_window}
 };
 static Boolean actions_initted = False;
 
+#ifdef HAVE_XFT
+static XtActionsRec button_actions[] = 
+  {
+    { "my_reset", command_reset },
+    { "my_press", command_press },
+  };
+char buttonTrans[] =
+  "<Leave>: reset() my_reset()\n"
+  "<Btn1Down>: set() my_press()\n"
+  "<Btn1Up>:  my_reset() notify() unset()\n";
+#endif
+
 static Widget
-make_dialog (name, parent, pop_up_p, shell_title, icon_name, text_input_slot, radio_box, list, left_buttons, right_buttons)
-     char* name;
-     Widget parent;
-     Boolean pop_up_p;
-     char* shell_title;
-     char* icon_name;
-     Boolean text_input_slot;
-     Boolean radio_box;
-     Boolean list;
-     int left_buttons;
-     int right_buttons;
+make_dialog (char* name,
+             Widget parent,
+             Boolean pop_up_p,
+             char* shell_title,
+             char* icon_name,
+             Boolean text_input_slot,
+             Boolean radio_box,
+             Boolean list,
+             int left_buttons,
+             int right_buttons,
+             widget_instance *instance)
 {
   Arg av [20];
   int ac = 0;
@@ -319,6 +515,10 @@ make_dialog (name, parent, pop_up_p, shell_title, icon_name, text_input_slot, ra
   Widget dialog;
   Widget button;
   XtTranslations override;
+#ifdef HAVE_XFT
+  XftFont *xft_font = 0;
+  XtTranslations button_override;
+#endif
 
   if (! pop_up_p) abort (); /* not implemented */
   if (text_input_slot) abort (); /* not implemented */
@@ -330,6 +530,10 @@ make_dialog (name, parent, pop_up_p, shell_title, icon_name, text_input_slot, ra
       XtAppContext app = XtWidgetToApplicationContext (parent);
       XtAppAddActions (app, xaw_actions,
                       sizeof (xaw_actions) / sizeof (xaw_actions[0]));
+#ifdef HAVE_XFT
+      XtAppAddActions (app, button_actions,
+                      sizeof (button_actions) / sizeof (button_actions[0]));
+#endif
       actions_initted = True;
     }
 
@@ -351,6 +555,49 @@ make_dialog (name, parent, pop_up_p, shell_title, icon_name, text_input_slot, ra
   override = XtParseTranslationTable (dialogOverride);
   XtOverrideTranslations (dialog, override);
 
+#ifdef HAVE_XFT
+  {
+    int num;
+    Widget *ch = NULL;
+    Widget w = 0;
+    XtVaGetValues (dialog,
+                   XtNnumChildren, &num,
+                   XtNchildren, &ch, NULL);
+    for (i = 0; i < num; ++i) 
+      {
+        if (!XtIsSubclass (ch[i], commandWidgetClass)
+            && XtIsSubclass (ch[i], labelWidgetClass))
+          {
+            w = ch[i];
+            break;
+          }
+      }
+    instance->xft_data = 0;
+    instance->nr_xft_data = 0;
+    if (w) 
+      {
+        XtResource rec[] = 
+          { { "faceName", "FaceName", XtRString, sizeof(String), 0, XtRString,
+              (XtPointer)"Sans-14" }};
+        char *faceName;
+        XtVaGetSubresources (dialog, &faceName, "Dialog", "dialog",
+                             rec, 1, (String)NULL);
+        if (strcmp ("none", faceName) != 0)
+          xft_font = openFont (dialog, faceName);
+        if (xft_font) 
+          {
+            instance->nr_xft_data = left_buttons + right_buttons + 1;
+            instance->xft_data = calloc (instance->nr_xft_data,
+                                         sizeof(*instance->xft_data));
+
+            fill_xft_data (&instance->xft_data[0], w, xft_font);
+          }
+      }
+
+    button_override = XtParseTranslationTable (buttonTrans);
+  }
+#endif
+
   bc = 0;
   button = 0;
   for (i = 0; i < left_buttons; i++)
@@ -362,59 +609,63 @@ make_dialog (name, parent, pop_up_p, shell_title, icon_name, text_input_slot, ra
       XtSetArg (av [ac], XtNtop, XtChainBottom); ac++;
       XtSetArg (av [ac], XtNbottom, XtChainBottom); ac++;
       XtSetArg (av [ac], XtNresizable, True); ac++;
+#ifdef HAVE_XAW3D
+      if (DefaultDepthOfScreen (XtScreen (dialog)) >= 16)
+        {
+          /* Turn of dithered shadow if we can.  Looks bad */
+          XtSetArg (av [ac], "beNiceToColormap", False); ac++;
+        }
+#endif
       sprintf (button_name, "button%d", ++bc);
       button = XtCreateManagedWidget (button_name, commandWidgetClass,
                                      dialog, av, ac);
+#ifdef HAVE_XFT
+      if (xft_font)
+        {
+          fill_xft_data (&instance->xft_data[bc], button, xft_font);
+          XtOverrideTranslations (button, button_override);
+        }
+#endif
     }
-  if (right_buttons)
-    {
-      /* Create a separator
 
-        I want the separator to take up the slack between the buttons on
-        the right and the buttons on the left (that is I want the buttons
-        after the separator to be packed against the right edge of the
-        window) but I can't seem to make it do it.
-       */
-      ac = 0;
-      XtSetArg (av [ac], XtNfromHoriz, button); ac++;
-/*  XtSetArg (av [ac], XtNfromVert, XtNameToWidget (dialog, "label")); ac++; */
-      XtSetArg (av [ac], XtNleft, XtChainLeft); ac++;
-      XtSetArg (av [ac], XtNright, XtChainRight); ac++;
-      XtSetArg (av [ac], XtNtop, XtChainBottom); ac++;
-      XtSetArg (av [ac], XtNbottom, XtChainBottom); ac++;
-      XtSetArg (av [ac], XtNlabel, ""); ac++;
-      XtSetArg (av [ac], XtNwidth, 30); ac++;  /* #### aaack!! */
-      XtSetArg (av [ac], XtNborderWidth, 0); ac++;
-      XtSetArg (av [ac], XtNshapeStyle, XmuShapeRectangle); ac++;
-      XtSetArg (av [ac], XtNresizable, False); ac++;
-      XtSetArg (av [ac], XtNsensitive, False); ac++;
-      button = XtCreateManagedWidget ("separator",
-                                     /* labelWidgetClass, */
-                                     /* This has to be Command to fake out
-                                        the Dialog widget... */
-                                     commandWidgetClass,
-                                     dialog, av, ac);
-    }
   for (i = 0; i < right_buttons; i++)
     {
       ac = 0;
       XtSetArg (av [ac], XtNfromHoriz, button); ac++;
+      if (i == 0) 
+        {
+          /* Separator to the other buttons. */
+          XtSetArg (av [ac], XtNhorizDistance, 30); ac++;
+        }
       XtSetArg (av [ac], XtNleft, XtChainRight); ac++;
       XtSetArg (av [ac], XtNright, XtChainRight); ac++;
       XtSetArg (av [ac], XtNtop, XtChainBottom); ac++;
       XtSetArg (av [ac], XtNbottom, XtChainBottom); ac++;
       XtSetArg (av [ac], XtNresizable, True); ac++;
+#ifdef HAVE_XAW3D
+      if (DefaultDepthOfScreen (XtScreen (dialog)) >= 16)
+        {
+          /* Turn of dithered shadow if we can.  Looks bad */
+          XtSetArg (av [ac], "beNiceToColormap", False); ac++;
+        }
+#endif
       sprintf (button_name, "button%d", ++bc);
       button = XtCreateManagedWidget (button_name, commandWidgetClass,
                                      dialog, av, ac);
+#ifdef HAVE_XFT
+      if (xft_font)
+        {
+          fill_xft_data (&instance->xft_data[bc], button, xft_font);
+          XtOverrideTranslations (button, button_override);
+        }
+#endif
     }
 
   return dialog;
 }
 
 Widget
-xaw_create_dialog (instance)
-     widget_instance* instance;
+xaw_create_dialog (widget_instance *instance)
 {
   char *name = instance->info->type;
   Widget parent = instance->parent;
@@ -472,17 +723,13 @@ xaw_create_dialog (instance)
 
   widget = make_dialog (name, parent, pop_up_p,
                        shell_name, icon_name, text_input_slot, radio_box,
-                       list, left_buttons, right_buttons);
-
+                       list, left_buttons, right_buttons, instance);
   return widget;
 }
 
 
 static void
-xaw_generic_callback (widget, closure, call_data)
-     Widget widget;
-     XtPointer closure;
-     XtPointer call_data;
+xaw_generic_callback (Widget widget, XtPointer closure, XtPointer call_data)
 {
   widget_instance *instance = (widget_instance *) closure;
   Widget instance_widget;
@@ -502,10 +749,6 @@ xaw_generic_callback (widget, closure, call_data)
 
   id = instance->info->id;
 
-#if 0
-  user_data = NULL;
-  XtVaGetValues (widget, XtNuserData, &user_data, NULL);
-#else
   /* Damn!  Athena doesn't give us a way to hang our own data on the
      buttons, so we have to go find it...  I guess this assumes that
      all instances of a button have the same call data. */
@@ -521,23 +764,22 @@ xaw_generic_callback (widget, closure, call_data)
     if (! val) abort ();
     user_data = val->call_data;
   }
-#endif
 
   if (instance->info->selection_cb)
     instance->info->selection_cb (widget, id, user_data);
 }
 
 static void
-wm_delete_window (w, closure, call_data)
-     Widget w;
-     XtPointer closure;
-     XtPointer call_data;
+wm_delete_window (Widget w,
+                  XEvent *event,
+                  String *params,
+                  Cardinal *num_params)
 {
   LWLIB_ID id;
   Cardinal nkids;
   int i;
   Widget *kids = 0;
-  Widget widget, shell;
+  Widget widget = 0, shell;
 
   if (XtIsSubclass (w, dialogWidgetClass))
     shell = XtParent (w);
@@ -556,6 +798,8 @@ wm_delete_window (w, closure, call_data)
       if (XtIsSubclass (widget, dialogWidgetClass))
        break;
     }
+  if (! widget) return;
+
   id = lw_get_widget_id (widget);
   if (! id) abort ();
 
@@ -570,111 +814,9 @@ wm_delete_window (w, closure, call_data)
 }
 
 \f
-/* Scrollbars */
-
-#if 0
-static void
-xaw_scrollbar_scroll (widget, closure, call_data)
-     Widget widget;
-     XtPointer closure;
-     XtPointer call_data;
-{
-  widget_instance *instance = (widget_instance *) closure;
-  LWLIB_ID id;
-  scroll_event event_data;
-
-  if (!instance || widget->core.being_destroyed)
-    return;
-
-  id = instance->info->id;
-  event_data.slider_value = 0;
-  event_data.time = 0;
-
-  if ((int) call_data > 0)
-    event_data.action = SCROLLBAR_PAGE_DOWN;
-  else
-    event_data.action = SCROLLBAR_PAGE_UP;
-
-  if (instance->info->pre_activate_cb)
-    instance->info->pre_activate_cb (widget, id, (XtPointer) &event_data);
-}
-#endif
-
-#if 0
-static void
-xaw_scrollbar_jump (widget, closure, call_data)
-     Widget widget;
-     XtPointer closure;
-     XtPointer call_data;
-{
-  widget_instance *instance = (widget_instance *) closure;
-  LWLIB_ID id;
-  scroll_event event_data;
-  scrollbar_values *val =
-    (scrollbar_values *) instance->info->val->scrollbar_data;
-  float percent;
-
-  if (!instance || widget->core.being_destroyed)
-    return;
-
-  id = instance->info->id;
-
-  percent = * (float *) call_data;
-  event_data.slider_value =
-    (int) (percent * (float) (val->maximum - val->minimum)) + val->minimum;
-
-  event_data.time = 0;
-  event_data.action = SCROLLBAR_DRAG;
-
-  if (instance->info->pre_activate_cb)
-    instance->info->pre_activate_cb (widget, id, (XtPointer) &event_data);
-}
-#endif
-
-static Widget
-xaw_create_scrollbar (instance)
-     widget_instance *instance;
-{
-#if 0
-  Arg av[20];
-  int ac = 0;
-  Dimension width;
-  Widget scrollbar;
-
-  XtVaGetValues (instance->parent, XtNwidth, &width, NULL);
-
-  XtSetArg (av[ac], XtNshowGrip, 0); ac++;
-  XtSetArg (av[ac], XtNresizeToPreferred, 1); ac++;
-  XtSetArg (av[ac], XtNallowResize, True); ac++;
-  XtSetArg (av[ac], XtNskipAdjust, True); ac++;
-  XtSetArg (av[ac], XtNwidth, width); ac++;
-  XtSetArg (av[ac], XtNmappedWhenManaged, True); ac++;
-
-  scrollbar =
-    XtCreateWidget (instance->info->name, scrollbarWidgetClass,
-                   instance->parent, av, ac);
-
-  /* We have to force the border width to be 0 otherwise the
-     geometry manager likes to start looping for awhile... */
-  XtVaSetValues (scrollbar, XtNborderWidth, 0, NULL);
-
-  XtRemoveAllCallbacks (scrollbar, "jumpProc");
-  XtRemoveAllCallbacks (scrollbar, "scrollProc");
-
-  XtAddCallback (scrollbar, "jumpProc", xaw_scrollbar_jump,
-                (XtPointer) instance);
-  XtAddCallback (scrollbar, "scrollProc", xaw_scrollbar_scroll,
-                (XtPointer) instance);
-
-  return scrollbar;
-#else
-  return NULL;
-#endif
-}
 
 static Widget
-xaw_create_main (instance)
-     widget_instance *instance;
+xaw_create_main (widget_instance *instance)
 {
   Arg al[1];
   int ac;
@@ -689,7 +831,6 @@ xaw_create_main (instance)
 widget_creation_entry
 xaw_creation_table [] =
 {
-  {"scrollbar",                        xaw_create_scrollbar},
   {"main",                     xaw_create_main},
   {NULL, NULL}
 };
index 41b8013ee644f5a51894e89a19a018b1dabcf9a5..e359b95359cd6e0c276698734d9bccd275085107 100644 (file)
@@ -6,25 +6,25 @@
 extern widget_creation_entry xaw_creation_table [];
 
 Widget
-xaw_create_dialog __P ((widget_instance*));
+xaw_create_dialog (widget_instance*);
 
 Boolean
-lw_xaw_widget_p __P ((Widget));
+lw_xaw_widget_p (Widget);
 
 void
-xaw_update_one_widget __P ((widget_instance *, Widget, widget_value *, Boolean));
+xaw_update_one_widget (widget_instance *, Widget, widget_value *, Boolean);
 
 void
-xaw_update_one_value __P ((widget_instance *, Widget, widget_value *));
+xaw_update_one_value (widget_instance *, Widget, widget_value *);
 
 void
-xaw_destroy_instance __P ((widget_instance *));
+xaw_destroy_instance (widget_instance *);
 
 void
-xaw_popup_menu __P ((Widget, XEvent *));
+xaw_popup_menu (Widget, XEvent *);
 
 void
-xaw_pop_instance __P ((widget_instance *, Boolean));
+xaw_pop_instance (widget_instance *, Boolean);
 
 #endif /* LWLIB_XAW_H */
 
index 115997d361237d870a6cd65c70c9947960509698..9a0ff10b11fd53e5db6b4f680b3ff874f2d8f85d 100644 (file)
@@ -43,8 +43,7 @@ Boston, MA 02110-1301, USA.  */
    This is sometimes handy to have available.  */
 
 void
-x_print_complete_resource_name (widget)
-     Widget widget;
+x_print_complete_resource_name (Widget widget)
 {
   int i;
   String names[100];
@@ -72,10 +71,7 @@ x_print_complete_resource_name (widget)
    if there isn't any highlighted menu item.  */
 
 static void
-highlight_hook (w, client_data, call_data)
-     Widget w;
-     XtPointer client_data;
-     XtPointer call_data;
+highlight_hook (Widget w, XtPointer client_data, XtPointer call_data)
 {
   widget_instance *instance = (widget_instance *) client_data;
 
@@ -85,29 +81,20 @@ highlight_hook (w, client_data, call_data)
 }
 
 static void
-enter_hook (w, client_data, call_data)
-     Widget w;
-     XtPointer client_data;
-     XtPointer call_data;
+enter_hook (Widget w, XtPointer client_data, XtPointer call_data)
 {
   highlight_hook (w, client_data, call_data);
 }
 
 static void
-leave_hook (w, client_data, call_data)
-     Widget w;
-     XtPointer client_data;
-     XtPointer call_data;
+leave_hook (Widget w, XtPointer client_data, XtPointer call_data)
 {
   highlight_hook (w, client_data, NULL);
 }
 
 
 static void
-pre_hook (w, client_data, call_data)
-     Widget w;
-     XtPointer client_data;
-     XtPointer call_data;
+pre_hook (Widget w, XtPointer client_data, XtPointer call_data)
 {
   widget_instance* instance = (widget_instance*)client_data;
   widget_value* val;
@@ -122,10 +109,7 @@ pre_hook (w, client_data, call_data)
 }
 
 static void
-pick_hook (w, client_data, call_data)
-     Widget w;
-     XtPointer client_data;
-     XtPointer call_data;
+pick_hook (Widget w, XtPointer client_data, XtPointer call_data)
 {
   widget_instance* instance = (widget_instance*)client_data;
   widget_value* contents_val = (widget_value*)call_data;
@@ -150,8 +134,7 @@ pick_hook (w, client_data, call_data)
 \f/* creation functions */
 
 static Widget
-xlw_create_menubar (instance)
-     widget_instance* instance;
+xlw_create_menubar (widget_instance *instance)
 {
   Widget widget;
   Arg al[5];
@@ -178,8 +161,7 @@ xlw_create_menubar (instance)
 }
 
 static Widget
-xlw_create_popup_menu (instance)
-     widget_instance* instance;
+xlw_create_popup_menu (widget_instance *instance)
 {
   Widget popup_shell
     = XtCreatePopupShell (instance->info->name, overrideShellWidgetClass,
@@ -214,8 +196,7 @@ xlw_creation_table [] =
 };
 
 Boolean
-lw_lucid_widget_p (widget)
-     Widget widget;
+lw_lucid_widget_p (Widget widget)
 {
   WidgetClass the_class = XtClass (widget);
 
@@ -228,16 +209,8 @@ lw_lucid_widget_p (widget)
 }
 
 void
-#ifdef PROTOTYPES
 xlw_update_one_widget (widget_instance* instance, Widget widget,
                       widget_value* val, Boolean deep_p)
-#else
-xlw_update_one_widget (instance, widget, val, deep_p)
-     widget_instance* instance;
-     Widget widget;
-     widget_value* val;
-     Boolean deep_p;
-#endif
 {
   Arg al[1];
 
@@ -249,29 +222,20 @@ xlw_update_one_widget (instance, widget, val, deep_p)
 }
 
 void
-xlw_update_one_value (instance, widget, val)
-     widget_instance* instance;
-     Widget widget;
-     widget_value* val;
+xlw_update_one_value (widget_instance *instance,
+                      Widget widget,
+                      widget_value *val)
 {
   return;
 }
 
 void
-#ifdef PROTOTYPES
 xlw_pop_instance (widget_instance* instance, Boolean up)
-#else
-xlw_pop_instance (instance, up)
-     widget_instance* instance;
-     Boolean up;
-#endif
 {
 }
 
 void
-xlw_popup_menu (widget, event)
-     Widget widget;
-     XEvent *event;
+xlw_popup_menu (Widget widget, XEvent *event)
 {
   XlwMenuWidget mw;
 
@@ -304,8 +268,7 @@ xlw_popup_menu (widget, event)
 
 \f/* Destruction of instances */
 void
-xlw_destroy_instance (instance)
-     widget_instance* instance;
+xlw_destroy_instance (widget_instance *instance)
 {
   if (instance->widget)
     XtDestroyWidget (instance->widget);
index 36f8244101bb5f43eff840d02e539e99a283dd07..cb2125ee17fb473f1c596bda3d98e91b4f75d4d9 100644 (file)
@@ -7,24 +7,24 @@ extern widget_creation_entry xlw_creation_table [];
 extern widget_creation_function xlw_create_dialog;
 
 Boolean
-lw_lucid_widget_p __P ((Widget widget));
+lw_lucid_widget_p (Widget widget);
 
 void
-xlw_update_one_widget __P ((widget_instance* instance, Widget widget,
-                      widget_value* val, Boolean deep_p));
+xlw_update_one_widget (widget_instance* instance, Widget widget,
+                       widget_value* val, Boolean deep_p);
 
 void
-xlw_update_one_value __P ((widget_instance* instance, Widget widget,
-                     widget_value* val));
+xlw_update_one_value (widget_instance* instance, Widget widget,
+                      widget_value* val);
 
 void
-xlw_destroy_instance __P ((widget_instance* instance));
+xlw_destroy_instance (widget_instance* instance);
 
 void
-xlw_pop_instance __P ((widget_instance* instance, Boolean up));
+xlw_pop_instance (widget_instance* instance, Boolean up);
 
 void
-xlw_popup_menu __P ((Widget widget, XEvent * event));
+xlw_popup_menu (Widget widget, XEvent * event);
 
 #endif /* LWLIB_XLW_H */
 
index ed203e26bf42f198e6fca84c2bf8096570c091e0..1116a6a54408db2f38c4492d2524b18d2eb9cef9 100644 (file)
@@ -65,13 +65,6 @@ Boston, MA 02110-1301, USA.  */
 #include <Xm/DialogS.h>
 #include <Xm/Form.h>
 
-#undef P_
-#if defined __STDC__ || defined PROTOTYPES
-#define P_(X) X
-#else
-#define P_(X) ()
-#endif
-
 enum do_call_type { pre_activate, selection, no_selection, post_activate };
 
 
@@ -86,63 +79,63 @@ typedef struct _destroyed_instance
   struct _destroyed_instance*  next;
 } destroyed_instance;
 
-static destroyed_instance *make_destroyed_instance P_ ((char *, char *,
-                                                       Widget, Widget,
-                                                       Boolean));
-static void free_destroyed_instance P_ ((destroyed_instance*));
-Widget first_child P_ ((Widget));
-Boolean lw_motif_widget_p P_ ((Widget));
-static XmString resource_motif_string P_ ((Widget, char *));
-static void destroy_all_children P_ ((Widget, int));
-static void xm_update_label P_ ((widget_instance *, Widget, widget_value *));
-static void xm_update_list P_ ((widget_instance *, Widget, widget_value *));
-static void xm_update_pushbutton P_ ((widget_instance *, Widget,
-                                     widget_value *));
-static void xm_update_cascadebutton P_ ((widget_instance *, Widget,
-                                        widget_value *));
-static void xm_update_toggle P_ ((widget_instance *, Widget, widget_value *));
-static void xm_update_radiobox P_ ((widget_instance *, Widget, widget_value *));
-static void make_menu_in_widget P_ ((widget_instance *, Widget,
-                                    widget_value *, int));
-static void update_one_menu_entry P_ ((widget_instance *, Widget,
-                                      widget_value *, Boolean));
-static void xm_update_menu P_ ((widget_instance *, Widget, widget_value *,
-                               Boolean));
-static void xm_update_text P_ ((widget_instance *, Widget, widget_value *));
-static void xm_update_text_field P_ ((widget_instance *, Widget,
-                                     widget_value *));
-void xm_update_one_value P_ ((widget_instance *, Widget, widget_value *));
-static void activate_button P_ ((Widget, XtPointer, XtPointer));
-static Widget make_dialog P_ ((char *, Widget, Boolean, char *, char *,
-                              Boolean, Boolean, Boolean, int, int));
-static destroyed_instance* find_matching_instance P_ ((widget_instance*));
-static void mark_dead_instance_destroyed P_ ((Widget, XtPointer, XtPointer));
-static void recenter_widget P_ ((Widget));
-static Widget recycle_instance P_ ((destroyed_instance*));
-Widget xm_create_dialog P_ ((widget_instance*));
-static Widget make_menubar P_ ((widget_instance*));
-static void remove_grabs P_ ((Widget, XtPointer, XtPointer));
-static Widget make_popup_menu P_ ((widget_instance*));
-static Widget make_main P_ ((widget_instance*));
-void xm_destroy_instance P_ ((widget_instance*));
-void xm_popup_menu P_ ((Widget, XEvent *));
-static void set_min_dialog_size P_ ((Widget));
-static void do_call P_ ((Widget, XtPointer, enum do_call_type));
-static void xm_generic_callback P_ ((Widget, XtPointer, XtPointer));
-static void xm_nosel_callback P_ ((Widget, XtPointer, XtPointer));
-static void xm_pull_down_callback P_ ((Widget, XtPointer, XtPointer));
-static void xm_pop_down_callback P_ ((Widget, XtPointer, XtPointer));
-void xm_set_keyboard_focus P_ ((Widget, Widget));
-void xm_set_main_areas P_ ((Widget, Widget, Widget));
-static void xm_internal_update_other_instances P_ ((Widget, XtPointer,
-                                                   XtPointer));
-static void xm_arm_callback P_ ((Widget, XtPointer, XtPointer));
+static destroyed_instance *make_destroyed_instance (char *, char *,
+                                                    Widget, Widget,
+                                                    Boolean);
+static void free_destroyed_instance (destroyed_instance*);
+Widget first_child (Widget);
+Boolean lw_motif_widget_p (Widget);
+static XmString resource_motif_string (Widget, char *);
+static void destroy_all_children (Widget, int);
+static void xm_update_label (widget_instance *, Widget, widget_value *);
+static void xm_update_list (widget_instance *, Widget, widget_value *);
+static void xm_update_pushbutton (widget_instance *, Widget,
+                                  widget_value *);
+static void xm_update_cascadebutton (widget_instance *, Widget,
+                                     widget_value *);
+static void xm_update_toggle (widget_instance *, Widget, widget_value *);
+static void xm_update_radiobox (widget_instance *, Widget, widget_value *);
+static void make_menu_in_widget (widget_instance *, Widget,
+                                 widget_value *, int);
+static void update_one_menu_entry (widget_instance *, Widget,
+                                   widget_value *, Boolean);
+static void xm_update_menu (widget_instance *, Widget, widget_value *,
+                            Boolean);
+static void xm_update_text (widget_instance *, Widget, widget_value *);
+static void xm_update_text_field (widget_instance *, Widget,
+                                  widget_value *);
+void xm_update_one_value (widget_instance *, Widget, widget_value *);
+static void activate_button (Widget, XtPointer, XtPointer);
+static Widget make_dialog (char *, Widget, Boolean, char *, char *,
+                           Boolean, Boolean, Boolean, int, int);
+static destroyed_instance* find_matching_instance (widget_instance*);
+static void mark_dead_instance_destroyed (Widget, XtPointer, XtPointer);
+static void recenter_widget (Widget);
+static Widget recycle_instance (destroyed_instance*);
+Widget xm_create_dialog (widget_instance*);
+static Widget make_menubar (widget_instance*);
+static void remove_grabs (Widget, XtPointer, XtPointer);
+static Widget make_popup_menu (widget_instance*);
+static Widget make_main (widget_instance*);
+void xm_destroy_instance (widget_instance*);
+void xm_popup_menu (Widget, XEvent *);
+static void set_min_dialog_size (Widget);
+static void do_call (Widget, XtPointer, enum do_call_type);
+static void xm_generic_callback (Widget, XtPointer, XtPointer);
+static void xm_nosel_callback (Widget, XtPointer, XtPointer);
+static void xm_pull_down_callback (Widget, XtPointer, XtPointer);
+static void xm_pop_down_callback (Widget, XtPointer, XtPointer);
+void xm_set_keyboard_focus (Widget, Widget);
+void xm_set_main_areas (Widget, Widget, Widget);
+static void xm_internal_update_other_instances (Widget, XtPointer,
+                                                XtPointer);
+static void xm_arm_callback (Widget, XtPointer, XtPointer);
 
 #if 0
-void xm_update_one_widget P_ ((widget_instance *, Widget, widget_value *,
-                              Boolean));
-void xm_pop_instance P_ ((widget_instance*, Boolean));
-void xm_manage_resizing P_ ((Widget, Boolean));
+void xm_update_one_widget (widget_instance *, Widget, widget_value *,
+                           Boolean);
+void xm_pop_instance (widget_instance*, Boolean);
+void xm_manage_resizing (Widget, Boolean);
 #endif
 
 
@@ -152,8 +145,7 @@ void xm_manage_resizing P_ ((Widget, Boolean));
    This is sometimes handy to have available.  */
 
 void
-x_print_complete_resource_name (widget)
-     Widget widget;
+x_print_complete_resource_name (Widget widget)
 {
   int i;
   String names[100];
@@ -175,12 +167,11 @@ x_print_complete_resource_name (widget)
 static destroyed_instance *all_destroyed_instances = NULL;
 
 static destroyed_instance*
-make_destroyed_instance (name, type, widget, parent, pop_up_p)
-     char* name;
-     char* type;
-     Widget widget;
-     Widget parent;
-     Boolean pop_up_p;
+make_destroyed_instance (char* name,
+                         char* type,
+                         Widget widget,
+                         Widget parent,
+                         Boolean pop_up_p)
 {
   destroyed_instance* instance =
     (destroyed_instance*)malloc (sizeof (destroyed_instance));
@@ -194,8 +185,7 @@ make_destroyed_instance (name, type, widget, parent, pop_up_p)
 }
 
 static void
-free_destroyed_instance (instance)
-     destroyed_instance* instance;
+free_destroyed_instance (destroyed_instance* instance)
 {
   free (instance->name);
   free (instance->type);
@@ -204,15 +194,13 @@ free_destroyed_instance (instance)
 
 \f/* motif utility functions */
 Widget
-first_child (widget)
-     Widget widget;
+first_child (Widget widget)
 {
   return ((CompositeWidget)widget)->composite.children [0];
 }
 
 Boolean
-lw_motif_widget_p (widget)
-     Widget widget;
+lw_motif_widget_p (Widget widget)
 {
   return
     XtClass (widget) == xmDialogShellWidgetClass
@@ -220,9 +208,8 @@ lw_motif_widget_p (widget)
 }
 
 static XmString
-resource_motif_string (widget, name)
-     Widget widget;
-     char* name;
+resource_motif_string (Widget widget,
+                       char* name)
 {
   XtResource resource;
   XmString result = 0;
@@ -244,9 +231,8 @@ resource_motif_string (widget, name)
    starting with number FIRST_CHILD_TO_DESTROY.  */
 
 static void
-destroy_all_children (widget, first_child_to_destroy)
-     Widget widget;
-     int first_child_to_destroy;
+destroy_all_children (Widget widget,
+                      int first_child_to_destroy)
 {
   Widget* children;
   unsigned int number;
@@ -292,9 +278,7 @@ destroy_all_children (widget, first_child_to_destroy)
    is called.  */
 
 static void
-xm_arm_callback (w, client_data, call_data)
-     Widget w;
-     XtPointer client_data, call_data;
+xm_arm_callback (Widget w, XtPointer client_data, XtPointer call_data)
 {
   XmPushButtonCallbackStruct *cbs = (XmPushButtonCallbackStruct *) call_data;
   widget_value *wv = (widget_value *) client_data;
@@ -346,10 +330,9 @@ xm_arm_callback (w, client_data, call_data)
    not null, and contains the label string to display.  */
 
 static void
-xm_update_label (instance, widget, val)
-     widget_instance* instance;
-     Widget widget;
-     widget_value* val;
+xm_update_label (widget_instance* instance,
+                 Widget widget,
+                 widget_value* val)
 {
   XmString res_string = 0;
   XmString built_string = 0;
@@ -397,10 +380,9 @@ xm_update_label (instance, widget, val)
 
 \f/* update of list */
 static void
-xm_update_list (instance, widget, val)
-     widget_instance* instance;
-     Widget widget;
-     widget_value* val;
+xm_update_list (widget_instance* instance,
+                Widget widget,
+                widget_value* val)
 {
   widget_value* cur;
   int i;
@@ -421,10 +403,9 @@ xm_update_list (instance, widget, val)
 
 \f/* update of buttons */
 static void
-xm_update_pushbutton (instance, widget, val)
-     widget_instance* instance;
-     Widget widget;
-     widget_value* val;
+xm_update_pushbutton (widget_instance* instance,
+                      Widget widget,
+                      widget_value* val)
 {
   XtVaSetValues (widget, XmNalignment, XmALIGNMENT_CENTER, NULL);
   XtRemoveAllCallbacks (widget, XmNactivateCallback);
@@ -432,10 +413,9 @@ xm_update_pushbutton (instance, widget, val)
 }
 
 static void
-xm_update_cascadebutton (instance, widget, val)
-     widget_instance* instance;
-     Widget widget;
-     widget_value* val;
+xm_update_cascadebutton (widget_instance* instance,
+                         Widget widget,
+                         widget_value* val)
 {
   /* Should also rebuild the menu by calling ...update_menu... */
   XtRemoveAllCallbacks (widget, XmNcascadingCallback);
@@ -445,10 +425,9 @@ xm_update_cascadebutton (instance, widget, val)
 
 \f/* update toggle and radiobox */
 static void
-xm_update_toggle (instance, widget, val)
-     widget_instance* instance;
-     Widget widget;
-     widget_value* val;
+xm_update_toggle (widget_instance* instance,
+                  Widget widget,
+                  widget_value* val)
 {
   XtRemoveAllCallbacks (widget, XmNvalueChangedCallback);
   XtAddCallback (widget, XmNvalueChangedCallback,
@@ -458,10 +437,9 @@ xm_update_toggle (instance, widget, val)
 }
 
 static void
-xm_update_radiobox (instance, widget, val)
-     widget_instance* instance;
-     Widget widget;
-     widget_value* val;
+xm_update_radiobox (widget_instance* instance,
+                    Widget widget,
+                    widget_value* val)
 
 {
   Widget toggle;
@@ -505,11 +483,10 @@ xm_update_radiobox (instance, widget, val)
 /* KEEP_FIRST_CHILDREN gives the number of initial children to keep.  */
 
 static void
-make_menu_in_widget (instance, widget, val, keep_first_children)
-     widget_instance* instance;
-     Widget widget;
-     widget_value* val;
-     int keep_first_children;
+make_menu_in_widget (widget_instance* instance,
+                     Widget widget,
+                     widget_value* val,
+                     int keep_first_children)
 {
   Widget* children = 0;
   int num_children;
@@ -662,11 +639,10 @@ make_menu_in_widget (instance, widget, val, keep_first_children)
 }
 
 static void
-update_one_menu_entry (instance, widget, val, deep_p)
-     widget_instance* instance;
-     Widget widget;
-     widget_value* val;
-     Boolean deep_p;
+update_one_menu_entry (widget_instance* instance,
+                       Widget widget,
+                       widget_value* val,
+                       Boolean deep_p)
 {
   Arg al [256];
   int ac;
@@ -764,11 +740,10 @@ update_one_menu_entry (instance, widget, val, deep_p)
 }
 
 static void
-xm_update_menu (instance, widget, val, deep_p)
-     widget_instance* instance;
-     Widget widget;
-     widget_value* val;
-     Boolean deep_p;
+xm_update_menu (widget_instance* instance,
+                Widget widget,
+                widget_value* val,
+                Boolean deep_p)
 {
   Widget* children;
   unsigned int num_children;
@@ -839,10 +814,9 @@ xm_update_menu (instance, widget, val, deep_p)
 /* update text widgets */
 
 static void
-xm_update_text (instance, widget, val)
-     widget_instance* instance;
-     Widget widget;
-     widget_value* val;
+xm_update_text (widget_instance* instance,
+                Widget widget,
+                widget_value* val)
 {
   XmTextSetString (widget, val->value ? val->value : "");
   XtRemoveAllCallbacks (widget, XmNactivateCallback);
@@ -853,10 +827,9 @@ xm_update_text (instance, widget, val)
 }
 
 static void
-xm_update_text_field (instance, widget, val)
-     widget_instance* instance;
-     Widget widget;
-     widget_value* val;
+xm_update_text_field (widget_instance* instance,
+                      Widget widget,
+                      widget_value* val)
 {
   XmTextFieldSetString (widget, val->value ? val->value : "");
   XtRemoveAllCallbacks (widget, XmNactivateCallback);
@@ -870,11 +843,10 @@ xm_update_text_field (instance, widget, val)
 /* update a motif widget */
 
 void
-xm_update_one_widget (instance, widget, val, deep_p)
-     widget_instance* instance;
-     Widget widget;
-     widget_value* val;
-     Boolean deep_p;
+xm_update_one_widget (widget_instance* instance,
+                      Widget widget,
+                      widget_value* val,
+                      Boolean deep_p)
 {
   WidgetClass class;
 
@@ -935,10 +907,9 @@ xm_update_one_widget (instance, widget, val, deep_p)
 
 \f/* getting the value back */
 void
-xm_update_one_value (instance, widget, val)
-     widget_instance* instance;
-     Widget widget;
-     widget_value* val;
+xm_update_one_value (widget_instance* instance,
+                     Widget widget,
+                     widget_value* val)
 {
   WidgetClass class = XtClass (widget);
   widget_value *old_wv;
@@ -1031,10 +1002,9 @@ xm_update_one_value (instance, widget, val)
    I could not find a way to do that with accelerators.
  */
 static void
-activate_button (widget, closure, call_data)
-     Widget widget;
-     XtPointer closure;
-     XtPointer call_data;
+activate_button (Widget widget,
+                 XtPointer closure,
+                 XtPointer call_data)
 {
   Widget button = (Widget)closure;
   XtCallCallbacks (button, XmNactivateCallback, NULL);
@@ -1044,11 +1014,10 @@ activate_button (widget, closure, call_data)
 
 /* Called for key press in dialogs.  Used to pop down dialog on ESC.  */
 static void
-dialog_key_cb (widget, closure, event, continue_to_dispatch)
-     Widget widget;
-     XtPointer closure;
-     XEvent *event;
-     Boolean *continue_to_dispatch;
+dialog_key_cb (Widget widget,
+               XtPointer closure,
+               XEvent *event,
+               Boolean *continue_to_dispatch)
 {
   KeySym sym = 0;
   Modifiers modif_ret;
@@ -1071,18 +1040,16 @@ dialog_key_cb (widget, closure, event, continue_to_dispatch)
 
 /* dialogs */
 static Widget
-make_dialog (name, parent, pop_up_p, shell_title, icon_name, text_input_slot,
-            radio_box, list, left_buttons, right_buttons)
-     char* name;
-     Widget parent;
-     Boolean pop_up_p;
-     char* shell_title;
-     char* icon_name;
-     Boolean text_input_slot;
-     Boolean radio_box;
-     Boolean list;
-     int left_buttons;
-     int right_buttons;
+make_dialog (char* name,
+             Widget parent,
+             Boolean pop_up_p,
+             char* shell_title,
+             char* icon_name,
+             Boolean text_input_slot,
+             Boolean radio_box,
+             Boolean list,
+             int left_buttons,
+             int right_buttons)
 {
   Widget result;
   Widget form;
@@ -1335,8 +1302,7 @@ make_dialog (name, parent, pop_up_p, shell_title, icon_name, text_input_slot,
 }
 
 static destroyed_instance*
-find_matching_instance (instance)
-     widget_instance* instance;
+find_matching_instance (widget_instance* instance)
 {
   destroyed_instance*  cur;
   destroyed_instance*  prev;
@@ -1373,18 +1339,16 @@ find_matching_instance (instance)
 }
 
 static void
-mark_dead_instance_destroyed (widget, closure, call_data)
-     Widget widget;
-     XtPointer closure;
-     XtPointer call_data;
+mark_dead_instance_destroyed (Widget widget,
+                              XtPointer closure,
+                              XtPointer call_data)
 {
   destroyed_instance* instance = (destroyed_instance*)closure;
   instance->widget = NULL;
 }
 
 static void
-recenter_widget (widget)
-     Widget widget;
+recenter_widget (Widget widget)
 {
   Widget parent = XtParent (widget);
   Screen* screen = XtScreen (widget);
@@ -1420,8 +1384,7 @@ recenter_widget (widget)
 }
 
 static Widget
-recycle_instance (instance)
-     destroyed_instance* instance;
+recycle_instance (destroyed_instance* instance)
 {
   Widget widget = instance->widget;
 
@@ -1457,8 +1420,7 @@ recycle_instance (instance)
 }
 
 Widget
-xm_create_dialog (instance)
-     widget_instance* instance;
+xm_create_dialog (widget_instance* instance)
 {
   char*        name = instance->info->type;
   Widget       parent = instance->parent;
@@ -1538,8 +1500,7 @@ xm_create_dialog (instance)
    because we have not yet managed to make it work right in Motif.  */
 
 static Widget
-make_menubar (instance)
-     widget_instance* instance;
+make_menubar (widget_instance* instance)
 {
   Arg al[3];
   int ac;
@@ -1550,18 +1511,16 @@ make_menubar (instance)
 }
 
 static void
-remove_grabs (shell, closure, call_data)
-     Widget shell;
-     XtPointer closure;
-     XtPointer call_data;
+remove_grabs (Widget shell,
+              XtPointer closure,
+              XtPointer call_data)
 {
   Widget menu = (Widget) closure;
   XmRemoveFromPostFromList (menu, XtParent (XtParent (menu)));
 }
 
 static Widget
-make_popup_menu (instance)
-     widget_instance* instance;
+make_popup_menu (widget_instance* instance)
 {
   Widget parent = instance->parent;
   Window parent_window = parent->core.window;
@@ -1577,8 +1536,7 @@ make_popup_menu (instance)
 }
 
 static Widget
-make_main (instance)
-     widget_instance* instance;
+make_main (widget_instance* instance)
 {
   Widget parent = instance->parent;
   Widget result;
@@ -1717,8 +1675,7 @@ xm_creation_table [] =
 
 \f/* Destruction of instances */
 void
-xm_destroy_instance (instance)
-     widget_instance* instance;
+xm_destroy_instance ( widget_instance* instance)
 {
   Widget widget = instance->widget;
   /* recycle the dialog boxes */
@@ -1752,9 +1709,7 @@ xm_destroy_instance (instance)
 
 \f/* popup utility */
 void
-xm_popup_menu (widget, event)
-     Widget widget;
-     XEvent *event;
+xm_popup_menu (Widget widget, XEvent *event)
 {
   XButtonPressedEvent dummy;
 
@@ -1802,8 +1757,7 @@ xm_popup_menu (widget, event)
 }
 
 static void
-set_min_dialog_size (w)
-     Widget w;
+set_min_dialog_size (Widget w)
 {
   short width;
   short height;
@@ -1812,9 +1766,7 @@ set_min_dialog_size (w)
 }
 
 void
-xm_pop_instance (instance, up)
-     widget_instance* instance;
-     Boolean up;
+xm_pop_instance (widget_instance* instance, Boolean up)
 {
   Widget widget = instance->widget;
 
@@ -1843,10 +1795,9 @@ xm_pop_instance (instance, up)
 /* motif callback */
 
 static void
-do_call (widget, closure, type)
-     Widget widget;
-     XtPointer closure;
-     enum do_call_type type;
+do_call (Widget widget,
+         XtPointer closure,
+         enum do_call_type type)
 {
   Arg al [256];
   int ac;
@@ -1903,10 +1854,9 @@ do_call (widget, closure, type)
    if the widget was ``destroyed'' by caching it in the all_destroyed_instances
    list */
 static void
-xm_internal_update_other_instances (widget, closure, call_data)
-     Widget widget;
-     XtPointer closure;
-     XtPointer call_data;
+xm_internal_update_other_instances (Widget widget,
+                                    XtPointer closure,
+                                    XtPointer call_data)
 {
   Widget parent;
   for (parent = widget; parent; parent = XtParent (parent))
@@ -1918,20 +1868,18 @@ xm_internal_update_other_instances (widget, closure, call_data)
 }
 
 static void
-xm_generic_callback (widget, closure, call_data)
-     Widget widget;
-     XtPointer closure;
-     XtPointer call_data;
+xm_generic_callback (Widget widget,
+                     XtPointer closure,
+                     XtPointer call_data)
 {
   lw_internal_update_other_instances (widget, closure, call_data);
   do_call (widget, closure, selection);
 }
 
 static void
-xm_nosel_callback (widget, closure, call_data)
-     Widget widget;
-     XtPointer closure;
-     XtPointer call_data;
+xm_nosel_callback (Widget widget,
+                   XtPointer closure,
+                   XtPointer call_data)
 {
   /* This callback is only called when a dialog box is dismissed with
      the wm's destroy button (WM_DELETE_WINDOW.)  We want the dialog
@@ -1946,10 +1894,9 @@ xm_nosel_callback (widget, closure, call_data)
 }
 
 static void
-xm_pull_down_callback (widget, closure, call_data)
-     Widget widget;
-     XtPointer closure;
-     XtPointer call_data;
+xm_pull_down_callback (Widget widget,
+                       XtPointer closure,
+                       XtPointer call_data)
 {
   Widget parent = XtParent (widget);
 
@@ -1970,10 +1917,9 @@ xm_pull_down_callback (widget, closure, call_data)
    menu, whether or not its submenu is visible.  */
 
 static void
-xm_pop_down_callback (widget, closure, call_data)
-     Widget widget;
-     XtPointer closure;
-     XtPointer call_data;
+xm_pop_down_callback (Widget widget,
+                      XtPointer closure,
+                      XtPointer call_data)
 {
   widget_instance *instance = (widget_instance *) closure;
 
@@ -1985,9 +1931,7 @@ xm_pop_down_callback (widget, closure, call_data)
 \f
 /* set the keyboard focus */
 void
-xm_set_keyboard_focus (parent, w)
-     Widget parent;
-     Widget w;
+xm_set_keyboard_focus (Widget parent, Widget w)
 {
   XmProcessTraversal (w, 0);
   XtSetKeyboardFocus (parent, w);
@@ -1995,10 +1939,9 @@ xm_set_keyboard_focus (parent, w)
 
 /* Motif hack to set the main window areas. */
 void
-xm_set_main_areas (parent, menubar, work_area)
-     Widget parent;
-     Widget menubar;
-     Widget work_area;
+xm_set_main_areas (Widget parent,
+                   Widget menubar,
+                   Widget work_area)
 {
   XmMainWindowSetAreas (parent,
                        menubar,        /* menubar (maybe 0) */
@@ -2010,9 +1953,7 @@ xm_set_main_areas (parent, menubar, work_area)
 
 /* Motif hack to control resizing on the menubar. */
 void
-xm_manage_resizing (w, flag)
-     Widget w;
-     Boolean flag;
+xm_manage_resizing (Widget w, Boolean flag)
 {
   XtVaSetValues (w, XtNallowShellResize, flag, NULL);
 }
index 3a827036f3687aaf4276a72cd8e94802c0a73012..a68fd4ee458914a4a3a0c1773e5cdcd36bed2352 100644 (file)
@@ -26,36 +26,36 @@ Boston, MA 02110-1301, USA.  */
 extern widget_creation_entry xm_creation_table [];
 
 Widget
-xm_create_dialog __P ((widget_instance* instance));
+xm_create_dialog (widget_instance* instance);
 
 Boolean
-lw_motif_widget_p __P ((Widget widget));
+lw_motif_widget_p (Widget widget);
 
 void
-xm_update_one_widget __P ((widget_instance* instance, Widget widget,
-                     widget_value* val, Boolean deep_p));
+xm_update_one_widget (widget_instance* instance, Widget widget,
+                      widget_value* val, Boolean deep_p);
 
 void
-xm_update_one_value __P ((widget_instance* instance, Widget widget,
-                    widget_value* val));
+xm_update_one_value (widget_instance* instance, Widget widget,
+                     widget_value* val);
 
 void
-xm_destroy_instance __P ((widget_instance* instance));
+xm_destroy_instance (widget_instance* instance);
 
 void
-xm_set_keyboard_focus __P ((Widget parent, Widget w));
+xm_set_keyboard_focus (Widget parent, Widget w);
 
 void
-xm_popup_menu __P ((Widget widget, XEvent *event));
+xm_popup_menu (Widget widget, XEvent *event);
 
 void
-xm_pop_instance __P ((widget_instance* instance, Boolean up));
+xm_pop_instance (widget_instance* instance, Boolean up);
 
 void
-xm_set_main_areas __P ((Widget parent, Widget menubar, Widget work_area));
+xm_set_main_areas (Widget parent, Widget menubar, Widget work_area);
 
 void
-xm_manage_resizing __P ((Widget w, Boolean flag));
+xm_manage_resizing (Widget w, Boolean flag);
 
 #endif /* LWLIB_XM_H */
 
index 6bcf558dc514ec56c4bb9ec5840d1e3fdaa330a4..e84d7fb9956db8861c976e2cd2245ff5781bc4c8 100644 (file)
@@ -26,13 +26,19 @@ Boston, MA 02110-1301, USA.  */
 
 #include "lwlib.h"
 
-extern char *safe_strdup __P ((const char *));
+extern char *safe_strdup (const char *);
+
+struct widget_xft_data;
 
 typedef struct _widget_instance
 {
   Widget               widget;
   Widget               parent;
   Boolean              pop_up_p;
+#ifdef HAVE_XFT
+  struct widget_xft_data *xft_data;
+  int                   nr_xft_data;
+#endif
   struct _widget_info*         info;
   struct _widget_instance*     next;
 } widget_instance;
@@ -52,8 +58,7 @@ typedef struct _widget_info
   struct _widget_info*         next;
 } widget_info;
 
-typedef Widget
-(*widget_creation_function) ();
+typedef Widget (*widget_creation_function) (widget_instance *instance);
 
 typedef struct _widget_creation_entry
 {
@@ -64,14 +69,14 @@ typedef struct _widget_creation_entry
 /* update all other instances of a widget.  Can be used in a callback when
    a widget has been used by the user */
 void
-lw_internal_update_other_instances __P ((Widget, XtPointer, XtPointer));
+lw_internal_update_other_instances (Widget, XtPointer, XtPointer);
 
 /* get the widget_value for a widget in a given instance */
 widget_value*
-lw_get_widget_value_for_widget __P ((widget_instance *, Widget));
+lw_get_widget_value_for_widget (widget_instance *, Widget);
 
-widget_info *lw_get_widget_info __P ((LWLIB_ID));
-widget_instance * lw_get_widget_instance __P ((Widget));
+widget_info *lw_get_widget_info (LWLIB_ID);
+widget_instance * lw_get_widget_instance (Widget);
 
 #endif /* LWLIB_INTERNAL_H */
 
index 9dce513cb82d8d76cdf49a83076d0e760fac2151..ea765cf5bd1268751e28794dac65c3113ff7c7b1 100644 (file)
@@ -42,8 +42,7 @@ Boston, MA 02110-1301, USA.  */
 
 /* Redisplay the contents of the widget, without first clearing it. */
 void
-XtNoClearRefreshWidget (widget)
-     Widget widget;
+XtNoClearRefreshWidget (Widget widget)
 {
   XEvent event;
 
@@ -67,10 +66,7 @@ XtNoClearRefreshWidget (widget)
  * Apply a function to all the subwidgets of a given widget recursively.
 */
 void
-XtApplyToWidgets (w, proc, arg)
-     Widget w;
-     XtApplyToWidgetsProc proc;
-     XtPointer arg;
+XtApplyToWidgets (Widget w, XtApplyToWidgetsProc proc, XtPointer arg)
 {
   if (XtIsComposite (w))
     {
@@ -81,8 +77,8 @@ XtApplyToWidgets (w, proc, arg)
       int nkids = cw->composite.num_children;
       Widget *kids = (Widget *) malloc (sizeof (Widget) * nkids);
       int i;
-      lwlib_bcopy ((char *) cw->composite.children, (char *) kids,
-                  sizeof (Widget) * nkids);
+      memcpy ((char *) kids, (char *) cw->composite.children,
+             sizeof (Widget) * nkids);
       for (i = 0; i < nkids; i++)
 /* This prevent us from using gadgets, why is it here? */
 /*     if (XtIsWidget (kids [i])) */
@@ -101,10 +97,7 @@ XtApplyToWidgets (w, proc, arg)
  * Stop as soon as the function returns non NULL and returns this as a value.
  */
 void *
-XtApplyUntilToWidgets (w, proc, arg)
-     Widget w;
-     XtApplyUntilToWidgetsProc proc;
-     XtPointer arg;
+XtApplyUntilToWidgets (Widget w, XtApplyUntilToWidgetsProc proc, XtPointer arg)
 {
   void* result;
   if (XtIsComposite (w))
@@ -130,9 +123,7 @@ XtApplyUntilToWidgets (w, proc, arg)
  * Returns a copy of the list of all children of a composite widget
  */
 Widget *
-XtCompositeChildren (widget, number)
-     Widget widget;
-     unsigned int* number;
+XtCompositeChildren (Widget widget, unsigned int *number)
 {
   CompositeWidget cw = (CompositeWidget)widget;
   Widget* result;
@@ -153,15 +144,13 @@ XtCompositeChildren (widget, number)
 }
 
 Boolean
-XtWidgetBeingDestroyedP (widget)
-     Widget widget;
+XtWidgetBeingDestroyedP (Widget widget)
 {
   return widget->core.being_destroyed;
 }
 
 void
-XtSafelyDestroyWidget (widget)
-     Widget widget;
+XtSafelyDestroyWidget (Widget widget)
 {
 #if 0
 
index 934b0b48f4afb08da112711a32dd4a100bf3a062..d4dbda8467d95cd610fde1589594ea0282e2093e 100644 (file)
@@ -1,21 +1,21 @@
 #ifndef _LWLIB_UTILS_H_
 #define _LWLIB_UTILS_H_
 
-void XtNoClearRefreshWidget __P ((Widget));
+void XtNoClearRefreshWidget (Widget);
 
-typedef void (*XtApplyToWidgetsProc) __P ((Widget, XtPointer));
-typedef void* (*XtApplyUntilToWidgetsProc) __P ((Widget, XtPointer));
+typedef void (*XtApplyToWidgetsProc) (Widget, XtPointer);
+typedef void* (*XtApplyUntilToWidgetsProc) (Widget, XtPointer);
 
-void XtApplyToWidgets __P ((Widget, XtApplyToWidgetsProc, XtPointer));
-void *XtApplyUntilToWidgets __P ((Widget, XtApplyUntilToWidgetsProc, XtPointer));
+void XtApplyToWidgets (Widget, XtApplyToWidgetsProc, XtPointer);
+void *XtApplyUntilToWidgets (Widget, XtApplyUntilToWidgetsProc, XtPointer);
 
-Widget *XtCompositeChildren __P ((Widget, unsigned int *));
+Widget *XtCompositeChildren (Widget, unsigned int *);
 
 /* returns True is the widget is being destroyed, False otherwise */
 Boolean
-XtWidgetBeingDestroyedP __P ((Widget widget));
+XtWidgetBeingDestroyedP (Widget widget);
 
-void XtSafelyDestroyWidget __P ((Widget));
+void XtSafelyDestroyWidget (Widget);
 
 #endif /* _LWLIB_UTILS_H_ */
 
index 5a64e4da984df23e29d30612e939d49ddbc22768..2b72f54bb19ec11f6161d1e7cd1af08a77201e9b 100644 (file)
@@ -71,67 +71,42 @@ char *lwlib_toolkit_type = "motif";
 char *lwlib_toolkit_type = "lucid";
 #endif
 
-static widget_value *merge_widget_value P_ ((widget_value *,
-                                            widget_value *,
-                                            int, int *));
-static void instantiate_widget_instance P_ ((widget_instance *));
-static int my_strcasecmp P_ ((char *, char *));
-static void safe_free_str P_ ((char *));
-static void free_widget_value_tree P_ ((widget_value *));
-static widget_value *copy_widget_value_tree P_ ((widget_value *,
-                                                change_type));
-static widget_info *allocate_widget_info P_ ((char *, char *, LWLIB_ID,
-                                             widget_value *,
-                                             lw_callback, lw_callback,
-                                             lw_callback, lw_callback));
-static void free_widget_info P_ ((widget_info *));
-static void mark_widget_destroyed P_ ((Widget, XtPointer, XtPointer));
-static widget_instance *allocate_widget_instance P_ ((widget_info *,
-                                                     Widget, Boolean));
-static void free_widget_instance P_ ((widget_instance *));
-static widget_info *get_widget_info P_ ((LWLIB_ID, Boolean));
-static widget_instance *get_widget_instance P_ ((Widget, Boolean));
-static widget_instance *find_instance P_ ((LWLIB_ID, Widget, Boolean));
-static Boolean safe_strcmp P_ ((char *, char *));
-static Widget name_to_widget P_ ((widget_instance *, char *));
-static void set_one_value P_ ((widget_instance *, widget_value *, Boolean));
-static void update_one_widget_instance P_ ((widget_instance *, Boolean));
-static void update_all_widget_values P_ ((widget_info *, Boolean));
-static void initialize_widget_instance P_ ((widget_instance *));
-static widget_creation_function find_in_table P_ ((char *, widget_creation_entry *));
-static Boolean dialog_spec_p P_ ((char *));
-static void destroy_one_instance P_ ((widget_instance *));
-static void lw_pop_all_widgets P_ ((LWLIB_ID, Boolean));
-static Boolean get_one_value P_ ((widget_instance *, widget_value *));
-static void show_one_widget_busy P_ ((Widget, Boolean));
-
-void
-lwlib_memset (address, value, length)
-     char *address;
-     int value;
-     size_t length;
-{
-  int i;
-
-  for (i = 0; i < length; i++)
-    address[i] = value;
-}
-
-void
-lwlib_bcopy (from, to, length)
-     char *from;
-     char *to;
-     int length;
-{
-  int i;
-
-  for (i = 0; i < length; i++)
-    to[i] = from[i];
-}
+static widget_value *merge_widget_value (widget_value *,
+                                         widget_value *,
+                                         int, int *);
+static void instantiate_widget_instance (widget_instance *);
+static int my_strcasecmp (char *, char *);
+static void safe_free_str (char *);
+static void free_widget_value_tree (widget_value *);
+static widget_value *copy_widget_value_tree (widget_value *,
+                                             change_type);
+static widget_info *allocate_widget_info (char *, char *, LWLIB_ID,
+                                          widget_value *,
+                                          lw_callback, lw_callback,
+                                          lw_callback, lw_callback);
+static void free_widget_info (widget_info *);
+static void mark_widget_destroyed (Widget, XtPointer, XtPointer);
+static widget_instance *allocate_widget_instance (widget_info *,
+                                                  Widget, Boolean);
+static void free_widget_instance (widget_instance *);
+static widget_info *get_widget_info (LWLIB_ID, Boolean);
+static widget_instance *get_widget_instance (Widget, Boolean);
+static widget_instance *find_instance (LWLIB_ID, Widget, Boolean);
+static Boolean safe_strcmp (char *, char *);
+static Widget name_to_widget (widget_instance *, char *);
+static void set_one_value (widget_instance *, widget_value *, Boolean);
+static void update_one_widget_instance (widget_instance *, Boolean);
+static void update_all_widget_values (widget_info *, Boolean);
+static void initialize_widget_instance (widget_instance *);
+static widget_creation_function find_in_table (char *, widget_creation_entry *);
+static Boolean dialog_spec_p (char *);
+static void destroy_one_instance (widget_instance *);
+static void lw_pop_all_widgets (LWLIB_ID, Boolean);
+static Boolean get_one_value (widget_instance *, widget_value *);
+static void show_one_widget_busy (Widget, Boolean);
 \f/* utility functions for widget_instance and widget_info */
 char *
-safe_strdup (s)
-     const char *s;
+safe_strdup (const char *s)
 {
   char *result;
   if (! s) return 0;
@@ -145,8 +120,7 @@ safe_strdup (s)
 /* Like strcmp but ignore differences in case.  */
 
 static int
-my_strcasecmp (s1, s2)
-     char *s1, *s2;
+my_strcasecmp (char *s1, char *s2)
 {
   while (1)
     {
@@ -164,8 +138,7 @@ my_strcasecmp (s1, s2)
 }
 
 static void
-safe_free_str (s)
-     char *s;
+safe_free_str (char *s)
 {
   free (s);
 }
@@ -174,7 +147,7 @@ static widget_value *widget_value_free_list = 0;
 static int malloc_cpt = 0;
 
 widget_value *
-malloc_widget_value ()
+malloc_widget_value (void)
 {
   widget_value *wv;
   if (widget_value_free_list)
@@ -188,7 +161,7 @@ malloc_widget_value ()
       wv = (widget_value *) malloc (sizeof (widget_value));
       malloc_cpt++;
     }
-  lwlib_memset ((void*) wv, 0, sizeof (widget_value));
+  memset ((void*) wv, 0, sizeof (widget_value));
   return wv;
 }
 
@@ -196,8 +169,7 @@ malloc_widget_value ()
    by malloc_widget_value(), and no substructures.
  */
 void
-free_widget_value (wv)
-     widget_value *wv;
+free_widget_value (widget_value *wv)
 {
   if (wv->free_list)
     abort ();
@@ -217,8 +189,7 @@ free_widget_value (wv)
 }
 
 static void
-free_widget_value_tree (wv)
-     widget_value *wv;
+free_widget_value_tree (widget_value *wv)
 {
   if (!wv)
     return;
@@ -249,9 +220,7 @@ free_widget_value_tree (wv)
 }
 
 static widget_value *
-copy_widget_value_tree (val, change)
-     widget_value* val;
-     change_type change;
+copy_widget_value_tree (widget_value *val, change_type change)
 {
   widget_value* copy;
 
@@ -280,16 +249,14 @@ copy_widget_value_tree (val, change)
 }
 
 static widget_info *
-allocate_widget_info (type, name, id, val, pre_activate_cb,
-                     selection_cb, post_activate_cb, highlight_cb)
-     char* type;
-     char* name;
-     LWLIB_ID id;
-     widget_value* val;
-     lw_callback pre_activate_cb;
-     lw_callback selection_cb;
-     lw_callback post_activate_cb;
-     lw_callback highlight_cb;
+allocate_widget_info (char* type,
+                      char* name,
+                      LWLIB_ID id,
+                      widget_value* val,
+                      lw_callback pre_activate_cb,
+                      lw_callback selection_cb,
+                      lw_callback post_activate_cb,
+                      lw_callback highlight_cb)
 {
   widget_info* info = (widget_info*)malloc (sizeof (widget_info));
   info->type = safe_strdup (type);
@@ -310,21 +277,17 @@ allocate_widget_info (type, name, id, val, pre_activate_cb,
 }
 
 static void
-free_widget_info (info)
-     widget_info* info;
+free_widget_info (widget_info *info)
 {
   safe_free_str (info->type);
   safe_free_str (info->name);
   free_widget_value_tree (info->val);
-  lwlib_memset ((void*)info, 0xDEADBEEF, sizeof (widget_info));
+  memset ((void*)info, 0xDEADBEEF, sizeof (widget_info));
   free (info);
 }
 
 static void
-mark_widget_destroyed (widget, closure, call_data)
-     Widget widget;
-     XtPointer closure;
-     XtPointer call_data;
+mark_widget_destroyed (Widget widget, XtPointer closure, XtPointer call_data)
 {
   widget_instance* instance = (widget_instance*)closure;
 
@@ -333,22 +296,12 @@ mark_widget_destroyed (widget, closure, call_data)
     instance->widget = NULL;
 }
 
-/* The messy #ifdef PROTOTYPES here and elsewhere are prompted by a
-   flood of warnings about argument promotion from proprietary ISO C
-   compilers.  (etags still only makes one entry for each function.)  */
 static widget_instance *
-#ifdef PROTOTYPES
 allocate_widget_instance (widget_info* info, Widget parent, Boolean pop_up_p)
-#else
-allocate_widget_instance (info, parent, pop_up_p)
-     widget_info* info;
-     Widget parent;
-     Boolean pop_up_p;
-#endif
 {
   widget_instance* instance =
     (widget_instance*)malloc (sizeof (widget_instance));
-  bzero (instance, sizeof *instance);
+  memset (instance, 0, sizeof *instance);
   instance->parent = parent;
   instance->pop_up_p = pop_up_p;
   instance->info = info;
@@ -363,21 +316,14 @@ allocate_widget_instance (info, parent, pop_up_p)
 }
 
 static void
-free_widget_instance (instance)
-     widget_instance* instance;
+free_widget_instance (widget_instance *instance)
 {
-  lwlib_memset ((void*)instance, 0xDEADBEEF, sizeof (widget_instance));
+  memset ((void*)instance, 0xDEADBEEF, sizeof (widget_instance));
   free (instance);
 }
 
 static widget_info *
-#ifdef PROTOTYPES
 get_widget_info (LWLIB_ID id, Boolean remove_p)
-#else
-get_widget_info (id, remove_p)
-     LWLIB_ID id;
-     Boolean remove_p;
-#endif
 {
   widget_info* info;
   widget_info* prev;
@@ -401,20 +347,13 @@ get_widget_info (id, remove_p)
 /* Internal function used by the library dependent implementation to get the
    widget_value for a given widget in an instance */
 widget_info *
-lw_get_widget_info (id)
-     LWLIB_ID id;
+lw_get_widget_info (LWLIB_ID id)
 {
   return get_widget_info (id, 0);
 }
 
 static widget_instance *
-#ifdef PROTOTYPES
 get_widget_instance (Widget widget, Boolean remove_p)
-#else
-get_widget_instance (widget, remove_p)
-     Widget widget;
-     Boolean remove_p;
-#endif
 {
   widget_info* info;
   widget_instance* instance;
@@ -441,21 +380,13 @@ get_widget_instance (widget, remove_p)
    WIDGET, or null if WIDGET is not a lwlib widget.  */
 
 widget_instance *
-lw_get_widget_instance (widget)
-     Widget widget;
+lw_get_widget_instance (Widget widget)
 {
   return get_widget_instance (widget, False);
 }
 
 static widget_instance*
-#ifdef PROTOTYPES
 find_instance (LWLIB_ID id, Widget parent, Boolean pop_up_p)
-#else
-find_instance (id, parent, pop_up_p)
-     LWLIB_ID id;
-     Widget parent;
-     Boolean pop_up_p;
-#endif
 {
   widget_info* info = get_widget_info (id, False);
   widget_instance* instance;
@@ -471,9 +402,7 @@ find_instance (id, parent, pop_up_p)
 \f
 /* utility function for widget_value */
 static Boolean
-safe_strcmp (s1, s2)
-     char* s1;
-     char* s2;
+safe_strcmp (char *s1, char *s2)
 {
   if (!!s1 ^ !!s2) return True;
   return (s1 && s2) ? strcmp (s1, s2) : s1 ? False : !!s2;
@@ -500,11 +429,10 @@ safe_strcmp (s1, s2)
 
 
 static widget_value *
-merge_widget_value (val1, val2, level, change_p)
-     widget_value* val1;
-     widget_value* val2;
-     int level;
-     int *change_p;
+merge_widget_value (widget_value *val1,
+                    widget_value *val2,
+                    int level,
+                    int *change_p)
 {
   change_type change, this_one_change;
   widget_value* merged_next;
@@ -658,9 +586,7 @@ merge_widget_value (val1, val2, level, change_p)
 \f
 /* modifying the widgets */
 static Widget
-name_to_widget (instance, name)
-     widget_instance* instance;
-     char* name;
+name_to_widget (widget_instance *instance, char *name)
 {
   Widget widget = NULL;
 
@@ -684,14 +610,7 @@ name_to_widget (instance, name)
 }
 
 static void
-#ifdef PROTOTYPES
 set_one_value (widget_instance* instance, widget_value* val, Boolean deep_p)
-#else
-set_one_value (instance, val, deep_p)
-     widget_instance* instance;
-     widget_value* val;
-     Boolean deep_p;
-#endif
 {
   Widget widget = name_to_widget (instance, val->name);
 
@@ -713,13 +632,7 @@ set_one_value (instance, val, deep_p)
 }
 
 static void
-#ifdef PROTOTYPES
 update_one_widget_instance (widget_instance* instance, Boolean deep_p)
-#else
-update_one_widget_instance (instance, deep_p)
-     widget_instance* instance;
-     Boolean deep_p;
-#endif
 {
   widget_value *val;
 
@@ -733,13 +646,7 @@ update_one_widget_instance (instance, deep_p)
 }
 
 static void
-#ifdef PROTOTYPES
 update_all_widget_values (widget_info* info, Boolean deep_p)
-#else
-update_all_widget_values (info, deep_p)
-     widget_info* info;
-     Boolean deep_p;
-#endif
 {
   widget_instance* instance;
   widget_value* val;
@@ -752,14 +659,7 @@ update_all_widget_values (info, deep_p)
 }
 
 int
-#ifdef PROTOTYPES
 lw_modify_all_widgets (LWLIB_ID id, widget_value* val, Boolean deep_p)
-#else
-lw_modify_all_widgets (id, val, deep_p)
-     LWLIB_ID id;
-     widget_value* val;
-     Boolean deep_p;
-#endif
 {
   widget_info* info = get_widget_info (id, False);
   widget_value* new_val;
@@ -814,8 +714,7 @@ lw_modify_all_widgets (id, val, deep_p)
 /* creating the widgets */
 
 static void
-initialize_widget_instance (instance)
-     widget_instance* instance;
+initialize_widget_instance (widget_instance *instance)
 {
   widget_value* val;
 
@@ -830,9 +729,7 @@ initialize_widget_instance (instance)
 
 
 static widget_creation_function
-find_in_table (type, table)
-     char* type;
-     widget_creation_entry* table;
+find_in_table (char *type, widget_creation_entry *table)
 {
   widget_creation_entry* cur;
   for (cur = table; cur->type; cur++)
@@ -842,8 +739,7 @@ find_in_table (type, table)
 }
 
 static Boolean
-dialog_spec_p (name)
-     char* name;
+dialog_spec_p (char *name)
 {
   /* return True if name matches [EILPQeilpq][1-9][Bb] or
      [EILPQeilpq][1-9][Bb][Rr][1-9] */
@@ -876,8 +772,7 @@ dialog_spec_p (name)
 }
 
 static void
-instantiate_widget_instance (instance)
-     widget_instance* instance;
+instantiate_widget_instance (widget_instance *instance)
 {
   widget_creation_function function = NULL;
 
@@ -928,16 +823,14 @@ instantiate_widget_instance (instance)
 }
 
 void
-lw_register_widget (type, name, id, val, pre_activate_cb,
-                   selection_cb, post_activate_cb, highlight_cb)
-     char* type;
-     char* name;
-     LWLIB_ID id;
-     widget_value* val;
-     lw_callback pre_activate_cb;
-     lw_callback selection_cb;
-     lw_callback post_activate_cb;
-     lw_callback highlight_cb;
+lw_register_widget (char* type,
+                    char* name,
+                    LWLIB_ID id,
+                    widget_value* val,
+                    lw_callback pre_activate_cb,
+                    lw_callback selection_cb,
+                    lw_callback post_activate_cb,
+                    lw_callback highlight_cb)
 {
   if (!get_widget_info (id, False))
     allocate_widget_info (type, name, id, val, pre_activate_cb, selection_cb,
@@ -945,14 +838,7 @@ lw_register_widget (type, name, id, val, pre_activate_cb,
 }
 
 Widget
-#ifdef PROTOTYPES
 lw_get_widget (LWLIB_ID id, Widget parent, Boolean pop_up_p)
-#else
-lw_get_widget (id, parent, pop_up_p)
-     LWLIB_ID id;
-     Widget parent;
-     Boolean pop_up_p;
-#endif
 {
   widget_instance* instance;
 
@@ -961,14 +847,7 @@ lw_get_widget (id, parent, pop_up_p)
 }
 
 Widget
-#ifdef PROTOTYPES
 lw_make_widget (LWLIB_ID id, Widget parent, Boolean pop_up_p)
-#else
-lw_make_widget (id, parent, pop_up_p)
-     LWLIB_ID id;
-     Widget parent;
-     Boolean pop_up_p;
-#endif
 {
   widget_instance* instance;
   widget_info* info;
@@ -988,25 +867,10 @@ lw_make_widget (id, parent, pop_up_p)
 }
 
 Widget
-#ifdef PROTOTYPES
 lw_create_widget (char* type, char* name, LWLIB_ID id, widget_value* val,
                  Widget parent, Boolean pop_up_p,
                  lw_callback pre_activate_cb, lw_callback selection_cb,
                  lw_callback post_activate_cb, lw_callback highlight_cb)
-#else
-lw_create_widget (type, name, id, val, parent, pop_up_p, pre_activate_cb,
-                 selection_cb, post_activate_cb, highlight_cb)
-     char* type;
-     char* name;
-     LWLIB_ID id;
-     widget_value* val;
-     Widget parent;
-     Boolean pop_up_p;
-     lw_callback pre_activate_cb;
-     lw_callback selection_cb;
-     lw_callback post_activate_cb;
-     lw_callback highlight_cb;
-#endif
 {
   lw_register_widget (type, name, id, val, pre_activate_cb, selection_cb,
                      post_activate_cb, highlight_cb);
@@ -1016,8 +880,7 @@ lw_create_widget (type, name, id, val, parent, pop_up_p, pre_activate_cb,
 \f
 /* destroying the widgets */
 static void
-destroy_one_instance (instance)
-     widget_instance* instance;
+destroy_one_instance (widget_instance *instance)
 {
   /* Remove the destroy callback on the widget; that callback will try to
      dereference the instance object (to set its widget slot to 0, since the
@@ -1059,8 +922,7 @@ destroy_one_instance (instance)
 }
 
 void
-lw_destroy_widget (w)
-     Widget w;
+lw_destroy_widget (Widget w)
 {
   widget_instance* instance = get_widget_instance (w, True);
 
@@ -1076,8 +938,7 @@ lw_destroy_widget (w)
 }
 
 void
-lw_destroy_all_widgets (id)
-     LWLIB_ID id;
+lw_destroy_all_widgets (LWLIB_ID id)
 {
   widget_info* info = get_widget_info (id, True);
   widget_instance* instance;
@@ -1096,14 +957,14 @@ lw_destroy_all_widgets (id)
 }
 
 void
-lw_destroy_everything ()
+lw_destroy_everything (void)
 {
   while (all_widget_info)
     lw_destroy_all_widgets (all_widget_info->id);
 }
 
 void
-lw_destroy_all_pop_ups ()
+lw_destroy_all_pop_ups (void)
 {
   widget_info* info;
   widget_info* next;
@@ -1123,7 +984,7 @@ extern Widget first_child (/* Widget */);  /* garbage */
 #endif
 
 Widget
-lw_raise_all_pop_up_widgets ()
+lw_raise_all_pop_up_widgets (void)
 {
   widget_info* info;
   widget_instance* instance;
@@ -1156,13 +1017,7 @@ lw_raise_all_pop_up_widgets ()
 }
 
 static void
-#ifdef PROTOTYPES
 lw_pop_all_widgets (LWLIB_ID id, Boolean up)
-#else
-lw_pop_all_widgets (id, up)
-     LWLIB_ID id;
-     Boolean up;
-#endif
 {
   widget_info* info = get_widget_info (id, False);
   widget_instance* instance;
@@ -1197,23 +1052,19 @@ lw_pop_all_widgets (id, up)
 }
 
 void
-lw_pop_up_all_widgets (id)
-     LWLIB_ID id;
+lw_pop_up_all_widgets (LWLIB_ID id)
 {
   lw_pop_all_widgets (id, True);
 }
 
 void
-lw_pop_down_all_widgets (id)
-     LWLIB_ID id;
+lw_pop_down_all_widgets (LWLIB_ID id)
 {
   lw_pop_all_widgets (id, False);
 }
 
 void
-lw_popup_menu (widget, event)
-     Widget widget;
-     XEvent *event;
+lw_popup_menu (Widget widget, XEvent *event)
 {
 #if defined (USE_LUCID)
   if (lw_lucid_widget_p (widget))
@@ -1231,9 +1082,7 @@ lw_popup_menu (widget, event)
 
 \f/* get the values back */
 static Boolean
-get_one_value (instance, val)
-     widget_instance* instance;
-     widget_value* val;
+get_one_value (widget_instance *instance, widget_value *val)
 {
   Widget widget = name_to_widget (instance, val->name);
 
@@ -1258,9 +1107,7 @@ get_one_value (instance, val)
 }
 
 Boolean
-lw_get_some_values (id, val_out)
-     LWLIB_ID id;
-     widget_value* val_out;
+lw_get_some_values (LWLIB_ID id, widget_value *val_out)
 {
   widget_info* info = get_widget_info (id, False);
   widget_instance* instance;
@@ -1282,8 +1129,7 @@ lw_get_some_values (id, val_out)
 }
 
 widget_value*
-lw_get_all_values (id)
-     LWLIB_ID id;
+lw_get_all_values (LWLIB_ID id)
 {
   widget_info* info = get_widget_info (id, False);
   widget_value* val = info->val;
@@ -1296,9 +1142,7 @@ lw_get_all_values (id)
 /* internal function used by the library dependent implementation to get the
    widget_value for a given widget in an instance */
 widget_value*
-lw_get_widget_value_for_widget (instance, w)
-     widget_instance* instance;
-     Widget w;
+lw_get_widget_value_for_widget (widget_instance *instance, Widget w)
 {
   char* name = XtName (w);
   widget_value* cur;
@@ -1317,10 +1161,9 @@ static Boolean lwlib_updating;
   modified to update other instances of the widgets.  Closure should be the
   widget_instance. */
 void
-lw_internal_update_other_instances (widget, closure, call_data)
-     Widget widget;
-     XtPointer closure;
-     XtPointer call_data;
+lw_internal_update_other_instances (Widget widget,
+                                    XtPointer closure,
+                                    XtPointer call_data)
 {
   widget_instance* instance = (widget_instance*)closure;
   char* name = XtName (widget);
@@ -1357,8 +1200,7 @@ lw_internal_update_other_instances (widget, closure, call_data)
 \f/* get the id */
 
 LWLIB_ID
-lw_get_widget_id (w)
-     Widget w;
+lw_get_widget_id (Widget w)
 {
   widget_instance* instance = get_widget_instance (w, False);
 
@@ -1367,9 +1209,7 @@ lw_get_widget_id (w)
 
 \f/* set the keyboard focus */
 void
-lw_set_keyboard_focus (parent, w)
-     Widget parent;
-     Widget w;
+lw_set_keyboard_focus (Widget parent, Widget w)
 {
 #if defined (USE_MOTIF)
   xm_set_keyboard_focus (parent, w);
@@ -1380,13 +1220,7 @@ lw_set_keyboard_focus (parent, w)
 
 \f/* Show busy */
 static void
-#ifdef PROTOTYPES
 show_one_widget_busy (Widget w, Boolean flag)
-#else
-show_one_widget_busy (w, flag)
-     Widget w;
-     Boolean flag;
-#endif
 {
   Pixel foreground = 0;
   Pixel background = 1;
@@ -1405,13 +1239,7 @@ show_one_widget_busy (w, flag)
 }
 
 void
-#ifdef PROTOTYPES
 lw_show_busy (Widget w, Boolean busy)
-#else
-lw_show_busy (w, busy)
-     Widget w;
-     Boolean busy;
-#endif
 {
   widget_instance* instance = get_widget_instance (w, False);
   widget_info* info;
@@ -1433,13 +1261,7 @@ lw_show_busy (w, busy)
 /* This hack exists because Lucid/Athena need to execute the strange
    function below to support geometry management. */
 void
-#ifdef PROTOTYPES
 lw_refigure_widget (Widget w, Boolean doit)
-#else
-lw_refigure_widget (w, doit)
-     Widget w;
-     Boolean doit;
-#endif
 {
 #if defined (USE_XAW)
   XawPanedSetRefigureMode (w, doit);
@@ -1455,9 +1277,7 @@ lw_refigure_widget (w, doit)
 /* Toolkit independent way of determining if an event window is in the
    menubar. */
 Boolean
-lw_window_is_in_menubar (win, menubar_widget)
-     Window win;
-     Widget menubar_widget;
+lw_window_is_in_menubar (Window win, Widget menubar_widget)
 {
   return menubar_widget
 #if defined (USE_LUCID)
@@ -1473,10 +1293,7 @@ lw_window_is_in_menubar (win, menubar_widget)
 
 /* Motif hack to set the main window areas. */
 void
-lw_set_main_areas (parent, menubar, work_area)
-     Widget parent;
-     Widget menubar;
-     Widget work_area;
+lw_set_main_areas (Widget parent, Widget menubar, Widget work_area)
 {
 #if defined (USE_MOTIF)
   xm_set_main_areas (parent, menubar, work_area);
@@ -1486,13 +1303,7 @@ lw_set_main_areas (parent, menubar, work_area)
 /* Manage resizing for Motif.  This disables resizing when the menubar
    is about to be modified. */
 void
-#ifdef PROTOTYPES
 lw_allow_resizing (Widget w, Boolean flag)
-#else
-lw_allow_resizing (w, flag)
-     Widget w;
-     Boolean flag;
-#endif
 {
 #if defined (USE_MOTIF)
   xm_manage_resizing (w, flag);
@@ -1506,15 +1317,12 @@ lw_allow_resizing (w, flag)
    to similar ones that are supported.  */
 
 int
-lw_separator_p (label, type, motif_p)
-     char *label;
-     enum menu_separator *type;
-     int motif_p;
+lw_separator_p (char *label, enum menu_separator *type, int motif_p)
 {
   int separator_p = 0;
 
   if (strlen (label) >= 3
-      && bcmp (label, "--:", 3) == 0)
+      && memcmp (label, "--:", 3) == 0)
     {
       static struct separator_table
       {
@@ -1557,7 +1365,7 @@ lw_separator_p (label, type, motif_p)
          }
     }
   else if (strlen (label) > 3
-          && bcmp (label, "--", 2) == 0
+          && memcmp (label, "--", 2) == 0
           && label[2] != '-')
     {
       /* Alternative, more Emacs-style names.  */
index 8b724fc56a5755bef4ca21f9e8950224b8a79292..1ee075257f10d4bb85e000aef3a819556877b718 100644 (file)
@@ -130,66 +130,64 @@ typedef struct _widget_value
 } widget_value;
 
 
-typedef void (*lw_callback) __P ((Widget w, LWLIB_ID id, void* data));
-
-void  lw_register_widget __P ((char* type, char* name, LWLIB_ID id,
-                              widget_value* val, lw_callback pre_activate_cb,
-                              lw_callback selection_cb,
-                              lw_callback post_activate_cb,
-                              lw_callback highlight_cb));
-Widget lw_get_widget __P ((LWLIB_ID id, Widget parent, Boolean pop_up_p));
-Widget lw_make_widget __P ((LWLIB_ID id, Widget parent, Boolean pop_up_p));
-Widget lw_create_widget __P ((char* type, char* name, LWLIB_ID id,
-                             widget_value* val, Widget parent, Boolean pop_up_p,
-                             lw_callback pre_activate_cb,
-                             lw_callback selection_cb,
-                             lw_callback post_activate_cb,
-                             lw_callback highlight_cb));
-LWLIB_ID lw_get_widget_id __P ((Widget w));
-int lw_modify_all_widgets __P ((LWLIB_ID id, widget_value* val, Boolean deep_p));
-void lw_destroy_widget __P ((Widget w));
-void lw_destroy_all_widgets __P ((LWLIB_ID id));
-void lw_destroy_everything __P ((void));
-void lw_destroy_all_pop_ups __P ((void));
-Widget lw_raise_all_pop_up_widgets __P ((void));
-widget_value* lw_get_all_values __P ((LWLIB_ID id));
-Boolean lw_get_some_values __P ((LWLIB_ID id, widget_value* val));
-void lw_pop_up_all_widgets __P ((LWLIB_ID id));
-void lw_pop_down_all_widgets __P ((LWLIB_ID id));
-widget_value *malloc_widget_value ();
-void free_widget_value __P ((widget_value *));
-void lw_popup_menu __P ((Widget, XEvent *));
+typedef void (*lw_callback) (Widget w, LWLIB_ID id, void* data);
+
+void  lw_register_widget (char* type, char* name, LWLIB_ID id,
+                          widget_value* val, lw_callback pre_activate_cb,
+                          lw_callback selection_cb,
+                          lw_callback post_activate_cb,
+                          lw_callback highlight_cb);
+Widget lw_get_widget (LWLIB_ID id, Widget parent, Boolean pop_up_p);
+Widget lw_make_widget (LWLIB_ID id, Widget parent, Boolean pop_up_p);
+Widget lw_create_widget (char* type, char* name, LWLIB_ID id,
+                         widget_value* val, Widget parent, Boolean pop_up_p,
+                         lw_callback pre_activate_cb,
+                         lw_callback selection_cb,
+                         lw_callback post_activate_cb,
+                         lw_callback highlight_cb);
+LWLIB_ID lw_get_widget_id (Widget w);
+int lw_modify_all_widgets (LWLIB_ID id, widget_value* val, Boolean deep_p);
+void lw_destroy_widget (Widget w);
+void lw_destroy_all_widgets (LWLIB_ID id);
+void lw_destroy_everything (void);
+void lw_destroy_all_pop_ups (void);
+Widget lw_raise_all_pop_up_widgets (void);
+widget_value* lw_get_all_values (LWLIB_ID id);
+Boolean lw_get_some_values (LWLIB_ID id, widget_value* val);
+void lw_pop_up_all_widgets (LWLIB_ID id);
+void lw_pop_down_all_widgets (LWLIB_ID id);
+widget_value *malloc_widget_value (void);
+void free_widget_value (widget_value *);
+void lw_popup_menu (Widget, XEvent *);
 
 /* Toolkit independent way of focusing on a Widget at the Xt level. */
-void lw_set_keyboard_focus __P ((Widget parent, Widget w));
+void lw_set_keyboard_focus (Widget parent, Widget w);
 
 /* Silly Energize hack to invert the "sheet" button */
-void lw_show_busy __P ((Widget w, Boolean busy));
+void lw_show_busy (Widget w, Boolean busy);
 
 /* Silly hack to assist with Lucid/Athena geometry management. */
-void lw_refigure_widget __P ((Widget w, Boolean doit));
+void lw_refigure_widget (Widget w, Boolean doit);
 
 /* Toolkit independent way of determining if an event occurred on a
    menubar. */
-Boolean lw_window_is_in_menubar __P ((Window win, Widget menubar_widget));
+Boolean lw_window_is_in_menubar (Window win, Widget menubar_widget);
 
 /* Manage resizing: TRUE permits resizing widget w; FALSE disallows it. */
-void lw_allow_resizing __P ((Widget w, Boolean flag));
+void lw_allow_resizing (Widget w, Boolean flag);
 
 /* Set up the main window. */
-void lw_set_main_areas __P ((Widget parent,
-                          Widget menubar,
-                          Widget work_area));
+void lw_set_main_areas (Widget parent,
+                        Widget menubar,
+                        Widget work_area);
 
 /* Value is non-zero if LABEL is a menu separator.  If it is, *TYPE is
    set to an appropriate enumerator of type enum menu_separator.
    MOTIF_P non-zero means map separator types not supported by Motif
    to similar ones that are supported.  */
 
-int lw_separator_p __P ((char *label, enum menu_separator *type,
-                   int motif_p));
-
-void lwlib_bcopy __P ((char*, char*, int));
+int lw_separator_p (char *label, enum menu_separator *type,
+                    int motif_p);
 
 #endif /* LWLIB_H */
 
index 2ae7ae57e7909326a495e7bf87adfbc04ec7e516..d3205eb0d33e40ef5b044fe1ba169a8afbf78adc 100644 (file)
@@ -30,6 +30,7 @@ Boston, MA 02110-1301, USA.  */
 #include "lisp.h"
 
 #include <stdio.h>
+#include <ctype.h>
 
 #include <sys/types.h>
 #if (defined __sun) && !(defined SUNOS41)
@@ -43,6 +44,7 @@ Boston, MA 02110-1301, USA.  */
 #include <X11/ObjectP.h>
 #include <X11/StringDefs.h>
 #include <X11/cursorfont.h>
+#include <X11/Shell.h>
 #include "xlwmenuP.h"
 
 #ifdef emacs
@@ -69,7 +71,7 @@ extern char *gray_bitmap_bits;
 static int pointer_grabbed;
 static XEvent menu_post_event;
 
-XFontStruct *xlwmenu_default_font;
+static XFontStruct *xlwmenu_default_font;
 
 static char
 xlwMenuTranslations [] =
@@ -127,6 +129,13 @@ xlwMenuResources[] =
 #ifdef HAVE_X_I18N
   {XtNfontSet,  XtCFontSet, XtRFontSet, sizeof(XFontSet),
      offset(menu.fontSet), XtRFontSet, NULL},
+#endif
+#ifdef HAVE_XFT
+#define DEFAULT_FACENAME "Sans-10"
+  {XtNfaceName,  XtCFaceName, XtRString, sizeof(String),
+   offset(menu.faceName), XtRString, DEFAULT_FACENAME},
+  {XtNdefaultFace,  XtCDefaultFace, XtRInt, sizeof(int),
+   offset(menu.default_face), XtRImmediate, (XtPointer)1},
 #endif
   {XtNfont,  XtCFont, XtRFontStruct, sizeof(XFontStruct *),
      offset(menu.font), XtRString, "XtDefaultFont"},
@@ -176,26 +185,26 @@ xlwMenuResources[] =
 };
 #undef offset
 
-static Boolean XlwMenuSetValues();
-static void XlwMenuRealize();
-static void XlwMenuRedisplay();
-static void XlwMenuResize();
-static void XlwMenuInitialize();
-static void XlwMenuRedisplay();
-static void XlwMenuDestroy();
-static void XlwMenuClassInitialize();
-static void Start();
-static void Drag();
-static void Down();
-static void Up();
-static void Left();
-static void Right();
-static void Select();
-static void Key();
-static void Nothing();
-static int separator_height __P ((enum menu_separator));
-static void pop_up_menu __P ((XlwMenuWidget, XButtonPressedEvent *));
-
+static Boolean XlwMenuSetValues(Widget current, Widget request, Widget new,
+                                ArgList args, Cardinal *num_args);
+static void XlwMenuRealize(Widget, Mask *, XSetWindowAttributes *);
+static void XlwMenuResize(Widget w);
+static void XlwMenuInitialize(Widget, Widget, ArgList, Cardinal *);
+static void XlwMenuRedisplay(Widget w, XEvent *ev, Region region);
+static void XlwMenuDestroy(Widget w);
+static void XlwMenuClassInitialize(void);
+static void Start(Widget w, XEvent *ev, String *params, Cardinal *num_params);
+static void Drag(Widget w, XEvent *ev, String *params, Cardinal *num_params);
+static void Down(Widget w, XEvent *ev, String *params, Cardinal *num_params);
+static void Up(Widget w, XEvent *ev, String *params, Cardinal *num_params);
+static void Left(Widget w, XEvent *ev, String *params, Cardinal *num_params);
+static void Right(Widget w, XEvent *ev, String *params, Cardinal *num_params);
+static void Select(Widget w, XEvent *ev, String *params, Cardinal *num_params);
+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 [] =
@@ -270,9 +279,7 @@ static int next_release_must_exit;
 
 /* Ungrab pointer and keyboard */
 static void
-ungrab_all (w, ungrabtime)
-     Widget w;
-     Time ungrabtime;
+ungrab_all (Widget w, Time ungrabtime)
 {
   XtUngrabPointer (w, ungrabtime);
   if (GRAB_KEYBOARD) XtUngrabKeyboard (w, ungrabtime);
@@ -281,8 +288,7 @@ ungrab_all (w, ungrabtime)
 /* Like abort, but remove grabs from widget W before.  */
 
 static void
-abort_gracefully (w)
-     Widget w;
+abort_gracefully (Widget w)
 {
   if (XtIsShell (XtParent (w)))
     XtRemoveGrab (w);
@@ -291,9 +297,7 @@ abort_gracefully (w)
 }
 
 static void
-push_new_stack (mw, val)
-     XlwMenuWidget mw;
-     widget_value* val;
+push_new_stack (XlwMenuWidget mw, widget_value *val)
 {
   if (!mw->menu.new_stack)
     {
@@ -313,8 +317,7 @@ push_new_stack (mw, val)
 }
 
 static void
-pop_new_stack_if_no_contents (mw)
-     XlwMenuWidget mw;
+pop_new_stack_if_no_contents (XlwMenuWidget mw)
 {
   if (mw->menu.new_depth > 1)
     {
@@ -324,9 +327,7 @@ pop_new_stack_if_no_contents (mw)
 }
 
 static void
-make_old_stack_space (mw, n)
-     XlwMenuWidget mw;
-     int n;
+make_old_stack_space (XlwMenuWidget mw, int n)
 {
   if (!mw->menu.old_stack)
     {
@@ -346,16 +347,24 @@ make_old_stack_space (mw, n)
 
 \f/* Size code */
 static int
-string_width (mw, s)
-     XlwMenuWidget mw;
-     char *s;
+string_width (XlwMenuWidget mw, char *s)
 {
   XCharStruct xcs;
   int drop;
+#ifdef HAVE_XFT
+  if (mw->menu.xft_font)
+    {
+      XGlyphInfo gi;
+      XftTextExtentsUtf8 (XtDisplay (mw), mw->menu.xft_font,
+                          (FcChar8 *) s,
+                          strlen (s), &gi);
+      return gi.width;
+    }
+#endif
 #ifdef HAVE_X_I18N
-  XRectangle ink, logical;
   if (mw->menu.fontSet)
     {
+      XRectangle ink, logical;
       XmbTextExtents (mw->menu.fontSet, s, strlen (s), &ink, &logical);
       return logical.width;
     }
@@ -366,6 +375,20 @@ string_width (mw, s)
 
 }
 
+#ifdef HAVE_XFT
+#define MENU_FONT_HEIGHT(mw)                                    \
+  ((mw)->menu.xft_font != NULL                                  \
+   ? (mw)->menu.xft_font->height                                \
+   : ((mw)->menu.fontSet != NULL                                \
+      ? (mw)->menu.font_extents->max_logical_extent.height      \
+      : (mw)->menu.font->ascent + (mw)->menu.font->descent))
+#define MENU_FONT_ASCENT(mw)                                    \
+  ((mw)->menu.xft_font != NULL                                  \
+    ? (mw)->menu.xft_font->ascent                               \
+    : ((mw)->menu.fontSet != NULL                               \
+       ? - (mw)->menu.font_extents->max_logical_extent.y        \
+       : (mw)->menu.font->ascent))
+#else
 #ifdef HAVE_X_I18N
 #define MENU_FONT_HEIGHT(mw) \
   ((mw)->menu.fontSet != NULL \
@@ -380,10 +403,10 @@ string_width (mw, s)
   ((mw)->menu.font->ascent + (mw)->menu.font->descent)
 #define MENU_FONT_ASCENT(mw) ((mw)->menu.font->ascent)
 #endif
+#endif
 
 static int
-arrow_width (mw)
-     XlwMenuWidget mw;
+arrow_width (XlwMenuWidget mw)
 {
   return (MENU_FONT_ASCENT (mw) * 3/4) | 1;
 }
@@ -391,8 +414,7 @@ arrow_width (mw)
 /* Return the width of toggle buttons of widget MW.  */
 
 static int
-toggle_button_width (mw)
-     XlwMenuWidget mw;
+toggle_button_width (XlwMenuWidget mw)
 {
   return (MENU_FONT_HEIGHT (mw) * 2 / 3) | 1;
 }
@@ -401,8 +423,7 @@ toggle_button_width (mw)
 /* Return the width of radio buttons of widget MW.  */
 
 static int
-radio_button_width (mw)
-     XlwMenuWidget mw;
+radio_button_width (XlwMenuWidget mw)
 {
   return toggle_button_width (mw) * 1.41;
 }
@@ -416,9 +437,7 @@ nameResource[] =
 };
 
 static char*
-resource_widget_value (mw, val)
-     XlwMenuWidget mw;
-     widget_value *val;
+resource_widget_value (XlwMenuWidget mw, widget_value *val)
 {
   if (!val->toolkit_data)
     {
@@ -454,15 +473,13 @@ resource_widget_value (mw, val)
 
 /* Returns the sizes of an item */
 static void
-size_menu_item (mw, val, horizontal_p, label_width, rest_width, button_width,
-               height)
-     XlwMenuWidget mw;
-     widget_value* val;
-     int horizontal_p;
-     int* label_width;
-     int* rest_width;
-     int* button_width;
-     int* height;
+size_menu_item (XlwMenuWidget mw,
+                widget_value* val,
+                int horizontal_p,
+                int* label_width,
+                int* rest_width,
+                int* button_width,
+                int* height)
 {
   enum menu_separator separator;
 
@@ -504,16 +521,14 @@ size_menu_item (mw, val, horizontal_p, label_width, rest_width, button_width,
 }
 
 static void
-size_menu (mw, level)
-     XlwMenuWidget mw;
-     int level;
+size_menu (XlwMenuWidget mw, int level)
 {
-  unsigned int  label_width = 0;
+  int           label_width = 0;
   int          rest_width = 0;
   int          button_width = 0;
   int          max_rest_width = 0;
   int          max_button_width = 0;
-  unsigned int  height = 0;
+  int           height = 0;
   int          horizontal_p = mw->menu.horizontal && (level == 0);
   widget_value*        val;
   window_state*        ws;
@@ -559,6 +574,7 @@ size_menu (mw, level)
 
   ws->width += 2 * mw->menu.shadow_thickness;
   ws->height += 2 * mw->menu.shadow_thickness;
+  ws->max_rest_width = max_rest_width;
 
   if (horizontal_p)
     {
@@ -571,14 +587,13 @@ size_menu (mw, level)
 \f/* Display code */
 
 static void
-draw_arrow (mw, window, gc, x, y, width, down_p)
-     XlwMenuWidget mw;
-     Window window;
-     GC gc;
-     int x;
-     int y;
-     int width;
-     int down_p;
+draw_arrow (XlwMenuWidget mw,
+            Window window,
+            GC gc,
+            int x,
+            int y,
+            int width,
+            int down_p)
 {
   Display *dpy = XtDisplay (mw);
   GC top_gc = mw->menu.shadow_top_gc;
@@ -635,15 +650,14 @@ draw_arrow (mw, window, gc, x, y, width, down_p)
 
 
 static void
-draw_shadow_rectangle (mw, window, x, y, width, height, erase_p, down_p)
-     XlwMenuWidget mw;
-     Window window;
-     int x;
-     int y;
-     int width;
-     int height;
-     int erase_p;
-     int down_p;
+draw_shadow_rectangle (XlwMenuWidget mw,
+                       Window window,
+                       int x,
+                       int y,
+                       int width,
+                       int height,
+                       int erase_p,
+                       int down_p)
 {
   Display *dpy = XtDisplay (mw);
   GC top_gc = !erase_p ? mw->menu.shadow_top_gc : mw->menu.background_gc;
@@ -699,15 +713,14 @@ draw_shadow_rectangle (mw, window, x, y, width, height, erase_p, down_p)
 
 
 static void
-draw_shadow_rhombus (mw, window, x, y, width, height, erase_p, down_p)
-     XlwMenuWidget mw;
-     Window window;
-     int x;
-     int y;
-     int width;
-     int height;
-     int erase_p;
-     int down_p;
+draw_shadow_rhombus (XlwMenuWidget mw,
+                     Window window,
+                     int x,
+                     int y,
+                     int width,
+                     int height,
+                     int erase_p,
+                     int down_p)
 {
   Display *dpy = XtDisplay (mw);
   GC top_gc = !erase_p ? mw->menu.shadow_top_gc : mw->menu.background_gc;
@@ -767,10 +780,7 @@ draw_shadow_rhombus (mw, window, x, y, width, height, erase_p, down_p)
    toggle button is selected.  */
 
 static void
-draw_toggle (mw, window, x, y, selected_p)
-     XlwMenuWidget mw;
-     Window window;
-     int x, y, selected_p;
+draw_toggle (XlwMenuWidget mw, Window window, int x, int y, int selected_p)
 {
   int width, height;
 
@@ -787,10 +797,7 @@ draw_toggle (mw, window, x, y, selected_p)
    toggle button is selected.  */
 
 static void
-draw_radio (mw, window, x, y, selected_p)
-     XlwMenuWidget mw;
-     Window window;
-     int x, y, selected_p;
+draw_radio (XlwMenuWidget mw, Window window, int x, int y, int selected_p)
 {
   int width, height;
 
@@ -807,11 +814,12 @@ draw_radio (mw, window, x, y, selected_p)
    separator to draw.  TYPE is the separator type.  */
 
 static void
-draw_separator (mw, window, x, y, width, type)
-     XlwMenuWidget mw;
-     Window window;
-     int x, y, width;
-     enum menu_separator type;
+draw_separator (XlwMenuWidget mw,
+                Window window,
+                int x,
+                int y,
+                int width,
+                enum menu_separator type)
 {
   Display *dpy = XtDisplay (mw);
   XGCValues xgcv;
@@ -924,8 +932,7 @@ draw_separator (mw, window, x, y, width, type)
 /* Return the pixel height of menu separator SEPARATOR.  */
 
 static int
-separator_height (separator)
-     enum menu_separator separator;
+separator_height (enum menu_separator separator)
 {
   switch (separator)
     {
@@ -962,15 +969,13 @@ separator_height (separator)
    the menu item was.  */
 
 static void
-display_menu_item (mw, val, ws, where, highlighted_p, horizontal_p,
-                  just_compute_p)
-     XlwMenuWidget mw;
-     widget_value* val;
-     window_state* ws;
-     XPoint* where;
-     Boolean highlighted_p;
-     Boolean horizontal_p;
-     Boolean just_compute_p;
+display_menu_item (XlwMenuWidget mw,
+                   widget_value* val,
+                   window_state* ws,
+                   XPoint* where,
+                   Boolean highlighted_p,
+                   Boolean horizontal_p,
+                   Boolean just_compute_p)
 {
   GC deco_gc;
   GC text_gc;
@@ -987,6 +992,9 @@ display_menu_item (mw, val, ws, where, highlighted_p, horizontal_p,
   int width;
   enum menu_separator separator;
   int separator_p = lw_separator_p (val->name, &separator, 0);
+#ifdef HAVE_XFT
+  XftColor *xftfg;
+#endif
 
   /* compute the sizes of the item */
   size_menu_item (mw, val, horizontal_p, &label_width, &rest_width,
@@ -1024,16 +1032,19 @@ display_menu_item (mw, val, ws, where, highlighted_p, horizontal_p,
       else
        text_gc = mw->menu.disabled_gc;
       deco_gc = mw->menu.foreground_gc;
+#ifdef HAVE_XFT
+      xftfg = val->enabled ? &mw->menu.xft_fg : &mw->menu.xft_disabled_fg;
+#endif
 
       if (separator_p)
        {
-         draw_separator (mw, ws->window, x, y, width, separator);
+         draw_separator (mw, ws->pixmap, x, y, width, separator);
        }
       else
        {
          int x_offset = x + h_spacing + shadow;
          char* display_string = resource_widget_value (mw, val);
-         draw_shadow_rectangle (mw, ws->window, x, y, width, height, True,
+         draw_shadow_rectangle (mw, ws->pixmap, x, y, width, height, True,
                                 False);
 
          /* Deal with centering a menu title. */
@@ -1048,15 +1059,27 @@ display_menu_item (mw, val, ws, where, highlighted_p, horizontal_p,
            x_offset += ws->button_width;
 
 
+#ifdef HAVE_XFT
+          if (ws->xft_draw)
+            {
+              int draw_y = y + v_spacing + shadow;
+              XftDrawStringUtf8 (ws->xft_draw, xftfg,
+                                 mw->menu.xft_font,
+                                 x_offset, draw_y + font_ascent,
+                                 (unsigned char *) display_string,
+                                 strlen (display_string));
+            }
+          else
+#endif
 #ifdef HAVE_X_I18N
           if (mw->menu.fontSet)
-            XmbDrawString (XtDisplay (mw), ws->window, mw->menu.fontSet,
+            XmbDrawString (XtDisplay (mw), ws->pixmap, mw->menu.fontSet,
                            text_gc, x_offset,
                            y + v_spacing + shadow + font_ascent,
                            display_string, strlen (display_string));
           else
 #endif
-          XDrawString (XtDisplay (mw), ws->window,
+          XDrawString (XtDisplay (mw), ws->pixmap,
                       text_gc, x_offset,
                       y + v_spacing + shadow + font_ascent,
                       display_string, strlen (display_string));
@@ -1064,16 +1087,16 @@ display_menu_item (mw, val, ws, where, highlighted_p, horizontal_p,
          if (!horizontal_p)
            {
              if (val->button_type == BUTTON_TYPE_TOGGLE)
-               draw_toggle (mw, ws->window, x, y + v_spacing + shadow,
+               draw_toggle (mw, ws->pixmap, x, y + v_spacing + shadow,
                             val->selected);
              else if (val->button_type == BUTTON_TYPE_RADIO)
-               draw_radio (mw, ws->window, x, y + v_spacing + shadow,
+               draw_radio (mw, ws->pixmap, x, y + v_spacing + shadow,
                            val->selected);
 
              if (val->contents)
                {
                  int a_w = arrow_width (mw);
-                 draw_arrow (mw, ws->window, deco_gc,
+                 draw_arrow (mw, ws->pixmap, deco_gc,
                              x + width - a_w
                              - mw->menu.horizontal_spacing
                              - mw->menu.shadow_thickness,
@@ -1082,9 +1105,23 @@ display_menu_item (mw, val, ws, where, highlighted_p, horizontal_p,
                }
              else if (val->key)
                {
+#ifdef HAVE_XFT
+                  if (ws->xft_draw)
+                    {
+                      int draw_x = ws->width - ws->max_rest_width
+                        + mw->menu.arrow_spacing;
+                      int draw_y = y + v_spacing + shadow + font_ascent;
+                      XftDrawStringUtf8 (ws->xft_draw, xftfg,
+                                         mw->menu.xft_font,
+                                         draw_x, draw_y,
+                                         (unsigned char *) val->key,
+                                         strlen (val->key));
+                    }
+                  else
+#endif
 #ifdef HAVE_X_I18N
                   if (mw->menu.fontSet)
-                    XmbDrawString (XtDisplay (mw), ws->window,
+                    XmbDrawString (XtDisplay (mw), ws->pixmap,
                                    mw->menu.fontSet,
                                    text_gc,
                                    x + label_width + mw->menu.arrow_spacing,
@@ -1092,7 +1129,7 @@ display_menu_item (mw, val, ws, where, highlighted_p, horizontal_p,
                                    val->key, strlen (val->key));
                   else
 #endif
-                 XDrawString (XtDisplay (mw), ws->window,
+                 XDrawString (XtDisplay (mw), ws->pixmap,
                               text_gc,
                               x + label_width + mw->menu.arrow_spacing,
                               y + v_spacing + shadow + font_ascent,
@@ -1101,17 +1138,17 @@ display_menu_item (mw, val, ws, where, highlighted_p, horizontal_p,
            }
          else
            {
-             XDrawRectangle (XtDisplay (mw), ws->window,
+             XDrawRectangle (XtDisplay (mw), ws->pixmap,
                              mw->menu.background_gc,
                              x + shadow, y + shadow,
                              label_width + h_spacing - 1,
                              font_height + 2 * v_spacing - 1);
-             draw_shadow_rectangle (mw, ws->window, x, y, width, height,
+             draw_shadow_rectangle (mw, ws->pixmap, x, y, width, height,
                                     True, False);
            }
 
          if (highlighted_p)
-           draw_shadow_rectangle (mw, ws->window, x, y, width, height, False,
+           draw_shadow_rectangle (mw, ws->pixmap, x, y, width, height, False,
                                   False);
        }
     }
@@ -1121,16 +1158,12 @@ display_menu_item (mw, val, ws, where, highlighted_p, horizontal_p,
 }
 
 static void
-display_menu (mw, level, just_compute_p, highlighted_pos, hit, hit_return,
-             this, that)
-     XlwMenuWidget mw;
-     int level;
-     Boolean just_compute_p;
-     XPoint* highlighted_pos;
-     XPoint* hit;
-     widget_value** hit_return;
-     widget_value* this;
-     widget_value* that;
+display_menu (XlwMenuWidget mw,
+              int level,
+              Boolean just_compute_p,
+              XPoint *highlighted_pos,
+              XPoint *hit,
+              widget_value **hit_return)
 {
   widget_value*        val;
   widget_value* following_item;
@@ -1138,9 +1171,6 @@ display_menu (mw, level, just_compute_p, highlighted_pos, hit, hit_return,
   XPoint       where;
   int horizontal_p = mw->menu.horizontal && (level == 0);
   int highlighted_p;
-  int just_compute_this_one_p;
-  /* This is set nonzero if the element containing HIGHLIGHTED_POS
-     is disabled, so that we do not return any subsequent element either.  */
   int no_return = 0;
   enum menu_separator separator;
 
@@ -1159,6 +1189,11 @@ display_menu (mw, level, just_compute_p, highlighted_pos, hit, hit_return,
   where.y = 0;
 
   ws = &mw->menu.windows [level];
+
+  if (!just_compute_p)
+    XFillRectangle (XtDisplay (mw), ws->pixmap, mw->menu.background_gc,
+                    0, 0, ws->width, ws->height);
+
   for (val = mw->menu.old_stack [level]->contents; val; val = val->next)
     {
       highlighted_p = val == following_item;
@@ -1170,11 +1205,8 @@ display_menu (mw, level, just_compute_p, highlighted_pos, hit, hit_return,
            highlighted_pos->y = where.y;
        }
 
-      just_compute_this_one_p =
-       just_compute_p || ((this || that) && val != this &&  val != that);
-
       display_menu_item (mw, val, ws, &where, highlighted_p, horizontal_p,
-                        just_compute_this_one_p);
+                        just_compute_p);
 
       if (highlighted_p && highlighted_pos)
        {
@@ -1212,16 +1244,17 @@ display_menu (mw, level, just_compute_p, highlighted_pos, hit, hit_return,
     }
 
   if (!just_compute_p)
-    draw_shadow_rectangle (mw, ws->window, 0, 0, ws->width, ws->height,
-                          False, False);
+    {
+      draw_shadow_rectangle (mw, ws->pixmap, 0, 0, ws->width, ws->height,
+                             False, False);
+      XCopyArea (XtDisplay (mw), ws->pixmap, ws->window,
+                 mw->menu.foreground_gc, 0, 0, ws->width, ws->height, 0, 0);
+    }
 }
 
 \f/* Motion code */
 static void
-set_new_state (mw, val, level)
-     XlwMenuWidget mw;
-     widget_value* val;
-     int level;
+set_new_state (XlwMenuWidget mw, widget_value *val, int level)
 {
   int i;
 
@@ -1232,31 +1265,48 @@ set_new_state (mw, val, level)
 }
 
 static void
-make_windows_if_needed (mw, n)
-     XlwMenuWidget mw;
-     int n;
+expose_cb (Widget widget,
+           XtPointer closure,
+           XEvent* event,
+           Boolean* continue_to_dispatch)
+{
+  XlwMenuWidget mw = (XlwMenuWidget) closure;
+  int i;
+
+  *continue_to_dispatch = False;
+  for (i = 0; i < mw->menu.windows_length; ++i)
+    if (mw->menu.windows [i].w == widget) break;
+  if (i < mw->menu.windows_length && i < mw->menu.old_depth)
+    display_menu (mw, i, False, NULL, NULL, NULL);
+}
+
+static void
+set_window_type (Widget w, XlwMenuWidget mw)
+{
+  int popup_menu_p = mw->menu.top_depth == 1;
+  Atom type = XInternAtom (XtDisplay (w),
+                           popup_menu_p
+                           ? "_NET_WM_WINDOW_TYPE_POPUP_MENU"
+                           : "_NET_WM_WINDOW_TYPE_DROPDOWN_MENU",
+                           False);
+
+  XChangeProperty (XtDisplay (w), XtWindow (w),
+                   XInternAtom (XtDisplay (w), "_NET_WM_WINDOW_TYPE", False),
+                   XA_ATOM, 32, PropModeReplace,
+                   (unsigned char *)&type, 1);
+}
+
+
+static void
+make_windows_if_needed (XlwMenuWidget mw, int n)
 {
   int i;
   int start_at;
-  XSetWindowAttributes xswa;
-  int mask;
-  Window root = RootWindowOfScreen (DefaultScreenOfDisplay (XtDisplay (mw)));
   window_state* windows;
 
   if (mw->menu.windows_length >= n)
     return;
 
-  xswa.save_under = True;
-  xswa.override_redirect = True;
-  xswa.background_pixel = mw->core.background_pixel;
-  xswa.border_pixel = mw->core.border_pixel;
-  xswa.event_mask =
-    ExposureMask | PointerMotionMask | PointerMotionHintMask
-      | ButtonReleaseMask | ButtonPressMask;
-  xswa.cursor = mw->menu.cursor_shape;
-  mask = CWSaveUnder | CWOverrideRedirect | CWBackPixel | CWBorderPixel
-    | CWEventMask | CWCursor;
-
   if (!mw->menu.windows)
     {
       mw->menu.windows =
@@ -1276,22 +1326,38 @@ make_windows_if_needed (mw, n)
 
   for (i = start_at; i < n; i++)
    {
+     Arg av[10];
+     int ac = 0;
      windows [i].x = 0;
      windows [i].y = 0;
      windows [i].width = 1;
      windows [i].height = 1;
-     windows [i].window =
-       XCreateWindow (XtDisplay (mw), root, 0, 0, 1, 1,
-                     0, 0, CopyFromParent, CopyFromParent, mask, &xswa);
-  }
+     windows [i].max_rest_width = 0;
+     XtSetArg (av[ac], XtNwidth, 1); ++ac;
+     XtSetArg (av[ac], XtNheight, 1); ++ac;
+     XtSetArg (av[ac], XtNsaveUnder, True); ++ac;
+     XtSetArg (av[ac], XtNbackground, mw->core.background_pixel); ++ac;
+     XtSetArg (av[ac], XtNborderColor, mw->core.border_pixel); ++ac;
+     XtSetArg (av[ac], XtNborderWidth, mw->core.border_width); ++ac;
+     XtSetArg (av[ac], XtNcursor, mw->menu.cursor_shape); ++ac;
+     windows [i].w =
+       XtCreatePopupShell ("sub", overrideShellWidgetClass,
+                           (Widget) mw, av, ac);
+     XtRealizeWidget (windows [i].w);
+     XtAddEventHandler (windows [i].w, ExposureMask, False, expose_cb, mw);
+     windows [i].window = XtWindow (windows [i].w);
+     windows [i].pixmap = None;
+#ifdef HAVE_XFT
+     windows [i].xft_draw = 0;
+#endif
+     set_window_type (windows [i].w, mw);
+   }
 }
 
 /* Value is non-zero if WINDOW is part of menu bar widget W.  */
 
 int
-xlwmenu_window_p (w, window)
-     Widget w;
-     Window window;
+xlwmenu_window_p (Widget w, Window window)
 {
   XlwMenuWidget mw = (XlwMenuWidget) w;
   int i;
@@ -1305,11 +1371,10 @@ xlwmenu_window_p (w, window)
 
 /* Make the window fit in the screen */
 static void
-fit_to_screen (mw, ws, previous_ws, horizontal_p)
-     XlwMenuWidget mw;
-     window_state* ws;
-     window_state* previous_ws;
-     Boolean horizontal_p;
+fit_to_screen (XlwMenuWidget mw,
+               window_state *ws,
+               window_state *previous_ws,
+               Boolean horizontal_p)
 {
   unsigned int screen_width = WidthOfScreen (XtScreen (mw));
   unsigned int screen_height = HeightOfScreen (XtScreen (mw));
@@ -1361,10 +1426,36 @@ fit_to_screen (mw, ws, previous_ws, horizontal_p)
     }
 }
 
+static void
+create_pixmap_for_menu (window_state* ws, XlwMenuWidget mw)
+{
+  if (ws->pixmap != None) 
+    {
+      XFreePixmap (XtDisplay (ws->w), ws->pixmap);
+      ws->pixmap = None;
+    }
+  ws->pixmap = XCreatePixmap (XtDisplay (ws->w), ws->window,
+                              ws->width, ws->height,
+                              DefaultDepthOfScreen (XtScreen (ws->w)));
+#ifdef HAVE_XFT
+  if (ws->xft_draw)
+    XftDrawDestroy (ws->xft_draw);
+  if (mw->menu.xft_font)
+    {
+      int screen = XScreenNumberOfScreen (mw->core.screen);
+      ws->xft_draw = XftDrawCreate (XtDisplay (ws->w),
+                                    ws->pixmap,
+                                    DefaultVisual (XtDisplay (ws->w), screen),
+                                    mw->core.colormap);
+    }
+  else
+    ws->xft_draw = 0;
+#endif
+}
+
 /* Updates old_stack from new_stack and redisplays. */
 static void
-remap_menubar (mw)
-     XlwMenuWidget mw;
+remap_menubar (XlwMenuWidget mw)
 {
   int i;
   int last_same;
@@ -1406,14 +1497,17 @@ remap_menubar (mw)
   /* updates old_state from new_state.  It has to be done now because
      display_menu (called below) uses the old_stack to know what to display. */
   for (i = last_same + 1; i < new_depth; i++)
-    old_stack [i] = new_stack [i];
+    {
+      XtPopdown (mw->menu.windows [i].w);
+      old_stack [i] = new_stack [i];
+    }
   mw->menu.old_depth = new_depth;
 
   /* refresh the last selection */
   selection_position.x = 0;
   selection_position.y = 0;
   display_menu (mw, last_same, new_selection == old_selection,
-               &selection_position, NULL, NULL, old_selection, new_selection);
+               &selection_position, NULL, NULL);
 
   /* Now place the new menus.  */
   for (i = last_same + 1; i < new_depth && new_stack[i]->contents; i++)
@@ -1440,25 +1534,24 @@ remap_menubar (mw)
 
       fit_to_screen (mw, ws, previous_ws, mw->menu.horizontal && i == 1);
 
-      XClearWindow (XtDisplay (mw), ws->window);
-      XMoveResizeWindow (XtDisplay (mw), ws->window, ws->x, ws->y,
-                        ws->width, ws->height);
-      XMapRaised (XtDisplay (mw), ws->window);
-      display_menu (mw, i, False, &selection_position, NULL, NULL, NULL, NULL);
+      XtVaSetValues (ws->w, XtNwidth, ws->width, XtNheight, ws->height,
+                     XtNx, ws->x, XtNy, ws->y, NULL);
+      create_pixmap_for_menu (ws, mw);
+      XtPopup (ws->w, XtGrabNone);
+      display_menu (mw, i, False, &selection_position, NULL, NULL);
     }
 
   /* unmap the menus that popped down */
   for (i = new_depth - 1; i < old_depth; i++)
     if (i >= new_depth || (i > 0 && !new_stack[i]->contents))
-      XUnmapWindow (XtDisplay (mw), windows[i].window);
+      XtPopdown (windows[i].w);
 }
 
 static Boolean
-motion_event_is_in_menu (mw, ev, level, relative_pos)
-     XlwMenuWidget mw;
-     XMotionEvent* ev;
-     int level;
-     XPoint* relative_pos;
+motion_event_is_in_menu (XlwMenuWidget mw,
+                         XMotionEvent *ev,
+                         int level,
+                         XPoint *relative_pos)
 {
   window_state* ws = &mw->menu.windows [level];
   int shadow = level == 0 ? 0 : mw->menu.shadow_thickness;
@@ -1471,11 +1564,10 @@ motion_event_is_in_menu (mw, ev, level, relative_pos)
 }
 
 static Boolean
-map_event_to_widget_value (mw, ev, val, level)
-     XlwMenuWidget mw;
-     XMotionEvent* ev;
-     widget_value** val;
-     int* level;
+map_event_to_widget_value (XlwMenuWidget mw,
+                           XMotionEvent *ev,
+                           widget_value **val,
+                           int *level)
 {
   int          i;
   XPoint       relative_pos;
@@ -1491,7 +1583,7 @@ map_event_to_widget_value (mw, ev, val, level)
       if (ws && motion_event_is_in_menu (mw, ev, i, &relative_pos))
        {
           inside = 1;
-         display_menu (mw, i, True, NULL, &relative_pos, val, NULL, NULL);
+         display_menu (mw, i, True, NULL, &relative_pos, val);
 
          if (*val)
            {
@@ -1514,8 +1606,7 @@ map_event_to_widget_value (mw, ev, val, level)
 
 \f/* Procedures */
 static void
-make_drawing_gcs (mw)
-     XlwMenuWidget mw;
+make_drawing_gcs (XlwMenuWidget mw)
 {
   XGCValues xgcv;
   float scale;
@@ -1585,8 +1676,7 @@ make_drawing_gcs (mw)
 }
 
 static void
-release_drawing_gcs (mw)
-     XlwMenuWidget mw;
+release_drawing_gcs (XlwMenuWidget mw)
 {
   XtReleaseGC ((Widget) mw, mw->menu.foreground_gc);
   XtReleaseGC ((Widget) mw, mw->menu.button_gc);
@@ -1605,8 +1695,7 @@ release_drawing_gcs (mw)
                   ? ((unsigned long) (x)) : ((unsigned long) (y)))
 
 static void
-make_shadow_gcs (mw)
-     XlwMenuWidget mw;
+make_shadow_gcs (XlwMenuWidget mw)
 {
   XGCValues xgcv;
   unsigned long pm = 0;
@@ -1738,8 +1827,7 @@ make_shadow_gcs (mw)
 
 
 static void
-release_shadow_gcs (mw)
-     XlwMenuWidget mw;
+release_shadow_gcs (XlwMenuWidget mw)
 {
   Display *dpy = XtDisplay ((Widget) mw);
   Screen *screen = XtScreen ((Widget) mw);
@@ -1758,15 +1846,48 @@ release_shadow_gcs (mw)
   XtReleaseGC ((Widget) mw, mw->menu.shadow_bottom_gc);
 }
 
+#ifdef HAVE_XFT
+static int
+openXftFont (XlwMenuWidget mw)
+{
+  char *fname = mw->menu.faceName;
+
+  mw->menu.xft_font = 0;
+  mw->menu.default_face = fname && strcmp (fname, DEFAULT_FACENAME) == 0;
+
+  if (fname && strcmp (fname, "none") != 0)
+    {
+      int screen = XScreenNumberOfScreen (mw->core.screen);
+      int len = strlen (fname), i = len-1;
+      /* Try to convert Gtk-syntax (Sans 9) to Xft syntax Sans-9.  */
+      while (i > 0 && isdigit (fname[i]))
+        --i;
+      if (fname[i] == ' ')
+        {
+          fname = xstrdup (mw->menu.faceName);
+          fname[i] = '-';
+        }
+
+      mw->menu.xft_font = XftFontOpenName (XtDisplay (mw), screen, fname);
+      if (!mw->menu.xft_font) 
+        {
+          fprintf (stderr, "Can't find font '%s'\n", fname);
+          mw->menu.xft_font = XftFontOpenName (XtDisplay (mw), screen,
+                                               DEFAULT_FACENAME);
+        }
+    }
+
+  if (fname != mw->menu.faceName) free (fname);
+
+  return mw->menu.xft_font != 0;
+}
+#endif
+
 static void
-XlwMenuInitialize (request, mw, args, num_args)
-     Widget request;
-     XlwMenuWidget mw;
-     ArgList args;
-     Cardinal *num_args;
+XlwMenuInitialize (Widget request, Widget w, ArgList args, Cardinal *num_args)
 {
   /* Get the GCs and the widget size */
-
+  XlwMenuWidget mw = (XlwMenuWidget) w;
   Window window = RootWindowOfScreen (DefaultScreenOfDisplay (XtDisplay (mw)));
   Display* display = XtDisplay (mw);
 
@@ -1775,11 +1896,11 @@ XlwMenuInitialize (request, mw, args, num_args)
 
   /* _XtCreate is freeing the object that was passed to us,
      so make a copy that we will actually keep.  */
-  lwlib_bcopy (mw->menu.contents, tem, sizeof (widget_value));
+  memcpy (tem, mw->menu.contents, sizeof (widget_value));
   mw->menu.contents = tem;
 #endif
 
-/*  mw->menu.cursor = XCreateFontCursor (display, mw->menu.cursor_shape); */
+  /*  mw->menu.cursor = XCreateFontCursor (display, mw->menu.cursor_shape); */
   mw->menu.cursor = mw->menu.cursor_shape;
 
   mw->menu.gray_pixmap
@@ -1787,11 +1908,24 @@ XlwMenuInitialize (request, mw, args, num_args)
                                   gray_bitmap_width, gray_bitmap_height,
                                   (unsigned long)1, (unsigned long)0, 1);
 
-  /* I don't understand why this ends up 0 sometimes,
-     but it does.  This kludge works around it.
-     Can anyone find a real fix?   -- rms.  */
-  if (mw->menu.font == 0)
-    mw->menu.font = xlwmenu_default_font;
+#ifdef HAVE_XFT
+  if (openXftFont (mw))
+    ;
+  else
+#endif
+  
+  if (!mw->menu.font)
+    {
+      if (!xlwmenu_default_font)
+        xlwmenu_default_font = XLoadQueryFont (display, "fixed");
+      mw->menu.font = xlwmenu_default_font;
+      if (!mw->menu.font) 
+        {
+          fprintf (stderr, "Menu font fixed not found, can't continue.\n");
+          abort ();
+        }
+    }
+
 #ifdef HAVE_X_I18N
   if (mw->menu.fontSet)
     mw->menu.font_extents = XExtentsOfFontSet (mw->menu.fontSet);
@@ -1818,6 +1952,11 @@ XlwMenuInitialize (request, mw, args, num_args)
   mw->menu.windows [0].y = 0;
   mw->menu.windows [0].width = 0;
   mw->menu.windows [0].height = 0;
+  mw->menu.windows [0].max_rest_width = 0;
+  mw->menu.windows [0].pixmap = None;
+#ifdef HAVE_XFT
+  mw->menu.windows [0].xft_draw = 0;
+#endif
   size_menu (mw, 0);
 
   mw->core.width = mw->menu.windows [0].width;
@@ -1825,15 +1964,13 @@ XlwMenuInitialize (request, mw, args, num_args)
 }
 
 static void
-XlwMenuClassInitialize ()
+XlwMenuClassInitialize (void)
 {
+  xlwmenu_default_font = 0;
 }
 
 static void
-XlwMenuRealize (w, valueMask, attributes)
-     Widget w;
-     Mask *valueMask;
-     XSetWindowAttributes *attributes;
+XlwMenuRealize (Widget w, Mask *valueMask, XSetWindowAttributes *attributes)
 {
   XlwMenuWidget mw = (XlwMenuWidget)w;
   XSetWindowAttributes xswa;
@@ -1856,24 +1993,48 @@ XlwMenuRealize (w, valueMask, attributes)
   x_uncatch_errors ();
 #endif
 
+  mw->menu.windows [0].w = w;
   mw->menu.windows [0].window = XtWindow (w);
   mw->menu.windows [0].x = w->core.x;
   mw->menu.windows [0].y = w->core.y;
   mw->menu.windows [0].width = w->core.width;
   mw->menu.windows [0].height = w->core.height;
+
+  set_window_type (mw->menu.windows [0].w, mw);
+  create_pixmap_for_menu (&mw->menu.windows [0], mw);
+
+#ifdef HAVE_XFT
+  if (mw->menu.xft_font)
+    {
+      XColor colors[3];
+      colors[0].pixel = mw->menu.xft_fg.pixel = mw->menu.foreground;
+      colors[1].pixel = mw->menu.xft_bg.pixel = mw->core.background_pixel;
+      colors[2].pixel = mw->menu.xft_disabled_fg.pixel
+        = mw->menu.disabled_foreground;
+      XQueryColors (XtDisplay (mw), mw->core.colormap, colors, 3);
+      mw->menu.xft_fg.color.alpha = 0xFFFF;
+      mw->menu.xft_fg.color.red = colors[0].red;
+      mw->menu.xft_fg.color.green = colors[0].green;
+      mw->menu.xft_fg.color.blue = colors[0].blue;
+      mw->menu.xft_bg.color.alpha = 0xFFFF;
+      mw->menu.xft_bg.color.red = colors[1].red;
+      mw->menu.xft_bg.color.green = colors[1].green;
+      mw->menu.xft_bg.color.blue = colors[1].blue;
+      mw->menu.xft_disabled_fg.color.alpha = 0xFFFF;
+      mw->menu.xft_disabled_fg.color.red = colors[2].red;
+      mw->menu.xft_disabled_fg.color.green = colors[2].green;
+      mw->menu.xft_disabled_fg.color.blue = colors[2].blue;
+    }
+#endif
 }
 
 /* Only the toplevel menubar/popup is a widget so it's the only one that
    receives expose events through Xt.  So we repaint all the other panes
    when receiving an Expose event. */
 static void
-XlwMenuRedisplay (w, ev, region)
-     Widget w;
-     XEvent* ev;
-     Region region;
+XlwMenuRedisplay (Widget w, XEvent *ev, Region region)
 {
   XlwMenuWidget mw = (XlwMenuWidget)w;
-  int i;
 
   /* If we have a depth beyond 1, it's because a submenu was displayed.
      If the submenu has been destroyed, set the depth back to 1.  */
@@ -1883,8 +2044,7 @@ XlwMenuRedisplay (w, ev, region)
       submenu_destroyed = 0;
     }
 
-  for (i = 0; i < mw->menu.old_depth; i++)
-    display_menu (mw, i, False, NULL, NULL, NULL, NULL, NULL);
+  display_menu (mw, 0, False, NULL, NULL, NULL);
 }
 
 
@@ -1892,15 +2052,13 @@ XlwMenuRedisplay (w, ev, region)
    over a menu item is unmapped.  */
 
 void
-xlwmenu_redisplay (w)
-     Widget w;
+xlwmenu_redisplay (Widget w)
 {
   XlwMenuRedisplay (w, NULL, None);
 }
 
 static void
-XlwMenuDestroy (w)
-     Widget w;
+XlwMenuDestroy (Widget w)
 {
   int i;
   XlwMenuWidget mw = (XlwMenuWidget) w;
@@ -1942,18 +2100,45 @@ XlwMenuDestroy (w)
      client exits.  Nice, eh?
    */
 
+#ifdef HAVE_XFT
+  if (mw->menu.windows [0].xft_draw)
+    XftDrawDestroy (mw->menu.windows [0].xft_draw);
+  if (mw->menu.xft_font)
+    XftFontClose (XtDisplay (mw), mw->menu.xft_font);
+#endif
+
+  if (mw->menu.windows [0].pixmap != None) 
+    XFreePixmap (XtDisplay (mw), mw->menu.windows [0].pixmap);
   /* start from 1 because the one in slot 0 is w->core.window */
   for (i = 1; i < mw->menu.windows_length; i++)
-    XDestroyWindow (XtDisplay (mw), mw->menu.windows [i].window);
+    {
+      if (mw->menu.windows [i].pixmap != None) 
+        XFreePixmap (XtDisplay (mw), mw->menu.windows [i].pixmap);
+#ifdef HAVE_XFT
+      if (mw->menu.windows [i].xft_draw)
+        XftDrawDestroy (mw->menu.windows [i].xft_draw);
+#endif
+    }
+
   if (mw->menu.windows)
     XtFree ((char *) mw->menu.windows);
 }
 
+#ifdef HAVE_XFT
+static int
+facename_changed (XlwMenuWidget newmw,
+                  XlwMenuWidget oldmw)
+{
+  /* This will fore a new XftFont even if the same string is set.
+     This is good, as rendering parameters may have changed and
+     we just want to do a redisplay.  */
+  return newmw->menu.faceName != oldmw->menu.faceName;
+}
+#endif
+
 static Boolean
-XlwMenuSetValues (current, request, new)
-     Widget current;
-     Widget request;
-     Widget new;
+XlwMenuSetValues (Widget current, Widget request, Widget new,
+                  ArgList args, Cardinal *num_args)
 {
   XlwMenuWidget oldmw = (XlwMenuWidget)current;
   XlwMenuWidget newmw = (XlwMenuWidget)new;
@@ -1972,6 +2157,9 @@ XlwMenuSetValues (current, request, new)
 
   if (newmw->core.background_pixel != oldmw->core.background_pixel
       || newmw->menu.foreground != oldmw->menu.foreground
+#ifdef HAVE_XFT
+      || facename_changed (newmw, oldmw)
+#endif
 #ifdef HAVE_X_I18N
       || newmw->menu.fontSet != oldmw->menu.fontSet
       || (newmw->menu.fontSet == NULL && newmw->menu.font != oldmw->menu.font)
@@ -2004,6 +2192,29 @@ XlwMenuSetValues (current, request, new)
          }
     }
 
+#ifdef HAVE_XFT
+  if (facename_changed (newmw, oldmw))
+    {
+      int i;
+      int screen = XScreenNumberOfScreen (newmw->core.screen);
+      if (newmw->menu.xft_font)
+        XftFontClose (XtDisplay (newmw), newmw->menu.xft_font);
+      openXftFont (newmw);
+      for (i = 0; i < newmw->menu.windows_length; i++)
+        {
+          if (newmw->menu.windows [i].xft_draw)
+            XftDrawDestroy (newmw->menu.windows [i].xft_draw);
+          newmw->menu.windows [i].xft_draw = 0;
+        }
+      if (newmw->menu.xft_font)
+      for (i = 0; i < newmw->menu.windows_length; i++)
+          newmw->menu.windows [i].xft_draw
+            = XftDrawCreate (XtDisplay (newmw),
+                             newmw->menu.windows [i].window,
+                             DefaultVisual (XtDisplay (newmw), screen),
+                             newmw->core.colormap);
+    }
+#endif
 #ifdef HAVE_X_I18N
   if (newmw->menu.fontSet != oldmw->menu.fontSet && newmw->menu.fontSet != NULL)
     {
@@ -2016,8 +2227,7 @@ XlwMenuSetValues (current, request, new)
 }
 
 static void
-XlwMenuResize (w)
-     Widget w;
+XlwMenuResize (Widget w)
 {
   XlwMenuWidget mw = (XlwMenuWidget)w;
 
@@ -2026,21 +2236,20 @@ XlwMenuResize (w)
       /* Don't allow the popup menu to resize itself.  */
       mw->core.width = mw->menu.windows [0].width;
       mw->core.height = mw->menu.windows [0].height;
-      mw->core.parent->core.width = mw->core.width ;
-      mw->core.parent->core.height = mw->core.height ;
+      mw->core.parent->core.width = mw->core.width;
+      mw->core.parent->core.height = mw->core.height;
     }
   else
     {
       mw->menu.windows [0].width = mw->core.width;
       mw->menu.windows [0].height = mw->core.height;
+      create_pixmap_for_menu (&mw->menu.windows [0], mw);
     }
 }
 
 \f/* Action procedures */
 static void
-handle_single_motion_event (mw, ev)
-     XlwMenuWidget mw;
-     XMotionEvent* ev;
+handle_single_motion_event (XlwMenuWidget mw, XMotionEvent *ev)
 {
   widget_value*        val;
   int          level;
@@ -2056,15 +2265,12 @@ handle_single_motion_event (mw, ev)
 }
 
 static void
-handle_motion_event (mw, ev)
-     XlwMenuWidget mw;
-     XMotionEvent* ev;
+handle_motion_event (XlwMenuWidget mw, XMotionEvent *ev)
 {
   int x = ev->x_root;
   int y = ev->y_root;
   int state = ev->state;
-
-  handle_single_motion_event (mw, ev);
+  XMotionEvent oldev = *ev;
 
   /* allow motion events to be generated again */
   if (ev->is_hint
@@ -2076,14 +2282,12 @@ handle_motion_event (mw, ev)
       && ev->state == state
       && (ev->x_root != x || ev->y_root != y))
     handle_single_motion_event (mw, ev);
+  else
+    handle_single_motion_event (mw, &oldev);
 }
 
 static void
-Start (w, ev, params, num_params)
-     Widget w;
-     XEvent *ev;
-     String *params;
-     Cardinal *num_params;
+Start (Widget w, XEvent *ev, String *params, Cardinal *num_params)
 {
   XlwMenuWidget mw = (XlwMenuWidget)w;
 
@@ -2116,11 +2320,7 @@ Start (w, ev, params, num_params)
 }
 
 static void
-Drag (w, ev, params, num_params)
-     Widget w;
-     XEvent *ev;
-     String *params;
-     Cardinal *num_params;
+Drag (Widget w, XEvent *ev, String *params, Cardinal *num_params)
 {
   XlwMenuWidget mw = (XlwMenuWidget)w;
   if (mw->menu.popped_up)
@@ -2130,19 +2330,12 @@ Drag (w, ev, params, num_params)
 /* Do nothing.
    This is how we handle presses and releases of modifier keys.  */
 static void
-Nothing (w, ev, params, num_params)
-     Widget w;
-     XEvent *ev;
-     String *params;
-     Cardinal *num_params;
+Nothing (Widget w, XEvent *ev, String *params, Cardinal *num_params)
 {
 }
 
 static widget_value *
-find_first_selectable (mw, item, skip_titles)
-     XlwMenuWidget mw;
-     widget_value *item;
-     int skip_titles;
+find_first_selectable (XlwMenuWidget mw, widget_value *item, int skip_titles)
 {
   widget_value *current = item;
   enum menu_separator separator;
@@ -2158,10 +2351,7 @@ find_first_selectable (mw, item, skip_titles)
 }
 
 static widget_value *
-find_next_selectable (mw, item, skip_titles)
-     XlwMenuWidget mw;
-     widget_value *item;
-     int skip_titles;
+find_next_selectable (XlwMenuWidget mw, widget_value *item, int skip_titles)
 {
   widget_value *current = item;
   enum menu_separator separator;
@@ -2195,10 +2385,7 @@ find_next_selectable (mw, item, skip_titles)
 }
 
 static widget_value *
-find_prev_selectable (mw, item, skip_titles)
-     XlwMenuWidget mw;
-     widget_value *item;
-     int skip_titles;
+find_prev_selectable (XlwMenuWidget mw, widget_value *item, int skip_titles)
 {
   widget_value *current = item;
   widget_value *prev = item;
@@ -2215,11 +2402,7 @@ find_prev_selectable (mw, item, skip_titles)
 }
 
 static void
-Down (w, ev, params, num_params)
-     Widget w;
-     XEvent *ev;
-     String *params;
-     Cardinal *num_params;
+Down (Widget w, XEvent *ev, String *params, Cardinal *num_params)
 {
   XlwMenuWidget mw = (XlwMenuWidget) w;
   widget_value* selected_item = mw->menu.old_stack [mw->menu.old_depth - 1];
@@ -2244,11 +2427,7 @@ Down (w, ev, params, num_params)
 }
 
 static void
-Up (w, ev, params, num_params)
-     Widget w;
-     XEvent *ev;
-     String *params;
-     Cardinal *num_params;
+Up (Widget w, XEvent *ev, String *params, Cardinal *num_params)
 {
   XlwMenuWidget mw = (XlwMenuWidget) w;
   widget_value* selected_item = mw->menu.old_stack [mw->menu.old_depth - 1];
@@ -2284,11 +2463,7 @@ Up (w, ev, params, num_params)
 }
 
 void
-Left (w, ev, params, num_params)
-     Widget w;
-     XEvent *ev;
-     String *params;
-     Cardinal *num_params;
+Left (Widget w, XEvent *ev, String *params, Cardinal *num_params)
 {
   XlwMenuWidget mw = (XlwMenuWidget) w;
   widget_value* selected_item = mw->menu.old_stack [mw->menu.old_depth - 1];
@@ -2324,11 +2499,7 @@ Left (w, ev, params, num_params)
 }
 
 void
-Right (w, ev, params, num_params)
-     Widget w;
-     XEvent *ev;
-     String *params;
-     Cardinal *num_params;
+Right (Widget w, XEvent *ev, String *params, Cardinal *num_params)
 {
   XlwMenuWidget mw = (XlwMenuWidget) w;
   widget_value* selected_item = mw->menu.old_stack [mw->menu.old_depth - 1];
@@ -2364,11 +2535,7 @@ Right (w, ev, params, num_params)
 /* Handle key press and release events while menu is popped up.
    Our action is to get rid of the menu.  */
 static void
-Key (w, ev, params, num_params)
-     Widget w;
-     XEvent *ev;
-     String *params;
-     Cardinal *num_params;
+Key (Widget w, XEvent *ev, String *params, Cardinal *num_params)
 {
   XlwMenuWidget mw = (XlwMenuWidget)w;
 
@@ -2385,7 +2552,7 @@ Key (w, ev, params, num_params)
       else
        {
          XtRemoveGrab ((Widget) mw);
-         display_menu (mw, 0, False, NULL, NULL, NULL, NULL, NULL);
+         display_menu (mw, 0, False, NULL, NULL, NULL);
        }
     }
 
@@ -2394,11 +2561,7 @@ Key (w, ev, params, num_params)
 }
 
 static void
-Select (w, ev, params, num_params)
-     Widget w;
-     XEvent *ev;
-     String *params;
-     Cardinal *num_params;
+Select (Widget w, XEvent *ev, String *params, Cardinal *num_params)
 {
   XlwMenuWidget mw = (XlwMenuWidget)w;
   widget_value* selected_item = mw->menu.old_stack [mw->menu.old_depth - 1];
@@ -2426,7 +2589,7 @@ Select (w, ev, params, num_params)
       else
        {
          XtRemoveGrab ((Widget) mw);
-         display_menu (mw, 0, False, NULL, NULL, NULL, NULL, NULL);
+         display_menu (mw, 0, False, NULL, NULL, NULL);
        }
     }
 
@@ -2437,9 +2600,7 @@ Select (w, ev, params, num_params)
 
 \f/* Special code to pop-up a menu */
 static void
-pop_up_menu (mw, event)
-     XlwMenuWidget mw;
-     XButtonPressedEvent* event;
+pop_up_menu (XlwMenuWidget mw, XButtonPressedEvent *event)
 {
   int          x = event->x_root;
   int          y = event->y_root;
@@ -2477,7 +2638,7 @@ pop_up_menu (mw, event)
       XtConfigureWidget (XtParent ((Widget)mw), x, y, w, h,
                         XtParent ((Widget)mw)->core.border_width);
       XtPopup (XtParent ((Widget)mw), XtGrabExclusive);
-      display_menu (mw, 0, False, NULL, NULL, NULL, NULL, NULL);
+      display_menu (mw, 0, False, NULL, NULL, NULL);
       mw->menu.windows [0].x = x + borderwidth;
       mw->menu.windows [0].y = y + borderwidth;
       mw->menu.top_depth = 1;  /* Popup menus don't have a bar so top is 1  */
index 4f2c6cc4452c1e69761b5c3169712b0e1b03330a..a514e8df7394a793d5a30e2a987f77acd8a3c0d4 100644 (file)
@@ -58,6 +58,10 @@ Boston, MA 02110-1301, USA.  */
 #define XtCResizeToPreferred "ResizeToPreferred"
 #define XtNallowResize "allowResize"
 #define XtCAllowResize "AllowResize"
+#define XtNfaceName "faceName"
+#define XtCFaceName "FaceName"
+#define XtNdefaultFace "defaultFace"
+#define XtCDefaultFace "DefaultFace"
 
 /* Motif-compatible resource names */
 #define XmNshadowThickness     "shadowThickness"
@@ -77,6 +81,9 @@ typedef struct _XlwMenuClassRec *XlwMenuWidgetClass;
 
 extern WidgetClass xlwMenuWidgetClass;
 
+extern int xlwmenu_window_p (Widget w, Window window);
+extern void xlwmenu_redisplay (Widget);
+
 #endif /* _XlwMenu_h */
 
 /* arch-tag: 0c019735-d61b-4080-be85-4fdd6e50ae07
index e98d657bfa03340fb337c4b895c8840787a5a0a6..1c2a8e8de1402744c32240f07af795aed429954b 100644 (file)
@@ -25,19 +25,28 @@ Boston, MA 02110-1301, USA.  */
 
 #include "xlwmenu.h"
 #include <X11/CoreP.h>
+#ifdef HAVE_XFT
+#include <X11/Xft/Xft.h>
+#endif
 
 /* Elements in the stack arrays. */
 typedef struct _window_state
 {
+  Widget        w;
   Window       window;
+  Pixmap        pixmap;
   Position     x;
   Position     y;
   Dimension    width;
   Dimension    height;
   Dimension    label_width;
+  int           max_rest_width;
 
   /* Width of toggle buttons or radio buttons.  */
   Dimension     button_width;
+#ifdef HAVE_XFT
+  XftDraw*      xft_draw;
+#endif
 } window_state;
 
 
@@ -48,6 +57,12 @@ typedef struct _XlwMenu_part
 #ifdef HAVE_X_I18N
   XFontSet     fontSet;
   XFontSetExtents *font_extents;
+#endif
+#ifdef HAVE_XFT
+  String        faceName;
+  int           default_face;
+  XftFont*      xft_font;
+  XftColor      xft_fg, xft_bg, xft_disabled_fg;
 #endif
   XFontStruct* font;
   Pixel                foreground;
index a5c600ab37e2bf22b8e0d19df38056ccb66ea9ed..95512c7f482516293779ae8732406bcfa53fff73 100755 (executable)
--- a/make-dist
+++ b/make-dist
@@ -121,8 +121,8 @@ while [ $# -gt 0 ]; do
 done
 
 ### Make sure we're running in the right place.
-if [ ! -d src -o ! -f src/lisp.h -o ! -d lisp -o ! -f lisp/version.el ]; then
-  echo "${progname}: Can't find \`src/lisp.h' and \`lisp/version.el'." >&2
+if [ ! -d src -o ! -f src/lisp.h -o ! -d lisp -o ! -f lisp/subr.el ]; then
+  echo "${progname}: Can't find \`src/lisp.h' and \`lisp/subr.el'." >&2
   echo "${progname} must be run in the top directory of the Emacs" >&2
   echo "distribution tree.  cd to that directory and try again." >&2
   exit 1
@@ -150,12 +150,12 @@ then
 fi
 
 ### Find out which version of Emacs this is.
-shortversion=`grep 'defconst[   ]*emacs-version' lisp/version.el \
+shortversion=`grep 'char emacs_version' src/emacs.c \
         | sed -e 's/^.*"\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/'`
-version=`grep 'defconst[        ]*emacs-version' lisp/version.el \
+version=`grep 'char emacs_version' src/emacs.c \
         | sed -e 's/^[^"]*"\([^"]*\)".*$/\1/'`
 if [ ! "${version}" ]; then
-  echo "${progname}: can't find current Emacs version in \`./lisp/version.el'" >&2
+  echo "${progname}: can't find current Emacs version in \`./src/emacs.c'" >&2
   exit 1
 fi
 
@@ -281,7 +281,7 @@ echo "Making lisp/MANIFEST"
 (cd lisp;
  files=`echo [!=]*.el | sed -e 's/ subdirs.el / /' -e 's/ default.el / /'`
  for dir in [!=]*; do
-  if [ -d $dir ] && [ $dir != term ] && [ $dir != CVS ] && [ $dir != RCS ]
+  if [ -d $dir ] && [ $dir != term ]
   then
     echo $dir
     thisdir=`echo $dir/[!=]*.el | sed -e 's/ subdirs.el / /'`
@@ -383,7 +383,7 @@ echo "Making links to \`lisp' and its subdirectories"
  ## Find all subdirs of lisp dir
  for file in `find . -type d -print`; do
    case $file in
-     . | .. | */Old | */CVS | */RCS | */=*)
+     . | .. | */=*)
        ;;
      *)
        if [ -d $file ]; then
@@ -440,6 +440,7 @@ echo "Making links to \`src'"
  ln [a-zA-Z]*.h ../${tempdir}/src
  ln [a-zA-Z]*.m ../${tempdir}/src
  ln [a-zA-Z]*.in ../${tempdir}/src
+ ln [a-zA-Z]*.mk ../${tempdir}/src
  ## If we ended up with a symlink, or if we did not get anything
  ## due to a cross-device symlink, copy the file.
  for file in [a-zA-Z]*.[hcs] [a-zA-Z]*.in; do
@@ -460,7 +461,7 @@ echo "Making links to \`src'"
  ln makefile.w32-in ../${tempdir}/src
  ln .gdbinit .dbxinit ../${tempdir}/src
  cd ../${tempdir}/src
- rm -f config.h epaths.h Makefile Makefile.c
+ rm -f config.h epaths.h Makefile
  rm -f =* TAGS)
 
 echo "Making links to \`src/bitmaps'"
@@ -469,8 +470,7 @@ echo "Making links to \`src/bitmaps'"
 
 echo "Making links to \`src/m'"
 (cd src/m
- # We call files for miscellaneous input (to linker etc) .inp.
- ln README [a-zA-Z0-9]*.h *.inp ../../${tempdir}/src/m)
+ ln README [a-zA-Z0-9]*.h ../../${tempdir}/src/m)
 
 echo "Making links to \`src/s'"
 (cd src/s
@@ -499,7 +499,6 @@ echo "Making links to \`lib-src'"
    fi
  done
  cd ../${tempdir}/lib-src
- rm -f Makefile.c
  rm -f getopt.h
  rm -f =* TAGS)
 
@@ -538,7 +537,7 @@ echo "Making links to \`nt/icons'"
 echo "Making links to \`msdos'"
 (cd msdos
  ln ChangeLog INSTALL README emacs.ico emacs.pif ../${tempdir}/msdos
- ln is_exec.c sigaction.c mainmake mainmake.v2 sed*.inp ../${tempdir}/msdos
+ ln is_exec.c sigaction.c mainmake.v2 sed*.inp ../${tempdir}/msdos
  cd ../${tempdir}/msdos
  rm -f =*)
 
@@ -581,7 +580,7 @@ echo "Making links to \`etc'"
 ### Don't distribute = files, TAGS, DOC files, backups, autosaves, or
 ### tex litter.
 (cd etc
- files=`ls -d * | grep -v CVS | grep -v RCS | grep -v 'Old' | grep -v '^e$' \
+ files=`ls -d * | grep -v '^e$' \
         | grep -v '^charsets$' | grep -v '^gnus$' | grep -v '^images$' | grep -v '^nxml$' \
         | grep -v '^refcards$' | grep -v '^tutorials$'| grep -v '^schema$'`
  ln $files ../${tempdir}/etc
@@ -609,7 +608,7 @@ echo "Making links to \`etc'"
 for dir in etc/charsets etc/e etc/gnus etc/nxml etc/tutorials etc/refcards etc/schema ; do
     echo "Making links to \`${dir}'"
     (cd ${dir}
-       ln `ls -d * | grep -v CVS | grep -v RCS` ../../${tempdir}/${dir}
+       ln `ls -d *` ../../${tempdir}/${dir}
        cd ../../${tempdir}/${dir}
        rm -f *~ \#*\# *,v =* core)
 done
@@ -643,7 +642,7 @@ for dir in etc/images/tree-widget/default etc/images/tree-widget/folder \
     etc/images/smilies/grayscale  etc/images/smilies/medium; do
     echo "Making links to \`${dir}'"
     (cd ${dir}
-     ln `ls -d * | grep -v CVS | grep -v RCS` ../../../../${tempdir}/${dir}
+     ln `ls -d *` ../../../../${tempdir}/${dir}
      cd ../../../../${tempdir}/${dir}
      rm -f *~ \#*\# *,v =* core)
 done
@@ -652,7 +651,7 @@ for dir in etc/images/icons/hicolor/*/apps \
     etc/images/icons/hicolor/*/mimetypes; do
     echo "Making links to \`${dir}'"
     (cd ${dir}
-     ln `ls -d * | grep -v CVS | grep -v RCS` ../../../../../../${tempdir}/${dir}
+     ln `ls -d *` ../../../../../../${tempdir}/${dir}
      cd ../../../../../../${tempdir}/${dir}
      rm -f *~ \#*\# *,v =* core)
 done
@@ -660,7 +659,7 @@ done
 echo "Making links to \`info'"
 # Don't distribute backups or autosaves.
 (cd info
- ln `find . -type f -print | grep -v CVS | grep -v RCS | grep -v cvsignore` ../${tempdir}/info
+ ln `find . -type f -print` ../${tempdir}/info
  #ln [a-zA-Z]* ../${tempdir}/info
  cd ../${tempdir}/info
  # Avoid an error when expanding the wildcards later.
index dfd5c41d7d5de03506b01210382c6ea01559f6fc..cc9a63ef12ab6604df0f0328638c9a89e1f8ab60 100644 (file)
@@ -1,7 +1,280 @@
+2010-08-22  Chong Yidong  <cyd@stupidchicken.com>
+
+       * sedleim.inp (RUN-EMACS): Don't use --multibyte.
+
+2010-08-20  Eli Zaretskii  <eliz@gnu.org>
+
+       * sed1v2.inp (IMAGEMAGICK_LIBS, IMAGEMAGICK_CFLAGS): Edit to empty.
+
+2010-08-15  Eli Zaretskii  <eliz@gnu.org>
+
+       * mainmake.v2 (version): Update due to change in emacs.c.
+
+2010-08-05  Eli Zaretskii  <eliz@gnu.org>
+
+       * sed1v2.inp (UNEXEC_OBJ): Edit to unexcoff.o, due to renaming of
+       unexec.c => unexcoff.c.
+
+2010-07-29  Chad Brown  <yandros@mit.edu>
+
+       * sed2v2.inp (HAVE_DIRENT_H): Edit to 1.
+
+2010-07-12  Eli Zaretskii  <eliz@gnu.org>
+
+       * sed1v2.inp (C_WARNINGS_SWITCH, PROFILING_CFLAGS, PROFILING_LDFLAGS):
+       Edit to empty.
+
+       * sed3v2.inp(C_WARNINGS_SWITCH, PROFILING_CFLAGS, PROFILING_LDFLAGS):
+       Edit to empty.
+
+2010-07-11  Eli Zaretskii  <eliz@gnu.org>
+
+       * sed2v2.inp (HAVE_STRCHR, HAVE_STRRCHR): Don't edit, already
+       defined on <sys/config.h>.
+
+2010-07-11  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * sed2v2.inp (HAVE_INDEX, HAVE_RINDEX): Don't edit.
+       (HAVE_STRCHR, HAVE_STRRCHR): Edit to 1.
+
+2010-07-08  Eli Zaretskii  <eliz@gnu.org>
+
+       * sed1v2.inp (stamp-oldxmenu): Don't edit out in `temacs:' target,
+       which doesn't exist.
+
+       * sed2v2.inp (HAVE_MEMCPY): Don't edit, defined on <sys/config.h>.
+
+2010-07-08  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * sed1v2.inp: Remove reference to prefix-args.
+
+2010-07-07  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * sed2v2.inp (HAVE_MEMCPY, HAVE_MEMSET): Edit to 1.
+       (HAVE_BZERO): Don't edit.
+
+2010-07-02  Eli Zaretskii  <eliz@gnu.org>
+
+       * sed1v2.inp (LIB_GCC): Edit to empty.
+       Return back to ../src after compiling each .el file.
+
+2010-06-30  Glenn Morris  <rgm@gnu.org>
+
+       * sed1v2.inp (CANNOT_DUMP): Update for configure name change.
+
+2010-06-26  Eli Zaretskii  <eliz@gnu.org>
+
+       * mainmake.v2 (version): Use emacs_version[] in src/emacs.c
+       instead of lisp/version.el (see 2010-05-15T21:11:37Z!raeburn@raeburn.org).
+
+       * sed1v2.inp (MKDEPDIR): Edit to empty.
+       Delete lines in rules that invoke $(MKDEPDIR).
+       Fix editing rules that begin with "cd ../lisp".
+       Edit out sh if-then-else-fi constructs that test ${CANNOT_DUMP}.
+       Edit out "|| exit ;\" constructs in emacs${EXEEXT} rule.
+
+2010-06-03  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * sed1v2.inp (UNEXEC_OBJ): Use UNEXEC_OBJ instead of unexec.
+
+2010-06-03  Glenn Morris  <rgm@gnu.org>
+
+       * sed2v2.inp: Do not edit HAVE_ALLOCA.
+
+2010-05-26  Glenn Morris  <rgm@gnu.org>
+
+       * sed1v2.inp (@PRE_EDIT_LDFLAGS@, @POST_EDIT_LDFLAGS@): Edit to nothing.
+
+       * sed1v2.inp (NS_IMPL_GNUSTEP_INC, NS_IMPL_GNUSTEP_TEMACS_LDFLAGS):
+       No longer present.
+
+2010-05-25  Glenn Morris  <rgm@gnu.org>
+
+       * sed1v2.inp (LD_SWITCH_SYSTEM_EXTRA): No longer present.
+
+2010-05-21  Glenn Morris  <rgm@gnu.org>
+
+       * sed1v2.inp (@ns_frag@): Edit to nothing.
+
+       * sed1x.inp (OLDXMENU): Replace any initial value.
+       * sed1v2.inp (OLDXMENU): Edit to "nothing".
+
+       * sed1v2.inp (CANNOT_DUMP): Edit to no.
+
+2010-05-20  Glenn Morris  <rgm@gnu.org>
+
+       * sed1v2.inp (DEPFLAGS, deps_frag): Edit to empty.
+       (MKDEPDIR): Edit to ':'.
+
+2010-05-19  Glenn Morris  <rgm@gnu.org>
+
+       * sed2v2.inp (ORDINARY_LINK): Set here rather than in s/msdos.h.
+
+       * sed1v2.inp (LD): Edit to $(CC).
+       (YMF_PASS_LDFLAGS): Edit to `flags'.
+
+2010-05-18  Eli Zaretskii  <eliz@gnu.org>
+
+       * sed1x.inp: Add copyright notice.
+
+2010-05-18  Glenn Morris  <rgm@gnu.org>
+
+       * sed1v2.inp (RALLOC_OBJ): Edit to ralloc.o.
+
+       * sed1v2.inp (GMALLOC_OBJ): Edit to gmalloc.o.
+       (VMLIMIT_OBJ): Edit to vm-limit.o.
+
+2010-05-17  Glenn Morris  <rgm@gnu.org>
+
+       * sed1v2.inp (OLDXMENU_DEPS): Edit to empty.
+       * sed1x.inp (OLDXMENU_DEPS): Edit to ${OLDXMENU} ../src/${OLDXMENU}.
+
+2010-05-16  Glenn Morris  <rgm@gnu.org>
+
+       * sed1v2.inp (TEMACS_LDFLAGS2): Edit to $(LDFLAGS).
+
+       * sed1v2.inp (GNUSTEP_SYSTEM_LIBRARIES): Remove.
+       (NS_IMPL_GNUSTEP_TEMACS_LDFLAGS): Edit to empty.
+
+2010-05-15  Glenn Morris  <rgm@gnu.org>
+
+       * sed1v2.inp (LIBXMENU): Edit to empty.
+       * sed1x.inp (LIBXMENU): Expect empty initial value.
+
+       * sed1v2.inp (OLDXMENU): Edit to empty.
+       * sed1x.inp (OLDXMENU): Expect empty initial value.
+
+       * sed1v2.inp (LIBX_OTHER): Edit to empty.
+       * sed1x.inp (LIBX_OTHER): Expect empty initial value.
+
+       * sed1v2.inp (FONT_OBJ): Edit to empty for non-X case.
+       * sed1x.inp (FONT_OBJ): Edit to xfont.o for X case.
+
+2010-05-15  Eli Zaretskii  <eliz@gnu.org>
+
+       * sed3v2.inp (INSTALLABLES): Edit out extra ${EXEEXT} after
+       "emacsclient".
+       (emacsserver, timer, wakeup): Remove edit-out commands.
+
+       * sed1v2.inp (MSDOS_OBJ): Add w16select.o.
+       (TERMCAP_OBJ): Add termcap.o.
+
+2010-05-15  Glenn Morris  <rgm@gnu.org>
+
+       * sed1v2.inp (OLDXMENU_TARGET): Edit to empty.
+       * sed1x.inp (OLDXMENU_TARGET): Edit to really-oldxmenu.
+
+       * sed1v2.inp (LIBXT_OTHER): Edit to empty.
+
+2010-05-14  Glenn Morris  <rgm@gnu.org>
+
+       * sed1v2.inp (ns_appdir, ns_appbindir, ns_appsrc): Edit to empty.
+
+       * sed1v2.inp (MSDOS_OBJ): Edit to dosfns.o msdos.o.
+       (MSDOS_SUPPORT): Edit to $(MSDOS_SUPPORT_REAL).
+       * sed1x.inp (MSDOS_X_OBJ): Edit to w16select.o termcap.o.
+
+       * sed2x.inp (HAVE_WINDOW_SYSTEM): Define.
+       * sed1x.inp (TOOLTIP_SUPPORT): Edit to ${lispsource}tooltip.elc.
+       (WINDOW_SUPPORT): Edit to $(BASE_WINDOW_SUPPORT) $(X_WINDOW_SUPPORT).
+       * sed1v2.inp (MOUSE_SUPPORT): Edit to $(REAL_MOUSE_SUPPORT).
+       (TOOLTIP_SUPPORT, WINDOW_SUPPORT): Edit to empty.
+
+       * sed1v2.inp (FONT_OBJ): Use the plain X version (no XFT, Freetype).
+
+       * sed1v2.inp (@NS_IMPL_GNUSTEP_INC@): Edit to nil.
+
+2010-05-13  Glenn Morris  <rgm@gnu.org>
+
+       * sed1x.inp (OLDXMENU): Edit to ${oldXMenudir}libXMenu11.a.
+       (LIBXMENU): Edit to ${OLDXMENU}.
+       (LIBX_OTHER): Edit to ${LIBXT} ${LIBX_EXTRA}.
+
+       * sed1v2.inp (C_SWITCH_X_SYSTEM, C_SWITCH_X_SITE, LIB_STANDARD)
+       (FONTCONFIG_CFLAGS, FONTCONFIG_LIBS, FREETYPE_CFLAGS, FREETYPE_LIBS)
+       (LIBOTF_CFLAGS, LIBOTF_LIBS, M17N_FLT_CFLAGS, M17N_FLT_LIBS)
+       (GNU_OBJC_CFLAGS, GNUSTEP_SYSTEM_LIBRARIES, LIBRESOLV, LIBGPM):
+       Edit to empty.
+       (LIB_MATH): Edit to -lm.
+       (UNEXEC_OBJ): Edit to unexec.o.
+
+2010-05-12  Glenn Morris  <rgm@gnu.org>
+
+       * sed3v2.inp (INSTALLABLES): No more @LIB_SRC_EXTRA_INSTALLABLES@.
+
+       * sed1v2.inp (LIB_GCC): Edit to -Lgcc.
+
+2010-05-11  Glenn Morris  <rgm@gnu.org>
+
+       * sed1x.inp (LIBS_SYSTEM): Edit to -lxext -lsys.
+       * sed3x.inp: New file.
+
+2010-05-10  Glenn Morris  <rgm@gnu.org>
+
+       * sed1v2.inp, sed3v2.inp (LIBS_SYSTEM): Edit to empty.
+
+       * sed3v2.inp (BLESSMAIL_TARGET): Edit to need-blessmail.
+
 2010-05-07  Chong Yidong  <cyd@stupidchicken.com>
 
        * Version 23.2 released.
 
+2010-05-08  Glenn Morris  <rgm@gnu.org>
+
+       * sed1v2.inp (LIBS_TERMCAP): Edit to empty.
+       (TERMCAP_OBJ): Edit to tparam.o.
+
+2010-05-07  Eli Zaretskii  <eliz@gnu.org>
+
+       Fix breakage due to autoconfiscation of Makefile.in files.
+
+       * sed3v2.inp (C_SWITCH_MACHINE): Edit to empty.
+
+       * sed1v2.inp (@LIB_MATH@): Edit to -lm.
+       (C_SWITCH_MACHINE, C_SWITCH_SYSTEM, LD_SWITCH_SYSTEM_TEMACS)
+       (LD_SWITCH_X_SITE_AUX, LD_SWITCH_X_SITE_AUX_RPATH)
+       (LD_SWITCH_SYSTEM, LD_SWITCH_SYSTEM_EXTRA, LIBTIFF, LIBJPEG)
+       (LIBPNG, LIBGIF, LIBXPM, XFT_LIBS, DBUS_CFLAGS, DBUS_LIBS)
+       (DBUS_OBJ, GCONF_CFLAGS, GCONF_LIBS, GTK_OBJ, LIBXMU, LIBXSM)
+       (LIBXTR6, XOBJ, TOOLKIT_LIBW, WIDGET_OBJ, CYGWIN_OBJ, NS_OBJ)
+       (NS_SUPPORT, LIBSELINUX_LIBS, START_FILES): Edit to empty.
+       (XMENU_OBJ): Edit to xmenu.o.
+       (FONT_OBJ): Edit to value used for X on Unix.
+       (PRE_ALLOC_OBJ): Edit to lastfile.o.
+       (POST_ALLOC_OBJ): Edit to $(vmlimitobj).
+       (@unexec@): Edit to unexec.o.
+
+2010-05-06  Glenn Morris  <rgm@gnu.org>
+
+       * sed1v2.inp, sed5x.inp: Remove LN_S, unused.
+
+2010-04-01  Eli Zaretskii  <eliz@gnu.org>
+
+       Remove support for DJGPP v1.x.
+
+       * sed3.inp:
+       * sed2.inp:
+       * sed1.inp:
+       * mainmake: Files removed.
+
+2010-03-27  Eli Zaretskii  <eliz@gnu.org>
+
+       * sedlisp.inp (VPATH): Don't edit, no longer needed.
+       (lisp, srcdir): Adapt to lisp/Makefile.in changes.
+       (abs_top_builddir): New edit.
+
+       * sed3v2.inp (KRB4LIB, DESLIB, KRB5LIB, CRYPTOLIB, COM_ERRLIB)
+       (LIBHESIOD, LIBRESOLV, LIBS_MAIL): Edit to empty values.
+
+       * sed3.inp (KRB4LIB, DESLIB, KRB5LIB, CRYPTOLIB, COM_ERRLIB)
+       (LIBHESIOD, LIBRESOLV, LIBS_MAIL): Edit to empty values.
+
+       * sed1v2.inp (abs_builddir): Edit into "../src".
+
+2010-03-10  Chong Yidong  <cyd@stupidchicken.com>
+
+       * Branch for 23.2.
+
 2010-02-19  Eli Zaretskii  <eliz@gnu.org>
 
        * INSTALL: Remove a CVS-specific note.  Update for latest versions
 1994-10-17  Morten Welinder  <terra@mole.gnu.ai.mit.edu>
 
        * sed1.inp: Handle "\t#"-style comments.
-       (obj): Don't add any files -- now done in src/makefile.in.in
+       (obj): Don't add any files -- now done in src/makefile.in.in.
        (temacs): Don't depend on prefix-args.
        (DOC): Reflect makefile changes regarding two-batch run.
 
diff --git a/msdos/mainmake b/msdos/mainmake
deleted file mode 100644 (file)
index c5f2f88..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-# Copyright (C) 1993, 1994, 1995, 1996, 2001, 2002, 2003, 2004,
-#   2005, 2006, 2007, 2008, 2009, 2010 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/>.
-
-# make all     to compile and build Emacs.
-# make install to install it.
-# make TAGS    to update tags tables.
-#
-# make clean  or  make mostlyclean
-#      Delete all files from the current directory that are normally
-#      created by building the program.         Don't delete the files that
-#      record the configuration.  Also preserve files that could be made
-#      by building, but normally aren't because the distribution comes
-#      with them.
-#
-#      Delete `.dvi' files here if they are not part of the distribution.
-#
-# make distclean
-#      Delete all files from the current directory that are created by
-#      configuring or building the program.  If you have unpacked the
-#      source and built the program without creating any other files,
-#      `make distclean' should leave only the files that were in the
-#      distribution.
-#
-# make realclean
-#      Delete everything from the current directory that can be
-#      reconstructed with this Makefile.  This typically includes
-#      everything deleted by distclean, plus more: C source files
-#      produced by Bison, tags tables, info files, and so on.
-#
-# make extraclean
-#      Still more severe - delete backup and autosave files, too.
-
-all:   lib-src src
-
-lib-src: FRC
-       cd lib-src
-       $(MAKE)
-       cd ..
-
-src: FRC
-       cd src
-       $(MAKE)
-       cd ..
-
-install: all
-       -md bin
-       cd lib-src
-       coff2exe hexl
-       coff2exe etags
-       coff2exe ctags
-       coff2exe b2m
-       mv -f hexl.exe etags.exe ctags.exe b2m.exe ../bin/
-       cd ..
-       cd src
-       coff2exe emacs
-       stubedit emacs.exe minstack=512k
-       mv -f emacs.exe ../bin/
-       cd ..
-
-FRC:
-
-TAGS tags:     lib-src
-       cd src
-       go32 ../lib-src/etags *.[ch] ../lisp/*.el ../lisp/term/*.el
-       cd ..
-
-check:
-       @echo "We don't have any tests for GNU Emacs yet."
-
-clean:
-       cd lib-src
-       $(MAKE) clean
-       cd ..
-       cd src
-       $(MAKE) clean
-       cd ..
-       cd oldxmenu
-       -$(MAKE) clean
-       cd ..
-
-# arch-tag: d5a489bc-818e-4c3c-8040-b5205ed0602f
index 7044b82f64f934f42c6bdf604b343fd431ddd0d2..79bd827d8c6e1752d36bf9a235448147b6d73e32 100644 (file)
@@ -65,13 +65,13 @@ MAKESHELL=/xyzzy/command
 top_srcdir := $(subst \,/,$(shell cd))
 
 # Find out which version of Emacs this is.
-version := ${shell sed -n -e '/(defconst emacs-version/s/^[^"]*\("[^"]*"\).*/\1/p' lisp/version.el}
+version := ${shell sed -n -e '/^static const char emacs_version/s/^[^"]*\("[^"]*"\).*/\1/p' src/emacs.c}
 
 # Q: Do we need to bootstrap?
-# A: Only if we find admin/admin.el, i.e. we are building out of CVS,
-#    and src/b-emacs.exe does not exist.  This avoids building a
-#    bootstrap-emacs and recompiling Lisp files when building a
-#    pretest/release tarball.
+# A: Only if we find admin/admin.el, i.e. we are building out of 
+#    a VCS-checkout (not a release) and src/b-emacs.exe does not exist.
+#    This avoids building a bootstrap-emacs and recompiling Lisp files
+#    when building a pretest/release tarball.
 boot :=
 ifneq ($(wildcard admin/admin.el),)
 ifeq ($(wildcard src/b-emacs.exe),)
diff --git a/msdos/sed1.inp b/msdos/sed1.inp
deleted file mode 100644 (file)
index 4ecbbfa..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-# -sed1.inp-------------------------------------------------------------
-# Configuration script for src/makefile
-# ----------------------------------------------------------------------
-#
-# Copyright (C) 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2002, 2003,
-#   2004, 2005, 2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
-#
-# This file is part of GNU Emacs.
-#
-# This file is free software; as a special exception, the author gives
-# unlimited permission to copy and/or distribute it, with or without
-# modifications, as long as this notice is preserved.
-#
-# 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.
-#
-# ----------------------------------------------------------------------
-# In case src/Makefile needs to rebuild `make-doc.exe' (might happen under
-# Windows 95), make sure it gets built with commands that DOS
-# understands (one command per line).
-s/^#.*//
-s/^[ \f\t][ \f\t]*$//
-s/^ /  /
-s/\.h\.in/.h-in/
-s!^    \./temacs!      go32 temacs!
-s!/bin/sh!command.com!
-/^MAKE *=/s/^/# /
-/^SHELL *=/s/^/# /
-/^srcdir *=/s/@[^@\n]*@/./
-/^VPATH *=/s/@[^@\n]*@/./
-/^CC *=/s/@[^@\n]*@/gcc/
-/^CPP *=/s/@[^@\n]*@/gcc -e/
-/^CFLAGS *=/s/@[^@\n]*@/-O2 -g/
-/^LIBS *=/s/@[^@\n]*@//
-/^LIBOBJS *=/s/@[^@\n]*@//
-/^LN_S *=/s/@[^@\n]*@/ln -s/
-/^M_FILE *=/s!@[^@\n]*@!m/intel386.h!
-/^S_FILE *=/s!@[^@\n]*@!s/msdos.h!
-/^@SET_MAKE@$/s/@SET_MAKE@//
-/^.\${libsrc}make-docfile.*>/s!make-docfile!make-doc.exe -o ../etc/DOC!
-/^.\${libsrc}make-doc/s!>.*$!!
-/^\${libsrc}make-docfile:/c\
-${libsrc}make-doc.exe:\
-       cd ..\
-       cd lib-src\
-       $(MAKE) ${MFLAGS} make-docfile -W make-docfile.c\
-       cd ..\
-       cd src
-/^     cd \${libsrc}; \${MAKE} \${MFLAGS} make-docfile/d
-/\${libsrc}make-docfile/s/-docfile[    ]/-doc.exe /
-/^[\f   ]*$/d
-/^temacs:/s/prefix-args//
-/^temacs:/s/stamp-oldxmenu//
-/^     #/d
-
-# arch-tag: 246725c1-79de-4d03-a080-8f19329fa35e
index b52b088b617a9f555a48710b2f3faae5de35584f..e9dfc9dea3dc8e9c08af036135a8a570dc773930 100644 (file)
@@ -2,8 +2,8 @@
 # Configuration script for src/Makefile under DJGPP v2.x
 # ----------------------------------------------------------------------
 #
-# Copyright (C) 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004,
-#   2005, 2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+#   2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
 #
 # This file is part of GNU Emacs.
 #
@@ -20,15 +20,10 @@ s/^#.*//
 s/^[ \f\t][ \f\t]*$//
 s/^ /  /
 s/\.h\.in/.h-in/
-/^     LC_ALL=C \$(RUN_TEMACS)/i\
-       stubedit temacs.exe minstack=1024k
-/^     LC_ALL=C.*\$(RUN_TEMACS)/s/LC_ALL=C/set &;/
-/-batch -l loadup/a\
-       stubify emacs\
-       stubedit emacs.exe minstack=2048k
 /^MAKE *=/s/^/# /
 /^SHELL *=/s/^/# /
 /^srcdir *=/s/@[^@\n]*@/./
+/^abs_builddir *=/s|@abs_builddir@|../src|
 /^VPATH *=/s/@[^@\n]*@/./
 /^CC *=/s/@[^@\n]*@/gcc/
 /^CPP *=/s/@[^@\n]*@/gcc -e/
@@ -41,33 +36,128 @@ s/\.h\.in/.h-in/
   s/@[^@\n]*@//g
 }
 /^LIBOBJS *=/s/@[^@\n]*@/getloadavg.o/
-/^GETLOADAVG_LIBS *=/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@//
+/^C_SWITCH_X_SITE *=/s/@C_SWITCH_X_SITE@//
+/^C_WARNINGS_SWITCH *=/s/@C_WARNINGS_SWITCH@//
+/^PROFILING_CFLAGS *=/s/@PROFILING_CFLAGS@//
+/^PROFILING_LDFLAGS *=/s/@PROFILING_LDFLAGS@//
+#/^LD_SWITCH_X_SITE *=/s/@LD_SWITCH_X_SITE@//
+/^LD_SWITCH_SYSTEM_TEMACS *=/s/@LD_SWITCH_SYSTEM_TEMACS@//
+/^LD_SWITCH_X_SITE_AUX *=/s/@LD_SWITCH_X_SITE_AUX@//
+/^LD_SWITCH_X_SITE_AUX_RPATH *=/s/@LD_SWITCH_X_SITE_AUX_RPATH@//
+/^LD_SWITCH_SYSTEM *=/s/@LD_SWITCH_SYSTEM@//
+/^TEMACS_LDFLAGS2 *=/s/@TEMACS_LDFLAGS2@/$(LDFLAGS)/
+/^LIBS_SYSTEM *=/s/@LIBS_SYSTEM@//
+/^LIB_GCC *=/s/@LIB_GCC@//
+/^LD *=/s/@LINKER@/$(CC)/
+/^LIB_STANDARD *=/s/@LIB_STANDARD@//
+/^LIB_MATH *=/s/@LIB_MATH@/-lm/
+/^LIBTIFF *=/s/@LIBTIFF@//
+/^LIBJPEG *=/s/@LIBJPEG@//
+/^LIBPNG *=/s/@LIBPNG@//
+/^LIBGIF *=/s/@LIBGIF@//
+/^LIBXPM *=/s/@LIBXPM@//
+/^XFT_LIBS *=/s/@XFT_LIBS@//
+/^FONTCONFIG_CFLAGS *=/s/@FONTCONFIG_CFLAGS@//
+/^FONTCONFIG_LIBS *=/s/@FONTCONFIG_LIBS@//
+/^FREETYPE_CFLAGS *=/s/@FREETYPE_CFLAGS@//
+/^FREETYPE_LIBS *=/s/@FREETYPE_LIBS@//
+/^LIBOTF_CFLAGS *=/s/@LIBOTF_CFLAGS@//
+/^LIBOTF_LIBS *=/s/@LIBOTF_LIBS@//
+/^M17N_FLT_CFLAGS *=/s/@M17N_FLT_CFLAGS@//
+/^M17N_FLT_LIBS *=/s/@M17N_FLT_LIBS@//
+/^DBUS_CFLAGS *=/s/@DBUS_CFLAGS@//
+/^DBUS_LIBS *=/s/@DBUS_LIBS@//
+/^DBUS_OBJ *=/s/@DBUS_OBJ@//
+/^GCONF_CFLAGS *=/s/@GCONF_CFLAGS@//
+/^GCONF_LIBS *=/s/@GCONF_LIBS@//
+/^GTK_OBJ *=/s/@GTK_OBJ@//
+/^LIBS_TERMCAP *=/s/@LIBS_TERMCAP@//
+/^TERMCAP_OBJ *=/s/@TERMCAP_OBJ@/termcap.o tparam.o/
+/^LIBXMU *=/s/@LIBXMU@//
+/^LIBXSM *=/s/@LIBXSM@//
+/^LIBXTR6 *=/s/@LIBXTR6@//
+/^LIBXT_OTHER *=/s/@LIBXT_OTHER@//
+/^OLDXMENU_TARGET *=/s/@OLDXMENU_TARGET@//
+/^OLDXMENU_DEPS *=/s/@OLDXMENU_DEPS@//
+/^XOBJ *=/s/@XOBJ@//
+/^TOOLKIT_LIBW *=/s/@TOOLKIT_LIBW@//
 /^LIBSOUND *=/s/@LIBSOUND@//
 /^CFLAGS_SOUND *=/s/@CFLAGS_SOUND@//
 /^RSVG_LIBS *=/s/@RSVG_LIBS@//
 /^RSVG_CFLAGS *=/s/@RSVG_CFLAGS@//
+/^IMAGEMAGICK_LIBS *=/s/@IMAGEMAGICK_LIBS@//
+/^IMAGEMAGICK_CFLAGS *=/s/@IMAGEMAGICK_CFLAGS@//
+/^WIDGET_OBJ *=/s/@WIDGET_OBJ@//
+/^CYGWIN_OBJ *=/s/@CYGWIN_OBJ@//
+/^MSDOS_OBJ *=/s/= */= dosfns.o msdos.o w16select.o/
+/^MSDOS_SUPPORT *=/s/= */= $(MSDOS_SUPPORT_REAL)/
+/^ns_appdir *=/s/@ns_appdir@//
+/^ns_appbindir *=/s/@ns_appbindir@//
+/^ns_appsrc *=/s/@ns_appsrc@//
+/^NS_OBJ *=/s/@NS_OBJ@//
+/^NS_SUPPORT *=/s/@NS_SUPPORT@//
+/^GNU_OBJC_CFLAGS*=/s/@GNU_OBJC_CFLAGS@//
+/^LIBRESOLV *=/s/@LIBRESOLV@//
+/^LIBSELINUX_LIBS *=/s/@LIBSELINUX_LIBS@//
+/^GETLOADAVG_LIBS *=/s/@[^@\n]*@//
+/^START_FILES *=/s/@START_FILES@//
 /^OTHER_FILES *=/s/@OTHER_FILES@//
+/^XMENU_OBJ *=/s/@XMENU_OBJ@/xmenu.o/
+/^FONT_OBJ *=/s/@FONT_OBJ@//
+/^MOUSE_SUPPORT *=/s/@MOUSE_SUPPORT@/$(REAL_MOUSE_SUPPORT)/
+/^TOOLTIP_SUPPORT *=/s/@TOOLTIP_SUPPORT@//
+/^WINDOW_SUPPORT *=/s/@WINDOW_SUPPORT@//
+/^LIBGPM *=/s/@LIBGPM@//
 /^EXEEXT *=/s/@EXEEXT@/.exe/
+/^OLDXMENU *=/s/@OLDXMENU@/nothing/
+/^LIBXMENU *=/s/@LIBXMENU@//
+/^LIBX_OTHER *=/s/@LIBX_OTHER@//
+/^GMALLOC_OBJ *=/s/@GMALLOC_OBJ@/gmalloc.o/
+/^VMLIMIT_OBJ *=/s/@VMLIMIT_OBJ@/vm-limit.o/
+/^RALLOC_OBJ *=/s/@RALLOC_OBJ@/ralloc.o/
+/^PRE_ALLOC_OBJ *=/s/@PRE_ALLOC_OBJ@/lastfile.o/
+/^POST_ALLOC_OBJ *=/s/@POST_ALLOC_OBJ@/$(vmlimitobj)/
+/^UNEXEC_OBJ *=/s/@UNEXEC_OBJ@/unexcoff.o/
+/^CANNOT_DUMP *=/s/@CANNOT_DUMP@/no/
+/^DEPFLAGS *=/s/@DEPFLAGS@//
+/^MKDEPDIR *=/s/@MKDEPDIR@//
 /^version *=/s/@[^@\n]*@//
-/^LN_S *=/s/@[^@\n]*@/ln -s/
 /^M_FILE *=/s!@[^@\n]*@!m/intel386.h!
 /^S_FILE *=/s!@[^@\n]*@!s/msdos.h!
 /^@SET_MAKE@$/s/@SET_MAKE@//
 /^.\${libsrc}make-docfile.*>/s!make-docfile!make-docfile -o ../etc/DOC!
 /^.\${libsrc}make-doc/s!>.*$!!
 /^[\f   ]*$/d
-/^temacs:/s/prefix-args//
-/^temacs:/s/stamp-oldxmenu//
+/^     if test -f/,/^  fi$/c\
+       command.com /c if exist .gdbinit rm -f _gdbinit
+/^     if test "\${CANNOT_DUMP}" =/,/^ else /d
+/^     fi/d
+/^     LC_ALL=C \$(RUN_TEMACS)/i\
+       stubedit temacs.exe minstack=1024k
+/^      *LC_ALL=C.*\$(RUN_TEMACS)/s/LC_ALL=C/set &;/
+/-batch -l loadup/a\
+       stubify emacs\
+       stubedit emacs.exe minstack=2048k
+s/ || exit 1\; \\$//
+s/ || true\; \\$//
 /^RUN_TEMACS *=/s|`/bin/pwd`|.|
+/^      *@\$(MKDEPDIR) *$/d
 /^     mv \.\/\.gdbinit/d
-/^     if test -f/c\
+/^     if test -f/,/^  fi$/c\
        command.com /c if exist .gdbinit rm -f _gdbinit
-/^     else mv \.\/\.gdbinit/d
 /^     #/d
 /^     cd.*make-docfile/s!$!; cd ${dot}${dot}/src!
 /^     @: /d
-/^     -\{0,1\}ln -/s/ln -f/cp -pf/
+/^     -\{0,1\} *ln -/s/ln -f/cp -pf/
 /^[    ]touch /s/touch/djecho $@ >/
+s/@YMF_PASS_LDFLAGS@/flags/
+s/@deps_frag@//
+s/@ns_frag@//
+s/@PRE_EDIT_LDFLAGS@//
+s/@POST_EDIT_LDFLAGS@//
 s/bootstrap-emacs/b-emacs/
 s/bootstrap-temacs/b-temacs/
 s/bootstrap-doc/b-doc/
@@ -81,7 +171,8 @@ s/echo.*buildobj.lst/dj&/
        stubedit b-emacs.exe minstack=3072k\
        djecho bootlisp > bootlisp
 /^     -\{0,1\}rm -f/s/\\#/#/
-/^     @\{0,1\}cd ..\/lisp; /s|$|\; cd ../src|
+/^     @\{0,1\}cd ..\/lisp;.*[^\]$/s|$|\; cd ../src|
+/^      *THEFILE=/s|$|\; cd ../src|
 /^     echo.* buildobj.h/s|echo |djecho |
 
 # arch-tag: c7e3aacb-4162-460e-99f9-4252bca68d2c
index 2a7ce82d528c90a0f3ba481e3b1c62133da16820..aa755ee784f910853f07c892613fbc986a2c22aa 100644 (file)
@@ -1,10 +1,34 @@
 # -sed1x.inp------------------------------------------------------------
 # Extra configuration script for src/makefile for DesqView/X
 # ----------------------------------------------------------------------
+#
+# Copyright (C) 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004,
+#   2005, 2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
+#
+# This file is part of GNU Emacs.
+#
+# This file is free software; as a special exception, the author gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+#
+# 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.
+#
+# ----------------------------------------------------------------------
 s!^    cd \${oldXMenudir}; \${MAKE}.*$!        ${MAKE} -C ${oldXMenudir}.!
 s!^    @true *$!       @rem!
 s/DOC/DOC-X/g
-#/^LIBXMENU *=/s!= *!= ../oldxmenu/!
+/^OLDXMENU *=/s!=.*!= ${oldXMenudir}libXMenu11.a!
+/^LIBXMENU *=/s!= *!= ${OLDXMENU}!
+/^LIBX_OTHER *=/s!= *!= ${LIBXT} ${LIBX_EXTRA}!
+/^OLDXMENU_TARGET *=/s!= *!= really-oldxmenu!
+/^OLDXMENU_DEPS *=/s!= *!= ${OLDXMENU} ../src/${OLDXMENU}!
+/^LIBS_SYSTEM *=/s!= *!= -lxext -lsys!
+/^MSDOS_X_OBJ *=/s!= *!= w16select.o termcap.o!
+/^FONT_OBJ *=/s!= *!= xfont.o!
+/^TOOLTIP_SUPPORT *=/s!= *!= ${lispsource}tooltip.elc!
+/^WINDOW_SUPPORT *=/s!= *!= $(BASE_WINDOW_SUPPORT) $(X_WINDOW_SUPPORT)!
 /^temacs *:/s!OLDXMENU!LIBXMENU!
 
 # arch-tag: 3e8a78f2-3dec-44f3-81f6-3785a562da19
diff --git a/msdos/sed2.inp b/msdos/sed2.inp
deleted file mode 100644 (file)
index beb95c2..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-# -sed2.inp-------------------------------------------------------------
-# Configuration script for src/config.h
-# ----------------------------------------------------------------------
-#
-# Copyright (C) 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002,
-#   2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
-#
-# This file is part of GNU Emacs.
-#
-# This file is free software; as a special exception, the author gives
-# unlimited permission to copy and/or distribute it, with or without
-# modifications, as long as this notice is preserved.
-#
-# 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.
-#
-# ----------------------------------------------------------------------
-/^#undef LISP_FLOAT_TYPE *$/s/undef/define/
-/^#undef GNU_MALLOC *$/s/undef/define/
-/^#undef REL_ALLOC *$/s/undef/define/
-/^#undef HAVE_SYS_SELECT/i\
-/^#undef STDC_HEADERS *$/s/undef/define/
-/^#undef HAVE_SYS_TIMEB_H *$/s/undef/define/
-/^#undef HAVE_SYS_TIME_H *$/s/undef/define/
-# /^#undef HAVE_UNISTD_H *$/s/undef/define/
-/^#undef HAVE_GETTIMEOFDAY *$/s/undef/define/
-/^#undef HAVE_GETHOSTNAME *$/s/undef/define/
-/^#undef HAVE_DUP2 *$/s/undef/define/
-/^#undef HAVE_TM_ZONE *$/s/undef/define/
-/^#undef LOCALTIME_CACHE *$/s/undef/define/
-/^#undef HAVE_TZSET *$/s/undef/define/
-/^#undef TM_IN_SYS_TIME *$/s/undef/define/
-/^#undef TIME_WITH_SYS_TIME *$/s/undef/define/
-/^#undef HAVE_RENAME *$/s/undef/define/
-/^#undef HAVE_CLOSEDIR *$/s/undef/define/
-/^#undef HAVE_RANDOM *$/s/undef/define/
-/^#undef HAVE_MKDIR *$/s/undef/define/
-/^#undef HAVE_RMDIR *$/s/undef/define/
-/^#undef HAVE_BCMP *$/s/undef/define/
-/^#undef HAVE_BCOPY *$/s/undef/define/
-/^#undef HAVE_FREXP *$/s/undef/define/
-/^#undef HAVE_FTIME *$/s/undef/define/
-/^#undef HAVE_MKTIME *$/s/undef/define/
-/^#undef HAVE_STRERROR *$/s/undef/define/
-/^#undef HAVE_TIMEVAL *$/s/undef/define/
-s/^#define USER_FULL_NAME .*$/#define USER_FULL_NAME (getenv ("NAME"))/
-s/^#undef STACK_DIRECTION *$/#define STACK_DIRECTION -1/
-s/^#undef EMACS_CONFIGURATION *$/#define EMACS_CONFIGURATION "i386-pc-msdosdjgpp"/
-s/^#undef EMACS_CONFIG_OPTIONS *$/#define EMACS_CONFIG_OPTIONS "-"/
-s!^#undef config_opsysfile *$!#define config_opsysfile "s/msdos.h"!
-s!^#undef config_machfile *$!#define config_machfile "m/intel386.h"!
-s/^#undef PROTOTYPES *$/#define PROTOTYPES 1/
-s/^#undef POINTER_TYPE *$/#define POINTER_TYPE void/
-
-# arch-tag: 31840234-109a-41ab-a675-7a3844978299
index ea3f1718646a1f9040966fecb6e2ff3e0fc7fe45..3e77fe4f0234e19bf1d7d1cc553378581f080e30 100644 (file)
@@ -27,7 +27,6 @@
 #define NSIG 320\
 #endif
 
-/^#undef HAVE_ALLOCA *$/s/^.*$/#define HAVE_ALLOCA 1/
 /^#undef HAVE_SETITIMER *$/s/^.*$/#define HAVE_SETITIMER 1/
 /^#undef HAVE_STRUCT_UTIMBUF *$/s/^.*$/#define HAVE_STRUCT_UTIMBUF 1/
 /^#undef LOCALTIME_CACHE *$/s/^.*$/#define LOCALTIME_CACHE 1/
@@ -39,6 +38,7 @@
 /^#undef HAVE_CBRT *$/s/^.*$/#define HAVE_CBRT 1/
 /^#undef HAVE_DIFFTIME *$/s/^.*$/#define HAVE_DIFFTIME 1/
 /^#undef HAVE_FPATHCONF *$/s/^.*$/#define HAVE_FPATHCONF 1/
+/^#undef HAVE_MEMSET *$/s/^.*$/#define HAVE_MEMSET 1/
 /^#undef HAVE_MEMCMP *$/s/^.*$/#define HAVE_MEMCMP 1/
 /^#undef HAVE_MEMMOVE *$/s/^.*$/#define HAVE_MEMMOVE 1/
 /^#undef HAVE_SETRLIMIT *$/s/^.*$/#define HAVE_SETRLIMIT 1/
 /^#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_INDEX *$/s/^.*$/#define HAVE_INDEX 1/
 /^#undef HAVE_SIZE_T *$/s/^.*$/#define HAVE_SIZE_T 1/
-/^#undef HAVE_RINDEX *$/s/^.*$/#define HAVE_RINDEX 1/
 /^#undef HAVE_MKSTEMP *$/s/^.*$/#define HAVE_MKSTEMP 1/
 /^#undef HAVE_STRUCT_TM_TM_ZONE *$/s/^.*$/#define HAVE_STRUCT_TM_TM_ZONE 1/
 /^#undef HAVE_SYNC *$/s/^.*$/#define HAVE_SYNC 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 SYS_SIGLIST_DECLARED/s/^.*$/#define SYS_SIGLIST_DECLARED 1/
+/^#undef HAVE_DIRENT_H/s/^.*$/#define HAVE_DIRENT_H 1/
 
 /^#undef GNU_MALLOC *$/s/^.*$/#define GNU_MALLOC 1/
 /^#undef REL_ALLOC *$/s/^.*$/#define REL_ALLOC 1/
@@ -84,14 +84,6 @@ s/^#undef POINTER_TYPE *$/#define POINTER_TYPE void/
 #else\
 #undef HAVE_STDINT_H\
 #endif
-# GCC 3.x has a built-in bzero, which conflicts with the define at
-# the end of config.in
-/^#undef HAVE_BZERO/c\
-#if __GNUC__ >= 3\
-#define HAVE_BZERO 1\
-#else\
-#undef HAVE_BZERO\
-#endif
 
 # Comment out any remaining undef directives, because some of them
 # might be defined in sys/config.h we include at the top of config.h.
index 64d138e1b097e542fbc03bf363e4ac8eaf7736e1..d17dd85ace6c319bcd6dbaae166294e73774a930 100644 (file)
@@ -2,8 +2,8 @@
 # Extra configuration script for src/config.h for DesqView/X
 # ----------------------------------------------------------------------
 #
-# Copyright (C) 1994, 2001, 2002, 2003, 2004, 2005,
-#   2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
+# Copyright (C) 1994, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+#   2009, 2010  Free Software Foundation, Inc.
 #
 # This file is part of GNU Emacs.
 #
@@ -17,6 +17,7 @@
 #
 # ----------------------------------------------------------------------
 /^#undef HAVE_X_WINDOWS *$/s/undef/define/
+/^#undef HAVE_WINDOW_SYSTEM *$/s/undef/define/
 /^#undef HAVE_X11 *$/s/undef/define/
 /^#undef HAVE_X_MENU *$/s/undef/define/
 /^#undef HAVE_XSCREENNUMBEROFSCREEN *$/s/undef/define/
diff --git a/msdos/sed3.inp b/msdos/sed3.inp
deleted file mode 100644 (file)
index 21a8e32..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-# -sed3.inp-------------------------------------------------------------
-# Configuration script for lib-src/makefile
-# ----------------------------------------------------------------------
-#
-# Copyright (C) 1993, 1994, 1995, 2001, 2002, 2003, 2004,
-#   2005, 2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
-#
-# This file is part of GNU Emacs.
-#
-# This file is free software; as a special exception, the author gives
-# unlimited permission to copy and/or distribute it, with or without
-# modifications, as long as this notice is preserved.
-#
-# 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.
-#
-# ----------------------------------------------------------------------
-/^# DIST: /d
-/^SHELL *=/s/^/# /
-/^CC *=/s/=.*$/=gcc/
-# Actually, here we should patch in the exact version number, but only
-# [ce]tags uses it.  Don't pass it.  This is more update-resistant.
-/-DVERSION=/s/-DVERSION="\\"\${version}\\""//
-/^configname *=/s/=.*$/=msdos/
-/^archlibdir *=/s!=.*$!=/emacs/bin!
-/^bindir *=/s!=.*$!=/emacs/bin!
-/^libdir *=/s!=.*$!=/emacs/bin!
-/^srcdir *=/s!=.*$!=.!
-/^VPATH *=/s!=.*$!=.!
-/^CFLAGS *=/s!=.*$!=-O2 -g!
-/^C_SWITCH_SYSTEM *=/s!=.*$!=-DMSDOS!
-/^LOADLIBES *=/s!=.*$!=!
-/^ALLOCA *=/s!=.*$!=alloca.o!
-/^INSTALLABLES/s/emacsclient *//
-s!^    \./!    go32 ./!
-/^UTILITIES=/s/ wakeup//
-/^UTILITIES=/s/ movemail//
-/^UTILITIES=/s/ emacsserver//
-/^UTILITIES=/s/ timer//
-/^all *:/s/$/ make-docfile/
-s!^    go32 ./test-distrib!    go32 ./test-dis!
-/-o make-docfile/a\
-       coff2exe make-docfile
-
-# arch-tag: cac6f5c7-3dbf-4e84-9d0c-44f0126f0ea8
index faabfc8c30535b9baa4957f598f4dfc4b68310ee..9e2e3ebd23f5087646f1043cff31e44281e3ff1f 100644 (file)
 /^libdir *=/s!=.*$!=/emacs/bin!
 /^srcdir=/s!srcdir=@srcdir@!srcdir := $(subst \\,/,$(shell command.com /c cd))!
 /^VPATH *=/s!=.*$!=.!
+/^BLESSMAIL_TARGET *=/s!@BLESSMAIL_TARGET@!need-blessmail!
+/^KRB4LIB *=/s/@[^@\n]*@//g
+/^DESLIB *=/s/@[^@\n]*@//g
+/^KRB5LIB *=/s/@[^@\n]*@//g
+/^CRYPTOLIB *=/s/@[^@\n]*@//g
+/^COM_ERRLIB *=/s/@[^@\n]*@//g
+/^LIBHESIOD *=/s/@[^@\n]*@//g
+/^LIBRESOLV *=/s/@[^@\n]*@//g
+/^LIBS_MAIL *=/s/@[^@\n]*@//g
+/^LIBS_SYSTEM *=/s/@[^@\n]*@//g
 /^CFLAGS *=/s!=.*$!=-O2 -g!
 /^C_SWITCH_SYSTEM *=/s!=.*$!=-DMSDOS!
+/^C_SWITCH_MACHINE *=/s/@C_SWITCH_MACHINE@//
+/^C_WARNINGS_SWITCH *=/s/@C_WARNINGS_SWITCH@//
+/^PROFILING_CFLAGS *=/s/@PROFILING_CFLAGS@//
+/^PROFILING_LDFLAGS *=/s/@PROFILING_LDFLAGS@//
 /^LOADLIBES *=/s!=.*$!=!
 /^ALLOCA *=/s!@ALLOCA@!!
 /^EXEEXT *=/s!@EXEEXT@!!
 /^GETOPT_H *=/s!@GETOPT_H@!getopt.h!
 /^GETOPTOBJS *=/s!@GETOPTOBJS@!getopt.o getopt1.o!
-/^INSTALLABLES/s/emacsclient *//
-/^INSTALLABLES/s/ @LIB_SRC_EXTRA_INSTALLABLES@//
+/^INSTALLABLES/s/emacsclient[^ ]* *//
 s!^    \./!    !
-/^UTILITIES=/s/ wakeup//
-/^UTILITIES=/s/ movemail//
-/^UTILITIES=/s/ emacsserver//
-/^UTILITIES=/s/ timer//
+/^UTILITIES *=/,/^$/{
+  s/movemail[^ ]* *//
+}
 
 # arch-tag: 16f3be18-a45b-496c-b19c-e43840359de8
diff --git a/msdos/sed3x.inp b/msdos/sed3x.inp
new file mode 100644 (file)
index 0000000..71148c9
--- /dev/null
@@ -0,0 +1,5 @@
+# -sed3x.inp------------------------------------------------------------
+# Extra configuration script for lib-src/makefile for DesqView/X
+# ----------------------------------------------------------------------
+/^LIBS_SYSTEM *=/s!= *!= -lxext -lsys!
+
index 6f2e08d23de32ba0ad0f477dd350f2b3d11f3116..e706b785d7b09a65fabc8906e3c968fd316373c1 100644 (file)
@@ -2,8 +2,8 @@
 # Configuration script for oldxmenu/makefile for DesqView/X
 # ----------------------------------------------------------------------
 #
-# Copyright (C) 1994, 2001, 2002, 2003, 2004, 2005,
-#   2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
+# Copyright (C) 1994, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+#   2009, 2010  Free Software Foundation, Inc.
 #
 # This file is part of GNU Emacs.
 #
@@ -22,7 +22,6 @@
 /^CC *=/s/@[^@\n]*@/gcc/
 /^CPP *=/s/@[^@\n]*@/gcc -e/
 /^CFLAGS *=/s/@[^@\n]*@/-O2 -g/
-/^LN_S *=/s/@[^@\n]*@/ln -s/
 s/|| true//
 
 # arch-tag: 612a79be-2a02-4cb0-8dec-779aac0a2f4f
index 20da3e64ae59729c3936e3d58adccb4fcc2aeca2..b5193e665a76be7400bd9f39b02f57cd3b2db874 100644 (file)
@@ -34,7 +34,7 @@ s|\([         ]\)echo|\1djecho|g
 
 /RUN-EMACS *=/,/^$/c\
 export EMACSLOADPATH=${buildlisppath}\
-RUN-EMACS = ${BUILT-EMACS} -batch --no-init-file --no-site-file --multibyte
+RUN-EMACS = ${BUILT-EMACS} -batch --no-init-file --no-site-file
 
 /^     cd ../c\
        ${MAKE} -C ../src ${MFLAGS} emacs
index f00ca986601c24d17d1367e14e1021b4613f1d9d..152dafbaa39226e470a3e59eed83680a3ee61d5d 100644 (file)
@@ -20,8 +20,9 @@
 /^SHELL *=/i\
 export FNCASE=y
 
-/^lisp=/s|@srcdir@|$(CURDIR)|
-/^VPATH=/s|@srcdir@|.|
-/^srcdir=/s|@srcdir@|.|
+/^lisp *=/s|\$(srcdir)|$(CURDIR)|
+/^srcdir *=/s|@srcdir@|.|
+/^top_srcdir *=/s|@top_srcdir@|./..|
+/^abs_top_builddir *=/s|@abs_top_builddir@|$(CURDIR)/..|
 
 # arch-tag: da7a3cff-4839-4ad7-bbe3-e2b61c84c38e
index 9396f90a5c77b0246102e82f70cf62cf48e3612e..17df993cab76d50bddcbcc11c8eb0216fda32a6d 100644 (file)
@@ -2,6 +2,10 @@
 
        * Version 23.2 released.
 
+2010-03-10  Chong Yidong  <cyd@stupidchicken.com>
+
+       * Branch for 23.2.
+
 2010-01-11  Glenn Morris  <rgm@gnu.org>
 
        * Cocoa/Emacs.base/Contents/Info.plist:
index 64ea836fbf667380497d3ec1da28f655f4602ff0..f064a1248ea60b5ee8ed61448f2fa84ed1ef5980 100644 (file)
@@ -1,5 +1,5 @@
 <!--
-Copyright (C) 2008, 2009  Free Software Foundation, Inc.
+Copyright (C) 2008, 2009, 2010  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -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 23.2.50 Copyright (C) 2010 Free Software Foundation, Inc.</string>
+       <string>Emacs 24.0.50 Copyright (C) 2010 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>23.2.50</string>
+       <string>24.0.50</string>
        <key>CFBundleSignature</key>
        <string>EMAx</string>
        <!-- This SHOULD be a build number. -->
index ce2d9dfa404762b2dccf2abd703a99473cc0cea1..197e42cb6fb921963869aeb106058a71b74bfc19 100644 (file)
@@ -1,6 +1,6 @@
 /* Localized versions of Info.plist keys */
 
 CFBundleName = "Emacs";
-CFBundleShortVersionString = "Version 23.2.50";
-CFBundleGetInfoString = "Emacs version 23.2.50, NS Windowing";
+CFBundleShortVersionString = "Version 24.0.50";
+CFBundleGetInfoString = "Emacs version 24.0.50, NS Windowing";
 NSHumanReadableCopyright = "Copyright (C) 2010 Free Software Foundation, Inc.";
index bf3ad7908b5c8e6e0f454ddb10ce0621862f19ba..462101f9abfc32049eeec00bfeb99d3e993d5d3a 100644 (file)
@@ -64,13 +64,8 @@ functions are:
 
 Currently ctrl-g is not detected in as many circumstances as other emacsen.
 It is not certain whether this is due to the means of event loop integration,
-or errors of omission in the NS code.  One area for exploration is the
-NO_SOCK_SIGIO define.  When it is defined, ctrl-g seems to be picked up more
-often, but there are some annoying side effects.  Currently it is left off by
-default, unless the --enable-cocoa-experimental-ctrl-g option is passed to
-configure [option removed Feb 2009].  (Has no effect under GNUstep.)
-This is an area for improvement.  Also, see the article here and its
-containing thread:
+or errors of omission in the NS code.  This is an area for improvement.
+Also, see the article here and its containing thread:
 
 http://article.gmane.org/gmane.emacs.devel/92021/match=handling%5fsignal
 
index 24402da3ea28d5412c24d022dffc8bfdc9d4a6c5..0131becdb6224974494e4224647f3b5206d23c6a 100644 (file)
@@ -1,7 +1,7 @@
 [Desktop Entry]
 Encoding=UTF-8
 Type=Application
-Version=23.2.50
+Version=24.0.50
 Categories=GNUstep
 Name=Emacs
 Comment=GNU Emacs for NeXT/Open/GNUstep and OS X
index a781b129b84bdf4e87b23ba221589624ef9844c2..ade3f0117e6481fad29feb6378239588997cfeaa 100644 (file)
@@ -2,7 +2,7 @@
     ApplicationDescription = "GNU Emacs for GNUstep / OS X";
     ApplicationIcon = emacs.tiff;
     ApplicationName = Emacs;
-    ApplicationRelease = "23.2.50";
+    ApplicationRelease = "24.0.50";
     Authors = (
        "Adrian Robert (GNUstep)",
        "Christophe de Dinechin (MacOS X)",
@@ -13,7 +13,7 @@
     );
     Copyright = "Copyright (C) 2010 Free Software Foundation, Inc.";
     CopyrightDescription = "Released under the GNU General Public License Version 3 or later";
-    FullVersionID = "Emacs 23.2.50, NS Windowing";
+    FullVersionID = "Emacs 24.0.50, NS Windowing";
     NSExecutable = Emacs;
     NSIcon = emacs.tiff;
     NSPrincipalClass = NSApplication;
diff --git a/nt/.arch-inventory b/nt/.arch-inventory
deleted file mode 100644 (file)
index a2db727..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-source ^subdirs\.el$
-
-# arch-tag: 01b87183-9d94-4b6b-93cb-fece25c4eec9
index 24b421b4567a33efeca81dedb8c9c47654be95cc..05f01767bd31a582e69f1b3e7071852d5a506281 100644 (file)
-2010-08-02  Óscar Fuentes  <ofv@wanadoo.es>
+2010-08-19  Juanma Barranquero  <lekktu@gmail.com>
+
+       * addpm.c (add_registry): Create App Paths of type REG_EXPAND_SZ.
+
+2010-08-12  Jason Rumney  <jasonr@gnu.org>
+
+       * addpm.c (add_registry): Set path for runemacs.exe to use.
+
+2010-08-08  Óscar Fuentes  <ofv@wanadoo.es>
 
        * cmdproxy.c (main): Use _snprintf instead of wsprintf,
        which has a 1024 char limit on Windows (bug#6647).
 
+2010-08-02  Juanma Barranquero  <lekktu@gmail.com>
+
+       * config.nt (TIME_WITH_SYS_TIME): Remove #undef, unused (bug#6754).
+       Suggested by Dan Nicolaescu <dann@ics.uci.edu>.
+
+2010-07-29  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * config.nt: Remove code referring to NO_REMAP, unused.
+
+2010-07-25  Christoph Scholtes  <cschol2112@gmail.com>
+
+       Build binary distros on Windows using emacs-VERSION as root dir name.
+
+       * makefile.w32-in: Copy README.W32 to installation directory
+       during `make install'.  Remove README.W32 with `distclean' (in
+       case Emacs was installed in place).  Use temporary directory to
+       create distribution zip files in `dist' target.
+       * zipdist.bat: Simplify code using temporary directory.
+
+2010-07-25  Juanma Barranquero  <lekktu@gmail.com>
+
+       * runemacs.c (set_user_model_id): Fix prototype.
+
+2010-07-24  Christoph Scholtes  <cschol2112@gmail.com>
+
+       New make target for Windows platform: make dist (bug#6602)
+
+       * INSTALL: Document new dist target and add section about
+       creating binary distributions.
+       * README.W32: Relocate from admin/nt/ directory.
+       * configure.bat: New parameter `--distfiles'.
+       * makefile.w32-in: Add version number, new target `dist'.
+       Add new target `install-shortcuts'.
+       * zipdist.bat: New file; create zipped binary distribution,
+       replaces admin/nt/makedist.bat.
+
+2010-07-21  Juanma Barranquero  <lekktu@gmail.com>
+
+       * INSTALL: Add note about backslashes in Windows paths.
+       Fix typos.  Simplify references to Windows versions.
+
+2010-07-20  Juanma Barranquero  <lekktu@gmail.com>
+
+       * addpm.c (add_registry, main):
+       * cmdproxy.c (get_env_size):
+       * ddeclient.c (main):
+       * runemacs.c (set_user_model_id):
+       Convert definitions to standard C.
+
+2010-07-20  Juanma Barranquero  <lekktu@gmail.com>
+
+       * gmake.defs (CHECKING_CFLAGS) [ENABLECHECKS]: Add -fno-crossjumping.
+
+2010-07-18  Juanma Barranquero  <lekktu@gmail.com>
+
+       * configure.bat: New option --enable-checking.
+       * gmake.defs, nmake.defs (CHECKING_CFLAGS): New define.
+       (CFLAGS): Include it.
+
+2010-07-12  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * config.nt (volatile): Remove definition.
+
+2010-07-07  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * config.nt (HAVE_BCOPY, HAVE_BCMP): Remove undefs.
+       (HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET, HAVE_MEMCMP): Add undefs.
+
+2010-07-02  Juanma Barranquero  <lekktu@gmail.com>
+
+       * config.nt (__P): Remove.
+
+2010-06-06  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * config.nt: Remove code depending on BSTRING.
+
+2010-06-03  Glenn Morris  <rgm@gnu.org>
+
+       * config.nt: Remove NOT_C_CODE tests, it is always true now.
+
+2010-05-13  Glenn Morris  <rgm@gnu.org>
+
+       * config.nt (LD_SWITCH_X_SITE, C_SWITCH_X_SITE): Remove undefs.
+
 2010-05-07  Chong Yidong  <cyd@stupidchicken.com>
 
        * Version 23.2 released.
 
+2010-05-04  Glenn Morris  <rgm@gnu.org>
+
+       * config.nt (LD_SWITCH_X_SITE_AUX): Remove.
+
+2010-04-20  Lewis Perin  <perin@panix.com>  (tiny change)
+
+       * emacs.manifest: Add trustInfo section to Windows manifest.
+
+2010-03-10  Chong Yidong  <cyd@stupidchicken.com>
+
+       * Branch for 23.2.
+
 2010-01-13  Martin Rudalics  <rudalics@gmx.at>
 
        * emacsclient.rc: Fix format of "LegalCopyright" value.
 
 2009-01-26  Jason Rumney  <jasonr@gnu.org>
 
-       * emacsclient.rc, emacs.rc: Swap name and description.  Remove
-       Windows versions.
+       * emacsclient.rc, emacs.rc: Swap name and description.
+       Remove Windows versions.
 
 2009-01-15  Jason Rumney  <jasonr@gnu.org>
 
        * config.nt (HAVE_FACES): Remove, unused.
 
 2008-06-26  Juanma Barranquero  <lekktu@gmail.com>
-           Eli Zaretskii  <eliz@gnu.org>
+            Eli Zaretskii  <eliz@gnu.org>
 
        * nmake.defs (FONT_CFLAGS):
        * gmake.defs (FONT_CFLAGS): Remove.
        * config.nt: Remove reference to UNEXEC_SRC.
 
 2008-06-23  Juanma Barranquero  <lekktu@gmail.com>
-           Eli Zaretskii  <eliz@gnu.org>
+            Eli Zaretskii  <eliz@gnu.org>
 
        * gmake.defs (DEBUG_FLAG, DEBUG_LINK) [!NODEBUG]:
        Don't hardcode -gstabs+, use DEBUG_INFO.
index da36b4e3390a626dfd63542cbdeb9fc63d075ba9..8af8e3020decd0744483708d55c141fe86566779 100644 (file)
@@ -1,5 +1,5 @@
-                     Building and Installing Emacs
-               on Windows NT/2K/XP and Windows 95/98/ME
+                   Building and Installing Emacs on Windows
+                          (from 95 to 7 and beyond)
 
   Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
     Free Software Foundation, Inc.
         emacs source with text!=binary.
     [2] fails when needs to invoke shell commands; okay invoking gcc etc.
     [3] requires LC_MESSAGES support to build; cannot build with early
-        versions of cygwin.
+        versions of Cygwin.
     [4] may fail on Windows 9X and Windows ME; if so, install Bash.
     [5] fails when building leim due to the use of cygwin style paths.
         May work if building emacs without leim.
   like this, we recommend the use of the supported compilers mentioned
   in the previous paragraph.
 
-  You will also need a copy of the Posix cp, rm and mv programs.  These
-  and other useful Posix utilities can be obtained from one of several
+  You will also need a copy of the POSIX cp, rm and mv programs.  These
+  and other useful POSIX utilities can be obtained from one of several
   projects:
 
   * http://gnuwin32.sourceforge.net/              ( GnuWin32 )
   * http://www.cygwin.com/                        ( Cygwin   )
   * http://unxutils.sourceforge.net/              ( UnxUtils )
 
-  If you build Emacs on Windows 9X or ME, not on Windows 2K/XP or
-  Windows NT, we suggest to install the Cygwin port of Bash.  That is
-  because the native Windows shell COMMAND.COM is too limited; the
-  Emacs build procedure tries very hard to support even such limited
-  shells, but as none of the Windows developers of Emacs work on
-  Windows 9x, we cannot guarantee that it works without a more
-  powerful shell.
+  If you build Emacs on 16-bit versions of Windows (9X or ME), we
+  suggest to install the Cygwin port of Bash.  That is because the
+  native Windows shell COMMAND.COM is too limited; the Emacs build
+  procedure tries very hard to support even such limited shells, but
+  as none of the Windows developers of Emacs work on Windows 9X, we
+  cannot guarantee that it works without a more powerful shell.
 
   Additional instructions and help for building Emacs on Windows can be
   found at the Emacs Wiki:
 
   N.B.  It is normal to see a few error messages output while configure
   is running, when gcc support is being tested.  These cannot be
-  suppressed because of limitations in the Windows 9x command.com shell.
+  suppressed because of limitations in the Windows 9X command.com shell.
 
   You are encouraged to look at the file config.log which shows details
   for failed tests, after configure.bat finishes.  Any unexplained failure
   wrong.  (Usually, any such failures happen because some headers are
   missing due to bad packaging of the image support libraries.)
 
+  Note that any file path passed to the compiler or linker must use
+  forward slashes; using backslashes will cause compiler warnings or
+  errors about unrecognized escape sequences.
+
   To use the external image support, the DLLs implementing the
   functionality must be found when Emacs first needs them, either on the
   PATH, or in the same directory as emacs.exe.  Failure to find a
   Removes the installed files in the bin subdirectory in addition to
   the files removed by make cleanall.
 
+  make dist
+  Builds Emacs from the available sources and pre-compiled lisp files.
+  Packages Emacs binaries as full distribution and barebin distribution.
 
   The following targets are intended only for use with the Bazaar sources.
 
   bootstrap to rebuild.  Occasionally it may be necessary to run this
   target after an update.
 
+* Creating binary distributions
+
+  Binary distributions (full and barebin distributions) can be
+  automatically built and packaged from source tarballs or a bzr
+  checkout.
+
+  When building Emacs binary distributions, the --distfiles argument
+  to configure.bat specifies files to be included in the bin directory
+  of the binary distributions. This is intended for libraries that are
+  not built as part of Emacs, e.g. image libraries.
+
+  For example, specifying
+
+       --distfiles D:\distfiles\libXpm.dll
+
+  results in libXpm.dll being copied from D:\distfiles to the
+  bin directory before packaging starts.
+
+  Multiple files can be specified using multiple --distfiles arguments:
+
+       --distfiles D:\distfiles\libXpm.dll --distfiles C:\jpeglib\jpeg.dll
+
+  For packaging the binary distributions, the 'dist' make target uses
+  7-Zip (http://www.7-zip.org), which must be installed and available
+  on the Windows Path.
+
 
 * Trouble-shooting
 
   The main problems that are likely to be encountered when building
   Emacs stem from using an old version of GCC, or old MinGW or W32 API
-  headers.  Additionally, cygwin ports of GNU make may require the Emacs
+  headers.  Additionally, Cygwin ports of GNU make may require the Emacs
   source tree to be mounted with text!=binary, because the makefiles
   generated by configure.bat necessarily use DOS line endings.  Also,
-  cygwin ports of make must run in UNIX mode, either by specifying
+  Cygwin ports of make must run in UNIX mode, either by specifying
   --unix on the command line, or MAKE_MODE=UNIX in the environment.
 
   When configure runs, it attempts to detect when GCC itself, or the
similarity index 100%
rename from admin/nt/README.W32
rename to nt/README.W32
index 9bdfafc2a3e45b854a283f8b44d13bce5a595419..de09fd5382c204f53654f5129b4360a5551539cd 100644 (file)
@@ -62,6 +62,8 @@ DdeCallback (UINT uType, UINT uFmt, HCONV hconv,
 #define REG_GTK "SOFTWARE\\GTK\\2.0"
 #define REG_APP_PATH \
   "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\emacs.exe"
+#define REG_RUNEMACS_PATH \
+  "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\runemacs.exe"
 
 static struct entry
 {
@@ -83,8 +85,7 @@ env_vars[] =
 };
 
 BOOL
-add_registry (path)
-     char *path;
+add_registry (char *path)
 {
   HKEY hrootkey = NULL;
   int i;
@@ -112,7 +113,7 @@ add_registry (path)
       emacs_path = (char *) alloca (len);
       sprintf (emacs_path, "%s\\bin\\emacs.exe", path);
 
-      RegSetValueEx (hrootkey, NULL, 0, REG_SZ, emacs_path, len);
+      RegSetValueEx (hrootkey, NULL, 0, REG_EXPAND_SZ, emacs_path, len);
 
       /* Look for a GTK installation. If found, add it to the library search
          path for Emacs so that the image libraries it provides are available
@@ -130,10 +131,26 @@ add_registry (path)
                   /* Make sure the emacs bin directory continues to be searched
                      first by including it as well.  */
                   char *dll_paths;
+                 HKEY runemacs_key = NULL;
                   len = strlen (path) + 5 + size;
                   dll_paths = (char *) alloca (size + strlen (path) + 1);
                   sprintf (dll_paths, "%s\\bin;%s", path, gtk_path);
-                  RegSetValueEx (hrootkey, "Path", 0, REG_SZ, dll_paths, len);
+                  RegSetValueEx (hrootkey, "Path", 0, REG_EXPAND_SZ,
+                                dll_paths, len);
+
+                 /* Set the same path for runemacs.exe, as the Explorer shell
+                    looks this up, so the above does not take effect when
+                    emacs.exe is spawned from runemacs.exe.  */
+                 if (RegCreateKeyEx (HKEY_LOCAL_MACHINE, REG_RUNEMACS_PATH,
+                                     0, "", REG_OPTION_NON_VOLATILE,
+                                     KEY_WRITE, NULL, &runemacs_key, NULL)
+                     == ERROR_SUCCESS)
+                   {
+                     RegSetValueEx (runemacs_key, "Path", 0, REG_EXPAND_SZ,
+                                    dll_paths, len);
+
+                     RegCloseKey (runemacs_key);
+                   }
                 }
             }
           RegCloseKey (gtk_key);
@@ -175,9 +192,7 @@ add_registry (path)
 }
 
 int
-main (argc, argv)
-     int argc;
-     char *argv[];
+main (int argc, char *argv[])
 {
   char start_folder[MAX_PATH + 1];
   int shortcuts_created = 0;
@@ -315,10 +330,10 @@ main (argc, argv)
                  if (SUCCEEDED (IPersistFile_Save (lnk, unicode_path, TRUE)))
                    shortcuts_created = 1;
                  IPersistFile_Release (lnk);
-                 
+
                }
            }
-       }      
+       }
     }
 
   if (com_available)
index 4f2d113a900d9f07d4a0bccbea8170a7f2217465..0f9bd65112d08a13f57c871726dba1f7c1323fc7 100644 (file)
@@ -410,7 +410,7 @@ spawn (char * progname, char * cmdline, char * dir, int * retcode)
 
 /* Return size of current environment block.  */
 int
-get_env_size ()
+get_env_size (void)
 {
   char * start = GetEnvironmentStrings ();
   char * tmp = start;
index f000d53e4128dc011eda14d1d9470fb102d93e96..49f823c9ba4f19e47d0307b0b2b809f43d0526f6 100644 (file)
@@ -1,6 +1,7 @@
 /* GNU Emacs site configuration template file.  -*- C -*-
-   Copyright (C) 1988, 1993, 1994, 2001, 2002, 2003, 2004, 2005, 2006,
-     2007, 2008, 2009, 2010  Free Software Foundation, Inc.
+
+Copyright (C) 1988, 1993, 1994, 2001, 2002, 2003, 2004, 2005, 2006,
+  2007, 2008, 2009, 2010  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -137,7 +138,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #undef HAVE_STDLIB_H
 #undef HAVE_PWD_H
 #undef STDC_HEADERS
-#undef TIME_WITH_SYS_TIME
 
 #undef HAVE_LIBDNET
 #undef HAVE_LIBPTHREADS
@@ -211,8 +211,10 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #undef HAVE_SYSINFO
 #undef HAVE_RANDOM
 #undef HAVE_LRAND48
-#undef HAVE_BCOPY
-#undef HAVE_BCMP
+#undef HAVE_MEMCPY
+#undef HAVE_MEMMOVE
+#undef HAVE_MEMSET
+#undef HAVE_MEMCMP
 #undef HAVE_LOGB
 #undef HAVE_FREXP
 #undef HAVE_FMOD
@@ -305,12 +307,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #undef config_machfile
 #include "m/intel386.h"
 
-/* If no remapping takes place, static variables cannot be dumped as
-   pure, so don't worry about the `static' keyword. */
-#ifdef NO_REMAP
-#undef static
-#endif
-
 /* Define `subprocesses' should be defined if you want to
    have code for asynchronous subprocesses
    (as used in M-x compile and M-x shell).
@@ -318,24 +314,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #define subprocesses
 
-/* Define LD_SWITCH_X_SITE to contain any special flags your loader
-   may need to deal with X Windows.  For instance, if you've defined
-   HAVE_X_WINDOWS above and your X libraries aren't in a place that
-   your loader can find on its own, you might want to add "-L/..." or
-   something similar.  */
-#undef LD_SWITCH_X_SITE
-
-/* Define LD_SWITCH_X_SITE_AUX with an -R option
-   in case it's needed (for Solaris, for example).  */
-#undef LD_SWITCH_X_SITE_AUX
-
-/* 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 above 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.  */
-#undef C_SWITCH_X_SITE
-
 /* Define STACK_DIRECTION here, but not if m/foo.h did.  */
 #ifndef STACK_DIRECTION
 #undef STACK_DIRECTION
@@ -364,32 +342,12 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #define my_strftime nstrftime   /* for strftime.c */
 
-/* The rest of the code currently tests the CPP symbol BSTRING.
-   Override any claims made by the system-description files.
-   Note that on some SCO version it is possible to have bcopy and not bcmp.  */
-#undef BSTRING
-#if defined (HAVE_BCOPY) && defined (HAVE_BCMP)
-#define BSTRING
-#endif
-
-/* Non-ANSI C compilers usually don't have volatile.  */
-#ifndef HAVE_VOLATILE
-#ifndef __STDC__
-#define volatile
-#endif
-#endif
-
 #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.
-
-   This declaration shouldn't appear when alloca.s or Makefile.in
-   includes config.h.  */
-#ifndef NOT_C_CODE
+   the type of getenv.  */
 extern char *getenv ();
 #endif
-#endif
 
 #endif /* EMACS_CONFIG_H */
 
@@ -423,16 +381,6 @@ extern char *getenv ();
 #define PROTOTYPES 1
 #endif
 
-#ifndef __P
-#if defined PROTOTYPES
-#define __P(args) args
-#else
-#define __P(args) ()
-#endif
-#endif
-
-/* Don't include <string.h> during configure.  */
-#ifndef NOT_C_CODE
 #ifdef HAVE_STRING_H
 #include "string.h"
 #endif
@@ -442,7 +390,6 @@ extern char *getenv ();
 #ifdef HAVE_STDLIB_H
 #include <stdlib.h>
 #endif
-#endif
 
 #ifndef NO_RETURN
 #if defined __GNUC__ && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR >= 5))
@@ -453,12 +400,10 @@ extern char *getenv ();
 #endif
 
 /* Redefine abort.  */
-#ifndef NOT_C_CODE
 #ifdef HAVE_NTGUI
 #define abort  w32_abort
 void w32_abort (void) NO_RETURN;
 #endif
-#endif
 
 /* Prevent accidental use of features unavailable in
    older Windows versions we still support.  */
index 7317416442b3e182483b6de7dbac023840b4d934..c7bfad35189f004090b2641af625bcb2673c0fca 100755 (executable)
@@ -80,6 +80,7 @@ rem   Default settings.
 set prefix=\r
 set nodebug=N\r
 set noopt=N\r
+set enablechecking=N\r
 set profile=N\r
 set nocygwin=N\r
 set COMPILER=\r
@@ -89,6 +90,8 @@ set userldflags=
 set doldflags=\r
 set sep1=\r
 set sep2=\r
+set sep3=\r
+set distfiles=\r
 \r
 rem ----------------------------------------------------------------------\r
 rem   Handle arguments.\r
@@ -100,6 +103,7 @@ if "%1" == "--with-gcc" goto withgcc
 if "%1" == "--with-msvc" goto withmsvc\r
 if "%1" == "--no-debug" goto nodebug\r
 if "%1" == "--no-opt" goto noopt\r
+if "%1" == "--enable-checking" goto enablechecking\r
 if "%1" == "--profile" goto profile\r
 if "%1" == "--no-cygwin" goto nocygwin\r
 if "%1" == "--cflags" goto usercflags\r
@@ -110,6 +114,7 @@ if "%1" == "--without-gif" goto withoutgif
 if "%1" == "--without-tiff" goto withouttiff\r
 if "%1" == "--without-xpm" goto withoutxpm\r
 if "%1" == "--with-svg" goto withsvg\r
+if "%1" == "--distfiles" goto distfiles\r
 if "%1" == "" goto checkutils\r
 :usage\r
 echo Usage: configure [options]\r
@@ -119,6 +124,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.   --profile               enable profiling\r
 echo.   --no-cygwin             use -mno-cygwin option with GCC\r
 echo.   --cflags FLAG           pass FLAG to compiler\r
@@ -129,6 +135,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.   --with-svg              use the RSVG library (experimental)\r
+echo.   --distfiles             path to files for make dist, e.g. libXpm.dll\r
 goto end\r
 rem ----------------------------------------------------------------------\r
 :setprefix\r
@@ -157,6 +164,11 @@ set noopt=Y
 shift\r
 goto again\r
 rem ----------------------------------------------------------------------\r
+:enablechecking\r
+set enablechecking=Y\r
+shift\r
+goto again\r
+rem ----------------------------------------------------------------------\r
 :profile\r
 set profile=Y\r
 shift\r
@@ -225,6 +237,16 @@ shift
 set svgsupport=Y\r
 goto again\r
 \r
+rem ----------------------------------------------------------------------\r
+\r
+:distfiles\r
+set HAVE_DISTFILES=1\r
+shift\r
+set distfiles=%distfiles%%sep3%%1\r
+set sep3= %nothing%\r
+shift\r
+goto again\r
+\r
 rem ----------------------------------------------------------------------\r
 rem    Check that necessary utilities (cp and rm) are present.\r
 :checkutils\r
@@ -513,6 +535,35 @@ set HAVE_RSVG=1
 :svgDone\r
 rm -f junk.c junk.obj junk.err junk.out\r
 \r
+rem Any distfiles provided for building distribution? If no, we're done.\r
+if "(%HAVE_DISTFILES%)"=="()" goto :distFilesDone\r
+\r
+rem Any arguments to --distfiles specified? If no, we're done.\r
+if not "%distfiles%"=="" goto :checkDistFiles\r
+set distFilesOk=0\r
+echo No arguments specified for option --distfiles!\r
+goto distfilesDone\r
+\r
+:checkDistFiles\r
+echo Checking for distfiles...\r
+rem Check if all specified distfiles exist\r
+set fileNotFound=\r
+for %%d in (%distfiles%) do if not exist %%d set fileNotFound=%%d\r
+if not "%fileNotFound%"=="" goto distFilesNotFound\r
+\r
+set distFilesOK=1\r
+echo ...all distfiles found.\r
+goto :distFilesDone\r
+\r
+:distFilesNotFound\r
+set distFilesOk=0\r
+echo ...%fileNotFound% not found.\r
+set distfiles=\r
+goto :distfilesDone\r
+\r
+:distFilesDone\r
+set fileNotFound=\r
+\r
 rem ----------------------------------------------------------------------\r
 :genmakefiles\r
 echo Generating makefiles\r
@@ -529,9 +580,11 @@ if not "(%mf%)" == "()" echo MCPU_FLAG=%mf%>>config.settings
 if not "(%dbginfo%)" == "()" echo DEBUG_INFO=%dbginfo%>>config.settings\r
 if (%nodebug%) == (Y) echo NODEBUG=1 >>config.settings\r
 if (%noopt%) == (Y) echo NOOPT=1 >>config.settings\r
+if (%enablechecking%) == (Y) echo ENABLECHECKS=1 >>config.settings\r
 if (%profile%) == (Y) echo PROFILE=1 >>config.settings\r
 if (%nocygwin%) == (Y) echo NOCYGWIN=1 >>config.settings\r
 if not "(%prefix%)" == "()" echo INSTALL_DIR=%prefix%>>config.settings\r
+if not "(%distfiles%)" == "()" echo DIST_FILES=%distfiles%>>config.settings\r
 rem We go thru docflags because usercflags could be "-DFOO=bar" -something\r
 rem and the if command cannot cope with this\r
 for %%v in (%usercflags%) do if not (%%v)==() set docflags=Y\r
@@ -633,12 +686,19 @@ if (%tiffsupport%) == (N) goto checkgif
  echo   Install libtiff development files or use --without-tiff\r
 \r
 :checkgif\r
-if not "(%HAVE_GIF%)" == "()" goto donelibchecks\r
-if (%gifsupport%) == (N) goto donelibchecks\r
+if not "(%HAVE_GIF%)" == "()" goto checkdistfiles\r
+if (%gifsupport%) == (N) goto checkdistfiles\r
  set libsOK=0\r
  echo GIF support is missing.\r
  echo   Install giflib or libungif development files or use --without-gif\r
 \r
+:checkdistfiles\r
+if "(%HAVE_DISTFILES%)" == "()" goto donelibchecks\r
+if (%distFilesOk%) == (1) goto donelibchecks\r
+echo.\r
+echo Files specified with option --distfiles could not be found.\r
+echo   Fix these issues before running make dist\r
+\r
 :donelibchecks\r
 if (%libsOK%) == (1) goto success\r
 echo.\r
@@ -660,6 +720,7 @@ set $foo$=
 set prefix=\r
 set nodebug=\r
 set noopt=\r
+set enablechecking=\r
 set profile=\r
 set nocygwin=\r
 set COMPILER=\r
@@ -670,6 +731,9 @@ set userldflags=
 set doldflags=\r
 set mingwflag=\r
 set mf=\r
+set distfiles=\r
+set HAVE_DISTFILES=\r
+set distFilesOk=\r
 \r
 goto skipArchTag\r
    arch-tag: 300d20a4-1675-4e75-b615-7ce1a8c5376c\r
index b8c6683c3a3fa3abb8d6af2279a35aac4c2598ac..ef287f017ba70d25cd2037a238b29e3a0251ae23 100644 (file)
@@ -35,9 +35,7 @@ DdeCallback (UINT uType, UINT uFmt, HCONV hconv,
                              CF_TEXT, XTYP_EXECUTE, 30000, NULL)
 
 int
-main (argc, argv)
-     int argc;
-     char *argv[];
+main (int argc, char *argv[])
 {
   DWORD idDde = 0;
   HCONV HConversation;
index 4c1894c335f7cbf5d1f7fb1573da9806f5c6cead..64c6f1edfb71d11d0b47ff1cb7940a67c96a9620 100644 (file)
@@ -8,4 +8,14 @@
                         language="*"/>
     </dependentAssembly>
   </dependency>
-</assembly>
\ No newline at end of file
+  <assemblyIdentity version="1.0.0.0" processorArchitecture="X86"
+                   name="emacs" type="win32"/>
+  <description>GNU Emacs</description>
+  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
+    <security>
+      <requestedPrivileges>
+        <requestedExecutionLevel level="asInvoker"/>
+      </requestedPrivileges>
+    </security>
+  </trustInfo>
+</assembly>
index 6fc08e6e26737e1519b40dab9662833d82f889d6..253065b47c47863a77c79c078571a8d5e07ca5d0 100644 (file)
@@ -7,8 +7,8 @@ Emacs ICON   icons\emacs.ico
 #endif
 
 VS_VERSION_INFO VERSIONINFO
- FILEVERSION 23,2,50,0
- PRODUCTVERSION 23,2,50,0
+ FILEVERSION 24,0,50,0
+ PRODUCTVERSION 24,0,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", "23, 2, 50, 0\0"
+           VALUE "FileVersion", "24, 0, 50, 0\0"
            VALUE "InternalName", "Emacs\0"
            VALUE "LegalCopyright", "Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010\0"
            VALUE "OriginalFilename", "emacs.exe"
            VALUE "ProductName", "Emacs\0"
-           VALUE "ProductVersion", "23, 2, 50, 0\0"
+           VALUE "ProductVersion", "24, 0, 50, 0\0"
            VALUE "OLESelfRegister", "\0"
         END
      END
index 6a3ae2401cd922f3fb99147cbc2281d7cc99dc06..98f0bcd4f84fe9ed9e3a6390f7946d52aefcd475 100644 (file)
@@ -5,8 +5,8 @@ Emacs ICON   icons\emacs.ico
 #endif
 
 VS_VERSION_INFO VERSIONINFO
- FILEVERSION 23,2,50,0
- PRODUCTVERSION 23,2,50,0
+ FILEVERSION 24,0,50,0
+ PRODUCTVERSION 24,0,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", "23, 2, 50, 0\0"
+           VALUE "FileVersion", "24, 0, 50, 0\0"
            VALUE "InternalName", "EmacsClient\0"
            VALUE "LegalCopyright", "Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010\0"
            VALUE "OriginalFilename", "emacsclientw.exe"
            VALUE "ProductName", "EmacsClient\0"
-           VALUE "ProductVersion", "23, 2, 50, 0\0"
+           VALUE "ProductVersion", "24, 0, 50, 0\0"
            VALUE "OLESelfRegister", "\0"
         END
      END
index 7b2aba4151e9245714549206dbfc775174a34aa8..491e65120664f109c099d03521a52e7548ae14ce 100644 (file)
@@ -198,7 +198,14 @@ DEBUG_CFLAGS       = -DEMACSDEBUG
 else
 DEBUG_CFLAGS   =
 endif
-CFLAGS          = -I. $(ARCH_CFLAGS) $(DEBUG_CFLAGS) $(PROFILE_CFLAGS) $(USER_CFLAGS) $(LOCAL_FLAGS)
+
+ifdef ENABLECHECKS
+CHECKING_CFLAGS        = -DENABLE_CHECKING -DXASSERTS -fno-crossjumping
+else
+CHECKING_CFLAGS        =
+endif
+
+CFLAGS          = -I. $(ARCH_CFLAGS) $(DEBUG_CFLAGS) $(CHECKING_CFLAGS) $(PROFILE_CFLAGS) $(USER_CFLAGS) $(LOCAL_FLAGS)
 EMACS_EXTRA_C_FLAGS = -DUSE_CRT_DLL=1
 
 ifdef PROFILE
index 48b3ab140564801a51dcfe412d0a7cbbf376dffd..b0f5edb28a21c24190fe9b9fd7ec9c0bb36dc0fd 100644 (file)
 # 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.0.50\r
+\r
+TMP_DIST_DIR   = emacs-$(VERSION)\r
+\r
 TRES           = $(BLD)/emacs.res\r
 CLIENTRES      = $(BLD)/emacsclient.res\r
 \r
@@ -197,12 +201,16 @@ $(INSTALL_DIR)/bin: $(INSTALL_DIR)
 #\r
 # Build and install emacs in INSTALL_DIR\r
 #\r
-install: all $(INSTALL_DIR)/bin install-other-dirs-$(MAKETYPE)\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)/addpm.exe $(INSTALL_DIR)/bin\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
-       - "$(INSTALL_DIR)/bin/addpm" -q\r
+       - $(CP) README.W32 $(INSTALL_DIR)\r
        - $(DEL) ../same-dir.tst\r
        - $(DEL) $(INSTALL_DIR)/same-dir.tst\r
        echo SameDirTest > "$(INSTALL_DIR)/same-dir.tst"\r
@@ -238,6 +246,26 @@ install-other-dirs-gmake:
        $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp install\r
        $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim install\r
 \r
+install-shortcuts:\r
+       "$(INSTALL_DIR)/bin/addpm" -q\r
+\r
+dist: install-bin\r
+       mkdir $(TMP_DIST_DIR)\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) "$(INSTALL_DIR)/INSTALL" $(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
+       $(CP_DIR) $(DIST_FILES) $(TMP_DIST_DIR)/bin\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
@@ -323,6 +351,7 @@ top-distclean:
        - $(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
index c065ee60de1722d68fac46efb427bf099411f388..412b0148bb5f752e7b36b18a3ad4ac731d2e48c4 100644 (file)
@@ -136,8 +136,15 @@ DEBUG_CFLAGS       = -DEMACSDEBUG
 !else\r
 DEBUG_CFLAGS   =\r
 !endif\r
+\r
+!ifdef ENABLECHECKS\r
+CHECKING_CFLAGS        = -DENABLE_CHECKING -DXASSERTS\r
+!else\r
+CHECKING_CFLAGS        =\r
+!endif\r
+\r
 CFLAGS          = -I. $(ARCH_CFLAGS) \\r
-                 $(DEBUG_CFLAGS) $(USER_CFLAGS) $(LOCAL_FLAGS)\r
+                 $(DEBUG_CFLAGS) $(CHECKING_CFLAGS) $(USER_CFLAGS) $(LOCAL_FLAGS)\r
 EMACS_EXTRA_C_FLAGS =\r
 \r
 SYS_LDFLAGS    = -nologo -release -incremental:no -version:3.10 -swaprun:cd -swaprun:net setargv.obj\r
index 4a3d4a9536d43d35651704ffe4afa10667c212bb..f4d7206262023dc2a1dc6715cde81789bdfa6fd0 100644 (file)
@@ -43,7 +43,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <string.h>
 #include <malloc.h>
 
-static void set_user_model_id ();
+static void set_user_model_id (void);
 
 int WINAPI
 WinMain (HINSTANCE hSelf, HINSTANCE hPrev, LPSTR cmdline, int nShow)
@@ -174,7 +174,8 @@ error:
   return 1;
 }
 
-void set_user_model_id ()
+void
+set_user_model_id (void)
 {
   HMODULE shell;
   HRESULT (WINAPI * set_user_model) (wchar_t * id);
diff --git a/nt/zipdist.bat b/nt/zipdist.bat
new file mode 100644 (file)
index 0000000..af90f61
--- /dev/null
@@ -0,0 +1,49 @@
+@echo off\r
+rem Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010\r
+rem   Free Software Foundation, Inc.\r
+\r
+rem Author: Christoph Scholtes cschol2112 at gmail.com\r
+\r
+rem This file is part of GNU Emacs.\r
+\r
+rem GNU Emacs is free software: you can redistribute it and/or modify\r
+rem it under the terms of the GNU General Public License as published by\r
+rem the Free Software Foundation, either version 3 of the License, or\r
+rem (at your option) any later version.\r
+\r
+rem GNU Emacs is distributed in the hope that it will be useful,\r
+rem but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+rem GNU General Public License for more details.\r
+\r
+rem You should have received a copy of the GNU General Public License\r
+rem along with GNU Emacs.  If not, see http://www.gnu.org/licenses/.\r
+\r
+SETLOCAL\r
+rem arg 1: Emacs version number\r
+set EMACS_VER=%1\r
+\r
+set TMP_DIST_DIR=emacs-%EMACS_VER%\r
+\r
+rem Check, if 7zip is installed and available on path\r
+:ZIP_CHECK\r
+7z\r
+if %ERRORLEVEL% NEQ 0 goto :ZIP_ERROR\r
+goto ZIP_DIST\r
+\r
+:ZIP_ERROR\r
+echo.\r
+echo ERROR: Make sure 7zip is installed and available on the Windows Path!\r
+goto EXIT\r
+\r
+rem Build distributions\r
+:ZIP_DIST\r
+rem Build and verify full distribution\r
+7z a -bd -tZIP -mx=9 -x!.bzrignore -x!.gitignore -xr!emacs.mdp -xr!*.pdb -xr!*.opt -xr!*~ -xr!CVS -xr!.arch-inventory emacs-%EMACS_VER%-bin-i386.zip %TMP_DIST_DIR%\r
+7z t emacs-%EMACS_VER%-bin-i386.zip\r
+rem Build and verify binary only distribution\r
+7z a -bd -tZIP -mx=9 -x!.bzrignore -x!.gitignore -xr!emacs.mdp -xr!*.pdb -xr!*.opt -xr!*~ -xr!CVS -xr!.arch-inventory emacs-%EMACS_VER%-barebin-i386.zip %TMP_DIST_DIR%/README.W32 %TMP_DIST_DIR%/bin %TMP_DIST_DIR%/etc/DOC-X %TMP_DIST_DIR%/COPYING\r
+7z t emacs-%EMACS_VER%-barebin-i386.zip\r
+goto EXIT\r
+\r
+:EXIT\r
index 2e1996e7287216adfcc8869ce58b4690481fba47..55bfca510b95ed1f629a12bb611bac5cf656b2d6 100644 (file)
@@ -103,32 +103,27 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 /* For debug, set this to 0 to not grab the keyboard on menu popup */
 int x_menu_grab_keyboard = 1;
 
-typedef void (*Wait_func)();
-
 static Wait_func wait_func;
 static void* wait_data;
 
 void
-XMenuActivateSetWaitFunction (func, data)
-     Wait_func func;
-     void *data;
+XMenuActivateSetWaitFunction (Wait_func func, void *data)
 {
   wait_func = func;
   wait_data = data;
 }
 
 int
-XMenuActivate(display, menu, p_num, s_num, x_pos, y_pos, event_mask, data,
-             help_callback)
-    register Display *display;         /* Display to put menu on. */
-    register XMenu *menu;              /* Menu to activate. */
-    int *p_num;                                /* Pane number selected. */
-    int *s_num;                                /* Selection number selected. */
-    int x_pos;                         /* X coordinate of menu position. */
-    int y_pos;                         /* Y coordinate of menu position. */
-    unsigned int event_mask;           /* Mouse button event mask. */
-    char **data;                       /* Pointer to return data value. */
-    void (* help_callback) ();         /* Help callback.  */
+XMenuActivate(
+    register Display *display,         /* Display to put menu on. */
+    register XMenu *menu,              /* Menu to activate. */
+    int *p_num,                                /* Pane number selected. */
+    int *s_num,                                /* Selection number selected. */
+    int x_pos,                         /* X coordinate of menu position. */
+    int y_pos,                         /* Y coordinate of menu position. */
+    unsigned int event_mask,           /* Mouse button event mask. */
+    char **data,                       /* Pointer to return data value. */
+    void (* help_callback) (char *, int, int)) /* Help callback.  */
 {
     int status;                                /* X routine call status. */
     int orig_x;                                /* Upper left menu origin X coord. */
index 54b55a150c9d2e58d8cc09853f407556b4143849..6312aa2c70a457fcc6685d0abaa91d008f3187b1 100644 (file)
 #include "XMenuInt.h"
 
 int
-XMenuAddPane(display, menu, label, active)
-    Display *display;
-    register XMenu *menu;      /* Menu object to be modified. */
-    register char *label;      /* Selection label. */
-    int active;                        /* Make selection active? */
+XMenuAddPane(Display *display, register XMenu *menu, register char *label, int active)
+                     
+                               /* Menu object to be modified. */
+                               /* Selection label. */
+                                       /* Make selection active? */
 {
     register XMPane *pane;     /* Newly created pane. */
     register XMSelect *select; /* Initial selection for the new pane. */
index e38b3404b569cf5392a148116643007e0b496182..d2f2156b0774050f7c3d0ffcfa6f36e78c6f90b3 100644 (file)
 #include "XMenuInt.h"
 
 int
-XMenuAddSelection(display, menu, p_num, data, label, active, help)
-    Display *display;
-    register XMenu *menu;      /* Menu object to be modified. */
-    register int p_num;                /* Pane number to be modified. */
-    char *data;                        /* Data value. */
-    char *label;               /* Selection label. */
-    int active;                        /* Make selection active? */
-    char *help;                        /* Help string */
+XMenuAddSelection(Display *display, register XMenu *menu, register int p_num, char *data, char *label, int active, char *help)
+                     
+                               /* Menu object to be modified. */
+                                       /* Pane number to be modified. */
+                                       /* Data value. */
+                               /* Selection label. */
+                                       /* Make selection active? */
+                                       /* Help string */
 {
     register XMPane *pane;     /* Pane containing the new selection. */
     register XMSelect *select; /* Newly created selection. */
index a7a1b849519c3575ac1bf543b318e0e2c21b90d9..f05553a38b3b5aacacc1a248503d931895e005e6 100644 (file)
@@ -1,7 +1,83 @@
+2010-07-12  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * XMenu.h: Include <stdlib.h>.
+
+2010-07-12  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * Makefile.in (C_WARNINGS_SWITCH, PROFILING_CFLAGS): Set from
+       substitution.
+       (ALL_CFLAGS): Add ${C_WARNINGS_SWITCH} and ${PROFILING_CFLAGS}.
+
+2010-07-04  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * Activate.c: Convert function definitions to standard C.
+       * AddPane.c:
+       * AddSel.c:
+       * ChgPane.c:
+       * ChgSel.c:
+       * Create.c:
+       * DelPane.c:
+       * DelSel.c:
+       * Destroy.c:
+       * Error.c:
+       * EvHand.c:
+       * FindPane.c:
+       * FindSel.c:
+       * InsPane.c:
+       * InsSel.c:
+       * Internal.c:
+       * Locate.c:
+       * Post.c:
+       * Recomp.c:
+       * SetAEQ.c:
+       * SetFrz.c:
+       * SetPane.c:
+       * SetSel.c:
+       * X10.h:
+       * XCrAssoc.c:
+       * XDelAssoc.c:
+       * XDestAssoc.c:
+       * XLookAssoc.c:
+       * XMakeAssoc.c:
+       * XMenu.h:
+       * XMenuInt.h:
+       * insque.c: Likewise.
+
 2010-05-07  Chong Yidong  <cyd@stupidchicken.com>
 
        * Version 23.2 released.
 
+2010-05-06  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (RANLIB): Let configure set it.
+       (libXMenu11.a): Configure sets RANLIB = : on systems without it.
+
+       * Makefile.in (CPP, LN_S, AS, LD, MV, LS, LINTOPTS, LINTLIBFLAG, MAKE)
+       (STD_DEFINES, CDEBUGFLAGS, RM_CMD): Remove unused variables.
+
+2010-05-04  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (C_SWITCH_SYSTEM, C_SWITCH_MACHINE):
+       Use @C_SWITCH_SYSTEM@, @C_SWITCH_MACHINE@ rather than
+       @c_switch_system@, @c_switch_machine@.
+
+2010-04-27  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * Makefile.in (C_SWITCH_X_SYSTEM): Define using autoconf.
+
+2010-04-23  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * Makefile.in (ALL_CFLAGS): Remove C_SWITCH_X_MACHINE, unused.
+
+2010-04-11  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * Makefile.in (C_SWITCH_SYSTEM, C_SWITCH_MACHINE)
+       (C_SWITCH_X_SITE): Define using autoconf.
+
+2010-03-10  Chong Yidong  <cyd@stupidchicken.com>
+
+       * Branch for 23.2.
+
 2009-06-21  Chong Yidong  <cyd@stupidchicken.com>
 
        * Branch for 23.1.
        * Activate.c: Add calls to GrabKeyboard to remove strange
        interactions with window managers that steal keypresses.
        Call ungrab_all instead of XtUngrabPointer.
-       (XMenuActivate): Add call to XGrabKeyboard
-       (XMenuActivate): Add call to XUngrabKeyboard
+       (XMenuActivate): Add call to XGrabKeyboard.
+       (XMenuActivate): Add call to XUngrabKeyboard.
 
 2001-10-20  Gerd Moellmann  <gerd@gnu.org>
 
index 06b2faa44517cb634bf2d7cb11ee936332f929b6..9217c848641f17106696949d12d9d0e740fa0440 100644 (file)
 #include "XMenuInt.h"
 
 int
-XMenuChangePane(menu, p_num, label)
-    register XMenu *menu;      /* Menu object to be modified. */
-    register int p_num;                /* Pane number to be modified. */
-    char *label;               /* Selection label. */
+XMenuChangePane(register XMenu *menu, register int p_num, char *label)
+                               /* Menu object to be modified. */
+                                       /* Pane number to be modified. */
+                               /* Selection label. */
 {
     register XMPane *p_ptr;    /* XMPane pointer. */
 
index 9a1230bd39b3c5dda7234f642c4d16d95dd89049..b23bb6fd34839b3867b0c8cbc36834653799a37e 100644 (file)
 #include "XMenuInt.h"
 
 int
-XMenuChangeSelection(display, menu, p_num, s_num, data, data_sw, label, label_sw)
-    Display *display;          /* previously opened display. */
-    register XMenu *menu;      /* Menu object to be modified. */
-    register int p_num;                /* Pane number to be modified. */
-    register int s_num;                /* Selection number to modified. */
-    char *data;                        /* Data value. */
-    int data_sw;               /* Change to new data value? */
-    char *label;               /* Selection label. */
-    int label_sw;              /* Change to new label? */
+XMenuChangeSelection(Display *display, register XMenu *menu, register int p_num, register int s_num, char *data, int data_sw, char *label, int label_sw)
+                               /* previously opened display. */
+                               /* Menu object to be modified. */
+                                       /* Pane number to be modified. */
+                                       /* Selection number to modified. */
+                                       /* Data value. */
+                               /* Change to new data value? */
+                               /* Selection label. */
+                               /* Change to new label? */
 {
     register XMPane *p_ptr;    /* XMPane pointer. */
     register XMSelect *s_ptr;  /* XMSelect pointer. */
index 628ab89a678e8e6676e7dbeb5c4eddfbb262952d..f96e077a4662ab7efbe4f4574942f630f18f63b4 100644 (file)
@@ -91,19 +91,14 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #define TILE_BUF_SIZE          5
 
-int atoi();
-double atof();
-char *x_get_resource_string ();
+int atoi(const char *);
+double atof(const char *);
+char *x_get_resource_string (char *attribute, char *class);
 
 
 
 static Status
-XAllocDisplayColor(display, map, colorName, color, junk)
-    Display *display;
-    Colormap map;
-    char *colorName;
-    XColor *color;
-    XColor *junk;
+XAllocDisplayColor(Display *display, Colormap map, char *colorName, XColor *color, XColor *junk)
 {
   return (colorName!=0 &&
          XParseColor(display, map, colorName, color) &&
@@ -112,10 +107,10 @@ XAllocDisplayColor(display, map, colorName, color, junk)
 
 
 XMenu *
-XMenuCreate(display, parent, def_env)
-    Display *display;           /* ID of previously opened display */
-    Window parent;             /* Window ID of the menu's parent window. */
-    register char *def_env;    /* X Defaults program environment name. */
+XMenuCreate(Display *display, Window parent, register char *def_env)
+                                /* ID of previously opened display */
+                               /* Window ID of the menu's parent window. */
+                               /* X Defaults program environment name. */
 {
   register int i;              /* Loop counter. */
   register int j;              /* Loop counter. */
index e7568cff56e319ff5c55334819d1d1e650512392..baa1b8def41d7b829ff429ad1092b58d0fc2ee59 100644 (file)
 #include "XMenuInt.h"
 
 int
-XMenuDeletePane(display, menu, p_num)
-    register Display *display; /* Previously opened display */
-    register XMenu *menu;      /* Menu object to be modified. */
-    register int p_num;                /* Pane number to be deleted. */
+XMenuDeletePane(register Display *display, register XMenu *menu, register int p_num)
+                               /* Previously opened display */
+                               /* Menu object to be modified. */
+                                       /* Pane number to be deleted. */
 {
     register XMPane *p_ptr;    /* Pointer to pane being deleted. */
     register XMSelect *s_ptr;  /* Pointer to selections being deleted. */
index e7b6ace3845535bb6222437738e3478a17bf12b7..9b0e3d7cd373aa3297d9399bc00f655715f19a88 100644 (file)
 #include "XMenuInt.h"
 
 int
-XMenuDeleteSelection(display, menu, p_num, s_num)
-    register Display *display; /* Previously opened display. */
-    register XMenu *menu;      /* Menu object to be modified. */
-    register int p_num;                /* Pane number to be deleted. */
-    register int s_num;                /* Selection number to be deleted. */
+XMenuDeleteSelection(register Display *display, register XMenu *menu, register int p_num, register int s_num)
+                               /* Previously opened display. */
+                               /* Menu object to be modified. */
+                                       /* Pane number to be deleted. */
+                                       /* Selection number to be deleted. */
 {
     register XMPane *p_ptr;    /* Pointer to pane being deleted. */
     register XMSelect *s_ptr;  /* Pointer to selections being deleted. */
index 117f04ed1c5d0068ba2fe8e2003b76a1937c562b..906d92fb8cf59b54988125b7991b2bef58a81048 100644 (file)
@@ -15,9 +15,9 @@
 
 #include "XMenuInt.h"
 
-XMenuDestroy(display, menu)
-    Display *display;
-    register XMenu *menu;      /* Menu object to destroy. */
+XMenuDestroy(Display *display, register XMenu *menu)
+                     
+                               /* Menu object to destroy. */
 {
     register XMPane *p_ptr;    /* Pointer to the current pane. */
     register XMPane *p_next;   /* Pointer to the next pane. */
index 6f43cbdbf9bf0b83b3d3b351c71db9f01f53ef38..6454974fd5ed7988d15522bc8176e7f584da608d 100644 (file)
@@ -17,7 +17,7 @@
 #include "XMenuInt.h"
 
 char *
-XMenuError()
+XMenuError(void)
 {
     static char message[128];          /* Error message buffer. */
 
index 41ba49bcbca569eb57cd7fbefd1593b9af06f3be..fa99b8363af7bf81c110e46d67bf6a37245e7d25 100644 (file)
@@ -15,8 +15,7 @@
 
 #include "XMenuInt.h"
 
-XMenuEventHandler(handler)
-    int (*handler)();
+XMenuEventHandler(int (*handler) (XEvent*))
 {
     /*
      * Set the global event handler variable.
index fa71c6b39a1abd02bb02a84bb2eaa3afa6c8b0e3..0d0f8188013e009eaaadd8e71631dbb05fe5476e 100644 (file)
@@ -17,9 +17,7 @@
 #include "XMenuInt.h"
 
 int
-XMenuFindPane(menu, label)
-    register XMenu *menu;
-    register char *label;
+XMenuFindPane(register XMenu *menu, register char *label)
 {
     register XMPane *p_ptr;
     register int i = 0;
index fcb66eb851cd93806014c4a73952f750e458a798..202bbc1b28c098824d516d82ecc1d929d98f1c9d 100644 (file)
@@ -34,10 +34,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #include "XMenuInt.h"
 
 int
-XMenuFindSelection(menu, p_num, label)
-    register XMenu *menu;
-    int p_num;
-    register char *label;
+XMenuFindSelection(register XMenu *menu, int p_num, register char *label)
 {
     register XMPane *p_ptr;
     register XMSelect *s_ptr;
index 0aa43935ea2d86de06bb333d1a395f4f87219a16..19ee33cb423fbba4e463550245b415f9e0e47ec2 100644 (file)
 #include "XMenuInt.h"
 
 int
-XMenuInsertPane(menu, p_num, label, active)
-    register XMenu *menu;      /* Menu object to be modified. */
-    register int p_num;                /* Pane number of new pane. */
-    char *label;               /* Selection label. */
-    int active;                        /* Make selection active? */
+XMenuInsertPane(register XMenu *menu, register int p_num, char *label, int active)
+                               /* Menu object to be modified. */
+                                       /* Pane number of new pane. */
+                               /* Selection label. */
+                                       /* Make selection active? */
 {
     register XMPane *p_ptr;    /* XMPane pointer. */
     register XMPane *pane;     /* Newly created pane. */
index 08a0370868c5adca7a3c8547358aa6be6a48e386..0f28cdbef0c0d8bbf6d212aab76b7f3d49c3ec13 100644 (file)
 #include "XMenuInt.h"
 
 int
-XMenuInsertSelection(menu, p_num, s_num, data, label, active)
-    register XMenu *menu;      /* Menu object to be modified. */
-    register int p_num;                /* Pane number to be modified. */
-    register int s_num;                /* Selection number of new selection. */
-    char *data;                        /* Data value. */
-    char *label;               /* Selection label. */
-    int active;                        /* Make selection active? */
+XMenuInsertSelection(register XMenu *menu, register int p_num, register int s_num, char *data, char *label, int active)
+                               /* Menu object to be modified. */
+                                       /* Pane number to be modified. */
+                                       /* Selection number of new selection. */
+                                       /* Data value. */
+                               /* Selection label. */
+                                       /* Make selection active? */
 {
     register XMPane *p_ptr;    /* XMPane pointer. */
     register XMSelect *s_ptr;  /* XMSelect pointer. */
index b00841b0cc36210ff8f05c52d99885332f247c08..cb87dd650c74e5d509de9246359ece34c151319b 100644 (file)
@@ -96,7 +96,7 @@ _XMErrorList[XME_CODE_COUNT] = {
 /*
  * _XMEventHandler - Internal event handler variable.
  */
-int (*_XMEventHandler)() = NULL;
+int (*_XMEventHandler)(XEvent*) = NULL;
 
 
 
@@ -104,7 +104,7 @@ int (*_XMEventHandler)() = NULL;
  * _XMWinQueInit - Internal routine to initialize the window
  *                queue.
  */
-_XMWinQueInit()
+_XMWinQueInit(void)
 {
     /*
      * If the queue is not initialized initialize it.
@@ -138,10 +138,10 @@ _XMWinQueInit()
  *                   window queue.
  */
 int
-_XMWinQueAddPane(display, menu, p_ptr)
-    register Display *display;
-    register XMenu *menu;      /* Menu being manipulated. */
-    register XMPane *p_ptr;    /* XMPane being queued. */
+_XMWinQueAddPane(register Display *display, register XMenu *menu, register XMPane *p_ptr)
+                              
+                               /* Menu being manipulated. */
+                               /* XMPane being queued. */
 {
     /*
      * If the queue is currently full then flush it.
@@ -172,10 +172,10 @@ _XMWinQueAddPane(display, menu, p_ptr)
  *                        the selection window queue.
  */
 int
-_XMWinQueAddSelection(display, menu, s_ptr)
-    register Display *display;
-    register XMenu *menu;      /* Menu being manipulated. */
-    register XMSelect *s_ptr;  /* XMSelection being queued. */
+_XMWinQueAddSelection(register Display *display, register XMenu *menu, register XMSelect *s_ptr)
+                              
+                               /* Menu being manipulated. */
+                               /* XMSelection being queued. */
 {
     /*
      * If this entry will overflow the queue then flush it.
@@ -206,10 +206,10 @@ _XMWinQueAddSelection(display, menu, s_ptr)
  *                 selection window queues.
  */
 int
-_XMWinQueFlush(display, menu, pane, select)
-    register Display *display;
-    register XMenu *menu;              /* Menu being manipulated. */
-    register XMPane *pane;             /* Current pane. */
+_XMWinQueFlush(register Display *display, register XMenu *menu, register XMPane *pane, XMSelect *select)
+                              
+                                       /* Menu being manipulated. */
+                                       /* Current pane. */
 {
     register int pq_index;             /* Pane queue index. */
     register int sq_index;             /* Selection queue index. */
@@ -346,9 +346,9 @@ _XMWinQueFlush(display, menu, pane, select)
  *                     a pane pointer that points to the indexed pane.
  */
 XMPane *
-_XMGetPanePtr(menu, p_num)
-    register XMenu *menu;      /* Menu to find the pane in. */
-    register int p_num;                /* Index number of pane to find. */
+_XMGetPanePtr(register XMenu *menu, register int p_num)
+                               /* Menu to find the pane in. */
+                                       /* Index number of pane to find. */
 {
     register XMPane *p_ptr;    /* Pane pointer to be returned. */
     register int i;            /* Loop counter. */
@@ -382,9 +382,9 @@ _XMGetPanePtr(menu, p_num)
  *                     indexed selection.
  */
 XMSelect *
-_XMGetSelectionPtr(p_ptr, s_num)
-    register XMPane *p_ptr;    /* Pane to find the selection in. */
-    register int s_num;                /* Index number of the selection to find. */
+_XMGetSelectionPtr(register XMPane *p_ptr, register int s_num)
+                               /* Pane to find the selection in. */
+                                       /* Index number of the selection to find. */
 {
     register XMSelect *s_ptr;  /* Selection pointer to be returned. */
     register int i;            /* Loop counter. */
@@ -416,9 +416,9 @@ _XMGetSelectionPtr(p_ptr, s_num)
  * _XMRecomputeGlobals - Internal subroutine to recompute menu wide
  *                      global values.
  */
-_XMRecomputeGlobals(display, menu)
-    register Display *display; /*X11 display variable. */
-    register XMenu *menu;      /* Menu object to compute from. */
+_XMRecomputeGlobals(register Display *display, register XMenu *menu)
+                               /*X11 display variable. */
+                               /* Menu object to compute from. */
 {
     register XMPane *p_ptr;    /* Pane pointer. */
     register XMSelect *s_ptr;  /* Selection pointer. */
@@ -531,11 +531,11 @@ _XMRecomputeGlobals(display, menu)
  *                   window dependencies.
  */
 int
-_XMRecomputePane(display, menu, p_ptr, p_num)
-    register Display *display; /* Standard X display variable. */
-    register XMenu *menu;      /* Menu object being recomputed. */
-    register XMPane *p_ptr;    /* Pane pointer. */
-    register int p_num;                /* Pane sequence number. */
+_XMRecomputePane(register Display *display, register XMenu *menu, register XMPane *p_ptr, register int p_num)
+                               /* Standard X display variable. */
+                               /* Menu object being recomputed. */
+                               /* Pane pointer. */
+                                       /* Pane sequence number. */
 {
     register int window_x;     /* Recomputed window X coordinate. */
     register int window_y;     /* Recomputed window Y coordinate. */
@@ -681,11 +681,11 @@ _XMRecomputePane(display, menu, p_ptr, p_num)
  *                        selection window dependencies.
  */
 int
-_XMRecomputeSelection(display, menu, s_ptr, s_num)
-    register Display *display;
-    register XMenu *menu;      /* Menu object being recomputed. */
-    register XMSelect *s_ptr;  /* Selection pointer. */
-    register int s_num;                /* Selection sequence number. */
+_XMRecomputeSelection(register Display *display, register XMenu *menu, register XMSelect *s_ptr, register int s_num)
+                              
+                               /* Menu object being recomputed. */
+                               /* Selection pointer. */
+                                       /* Selection sequence number. */
 {
     register Bool config_s = False;    /* Reconfigure selection window? */
     XWindowChanges *changes;           /* Values to change in configure. */
@@ -811,15 +811,15 @@ _XMRecomputeSelection(display, menu, s_ptr, s_num)
  *                     recomputed before calling this routine or
  *                     unpredictable results will follow.
  */
-_XMTransToOrigin(display, menu, p_ptr, s_ptr, x_pos, y_pos, orig_x, orig_y)
-    Display *display;          /* Not used. Included for consistency. */
-    register XMenu *menu;      /* Menu being computed against. */
-    register XMPane *p_ptr;    /* Current pane pointer. */
-    register XMSelect *s_ptr;  /* Current selection pointer. */
-    int x_pos;                 /* X coordinate of point to translate. */
-    int y_pos;                 /* Y coordinate of point to translate. */
-    int *orig_x;               /* Return value X coord. of the menu origin. */
-    int *orig_y;               /* Return value Y coord. of the menu origin. */
+_XMTransToOrigin(Display *display, register XMenu *menu, register XMPane *p_ptr, register XMSelect *s_ptr, int x_pos, int y_pos, int *orig_x, int *orig_y)
+                               /* Not used. Included for consistency. */
+                               /* Menu being computed against. */
+                               /* Current pane pointer. */
+                               /* Current selection pointer. */
+                               /* X coordinate of point to translate. */
+                               /* Y coordinate of point to translate. */
+                               /* Return value X coord. of the menu origin. */
+                               /* Return value Y coord. of the menu origin. */
 {
     register int l_orig_x;     /* Local X coordinate of the menu origin. */
     register int l_orig_y;     /* Local Y coordinate of the menu origin. */
@@ -871,10 +871,7 @@ _XMTransToOrigin(display, menu, p_ptr, s_ptr, x_pos, y_pos, orig_x, orig_y)
  * _XMRefreshPane - Internal subroutine to completely refresh
  *                 the contents of a pane.
  */
-_XMRefreshPane(display, menu, pane)
-    register Display *display;
-    register XMenu *menu;
-    register XMPane *pane;
+_XMRefreshPane(register Display *display, register XMenu *menu, register XMPane *pane)
 {
     register XMSelect *s_list = pane->s_list;
     register XMSelect *s_ptr;
@@ -941,10 +938,7 @@ _XMRefreshPane(display, menu, pane)
  * _XMRefreshSelection - Internal subroutine that refreshes
  *                      a single selection window.
  */
-_XMRefreshSelection(display, menu, select)
-    register Display *display;
-    register XMenu *menu;
-    register XMSelect *select;
+_XMRefreshSelection(register Display *display, register XMenu *menu, register XMSelect *select)
 {
     register int width = select->window_w;
     register int height = select->window_h;
index edd94369e6e7e5aa7a5565be94ef98a41992d70d..c79f70bd836122f5ff1312157d8c60393df286fe 100644 (file)
 #include "XMenuInt.h"
 
 int
-XMenuLocate(display, menu, p_num, s_num, x_pos, y_pos, ul_x, ul_y, width, height)
-    register Display *display; /* Previously opened display. */
-    register XMenu *menu;      /* Menu object being located. */
-    int p_num;                 /* Active pane number. */
-    int s_num;                 /* Active selection number. */
-    int x_pos;                 /* X coordinate of mouse active position. */
-    int y_pos;                 /* Y coordinate of mouse active position. */
-    int *ul_x;                 /* Returned upper left menu X coordinate. */
-    int *ul_y;                 /* Returned upper left menu Y coordinate. */
-    int *width;                        /* Returned menu width. */
-    int *height;               /* Returned menu height. */
+XMenuLocate(register Display *display, register XMenu *menu, int p_num, int s_num, int x_pos, int y_pos, int *ul_x, int *ul_y, int *width, int *height)
+                               /* Previously opened display. */
+                               /* Menu object being located. */
+                               /* Active pane number. */
+                               /* Active selection number. */
+                               /* X coordinate of mouse active position. */
+                               /* Y coordinate of mouse active position. */
+                               /* Returned upper left menu X coordinate. */
+                               /* Returned upper left menu Y coordinate. */
+                                       /* Returned menu width. */
+                               /* Returned menu height. */
 {
     register XMPane *p_ptr;    /* XMPane pointer. */
     register XMSelect *s_ptr;  /* XMSelect pointer. */
index a4a2d52b156c3169abd51d92692707348c625dff..8acfee07fd08ffef67f2227718cf49d9dd151c66 100644 (file)
@@ -15,8 +15,8 @@
 ## without express or implied warranty.
 
 
-## Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
-##   Free Software Foundation, Inc.
+## Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
+##   2010  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
@@ -36,7 +36,7 @@
 
 ## To the best of our knowledge, this code was originally based on the
 ## X11 oldXMenu Makefile, which was automatically generated from the
-## X11 oldXMenu Imakefile. There was no explicit copyright information
+## X11 oldXMenu Imakefile.  There was no explicit copyright information
 ## in the Imakefile, therefore we have added the same MIT license as
 ## used by the rest of the oldXMenu code.
 
 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@
 
 EXTRA=insque.o
 CC=@CC@
 CFLAGS=@CFLAGS@
-CPP=@CPP@
-LN_S=@LN_S@
-             AS = as
-             LD = ld
-           TAGS = etags
-             RM = rm -f
-             MV = mv
-         RANLIB = ranlib
+TAGS = etags
+RM = rm -f
+RANLIB = @RANLIB@
 # Solaris 2.1 ar doesn't accept the 'l' option.
-             AR = ar cq
-             LS = ls
-       LINTOPTS = -axz
-    LINTLIBFLAG = -C
-           MAKE = make
-    STD_DEFINES =
-    CDEBUGFLAGS = -O
-         RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a \
-                       tags TAGS make.log
+AR = ar cq
 
 OBJS =  Activate.o \
        AddPane.o \
@@ -97,7 +89,8 @@ OBJS =  Activate.o \
 all:: libXMenu11.a
 
 ALL_CFLAGS=$(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) \
-  $(C_SWITCH_X_SITE) $(C_SWITCH_X_SYSTEM) $(C_SWITCH_X_MACHINE) \
+  $(C_SWITCH_X_SITE) $(C_SWITCH_X_SYSTEM) \
+  ${C_WARNINGS_SWITCH} ${PROFILING_CFLAGS} \
   $(CPPFLAGS) $(CFLAGS) -DEMACS_BITMAP_FILES \
   -I../src -I${srcdir} -I${srcdir}/../src
 
@@ -107,11 +100,7 @@ ALL_CFLAGS=$(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) \
 libXMenu11.a: $(OBJS) $(EXTRA)
        $(RM) $@
        $(AR) $@ $(OBJS) $(EXTRA)
-       @echo Do not be alarmed if the following ranlib command
-       @echo fails due to the absence of a ranlib program on your system.
-       -$(RANLIB) $@ || true
-#If running ranlib fails, probably there is none.
-#That's ok.  So don't stop the build.
+       $(RANLIB) $@
 
 Activate.o: Activate.c XMenuInt.h XMenu.h X10.h
 AddPane.o: AddPane.c XMenuInt.h XMenu.h X10.h
index c51f23e71467f5f981c018581721fd5e0197fd0b..07e24a26272253e281cff810d321f2ec1c8645e0 100644 (file)
 #include "XMenuInt.h"
 
 char *
-XMenuPost(display, menu, p_num, s_num, x_pos, y_pos, event_mask)
-    register Display *display; /* Previously opened display. */
-    register XMenu *menu;      /* Menu to post. */
-    register int *p_num;       /* Pane number selected. */
-    register int *s_num;       /* Selection number selected. */
-    register int x_pos;                /* X coordinate of menu position. */
-    register int y_pos;                /* Y coordinate of menu position. */
-    int event_mask;            /* Mouse button event mask. */
+XMenuPost(register Display *display, register XMenu *menu, register int *p_num, register int *s_num, register int x_pos, register int y_pos, int event_mask)
+                               /* Previously opened display. */
+                               /* Menu to post. */
+                               /* Pane number selected. */
+                               /* Selection number selected. */
+                                       /* X coordinate of menu position. */
+                                       /* Y coordinate of menu position. */
+                               /* Mouse button event mask. */
 {
     register int stat;         /* Routine call return status. */
     char *data;                        /* Return data. */
index 230db9e3a13b657159bdc03b67da520cd3cc75ec..038ac3b0b6bae0cef6135aada72f47808997b6ab 100644 (file)
@@ -16,9 +16,9 @@
 #include "XMenuInt.h"
 
 int
-XMenuRecompute(display, menu)
-    Display *display;
-    register XMenu *menu;      /* Menu object to be recomputed. */
+XMenuRecompute(Display *display, register XMenu *menu)
+                     
+                               /* Menu object to be recomputed. */
 {
     register XMPane *p_ptr;    /* Pane pointer. */
     register XMSelect *s_ptr;  /* Selection pointer. */
index 0e81ed55a49bbb7bdda2c208f18b60e51ac94239..7cdb867ff092e3e4272138d6e7b4dc6a21d82a63 100644 (file)
@@ -18,9 +18,9 @@
 
 #include "XMenuInt.h"
 
-XMenuSetAEQ(menu, aeq)
-    register XMenu *menu;      /* Menu object to be modified. */
-    register int aeq;          /* AEQ mode? */
+XMenuSetAEQ(register XMenu *menu, register int aeq)
+                               /* Menu object to be modified. */
+                               /* AEQ mode? */
 {
     /*
      * Set the AEQ mode switch.
index be9f76f7d80f0799eeb29cbf8a741d7bfbfee456..43684db901184513bddf8abd22a94023bf381d2a 100644 (file)
@@ -17,9 +17,9 @@
 
 #include "XMenuInt.h"
 
-XMenuSetFreeze(menu, freeze)
-    register XMenu *menu;      /* Menu object to be modified. */
-    register int freeze;       /* Freeze mode? */
+XMenuSetFreeze(register XMenu *menu, register int freeze)
+                               /* Menu object to be modified. */
+                               /* Freeze mode? */
 {
     /*
      * Set the freeze mode switch.
index b9ecb7e8706602be9d07fc09f81f3e202490c4c2..9f5a99a564e39d02f719fb5d025d616eed31c294 100644 (file)
 #include "XMenuInt.h"
 
 int
-XMenuSetPane(menu, p_num, active)
-    register XMenu *menu;      /* Menu object to be modified. */
-    register int p_num;                /* Pane number to be modified. */
-    register int active;       /* Make selection active? */
+XMenuSetPane(register XMenu *menu, register int p_num, register int active)
+                               /* Menu object to be modified. */
+                                       /* Pane number to be modified. */
+                               /* Make selection active? */
 {
     register XMPane *p_ptr;    /* XMPane pointer. */
 
index aae161322ebe6c85ff5cf19ed372c497f6ad26c7..162d3434badc13586e0d487605575b4a270fc213 100644 (file)
 #include "XMenuInt.h"
 
 int
-XMenuSetSelection(menu, p_num, s_num, active)
-    register XMenu *menu;      /* Menu object to be modified. */
-    register int p_num;                /* Pane number to be modified. */
-    register int s_num;                /* Selection number to modified. */
-    int active;                        /* Make selection active? */
+XMenuSetSelection(register XMenu *menu, register int p_num, register int s_num, int active)
+                               /* Menu object to be modified. */
+                                       /* Pane number to be modified. */
+                                       /* Selection number to modified. */
+                                       /* Make selection active? */
 {
     register XMPane *p_ptr;    /* XMPane pointer. */
     register XMSelect *s_ptr;  /* XMSelect pointer. */
index e1abcbbe6c599efca939f5d8dc1bc0b0e651fbab..9a7766bc09d68806d7620d6c59e1d9b1902f6a61 100644 (file)
@@ -71,8 +71,8 @@ typedef struct {
     int size;                  /* Table size (number of buckets). */
 } XAssocTable;
 
-XAssocTable *XCreateAssocTable();
-char *XLookUpAssoc();
+XAssocTable *XCreateAssocTable(int size);
+char *XLookUpAssoc(Display *dpy, XAssocTable *table, XID x_id);
 
 #endif /* _X10_H_ */
 
index 874ed81d31f14e03d24d05f7d3a4b2bb8c89faad..aa98c27ff4140060ac730370bf2c814f9d693ae6 100644 (file)
@@ -11,8 +11,6 @@
 #define NULL 0
 #endif
 
-extern int errno;
-
 /*
  * XCreateAssocTable - Create an XAssocTable.  The size argument should be
  * a power of two for efficiency reasons.  Some size suggestions: use 32
@@ -20,8 +18,8 @@ extern int errno;
  * buckets is 8.  If there is an error creating the XAssocTable, a NULL
  * pointer is returned.
  */
-XAssocTable *XCreateAssocTable(size)
-       register int size;              /* Desired size of the table. */
+XAssocTable *XCreateAssocTable(register int size)
+                                       /* Desired size of the table. */
 {
        register XAssocTable *table;    /* XAssocTable to be initialized. */
        register XAssoc *buckets;       /* Pointer to the first bucket in */
index 11e8c35a774db2a300c7396944174275970ee553..7aca50aa56b10199c776b7f3aac8d055b1085b1c 100644 (file)
@@ -5,22 +5,19 @@
 
 #include <X11/Xlib.h>
 #include "X10.h"
-void emacs_remque();
 struct qelem {
        struct    qelem *q_forw;
        struct    qelem *q_back;
        char q_data[1];
 };
+void emacs_remque(struct qelem*);
 
 /*
  * XDeleteAssoc - Delete an association in an XAssocTable keyed on
  * an XId.  An association may be removed only once.  Redundant
  * deletes are meaningless (but cause no problems).
  */
-XDeleteAssoc(dpy, table, x_id)
-        register Display *dpy;
-       register XAssocTable *table;
-       register XID x_id;
+XDeleteAssoc(register Display *dpy, register XAssocTable *table, register XID x_id)
 {
        int hash;
        register XAssoc *bucket;
index fee53eb756f676879b328b24a9fbeb158c2482b8..c2dd8d4d89ba2d8c689147c557e35927beb7bb90 100644 (file)
@@ -10,8 +10,7 @@
  * XDestroyAssocTable - Destroy (free the memory associated with)
  * an XAssocTable.
  */
-XDestroyAssocTable(table)
-       register XAssocTable *table;
+XDestroyAssocTable(register XAssocTable *table)
 {
        register int i;
        register XAssoc *bucket;
index 0ab71c3e78b99e6fc446148d9764688b3951cb6f..a1a06e900c74b09dfc6c3977ecab750bfef09043 100644 (file)
  * in the table the routine will return a NULL pointer.  All XId's are relative
  * to the currently active Display.
  */
-caddr_t XLookUpAssoc(dpy, table, x_id)
-        register Display *dpy;
-       register XAssocTable *table;    /* XAssocTable to search in. */
-       register XID x_id;                      /* XId to search for. */
+caddr_t XLookUpAssoc(register Display *dpy, register XAssocTable *table, register XID x_id)
+                              
+                                       /* XAssocTable to search in. */
+                                               /* XId to search for. */
 {
        int hash;
        register XAssoc *bucket;
index cf039c8f3c1f3f206be3e3ea2223219e4239d778..84157399b43923eb777e80ff4665ad28fbc18d7c 100644 (file)
 #define NULL 0
 #endif
 
-extern int errno;
-
-void emacs_insque();
 struct qelem {
        struct    qelem *q_forw;
        struct    qelem *q_back;
        char q_data[1];
 };
+void emacs_insque (struct qelem *elem, struct qelem *prev);
+
 /*
  * XMakeAssoc - Insert data into an XAssocTable keyed on an XId.
  * Data is inserted into the table only once.  Redundant inserts are
  * meaningless (but cause no problems).  The queue in each association
  * bucket is sorted (lowest XId to highest XId).
  */
-XMakeAssoc(dpy, table, x_id, data)
-       register Display *dpy;
-       register XAssocTable *table;
-       register XID x_id;
-       register caddr_t data;
+XMakeAssoc(register Display *dpy, register XAssocTable *table, register XID x_id, register caddr_t data)
 {
        int hash;
        register XAssoc *bucket;
index 2589ae68ccac63d4fd9e46b18c77c5b011ede8c2..88ebf5b3ac75a289e7dbee310de2e6b99f2e6ee4 100644 (file)
@@ -16,6 +16,7 @@
 #ifndef _XMenu_h_
 #define _XMenu_h_
 
+#include <stdlib.h>
 #include <X11/Xutil.h>
 #include "X10.h"
 
@@ -234,31 +235,33 @@ typedef struct _xmenu {
     Pixmap inact_pixmap;       /* Menu inactive pixmap. */
 } XMenu;
 
+typedef void (*Wait_func)(void*);
+
 /*
  * XMenu library routine declarations.
  */
-XMenu *XMenuCreate();
-int XMenuAddPane();
-int XMenuAddSelection();
-int XMenuInsertPane();
-int XMenuInsertSelection();
-int XMenuFindPane();
-int XMenuFindSelection();
-int XMenuChangePane();
-int XMenuChangeSelection();
-int XMenuSetPane();
-int XMenuSetSelection();
-int XMenuRecompute();
-int XMenuEventHandler();       /* No value actually returned. */
-int XMenuLocate();
-int XMenuSetFreeze();          /* No value actually returned. */
-void XMenuActivateSetWaitFunction();
-int XMenuActivate();
-char *XMenuPost();
-int XMenuDeletePane();
-int XMenuDeleteSelection();
-int XMenuDestroy();            /* No value actually returned. */
-char *XMenuError();
+XMenu *XMenuCreate(Display *display, Window parent, register char *def_env);
+int XMenuAddPane(Display *display, register XMenu *menu, register char *label, int active);
+int XMenuAddSelection(Display *display, register XMenu *menu, register int p_num, char *data, char *label, int active, char *help);
+int XMenuInsertPane(register XMenu *menu, register int p_num, char *label, int active);
+int XMenuInsertSelection(register XMenu *menu, register int p_num, register int s_num, char *data, char *label, int active);
+int XMenuFindPane(register XMenu *menu, register char *label);
+int XMenuFindSelection(register XMenu *menu, int p_num, register char *label);
+int XMenuChangePane(register XMenu *menu, register int p_num, char *label);
+int XMenuChangeSelection(Display *display, register XMenu *menu, register int p_num, register int s_num, char *data, int data_sw, char *label, int label_sw);
+int XMenuSetPane(register XMenu *menu, register int p_num, register int active);
+int XMenuSetSelection(register XMenu *menu, register int p_num, register int s_num, int active);
+int XMenuRecompute(Display *display, register XMenu *menu);
+int XMenuEventHandler(int (*handler) (XEvent *));      /* No value actually returned. */
+int XMenuLocate(register Display *display, register XMenu *menu, int p_num, int s_num, int x_pos, int y_pos, int *ul_x, int *ul_y, int *width, int *height);
+int XMenuSetFreeze(register XMenu *menu, register int freeze);         /* No value actually returned. */
+void XMenuActivateSetWaitFunction(Wait_func func, void *data);
+int XMenuActivate(Display *display, XMenu *menu, int *p_num, int *s_num, int x_pos, int y_pos, unsigned int event_mask, char **data, void (*help_callback) (char *, int, int));
+char *XMenuPost(register Display *display, register XMenu *menu, register int *p_num, register int *s_num, register int x_pos, register int y_pos, int event_mask);
+int XMenuDeletePane(register Display *display, register XMenu *menu, register int p_num);
+int XMenuDeleteSelection(register Display *display, register XMenu *menu, register int p_num, register int s_num);
+int XMenuDestroy(Display *display, register XMenu *menu);              /* No value actually returned. */
+char *XMenuError(void);
 
 #endif
 /* Don't add after this point. */
index d2844d8ea2b8503c5e674208dd03ca0d7808fc64..dc6a0e5192a93ccc84dd6eb919eab8b209500d20 100644 (file)
@@ -37,7 +37,7 @@
 /*
  * XMenu internal event handler variable.
  */
-extern int (*_XMEventHandler)();
+extern int (*_XMEventHandler)(XEvent*);
 
 #ifndef Pixel
 #define Pixel unsigned long
@@ -46,19 +46,17 @@ extern int (*_XMEventHandler)();
 /*
  * Internal routine declarations.
  */
-int _XMWinQueInit();           /* No value actually returned. */
-int _XMWinQueAddPane();
-int _XMWinQueAddSelection();
-int _XMWinQueFlush();
-XMPane *_XMGetPanePtr();
-XMSelect *_XMGetSelectionPtr();
-int _XMRecomputeGlobals();     /* No value actually returned. */
-int _XMRecomputePane();
-int _XMRecomputeSelection();
-int _XMTransToOrigin();                /* No value actually returned. */
-int _XMRefreshPane();          /* No value actually returned. */
-int _XMRefreshSelections();    /* No value actually returned. */
-int _XMHighlightSelection();   /* No value actually returned. */
+int _XMWinQueInit(void);               /* No value actually returned. */
+int _XMWinQueAddPane(register Display *display, register XMenu *menu, register XMPane *p_ptr);
+int _XMWinQueAddSelection(register Display *display, register XMenu *menu, register XMSelect *s_ptr);
+int _XMWinQueFlush(register Display *display, register XMenu *menu, register XMPane *pane, XMSelect *select);
+XMPane *_XMGetPanePtr(register XMenu *menu, register int p_num);
+XMSelect *_XMGetSelectionPtr(register XMPane *p_ptr, register int s_num);
+int _XMRecomputeGlobals(register Display *display, register XMenu *menu);      /* No value actually returned. */
+int _XMRecomputePane(register Display *display, register XMenu *menu, register XMPane *p_ptr, register int p_num);
+int _XMRecomputeSelection(register Display *display, register XMenu *menu, register XMSelect *s_ptr, register int s_num);
+int _XMTransToOrigin(Display *display, register XMenu *menu, register XMPane *p_ptr, register XMSelect *s_ptr, int x_pos, int y_pos, int *orig_x, int *orig_y);                /* No value actually returned. */
+int _XMRefreshPane(register Display *display, register XMenu *menu, register XMPane *pane);            /* No value actually returned. */
 
 #endif
 /* Don't add stuff after this #endif */
index 16b194d88d37d002942bd076a230d09322a3698d..c6f8f6ef1fb9da3a5b6d01dfde3b860a4c2c6f83 100644 (file)
@@ -30,8 +30,7 @@ struct qelem {
 /* Insert ELEM into a doubly-linked list, after PREV.  */
 
 void
-emacs_insque (elem, prev)
-     struct qelem *elem, *prev;
+emacs_insque (struct qelem *elem, struct qelem *prev)
 {
   struct qelem *next = prev->q_forw;
   prev->q_forw = elem;
@@ -43,8 +42,7 @@ emacs_insque (elem, prev)
 
 /* Unlink ELEM from the doubly-linked list that it is in.  */
 
-emacs_remque (elem)
-     struct qelem *elem;
+emacs_remque (struct qelem *elem)
 {
   struct qelem *next = elem->q_forw;
   struct qelem *prev = elem->q_back;
diff --git a/src/.arch-inventory b/src/.arch-inventory
deleted file mode 100644 (file)
index c21e38d..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-# Source files which don't match the usual naming conventions, mostly dot files
-source ^\.(gdbinit|dbxinit)$
-
-# Auto-generated files, which ignore
-precious ^(config\.stamp|config\.h|epaths\.h|buildobj\.lst)$
-precious ^(TAGS-LISP)$
-precious ^(buildobj\.lst)$
-
-backup ^(stamp-oldxmenu|prefix-args|temacs|emacs|emacs-[0-9.]*)$
-backup ^(bootstrap-emacs)$
-
-# arch-tag: 277cc7ae-b3f5-44af-abf1-84c073164543
index e8a64f5dfe419e5be586830448ced2f384b95fe4..b3bb6b58267f76ae016685944702782a9342806c 100644 (file)
@@ -21,6 +21,8 @@
 
 # Force loading of symbols, enough to give us gdb_valbits etc.
 set main
+# With some compilers, we need this to give us struct Lisp_Symbol etc.:
+set Fmake_symbol
 
 # Find lwlib source files too.
 dir ../lwlib
@@ -271,6 +273,9 @@ define pitx
     end
   end
   printf "\n"
+  if ($it->bidi_p)
+    printf "BIDI: base_stop=%d prev_stop=%d level=%d\n", $it->base_level_stop, $it->prev_stop, $it->bidi_it.resolved_level
+  end
   if ($it->region_beg_charpos >= 0)
     printf "reg=%d-%d ", $it->region_beg_charpos, $it->region_end_charpos
   end
@@ -447,6 +452,36 @@ document pwin
 Pretty print window structure w.
 end
 
+define pbiditype
+  if ($arg0 == 0)
+    printf "UNDEF"
+  end
+  if ($arg0 == 1)
+    printf "L"
+  end
+  if ($arg0 == 2)
+    printf "R"
+  end
+  if ($arg0 == 3)
+    printf "EN"
+  end
+  if ($arg0 == 4)
+    printf "AN"
+  end
+  if ($arg0 == 5)
+    printf "BN"
+  end
+  if ($arg0 == 6)
+    printf "B"
+  end
+  if ($arg0 < 0 || $arg0 > 6)
+    printf "%d??", $arg0
+  end
+end
+document pbiditype
+Print textual description of bidi type given as first argument.
+end
+
 define pgx
   set $g = $arg0
   # CHAR_GLYPH
@@ -475,6 +510,11 @@ define pgx
   else
     printf " pos=%d", $g->charpos
   end
+  # For characters, print their resolved level and bidi type
+  if ($g->type == 0)
+    printf " blev=%d,btyp=", $g->resolved_level
+    pbiditype $g->bidi_type
+  end
   printf " w=%d a+d=%d+%d", $g->pixel_width, $g->ascent, $g->descent
   # If not DEFAULT_FACE_ID
   if ($g->face_id != 0)
@@ -495,6 +535,9 @@ define pgx
   if ($g->overlaps_vertically_p)
     printf " OVL"
   end
+  if ($g->avoid_cursor_p)
+    printf " AVOID"
+  end
   if ($g->left_box_line_p)
     printf " ["
   end
@@ -575,6 +618,31 @@ document pgrowit
 Pretty print all glyphs in it->glyph_row.
 end
 
+define prowlims
+  printf "edges=(%d,%d),r2l=%d,cont=%d,trunc=(%d,%d),at_zv=%d\n", $arg0->minpos.charpos, $arg0->maxpos.charpos, $arg0->reversed_p, $arg0->continued_p, $arg0->truncated_on_left_p, $arg0->truncated_on_right_p, $arg0->ends_at_zv_p
+end
+document prowlims
+Print important attributes of a glyph_row structure.
+Takes one argument, a pointer to a glyph_row structure.
+end
+
+define pmtxrows
+  set $mtx = $arg0
+  set $gl = $mtx->rows
+  set $glend = $mtx->rows + $mtx->nrows - 1
+  set $i = 0
+  while ($gl < $glend)
+    printf "%d: ", $i
+    prowlims $gl
+    set $gl = $gl + 1
+    set $i = $i + 1
+  end
+end
+document pmtxrows
+Print data about glyph rows in a glyph matrix.
+Takes one argument, a pointer to a glyph_matrix structure.
+end
+
 define xtype
   xgettype $
   output $type
@@ -829,6 +897,19 @@ Print the address of the char-table $, and its purpose.
 This command assumes that $ is an Emacs Lisp char-table value.
 end
 
+define xsubchartable
+  xgetptr $
+  print (struct Lisp_Sub_Char_Table *) $ptr
+  xgetint $->depth
+  set $depth = $int
+  xgetint $->min_char
+  printf "Depth: %d, Min char: %d (0x%x)\n", $depth, $int, $int
+end
+document xsubchartable
+Print the address of the sub-char-table $, its depth and min-char.
+This command assumes that $ is an Emacs Lisp sub-char-table value.
+end
+
 define xboolvector
   xgetptr $
   print (struct Lisp_Bool_Vector *) $ptr
index 8a0b1b094ba03b5c617c3b5322f0c050aaf49d3b..d1f789f5dcb94a6a0878c80a376fd77c7bc8e0fe 100644 (file)
        handle unibyte-display-via-language-environment here. For a
        charater of no glyph, use font->space_width instead of FONT_WIDTH.
 
+2010-08-31  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * keyboard.c (Fwindow_system): Fix compilation for USE_LISP_UNION_TYPE.
+
+2010-08-31  Chong Yidong  <cyd@stupidchicken.com>
+
+       * keyboard.c (command_loop_1): Don't call x-set-selection on tty.
+
+2010-08-30  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * marker.c (Fcopy_marker): Make the first arg optional.
+
+2010-08-30  Kenichi Handa  <handa@m17n.org>
+
+       * composite.c (composition_update_it): Fix computing of
+       cmp_it->width.
+
 2010-08-29  Kenichi Handa  <handa@m17n.org>
 
-       * term.c (encode_terminal_code): Encode byte chars to the
-       correspnding bytes.
+       * term.c (encode_terminal_code): Encode byte chars to the
+       correspnding bytes.
+
+2010-08-29  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * nsterm.m (ns_draw_window_cursor): Draw BAR_CURSOR correct for R2L.
+
+2010-08-26  Kenichi Handa  <handa@m17n.org>
+
+       * xdisp.c (compute_stop_pos): Pay attention to bidi scan direction
+       on calling composition_compute_stop_pos.
+
+2010-08-25  Kenichi Handa  <handa@m17n.org>
+
+       * fontset.c (reorder_font_vector): Prefer a font-spec specifying
+       :otf.
+
+       * composite.c (composition_compute_stop_pos): Don't break
+       composition at PT.
+       (composition_reseat_it): Likewise.  Fix calculation of character
+       position starting a composition.
+       (Fcomposition_get_gstring): Don't limit the number of components
+       for automatic composition.
+
+2010-08-25  Kenichi Handa  <handa@m17n.org>
+
+       * composite.c (composition_compute_stop_pos): In forward search,
+       pay attention to the possibility that some character after ENDPOS
+       will be composed with charactrs before ENDPOS.
+
+2010-08-24  Chong Yidong  <cyd@stupidchicken.com>
+
+       * keyboard.c (command_loop_1): Don't clobber primary selection
+       during handle-switch-frame (Bug#6872).
+
+2010-08-23  Michael Albinus  <michael.albinus@gmx.de>
+
+       * dbusbind.c: Accept UNIX domain sockets as bus address.
+       (Fdbus_close_bus): New function.
+       (Vdbus_registered_buses): New variable.
+       (xd_initialize): Implement string as bus address.
+       (Fdbus_init_bus): Add bus to Vdbus_registered_buses).
+       (Fdbus_get_unique_name, Fdbus_call_method)
+       (Fdbus_call_method_asynchronously, Fdbus_method_return_internal)
+       (Fdbus_method_error_internal, Fdbus_send_signal)
+       (Fdbus_register_signal, Fdbus_register_method): Remove bus type
+       check.  This is done in xd_initialize_bus.  Adapt doc string, if
+       necessary.
+       (xd_pending_messages, xd_read_queued_messages): Loop over buses in
+       Vdbus_registered_buses.
+       (Vdbus_registered_objects_table): Create hash.
+
+2010-08-22  Juri Linkov  <juri@jurta.org>
+
+       * keyboard.c (Fexecute_extended_command): Move reading a command name
+       with `completing-read' to a new Elisp function `read-extended-command'.
+       Call it to read a command to `function'  (bug#5364, bug#5214).
+
+2010-08-22  Chong Yidong  <cyd@stupidchicken.com>
+
+       * emacs.c (main): Remove handling of --unibyte arg (Bug#6886).
+
+2010-08-22  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * eval.c (Flet, Feval, Fapply, apply_lambda): Use SAFE_ALLOCA_LISP
+       instead of SAFE_ALLOCA.
+
+2010-08-22  Chong Yidong  <cyd@stupidchicken.com>
+
+       * eval.c (Flet, Feval, Fapply, apply_lambda): Use SAFE_ALLOCA
+       (Bug#6214).
+
+2010-08-22  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * doc.c (Fsnarf_documentation): Set skip_file only if p[1] is S.
+
+2010-08-22  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * doc.c (Fsnarf_documentation): Initialize skip_file before
+       build-files test.
+
+2010-08-22  Peter O'Gorman  <pogma@thewrittenword.com>  (tiny change)
+
+       * s/hpux10-20.h (HAVE_TERMIOS, NO_TERMIO, ORDINARY_LINK):
+       New definitions.
+       (HAVE_TERMIO): Remove.
+
+2010-08-22  Eli Zaretskii  <eliz@gnu.org>
+
+       * deps.mk (sysdep.o, msdos.o): Depend on sysselect.h.
+
+       * sysselect.h [WINDOWSNT]: Don't define the FD_* and select stuff
+       for w32.
+
+       * s/ms-w32.h (HAVE_SYS_TIMEB_H): Don't #undef HAVE_SYS_SELECT_H,
+       it's done in nt/config.nt.
+
+       * makefile.w32-in ($(BLD)/sysdep.$(O)): Depend on sysselect.h.
+
+       * unexcoff.c (report_error, make_hdr, write_segment)
+       (copy_text_and_data, copy_sym, mark_x, adjust_lnnoptrs, unexec):
+       Convert argument lists and prototypes to ANSI C.
+       (make_hdr, write_segment): Remove unused variables.
+       (unexec): Remove commented-out line.  Initialize `new' to shut up
+       compiler warnings.
+
+2010-08-22  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       Simplify termio code.
+       All non-MSDOS non-WINDOWSNT platforms define HAVE_TERMIOS, so
+       HAVE_TERMIO code is obsolete.
+       Replace HAVE_TERMIOS conditionals with !DOS_NT.
+       * systty.h: Do not define HAVE_TCATTR.
+       Remove HAVE_TERMIO, HAVE_LTCHARS and HAVE_TCHARS code.
+       Do not define EMACS_HAVE_TTY_PGRP.  Only define
+       EMACS_GET_TTY_PGRP for !DOS_NT.
+       * sysdep.c: Include sysselect.h unconditionally.  Do not include
+       sys/ioctl.h and termios.h, systty.h does it.  Use
+       HAVE_SYS_UTSNAME_H instead of USG as an include guard.
+       (init_baud_rate): Remove HAVE_TERMIO code.
+       (child_setup_tty): Remove HAVE_TERMIO code.
+       (emacs_get_tty, emacs_set_tty): Remove HAVE_TERMIO, HAVE_TCHARS
+       and HAVE_LTCHARS code.  Use !DOS_NT instead of HAVE_TCATTR.
+       (new_ltchars, new_tchars): Remove, unused.
+       (init_sys_modes): Remove HAVE_TERMIO, HAVE_TCHARS and HAVE_LTCHARS
+       code.  Remove special casing for __mips__, it was a no-op.  Remove
+       HAVE_TCATTR conditional, it is implied by HAVE_TERMIOS.
+       (init_sys_modes): Remove HPUX special case.
+       * process.c: Include stdlib.h unconditionally.  Do not include
+       fcntl.h, systty.h does it.  Remove conditional code for
+       HAVE_SERIAL, it is always true.
+       (process_send_signal): Remove HAVE_TERMIOS conditional, it's
+       always true when SIGNALS_VIA_CHARACTERS is true.
+       (Fcontinue_process, Fprocess_send_eof): Simplify conditionals:
+       !WINDOWSNT means HAVE_TERMIOS.
+       (create_process): Remove HAVE_TERMIOS, it's inside a HAVE_PTYS
+       conditional, which is true for all HAVE_TERMIOS systems.
+       * keyboard.c (init_keyboard): Do not use HAVE_TERMIO, use !DOS_NT
+       instead of HAVE_TERMIOS.
+       * emacs.c (shut_down_emacs): Use !defined DOS_NT instead of
+       EMACS_HAVE_TTY_PGRP.
+       * callproc.c (child_setup): Move EMACS_SET_TTY_PGRP use to the
+       non-MSDOS, non-WINDOWSNT code, it's only defined for such systems
+       anyway.
+
+2010-08-21  Eli Zaretskii  <eliz@gnu.org>
+
+       * dispnew.c (buffer_posn_from_coords): Fix off-by-one error in
+       mirroring pixel positions.
+
+2010-08-20  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * alloc.c (malloc_sbrk_used, malloc_sbrk_unused): Remove,
+       write only.
+       (init_alloc_once): Remove writes to malloc_sbrk_unused, and
+       malloc_sbrk_used, nothing uses them.
+
+       * puresize.h: Remove code assuming PNTR_COMPARISON_TYPE is not
+       defined, unconditionally defined in lisp.h.
+
+       * term.c: Do not include <termios.h>, systty.h does it.
+
+       * s/unixware.h (HAVE_TCATTR):
+       * s/aix4-2.h (HAVE_TCATTR): Remove definitions, not needed.
+       systty.h defines it when HAVE_TERMIOS is defined.
+
+2010-08-20  Eli Zaretskii  <eliz@gnu.org>
+
+       * dispnew.c (buffer_posn_from_coords): Fix last change for text
+       terminals: add one-character offset for R2L lines.
+
+       * emacs.c <emacs_version>: Add a comment regarding
+       msdos/mainmake.v2's dependency on the syntax of this declaration.
+
+2010-08-20  Eli Zaretskii  <eliz@gnu.org>
+
+       * dispnew.c (buffer_posn_from_coords): Fix calculation of buffer
+       position for R2L lines by mirroring the pixel position wrt the
+       text are box.  Improve commentary.
+
+2010-08-20  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * image.c (imagemagick_clear_image): Remove debugging output.
+
+2010-08-19  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * cmds.c (Vself_insert_face, Vself_insert_face_command): Remove.
+       (Qpost_self_insert_hook, Vpost_self_insert_hook): New vars.
+       (internal_self_insert): Run Qpost_self_insert_hook rather than handle
+       self-insert-face.
+       (syms_of_cmds): Initialize the new vars.
+
+2010-08-19  Jason Rumney  <jasonr@gnu.org>
+
+       * w32menu.c (set_frame_menubar): Remove call to undefined function.
+
+       * w32fns.c (w32_wnd_proc): Don't check context before initializing.
+
+2010-08-19  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * nsselect.m (nxatoms_of_nsselect): Use "Selection" and "Secondary".
+
+2010-08-18  Eli Zaretskii  <eliz@gnu.org>
+
+       * xterm.c (x_draw_bar_cursor):
+       * w32term.c (x_draw_bar_cursor): If the character under cursor is
+       R2L, draw the bar cursor on its right rather than on its left.
+
+2010-08-18  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * eval.c (Fdefmacro): Only obey one declaration.
+
+       * casefiddle.c (casify_region): Setup gl_state.
+
+2010-08-18  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * nsterm.m (ns_define_frame_cursor): Call x_update_cursor (Bug#6868).
+
+2010-08-18  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * gtkutil.c (update_frame_tool_bar): Literal stings are const char*.
+
+2010-08-18  David De La Harpe Golden  <david@harpegolden.net>
+
+       * nsselect.m (QCLIPBOARD, NXPrimaryPboard): Define.
+       (symbol_to_nsstring): Map QCLIPBOARD => NSGeneralPboard,
+       QPRIMARY => NXPrimaryPboard.
+       (ns_string_to_symbol): NSGeneralPboard => QCLIPBOARD,
+       NXPrimaryPboard => QPRIMARY.
+       (nxatoms_of_nsselect): NXPrimaryPboard = PrimarySelection,
+       NXSecondaryPboard = SecondarySelection.
+       (syms_of_nsselect): Intern QCLIPBOARD (Bug#6677).
+
+2010-08-18  Joakim Verona  <joakim@verona.se>
+
+       * image.c: Add support for ImageMagick.  When HAVE_IMAGEMAGICK is
+       defined:
+       (imagemagick_image_p): New function to test for ImageMagic image.
+       (imagemagick_load): New function to load ImageMagick image.
+       (imagemagick_load_image): New function, helper for imagemagick_load.
+       (imagemagick-types): New function.
+       (Qimagemagick): New Lisp_object.
+       (imagemagick-render-type): New variable, decides which renderer to use.
+
+2010-08-17  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * gtkutil.c (update_frame_tool_bar): Don't assume TOOL_BAR_ITEM_LABEL
+       is a string.
+
+2010-08-17  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * nsfns.m (ns_frame_parm_handlers): Add a slot for the
+       x_set_tool_bar_position handler.
+
+2010-08-17  Eli Zaretskii  <eliz@gnu.org>
+
+       * w32fns.c <w32_frame_parm_handlers>: Add a slot for the
+       x_set_tool_bar_position handler, needed to support changes from
+       2010-07-29T16:49:59Z!jan.h.d@swipnet.se for positioning the tool bar.  (Bug#6796)
+
+2010-08-16  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * nsselect.m: include keyboard.h for QPRIMARY, remove its
+       declaration (Bug#6863).
+       (syms_of_nsselect): Don't intern QPRIMARY.
+
+       * xselect.c: Remove declaration of QPRIMARY (Bug#6864).
+
+       * keyboard.h (QPRIMARY): Declare (Bug#6864).
+
+2010-08-16  Chong Yidong  <cyd@stupidchicken.com>
+
+       * keyboard.c (command_loop_1): Avoid setting selection twice,
+       since it's done in deactivate-mark as well.
+       (Vselect_active_regions): Change default to t.  Replace `lazy'
+       with non-default value `only', meaning only set PRIMARY for
+       temporarily active regions.
+
+       * insdel.c (prepare_to_modify_buffer): Handle `only' value of
+       select-active-regions.
+
+2010-08-15  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * keyboard.c (parse_tool_bar_item): Put in a bad label if :label
+       isn't a string.
+
+2010-08-15  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * keyboard.c (parse_tool_bar_item): Avoid excessive use of strlen.
+
+2010-08-15  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * keyboard.c (parse_tool_bar_item): malloc buf.
+       Set TOOL_BAR_ITEM_LABEL to empty string if not set to
+       new_lbl (Bug#6855).
+
+2010-08-14  Eli Zaretskii  <eliz@gnu.org>
+
+       * xterm.c (x_draw_stretch_glyph_string):
+       * w32term.c (x_draw_stretch_glyph_string): In R2L rows, display
+       the cursor on the right edge of the stretch glyph.
+
+       * xdisp.c (window_box_right_offset, window_box_right):
+       Fix commentary.
+
+       * xdisp.c (Fcurrent_bidi_paragraph_direction): Fix paragraph
+       direction when point is inside a run of whitespace characters.
+
+       * bidi.c (bidi_at_paragraph_end): Remove obsolete comment.
+
+2010-08-14  Jason Rumney  <jasonr@gnu.org>
+
+       * keyboard.c (lispy_function_keys): Do not define VK_PACKET (bug#4836)
+
+2010-08-14  Chong Yidong  <cyd@stupidchicken.com>
+
+       * fns.c (Fmake_hash_table): Doc fix (Bug#6851).
+
+2010-08-13  Jason Rumney  <jasonr@gnu.org>
+
+       * w32menu.c (simple_dialog_show): Use unicode message box if available.
+       (MessageBoxW_Proc): New function typedef.
+       (unicode-message-box): New function pointer.
+       (globals_of_w32menu): Import it from user32.dll. (Bug#5629)
+
+2010-08-13  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * frame.h (Qtool_bar_position): Declare.
+
+       * xfns.c (Fx_create_frame): Call x_default_parameter for
+       Qtool_bar_position.
+
+2010-08-13  Eli Zaretskii  <eliz@gnu.org>
+
+       * unexcoff.c: Remove the parts used when "emacs" is not defined.
+       (report_error, report_error_1): Ditto.
+       (write_segment): Remove "#if 0" unused code.
+       (make_hdr): Remove code that was "#ifndef NO_REMAP" before
+       NO_REMAP was removed (in 2010-07-29T03:25:08Z!dann@ics.uci.edu).
+       (start_of_text): Remove unused function (was used only if NO_REMAP
+       was NOT defined).
+
+       * msdos.c (IT_set_face): Fix format string to match argument
+       types.
+       (IT_write_glyphs, IT_note_mode_line_highlight)
+       (IT_set_frame_parameters): Remove unused variables.
+       (x_set_menu_bar_lines): Declare set_menu_bar_lines.
+       (IT_set_terminal_modes): Disambiguate expression in if clause.
+       (Fmsdos_remember_default_colors): Return Qnil.
+       (IT_set_frame_parameters): Add parens to disambiguate boolean
+       expression for logging the cursor type to termscript.
+       (keyboard_layout_list, keypad_translate_map)
+       (grey_key_translate_map): Add braces in inner initializers.
+       (dos_rawgetc): Add parens in condition for mouse-3 button-press.
+       (dos_rawgetc): Remove unused label.
+       (XMenuActivate): Add braces to remove ambiguous `else'.
+       (dos_ttraw): Always return a value.
+       (spawnve): Declare.
+       (run_msdos_command): Cast 3rd arg of spawnve to "char **".
+
+       * dosfns.h (x_set_title): Declare.
+
+       * w16select.c (Fw16_set_clipboard_data, Fw16_get_clipboard_data):
+       Remove unused variables.
+
+       * dosfns.c (Fint86, Fdos_memget, Fdos_memput): Remove unused
+       variables.
+       (init_dosfns): Declare get_lim_data.
+       (system_process_attributes): Declare Fget_internal_run_time.
+
+       * xmenu.c (xmenu_show) [!USE_X_TOOLKIT && !USE_GTK]: Fix argument
+       list to be consistent with menu.h.
+
+       * w32menu.c (add_menu_item, name_is_separator): Shut up compiler
+       warnings due to mixing of "char *" and "const char *".
+
+2010-08-12  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       Introduce a new comment style "c" flag.
+       * syntax.c (SYNTAX_FLAGS_COMMENT_STYLEB)
+       (SYNTAX_FLAGS_COMMENT_STYLEC): New macros.
+       (SYNTAX_FLAGS_COMMENT_STYLE): Use them, add an argument.
+       (syntax_prefix_flag_p): New function.
+       (Fstring_to_syntax): Understand new "c" flag.
+       (Finternal_describe_syntax_value): Recognize new flag; use the
+       SYNTAX_FLAGS_* macros.
+       (scan_sexps_forward, Fparse_partial_sexp): Change representation of
+       comment style to accomodate the new styles.
+       (back_comment, forw_comment, Fforward_comment, scan_lists)
+       (scan_sexps_forward): Update code to obey the new comment style flag.
+
+       * syntax.h: Move SYNTAX_FLAGS_FOO() macros to syntax.c.
+
+       * casefiddle.c (casify_region): Use the new syntax_prefix_flag_p.
+
+2010-08-11  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * xfns.c (x_defined_color): If USE_GTK, call xg_check_special_colors
+       first.
+       (Fx_hide_tip): Check FRAME_LIVE_P (f) before calling xg_hide_tooltip.
+
+       * gtkutil.h (xg_check_special_colors): Declare.
+
+       * gtkutil.c (xg_check_special_colors, style_changed_cb): New functions.
+       (xg_create_frame_widgets): Connect theme name changes to
+       style_changed_cb.
+
+       * xterm.c (emacs_class): New char[] for EMACS_CLASS.
+       (xim_open_dpy, xim_initialize, xim_close_dpy): Use emacs_class.
+       (x_term_init): Use char[] display_opt and name_opt instead of
+       string literal. file is const char*.
+
+       * xsmfns.c (NOSPLASH_OPT): Change to char[].
+       (smc_save_yourself_CB): Do xstrdup on all ->type and ->name for
+       props.  Free them at the end.
+
+       * xselect.c (Fx_get_atom_name): Use char empty[] instead of literal "".
+
+       * xrdb.c (get_system_app): Make path const and use char *p for
+       non-const char.
+
+       * xmenu.c (Fx_popup_dialog): error_name is const char*.
+       (xmenu_show): error parameter is const char **. pane_string is const
+       char *.
+       (button_names): Is const char *.
+       (xdialog_show): error_name and pane_string is const.
+
+       * process.h (synch_process_death): Is const char*.
+
+       * w32menu.c (w32_menu_show):
+       * nsmenu.m (ns_menu_show): error parameter is const char **.
+
+       * menu.h (w32_menu_show, ns_menu_show, xmenu_show): error parameter
+       is const char **.
+
+       * menu.c (Fx_popup_menu): error_name is const.
+
+       * keyboard.h (_widget_value): Add defined USE_GTK.  Replace Boolean
+       with unsigned char and XtPointer with void *.
+
+       * gtkutil.h: Replace widget_value with struct _widget_value.
+       (enum button_type, struct _widget_value): Remove and use the one from
+       keyboard.h.
+
+       * gtkutil.c (get_utf8_string): Always return an allocated string.
+       Parameter is const.
+       (create_dialog, xg_create_one_menuitem, create_menus)
+       (xg_item_label_same_p, xg_update_menu_item): Free result from
+       get_utf8_string.
+       (xg_separator_p, xg_item_label_same_p): label is const.
+
+       * font.h (font_open_by_name): Make name const.
+
+       * font.c (font_open_by_name): Make name const.
+
+       * floatfns.c (matherr): Use a const char* variable for x->name.
+
+       * emacs.c (main): Pass char[] to putenv instead of literal.
+
+       * callproc.c (synch_process_death): Make const.
+       (Fcall_process): Make signame const.
+
+       * nsterm.h (parseKeyEquiv, addSubmenuWithTitle)
+       (addDisplayItemWithImage): Use const char*.
+
+       * nsmenu.m (parseKeyEquiv, addSubmenuWithTitle)
+       (addDisplayItemWithImage, update_frame_tool_bar): Use const char*.
+
+       * nsfont.m (ns_descriptor_to_entity): Use const char*.
+
+       * keyboard.h (_widget_value): name, value and key are const char*.
+
+       * unexmacosx.c (unexec_error): Use const char *.
+
+2010-08-09  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * font.h (font_parse_xlfd, font_parse_fcname, font_unparse_fcname)
+       (font_parse_name, font_open_by_name):
+       * font.c (font_parse_xlfd, font_parse_fcname, font_unparse_fcname)
+       (font_parse_name, font_open_by_name): Remove const.
+
+2010-08-09  Andreas Schwab  <schwab@linux-m68k.org>
+
+       Use autoconf determined WORDS_BIGENDIAN instead of hardcoded
+       definition.
+
+       * m/alpha.h: Don't define/undef WORDS_BIG_ENDIAN.
+       * m/amdx86-64.h: Likewise.
+       * m/arm.h: Likewise.
+       * m/hp800.h: Likewise.
+       * m/ia64.h: Likewise.
+       * m/ibmrs6000.h: Likewise.
+       * m/ibms390.h: Likewise.
+       * m/intel386.h: Likewise.
+       * m/iris4d.h: Likewise.
+       * m/m68k.h: Likewise.
+       * m/macppc.h: Likewise.
+       * m/mips.h: Likewise.
+       * m/sh3.h: Likewise.
+       * m/sparc.h: Likewise.
+       * m/template.h: Likewise.
+       * m/vax.h: Likewise.
+       * m/xtensa.h: Likewise.
+       * fringe.c (init_fringe_bitmap): Test WORDS_BIGENDIAN instead of
+       WORDS_BIG_ENDIAN.
+       * lisp.h: Likewise.
+       * md5.c: Likewise.
+       * sound.c (le2hl, le2hs, be2hl, be2hs): Likewise.
+
+2010-08-09  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       Use const char* instead of char*.
+       Reduce the number of warnings with -Wwrite-strings.
+       * xrdb.c (get_environ_db, get_system_name):
+       * unexelf.c (find_section):
+       * term.c (string_cost, string_cost_one_line, per_line_cost)
+       (get_named_tty, init_tty):
+       * sysdep.c (sys_subshell):
+       * sound.c (sound_perror, sound_warning, vox_open, vox_init)
+       (alsa_sound_perror, alsa_open, alsa_configure, alsa_init):
+       * search.c (Freplace_match):
+       * process.c (Fmake_network_process, send_process, init_process):
+       * lread.c (Fload, init_lread):
+       * keymap.c (Fdescribe_buffer_bindings, describe_map_tree):
+       * keyboard.c (parse_tool_bar_item, struct event_head):
+       * gtkutil.h (xg_get_font_name):
+       * gtkutil.c (get_dialog_title, create_dialog, xg_get_font_name)
+       (make_widget_for_menu_item, make_menu_item, create_menus)
+       (xg_make_tool_item):
+       * font.c (parse_matrix, font_parse_name):
+       * floatfns.c (rounding_driver, float_error_fn_name):
+       * filelock.c (get_boot_time_1, lock_file_1):
+       * fileio.c (barf_or_query_if_file_exists, check_writable):
+       * editfns.c (get_system_name, get_operating_system_release)
+       (Fencode_time, Fset_time_zone_rule):
+       * dispextern.h (string_cost, per_line_cost, get_named_tty, init_tty):
+       * buffer.c (defvar_per_buffer): Use const.
+
+2010-08-08  Kenichi Handa  <handa@m17n.org>
+
+       * charset.c: Include <stdlib.h>.
+       (struct charset_sort_data): New struct.
+       (charset_compare): New function.
+       (Fsort_charsets): New function.
+       (syms_of_charset): Declare Fsort_charsets as a Lisp function.
+
+       * coding.c (decode_coding_iso_2022): Fix checking of dimension
+       number in CTEXT extended segment.
+
+2010-08-08  Juanma Barranquero  <lekktu@gmail.com>
+
+       * w32fns.c (syms_of_w32fns) <x-max-tooltip-size>: Fix typo in docstring.
+       * xfns.c (syms_of_xfns) <x-max-tooltip-size>: Reflow docstring.
+
+2010-08-08  Juanma Barranquero  <lekktu@gmail.com>
+
+       * fns.c (Fsubstring_no_properties, Fnthcdr, Ffeaturep)
+       (Fhash_table_size): Fix typos in docstrings.
+       (Fmake_hash_table): Doc fix.
+
+2010-08-08  Juanma Barranquero  <lekktu@gmail.com>
+
+       * minibuf.c (syms_of_minibuf) <read-buffer-function>:
+       Doc fix (bug#5625).
+
+2010-08-08  Ken Brown  <kbrown@cornell.edu>
+
+       * dired.c (DIRENTRY_NONEMPTY) [cygwin]: Use d_ino instead of
+       the MSDOS definition.
+
+2010-08-08  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       Use const char* instead of char*.
+       * xterm.c (x_create_toolkit_scroll_bar):
+       * xfont.c (xfont_list_pattern):
+       * xfns.c (x_default_scroll_bar_color_parameter)
+       (xic_create_fontsetname, x_default_font_parameter)
+       (x_screen_planes):
+       * xdisp.c (c_string_pos, number_of_chars, reseat_to_string)
+       (store_mode_line_string, decode_mode_spec, display_string):
+       * menu.c (digest_single_submenu):
+       * keymap.h (initial_define_key, initial_define_lispy_key):
+       * keymap.c (initial_define_key, initial_define_lispy_key):
+       * image.c (image_error, image_keyword):
+       * gtkutil.h (xg_create_widget, xg_create_scroll_bar):
+       * gtkutil.c (xg_create_widget, xg_create_scroll_bar):
+       * ftfont.c (struct fc_charset_table, ftfont_spec_pattern)
+       (ftfont_list, ftfont_match):
+       * frame.c (frame_parm_table):
+       * font.h (font_intern_prop, font_parse_xlfd, font_parse_fcname)
+       (font_unparse_fcname, font_unparse_fcname, font_open_by_name)
+       (font_add_log, font_deferred_log):
+       * font.c (font_intern_prop, font_parse_xlfd, font_parse_fcname)
+       (font_unparse_fcname, font_unparse_fcname, font_open_by_name)
+       (font_add_log, font_deferred_log):
+       * emacs.c (argmatch):
+       * dispextern.h (struct it):
+       * coding.c (ENCODE_DESIGNATION):
+       * charset.c (define_charset_internal): Use const.
+
+       * s/freebsd.h (DECLARE_GETPWUID_WITH_UID_T): Remove, unused.
+
+       * xrdb.c: Remove include guard.
+       Remove DECLARE_GETPWUID_WITH_UID_T conditional it had no effect.
+       Remove #if 0 code.  Replace malloc->xmalloc, free->xfree,
+       realloc->xrealloc instead of using #defines.
+
+2010-08-08  Eli Zaretskii  <eliz@gnu.org>
+
+       * cmds.c (Fforward_line, Fbeginning_of_line, Fend_of_line):
+       * editfns.c (Fline_beginning_position, Fline_end_position):
+       State in the doc strings that start and end of line are in the
+       logical order.
+
+       * xdisp.c (display_line): Move the handling of overlay arrow after
+       the call to find_row_edges.  (Bug#6699)
+
+2010-08-07  Chong Yidong  <cyd@stupidchicken.com>
+
+       * keyboard.c (command_loop_1):
+       * insdel.c (prepare_to_modify_buffer): Don't call validate_region.
+
+2010-08-07  Chong Yidong  <cyd@stupidchicken.com>
+
+       * insdel.c (prepare_to_modify_buffer): Save active region text to
+       Vsaved_region_selection.
+
+       * xselect.c (QPRIMARY): Move to keyboard.c.
+
+       * keyboard.c (Vselect_active_regions): Move from simple.el.
+       (Vsaved_region_selection, Qx_set_selection, QPRIMARY, Qlazy): New vars.
+       (command_loop_1): Set window selection prior to deactivating the mark.
+
+2010-08-07  Juanma Barranquero  <lekktu@gmail.com>
+
+       * alloc.c (lisp_malloc):
+       * buffer.c (set_buffer_internal, set_buffer_internal_1):
+       * charset.h (emacs_mule_charset):
+       * dispextern.h (inhibit_free_realized_faces, redraw_frame)
+       (redraw_garbaged_frames, scroll_cost, update_frame, scrolling)
+       (bitch_at_user):
+       * lisp.h (Fcheck_coding_system, Fget_text_property)
+       (Qfunction, Qcompletion_ignore_case, QCwidth, QCsize):
+       Remove duplicate declarations.
+
+2010-08-06  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * process.c: Simplify include logic.
+
+       * keyboard.h (quit_char): Add declaration.
+       * process.h (QCport, QCspeed, QCprocess, QCbytesize, QCstopbits)
+       (QCparity, Qodd, Qeven, QCflowcontrol, Qhw, Qsw, QCsummary):
+       Add declarations.
+       * sysdep.c:
+       * w32.c: Remove the above declarations.
+
+       Remove extern declarations in .c files, .h files have them.
+       * xterm.c:
+       * xdisp.c:
+       * msdos.c:
+       * image.c:
+       * gtkutil.c:
+       * fileio.c:
+       * eval.c: Remove declarations.
+
+       * frame.c (frame_params): Make const.
+
+       * lisp.h (fatal_error_signal, emacs_root_dir): Add declaration.
+
+       * emacs.c (emacs_copyright, emacs_version): Make static.
+       (Vinitial_window_system, Vauto_save_list_file_name)
+       (Vinhibit_redisplay): Remove declarations.
+       (main): Remove HAVE_SHM code, unused.  Remove _I386 conditional
+       for AIX.
+
+       Use const for some arrays and functions.
+       * xterm.h (xg_set_icon_from_xpm_data):
+       * xfns.c (xg_set_icon_from_xpm_data):
+       * term.c (fkeys):
+       * keyboard.c (lispy_accent_keys, lispy_function_keys)
+       (lispy_multimedia_keys, lispy_kana_keys, iso_lispy_function_keys)
+       (lispy_drag_n_drop_names, scroll_bar_parts, modify_event_symbol)
+       (frame.c frame_parms):
+       * emacs-icon.h (gnu_xpm_bits):
+       * callint.c (callint_argfuns): Use const.
+
+2010-08-06  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * sysdep.c: Move include term.h last of includes (Bug#6812).
+
+2010-08-06  Eli Zaretskii  <eliz@gnu.org>
+
+       * dispnew.c (realloc_glyph_pool): Zero out newly allocated glyphs.
+
+       * msdos.c (IT_display_cursor): Log cursor position on termscript.
+
+       * .gdbinit (pgx): Display the avoid_cursor_p flag.
+
+2010-08-06  Juanma Barranquero  <lekktu@gmail.com>
+
+       * makefile.w32-in ($(BLD)/xdisp.$(O)): Update dependencies.
+
+2010-08-06  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * xterm.h (x_get_focus_frame): Declare.
+
+       * keyboard.h (poll_for_input_1): Unconditionally declare.
+
+       * nsterm.h (x_set_menu_bar_lines): Declare.
+
+       * window.c: Don't include menu.h, it depends on lots of other .h-files.
+
+       * xfaces.c (x_create_gc, x_free_gc): Convert to ANSI C prototypes.
+
+       * window.c: Include menu.h.
+
+       * unexmacosx.c (print_region_list, print_regions)
+       (build_region_list, find_emacs_zone_regions)
+       (unexec_regions_merge, read_load_commands, dump_it)
+       (unexec_init_emacs_zone): Convert to ANSI C prototypes.
+
+       * term.c: Check HAVE_SYS_IOCTL_H.
+
+       * sysdep.c: Check HAVE_TERM_H.
+
+       * process.c: Check HAVE_UTIL_H.  Include nsterm.h if HAVE_NS.
+
+       * nsterm.m (ns_init_paths, ns_alloc_autorelease_pool)
+       (ns_ring_bell, ns_defined_color, hide_hourglass)
+       (x_display_pixel_height, x_display_pixel_width, syms_of_nsterm):
+       Convert to ANSI C prototypes.
+       (x_set_window_size, ns_draw_fringe_bitmap, judge): Move declarations
+       before code.
+
+       * nsterm.h : Include sysselect.h.
+       (x_sync, x_get_focus_frame, x_set_mouse_position)
+       (x_set_mouse_pixel_position, x_make_frame_visible)
+       (x_make_frame_invisible, x_iconify_frame, x_char_width, x_char_height)
+       (x_pixel_width, x_pixel_height, x_set_frame_alpha, x_set_tool_bar_lines)
+       (x_activate_menubar, free_frame_menubar, ns_init_paths, ns_select)
+       (syms_of_nsterm, syms_of_nsfns, syms_of_nsmenu, syms_of_nsselect):
+       Declare.
+
+       * nsmenu.m (popup_activated, name_is_separator)
+       (syms_of_nsmenu): Convert to ANSI C prototypes.
+       (runMenuAt): Prototypes and move declarations before code.
+
+       * nsimage.m (ns_load_image): Move NSTRACE after declarations.
+
+       * nsfont.m (ns_fallback_entity, syms_of_nsfont): Convert to ANSI C
+       prototypes.
+
+       * nsfns.m (have_menus_p, ns_display_info_for_name)
+       (x_set_cursor_type, ns_appkit_version_str)
+       (ns_appkit_version_int, ns_do_applescript)
+       (x_set_scroll_bar_default_width, x_sync, compute_tip_xy)
+       (syms_of_nsfns): Convert to ANSI C prototypes.
+
+       * menu.h (x_set_menu_bar_line): Declare.
+       (free_menubar_widget_value_tree et.al): Add HAVE_NS for these functions.
+
+       * lisp.h (fmod_float): Declare.
+
+       * image.c (xpm_scan, xpm_make_color_table_v)
+       (xpm_put_color_table_v, xpm_get_color_table_v)
+       (xpm_make_color_table_h, xpm_put_color_table_h)
+       (xpm_get_color_table_h, xpm_str_to_color_key, xpm_load_image)
+       (xpm_load): Convert to ANSI C prototypes.
+
+       * emacs.c: Include nsterm.h if HAVE_NS.
+
+       * bidi.c (bidi_dump_cached_states): Fix fprintf warning.
+
+2010-08-06  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * process.c: Remove HAVE_SOCKETS #ifdefs inside #ifdef
+       subprocesses, only MSDOS does not define HAVE_SOCKETS.
+       (socket_options): Use const char* for name.
+
+2010-08-06  Juanma Barranquero  <lekktu@gmail.com>
+
+       Fix changes in 2010-08-05T23:15:24Z!dann@ics.uci.edu..2010-08-05T23:34:12Z!dann@ics.uci.edu for Windows build.
+
+       * xmenu.c [USE_X_TOOLKIT || USE_GTK]:
+       Don't declare xmalloc_widget_value and digest_single_submenu.
+
+       * w32font.c (Qlatin): Remove declaration.
+
+       * menu.h (xmalloc_widget_value, digest_single_submenu): Declare.
+
+       * dired.c (compile_pattern): Restore declaration.
+
+2010-08-05  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       Remove extern declarations in .c files, .h files have them.
+       * data.c:
+       * dired.c:
+       * editfns.c:
+       * filelock.c:
+       * fns.c:
+       * font.c:
+       * fontset.c:
+       * frame.c:
+       * fringe.c:
+       * ftfont.c:
+       * gtkutil.c:
+       * indent.c:
+       * keyboard.c:
+       * keymap.c:
+       * lread.c:
+       * menu.c:
+       * print.c:
+       * search.c:
+       * sound.c:
+       * window.c:
+       * xdisp.c:
+       * xfaces.c:
+       * xfns.c:
+       * xfont.c:
+       * xftfont.c:
+       * xmenu.c:
+       * xterm.c: Remove declarations.
+
+       Cleanup syssignal.h.
+       * syssignal.h (sighold, sigrelse, RETSIGTYPE): Remove, unused.
+       (main_thread): Move down to remove #ifdef.
+       (SIGMASKTYPE, SIGEMPTYMASK, SIGFULLMASK, sigmask, sigunblock):
+       Remove conditional definition following unconditional ones.
+
+       * lisp.h: Remove HAVE_SHM code, unused.
+       (QCmap, QCrehash_size, QCrehash_threshold, QCsize, QCtest)
+       (QCweakness, Qabove_handle, Qbackquote, Qbar, Qbelow_handle)
+       (Qborder, Qbottom, Qbox, Qcircular_list, Qcomma, Qcomma_at)
+       (Qcomma_dot, Qcursor, Qdefault, Qdown, Qend_scroll, Qeq, Qeql)
+       (Qequal, Qfile_exists_p, Qfont_param, Qfringe, Qfunction)
+       (Qfunction_documentation, Qhandle, Qhbar, Qheader_line, Qhollow)
+       (Qidentity, Qleft_margin, Qmenu, Qmenu_bar_update_hook)
+       (Qmode_line_inactive, Qmouse, Qoverriding_local_map)
+       (Qoverriding_terminal_local_map, Qratio, Qregion, Qright_margin)
+       (Qscroll_bar, Qtool_bar, Qtop, Qup, Qvertical_border, Qwhen)
+       (Qwindow_scroll_functions, Vafter_load_alist)
+       (Vauto_save_list_file_name, Vface_alternative_font_family_alist)
+       (Vface_alternative_font_registry_alist, Vface_font_rescale_alist)
+       (Vface_ignored_fonts, Vinhibit_redisplay, Vminibuffer_list)
+       (Vprint_length, Vprint_level, Vscalable_fonts_allowed)
+       (Vshell_file_name, Vsystem_name, Vwindow_scroll_functions)
+       (Vwindow_system_version, Vx_no_window_manager, initial_argc)
+       (initial_argv, last_nonmenu_event, load_in_progress)
+       (noninteractive_need_newline, scroll_margin): Add declarations.
+
+       * keyboard.h (xmalloc_widget_value, digest_single_submenu): Remove
+       declarations, menu.h has them.
+       (QCbutton, QCtoggle, QCradio, QClabel, extra_keyboard_modifiers)
+       (Vinput_method_function, Qinput_method_function)
+       (Qevent_symbol_element_mask, last_event_timestamp):
+       * dispextern.h (Voverflow_newline_into_fringe):
+       * font.h (QCantialias, Qp, syms_of_ftfont, syms_of_xfns)
+       (syms_of_ftxfont, syms_of_xftfont, syms_of_bdffont)
+       (syms_of_w32font, syms_of_nsfont):
+       * fontset.h (find_font_encoding, Qlatin):
+       * frame.h (Qtooltip, Qrun_hook_with_args, Vmenu_bar_mode)
+       (Vtool_bar_mode, set_frame_menubar):
+       * ftfont.h (ftfont_font_format, ftfont_get_fc_charset):
+       * xterm.h (Qx_gtk_map_stock):
+       * keymap.h (meta_prefix_char): Add declarations.
+
+       * term.c: Remove dead code.
+
+       Fix emacs -Q -f server-start & emacsclient -t on GNU/Linux.
+       * term.c (dissociate_if_controlling_tty): Use USG5 instead of
+       USG.  This is equivalent to defined (USG) && !defined (BSD_PGRPS),
+       which is what was there before BSD_PGRPS was removed.
+
+2010-08-05  Eli Zaretskii  <eliz@gnu.org>
+
+       * deps.mk (unexcoff.o): Rename unexec.[co] => unexcoff.[co].
+
+       * unexcoff.c: Renamed from unexec.c.
+
+2010-08-04  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * sysdep.c (child_setup_tty): Comment-out left-over non-ICANON code.
+
+2010-08-03  Johan Bockgård  <bojohan@gnu.org>
+
+       * data.c (Flocal_variable_p): Handle variable aliases correctly.
+       (Bug#6744)
+
+2010-08-02  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * xterm.c (x_create_toolkit_scroll_bar): Only set XtNbeNiceToColormap
+       to TRUE if depth of screen is < 16.
+
+       * gtkutil.c (hierarchy_ch_cb, qttip_cb): Do not define unless
+       USE_GTK_TOOLTIP.
+       (xg_prepare_tooltip): Return 0 unless USE_GTK_TOOLTIP.
+       (xg_show_tooltip, xg_hide_tooltip): Do nothing unless USE_GTK_TOOLTIP.
+       (xg_create_frame_widgets): Surround tooltip-related code with ifdef
+       USE_GTK_TOOLTIP.
+       (xg_free_frame_widgets): Don't delete ttip_* unless USE_GTK_TOOLTIP.
+
+       * xterm.h (USE_GTK_TOOLTIP): New define.
+       (struct x_output): Put ttip_* inside ifdef USE_GTK_TOOLTIP.
+
+       * sysdep.c (child_setup_tty): Enable ICANON in lflags and set VEOF
+       to Control-D (Bug#6771).
+
+2010-08-02  Juanma Barranquero  <lekktu@gmail.com>
+
+       * editfns.c (Fregion_beginning, Fregion_end): Doc fixes (bug#6493).
+       Wording by Drew Adams <drew.adams@oracle.com>.
+
+2010-08-01  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * xterm.h (struct x_output): Add ttip_widget, ttip_window and
+       ttip_lbl.
+
+       * xterm.c (x_clear_frame): Check FRAME_GTK_WIDGET (f) before
+       calling gtk_widget_queue_draw.
+       (x_free_frame_resources): Call xg_free_frame_widgets.
+
+       * xfns.c (x_gtk_use_system_tooltips): New variable.
+       (Fx_show_tip): If USE_GTK and x_gtk_use_system_tooltips, call
+       new gtkutil tooltip functions to show the tooltip.
+       (Fx_hide_tip): Call xg_hide_tooltip.
+       (syms_of_xfns): Defvar x-gtk-use-system-tooltips.
+
+       * gtkutil.h (xg_free_frame_widgets, xg_prepare_tooltip)
+       (xg_show_tooltip, xg_hide_tooltip): Declare.
+
+       * gtkutil.c (hierarchy_ch_cb, qttip_cb, xg_prepare_tooltip)
+       (xg_show_tooltip, xg_hide_tooltip, xg_free_frame_widgets):
+       New functions.
+       (xg_create_frame_widgets): Set ttip_* to 0.  Set a dummy tooltip
+       text so qttip_cb is called.  Connect query-tooltip to qttip_cb.
+       Remove code that is commented out.
+
+2010-08-01  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * keymap.c (Fdefine_key, Flookup_key): Say what event is invalid.
+
+2010-07-31  Chong Yidong  <cyd@stupidchicken.com>
+
+       * xselect.c (x_own_selection): Use list4.
+
+2010-07-30  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * buffer.c (Qwindow): Do not define, already defined in data.c.
+       (syms_of_buffer): Do not intern and staticpro Qwindow.  (Bug#6760)
+
+2010-07-29  Chad Brown  <yandros@mit.edu>
+
+       Replace tests for SYSV_SYSTEM_DIR with HAVE_DIRENT_H, set via autoconf.
+       * dired.c, sysdep.c: Test HAVE_DIRENT_H instead of SYSV_SYSTEM_DIR.
+       * config.in: Undef HAVE_DIRENT_H.
+       * s/aix4-2.h, s/bsd-common.h, s/cygwin.h, s/gnu-linux.h,
+       * s/msdos.h, s/usg5-4.h: Don't define SYSV_SYSTEM_DIR.
+
+2010-07-29  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       Rename s/usg5-4.h -> s/usg5-4-common.h.
+       * s/usg5-4.h: Rename file to ...
+       * s/usg5-4-common.h: ... this for consistency with what we do for BSD.
+       * s/unixware.h:
+       * s/sol2-6.h:
+       * s/irix6-5.h: Update includes accordingly.
+
+2010-07-29  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * xfns.c (x_set_tool_bar_position): Remove debug fprintf.
+
+       * xterm.h (struct x_output): Add toolbar_top_height,
+       toolbar_bottom_height, toolbar_left_width, toolbar_right_width.
+       Remove toolbar_height.
+       If USE_GTK: Add hbox_widget and toolbar_in_hbox.
+       (FRAME_TOOLBAR_TOP_HEIGHT, FRAME_TOOLBAR_BOTTOM_HEIGHT)
+       (FRAME_TOOLBAR_LEFT_WIDTH, FRAME_TOOLBAR_RIGHT_WIDTH): New macros.
+       (FRAME_TOOLBAR_HEIGHT): Is now TOP_HEIGHT + BOTTOM_HEIGHT.
+
+       * xterm.c (x_set_window_size_1): Add FRAME_TOOLBAR_WIDTH to pixelwidth.
+
+       * xfns.c (x_set_tool_bar_position): New function.
+       (xic_set_statusarea): Use FRAME_TOOLBAR_TOP_HEIGHT.
+       (x_frame_parm_handlers): Add x_set_tool_bar_position.
+       (syms_of_xfns): If USE_GTK, provide move-toolbar.
+
+       * window.c (calc_absolute_offset): Check for FRAME_TOOLBAR_TOP_HEIGHT
+       and FRAME_TOOLBAR_LEFT_WIDTH.
+
+       * gtkutil.h (xg_change_toolbar_position): Declare.
+
+       * gtkutil.c (FRAME_TOTAL_PIXEL_WIDTH): New macro.
+       (xg_frame_set_char_size): Add FRAME_TOOLBAR_WIDTH to pixelwidth.
+       (xg_height_or_width_changed): Use FRAME_TOTAL_PIXEL_WIDTH.
+       (xg_create_frame_widgets): Create a hobox for placing widgets
+       vertically.  Use gtk_box_pack_start.
+       (xg_height_or_width_changed): Renamed from xg_height_changed.
+       (x_wm_set_size_hint): Add FRAME_TOOLBAR_WIDTH to base_width.
+       (xg_update_frame_menubar, free_frame_menubar): Change to
+       xg_height_or_width_changed.
+       (xg_tool_bar_detach_callback): Update left/right/top/bottom tool bar
+       size correctly.  Remove hardcoded 4, instead use handlebox size -
+       toolbar size.
+       (xg_tool_bar_attach_callback): Update left/right/top/bottom tool bar
+       size correctly.  Use handlebox size + toolbar size as additional size.
+       (xg_pack_tool_bar): POS is a new parameter.
+       Set orientation of tool bar based on pos.
+       Only make handlebox_widget if NULL.
+       Check if tool bar goes to vbox or hbox depending on pos.
+       (xg_update_tool_bar_sizes): New function.
+       (update_frame_tool_bar): Remove old_req, new_req.  Do not get tool bar
+       height, call xg_update_tool_bar_sizes instead.
+       (free_frame_tool_bar): Remove from hbox or vbox depending on
+       toolbar_in_hbox,  Set all FRAME_TOOLBAR_*_(WIDTH|HEIGHT) to zero.
+       (xg_change_toolbar_position): New function.
+
+       * frame.h (struct frame): Add tool_bar_position.
+       (Qbottom): Declare.
+
+       * frame.c (Qtool_bar_position): New variable.
+       (make_frame): Set tool_bar_position to Qtop.
+       (frame_parms): Add tool-bar-position.
+       (x_report_frame_params): Store tool_bar_position.
+       (x_set_fringe_width): Reset wm size hint after fringe changes.
+
+2010-07-29  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       Make lisp_time_argument declaration work on all systems.
+       * lisp.h (lisp_time_argument): Move declaration ...
+       * systime.h (lisp_time_argument): ... here
+       * editfns.c (lisp_time_argument): Remove declaration.  (Bug#6751)
+
+2010-07-29  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * vm-limit.c (POINTER): Add typedef for it.
+       (start_of_data): Change return type from POINTER to char *.
+
+       * frame.h (Qtty_color_mode): Move declaration out of ifdef
+       HAVE_WINDOW_SYSTEM.
+
+2010-07-29  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * vm-limit.c: Do not include sys/resource.h, mem-limits.h does it.
+       Remove reference to __osf__, unused.
+
+       * mem-limits.h: Remove duplicated includes.
+       (NULL): Remove definition, unused.
+       (POINTER): Remove definition.
+       (start_of_data): Use char* in prototype, as the function
+       definition does.
+
+       Remove extern declarations from .c files, and them to .h files.
+       * keyboard.h (Qhelp_echo, waiting_for_input)
+       (input_available_clear_time, ignore_mouse_drag_p)
+       (Vdouble_click_time, real_this_command, Vthis_original_command):
+       * keymap.h (Qremap, Qmenu_item, Voverriding_local_map)
+       (Voverriding_local_map_menu_flag):
+       * lisp.h (Qinteractive_form, use_file_dialog)
+       (Qcursor_in_echo_area, QCascent, QCmargin, QCrelief, Qcount)
+       (Qextension_data, QCconversion, QCcolor_symbols, QCheuristic_mask)
+       (QCindex, QCmatrix, QCcolor_adjustment, QCmask)
+       (Qrisky_local_variable, map_char_table_for_charset, Vprint_level)
+       (Qfunction, debug_on_next_call, Qfield)
+       (Vinhibit_field_text_motion, Vuser_login_name, lisp_time_argument)
+       (Qpriority, Qwindow, Qevaporate, Qbefore_string, Qafter_string)
+       (Qfile_directory_p, Qinsert_file_contents)
+       (Qcompletion_ignore_case, Qcompletion_ignore_case)
+       (Vcompletion_regexp_list, Vhistory_length, completion_ignore_case)
+       (history_delete_duplicates, minibuffer_auto_raise, Qonly)
+       (Qfile_name_handler_alist, Qfront_sticky, Qrear_nonsticky)
+       (Qminibuffer_prompt)
+       (Vtemporary_file_directory,char_ins_del_vector, Qface):
+       * xterm.h (gray_bitmap_width, gray_bitmap_height)
+       (gray_bitmap_bits, xic_create_fontsetname):
+       * coding.h (Vtranslation_table_for_input): Add extern declarations.
+
+       * xsmfns.c (Vuser_login_name):
+       * xrdb.c (Vdouble_click_time):
+       * xfaces.c (xic_create_fontsetname):
+       * w32select.c (waiting_for_input):
+       * print.c (minibuffer_auto_raise):
+       * msdos.c (Qhelp_echo):
+       * macros.c (real_this_command):
+       * keymap.c (Voverriding_local_map):
+       * xterm.c (poll_for_input_1, gray_bitmap_width)
+       (gray_bitmap_height, gray_bitmap_bits;
+       * xmenu.c ( Voverriding_local_map)
+       (Voverriding_local_map_menu_flag; Qmenu_item; use_dialog_box)
+       (use_file_dialog, Xt_app_con):
+       * xdisp.c (minibuffer_auto_raise, Voverriding_local_map)
+       (Voverriding_local_map_menu_flag, Qmenu_item, Qface, Qinvisible)
+       (Qwidth, Qinvisible, Qwindow, Qpriority, Qtool_bar_lines)
+       (Qtool_bar_lines, ignore_mouse_drag_p):
+       * minibuf.c (Voverriding_local_map, Qfield, Qfront_sticky)
+       (Qrear_nonsticky, nconc2):
+       * keyboard.c (current_global_map, minibuf_level, Qmenu_item)
+       (Vhistory_length, Vtranslation_table_for_input, Qcomposition)
+       (Qdisplay, Qafter_string, Qbefore_string, Qundefined):
+       * fileio.c (use_dialog_box, use_file_dialog, Vuser_login_name)
+       (minibuf_level, minibuffer_auto_raise, lisp_time_argument):
+       * eval.c (Qinteractive_form, Qrisky_local_variable, Qfunction)
+       (gc_in_progress):
+       * doc.c (Voverriding_local_map, Qremap):
+       * dired.c (completion_ignore_case, Qcompletion_ignore_case)
+       (Vcompletion_regexp_list):
+       * coding.c (Qmac, Qinsert_file_contents, Qwrite_region)
+       (Qcompletion_ignore_case):
+       * callint.c (Qcursor_in_echo_area, Qfile_directory_p, Qonly)
+       (Vhistory_length, Vthis_original_command, real_this_command)
+       (Qface, Qminibuffer_prompt, history_delete_duplicates):
+       * image.c (Qrisky_local_variable):
+       * fontset.c (QCname):
+       * fns.c (minibuffer_auto_raise, QCname):
+       * dispnew.c (char_ins_del_cost):
+       * composite.c (font_fill_lglyph_metrics):
+       * cmds.c (Qface, Vtranslation_table_for_input):
+       * charset.c (map_char_table_for_charset, Qfile_name_handler_alist):
+       * ccl.c (charset_unicode):
+       * callproc.c (Vtemporary_file_directory):
+       * buffer.c (emacs_strerror): Remove extern declarations.
+
+       * data.c (Qwindow): Make non-static, used from other files too.
+       * frame.c (validate_x_resource_name): Remove shadow definition for i.
+
+       * unexec.c (make_hdr): Remove references to NO_REMAP, COFF,
+       SEGMENT_MASK, SECTION_ALIGNMENT, ADJUST_EXEC_HEADER.
+       * s/usg5-4.h (COFF):
+       * s/template.h:
+       * s/msdos.h (COFF, NO_REMAP):
+       * s/ms-w32.h (NO_REMAP):
+       * s/hpux10-20.h (NO_REMAP):
+       * m/sparc.h (SEGMENT_MASK):
+       * m/m68k.h (NO_REMAP):
+       * m/intel386.h (SEGMENT_MASK):
+       * m/arm.h (NO_REMAP):
+       * m/alpha.h (COFF):
+       * m/template.h: Remove references to unused defines.
+
+2010-07-28  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * xsettings.c (Ftool_bar_get_system_style): Also check for
+       Qtext_image_horiz.
+
+       * xdisp.c (Qtext_image_horiz): Define.
+       (syms_of_xdisp): Initialize Qtext_image_horiz.  Add text-image-horiz
+       to documentation of tool-bar-style.
+
+       * lisp.h (Qtext_image_horiz): Declare.
+
+       * gtkutil.c (xg_make_tool_item, xg_show_toolbar_item): Handle tool bar
+       style text_image_horiz.
+
+2010-07-27  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * emacs.c (Fkill_emacs): Remove return statement.
+
+       * term.c (Qspace, QCalign_to, QCwidth): Remove declarations.
+       (encode_terminal_code, produce_composite_glyph): Remove unused variables.
+       (set_tty_color_mode, term_mouse_highlight, term_get_fkeys): Remove
+       local extern declarations.
+
+       * xmenu.c: Do not included lwlib.h, not needed.
+
+       * m/iris4d.h (XUINT, XSET): Remove, not needed.
+
+       * process.c: Move definitions earlier to minimize #ifdefs.
+
+       * xterm.h (x_get_customization_string, x_load_resources)
+       (x_get_resource, x_text_icon, x_text_icon, x_check_errors)
+       (x_check_errors, x_property_data_to_lisp, defined_color)
+       (xic_set_xfontset, x_defined_color): Use const.
+
+       * xterm.c (xlwmenu_window_p, xlwmenu_redisplay): Remove declarations.
+       (x_text_icon, x_check_errors, x_connection_closed): Use const.
+
+       * xselect.c (selection_data_to_lisp_data)
+       (x_property_data_to_lisp):
+       * xrdb.c (x_get_string_resource, file_p)
+       (x_get_customization_string, magic_file_p, search_magic_path)
+       (get_system_app, get_user_app, x_load_resources, x_get_resource)
+       (x_get_string_resource): Use const.
+
+       * xfns.c: Include xlwmenu.h when USE_LUCID.
+       (x_defined_color, xic_set_xfontset): Use const.
+       (Fx_hide_tip): Remove local extern declaration.
+
+       * xfaces.c (Qmouse_face): Remove declaration.
+       (face_color_gray_p, tty_defined_color, defined_color)
+       (face_color_gray_p, face_color_supported_p): Add const.
+
+       * xdisp.c (do_mouse_tracking): Remove declaration.
+       (add_to_log): Use const.
+
+       * minibuf.c (Qmouse_face): Remove declaration.
+
+       * msdos.c (IT_note_mouse_highlight): Remove local extern declaration.
+
+       * keyboard.h (do_mouse_tracking): Add declaration.
+
+       * image.c (QCwidth, QCheight, QCforeground, QCbackground, QCfile)
+       (QCdata, QCtype, Qcenter): Remove declarations.
+
+       * frame.c (x_get_resource_string, x_get_string_resource)
+       (x_get_arg, x_frame_get_arg, x_frame_get_and_record_arg)
+       (x_default_parameter): Use const.
+
+       * font.c (Qnormal, QCtype, QCfamily, QCweight, QCslant, QCwidth)
+       (QCheight, QCsize, QCname): Remove declarations.
+
+       * emacs.c (main): Remove local extern declaration.
+
+       * editfns.c (region_limit, syms_of_editfns): Remove local extern
+       declarations.
+
+       * dispnew.c: Remove duplicate #include <unistd.h>.
+       (update_window, update_frame_1, init_display): Remove local extern
+       declarations.
+
+       * dispextern.h (add_to_log): Remove declaration.
+       (x_get_arg, x_frame_get_arg, x_frame_get_and_record_arg)
+       (x_frame_get_and_record_arg, x_default_parameter): Add const.
+
+       * dired.c (scmp): Add const.
+       (directory_files_internal): Remove local extern declaration.
+
+       * data.c (Finteractive_form): Use const.
+
+       * composite.c (syms_of_composite): Remove local extern declarations.
+
+       * charset.c (add_to_log): Remove declaration.
+
+       * character.c (strwidth, parse_str_to_multibyte): Add const.
+
+       * character.h (strwidth, parse_str_to_multibyte): Likewise.
+
+       * buffer.c (Fset_buffer_multibyte): Remove local extern declaration.
+
+       * lisp.h (Fkill_emacs): Mark as NO_RETURN.
+       (Lisp_Subr): Make doc and intspec constant.
+       (QCsize, Qspace, Qcenter, QCalign_to, QCdata, QCfile, QCtype)
+       (Qlocal, Qapply, Qnormal, QCfamily, QCweight, QCslant, QCwidth)
+       (QCheight, QCsize, QCname, QCwidth, QCforeground)
+       (QCbackground, add_to_log, stack_base, Vmark_even_if_inactive)
+       (display_arg): Add declarations.
+
+2010-07-27  Christoph Scholtes  <cschol2112@gmail.com>
+
+       * minibuf.c (Fread_buffer): Doc fix (bug#6528).
+
+       * window.c (Fwindow_height): Doc fix (bug#6518).
+
+2010-07-27  Juanma Barranquero  <lekktu@gmail.com>
+
+       * buffer.c (syms_of_buffer) <fringe-indicator-alist>: Doc fix.
+
+2010-07-26  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * keyboard.c (Ftop_level, Fexit_recursive_edit)
+       (Fabort_recursive_edit): Remove return statements in NO_RETURN
+       functions.
+
+       * frame.h (Qtty_color_mode): Add declaration.
+
+       * lisp.h (Ftop_level, Fexit_recursive_edit)
+       (Fabort_recursive_edit): Mark as NO_RETURN.
+
+2010-07-26  Kenichi Handa  <handa@m17n.org>
+
+       * font.c (Ffont_shape_gstring): Terminate GSTRING by nil if the
+       number of glyphs gets smaller than the original length.  (Bug#6621)
+
+2010-07-26  Juanma Barranquero  <lekktu@gmail.com>
+
+       * lread.c (unreadpure, mapatoms_1): Make static.
+
+2010-07-25  Juanma Barranquero  <lekktu@gmail.com>
+
+       * terminfo.c (tparam): Fix prototype of tparm.
+
+2010-07-25  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * emacs.c (main) [PROFILING]: Use __executable_start if defined to
+       find start of text segment.
+       * dispnew.c (safe_bcopy): Don't define if HAVE___EXECUTABLE_START
+       is defined.
+
+       * callproc.c (set_initial_environment): Avoid unbalanced braces.
+
+2010-07-25  Ken Brown  <kbrown@cornell.edu>
+
+       * vm-limit.c (check_memory_limits): Fix previous change;
+       accidentally reverted an earlier change.
+
+2010-07-25  Ken Brown  <kbrown@cornell.edu>
+
+       * mem-limits.h (BSD4_2) [cygwin]: Don't define here; instead...
+       * vm-limit.c: ...add 'defined (CYGWIN)' here (Bug#6715).
+
+2010-07-25  Juanma Barranquero  <lekktu@gmail.com>
+
+       * callproc.c (relocate_fd): Set inside #ifndef WINDOWSNT.
+       * dired.c (opendir, readdir): Fix prototypes.
+       * editfns.c (w32_get_internal_run_time): Fix prototypes.
+       * keyboard.c (input_available_signal): Declare inside #ifdef SIGIO.
+       * ndir.h (opendir, readdir, seekdir, closedir): Fix prototypes.
+       (telldir): Remove declaration.
+       * ralloc.c (real_morecore, __morecore): Fix prototypes.
+       * sound.c (alsa_sound_perror): Declare inside #ifdef HAVE_ALSA.
+       * syssignal.h (strsignal): Fix prototype.
+       * term.c (tparam): Fix prototype.
+       (term_get_fkeys_address, term_get_fkeys_kboard, term_get_fkeys_1)
+       (term_get_fkeys): Set inside "#ifndef DOS_NT".
+       * vm-limit.c (check_memory_limits): Fix prototypes of real_morecore
+       and __morecore.
+       * w32gui.h (XParseGeometry): Fix prototype.
+       * w32heap.h (get_data_start, get_data_end, init_heap): Fix prototypes.
+       * w32term.c (my_set_focus): Declare inside #if 0.
+       * w32term.h (x_window_to_frame, x_display_info_for_name, w32_term_init)
+       (w32_fill_rect, w32_clear_window, init_crit, delete_crit, signal_quit)
+       (drain_message_queue, get_next_msg, post_msg, parse_button)
+       (ClipboardSequence_Proc): Fix prototypes.
+       (wait_for_sync): Remove declaration.
+
+2010-07-24  Juanma Barranquero  <lekktu@gmail.com>
+
+       * w32fns.c (w32_to_x_color): Remove, unused.
+
+2010-07-24  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * lisp.h: Remove leftover P_.
+
+2010-07-24  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * ecrt0.c, unexalpha.c: Remove files, unused.
+
+2010-07-24  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * cmds.c (internal_self_insert): Make static.
+       * lisp.h (internal_self_insert): Remove declaration.
+
+2010-07-23  Juanma Barranquero  <lekktu@gmail.com>
+
+       * alloc.c (free_float):
+       * font.c [ENABLE_CHECKING] (font_match_xlfd, font_check_xlfd_parse):
+       * frame.c (delete_frame_handler):
+       * ralloc.c (reorder_bloc):
+       * w32menu.c (menubar_id_to_frame, add_left_right_boundary):
+       Remove unused static functions.
+
+       * menu.c (cleanup_popup_menu): Set inside "#ifdef HAVE_NS";
+       it is called only from NS code.
+
+       * w32term.c (my_set_focus): #ifdef away; it is called only from
+       "#ifdef 0" code.
+
+       * w32fns.c (x_edge_detection):
+       * xfaces.c (may_use_scalable_font_p):
+       Remove obsolete static declarations.
+
+2010-07-20  Juanma Barranquero  <lekktu@gmail.com>
+
+       * alloc.c (emacs_blocked_free, emacs_blocked_malloc)
+       (emacs_blocked_realloc, uninterrupt_malloc):
+       * fringe.c (w32_reset_fringes):
+       * image.c (convert_mono_to_color_image, lookup_rgb_color)
+       (init_color_table, XPutPixel, jpeg_resync_to_restart_wrapper):
+       * sound.c (be2hs, do_play_sound):
+       * vm-limit.c (get_lim_data, ret_lim_data):
+       * w32term.c (x_free_frame_resources):
+       * xfaces.c (x_create_gc, x_free_gc):
+       Convert definitions to standard C.
+
+2010-07-20  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * eval.c (Feval, Ffuncall): Use the new names.
+
+       * lisp.h (struct Lisp_Subr): Rename `am' to aMANY and add aUNEVALLED.
+       (DEFUN): Add braces around the union initialisation and use ## to
+       specify the right union alternative and avoid a cast.
+
+2010-07-18  Juanma Barranquero  <lekktu@gmail.com>
+
+       * makefile.w32-in ($(BLD)/keyboard.$(O)): Update dependencies.
+
+2010-07-17  Chong Yidong  <cyd@stupidchicken.com>
+
+       * frame.c (make_initial_frame): Use set_menu_bar_lines (Bug#6660).
+
+2010-07-17  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * gtkutil.c (xg_event_is_for_menubar): Also check that event window
+       is related to the menu bar (Bug#6499).
+       (xg_frame_resized): GTK_IS_MAPPED => gtk_widget_get_mapped, for Gtk 3.0.
+
+2010-07-16  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * xterm.h (x_menubar_window_to_frame): Second parameter is XEvent*.
+
+       * xterm.c (handle_one_xevent): Pass event to x_menubar_window_to_frame.
+
+       * xmenu.c (x_activate_menubar): Revert previous fix for Bug#6499,
+       i.e. don't put back ButtonRelease (Bug#6608).
+
+       * xfns.c (x_menubar_window_to_frame): Take XEvent as second parameter
+       instead of Window.  Call xg_event_is_for_menubar when
+       USE_GTK (Bug#6499).
+
+       * gtkutil.h (xg_event_is_for_menubar): Declare.
+
+       * gtkutil.c (xg_event_is_for_menubar): New function (Bug#6499).
+
+2010-07-16  Eli Zaretskii  <eliz@gnu.org>
+
+       * w32fns.c (x_set_foreground_color): Fix setting the cursor color
+       when it's the same as the old foreground.  (Bug#6609)
+
+2010-07-16  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * xmenu.c (free_frame_menubar): Only call x_set_window_size if
+       widget is non-null (Bug#6645).
+
+2010-07-15  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * xterm.c (x_fully_uncatch_errors, x_trace_wire, x_check_font):
+       Convert old-style definition.
+
+       * xmenu.c (create_and_show_popup_menu, xmenu_show): Fix type of
+       timestamp argument.
+
+2010-07-15  Eli Zaretskii  <eliz@gnu.org>
+
+       * fringe.c (update_window_fringes): Restore mistakenly reverted
+       code from 2010-04-17T12:33:05Z!eliz@gnu.org merged in 2010-04-20T13:31:28Z!eliz@gnu.org.
+
+2010-07-14  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * xterm.c (xm_scroll_callback, x_process_timeouts): K&R => prototype.
+       (SET_SAVED_KEY_EVENT): Remove (not used).
+       (SET_SAVED_MENU_EVENT): Rename to SET_SAVED_BUTTON_EVENT and
+       remove size parameter.
+       (handle_one_xevent): Check popup_activated () for menu for Xt also.
+       Remove #ifdef USE_GTK around finish = X_EVENT_DROP.
+       Remove #ifdef USE_MOTIF code that did SET_SAVED_BUTTON_EVENT for
+       ButtonRelease.
+       (x_set_window_size_1): scroll_bar_actual_width is always
+       SCROLL_BAR_COLS * COLUMN_WIDTH for the purpose of frame sizing.
+
+       * xdisp.c (pending_menu_activation): Remove extern declaration.
+       (prepare_menu_bars): Remove setting of pending_menu_activation.
+
+       * xmenu.c (pending_menu_activation): Remove.
+       (x_activate_menubar): Set popup_activated_flag for Xt also.
+       Remove setting of pending_menu_activation.
+       (set_frame_menubar): Remove check of pending_menu_activation.
+       Declare menubar_size before code.  Correct spelling in comment.
+
+2010-07-14  Kenichi Handa  <handa@m17n.org>
+
+       * font.c (font_open_entity): Cancel previous change.
+       (Ffont_get): Don't check FONT_ENTITY_INDEX of a font-object.
+
+2010-07-13  Eli Zaretskii  <eliz@gnu.org>
+
+       Remove subprocesses #ifdefs.
+       * process.c <inhibit_sentinels>: Move to the common part.
+       (Fwaiting_for_user_input_p): Move to the common part; return nil
+       if async subprocesses aren't supported.
+       * sysdep.c (wait_for_termination) [!MSDOS]: Don't compile on
+       MS-DOS.  Remove "#ifdef subprocesses".
+       (sys_subshell, sys_select): Remove "#ifdef subprocesses".
+       (gettimeofday): Remove "#ifdef subprocesses".
+       (wait_without_blocking): Remove function.
+       (flush_pending_output, child_setup_tty): Don't compile on MS-DOS.
+       Remove "#ifdef subprocesses".
+       (child_setup_tty): Use WINDOWSNT instead of DOS_NT, since not
+       compiled on MS-DOS.
+       * callproc.c (Fcall_process) [!MSDOS]: Don't call
+       wait_for_termination on MS-DOS.
+       * emacs.c (shut_down_emacs): Remove "#ifndef subprocesses" from
+       initialization of inhibit_sentinels.
+       * keyboard.c (record_asynch_buffer_change): Remove "#ifdef
+       subprocesses" conditional.
+       * callproc.c (Fcall_process) [!subprocesses]: Don't call
+       wait_for_termination, since `buffer' cannot be an integer when
+       async subprocesses are not supported
+       * xdisp.c (decode_mode_spec): Use `MSDOS' instead of `subprocesses'
+       for ifdefing away the call to Fprocess_status.
+
+       * process.c (add_keyboard_wait_descriptor) [!subprocesses]: Ifdef
+       away the entire body of the function.
+
+2010-07-13  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       Remove subprocesses #ifdefs from term.c.
+       * process.c (add_keyboard_wait_descriptor)
+       (delete_keyboard_wait_descriptor): Move to common section, do
+       nothing when subprocesses is not defined.
+       * term.c (Fsuspend_tty, Fresume_tty, init_tty):
+       Remove subprocesses #ifdefs.
+
+       Convert maybe_fatal to standard C.
+       * lisp.h (verror): Declare.
+       * eval.c (verror): New function containing the code from ...
+       (error): ... this.  Call verror.
+       * term.c (vfatal): New function containing the code from ...
+       (fatal): ... this.  Call vfatal.
+       (maybe_fatal): Convert to standard C, use variable number of
+       arguments.  Declare as non-return.
+       (init_tty): Fix maybe_fatal call.
+
+2010-07-12  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * xterm.c (x_scroll_bar_set_handle, x_scroll_bar_expose)
+       (_scroll_bar_note_movement): Convert definitions to standard C.
+       * xmenu.c (menu_help_callback, pop_down_menu, xmenu_show):
+       * xfns.c (hack_wm_protocols, x_window, x_window): Likewise.
+
+2010-07-12  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * xterm.c (x_frame_of_widget, x_alloc_nearest_color_for_widget)
+       (x_alloc_lighter_color_for_widget, cvt_string_to_pixel)
+       (cvt_pixel_dtor, x_window_to_menu_bar, xt_action_hook)
+       (xaw_jump_callback, xaw_scroll_callback)
+       (x_create_toolkit_scroll_bar, x_set_toolkit_scroll_bar_thumb)
+       (x_wm_set_size_hint, x_activate_timeout_atimer): Convert
+       definitions to standard C.
+       * xmenu.c (menubar_id_to_frame, popup_get_selection)
+       (popup_activate_callback, popup_deactivate_callback)
+       (menu_highlight_callback, menubar_selection_callback)
+       (apply_systemfont_to_dialog, apply_systemfont_to_menu)
+       (free_frame_menubar, popup_selection_callback, as)
+       (create_and_show_popup_menu, dialog_selection_callback)
+       (create_and_show_dialog):
+       * xfns.c (hack_wm_protocols, x_window):
+       * xfaces.c (x_update_menu_appearance):
+       * widget.c (get_default_char_pixel_size, pixel_to_char_size)
+       (char_to_pixel_size, round_size_to_char, get_wm_shell)
+       (set_frame_size, update_wm_hints, setup_frame_gcs)
+       (update_various_frame_slots, update_from_various_frame_slots)
+       (EmacsFrameInitialize, EmacsFrameRealize, EmacsFrameResize)
+       (EmacsFrameSetValues, EmacsFrameQueryGeometry)
+       (EmacsFrameSetCharSize, widget_store_internal_border): Likewise.
+
+2010-07-12  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * dbusbind.c (xd_initialize): Don't compare boolean with a constant.
+
+2010-07-12  Eli Zaretskii  <eliz@gnu.org>
+
+       * process.c (setup_process_coding_systems): Move to the part
+       shared by non-subprocesses systems, and make its body empty when
+       subprocesses is not defined.
+       (close_process_descs): Move to the part shared by non-subprocesses
+       systems.
+       (wait_reading_process_output) [!subprocesses]: Convert arg list to
+       ANSI C.
+
+2010-07-12  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * editfns.c (transpose_markers): Convert old-style definition.
+       * emacs.c (abort, shut_down_emacs, fixup_locale)
+       (synchronize_system_time_locale)
+       (synchronize_system_messages_locale, syms_of_emacs): Likewise.
+       * floatfns.c (extract_float, matherr, init_floatfns)
+       (syms_of_floatfns): Likewise.
+       * fns.c (make_hash_table): Likewise.
+       * ftfont.c (ftfont_get_otf, ftfont_otf_features)
+       (ftfont_otf_capability, ftfont_get_glyph_id, ftfont_get_metrics)
+       (ftfont_drive_otf, ftfont_shape_by_flt, ftfont_shape)
+       (ftfont_variation_glyphs): Likewise.
+       * gtkutil.c (xg_create_widget, xg_modify_menubar_widgets): Likewise.
+       * keymap.c (describe_map_tree, describe_map, describe_vector): Likewise.
+       * lread.c (read_filtered_event): Likewise.
+       * minibuf.c (read_minibuf_noninteractive, read_minibuf): Likewise.
+       * process.c (wait_reading_process_output): Likewise.
+       * scroll.c (do_line_insertion_deletion_costs): Likewise.
+       * search.c (search_buffer, boyer_moore): Likewise.
+       * syntax.c (scan_sexps_forward): Likewise.
+       * xdisp.c (try_scrolling): Likewise.
+       * xfaces.c (face_at_buffer_position, face_for_overlay_string)
+       (face_at_string_position): Likewise.
+       * xfns.c (x_default_scroll_bar_color_parameter): Likewise.
+       * xselect.c (x_get_window_property, receive_incremental_selection)
+       (x_get_window_property_as_lisp_data, lisp_data_to_selection_data):
+       Likewise.
+       * xterm.c (x_draw_relief_rect, x_draw_box_rect): Likewise.
+
+2010-07-12  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * callproc.c (child_setup): Remove subprocesses conditional.
+       Remove code dealing with SET_EMACS_PRIORITY, unused.
+
+       * buffer.c (Fset_buffer_multibyte): Remove subprocesses conditional.
+       * process.c (close_process_descs): Use DOS_NT instead of WINDOWSNT.
+
+       * emacs.c (__do_global_ctors, __do_global_ctors_aux)
+       (__do_global_dtors, __main): Use void in definition.
+       (main): Remove code dealing with SET_EMACS_PRIORITY, unused.
+       Remove SYMS_MACHINE code, unused.  Remove SYMS_SYSTEM, inline
+       the only users from ...
+       * s/ms-w32.h (SYMS_SYSTEM): ... here and ...
+       * s/msdos.h (SYMS_SYSTEM): ... here.  Remove.
+       (HAVE_VOLATILE): Remove, unused.
+
+       Convert more function definitions to standard C.
+       * xdisp.c (window_box_edges, handle_single_display_spec)
+       (display_string): Convert definition to standard C.
+       * scroll.c (do_direct_scrolling, scrolling_1):
+       * dispnew.c (allocate_matrices_for_frame_redisplay)
+       (mirrored_line_dance):
+       * coding.c (code_convert_string):
+       * charset.c (map_charset_chars):
+       * ccl.c (Fccl_program_p, Fccl_execute, Fccl_execute_on_string)
+       (Fregister_ccl_program, Fregister_code_conversion_map):
+       * keyboard.c (kbd_buffer_nr_stored): Likewise.
+       (head_table): Make static and const.
+
+2010-07-12  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * Makefile.in (C_WARNINGS_SWITCH, PROFILING_CFLAGS)
+       (PROFILING_LDFLAGS): Set from substitution.
+       (ALL_CFLAGS): Add C_WARNINGS_SWITCH and PROFILING_CFLAGS, put
+       CFLAGS last.
+
+2010-07-12  Kenichi Handa  <handa@m17n.org>
+
+       * Makefile.in (lisp): Change hebrew.el to hebrew.elc.
+       (shortlisp): Likewise.
+
+       * font.h (enum font_property_index): New member FONT_ENTITY_INDEX.
+
+       * font.c (font_open_entity): Record ENTITY in FONT_OBJECT's slot
+       of FONT_ENTITY_INDEX.
+       (Ffont_get): If KEY is :otf and the font-object doesn't have the
+       property, get the property value dynamically.
+       (Ffont_put): Accept font-entity and font-object too.
+       (Ffont_get_glyhphs): Renamed from Fget_font_glyphs.  Arguments and
+       return value changed.
+       (syms_of_font): Adjusted for the above change.
+
+2010-07-11  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * blockinput.h: Remove obsolete comment.
+
+       * lisp.h: Include <stddef.h>.
+       (OFFSETOF): Don't define.
+       (VECSIZE): Use offsetof instead of OFFSETOF.
+       (PSEUDOVECSIZE): Likewise.
+       * process.c (conv_sockaddr_to_lisp): Likewise.
+       * alloc.c: Don't include <stddef.h>.
+       * buffer.h (PER_BUFFER_VAR_OFFSET): Use offsetof.
+
+       * process.c: Remove obsolete comment.
+
+2010-07-11  Chong Yidong  <cyd@stupidchicken.com>
+
+       * xfaces.c (Vface_remapping_alist): Doc fix (Bug#6091).
+
+2010-07-11  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * callint.c (Fcall_interactively): Use strchr, strrchr instead of
+       index, rindex.
+       * doc.c (get_doc_string, Fsnarf_documentation): Likewise.
+       * editfns.c (Fuser_full_name, Fformat): Likewise.
+       * emacs.c (argmatch, sort_args, decode_env_path): Likewise.
+       * fileio.c (Ffile_symlink_p): Likewise.
+       * filelock.c (current_lock_owner): Likewise.
+       * font.c (font_parse_name, font_parse_family_registry): Likewise.
+       * fontset.c (fontset_pattern_regexp): Likewise.
+       * lread.c (read1): Likewise.
+       * sysdep.c (init_system_name): Likewise.
+       * xfns.c (select_visual): Likewise.
+       * s/hpux10-20.h (index, rindex): Don't define.
+       * s/ms-w32.h (index): Likewise.
+       * s/usg5-4.h: Likewise.
+
+       * callproc.c (relocate_fd): Use F_DUPFD if defined.
+
+       * alloc.c (pending_malloc_warning, malloc_warning): Add const.
+       * callproc.c (relocate_fd, getenv_internal_1, getenv_internal)
+       (egetenv): Likewise.
+       * doprnt.c (doprnt): Likewise.
+       * editfns.c (set_time_zone_rule, format2): Likewise.
+       * emacs.c (decode_env_path): Likewise.
+       * eval.c (signal_error, error): Likewise.
+       * insdel.c (replace_range_2): Likewise.
+       * keyboard.c (cmd_error_internal): Likewise.
+       * lread.c (isfloat_string, make_symbol, dir_warning): Likewise.
+       * print.c (write_string, write_string_1, print_error_message):
+       Likewise.
+       * vm-limit.c (warn_function, memory_warnings): Likewise.
+       * xdisp.c (message1, message1_nolog, message_with_string)
+       (vmessage, message, message_nolog): Likewise.
+       * emacs.c: Remove duplicate declaration.
+       * keyboard.h: Likewise.
+       * lisp.h: Update prototypes.
+
+       * eval.c: Fix indentation problem.
+
+       * keyboard.c: Include "process.h"
+
+       * eval.c: Remove obsolete noinline declaration.
+       * fns.c: Likewise.
+
+2010-07-11  Ken Raeburn  <raeburn@raeburn.org>
+
+       * doprnt.c (doprnt): Take a va_list argument instead of count and
+       pointer.
+       * eval.c (error): Change to a standard-C variadic function.
+       * xdisp.c (vmessage): Renamed from message, made static, and
+       changed to take a va_list argument.
+       (message): New variadic wrapper.
+       (message_nolog): Now a variadic function, calling vmessage.
+       * lisp.h: Include stdarg.h for va_list.
+       (doprnt, error, message, message_nolog): Decls updated.
+
+2010-07-11  Eli Zaretskii  <eliz@gnu.org>
+
+       * process.c (syms_of_process) <delete-exited-processes>: Define
+       even if !subprocesses.
+       (delete_exited_processes): Ditto.
+
+       * msdos.c (syms_of_msdos) <delete-exited-processes>: Remove DEFVAR.
+       (delete_exited_processes): Don't define.
+
+2010-07-10  Chong Yidong  <cyd@stupidchicken.com>
+
+       * frame.c (make_frame): Initialize menu_bar_lines and
+       tool_bar_lines members.
+       (make_initial_frame, make_terminal_frame): Initialize
+       menu_bar_lines using value of menu-bar-mode.
+
+       * msdos.c (IT_set_frame_parameters): Don't set menu-bar-lines.
+
+2010-07-10  Eli Zaretskii  <eliz@gnu.org>
+
+       * process.c: Reshuffle #include's.  Condition some of the global
+       and static variables on `subprocesses'.
+       (hold_keyboard_input, unhold_keyboard_input, kbd_on_hold_p):
+       Leave only one implementation.
+       (Fget_buffer_process, Fprocess_inherit_coding_system_flag)
+       (kill_buffer_processes, Flist_system_processes)
+       (Fprocess_attributes, init_process, syms_of_process): Unify the
+       implementations for with subprocesses and without them.
+
+2010-07-09  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * xmenu.c (set_frame_menubar): Must realize menubar_widget to get the
+       correct size for Motif.
+       (free_frame_menubar): Call x_set_window_size to update frame size.
+
+       * xfns.c (x_window): Set borderWidth to 0 for pane and
+       EmacsFrame.  Frame size calculation is wrong otherwise.
+
+2010-07-09  Michael Albinus  <michael.albinus@gmx.de>
+
+       * dbusbind.c (xd_initialize): Add new argument RAISE_ERROR, which
+       allows to suppress errors when polling in Emacs' main loop.
+       (Fdbus_init_bus, Fdbus_get_unique_name, Fdbus_call_method)
+       (Fdbus_call_method_asynchronously, Fdbus_method_return_internal)
+       (Fdbus_method_error_internal, Fdbus_send_signal)
+       (xd_get_dispatch_status, xd_read_message, Fdbus_register_signal)
+       (Fdbus_register_method): Use it.  (Bug#6579)
+
+2010-07-08  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * alloc.c: Convert DEFUNs to standard C.
+       * buffer.c:
+       * bytecode.c:
+       * callint.c:
+       * callproc.c:
+       * casefiddle.c:
+       * casetab.c:
+       * category.c:
+       * character.c:
+       * charset.c:
+       * chartab.c:
+       * cmds.c:
+       * coding.c:
+       * composite.c:
+       * data.c:
+       * dbusbind.c:
+       * dired.c:
+       * dispnew.c:
+       * doc.c:
+       * dosfns.c:
+       * editfns.c:
+       * emacs.c:
+       * eval.c:
+       * fileio.c:
+       * filelock.c:
+       * floatfns.c:
+       * fns.c:
+       * font.c:
+       * fontset.c:
+       * frame.c:
+       * fringe.c:
+       * image.c:
+       * indent.c:
+       * insdel.c:
+       * keyboard.c:
+       * keymap.c:
+       * lread.c:
+       * macros.c:
+       * marker.c:
+       * menu.c:
+       * minibuf.c:
+       * msdos.c:
+       * nsfns.m:
+       * nsmenu.m:
+       * nsselect.m:
+       * print.c:
+       * process.c:
+       * search.c:
+       * sound.c:
+       * syntax.c:
+       * term.c:
+       * terminal.c:
+       * textprop.c:
+       * undo.c:
+       * w16select.c:
+       * w32console.c:
+       * w32fns.c:
+       * w32font.c:
+       * w32menu.c:
+       * w32proc.c:
+       * w32select.c:
+       * window.c:
+       * xdisp.c:
+       * xfaces.c:
+       * xfns.c:
+       * xmenu.c:
+       * xselect.c:
+       * xsettings.c:
+       * xsmfns.c: Likewise.
+
+2010-07-08  Eli Zaretskii  <eliz@gnu.org>
+
+       * process.c (kbd_is_on_hold, hold_keyboard_input)
+       (unhold_keyboard_input, kbd_on_hold_p) [!subprocesses]: Define.
+
+2010-07-08  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * xmenu.c (set_frame_menubar, create_and_show_popup_menu)
+       (create_and_show_dialog): Don't call apply_systemfont_to_(menu|dialog)
+       unless USE_LUCID.
+
+2010-07-08  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * xdisp.c (store_mode_line_noprop_char): Remove K&R alternative
+       declaration.
+
+       Clean up include guards.
+       * tparam.c: Remove include guards for config.h, string.h and code
+       that assumes #ifndef emacs.
+       * termcap.c:
+       * unexalpha.c:
+       * sysdep.c:
+       * filemode.c:
+       * filelock.c:
+       * bidi.c: Likewise.
+
+       Remove prefix-args.c
+       * prefix-args.c: Remove file.
+       * autodeps.mk (ALLOBJS): Remove reference to prefix-args.
+       * Makefile.in (temacs${EXEEXT}): Remove references to
+       PRE_EDIT_LDFLAGS and POST_EDIT_LDFLAGS.
+       (mostlyclean): Remove reference to prefix-args.
+       (prefix-args): Remove.
+
+       Simplify cstart_of_data, start_of_code and related code.
+       * mem-limits.h: Remove !emacs and _LIBC conditional code.
+       (start_of_data): Merge into start_of_data function.
+       * sysdep.c (start_of_text): Remove.  Move simplified versions of
+       it in the only users: unexaix.c and unexec.c.
+       (read_input_waiting): Remove local declaration of quit_char.
+       (start, etext): Remove declarations.
+       (start_of_data): Merge with the version in mem-limits.h and move
+       to vm-limits.c.
+       * vm-limit.c (start_of_data): Merged and simplified version of the
+       code formerly in mem-limits.h and sysdep.c.
+       * unexec.c (start): New declaration, moved from sysdep.c.
+       (start_of_text): Simplified version of the code formerly in sysdep.c.
+       * unexaix.c (start_of_text): Simplified version of the code
+       formerly in sysdep.c.
+       * m/alpha.h (HAVE_TEXT_START): Remove.
+       (TEXT_START): Move ...
+       * unexalpha.c (TEXT_START): ... here.
+       * s/hpux10-20.h (TEXT_START): Remove.
+       * s/darwin.h (TEXT_START):
+       * m/mips.h (TEXT_START):
+       * m/macppc.h (HAVE_TEXT_START):
+       * m/m68k.h (TEXT_START):
+       * m/iris4d.h (TEXT_START):
+       * m/intel386.h (TEXT_START):
+       * m/ibmrs6000.h (TEXT_START):
+       * m/ia64.h (HAVE_TEXT_START):
+       * s/msdos.h (TEXT_START): Likewise.
+
+2010-07-07  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * alloc.c (overrun_check_malloc, overrun_check_realloc)
+       (overrun_check_free, xstrdup, allocate_string)
+       (allocate_string_data, compact_small_strings, Fmake_string)
+       (make_unibyte_string, make_multibyte_string)
+       (make_string_from_bytes, make_specified_string, make_float)
+       (Fcons, allocate_terminal, allocate_frame, make_pure_string)
+       (Fgarbage_collect): Replace bcopy, safe_bcopy, bzero, bcmp by
+       memcpy, memmove, memset, memcmp.
+       * atimer.c (start_atimer, set_alarm): Likewise.
+       * buffer.c (clone_per_buffer_values, report_overlay_modification)
+       (mmap_realloc, init_buffer_once): Likewise.
+       * callint.c (Fcall_interactively): Likewise.
+       * callproc.c (Fcall_process, Fcall_process_region, child_setup)
+       (getenv_internal_1): Likewise.
+       * casefiddle.c (casify_object): Likewise.
+       * ccl.c (ccl_driver): Likewise.
+       * character.c (str_as_multibyte, str_to_multibyte): Likewise.
+       * charset.c (load_charset_map_from_file)
+       (load_charset_map_from_file, load_charset_map_from_vector)
+       (Fdefine_charset_internal): Likewise.
+       * cm.c (Wcm_clear): Likewise.
+       * coding.c (decode_eol, decode_coding_object)
+       (Fset_coding_system_priority, make_subsidiaries): Likewise.
+       * data.c (Faset): Likewise.
+       * dired.c (directory_files_internal, file_name_completion_stat):
+       Likewise.
+       * dispnew.c (new_glyph_matrix, adjust_glyph_matrix)
+       (clear_glyph_row, copy_row_except_pointers)
+       (copy_glyph_row_contents, new_glyph_pool, realloc_glyph_pool)
+       (save_current_matrix, restore_current_matrix)
+       (build_frame_matrix_from_leaf_window, mirrored_line_dance)
+       (mirror_line_dance, scrolling_window): Likewise.
+       * doc.c (Fsnarf_documentation, Fsubstitute_command_keys):
+       Likewise.
+       * doprnt.c (doprnt): Likewise.
+       * editfns.c (Fuser_full_name, make_buffer_string_both)
+       (Fmessage_box, Fformat, Ftranspose_regions): Likewise.
+       * emacs.c (sort_args): Likewise.
+       * eval.c (Fapply, Ffuncall): Likewise.
+       * fileio.c (Ffile_name_directory, make_temp_name)
+       (Fexpand_file_name, search_embedded_absfilename)
+       (Fsubstitute_in_file_name, Ffile_symlink_p, Finsert_file_contents)
+       (auto_save_error): Likewise.
+       * fns.c (Fstring_equal, Fcopy_sequence, concat)
+       (string_to_multibyte, Fstring_as_unibyte, Fstring_as_multibyte)
+       (internal_equal, Fclear_string, larger_vector, copy_hash_table)
+       (Fmake_hash_table): Likewise.
+       * fringe.c (Fdefine_fringe_bitmap): Likewise.
+       * ftfont.c (ftfont_text_extents): Likewise.
+       * getloadavg.c (getloadavg): Likewise.
+       * image.c (define_image_type, make_image, make_image_cache)
+       (x_create_x_image_and_pixmap, xbm_image_p)
+       (w32_create_pixmap_from_bitmap_data, xbm_load, xpm_lookup_color)
+       (xpm_image_p, x_create_bitmap_from_xpm_data, xpm_load)
+       (init_color_table, x_build_heuristic_mask, pbm_image_p, pbm_load)
+       (png_image_p, png_read_from_memory, png_load, jpeg_image_p)
+       (tiff_image_p, tiff_read_from_memory, gif_image_p)
+       (gif_read_from_memory, gif_load, svg_image_p, gs_image_p):
+       Likewise.
+       * indent.c (scan_for_column, compute_motion): Likewise.
+       * insdel.c (gap_left, gap_right, make_gap_smaller, copy_text)
+       (insert_1_both, insert_from_gap, replace_range_2): Likewise.
+       * intervals.c (reproduce_tree, reproduce_tree_obj): Likewise.
+       * keyboard.c (echo_char, save_getcjmp, restore_getcjmp)
+       (kbd_buffer_store_event_hold, apply_modifiers_uncached)
+       (store_user_signal_events, menu_bar_items, tool_bar_items)
+       (process_tool_bar_item, append_tool_bar_item)
+       (read_char_minibuf_menu_prompt, read_key_sequence)
+       (Fread_key_sequence, Fread_key_sequence_vector, Frecent_keys):
+       Likewise.
+       * keymap.c (current_minor_maps, Fdescribe_buffer_bindings):
+       Likewise.
+       * lisp.h (STRING_COPYIN): Likewise.
+       * lread.c (Fload, read1, oblookup): Likewise.
+       * msdos.c (Frecent_doskeys): Likewise.
+       * nsfns.m (Fx_create_frame): Likewise.
+       * nsfont.m (nsfont_open, nsfont_text_extents, ns_glyph_metrics):
+       Likewise.
+       * nsimage.m (EmacsImage-initFromSkipXBM:width:height:)
+       (EmacsImage-initForXPMWithDepth:width:height:flip:length:):
+       Likewise.
+       * nsmenu.m (ns_update_menubar): Likewise.
+       * nsterm.m (ns_draw_fringe_bitmap, ns_term_init): Likewise.
+       * print.c (print_unwind, printchar, strout, print_string)
+       (print_error_message): Likewise.
+       * process.c (conv_lisp_to_sockaddr, set_socket_option)
+       (Fmake_network_process, Fnetwork_interface_list)
+       (Fnetwork_interface_info, read_process_output, Fprocess_send_eof)
+       (init_process): Likewise.
+       * ralloc.c (resize_bloc, r_alloc_sbrk, r_alloc_init): Likewise.
+       * regex.c (init_syntax_once, regex_compile, re_compile_fastmap):
+       Likewise.
+       * scroll.c (do_scrolling, do_direct_scrolling)
+       (scrolling_max_lines_saved): Likewise.
+       * search.c (search_buffer, wordify, Freplace_match): Likewise.
+       * sound.c (wav_init, au_init, Fplay_sound_internal): Likewise.
+       * syntax.c (skip_chars, skip_syntaxes): Likewise.
+       * sysdep.c (child_setup_tty, sys_subshell, emacs_get_tty)
+       (emacs_set_tty): Likewise.
+       * term.c (encode_terminal_code, calculate_costs)
+       (produce_special_glyphs, create_tty_output, init_tty, delete_tty):
+       Likewise.
+       * termcap.c (tgetst1, gobble_line): Likewise.
+       * termhooks.h (EVENT_INIT): Likewise.
+       * tparam.c (tparam1): Likewise.
+       * unexalpha.c (unexec): Likewise.
+       * unexec.c (write_segment): Likewise.
+       * unexmacosx.c (unexec_write_zero): Likewise.
+       * w32fns.c (w32_wnd_proc, Fx_create_frame, x_create_tip_frame)
+       (Fx_file_dialog, Fsystem_move_file_to_trash): Likewise.
+       * w32font.c (w32font_list_family, w32font_text_extents)
+       (w32font_list_internal, w32font_match_internal)
+       (w32font_open_internal, compute_metrics, Fx_select_font):
+       Likewise.
+       * w32menu.c (set_frame_menubar, add_menu_item)
+       (w32_menu_display_help, w32_free_submenu_strings): Likewise.
+       * w32term.c (XCreateGC, w32_initialize_display_info): Likewise.
+       * w32uniscribe.c (uniscribe_list_family): Likewise.
+       * w32xfns.c (get_next_msg, post_msg, prepend_msg): Likewise.
+       * window.c (make_window, replace_window, set_window_buffer)
+       (Fsplit_window): Likewise.
+       * xdisp.c (init_iterator, RECORD_OVERLAY_STRING, reseat_to_string)
+       (add_to_log, message3, x_consider_frame_title)
+       (append_space_for_newline, extend_face_to_end_of_line)
+       (decode_mode_spec_coding, init_glyph_string): Likewise.
+       * xfaces.c (x_create_gc, get_lface_attributes_no_remap)
+       (Finternal_copy_lisp_face, Finternal_merge_in_global_face)
+       (face_attr_equal_p, make_realized_face, make_face_cache)
+       (free_realized_faces, lookup_named_face, smaller_face)
+       (face_with_height, lookup_derived_face)
+       (x_supports_face_attributes_p, Finternal_set_font_selection_order)
+       (Finternal_set_font_selection_order, realize_default_face)
+       (compute_char_face, face_at_buffer_position)
+       (face_for_overlay_string, face_at_string_position, merge_faces):
+       Likewise.
+       * xfns.c (xic_create_fontsetname, Fx_create_frame)
+       (Fx_window_property, x_create_tip_frame)
+       (Fx_backspace_delete_keys_p): Likewise.
+       * xfont.c (xfont_list, xfont_match, xfont_list_family)
+       (xfont_text_extents): Likewise.
+       * xmenu.c (set_frame_menubar, xmenu_show): Likewise.
+       * xrdb.c (magic_file_p, x_get_resource): Likewise.
+       * xselect.c (x_queue_event, x_get_window_property)
+       (receive_incremental_selection): Likewise.
+       * xsmfns.c (x_session_check_input): Likewise.
+       * xterm.c (x_send_scroll_bar_event, SET_SAVED_MENU_EVENT)
+       (handle_one_xevent, x_check_errors, xim_initialize, x_term_init):
+       Likewise.
+       * character.h (BCOPY_SHORT): Removed.
+       * config.in: Regenerate.
+       * dispnew.c (safe_bcopy): Only define as dummy if PROFILING.
+       * emacs.c (main) [PROFILING]: Don't declare
+       dump_opcode_frequencies.
+       * lisp.h (safe_bcopy): Remove declaration.
+       (memset) [!HAVE_MEMSET]: Declare.
+       (memcpy) [!HAVE_MEMCPY]: Likewise.
+       (memmove) [!HAVE_MEMMOVE]: Likewise.
+       (memcmp) [!HAVE_MEMCMP]: Likewise.
+       * s/ms-w32.h (bzero, bcopy, bcmp, GAP_USE_BCOPY)
+       (BCOPY_UPWARD_SAFE, BCOPY_DOWNWARD_SAFE, HAVE_BCOPY, HAVE_BCMP):
+       Don't define.
+       (HAVE_MEMCMP, HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET): Define.
+       * s/msdos.h (GAP_USE_BCOPY, BCOPY_UPWARD_SAFE)
+       (BCOPY_DOWNWARD_SAFE): Don't define.
+       * sysdep.c (memset) [!HAVE_MEMSET]: Define.
+       (memcpy) [!HAVE_MEMCPY]: Define.
+       (memmove) [!HAVE_MEMMOVE]: Define.
+       (memcmp) [!HAVE_MEMCMP]: Define.
+
+2010-07-07  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * process.c (kbd_is_on_hold): New variable.
+       (hold_keyboard_input, unhold_keyboard_input, kbd_on_hold_p):
+       New functions.
+       (wait_reading_process_output): If kbd_on_hold_p returns non-zero,
+       select on empty input mask.
+       (init_process): Initialize kbd_is_on_hold to 0.
+
+       * process.h (hold_keyboard_input, unhold_keyboard_input)
+       (kbd_on_hold_p): Declare.
+
+       * keyboard.c (input_available_signal): Declare.
+       (kbd_buffer_nr_stored): New function.
+       (kbd_buffer_store_event_hold): If kbd_buffer_nr_stored returns
+       more than KBD_BUFFER_SIZE/2, stop reding input (Bug#6571).
+       (kbd_buffer_get_event): If input is suspended and kbd_buffer_nr_stored
+       returns less than KBD_BUFFER_SIZE/4, resume reding input (Bug#6571).
+       (tty_read_avail_input): If input is on hold, return.
+       Don't read more that free slots in kbd_buffer (Bug#6571).
+
+2010-07-07  Eli Zaretskii  <eliz@gnu.org>
+
+       * msdos.h:
+       * msdos.c:
+       * dosfns.c:
+       * w16select.c: Convert function definitions to ANSI C.
+
+       * msdos.h (ctrl_break_func, install_ctrl_break_check):
+       Remove unused prototypes.
+
+2010-07-07  Juanma Barranquero  <lekktu@gmail.com>
+
+       * coding.c, sysdep.c: Convert some more functions to standard C.
+
+2010-07-07  Juanma Barranquero  <lekktu@gmail.com>
+
+       * coding.c (decode_coding_gap, encode_coding_gap, decode_coding_object)
+       (encode_coding_object): Use SPECPDL_INDEX.
+       (syms_of_coding): Use DOS_NT.
+
+2010-07-07  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * intervals.h (interval): Use EMACS_UINT instead of unsigned EMACS_INT.
+
+       Make the function member of Lisp_Subr use standard C prototypes.
+       * lisp.h (struct Lisp_Subr): Use a union for the function member.
+       (DECL_ALIGN): Add a cast for the function.
+       * eval.c (Feval, Ffuncall): Use the proper type for each type
+       function call.
+
+2010-07-06  Chong Yidong  <cyd@stupidchicken.com>
+
+       * fringe.c (draw_fringe_bitmap_1): Use lookup_named_face to get
+       fringe face id, so face-remapping-alist works (Bug#6091).
+
+2010-07-06  Juanma Barranquero  <lekktu@gmail.com>
+
+       * w32.c, w32console.c, w32fns.c, w32font.c, w32heap.c, w32inevt.c
+       * w32menu.c, w32proc.c, w32reg.c, w32select.c, w32term.c
+       * w32uniscribe.c, w32xfns.c: Convert function definitions to standard C.
+
+2010-07-06  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * xterm.c (x_get_keysym_name): Change type of parameter to int.
+       * lisp.h: Declare x_get_keysym_name.
+       * keyboard.c (modify_event_symbol): Don't declare
+       x_get_keysym_name here.
+
+2010-07-06  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * ecrt0.c: Revert conversion to standard C.
+
+2010-07-05  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * vm-limit.c (memory_warnings):
+       * keyboard.c (modify_event_symbol):
+       * floatfns.c (rounding_driver, ceiling2, floor2, truncate2)
+       (round2, emacs_rint):
+       * process.c (send_process, old_sigpipe): Convert function
+       definitions and declarations to standard C.
+
+2010-07-05  Juanma Barranquero  <lekktu@gmail.com>
+
+       * buffer.c, cm.c, eval.c, keyboard.c, process.c, term.c, vm-limit.c,
+       * xdisp.c: Convert function definitions to standard C.
+
+       * cm.c (cmputc): Arg C is now int, not char.
+       * process.c (Fmake_network_process): Cast sockaddr_in* to sockaddr*.
+
+2010-07-05  James Cloos  <cloos@jhcloos.com>
+
+       * xterm.h (Xatom_net_wm_name, Xatom_net_wm_icon_name): New.
+
+       * xterm.c (x_term_init): Intern the _NET_WM_NAME and
+       _NET_WM_ICON_NAME atoms.
+
+       * xfns.c (x_set_name_internal): Set the EWMH _NET_WM_NAME
+       and _NET_WM_ICON_NAME properties, too, matching what is
+       done in the Gtk+ case.
+
+2010-07-05  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * xterm.c (XTring_bell, XTset_terminal_window): Fix wrong prototype.
+
+       * xsmfns.c (SSDATA): New macro.
+       (smc_save_yourself_CB, x_session_initialize): Use SSDATA for strings
+       passed to strlen/strcpy/strcat.
+       (create_client_leader_window): Surround with #ifndef USE_GTK.  Cast
+       7:th arg to XChangeProperty to (unsigned char *)
+
+       * xsettings.c (something_changedCB, parse_settings)
+       (apply_xft_settings): Reformat prototype.
+       (something_changedCB, init_gconf): Remove unused variable i.
+       (read_settings): Remove unused variable long_len.
+
+       * gtkutil.c (xg_get_pixbuf_from_pix_and_mask)
+       (xg_get_image_for_pixmap, create_dialog)
+       (xg_get_file_with_selection, xg_get_file_name, update_cl_data)
+       (menuitem_highlight_callback, make_menu_item)
+       (xg_create_one_menuitem, create_menus, xg_update_menu_item)
+       (xg_create_scroll_bar, xg_update_scrollbar_pos)
+       (xg_set_toolkit_scroll_bar_thumb, xg_tool_bar_button_cb)
+       (xg_tool_bar_proxy_help_callback, xg_tool_bar_detach_callback)
+       (xg_tool_bar_attach_callback, xg_tool_bar_help_callback)
+       (xg_tool_bar_item_expose_callback): Reformat prototype.
+       (xg_update_menubar): GList *group => GSList *group.
+       (xg_modify_menubar_widgets): Initialize witem to 0, check witem != 0
+       before use.
+       (update_frame_tool_bar): 4:th param to xg_get_image_for_pixmap changed
+       to GTK_IMAGE (wimage).
+
+2010-07-05  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * atimer.c: Use "" instead of <> for local includes for
+       consistency with the rest of the code.
+
+       * xsmfns.c (smc_save_yourself_CB, smc_error_handler):
+       * xrdb.c (get_system_name):
+       * window.c (shrink_windows):
+       * syntax.c (forw_comment):
+       * scroll.c (calculate_scrolling, calculate_direct_scrolling)
+       (ins_del_costs):
+       * mem-limits.h (start_of_data):
+       * lread.c (readevalloop):
+       * gtkutil.c (xg_dialog_response_cb, xg_get_file_with_chooser)
+       (xg_get_file_with_selection, xg_update_menubar, xg_update_submenu):
+       * frame.c (x_get_focus_frame):
+       * floatfns.c (fmod_float):
+       * fileio.c (choose_write_coding_system):
+       * emacs.c (fatal_error_signal, init_cmdargs, argmatch)
+       (malloc_initialize_hook, sort_args, synchronize_locale):
+       * doprnt.c (doprnt):
+       * dired.c (compile_pattern):
+       * data.c (fmod_float):
+       * chartab.c (map_sub_char_table, map_sub_char_table_for_charset)
+       (map_char_table_for_charset):
+       * charset.c (define_charset_internal):
+       * alloc.c (Fgarbage_collect): Convert declarations or definitions
+       to standard C.
+
+2010-07-04  Tetsurou Okazaki  <okazaki@be.to>  (tiny change)
+            Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * lread.c (read1): Fix up last change to not mess up `c'.
+
+2010-07-04  Juanma Barranquero  <lekktu@gmail.com>
+
+       * strftime.c: Revert conversion to standard C (2010-07-04T07:50:25Z!dann@ics.uci.edu).
+
+2010-07-04  Juanma Barranquero  <lekktu@gmail.com>
+
+       Fix prototypes.
+
+       * atimer.c (start_atimer): Use EMACS_TIME, not struct timeval.
+       * dired.c (file_name_completion_stat): Use DIRENTRY, not struct dirent.
+       * fileio.c (read_non_regular, read_non_regular_quit): Add Lisp_Object
+       arg, as required by internal_condition_case_1.
+       * print.c (strout): Use const char* for arg PTR.
+       * regex.c (bcmp_translate): Use RE_TRANSLATE_TYPE, not Lisp_Object.
+       (analyse_first): Fix "const const".
+       * sysdep.c (set_file_times): Use EMACS_TIME, not struct timeval.
+       * unexelf.c (round_up, find_section): Use ElfW macro for arguments.
+       * xgselect.c (xg_select): Use SELECT_TYPE, EMACS_TIME.
+
+2010-07-04  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * alloc.c: Convert function definitions to standard C.
+       * atimer.c:
+       * bidi.c:
+       * bytecode.c:
+       * callint.c:
+       * callproc.c:
+       * casefiddle.c:
+       * casetab.c:
+       * category.c:
+       * ccl.c:
+       * character.c:
+       * charset.c:
+       * chartab.c:
+       * cmds.c:
+       * coding.c:
+       * composite.c:
+       * data.c:
+       * dbusbind.c:
+       * dired.c:
+       * dispnew.c:
+       * doc.c:
+       * doprnt.c:
+       * ecrt0.c:
+       * editfns.c:
+       * fileio.c:
+       * filelock.c:
+       * filemode.c:
+       * fns.c:
+       * font.c:
+       * fontset.c:
+       * frame.c:
+       * fringe.c:
+       * ftfont.c:
+       * ftxfont.c:
+       * gtkutil.c:
+       * indent.c:
+       * insdel.c:
+       * intervals.c:
+       * keymap.c:
+       * lread.c:
+       * macros.c:
+       * marker.c:
+       * md5.c:
+       * menu.c:
+       * minibuf.c:
+       * prefix-args.c:
+       * print.c:
+       * ralloc.c:
+       * regex.c:
+       * region-cache.c:
+       * scroll.c:
+       * search.c:
+       * sound.c:
+       * strftime.c:
+       * syntax.c:
+       * sysdep.c:
+       * termcap.c:
+       * terminal.c:
+       * terminfo.c:
+       * textprop.c:
+       * tparam.c:
+       * undo.c:
+       * unexelf.c:
+       * window.c:
+       * xfaces.c:
+       * xfns.c:
+       * xfont.c:
+       * xftfont.c:
+       * xgselect.c:
+       * xmenu.c:
+       * xrdb.c:
+       * xselect.c:
+       * xsettings.c:
+       * xsmfns.c:
+       * xterm.c: Likewise.
+
+2010-07-03  Eli Zaretskii  <eliz@gnu.org>
+
+       * msdos.c (IT_set_frame_parameters): Fix setting of colors in
+       frames other than the initial one.  Fix reversal of colors when
+       `reverse' is specified in the frame parameters.  Call
+       update_face_from_frame_parameter instead of
+       internal-set-lisp-face-attribute.  Initialize screen colors from
+       initial_screen_colors[] when f->default_face_done_p is zero,
+       instead of depending on being called with default-frame-alist as
+       the alist argument.
+
+       * xfaces.c (update_face_from_frame_parameter): Move out of
+       HAVE_WINDOW_SYSTEM portion.  Condition window-system only parts
+       with HAVE_WINDOW_SYSTEM.
+
+       * msdos.c (IT_set_frame_parameters): Set menu-bar-lines according
+       to menu-bar-mode, if not set in the frame parameters or in
+       default-frame-alist.
+
+       * w32console.c (sys_tputs): Adjust argument list to prototype in
+       term.c.
+
+2010-07-03  Juanma Barranquero  <lekktu@gmail.com>
+
+       * lisp.h (memory_warnings): Fix prototype.
+
+       * cm.h (evalcost): Fix prototype.
+
+       * cm.c (evalcost): Fix arg type.
+
+2010-07-02  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * term.c (term_clear_mouse_face, Fidentity):
+       * syssignal.h (signal_handler_t):
+       * lisp.h (memory_warnings):
+       * coding.h (preferred_coding_system):
+       * cm.h (evalcost):
+       * blockinput.h (reinvoke_input_signal): Convert to standard C prototypes.
+
+2010-07-02  Eli Zaretskii  <eliz@gnu.org>
+
+       * dosfns.h (msdos_stdcolor_idx, msdos_stdcolor_name): Remove P_
+       from prototypes.
+
+       * msdos.h (load_pixmap): Don't define away.
+
+2010-07-02  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * lisp.h:
+       * atimer.h: Remove define for P_.
+
+       * alloc.c: Remove __P and P_ from .c and .m files.
+       * atimer.c:
+       * buffer.c:
+       * callint.c:
+       * category.c:
+       * charset.c:
+       * chartab.c:
+       * cm.c:
+       * coding.c:
+       * composite.c:
+       * data.c:
+       * dired.c:
+       * dispnew.c:
+       * doc.c:
+       * editfns.c:
+       * emacs.c:
+       * eval.c:
+       * fileio.c:
+       * filelock.c:
+       * fns.c:
+       * font.c:
+       * fontset.c:
+       * frame.c:
+       * ftfont.c:
+       * ftxfont.c:
+       * gmalloc.c:
+       * gtkutil.c:
+       * image.c:
+       * indent.c:
+       * intervals.c:
+       * keyboard.c:
+       * keymap.c:
+       * lread.c:
+       * marker.c:
+       * menu.c:
+       * minibuf.c:
+       * print.c:
+       * process.c:
+       * scroll.c:
+       * search.c:
+       * sound.c:
+       * strftime.c:
+       * syntax.c:
+       * sysdep.c:
+       * term.c:
+       * terminal.c:
+       * textprop.c:
+       * unexalpha.c:
+       * w32console.c:
+       * w32fns.c:
+       * w32font.c:
+       * w32menu.c:
+       * w32term.c:
+       * w32uniscribe.c:
+       * window.c:
+       * xdisp.c:
+       * xfaces.c:
+       * xfns.c:
+       * xfont.c:
+       * xftfont.c:
+       * xmenu.c:
+       * xselect.c:
+       * xterm.c: Likewise.
+
+       Remove P_ and __P macros.
+       * atimer.h: Remove P_ and __P macros.
+       * buffer.h:
+       * category.h:
+       * ccl.h:
+       * character.h:
+       * charset.h:
+       * cm.h:
+       * coding.h:
+       * composite.h:
+       * dispextern.h:
+       * disptab.h:
+       * dosfns.h:
+       * font.h:
+       * fontset.h:
+       * frame.h:
+       * gtkutil.h:
+       * indent.h:
+       * intervals.h:
+       * keyboard.h:
+       * keymap.h:
+       * lisp.h:
+       * macros.h:
+       * md5.h:
+       * menu.h:
+       * msdos.h:
+       * nsterm.h:
+       * puresize.h:
+       * region-cache.h:
+       * syntax.h:
+       * syssignal.h:
+       * systime.h:
+       * termhooks.h:
+       * w32font.h:
+       * w32term.h:
+       * widget.h:
+       * window.h:
+       * xgselect.h:
+       * xsettings.h:
+       * xterm.h: Likewise.
+
+2010-07-02  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * lisp.h: Document that USE_LISP_UNION_TYPE is now enabled using autoconf.
+
+       Cleanup old code.
+       * dired.c (BSD4_3): Remove all uses, redundant with BSD4_2.
+       * syssignal.h: Remove code for Lynx, not supported anymore.
+       * vm-limit.c: Remove unused code the depends on emacs not being
+       defined and NO_LIM_DATA being defined.
+       * mem-limits.h: Remove dead code.
+
+2010-07-01  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * window.c (Fwindow_absolute_pixel_edges): Doc fix.
+
+       * window.c (calc_absolute_offset, Fwindow_absolute_pixel_edges)
+       (Fwindow_inside_absolute_pixel_edges): New functions (bug#5721).
+
+       * nsfns.m (compute_tip_xy): Do not convert coordinates from frame
+       parameters, they are already absolute.
+
+       * nsterm.m (x_set_window_size, initFrameFromEmacs):
+       Rename FRAME_NS_TOOLBAR_HEIGHT to FRAME_TOOLBAR_HEIGHT.
+
+       * nsterm.h (FRAME_NS_TOOLBAR_HEIGHT): Rename to FRAME_TOOLBAR_HEIGHT.
+
+       * nsmenu.m (update_frame_tool_bar, free_frame_tool_bar):
+       Update FRAME_TOOLBAR_HEIGHT.
+
+       * nsmenu.m (free_frame_tool_bar, update_frame_tool_bar):
+       Add BLOCK/UNBLOCK_INPUT so asserts don't trigger.
+
+2010-06-30  Chong Yidong  <cyd@stupidchicken.com>
+
+       * frame.c (get_future_frame_param, Fmake_terminal_frame): Don't
+       check default-frame-alist.
+
+2010-06-30  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * process.c (create_process): Avoid using invalid file descriptors.
+
+       * callproc.c (child_setup): Avoid closing a file descriptor twice.
+
+2010-06-30  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * xsettings.c (Ffont_get_system_normal_font, Ffont_get_system_font):
+       Improve documentation.  Return font regardless of use_system_font.
+       (syms_of_xsettings): Improve documentation for font-use-system-font.
+
+2010-07-10  Chong Yidong  <cyd@stupidchicken.com>
+
+       * xfaces.c (realize_face): Garbage the frame if a face is removed
+       (Bug#6593).
+
+2010-07-05  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * keyboard.c: Remove duplicate <setjmp.h>.
+       (read_key_sequence): Remove volatile qualifiers.
+
+2010-07-05  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+       * dispextern.h (FRINGE_HEIGHT_BITS): New define.
+       (struct glyph_row): New members left_fringe_offset and
+       right_fringe_offset.
+
+       * xterm.c (x_draw_fringe_bitmap): Don't clip bottom aligned bitmap
+       specially.
+       * w32term.c (w32_draw_fringe_bitmap): Likewise.
+       * nsterm.m (ns_draw_fringe_bitmap): Likewise.
+
+       * fringe.c (draw_fringe_bitmap_1): Don't clip bitmap here.
+       Take account of bitmap offset.
+       (draw_window_fringes): Take account of window vscroll.
+       (update_window_fringes): Likewise.  Extend top-aligned top indicator
+       or bottom-aligned bottom indicator to adjacent rows if it doesn't fit
+       in one row.  Don't set redraw_fringe_bitmaps_p outside row comparison.
+       Set left_fringe_offset and right_fringe_offset (Bug#5634, Bug#6325).
+
+2010-07-04  Juanma Barranquero  <lekktu@gmail.com>
+
+       * w32fns.c (Qtooltip): Declare.
+       Suggested by Andy Moreton <andrewjmoreton@gmail.com>.
+
+2010-07-03  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * xmenu.c (x_activate_menubar): Send Press/Release for Gtk+ to avoid
+       grab on just Press (Bug#6499).
+
+2010-07-02  Chong Yidong  <cyd@stupidchicken.com>
+
+       * frame.c (Qtooltip): New var.
+       (delete_frame): Use it.  Fix faulty if statement.  Don't update
+       mode line for tooltip frames.  Suggested by Martin Rudalics.
+
+       * xfns.c (x_create_tip_frame):
+       * w32fns.c (x_create_tip_frame): Use it.
+
+2010-06-17  Naohiro Aota  <naota@elisp.net>  (tiny change)
+
+       * xftfont.c (xftfont_open): Check font width one by one also when
+       spacing is dual.
+
+       * ftfont.c (ftfont_open): Ditto.
+
+2010-06-30  Glenn Morris  <rgm@gnu.org>
+
+       * s/sol2-6.h (INHIBIT_X11R6_XIM): Remove, handled by configure now.
+
+       * Makefile.in (CANNOT_DUMP): Update for configure name change.
+
+       * s/freebsd.h (USE_MMAP_FOR_BUFFERS):
+       * s/irix6-5.h (USE_MMAP_FOR_BUFFERS):
+       * s/darwin.h (SYSTEM_MALLOC):
+       * s/sol2-10.h (SYSTEM_MALLOC): Move to configure.
+
+2010-06-29  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * nsfns.m: extern declare Vmenu_bar_mode, Vtool_bar_mode.
+       (ns_get_screen): Don't assign integer to f.
+       (Fx_display_color_cells): Declarations before statements.
+
+2010-06-28  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * xfns.c (x_default_font_parameter): Remove got_from_system
+       (Bug#6526).
+
+       * xterm.h (gtk_widget_get_window, gtk_widget_get_mapped)
+       (gtk_adjustment_get_page_size, gtk_adjustment_get_upper): New
+       defines based on what configure finds.
+
+       * xterm.c (XTflash): Use gtk_widget_get_window.
+       (xg_scroll_callback): Use gtk_adjustment_get_upper and
+       gtk_adjustment_get_page_size.
+       (handle_one_xevent): Use gtk_widget_get_mapped.
+       (x_term_init): Remove HAVE_GTK_MULTIDISPLAY and associated error
+       messages.
+
+       * xmenu.c (create_and_show_popup_menu): Call gtk_widget_get_mapped.
+
+       * gtkutil.h: Replace HAVE_GTK_FILE_BOTH with
+       HAVE_GTK_FILE_SELECTION_NEW.
+
+       * gtkutil.c (xg_display_open, xg_display_close): Remove
+       HAVE_GTK_MULTIDISPLAY, it is always defined.
+       (xg_display_open): Return type is void.
+       (gtk_widget_set_has_window)
+       (gtk_dialog_get_action_area, gtk_dialog_get_content_area)
+       (gtk_widget_get_sensitive, gtk_adjustment_set_page_size)
+       (gtk_adjustment_set_page_increment)
+       (gtk_adjustment_get_step_increment): #define these if not found
+       by configure.
+       (remove_submenu): New define based on Gtk+ version.
+       (xg_set_cursor, xg_frame_resized, xg_event_is_for_scrollbar): Use
+       gtk_widget_get_window.
+       (xg_frame_resized, xg_update_frame_menubar): Use gtk_widget_get_mapped.
+       (xg_create_frame_widgets): Use gtk_widget_set_has_window.
+       (create_dialog): Use gtk_dialog_get_action_area and
+       gtk_dialog_get_content_area.
+       (xg_uses_old_file_dialog, xg_get_file_name): Remove HAVE_GTK_FILE_BOTH
+       and HAVE_GTK_FILE_CHOOSER_DIALOG_NEW.  File chooser is always
+       available, so checking for HAVE_GTK_FILE_SELECTION_NEW is enough.
+       (xg_update_menubar, xg_update_submenu, xg_show_toolbar_item): Use
+       g_object_ref and g_object_unref.
+       (xg_update_menu_item, xg_tool_bar_menu_proxy): Use
+       gtk_widget_get_sensitive.
+       (xg_update_submenu): Use remove_submenu.
+       (xg_update_scrollbar_pos): Don't use GtkFixedChild, use child
+       properties instead to get old x and y position.
+       (xg_set_toolkit_scroll_bar_thumb): Use gtk_adjustment_get_page_size,
+       gtk_adjustment_get_step_increment, gtk_adjustment_set_page_size,
+       gtk_adjustment_set_step_increment and gtk_adjustment_set_page_increment.
+       (xg_get_tool_bar_widgets): New function.
+       (xg_tool_bar_menu_proxy, xg_show_toolbar_item)
+       (update_frame_tool_bar): Call xg_get_tool_bar_widgets.
+       (toolbar_set_orientation): New #define based on if configure
+       finds gtk_orientable_set_orientation.
+       (xg_create_tool_bar): Call toolbar_set_orientation.
+       (xg_make_tool_item, xg_show_toolbar_item): Call gtk_box_pack_start
+       instead of gtk_box_pack_start_defaults.
+
+2010-06-28  Chong Yidong  <cyd@stupidchicken.com>
+
+       * cmds.c (Fdelete_backward_char): Move into Lisp.
+
+2010-06-27  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * s/freebsd.h (BSD4_2): Remove redundant definition.
+       bsd-common.h defines it already.
+
+2010-06-27  Chong Yidong  <cyd@stupidchicken.com>
+
+       * xfns.c (Fx_create_frame): Don't consult X resouces when setting
+       menu-bar-lines and tool-bar-lines.  Use menu-bar-mode and
+       tool-bar-mode, which are now set using these X resources at
+       startup, to determine the defaults (Bug#2249).
+
+       * w32fns.c (Fx_create_frame):
+       * nsfns.m (Fx_create_frame): Likewise.
+
+       * frame.c (Vmenu_bar_mode, Vtool_bar_mode): New vars.
+
+2010-06-24  Juanma Barranquero  <lekktu@gmail.com>
+
+       * gtkutil.c (xg_update_scrollbar_pos):
+       Avoid C99 mid-block variable declaration.
+
+2010-06-22  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * xterm.c (x_scroll_bar_create): Remove call to xg_show_scroll_bar.
+
+       * gtkutil.h (xg_show_scroll_bar): Remove.
+
+       * gtkutil.c (xg_update_scrollbar_pos): Show/hide scroll bar as needed
+       if height is less than scroll bar min size.
+       (xg_show_scroll_bar): Remove, show moved to xg_update_scrollbar_pos.
+
+       * xfns.c (x_default_font_parameter): Try to open font from system
+       before using it (bug#6478).  Rename got_from_gconf to got_from_system.
+
+2010-06-22  Keith Packard  <keithp@keithp.com>  (tiny change)
+
+       * font.c (font_parse_fcname): Allow . for sizes like 7.5 (bug#6437).
+
+2010-06-20  Eli Zaretskii  <eliz@gnu.org>
+
+       * xdisp.c (try_scrolling): When scroll-conservatively is set to
+       most-positive-fixnum, be extra accurate when scrolling window
+       start, to avoid missing the cursor line.
+
+2010-06-19  Eli Zaretskii  <eliz@gnu.org>
+
+       * xdisp.c (try_scrolling): Compute the limit for searching point
+       in forward scroll from scroll_max, instead of an arbitrary limit
+       of 10 screen lines.  See
+       http://lists.gnu.org/archive/html/emacs-devel/2010-06/msg00766.html
+       and
+       http://lists.gnu.org/archive/html/emacs-devel/2010-06/msg00773.html
+       for details.
+
+2010-06-16  Glenn Morris  <rgm@gnu.org>
+
+       * editfns.c (Fbyte_to_string): Pacify compiler.
+
+2010-06-16  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * lread.c (read1): Phase out old-style backquotes a bit more.
+
+2010-06-12  Eli Zaretskii  <eliz@gnu.org>
+
+       * makefile.w32-in ($(BLD)/bidi.$(O)): Depend on biditype.h and
+       bidimirror.h.
+
+       * deps.mk (bidi.o): Depend on biditype.h and bidimirror.h.
+
+       * bidi.c (bidi_initialize): Remove explicit initialization of
+       bidi_type_table; include biditype.h instead.  Don't support
+       entries whose second codepoint is zero.  Initialize bidi_mirror_table.
+       (bidi_mirror_char): Use bidi_mirror_table.
+
+       * biditype.h: New file.
+
+       * bidimirror.h: New file.
+
+       * window.c (syms_of_window): Doc fix (bug#6409).
+
+2010-06-12  Romain Francoise  <romain@orebokech.com>
+
+       * Makefile.in (lisp, shortlisp): Use new location of vc-hooks and
+       ediff-hook.
+
+2010-06-10  Glenn Morris  <rgm@gnu.org>
+
+       * editfns.c (Fbyte_to_string): Pacify compiler.
+
+       * m/ibms390x.h: Rather than duplicating ibms390.h, just include it.
+
+2010-06-26  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * alloc.c (Fmake_byte_code): Don't access undefined argument
+       (Bug#6517).
+
+2010-06-25  Chong Yidong  <cyd@stupidchicken.com>
+
+       * xdisp.c (next_element_from_image): Ensure that after-strings are
+       read the next time we hit handle_stop (Bug#1336).
+
+2010-06-23  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * lread.c (read1): Signal error if #s is not followed by paren.
+
+2010-06-19  Chong Yidong  <cyd@stupidchicken.com>
+
+       * image.c (free_image): Mark frame as garbaged (Bug#6426).
+
+       * keymap.c (Fdefine_key): Doc fix (Bug#6460).
+
+2010-06-15  Glenn Morris  <rgm@gnu.org>
+
+       * editfns.c (Fbyte_to_string): Pacify compiler.
+
+2010-06-09  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * dbusbind.c (xd_append_arg): Don't "make-unibyte" the string.
+       Check `object's type before accessing its guts.
+
+2010-06-09  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * s/usg5-4.h: Fix previous change.
+       Suggested by Lawrence Mitchell <wence@gmx.li>
+
+2010-06-08  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * minibuf.c (Fall_completions): Add more checks.
+
+2010-06-08  Juanma Barranquero  <lekktu@gmail.com>
+
+       * minibuf.c (Fall_completions): Check COLLECTION's size (bug#6378).
+
+2010-06-08  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * lread.c (X_OK): Remove, unused.
+
+       * dispnew.c: Remove obsolete comment.
+
+       Remove INCLUDED_FCNTL.
+       * xterm.c (INCLUDED_FCNTL):
+       * callproc.c (INCLUDED_FCNTL):
+       * alloc.c (INCLUDED_FCNTL):
+       * systty.h (INCLUDED_FCNTL): Remove all uses, not needed anymore.
+       (emacs_get_tty, emacs_set_tty): Declare unconditionally.
+
+2010-06-07  Martin Rudalics  <rudalics@gmx.at>
+
+       * window.c (Fselect_window): Move `record_buffer' up to the
+       beginning of this function, so the buffer gets recorded
+       even if the selected window does not change.
+       http://lists.gnu.org/archive/html/emacs-devel/2010-06/msg00137.html
+
+2010-06-07  Juanma Barranquero  <lekktu@gmail.com>
+
+       * cmds.c (Fforward_char, Fbackward_char): Fix typos in docstrings.
+       (Fforward_line, Fbeginning_of_line): Reflow docstrings.
+
+2010-06-06  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       Remove BSTRING related code, all platforms define it.
+       * s/usg5-4.h (BSTRING): Remove definition.
+       * s/template.h (BSTRING):
+       * s/msdos.h (BSTRING):
+       * s/ms-w32.h (BSTRING):
+       * s/hpux10-20.h (BSTRING):
+       * s/gnu-linux.h (BSTRING):
+       * s/darwin.h (BSTRING):
+       * s/cygwin.h (BSTRING):
+       * s/bsd-common.h (BSTRING):
+       * s/aix4-2.h (BSTRING): Likewise.
+       * sysdep.c: Remove code depending on BSTRING not being defined.
+
+2010-06-05  Juanma Barranquero  <lekktu@gmail.com>
+
+       Remove obsolete macro BASE_LEADING_CODE_P.
+       * character.h (BASE_LEADING_CODE_P): Remove.
+       * regex.c [!emacs] (BASE_LEADING_CODE_P): Remove.
+       * buffer.c (Fset_buffer_multibyte):
+       * indent.c (scan_for_column, compute_motion):
+       * insdel.c (count_combining_before, count_combining_after):
+       Use LEADING_CODE_P instead of BASE_LEADING_CODE_P.
+
+2010-06-04  Juanma Barranquero  <lekktu@gmail.com>
+
+       Turn `directory-sep-char' into a noop.
+
+       * lisp.h [WINDOWSNT] (Vdirectory_sep_char): Don't declare.
+       (DIRECTORY_SEP): Define unconditionally.
+
+       * s/ms-w32.h (DIRECTORY_SEP): Remove.
+
+       * emacs.c (decode_env_path): Don't check DIRECTORY_SEP,
+       call dostounix_filename directly.
+
+       * fileio.c (CORRECT_DIR_SEPS): Remove.
+       (Ffile_name_directory, directory_file_name, Fexpand_file_name)
+       (Fsubstitute_in_file_name): Use dostounix_filename instead.
+       (file_name_as_directory): Use dostounix_filename, DIRECTORY_SEP.
+       (syms_of_fileio) <directory-sep-char>: Move to subr.el.
+
+       * w32proc.c (CORRECT_DIR_SEPS): Remove.
+       (Fw32_short_file_name, Fw32_long_file_name): Use dostounix_filename.
+
+2010-06-03  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * process.c (conv_lisp_to_sockaddr): Fix conversion of IPv4 address.
+       (Bug#6346)
+
+2010-06-03  Juanma Barranquero  <lekktu@gmail.com>
+
+       * ccl.c (Fccl_program_p): Fix typo in docstring.
+
+2010-06-03  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       Move UNEXEC definition to autoconf.
+       * s/usg5-4.h (UNEXEC): Remove, move to configure.in.
+       * s/sol2-10.h (UNEXEC):
+       * s/irix6-5.h (UNEXEC):
+       * s/hpux10-20.h (UNEXEC):
+       * s/gnu-linux.h (UNEXEC):
+       * s/darwin.h (UNEXEC):
+       * s/cygwin.h (UNEXEC):
+       * s/bsd-common.h (UNEXEC):
+       * s/aix4-2.h (UNEXEC):
+       * m/alpha.h (UNEXEC): Likewise.
+       * Makefile.in (UNEXEC_OBJ): Define using @UNEXEC_OBJ@.
+
+2010-06-03  Juanma Barranquero  <lekktu@gmail.com>
+
+       Remove obsolete pre-unicode2 macros.
+       * character.h (MULTIBYTE_FORM_LENGTH, PARSE_MULTIBYTE_SEQ): Remove.
+       * composite.c (composition_reseat_it):
+       * data.c (Faset):
+       * fns.c (Ffillarray):
+       * regex.c (re_search_2): Use BYTES_BY_CHAR_HEAD.
+       [!emacs] (BYTES_BY_CHAR_HEAD): Define instead of MULTIBYTE_FORM_LENGTH.
+
+2010-06-03  Juri Linkov  <juri@jurta.org>
+
+       * buffer.c (Fother_buffer): Add CHECK_FRAME.
+       (Fswitch_to_buffer): Remove unused variable `err'.
+
+2010-06-03  Glenn Morris  <rgm@gnu.org>
+
+       * m/template.h (NO_SOCK_SIGIO): Remove, no longer used.
+
+       * m/hp800.h (alloca) [__NetBSD__ && __GNUC__]: No need to define it,
+       now that AH_BOTTOM does it.
+
+       * m/hp800.h (HAVE_ALLOCA):
+       * m/ibms390x.h (HAVE_ALLOCA): Do not define, no longer needed.
+
+       * m/ia64.h, s/gnu-linux.h, s/gnu.h, s/netbsd.h, s/usg5-4.h:
+       Remove NOT_C_CODE tests, it is always true now.
+
+2010-06-02  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       Fix config.h includes.
+       * xsettings.c:
+       * xgselect.c:
+       * nsterm.m:
+       * nsselect.m:
+       * nsimage.m:
+       * nsfont.m:
+       * nsfns.m:
+       * dbusbind.c: Use #include <config.h> instead of "config.h" as all
+       other files do.
+
+       * gmalloc.c: Remove BROKEN_PROTOTYPES reference, unused.
+
+       * s/sol2-6.h: Remove obsolete comments.
+
+       Remove unnecessary alloca.h includes.
+       * keymap.c: Do not include alloca.h, config.h does that.
+       * sysdep.c: Likewise.  Do not define fwrite, not used.
+
+2010-06-01  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * sysdep.c (child_setup_tty): Move the non-canonical initialization to
+       the HAVE_TERMIO where it belongs (bug#6149).
+
+2010-05-31  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * keymap.c (Fwhere_is_internal): Fix handling of remapping (in thread
+       of bug#6305).
+
+2010-05-30  Eli Zaretskii  <eliz@gnu.org>
+
+       * bidi.c (bidi_move_to_visually_next): Make sure the sentinel
+       state is always cached (bug#6306).
+
+2010-05-29  Eli Zaretskii  <eliz@gnu.org>
+
+       Fix cursor motion in bidi-reordered continued lines.
+       * xdisp.c (try_cursor_movement): Backup to non-continuation line
+       only after finding point's row.  Fix the logic.  Rewrite the loop
+       over continuation lines in bidi-reordered buffers.  Return
+       CURSOR_MOVEMENT_MUST_SCROLL upon failure to find a suitable row,
+       rather than CURSOR_MOVEMENT_CANNOT_BE_USED.
+
+2010-05-28  Michael Albinus  <michael.albinus@gmx.de>
+
+       * fileio.c (Fdelete_file): Pass TRASH arg to handler call.
+
+2010-05-28  Kenichi Handa  <handa@m17n.org>
+
+       * font.c (font_delete_unmatched): Check Vface_ignored_fonts.
+       Don't sheck SPEC if it is nil.
+       (font_list_entities): Call font_delete_unmatched if
+       Vface_ignored_fonts is non-nil.  (Bug#6287)
+
+2010-05-28  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (LIBES): Remove $LOADLIBES, it is never set.
+
+2010-05-27  Chong Yidong  <cyd@stupidchicken.com>
+
+       * fileio.c (Fdelete_file): Change meaning of optional arg to mean
+       whether to trash.
+       (internal_delete_file, Frename_file): Callers changed.
+       (delete_by_moving_to_trash): Doc fix.
+       (Fdelete_directory_internal): Don't move to trash.
+
+       * callproc.c (delete_temp_file):
+       * buffer.c (Fkill_buffer): Callers changed.
+
+       * lisp.h: Update prototype.
+
+2010-05-27  Chong Yidong  <cyd@stupidchicken.com>
+
+       * xdisp.c (redisplay_window): After redisplay, check if point is
+       still valid before setting it (Bug#6177).
+
+2010-05-27  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in, autodeps.mk, deps.mk, ns.mk:
+       Convert comments to Makefile format.
+
+       * Makefile.in (bootstrap-clean): No more Makefile.c.
+
+2010-05-26  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (YMF_PASS_LDFLAGS): Remove.
+       (temacs${EXEEXT}): Use PRE_EDIT_LDFLAGS, POST_EDIT_LDFLAGS.
+
+       * Makefile.in (NS_IMPL_GNUSTEP_INC, NS_IMPL_GNUSTEP_TEMACS_LDFLAGS):
+       Remove.
+       (TEMACS_LDFLAGS): Do not use NS_IMPL_GNUSTEP_TEMACS_LDFLAGS.
+
+2010-05-26  Kenichi Handa  <handa@m17n.org>
+
+       * composite.c (composition_compute_stop_pos): Fix condition for
+       backward scanning.
+
+2010-05-25  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (@NS_IMPL_GNUSTEP_INC@, NS_IMPL_GNUSTEP_TEMACS_LDFLAGS):
+       Move before TEMACS_LDFLAGS.
+       (TEMACS_LDFLAGS): Use $NS_IMPL_GNUSTEP_TEMACS_LDFLAGS.
+       (temacs${EXEEXT}): Do not use $NS_IMPL_GNUSTEP_TEMACS_LDFLAGS.
+
+       * Makefile.in (NOT_C_CODE): No longer define.
+       (config.h): No longer include.
+
+       * Makefile.in (LD_SWITCH_SYSTEM_TEMACS): Move definition after some
+       variables it may reference.
+
+       * Makefile.in (LD_SWITCH_SYSTEM_EXTRA): Remove.
+       (TEMACS_LDFLAGS): Remove LD_SWITCH_SYSTEM_EXTRA.
+
+2010-05-25  Kenichi Handa  <handa@m17n.org>
+
+       * dispextern.h (struct composition_it): New members rule_idx and
+       charpos.
+
+       * xdisp.c (set_iterator_to_next): While scanning backward, assume
+       that the character positions of IT point the last character of the
+       current grapheme cluster.
+       (next_element_from_composition): Don't change character positions
+       of IT.
+       (append_composite_glyph): Set glyph->charpos to
+       it->cmp_it.charpos.
+
+       * composite.c (autocmp_chars): Change the first argument to RULE,
+       and try composition with RULE only.
+       (composition_compute_stop_pos): Record the index number of the
+       composition rule in CMP_IT->rule_idx.
+       (composition_reseat_it): Call autocmp_chars repeatedly until the
+       correct rule of the composition is found.
+       (composition_update_it): Set CMP_IT->charpos.  Assume the CHARPOS
+       is at the last character of the current grapheme cluster when
+       CMP_IT->reversed_p is nonzero.
+
+2010-05-24  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * editfns.c (Fbyte_to_string): New function.
+
+2010-05-24  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * process.c (Fmake_network_process): Set :host to nil if it's not used.
+       Suggested by Masatake YAMATO <yamato@redhat.com>.
+
+2010-05-23  Eli Zaretskii  <eliz@gnu.org>
+
+       * dispextern.h (init_iterator): Sync prototype with changed definition.
+
+2010-05-20  enami tsugutomo  <tsugutomo.enami@jp.sony.com>
+
+       * s/netbsd.h: If terminfo is found, use it in preference to
+       termcap.  (Bug#6190)  [Backport from trunk]
+
+2010-05-19  Eli Zaretskii  <eliz@gnu.org>
+
+       Redesign and reimplement bidi-aware edge positions of glyph rows.
+
+       * dispextern.h (struct glyph_row): New members minpos and maxpos.
+       (MATRIX_ROW_START_CHARPOS, MATRIX_ROW_START_BYTEPOS)
+       (MATRIX_ROW_END_CHARPOS, MATRIX_ROW_END_BYTEPOS): Reference minpos
+       and maxpos members instead of start.pos and end.pos, respectively.
+
+       * xdisp.c (display_line): Compare IT_CHARPOS with the position in
+       row->start.pos, rather than with MATRIX_ROW_START_CHARPOS.
+       (cursor_row_p): Use row->end.pos rather than MATRIX_ROW_END_CHARPOS.
+       (try_window_reusing_current_matrix, try_window_id):
+       Use ROW->minpos rather than ROW->start.pos.
+       (init_from_display_pos, init_iterator): Use EMACS_INT for
+       character and byte positions.
+       (find_row_edges): Rename from find_row_end.  Accept additional
+       arguments for minimum and maximum buffer positions seen by
+       display_line for this row.  Don't use iterator to find the
+       position following the maximum one; instead, increment the
+       position found by display_line directly.  Fix logic; eol_pos
+       should be tested before the rest.  Handle the case of characters
+       delivered from display vector (bug#6036).  Fix tests related to
+       it->method.  Handle the truncated_on_right_p rows.
+       (RECORD_MAX_MIN_POS): New macro.
+       (display_line): Use it to record the minimum and maximum buffer
+       positions for glyphs in the row being assembled.  Record the
+       position of the newline that terminates the line.  If word wrap is
+       in effect, restore minimum and maximum positions seen up to the
+       wrap point, when iterator returns to it.
+       (try_window_reusing_current_matrix): Give up if in bidi-reordered
+       row and cursor not already at point.  Restore original pre-bidi
+       code for unidirectional buffers.
+
+       * dispnew.c (increment_row_positions, check_matrix_invariants):
+       Increment and check row->start.pos and row->end.pos, in addition
+       to MATRIX_ROW_START_CHARPOS and MATRIX_ROW_END_CHARPOS.
+
+       * .gdbinit (prowlims): Display row->minpos and row->maxpos.
+       Display truncated_on_left_p and truncated_on_right_p flags.
+       Formatting fixes.
+       (pmtxrows): Display the ordinal number of each row.  Don't display
+       rows beyond the last one.
+
+       * bidi.c (bidi_cache_iterator_state): Don't zero out new_paragraph:
+       it is not copied by bidi_copy_it.
+
+2010-05-22  Eli Zaretskii  <eliz@gnu.org>
+
+       * w32.c (sys_write): Break writes into chunks smaller than 32MB.
+       (Bug#6237)
+
+2010-05-22  Chong Yidong  <cyd@stupidchicken.com>
+
+       * image.c (Fimage_flush): Rename from image-refresh.
+
+2010-05-21  Chong Yidong  <cyd@stupidchicken.com>
+
+       * xdisp.c (redisplay_internal): Clear caches even if redisplaying
+       just one window.
+
+       * image.c (Vimage_cache_eviction_delay): Decrease to 300.
+       (clear_image_cache): If the number of cached images is unusually
+       large, decrease the cache eviction delay (Bug#6230).
+
+2010-05-21  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (${ns_appdir}, ${ns_appbindir}Emacs, ns-app):
+       Move these rules to ns.mk.
+       * ns.mk: New file.
+
+       * Makefile.in (../src/$(OLDXMENU), $(OLDXMENU)): Always define rules.
+
+       * Makefile.in (CANNOT_DUMP): New, set by configure.
+       (emacs${EXEEXT}, bootstrap-emacs${EXEEXT}): Use $CANNOT_DUMP.
+
+2010-05-20  Juri Linkov  <juri@jurta.org>
+
+       * fileio.c (Fdelete_file): Change interative spec to use
+       `read-file-name' like in `find-file-read-args' where the default
+       value is `default-directory' instead of `buffer-file-name'.
+       http://lists.gnu.org/archive/html/emacs-devel/2010-05/msg00533.html
+
+2010-05-20  Kevin Ryde  <user42@zip.com.au>
+
+       * keyboard.c (Vlast_command, Vkeyboard_translate_table)
+       (Voverriding_terminal_local_map, Vsystem_key_alist)
+       (Vlocal_function_key_map): Fix manual link in docstring (Bug#6224).
+
+2010-05-20  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (DEPDIR): New constant.
+       (DEPFLAGS): Set with configure, not cpp.
+       (MKDEPDIR): New, set by configure.
+       (.c.o, .m.o, ecrt0.o): Use $MKDEPDIR.
+       (clean): Use $DEPDIR.
+       (deps_frag): Include from configure.
+       Move static/dynamic dependency stuff to deps.mk/autodeps.mk.
+       * deps.mk, autodeps.mk: New files, extracted from Makefile.in.
+
+       * bidi.c (bidi_cache_shrink, bidi_cache_iterator_state): Fix
+       reallocation of the cache.  (Bug#6210)
+
+2010-05-19  Glenn Morris  <rgm@gnu.org>
+
+       * s/msdos.h (ORDINARY_LINK): Move to sed2v2.inp.
+
+       * Makefile.in (LD, YMF_PASS_LDFLAGS): Set with configure, not cpp.
+       (GNULIB_VAR): Remove.
+       (LIBES): Use LIB_GCC instead of GNULIB_VAR.
+
+       * m/ibms390x.h (LINKER):
+       * m/macppc.h (LINKER) [GNU_LINUX]:
+       * s/aix4-2.h (ORDINARY_LINK):
+       * s/cygwin.h (LINKER):
+       * s/darwin.h (ORDINARY_LINK):
+       * s/gnu.h (ORDINARY_LINK):
+       * s/netbsd.h (LINKER):
+       * s/usg5-4.h (ORDINARY_LINK):
+       Move to configure.
+
+       * s/aix4-2.h (LINKER): Remove; this file sets ORDINARY_LINK.
+
+2010-05-18  Chong Yidong  <cyd@stupidchicken.com>
+
+       * character.c (Fstring, Funibyte_string): Use SAFE_ALLOCA to
+       prevent stack overflow if number of arguments is too large
+       (Bug#6214).
+
+2010-05-18  Juanma Barranquero  <lekktu@gmail.com>
+
+       * charset.c (load_charset_map_from_file): Don't call close after fclose.
+
+2010-05-18  Glenn Morris  <rgm@gnu.org>
+
+       * s/gnu-linux.h: Combine two conditionals.
+
+       * Makefile.in (otherobj): Include $(VMLIMIT_OBJ) separately from
+       $(POST_ALLOC_OBJ).
+
+       * Makefile.in (RALLOC_OBJ): New, set by configure.
+       (rallocobj): Replace with the previous variable.
+       (otherobj): Use $RALLOC_OBJ.
+
+       * s/gnu.h (REL_ALLOC) [DOUG_LEA_MALLOC]:
+       * s/gnu-linux.h (REL_ALLOC) [DOUG_LEA_MALLOC]: Move undef to configure.
+
+       * Makefile.in (GMALLOC_OBJ, VMLIMIT_OBJ): New, set by configure.
+       (gmallocobj, vmlimitobj): Replace with previous two variables.
+       (otherobj): Use $GMALLOC_OBJ, $VMLIMIT_OBJ.
+
+2010-05-17  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (OLDXMENU_DEPS): New, set by configure.
+       (stamp-oldxmenu): Use $OLDXMENU_DEPS.
+
+2010-05-16  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (${ns_appbindir}Emacs, ns-app): Always define these rules.
+
+       * Makefile.in (clean): Get rid of HAVE_NS conditional.
+
+       * Makefile.in (ns_appdir, ns_appbindir): Now configure adds the
+       trailing "/".
+
+       * Makefile.in (TEMACS_LDFLAGS2): New, set by configure.
+       (temacs${EXEEXT}): Combine the NS_IMPL_GNUSTEP case with the default.
+
+       * Makefile.in (GNUSTEP_SYSTEM_LIBRARIES): Remove, unused.
+       (NS_IMPL_GNUSTEP_TEMACS_LDFLAGS): New, set by configure.
+       (LD) [NS_IMPL_GNUSTEP]: Set to $(CC) -rdynamic.
+       (temacs${EXEEXT}): Remove $LOCALCPP, never defined or referenced.
+       Make most of the NS_IMPL_GNUSTEP case the same as the default case.
+
+       * Makefile.in (temacs${EXEEXT}) [!NS_IMPL_GNUSTEP]:
+       Remove ${STARTFLAGS}, nothing ever sets it.
+
+2010-05-16  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * m/ia64.h (UNEXEC): Remove, set in s/*.h.
+
+2010-05-16  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (LIBX_BASE): Always define.
+
+       * Makefile.in (LIBX_OTHER): Move out of cpp section.
+
+       * Makefile.in (LIBXT): Always define.
+
+2010-05-15  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (OLDXMENU, LIBXMENU, LIBX_OTHER): Always define.
+
+       * Makefile.in (FONT_DRIVERS): Remove, replace with $FONT_OBJ.
+       (obj, SOME_MACHINE_OBJECTS): Use $FONT_OBJ.
+
+2010-05-15  Ken Raeburn  <raeburn@raeburn.org>
+
+       * lisp.h (XFLOAT_DATA): Use "0?x:x" to generate an rvalue.  (Bug#5916)
+       (LISP_MAKE_RVALUE) [!USE_LISP_UNION_TYPE && !__GNUC__]: Likewise.
+
+       * emacs.c (main): Initialize initial-environment and
+       process-environment before generating from env, not after.
+
+       Handle --version reasonably in CANNOT_DUMP configuration.
+       * emacs.c (emacs_version, emacs_copyright): New string variables.
+       (Vemacs_version, Vemacs_copyright): New Lisp_Object variables.
+       (syms_of_emacs): Defvar them, and initialize them from the C
+       string variables.
+       (main): If initialization hasn't been done, print initial version
+       info from the C strings, instead of starting an interactive session.
+
+2010-05-15  Eli Zaretskii  <eliz@gnu.org>
+
+       * bidi.c (bidi_paragraph_init): Don't leave alone garbage values
+       of bidi_it->paragraph_dir.  Call bidi_initialize if needed.
+       (bidi_paragraph_init): Remove redundant assertion that we are at
+       the beginning of a line after call to bidi_find_paragraph_start.
+
+       * xdisp.c (Fcurrent_bidi_paragraph_direction): New function.
+       (syms_of_xdisp): Defsubr it.
+
+       * cmds.c (Fforward_char, Fbackward_char): Doc fix.
+
+       * Makefile.in: Fix MSDOS-related comments.
+
+2010-05-15  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (OLDXMENU_TARGET): New, set by configure.
+       (really-lwlib, really-oldXMenu): Always define.
+       ($OLDXMENU): Depend on $OLDXMENU_TARGET.
+
+       * Makefile.in: Simplify cpp conditional.
+
+       * Makefile.in (${ns_appdir}): Simplify using umask.
+
+       * Makefile.in (${ns_appdir}): Remove references to CVS-related files.
+
+2010-05-14  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * eval.c (specbind): Remove left-over duplicate test.
+       Disallow let-binding frame-local vars.  Add comment.
+
+2010-05-14  Eli Zaretskii  <eliz@gnu.org>
+
+       Make the cache of bidi iterator states dynamically allocated.
+       * bidi.c (bidi_cache_shrink): New function.
+       (bidi_init_it): Call it.
+       (bidi_cache_iterator_state): Enlarge the cache if needed.
+
+       * bidi.c (bidi_move_to_visually_next): Rename from
+       bidi_get_next_char_visually.  All callers changed.
+
+2010-05-14  Kenichi Handa  <handa@m17n.org>
+
+       * dispextern.h (struct composition_it): New member reversed_p.
+
+       * composite.c (composition_compute_stop_pos): Search backward if
+       ENDPOS < CHARPOS.
+       (composition_reseat_it): Handle the case that ENDPOS < CHARPOS.
+       Set CMP_IT->reversed_p.
+       (composition_update_it): Pay attention to CMP_IT->reversed_p.
+
+       * xdisp.c (set_iterator_to_next):
+       Call composition_compute_stop_pos with negative ENDPOS if we are
+       scanning backward.  Call composition_compute_stop_pos if scan
+       direction is changed.
+       (next_element_from_buffer): Call composition_compute_stop_pos with
+       negative ENDPOS if we are scanning backward.
+       (next_element_from_composition): Pay attention to
+       IT->cmp_it.reversed_p.
+
+2010-05-14  Kenichi Handa  <handa@m17n.org>
+
+       * font.c (font_range): Return the range for the font found at first.
+
+2010-05-14  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (ns_appdir, ns_appbindir, ns_appsrc): Always define.
+
+       * Makefile.in (mktime, X11, register): Move undefs to configure.
+
+       * Makefile.in (MSDOS_OBJ): Default to empty, let msdos scripts set it.
+       (MSDOS_X_OBJ): New variable.
+       (MSDOS_SUPPORT_REAL): New constant.
+       (MSDOS_SUPPORT): Set as a variable, not with cpp.
+       (obj): Use MSDOS_X_OBJ.
+       (lisp): Use MSDOS_SUPPORT as a variable.
+
+       * Makefile.in (REAL_MOUSE_SUPPORT): New constant.
+       (GPM_MOUSE_SUPPORT): Now it's a constant.
+       (MOUSE_SUPPORT, TOOLTIP_SUPPORT, WINDOW_SUPPORT): Set with configure,
+       not cpp.
+
+       * Makefile.in (@NS_IMPL_GNUSTEP_INC@): Use in place of #ifdef.
+       (ns_appresdir): Remove, unused.
+
+       * Makefile.in (SHELL): Move outside cpp section.
+
+       * s/netbsd.h (AMPERSAND_FULL_NAME): Remove (defined in AH_BOTTOM).
+
+2010-05-13  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (FONT_DRIVERS): Place with other HAVE_X_WINDOWS stuff.
+       (TOOLTIP_SUPPORT): Place with other HAVE_WINDOW_SYSTEM stuff.
+
+       * Makefile.in (FONT_DRIVERS): If HAVE_X_WINDOWS is defined,
+       HAVE_WINDOW_SYSTEM must be too.
+
+       * Makefile.in (WINNT_SUPPORT): Remove, nt build does not use this file.
+       (lisp): Remove WINNT_SUPPORT.
+
+       * Makefile.in (OLDXMENU, LIBXMENU) [!HAVE_MENUS]:
+       Let configure set these variables (to empty) in this case as well.
+
+       * Makefile.in (LD_SWITCH_X_SITE): Define as a variable, not via cpp.
+       (LIBX_BASE): Use $LD_SWITCH_X_SITE.
+
+       * Makefile.in (C_SWITCH_X_SYSTEM, C_SWITCH_X_SITE, LIB_STANDARD)
+       (LIB_MATH, FONTCONFIG_CFLAGS, FONTCONFIG_LIBS, FREETYPE_CFLAGS)
+       (FREETYPE_LIBS, LIBOTF_CFLAGS, LIBOTF_LIBS, M17N_FLT_CFLAGS)
+       (M17N_FLT_LIBS, GNU_OBJC_CFLAGS, GNUSTEP_SYSTEM_LIBRARIES, LIBGPM)
+       (LIBRESOLV, UNEXEC_OBJ): For clarity, define variables to hold
+       the values output by configure.
+       (ALL_CFLAGS, obj, LIBES, temacs${EXEEXT}): Use the above variables.
+
+2010-05-12  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (YMF_PASS_LDFLAGS, LD, LINKER): Simplify the logic.
+       (LINKER_WAS_SPECIFIED): Remove.
+
+       * Makefile.in (LIB_GCC): Set using configure, not cpp.
+       (GNULIB_VAR) [!ORDINARY_LINK]: Always set to $LIB_GCC.
+       * m/arm.h (LIB_GCC) [GNU_LINUX]:
+       * s/cygwin.h (LIB_GCC):
+       * s/freebsd.h (LIB_GCC):
+       * s/gnu-linux.h (LIB_GCC):
+       * s/msdos.h (LIB_GCC):
+       * s/netbsd.h (LIB_GCC):
+       Move to configure.
+
+2010-05-11  Karel Klic  <kklic@redhat.com>
+
+       * ftfont.c: Fix incorrect parentheses of #if condition for
+       definining M17N_FLT_USE_NEW_FEATURE.
+
+2010-05-11  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (LIBS_SYSTEM) [MSDOS]: Do not reset.
+       * s/msdos.h (MSDOS_LIBS_SYSTEM): Remove.
+
+2010-05-10  Eli Zaretskii  <eliz@gnu.org>
+
+       * xdisp.c (init_iterator): Don't turn on bidi reordering in
+       unibyte buffers.  See
+       http://lists.gnu.org/archive/html/emacs-devel/2010-05/msg00263.html.
+
+2010-05-10  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (LIBS_SYSTEM): Set using configure, not cpp.
+       (LIBS_SYSTEM) [MSDOS]: Reset with MSDOS_LIBS_SYSTEM.
+       (LIBES): Use LIBS_SYSTEM as a variable.
+       * s/msdos.h (LIBS_SYSTEM): Rename to MSDOS_LIBS_SYSTEM.  Always define.
+       * s/aix4-2.h (LIBS_SYSTEM):
+       * s/freebsd.h (LIBS_SYSTEM):
+       * s/hpux10-20.h (LIBS_SYSTEM):
+       * s/sol2-6.h (LIBS_SYSTEM):
+       * s/unixware.h (LIBS_SYSTEM):
+       Move to configure.
+
+       * s/aix4-2.h (MAIL_USE_LOCKF):
+       * s/bsd-common.h (MAIL_USE_FLOCK):
+       * s/darwin.h (MAIL_USE_FLOCK):
+       * s/gnu-linux.h (MAIL_USE_FLOCK):
+       * s/irix6-5.h (MAIL_USE_FLOCK):
+       * s/template.h (MAIL_USE_FLOCK):
+       Move to configure.
+
+2010-05-08  Chong Yidong  <cyd@stupidchicken.com>
+
+       * Version 23.2 released.
+
+2010-05-08  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * composite.c (autocmp_chars): Save point as marker before calling
+       auto-composition-function (Bug#5984).
+
+       * lisp.h (restore_point_unwind): Add prototype.
+
+       * fileio.c (restore_point_unwind): Remove static attribute.
+
+2010-05-08  Kenichi Handa  <handa@m17n.org>
+
+       * ftfont.c (M17N_FLT_USE_NEW_FEATURE): Define it if we can use the
+       new feature of libotf and m17n-flt.
+       (ftfont_check_otf) [M17N_FLT_USE_NEW_FEATURE]:
+       Call OTF_check_features even if no specific feature is given.
+       (PACK_OTF_TAG) [M17N_FLT_USE_NEW_FEATURE]: New macro.
+       (ftfont_drive_otf) [M17N_FLT_USE_NEW_FEATURE]: Handle the case
+       that OUT is NULL.  Use OTF_drive_gsub_with_log and
+       OTF_drive_gpos_with_log instead of OTF_drive_gsub and
+       OTF_drive_gpos.
+       (ftfont_try_otf) [M17N_FLT_USE_NEW_FEATURE]: New function.
+       (ftfont_shape_by_flt) [M17N_FLT_USE_NEW_FEATURE]:
+       Setup mflt_enable_new_feature and mflt_try_otf.
+
+2010-05-08  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * xsettings.c (Ftool_bar_get_system_style): Correct comment.
+
+       * gtkutil.c (xg_pack_tool_bar): Change show_all to show for handle
+       box and toolbar (Bug #6139).
+       (xg_create_tool_bar): Remove comment (Bug #6139).
+       (xg_make_tool_item): Remove gtk_widget_show_all (Bug #6139).
+       (xg_show_toolbar_item): Add gtk_widget_show for weventbox (Bug #6139).
+
+2010-05-08  Juanma Barranquero  <lekktu@gmail.com>
+
+       * makefile.w32-in ($(BLD)/eval.$(O), $(BLD)/w32fns.$(O)):
+       Update dependencies.
+
+2010-05-08  Eli Zaretskii  <eliz@gnu.org>
+
+       * fringe.c (update_window_fringes): Set up truncation bitmaps for
+       R2L lines.
+
+2010-05-08  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (THIS_IS_MAKEFILE): Remove, unused.
+
+       * Makefile.in (LIBS_TERMCAP): Set with configure, not cpp.
+       (TERMCAP_OBJ): New, set by configure, replacing termcapobj.
+       (termcapobj): Replace with TERMCAP_OBJ.
+       (otherobj): Use $TERMCAP_OBJ instead of $termcapobj.
+       (LIBES): Use LIBS_TERMCAP as a variable.
+
+       * s/freebsd.h (osreldate.h): No longer include, since this file
+       does not use __FreeBSD_version any more.
+
+       * s/aix4-2.h (TERMINFO):
+       * s/cygwin.h (TERMINFO):
+       * s/darwin.h (TERMINFO, LIBS_TERMCAP) [HAVE_LIBNCURSES]:
+       * s/freebsd.h (TERMINFO, LIBS_TERMCAP):
+       * s/gnu-linux.h (TERMINFO, LIBS_TERMCAP) [HAVE_LIBNCURSES]:
+       * s/gnu.h (TERMINFO, LIBS_TERMCAP) [HAVE_LIBNCURSES]:
+       * s/hpux10-20.h (TERMINFO, LIBS_TERMCAP):
+       * s/irix6-5.h (TERMINFO):
+       * s/netbsd.h (LIBS_TERMCAP):
+       * s/openbsd.h (TERMINFO, LIBS_TERMCAP):
+       * s/sol2-6.h (LIBS_TERMCAP) [!TERMINFO]:
+       * s/usg5-4.h (TERMINFO):
+       Move to configure.
+
+2010-05-07  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * eval.c (unbind_to): Don't unbind a local binding into the global
+       binding when the local binding disappeared.  Inversely, don't unbind
+       a global binding into a newly created local binding.
+       * data.c (set_internal): Make its `buf' arg into a `where' arg so we
+       can specify the frame to use, when applicable.  Adjust callers.
+
+2010-05-07  Vincent Belaïche  <vincent.belaiche@gmail.com>
+            Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * floatfns.c (Fisnan, Fcopysign, Ffrexp, Fldexp): New functions.
+
+2010-05-07  Eli Zaretskii  <eliz@gnu.org>
+
+       * w32fns.c: Include w32.h.
+       (Fw32_shell_execute): Decode the error message before passing it
+       to `error'.  (Bug#6126)
+
+       * msdos.c (dos_set_window_size):
+       * w16select.c (Fx_selection_exists_p): Use `Fsymbol_value (foo)'
+       instead of `XSYMBOL (foo)->value'.
+
+2010-05-07  Eli Zaretskii  <eliz@gnu.org>
+
+       Fix the MS-DOS build, broken by autoconfiscation.
+
+       * Makefile.in: Don't use Make-style comments past the "start of
+       cpp stuff" line.
+       (MSDOS_OBJ): Remove xmenu.o (it is now defined by XMENU_OBJ).
+
+       * s/msdos.h (UNEXEC): Don't define (@unexec@ in Makefile.in is
+       edited directly by msdos/sed1v2.inp).
+
+2010-05-07  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (LD_SWITCH_SYSTEM): Set with configure, not cpp.
+       (LD_SWITCH_SYSTEM_EXTRA): New variable, set by configure.
+       (TEMACS_LDFLAGS): Use $LD_SWITCH_SYSTEM and $LD_SWITCH_SYSTEM_EXTRA,
+       move out of cpp section.
+       * s/freebsd.h (LD_SWITCH_SYSTEM):
+       * s/gnu-linux.h (LD_SWITCH_SYSTEM):
+       * s/netbsd.h (LD_SWITCH_SYSTEM):
+       * s/openbsd.h (LD_SWITCH_SYSTEM): Move to configure.in.
+
+2010-05-07  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       Define LIB_STANDARD and START_FILES using autoconf.
+       * s/usg5-4.h (LIB_STANDARD):
+       * s/netbsd.h (START_FILES):
+       * s/irix6-5.h (LIB_STANDARD):
+       * s/hpux10-20.h (LIB_STANDARD, START_FILES):
+       * s/gnu-linux.h (START_FILES, LIB_STANDARD):
+       * s/freebsd.h (START_FILES):
+       * s/darwin.h (START_FILES):
+       * s/cygwin.h (START_FILES):
+       * s/aix4-2.h (LIB_STANDARD):
+       * m/ibmrs6000.h (START_FILES): Remove, move logic to configure.in.
+       * Makefile.in (STARTFILES): Rename to START_FILES, define using
+       autoconf, not cpp.
+
+2010-05-06  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       Remove NEED_BSDTTY and NEED_UNISTD_H.
+       * s/hpux10-20.h (NEED_BSDTTY): Remove.
+       * s/aix4-2.h (NEED_UNISTD_H): Remove.
+       * systty.h: Simplify conditionals for including <sys/bsdtty.h>,
+       <sys/ptyio.h> and <unistd.h>.
+
+       * emacs.c (main): Remove NO_DIR_LIBRARY conditional, unused.
+
+       * Makefile.in (STARTFILES): Conditionally define to make the usage clear.
+       * s/gnu.h (START_FILES): Remove empty definition.
+
+2010-05-06  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * xterm.c (x_draw_image_relief): Move declaration of extra to beginning.
+
+2010-05-06  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (CPP, LN_S): Remove unused variables.
+
+2010-05-05  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * syntax.c (Fchar_syntax): Check the arg is a character (bug#6080).
+
+2010-05-05  Lawrence Mitchell  <wence@gmx.li>
+
+       * m/sparc.h: Fix typo in earlier change.
+
+2010-05-04  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       Misc tweaks.
+       * eval.c (Fdefvaralias): Remove unintended nested if.
+       (internal_condition_case_2, internal_condition_case_n): Use ANSI type.
+
+2010-05-04  Bernhard Herzog  <bh@intevation.de>  (tiny change)
+
+       * xsmfns.c (smc_save_yourself_CB): strlen(client_id) => strlen(cwd).
+
+2010-05-04  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       Remove BSD_PGRPS.
+       * s/bsd-common.h (BSD_PGRPS): Remove undef.
+       * s/gnu-linux.h (BSD_PGRPS): Remove.
+       * term.c (dissociate_if_controlling_tty):
+       * sysdep.c (narrow_foreground_group, widen_foreground_group)
+       (init_sys_modes, reset_sys_modes):
+       * emacs.c (main):
+       * callproc.c (Fcall_process, child_setup): Remove code depending
+       on BSD_PGRPS.
+
+       Remove POSIX_SIGNALS.
+       * s/usg5-4.h (POSIX_SIGNALS):
+       * s/netbsd.h (POSIX_SIGNALS):
+       * s/msdos.h (POSIX_SIGNALS):
+       * s/ms-w32.h (POSIX_SIGNALS):
+       * s/hpux11.h (POSIX_SIGNALS):
+       * s/gnu.h (POSIX_SIGNALS):
+       * s/gnu-linux.h (POSIX_SIGNALS):
+       * s/freebsd.h (POSIX_SIGNALS):
+       * s/darwin.h (POSIX_SIGNALS):
+       * s/cygwin.h (POSIX_SIGNALS):
+       * s/aix4-2.h (POSIX_SIGNALS): Remove definition.
+       * s/unixware.h:
+       * s/sol2-6.h: Remove comments on POSIX_SIGNALS.
+       * process.c (create_process):
+       * syssignal.h:
+       * sysdep.c (wait_for_termination, init_signals):
+       * process.c (create_process):
+       * msdos.c: POSIX_SIGNALS is always defined on all platforms,
+       remove all code that assumes the contrary.
+
+2010-05-04  Glenn Morris  <rgm@gnu.org>
+
+       * s/gnu-linux.h (LD_SWITCH_SYSTEM): Use LD_SWITCH_X_SITE_AUX as a shell
+       variable.
+       * s/netbsd.h (LD_SWITCH_SYSTEM_tmp): Remove.
+       (LD_SWITCH_SYSTEM): Use $LD_SWITCH_X_SITE_AUX_RPATH.
+       * s/openbsd.h (LD_SWITCH_SYSTEM_tmp): Remove.
+       (LD_SWITCH_SYSTEM): Use $LD_SWITCH_X_SITE_AUX_RPATH instead of
+       LD_SWITCH_SYSTEM_tmp.
+       * Makefile.in (LD_SWITCH_X_SITE_AUX, LD_SWITCH_X_SITE_AUX_RPATH):
+       New variables, set by configure.
+
+       * s/aix4-2.h (LD_SWITCH_SYSTEM_TEMACS): Move to configure.in.
+       * s/darwin.h (HEADERPAD_EXTRA, LIBS_NSGUI): Remove.
+       (LD_SWITCH_SYSTEM_TEMACS): Move to configure.in.
+       * Makefile.in (LD_SWITCH_SYSTEM_TEMACS): New variable, set by configure.
+       (TEMACS_LDFLAGS): Use $LD_SWITCH_SYSTEM_TEMACS.
+
+       * s/aix4-2.h (C_SWITCH_SYSTEM):
+       * m/alpha.h (C_SWITCH_MACHINE):
+       Move to configure.in.
+       * Makefile.in (C_SWITCH_MACHINE, C_SWITCH_SYSTEM):
+       New variables, set by configure.
+       (ALL_CFLAGS): Use $C_SWITCH_MACHINE and $C_SWITCH_SYSTEM in place of
+       $c_switch_machine and $c_switch_system.
+
+2010-05-04  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * s/hpux10-20.h (LIB_STANDARD): New definition.
+       * Makefile.in (ORDINARY_LINK): Remove setting LIB_STANDARD based
+       on it, not used anymore.
+
+2010-05-03  Chong Yidong  <cyd@stupidchicken.com>
+
+       * eval.c (internal_condition_case_n): Rename from
+       internal_condition_case_2.
+       (internal_condition_case_2): New function.
+
+       * xdisp.c (safe_call): Use internal_condition_case_n.
+
+       * fileio.c (Fdelete_file, internal_delete_file): New arg FORCE.
+       (internal_delete_file, Frename_file): Callers changed.
+
+       * buffer.c (Fkill_buffer):
+       * callproc.c (delete_temp_file): Callers changed (Bug#6070).
+
+       * lisp.h: Update prototypes.
+
+2010-05-03  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (LIBX_EXTRA, LIBX_BASE): New variables.
+       (LIBXT_OTHER, LIBX_OTHER): New, set by configure.
+       (LIBXT): Set with configure, not cpp.
+       (LIBX): Remove.
+       (LIBES): Replace $LIBX with $LIBX_BASE and $LIBX_OTHER.
+
+2010-05-02  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * m/amdx86-64.h (START_FILES, LIB_STANDARD): Remove.
+       The FreeBSD is not needed, the default works, Solaris version is
+       not needed, and the remaining case is not supported by configure.
+
+2010-05-02  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * xsmfns.c (CHDIR_OPT): New define.
+       (smc_save_yourself_CB): Add CHDIR_OPT to options to use when
+       restarting emacs.
+
+       * xterm.c (x_connection_closed): Call Fkill_emacs instead of
+       shut_down_emacs.
+
+       * emacs.c (USAGE1): Mention --chdir.
+       (main): Handle --chdir.
+       (standard_args): Add --chdir.
+       (fatal_error_signal): Call Fkill_emacs for SIGTERM and SIGHUP (Bug
+       #5552).
+
+2010-05-01  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       Remove LD_SWITCH_MACHINE.
+       * Makefile.in (LD_SWITCH_MACHINE): Remove definition, unused.
+       (TEMACS_LDFLAGS): Do not use LD_SWITCH_MACHINE.
+
+       Clean up IRIX code.
+       * m/iris4d.h (TERMINFO, FIRST_PTY_LETTER): Move definitions ...
+       * s/irix6-5.h (TERMINFO, FIRST_PTY_LETTER): ... here.
+
+       Clean up AIX code.
+       * m/ibmrs6000.inp: Remove file, unused.
+       * m/ibmrs6000.h (IBMR2AIX): Remove, unused.
+       (LD_SWITCH_MACHINE): Rename to LD_SWITCH_SYSTEM_TEMACS, and move
+       definition ...
+       * s/aix4-2.h (LD_SWITCH_SYSTEM_TEMACS): ... here.
+
+       * sysdep.c (child_setup_tty, init_sys_modes): Remove !IBMR2AIX code,
+       unused.
+
+2010-05-01  Eli Zaretskii  <eliz@gnu.org>
+
+       Emulate POSIX_SIGNALS on MS-Windows.
+
+       * s/ms-w32.h (POSIX_SIGNALS, struct sigaction, SIG_BLOCK)
+       (SIG_SETMASK, SIG_UNBLOCK): Define.
+
+       * sysdep.c (sys_signal) [WINDOWSNT]: #ifdef away.
+       (wait_for_termination) [WINDOWSNT]: Move MS-Windows specific code
+       from non-POSIX_SIGNALS section to POSIX_SIGNALS section.
+
+       * w32.c (sigemptyset, sigaddset, sigfillset, sigprocmask):
+       New stubs.
+
+       Miscellaneous fixes of bidi display.
+
+       * xdisp.c (find_row_end): New function, refactored from display_line.
+       (display_line): Use it.
+       (extend_face_to_end_of_line): In almost-filled rows, extend only
+       if the row is R2L and not continued.
+       (display_line): Fix prepending of truncation glyphs to R2L rows.
+       Preserve overlay and string info in row->end.
+       (insert_left_trunc_glyphs): Support addition of left truncation
+       glyphs to R2L rows.
+       (set_cursor_from_row): Don't place cursor on the vertical border
+       glyph between adjacent windows.  Fix a crash when a display string
+       is continued to the next line.  Don't return zero if cursor was
+       found by `cursor' property of a display string.
+       (try_cursor_movement): Don't assume that row->end == (row+1)->start,
+       test for that explicitly.
+
+2010-05-01  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (gmallocobj, rallocobj, vmlimitobj): Initialize to null,
+       for clarity.
+       (OTHER_OBJ): Remove.
+       (PRE_ALLOC_OBJ, POST_ALLOC_OBJ): New, set by configure.
+       (otherobj): Use PRE_ALLOC_OBJ, POST_ALLOC_OBJ rather than OTHER_OBJ.
+
+2010-05-01  Karel Klíč  <kklic@redhat.com>
+
+       * fileio.c (Ffile_selinux_context): Context functions may return null.
+
+2010-04-30  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * s/gnu.h (POSIX_SIGNALS, START_FILES): New definitions.
+
+2010-04-30  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (vmlimitobj) [!SYSTEM_MALLOC]: New variable.  (Bug#6065)
+       (OTHER_OBJ): Define as a separate variable, for clarity.
+
+2010-04-30  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * xsettings.c: include limits.h and update file comment.
+
+2010-04-30  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (OLDXMENU, LIBXMENU) [HAVE_MENUS]:
+       Set with configure, not cpp.
+       (LIBW): Remove, replace with $TOOLKIT_LIBW.
+
+       * Makefile.in (mallocobj): Remove.
+       (otherobj): Simplify using @OTHER_OBJ@.
+
+       * Makefile.in (dispnew.o, frame.o, fringe.o, font.o, fontset.o)
+       (keyboard.o, window.o, xdisp.o, xfaces.o, menu.o):
+       Don't bother making nsgui.h dependency platform-specific.
+
+       * Makefile.in (nsfns.o): Remove duplicate nsgui.h dependency.
+
+2010-04-29  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * process.c (read_process_output, exec_sentinel): Don't burp if the
+       sentinel/filter kills the current buffer (bug#6060).
+
+       Fix wrong-docstring problem introduced with hash-consing.  (Bug#6008)
+       * eval.c (Fautoload): Set doc to a unique number rather than to 0.
+       Remove unused var `args'.
+       * lisp.h (XSETCARFASTINT, XSETCDRFASTINT): Remove.
+       (LOADHIST_ATTACH): Wrap with do...while to avoid surprises for callers.
+       * doc.c (store_function_docstring): Use XSETCAR.
+
+2010-04-28  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (BASE_WINDOW_SUPPORT, X_WINDOW_SUPPORT): New variables.
+       (WINDOW_SUPPORT) [HAVE_WINDOW_SYSTEM]: Use them.
+
+       * Makefile.in (CYGWIN_OBJ): Set with configure, not cpp.
+
+       * Makefile.in (GPM_MOUSE_SUPPORT): New, set by configure.
+       (MOUSE_SUPPORT) [!HAVE_MOUSE]: Use $GPM_MOUSE_SUPPORT.
+
+       * Makefile.in (FONT_OBJ): New, set by configure.
+       (FONT_DRIVERS): Use $FONT_OBJ.
+
+       * Makefile.in (LIBXMU): Set with configure, not cpp.
+       * s/aix4-2.h (LIBXMU):
+       * s/hpux10-20.h (LIBXMU):
+       Remove definition, now set in configure.
 
-2010-08-17  Andreas Schwab  <schwab@linux-m68k.org>
+       * Makefile.in (NS_OBJ, NS_SUPPORT): Set with configure, not cpp.
 
-       * eval.c (Flet, Feval, Fapply, apply_lambda): Use SAFE_ALLOCA_LISP
-       instead of SAFE_ALLOCA.
+       * m/amdx86-64.h [i386]: Move this test to configure.in.
 
-2010-08-17  Chong Yidong  <cyd@stupidchicken.com>
+2010-04-27  Glenn Morris  <rgm@gnu.org>
 
-       * eval.c (Flet, Feval, Fapply, apply_lambda): Use SAFE_ALLOCA
-       (Bug#6214).
+       * Makefile.in (LIBXTR6): Set with configure, not cpp.
+       * s/unixware.h (NEED_LIBW): Remove definition.
 
-2010-08-14  Jan Djärv  <jan.h.d@swipnet.se>
+       * Makefile.in (LUCID_LIBW, MOTIF_LIBW): Remove, replacing by...
+       (TOOLKIT_LIBW): New, set by configure.
+       (@X_TOOLKIT_TYPE@): No longer define it.
 
-       * doc.c (Fsnarf_documentation): Set skip_file only if p[1] is S.
+       * Makefile.in (LIBXP): Remove, since included in MOTIF_LIBW.
+       (MOTIF_LIBW): Set with configure, not cpp.
+       * s/aix4-2.h (LIB_MOTIF):
+       * s/gnu-linux.h (LIB_MOTIF):
+       * s/unixware.h (LIB_MOTIF): Move to configure.in.
 
-2010-08-13  Jan Djärv  <jan.h.d@swipnet.se>
+2010-04-27  Dan Nicolaescu  <dann@ics.uci.edu>
 
-       * doc.c (Fsnarf_documentation): Initialize skip_file before
-       build-files test.
+       Reduce CPP usage.
+       * Makefile.in (LIB_X11_LIB): Remove, inline in the only user.
+       (obj): Use autoconf for unexec instead of cpp.
+       (C_SWITCH_SYSTEM, C_SWITCH_MACHINE, C_SWITCH_X_SITE): Remove
+       definitions and undefs.  Inline definitions in the only user.
+       (ALL_CFLAGS): Substitute C_SWITCH_X_SYSTEM using autoconf.
 
-2010-08-09  Peter O'Gorman <pogma@thewrittenword.com>  (tiny change)
+2010-04-27  Glenn Morris  <rgm@gnu.org>
 
-       * s/hpux10-20.h (HAVE_TERMIOS, NO_TERMIO, ORDINARY_LINK): New
-       definitions.
-       (HAVE_TERMIO): Remove.
+       * m/amdx86-64.h (START_FILES, LIB_STANDARD): Change the logic around,
+       since the defaults (set by the system file) are fine in most cases.
+       [GNU_LINUX, __OpenBSD__, __NetBSD__, __APPLE__]: Remove sections.
+       * m/ibms390x.h (START_FILES, LIB_STANDARD):
+       * m/macppc.h (START_FILES, LIB_STANDARD) [GNU_LINUX]:
+       * m/sparc.h (START_FILES, LIB_STANDARD) [__linux__]:
+       Remove definitions, since they are set correctly in s/gnu-linux.h.
+       * s/freebsd.h (START_FILES, LIB_STANDARD):
+       * s/gnu-linux.h (START_FILES, LIB_STANDARD):
+       * s/hpux10-20.h (START_FILES):
+       * s/netbsd.h (START_FILES, LIB_STANDARD, START_FILES_1, END_FILES_1):
+       Use $CRT_DIR in place of fixed /usr/lib, /lib directories.
 
-2010-08-06  Kenichi Handa  <handa@m17n.org>
+       * Makefile.in (LIBXP, LUCID_LIBW, WIDGET_OBJ): Set via configure.
+       (MOTIF_LIBW): Use $LIBXP.
+       (otherobj): Use $WIDGET_OBJ.
 
-       * charset.c: Include <stdlib.h>
-       (struct charset_sort_data): New struct.
-       (charset_compare): New function.
-       (Fsort_charsets): New funciton.
-       (syms_of_charset): Declare Fsort_charsets as a Lisp function.
+2010-04-26  Dan Nicolaescu  <dann@ics.uci.edu>
 
-       * coding.c (decode_coding_iso_2022): Fix checking of dimension
-       number in CTEXT extended segment.
+       * Makefile.in (LIBS_MACHINE): Remove, unused.
 
-2010-08-01  Juanma Barranquero  <lekktu@gmail.com>
+       Use autoconf instead of cpp for LIB_MATH.
+       * s/darwin.h (LIB_MATH): Do not define here, move to configure.
+       * s/cygwin.h (LIB_MATH): Likewise.
+       * Makefile.in (LIB_MATH): Do not define with cpp.
+       (LIBES): Use autoconf for LIB_MATH.
 
-       * w32fns.c (syms_of_w32fns) <x-max-tooltip-size>: Fix typo in docstring.
-       * xfns.c (syms_of_xfns) <x-max-tooltip-size>: Reflow docstring.
+2010-04-26  Kenichi Handa  <handa@m17n.org>
 
-2010-07-30  Juanma Barranquero  <lekktu@gmail.com>
+       * composite.c (Ffind_composition_internal): Fix the return value
+       for an automatic composition.
 
-       * fns.c (Fsubstring_no_properties, Fnthcdr, Ffeaturep)
-       (Fhash_table_size): Fix typos in docstrings.
-       (Fmake_hash_table): Doc fix.
+2010-04-25  Dan Nicolaescu  <dann@ics.uci.edu>
 
-2010-07-28  Juanma Barranquero  <lekktu@gmail.com>
+       Remove all NO_ARG_ARRAY uses.
+       * fns.c (concat2, concat3, nconc2):
+       * eval.c (apply1, call1, call2, call3, call4, call5, call6)
+       (call7): Remove NO_ARG_ARRAY usage, assume it's always true.
+       * m/xtensa.h (NO_ARG_ARRAY):
+       * m/template.h (NO_ARG_ARRAY):
+       * m/sparc.h (NO_ARG_ARRAY):
+       * m/sh3.h (NO_ARG_ARRAY):
+       * m/mips.h (NO_ARG_ARRAY):
+       * m/macppc.h (NO_ARG_ARRAY):
+       * m/iris4d.h (NO_ARG_ARRAY):
+       * m/intel386.h (NO_ARG_ARRAY):
+       * m/ibms390x.h (NO_ARG_ARRAY):
+       * m/ibms390.h (NO_ARG_ARRAY):
+       * m/ibmrs6000.h (NO_ARG_ARRAY):
+       * m/ia64.h (NO_ARG_ARRAY):
+       * m/hp800.h (NO_ARG_ARRAY):
+       * m/arm.h (NO_ARG_ARRAY):
+       * m/amdx86-64.h (NO_ARG_ARRAY):
+       * m/alpha.h (NO_ARG_ARRAY): Remove definition.
 
-       * minibuf.c (syms_of_minibuf) <read-buffer-function>:
-       Doc fix (bug#5625).
+2010-04-25  Eli Zaretskii  <eliz@gnu.org>
 
-2010-07-27  Ken Brown  <kbrown@cornell.edu>
+       * xdisp.c (display_line): Don't assume 2nd call to
+       get_next_display_element cannot return zero.  (Bug#6030)
+       (iterate_out_of_display_property): New function, body from pop_it.
+       (pop_it): Use it.
 
-       * dired.c (DIRENTRY_NONEMPTY) [cygwin]: Use d_ino instead of
-       the MSDOS definition.
+2010-04-24  Glenn Morris  <rgm@gnu.org>
 
-2010-07-25  Christoph Scholtes  <cschol2112@gmail.com>
+       * m/amdx86-64.h (START_FILES, LIB_STANDARD) [__OpenBSD__]:
+       For clarity, revert to using fixed /usr/lib rather than $CRT_DIR.
+       (START_FILES, LIB_STANDARD) [__FreeBSD__]: Merge into the generic case,
+       since CRT_DIR defaults to /usr/lib.  Suggested by Dan Nicolaescu.
 
-       * minibuf.c (Fread_buffer): Doc fix (bug#6528).
+2010-04-24  Eli Zaretskii  <eliz@gnu.org>
 
-2010-07-22  Christoph Scholtes  <cschol2112@gmail.com>
+       * xdisp.c (display_line): Use `reseat' instead of `reseat_1', and
+       use `get_next_display_element' and `set_iterator_to_next' to
+       advance to the next character, when looking for the character that
+       begins the next row.
+
+       * .gdbinit: Add a "set Fmake_symbol" line to force GDB to load the
+       definition of "struct Lisp_Symbol".
+
+2010-04-24  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (CRT_DIR): New variable, set by configure.
+       * m/amdx86-64.h, m/ibms390x.h (START_FILES, LIB_STANDARD):
+       Use $CRT_DIR rather than HAVE_LIB64_DIR.  (Bug#5655)
+
+2010-04-23  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * Makefile.in: Remove C_SWITCH_X_MACHINE, unused.
+
+       * s/cygwin.h (LIBS_DEBUG): Remove, unused.
+
+       Remove redundant flags.
+       * s/freebsd.h (C_SWITCH_SYSTEM):
+       * s/hpux10-20.h (C_SWITCH_X_SYSTEM, LD_SWITCH_X_DEFAULT):
+       * s/netbsd.h (C_SWITCH_SYSTEM):
+       * s/openbsd.h (LD_SWITCH_X_DEFAULT): Remove, configure takes care
+       of these.
+
+       Simplify m/intel386.h.
+       * m/intel386.h (CRT0_DUMMIES): Remove, inline value in the only
+       user: ecrt0.c.
+       (SOLARIS2): Remove LOAD_AVE_TYPE, LOAD_AVE_CVT, LIBS_MACHINE, unused.
+       (USG5_4): Move LOAD_AVE_TYPE, LOAD_AVE_CVT, FSCALE definitions to
+       the only user: s/unixware.h.
+       * ecrt0.c: Remove #ifndef static.  Inline CRT0_DUMMIES definition
+       from m/intel386.h.
+       * s/unixware.h (LOAD_AVE_TYPE, LOAD_AVE_CVT, FSCALE): Definitions
+       moved here from m/intel386.h.
+
+       * m/mips.h: Remove #if 0 code.
+
+2010-04-23  Eli Zaretskii  <eliz@gnu.org>
+
+       Fix display of composed characters from L2R scripts in bidi buffers.
+       * xdisp.c (set_iterator_to_next, next_element_from_composition):
+       After advancing IT past the composition, resync the bidi iterator
+       with IT's position.  (Bug#5977)
+
+2010-04-23  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * Makefile.in (LD_SWITCH_MACHINE_TEMACS): Remove, unused.
+       (TEMACS_LDFLAGS): Don't use LD_SWITCH_SYSTEM_TEMACS.
+
+2010-04-23  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * gtkutil.c: Include xsettings.h for Ftool_bar_get_system_style.
+
+2010-04-23  Eli Zaretskii  <eliz@gnu.org>
+
+       Support `display' text properties and overlay strings in bidi buffers.
+       * xdisp.c (pop_it): When the stack is popped after displaying
+       from a string, bidi-iterate to exit from the text portion covered
+       by the `display' property or overlay.  (Bug#5988, bug#5920)
+
+2010-04-23  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * m/macppc.h (LD_SWITCH_SYSTEM_TEMACS): Remove #undef.
+       (LD_SWITCH_MACHINE_TEMACS): Remove, configure sets nocombreloc.
+
+       * s/netbsd.h (LD_SWITCH_SYSTEM_TEMACS): Remove, configure sets nocombreloc.
+       * s/openbsd.h (LD_SWITCH_SYSTEM_TEMACS): Remove.
+
+       Simplify STARTFILES definition.
+       * s/hpux10-20.h (START_FILES): Explicitly define here instead of
+       relying on Makefile.in to define it.
+       * s/cygwin.h (START_FILES): Likewise.
+       * Makefile.in (STARTFILES): Remove conditional code, not needed anymore.
+
+       Clean up Solaris code.
+       * s/sol2-6.h (LD_SWITCH_SYSTEM_TEMACS, C_SWITCH_X_SYSTEM)
+       (LIB_MOTIF): Remove, configure takes care of this.
+       (NOT_USING_MOTIF): Remove, unused.
+       * xrdb.c: Remove #if 0-ed #include.
+       (SYSV): Remove conditional for old SysV.
+       * sysdep.c (closedir): Remove conditional code for Solaris,
+       Solaris has closedir.
 
-       * window.c (Fwindow_height): Doc fix (bug#6518).
+2010-04-22  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * xsettings.c (read_and_apply_settings): Check if current_font is
+       NULL before strcmp (Bug#6001).
 
-2010-07-21  Juanma Barranquero  <lekktu@gmail.com>
+2010-04-21  Dan Nicolaescu  <dann@ics.uci.edu>
 
-       * buffer.c (syms_of_buffer) <fringe-indicator-alist>: Doc fix.
+       Clean up HP-UX files.
+       * m/hp800.h (NO_REMAP, VIRT_ADDR_VARIES, DATA_SEG_BITS)
+       (DATA_START, TEXT_START, LOAD_AVE_TYPE, LOAD_AVE_CVT)
+       (LDAV_SYMBOL, index, rindex): Move definitions only used in HP-UX ...
+       * s/hpux10-20.h: ... to the only user, here.
 
-2010-07-17  Jan Djärv  <jan.h.d@swipnet.se>
+2010-04-21  Eli Zaretskii  <eliz@gnu.org>
+
+       * bidi.c (bidi_find_paragraph_start, bidi_at_paragraph_end): Don't
+       use buffer-local values of paragraph-start and paragraph-separate.
+       <paragraph_start_re, paragraph_separate_re>: Rename from
+       fallback_paragraph_start_re and fallback_paragraph_separate_re.
+       (Bug#5992)
 
-       * gtkutil.c (xg_event_is_for_menubar): Also check that event window
-       is related to the menu bar (Bug#6499).
+2010-04-21  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * xsettings.c: Qmonospace_font_name, Qtool_bar_style and
+       current_tool_bar_style are new.
+       (store_config_changed_event): Rename from store_font_changed_event.
+       (XSETTINGS_TOOL_BAR_STYLE): New define.
+       (SEEN_FONT, SEEN_TB_STYLE): New enum values.
+       (struct xsettings): Add font and tb_style, set xft stuff inside #ifdef
+       HAVE_XFT.
+       (something_changedCB): store_font_changed_event is now
+       store_config_changed_event.
+       (parse_settings): Rename from parse_xft_settings.  Read
+       non-xft xsettings outside #ifdef HAVE_XFT.
+       (read_settings): Renamed from read_xft_settings.
+       (apply_xft_settings): Take current settings as parameter.  Do not
+       call read_(xft)_settings.
+       (read_and_apply_settings): New function.
+       (xft_settings_event): Do non-xft stuff out of HAVE_XFT.  Call
+       read_and_apply_settings if there are settings to be read.
+       (init_xsettings): Renamed from init_xfd_settings.
+       Call read_and_apply_settings unconditionally.
+       (xsettings_initialize): Call init_xsettings.
+       (Ftool_bar_get_system_style): New function.
+       (syms_of_xsettings): Define Qmonospace_font_name and
+       Qtool_bar_style.  Initialize current_tool_bar_style to nil.
+       defsubr Stool_bar_get_system_style.  Fprovide on
+       dynamic-setting.
+       Move misplaced HAVE_GCONF
 
-2010-07-14  Jan Djärv  <jan.h.d@swipnet.se>
+       * xsettings.h (Ftool_bar_get_system_style): Declare.
 
-       * xterm.h (x_menubar_window_to_frame): Second parameter is XEvent*.
+       * xdisp.c: Vtool_bar_style, tool_bar_max_label_size,
+       Qtext, Qboth, Qboth_horiz are new.
+       (syms_of_xdisp): Intern Qtext, Qboth, Qboth_horiz, DEFVAR
+       Vtool_bar_style, tool_bar_max_label_size.
+
+       * lisp.h: Extern declare Qtext, Qboth, Qboth_horiz.
+
+       * keyboard.c: QClabel is new.
+       (parse_tool_bar_item): Take out QClabel from tool bar items.
+       Try to construct a label if ther is no QClabel.
+       (syms_of_keyboard): Intern :label as QClabel.
+
+       * dispextern.h (tool_bar_item_idx): TOOL_BAR_ITEM_LABEL is new.
+       (Vtool_bar_style, tool_bar_max_label_size, DEFAULT_TOOL_BAR_LABEL_SIZE):
+       New.
+
+       * Makefile.in (SOME_MACHINE_LISP): font-setting.el renamed to
+       dynamic-setting.el.
+
+       * gtkutil.c (xg_tool_bar_menu_proxy): Handle label in tool bar item.
+       (xg_make_tool_item, xg_show_toolbar_item): New function.
+       (update_frame_tool_bar): Take label from TOOL_BAR_ITEM_LABEL.
+       Call xg_make_tool_item to make a tool bar item.
+       Call xg_show_toolbar_item.  Use wtoolbar instead of x->toolbar_widget.
+
+       * xterm.c (x_draw_image_relief): Take Vtool_bar_button_margin
+       into account for toolbars.
+
+2010-04-21  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * data.c (make_blv): Declarations before code (Bug#5993).
+
+2010-04-21  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (DBUS_OBJ, GTK_OBJ, XMENU_OBJ, XOBJ):
+       Define using autoconf, not cpp.
+       (LIBXSM): New variable, set by autoconf.
+       (LIBXT): Use $LIBXSM.
+
+2010-04-21  Dan Nicolaescu  <local_user@dannlt>
+
+       Remove NOMULTIPLEJOBS, unused.
+       * s/template.h (NOMULTIPLEJOBS):
+       * s/msdos.h (NOMULTIPLEJOBS): Remove, unused.
+
+       Simplify LD_SWITCH_SYSTEM_TEMACS usage.
+       * s/freebsd.h (LD_SWITCH_SYSTEM_TEMACS):
+       * s/gnu-linux.h (LD_SWITCH_SYSTEM_TEMACS): Remove, configure
+       detects -znocombreloc and passes it to the linker
+       * s/hpux10-20.h (LD_SWITCH_SYSTEM_TEMACS): Remove, empty.
+
+2010-04-21  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (LIBSELINUX_LIBS): Move out of #ifdef.
+
+2010-04-21  Karel Klíč  <kklic@redhat.com>
+
+       * Makefile.in (LIBSELINUX_LIBS): New.
+       (LIBES): Add $LIBSELINUX_LIBS.
+       * eval.c, lisp.h (call7): New function.
+       * fileio.c [HAVE_LIBSELINUX]: Include selinux headers.
+       (Ffile_selinux_context, Fset_file_selinux_context):
+       New functions.
+       (Fcopy_file): New parameter preserve-selinux-context.
+       (Frename_file): Preserve selinux context when renaming by copy-file.
+
+2010-04-21  Juanma Barranquero  <lekktu@gmail.com>
+            Eli Zaretskii  <eliz@gnu.org>
+
+       Don't depend on cm.c or termcap.c on Windows, use stubs.
+       * makefile.w32-in (OBJ1): Remove cm.$(O) and termcap.$(O).
+       ($(BLD)/cm.$(O), $(BLD)/termcap.$(O)): Remove.
+       * w32console.c (current_tty, cost): New vars; lifted from cm.c.
+       (evalcost, cmputc, cmcheckmagic, cmcostinit, cmgoto, Wcm_clear)
+       (sys_tputs, sys_tgetstr): New stubs.
+       * s/ms-w32.h (chcheckmagic, cmcostinit, cmgoto, cmputc, Wcm_clear)
+       (tputs, tgetstr): New; define to sys_*.
+
+2010-04-20  Juanma Barranquero  <lekktu@gmail.com>
+
+       * buffer.c (syms_of_buffer) <bidi-display-reordering>: Doc fix.
+
+2010-04-20  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * data.c (Fmake_variable_buffer_local, Fmake_local_variable):
+       Just signal a warning rather than an error when inside a let.
+       (Fmake_variable_frame_local): Add the same test.
+
+       * font.c (syms_of_font): Make the style table vars read-only.
+
+       * buffer.h (struct buffer): Remove unused var `direction_reversed'.
+       * buffer.c (init_buffer_once, syms_of_buffer): Remove its initialization.
+
+       * bidi.c (bidi_initialize): Simplify fallback_paragraph_*_re init.
+
+2010-04-20  Eli Zaretskii  <eliz@gnu.org>
+
+       Fix R2L paragraph display on TTY.
+
+       * xdisp.c (unproduce_glyphs): New function.
+       (display_line): Use it when produced glyphs are discarded from R2L
+       glyph rows.
+       (append_composite_glyph): In R2L rows, prepend the glyph rather
+       than appending it.
+
+       * term.c (append_composite_glyph): In R2L rows, prepend the glyph
+       rather than append it.  Set up the resolved_level and bidi_type
+       attributes of the appended glyph.
+       (produce_special_glyphs): Mirror the backslash continuation
+       character in R2L lines.
+
+       Implement display of R2L paragraphs in GUI sessions.
+
+       * xdisp.c [HAVE_WINDOW_SYSTEM]: Add prototype for
+       append_stretch_glyph.
+       (set_cursor_from_row) <cursor_x>: Remove unused variable.  Fix
+       off-by-one error in computing x at end of text in the row.
+       (append_stretch_glyph): In reversed row, prepend the glyph rather
+       than append it.  Set resolved_level and bidi_type of the glyph.
+       (extend_face_to_end_of_line): If the row is reversed, prepend a
+       stretch glyph whose width is such that the rightmost glyph will be
+       drawn at the right margin of the window.  Fix off-by-one error on
+       TTY frames in testing whether a line needs face extension.  Fix
+       face extension at ZV.  If this is the last glyph row, use
+       DEFAULT_FACE_ID, to avoid painting the rest of the window with the
+       region face.
+       (set_cursor_from_row, display_line): Use
+       MATRIX_ROW_CONTINUATION_LINE_P instead of testing value of
+       row->continuation_lines_width.
+       (next_element_from_buffer): Don't call bidi_paragraph_init if we
+       are at ZV.  Fixes a crash when reseated to ZV by
+       try_window_reusing_current_matrix.
+       (display_and_set_cursor, erase_phys_cursor): Handle negative HPOS,
+       which happens with R2L glyph rows.  Fixes a crash when inserting a
+       character at end of an R2L line.
+       (set_cursor_from_row): Don't be fooled by truncated rows: don't
+       treat them as having zero-width characters.  Improve comments.
+       Don't reverse pos_before and pos_after for reversed glyph rows.
+       Set cursor.x to negative value when the cursor might be on the
+       left fringe.
+       (IT_OVERFLOW_NEWLINE_INTO_FRINGE): For R2L lines, consider the
+       left fringe, not the right one.
+       (notice_overwritten_cursor, draw_phys_cursor_glyph)
+       (erase_phys_cursor): For reversed cursor_row, support cursor on
+       the left fringe.
+
+       * fringe.c (update_window_fringes): For R2L rows, swap the bitmaps
+       of continuation indicators on the fringes.
+       (draw_fringe_bitmap): For reversed glyph rows, allow cursor on the
+       left fringe.
+
+       * w32term.c (w32_draw_window_cursor): For reversed glyph rows,
+       draw cursor on the left fringe.
+
+       * xterm.c (x_draw_window_cursor): For reversed glyph rows, draw
+       cursor on the left fringe.
+
+       * dispnew.c (update_text_area): Handle reversed desired rows when
+       the cursor is on the left fringe.
+       (set_window_cursor_after_update): Limit cursor's hpos by -1 from
+       below, not by 0, for when the cursor is on the left fringe.
+
+2010-04-20  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * gtkutil.c (xg_event_is_for_scrollbar): Check if grabbed
+       widget is a scrollbar.
+
+2010-04-20  Kenichi Handa  <handa@m17n.org>
+
+       * charset.c (char_charset): Consider Vcharset_non_preferred_head
+       only when the arg CHARSET_LIST is nil.
+
+2010-04-20  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       Make variable forwarding explicit rather the using special values.
+       Basically, this makes the structure of buffer-local values and object
+       forwarding explicit in the type of Lisp_Symbols rather than use
+       special Lisp_Objects for that.  This tends to lead to slightly more
+       verbose code, but is more C-like, simpler, and makes it easier to make
+       sure we handled all cases, among other things by letting the compiler
+       help us check it.
+       * lisp.h (enum Lisp_Misc_Type, union Lisp_Misc):
+       Removing forwarding objects.
+       (enum Lisp_Fwd_Type, enum symbol_redirect, union Lisp_Fwd): New types.
+       (struct Lisp_Symbol): Make the various forms of variable-forwarding
+       explicit rather than hiding them inside Lisp_Object "values".
+       (XFWDTYPE): New macro.
+       (XINTFWD, XBOOLFWD, XOBJFWD, XKBOARD_OBJFWD): Redefine.
+       (XBUFFER_LOCAL_VALUE): Remove.
+       (SYMBOL_VAL, SYMBOL_ALIAS, SYMBOL_BLV, SYMBOL_FWD, SET_SYMBOL_VAL)
+       (SET_SYMBOL_ALIAS, SET_SYMBOL_BLV, SET_SYMBOL_FWD): New macros.
+       (SYMBOL_VALUE, SET_SYMBOL_VALUE): Remove.
+       (struct Lisp_Intfwd, struct Lisp_Boolfwd, struct Lisp_Objfwd)
+       (struct Lisp_Buffer_Objfwd, struct Lisp_Kboard_Objfwd):
+       Remove the Lisp_Misc_* header.
+       (struct Lisp_Buffer_Local_Value): Redefine.
+       (BLV_FOUND, SET_BLV_FOUND, BLV_VALUE, SET_BLV_VALUE): New macros.
+       (struct Lisp_Misc_Any): Add filler to get the right size.
+       (struct Lisp_Free): Use struct Lisp_Misc_Any rather than struct
+       Lisp_Intfwd.
+       (DEFVAR_LISP, DEFVAR_LISP_NOPRO, DEFVAR_BOOL, DEFVAR_INT)
+       (DEFVAR_KBOARD): Allocate a forwarding object.
+       * data.c (do_blv_forwarding, store_blv_forwarding): New macros.
+       (let_shadows_global_binding_p): New function.
+       (union Lisp_Val_Fwd): New type.
+       (make_blv): New function.
+       (swap_in_symval_forwarding, indirect_variable, do_symval_forwarding)
+       (store_symval_forwarding, swap_in_global_binding, Fboundp)
+       (swap_in_symval_forwarding, find_symbol_value, Fset)
+       (let_shadows_buffer_binding_p, set_internal, default_value)
+       (Fset_default, Fmake_variable_buffer_local, Fmake_local_variable)
+       (Fkill_local_variable, Fmake_variable_frame_local)
+       (Flocal_variable_p, Flocal_variable_if_set_p)
+       (Fvariable_binding_locus):
+       * xdisp.c (select_frame_for_redisplay):
+       * lread.c (Fintern, Funintern, init_obarray, defvar_int)
+       (defvar_bool, defvar_lisp_nopro, defvar_lisp, defvar_kboard):
+       * frame.c (store_frame_param):
+       * eval.c (Fdefvaralias, Fuser_variable_p, specbind, unbind_to):
+       * bytecode.c (Fbyte_code) <varref, varset>: Adapt to the new symbol
+       value structure.
+       * buffer.c (PER_BUFFER_SYMBOL): Move from buffer.h.
+       (clone_per_buffer_values): Only adjust markers into the current buffer.
+       (reset_buffer_local_variables): PER_BUFFER_IDX is never -2.
+       (Fbuffer_local_value, set_buffer_internal_1)
+       (swap_out_buffer_local_variables):
+       Adapt to the new symbol value structure.
+       (DEFVAR_PER_BUFFER): Allocate a Lisp_Buffer_Objfwd object.
+       (defvar_per_buffer): Take a new arg for the fwd object.
+       (buffer_lisp_local_variables): Return a proper alist (different fix
+       for bug#4138).
+       * alloc.c (Fmake_symbol): Use SET_SYMBOL_VAL.
+       (Fgarbage_collect): Don't handle buffer_defaults specially.
+       (mark_object): Handle new symbol value structure rather than the old
+       special Lisp_Misc_* objects.
+       (gc_sweep) <symbols>: Free also the buffer-local-value objects.
+       * term.c (set_tty_color_mode):
+       * bidi.c (bidi_initialize): Don't access the ->value field directly.
+       * buffer.h (PER_BUFFER_VAR_OFFSET): Don't bother with
+       a buffer_local_flags.
+       * print.c (print_object): Get rid of impossible forwarding objects.
+
+2010-04-19  Eli Zaretskii  <eliz@gnu.org>
+
+       * bidi.c (bidi_get_type, bidi_get_category)
+       (bidi_at_paragraph_end, bidi_resolve_weak, bidi_resolve_neutral)
+       (bidi_type_of_next_char, bidi_level_of_next_char):
+       Declare static.  Use `INLINE' rather than `inline'.
 
-       * xterm.c (handle_one_xevent): Pass event to x_menubar_window_to_frame.
+2010-04-19  Juanma Barranquero  <lekktu@gmail.com>
 
-       * xmenu.c (x_activate_menubar): Revert previous fix for Bug#6499,
-       i.e. don't put back ButtonRelease (Bug#6608).
+       * dired.c (Ffile_attributes): Fix typo in docstring.
 
-       * xfns.c (x_menubar_window_to_frame): Take XEvent as second parameter
-       instead of Window.  Call xg_event_is_for_menubar when
-       USE_GTK (Bug#6499).
+2010-04-19  Adrian Robert  <Adrian.B.Robert@gmail.com>
 
-       * gtkutil.h (xg_event_is_for_menubar): Declare.
+       * nsmenu.m (EmacsDialog-runDialogAt:): Declare ret as
+       NSInteger (Bug#5811).
 
-       * gtkutil.c (xg_event_is_for_menubar): New function (Bug#6499).
+2010-04-19  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
 
-2010-07-14  Eli Zaretskii  <eliz@gnu.org>
+       * s/darwin.h (PTY_ITERATION, PTY_NAME_SPRINTF, PTY_TTY_NAME_SPRINTF)
+       (PTY_OPEN): New defines.  Use openpty (Bug#726, Bug#5819).
 
-       * w32fns.c (x_set_foreground_color): Fix setting the cursor color
-       when it's the same as the old foreground.  (Bug#6609)
+2010-04-19  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
 
-2010-07-10  Chong Yidong  <cyd@stupidchicken.com>
+       * frame.h (FRAME_LINE_TO_PIXEL_Y): Add missing parenthesis.
 
-       * xfaces.c (realize_face): Garbage the frame if a face is removed
-       (Bug#6593).
+2010-04-19  Chong Yidong  <cyd@stupidchicken.com>
 
-2010-07-05  Andreas Schwab  <schwab@linux-m68k.org>
+       * xdisp.c (prepare_menu_bars): Don't call ns_set_doc_edited for
+       terminal frames (Bug#5837).
 
-       * keyboard.c: Remove duplicate <setjmp.h>.
-       (read_key_sequence): Remove volatile qualifiers.
+2010-04-19  Eli Zaretskii  <eliz@gnu.org>
 
-2010-07-05  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+       * .gdbinit (xsubchartable): New command.
 
-       * dispextern.h (FRINGE_HEIGHT_BITS): New define.
-       (struct glyph_row): New members left_fringe_offset and
-       right_fringe_offset.
+2010-04-19  Eli Zaretskii  <eliz@gnu.org>
 
-       * xterm.c (x_draw_fringe_bitmap): Don't clip bottom aligned bitmap
-       specially.
-       * w32term.c (w32_draw_fringe_bitmap): Likewise.
-       * nsterm.m (ns_draw_fringe_bitmap): Likewise.
+       * xdisp.c (display_line): Don't write beyond the last glyph row in
+       the desired matrix.  Fixes a crash in "emacs -nw" (bug#5972), see
+       http://lists.gnu.org/archive/html/emacs-devel/2010-04/msg00075.html
+       and
+       http://lists.gnu.org/archive/html/emacs-devel/2010-04/msg00213.html
 
-       * fringe.c (draw_fringe_bitmap_1): Don't clip bitmap here.
-       Take account of bitmap offset.
-       (draw_window_fringes): Take account of window vscroll.
-       (update_window_fringes): Likewise.  Extend top-aligned top indicator
-       or bottom-aligned bottom indicator to adjacent rows if it doesn't fit
-       in one row.  Don't set redraw_fringe_bitmaps_p outside row comparison.
-       Set left_fringe_offset and right_fringe_offset (Bug#5634, Bug#6325).
+2010-04-18  Stefan Monnier  <monnier@iro.umontreal.ca>
 
-2010-07-04  Juanma Barranquero  <lekktu@gmail.com>
+       * alloc.c (Fpurecopy): Hash-cons if requested.
+       (syms_of_alloc): Update purify-flag docstring.
 
-       * w32fns.c (Qtooltip): Declare.
-       Suggested by Andy Moreton <andrewjmoreton@gmail.com>.
+2010-04-18  Jan Djärv  <jan.h.d@swipnet.se>
 
-2010-07-03  Jan Djärv  <jan.h.d@swipnet.se>
+       * gtkutil.c (xg_set_geometry): Set size in geometry string also.
+       (x_wm_set_size_hint): Set USER_POS in hint_flags (Bug#5968).
 
-       * xmenu.c (x_activate_menubar): Send Press/Release for Gtk+ to avoid
-       grab on just Press (Bug#6499).
+2010-04-17  Eli Zaretskii  <eliz@gnu.org>
 
-2010-07-02  Chong Yidong  <cyd@stupidchicken.com>
+       Fix a crash when an NSM character is inserted at BEGV.
 
-       * frame.c (Qtooltip): New var.
-       (delete_frame): Use it.  Fix faulty if statement.  Don't update
-       mode line for tooltip frames.  Suggested by Martin Rudalics.
+       * bidi.c (bidi_init_it): Fix initialization of bidi_it->prev.
+       (bidi_resolve_weak): Don't use prev.type_after_w1 if it is
+       NEUTRAL_B or UNKNOWN_BT.
 
-       * xfns.c (x_create_tip_frame):
-       * w32fns.c (x_create_tip_frame): Use it.
+2010-04-16  Eli Zaretskii  <eliz@gnu.org>
 
-2010-06-30  Naohiro Aota  <naota@elisp.net>  (tiny change)
+       * xdisp.c (set_cursor_from_row): Don't consider possibility of
+       other rows with cursor unless they are different from this row and
+       this row is part of a continued line.  (Bug#5943)
 
-       * xftfont.c (xftfont_open): Check font width one by one also when
-       spacing is dual.
+2010-04-16  Dan Nicolaescu  <dann@ics.uci.edu>
 
-       * ftfont.c (ftfont_open): Ditto.
+       * s/freebsd.h: Restore osreldate.h include.
+       Suggested by Naohiro Aota.
 
-2010-06-26  Andreas Schwab  <schwab@linux-m68k.org>
+2010-04-16  Jan Djärv  <jan.h.d@swipnet.se>
 
-       * alloc.c (Fmake_byte_code): Don't access undefined argument
-       (Bug#6517).
+       * xmenu.c (apply_systemfont_to_menu): *childs was incorrectly used.
 
-2010-06-25  Chong Yidong  <cyd@stupidchicken.com>
+2010-04-16  Ken Brown  <kbrown@cornell.edu>  (tiny change)
 
-       * xdisp.c (next_element_from_image): Ensure that after-strings are
-       read the next time we hit handle_stop (Bug#1336).
+       * s/cygwin.h: Avoid linking against static libgcc.
 
-2010-06-23  Andreas Schwab  <schwab@linux-m68k.org>
+2010-04-15  Juri Linkov  <juri@jurta.org>
 
-       * lread.c (read1): Signal error if #s is not followed by paren.
+       * window.c: Add Qscroll_command.
+       Remove Vscroll_preserve_screen_position_commands.
+       (window_scroll_pixel_based, window_scroll_line_based): Check the
+       `scroll-command' property on the last command instead of searching
+       the last command in Vscroll_preserve_screen_position_commands.
+       (syms_of_window): Initialize and staticpro `Qscroll_command'.
+       Put Qscroll_command property on Qscroll_up and Qscroll_down.
+       (scroll-preserve-screen-position): Doc fix.
+       (Vscroll_preserve_screen_position_commands): Remove variable.
 
-2010-06-19  Chong Yidong  <cyd@stupidchicken.com>
+2010-04-15  Dan Nicolaescu  <dann@ics.uci.edu>
 
-       * image.c (free_image): Mark frame as garbaged (Bug#6426).
+       * xdisp.c (message): Do not use NO_ARG_ARRAY.
 
-       * keymap.c (Fdefine_key): Doc fix (Bug#6460).
+2010-04-14  Dan Nicolaescu  <dann@ics.uci.edu>
 
-2010-06-15  Glenn Morris  <rgm@gnu.org>
+       Reduce cpp use in Makefile.in.
+       * Makefile.in (DBUS_CFLAGS, DBUS_LIBS, GCONF_CFLAGS, GCONF_LIBS)
+       (LIBSOUND, CFLAGS_SOUND, RSVG_LIBS, RSVG_CFLAGS, INTERVALS_H)
+       (GETLOADAVG_LIBS, RUN_TEMACS): Move to the autoconf section.
+       (ORDINARY_LINK): Remove, defined in src/s/gnu.h.
+       (CRT0_COMPILE): Remove, inline it in the only user.
 
-       * editfns.c (Fbyte_to_string): Pacify compiler.
+2010-04-14  Juri Linkov  <juri@jurta.org>
 
-2010-06-09  Stefan Monnier  <monnier@iro.umontreal.ca>
+       * window.c (keys_of_window): Rebind `C-v' from `scroll-up' to
+       `scroll-up-command' and `M-v' from `scroll-down' to
+       `scroll-down-command'.
 
-       * dbusbind.c (xd_append_arg): Don't "make-unibyte" the string.
-       Check `object's type before accessing its guts.
+2010-04-14  Juri Linkov  <juri@jurta.org>
 
-2010-06-08  Andreas Schwab  <schwab@linux-m68k.org>
+       * window.c (Vscroll_preserve_screen_position_commands): New variable
+       with the default value as the list of Qscroll_down and Qscroll_up.
+       (window_scroll_pixel_based, window_scroll_line_based): Search the
+       last command in the list Vscroll_preserve_screen_position_commands
+       instead of comparing with Qscroll_up and Qscroll_down.
 
-       * minibuf.c (Fall_completions): Add more checks.
+2010-04-13  Jan Djärv  <jan.h.d@swipnet.se>
 
-2010-06-08  Juanma Barranquero  <lekktu@gmail.com>
+       * gtkutil.c (xg_set_geometry): Set geometry for PPosition also.
+       (x_wm_set_size_hint): Dont set position flags, gtk_window_parse_geometry
+       does that.
 
-       * minibuf.c (Fall_completions): Check COLLECTION's size (bug#6378).
+       * xfns.c (Fx_create_frame, x_create_tip_frame): Set default border width
+       to zero.
 
-2010-06-03  Andreas Schwab  <schwab@linux-m68k.org>
+2010-04-13  Stefan Monnier  <monnier@iro.umontreal.ca>
 
-       * process.c (conv_lisp_to_sockaddr): Fix conversion of IPv4
-       address.  (Bug#6346)
+       * term.c (init_tty): Move common text outside of #ifdef TERMINFO.
 
-2010-06-03  Juanma Barranquero  <lekktu@gmail.com>
+       Try to solve the problem of spurious EOF chars in long lines of text
+       sent to interactive subprocesses.
+       * sysdep.c (child_setup_tty): Do not enable ICANON any more.
+       (system_process_attributes): Remove unused var `ttotal'.
+       * process.c (send_process): Don't bother breaking long line with EOF
+       chars when talking to ttys any more.
+       (wait_reading_process_output): Output a warning when called in such
+       a way that it could block without being interruptible.
 
-       * ccl.c (Fccl_program_p): Fix typo in docstring.
+       Try to detect file modification within the same second.
+       * buffer.h (struct buffer): New field modtime_size.
+       * buffer.c (reset_buffer): Initialize it.
+       * fileio.c (Finsert_file_contents, Fwrite_region): Set it.
+       (Fverify_visited_file_modtime): Check it.
+       (Fclear_visited_file_modtime, Fset_visited_file_modtime): Clear it.
+       (Fset_visited_file_modtime): Set (or clear) it.
 
-2010-05-31  Stefan Monnier  <monnier@iro.umontreal.ca>
+2010-04-12  Stefan Monnier  <monnier@iro.umontreal.ca>
 
-       * keymap.c (Fwhere_is_internal): Fix handling of remapping (in thread
-       of bug#6305).
+       * process.c (status_notify): Remove unused var `ro'.
 
-2010-05-27  Chong Yidong  <cyd@stupidchicken.com>
+2010-04-12  Jan Djärv  <jan.h.d@swipnet.se>
 
-       * xdisp.c (redisplay_window): After redisplay, check if point is
-       still valid before setting it (Bug#6177).
+       * xfns.c (select_visual): Don't call error if XGetVisualInfo returns
+       more than one visual (Bug#5938).
 
-2010-05-20  enami tsugutomo  <tsugutomo.enami@jp.sony.com>
+2010-04-12  Dan Nicolaescu  <dann@ics.uci.edu>
 
-       * s/netbsd.h: If terminfo is found, use it in preference to
-       termcap.  (Bug#6190)  [Backport from trunk]
+       * Makefile.in (C_SWITCH_SYSTEM,C_SWITCH_MACHINE,C_SWITCH_X_SITE):
+       Undefine.
 
-2010-05-20  Kevin Ryde  <user42@zip.com.au>
+2010-04-11  Dan Nicolaescu  <dann@ics.uci.edu>
 
-       * keyboard.c (Vlast_command, Vkeyboard_translate_table)
-       (Voverriding_terminal_local_map, Vsystem_key_alist)
-       (Vlocal_function_key_map): Fix manual link in docstring (Bug#6224).
+       Remove C_SWITCH_SYSTEM_TEMACS.
+       * s/darwin.h (C_SWITCH_SYSTEM_TEMACS): Remove.
+       (malloc, realloc, free): Use emacs, not temacs for conditional
+       definition.
 
-2010-05-19  Stefan Monnier  <monnier@iro.umontreal.ca>
+       * Makefile.in (C_SWITCH_SYSTEM_TEMACS): Remove.
+       (ALL_CFLAGS): Do not use C_SWITCH_SYSTEM_TEMACS.
 
-       * editfns.c (Fbyte_to_string): New function.
+       Use autoconf, not cpp for some variables.
+       * Makefile.in (C_SWITCH_SYSTEM, C_SWITCH_MACHINE)
+       (C_SWITCH_X_SITE): Define using autoconf, not cpp.
+       (ALL_CFLAGS): Use them as make variables.
+       (really-lwlib, really-oldXMenu): Do not pass them.
 
-2010-05-18  Chong Yidong  <cyd@stupidchicken.com>
+2010-04-11  Jan Djärv  <jan.h.d@swipnet.se>
 
-       * character.c (Fstring, Funibyte_string): Use SAFE_ALLOCA to
-       prevent stack overflow if number of arguments is too large
-       (Bug#6214).
+       * xmenu.c (apply_systemfont_to_dialog): New.
+       (create_and_show_dialog): Call apply_systemfont_to_dialog if HAVE_XFT.
 
-2010-05-11  Eli Zaretskii  <eliz@gnu.org>
+2010-04-11  Stefan Monnier  <monnier@iro.umontreal.ca>
 
-       * makefile.w32-in ($(BLD)/w32fns.$(O)): Depend on $(SRC)/w32.h.
+       * process.c (exec_sentinel): Preserve current-buffer.
 
-       * w32fns.c: Include w32.h.
-       (Fw32_shell_execute): Decode the error message before passing it
-       to `error'.  (Bug#6126)
+       * process.c (read_process_output): Move the save-current-buffer to
+       apply to both the filter and the non-filter branches.
 
-2010-05-11  Karel Klic  <kklic@redhat.com>
+2010-04-10  Dan Nicolaescu  <dann@ics.uci.edu>
 
-       * ftfont.c: Fix incorrect parentheses of #if condition for
-       definining M17N_FLT_USE_NEW_FEATURE.
+       * s/msdos.h (UNEXEC): New definition.
 
-2010-05-07  Chong Yidong  <cyd@stupidchicken.com>
+2010-04-10  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
 
-       * Version 23.2 released.
+       * dispextern.h (TRY_WINDOW_CHECK_MARGINS)
+       (TRY_WINDOW_IGNORE_FONTS_CHANGE): New defines.
 
-2010-04-30  Andreas Schwab  <schwab@linux-m68k.org>
+       * xdisp.c (try_window): Change arg from CHECK_MARGINS to FLAGS.
+       Don't abort with fonts change if TRY_WINDOW_IGNORE_FONTS_CHANGE is
+       set in FLAGS.  Callers with non-zero CHECK_MARGINS changed to use
+       TRY_WINDOW_CHECK_MARGINS.
 
-       * composite.c (autocmp_chars): Save point as marker before calling
-       auto-composition-function (Bug#5984).
+       * xfns.c (Fx_show_tip): Undo last change.  Call try_window with
+       TRY_WINDOW_IGNORE_FONTS_CHANGE (Bug#2423).  Subtract last glyph's
+       width only when it is for padding.
 
-       * lisp.h (restore_point_unwind): Add prototype.
+2010-04-09  Jan Djärv  <jan.h.d@swipnet.se>
 
-       * fileio.c (restore_point_unwind): Remove static attribute.
+       * xfns.c (Fx_show_tip): Call try_window in a loop until
+       fonts_changed_p is zero (Bug#2423).
 
-2010-04-23  Kenichi Handa  <handa@m17n.org>
+2010-04-08  Eli Zaretskii  <eliz@gnu.org>
 
-       * ftfont.c (M17N_FLT_USE_NEW_FEATURE): Define it if we can use the
-       new feature of libotf and m17n-flt.
-       (ftfont_check_otf) [M17N_FLT_USE_NEW_FEATURE]: Call
-       OTF_check_features even if no specific feature is given.
-       (PACK_OTF_TAG) [M17N_FLT_USE_NEW_FEATURE]: New macro.
-       (ftfont_drive_otf) [M17N_FLT_USE_NEW_FEATURE]: Handle the case
-       that OUT is NULL.  Use OTF_drive_gsub_with_log and
-       OTF_drive_gpos_with_log instead of OTF_drive_gsub and
-       OTF_drive_gpos.
-       (ftfont_try_otf) [M17N_FLT_USE_NEW_FEATURE]: New function.
-       (ftfont_shape_by_flt) [M17N_FLT_USE_NEW_FEATURE]: Setup
-       mflt_enable_new_feature and mflt_try_otf.
+       * xdisp.c (set_cursor_from_row): Don't dereference glyphs beyond
+       the end of TEXT_AREA.  (Bug#5856)
 
-2010-04-19  Juanma Barranquero  <lekktu@gmail.com>
+2010-04-08  Jan Djärv  <jan.h.d@swipnet.se>
 
-       * dired.c (Ffile_attributes): Fix typo in docstring.
+       * xsettings.c (XSETTINGS_FONT_NAME): Move XSETTINGS_FONT_NAME out of
+       HAVE_GCONF.
 
-2010-04-13  Adrian Robert  <Adrian.B.Robert@gmail.com>
+2010-04-08  Eli Zaretskii  <eliz@gnu.org>
 
-       * nsmenu.m (EmacsDialog-runDialogAt:): Declare ret as
-       NSInteger (Bug#5811).
+       * bidi.c (bidi_resolve_weak): Use prev.type_after_w1, instead of
+       prev.orig_type, for resolving type of NSM.  (Bug#5858)
 
-2010-04-10  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+2010-04-08  Jan Djärv  <jan.h.d@swipnet.se>
 
-       * s/darwin.h (PTY_ITERATION, PTY_NAME_SPRINTF, PTY_TTY_NAME_SPRINTF)
-       (PTY_OPEN): New defines.  Use openpty (Bug#726, Bug#5819).
+       * xsettings.c (current_font, SYSTEM_FONT, XSETTINGS_FONT_NAME): New.
+       (parse_xft_settings): Also check for XSETTINGS_FONT_NAME and save that
+       in current_font.
+       (init_gconf): Read value of SYSTEM_FONT and save it in current_font.
+       (Ffont_get_system_normal_font, xsettings_get_system_normal_font):
+       New functions.
+       (syms_of_xsettings): Initialize current_font.
+       defsubr Sfont_get_system_normal_font.
 
-2010-04-08  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+       * xsettings.h (Ffont_get_system_normal_font)
+       (xsettings_get_system_normal_font): Declare.
 
-       * frame.h (FRAME_LINE_TO_PIXEL_Y): Add missing parenthesis.
+       * xfns.c (extern xlwmenu_default_font): Remove.
+       (Fx_create_frame): Remove setting of xlwmenu_default_font, moved
+       to xlwmenu.c.
+
+       * menu.c (digest_single_submenu): If USE_LUCID and HAVE_XFT, encode
+       menu items in UTF-8.
+
+       * xmenu.c: include xsettings.h and xlwmenu.h if USE_LUCID.
+       (apply_systemfont_to_menu): New function.
+       (set_frame_menubar, create_and_show_popup_menu): Call
+       apply_systemfont_to_menu.
 
 2010-04-07  Jan Djärv  <jan.h.d@swipnet.se>
 
        * xterm.c (x_set_window_size_1): Don't add border_width/height to
        pixelwidth/height.
 
-2010-04-05  Chong Yidong  <cyd@stupidchicken.com>
+2010-04-07  Dan Nicolaescu  <dann@ics.uci.edu>
 
-       * xdisp.c (prepare_menu_bars): Don't call ns_set_doc_edited for
-       terminal frames (Bug#5837).
+       Simplify code for HP machines.
+       * m/hp800.h (LOAD_AVE_TYPE, LOAD_AVE_CVT, NO_REMAP): Do not define
+       for GNU_LINUX, not needed.
+       (UNEXEC, NEED_BSDTTY): Move definitions...
+       * s/hpux10-20.h (UNEXEC, NEED_BSDTTY): ... here.
+
+       * m/iris4d.h (UNEXEC): Move definition ...
+       * s/irix6-5.h (UNEXEC): ... here.
+
+2010-04-04  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * xfns.c (set_machine_and_pid_properties): New function.
+       (Fx_create_frame): Call set_machine_and_pid_properties.
+
+2010-04-03  Eli Zaretskii  <eliz@gnu.org>
+
+       * bidi.c (bidi_resolve_explicit, bidi_level_of_next_char): Check
+       bidi_it->bytepos against ZV_BYTE instead of bidi_it->ch against
+       BIDI_EOB.  Fixes infloop with vertical cursor motion at ZV.
+
+       * w32fns.c (x_create_tip_frame): Copy `parms' before we modify it
+       in this function.  (Bug#5703)
+
+2010-04-03  Chong Yidong  <cyd@stupidchicken.com>
+
+       * nsterm.h: Fix last change.
+
+2010-04-03  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * m/intel386.h (NO_REMAP): Move definition ...
+       * s/msdos.h (NO_REMAP): ... here.
+
+       * m/vax.h (CRT0_DUMMIES): Remove, unused.
+
+       * ecrt0.c: Remove MSDOS, m68k and __sparc__ conditionals, file not
+       used on those platforms.
+
+2010-04-02  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       Remove extern errno declarations.
+       * xterm.c:
+       * xrdb.c:
+       * w32term.c:
+       * unexec.c:
+       * unexaix.c:
+       * sysdep.c:
+       * process.c:
+       * lread.c:
+       * keyboard.c:
+       * floatfns.c:
+       * filelock.c:
+       * fileio.c:
+       * emacs.c (main):
+       * ecrt0.c:
+       * dispnew.c:
+       * callproc.c:
+       * buffer.c: Remove errno extern declarations.
+       * s/netbsd.h (NEED_ERRNO): Remove.
+
+2010-04-01  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       Remove all uses of LIBX11_SYSTEM.
+       * Makefile.in (LIBX11_SYSTEM): Remove.
+       * s/msdos.h (LIBX11_SYSTEM): Do not define, define LIBS_SYSTEM
+       instead.
+
+2010-04-01  Eli Zaretskii  <eliz@gnu.org>
+
+       Remove support for DJGPP v1.x (bug#5813).
+
+       * w16select.c (__dpmi_int): Remove DJGPP v1.x compatibility.
+       * s/msdos.h:
+       * unexec.c (make_hdr, copy_text_and_data):
+       * sysdep.c (wait_for_termination, sys_subshell):
+       * msdos.c (dos_set_window_size, msdos_set_cursor_shape)
+       (IT_set_terminal_modes, __write, _rename, gethostname)
+       (gettimeofday, alarm, fork, kill, dos_ttraw, dos_ttcooked)
+       (run_msdos_command, abort): Remove DJGPP v1.x code and tests of
+       the value of __DJGPP__.
+       (nice, pause, sigsetmask, sigblock): Remove DJGPP v1.x
+       compatibility code.
+       * lread.c:
+       * gmalloc.c (memalign):
+       * fileio.c (Fcopy_file, check_executable, Ffile_modes):
+       * emacs.c (main):
+       * dosfns.c (init_dosfns):
+       * dired.c (file_name_completion_stat): Remove tests of __DJGPP__.
+
+2010-04-01  Eli Zaretskii  <eliz@gnu.org>
+
+       * xdisp.c (set_cursor_from_row): Fix cursor positioning when the
+       string with `cursor' property comes from an `after-string'
+       overlay.  (Bug#5816)
+
+2010-04-01  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (LIBTIFF, LIBJPEG, LIBPNG, LIBGIF, LIBXPM, XFT_LIBS):
+       Define as Makefile variables.
+       (LIBX): Use above variables rather than directly using autoconf.
+
+2010-03-31  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       Clean up BSD_SYSTEM use.
+       * xterm.c:
+       * process.c:
+       * emacs.c: Use HAVE_SYS_IOCTL_H instead of BSD_SYSTEM as a guard
+       for including <sys/ioctl.h>.
+       * sysdep.c (wait_without_blocking): Remove BSD_SYSTEM case, this
+       code is only used for MSDOS.
+
+2010-03-31  Juri Linkov  <juri@jurta.org>
+
+       * image.c: Add `Qextension_data'.
+       (syms_of_image): Initialize and staticpro `Qextension_data'.
+       (Fimage_metadata): Rename from `Fimage_extension_data'.
+       (gif_load): Put GIF extension data to the property
+       `Qextension_data'.
 
 2010-03-31  Chong Yidong  <cyd@stupidchicken.com>
 
 
 2010-03-31  Eli Zaretskii  <eliz@gnu.org>
 
-       * w32fns.c (x_create_tip_frame): Copy `parms' before we modify it
-       in this function.  (Bug#5703)
+       * xdisp.c (highlight_trailing_whitespace): Support highlight of
+       trailing whitespace in right-to-left rows.
 
-2010-03-31  Chong Yidong  <cyd@stupidchicken.com>
+2010-03-31  Stefan Monnier  <monnier@iro.umontreal.ca>
 
-       * nsterm.h: Fix last change.
+       Get rid of the direct_output optimizations.
+       * keyboard.c (nonundocount): Remove extern declaration.
+       (command_loop_1): Remove brittle optimisation for cheap and
+       common operations.
+       * xdisp.c (redisplay_internal): Don't bother checking
+       redisplay_performed_directly_p any more.
+       * sysdep.c (init_sys_modes): Don't call direct_output_forward_char
+       any more.
+       * dispnew.c (redisplay_performed_directly_p)
+       (direct_output_for_insert, direct_output_forward_char):
+       * dispextern.h (redisplay_performed_directly_p)
+       (direct_output_for_insert, direct_output_forward_char): Remove.
+       * cmds.c (nonundocount): Make it static.
 
-2010-03-30  Bernhard Herzog  <bh@intevation.de>  (tiny change)
+2010-03-31  Bernhard Herzog  <bh@intevation.de>  (tiny change)
 
        * menu.c (Fx_popup_menu): Use last_event_timestamp (Bug#4930).
 
-2010-03-30  Jan Djärv  <jan.h.d@swipnet.se>
+2010-03-31  Jan Djärv  <jan.h.d@swipnet.se>
 
        * xdisp.c (note_mouse_highlight): Don't do highlight if pointer is
        invisible (Bug#5766).
 
-2010-03-29  Adrian Robert  <adrian.b.robert@gmail.com>
+2010-03-31  Adrian Robert  <adrian.b.robert@gmail.com>
 
-       * xdisp.c (x_consider_frame_title, update_window_cursor): Remove
-       HAVE_NS conditionals.
+       * xdisp.c (x_consider_frame_title, update_window_cursor):
+       Remove HAVE_NS conditionals.
        (prepare_menu_bars) [HAVE_NS]: Call ns_set_doc_edited.
 
        * nsfns.m (x_implicitly_set_name): If frame-title-format is t, use
 
        * nsterm.m: Remove unneeded prototype.
 
-2010-03-28  Glenn Morris  <rgm@gnu.org>
+2010-03-31  Glenn Morris  <rgm@gnu.org>
 
        * Makefile.in (SOME_MACHINE_OBJECTS): Ensure dbus stuff is always
        in the DOC file.  (Bug#5336)
 
-2010-03-24  Chong Yidong  <cyd@stupidchicken.com>
+2010-03-31  Chong Yidong  <cyd@stupidchicken.com>
 
        * xdisp.c (pos_visible_p): Revert 2008-01-25 change (Bug#5730).
 
-2010-03-20  Jan Djärv  <jan.h.d@swipnet.se>
+2010-03-31  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * window.c (keys_of_window): Remove redundant/overridden bindings.
+
+2010-03-30  Eli Zaretskii  <eliz@gnu.org>
+
+       * xdisp.c (BUFFER_POS_REACHED_P, move_it_in_display_line_to):
+       Restore original behavior when the iterator is not bidi_p.
+
+2010-03-30  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * xdisp.c (syms_of_xdisp): Use intern_c_string instead of intern.
+
+2010-03-30  Eli Zaretskii  <eliz@gnu.org>
+
+       * bidi.c (bidi_cache_iterator_state): Invalidate the cache if we
+       are outside the range of cached character positions.
+
+2010-03-30  Juanma Barranquero  <lekktu@gmail.com>
+
+       * makefile.w32-in ($(BLD)/bidi.$(O)): Add dependency on w32gui.h.
+
+2010-03-30  Eli Zaretskii  <eliz@gnu.org>
+
+       Initial support for bidirectional editing.
+
+       * Makefile.in (obj): Include bidi.o.
+       (bidi.o): New target.
+
+       * makefile.w32-in (OBJ1): Add $(BLD)/bidi.$(O).
+       ($(BLD)/bidi.$(O)): New target.
+
+       * bidi.c: New file.
+
+       * buffer.h (struct buffer): New members bidi_display_reordering
+       and bidi_paragraph_direction.
+
+       * buffer.c (init_buffer_once): Initialize bidi_display_reordering
+       and bidi_paragraph_direction.
+       (syms_of_buffer): Declare Lisp variables bidi-display-reordering
+       and bidi-paragraph-direction.
+       (Fbuffer_swap_text): Swap the values of
+       bidi_display_reordering and bidi_paragraph_direction.
+
+       * dispextern.h (BIDI_MAXLEVEL, BIDI_AT_BASE_LEVEL): New macros.
+       (bidi_type_t, bidi_dir_t): New types.
+       (bidi_saved_info, bidi_stack, bidi_it): New structures.
+       (struct it): New members bidi_p, bidi_it, paragraph_embedding,
+       prev_stop, base_level_stop, and eol_pos.
+       (bidi_init_it, bidi_get_next_char_visually): New prototypes.
+       (IT_STACK_SIZE): Enlarge to 5.
+       (struct glyph_row): New member reversed_p.
+       <string_buffer_position>: Update prototype.
+       (PRODUCE_GLYPHS): Set the reversed_p flag in the iterator's
+       glyph_row if bidi_it.paragraph_dir == R2L.
+       (struct glyph): New members resolved_level and bidi_type.
+
+       * dispnew.c (direct_output_forward_char): Give up if we need bidi
+       processing or buffer's direction is right-to-left.
+       (prepare_desired_row): Preserve the reversed_p flag.
+       (row_equal_p): Compare the reversed_p attributes as well.
+
+       * xdisp.c (init_iterator): Initialize it->bidi_p.  Call
+       bidi_init_it and set it->paragraph_embedding from the current
+       buffer's value of bidi_paragraph_direction.
+       (reseat_1): Initialize bidi_it.first_elt.
+       (set_iterator_to_next, next_element_from_buffer): Use the value of
+       paragraph_embedding to determine the paragraph direction.
+       (set_iterator_to_next): Under bidi reordering, call
+       bidi_get_next_char_visually.  Call bidi_paragraph_init if the
+       new_paragraph flag is set in the bidi iterator.
+       (next_element_from_buffer): If bidi_it.first_elt is set,
+       initialize paragraph direction and find the first character to
+       display in the visual order.  If reseated to a middle of a line,
+       prime the bidi iterator starting at the line's beginning.  Handle
+       the situation where we overstepped stop_charpos due to
+       non-linearity of the bidi iteration.  Likewise for when we back up
+       beyond the previous stop_charpos.  When moving across stop_charpos,
+       record it in prev_stop.
+       (display_line): Set row->end and it->start for the next row to the
+       next character in logical order.  Always extend reversed_p rows to
+       the end of line, even if they end at ZV.  Copy the reversed_p flag
+       to the next glyph row.  Keep calling set_cursor_from_row for
+       bidi-reordered rows even if we already have a possible candidate
+       for cursor position.  Set row_end after all the row's glyphs have
+       been produced, by looping over the glyphs.  Record the position
+       after EOL in it->eol_pos, and use it to set end_pos of the last
+       row produced for a continued line.
+       <Qright_to_left, Qleft_to_right>: New variables.
+       (syms_of_xdisp): Initialize and staticpro them.
+       (string_buffer_position_lim): New function.
+       (string_buffer_position): Most of code moved to
+       string_buffer_position_lim.  Last argument and return value are
+       now EMACS_INT; all callers changed.
+       (set_cursor_from_row): Rewritten to support bidirectional text and
+       reversed glyph rows.
+       (text_outside_line_unchanged_p, try_window_id): Disable
+       optimizations if we are reordering bidirectional text and the
+       paragraph direction can be affected by the change.
+       (append_glyph, append_composite_glyph)
+       (produce_image_glyph, append_stretch_glyph): Set the
+       resolved_level and bidi_type members of each glyph.
+       (append_glyph): If the glyph row is reversed, prepend the glyph
+       rather than appending it.
+       (handle_stop_backwards): New function.
+       (reseat_1, pop_it, push_it): Set prev_stop and base_level_stop.
+       (reseat): call handle_stop_backwards to recompute prev_stop and
+       base_level_stop for the new position.
+       (handle_invisible_prop): Under bidi iteration, skip invisible text
+       using bidi_get_next_char_visually.  If we are `reseat'ed, init the
+       paragraph direction.  Update IT->prev_stop after skipping
+       invisible text.
+       (move_it_in_display_line_to): New variables prev_method
+       and prev_pos.  Compare for strict equality in
+       BUFFER_POS_REACHED_P.
+       (try_cursor_movement): Examine all the candidate rows that occlude
+       point, to return the best match.  If rows are bidi-reordered
+       and point moved backwards, back up to the row that is not a
+       continuation line, and start looking for a suitable row from
+       there.
+
+       * term.c (append_glyph): Reverse glyphs by pre-pending them,
+       rather than appending, if the glyph_row's reversed_p flag is set.
+       Set the resolved_level and bidi_type members of each glyph.
+
+       * .gdbinit (pbiditype): New command.
+       (pgx): Use it to display bidi level and type of the glyph.
+       (pitx): Display some bidi information about the iterator.
+       (prowlims, pmtxrows): New commands.
+
+2010-03-30  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       Remove all uses of C_DEBUG_SWITCH and LIBS_DEBUG.
+       * s/usg5-4.h (LIBS_DEBUG):
+       * s/irix6-5.h (C_DEBUG_SWITCH):
+       * s/gnu-linux.h (LIBS_DEBUG):
+       * s/darwin.h (LIBS_DEBUG):
+       * s/bsd-common.h (LIBS_DEBUG):
+       * s/aix4-2.h (LIBS_DEBUG, C_DEBUG_SWITCH):
+       * m/iris4d.h (LIBS_DEBUG):
+       * m/hp800.h (LIBS_DEBUG): Remove definitions.
+
+       * Makefile.in (LIBES): Remove reference to LIBS_DEBUG.
+       (LIBS_DEBUG): Remove definition.
+
+2010-03-27  Chong Yidong  <cyd@stupidchicken.com>
+
+       * process.c (Fmake_network_process): Don't apply Bug#5173 fix for
+       Windows.
+
+2010-03-25  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+       * process.c (Fmake_network_process): Don't call turn_on_atimers around
+       `connect' (Bug#5723).
+
+2010-03-25  Helmut Eller  <eller.helmut@gmail.com>
+
+       * process.c (Fmake_network_process): Call `select' for interrupted
+       `connect' rather than creating new socket (Bug#5173).
+
+2010-03-24  Jan Djärv  <jan.h.d@swipnet.se>
 
        * frame.c (x_get_arg): Handle RES_TYPE_BOOLEAN_NUMBER (bug #5736).
 
 
        * dispextern.h (resource_types): RES_TYPE_BOOLEAN_NUMBER is new.
 
-2010-03-20  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+2010-03-24  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
 
        * xfns.c (Fx_create_frame) [USE_LUCID]: Add BLOCK_INPUT around
        XLoadQueryFont.
 
-2010-03-16  Kenichi Handa  <handa@m17n.org>
+2010-03-24  Kenichi Handa  <handa@m17n.org>
 
        * coding.c (decode_coding_ccl): Fix previous change for the
        multibyte case.
        case that the output buffer is fullfilled.
        (encode_coding): Setup ccl program here.
 
-2010-03-15  Andreas Politz  <politza@fh-trier.de>  (tiny change)
+2010-03-23  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * s/gnu-linux.h (LIBS_SYSTEM): Remove, same as default.
+
+       Simplify LIBS_MACHINE definitions.
+       * m/hp800.h (LIBS_MACHINE): Remove, same as default.
+       * m/iris4d.h (LIBS_MACHINE): Likewise.
+       * m/ibmrs6000.h (LIBS_MACHINE): Rename to LIBS_SYSTEM and move ...
+       * s/aix4-2.h (LIBS_SYSTEM): ... here.
+       * s/netbsd.h: Remove commented out code.
+
+2010-03-22  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       Remove dead code dealing with POSIX_SIGNALS.
+       * atimer.c (set_alarm): Remove dead code, all USG systems define
+       POSIX_SIGNALS.
+       * data.c (arith_error): Likewise.
+       * keyboard.c (input_available_signal, handle_user_signal)
+       (interrupt_signal): Likewise.
+       * process.c (sigchld_handler): Likewise.
+       (create_process): Remove if 0 code.  Remove HPUX conditional when
+       !defined (POSIX_SIGNALS), it cannot be true.
+       * syssignal.h: Remove USG5_4 and USG conditionals when
+       !POSIX_SIGNALS, they cannot be true.
+
+       * keyboard.c (Fset_input_interrupt_mode): Remove code depending on
+       NO_SOCK_SIGIO, not used anymore.
+
+2010-03-21  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * m/vax.h (BSD_SYSTEM, BSD4_2): Remove conditionals, we only
+       support vax on BSDs.
+
+       * m/ibmrs6000.h (ORDINARY_LINK): Move definition ...
+       * s/aix4-2.h (ORDINARY_LINK): ... here.
+
+2010-03-21  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * Makefile.in (abs_builddir): Define.
+       (bootstrap_exe): Use it.
+       (VPATH): Use $(srcdir) instead of @srcdir@.
+
+2010-03-20  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * Makefile.in (bootstrap_exe): Use an absolute name.
+
+2010-03-20  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       Remove support for old GNU/Linux using libc version 5.
+       * m/alpha.h (LINUX_SBRK_BUG): Remove definition.
+       * emacs.c (main): Remove code depending on LINUX_SBRK_BUG.
+
+       Consolidate redundant definitions in s/bsd-common.h.
+       * s/bsd-common.h (BSD4_2, TABDLY, TAB3, HAVE_TERMIOS, NO_TERMIO)
+       (LIBS_DEBUG, SYSV_SYSTEM_DIR, UNEXEC, NARROWPROTO, BSD_PGRPS)
+       (LDAV_SYMBOL, KERNEL_FILE): Define (or undefine) here instead of
+       doing it in all files that include this one.
+       * s/gnu.h (BSD4_2, TABDLY, TAB3, HAVE_TERMIOS, NO_TERMIO)
+       (LIBS_DEBUG, SYSV_SYSTEM_DIR, UNEXEC, NARROWPROTO, BSD_PGRPS)
+       (LDAV_SYMBOL, KERNEL_FILE): Remove.
+       * s/freebsd.h (BSD4_2, TABDLY, TAB3, HAVE_TERMIOS, NO_TERMIO)
+       (LIBS_DEBUG, SYSV_SYSTEM_DIR, UNEXEC, NARROWPROTO, BSD_PGRPS)
+       (LDAV_SYMBOL, KERNEL_FILE): Remove.
+       * s/netbsd.h (BSD4_2, TABDLY, TAB3, HAVE_TERMIOS, NO_TERMIO)
+       (LIBS_DEBUG, SYSV_SYSTEM_DIR, UNEXEC, NARROWPROTO, BSD_PGRPS)
+       (LDAV_SYMBOL, KERNEL_FILE): Remove.
+
+       Consolidate redundant definitions.
+       * s/usg5-4.h (sigsetmask, PTY_TTY_NAME_SPRINTF): Do not define,
+       it's undefined in all files that include this one.
+       (POSIX_SIGNALS): Define here instead of doing it in all files that
+       include this one.
+       * s/irix6-5.h (sigsetmask, PTY_TTY_NAME_SPRINTF): Do not undef.
+       (POSIX_SIGNALS): Do not define.
+       * s/sol2-6.h (sigsetmask, PTY_TTY_NAME_SPRINTF): Do not undef.
+       (POSIX_SIGNALS): Do not define.
+       * s/unixware.h (sigsetmask, PTY_TTY_NAME_SPRINTF): Do not undef.
+       (POSIX_SIGNALS): Do not define.
+
+       Remove support for old UNIX System V systems.
+       * s/unixware.h: Add the contents of s/usg-5-4-2.h.
+       * s/usg-5-4-2.h: Remove.
+
+       Remove support for Solaris on PPC and for old versions.
+       * s/sol2-6.h: Add the contents of s/sol-2.3.h, s/sol-2.4.h, s/sol-2.5.h.
+       (LD_SWITCH_SYSTEM, USE_MMAP_FOR_BUFFERS): Remove #defines/#undef
+       that cancel each other.
+       * s/sol2-3.h:
+       * s/sol2-4.h:
+       * s/sol2-5.h: Remove.
+       * m/ibmrs6000.h: Remove code for USG5_4, this file is only used on AIX.
+       (NO_REMAP): Remove, unused.
+       (UNEXEC): Move definition ...
+       * s/aix4-2.h (UNEXEC): ... here.
+
+       * s/openbsd.h: Remove support for non-ELF and for systems that do
+       not support shared libraries.
+       * s/netbsd.h:
+       * s/freebsd.h: Likewise.
+
+2010-03-20  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       Remove non-working support for lynxos 3.0.
+       * s/lynxos.h: Remove file.
+
+       * unexec.c (unexec, adjust_lnnoptrs): Do not depend on
+       COFF_BSD_SYMBOLS, nothing defines it anymore.
+
+2010-03-20  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       Remove obsolete uses of HAVE_SHM.
+       * emacs.c (standard_args):
+       (Fdump_emacs):
+       (syms_of_emacs): Remove code depending on HAVE_SHM.
+
+       * alloc.c: Remove HAVE_SHM dependent definition.
+
+       * Makefile.in (RUN_TEMACS): Do not depend on HAVE_SHM.
+
+2010-03-18  Glenn Morris  <rgm@gnu.org>
+
+       * emacs.c (USAGE4): Hard-code bug address.
+       (REPORT_EMACS_BUG_ADDRESS, REPORT_EMACS_BUG_PRETEST_ADDRESS): Remove.
+       (bug_reporting_address): Remove.
+       (main): Don't call bug_reporting_address.
+
+       * Makefile.in (XFT_LIBS, LIBXPM, LIBJPEG, LIBPNG, LIBTIFF, LIBGIF)
+       (LIBGPM, LIBRESOLV): Set using autoconf rather than cpp.
+
+2010-03-15  Chong Yidong  <cyd@stupidchicken.com>
+
+       * xfns.c (Fx_create_frame):
+       * frame.c (Vdefault_frame_scroll_bars): Put non-GTK X scroll-bars
+       on left.
+
+2010-03-13  Andreas Politz  <politza@fh-trier.de>  (tiny change)
 
        * editfns.c (Fformat): Account for string precision when computing
        field width (Bug#5710).
 
+2010-03-12  Chong Yidong  <cyd@stupidchicken.com>
+
+       * xfns.c (Fx_create_frame): Set default to Qright.
+
+       * frame.c (Vdefault_frame_scroll_bars): Set default to Qright for
+       all window systems.
+
+2010-03-12  Eli Zaretskii  <eliz@gnu.org>
+
+       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
+       now identical to when LIBS_TERMCAP is defined.
+
+       * term.c: Remove (ifdef'ed away) inclusion of termcap.h.
+
+       * cm.c: Remove (ifdef'ed away) inclusion of termcap.h.
+
+       * config.in: Regenerated.  (See top-level ChangeLog.)
+
+2010-03-10  Chong Yidong  <cyd@stupidchicken.com>
+
+       * Branch for 23.2.
+
+2010-03-10  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       Cleanup setup of gl_state in various parts of the code.
+       * syntax.h (SETUP_BUFFER_SYNTAX_TABLE): New macro.
+       (SETUP_SYNTAX_TABLE, SETUP_SYNTAX_TABLE_FOR_OBJECT):
+       * syntax.c (find_defun_start, Fchar_syntax, Fmatching_paren)
+       (skip_chars):
+       * regex.c (regex_compile): Use it.
+       (re_compile_pattern): Don't set gl_state.current_syntax_table since
+       it's now set in regex_compile when/if we need it.
+
 2010-03-05  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        Make it possible to C-g in a tight bytecode loop again (bug#5680).
        (scroll_end_callback): Remove.
        (xg_create_scroll_bar): Add parameter end_callback, bind it to
        button-release-event.  Replace value-changed event with change-value,
-       bug #5177,
+       bug #5177.
        (xg_event_is_for_scrollbar): Only return true if button is less than 4,
        bug #5177.
 
 
 2009-12-12  Eli Zaretskii  <eliz@gnu.org>
 
-       * dispextern.h (struct text_pos): Use EMACS_INT;
+       * dispextern.h (struct text_pos): Use EMACS_INT.
        (struct glyph): Use EMACS_INT for charpos.
        (struct it): Use EMACS_INT for stop_charpos, end_charpos,
        region_beg_charpos, region_end_charpos,
        (store_symval_forwarding): Take into account the fact that Ints can
        now have more than one tag.
        * buffer.c (syms_of_buffer): Use LISP_INT_TAG.
-       buffer_slot_type_mismatch):
+       (buffer_slot_type_mismatch):
        * xfaces.c (face_attr_equal_p):
        * print.c (print_object):
        * alloc.c (mark_maybe_object, mark_object, survives_gc_p):
        * xterm.h: Rename x_non_menubar_window_to_frame to
        x_menubar_window_to_frame.
 
-       * xterm.c: Remove declarations also in xterm.h
+       * xterm.c: Remove declarations also in xterm.h.
        (XTmouse_position): Do not return valid positions
        for clicks in the menubar and the toolbar for Gtk+.
 
 2009-07-04  Eli Zaretskii  <eliz@gnu.org>
 
        Emulation of `getloadavg' on MS-Windows.
-       * w32.c: Include float.h
+       * w32.c: Include float.h.
        (g_b_init_get_native_system_info, g_b_init_get_system_times)
        (GetNativeSystemInfo_Proc, GetSystemTimes_Proc): Declare.
        (get_native_system_info, get_system_times): New functions.
        <after-change-functions>: Reflow docstrings.
 
 2008-08-04  Adrian Robert  <Adrian.B.Robert@gmail.com>
-           Ken Raeburn  <raeburn@gnu.org>
+            Ken Raeburn  <raeburn@gnu.org>
 
        Dock menu customization, based on a patch by Ken Raeburn, plus some
        other fixes.
        batch-compiling for bootstrap).
 
 2008-07-15  Chris Hall  <chris@web.workinglinux.com>  (tiny change)
-           YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+            YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
 
-       (make_initial_frame): Call init_frame_faces(f) in CANNOT_DUMP case --
-       fix crash due to different init order.
+       * frame.c (make_initial_frame): Call init_frame_faces(f) in
+       CANNOT_DUMP case -- fix crash due to different init order.
 
 2008-07-15  Adrian Robert  <Adrian.B.Robert@gmail.com>
 
        * m/macppc.h:
        * m/alpha.h: Use GNU_LINUX instead of LINUX.  Reorganize conditionals.
 
-       * m/ibms390x.h (XINT, XUINT): Don't define, same as the default
+       * m/ibms390x.h (XINT, XUINT): Don't define, same as the default.
        (SPECIAL_EMACS_INT):
        * m/ia64.h (SPECIAL_EMACS_INT):
        * m/amdx86-64.h (SPECIAL_EMACS_INT):
 2008-07-10  Dan Nicolaescu  <dann@ics.uci.edu>
 
        * fileio.c:
-       * sysdep.c
+       * sysdep.c:
        * systty.h:
        * m/ibmrs6000.h:
        * m/iris4d.h:
        (USG_SHARED_LIBRARIES): Remove duplicate definition.
 
 2008-06-26  Juanma Barranquero  <lekktu@gmail.com>
-           Eli Zaretskii  <eliz@gnu.org>
+            Eli Zaretskii  <eliz@gnu.org>
 
        * makefile.w32-in (LOCAL_FLAGS):
        Don't include WINDOWSNT, DOS_NT and _UCHAR_T.
        the property of LFACE_FONT of LFACE (if any).
 
 2008-06-21  Seiji Zenitani  <zenitani@mac.com>
-           Ryo Yoshitake  <ryo@shiftmode.net>
+            Ryo Yoshitake  <ryo@shiftmode.net>
 
        * xterm.c (x_set_frame_alpha): Add x_catch_errors for bug#437.
 
        definitions from xmenu.c.  Suggested by Adrian Robert.
 
        * xmenu.c: Remove platform-independent menu definitions.
-       (menu_items menu_items_inuse, menu_items_allocated)
+       (menu_items, menu_items_inuse, menu_items_allocated)
        (menu_items_used, menu_items_n_panes)
        (menu_items_submenu_depth): Move to keyboard.h.
        (init_menu_items, finish_menu_items, unuse_menu_items)
        * xterm.c (x_set_frame_alpha): Move declarations before statements.
 
 2008-05-21  Seiji Zenitani  <zenitani@mac.com>
-           Ryo Yoshitake  <ryo@shiftmode.net>
+            Ryo Yoshitake  <ryo@shiftmode.net>
 
        * frame.c (Qalpha): Add a new frame parameter `alpha'.
        (Vframe_alpha_lower_limit): New variable.
        Report an error when image size is invalid.
        Read two bytes at a time when raw images have max_color_idx above 255.
 
-2008-04-05  Eli Zaretskii  <eliz@gnu.org>
-
-       * w32.c (readdir): If FindFirstFile/FindNextFile return in
-       cFileName a file name that includes `?' characters, use the 8+3
-       alias in cAlternateFileName instead.
-
 2008-04-05  Kenichi Handa  <handa@ni.aist.go.jp>
 
        * ccl.c (ccl_driver): If ccl->quit_silently is nonzero, don't
        * charset.c (charset_ordered_list_tick): New variable.
        (Fdefine_charset_internal): Increment charset_ordered_list_tick.
        (Funify_charset): New optional arg DEUNIFY.  If it is non-nil,
-       deunify intead of unify a charset.
+       deunify instead of unify a charset.
        (string_xstring_p): Add `const' to local variables.
        (find_charsets_in_text): Add `const' to arguments and local variables.
        (encode_char): Adjust for the change of Funify_charset.  Fix
index 921123f236ac13518ad82e4c3cd3b7b5c1915341..8b4a9afbc6c220e8aa15e8170d9ee43c30125775 100644 (file)
        prompt.
        (various): Pass window being displayed as arg to vmotion.
        (various): Compute starting-hpos arg to compute_motion
-        using minibuf_prompt_width if in minibuf starting at top.
+       using minibuf_prompt_width if in minibuf starting at top.
 
        * window.c (Fdisplay_buffer & callers):
        Take second arg, non-nil means do not use selected window
        Use signal, not sigset, since we simulate signal on
        all system versions when nec.
 
-       * buffer.c (syms_of_buffer, init_buffer_once,
-                   reset_buffer_local_variables):
+       * buffer.c (syms_of_buffer, init_buffer_once)
+       (reset_buffer_local_variables):
        Define default-abbrev-mode, and init new buffers' abbrev-mode
        from it.  Move definition of abbrev-mode here from abbrev.c.
 
        * keymap.c, callint.c, minibuf.c, fns.c, commands.h:
        Rename MinbufLocalMap to Vminibuffer_local_map, etc.
        Rename minibuf-local-{,-ns,-completion,must-match}map,
-        and DefLispVar them (document even!).
+       and DefLispVar them (document even!).
        => New lisp variables minibuffer-local-map, minibuffer-local-ns-map,
        minibuffer-local-completion-map, minibuffer-local-must-match-map.
 
index 39b70d9b1997064d35edee5d62fa9d52d56ac7e0..dd847f8a64e4ee5499b6c6196814691ee4aacc35 100644 (file)
 2006-07-02  Kim F. Storm  <storm@cua.dk>
 
        * xdisp.c (display_tool_bar_line): Skip glyphs which are too big
-       to ever fit the tool-bar,
+       to ever fit the tool-bar.
        (MAX_FRAME_TOOL_BAR_HEIGHT): New macro.
        (tool_bar_lines_needed): Use unused mode-line row as temp_row.
        (redisplay_tool_bar): Only clear desired matrix if we actually
        * image.c: Include "charset.h" and "coding.h".
        (x_find_image_file): Return an encoded file name.
 
-2006-04-01  Eli Zaretskii  <eliz@gnu.org>
-
-       * configure: Regenerated.
-
 2006-03-31  Kenichi Handa  <handa@m17n.org>
 
        * xfns.c (xg_set_icon): Delete superfluous UNGCPRO.
 
 2005-07-19  Juanma Barranquero  <lekktu@gmail.com>
 
-       * eval.c (Fprog2, Fcalled_interactively_p),
+       * eval.c (Fprog2, Fcalled_interactively_p)
        (syms_of_eval) <debug-on-quit>: Doc fixes.
        (syms_of_eval) <max-specpdl-size>:
        (Finteractive_p): Fix typos in docstrings.
 2004-12-18  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
 
        * macterm.c (endif, x_font_name_to_mac_font_name):
-       Use maccentraleurroman instead of maccentraleuropean
+       Use maccentraleurroman instead of maccentraleuropean.
        (mac_c_string_match, mac_do_list_fonts): Speed up font search by
        quickly finding a specific font without needing regexps.
 
 
        * gtkutil.h (xg_frame_cleared): Remove.
 
-       * xterm.c (x_clear_frame): Remove call to xg_frame_cleared
+       * xterm.c (x_clear_frame): Remove call to xg_frame_cleared.
        (x_scroll_bar_create, XTset_vertical_scroll_bar):
        Remove arguments left and width to xg_update_scrollbar_pos.
        (XTset_vertical_scroll_bar): Do x_clear_area for USE_GTK also.
 
        * macmenu.c (ENCODE_MENU_STRING): Added to handle multibyte
        strings in menu items.
-       (single_submenu): Use ENCODE_MENU_STRING
+       (single_submenu): Use ENCODE_MENU_STRING.
        (mac_menu_show): Use ENCODE_MENU_STRING.  Reset grabbed because
-       button release isn't passed to event loop
+       button release isn't passed to event loop.
        (add_menu_item): Use SetMenuItemWithCFString.
 
 2004-08-26  Steven Tamm  <steventamm@mac.com>
        (Fxw_display_color_p): Use dpyinfo->color_p.
        (Fx_display_grayscale_p, Fx_display_planes): Don't use
        dpyinfo->n_cbits.
-       (Fx_display_color_cells): Use dpyinfo->n_planes;
+       (Fx_display_color_cells): Use dpyinfo->n_planes.
        (QCmatrix, QCcolor_adjustment, QCmask, Qemboss, Qedge_detection)
        (Qheuristic, cross_disabled_images, emboss_matrix)
        (laplace_matrix): New variables (from xfns.c).
        (append_glyph, append_composite_glyph, produce_image_glyph)
        (append_stretch_glyph): Set glyph's ascent and descent.
        (on_hot_spot_p): New function to check if position is inside an
-       rectangular, circular, or polygon-shaped image hot-spot,
+       rectangular, circular, or polygon-shaped image hot-spot.
        (find_hot_spot): New function to search for image hot-spot.
        (Flookup_image_map): New defun to search for image hot-spot.
        (define_frame_cursor1): New aux function to determine frame
        change/simplify relevant callers.
        (x_y_to_hpos_vpos): Adapt to per-window fringes and scroll bars,
        and new fringe vs. display margin position.
-       Use window_box_left_offset and window_box_right_offset
+       Use window_box_left_offset and window_box_right_offset.
        (get_glyph_string_clip_rect): Adapt to per-window fringes and
        scroll bars, and new fringe vs. display margin position.
        Use WINDOW_LEFT_EDGE_X and WINDOW_TOTAL_WIDTH.
index 265cc95e60dda186bb3713d410314a35309afa19..f087802e27d37bb77b0446227f1f7dfcef4dba83 100644 (file)
        (That `select' saw something on channel 0 doesn't mean it is
        kbd input; it could be an expose event.)
 
-       * keyboard.c (read_avail_input) [FIONREAD]:  Now static.
+       * keyboard.c (read_avail_input) [FIONREAD]: Now static.
        New arg specifies value of NREAD;
        if it is nonzero, don't call get_input_pending to get it.
        Use kbd_buffer_store_char to put chars into kbd_buffer.
 1988-01-06  Richard Stallman  (rms@frosted-flakes)
 
        * s-hpux.h: Don't define nomultiplejobs, LDAV_SYMBOL, LIBS_DEBUG
-        or BROKEN_FIONREAD.
+       or BROKEN_FIONREAD.
        * m-hp9000s300.h: Define those four.
        * s-hpux.h: Define BSTRING, and define bcopy, etc., as macros.
 
        Remove #ifndef VMS around the sleep when buffer is full.
        * s-vms.h: Define nonstandard PENDING_OUTPUT_COUNT for VMS use.
 
-       * fileio.c (file_name_as_directory) [VMS]:  Fix 3rd arg to strncmp.
+       * fileio.c (file_name_as_directory) [VMS]: Fix 3rd arg to strncmp.
 
 1987-07-17  Paul Rubin  (phr@prep)
 
 
 1987-06-09  Richard M. Stallman  (rms@prep)
 
-       * syntax.c: (scan_lists): Clear mathexit on 2nd math-char in a pair.
+       * syntax.c (scan_lists): Clear mathexit on 2nd math-char in a pair.
 
 1987-06-08  Richard M. Stallman  (rms@prep)
 
        Turn on call to vmserrstr.
        * sysdep.c (vmserrstr) [VMS]: Define this function.
 
-       * process.c (create_process) [IRIS]:  Don't open the pty's tty
+       * process.c (create_process) [IRIS]: Don't open the pty's tty
        in the parent process.  Open only once, in the child.
 
        * xdisp.c (redisplay_window): If window-start points nowhere,
 
 1987-05-05  Richard Mlynarik  (mly@prep)
 
-       * m-irist.h:  New version from raible@orville.arpa
-       * s-iris3-5.h:  New file.  (s-usg5-2 with additions)
+       * m-irist.h: New version from raible@orville.arpa
+       * s-iris3-5.h: New file.  (s-usg5-2 with additions)
 
        * keyboard.c:
        IRIS, like HPUX, #defines but does not implement FIONREAD.
        Fcopy_file, Fset_file_modes: Don't use un*x modes if
        env var USE_DOMAIN_ACLS is set.
        Fset_file_modes: utimes fix.
-       Finsert_file_contents:  Must do fstat after open for Apollo.
+       Finsert_file_contents: Must do fstat after open for Apollo.
 
        * emacs.c (main): (APOLLO from lnz):
        Don't use un*x modes if env var USE_DOMAIN_ACLS set.
 
 1987-03-20  Richard Mlynarik  (mly@prep)
 
-       * filemode.c:  Hacks for set-uid/gid but not executable.
+       * filemode.c: Hacks for set-uid/gid but not executable.
 
 1987-03-20  Richard M. Stallman  (rms@prep)
 
 
 1987-02-22  Richard M. Stallman  (rms@prep)
 
-       * dispnew.c (Fopen_termscript):  Close existing termscript
+       * dispnew.c (Fopen_termscript): Close existing termscript
        file before trying to open a new one.  Report open failure
        with report_file_error.
 
 
 1987-02-10  Richard Mlynarik  (mly@prep)
 
-       * xfns.c (Fx_get_default):  Add (unsigned char *) cast.
+       * xfns.c (Fx_get_default): Add (unsigned char *) cast.
 
        * window.c: typo.
 
 1986-11-26  Richard M. Stallman  (rms@prep)
 
        * sysdep.c (get_system_name):
-        Eliminate internal static var in USG case.
+       Eliminate internal static var in USG case.
 
        * lisp.h: New case testing and conversion macros
        UPPERCASEP, LOWERCASEP, NOCASEP, UPCASE, DOWNCASE.
        local variables for more register decls.  Compute
        and pass `envlen' arg to child_setup.
 
-       * process.c (create_process):  Compute and pass `envlen' arg
+       * process.c (create_process): Compute and pass `envlen' arg
        to child_setup.
 
        * xterm.c (x_term_init): Don't call XPopUpWindow at all.
        [So (-259 . (259 . x)) means to format x -exactly- 259 chars wide.]
 
        * dispnew.c (Fding):
-       Do not terminate macro-definition if given an argument
+       Do not terminate macro-definition if given an argument.
        (This is so things like asynchronous process notifications
-       can beep but not screw)
+       can beep but not screw.)
 
 1986-11-10  Richard M. Stallman  (rms@prep)
 
        (so now (let ((case-fold-search t))) doesn't force buffer-localness)
        However, setting a binding will still make it buffer-local.
        (ie (let ((case-fold-search t)) (setq case-fold-search t))
-        will cause case-fold-search be buffer-local even outside the let)
+       will cause case-fold-search be buffer-local even outside the let)
 
        * xfns.c:
        Preserve studlycaps: "Gnuemacs" => "GNU Emacs"
        * editfns.c (Fuser_uid, Fuser_real_uid):
        New functions that return values of geteuid and getuid system calls.
 
-       * dired.c (Ffile_attributes):  Value has additional element
+       * dired.c (Ffile_attributes): Value has additional element
        t iff file gid would change if Emacs deletes it and recreates it.
 
        * xdisp.c (display_mode_element):
        being unbound.  struct catchtag has two new fields,
        gcpro and pdlcount.
 
-       * eval.c (Fthrow, Fsignal):  Use unbind_catch before longjmp.
+       * eval.c (Fthrow, Fsignal): Use unbind_catch before longjmp.
 
        * eval.c (internal_catch): No need to restore anything
        from the catchtag after throw, because unbind_catch does it all.
        * search.c (Freplace_match): Delete unused some_multiletter_word init.
        * alloc.c (gc_sweep): Delete unused next initializers.
        * fns.c (concat): After error on non-int elt for string,
-          do store the new value from the error handler.
+       do store the new value from the error handler.
        * lread.c (read1): Comment out unused end =.
        * lread.c (read_list): Delete unused tail =.
        * data.c (Fmake_variable_buffer_local):
-         If value type is Lisp_Some_Buffer_Local_Value,
-         change it to Lisp_Buffer_Local_Value permanently.
+       If value type is Lisp_Some_Buffer_Local_Value,
+       change it to Lisp_Buffer_Local_Value permanently.
        * undo.c (record_block): Delete unused cp =.
-         Don't bother reallocing if n = 0 after first batch.
+       Don't bother reallocing if n = 0 after first batch.
        * fileio.c (Fverify_visited_file_modtime):
-         If CHECK_BUFFER changes buf, use the changed value.
+       If CHECK_BUFFER changes buf, use the changed value.
 
 1986-07-07  Richard M. Stallman  (rms@prep)
 
 
        * fileio.c (Ffile_newer_than_file_p): New Lisp primitive.
 
-       * fileio.c (Ffile_exists_p):  this is now distinct from
+       * fileio.c (Ffile_exists_p): This is now distinct from
        Ffile_readable_p; it checks only for existence, not for
        readability.
 
        * editfns.c (Fgoto_char): Use new interactive code N.
 
-       * callint.c (Fcall_interactively): New code N
-       means use prefix argif have one, else read number from minibuffer.
+       * callint.c (Fcall_interactively): New code N means use
+       prefix arg if have one, else read number from minibuffer.
 
        * buffer.c (record_buffer):
        Don't use Frassq, Fmemq or Fdelq since their loops
index fbe3f752aedc6180d9c19f14d74721eff71eba5b..e3c5ab70f66c2c02bda49270d6573957a3e5cbcd 100644 (file)
 
        * keyboard.c (Qvertical_split): Renamed to `vertical-line',
        since the window arrangement is actually referred to as a
-       `horizontal split.'
+       `horizontal split'.
        (make_lispy_event, make_lispy_movement, syms_of_keyboard): Uses
        renamed here.
        * keyboard.h (Qvertical_split): Extern declaration changed here.
 1989-12-14  Joseph Arceneaux  (jla@spiff)
 
        * xfns.c: New variable Vx_no_window_manager.
-        (Fx_track_pointer): If bufp < 0, abort.
+       (Fx_track_pointer): If bufp < 0, abort.
 
        * xterm.c (XTread_socket): When leaving window, set x_mouse_x and
        x_mouse_y to -1.
index 7e5728fbbcda5900ef8590d926944b7062ffbd5d..c853ad7b4a616fa853d45493a64c11574316da23 100644 (file)
 
 1993-11-01  Richard Stallman  (rms@mole.gnu.ai.mit.edu)
 
-       * s/sunos4-1-3.h (HAVE_TERMIOS): Defined.
+       * s/sunos4-1-3.h (HAVE_TERMIOS): Define.
 
 1993-10-25  Brian J. Fox  (bfox@albert.gnu.ai.mit.edu)
 
 
        * keyboard.c (read_key_sequence): Don't declare first_event; it is
        no longer used.  Change "#if 0" for first_event reading to
-        "#if defined (GOBBLE_FIRST_EVENT)".
+       "#if defined (GOBBLE_FIRST_EVENT)".
 
 1993-10-03  Brian J. Fox  (bfox@ai.mit.edu)
 
 
        * Makefile.in: File removed.  It is now generated by ../configure.
 
-       * Makefile.in.in (LIBES): Add $(GNULIB_VAR) again at end.  This
-       change to ymakefile was mysteriously lost.  Were any others lost
-       too?
+       * Makefile.in.in (LIBES): Add $(GNULIB_VAR) again at end.
+       This change to ymakefile was mysteriously lost.
+       Were any others lost too?
 
 1993-10-02  Brian J. Fox  (bfox@ai.mit.edu)
 
 
 1993-09-24  Brian J. Fox  (bfox@ai.mit.edu)
 
-       * textprop.c (validate_plist): Add declaration for `list'
-       argument.
+       * textprop.c (validate_plist): Add declaration for `list' argument.
 
        * frame.c (Fhandle_switch_frame): Doc fix.
 
        * doc.c (Fsubstitute_command_keys): Pass new arg.
        * abbrev.c (Funexpand_abbrev, Fexpand_abbrev): Pass new arg.
 
-       * s/aix3-2.h (AIX3_2): Defined.
+       * s/aix3-2.h (AIX3_2): Define.
        * m/ibmrs6000.h (LIBS_MACHINE): Include -lrts, -liconv only if AIX3_2.
 
        * xterm.h (HAVE_X11R4): If AIX, do not define HAVE_X11R4.
 
        * xfns.c (XScreenNumberOfScreen): New function.
 
-       * m/tek4300.h (C_DEBUG_SWITCH, SYSTEM_MALLOC): Defined.
+       * m/tek4300.h (C_DEBUG_SWITCH, SYSTEM_MALLOC): Define.
 
        * m/iris4d.h (START_FILES, LIB_STANDARD): Don't define if USG5_4.
        (DEFAULT_ENTRY_ADDRESS): Likewise.
        (UNEXEC): Use unexelfsgi.o if USG5_4.
 
-       * s/irix5-0.h (C_SWITCH_MACHINE): Deleted.
+       * s/irix5-0.h (C_SWITCH_MACHINE): Delete.
 
 1993-08-13  Frederic Pierresteguy  (F.Pierresteguy@frcl.bull.fr)
 
 
        * m/dpx2.h (HAVE_TCATTR): Macro #defined.
        (HAVE_CLOSEDIR): #undef to allow use of closedir in sysdep.c.
-       (SIGTSTP): Commented #undef to allow use of ^Z in shell-mode.
+       (SIGTSTP): Comment #undef to allow use of ^Z in shell-mode.
        (SIGNALS_VIA_CHARACTERS): #defined.
 
 1993-08-09  Paul Eggert  (eggert@twinsun.com)
        and calculate position properly.
 
        * s/bsd4-2.h, s/bsd4-3.h, s/umax.h, s/rtu.h, s/dgux.h (HAVE_VFORK):
-       Defined.
+       Define.
 
        * ymakefile (alloc.o): Don't use DEBUG_MOLE.
-       (DEBUG_MOLE): Deleted.
+       (DEBUG_MOLE): Delete.
        * gnu-hp300: File deleted.
 
        * .gdbinit: Don't put -q in args.
        (main): Call init_buffer, init_callproc and init_cmdargs
        before init_lread.
        (syms_of_emacs): Install the function, and protect the variable.
-       * lisp.h (Vinvocation_directory): Declared.
+       * lisp.h (Vinvocation_directory): Declare.
        * lread.c (init_lread): Normally put Vinvocation_directory
        at end of Vload_path, if not present already.
 
index d30bd1bdb006121da4d23090a567526f534b6b9a..9be45e2fc54d01cafa6806413377ce5fb1476975 100644 (file)
 1995-06-12  Roland McGrath  <roland@churchy.gnu.ai.mit.edu>
 
        * mem-limits.h [_LIBC] (start_of_data): Define to &__data_start
-       for GNU libc.
+       for GNU libc.
 
 1995-06-11  Richard Stallman  <rms@gnu.ai.mit.edu>
 
        * xterm.c (x_get_keysym_name): New function.
        * keyboard.c (modify_event_symbol): Mask out high bits here,
        and only for certain purposes.  table_size now unsigned.
-       (modify_event_symbol) [HAVE_X_WINDOWS]: Use x_get_keysym_name.
+       (modify_event_symbol) [HAVE_X_WINDOWS]: Use x_get_keysym_name.
        (make_lispy_event): Don't mask high bits here.
        Supply -1 as table_size for system-specific keys.
 
        (Fexecute_extended_command, init_kboard, syms_of_keyboard):
        Undo Feb 28 change; prefix arg handling is now in Lisp code again.
 
-       * buffer.c: (syms_of_buffer): Doc fix.
+       * buffer.c (syms_of_buffer): Doc fix.
 
-       * buffer.c: (Fbuffer_disable_undo): Make this function interactive.
+       * buffer.c (Fbuffer_disable_undo): Make this function interactive.
 
 1995-06-07  Richard Stallman  <rms@gnu.ai.mit.edu>
 
        (ALL_CFLAGS): Insert $(TOOLKIT_DEFINES) here.
        * xfns.c (syms_of_xfns): Provide motif in Motif version.
 
-       * lisp.h: (Fwaiting_for_user_input_p): Function declared.
+       * lisp.h (Fwaiting_for_user_input_p): Function declared.
        (Fupcase_initials, Fupcase_initials_region): Likewise.
        (Fplist_get, get_local_map, Fx_popup_menu, Fx_popup_dialog): Likewise.
        (Fframe_first_window): Likewise.
        based on frame name and icon_name fields.
        (x_set_icon_name): New function.
        (x_icon): Call x_text_icon.
-       (x_set_name): Look at icon_name field when setting the icon name,
+       (x_set_name): Look at icon_name field when setting the icon name.
        (x_frame_parms): Add icon-name.
        (syms_of_xfns): Set up Qicon_name.
 
 1995-05-07  Richard Stallman  <rms@mole.gnu.ai.mit.edu>
 
        * process.c (wait_reading_process_input): Pass arg in new call to
-       set_waiting_for_input.
+       set_waiting_for_input.
 
        * xfns.c (Funfocus_frame): Check for live X frame.
 
 
 1995-05-04  Richard Stallman  <rms@mole.gnu.ai.mit.edu>
 
-       * s/freebsd.h: (GETPGRP_NO_ARG): Defined
+       * s/freebsd.h (GETPGRP_NO_ARG): Define.
        (HAVE_GETPAGESIZE): Definition deleted.
 
        * data.c (store_symval_forwarding): Error if value out of range
 
        * ntinevt.c (do_mouse_event): Use XSETFASTINT.
        (SET_FRAME): Undefined.
-       (select): Renamed to sys_select to correspond to routine in sysdep.c
+       (select): Renamed to sys_select to correspond to routine in sysdep.c.
        (sys_select): Support struct timeval.
        (key_event): Support German keyboard.
        Replace SET_FRAME with XSETFRAME.
 1995-04-11  Roland McGrath  <roland@churchy.gnu.ai.mit.edu>
 
        * process.c (create_process): Set PROCESS's tty_name to Qnil when
-       !PTY_FLAG, so Fprocess_tty_name returns nil for pipes as its
-       docstring says.
+       !PTY_FLAG, so Fprocess_tty_name returns nil for pipes as its
+       docstring says.
 
 1995-04-11  Richard Stallman  <rms@mole.gnu.ai.mit.edu>
 
        * keyboard.c (kbd_buffer_get_event): Pass 0 for `insist' arg.
 
        * m/intel386.h (C_SWITCH_SYSTEM): Don't #undef or define it.
-       [SOLARIS2, SOLARIS2_4, !__GNUC__] (C_SWITCH_MACHINE): Define instead.
+       [SOLARIS2, SOLARIS2_4, !__GNUC__] (C_SWITCH_MACHINE): Define instead.
 
 1995-03-26  Germano Caronni  <caronni@tik.ethz.ch>
 
        * ralloc.c (r_re_alloc): Correct realloc behavior--allow shrinking
-       of blocks while reallocating, if shrinking by more than one page.
+       of blocks while reallocating, if shrinking by more than one page.
        (relocate_blocs, resize_blocs): Added failsafe to protect future
        calling of these routines when in frozen state.
        (r_alloc_thaw): Added call to r_alloc_init.
        * m/sparc.h: Don't include alloca.h if NOT_C_CODE.
 
        * m/mips-siemens.h (UNEXEC): Override the definition.
-       (LIBS_DEBUG, ORDINARY_LINK): Add #undefs.
+       (LIBS_DEBUG, ORDINARY_LINK): Add #undefs.
 
 1995-03-22  Karl Heuer  <kwzh@hal.gnu.ai.mit.edu>
 
 
 1995-02-14  Richard Stallman  <rms@geech.gnu.ai.mit.edu>
 
-       * filelock.c: (unlock_buffer, unlock_all_files, Flock_buffer)
+       * filelock.c (unlock_buffer, unlock_all_files, Flock_buffer)
        (Funlock_buffer): Use buffer's file_truename, not filename.
 
        * buffer.c (syms_of_buffer): Set up Lisp var buffer-file-truename.
 
        * lisp.h (enum Lisp_Type): Lisp_Process, Lisp_Window, Lisp_Frame,
        Lisp_Subr deleted.
-       (PSEUDOVECTORP, GC_PSEUDOVECTORP):  Add paren for proper nesting.
+       (PSEUDOVECTORP, GC_PSEUDOVECTORP): Add paren for proper nesting.
        (PROCESSP, GC_PROCESSP, XSETPROCESS): Rewrite to use pseudovectors.
        (WINDOWP, GC_WINDOWP, XSETWINDOW): Likewise.
        (FRAMEP, GC_FRAMEP): Likewise.
 
 1994-11-19  Francesco Potortì  <pot@cnuce.cnr.it>
 
-       * lisp.h: (running_asynch_code): New global flag.
+       * lisp.h (running_asynch_code): New global flag.
        * emacs.c (running_asynch_code): New global flag.
        (main): Initialise it.
        * process.c (read_process_output, exec_sentinel): Set and
 
 1994-11-17  Karl Heuer  <kwzh@hal.gnu.ai.mit.edu>
 
-       * lisp.h: (enum Lisp_Misc_Type): Rename Lisp_Vector to
+       * lisp.h (enum Lisp_Misc_Type): Rename Lisp_Vector to
        Lisp_Vectorlike.  Mark Lisp_Window_Configuration as obsolete.
        (PSEUDOVECTOR_FLAG, PSEUDOVECTOR_SIZE_MASK, PVEC_BUFFER,
        PVEC_PROCESS, PVEC_FRAME, PVEC_COMPILED, PVEC_WINDOW,
 
 1994-11-14  Karl Heuer  <kwzh@hal.gnu.ai.mit.edu>
 
-       * lisp.h: (enum Lisp_Misc_Type): Add new enumeration Lisp_Misc_Overlay.
+       * lisp.h (enum Lisp_Misc_Type): Add new enumeration Lisp_Misc_Overlay.
        (enum Lisp_Type): Delete the corresponding enumeration from here.
        (struct Lisp_Overlay): New structure.
        (XOVERLAY, OVERLAYP): Access the new structure.
 
 1994-11-11  Karl Heuer  <kwzh@nutrimat.gnu.ai.mit.edu>
 
-       * lisp.h: (enum Lisp_Misc_Type): Add new enumerations
+       * lisp.h (enum Lisp_Misc_Type): Add new enumerations
        Lisp_Misc_Buffer_Local_Value and Lisp_Misc_Some_Buffer_Local_Value.
        (enum Lisp_Type): Delete the corresponding enumerations from here.
        (struct Lisp_Buffer_Local_Value): New structure.
        * xfns.c (Fx_list_fonts): Don't bother to retrieve font info when
        there's no size_ref to compare it against.
 
-       * editfns.c: (Fdecode_time): Fix Lisp_Object vs. integer problems.
+       * editfns.c (Fdecode_time): Fix Lisp_Object vs. integer problems.
        Don't use tm_gmtoff; it's not portable.
 
        * lisp.h: Leave DEVICE_SEP undefined by default.
        Use the return value of child_setup to get the child's pid;
        don't call vfork etc. explicitly.
 
-       * callproc.c [WINDOWSNT]: Add includes.  Define NOMINMAX, _P_NOWAIT.
+       * callproc.c [WINDOWSNT]: Add includes.  Define NOMINMAX, _P_NOWAIT.
        (Vbinary_process_input, Vbinary_process_output)
        (Qbuffer_file_type): Test DOS_NT, not MSDOS.
        (syms_of_callproc): Test DOS_NT, not MSDOS.
 
        * process.c: Handle multiple keyboard input descriptors.
        (non_keyboard_wait_mask): New variable.
-       (Fset_process_filter): Update non_keyboard_wait_mask
+       (Fset_process_filter): Update non_keyboard_wait_mask.
        (create_process, Fopen_network_stream, deactivate_process):
        (init_process, sigchld_handler): Likewise.
        (wait_reading_process_input): Maybe use non_keyboard_wait_mask.
        (the_x_screen): Variable moved here.
        (syms_of_xterm): Staticpro parts of the_x_screen.
        * xfns.c (Fx_open_connection): Get dpyinfo from x_term_init.
-       Don't set up atoms, xrdb here.  Pass name as Lisp_Object.
+       Don't set up atoms, xrdb here.  Pass name as Lisp_Object.
        (the_x_screen): Variable moved to xterm.c.
        (syms_of_xfns): Don't staticpro it here.
 
 
        * xfns.c: Use FRAME_X_DISPLAY instead of x_current_display
        and XDISPLAY.
-       (x_in_use): New variable,
+       (x_in_use): New variable.
        (check_x, using_x_p): Test x_in_use.
        (Fx_open_connection): Set x_in_use.
        (check_x_frame): New function.
 
 1994-10-19  Karl Heuer  <kwzh@hal.gnu.ai.mit.edu>
 
-       * search.c: (searchbufs): New variable, replaces searchbuf and
+       * search.c (searchbufs): New variable, replaces searchbuf and
        last_regexp and search_fastmap.
        (syms_of_search): Initialize it.
        (searchbuf_head): New variable.
        * frame.h [!MULTI_FRAME]: We give up having selected_frame be
        an always-zero integer variable.  From now on it will be a
        pointer to a `struct frame' just like in the MULTI_FRAME case.
-       (selected_frame, last_nonminibuf_frame): use FRAME_PTR, not EMACS_INT.
+       (selected_frame, last_nonminibuf_frame): use FRAME_PTR, not EMACS_INT.
        (XFRAME): Redefine to use the_only_frame.
        (XSETFRAME): Define to set Lisp value.
        (WINDOW_FRAME): Redefine to return Lisp value.
        (the_only_x_display, x_current_display) [!HAVE_X_WINDOWS]: New
        variables.
 
-       * msdos.h: (XFontStruct, GC, Pixmap, Display, Window) [MSDOS_NO_X]:
+       * msdos.h (XFontStruct, GC, Pixmap, Display, Window) [MSDOS_NO_X]:
        Dummy types.
        (struct face, FACE_HAS_GC, FACE_GC, FACE_FOREGROUND, FACE_BACKGROUND,
        FACE_FONT, FACE_STIPPLE, FACE_UNDERLINE_P) [MSDOS_NO_X]: Define like
        (struct Lisp_Free): New structure.
        (Lisp_Misc_Free): Type code for that structure.
        * buffer.h (OVERLAY_POSITION): Marker assert now tests substructure.
-       * alloc.c: (MARKER_BLOCK_SIZE, marker_block, marker_free_list):
+       * alloc.c (MARKER_BLOCK_SIZE, marker_block, marker_free_list):
        Now refers to the superset type, not just markers.
        (allocate_misc): New function, extracted from Fmake_marker.
        (Fpurecopy): Check the substructure.
 
 1994-10-02  Paul Reilly  <pmr@geech.gnu.ai.mit.edu>
 
-       * xfns.c: (HACK_EDITRES): Declare if using X11R5.
+       * xfns.c (HACK_EDITRES): Declare if using X11R5.
        (widget_id_tick): New variable.
        (x_any_window_to_frame): Use lw_window_is_in_menubar for
        widget set independence.
 1994-09-03  Kaveh R. Ghazi  (ghazi@noc.rutgers.edu)
 
        * m/delta88k.h [__GNUC__] (HAVE_ALLOCA): Defined.
-       [__GNUC__] (C_ALLOCA): Add #undef
+       [__GNUC__] (C_ALLOCA): Add #undef.
        (LIB_X11_LIB): Add #undef.
        (HAVE_TERMIOS): Defined.
        (HAVE_TERMIO): Add #undef.
        * fileio.c (Fmake_symbolic_link, Ffile_accessible_directory_p,
        Finsert_file_contents, auto_save_error, Fwrite_region): Likewise.
        (Fcopy_file, build_annotations, Fdo_auto_save): Delete unused
-        variables.
+       variables.
 
 1994-08-23  Richard Stallman  <rms@mole.gnu.ai.mit.edu>
 
 
 1994-06-07  Richard Stallman  (rms@mole.gnu.ai.mit.edu)
 
-       * mips-siemens.h:  Include pyramid.h, not mips.h.
+       * mips-siemens.h: Include pyramid.h, not mips.h.
        (LOAD_AVE_TYPE, LOAD_AVE_CVT): Definitions deleted.
        (NO_ARG_ARRAY, HAVE_ALLOCA): Defined.
        (BROKEN_FIONREAD): Add #undef.
index 6c7d04a531ecf1263310161da45bdc27361c910b..3b1bdbffabc73a0a778da220eacb0450afc5cf4a 100644 (file)
        * dosfns.c (Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard):
        Harmonize arguments with documentation.
 
-       * editfns.c (Fchar_to_string, Fstring_to_char, Fgoto_char, Fencode_time,
+       * editfns.c (Fchar_to_string, Fstring_to_char, Fgoto_char, Fencode_time)
        (Finsert_char, Fbuffer_substring, Fbuffer_substring_no_properties)
        (Finsert_buffer_substring, Fdelete_region, Fnarrow_to_region):
        Harmonize arguments with documentation.
index 6da7b6862a53eb6c9535d200af5710f2df33a12c..4dd3d0dd071468f51d1a4af1a29ab431da921579 100644 (file)
 
        * Makefile.in (LIBGIF): Use libungif.
 
-       * configure.in (HAVE_GIF): Use libungif instead of libgif
-       because the former doesn't contain patented compression code.
-
        * xdisp.c (compute_window_start_on_continuation_line): Don't
        do it if line start is too far away from window start.
 
index b161a21eb72087f448363dd0b1198752b6a81d99..fc4f2d4ad371bd9087d71e6512ec491fdb872218 100644 (file)
 
        * lisp.h (Ftop_level): Add prototype.
 
-       * xterm.c: (xlwmenu_window_p, xlwmenu_redisplay): Add prototypes.
+       * xterm.c (xlwmenu_window_p, xlwmenu_redisplay): Add prototypes.
        (XTread_socket): Improve style of comments to follow other
        comments.
 
 
        * xterm.c (note_mouse_highlight) <help-echo>: When looking for
        help-echo for a string which doesn't have help-echo itself, use
-       get-char-property to obtain the help-echo from the string's buffer
+       get-char-property to obtain the help-echo from the string's buffer.
        (note_mouse_highlight) <mouse-face>: When on a string that doesn't
        have mouse-face, look ``under'' the string for mouse-face from an
        overlay.
        * coding.c (setup_coding_system): Don't do any designation based
        on reg_bits if charset is not yet defined.
 
-       * lisp.h (XVECTOR): Verify correct object type before returning a
+       * lisp.h (XVECTOR): Verify correct object type before returning a
        pointer, using eassert.
 
 2001-07-17  Gerd Moellmann  <gerd@gnu.org>
        creating the directory might signal an error, and leaves
        Emacs in a strange state.
 
-       * term.c: (tty_cursor_hidden): New variable.
+       * term.c (tty_cursor_hidden): New variable.
        (update_begin): Don't call tty_hide_cursor.  Clean up.
        (update_end, set_terminal_window, set_scroll_region): Clean up.
        (ring_bell, reset_terminal_modes): Clean up.
 
        * w32term.c (w32_encode_char): Treat eight bit graphic and control
        characters the same as ASCII and latin-1.
-       (x_display_and_set_cursor): Check for the focus frame's selected
+       (x_display_and_set_cursor): Check for the focus frame's selected
        window instead of selected_window.
        (x_after_update_window_line): Don't clear if frame's internal
        border width is zero.
        * w32fns.c (Fx_show_tip): Fix calls to make_number.
        (x_set_font): If font hasn't changed, avoid recomputing
        faces and other things.
-       (x_set_tool_bar_lines): Do nothing if frame is minibuffer-only,
+       (x_set_tool_bar_lines): Do nothing if frame is minibuffer-only.
        (Fx_create_frame): Add the tool bar height to the frame height.
        (x_create_tip_frame): Prevent changing the tooltip's
        background color by specifying a color for the default font
 
 2001-01-07  Dave Love  <fx@gnu.org>
 
-       * keyboard.c (Fread_key_sequence_vector):  Avoid newline in
+       * keyboard.c (Fread_key_sequence_vector): Avoid newline in
        arglist, for documentation's sake.
 
 2001-01-06  Andrew Innes  <andrewi@gnu.org>
 2001-01-05  Gerd Moellmann  <gerd@gnu.org>
 
        * sysdep.c: Don't prototype srandom; it takes an unsigned argument
-        on some systems, and an unsigned long on others, like FreeBSD 4.1.
+       on some systems, and an unsigned long on others, like FreeBSD 4.1.
 
 2001-01-04  Gerd Moellmann  <gerd@gnu.org>
 
        what's displayed in the window.
 
        * xdisp.c (try_window_reusing_current_matrix)
-       <new start <= old start>:  Disable rows in the current matrix
+       <new start <= old start>: Disable rows in the current matrix
        which are below the window after scrolling.
 
        * xdisp.c (move_it_by_lines): Don't do optimizations if NEED_Y_P
 
        * md5.c: Delay include of md5.h until after namespace cleaning.
 
-       * makefile.w32-in (fns.o): Depend on md5.h
+       * makefile.w32-in (fns.o): Depend on md5.h.
        (md5.o): New target.
        (sunfns.o): Remove.
 
        the metrics of BDF fonts.
        (x_estimate_mode_line_height): If `mode-line' face
        hasn't a font, use that of the frame, as drawing glyphs does.
-       (note_mouse_highlight): Change the cursor shape on the vertical
+       (note_mouse_highlight): Change the cursor shape on the vertical
        border between windows [not enabled].
 
        * w32term.h (struct w32_output): Add member horizontal_drag_cursor.
        `vertical-line', `mode-line' and `header-line' events.
 
        * xdisp.c (try_window_id): Avoid starting to display in the middle
-        of a character, a TAB for instance.  This is easier than to set
-        up the iterator exactly, and it's not a frequent case, so the
-        additional effort wouldn't really pay off.
+       of a character, a TAB for instance.  This is easier than to set
+       up the iterator exactly, and it's not a frequent case, so the
+       additional effort wouldn't really pay off.
 
 2000-11-26  Andrew Choi  <akochoi@i-cable.com>
 
 2000-11-24  Gerd Moellmann  <gerd@gnu.org>
 
        * xdisp.c (init_from_display_pos): If POS says we're already after
-        an overlay string ending at POS, make sure to pop the iterator
-        because it will be in front of that overlay string.  When POS is
-        ZV, we've thereby also ``processed'' overlay strings at ZV.
+       an overlay string ending at POS, make sure to pop the iterator
+       because it will be in front of that overlay string.  When POS is
+       ZV, we've thereby also ``processed'' overlay strings at ZV.
 
        * xfaces.c (lface_from_face_name): Function comment fix.
 
        * lisp.h (pos_visible_p): Change prototype.
 
        * dispextern.h (CURRENT_MODE_LINE_HEIGHT)
-       (CURRENT_HEADER_LINE_HEIGHT):  Look at current_mode_line_height
+       (CURRENT_HEADER_LINE_HEIGHT): Look at current_mode_line_height
        and current_header_line_height first.
        (current_mode_line_height, current_header_line_height):
        Declare extern.
        (create_offscreen_bitmap): New function.
        (w32_BDF_TextOut): Use it. Draw glyphs as DIBs.
 
-       * w32term.c (x_produce_glyphs):  If the distance from the current
+       * w32term.c (x_produce_glyphs): If the distance from the current
        position to the next tab stop is less than a canonical character
        width, use the tab stop after that.
        (x_draw_glyphs): Handle case START and END are out of bounds more
 
        * charset.h (MAKE_CHAR): Be sure to set MSB of C1 to 0.
 
-       * charset.c: Include composite.h
+       * charset.c: Include composite.h.
        (lisp_string_width): New function.
        (Fstring_width): Call lisp_string_width instead of strwidth.
 
 
        * s/ms-w32.h (ORDINARY_LINK): New define.
 
-       * w32.c (_ANONYMOUS_UNION) [__GNUC__]: New define
+       * w32.c (_ANONYMOUS_UNION) [__GNUC__]: New define.
        (_ANONYMOUS_STRUCT) [__GNUC__]: New define.
 
        * makefile.w32-in (clean): Don't delete config.h and epaths.h.
        CYCLE_CHECK arguments.
        (merge_face_vector_with_property, Finternal_merge_in_global_face)
        (lookup_named_face, lookup_derived_face, realize_named_face)
-       (face_at_string_position, face_at_buffer_position):  Supply
+       (face_at_string_position, face_at_buffer_position): Supply
        new F and CYCLE_CHECK arguments to merge_face_vectors.
        (merge_face_heights): New function.
        (merge_face_vectors, merge_face_vector_with_property)
        (x_compute_glyph_string_overhangs): Incomplete body removed, as
        the X way of doing this will not work for W32.
        (w32_intersect_rectangles): Removed. Use IntersectRect API call.
-       (x_draw_image_foreground):  Avoid drawing outside of the clip area
+       (x_draw_image_foreground): Avoid drawing outside of the clip area
        when image doesn't have a mask.
        (note_mouse_highlight): Process overlays in the right order of
        priority. Set help_echo_window.
        (encode_coding_iso2022): New local variable safe_chars.  Check
        unsafe chars.
        (setup_coding_system): Delete the code to initialize
-       coding->safe_charses
+       coding->safe_charses.
        (intersection, find_safe_codings): New functions.
        (Ffind_coding_systems_region_internal): New function.
        (syms_of_coding): Defsubr it.  Initialize Qsafe_chars,
        * w32term.c (help_echo_object, help_echo_pos): New variables.
        (note_mode_line_highlight): Store additional information about the
        help-echo in help_echo_object and help_echo_pos.  Check both
-       `local-map' and `keymap' properties for changing the cursor
+       `local-map' and `keymap' properties for changing the cursor.
        (note_mouse_highlight): Store additional information about the
        help-echo in help_echo_object and help_echo_pos.
        (note_tool_bar_highlight): Set help_echo_object to nil and
        * xterm.c (help_echo_object, help_echo_pos): New variables.
        (note_mode_line_highlight): Store additional information about the
        help-echo in help_echo_object and help_echo_pos.  Check both
-       `local-map' and `keymap' properties for changing the cursor
+       `local-map' and `keymap' properties for changing the cursor.
        (note_mouse_highlight): Store additional information about the
        help-echo in help_echo_object and help_echo_pos.
        (note_tool_bar_highlight): Set help_echo_object to nil and
        (encode_coding_string): Likewise.
 
        * ccl.c (ccl_driver) <CCL_ReadMultibyteChar2>
-       <CCL_WriteMultibyteChar2>:  Handle charsets eight-bit-control and
+       <CCL_WriteMultibyteChar2>: Handle charsets eight-bit-control and
        eight-bit-graphic correctly.
 
 2000-05-24  Kenichi HANDA  <handa@etl.go.jp>
        (detect_coding_utf_8): New function.
        (UTF_16_INVALID_P, UTF_16_HIGH_SURROGATE_P
        UTF_16_LOW_SURROGATE_P): New macros.
-       (detect_coding_utf_16): New function
+       (detect_coding_utf_16): New function.
        (detect_coding_mask): When priorities are specified, skip any
        categories that have `nil' coding-system.  Fix bug of returning
        wrong mask when PRIORITIES is specified and detect_coding_XXX()
 
        * makefile.nt: Add atimer.h to dependencies.
        * w32.c (init_environment): Set Vw32_num_mouse_buttons here.
-       * w32console.c: Only disable window system features for dispextern.h
+       * w32console.c: Only disable window system features for dispextern.h.
        (initialize_w32_display): Build a display info for the console.
        * w32faces.c (tty_defined_color): Apply xfaces.c change from 02-17.
        * w32fns.c (w32_wnd_proc) [WM_LBUTTON_DOWN, WM_RBUTTON_DOWN,
        (xim_destroy_callback, xim_open_dpy, xim_instantiate_callback)
        (xim_initialize, xim_close)
        [HAVE_X_I18N && HAVE_X11R6]: New functions.
-       (x_destroy_window) [HAVE_X_I18N]:  Call xic_destroy_frame.
+       (x_destroy_window) [HAVE_X_I18N]: Call xic_destroy_frame.
        (x_term_init) [HAVE_X_I18N]: Call xim_initialize.
        (x_delete_display) [HAVE_X_I18N]: Call xim_close.
 
        (FRAME_XIM): Removed.
 
        * xfns.c (supported_styles): New variable.
-       (DEFAULT_STYLE, DEFAULT_FONT): New macros
+       (DEFAULT_STYLE, DEFAULT_FONT): New macros.
        (xic_create_xfontset, best_style, xic_create_frame)
        (xic_destroy_frame, xic_set_preeditarea, xic_set_statusarea)
        (xic_set_xfontset): New functions.
 
 2000-01-19  Dave Love  <fx@gnu.org>
 
-       * lread.c: (syms_of_lread) [user-init-file]: Doc change.
+       * lread.c (syms_of_lread) [user-init-file]: Doc change.
 
 2000-01-18  Kenichi Handa  <handa@etl.go.jp>
 
        (GC_STRING_BYTES, GC_STRING_CHARS): New macros.
        (DONT_COPY_FLAG): Removed.
        (SBLOCK_SIZE, LARGE_STRING_BYTES): New macros.
-       (struct sdata, struct sblock): New
+       (struct sdata, struct sblock): New.
        (struct string_block): Rewritten.
        (STRINGS_IN_STRING_BLOCK): New macro.
        (oldest_sblock, current_sblock, total_strings, total_free_strings)
index 9caa01d9066e872836d861f186de63c72d60ea7a..9ee5631ef70ea550c791b798ca63553ce61c3be8 100644 (file)
@@ -1,7 +1,8 @@
+
 # Makefile for GNU Emacs.
 # Copyright (C) 1985, 1987, 1988, 1993, 1994, 1995, 1999, 2000, 2001, 2002,
-#               2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
-#               Free Software Foundation, Inc.
+#   2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+#   Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
 # script may need modifying in sync with changes made here.  Try to
 # avoid shell-ism because the DOS build has to use the DOS shell.
 
-# Don't try to replace the cpp processing using autoconf facilities,
-# says rms.
-# Replacing a particular part of the conditionals to work via autoconf
-# is OK.
-# Some of the conditionals might be dead now.  Finding them and
-# deleting them would be fine.
-
+SHELL = /bin/sh
 
 # Here are the things that we expect ../configure to edit.
 # We use $(srcdir) explicitly in dependencies so as not to depend on VPATH.
-srcdir=@srcdir@
-VPATH=@srcdir@
-CC=@CC@
-CPP=@CPP@
-CFLAGS=@CFLAGS@
-CPPFLAGS=@CPPFLAGS@
-LDFLAGS=@LDFLAGS@
-LN_S=@LN_S@
-EXEEXT=@EXEEXT@
-version=@version@
+srcdir = @srcdir@
+abs_builddir = @abs_builddir@
+VPATH = $(srcdir)
+CC = @CC@
+CFLAGS = @CFLAGS@
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@
+EXEEXT = @EXEEXT@
+version = @version@
 # Substitute an assignment for the MAKE variable, because
 # BSD doesn't have it as a default.
 @SET_MAKE@
 # Don't use LIBS.  configure puts stuff in it that either shouldn't be
-# linked with Emacs or is duplicated by the cpp stuff below.
+# linked with Emacs or is duplicated by the other stuff below.
 # LIBS = @LIBS@
 LIBOBJS = @LIBOBJS@
 
@@ -63,381 +57,165 @@ M_FILE = ${srcdir}/@machfile@
 S_FILE = ${srcdir}/@opsysfile@
 config_h = config.h $(M_FILE) $(S_FILE)
 
-bootstrap_exe = ../src/bootstrap-emacs${EXEEXT}
+bootstrap_exe = ${abs_builddir}/bootstrap-emacs${EXEEXT}
 
+## ns-app if HAVE_NS, else empty.
 OTHER_FILES = @OTHER_FILES@
 
-# ========================== start of cpp stuff =======================
-/* From here on, comments must be done in C syntax.  */
-
-C_SWITCH_SYSTEM=
-
-/* just to be sure the sh is used */
-SHELL=/bin/sh
-
-#define THIS_IS_MAKEFILE
-#define NOT_C_CODE
-#include "config.h"
-
-#ifdef AUTO_DEPEND
-DEPFLAGS = -MMD -MF deps/$*.d
-#endif
-
-/* Do not let the file name mktime.c get messed up.  */
-#ifdef mktime
-#undef mktime
-#endif
-
-/* Use HAVE_X11 as an alias for X11 in this file
-   to avoid problems with X11 as a subdirectory name
-   in -I and other such options which pass through this file. */
-
-#ifdef X11
-#define HAVE_X11
-#undef X11
-#endif
-
-/* On some machines #define register is done in config;
-   do not let it interfere with this file.  */
-#undef register
-
-/* GNU libc requires ORDINARY_LINK so that its own crt0 is used.
-   GNU/Linux is an exception because it uses a funny variant of GNU libc.  */
-#ifdef __GNU_LIBRARY__
-#ifndef GNU_LINUX
-#define ORDINARY_LINK
-#endif
-#endif
-
-/* Some machines do not find the standard C libraries in the usual place.  */
-#ifndef ORDINARY_LINK
-#ifndef LIB_STANDARD
-#define LIB_STANDARD -lc
-#endif
-#else
-#ifndef LIB_STANDARD
-#define LIB_STANDARD
-#endif
-#endif
-
-/* Under GNUstep, putting libc on the link line causes problems. */
-#ifdef NS_IMPL_GNUSTEP
-#undef LIB_STANDARD
-#define LIB_STANDARD
-#endif
-
-/* Unless inhibited or changed, use -lg to link for debugging.  */
-#ifndef LIBS_DEBUG
-#define LIBS_DEBUG -lg
-#endif
-
-/* Some s/SYSTEM.h files define this to request special libraries.  */
-#ifndef LIBS_SYSTEM
-#define LIBS_SYSTEM
-#endif
-
-/* Some m/MACHINE.h files define this to request special libraries.  */
-#ifndef LIBS_MACHINE
-#define LIBS_MACHINE
-#endif
-
-#ifndef LIB_MATH
-#  define LIB_MATH -lm
-#endif /* LIB_MATH */
-
-/* Some s/SYSTEM.h files define this to request special switches in ld.  */
-#ifndef LD_SWITCH_SYSTEM
-#if !defined (__GNUC__) && ((defined (BSD_SYSTEM) && !defined (COFF)))
-#define LD_SWITCH_SYSTEM -X
-#else /* (defined (BSD_SYSTEM) && !defined (COFF)) */
-#define LD_SWITCH_SYSTEM
-#endif /* (defined (BSD_SYSTEM) && !defined (COFF)) */
-#endif /* LD_SWITCH_SYSTEM */
-
-/* This holds special options for linking temacs
-   that should be used for linking anything else.  */
-#ifndef LD_SWITCH_SYSTEM_TEMACS
-#define LD_SWITCH_SYSTEM_TEMACS
-#endif
-
-/* Some s/SYSTEM.h files define this to request special switches
-   for compiling temacs.  */
-#ifndef C_SWITCH_SYSTEM_TEMACS
-#define C_SWITCH_SYSTEM_TEMACS
-#endif
-
-/* Some m/MACHINE.h files define this to request special switches in ld.  */
-#ifndef LD_SWITCH_MACHINE
-#define LD_SWITCH_MACHINE
-#endif
-
-/* This holds special options for linking temacs
-   that should be used for linking anything else.  */
-#ifndef LD_SWITCH_MACHINE_TEMACS
-#define LD_SWITCH_MACHINE_TEMACS
-#endif
-
-/* Some m/MACHINE.h files define this to request special switches in cc.  */
-#ifndef C_SWITCH_MACHINE
-#define C_SWITCH_MACHINE
-#endif
-
-/* Some s/SYSTEM.h files define this to request special switches in cc.  */
-#ifndef C_SWITCH_SYSTEM
-#define C_SWITCH_SYSTEM
-#endif
-
-/* These macros are for switches specifically related to X Windows.  */
-#ifndef C_SWITCH_X_MACHINE
-#define C_SWITCH_X_MACHINE
-#endif
-
-#ifndef C_SWITCH_X_SYSTEM
-#define C_SWITCH_X_SYSTEM
-#endif
-
-#ifndef C_SWITCH_X_SITE
-#define C_SWITCH_X_SITE
-#endif
-
-#ifndef LD_SWITCH_X_SITE
-#define LD_SWITCH_X_SITE
-#endif
-
-#ifndef LD_SWITCH_X_DEFAULT
-#define LD_SWITCH_X_DEFAULT
-#endif
-
-#ifndef ORDINARY_LINK
-
-#ifndef CRT0_COMPILE
-#define CRT0_COMPILE $(CC) -c $(ALL_CFLAGS)
-#endif
-
-#ifndef START_FILES
-#ifdef NO_REMAP
-#define START_FILES pre-crt0.o /lib/crt0.o
-#else /* ! defined (NO_REMAP) */
-#define START_FILES ecrt0.o
-#endif /* ! defined (NO_REMAP) */
-#endif /* START_FILES */
-STARTFILES = START_FILES
-
-#else /* ORDINARY_LINK */
-
-/* config.h might want to force START_FILES anyway */
-#ifdef START_FILES
-STARTFILES = START_FILES
-#endif /* START_FILES */
-
-#endif /* not ORDINARY_LINK */
-
-
-#ifdef NS_IMPL_GNUSTEP
-/* Pull in stuff from GNUstep-make. */
-FOUNDATION_LIB=gnu
-GUI_LIB=gnu
-include @GNUSTEP_MAKEFILES@/Additional/base.make
-include @GNUSTEP_MAKEFILES@/Additional/gui.make
-shared=no
-#endif
-
-#ifdef HAVE_DBUS
+CRT_DIR=@CRT_DIR@
+
+## Flags to pass for profiling builds
+PROFILING_CFLAGS = @PROFILING_CFLAGS@
+PROFILING_LDFLAGS = @PROFILING_LDFLAGS@
+
+## Flags to pass to the compiler to enable build warnings
+C_WARNINGS_SWITCH = @C_WARNINGS_SWITCH@
+
+## 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@
+
+## 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
+## may need to deal with X Windows.  For instance, if your X libraries
+## aren't in a place that your loader can find on its own, you might
+## want to add "-L/..." or something similar.  Only used if
+## HAVE_X_WINDOWS.
+## FIXME? configure sets a value for this, but it has never been
+## 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@
+
+## System-specific LDFLAGS.
+LD_SWITCH_SYSTEM=@LD_SWITCH_SYSTEM@
+
+## This holds any special options for linking temacs only (ie, not
+## used by configure).  Not used elsewhere because it sometimes
+## contains options that have to do with using Emacs's crt0, 
+## which are only good with temacs.
+LD_SWITCH_SYSTEM_TEMACS=@LD_SWITCH_SYSTEM_TEMACS@
+
+## Flags to pass to ld only for temacs.
+TEMACS_LDFLAGS = $(LD_SWITCH_SYSTEM) $(LD_SWITCH_SYSTEM_TEMACS)
+
+## $LDFLAGS $PROFILING_LDFLAGS, or empty if NS_IMPL_GNUSTEP (for some reason).
+TEMACS_LDFLAGS2 = @TEMACS_LDFLAGS2@
+
+## Some systems define this to request special libraries.
+LIBS_SYSTEM=@LIBS_SYSTEM@
+
+## Where to find libgcc.a, if using gcc and necessary.
+LIB_GCC=@LIB_GCC@
+
+LD=@LINKER@
+
+## May use $CRT_DIR.
+LIB_STANDARD=@LIB_STANDARD@
+
+## -lm, or empty.
+LIB_MATH=@LIB_MATH@
+
+LIBTIFF=@LIBTIFF@
+LIBJPEG=@LIBJPEG@
+LIBPNG=@LIBPNG@
+LIBGIF=@LIBGIF@
+LIBXPM=@LIBXPM@
+XFT_LIBS=@XFT_LIBS@
+LIBX_EXTRA=$(LIBTIFF) $(LIBJPEG) $(LIBPNG) $(LIBGIF) $(LIBXPM) -lX11 $(XFT_LIBS)
+
+FONTCONFIG_CFLAGS = @FONTCONFIG_CFLAGS@
+FONTCONFIG_LIBS = @FONTCONFIG_LIBS@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+LIBOTF_CFLAGS = @LIBOTF_CFLAGS@
+LIBOTF_LIBS = @LIBOTF_LIBS@
+M17N_FLT_CFLAGS = @M17N_FLT_CFLAGS@
+M17N_FLT_LIBS = @M17N_FLT_LIBS@
+
 DBUS_CFLAGS = @DBUS_CFLAGS@
 DBUS_LIBS = @DBUS_LIBS@
-DBUS_OBJ = dbusbind.o
-#endif
+DBUS_OBJ = @DBUS_OBJ@
 
-#ifdef HAVE_GCONF
 GCONF_CFLAGS = @GCONF_CFLAGS@
 GCONF_LIBS = @GCONF_LIBS@
-#endif
 
-/* DO NOT use -R.  There is a special hack described in lastfile.c
-   which is used instead.  Some initialized data areas are modified
-   at initial startup, then labeled as part of the text area when
-   Emacs is dumped for the first time, and never changed again. */
+GTK_OBJ=@GTK_OBJ@
 
-/* -Demacs is needed to make some files produce the correct version
-   for use in Emacs.
+## -ltermcap, or -lncurses, or -lcurses, or "".
+LIBS_TERMCAP=@LIBS_TERMCAP@
+## terminfo.o if TERMINFO, else tparam.o.
+TERMCAP_OBJ=@TERMCAP_OBJ@
 
-   -DHAVE_CONFIG_H is needed for some other files to take advantage of
-   the information in ``config.h''.  */
+LIBXMU=@LIBXMU@
 
-/* C_SWITCH_X_SITE must come before C_SWITCH_X_MACHINE and C_SWITCH_X_SYSTEM
-   since it may have -I options that should override those two.  */
-ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(MYCPPFLAGS) -I. -I${srcdir} C_SWITCH_MACHINE C_SWITCH_SYSTEM C_SWITCH_X_SITE C_SWITCH_X_MACHINE C_SWITCH_X_SYSTEM C_SWITCH_SYSTEM_TEMACS ${CFLAGS_SOUND} ${RSVG_CFLAGS} ${DBUS_CFLAGS} ${GCONF_CFLAGS} ${CFLAGS} @FREETYPE_CFLAGS@ @FONTCONFIG_CFLAGS@ @LIBOTF_CFLAGS@ @M17N_FLT_CFLAGS@ ${DEPFLAGS}
-ALL_OBJC_CFLAGS=$(ALL_CFLAGS) @GNU_OBJC_CFLAGS@
+LIBXSM=@LIBXSM@
 
-.SUFFIXES: .m
-.c.o:
-#ifdef AUTO_DEPEND
-       @-test -d deps || mkdir deps
-#endif
-       $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $<
-.m.o:
-#ifdef AUTO_DEPEND
-       @-test -d deps || mkdir deps
-#endif
-       $(CC) -c $(CPPFLAGS) $(ALL_OBJC_CFLAGS) $<
+LIBXTR6=@LIBXTR6@
 
-#ifndef LIBX11_SYSTEM
-#define LIBX11_SYSTEM
-#endif
-
-#ifndef LIB_X11_LIB
-#define LIB_X11_LIB -lX11
-#endif
-
-#ifdef HAVE_X_WINDOWS
-XMENU_OBJ = xmenu.o
-XOBJ= xterm.o xfns.o xselect.o xrdb.o fontset.o xsmfns.o fringe.o image.o \
-      xsettings.o xgselect.o
-
-#ifdef HAVE_MENUS
-
-#ifdef USE_GTK
-GTK_OBJ= gtkutil.o
-#endif
-
-/* The X Menu stuff is present in the X10 distribution, but missing
-   from X11.  If we have X10, just use the installed library;
-   otherwise, use our own copy.  */
-#ifdef HAVE_X11
-#ifdef USE_X_TOOLKIT
-OLDXMENU=${lwlibdir}liblw.a
-LIBXMENU= $(OLDXMENU)
-#else /* not USE_X_TOOLKIT */
-OLDXMENU= ${oldXMenudir}libXMenu11.a
-LIBXMENU= $(OLDXMENU)
-#endif /* not USE_X_TOOLKIT */
-#else /* not HAVE_X11 */
-LIBXMENU= -lXMenu
-#endif /* not HAVE_X11 */
-
-#else /* not HAVE_MENUS */
-
-/* Otherwise, do not worry about the menu library at all.  */
-LIBXMENU=
-#endif /* not HAVE_MENUS */
-
-#ifdef USE_X_TOOLKIT
-# define @X_TOOLKIT_TYPE@
-# if HAVE_XAW3D
-LUCID_LIBW= -lXaw3d
-# else
-LUCID_LIBW= -lXaw
-# endif
-# if defined (HAVE_MOTIF_2_1) && defined (HAVE_LIBXP)
-#  define LIB_MOTIF_EXTRA -lXp
-# else
-#  define LIB_MOTIF_EXTRA
-# endif
-# ifdef LIB_MOTIF
-MOTIF_LIBW= LIB_MOTIF LIB_MOTIF_EXTRA
-# else
-MOTIF_LIBW= -lXm LIB_MOTIF_EXTRA
-# endif
-LIBW=$(@X_TOOLKIT_TYPE@_LIBW)
-
-#ifdef HAVE_X11XTR6
-#ifdef NEED_LIBW
-LIBXTR6 = -lSM -lICE -lw
-#else
-LIBXTR6 = -lSM -lICE
-#endif
-#endif
-
-#ifndef LIBXMU
-#define LIBXMU -lXmu
-#endif
-
-LIBXT= $(LIBW) LIBXMU -lXt $(LIBXTR6) -lXext
-
-#else /* not USE_X_TOOLKIT */
-
-#ifdef USE_GTK
-LIBW=@GTK_LIBS@
-OLDXMENU=
-LIBXMENU=
-#endif /* USE_GTK */
-
-#ifdef HAVE_X_SM
-LIBXT=$(LIBW) -lSM -lICE
-#else
-LIBXT=$(LIBW)
-#endif
-#endif /* not USE_X_TOOLKIT */
-
-#if HAVE_XFT
-XFT_LIBS=@XFT_LIBS@
-#endif /* HAVE_XFT */
-
-#if HAVE_XPM
-#ifndef LIBXPM
-#define LIBXPM -lXpm
-#endif /* not defined LIBXPM */
-#else /* not HAVE_XPM */
-#define LIBXPM
-#endif /* not HAVE_XPM */
-
-#if HAVE_JPEG
-#ifndef LIBJPEG
-#define LIBJPEG -ljpeg
-#endif /* not defined LIBJPEG */
-#else /* not HAVE_JPEG */
-#define LIBJPEG
-#endif /* not HAVE_JPEG */
-
-#if HAVE_PNG
-#ifndef LIBPNG
-#define LIBPNG -lpng -lz -lm
-#endif /* not defined LIBPNG */
-#else /* not HAVE_PNG */
-#define LIBPNG
-#endif /* not HAVE_PNG */
-
-#if HAVE_TIFF
-#ifndef LIBTIFF
-#define LIBTIFF -ltiff
-#endif /* not defined LIBTIFF */
-#else /* not HAVE_TIFF */
-#define LIBTIFF
-#endif /* not HAVE_TIFF */
-
-#if HAVE_GIF
-#ifndef LIBGIF
-#define LIBGIF -lgif
-#endif /* not defined LIBGIF */
-#else /* not HAVE_GIF */
-#define LIBGIF
-#endif /* not HAVE_GIF */
-
-#ifdef HAVE_X11
-/* LD_SWITCH_X_DEFAULT comes after everything else that specifies
-   options for where to find X libraries, but before those libraries.  */
-X11_LDFLAGS = LD_SWITCH_X_SITE LD_SWITCH_X_DEFAULT
-LIBX= $(LIBXMENU) $(X11_LDFLAGS) $(LIBXT) LIBTIFF LIBJPEG LIBPNG LIBGIF LIBXPM LIB_X11_LIB LIBX11_SYSTEM $(XFT_LIBS)
-#else /* not HAVE_X11 */
-LIBX= $(LIBXMENU) LD_SWITCH_X_SITE
-#endif /* not HAVE_X11 */
-#endif /* not HAVE_X_WINDOWS */
-
-#if HAVE_GPM
-#ifndef LIBGPM
-#define LIBGPM -lgpm
-#endif /* not defined LIBGPM */
-#else /* not HAVE_GPM */
-#define LIBGPM
-#endif /* not HAVE_GPM */
-
-#if HAVE_LIBRESOLV
-#ifndef LIBRESOLV
-#define LIBRESOLV -lresolv
-#endif /* not defined LIBRESOLV */
-#else /* not HAVE_LIBRESOLV */
-#define LIBRESOLV
-#endif /* not HAVE_LIBRESOLV */
+## $(LIBXMU) -lXt $(LIBXTR6) -lXext if USE_X_TOOLKIT, else $(LIBXSM).
+## Only used if HAVE_X_WINDOWS.
+LIBXT_OTHER=@LIBXT_OTHER@
+
+## If !HAVE_X11 || USE_GTK, empty.
+## Else if USE_X_TOOLKIT really-lwlib, else really-oldxmenu.
+OLDXMENU_TARGET=@OLDXMENU_TARGET@
+
+## If !HAVE_X11 || USE_GTK, empty.
+## Else if USE_X_TOOLKIT, ${lwlibdir}liblw.a.
+## Else ${oldXMenudir}libXMenu11.a.
+## (Actually, rather than being empty, it is set to "nothing".
+## It is never actually used for anything in this case.
+## This is done because there is a rule with target $(OLDXMENU) below,
+## and I think it might be a syntax error with some makes to have
+## an empty target, even if the associated rule is never run.
+## http://lists.gnu.org/archive/html/help-make/2010-05/msg00058.html
+## The alternative would be to put that rule in a makefile fragment.)
+OLDXMENU=@OLDXMENU@
+
+## If HAVE_X11 && !USE_GTK, ${OLDXMENU} ../src/${OLDXMENU}; else empty.
+## We use stamp-xmenu with these two deps to both ensure that lwlib
+## gets remade based on its dependencies in its own makefile,
+## and remake temacs if lwlib gets changed by this. 
+OLDXMENU_DEPS=@OLDXMENU_DEPS@
+
+## If !HAVE_X11 && HAVE_X_WINDOWS, -lXMenu (this case no longer possible).
+## Else if !HAVE_X11 || USE_GTK, empty.
+## Else $(OLDXMENU).
+LIBXMENU=@LIBXMENU@
+
+XMENU_OBJ=@XMENU_OBJ@
+XOBJ=@XOBJ@
+
+TOOLKIT_LIBW=@TOOLKIT_LIBW@
+
+## Only used if HAVE_X11, in LIBX_OTHER.
+LIBXT=$(TOOLKIT_LIBW) $(LIBXT_OTHER)
+
+## If HAVE_X11, $(LIBXT) $(LIBX_EXTRA), else empty.
+LIBX_OTHER=@LIBX_OTHER@
+
+## LIBXMENU is nil if !HAVE_X_WINDOWS.
+## LD_SWITCH_X_SITE should not be used if not using X, but nothing
+## sets it at present, and if something ever does, it should be
+## configure, which should set it to nil in non-X builds.
+LIBX_BASE=$(LIBXMENU) $(LD_SWITCH_X_SITE)
 
 LIBSOUND= @LIBSOUND@
 CFLAGS_SOUND= @CFLAGS_SOUND@
@@ -445,122 +223,122 @@ CFLAGS_SOUND= @CFLAGS_SOUND@
 RSVG_LIBS= @RSVG_LIBS@
 RSVG_CFLAGS= @RSVG_CFLAGS@
 
-#ifndef ORDINARY_LINK
-/* Fix linking if compiled with GCC.  */
-#ifdef __GNUC__
-
-#ifdef LINKER
-#define LINKER_WAS_SPECIFIED
-#endif
-
-/* Versions of GCC >= 2.0 put their library, libgcc.a, in obscure
-   places that are difficult to figure out at make time.  Fortunately,
-   these same versions allow you to pass arbitrary flags on to the
-   linker, so there is no reason not to use it as a linker.
-
-   Well, it is not quite perfect.  The "-nostdlib" keeps GCC from
-   searching for libraries in its internal directories, so we have to
-   ask GCC explicitly where to find libgcc.a.  */
-
-#ifndef LINKER
-#define LINKER $(CC) -nostdlib
-#endif
-
-#ifndef LIB_GCC
-/* Ask GCC where to find libgcc.a.  */
-#define LIB_GCC `$(CC) -print-libgcc-file-name`
-#endif /* not LIB_GCC */
-
-GNULIB_VAR = LIB_GCC
-
-#ifndef LINKER_WAS_SPECIFIED
-/* GCC passes any argument prefixed with -Xlinker directly to the
-   linker.  See prefix-args.c for an explanation of why we do not do
-   this with the shell''s ``for'' construct.
-   Note that some people do not have '.'  in their paths, so we must
-   use ./prefix-args.  */
-#define YMF_PASS_LDFLAGS(flags) `./prefix-args -Xlinker flags`
-#else
-#define YMF_PASS_LDFLAGS(flags) flags
-#endif
-
-#else /* not __GNUC__ */
-GNULIB_VAR =
-
-#endif /* not __GNUC__ */
-#endif /* not ORDINARY_LINK */
-
-#ifdef ORDINARY_LINK
-LD = $(CC)
-#else
-#ifdef LINKER
-LD=LINKER
-#else /* not LINKER */
-LD=ld
-#endif /* not LINKER */
-#endif /* not ORDINARY_LINK */
-
-/* Flags to pass to LD only for temacs.  */
-/* Do not split this line with a backslash.  That can cause trouble with
-   some cpps.  */
-TEMACS_LDFLAGS = LD_SWITCH_SYSTEM LD_SWITCH_SYSTEM_TEMACS LD_SWITCH_MACHINE LD_SWITCH_MACHINE_TEMACS
-
-/* A macro which other sections of Makefile can redefine to munge the
-   flags before they are passed to LD.  This is helpful if you have
-   redefined LD to something odd, like "gcc".
-   (The YMF prefix is a holdover from the old name "ymakefile".)
-  */
-#ifndef YMF_PASS_LDFLAGS
-#define YMF_PASS_LDFLAGS(flags) flags
-#endif
-
-/* Allow config.h to specify a replacement file for unexec.c.  */
-#ifndef UNEXEC
-#define UNEXEC unexec.o
-#endif
+IMAGEMAGICK_LIBS= @IMAGEMAGICK_LIBS@
+IMAGEMAGICK_CFLAGS= @IMAGEMAGICK_CFLAGS@
+
+
+## widget.o if USE_X_TOOLKIT, otherwise empty.
+WIDGET_OBJ=@WIDGET_OBJ@
+
+## sheap.o if CYGWIN, otherwise empty.
+CYGWIN_OBJ=@CYGWIN_OBJ@
+
+## dosfns.o msdos.o w16select.o if MSDOS.
+MSDOS_OBJ =
+## w16select.o termcap.o if MSDOS && HAVE_X_WINDOWS.
+MSDOS_X_OBJ =
+MSDOS_SUPPORT_REAL = ${lispsource}ls-lisp.elc ${lispsource}disp-table.elc \
+ ${lispsource}dos-fns.elc ${lispsource}dos-w32.elc ${lispsource}dos-vars.elc \
+ ${lispsource}term/internal.elc ${lispsource}term/pc-win.elc
+## $MSDOS_SUPPORT_REAL if MSDOS.
+MSDOS_SUPPORT = 
+
+ns_appdir=@ns_appdir@
+ns_appbindir=@ns_appbindir@
+ns_appsrc=@ns_appsrc@
+NS_OBJ=@NS_OBJ@
+NS_SUPPORT=@NS_SUPPORT@
+## Only set if NS_IMPL_GNUSTEP.
+GNU_OBJC_CFLAGS=@GNU_OBJC_CFLAGS@
+
+## Empty if !HAVE_X_WINDOWS
+## xfont.o ftfont.o xftfont.o ftxfont.o if HAVE_XFT
+## xfont.o ftfont.o ftxfont.o if HAVE_FREETYPE
+## else xfont.o
+FONT_OBJ=@FONT_OBJ@
+
+## Used if HAVE_MOUSE.
+REAL_MOUSE_SUPPORT=${lispsource}mouse.elc ${lispsource}select.elc \
+  ${lispsource}scroll-bar.elc
+## Used if HAVE_GPM && !HAVE_MOUSE
+GPM_MOUSE_SUPPORT=${lispsource}mouse.elc
+LIBGPM = @LIBGPM@
+## Either of the two preceding options, or empty.
+MOUSE_SUPPORT=@MOUSE_SUPPORT@
+
+## ${lispsource}tooltip.elc if HAVE_WINDOW_SYSTEM, else empty.
+TOOLTIP_SUPPORT=@TOOLTIP_SUPPORT@
+
+BASE_WINDOW_SUPPORT=${lispsource}fringe.elc ${lispsource}image.elc \
+  ${lispsource}international/fontset.elc ${lispsource}dnd.elc \
+  ${lispsource}tool-bar.elc ${lispsource}mwheel.elc
+
+X_WINDOW_SUPPORT=${lispsource}x-dnd.elc ${lispsource}term/common-win.elc \
+  ${lispsource}term/x-win.elc ${lispsource}dynamic-setting.elc
+
+## If HAVE_X_WINDOWS, both the above
+## else if HAVE_WINDOW_SYSTEM (ie, HAVE_NS) just the former; else empty.
+WINDOW_SUPPORT=@WINDOW_SUPPORT@
+
+## -lresolv, or empty.
+LIBRESOLV = @LIBRESOLV@
+
+LIBSELINUX_LIBS = @LIBSELINUX_LIBS@
 
 INTERVALS_H = dispextern.h intervals.h composite.h
 
 GETLOADAVG_LIBS = @GETLOADAVG_LIBS@
 
-#ifdef MSDOS
-#ifdef HAVE_X_WINDOWS
-MSDOS_OBJ = dosfns.o msdos.o xmenu.o
-#else
-MSDOS_OBJ = dosfns.o msdos.o w16select.o xmenu.o
-#endif
-#endif
-
-#ifdef CYGWIN
-CYGWIN_OBJ = sheap.o
-#endif
-
-#ifdef HAVE_NS
-ns_appdir=@ns_appdir@/
-ns_appbindir=@ns_appbindir@/
-ns_appresdir=@ns_appresdir@/
-ns_appsrc=@ns_appsrc@
-/* Object files for NeXTstep */
-NS_OBJ= nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o \
-       fontset.o fringe.o image.o
-#endif  /* HAVE_NS */
-
-#ifdef HAVE_WINDOW_SYSTEM
-#ifdef HAVE_X_WINDOWS
-#if defined (HAVE_XFT)
-FONT_DRIVERS = xfont.o ftfont.o xftfont.o ftxfont.o
-#elif defined (HAVE_FREETYPE)
-FONT_DRIVERS = xfont.o ftfont.o ftxfont.o
-#else /* ! defined (HAVE_XFT) && ! defined (HAVE_FREETYPE) */
-FONT_DRIVERS = xfont.o
-#endif /* ! defined (HAVE_XFT) && ! defined (HAVE_FREETYPE) */
-#endif /* HAVE_X_WINDOWS */
-#endif /* HAVE_WINDOW_SYSTEM */
-
-/* lastfile must follow all files
-   whose initialized data areas should be dumped as pure by dump-emacs.  */
+RUN_TEMACS = `/bin/pwd`/temacs
+
+START_FILES = @START_FILES@
+
+UNEXEC_OBJ = @UNEXEC_OBJ@
+
+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 ':'.
+MKDEPDIR=@MKDEPDIR@
+
+## DO NOT use -R.  There is a special hack described in lastfile.c
+## which is used instead.  Some initialized data areas are modified
+## at initial startup, then labeled as part of the text area when
+## Emacs is dumped for the first time, and never changed again.
+##
+## -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} \
+  ${C_SWITCH_MACHINE} ${C_SWITCH_SYSTEM} ${C_SWITCH_X_SITE} \
+  ${C_SWITCH_X_SYSTEM} ${CFLAGS_SOUND} ${RSVG_CFLAGS} ${IMAGEMAGICK_CFLAGS} ${DBUS_CFLAGS} \
+  ${GCONF_CFLAGS} ${FREETYPE_CFLAGS} ${FONTCONFIG_CFLAGS} \
+  ${LIBOTF_CFLAGS} ${M17N_FLT_CFLAGS} ${DEPFLAGS} ${PROFILING_CFLAGS} \
+  ${C_WARNINGS_SWITCH} ${CFLAGS}
+ALL_OBJC_CFLAGS=$(ALL_CFLAGS) $(GNU_OBJC_CFLAGS)
+
+.SUFFIXES: .m
+.c.o:
+       @$(MKDEPDIR)
+       $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $<
+.m.o:
+       @$(MKDEPDIR)
+       $(CC) -c $(CPPFLAGS) $(ALL_OBJC_CFLAGS) $<
+
+
+## lastfile must follow all files whose initialized data areas should
+## be dumped as pure by dump-emacs.
 obj=    dispnew.o frame.o scroll.o xdisp.o menu.o $(XMENU_OBJ) window.o \
-       charset.o coding.o category.o ccl.o character.o chartab.o \
+       charset.o coding.o category.o ccl.o character.o chartab.o bidi.o \
        cm.o term.o terminal.o xfaces.o $(XOBJ) $(GTK_OBJ) $(DBUS_OBJ) \
        emacs.o keyboard.o macros.o keymap.o sysdep.o \
        buffer.o filelock.o insdel.o marker.o \
@@ -568,144 +346,53 @@ obj=    dispnew.o frame.o scroll.o xdisp.o menu.o $(XMENU_OBJ) window.o \
        cmds.o casetab.o casefiddle.o indent.o search.o regex.o undo.o \
        alloc.o data.o doc.o editfns.o callint.o \
        eval.o floatfns.o fns.o font.o print.o lread.o \
-       syntax.o UNEXEC bytecode.o \
+       syntax.o $(UNEXEC_OBJ) bytecode.o \
        process.o callproc.o \
        region-cache.o sound.o atimer.o \
        doprnt.o strftime.o intervals.o textprop.o composite.o md5.o \
-       $(MSDOS_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_DRIVERS)
+       $(MSDOS_OBJ) $(MSDOS_X_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_OBJ)
 
-/* Object files used on some machine or other.
-   These go in the DOC file on all machines
-   in case they are needed there.  */
+## Object files used on some machine or other.
+## These go in the DOC file on all machines in case they are needed.
 SOME_MACHINE_OBJECTS = dosfns.o msdos.o \
   xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o fringe.o image.o \
   fontset.o dbusbind.o \
   nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o \
   w32.o w32console.o w32fns.o w32heap.o w32inevt.o \
-  w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o $(FONT_DRIVERS)
-
-
-#ifdef TERMINFO
-/* Used to be -ltermcap here.  If your machine needs that,
-   define LIBS_TERMCAP in the m/MACHINE.h file.  */
-#ifndef LIBS_TERMCAP
-#define LIBS_TERMCAP -lcurses
-#endif /* LIBS_TERMCAP */
-termcapobj = terminfo.o
-#else /* ! defined (TERMINFO) */
-#ifndef LIBS_TERMCAP
-#define LIBS_TERMCAP
-termcapobj = termcap.o tparam.o
-#else /* LIBS_TERMCAP */
-termcapobj = tparam.o
-#endif /* LIBS_TERMCAP */
-#endif /* ! defined (TERMINFO) */
-
-
-#ifndef SYSTEM_MALLOC
-
-#ifndef DOUG_LEA_MALLOC
-gmallocobj = gmalloc.o
-#endif
-
-#ifdef REL_ALLOC
-rallocobj = ralloc.o
-#endif
-
-mallocobj = $(gmallocobj) $(rallocobj) vm-limit.o
-
-#endif /* SYSTEM_MALLOC */
-
-
-#ifdef USE_X_TOOLKIT
-widgetobj= widget.o
-#else /* not USE_X_TOOLKIT */
-widgetobj=
-#endif /* not USE_X_TOOLKIT */
-
-
-/* define otherobj as list of object files that make-docfile
-   should not be told about.  */
-#ifdef CYGWIN
-/* Cygwin differs because of its unexec(). */
-otherobj= $(termcapobj) $(gmallocobj) $(rallocobj) lastfile.o vm-limit.o $(widgetobj) $(LIBOBJS)
-#else
-otherobj= $(termcapobj) lastfile.o $(mallocobj) $(widgetobj) $(LIBOBJS)
-#endif
-
-#ifdef HAVE_MOUSE
-#define MOUSE_SUPPORT ${lispsource}mouse.elc \
-  ${lispsource}select.elc ${lispsource}scroll-bar.elc
-#else
-#ifdef HAVE_GPM
-#define MOUSE_SUPPORT ${lispsource}mouse.elc
-#else
-#define MOUSE_SUPPORT
-#endif
-#endif
-
-#ifdef MSDOS
-#define MSDOS_SUPPORT ${lispsource}ls-lisp.elc ${lispsource}disp-table.elc \
- ${lispsource}dos-fns.elc ${lispsource}dos-w32.elc ${lispsource}dos-vars.elc \
- ${lispsource}term/internal.elc ${lispsource}term/pc-win.elc
-
-#else
-#define MSDOS_SUPPORT
-#endif
-
-#ifdef HAVE_WINDOW_SYSTEM
-#ifdef HAVE_X_WINDOWS
-#define WINDOW_SUPPORT ${lispsource}fringe.elc ${lispsource}image.elc \
- ${lispsource}international/fontset.elc ${lispsource}dnd.elc \
- ${lispsource}tool-bar.elc ${lispsource}mwheel.elc ${lispsource}x-dnd.elc \
- ${lispsource}term/common-win.elc ${lispsource}term/x-win.elc \
- ${lispsource}font-setting.elc
-#else
-#define WINDOW_SUPPORT ${lispsource}fringe.elc ${lispsource}image.elc \
- ${lispsource}international/fontset.elc ${lispsource}dnd.elc \
- ${lispsource}tool-bar.elc ${lispsource}mwheel.elc
-#endif
-#else
-#define WINDOW_SUPPORT
-#endif
-
-#ifdef WINDOWSNT
-#define WINNT_SUPPORT ${lispsource}ls-lisp.elc ${lispsource}disp-table.elc \
-  ${lispsource}dos-w32.elc ${lispsource}w32-vars.elc \
-  ${lispsource}w32-fns.elc ${lispsource}term/common-win.elc \
-  ${lispsource}term/w32-win.elc
-#else
-#define WINNT_SUPPORT
-#endif
-
-#ifdef HAVE_WINDOW_SYSTEM
-#define TOOLTIP_SUPPORT ${lispsource}tooltip.elc
-#else
-#define TOOLTIP_SUPPORT
-#endif
-
-#ifdef HAVE_NS
-#define NS_SUPPORT ${lispsource}emacs-lisp/easymenu.elc \
-  ${lispsource}term/ns-win.elc
-#else
-#define NS_SUPPORT
-#endif
-
-/* This is the platform-specific list of Lisp files loaded into the
-   dumped Emacs.  It is arranged like this because it is easier to generate
-   it semi-mechanically from loadup.el this way.
-
-   Note that this list should not include lisp files which might not
-   be present, like site-load.el and site-init.el; this makefile
-   expects them all to be either present or buildable.
-
-   Files which are loaded unconditionally (i.e., on all platforms) should
-   also be in shortlisp.  Files which are loaded conditionally (i.e., only
-   on some platforms) should instead be in SOME_MACHINE_LISP.  */
-
-/* Place loaddefs.el first, so it gets generated first, since it is on
-   the critical path (relevant in parallel compilations).  */
-
+  w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o $(FONT_OBJ)
+
+## gmalloc.o if !SYSTEM_MALLOC && !DOUG_LEA_MALLOC, else empty.
+GMALLOC_OBJ=@GMALLOC_OBJ@
+
+## vm-limit.o if !SYSTEM_MALLOC, else empty.
+VMLIMIT_OBJ=@VMLIMIT_OBJ@
+
+## ralloc.o if !SYSTEM_MALLOC && REL_ALLOC, else empty.
+RALLOC_OBJ=@RALLOC_OBJ@
+
+## Empty on Cygwin, lastfile.o elsewhere.
+PRE_ALLOC_OBJ=@PRE_ALLOC_OBJ@
+## lastfile.o on Cygwin, empty elsewhere.
+POST_ALLOC_OBJ=@POST_ALLOC_OBJ@
+
+## List of object files that make-docfile should not be told about.
+otherobj= $(TERMCAP_OBJ) $(PRE_ALLOC_OBJ) $(GMALLOC_OBJ) $(RALLOC_OBJ) \
+  $(POST_ALLOC_OBJ) $(VMLIMIT_OBJ) $(WIDGET_OBJ) $(LIBOBJS)
+
+## This is the platform-specific list of Lisp files loaded into the
+## dumped Emacs.  It is arranged like this because it is easier to generate
+## it semi-mechanically from loadup.el this way.
+##
+## Note that this list should not include lisp files which might not
+## be present, like site-load.el and site-init.el; this makefile
+## expects them all to be either present or buildable.
+##
+## Files which are loaded unconditionally (i.e., on all platforms) should
+## also be in shortlisp.  Files which are loaded conditionally (i.e., only
+## on some platforms) should instead be in SOME_MACHINE_LISP.
+##
+## Place loaddefs.el first, so it gets generated first, since it is on
+## the critical path (relevant in parallel compilations).
 lisp= \
        ${lispsource}loaddefs.el \
        ${lispsource}abbrev.elc \
@@ -724,7 +411,7 @@ lisp= \
        ${lispsource}files.elc \
        ${lispsource}format.elc \
        ${lispsource}facemenu.elc \
-       MOUSE_SUPPORT \
+       ${MOUSE_SUPPORT} \
        ${lispsource}emacs-lisp/float-sup.elc \
        ${lispsource}frame.elc \
        ${lispsource}help.elc \
@@ -752,7 +439,7 @@ lisp= \
        ${lispsource}language/slovak.el \
        ${lispsource}language/romanian.el \
        ${lispsource}language/greek.el \
-       ${lispsource}language/hebrew.el \
+       ${lispsource}language/hebrew.elc \
        ${lispsource}language/japanese.el \
        ${lispsource}language/korean.el \
        ${lispsource}language/lao.el \
@@ -784,23 +471,22 @@ lisp= \
        ${lispsource}textmodes/text-mode.elc \
        ${lispsource}emacs-lisp/timer.elc \
        ${lispsource}jka-cmpr-hook.elc \
-       ${lispsource}vc-hooks.elc \
-       ${lispsource}ediff-hook.elc \
+       ${lispsource}vc/vc-hooks.elc \
+       ${lispsource}vc/ediff-hook.elc \
        ${lispsource}epa-hook.elc \
-       TOOLTIP_SUPPORT \
-       MSDOS_SUPPORT \
-       WINNT_SUPPORT \
-       WINDOW_SUPPORT \
-       NS_SUPPORT \
+       ${TOOLTIP_SUPPORT} \
+       ${MSDOS_SUPPORT} \
+       ${WINDOW_SUPPORT} \
+       ${NS_SUPPORT} \
        ${lispsource}widget.elc \
        ${lispsource}window.elc \
        ${lispsource}version.el
 
-/* List of relative names for those files from $lisp that are loaded
-   unconditionally (i.e. on all platforms).  Files from $lisp that
-   are only loaded on some platforms should instead be placed in
-   SOME_MACHINE_LISP.  The only reason this variable exists is to prevent
-   the make-docfile command-line getting too long for some systems.  */
+## List of relative names for those files from $lisp that are loaded
+## unconditionally (i.e. on all platforms).  Files from $lisp that
+## are only loaded on some platforms should instead be placed in
+## SOME_MACHINE_LISP.  The only reason this variable exists is to prevent
+## the make-docfile command-line getting too long for some systems.
 shortlisp= \
        ../lisp/loaddefs.el \
        ../lisp/abbrev.elc \
@@ -844,7 +530,7 @@ shortlisp= \
        ../lisp/language/slovak.el \
        ../lisp/language/romanian.el \
        ../lisp/language/greek.el \
-       ../lisp/language/hebrew.el \
+       ../lisp/language/hebrew.elc \
        ../lisp/language/japanese.el \
        ../lisp/language/korean.el \
        ../lisp/language/lao.el \
@@ -876,16 +562,16 @@ shortlisp= \
        ../lisp/textmodes/paragraphs.elc \
        ../lisp/textmodes/text-mode.elc \
        ../lisp/emacs-lisp/timer.elc \
-       ../lisp/vc-hooks.elc \
+       ../lisp/vc/vc-hooks.elc \
+       ../lisp/vc/ediff-hook.elc \
        ../lisp/jka-cmpr-hook.elc \
-       ../lisp/ediff-hook.elc \
        ../lisp/epa-hook.elc \
        ../lisp/widget.elc \
        ../lisp/window.elc \
        ../lisp/version.el
 
-/* Like $shortlisp, but includes only those files from $lisp that are loaded
-   conditionally (i.e., only on some platforms).  */
+## Like $shortlisp, but includes only those files from $lisp that are loaded
+## conditionally (i.e., only on some platforms).
 SOME_MACHINE_LISP = ../lisp/mouse.elc \
   ../lisp/select.elc ../lisp/scroll-bar.elc \
   ../lisp/ls-lisp.elc ../lisp/dos-fns.elc \
@@ -894,7 +580,7 @@ SOME_MACHINE_LISP = ../lisp/mouse.elc \
   ../lisp/tooltip.elc ../lisp/image.elc \
   ../lisp/fringe.elc ../lisp/dnd.elc \
   ../lisp/mwheel.elc ../lisp/tool-bar.elc \
-  ../lisp/x-dnd.elc ../lisp/font-setting.elc \
+  ../lisp/x-dnd.elc ../lisp/dynamic-setting.elc \
   ../lisp/international/ccl.elc \
   ../lisp/international/fontset.elc \
   ../lisp/mouse.elc \
@@ -904,51 +590,45 @@ SOME_MACHINE_LISP = ../lisp/mouse.elc \
   ../lisp/term/ns-win.elc ../lisp/term/w32-win.elc \
   ../lisp/emacs-lisp/easymenu.elc
 
-/* Construct full set of libraries to be linked.
-   Note that SunOS needs -lm to come before -lc; otherwise, you get
-   duplicated symbols.  If the standard libraries were compiled
-   with GCC, we might need gnulib again after them.  */
-
-LIBES = $(LOADLIBES) $(LIBS) $(LIBX) $(LIBSOUND) $(RSVG_LIBS) $(DBUS_LIBS) \
-   LIBGPM LIBRESOLV LIBS_SYSTEM LIBS_MACHINE LIBS_TERMCAP \
-   LIBS_DEBUG $(GETLOADAVG_LIBS) ${GCONF_LIBS} \
-   @FREETYPE_LIBS@ @FONTCONFIG_LIBS@ @LIBOTF_LIBS@ @M17N_FLT_LIBS@ \
-   $(GNULIB_VAR) LIB_MATH LIB_STANDARD $(GNULIB_VAR)
-
-#ifdef HAVE_SHM
-RUN_TEMACS = `/bin/pwd`/temacs -nl
-#else
-RUN_TEMACS = `/bin/pwd`/temacs
-#endif
+## Construct full set of libraries to be linked.
+## Note that SunOS needs -lm to come before -lc; otherwise, you get
+## 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) $(LIBGPM) $(LIBRESOLV) $(LIBS_SYSTEM) \
+   $(LIBS_TERMCAP) $(GETLOADAVG_LIBS) ${GCONF_LIBS} ${LIBSELINUX_LIBS} \
+   $(FREETYPE_LIBS) $(FONTCONFIG_LIBS) $(LIBOTF_LIBS) $(M17N_FLT_LIBS) \
+   $(LIB_GCC) $(LIB_MATH) $(LIB_STANDARD) $(LIB_GCC)
 
 all: emacs${EXEEXT} $(OTHER_FILES)
 
+## Does anyone ever pay attention to the load-path-shadows output here?
+## The dumped Emacs is as functional and more efficient than
+## bootstrap-emacs, so we replace the latter with the former.
 emacs${EXEEXT}: temacs${EXEEXT} ${etc}DOC ${lisp}
-#ifdef CANNOT_DUMP
-       rm -f emacs${EXEEXT}
-       ln temacs${EXEEXT} emacs${EXEEXT}
-       -EMACSLOADPATH=${lispsource} ./emacs -q -batch -f list-load-path-shadows
-#else
-       LC_ALL=C $(RUN_TEMACS) -batch -l loadup dump
-       @: This new Emacs is as functional and more efficient then
-       @: bootstrap-emacs, so let us replace it.
-       -ln -f emacs${EXEEXT} bootstrap-emacs${EXEEXT}
-       -./emacs -q -batch -f list-load-path-shadows
-#endif /* ! defined (CANNOT_DUMP) */
-
-/* We run make-docfile twice because the command line may get too long
-   on some systems.  */
-/* ${SOME_MACHINE_OBJECTS} comes before ${obj} because some files may
-   or may not be included in ${obj}, but they are always included in
-   ${SOME_MACHINE_OBJECTS}.  Since a file is processed when it is mentioned
-   for the first time, this prevents any variation between configurations
-   in the contents of the DOC file.
-   Likewise for ${SOME_MACHINE_LISP}.  */
-/* Most of this Makefile refers to Lisp files via ${lispsource}, so
-   we also use ${lisp} rather than ${shortlisp} for the dependency since
-   the Makefile uses string equality to decide when we talk about identical
-   files.  Apparently we pass ${shortlisp} rather than ${lisp} to make-docfile
-   only in order to reduce the command line length.  --Stef  */
+       if test "${CANNOT_DUMP}" = "yes"; then \
+         ln -f temacs${EXEEXT} emacs${EXEEXT}; \
+         EMACSLOADPATH=${lispsource} ./emacs -q -batch \
+           -f list-load-path-shadows || true; \
+       else \
+         LC_ALL=C $(RUN_TEMACS) -batch -l loadup dump || exit 1; \
+         ln -f emacs${EXEEXT} bootstrap-emacs${EXEEXT}; \
+         ./emacs -q -batch -f list-load-path-shadows || true; \
+       fi
+
+## We run make-docfile twice because the command line may get too long
+## on some systems.
+## ${SOME_MACHINE_OBJECTS} comes before ${obj} because some files may
+## or may not be included in ${obj}, but they are always included in
+## ${SOME_MACHINE_OBJECTS}.  Since a file is processed when it is mentioned
+## for the first time, this prevents any variation between configurations
+## in the contents of the DOC file.
+## Likewise for ${SOME_MACHINE_LISP}.
+## Most of this Makefile refers to Lisp files via ${lispsource}, so
+## we also use ${lisp} rather than ${shortlisp} for the dependency since
+## the Makefile uses string equality to decide when we talk about identical
+## files.  Apparently we pass ${shortlisp} rather than ${lisp} to make-docfile
+## only in order to reduce the command line length.  --Stef
 ${etc}DOC: ${libsrc}make-docfile${EXEEXT} ${obj} ${lisp} ${SOME_MACHINE_LISP}
        -rm -f ${etc}DOC
        ${libsrc}make-docfile -d ${srcdir} ${SOME_MACHINE_OBJECTS} ${obj} > ${etc}DOC
@@ -960,76 +640,35 @@ ${libsrc}make-docfile${EXEEXT}:
 buildobj.h: Makefile
        echo "#define BUILDOBJ \"${obj} ${otherobj} " "\"" > buildobj.h
 
-temacs${EXEEXT}: $(LOCALCPP) $(STARTFILES) stamp-oldxmenu ${obj} ${otherobj} prefix-args${EXEEXT}
-#ifdef NS_IMPL_GNUSTEP
-       $(CC) -rdynamic YMF_PASS_LDFLAGS ( ${TEMACS_LDFLAGS} \
-       -L@GNUSTEP_SYSTEM_LIBRARIES@ -lgnustep-gui -lgnustep-base \
-       -lobjc $(CONFIG_SYSTEM_LIBS) -lpthread ) -o temacs \
-       ${obj} ${otherobj} ${LIBES}
-#else
-       $(LD) YMF_PASS_LDFLAGS (${STARTFLAGS} ${TEMACS_LDFLAGS}) $(LDFLAGS) \
-    -o temacs ${STARTFILES} ${obj} ${otherobj}  \
-    ${LIBES}
-#endif
-
-/* We do not use ALL_LDFLAGS because LD_SWITCH_SYSTEM and LD_SWITCH_MACHINE
-   often contain options that have to do with using Emacs''s crt0,
-   which are only good with temacs.  */
-prefix-args${EXEEXT}: prefix-args.o $(config_h)
-       $(CC) $(LDFLAGS) prefix-args.o -o prefix-args
-
-#if defined (HAVE_X_WINDOWS) && defined (HAVE_X11) && defined (HAVE_MENUS) && ! defined (USE_GTK)
-
-/* We use stamp-xmenu with these two deps
-   to both ensure that lwlib gets remade based on its dependencies
-   in its own makefile,
-   and remake temacs if lwlib gets changed by this.  */
-stamp-oldxmenu: ${OLDXMENU} ../src/$(OLDXMENU)
-       touch stamp-oldxmenu
-/* Supply an ordering for parallel make.  */
-../src/$(OLDXMENU): ${OLDXMENU}
-
-/* Encode the values of these two macros in Make variables,
-   so we can use $(...) to substitute their values within "...".  */
-C_SWITCH_MACHINE_1 = C_SWITCH_MACHINE
-C_SWITCH_SYSTEM_1 = C_SWITCH_SYSTEM
-C_SWITCH_X_SITE_1 = C_SWITCH_X_SITE
-C_SWITCH_X_MACHINE_1 = C_SWITCH_X_MACHINE
-C_SWITCH_X_SYSTEM_1 = C_SWITCH_X_SYSTEM
 
-#ifdef USE_X_TOOLKIT
-$(OLDXMENU): really-lwlib
+temacs${EXEEXT}: $(START_FILES) stamp-oldxmenu ${obj} ${otherobj}
+       $(LD) ${TEMACS_LDFLAGS} ${TEMACS_LDFLAGS2} \
+         -o temacs ${START_FILES} ${obj} ${otherobj} ${LIBES}
 
+## The following oldxmenu-related rules are only (possibly) used if
+## HAVE_X11 && !USE_GTK, but there is no harm in always defining them
+## (provided we take a little care that OLDXMENU is never empty).
 really-lwlib:
        cd ${lwlibdir}; ${MAKE} ${MFLAGS} \
-    CC='${CC}' CFLAGS='${CFLAGS}' MAKE='${MAKE}' \
-    "C_SWITCH_X_SITE=$(C_SWITCH_X_SITE_1)" \
-    "C_SWITCH_X_MACHINE=$(C_SWITCH_X_MACHINE_1)" \
-    "C_SWITCH_X_SYSTEM=$(C_SWITCH_X_SYSTEM_1)" \
-    "C_SWITCH_MACHINE=$(C_SWITCH_MACHINE_1)" \
-    "C_SWITCH_SYSTEM=$(C_SWITCH_SYSTEM_1)"
-       @true  /* make -t should not create really-lwlib.  */
+    CC='${CC}' CFLAGS='${CFLAGS}' MAKE='${MAKE}'
+       @true  # make -t should not create really-lwlib.
 .PHONY: really-lwlib
-#else /* not USE_X_TOOLKIT */
-$(OLDXMENU): really-oldXMenu
 
 really-oldXMenu:
        cd ${oldXMenudir}; ${MAKE} ${MFLAGS} \
-    CC='${CC}' CFLAGS='${CFLAGS}' MAKE='${MAKE}' \
-    "C_SWITCH_X_SITE=$(C_SWITCH_X_SITE_1)" \
-    "C_SWITCH_X_MACHINE=$(C_SWITCH_X_MACHINE_1)" \
-    "C_SWITCH_X_SYSTEM=$(C_SWITCH_X_SYSTEM_1)" \
-    "C_SWITCH_MACHINE=$(C_SWITCH_MACHINE_1)" \
-    "C_SWITCH_SYSTEM=$(C_SWITCH_SYSTEM_1)"
-       @true  /* make -t should not create really-oldXMenu.  */
+    CC='${CC}' CFLAGS='${CFLAGS}' MAKE='${MAKE}'
+       @true  # make -t should not create really-oldXMenu.
 .PHONY: really-oldXMenu
-#endif /* not USE_X_TOOLKIT */
-#else /* not (HAVE_X_WINDOWS && HAVE_X11 && HAVE_MENUS && ! USE_GTK) */
 
-/* We don''t really need this, but satisfy the dependency.  */
-stamp-oldxmenu:
+## We do not really need this when OLDXMENU_DEPS is empty, but as
+## things stand we need something to satisfy the temacs dependency.
+stamp-oldxmenu: ${OLDXMENU_DEPS}
        touch stamp-oldxmenu
-#endif /* not (HAVE_X_WINDOWS && HAVE_X11 && HAVE_MENUS && ! USE_GTK) */
+
+## Supply an ordering for parallel make.
+../src/$(OLDXMENU): ${OLDXMENU}
+
+$(OLDXMENU): $(OLDXMENU_TARGET)
 
 ../config.status:: epaths.in
        @echo "The file epaths.h needs to be set up from epaths.in."
@@ -1042,301 +681,37 @@ stamp-oldxmenu:
        exit 1
 
 ecrt0.o: ecrt0.c $(config_h)
-#ifdef AUTO_DEPEND
-       @-test -d deps || mkdir deps
-#endif
-       CRT0_COMPILE ${srcdir}/ecrt0.c
+       @$(MKDEPDIR)
+       $(CC) -c $(ALL_CFLAGS) ${srcdir}/ecrt0.c
 doc.o: buildobj.h
 
-#ifndef AUTO_DEPEND
-
-atimer.o: atimer.c atimer.h syssignal.h systime.h lisp.h blockinput.h \
- $(config_h)
-buffer.o: buffer.c buffer.h region-cache.h commands.h window.h \
-   $(INTERVALS_H) blockinput.h atimer.h systime.h character.h \
-   indent.h keyboard.h coding.h keymap.h frame.h lisp.h $(config_h)
-callint.o: callint.c window.h commands.h buffer.h keymap.h \
-   keyboard.h dispextern.h systime.h coding.h composite.h lisp.h $(config_h)
-callproc.o: callproc.c epaths.h buffer.h commands.h lisp.h $(config_h) \
-       process.h systty.h syssignal.h character.h coding.h ccl.h msdos.h \
-        composite.h w32.h blockinput.h atimer.h systime.h frame.h termhooks.h \
-        buffer.h
-casefiddle.o: casefiddle.c syntax.h commands.h buffer.h character.h \
-   composite.h keymap.h lisp.h $(config_h)
-casetab.o: casetab.c buffer.h character.h lisp.h $(config_h)
-category.o: category.c category.h buffer.h charset.h keymap.h  \
-       character.h lisp.h $(config_h)
-ccl.o: ccl.c ccl.h charset.h character.h coding.h composite.h lisp.h $(config_h)
-character.o: character.c character.h buffer.h charset.h composite.h disptab.h \
-   lisp.h $(config_h)
-charset.o: charset.c charset.h character.h buffer.h coding.h composite.h \
-   disptab.h lisp.h $(config_h)
-chartab.o: charset.h character.h ccl.h lisp.h $(config_h)
-coding.o: coding.c coding.h ccl.h buffer.h character.h charset.h composite.h \
-       window.h dispextern.h frame.h termhooks.h lisp.h $(config_h)
-cm.o: cm.c frame.h cm.h termhooks.h termchar.h dispextern.h lisp.h $(config_h)
-cmds.o: cmds.c syntax.h buffer.h character.h commands.h window.h lisp.h $(config_h) \
-       msdos.h dispextern.h keyboard.h keymap.h systime.h coding.h frame.h \
-        composite.h
-pre-crt0.o: pre-crt0.c
-dbusbind.o: dbusbind.c termhooks.h frame.h keyboard.h lisp.h $(config_h)
-dired.o: dired.c commands.h buffer.h lisp.h $(config_h) character.h charset.h \
-   coding.h regex.h systime.h blockinput.h atimer.h composite.h
-dispnew.o: dispnew.c systime.h commands.h process.h frame.h coding.h \
-   window.h buffer.h termchar.h termopts.h termhooks.h cm.h \
-   disptab.h indent.h $(INTERVALS_H) \
-   xterm.h blockinput.h atimer.h character.h msdos.h keyboard.h \
-   syssignal.h lisp.h $(config_h)
-doc.o: doc.c lisp.h $(config_h) epaths.h buffer.h keyboard.h keymap.h \
-   character.h systime.h coding.h composite.h
-doprnt.o: doprnt.c character.h lisp.h $(config_h)
-dosfns.o: buffer.h termchar.h termhooks.h frame.h blockinput.h window.h \
-   msdos.h dosfns.h dispextern.h charset.h coding.h atimer.h systime.h \
-   lisp.h $(config_h)
-editfns.o: editfns.c window.h buffer.h systime.h $(INTERVALS_H) character.h \
-   coding.h frame.h blockinput.h atimer.h lisp.h $(config_h)
-emacs.o: emacs.c commands.h systty.h syssignal.h blockinput.h process.h \
-   termhooks.h buffer.h atimer.h systime.h $(INTERVALS_H) lisp.h $(config_h) \
-   window.h dispextern.h keyboard.h keymap.h frame.h coding.h
-fileio.o: fileio.c window.h buffer.h systime.h $(INTERVALS_H) character.h \
-   coding.h msdos.h blockinput.h atimer.h lisp.h $(config_h) frame.h commands.h
-filelock.o: filelock.c buffer.h character.h coding.h systime.h composite.h \
-   lisp.h $(config_h)
-filemode.o: filemode.c $(config_h)
-frame.o: frame.c xterm.h window.h frame.h termhooks.h commands.h keyboard.h \
-   blockinput.h atimer.h systime.h buffer.h character.h fontset.h font.h    \
-   msdos.h dosfns.h dispextern.h w32term.h termchar.h coding.h composite.h \
-   lisp.h $(config_h) termhooks.h ccl.h
-fringe.o: fringe.c dispextern.h frame.h window.h buffer.h termhooks.h \
-   blockinput.h atimer.h systime.h lisp.h $(config_h)
-font.o: font.c dispextern.h frame.h window.h ccl.h character.h charset.h \
-   font.h lisp.h $(config_h) buffer.h composite.h fontset.h xterm.h
-ftfont.o: dispextern.h frame.h character.h charset.h composite.h font.h \
-   lisp.h $(config_h) blockinput.h atimer.h systime.h coding.h fontset.h \
-   ccl.h ftfont.h
-fontset.o: fontset.c fontset.h ccl.h buffer.h character.h \
-   charset.h frame.h keyboard.h termhooks.h font.h lisp.h $(config_h) \
-   blockinput.h atimer.h systime.h coding.h $(INTERVALS_H) window.h xterm.h
-getloadavg.o: getloadavg.c $(config_h)
-gtkutil.o: gtkutil.c gtkutil.h xterm.h lisp.h frame.h lisp.h $(config_h) \
-  blockinput.h window.h atimer.h systime.h termhooks.h keyboard.h \
-  charset.h coding.h syssignal.h dispextern.h composite.h
-image.o: image.c frame.h window.h dispextern.h blockinput.h atimer.h \
-   systime.h xterm.h w32term.h w32gui.h font.h epaths.h character.h coding.h \
-   nsterm.h nsgui.h lisp.h $(config_h) composite.h termhooks.h ccl.h
-indent.o: indent.c frame.h window.h indent.h buffer.h lisp.h $(config_h) termchar.h \
-   termopts.h disptab.h region-cache.h character.h category.h \
-   keyboard.h systime.h coding.h $(INTERVALS_H)
-insdel.o: insdel.c window.h buffer.h $(INTERVALS_H) blockinput.h character.h \
-   dispextern.h atimer.h systime.h region-cache.h lisp.h $(config_h)
-keyboard.o: keyboard.c termchar.h termhooks.h termopts.h buffer.h character.h \
-   commands.h frame.h window.h macros.h disptab.h keyboard.h syssignal.h \
-   systime.h syntax.h $(INTERVALS_H) blockinput.h atimer.h composite.h \
-   xterm.h puresize.h msdos.h keymap.h w32term.h nsterm.h coding.h \
-   lisp.h $(config_h)
-keymap.o: keymap.c buffer.h commands.h keyboard.h termhooks.h blockinput.h \
-   atimer.h systime.h puresize.h character.h charset.h $(INTERVALS_H) keymap.h window.h \
-   coding.h frame.h lisp.h $(config_h)
-lastfile.o: lastfile.c $(config_h)
-macros.o: macros.c window.h buffer.h commands.h macros.h keyboard.h \
-       dispextern.h lisp.h $(config_h) systime.h coding.h composite.h
-gmalloc.o: gmalloc.c $(config_h)
-ralloc.o: ralloc.c lisp.h $(config_h)
-vm-limit.o: vm-limit.c mem-limits.h lisp.h $(config_h)
-marker.o: marker.c buffer.h character.h lisp.h $(config_h)
-md5.o: md5.c md5.h $(config_h)
-minibuf.o: minibuf.c syntax.h frame.h window.h keyboard.h systime.h \
-   buffer.h commands.h character.h msdos.h $(INTERVALS_H) keymap.h \
-   termhooks.h lisp.h $(config_h) coding.h
-mktime.o: mktime.c $(config_h)
-msdos.o: msdos.c msdos.h dosfns.h systime.h termhooks.h dispextern.h frame.h \
-   termopts.h termchar.h character.h coding.h ccl.h disptab.h window.h \
-   keyboard.h $(INTERVALS_H) buffer.h commands.h blockinput.h atimer.h lisp.h $(config_h)
-nsfns.o: nsfns.m charset.h nsterm.h nsgui.h frame.h window.h buffer.h \
-  dispextern.h nsgui.h fontset.h $(INTERVALS_H) keyboard.h blockinput.h \
-  atimer.h systime.h epaths.h termhooks.h coding.h systime.h lisp.h $(config_h)
-nsfont.o: nsterm.h dispextern.h frame.h lisp.h lisp.h $(config_h)
-nsimage.o: nsimage.m nsterm.h lisp.h $(config_h)
-nsmenu.o: nsmenu.m termhooks.h frame.h window.h dispextern.h \
-  nsgui.h keyboard.h blockinput.h atimer.h systime.h buffer.h \
-  nsterm.h lisp.h $(config_h)
-nsterm.o: nsterm.m blockinput.h atimer.h systime.h syssignal.h nsterm.h \
-  nsgui.h frame.h charset.h ccl.h dispextern.h fontset.h termhooks.h \
-  termopts.h termchar.h disptab.h buffer.h window.h keyboard.h \
-  $(INTERVALS_H) process.h coding.h lisp.h $(config_h)
-nsselect.o: nsselect.m blockinput.h nsterm.h nsgui.h frame.h lisp.h $(config_h)
-process.o: process.c process.h buffer.h window.h termhooks.h termopts.h \
-   commands.h syssignal.h systime.h systty.h syswait.h frame.h dispextern.h \
-   blockinput.h atimer.h charset.h coding.h ccl.h msdos.h composite.h \
-   keyboard.h lisp.h $(config_h) character.h xgselect.h sysselect.h
-regex.o: regex.c syntax.h buffer.h lisp.h $(config_h) regex.h category.h character.h
-region-cache.o: region-cache.c buffer.h region-cache.h lisp.h $(config_h)
-scroll.o: scroll.c termchar.h dispextern.h frame.h msdos.h keyboard.h \
-   termhooks.h lisp.h $(config_h) systime.h coding.h composite.h window.h
-search.o: search.c regex.h commands.h buffer.h region-cache.h syntax.h \
-   blockinput.h atimer.h systime.h category.h character.h charset.h \
-   $(INTERVALS_H) \
-   lisp.h $(config_h)
-sound.o: sound.c dispextern.h syssignal.h lisp.h $(config_h) atimer.h systime.h
-strftime.o: strftime.c $(config_h)
-syntax.o: syntax.c syntax.h buffer.h commands.h category.h character.h \
-   keymap.h regex.h $(INTERVALS_H) lisp.h $(config_h)
-sysdep.o: sysdep.c syssignal.h systty.h systime.h syswait.h blockinput.h \
-   process.h dispextern.h termhooks.h termchar.h termopts.h coding.h \
-   frame.h atimer.h window.h msdos.h dosfns.h keyboard.h cm.h lisp.h $(config_h) \
-   composite.h
-term.o: term.c termchar.h termhooks.h termopts.h lisp.h $(config_h) cm.h frame.h \
-   disptab.h keyboard.h character.h charset.h coding.h ccl.h xterm.h \
-   msdos.h window.h keymap.h blockinput.h atimer.h systime.h systty.h \
-   syssignal.h $(INTERVALS_H) buffer.h
-termcap.o: termcap.c lisp.h $(config_h)
-terminal.o: terminal.c frame.h termchar.h termhooks.h charset.h coding.h \
-   keyboard.h lisp.h $(config_h) dispextern.h composite.h systime.h
-terminfo.o: terminfo.c lisp.h $(config_h)
-tparam.o: tparam.c lisp.h $(config_h)
-undo.o: undo.c buffer.h commands.h window.h dispextern.h lisp.h $(config_h)
-unexaix.o: unexaix.c lisp.h $(config_h)
-unexalpha.o: unexalpha.c $(config_h)
-unexcw.o: unexcw.c lisp.h $(config_h)
-unexec.o: unexec.c lisp.h $(config_h)
-unexelf.o: unexelf.c $(config_h)
-unexhp9k800.o: unexhp9k800.c $(config_h)
-unexmacosx.o: unexmacosx.c $(config_h)
-unexsol.o: unexsol.c lisp.h $(config_h)
-unexw32.o: unexw32.c $(config_h)
-w16select.o: w16select.c dispextern.h frame.h blockinput.h atimer.h systime.h \
-   msdos.h buffer.h charset.h coding.h composite.h lisp.h $(config_h)
-widget.o: widget.c xterm.h frame.h dispextern.h widgetprv.h \
-   $(srcdir)/../lwlib/lwlib.h lisp.h $(config_h)
-window.o: window.c indent.h commands.h frame.h window.h buffer.h termchar.h \
-   disptab.h keyboard.h msdos.h coding.h termhooks.h \
-   keymap.h blockinput.h atimer.h systime.h $(INTERVALS_H) \
-   xterm.h w32term.h nsterm.h lisp.h $(config_h)
-xdisp.o: xdisp.c macros.h commands.h process.h indent.h buffer.h dispextern.h \
-   coding.h termchar.h frame.h window.h disptab.h termhooks.h character.h     \
-   charset.h lisp.h $(config_h) keyboard.h $(INTERVALS_H) region-cache.h xterm.h    \
-   w32term.h nsterm.h msdos.h composite.h fontset.h ccl.h \
-   blockinput.h atimer.h systime.h keymap.h font.h
-xfaces.o: xfaces.c dispextern.h frame.h xterm.h buffer.h blockinput.h  \
-   window.h character.h charset.h msdos.h dosfns.h composite.h atimer.h        \
-   systime.h keyboard.h fontset.h w32term.h nsterm.h coding.h ccl.h \
-   $(INTERVALS_H) termchar.h termhooks.h font.h lisp.h $(config_h)
-xfns.o: xfns.c buffer.h frame.h window.h keyboard.h xterm.h dispextern.h \
-   $(srcdir)/../lwlib/lwlib.h blockinput.h atimer.h systime.h epaths.h \
-   character.h charset.h coding.h gtkutil.h lisp.h $(config_h) termhooks.h \
-   fontset.h termchar.h font.h xsettings.h $(INTERVALS_H) ccl.h
-xfont.o: dispextern.h xterm.h frame.h blockinput.h character.h charset.h \
-   font.h lisp.h $(config_h) atimer.h systime.h fontset.h ccl.h
-xftfont.o: dispextern.h xterm.h frame.h blockinput.h character.h charset.h \
-   font.h lisp.h $(config_h) atimer.h systime.h fontset.h ccl.h ftfont.h
-ftxfont.o: dispextern.h xterm.h frame.h blockinput.h character.h charset.h \
-   font.h lisp.h $(config_h) atimer.h systime.h fontset.h ccl.h
-menu.o: menu.c lisp.h keyboard.h keymap.h frame.h termhooks.h blockinput.h \
-   dispextern.h $(srcdir)/../lwlib/lwlib.h xterm.h gtkutil.h menu.h \
-   lisp.h $(config_h) systime.h coding.h composite.h window.h atimer.h
-xmenu.o: xmenu.c xterm.h termhooks.h window.h dispextern.h frame.h buffer.h \
-   charset.h keyboard.h $(srcdir)/../lwlib/lwlib.h blockinput.h atimer.h \
-   systime.h gtkutil.h msdos.h coding.h menu.h lisp.h $(config_h) composite.h \
-   keymap.h sysselect.h
-xterm.o: xterm.c xterm.h termhooks.h termopts.h termchar.h window.h buffer.h \
-   dispextern.h frame.h disptab.h blockinput.h atimer.h systime.h syssignal.h \
-   keyboard.h emacs-icon.h character.h charset.h ccl.h fontset.h composite.h \
-   coding.h process.h gtkutil.h font.h fontset.h lisp.h $(config_h) \
-   xsettings.h intervals.h keymap.h xgselect.h sysselect.h
-xselect.o: xselect.c process.h dispextern.h frame.h xterm.h blockinput.h \
-  buffer.h atimer.h systime.h termhooks.h lisp.h $(config_h) keyboard.h \
-  coding.h composite.h
-xgselect.o: xgselect.h systime.h sysselect.h lisp.h $(config_h)
-xrdb.o: xrdb.c lisp.h $(config_h) epaths.h
-xsmfns.o: xsmfns.c lisp.h $(config_h) systime.h sysselect.h termhooks.h xterm.h \
-  lisp.h termopts.h frame.h dispextern.h
-xsettings.o: xterm.h xsettings.h lisp.h frame.h termhooks.h $(config_h) \
-  dispextern.h keyboard.h systime.h coding.h composite.h blockinput.h atimer.h \
-  termopts.h
-/* The files of Lisp proper */
-
-alloc.o: alloc.c process.h frame.h window.h buffer.h  puresize.h syssignal.h \
- keyboard.h blockinput.h atimer.h systime.h character.h lisp.h $(config_h) \
- $(INTERVALS_H) termhooks.h
-bytecode.o: bytecode.c buffer.h syntax.h character.h window.h dispextern.h \
-  frame.h xterm.h lisp.h $(config_h)
-data.o: data.c buffer.h puresize.h character.h syssignal.h keyboard.h frame.h \
-   termhooks.h systime.h coding.h composite.h dispextern.h font.h ccl.h \
-   lisp.h $(config_h)
-eval.o: eval.c commands.h keyboard.h blockinput.h atimer.h systime.h \
-  dispextern.h lisp.h $(config_h) coding.h composite.h xterm.h
-floatfns.o: floatfns.c syssignal.h lisp.h $(config_h)
-fns.o: fns.c commands.h lisp.h $(config_h) frame.h buffer.h character.h keyboard.h \
- keymap.h window.h dispextern.h $(INTERVALS_H) coding.h md5.h \
- blockinput.h atimer.h systime.h xterm.h
-print.o: print.c process.h frame.h window.h buffer.h keyboard.h character.h \
-   lisp.h $(config_h) termchar.h $(INTERVALS_H) msdos.h termhooks.h \
-   blockinput.h atimer.h systime.h font.h charset.h coding.h ccl.h
-lread.o: lread.c commands.h keyboard.h buffer.h epaths.h character.h \
- charset.h lisp.h $(config_h) $(INTERVALS_H) termhooks.h coding.h msdos.h \
- systime.h frame.h blockinput.h atimer.h
-
-/* Text properties support */
-composite.o: composite.c buffer.h character.h coding.h font.h ccl.h \
-        frame.h termhooks.h $(INTERVALS_H) window.h lisp.h $(config_h)
-intervals.o: intervals.c buffer.h $(INTERVALS_H) keyboard.h puresize.h \
-       keymap.h lisp.h $(config_h) systime.h coding.h
-textprop.o: textprop.c buffer.h window.h $(INTERVALS_H) \
-       lisp.h $(config_h)
-
-#endif /* ! AUTO_DEPEND */
-
-/* System-specific programs to be made.
-   OTHER_FILES
-   select which of these should be compiled.  */
-
-#ifdef HAVE_NS
-/* In fact, every .o file depends directly or indirectly on dispextern.h
-   and hence nsgui.h under NS.  But the ones that actually use stuff there
-   are more limited.  */
-dispnew.o font.o fontset.o frame.o fringe.o image.o keyboard.o menu.o \
-   window.o xdisp.o xfaces.o: nsgui.h
-
-${ns_appdir}: ${ns_appsrc}
-       rm -fr ${ns_appdir}
-       mkdir -p ${ns_appdir}
-       ( cd ${ns_appsrc} ; tar cfh - . ) | ( cd ${ns_appdir} ; tar xf - )
-       ( cd ${ns_appdir} ; for subdir in `find . -type d ! -name CVS -print` ; do \
-               chmod a+rx $${subdir} ; \
-               rm -rf $${subdir}/CVS ; \
-               rm -f  $${subdir}/.cvsignore ; done ; )
-
-${ns_appbindir}Emacs: emacs${EXEEXT}
-       mkdir -p ${ns_appbindir}
-       cp -f emacs${EXEEXT} ${ns_appbindir}Emacs
-
-ns-app: ${ns_appdir} ${ns_appbindir}Emacs
-
-#endif /* HAVE_NS */
+
+## If HAVE_NS, some ns-specific rules (for OTHER_FILES) are inserted here.
+@ns_frag@
+
 
 mostlyclean:
-       rm -f temacs${EXEEXT} prefix-args${EXEEXT} core *.core \#* *.o libXMenu11.a liblw.a
+       rm -f temacs${EXEEXT} core *.core \#* *.o libXMenu11.a liblw.a
        rm -f ../etc/DOC
        rm -f bootstrap-emacs${EXEEXT} emacs-${version}${EXEEXT}
        rm -f buildobj.h
 clean: mostlyclean
        rm -f emacs-*.*.*${EXEEXT} emacs${EXEEXT}
-       -rm -rf deps
-#ifdef HAVE_NS
-       rm -fr ${ns_appdir}
-#endif
-/* bootstrap-clean is used to clean up just before a bootstrap.
-   It should remove all files generated during a compilation/bootstrap,
-   but not things like config.status or TAGS.  */
+       -rm -rf ${DEPDIR}
+       test "X${ns_appdir}" = "X" || rm -rf ${ns_appdir}
+
+## bootstrap-clean is used to clean up just before a bootstrap.
+## It should remove all files generated during a compilation/bootstrap,
+## but not things like config.status or TAGS.
 bootstrap-clean: clean
-       rm -f epaths.h config.h Makefile.c config.stamp stamp-oldxmenu ../etc/DOC-*
+       rm -f epaths.h config.h config.stamp stamp-oldxmenu ../etc/DOC-*
        if test -f ./.gdbinit; then \
          mv ./.gdbinit ./.gdbinit.save; \
          if test -f "${srcdir}/.gdbinit"; then rm -f ./.gdbinit.save; \
          else mv ./.gdbinit.save ./.gdbinit; fi; \
        fi
-/**/# This is used in making a distribution.
-/**/# Do not use it on development directories!
+## This is used in making a distribution.
+## Do not use it on development directories!
 distclean: bootstrap-clean
        rm -f Makefile
 maintainer-clean: distclean
@@ -1348,8 +723,8 @@ versionclean:
 extraclean: distclean
        -rm -f *~ \#* m/?*~ s/?*~
 
-/* Arrange to make a tags table TAGS-LISP for ../lisp,
-   plus TAGS for the C files, which includes ../lisp/TAGS by reference.  */
+## Arrange to make a tags table TAGS-LISP for ../lisp,
+## plus TAGS for the C files, which includes ../lisp/TAGS by reference.
 
 ctagsfiles1 = [xyzXYZ]*.[hcm]
 ctagsfiles2 = [a-wA-W]*.[hcm]
@@ -1369,59 +744,62 @@ tags: TAGS TAGS-LISP $(lwlibdir)TAGS
 .PHONY: tags
 
 
-/* Bootstrapping.  */
-/* Bootstrapping right is difficult because of the circular dependencies.
-   Furthermore, we have to deal with the fact that many compilation targets
-   such as loaddefs.el or *.elc can typically be produced by any old
-   Emacs executable, so we would like to avoid rebuilding them whenever
-   we build a new Emacs executable.
-   To solve the circularity, we use 2 different Emacs executables,
-   "emacs" is the main target and "bootstrap-emacs" is the one used
-   to build the *.elc and loaddefs.el files.
-   To solve the freshness issue, we used to use a third file "witness-emacs"
-   which was used to witness the fact that there is a bootstrap-emacs
-   executable, and then have dependencies on witness-emacs rather than
-   bootstrap-emacs, but that lead to problems in parallel builds (because
-   witness-emacs needed to be free from dependencies (to avoid rebuilding
-   it), so it was compiled in parallel, leading typically to having 2
-   processes dumping bootstrap-emacs at the same time).
-   So instead, we replace the witness-emacs dependencies by conditional
-   bootstrap-dependencies (via ${BOOTSTRAPEMACS}).  Of course, since we do
-   not want to rely on GNU Make features, we have to rely on an external
-   script to do the conditional part of the dependency
-   (i.e. see the ${SUBDIR} rule ../Makefile.in).  */
+### Bootstrapping.
+
+## Bootstrapping right is difficult because of the circular dependencies.
+## Furthermore, we have to deal with the fact that many compilation targets
+## such as loaddefs.el or *.elc can typically be produced by any old
+## Emacs executable, so we would like to avoid rebuilding them whenever
+## we build a new Emacs executable.
+## To solve the circularity, we use 2 different Emacs executables,
+## "emacs" is the main target and "bootstrap-emacs" is the one used
+## to build the *.elc and loaddefs.el files.
+## To solve the freshness issue, we used to use a third file "witness-emacs"
+## which was used to witness the fact that there is a bootstrap-emacs
+## executable, and then have dependencies on witness-emacs rather than
+## bootstrap-emacs, but that lead to problems in parallel builds (because
+## witness-emacs needed to be free from dependencies (to avoid rebuilding
+## it), so it was compiled in parallel, leading typically to having 2
+## processes dumping bootstrap-emacs at the same time).
+## So instead, we replace the witness-emacs dependencies by conditional
+## bootstrap-dependencies (via ${BOOTSTRAPEMACS}).  Of course, since we do
+## not want to rely on GNU Make features, we have to rely on an external
+## script to do the conditional part of the dependency
+## (i.e. see the ${SUBDIR} rule ../Makefile.in).
 
 .SUFFIXES: .elc .el
 
-/* These suffix rules do not allow additional dependencies, sadly, so
-   instead of adding a $(BOOTSTRAPEMACS) dependency here, we add it
-   separately below.
-   With GNU Make, we would just say "%.el : %.elc $(BOOTSTRAPEMACS)"  */
+## These suffix rules do not allow additional dependencies, sadly, so
+## instead of adding a $(BOOTSTRAPEMACS) dependency here, we add it
+## separately below.
+## With GNU Make, we would just say "%.el : %.elc $(BOOTSTRAPEMACS)"
 .el.elc:
        @cd ../lisp; $(MAKE) $(MFLAGS) compile-onefile \
                             THEFILE=$< EMACS=${bootstrap_exe}
 
-/* Since the .el.elc rule cannot specify an extra dependency, we do it here.  */
+## Since the .el.elc rule cannot specify an extra dependency, we do it here.
 ${lisp} ${SOME_MACHINE_LISP}: $(BOOTSTRAPEMACS)
 
-${lispsource}loaddefs.el: $(BOOTSTRAPEMACS)
+## VCSWITNESS points to the file that holds info about the current checkout.
+## We use it as a heuristic to decide when to rebuild loaddefs.el.
+${lispsource}loaddefs.el: $(BOOTSTRAPEMACS) $(VCSWITNESS)
        cd ../lisp; $(MAKE) $(MFLAGS) autoloads EMACS=${bootstrap_exe}
 
-/* Dump an Emacs executable named bootstrap-emacs containing the
-   files from loadup.el in source form.  */
-
+## Dump an Emacs executable named bootstrap-emacs containing the
+## files from loadup.el in source form.
 bootstrap-emacs${EXEEXT}: temacs${EXEEXT}
        cd ../lisp; $(MAKE) $(MFLAGS) update-subdirs
-#ifdef CANNOT_DUMP
-       ln -f temacs${EXEEXT} bootstrap-emacs${EXEEXT}
-#else
-       $(RUN_TEMACS) --batch --load loadup bootstrap
-       mv -f emacs${EXEEXT} bootstrap-emacs${EXEEXT}
-#endif /* ! defined (CANNOT_DUMP) */
+       if test "${CANNOT_DUMP}" = "yes"; then \
+         ln -f temacs${EXEEXT} bootstrap-emacs${EXEEXT}; \
+       else \
+         $(RUN_TEMACS) --batch --load loadup bootstrap || exit 1; \
+         mv -f emacs${EXEEXT} bootstrap-emacs${EXEEXT}; \
+       fi
        @: Compile some files earlier to speed up further compilation.
        cd ../lisp; $(MAKE) $(MFLAGS) compile-first EMACS=${bootstrap_exe}
 
-#ifdef AUTO_DEPEND
-ALLOBJS=$(STARTFILES) ${obj} ${otherobj} prefix-args.o
--include $(ALLOBJS:%.o=deps/%.d)
-#endif
+## Insert either autodeps.mk (if AUTO_DEPEND), else deps.mk.
+@deps_frag@
+
+
+### Makefile.in ends here
index 679fc961e53ad512800957c1ef2cc6fa007d4d95..b4ce91b150ae6771818729ba2e80278927a23f83 100644 (file)
@@ -1,5 +1,5 @@
-Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
-  Free Software Foundation, Inc.
+Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
+  2010  Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 
@@ -10,12 +10,10 @@ and installed, if the dumped Emacs (on Unix systems) is copied elsewhere.
 See the files ../README and then ../INSTALL for installation instructions.
 
 Under GNU and Unix systems, the file `Makefile.in' is used as a
-template by the script `../configure' to produce `Makefile.c'.  The
-same script then uses `cpp' to produce the machine-dependent
-`Makefile' from `Makefile.c'; `Makefile' is the file which actually
-controls the compilation of Emacs.  Most of this should work
-transparently to the user; you should only need to run `../configure',
-and then type `make'.
+template by the script `../configure' to produce `Makefile'.  This
+is the file which actually controls the compilation of Emacs.
+All of this should work transparently to the user; you should only
+need to run `../configure', and then type `make'.
 
 \f
 This file is part of GNU Emacs.
index da63fe0f82bc371e922d55dee8501a4eb00498bd..1f615a7d505a1d41d1ebd29124c70c7b1a647985 100644 (file)
@@ -23,10 +23,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <limits.h>            /* For CHAR_BIT.  */
 #include <setjmp.h>
 
-#ifdef STDC_HEADERS
-#include <stddef.h>            /* For offsetof, used by PSEUDOVECSIZE. */
-#endif
-
 #ifdef ALLOC_DEBUG
 #undef INLINE
 #endif
@@ -70,7 +66,6 @@ extern POINTER_TYPE *sbrk ();
 #endif
 
 #ifdef HAVE_FCNTL_H
-#define INCLUDED_FCNTL
 #include <fcntl.h>
 #endif
 #ifndef O_WRONLY
@@ -219,16 +214,6 @@ int abort_on_gc;
 
 int garbage_collection_messages;
 
-#ifndef VIRT_ADDR_VARIES
-extern
-#endif /* VIRT_ADDR_VARIES */
-int malloc_sbrk_used;
-
-#ifndef VIRT_ADDR_VARIES
-extern
-#endif /* VIRT_ADDR_VARIES */
-int malloc_sbrk_unused;
-
 /* Number of live and free conses etc.  */
 
 static int total_conses, total_markers, total_symbols, total_vector_size;
@@ -257,8 +242,6 @@ Lisp_Object Vpurify_flag;
 
 Lisp_Object Vmemory_full;
 
-#ifndef HAVE_SHM
-
 /* Initialize it to a nonzero value to force it into data space
    (rather than bss space).  That way unexec will remap it into text
    space (pure), on some systems.  We have not implemented the
@@ -268,13 +251,6 @@ Lisp_Object Vmemory_full;
 EMACS_INT pure[(PURESIZE + sizeof (EMACS_INT) - 1) / sizeof (EMACS_INT)] = {1,};
 #define PUREBEG (char *) pure
 
-#else /* HAVE_SHM */
-
-#define pure PURE_SEG_BITS   /* Use shared memory segment */
-#define PUREBEG (char *)PURE_SEG_BITS
-
-#endif /* HAVE_SHM */
-
 /* Pointer to the pure area, and its size.  */
 
 static char *purebeg;
@@ -308,7 +284,7 @@ static EMACS_INT pure_bytes_used_non_lisp;
 /* If nonzero, this is a warning delivered by malloc and not yet
    displayed.  */
 
-char *pending_malloc_warning;
+const char *pending_malloc_warning;
 
 /* Pre-computed signal argument for use when memory is exhausted.  */
 
@@ -339,23 +315,23 @@ Lisp_Object Vpost_gc_hook, Qpost_gc_hook;
 Lisp_Object Vgc_elapsed;       /* accumulated elapsed time in GC  */
 EMACS_INT gcs_done;            /* accumulated GCs  */
 
-static void mark_buffer P_ ((Lisp_Object));
-static void mark_terminals P_ ((void));
-extern void mark_kboards P_ ((void));
-extern void mark_ttys P_ ((void));
-extern void mark_backtrace P_ ((void));
-static void gc_sweep P_ ((void));
-static void mark_glyph_matrix P_ ((struct glyph_matrix *));
-static void mark_face_cache P_ ((struct face_cache *));
+static void mark_buffer (Lisp_Object);
+static void mark_terminals (void);
+extern void mark_kboards (void);
+extern void mark_ttys (void);
+extern void mark_backtrace (void);
+static void gc_sweep (void);
+static void mark_glyph_matrix (struct glyph_matrix *);
+static void mark_face_cache (struct face_cache *);
 
 #ifdef HAVE_WINDOW_SYSTEM
-extern void mark_fringe_data P_ ((void));
+extern void mark_fringe_data (void);
 #endif /* HAVE_WINDOW_SYSTEM */
 
-static struct Lisp_String *allocate_string P_ ((void));
-static void compact_small_strings P_ ((void));
-static void free_large_strings P_ ((void));
-static void sweep_strings P_ ((void));
+static struct Lisp_String *allocate_string (void);
+static void compact_small_strings (void);
+static void free_large_strings (void);
+static void sweep_strings (void);
 
 extern int message_enable_multibyte;
 
@@ -379,9 +355,9 @@ enum mem_type
   MEM_TYPE_VECTORLIKE
 };
 
-static POINTER_TYPE *lisp_align_malloc P_ ((size_t, enum mem_type));
-static POINTER_TYPE *lisp_malloc P_ ((size_t, enum mem_type));
-void refill_memory_reserve ();
+static POINTER_TYPE *lisp_align_malloc (size_t, enum mem_type);
+static POINTER_TYPE *lisp_malloc (size_t, enum mem_type);
+void refill_memory_reserve (void);
 
 
 #if GC_MARK_STACK || defined GC_MALLOC_CHECK
@@ -462,31 +438,30 @@ static void *min_heap_address, *max_heap_address;
 static struct mem_node mem_z;
 #define MEM_NIL &mem_z
 
-static POINTER_TYPE *lisp_malloc P_ ((size_t, enum mem_type));
-static struct Lisp_Vector *allocate_vectorlike P_ ((EMACS_INT));
-static void lisp_free P_ ((POINTER_TYPE *));
-static void mark_stack P_ ((void));
-static int live_vector_p P_ ((struct mem_node *, void *));
-static int live_buffer_p P_ ((struct mem_node *, void *));
-static int live_string_p P_ ((struct mem_node *, void *));
-static int live_cons_p P_ ((struct mem_node *, void *));
-static int live_symbol_p P_ ((struct mem_node *, void *));
-static int live_float_p P_ ((struct mem_node *, void *));
-static int live_misc_p P_ ((struct mem_node *, void *));
-static void mark_maybe_object P_ ((Lisp_Object));
-static void mark_memory P_ ((void *, void *, int));
-static void mem_init P_ ((void));
-static struct mem_node *mem_insert P_ ((void *, void *, enum mem_type));
-static void mem_insert_fixup P_ ((struct mem_node *));
-static void mem_rotate_left P_ ((struct mem_node *));
-static void mem_rotate_right P_ ((struct mem_node *));
-static void mem_delete P_ ((struct mem_node *));
-static void mem_delete_fixup P_ ((struct mem_node *));
-static INLINE struct mem_node *mem_find P_ ((void *));
+static struct Lisp_Vector *allocate_vectorlike (EMACS_INT);
+static void lisp_free (POINTER_TYPE *);
+static void mark_stack (void);
+static int live_vector_p (struct mem_node *, void *);
+static int live_buffer_p (struct mem_node *, void *);
+static int live_string_p (struct mem_node *, void *);
+static int live_cons_p (struct mem_node *, void *);
+static int live_symbol_p (struct mem_node *, void *);
+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 *, int);
+static void mem_init (void);
+static struct mem_node *mem_insert (void *, void *, enum mem_type);
+static void mem_insert_fixup (struct mem_node *);
+static void mem_rotate_left (struct mem_node *);
+static void mem_rotate_right (struct mem_node *);
+static void mem_delete (struct mem_node *);
+static void mem_delete_fixup (struct mem_node *);
+static INLINE struct mem_node *mem_find (void *);
 
 
 #if GC_MARK_STACK == GC_MARK_STACK_CHECK_GCPROS
-static void check_gcpros P_ ((void));
+static void check_gcpros (void);
 #endif
 
 #endif /* GC_MARK_STACK || GC_MALLOC_CHECK */
@@ -505,7 +480,7 @@ static Lisp_Object *staticvec[NSTATICS] = {&Vpurify_flag};
 
 static int staticidx = 0;
 
-static POINTER_TYPE *pure_alloc P_ ((size_t, int));
+static POINTER_TYPE *pure_alloc (size_t, int);
 
 
 /* Value is SZ rounded up to the next multiple of ALIGNMENT.
@@ -524,8 +499,7 @@ static POINTER_TYPE *pure_alloc P_ ((size_t, int));
 /* Function malloc calls this if it finds we are near exhausting storage.  */
 
 void
-malloc_warning (str)
-     char *str;
+malloc_warning (const char *str)
 {
   pending_malloc_warning = str;
 }
@@ -534,7 +508,7 @@ malloc_warning (str)
 /* Display an already-pending malloc warning.  */
 
 void
-display_malloc_warning ()
+display_malloc_warning (void)
 {
   call3 (intern ("display-warning"),
         intern ("alloc"),
@@ -553,7 +527,7 @@ display_malloc_warning ()
 /* Called if we can't allocate relocatable space for a buffer.  */
 
 void
-buffer_memory_full ()
+buffer_memory_full (void)
 {
   /* If buffers use the relocating allocator, no need to free
      spare_memory, because we may have plenty of malloc space left
@@ -647,10 +621,12 @@ overrun_check_malloc (size)
   val = (unsigned char *) malloc (size + overhead);
   if (val && check_depth == 1)
     {
-      bcopy (xmalloc_overrun_check_header, val, XMALLOC_OVERRUN_CHECK_SIZE - 4);
+      memcpy (val, xmalloc_overrun_check_header,
+             XMALLOC_OVERRUN_CHECK_SIZE - 4);
       val += XMALLOC_OVERRUN_CHECK_SIZE;
       XMALLOC_PUT_SIZE(val, size);
-      bcopy (xmalloc_overrun_check_trailer, val + size, XMALLOC_OVERRUN_CHECK_SIZE);
+      memcpy (val + size, xmalloc_overrun_check_trailer,
+             XMALLOC_OVERRUN_CHECK_SIZE);
     }
   --check_depth;
   return (POINTER_TYPE *)val;
@@ -670,28 +646,29 @@ overrun_check_realloc (block, size)
 
   if (val
       && check_depth == 1
-      && bcmp (xmalloc_overrun_check_header,
-              val - XMALLOC_OVERRUN_CHECK_SIZE,
-              XMALLOC_OVERRUN_CHECK_SIZE - 4) == 0)
+      && memcmp (xmalloc_overrun_check_header,
+                val - XMALLOC_OVERRUN_CHECK_SIZE,
+                XMALLOC_OVERRUN_CHECK_SIZE - 4) == 0)
     {
       size_t osize = XMALLOC_GET_SIZE (val);
-      if (bcmp (xmalloc_overrun_check_trailer,
-               val + osize,
-               XMALLOC_OVERRUN_CHECK_SIZE))
+      if (memcmp (xmalloc_overrun_check_trailer, val + osize,
+                 XMALLOC_OVERRUN_CHECK_SIZE))
        abort ();
-      bzero (val + osize, XMALLOC_OVERRUN_CHECK_SIZE);
+      memset (val + osize, 0, XMALLOC_OVERRUN_CHECK_SIZE);
       val -= XMALLOC_OVERRUN_CHECK_SIZE;
-      bzero (val, XMALLOC_OVERRUN_CHECK_SIZE);
+      memset (val, 0, XMALLOC_OVERRUN_CHECK_SIZE);
     }
 
   val = (unsigned char *) realloc ((POINTER_TYPE *)val, size + overhead);
 
   if (val && check_depth == 1)
     {
-      bcopy (xmalloc_overrun_check_header, val, XMALLOC_OVERRUN_CHECK_SIZE - 4);
+      memcpy (val, xmalloc_overrun_check_header,
+             XMALLOC_OVERRUN_CHECK_SIZE - 4);
       val += XMALLOC_OVERRUN_CHECK_SIZE;
       XMALLOC_PUT_SIZE(val, size);
-      bcopy (xmalloc_overrun_check_trailer, val + size, XMALLOC_OVERRUN_CHECK_SIZE);
+      memcpy (val + size, xmalloc_overrun_check_trailer,
+             XMALLOC_OVERRUN_CHECK_SIZE);
     }
   --check_depth;
   return (POINTER_TYPE *)val;
@@ -708,22 +685,21 @@ overrun_check_free (block)
   ++check_depth;
   if (val
       && check_depth == 1
-      && bcmp (xmalloc_overrun_check_header,
-              val - XMALLOC_OVERRUN_CHECK_SIZE,
-              XMALLOC_OVERRUN_CHECK_SIZE - 4) == 0)
+      && memcmp (xmalloc_overrun_check_header,
+                val - XMALLOC_OVERRUN_CHECK_SIZE,
+                XMALLOC_OVERRUN_CHECK_SIZE - 4) == 0)
     {
       size_t osize = XMALLOC_GET_SIZE (val);
-      if (bcmp (xmalloc_overrun_check_trailer,
-               val + osize,
-               XMALLOC_OVERRUN_CHECK_SIZE))
+      if (memcmp (xmalloc_overrun_check_trailer, val + osize,
+                 XMALLOC_OVERRUN_CHECK_SIZE))
        abort ();
 #ifdef XMALLOC_CLEAR_FREE_MEMORY
       val -= XMALLOC_OVERRUN_CHECK_SIZE;
       memset (val, 0xff, osize + XMALLOC_OVERRUN_CHECK_SIZE*2);
 #else
-      bzero (val + osize, XMALLOC_OVERRUN_CHECK_SIZE);
+      memset (val + osize, 0, XMALLOC_OVERRUN_CHECK_SIZE);
       val -= XMALLOC_OVERRUN_CHECK_SIZE;
-      bzero (val, XMALLOC_OVERRUN_CHECK_SIZE);
+      memset (val, 0, XMALLOC_OVERRUN_CHECK_SIZE);
 #endif
     }
 
@@ -752,8 +728,7 @@ overrun_check_free (block)
 /* Like malloc but check for no memory and block interrupt input..  */
 
 POINTER_TYPE *
-xmalloc (size)
-     size_t size;
+xmalloc (size_t size)
 {
   register POINTER_TYPE *val;
 
@@ -770,9 +745,7 @@ xmalloc (size)
 /* Like realloc but check for no memory and block interrupt input..  */
 
 POINTER_TYPE *
-xrealloc (block, size)
-     POINTER_TYPE *block;
-     size_t size;
+xrealloc (POINTER_TYPE *block, size_t size)
 {
   register POINTER_TYPE *val;
 
@@ -793,8 +766,7 @@ xrealloc (block, size)
 /* Like free but block interrupt input.  */
 
 void
-xfree (block)
-     POINTER_TYPE *block;
+xfree (POINTER_TYPE *block)
 {
   if (!block)
     return;
@@ -810,12 +782,11 @@ xfree (block)
 /* Like strdup, but uses xmalloc.  */
 
 char *
-xstrdup (s)
-     const char *s;
+xstrdup (const char *s)
 {
   size_t len = strlen (s) + 1;
   char *p = (char *) xmalloc (len);
-  bcopy (s, p, len);
+  memcpy (p, s, len);
   return p;
 }
 
@@ -823,8 +794,7 @@ xstrdup (s)
 /* Unwind for SAFE_ALLOCA */
 
 Lisp_Object
-safe_alloca_unwind (arg)
-     Lisp_Object arg;
+safe_alloca_unwind (Lisp_Object arg)
 {
   register struct Lisp_Save_Value *p = XSAVE_VALUE (arg);
 
@@ -845,9 +815,7 @@ static void *lisp_malloc_loser;
 #endif
 
 static POINTER_TYPE *
-lisp_malloc (nbytes, type)
-     size_t nbytes;
-     enum mem_type type;
+lisp_malloc (size_t nbytes, enum mem_type type)
 {
   register void *val;
 
@@ -891,8 +859,7 @@ lisp_malloc (nbytes, type)
    call to lisp_malloc.  */
 
 static void
-lisp_free (block)
-     POINTER_TYPE *block;
+lisp_free (POINTER_TYPE *block)
 {
   MALLOC_BLOCK_INPUT;
   free (block);
@@ -991,9 +958,7 @@ static struct ablock *free_ablock;
    Alignment is on a multiple of BLOCK_ALIGN and `nbytes' has to be
    smaller or equal to BLOCK_BYTES.  */
 static POINTER_TYPE *
-lisp_align_malloc (nbytes, type)
-     size_t nbytes;
-     enum mem_type type;
+lisp_align_malloc (size_t nbytes, enum mem_type type)
 {
   void *base, *val;
   struct ablocks *abase;
@@ -1100,8 +1065,7 @@ lisp_align_malloc (nbytes, type)
 }
 
 static void
-lisp_align_free (block)
-     POINTER_TYPE *block;
+lisp_align_free (POINTER_TYPE *block)
 {
   struct ablock *ablock = block;
   struct ablocks *abase = ABLOCK_ABASE (ablock);
@@ -1146,7 +1110,7 @@ lisp_align_free (block)
    a call to lisp_malloc.  */
 
 struct buffer *
-allocate_buffer ()
+allocate_buffer (void)
 {
   struct buffer *b
     = (struct buffer *) lisp_malloc (sizeof (struct buffer),
@@ -1174,21 +1138,19 @@ allocate_buffer ()
    there's no need to block input around malloc.  */
 
 #ifndef DOUG_LEA_MALLOC
-extern void * (*__malloc_hook) P_ ((size_t, const void *));
-extern void * (*__realloc_hook) P_ ((void *, size_t, const void *));
-extern void (*__free_hook) P_ ((void *, const void *));
+extern void * (*__malloc_hook) (size_t, const void *);
+extern void * (*__realloc_hook) (void *, size_t, const void *);
+extern void (*__free_hook) (void *, const void *);
 /* Else declared in malloc.h, perhaps with an extra arg.  */
 #endif /* DOUG_LEA_MALLOC */
-static void * (*old_malloc_hook) P_ ((size_t, const void *));
-static void * (*old_realloc_hook) P_ ((void *,  size_t, const void*));
-static void (*old_free_hook) P_ ((void*, const void*));
+static void * (*old_malloc_hook) (size_t, const void *);
+static void * (*old_realloc_hook) (void *,  size_t, const void*);
+static void (*old_free_hook) (void*, const void*);
 
 /* This function is used as the hook for free to call.  */
 
 static void
-emacs_blocked_free (ptr, ptr2)
-     void *ptr;
-     const void *ptr2;
+emacs_blocked_free (void *ptr, const void *ptr2)
 {
   BLOCK_INPUT_ALLOC;
 
@@ -1236,9 +1198,7 @@ emacs_blocked_free (ptr, ptr2)
 /* This function is the malloc hook that Emacs uses.  */
 
 static void *
-emacs_blocked_malloc (size, ptr)
-     size_t size;
-     const void *ptr;
+emacs_blocked_malloc (size_t size, const void *ptr)
 {
   void *value;
 
@@ -1285,10 +1245,7 @@ emacs_blocked_malloc (size, ptr)
 /* This function is the realloc hook that Emacs uses.  */
 
 static void *
-emacs_blocked_realloc (ptr, size, ptr2)
-     void *ptr;
-     size_t size;
-     const void *ptr2;
+emacs_blocked_realloc (void *ptr, size_t size, const void *ptr2)
 {
   void *value;
 
@@ -1362,7 +1319,7 @@ reset_malloc_hooks ()
 /* Called from main to set up malloc to use our hooks.  */
 
 void
-uninterrupt_malloc ()
+uninterrupt_malloc (void)
 {
 #ifdef HAVE_GTK_AND_PTHREAD
 #ifdef DOUG_LEA_MALLOC
@@ -1374,7 +1331,7 @@ uninterrupt_malloc ()
   pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE);
   pthread_mutex_init (&alloc_mutex, &attr);
 #else  /* !DOUG_LEA_MALLOC */
-  /* Some systems such as Solaris 2.6 doesn't have a recursive mutex,
+  /* Some systems such as Solaris 2.6 don't have a recursive mutex,
      and the bundled gmalloc.c doesn't require it.  */
   pthread_mutex_init (&alloc_mutex, NULL);
 #endif /* !DOUG_LEA_MALLOC */
@@ -1444,7 +1401,7 @@ static int n_interval_blocks;
 /* Initialize interval allocation.  */
 
 static void
-init_intervals ()
+init_intervals (void)
 {
   interval_block = NULL;
   interval_block_index = INTERVAL_BLOCK_SIZE;
@@ -1456,7 +1413,7 @@ init_intervals ()
 /* Return a new interval.  */
 
 INTERVAL
-make_interval ()
+make_interval (void)
 {
   INTERVAL val;
 
@@ -1499,9 +1456,7 @@ make_interval ()
 /* Mark Lisp objects in interval I. */
 
 static void
-mark_interval (i, dummy)
-     register INTERVAL i;
-     Lisp_Object dummy;
+mark_interval (register INTERVAL i, Lisp_Object dummy)
 {
   eassert (!i->gcmarkbit);             /* Intervals are never shared.  */
   i->gcmarkbit = 1;
@@ -1513,8 +1468,7 @@ mark_interval (i, dummy)
    use the macro MARK_INTERVAL_TREE instead.  */
 
 static void
-mark_interval_tree (tree)
-     register INTERVAL tree;
+mark_interval_tree (register INTERVAL tree)
 {
   /* No need to test if this tree has been marked already; this
      function is always called through the MARK_INTERVAL_TREE macro,
@@ -1761,7 +1715,7 @@ static char string_overrun_cookie[GC_STRING_OVERRUN_COOKIE_SIZE] =
 /* Initialize string allocation.  Called from init_alloc_once.  */
 
 static void
-init_strings ()
+init_strings (void)
 {
   total_strings = total_free_strings = total_string_size = 0;
   oldest_sblock = current_sblock = large_sblocks = NULL;
@@ -1777,8 +1731,8 @@ init_strings ()
 
 static int check_string_bytes_count;
 
-static void check_string_bytes P_ ((int));
-static void check_sblock P_ ((struct sblock *));
+static void check_string_bytes (int);
+static void check_sblock (struct sblock *);
 
 #define CHECK_STRING_BYTES(S)  STRING_BYTES (S)
 
@@ -1883,7 +1837,7 @@ check_string_free_list ()
 /* Return a new Lisp_String.  */
 
 static struct Lisp_String *
-allocate_string ()
+allocate_string (void)
 {
   struct Lisp_String *s;
 
@@ -1899,7 +1853,7 @@ allocate_string ()
       int i;
 
       b = (struct string_block *) lisp_malloc (sizeof *b, MEM_TYPE_STRING);
-      bzero (b, sizeof *b);
+      memset (b, 0, sizeof *b);
       b->next = string_blocks;
       string_blocks = b;
       ++n_string_blocks;
@@ -1923,7 +1877,7 @@ allocate_string ()
   MALLOC_UNBLOCK_INPUT;
 
   /* Probably not strictly necessary, but play it safe.  */
-  bzero (s, sizeof *s);
+  memset (s, 0, sizeof *s);
 
   --total_free_strings;
   ++total_strings;
@@ -1954,9 +1908,7 @@ allocate_string ()
    S->data if it was initially non-null.  */
 
 void
-allocate_string_data (s, nchars, nbytes)
-     struct Lisp_String *s;
-     int nchars, nbytes;
+allocate_string_data (struct Lisp_String *s, int nchars, int nbytes)
 {
   struct sdata *data, *old_data;
   struct sblock *b;
@@ -2033,8 +1985,7 @@ allocate_string_data (s, nchars, nbytes)
   s->size_byte = nbytes;
   s->data[nbytes] = '\0';
 #ifdef GC_CHECK_STRING_OVERRUN
-  bcopy (string_overrun_cookie, (char *) data + needed,
-        GC_STRING_OVERRUN_COOKIE_SIZE);
+  memcpy (data + needed, string_overrun_cookie, GC_STRING_OVERRUN_COOKIE_SIZE);
 #endif
 
   /* If S had already data assigned, mark that as free by setting its
@@ -2053,7 +2004,7 @@ allocate_string_data (s, nchars, nbytes)
 /* Sweep and compact strings.  */
 
 static void
-sweep_strings ()
+sweep_strings (void)
 {
   struct string_block *b, *next;
   struct string_block *live_blocks = NULL;
@@ -2153,7 +2104,7 @@ sweep_strings ()
 /* Free dead large strings.  */
 
 static void
-free_large_strings ()
+free_large_strings (void)
 {
   struct sblock *b, *next;
   struct sblock *live_blocks = NULL;
@@ -2179,7 +2130,7 @@ free_large_strings ()
    data of live strings after compaction.  */
 
 static void
-compact_small_strings ()
+compact_small_strings (void)
 {
   struct sblock *b, *tb, *next;
   struct sdata *from, *to, *end, *tb_end;
@@ -2225,9 +2176,9 @@ compact_small_strings ()
          from_end = (struct sdata *) ((char *) from + nbytes + GC_STRING_EXTRA);
 
 #ifdef GC_CHECK_STRING_OVERRUN
-         if (bcmp (string_overrun_cookie,
-                   ((char *) from_end) - GC_STRING_OVERRUN_COOKIE_SIZE,
-                   GC_STRING_OVERRUN_COOKIE_SIZE))
+         if (memcmp (string_overrun_cookie,
+                     (char *) from_end - GC_STRING_OVERRUN_COOKIE_SIZE,
+                     GC_STRING_OVERRUN_COOKIE_SIZE))
            abort ();
 #endif
 
@@ -2249,7 +2200,7 @@ compact_small_strings ()
              if (from != to)
                {
                  xassert (tb != b || to <= from);
-                 safe_bcopy ((char *) from, (char *) to, nbytes + GC_STRING_EXTRA);
+                 memmove (to, from, nbytes + GC_STRING_EXTRA);
                  to->string->data = SDATA_DATA (to);
                }
 
@@ -2277,8 +2228,7 @@ DEFUN ("make-string", Fmake_string, Smake_string, 2, 2, 0,
        doc: /* Return a newly created string of length LENGTH, with INIT in each element.
 LENGTH must be an integer.
 INIT must be an integer that represents a character.  */)
-     (length, init)
-     Lisp_Object length, init;
+  (Lisp_Object length, Lisp_Object init)
 {
   register Lisp_Object val;
   register unsigned char *p, *end;
@@ -2308,7 +2258,7 @@ INIT must be an integer that represents a character.  */)
       end = p + nbytes;
       while (p != end)
        {
-         bcopy (str, p, len);
+         memcpy (p, str, len);
          p += len;
        }
     }
@@ -2321,8 +2271,7 @@ INIT must be an integer that represents a character.  */)
 DEFUN ("make-bool-vector", Fmake_bool_vector, Smake_bool_vector, 2, 2, 0,
        doc: /* Return a new bool-vector of length LENGTH, using INIT for each element.
 LENGTH must be a number.  INIT matters only in whether it is t or nil.  */)
-     (length, init)
-     Lisp_Object length, init;
+  (Lisp_Object length, Lisp_Object init)
 {
   register Lisp_Object val;
   struct Lisp_Bool_Vector *p;
@@ -2367,9 +2316,7 @@ LENGTH must be a number.  INIT matters only in whether it is t or nil.  */)
    multibyte, depending on the contents.  */
 
 Lisp_Object
-make_string (contents, nbytes)
-     const char *contents;
-     int nbytes;
+make_string (const char *contents, int nbytes)
 {
   register Lisp_Object val;
   int nchars, multibyte_nbytes;
@@ -2388,13 +2335,11 @@ make_string (contents, nbytes)
 /* Make an unibyte string from LENGTH bytes at CONTENTS.  */
 
 Lisp_Object
-make_unibyte_string (contents, length)
-     const char *contents;
-     int length;
+make_unibyte_string (const char *contents, int length)
 {
   register Lisp_Object val;
   val = make_uninit_string (length);
-  bcopy (contents, SDATA (val), length);
+  memcpy (SDATA (val), contents, length);
   STRING_SET_UNIBYTE (val);
   return val;
 }
@@ -2404,13 +2349,11 @@ make_unibyte_string (contents, length)
    bytes at CONTENTS.  */
 
 Lisp_Object
-make_multibyte_string (contents, nchars, nbytes)
-     const char *contents;
-     int nchars, nbytes;
+make_multibyte_string (const char *contents, int nchars, int nbytes)
 {
   register Lisp_Object val;
   val = make_uninit_multibyte_string (nchars, nbytes);
-  bcopy (contents, SDATA (val), nbytes);
+  memcpy (SDATA (val), contents, nbytes);
   return val;
 }
 
@@ -2419,13 +2362,11 @@ make_multibyte_string (contents, nchars, nbytes)
    CONTENTS.  It is a multibyte string if NBYTES != NCHARS.  */
 
 Lisp_Object
-make_string_from_bytes (contents, nchars, nbytes)
-     const char *contents;
-     int nchars, nbytes;
+make_string_from_bytes (const char *contents, int nchars, int nbytes)
 {
   register Lisp_Object val;
   val = make_uninit_multibyte_string (nchars, nbytes);
-  bcopy (contents, SDATA (val), nbytes);
+  memcpy (SDATA (val), contents, nbytes);
   if (SBYTES (val) == SCHARS (val))
     STRING_SET_UNIBYTE (val);
   return val;
@@ -2438,10 +2379,7 @@ make_string_from_bytes (contents, nchars, nbytes)
    characters by itself.  */
 
 Lisp_Object
-make_specified_string (contents, nchars, nbytes, multibyte)
-     const char *contents;
-     int nchars, nbytes;
-     int multibyte;
+make_specified_string (const char *contents, int nchars, int nbytes, int multibyte)
 {
   register Lisp_Object val;
 
@@ -2453,7 +2391,7 @@ make_specified_string (contents, nchars, nbytes, multibyte)
        nchars = nbytes;
     }
   val = make_uninit_multibyte_string (nchars, nbytes);
-  bcopy (contents, SDATA (val), nbytes);
+  memcpy (SDATA (val), contents, nbytes);
   if (!multibyte)
     STRING_SET_UNIBYTE (val);
   return val;
@@ -2464,8 +2402,7 @@ make_specified_string (contents, nchars, nbytes, multibyte)
    data warrants.  */
 
 Lisp_Object
-build_string (str)
-     const char *str;
+build_string (const char *str)
 {
   return make_string (str, strlen (str));
 }
@@ -2475,8 +2412,7 @@ build_string (str)
    occupying LENGTH bytes.  */
 
 Lisp_Object
-make_uninit_string (length)
-     int length;
+make_uninit_string (int length)
 {
   Lisp_Object val;
 
@@ -2492,8 +2428,7 @@ make_uninit_string (length)
    which occupy NBYTES bytes.  */
 
 Lisp_Object
-make_uninit_multibyte_string (nchars, nbytes)
-     int nchars, nbytes;
+make_uninit_multibyte_string (int nchars, int nbytes)
 {
   Lisp_Object string;
   struct Lisp_String *s;
@@ -2583,7 +2518,7 @@ struct Lisp_Float *float_free_list;
 /* Initialize float allocation.  */
 
 static void
-init_float ()
+init_float (void)
 {
   float_block = NULL;
   float_block_index = FLOAT_BLOCK_SIZE; /* Force alloc of new float_block.   */
@@ -2592,22 +2527,10 @@ init_float ()
 }
 
 
-/* Explicitly free a float cell by putting it on the free-list.  */
-
-static void
-free_float (ptr)
-     struct Lisp_Float *ptr;
-{
-  ptr->u.chain = float_free_list;
-  float_free_list = ptr;
-}
-
-
 /* Return a new float object with value FLOAT_VALUE.  */
 
 Lisp_Object
-make_float (float_value)
-     double float_value;
+make_float (double float_value)
 {
   register Lisp_Object val;
 
@@ -2631,7 +2554,7 @@ make_float (float_value)
          new = (struct float_block *) lisp_align_malloc (sizeof *new,
                                                          MEM_TYPE_FLOAT);
          new->next = float_block;
-         bzero ((char *) new->gcmarkbits, sizeof new->gcmarkbits);
+         memset (new->gcmarkbits, 0, sizeof new->gcmarkbits);
          float_block = new;
          float_block_index = 0;
          n_float_blocks++;
@@ -2707,7 +2630,7 @@ static int n_cons_blocks;
 /* Initialize cons allocation.  */
 
 static void
-init_cons ()
+init_cons (void)
 {
   cons_block = NULL;
   cons_block_index = CONS_BLOCK_SIZE; /* Force alloc of new cons_block.  */
@@ -2719,8 +2642,7 @@ init_cons ()
 /* Explicitly free a cons cell by putting it on the free-list.  */
 
 void
-free_cons (ptr)
-     struct Lisp_Cons *ptr;
+free_cons (struct Lisp_Cons *ptr)
 {
   ptr->u.chain = cons_free_list;
 #if GC_MARK_STACK
@@ -2731,8 +2653,7 @@ free_cons (ptr)
 
 DEFUN ("cons", Fcons, Scons, 2, 2, 0,
        doc: /* Create a new cons, give it CAR and CDR as components, and return it.  */)
-     (car, cdr)
-     Lisp_Object car, cdr;
+  (Lisp_Object car, Lisp_Object cdr)
 {
   register Lisp_Object val;
 
@@ -2754,7 +2675,7 @@ DEFUN ("cons", Fcons, Scons, 2, 2, 0,
          register struct cons_block *new;
          new = (struct cons_block *) lisp_align_malloc (sizeof *new,
                                                         MEM_TYPE_CONS);
-         bzero ((char *) new->gcmarkbits, sizeof new->gcmarkbits);
+         memset (new->gcmarkbits, 0, sizeof new->gcmarkbits);
          new->next = cons_block;
          cons_block = new;
          cons_block_index = 0;
@@ -2776,7 +2697,7 @@ DEFUN ("cons", Fcons, Scons, 2, 2, 0,
 
 /* Get an error now if there's any junk in the cons free list.  */
 void
-check_cons_list ()
+check_cons_list (void)
 {
 #ifdef GC_CHECK_CONS_LIST
   struct Lisp_Cons *tail = cons_free_list;
@@ -2789,39 +2710,34 @@ check_cons_list ()
 /* Make a list of 1, 2, 3, 4 or 5 specified objects.  */
 
 Lisp_Object
-list1 (arg1)
-     Lisp_Object arg1;
+list1 (Lisp_Object arg1)
 {
   return Fcons (arg1, Qnil);
 }
 
 Lisp_Object
-list2 (arg1, arg2)
-     Lisp_Object arg1, arg2;
+list2 (Lisp_Object arg1, Lisp_Object arg2)
 {
   return Fcons (arg1, Fcons (arg2, Qnil));
 }
 
 
 Lisp_Object
-list3 (arg1, arg2, arg3)
-     Lisp_Object arg1, arg2, arg3;
+list3 (Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3)
 {
   return Fcons (arg1, Fcons (arg2, Fcons (arg3, Qnil)));
 }
 
 
 Lisp_Object
-list4 (arg1, arg2, arg3, arg4)
-     Lisp_Object arg1, arg2, arg3, arg4;
+list4 (Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, Lisp_Object arg4)
 {
   return Fcons (arg1, Fcons (arg2, Fcons (arg3, Fcons (arg4, Qnil))));
 }
 
 
 Lisp_Object
-list5 (arg1, arg2, arg3, arg4, arg5)
-     Lisp_Object arg1, arg2, arg3, arg4, arg5;
+list5 (Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, Lisp_Object arg4, Lisp_Object arg5)
 {
   return Fcons (arg1, Fcons (arg2, Fcons (arg3, Fcons (arg4,
                                                       Fcons (arg5, Qnil)))));
@@ -2832,9 +2748,7 @@ DEFUN ("list", Flist, Slist, 0, MANY, 0,
        doc: /* Return a newly created list with specified arguments as elements.
 Any number of arguments, even zero arguments, are allowed.
 usage: (list &rest OBJECTS)  */)
-     (nargs, args)
-     int nargs;
-     register Lisp_Object *args;
+  (int nargs, register Lisp_Object *args)
 {
   register Lisp_Object val;
   val = Qnil;
@@ -2850,8 +2764,7 @@ usage: (list &rest OBJECTS)  */)
 
 DEFUN ("make-list", Fmake_list, Smake_list, 2, 2, 0,
        doc: /* Return a newly created list of length LENGTH, with each element being INIT.  */)
-     (length, init)
-     register Lisp_Object length, init;
+  (register Lisp_Object length, Lisp_Object init)
 {
   register Lisp_Object val;
   register int size;
@@ -2914,8 +2827,7 @@ static int n_vectors;
    with room for LEN Lisp_Objects.  */
 
 static struct Lisp_Vector *
-allocate_vectorlike (len)
-     EMACS_INT len;
+allocate_vectorlike (EMACS_INT len)
 {
   struct Lisp_Vector *p;
   size_t nbytes;
@@ -2956,8 +2868,7 @@ allocate_vectorlike (len)
 /* Allocate a vector with NSLOTS slots.  */
 
 struct Lisp_Vector *
-allocate_vector (nslots)
-     EMACS_INT nslots;
+allocate_vector (EMACS_INT nslots)
 {
   struct Lisp_Vector *v = allocate_vectorlike (nslots);
   v->size = nslots;
@@ -2968,9 +2879,7 @@ allocate_vector (nslots)
 /* Allocate other vector-like structures.  */
 
 struct Lisp_Vector *
-allocate_pseudovector (memlen, lisplen, tag)
-     int memlen, lisplen;
-     EMACS_INT tag;
+allocate_pseudovector (int memlen, int lisplen, EMACS_INT tag)
 {
   struct Lisp_Vector *v = allocate_vectorlike (memlen);
   EMACS_INT i;
@@ -2992,38 +2901,38 @@ allocate_hash_table (void)
 
 
 struct window *
-allocate_window ()
+allocate_window (void)
 {
   return ALLOCATE_PSEUDOVECTOR(struct window, current_matrix, PVEC_WINDOW);
 }
 
 
 struct terminal *
-allocate_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.  */
-  bzero (&(t->next_terminal),
-        ((char*)(t+1)) - ((char*)&(t->next_terminal)));
+  memset (&t->next_terminal, 0,
+         (char*) (t + 1) - (char*) &t->next_terminal);
 
   return t;
 }
 
 struct frame *
-allocate_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.  */
-  bzero (&(f->face_cache),
-        ((char*)(f+1)) - ((char*)&(f->face_cache)));
+  memset (&f->face_cache, 0,
+         (char *) (f + 1) - (char *) &f->face_cache);
   return f;
 }
 
 
 struct Lisp_Process *
-allocate_process ()
+allocate_process (void)
 {
   return ALLOCATE_PSEUDOVECTOR (struct Lisp_Process, pid, PVEC_PROCESS);
 }
@@ -3032,8 +2941,7 @@ allocate_process ()
 DEFUN ("make-vector", Fmake_vector, Smake_vector, 2, 2, 0,
        doc: /* Return a newly created vector of length LENGTH, with each element being INIT.
 See also the function `vector'.  */)
-     (length, init)
-     register Lisp_Object length, init;
+  (register Lisp_Object length, Lisp_Object init)
 {
   Lisp_Object vector;
   register EMACS_INT sizei;
@@ -3056,9 +2964,7 @@ DEFUN ("vector", Fvector, Svector, 0, MANY, 0,
        doc: /* Return a newly created vector with specified arguments as elements.
 Any number of arguments, even zero arguments, are allowed.
 usage: (vector &rest OBJECTS)  */)
-     (nargs, args)
-     register int nargs;
-     Lisp_Object *args;
+  (register int nargs, Lisp_Object *args)
 {
   register Lisp_Object len, val;
   register int index;
@@ -3080,9 +2986,7 @@ stack size, (optional) doc string, and (optional) interactive spec.
 The first four arguments are required; at most six have any
 significance.
 usage: (make-byte-code ARGLIST BYTE-CODE CONSTANTS DEPTH &optional DOCSTRING INTERACTIVE-SPEC &rest ELEMENTS)  */)
-     (nargs, args)
-     register int nargs;
-     Lisp_Object *args;
+  (register int nargs, Lisp_Object *args)
 {
   register Lisp_Object len, val;
   register int index;
@@ -3152,7 +3056,7 @@ static int n_symbol_blocks;
 /* Initialize symbol allocation.  */
 
 static void
-init_symbol ()
+init_symbol (void)
 {
   symbol_block = NULL;
   symbol_block_index = SYMBOL_BLOCK_SIZE;
@@ -3164,8 +3068,7 @@ init_symbol ()
 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.  */)
-     (name)
-     Lisp_Object name;
+  (Lisp_Object name)
 {
   register Lisp_Object val;
   register struct Lisp_Symbol *p;
@@ -3202,13 +3105,13 @@ Its value and function definition are void, and its property list is nil.  */)
   p = XSYMBOL (val);
   p->xname = name;
   p->plist = Qnil;
-  p->value = Qunbound;
+  p->redirect = SYMBOL_PLAINVAL;
+  SET_SYMBOL_VAL (p, Qunbound);
   p->function = Qunbound;
   p->next = NULL;
   p->gcmarkbit = 0;
   p->interned = SYMBOL_UNINTERNED;
   p->constant = 0;
-  p->indirect_variable = 0;
   consing_since_gc += sizeof (struct Lisp_Symbol);
   symbols_consed++;
   return val;
@@ -3243,7 +3146,7 @@ static union Lisp_Misc *marker_free_list;
 static int n_marker_blocks;
 
 static void
-init_marker ()
+init_marker (void)
 {
   marker_block = NULL;
   marker_block_index = MARKER_BLOCK_SIZE;
@@ -3254,7 +3157,7 @@ init_marker ()
 /* Return a newly allocated Lisp_Misc object, with no substructure.  */
 
 Lisp_Object
-allocate_misc ()
+allocate_misc (void)
 {
   Lisp_Object val;
 
@@ -3296,8 +3199,7 @@ allocate_misc ()
 /* Free a Lisp_Misc object */
 
 void
-free_misc (misc)
-     Lisp_Object misc;
+free_misc (Lisp_Object misc)
 {
   XMISCTYPE (misc) = Lisp_Misc_Free;
   XMISC (misc)->u_free.chain = marker_free_list;
@@ -3311,9 +3213,7 @@ free_misc (misc)
    The unwind function can get the C values back using XSAVE_VALUE.  */
 
 Lisp_Object
-make_save_value (pointer, integer)
-     void *pointer;
-     int integer;
+make_save_value (void *pointer, int integer)
 {
   register Lisp_Object val;
   register struct Lisp_Save_Value *p;
@@ -3329,7 +3229,7 @@ make_save_value (pointer, integer)
 
 DEFUN ("make-marker", Fmake_marker, Smake_marker, 0, 0, 0,
        doc: /* Return a newly allocated marker which does not point at any place.  */)
-     ()
+  (void)
 {
   register Lisp_Object val;
   register struct Lisp_Marker *p;
@@ -3348,8 +3248,7 @@ DEFUN ("make-marker", Fmake_marker, Smake_marker, 0, 0, 0,
 /* Put MARKER back on the free list after using it temporarily.  */
 
 void
-free_marker (marker)
-     Lisp_Object marker;
+free_marker (Lisp_Object marker)
 {
   unchain_marker (XMARKER (marker));
   free_misc (marker);
@@ -3363,9 +3262,7 @@ free_marker (marker)
    Any number of arguments, even zero arguments, are allowed.  */
 
 Lisp_Object
-make_event_array (nargs, args)
-     register int nargs;
-     Lisp_Object *args;
+make_event_array (register int nargs, Lisp_Object *args)
 {
   int i;
 
@@ -3405,7 +3302,7 @@ make_event_array (nargs, args)
 /* Called if malloc returns zero.  */
 
 void
-memory_full ()
+memory_full (void)
 {
   int i;
 
@@ -3445,7 +3342,7 @@ memory_full ()
    and also directly from this file, in case we're not using ralloc.c.  */
 
 void
-refill_memory_reserve ()
+refill_memory_reserve (void)
 {
 #ifndef SYSTEM_MALLOC
   if (spare_memory[0] == 0)
@@ -3493,7 +3390,7 @@ refill_memory_reserve ()
 /* Initialize this part of alloc.c.  */
 
 static void
-mem_init ()
+mem_init (void)
 {
   mem_z.left = mem_z.right = MEM_NIL;
   mem_z.parent = NULL;
@@ -3507,8 +3404,7 @@ mem_init ()
    MEM_NIL if there is no node in the tree containing START.  */
 
 static INLINE struct mem_node *
-mem_find (start)
-     void *start;
+mem_find (void *start)
 {
   struct mem_node *p;
 
@@ -3531,9 +3427,7 @@ mem_find (start)
    pointer to the node that was inserted.  */
 
 static struct mem_node *
-mem_insert (start, end, type)
-     void *start, *end;
-     enum mem_type type;
+mem_insert (void *start, void *end, enum mem_type type)
 {
   struct mem_node *c, *parent, *x;
 
@@ -3605,8 +3499,7 @@ mem_insert (start, end, type)
    balance the tree, after node X has been inserted; X is always red.  */
 
 static void
-mem_insert_fixup (x)
-     struct mem_node *x;
+mem_insert_fixup (struct mem_node *x)
 {
   while (x != mem_root && x->parent->color == MEM_RED)
     {
@@ -3684,8 +3577,7 @@ mem_insert_fixup (x)
        b   c            a   b  */
 
 static void
-mem_rotate_left (x)
-     struct mem_node *x;
+mem_rotate_left (struct mem_node *x)
 {
   struct mem_node *y;
 
@@ -3724,8 +3616,7 @@ mem_rotate_left (x)
     a   b                  b   c  */
 
 static void
-mem_rotate_right (x)
-     struct mem_node *x;
+mem_rotate_right (struct mem_node *x)
 {
   struct mem_node *y = x->left;
 
@@ -3754,8 +3645,7 @@ mem_rotate_right (x)
 /* Delete node Z from the tree.  If Z is null or MEM_NIL, do nothing.  */
 
 static void
-mem_delete (z)
-     struct mem_node *z;
+mem_delete (struct mem_node *z)
 {
   struct mem_node *x, *y;
 
@@ -3809,8 +3699,7 @@ mem_delete (z)
    deletion.  */
 
 static void
-mem_delete_fixup (x)
-     struct mem_node *x;
+mem_delete_fixup (struct mem_node *x)
 {
   while (x != mem_root && x->color == MEM_BLACK)
     {
@@ -3891,9 +3780,7 @@ mem_delete_fixup (x)
    the heap.  M is a pointer to the mem_block for P.  */
 
 static INLINE int
-live_string_p (m, p)
-     struct mem_node *m;
-     void *p;
+live_string_p (struct mem_node *m, void *p)
 {
   if (m->type == MEM_TYPE_STRING)
     {
@@ -3916,9 +3803,7 @@ live_string_p (m, p)
    the heap.  M is a pointer to the mem_block for P.  */
 
 static INLINE int
-live_cons_p (m, p)
-     struct mem_node *m;
-     void *p;
+live_cons_p (struct mem_node *m, void *p)
 {
   if (m->type == MEM_TYPE_CONS)
     {
@@ -3944,9 +3829,7 @@ live_cons_p (m, p)
    the heap.  M is a pointer to the mem_block for P.  */
 
 static INLINE int
-live_symbol_p (m, p)
-     struct mem_node *m;
-     void *p;
+live_symbol_p (struct mem_node *m, void *p)
 {
   if (m->type == MEM_TYPE_SYMBOL)
     {
@@ -3972,9 +3855,7 @@ live_symbol_p (m, p)
    the heap.  M is a pointer to the mem_block for P.  */
 
 static INLINE int
-live_float_p (m, p)
-     struct mem_node *m;
-     void *p;
+live_float_p (struct mem_node *m, void *p)
 {
   if (m->type == MEM_TYPE_FLOAT)
     {
@@ -3998,9 +3879,7 @@ live_float_p (m, p)
    the heap.  M is a pointer to the mem_block for P.  */
 
 static INLINE int
-live_misc_p (m, p)
-     struct mem_node *m;
-     void *p;
+live_misc_p (struct mem_node *m, void *p)
 {
   if (m->type == MEM_TYPE_MISC)
     {
@@ -4026,9 +3905,7 @@ live_misc_p (m, p)
    M is a pointer to the mem_block for P.  */
 
 static INLINE int
-live_vector_p (m, p)
-     struct mem_node *m;
-     void *p;
+live_vector_p (struct mem_node *m, void *p)
 {
   return (p == m->start && m->type == MEM_TYPE_VECTORLIKE);
 }
@@ -4038,9 +3915,7 @@ live_vector_p (m, p)
    pointer to the mem_block for P.  */
 
 static INLINE int
-live_buffer_p (m, p)
-     struct mem_node *m;
-     void *p;
+live_buffer_p (struct mem_node *m, void *p)
 {
   /* P must point to the start of the block, and the buffer
      must not have been killed.  */
@@ -4083,7 +3958,7 @@ static double avg_live;
 
 DEFUN ("gc-status", Fgc_status, Sgc_status, 0, 0, "",
        doc: /* Show information about live and zombie objects.  */)
-     ()
+  (void)
 {
   Lisp_Object args[8], zombie_list = Qnil;
   int i;
@@ -4106,8 +3981,7 @@ DEFUN ("gc-status", Fgc_status, Sgc_status, 0, 0, "",
 /* Mark OBJ if we can prove it's a Lisp_Object.  */
 
 static INLINE void
-mark_maybe_object (obj)
-     Lisp_Object obj;
+mark_maybe_object (Lisp_Object obj)
 {
   void *po = (void *) XPNTR (obj);
   struct mem_node *m = mem_find (po);
@@ -4170,8 +4044,7 @@ mark_maybe_object (obj)
    marked.  */
 
 static INLINE void
-mark_maybe_pointer (p)
-     void *p;
+mark_maybe_pointer (void *p)
 {
   struct mem_node *m;
 
@@ -4251,9 +4124,7 @@ mark_maybe_pointer (p)
    or END+OFFSET..START. */
 
 static void
-mark_memory (start, end, offset)
-     void *start, *end;
-     int offset;
+mark_memory (void *start, void *end, int offset)
 {
   Lisp_Object *p;
   void **pp;
@@ -4469,7 +4340,7 @@ dump_zombies ()
    equally on the stack.  */
 
 static void
-mark_stack ()
+mark_stack (void)
 {
   int i;
   /* jmp_buf may not be aligned enough on darwin-ppc64 */
@@ -4544,8 +4415,7 @@ mark_stack ()
 
 /* Determine whether it is safe to access memory at address P.  */
 static int
-valid_pointer_p (p)
-     void *p;
+valid_pointer_p (void *p)
 {
 #ifdef WINDOWSNT
   return w32_valid_pointer_p (p, 16);
@@ -4576,8 +4446,7 @@ valid_pointer_p (p)
    so it should only be used in code for manual debugging.  */
 
 int
-valid_lisp_object_p (obj)
-     Lisp_Object obj;
+valid_lisp_object_p (Lisp_Object obj)
 {
   void *p;
 #if GC_MARK_STACK
@@ -4655,9 +4524,7 @@ valid_lisp_object_p (obj)
    allocated.  TYPE < 0 means it's not used for a Lisp object.  */
 
 static POINTER_TYPE *
-pure_alloc (size, type)
-     size_t size;
-     int type;
+pure_alloc (size_t size, int type)
 {
   POINTER_TYPE *result;
 #ifdef USE_LSB_TAG
@@ -4711,7 +4578,7 @@ pure_alloc (size, type)
 /* Print a warning if PURESIZE is too small.  */
 
 void
-check_pure_size ()
+check_pure_size (void)
 {
   if (pure_bytes_used_before_overflow)
     message ("emacs:0:Pure Lisp storage overflow (approx. %d bytes needed)",
@@ -4724,9 +4591,7 @@ check_pure_size ()
    address.  Return NULL if not found.  */
 
 static char *
-find_string_data_in_pure (data, nbytes)
-     const char *data;
-     int nbytes;
+find_string_data_in_pure (const char *data, int nbytes)
 {
   int i, skip, bm_skip[256], last_char_skip, infinity, start, start_max;
   const unsigned char *p;
@@ -4795,10 +4660,7 @@ find_string_data_in_pure (data, nbytes)
    string; then the string is not protected from gc.  */
 
 Lisp_Object
-make_pure_string (data, nchars, nbytes, multibyte)
-     const char *data;
-     int nchars, nbytes;
-     int multibyte;
+make_pure_string (const char *data, int nchars, int nbytes, int multibyte)
 {
   Lisp_Object string;
   struct Lisp_String *s;
@@ -4808,7 +4670,7 @@ make_pure_string (data, nchars, nbytes, multibyte)
   if (s->data == NULL)
     {
       s->data = (unsigned char *) pure_alloc (nbytes + 1, -1);
-      bcopy (data, s->data, nbytes);
+      memcpy (s->data, data, nbytes);
       s->data[nbytes] = '\0';
     }
   s->size = nchars;
@@ -4841,8 +4703,7 @@ make_pure_c_string (const char *data)
    of CAR as car and CDR as cdr.  */
 
 Lisp_Object
-pure_cons (car, cdr)
-     Lisp_Object car, cdr;
+pure_cons (Lisp_Object car, Lisp_Object cdr)
 {
   register Lisp_Object new;
   struct Lisp_Cons *p;
@@ -4858,8 +4719,7 @@ pure_cons (car, cdr)
 /* Value is a float object with value NUM allocated from pure space.  */
 
 static Lisp_Object
-make_pure_float (num)
-     double num;
+make_pure_float (double num)
 {
   register Lisp_Object new;
   struct Lisp_Float *p;
@@ -4875,8 +4735,7 @@ make_pure_float (num)
    pure space.  */
 
 Lisp_Object
-make_pure_vector (len)
-     EMACS_INT len;
+make_pure_vector (EMACS_INT len)
 {
   Lisp_Object new;
   struct Lisp_Vector *p;
@@ -4893,8 +4752,7 @@ DEFUN ("purecopy", Fpurecopy, Spurecopy, 1, 1, 0,
        doc: /* Make a copy of object OBJ in pure storage.
 Recursively copies contents of vectors and cons cells.
 Does not copy symbols.  Copies strings without text properties.  */)
-     (obj)
-     register Lisp_Object obj;
+  (register Lisp_Object obj)
 {
   if (NILP (Vpurify_flag))
     return obj;
@@ -4902,14 +4760,21 @@ Does not copy symbols.  Copies strings without text properties.  */)
   if (PURE_POINTER_P (XPNTR (obj)))
     return obj;
 
+  if (HASH_TABLE_P (Vpurify_flag)) /* Hash consing.  */
+    {
+      Lisp_Object tmp = Fgethash (obj, Vpurify_flag, Qnil);
+      if (!NILP (tmp))
+       return tmp;
+    }
+
   if (CONSP (obj))
-    return pure_cons (XCAR (obj), XCDR (obj));
+    obj = pure_cons (XCAR (obj), XCDR (obj));
   else if (FLOATP (obj))
-    return make_pure_float (XFLOAT_DATA (obj));
+    obj = make_pure_float (XFLOAT_DATA (obj));
   else if (STRINGP (obj))
-    return make_pure_string (SDATA (obj), SCHARS (obj),
-                            SBYTES (obj),
-                            STRING_MULTIBYTE (obj));
+    obj = make_pure_string (SDATA (obj), SCHARS (obj),
+                           SBYTES (obj),
+                           STRING_MULTIBYTE (obj));
   else if (COMPILEDP (obj) || VECTORP (obj))
     {
       register struct Lisp_Vector *vec;
@@ -4929,10 +4794,15 @@ Does not copy symbols.  Copies strings without text properties.  */)
        }
       else
        XSETVECTOR (obj, vec);
-      return obj;
     }
   else if (MARKERP (obj))
     error ("Attempt to copy a marker to pure storage");
+  else
+    /* Not purified, don't hash-cons.  */
+    return obj;
+
+  if (HASH_TABLE_P (Vpurify_flag)) /* Hash consing.  */
+    Fputhash (obj, obj, Vpurify_flag);
 
   return obj;
 }
@@ -4947,8 +4817,7 @@ Does not copy symbols.  Copies strings without text properties.  */)
    VARADDRESS.  */
 
 void
-staticpro (varaddress)
-     Lisp_Object *varaddress;
+staticpro (Lisp_Object *varaddress)
 {
   staticvec[staticidx++] = varaddress;
   if (staticidx >= NSTATICS)
@@ -4963,7 +4832,7 @@ staticpro (varaddress)
 /* Temporarily prevent garbage collection.  */
 
 int
-inhibit_garbage_collection ()
+inhibit_garbage_collection (void)
 {
   int count = SPECPDL_INDEX ();
   int nbits = min (VALBITS, BITS_PER_INT);
@@ -4984,7 +4853,7 @@ Garbage collection happens automatically if you cons more than
   (USED-STRINGS . FREE-STRINGS))
 However, if there was overflow in pure space, `garbage-collect'
 returns nil, because real GC can't be done.  */)
-     ()
+  (void)
 {
   register struct specbinding *bind;
   struct catchtag *catch;
@@ -5067,9 +4936,9 @@ returns nil, because real GC can't be done.  */)
          if (stack_copy)
            {
              if ((EMACS_INT) (&stack_top_variable - stack_bottom) > 0)
-               bcopy (stack_bottom, stack_copy, i);
+               memcpy (stack_copy, stack_bottom, i);
              else
-               bcopy (&stack_top_variable, stack_copy, i);
+               memcpy (stack_copy, &stack_top_variable, i);
            }
        }
     }
@@ -5102,7 +4971,7 @@ returns nil, because real GC can't be done.  */)
 
 #ifdef USE_GTK
   {
-    extern void xg_mark_data ();
+    extern void xg_mark_data (void);
     xg_mark_data ();
   }
 #endif
@@ -5295,8 +5164,7 @@ returns nil, because real GC can't be done.  */)
    only interesting objects referenced from glyphs are strings.  */
 
 static void
-mark_glyph_matrix (matrix)
-     struct glyph_matrix *matrix;
+mark_glyph_matrix (struct glyph_matrix *matrix)
 {
   struct glyph_row *row = matrix->rows;
   struct glyph_row *end = row + matrix->nrows;
@@ -5322,8 +5190,7 @@ mark_glyph_matrix (matrix)
 /* Mark Lisp faces in the face cache C.  */
 
 static void
-mark_face_cache (c)
-     struct face_cache *c;
+mark_face_cache (struct face_cache *c)
 {
   if (c)
     {
@@ -5358,8 +5225,7 @@ int last_marked_index;
 static int mark_object_loop_halt;
 
 static void
-mark_vectorlike (ptr)
-     struct Lisp_Vector *ptr;
+mark_vectorlike (struct Lisp_Vector *ptr)
 {
   register EMACS_INT size = ptr->size;
   register int i;
@@ -5382,8 +5248,7 @@ mark_vectorlike (ptr)
    symbols.  */
 
 static void
-mark_char_table (ptr)
-     struct Lisp_Vector *ptr;
+mark_char_table (struct Lisp_Vector *ptr)
 {
   register EMACS_INT size = ptr->size & PSEUDOVECTOR_SIZE_MASK;
   register int i;
@@ -5407,8 +5272,7 @@ mark_char_table (ptr)
 }
 
 void
-mark_object (arg)
-     Lisp_Object arg;
+mark_object (Lisp_Object arg)
 {
   register Lisp_Object obj = arg;
 #ifdef GC_CHECK_MARKED_OBJECTS
@@ -5578,17 +5442,42 @@ mark_object (arg)
          break;
        CHECK_ALLOCATED_AND_LIVE (live_symbol_p);
        ptr->gcmarkbit = 1;
-       mark_object (ptr->value);
        mark_object (ptr->function);
        mark_object (ptr->plist);
-
+       switch (ptr->redirect)
+         {
+         case SYMBOL_PLAINVAL: mark_object (SYMBOL_VAL (ptr)); break;
+         case SYMBOL_VARALIAS:
+           {
+             Lisp_Object tem;
+             XSETSYMBOL (tem, SYMBOL_ALIAS (ptr));
+             mark_object (tem);
+             break;
+           }
+         case SYMBOL_LOCALIZED:
+           {
+             struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (ptr);
+             /* If the value is forwarded to a buffer or keyboard field,
+                these are marked when we see the corresponding object.
+                And if it's forwarded to a C variable, either it's not
+                a Lisp_Object var, or it's staticpro'd already.  */
+             mark_object (blv->where);
+             mark_object (blv->valcell);
+             mark_object (blv->defcell);
+             break;
+           }
+         case SYMBOL_FORWARDED:
+           /* If the value is forwarded to a buffer or keyboard field,
+              these are marked when we see the corresponding object.
+              And if it's forwarded to a C variable, either it's not
+              a Lisp_Object var, or it's staticpro'd already.  */
+           break;
+         default: abort ();
+         }
        if (!PURE_POINTER_P (XSTRING (ptr->xname)))
          MARK_STRING (XSTRING (ptr->xname));
        MARK_INTERVAL_TREE (STRING_INTERVALS (ptr->xname));
 
-       /* Note that we do not mark the obarray of the symbol.
-          It is safe not to do so because nothing accesses that
-          slot except to check whether it is nil.  */
        ptr = ptr->next;
        if (ptr)
          {
@@ -5607,22 +5496,6 @@ mark_object (arg)
 
       switch (XMISCTYPE (obj))
        {
-       case Lisp_Misc_Buffer_Local_Value:
-         {
-           register struct Lisp_Buffer_Local_Value *ptr
-             = XBUFFER_LOCAL_VALUE (obj);
-           /* If the cdr is nil, avoid recursion for the car.  */
-           if (EQ (ptr->cdr, Qnil))
-             {
-               obj = ptr->realvalue;
-               goto loop;
-             }
-           mark_object (ptr->realvalue);
-           mark_object (ptr->buffer);
-           mark_object (ptr->frame);
-           obj = ptr->cdr;
-           goto loop;
-         }
 
        case Lisp_Misc_Marker:
          /* DO NOT mark thru the marker's chain.
@@ -5630,17 +5503,6 @@ mark_object (arg)
             instead, markers are removed from the chain when freed by gc.  */
          break;
 
-       case Lisp_Misc_Intfwd:
-       case Lisp_Misc_Boolfwd:
-       case Lisp_Misc_Objfwd:
-       case Lisp_Misc_Buffer_Objfwd:
-       case Lisp_Misc_Kboard_Objfwd:
-         /* Don't bother with Lisp_Buffer_Objfwd,
-            since all markable slots in current buffer marked anyway.  */
-         /* Don't need to do Lisp_Objfwd, since the places they point
-            are protected with staticpro.  */
-         break;
-
        case Lisp_Misc_Save_Value:
 #if GC_MARK_STACK
          {
@@ -5719,8 +5581,7 @@ mark_object (arg)
 /* Mark the pointers in a buffer structure.  */
 
 static void
-mark_buffer (buf)
-     Lisp_Object buf;
+mark_buffer (Lisp_Object buf)
 {
   register struct buffer *buffer = XBUFFER (buf);
   register Lisp_Object *ptr, tmp;
@@ -5787,8 +5648,7 @@ mark_terminals (void)
    either marked or does not need to be marked to survive.  */
 
 int
-survives_gc_p (obj)
-     Lisp_Object obj;
+survives_gc_p (Lisp_Object obj)
 {
   int survives_p;
 
@@ -5834,7 +5694,7 @@ survives_gc_p (obj)
 /* Sweep: find all structures not marked, and free them. */
 
 static void
-gc_sweep ()
+gc_sweep (void)
 {
   /* Remove or mark entries in weak hash tables.
      This must be done before any object is unmarked.  */
@@ -6045,6 +5905,8 @@ gc_sweep ()
 
            if (!sym->gcmarkbit && !pure_p)
              {
+               if (sym->redirect == SYMBOL_LOCALIZED)
+                 xfree (SYMBOL_BLV (sym));
                sym->next = symbol_free_list;
                symbol_free_list = sym;
 #if GC_MARK_STACK
@@ -6208,7 +6070,7 @@ DEFUN ("memory-limit", Fmemory_limit, Smemory_limit, 0, 0, 0,
        doc: /* Return the address of the last byte Emacs has allocated, divided by 1024.
 This may be helpful in debugging Emacs's memory usage.
 We divide the value by 1024 to make sure it fits in a Lisp integer.  */)
-     ()
+  (void)
 {
   Lisp_Object end;
 
@@ -6230,7 +6092,7 @@ objects consed.
 MISCS include overlays, markers, and some internal types.
 Frames, windows, buffers, and subprocesses count as vectors
   (but the contents of a buffer's text do not count here).  */)
-     ()
+  (void)
 {
   Lisp_Object consed[8];
 
@@ -6249,10 +6111,7 @@ Frames, windows, buffers, and subprocesses count as vectors
 int suppress_checking;
 
 void
-die (msg, file, line)
-     const char *msg;
-     const char *file;
-     int line;
+die (const char *msg, const char *file, int line)
 {
   fprintf (stderr, "\r\n%s:%d: Emacs fatal error: %s\r\n",
           file, line, msg);
@@ -6262,7 +6121,7 @@ die (msg, file, line)
 /* Initialization */
 
 void
-init_alloc_once ()
+init_alloc_once (void)
 {
   /* Used to do Vpurify_flag = Qt here, but Qt isn't set up yet!  */
   purebeg = PUREBEG;
@@ -6309,15 +6168,10 @@ init_alloc_once ()
   consing_since_gc = 0;
   gc_cons_threshold = 100000 * sizeof (Lisp_Object);
   gc_relative_threshold = 0;
-
-#ifdef VIRT_ADDR_VARIES
-  malloc_sbrk_unused = 1<<22;  /* A large number */
-  malloc_sbrk_used = 100000;   /* as reasonable as any number */
-#endif /* VIRT_ADDR_VARIES */
 }
 
 void
-init_alloc ()
+init_alloc (void)
 {
   gcprolist = 0;
   byte_stack_list = 0;
@@ -6331,7 +6185,7 @@ init_alloc ()
 }
 
 void
-syms_of_alloc ()
+syms_of_alloc (void)
 {
   DEFVAR_INT ("gc-cons-threshold", &gc_cons_threshold,
              doc: /* *Number of bytes of consing between garbage collections.
@@ -6380,7 +6234,9 @@ If this portion is smaller than `gc-cons-threshold', this is ignored.  */);
 
   DEFVAR_LISP ("purify-flag", &Vpurify_flag,
               doc: /* Non-nil means loading Lisp code in order to dump an executable.
-This means that certain objects should be allocated in shared (pure) space.  */);
+This means that certain objects should be allocated in shared (pure) space.
+It can also be set to a hash-table, in which case this table is used to
+do hash-consing of the objects allocated to pure space.  */);
 
   DEFVAR_BOOL ("garbage-collection-messages", &garbage_collection_messages,
               doc: /* Non-nil means display messages at start and end of garbage collection.  */);
index 432e2590dad83d7ccb26acd51c9228b42fb03e85..9fd9dee835ed7136adaf0ac0a6318d9864678c6c 100644 (file)
@@ -21,11 +21,11 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <signal.h>
 #include <stdio.h>
 #include <setjmp.h>
-#include <lisp.h>
-#include <syssignal.h>
-#include <systime.h>
-#include <blockinput.h>
-#include <atimer.h>
+#include "lisp.h"
+#include "syssignal.h"
+#include "systime.h"
+#include "blockinput.h"
+#include "atimer.h"
 
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
@@ -64,11 +64,11 @@ int pending_atimers;
 
 /* Function prototypes.  */
 
-static void set_alarm P_ ((void));
-static void schedule_atimer P_ ((struct atimer *));
-static struct atimer *append_atimer_lists P_ ((struct atimer *,
-                                              struct atimer *));
-SIGTYPE alarm_signal_handler ();
+static void set_alarm (void);
+static void schedule_atimer (struct atimer *);
+static struct atimer *append_atimer_lists (struct atimer *,
+                                           struct atimer *);
+SIGTYPE alarm_signal_handler (int signo);
 
 
 /* Start a new atimer of type TYPE.  TIME specifies when the timer is
@@ -90,11 +90,8 @@ SIGTYPE alarm_signal_handler ();
    to cancel_atimer; don't free it yourself.  */
 
 struct atimer *
-start_atimer (type, time, fn, client_data)
-     enum atimer_type type;
-     EMACS_TIME time;
-     atimer_callback fn;
-     void *client_data;
+start_atimer (enum atimer_type type, EMACS_TIME time, atimer_callback fn,
+             void *client_data)
 {
   struct atimer *t;
 
@@ -119,7 +116,7 @@ start_atimer (type, time, fn, client_data)
     t = (struct atimer *) xmalloc (sizeof *t);
 
   /* Fill the atimer structure.  */
-  bzero (t, sizeof *t);
+  memset (t, 0, sizeof *t);
   t->type = type;
   t->fn = fn;
   t->client_data = client_data;
@@ -159,8 +156,7 @@ start_atimer (type, time, fn, client_data)
 /* Cancel and free atimer TIMER.  */
 
 void
-cancel_atimer (timer)
-     struct atimer *timer;
+cancel_atimer (struct atimer *timer)
 {
   int i;
 
@@ -199,8 +195,7 @@ cancel_atimer (timer)
    result list.  */
 
 static struct atimer *
-append_atimer_lists (list1, list2)
-     struct atimer *list1, *list2;
+append_atimer_lists (struct atimer *list1, struct atimer *list2)
 {
   if (list1 == NULL)
     return list2;
@@ -221,8 +216,7 @@ append_atimer_lists (list1, list2)
 /* Stop all timers except timer T.  T null means stop all timers.  */
 
 void
-stop_other_atimers (t)
-     struct atimer *t;
+stop_other_atimers (struct atimer *t)
 {
   BLOCK_ATIMERS;
 
@@ -257,7 +251,7 @@ stop_other_atimers (t)
    stop_other_atimers.  */
 
 void
-run_all_atimers ()
+run_all_atimers (void)
 {
   if (stopped_atimers)
     {
@@ -283,8 +277,7 @@ run_all_atimers ()
 /* A version of run_all_timers suitable for a record_unwind_protect.  */
 
 Lisp_Object
-unwind_stop_other_atimers (dummy)
-     Lisp_Object dummy;
+unwind_stop_other_atimers (Lisp_Object dummy)
 {
   run_all_atimers ();
   return Qnil;
@@ -294,14 +287,8 @@ unwind_stop_other_atimers (dummy)
 /* Arrange for a SIGALRM to arrive when the next timer is ripe.  */
 
 static void
-set_alarm ()
+set_alarm (void)
 {
-#if defined (USG) && !defined (POSIX_SIGNALS)
-  /* USG systems forget handlers when they are used;
-     must reestablish each time.  */
-  signal (SIGALRM, alarm_signal_handler);
-#endif /* USG */
-
   if (atimers)
     {
       EMACS_TIME now, time;
@@ -321,7 +308,7 @@ set_alarm ()
          EMACS_SET_USECS (time, 1000);
        }
 
-      bzero (&it, sizeof it);
+      memset (&it, 0, sizeof it);
       it.it_value = time;
       setitimer (ITIMER_REAL, &it, 0);
 #else /* not HAVE_SETITIMER */
@@ -336,8 +323,7 @@ set_alarm ()
    already.  */
 
 static void
-schedule_atimer (t)
-     struct atimer *t;
+schedule_atimer (struct atimer *t)
 {
   struct atimer *a = atimers, *prev = NULL;
 
@@ -355,7 +341,7 @@ schedule_atimer (t)
 }
 
 static void
-run_timers ()
+run_timers (void)
 {
   EMACS_TIME now;
 
@@ -407,8 +393,7 @@ run_timers ()
    SIGALRM.  */
 
 SIGTYPE
-alarm_signal_handler (signo)
-     int signo;
+alarm_signal_handler (int signo)
 {
 #ifndef SYNC_INPUT
   SIGNAL_THREAD_CHECK (signo);
@@ -426,7 +411,7 @@ alarm_signal_handler (signo)
 /* Call alarm_signal_handler for pending timers.  */
 
 void
-do_pending_atimers ()
+do_pending_atimers (void)
 {
   if (pending_atimers)
     {
@@ -441,8 +426,7 @@ do_pending_atimers ()
    some systems like HPUX (see process.c).  */
 
 void
-turn_on_atimers (on)
-     int on;
+turn_on_atimers (int on)
 {
   if (on)
     {
@@ -455,7 +439,7 @@ turn_on_atimers (on)
 
 
 void
-init_atimer ()
+init_atimer (void)
 {
   free_atimers = stopped_atimers = atimers = NULL;
   pending_atimers = 0;
index fd354caf54d4a1c54b21db26e02f58d3ead5a8b7..c2245d30e6bb3346a96088aa462d3fa209b9e029 100644 (file)
@@ -20,13 +20,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #ifndef EMACS_ATIMER_H
 #define EMACS_ATIMER_H
 
-/* Declare the prototype for a general external function.  */
-#if defined (PROTOTYPES) || defined (WINDOWSNT)
-#define P_(proto) proto
-#else
-#define P_(proto) ()
-#endif
-
 #include "systime.h"           /* for EMACS_TIME */
 
 /* Forward declaration.  */
@@ -49,7 +42,7 @@ enum atimer_type
 
 /* Type of timer callback functions.  */
 
-typedef void (* atimer_callback) P_ ((struct atimer *timer));
+typedef void (* atimer_callback) (struct atimer *timer);
 
 /* Structure describing an asynchronous timer.  */
 
@@ -77,15 +70,15 @@ struct atimer
 
 /* Function prototypes.  */
 
-struct atimer *start_atimer P_ ((enum atimer_type, EMACS_TIME,
-                                atimer_callback, void *));
-void cancel_atimer P_ ((struct atimer *));
-void do_pending_atimers P_ ((void));
-void init_atimer P_ ((void));
-void turn_on_atimers P_ ((int));
-void stop_other_atimers P_ ((struct atimer *));
-void run_all_atimers P_ ((void));
-Lisp_Object unwind_stop_other_atimers P_ ((Lisp_Object));
+struct atimer *start_atimer (enum atimer_type, EMACS_TIME,
+                             atimer_callback, void *);
+void cancel_atimer (struct atimer *);
+void do_pending_atimers (void);
+void init_atimer (void);
+void turn_on_atimers (int);
+void stop_other_atimers (struct atimer *);
+void run_all_atimers (void);
+Lisp_Object unwind_stop_other_atimers (Lisp_Object);
 
 #endif /* EMACS_ATIMER_H */
 
diff --git a/src/autodeps.mk b/src/autodeps.mk
new file mode 100644 (file)
index 0000000..fb0e213
--- /dev/null
@@ -0,0 +1,6 @@
+### autodeps.mk --- src/Makefile fragment for GNU Emacs
+
+## This is inserted in src/Makefile if AUTO_DEPEND=yes.
+
+ALLOBJS=$(START_FILES) ${obj} ${otherobj}
+-include $(ALLOBJS:%.o=${DEPDIR}/%.d)
diff --git a/src/bidi.c b/src/bidi.c
new file mode 100644 (file)
index 0000000..a6d4d1b
--- /dev/null
@@ -0,0 +1,1778 @@
+/* Low-level bidirectional buffer-scanning functions for GNU Emacs.
+   Copyright (C) 2000, 2001, 2004, 2005, 2009, 2010
+   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 Eli Zaretskii <eliz@gnu.org>.
+
+   A sequential implementation of the Unicode Bidirectional algorithm,
+   as per UAX#9, a part of the Unicode Standard.
+
+   Unlike the reference and most other implementations, this one is
+   designed to be called once for every character in the buffer or
+   string.
+
+   The main entry point is bidi_move_to_visually_next.  Each time it
+   is called, it finds the next character in the visual order, and
+   returns its information in a special structure.  The caller is then
+   expected to process this character for display or any other
+   purposes, and call bidi_move_to_visually_next for the next
+   character.  See the comments in bidi_move_to_visually_next for more
+   details about its algorithm that finds the next visual-order
+   character by resolving their levels on the fly.
+
+   The two other entry points are bidi_paragraph_init and
+   bidi_mirror_char.  The first determines the base direction of a
+   paragraph, while the second returns the mirrored version of its
+   argument character.
+
+   If you want to understand the code, you will have to read it
+   together with the relevant portions of UAX#9.  The comments include
+   references to UAX#9 rules, for that very reason.
+
+   A note about references to UAX#9 rules: if the reference says
+   something like "X9/Retaining", it means that you need to refer to
+   rule X9 and to its modifications decribed in the "Implementation
+   Notes" section of UAX#9, under "Retaining Format Codes".  */
+
+#include <config.h>
+#include <stdio.h>
+#include <string.h>
+#include <setjmp.h>
+
+#include "lisp.h"
+#include "buffer.h"
+#include "character.h"
+#include "dispextern.h"
+
+static int bidi_initialized = 0;
+
+static Lisp_Object bidi_type_table, bidi_mirror_table;
+
+/* FIXME: Remove these when bidi_explicit_dir_char uses a lookup table.  */
+#define LRM_CHAR   0x200E
+#define RLM_CHAR   0x200F
+#define LRE_CHAR   0x202A
+#define RLE_CHAR   0x202B
+#define PDF_CHAR   0x202C
+#define LRO_CHAR   0x202D
+#define RLO_CHAR   0x202E
+
+#define BIDI_EOB   -1
+#define BIDI_BOB   -2          /* FIXME: Is this needed? */
+
+/* Local data structures.  (Look in dispextern.h for the rest.)  */
+
+/* What we need to know about the current paragraph.  */
+struct bidi_paragraph_info {
+  int start_bytepos;   /* byte position where it begins */
+  int end_bytepos;     /* byte position where it ends */
+  int embedding_level; /* its basic embedding level */
+  bidi_dir_t base_dir; /* its base direction */
+};
+
+/* Data type for describing the bidirectional character categories.  */
+typedef enum {
+  UNKNOWN_BC,
+  NEUTRAL,
+  WEAK,
+  STRONG
+} bidi_category_t;
+
+int bidi_ignore_explicit_marks_for_paragraph_level = 1;
+
+static Lisp_Object paragraph_start_re, paragraph_separate_re;
+static Lisp_Object Qparagraph_start, Qparagraph_separate;
+
+static void
+bidi_initialize (void)
+{
+
+#include "biditype.h"
+#include "bidimirror.h"
+
+  int i;
+
+  bidi_type_table = Fmake_char_table (Qnil, make_number (STRONG_L));
+  staticpro (&bidi_type_table);
+
+  for (i = 0; i < sizeof bidi_type / sizeof bidi_type[0]; i++)
+    char_table_set_range (bidi_type_table, bidi_type[i].from, bidi_type[i].to,
+                         make_number (bidi_type[i].type));
+
+  bidi_mirror_table = Fmake_char_table (Qnil, Qnil);
+  staticpro (&bidi_mirror_table);
+
+  for (i = 0; i < sizeof bidi_mirror / sizeof bidi_mirror[0]; i++)
+    char_table_set (bidi_mirror_table, bidi_mirror[i].from,
+                   make_number (bidi_mirror[i].to));
+
+  Qparagraph_start = intern ("paragraph-start");
+  staticpro (&Qparagraph_start);
+  paragraph_start_re = Fsymbol_value (Qparagraph_start);
+  if (!STRINGP (paragraph_start_re))
+    paragraph_start_re = build_string ("\f\\|[ \t]*$");
+  staticpro (&paragraph_start_re);
+  Qparagraph_separate = intern ("paragraph-separate");
+  staticpro (&Qparagraph_separate);
+  paragraph_separate_re = Fsymbol_value (Qparagraph_separate);
+  if (!STRINGP (paragraph_separate_re))
+    paragraph_separate_re = build_string ("[ \t\f]*$");
+  staticpro (&paragraph_separate_re);
+  bidi_initialized = 1;
+}
+
+/* Return the bidi type of a character CH, subject to the current
+   directional OVERRIDE.  */
+static INLINE bidi_type_t
+bidi_get_type (int ch, bidi_dir_t override)
+{
+  bidi_type_t default_type;
+
+  if (ch == BIDI_EOB)
+    return NEUTRAL_B;
+  if (ch < 0 || ch > MAX_CHAR)
+    abort ();
+
+  default_type = (bidi_type_t) XINT (CHAR_TABLE_REF (bidi_type_table, ch));
+
+  if (override == NEUTRAL_DIR)
+    return default_type;
+
+  switch (default_type)
+    {
+      /* Although UAX#9 does not tell, it doesn't make sense to
+        override NEUTRAL_B and LRM/RLM characters.  */
+      case NEUTRAL_B:
+      case LRE:
+      case LRO:
+      case RLE:
+      case RLO:
+      case PDF:
+       return default_type;
+      default:
+       switch (ch)
+         {
+           case LRM_CHAR:
+           case RLM_CHAR:
+             return default_type;
+           default:
+             if (override == L2R) /* X6 */
+               return STRONG_L;
+             else if (override == R2L)
+               return STRONG_R;
+             else
+               abort ();       /* can't happen: handled above */
+         }
+    }
+}
+
+void
+bidi_check_type (bidi_type_t type)
+{
+  if (type < UNKNOWN_BT || type > NEUTRAL_ON)
+    abort ();
+}
+
+/* Given a bidi TYPE of a character, return its category.  */
+static INLINE bidi_category_t
+bidi_get_category (bidi_type_t type)
+{
+  switch (type)
+    {
+      case UNKNOWN_BT:
+       return UNKNOWN_BC;
+      case STRONG_L:
+      case STRONG_R:
+      case STRONG_AL:
+      case LRE:
+      case LRO:
+      case RLE:
+      case RLO:
+       return STRONG;
+      case PDF:                /* ??? really?? */
+      case WEAK_EN:
+      case WEAK_ES:
+      case WEAK_ET:
+      case WEAK_AN:
+      case WEAK_CS:
+      case WEAK_NSM:
+      case WEAK_BN:
+       return WEAK;
+      case NEUTRAL_B:
+      case NEUTRAL_S:
+      case NEUTRAL_WS:
+      case NEUTRAL_ON:
+       return NEUTRAL;
+      default:
+       abort ();
+    }
+}
+
+/* Return the mirrored character of C, if it has one.  If C has no
+   mirrored counterpart, return C.
+   Note: The conditions in UAX#9 clause L4 regarding the surrounding
+   context must be tested by the caller.  */
+int
+bidi_mirror_char (int c)
+{
+  Lisp_Object val;
+
+  if (c == BIDI_EOB)
+    return c;
+  if (c < 0 || c > MAX_CHAR)
+    abort ();
+
+  val = CHAR_TABLE_REF (bidi_mirror_table, c);
+  if (INTEGERP (val))
+    {
+      int v = XINT (val);
+
+      if (v < 0 || v > MAX_CHAR)
+       abort ();
+
+      return v;
+    }
+
+  return c;
+}
+
+/* Copy the bidi iterator from FROM to TO.  To save cycles, this only
+   copies the part of the level stack that is actually in use.  */
+static INLINE void
+bidi_copy_it (struct bidi_it *to, struct bidi_it *from)
+{
+  int i;
+
+  /* Copy everything except the level stack and beyond.  */
+  memcpy (to, from, ((size_t)&((struct bidi_it *)0)->level_stack[0]));
+
+  /* Copy the active part of the level stack.  */
+  to->level_stack[0] = from->level_stack[0]; /* level zero is always in use */
+  for (i = 1; i <= from->stack_idx; i++)
+    to->level_stack[i] = from->level_stack[i];
+}
+
+/* Caching the bidi iterator states.  */
+
+#define BIDI_CACHE_CHUNK 200
+static struct bidi_it *bidi_cache;
+static size_t bidi_cache_size = 0;
+static size_t elsz = sizeof (struct bidi_it);
+static int bidi_cache_idx;     /* next unused cache slot */
+static int bidi_cache_last_idx;        /* slot of last cache hit */
+
+static INLINE void
+bidi_cache_reset (void)
+{
+  bidi_cache_idx = 0;
+  bidi_cache_last_idx = -1;
+}
+
+static INLINE void
+bidi_cache_shrink (void)
+{
+  if (bidi_cache_size > BIDI_CACHE_CHUNK)
+    {
+      bidi_cache_size = BIDI_CACHE_CHUNK;
+      bidi_cache =
+       (struct bidi_it *) xrealloc (bidi_cache, bidi_cache_size * elsz);
+    }
+  bidi_cache_reset ();
+}
+
+static INLINE void
+bidi_cache_fetch_state (int idx, struct bidi_it *bidi_it)
+{
+  int current_scan_dir = bidi_it->scan_dir;
+
+  if (idx < 0 || idx >= bidi_cache_idx)
+    abort ();
+
+  bidi_copy_it (bidi_it, &bidi_cache[idx]);
+  bidi_it->scan_dir = current_scan_dir;
+  bidi_cache_last_idx = idx;
+}
+
+/* Find a cached state with a given CHARPOS and resolved embedding
+   level less or equal to LEVEL.  if LEVEL is -1, disregard the
+   resolved levels in cached states.  DIR, if non-zero, means search
+   in that direction from the last cache hit.  */
+static INLINE int
+bidi_cache_search (int charpos, int level, int dir)
+{
+  int i, i_start;
+
+  if (bidi_cache_idx)
+    {
+      if (charpos < bidi_cache[bidi_cache_last_idx].charpos)
+       dir = -1;
+      else if (charpos > bidi_cache[bidi_cache_last_idx].charpos)
+       dir = 1;
+      if (dir)
+       i_start = bidi_cache_last_idx;
+      else
+       {
+         dir = -1;
+         i_start = bidi_cache_idx - 1;
+       }
+
+      if (dir < 0)
+       {
+         /* Linear search for now; FIXME!  */
+         for (i = i_start; i >= 0; i--)
+           if (bidi_cache[i].charpos == charpos
+               && (level == -1 || bidi_cache[i].resolved_level <= level))
+             return i;
+       }
+      else
+       {
+         for (i = i_start; i < bidi_cache_idx; i++)
+           if (bidi_cache[i].charpos == charpos
+               && (level == -1 || bidi_cache[i].resolved_level <= level))
+             return i;
+       }
+    }
+
+  return -1;
+}
+
+/* Find a cached state where the resolved level changes to a value
+   that is lower than LEVEL, and return its cache slot index.  DIR is
+   the direction to search, starting with the last used cache slot.
+   BEFORE, if non-zero, means return the index of the slot that is
+   ``before'' the level change in the search direction.  That is,
+   given the cached levels like this:
+
+        1122333442211
+         AB        C
+
+   and assuming we are at the position cached at the slot marked with
+   C, searching backwards (DIR = -1) for LEVEL = 2 will return the
+   index of slot B or A, depending whether BEFORE is, respectively,
+   non-zero or zero.  */
+static int
+bidi_cache_find_level_change (int level, int dir, int before)
+{
+  if (bidi_cache_idx)
+    {
+      int i = dir ? bidi_cache_last_idx : bidi_cache_idx - 1;
+      int incr = before ? 1 : 0;
+
+      if (!dir)
+       dir = -1;
+      else if (!incr)
+       i += dir;
+
+      if (dir < 0)
+       {
+         while (i >= incr)
+           {
+             if (bidi_cache[i - incr].resolved_level >= 0
+                 && bidi_cache[i - incr].resolved_level < level)
+               return i;
+             i--;
+           }
+       }
+      else
+       {
+         while (i < bidi_cache_idx - incr)
+           {
+             if (bidi_cache[i + incr].resolved_level >= 0
+                 && bidi_cache[i + incr].resolved_level < level)
+               return i;
+             i++;
+           }
+       }
+    }
+
+  return -1;
+}
+
+static INLINE void
+bidi_cache_iterator_state (struct bidi_it *bidi_it, int resolved)
+{
+  int idx;
+
+  /* We should never cache on backward scans.  */
+  if (bidi_it->scan_dir == -1)
+    abort ();
+  idx = bidi_cache_search (bidi_it->charpos, -1, 1);
+
+  if (idx < 0)
+    {
+      idx = bidi_cache_idx;
+      /* Enlarge the cache as needed.  */
+      if (idx >= bidi_cache_size)
+       {
+         bidi_cache_size += BIDI_CACHE_CHUNK;
+         bidi_cache =
+           (struct bidi_it *) xrealloc (bidi_cache, bidi_cache_size * elsz);
+       }
+      /* Character positions should correspond to cache positions 1:1.
+        If we are outside the range of cached positions, the cache is
+        useless and must be reset.  */
+      if (idx > 0 &&
+         (bidi_it->charpos > bidi_cache[idx - 1].charpos + 1
+          || bidi_it->charpos < bidi_cache[0].charpos))
+       {
+         bidi_cache_reset ();
+         idx = 0;
+       }
+      bidi_copy_it (&bidi_cache[idx], bidi_it);
+      if (!resolved)
+       bidi_cache[idx].resolved_level = -1;
+    }
+  else
+    {
+      /* Copy only the members which could have changed, to avoid
+        costly copying of the entire struct.  */
+      bidi_cache[idx].type = bidi_it->type;
+      bidi_check_type (bidi_it->type);
+      bidi_cache[idx].type_after_w1 = bidi_it->type_after_w1;
+      bidi_check_type (bidi_it->type_after_w1);
+      if (resolved)
+       bidi_cache[idx].resolved_level = bidi_it->resolved_level;
+      else
+       bidi_cache[idx].resolved_level = -1;
+      bidi_cache[idx].invalid_levels = bidi_it->invalid_levels;
+      bidi_cache[idx].invalid_rl_levels = bidi_it->invalid_rl_levels;
+      bidi_cache[idx].next_for_neutral = bidi_it->next_for_neutral;
+      bidi_cache[idx].next_for_ws = bidi_it->next_for_ws;
+      bidi_cache[idx].ignore_bn_limit = bidi_it->ignore_bn_limit;
+    }
+
+  bidi_cache_last_idx = idx;
+  if (idx >= bidi_cache_idx)
+    bidi_cache_idx = idx + 1;
+}
+
+static INLINE bidi_type_t
+bidi_cache_find (int charpos, int level, struct bidi_it *bidi_it)
+{
+  int i = bidi_cache_search (charpos, level, bidi_it->scan_dir);
+
+  if (i >= 0)
+    {
+      bidi_dir_t current_scan_dir = bidi_it->scan_dir;
+
+      bidi_copy_it (bidi_it, &bidi_cache[i]);
+      bidi_cache_last_idx = i;
+      /* Don't let scan direction from from the cached state override
+        the current scan direction.  */
+      bidi_it->scan_dir = current_scan_dir;
+      return bidi_it->type;
+    }
+
+  return UNKNOWN_BT;
+}
+
+static INLINE int
+bidi_peek_at_next_level (struct bidi_it *bidi_it)
+{
+  if (bidi_cache_idx == 0 || bidi_cache_last_idx == -1)
+    abort ();
+  return bidi_cache[bidi_cache_last_idx + bidi_it->scan_dir].resolved_level;
+}
+
+/* Check if buffer position CHARPOS/BYTEPOS is the end of a paragraph.
+   Value is the non-negative length of the paragraph separator
+   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)
+{
+  Lisp_Object sep_re;
+  Lisp_Object start_re;
+  EMACS_INT val;
+
+  sep_re = paragraph_separate_re;
+  start_re = paragraph_start_re;
+
+  val = fast_looking_at (sep_re, charpos, bytepos, ZV, ZV_BYTE, Qnil);
+  if (val < 0)
+    {
+      if (fast_looking_at (start_re, charpos, bytepos, ZV, ZV_BYTE, Qnil) >= 0)
+       val = -1;
+      else
+       val = -2;
+    }
+
+  return val;
+}
+
+/* Determine the start-of-run (sor) directional type given the two
+   embedding levels on either side of the run boundary.  Also, update
+   the saved info about previously seen characters, since that info is
+   generally valid for a single level run.  */
+static INLINE void
+bidi_set_sor_type (struct bidi_it *bidi_it, int level_before, int level_after)
+{
+  int higher_level = level_before > level_after ? level_before : level_after;
+
+  /* The prev_was_pdf gork is required for when we have several PDFs
+     in a row.  In that case, we want to compute the sor type for the
+     next level run only once: when we see the first PDF.  That's
+     because the sor type depends only on the higher of the two levels
+     that we find on the two sides of the level boundary (see UAX#9,
+     clause X10), and so we don't need to know the final embedding
+     level to which we descend after processing all the PDFs.  */
+  if (!bidi_it->prev_was_pdf || level_before < level_after)
+    /* FIXME: should the default sor direction be user selectable?  */
+    bidi_it->sor = (higher_level & 1) != 0 ? R2L : L2R;
+  if (level_before > level_after)
+    bidi_it->prev_was_pdf = 1;
+
+  bidi_it->prev.type = UNKNOWN_BT;
+  bidi_it->last_strong.type = bidi_it->last_strong.type_after_w1 =
+    bidi_it->last_strong.orig_type = UNKNOWN_BT;
+  bidi_it->prev_for_neutral.type = bidi_it->sor == R2L ? STRONG_R : STRONG_L;
+  bidi_it->prev_for_neutral.charpos = bidi_it->charpos;
+  bidi_it->prev_for_neutral.bytepos = bidi_it->bytepos;
+  bidi_it->next_for_neutral.type = bidi_it->next_for_neutral.type_after_w1 =
+    bidi_it->next_for_neutral.orig_type = UNKNOWN_BT;
+  bidi_it->ignore_bn_limit = 0; /* meaning it's unknown */
+}
+
+static void
+bidi_line_init (struct bidi_it *bidi_it)
+{
+  bidi_it->scan_dir = 1; /* FIXME: do we need to have control on this? */
+  bidi_it->resolved_level = bidi_it->level_stack[0].level;
+  bidi_it->level_stack[0].override = NEUTRAL_DIR; /* X1 */
+  bidi_it->invalid_levels = 0;
+  bidi_it->invalid_rl_levels = -1;
+  bidi_it->next_en_pos = -1;
+  bidi_it->next_for_ws.type = UNKNOWN_BT;
+  bidi_set_sor_type (bidi_it,
+                    bidi_it->paragraph_dir == R2L ? 1 : 0,
+                    bidi_it->level_stack[0].level); /* X10 */
+
+  bidi_cache_reset ();
+}
+
+/* Find the beginning of this paragraph by looking back in the buffer.
+   Value is the byte position of the paragraph's beginning.  */
+static EMACS_INT
+bidi_find_paragraph_start (EMACS_INT pos, EMACS_INT pos_byte)
+{
+  Lisp_Object re = paragraph_start_re;
+  EMACS_INT limit = ZV, limit_byte = ZV_BYTE;
+
+  while (pos_byte > BEGV_BYTE
+        && fast_looking_at (re, pos, pos_byte, limit, limit_byte, Qnil) < 0)
+    {
+      pos = find_next_newline_no_quit (pos - 1, -1);
+      pos_byte = CHAR_TO_BYTE (pos);
+    }
+  return pos_byte;
+}
+
+/* Determine the 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
+   from the first strong character of the paragraph.
+
+   Note that this gives the paragraph separator the same direction as
+   the preceding paragraph, even though Emacs generally views the
+   separartor as not belonging to any paragraph.  */
+void
+bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it)
+{
+  EMACS_INT bytepos = bidi_it->bytepos;
+
+  /* Special case for an empty buffer. */
+  if (bytepos == BEGV_BYTE && bytepos == ZV_BYTE)
+    dir = L2R;
+  /* We should never be called at EOB or before BEGV.  */
+  else if (bytepos >= ZV_BYTE || bytepos < BEGV_BYTE)
+    abort ();
+
+  if (dir == L2R)
+    {
+      bidi_it->paragraph_dir = L2R;
+      bidi_it->new_paragraph = 0;
+    }
+  else if (dir == R2L)
+    {
+      bidi_it->paragraph_dir = R2L;
+      bidi_it->new_paragraph = 0;
+    }
+  else if (dir == NEUTRAL_DIR) /* P2 */
+    {
+      int ch, ch_len;
+      EMACS_INT pos;
+      bidi_type_t type;
+
+      if (!bidi_initialized)
+       bidi_initialize ();
+
+      /* If we are inside a paragraph separator, we are just waiting
+        for the separator to be exhausted; use the previous paragraph
+        direction.  But don't do that if we have been just reseated,
+        because we need to reinitialize below in that case.  */
+      if (!bidi_it->first_elt
+         && bidi_it->charpos < bidi_it->separator_limit)
+       return;
+
+      /* If we are on a newline, get past it to where the next
+        paragraph might start.  But don't do that at BEGV since then
+        we are potentially in a new paragraph that doesn't yet
+        exist.  */
+      pos = bidi_it->charpos;
+      if (bytepos > BEGV_BYTE && FETCH_CHAR (bytepos) == '\n')
+       {
+         bytepos++;
+         pos++;
+       }
+
+      /* We are either at the beginning of a paragraph or in the
+        middle of it.  Find where this paragraph starts.  */
+      bytepos = bidi_find_paragraph_start (pos, bytepos);
+
+      bidi_it->separator_limit = -1;
+      bidi_it->new_paragraph = 0;
+      ch = FETCH_CHAR (bytepos);
+      ch_len = CHAR_BYTES (ch);
+      pos = BYTE_TO_CHAR (bytepos);
+      type = bidi_get_type (ch, NEUTRAL_DIR);
+
+      for (pos++, bytepos += ch_len;
+          /* NOTE: UAX#9 says to search only for L, AL, or R types of
+             characters, and ignore RLE, RLO, LRE, and LRO.  However,
+             I'm not sure it makes sense to omit those 4; should try
+             with and without that to see the effect.  */
+          (bidi_get_category (type) != STRONG)
+            || (bidi_ignore_explicit_marks_for_paragraph_level
+                && (type == RLE || type == RLO
+                    || type == LRE || type == LRO));
+          type = bidi_get_type (ch, NEUTRAL_DIR))
+       {
+         if (type == NEUTRAL_B && bidi_at_paragraph_end (pos, bytepos) >= -1)
+           break;
+         if (bytepos >= ZV_BYTE)
+           {
+             /* Pretend there's a paragraph separator at end of buffer.  */
+             type = NEUTRAL_B;
+             break;
+           }
+         FETCH_CHAR_ADVANCE (ch, pos, bytepos);
+       }
+      if (type == STRONG_R || type == STRONG_AL) /* P3 */
+       bidi_it->paragraph_dir = R2L;
+      else if (type == STRONG_L)
+       bidi_it->paragraph_dir = L2R;
+    }
+  else
+    abort ();
+
+  /* Contrary to UAX#9 clause P3, we only default the paragraph
+     direction to L2R if we have no previous usable paragraph
+     direction.  */
+  if (bidi_it->paragraph_dir != L2R && bidi_it->paragraph_dir != R2L)
+    bidi_it->paragraph_dir = L2R; /* P3 and ``higher protocols'' */
+  if (bidi_it->paragraph_dir == R2L)
+    bidi_it->level_stack[0].level = 1;
+  else
+    bidi_it->level_stack[0].level = 0;
+
+  bidi_line_init (bidi_it);
+}
+
+/* Do whatever UAX#9 clause X8 says should be done at paragraph's
+   end.  */
+static INLINE void
+bidi_set_paragraph_end (struct bidi_it *bidi_it)
+{
+  bidi_it->invalid_levels = 0;
+  bidi_it->invalid_rl_levels = -1;
+  bidi_it->stack_idx = 0;
+  bidi_it->resolved_level = bidi_it->level_stack[0].level;
+}
+
+/* Initialize the bidi iterator from buffer position CHARPOS.  */
+void
+bidi_init_it (EMACS_INT charpos, EMACS_INT bytepos, struct bidi_it *bidi_it)
+{
+  if (! bidi_initialized)
+    bidi_initialize ();
+  bidi_it->charpos = charpos;
+  bidi_it->bytepos = bytepos;
+  bidi_it->first_elt = 1;
+  bidi_set_paragraph_end (bidi_it);
+  bidi_it->new_paragraph = 1;
+  bidi_it->separator_limit = -1;
+  bidi_it->type = NEUTRAL_B;
+  bidi_it->type_after_w1 = NEUTRAL_B;
+  bidi_it->orig_type = NEUTRAL_B;
+  bidi_it->prev_was_pdf = 0;
+  bidi_it->prev.type = bidi_it->prev.type_after_w1 =
+    bidi_it->prev.orig_type = UNKNOWN_BT;
+  bidi_it->last_strong.type = bidi_it->last_strong.type_after_w1 =
+    bidi_it->last_strong.orig_type = UNKNOWN_BT;
+  bidi_it->next_for_neutral.charpos = -1;
+  bidi_it->next_for_neutral.type =
+    bidi_it->next_for_neutral.type_after_w1 =
+    bidi_it->next_for_neutral.orig_type = UNKNOWN_BT;
+  bidi_it->prev_for_neutral.charpos = -1;
+  bidi_it->prev_for_neutral.type =
+    bidi_it->prev_for_neutral.type_after_w1 =
+    bidi_it->prev_for_neutral.orig_type = UNKNOWN_BT;
+  bidi_it->sor = L2R;   /* FIXME: should it be user-selectable? */
+  bidi_cache_shrink ();
+}
+
+/* Push the current embedding level and override status; reset the
+   current level to LEVEL and the current override status to OVERRIDE.  */
+static INLINE void
+bidi_push_embedding_level (struct bidi_it *bidi_it,
+                          int level, bidi_dir_t override)
+{
+  bidi_it->stack_idx++;
+  if (bidi_it->stack_idx >= BIDI_MAXLEVEL)
+    abort ();
+  bidi_it->level_stack[bidi_it->stack_idx].level = level;
+  bidi_it->level_stack[bidi_it->stack_idx].override = override;
+}
+
+/* Pop the embedding level and directional override status from the
+   stack, and return the new level.  */
+static INLINE int
+bidi_pop_embedding_level (struct bidi_it *bidi_it)
+{
+  /* UAX#9 says to ignore invalid PDFs.  */
+  if (bidi_it->stack_idx > 0)
+    bidi_it->stack_idx--;
+  return bidi_it->level_stack[bidi_it->stack_idx].level;
+}
+
+/* Record in SAVED_INFO the information about the current character.  */
+static INLINE void
+bidi_remember_char (struct bidi_saved_info *saved_info,
+                   struct bidi_it *bidi_it)
+{
+  saved_info->charpos = bidi_it->charpos;
+  saved_info->bytepos = bidi_it->bytepos;
+  saved_info->type = bidi_it->type;
+  bidi_check_type (bidi_it->type);
+  saved_info->type_after_w1 = bidi_it->type_after_w1;
+  bidi_check_type (bidi_it->type_after_w1);
+  saved_info->orig_type = bidi_it->orig_type;
+  bidi_check_type (bidi_it->orig_type);
+}
+
+/* Resolve the type of a neutral character according to the type of
+   surrounding strong text and the current embedding level.  */
+static INLINE bidi_type_t
+bidi_resolve_neutral_1 (bidi_type_t prev_type, bidi_type_t next_type, int lev)
+{
+  /* N1: European and Arabic numbers are treated as though they were R.  */
+  if (next_type == WEAK_EN || next_type == WEAK_AN)
+    next_type = STRONG_R;
+  if (prev_type == WEAK_EN || prev_type == WEAK_AN)
+    prev_type = STRONG_R;
+
+  if (next_type == prev_type)  /* N1 */
+    return next_type;
+  else if ((lev & 1) == 0)     /* N2 */
+    return STRONG_L;
+  else
+    return STRONG_R;
+}
+
+static INLINE int
+bidi_explicit_dir_char (int c)
+{
+  /* FIXME: this should be replaced with a lookup table with suitable
+     bits set, like standard C ctype macros do.  */
+  return (c == LRE_CHAR || c == LRO_CHAR
+         || c == RLE_CHAR || c == RLO_CHAR || c == PDF_CHAR);
+}
+
+/* A helper function for bidi_resolve_explicit.  It advances to the
+   next character in logical order and determines the new embedding
+   level and directional override, but does not take into account
+   empty embeddings.  */
+static int
+bidi_resolve_explicit_1 (struct bidi_it *bidi_it)
+{
+  int curchar;
+  bidi_type_t type;
+  int current_level;
+  int new_level;
+  bidi_dir_t override;
+
+  if (bidi_it->bytepos < BEGV_BYTE     /* after reseat to BEGV? */
+      || bidi_it->first_elt)
+    {
+      bidi_it->first_elt = 0;
+      if (bidi_it->charpos < BEGV)
+       bidi_it->charpos = BEGV;
+      bidi_it->bytepos = CHAR_TO_BYTE (bidi_it->charpos);
+    }
+  else if (bidi_it->bytepos < ZV_BYTE) /* don't move at ZV */
+    {
+      bidi_it->charpos++;
+      if (bidi_it->ch_len == 0)
+       abort ();
+      bidi_it->bytepos += bidi_it->ch_len;
+    }
+
+  current_level = bidi_it->level_stack[bidi_it->stack_idx].level; /* X1 */
+  override = bidi_it->level_stack[bidi_it->stack_idx].override;
+  new_level = current_level;
+
+  /* in case it is a unibyte character (not yet implemented) */
+  /* _fetch_multibyte_char_len = 1; */
+  if (bidi_it->bytepos >= ZV_BYTE)
+    {
+      curchar = BIDI_EOB;
+      bidi_it->ch_len = 1;
+    }
+  else
+    {
+      curchar = FETCH_CHAR (bidi_it->bytepos);
+      bidi_it->ch_len = CHAR_BYTES (curchar);
+    }
+  bidi_it->ch = curchar;
+
+  /* Don't apply directional override here, as all the types we handle
+     below will not be affected by the override anyway, and we need
+     the original type unaltered.  The override will be applied in
+     bidi_resolve_weak.  */
+  type = bidi_get_type (curchar, NEUTRAL_DIR);
+  bidi_it->orig_type = type;
+  bidi_check_type (bidi_it->orig_type);
+
+  if (type != PDF)
+    bidi_it->prev_was_pdf = 0;
+
+  bidi_it->type_after_w1 = UNKNOWN_BT;
+
+  switch (type)
+    {
+      case RLE:        /* X2 */
+      case RLO:        /* X4 */
+       bidi_it->type_after_w1 = type;
+       bidi_check_type (bidi_it->type_after_w1);
+       type = WEAK_BN; /* X9/Retaining */
+       if (bidi_it->ignore_bn_limit <= 0)
+         {
+           if (current_level <= BIDI_MAXLEVEL - 4)
+             {
+               /* Compute the least odd embedding level greater than
+                  the current level.  */
+               new_level = ((current_level + 1) & ~1) + 1;
+               if (bidi_it->type_after_w1 == RLE)
+                 override = NEUTRAL_DIR;
+               else
+                 override = R2L;
+               if (current_level == BIDI_MAXLEVEL - 4)
+                 bidi_it->invalid_rl_levels = 0;
+               bidi_push_embedding_level (bidi_it, new_level, override);
+             }
+           else
+             {
+               bidi_it->invalid_levels++;
+               /* See the commentary about invalid_rl_levels below.  */
+               if (bidi_it->invalid_rl_levels < 0)
+                 bidi_it->invalid_rl_levels = 0;
+               bidi_it->invalid_rl_levels++;
+             }
+         }
+       else if (bidi_it->prev.type_after_w1 == WEAK_EN /* W5/Retaining */
+                || bidi_it->next_en_pos > bidi_it->charpos)
+         type = WEAK_EN;
+       break;
+      case LRE:        /* X3 */
+      case LRO:        /* X5 */
+       bidi_it->type_after_w1 = type;
+       bidi_check_type (bidi_it->type_after_w1);
+       type = WEAK_BN; /* X9/Retaining */
+       if (bidi_it->ignore_bn_limit <= 0)
+         {
+           if (current_level <= BIDI_MAXLEVEL - 5)
+             {
+               /* Compute the least even embedding level greater than
+                  the current level.  */
+               new_level = ((current_level + 2) & ~1);
+               if (bidi_it->type_after_w1 == LRE)
+                 override = NEUTRAL_DIR;
+               else
+                 override = L2R;
+               bidi_push_embedding_level (bidi_it, new_level, override);
+             }
+           else
+             {
+               bidi_it->invalid_levels++;
+               /* invalid_rl_levels counts invalid levels encountered
+                  while the embedding level was already too high for
+                  LRE/LRO, but not for RLE/RLO.  That is because
+                  there may be exactly one PDF which we should not
+                  ignore even though invalid_levels is non-zero.
+                  invalid_rl_levels helps to know what PDF is
+                  that.  */
+               if (bidi_it->invalid_rl_levels >= 0)
+                 bidi_it->invalid_rl_levels++;
+             }
+         }
+       else if (bidi_it->prev.type_after_w1 == WEAK_EN /* W5/Retaining */
+                || bidi_it->next_en_pos > bidi_it->charpos)
+         type = WEAK_EN;
+       break;
+      case PDF:        /* X7 */
+       bidi_it->type_after_w1 = type;
+       bidi_check_type (bidi_it->type_after_w1);
+       type = WEAK_BN; /* X9/Retaining */
+       if (bidi_it->ignore_bn_limit <= 0)
+         {
+           if (!bidi_it->invalid_rl_levels)
+             {
+               new_level = bidi_pop_embedding_level (bidi_it);
+               bidi_it->invalid_rl_levels = -1;
+               if (bidi_it->invalid_levels)
+                 bidi_it->invalid_levels--;
+               /* else nothing: UAX#9 says to ignore invalid PDFs */
+             }
+           if (!bidi_it->invalid_levels)
+             new_level = bidi_pop_embedding_level (bidi_it);
+           else
+             {
+               bidi_it->invalid_levels--;
+               bidi_it->invalid_rl_levels--;
+             }
+         }
+       else if (bidi_it->prev.type_after_w1 == WEAK_EN /* W5/Retaining */
+                || bidi_it->next_en_pos > bidi_it->charpos)
+         type = WEAK_EN;
+       break;
+      default:
+       /* Nothing.  */
+       break;
+    }
+
+  bidi_it->type = type;
+  bidi_check_type (bidi_it->type);
+
+  return new_level;
+}
+
+/* Given an iterator state in BIDI_IT, advance one character position
+   in the buffer to the next character (in the logical order), resolve
+   any explicit embeddings and directional overrides, and return the
+   embedding level of the character after resolving explicit
+   directives and ignoring empty embeddings.  */
+static int
+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);
+
+  if (prev_level < new_level
+      && bidi_it->type == WEAK_BN
+      && bidi_it->ignore_bn_limit == 0 /* only if not already known */
+      && bidi_it->bytepos < ZV_BYTE    /* not already at EOB */
+      && bidi_explicit_dir_char (FETCH_CHAR (bidi_it->bytepos
+                                            + bidi_it->ch_len)))
+    {
+      /* Avoid pushing and popping embedding levels if the level run
+        is empty, as this breaks level runs where it shouldn't.
+        UAX#9 removes all the explicit embedding and override codes,
+        so empty embeddings disappear without a trace.  We need to
+        behave as if we did the same.  */
+      struct bidi_it saved_it;
+      int level = prev_level;
+
+      bidi_copy_it (&saved_it, bidi_it);
+
+      while (bidi_explicit_dir_char (FETCH_CHAR (bidi_it->bytepos
+                                                + bidi_it->ch_len)))
+       {
+         level = bidi_resolve_explicit_1 (bidi_it);
+       }
+
+      if (level == prev_level) /* empty embedding */
+       saved_it.ignore_bn_limit = bidi_it->charpos + 1;
+      else                     /* this embedding is non-empty */
+       saved_it.ignore_bn_limit = -1;
+
+      bidi_copy_it (bidi_it, &saved_it);
+      if (bidi_it->ignore_bn_limit > 0)
+       {
+         /* We pushed a level, but we shouldn't have.  Undo that. */
+         if (!bidi_it->invalid_rl_levels)
+           {
+             new_level = bidi_pop_embedding_level (bidi_it);
+             bidi_it->invalid_rl_levels = -1;
+             if (bidi_it->invalid_levels)
+               bidi_it->invalid_levels--;
+           }
+         if (!bidi_it->invalid_levels)
+           new_level = bidi_pop_embedding_level (bidi_it);
+         else
+           {
+             bidi_it->invalid_levels--;
+             bidi_it->invalid_rl_levels--;
+           }
+       }
+    }
+
+  if (bidi_it->type == NEUTRAL_B)      /* X8 */
+    {
+      bidi_set_paragraph_end (bidi_it);
+      /* This is needed by bidi_resolve_weak below, and in L1.  */
+      bidi_it->type_after_w1 = bidi_it->type;
+      bidi_check_type (bidi_it->type_after_w1);
+    }
+
+  return new_level;
+}
+
+/* Advance in the buffer, resolve weak types and return the type of
+   the next character after weak type resolution.  */
+static bidi_type_t
+bidi_resolve_weak (struct bidi_it *bidi_it)
+{
+  bidi_type_t type;
+  bidi_dir_t override;
+  int prev_level = bidi_it->level_stack[bidi_it->stack_idx].level;
+  int new_level  = bidi_resolve_explicit (bidi_it);
+  int next_char;
+  bidi_type_t type_of_next;
+  struct bidi_it saved_it;
+
+  type = bidi_it->type;
+  override = bidi_it->level_stack[bidi_it->stack_idx].override;
+
+  if (type == UNKNOWN_BT
+      || type == LRE
+      || type == LRO
+      || type == RLE
+      || type == RLO
+      || type == PDF)
+    abort ();
+
+  if (new_level != prev_level
+      || bidi_it->type == NEUTRAL_B)
+    {
+      /* We've got a new embedding level run, compute the directional
+         type of sor and initialize per-run variables (UAX#9, clause
+         X10).  */
+      bidi_set_sor_type (bidi_it, prev_level, new_level);
+    }
+  else if (type == NEUTRAL_S || type == NEUTRAL_WS
+          || type == WEAK_BN || type == STRONG_AL)
+    bidi_it->type_after_w1 = type;     /* needed in L1 */
+  bidi_check_type (bidi_it->type_after_w1);
+
+  /* Level and directional override status are already recorded in
+     bidi_it, and do not need any change; see X6.  */
+  if (override == R2L)         /* X6 */
+    type = STRONG_R;
+  else if (override == L2R)
+    type = STRONG_L;
+  else
+    {
+      if (type == WEAK_NSM)    /* W1 */
+       {
+         /* Note that we don't need to consider the case where the
+            prev character has its type overridden by an RLO or LRO,
+            because then either the type of this NSM would have been
+            also overridden, or the previous character is outside the
+            current level run, and thus not relevant to this NSM.
+            This is why NSM gets the type_after_w1 of the previous
+            character.  */
+         if (bidi_it->prev.type_after_w1 != UNKNOWN_BT
+             /* if type_after_w1 is NEUTRAL_B, this NSM is at sor */
+             && bidi_it->prev.type_after_w1 != NEUTRAL_B)
+           type = bidi_it->prev.type_after_w1;
+         else if (bidi_it->sor == R2L)
+           type = STRONG_R;
+         else if (bidi_it->sor == L2R)
+           type = STRONG_L;
+         else /* shouldn't happen! */
+           abort ();
+       }
+      if (type == WEAK_EN      /* W2 */
+         && bidi_it->last_strong.type_after_w1 == STRONG_AL)
+       type = WEAK_AN;
+      else if (type == STRONG_AL) /* W3 */
+       type = STRONG_R;
+      else if ((type == WEAK_ES        /* W4 */
+               && bidi_it->prev.type_after_w1 == WEAK_EN
+               && bidi_it->prev.orig_type == WEAK_EN)
+              || (type == WEAK_CS
+                  && ((bidi_it->prev.type_after_w1 == WEAK_EN
+                       && bidi_it->prev.orig_type == WEAK_EN)
+                      || bidi_it->prev.type_after_w1 == WEAK_AN)))
+       {
+         next_char =
+           bidi_it->bytepos + bidi_it->ch_len >= ZV_BYTE
+           ? BIDI_EOB : FETCH_CHAR (bidi_it->bytepos + bidi_it->ch_len);
+         type_of_next = bidi_get_type (next_char, override);
+
+         if (type_of_next == WEAK_BN
+             || bidi_explicit_dir_char (next_char))
+           {
+             bidi_copy_it (&saved_it, bidi_it);
+             while (bidi_resolve_explicit (bidi_it) == new_level
+                    && bidi_it->type == WEAK_BN)
+               ;
+             type_of_next = bidi_it->type;
+             bidi_copy_it (bidi_it, &saved_it);
+           }
+
+         /* If the next character is EN, but the last strong-type
+            character is AL, that next EN will be changed to AN when
+            we process it in W2 above.  So in that case, this ES
+            should not be changed into EN.  */
+         if (type == WEAK_ES
+             && type_of_next == WEAK_EN
+             && bidi_it->last_strong.type_after_w1 != STRONG_AL)
+           type = WEAK_EN;
+         else if (type == WEAK_CS)
+           {
+             if (bidi_it->prev.type_after_w1 == WEAK_AN
+                 && (type_of_next == WEAK_AN
+                     /* If the next character is EN, but the last
+                        strong-type character is AL, EN will be later
+                        changed to AN when we process it in W2 above.
+                        So in that case, this ES should not be
+                        changed into EN.  */
+                     || (type_of_next == WEAK_EN
+                         && bidi_it->last_strong.type_after_w1 == STRONG_AL)))
+               type = WEAK_AN;
+             else if (bidi_it->prev.type_after_w1 == WEAK_EN
+                      && type_of_next == WEAK_EN
+                      && bidi_it->last_strong.type_after_w1 != STRONG_AL)
+               type = WEAK_EN;
+           }
+       }
+      else if (type == WEAK_ET /* W5: ET with EN before or after it */
+              || type == WEAK_BN)      /* W5/Retaining */
+       {
+         if (bidi_it->prev.type_after_w1 == WEAK_EN /* ET/BN w/EN before it */
+             || bidi_it->next_en_pos > bidi_it->charpos)
+           type = WEAK_EN;
+         else                  /* W5: ET/BN with EN after it.  */
+           {
+             EMACS_INT en_pos = bidi_it->charpos + 1;
+
+             next_char =
+               bidi_it->bytepos + bidi_it->ch_len >= ZV_BYTE
+               ? BIDI_EOB : FETCH_CHAR (bidi_it->bytepos + bidi_it->ch_len);
+             type_of_next = bidi_get_type (next_char, override);
+
+             if (type_of_next == WEAK_ET
+                 || type_of_next == WEAK_BN
+                 || bidi_explicit_dir_char (next_char))
+               {
+                 bidi_copy_it (&saved_it, bidi_it);
+                 while (bidi_resolve_explicit (bidi_it) == new_level
+                        && (bidi_it->type == WEAK_BN
+                            || bidi_it->type == WEAK_ET))
+                   ;
+                 type_of_next = bidi_it->type;
+                 en_pos = bidi_it->charpos;
+                 bidi_copy_it (bidi_it, &saved_it);
+               }
+             if (type_of_next == WEAK_EN)
+               {
+                 /* If the last strong character is AL, the EN we've
+                    found will become AN when we get to it (W2). */
+                 if (bidi_it->last_strong.type_after_w1 != STRONG_AL)
+                   {
+                     type = WEAK_EN;
+                     /* Remember this EN position, to speed up processing
+                        of the next ETs.  */
+                     bidi_it->next_en_pos = en_pos;
+                   }
+                 else if (type == WEAK_BN)
+                   type = NEUTRAL_ON; /* W6/Retaining */
+               }
+           }
+       }
+    }
+
+  if (type == WEAK_ES || type == WEAK_ET || type == WEAK_CS /* W6 */
+      || (type == WEAK_BN
+         && (bidi_it->prev.type_after_w1 == WEAK_CS        /* W6/Retaining */
+             || bidi_it->prev.type_after_w1 == WEAK_ES
+             || bidi_it->prev.type_after_w1 == WEAK_ET)))
+    type = NEUTRAL_ON;
+
+  /* Store the type we've got so far, before we clobber it with strong
+     types in W7 and while resolving neutral types.  But leave alone
+     the original types that were recorded above, because we will need
+     them for the L1 clause.  */
+  if (bidi_it->type_after_w1 == UNKNOWN_BT)
+    bidi_it->type_after_w1 = type;
+  bidi_check_type (bidi_it->type_after_w1);
+
+  if (type == WEAK_EN) /* W7 */
+    {
+      if ((bidi_it->last_strong.type_after_w1 == STRONG_L)
+         || (bidi_it->last_strong.type == UNKNOWN_BT && bidi_it->sor == L2R))
+       type = STRONG_L;
+    }
+
+  bidi_it->type = type;
+  bidi_check_type (bidi_it->type);
+  return type;
+}
+
+static bidi_type_t
+bidi_resolve_neutral (struct bidi_it *bidi_it)
+{
+  int prev_level = bidi_it->level_stack[bidi_it->stack_idx].level;
+  bidi_type_t type = bidi_resolve_weak (bidi_it);
+  int current_level = bidi_it->level_stack[bidi_it->stack_idx].level;
+
+  if (!(type == STRONG_R
+       || type == STRONG_L
+       || type == WEAK_BN
+       || type == WEAK_EN
+       || type == WEAK_AN
+       || type == NEUTRAL_B
+       || type == NEUTRAL_S
+       || type == NEUTRAL_WS
+       || type == NEUTRAL_ON))
+    abort ();
+
+  if (bidi_get_category (type) == NEUTRAL
+      || (type == WEAK_BN && prev_level == current_level))
+    {
+      if (bidi_it->next_for_neutral.type != UNKNOWN_BT)
+       type = bidi_resolve_neutral_1 (bidi_it->prev_for_neutral.type,
+                                      bidi_it->next_for_neutral.type,
+                                      current_level);
+      else
+       {
+         /* Arrrgh!!  The UAX#9 algorithm is too deeply entrenched in
+            the assumption of batch-style processing; see clauses W4,
+            W5, and especially N1, which require to look far forward
+            (as well as back) in the buffer.  May the fleas of a
+            thousand camels infest the armpits of those who design
+            supposedly general-purpose algorithms by looking at their
+            own implementations, and fail to consider other possible
+            implementations!  */
+         struct bidi_it saved_it;
+         bidi_type_t next_type;
+
+         if (bidi_it->scan_dir == -1)
+           abort ();
+
+         bidi_copy_it (&saved_it, bidi_it);
+         /* Scan the text forward until we find the first non-neutral
+            character, and then use that to resolve the neutral we
+            are dealing with now.  We also cache the scanned iterator
+            states, to salvage some of the effort later.  */
+         bidi_cache_iterator_state (bidi_it, 0);
+         do {
+           /* Record the info about the previous character, so that
+              it will be cached below with this state.  */
+           if (bidi_it->type_after_w1 != WEAK_BN /* W1/Retaining */
+               && bidi_it->type != WEAK_BN)
+             bidi_remember_char (&bidi_it->prev, bidi_it);
+           type = bidi_resolve_weak (bidi_it);
+           /* Paragraph separators have their levels fully resolved
+              at this point, so cache them as resolved.  */
+           bidi_cache_iterator_state (bidi_it, type == NEUTRAL_B);
+           /* FIXME: implement L1 here, by testing for a newline and
+              resetting the level for any sequence of whitespace
+              characters adjacent to it.  */
+         } while (!(type == NEUTRAL_B
+                    || (type != WEAK_BN
+                        && bidi_get_category (type) != NEUTRAL)
+                    /* This is all per level run, so stop when we
+                       reach the end of this level run.  */
+                    || bidi_it->level_stack[bidi_it->stack_idx].level !=
+                    current_level));
+
+         bidi_remember_char (&saved_it.next_for_neutral, bidi_it);
+
+         switch (type)
+           {
+             case STRONG_L:
+             case STRONG_R:
+             case STRONG_AL:
+               next_type = type;
+               break;
+             case WEAK_EN:
+             case WEAK_AN:
+               /* N1: ``European and Arabic numbers are treated as
+                  though they were R.''  */
+               next_type = STRONG_R;
+               saved_it.next_for_neutral.type = STRONG_R;
+               break;
+             case WEAK_BN:
+               if (!bidi_explicit_dir_char (bidi_it->ch))
+                 abort ();             /* can't happen: BNs are skipped */
+               /* FALLTHROUGH */
+             case NEUTRAL_B:
+               /* Marched all the way to the end of this level run.
+                  We need to use the eor type, whose information is
+                  stored by bidi_set_sor_type in the prev_for_neutral
+                  member.  */
+               if (saved_it.type != WEAK_BN
+                   || bidi_get_category (bidi_it->prev.type_after_w1) == NEUTRAL)
+                 {
+                   next_type = bidi_it->prev_for_neutral.type;
+                   saved_it.next_for_neutral.type = next_type;
+                   bidi_check_type (next_type);
+                 }
+               else
+                 {
+                   /* This is a BN which does not adjoin neutrals.
+                      Leave its type alone.  */
+                   bidi_copy_it (bidi_it, &saved_it);
+                   return bidi_it->type;
+                 }
+               break;
+             default:
+               abort ();
+           }
+         type = bidi_resolve_neutral_1 (saved_it.prev_for_neutral.type,
+                                        next_type, current_level);
+         saved_it.type = type;
+         bidi_check_type (type);
+         bidi_copy_it (bidi_it, &saved_it);
+       }
+    }
+  return type;
+}
+
+/* Given an iterator state in BIDI_IT, advance one character position
+   in the buffer to the next character (in the logical order), resolve
+   the bidi type of that next character, and return that type.  */
+static bidi_type_t
+bidi_type_of_next_char (struct bidi_it *bidi_it)
+{
+  bidi_type_t type;
+
+  /* This should always be called during a forward scan.  */
+  if (bidi_it->scan_dir != 1)
+    abort ();
+
+  /* Reset the limit until which to ignore BNs if we step out of the
+     area where we found only empty levels.  */
+  if ((bidi_it->ignore_bn_limit > 0
+       && bidi_it->ignore_bn_limit <= bidi_it->charpos)
+      || (bidi_it->ignore_bn_limit == -1
+         && !bidi_explicit_dir_char (bidi_it->ch)))
+    bidi_it->ignore_bn_limit = 0;
+
+  type = bidi_resolve_neutral (bidi_it);
+
+  return type;
+}
+
+/* Given an iterator state BIDI_IT, advance one character position in
+   the buffer to the next character (in the logical order), resolve
+   the embedding and implicit levels of that next character, and
+   return the resulting level.  */
+static int
+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;
+
+  if (bidi_it->scan_dir == 1)
+    {
+      /* There's no sense in trying to advance if we hit end of text.  */
+      if (bidi_it->bytepos >= ZV_BYTE)
+       return bidi_it->resolved_level;
+
+      /* Record the info about the previous character.  */
+      if (bidi_it->type_after_w1 != WEAK_BN /* W1/Retaining */
+         && bidi_it->type != WEAK_BN)
+       bidi_remember_char (&bidi_it->prev, bidi_it);
+      if (bidi_it->type_after_w1 == STRONG_R
+         || bidi_it->type_after_w1 == STRONG_L
+         || bidi_it->type_after_w1 == STRONG_AL)
+       bidi_remember_char (&bidi_it->last_strong, bidi_it);
+      /* FIXME: it sounds like we don't need both prev and
+        prev_for_neutral members, but I'm leaving them both for now.  */
+      if (bidi_it->type == STRONG_R || bidi_it->type == STRONG_L
+         || bidi_it->type == WEAK_EN || bidi_it->type == WEAK_AN)
+       bidi_remember_char (&bidi_it->prev_for_neutral, bidi_it);
+
+      /* If we overstepped the characters used for resolving neutrals
+        and whitespace, invalidate their info in the iterator.  */
+      if (bidi_it->charpos >= bidi_it->next_for_neutral.charpos)
+       bidi_it->next_for_neutral.type = UNKNOWN_BT;
+      if (bidi_it->next_en_pos >= 0
+         && bidi_it->charpos >= bidi_it->next_en_pos)
+       bidi_it->next_en_pos = -1;
+      if (bidi_it->next_for_ws.type != UNKNOWN_BT
+         && bidi_it->charpos >= bidi_it->next_for_ws.charpos)
+       bidi_it->next_for_ws.type = UNKNOWN_BT;
+
+      /* This must be taken before we fill the iterator with the info
+        about the next char.  If we scan backwards, the iterator
+        state must be already cached, so there's no need to know the
+        embedding level of the previous character, since we will be
+        returning to our caller shortly.  */
+      prev_level = bidi_it->level_stack[bidi_it->stack_idx].level;
+    }
+  next_for_neutral = bidi_it->next_for_neutral;
+
+  /* Perhaps it is already cached.  */
+  type = bidi_cache_find (bidi_it->charpos + bidi_it->scan_dir, -1, bidi_it);
+  if (type != UNKNOWN_BT)
+    {
+      /* Don't lose the information for resolving neutrals!  The
+        cached states could have been cached before their
+        next_for_neutral member was computed.  If we are on our way
+        forward, we can simply take the info from the previous
+        state.  */
+      if (bidi_it->scan_dir == 1
+         && bidi_it->next_for_neutral.type == UNKNOWN_BT)
+       bidi_it->next_for_neutral = next_for_neutral;
+
+      /* If resolved_level is -1, it means this state was cached
+        before it was completely resolved, so we cannot return
+        it.  */
+      if (bidi_it->resolved_level != -1)
+       return bidi_it->resolved_level;
+    }
+  if (bidi_it->scan_dir == -1)
+    /* If we are going backwards, the iterator state is already cached
+       from previous scans, and should be fully resolved.  */
+    abort ();
+
+  if (type == UNKNOWN_BT)
+    type = bidi_type_of_next_char (bidi_it);
+
+  if (type == NEUTRAL_B)
+    return bidi_it->resolved_level;
+
+  level = bidi_it->level_stack[bidi_it->stack_idx].level;
+  if ((bidi_get_category (type) == NEUTRAL /* && type != NEUTRAL_B */)
+      || (type == WEAK_BN && prev_level == level))
+    {
+      if (bidi_it->next_for_neutral.type == UNKNOWN_BT)
+       abort ();
+
+      /* If the cached state shows a neutral character, it was not
+        resolved by bidi_resolve_neutral, so do it now.  */
+      type = bidi_resolve_neutral_1 (bidi_it->prev_for_neutral.type,
+                                    bidi_it->next_for_neutral.type,
+                                    level);
+    }
+
+  if (!(type == STRONG_R
+       || type == STRONG_L
+       || type == WEAK_BN
+       || type == WEAK_EN
+       || type == WEAK_AN))
+    abort ();
+  bidi_it->type = type;
+  bidi_check_type (bidi_it->type);
+
+  /* For L1 below, we need to know, for each WS character, whether
+     it belongs to a sequence of WS characters preceeding a newline
+     or a TAB or a paragraph separator.  */
+  if (bidi_it->orig_type == NEUTRAL_WS
+      && bidi_it->next_for_ws.type == UNKNOWN_BT)
+    {
+      int ch;
+      int clen = bidi_it->ch_len;
+      EMACS_INT bpos = bidi_it->bytepos;
+      EMACS_INT cpos = bidi_it->charpos;
+      bidi_type_t chtype;
+
+      do {
+       /*_fetch_multibyte_char_len = 1;*/
+       ch = bpos + clen >= ZV_BYTE ? BIDI_EOB : FETCH_CHAR (bpos + clen);
+       bpos += clen;
+       cpos++;
+       clen = (ch == BIDI_EOB ? 1 : CHAR_BYTES (ch));
+       if (ch == '\n' || ch == BIDI_EOB /* || ch == LINESEP_CHAR */)
+         chtype = NEUTRAL_B;
+       else
+         chtype = bidi_get_type (ch, NEUTRAL_DIR);
+      } while (chtype == NEUTRAL_WS || chtype == WEAK_BN
+              || bidi_explicit_dir_char (ch)); /* L1/Retaining */
+      bidi_it->next_for_ws.type = chtype;
+      bidi_check_type (bidi_it->next_for_ws.type);
+      bidi_it->next_for_ws.charpos = cpos;
+      bidi_it->next_for_ws.bytepos = bpos;
+    }
+
+  /* Resolve implicit levels, with a twist: PDFs get the embedding
+     level of the enbedding they terminate.  See below for the
+     reason.  */
+  if (bidi_it->orig_type == PDF
+      /* Don't do this if this formatting code didn't change the
+        embedding level due to invalid or empty embeddings.  */
+      && prev_level != level)
+    {
+      /* Don't look in UAX#9 for the reason for this: it's our own
+        private quirk.  The reason is that we want the formatting
+        codes to be delivered so that they bracket the text of their
+        embedding.  For example, given the text
+
+            {RLO}teST{PDF}
+
+        we want it to be displayed as
+
+            {PDF}STet{RLO}
+
+        not as
+
+            STet{RLO}{PDF}
+
+        which will result because we bump up the embedding level as
+        soon as we see the RLO and pop it as soon as we see the PDF,
+        so RLO itself has the same embedding level as "teST", and
+        thus would be normally delivered last, just before the PDF.
+        The switch below fiddles with the level of PDF so that this
+        ugly side effect does not happen.
+
+        (This is, of course, only important if the formatting codes
+        are actually displayed, but Emacs does need to display them
+        if the user wants to.)  */
+      level = prev_level;
+    }
+  else if (bidi_it->orig_type == NEUTRAL_B /* L1 */
+          || bidi_it->orig_type == NEUTRAL_S
+          || bidi_it->ch == '\n' || bidi_it->ch == BIDI_EOB
+          /* || bidi_it->ch == LINESEP_CHAR */
+          || (bidi_it->orig_type == NEUTRAL_WS
+              && (bidi_it->next_for_ws.type == NEUTRAL_B
+                  || bidi_it->next_for_ws.type == NEUTRAL_S)))
+    level = bidi_it->level_stack[0].level;
+  else if ((level & 1) == 0) /* I1 */
+    {
+      if (type == STRONG_R)
+       level++;
+      else if (type == WEAK_EN || type == WEAK_AN)
+       level += 2;
+    }
+  else                 /* I2 */
+    {
+      if (type == STRONG_L || type == WEAK_EN || type == WEAK_AN)
+       level++;
+    }
+
+  bidi_it->resolved_level = level;
+  return level;
+}
+
+/* Move to the other edge of a level given by LEVEL.  If END_FLAG is
+   non-zero, we are at the end of a level, and we need to prepare to
+   resume the scan of the lower level.
+
+   If this level's other edge is cached, we simply jump to it, filling
+   the iterator structure with the iterator state on the other edge.
+   Otherwise, we walk the buffer until we come back to the same level
+   as LEVEL.
+
+   Note: we are not talking here about a ``level run'' in the UAX#9
+   sense of the term, but rather about a ``level'' which includes
+   all the levels higher than it.  In other words, given the levels
+   like this:
+
+         11111112222222333333334443343222222111111112223322111
+                A      B                    C
+
+   and assuming we are at point A scanning left to right, this
+   function moves to point C, whereas the UAX#9 ``level 2 run'' ends
+   at point B.  */
+static void
+bidi_find_other_level_edge (struct bidi_it *bidi_it, int level, int end_flag)
+{
+  int dir = end_flag ? -bidi_it->scan_dir : bidi_it->scan_dir;
+  int idx;
+
+  /* Try the cache first.  */
+  if ((idx = bidi_cache_find_level_change (level, dir, end_flag)) >= 0)
+    bidi_cache_fetch_state (idx, bidi_it);
+  else
+    {
+      int new_level;
+
+      if (end_flag)
+       abort (); /* if we are at end of level, its edges must be cached */
+
+      bidi_cache_iterator_state (bidi_it, 1);
+      do {
+       new_level = bidi_level_of_next_char (bidi_it);
+       bidi_cache_iterator_state (bidi_it, 1);
+      } while (new_level >= level);
+    }
+}
+
+void
+bidi_move_to_visually_next (struct bidi_it *bidi_it)
+{
+  int old_level, new_level, next_level;
+  struct bidi_it sentinel;
+
+  if (bidi_it->scan_dir == 0)
+    {
+      bidi_it->scan_dir = 1;   /* default to logical order */
+    }
+
+  /* If we just passed a newline, initialize for the next line.  */
+  if (!bidi_it->first_elt && bidi_it->orig_type == NEUTRAL_B)
+    bidi_line_init (bidi_it);
+
+  /* Prepare the sentinel iterator state, and cache it.  When we bump
+     into it, scanning backwards, we'll know that the last non-base
+     level is exhausted.  */
+  if (bidi_cache_idx == 0)
+    {
+      bidi_copy_it (&sentinel, bidi_it);
+      if (bidi_it->first_elt)
+       {
+         sentinel.charpos--;   /* cached charpos needs to be monotonic */
+         sentinel.bytepos--;
+         sentinel.ch = '\n';   /* doesn't matter, but why not? */
+         sentinel.ch_len = 1;
+       }
+      bidi_cache_iterator_state (&sentinel, 1);
+    }
+
+  old_level = bidi_it->resolved_level;
+  new_level = bidi_level_of_next_char (bidi_it);
+
+  /* Reordering of resolved levels (clause L2) is implemented by
+     jumping to the other edge of the level and flipping direction of
+     scanning the text whenever we find a level change.  */
+  if (new_level != old_level)
+    {
+      int ascending = new_level > old_level;
+      int level_to_search = ascending ? old_level + 1 : old_level;
+      int incr = ascending ? 1 : -1;
+      int expected_next_level = old_level + incr;
+
+      /* Jump (or walk) to the other edge of this level.  */
+      bidi_find_other_level_edge (bidi_it, level_to_search, !ascending);
+      /* Switch scan direction and peek at the next character in the
+        new direction.  */
+      bidi_it->scan_dir = -bidi_it->scan_dir;
+
+      /* The following loop handles the case where the resolved level
+        jumps by more than one.  This is typical for numbers inside a
+        run of text with left-to-right embedding direction, but can
+        also happen in other situations.  In those cases the decision
+        where to continue after a level change, and in what direction,
+        is tricky.  For example, given a text like below:
+
+                 abcdefgh
+                 11336622
+
+        (where the numbers below the text show the resolved levels),
+        the result of reordering according to UAX#9 should be this:
+
+                 efdcghba
+
+        This is implemented by the loop below which flips direction
+        and jumps to the other edge of the level each time it finds
+        the new level not to be the expected one.  The expected level
+        is always one more or one less than the previous one.  */
+      next_level = bidi_peek_at_next_level (bidi_it);
+      while (next_level != expected_next_level)
+       {
+         expected_next_level += incr;
+         level_to_search += incr;
+         bidi_find_other_level_edge (bidi_it, level_to_search, !ascending);
+         bidi_it->scan_dir = -bidi_it->scan_dir;
+         next_level = bidi_peek_at_next_level (bidi_it);
+       }
+
+      /* Finally, deliver the next character in the new direction.  */
+      next_level = bidi_level_of_next_char (bidi_it);
+    }
+
+  /* Take note when we have just processed the newline that precedes
+     the end of the paragraph.  The next time we are about to be
+     called, set_iterator_to_next will automatically reinit the
+     paragraph direction, if needed.  We do this at the newline before
+     the paragraph separator, because the next character might not be
+     the first character of the next paragraph, due to the bidi
+     reordering, whereas we _must_ know the paragraph base direction
+     _before_ we process the paragraph's text, since the base
+     direction affects the reordering.  */
+  if (bidi_it->scan_dir == 1
+      && bidi_it->orig_type == NEUTRAL_B
+      && bidi_it->bytepos < ZV_BYTE)
+    {
+      EMACS_INT sep_len =
+       bidi_at_paragraph_end (bidi_it->charpos + 1,
+                              bidi_it->bytepos + bidi_it->ch_len);
+      if (sep_len >= 0)
+       {
+         bidi_it->new_paragraph = 1;
+         /* Record the buffer position of the last character of the
+            paragraph separator.  */
+         bidi_it->separator_limit = bidi_it->charpos + 1 + sep_len;
+       }
+    }
+
+  if (bidi_it->scan_dir == 1 && bidi_cache_idx)
+    {
+      /* If we are at paragraph's base embedding level and beyond the
+        last cached position, the cache's job is done and we can
+        discard it.  */
+      if (bidi_it->resolved_level == bidi_it->level_stack[0].level
+         && bidi_it->charpos > bidi_cache[bidi_cache_idx - 1].charpos)
+       bidi_cache_reset ();
+       /* But as long as we are caching during forward scan, we must
+          cache each state, or else the cache integrity will be
+          compromised: it assumes cached states correspond to buffer
+          positions 1:1.  */
+      else
+       bidi_cache_iterator_state (bidi_it, 1);
+    }
+}
+
+/* This is meant to be called from within the debugger, whenever you
+   wish to examine the cache contents.  */
+void
+bidi_dump_cached_states (void)
+{
+  int i;
+  int ndigits = 1;
+
+  if (bidi_cache_idx == 0)
+    {
+      fprintf (stderr, "The cache is empty.\n");
+      return;
+    }
+  fprintf (stderr, "Total of %d state%s in cache:\n",
+          bidi_cache_idx, bidi_cache_idx == 1 ? "" : "s");
+
+  for (i = bidi_cache[bidi_cache_idx - 1].charpos; i > 0; i /= 10)
+    ndigits++;
+  fputs ("ch  ", stderr);
+  for (i = 0; i < bidi_cache_idx; i++)
+    fprintf (stderr, "%*c", ndigits, bidi_cache[i].ch);
+  fputs ("\n", stderr);
+  fputs ("lvl ", stderr);
+  for (i = 0; i < bidi_cache_idx; i++)
+    fprintf (stderr, "%*d", ndigits, bidi_cache[i].resolved_level);
+  fputs ("\n", stderr);
+  fputs ("pos ", stderr);
+  for (i = 0; i < bidi_cache_idx; i++)
+    fprintf (stderr, "%*ld", ndigits, (long)bidi_cache[i].charpos);
+  fputs ("\n", stderr);
+}
diff --git a/src/bidimirror.h b/src/bidimirror.h
new file mode 100644 (file)
index 0000000..477f983
--- /dev/null
@@ -0,0 +1,365 @@
+  struct {
+    int from, to;
+  } bidi_mirror[] = {
+       { 0x0028, 0x0029 },
+       { 0x0029, 0x0028 },
+       { 0x003C, 0x003E },
+       { 0x003E, 0x003C },
+       { 0x005B, 0x005D },
+       { 0x005D, 0x005B },
+       { 0x007B, 0x007D },
+       { 0x007D, 0x007B },
+       { 0x00AB, 0x00BB },
+       { 0x00BB, 0x00AB },
+       { 0x0F3A, 0x0F3B },
+       { 0x0F3B, 0x0F3A },
+       { 0x0F3C, 0x0F3D },
+       { 0x0F3D, 0x0F3C },
+       { 0x169B, 0x169C },
+       { 0x169C, 0x169B },
+       { 0x2039, 0x203A },
+       { 0x203A, 0x2039 },
+       { 0x2045, 0x2046 },
+       { 0x2046, 0x2045 },
+       { 0x207D, 0x207E },
+       { 0x207E, 0x207D },
+       { 0x208D, 0x208E },
+       { 0x208E, 0x208D },
+       { 0x2208, 0x220B },
+       { 0x2209, 0x220C },
+       { 0x220A, 0x220D },
+       { 0x220B, 0x2208 },
+       { 0x220C, 0x2209 },
+       { 0x220D, 0x220A },
+       { 0x2215, 0x29F5 },
+       { 0x223C, 0x223D },
+       { 0x223D, 0x223C },
+       { 0x2243, 0x22CD },
+       { 0x2252, 0x2253 },
+       { 0x2253, 0x2252 },
+       { 0x2254, 0x2255 },
+       { 0x2255, 0x2254 },
+       { 0x2264, 0x2265 },
+       { 0x2265, 0x2264 },
+       { 0x2266, 0x2267 },
+       { 0x2267, 0x2266 },
+       { 0x2268, 0x2269 },
+       { 0x2269, 0x2268 },
+       { 0x226A, 0x226B },
+       { 0x226B, 0x226A },
+       { 0x226E, 0x226F },
+       { 0x226F, 0x226E },
+       { 0x2270, 0x2271 },
+       { 0x2271, 0x2270 },
+       { 0x2272, 0x2273 },
+       { 0x2273, 0x2272 },
+       { 0x2274, 0x2275 },
+       { 0x2275, 0x2274 },
+       { 0x2276, 0x2277 },
+       { 0x2277, 0x2276 },
+       { 0x2278, 0x2279 },
+       { 0x2279, 0x2278 },
+       { 0x227A, 0x227B },
+       { 0x227B, 0x227A },
+       { 0x227C, 0x227D },
+       { 0x227D, 0x227C },
+       { 0x227E, 0x227F },
+       { 0x227F, 0x227E },
+       { 0x2280, 0x2281 },
+       { 0x2281, 0x2280 },
+       { 0x2282, 0x2283 },
+       { 0x2283, 0x2282 },
+       { 0x2284, 0x2285 },
+       { 0x2285, 0x2284 },
+       { 0x2286, 0x2287 },
+       { 0x2287, 0x2286 },
+       { 0x2288, 0x2289 },
+       { 0x2289, 0x2288 },
+       { 0x228A, 0x228B },
+       { 0x228B, 0x228A },
+       { 0x228F, 0x2290 },
+       { 0x2290, 0x228F },
+       { 0x2291, 0x2292 },
+       { 0x2292, 0x2291 },
+       { 0x2298, 0x29B8 },
+       { 0x22A2, 0x22A3 },
+       { 0x22A3, 0x22A2 },
+       { 0x22A6, 0x2ADE },
+       { 0x22A8, 0x2AE4 },
+       { 0x22A9, 0x2AE3 },
+       { 0x22AB, 0x2AE5 },
+       { 0x22B0, 0x22B1 },
+       { 0x22B1, 0x22B0 },
+       { 0x22B2, 0x22B3 },
+       { 0x22B3, 0x22B2 },
+       { 0x22B4, 0x22B5 },
+       { 0x22B5, 0x22B4 },
+       { 0x22B6, 0x22B7 },
+       { 0x22B7, 0x22B6 },
+       { 0x22C9, 0x22CA },
+       { 0x22CA, 0x22C9 },
+       { 0x22CB, 0x22CC },
+       { 0x22CC, 0x22CB },
+       { 0x22CD, 0x2243 },
+       { 0x22D0, 0x22D1 },
+       { 0x22D1, 0x22D0 },
+       { 0x22D6, 0x22D7 },
+       { 0x22D7, 0x22D6 },
+       { 0x22D8, 0x22D9 },
+       { 0x22D9, 0x22D8 },
+       { 0x22DA, 0x22DB },
+       { 0x22DB, 0x22DA },
+       { 0x22DC, 0x22DD },
+       { 0x22DD, 0x22DC },
+       { 0x22DE, 0x22DF },
+       { 0x22DF, 0x22DE },
+       { 0x22E0, 0x22E1 },
+       { 0x22E1, 0x22E0 },
+       { 0x22E2, 0x22E3 },
+       { 0x22E3, 0x22E2 },
+       { 0x22E4, 0x22E5 },
+       { 0x22E5, 0x22E4 },
+       { 0x22E6, 0x22E7 },
+       { 0x22E7, 0x22E6 },
+       { 0x22E8, 0x22E9 },
+       { 0x22E9, 0x22E8 },
+       { 0x22EA, 0x22EB },
+       { 0x22EB, 0x22EA },
+       { 0x22EC, 0x22ED },
+       { 0x22ED, 0x22EC },
+       { 0x22F0, 0x22F1 },
+       { 0x22F1, 0x22F0 },
+       { 0x22F2, 0x22FA },
+       { 0x22F3, 0x22FB },
+       { 0x22F4, 0x22FC },
+       { 0x22F6, 0x22FD },
+       { 0x22F7, 0x22FE },
+       { 0x22FA, 0x22F2 },
+       { 0x22FB, 0x22F3 },
+       { 0x22FC, 0x22F4 },
+       { 0x22FD, 0x22F6 },
+       { 0x22FE, 0x22F7 },
+       { 0x2308, 0x2309 },
+       { 0x2309, 0x2308 },
+       { 0x230A, 0x230B },
+       { 0x230B, 0x230A },
+       { 0x2329, 0x232A },
+       { 0x232A, 0x2329 },
+       { 0x2768, 0x2769 },
+       { 0x2769, 0x2768 },
+       { 0x276A, 0x276B },
+       { 0x276B, 0x276A },
+       { 0x276C, 0x276D },
+       { 0x276D, 0x276C },
+       { 0x276E, 0x276F },
+       { 0x276F, 0x276E },
+       { 0x2770, 0x2771 },
+       { 0x2771, 0x2770 },
+       { 0x2772, 0x2773 },
+       { 0x2773, 0x2772 },
+       { 0x2774, 0x2775 },
+       { 0x2775, 0x2774 },
+       { 0x27C3, 0x27C4 },
+       { 0x27C4, 0x27C3 },
+       { 0x27C5, 0x27C6 },
+       { 0x27C6, 0x27C5 },
+       { 0x27C8, 0x27C9 },
+       { 0x27C9, 0x27C8 },
+       { 0x27D5, 0x27D6 },
+       { 0x27D6, 0x27D5 },
+       { 0x27DD, 0x27DE },
+       { 0x27DE, 0x27DD },
+       { 0x27E2, 0x27E3 },
+       { 0x27E3, 0x27E2 },
+       { 0x27E4, 0x27E5 },
+       { 0x27E5, 0x27E4 },
+       { 0x27E6, 0x27E7 },
+       { 0x27E7, 0x27E6 },
+       { 0x27E8, 0x27E9 },
+       { 0x27E9, 0x27E8 },
+       { 0x27EA, 0x27EB },
+       { 0x27EB, 0x27EA },
+       { 0x27EC, 0x27ED },
+       { 0x27ED, 0x27EC },
+       { 0x27EE, 0x27EF },
+       { 0x27EF, 0x27EE },
+       { 0x2983, 0x2984 },
+       { 0x2984, 0x2983 },
+       { 0x2985, 0x2986 },
+       { 0x2986, 0x2985 },
+       { 0x2987, 0x2988 },
+       { 0x2988, 0x2987 },
+       { 0x2989, 0x298A },
+       { 0x298A, 0x2989 },
+       { 0x298B, 0x298C },
+       { 0x298C, 0x298B },
+       { 0x298D, 0x2990 },
+       { 0x298E, 0x298F },
+       { 0x298F, 0x298E },
+       { 0x2990, 0x298D },
+       { 0x2991, 0x2992 },
+       { 0x2992, 0x2991 },
+       { 0x2993, 0x2994 },
+       { 0x2994, 0x2993 },
+       { 0x2995, 0x2996 },
+       { 0x2996, 0x2995 },
+       { 0x2997, 0x2998 },
+       { 0x2998, 0x2997 },
+       { 0x29B8, 0x2298 },
+       { 0x29C0, 0x29C1 },
+       { 0x29C1, 0x29C0 },
+       { 0x29C4, 0x29C5 },
+       { 0x29C5, 0x29C4 },
+       { 0x29CF, 0x29D0 },
+       { 0x29D0, 0x29CF },
+       { 0x29D1, 0x29D2 },
+       { 0x29D2, 0x29D1 },
+       { 0x29D4, 0x29D5 },
+       { 0x29D5, 0x29D4 },
+       { 0x29D8, 0x29D9 },
+       { 0x29D9, 0x29D8 },
+       { 0x29DA, 0x29DB },
+       { 0x29DB, 0x29DA },
+       { 0x29F5, 0x2215 },
+       { 0x29F8, 0x29F9 },
+       { 0x29F9, 0x29F8 },
+       { 0x29FC, 0x29FD },
+       { 0x29FD, 0x29FC },
+       { 0x2A2B, 0x2A2C },
+       { 0x2A2C, 0x2A2B },
+       { 0x2A2D, 0x2A2E },
+       { 0x2A2E, 0x2A2D },
+       { 0x2A34, 0x2A35 },
+       { 0x2A35, 0x2A34 },
+       { 0x2A3C, 0x2A3D },
+       { 0x2A3D, 0x2A3C },
+       { 0x2A64, 0x2A65 },
+       { 0x2A65, 0x2A64 },
+       { 0x2A79, 0x2A7A },
+       { 0x2A7A, 0x2A79 },
+       { 0x2A7D, 0x2A7E },
+       { 0x2A7E, 0x2A7D },
+       { 0x2A7F, 0x2A80 },
+       { 0x2A80, 0x2A7F },
+       { 0x2A81, 0x2A82 },
+       { 0x2A82, 0x2A81 },
+       { 0x2A83, 0x2A84 },
+       { 0x2A84, 0x2A83 },
+       { 0x2A8B, 0x2A8C },
+       { 0x2A8C, 0x2A8B },
+       { 0x2A91, 0x2A92 },
+       { 0x2A92, 0x2A91 },
+       { 0x2A93, 0x2A94 },
+       { 0x2A94, 0x2A93 },
+       { 0x2A95, 0x2A96 },
+       { 0x2A96, 0x2A95 },
+       { 0x2A97, 0x2A98 },
+       { 0x2A98, 0x2A97 },
+       { 0x2A99, 0x2A9A },
+       { 0x2A9A, 0x2A99 },
+       { 0x2A9B, 0x2A9C },
+       { 0x2A9C, 0x2A9B },
+       { 0x2AA1, 0x2AA2 },
+       { 0x2AA2, 0x2AA1 },
+       { 0x2AA6, 0x2AA7 },
+       { 0x2AA7, 0x2AA6 },
+       { 0x2AA8, 0x2AA9 },
+       { 0x2AA9, 0x2AA8 },
+       { 0x2AAA, 0x2AAB },
+       { 0x2AAB, 0x2AAA },
+       { 0x2AAC, 0x2AAD },
+       { 0x2AAD, 0x2AAC },
+       { 0x2AAF, 0x2AB0 },
+       { 0x2AB0, 0x2AAF },
+       { 0x2AB3, 0x2AB4 },
+       { 0x2AB4, 0x2AB3 },
+       { 0x2ABB, 0x2ABC },
+       { 0x2ABC, 0x2ABB },
+       { 0x2ABD, 0x2ABE },
+       { 0x2ABE, 0x2ABD },
+       { 0x2ABF, 0x2AC0 },
+       { 0x2AC0, 0x2ABF },
+       { 0x2AC1, 0x2AC2 },
+       { 0x2AC2, 0x2AC1 },
+       { 0x2AC3, 0x2AC4 },
+       { 0x2AC4, 0x2AC3 },
+       { 0x2AC5, 0x2AC6 },
+       { 0x2AC6, 0x2AC5 },
+       { 0x2ACD, 0x2ACE },
+       { 0x2ACE, 0x2ACD },
+       { 0x2ACF, 0x2AD0 },
+       { 0x2AD0, 0x2ACF },
+       { 0x2AD1, 0x2AD2 },
+       { 0x2AD2, 0x2AD1 },
+       { 0x2AD3, 0x2AD4 },
+       { 0x2AD4, 0x2AD3 },
+       { 0x2AD5, 0x2AD6 },
+       { 0x2AD6, 0x2AD5 },
+       { 0x2ADE, 0x22A6 },
+       { 0x2AE3, 0x22A9 },
+       { 0x2AE4, 0x22A8 },
+       { 0x2AE5, 0x22AB },
+       { 0x2AEC, 0x2AED },
+       { 0x2AED, 0x2AEC },
+       { 0x2AF7, 0x2AF8 },
+       { 0x2AF8, 0x2AF7 },
+       { 0x2AF9, 0x2AFA },
+       { 0x2AFA, 0x2AF9 },
+       { 0x2E02, 0x2E03 },
+       { 0x2E03, 0x2E02 },
+       { 0x2E04, 0x2E05 },
+       { 0x2E05, 0x2E04 },
+       { 0x2E09, 0x2E0A },
+       { 0x2E0A, 0x2E09 },
+       { 0x2E0C, 0x2E0D },
+       { 0x2E0D, 0x2E0C },
+       { 0x2E1C, 0x2E1D },
+       { 0x2E1D, 0x2E1C },
+       { 0x2E20, 0x2E21 },
+       { 0x2E21, 0x2E20 },
+       { 0x2E22, 0x2E23 },
+       { 0x2E23, 0x2E22 },
+       { 0x2E24, 0x2E25 },
+       { 0x2E25, 0x2E24 },
+       { 0x2E26, 0x2E27 },
+       { 0x2E27, 0x2E26 },
+       { 0x2E28, 0x2E29 },
+       { 0x2E29, 0x2E28 },
+       { 0x3008, 0x3009 },
+       { 0x3009, 0x3008 },
+       { 0x300A, 0x300B },
+       { 0x300B, 0x300A },
+       { 0x300C, 0x300D },
+       { 0x300D, 0x300C },
+       { 0x300E, 0x300F },
+       { 0x300F, 0x300E },
+       { 0x3010, 0x3011 },
+       { 0x3011, 0x3010 },
+       { 0x3014, 0x3015 },
+       { 0x3015, 0x3014 },
+       { 0x3016, 0x3017 },
+       { 0x3017, 0x3016 },
+       { 0x3018, 0x3019 },
+       { 0x3019, 0x3018 },
+       { 0x301A, 0x301B },
+       { 0x301B, 0x301A },
+       { 0xFE59, 0xFE5A },
+       { 0xFE5A, 0xFE59 },
+       { 0xFE5B, 0xFE5C },
+       { 0xFE5C, 0xFE5B },
+       { 0xFE5D, 0xFE5E },
+       { 0xFE5E, 0xFE5D },
+       { 0xFE64, 0xFE65 },
+       { 0xFE65, 0xFE64 },
+       { 0xFF08, 0xFF09 },
+       { 0xFF09, 0xFF08 },
+       { 0xFF1C, 0xFF1E },
+       { 0xFF1E, 0xFF1C },
+       { 0xFF3B, 0xFF3D },
+       { 0xFF3D, 0xFF3B },
+       { 0xFF5B, 0xFF5D },
+       { 0xFF5D, 0xFF5B },
+       { 0xFF5F, 0xFF60 },
+       { 0xFF60, 0xFF5F },
+       { 0xFF62, 0xFF63 },
+       { 0xFF63, 0xFF62 } };
diff --git a/src/biditype.h b/src/biditype.h
new file mode 100644 (file)
index 0000000..60fc637
--- /dev/null
@@ -0,0 +1,446 @@
+  struct {
+    int from, to;
+    bidi_type_t type;
+  } bidi_type[] = {
+       { 0x0000, 0x0008, WEAK_BN },
+       { 0x0009, 0x0009, NEUTRAL_S },
+       { 0x000A, 0x000A, NEUTRAL_B },
+       { 0x000B, 0x000B, NEUTRAL_S },
+       { 0x000C, 0x000C, NEUTRAL_WS },
+       { 0x000D, 0x000D, NEUTRAL_B },
+       { 0x000E, 0x001B, WEAK_BN },
+       { 0x001C, 0x001E, NEUTRAL_B },
+       { 0x001F, 0x001F, NEUTRAL_S },
+       { 0x0020, 0x0020, NEUTRAL_WS },
+       { 0x0021, 0x0022, NEUTRAL_ON },
+       { 0x0023, 0x0025, WEAK_ET },
+       { 0x0026, 0x002A, NEUTRAL_ON },
+       { 0x002B, 0x002B, WEAK_ES },
+       { 0x002C, 0x002C, WEAK_CS },
+       { 0x002D, 0x002D, WEAK_ES },
+       { 0x002E, 0x002F, WEAK_CS },
+       { 0x0030, 0x0039, WEAK_EN },
+       { 0x003A, 0x003A, WEAK_CS },
+       { 0x003B, 0x0040, NEUTRAL_ON },
+       { 0x005B, 0x0060, NEUTRAL_ON },
+       { 0x007B, 0x007E, NEUTRAL_ON },
+       { 0x007F, 0x0084, WEAK_BN },
+       { 0x0085, 0x0085, NEUTRAL_B },
+       { 0x0086, 0x009F, WEAK_BN },
+       { 0x00A0, 0x00A0, WEAK_CS },
+       { 0x00A1, 0x00A1, NEUTRAL_ON },
+       { 0x00A2, 0x00A5, WEAK_ET },
+       { 0x00A6, 0x00A9, NEUTRAL_ON },
+       { 0x00AB, 0x00AC, NEUTRAL_ON },
+       { 0x00AD, 0x00AD, WEAK_BN },
+       { 0x00AE, 0x00AF, NEUTRAL_ON },
+       { 0x00B0, 0x00B1, WEAK_ET },
+       { 0x00B2, 0x00B3, WEAK_EN },
+       { 0x00B4, 0x00B4, NEUTRAL_ON },
+       { 0x00B6, 0x00B8, NEUTRAL_ON },
+       { 0x00B9, 0x00B9, WEAK_EN },
+       { 0x00BB, 0x00BF, NEUTRAL_ON },
+       { 0x00D7, 0x00D7, NEUTRAL_ON },
+       { 0x00F7, 0x00F7, NEUTRAL_ON },
+       { 0x02B9, 0x02BA, NEUTRAL_ON },
+       { 0x02C2, 0x02CF, NEUTRAL_ON },
+       { 0x02D2, 0x02DF, NEUTRAL_ON },
+       { 0x02E5, 0x02ED, NEUTRAL_ON },
+       { 0x02EF, 0x02FF, NEUTRAL_ON },
+       { 0x0300, 0x036F, WEAK_NSM },
+       { 0x0374, 0x0375, NEUTRAL_ON },
+       { 0x037E, 0x0385, NEUTRAL_ON },
+       { 0x0387, 0x0387, NEUTRAL_ON },
+       { 0x03F6, 0x03F6, NEUTRAL_ON },
+       { 0x0483, 0x0489, WEAK_NSM },
+       { 0x058A, 0x058A, NEUTRAL_ON },
+       { 0x0591, 0x05BD, WEAK_NSM },
+       { 0x05BE, 0x05BE, STRONG_R },
+       { 0x05BF, 0x05BF, WEAK_NSM },
+       { 0x05C0, 0x05C0, STRONG_R },
+       { 0x05C1, 0x05C2, WEAK_NSM },
+       { 0x05C3, 0x05C3, STRONG_R },
+       { 0x05C4, 0x05C5, WEAK_NSM },
+       { 0x05C6, 0x05C6, STRONG_R },
+       { 0x05C7, 0x05C7, WEAK_NSM },
+       { 0x05D0, 0x05F4, STRONG_R },
+       { 0x0600, 0x0603, WEAK_AN },
+       { 0x0606, 0x0607, NEUTRAL_ON },
+       { 0x0608, 0x0608, STRONG_AL },
+       { 0x0609, 0x060A, WEAK_ET },
+       { 0x060B, 0x060B, STRONG_AL },
+       { 0x060C, 0x060C, WEAK_CS },
+       { 0x060D, 0x060D, STRONG_AL },
+       { 0x060E, 0x060F, NEUTRAL_ON },
+       { 0x0610, 0x061A, WEAK_NSM },
+       { 0x061B, 0x064A, STRONG_AL },
+       { 0x064B, 0x065F, WEAK_NSM },
+       { 0x0660, 0x0669, WEAK_AN },
+       { 0x066A, 0x066A, WEAK_ET },
+       { 0x066B, 0x066C, WEAK_AN },
+       { 0x066D, 0x066F, STRONG_AL },
+       { 0x0670, 0x0670, WEAK_NSM },
+       { 0x0671, 0x06D5, STRONG_AL },
+       { 0x06D6, 0x06DC, WEAK_NSM },
+       { 0x06DD, 0x06DD, WEAK_AN },
+       { 0x06DE, 0x06E4, WEAK_NSM },
+       { 0x06E5, 0x06E6, STRONG_AL },
+       { 0x06E7, 0x06E8, WEAK_NSM },
+       { 0x06E9, 0x06E9, NEUTRAL_ON },
+       { 0x06EA, 0x06ED, WEAK_NSM },
+       { 0x06EE, 0x06EF, STRONG_AL },
+       { 0x06F0, 0x06F9, WEAK_EN },
+       { 0x06FA, 0x070D, STRONG_AL },
+       { 0x070F, 0x070F, WEAK_AN },
+       { 0x0710, 0x0710, STRONG_AL },
+       { 0x0711, 0x0711, WEAK_NSM },
+       { 0x0712, 0x072F, STRONG_AL },
+       { 0x0730, 0x074A, WEAK_NSM },
+       { 0x074D, 0x07A5, STRONG_AL },
+       { 0x07A6, 0x07B0, WEAK_NSM },
+       { 0x07B1, 0x07B1, STRONG_AL },
+       { 0x07C0, 0x07EA, STRONG_R },
+       { 0x07EB, 0x07F3, WEAK_NSM },
+       { 0x07F4, 0x07F5, STRONG_R },
+       { 0x07F6, 0x07F9, NEUTRAL_ON },
+       { 0x07FA, 0x0815, STRONG_R },
+       { 0x0816, 0x0819, WEAK_NSM },
+       { 0x081A, 0x081A, STRONG_R },
+       { 0x081B, 0x0823, WEAK_NSM },
+       { 0x0824, 0x0824, STRONG_R },
+       { 0x0825, 0x0827, WEAK_NSM },
+       { 0x0828, 0x0828, STRONG_R },
+       { 0x0829, 0x082D, WEAK_NSM },
+       { 0x0830, 0x0858, STRONG_R },
+       { 0x0859, 0x085B, WEAK_NSM },
+       { 0x085E, 0x085E, STRONG_R },
+       { 0x0900, 0x0902, WEAK_NSM },
+       { 0x093A, 0x093A, WEAK_NSM },
+       { 0x093C, 0x093C, WEAK_NSM },
+       { 0x0941, 0x0948, WEAK_NSM },
+       { 0x094D, 0x094D, WEAK_NSM },
+       { 0x0951, 0x0957, WEAK_NSM },
+       { 0x0962, 0x0963, WEAK_NSM },
+       { 0x0981, 0x0981, WEAK_NSM },
+       { 0x09BC, 0x09BC, WEAK_NSM },
+       { 0x09C1, 0x09C4, WEAK_NSM },
+       { 0x09CD, 0x09CD, WEAK_NSM },
+       { 0x09E2, 0x09E3, WEAK_NSM },
+       { 0x09F2, 0x09F3, WEAK_ET },
+       { 0x09FB, 0x09FB, WEAK_ET },
+       { 0x0A01, 0x0A02, WEAK_NSM },
+       { 0x0A3C, 0x0A3C, WEAK_NSM },
+       { 0x0A41, 0x0A51, WEAK_NSM },
+       { 0x0A70, 0x0A71, WEAK_NSM },
+       { 0x0A75, 0x0A82, WEAK_NSM },
+       { 0x0ABC, 0x0ABC, WEAK_NSM },
+       { 0x0AC1, 0x0AC8, WEAK_NSM },
+       { 0x0ACD, 0x0ACD, WEAK_NSM },
+       { 0x0AE2, 0x0AE3, WEAK_NSM },
+       { 0x0AF1, 0x0AF1, WEAK_ET },
+       { 0x0B01, 0x0B01, WEAK_NSM },
+       { 0x0B3C, 0x0B3C, WEAK_NSM },
+       { 0x0B3F, 0x0B3F, WEAK_NSM },
+       { 0x0B41, 0x0B44, WEAK_NSM },
+       { 0x0B4D, 0x0B56, WEAK_NSM },
+       { 0x0B62, 0x0B63, WEAK_NSM },
+       { 0x0B82, 0x0B82, WEAK_NSM },
+       { 0x0BC0, 0x0BC0, WEAK_NSM },
+       { 0x0BCD, 0x0BCD, WEAK_NSM },
+       { 0x0BF3, 0x0BF8, NEUTRAL_ON },
+       { 0x0BF9, 0x0BF9, WEAK_ET },
+       { 0x0BFA, 0x0BFA, NEUTRAL_ON },
+       { 0x0C3E, 0x0C40, WEAK_NSM },
+       { 0x0C46, 0x0C56, WEAK_NSM },
+       { 0x0C62, 0x0C63, WEAK_NSM },
+       { 0x0C78, 0x0C7E, NEUTRAL_ON },
+       { 0x0CBC, 0x0CBC, WEAK_NSM },
+       { 0x0CCC, 0x0CCD, WEAK_NSM },
+       { 0x0CE2, 0x0CE3, WEAK_NSM },
+       { 0x0D41, 0x0D44, WEAK_NSM },
+       { 0x0D4D, 0x0D4D, WEAK_NSM },
+       { 0x0D62, 0x0D63, WEAK_NSM },
+       { 0x0DCA, 0x0DCA, WEAK_NSM },
+       { 0x0DD2, 0x0DD6, WEAK_NSM },
+       { 0x0E31, 0x0E31, WEAK_NSM },
+       { 0x0E34, 0x0E3A, WEAK_NSM },
+       { 0x0E3F, 0x0E3F, WEAK_ET },
+       { 0x0E47, 0x0E4E, WEAK_NSM },
+       { 0x0EB1, 0x0EB1, WEAK_NSM },
+       { 0x0EB4, 0x0EBC, WEAK_NSM },
+       { 0x0EC8, 0x0ECD, WEAK_NSM },
+       { 0x0F18, 0x0F19, WEAK_NSM },
+       { 0x0F35, 0x0F35, WEAK_NSM },
+       { 0x0F37, 0x0F37, WEAK_NSM },
+       { 0x0F39, 0x0F39, WEAK_NSM },
+       { 0x0F3A, 0x0F3D, NEUTRAL_ON },
+       { 0x0F71, 0x0F7E, WEAK_NSM },
+       { 0x0F80, 0x0F84, WEAK_NSM },
+       { 0x0F86, 0x0F87, WEAK_NSM },
+       { 0x0F8D, 0x0FBC, WEAK_NSM },
+       { 0x0FC6, 0x0FC6, WEAK_NSM },
+       { 0x102D, 0x1030, WEAK_NSM },
+       { 0x1032, 0x1037, WEAK_NSM },
+       { 0x1039, 0x103A, WEAK_NSM },
+       { 0x103D, 0x103E, WEAK_NSM },
+       { 0x1058, 0x1059, WEAK_NSM },
+       { 0x105E, 0x1060, WEAK_NSM },
+       { 0x1071, 0x1074, WEAK_NSM },
+       { 0x1082, 0x1082, WEAK_NSM },
+       { 0x1085, 0x1086, WEAK_NSM },
+       { 0x108D, 0x108D, WEAK_NSM },
+       { 0x109D, 0x109D, WEAK_NSM },
+       { 0x135D, 0x135F, WEAK_NSM },
+       { 0x1390, 0x1399, NEUTRAL_ON },
+       { 0x1400, 0x1400, NEUTRAL_ON },
+       { 0x1680, 0x1680, NEUTRAL_WS },
+       { 0x169B, 0x169C, NEUTRAL_ON },
+       { 0x1712, 0x1714, WEAK_NSM },
+       { 0x1732, 0x1734, WEAK_NSM },
+       { 0x1752, 0x1753, WEAK_NSM },
+       { 0x1772, 0x1773, WEAK_NSM },
+       { 0x17B7, 0x17BD, WEAK_NSM },
+       { 0x17C6, 0x17C6, WEAK_NSM },
+       { 0x17C9, 0x17D3, WEAK_NSM },
+       { 0x17DB, 0x17DB, WEAK_ET },
+       { 0x17DD, 0x17DD, WEAK_NSM },
+       { 0x17F0, 0x180A, NEUTRAL_ON },
+       { 0x180B, 0x180D, WEAK_NSM },
+       { 0x180E, 0x180E, NEUTRAL_WS },
+       { 0x18A9, 0x18A9, WEAK_NSM },
+       { 0x1920, 0x1922, WEAK_NSM },
+       { 0x1927, 0x1928, WEAK_NSM },
+       { 0x1932, 0x1932, WEAK_NSM },
+       { 0x1939, 0x193B, WEAK_NSM },
+       { 0x1940, 0x1945, NEUTRAL_ON },
+       { 0x19DE, 0x19FF, NEUTRAL_ON },
+       { 0x1A17, 0x1A18, WEAK_NSM },
+       { 0x1A56, 0x1A56, WEAK_NSM },
+       { 0x1A58, 0x1A60, WEAK_NSM },
+       { 0x1A62, 0x1A62, WEAK_NSM },
+       { 0x1A65, 0x1A6C, WEAK_NSM },
+       { 0x1A73, 0x1A7F, WEAK_NSM },
+       { 0x1B00, 0x1B03, WEAK_NSM },
+       { 0x1B34, 0x1B34, WEAK_NSM },
+       { 0x1B36, 0x1B3A, WEAK_NSM },
+       { 0x1B3C, 0x1B3C, WEAK_NSM },
+       { 0x1B42, 0x1B42, WEAK_NSM },
+       { 0x1B6B, 0x1B73, WEAK_NSM },
+       { 0x1B80, 0x1B81, WEAK_NSM },
+       { 0x1BA2, 0x1BA5, WEAK_NSM },
+       { 0x1BA8, 0x1BA9, WEAK_NSM },
+       { 0x1BE6, 0x1BE6, WEAK_NSM },
+       { 0x1BE8, 0x1BE9, WEAK_NSM },
+       { 0x1BED, 0x1BED, WEAK_NSM },
+       { 0x1BEF, 0x1BF1, WEAK_NSM },
+       { 0x1C2C, 0x1C33, WEAK_NSM },
+       { 0x1C36, 0x1C37, WEAK_NSM },
+       { 0x1CD0, 0x1CD2, WEAK_NSM },
+       { 0x1CD4, 0x1CE0, WEAK_NSM },
+       { 0x1CE2, 0x1CE8, WEAK_NSM },
+       { 0x1CED, 0x1CED, WEAK_NSM },
+       { 0x1DC0, 0x1DFF, WEAK_NSM },
+       { 0x1FBD, 0x1FBD, NEUTRAL_ON },
+       { 0x1FBF, 0x1FC1, NEUTRAL_ON },
+       { 0x1FCD, 0x1FCF, NEUTRAL_ON },
+       { 0x1FDD, 0x1FDF, NEUTRAL_ON },
+       { 0x1FED, 0x1FEF, NEUTRAL_ON },
+       { 0x1FFD, 0x1FFE, NEUTRAL_ON },
+       { 0x2000, 0x200A, NEUTRAL_WS },
+       { 0x200B, 0x200D, WEAK_BN },
+       { 0x200F, 0x200F, STRONG_R },
+       { 0x2010, 0x2027, NEUTRAL_ON },
+       { 0x2028, 0x2028, NEUTRAL_WS },
+       { 0x2029, 0x2029, NEUTRAL_B },
+       { 0x202A, 0x202A, LRE },
+       { 0x202B, 0x202B, RLE },
+       { 0x202C, 0x202C, PDF },
+       { 0x202D, 0x202D, LRO },
+       { 0x202E, 0x202E, RLO },
+       { 0x202F, 0x202F, WEAK_CS },
+       { 0x2030, 0x2034, WEAK_ET },
+       { 0x2035, 0x2043, NEUTRAL_ON },
+       { 0x2044, 0x2044, WEAK_CS },
+       { 0x2045, 0x205E, NEUTRAL_ON },
+       { 0x205F, 0x205F, NEUTRAL_WS },
+       { 0x2060, 0x206F, WEAK_BN },
+       { 0x2070, 0x2070, WEAK_EN },
+       { 0x2074, 0x2079, WEAK_EN },
+       { 0x207A, 0x207B, WEAK_ES },
+       { 0x207C, 0x207E, NEUTRAL_ON },
+       { 0x2080, 0x2089, WEAK_EN },
+       { 0x208A, 0x208B, WEAK_ES },
+       { 0x208C, 0x208E, NEUTRAL_ON },
+       { 0x20A0, 0x20B8, WEAK_ET },
+       { 0x20D0, 0x20F0, WEAK_NSM },
+       { 0x2100, 0x2101, NEUTRAL_ON },
+       { 0x2103, 0x2106, NEUTRAL_ON },
+       { 0x2108, 0x2109, NEUTRAL_ON },
+       { 0x2114, 0x2114, NEUTRAL_ON },
+       { 0x2116, 0x2118, NEUTRAL_ON },
+       { 0x211E, 0x2123, NEUTRAL_ON },
+       { 0x2125, 0x2125, NEUTRAL_ON },
+       { 0x2127, 0x2127, NEUTRAL_ON },
+       { 0x2129, 0x2129, NEUTRAL_ON },
+       { 0x212E, 0x212E, WEAK_ET },
+       { 0x213A, 0x213B, NEUTRAL_ON },
+       { 0x2140, 0x2144, NEUTRAL_ON },
+       { 0x214A, 0x214D, NEUTRAL_ON },
+       { 0x2150, 0x215F, NEUTRAL_ON },
+       { 0x2189, 0x2211, NEUTRAL_ON },
+       { 0x2212, 0x2212, WEAK_ES },
+       { 0x2213, 0x2213, WEAK_ET },
+       { 0x2214, 0x2335, NEUTRAL_ON },
+       { 0x237B, 0x2394, NEUTRAL_ON },
+       { 0x2396, 0x2487, NEUTRAL_ON },
+       { 0x2488, 0x249B, WEAK_EN },
+       { 0x24EA, 0x26AB, NEUTRAL_ON },
+       { 0x26AD, 0x27FF, NEUTRAL_ON },
+       { 0x2900, 0x2B59, NEUTRAL_ON },
+       { 0x2CE5, 0x2CEA, NEUTRAL_ON },
+       { 0x2CEF, 0x2CF1, WEAK_NSM },
+       { 0x2CF9, 0x2CFF, NEUTRAL_ON },
+       { 0x2D7F, 0x2D7F, WEAK_NSM },
+       { 0x2DE0, 0x2DFF, WEAK_NSM },
+       { 0x2E00, 0x2FFB, NEUTRAL_ON },
+       { 0x3000, 0x3000, NEUTRAL_WS },
+       { 0x3001, 0x3004, NEUTRAL_ON },
+       { 0x3008, 0x3020, NEUTRAL_ON },
+       { 0x302A, 0x302F, WEAK_NSM },
+       { 0x3030, 0x3030, NEUTRAL_ON },
+       { 0x3036, 0x3037, NEUTRAL_ON },
+       { 0x303D, 0x303F, NEUTRAL_ON },
+       { 0x3099, 0x309A, WEAK_NSM },
+       { 0x309B, 0x309C, NEUTRAL_ON },
+       { 0x30A0, 0x30A0, NEUTRAL_ON },
+       { 0x30FB, 0x30FB, NEUTRAL_ON },
+       { 0x31C0, 0x31E3, NEUTRAL_ON },
+       { 0x321D, 0x321E, NEUTRAL_ON },
+       { 0x3250, 0x325F, NEUTRAL_ON },
+       { 0x327C, 0x327E, NEUTRAL_ON },
+       { 0x32B1, 0x32BF, NEUTRAL_ON },
+       { 0x32CC, 0x32CF, NEUTRAL_ON },
+       { 0x3377, 0x337A, NEUTRAL_ON },
+       { 0x33DE, 0x33DF, NEUTRAL_ON },
+       { 0x33FF, 0x33FF, NEUTRAL_ON },
+       { 0x4DC0, 0x4DFF, NEUTRAL_ON },
+       { 0xA490, 0xA4C6, NEUTRAL_ON },
+       { 0xA60D, 0xA60F, NEUTRAL_ON },
+       { 0xA66F, 0xA672, WEAK_NSM },
+       { 0xA673, 0xA673, NEUTRAL_ON },
+       { 0xA67C, 0xA67D, WEAK_NSM },
+       { 0xA67E, 0xA67F, NEUTRAL_ON },
+       { 0xA6F0, 0xA6F1, WEAK_NSM },
+       { 0xA700, 0xA721, NEUTRAL_ON },
+       { 0xA788, 0xA788, NEUTRAL_ON },
+       { 0xA802, 0xA802, WEAK_NSM },
+       { 0xA806, 0xA806, WEAK_NSM },
+       { 0xA80B, 0xA80B, WEAK_NSM },
+       { 0xA825, 0xA826, WEAK_NSM },
+       { 0xA828, 0xA82B, NEUTRAL_ON },
+       { 0xA838, 0xA839, WEAK_ET },
+       { 0xA874, 0xA877, NEUTRAL_ON },
+       { 0xA8C4, 0xA8C4, WEAK_NSM },
+       { 0xA8E0, 0xA8F1, WEAK_NSM },
+       { 0xA926, 0xA92D, WEAK_NSM },
+       { 0xA947, 0xA951, WEAK_NSM },
+       { 0xA980, 0xA982, WEAK_NSM },
+       { 0xA9B3, 0xA9B3, WEAK_NSM },
+       { 0xA9B6, 0xA9B9, WEAK_NSM },
+       { 0xA9BC, 0xA9BC, WEAK_NSM },
+       { 0xAA29, 0xAA2E, WEAK_NSM },
+       { 0xAA31, 0xAA32, WEAK_NSM },
+       { 0xAA35, 0xAA36, WEAK_NSM },
+       { 0xAA43, 0xAA43, WEAK_NSM },
+       { 0xAA4C, 0xAA4C, WEAK_NSM },
+       { 0xAAB0, 0xAAB0, WEAK_NSM },
+       { 0xAAB2, 0xAAB4, WEAK_NSM },
+       { 0xAAB7, 0xAAB8, WEAK_NSM },
+       { 0xAABE, 0xAABF, WEAK_NSM },
+       { 0xAAC1, 0xAAC1, WEAK_NSM },
+       { 0xABE5, 0xABE5, WEAK_NSM },
+       { 0xABE8, 0xABE8, WEAK_NSM },
+       { 0xABED, 0xABED, WEAK_NSM },
+       { 0xFB1D, 0xFB1D, STRONG_R },
+       { 0xFB1E, 0xFB1E, WEAK_NSM },
+       { 0xFB1F, 0xFB28, STRONG_R },
+       { 0xFB29, 0xFB29, WEAK_ES },
+       { 0xFB2A, 0xFB4F, STRONG_R },
+       { 0xFB50, 0xFD3D, STRONG_AL },
+       { 0xFD3E, 0xFD3F, NEUTRAL_ON },
+       { 0xFD50, 0xFDFC, STRONG_AL },
+       { 0xFDFD, 0xFDFD, NEUTRAL_ON },
+       { 0xFE00, 0xFE0F, WEAK_NSM },
+       { 0xFE10, 0xFE19, NEUTRAL_ON },
+       { 0xFE20, 0xFE26, WEAK_NSM },
+       { 0xFE30, 0xFE4F, NEUTRAL_ON },
+       { 0xFE50, 0xFE50, WEAK_CS },
+       { 0xFE51, 0xFE51, NEUTRAL_ON },
+       { 0xFE52, 0xFE52, WEAK_CS },
+       { 0xFE54, 0xFE54, NEUTRAL_ON },
+       { 0xFE55, 0xFE55, WEAK_CS },
+       { 0xFE56, 0xFE5E, NEUTRAL_ON },
+       { 0xFE5F, 0xFE5F, WEAK_ET },
+       { 0xFE60, 0xFE61, NEUTRAL_ON },
+       { 0xFE62, 0xFE63, WEAK_ES },
+       { 0xFE64, 0xFE68, NEUTRAL_ON },
+       { 0xFE69, 0xFE6A, WEAK_ET },
+       { 0xFE6B, 0xFE6B, NEUTRAL_ON },
+       { 0xFE70, 0xFEFC, STRONG_AL },
+       { 0xFEFF, 0xFEFF, WEAK_BN },
+       { 0xFF01, 0xFF02, NEUTRAL_ON },
+       { 0xFF03, 0xFF05, WEAK_ET },
+       { 0xFF06, 0xFF0A, NEUTRAL_ON },
+       { 0xFF0B, 0xFF0B, WEAK_ES },
+       { 0xFF0C, 0xFF0C, WEAK_CS },
+       { 0xFF0D, 0xFF0D, WEAK_ES },
+       { 0xFF0E, 0xFF0F, WEAK_CS },
+       { 0xFF10, 0xFF19, WEAK_EN },
+       { 0xFF1A, 0xFF1A, WEAK_CS },
+       { 0xFF1B, 0xFF20, NEUTRAL_ON },
+       { 0xFF3B, 0xFF40, NEUTRAL_ON },
+       { 0xFF5B, 0xFF65, NEUTRAL_ON },
+       { 0xFFE0, 0xFFE1, WEAK_ET },
+       { 0xFFE2, 0xFFE4, NEUTRAL_ON },
+       { 0xFFE5, 0xFFE6, WEAK_ET },
+       { 0xFFE8, 0xFFFD, NEUTRAL_ON },
+       { 0x10101, 0x10101, NEUTRAL_ON },
+       { 0x10140, 0x1019B, NEUTRAL_ON },
+       { 0x101FD, 0x101FD, WEAK_NSM },
+       { 0x10800, 0x1091B, STRONG_R },
+       { 0x1091F, 0x1091F, NEUTRAL_ON },
+       { 0x10920, 0x10A00, STRONG_R },
+       { 0x10A01, 0x10A0F, WEAK_NSM },
+       { 0x10A10, 0x10A33, STRONG_R },
+       { 0x10A38, 0x10A3F, WEAK_NSM },
+       { 0x10A40, 0x10B35, STRONG_R },
+       { 0x10B39, 0x10B3F, NEUTRAL_ON },
+       { 0x10B40, 0x10C48, STRONG_R },
+       { 0x10E60, 0x10E7E, WEAK_AN },
+       { 0x11001, 0x11001, WEAK_NSM },
+       { 0x11038, 0x11046, WEAK_NSM },
+       { 0x11052, 0x11065, NEUTRAL_ON },
+       { 0x11080, 0x11081, WEAK_NSM },
+       { 0x110B3, 0x110B6, WEAK_NSM },
+       { 0x110B9, 0x110BA, WEAK_NSM },
+       { 0x1D167, 0x1D169, WEAK_NSM },
+       { 0x1D173, 0x1D17A, WEAK_BN },
+       { 0x1D17B, 0x1D182, WEAK_NSM },
+       { 0x1D185, 0x1D18B, WEAK_NSM },
+       { 0x1D1AA, 0x1D1AD, WEAK_NSM },
+       { 0x1D200, 0x1D241, NEUTRAL_ON },
+       { 0x1D242, 0x1D244, WEAK_NSM },
+       { 0x1D245, 0x1D356, NEUTRAL_ON },
+       { 0x1D6DB, 0x1D6DB, NEUTRAL_ON },
+       { 0x1D715, 0x1D715, NEUTRAL_ON },
+       { 0x1D74F, 0x1D74F, NEUTRAL_ON },
+       { 0x1D789, 0x1D789, NEUTRAL_ON },
+       { 0x1D7C3, 0x1D7C3, NEUTRAL_ON },
+       { 0x1D7CE, 0x1D7FF, WEAK_EN },
+       { 0x1F000, 0x1F0DF, NEUTRAL_ON },
+       { 0x1F100, 0x1F10A, WEAK_EN },
+       { 0x1F300, 0x1F48B, NEUTRAL_ON },
+       { 0x1F48D, 0x1F523, NEUTRAL_ON },
+       { 0x1F525, 0x1F773, NEUTRAL_ON },
+       { 0xE0001, 0xE007F, WEAK_BN },
+       { 0xE0100, 0xE01EF, WEAK_NSM } };
index 890adcbcd862de74f1640c99711db24cc3396f2e..7ba6fc264fd2cdd144255a32110c733eb2743338 100644 (file)
@@ -122,8 +122,7 @@ extern int pending_atimers;
 #define INPUT_BLOCKED_P (interrupt_input_blocked > 0)
 
 /* Defined in keyboard.c */
-/* Don't use a prototype here; it causes trouble in some files.  */
-extern void reinvoke_input_signal ();
+extern void reinvoke_input_signal (void);
 
 #endif /* EMACS_BLOCKINPUT_H */
 
index adb85b83e5fc5e6307a59191aa5000d124abcd38..39fabf581bb7343b2213f2ff9e5f941fdfd5ca55 100644 (file)
@@ -28,11 +28,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <stdio.h>
 #include <setjmp.h>
 
-#ifndef USE_CRT_DLL
-extern int errno;
-#endif
-
-
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
@@ -83,9 +78,6 @@ static Lisp_Object Vbuffer_defaults;
    be a DEFVAR_PER_BUFFER for the slot, there is no default value for it;
    and the corresponding slot in buffer_defaults is not used.
 
-   If a slot is -2, then there is no DEFVAR_PER_BUFFER for it,
-   but there is a default value which is copied into each buffer.
-
    If a slot in this structure corresponding to a DEFVAR_PER_BUFFER is
    zero, that is a bug */
 
@@ -99,6 +91,12 @@ DECL_ALIGN (struct buffer, buffer_local_symbols);
 /* A Lisp_Object pointer to the above, used for staticpro */
 static Lisp_Object Vbuffer_local_symbols;
 
+/* Return the symbol of the per-buffer variable at offset OFFSET in
+   the buffer structure.  */
+
+#define PER_BUFFER_SYMBOL(OFFSET) \
+      (*(Lisp_Object *)((OFFSET) + (char *) &buffer_local_symbols))
+
 /* Flags indicating which built-in buffer-local variables
    are permanent locals.  */
 static char buffer_permanent_local_flags[MAX_PER_BUFFER_VARS];
@@ -108,13 +106,11 @@ static char buffer_permanent_local_flags[MAX_PER_BUFFER_VARS];
 int last_per_buffer_idx;
 
 EXFUN (Fset_buffer, 1);
-void set_buffer_internal P_ ((struct buffer *b));
-void set_buffer_internal_1 P_ ((struct buffer *b));
-static void call_overlay_mod_hooks P_ ((Lisp_Object list, Lisp_Object overlay,
-                                       int after, Lisp_Object arg1,
-                                       Lisp_Object arg2, Lisp_Object arg3));
-static void swap_out_buffer_local_variables P_ ((struct buffer *b));
-static void reset_buffer_local_variables P_ ((struct buffer *b, int permanent_too));
+static void call_overlay_mod_hooks (Lisp_Object list, Lisp_Object overlay,
+                                    int after, Lisp_Object arg1,
+                                    Lisp_Object arg2, Lisp_Object arg3);
+static void swap_out_buffer_local_variables (struct buffer *b);
+static void reset_buffer_local_variables (struct buffer *b, int permanent_too);
 
 /* Alist of all buffer names vs the buffers. */
 /* This used to be a variable, but is no longer,
@@ -164,26 +160,23 @@ Lisp_Object Qget_file_buffer;
 
 Lisp_Object Qoverlayp;
 
-Lisp_Object Qpriority, Qwindow, Qevaporate, Qbefore_string, Qafter_string;
+Lisp_Object Qpriority, Qevaporate, Qbefore_string, Qafter_string;
 
 Lisp_Object Qmodification_hooks;
 Lisp_Object Qinsert_in_front_hooks;
 Lisp_Object Qinsert_behind_hooks;
 
-static void alloc_buffer_text P_ ((struct buffer *, size_t));
-static void free_buffer_text P_ ((struct buffer *b));
-static struct Lisp_Overlay * copy_overlays P_ ((struct buffer *, struct Lisp_Overlay *));
-static void modify_overlay P_ ((struct buffer *, EMACS_INT, EMACS_INT));
-static Lisp_Object buffer_lisp_local_variables P_ ((struct buffer *));
-
-extern char * emacs_strerror P_ ((int));
+static void alloc_buffer_text (struct buffer *, size_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 Lisp_Object buffer_lisp_local_variables (struct buffer *);
 
 /* For debugging; temporary.  See set_buffer_internal.  */
 /* Lisp_Object Qlisp_mode, Vcheck_symbol; */
 
 void
-nsberror (spec)
-     Lisp_Object spec;
+nsberror (Lisp_Object spec)
 {
   if (STRINGP (spec))
     error ("No buffer named %s", SDATA (spec));
@@ -193,8 +186,7 @@ nsberror (spec)
 DEFUN ("buffer-live-p", Fbuffer_live_p, Sbuffer_live_p, 1, 1, 0,
        doc: /* Return non-nil if OBJECT is a buffer which has not been killed.
 Value is nil if OBJECT is not a buffer or if it has been killed.  */)
-     (object)
-     Lisp_Object object;
+  (Lisp_Object object)
 {
   return ((BUFFERP (object) && ! NILP (XBUFFER (object)->name))
          ? Qt : Qnil);
@@ -205,8 +197,7 @@ DEFUN ("buffer-list", Fbuffer_list, Sbuffer_list, 0, 1, 0,
 If the optional arg FRAME is a frame, we return the buffer list
 in the proper order for that frame: the buffers in FRAME's `buffer-list'
 frame parameter come first, followed by the rest of the buffers.  */)
-     (frame)
-     Lisp_Object frame;
+  (Lisp_Object frame)
 {
   Lisp_Object general;
   general = Fmapcar (Qcdr, Vbuffer_alist);
@@ -250,9 +241,7 @@ frame parameter come first, followed by the rest of the buffers.  */)
    and don't ever QUIT.  */
 
 static Lisp_Object
-assoc_ignore_text_properties (key, list)
-     register Lisp_Object key;
-     Lisp_Object list;
+assoc_ignore_text_properties (register Lisp_Object key, Lisp_Object list)
 {
   register Lisp_Object tail;
   for (tail = list; CONSP (tail); tail = XCDR (tail))
@@ -271,8 +260,7 @@ DEFUN ("get-buffer", Fget_buffer, Sget_buffer, 1, 1, 0,
 BUFFER-OR-NAME must be either a string or a buffer.  If BUFFER-OR-NAME
 is a string and there is no buffer with that name, return nil.  If
 BUFFER-OR-NAME is a buffer, return it as given.  */)
-     (buffer_or_name)
-     register Lisp_Object buffer_or_name;
+  (register Lisp_Object buffer_or_name)
 {
   if (BUFFERP (buffer_or_name))
     return buffer_or_name;
@@ -286,8 +274,7 @@ DEFUN ("get-file-buffer", Fget_file_buffer, Sget_file_buffer, 1, 1, 0,
 The buffer's `buffer-file-name' must match exactly the expansion of FILENAME.
 If there is no such live buffer, return nil.
 See also `find-buffer-visiting'.  */)
-     (filename)
-     register Lisp_Object filename;
+  (register Lisp_Object filename)
 {
   register Lisp_Object tail, buf, tem;
   Lisp_Object handler;
@@ -314,8 +301,7 @@ See also `find-buffer-visiting'.  */)
 }
 
 Lisp_Object
-get_truename_buffer (filename)
-     register Lisp_Object filename;
+get_truename_buffer (register Lisp_Object filename)
 {
   register Lisp_Object tail, buf, tem;
 
@@ -343,8 +329,7 @@ buffer does not keep undo information.
 
 If BUFFER-OR-NAME is a buffer instead of a string, return it as given,
 even if it is dead.  The return value is never nil.  */)
-     (buffer_or_name)
-     register Lisp_Object buffer_or_name;
+  (register Lisp_Object buffer_or_name)
 {
   register Lisp_Object buffer, name;
   register struct buffer *b;
@@ -439,9 +424,7 @@ even if it is dead.  The return value is never nil.  */)
    LIST, but for buffer B.  */
 
 static struct Lisp_Overlay *
-copy_overlays (b, list)
-     struct buffer *b;
-     struct Lisp_Overlay *list;
+copy_overlays (struct buffer *b, struct Lisp_Overlay *list)
 {
   Lisp_Object buffer;
   struct Lisp_Overlay *result = NULL, *tail = NULL;
@@ -491,8 +474,7 @@ copy_overlays (b, list)
    copied.  */
 
 static void
-clone_per_buffer_values (from, to)
-     struct buffer *from, *to;
+clone_per_buffer_values (struct buffer *from, struct buffer *to)
 {
   Lisp_Object to_buffer;
   int offset;
@@ -512,7 +494,7 @@ clone_per_buffer_values (from, to)
        continue;
 
       obj = PER_BUFFER_VALUE (from, offset);
-      if (MARKERP (obj))
+      if (MARKERP (obj) && XMARKER (obj)->buffer == from)
        {
          struct Lisp_Marker *m = XMARKER (obj);
          obj = Fmake_marker ();
@@ -523,7 +505,7 @@ clone_per_buffer_values (from, to)
       PER_BUFFER_VALUE (to, offset) = obj;
     }
 
-  bcopy (from->local_flags, to->local_flags, sizeof to->local_flags);
+  memcpy (to->local_flags, from->local_flags, sizeof to->local_flags);
 
   to->overlays_before = copy_overlays (to, from->overlays_before);
   to->overlays_after = copy_overlays (to, from->overlays_after);
@@ -542,8 +524,7 @@ NAME should be a string which is not the name of an existing buffer.
 Optional argument CLONE non-nil means preserve BASE-BUFFER's state,
 such as major and minor modes, in the indirect buffer.
 CLONE nil means the indirect buffer's state is reset to default values.  */)
-     (base_buffer, name, clone)
-     Lisp_Object base_buffer, name, clone;
+  (Lisp_Object base_buffer, Lisp_Object name, Lisp_Object clone)
 {
   Lisp_Object buf, tem;
   struct buffer *b;
@@ -660,8 +641,7 @@ CLONE nil means the indirect buffer's state is reset to default values.  */)
 }
 
 void
-delete_all_overlays (b)
-     struct buffer *b;
+delete_all_overlays (struct buffer *b)
 {
   Lisp_Object overlay;
 
@@ -691,13 +671,13 @@ delete_all_overlays (b)
    claims it doesn't belong to it.  */
 
 void
-reset_buffer (b)
-     register struct buffer *b;
+reset_buffer (register struct buffer *b)
 {
   b->filename = Qnil;
   b->file_truename = Qnil;
   b->directory = (current_buffer) ? current_buffer->directory : Qnil;
   b->modtime = 0;
+  b->modtime_size = -1;
   XSETFASTINT (b->save_length, 0);
   b->last_window_start = 1;
   /* It is more conservative to start out "changed" than "unchanged".  */
@@ -735,9 +715,7 @@ reset_buffer (b)
    we preserve those.  */
 
 static void
-reset_buffer_local_variables (b, permanent_too)
-     register struct buffer *b;
-     int permanent_too;
+reset_buffer_local_variables (register struct buffer *b, int permanent_too)
 {
   register int offset;
   int i;
@@ -774,9 +752,7 @@ reset_buffer_local_variables (b, permanent_too)
     {
       Lisp_Object tmp, prop, last = Qnil;
       for (tmp = b->local_var_alist; CONSP (tmp); tmp = XCDR (tmp))
-       if (CONSP (XCAR (tmp))
-           && SYMBOLP (XCAR (XCAR (tmp)))
-           && !NILP (prop = Fget (XCAR (XCAR (tmp)), Qpermanent_local)))
+       if (!NILP (prop = Fget (XCAR (XCAR (tmp)), Qpermanent_local)))
          {
            /* If permanent-local, keep it.  */
            last = tmp;
@@ -826,9 +802,7 @@ reset_buffer_local_variables (b, permanent_too)
       int idx = PER_BUFFER_IDX (offset);
       if ((idx > 0
           && (permanent_too
-              || buffer_permanent_local_flags[idx] == 0))
-         /* Is -2 used anywhere?  */
-         || idx == -2)
+              || buffer_permanent_local_flags[idx] == 0)))
        PER_BUFFER_VALUE (b, offset) = PER_BUFFER_DEFAULT (offset);
     }
 }
@@ -845,8 +819,7 @@ 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.  */)
-     (name, ignore)
-     register Lisp_Object name, ignore;
+  (register Lisp_Object name, Lisp_Object ignore)
 {
   register Lisp_Object gentemp, tem;
   int count;
@@ -880,8 +853,7 @@ DEFUN ("buffer-name", Fbuffer_name, Sbuffer_name, 0, 1, 0,
        doc: /* Return the name of BUFFER, as a string.
 BUFFER defaults to the current buffer.
 Return nil if BUFFER has been killed.  */)
-     (buffer)
-     register Lisp_Object buffer;
+  (register Lisp_Object buffer)
 {
   if (NILP (buffer))
     return current_buffer->name;
@@ -892,8 +864,7 @@ Return nil if BUFFER has been killed.  */)
 DEFUN ("buffer-file-name", Fbuffer_file_name, Sbuffer_file_name, 0, 1, 0,
        doc: /* Return name of file BUFFER is visiting, or nil if none.
 No argument or nil as argument means use the current buffer.  */)
-     (buffer)
-     register Lisp_Object buffer;
+  (register Lisp_Object buffer)
 {
   if (NILP (buffer))
     return current_buffer->filename;
@@ -906,8 +877,7 @@ DEFUN ("buffer-base-buffer", Fbuffer_base_buffer, Sbuffer_base_buffer,
        doc: /* Return the base buffer of indirect buffer BUFFER.
 If BUFFER is not indirect, return nil.
 BUFFER defaults to the current buffer.  */)
-     (buffer)
-     register Lisp_Object buffer;
+  (register Lisp_Object buffer)
 {
   struct buffer *base;
   Lisp_Object base_buffer;
@@ -931,9 +901,7 @@ DEFUN ("buffer-local-value", Fbuffer_local_value,
        doc: /* Return the value of VARIABLE in BUFFER.
 If VARIABLE does not have a buffer-local binding in BUFFER, the value
 is the default binding of the variable. */)
-     (variable, buffer)
-     register Lisp_Object variable;
-     register Lisp_Object buffer;
+  (register Lisp_Object variable, register Lisp_Object buffer)
 {
   register struct buffer *buf;
   register Lisp_Object result;
@@ -942,59 +910,49 @@ is the default binding of the variable. */)
   CHECK_SYMBOL (variable);
   CHECK_BUFFER (buffer);
   buf = XBUFFER (buffer);
+  sym = XSYMBOL (variable);
 
-  sym = indirect_variable (XSYMBOL (variable));
-  XSETSYMBOL (variable, sym);
-
-  /* Look in local_var_list */
-  result = Fassoc (variable, buf->local_var_alist);
-  if (NILP (result))
-    {
-      int offset, idx;
-      int found = 0;
-
-      /* Look in special slots */
-      /* 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 (undo_list);
-          offset < sizeof (struct buffer);
-          /* sizeof EMACS_INT == sizeof Lisp_Object */
-          offset += (sizeof (EMACS_INT)))
-       {
-         idx = PER_BUFFER_IDX (offset);
-         if ((idx == -1 || PER_BUFFER_VALUE_P (buf, idx))
-             && SYMBOLP (PER_BUFFER_SYMBOL (offset))
-             && EQ (PER_BUFFER_SYMBOL (offset), variable))
-           {
-             result = PER_BUFFER_VALUE (buf, offset);
-             found = 1;
-             break;
-           }
-       }
-
-      if (!found)
-       result = Fdefault_value (variable);
-    }
-  else
+ start:
+  switch (sym->redirect)
     {
-      Lisp_Object valcontents;
-      Lisp_Object current_alist_element;
-
-      /* What binding is loaded right now?  */
-      valcontents = sym->value;
-      current_alist_element
-       = XCAR (XBUFFER_LOCAL_VALUE (valcontents)->cdr);
-
-      /* The value of the currently loaded binding is not
-        stored in it, but rather in the realvalue slot.
-        Store that value into the binding it belongs to
-        in case that is the one we are about to use.  */
+    case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start;
+    case SYMBOL_PLAINVAL: result = SYMBOL_VAL (sym); break;
+    case SYMBOL_LOCALIZED:
+      { /* Look in local_var_alist.  */
+       struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym);
+       XSETSYMBOL (variable, sym); /* Update In case of aliasing.  */
+       result = Fassoc (variable, buf->local_var_alist);
+       if (!NILP (result))
+         {
+           if (blv->fwd)
+             { /* What binding is loaded right now?  */
+               Lisp_Object current_alist_element = blv->valcell;
 
-      Fsetcdr (current_alist_element,
-              do_symval_forwarding (XBUFFER_LOCAL_VALUE (valcontents)->realvalue));
+               /* The value of the currently loaded binding is not
+                  stored in it, but rather in the realvalue slot.
+                  Store that value into the binding it belongs to
+                  in case that is the one we are about to use.  */
 
-      /* Now get the (perhaps updated) value out of the binding.  */
-      result = XCDR (result);
+               XSETCDR (current_alist_element,
+                        do_symval_forwarding (blv->fwd));
+             }
+           /* Now get the (perhaps updated) value out of the binding.  */
+           result = XCDR (result);
+         }
+       else
+         result = Fdefault_value (variable);
+       break;
+      }
+    case SYMBOL_FORWARDED:
+      {
+       union Lisp_Fwd *fwd = SYMBOL_FWD (sym);
+       if (BUFFER_OBJFWDP (fwd))
+         result = PER_BUFFER_VALUE (buf, XBUFFER_OBJFWD (fwd)->offset);
+       else
+         result = Fdefault_value (variable);
+       break;
+      }
+    default: abort ();
     }
 
   if (!EQ (result, Qunbound))
@@ -1008,8 +966,7 @@ is the default binding of the variable. */)
    in special slots in the buffer object.  */
 
 static Lisp_Object
-buffer_lisp_local_variables (buf)
-     struct buffer *buf;
+buffer_lisp_local_variables (struct buffer *buf)
 {
   Lisp_Object result = Qnil;
   register Lisp_Object tail;
@@ -1029,12 +986,7 @@ buffer_lisp_local_variables (buf)
       if (buf != current_buffer)
        val = XCDR (elt);
 
-      /* If symbol is unbound, put just the symbol in the list.  */
-      if (EQ (val, Qunbound))
-       result = Fcons (XCAR (elt), result);
-      /* Otherwise, put (symbol . value) in the list.  */
-      else
-       result = Fcons (Fcons (XCAR (elt), val), result);
+      result = Fcons (Fcons (XCAR (elt), val), result);
     }
 
   return result;
@@ -1047,8 +999,7 @@ Most elements look like (SYMBOL . VALUE), describing one variable.
 For a symbol that is locally unbound, just the symbol appears in the value.
 Note that storing new VALUEs in these elements doesn't change the variables.
 No argument or nil as argument means use current buffer as BUFFER.  */)
-     (buffer)
-     register Lisp_Object buffer;
+  (register Lisp_Object buffer)
 {
   register struct buffer *buf;
   register Lisp_Object result;
@@ -1090,8 +1041,7 @@ DEFUN ("buffer-modified-p", Fbuffer_modified_p, Sbuffer_modified_p,
        0, 1, 0,
        doc: /* Return t if BUFFER was modified since its file was last read or saved.
 No argument or nil as argument means use current buffer as BUFFER.  */)
-     (buffer)
-     register Lisp_Object buffer;
+  (register Lisp_Object buffer)
 {
   register struct buffer *buf;
   if (NILP (buffer))
@@ -1109,8 +1059,7 @@ DEFUN ("set-buffer-modified-p", Fset_buffer_modified_p, Sset_buffer_modified_p,
        1, 1, 0,
        doc: /* Mark current buffer as modified or unmodified according to FLAG.
 A non-nil FLAG means mark the buffer modified.  */)
-     (flag)
-     register Lisp_Object flag;
+  (register Lisp_Object flag)
 {
   register int already;
   register Lisp_Object fn;
@@ -1179,8 +1128,7 @@ DEFUN ("restore-buffer-modified-p", Frestore_buffer_modified_p,
        doc: /* Like `set-buffer-modified-p', with a difference concerning redisplay.
 It is not ensured that mode lines will be updated to show the modified
 state of the current buffer.  Use with care.  */)
-     (flag)
-     Lisp_Object flag;
+  (Lisp_Object flag)
 {
 #ifdef CLASH_DETECTION
   Lisp_Object fn;
@@ -1210,8 +1158,7 @@ DEFUN ("buffer-modified-tick", Fbuffer_modified_tick, Sbuffer_modified_tick,
 Each buffer has a tick counter which is incremented each time the
 text in that buffer is changed.  It wraps around occasionally.
 No argument or nil as argument means use current buffer as BUFFER.  */)
-     (buffer)
-     register Lisp_Object buffer;
+  (register Lisp_Object buffer)
 {
   register struct buffer *buf;
   if (NILP (buffer))
@@ -1235,8 +1182,7 @@ values returned by two individual calls of `buffer-chars-modified-tick',
 you can tell whether a character change occurred in that buffer in
 between these calls.  No argument or nil as argument means use current
 buffer as BUFFER.  */)
-     (buffer)
-     register Lisp_Object buffer;
+  (register Lisp_Object buffer)
 {
   register struct buffer *buf;
   if (NILP (buffer))
@@ -1262,8 +1208,7 @@ If UNIQUE is non-nil, come up with a new name using
 Interactively, you can set UNIQUE with a prefix argument.
 We return the name we actually gave the buffer.
 This does not change the name of the visited file (if any).  */)
-     (newname, unique)
-     register Lisp_Object newname, unique;
+  (register Lisp_Object newname, Lisp_Object unique)
 {
   register Lisp_Object tem, buf;
 
@@ -1310,16 +1255,17 @@ If the optional third argument FRAME is non-nil, use that frame's
 buffer list instead of the selected frame's buffer list.
 If no other buffer exists, the buffer `*scratch*' is returned.
 If BUFFER is omitted or nil, some interesting buffer is returned.  */)
-     (buffer, visible_ok, frame)
-     register Lisp_Object buffer, visible_ok, frame;
+  (register Lisp_Object buffer, Lisp_Object visible_ok, Lisp_Object frame)
 {
-  Lisp_Object Fset_buffer_major_mode ();
+  Lisp_Object Fset_buffer_major_mode (Lisp_Object buffer);
   register Lisp_Object tail, buf, notsogood, tem, pred, add_ons;
   notsogood = Qnil;
 
   if (NILP (frame))
     frame = selected_frame;
 
+  CHECK_FRAME (frame);
+
   tail = Vbuffer_alist;
   pred = frame_buffer_predicate (frame);
 
@@ -1380,8 +1326,7 @@ DEFUN ("buffer-enable-undo", Fbuffer_enable_undo, Sbuffer_enable_undo,
        0, 1, "",
        doc: /* Start keeping undo information for buffer BUFFER.
 No argument or nil as argument means do this for the current buffer.  */)
-     (buffer)
-     register Lisp_Object buffer;
+  (register Lisp_Object buffer)
 {
   Lisp_Object real_buffer;
 
@@ -1422,8 +1367,7 @@ is running.
 
 Any processes that have this buffer as the `process-buffer' are killed
 with SIGHUP.  */)
-     (buffer_or_name)
-     Lisp_Object buffer_or_name;
+  (Lisp_Object buffer_or_name)
 {
   Lisp_Object buffer;
   register struct buffer *b;
@@ -1636,8 +1580,7 @@ with SIGHUP.  */)
    means that other_buffer is more likely to choose a relevant buffer.  */
 
 void
-record_buffer (buf)
-     Lisp_Object buf;
+record_buffer (Lisp_Object buf)
 {
   register Lisp_Object link, prev;
   Lisp_Object frame;
@@ -1713,8 +1656,7 @@ For the *scratch* buffer, use `initial-major-mode', otherwise choose a mode
 according to `default-major-mode'.
 Use this function before selecting the buffer, since it may need to inspect
 the current buffer's major mode.  */)
-     (buffer)
-     Lisp_Object buffer;
+  (Lisp_Object buffer)
 {
   int count;
   Lisp_Object function;
@@ -1752,8 +1694,7 @@ the current buffer's major mode.  */)
    If NORECORD is non-nil, don't call record_buffer.  */
 
 Lisp_Object
-switch_to_buffer_1 (buffer_or_name, norecord)
-     Lisp_Object buffer_or_name, norecord;
+switch_to_buffer_1 (Lisp_Object buffer_or_name, Lisp_Object norecord)
 {
   register Lisp_Object buffer;
 
@@ -1802,11 +1743,8 @@ its buffer, use `pop-to-buffer' for displaying the buffer.
 WARNING: This is NOT the way to work on another buffer temporarily
 within a Lisp program!  Use `set-buffer' instead.  That avoids
 messing with the window-buffer correspondences.  */)
-     (buffer_or_name, norecord)
-     Lisp_Object buffer_or_name, norecord;
+  (Lisp_Object buffer_or_name, Lisp_Object norecord)
 {
-  char *err;
-
   if (EQ (buffer_or_name, Fwindow_buffer (selected_window)))
     {
       /* Basically a NOP.  Avoid signalling an error in the case where
@@ -1834,7 +1772,7 @@ messing with the window-buffer correspondences.  */)
 
 DEFUN ("current-buffer", Fcurrent_buffer, Scurrent_buffer, 0, 0, 0,
        doc: /* Return the current buffer as a Lisp object.  */)
-     ()
+  (void)
 {
   register Lisp_Object buf;
   XSETBUFFER (buf, current_buffer);
@@ -1851,8 +1789,7 @@ DEFUN ("current-buffer", Fcurrent_buffer, Scurrent_buffer, 0, 0, 0,
    time, and that increments windows_or_buffers_changed.  */
 
 void
-set_buffer_internal (b)
-     register struct buffer *b;
+set_buffer_internal (register struct buffer *b)
 {
   if (current_buffer != b)
     set_buffer_internal_1 (b);
@@ -1862,12 +1799,10 @@ set_buffer_internal (b)
    This is used by redisplay.  */
 
 void
-set_buffer_internal_1 (b)
-     register struct buffer *b;
+set_buffer_internal_1 (register struct buffer *b)
 {
   register struct buffer *old_buf;
-  register Lisp_Object tail, valcontents;
-  Lisp_Object tem;
+  register Lisp_Object tail;
 
 #ifdef USE_MMAP_FOR_BUFFERS
   if (b->text->beg == NULL)
@@ -1939,42 +1874,28 @@ set_buffer_internal_1 (b)
   /* Look down buffer's list of local Lisp variables
      to find and update any that forward into C variables. */
 
-  for (tail = b->local_var_alist; CONSP (tail); tail = XCDR (tail))
+  do
     {
-      if (CONSP (XCAR (tail))
-         && SYMBOLP (XCAR (XCAR (tail)))
-         && (valcontents = SYMBOL_VALUE (XCAR (XCAR (tail))),
-             (BUFFER_LOCAL_VALUEP (valcontents)))
-         && (tem = XBUFFER_LOCAL_VALUE (valcontents)->realvalue,
-             (BOOLFWDP (tem) || INTFWDP (tem) || OBJFWDP (tem))))
-       /* Just reference the variable to cause it to become set for
-          this buffer.  */
-       Fsymbol_value (XCAR (XCAR (tail)));
+      for (tail = b->local_var_alist; CONSP (tail); tail = XCDR (tail))
+       {
+         Lisp_Object var = XCAR (XCAR (tail));
+         struct Lisp_Symbol *sym = XSYMBOL (var);
+         if (sym->redirect == SYMBOL_LOCALIZED /* Just to be sure.  */
+             && SYMBOL_BLV (sym)->fwd)
+           /* Just reference the variable
+              to cause it to become set for this buffer.  */
+           Fsymbol_value (var);
+       }
     }
-
   /* Do the same with any others that were local to the previous buffer */
-
-  if (old_buf)
-    for (tail = old_buf->local_var_alist; CONSP (tail); tail = XCDR (tail))
-      {
-       if (CONSP (tail)
-           && SYMBOLP (XCAR (XCAR (tail)))
-           && (valcontents = SYMBOL_VALUE (XCAR (XCAR (tail))),
-               (BUFFER_LOCAL_VALUEP (valcontents)))
-           && (tem = XBUFFER_LOCAL_VALUE (valcontents)->realvalue,
-               (BOOLFWDP (tem) || INTFWDP (tem) || OBJFWDP (tem))))
-         /* Just reference the variable to cause it to become set for
-            this buffer.  */
-         Fsymbol_value (XCAR (XCAR (tail)));
-      }
+  while (b != old_buf && (b = old_buf, b));
 }
 
 /* Switch to buffer B temporarily for redisplay purposes.
    This avoids certain things that don't need to be done within redisplay.  */
 
 void
-set_buffer_temp (b)
-     struct buffer *b;
+set_buffer_temp (struct buffer *b)
 {
   register struct buffer *old_buf;
 
@@ -2037,8 +1958,7 @@ also `save-excursion' when you want to make a buffer current
 temporarily.  This function does not display the buffer, so its effect
 ends when the current command terminates.  Use `switch-to-buffer' or
 `pop-to-buffer' to switch buffers permanently.  */)
-     (buffer_or_name)
-     register Lisp_Object buffer_or_name;
+  (register Lisp_Object buffer_or_name)
 {
   register Lisp_Object buffer;
   buffer = Fget_buffer (buffer_or_name);
@@ -2053,8 +1973,7 @@ ends when the current command terminates.  Use `switch-to-buffer' or
 /* Set the current buffer to BUFFER provided it is alive.  */
 
 Lisp_Object
-set_buffer_if_live (buffer)
-     Lisp_Object buffer;
+set_buffer_if_live (Lisp_Object buffer)
 {
   if (! NILP (XBUFFER (buffer)->name))
     Fset_buffer (buffer);
@@ -2064,7 +1983,7 @@ set_buffer_if_live (buffer)
 DEFUN ("barf-if-buffer-read-only", Fbarf_if_buffer_read_only,
                                   Sbarf_if_buffer_read_only, 0, 0, 0,
        doc: /* Signal a `buffer-read-only' error if the current buffer is read-only.  */)
-     ()
+  (void)
 {
   if (!NILP (current_buffer->read_only)
       && NILP (Vinhibit_read_only))
@@ -2084,8 +2003,7 @@ from the selected window if it is displayed there.  If the selected
 window is dedicated to its buffer, delete that window if there are other
 windows on the same frame.  If the selected window is the only window on
 its frame, iconify that frame.  */)
-     (buffer_or_name)
-     register Lisp_Object buffer_or_name;
+  (register Lisp_Object buffer_or_name)
 {
   Lisp_Object buffer;
 
@@ -2139,7 +2057,7 @@ DEFUN ("erase-buffer", Ferase_buffer, Serase_buffer, 0, 0, "*",
        doc: /* Delete the entire contents of the current buffer.
 Any narrowing restriction in effect (see `narrow-to-region') is removed,
 so the buffer is truly empty after this.  */)
-     ()
+  (void)
 {
   Fwiden ();
 
@@ -2154,8 +2072,7 @@ so the buffer is truly empty after this.  */)
 }
 
 void
-validate_region (b, e)
-     register Lisp_Object *b, *e;
+validate_region (register Lisp_Object *b, register Lisp_Object *e)
 {
   CHECK_NUMBER_COERCE_MARKER (*b);
   CHECK_NUMBER_COERCE_MARKER (*e);
@@ -2175,8 +2092,7 @@ validate_region (b, e)
    and return the adjusted position.  */
 
 static int
-advance_to_char_boundary (byte_pos)
-     int byte_pos;
+advance_to_char_boundary (int byte_pos)
 {
   int c;
 
@@ -2209,21 +2125,20 @@ advance_to_char_boundary (byte_pos)
 }
 
 #ifdef REL_ALLOC
-extern void r_alloc_reset_variable P_ ((POINTER_TYPE *, POINTER_TYPE *));
+extern void r_alloc_reset_variable (POINTER_TYPE *, POINTER_TYPE *);
 #endif /* REL_ALLOC */
 
 DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text,
        1, 1, 0,
        doc: /* Swap the text between current buffer and BUFFER.  */)
-     (buffer)
-     Lisp_Object buffer;
+  (Lisp_Object buffer)
 {
   struct buffer *other_buffer;
   CHECK_BUFFER (buffer);
   other_buffer = XBUFFER (buffer);
 
   if (NILP (other_buffer->name))
-    error ("Cannot swap a dead buffer's text");    
+    error ("Cannot swap a dead buffer's text");
 
   /* Actually, it probably works just fine.
    * if (other_buffer == current_buffer)
@@ -2279,6 +2194,8 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text,
   swapfield (undo_list, Lisp_Object);
   swapfield (mark, Lisp_Object);
   swapfield (enable_multibyte_characters, Lisp_Object);
+  swapfield (bidi_display_reordering, Lisp_Object);
+  swapfield (bidi_paragraph_direction, Lisp_Object);
   /* FIXME: Not sure what we should do with these *_marker fields.
      Hopefully they're just nil anyway.  */
   swapfield (pt_marker, Lisp_Object);
@@ -2352,8 +2269,7 @@ If FLAG is `to', this makes the buffer a multibyte buffer by changing
 all eight-bit bytes to eight-bit characters.
 If the multibyte flag was really changed, undo information of the
 current buffer is cleared.  */)
-     (flag)
-     Lisp_Object flag;
+  (Lisp_Object flag)
 {
   struct Lisp_Marker *tail, *markers;
   struct buffer *other;
@@ -2468,7 +2384,7 @@ current buffer is cleared.  */)
          unsigned char *p = GPT_ADDR - 1;
 
          while (! CHAR_HEAD_P (*p) && p > BEG_ADDR) p--;
-         if (BASE_LEADING_CODE_P (*p))
+         if (LEADING_CODE_P (*p))
            {
              int new_gpt = GPT_BYTE - (GPT_ADDR - p);
 
@@ -2592,7 +2508,6 @@ current buffer is cleared.  */)
   if (!EQ (old_undo, Qt))
     {
       /* Represent all the above changes by a special undo entry.  */
-      extern Lisp_Object Qapply;
       current_buffer->undo_list = Fcons (list3 (Qapply,
                                                intern ("set-buffer-multibyte"),
                                                NILP (flag) ? Qt : Qnil),
@@ -2620,7 +2535,6 @@ current buffer is cleared.  */)
   if (!modified_p && !NILP (Fbuffer_modified_p (Qnil)))
     Fset_buffer_modified_p (Qnil);
 
-#ifdef subprocesses
   /* Update coding systems of this buffer's process (if any).  */
   {
     Lisp_Object process;
@@ -2629,7 +2543,6 @@ current buffer is cleared.  */)
     if (PROCESSP (process))
       setup_process_coding_systems (process);
   }
-#endif /* subprocesses */
 
   return flag;
 }
@@ -2651,7 +2564,7 @@ a non-nil `permanent-local' property are not eliminated by this function.
 
 The first thing this function does is run
 the normal hook `change-major-mode-hook'.  */)
-     ()
+  (void)
 {
   if (!NILP (Vrun_hooks))
     call1 (Vrun_hooks, Qchange_major_mode_hook);
@@ -2676,26 +2589,24 @@ the normal hook `change-major-mode-hook'.  */)
    for their current values.  */
 
 static void
-swap_out_buffer_local_variables (b)
-     struct buffer *b;
+swap_out_buffer_local_variables (struct buffer *b)
 {
-  Lisp_Object oalist, alist, sym, buffer;
+  Lisp_Object oalist, alist, buffer;
 
   XSETBUFFER (buffer, b);
   oalist = b->local_var_alist;
 
   for (alist = oalist; CONSP (alist); alist = XCDR (alist))
     {
-      if (CONSP (XCAR (alist))
-         && (sym = XCAR (XCAR (alist)), SYMBOLP (sym))
-         /* Need not do anything if some other buffer's binding is
-            now encached.  */
-         && EQ (XBUFFER_LOCAL_VALUE (SYMBOL_VALUE (sym))->buffer,
-                buffer))
+      Lisp_Object sym = XCAR (XCAR (alist));
+      eassert (XSYMBOL (sym)->redirect == SYMBOL_LOCALIZED);
+      /* Need not do anything if some other buffer's binding is
+        now encached.  */
+      if (EQ (SYMBOL_BLV (XSYMBOL (sym))->where, buffer))
        {
          /* Symbol is set up for this buffer's old local value:
             swap it out!  */
-         swap_in_global_binding (sym);
+         swap_in_global_binding (XSYMBOL (sym));
        }
     }
 }
@@ -2723,14 +2634,8 @@ swap_out_buffer_local_variables (b)
    default (BEGV or ZV).  */
 
 int
-overlays_at (pos, extend, vec_ptr, len_ptr, next_ptr, prev_ptr, change_req)
-     EMACS_INT pos;
-     int extend;
-     Lisp_Object **vec_ptr;
-     int *len_ptr;
-     EMACS_INT *next_ptr;
-     EMACS_INT *prev_ptr;
-     int change_req;
+overlays_at (EMACS_INT pos, int extend, Lisp_Object **vec_ptr, int *len_ptr,
+            EMACS_INT *next_ptr, EMACS_INT *prev_ptr, int change_req)
 {
   Lisp_Object overlay, start, end;
   struct Lisp_Overlay *tail;
@@ -2868,13 +2773,8 @@ overlays_at (pos, extend, vec_ptr, len_ptr, next_ptr, prev_ptr, change_req)
    But we still return the total number of overlays.  */
 
 static int
-overlays_in (beg, end, extend, vec_ptr, len_ptr, next_ptr, prev_ptr)
-     int beg, end;
-     int extend;
-     Lisp_Object **vec_ptr;
-     int *len_ptr;
-     int *next_ptr;
-     int *prev_ptr;
+overlays_in (int beg, int end, int extend, Lisp_Object **vec_ptr, int *len_ptr,
+            int *next_ptr, int *prev_ptr)
 {
   Lisp_Object overlay, ostart, oend;
   struct Lisp_Overlay *tail;
@@ -2995,8 +2895,7 @@ overlays_in (beg, end, extend, vec_ptr, len_ptr, next_ptr, prev_ptr)
    `mouse-face' property overlapping OVERLAY.  */
 
 int
-mouse_face_overlay_overlaps (overlay)
-     Lisp_Object overlay;
+mouse_face_overlay_overlaps (Lisp_Object overlay)
 {
   int start = OVERLAY_POSITION (OVERLAY_START (overlay));
   int end = OVERLAY_POSITION (OVERLAY_END (overlay));
@@ -3025,8 +2924,7 @@ mouse_face_overlay_overlaps (overlay)
 \f
 /* Fast function to just test if we're at an overlay boundary.  */
 int
-overlay_touches_p (pos)
-     int pos;
+overlay_touches_p (int pos)
 {
   Lisp_Object overlay;
   struct Lisp_Overlay *tail;
@@ -3071,8 +2969,7 @@ struct sortvec
 };
 
 static int
-compare_overlays (v1, v2)
-     const void *v1, *v2;
+compare_overlays (const void *v1, const void *v2)
 {
   const struct sortvec *s1 = (const struct sortvec *) v1;
   const struct sortvec *s2 = (const struct sortvec *) v2;
@@ -3089,10 +2986,7 @@ compare_overlays (v1, v2)
    The return value is the new size; this may be smaller than the original
    size if some of the overlays were invalid or were window-specific.  */
 int
-sort_overlays (overlay_vec, noverlays, w)
-     Lisp_Object *overlay_vec;
-     int noverlays;
-     struct window *w;
+sort_overlays (Lisp_Object *overlay_vec, int noverlays, struct window *w)
 {
   int i, j;
   struct sortvec *sortvec;
@@ -3172,8 +3066,7 @@ static int overlay_str_len;
 
 /* A comparison function suitable for passing to qsort.  */
 static int
-cmp_for_strings (as1, as2)
-     char *as1, *as2;
+cmp_for_strings (const void *as1, const void *as2)
 {
   struct sortstr *s1 = (struct sortstr *)as1;
   struct sortstr *s2 = (struct sortstr *)as2;
@@ -3185,10 +3078,7 @@ cmp_for_strings (as1, as2)
 }
 
 static void
-record_overlay_string (ssl, str, str2, pri, size)
-     struct sortstrlist *ssl;
-     Lisp_Object str, str2, pri;
-     int size;
+record_overlay_string (struct sortstrlist *ssl, Lisp_Object str, Lisp_Object str2, Lisp_Object pri, int size)
 {
   int nbytes;
 
@@ -3244,10 +3134,7 @@ record_overlay_string (ssl, str, str2, pri, size)
    subsequent calls.  */
 
 int
-overlay_strings (pos, w, pstr)
-     EMACS_INT pos;
-     struct window *w;
-     unsigned char **pstr;
+overlay_strings (EMACS_INT pos, struct window *w, unsigned char **pstr)
 {
   Lisp_Object overlay, window, str;
   struct Lisp_Overlay *ov;
@@ -3370,9 +3257,7 @@ overlay_strings (pos, w, pstr)
 /* Shift overlays in BUF's overlay lists, to center the lists at POS.  */
 
 void
-recenter_overlay_lists (buf, pos)
-     struct buffer *buf;
-     EMACS_INT pos;
+recenter_overlay_lists (struct buffer *buf, EMACS_INT pos)
 {
   Lisp_Object overlay, beg, end;
   struct Lisp_Overlay *prev, *tail, *next;
@@ -3521,9 +3406,7 @@ recenter_overlay_lists (buf, pos)
 }
 
 void
-adjust_overlays_for_insert (pos, length)
-     EMACS_INT pos;
-     EMACS_INT length;
+adjust_overlays_for_insert (EMACS_INT pos, EMACS_INT length)
 {
   /* After an insertion, the lists are still sorted properly,
      but we may need to update the value of the overlay center.  */
@@ -3532,9 +3415,7 @@ adjust_overlays_for_insert (pos, length)
 }
 
 void
-adjust_overlays_for_delete (pos, length)
-     EMACS_INT pos;
-     EMACS_INT length;
+adjust_overlays_for_delete (EMACS_INT pos, EMACS_INT length)
 {
   if (current_buffer->overlay_center < pos)
     /* The deletion was to our right.  No change needed; the before- and
@@ -3559,8 +3440,7 @@ adjust_overlays_for_delete (pos, 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 (start, end)
-     register int start, end;
+fix_start_end_in_overlays (register int start, register int end)
 {
   Lisp_Object overlay;
   struct Lisp_Overlay *before_list, *after_list;
@@ -3706,9 +3586,7 @@ fix_start_end_in_overlays (start, end)
    was at PREV, and now is at POS.  */
 
 void
-fix_overlays_before (bp, prev, pos)
-     struct buffer *bp;
-     EMACS_INT prev, pos;
+fix_overlays_before (struct buffer *bp, EMACS_INT prev, EMACS_INT pos)
 {
   /* If parent is nil, replace overlays_before; otherwise, parent->next.  */
   struct Lisp_Overlay *tail = bp->overlays_before, *parent = NULL, *right_pair;
@@ -3787,8 +3665,7 @@ fix_overlays_before (bp, prev, pos)
 \f
 DEFUN ("overlayp", Foverlayp, Soverlayp, 1, 1, 0,
        doc: /* Return t if OBJECT is an overlay.  */)
-     (object)
-     Lisp_Object object;
+  (Lisp_Object object)
 {
   return (OVERLAYP (object) ? Qt : Qnil);
 }
@@ -3803,9 +3680,7 @@ for the front of the overlay advance when text is inserted there
 The fifth arg REAR-ADVANCE, if non-nil, makes the marker
 for the rear of the overlay advance when text is inserted there
 \(which means the text *is* included in the overlay).  */)
-     (beg, end, buffer, front_advance, rear_advance)
-     Lisp_Object beg, end, buffer;
-     Lisp_Object front_advance, rear_advance;
+  (Lisp_Object beg, Lisp_Object end, Lisp_Object buffer, Lisp_Object front_advance, Lisp_Object rear_advance)
 {
   Lisp_Object overlay;
   struct buffer *b;
@@ -3874,9 +3749,7 @@ 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 (buf, start, end)
-     struct buffer *buf;
-     EMACS_INT start, end;
+modify_overlay (struct buffer *buf, EMACS_INT start, EMACS_INT end)
 {
   if (start > end)
     {
@@ -3903,11 +3776,10 @@ modify_overlay (buf, start, end)
 }
 
 \f
-Lisp_Object Fdelete_overlay ();
+Lisp_Object Fdelete_overlay (Lisp_Object overlay);
 
 static struct Lisp_Overlay *
-unchain_overlay (list, overlay)
-     struct Lisp_Overlay *list, *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)
@@ -3928,8 +3800,7 @@ DEFUN ("move-overlay", Fmove_overlay, Smove_overlay, 3, 4, 0,
 If BUFFER is omitted, leave OVERLAY in the same buffer it inhabits now.
 If BUFFER is omitted, and OVERLAY is in no buffer, put it in the current
 buffer.  */)
-     (overlay, beg, end, buffer)
-     Lisp_Object overlay, beg, end, buffer;
+  (Lisp_Object overlay, Lisp_Object beg, Lisp_Object end, Lisp_Object buffer)
 {
   struct buffer *b, *ob;
   Lisp_Object obuffer;
@@ -4038,8 +3909,7 @@ buffer.  */)
 
 DEFUN ("delete-overlay", Fdelete_overlay, Sdelete_overlay, 1, 1, 0,
        doc: /* Delete the overlay OVERLAY from its buffer.  */)
-     (overlay)
-     Lisp_Object overlay;
+  (Lisp_Object overlay)
 {
   Lisp_Object buffer;
   struct buffer *b;
@@ -4079,8 +3949,7 @@ DEFUN ("delete-overlay", Fdelete_overlay, Sdelete_overlay, 1, 1, 0,
 
 DEFUN ("overlay-start", Foverlay_start, Soverlay_start, 1, 1, 0,
        doc: /* Return the position at which OVERLAY starts.  */)
-     (overlay)
-     Lisp_Object overlay;
+  (Lisp_Object overlay)
 {
   CHECK_OVERLAY (overlay);
 
@@ -4089,8 +3958,7 @@ DEFUN ("overlay-start", Foverlay_start, Soverlay_start, 1, 1, 0,
 
 DEFUN ("overlay-end", Foverlay_end, Soverlay_end, 1, 1, 0,
        doc: /* Return the position at which OVERLAY ends.  */)
-     (overlay)
-     Lisp_Object overlay;
+  (Lisp_Object overlay)
 {
   CHECK_OVERLAY (overlay);
 
@@ -4100,8 +3968,7 @@ DEFUN ("overlay-end", Foverlay_end, Soverlay_end, 1, 1, 0,
 DEFUN ("overlay-buffer", Foverlay_buffer, Soverlay_buffer, 1, 1, 0,
        doc: /* Return the buffer OVERLAY belongs to.
 Return nil if OVERLAY has been deleted.  */)
-     (overlay)
-       Lisp_Object overlay;
+  (Lisp_Object overlay)
 {
   CHECK_OVERLAY (overlay);
 
@@ -4112,8 +3979,7 @@ DEFUN ("overlay-properties", Foverlay_properties, Soverlay_properties, 1, 1, 0,
        doc: /* Return a list of the properties on OVERLAY.
 This is a copy of OVERLAY's plist; modifying its conses has no effect on
 OVERLAY.  */)
-     (overlay)
-    Lisp_Object overlay;
+  (Lisp_Object overlay)
 {
   CHECK_OVERLAY (overlay);
 
@@ -4123,8 +3989,7 @@ OVERLAY.  */)
 \f
 DEFUN ("overlays-at", Foverlays_at, Soverlays_at, 1, 1, 0,
        doc: /* Return a list of the overlays that contain the character at POS.  */)
-     (pos)
-     Lisp_Object pos;
+  (Lisp_Object pos)
 {
   int noverlays;
   Lisp_Object *overlay_vec;
@@ -4156,8 +4021,7 @@ and also contained within the specified region.
 Empty overlays are included in the result if they are located at BEG,
 between BEG and END, or at END provided END denotes the position at the
 end of the buffer.  */)
-     (beg, end)
-     Lisp_Object beg, end;
+  (Lisp_Object beg, Lisp_Object end)
 {
   int noverlays;
   Lisp_Object *overlay_vec;
@@ -4187,8 +4051,7 @@ DEFUN ("next-overlay-change", Fnext_overlay_change, Snext_overlay_change,
        doc: /* Return the next position after POS where an overlay starts or ends.
 If there are no overlay boundaries from POS to (point-max),
 the value is (point-max).  */)
-     (pos)
-     Lisp_Object pos;
+  (Lisp_Object pos)
 {
   int noverlays;
   EMACS_INT endpos;
@@ -4229,8 +4092,7 @@ DEFUN ("previous-overlay-change", Fprevious_overlay_change,
        doc: /* Return the previous position before POS where an overlay starts or ends.
 If there are no overlay boundaries from (point-min) to POS,
 the value is (point-min).  */)
-     (pos)
-     Lisp_Object pos;
+  (Lisp_Object pos)
 {
   int noverlays;
   EMACS_INT prevpos;
@@ -4266,7 +4128,7 @@ the cdr has all the overlays after the overlay center.
 Recentering overlays moves overlays between these lists.
 The lists you get are copies, so that changing them has no effect.
 However, the overlays you get are the real objects that the buffer uses.  */)
-     ()
+  (void)
 {
   struct Lisp_Overlay *ol;
   Lisp_Object before = Qnil, after = Qnil, tmp;
@@ -4287,8 +4149,7 @@ DEFUN ("overlay-recenter", Foverlay_recenter, Soverlay_recenter, 1, 1, 0,
        doc: /* Recenter the overlays of the current buffer around position POS.
 That makes overlay lookup faster for positions near POS (but perhaps slower
 for positions far away from POS).  */)
-     (pos)
-     Lisp_Object pos;
+  (Lisp_Object pos)
 {
   CHECK_NUMBER_COERCE_MARKER (pos);
 
@@ -4298,8 +4159,7 @@ for positions far away from POS).  */)
 \f
 DEFUN ("overlay-get", Foverlay_get, Soverlay_get, 2, 2, 0,
        doc: /* Get the property of overlay OVERLAY with property name PROP.  */)
-     (overlay, prop)
-     Lisp_Object overlay, prop;
+  (Lisp_Object overlay, Lisp_Object prop)
 {
   CHECK_OVERLAY (overlay);
   return lookup_char_property (XOVERLAY (overlay)->plist, prop, 0);
@@ -4307,8 +4167,7 @@ DEFUN ("overlay-get", Foverlay_get, Soverlay_get, 2, 2, 0,
 
 DEFUN ("overlay-put", Foverlay_put, Soverlay_put, 3, 3, 0,
        doc: /* Set one property of overlay OVERLAY: give property PROP value VALUE.  */)
-     (overlay, prop, value)
-     Lisp_Object overlay, prop, value;
+  (Lisp_Object overlay, Lisp_Object prop, Lisp_Object value)
 {
   Lisp_Object tail, buffer;
   int changed;
@@ -4366,13 +4225,12 @@ static int last_overlay_modification_hooks_used;
    to the end of last_overlay_modification_hooks.  */
 
 static void
-add_overlay_mod_hooklist (functionlist, overlay)
-     Lisp_Object functionlist, overlay;
+add_overlay_mod_hooklist (Lisp_Object functionlist, Lisp_Object overlay)
 {
   int oldsize = XVECTOR (last_overlay_modification_hooks)->size;
 
   if (last_overlay_modification_hooks_used == oldsize)
-    last_overlay_modification_hooks = larger_vector 
+    last_overlay_modification_hooks = larger_vector
       (last_overlay_modification_hooks, oldsize * 2, Qnil);
   ASET (last_overlay_modification_hooks, last_overlay_modification_hooks_used,
        functionlist); last_overlay_modification_hooks_used++;
@@ -4395,10 +4253,8 @@ add_overlay_mod_hooklist (functionlist, overlay)
    and the length of deleted or replaced old text.  */
 
 void
-report_overlay_modification (start, end, after, arg1, arg2, arg3)
-     Lisp_Object start, end;
-     int after;
-     Lisp_Object arg1, arg2, arg3;
+report_overlay_modification (Lisp_Object start, Lisp_Object end, int after,
+                            Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3)
 {
   Lisp_Object prop, overlay;
   struct Lisp_Overlay *tail;
@@ -4506,8 +4362,8 @@ report_overlay_modification (start, end, after, arg1, arg2, arg3)
     Lisp_Object *copy = (Lisp_Object *) alloca (size * sizeof (Lisp_Object));
     int i;
 
-    bcopy (XVECTOR (last_overlay_modification_hooks)->contents,
-          copy, size * sizeof (Lisp_Object));
+    memcpy (copy, XVECTOR (last_overlay_modification_hooks)->contents,
+           size * sizeof (Lisp_Object));
     gcpro1.var = copy;
     gcpro1.nvars = size;
 
@@ -4523,10 +4379,8 @@ report_overlay_modification (start, end, after, arg1, arg2, arg3)
 }
 
 static void
-call_overlay_mod_hooks (list, overlay, after, arg1, arg2, arg3)
-     Lisp_Object list, overlay;
-     int after;
-     Lisp_Object arg1, arg2, arg3;
+call_overlay_mod_hooks (Lisp_Object list, Lisp_Object overlay, int after,
+                       Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3)
 {
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
 
@@ -4546,8 +4400,7 @@ call_overlay_mod_hooks (list, overlay, after, arg1, arg2, arg3)
 /* Delete any zero-sized overlays at position POS, if the `evaporate'
    property is set.  */
 void
-evaporate_overlays (pos)
-     EMACS_INT pos;
+evaporate_overlays (EMACS_INT pos)
 {
   Lisp_Object overlay, hit_list;
   struct Lisp_Overlay *tail;
@@ -4585,9 +4438,7 @@ evaporate_overlays (pos)
    in the slot with offset OFFSET.  */
 
 void
-buffer_slot_type_mismatch (newval, type)
-     Lisp_Object newval;
-     int type;
+buffer_slot_type_mismatch (Lisp_Object newval, int type)
 {
   Lisp_Object predicate;
 
@@ -4625,7 +4476,6 @@ buffer_slot_type_mismatch (newval, type)
 #endif
 
 #include <stdio.h>
-#include <errno.h>
 
 #if MAP_ANON == 0
 #include <fcntl.h>
@@ -4727,13 +4577,13 @@ static int mmap_initialized_p;
 
 /* Function prototypes.  */
 
-static int mmap_free_1 P_ ((struct mmap_region *));
-static int mmap_enlarge P_ ((struct mmap_region *, int));
-static struct mmap_region *mmap_find P_ ((POINTER_TYPE *, POINTER_TYPE *));
-static POINTER_TYPE *mmap_alloc P_ ((POINTER_TYPE **, size_t));
-static POINTER_TYPE *mmap_realloc P_ ((POINTER_TYPE **, size_t));
-static void mmap_free P_ ((POINTER_TYPE **ptr));
-static void mmap_init P_ ((void));
+static int mmap_free_1 (struct mmap_region *);
+static int mmap_enlarge (struct mmap_region *, int);
+static struct mmap_region *mmap_find (POINTER_TYPE *, POINTER_TYPE *);
+static POINTER_TYPE *mmap_alloc (POINTER_TYPE **, size_t);
+static POINTER_TYPE *mmap_realloc (POINTER_TYPE **, size_t);
+static void mmap_free (POINTER_TYPE **ptr);
+static void mmap_init (void);
 
 
 /* Return a region overlapping address range START...END, or null if
@@ -4976,7 +4826,7 @@ mmap_realloc (var, nbytes)
            }
          else if (mmap_alloc (var, nbytes))
            {
-             bcopy (old_ptr, *var, r->nbytes_specified);
+             memcpy (*var, old_ptr, r->nbytes_specified);
              mmap_free_1 (MMAP_REGION (old_ptr));
              result = *var;
              r = MMAP_REGION (result);
@@ -5066,18 +4916,16 @@ mmap_init ()
  ***********************************************************************/
 
 #ifdef REL_ALLOC
-extern POINTER_TYPE *r_alloc P_ ((POINTER_TYPE **, size_t));
-extern POINTER_TYPE *r_re_alloc P_ ((POINTER_TYPE **, size_t));
-extern void r_alloc_free P_ ((POINTER_TYPE **ptr));
+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);
 #endif /* REL_ALLOC */
 
 
 /* Allocate NBYTES bytes for buffer B's text buffer.  */
 
 static void
-alloc_buffer_text (b, nbytes)
-     struct buffer *b;
-     size_t nbytes;
+alloc_buffer_text (struct buffer *b, size_t nbytes)
 {
   POINTER_TYPE *p;
 
@@ -5132,8 +4980,7 @@ enlarge_buffer_text (struct buffer *b, EMACS_INT delta)
 /* Free buffer B's text buffer.  */
 
 static void
-free_buffer_text (b)
-     struct buffer *b;
+free_buffer_text (struct buffer *b)
 {
   BLOCK_INPUT;
 
@@ -5156,16 +5003,18 @@ free_buffer_text (b)
  ***********************************************************************/
 
 void
-init_buffer_once ()
+init_buffer_once (void)
 {
   int idx;
 
-  bzero (buffer_permanent_local_flags, sizeof buffer_permanent_local_flags);
+  memset (buffer_permanent_local_flags, 0, sizeof buffer_permanent_local_flags);
 
   /* Make sure all markable slots in buffer_defaults
      are initialized reasonably, so mark_buffer won't choke.  */
   reset_buffer (&buffer_defaults);
+  eassert (EQ (buffer_defaults.name, make_number (0)));
   reset_buffer_local_variables (&buffer_defaults, 1);
+  eassert (EQ (buffer_local_symbols.name, make_number (0)));
   reset_buffer (&buffer_local_symbols);
   reset_buffer_local_variables (&buffer_local_symbols, 1);
   /* Prevent GC from getting confused.  */
@@ -5206,7 +5055,8 @@ init_buffer_once ()
   buffer_defaults.truncate_lines = Qnil;
   buffer_defaults.word_wrap = Qnil;
   buffer_defaults.ctl_arrow = Qt;
-  buffer_defaults.direction_reversed = Qnil;
+  buffer_defaults.bidi_display_reordering = Qnil;
+  buffer_defaults.bidi_paragraph_direction = Qnil;
   buffer_defaults.cursor_type = Qt;
   buffer_defaults.extra_line_spacing = Qnil;
   buffer_defaults.cursor_in_non_selected_windows = Qt;
@@ -5245,7 +5095,7 @@ init_buffer_once ()
   if (sizeof (EMACS_INT) != sizeof (Lisp_Object)) abort ();
 
   /* 0 means not a lisp var, -1 means always local, else mask */
-  bzero (&buffer_local_flags, sizeof buffer_local_flags);
+  memset (&buffer_local_flags, 0, sizeof buffer_local_flags);
   XSETINT (buffer_local_flags.filename, -1);
   XSETINT (buffer_local_flags.directory, -1);
   XSETINT (buffer_local_flags.backed_up, -1);
@@ -5291,7 +5141,8 @@ init_buffer_once ()
   XSETFASTINT (buffer_local_flags.syntax_table, idx); ++idx;
   XSETFASTINT (buffer_local_flags.cache_long_line_scans, idx); ++idx;
   XSETFASTINT (buffer_local_flags.category_table, idx); ++idx;
-  XSETFASTINT (buffer_local_flags.direction_reversed, idx); ++idx;
+  XSETFASTINT (buffer_local_flags.bidi_display_reordering, idx); ++idx;
+  XSETFASTINT (buffer_local_flags.bidi_paragraph_direction, idx); ++idx;
   XSETFASTINT (buffer_local_flags.buffer_file_coding_system, idx);
   /* Make this one a permanent local.  */
   buffer_permanent_local_flags[idx++] = 1;
@@ -5348,7 +5199,7 @@ init_buffer_once ()
 }
 
 void
-init_buffer ()
+init_buffer (void)
 {
   char *pwd;
   Lisp_Object temp;
@@ -5420,33 +5271,37 @@ init_buffer ()
    in the buffer that is current now. */
 
 /* TYPE is nil for a general Lisp variable.
-   An integer specifies a type; then only LIsp values
+   An integer specifies a type; then only Lisp values
    with that type code are allowed (except that nil is allowed too).
-   LNAME is the LIsp-level variable name.
+   LNAME is the Lisp-level variable name.
    VNAME is the name of the buffer slot.
    DOC is a dummy where you write the doc string as a comment.  */
-#define DEFVAR_PER_BUFFER(lname, vname, type, doc)  \
- defvar_per_buffer (lname, vname, type, 0)
+#define DEFVAR_PER_BUFFER(lname, vname, type, doc)                     \
+  do {                                                                 \
+    static struct Lisp_Buffer_Objfwd bo_fwd;                           \
+    defvar_per_buffer (&bo_fwd, lname, vname, type, 0);                        \
+  } while (0)
 
 static void
-defvar_per_buffer (namestring, address, type, doc)
-     char *namestring;
-     Lisp_Object *address;
-     Lisp_Object type;
-     char *doc;
+defvar_per_buffer (struct Lisp_Buffer_Objfwd *bo_fwd, const char *namestring,
+                  Lisp_Object *address, Lisp_Object type, char *doc)
 {
-  Lisp_Object sym, val;
+  struct Lisp_Symbol *sym;
   int offset;
 
-  sym = intern (namestring);
-  val = allocate_misc ();
+  sym = XSYMBOL (intern (namestring));
   offset = (char *)address - (char *)current_buffer;
 
-  XMISCTYPE (val) = Lisp_Misc_Buffer_Objfwd;
-  XBUFFER_OBJFWD (val)->offset = offset;
-  XBUFFER_OBJFWD (val)->slottype = type;
-  SET_SYMBOL_VALUE (sym, val);
-  PER_BUFFER_SYMBOL (offset) = sym;
+  bo_fwd->type = Lisp_Fwd_Buffer_Obj;
+  bo_fwd->offset = offset;
+  bo_fwd->slottype = type;
+  sym->redirect = SYMBOL_FORWARDED;
+  {
+    /* I tried to do the job without a cast, but it seems impossible.
+       union Lisp_Fwd *fwd; &(fwd->u_buffer_objfwd) = bo_fwd;  */
+    SET_SYMBOL_FWD (sym, (union Lisp_Fwd *)bo_fwd);
+  }
+  XSETSYMBOL (PER_BUFFER_SYMBOL (offset), sym);
 
   if (PER_BUFFER_IDX (offset) == 0)
     /* Did a DEFVAR_PER_BUFFER without initializing the corresponding
@@ -5457,7 +5312,7 @@ defvar_per_buffer (namestring, address, type, doc)
 
 /* initialize the buffer routines */
 void
-syms_of_buffer ()
+syms_of_buffer (void)
 {
   staticpro (&last_overlay_modification_hooks);
   last_overlay_modification_hooks
@@ -5488,8 +5343,6 @@ syms_of_buffer ()
   staticpro (&Qget_file_buffer);
   Qpriority = intern_c_string ("priority");
   staticpro (&Qpriority);
-  Qwindow = intern_c_string ("window");
-  staticpro (&Qwindow);
   Qbefore_string = intern_c_string ("before-string");
   staticpro (&Qbefore_string);
   Qafter_string = intern_c_string ("after-string");
@@ -5548,11 +5401,6 @@ This is the same as (default-value 'abbrev-mode).  */);
                     doc: /* Default value of `ctl-arrow' for buffers that do not override it.
 This is the same as (default-value 'ctl-arrow).  */);
 
-  DEFVAR_LISP_NOPRO ("default-direction-reversed",
-                     &buffer_defaults.direction_reversed,
-                     doc: /* Default value of `direction-reversed' for buffers that do not override it.
-This is the same as (default-value 'direction-reversed).  */);
-
   DEFVAR_LISP_NOPRO ("default-enable-multibyte-characters",
                      &buffer_defaults.enable_multibyte_characters,
                      doc: /* *Default value of `enable-multibyte-characters' for buffers not overriding it.
@@ -5809,11 +5657,23 @@ The variable `coding-system-for-write', if non-nil, overrides this variable.
 
 This variable is never applied to a way of decoding a file while reading it.  */);
 
-  DEFVAR_PER_BUFFER ("direction-reversed", &current_buffer->direction_reversed,
-                    Qnil,
-                    doc: /* *Non-nil means lines in the buffer are displayed right to left.  */);
+  DEFVAR_PER_BUFFER ("bidi-display-reordering",
+                    &current_buffer->bidi_display_reordering, Qnil,
+                    doc: /* Non-nil means reorder bidirectional text for display in the visual order.  */);
+
+  DEFVAR_PER_BUFFER ("bidi-paragraph-direction",
+                    &current_buffer->bidi_paragraph_direction, Qnil,
+                    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.
+The values of `right-to-left' and `left-to-right' override that.
+Any other value is treated as nil.
+
+This variable has no effect unless the buffer's value of
+\`bidi-display-reordering' is non-nil.  */);
 
 DEFVAR_PER_BUFFER ("truncate-lines", &current_buffer->truncate_lines, Qnil,
+ DEFVAR_PER_BUFFER ("truncate-lines", &current_buffer->truncate_lines, Qnil,
                     doc: /* *Non-nil means do not display continuation lines.
 Instead, give each line of text just one screen line.
 
@@ -6353,7 +6213,7 @@ The function `kill-all-local-variables' runs this before doing anything else.  *
 }
 
 void
-keys_of_buffer ()
+keys_of_buffer (void)
 {
   initial_define_key (control_x_map, 'b', "switch-to-buffer");
   initial_define_key (control_x_map, 'k', "kill-buffer");
index 5217c6d7298311b79d2b61e01f97e07a57679102..339e7d9bb6dfc53a97a6748e48da6971e4957456 100644 (file)
@@ -107,6 +107,11 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #define BUF_BEG(buf) (BEG)
 #define BUF_BEG_BYTE(buf) (BEG_BYTE)
 
+/* !!!FIXME:  all the BUF_BEGV/BUF_ZV/BUF_PT macros are flawed:
+   on indirect (or base) buffers, that value is only correct if that buffer
+   is the current_buffer, or if the buffer's text hasn't been modified (via
+   an indirect buffer) since it was last current.  */
+
 /* Position of beginning of accessible range of buffer.  */
 #define BUF_BEGV(buf) ((buf)->begv)
 #define BUF_BEGV_BYTE(buf) ((buf)->begv_byte)
@@ -220,12 +225,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 P_ ((EMACS_INT));
-extern INLINE void temp_set_point P_ ((struct buffer *, EMACS_INT));
-extern void set_point_both P_ ((EMACS_INT, EMACS_INT));
-extern INLINE void temp_set_point_both P_ ((struct buffer *,
-                                           EMACS_INT, EMACS_INT));
-extern void enlarge_buffer_text P_ ((struct buffer *, EMACS_INT));
+extern void set_point (EMACS_INT);
+extern INLINE void temp_set_point (struct buffer *, EMACS_INT);
+extern void set_point_both (EMACS_INT, EMACS_INT);
+extern INLINE void temp_set_point_both (struct buffer *,
+                                        EMACS_INT, EMACS_INT);
+extern void enlarge_buffer_text (struct buffer *, EMACS_INT);
 
 \f
 /* Macros for setting the BEGV, ZV or PT of a given buffer.
@@ -313,7 +318,7 @@ while (0)
  - (ptr - (current_buffer)->text->beg <= (unsigned) (GPT_BYTE - BEG_BYTE) ? 0 : GAP_SIZE) \
  + BEG_BYTE)
 
-/* Return character at position POS.  */
+/* Return character at byte position POS.  */
 
 #define FETCH_CHAR(pos)                                        \
   (!NILP (current_buffer->enable_multibyte_characters) \
@@ -327,7 +332,7 @@ while (0)
 /* Variables used locally in FETCH_MULTIBYTE_CHAR.  */
 extern unsigned char *_fetch_multibyte_char_p;
 
-/* Return character code of multi-byte form at position POS.  If POS
+/* 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.  */
 
@@ -336,7 +341,7 @@ extern unsigned char *_fetch_multibyte_char_p;
                               + (pos) + BEG_ADDR - BEG_BYTE),          \
    STRING_CHAR (_fetch_multibyte_char_p))
 
-/* Return character at position POS.  If the current buffer is unibyte
+/* Return character at byte position POS.  If the current buffer is unibyte
    and the character is not ASCII, make the returning character
    multibyte.  */
 
@@ -447,7 +452,10 @@ struct buffer_text
     /* The markers that refer to this buffer.
        This is actually a single marker ---
        successive elements in its marker `chain'
-       are the other markers referring to this buffer.  */
+       are the other markers referring to this buffer.
+       This is a singly linked unordered list, which means that it's
+       very cheap to add a marker to the list and it's also very cheap
+       to move a marker within a buffer.  */
     struct Lisp_Marker *markers;
 
     /* Usually 0.  Temporarily set to 1 in decode_coding_gap to
@@ -513,6 +521,12 @@ struct buffer
      0 means visited file modtime unknown; in no case complain
      about any mismatch on next save attempt.  */
   int 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.  */
+  EMACS_INT 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.
@@ -662,8 +676,13 @@ struct buffer
   Lisp_Object word_wrap;
   /* Non-nil means display ctl chars with uparrow.  */
   Lisp_Object ctl_arrow;
-  /* Non-nil means display text from right to left.  */
-  Lisp_Object direction_reversed;
+  /* Non-nil means reorder bidirectional text for display in the
+     visual order.  */
+  Lisp_Object 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 bidi_paragraph_direction;
   /* Non-nil means do selective display;
      see doc string in syms_of_buffer (buffer.c) for details.  */
   Lisp_Object selective_display;
@@ -829,6 +848,7 @@ extern struct buffer buffer_defaults;
    be a Lisp-level local variable for the slot, it has no default value,
    and the corresponding slot in buffer_defaults is not used.  */
 
+
 extern struct buffer buffer_local_flags;
 
 /* For each buffer slot, this points to the Lisp symbol name
@@ -837,23 +857,23 @@ extern struct buffer buffer_local_flags;
 
 extern struct buffer buffer_local_symbols;
 \f
-extern void delete_all_overlays P_ ((struct buffer *));
-extern void reset_buffer P_ ((struct buffer *));
-extern void evaporate_overlays P_ ((EMACS_INT));
-extern int overlays_at P_ ((EMACS_INT pos, int extend, Lisp_Object **vec_ptr,
-                           int *len_ptr, EMACS_INT *next_ptr,
-                           EMACS_INT *prev_ptr, int change_req));
-extern int sort_overlays P_ ((Lisp_Object *, int, struct window *));
-extern void recenter_overlay_lists P_ ((struct buffer *, EMACS_INT));
-extern int overlay_strings P_ ((EMACS_INT, struct window *, unsigned char **));
-extern void validate_region P_ ((Lisp_Object *, Lisp_Object *));
-extern void set_buffer_internal P_ ((struct buffer *));
-extern void set_buffer_internal_1 P_ ((struct buffer *));
-extern void set_buffer_temp P_ ((struct buffer *));
-extern void record_buffer P_ ((Lisp_Object));
-extern void buffer_slot_type_mismatch P_ ((Lisp_Object, int)) NO_RETURN;
-extern void fix_overlays_before P_ ((struct buffer *, EMACS_INT, EMACS_INT));
-extern void mmap_set_vars P_ ((int));
+extern void delete_all_overlays (struct buffer *);
+extern void reset_buffer (struct buffer *);
+extern void evaporate_overlays (EMACS_INT);
+extern int overlays_at (EMACS_INT pos, int extend, Lisp_Object **vec_ptr,
+                        int *len_ptr, EMACS_INT *next_ptr,
+                        EMACS_INT *prev_ptr, int change_req);
+extern int sort_overlays (Lisp_Object *, int, struct window *);
+extern void recenter_overlay_lists (struct buffer *, EMACS_INT);
+extern int overlay_strings (EMACS_INT, 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 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 void mmap_set_vars (int);
 
 /* Get overlays at POSN into array OVERLAYS with NOVERLAYS elements.
    If NEXTP is non-NULL, return next overlay there.
@@ -934,7 +954,7 @@ extern int last_per_buffer_idx;
    from the start of a buffer structure.  */
 
 #define PER_BUFFER_VAR_OFFSET(VAR) \
-    ((char *) &buffer_local_flags.VAR - (char *) &buffer_local_flags)
+  offsetof (struct buffer, VAR)
 
 /* Return the index of buffer-local variable VAR.  Each per-buffer
    variable has an index > 0 associated with it, except when it always
@@ -999,11 +1019,5 @@ extern int last_per_buffer_idx;
 #define PER_BUFFER_VALUE(BUFFER, OFFSET) \
       (*(Lisp_Object *)((OFFSET) + (char *) (BUFFER)))
 
-/* Return the symbol of the per-buffer variable at offset OFFSET in
-   the buffer structure.  */
-
-#define PER_BUFFER_SYMBOL(OFFSET) \
-      (*(Lisp_Object *)((OFFSET) + (char *) &buffer_local_symbols))
-
 /* arch-tag: 679305dd-d41c-4a50-b170-3caf5c97b2d1
    (do not change this comment) */
index e95614c72a9126bef52ee15d038f1fc049bc4d5c..88ac509e4ba5852143824efdbb04997a288b7071 100644 (file)
@@ -272,7 +272,7 @@ struct byte_stack *byte_stack_list;
 /* Mark objects on byte_stack_list.  Called during GC.  */
 
 void
-mark_byte_stack ()
+mark_byte_stack (void)
 {
   struct byte_stack *stack;
   Lisp_Object *obj;
@@ -301,7 +301,7 @@ mark_byte_stack ()
    counters.  Called when GC has completed.  */
 
 void
-unmark_byte_stack ()
+unmark_byte_stack (void)
 {
   struct byte_stack *stack;
 
@@ -403,8 +403,7 @@ The first argument, BYTESTR, is a string of byte code;
 the second, VECTOR, a vector of constants;
 the third, MAXDEPTH, the maximum stack depth used in this function.
 If the third argument is incorrect, Emacs may crash.  */)
-     (bytestr, vector, maxdepth)
-     Lisp_Object bytestr, vector, maxdepth;
+  (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth)
 {
   int count = SPECPDL_INDEX ();
 #ifdef BYTE_CODE_METER
@@ -505,8 +504,9 @@ If the third argument is incorrect, Emacs may crash.  */)
            v1 = vectorp[op];
            if (SYMBOLP (v1))
              {
-               v2 = SYMBOL_VALUE (v1);
-               if (MISCP (v2) || EQ (v2, Qunbound))
+               if (XSYMBOL (v1)->redirect != SYMBOL_PLAINVAL
+                   || (v2 = SYMBOL_VAL (XSYMBOL (v1)),
+                       EQ (v2, Qunbound)))
                  {
                    BEFORE_POTENTIAL_GC ();
                    v2 = Fsymbol_value (v1);
@@ -597,14 +597,13 @@ If the third argument is incorrect, Emacs may crash.  */)
            /* Inline the most common case.  */
            if (SYMBOLP (sym)
                && !EQ (val, Qunbound)
-               && !XSYMBOL (sym)->indirect_variable
-               && !SYMBOL_CONSTANT_P (sym)
-               && !MISCP (XSYMBOL (sym)->value))
-             XSYMBOL (sym)->value = val;
+               && !XSYMBOL (sym)->redirect
+               && !SYMBOL_CONSTANT_P (sym))
+             XSYMBOL (sym)->val.value = val;
            else
              {
                BEFORE_POTENTIAL_GC ();
-               set_internal (sym, val, current_buffer, 0);
+               set_internal (sym, val, Qnil, 0);
                AFTER_POTENTIAL_GC ();
              }
          }
@@ -1678,7 +1677,7 @@ If the third argument is incorrect, Emacs may crash.  */)
 }
 
 void
-syms_of_bytecode ()
+syms_of_bytecode (void)
 {
   Qbytecode = intern_c_string ("byte-code");
   staticpro (&Qbytecode);
index a45f8a372b8a23da89312729cb0085d4cbe1ab09..ae11c7cb24da267da9455c1343a168667f0a5655 100644 (file)
@@ -29,25 +29,12 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "window.h"
 #include "keymap.h"
 
-#ifdef HAVE_INDEX
-extern char *index P_ ((const char *, int));
-#endif
-
-extern Lisp_Object Qcursor_in_echo_area;
-extern Lisp_Object Qfile_directory_p;
-extern Lisp_Object Qonly;
-
 Lisp_Object Vcurrent_prefix_arg, Qminus, Qplus;
 Lisp_Object Qcall_interactively;
 Lisp_Object Vcommand_history;
 
-extern Lisp_Object Vhistory_length;
-extern Lisp_Object Vthis_original_command, real_this_command;
-extern int history_delete_duplicates;
-
 Lisp_Object Vcommand_debug_status, Qcommand_debug_status;
 Lisp_Object Qenable_recursive_minibuffers;
-extern Lisp_Object Qface, Qminibuffer_prompt;
 
 /* Non-nil means treat the mark as active
    even if mark_active is 0.  */
@@ -131,8 +118,7 @@ If the string begins with `^' and `shift-select-mode' is non-nil,
 You may use `@', `*', and `^' together.  They are processed in the
  order that they appear, before reading any arguments.
 usage: (interactive &optional ARGS)  */)
-     (args)
-     Lisp_Object args;
+  (Lisp_Object args)
 {
   return Qnil;
 }
@@ -140,8 +126,7 @@ usage: (interactive &optional ARGS)  */)
 /* Quotify EXP: if EXP is constant, return it.
    If EXP is not constant, return (quote EXP).  */
 Lisp_Object
-quotify_arg (exp)
-     register Lisp_Object exp;
+quotify_arg (register Lisp_Object exp)
 {
   if (!INTEGERP (exp) && !STRINGP (exp)
       && !NILP (exp) && !EQ (exp, Qt))
@@ -152,8 +137,7 @@ quotify_arg (exp)
 
 /* Modify EXP by quotifying each element (except the first).  */
 Lisp_Object
-quotify_args (exp)
-     Lisp_Object exp;
+quotify_args (Lisp_Object exp)
 {
   register Lisp_Object tail;
   Lisp_Object next;
@@ -165,12 +149,11 @@ quotify_args (exp)
   return exp;
 }
 
-char *callint_argfuns[]
+static const char *callint_argfuns[]
     = {"", "point", "mark", "region-beginning", "region-end"};
 
 static void
-check_mark (for_region)
-     int for_region;
+check_mark (int for_region)
 {
   Lisp_Object tem;
   tem = Fmarker_buffer (current_buffer->mark);
@@ -191,8 +174,7 @@ check_mark (for_region)
    of VALUES to do its job.  */
 
 static void
-fix_command (input, values)
-     Lisp_Object input, values;
+fix_command (Lisp_Object input, Lisp_Object values)
 {
   if (CONSP (input))
     {
@@ -267,8 +249,7 @@ Optional third arg KEYS, if given, specifies the sequence of events to
 supply, as a vector, if the command inquires which events were used to
 invoke it.  If KEYS is omitted or nil, the return value of
 `this-command-keys-vector' is used.  */)
-     (function, record_flag, keys)
-     Lisp_Object function, record_flag, keys;
+  (Lisp_Object function, Lisp_Object record_flag, Lisp_Object keys)
 {
   Lisp_Object *args, *visargs;
   Lisp_Object specs;
@@ -352,8 +333,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 = (unsigned char *) alloca (SBYTES (specs) + 1);
-      bcopy (SDATA (specs), string,
-            SBYTES (specs) + 1);
+      memcpy (string, SDATA (specs), SBYTES (specs) + 1);
     }
   else
     {
@@ -476,7 +456,7 @@ invoke it.  If KEYS is omitted or nil, the return value of
        j += 2;
       else
        j++;
-      tem = (unsigned char *) index (tem, '\n');
+      tem = (unsigned char *) strchr (tem, '\n');
       if (tem)
        ++tem;
       else
@@ -507,11 +487,11 @@ invoke it.  If KEYS is omitted or nil, the return value of
     {
       strncpy (prompt1, tem + 1, sizeof prompt1 - 1);
       prompt1[sizeof prompt1 - 1] = 0;
-      tem1 = (char *) index (prompt1, '\n');
+      tem1 = strchr (prompt1, '\n');
       if (tem1) *tem1 = 0;
 
       visargs[0] = build_string (prompt1);
-      if (index (prompt1, '%'))
+      if (strchr (prompt1, '%'))
        callint_message = Fformat (i, visargs);
       else
        callint_message = visargs[0];
@@ -816,7 +796,7 @@ invoke it.  If KEYS is omitted or nil, the return value of
       if (NILP (visargs[i]) && STRINGP (args[i]))
        visargs[i] = args[i];
 
-      tem = (unsigned char *) index (tem, '\n');
+      tem = (unsigned char *) strchr (tem, '\n');
       if (tem) tem++;
       else tem = (unsigned char *) "";
     }
@@ -877,8 +857,7 @@ DEFUN ("prefix-numeric-value", Fprefix_numeric_value, Sprefix_numeric_value,
        doc: /* Return numeric meaning of raw prefix argument RAW.
 A raw prefix argument is what you get from `(interactive "P")'.
 Its numeric meaning is what you would get from `(interactive "p")'.  */)
-     (raw)
-     Lisp_Object raw;
+  (Lisp_Object raw)
 {
   Lisp_Object val;
 
@@ -897,7 +876,7 @@ Its numeric meaning is what you would get from `(interactive "p")'.  */)
 }
 
 void
-syms_of_callint ()
+syms_of_callint (void)
 {
   point_marker = Fmake_marker ();
   staticpro (&point_marker);
index bed3302e508848f9dc9d435f634d1590df7017b0..8c1384df6a11ce67596e5f2275302555b3ac7f3d 100644 (file)
@@ -25,10 +25,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <stdio.h>
 #include <setjmp.h>
 
-#ifndef USE_CRT_DLL
-extern int errno;
-#endif
-
 /* Define SIGCHLD as an alias for SIGCLD.  */
 
 #if !defined (SIGCHLD) && defined (SIGCLD)
@@ -43,7 +39,6 @@ extern int errno;
 
 #include <sys/file.h>
 #ifdef HAVE_FCNTL_H
-#define INCLUDED_FCNTL
 #include <fcntl.h>
 #endif
 
@@ -57,11 +52,9 @@ extern int errno;
 #endif
 
 #ifdef MSDOS   /* Demacs 1.1.1 91/10/16 HIRANO Satoshi */
-#define INCLUDED_FCNTL
 #include <fcntl.h>
 #include <sys/stat.h>
 #include <sys/param.h>
-#include <errno.h>
 #endif /* MSDOS */
 
 #ifndef O_RDONLY
@@ -96,7 +89,7 @@ extern char **environ;
 #endif
 
 #ifdef HAVE_SETPGID
-#if !defined (USG) || defined (BSD_PGRPS)
+#if !defined (USG)
 #undef setpgrp
 #define setpgrp setpgid
 #endif
@@ -109,8 +102,6 @@ Lisp_Object Vconfigure_info_directory, Vshared_game_score_directory;
 /* Pattern used by call-process-region to make temp files.  */
 static Lisp_Object Vtemp_file_name_pattern;
 
-extern Lisp_Object Vtemporary_file_directory;
-
 Lisp_Object Vshell_file_name;
 
 Lisp_Object Vprocess_environment, Vinitial_environment;
@@ -124,7 +115,7 @@ Lisp_Object Qbuffer_file_type;
 int synch_process_alive;
 
 /* Nonzero => this is a string explaining death of synchronous subprocess.  */
-char *synch_process_death;
+const char *synch_process_death;
 
 /* Nonzero => this is the signal number that terminated the subprocess.  */
 int synch_process_termsig;
@@ -144,8 +135,7 @@ static int call_process_exited;
 EXFUN (Fgetenv_internal, 2);
 
 static Lisp_Object
-call_process_kill (fdpid)
-     Lisp_Object fdpid;
+call_process_kill (Lisp_Object fdpid)
 {
   emacs_close (XFASTINT (Fcar (fdpid)));
   EMACS_KILLPG (XFASTINT (Fcdr (fdpid)), SIGKILL);
@@ -154,8 +144,7 @@ call_process_kill (fdpid)
 }
 
 Lisp_Object
-call_process_cleanup (arg)
-     Lisp_Object arg;
+call_process_cleanup (Lisp_Object arg)
 {
   Lisp_Object fdpid = Fcdr (arg);
 #if defined (MSDOS)
@@ -224,9 +213,7 @@ and returns a numeric exit status or a signal description string.
 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)  */)
-     (nargs, args)
-     int nargs;
-     register Lisp_Object *args;
+  (int nargs, register Lisp_Object *args)
 {
   Lisp_Object infile, buffer, current_dir, path;
   int display_p;
@@ -586,7 +573,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS)  */)
 #ifdef HAVE_SETSID
         setsid ();
 #endif
-#if defined (USG) && !defined (BSD_PGRPS)
+#if defined (USG)
         setpgrp ();
 #else
         setpgrp (pid, pid);
@@ -623,12 +610,6 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS)  */)
     {
       if (fd[0] >= 0)
        emacs_close (fd[0]);
-#ifndef subprocesses
-      /* If Emacs has been built with asynchronous subprocess support,
-        we don't need to do this, I think because it will then have
-        the facilities for handling SIGCHLD.  */
-      wait_without_blocking ();
-#endif /* subprocesses */
       return Qnil;
     }
 
@@ -784,10 +765,8 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS)  */)
                                  PT_BYTE + process_coding.produced);
                carryover = process_coding.carryover_bytes;
                if (carryover > 0)
-                 /* As CARRYOVER should not be that large, we had
-                    better avoid overhead of bcopy.  */
-                 BCOPY_SHORT (process_coding.carryover, buf,
-                              process_coding.carryover_bytes);
+                 memcpy (buf, process_coding.carryover,
+                         process_coding.carryover_bytes);
              }
          }
 
@@ -824,8 +803,10 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS)  */)
             make_number (total_read));
   }
 
+#ifndef MSDOS
   /* Wait for it to terminate, unless it already has.  */
   wait_for_termination (pid);
+#endif
 
   immediate_quit = 0;
 
@@ -837,7 +818,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS)  */)
 
   if (synch_process_termsig)
     {
-      char *signame;
+      const char *signame;
 
       synchronize_system_messages_locale ();
       signame = strsignal (synch_process_termsig);
@@ -855,8 +836,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS)  */)
 }
 \f
 static Lisp_Object
-delete_temp_file (name)
-     Lisp_Object name;
+delete_temp_file (Lisp_Object name)
 {
   /* Suppress jka-compr handling, etc.  */
   int count = SPECPDL_INDEX ();
@@ -889,9 +869,7 @@ and returns a numeric exit status or a signal description string.
 If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.
 
 usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &rest ARGS)  */)
-     (nargs, args)
-     int nargs;
-     register Lisp_Object *args;
+  (int nargs, register Lisp_Object *args)
 {
   struct gcpro gcpro1;
   Lisp_Object filename_string;
@@ -926,7 +904,7 @@ usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &r
 
   pattern = Fexpand_file_name (Vtemp_file_name_pattern, tmpdir);
   tempfile = (char *) alloca (SBYTES (pattern) + 1);
-  bcopy (SDATA (pattern), tempfile, SBYTES (pattern) + 1);
+  memcpy (tempfile, SDATA (pattern), SBYTES (pattern) + 1);
   coding_systems = Qt;
 
 #ifdef HAVE_MKSTEMP
@@ -1004,7 +982,9 @@ usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &r
   RETURN_UNGCPRO (unbind_to (count, Fcall_process (nargs, args)));
 }
 \f
-static int relocate_fd ();
+#ifndef WINDOWSNT
+static int relocate_fd (int fd, int minfd);
+#endif
 
 static char **
 add_env (char **env, char **new_env, char *string)
@@ -1059,11 +1039,7 @@ add_env (char **env, char **new_env, char *string)
    executable directory by the parent.  */
 
 int
-child_setup (in, out, err, new_argv, set_pgrp, current_dir)
-     int in, out, err;
-     register char **new_argv;
-     int set_pgrp;
-     Lisp_Object current_dir;
+child_setup (int in, int out, int err, register char **new_argv, int set_pgrp, Lisp_Object current_dir)
 {
   char **env;
   char *pwd_var;
@@ -1074,19 +1050,9 @@ child_setup (in, out, err, new_argv, set_pgrp, current_dir)
 
   int pid = getpid ();
 
-#ifdef SET_EMACS_PRIORITY
-  {
-    extern EMACS_INT emacs_priority;
-
-    if (emacs_priority < 0)
-      nice (- emacs_priority);
-  }
-#endif
-
-#ifdef subprocesses
   /* Close Emacs's descriptors that this process should not have.  */
   close_process_descs ();
-#endif
+
   /* DOS_NT isn't in a vfork, so if we are in the middle of load-file,
      we will lose if we call close_load_descs here.  */
 #ifndef DOS_NT
@@ -1113,8 +1079,8 @@ child_setup (in, out, err, new_argv, set_pgrp, current_dir)
     pwd_var = (char *) alloca (i + 6);
 #endif
     temp = pwd_var + 4;
-    bcopy ("PWD=", pwd_var, 4);
-    bcopy (SDATA (current_dir), temp, i);
+    memcpy (pwd_var, "PWD=", 4);
+    memcpy (temp, SDATA (current_dir), i);
     if (!IS_DIRECTORY_SEP (temp[i - 1])) temp[i++] = DIRECTORY_SEP;
     temp[i] = 0;
 
@@ -1147,7 +1113,7 @@ child_setup (in, out, err, new_argv, set_pgrp, current_dir)
     char **p, **q;
     register int new_length;
     Lisp_Object display = Qnil;
-    
+
     new_length = 0;
 
     for (tem = Vprocess_environment;
@@ -1183,7 +1149,7 @@ child_setup (in, out, err, new_argv, set_pgrp, current_dir)
        but with corrected value.  */
     if (egetenv ("PWD"))
       *new_env++ = pwd_var;
+
     if (STRINGP (display))
       {
        int vlen = strlen ("DISPLAY=") + strlen (SDATA (display)) + 1;
@@ -1213,7 +1179,7 @@ child_setup (in, out, err, new_argv, set_pgrp, current_dir)
       }
   }
 
-  
+
 #ifdef WINDOWSNT
   prepare_standard_handles (in, out, err, handles);
   set_process_dir (SDATA (current_dir));
@@ -1251,20 +1217,20 @@ child_setup (in, out, err, new_argv, set_pgrp, current_dir)
   dup2 (out, 1);
   dup2 (err, 2);
   emacs_close (in);
-  emacs_close (out);
-  emacs_close (err);
+  if (out != in)
+    emacs_close (out);
+  if (err != in && err != out)
+    emacs_close (err);
 #endif /* not MSDOS */
 #endif /* not WINDOWSNT */
 
-#if defined(USG) && !defined(BSD_PGRPS)
+#if defined(USG)
 #ifndef SETPGRP_RELEASES_CTTY
   setpgrp ();                  /* No arguments but equivalent in this case */
 #endif
 #else
   setpgrp (pid, pid);
 #endif /* USG */
-  /* setpgrp_of_tty is incorrect here; it uses input_fd.  */
-  EMACS_SET_TTY_PGRP (0, &pid);
 
 #ifdef MSDOS
   pid = run_msdos_command (new_argv, pwd_var + 4, in, out, err, env);
@@ -1283,6 +1249,9 @@ child_setup (in, out, err, new_argv, set_pgrp, current_dir)
     report_file_error ("Spawning child process", Qnil);
   return cpid;
 #else /* not WINDOWSNT */
+  /* setpgrp_of_tty is incorrect here; it uses input_fd.  */
+  EMACS_SET_TTY_PGRP (0, &pid);
+
   /* execvp does not accept an environment arg so the only way
      to pass this environment is to set environ.  Our caller
      is responsible for restoring the ambient value of environ.  */
@@ -1297,42 +1266,45 @@ child_setup (in, out, err, new_argv, set_pgrp, current_dir)
 #endif /* not MSDOS */
 }
 
+#ifndef WINDOWSNT
 /* Move the file descriptor FD so that its number is not less than MINFD.
    If the file descriptor is moved at all, the original is freed.  */
 static int
-relocate_fd (fd, minfd)
-     int fd, minfd;
+relocate_fd (int fd, int minfd)
 {
   if (fd >= minfd)
     return fd;
   else
     {
-      int new = dup (fd);
+      int new;
+#ifdef F_DUPFD
+      new = fcntl (fd, F_DUPFD, minfd);
+#else
+      new = dup (fd);
+      if (new != -1)
+       /* Note that we hold the original FD open while we recurse,
+          to guarantee we'll get a new FD if we need it.  */
+       new = relocate_fd (new, minfd);
+#endif
       if (new == -1)
        {
-         char *message1 = "Error while setting up child: ";
-         char *errmessage = strerror (errno);
-         char *message2 = "\n";
+         const char *message1 = "Error while setting up child: ";
+         const char *errmessage = strerror (errno);
+         const char *message2 = "\n";
          emacs_write (2, message1, strlen (message1));
          emacs_write (2, errmessage, strlen (errmessage));
          emacs_write (2, message2, strlen (message2));
          _exit (1);
        }
-      /* Note that we hold the original FD open while we recurse,
-        to guarantee we'll get a new FD if we need it.  */
-      new = relocate_fd (new, minfd);
       emacs_close (fd);
       return new;
     }
 }
+#endif /* not WINDOWSNT */
 
 static int
-getenv_internal_1 (var, varlen, value, valuelen, env)
-     char *var;
-     int varlen;
-     char **value;
-     int *valuelen;
-     Lisp_Object env;
+getenv_internal_1 (const char *var, int varlen, char **value, int *valuelen,
+                  Lisp_Object env)
 {
   for (; CONSP (env); env = XCDR (env))
     {
@@ -1343,7 +1315,7 @@ getenv_internal_1 (var, varlen, value, valuelen, env)
          /* NT environment variables are case insensitive.  */
          && ! strnicmp (SDATA (entry), var, varlen)
 #else  /* not WINDOWSNT */
-         && ! bcmp (SDATA (entry), var, varlen)
+         && ! memcmp (SDATA (entry), var, varlen)
 #endif /* not WINDOWSNT */
          )
        {
@@ -1366,12 +1338,8 @@ getenv_internal_1 (var, varlen, value, valuelen, env)
 }
 
 static int
-getenv_internal (var, varlen, value, valuelen, frame)
-     char *var;
-     int varlen;
-     char **value;
-     int *valuelen;
-     Lisp_Object frame;
+getenv_internal (const char *var, int varlen, char **value, int *valuelen,
+                Lisp_Object frame)
 {
   /* Try to find VAR in Vprocess_environment first.  */
   if (getenv_internal_1 (var, varlen, value, valuelen,
@@ -1408,8 +1376,7 @@ This function searches `process-environment' for VARIABLE.
 If optional parameter ENV is a list, then search this list instead of
 `process-environment', and return t when encountering a negative entry
 \(an entry for a variable with no value).  */)
-     (variable, env)
-     Lisp_Object variable, env;
+  (Lisp_Object variable, Lisp_Object env)
 {
   char *value;
   int valuelen;
@@ -1433,8 +1400,7 @@ If optional parameter ENV is a list, then search this list instead of
 /* A version of getenv that consults the Lisp environment lists,
    easily callable from C.  */
 char *
-egetenv (var)
-     char *var;
+egetenv (const char *var)
 {
   char *value;
   int valuelen;
@@ -1449,7 +1415,7 @@ egetenv (var)
 /* This is run before init_cmdargs.  */
 
 void
-init_callproc_1 ()
+init_callproc_1 (void)
 {
   char *data_dir = egetenv ("EMACSDATA");
   char *doc_dir = egetenv ("EMACSDOC");
@@ -1471,7 +1437,7 @@ init_callproc_1 ()
 /* This is run after init_cmdargs, when Vinstallation_directory is valid.  */
 
 void
-init_callproc ()
+init_callproc (void)
 {
   char *data_dir = egetenv ("EMACSDATA");
 
@@ -1560,16 +1526,15 @@ init_callproc ()
 }
 
 void
-set_initial_environment ()
+set_initial_environment (void)
 {
   register char **envp;
-#ifndef CANNOT_DUMP
-  if (initialized)
-    {
+#ifdef CANNOT_DUMP
+  Vprocess_environment = Qnil;
 #else
-    {
-      Vprocess_environment = Qnil;
+  if (initialized)
 #endif
+    {
       for (envp = environ; *envp; envp++)
        Vprocess_environment = Fcons (build_string (*envp),
                                      Vprocess_environment);
@@ -1580,7 +1545,7 @@ set_initial_environment ()
 }
 
 void
-syms_of_callproc ()
+syms_of_callproc (void)
 {
 #ifdef DOS_NT
   Qbuffer_file_type = intern ("buffer-file-type");
index 30bb457b17d3b94f3bccb287688a5620d5872ee7..b6551618b2f9afc18cec5f1a1c4a127ecc52d33e 100644 (file)
@@ -33,9 +33,7 @@ enum case_action {CASE_UP, CASE_DOWN, CASE_CAPITALIZE, CASE_CAPITALIZE_UP};
 Lisp_Object Qidentity;
 \f
 Lisp_Object
-casify_object (flag, obj)
-     enum case_action flag;
-     Lisp_Object obj;
+casify_object (enum case_action flag, Lisp_Object obj)
 {
   register int c, c1;
   register int inword = flag == CASE_DOWN;
@@ -130,7 +128,7 @@ casify_object (flag, obj)
              unsigned char *old_dst = dst;
              o_size += o_size; /* Probably overkill, but extremely rare.  */
              SAFE_ALLOCA (dst, void *, o_size);
-             bcopy (old_dst, dst, o - old_dst);
+             memcpy (dst, old_dst, o - old_dst);
              o = dst + (o - old_dst);
            }
          c = STRING_CHAR_AND_LENGTH (SDATA (obj) + i_byte, len);
@@ -155,8 +153,7 @@ DEFUN ("upcase", Fupcase, Supcase, 1, 1, 0,
 The argument may be a character or string.  The result has the same type.
 The argument object is not altered--the value is a copy.
 See also `capitalize', `downcase' and `upcase-initials'.  */)
-     (obj)
-     Lisp_Object obj;
+  (Lisp_Object obj)
 {
   return casify_object (CASE_UP, obj);
 }
@@ -165,8 +162,7 @@ DEFUN ("downcase", Fdowncase, Sdowncase, 1, 1, 0,
        doc: /* Convert argument to lower case and return that.
 The argument may be a character or string.  The result has the same type.
 The argument object is not altered--the value is a copy.  */)
-     (obj)
-     Lisp_Object obj;
+  (Lisp_Object obj)
 {
   return casify_object (CASE_DOWN, obj);
 }
@@ -177,8 +173,7 @@ This means that each word's first character is upper case
 and the rest is lower case.
 The argument may be a character or string.  The result has the same type.
 The argument object is not altered--the value is a copy.  */)
-     (obj)
-     Lisp_Object obj;
+  (Lisp_Object obj)
 {
   return casify_object (CASE_CAPITALIZE, obj);
 }
@@ -190,8 +185,7 @@ DEFUN ("upcase-initials", Fupcase_initials, Supcase_initials, 1, 1, 0,
 Do not change the other letters of each word.
 The argument may be a character or string.  The result has the same type.
 The argument object is not altered--the value is a copy.  */)
-     (obj)
-     Lisp_Object obj;
+  (Lisp_Object obj)
 {
   return casify_object (CASE_CAPITALIZE_UP, obj);
 }
@@ -200,9 +194,7 @@ The argument object is not altered--the value is a copy.  */)
    b and e specify range of buffer to operate on. */
 
 void
-casify_region (flag, b, e)
-     enum case_action flag;
-     Lisp_Object b, e;
+casify_region (enum case_action flag, Lisp_Object b, Lisp_Object e)
 {
   register int c;
   register int inword = flag == CASE_DOWN;
@@ -229,6 +221,8 @@ casify_region (flag, b, e)
   start_byte = CHAR_TO_BYTE (start);
   end_byte = CHAR_TO_BYTE (end);
 
+  SETUP_BUFFER_SYNTAX_TABLE(); /* For syntax_prefix_flag_p.  */
+
   while (start < end)
     {
       int c2, len;
@@ -251,7 +245,8 @@ casify_region (flag, b, e)
               && (!inword || flag != CASE_CAPITALIZE_UP))
        c = UPCASE1 (c);
       if ((int) flag >= (int) CASE_CAPITALIZE)
-       inword = ((SYNTAX (c) == Sword) && (inword || !SYNTAX_PREFIX (c)));
+       inword = ((SYNTAX (c) == Sword)
+                 && (inword || !syntax_prefix_flag_p (c)));
       if (c != c2)
        {
          last = start;
@@ -310,8 +305,7 @@ These arguments specify the starting and ending character numbers of
 the region to operate on.  When used as a command, the text between
 point and the mark is operated on.
 See also `capitalize-region'.  */)
-     (beg, end)
-     Lisp_Object beg, end;
+  (Lisp_Object beg, Lisp_Object end)
 {
   casify_region (CASE_UP, beg, end);
   return Qnil;
@@ -322,8 +316,7 @@ DEFUN ("downcase-region", Fdowncase_region, Sdowncase_region, 2, 2, "r",
 These arguments specify the starting and ending character numbers of
 the region to operate on.  When used as a command, the text between
 point and the mark is operated on.  */)
-     (beg, end)
-     Lisp_Object beg, end;
+  (Lisp_Object beg, Lisp_Object end)
 {
   casify_region (CASE_DOWN, beg, end);
   return Qnil;
@@ -335,8 +328,7 @@ Capitalized form means each word's first character is upper case
 and the rest of it is lower case.
 In programs, give two arguments, the starting and ending
 character positions to operate on.  */)
-     (beg, end)
-     Lisp_Object beg, end;
+  (Lisp_Object beg, Lisp_Object end)
 {
   casify_region (CASE_CAPITALIZE, beg, end);
   return Qnil;
@@ -350,17 +342,14 @@ DEFUN ("upcase-initials-region", Fupcase_initials_region,
 Subsequent letters of each word are not changed.
 In programs, give two arguments, the starting and ending
 character positions to operate on.  */)
-     (beg, end)
-     Lisp_Object beg, end;
+  (Lisp_Object beg, Lisp_Object end)
 {
   casify_region (CASE_CAPITALIZE_UP, beg, end);
   return Qnil;
 }
 \f
 static Lisp_Object
-operate_on_word (arg, newpoint)
-     Lisp_Object arg;
-     EMACS_INT *newpoint;
+operate_on_word (Lisp_Object arg, EMACS_INT *newpoint)
 {
   Lisp_Object val;
   int farend;
@@ -382,8 +371,7 @@ DEFUN ("upcase-word", Fupcase_word, Supcase_word, 1, 1, "p",
        doc: /* Convert following word (or ARG words) to upper case, moving over.
 With negative argument, convert previous words but do not move.
 See also `capitalize-word'.  */)
-     (arg)
-     Lisp_Object arg;
+  (Lisp_Object arg)
 {
   Lisp_Object beg, end;
   EMACS_INT newpoint;
@@ -397,8 +385,7 @@ See also `capitalize-word'.  */)
 DEFUN ("downcase-word", Fdowncase_word, Sdowncase_word, 1, 1, "p",
        doc: /* Convert following word (or ARG words) to lower case, moving over.
 With negative argument, convert previous words but do not move.  */)
-     (arg)
-     Lisp_Object arg;
+  (Lisp_Object arg)
 {
   Lisp_Object beg, end;
   EMACS_INT newpoint;
@@ -414,8 +401,7 @@ DEFUN ("capitalize-word", Fcapitalize_word, Scapitalize_word, 1, 1, "p",
 This gives the word(s) a first character in upper case
 and the rest lower case.
 With negative argument, capitalize previous words but do not move.  */)
-     (arg)
-     Lisp_Object arg;
+  (Lisp_Object arg)
 {
   Lisp_Object beg, end;
   EMACS_INT newpoint;
@@ -427,7 +413,7 @@ With negative argument, capitalize previous words but do not move.  */)
 }
 \f
 void
-syms_of_casefiddle ()
+syms_of_casefiddle (void)
 {
   Qidentity = intern_c_string ("identity");
   staticpro (&Qidentity);
@@ -445,7 +431,7 @@ syms_of_casefiddle ()
 }
 
 void
-keys_of_casefiddle ()
+keys_of_casefiddle (void)
 {
   initial_define_key (control_x_map, Ctl('U'), "upcase-region");
   Fput (intern ("upcase-region"), Qdisabled, Qt);
index e0a9ec49157fd3bfbab64199dce1336f945b4bae..eed6e22087fdaf2df14b5e6887f6f6b2b083878a 100644 (file)
@@ -34,15 +34,14 @@ Lisp_Object Vascii_canon_table, Vascii_eqv_table;
 int case_temp1;
 Lisp_Object case_temp2;
 
-static void set_canon ();
-static void set_identity ();
-static void shuffle ();
+static void set_canon (Lisp_Object case_table, Lisp_Object range, Lisp_Object elt);
+static void set_identity (Lisp_Object table, Lisp_Object c, Lisp_Object elt);
+static void shuffle (Lisp_Object table, Lisp_Object c, Lisp_Object elt);
 
 DEFUN ("case-table-p", Fcase_table_p, Scase_table_p, 1, 1, 0,
        doc: /* Return t if OBJECT is a case table.
 See `set-case-table' for more information on these data structures.  */)
-     (object)
-     Lisp_Object object;
+  (Lisp_Object object)
 {
   Lisp_Object up, canon, eqv;
 
@@ -63,8 +62,7 @@ See `set-case-table' for more information on these data structures.  */)
 }
 
 static Lisp_Object
-check_case_table (obj)
-     Lisp_Object obj;
+check_case_table (Lisp_Object obj)
 {
   CHECK_TYPE (!NILP (Fcase_table_p (obj)), Qcase_table_p, obj);
   return (obj);
@@ -72,7 +70,7 @@ check_case_table (obj)
 
 DEFUN ("current-case-table", Fcurrent_case_table, Scurrent_case_table, 0, 0, 0,
        doc: /* Return the case table of the current buffer.  */)
-     ()
+  (void)
 {
   return current_buffer->downcase_table;
 }
@@ -80,12 +78,12 @@ DEFUN ("current-case-table", Fcurrent_case_table, Scurrent_case_table, 0, 0, 0,
 DEFUN ("standard-case-table", Fstandard_case_table, Sstandard_case_table, 0, 0, 0,
        doc: /* Return the standard case table.
 This is the one used for new buffers.  */)
-     ()
+  (void)
 {
   return Vascii_downcase_table;
 }
 
-static Lisp_Object set_case_table ();
+static Lisp_Object set_case_table (Lisp_Object table, int standard);
 
 DEFUN ("set-case-table", Fset_case_table, Sset_case_table, 1, 1, 0,
        doc: /* Select a new case table for the current buffer.
@@ -104,8 +102,7 @@ CANONICALIZE maps each character to a canonical equivalent;
 EQUIVALENCES is a map that cyclicly permutes each equivalence class
  (of characters with the same canonical equivalent); it may be nil,
  in which case it is deduced from CANONICALIZE.  */)
-     (table)
-     Lisp_Object table;
+  (Lisp_Object table)
 {
   return set_case_table (table, 0);
 }
@@ -113,16 +110,13 @@ EQUIVALENCES is a map that cyclicly permutes each equivalence class
 DEFUN ("set-standard-case-table", Fset_standard_case_table, Sset_standard_case_table, 1, 1, 0,
        doc: /* Select a new standard case table for new buffers.
 See `set-case-table' for more info on case tables.  */)
-     (table)
-     Lisp_Object table;
+  (Lisp_Object table)
 {
   return set_case_table (table, 1);
 }
 
 static Lisp_Object
-set_case_table (table, standard)
-     Lisp_Object table;
-     int standard;
+set_case_table (Lisp_Object table, int standard)
 {
   Lisp_Object up, canon, eqv;
 
@@ -184,8 +178,7 @@ set_case_table (table, standard)
    CASE_TABLE.  */
 
 static void
-set_canon (case_table, range, elt)
-     Lisp_Object case_table, range, elt;
+set_canon (Lisp_Object case_table, Lisp_Object range, Lisp_Object elt)
 {
   Lisp_Object up = XCHAR_TABLE (case_table)->extras[0];
   Lisp_Object canon = XCHAR_TABLE (case_table)->extras[1];
@@ -200,8 +193,7 @@ set_canon (case_table, range, elt)
    character.  This is called in map_char_table.  */
 
 static void
-set_identity (table, c, elt)
-     Lisp_Object table, c, elt;
+set_identity (Lisp_Object table, Lisp_Object c, Lisp_Object elt)
 {
   if (NATNUMP (elt))
     {
@@ -225,8 +217,7 @@ set_identity (table, c, elt)
    operated.  */
 
 static void
-shuffle (table, c, elt)
-     Lisp_Object table, c, elt;
+shuffle (Lisp_Object table, Lisp_Object c, Lisp_Object elt)
 {
   if (NATNUMP (elt))
     {
@@ -250,7 +241,7 @@ shuffle (table, c, elt)
 }
 \f
 void
-init_casetab_once ()
+init_casetab_once (void)
 {
   register int i;
   Lisp_Object down, up;
@@ -296,7 +287,7 @@ init_casetab_once ()
 }
 
 void
-syms_of_casetab ()
+syms_of_casetab (void)
 {
   Qcase_table_p = intern_c_string ("case-table-p");
   staticpro (&Qcase_table_p);
index b56d62b6b803cf317f5b1b5990d747a10f122ffc..5c38f351d014dffa897eb0247d61a7def20aa8ae 100644 (file)
@@ -59,11 +59,10 @@ Lisp_Object _temp_category_set;
 \f
 /* Category set staff.  */
 
-static Lisp_Object hash_get_category_set P_ ((Lisp_Object, Lisp_Object));
+static Lisp_Object hash_get_category_set (Lisp_Object, Lisp_Object);
 
 static Lisp_Object
-hash_get_category_set (table, category_set)
-     Lisp_Object table, category_set;
+hash_get_category_set (Lisp_Object table, Lisp_Object category_set)
 {
   Lisp_Object val;
   struct Lisp_Hash_Table *h;
@@ -90,8 +89,7 @@ DEFUN ("make-category-set", Fmake_category_set, Smake_category_set, 1, 1, 0,
 CATEGORIES is a string of category mnemonics.
 The value is a bool-vector which has t at the indices corresponding to
 those categories.  */)
-     (categories)
-     Lisp_Object categories;
+  (Lisp_Object categories)
 {
   Lisp_Object val;
   int len;
@@ -117,7 +115,7 @@ those categories.  */)
 \f
 /* Category staff.  */
 
-Lisp_Object check_category_table ();
+Lisp_Object check_category_table (Lisp_Object table);
 
 DEFUN ("define-category", Fdefine_category, Sdefine_category, 2, 3, 0,
        doc: /* Define CATEGORY as a category which is described by DOCSTRING.
@@ -127,8 +125,7 @@ should be a terse text (preferably less than 16 characters),
 and the rest lines should be the full description.
 The category is defined only in category table TABLE, which defaults to
 the current buffer's category table.  */)
-     (category, docstring, table)
-     Lisp_Object category, docstring, table;
+  (Lisp_Object category, Lisp_Object docstring, Lisp_Object table)
 {
   CHECK_CATEGORY (category);
   CHECK_STRING (docstring);
@@ -147,8 +144,7 @@ DEFUN ("category-docstring", Fcategory_docstring, Scategory_docstring, 1, 2, 0,
        doc: /* Return the documentation string of CATEGORY, as defined in TABLE.
 TABLE should be a category table and defaults to the current buffer's
 category table.  */)
-     (category, table)
-     Lisp_Object category, table;
+  (Lisp_Object category, Lisp_Object table)
 {
   CHECK_CATEGORY (category);
   table = check_category_table (table);
@@ -162,8 +158,7 @@ DEFUN ("get-unused-category", Fget_unused_category, Sget_unused_category,
 If no category remains available, return nil.
 The optional argument TABLE specifies which category table to modify;
 it defaults to the current buffer's category table.  */)
-     (table)
-     Lisp_Object table;
+  (Lisp_Object table)
 {
   int i;
 
@@ -181,8 +176,7 @@ it defaults to the current buffer's category table.  */)
 
 DEFUN ("category-table-p", Fcategory_table_p, Scategory_table_p, 1, 1, 0,
        doc: /* Return t if ARG is a category table.  */)
-     (arg)
-     Lisp_Object arg;
+  (Lisp_Object arg)
 {
   if (CHAR_TABLE_P (arg)
       && EQ (XCHAR_TABLE (arg)->purpose, Qcategory_table))
@@ -196,8 +190,7 @@ DEFUN ("category-table-p", Fcategory_table_p, Scategory_table_p, 1, 1, 0,
    wrong-type-argument.  */
 
 Lisp_Object
-check_category_table (table)
-     Lisp_Object table;
+check_category_table (Lisp_Object table)
 {
   if (NILP (table))
     return current_buffer->category_table;
@@ -208,7 +201,7 @@ check_category_table (table)
 DEFUN ("category-table", Fcategory_table, Scategory_table, 0, 0, 0,
        doc: /* Return the current category table.
 This is the one specified by the current buffer.  */)
-     ()
+  (void)
 {
   return current_buffer->category_table;
 }
@@ -217,15 +210,14 @@ DEFUN ("standard-category-table", Fstandard_category_table,
    Sstandard_category_table, 0, 0, 0,
        doc: /* Return the standard category table.
 This is the one used for new buffers.  */)
-     ()
+  (void)
 {
   return Vstandard_category_table;
 }
 
 
 static void
-copy_category_entry (table, c, val)
-     Lisp_Object table, c, val;
+copy_category_entry (Lisp_Object table, Lisp_Object c, Lisp_Object val)
 {
   val = Fcopy_sequence (val);
   if (CONSP (c))
@@ -240,8 +232,7 @@ copy_category_entry (table, c, val)
    binding TABLE to a sub char table.  */
 
 Lisp_Object
-copy_category_table (table)
-     Lisp_Object table;
+copy_category_table (Lisp_Object table)
 {
   table = copy_char_table (table);
 
@@ -259,8 +250,7 @@ DEFUN ("copy-category-table", Fcopy_category_table, Scopy_category_table,
        0, 1, 0,
        doc: /* Construct a new category table and return it.
 It is a copy of the TABLE, which defaults to the standard category table.  */)
-     (table)
-     Lisp_Object table;
+  (Lisp_Object table)
 {
   if (!NILP (table))
     check_category_table (table);
@@ -273,7 +263,7 @@ It is a copy of the TABLE, which defaults to the standard category table.  */)
 DEFUN ("make-category-table", Fmake_category_table, Smake_category_table,
        0, 0, 0,
        doc: /* Construct a new and empty category table and return it.  */)
-     ()
+  (void)
 {
   Lisp_Object val;
   int i;
@@ -290,8 +280,7 @@ DEFUN ("make-category-table", Fmake_category_table, Smake_category_table,
 DEFUN ("set-category-table", Fset_category_table, Sset_category_table, 1, 1, 0,
        doc: /* Specify TABLE as the category table for the current buffer.
 Return TABLE.  */)
-     (table)
-     Lisp_Object table;
+  (Lisp_Object table)
 {
   int idx;
   table = check_category_table (table);
@@ -304,8 +293,7 @@ Return TABLE.  */)
 
 \f
 Lisp_Object
-char_category_set (c)
-     int c;
+char_category_set (int c)
 {
   return CHAR_TABLE_REF (current_buffer->category_table, c);
 }
@@ -313,8 +301,7 @@ char_category_set (c)
 DEFUN ("char-category-set", Fchar_category_set, Schar_category_set, 1, 1, 0,
        doc: /* Return the category set of CHAR.
 usage: (char-category-set CHAR)  */)
-     (ch)
-     Lisp_Object ch;
+  (Lisp_Object ch)
 {
   CHECK_NUMBER (ch);
   return CATEGORY_SET (XFASTINT (ch));
@@ -326,8 +313,7 @@ DEFUN ("category-set-mnemonics", Fcategory_set_mnemonics,
 CATEGORY-SET is a bool-vector, and the categories \"in\" it are those
 that are indexes where t occurs in the bool-vector.
 The return value is a string containing those same categories.  */)
-     (category_set)
-     Lisp_Object category_set;
+  (Lisp_Object category_set)
 {
   int i, j;
   char str[96];
@@ -344,8 +330,7 @@ The return value is a string containing those same categories.  */)
 }
 
 void
-set_category_set (category_set, category, val)
-     Lisp_Object category_set, category, val;
+set_category_set (Lisp_Object category_set, Lisp_Object category, Lisp_Object val)
 {
   do {
     int idx = XINT (category) / 8;
@@ -367,8 +352,7 @@ CHARACTER can be either a single character or a cons representing the
 lower and upper ends of an inclusive character range to modify.
 If optional fourth argument RESET is non-nil,
 then delete CATEGORY from the category set instead of adding it.  */)
-     (character, category, table, reset)
-     Lisp_Object character, category, table, reset;
+  (Lisp_Object character, Lisp_Object category, Lisp_Object table, Lisp_Object reset)
 {
   Lisp_Object set_value;       /* Actual value to be set in category sets.  */
   Lisp_Object category_set;
@@ -420,8 +404,7 @@ then delete CATEGORY from the category set instead of adding it.  */)
    directly.  */
 
 int
-word_boundary_p (c1, c2)
-     int c1, c2;
+word_boundary_p (int c1, int c2)
 {
   Lisp_Object category_set1, category_set2;
   Lisp_Object tail;
@@ -466,7 +449,7 @@ word_boundary_p (c1, c2)
 
 \f
 void
-init_category_once ()
+init_category_once (void)
 {
   /* This has to be done here, before we call Fmake_char_table.  */
   Qcategory_table = intern_c_string ("category-table");
@@ -489,7 +472,7 @@ init_category_once ()
 }
 
 void
-syms_of_category ()
+syms_of_category (void)
 {
   Qcategoryp = intern_c_string ("categoryp");
   staticpro (&Qcategoryp);
index b0fca6c7155b6859095bbad305d45e12e6960957..e636e32827dd9fe16e400c9a404daaf54d86c97d 100644 (file)
@@ -113,8 +113,8 @@ extern Lisp_Object _temp_category_set;
   (!(SINGLE_BYTE_CHAR_P (c1) && SINGLE_BYTE_CHAR_P (c2))       \
    && word_boundary_p (c1, c2))
 
-extern int word_boundary_p P_ ((int, int));
-extern void set_category_set P_ ((Lisp_Object, Lisp_Object, Lisp_Object));
+extern int word_boundary_p (int, int);
+extern void set_category_set (Lisp_Object, Lisp_Object, Lisp_Object);
 
 /* arch-tag: 309dfe83-c3e2-4d22-8e81-faae5aece0ff
    (do not change this comment) */
index c33df9e56de0b12ee28ab6bf4d3271a6970c3586..f418c65b01e72ad1c574eb869038d6d56d003e9c 100644 (file)
--- a/src/ccl.c
+++ b/src/ccl.c
@@ -72,8 +72,6 @@ Lisp_Object Vtranslation_hash_table_vector;
 #define GET_HASH_TABLE(id) \
   (XHASH_TABLE (XCDR(XVECTOR(Vtranslation_hash_table_vector)->contents[(id)])))
 
-extern int charset_unicode;
-
 /* CCL (Code Conversion Language) is a simple language which has
    operations on one input buffer, one output buffer, and 7 registers.
    The syntax of CCL is described in `ccl.el'.  Emacs Lisp function
@@ -862,11 +860,7 @@ struct ccl_prog_stack
 static struct ccl_prog_stack ccl_prog_stack_struct[256];
 
 void
-ccl_driver (ccl, source, destination, src_size, dst_size, charset_list)
-     struct ccl_program *ccl;
-     int *source, *destination;
-     int src_size, dst_size;
-     Lisp_Object charset_list;
+ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size, int dst_size, Lisp_Object charset_list)
 {
   register int *reg = ccl->reg;
   register int ic = ccl->ic;
@@ -1719,7 +1713,7 @@ ccl_driver (ccl, source, destination, src_size, dst_size, charset_list)
            msglen = strlen (msg);
            if (dst + msglen <= (dst_bytes ? dst_end : src))
              {
-               bcopy (msg, dst, msglen);
+               memcpy (dst, msg, msglen);
                dst += msglen;
              }
 
@@ -1732,7 +1726,7 @@ ccl_driver (ccl, source, destination, src_size, dst_size, charset_list)
                msglen = strlen (msg);
                if (dst + msglen > (dst_bytes ? dst_end : src))
                  break;
-               bcopy (msg, dst, msglen);
+               memcpy (dst, msg, msglen);
                dst += msglen;
              }
            goto ccl_finish;
@@ -1765,7 +1759,7 @@ ccl_driver (ccl, source, destination, src_size, dst_size, charset_list)
          int i = src_end - src;
          if (dst_bytes && (dst_end - dst) < i)
            i = dst_end - dst;
-         bcopy (src, dst, i);
+         memcpy (dst, src, i);
          src += i;
          dst += i;
 #else
@@ -1795,8 +1789,7 @@ ccl_driver (ccl, source, destination, src_size, dst_size, charset_list)
    or nil if CCL contains invalid data.  */
 
 static Lisp_Object
-resolve_symbol_ccl_program (ccl)
-     Lisp_Object ccl;
+resolve_symbol_ccl_program (Lisp_Object ccl)
 {
   int i, veclen, unresolved = 0;
   Lisp_Object result, contents, val;
@@ -1867,9 +1860,7 @@ resolve_symbol_ccl_program (ccl)
    symbols, return Qnil.  */
 
 static Lisp_Object
-ccl_get_compiled_code (ccl_prog, idx)
-     Lisp_Object ccl_prog;
-     int *idx;
+ccl_get_compiled_code (Lisp_Object ccl_prog, int *idx)
 {
   Lisp_Object val, slot;
 
@@ -1910,9 +1901,7 @@ ccl_get_compiled_code (ccl_prog, idx)
 
    If CCL_PROG is nil, we just reset the structure pointed by CCL.  */
 int
-setup_ccl_program (ccl, ccl_prog)
-     struct ccl_program *ccl;
-     Lisp_Object ccl_prog;
+setup_ccl_program (struct ccl_program *ccl, Lisp_Object ccl_prog)
 {
   int i;
 
@@ -1953,8 +1942,7 @@ setup_ccl_program (ccl, ccl_prog)
 /* Check if CCL is updated or not.  If not, re-setup members of CCL.  */
 
 int
-check_ccl_update (ccl)
-     struct ccl_program *ccl;
+check_ccl_update (struct ccl_program *ccl)
 {
   Lisp_Object slot, ccl_prog;
 
@@ -1978,8 +1966,7 @@ check_ccl_update (ccl)
 DEFUN ("ccl-program-p", Fccl_program_p, Sccl_program_p, 1, 1, 0,
        doc: /* Return t if OBJECT is a CCL program name or a compiled CCL program code.
 See the documentation of `define-ccl-program' for the detail of CCL program.  */)
-     (object)
-     Lisp_Object object;
+  (Lisp_Object object)
 {
   Lisp_Object val;
 
@@ -2013,8 +2000,7 @@ the corresponding register after the execution.
 
 See the documentation of `define-ccl-program' for a definition of CCL
 programs.  */)
-     (ccl_prog, reg)
-     Lisp_Object ccl_prog, reg;
+  (Lisp_Object ccl_prog, Lisp_Object reg)
 {
   struct ccl_program ccl;
   int i;
@@ -2068,8 +2054,7 @@ is a unibyte string.  By default it is a multibyte string.
 
 See the documentation of `define-ccl-program' for the detail of CCL program.
 usage: (ccl-execute-on-string CCL-PROGRAM STATUS STRING &optional CONTINUE UNIBYTE-P)  */)
-     (ccl_prog, status, str, contin, unibyte_p)
-     Lisp_Object ccl_prog, status, str, contin, unibyte_p;
+  (Lisp_Object ccl_prog, Lisp_Object status, Lisp_Object str, Lisp_Object contin, Lisp_Object unibyte_p)
 {
   Lisp_Object val;
   struct ccl_program ccl;
@@ -2199,8 +2184,7 @@ DEFUN ("register-ccl-program", Fregister_ccl_program, Sregister_ccl_program,
 CCL-PROG should be a compiled CCL program (vector), or nil.
 If it is nil, just reserve NAME as a CCL program name.
 Return index number of the registered CCL program.  */)
-     (name, ccl_prog)
-     Lisp_Object name, ccl_prog;
+     (Lisp_Object name, Lisp_Object ccl_prog)
 {
   int len = ASIZE (Vccl_program_table);
   int idx;
@@ -2275,8 +2259,7 @@ DEFUN ("register-code-conversion-map", Fregister_code_conversion_map,
        2, 2, 0,
        doc: /* Register SYMBOL as code conversion map MAP.
 Return index number of the registered map.  */)
-     (symbol, map)
-     Lisp_Object symbol, map;
+  (Lisp_Object symbol, Lisp_Object map)
 {
   int len = ASIZE (Vcode_conversion_map_vector);
   int i;
@@ -2315,7 +2298,7 @@ Return index number of the registered map.  */)
 
 
 void
-syms_of_ccl ()
+syms_of_ccl (void)
 {
   staticpro (&Vccl_program_table);
   Vccl_program_table = Fmake_vector (make_number (32), Qnil);
index 54fc576c7e08d33abcfccdedd9a954d22d099ec4..e4414ddf65ce3d902ae23f2bee5df066f596abab 100644 (file)
--- a/src/ccl.h
+++ b/src/ccl.h
@@ -97,13 +97,13 @@ extern Lisp_Object Vfont_ccl_encoder_alist;
 
 /* Setup fields of the structure pointed by CCL appropriately for the
    execution of ccl program CCL_PROG (symbol or vector).  */
-extern int setup_ccl_program P_ ((struct ccl_program *, Lisp_Object));
+extern int setup_ccl_program (struct ccl_program *, Lisp_Object);
 
 /* Check if CCL is updated or not.  If not, re-setup members of CCL.  */
-extern int check_ccl_update P_ ((struct ccl_program *));
+extern int check_ccl_update (struct ccl_program *);
 
-extern void ccl_driver P_ ((struct ccl_program *, int *, int *, int, int,
-                           Lisp_Object));
+extern void ccl_driver (struct ccl_program *, int *, int *, int, int,
+                        Lisp_Object);
 
 /* Vector of CCL program names vs corresponding program data.  */
 extern Lisp_Object Vccl_program_table;
index 7cd1eedcef4ae8b79bb5042cff5430853298af0c..c4a3a008bcd193d2ce757f7ef6aab95b722001c0 100644 (file)
@@ -93,8 +93,7 @@ Lisp_Object Vunicode_category_table;
    character code if possible.  Return the resulting code.  */
 
 int
-char_resolve_modifier_mask (c)
-     int c;
+char_resolve_modifier_mask (int c)
 {
   /* A non-ASCII character can't reflect modifier bits to the code.  */
   if (! ASCII_CHAR_P ((c & ~CHAR_MODIFIER_MASK)))
@@ -143,9 +142,7 @@ char_resolve_modifier_mask (c)
    handle them appropriately.  */
 
 int
-char_string (c, p)
-     unsigned c;
-     unsigned char *p;
+char_string (unsigned int c, unsigned char *p)
 {
   int bytes;
 
@@ -199,10 +196,7 @@ char_string (c, p)
    character) of the multibyte form.  */
 
 int
-string_char (p, advanced, len)
-     const unsigned char *p;
-     const unsigned char **advanced;
-     int *len;
+string_char (const unsigned char *p, const unsigned char **advanced, int *len)
 {
   int c;
   const unsigned char *saved_p = p;
@@ -245,9 +239,7 @@ string_char (p, advanced, len)
    case, translace C by all tables.  */
 
 int
-translate_char (table, c)
-     Lisp_Object table;
-     int c;
+translate_char (Lisp_Object table, int c)
 {
   if (CHAR_TABLE_P (table))
     {
@@ -272,9 +264,7 @@ translate_char (table, c)
    future.  */
 
 int
-multibyte_char_to_unibyte (c, rev_tbl)
-     int c;
-     Lisp_Object rev_tbl;
+multibyte_char_to_unibyte (int c, Lisp_Object rev_tbl)
 {
   if (c < 0x80)
     return c;
@@ -287,8 +277,7 @@ multibyte_char_to_unibyte (c, rev_tbl)
    by charset_unibyte.  */
 
 int
-multibyte_char_to_unibyte_safe (c)
-     int c;
+multibyte_char_to_unibyte_safe (int c)
 {
   if (c < 0x80)
     return c;
@@ -299,15 +288,14 @@ multibyte_char_to_unibyte_safe (c)
 
 DEFUN ("characterp", Fcharacterp, Scharacterp, 1, 2, 0,
        doc: /* Return non-nil if OBJECT is a character.  */)
-     (object, ignore)
-     Lisp_Object object, ignore;
+  (Lisp_Object object, Lisp_Object ignore)
 {
   return (CHARACTERP (object) ? Qt : Qnil);
 }
 
 DEFUN ("max-char", Fmax_char, Smax_char, 0, 0, 0,
        doc: /* Return the character of the maximum code.  */)
-     ()
+  (void)
 {
   return make_number (MAX_CHAR);
 }
@@ -315,8 +303,7 @@ DEFUN ("max-char", Fmax_char, Smax_char, 0, 0, 0,
 DEFUN ("unibyte-char-to-multibyte", Funibyte_char_to_multibyte,
        Sunibyte_char_to_multibyte, 1, 1, 0,
        doc: /* Convert the byte CH to multibyte character.  */)
-     (ch)
-     Lisp_Object ch;
+  (Lisp_Object ch)
 {
   int c;
 
@@ -332,8 +319,7 @@ DEFUN ("multibyte-char-to-unibyte", Fmultibyte_char_to_unibyte,
        Smultibyte_char_to_unibyte, 1, 1, 0,
        doc: /* Convert the multibyte character CH to a byte.
 If the multibyte character does not represent a byte, return -1.  */)
-     (ch)
-     Lisp_Object ch;
+  (Lisp_Object ch)
 {
   int cm;
 
@@ -354,8 +340,7 @@ DEFUN ("char-bytes", Fchar_bytes, Schar_bytes, 1, 1, 0,
        doc: /* Return 1 regardless of the argument CHAR.
 This is now an obsolete function.  We keep it just for backward compatibility.
 usage: (char-bytes CHAR)  */)
-     (ch)
-     Lisp_Object ch;
+  (Lisp_Object ch)
 {
   CHECK_CHARACTER (ch);
   return make_number (1);
@@ -366,8 +351,7 @@ DEFUN ("char-width", Fchar_width, Schar_width, 1, 1, 0,
 The width is measured by how many columns it occupies on the screen.
 Tab is taken to occupy `tab-width' columns.
 usage: (char-width CHAR)  */)
-     (ch)
-       Lisp_Object ch;
+  (Lisp_Object ch)
 {
   Lisp_Object disp;
   int c, width;
@@ -446,9 +430,7 @@ c_string_width (const unsigned char *str, int len, int precision, int *nchars, i
    occupies on the screen.  */
 
 int
-strwidth (str, len)
-     unsigned char *str;
-     int len;
+strwidth (const unsigned char *str, int len)
 {
   return c_string_width (str, len, -1, NULL, NULL);
 }
@@ -461,9 +443,7 @@ strwidth (str, len)
    in *NCHARS and *NBYTES respectively.  */
 
 int
-lisp_string_width (string, precision, nchars, nbytes)
-     Lisp_Object string;
-     int precision, *nchars, *nbytes;
+lisp_string_width (Lisp_Object string, int precision, int *nchars, int *nbytes)
 {
   int len = SCHARS (string);
   /* This set multibyte to 0 even if STRING is multibyte when it
@@ -542,8 +522,7 @@ only the base leading-code is considered; the validity of
 the following bytes is not checked.  Tabs in STRING are always
 taken to occupy `tab-width' columns.
 usage: (string-width STRING)  */)
-     (str)
-     Lisp_Object str;
+  (Lisp_Object str)
 {
   Lisp_Object val;
 
@@ -556,8 +535,7 @@ DEFUN ("char-direction", Fchar_direction, Schar_direction, 1, 1, 0,
        doc: /* Return the direction of CHAR.
 The returned value is 0 for left-to-right and 1 for right-to-left.
 usage: (char-direction CHAR)  */)
-     (ch)
-     Lisp_Object ch;
+  (Lisp_Object ch)
 {
   int c;
 
@@ -573,9 +551,7 @@ usage: (char-direction CHAR)  */)
    nil, we treat each byte as a character.  */
 
 EMACS_INT
-chars_in_text (ptr, nbytes)
-     const unsigned char *ptr;
-     EMACS_INT nbytes;
+chars_in_text (const unsigned char *ptr, EMACS_INT nbytes)
 {
   /* current_buffer is null at early stages of Emacs initialization.  */
   if (current_buffer == 0
@@ -591,9 +567,7 @@ chars_in_text (ptr, nbytes)
    ignores enable-multibyte-characters.  */
 
 EMACS_INT
-multibyte_chars_in_text (ptr, nbytes)
-     const unsigned char *ptr;
-     EMACS_INT nbytes;
+multibyte_chars_in_text (const unsigned char *ptr, EMACS_INT nbytes)
 {
   const unsigned char *endp = ptr + nbytes;
   int chars = 0;
@@ -618,9 +592,7 @@ multibyte_chars_in_text (ptr, nbytes)
    represented by 2-byte in a multibyte text.  */
 
 void
-parse_str_as_multibyte (str, len, nchars, nbytes)
-     const unsigned char *str;
-     int len, *nchars, *nbytes;
+parse_str_as_multibyte (const unsigned char *str, int len, int *nchars, int *nbytes)
 {
   const unsigned char *endp = str + len;
   int n, chars = 0, bytes = 0;
@@ -662,9 +634,7 @@ parse_str_as_multibyte (str, len, nchars, nbytes)
    resulting text.  */
 
 int
-str_as_multibyte (str, len, nbytes, nchars)
-     unsigned char *str;
-     int len, nbytes, *nchars;
+str_as_multibyte (unsigned char *str, int len, int nbytes, int *nchars)
 {
   unsigned char *p = str, *endp = str + nbytes;
   unsigned char *to;
@@ -691,7 +661,7 @@ str_as_multibyte (str, len, nbytes, nchars)
   to = p;
   nbytes = endp - p;
   endp = str + len;
-  safe_bcopy ((char *) p, (char *) (endp - nbytes), nbytes);
+  memmove (endp - nbytes, p, nbytes);
   p = endp - nbytes;
 
   if (nbytes >= MAX_MULTIBYTE_LENGTH)
@@ -740,11 +710,9 @@ str_as_multibyte (str, len, nbytes, nchars)
    `str_to_multibyte'.  */
 
 int
-parse_str_to_multibyte (str, len)
-     unsigned char *str;
-     int len;
+parse_str_to_multibyte (const unsigned char *str, int len)
 {
-  unsigned char *endp = str + len;
+  const unsigned char *endp = str + len;
   int bytes;
 
   for (bytes = 0; str < endp; str++)
@@ -760,9 +728,7 @@ parse_str_to_multibyte (str, len)
    enough.  */
 
 int
-str_to_multibyte (str, len, bytes)
-     unsigned char *str;
-     int len, bytes;
+str_to_multibyte (unsigned char *str, int len, int bytes)
 {
   unsigned char *p = str, *endp = str + bytes;
   unsigned char *to;
@@ -773,7 +739,7 @@ str_to_multibyte (str, len, bytes)
   to = p;
   bytes = endp - p;
   endp = str + len;
-  safe_bcopy ((char *) p, (char *) (endp - bytes), bytes);
+  memmove (endp - bytes, p, bytes);
   p = endp - bytes;
   while (p < endp)
     {
@@ -791,9 +757,7 @@ str_to_multibyte (str, len, bytes)
    unibyte.  */
 
 int
-str_as_unibyte (str, bytes)
-     unsigned char *str;
-     int bytes;
+str_as_unibyte (unsigned char *str, int bytes)
 {
   const unsigned char *p = str, *endp = str + bytes;
   unsigned char *to;
@@ -835,11 +799,7 @@ str_as_unibyte (str, bytes)
    Note: Currently the arg ACCEPT_LATIN_1 is not used.  */
 
 EMACS_INT
-str_to_unibyte (src, dst, chars, accept_latin_1)
-     const unsigned char *src;
-     unsigned char *dst;
-     EMACS_INT chars;
-     int accept_latin_1;
+str_to_unibyte (const unsigned char *src, unsigned char *dst, EMACS_INT chars, int accept_latin_1)
 {
   EMACS_INT i;
 
@@ -859,8 +819,7 @@ str_to_unibyte (src, dst, chars, accept_latin_1)
 
 
 int
-string_count_byte8 (string)
-     Lisp_Object string;
+string_count_byte8 (Lisp_Object string)
 {
   int multibyte = STRING_MULTIBYTE (string);
   int nbytes = SBYTES (string);
@@ -890,8 +849,7 @@ string_count_byte8 (string)
 
 
 Lisp_Object
-string_escape_byte8 (string)
-     Lisp_Object string;
+string_escape_byte8 (Lisp_Object string)
 {
   int nchars = SCHARS (string);
   int nbytes = SBYTES (string);
@@ -957,9 +915,7 @@ DEFUN ("string", Fstring, Sstring, 0, MANY, 0,
        doc: /*
 Concatenate all the argument characters and make the result a string.
 usage: (string &rest CHARACTERS)  */)
-     (n, args)
-     int n;
-     Lisp_Object *args;
+  (int n, Lisp_Object *args)
 {
   int i, c;
   unsigned char *buf, *p;
@@ -984,9 +940,7 @@ usage: (string &rest CHARACTERS)  */)
 DEFUN ("unibyte-string", Funibyte_string, Sunibyte_string, 0, MANY, 0,
        doc: /* Concatenate all the argument bytes and make the result a unibyte string.
 usage: (unibyte-string &rest BYTES)  */)
-     (n, args)
-     int n;
-     Lisp_Object *args;
+  (int n, Lisp_Object *args)
 {
   int i, c;
   unsigned char *buf, *p;
@@ -1016,8 +970,7 @@ DEFUN ("char-resolve-modifiers", Fchar_resolve_modifiers,
 The value is a character with modifiers resolved into the character
 code.  Unresolved modifiers are kept in the value.
 usage: (char-resolve-modifiers CHAR)  */)
-     (character)
-     Lisp_Object character;
+  (Lisp_Object character)
 {
   int c;
 
@@ -1036,8 +989,7 @@ non-nil, is an index of a target character in the string.
 
 If the current buffer (or STRING) is multibyte, and the target
 character is not ASCII nor 8-bit character, an error is signalled.  */)
-     (position, string)
-     Lisp_Object position, string;
+  (Lisp_Object position, Lisp_Object string)
 {
   int c;
   EMACS_INT pos;
@@ -1088,14 +1040,14 @@ character is not ASCII nor 8-bit character, an error is signalled.  */)
 
 
 void
-init_character_once ()
+init_character_once (void)
 {
 }
 
 #ifdef emacs
 
 void
-syms_of_character ()
+syms_of_character (void)
 {
   DEFSYM (Qcharacterp, "characterp");
   DEFSYM (Qauto_fill_chars, "auto-fill-chars");
index dee846dbb9a0950eee3c4208f24b5a5ead9df8dc..8726b2ae1d6cc594514fcf5471660abf85ac74c8 100644 (file)
@@ -221,10 +221,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
        (ASCII_BYTE_P (byte) || LEADING_CODE_P (byte))  */
 #define CHAR_HEAD_P(byte) (((byte) & 0xC0) != 0x80)
 
-/* Kept for backward compatibility.  This macro will be removed in the
-   future.  */
-#define BASE_LEADING_CODE_P LEADING_CODE_P
-
 /* How many bytes a character that starts with BYTE occupies in a
    multibyte form.  */
 #define BYTES_BY_CHAR_HEAD(byte)       \
@@ -235,23 +231,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    : 5)
 
 
-/* Return the length of the multi-byte form at string STR of length
-   LEN while assuming that STR points a valid multi-byte form.  As
-   this macro isn't necessary anymore, all callers will be changed to
-   use BYTES_BY_CHAR_HEAD directly in the future.  */
-
-#define MULTIBYTE_FORM_LENGTH(str, len)                \
-  BYTES_BY_CHAR_HEAD (*(str))
-
-/* Parse multibyte string STR of length LENGTH and set BYTES to the
-   byte length of a character at STR while assuming that STR points a
-   valid multibyte form.  As this macro isn't necessary anymore, all
-   callers will be changed to use BYTES_BY_CHAR_HEAD directly in the
-   future.  */
-
-#define PARSE_MULTIBYTE_SEQ(str, length, bytes)        \
-  (bytes) = BYTES_BY_CHAR_HEAD (*(str))
-
 /* The byte length of multibyte form at unibyte string P ending at
    PEND.  If STR doesn't point to a valid multibyte form, return 0.  */
 
@@ -617,24 +596,24 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    : 0)
 
 
-extern int char_resolve_modifier_mask P_ ((int));
-extern int char_string P_ ((unsigned, unsigned char *));
-extern int string_char P_ ((const unsigned char *,
-                           const unsigned char **, int *));
-
-extern int translate_char P_ ((Lisp_Object, int c));
-extern int char_printable_p P_ ((int c));
-extern void parse_str_as_multibyte P_ ((const unsigned char *, int, int *,
-                                       int *));
-extern int parse_str_to_multibyte P_ ((unsigned char *, int));
-extern int str_as_multibyte P_ ((unsigned char *, int, int, int *));
-extern int str_to_multibyte P_ ((unsigned char *, int, int));
-extern int str_as_unibyte P_ ((unsigned char *, int));
-extern EMACS_INT str_to_unibyte P_ ((const unsigned char *, unsigned char *,
-                                    EMACS_INT, int));
-extern int strwidth P_ ((unsigned char *, int));
-extern int c_string_width P_ ((const unsigned char *, int, int, int *, int *));
-extern int lisp_string_width P_ ((Lisp_Object, int, int *, int *));
+extern int char_resolve_modifier_mask (int);
+extern int char_string (unsigned, unsigned char *);
+extern int string_char (const unsigned char *,
+                        const unsigned char **, int *);
+
+extern int translate_char (Lisp_Object, int c);
+extern int char_printable_p (int c);
+extern void parse_str_as_multibyte (const unsigned char *, int, int *,
+                                    int *);
+extern int parse_str_to_multibyte (const unsigned char *, int);
+extern int str_as_multibyte (unsigned char *, int, int, int *);
+extern int str_to_multibyte (unsigned char *, int, int);
+extern int str_as_unibyte (unsigned char *, int);
+extern EMACS_INT str_to_unibyte (const unsigned char *, unsigned char *,
+                                 EMACS_INT, int);
+extern int strwidth (const unsigned char *, int);
+extern int c_string_width (const unsigned char *, int, int, int *, int *);
+extern int lisp_string_width (Lisp_Object, int, int *, int *);
 
 extern Lisp_Object Vprintable_chars;
 
@@ -645,7 +624,7 @@ extern Lisp_Object Vchar_direction_table;
 extern Lisp_Object Vchar_unify_table;
 extern Lisp_Object Vunicode_category_table;
 
-extern Lisp_Object string_escape_byte8 P_ ((Lisp_Object));
+extern Lisp_Object string_escape_byte8 (Lisp_Object);
 
 /* Return a translation table of id number ID.  */
 #define GET_TRANSLATION_TABLE(id) \
@@ -657,18 +636,6 @@ extern Lisp_Object Vauto_fill_chars;
 extern Lisp_Object Vchar_script_table;
 extern Lisp_Object Vscript_representative_chars;
 
-/* Copy LEN bytes from FROM to TO.  This macro should be used only
-   when a caller knows that LEN is short and the obvious copy loop is
-   faster than calling bcopy which has some overhead.  Copying a
-   multibyte sequence of a character is the typical case.  */
-
-#define BCOPY_SHORT(from, to, len)             \
-  do {                                         \
-    int i = len;                               \
-    unsigned char *from_p = from, *to_p = to;  \
-    while (i--) *to_p++ = *from_p++;           \
-  } while (0)
-
 #define DEFSYM(sym, name)      \
   do { (sym) = intern_c_string ((name)); staticpro (&(sym)); } while (0)
 
index 3b45dc348ed89a5058e5cc676acc8f424797dd92..036d7146db69c982e8b9991e4c9252dbbfd088b2 100644 (file)
@@ -128,13 +128,6 @@ int inhibit_load_charset_map;
 
 Lisp_Object Vcurrent_iso639_language;
 
-/* Defined in chartab.c */
-extern void
-map_char_table_for_charset P_ ((void (*c_function) (Lisp_Object, Lisp_Object),
-                               Lisp_Object function, Lisp_Object table,
-                               Lisp_Object arg, struct charset *charset,
-                               unsigned from, unsigned to));
-
 #define CODE_POINT_TO_INDEX(charset, code)                             \
   ((charset)->code_linear_p                                            \
    ? (code) - (charset)->min_code                                      \
@@ -268,11 +261,7 @@ struct charset_map_entries
 */
 
 static void
-load_charset_map (charset, entries, n_entries, control_flag)
-  struct charset *charset;
-  struct charset_map_entries *entries;
-  int n_entries;
-  int control_flag;
+load_charset_map (struct charset *charset, struct charset_map_entries *entries, int n_entries, int control_flag)
 {
   Lisp_Object vec, table;
   unsigned max_code = CHARSET_MAX_CODE (charset);
@@ -441,9 +430,7 @@ load_charset_map (charset, entries, n_entries, control_flag)
    paying attention to comment charcter '#'.  */
 
 static INLINE unsigned
-read_hex (fp, eof)
-     FILE *fp;
-     int *eof;
+read_hex (FILE *fp, int *eof)
 {
   int c;
   unsigned n;
@@ -479,8 +466,6 @@ read_hex (fp, eof)
   return n;
 }
 
-extern Lisp_Object Qfile_name_handler_alist;
-
 /* Return a mapping vector for CHARSET loaded from MAPFILE.
    Each line of MAPFILE has this form
        0xAAAA 0xCCCC
@@ -498,13 +483,8 @@ extern Lisp_Object Qfile_name_handler_alist;
    Note that this function uses `openp' to open MAPFILE but ignores
    `file-name-handler-alist' to avoid running any Lisp code.  */
 
-extern void add_to_log P_ ((char *, Lisp_Object, Lisp_Object));
-
 static void
-load_charset_map_from_file (charset, mapfile, control_flag)
-     struct charset *charset;
-     Lisp_Object mapfile;
-     int control_flag;
+load_charset_map_from_file (struct charset *charset, Lisp_Object mapfile, int control_flag)
 {
   unsigned min_code = CHARSET_MIN_CODE (charset);
   unsigned max_code = CHARSET_MAX_CODE (charset);
@@ -532,7 +512,7 @@ load_charset_map_from_file (charset, mapfile, control_flag)
   SAFE_ALLOCA (head, struct charset_map_entries *,
               sizeof (struct charset_map_entries));
   entries = head;
-  bzero (entries, sizeof (struct charset_map_entries));
+  memset (entries, 0, sizeof (struct charset_map_entries));
 
   n_entries = 0;
   eof = 0;
@@ -559,7 +539,7 @@ load_charset_map_from_file (charset, mapfile, control_flag)
          SAFE_ALLOCA (entries->next, struct charset_map_entries *,
                       sizeof (struct charset_map_entries));
          entries = entries->next;
-         bzero (entries, sizeof (struct charset_map_entries));
+         memset (entries, 0, sizeof (struct charset_map_entries));
        }
       idx = n_entries % 0x10000;
       entries->entry[idx].from = from;
@@ -568,17 +548,13 @@ load_charset_map_from_file (charset, mapfile, control_flag)
       n_entries++;
     }
   fclose (fp);
-  close (fd);
 
   load_charset_map (charset, head, n_entries, control_flag);
   SAFE_FREE ();
 }
 
 static void
-load_charset_map_from_vector (charset, vec, control_flag)
-     struct charset *charset;
-     Lisp_Object vec;
-     int control_flag;
+load_charset_map_from_vector (struct charset *charset, Lisp_Object vec, int control_flag)
 {
   unsigned min_code = CHARSET_MIN_CODE (charset);
   unsigned max_code = CHARSET_MAX_CODE (charset);
@@ -599,7 +575,7 @@ load_charset_map_from_vector (charset, vec, control_flag)
   SAFE_ALLOCA (head, struct charset_map_entries *,
               sizeof (struct charset_map_entries));
   entries = head;
-  bzero (entries, sizeof (struct charset_map_entries));
+  memset (entries, 0, sizeof (struct charset_map_entries));
 
   n_entries = 0;
   for (i = 0; i < len; i += 2)
@@ -636,7 +612,7 @@ load_charset_map_from_vector (charset, vec, control_flag)
          SAFE_ALLOCA (entries->next, struct charset_map_entries *,
                       sizeof (struct charset_map_entries));
          entries = entries->next;
-         bzero (entries, sizeof (struct charset_map_entries));
+         memset (entries, 0, sizeof (struct charset_map_entries));
        }
       idx = n_entries % 0x10000;
       entries->entry[idx].from = from;
@@ -654,9 +630,7 @@ load_charset_map_from_vector (charset, vec, control_flag)
    map it is (see the comment of load_charset_map for the detail).  */
 
 static void
-load_charset (charset, control_flag)
-     struct charset *charset;
-     int control_flag;
+load_charset (struct charset *charset, int control_flag)
 {
   Lisp_Object map;
 
@@ -679,22 +653,18 @@ load_charset (charset, control_flag)
 
 DEFUN ("charsetp", Fcharsetp, Scharsetp, 1, 1, 0,
        doc: /* Return non-nil if and only if OBJECT is a charset.*/)
-     (object)
-     Lisp_Object object;
+  (Lisp_Object object)
 {
   return (CHARSETP (object) ? Qt : Qnil);
 }
 
 
-void map_charset_for_dump P_ ((void (*c_function) (Lisp_Object, Lisp_Object),
-                              Lisp_Object function, Lisp_Object arg,
-                              unsigned from, unsigned to));
+void map_charset_for_dump (void (*c_function) (Lisp_Object, Lisp_Object),
+                           Lisp_Object function, Lisp_Object arg,
+                           unsigned from, unsigned to);
 
 void
-map_charset_for_dump (c_function, function, arg, from, to)
-     void (*c_function) (Lisp_Object, Lisp_Object);
-     Lisp_Object function, arg;
-     unsigned from, to;
+map_charset_for_dump (void (*c_function) (Lisp_Object, Lisp_Object), Lisp_Object function, Lisp_Object arg, unsigned int from, unsigned int to)
 {
   int from_idx = CODE_POINT_TO_INDEX (temp_charset_work->current, from);
   int to_idx = CODE_POINT_TO_INDEX (temp_charset_work->current, to);
@@ -750,12 +720,8 @@ map_charset_for_dump (c_function, function, arg, from, to)
 }
 
 void
-map_charset_chars (c_function, function, arg,
-                  charset, from, to)
-     void (*c_function) P_ ((Lisp_Object, Lisp_Object));
-     Lisp_Object function, arg;
-     struct charset *charset;
-     unsigned from, to;
+map_charset_chars (void (*c_function)(Lisp_Object, Lisp_Object), Lisp_Object function,
+                  Lisp_Object arg, struct charset *charset, unsigned from, unsigned to)
 {
   Lisp_Object range;
   int partial;
@@ -849,8 +815,7 @@ characters contained in CHARSET.
 
 The optional 4th and 5th arguments FROM-CODE and TO-CODE specify the
 range of code points (in CHARSET) of target characters.  */)
-     (function, charset, arg, from_code, to_code)
-       Lisp_Object function, charset, arg, from_code, to_code;
+  (Lisp_Object function, Lisp_Object charset, Lisp_Object arg, Lisp_Object from_code, Lisp_Object to_code)
 {
   struct charset *cs;
   unsigned from, to;
@@ -888,9 +853,7 @@ DEFUN ("define-charset-internal", Fdefine_charset_internal,
        Sdefine_charset_internal, charset_arg_max, MANY, 0,
        doc: /* For internal use only.
 usage: (define-charset-internal ...)  */)
-     (nargs, args)
-     int nargs;
-     Lisp_Object *args;
+  (int nargs, Lisp_Object *args)
 {
   /* Charset attr vector.  */
   Lisp_Object attrs;
@@ -954,7 +917,7 @@ usage: (define-charset-internal ...)  */)
   if (! charset.code_linear_p)
     {
       charset.code_space_mask = (unsigned char *) xmalloc (256);
-      bzero (charset.code_space_mask, 256);
+      memset (charset.code_space_mask, 0, 256);
       for (i = 0; i < 4; i++)
        for (j = charset.code_space[i * 4]; j <= charset.code_space[i * 4 + 1];
             j++)
@@ -1077,7 +1040,7 @@ usage: (define-charset-internal ...)  */)
 
   charset.unified_p = 0;
 
-  bzero (charset.fast_map, sizeof (charset.fast_map));
+  memset (charset.fast_map, 0, sizeof (charset.fast_map));
 
   if (! NILP (args[charset_arg_code_offset]))
     {
@@ -1210,8 +1173,8 @@ usage: (define-charset-internal ...)  */)
          struct charset *new_table
            = (struct charset *) xmalloc (sizeof (struct charset)
                                          * (charset_table_size + 16));
-         bcopy (charset_table, new_table,
-                sizeof (struct charset) * charset_table_size);
+         memcpy (new_table, charset_table,
+                 sizeof (struct charset) * charset_table_size);
          charset_table_size += 16;
          charset_table = new_table;
        }
@@ -1301,17 +1264,13 @@ usage: (define-charset-internal ...)  */)
    charset.  */
 
 static int
-define_charset_internal (name, dimension, code_space, min_code, max_code,
-                        iso_final, iso_revision, emacs_mule_id,
-                        ascii_compatible, supplementary,
-                        code_offset)
-     Lisp_Object name;
-     int dimension;
-     unsigned char *code_space;
-     unsigned min_code, max_code;
-     int iso_final, iso_revision, emacs_mule_id;
-     int ascii_compatible, supplementary;
-     int code_offset;
+define_charset_internal (Lisp_Object name,
+                        int dimension,
+                        const unsigned char *code_space,
+                        unsigned min_code, unsigned max_code,
+                        int iso_final, int iso_revision, int emacs_mule_id,
+                        int ascii_compatible, int supplementary,
+                        int code_offset)
 {
   Lisp_Object args[charset_arg_max];
   Lisp_Object plist[14];
@@ -1365,8 +1324,7 @@ define_charset_internal (name, dimension, code_space, min_code, max_code,
 DEFUN ("define-charset-alias", Fdefine_charset_alias,
        Sdefine_charset_alias, 2, 2, 0,
        doc: /* Define ALIAS as an alias for charset CHARSET.  */)
-     (alias, charset)
-     Lisp_Object alias, charset;
+  (Lisp_Object alias, Lisp_Object charset)
 {
   Lisp_Object attr;
 
@@ -1379,8 +1337,7 @@ DEFUN ("define-charset-alias", Fdefine_charset_alias,
 
 DEFUN ("charset-plist", Fcharset_plist, Scharset_plist, 1, 1, 0,
        doc: /* Return the property list of CHARSET.  */)
-     (charset)
-     Lisp_Object charset;
+  (Lisp_Object charset)
 {
   Lisp_Object attrs;
 
@@ -1391,8 +1348,7 @@ DEFUN ("charset-plist", Fcharset_plist, Scharset_plist, 1, 1, 0,
 
 DEFUN ("set-charset-plist", Fset_charset_plist, Sset_charset_plist, 2, 2, 0,
        doc: /* Set CHARSET's property list to PLIST.  */)
-     (charset, plist)
-     Lisp_Object charset, plist;
+  (Lisp_Object charset, Lisp_Object plist)
 {
   Lisp_Object attrs;
 
@@ -1412,8 +1368,7 @@ the same meaning as the `:unify-map' attribute in the function
 `define-charset' (which see).
 
 Optional third argument DEUNIFY, if non-nil, means to de-unify CHARSET.  */)
-     (charset, unify_map, deunify)
-     Lisp_Object charset, unify_map, deunify;
+  (Lisp_Object charset, Lisp_Object unify_map, Lisp_Object deunify)
 {
   int id;
   struct charset *cs;
@@ -1468,8 +1423,7 @@ CHARS is the number of characters in a dimension: 94 or 96.
 This final char is for private use, thus the range is `0' (48) .. `?' (63).
 If there's no unused final char for the specified kind of charset,
 return nil.  */)
-     (dimension, chars)
-     Lisp_Object dimension, chars;
+  (Lisp_Object dimension, Lisp_Object chars)
 {
   int final_char;
 
@@ -1486,8 +1440,7 @@ return nil.  */)
 }
 
 static void
-check_iso_charset_parameter (dimension, chars, final_char)
-     Lisp_Object dimension, chars, final_char;
+check_iso_charset_parameter (Lisp_Object dimension, Lisp_Object chars, Lisp_Object final_char)
 {
   CHECK_NATNUM (dimension);
   CHECK_NATNUM (chars);
@@ -1509,8 +1462,7 @@ DEFUN ("declare-equiv-charset", Fdeclare_equiv_charset, Sdeclare_equiv_charset,
 On decoding by an ISO-2022 base coding system, when a charset
 specified by DIMENSION, CHARS, and FINAL-CHAR is designated, behave as
 if CHARSET is designated instead.  */)
-     (dimension, chars, final_char, charset)
-     Lisp_Object dimension, chars, final_char, charset;
+  (Lisp_Object dimension, Lisp_Object chars, Lisp_Object final_char, Lisp_Object charset)
 {
   int id;
   int chars_flag;
@@ -1537,8 +1489,7 @@ if CHARSET is designated instead.  */)
 */
 
 int
-string_xstring_p (string)
-     Lisp_Object string;
+string_xstring_p (Lisp_Object string)
 {
   const unsigned char *p = SDATA (string);
   const unsigned char *endp = p + SBYTES (string);
@@ -1565,11 +1516,7 @@ string_xstring_p (string)
    It may lookup a translation table TABLE if supplied.  */
 
 static void
-find_charsets_in_text (ptr, nchars, nbytes, charsets, table, multibyte)
-     const unsigned char *ptr;
-     EMACS_INT nchars, nbytes;
-     Lisp_Object charsets, table;
-     int multibyte;
+find_charsets_in_text (const unsigned char *ptr, EMACS_INT nchars, EMACS_INT nbytes, Lisp_Object charsets, Lisp_Object table, int multibyte)
 {
   const unsigned char *pend = ptr + nbytes;
 
@@ -1613,8 +1560,7 @@ Optional arg TABLE if non-nil is a translation table to look up.
 
 If the current buffer is unibyte, the returned list may contain
 only `ascii', `eight-bit-control', and `eight-bit-graphic'.  */)
-     (beg, end, table)
-     Lisp_Object beg, end, table;
+  (Lisp_Object beg, Lisp_Object end, Lisp_Object table)
 {
   Lisp_Object charsets;
   EMACS_INT from, from_byte, to, stop, stop_byte;
@@ -1665,8 +1611,7 @@ Optional arg TABLE if non-nil is a translation table to look up.
 
 If STR is unibyte, the returned list may contain
 only `ascii', `eight-bit-control', and `eight-bit-graphic'. */)
-     (str, table)
-     Lisp_Object str, table;
+  (Lisp_Object str, Lisp_Object table)
 {
   Lisp_Object charsets;
   int i;
@@ -1691,9 +1636,7 @@ only `ascii', `eight-bit-control', and `eight-bit-graphic'. */)
    value of Vchar_unify_table for C; i.e. it is nil, an integer, or a
    charset symbol.  */
 int
-maybe_unify_char (c, val)
-     int c;
-     Lisp_Object val;
+maybe_unify_char (int c, Lisp_Object val)
 {
   struct charset *charset;
 
@@ -1726,9 +1669,7 @@ maybe_unify_char (c, val)
    CHARSET.  */
 
 int
-decode_char (charset, code)
-     struct charset *charset;
-     unsigned code;
+decode_char (struct charset *charset, unsigned int code)
 {
   int c, char_index;
   enum charset_method method = CHARSET_METHOD (charset);
@@ -1807,9 +1748,7 @@ Lisp_Object charset_work;
    use CHARSET's strict_max_char instead of max_char.  */
 
 unsigned
-encode_char (charset, c)
-     struct charset *charset;
-     int c;
+encode_char (struct charset *charset, int c)
 {
   unsigned code;
   enum charset_method method = CHARSET_METHOD (charset);
@@ -1923,8 +1862,7 @@ CODE-POINT may be a cons (HIGHER-16-BIT-VALUE . LOWER-16-BIT-VALUE).
 
 Optional argument RESTRICTION specifies a way to map the pair of CCS
 and CODE-POINT to a character.  Currently not supported and just ignored.  */)
-  (charset, code_point, restriction)
-     Lisp_Object charset, code_point, restriction;
+  (Lisp_Object charset, Lisp_Object code_point, Lisp_Object restriction)
 {
   int c, id;
   unsigned code;
@@ -1954,8 +1892,7 @@ Return nil if CHARSET doesn't include CH.
 
 Optional argument RESTRICTION specifies a way to map CH to a
 code-point in CCS.  Currently not supported and just ignored.  */)
-     (ch, charset, restriction)
-     Lisp_Object ch, charset, restriction;
+  (Lisp_Object ch, Lisp_Object charset, Lisp_Object restriction)
 {
   int id;
   unsigned code;
@@ -1980,8 +1917,7 @@ DEFUN ("make-char", Fmake_char, Smake_char, 1, 5, 0,
 CODE1 through CODE4 are optional, but if you don't supply sufficient
 position codes, it is assumed that the minimum code in each dimension
 is specified.  */)
-     (charset, code1, code2, code3, code4)
-     Lisp_Object charset, code1, code2, code3, code4;
+  (Lisp_Object charset, Lisp_Object code1, Lisp_Object code2, Lisp_Object code3, Lisp_Object code4)
 {
   int id, dimension;
   struct charset *charsetp;
@@ -2059,10 +1995,7 @@ is specified.  */)
    Vcharset_ordered_list.  */
 
 struct charset *
-char_charset (c, charset_list, code_return)
-     int c;
-     Lisp_Object charset_list;
-     unsigned *code_return;
+char_charset (int c, Lisp_Object charset_list, unsigned int *code_return)
 {
   int maybe_null = 0;
 
@@ -2083,8 +2016,9 @@ char_charset (c, charset_list, code_return)
          return charset;
        }
       charset_list = XCDR (charset_list);
-      if (c <= MAX_UNICODE_CHAR
-        && EQ (charset_list, Vcharset_non_preferred_head))
+      if (! maybe_null
+         && c <= MAX_UNICODE_CHAR
+         && EQ (charset_list, Vcharset_non_preferred_head))
        return CHARSET_FROM_ID (charset_unicode);
     }
   return (maybe_null ? NULL
@@ -2099,8 +2033,7 @@ DEFUN ("split-char", Fsplit_char, Ssplit_char, 1, 1, 0,
 The charset is decided by the current priority order of charsets.
 A position-code is a byte value of each dimension of the code-point of
 CH in the charset.  */)
-     (ch)
-     Lisp_Object ch;
+  (Lisp_Object ch)
 {
   struct charset *charset;
   int c, dimension;
@@ -2130,8 +2063,7 @@ DEFUN ("char-charset", Fchar_charset, Schar_charset, 1, 2, 0,
 If optional 2nd arg RESTRICTION is non-nil, it is a list of charsets
 from which to find the charset.  It may also be a coding system.  In
 that case, find the charset from what supported by that coding system.  */)
-     (ch, restriction)
-     Lisp_Object ch, restriction;
+  (Lisp_Object ch, Lisp_Object restriction)
 {
   struct charset *charset;
 
@@ -2168,8 +2100,7 @@ DEFUN ("charset-after", Fcharset_after, Scharset_after, 0, 1, 0,
 Return charset of a character in the current buffer at position POS.
 If POS is nil, it defauls to the current point.
 If POS is out of range, the value is nil.  */)
-     (pos)
-     Lisp_Object pos;
+  (Lisp_Object pos)
 {
   Lisp_Object ch;
   struct charset *charset;
@@ -2191,8 +2122,7 @@ by their DIMENSION, CHARS, and FINAL-CHAR,
 whereas Emacs distinguishes them by charset symbol.
 See the documentation of the function `charset-info' for the meanings of
 DIMENSION, CHARS, and FINAL-CHAR.  */)
-     (dimension, chars, final_char)
-     Lisp_Object dimension, chars, final_char;
+  (Lisp_Object dimension, Lisp_Object chars, Lisp_Object final_char)
 {
   int id;
   int chars_flag;
@@ -2211,7 +2141,7 @@ DEFUN ("clear-charset-maps", Fclear_charset_maps, Sclear_charset_maps,
 Internal use only.
 Clear temporary charset mapping tables.
 It should be called only from temacs invoked for dumping.  */)
-     ()
+  (void)
 {
   if (temp_charset_work)
     {
@@ -2229,8 +2159,7 @@ DEFUN ("charset-priority-list", Fcharset_priority_list,
        Scharset_priority_list, 0, 1, 0,
        doc: /* Return the list of charsets ordered by priority.
 HIGHESTP non-nil means just return the highest priority one.  */)
-     (highestp)
-     Lisp_Object highestp;
+  (Lisp_Object highestp)
 {
   Lisp_Object val = Qnil, list = Vcharset_ordered_list;
 
@@ -2249,9 +2178,7 @@ DEFUN ("set-charset-priority", Fset_charset_priority, Sset_charset_priority,
        1, MANY, 0,
        doc: /* Assign higher priority to the charsets given as arguments.
 usage: (set-charset-priority &rest charsets)  */)
-       (nargs, args)
-     int nargs;
-     Lisp_Object *args;
+  (int nargs, Lisp_Object *args)
 {
   Lisp_Object new_head, old_list, arglist[2];
   Lisp_Object list_2022, list_emacs_mule;
@@ -2303,8 +2230,7 @@ DEFUN ("charset-id-internal", Fcharset_id_internal, Scharset_id_internal,
        0, 1, 0,
        doc: /* Internal use only.
 Return charset identification number of CHARSET.  */)
-     (charset)
-     Lisp_Object charset;
+  (Lisp_Object charset)
 {
   int id;
 
@@ -2377,7 +2303,7 @@ See also `charset-priority-list' and `set-charset-priority'.  */)
 
 \f
 void
-init_charset ()
+init_charset (void)
 {
   Lisp_Object tempdir;
   tempdir = Fexpand_file_name (build_string ("charsets"), Vdata_directory);
@@ -2395,7 +2321,7 @@ Please check your installation!\n",
 
 
 void
-init_charset_once ()
+init_charset_once (void)
 {
   int i, j, k;
 
@@ -2416,7 +2342,7 @@ init_charset_once ()
 #ifdef emacs
 
 void
-syms_of_charset ()
+syms_of_charset (void)
 {
   DEFSYM (Qcharsetp, "charsetp");
 
index 718859929dfef1be3f3c678aef69efcfeaf8c72e..dbe9c776a0dd3c251a4a2a5d8b5920179b49ed30 100644 (file)
@@ -517,8 +517,6 @@ extern int iso_charset_table[ISO_MAX_DIMENSION][ISO_MAX_CHARS][ISO_MAX_FINAL];
 #define EMACS_MULE_LEADING_CODE_PRIVATE_21     0x9C /* 2/2 */
 #define EMACS_MULE_LEADING_CODE_PRIVATE_22     0x9D /* 2/2 */
 
-extern struct charset *emacs_mule_charset[256];
-
 \f
 
 extern Lisp_Object Qcharsetp;
@@ -534,17 +532,17 @@ extern int charset_ksc5601;
 
 extern int charset_unibyte;
 
-extern struct charset *char_charset P_ ((int, Lisp_Object, unsigned *));
-extern Lisp_Object charset_attributes P_ ((int));
+extern struct charset *char_charset (int, Lisp_Object, unsigned *);
+extern Lisp_Object charset_attributes (int);
 
-extern int maybe_unify_char P_ ((int, Lisp_Object));
-extern int decode_char P_ ((struct charset *, unsigned));
-extern unsigned encode_char P_ ((struct charset *, int));
-extern int string_xstring_p P_ ((Lisp_Object));
+extern int maybe_unify_char (int, Lisp_Object);
+extern int decode_char (struct charset *, unsigned);
+extern unsigned encode_char (struct charset *, int);
+extern int string_xstring_p (Lisp_Object);
 
-extern void map_charset_chars P_ ((void (*) (Lisp_Object, Lisp_Object),
-                                  Lisp_Object, Lisp_Object,
-                                  struct charset *, unsigned, unsigned));
+extern void map_charset_chars (void (*) (Lisp_Object, Lisp_Object),
+                               Lisp_Object, Lisp_Object,
+                               struct charset *, unsigned, unsigned);
 
 EXFUN (Funify_charset, 3);
 
index 2b547184b21b1e816995685d785cb087cb413efc..fddd8a3d4067555528c07621f2af1f0bf628eb82 100644 (file)
@@ -62,8 +62,7 @@ PURPOSE should be a symbol.  If it has a `char-table-extra-slots'
 property, the property's value should be an integer between 0 and 10
 that specifies how many extra slots the char-table has.  Otherwise,
 the char-table has no extra slot.  */)
-     (purpose, init)
-     register Lisp_Object purpose, init;
+  (register Lisp_Object purpose, Lisp_Object init)
 {
   Lisp_Object vector;
   Lisp_Object n;
@@ -92,9 +91,7 @@ the char-table has no extra slot.  */)
 }
 
 static Lisp_Object
-make_sub_char_table (depth, min_char, defalt)
-     int depth, min_char;
-     Lisp_Object defalt;
+make_sub_char_table (int depth, int min_char, Lisp_Object defalt)
 {
   Lisp_Object table;
   int size = VECSIZE (struct Lisp_Sub_Char_Table) - 1 + chartab_size[depth];
@@ -108,8 +105,7 @@ make_sub_char_table (depth, min_char, defalt)
 }
 
 static Lisp_Object
-char_table_ascii (table)
-     Lisp_Object table;
+char_table_ascii (Lisp_Object table)
 {
   Lisp_Object sub;
 
@@ -123,8 +119,7 @@ char_table_ascii (table)
 }
 
 Lisp_Object
-copy_sub_char_table (table)
-     Lisp_Object table;
+copy_sub_char_table (Lisp_Object table)
 {
   Lisp_Object copy;
   int depth = XINT (XSUB_CHAR_TABLE (table)->depth);
@@ -148,8 +143,7 @@ copy_sub_char_table (table)
 
 
 Lisp_Object
-copy_char_table (table)
-     Lisp_Object table;
+copy_char_table (Lisp_Object table)
 {
   Lisp_Object copy;
   int size = XCHAR_TABLE (table)->size & PSEUDOVECTOR_SIZE_MASK;
@@ -175,9 +169,7 @@ copy_char_table (table)
 }
 
 Lisp_Object
-sub_char_table_ref (table, c)
-     Lisp_Object table;
-     int c;
+sub_char_table_ref (Lisp_Object table, int c)
 {
   struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table);
   int depth = XINT (tbl->depth);
@@ -191,9 +183,7 @@ sub_char_table_ref (table, c)
 }
 
 Lisp_Object
-char_table_ref (table, c)
-     Lisp_Object table;
-     int c;
+char_table_ref (Lisp_Object table, int c)
 {
   struct Lisp_Char_Table *tbl = XCHAR_TABLE (table);
   Lisp_Object val;
@@ -220,11 +210,7 @@ char_table_ref (table, c)
 }
 
 static Lisp_Object
-sub_char_table_ref_and_range (table, c, from, to, defalt)
-     Lisp_Object table;
-     int c;
-     int *from, *to;
-     Lisp_Object defalt;
+sub_char_table_ref_and_range (Lisp_Object table, int c, int *from, int *to, Lisp_Object defalt)
 {
   struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table);
   int depth = XINT (tbl->depth);
@@ -286,10 +272,7 @@ sub_char_table_ref_and_range (table, c, from, to, defalt)
    1) are different from that of C.  */
 
 Lisp_Object
-char_table_ref_and_range (table, c, from, to)
-     Lisp_Object table;
-     int c;
-     int *from, *to;
+char_table_ref_and_range (Lisp_Object table, int c, int *from, int *to)
 {
   struct Lisp_Char_Table *tbl = XCHAR_TABLE (table);
   int index = CHARTAB_IDX (c, 0, 0), idx;
@@ -363,10 +346,7 @@ char_table_ref_and_range (table, c, from, to)
 
 
 static void
-sub_char_table_set (table, c, val)
-     Lisp_Object table;
-     int c;
-     Lisp_Object val;
+sub_char_table_set (Lisp_Object table, int c, Lisp_Object val)
 {
   struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table);
   int depth = XINT ((tbl)->depth);
@@ -390,10 +370,7 @@ sub_char_table_set (table, c, val)
 }
 
 Lisp_Object
-char_table_set (table, c, val)
-     Lisp_Object table;
-     int c;
-     Lisp_Object val;
+char_table_set (Lisp_Object table, int c, Lisp_Object val)
 {
   struct Lisp_Char_Table *tbl = XCHAR_TABLE (table);
 
@@ -421,12 +398,7 @@ char_table_set (table, c, val)
 }
 
 static void
-sub_char_table_set_range (table, depth, min_char, from, to, val)
-     Lisp_Object *table;
-     int depth;
-     int min_char;
-     int from, to;
-     Lisp_Object val;
+sub_char_table_set_range (Lisp_Object *table, int depth, int min_char, int from, int to, Lisp_Object val)
 {
   int max_char = min_char + chartab_chars[depth] - 1;
 
@@ -454,10 +426,7 @@ sub_char_table_set_range (table, depth, min_char, from, to, val)
 
 
 Lisp_Object
-char_table_set_range (table, from, to, val)
-     Lisp_Object table;
-     int from, to;
-     Lisp_Object val;
+char_table_set_range (Lisp_Object table, int from, int to, Lisp_Object val)
 {
   struct Lisp_Char_Table *tbl = XCHAR_TABLE (table);
   Lisp_Object *contents = tbl->contents;
@@ -482,8 +451,7 @@ DEFUN ("char-table-subtype", Fchar_table_subtype, Schar_table_subtype,
        1, 1, 0,
        doc: /*
 Return the subtype of char-table CHAR-TABLE.  The value is a symbol.  */)
-     (char_table)
-     Lisp_Object char_table;
+  (Lisp_Object char_table)
 {
   CHECK_CHAR_TABLE (char_table);
 
@@ -497,8 +465,7 @@ The value is either nil or another char-table.
 If CHAR-TABLE holds nil for a given character,
 then the actual applicable value is inherited from the parent char-table
 \(or from its parents, if necessary).  */)
-  (char_table)
-     Lisp_Object char_table;
+  (Lisp_Object char_table)
 {
   CHECK_CHAR_TABLE (char_table);
 
@@ -509,8 +476,7 @@ DEFUN ("set-char-table-parent", Fset_char_table_parent, Sset_char_table_parent,
        2, 2, 0,
        doc: /* Set the parent char-table of CHAR-TABLE to PARENT.
 Return PARENT.  PARENT must be either nil or another char-table.  */)
-     (char_table, parent)
-     Lisp_Object char_table, parent;
+  (Lisp_Object char_table, Lisp_Object parent)
 {
   Lisp_Object temp;
 
@@ -533,8 +499,7 @@ Return PARENT.  PARENT must be either nil or another char-table.  */)
 DEFUN ("char-table-extra-slot", Fchar_table_extra_slot, Schar_table_extra_slot,
        2, 2, 0,
        doc: /* Return the value of CHAR-TABLE's extra-slot number N.  */)
-     (char_table, n)
-     Lisp_Object char_table, n;
+  (Lisp_Object char_table, Lisp_Object n)
 {
   CHECK_CHAR_TABLE (char_table);
   CHECK_NUMBER (n);
@@ -549,8 +514,7 @@ DEFUN ("set-char-table-extra-slot", Fset_char_table_extra_slot,
        Sset_char_table_extra_slot,
        3, 3, 0,
        doc: /* Set CHAR-TABLE's extra-slot number N to VALUE.  */)
-     (char_table, n, value)
-     Lisp_Object char_table, n, value;
+  (Lisp_Object char_table, Lisp_Object n, Lisp_Object value)
 {
   CHECK_CHAR_TABLE (char_table);
   CHECK_NUMBER (n);
@@ -566,8 +530,7 @@ DEFUN ("char-table-range", Fchar_table_range, Schar_table_range,
        doc: /* Return the value in CHAR-TABLE for a range of characters RANGE.
 RANGE should be nil (for the default value),
 a cons of character codes (for characters in the range), or a character code.  */)
-     (char_table, range)
-     Lisp_Object char_table, range;
+  (Lisp_Object char_table, Lisp_Object range)
 {
   Lisp_Object val;
   CHECK_CHAR_TABLE (char_table);
@@ -597,8 +560,7 @@ DEFUN ("set-char-table-range", Fset_char_table_range, Sset_char_table_range,
 RANGE should be t (for all characters), nil (for the default value),
 a cons of character codes (for characters in the range),
 or a character code.  Return VALUE.  */)
-     (char_table, range, value)
-     Lisp_Object char_table, range, value;
+  (Lisp_Object char_table, Lisp_Object range, Lisp_Object value)
 {
   CHECK_CHAR_TABLE (char_table);
   if (EQ (range, Qt))
@@ -630,8 +592,7 @@ DEFUN ("set-char-table-default", Fset_char_table_default,
        Sset_char_table_default, 3, 3, 0,
        doc: /*
 This function is obsolete and has no effect.  */)
-     (char_table, ch, value)
-     Lisp_Object char_table, ch, value;
+  (Lisp_Object char_table, Lisp_Object ch, Lisp_Object value)
 {
   return Qnil;
 }
@@ -640,9 +601,7 @@ This function is obsolete and has no effect.  */)
    integer.  If the element is not a character, return CH itself.  */
 
 int
-char_table_translate (table, ch)
-     Lisp_Object table;
-     int ch;
+char_table_translate (Lisp_Object table, int ch)
 {
   Lisp_Object value;
   value = Faref (table, make_number (ch));
@@ -652,8 +611,7 @@ char_table_translate (table, ch)
 }
 
 static Lisp_Object
-optimize_sub_char_table (table, test)
-     Lisp_Object table, test;
+optimize_sub_char_table (Lisp_Object table, Lisp_Object test)
 {
   struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table);
   int depth = XINT (tbl->depth);
@@ -686,8 +644,7 @@ DEFUN ("optimize-char-table", Foptimize_char_table, Soptimize_char_table,
        doc: /* Optimize CHAR-TABLE.
 TEST is the comparison function used to decide whether two entries are
 equivalent and can be merged.  It defaults to `equal'.  */)
-     (char_table, test)
-     Lisp_Object char_table, test;
+  (Lisp_Object char_table, Lisp_Object test)
 {
   Lisp_Object elt;
   int i;
@@ -723,10 +680,9 @@ equivalent and can be merged.  It defaults to `equal'.  */)
    following characters in TABLE have the same value.  */
 
 static Lisp_Object
-map_sub_char_table (c_function, function, table, arg, val, range,
-                   default_val, parent)
-     void (*c_function) P_ ((Lisp_Object, Lisp_Object, Lisp_Object));
-     Lisp_Object function, table, arg, val, range, default_val, parent;
+map_sub_char_table (void (*c_function) (Lisp_Object, Lisp_Object, Lisp_Object),
+                   Lisp_Object function, Lisp_Object table, Lisp_Object arg, Lisp_Object val,
+                   Lisp_Object range, Lisp_Object default_val, Lisp_Object parent)
 {
   /* Pointer to the elements of TABLE. */
   Lisp_Object *contents;
@@ -840,9 +796,7 @@ map_sub_char_table (c_function, function, table, arg, val, range,
    ARG is passed to C_FUNCTION when that is called.  */
 
 void
-map_char_table (c_function, function, table, arg)
-     void (*c_function) P_ ((Lisp_Object, Lisp_Object, Lisp_Object));
-     Lisp_Object function, table, arg;
+map_char_table (void (*c_function) (Lisp_Object, Lisp_Object, Lisp_Object), Lisp_Object function, Lisp_Object table, Lisp_Object arg)
 {
   Lisp_Object range, val;
   struct gcpro gcpro1, gcpro2, gcpro3;
@@ -902,8 +856,7 @@ Call FUNCTION for each character in CHAR-TABLE that has non-nil value.
 FUNCTION is called with two arguments--a key and a value.
 The key is a character code or a cons of character codes specifying a
 range of characters that have the same value.  */)
-     (function, char_table)
-     Lisp_Object function, char_table;
+  (Lisp_Object function, Lisp_Object char_table)
 {
   CHECK_CHAR_TABLE (char_table);
 
@@ -913,12 +866,10 @@ range of characters that have the same value.  */)
 
 
 static void
-map_sub_char_table_for_charset (c_function, function, table, arg, range,
-                               charset, from, to)
-     void (*c_function) P_ ((Lisp_Object, Lisp_Object));
-     Lisp_Object function, table, arg, range;
-     struct charset *charset;
-     unsigned from, to;
+map_sub_char_table_for_charset (void (*c_function) (Lisp_Object, Lisp_Object),
+                               Lisp_Object function, Lisp_Object table, Lisp_Object arg,
+                               Lisp_Object range, struct charset *charset,
+                               unsigned from, unsigned to)
 {
   struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table);
   int depth = XINT (tbl->depth);
@@ -1000,12 +951,10 @@ map_sub_char_table_for_charset (c_function, function, table, arg, range,
    map_charset_chars.  */
 
 void
-map_char_table_for_charset (c_function, function, table, arg,
-                           charset, from, to)
-     void (*c_function) P_ ((Lisp_Object, Lisp_Object));
-     Lisp_Object function, table, arg;
-     struct charset *charset;
-     unsigned from, to;
+map_char_table_for_charset (void (*c_function) (Lisp_Object, Lisp_Object), 
+                           Lisp_Object function, Lisp_Object table, Lisp_Object arg,
+                           struct charset *charset,
+                           unsigned from, unsigned to)
 {
   Lisp_Object range;
   int c, i;
@@ -1049,7 +998,7 @@ map_char_table_for_charset (c_function, function, table, arg,
 
 \f
 void
-syms_of_chartab ()
+syms_of_chartab (void)
 {
   defsubr (&Smake_char_table);
   defsubr (&Schar_table_parent);
index f6bf37cb7dbe2dd284ee90dfce47935aa76cfe11..dac6ece7b2d80f350643c342fed81ab6d08fe0d3 100644 (file)
--- a/src/cm.c
+++ b/src/cm.c
@@ -33,13 +33,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* For now, don't try to include termcap.h.  On some systems,
    configure finds a non-standard termcap.h that the main build
    won't find.  */
-
-#if defined HAVE_TERMCAP_H && 0
-#include <termcap.h>
-#else
-extern void tputs P_ ((const char *, int, int (*)(int)));
-extern char *tgoto P_ ((const char *, int, int));
-#endif
+extern void tputs (const char *, int, int (*)(int));
+extern char *tgoto (const char *, int, int);
 
 #define        BIG     9999            /* 9999 good on VAXen.  For 16 bit machines
                                   use about 2000.... */
@@ -50,8 +45,7 @@ int cost;             /* sums up costs */
 
 /* ARGSUSED */
 int
-evalcost (c)
-     char c;
+evalcost (int c)
 {
   cost++;
   return c;
@@ -61,8 +55,7 @@ evalcost (c)
 struct tty_display_info *current_tty;
 
 int
-cmputc (c)
-     char c;
+cmputc (int c)
 {
   if (current_tty->termscript)
     putc (c & 0177, current_tty->termscript);
@@ -331,9 +324,7 @@ losecursor ()
 #define        USECR   3
 
 void
-cmgoto (tty, row, col)
-     struct tty_display_info *tty;
-     int row, col;
+cmgoto (struct tty_display_info *tty, int row, int col)
 {
     int     homecost,
             crcost,
@@ -439,7 +430,7 @@ cmgoto (tty, row, col)
 void
 Wcm_clear (struct tty_display_info *tty)
 {
-  bzero (tty->Wcm, sizeof (struct cm));
+  memset (tty->Wcm, 0, sizeof (struct cm));
   UP = 0;
   BC = 0;
 }
index 4364a39962ef7579edce66c25100a0a19952d2ca..0ede5e0cc9866ffacb4f4d96ebdb9bca007a8e31 100644 (file)
--- a/src/cm.h
+++ b/src/cm.h
@@ -158,17 +158,17 @@ extern char PC;                   /* Pad character */
 #define losecursor(tty)         (curX(tty) = -1, curY(tty) = -1)
 
 extern int cost;
-extern int evalcost ();
+extern int evalcost (int c);
 
 #define emacs_tputs(tty, str, affcnt, putc) (current_tty = (tty), tputs (str, affcnt, putc))
 
 extern struct tty_display_info *current_tty;
-extern void cmcheckmagic P_ ((struct tty_display_info *));
-extern int cmputc P_ ((int));
-extern void cmcostinit P_ ((struct tty_display_info *));
-extern void cmgoto P_ ((struct tty_display_info *, int, int));
-extern void Wcm_clear P_ ((struct tty_display_info *));
-extern int Wcm_init P_ ((struct tty_display_info *));
+extern void cmcheckmagic (struct tty_display_info *);
+extern int cmputc (int);
+extern void cmcostinit (struct tty_display_info *);
+extern void cmgoto (struct tty_display_info *, int, int);
+extern void Wcm_clear (struct tty_display_info *);
+extern int Wcm_init (struct tty_display_info *);
 
 /* arch-tag: acc1535a-7136-49d6-b22d-9bc85702251b
    (do not change this comment) */
index 3ad6f988b2d906ff5ac7e5a50de76d4db2905582..f306ede7ca515690e884c59e537c0c892a8dcd6f 100644 (file)
@@ -37,19 +37,11 @@ Lisp_Object Qkill_forward_chars, Qkill_backward_chars, Vblink_paren_function;
 /* A possible value for a buffer's overwrite-mode variable.  */
 Lisp_Object Qoverwrite_mode_binary;
 
-/* Non-nil means put this face on the next self-inserting character.  */
-Lisp_Object Vself_insert_face;
-
-/* This is the command that set up Vself_insert_face.  */
-Lisp_Object Vself_insert_face_command;
-
-extern Lisp_Object Qface;
-extern Lisp_Object Vtranslation_table_for_input;
+static int internal_self_insert (int, int);
 \f
 DEFUN ("forward-point", Fforward_point, Sforward_point, 1, 1, 0,
        doc: /* Return buffer position N characters after (before if N negative) point.  */)
-     (n)
-     Lisp_Object n;
+  (Lisp_Object n)
 {
   CHECK_NUMBER (n);
 
@@ -57,10 +49,13 @@ DEFUN ("forward-point", Fforward_point, Sforward_point, 1, 1, 0,
 }
 
 DEFUN ("forward-char", Fforward_char, Sforward_char, 0, 1, "^p",
-       doc: /* Move point right N characters (left if N is negative).
-On reaching end of buffer, stop and signal error.  */)
-     (n)
-     Lisp_Object n;
+       doc: /* Move point N characters forward (backward if N is negative).
+On reaching end or beginning of buffer, stop and signal error.
+
+Depending on the bidirectional context, the movement may be to the
+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);
@@ -93,10 +88,13 @@ On reaching end of buffer, stop and signal error.  */)
 }
 
 DEFUN ("backward-char", Fbackward_char, Sbackward_char, 0, 1, "^p",
-       doc: /* Move point left N characters (right if N is negative).
-On attempt to pass beginning or end of buffer, stop and signal error.  */)
-     (n)
-     Lisp_Object n;
+       doc: /* Move point N characters backward (forward if N is negative).
+On attempt to pass beginning or end of buffer, stop and signal error.
+
+Depending on the bidirectional context, the movement may be to the
+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);
@@ -109,14 +107,14 @@ On attempt to pass beginning or end of buffer, stop and signal error.  */)
 
 DEFUN ("forward-line", Fforward_line, Sforward_line, 0, 1, "^p",
        doc: /* Move N lines forward (backward if N is negative).
-Precisely, if point is on line I, move to the start of line I + N.
+Precisely, if point is on line I, move to the start of line I + N
+\("start of line" in the logical order).
 If there isn't room, go as far as possible (no error).
 Returns the count of lines left to move.  If moving forward,
 that is N - number of lines moved; if backward, N + number moved.
 With positive N, a non-empty line at the end counts as one line
-  successfully moved (for the return value).  */)
-     (n)
-     Lisp_Object n;
+successfully moved (for the return value).  */)
+  (Lisp_Object n)
 {
   int opoint = PT, opoint_byte = PT_BYTE;
   int pos, pos_byte;
@@ -154,19 +152,18 @@ With positive N, a non-empty line at the end counts as one line
 }
 
 DEFUN ("beginning-of-line", Fbeginning_of_line, Sbeginning_of_line, 0, 1, "^p",
-       doc: /* Move point to beginning of current line.
+       doc: /* Move point to beginning of current line (in the logical order).
 With argument N not nil or 1, move forward N - 1 lines first.
 If point reaches the beginning or end of buffer, it stops there.
 
 This function constrains point to the current field unless this moves
-point to a different line than the original, unconstrained result.  If
-N is nil or 1, and a front-sticky field starts at point, the point
+point to a different line than the original, unconstrained result.
+If N is nil or 1, and a front-sticky field starts at point, the point
 does not move.  To ignore field boundaries bind
 `inhibit-field-text-motion' to t, or use the `forward-line' function
 instead.  For instance, `(forward-line 0)' does the same thing as
 `(beginning-of-line)', except that it ignores field boundaries.  */)
-     (n)
-     Lisp_Object n;
+  (Lisp_Object n)
 {
   if (NILP (n))
     XSETFASTINT (n, 1);
@@ -179,7 +176,7 @@ instead.  For instance, `(forward-line 0)' does the same thing as
 }
 
 DEFUN ("end-of-line", Fend_of_line, Send_of_line, 0, 1, "^p",
-       doc: /* Move point to end of current line.
+       doc: /* Move point to end of current line (in the logical order).
 With argument N not nil or 1, move forward N - 1 lines first.
 If point reaches the beginning or end of buffer, it stops there.
 To ignore intangibility, bind `inhibit-point-motion-hooks' to t.
@@ -189,8 +186,7 @@ point to a different line than the original, unconstrained result.  If
 N is nil or 1, and a rear-sticky field ends at point, the point does
 not move.  To ignore field boundaries bind `inhibit-field-text-motion'
 to t.  */)
-     (n)
-     Lisp_Object n;
+  (Lisp_Object n)
 {
   int newpos;
 
@@ -232,9 +228,10 @@ DEFUN ("delete-char", Fdelete_char, Sdelete_char, 1, 2, "p\nP",
        doc: /* Delete the following N characters (previous if N is negative).
 Optional second arg KILLFLAG non-nil means kill instead (save in kill ring).
 Interactively, N is the prefix arg, and KILLFLAG is set if
-N was explicitly specified.  */)
-     (n, killflag)
-     Lisp_Object n, killflag;
+N was explicitly specified.
+
+The command `delete-forward' is preferable for interactive use.  */)
+  (Lisp_Object n, Lisp_Object killflag)
 {
   int pos;
 
@@ -265,61 +262,7 @@ N was explicitly specified.  */)
   return Qnil;
 }
 
-DEFUN ("delete-backward-char", Fdelete_backward_char, Sdelete_backward_char,
-       1, 2, "p\nP",
-       doc: /* Delete the previous N characters (following if N is negative).
-Optional second arg KILLFLAG non-nil means kill instead (save in kill ring).
-Interactively, N is the prefix arg, and KILLFLAG is set if
-N was explicitly specified.
-This is meant for interactive use only; from Lisp, better use `delete-char'
-with a negated argument.  */)
-     (n, killflag)
-     Lisp_Object n, killflag;
-{
-  Lisp_Object value;
-  int deleted_special = 0;
-  int pos, pos_byte, i;
-
-  CHECK_NUMBER (n);
-
-  /* See if we are about to delete a tab or newline backwards.  */
-  pos = PT;
-  pos_byte = PT_BYTE;
-  for (i = 0; i < XINT (n) && pos_byte > BEGV_BYTE; i++)
-    {
-      int c;
-
-      DEC_BOTH (pos, pos_byte);
-      c = FETCH_BYTE (pos_byte);
-      if (c == '\t' || c == '\n')
-       {
-         deleted_special = 1;
-         break;
-       }
-    }
-
-  /* In overwrite mode, back over columns while clearing them out,
-     unless at end of line.  */
-  if (XINT (n) > 0
-      && ! NILP (current_buffer->overwrite_mode)
-      && ! deleted_special
-      && ! (PT == ZV || FETCH_BYTE (PT_BYTE) == '\n'))
-    {
-      int column = (int) current_column (); /* iftc */
-
-      value = Fdelete_char (make_number (-XINT (n)), killflag);
-      i = column - (int) current_column (); /* iftc */
-      Finsert_char (make_number (' '), make_number (i), Qnil);
-      /* Whitespace chars are ASCII chars, so we can simply subtract.  */
-      SET_PT_BOTH (PT - i, PT_BYTE - i);
-    }
-  else
-    value = Fdelete_char (make_number (-XINT (n)), killflag);
-
-  return value;
-}
-
-int nonundocount;
+static int nonundocount;
 
 /* Note that there's code in command_loop_1 which typically avoids
    calling this.  */
@@ -330,8 +273,7 @@ Before insertion, `expand-abbrev' is executed if the inserted character does
 not have word syntax and the previous character in the buffer does.
 After insertion, the value of `auto-fill-function' is called if the
 `auto-fill-chars' table has a non-nil value for the inserted character.  */)
-     (n)
-     Lisp_Object n;
+  (Lisp_Object n)
 {
   int remove_boundary = 1;
   CHECK_NUMBER (n);
@@ -398,11 +340,10 @@ After insertion, the value of `auto-fill-function' is called if the
    A value of 2 means this did things that call for an undo boundary.  */
 
 static Lisp_Object Qexpand_abbrev;
+static Lisp_Object Qpost_self_insert_hook, Vpost_self_insert_hook;
 
-int
-internal_self_insert (c, noautofill)
-     int c;
-     int noautofill;
+static int
+internal_self_insert (int c, int noautofill)
 {
   int hairy = 0;
   Lisp_Object tem;
@@ -505,10 +446,10 @@ internal_self_insert (c, noautofill)
       && synt != Sword
       && NILP (current_buffer->read_only)
       && PT > BEGV
-      && (!NILP (current_buffer->enable_multibyte_characters)
-         ? SYNTAX (XFASTINT (Fprevious_char ())) == Sword
-         : (SYNTAX (UNIBYTE_TO_CHAR (XFASTINT (Fprevious_char ())))
-            == Sword)))
+      && (SYNTAX (!NILP (current_buffer->enable_multibyte_characters)
+                 ? XFASTINT (Fprevious_char ())
+                 : UNIBYTE_TO_CHAR (XFASTINT (Fprevious_char ())))
+         == Sword))
     {
       int modiff = MODIFF;
       Lisp_Object sym;
@@ -568,15 +509,6 @@ internal_self_insert (c, noautofill)
        hairy = 2;
     }
 
-  /* If previous command specified a face to use, use it.  */
-  if (!NILP (Vself_insert_face)
-      && EQ (current_kboard->Vlast_command, Vself_insert_face_command))
-    {
-      Fput_text_property (make_number (PT - 1), make_number (PT),
-                         Qface, Vself_insert_face, Qnil);
-      Vself_insert_face = Qnil;
-    }
-
   if ((synt == Sclose || synt == Smath)
       && !NILP (Vblink_paren_function) && INTERACTIVE
       && !noautofill)
@@ -584,13 +516,16 @@ internal_self_insert (c, noautofill)
       call0 (Vblink_paren_function);
       hairy = 2;
     }
+  /* Run hooks for electric keys.  */
+  call1 (Vrun_hooks, Qpost_self_insert_hook);
+
   return hairy;
 }
 \f
 /* module initialization */
 
 void
-syms_of_cmds ()
+syms_of_cmds (void)
 {
   Qkill_backward_chars = intern_c_string ("kill-backward-chars");
   staticpro (&Qkill_backward_chars);
@@ -604,15 +539,13 @@ syms_of_cmds ()
   Qexpand_abbrev = intern_c_string ("expand-abbrev");
   staticpro (&Qexpand_abbrev);
 
-  DEFVAR_LISP ("self-insert-face", &Vself_insert_face,
-              doc: /* If non-nil, set the face of the next self-inserting character to this.
-See also `self-insert-face-command'.  */);
-  Vself_insert_face = Qnil;
+  Qpost_self_insert_hook = intern_c_string ("post-self-insert-hook");
+  staticpro (&Qpost_self_insert_hook);
 
-  DEFVAR_LISP ("self-insert-face-command", &Vself_insert_face_command,
-              doc: /* This is the command that set up `self-insert-face'.
-If `last-command' does not equal this value, we ignore `self-insert-face'.  */);
-  Vself_insert_face_command = Qnil;
+  DEFVAR_LISP ("post-self-insert-hook", &Vpost_self_insert_hook,
+              doc: /* Hook run at the end of `self-insert-command'.
+This run is run after inserting the charater.  */);
+  Vpost_self_insert_hook = Qnil;
 
   DEFVAR_LISP ("blink-paren-function", &Vblink_paren_function,
               doc: /* Function called, if non-nil, whenever a close parenthesis is inserted.
@@ -627,13 +560,11 @@ More precisely, a char with closeparen syntax is self-inserted.  */);
   defsubr (&Send_of_line);
 
   defsubr (&Sdelete_char);
-  defsubr (&Sdelete_backward_char);
-
   defsubr (&Sself_insert_command);
 }
 
 void
-keys_of_cmds ()
+keys_of_cmds (void)
 {
   int n;
 
@@ -650,10 +581,8 @@ keys_of_cmds ()
 
   initial_define_key (global_map, Ctl ('A'), "beginning-of-line");
   initial_define_key (global_map, Ctl ('B'), "backward-char");
-  initial_define_key (global_map, Ctl ('D'), "delete-char");
   initial_define_key (global_map, Ctl ('E'), "end-of-line");
   initial_define_key (global_map, Ctl ('F'), "forward-char");
-  initial_define_key (global_map, 0177, "delete-backward-char");
 }
 
 /* arch-tag: 022ba3cd-67f9-4978-9c5d-7d2b18d8644e
index aef80f5cc806db7ea24541bb94f3745da50983e3..6012978b60a3e143236bc464784dfbdecea90796 100644 (file)
@@ -154,9 +154,8 @@ STRUCT CODING_SYSTEM
 
 #if 0
 static int
-detect_coding_XXX (coding, detect_info)
-     struct coding_system *coding;
-     struct coding_detection_info *detect_info;
+detect_coding_XXX (struct coding_system *coding,
+                  struct coding_detection_info *detect_info)
 {
   const unsigned char *src = coding->source;
   const unsigned char *src_end = coding->source + coding->src_bytes;
@@ -203,8 +202,7 @@ detect_coding_XXX (coding, detect_info)
 
 #if 0
 static void
-decode_coding_XXXX (coding)
-     struct coding_system *coding;
+decode_coding_XXXX (struct coding_system *coding)
 {
   const unsigned char *src = coding->source + coding->consumed;
   const unsigned char *src_end = coding->source + coding->src_bytes;
@@ -261,8 +259,7 @@ decode_coding_XXXX (coding)
   Below is a template of these functions.  */
 #if 0
 static void
-encode_coding_XXX (coding)
-     struct coding_system *coding;
+encode_coding_XXX (struct coding_system *coding)
 {
   int multibytep = coding->dst_multibyte;
   int *charbuf = coding->charbuf;
@@ -306,7 +303,6 @@ Lisp_Object Vcoding_system_hash_table;
 
 Lisp_Object Qcoding_system, Qcoding_aliases, Qeol_type;
 Lisp_Object Qunix, Qdos;
-extern Lisp_Object Qmac;       /* frame.c */
 Lisp_Object Qbuffer_file_coding_system;
 Lisp_Object Qpost_read_conversion, Qpre_write_conversion;
 Lisp_Object Qdefault_char;
@@ -320,7 +316,6 @@ Lisp_Object QCdecode_translation_table, QCencode_translation_table;
 Lisp_Object QCpost_read_conversion, QCpre_write_conversion;
 Lisp_Object QCascii_compatible_p;
 
-extern Lisp_Object Qinsert_file_contents, Qwrite_region;
 Lisp_Object Qcall_process, Qcall_process_region;
 Lisp_Object Qstart_process, Qopen_network_stream;
 Lisp_Object Qtarget_idx;
@@ -328,8 +323,6 @@ Lisp_Object Qtarget_idx;
 Lisp_Object Qinsufficient_source, Qinconsistent_eol, Qinvalid_source;
 Lisp_Object Qinterrupted, Qinsufficient_memory;
 
-extern Lisp_Object Qcompletion_ignore_case;
-
 /* If a symbol has this property, evaluate the value to define the
    symbol as a coding system.  */
 static Lisp_Object Qcoding_system_define_form;
@@ -896,80 +889,80 @@ static struct coding_system coding_categories[coding_category_max];
 
 
 /* Prototypes for static functions.  */
-static void record_conversion_result P_ ((struct coding_system *coding,
-                                         enum coding_result_code result));
-static int detect_coding_utf_8 P_ ((struct coding_system *,
-                                   struct coding_detection_info *info));
-static void decode_coding_utf_8 P_ ((struct coding_system *));
-static int encode_coding_utf_8 P_ ((struct coding_system *));
-
-static int detect_coding_utf_16 P_ ((struct coding_system *,
-                                    struct coding_detection_info *info));
-static void decode_coding_utf_16 P_ ((struct coding_system *));
-static int encode_coding_utf_16 P_ ((struct coding_system *));
-
-static int detect_coding_iso_2022 P_ ((struct coding_system *,
-                                      struct coding_detection_info *info));
-static void decode_coding_iso_2022 P_ ((struct coding_system *));
-static int encode_coding_iso_2022 P_ ((struct coding_system *));
-
-static int detect_coding_emacs_mule P_ ((struct coding_system *,
-                                        struct coding_detection_info *info));
-static void decode_coding_emacs_mule P_ ((struct coding_system *));
-static int encode_coding_emacs_mule P_ ((struct coding_system *));
-
-static int detect_coding_sjis P_ ((struct coding_system *,
-                                  struct coding_detection_info *info));
-static void decode_coding_sjis P_ ((struct coding_system *));
-static int encode_coding_sjis P_ ((struct coding_system *));
-
-static int detect_coding_big5 P_ ((struct coding_system *,
-                                  struct coding_detection_info *info));
-static void decode_coding_big5 P_ ((struct coding_system *));
-static int encode_coding_big5 P_ ((struct coding_system *));
-
-static int detect_coding_ccl P_ ((struct coding_system *,
-                                 struct coding_detection_info *info));
-static void decode_coding_ccl P_ ((struct coding_system *));
-static int encode_coding_ccl P_ ((struct coding_system *));
-
-static void decode_coding_raw_text P_ ((struct coding_system *));
-static int encode_coding_raw_text P_ ((struct coding_system *));
-
-static void coding_set_source P_ ((struct coding_system *));
-static void coding_set_destination P_ ((struct coding_system *));
-static void coding_alloc_by_realloc P_ ((struct coding_system *, EMACS_INT));
-static void coding_alloc_by_making_gap P_ ((struct coding_system *,
-                                           EMACS_INT, EMACS_INT));
-static unsigned char *alloc_destination P_ ((struct coding_system *,
-                                            EMACS_INT, unsigned char *));
-static void setup_iso_safe_charsets P_ ((Lisp_Object));
-static unsigned char *encode_designation_at_bol P_ ((struct coding_system *,
-                                                    int *, int *,
-                                                    unsigned char *));
-static int detect_eol P_ ((const unsigned char *,
-                          EMACS_INT, enum coding_category));
-static Lisp_Object adjust_coding_eol_type P_ ((struct coding_system *, int));
-static void decode_eol P_ ((struct coding_system *));
-static Lisp_Object get_translation_table P_ ((Lisp_Object, int, int *));
-static Lisp_Object get_translation P_ ((Lisp_Object, int *, int *));
-static int produce_chars P_ ((struct coding_system *, Lisp_Object, int));
-static INLINE void produce_charset P_ ((struct coding_system *, int *,
-                                       EMACS_INT));
-static void produce_annotation P_ ((struct coding_system *, EMACS_INT));
-static int decode_coding P_ ((struct coding_system *));
-static INLINE int *handle_composition_annotation P_ ((EMACS_INT, EMACS_INT,
-                                                     struct coding_system *,
-                                                     int *, EMACS_INT *));
-static INLINE int *handle_charset_annotation P_ ((EMACS_INT, EMACS_INT,
-                                                 struct coding_system *,
-                                                 int *, EMACS_INT *));
-static void consume_chars P_ ((struct coding_system *, Lisp_Object, int));
-static int encode_coding P_ ((struct coding_system *));
-static Lisp_Object make_conversion_work_buffer P_ ((int));
-static Lisp_Object code_conversion_restore P_ ((Lisp_Object));
-static INLINE int char_encodable_p P_ ((int, Lisp_Object));
-static Lisp_Object make_subsidiaries P_ ((Lisp_Object));
+static void record_conversion_result (struct coding_system *coding,
+                                      enum coding_result_code result);
+static int detect_coding_utf_8 (struct coding_system *,
+                                struct coding_detection_info *info);
+static void decode_coding_utf_8 (struct coding_system *);
+static int encode_coding_utf_8 (struct coding_system *);
+
+static int detect_coding_utf_16 (struct coding_system *,
+                                 struct coding_detection_info *info);
+static void decode_coding_utf_16 (struct coding_system *);
+static int encode_coding_utf_16 (struct coding_system *);
+
+static int detect_coding_iso_2022 (struct coding_system *,
+                                   struct coding_detection_info *info);
+static void decode_coding_iso_2022 (struct coding_system *);
+static int encode_coding_iso_2022 (struct coding_system *);
+
+static int detect_coding_emacs_mule (struct coding_system *,
+                                     struct coding_detection_info *info);
+static void decode_coding_emacs_mule (struct coding_system *);
+static int encode_coding_emacs_mule (struct coding_system *);
+
+static int detect_coding_sjis (struct coding_system *,
+                               struct coding_detection_info *info);
+static void decode_coding_sjis (struct coding_system *);
+static int encode_coding_sjis (struct coding_system *);
+
+static int detect_coding_big5 (struct coding_system *,
+                               struct coding_detection_info *info);
+static void decode_coding_big5 (struct coding_system *);
+static int encode_coding_big5 (struct coding_system *);
+
+static int detect_coding_ccl (struct coding_system *,
+                              struct coding_detection_info *info);
+static void decode_coding_ccl (struct coding_system *);
+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 void coding_set_source (struct coding_system *);
+static void coding_set_destination (struct coding_system *);
+static void coding_alloc_by_realloc (struct coding_system *, EMACS_INT);
+static void coding_alloc_by_making_gap (struct coding_system *,
+                                        EMACS_INT, EMACS_INT);
+static unsigned char *alloc_destination (struct coding_system *,
+                                         EMACS_INT, unsigned char *);
+static void setup_iso_safe_charsets (Lisp_Object);
+static unsigned char *encode_designation_at_bol (struct coding_system *,
+                                                 int *, int *,
+                                                 unsigned char *);
+static int detect_eol (const unsigned char *,
+                       EMACS_INT, 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);
+static int decode_coding (struct coding_system *);
+static INLINE int *handle_composition_annotation (EMACS_INT, EMACS_INT,
+                                                  struct coding_system *,
+                                                  int *, EMACS_INT *);
+static INLINE int *handle_charset_annotation (EMACS_INT, EMACS_INT,
+                                              struct coding_system *,
+                                              int *, EMACS_INT *);
+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);
+static Lisp_Object code_conversion_restore (Lisp_Object);
+static INLINE int char_encodable_p (int, Lisp_Object);
+static Lisp_Object make_subsidiaries (Lisp_Object);
 
 static void
 record_conversion_result (struct coding_system *coding,
@@ -1106,8 +1099,7 @@ record_conversion_result (struct coding_system *coding,
 
 
 static void
-coding_set_source (coding)
-     struct coding_system *coding;
+coding_set_source (struct coding_system *coding)
 {
   if (BUFFERP (coding->src_object))
     {
@@ -1129,8 +1121,7 @@ coding_set_source (coding)
 }
 
 static void
-coding_set_destination (coding)
-     struct coding_system *coding;
+coding_set_destination (struct coding_system *coding)
 {
   if (BUFFERP (coding->dst_object))
     {
@@ -1159,9 +1150,7 @@ coding_set_destination (coding)
 
 
 static void
-coding_alloc_by_realloc (coding, bytes)
-     struct coding_system *coding;
-     EMACS_INT bytes;
+coding_alloc_by_realloc (struct coding_system *coding, EMACS_INT bytes)
 {
   coding->destination = (unsigned char *) xrealloc (coding->destination,
                                                    coding->dst_bytes + bytes);
@@ -1169,9 +1158,8 @@ coding_alloc_by_realloc (coding, bytes)
 }
 
 static void
-coding_alloc_by_making_gap (coding, gap_head_used, bytes)
-     struct coding_system *coding;
-     EMACS_INT gap_head_used, bytes;
+coding_alloc_by_making_gap (struct coding_system *coding,
+                           EMACS_INT gap_head_used, EMACS_INT bytes)
 {
   if (EQ (coding->src_object, coding->dst_object))
     {
@@ -1200,10 +1188,8 @@ coding_alloc_by_making_gap (coding, gap_head_used, bytes)
 
 
 static unsigned char *
-alloc_destination (coding, nbytes, dst)
-     struct coding_system *coding;
-     EMACS_INT nbytes;
-     unsigned char *dst;
+alloc_destination (struct coding_system *coding, EMACS_INT nbytes,
+                  unsigned char *dst)
 {
   EMACS_INT offset = dst - coding->destination;
 
@@ -1301,9 +1287,8 @@ alloc_destination (coding, nbytes, dst)
 #define UTF_8_BOM_3 0xBF
 
 static int
-detect_coding_utf_8 (coding, detect_info)
-     struct coding_system *coding;
-     struct coding_detection_info *detect_info;
+detect_coding_utf_8 (struct coding_system *coding,
+                    struct coding_detection_info *detect_info)
 {
   const unsigned char *src = coding->source, *src_base;
   const unsigned char *src_end = coding->source + coding->src_bytes;
@@ -1386,8 +1371,7 @@ detect_coding_utf_8 (coding, detect_info)
 
 
 static void
-decode_coding_utf_8 (coding)
-     struct coding_system *coding;
+decode_coding_utf_8 (struct coding_system *coding)
 {
   const unsigned char *src = coding->source + coding->consumed;
   const unsigned char *src_end = coding->source + coding->src_bytes;
@@ -1435,8 +1419,6 @@ decode_coding_utf_8 (coding)
     }
   CODING_UTF_8_BOM (coding) = utf_without_bom;
 
-
-
   while (1)
     {
       int c, c1, c2, c3, c4, c5;
@@ -1459,7 +1441,7 @@ decode_coding_utf_8 (coding)
        {
          c = - c1;
        }
-      else if (UTF_8_1_OCTET_P(c1))
+      else if (UTF_8_1_OCTET_P (c1))
        {
          if (eol_crlf && c1 == '\r')
            ONE_MORE_BYTE (byte_after_cr);
@@ -1543,8 +1525,7 @@ decode_coding_utf_8 (coding)
 
 
 static int
-encode_coding_utf_8 (coding)
-     struct coding_system *coding;
+encode_coding_utf_8 (struct coding_system *coding)
 {
   int multibytep = coding->dst_multibyte;
   int *charbuf = coding->charbuf;
@@ -1623,9 +1604,8 @@ encode_coding_utf_8 (coding)
 
 
 static int
-detect_coding_utf_16 (coding, detect_info)
-     struct coding_system *coding;
-     struct coding_detection_info *detect_info;
+detect_coding_utf_16 (struct coding_system *coding,
+                     struct coding_detection_info *detect_info)
 {
   const unsigned char *src = coding->source, *src_base = src;
   const unsigned char *src_end = coding->source + coding->src_bytes;
@@ -1708,8 +1688,7 @@ detect_coding_utf_16 (coding, detect_info)
 }
 
 static void
-decode_coding_utf_16 (coding)
-     struct coding_system *coding;
+decode_coding_utf_16 (struct coding_system *coding)
 {
   const unsigned char *src = coding->source + coding->consumed;
   const unsigned char *src_end = coding->source + coding->src_bytes;
@@ -1837,8 +1816,7 @@ decode_coding_utf_16 (coding)
 }
 
 static int
-encode_coding_utf_16 (coding)
-     struct coding_system *coding;
+encode_coding_utf_16 (struct coding_system *coding)
 {
   int multibytep = coding->dst_multibyte;
   int *charbuf = coding->charbuf;
@@ -1979,9 +1957,8 @@ char emacs_mule_bytes[256];
    else return 0.  */
 
 static int
-detect_coding_emacs_mule (coding, detect_info)
-     struct coding_system *coding;
-     struct coding_detection_info *detect_info;
+detect_coding_emacs_mule (struct coding_system *coding,
+                         struct coding_detection_info *detect_info)
 {
   const unsigned char *src = coding->source, *src_base;
   const unsigned char *src_end = coding->source + coding->src_bytes;
@@ -2069,11 +2046,9 @@ detect_coding_emacs_mule (coding, detect_info)
    -1.  If SRC is too short, return -2.  */
 
 int
-emacs_mule_char (coding, src, nbytes, nchars, id, cmp_status)
-     struct coding_system *coding;
-     const unsigned char *src;
-     int *nbytes, *nchars, *id;
-     struct composition_status *cmp_status;
+emacs_mule_char (struct coding_system *coding, const unsigned char *src,
+                int *nbytes, int *nchars, int *id,
+                struct composition_status *cmp_status)
 {
   const unsigned char *src_end = coding->source + coding->src_bytes;
   const unsigned char *src_base = src;
@@ -2210,7 +2185,7 @@ emacs_mule_char (coding, src, nbytes, nchars, id, cmp_status)
    (3) alt&rule composition: 0x80 0xF5 BYTES CHARS | ALT RULE ... ALT CHAR ...
 
    and these old form:
-  
+
    (4) relative composition: 0x80 | MSEQ ... MSEQ
    (5) rulebase composition: 0x80 0xFF | MSEQ MRULE ... MSEQ
 
@@ -2391,9 +2366,8 @@ emacs_mule_char (coding, src, nbytes, nchars, id, cmp_status)
 
 
 static int
-emacs_mule_finish_composition (charbuf, cmp_status)
-     int *charbuf;
-     struct composition_status *cmp_status;
+emacs_mule_finish_composition (int *charbuf,
+                              struct composition_status *cmp_status)
 {
   int idx = - cmp_status->length;
   int new_chars;
@@ -2448,8 +2422,7 @@ emacs_mule_finish_composition (charbuf, cmp_status)
 
 
 static void
-decode_coding_emacs_mule (coding)
-     struct coding_system *coding;
+decode_coding_emacs_mule (struct coding_system *coding)
 {
   const unsigned char *src = coding->source + coding->consumed;
   const unsigned char *src_end = coding->source + coding->src_bytes;
@@ -2713,8 +2686,7 @@ decode_coding_emacs_mule (coding)
 
 
 static int
-encode_coding_emacs_mule (coding)
-     struct coding_system *coding;
+encode_coding_emacs_mule (struct coding_system *coding)
 {
   int multibytep = coding->dst_multibyte;
   int *charbuf = coding->charbuf;
@@ -3007,8 +2979,7 @@ enum iso_code_class_type iso_code_class[256];
   (CODING_ISO_INITIAL (&coding_categories[category], 1) >= 0)
 
 static void
-setup_iso_safe_charsets (attrs)
-     Lisp_Object attrs;
+setup_iso_safe_charsets (Lisp_Object attrs)
 {
   Lisp_Object charset_list, safe_charsets;
   Lisp_Object request;
@@ -3076,9 +3047,8 @@ setup_iso_safe_charsets (attrs)
    If it is, return 1, else return 0.  */
 
 static int
-detect_coding_iso_2022 (coding, detect_info)
-     struct coding_system *coding;
-     struct coding_detection_info *detect_info;
+detect_coding_iso_2022 (struct coding_system *coding,
+                       struct coding_detection_info *detect_info)
 {
   const unsigned char *src = coding->source, *src_base = src;
   const unsigned char *src_end = coding->source + coding->src_bytes;
@@ -3442,12 +3412,10 @@ detect_coding_iso_2022 (coding, detect_info)
 
 /* Finish the current composition as invalid.  */
 
-static int finish_composition P_ ((int *, struct composition_status *));
+static int finish_composition (int *, struct composition_status *);
 
 static int
-finish_composition (charbuf, cmp_status)
-     int *charbuf;
-     struct composition_status *cmp_status;
+finish_composition (int *charbuf, struct composition_status *cmp_status)
 {
   int idx = - cmp_status->length;
   int new_chars;
@@ -3584,8 +3552,7 @@ finish_composition (charbuf, cmp_status)
 /* See the above "GENERAL NOTES on `decode_coding_XXX ()' functions".  */
 
 static void
-decode_coding_iso_2022 (coding)
-     struct coding_system *coding;
+decode_coding_iso_2022 (struct coding_system *coding)
 {
   const unsigned char *src = coding->source + coding->consumed;
   const unsigned char *src_end = coding->source + coding->src_bytes;
@@ -4130,8 +4097,8 @@ decode_coding_iso_2022 (coding)
 #define ENCODE_DESIGNATION(charset, reg, coding)                       \
   do {                                                                 \
     unsigned char final_char = CHARSET_ISO_FINAL (charset);            \
-    char *intermediate_char_94 = "()*+";                               \
-    char *intermediate_char_96 = ",-./";                               \
+    const char *intermediate_char_94 = "()*+";                         \
+    const char *intermediate_char_96 = ",-./";                         \
     int revision = -1;                                                 \
     int c;                                                             \
                                                                        \
@@ -4317,7 +4284,7 @@ decode_coding_iso_2022 (coding)
 
 #define ENCODE_ISO_CHARACTER(charset, c)                                  \
   do {                                                                    \
-    int code = ENCODE_CHAR ((charset),(c));                               \
+    int code = ENCODE_CHAR ((charset), (c));                              \
                                                                           \
     if (CHARSET_DIMENSION (charset) == 1)                                 \
       ENCODE_ISO_CHARACTER_DIMENSION1 ((charset), code);                  \
@@ -4331,11 +4298,9 @@ decode_coding_iso_2022 (coding)
    Return new DST.  */
 
 unsigned char *
-encode_invocation_designation (charset, coding, dst, p_nchars)
-     struct charset *charset;
-     struct coding_system *coding;
-     unsigned char *dst;
-     int *p_nchars;
+encode_invocation_designation (struct charset *charset,
+                              struct coding_system *coding,
+                              unsigned char *dst, int *p_nchars)
 {
   int multibytep = coding->dst_multibyte;
   int produced_chars = *p_nchars;
@@ -4447,10 +4412,8 @@ encode_invocation_designation (charset, coding, dst, p_nchars)
    find all the necessary designations.  */
 
 static unsigned char *
-encode_designation_at_bol (coding, charbuf, charbuf_end, dst)
-     struct coding_system *coding;
-     int *charbuf, *charbuf_end;
-     unsigned char *dst;
+encode_designation_at_bol (struct coding_system *coding, int *charbuf,
+                          int *charbuf_end, unsigned char *dst)
 {
   struct charset *charset;
   /* Table of charsets to be designated to each graphic register.  */
@@ -4500,8 +4463,7 @@ encode_designation_at_bol (coding, charbuf, charbuf_end, dst)
 /* See the above "GENERAL NOTES on `encode_coding_XXX ()' functions".  */
 
 static int
-encode_coding_iso_2022 (coding)
-     struct coding_system *coding;
+encode_coding_iso_2022 (struct coding_system *coding)
 {
   int multibytep = coding->dst_multibyte;
   int *charbuf = coding->charbuf;
@@ -4691,9 +4653,8 @@ encode_coding_iso_2022 (coding)
    CATEGORY_MASK_SJIS, else return 0.  */
 
 static int
-detect_coding_sjis (coding, detect_info)
-     struct coding_system *coding;
-     struct coding_detection_info *detect_info;
+detect_coding_sjis (struct coding_system *coding,
+                   struct coding_detection_info *detect_info)
 {
   const unsigned char *src = coding->source, *src_base;
   const unsigned char *src_end = coding->source + coding->src_bytes;
@@ -4749,9 +4710,8 @@ detect_coding_sjis (coding, detect_info)
    CATEGORY_MASK_BIG5, else return 0.  */
 
 static int
-detect_coding_big5 (coding, detect_info)
-     struct coding_system *coding;
-     struct coding_detection_info *detect_info;
+detect_coding_big5 (struct coding_system *coding,
+                   struct coding_detection_info *detect_info)
 {
   const unsigned char *src = coding->source, *src_base;
   const unsigned char *src_end = coding->source + coding->src_bytes;
@@ -4797,8 +4757,7 @@ detect_coding_big5 (coding, detect_info)
    If SJIS_P is 1, decode SJIS text, else decode BIG5 test.  */
 
 static void
-decode_coding_sjis (coding)
-     struct coding_system *coding;
+decode_coding_sjis (struct coding_system *coding)
 {
   const unsigned char *src = coding->source + coding->consumed;
   const unsigned char *src_end = coding->source + coding->src_bytes;
@@ -4916,8 +4875,7 @@ decode_coding_sjis (coding)
 }
 
 static void
-decode_coding_big5 (coding)
-     struct coding_system *coding;
+decode_coding_big5 (struct coding_system *coding)
 {
   const unsigned char *src = coding->source + coding->consumed;
   const unsigned char *src_end = coding->source + coding->src_bytes;
@@ -5021,8 +4979,7 @@ decode_coding_big5 (coding)
    SJIS text, else encode BIG5 text.  */
 
 static int
-encode_coding_sjis (coding)
-     struct coding_system *coding;
+encode_coding_sjis (struct coding_system *coding)
 {
   int multibytep = coding->dst_multibyte;
   int *charbuf = coding->charbuf;
@@ -5114,8 +5071,7 @@ encode_coding_sjis (coding)
 }
 
 static int
-encode_coding_big5 (coding)
-     struct coding_system *coding;
+encode_coding_big5 (struct coding_system *coding)
 {
   int multibytep = coding->dst_multibyte;
   int *charbuf = coding->charbuf;
@@ -5193,9 +5149,8 @@ encode_coding_big5 (coding)
    CATEGORY_MASK_CCL, else return 0.  */
 
 static int
-detect_coding_ccl (coding, detect_info)
-     struct coding_system *coding;
-     struct coding_detection_info *detect_info;
+detect_coding_ccl (struct coding_system *coding,
+                  struct coding_detection_info *detect_info)
 {
   const unsigned char *src = coding->source, *src_base;
   const unsigned char *src_end = coding->source + coding->src_bytes;
@@ -5234,8 +5189,7 @@ detect_coding_ccl (coding, detect_info)
 }
 
 static void
-decode_coding_ccl (coding)
-     struct coding_system *coding;
+decode_coding_ccl (struct coding_system *coding)
 {
   const unsigned char *src = coding->source + coding->consumed;
   const unsigned char *src_end = coding->source + coding->src_bytes;
@@ -5304,8 +5258,7 @@ decode_coding_ccl (coding)
 }
 
 static int
-encode_coding_ccl (coding)
-     struct coding_system *coding;
+encode_coding_ccl (struct coding_system *coding)
 {
   struct ccl_program *ccl = &coding->spec.ccl->ccl;
   int multibytep = coding->dst_multibyte;
@@ -5374,8 +5327,7 @@ encode_coding_ccl (coding)
 /* See the above "GENERAL NOTES on `decode_coding_XXX ()' functions".  */
 
 static void
-decode_coding_raw_text (coding)
-     struct coding_system *coding;
+decode_coding_raw_text (struct coding_system *coding)
 {
   int eol_crlf =
     !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
@@ -5394,8 +5346,7 @@ decode_coding_raw_text (coding)
 }
 
 static int
-encode_coding_raw_text (coding)
-     struct coding_system *coding;
+encode_coding_raw_text (struct coding_system *coding)
 {
   int multibytep = coding->dst_multibyte;
   int *charbuf = coding->charbuf;
@@ -5478,9 +5429,8 @@ encode_coding_raw_text (coding)
    is, return 1, else return 0.  */
 
 static int
-detect_coding_charset (coding, detect_info)
-     struct coding_system *coding;
-     struct coding_detection_info *detect_info;
+detect_coding_charset (struct coding_system *coding,
+                      struct coding_detection_info *detect_info)
 {
   const unsigned char *src = coding->source, *src_base;
   const unsigned char *src_end = coding->source + coding->src_bytes;
@@ -5582,8 +5532,7 @@ detect_coding_charset (coding, detect_info)
 }
 
 static void
-decode_coding_charset (coding)
-     struct coding_system *coding;
+decode_coding_charset (struct coding_system *coding)
 {
   const unsigned char *src = coding->source + coding->consumed;
   const unsigned char *src_end = coding->source + coding->src_bytes;
@@ -5711,8 +5660,7 @@ decode_coding_charset (coding)
 }
 
 static int
-encode_coding_charset (coding)
-     struct coding_system *coding;
+encode_coding_charset (struct coding_system *coding)
 {
   int multibytep = coding->dst_multibyte;
   int *charbuf = coding->charbuf;
@@ -5782,9 +5730,7 @@ encode_coding_charset (coding)
    CODING_SYSTEM is invalid, signal an error.  */
 
 void
-setup_coding_system (coding_system, coding)
-     Lisp_Object coding_system;
-     struct coding_system *coding;
+setup_coding_system (Lisp_Object coding_system, struct coding_system *coding)
 {
   Lisp_Object attrs;
   Lisp_Object eol_type;
@@ -5987,8 +5933,7 @@ setup_coding_system (coding_system, coding)
 /* Return a list of charsets supported by CODING.  */
 
 Lisp_Object
-coding_charset_list (coding)
-     struct coding_system *coding;
+coding_charset_list (struct coding_system *coding)
 {
   Lisp_Object attrs, charset_list;
 
@@ -6011,8 +5956,7 @@ coding_charset_list (coding)
 /* Return a list of charsets supported by CODING-SYSTEM.  */
 
 Lisp_Object
-coding_system_charset_list (coding_system)
-     Lisp_Object coding_system;
+coding_system_charset_list (Lisp_Object coding_system)
 {
   int id;
   Lisp_Object attrs, charset_list;
@@ -6045,8 +5989,7 @@ coding_system_charset_list (coding_system)
    eol_type as CODING-SYSTEM.  */
 
 Lisp_Object
-raw_text_coding_system (coding_system)
-     Lisp_Object coding_system;
+raw_text_coding_system (Lisp_Object coding_system)
 {
   Lisp_Object spec, attrs;
   Lisp_Object eol_type, raw_text_eol_type;
@@ -6077,8 +6020,7 @@ raw_text_coding_system (coding_system)
    (system_eol_type).  */
 
 Lisp_Object
-coding_inherit_eol_type (coding_system, parent)
-     Lisp_Object coding_system, parent;
+coding_inherit_eol_type (Lisp_Object coding_system, Lisp_Object parent)
 {
   Lisp_Object spec, eol_type;
 
@@ -6233,10 +6175,8 @@ coding_inherit_eol_type (coding_system, parent)
 #define MAX_EOL_CHECK_COUNT 3
 
 static int
-detect_eol (source, src_bytes, category)
-     const unsigned char *source;
-     EMACS_INT src_bytes;
-     enum coding_category category;
+detect_eol (const unsigned char *source, EMACS_INT src_bytes,
+           enum coding_category category)
 {
   const unsigned char *src = source, *src_end = src + src_bytes;
   unsigned char c;
@@ -6334,9 +6274,7 @@ detect_eol (source, src_bytes, category)
 
 
 static Lisp_Object
-adjust_coding_eol_type (coding, eol_seen)
-     struct coding_system *coding;
-     int eol_seen;
+adjust_coding_eol_type (struct coding_system *coding, int eol_seen)
 {
   Lisp_Object eol_type;
 
@@ -6364,8 +6302,7 @@ adjust_coding_eol_type (coding, eol_seen)
    system.  */
 
 void
-detect_coding (coding)
-     struct coding_system *coding;
+detect_coding (struct coding_system *coding)
 {
   const unsigned char *src, *src_end;
   int saved_mode = coding->mode;
@@ -6408,7 +6345,7 @@ detect_coding (coding)
                        {
                          /* We didn't find an 8-bit code.  We may
                             have found a null-byte, but it's very
-                            rare that a binary file confirm to
+                            rare that a binary file conforms to
                             ISO-2022.  */
                          src = src_end;
                          coding->head_ascii = src - coding->source;
@@ -6544,8 +6481,7 @@ detect_coding (coding)
 
 
 static void
-decode_eol (coding)
-     struct coding_system *coding;
+decode_eol (struct coding_system *coding)
 {
   Lisp_Object eol_type;
   unsigned char *p, *pbeg, *pend;
@@ -6610,7 +6546,7 @@ decode_eol (coding)
          for (p = pend - 2; p >= pbeg; p--)
            if (*p == '\r')
              {
-               safe_bcopy ((char *) (p + 1), (char *) p, pend-- - p - 1);
+               memmove (p, p + 1, pend-- - p - 1);
                n++;
              }
        }
@@ -6647,9 +6583,7 @@ decode_eol (coding)
    decoding (ENCODEP is zero). */
 
 static Lisp_Object
-get_translation_table (attrs, encodep, max_lookup)
-     Lisp_Object attrs;
-     int encodep, *max_lookup;
+get_translation_table (Lisp_Object attrs, int encodep, int *max_lookup)
 {
   Lisp_Object standard, translation_table;
   Lisp_Object val;
@@ -6751,9 +6685,7 @@ get_translation_table (attrs, encodep, max_lookup)
    If BUF is too short to lookup characters in FROM, return Qt.  */
 
 static Lisp_Object
-get_translation (trans, buf, buf_end)
-     Lisp_Object trans;
-     int *buf, *buf_end;
+get_translation (Lisp_Object trans, int *buf, int *buf_end)
 {
 
   if (INTEGERP (trans))
@@ -6780,10 +6712,8 @@ get_translation (trans, buf, buf_end)
 
 
 static int
-produce_chars (coding, translation_table, last_block)
-     struct coding_system *coding;
-     Lisp_Object translation_table;
-     int last_block;
+produce_chars (struct coding_system *coding, Lisp_Object translation_table,
+              int last_block)
 {
   unsigned char *dst = coding->destination + coding->produced;
   unsigned char *dst_end = coding->destination + coding->dst_bytes;
@@ -6981,10 +6911,7 @@ produce_chars (coding, translation_table, last_block)
  */
 
 static INLINE void
-produce_composition (coding, charbuf, pos)
-     struct coding_system *coding;
-     int *charbuf;
-     EMACS_INT pos;
+produce_composition (struct coding_system *coding, int *charbuf, EMACS_INT pos)
 {
   int len;
   EMACS_INT to;
@@ -7028,10 +6955,7 @@ produce_composition (coding, charbuf, pos)
  */
 
 static INLINE void
-produce_charset (coding, charbuf, pos)
-     struct coding_system *coding;
-     int *charbuf;
-     EMACS_INT pos;
+produce_charset (struct coding_system *coding, int *charbuf, EMACS_INT pos)
 {
   EMACS_INT from = pos - charbuf[2];
   struct charset *charset = CHARSET_FROM_ID (charbuf[3]);
@@ -7066,9 +6990,7 @@ produce_charset (coding, charbuf, pos)
 
 
 static void
-produce_annotation (coding, pos)
-     struct coding_system *coding;
-     EMACS_INT pos;
+produce_annotation (struct coding_system *coding, EMACS_INT pos)
 {
   int *charbuf = coding->charbuf;
   int *charbuf_end = charbuf + coding->charbuf_used;
@@ -7123,8 +7045,7 @@ produce_annotation (coding, pos)
 */
 
 static int
-decode_coding (coding)
-     struct coding_system *coding;
+decode_coding (struct coding_system *coding)
 {
   Lisp_Object attrs;
   Lisp_Object undo_list;
@@ -7262,11 +7183,9 @@ decode_coding (coding)
    return BUF.  */
 
 static INLINE int *
-handle_composition_annotation (pos, limit, coding, buf, stop)
-     EMACS_INT pos, limit;
-     struct coding_system *coding;
-     int *buf;
-     EMACS_INT *stop;
+handle_composition_annotation (EMACS_INT pos, EMACS_INT limit,
+                              struct coding_system *coding, int *buf,
+                              EMACS_INT *stop)
 {
   EMACS_INT start, end;
   Lisp_Object prop;
@@ -7347,11 +7266,9 @@ handle_composition_annotation (pos, limit, coding, buf, stop)
    property value is non-nil (limiting by LIMIT), and return BUF.  */
 
 static INLINE int *
-handle_charset_annotation (pos, limit, coding, buf, stop)
-     EMACS_INT pos, limit;
-     struct coding_system *coding;
-     int *buf;
-     EMACS_INT *stop;
+handle_charset_annotation (EMACS_INT pos, EMACS_INT limit,
+                          struct coding_system *coding, int *buf,
+                          EMACS_INT *stop)
 {
   Lisp_Object val, next;
   int id;
@@ -7371,10 +7288,8 @@ handle_charset_annotation (pos, limit, coding, buf, stop)
 
 
 static void
-consume_chars (coding, translation_table, max_lookup)
-     struct coding_system *coding;
-     Lisp_Object translation_table;
-     int max_lookup;
+consume_chars (struct coding_system *coding, Lisp_Object translation_table,
+              int max_lookup)
 {
   int *buf = coding->charbuf;
   int *buf_end = coding->charbuf + coding->charbuf_size;
@@ -7530,8 +7445,7 @@ consume_chars (coding, translation_table, max_lookup)
    memory area specified by CODING->destination.  */
 
 static int
-encode_coding (coding)
-     struct coding_system *coding;
+encode_coding (struct coding_system *coding)
 {
   Lisp_Object attrs;
   Lisp_Object translation_table;
@@ -7595,8 +7509,7 @@ static int reused_workbuf_in_use;
    multibyteness of returning buffer.  */
 
 static Lisp_Object
-make_conversion_work_buffer (multibyte)
-     int multibyte;
+make_conversion_work_buffer (int multibyte)
 {
   Lisp_Object name, workbuf;
   struct buffer *current;
@@ -7628,8 +7541,7 @@ make_conversion_work_buffer (multibyte)
 
 
 static Lisp_Object
-code_conversion_restore (arg)
-     Lisp_Object arg;
+code_conversion_restore (Lisp_Object arg)
 {
   Lisp_Object current, workbuf;
   struct gcpro gcpro1;
@@ -7650,8 +7562,7 @@ code_conversion_restore (arg)
 }
 
 Lisp_Object
-code_conversion_save (with_work_buf, multibyte)
-     int with_work_buf, multibyte;
+code_conversion_save (int with_work_buf, int multibyte)
 {
   Lisp_Object workbuf = Qnil;
 
@@ -7663,11 +7574,10 @@ code_conversion_save (with_work_buf, multibyte)
 }
 
 int
-decode_coding_gap (coding, chars, bytes)
-     struct coding_system *coding;
-     EMACS_INT chars, bytes;
+decode_coding_gap (struct coding_system *coding,
+                  EMACS_INT chars, EMACS_INT bytes)
 {
-  int count = specpdl_ptr - specpdl;
+  int count = SPECPDL_INDEX ();
   Lisp_Object attrs;
 
   code_conversion_save (0, 0);
@@ -7710,11 +7620,10 @@ decode_coding_gap (coding, chars, bytes)
 }
 
 int
-encode_coding_gap (coding, chars, bytes)
-     struct coding_system *coding;
-     EMACS_INT chars, bytes;
+encode_coding_gap (struct coding_system *coding,
+                  EMACS_INT chars, EMACS_INT bytes)
 {
-  int count = specpdl_ptr - specpdl;
+  int count = SPECPDL_INDEX ();
 
   code_conversion_save (0, 0);
 
@@ -7765,14 +7674,13 @@ encode_coding_gap (coding, chars, bytes)
  */
 
 void
-decode_coding_object (coding, src_object, from, from_byte, to, to_byte,
-                     dst_object)
-     struct coding_system *coding;
-     Lisp_Object src_object;
-     EMACS_INT from, from_byte, to, to_byte;
-     Lisp_Object dst_object;
+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,
+                     Lisp_Object dst_object)
 {
-  int count = specpdl_ptr - specpdl;
+  int count = SPECPDL_INDEX ();
   unsigned char *destination;
   EMACS_INT dst_bytes;
   EMACS_INT chars = to - from;
@@ -7902,7 +7810,7 @@ decode_coding_object (coding, src_object, from, from_byte, to, to_byte,
            }
          if (BEGV < GPT && GPT < BEGV + coding->produced_char)
            move_gap_both (BEGV, BEGV_BYTE);
-         bcopy (BEGV_ADDR, destination, coding->produced);
+         memcpy (destination, BEGV_ADDR, coding->produced);
          coding->destination = destination;
        }
     }
@@ -7956,14 +7864,13 @@ decode_coding_object (coding, src_object, from, from_byte, to, to_byte,
 
 
 void
-encode_coding_object (coding, src_object, from, from_byte, to, to_byte,
-                     dst_object)
-     struct coding_system *coding;
-     Lisp_Object src_object;
-     EMACS_INT from, from_byte, to, to_byte;
-     Lisp_Object dst_object;
+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,
+                     Lisp_Object dst_object)
 {
-  int count = specpdl_ptr - specpdl;
+  int count = SPECPDL_INDEX ();
   EMACS_INT chars = to - from;
   EMACS_INT bytes = to_byte - from_byte;
   Lisp_Object attrs;
@@ -8165,7 +8072,7 @@ encode_coding_object (coding, src_object, from, from_byte, to, to_byte,
 
 
 Lisp_Object
-preferred_coding_system ()
+preferred_coding_system (void)
 {
   int id = coding_categories[coding_priorities[0]].id;
 
@@ -8180,8 +8087,7 @@ DEFUN ("coding-system-p", Fcoding_system_p, Scoding_system_p, 1, 1, 0,
        doc: /* Return t if OBJECT is nil or a coding-system.
 See the documentation of `define-coding-system' for information
 about coding-system objects.  */)
-     (object)
-     Lisp_Object object;
+  (Lisp_Object object)
 {
   if (NILP (object)
       || CODING_SYSTEM_ID (object) >= 0)
@@ -8195,8 +8101,7 @@ about coding-system objects.  */)
 DEFUN ("read-non-nil-coding-system", Fread_non_nil_coding_system,
        Sread_non_nil_coding_system, 1, 1, 0,
        doc: /* Read a coding system from the minibuffer, prompting with string PROMPT.  */)
-     (prompt)
-     Lisp_Object prompt;
+  (Lisp_Object prompt)
 {
   Lisp_Object val;
   do
@@ -8213,8 +8118,7 @@ DEFUN ("read-coding-system", Fread_coding_system, Sread_coding_system, 1, 2, 0,
 If the user enters null input, return second argument DEFAULT-CODING-SYSTEM.
 Ignores case when completing coding systems (all Emacs coding systems
 are lower-case).  */)
-     (prompt, default_coding_system)
-     Lisp_Object prompt, default_coding_system;
+  (Lisp_Object prompt, Lisp_Object default_coding_system)
 {
   Lisp_Object val;
   int count = SPECPDL_INDEX ();
@@ -8235,8 +8139,7 @@ DEFUN ("check-coding-system", Fcheck_coding_system, Scheck_coding_system,
 If valid, return CODING-SYSTEM, else signal a `coding-system-error' error.
 It is valid if it is nil or a symbol defined as a coding system by the
 function `define-coding-system'.  */)
-  (coding_system)
-     Lisp_Object coding_system;
+  (Lisp_Object coding_system)
 {
   Lisp_Object define_form;
 
@@ -8269,13 +8172,10 @@ function `define-coding-system'.  */)
    detect only text-format.  */
 
 Lisp_Object
-detect_coding_system (src, src_chars, src_bytes, highest, multibytep,
-                     coding_system)
-     const unsigned char *src;
-     EMACS_INT src_chars, src_bytes;
-     int highest;
-     int multibytep;
-     Lisp_Object coding_system;
+detect_coding_system (const unsigned char *src,
+                     EMACS_INT src_chars, EMACS_INT src_bytes,
+                     int highest, int multibytep,
+                     Lisp_Object coding_system)
 {
   const unsigned char *src_end = src + src_bytes;
   Lisp_Object attrs, eol_type;
@@ -8591,8 +8491,7 @@ format.
 
 If optional argument HIGHEST is non-nil, return the coding system of
 highest priority.  */)
-     (start, end, highest)
-     Lisp_Object start, end, highest;
+  (Lisp_Object start, Lisp_Object end, Lisp_Object highest)
 {
   int from, to;
   int from_byte, to_byte;
@@ -8630,8 +8529,7 @@ format.
 
 If optional argument HIGHEST is non-nil, return the coding system of
 highest priority.  */)
-     (string, highest)
-     Lisp_Object string, highest;
+  (Lisp_Object string, Lisp_Object highest)
 {
   CHECK_STRING (string);
 
@@ -8643,9 +8541,7 @@ highest priority.  */)
 
 
 static INLINE int
-char_encodable_p (c, attrs)
-     int c;
-     Lisp_Object attrs;
+char_encodable_p (int c, Lisp_Object attrs)
 {
   Lisp_Object tail;
   struct charset *charset;
@@ -8675,8 +8571,7 @@ DEFUN ("find-coding-systems-region-internal",
        Ffind_coding_systems_region_internal,
        Sfind_coding_systems_region_internal, 2, 3, 0,
        doc: /* Internal use only.  */)
-     (start, end, exclude)
-     Lisp_Object start, end, exclude;
+  (Lisp_Object start, Lisp_Object end, Lisp_Object exclude)
 {
   Lisp_Object coding_attrs_list, safe_codings;
   EMACS_INT start_byte, end_byte;
@@ -8809,8 +8704,7 @@ list of positions.
 If optional 5th argument STRING is non-nil, it is a string to search
 for un-encodable characters.  In that case, START and END are indexes
 to the string.  */)
-     (start, end, coding_system, count, string)
-     Lisp_Object start, end, coding_system, count, string;
+  (Lisp_Object start, Lisp_Object end, Lisp_Object coding_system, Lisp_Object count, Lisp_Object string)
 {
   int n;
   struct coding_system coding;
@@ -8925,8 +8819,7 @@ buffer positions.  END is ignored.
 
 If the current buffer (or START if it is a string) is unibyte, the value
 is nil.  */)
-     (start, end, coding_system_list)
-     Lisp_Object start, end, coding_system_list;
+  (Lisp_Object start, Lisp_Object end, Lisp_Object coding_system_list)
 {
   Lisp_Object list;
   EMACS_INT start_byte, end_byte;
@@ -9031,9 +8924,9 @@ is nil.  */)
 
 
 Lisp_Object
-code_convert_region (start, end, coding_system, dst_object, encodep, norecord)
-     Lisp_Object start, end, coding_system, dst_object;
-     int encodep, norecord;
+code_convert_region (Lisp_Object start, Lisp_Object end,
+                    Lisp_Object coding_system, Lisp_Object dst_object,
+                    int encodep, int norecord)
 {
   struct coding_system coding;
   EMACS_INT from, from_byte, to, to_byte;
@@ -9092,8 +8985,7 @@ If DESTINATION is t, the decoded text is returned.
 This function sets `last-coding-system-used' to the precise coding system
 used (which may be different from CODING-SYSTEM if CODING-SYSTEM is
 not fully specified.)  */)
-     (start, end, coding_system, destination)
-     Lisp_Object start, end, coding_system, destination;
+  (Lisp_Object start, Lisp_Object end, Lisp_Object coding_system, Lisp_Object destination)
 {
   return code_convert_region (start, end, coding_system, destination, 0, 0);
 }
@@ -9115,17 +9007,14 @@ If DESTINATION is t, the encoded text is returned.
 This function sets `last-coding-system-used' to the precise coding system
 used (which may be different from CODING-SYSTEM if CODING-SYSTEM is
 not fully specified.)  */)
-  (start, end, coding_system, destination)
-     Lisp_Object start, end, coding_system, destination;
+  (Lisp_Object start, Lisp_Object end, Lisp_Object coding_system, Lisp_Object destination)
 {
   return code_convert_region (start, end, coding_system, destination, 1, 0);
 }
 
 Lisp_Object
-code_convert_string (string, coding_system, dst_object,
-                    encodep, nocopy, norecord)
-     Lisp_Object string, coding_system, dst_object;
-     int encodep, nocopy, norecord;
+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;
@@ -9172,9 +9061,8 @@ code_convert_string (string, coding_system, dst_object,
    ENCODE_FILE, thus we ignore character composition.  */
 
 Lisp_Object
-code_convert_string_norecord (string, coding_system, encodep)
-     Lisp_Object string, coding_system;
-     int encodep;
+code_convert_string_norecord (Lisp_Object string, Lisp_Object coding_system,
+                             int encodep)
 {
   return code_convert_string (string, coding_system, Qt, encodep, 0, 1);
 }
@@ -9194,8 +9082,7 @@ case, the return value is the length of the decoded text.
 This function sets `last-coding-system-used' to the precise coding system
 used (which may be different from CODING-SYSTEM if CODING-SYSTEM is
 not fully specified.)  */)
-  (string, coding_system, nocopy, buffer)
-     Lisp_Object string, coding_system, nocopy, buffer;
+  (Lisp_Object string, Lisp_Object coding_system, Lisp_Object nocopy, Lisp_Object buffer)
 {
   return code_convert_string (string, coding_system, buffer,
                              0, ! NILP (nocopy), 0);
@@ -9215,8 +9102,7 @@ case, the return value is the length of the encoded text.
 This function sets `last-coding-system-used' to the precise coding system
 used (which may be different from CODING-SYSTEM if CODING-SYSTEM is
 not fully specified.)  */)
-     (string, coding_system, nocopy, buffer)
-     Lisp_Object string, coding_system, nocopy, buffer;
+  (Lisp_Object string, Lisp_Object coding_system, Lisp_Object nocopy, Lisp_Object buffer)
 {
   return code_convert_string (string, coding_system, buffer,
                              1, ! NILP (nocopy), 1);
@@ -9226,8 +9112,7 @@ not fully specified.)  */)
 DEFUN ("decode-sjis-char", Fdecode_sjis_char, Sdecode_sjis_char, 1, 1, 0,
        doc: /* Decode a Japanese character which has CODE in shift_jis encoding.
 Return the corresponding character.  */)
-     (code)
-     Lisp_Object code;
+  (Lisp_Object code)
 {
   Lisp_Object spec, attrs, val;
   struct charset *charset_roman, *charset_kanji, *charset_kana, *charset;
@@ -9274,8 +9159,7 @@ Return the corresponding character.  */)
 DEFUN ("encode-sjis-char", Fencode_sjis_char, Sencode_sjis_char, 1, 1, 0,
        doc: /* Encode a Japanese character CH to shift_jis encoding.
 Return the corresponding code in SJIS.  */)
-     (ch)
-    Lisp_Object ch;
+  (Lisp_Object ch)
 {
   Lisp_Object spec, attrs, charset_list;
   int c;
@@ -9303,8 +9187,7 @@ Return the corresponding code in SJIS.  */)
 DEFUN ("decode-big5-char", Fdecode_big5_char, Sdecode_big5_char, 1, 1, 0,
        doc: /* Decode a Big5 character which has CODE in BIG5 coding system.
 Return the corresponding character.  */)
-     (code)
-     Lisp_Object code;
+  (Lisp_Object code)
 {
   Lisp_Object spec, attrs, val;
   struct charset *charset_roman, *charset_big5, *charset;
@@ -9342,8 +9225,7 @@ Return the corresponding character.  */)
 DEFUN ("encode-big5-char", Fencode_big5_char, Sencode_big5_char, 1, 1, 0,
        doc: /* Encode the Big5 character CH to BIG5 coding system.
 Return the corresponding character code in Big5.  */)
-     (ch)
-     Lisp_Object ch;
+  (Lisp_Object ch)
 {
   Lisp_Object spec, attrs, charset_list;
   struct charset *charset;
@@ -9370,9 +9252,7 @@ Return the corresponding character code in Big5.  */)
 DEFUN ("set-terminal-coding-system-internal", Fset_terminal_coding_system_internal,
        Sset_terminal_coding_system_internal, 1, 2, 0,
        doc: /* Internal use only.  */)
-     (coding_system, terminal)
-     Lisp_Object coding_system;
-     Lisp_Object terminal;
+  (Lisp_Object coding_system, Lisp_Object terminal)
 {
   struct coding_system *terminal_coding = TERMINAL_TERMINAL_CODING (get_terminal (terminal, 1));
   CHECK_SYMBOL (coding_system);
@@ -9390,8 +9270,7 @@ DEFUN ("set-safe-terminal-coding-system-internal",
        Fset_safe_terminal_coding_system_internal,
        Sset_safe_terminal_coding_system_internal, 1, 1, 0,
        doc: /* Internal use only.  */)
-     (coding_system)
-     Lisp_Object coding_system;
+  (Lisp_Object coding_system)
 {
   CHECK_SYMBOL (coding_system);
   setup_coding_system (Fcheck_coding_system (coding_system),
@@ -9408,8 +9287,7 @@ DEFUN ("terminal-coding-system", Fterminal_coding_system,
        doc: /* Return coding system specified for terminal output on the given terminal.
 TERMINAL may be a terminal object, a frame, or nil for the selected
 frame's terminal device.  */)
-     (terminal)
-     Lisp_Object terminal;
+  (Lisp_Object terminal)
 {
   struct coding_system *terminal_coding
     = TERMINAL_TERMINAL_CODING (get_terminal (terminal, 1));
@@ -9422,9 +9300,7 @@ frame's terminal device.  */)
 DEFUN ("set-keyboard-coding-system-internal", Fset_keyboard_coding_system_internal,
        Sset_keyboard_coding_system_internal, 1, 2, 0,
        doc: /* Internal use only.  */)
-     (coding_system, terminal)
-     Lisp_Object coding_system;
-     Lisp_Object terminal;
+  (Lisp_Object coding_system, Lisp_Object terminal)
 {
   struct terminal *t = get_terminal (terminal, 1);
   CHECK_SYMBOL (coding_system);
@@ -9442,8 +9318,7 @@ DEFUN ("set-keyboard-coding-system-internal", Fset_keyboard_coding_system_intern
 DEFUN ("keyboard-coding-system",
        Fkeyboard_coding_system, Skeyboard_coding_system, 0, 1, 0,
        doc: /* Return coding system specified for decoding keyboard input.  */)
-     (terminal)
-     Lisp_Object terminal;
+  (Lisp_Object terminal)
 {
   return CODING_ID_NAME (TERMINAL_KEYBOARD_CODING
                         (get_terminal (terminal, 1))->id);
@@ -9491,9 +9366,7 @@ function to call for FILENAME, that function should examine the
 contents of BUFFER instead of reading the file.
 
 usage: (find-operation-coding-system OPERATION ARGUMENTS...)  */)
-     (nargs, args)
-     int nargs;
-     Lisp_Object *args;
+  (int nargs, Lisp_Object *args)
 {
   Lisp_Object operation, target_idx, target, val;
   register Lisp_Object chain;
@@ -9569,15 +9442,13 @@ If multiple coding systems belong to the same category,
 all but the first one are ignored.
 
 usage: (set-coding-system-priority &rest coding-systems)  */)
-     (nargs, args)
-     int nargs;
-     Lisp_Object *args;
+  (int nargs, Lisp_Object *args)
 {
   int i, j;
   int changed[coding_category_max];
   enum coding_category priorities[coding_category_max];
 
-  bzero (changed, sizeof changed);
+  memset (changed, 0, sizeof changed);
 
   for (i = j = 0; i < nargs; i++)
     {
@@ -9612,7 +9483,7 @@ usage: (set-coding-system-priority &rest coding-systems)  */)
       priorities[i] = coding_priorities[j];
     }
 
-  bcopy (priorities, coding_priorities, sizeof priorities);
+  memcpy (coding_priorities, priorities, sizeof priorities);
 
   /* Update `coding-category-list'.  */
   Vcoding_category_list = Qnil;
@@ -9631,8 +9502,7 @@ The list contains a subset of coding systems; i.e. coding systems
 assigned to each coding category (see `coding-category-list').
 
 HIGHESTP non-nil means just return the highest priority one.  */)
-     (highestp)
-     Lisp_Object highestp;
+  (Lisp_Object highestp)
 {
   int i;
   Lisp_Object val;
@@ -9656,19 +9526,18 @@ HIGHESTP non-nil means just return the highest priority one.  */)
 static const char *const suffixes[] = { "-unix", "-dos", "-mac" };
 
 static Lisp_Object
-make_subsidiaries (base)
-     Lisp_Object base;
+make_subsidiaries (Lisp_Object base)
 {
   Lisp_Object subsidiaries;
   int base_name_len = SBYTES (SYMBOL_NAME (base));
   char *buf = (char *) alloca (base_name_len + 6);
   int i;
 
-  bcopy (SDATA (SYMBOL_NAME (base)), buf, base_name_len);
+  memcpy (buf, SDATA (SYMBOL_NAME (base)), base_name_len);
   subsidiaries = Fmake_vector (make_number (3), Qnil);
   for (i = 0; i < 3; i++)
     {
-      bcopy (suffixes[i], buf + base_name_len, strlen (suffixes[i]) + 1);
+      memcpy (buf + base_name_len, suffixes[i], strlen (suffixes[i]) + 1);
       ASET (subsidiaries, i, intern (buf));
     }
   return subsidiaries;
@@ -9679,9 +9548,7 @@ DEFUN ("define-coding-system-internal", Fdefine_coding_system_internal,
        Sdefine_coding_system_internal, coding_arg_max, MANY, 0,
        doc: /* For internal use only.
 usage: (define-coding-system-internal ...)  */)
-     (nargs, args)
-     int nargs;
-     Lisp_Object *args;
+  (int nargs, Lisp_Object *args)
 {
   Lisp_Object name;
   Lisp_Object spec_vec;                /* [ ATTRS ALIASE EOL_TYPE ] */
@@ -10210,8 +10077,7 @@ usage: (define-coding-system-internal ...)  */)
 DEFUN ("coding-system-put", Fcoding_system_put, Scoding_system_put,
        3, 3, 0,
        doc: /* Change value in CODING-SYSTEM's property list PROP to VAL.  */)
-  (coding_system, prop, val)
-     Lisp_Object coding_system, prop, val;
+  (Lisp_Object coding_system, Lisp_Object prop, Lisp_Object val)
 {
   Lisp_Object spec, attrs;
 
@@ -10267,8 +10133,7 @@ DEFUN ("coding-system-put", Fcoding_system_put, Scoding_system_put,
 DEFUN ("define-coding-system-alias", Fdefine_coding_system_alias,
        Sdefine_coding_system_alias, 2, 2, 0,
        doc: /* Define ALIAS as an alias for CODING-SYSTEM.  */)
-     (alias, coding_system)
-     Lisp_Object alias, coding_system;
+  (Lisp_Object alias, Lisp_Object coding_system)
 {
   Lisp_Object spec, aliases, eol_type, val;
 
@@ -10308,8 +10173,7 @@ DEFUN ("coding-system-base", Fcoding_system_base, Scoding_system_base,
        1, 1, 0,
        doc: /* Return the base of CODING-SYSTEM.
 Any alias or subsidiary coding system is not a base coding system.  */)
-  (coding_system)
-     Lisp_Object coding_system;
+  (Lisp_Object coding_system)
 {
   Lisp_Object spec, attrs;
 
@@ -10323,8 +10187,7 @@ Any alias or subsidiary coding system is not a base coding system.  */)
 DEFUN ("coding-system-plist", Fcoding_system_plist, Scoding_system_plist,
        1, 1, 0,
        doc: "Return the property list of CODING-SYSTEM.")
-     (coding_system)
-     Lisp_Object coding_system;
+  (Lisp_Object coding_system)
 {
   Lisp_Object spec, attrs;
 
@@ -10339,8 +10202,7 @@ DEFUN ("coding-system-plist", Fcoding_system_plist, Scoding_system_plist,
 DEFUN ("coding-system-aliases", Fcoding_system_aliases, Scoding_system_aliases,
        1, 1, 0,
        doc: /* Return the list of aliases of CODING-SYSTEM.  */)
-     (coding_system)
-     Lisp_Object coding_system;
+  (Lisp_Object coding_system)
 {
   Lisp_Object spec;
 
@@ -10361,8 +10223,7 @@ and CR respectively.
 A vector value indicates that a format of end-of-line should be
 detected automatically.  Nth element of the vector is the subsidiary
 coding system whose eol-type is N.  */)
-     (coding_system)
-     Lisp_Object coding_system;
+  (Lisp_Object coding_system)
 {
   Lisp_Object spec, eol_type;
   int n;
@@ -10385,7 +10246,7 @@ coding system whose eol-type is N.  */)
 /*** 9. Post-amble ***/
 
 void
-init_coding_once ()
+init_coding_once (void)
 {
   int i;
 
@@ -10427,7 +10288,7 @@ init_coding_once ()
 #ifdef emacs
 
 void
-syms_of_coding ()
+syms_of_coding (void)
 {
   staticpro (&Vcoding_system_hash_table);
   {
@@ -10968,7 +10829,7 @@ character.");
     for (i = 0; i < coding_category_max; i++)
       Fset (AREF (Vcoding_category_table, i), Qno_conversion);
   }
-#if defined (MSDOS) || defined (WINDOWSNT)
+#if defined (DOS_NT)
   system_eol_type = Qdos;
 #else
   system_eol_type = Qunix;
@@ -10977,8 +10838,7 @@ character.");
 }
 
 char *
-emacs_strerror (error_number)
-     int error_number;
+emacs_strerror (int error_number)
 {
   char *str;
 
index f47c33847f963842c0320cdb156192559747141f..0caa5b2f96f0a96c263dc9769755c67681cdfdef 100644 (file)
@@ -499,10 +499,10 @@ struct coding_system
 
   int default_char;
 
-  int (*detector) P_ ((struct coding_system *,
-                      struct coding_detection_info *));
-  void (*decoder) P_ ((struct coding_system *));
-  int (*encoder) P_ ((struct coding_system *));
+  int (*detector) (struct coding_system *,
+                   struct coding_detection_info *);
+  void (*decoder) (struct coding_system *);
+  int (*encoder) (struct coding_system *);
 };
 
 /* Meanings of bits in the member `common_flags' of the structure
@@ -691,33 +691,33 @@ struct coding_system
 #define ENCODE_UTF_8(str) code_convert_string_norecord (str, Qutf_8, 1)
 
 /* Extern declarations.  */
-extern Lisp_Object code_conversion_save P_ ((int, int));
-extern int decoding_buffer_size P_ ((struct coding_system *, int));
-extern int encoding_buffer_size P_ ((struct coding_system *, int));
-extern void setup_coding_system P_ ((Lisp_Object, struct coding_system *));
-extern Lisp_Object coding_charset_list P_ ((struct coding_system *));
-extern Lisp_Object coding_system_charset_list P_ ((Lisp_Object));
-extern void detect_coding P_ ((struct coding_system *));
-extern Lisp_Object code_convert_region P_ ((Lisp_Object, Lisp_Object,
-                                           Lisp_Object, Lisp_Object,
-                                           int, int));
-extern Lisp_Object code_convert_string P_ ((Lisp_Object, Lisp_Object,
-                                           Lisp_Object, int, int, int));
-extern Lisp_Object code_convert_string_norecord P_ ((Lisp_Object, Lisp_Object,
-                                                    int));
-extern Lisp_Object raw_text_coding_system P_ ((Lisp_Object));
-extern Lisp_Object coding_inherit_eol_type P_ ((Lisp_Object, Lisp_Object));
-
-extern int decode_coding_gap P_ ((struct coding_system *,
-                                 EMACS_INT, EMACS_INT));
-extern int encode_coding_gap P_ ((struct coding_system *,
-                                 EMACS_INT, EMACS_INT));
-extern void decode_coding_object P_ ((struct coding_system *,
-                                     Lisp_Object, EMACS_INT, EMACS_INT,
-                                     EMACS_INT, EMACS_INT, Lisp_Object));
-extern void encode_coding_object P_ ((struct coding_system *,
-                                     Lisp_Object, EMACS_INT, EMACS_INT,
-                                     EMACS_INT, EMACS_INT, Lisp_Object));
+extern Lisp_Object code_conversion_save (int, int);
+extern int decoding_buffer_size (struct coding_system *, int);
+extern int encoding_buffer_size (struct coding_system *, int);
+extern void setup_coding_system (Lisp_Object, struct coding_system *);
+extern Lisp_Object coding_charset_list (struct coding_system *);
+extern Lisp_Object coding_system_charset_list (Lisp_Object);
+extern void detect_coding (struct coding_system *);
+extern Lisp_Object code_convert_region (Lisp_Object, Lisp_Object,
+                                        Lisp_Object, Lisp_Object,
+                                        int, int);
+extern Lisp_Object code_convert_string (Lisp_Object, Lisp_Object,
+                                        Lisp_Object, int, int, int);
+extern Lisp_Object code_convert_string_norecord (Lisp_Object, Lisp_Object,
+                                                 int);
+extern Lisp_Object raw_text_coding_system (Lisp_Object);
+extern Lisp_Object coding_inherit_eol_type (Lisp_Object, Lisp_Object);
+
+extern int decode_coding_gap (struct coding_system *,
+                              EMACS_INT, EMACS_INT);
+extern int encode_coding_gap (struct coding_system *,
+                              EMACS_INT, EMACS_INT);
+extern void decode_coding_object (struct coding_system *,
+                                  Lisp_Object, EMACS_INT, EMACS_INT,
+                                  EMACS_INT, EMACS_INT, Lisp_Object);
+extern void encode_coding_object (struct coding_system *,
+                                  Lisp_Object, EMACS_INT, EMACS_INT,
+                                  EMACS_INT, EMACS_INT, Lisp_Object);
 
 /* Macros for backward compatibility.  */
 
@@ -753,7 +753,7 @@ extern void encode_coding_object P_ ((struct coding_system *,
   } while (0)
 
 
-extern Lisp_Object preferred_coding_system P_ (());
+extern Lisp_Object preferred_coding_system (void);
 
 
 extern Lisp_Object Qutf_8, Qutf_8_emacs;
@@ -780,7 +780,7 @@ extern Lisp_Object Qcall_process, Qcall_process_region;
 extern Lisp_Object Qstart_process, Qopen_network_stream;
 extern Lisp_Object Qwrite_region;
 
-extern char *emacs_strerror P_ ((int));
+extern char *emacs_strerror (int);
 
 /* Coding-system for reading files and receiving data from process.  */
 extern Lisp_Object Vcoding_system_for_read;
@@ -802,6 +802,9 @@ extern struct coding_system safe_terminal_coding;
 /* Default coding systems used for process I/O.  */
 extern Lisp_Object Vdefault_process_coding_system;
 
+/* Char table for translating Quail and self-inserting input.  */
+extern Lisp_Object Vtranslation_table_for_input;
+
 /* Function to call to force a user to force select a propert coding
    system.  */
 extern Lisp_Object Vselect_safe_coding_system_function;
@@ -823,7 +826,7 @@ extern Lisp_Object Vdefault_file_name_coding_system;
 extern Lisp_Object Qcoding_system_error;
 
 extern char emacs_mule_bytes[256];
-extern int emacs_mule_string_char P_ ((unsigned char *));
+extern int emacs_mule_string_char (unsigned char *);
 
 #endif /* EMACS_CODING_H */
 
index 1295a03e9f6eb7627125d2f555a6207bcf77743a..bc5a67ef6e21b2b8574b41ab9fd169f0e43f8b65 100644 (file)
@@ -74,8 +74,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
        composition rules to tell how to compose (2N+2)th element with
        the previously composed 2N glyphs.
 
-   COMPONENTS-VEC -- Vector of integers.  In relative composition, the
-       elements are characters to be composed.  In rule-base
+   COMPONENTS-VEC -- Vector of integers.  In a relative composition,
+       the elements are the characters to be composed.  In a rule-base
        composition, the elements are characters or encoded
        composition rules.
 
@@ -95,13 +95,13 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    get_composition_id checks the validity of `composition' property,
    and, if valid, assigns a new ID, registers the information in
    composition_hash_table and composition_table, and changes the form
-   of the property value.  If the property is invalid, return -1
-   without changing the property value.
+   of the property value.  If the property is invalid,
+   get_composition_id returns -1 without changing the property value.
 
-   We use two tables to keep information about composition;
+   We use two tables to keep the information about composition;
    composition_hash_table and composition_table.
 
-   The former is a hash table in which keys are COMPONENTS-VECs and
+   The former is a hash table whose keys are COMPONENTS-VECs and
    values are the corresponding COMPOSITION-IDs.  This hash table is
    weak, but as each key (COMPONENTS-VEC) is also kept as a value of the
    `composition' property, it won't be collected as garbage until all
@@ -162,8 +162,8 @@ Lisp_Object Vauto_composition_function;
 Lisp_Object Qauto_composition_function;
 Lisp_Object Vcomposition_function_table;
 
-/* Maxinum number of characters to lookback to check
-   auto-composition.  */
+/* Maximum number of characters to look back for
+   auto-compositions.  */
 #define MAX_AUTO_COMPOSITION_LOOKBACK 3
 
 EXFUN (Fremove_list_of_text_properties, 4);
@@ -180,9 +180,7 @@ Lisp_Object composition_temp;
    If the composition is invalid, return -1.  */
 
 int
-get_composition_id (charpos, bytepos, nchars, prop, string)
-     int charpos, bytepos, nchars;
-     Lisp_Object prop, string;
+get_composition_id (int charpos, int bytepos, int nchars, Lisp_Object prop, Lisp_Object string)
 {
   Lisp_Object id, length, components, key, *key_contents;
   int glyph_len;
@@ -429,10 +427,7 @@ get_composition_id (charpos, bytepos, nchars, prop, string)
    This doesn't check the validity of composition.  */
 
 int
-find_composition (pos, limit, start, end, prop, object)
-     int pos, limit;
-     EMACS_INT *start, *end;
-     Lisp_Object *prop, object;
+find_composition (int pos, int limit, EMACS_INT *start, EMACS_INT *end, Lisp_Object *prop, Lisp_Object object)
 {
   Lisp_Object val;
 
@@ -470,9 +465,7 @@ find_composition (pos, limit, start, end, prop, object)
    FROM and TO with property PROP.  */
 
 static void
-run_composition_function (from, to, prop)
-     int from, to;
-     Lisp_Object prop;
+run_composition_function (int from, int to, Lisp_Object prop)
 {
   Lisp_Object func;
   EMACS_INT start, end;
@@ -504,9 +497,7 @@ run_composition_function (from, to, prop)
    change is deletion, FROM == TO.  Otherwise, FROM < TO.  */
 
 void
-update_compositions (from, to, check_mask)
-     EMACS_INT from, to;
-     int check_mask;
+update_compositions (EMACS_INT from, EMACS_INT to, int check_mask)
 {
   Lisp_Object prop;
   EMACS_INT start, end;
@@ -612,8 +603,7 @@ update_compositions (from, to, check_mask)
    top-level copies of them so that none of them are `eq'.  */
 
 void
-make_composition_value_copy (list)
-     Lisp_Object list;
+make_composition_value_copy (Lisp_Object list)
 {
   Lisp_Object plist, val;
 
@@ -638,9 +628,7 @@ make_composition_value_copy (list)
    indices START and END in STRING.  */
 
 void
-compose_text (start, end, components, modification_func, string)
-     int start, end;
-     Lisp_Object components, modification_func, string;
+compose_text (int start, int end, Lisp_Object components, Lisp_Object modification_func, Lisp_Object string)
 {
   Lisp_Object prop;
 
@@ -651,9 +639,9 @@ compose_text (start, end, components, modification_func, string)
 }
 
 
-static Lisp_Object autocmp_chars P_ ((Lisp_Object, EMACS_INT, EMACS_INT,
-                                     EMACS_INT, struct window *,
-                                     struct face *, Lisp_Object));
+static Lisp_Object autocmp_chars (Lisp_Object, EMACS_INT, EMACS_INT,
+                                  EMACS_INT, struct window *,
+                                  struct face *, Lisp_Object);
 
 \f
 /* Lisp glyph-string handlers */
@@ -664,11 +652,10 @@ static Lisp_Object autocmp_chars P_ ((Lisp_Object, EMACS_INT, EMACS_INT,
 
 static Lisp_Object gstring_hash_table;
 
-static Lisp_Object gstring_lookup_cache P_ ((Lisp_Object));
+static Lisp_Object gstring_lookup_cache (Lisp_Object);
 
 static Lisp_Object
-gstring_lookup_cache (header)
-     Lisp_Object header;
+gstring_lookup_cache (Lisp_Object header)
 {
   struct Lisp_Hash_Table *h = XHASH_TABLE (gstring_hash_table);
   int i = hash_lookup (h, header, NULL);
@@ -677,9 +664,7 @@ gstring_lookup_cache (header)
 }
 
 Lisp_Object
-composition_gstring_put_cache (gstring, len)
-     Lisp_Object gstring;
-     int len;
+composition_gstring_put_cache (Lisp_Object gstring, int len)
 {
   struct Lisp_Hash_Table *h = XHASH_TABLE (gstring_hash_table);
   unsigned hash;
@@ -707,21 +692,19 @@ composition_gstring_put_cache (gstring, len)
 }
 
 Lisp_Object
-composition_gstring_from_id (id)
-     int id;
+composition_gstring_from_id (int id)
 {
   struct Lisp_Hash_Table *h = XHASH_TABLE (gstring_hash_table);
 
   return HASH_VALUE (h, id);
 }
 
-static Lisp_Object fill_gstring_header P_ ((Lisp_Object, Lisp_Object,
-                                           Lisp_Object, Lisp_Object,
-                                           Lisp_Object));
+static Lisp_Object fill_gstring_header (Lisp_Object, Lisp_Object,
+                                        Lisp_Object, Lisp_Object,
+                                        Lisp_Object);
 
 int
-composition_gstring_p (gstring)
-     Lisp_Object gstring;
+composition_gstring_p (Lisp_Object gstring)
 {
   Lisp_Object header;
   int i;
@@ -752,10 +735,7 @@ composition_gstring_p (gstring)
 }
 
 int
-composition_gstring_width (gstring, from, to, metrics)
-     Lisp_Object gstring;
-     int from, to;
-     struct font_metrics *metrics;
+composition_gstring_width (Lisp_Object gstring, int from, int to, struct font_metrics *metrics)
 {
   Lisp_Object *glyph;
   int width = 0;
@@ -811,8 +791,7 @@ static Lisp_Object gstring_work;
 static Lisp_Object gstring_work_headers;
 
 static Lisp_Object
-fill_gstring_header (header, start, end, font_object, string)
-     Lisp_Object header, start, end, font_object, string;
+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;
@@ -869,11 +848,8 @@ fill_gstring_header (header, start, end, font_object, string)
   return header;
 }
 
-extern void font_fill_lglyph_metrics P_ ((Lisp_Object, Lisp_Object));
-
 static void
-fill_gstring_body (gstring)
-     Lisp_Object gstring;
+fill_gstring_body (Lisp_Object gstring)
 {
   Lisp_Object font_object = LGSTRING_FONT (gstring);
   Lisp_Object header = AREF (gstring, 0);
@@ -915,181 +891,317 @@ fill_gstring_body (gstring)
 }
 
 
-/* Try to compose the characters at CHARPOS according to CFT_ELEMENT
-   which is an element of composition-function-table (which see).
-   LIMIT limits the characters to compose.  STRING, if not nil, is a
-   target string.  WIN is a window where the characters are being
-   displayed.  */
+/* Try to compose the characters at CHARPOS according to composition
+   rule RULE ([PATTERN PREV-CHARS FUNC]).  LIMIT limits the characters
+   to compose.  STRING, if not nil, is a target string.  WIN is a
+   window where the characters are being displayed.  If characters are
+   successfully composed, return the composition as a glyph-string
+   object.  Otherwise return nil.  */
 
 static Lisp_Object
-autocmp_chars (cft_element, charpos, bytepos, limit, win, face, string)
-     Lisp_Object cft_element;
-     EMACS_INT charpos, bytepos, limit;
-     struct window *win;
-     struct face *face;
-     Lisp_Object string;
+autocmp_chars (Lisp_Object rule, EMACS_INT charpos, EMACS_INT bytepos, EMACS_INT limit, struct window *win, struct face *face, Lisp_Object string)
 {
   int 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;
-  int lookback;
+  Lisp_Object re, font_object, lgstring;
+  int len;
 
   record_unwind_save_match_data ();
-  for (lookback = -1; CONSP (cft_element); cft_element = XCDR (cft_element))
+  re = AREF (rule, 0);
+  if (NILP (re))
+    len = 1;
+  else if (! STRINGP (re))
+    return unbind_to (count, Qnil);
+  else if ((len = fast_looking_at (re, charpos, bytepos, limit, -1, string))
+          > 0)
     {
-      Lisp_Object elt = XCAR (cft_element);
-      Lisp_Object re;
-      Lisp_Object font_object = Qnil, gstring;
-      EMACS_INT len, to;
-
-      if (! VECTORP (elt) || ASIZE (elt) != 3)
-       continue;
-      if (lookback < 0)
-       {
-         lookback = XFASTINT (AREF (elt, 1));
-         if (limit > charpos + MAX_COMPOSITION_COMPONENTS)
-           limit = charpos + MAX_COMPOSITION_COMPONENTS;
-       }
-      else if (lookback != XFASTINT (AREF (elt, 1)))
-       break;
-      re = AREF (elt, 0);
-      if (NILP (re))
-       len = 1;
-      else if ((len = fast_looking_at (re, charpos, bytepos, limit, -1, string))
-              > 0)
-       {
-         if (NILP (string))
-           len = BYTE_TO_CHAR (bytepos + len) - charpos;
-         else
-           len = string_byte_to_char (string, bytepos + len) - charpos;
-       }
-      if (len > 0)
-       {
-         limit = to = charpos + len;
+      if (NILP (string))
+       len = BYTE_TO_CHAR (bytepos + len) - charpos;
+      else
+       len = string_byte_to_char (string, bytepos + len) - charpos;
+    }
+  if (len <= 0)
+    return unbind_to (count, Qnil);
+  to = limit = charpos + len;
 #ifdef HAVE_WINDOW_SYSTEM
-         if (FRAME_WINDOW_P (f))
-           {
-             font_object = font_range (charpos, &to, win, face, string);
-             if (! FONT_OBJECT_P (font_object)
-                 || (! NILP (re)
-                     && to < limit
-                     && (fast_looking_at (re, charpos, bytepos, to, -1, string) <= 0)))
-               {
-                 if (NILP (string))
-                   TEMP_SET_PT_BOTH (pt, pt_byte);
-                 return unbind_to (count, Qnil);
-               }
-           }
-         else
+  if (FRAME_WINDOW_P (f))
+    {
+      font_object = font_range (charpos, &to, win, face, string);
+      if (! FONT_OBJECT_P (font_object)
+         || (! NILP (re)
+             && to < limit
+             && (fast_looking_at (re, charpos, bytepos, to, -1, string) <= 0)))
+       return unbind_to (count, Qnil);
+    }
+  else
 #endif /* not HAVE_WINDOW_SYSTEM */
-           font_object = win->frame;
-         gstring = Fcomposition_get_gstring (pos, make_number (to),
-                                             font_object, string);
-         if (NILP (LGSTRING_ID (gstring)))
-           {
-             Lisp_Object args[6];
-
-             /* 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);
-               }
+    font_object = win->frame;
+  lgstring = Fcomposition_get_gstring (pos, make_number (to), font_object,
+                                      string);
+  if (NILP (LGSTRING_ID (lgstring)))
+    {
+      Lisp_Object args[6];
 
-             args[0] = Vauto_composition_function;
-             args[1] = AREF (elt, 2);
-             args[2] = pos;
-             args[3] = make_number (to);
-             args[4] = font_object;
-             args[5] = string;
-             gstring = safe_call (6, args);
-           }
-         else if (NILP (string))
-           {
-             TEMP_SET_PT_BOTH (pt, pt_byte);
-           }
-         return unbind_to (count, gstring);
+      /* 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);
        }
+
+      args[0] = Vauto_composition_function;
+      args[1] = AREF (rule, 2);
+      args[2] = pos;
+      args[3] = make_number (to);
+      args[4] = font_object;
+      args[5] = string;
+      lgstring = safe_call (6, args);
+      if (NILP (string))
+       TEMP_SET_PT_BOTH (pt, pt_byte);
     }
-  if (NILP (string))
-    TEMP_SET_PT_BOTH (pt, pt_byte);
-  return unbind_to (count, Qnil);
+  return unbind_to (count, lgstring);
 }
 
+static Lisp_Object _work_val;
+static int _work_char;
+
+/* 1 iff the character C is composable.  Characters of general
+   category Z? or C? are not composable except for ZWNJ and ZWJ. */
+
+#define CHAR_COMPOSABLE_P(C)                                           \
+  ((C) == 0x200C || (C) == 0x200D                                      \
+   || (_work_val = CHAR_TABLE_REF (Vunicode_category_table, (C)),      \
+       (SYMBOLP (_work_val)                                            \
+       && (_work_char = SDATA (SYMBOL_NAME (_work_val))[0]) != 'C'     \
+       && _work_char != 'Z')))
 
 /* Update cmp_it->stop_pos to the next position after CHARPOS (and
    BYTEPOS) where character composition may happen.  If BYTEPOS is
-   negative, compoute it.  If it is a static composition, set
-   cmp_it->ch to -1.  Otherwise, set cmp_it->ch to the character that
-   triggers a automatic composition.  */
+   negative, compute it.  ENDPOS is a limit of searching.  If it is
+   less than CHARPOS, search backward to ENDPOS+1 assuming that
+   set_iterator_to_next works in reverse order.  In this case, if a
+   composition closest to CHARPOS is found, set cmp_it->stop_pos to
+   the last character of the composition.
+
+   If no composition is found, set cmp_it->ch to -2.  If a static
+   composition is found, set cmp_it->ch to -1.  Otherwise, set
+   cmp_it->ch to the character that triggers the automatic
+   composition.  */
 
 void
-composition_compute_stop_pos (cmp_it, charpos, bytepos, endpos, string)
-     struct composition_it *cmp_it;
-     EMACS_INT charpos, bytepos, endpos;
-     Lisp_Object string;
+composition_compute_stop_pos (struct composition_it *cmp_it, EMACS_INT charpos, EMACS_INT bytepos, EMACS_INT endpos, Lisp_Object string)
 {
   EMACS_INT start, end, c;
   Lisp_Object prop, val;
   /* This is from forward_to_next_line_start in xdisp.c.  */
   const int MAX_NEWLINE_DISTANCE = 500;
 
-  if (endpos > charpos + MAX_NEWLINE_DISTANCE)
-    endpos = charpos + MAX_NEWLINE_DISTANCE;
-  cmp_it->stop_pos = endpos;
+  if (charpos < endpos)
+    {
+      if (endpos > charpos + MAX_NEWLINE_DISTANCE)
+       endpos = charpos + MAX_NEWLINE_DISTANCE;
+    }
+  else if (endpos < charpos)
+    {
+      /* We search backward for a position to check composition.  */
+      if (endpos < 0)
+       {
+         /* But we don't know where to stop the searching.  */
+         endpos = NILP (string) ? BEGV - 1 : -1;
+         /* Usually we don't reach ENDPOS because we stop searching
+            at an uncomposable character (NL, LRE, etc).  */
+       }
+    }
   cmp_it->id = -1;
   cmp_it->ch = -2;
-  if (find_composition (charpos, endpos, &start, &end, &prop, string)
+  cmp_it->reversed_p = 0;
+  cmp_it->stop_pos = endpos;
+  if (charpos == endpos)
+    return;
+  /* FIXME: Bidi is not yet handled well in static composition.  */
+  if (charpos < endpos
+      && find_composition (charpos, endpos, &start, &end, &prop, string)
       && COMPOSITION_VALID_P (start, end, prop))
     {
       cmp_it->stop_pos = endpos = start;
       cmp_it->ch = -1;
     }
-  if (NILP (string) && PT > charpos && PT < endpos)
-    cmp_it->stop_pos = PT;
   if (NILP (current_buffer->enable_multibyte_characters)
       || NILP (Vauto_composition_mode))
     return;
   if (bytepos < 0)
     {
-      if (STRINGP (string))
-       bytepos = string_char_to_byte (string, charpos);
-      else
+      if (NILP (string))
        bytepos = CHAR_TO_BYTE (charpos);
+      else
+       bytepos = string_char_to_byte (string, charpos);
     }
 
   start = charpos;
-  while (charpos < endpos)
+  if (charpos < endpos)
     {
-      if (STRINGP (string))
-       FETCH_STRING_CHAR_ADVANCE (c, string, charpos, bytepos);
-      else
-       FETCH_CHAR_ADVANCE (c, charpos, bytepos);
-      if (c == '\n')
+      /* Forward search.  */
+      while (charpos < endpos)
        {
-         cmp_it->ch = -2;
-         break;
+         if (STRINGP (string))
+           FETCH_STRING_CHAR_ADVANCE (c, string, charpos, bytepos);
+         else
+           FETCH_CHAR_ADVANCE (c, charpos, bytepos);
+         if (c == '\n')
+           {
+             cmp_it->ch = -2;
+             break;
+           }
+         val = CHAR_TABLE_REF (Vcomposition_function_table, c);
+         if (! NILP (val))
+           {
+             Lisp_Object elt;
+             int ridx;
+
+             for (ridx = 0; CONSP (val); val = XCDR (val), ridx++)
+               {
+                 elt = XCAR (val);
+                 if (VECTORP (elt) && ASIZE (elt) == 3
+                     && NATNUMP (AREF (elt, 1))
+                     && charpos - 1 - XFASTINT (AREF (elt, 1)) >= start)
+                   break;
+               }
+             if (CONSP (val))
+               {
+                 cmp_it->rule_idx = ridx;
+                 cmp_it->lookback = XFASTINT (AREF (elt, 1));
+                 cmp_it->stop_pos = charpos - 1 - cmp_it->lookback;
+                 cmp_it->ch = c;
+                 return;
+               }
+           }
        }
-      val = CHAR_TABLE_REF (Vcomposition_function_table, c);
-      if (! NILP (val))
+      if (charpos == endpos)
        {
-         Lisp_Object elt;
+         /* We couldn't find a composition point before ENDPOS.  But,
+            some character after ENDPOS may be composed with
+            characters before ENDPOS.  So, we should stop at the safe
+            point.  */
+         charpos = endpos - MAX_AUTO_COMPOSITION_LOOKBACK;
+         if (charpos < start)
+           charpos = start;
+       }
+    }
+  else if (charpos > endpos)
+    {
+      /* Search backward for a pattern that may be composed and the
+        position of (possibly) the last character of the match is
+        closest to (but not after) START.  The reason for the last
+        character is that set_iterator_to_next works in reverse order,
+        and thus we must stop at the last character for composition
+        check.  */
+      unsigned char *p;
+      int len;
+      /* Limit byte position used in fast_looking_at.  This is the
+        byte position of the character after START. */
+      EMACS_INT limit;
 
-         for (; CONSP (val); val = XCDR (val))
+      if (NILP (string))
+       p = BYTE_POS_ADDR (bytepos);
+      else
+       p = SDATA (string) + bytepos;
+      c = STRING_CHAR_AND_LENGTH (p, len);
+      limit = bytepos + len;
+      while (CHAR_COMPOSABLE_P (c))
+       {
+         val = CHAR_TABLE_REF (Vcomposition_function_table, c);
+         if (! NILP (val))
            {
-             elt = XCAR (val);
-             if (VECTORP (elt) && ASIZE (elt) == 3 && NATNUMP (AREF (elt, 1))
-                 && charpos - 1 - XFASTINT (AREF (elt, 1)) >= start)
-               break;
+             Lisp_Object elt;
+             int ridx, back, len;
+
+             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)
+                   {
+                     EMACS_INT cpos = charpos - back, bpos;
+
+                     if (back == 0)
+                       bpos = bytepos;
+                     else
+                       bpos = (NILP (string) ? CHAR_TO_BYTE (cpos)
+                               : string_char_to_byte (string, cpos));
+                     if (STRINGP (AREF (elt, 0)))
+                       len = fast_looking_at (AREF (elt, 0), cpos, bpos,
+                                              start + 1, limit, string);
+                     else
+                       len = 1;
+                     if (len > 0)
+                       {
+                         /* Make CPOS point to the last character of
+                            match.  Note that LEN is byte-length.  */
+                         if (len > 1)
+                           {
+                             bpos += len;
+                             if (NILP (string))
+                               cpos = BYTE_TO_CHAR (bpos) - 1;
+                             else
+                               cpos = string_byte_to_char (string, bpos) - 1;
+                           }
+                         back = cpos - (charpos - back);
+                         if (cmp_it->stop_pos < cpos
+                             || (cmp_it->stop_pos == cpos
+                                 && cmp_it->lookback < back))
+                           {
+                             cmp_it->rule_idx = ridx;
+                             cmp_it->stop_pos = cpos;
+                             cmp_it->ch = c;
+                             cmp_it->lookback = back;
+                             cmp_it->nchars = back + 1;
+                           }
+                       }
+                   }
+               }
+           }
+         if (charpos - 1 == endpos)
+           break;
+         if (STRINGP (string))
+           {
+             p--, bytepos--;
+             while (! CHAR_HEAD_P (*p))
+               p--, bytepos--;
+             charpos--;
+           }
+         else
+           {
+             DEC_BOTH (charpos, bytepos);
+             p = BYTE_POS_ADDR (bytepos);
+           }
+         c = STRING_CHAR (p);
+       }
+      if (cmp_it->ch >= 0)
+       /* We found a position to check.  */
+       return;
+      /* Skip all uncomposable characters.  */
+      if (NILP (string))
+       {
+         while (charpos - 1 > endpos && ! CHAR_COMPOSABLE_P (c))
+           {
+             DEC_BOTH (charpos, bytepos);
+             c = FETCH_MULTIBYTE_CHAR (bytepos);
            }
-         if (CONSP (val))
+       }
+      else
+       {
+         while (charpos - 1 > endpos && ! CHAR_COMPOSABLE_P (c))
            {
-             cmp_it->lookback = XFASTINT (AREF (elt, 1));
-             cmp_it->stop_pos = charpos - 1 - cmp_it->lookback;
-             cmp_it->ch = c;
-             return;
+             p--;
+             while (! CHAR_HEAD_P (*p))
+               p--;
+             charpos--;
+             c = STRING_CHAR (p);
            }
        }
     }
@@ -1104,24 +1216,20 @@ composition_compute_stop_pos (cmp_it, charpos, bytepos, endpos, string)
    string.  In that case, FACE must not be NULL.
 
    If the character is composed, setup members of CMP_IT (id, nglyphs,
-   and from), and return 1.  Otherwise, update CMP_IT->stop_pos, and
-   return 0.  */
+   from, to, reversed_p), and return 1.  Otherwise, update
+   CMP_IT->stop_pos, and return 0.  */
 
 int
-composition_reseat_it (cmp_it, charpos, bytepos, endpos, w, face, string)
-     struct composition_it *cmp_it;
-     EMACS_INT charpos, bytepos, endpos;
-     struct window *w;
-     struct face *face;
-     Lisp_Object string;
+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)
 {
-  if (NILP (string) && charpos < PT && PT < endpos)
-    endpos = PT;
+  if (endpos < 0)
+    endpos = NILP (string) ? BEGV : 0;
 
   if (cmp_it->ch == -2)
     {
       composition_compute_stop_pos (cmp_it, charpos, bytepos, endpos, string);
-      if (cmp_it->ch == -2)
+      if (cmp_it->ch == -2 || cmp_it->stop_pos != charpos)
+       /* The current position is not composed.  */
        return 0;
     }
 
@@ -1141,57 +1249,131 @@ composition_reseat_it (cmp_it, charpos, bytepos, endpos, w, face, string)
     }
   else if (w)
     {
-      Lisp_Object val, elt;
-      int i;
+      Lisp_Object lgstring = Qnil;
+      Lisp_Object val, elt, re;
+      int len, i;
 
       val = CHAR_TABLE_REF (Vcomposition_function_table, cmp_it->ch);
-      for (; CONSP (val); val = XCDR (val))
+      for (i = 0; i < cmp_it->rule_idx; i++, val = XCDR (val));
+      if (charpos < endpos)
        {
-         elt = XCAR (val);
-         if (cmp_it->lookback == XFASTINT (AREF (elt, 1)))
-           break;
+         for (; CONSP (val); val = XCDR (val))
+           {
+             elt = XCAR (val);
+             if (! VECTORP (elt) || ASIZE (elt) != 3
+                 || ! INTEGERP (AREF (elt, 1)))
+               continue;
+             if (XFASTINT (AREF (elt, 1)) != cmp_it->lookback)
+               goto no_composition;
+             lgstring = autocmp_chars (elt, charpos, bytepos, endpos,
+                                       w, face, string);
+             if (composition_gstring_p (lgstring))
+               break;
+             lgstring = Qnil;
+             /* Composition failed perhaps because the font doesn't
+                support sufficient range of characters.  Try the
+                other composition rules if any.  */
+           }
+         cmp_it->reversed_p = 0;
        }
-      if (NILP (val))
-       goto no_composition;
+      else
+       {
+         EMACS_INT cpos = charpos, bpos = bytepos;
 
-      val = autocmp_chars (val, charpos, bytepos, endpos, w, face, string);
-      if (! composition_gstring_p (val))
+         while (1)
+           {
+             elt = XCAR (val);
+             if (cmp_it->lookback > 0)
+               {
+                 cpos = charpos - cmp_it->lookback;
+                 if (STRINGP (string))
+                   bpos = string_char_to_byte (string, cpos);
+                 else
+                   bpos = CHAR_TO_BYTE (cpos);
+               }
+             lgstring = autocmp_chars (elt, cpos, bpos, charpos + 1, w, face,
+                                       string);
+             if (composition_gstring_p (lgstring)
+                 && cpos + LGSTRING_CHAR_LEN (lgstring) - 1 == charpos)
+               break;
+             /* Composition failed or didn't cover the current
+                character.  */
+             if (cmp_it->lookback == 0)
+               goto no_composition;
+             lgstring = Qnil;
+             /* Try to find a shorter compostion that starts after CPOS.  */
+             composition_compute_stop_pos (cmp_it, charpos, bytepos, cpos,
+                                           string);
+             if (cmp_it->ch == -2 || cmp_it->stop_pos < charpos)
+               goto no_composition;
+             val = CHAR_TABLE_REF (Vcomposition_function_table, cmp_it->ch);
+             for (i = 0; i < cmp_it->rule_idx; i++, val = XCDR (val));
+           }
+         cmp_it->reversed_p = 1;
+       }
+      if (NILP (lgstring))
        goto no_composition;
-      if (NILP (LGSTRING_ID (val)))
-       val = composition_gstring_put_cache (val, -1);
-      cmp_it->id = XINT (LGSTRING_ID (val));
-      for (i = 0; i < LGSTRING_GLYPH_LEN (val); i++)
-       if (NILP (LGSTRING_GLYPH (val, i)))
+      if (NILP (LGSTRING_ID (lgstring)))
+       lgstring = composition_gstring_put_cache (lgstring, -1);
+      cmp_it->id = XINT (LGSTRING_ID (lgstring));
+      for (i = 0; i < LGSTRING_GLYPH_LEN (lgstring); i++)
+       if (NILP (LGSTRING_GLYPH (lgstring, i)))
          break;
       cmp_it->nglyphs = i;
+      cmp_it->from = 0;
+      cmp_it->to = i;
     }
   else
     goto no_composition;
-  cmp_it->from = 0;
   return 1;
 
  no_composition:
-  charpos++;
-  if (STRINGP (string))
-    bytepos += MULTIBYTE_LENGTH_NO_CHECK (SDATA (string) + bytepos);
+  if (charpos == endpos)
+    return 0;
+  if (charpos < endpos)
+    {
+      charpos++;
+      if (NILP (string))
+       INC_POS (bytepos);
+      else
+       bytepos += BYTES_BY_CHAR_HEAD (*(SDATA (string) + bytepos));
+    }
   else
-    INC_POS (bytepos);
+    {
+      charpos--;
+      /* BYTEPOS is calculated in composition_compute_stop_pos */
+      bytepos = -1;
+    }
   composition_compute_stop_pos (cmp_it, charpos, bytepos, endpos, string);
   return 0;
 }
 
+/* Update charpos, nchars, nbytes, and width of the current grapheme
+   cluster.
+
+   If the composition is static or automatic in L2R context, the
+   cluster is identified by CMP_IT->from, and CHARPOS is the position
+   of the first character of the cluster.  In this case, update
+   CMP_IT->to too.
+
+   If the composition is automatic in R2L context, the cluster is
+   identified by CMP_IT->to, and CHARPOS is the position of the last
+   character of the cluster.  In this case, update CMP_IT->from too.
+
+   The return value is the character code of the first character of
+   the cluster, or -1 if the composition is somehow broken.  */
+
 int
-composition_update_it (cmp_it, charpos, bytepos, string)
-     struct composition_it *cmp_it;
-     EMACS_INT charpos, bytepos;
-     Lisp_Object string;
+composition_update_it (struct composition_it *cmp_it, EMACS_INT charpos, EMACS_INT bytepos, Lisp_Object string)
 {
   int i, c;
 
   if (cmp_it->ch < 0)
     {
+      /* static composition */
       struct composition *cmp = composition_table[cmp_it->id];
 
+      cmp_it->charpos = charpos;
       cmp_it->to = cmp_it->nglyphs;
       if (cmp_it->nglyphs == 0)
        c = -1;
@@ -1204,43 +1386,63 @@ composition_update_it (cmp_it, charpos, bytepos, string)
            c = ' ';
        }
       cmp_it->width = cmp->width;
+      charpos += cmp_it->nchars;
+      if (STRINGP (string))
+       cmp_it->nbytes = string_char_to_byte (string, charpos) - bytepos;
+      else
+       cmp_it->nbytes = CHAR_TO_BYTE (charpos) - bytepos;
     }
   else
     {
+      /* automatic composition */
       Lisp_Object gstring = composition_gstring_from_id (cmp_it->id);
+      Lisp_Object glyph;
+      int from, to;
 
       if (cmp_it->nglyphs == 0)
        {
-         c = -1;
          cmp_it->nchars = LGSTRING_CHAR_LEN (gstring);
          cmp_it->width = 0;
+         cmp_it->from = cmp_it->to = 0;
+         return -1;
        }
-      else
+      if (! cmp_it->reversed_p)
        {
-         Lisp_Object glyph = LGSTRING_GLYPH (gstring, cmp_it->from);
-         int from = LGLYPH_FROM (glyph);
-
-         c = XINT (LGSTRING_CHAR (gstring, from));
-         cmp_it->nchars = LGLYPH_TO (glyph) - from + 1;
-         cmp_it->width = (LGLYPH_WIDTH (glyph) > 0
-                          ? CHAR_WIDTH (LGLYPH_CHAR (glyph)) : 0);
+         glyph = LGSTRING_GLYPH (gstring, cmp_it->from);
+         from = LGLYPH_FROM (glyph);
          for (cmp_it->to = cmp_it->from + 1; cmp_it->to < cmp_it->nglyphs;
               cmp_it->to++)
            {
              glyph = LGSTRING_GLYPH (gstring, cmp_it->to);
              if (LGLYPH_FROM (glyph) != from)
                break;
-             if (LGLYPH_WIDTH (glyph) > 0)
-               cmp_it->width += CHAR_WIDTH (LGLYPH_CHAR (glyph));
            }
+         cmp_it->charpos = charpos;
+       }
+      else
+       {
+         glyph = LGSTRING_GLYPH (gstring, cmp_it->to - 1);
+         from = LGLYPH_FROM (glyph);
+         cmp_it->charpos = charpos - (LGLYPH_TO (glyph) - from);
+         for (cmp_it->from = cmp_it->to - 1; cmp_it->from > 0;
+              cmp_it->from--)
+           {
+             glyph = LGSTRING_GLYPH (gstring, cmp_it->from - 1);
+             if (LGLYPH_FROM (glyph) != from)
+               break;
+           }
+       }
+      glyph = LGSTRING_GLYPH (gstring, cmp_it->from);
+      cmp_it->nchars = LGLYPH_TO (glyph) + 1 - from;
+      cmp_it->nbytes = 0;
+      cmp_it->width = 0;
+      for (i = cmp_it->nchars - 1; i >= 0; i--)
+       {
+         c = XINT (LGSTRING_CHAR (gstring, i));
+         cmp_it->nbytes += CHAR_BYTES (c);
+         cmp_it->width += CHAR_WIDTH (c);
        }
     }
-
-  charpos += cmp_it->nchars;
-  if (STRINGP (string))
-    cmp_it->nbytes = string_char_to_byte (string, charpos) - bytepos;
-  else
-    cmp_it->nbytes = CHAR_TO_BYTE (charpos) - bytepos;
   return c;
 }
 
@@ -1251,7 +1453,7 @@ struct position_record
   unsigned char *p;
 };
 
-/* Update the members of POSTION to the next character boundary.  */
+/* Update the members of POSITION to the next character boundary.  */
 #define FORWARD_CHAR(POSITION, STOP)                                   \
   do {                                                                 \
     (POSITION).pos++;                                                  \
@@ -1267,7 +1469,7 @@ struct position_record
       }                                                                        \
   } while (0)
 
-/* Update the members of POSTION to the previous character boundary.  */
+/* Update the members of POSITION to the previous character boundary.  */
 #define BACKWARD_CHAR(POSITION, STOP)          \
   do {                                         \
     if ((POSITION).pos == STOP)                        \
@@ -1279,25 +1481,12 @@ struct position_record
     (POSITION).pos--;                          \
   } while (0)
 
-static Lisp_Object _work_val;
-static int _work_char;
-
-/* 1 iff the character C is composable.  */
-#define CHAR_COMPOSABLE_P(C)                                           \
-  ((C) == 0x200C || (C) == 0x200D                                      \
-   || (_work_val = CHAR_TABLE_REF (Vunicode_category_table, (C)),      \
-       (SYMBOLP (_work_val)                                            \
-       && (_work_char = SDATA (SYMBOL_NAME (_work_val))[0]) != 'C'     \
-       && _work_char != 'Z')))
-
 /* This is like find_composition, but find an automatic composition
    instead.  If found, set *GSTRING to the glyph-string representing
    the composition, and return 1.  Otherwise, return 0.  */
 
 static int
-find_automatic_composition (pos, limit, start, end, gstring, string)
-     EMACS_INT pos, limit, *start, *end;
-     Lisp_Object *gstring, string;
+find_automatic_composition (EMACS_INT pos, EMACS_INT limit, EMACS_INT *start, EMACS_INT *end, Lisp_Object *gstring, Lisp_Object string)
 {
   EMACS_INT head, tail, stop;
   /* Limit to check a composition after POS.  */
@@ -1420,7 +1609,7 @@ find_automatic_composition (pos, limit, start, end, gstring, string)
                    check.pos_byte = cur.pos_byte;
                  else
                    check.pos_byte = CHAR_TO_BYTE (check.pos);
-                 val = autocmp_chars (check_val, check.pos, check.pos_byte,
+                 val = autocmp_chars (elt, check.pos, check.pos_byte,
                                       tail, w, NULL, string);
                  need_adjustment = 1;
                  if (! NILP (val))
@@ -1439,7 +1628,7 @@ find_automatic_composition (pos, limit, start, end, gstring, string)
            }
          if (need_adjustment)
            {
-             /* As we have called Lisp, there's a possibilily that
+             /* As we have called Lisp, there's a possibility that
                 buffer/string is relocated.  */
              if (NILP (string))
                cur.p  = BYTE_POS_ADDR (cur.pos_byte);
@@ -1468,8 +1657,7 @@ find_automatic_composition (pos, limit, start, end, gstring, string)
    to NEW_PT.  */
 
 int
-composition_adjust_point (last_pt, new_pt)
-     EMACS_INT last_pt, new_pt;
+composition_adjust_point (EMACS_INT last_pt, EMACS_INT new_pt)
 {
   EMACS_INT charpos, bytepos, startpos, beg, end, pos;
   Lisp_Object val;
@@ -1551,16 +1739,13 @@ where
 
 If GLYPH is nil, the remaining elements of the glyph-string vector
 should be ignored.  */)
-     (from, to, font_object, string)
-     Lisp_Object font_object, from, to, string;
+  (Lisp_Object from, Lisp_Object to, Lisp_Object font_object, Lisp_Object string)
 {
   Lisp_Object gstring, header;
   EMACS_INT frompos, topos;
 
   CHECK_NATNUM (from);
   CHECK_NATNUM (to);
-  if (XINT (to) > XINT (from) + MAX_COMPOSITION_COMPONENTS)
-    to = make_number (XINT (from) + MAX_COMPOSITION_COMPONENTS);
   if (! FONT_OBJECT_P (font_object))
     {
       struct coding_system *coding;
@@ -1597,8 +1782,7 @@ DEFUN ("compose-region-internal", Fcompose_region_internal,
 Compose text in the region between START and END.
 Optional 3rd and 4th arguments are COMPONENTS and MODIFICATION-FUNC
 for the composition.  See `compose-region' for more details.  */)
-     (start, end, components, modification_func)
-     Lisp_Object start, end, components, modification_func;
+  (Lisp_Object start, Lisp_Object end, Lisp_Object components, Lisp_Object modification_func)
 {
   validate_region (&start, &end);
   if (!NILP (components)
@@ -1618,8 +1802,7 @@ DEFUN ("compose-string-internal", Fcompose_string_internal,
 Compose text between indices START and END of STRING.
 Optional 4th and 5th arguments are COMPONENTS and MODIFICATION-FUNC
 for the composition.  See `compose-string' for more details.  */)
-     (string, start, end, components, modification_func)
-     Lisp_Object string, start, end, components, modification_func;
+  (Lisp_Object string, Lisp_Object start, Lisp_Object end, Lisp_Object components, Lisp_Object modification_func)
 {
   CHECK_STRING (string);
   CHECK_NUMBER (start);
@@ -1640,8 +1823,7 @@ DEFUN ("find-composition-internal", Ffind_composition_internal,
 
 Return information about composition at or nearest to position POS.
 See `find-composition' for more details.  */)
-     (pos, limit, string, detail_p)
-     Lisp_Object pos, limit, string, detail_p;
+  (Lisp_Object pos, Lisp_Object limit, Lisp_Object string, Lisp_Object detail_p)
 {
   Lisp_Object prop, tail, gstring;
   EMACS_INT start, end, from, to;
@@ -1684,7 +1866,7 @@ See `find-composition' for more details.  */)
 
       if (find_automatic_composition (from, to, &s, &e, &gstring, string)
          && (e <= XINT (pos) ? e > end : s < start))
-       return list3 (make_number (start), make_number (end), gstring);
+       return list3 (make_number (s), make_number (e), gstring);
     }
   if (!COMPOSITION_VALID_P (start, end, prop))
     return Fcons (make_number (start), Fcons (make_number (end),
@@ -1726,7 +1908,7 @@ See `find-composition' for more details.  */)
 
 \f
 void
-syms_of_composite ()
+syms_of_composite (void)
 {
   int i;
 
@@ -1736,7 +1918,6 @@ syms_of_composite ()
   /* Make a hash table for static composition.  */
   {
     Lisp_Object args[6];
-    extern Lisp_Object QCsize;
 
     args[0] = QCtest;
     args[1] = Qequal;
@@ -1756,8 +1937,6 @@ syms_of_composite ()
   /* Make a hash table for glyph-string.  */
   {
     Lisp_Object args[6];
-    extern Lisp_Object QCsize;
-
     args[0] = QCtest;
     args[1] = Qequal;
     args[2] = QCweakness;
@@ -1824,7 +2003,7 @@ preceding and/or following characters, this char-table contains
 a function to call to compose that character.
 
 The element at index C in the table, if non-nil, is a list of
-this form: ([PATTERN PREV-CHARS FUNC] ...)
+composition rules of this form: ([PATTERN PREV-CHARS FUNC] ...)
 
 PATTERN is a regular expression which C and the surrounding
 characters must match.
index 59c237c8de21f956b67e2d5747e4e126cec1f905..554ab55411520cab0446e36dfd1074eb16ac5d4f 100644 (file)
@@ -212,16 +212,16 @@ extern Lisp_Object Vauto_composition_function;
 extern Lisp_Object Qauto_composition_function;
 extern Lisp_Object Vcomposition_function_table;
 
-extern int get_composition_id P_ ((int, int, int, Lisp_Object, Lisp_Object));
-extern int find_composition P_ ((int, int, EMACS_INT *, EMACS_INT *, Lisp_Object *,
-                                Lisp_Object));
-extern void update_compositions P_ ((EMACS_INT, EMACS_INT, int));
-extern void make_composition_value_copy P_ ((Lisp_Object));
-extern void compose_region P_ ((int, int, Lisp_Object, Lisp_Object,
-                               Lisp_Object));
-extern void syms_of_composite P_ ((void));
-extern void compose_text P_ ((int, int, Lisp_Object, Lisp_Object,
-                             Lisp_Object));
+extern int get_composition_id (int, int, int, Lisp_Object, Lisp_Object);
+extern int find_composition (int, int, EMACS_INT *, EMACS_INT *, Lisp_Object *,
+                             Lisp_Object);
+extern void update_compositions (EMACS_INT, EMACS_INT, 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 (int, int, Lisp_Object, Lisp_Object,
+                          Lisp_Object);
 
 /* Macros for lispy glyph-string.  This is completely different from
    struct glyph_string.  */
@@ -303,23 +303,23 @@ struct composition_it;
 struct face;
 struct font_metrics;
 
-extern Lisp_Object composition_gstring_put_cache P_ ((Lisp_Object, int));
-extern Lisp_Object composition_gstring_from_id P_ ((int));
-extern int composition_gstring_p P_ ((Lisp_Object));
-extern int composition_gstring_width P_ ((Lisp_Object, int, int,
-                                         struct font_metrics *));
-
-extern void composition_compute_stop_pos P_ ((struct composition_it *,
-                                             EMACS_INT, EMACS_INT, EMACS_INT,
-                                             Lisp_Object));
-extern int composition_reseat_it P_ ((struct composition_it *,
-                                     EMACS_INT, EMACS_INT, EMACS_INT,
-                                     struct window *, struct face *,
-                                     Lisp_Object));
-extern int composition_update_it P_ ((struct composition_it *,
-                                     EMACS_INT, EMACS_INT, Lisp_Object));
-
-extern int composition_adjust_point P_ ((EMACS_INT, EMACS_INT));
+extern Lisp_Object composition_gstring_put_cache (Lisp_Object, int);
+extern Lisp_Object composition_gstring_from_id (int);
+extern int composition_gstring_p (Lisp_Object);
+extern int composition_gstring_width (Lisp_Object, int, int,
+                                      struct font_metrics *);
+
+extern void composition_compute_stop_pos (struct composition_it *,
+                                          EMACS_INT, EMACS_INT, EMACS_INT,
+                                          Lisp_Object);
+extern int composition_reseat_it (struct composition_it *,
+                                  EMACS_INT, EMACS_INT, EMACS_INT,
+                                  struct window *, struct face *,
+                                  Lisp_Object);
+extern int composition_update_it (struct composition_it *,
+                                  EMACS_INT, EMACS_INT, Lisp_Object);
+
+extern int composition_adjust_point (EMACS_INT, EMACS_INT);
 
 EXFUN (Fcompose_region_internal, 4);
 EXFUN (Fcompose_string_internal, 5);
index 4667c0feb288e5bb1c01e9353d96b533a43d6e8b..604a737a8b0a2f77baefd88bd478ea169b6a5857 100644 (file)
@@ -27,12 +27,15 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #define EMACS_CONFIG_H
 
 
-/* Generate dependencies with gcc. */
-#undef AUTO_DEPEND
+/* Define if building universal (internal helper macro) */
+#undef AC_APPLE_UNIVERSAL_BUILD
 
 /* Define to 1 if the mktime function is broken. */
 #undef BROKEN_MKTIME
 
+/* 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.
    */
@@ -44,12 +47,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to 1 if using `getloadavg.c'. */
 #undef C_GETLOADAVG
 
-/* 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
-   above 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. */
-#undef C_SWITCH_X_SITE
-
 /* Define to 1 for DGUX with <sys/dg_sys_info.h>. */
 #undef DGUX
 
@@ -108,15 +105,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to 1 if ALSA is available. */
 #undef HAVE_ALSA
 
-/* Define to 1 if you have the `bcmp' function. */
-#undef HAVE_BCMP
-
-/* Define to 1 if you have the `bcopy' function. */
-#undef HAVE_BCOPY
-
-/* Define to 1 if you have the `bzero' function. */
-#undef HAVE_BZERO
-
 /* Define to 1 if you have the `cbrt' function. */
 #undef HAVE_CBRT
 
@@ -135,8 +123,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to 1 if you have the <com_err.h> header file. */
 #undef HAVE_COM_ERR_H
 
-/* Define to 1 if you have /usr/lib/crti.o. */
-#undef HAVE_CRTIN
+/* Define to 1 if you have the `copysign' function. */
+#undef HAVE_COPYSIGN
 
 /* Define to 1 if using D-Bus. */
 #undef HAVE_DBUS
@@ -165,6 +153,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* 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. */
 #undef HAVE_DUP2
 
@@ -204,9 +195,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to 1 if using GConf. */
 #undef HAVE_GCONF
 
-/* Define to 1 if you have the `gdk_display_open' function. */
-#undef HAVE_GDK_DISPLAY_OPEN
-
 /* Define to 1 if you have the `getaddrinfo' function. */
 #undef HAVE_GETADDRINFO
 
@@ -264,8 +252,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* 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 library (default -lgif; otherwise specify
-   with LIBGIF). */
+/* Define to 1 if you have a gif (or ungif) library. */
 #undef HAVE_GIF
 
 /* Define to 1 if you have the gpm library (-lgpm). */
@@ -274,14 +261,14 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to 1 if you have the `grantpt' function. */
 #undef HAVE_GRANTPT
 
+/* 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 GTK and pthread (-lpthread). */
 #undef HAVE_GTK_AND_PTHREAD
 
-/* Define to 1 if GTK has both file selection and chooser dialog. */
-#undef HAVE_GTK_FILE_BOTH
-
-/* Define to 1 if you have the `gtk_file_chooser_dialog_new' function. */
-#undef HAVE_GTK_FILE_CHOOSER_DIALOG_NEW
+/* 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
@@ -289,14 +276,26 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to 1 if you have the `gtk_main' function. */
 #undef HAVE_GTK_MAIN
 
-/* Define to 1 if GTK can handle more than one display. */
-#undef HAVE_GTK_MULTIDISPLAY
+/* 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 netdb.h declares h_errno. */
 #undef HAVE_H_ERRNO
 
-/* Define to 1 if you have the `index' function. */
-#undef HAVE_INDEX
+/* Define to 1 if using imagemagick. */
+#undef HAVE_IMAGEMAGICK
 
 /* Define to 1 if you have inet sockets. */
 #undef HAVE_INET_SOCKETS
@@ -304,6 +303,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
+/* Define to 1 if you have the `isnan' function. */
+#undef HAVE_ISNAN
+
 /* Define to 1 if you have the jpeg library (-ljpeg). */
 #undef HAVE_JPEG
 
@@ -334,9 +336,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define if you have <langinfo.h> and nl_langinfo(CODESET). */
 #undef HAVE_LANGINFO_CODESET
 
-/* Define to 1 if the directory /usr/lib64 exists. */
-#undef HAVE_LIB64_DIR
-
 /* Define to 1 if you have the `com_err' library (-lcom_err). */
 #undef HAVE_LIBCOM_ERR
 
@@ -400,15 +399,15 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* 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 `Xmu' library (-lXmu). */
 #undef HAVE_LIBXMU
 
-/* Define to 1 if you have the Xp library (-lXp). */
-#undef HAVE_LIBXP
-
 /* Define to 1 if you have the <limits.h> header file. */
 #undef HAVE_LIMITS_H
 
@@ -436,6 +435,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* 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 <maillock.h> header file. */
 #undef HAVE_MAILLOCK_H
 
@@ -489,8 +491,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to 1 if you have a working `mmap' system call. */
 #undef HAVE_MMAP
 
-/* Define to 1 if you have Motif 2.1 or newer. */
-#undef HAVE_MOTIF_2_1
+/* Define if you have mouse support. */
+#undef HAVE_MOUSE
 
 /* Define to 1 if you have the `mremap' function. */
 #undef HAVE_MREMAP
@@ -544,9 +546,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to 1 if res_init is available. */
 #undef HAVE_RES_INIT
 
-/* Define to 1 if you have the `rindex' function. */
-#undef HAVE_RINDEX
-
 /* Define to 1 if you have the `rint' function. */
 #undef HAVE_RINT
 
@@ -586,6 +585,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to 1 if the system has the type `size_t'. */
 #undef HAVE_SIZE_T
 
+/* Define to 1 if you have sound support. */
+#undef HAVE_SOUND
+
 /* Define to 1 if you have the <soundcard.h> header file. */
 #undef HAVE_SOUNDCARD_H
 
@@ -601,6 +603,9 @@ 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 `strchr' function. */
+#undef HAVE_STRCHR
+
 /* Define to 1 if you have the `strerror' function. */
 #undef HAVE_STRERROR
 
@@ -613,6 +618,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to 1 if you have the <string.h> header file. */
 #undef HAVE_STRING_H
 
+/* Define to 1 if you have the `strrchr' function. */
+#undef HAVE_STRRCHR
+
 /* Define to 1 if you have the `strsignal' function. */
 #undef HAVE_STRSIGNAL
 
@@ -697,9 +705,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* 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 <termcap.h> header file. */
-#undef HAVE_TERMCAP_H
-
 /* Define to 1 if you have the <termios.h> header file. */
 #undef HAVE_TERMIOS_H
 
@@ -735,6 +740,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
+/* Define to 1 if you have the <util.h> header file. */
+#undef HAVE_UTIL_H
+
 /* Define to 1 if you have the `utimes' function. */
 #undef HAVE_UTIMES
 
@@ -750,6 +758,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to 1 if you have the <vfork.h> header file. */
 #undef HAVE_VFORK_H
 
+/* Define if you have a window system. */
+#undef HAVE_WINDOW_SYSTEM
+
 /* Define to 1 if `fork' works. */
 #undef HAVE_WORKING_FORK
 
@@ -763,6 +774,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* 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
 
@@ -793,12 +807,18 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to 1 if you have the `XSetWMProtocols' function. */
 #undef HAVE_XSETWMPROTOCOLS
 
+/* 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 you have the `__executable_start' function. */
+#undef HAVE___EXECUTABLE_START
+
 /* Define to 1 if you have the `__fpending' function. */
 #undef HAVE___FPENDING
 
@@ -811,21 +831,23 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to use Kerberos 5 instead of Kerberos 4. */
 #undef KERBEROS5
 
-/* Define LD_SWITCH_X_SITE to contain any special flags your loader may need
-   to deal with X Windows. For instance, if you've defined HAVE_X_WINDOWS
-   above and your X libraries aren't in a place that your loader can find on
-   its own, you might want to add "-L/..." or something similar. */
-#undef LD_SWITCH_X_SITE
+/* Define to 1 if localtime caches TZ. */
+#undef LOCALTIME_CACHE
 
-/* Define LD_SWITCH_X_SITE_AUX with an -R option in case it's needed (for
-   Solaris, for example). */
-#undef LD_SWITCH_X_SITE_AUX
+/* String giving fallback POP mail host. */
+#undef MAILHOST
 
-/* Compiler option to link with the gif library (if not -lgif). */
-#undef LIBGIF
+/* Define to unlink, rather than empty, mail spool after reading. */
+#undef MAIL_UNLINK_SPOOL
 
-/* Define to 1 if localtime caches TZ. */
-#undef LOCALTIME_CACHE
+/* 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. */
 #undef MAIL_USE_POP
@@ -846,6 +868,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to 1 if you are using NS windowing under GNUstep. */
 #undef NS_IMPL_GNUSTEP
 
+/* Define if the C compiler is the linker. */
+#undef ORDINARY_LINK
+
 /* Define to the address where bug reports for this package should be sent. */
 #undef PACKAGE_BUGREPORT
 
@@ -895,6 +920,12 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Process async input synchronously. */
 #undef SYNC_INPUT
 
+/* Define to use system malloc. */
+#undef SYSTEM_MALLOC
+
+/* 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>. */
 #undef TIME_WITH_SYS_TIME
 
@@ -908,15 +939,18 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    <sys/cpustats.h>. */
 #undef UMAX4_3
 
-/* Define to the unexec source file name. */
-#undef UNEXEC_SRC
-
 /* 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
 
+/* Define to use mmap to allocate buffer text. */
+#undef USE_MMAP_FOR_BUFFERS
+
 /* Define to 1 if using the Motif X toolkit. */
 #undef USE_MOTIF
 
@@ -951,6 +985,18 @@ 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 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
+# ifndef WORDS_BIGENDIAN
+#  undef WORDS_BIGENDIAN
+# endif
+#endif
+
 /* Define this to check for malloc buffer overrun. */
 #undef XMALLOC_OVERRUN_CHECK
 
@@ -1018,37 +1064,12 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #undef volatile
 
 
-/* If we're using X11/Carbon/GNUstep, define some consequences.  */
-#if defined(HAVE_X_WINDOWS) || defined(HAVE_NS)
-#define HAVE_WINDOW_SYSTEM
-#define HAVE_MOUSE
-#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.  */
 #define AMPERSAND_FULL_NAME
 
-/* Define HAVE_SOUND if we have sound support.  We know it works
-   and compiles only on the specified platforms.   For others,
-   it probably doesn't make sense to try.  */
-
-#if defined __FreeBSD__ || defined __NetBSD__ || defined __linux__
-#ifdef HAVE_MACHINE_SOUNDCARD_H
-#define HAVE_SOUND 1
-#endif
-#ifdef HAVE_SYS_SOUNDCARD_H
-#define HAVE_SOUND 1
-#endif
-#ifdef HAVE_SOUNDCARD_H
-#define HAVE_SOUND 1
-#endif
-#ifdef HAVE_ALSA
-#define HAVE_SOUND 1
-#endif
-#endif /* __FreeBSD__ || __NetBSD__ || __linux__  */
-
-/* If using GNU, then support inline function declarations. */
+/* If using GNU, then support inline function declarations.  */
 /* Don't try to switch on inline handling as detected by AC_C_INLINE
    generally, because even if non-gcc compilers accept `inline', they
    may reject `extern inline'.  */
@@ -1073,12 +1094,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Set up some defines, C and LD flags for NeXTstep interface on GNUstep.
   (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. */
+   parallel this exactly since GNUstep is multi-OS.  */
 #ifdef HAVE_NS
 # ifdef NS_IMPL_GNUSTEP
-/* See also .m.o rule in Makefile.in */
-/* FIXME: are all these flags really needed?  Document here why.  */
-#  define C_SWITCH_X_SYSTEM -D_REENTRANT -fPIC -fno-strict-aliasing
 /* GNUstep needs a bit more pure memory.  Of the existing knobs,
 SYSTEM_PURESIZE_EXTRA seems like the least likely to cause problems.  */
 #  define SYSTEM_PURESIZE_EXTRA 30000
@@ -1110,24 +1128,6 @@ SYSTEM_PURESIZE_EXTRA seems like the least likely to cause problems.  */
 
 #define my_strftime nstrftime  /* for strftime.c */
 
-/* The rest of the code currently tests the CPP symbol BSTRING.
-   Override any claims made by the system-description files.
-   Note that on some SCO version it is possible to have bcopy and not bcmp.  */
-#undef BSTRING
-#if defined (HAVE_BCOPY) && defined (HAVE_BCMP)
-#define BSTRING
-#endif
-
-/* 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.
-
-   This declaration shouldn't appear when alloca.s or Makefile.in
-   includes config.h.  */
-#ifndef NOT_C_CODE
-extern char *getenv ();
-#endif
-
 /* These default definitions are good for almost all machines.
    The exceptions override them in m/MACHINE.h.  */
 
@@ -1154,56 +1154,42 @@ extern char *getenv ();
 #endif
 #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.  */
+/* 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
-/* For mktime.c:  */
-#ifndef __P
-# if defined PROTOTYPES
-#  define __P(args) args
-# else
-#  define __P(args) ()
-# endif  /* GCC.  */
-#endif /* __P */
-
-/* Don't include "string.h" or <stdlib.h> in non-C code.  */
-#ifndef NOT_C_CODE
+
 #ifdef HAVE_STRING_H
-#include "string.h"
-#endif
-#ifdef HAVE_STRINGS_H
-#include "strings.h"  /* May be needed for bcopy & al. */
+#include <string.h>
 #endif
+
 #ifdef HAVE_STDLIB_H
 #include <stdlib.h>
 #endif
-#ifndef __GNUC__
-# ifdef HAVE_ALLOCA_H
-#  include <alloca.h>
-# else /* AIX files deal with #pragma.  */
-#  ifndef alloca /* predefined by HP cc +Olibcalls */
-char *alloca ();
-#  endif
-# endif /* HAVE_ALLOCA_H */
-#endif /* __GNUC__ */
+
+#ifdef HAVE_ALLOCA_H
+# include <alloca.h>
+#elif defined __GNUC__
+# define alloca __builtin_alloca
+#elif defined _AIX
+# define alloca __alloca
+#else
+# include <stddef.h>
+# ifdef  __cplusplus
+extern "C"
+# endif
+void *alloca (size_t);
+#endif
+
 #ifndef HAVE_SIZE_T
 typedef unsigned size_t;
 #endif
-#endif /* NOT_C_CODE */
 
-/* Define HAVE_X_I18N if we have usable i18n support.  */
-
-#ifdef HAVE_X11R6
-#define HAVE_X_I18N
-#elif !defined X11R5_INHIBIT_I18N
-#define HAVE_X_I18N
+#ifndef HAVE_STRCHR
+#define strchr(a, b) index (a, b)
 #endif
 
-/* Define HAVE_X11R6_XIM if we have usable X11R6-style XIM support.  */
-
-#if defined HAVE_X11R6 && !defined INHIBIT_X11R6_XIM
-#define HAVE_X11R6_XIM
+#ifndef HAVE_STRRCHR
+#define strrchr(a, b) rindex (a, b)
 #endif
 
 #if defined __GNUC__ && (__GNUC__ > 2 \
@@ -1217,11 +1203,7 @@ typedef unsigned size_t;
    that the stack is continuous.  */
 #ifdef __GNUC__
 #  ifndef GC_SETJMP_WORKS
-  /* GC_SETJMP_WORKS is nearly always appropriate for GCC --
-     see NON_SAVING_SETJMP in the target descriptions.  */
-  /* Exceptions (see NON_SAVING_SETJMP in target description) are
-     SCO5 non-ELF (but Emacs specifies ELF) and SVR3 on x86.
-     Fixme: Deal with SVR3.  */
+  /* GC_SETJMP_WORKS is nearly always appropriate for GCC.  */
 #    define GC_SETJMP_WORKS 1
 #  endif
 #  ifndef GC_LISP_OBJECT_ALIGNMENT
@@ -1229,16 +1211,6 @@ typedef unsigned size_t;
 #  endif
 #endif
 
-#ifndef HAVE_BCOPY
-#define bcopy(a,b,s) memcpy (b,a,s)
-#endif
-#ifndef HAVE_BZERO
-#define bzero(a,s) memset (a,0,s)
-#endif
-#ifndef HAVE_BCMP
-#define BCMP memcmp
-#endif
-
 #endif /* EMACS_CONFIG_H */
 
 /*
index e405ca6af9eb2870d80ab9838c3aaad970284eb9..630d341a20e773be679ca7ea7b0213f049d1a50a 100644 (file)
@@ -50,7 +50,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <math.h>
 
 #if !defined (atof)
-extern double atof ();
+extern double atof (const char *);
 #endif /* !atof */
 
 Lisp_Object Qnil, Qt, Qquote, Qlambda, Qsubr, Qunbound;
@@ -82,7 +82,8 @@ Lisp_Object Qnumberp, Qnumber_or_marker_p;
 
 Lisp_Object Qinteger;
 static Lisp_Object Qsymbol, Qstring, Qcons, Qmarker, Qoverlay;
-static Lisp_Object Qfloat, Qwindow_configuration, Qwindow;
+Lisp_Object Qwindow;
+static Lisp_Object Qfloat, Qwindow_configuration;
 Lisp_Object Qprocess;
 static Lisp_Object Qcompiled_function, Qbuffer, Qframe, Qvector;
 static Lisp_Object Qchar_table, Qbool_vector, Qhash_table;
@@ -91,22 +92,20 @@ Lisp_Object Qfont_spec, Qfont_entity, Qfont_object;
 
 Lisp_Object Qinteractive_form;
 
-static Lisp_Object swap_in_symval_forwarding P_ ((Lisp_Object, Lisp_Object));
+static void swap_in_symval_forwarding (struct Lisp_Symbol *, struct Lisp_Buffer_Local_Value *);
 
 Lisp_Object Vmost_positive_fixnum, Vmost_negative_fixnum;
 
 
 void
-circular_list_error (list)
-     Lisp_Object list;
+circular_list_error (Lisp_Object list)
 {
   xsignal (Qcircular_list, list);
 }
 
 
 Lisp_Object
-wrong_type_argument (predicate, value)
-     register Lisp_Object predicate, value;
+wrong_type_argument (register Lisp_Object predicate, register Lisp_Object value)
 {
   /* If VALUE is not even a valid Lisp object, we'd want to abort here
      where we can get a backtrace showing where it came from.  We used
@@ -119,21 +118,19 @@ wrong_type_argument (predicate, value)
 }
 
 void
-pure_write_error ()
+pure_write_error (void)
 {
   error ("Attempt to modify read-only object");
 }
 
 void
-args_out_of_range (a1, a2)
-     Lisp_Object a1, a2;
+args_out_of_range (Lisp_Object a1, Lisp_Object a2)
 {
   xsignal2 (Qargs_out_of_range, a1, a2);
 }
 
 void
-args_out_of_range_3 (a1, a2, a3)
-     Lisp_Object a1, a2, a3;
+args_out_of_range_3 (Lisp_Object a1, Lisp_Object a2, Lisp_Object a3)
 {
   xsignal3 (Qargs_out_of_range, a1, a2, a3);
 }
@@ -146,8 +143,7 @@ int sign_extend_temp;
 /* On a few machines, XINT can only be done by calling this.  */
 
 int
-sign_extend_lisp_int (num)
-     EMACS_INT num;
+sign_extend_lisp_int (EMACS_INT num)
 {
   if (num & (((EMACS_INT) 1) << (VALBITS - 1)))
     return num | (((EMACS_INT) (-1)) << VALBITS);
@@ -159,8 +155,7 @@ sign_extend_lisp_int (num)
 
 DEFUN ("eq", Feq, Seq, 2, 2, 0,
        doc: /* Return t if the two args are the same Lisp object.  */)
-     (obj1, obj2)
-     Lisp_Object obj1, obj2;
+  (Lisp_Object obj1, Lisp_Object obj2)
 {
   if (EQ (obj1, obj2))
     return Qt;
@@ -169,8 +164,7 @@ DEFUN ("eq", Feq, Seq, 2, 2, 0,
 
 DEFUN ("null", Fnull, Snull, 1, 1, 0,
        doc: /* Return t if OBJECT is nil.  */)
-     (object)
-     Lisp_Object object;
+  (Lisp_Object object)
 {
   if (NILP (object))
     return Qt;
@@ -181,8 +175,7 @@ DEFUN ("type-of", Ftype_of, Stype_of, 1, 1, 0,
        doc: /* Return a symbol representing the type of OBJECT.
 The symbol returned names the object's basic type;
 for example, (type-of 1) returns `integer'.  */)
-     (object)
-     Lisp_Object object;
+  (Lisp_Object object)
 {
   switch (XTYPE (object))
     {
@@ -249,8 +242,7 @@ for example, (type-of 1) returns `integer'.  */)
 
 DEFUN ("consp", Fconsp, Sconsp, 1, 1, 0,
        doc: /* Return t if OBJECT is a cons cell.  */)
-     (object)
-     Lisp_Object object;
+  (Lisp_Object object)
 {
   if (CONSP (object))
     return Qt;
@@ -259,8 +251,7 @@ DEFUN ("consp", Fconsp, Sconsp, 1, 1, 0,
 
 DEFUN ("atom", Fatom, Satom, 1, 1, 0,
        doc: /* Return t if OBJECT is not a cons cell.  This includes nil.  */)
-     (object)
-     Lisp_Object object;
+  (Lisp_Object object)
 {
   if (CONSP (object))
     return Qnil;
@@ -270,8 +261,7 @@ DEFUN ("atom", Fatom, Satom, 1, 1, 0,
 DEFUN ("listp", Flistp, Slistp, 1, 1, 0,
        doc: /* Return t if OBJECT is a list, that is, a cons cell or nil.
 Otherwise, return nil.  */)
-     (object)
-     Lisp_Object object;
+  (Lisp_Object object)
 {
   if (CONSP (object) || NILP (object))
     return Qt;
@@ -280,8 +270,7 @@ Otherwise, return nil.  */)
 
 DEFUN ("nlistp", Fnlistp, Snlistp, 1, 1, 0,
        doc: /* Return t if OBJECT is not a list.  Lists include nil.  */)
-     (object)
-     Lisp_Object object;
+  (Lisp_Object object)
 {
   if (CONSP (object) || NILP (object))
     return Qnil;
@@ -290,8 +279,7 @@ DEFUN ("nlistp", Fnlistp, Snlistp, 1, 1, 0,
 \f
 DEFUN ("symbolp", Fsymbolp, Ssymbolp, 1, 1, 0,
        doc: /* Return t if OBJECT is a symbol.  */)
-     (object)
-     Lisp_Object object;
+  (Lisp_Object object)
 {
   if (SYMBOLP (object))
     return Qt;
@@ -304,8 +292,7 @@ DEFUN ("keywordp", Fkeywordp, Skeywordp, 1, 1, 0,
        doc: /* Return t if OBJECT is a keyword.
 This means that it is a symbol with a print name beginning with `:'
 interned in the initial obarray.  */)
-     (object)
-     Lisp_Object object;
+  (Lisp_Object object)
 {
   if (SYMBOLP (object)
       && SREF (SYMBOL_NAME (object), 0) == ':'
@@ -316,8 +303,7 @@ interned in the initial obarray.  */)
 
 DEFUN ("vectorp", Fvectorp, Svectorp, 1, 1, 0,
        doc: /* Return t if OBJECT is a vector.  */)
-     (object)
-     Lisp_Object object;
+  (Lisp_Object object)
 {
   if (VECTORP (object))
     return Qt;
@@ -326,8 +312,7 @@ DEFUN ("vectorp", Fvectorp, Svectorp, 1, 1, 0,
 
 DEFUN ("stringp", Fstringp, Sstringp, 1, 1, 0,
        doc: /* Return t if OBJECT is a string.  */)
-     (object)
-     Lisp_Object object;
+  (Lisp_Object object)
 {
   if (STRINGP (object))
     return Qt;
@@ -337,8 +322,7 @@ DEFUN ("stringp", Fstringp, Sstringp, 1, 1, 0,
 DEFUN ("multibyte-string-p", Fmultibyte_string_p, Smultibyte_string_p,
        1, 1, 0,
        doc: /* Return t if OBJECT is a multibyte string.  */)
-     (object)
-     Lisp_Object object;
+  (Lisp_Object object)
 {
   if (STRINGP (object) && STRING_MULTIBYTE (object))
     return Qt;
@@ -347,8 +331,7 @@ DEFUN ("multibyte-string-p", Fmultibyte_string_p, Smultibyte_string_p,
 
 DEFUN ("char-table-p", Fchar_table_p, Schar_table_p, 1, 1, 0,
        doc: /* Return t if OBJECT is a char-table.  */)
-     (object)
-     Lisp_Object object;
+  (Lisp_Object object)
 {
   if (CHAR_TABLE_P (object))
     return Qt;
@@ -358,8 +341,7 @@ DEFUN ("char-table-p", Fchar_table_p, Schar_table_p, 1, 1, 0,
 DEFUN ("vector-or-char-table-p", Fvector_or_char_table_p,
        Svector_or_char_table_p, 1, 1, 0,
        doc: /* Return t if OBJECT is a char-table or vector.  */)
-     (object)
-     Lisp_Object object;
+  (Lisp_Object object)
 {
   if (VECTORP (object) || CHAR_TABLE_P (object))
     return Qt;
@@ -368,8 +350,7 @@ DEFUN ("vector-or-char-table-p", Fvector_or_char_table_p,
 
 DEFUN ("bool-vector-p", Fbool_vector_p, Sbool_vector_p, 1, 1, 0,
        doc: /* Return t if OBJECT is a bool-vector.  */)
-     (object)
-     Lisp_Object object;
+  (Lisp_Object object)
 {
   if (BOOL_VECTOR_P (object))
     return Qt;
@@ -378,8 +359,7 @@ DEFUN ("bool-vector-p", Fbool_vector_p, Sbool_vector_p, 1, 1, 0,
 
 DEFUN ("arrayp", Farrayp, Sarrayp, 1, 1, 0,
        doc: /* Return t if OBJECT is an array (string or vector).  */)
-     (object)
-     Lisp_Object object;
+  (Lisp_Object object)
 {
   if (ARRAYP (object))
     return Qt;
@@ -388,8 +368,7 @@ DEFUN ("arrayp", Farrayp, Sarrayp, 1, 1, 0,
 
 DEFUN ("sequencep", Fsequencep, Ssequencep, 1, 1, 0,
        doc: /* Return t if OBJECT is a sequence (list or array).  */)
-     (object)
-     register Lisp_Object object;
+  (register Lisp_Object object)
 {
   if (CONSP (object) || NILP (object) || ARRAYP (object))
     return Qt;
@@ -398,8 +377,7 @@ DEFUN ("sequencep", Fsequencep, Ssequencep, 1, 1, 0,
 
 DEFUN ("bufferp", Fbufferp, Sbufferp, 1, 1, 0,
        doc: /* Return t if OBJECT is an editor buffer.  */)
-     (object)
-     Lisp_Object object;
+  (Lisp_Object object)
 {
   if (BUFFERP (object))
     return Qt;
@@ -408,8 +386,7 @@ DEFUN ("bufferp", Fbufferp, Sbufferp, 1, 1, 0,
 
 DEFUN ("markerp", Fmarkerp, Smarkerp, 1, 1, 0,
        doc: /* Return t if OBJECT is a marker (editor pointer).  */)
-     (object)
-     Lisp_Object object;
+  (Lisp_Object object)
 {
   if (MARKERP (object))
     return Qt;
@@ -418,8 +395,7 @@ DEFUN ("markerp", Fmarkerp, Smarkerp, 1, 1, 0,
 
 DEFUN ("subrp", Fsubrp, Ssubrp, 1, 1, 0,
        doc: /* Return t if OBJECT is a built-in function.  */)
-     (object)
-     Lisp_Object object;
+  (Lisp_Object object)
 {
   if (SUBRP (object))
     return Qt;
@@ -429,8 +405,7 @@ DEFUN ("subrp", Fsubrp, Ssubrp, 1, 1, 0,
 DEFUN ("byte-code-function-p", Fbyte_code_function_p, Sbyte_code_function_p,
        1, 1, 0,
        doc: /* Return t if OBJECT is a byte-compiled function object.  */)
-     (object)
-     Lisp_Object object;
+  (Lisp_Object object)
 {
   if (COMPILEDP (object))
     return Qt;
@@ -439,8 +414,7 @@ DEFUN ("byte-code-function-p", Fbyte_code_function_p, Sbyte_code_function_p,
 
 DEFUN ("char-or-string-p", Fchar_or_string_p, Schar_or_string_p, 1, 1, 0,
        doc: /* Return t if OBJECT is a character or a string.  */)
-     (object)
-     register Lisp_Object object;
+  (register Lisp_Object object)
 {
   if (CHARACTERP (object) || STRINGP (object))
     return Qt;
@@ -449,8 +423,7 @@ DEFUN ("char-or-string-p", Fchar_or_string_p, Schar_or_string_p, 1, 1, 0,
 \f
 DEFUN ("integerp", Fintegerp, Sintegerp, 1, 1, 0,
        doc: /* Return t if OBJECT is an integer.  */)
-     (object)
-     Lisp_Object object;
+  (Lisp_Object object)
 {
   if (INTEGERP (object))
     return Qt;
@@ -459,8 +432,7 @@ DEFUN ("integerp", Fintegerp, Sintegerp, 1, 1, 0,
 
 DEFUN ("integer-or-marker-p", Finteger_or_marker_p, Sinteger_or_marker_p, 1, 1, 0,
        doc: /* Return t if OBJECT is an integer or a marker (editor pointer).  */)
-     (object)
-     register Lisp_Object object;
+  (register Lisp_Object object)
 {
   if (MARKERP (object) || INTEGERP (object))
     return Qt;
@@ -469,8 +441,7 @@ DEFUN ("integer-or-marker-p", Finteger_or_marker_p, Sinteger_or_marker_p, 1, 1,
 
 DEFUN ("natnump", Fnatnump, Snatnump, 1, 1, 0,
        doc: /* Return t if OBJECT is a nonnegative integer.  */)
-     (object)
-     Lisp_Object object;
+  (Lisp_Object object)
 {
   if (NATNUMP (object))
     return Qt;
@@ -479,8 +450,7 @@ DEFUN ("natnump", Fnatnump, Snatnump, 1, 1, 0,
 
 DEFUN ("numberp", Fnumberp, Snumberp, 1, 1, 0,
        doc: /* Return t if OBJECT is a number (floating point or integer).  */)
-     (object)
-     Lisp_Object object;
+  (Lisp_Object object)
 {
   if (NUMBERP (object))
     return Qt;
@@ -491,8 +461,7 @@ DEFUN ("numberp", Fnumberp, Snumberp, 1, 1, 0,
 DEFUN ("number-or-marker-p", Fnumber_or_marker_p,
        Snumber_or_marker_p, 1, 1, 0,
        doc: /* Return t if OBJECT is a number or a marker.  */)
-     (object)
-     Lisp_Object object;
+  (Lisp_Object object)
 {
   if (NUMBERP (object) || MARKERP (object))
     return Qt;
@@ -501,8 +470,7 @@ DEFUN ("number-or-marker-p", Fnumber_or_marker_p,
 
 DEFUN ("floatp", Ffloatp, Sfloatp, 1, 1, 0,
        doc: /* Return t if OBJECT is a floating point number.  */)
-     (object)
-     Lisp_Object object;
+  (Lisp_Object object)
 {
   if (FLOATP (object))
     return Qt;
@@ -518,16 +486,14 @@ Error if arg is not nil and not a cons cell.  See also `car-safe'.
 
 See Info node `(elisp)Cons Cells' for a discussion of related basic
 Lisp concepts such as car, cdr, cons cell and list.  */)
-     (list)
-     register Lisp_Object list;
+  (register Lisp_Object list)
 {
   return CAR (list);
 }
 
 DEFUN ("car-safe", Fcar_safe, Scar_safe, 1, 1, 0,
        doc: /* Return the car of OBJECT if it is a cons cell, or else nil.  */)
-     (object)
-     Lisp_Object object;
+  (Lisp_Object object)
 {
   return CAR_SAFE (object);
 }
@@ -538,24 +504,21 @@ Error if arg is not nil and not a cons cell.  See also `cdr-safe'.
 
 See Info node `(elisp)Cons Cells' for a discussion of related basic
 Lisp concepts such as cdr, car, cons cell and list.  */)
-     (list)
-     register Lisp_Object list;
+  (register Lisp_Object list)
 {
   return CDR (list);
 }
 
 DEFUN ("cdr-safe", Fcdr_safe, Scdr_safe, 1, 1, 0,
        doc: /* Return the cdr of OBJECT if it is a cons cell, or else nil.  */)
-     (object)
-     Lisp_Object object;
+  (Lisp_Object object)
 {
   return CDR_SAFE (object);
 }
 
 DEFUN ("setcar", Fsetcar, Ssetcar, 2, 2, 0,
        doc: /* Set the car of CELL to be NEWCAR.  Returns NEWCAR.  */)
-     (cell, newcar)
-     register Lisp_Object cell, newcar;
+  (register Lisp_Object cell, Lisp_Object newcar)
 {
   CHECK_CONS (cell);
   CHECK_IMPURE (cell);
@@ -565,8 +528,7 @@ DEFUN ("setcar", Fsetcar, Ssetcar, 2, 2, 0,
 
 DEFUN ("setcdr", Fsetcdr, Ssetcdr, 2, 2, 0,
        doc: /* Set the cdr of CELL to be NEWCDR.  Returns NEWCDR.  */)
-     (cell, newcdr)
-     register Lisp_Object cell, newcdr;
+  (register Lisp_Object cell, Lisp_Object newcdr)
 {
   CHECK_CONS (cell);
   CHECK_IMPURE (cell);
@@ -578,24 +540,45 @@ DEFUN ("setcdr", Fsetcdr, Ssetcdr, 2, 2, 0,
 
 DEFUN ("boundp", Fboundp, Sboundp, 1, 1, 0,
        doc: /* Return t if SYMBOL's value is not void.  */)
-     (symbol)
-     register Lisp_Object symbol;
+  (register Lisp_Object symbol)
 {
   Lisp_Object valcontents;
+  struct Lisp_Symbol *sym;
   CHECK_SYMBOL (symbol);
+  sym = XSYMBOL (symbol);
 
-  valcontents = SYMBOL_VALUE (symbol);
-
-  if (BUFFER_LOCAL_VALUEP (valcontents))
-    valcontents = swap_in_symval_forwarding (symbol, valcontents);
+ start:
+  switch (sym->redirect)
+    {
+    case SYMBOL_PLAINVAL: valcontents = SYMBOL_VAL (sym); break;
+    case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start;
+    case SYMBOL_LOCALIZED:
+      {
+       struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym);
+       if (blv->fwd)
+         /* In set_internal, we un-forward vars when their value is
+            set to Qunbound. */
+         return Qt;
+       else
+         {
+           swap_in_symval_forwarding (sym, blv);
+           valcontents = BLV_VALUE (blv);
+         }
+       break;
+      }
+    case SYMBOL_FORWARDED:
+      /* In set_internal, we un-forward vars when their value is
+        set to Qunbound. */
+      return Qt;
+    default: abort ();
+    }
 
   return (EQ (valcontents, Qunbound) ? Qnil : Qt);
 }
 
 DEFUN ("fboundp", Ffboundp, Sfboundp, 1, 1, 0,
        doc: /* Return t if SYMBOL's function definition is not void.  */)
-     (symbol)
-     register Lisp_Object symbol;
+  (register Lisp_Object symbol)
 {
   CHECK_SYMBOL (symbol);
   return (EQ (XSYMBOL (symbol)->function, Qunbound) ? Qnil : Qt);
@@ -604,8 +587,7 @@ DEFUN ("fboundp", Ffboundp, Sfboundp, 1, 1, 0,
 DEFUN ("makunbound", Fmakunbound, Smakunbound, 1, 1, 0,
        doc: /* Make SYMBOL's value be void.
 Return SYMBOL.  */)
-     (symbol)
-     register Lisp_Object symbol;
+  (register Lisp_Object symbol)
 {
   CHECK_SYMBOL (symbol);
   if (SYMBOL_CONSTANT_P (symbol))
@@ -617,8 +599,7 @@ Return SYMBOL.  */)
 DEFUN ("fmakunbound", Ffmakunbound, Sfmakunbound, 1, 1, 0,
        doc: /* Make SYMBOL's function definition be void.
 Return SYMBOL.  */)
-     (symbol)
-     register Lisp_Object symbol;
+  (register Lisp_Object symbol)
 {
   CHECK_SYMBOL (symbol);
   if (NILP (symbol) || EQ (symbol, Qt))
@@ -629,8 +610,7 @@ Return SYMBOL.  */)
 
 DEFUN ("symbol-function", Fsymbol_function, Ssymbol_function, 1, 1, 0,
        doc: /* Return SYMBOL's function definition.  Error if that is void.  */)
-     (symbol)
-     register Lisp_Object symbol;
+  (register Lisp_Object symbol)
 {
   CHECK_SYMBOL (symbol);
   if (!EQ (XSYMBOL (symbol)->function, Qunbound))
@@ -640,8 +620,7 @@ DEFUN ("symbol-function", Fsymbol_function, Ssymbol_function, 1, 1, 0,
 
 DEFUN ("symbol-plist", Fsymbol_plist, Ssymbol_plist, 1, 1, 0,
        doc: /* Return SYMBOL's property list.  */)
-     (symbol)
-     register Lisp_Object symbol;
+  (register Lisp_Object symbol)
 {
   CHECK_SYMBOL (symbol);
   return XSYMBOL (symbol)->plist;
@@ -649,8 +628,7 @@ DEFUN ("symbol-plist", Fsymbol_plist, Ssymbol_plist, 1, 1, 0,
 
 DEFUN ("symbol-name", Fsymbol_name, Ssymbol_name, 1, 1, 0,
        doc: /* Return SYMBOL's name, a string.  */)
-     (symbol)
-     register Lisp_Object symbol;
+  (register Lisp_Object symbol)
 {
   register Lisp_Object name;
 
@@ -661,8 +639,7 @@ DEFUN ("symbol-name", Fsymbol_name, Ssymbol_name, 1, 1, 0,
 
 DEFUN ("fset", Ffset, Sfset, 2, 2, 0,
        doc: /* Set SYMBOL's function definition to DEFINITION, and return DEFINITION.  */)
-     (symbol, definition)
-     register Lisp_Object symbol, definition;
+  (register Lisp_Object symbol, Lisp_Object definition)
 {
   register Lisp_Object function;
 
@@ -688,16 +665,13 @@ DEFUN ("fset", Ffset, Sfset, 2, 2, 0,
   return definition;
 }
 
-extern Lisp_Object Qfunction_documentation;
-
 DEFUN ("defalias", Fdefalias, Sdefalias, 2, 3, 0,
        doc: /* Set SYMBOL's function definition to DEFINITION, and return 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.  */)
-     (symbol, definition, docstring)
-     register Lisp_Object symbol, definition, docstring;
+  (register Lisp_Object symbol, Lisp_Object definition, Lisp_Object docstring)
 {
   CHECK_SYMBOL (symbol);
   if (CONSP (XSYMBOL (symbol)->function)
@@ -712,8 +686,7 @@ determined by DEFINITION.  */)
 
 DEFUN ("setplist", Fsetplist, Ssetplist, 2, 2, 0,
        doc: /* Set SYMBOL's property list to NEWPLIST, and return NEWPLIST.  */)
-     (symbol, newplist)
-     register Lisp_Object symbol, newplist;
+  (register Lisp_Object symbol, Lisp_Object newplist)
 {
   CHECK_SYMBOL (symbol);
   XSYMBOL (symbol)->plist = newplist;
@@ -726,8 +699,7 @@ SUBR must be a built-in function.
 The returned value is a pair (MIN . MAX).  MIN is the minimum number
 of args.  MAX is the maximum number or the symbol `many', for a
 function with `&rest' args, or `unevalled' for a special form.  */)
-     (subr)
-     Lisp_Object subr;
+  (Lisp_Object subr)
 {
   short minargs, maxargs;
   CHECK_SUBR (subr);
@@ -744,8 +716,7 @@ function with `&rest' args, or `unevalled' for a special form.  */)
 DEFUN ("subr-name", Fsubr_name, Ssubr_name, 1, 1, 0,
        doc: /* Return name of subroutine SUBR.
 SUBR must be a built-in function.  */)
-     (subr)
-     Lisp_Object subr;
+  (Lisp_Object subr)
 {
   const char *name;
   CHECK_SUBR (subr);
@@ -757,8 +728,7 @@ DEFUN ("interactive-form", Finteractive_form, Sinteractive_form, 1, 1, 0,
        doc: /* Return the interactive form of CMD or nil if none.
 If CMD is not a command, the return value is nil.
 Value, if non-nil, is a list \(interactive SPEC).  */)
-     (cmd)
-     Lisp_Object cmd;
+  (Lisp_Object cmd)
 {
   Lisp_Object fun = indirect_function (cmd); /* Check cycles.  */
 
@@ -779,7 +749,7 @@ Value, if non-nil, is a list \(interactive SPEC).  */)
 
   if (SUBRP (fun))
     {
-      char *spec = XSUBR (fun)->intspec;
+      const char *spec = XSUBR (fun)->intspec;
       if (spec)
        return list2 (Qinteractive,
                      (*spec != '(') ? build_string (spec) :
@@ -817,21 +787,20 @@ Value, if non-nil, is a list \(interactive SPEC).  */)
    indirections contains a loop.  */
 
 struct Lisp_Symbol *
-indirect_variable (symbol)
-     struct Lisp_Symbol *symbol;
+indirect_variable (struct Lisp_Symbol *symbol)
 {
   struct Lisp_Symbol *tortoise, *hare;
 
   hare = tortoise = symbol;
 
-  while (hare->indirect_variable)
+  while (hare->redirect == SYMBOL_VARALIAS)
     {
-      hare = XSYMBOL (hare->value);
-      if (!hare->indirect_variable)
+      hare = SYMBOL_ALIAS (hare);
+      if (hare->redirect != SYMBOL_VARALIAS)
        break;
 
-      hare = XSYMBOL (hare->value);
-      tortoise = XSYMBOL (tortoise->value);
+      hare = SYMBOL_ALIAS (hare);
+      tortoise = SYMBOL_ALIAS (tortoise);
 
       if (hare == tortoise)
        {
@@ -851,8 +820,7 @@ If OBJECT is a symbol, follow all variable indirections and return the final
 variable.  If OBJECT is not a symbol, just return it.
 Signal a cyclic-variable-indirection error if there is a loop in the
 variable chain of symbols.  */)
-     (object)
-     Lisp_Object object;
+  (Lisp_Object object)
 {
   if (SYMBOLP (object))
     XSETSYMBOL (object,  indirect_variable (XSYMBOL (object)));
@@ -865,44 +833,45 @@ variable chain of symbols.  */)
    This does not handle buffer-local variables; use
    swap_in_symval_forwarding for that.  */
 
+#define do_blv_forwarding(blv) \
+  ((blv)->forwarded ? do_symval_forwarding (BLV_FWD (blv)) : BLV_VALUE (blv))
+
 Lisp_Object
-do_symval_forwarding (valcontents)
-     register Lisp_Object valcontents;
+do_symval_forwarding (register union Lisp_Fwd *valcontents)
 {
   register Lisp_Object val;
-  if (MISCP (valcontents))
-    switch (XMISCTYPE (valcontents))
-      {
-      case Lisp_Misc_Intfwd:
-       XSETINT (val, *XINTFWD (valcontents)->intvar);
-       return val;
-
-      case Lisp_Misc_Boolfwd:
-       return (*XBOOLFWD (valcontents)->boolvar ? Qt : Qnil);
-
-      case Lisp_Misc_Objfwd:
-       return *XOBJFWD (valcontents)->objvar;
-
-      case Lisp_Misc_Buffer_Objfwd:
-       return PER_BUFFER_VALUE (current_buffer,
-                                XBUFFER_OBJFWD (valcontents)->offset);
-
-      case Lisp_Misc_Kboard_Objfwd:
-        /* We used to simply use current_kboard here, but from Lisp
-           code, it's value is often unexpected.  It seems nicer to
-           allow constructions like this to work as intuitively expected:
-
-               (with-selected-frame frame
-                   (define-key local-function-map "\eOP" [f1]))
-
-           On the other hand, this affects the semantics of
-           last-command and real-last-command, and people may rely on
-           that.  I took a quick look at the Lisp codebase, and I
-           don't think anything will break.  --lorentey  */
-       return *(Lisp_Object *)(XKBOARD_OBJFWD (valcontents)->offset
-                               + (char *)FRAME_KBOARD (SELECTED_FRAME ()));
-      }
-  return valcontents;
+  switch (XFWDTYPE (valcontents))
+    {
+    case Lisp_Fwd_Int:
+      XSETINT (val, *XINTFWD (valcontents)->intvar);
+      return val;
+
+    case Lisp_Fwd_Bool:
+      return (*XBOOLFWD (valcontents)->boolvar ? Qt : Qnil);
+
+    case Lisp_Fwd_Obj:
+      return *XOBJFWD (valcontents)->objvar;
+
+    case Lisp_Fwd_Buffer_Obj:
+      return PER_BUFFER_VALUE (current_buffer,
+                              XBUFFER_OBJFWD (valcontents)->offset);
+
+    case Lisp_Fwd_Kboard_Obj:
+      /* We used to simply use current_kboard here, but from Lisp
+        code, it's value is often unexpected.  It seems nicer to
+        allow constructions like this to work as intuitively expected:
+
+        (with-selected-frame frame
+        (define-key local-function-map "\eOP" [f1]))
+
+        On the other hand, this affects the semantics of
+        last-command and real-last-command, and people may rely on
+        that.  I took a quick look at the Lisp codebase, and I
+        don't think anything will break.  --lorentey  */
+      return *(Lisp_Object *)(XKBOARD_OBJFWD (valcontents)->offset
+                             + (char *)FRAME_KBOARD (SELECTED_FRAME ()));
+    default: abort ();
+    }
 }
 
 /* Store NEWVAL into SYMBOL, where VALCONTENTS is found in the value cell
@@ -913,102 +882,89 @@ do_symval_forwarding (valcontents)
    BUF non-zero means set the value in buffer BUF instead of the
    current buffer.  This only plays a role for per-buffer variables.  */
 
-void
-store_symval_forwarding (symbol, valcontents, newval, buf)
-     Lisp_Object symbol;
-     register Lisp_Object valcontents, newval;
-     struct buffer *buf;
+#define store_blv_forwarding(blv, newval, buf)                 \
+  do {                                                         \
+    if ((blv)->forwarded)                                      \
+      store_symval_forwarding (BLV_FWD (blv), (newval), (buf));        \
+    else                                                       \
+      SET_BLV_VALUE (blv, newval);                             \
+  } while (0)
+
+static void
+store_symval_forwarding (union Lisp_Fwd *valcontents, register Lisp_Object newval, struct buffer *buf)
 {
-  switch (SWITCH_ENUM_CAST (XTYPE (valcontents)))
+  switch (XFWDTYPE (valcontents))
     {
-    case Lisp_Misc:
-      switch (XMISCTYPE (valcontents))
-       {
-       case Lisp_Misc_Intfwd:
-         CHECK_NUMBER (newval);
-         *XINTFWD (valcontents)->intvar = XINT (newval);
-         /* This can never happen since intvar points to an EMACS_INT
-            which is at least large enough to hold a Lisp_Object.
-             if (*XINTFWD (valcontents)->intvar != XINT (newval))
-              error ("Value out of range for variable `%s'",
-                  SDATA (SYMBOL_NAME (symbol))); */
-         break;
+    case Lisp_Fwd_Int:
+      CHECK_NUMBER (newval);
+      *XINTFWD (valcontents)->intvar = XINT (newval);
+      break;
 
-       case Lisp_Misc_Boolfwd:
-         *XBOOLFWD (valcontents)->boolvar = !NILP (newval);
-         break;
+    case Lisp_Fwd_Bool:
+      *XBOOLFWD (valcontents)->boolvar = !NILP (newval);
+      break;
 
-       case Lisp_Misc_Objfwd:
-         *XOBJFWD (valcontents)->objvar = newval;
+    case Lisp_Fwd_Obj:
+      *XOBJFWD (valcontents)->objvar = newval;
 
-         /* If this variable is a default for something stored
-            in the buffer itself, such as default-fill-column,
-            find the buffers that don't have local values for it
-            and update them.  */
-         if (XOBJFWD (valcontents)->objvar > (Lisp_Object *) &buffer_defaults
-             && XOBJFWD (valcontents)->objvar < (Lisp_Object *) (&buffer_defaults + 1))
-           {
-             int offset = ((char *) XOBJFWD (valcontents)->objvar
-                           - (char *) &buffer_defaults);
-             int idx = PER_BUFFER_IDX (offset);
+      /* If this variable is a default for something stored
+        in the buffer itself, such as default-fill-column,
+        find the buffers that don't have local values for it
+        and update them.  */
+      if (XOBJFWD (valcontents)->objvar > (Lisp_Object *) &buffer_defaults
+         && XOBJFWD (valcontents)->objvar < (Lisp_Object *) (&buffer_defaults + 1))
+       {
+         int offset = ((char *) XOBJFWD (valcontents)->objvar
+                       - (char *) &buffer_defaults);
+         int idx = PER_BUFFER_IDX (offset);
 
-             Lisp_Object tail;
+         Lisp_Object tail;
 
-             if (idx <= 0)
-               break;
+         if (idx <= 0)
+           break;
 
-             for (tail = Vbuffer_alist; CONSP (tail); tail = XCDR (tail))
-               {
-                 Lisp_Object buf;
-                 struct buffer *b;
+         for (tail = Vbuffer_alist; CONSP (tail); tail = XCDR (tail))
+           {
+             Lisp_Object buf;
+             struct buffer *b;
 
-                 buf = Fcdr (XCAR (tail));
-                 if (!BUFFERP (buf)) continue;
-                 b = XBUFFER (buf);
+             buf = Fcdr (XCAR (tail));
+             if (!BUFFERP (buf)) continue;
+             b = XBUFFER (buf);
 
-                 if (! PER_BUFFER_VALUE_P (b, idx))
-                   PER_BUFFER_VALUE (b, offset) = newval;
-               }
+             if (! PER_BUFFER_VALUE_P (b, idx))
+               PER_BUFFER_VALUE (b, offset) = newval;
            }
-         break;
-
-       case Lisp_Misc_Buffer_Objfwd:
-         {
-           int offset = XBUFFER_OBJFWD (valcontents)->offset;
-           Lisp_Object type = XBUFFER_OBJFWD (valcontents)->slottype;
-
-           if (!(NILP (type) || NILP (newval)
-                 || (XINT (type) == LISP_INT_TAG
-                     ? INTEGERP (newval)
-                     : XTYPE (newval) == XINT (type))))
-             buffer_slot_type_mismatch (newval, XINT (type));
-
-           if (buf == NULL)
-             buf = current_buffer;
-           PER_BUFFER_VALUE (buf, offset) = newval;
-         }
-         break;
+       }
+      break;
 
-       case Lisp_Misc_Kboard_Objfwd:
-         {
-           char *base = (char *) FRAME_KBOARD (SELECTED_FRAME ());
-           char *p = base + XKBOARD_OBJFWD (valcontents)->offset;
-           *(Lisp_Object *) p = newval;
-         }
-         break;
+    case Lisp_Fwd_Buffer_Obj:
+      {
+       int offset = XBUFFER_OBJFWD (valcontents)->offset;
+       Lisp_Object type = XBUFFER_OBJFWD (valcontents)->slottype;
+
+       if (!(NILP (type) || NILP (newval)
+             || (XINT (type) == LISP_INT_TAG
+                 ? INTEGERP (newval)
+                 : XTYPE (newval) == XINT (type))))
+         buffer_slot_type_mismatch (newval, XINT (type));
+
+       if (buf == NULL)
+         buf = current_buffer;
+       PER_BUFFER_VALUE (buf, offset) = newval;
+      }
+      break;
 
-       default:
-         goto def;
-       }
+    case Lisp_Fwd_Kboard_Obj:
+      {
+       char *base = (char *) FRAME_KBOARD (SELECTED_FRAME ());
+       char *p = base + XKBOARD_OBJFWD (valcontents)->offset;
+       *(Lisp_Object *) p = newval;
+      }
       break;
 
     default:
-    def:
-      valcontents = SYMBOL_VALUE (symbol);
-      if (BUFFER_LOCAL_VALUEP (valcontents))
-       XBUFFER_LOCAL_VALUE (valcontents)->realvalue = newval;
-      else
-       SET_SYMBOL_VALUE (symbol, newval);
+      abort (); /* goto def; */
     }
 }
 
@@ -1016,26 +972,22 @@ store_symval_forwarding (symbol, valcontents, newval, buf)
    This makes it safe to alter the status of other bindings.  */
 
 void
-swap_in_global_binding (symbol)
-     Lisp_Object symbol;
+swap_in_global_binding (struct Lisp_Symbol *symbol)
 {
-  Lisp_Object valcontents = SYMBOL_VALUE (symbol);
-  struct Lisp_Buffer_Local_Value *blv = XBUFFER_LOCAL_VALUE (valcontents);
-  Lisp_Object cdr = blv->cdr;
+  struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (symbol);
 
   /* Unload the previously loaded binding.  */
-  Fsetcdr (XCAR (cdr),
-          do_symval_forwarding (blv->realvalue));
+  if (blv->fwd)
+    SET_BLV_VALUE (blv, do_symval_forwarding (blv->fwd));
 
   /* Select the global binding in the symbol.  */
-  XSETCAR (cdr, cdr);
-  store_symval_forwarding (symbol, blv->realvalue, XCDR (cdr), NULL);
+  blv->valcell = blv->defcell;
+  if (blv->fwd)
+    store_symval_forwarding (blv->fwd, XCDR (blv->defcell), NULL);
 
   /* Indicate that the global binding is set up now.  */
-  blv->frame = Qnil;
-  blv->buffer = Qnil;
-  blv->found_for_frame = 0;
-  blv->found_for_buffer = 0;
+  blv->where = Qnil;
+  SET_BLV_FOUND (blv, 0);
 }
 
 /* Set up the buffer-local symbol SYMBOL for validity in the current buffer.
@@ -1045,55 +997,48 @@ swap_in_global_binding (symbol)
    Return the value forwarded one step past the buffer-local stage.
    This could be another forwarding pointer.  */
 
-static Lisp_Object
-swap_in_symval_forwarding (symbol, valcontents)
-     Lisp_Object symbol, valcontents;
+static void
+swap_in_symval_forwarding (struct Lisp_Symbol *symbol, struct Lisp_Buffer_Local_Value *blv)
 {
   register Lisp_Object tem1;
 
-  tem1 = XBUFFER_LOCAL_VALUE (valcontents)->buffer;
+  eassert (blv == SYMBOL_BLV (symbol));
+
+  tem1 = blv->where;
 
   if (NILP (tem1)
-      || current_buffer != XBUFFER (tem1)
-      || (XBUFFER_LOCAL_VALUE (valcontents)->check_frame
-         && ! EQ (selected_frame, XBUFFER_LOCAL_VALUE (valcontents)->frame)))
+      || (blv->frame_local
+         ? !EQ (selected_frame, tem1)
+         : current_buffer != XBUFFER (tem1)))
     {
-      struct Lisp_Symbol *sym = XSYMBOL (symbol);
-      if (sym->indirect_variable)
-       {
-         sym = indirect_variable (sym);
-         XSETSYMBOL (symbol, sym);
-       }
 
       /* Unload the previously loaded binding.  */
-      tem1 = XCAR (XBUFFER_LOCAL_VALUE (valcontents)->cdr);
-      Fsetcdr (tem1,
-              do_symval_forwarding (XBUFFER_LOCAL_VALUE (valcontents)->realvalue));
+      tem1 = blv->valcell;
+      if (blv->fwd)
+       SET_BLV_VALUE (blv, do_symval_forwarding (blv->fwd));
       /* Choose the new binding.  */
-      tem1 = assq_no_quit (symbol, current_buffer->local_var_alist);
-      XBUFFER_LOCAL_VALUE (valcontents)->found_for_frame = 0;
-      XBUFFER_LOCAL_VALUE (valcontents)->found_for_buffer = 0;
-      if (NILP (tem1))
-       {
-         if (XBUFFER_LOCAL_VALUE (valcontents)->check_frame)
-           tem1 = assq_no_quit (symbol, XFRAME (selected_frame)->param_alist);
-         if (! NILP (tem1))
-           XBUFFER_LOCAL_VALUE (valcontents)->found_for_frame = 1;
-         else
-           tem1 = XBUFFER_LOCAL_VALUE (valcontents)->cdr;
-       }
-      else
-       XBUFFER_LOCAL_VALUE (valcontents)->found_for_buffer = 1;
+      {
+       Lisp_Object var;
+       XSETSYMBOL (var, symbol);
+       if (blv->frame_local)
+         {
+           tem1 = assq_no_quit (var, XFRAME (selected_frame)->param_alist);
+           blv->where = selected_frame;
+         }
+       else
+         {
+           tem1 = assq_no_quit (var, current_buffer->local_var_alist);
+           XSETBUFFER (blv->where, current_buffer);
+         }
+      }
+      if (!(blv->found = !NILP (tem1)))
+       tem1 = blv->defcell;
 
       /* Load the new binding.  */
-      XSETCAR (XBUFFER_LOCAL_VALUE (valcontents)->cdr, tem1);
-      XSETBUFFER (XBUFFER_LOCAL_VALUE (valcontents)->buffer, current_buffer);
-      XBUFFER_LOCAL_VALUE (valcontents)->frame = selected_frame;
-      store_symval_forwarding (symbol,
-                              XBUFFER_LOCAL_VALUE (valcontents)->realvalue,
-                              Fcdr (tem1), NULL);
+      blv->valcell = tem1;
+      if (blv->fwd)
+       store_symval_forwarding (blv->fwd, BLV_VALUE (blv), NULL);
     }
-  return XBUFFER_LOCAL_VALUE (valcontents)->realvalue;
 }
 \f
 /* Find the value of a symbol, returning Qunbound if it's not bound.
@@ -1103,25 +1048,34 @@ swap_in_symval_forwarding (symbol, valcontents)
    within this function.  Great care is required for this.  */
 
 Lisp_Object
-find_symbol_value (symbol)
-     Lisp_Object symbol;
+find_symbol_value (Lisp_Object symbol)
 {
-  register Lisp_Object valcontents;
-  register Lisp_Object val;
+  struct Lisp_Symbol *sym;
 
   CHECK_SYMBOL (symbol);
-  valcontents = SYMBOL_VALUE (symbol);
+  sym = XSYMBOL (symbol);
 
-  if (BUFFER_LOCAL_VALUEP (valcontents))
-    valcontents = swap_in_symval_forwarding (symbol, valcontents);
-
-  return do_symval_forwarding (valcontents);
+ start:
+  switch (sym->redirect)
+    {
+    case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start;
+    case SYMBOL_PLAINVAL: return SYMBOL_VAL (sym);
+    case SYMBOL_LOCALIZED:
+      {
+       struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym);
+       swap_in_symval_forwarding (sym, blv);
+       return blv->fwd ? do_symval_forwarding (blv->fwd) : BLV_VALUE (blv);
+      }
+      /* FALLTHROUGH */
+    case SYMBOL_FORWARDED:
+      return do_symval_forwarding (SYMBOL_FWD (sym));
+    default: abort ();
+    }
 }
 
 DEFUN ("symbol-value", Fsymbol_value, Ssymbol_value, 1, 1, 0,
        doc: /* Return SYMBOL's value.  Error if that is void.  */)
-     (symbol)
-     Lisp_Object symbol;
+  (Lisp_Object symbol)
 {
   Lisp_Object val;
 
@@ -1134,29 +1088,27 @@ DEFUN ("symbol-value", Fsymbol_value, Ssymbol_value, 1, 1, 0,
 
 DEFUN ("set", Fset, Sset, 2, 2, 0,
        doc: /* Set SYMBOL's value to NEWVAL, and return NEWVAL.  */)
-     (symbol, newval)
-     register Lisp_Object symbol, newval;
+  (register Lisp_Object symbol, Lisp_Object newval)
 {
-  return set_internal (symbol, newval, current_buffer, 0);
+  set_internal (symbol, newval, Qnil, 0);
+  return newval;
 }
 
 /* Return 1 if SYMBOL currently has a let-binding
    which was made in the buffer that is now current.  */
 
 static int
-let_shadows_buffer_binding_p (symbol)
-     struct Lisp_Symbol *symbol;
+let_shadows_buffer_binding_p (struct Lisp_Symbol *symbol)
 {
-  volatile struct specbinding *p;
+  struct specbinding *p;
 
   for (p = specpdl_ptr - 1; p >= specpdl; p--)
     if (p->func == NULL
        && CONSP (p->symbol))
       {
        struct Lisp_Symbol *let_bound_symbol = XSYMBOL (XCAR (p->symbol));
-       if ((symbol == let_bound_symbol
-            || (let_bound_symbol->indirect_variable
-                && symbol == indirect_variable (let_bound_symbol)))
+       eassert (let_bound_symbol->redirect != SYMBOL_VARALIAS);
+       if (symbol == let_bound_symbol
            && XBUFFER (XCDR (XCDR (p->symbol))) == current_buffer)
          break;
       }
@@ -1164,141 +1116,170 @@ let_shadows_buffer_binding_p (symbol)
   return p >= specpdl;
 }
 
+static int
+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;
+
+  return p >= specpdl;
+}
+
 /* Store the value NEWVAL into SYMBOL.
-   If buffer-locality is an issue, BUF specifies which buffer to use.
-   (0 stands for the current buffer.)
+   If buffer/frame-locality is an issue, WHERE specifies which context to use.
+   (nil stands for the current buffer/frame).
 
    If BINDFLAG is zero, then if this symbol is supposed to become
    local in every buffer where it is set, then we make it local.
    If BINDFLAG is nonzero, we don't do that.  */
 
-Lisp_Object
-set_internal (symbol, newval, buf, bindflag)
-     register Lisp_Object symbol, newval;
-     struct buffer *buf;
-     int bindflag;
+void
+set_internal (register Lisp_Object symbol, register Lisp_Object newval, register Lisp_Object where, int bindflag)
 {
   int voide = EQ (newval, Qunbound);
-
-  register Lisp_Object valcontents, innercontents, tem1, current_alist_element;
-
-  if (buf == 0)
-    buf = current_buffer;
+  struct Lisp_Symbol *sym;
+  Lisp_Object tem1;
 
   /* If restoring in a dead buffer, do nothing.  */
-  if (NILP (buf->name))
-    return newval;
+  /* if (BUFFERP (where) && NILP (XBUFFER (where)->name))
+      return; */
 
   CHECK_SYMBOL (symbol);
-  if (SYMBOL_CONSTANT_P (symbol)
-      && (NILP (Fkeywordp (symbol))
-         || !EQ (newval, SYMBOL_VALUE (symbol))))
-    xsignal1 (Qsetting_constant, symbol);
-
-  innercontents = valcontents = SYMBOL_VALUE (symbol);
-
-  if (BUFFER_OBJFWDP (valcontents))
+  if (SYMBOL_CONSTANT_P (symbol))
     {
-      int offset = XBUFFER_OBJFWD (valcontents)->offset;
-      int idx = PER_BUFFER_IDX (offset);
-      if (idx > 0
-         && !bindflag
-         && !let_shadows_buffer_binding_p (XSYMBOL (symbol)))
-       SET_PER_BUFFER_VALUE_P (buf, idx, 1);
+      if (NILP (Fkeywordp (symbol))
+         || !EQ (newval, Fsymbol_value (symbol)))
+       xsignal1 (Qsetting_constant, symbol);
+      else
+       /* Allow setting keywords to their own value.  */
+       return;
     }
-  else if (BUFFER_LOCAL_VALUEP (valcontents))
-    {
-      /* valcontents is a struct Lisp_Buffer_Local_Value.   */
-      if (XSYMBOL (symbol)->indirect_variable)
-       XSETSYMBOL (symbol, indirect_variable (XSYMBOL (symbol)));
-
-      /* What binding is loaded right now?  */
-      current_alist_element
-       = XCAR (XBUFFER_LOCAL_VALUE (valcontents)->cdr);
-
-      /* If the current buffer is not the buffer whose binding is
-        loaded, or if there may be frame-local bindings and the frame
-        isn't the right one, or if it's a Lisp_Buffer_Local_Value and
-        the default binding is loaded, the loaded binding may be the
-        wrong one.  */
-      if (!BUFFERP (XBUFFER_LOCAL_VALUE (valcontents)->buffer)
-         || buf != XBUFFER (XBUFFER_LOCAL_VALUE (valcontents)->buffer)
-         || (XBUFFER_LOCAL_VALUE (valcontents)->check_frame
-             && !EQ (selected_frame, XBUFFER_LOCAL_VALUE (valcontents)->frame))
-         /* Also unload a global binding (if the var is local_if_set). */
-         || (EQ (XCAR (current_alist_element),
-                 current_alist_element)))
-       {
-         /* The currently loaded binding is not necessarily valid.
-            We need to unload it, and choose a new binding.  */
 
-         /* Write out `realvalue' to the old loaded binding.  */
-          Fsetcdr (current_alist_element,
-                  do_symval_forwarding (XBUFFER_LOCAL_VALUE (valcontents)->realvalue));
+  sym = XSYMBOL (symbol);
 
-         /* Find the new binding.  */
-         tem1 = Fassq (symbol, buf->local_var_alist);
-         XBUFFER_LOCAL_VALUE (valcontents)->found_for_buffer = 1;
-         XBUFFER_LOCAL_VALUE (valcontents)->found_for_frame = 0;
-
-         if (NILP (tem1))
-           {
-             /* This buffer still sees the default value.  */
-
-             /* If the variable is not local_if_set,
-                or if this is `let' rather than `set',
-                make CURRENT-ALIST-ELEMENT point to itself,
-                indicating that we're seeing the default value.
-                Likewise if the variable has been let-bound
-                in the current buffer.  */
-             if (bindflag || !XBUFFER_LOCAL_VALUE (valcontents)->local_if_set
-                 || let_shadows_buffer_binding_p (XSYMBOL (symbol)))
-               {
-                 XBUFFER_LOCAL_VALUE (valcontents)->found_for_buffer = 0;
-
-                 if (XBUFFER_LOCAL_VALUE (valcontents)->check_frame)
-                   tem1 = Fassq (symbol,
-                                 XFRAME (selected_frame)->param_alist);
-
-                 if (! NILP (tem1))
-                   XBUFFER_LOCAL_VALUE (valcontents)->found_for_frame = 1;
-                 else
-                   tem1 = XBUFFER_LOCAL_VALUE (valcontents)->cdr;
-               }
-             /* If it's a Lisp_Buffer_Local_Value, being set not bound,
-                and we're not within a let that was made for this buffer,
-                create a new buffer-local binding for the variable.
-                That means, give this buffer a new assoc for a local value
-                and load that binding.  */
-             else
-               {
-                 tem1 = Fcons (symbol, XCDR (current_alist_element));
-                 buf->local_var_alist
-                   = Fcons (tem1, buf->local_var_alist);
-               }
-           }
+ start:
+  switch (sym->redirect)
+    {
+    case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start;
+    case SYMBOL_PLAINVAL: SET_SYMBOL_VAL (sym , newval); return;
+    case SYMBOL_LOCALIZED:
+      {
+       struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym);
+       if (NILP (where))
+         {
+           if (blv->frame_local)
+             where = selected_frame;
+           else
+             XSETBUFFER (where, current_buffer);
+         }
+       /* If the current buffer is not the buffer whose binding is
+          loaded, or if there may be frame-local bindings and the frame
+          isn't the right one, or if it's a Lisp_Buffer_Local_Value and
+          the default binding is loaded, the loaded binding may be the
+          wrong one.  */
+       if (!EQ (blv->where, where)
+           /* Also unload a global binding (if the var is local_if_set). */
+           || (EQ (blv->valcell, blv->defcell)))
+         {
+           /* The currently loaded binding is not necessarily valid.
+              We need to unload it, and choose a new binding.  */
+
+           /* Write out `realvalue' to the old loaded binding.  */
+           if (blv->fwd)
+             SET_BLV_VALUE (blv, do_symval_forwarding (blv->fwd));
+
+           /* Find the new binding.  */
+           XSETSYMBOL (symbol, sym); /* May have changed via aliasing.  */
+           tem1 = Fassq (symbol,
+                         (blv->frame_local
+                          ? XFRAME (where)->param_alist
+                          : XBUFFER (where)->local_var_alist));
+           blv->where = where;
+           blv->found = 1;
+
+           if (NILP (tem1))
+             {
+               /* This buffer still sees the default value.  */
+
+               /* If the variable is a Lisp_Some_Buffer_Local_Value,
+                  or if this is `let' rather than `set',
+                  make CURRENT-ALIST-ELEMENT point to itself,
+                  indicating that we're seeing the default value.
+                  Likewise if the variable has been let-bound
+                  in the current buffer.  */
+               if (bindflag || !blv->local_if_set
+                   || let_shadows_buffer_binding_p (sym))
+                 {
+                   blv->found = 0;
+                   tem1 = blv->defcell;
+                 }
+               /* If it's a local_if_set, being set not bound,
+                  and we're not within a let that was made for this buffer,
+                  create a new buffer-local binding for the variable.
+                  That means, give this buffer a new assoc for a local value
+                  and load that binding.  */
+               else
+                 {
+                   /* local_if_set is only supported for buffer-local
+                      bindings, not for frame-local bindings.  */
+                   eassert (!blv->frame_local);
+                   tem1 = Fcons (symbol, XCDR (blv->defcell));
+                   XBUFFER (where)->local_var_alist
+                     = Fcons (tem1, XBUFFER (where)->local_var_alist);
+                 }
+             }
+
+           /* Record which binding is now loaded.  */
+           blv->valcell = tem1;
+         }
 
-         /* Record which binding is now loaded.  */
-         XSETCAR (XBUFFER_LOCAL_VALUE (valcontents)->cdr, tem1);
+       /* Store the new value in the cons cell.  */
+       SET_BLV_VALUE (blv, newval);
 
-         /* Set `buffer' and `frame' slots for the binding now loaded.  */
-         XSETBUFFER (XBUFFER_LOCAL_VALUE (valcontents)->buffer, buf);
-         XBUFFER_LOCAL_VALUE (valcontents)->frame = selected_frame;
-       }
-      innercontents = XBUFFER_LOCAL_VALUE (valcontents)->realvalue;
+       if (blv->fwd)
+         {
+           if (voide)
+             /* If storing void (making the symbol void), forward only through
+                buffer-local indicator, not through Lisp_Objfwd, etc.  */
+             blv->fwd = NULL;
+           else
+             store_symval_forwarding (blv->fwd, newval,
+                                      BUFFERP (where)
+                                      ? XBUFFER (where) : current_buffer);
+         }
+       break;
+      }
+    case SYMBOL_FORWARDED:
+      {
+       struct buffer *buf
+         = BUFFERP (where) ? XBUFFER (where) : current_buffer;
+       union Lisp_Fwd *innercontents = SYMBOL_FWD (sym);
+       if (BUFFER_OBJFWDP (innercontents))
+         {
+           int offset = XBUFFER_OBJFWD (innercontents)->offset;
+           int idx = PER_BUFFER_IDX (offset);
+           if (idx > 0
+               && !bindflag
+               && !let_shadows_buffer_binding_p (sym))
+             SET_PER_BUFFER_VALUE_P (buf, idx, 1);
+         }
 
-      /* Store the new value in the cons-cell.  */
-      XSETCDR (XCAR (XBUFFER_LOCAL_VALUE (valcontents)->cdr), newval);
+       if (voide)
+         { /* If storing void (making the symbol void), forward only through
+              buffer-local indicator, not through Lisp_Objfwd, etc.  */
+           sym->redirect = SYMBOL_PLAINVAL;
+           SET_SYMBOL_VAL (sym, newval);
+         }
+       else
+         store_symval_forwarding (/* sym, */ innercontents, newval, buf);
+       break;
+      }
+    default: abort ();
     }
-
-  /* If storing void (making the symbol void), forward only through
-     buffer-local indicator, not through Lisp_Objfwd, etc.  */
-  if (voide)
-    store_symval_forwarding (symbol, Qnil, newval, buf);
-  else
-    store_symval_forwarding (symbol, innercontents, newval, buf);
-
-  return newval;
+  return;
 }
 \f
 /* Access or set a buffer-local symbol's default value.  */
@@ -1307,49 +1288,55 @@ set_internal (symbol, newval, buf, bindflag)
    Return Qunbound if it is void.  */
 
 Lisp_Object
-default_value (symbol)
-     Lisp_Object symbol;
+default_value (Lisp_Object symbol)
 {
-  register Lisp_Object valcontents;
+  struct Lisp_Symbol *sym;
 
   CHECK_SYMBOL (symbol);
-  valcontents = SYMBOL_VALUE (symbol);
+  sym = XSYMBOL (symbol);
 
-  /* For a built-in buffer-local variable, get the default value
-     rather than letting do_symval_forwarding get the current value.  */
-  if (BUFFER_OBJFWDP (valcontents))
+ start:
+  switch (sym->redirect)
     {
-      int offset = XBUFFER_OBJFWD (valcontents)->offset;
-      if (PER_BUFFER_IDX (offset) != 0)
-       return PER_BUFFER_DEFAULT (offset);
-    }
+    case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start;
+    case SYMBOL_PLAINVAL: return SYMBOL_VAL (sym);
+    case SYMBOL_LOCALIZED:
+      {
+       /* If var is set up for a buffer that lacks a local value for it,
+          the current value is nominally the default value.
+          But the `realvalue' slot may be more up to date, since
+          ordinary setq stores just that slot.  So use that.  */
+       struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym);
+       if (blv->fwd && EQ (blv->valcell, blv->defcell))
+         return do_symval_forwarding (blv->fwd);
+       else
+         return XCDR (blv->defcell);
+      }
+    case SYMBOL_FORWARDED:
+      {
+       union Lisp_Fwd *valcontents = SYMBOL_FWD (sym);
 
-  /* Handle user-created local variables.  */
-  if (BUFFER_LOCAL_VALUEP (valcontents))
-    {
-      /* If var is set up for a buffer that lacks a local value for it,
-        the current value is nominally the default value.
-        But the `realvalue' slot may be more up to date, since
-        ordinary setq stores just that slot.  So use that.  */
-      Lisp_Object current_alist_element, alist_element_car;
-      current_alist_element
-       = XCAR (XBUFFER_LOCAL_VALUE (valcontents)->cdr);
-      alist_element_car = XCAR (current_alist_element);
-      if (EQ (alist_element_car, current_alist_element))
-       return do_symval_forwarding (XBUFFER_LOCAL_VALUE (valcontents)->realvalue);
-      else
-       return XCDR (XBUFFER_LOCAL_VALUE (valcontents)->cdr);
+       /* For a built-in buffer-local variable, get the default value
+          rather than letting do_symval_forwarding get the current value.  */
+       if (BUFFER_OBJFWDP (valcontents))
+         {
+           int offset = XBUFFER_OBJFWD (valcontents)->offset;
+           if (PER_BUFFER_IDX (offset) != 0)
+             return PER_BUFFER_DEFAULT (offset);
+         }
+
+       /* For other variables, get the current value.  */
+       return do_symval_forwarding (valcontents);
+      }
+    default: abort ();
     }
-  /* For other variables, get the current value.  */
-  return do_symval_forwarding (valcontents);
 }
 
 DEFUN ("default-boundp", Fdefault_boundp, Sdefault_boundp, 1, 1, 0,
        doc: /* Return t if SYMBOL has a non-void default value.
 This is the value that is seen in buffers that do not have their own values
 for this variable.  */)
-     (symbol)
-     Lisp_Object symbol;
+  (Lisp_Object symbol)
 {
   register Lisp_Object value;
 
@@ -1362,8 +1349,7 @@ DEFUN ("default-value", Fdefault_value, Sdefault_value, 1, 1, 0,
 This is the value that is seen in buffers that do not have their own values
 for this variable.  The default value is meaningful for variables with
 local bindings in certain buffers.  */)
-     (symbol)
-     Lisp_Object symbol;
+  (Lisp_Object symbol)
 {
   register Lisp_Object value;
 
@@ -1378,53 +1364,70 @@ DEFUN ("set-default", Fset_default, Sset_default, 2, 2, 0,
        doc: /* Set SYMBOL's default value to VALUE.  SYMBOL and VALUE are evaluated.
 The default value is seen in buffers that do not have their own values
 for this variable.  */)
-     (symbol, value)
-     Lisp_Object symbol, value;
+  (Lisp_Object symbol, Lisp_Object value)
 {
-  register Lisp_Object valcontents, current_alist_element, alist_element_buffer;
+  struct Lisp_Symbol *sym;
 
   CHECK_SYMBOL (symbol);
-  valcontents = SYMBOL_VALUE (symbol);
-
-  /* Handle variables like case-fold-search that have special slots
-     in the buffer.  Make them work apparently like Lisp_Buffer_Local_Value
-     variables.  */
-  if (BUFFER_OBJFWDP (valcontents))
+  if (SYMBOL_CONSTANT_P (symbol))
     {
-      int offset = XBUFFER_OBJFWD (valcontents)->offset;
-      int idx = PER_BUFFER_IDX (offset);
+      if (NILP (Fkeywordp (symbol))
+         || !EQ (value, Fdefault_value (symbol)))
+       xsignal1 (Qsetting_constant, symbol);
+      else
+       /* Allow setting keywords to their own value.  */
+       return value;
+    }
+  sym = XSYMBOL (symbol);
 
-      PER_BUFFER_DEFAULT (offset) = value;
+ start:
+  switch (sym->redirect)
+    {
+    case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start;
+    case SYMBOL_PLAINVAL: return Fset (symbol, value);
+    case SYMBOL_LOCALIZED:
+      {
+       struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym);
 
-      /* If this variable is not always local in all buffers,
-        set it in the buffers that don't nominally have a local value.  */
-      if (idx > 0)
-       {
-         struct buffer *b;
+       /* Store new value into the DEFAULT-VALUE slot.  */
+       XSETCDR (blv->defcell, value);
 
-         for (b = all_buffers; b; b = b->next)
-           if (!PER_BUFFER_VALUE_P (b, idx))
-             PER_BUFFER_VALUE (b, offset) = value;
-       }
-      return value;
-    }
+       /* If the default binding is now loaded, set the REALVALUE slot too.  */
+       if (blv->fwd && EQ (blv->defcell, blv->valcell))
+         store_symval_forwarding (blv->fwd, value, NULL);
+       return value;
+      }
+    case SYMBOL_FORWARDED:
+      {
+       union Lisp_Fwd *valcontents = SYMBOL_FWD (sym);
 
-  if (!BUFFER_LOCAL_VALUEP (valcontents))
-    return Fset (symbol, value);
+       /* Handle variables like case-fold-search that have special slots
+          in the buffer.
+          Make them work apparently like Lisp_Buffer_Local_Value variables.  */
+       if (BUFFER_OBJFWDP (valcontents))
+         {
+           int offset = XBUFFER_OBJFWD (valcontents)->offset;
+           int idx = PER_BUFFER_IDX (offset);
 
-  /* Store new value into the DEFAULT-VALUE slot.  */
-  XSETCDR (XBUFFER_LOCAL_VALUE (valcontents)->cdr, value);
+           PER_BUFFER_DEFAULT (offset) = value;
 
-  /* If the default binding is now loaded, set the REALVALUE slot too.  */
-  current_alist_element
-    = XCAR (XBUFFER_LOCAL_VALUE (valcontents)->cdr);
-  alist_element_buffer = Fcar (current_alist_element);
-  if (EQ (alist_element_buffer, current_alist_element))
-    store_symval_forwarding (symbol,
-                            XBUFFER_LOCAL_VALUE (valcontents)->realvalue,
-                            value, NULL);
+           /* If this variable is not always local in all buffers,
+              set it in the buffers that don't nominally have a local value.  */
+           if (idx > 0)
+             {
+               struct buffer *b;
 
-  return value;
+               for (b = all_buffers; b; b = b->next)
+                 if (!PER_BUFFER_VALUE_P (b, idx))
+                   PER_BUFFER_VALUE (b, offset) = value;
+             }
+           return value;
+         }
+       else
+         return Fset (symbol, value);
+      }
+    default: abort ();
+    }
 }
 
 DEFUN ("setq-default", Fsetq_default, Ssetq_default, 0, UNEVALLED, 0,
@@ -1440,8 +1443,7 @@ This sets each VAR's default value to the corresponding VALUE.
 The VALUE for the Nth VAR can refer to the new default values
 of previous VARs.
 usage: (setq-default [VAR VALUE]...)  */)
-     (args)
-     Lisp_Object args;
+  (Lisp_Object args)
 {
   register Lisp_Object args_left;
   register Lisp_Object val, symbol;
@@ -1468,6 +1470,39 @@ usage: (setq-default [VAR VALUE]...)  */)
 \f
 /* Lisp functions for creating and removing buffer-local variables.  */
 
+union Lisp_Val_Fwd
+  {
+    Lisp_Object value;
+    union Lisp_Fwd *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));
+  Lisp_Object symbol;
+  Lisp_Object tem;
+
+ XSETSYMBOL (symbol, sym);
+ tem = Fcons (symbol, (forwarded
+                       ? do_symval_forwarding (valcontents.fwd)
+                       : valcontents.value));
+
+  /* Buffer_Local_Values cannot have as realval a buffer-local
+     or keyboard-local forwarding.  */
+  eassert (!(forwarded && BUFFER_OBJFWDP (valcontents.fwd)));
+  eassert (!(forwarded && KBOARD_OBJFWDP (valcontents.fwd)));
+  blv->fwd = forwarded ? valcontents.fwd : NULL;
+  blv->where = Qnil;
+  blv->frame_local = 0;
+  blv->local_if_set = 0;
+  blv->defcell = tem;
+  blv->valcell = tem;
+  SET_BLV_FOUND (blv, 0);
+  return blv;
+}
+
 DEFUN ("make-variable-buffer-local", Fmake_variable_buffer_local, Smake_variable_buffer_local,
        1, 1, "vMake Variable Buffer Local: ",
        doc: /* Make VARIABLE become buffer-local whenever it is set.
@@ -1482,45 +1517,60 @@ In most cases it is better to use `make-local-variable',
 which makes a variable local in just one buffer.
 
 The function `default-value' gets the default value and `set-default' sets it.  */)
-     (variable)
-     register Lisp_Object variable;
+  (register Lisp_Object variable)
 {
-  register Lisp_Object tem, valcontents, newval;
   struct Lisp_Symbol *sym;
+  struct Lisp_Buffer_Local_Value *blv = NULL;
+  union Lisp_Val_Fwd valcontents;
+  int forwarded;
 
   CHECK_SYMBOL (variable);
-  sym = indirect_variable (XSYMBOL (variable));
-
-  valcontents = sym->value;
-  if (sym->constant || KBOARD_OBJFWDP (valcontents))
-    error ("Symbol %s may not be buffer-local", SDATA (sym->xname));
+  sym = XSYMBOL (variable);
 
-  if (BUFFER_OBJFWDP (valcontents))
-    return variable;
-  else if (BUFFER_LOCAL_VALUEP (valcontents))
+ start:
+  switch (sym->redirect)
     {
-      if (XBUFFER_LOCAL_VALUE (valcontents)->check_frame)
-       error ("Symbol %s may not be buffer-local", SDATA (sym->xname));
-      newval = valcontents;
+    case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start;
+    case SYMBOL_PLAINVAL:
+      forwarded = 0; valcontents.value = SYMBOL_VAL (sym);
+      if (EQ (valcontents.value, Qunbound))
+       valcontents.value = Qnil;
+      break;
+    case SYMBOL_LOCALIZED:
+      blv = SYMBOL_BLV (sym);
+      if (blv->frame_local)
+       error ("Symbol %s may not be buffer-local",
+              SDATA (SYMBOL_NAME (variable)));
+      break;
+    case SYMBOL_FORWARDED:
+      forwarded = 1; valcontents.fwd = SYMBOL_FWD (sym);
+      if (KBOARD_OBJFWDP (valcontents.fwd))
+       error ("Symbol %s may not be buffer-local",
+              SDATA (SYMBOL_NAME (variable)));
+      else if (BUFFER_OBJFWDP (valcontents.fwd))
+       return variable;
+      break;
+    default: abort ();
     }
-  else
+
+  if (sym->constant)
+    error ("Symbol %s may not be buffer-local", SDATA (SYMBOL_NAME (variable)));
+
+  if (!blv)
     {
-      if (EQ (valcontents, Qunbound))
-       sym->value = Qnil;
-      tem = Fcons (Qnil, Fsymbol_value (variable));
-      XSETCAR (tem, tem);
-      newval = allocate_misc ();
-      XMISCTYPE (newval) = Lisp_Misc_Buffer_Local_Value;
-      XBUFFER_LOCAL_VALUE (newval)->realvalue = sym->value;
-      XBUFFER_LOCAL_VALUE (newval)->buffer = Fcurrent_buffer ();
-      XBUFFER_LOCAL_VALUE (newval)->frame = Qnil;
-      XBUFFER_LOCAL_VALUE (newval)->found_for_buffer = 0;
-      XBUFFER_LOCAL_VALUE (newval)->found_for_frame = 0;
-      XBUFFER_LOCAL_VALUE (newval)->check_frame = 0;
-      XBUFFER_LOCAL_VALUE (newval)->cdr = tem;
-      sym->value = newval;
+      blv = make_blv (sym, forwarded, valcontents);
+      sym->redirect = SYMBOL_LOCALIZED;
+      SET_SYMBOL_BLV (sym, blv);
+      {
+       Lisp_Object symbol;
+       XSETSYMBOL (symbol, sym); /* In case `variable' is aliased.  */
+       if (let_shadows_global_binding_p (symbol))
+         message ("Making %s buffer-local while let-bound!",
+                  SDATA (SYMBOL_NAME (variable)));
+      }
     }
-  XBUFFER_LOCAL_VALUE (newval)->local_if_set = 1;
+
+  blv->local_if_set = 1;
   return variable;
 }
 
@@ -1544,85 +1594,99 @@ See also `make-variable-buffer-local'.
 
 Do not use `make-local-variable' to make a hook variable buffer-local.
 Instead, use `add-hook' and specify t for the LOCAL argument.  */)
-     (variable)
-     register Lisp_Object variable;
+  (register Lisp_Object variable)
 {
-  register Lisp_Object tem, valcontents;
+  register Lisp_Object tem;
+  int forwarded;
+  union Lisp_Val_Fwd valcontents;
   struct Lisp_Symbol *sym;
+  struct Lisp_Buffer_Local_Value *blv = NULL;
 
   CHECK_SYMBOL (variable);
-  sym = indirect_variable (XSYMBOL (variable));
+  sym = XSYMBOL (variable);
 
-  valcontents = sym->value;
-  if (sym->constant || KBOARD_OBJFWDP (valcontents)
-      || (BUFFER_LOCAL_VALUEP (valcontents)
-         && (XBUFFER_LOCAL_VALUE (valcontents)->check_frame)))
-    error ("Symbol %s may not be buffer-local", SDATA (sym->xname));
+ start:
+  switch (sym->redirect)
+    {
+    case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start;
+    case SYMBOL_PLAINVAL:
+      forwarded = 0; valcontents.value = SYMBOL_VAL (sym); break;
+    case SYMBOL_LOCALIZED:
+      blv = SYMBOL_BLV (sym);
+      if (blv->frame_local)
+       error ("Symbol %s may not be buffer-local",
+              SDATA (SYMBOL_NAME (variable)));
+      break;
+    case SYMBOL_FORWARDED:
+      forwarded = 1; valcontents.fwd = SYMBOL_FWD (sym);
+      if (KBOARD_OBJFWDP (valcontents.fwd))
+       error ("Symbol %s may not be buffer-local",
+              SDATA (SYMBOL_NAME (variable)));
+      break;
+    default: abort ();
+    }
 
-  if ((BUFFER_LOCAL_VALUEP (valcontents)
-       && XBUFFER_LOCAL_VALUE (valcontents)->local_if_set)
-      || BUFFER_OBJFWDP (valcontents))
+  if (sym->constant)
+    error ("Symbol %s may not be buffer-local",
+          SDATA (SYMBOL_NAME (variable)));
+
+  if (blv ? blv->local_if_set
+      : (forwarded && BUFFER_OBJFWDP (valcontents.fwd)))
     {
       tem = Fboundp (variable);
-
       /* Make sure the symbol has a local value in this particular buffer,
         by setting it to the same value it already has.  */
       Fset (variable, (EQ (tem, Qt) ? Fsymbol_value (variable) : Qunbound));
       return variable;
     }
-  /* Make sure symbol is set up to hold per-buffer values.  */
-  if (!BUFFER_LOCAL_VALUEP (valcontents))
+  if (!blv)
     {
-      Lisp_Object newval;
-      tem = Fcons (Qnil, do_symval_forwarding (valcontents));
-      XSETCAR (tem, tem);
-      newval = allocate_misc ();
-      XMISCTYPE (newval) = Lisp_Misc_Buffer_Local_Value;
-      XBUFFER_LOCAL_VALUE (newval)->realvalue = sym->value;
-      XBUFFER_LOCAL_VALUE (newval)->buffer = Qnil;
-      XBUFFER_LOCAL_VALUE (newval)->frame = Qnil;
-      XBUFFER_LOCAL_VALUE (newval)->local_if_set = 0;
-      XBUFFER_LOCAL_VALUE (newval)->found_for_buffer = 0;
-      XBUFFER_LOCAL_VALUE (newval)->found_for_frame = 0;
-      XBUFFER_LOCAL_VALUE (newval)->check_frame = 0;
-      XBUFFER_LOCAL_VALUE (newval)->cdr = tem;
-      sym->value = newval;
+      blv = make_blv (sym, forwarded, valcontents);
+      sym->redirect = SYMBOL_LOCALIZED;
+      SET_SYMBOL_BLV (sym, blv);
+      {
+       Lisp_Object symbol;
+       XSETSYMBOL (symbol, sym); /* In case `variable' is aliased.  */
+       if (let_shadows_global_binding_p (symbol))
+         message ("Making %s local to %s while let-bound!",
+                  SDATA (SYMBOL_NAME (variable)),
+                  SDATA (current_buffer->name));
+      }
     }
+
   /* Make sure this buffer has its own value of symbol.  */
-  XSETSYMBOL (variable, sym);  /* Propagate variable indirections.  */
+  XSETSYMBOL (variable, sym);  /* Update in case of aliasing.  */
   tem = Fassq (variable, current_buffer->local_var_alist);
   if (NILP (tem))
     {
+      if (let_shadows_buffer_binding_p (sym))
+       message ("Making %s buffer-local while locally let-bound!",
+                SDATA (SYMBOL_NAME (variable)));
+
       /* Swap out any local binding for some other buffer, and make
         sure the current value is permanently recorded, if it's the
         default value.  */
       find_symbol_value (variable);
 
       current_buffer->local_var_alist
-        = Fcons (Fcons (variable, XCDR (XBUFFER_LOCAL_VALUE (sym->value)->cdr)),
+        = Fcons (Fcons (variable, XCDR (blv->defcell)),
                 current_buffer->local_var_alist);
 
       /* Make sure symbol does not think it is set up for this buffer;
         force it to look once again for this buffer's value.  */
-      {
-       Lisp_Object *pvalbuf;
-
-       valcontents = sym->value;
-
-       pvalbuf = &XBUFFER_LOCAL_VALUE (valcontents)->buffer;
-       if (current_buffer == XBUFFER (*pvalbuf))
-         *pvalbuf = Qnil;
-       XBUFFER_LOCAL_VALUE (valcontents)->found_for_buffer = 0;
-      }
+      if (current_buffer == XBUFFER (blv->where))
+       blv->where = Qnil;
+      /* blv->valcell = blv->defcell;
+       * SET_BLV_FOUND (blv, 0); */
+      blv->found = 0;
     }
 
   /* If the symbol forwards into a C variable, then load the binding
      for this buffer now.  If C code modifies the variable before we
      load the binding in, then that new value will clobber the default
      binding the next time we unload it.  */
-  valcontents = XBUFFER_LOCAL_VALUE (sym->value)->realvalue;
-  if (INTFWDP (valcontents) || BOOLFWDP (valcontents) || OBJFWDP (valcontents))
-    swap_in_symval_forwarding (variable, sym->value);
+  if (blv->fwd)
+    swap_in_symval_forwarding (sym, blv);
 
   return variable;
 }
@@ -1631,34 +1695,45 @@ DEFUN ("kill-local-variable", Fkill_local_variable, Skill_local_variable,
        1, 1, "vKill Local Variable: ",
        doc: /* Make VARIABLE no longer have a separate value in the current buffer.
 From now on the default value will apply in this buffer.  Return VARIABLE.  */)
-     (variable)
-     register Lisp_Object variable;
+  (register Lisp_Object variable)
 {
-  register Lisp_Object tem, valcontents;
+  register Lisp_Object tem;
+  struct Lisp_Buffer_Local_Value *blv;
   struct Lisp_Symbol *sym;
 
   CHECK_SYMBOL (variable);
-  sym = indirect_variable (XSYMBOL (variable));
-
-  valcontents = sym->value;
+  sym = XSYMBOL (variable);
 
-  if (BUFFER_OBJFWDP (valcontents))
+ start:
+  switch (sym->redirect)
     {
-      int offset = XBUFFER_OBJFWD (valcontents)->offset;
-      int idx = PER_BUFFER_IDX (offset);
-
-      if (idx > 0)
-       {
-         SET_PER_BUFFER_VALUE_P (current_buffer, idx, 0);
-         PER_BUFFER_VALUE (current_buffer, offset)
-           = PER_BUFFER_DEFAULT (offset);
-       }
-      return variable;
+    case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start;
+    case SYMBOL_PLAINVAL: return variable;
+    case SYMBOL_FORWARDED:
+      {
+       union Lisp_Fwd *valcontents = SYMBOL_FWD (sym);
+       if (BUFFER_OBJFWDP (valcontents))
+         {
+           int offset = XBUFFER_OBJFWD (valcontents)->offset;
+           int idx = PER_BUFFER_IDX (offset);
+
+           if (idx > 0)
+             {
+               SET_PER_BUFFER_VALUE_P (current_buffer, idx, 0);
+               PER_BUFFER_VALUE (current_buffer, offset)
+                 = PER_BUFFER_DEFAULT (offset);
+             }
+         }
+       return variable;
+      }
+    case SYMBOL_LOCALIZED:
+      blv = SYMBOL_BLV (sym);
+      if (blv->frame_local)
+       return variable;
+      break;
+    default: abort ();
     }
 
-  if (!BUFFER_LOCAL_VALUEP (valcontents))
-    return variable;
-
   /* Get rid of this buffer's alist element, if any.  */
   XSETSYMBOL (variable, sym);  /* Propagate variable indirection.  */
   tem = Fassq (variable, current_buffer->local_var_alist);
@@ -1670,14 +1745,13 @@ From now on the default value will apply in this buffer.  Return VARIABLE.  */)
      loaded, recompute its value.  We have to do it now, or else
      forwarded objects won't work right.  */
   {
-    Lisp_Object *pvalbuf, buf;
-    valcontents = sym->value;
-    pvalbuf = &XBUFFER_LOCAL_VALUE (valcontents)->buffer;
-    XSETBUFFER (buf, current_buffer);
-    if (EQ (buf, *pvalbuf))
+    Lisp_Object buf; XSETBUFFER (buf, current_buffer);
+    if (EQ (buf, blv->where))
       {
-       *pvalbuf = Qnil;
-       XBUFFER_LOCAL_VALUE (valcontents)->found_for_buffer = 0;
+       blv->where = Qnil;
+       /* blv->valcell = blv->defcell;
+        * SET_BLV_FOUND (blv, 0); */
+       blv->found = 0;
        find_symbol_value (variable);
       }
   }
@@ -1709,42 +1783,54 @@ is to set the VARIABLE frame parameter of that frame.  See
 Note that since Emacs 23.1, variables cannot be both buffer-local and
 frame-local any more (buffer-local bindings used to take precedence over
 frame-local bindings).  */)
-     (variable)
-     register Lisp_Object variable;
+  (register Lisp_Object variable)
 {
-  register Lisp_Object tem, valcontents, newval;
+  int forwarded;
+  union Lisp_Val_Fwd valcontents;
   struct Lisp_Symbol *sym;
+  struct Lisp_Buffer_Local_Value *blv = NULL;
 
   CHECK_SYMBOL (variable);
-  sym = indirect_variable (XSYMBOL (variable));
+  sym = XSYMBOL (variable);
 
-  valcontents = sym->value;
-  if (sym->constant || KBOARD_OBJFWDP (valcontents)
-      || BUFFER_OBJFWDP (valcontents))
-    error ("Symbol %s may not be frame-local", SDATA (sym->xname));
-
-  if (BUFFER_LOCAL_VALUEP (valcontents))
+ start:
+  switch (sym->redirect)
     {
-      if (!XBUFFER_LOCAL_VALUE (valcontents)->check_frame)
-       error ("Symbol %s may not be frame-local", SDATA (sym->xname));
-      return variable;
+    case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start;
+    case SYMBOL_PLAINVAL:
+      forwarded = 0; valcontents.value = SYMBOL_VAL (sym);
+      if (EQ (valcontents.value, Qunbound))
+       valcontents.value = Qnil;
+      break;
+    case SYMBOL_LOCALIZED:
+      if (SYMBOL_BLV (sym)->frame_local)
+       return variable;
+      else
+       error ("Symbol %s may not be frame-local",
+              SDATA (SYMBOL_NAME (variable)));
+    case SYMBOL_FORWARDED:
+      forwarded = 1; valcontents.fwd = SYMBOL_FWD (sym);
+      if (KBOARD_OBJFWDP (valcontents.fwd) || BUFFER_OBJFWDP (valcontents.fwd))
+       error ("Symbol %s may not be frame-local",
+              SDATA (SYMBOL_NAME (variable)));
+      break;
+    default: abort ();
     }
 
-  if (EQ (valcontents, Qunbound))
-    sym->value = Qnil;
-  tem = Fcons (Qnil, Fsymbol_value (variable));
-  XSETCAR (tem, tem);
-  newval = allocate_misc ();
-  XMISCTYPE (newval) = Lisp_Misc_Buffer_Local_Value;
-  XBUFFER_LOCAL_VALUE (newval)->realvalue = sym->value;
-  XBUFFER_LOCAL_VALUE (newval)->buffer = Qnil;
-  XBUFFER_LOCAL_VALUE (newval)->frame = Qnil;
-  XBUFFER_LOCAL_VALUE (newval)->local_if_set = 0;
-  XBUFFER_LOCAL_VALUE (newval)->found_for_buffer = 0;
-  XBUFFER_LOCAL_VALUE (newval)->found_for_frame = 0;
-  XBUFFER_LOCAL_VALUE (newval)->check_frame = 1;
-  XBUFFER_LOCAL_VALUE (newval)->cdr = tem;
-  sym->value = newval;
+  if (sym->constant)
+    error ("Symbol %s may not be frame-local", SDATA (SYMBOL_NAME (variable)));
+
+  blv = make_blv (sym, forwarded, valcontents);
+  blv->frame_local = 1;
+  sym->redirect = SYMBOL_LOCALIZED;
+  SET_SYMBOL_BLV (sym, blv);
+  {
+    Lisp_Object symbol;
+    XSETSYMBOL (symbol, sym); /* In case `variable' is aliased.  */
+    if (let_shadows_global_binding_p (symbol))
+      message ("Making %s frame-local while let-bound!",
+              SDATA (SYMBOL_NAME (variable)));
+  }
   return variable;
 }
 
@@ -1752,10 +1838,8 @@ DEFUN ("local-variable-p", Flocal_variable_p, Slocal_variable_p,
        1, 2, 0,
        doc: /* Non-nil if VARIABLE has a local binding in buffer BUFFER.
 BUFFER defaults to the current buffer.  */)
-     (variable, buffer)
-     register Lisp_Object variable, buffer;
+  (register Lisp_Object variable, Lisp_Object buffer)
 {
-  Lisp_Object valcontents;
   register struct buffer *buf;
   struct Lisp_Symbol *sym;
 
@@ -1768,29 +1852,47 @@ BUFFER defaults to the current buffer.  */)
     }
 
   CHECK_SYMBOL (variable);
-  sym = indirect_variable (XSYMBOL (variable));
-  XSETSYMBOL (variable, sym);
+  sym = XSYMBOL (variable);
 
-  valcontents = sym->value;
-  if (BUFFER_LOCAL_VALUEP (valcontents))
+ start:
+  switch (sym->redirect)
     {
-      Lisp_Object tail, elt;
+    case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start;
+    case SYMBOL_PLAINVAL: return Qnil;
+    case SYMBOL_LOCALIZED:
+      {
+       Lisp_Object tail, elt, tmp;
+       struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym);
+       XSETBUFFER (tmp, buf);
+       XSETSYMBOL (variable, sym); /* Update in case of aliasing.  */
 
-      for (tail = buf->local_var_alist; CONSP (tail); tail = XCDR (tail))
-       {
-         elt = XCAR (tail);
-         if (EQ (variable, XCAR (elt)))
-           return Qt;
-       }
-    }
-  if (BUFFER_OBJFWDP (valcontents))
-    {
-      int offset = XBUFFER_OBJFWD (valcontents)->offset;
-      int idx = PER_BUFFER_IDX (offset);
-      if (idx == -1 || PER_BUFFER_VALUE_P (buf, idx))
-       return Qt;
+       for (tail = buf->local_var_alist; CONSP (tail); tail = XCDR (tail))
+         {
+           elt = XCAR (tail);
+           if (EQ (variable, XCAR (elt)))
+             {
+               eassert (!blv->frame_local);
+               eassert (BLV_FOUND (blv) || !EQ (blv->where, tmp));
+               return Qt;
+             }
+         }
+       eassert (!BLV_FOUND (blv) || !EQ (blv->where, tmp));
+       return Qnil;
+      }
+    case SYMBOL_FORWARDED:
+      {
+       union Lisp_Fwd *valcontents = SYMBOL_FWD (sym);
+       if (BUFFER_OBJFWDP (valcontents))
+         {
+           int offset = XBUFFER_OBJFWD (valcontents)->offset;
+           int idx = PER_BUFFER_IDX (offset);
+           if (idx == -1 || PER_BUFFER_VALUE_P (buf, idx))
+             return Qt;
+         }
+       return Qnil;
+      }
+    default: abort ();
     }
-  return Qnil;
 }
 
 DEFUN ("local-variable-if-set-p", Flocal_variable_if_set_p, Slocal_variable_if_set_p,
@@ -1801,43 +1903,31 @@ while it does not have a `let'-style binding that was made in BUFFER,
 will produce a buffer local binding.  See Info node
 `(elisp)Creating Buffer-Local'.
 BUFFER defaults to the current buffer.  */)
-     (variable, buffer)
-     register Lisp_Object variable, buffer;
+  (register Lisp_Object variable, Lisp_Object buffer)
 {
-  Lisp_Object valcontents;
-  register struct buffer *buf;
   struct Lisp_Symbol *sym;
 
-  if (NILP (buffer))
-    buf = current_buffer;
-  else
-    {
-      CHECK_BUFFER (buffer);
-      buf = XBUFFER (buffer);
-    }
-
   CHECK_SYMBOL (variable);
-  sym = indirect_variable (XSYMBOL (variable));
-  XSETSYMBOL (variable, sym);
+  sym = XSYMBOL (variable);
 
-  valcontents = sym->value;
-
-  if (BUFFER_OBJFWDP (valcontents))
-    /* All these slots become local if they are set.  */
-    return Qt;
-  else if (BUFFER_LOCAL_VALUEP (valcontents))
+ start:
+  switch (sym->redirect)
     {
-      Lisp_Object tail, elt;
-      if (XBUFFER_LOCAL_VALUE (valcontents)->local_if_set)
-       return Qt;
-      for (tail = buf->local_var_alist; CONSP (tail); tail = XCDR (tail))
-       {
-         elt = XCAR (tail);
-         if (EQ (variable, XCAR (elt)))
-           return Qt;
-       }
+    case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start;
+    case SYMBOL_PLAINVAL: return Qnil;
+    case SYMBOL_LOCALIZED:
+      {
+       struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym);
+       if (blv->local_if_set)
+         return Qt;
+       XSETSYMBOL (variable, sym); /* Update in case of aliasing.  */
+       return Flocal_variable_p (variable, buffer);
+      }
+    case SYMBOL_FORWARDED:
+      /* All BUFFER_OBJFWD slots become local if they are set.  */
+      return (BUFFER_OBJFWDP (SYMBOL_FWD (sym)) ? Qt : Qnil);
+    default: abort ();
     }
-  return Qnil;
 }
 
 DEFUN ("variable-binding-locus", Fvariable_binding_locus, Svariable_binding_locus,
@@ -1846,39 +1936,48 @@ DEFUN ("variable-binding-locus", Fvariable_binding_locus, Svariable_binding_locu
 If the current binding is buffer-local, the value is the current buffer.
 If the current binding is frame-local, the value is the selected frame.
 If the current binding is global (the default), the value is nil.  */)
-     (variable)
-     register Lisp_Object variable;
+  (register Lisp_Object variable)
 {
-  Lisp_Object valcontents;
   struct Lisp_Symbol *sym;
 
   CHECK_SYMBOL (variable);
-  sym = indirect_variable (XSYMBOL (variable));
+  sym = XSYMBOL (variable);
 
   /* Make sure the current binding is actually swapped in.  */
   find_symbol_value (variable);
 
-  valcontents = sym->value;
-
-  if (BUFFER_LOCAL_VALUEP (valcontents)
-      || BUFFER_OBJFWDP (valcontents))
+ start:
+  switch (sym->redirect)
     {
+    case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start;
+    case SYMBOL_PLAINVAL: return Qnil;
+    case SYMBOL_FORWARDED:
+      {
+       union Lisp_Fwd *valcontents = SYMBOL_FWD (sym);
+       if (KBOARD_OBJFWDP (valcontents))
+         return Fframe_terminal (Fselected_frame ());
+       else if (!BUFFER_OBJFWDP (valcontents))
+         return Qnil;
+      }
+      /* FALLTHROUGH */
+    case SYMBOL_LOCALIZED:
       /* For a local variable, record both the symbol and which
         buffer's or frame's value we are saving.  */
       if (!NILP (Flocal_variable_p (variable, Qnil)))
        return Fcurrent_buffer ();
-      else if (BUFFER_LOCAL_VALUEP (valcontents)
-              && XBUFFER_LOCAL_VALUE (valcontents)->found_for_frame)
-       return XBUFFER_LOCAL_VALUE (valcontents)->frame;
+      else if (sym->redirect == SYMBOL_LOCALIZED
+              && BLV_FOUND (SYMBOL_BLV (sym)))
+       return SYMBOL_BLV (sym)->where;
+      else
+       return Qnil;
+    default: abort ();
     }
-
-  return Qnil;
 }
 
 /* This code is disabled now that we use the selected frame to return
    keyboard-local-values. */
 #if 0
-extern struct terminal *get_terminal P_ ((Lisp_Object display, int));
+extern struct terminal *get_terminal (Lisp_Object display, int);
 
 DEFUN ("terminal-local-value", Fterminal_local_value, Sterminal_local_value, 2, 2, 0,
        doc: /* Return the terminal-local value of SYMBOL on TERMINAL.
@@ -1887,9 +1986,7 @@ value, like `symbol-value'.
 
 TERMINAL may be a terminal object, a frame, or nil (meaning the
 selected frame's terminal device).  */)
-  (symbol, terminal)
-     Lisp_Object symbol;
-     Lisp_Object terminal;
+  (Lisp_Object symbol, Lisp_Object terminal)
 {
   Lisp_Object result;
   struct terminal *t = get_terminal (terminal, 1);
@@ -1906,10 +2003,7 @@ binding, like `set'.
 
 TERMINAL may be a terminal object, a frame, or nil (meaning the
 selected frame's terminal device).  */)
-  (symbol, terminal, value)
-     Lisp_Object symbol;
-     Lisp_Object terminal;
-     Lisp_Object value;
+  (Lisp_Object symbol, Lisp_Object terminal, Lisp_Object value)
 {
   Lisp_Object result;
   struct terminal *t = get_terminal (terminal, 1);
@@ -1930,8 +2024,7 @@ selected frame's terminal device).  */)
    This is like Findirect_function, except that it doesn't signal an
    error if the chain ends up unbound.  */
 Lisp_Object
-indirect_function (object)
-     register Lisp_Object object;
+indirect_function (register Lisp_Object object)
 {
   Lisp_Object tortoise, hare;
 
@@ -1963,9 +2056,7 @@ If the final symbol in the chain is unbound, signal a void-function error.
 Optional arg NOERROR non-nil means to return nil instead of signalling.
 Signal a cyclic-function-indirection error if there is a loop in the
 function chain of symbols.  */)
-     (object, noerror)
-     register Lisp_Object object;
-     Lisp_Object noerror;
+  (register Lisp_Object object, Lisp_Object noerror)
 {
   Lisp_Object result;
 
@@ -1989,9 +2080,7 @@ DEFUN ("aref", Faref, Saref, 2, 2, 0,
        doc: /* Return the element of ARRAY at index IDX.
 ARRAY may be a vector, a string, a char-table, a bool-vector,
 or a byte-code object.  IDX starts at 0.  */)
-     (array, idx)
-     register Lisp_Object array;
-     Lisp_Object idx;
+  (register Lisp_Object array, Lisp_Object idx)
 {
   register int idxval;
 
@@ -2045,9 +2134,7 @@ DEFUN ("aset", Faset, Saset, 3, 3, 0,
        doc: /* Store into the element of ARRAY at index IDX the value NEWELT.
 Return NEWELT.  ARRAY may be a vector, a string, a char-table or a
 bool-vector.  IDX starts at 0.  */)
-     (array, idx, newelt)
-     register Lisp_Object array;
-     Lisp_Object idx, newelt;
+  (register Lisp_Object array, Lisp_Object idx, Lisp_Object newelt)
 {
   register int idxval;
 
@@ -2095,7 +2182,7 @@ bool-vector.  IDX starts at 0.  */)
 
       idxval_byte = string_char_to_byte (array, idxval);
       p1 = SDATA (array) + idxval_byte;
-      PARSE_MULTIBYTE_SEQ (p1, nbytes - idxval_byte, prev_bytes);
+      prev_bytes = BYTES_BY_CHAR_HEAD (*p1);
       new_bytes = CHAR_STRING (XINT (newelt), p0);
       if (prev_bytes != new_bytes)
        {
@@ -2105,13 +2192,13 @@ bool-vector.  IDX starts at 0.  */)
          USE_SAFE_ALLOCA;
 
          SAFE_ALLOCA (str, unsigned char *, nbytes);
-         bcopy (SDATA (array), str, nbytes);
+         memcpy (str, SDATA (array), nbytes);
          allocate_string_data (XSTRING (array), nchars,
                                nbytes + new_bytes - prev_bytes);
-         bcopy (str, SDATA (array), idxval_byte);
+         memcpy (SDATA (array), str, idxval_byte);
          p1 = SDATA (array) + idxval_byte;
-         bcopy (str + idxval_byte + prev_bytes, p1 + new_bytes,
-                nbytes - (idxval_byte + prev_bytes));
+         memcpy (p1 + new_bytes, str + idxval_byte + prev_bytes,
+                 nbytes - (idxval_byte + prev_bytes));
          SAFE_FREE ();
          clear_string_char_byte_cache ();
        }
@@ -2147,9 +2234,7 @@ bool-vector.  IDX starts at 0.  */)
 enum comparison { equal, notequal, less, grtr, less_or_equal, grtr_or_equal };
 
 Lisp_Object
-arithcompare (num1, num2, comparison)
-     Lisp_Object num1, num2;
-     enum comparison comparison;
+arithcompare (Lisp_Object num1, Lisp_Object num2, enum comparison comparison)
 {
   double f1 = 0, f2 = 0;
   int floatp = 0;
@@ -2203,24 +2288,21 @@ arithcompare (num1, num2, comparison)
 
 DEFUN ("=", Feqlsign, Seqlsign, 2, 2, 0,
        doc: /* Return t if two args, both numbers or markers, are equal.  */)
-     (num1, num2)
-     register Lisp_Object num1, num2;
+  (register Lisp_Object num1, Lisp_Object num2)
 {
   return arithcompare (num1, num2, equal);
 }
 
 DEFUN ("<", Flss, Slss, 2, 2, 0,
        doc: /* Return t if first arg is less than second arg.  Both must be numbers or markers.  */)
-     (num1, num2)
-     register Lisp_Object num1, num2;
+  (register Lisp_Object num1, Lisp_Object num2)
 {
   return arithcompare (num1, num2, less);
 }
 
 DEFUN (">", Fgtr, Sgtr, 2, 2, 0,
        doc: /* Return t if first arg is greater than second arg.  Both must be numbers or markers.  */)
-     (num1, num2)
-     register Lisp_Object num1, num2;
+  (register Lisp_Object num1, Lisp_Object num2)
 {
   return arithcompare (num1, num2, grtr);
 }
@@ -2228,8 +2310,7 @@ DEFUN (">", Fgtr, Sgtr, 2, 2, 0,
 DEFUN ("<=", Fleq, Sleq, 2, 2, 0,
        doc: /* Return t if first arg is less than or equal to second arg.
 Both must be numbers or markers.  */)
-     (num1, num2)
-     register Lisp_Object num1, num2;
+  (register Lisp_Object num1, Lisp_Object num2)
 {
   return arithcompare (num1, num2, less_or_equal);
 }
@@ -2237,24 +2318,21 @@ Both must be numbers or markers.  */)
 DEFUN (">=", Fgeq, Sgeq, 2, 2, 0,
        doc: /* Return t if first arg is greater than or equal to second arg.
 Both must be numbers or markers.  */)
-     (num1, num2)
-     register Lisp_Object num1, num2;
+  (register Lisp_Object num1, Lisp_Object num2)
 {
   return arithcompare (num1, num2, grtr_or_equal);
 }
 
 DEFUN ("/=", Fneq, Sneq, 2, 2, 0,
        doc: /* Return t if first arg is not equal to second arg.  Both must be numbers or markers.  */)
-     (num1, num2)
-     register Lisp_Object num1, num2;
+  (register Lisp_Object num1, Lisp_Object num2)
 {
   return arithcompare (num1, num2, notequal);
 }
 
 DEFUN ("zerop", Fzerop, Szerop, 1, 1, 0,
        doc: /* Return t if NUMBER is zero.  */)
-     (number)
-     register Lisp_Object number;
+  (register Lisp_Object number)
 {
   CHECK_NUMBER_OR_FLOAT (number);
 
@@ -2275,8 +2353,7 @@ DEFUN ("zerop", Fzerop, Szerop, 1, 1, 0,
    when the value fits in one.  */
 
 Lisp_Object
-long_to_cons (i)
-     unsigned long i;
+long_to_cons (long unsigned int i)
 {
   unsigned long top = i >> 16;
   unsigned int bot = i & 0xFFFF;
@@ -2288,8 +2365,7 @@ long_to_cons (i)
 }
 
 unsigned long
-cons_to_long (c)
-     Lisp_Object c;
+cons_to_long (Lisp_Object c)
 {
   Lisp_Object top, bot;
   if (INTEGERP (c))
@@ -2305,8 +2381,7 @@ DEFUN ("number-to-string", Fnumber_to_string, Snumber_to_string, 1, 1, 0,
        doc: /* Return the decimal representation of NUMBER as a string.
 Uses a minus sign if negative.
 NUMBER may be an integer or a floating point number.  */)
-     (number)
-     Lisp_Object number;
+  (Lisp_Object number)
 {
   char buffer[VALBITS];
 
@@ -2330,8 +2405,7 @@ NUMBER may be an integer or a floating point number.  */)
 }
 
 INLINE static int
-digit_to_number (character, base)
-     int character, base;
+digit_to_number (int character, int base)
 {
   int digit;
 
@@ -2358,8 +2432,7 @@ It ignores leading spaces and tabs, and all trailing chars.
 If BASE, interpret STRING as a number in that base.  If BASE isn't
 present, base 10 is used.  BASE must be between 2 and 16 (inclusive).
 If the base used is not 10, STRING is always parsed as integer.  */)
-     (string, base)
-     register Lisp_Object string, base;
+  (register Lisp_Object string, Lisp_Object base)
 {
   register unsigned char *p;
   register int b;
@@ -2426,15 +2499,10 @@ enum arithop
     Amin
   };
 
-static Lisp_Object float_arith_driver P_ ((double, int, enum arithop,
-                                          int, Lisp_Object *));
-extern Lisp_Object fmod_float ();
-
+static Lisp_Object float_arith_driver (double, int, enum arithop,
+                                       int, Lisp_Object *);
 Lisp_Object
-arith_driver (code, nargs, args)
-     enum arithop code;
-     int nargs;
-     register Lisp_Object *args;
+arith_driver (enum arithop code, int nargs, register Lisp_Object *args)
 {
   register Lisp_Object val;
   register int argnum;
@@ -2519,12 +2587,7 @@ arith_driver (code, nargs, args)
 #define isnan(x) ((x) != (x))
 
 static Lisp_Object
-float_arith_driver (accum, argnum, code, nargs, args)
-     double accum;
-     register int argnum;
-     enum arithop code;
-     int nargs;
-     register Lisp_Object *args;
+float_arith_driver (double accum, register int argnum, enum arithop code, int nargs, register Lisp_Object *args)
 {
   register Lisp_Object val;
   double next;
@@ -2586,9 +2649,7 @@ float_arith_driver (accum, argnum, code, nargs, args)
 DEFUN ("+", Fplus, Splus, 0, MANY, 0,
        doc: /* Return sum of any number of arguments, which are numbers or markers.
 usage: (+ &rest NUMBERS-OR-MARKERS)  */)
-     (nargs, args)
-     int nargs;
-     Lisp_Object *args;
+  (int nargs, Lisp_Object *args)
 {
   return arith_driver (Aadd, nargs, args);
 }
@@ -2598,9 +2659,7 @@ DEFUN ("-", Fminus, Sminus, 0, MANY, 0,
 With one arg, negates it.  With more than one arg,
 subtracts all but the first from the first.
 usage: (- &optional NUMBER-OR-MARKER &rest MORE-NUMBERS-OR-MARKERS)  */)
-     (nargs, args)
-     int nargs;
-     Lisp_Object *args;
+  (int nargs, Lisp_Object *args)
 {
   return arith_driver (Asub, nargs, args);
 }
@@ -2608,9 +2667,7 @@ usage: (- &optional NUMBER-OR-MARKER &rest MORE-NUMBERS-OR-MARKERS)  */)
 DEFUN ("*", Ftimes, Stimes, 0, MANY, 0,
        doc: /* Return product of any number of arguments, which are numbers or markers.
 usage: (* &rest NUMBERS-OR-MARKERS)  */)
-     (nargs, args)
-     int nargs;
-     Lisp_Object *args;
+  (int nargs, Lisp_Object *args)
 {
   return arith_driver (Amult, nargs, args);
 }
@@ -2619,9 +2676,7 @@ DEFUN ("/", Fquo, Squo, 2, MANY, 0,
        doc: /* Return first argument divided by all the remaining arguments.
 The arguments must be numbers or markers.
 usage: (/ DIVIDEND DIVISOR &rest DIVISORS)  */)
-     (nargs, args)
-     int nargs;
-     Lisp_Object *args;
+  (int nargs, Lisp_Object *args)
 {
   int argnum;
   for (argnum = 2; argnum < nargs; argnum++)
@@ -2633,8 +2688,7 @@ usage: (/ DIVIDEND DIVISOR &rest DIVISORS)  */)
 DEFUN ("%", Frem, Srem, 2, 2, 0,
        doc: /* Return remainder of X divided by Y.
 Both must be integers or markers.  */)
-     (x, y)
-     register Lisp_Object x, y;
+  (register Lisp_Object x, Lisp_Object y)
 {
   Lisp_Object val;
 
@@ -2675,8 +2729,7 @@ DEFUN ("mod", Fmod, Smod, 2, 2, 0,
        doc: /* Return X modulo Y.
 The result falls between zero (inclusive) and Y (exclusive).
 Both X and Y must be numbers or markers.  */)
-     (x, y)
-     register Lisp_Object x, y;
+  (register Lisp_Object x, Lisp_Object y)
 {
   Lisp_Object val;
   EMACS_INT i1, i2;
@@ -2707,9 +2760,7 @@ DEFUN ("max", Fmax, Smax, 1, MANY, 0,
        doc: /* Return largest of all the arguments (which must be numbers or markers).
 The value is always a number; markers are converted to numbers.
 usage: (max NUMBER-OR-MARKER &rest NUMBERS-OR-MARKERS)  */)
-     (nargs, args)
-     int nargs;
-     Lisp_Object *args;
+  (int nargs, Lisp_Object *args)
 {
   return arith_driver (Amax, nargs, args);
 }
@@ -2718,9 +2769,7 @@ DEFUN ("min", Fmin, Smin, 1, MANY, 0,
        doc: /* Return smallest of all the arguments (which must be numbers or markers).
 The value is always a number; markers are converted to numbers.
 usage: (min NUMBER-OR-MARKER &rest NUMBERS-OR-MARKERS)  */)
-     (nargs, args)
-     int nargs;
-     Lisp_Object *args;
+  (int nargs, Lisp_Object *args)
 {
   return arith_driver (Amin, nargs, args);
 }
@@ -2729,9 +2778,7 @@ DEFUN ("logand", Flogand, Slogand, 0, MANY, 0,
        doc: /* Return bitwise-and of all the arguments.
 Arguments may be integers, or markers converted to integers.
 usage: (logand &rest INTS-OR-MARKERS)  */)
-     (nargs, args)
-     int nargs;
-     Lisp_Object *args;
+  (int nargs, Lisp_Object *args)
 {
   return arith_driver (Alogand, nargs, args);
 }
@@ -2740,9 +2787,7 @@ DEFUN ("logior", Flogior, Slogior, 0, MANY, 0,
        doc: /* Return bitwise-or of all the arguments.
 Arguments may be integers, or markers converted to integers.
 usage: (logior &rest INTS-OR-MARKERS)  */)
-     (nargs, args)
-     int nargs;
-     Lisp_Object *args;
+  (int nargs, Lisp_Object *args)
 {
   return arith_driver (Alogior, nargs, args);
 }
@@ -2751,9 +2796,7 @@ DEFUN ("logxor", Flogxor, Slogxor, 0, MANY, 0,
        doc: /* Return bitwise-exclusive-or of all the arguments.
 Arguments may be integers, or markers converted to integers.
 usage: (logxor &rest INTS-OR-MARKERS)  */)
-     (nargs, args)
-     int nargs;
-     Lisp_Object *args;
+  (int nargs, Lisp_Object *args)
 {
   return arith_driver (Alogxor, nargs, args);
 }
@@ -2762,8 +2805,7 @@ DEFUN ("ash", Fash, Sash, 2, 2, 0,
        doc: /* Return VALUE with its bits shifted left by COUNT.
 If COUNT is negative, shifting is actually to the right.
 In this case, the sign bit is duplicated.  */)
-     (value, count)
-     register Lisp_Object value, count;
+  (register Lisp_Object value, Lisp_Object count)
 {
   register Lisp_Object val;
 
@@ -2785,8 +2827,7 @@ DEFUN ("lsh", Flsh, Slsh, 2, 2, 0,
        doc: /* Return VALUE with its bits shifted left by COUNT.
 If COUNT is negative, shifting is actually to the right.
 In this case, zeros are shifted in on the left.  */)
-     (value, count)
-     register Lisp_Object value, count;
+  (register Lisp_Object value, Lisp_Object count)
 {
   register Lisp_Object val;
 
@@ -2807,8 +2848,7 @@ In this case, zeros are shifted in on the left.  */)
 DEFUN ("1+", Fadd1, Sadd1, 1, 1, 0,
        doc: /* Return NUMBER plus one.  NUMBER may be a number or a marker.
 Markers are converted to integers.  */)
-     (number)
-     register Lisp_Object number;
+  (register Lisp_Object number)
 {
   CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (number);
 
@@ -2822,8 +2862,7 @@ Markers are converted to integers.  */)
 DEFUN ("1-", Fsub1, Ssub1, 1, 1, 0,
        doc: /* Return NUMBER minus one.  NUMBER may be a number or a marker.
 Markers are converted to integers.  */)
-     (number)
-     register Lisp_Object number;
+  (register Lisp_Object number)
 {
   CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (number);
 
@@ -2836,8 +2875,7 @@ Markers are converted to integers.  */)
 
 DEFUN ("lognot", Flognot, Slognot, 1, 1, 0,
        doc: /* Return the bitwise complement of NUMBER.  NUMBER must be an integer.  */)
-     (number)
-     register Lisp_Object number;
+  (register Lisp_Object number)
 {
   CHECK_NUMBER (number);
   XSETINT (number, ~XINT (number));
@@ -2848,7 +2886,7 @@ DEFUN ("byteorder", Fbyteorder, Sbyteorder, 0, 0, 0,
        doc: /* Return the byteorder for the machine.
 Returns 66 (ASCII uppercase B) for big endian machines or 108 (ASCII
 lowercase l) for small endian machines.  */)
-     ()
+  (void)
 {
   unsigned i = 0x04030201;
   int order = *(char *)&i == 1 ? 108 : 66;
@@ -2859,7 +2897,7 @@ lowercase l) for small endian machines.  */)
 
 \f
 void
-syms_of_data ()
+syms_of_data (void)
 {
   Lisp_Object error_tail, arith_tail;
 
@@ -3288,14 +3326,8 @@ syms_of_data ()
 }
 
 SIGTYPE
-arith_error (signo)
-     int signo;
-{
-#if defined(USG) && !defined(POSIX_SIGNALS)
-  /* USG systems forget handlers when they are used;
-     must reestablish each time */
-  signal (signo, arith_error);
-#endif /* USG */
+arith_error (int signo)
+{
   sigsetmask (SIGEMPTYMASK);
 
   SIGNAL_THREAD_CHECK (signo);
@@ -3303,7 +3335,7 @@ arith_error (signo)
 }
 
 void
-init_data ()
+init_data (void)
 {
   /* Don't do this if just dumping out.
      We don't want to call `signal' in this case
index f710741b5919c3154536dfd6c2a95622596f78ff..3b6f0e543bb159b30fa9703e057179ab1542ef87 100644 (file)
@@ -16,7 +16,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/>.  */
 
-#include "config.h"
+#include <config.h>
 
 #ifdef HAVE_DBUS
 #include <stdlib.h>
@@ -31,6 +31,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 \f
 /* Subroutines.  */
 Lisp_Object Qdbus_init_bus;
+Lisp_Object Qdbus_close_bus;
 Lisp_Object Qdbus_get_unique_name;
 Lisp_Object Qdbus_call_method;
 Lisp_Object Qdbus_call_method_asynchronously;
@@ -59,6 +60,9 @@ Lisp_Object QCdbus_type_object_path, QCdbus_type_signature;
 Lisp_Object QCdbus_type_array, QCdbus_type_variant;
 Lisp_Object QCdbus_type_struct, QCdbus_type_dict_entry;
 
+/* Registered buses.  */
+Lisp_Object Vdbus_registered_buses;
+
 /* Hash table which keeps function definitions.  */
 Lisp_Object Vdbus_registered_objects_table;
 
@@ -111,7 +115,7 @@ int xd_in_read_queued_messages = 0;
   } while (0)
 
 /* Macros for debugging.  In order to enable them, build with
-   "make MYCPPFLAGS='-DDBUS_DEBUG -Wall'".  */
+   "MYCPPFLAGS='-DDBUS_DEBUG -Wall' make".  */
 #ifdef DBUS_DEBUG
 #define XD_DEBUG_MESSAGE(...)          \
   do {                                 \
@@ -163,8 +167,7 @@ int xd_in_read_queued_messages = 0;
 /* Determine the DBusType of a given Lisp symbol.  OBJECT must be one
    of the predefined D-Bus type symbols.  */
 static int
-xd_symbol_to_dbus_type (object)
-     Lisp_Object object;
+xd_symbol_to_dbus_type (Lisp_Object object)
 {
   return
     ((EQ (object, QCdbus_type_byte)) ? DBUS_TYPE_BYTE
@@ -221,10 +224,7 @@ xd_symbol_to_dbus_type (object)
    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 (signature, dtype, parent_type, object)
-     char *signature;
-     unsigned int dtype, parent_type;
-     Lisp_Object object;
+xd_signature (char *signature, unsigned int dtype, unsigned int parent_type, Lisp_Object object)
 {
   unsigned int subtype;
   Lisp_Object elt;
@@ -393,10 +393,7 @@ xd_signature (signature, dtype, parent_type, object)
    `dbus-send-signal', into corresponding C values appended as
    arguments to a D-Bus message.  */
 static void
-xd_append_arg (dtype, object, iter)
-     unsigned int dtype;
-     Lisp_Object object;
-     DBusMessageIter *iter;
+xd_append_arg (unsigned int dtype, Lisp_Object object, DBusMessageIter *iter)
 {
   char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH];
   DBusMessageIter subiter;
@@ -604,9 +601,7 @@ xd_append_arg (dtype, object, 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 (dtype, iter)
-     unsigned int dtype;
-     DBusMessageIter *iter;
+xd_retrieve_arg (unsigned int dtype, DBusMessageIter *iter)
 {
 
   switch (dtype)
@@ -722,37 +717,79 @@ xd_retrieve_arg (dtype, iter)
     }
 }
 
-/* Initialize D-Bus connection.  BUS is a Lisp symbol, either :system
-   or :session.  It tells which D-Bus to be initialized.  */
+/* 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.  */
 static DBusConnection *
-xd_initialize (bus)
-     Lisp_Object bus;
+xd_initialize (Lisp_Object bus, int raise_error)
 {
   DBusConnection *connection;
   DBusError derror;
 
   /* Parameter check.  */
-  CHECK_SYMBOL (bus);
-  if (!(EQ (bus, QCdbus_system_bus) || EQ (bus, QCdbus_session_bus)))
-    XD_SIGNAL2 (build_string ("Wrong bus name"), bus);
+  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)
-    XD_SIGNAL2 (build_string ("No connection to bus"), 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)
+       {
+         if (raise_error)
+           XD_SIGNAL2 (build_string ("No connection to bus"), bus);
+         else
+           return NULL;
+       }
+    }
 
   /* Open a connection to the bus.  */
   dbus_error_init (&derror);
 
-  if (EQ (bus, QCdbus_system_bus))
-    connection = dbus_bus_get (DBUS_BUS_SYSTEM, &derror);
+  if (STRINGP (bus))
+      connection = dbus_connection_open (SDATA (bus), &derror);
   else
-    connection = dbus_bus_get (DBUS_BUS_SESSION, &derror);
+    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))
-    XD_ERROR (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 (connection == NULL)
+  if (dbus_error_is_set (&derror))
+    {
+      if (raise_error)
+       XD_ERROR (derror);
+      else
+       connection = NULL;
+    }
+
+  if (connection == NULL && raise_error)
     XD_SIGNAL2 (build_string ("No connection to bus"), bus);
 
   /* Cleanup.  */
@@ -766,9 +803,7 @@ xd_initialize (bus)
 /* Add connection file descriptor to input_wait_mask, in order to
    let select() detect, whether a new message has been arrived.  */
 dbus_bool_t
-xd_add_watch (watch, data)
-     DBusWatch *watch;
-     void *data;
+xd_add_watch (DBusWatch *watch, void *data)
 {
   /* We check only for incoming data.  */
   if (dbus_watch_get_flags (watch) & DBUS_WATCH_READABLE)
@@ -795,11 +830,10 @@ xd_add_watch (watch, data)
 }
 
 /* Remove connection file descriptor from input_wait_mask.  DATA is
-   the used bus, either QCdbus_system_bus or QCdbus_session_bus.  */
+   the used bus, either a string or QCdbus_system_bus or
+   QCdbus_session_bus.  */
 void
-xd_remove_watch (watch, data)
-     DBusWatch *watch;
-     void *data;
+xd_remove_watch (DBusWatch *watch, void *data)
 {
   /* We check only for incoming data.  */
   if (dbus_watch_get_flags (watch) & DBUS_WATCH_READABLE)
@@ -833,18 +867,13 @@ 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.
-This is an internal function, it shall not be used outside dbus.el.  */)
-     (bus)
-     Lisp_Object bus;
+       doc: /* Initialize connection to D-Bus BUS.  */)
+  (Lisp_Object bus)
 {
   DBusConnection *connection;
 
-  /* Check parameters.  */
-  CHECK_SYMBOL (bus);
-
   /* Open a connection to the bus.  */
-  connection = xd_initialize (bus);
+  connection = xd_initialize (bus, TRUE);
 
   /* Add the watch functions.  We pass also the bus as data, in order
      to distinguish between the busses in xd_remove_watch.  */
@@ -854,6 +883,28 @@ This is an internal function, it shall not be used outside dbus.el.  */)
                                            NULL, (void*) XHASH (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);
+
+  /* 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);
+
   /* Return.  */
   return Qnil;
 }
@@ -861,17 +912,13 @@ This is an internal function, it shall not be used outside dbus.el.  */)
 DEFUN ("dbus-get-unique-name", Fdbus_get_unique_name, Sdbus_get_unique_name,
        1, 1, 0,
        doc: /* Return the unique name of Emacs registered at D-Bus BUS.  */)
-     (bus)
-     Lisp_Object bus;
+  (Lisp_Object bus)
 {
   DBusConnection *connection;
   const char *name;
 
-  /* Check parameters.  */
-  CHECK_SYMBOL (bus);
-
   /* Open a connection to the bus.  */
-  connection = xd_initialize (bus);
+  connection = xd_initialize (bus, TRUE);
 
   /* Request the name.  */
   name = dbus_bus_get_unique_name (connection);
@@ -885,7 +932,8 @@ DEFUN ("dbus-get-unique-name", Fdbus_get_unique_name, Sdbus_get_unique_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 the symbol `:system' or the symbol `:session'.
+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
@@ -950,9 +998,7 @@ object is returned instead of a list containing this single Lisp object.
   => "i686"
 
 usage: (dbus-call-method BUS SERVICE PATH INTERFACE METHOD &optional :timeout TIMEOUT &rest ARGS)  */)
-     (nargs, args)
-     int nargs;
-     register Lisp_Object *args;
+  (int nargs, register Lisp_Object *args)
 {
   Lisp_Object bus, service, path, interface, method;
   Lisp_Object result;
@@ -974,7 +1020,6 @@ usage: (dbus-call-method BUS SERVICE PATH INTERFACE METHOD &optional :timeout TI
   interface = args[3];
   method = args[4];
 
-  CHECK_SYMBOL (bus);
   CHECK_STRING (service);
   CHECK_STRING (path);
   CHECK_STRING (interface);
@@ -988,7 +1033,7 @@ usage: (dbus-call-method BUS SERVICE PATH INTERFACE METHOD &optional :timeout TI
                    SDATA (method));
 
   /* Open a connection to the bus.  */
-  connection = xd_initialize (bus);
+  connection = xd_initialize (bus, TRUE);
 
   /* Create the message.  */
   dmessage = dbus_message_new_method_call (SDATA (service),
@@ -1089,7 +1134,8 @@ 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 the symbol `:system' or the symbol `:session'.
+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
@@ -1134,9 +1180,7 @@ Example:
   -| i686
 
 usage: (dbus-call-method-asynchronously BUS SERVICE PATH INTERFACE METHOD HANDLER &optional :timeout TIMEOUT &rest ARGS)  */)
-     (nargs, args)
-     int nargs;
-     register Lisp_Object *args;
+  (int nargs, register Lisp_Object *args)
 {
   Lisp_Object bus, service, path, interface, method, handler;
   Lisp_Object result;
@@ -1157,7 +1201,6 @@ usage: (dbus-call-method-asynchronously BUS SERVICE PATH INTERFACE METHOD HANDLE
   method = args[4];
   handler = args[5];
 
-  CHECK_SYMBOL (bus);
   CHECK_STRING (service);
   CHECK_STRING (path);
   CHECK_STRING (interface);
@@ -1173,7 +1216,7 @@ usage: (dbus-call-method-asynchronously BUS SERVICE PATH INTERFACE METHOD HANDLE
                    SDATA (method));
 
   /* Open a connection to the bus.  */
-  connection = xd_initialize (bus);
+  connection = xd_initialize (bus, TRUE);
 
   /* Create the message.  */
   dmessage = dbus_message_new_method_call (SDATA (service),
@@ -1264,9 +1307,7 @@ DEFUN ("dbus-method-return-internal", Fdbus_method_return_internal,
 This is an internal function, it shall not be used outside dbus.el.
 
 usage: (dbus-method-return-internal BUS SERIAL SERVICE &rest ARGS)  */)
-     (nargs, args)
-     int nargs;
-     register Lisp_Object *args;
+  (int nargs, register Lisp_Object *args)
 {
   Lisp_Object bus, serial, service;
   struct gcpro gcpro1, gcpro2, gcpro3;
@@ -1282,7 +1323,6 @@ usage: (dbus-method-return-internal BUS SERIAL SERVICE &rest ARGS)  */)
   serial = args[1];
   service = args[2];
 
-  CHECK_SYMBOL (bus);
   CHECK_NUMBER (serial);
   CHECK_STRING (service);
   GCPRO3 (bus, serial, service);
@@ -1290,7 +1330,7 @@ usage: (dbus-method-return-internal BUS SERIAL SERVICE &rest ARGS)  */)
   XD_DEBUG_MESSAGE ("%lu %s ", (unsigned long) XUINT (serial), SDATA (service));
 
   /* Open a connection to the bus.  */
-  connection = xd_initialize (bus);
+  connection = xd_initialize (bus, TRUE);
 
   /* Create the message.  */
   dmessage = dbus_message_new (DBUS_MESSAGE_TYPE_METHOD_RETURN);
@@ -1358,9 +1398,7 @@ DEFUN ("dbus-method-error-internal", Fdbus_method_error_internal,
 This is an internal function, it shall not be used outside dbus.el.
 
 usage: (dbus-method-error-internal BUS SERIAL SERVICE &rest ARGS)  */)
-     (nargs, args)
-     int nargs;
-     register Lisp_Object *args;
+  (int nargs, register Lisp_Object *args)
 {
   Lisp_Object bus, serial, service;
   struct gcpro gcpro1, gcpro2, gcpro3;
@@ -1376,7 +1414,6 @@ usage: (dbus-method-error-internal BUS SERIAL SERVICE &rest ARGS)  */)
   serial = args[1];
   service = args[2];
 
-  CHECK_SYMBOL (bus);
   CHECK_NUMBER (serial);
   CHECK_STRING (service);
   GCPRO3 (bus, serial, service);
@@ -1384,7 +1421,7 @@ usage: (dbus-method-error-internal BUS SERIAL SERVICE &rest ARGS)  */)
   XD_DEBUG_MESSAGE ("%lu %s ", (unsigned long) XUINT (serial), SDATA (service));
 
   /* Open a connection to the bus.  */
-  connection = xd_initialize (bus);
+  connection = xd_initialize (bus, TRUE);
 
   /* Create the message.  */
   dmessage = dbus_message_new (DBUS_MESSAGE_TYPE_ERROR);
@@ -1449,7 +1486,8 @@ usage: (dbus-method-error-internal BUS SERIAL SERVICE &rest ARGS)  */)
 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 the symbol `:system' or the symbol `:session'.
+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
@@ -1475,9 +1513,7 @@ Example:
   "org.gnu.Emacs.FileManager" "FileModified" "/home/albinus/.emacs")
 
 usage: (dbus-send-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS)  */)
-     (nargs, args)
-     int nargs;
-     register Lisp_Object *args;
+  (int nargs, register Lisp_Object *args)
 {
   Lisp_Object bus, service, path, interface, signal;
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
@@ -1495,7 +1531,6 @@ usage: (dbus-send-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS)  */)
   interface = args[3];
   signal = args[4];
 
-  CHECK_SYMBOL (bus);
   CHECK_STRING (service);
   CHECK_STRING (path);
   CHECK_STRING (interface);
@@ -1509,7 +1544,7 @@ usage: (dbus-send-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS)  */)
                    SDATA (signal));
 
   /* Open a connection to the bus.  */
-  connection = xd_initialize (bus);
+  connection = xd_initialize (bus, TRUE);
 
   /* Create the message.  */
   dmessage = dbus_message_new_signal (SDATA (path),
@@ -1567,15 +1602,16 @@ usage: (dbus-send-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS)  */)
 }
 
 /* Check, whether there is pending input in the message queue of the
-   D-Bus BUS.  BUS is a Lisp symbol, either :system or :session.  */
+   D-Bus BUS.  BUS is either a Lisp symbol, :system or :session, or a
+   string denoting the bus address.  */
 int
-xd_get_dispatch_status (bus)
-     Lisp_Object bus;
+xd_get_dispatch_status (Lisp_Object bus)
 {
   DBusConnection *connection;
 
   /* Open a connection to the bus.  */
-  connection = xd_initialize (bus);
+  connection = xd_initialize (bus, FALSE);
+  if (connection == NULL) return FALSE;
 
   /* Non blocking read of the next available message.  */
   dbus_connection_read_write (connection, 0);
@@ -1587,27 +1623,33 @@ xd_get_dispatch_status (bus)
     ? TRUE : FALSE;
 }
 
-/* Check for queued incoming messages from the system and session buses.  */
+/* Check for queued incoming messages from the buses.  */
 int
-xd_pending_messages ()
+xd_pending_messages (void)
 {
+  Lisp_Object busp = Vdbus_registered_buses;
+
+  while (!NILP (busp))
+    {
+      /* We do not want to have an autolaunch for the session bus.  */
+      if (EQ ((CAR_SAFE (busp)), QCdbus_session_bus)
+         && getenv ("DBUS_SESSION_BUS_ADDRESS") == NULL)
+       continue;
+
+      if (xd_get_dispatch_status (CAR_SAFE (busp)))
+       return TRUE;
 
-  /* Vdbus_registered_objects_table will be initialized as hash table
-     in dbus.el.  When this package isn't loaded yet, it doesn't make
-     sense to handle D-Bus messages.  */
-  return (HASH_TABLE_P (Vdbus_registered_objects_table)
-         ? (xd_get_dispatch_status (QCdbus_system_bus)
-            || ((getenv ("DBUS_SESSION_BUS_ADDRESS") != NULL)
-                ? xd_get_dispatch_status (QCdbus_session_bus)
-                : FALSE))
-         : FALSE);
+      busp = CDR_SAFE (busp);
+    }
+
+  return FALSE;
 }
 
-/* Read queued incoming message of the D-Bus BUS.  BUS is a Lisp
-   symbol, either :system or :session.  */
+/* Read queued incoming message of the D-Bus BUS.  BUS is either a
+   Lisp symbol, :system or :session, or a string denoting the bus
+   address.  */
 static Lisp_Object
-xd_read_message (bus)
-     Lisp_Object bus;
+xd_read_message (Lisp_Object bus)
 {
   Lisp_Object args, key, value;
   struct gcpro gcpro1;
@@ -1620,7 +1662,7 @@ xd_read_message (bus)
   const char *uname, *path, *interface, *member;
 
   /* Open a connection to the bus.  */
-  connection = xd_initialize (bus);
+  connection = xd_initialize (bus, TRUE);
 
   /* Non blocking read of the next available message.  */
   dbus_connection_read_write (connection, 0);
@@ -1762,29 +1804,28 @@ xd_read_message (bus)
   RETURN_UNGCPRO (Qnil);
 }
 
-/* Read queued incoming messages from the system and session buses.  */
+/* Read queued incoming messages from all buses.  */
 void
-xd_read_queued_messages ()
+xd_read_queued_messages (void)
 {
+  Lisp_Object busp = Vdbus_registered_buses;
 
-  /* Vdbus_registered_objects_table will be initialized as hash table
-     in dbus.el.  When this package isn't loaded yet, it doesn't make
-     sense to handle D-Bus messages.  Furthermore, we ignore all Lisp
-     errors during the call.  */
-  if (HASH_TABLE_P (Vdbus_registered_objects_table))
+  xd_in_read_queued_messages = 1;
+  while (!NILP (busp))
     {
-      xd_in_read_queued_messages = 1;
-      internal_catch (Qdbus_error, xd_read_message, QCdbus_system_bus);
-      internal_catch (Qdbus_error, xd_read_message, QCdbus_session_bus);
-      xd_in_read_queued_messages = 0;
+      /* We ignore all Lisp errors during the call.  */
+      internal_catch (Qdbus_error, xd_read_message, CAR_SAFE (busp));
+      busp = CDR_SAFE (busp);
     }
+  xd_in_read_queued_messages = 0;
 }
 
 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 the symbol `:system' or the symbol `:session'.
+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
@@ -1819,9 +1860,7 @@ INTERFACE, SIGNAL and HANDLER must not be nil.  Example:
 `dbus-unregister-object' for removing the registration.
 
 usage: (dbus-register-signal BUS SERVICE PATH INTERFACE SIGNAL HANDLER &rest ARGS) */)
-     (nargs, args)
-     int nargs;
-     register Lisp_Object *args;
+  (int nargs, register Lisp_Object *args)
 {
   Lisp_Object bus, service, path, interface, signal, handler;
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6;
@@ -1840,7 +1879,6 @@ usage: (dbus-register-signal BUS SERVICE PATH INTERFACE SIGNAL HANDLER &rest ARG
   signal = args[4];
   handler = args[5];
 
-  CHECK_SYMBOL (bus);
   if (!NILP (service)) CHECK_STRING (service);
   if (!NILP (path)) CHECK_STRING (path);
   CHECK_STRING (interface);
@@ -1872,7 +1910,7 @@ usage: (dbus-register-signal BUS SERVICE PATH INTERFACE SIGNAL HANDLER &rest ARG
   if (NILP (uname) || (SBYTES (uname) > 0))
     {
       /* Open a connection to the bus.  */
-      connection = xd_initialize (bus);
+      connection = xd_initialize (bus, TRUE);
 
       /* Create a rule to receive related signals.  */
       sprintf (rule,
@@ -1933,7 +1971,8 @@ DEFUN ("dbus-register-method", Fdbus_register_method, Sdbus_register_method,
        6, 6, 0,
        doc: /* Register for method METHOD on the D-Bus BUS.
 
-BUS is either the symbol `:system' or the symbol `:session'.
+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.
@@ -1943,8 +1982,7 @@ 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.  */)
-     (bus, service, path, interface, method, handler)
-     Lisp_Object bus, service, path, interface, method, handler;
+  (Lisp_Object bus, Lisp_Object service, Lisp_Object path, Lisp_Object interface, Lisp_Object method, Lisp_Object handler)
 {
   Lisp_Object key, key1, value;
   DBusConnection *connection;
@@ -1952,7 +1990,6 @@ used for composing the returning D-Bus message.  */)
   DBusError derror;
 
   /* Check parameters.  */
-  CHECK_SYMBOL (bus);
   CHECK_STRING (service);
   CHECK_STRING (path);
   CHECK_STRING (interface);
@@ -1963,7 +2000,7 @@ used for composing the returning D-Bus message.  */)
      a segmentation fault.  */
 
   /* Open a connection to the bus.  */
-  connection = xd_initialize (bus);
+  connection = xd_initialize (bus, TRUE);
 
   /* Request the known name from the bus.  We can ignore the result,
      it is set to -1 if there is an error - kind of redundancy.  */
@@ -1990,13 +2027,17 @@ used for composing the returning D-Bus message.  */)
 
 \f
 void
-syms_of_dbusbind ()
+syms_of_dbusbind (void)
 {
 
   Qdbus_init_bus = intern_c_string ("dbus-init-bus");
   staticpro (&Qdbus_init_bus);
   defsubr (&Sdbus_init_bus);
 
+  Qdbus_close_bus = intern_c_string ("dbus-close-bus");
+  staticpro (&Qdbus_close_bus);
+  defsubr (&Sdbus_close_bus);
+
   Qdbus_get_unique_name = intern_c_string ("dbus-get-unique-name");
   staticpro (&Qdbus_get_unique_name);
   defsubr (&Sdbus_get_unique_name);
@@ -2093,18 +2134,25 @@ syms_of_dbusbind ()
   QCdbus_type_dict_entry = intern_c_string (":dict-entry");
   staticpro (&QCdbus_type_dict_entry);
 
+  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-registered-objects-table",
               &Vdbus_registered_objects_table,
     doc: /* Hash table of registered functions for D-Bus.
+
 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 the symbol `:system' or the symbol
-`:session'.  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.
+INTERFACE MEMBER).  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) ...).
@@ -2116,15 +2164,18 @@ 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.
 
-In the second case, the key in the hash table is the list (BUS SERIAL).
-BUS is either the symbol `:system' or the symbol `:session'.  SERIAL
-is the serial number of the non-blocking method call, a reply is
-expected.  Both arguments must not be nil.  The value in the hash
-table is HANDLER, the function to be called when the D-Bus reply
-message arrives.  */);
-  /* We initialize Vdbus_registered_objects_table in dbus.el, because
-     we need to define a hash table function first.  */
-  Vdbus_registered_objects_table = Qnil;
+In the second case, the key in the hash table is the 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
+non-blocking method call, a reply is expected.  Both arguments must
+not be nil.  The value in the hash table is HANDLER, the function to
+be called when the D-Bus reply message arrives.  */);
+  {
+    Lisp_Object args[2];
+    args[0] = QCtest;
+    args[1] = Qequal;
+    Vdbus_registered_objects_table = Fmake_hash_table (2, args);
+  }
 
   DEFVAR_LISP ("dbus-debug", &Vdbus_debug,
     doc: /* If non-nil, debug messages of D-Bus bindings are raised.  */);
diff --git a/src/deps.mk b/src/deps.mk
new file mode 100644 (file)
index 0000000..d00be96
--- /dev/null
@@ -0,0 +1,280 @@
+### deps.mk --- src/Makefile fragment for GNU Emacs
+
+## Copyright (C) 1985, 1987, 1988, 1993, 1994, 1995, 1999, 2000, 2001, 2002,
+##   2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+##   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/>.
+
+## Commentary:
+## 
+## This file is inserted in src/Makefile if AUTO_DEPEND=no.
+## It defines static dependencies between the various source files.
+
+## FIXME some of these dependencies are platform-specific.
+## Eg callproc.c only depends on w32.h for WINDOWSNT builds.
+## One way to fix this would be to replace w32.h (etc) by $(W32_H),
+## a variable set by configure.  Does not seem worth the trouble.
+## Since the w32 build does not even use this file, you might ask
+## why these dependencies are here at all...
+
+## nsgui.h: In fact, every .o file depends directly or indirectly on
+## dispextern.h and hence nsgui.h under NS.  But the ones that actually
+## use stuff there are more limited.
+
+### Code:
+
+atimer.o: atimer.c atimer.h syssignal.h systime.h lisp.h blockinput.h \
+ $(config_h)
+bidi.o: bidi.c buffer.h character.h dispextern.h lisp.h \
+   biditype.h bidimirror.h $(config_h)
+buffer.o: buffer.c buffer.h region-cache.h commands.h window.h \
+   $(INTERVALS_H) blockinput.h atimer.h systime.h character.h \
+   indent.h keyboard.h coding.h keymap.h frame.h lisp.h $(config_h)
+callint.o: callint.c window.h commands.h buffer.h keymap.h \
+   keyboard.h dispextern.h systime.h coding.h composite.h lisp.h $(config_h)
+callproc.o: callproc.c epaths.h buffer.h commands.h lisp.h $(config_h) \
+   process.h systty.h syssignal.h character.h coding.h ccl.h msdos.h \
+   composite.h w32.h blockinput.h atimer.h systime.h frame.h termhooks.h \
+   buffer.h
+casefiddle.o: casefiddle.c syntax.h commands.h buffer.h character.h \
+   composite.h keymap.h lisp.h $(config_h)
+casetab.o: casetab.c buffer.h character.h lisp.h $(config_h)
+category.o: category.c category.h buffer.h charset.h keymap.h  \
+   character.h lisp.h $(config_h)
+ccl.o: ccl.c ccl.h charset.h character.h coding.h composite.h lisp.h $(config_h)
+character.o: character.c character.h buffer.h charset.h composite.h disptab.h \
+   lisp.h $(config_h)
+charset.o: charset.c charset.h character.h buffer.h coding.h composite.h \
+   disptab.h lisp.h $(config_h)
+chartab.o: charset.h character.h ccl.h lisp.h $(config_h)
+coding.o: coding.c coding.h ccl.h buffer.h character.h charset.h composite.h \
+   window.h dispextern.h frame.h termhooks.h lisp.h $(config_h)
+cm.o: cm.c frame.h cm.h termhooks.h termchar.h dispextern.h lisp.h $(config_h)
+cmds.o: cmds.c syntax.h buffer.h character.h commands.h window.h lisp.h \
+   $(config_h) msdos.h dispextern.h keyboard.h keymap.h systime.h \
+   coding.h frame.h composite.h
+pre-crt0.o: pre-crt0.c
+dbusbind.o: dbusbind.c termhooks.h frame.h keyboard.h lisp.h $(config_h)
+dired.o: dired.c commands.h buffer.h lisp.h $(config_h) character.h charset.h \
+   coding.h regex.h systime.h blockinput.h atimer.h composite.h
+dispnew.o: dispnew.c systime.h commands.h process.h frame.h coding.h \
+   window.h buffer.h termchar.h termopts.h termhooks.h cm.h \
+   disptab.h indent.h $(INTERVALS_H) nsgui.h \
+   xterm.h blockinput.h atimer.h character.h msdos.h keyboard.h \
+   syssignal.h lisp.h $(config_h)
+doc.o: doc.c lisp.h $(config_h) epaths.h buffer.h keyboard.h keymap.h \
+   character.h systime.h coding.h composite.h
+doprnt.o: doprnt.c character.h lisp.h $(config_h)
+dosfns.o: buffer.h termchar.h termhooks.h frame.h blockinput.h window.h \
+   msdos.h dosfns.h dispextern.h charset.h coding.h atimer.h systime.h \
+   lisp.h $(config_h)
+editfns.o: editfns.c window.h buffer.h systime.h $(INTERVALS_H) character.h \
+   coding.h frame.h blockinput.h atimer.h lisp.h $(config_h)
+emacs.o: emacs.c commands.h systty.h syssignal.h blockinput.h process.h \
+   termhooks.h buffer.h atimer.h systime.h $(INTERVALS_H) lisp.h $(config_h) \
+   window.h dispextern.h keyboard.h keymap.h frame.h coding.h
+fileio.o: fileio.c window.h buffer.h systime.h $(INTERVALS_H) character.h \
+   coding.h msdos.h blockinput.h atimer.h lisp.h $(config_h) frame.h commands.h
+filelock.o: filelock.c buffer.h character.h coding.h systime.h composite.h \
+   lisp.h $(config_h)
+filemode.o: filemode.c $(config_h)
+frame.o: frame.c xterm.h window.h frame.h termhooks.h commands.h keyboard.h \
+   blockinput.h atimer.h systime.h buffer.h character.h fontset.h font.h    \
+   msdos.h dosfns.h dispextern.h w32term.h nsgui.h termchar.h coding.h \
+   composite.h lisp.h $(config_h) termhooks.h ccl.h
+fringe.o: fringe.c dispextern.h nsgui.h frame.h window.h buffer.h termhooks.h \
+   blockinput.h atimer.h systime.h lisp.h $(config_h)
+font.o: font.c dispextern.h frame.h window.h ccl.h character.h charset.h \
+   font.h lisp.h $(config_h) buffer.h composite.h fontset.h xterm.h nsgui.h
+ftfont.o: dispextern.h frame.h character.h charset.h composite.h font.h \
+   lisp.h $(config_h) blockinput.h atimer.h systime.h coding.h fontset.h \
+   ccl.h ftfont.h
+fontset.o: fontset.c fontset.h ccl.h buffer.h character.h \
+   charset.h frame.h keyboard.h termhooks.h font.h lisp.h $(config_h) \
+   blockinput.h atimer.h systime.h coding.h $(INTERVALS_H) nsgui.h \
+   window.h xterm.h
+getloadavg.o: getloadavg.c $(config_h)
+gtkutil.o: gtkutil.c gtkutil.h xterm.h lisp.h frame.h lisp.h $(config_h) \
+   blockinput.h window.h atimer.h systime.h termhooks.h keyboard.h \
+   charset.h coding.h syssignal.h dispextern.h composite.h
+image.o: image.c frame.h window.h dispextern.h blockinput.h atimer.h \
+   systime.h xterm.h w32term.h w32gui.h font.h epaths.h character.h coding.h \
+   nsterm.h nsgui.h lisp.h $(config_h) composite.h termhooks.h ccl.h
+indent.o: indent.c frame.h window.h indent.h buffer.h lisp.h $(config_h) \
+   termchar.h termopts.h disptab.h region-cache.h character.h category.h \
+   keyboard.h systime.h coding.h $(INTERVALS_H)
+insdel.o: insdel.c window.h buffer.h $(INTERVALS_H) blockinput.h character.h \
+   dispextern.h atimer.h systime.h region-cache.h lisp.h $(config_h)
+keyboard.o: keyboard.c termchar.h termhooks.h termopts.h buffer.h character.h \
+   commands.h frame.h window.h macros.h disptab.h keyboard.h syssignal.h \
+   systime.h syntax.h $(INTERVALS_H) blockinput.h atimer.h composite.h \
+   xterm.h puresize.h msdos.h keymap.h w32term.h nsterm.h nsgui.h coding.h \
+   lisp.h $(config_h)
+keymap.o: keymap.c buffer.h commands.h keyboard.h termhooks.h blockinput.h \
+   atimer.h systime.h puresize.h character.h charset.h $(INTERVALS_H) \
+   keymap.h window.h coding.h frame.h lisp.h $(config_h)
+lastfile.o: lastfile.c $(config_h)
+macros.o: macros.c window.h buffer.h commands.h macros.h keyboard.h \
+   dispextern.h lisp.h $(config_h) systime.h coding.h composite.h
+gmalloc.o: gmalloc.c $(config_h)
+ralloc.o: ralloc.c lisp.h $(config_h)
+vm-limit.o: vm-limit.c mem-limits.h lisp.h $(config_h)
+marker.o: marker.c buffer.h character.h lisp.h $(config_h)
+md5.o: md5.c md5.h $(config_h)
+minibuf.o: minibuf.c syntax.h frame.h window.h keyboard.h systime.h \
+   buffer.h commands.h character.h msdos.h $(INTERVALS_H) keymap.h \
+   termhooks.h lisp.h $(config_h) coding.h
+mktime.o: mktime.c $(config_h)
+msdos.o: msdos.c msdos.h dosfns.h systime.h termhooks.h dispextern.h frame.h \
+   termopts.h termchar.h character.h coding.h ccl.h disptab.h window.h \
+   keyboard.h $(INTERVALS_H) buffer.h commands.h blockinput.h atimer.h \
+   lisp.h sysselect.h $(config_h)
+nsfns.o: nsfns.m charset.h nsterm.h nsgui.h frame.h window.h buffer.h \
+   dispextern.h fontset.h $(INTERVALS_H) keyboard.h blockinput.h \
+   atimer.h systime.h epaths.h termhooks.h coding.h systime.h lisp.h $(config_h)
+nsfont.o: nsterm.h dispextern.h frame.h lisp.h lisp.h $(config_h)
+nsimage.o: nsimage.m nsterm.h lisp.h $(config_h)
+nsmenu.o: nsmenu.m termhooks.h frame.h window.h dispextern.h \
+   nsgui.h keyboard.h blockinput.h atimer.h systime.h buffer.h \
+   nsterm.h lisp.h $(config_h)
+nsterm.o: nsterm.m blockinput.h atimer.h systime.h syssignal.h nsterm.h \
+   nsgui.h frame.h charset.h ccl.h dispextern.h fontset.h termhooks.h \
+   termopts.h termchar.h disptab.h buffer.h window.h keyboard.h \
+   $(INTERVALS_H) process.h coding.h lisp.h $(config_h)
+nsselect.o: nsselect.m blockinput.h nsterm.h nsgui.h frame.h lisp.h $(config_h)
+process.o: process.c process.h buffer.h window.h termhooks.h termopts.h \
+   commands.h syssignal.h systime.h systty.h syswait.h frame.h dispextern.h \
+   blockinput.h atimer.h charset.h coding.h ccl.h msdos.h composite.h \
+   keyboard.h lisp.h $(config_h) character.h xgselect.h sysselect.h
+regex.o: regex.c syntax.h buffer.h lisp.h $(config_h) regex.h \
+   category.h character.h
+region-cache.o: region-cache.c buffer.h region-cache.h lisp.h $(config_h)
+scroll.o: scroll.c termchar.h dispextern.h frame.h msdos.h keyboard.h \
+   termhooks.h lisp.h $(config_h) systime.h coding.h composite.h window.h
+search.o: search.c regex.h commands.h buffer.h region-cache.h syntax.h \
+   blockinput.h atimer.h systime.h category.h character.h charset.h \
+   $(INTERVALS_H) \
+   lisp.h $(config_h)
+sound.o: sound.c dispextern.h syssignal.h lisp.h $(config_h) atimer.h systime.h
+strftime.o: strftime.c $(config_h)
+syntax.o: syntax.c syntax.h buffer.h commands.h category.h character.h \
+   keymap.h regex.h $(INTERVALS_H) lisp.h $(config_h)
+sysdep.o: sysdep.c syssignal.h systty.h systime.h syswait.h blockinput.h \
+   process.h dispextern.h termhooks.h termchar.h termopts.h coding.h \
+   frame.h atimer.h window.h msdos.h dosfns.h keyboard.h cm.h lisp.h \
+   $(config_h) composite.h sysselect.h
+term.o: term.c termchar.h termhooks.h termopts.h lisp.h $(config_h) \
+   cm.h frame.h disptab.h keyboard.h character.h charset.h coding.h ccl.h \
+   xterm.h msdos.h window.h keymap.h blockinput.h atimer.h systime.h \
+   systty.h syssignal.h $(INTERVALS_H) buffer.h
+termcap.o: termcap.c lisp.h $(config_h)
+terminal.o: terminal.c frame.h termchar.h termhooks.h charset.h coding.h \
+   keyboard.h lisp.h $(config_h) dispextern.h composite.h systime.h
+terminfo.o: terminfo.c lisp.h $(config_h)
+tparam.o: tparam.c lisp.h $(config_h)
+undo.o: undo.c buffer.h commands.h window.h dispextern.h lisp.h $(config_h)
+unexaix.o: unexaix.c lisp.h $(config_h)
+unexalpha.o: unexalpha.c $(config_h)
+unexcw.o: unexcw.c lisp.h $(config_h)
+unexcoff.o: unexcoff.c lisp.h $(config_h)
+unexelf.o: unexelf.c $(config_h)
+unexhp9k800.o: unexhp9k800.c $(config_h)
+unexmacosx.o: unexmacosx.c $(config_h)
+unexsol.o: unexsol.c lisp.h $(config_h)
+unexw32.o: unexw32.c $(config_h)
+w16select.o: w16select.c dispextern.h frame.h blockinput.h atimer.h systime.h \
+   msdos.h buffer.h charset.h coding.h composite.h lisp.h $(config_h)
+widget.o: widget.c xterm.h frame.h dispextern.h widgetprv.h \
+   $(srcdir)/../lwlib/lwlib.h lisp.h $(config_h)
+window.o: window.c indent.h commands.h frame.h window.h buffer.h termchar.h \
+   disptab.h keyboard.h msdos.h coding.h termhooks.h \
+   keymap.h blockinput.h atimer.h systime.h $(INTERVALS_H) \
+   xterm.h w32term.h nsterm.h nsgui.h lisp.h $(config_h)
+xdisp.o: xdisp.c macros.h commands.h process.h indent.h buffer.h dispextern.h \
+   coding.h termchar.h frame.h window.h disptab.h termhooks.h character.h \
+   charset.h lisp.h $(config_h) keyboard.h $(INTERVALS_H) region-cache.h \
+   xterm.h w32term.h nsterm.h nsgui.h msdos.h composite.h fontset.h ccl.h \
+   blockinput.h atimer.h systime.h keymap.h font.h
+xfaces.o: xfaces.c dispextern.h frame.h xterm.h buffer.h blockinput.h  \
+   window.h character.h charset.h msdos.h dosfns.h composite.h atimer.h        \
+   systime.h keyboard.h fontset.h w32term.h nsterm.h coding.h ccl.h \
+   $(INTERVALS_H) nsgui.h termchar.h termhooks.h font.h lisp.h $(config_h)
+xfns.o: xfns.c buffer.h frame.h window.h keyboard.h xterm.h dispextern.h \
+   $(srcdir)/../lwlib/lwlib.h blockinput.h atimer.h systime.h epaths.h \
+   character.h charset.h coding.h gtkutil.h lisp.h $(config_h) termhooks.h \
+   fontset.h termchar.h font.h xsettings.h $(INTERVALS_H) ccl.h
+xfont.o: dispextern.h xterm.h frame.h blockinput.h character.h charset.h \
+   font.h lisp.h $(config_h) atimer.h systime.h fontset.h ccl.h
+xftfont.o: dispextern.h xterm.h frame.h blockinput.h character.h charset.h \
+   font.h lisp.h $(config_h) atimer.h systime.h fontset.h ccl.h ftfont.h
+ftxfont.o: dispextern.h xterm.h frame.h blockinput.h character.h charset.h \
+   font.h lisp.h $(config_h) atimer.h systime.h fontset.h ccl.h
+menu.o: menu.c lisp.h keyboard.h keymap.h frame.h termhooks.h blockinput.h \
+   dispextern.h $(srcdir)/../lwlib/lwlib.h xterm.h gtkutil.h menu.h \
+   lisp.h $(config_h) systime.h coding.h composite.h window.h atimer.h nsgui.h
+xmenu.o: xmenu.c xterm.h termhooks.h window.h dispextern.h frame.h buffer.h \
+   charset.h keyboard.h $(srcdir)/../lwlib/lwlib.h blockinput.h atimer.h \
+   systime.h gtkutil.h msdos.h coding.h menu.h lisp.h $(config_h) composite.h \
+   keymap.h sysselect.h
+xterm.o: xterm.c xterm.h termhooks.h termopts.h termchar.h window.h buffer.h \
+   dispextern.h frame.h disptab.h blockinput.h atimer.h systime.h syssignal.h \
+   keyboard.h emacs-icon.h character.h charset.h ccl.h fontset.h composite.h \
+   coding.h process.h gtkutil.h font.h fontset.h lisp.h $(config_h) \
+   xsettings.h intervals.h keymap.h xgselect.h sysselect.h
+xselect.o: xselect.c process.h dispextern.h frame.h xterm.h blockinput.h \
+   buffer.h atimer.h systime.h termhooks.h lisp.h $(config_h) keyboard.h \
+   coding.h composite.h
+xgselect.o: xgselect.h systime.h sysselect.h lisp.h $(config_h)
+xrdb.o: xrdb.c lisp.h $(config_h) epaths.h
+xsmfns.o: xsmfns.c lisp.h $(config_h) systime.h sysselect.h termhooks.h \
+   xterm.h lisp.h termopts.h frame.h dispextern.h
+xsettings.o: xterm.h xsettings.h lisp.h frame.h termhooks.h $(config_h) \
+   dispextern.h keyboard.h systime.h coding.h composite.h blockinput.h \
+   atimer.h termopts.h
+
+## The files of Lisp proper.
+alloc.o: alloc.c process.h frame.h window.h buffer.h  puresize.h syssignal.h \
+   keyboard.h blockinput.h atimer.h systime.h character.h lisp.h $(config_h) \
+   $(INTERVALS_H) termhooks.h
+bytecode.o: bytecode.c buffer.h syntax.h character.h window.h dispextern.h \
+  frame.h xterm.h lisp.h $(config_h)
+data.o: data.c buffer.h puresize.h character.h syssignal.h keyboard.h frame.h \
+   termhooks.h systime.h coding.h composite.h dispextern.h font.h ccl.h \
+   lisp.h $(config_h)
+eval.o: eval.c commands.h keyboard.h blockinput.h atimer.h systime.h \
+   dispextern.h lisp.h $(config_h) coding.h composite.h xterm.h
+floatfns.o: floatfns.c syssignal.h lisp.h $(config_h)
+fns.o: fns.c commands.h lisp.h $(config_h) frame.h buffer.h character.h \
+   keyboard.h keymap.h window.h dispextern.h $(INTERVALS_H) coding.h md5.h \
+   blockinput.h atimer.h systime.h xterm.h
+print.o: print.c process.h frame.h window.h buffer.h keyboard.h character.h \
+   lisp.h $(config_h) termchar.h $(INTERVALS_H) msdos.h termhooks.h \
+   blockinput.h atimer.h systime.h font.h charset.h coding.h ccl.h
+lread.o: lread.c commands.h keyboard.h buffer.h epaths.h character.h \
+   charset.h lisp.h $(config_h) $(INTERVALS_H) termhooks.h coding.h msdos.h \
+   systime.h frame.h blockinput.h atimer.h
+
+## Text properties support.
+composite.o: composite.c buffer.h character.h coding.h font.h ccl.h \
+   frame.h termhooks.h $(INTERVALS_H) window.h lisp.h $(config_h)
+intervals.o: intervals.c buffer.h $(INTERVALS_H) keyboard.h puresize.h \
+   keymap.h lisp.h $(config_h) systime.h coding.h
+textprop.o: textprop.c buffer.h window.h $(INTERVALS_H) \
+   lisp.h $(config_h)
+
+
+### deps.mk ends here
index 92a768da5be23195854dc82beba4be43de7297d2..d72ea54a5185a9d60c7e3da6613abf64c8c4bba5 100644 (file)
@@ -48,29 +48,22 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    Since applying strlen to the name always works, we'll just do that.  */
 #define NAMLEN(p) strlen (p->d_name)
 
-#ifdef SYSV_SYSTEM_DIR
+#ifdef HAVE_DIRENT_H
 
 #include <dirent.h>
 #define DIRENTRY struct dirent
 
-#else /* not SYSV_SYSTEM_DIR */
+#else /* not HAVE_DIRENT_H */
 
-#ifdef MSDOS
-#include <dirent.h>
-#else
 #include <sys/dir.h>
-#endif
-
 #include <sys/stat.h>
 
-#ifndef MSDOS
 #define DIRENTRY struct direct
 
-extern DIR *opendir ();
-extern struct direct *readdir ();
+extern DIR *opendir (char *);
+extern struct direct *readdir (DIR *);
 
-#endif /* not MSDOS */
-#endif /* not SYSV_SYSTEM_DIR */
+#endif /* HAVE_DIRENT_H */
 
 #ifdef MSDOS
 #define DIRENTRY_NONEMPTY(p) ((p)->d_name[0] != 0)
@@ -89,10 +82,12 @@ extern struct direct *readdir ();
 #include "blockinput.h"
 
 /* Returns a search buffer, with a fastmap allocated and ready to go.  */
-extern struct re_pattern_buffer *compile_pattern ();
+extern struct re_pattern_buffer *compile_pattern (Lisp_Object,
+                                                 struct re_registers *,
+                                                 Lisp_Object, int, int);
 
 /* From filemode.c.  Can't go in Lisp.h because of `stat'.  */
-extern void filemodestring P_ ((struct stat *, char *));
+extern void filemodestring (struct stat *, char *);
 
 /* if system does not have symbolic links, it does not have lstat.
    In that case, use ordinary stat instead.  */
@@ -101,9 +96,6 @@ extern void filemodestring P_ ((struct stat *, char *));
 #define lstat stat
 #endif
 
-extern int completion_ignore_case;
-extern Lisp_Object Qcompletion_ignore_case;
-extern Lisp_Object Vcompletion_regexp_list;
 extern Lisp_Object Vw32_get_true_file_attributes;
 
 Lisp_Object Vcompletion_ignored_extensions;
@@ -114,7 +106,7 @@ Lisp_Object Qfile_name_all_completions;
 Lisp_Object Qfile_attributes;
 Lisp_Object Qfile_attributes_lessp;
 
-static int scmp P_ ((unsigned char *, unsigned char *, int));
+static int scmp (const unsigned char *, const unsigned char *, int);
 \f
 #ifdef WINDOWSNT
 Lisp_Object
@@ -126,8 +118,7 @@ directory_files_internal_w32_unwind (Lisp_Object arg)
 #endif
 
 Lisp_Object
-directory_files_internal_unwind (dh)
-     Lisp_Object dh;
+directory_files_internal_unwind (Lisp_Object dh)
 {
   DIR *d = (DIR *) XSAVE_VALUE (dh)->pointer;
   BLOCK_INPUT;
@@ -142,10 +133,7 @@ directory_files_internal_unwind (dh)
    In the latter case, ID_FORMAT is passed to Ffile_attributes.  */
 
 Lisp_Object
-directory_files_internal (directory, full, match, nosort, attrs, id_format)
-     Lisp_Object directory, full, match, nosort;
-     int attrs;
-     Lisp_Object id_format;
+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;
@@ -209,7 +197,6 @@ directory_files_internal (directory, full, match, nosort, attrs, id_format)
 #ifdef WINDOWSNT
   if (attrs)
     {
-      extern Lisp_Object Qlocal;
       extern int is_slow_fs (const char *);
 
       /* Do this only once to avoid doing it (in w32.c:stat) for each
@@ -292,15 +279,14 @@ directory_files_internal (directory, full, match, nosort, attrs, id_format)
                  int nchars;
 
                  fullname = make_uninit_multibyte_string (nbytes, nbytes);
-                 bcopy (SDATA (directory), SDATA (fullname),
-                        directory_nbytes);
+                 memcpy (SDATA (fullname), SDATA (directory),
+                         directory_nbytes);
 
                  if (needsep)
                    SSET (fullname, directory_nbytes, DIRECTORY_SEP);
 
-                 bcopy (SDATA (name),
-                        SDATA (fullname) + directory_nbytes + needsep,
-                        len);
+                 memcpy (SDATA (fullname) + directory_nbytes + needsep,
+                         SDATA (name), len);
 
                  nchars = chars_in_text (SDATA (fullname), nbytes);
 
@@ -370,8 +356,7 @@ If MATCH is non-nil, mention only file names that match the regexp MATCH.
 If NOSORT is non-nil, the list is not sorted--its order is unpredictable.
  Otherwise, the list returned is sorted with `string-lessp'.
  NOSORT is useful if you plan to sort the result yourself.  */)
-     (directory, full, match, nosort)
-     Lisp_Object directory, full, match, nosort;
+  (Lisp_Object directory, Lisp_Object full, Lisp_Object match, Lisp_Object nosort)
 {
   Lisp_Object handler;
   directory = Fexpand_file_name (directory, Qnil);
@@ -399,8 +384,7 @@ ID-FORMAT specifies the preferred format of attributes uid and gid, see
 `file-attributes' for further documentation.
 On MS-Windows, performance depends on `w32-get-true-file-attributes',
 which see.  */)
-     (directory, full, match, nosort, id_format)
-     Lisp_Object directory, full, match, nosort, id_format;
+  (Lisp_Object directory, Lisp_Object full, Lisp_Object match, Lisp_Object nosort, Lisp_Object id_format)
 {
   Lisp_Object handler;
   directory = Fexpand_file_name (directory, Qnil);
@@ -416,7 +400,7 @@ which see.  */)
 }
 
 \f
-Lisp_Object file_name_completion ();
+Lisp_Object file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int ver_flag, Lisp_Object predicate);
 
 DEFUN ("file-name-completion", Ffile_name_completion, Sfile_name_completion,
        2, 3, 0,
@@ -431,8 +415,7 @@ completion (in absolute form) and ignore it if PREDICATE returns nil.
 
 This function ignores some of the possible completions as
 determined by the variable `completion-ignored-extensions', which see.  */)
-     (file, directory, predicate)
-     Lisp_Object file, directory, predicate;
+  (Lisp_Object file, Lisp_Object directory, Lisp_Object predicate)
 {
   Lisp_Object handler;
 
@@ -455,8 +438,7 @@ DEFUN ("file-name-all-completions", Ffile_name_all_completions,
        Sfile_name_all_completions, 2, 2, 0,
        doc: /* Return a list of all completions of file name FILE in directory DIRECTORY.
 These are all file names in directory DIRECTORY which begin with FILE.  */)
-     (file, directory)
-     Lisp_Object file, directory;
+  (Lisp_Object file, Lisp_Object directory)
 {
   Lisp_Object handler;
 
@@ -475,14 +457,11 @@ These are all file names in directory DIRECTORY which begin with FILE.  */)
   return file_name_completion (file, directory, 1, 0, Qnil);
 }
 
-static int file_name_completion_stat ();
+static int file_name_completion_stat (Lisp_Object dirname, DIRENTRY *dp, struct stat *st_addr);
 Lisp_Object Qdefault_directory;
 
 Lisp_Object
-file_name_completion (file, dirname, all_flag, ver_flag, predicate)
-     Lisp_Object file, dirname;
-     int all_flag, ver_flag;
-     Lisp_Object predicate;
+file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int ver_flag, Lisp_Object predicate)
 {
   DIR *d;
   int bestmatchsize = 0;
@@ -824,9 +803,7 @@ file_name_completion (file, dirname, all_flag, ver_flag, predicate)
    else number of chars that match at the beginning.  */
 
 static int
-scmp (s1, s2, len)
-     register unsigned char *s1, *s2;
-     int len;
+scmp (const unsigned char *s1, const unsigned char *s2, int len)
 {
   register int l = len;
 
@@ -847,10 +824,7 @@ scmp (s1, s2, len)
 }
 
 static int
-file_name_completion_stat (dirname, dp, st_addr)
-     Lisp_Object dirname;
-     DIRENTRY *dp;
-     struct stat *st_addr;
+file_name_completion_stat (Lisp_Object dirname, DIRENTRY *dp, struct stat *st_addr)
 {
   int len = NAMLEN (dp);
   int pos = SCHARS (dirname);
@@ -858,7 +832,6 @@ file_name_completion_stat (dirname, dp, st_addr)
   char *fullname = (char *) alloca (len + pos + 2);
 
 #ifdef MSDOS
-#if __DJGPP__ > 1
   /* Some fields of struct stat are *very* expensive to compute on MS-DOS,
      but aren't required here.  Avoid computing the following fields:
      st_inode, st_size and st_nlink for directories, and the execute bits
@@ -867,14 +840,13 @@ file_name_completion_stat (dirname, dp, st_addr)
   unsigned short save_djstat_flags = _djstat_flags;
 
   _djstat_flags = _STAT_INODE | _STAT_EXEC_MAGIC | _STAT_DIRSIZE;
-#endif /* __DJGPP__ > 1 */
 #endif /* MSDOS */
 
-  bcopy (SDATA (dirname), fullname, pos);
+  memcpy (fullname, SDATA (dirname), pos);
   if (!IS_DIRECTORY_SEP (fullname[pos - 1]))
     fullname[pos++] = DIRECTORY_SEP;
 
-  bcopy (dp->d_name, fullname + pos, len);
+  memcpy (fullname + pos, dp->d_name, len);
   fullname[pos + len] = 0;
 
 #ifdef S_IFLNK
@@ -887,17 +859,14 @@ file_name_completion_stat (dirname, dp, st_addr)
 #else
   value = stat (fullname, st_addr);
 #ifdef MSDOS
-#if __DJGPP__ > 1
   _djstat_flags = save_djstat_flags;
-#endif /* __DJGPP__ > 1 */
 #endif /* MSDOS */
   return value;
 #endif /* S_IFLNK */
 }
 \f
 Lisp_Object
-make_time (time)
-     time_t time;
+make_time (time_t time)
 {
   return Fcons (make_number (time >> 16),
                Fcons (make_number (time & 0177777), Qnil));
@@ -976,16 +945,15 @@ which see.
 
 On some FAT-based filesystems, only the date of last access is recorded,
 so last access time will always be midnight of that day.  */)
-     (filename, id_format)
-     Lisp_Object filename, id_format;
+  (Lisp_Object filename, Lisp_Object id_format)
 {
   Lisp_Object values[12];
   Lisp_Object encoded;
   struct stat s;
-#if defined (BSD4_2) || defined (BSD4_3)
+#ifdef BSD4_2
   Lisp_Object dirname;
   struct stat sdir;
-#endif
+#endif /* BSD4_2 */
   char modes[10];
   Lisp_Object handler;
   struct gcpro gcpro1;
@@ -1052,7 +1020,7 @@ so last access time will always be midnight of that day.  */)
 
   filemodestring (&s, modes);
   values[8] = make_string (modes, 10);
-#if defined (BSD4_2) || defined (BSD4_3) /* file gid will be dir gid */
+#ifdef BSD4_2 /* file gid will be dir gid */
   dirname = Ffile_name_directory (filename);
   if (! NILP (dirname))
     encoded = ENCODE_FILE (dirname);
@@ -1062,7 +1030,7 @@ so last access time will always be midnight of that day.  */)
     values[9] = Qt;
 #else                                  /* file gid will be egid */
   values[9] = (s.st_gid != getegid ()) ? Qt : Qnil;
-#endif /* BSD4_2 (or BSD4_3) */
+#endif /* not BSD4_2 */
   if (!FIXNUM_OVERFLOW_P (s.st_ino))
     /* Keep the most common cases as integers.  */
     values[10] = make_number (s.st_ino);
@@ -1099,14 +1067,13 @@ so last access time will always be midnight of that day.  */)
 DEFUN ("file-attributes-lessp", Ffile_attributes_lessp, Sfile_attributes_lessp, 2, 2, 0,
        doc: /* Return t if first arg file attributes list is less than second.
 Comparison is in lexicographic order and case is significant.  */)
-     (f1, f2)
-     Lisp_Object f1, f2;
+  (Lisp_Object f1, Lisp_Object f2)
 {
   return Fstring_lessp (Fcar (f1), Fcar (f2));
 }
 \f
 void
-syms_of_dired ()
+syms_of_dired (void)
 {
   Qdirectory_files = intern_c_string ("directory-files");
   Qdirectory_files_and_attributes = intern_c_string ("directory-files-and-attributes");
index 076d9055859e4f21c98e04721d809c2bce0b7e39..5138958b6db8a8adb3b08862d15bfc16038570a1 100644 (file)
@@ -372,6 +372,16 @@ struct glyph
   /* Non-zero means don't display cursor here.  */
   unsigned avoid_cursor_p : 1;
 
+  /* Resolved bidirectional level of this character [0..63].  */
+  unsigned resolved_level : 5;
+
+  /* Resolved bidirectional type of this character, see enum
+     bidi_type_t below.  Note that according to UAX#9, only some
+     values (STRONG_L, STRONG_R, WEAK_AN, WEAK_EN, WEAK_BN, and
+     NEUTRAL_B) can appear in the resolved type, so we only reserve
+     space for those that can.  */
+  unsigned bidi_type : 3;
+
 #define FACE_ID_BITS   20
 
   /* Face of the glyph.  This is a realized face ID,
@@ -634,7 +644,7 @@ struct glyph_matrix
    This aborts if any pointer is found twice.  */
 
 #if GLYPH_DEBUG
-void check_matrix_pointer_lossage P_ ((struct glyph_matrix *));
+void check_matrix_pointer_lossage (struct glyph_matrix *);
 #define CHECK_MATRIX(MATRIX) check_matrix_pointer_lossage ((MATRIX))
 #else
 #define CHECK_MATRIX(MATRIX) (void) 0
@@ -740,17 +750,29 @@ struct glyph_row
 
   /* First position in this row.  This is the text position, including
      overlay position information etc, where the display of this row
-     started, and can thus be less the position of the first glyph
-     (e.g. due to invisible text or horizontal scrolling).  */
+     started, and can thus be less than the position of the first
+     glyph (e.g. due to invisible text or horizontal scrolling).
+     BIDI Note: In R2L rows, that have its reversed_p flag set, this
+     position is at or beyond the right edge of the row.  */
   struct display_pos start;
 
   /* Text position at the end of this row.  This is the position after
      the last glyph on this row.  It can be greater than the last
-     glyph position + 1, due to truncation, invisible text etc.  In an
-     up-to-date display, this should always be equal to the start
-     position of the next row.  */
+     glyph position + 1, due to a newline that ends the line,
+     truncation, invisible text etc.  In an up-to-date display, this
+     should always be equal to the start position of the next row.
+     BIDI Note: In R2L rows, this position is at or beyond the left
+     edge of the row.  */
   struct display_pos end;
 
+  /* The smallest and the largest buffer positions that contributed to
+     glyphs in this row.  Note that due to bidi reordering, these are
+     in general different from the text positions stored in `start'
+     and `end' members above, and also different from the buffer
+     positions recorded in the glyphs displayed the leftmost and
+     rightmost on the screen.  */
+  struct text_pos minpos, maxpos;
+
   /* Non-zero means the overlay arrow bitmap is on this line.
      -1 means use default overlay arrow bitmap, else
      it specifies actual fringe bitmap number.  */
@@ -880,6 +902,10 @@ struct glyph_row
      the bottom line of the window, but not end of the buffer.  */
   unsigned indicate_bottom_line_p : 1;
 
+  /* Non-zero means the row was reversed to display text in a
+     right-to-left paragraph.  */
+  unsigned reversed_p : 1;
+
   /* Continuation lines width at the start of the row.  */
   int continuation_lines_width;
 
@@ -896,7 +922,7 @@ struct glyph_row
    we don't try to access rows that are out of bounds.  */
 
 #if GLYPH_DEBUG
-struct glyph_row *matrix_row P_ ((struct glyph_matrix *, int));
+struct glyph_row *matrix_row (struct glyph_matrix *, int);
 #define MATRIX_ROW(MATRIX, ROW)   matrix_row ((MATRIX), (ROW))
 #else
 #define MATRIX_ROW(MATRIX, ROW)          ((MATRIX)->rows + (ROW))
@@ -932,15 +958,21 @@ struct glyph_row *matrix_row P_ ((struct glyph_matrix *, int));
      (MATRIX_ROW ((MATRIX), (ROW))->used[TEXT_AREA])
 
 /* Return the character/ byte position at which the display of ROW
-   starts.  */
+   starts.  BIDI Note: this is the smallest character/byte position
+   among characters in ROW, i.e. the first logical-order character
+   displayed by ROW, which is not necessarily the smallest horizontal
+   position.  */
 
-#define MATRIX_ROW_START_CHARPOS(ROW) ((ROW)->start.pos.charpos)
-#define MATRIX_ROW_START_BYTEPOS(ROW) ((ROW)->start.pos.bytepos)
+#define MATRIX_ROW_START_CHARPOS(ROW) ((ROW)->minpos.charpos)
+#define MATRIX_ROW_START_BYTEPOS(ROW) ((ROW)->minpos.bytepos)
 
-/* Return the character/ byte position at which ROW ends.  */
+/* Return the character/ byte position at which ROW ends.  BIDI Note:
+   this is the largest character/byte position among characters in
+   ROW, i.e. the last logical-order character displayed by ROW, which
+   is not necessarily the largest horizontal position.  */
 
-#define MATRIX_ROW_END_CHARPOS(ROW) ((ROW)->end.pos.charpos)
-#define MATRIX_ROW_END_BYTEPOS(ROW) ((ROW)->end.pos.bytepos)
+#define MATRIX_ROW_END_CHARPOS(ROW) ((ROW)->maxpos.charpos)
+#define MATRIX_ROW_END_BYTEPOS(ROW) ((ROW)->maxpos.bytepos)
 
 /* Return the vertical position of ROW in MATRIX.  */
 
@@ -1086,17 +1118,9 @@ extern int cursor_in_echo_area;
 
 extern int display_completed;
 
-/* Non-zero means redisplay has been performed directly (see also
-   direct_output_for_insert and direct_output_forward_char), so that
-   no further updating has to be performed.  The function
-   redisplay_internal checks this flag, and does nothing but reset it
-   to zero if it is non-zero.  */
-
-extern int redisplay_performed_directly_p;
-
 /* A temporary storage area, including a row of glyphs.  Initialized
    in xdisp.c.  Used for various purposes, as an example see
-   direct_output_for_insert.  */
+   get_overlay_arrow_glyph_row.  */
 
 extern struct glyph_row scratch_glyph_row;
 
@@ -1710,7 +1734,93 @@ struct face_cache
 
 extern int face_change_count;
 
+/* For reordering of bidirectional text.  */
+#define BIDI_MAXLEVEL 64
+
+/* Data type for describing the bidirectional character types.  The
+   first 7 must be at the beginning, because they are the only values
+   valid in the `bidi_type' member of `struct glyph'; we only reserve
+   3 bits for it, so we cannot use there values larger than 7.  */
+typedef enum {
+  UNKNOWN_BT = 0,
+  STRONG_L,    /* strong left-to-right */
+  STRONG_R,    /* strong right-to-left */
+  WEAK_EN,     /* european number */
+  WEAK_AN,     /* arabic number */
+  WEAK_BN,     /* boundary neutral */
+  NEUTRAL_B,   /* paragraph separator */
+  STRONG_AL,   /* arabic right-to-left letter */
+  LRE,         /* left-to-right embedding */
+  LRO,         /* left-to-right override */
+  RLE,         /* right-to-left embedding */
+  RLO,         /* right-to-left override */
+  PDF,         /* pop directional format */
+  WEAK_ES,     /* european number separator */
+  WEAK_ET,     /* european number terminator */
+  WEAK_CS,     /* common separator */
+  WEAK_NSM,    /* non-spacing mark */
+  NEUTRAL_S,   /* segment separator */
+  NEUTRAL_WS,  /* whitespace */
+  NEUTRAL_ON   /* other neutrals */
+} bidi_type_t;
+
+/* The basic directionality data type.  */
+typedef enum { NEUTRAL_DIR, L2R, R2L } bidi_dir_t;
+
+/* Data type for storing information about characters we need to
+   remember.  */
+struct bidi_saved_info {
+  int 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 */
+};
+
+/* Data type for keeping track of saved embedding levels and override
+   status information.  */
+struct bidi_stack {
+  int level;
+  bidi_dir_t override;
+};
 
+/* Data type for iterating over bidi text.  */
+struct bidi_it {
+  EMACS_INT bytepos;           /* iterator's position in buffer */
+  EMACS_INT charpos;
+  int ch;                      /* character itself */
+  int ch_len;                  /* length of its multibyte sequence */
+  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 */
+  bidi_type_t orig_type;       /* original type, as found in the buffer */
+  int resolved_level;          /* final resolved level of this character */
+  int invalid_levels;          /* how many PDFs to ignore */
+  int invalid_rl_levels;       /* how many PDFs from RLE/RLO to ignore */
+  int prev_was_pdf;            /* if non-zero, previous char was PDF */
+  struct bidi_saved_info prev; /* info about previous character */
+  struct bidi_saved_info last_strong; /* last-seen strong directional char */
+  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;       /* position of next EN char for ET */
+  EMACS_INT 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 */
+  int stack_idx;               /* index of current data on the stack */
+  /* Note: Everything from here on is not copied/saved when the bidi
+     iterator state is saved, pushed, or popped.  So only put here
+     stuff that is not part of the bidi iterator's state!  */
+  struct bidi_stack level_stack[BIDI_MAXLEVEL]; /* stack of embedding levels */
+  int first_elt;               /* if non-zero, examine current char first */
+  bidi_dir_t paragraph_dir;    /* current paragraph direction */
+  int new_paragraph;           /* if non-zero, we expect a new paragraph */
+  EMACS_INT separator_limit;   /* where paragraph separator should end */
+};
+
+/* Value is non-zero when the bidi iterator is at base paragraph
+   embedding level.  */
+#define BIDI_AT_BASE_LEVEL(BIDI_IT) \
+  ((BIDI_IT).resolved_level == (BIDI_IT).level_stack[0].level)
 
 \f
 /***********************************************************************
@@ -1862,7 +1972,8 @@ enum it_method {
   NUM_IT_METHODS
 };
 
-#define IT_STACK_SIZE 4
+/* FIXME: What is this?  Why 5?  */
+#define IT_STACK_SIZE 5
 
 /* Iterator for composition (both for static and automatic).  */
 struct composition_it
@@ -1873,17 +1984,31 @@ struct composition_it
      are not iterating over a composition now.  */
   int id;
   /* If non-negative, character that triggers the automatic
-     composition at `stop_pos', and this is an automatic compositoin.
+     composition at `stop_pos', and this is an automatic composition.
      If negative, this is a static composition.  This is set to -2
      temporarily if searching of composition reach a limit or a
      newline.  */
   int ch;
-  /* If this an automatic composition, how many characters to look back
-     from the position where a character triggering the composition
-     exists.  */
+  /* If this is an automatic composition, index of a rule for making
+     the automatic composition.  Provided that ELT is an element of
+     Vcomposition_function_table for CH, (nth ELT RULE_IDX) is the
+     rule for the composition.  */
+  int rule_idx;
+  /* If this is an automatic composition, how many characters to look
+     back from the position where a character triggering the
+     composition exists.  */
   int lookback;
   /* If non-negative, number of glyphs of the glyph-string.  */
   int nglyphs;
+  /* Nonzero iff the composition is created while buffer is scanned in
+     reverse order, and thus the grapheme clusters must be rendered
+     from the last to the first.  */
+  int reversed_p;
+
+  /** The following members contain information about the current
+      grapheme cluster.  */
+  /* Position of the first character of the current grapheme cluster.  */
+  EMACS_INT charpos;
   /* Number of characters and bytes of the current grapheme cluster.  */
   int nchars, nbytes;
   /* Indices of the glyphs for the current grapheme cluster.  */
@@ -1910,6 +2035,14 @@ struct it
      text, overlay strings, end of text etc., which see.  */
   EMACS_INT stop_charpos;
 
+  /* Previous stop position, i.e. the last one before the current
+     iterator position in `current'.  */
+  EMACS_INT 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;
+
   /* Maximum string or buffer position + 1.  ZV when iterating over
      current_buffer.  */
   EMACS_INT end_charpos;
@@ -1917,7 +2050,7 @@ struct it
   /* C string to iterate over.  Non-null means get characters from
      this string, otherwise characters are read from current_buffer
      or it->string.  */
-  unsigned char *s;
+  const unsigned char *s;
 
   /* Number of characters in the string (s, or it->string) we iterate
      over.  */
@@ -2016,6 +2149,8 @@ struct it
     int string_nchars;
     EMACS_INT end_charpos;
     EMACS_INT stop_charpos;
+    EMACS_INT prev_stop;
+    EMACS_INT base_level_stop;
     struct composition_it cmp_it;
     int face_id;
 
@@ -2118,13 +2253,22 @@ struct it
      MODE_LINE_FACE_ID, etc, depending on what we are displaying.  */
   int base_face_id;
 
-  /* If what == IT_CHARACTER, character and length in bytes.  This is
-     a character from a buffer or string.  It may be different from
-     the character displayed in case that
-     unibyte_display_via_language_environment is set.
+  /* If `what' == IT_CHARACTER, the character and the length in bytes
+     of its multibyte sequence.  The character comes from a buffer or
+     a string.  It may be different from the character displayed in
+     case that unibyte_display_via_language_environment is set.
+
+     If `what' == IT_COMPOSITION, the first component of a composition
+     and length in bytes of the composition.
 
-     If what == IT_COMPOSITION, the first component of a composition
-     and length in bytes of the composition.  */
+     If `what' is anything else, these two are undefined (will
+     probably hold values for the last IT_CHARACTER or IT_COMPOSITION
+     traversed by the iterator.
+
+     The values are updated by get_next_display_element, so they are
+     out of sync with the value returned by IT_CHARPOS between the
+     time set_iterator_to_next advances the position and the time
+     get_next_display_element loads the new values into c and len.  */
   int c, len;
 
   /* If what == IT_COMPOSITION, iterator substructure for the
@@ -2217,6 +2361,14 @@ struct it
      incremented/reset by display_line, move_it_to etc.  */
   int continuation_lines_width;
 
+  /* Buffer position that ends the buffer text line being iterated.
+     This is normally the position after the newline at EOL.  If this
+     is the last line of the buffer and it doesn't have a newline,
+     value is ZV/ZV_BYTE.  Set and used only if IT->bidi_p, for
+     setting the end position of glyph rows produced for continuation
+     lines, see display_line.  */
+  struct text_pos eol_pos;
+
   /* Current y-position.  Automatically incremented by the height of
      glyph_row in move_it_to and display_line.  */
   int current_y;
@@ -2243,6 +2395,14 @@ struct it
 
   /* Face of the right fringe glyph.  */
   unsigned right_user_fringe_face_id : FACE_ID_BITS;
+
+  /* Non-zero means we need to reorder bidirectional text for display
+     in the visual order.  */
+  int bidi_p;
+
+  /* For iterating over bidirectional text.  */
+  struct bidi_it bidi_it;
+  bidi_dir_t paragraph_embedding;
 };
 
 
@@ -2272,7 +2432,13 @@ struct it
 
 #define PRODUCE_GLYPHS(IT)                              \
   do {                                                  \
-    extern int inhibit_free_realized_faces;             \
+    if ((IT)->glyph_row != NULL && (IT)->bidi_p)       \
+      {                                                        \
+        if ((IT)->bidi_it.paragraph_dir == R2L)                \
+         (IT)->glyph_row->reversed_p = 1;              \
+       else                                            \
+         (IT)->glyph_row->reversed_p = 0;              \
+      }                                                        \
     if (FRAME_RIF ((IT)->f) != NULL)                    \
       FRAME_RIF ((IT)->f)->produce_glyphs ((IT));       \
     else                                                \
@@ -2321,7 +2487,7 @@ struct run
 
 /* Handlers for setting frame parameters.  */
 
-typedef void (*frame_parm_handler) P_ ((struct frame *, Lisp_Object, Lisp_Object));
+typedef void (*frame_parm_handler) (struct frame *, Lisp_Object, Lisp_Object);
 
 
 /* Structure holding system-dependent interface functions needed
@@ -2334,110 +2500,110 @@ struct redisplay_interface
 
   /* Produce glyphs/get display metrics for the display element IT is
      loaded with.  */
-  void (*produce_glyphs) P_ ((struct it *it));
+  void (*produce_glyphs) (struct it *it);
 
   /* Write or insert LEN glyphs from STRING at the nominal output
      position.  */
-  void (*write_glyphs) P_ ((struct glyph *string, int len));
-  void (*insert_glyphs) P_ ((struct glyph *start, int len));
+  void (*write_glyphs) (struct glyph *string, int len);
+  void (*insert_glyphs) (struct glyph *start, int len);
 
   /* Clear from nominal output position to X.  X < 0 means clear
      to right end of display.  */
-  void (*clear_end_of_line) P_ ((int x));
+  void (*clear_end_of_line) (int x);
 
   /* Function to call to scroll the display as described by RUN on
      window W.  */
-  void (*scroll_run_hook) P_ ((struct window *w, struct run *run));
+  void (*scroll_run_hook) (struct window *w, struct run *run);
 
   /* Function to call after a line in a display has been completely
      updated.  Used to draw truncation marks and alike.  DESIRED_ROW
      is the desired row which has been updated.  */
-  void (*after_update_window_line_hook) P_ ((struct glyph_row *desired_row));
+  void (*after_update_window_line_hook) (struct glyph_row *desired_row);
 
   /* Function to call before beginning to update window W in
      window-based redisplay.  */
-  void (*update_window_begin_hook) P_ ((struct window *w));
+  void (*update_window_begin_hook) (struct window *w);
 
   /* Function to call after window W has been updated in window-based
      redisplay.  CURSOR_ON_P non-zero means switch cursor on.
      MOUSE_FACE_OVERWRITTEN_P non-zero means that some lines in W
      that contained glyphs in mouse-face were overwritten, so we
      have to update the mouse highlight.  */
-  void (*update_window_end_hook) P_ ((struct window *w, int cursor_on_p,
-                                     int mouse_face_overwritten_p));
+  void (*update_window_end_hook) (struct window *w, int cursor_on_p,
+                                  int mouse_face_overwritten_p);
 
   /* Move cursor to row/column position VPOS/HPOS, pixel coordinates
      Y/X. HPOS/VPOS are window-relative row and column numbers and X/Y
      are window-relative pixel positions.  */
-  void (*cursor_to) P_ ((int vpos, int hpos, int y, int x));
+  void (*cursor_to) (int vpos, int hpos, int y, int x);
 
   /* Flush the display of frame F.  For X, this is XFlush.  */
-  void (*flush_display) P_ ((struct frame *f));
+  void (*flush_display) (struct frame *f);
 
   /* Flush the display of frame F if non-NULL.  This is called
      during redisplay, and should be NULL on systems which flushes
      automatically before reading input.  */
-  void (*flush_display_optional) P_ ((struct frame *f));
+  void (*flush_display_optional) (struct frame *f);
 
   /* Clear the mouse hightlight in window W, if there is any.  */
-  void (*clear_window_mouse_face) P_ ((struct window *w));
+  void (*clear_window_mouse_face) (struct window *w);
 
   /* Set *LEFT and *RIGHT to the left and right overhang of GLYPH on
      frame F.  */
-  void (*get_glyph_overhangs) P_ ((struct glyph *glyph, struct frame *f,
-                                  int *left, int *right));
+  void (*get_glyph_overhangs) (struct glyph *glyph, struct frame *f,
+                               int *left, int *right);
 
   /* Fix the display of AREA of ROW in window W for overlapping rows.
      This function is called from redraw_overlapping_rows after
      desired rows have been made current.  */
-  void (*fix_overlapping_area) P_ ((struct window *w, struct glyph_row *row,
-                                   enum glyph_row_area area, int));
+  void (*fix_overlapping_area) (struct window *w, struct glyph_row *row,
+                                enum glyph_row_area area, int);
 
 #ifdef HAVE_WINDOW_SYSTEM
 
   /* Draw a fringe bitmap in window W of row ROW using parameters P.  */
-  void (*draw_fringe_bitmap) P_ ((struct window *w, struct glyph_row *row,
-                                 struct draw_fringe_bitmap_params *p));
+  void (*draw_fringe_bitmap) (struct window *w, struct glyph_row *row,
+                              struct draw_fringe_bitmap_params *p);
 
   /* Define and destroy fringe bitmap no. WHICH.  */
-  void (*define_fringe_bitmap) P_ ((int which, unsigned short *bits,
-                                   int h, int wd));
-  void (*destroy_fringe_bitmap) P_ ((int which));
+  void (*define_fringe_bitmap) (int which, unsigned short *bits,
+                                int h, int wd);
+  void (*destroy_fringe_bitmap) (int which);
 
 /* Compute left and right overhang of glyph string S.
    A NULL pointer if platform does not support this. */
-  void (*compute_glyph_string_overhangs) P_ ((struct glyph_string *s));
+  void (*compute_glyph_string_overhangs) (struct glyph_string *s);
 
 /* Draw a glyph string S.  */
-  void (*draw_glyph_string) P_ ((struct glyph_string *s));
+  void (*draw_glyph_string) (struct glyph_string *s);
 
 /* Define cursor CURSOR on frame F.  */
-  void (*define_frame_cursor) P_ ((struct frame *f, Cursor cursor));
+  void (*define_frame_cursor) (struct frame *f, Cursor cursor);
 
 /* Clear the area at (X,Y,WIDTH,HEIGHT) of frame F.  */
-  void (*clear_frame_area) P_ ((struct frame *f, int x, int y,
-                               int width, int height));
+  void (*clear_frame_area) (struct frame *f, int x, int y,
+                            int width, int height);
 
 /* Draw specified cursor CURSOR_TYPE of width CURSOR_WIDTH
    at row GLYPH_ROW on window W if ON_P is 1.  If ON_P is
    0, don't draw cursor.  If ACTIVE_P is 1, system caret
    should track this cursor (when applicable).  */
-  void (*draw_window_cursor) P_ ((struct window *w,
-                                 struct glyph_row *glyph_row,
-                                 int x, int y,
-                                 int cursor_type, int cursor_width,
-                                 int on_p, int active_p));
+  void (*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);
 
 /* Draw vertical border for window W from (X,Y0) to (X,Y1).  */
-  void (*draw_vertical_window_border) P_ ((struct window *w,
-                                          int x, int y0, int y1));
+  void (*draw_vertical_window_border) (struct window *w,
+                                       int x, int y0, int y1);
 
 /* Shift display of frame F to make room for inserted glyphs.
    The area at pixel (X,Y) of width WIDTH and height HEIGHT is
    shifted right by SHIFT_BY pixels.  */
-  void (*shift_glyphs_for_insert) P_ ((struct frame *f,
-                                      int x, int y, int width,
-                                      int height, int shift_by));
+  void (*shift_glyphs_for_insert) (struct frame *f,
+                                   int x, int y, int width,
+                                   int height, int shift_by);
 
 #endif /* HAVE_WINDOW_SYSTEM */
 };
@@ -2464,14 +2630,14 @@ struct image_type
 
   /* Check that SPEC is a valid image specification for the given
      image type.  Value is non-zero if SPEC is valid.  */
-  int (* valid_p) P_ ((Lisp_Object spec));
+  int (* valid_p) (Lisp_Object spec);
 
   /* Load IMG which is used on frame F from information contained in
      IMG->spec.  Value is non-zero if successful.  */
-  int (* load) P_ ((struct frame *f, struct image *img));
+  int (* load) (struct frame *f, struct image *img);
 
   /* Free resources of image IMG which is used on frame F.  */
-  void (* free) P_ ((struct frame *f, struct image *img));
+  void (* free) (struct frame *f, struct image *img);
 
   /* Next in list of all supported image types.  */
   struct image_type *next;
@@ -2658,6 +2824,9 @@ enum tool_bar_item_idx
   /* Icon file name of right to left image when an RTL locale is used.  */
   TOOL_BAR_ITEM_RTL_IMAGE,
 
+  /* Label to show when text labels are enabled.  */
+  TOOL_BAR_ITEM_LABEL,
+
   /* Sentinel = number of slots in tool_bar_items occupied by one
      tool-bar item.  */
   TOOL_BAR_ITEM_NSLOTS
@@ -2679,6 +2848,15 @@ enum tool_bar_item_image
 
 extern Lisp_Object Vtool_bar_button_margin;
 
+/* Tool bar style */
+
+extern Lisp_Object Vtool_bar_style;
+
+/* Maximum number of characters a label can have to be shown.  */
+
+extern EMACS_INT tool_bar_max_label_size;
+#define DEFAULT_TOOL_BAR_LABEL_SIZE 14
+
 /* Thickness of relief to draw around tool-bar buttons.  */
 
 extern EMACS_INT tool_bar_button_relief;
@@ -2714,59 +2892,66 @@ extern EMACS_INT tool_bar_button_relief;
                          Function Prototypes
  ***********************************************************************/
 
+/* Defined in bidi.c */
+
+extern void bidi_init_it (EMACS_INT, EMACS_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 *);
+extern int  bidi_mirror_char (int);
+
 /* Defined in xdisp.c */
 
-struct glyph_row *row_containing_pos P_ ((struct window *, int,
-                                         struct glyph_row *,
-                                         struct glyph_row *, int));
-int string_buffer_position P_ ((struct window *, Lisp_Object, int));
-int line_bottom_y P_ ((struct it *));
-int display_prop_intangible_p P_ ((Lisp_Object));
-void resize_echo_area_exactly P_ ((void));
-int resize_mini_window P_ ((struct window *, int));
-int try_window P_ ((Lisp_Object, struct text_pos, int));
-void window_box P_ ((struct window *, int, int *, int *, int *, int *));
-int window_box_height P_ ((struct window *));
-int window_text_bottom_y P_ ((struct window *));
-int window_box_width P_ ((struct window *, int));
-int window_box_left P_ ((struct window *, int));
-int window_box_left_offset P_ ((struct window *, int));
-int window_box_right P_ ((struct window *, int));
-int window_box_right_offset P_ ((struct window *, int));
-void window_box_edges P_ ((struct window *, int, int *, int *, int *, int *));
-int estimate_mode_line_height P_ ((struct frame *, enum face_id));
-void pixel_to_glyph_coords P_ ((struct frame *, int, int, int *, int *,
-                               NativeRectangle *, int));
-int glyph_to_pixel_coords P_ ((struct window *, int, int, int *, int *));
-void remember_mouse_glyph P_ ((struct frame *, int, int, NativeRectangle *));
-
-void mark_window_display_accurate P_ ((Lisp_Object, int));
-void redisplay_preserve_echo_area P_ ((int));
-int set_cursor_from_row P_ ((struct window *, struct glyph_row *,
-                            struct glyph_matrix *, int, int, int, int));
-void init_iterator P_ ((struct it *, struct window *, int,
-                       int, struct glyph_row *, enum face_id));
-void init_iterator_to_row_start P_ ((struct it *, struct window *,
-                                    struct glyph_row *));
-int get_next_display_element P_ ((struct it *));
-void set_iterator_to_next P_ ((struct it *, int));
-void start_display P_ ((struct it *, struct window *, struct text_pos));
-void move_it_to P_ ((struct it *, int, int, int, int, int));
-void move_it_vertically P_ ((struct it *, int));
-void move_it_vertically_backward P_ ((struct it *, int));
-void move_it_by_lines P_ ((struct it *, int, int));
-void move_it_past_eol P_ ((struct it *));
+struct glyph_row *row_containing_pos (struct window *, int,
+                                      struct glyph_row *,
+                                      struct glyph_row *, int);
+EMACS_INT string_buffer_position (struct window *, Lisp_Object,
+                                  EMACS_INT);
+int line_bottom_y (struct it *);
+int display_prop_intangible_p (Lisp_Object);
+void resize_echo_area_exactly (void);
+int resize_mini_window (struct window *, int);
+int try_window (Lisp_Object, struct text_pos, int);
+void window_box (struct window *, int, int *, int *, int *, int *);
+int window_box_height (struct window *);
+int window_text_bottom_y (struct window *);
+int window_box_width (struct window *, int);
+int window_box_left (struct window *, int);
+int window_box_left_offset (struct window *, int);
+int window_box_right (struct window *, int);
+int window_box_right_offset (struct window *, int);
+void window_box_edges (struct window *, int, int *, int *, int *, int *);
+int estimate_mode_line_height (struct frame *, enum face_id);
+void pixel_to_glyph_coords (struct frame *, int, int, int *, int *,
+                            NativeRectangle *, int);
+int glyph_to_pixel_coords (struct window *, int, int, int *, int *);
+void remember_mouse_glyph (struct frame *, int, int, NativeRectangle *);
+
+void mark_window_display_accurate (Lisp_Object, int);
+void redisplay_preserve_echo_area (int);
+int set_cursor_from_row (struct window *, struct glyph_row *,
+                         struct glyph_matrix *, int, int, int, int);
+void init_iterator (struct it *, struct window *, EMACS_INT,
+                    EMACS_INT, struct glyph_row *, enum face_id);
+void init_iterator_to_row_start (struct it *, struct window *,
+                                 struct glyph_row *);
+int get_next_display_element (struct it *);
+void set_iterator_to_next (struct it *, int);
+void start_display (struct it *, struct window *, struct text_pos);
+void move_it_to (struct it *, int, 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, int);
+void move_it_past_eol (struct it *);
 void move_it_in_display_line (struct it *it,
                              EMACS_INT to_charpos, int to_x,
                              enum move_operation_enum op);
-int in_display_vector_p P_ ((struct it *));
-int frame_mode_line_height P_ ((struct frame *));
-void highlight_trailing_whitespace P_ ((struct frame *, struct glyph_row *));
+int in_display_vector_p (struct it *);
+int frame_mode_line_height (struct frame *);
+void highlight_trailing_whitespace (struct frame *, struct glyph_row *);
 extern Lisp_Object Qtool_bar;
 extern Lisp_Object Vshow_trailing_whitespace;
 extern int mode_line_in_non_selected_windows;
 extern int redisplaying_p;
-extern void add_to_log P_ ((char *, Lisp_Object, Lisp_Object));
 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;
@@ -2778,173 +2963,178 @@ extern Lisp_Object Vmouse_autoselect_window;
 extern int unibyte_display_via_language_environment;
 extern EMACS_INT underline_minimum_offset;
 
-extern void reseat_at_previous_visible_line_start P_ ((struct it *));
+extern void reseat_at_previous_visible_line_start (struct it *);
 
-extern int calc_pixel_width_or_height P_ ((double *, struct it *, Lisp_Object,
-                                          struct font *, int, int *));
+extern int calc_pixel_width_or_height (double *, struct it *, Lisp_Object,
+                                       struct font *, int, int *);
 
 #ifdef HAVE_WINDOW_SYSTEM
 
 #if GLYPH_DEBUG
-extern void dump_glyph_string P_ ((struct glyph_string *));
+extern void dump_glyph_string (struct glyph_string *);
 #endif
 
-extern void x_get_glyph_overhangs P_ ((struct glyph *, struct frame *,
-                                      int *, int *));
-extern void x_produce_glyphs P_ ((struct it *));
+extern void x_get_glyph_overhangs (struct glyph *, struct frame *,
+                                   int *, int *);
+extern void x_produce_glyphs (struct it *);
 
-extern void x_write_glyphs P_ ((struct glyph *, int));
-extern void x_insert_glyphs P_ ((struct glyph *, int len));
-extern void x_clear_end_of_line P_ ((int));
+extern void x_write_glyphs (struct glyph *, int);
+extern void x_insert_glyphs (struct glyph *, int len);
+extern void x_clear_end_of_line (int);
 
 extern int x_stretch_cursor_p;
 extern struct cursor_pos output_cursor;
 
-extern void x_fix_overlapping_area P_ ((struct window *, struct glyph_row *,
-                                       enum glyph_row_area, int));
-extern void draw_phys_cursor_glyph P_ ((struct window *,
-                                         struct glyph_row *,
-                                         enum draw_glyphs_face));
-extern void get_phys_cursor_geometry P_ ((struct window *, struct glyph_row *,
-                                         struct glyph *, int *, int *, int *));
-extern void erase_phys_cursor P_ ((struct window *));
-extern void display_and_set_cursor P_ ((struct window *,
-                                         int, int, int, int, int));
-
-extern void set_output_cursor P_ ((struct cursor_pos *));
-extern void x_cursor_to P_ ((int, int, int, int));
-
-extern void x_update_cursor P_ ((struct frame *, int));
-extern void x_clear_cursor P_ ((struct window *));
-extern void x_draw_vertical_border P_ ((struct window *w));
-
-extern void frame_to_window_pixel_xy P_ ((struct window *, int *, int *));
-extern int get_glyph_string_clip_rects P_ ((struct glyph_string *,
-                                           NativeRectangle *, int));
-extern void get_glyph_string_clip_rect P_ ((struct glyph_string *,
-                                           NativeRectangle *nr));
-extern Lisp_Object find_hot_spot P_ ((Lisp_Object, int, int));
-extern void note_mouse_highlight P_ ((struct frame *, int, int));
-extern void x_clear_window_mouse_face P_ ((struct window *));
-extern void cancel_mouse_face P_ ((struct frame *));
-
-extern void handle_tool_bar_click P_ ((struct frame *,
-                                      int, int, int, unsigned int));
+extern void x_fix_overlapping_area (struct window *, struct glyph_row *,
+                                    enum glyph_row_area, int);
+extern void draw_phys_cursor_glyph (struct window *,
+                                    struct glyph_row *,
+                                    enum draw_glyphs_face);
+extern void get_phys_cursor_geometry (struct window *, struct glyph_row *,
+                                      struct glyph *, int *, int *, int *);
+extern void erase_phys_cursor (struct window *);
+extern void display_and_set_cursor (struct window *,
+                                    int, int, int, int, int);
+
+extern void set_output_cursor (struct cursor_pos *);
+extern void x_cursor_to (int, int, int, int);
+
+extern void x_update_cursor (struct frame *, int);
+extern void x_clear_cursor (struct window *);
+extern void x_draw_vertical_border (struct window *w);
+
+extern void frame_to_window_pixel_xy (struct window *, int *, int *);
+extern int get_glyph_string_clip_rects (struct glyph_string *,
+                                        NativeRectangle *, int);
+extern void get_glyph_string_clip_rect (struct glyph_string *,
+                                        NativeRectangle *nr);
+extern Lisp_Object find_hot_spot (Lisp_Object, int, int);
+extern void note_mouse_highlight (struct frame *, int, int);
+extern void x_clear_window_mouse_face (struct window *);
+extern void cancel_mouse_face (struct frame *);
+
+extern void handle_tool_bar_click (struct frame *,
+                                   int, int, int, unsigned int);
 
 /* msdos.c defines its own versions of these functions. */
-extern int clear_mouse_face P_ ((Display_Info *));
-extern void show_mouse_face P_ ((Display_Info *, enum draw_glyphs_face));
-extern int cursor_in_mouse_face_p P_ ((struct window *w));
+extern int clear_mouse_face (Display_Info *);
+extern void show_mouse_face (Display_Info *, enum draw_glyphs_face);
+extern int cursor_in_mouse_face_p (struct window *w);
 
-extern void expose_frame P_ ((struct frame *, int, int, int, int));
-extern int x_intersect_rectangles P_ ((XRectangle *, XRectangle *,
-                                      XRectangle *));
+extern void expose_frame (struct frame *, int, int, int, int);
+extern int x_intersect_rectangles (XRectangle *, XRectangle *,
+                                   XRectangle *);
 #endif
 
+/* Flags passed to try_window.  */
+#define TRY_WINDOW_CHECK_MARGINS       (1 << 0)
+#define TRY_WINDOW_IGNORE_FONTS_CHANGE (1 << 1)
+
 /* Defined in fringe.c */
 
+extern Lisp_Object Voverflow_newline_into_fringe;
 int lookup_fringe_bitmap (Lisp_Object);
-void draw_fringe_bitmap P_ ((struct window *, struct glyph_row *, int));
-void draw_row_fringe_bitmaps P_ ((struct window *, struct glyph_row *));
-int draw_window_fringes P_ ((struct window *, int));
-int update_window_fringes P_ ((struct window *, int));
-void compute_fringe_widths P_ ((struct frame *, int));
+void draw_fringe_bitmap (struct window *, struct glyph_row *, int);
+void draw_row_fringe_bitmaps (struct window *, struct glyph_row *);
+int draw_window_fringes (struct window *, int);
+int update_window_fringes (struct window *, int);
+void compute_fringe_widths (struct frame *, int);
 
 #ifdef WINDOWSNT
-void w32_init_fringe P_ ((struct redisplay_interface *));
-void w32_reset_fringes P_ ((void));
+void w32_init_fringe (struct redisplay_interface *);
+void w32_reset_fringes (void);
 #endif
 /* Defined in image.c */
 
 #ifdef HAVE_WINDOW_SYSTEM
 
-extern int x_bitmap_height P_ ((struct frame *, int));
-extern int x_bitmap_width P_ ((struct frame *, int));
-extern int x_bitmap_pixmap P_ ((struct frame *, int));
-extern void x_reference_bitmap P_ ((struct frame *, int));
-extern int x_create_bitmap_from_data P_ ((struct frame *, char *,
-                                         unsigned int, unsigned int));
-extern int x_create_bitmap_from_file P_ ((struct frame *, Lisp_Object));
+extern int x_bitmap_height (struct frame *, int);
+extern int x_bitmap_width (struct frame *, int);
+extern int x_bitmap_pixmap (struct frame *, int);
+extern void x_reference_bitmap (struct frame *, int);
+extern int x_create_bitmap_from_data (struct frame *, char *,
+                                      unsigned int, unsigned int);
+extern int x_create_bitmap_from_file (struct frame *, Lisp_Object);
 #if defined (HAVE_XPM) && defined (HAVE_X_WINDOWS)
-extern int x_create_bitmap_from_xpm_data P_ ((struct frame *f, char **bits));
+extern int x_create_bitmap_from_xpm_data (struct frame *f, char **bits);
 #endif
 #ifndef x_destroy_bitmap
-extern void x_destroy_bitmap P_ ((struct frame *, int));
+extern void x_destroy_bitmap (struct frame *, int);
 #endif
-extern void x_destroy_all_bitmaps P_ ((Display_Info *));
-extern int x_create_bitmap_mask P_ ((struct frame * , int));
-extern Lisp_Object x_find_image_file P_ ((Lisp_Object));
-
-void x_kill_gs_process P_ ((Pixmap, struct frame *));
-struct image_cache *make_image_cache P_ ((void));
-void free_image_cache P_ ((struct frame *));
-void clear_image_caches P_ ((Lisp_Object));
-void mark_image_cache P_ ((struct image_cache *));
-int valid_image_p P_ ((Lisp_Object));
-void prepare_image_for_display P_ ((struct frame *, struct image *));
-int lookup_image P_ ((struct frame *, Lisp_Object));
-
-unsigned long image_background P_ ((struct image *, struct frame *,
-                                   XImagePtr_or_DC ximg));
-int image_background_transparent P_ ((struct image *, struct frame *,
-                                     XImagePtr_or_DC mask));
-
-int image_ascent P_ ((struct image *, struct face *, struct glyph_slice *));
+extern void x_destroy_all_bitmaps (Display_Info *);
+extern int x_create_bitmap_mask (struct frame * , int);
+extern Lisp_Object x_find_image_file (Lisp_Object);
+
+void x_kill_gs_process (Pixmap, struct frame *);
+struct image_cache *make_image_cache (void);
+void free_image_cache (struct frame *);
+void clear_image_caches (Lisp_Object);
+void mark_image_cache (struct image_cache *);
+int valid_image_p (Lisp_Object);
+void prepare_image_for_display (struct frame *, struct image *);
+int lookup_image (struct frame *, Lisp_Object);
+
+unsigned long image_background (struct image *, struct frame *,
+                                XImagePtr_or_DC ximg);
+int image_background_transparent (struct image *, struct frame *,
+                                  XImagePtr_or_DC mask);
+
+int image_ascent (struct image *, struct face *, struct glyph_slice *);
 
 #endif
 
 /* Defined in sysdep.c */
 
-void get_tty_size P_ ((int, int *, int *));
-void request_sigio P_ ((void));
-void unrequest_sigio P_ ((void));
-int tabs_safe_p P_ ((int));
-void init_baud_rate P_ ((int));
-void init_sigio P_ ((int));
+void get_tty_size (int, int *, int *);
+void request_sigio (void);
+void unrequest_sigio (void);
+int tabs_safe_p (int);
+void init_baud_rate (int);
+void init_sigio (int);
 
 /* Defined in xfaces.c */
 
 #ifdef HAVE_X_WINDOWS
-void x_free_colors P_ ((struct frame *, unsigned long *, int));
+void x_free_colors (struct frame *, unsigned long *, int);
 #endif
 
-void update_face_from_frame_parameter P_ ((struct frame *, Lisp_Object,
-                                          Lisp_Object));
-Lisp_Object tty_color_name P_ ((struct frame *, int));
-void clear_face_cache P_ ((int));
-unsigned long load_color P_ ((struct frame *, struct face *, Lisp_Object,
-                             enum lface_attribute_index));
-void unload_color P_ ((struct frame *, unsigned long));
-char *choose_face_font P_ ((struct frame *, Lisp_Object *, Lisp_Object,
-                           int *));
-int ascii_face_of_lisp_face P_ ((struct frame *, int));
-void prepare_face_for_display P_ ((struct frame *, struct face *));
-int xstrcasecmp P_ ((const unsigned char *, const unsigned char *));
-int lookup_face P_ ((struct frame *, Lisp_Object *));
-int lookup_named_face P_ ((struct frame *, Lisp_Object, int));
-int lookup_basic_face P_ ((struct frame *, int));
-int smaller_face P_ ((struct frame *, int, int));
-int face_with_height P_ ((struct frame *, int, int));
-int lookup_derived_face P_ ((struct frame *, Lisp_Object, int, int));
-void init_frame_faces P_ ((struct frame *));
-void free_frame_faces P_ ((struct frame *));
-void recompute_basic_faces P_ ((struct frame *));
-int face_at_buffer_position P_ ((struct window *w, EMACS_INT pos,
-                                EMACS_INT region_beg, EMACS_INT region_end,
-                                EMACS_INT *endptr, EMACS_INT limit,
-                                int mouse, int base_face_id));
-int face_for_overlay_string P_ ((struct window *w, EMACS_INT pos,
-                                EMACS_INT region_beg, EMACS_INT region_end,
-                                EMACS_INT *endptr, EMACS_INT limit,
-                                int mouse, Lisp_Object overlay));
-int face_at_string_position P_ ((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 P_ ((struct frame *, Lisp_Object, int, int));
-int compute_char_face P_ ((struct frame *, int, Lisp_Object));
-void free_all_realized_faces P_ ((Lisp_Object));
-void free_realized_face P_ ((struct frame *, struct face *));
+void update_face_from_frame_parameter (struct frame *, Lisp_Object,
+                                       Lisp_Object);
+Lisp_Object tty_color_name (struct frame *, int);
+void clear_face_cache (int);
+unsigned long load_color (struct frame *, struct face *, Lisp_Object,
+                          enum lface_attribute_index);
+void unload_color (struct frame *, unsigned long);
+char *choose_face_font (struct frame *, Lisp_Object *, Lisp_Object,
+                        int *);
+int ascii_face_of_lisp_face (struct frame *, int);
+void prepare_face_for_display (struct frame *, struct face *);
+int xstrcasecmp (const unsigned char *, const unsigned char *);
+int lookup_face (struct frame *, Lisp_Object *);
+int lookup_named_face (struct frame *, Lisp_Object, int);
+int lookup_basic_face (struct frame *, int);
+int smaller_face (struct frame *, int, int);
+int face_with_height (struct frame *, int, int);
+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 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 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, int, int);
+int compute_char_face (struct frame *, int, Lisp_Object);
+void free_all_realized_faces (Lisp_Object);
+void free_realized_face (struct frame *, struct face *);
 extern Lisp_Object Qforeground_color, Qbackground_color;
 extern Lisp_Object Qframe_set_background_mode;
 extern char unspecified_fg[], unspecified_bg[];
@@ -2954,24 +3144,24 @@ extern Lisp_Object Vface_remapping_alist;
 /* Defined in xfns.c  */
 
 #ifdef HAVE_X_WINDOWS
-void gamma_correct P_ ((struct frame *, XColor *));
+void gamma_correct (struct frame *, XColor *);
 #endif
 #ifdef WINDOWSNT
-void gamma_correct P_ ((struct frame *, COLORREF *));
+void gamma_correct (struct frame *, COLORREF *);
 #endif
 
 #ifdef HAVE_WINDOW_SYSTEM
 
-int x_screen_planes P_ ((struct frame *));
-void x_implicitly_set_name P_ ((struct frame *, Lisp_Object, Lisp_Object));
+int x_screen_planes (struct frame *);
+void x_implicitly_set_name (struct frame *, Lisp_Object, Lisp_Object);
 
 extern Lisp_Object tip_frame;
 extern Window tip_window;
 EXFUN (Fx_show_tip, 6);
 EXFUN (Fx_hide_tip, 0);
-extern void start_hourglass P_ ((void));
-extern void cancel_hourglass P_ ((void));
-extern int hourglass_started P_ ((void));
+extern void start_hourglass (void);
+extern void cancel_hourglass (void);
+extern int hourglass_started (void);
 extern int display_hourglass_p;
 extern int hourglass_shown_p;
 struct atimer;                 /* Defined in atimer.h.  */
@@ -2980,8 +3170,8 @@ struct atimer;                    /* Defined in atimer.h.  */
 extern struct atimer *hourglass_atimer;
 
 /* Each GUI implements these.  FIXME: move into RIF. */
-extern void show_hourglass P_ ((struct atimer *));
-extern void hide_hourglass P_ ((void));
+extern void show_hourglass (struct atimer *);
+extern void hide_hourglass (void);
 
 /* Returns the background color of IMG, calculating one heuristically if
    necessary.  If non-zero, XIMG is an existing XImage object to use for
@@ -3006,120 +3196,110 @@ extern void hide_hourglass P_ ((void));
 
 /* Defined in xmenu.c  */
 
-int popup_activated P_ ((void));
+int popup_activated (void);
 
 /* Defined in dispnew.c  */
 
 extern int inverse_video;
-extern int required_matrix_width P_ ((struct window *));
-extern int required_matrix_height P_ ((struct window *));
-extern Lisp_Object buffer_posn_from_coords P_ ((struct window *,
-                                               int *, int *,
-                                               struct display_pos *,
-                                               Lisp_Object *,
-                                               int *, int *, int *, int *));
-extern Lisp_Object mode_line_string P_ ((struct window *, enum window_part,
-                                        int *, int *, int *,
-                                        Lisp_Object *,
-                                        int *, int *, int *, int *));
-extern Lisp_Object marginal_area_string P_ ((struct window *, enum window_part,
-                                            int *, int *, int *,
-                                            Lisp_Object *,
-                                            int *, int *, int *, int *));
-extern void redraw_frame P_ ((struct frame *));
-extern void redraw_garbaged_frames P_ ((void));
-extern void cancel_line P_ ((int, struct frame *));
-extern void init_desired_glyphs P_ ((struct frame *));
-extern int scroll_frame_lines P_ ((struct frame *, int, int, int, int));
-extern int direct_output_for_insert P_ ((int));
-extern int direct_output_forward_char P_ ((int));
-extern int update_frame P_ ((struct frame *, int, int));
-extern int scrolling P_ ((struct frame *));
-extern void bitch_at_user P_ ((void));
-void adjust_glyphs P_ ((struct frame *));
-void free_glyphs P_ ((struct frame *));
-void free_window_matrices P_ ((struct window *));
-void check_glyph_memory P_ ((void));
-void mirrored_line_dance P_ ((struct glyph_matrix *, int, int, int *, char *));
-void clear_glyph_matrix P_ ((struct glyph_matrix *));
-void clear_current_matrices P_ ((struct frame *f));
-void clear_desired_matrices P_ ((struct frame *));
-void shift_glyph_matrix P_ ((struct window *, struct glyph_matrix *,
-                            int, int, int));
-void rotate_matrix P_ ((struct glyph_matrix *, int, int, int));
-void increment_matrix_positions P_ ((struct glyph_matrix *,
-                                    int, int, int, int));
-void blank_row P_ ((struct window *, struct glyph_row *, int));
-void increment_row_positions P_ ((struct glyph_row *, int, int));
-void enable_glyph_matrix_rows P_ ((struct glyph_matrix *, int, int, int));
-void clear_glyph_row P_ ((struct glyph_row *));
-void prepare_desired_row P_ ((struct glyph_row *));
-int line_hash_code P_ ((struct glyph_row *));
-void set_window_update_flags P_ ((struct window *, int));
-void redraw_frame P_ ((struct frame *));
-void redraw_garbaged_frames P_ ((void));
-int scroll_cost P_ ((struct frame *, int, int, int));
-int direct_output_for_insert P_ ((int));
-int direct_output_forward_char P_ ((int));
-int update_frame P_ ((struct frame *, int, int));
-void update_single_window P_ ((struct window *, int));
-int scrolling P_ ((struct frame *));
-void do_pending_window_change P_ ((int));
-void change_frame_size P_ ((struct frame *, int, int, int, int, int));
-void bitch_at_user P_ ((void));
-void init_display P_ ((void));
-void syms_of_display P_ ((void));
+extern int required_matrix_width (struct window *);
+extern int required_matrix_height (struct window *);
+extern Lisp_Object buffer_posn_from_coords (struct window *,
+                                            int *, int *,
+                                            struct display_pos *,
+                                            Lisp_Object *,
+                                            int *, int *, int *, int *);
+extern Lisp_Object mode_line_string (struct window *, enum window_part,
+                                     int *, int *, int *,
+                                     Lisp_Object *,
+                                     int *, int *, int *, int *);
+extern Lisp_Object marginal_area_string (struct window *, enum window_part,
+                                         int *, int *, int *,
+                                         Lisp_Object *,
+                                         int *, int *, int *, int *);
+extern void redraw_frame (struct frame *);
+extern void redraw_garbaged_frames (void);
+extern void cancel_line (int, struct frame *);
+extern void init_desired_glyphs (struct frame *);
+extern int scroll_frame_lines (struct frame *, int, int, int, int);
+extern int update_frame (struct frame *, int, int);
+extern int scrolling (struct frame *);
+extern void bitch_at_user (void);
+void adjust_glyphs (struct frame *);
+void free_glyphs (struct frame *);
+void free_window_matrices (struct window *);
+void check_glyph_memory (void);
+void mirrored_line_dance (struct glyph_matrix *, int, int, int *, char *);
+void clear_glyph_matrix (struct glyph_matrix *);
+void clear_current_matrices (struct frame *f);
+void clear_desired_matrices (struct frame *);
+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, int, int);
+void blank_row (struct window *, struct glyph_row *, int);
+void increment_row_positions (struct glyph_row *, int, int);
+void enable_glyph_matrix_rows (struct glyph_matrix *, int, int, int);
+void clear_glyph_row (struct glyph_row *);
+void prepare_desired_row (struct glyph_row *);
+int line_hash_code (struct glyph_row *);
+void set_window_update_flags (struct window *, int);
+void update_single_window (struct window *, int);
+void do_pending_window_change (int);
+void change_frame_size (struct frame *, int, int, int, int, int);
+void init_display (void);
+void syms_of_display (void);
 extern Lisp_Object Qredisplay_dont_pause;
-void spec_glyph_lookup_face P_ ((struct window *, GLYPH *));
+void spec_glyph_lookup_face (struct window *, GLYPH *);
 
 /* Defined in terminal.c */
 
-extern void ring_bell P_ ((struct frame *));
-extern void update_begin P_ ((struct frame *));
-extern void update_end P_ ((struct frame *));
-extern void set_terminal_window P_ ((struct frame *, int));
-extern void cursor_to P_ ((struct frame *, int, int));
-extern void raw_cursor_to P_ ((struct frame *, int, int));
-extern void clear_to_end P_ ((struct frame *));
-extern void clear_frame P_ ((struct frame *));
-extern void clear_end_of_line P_ ((struct frame *, int));
-extern void write_glyphs P_ ((struct frame *, struct glyph *, int));
-extern void insert_glyphs P_ ((struct frame *, struct glyph *, int));
-extern void delete_glyphs P_ ((struct frame *, int));
-extern void ins_del_lines P_ ((struct frame *, int, int));
+extern void ring_bell (struct frame *);
+extern void update_begin (struct frame *);
+extern void update_end (struct frame *);
+extern void set_terminal_window (struct frame *, int);
+extern void cursor_to (struct frame *, int, int);
+extern void raw_cursor_to (struct frame *, int, int);
+extern void clear_to_end (struct frame *);
+extern void clear_frame (struct frame *);
+extern void clear_end_of_line (struct frame *, int);
+extern void write_glyphs (struct frame *, struct glyph *, int);
+extern void insert_glyphs (struct frame *, struct glyph *, int);
+extern void delete_glyphs (struct frame *, int);
+extern void ins_del_lines (struct frame *, int, int);
 
-extern struct terminal *init_initial_terminal P_ ((void));
+extern struct terminal *init_initial_terminal (void);
 
 
 /* Defined in term.c */
 
-extern void tty_set_terminal_modes P_ ((struct terminal *));
-extern void tty_reset_terminal_modes P_ ((struct terminal *));
-extern void tty_turn_off_insert P_ ((struct tty_display_info *));
-extern void tty_turn_off_highlight P_ ((struct tty_display_info *));
-extern int string_cost P_ ((char *));
-extern int per_line_cost P_ ((char *));
-extern void calculate_costs P_ ((struct frame *));
-extern void produce_glyphs P_ ((struct it *));
-extern void produce_special_glyphs P_ ((struct it *, enum display_element_type));
-extern int tty_capable_p P_ ((struct tty_display_info *, unsigned, unsigned long, unsigned long));
+extern void tty_set_terminal_modes (struct terminal *);
+extern void tty_reset_terminal_modes (struct terminal *);
+extern void tty_turn_off_insert (struct tty_display_info *);
+extern void tty_turn_off_highlight (struct tty_display_info *);
+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_tty_terminal P_ ((Lisp_Object, int));
-extern struct terminal *get_named_tty P_ ((char *));
+extern struct terminal *get_tty_terminal (Lisp_Object, int);
+extern struct terminal *get_named_tty (const char *);
 EXFUN (Ftty_type, 1);
-extern void create_tty_output P_ ((struct frame *));
-extern struct terminal *init_tty P_ ((char *, char *, int));
+extern void create_tty_output (struct frame *);
+extern struct terminal *init_tty (const char *, const char *, int);
 
 
 /* Defined in scroll.c */
 
-extern int scrolling_max_lines_saved P_ ((int, int, int *, int *, int *));
-extern int scroll_cost P_ ((struct frame *, int, int, int));
-extern void do_line_insertion_deletion_costs P_ ((struct frame *, char *,
-                                                 char *, char *, char *,
-                                                 char *, char *, int));
-void scrolling_1 P_ ((struct frame *, int, int, int, int *, int *, int *,
-                     int *, int));
+extern int scrolling_max_lines_saved (int, int, int *, int *, int *);
+extern int scroll_cost (struct frame *, int, int, int);
+extern void do_line_insertion_deletion_costs (struct frame *, char *,
+                                              char *, char *, char *,
+                                              char *, char *, int);
+void scrolling_1 (struct frame *, int, int, int, int *, int *, int *,
+                  int *, int);
 
 /* Defined in frame.c */
 
@@ -3136,20 +3316,20 @@ enum resource_types
   RES_TYPE_BOOLEAN_NUMBER
 };
 
-extern Lisp_Object x_get_arg P_ ((Display_Info *, Lisp_Object,
-                                 Lisp_Object, char *, char *class,
-                                 enum resource_types));
-extern Lisp_Object x_frame_get_arg P_ ((struct frame *, Lisp_Object,
-                                       Lisp_Object, char *, char *,
-                                       enum resource_types));
-extern Lisp_Object x_frame_get_and_record_arg P_ ((
-                                       struct frame *, Lisp_Object,
-                                       Lisp_Object, char *, char *,
-                                       enum resource_types));
-extern Lisp_Object x_default_parameter P_ ((struct frame *, Lisp_Object,
-                                           Lisp_Object, Lisp_Object,
-                                           char *, char *,
-                                           enum resource_types));
+extern Lisp_Object x_get_arg (Display_Info *, Lisp_Object,
+                              Lisp_Object, const char *, const char *class,
+                              enum resource_types);
+extern Lisp_Object x_frame_get_arg (struct frame *, Lisp_Object,
+                                    Lisp_Object, const char *, const char *,
+                                    enum resource_types);
+extern Lisp_Object x_frame_get_and_record_arg (struct frame *, Lisp_Object,
+                                               Lisp_Object,
+                                              const char *, const char *,
+                                               enum resource_types);
+extern Lisp_Object x_default_parameter (struct frame *, Lisp_Object,
+                                        Lisp_Object, Lisp_Object,
+                                        const char *, const char *,
+                                        enum resource_types);
 
 #endif /* HAVE_WINDOW_SYSTEM */
 
index d32ce48cce6a190619ee1a2b1cccac864daba3cf..9344d792f3dce08fcf9a327ad7aa32fc4c5cdabd 100644 (file)
@@ -47,9 +47,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "blockinput.h"
 #include "process.h"
 
-/* I don't know why DEC Alpha OSF1 fail to compile this file if we
-   include the following file.  */
-/* #include "systty.h" */
 #include "syssignal.h"
 
 #ifdef HAVE_X_WINDOWS
@@ -69,12 +66,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "systime.h"
 #include <errno.h>
 
-/* To get the prototype for `sleep'.  */
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
 /* Get number of chars of output now in the buffer of a stdio stream.
    This ought to be built in in stdio, but it isn't.  Some s- files
    override this because their stdio internals differ.  */
@@ -117,73 +108,73 @@ struct dim
 \f
 /* Function prototypes.  */
 
-static struct glyph_matrix *save_current_matrix P_ ((struct frame *));
-static void restore_current_matrix P_ ((struct frame *, struct glyph_matrix *));
-static int showing_window_margins_p P_ ((struct window *));
-static void fake_current_matrices P_ ((Lisp_Object));
-static void redraw_overlapping_rows P_ ((struct window *, int));
-static void redraw_overlapped_rows P_ ((struct window *, int));
-static int count_blanks P_ ((struct glyph *, int));
-static int count_match P_ ((struct glyph *, struct glyph *,
-                           struct glyph *, struct glyph *));
-static unsigned line_draw_cost P_ ((struct glyph_matrix *, int));
-static void update_frame_line P_ ((struct frame *, int));
+static struct glyph_matrix *save_current_matrix (struct frame *);
+static void restore_current_matrix (struct frame *, struct glyph_matrix *);
+static int showing_window_margins_p (struct window *);
+static void fake_current_matrices (Lisp_Object);
+static void redraw_overlapping_rows (struct window *, int);
+static void redraw_overlapped_rows (struct window *, int);
+static int count_blanks (struct glyph *, int);
+static int count_match (struct glyph *, struct glyph *,
+                        struct glyph *, struct glyph *);
+static unsigned line_draw_cost (struct glyph_matrix *, int);
+static void update_frame_line (struct frame *, int);
 static struct dim allocate_matrices_for_frame_redisplay
-     P_ ((Lisp_Object, int, int, int, int *));
-static void allocate_matrices_for_window_redisplay P_ ((struct window *));
-static int realloc_glyph_pool P_ ((struct glyph_pool *, struct dim));
-static void adjust_frame_glyphs P_ ((struct frame *));
-struct glyph_matrix *new_glyph_matrix P_ ((struct glyph_pool *));
-static void free_glyph_matrix P_ ((struct glyph_matrix *));
-static void adjust_glyph_matrix P_ ((struct window *, struct glyph_matrix *,
-                                    int, int, struct dim));
-static void change_frame_size_1 P_ ((struct frame *, int, int, int, int, int));
-static void swap_glyph_pointers P_ ((struct glyph_row *, struct glyph_row *));
+     (Lisp_Object, int, int, int, int *);
+static void allocate_matrices_for_window_redisplay (struct window *);
+static int realloc_glyph_pool (struct glyph_pool *, struct dim);
+static void adjust_frame_glyphs (struct frame *);
+struct glyph_matrix *new_glyph_matrix (struct glyph_pool *);
+static void free_glyph_matrix (struct glyph_matrix *);
+static void adjust_glyph_matrix (struct window *, struct glyph_matrix *,
+                                 int, int, struct dim);
+static void change_frame_size_1 (struct frame *, int, int, int, int, int);
+static void swap_glyph_pointers (struct glyph_row *, struct glyph_row *);
 #if GLYPH_DEBUG
-static int glyph_row_slice_p P_ ((struct glyph_row *, struct glyph_row *));
+static int glyph_row_slice_p (struct glyph_row *, struct glyph_row *);
 #endif
-static void fill_up_frame_row_with_spaces P_ ((struct glyph_row *, int));
-static void build_frame_matrix_from_window_tree P_ ((struct glyph_matrix *,
-                                                    struct window *));
-static void build_frame_matrix_from_leaf_window P_ ((struct glyph_matrix *,
-                                                    struct window *));
-static struct glyph_pool *new_glyph_pool P_ ((void));
-static void free_glyph_pool P_ ((struct glyph_pool *));
-static void adjust_frame_glyphs_initially P_ ((void));
-static void adjust_frame_message_buffer P_ ((struct frame *));
-static void adjust_decode_mode_spec_buffer P_ ((struct frame *));
-static void fill_up_glyph_row_with_spaces P_ ((struct glyph_row *));
-static void build_frame_matrix P_ ((struct frame *));
-void clear_current_matrices P_ ((struct frame *));
-void scroll_glyph_matrix_range P_ ((struct glyph_matrix *, int, int,
-                                   int, int));
-static void clear_window_matrices P_ ((struct window *, int));
-static void fill_up_glyph_row_area_with_spaces P_ ((struct glyph_row *, int));
-static int scrolling_window P_ ((struct window *, int));
-static int update_window_line P_ ((struct window *, int, int *));
-static void update_marginal_area P_ ((struct window *, int, int));
-static int update_text_area P_ ((struct window *, int));
-static void make_current P_ ((struct glyph_matrix *, struct glyph_matrix *,
-                             int));
-static void mirror_make_current P_ ((struct window *, int));
-void check_window_matrix_pointers P_ ((struct window *));
+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 *);
+static void build_frame_matrix_from_leaf_window (struct glyph_matrix *,
+                                                 struct window *);
+static struct glyph_pool *new_glyph_pool (void);
+static void free_glyph_pool (struct glyph_pool *);
+static void adjust_frame_glyphs_initially (void);
+static void adjust_frame_message_buffer (struct frame *);
+static void adjust_decode_mode_spec_buffer (struct frame *);
+static void fill_up_glyph_row_with_spaces (struct glyph_row *);
+static void build_frame_matrix (struct frame *);
+void clear_current_matrices (struct frame *);
+void scroll_glyph_matrix_range (struct glyph_matrix *, int, int,
+                                int, int);
+static void clear_window_matrices (struct window *, int);
+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 update_marginal_area (struct window *, int, int);
+static int update_text_area (struct window *, int);
+static void make_current (struct glyph_matrix *, struct glyph_matrix *,
+                          int);
+static void mirror_make_current (struct window *, int);
+void check_window_matrix_pointers (struct window *);
 #if GLYPH_DEBUG
-static void check_matrix_pointers P_ ((struct glyph_matrix *,
-                                      struct glyph_matrix *));
+static void check_matrix_pointers (struct glyph_matrix *,
+                                   struct glyph_matrix *);
 #endif
-static void mirror_line_dance P_ ((struct window *, int, int, int *, char *));
-static int update_window_tree P_ ((struct window *, int));
-static int update_window P_ ((struct window *, int));
-static int update_frame_1 P_ ((struct frame *, int, int));
-static void set_window_cursor_after_update P_ ((struct window *));
-static int row_equal_p P_ ((struct window *, struct glyph_row *,
-                           struct glyph_row *, int));
-static void adjust_frame_glyphs_for_window_redisplay P_ ((struct frame *));
-static void adjust_frame_glyphs_for_frame_redisplay P_ ((struct frame *));
-static void reverse_rows P_ ((struct glyph_matrix *, int, int));
-static int margin_glyphs_to_reserve P_ ((struct window *, int, Lisp_Object));
-static void sync_window_with_frame_matrix_rows P_ ((struct window *));
-struct window *frame_row_to_window P_ ((struct window *, int));
+static void mirror_line_dance (struct window *, int, int, int *, char *);
+static int update_window_tree (struct window *, int);
+static int update_window (struct window *, int);
+static int update_frame_1 (struct frame *, int, int);
+static void set_window_cursor_after_update (struct window *);
+static int row_equal_p (struct window *, struct glyph_row *,
+                        struct glyph_row *, int);
+static void adjust_frame_glyphs_for_window_redisplay (struct frame *);
+static void adjust_frame_glyphs_for_frame_redisplay (struct frame *);
+static void reverse_rows (struct glyph_matrix *, int, int);
+static int margin_glyphs_to_reserve (struct window *, int, Lisp_Object);
+static void sync_window_with_frame_matrix_rows (struct window *);
+struct window *frame_row_to_window (struct window *, int);
 
 \f
 /* Non-zero means don't pause redisplay for pending input.  (This is
@@ -302,12 +293,6 @@ int updated_area;
 
 struct glyph space_glyph;
 
-/* Non-zero means update has been performed directly, so that there's
-   no need for redisplay_internal to do much work.  Set by
-   direct_output_for_insert.  */
-
-int redisplay_performed_directly_p;
-
 /* Counts of allocated structures.  These counts serve to diagnose
    memory leaks and double frees.  */
 
@@ -334,8 +319,8 @@ int fonts_changed_p;
 
 #if GLYPH_DEBUG
 
-static int window_to_frame_vpos P_ ((struct window *, int));
-static int window_to_frame_hpos P_ ((struct window *, int));
+static int window_to_frame_vpos (struct window *, int);
+static int window_to_frame_hpos (struct window *, int);
 #define WINDOW_TO_FRAME_VPOS(W, VPOS) window_to_frame_vpos ((W), (VPOS))
 #define WINDOW_TO_FRAME_HPOS(W, HPOS) window_to_frame_hpos ((W), (HPOS))
 
@@ -364,8 +349,8 @@ static int history_idx;
 
 static unsigned history_tick;
 
-static void add_frame_display_history P_ ((struct frame *, int));
-static void add_window_display_history P_ ((struct window *, char *, int));
+static void add_frame_display_history (struct frame *, int);
+static void add_window_display_history (struct window *, char *, int);
 \f
 /* Add to the redisplay history how window W has been displayed.
    MSG is a trace containing the information how W's glyph matrix
@@ -422,7 +407,7 @@ add_frame_display_history (f, paused_p)
 DEFUN ("dump-redisplay-history", Fdump_redisplay_history,
        Sdump_redisplay_history, 0, 0, "",
        doc: /* Dump redisplay history to stderr.  */)
-     ()
+  (void)
 {
   int i;
 
@@ -445,65 +430,15 @@ DEFUN ("dump-redisplay-history", Fdump_redisplay_history,
 #endif /* GLYPH_DEBUG == 0 */
 
 
-/* Like bcopy except never gets confused by overlap.  Let this be the
-   first function defined in this file, or change emacs.c where the
-   address of this function is used.  */
+#if defined PROFILING && !HAVE___EXECUTABLE_START
+/* FIXME: only used to find text start for profiling.  */
 
 void
-safe_bcopy (from, to, size)
-     const char *from;
-     char *to;
-     int size;
+safe_bcopy (const char *from, char *to, int size)
 {
-  if (size <= 0 || from == to)
-    return;
-
-  /* If the source and destination don't overlap, then bcopy can
-     handle it.  If they do overlap, but the destination is lower in
-     memory than the source, we'll assume bcopy can handle that.  */
-  if (to < from || from + size <= to)
-    bcopy (from, to, size);
-
-  /* Otherwise, we'll copy from the end.  */
-  else
-    {
-      register const char *endf = from + size;
-      register char *endt = to + size;
-
-      /* If TO - FROM is large, then we should break the copy into
-        nonoverlapping chunks of TO - FROM bytes each.  However, if
-        TO - FROM is small, then the bcopy function call overhead
-        makes this not worth it.  The crossover point could be about
-        anywhere.  Since I don't think the obvious copy loop is too
-        bad, I'm trying to err in its favor.  */
-      if (to - from < 64)
-       {
-         do
-           *--endt = *--endf;
-         while (endf != from);
-       }
-      else
-       {
-         for (;;)
-           {
-             endt -= (to - from);
-             endf -= (to - from);
-
-             if (endt < to)
-               break;
-
-             bcopy (endf, endt, to - from);
-           }
-
-         /* If SIZE wasn't a multiple of TO - FROM, there will be a
-            little left over.  The amount left over is (endt + (to -
-            from)) - to, which is endt - from.  */
-         bcopy (from, to, endt - from);
-       }
-    }
+  abort ();
 }
-
-
+#endif
 \f
 /***********************************************************************
                            Glyph Matrices
@@ -516,14 +451,13 @@ safe_bcopy (from, to, size)
    POOL, the structure is otherwise zeroed.  */
 
 struct glyph_matrix *
-new_glyph_matrix (pool)
-     struct glyph_pool *pool;
+new_glyph_matrix (struct glyph_pool *pool)
 {
   struct glyph_matrix *result;
 
   /* Allocate and clear.  */
   result = (struct glyph_matrix *) xmalloc (sizeof *result);
-  bzero (result, sizeof *result);
+  memset (result, 0, sizeof *result);
 
   /* Increment number of allocated matrices.  This count is used
      to detect memory leaks.  */
@@ -547,8 +481,7 @@ new_glyph_matrix (pool)
    matrix also frees the glyph memory in this case.  */
 
 static void
-free_glyph_matrix (matrix)
-     struct glyph_matrix *matrix;
+free_glyph_matrix (struct glyph_matrix *matrix)
 {
   if (matrix)
     {
@@ -578,10 +511,7 @@ free_glyph_matrix (matrix)
    or a float.  */
 
 static int
-margin_glyphs_to_reserve (w, total_glyphs, margin)
-     struct window *w;
-     int total_glyphs;
-     Lisp_Object margin;
+margin_glyphs_to_reserve (struct window *w, int total_glyphs, Lisp_Object margin)
 {
   int n;
 
@@ -622,11 +552,7 @@ margin_glyphs_to_reserve (w, total_glyphs, margin)
    leads to screen flickering.  */
 
 static void
-adjust_glyph_matrix (w, matrix, x, y, dim)
-     struct window *w;
-     struct glyph_matrix *matrix;
-     int x, y;
-     struct dim dim;
+adjust_glyph_matrix (struct window *w, struct glyph_matrix *matrix, int x, int y, struct dim dim)
 {
   int i;
   int new_rows;
@@ -676,8 +602,8 @@ adjust_glyph_matrix (w, matrix, x, y, dim)
       int size = dim.height * sizeof (struct glyph_row);
       new_rows = dim.height - matrix->rows_allocated;
       matrix->rows = (struct glyph_row *) xrealloc (matrix->rows, size);
-      bzero (matrix->rows + matrix->rows_allocated,
-            new_rows * sizeof *matrix->rows);
+      memset (matrix->rows + matrix->rows_allocated, 0,
+             new_rows * sizeof *matrix->rows);
       matrix->rows_allocated = dim.height;
     }
   else
@@ -869,9 +795,7 @@ adjust_glyph_matrix (w, matrix, x, y, dim)
    below).  */
 
 static void
-reverse_rows (matrix, start, end)
-     struct glyph_matrix *matrix;
-     int start, end;
+reverse_rows (struct glyph_matrix *matrix, int start, int end)
 {
   int i, j;
 
@@ -900,9 +824,7 @@ reverse_rows (matrix, start, end)
    rotating right.  */
 
 void
-rotate_matrix (matrix, first, last, by)
-     struct glyph_matrix *matrix;
-     int first, last, by;
+rotate_matrix (struct glyph_matrix *matrix, int first, int last, int by)
 {
   if (by < 0)
     {
@@ -927,9 +849,7 @@ rotate_matrix (matrix, first, last, by)
    DELTA_BYTES.  */
 
 void
-increment_matrix_positions (matrix, start, end, delta, delta_bytes)
-     struct glyph_matrix *matrix;
-     int start, end, delta, delta_bytes;
+increment_matrix_positions (struct glyph_matrix *matrix, int start, int end, int delta, int delta_bytes)
 {
   /* Check that START and END are reasonable values.  */
   xassert (start >= 0 && start <= matrix->nrows);
@@ -946,10 +866,7 @@ increment_matrix_positions (matrix, start, end, delta, delta_bytes)
    ENABLED_P is non-zero, enabled_p flags in rows will be set to 1.  */
 
 void
-enable_glyph_matrix_rows (matrix, start, end, enabled_p)
-     struct glyph_matrix *matrix;
-     int start, end;
-     int enabled_p;
+enable_glyph_matrix_rows (struct glyph_matrix *matrix, int start, int end, int enabled_p)
 {
   xassert (start <= end);
   xassert (start >= 0 && start < matrix->nrows);
@@ -971,8 +888,7 @@ enable_glyph_matrix_rows (matrix, start, end, enabled_p)
    currently present is the flag MATRIX->no_scrolling_p.  */
 
 void
-clear_glyph_matrix (matrix)
-     struct glyph_matrix *matrix;
+clear_glyph_matrix (struct glyph_matrix *matrix)
 {
   if (matrix)
     {
@@ -987,10 +903,7 @@ clear_glyph_matrix (matrix)
    and recompute their visible height.  */
 
 void
-shift_glyph_matrix (w, matrix, start, end, dy)
-     struct window *w;
-     struct glyph_matrix *matrix;
-     int start, end, dy;
+shift_glyph_matrix (struct window *w, struct glyph_matrix *matrix, int start, int end, int dy)
 {
   int min_y, max_y;
 
@@ -1021,8 +934,7 @@ shift_glyph_matrix (w, matrix, start, end, dy)
    current matrix.  */
 
 void
-clear_current_matrices (f)
-     register struct frame *f;
+clear_current_matrices (register struct frame *f)
 {
   /* Clear frame current matrix, if we have one.  */
   if (f->current_matrix)
@@ -1047,8 +959,7 @@ clear_current_matrices (f)
 /* Clear out all display lines of F for a coming redisplay.  */
 
 void
-clear_desired_matrices (f)
-     register struct frame *f;
+clear_desired_matrices (register struct frame *f)
 {
   if (f->desired_matrix)
     clear_glyph_matrix (f->desired_matrix);
@@ -1069,9 +980,7 @@ clear_desired_matrices (f)
    non-zero clear desired matrices, otherwise clear current matrices.  */
 
 static void
-clear_window_matrices (w, desired_p)
-     struct window *w;
-     int desired_p;
+clear_window_matrices (struct window *w, int desired_p)
 {
   while (w)
     {
@@ -1115,8 +1024,7 @@ clear_window_matrices (w, desired_p)
 static struct glyph_row null_row;
 
 void
-clear_glyph_row (row)
-     struct glyph_row *row;
+clear_glyph_row (struct glyph_row *row)
 {
   struct glyph *p[1 + LAST_AREA];
 
@@ -1142,7 +1050,7 @@ clear_glyph_row (row)
         returned by xmalloc.  If flickering happens again, activate
         the code below.  If the flickering is gone with that, chances
         are that the flickering has the same reason as here.  */
-  bzero (p[0], (char *) p[LAST_AREA] - (char *) p[0]);
+  memset (p[0], 0, (char *) p[LAST_AREA] - (char *) p[0]);
 #endif
 }
 
@@ -1151,10 +1059,7 @@ clear_glyph_row (row)
    in window W starting at y-position Y.  */
 
 void
-blank_row (w, row, y)
-     struct window *w;
-     struct glyph_row *row;
-     int y;
+blank_row (struct window *w, struct glyph_row *row, int y)
 {
   int min_y, max_y;
 
@@ -1183,9 +1088,7 @@ blank_row (w, row, y)
    ends.  */
 
 void
-increment_row_positions (row, delta, delta_bytes)
-     struct glyph_row *row;
-     int delta, delta_bytes;
+increment_row_positions (struct glyph_row *row, int delta, int delta_bytes)
 {
   int area, i;
 
@@ -1194,6 +1097,10 @@ increment_row_positions (row, delta, delta_bytes)
   MATRIX_ROW_START_BYTEPOS (row) += delta_bytes;
   MATRIX_ROW_END_CHARPOS (row) += delta;
   MATRIX_ROW_END_BYTEPOS (row) += delta_bytes;
+  CHARPOS (row->start.pos) += delta;
+  BYTEPOS (row->start.pos) += delta_bytes;
+  CHARPOS (row->end.pos) += delta;
+  BYTEPOS (row->end.pos) += delta_bytes;
 
   if (!row->enabled_p)
     return;
@@ -1256,8 +1163,7 @@ swap_glyphs_in_rows (a, b)
 /* Exchange pointers to glyph memory between glyph rows A and B.  */
 
 static INLINE void
-swap_glyph_pointers (a, b)
-     struct glyph_row *a, *b;
+swap_glyph_pointers (struct glyph_row *a, struct glyph_row *b)
 {
   int i;
   for (i = 0; i < LAST_AREA + 1; ++i)
@@ -1273,19 +1179,18 @@ swap_glyph_pointers (a, b)
    that glyph pointers in the structures are left unchanged.  */
 
 INLINE void
-copy_row_except_pointers (to, from)
-     struct glyph_row *to, *from;
+copy_row_except_pointers (struct glyph_row *to, struct glyph_row *from)
 {
   struct glyph *pointers[1 + LAST_AREA];
 
   /* Save glyph pointers of TO.  */
-  bcopy (to->glyphs, pointers, sizeof to->glyphs);
+  memcpy (pointers, to->glyphs, sizeof to->glyphs);
 
   /* Do a structure assignment.  */
   *to = *from;
 
   /* Restore original pointers of TO.  */
-  bcopy (pointers, to->glyphs, sizeof to->glyphs);
+  memcpy (to->glyphs, pointers, sizeof to->glyphs);
 }
 
 
@@ -1295,9 +1200,7 @@ copy_row_except_pointers (to, from)
    positions in row TO by DELTA/ DELTA_BYTES.  */
 
 void
-copy_glyph_row_contents (to, from, delta, delta_bytes)
-     struct glyph_row *to, *from;
-     int delta, delta_bytes;
+copy_glyph_row_contents (struct glyph_row *to, struct glyph_row *from, int delta, int delta_bytes)
 {
   int area;
 
@@ -1308,8 +1211,8 @@ copy_glyph_row_contents (to, from, delta, delta_bytes)
   /* Copy glyphs from FROM to TO.  */
   for (area = 0; area < LAST_AREA; ++area)
     if (from->used[area])
-      bcopy (from->glyphs[area], to->glyphs[area],
-            from->used[area] * sizeof (struct glyph));
+      memcpy (to->glyphs[area], from->glyphs[area],
+             from->used[area] * sizeof (struct glyph));
 
   /* Increment buffer positions in TO by DELTA.  */
   increment_row_positions (to, delta, delta_bytes);
@@ -1322,8 +1225,7 @@ copy_glyph_row_contents (to, from, delta, delta_bytes)
    a memory leak.  */
 
 static INLINE void
-assign_row (to, from)
-     struct glyph_row *to, *from;
+assign_row (struct glyph_row *to, struct glyph_row *from)
 {
   swap_glyph_pointers (to, from);
   copy_row_except_pointers (to, from);
@@ -1383,13 +1285,15 @@ find_glyph_row_slice (window_matrix, frame_matrix, row)
    call to this function really clears it.  */
 
 void
-prepare_desired_row (row)
-     struct glyph_row *row;
+prepare_desired_row (struct glyph_row *row)
 {
   if (!row->enabled_p)
     {
+      unsigned rp = row->reversed_p;
+
       clear_glyph_row (row);
       row->enabled_p = 1;
+      row->reversed_p = rp;
     }
 }
 
@@ -1397,8 +1301,7 @@ prepare_desired_row (row)
 /* Return a hash code for glyph row ROW.  */
 
 int
-line_hash_code (row)
-     struct glyph_row *row;
+line_hash_code (struct glyph_row *row)
 {
   int hash = 0;
 
@@ -1431,9 +1334,7 @@ line_hash_code (row)
    zero, leading and trailing spaces are ignored.  */
 
 static unsigned int
-line_draw_cost (matrix, vpos)
-     struct glyph_matrix *matrix;
-     int vpos;
+line_draw_cost (struct glyph_matrix *matrix, int vpos)
 {
   struct glyph_row *row = matrix->rows + vpos;
   struct glyph *beg = row->glyphs[TEXT_AREA];
@@ -1494,10 +1395,7 @@ line_draw_cost (matrix, vpos)
    flags of A and B, too.  */
 
 static INLINE int
-row_equal_p (w, a, b, mouse_face_p)
-     struct window *w;
-     struct glyph_row *a, *b;
-     int mouse_face_p;
+row_equal_p (struct window *w, struct glyph_row *a, struct glyph_row *b, int mouse_face_p)
 {
   if (a == b)
     return 1;
@@ -1540,6 +1438,7 @@ row_equal_p (w, a, b, mouse_face_p)
          || a->overlapped_p != b->overlapped_p
          || (MATRIX_ROW_CONTINUATION_LINE_P (a)
              != MATRIX_ROW_CONTINUATION_LINE_P (b))
+         || a->reversed_p != b->reversed_p
          /* Different partially visible characters on left margin.  */
          || a->x != b->x
          /* Different height.  */
@@ -1566,13 +1465,13 @@ row_equal_p (w, a, b, mouse_face_p)
    incremented for each pool allocated.  */
 
 static struct glyph_pool *
-new_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);
-  bzero (result, sizeof *result);
+  memset (result, 0, sizeof *result);
 
   /* For memory leak and double deletion checking.  */
   ++glyph_pool_count;
@@ -1589,8 +1488,7 @@ new_glyph_pool ()
    was passed to free_glyph_pool.  */
 
 static void
-free_glyph_pool (pool)
-     struct glyph_pool *pool;
+free_glyph_pool (struct glyph_pool *pool)
 {
   if (pool)
     {
@@ -1614,9 +1512,7 @@ free_glyph_pool (pool)
    re-adjusting window glyph matrices necessary.  */
 
 static int
-realloc_glyph_pool (pool, matrix_dim)
-     struct glyph_pool *pool;
-     struct dim matrix_dim;
+realloc_glyph_pool (struct glyph_pool *pool, struct dim matrix_dim)
 {
   int needed;
   int changed_p;
@@ -1632,11 +1528,15 @@ realloc_glyph_pool (pool, matrix_dim)
       int size = needed * sizeof (struct glyph);
 
       if (pool->glyphs)
-       pool->glyphs = (struct glyph *) xrealloc (pool->glyphs, size);
+       {
+         pool->glyphs = (struct glyph *) xrealloc (pool->glyphs, size);
+         memset (pool->glyphs + pool->nglyphs, 0,
+                 size - pool->nglyphs * sizeof (struct glyph));
+       }
       else
        {
          pool->glyphs = (struct glyph *) xmalloc (size);
-         bzero (pool->glyphs, size);
+         memset (pool->glyphs, 0, size);
        }
 
       pool->nglyphs = needed;
@@ -1750,13 +1650,19 @@ check_matrix_invariants (w)
       /* Check that character and byte positions are in sync.  */
       xassert (MATRIX_ROW_START_BYTEPOS (row)
               == CHAR_TO_BYTE (MATRIX_ROW_START_CHARPOS (row)));
+      xassert (BYTEPOS (row->start.pos)
+              == CHAR_TO_BYTE (CHARPOS (row->start.pos)));
 
       /* CHAR_TO_BYTE aborts when invoked for a position > Z.  We can
         have such a position temporarily in case of a minibuffer
         displaying something like `[Sole completion]' at its end.  */
       if (MATRIX_ROW_END_CHARPOS (row) < BUF_ZV (current_buffer))
-       xassert (MATRIX_ROW_END_BYTEPOS (row)
-                == CHAR_TO_BYTE (MATRIX_ROW_END_CHARPOS (row)));
+       {
+         xassert (MATRIX_ROW_END_BYTEPOS (row)
+                  == CHAR_TO_BYTE (MATRIX_ROW_END_CHARPOS (row)));
+         xassert (BYTEPOS (row->end.pos)
+                  == CHAR_TO_BYTE (CHARPOS (row->end.pos)));
+       }
 
       /* Check that end position of `row' is equal to start position
         of next row.  */
@@ -1766,6 +1672,8 @@ check_matrix_invariants (w)
                   == MATRIX_ROW_START_CHARPOS (next));
          xassert (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));
        }
       row = next;
     }
@@ -1866,12 +1774,8 @@ check_matrix_invariants (w)
 #define CHANGED_LEAF_MATRIX    (1 << 1)
 
 static struct dim
-allocate_matrices_for_frame_redisplay (window, x, y, dim_only_p,
-                                      window_change_flags)
-     Lisp_Object window;
-     int x, y;
-     int dim_only_p;
-     int *window_change_flags;
+allocate_matrices_for_frame_redisplay (Lisp_Object window, int x, int y,
+                                      int dim_only_p, int *window_change_flags)
 {
   struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (window)));
   int x0 = x, y0 = y;
@@ -1987,8 +1891,7 @@ allocate_matrices_for_frame_redisplay (window, x, y, dim_only_p,
 /* Return the required height of glyph matrices for window W.  */
 
 int
-required_matrix_height (w)
-     struct window *w;
+required_matrix_height (struct window *w)
 {
 #ifdef HAVE_WINDOW_SYSTEM
   struct frame *f = XFRAME (w->frame);
@@ -2014,8 +1917,7 @@ required_matrix_height (w)
 /* Return the required width of glyph matrices for window W.  */
 
 int
-required_matrix_width (w)
-     struct window *w;
+required_matrix_width (struct window *w)
 {
 #ifdef HAVE_WINDOW_SYSTEM
   struct frame *f = XFRAME (w->frame);
@@ -2043,8 +1945,7 @@ required_matrix_width (w)
    window whose matrices must be allocated/reallocated.  */
 
 static void
-allocate_matrices_for_window_redisplay (w)
-     struct window *w;
+allocate_matrices_for_window_redisplay (struct window *w)
 {
   while (w)
     {
@@ -2081,8 +1982,7 @@ allocate_matrices_for_window_redisplay (w)
    changes, or its window configuration changes.  */
 
 void
-adjust_glyphs (f)
-     struct frame *f;
+adjust_glyphs (struct frame *f)
 {
   /* Block input so that expose events and other events that access
      glyph matrices are not processed while we are changing them.  */
@@ -2114,7 +2014,7 @@ adjust_glyphs (f)
    windows to estimated values.  */
 
 static void
-adjust_frame_glyphs_initially ()
+adjust_frame_glyphs_initially (void)
 {
   struct frame *sf = SELECTED_FRAME ();
   struct window *root = XWINDOW (sf->root_window);
@@ -2141,8 +2041,7 @@ adjust_frame_glyphs_initially ()
 /* Allocate/reallocate glyph matrices of a single frame F.  */
 
 static void
-adjust_frame_glyphs (f)
-     struct frame *f;
+adjust_frame_glyphs (struct frame *f)
 {
   if (FRAME_WINDOW_P (f))
     adjust_frame_glyphs_for_window_redisplay (f);
@@ -2160,8 +2059,7 @@ adjust_frame_glyphs (f)
 /* Return 1 if any window in the tree has nonzero window margins.  See
    the hack at the end of adjust_frame_glyphs_for_frame_redisplay.  */
 static int
-showing_window_margins_p (w)
-     struct window *w;
+showing_window_margins_p (struct window *w)
 {
   while (w)
     {
@@ -2189,8 +2087,7 @@ showing_window_margins_p (w)
    windows from the frame's current matrix.  */
 
 static void
-fake_current_matrices (window)
-     Lisp_Object window;
+fake_current_matrices (Lisp_Object window)
 {
   struct window *w;
 
@@ -2240,18 +2137,17 @@ fake_current_matrices (window)
    a glyph matrix holding the contents of F's current frame matrix.  */
 
 static struct glyph_matrix *
-save_current_matrix (f)
-     struct frame *f;
+save_current_matrix (struct frame *f)
 {
   int i;
   struct glyph_matrix *saved;
 
   saved = (struct glyph_matrix *) xmalloc (sizeof *saved);
-  bzero (saved, sizeof *saved);
+  memset (saved, 0, sizeof *saved);
   saved->nrows = f->current_matrix->nrows;
   saved->rows = (struct glyph_row *) xmalloc (saved->nrows
                                              * sizeof *saved->rows);
-  bzero (saved->rows, saved->nrows * sizeof *saved->rows);
+  memset (saved->rows, 0, saved->nrows * sizeof *saved->rows);
 
   for (i = 0; i < saved->nrows; ++i)
     {
@@ -2259,7 +2155,7 @@ save_current_matrix (f)
       struct glyph_row *to = saved->rows + i;
       size_t nbytes = from->used[TEXT_AREA] * sizeof (struct glyph);
       to->glyphs[TEXT_AREA] = (struct glyph *) xmalloc (nbytes);
-      bcopy (from->glyphs[TEXT_AREA], to->glyphs[TEXT_AREA], nbytes);
+      memcpy (to->glyphs[TEXT_AREA], from->glyphs[TEXT_AREA], nbytes);
       to->used[TEXT_AREA] = from->used[TEXT_AREA];
     }
 
@@ -2271,9 +2167,7 @@ save_current_matrix (f)
    and free memory associated with SAVED.  */
 
 static void
-restore_current_matrix (f, saved)
-     struct frame *f;
-     struct glyph_matrix *saved;
+restore_current_matrix (struct frame *f, struct glyph_matrix *saved)
 {
   int i;
 
@@ -2282,7 +2176,7 @@ restore_current_matrix (f, saved)
       struct glyph_row *from = saved->rows + i;
       struct glyph_row *to = f->current_matrix->rows + i;
       size_t nbytes = from->used[TEXT_AREA] * sizeof (struct glyph);
-      bcopy (from->glyphs[TEXT_AREA], to->glyphs[TEXT_AREA], nbytes);
+      memcpy (to->glyphs[TEXT_AREA], from->glyphs[TEXT_AREA], nbytes);
       to->used[TEXT_AREA] = from->used[TEXT_AREA];
       xfree (from->glyphs[TEXT_AREA]);
     }
@@ -2297,8 +2191,7 @@ restore_current_matrix (f, saved)
    frame-based redisplay.  */
 
 static void
-adjust_frame_glyphs_for_frame_redisplay (f)
-     struct frame *f;
+adjust_frame_glyphs_for_frame_redisplay (struct frame *f)
 {
   struct dim matrix_dim;
   int pool_changed_p;
@@ -2398,8 +2291,7 @@ adjust_frame_glyphs_for_frame_redisplay (f)
    window-based redisplay.  */
 
 static void
-adjust_frame_glyphs_for_window_redisplay (f)
-     struct frame *f;
+adjust_frame_glyphs_for_window_redisplay (struct frame *f)
 {
   struct window *w;
 
@@ -2467,8 +2359,7 @@ adjust_frame_glyphs_for_window_redisplay (f)
    eventually without causing trouble).  */
 
 static void
-adjust_frame_message_buffer (f)
-     struct frame *f;
+adjust_frame_message_buffer (struct frame *f)
 {
   int size = FRAME_MESSAGE_BUF_SIZE (f) + 1;
 
@@ -2486,8 +2377,7 @@ adjust_frame_message_buffer (f)
 /* Re-allocate buffer for decode_mode_spec on frame F.  */
 
 static void
-adjust_decode_mode_spec_buffer (f)
-     struct frame *f;
+adjust_decode_mode_spec_buffer (struct frame *f)
 {
   f->decode_mode_spec_buffer
     = (char *) xrealloc (f->decode_mode_spec_buffer,
@@ -2506,8 +2396,7 @@ adjust_decode_mode_spec_buffer (f)
    the function is called when F is destroyed.  */
 
 void
-free_glyphs (f)
-     struct frame *f;
+free_glyphs (struct frame *f)
 {
   if (f && f->glyphs_initialized_p)
     {
@@ -2568,8 +2457,7 @@ free_glyphs (f)
    the same tree more than once.  */
 
 void
-free_window_matrices (w)
-     struct window *w;
+free_window_matrices (struct window *w)
 {
   while (w)
     {
@@ -2599,7 +2487,7 @@ free_window_matrices (w)
    explicitly and check that nothing is left allocated.  */
 
 void
-check_glyph_memory ()
+check_glyph_memory (void)
 {
   Lisp_Object tail, frame;
 
@@ -2683,8 +2571,7 @@ check_glyph_memory ()
    sure not to touch them in this function.  */
 
 static void
-build_frame_matrix (f)
-     struct frame *f;
+build_frame_matrix (struct frame *f)
 {
   int i;
 
@@ -2706,9 +2593,7 @@ build_frame_matrix (f)
    matrices.  W is the root of a window tree.  */
 
 static void
-build_frame_matrix_from_window_tree (matrix, w)
-     struct glyph_matrix *matrix;
-     struct window *w;
+build_frame_matrix_from_window_tree (struct glyph_matrix *matrix, struct window *w)
 {
   while (w)
     {
@@ -2736,9 +2621,7 @@ build_frame_matrix_from_window_tree (matrix, w)
    preserve_other_columns in the old redisplay.  */
 
 static void
-build_frame_matrix_from_leaf_window (frame_matrix, w)
-     struct glyph_matrix *frame_matrix;
-     struct window *w;
+build_frame_matrix_from_leaf_window (struct glyph_matrix *frame_matrix, struct window *w)
 {
   struct glyph_matrix *window_matrix;
   int window_y, frame_y;
@@ -2804,9 +2687,9 @@ build_frame_matrix_from_leaf_window (frame_matrix, w)
       if (current_row_p)
        {
          /* Copy window row to frame row.  */
-         bcopy (window_row->glyphs[0],
-                frame_row->glyphs[TEXT_AREA] + window_matrix->matrix_x,
-                window_matrix->matrix_w * sizeof (struct glyph));
+         memcpy (frame_row->glyphs[TEXT_AREA] + window_matrix->matrix_x,
+                 window_row->glyphs[0],
+                 window_matrix->matrix_w * sizeof (struct glyph));
        }
       else
        {
@@ -2855,9 +2738,7 @@ build_frame_matrix_from_leaf_window (frame_matrix, w)
    for instance, vertical separators, truncation markers, etc.  */
 
 void
-spec_glyph_lookup_face (w, glyph)
-     struct window *w;
-     GLYPH *glyph;
+spec_glyph_lookup_face (struct window *w, GLYPH *glyph)
 {
   int lface_id = GLYPH_FACE (*glyph);
   /* Convert the glyph's specified face to a realized (cache) face.  */
@@ -2886,8 +2767,7 @@ spec_glyph_lookup_face (w, glyph)
    To be called for frame-based redisplay, only.  */
 
 static void
-fill_up_glyph_row_with_spaces (row)
-     struct glyph_row *row;
+fill_up_glyph_row_with_spaces (struct glyph_row *row)
 {
   fill_up_glyph_row_area_with_spaces (row, LEFT_MARGIN_AREA);
   fill_up_glyph_row_area_with_spaces (row, TEXT_AREA);
@@ -2899,9 +2779,7 @@ fill_up_glyph_row_with_spaces (row)
    frame-based redisplay only.  */
 
 static void
-fill_up_glyph_row_area_with_spaces (row, area)
-     struct glyph_row *row;
-     int area;
+fill_up_glyph_row_area_with_spaces (struct glyph_row *row, int area)
 {
   if (row->glyphs[area] < row->glyphs[area + 1])
     {
@@ -2919,9 +2797,7 @@ fill_up_glyph_row_area_with_spaces (row, area)
    reached.  In frame matrices only one area, TEXT_AREA, is used.  */
 
 static void
-fill_up_frame_row_with_spaces (row, upto)
-     struct glyph_row *row;
-     int upto;
+fill_up_frame_row_with_spaces (struct glyph_row *row, int upto)
 {
   int i = row->used[TEXT_AREA];
   struct glyph *glyph = row->glyphs[TEXT_AREA];
@@ -2943,8 +2819,7 @@ fill_up_frame_row_with_spaces (row, upto)
    working on frame matrices or not.  */
 
 static INLINE void
-set_frame_matrix_frame (f)
-     struct frame *f;
+set_frame_matrix_frame (struct frame *f)
 {
   frame_matrix_frame = f;
 }
@@ -2959,9 +2834,7 @@ set_frame_matrix_frame (f)
    operations in window matrices of frame_matrix_frame.  */
 
 static INLINE void
-make_current (desired_matrix, current_matrix, row)
-     struct glyph_matrix *desired_matrix, *current_matrix;
-     int row;
+make_current (struct glyph_matrix *desired_matrix, struct glyph_matrix *current_matrix, int row)
 {
   struct glyph_row *current_row = MATRIX_ROW (current_matrix, row);
   struct glyph_row *desired_row = MATRIX_ROW (desired_matrix, row);
@@ -2988,9 +2861,7 @@ make_current (desired_matrix, current_matrix, row)
    matrices of leaf windows in the window tree rooted at W.  */
 
 static void
-mirror_make_current (w, frame_row)
-     struct window *w;
-     int frame_row;
+mirror_make_current (struct window *w, int frame_row)
 {
   while (w)
     {
@@ -3038,12 +2909,8 @@ mirror_make_current (w, frame_row)
    This function is called from do_scrolling and do_direct_scrolling.  */
 
 void
-mirrored_line_dance (matrix, unchanged_at_top, nlines, copy_from,
-                    retained_p)
-     struct glyph_matrix *matrix;
-     int unchanged_at_top, nlines;
-     int *copy_from;
-     char *retained_p;
+mirrored_line_dance (struct glyph_matrix *matrix, int unchanged_at_top, int nlines,
+                    int *copy_from, char *retained_p)
 {
   /* A copy of original rows.  */
   struct glyph_row *old_rows;
@@ -3055,7 +2922,7 @@ mirrored_line_dance (matrix, unchanged_at_top, nlines, copy_from,
 
   /* Make a copy of the original rows.  */
   old_rows = (struct glyph_row *) alloca (nlines * sizeof *old_rows);
-  bcopy (new_rows, old_rows, nlines * sizeof *old_rows);
+  memcpy (old_rows, new_rows, nlines * sizeof *old_rows);
 
   /* Assign new rows, maybe clear lines.  */
   for (i = 0; i < nlines; ++i)
@@ -3083,8 +2950,7 @@ mirrored_line_dance (matrix, unchanged_at_top, nlines, copy_from,
    the current frame matrix.  */
 
 static void
-sync_window_with_frame_matrix_rows (w)
-     struct window *w;
+sync_window_with_frame_matrix_rows (struct window *w)
 {
   struct frame *f = XFRAME (w->frame);
   struct glyph_row *window_row, *window_row_end, *frame_row;
@@ -3121,9 +2987,7 @@ sync_window_with_frame_matrix_rows (w)
    row ROW.  Value is null if none is found.  */
 
 struct window *
-frame_row_to_window (w, row)
-     struct window *w;
-     int row;
+frame_row_to_window (struct window *w, int row)
 {
   struct window *found = NULL;
 
@@ -3156,11 +3020,7 @@ frame_row_to_window (w, row)
    which is empty.  */
 
 static void
-mirror_line_dance (w, unchanged_at_top, nlines, copy_from, retained_p)
-     struct window *w;
-     int unchanged_at_top, nlines;
-     int *copy_from;
-     char *retained_p;
+mirror_line_dance (struct window *w, int unchanged_at_top, int nlines, int *copy_from, char *retained_p)
 {
   while (w)
     {
@@ -3180,7 +3040,7 @@ mirror_line_dance (w, unchanged_at_top, nlines, copy_from, retained_p)
 
          /* Make a copy of the original rows of matrix m.  */
          old_rows = (struct glyph_row *) alloca (m->nrows * sizeof *old_rows);
-         bcopy (m->rows, old_rows, m->nrows * sizeof *old_rows);
+         memcpy (old_rows, m->rows, m->nrows * sizeof *old_rows);
 
          for (i = 0; i < nlines; ++i)
            {
@@ -3374,8 +3234,7 @@ window_to_frame_hpos (w, hpos)
 
 DEFUN ("redraw-frame", Fredraw_frame, Sredraw_frame, 1, 1, 0,
        doc: /* Clear frame FRAME and output again what is supposed to appear on it.  */)
-     (frame)
-     Lisp_Object frame;
+  (Lisp_Object frame)
 {
   struct frame *f;
 
@@ -3412,8 +3271,7 @@ DEFUN ("redraw-frame", Fredraw_frame, Sredraw_frame, 1, 1, 0,
    function redraw-frame.  */
 
 void
-redraw_frame (f)
-     struct frame *f;
+redraw_frame (struct frame *f)
 {
   Lisp_Object frame;
   XSETFRAME (frame, f);
@@ -3423,7 +3281,7 @@ redraw_frame (f)
 
 DEFUN ("redraw-display", Fredraw_display, Sredraw_display, 0, 0, "",
        doc: /* Clear and redisplay all visible frames.  */)
-     ()
+  (void)
 {
   Lisp_Object tail, frame;
 
@@ -3439,7 +3297,7 @@ DEFUN ("redraw-display", Fredraw_display, Sredraw_display, 0, 0, "",
    visible frames marked as garbaged.  */
 
 void
-redraw_garbaged_frames ()
+redraw_garbaged_frames (void)
 {
   Lisp_Object tail, frame;
 
@@ -3450,395 +3308,6 @@ redraw_garbaged_frames ()
 }
 
 
-\f
-/***********************************************************************
-                         Direct Operations
- ***********************************************************************/
-
-/* Try to update display and current glyph matrix directly.
-
-   This function is called after a character G has been inserted into
-   current_buffer.  It tries to update the current glyph matrix and
-   perform appropriate screen output to reflect the insertion.  If it
-   succeeds, the global flag redisplay_performed_directly_p will be
-   set to 1, and thereby prevent the more costly general redisplay
-   from running (see redisplay_internal).
-
-   This function is not called for `hairy' character insertions.
-   In particular, it is not called when after or before change
-   functions exist, like they are used by font-lock.  See keyboard.c
-   for details where this function is called.  */
-
-int
-direct_output_for_insert (g)
-     int g;
-{
-  register struct frame *f = SELECTED_FRAME ();
-  struct window *w = XWINDOW (selected_window);
-  struct it it, it2;
-  struct glyph_row *glyph_row;
-  struct glyph *glyphs, *glyph, *end;
-  int n;
-  /* Non-null means that redisplay of W is based on window matrices.  */
-  int window_redisplay_p = FRAME_WINDOW_P (f);
-  /* Non-null means we are in overwrite mode.  */
-  int overwrite_p = !NILP (current_buffer->overwrite_mode);
-  int added_width;
-  struct text_pos pos;
-  int delta, delta_bytes;
-
-  /* Not done directly.  */
-  redisplay_performed_directly_p = 0;
-
-  /* Quickly give up for some common cases.  */
-  if (cursor_in_echo_area
-      /* Give up if fonts have changed.  */
-      || fonts_changed_p
-      /* Give up if face attributes have been changed.  */
-      || face_change_count
-      /* Give up if cursor position not really known.  */
-      || !display_completed
-      /* Give up if buffer appears in two places.  */
-      || buffer_shared > 1
-      /* Give up if currently displaying a message instead of the
-        minibuffer contents.  */
-      || (EQ (selected_window, minibuf_window)
-         && EQ (minibuf_window, echo_area_window))
-      /* Give up for hscrolled mini-buffer because display of the prompt
-        is handled specially there (see display_line).  */
-      || (MINI_WINDOW_P (w) && XFASTINT (w->hscroll))
-      /* Give up if overwriting in the middle of a line.  */
-      || (overwrite_p
-         && PT != ZV
-         && FETCH_BYTE (PT) != '\n')
-      /* Give up for tabs and line ends.  */
-      || g == '\t'
-      || g == '\n'
-      || g == '\r'
-      || (g == ' ' && !NILP (current_buffer->word_wrap))
-      /* Give up if unable to display the cursor in the window.  */
-      || w->cursor.vpos < 0
-      /* Give up if we are showing a message or just cleared the message
-        because we might need to resize the echo area window.  */
-      || !NILP (echo_area_buffer[0])
-      || !NILP (echo_area_buffer[1])
-      || (glyph_row = MATRIX_ROW (w->current_matrix, w->cursor.vpos),
-         /* Can't do it in a continued line because continuation
-            lines would change.  */
-         (glyph_row->continued_p
-          || glyph_row->exact_window_width_line_p
-          /* Can't use this method if the line overlaps others or is
-             overlapped by others because these other lines would
-             have to be redisplayed.  */
-          || glyph_row->overlapping_p
-          || glyph_row->overlapped_p))
-      /* Can't do it for partial width windows on terminal frames
-        because we can't clear to eol in such a window.  */
-      || (!window_redisplay_p && !WINDOW_FULL_WIDTH_P (w)))
-    return 0;
-
-  /* If we can't insert glyphs, we can use this method only
-     at the end of a line.  */
-  if (!FRAME_CHAR_INS_DEL_OK (f))
-    if (PT != ZV && FETCH_BYTE (PT_BYTE) != '\n')
-      return 0;
-
-  /* Set up a display iterator structure for W.  Glyphs will be
-     produced in scratch_glyph_row.  Current position is W's cursor
-     position.  */
-  clear_glyph_row (&scratch_glyph_row);
-  SET_TEXT_POS (pos, PT, PT_BYTE);
-  DEC_TEXT_POS (pos, !NILP (current_buffer->enable_multibyte_characters));
-  init_iterator (&it, w, CHARPOS (pos), BYTEPOS (pos), &scratch_glyph_row,
-                DEFAULT_FACE_ID);
-
-  glyph_row = MATRIX_ROW (w->current_matrix, w->cursor.vpos);
-  if (glyph_row->mouse_face_p)
-    return 0;
-
-  /* Give up if highlighting trailing whitespace and we have trailing
-     whitespace in glyph_row.  We would have to remove the trailing
-     whitespace face in that case.  */
-  if (!NILP (Vshow_trailing_whitespace)
-      && glyph_row->used[TEXT_AREA])
-    {
-      struct glyph *last;
-
-      last = glyph_row->glyphs[TEXT_AREA] + glyph_row->used[TEXT_AREA] - 1;
-      if (last->type == STRETCH_GLYPH
-         || (last->type == CHAR_GLYPH
-             && last->u.ch == ' '))
-       return 0;
-    }
-
-  /* Give up if there are overlay strings at pos.  This would fail
-     if the overlay string has newlines in it.  */
-  if (STRINGP (it.string))
-    return 0;
-
-  it.hpos = w->cursor.hpos;
-  it.vpos = w->cursor.vpos;
-  it.current_x = w->cursor.x + it.first_visible_x;
-  it.current_y = w->cursor.y;
-  it.end_charpos = PT;
-  it.stop_charpos = min (PT, it.stop_charpos);
-  it.stop_charpos = max (IT_CHARPOS (it), it.stop_charpos);
-
-  /* More than one display element may be returned for PT - 1 if
-     (i) it's a control character which is translated into `\003' or
-     `^C', or (ii) it has a display table entry, or (iii) it's a
-     combination of both.  */
-  delta = delta_bytes = 0;
-  while (get_next_display_element (&it))
-    {
-      PRODUCE_GLYPHS (&it);
-
-      /* Give up if glyph doesn't fit completely on the line.  */
-      if (it.current_x >= it.last_visible_x)
-       return 0;
-
-      /* Give up if new glyph has different ascent or descent than
-        the original row, or if it is not a character glyph.  */
-      if (glyph_row->ascent != it.ascent
-         || glyph_row->height != it.ascent + it.descent
-         || glyph_row->phys_ascent != it.phys_ascent
-         || glyph_row->phys_height != it.phys_ascent + it.phys_descent
-         || it.what != IT_CHARACTER)
-       return 0;
-
-      delta += 1;
-      delta_bytes += it.len;
-      set_iterator_to_next (&it, 1);
-    }
-
-  /* Give up if we hit the right edge of the window.  We would have
-     to insert truncation or continuation glyphs.  */
-  added_width = it.current_x - (w->cursor.x + it.first_visible_x);
-  if (glyph_row->pixel_width + added_width >= it.last_visible_x)
-    return 0;
-
-  /* Give up if there is a \t following in the line.  */
-  it2 = it;
-  it2.end_charpos = ZV;
-  it2.stop_charpos = min (it2.stop_charpos, ZV);
-  while (get_next_display_element (&it2)
-        && !ITERATOR_AT_END_OF_LINE_P (&it2))
-    {
-      if (it2.c == '\t')
-       return 0;
-      set_iterator_to_next (&it2, 1);
-    }
-
-  /* Number of new glyphs produced.  */
-  n = it.glyph_row->used[TEXT_AREA];
-
-  /* Start and end of glyphs in original row.  */
-  glyphs = glyph_row->glyphs[TEXT_AREA] + w->cursor.hpos;
-  end = glyph_row->glyphs[1 + TEXT_AREA];
-
-  /* Make room for new glyphs, then insert them.  */
-  xassert (end - glyphs - n >= 0);
-  safe_bcopy ((char *) glyphs, (char *) (glyphs + n),
-             (end - glyphs - n) * sizeof (*end));
-  bcopy (it.glyph_row->glyphs[TEXT_AREA], glyphs, n * sizeof *glyphs);
-  glyph_row->used[TEXT_AREA] = min (glyph_row->used[TEXT_AREA] + n,
-                                   end - glyph_row->glyphs[TEXT_AREA]);
-
-  /* Compute new line width.  */
-  glyph = glyph_row->glyphs[TEXT_AREA];
-  end = glyph + glyph_row->used[TEXT_AREA];
-  glyph_row->pixel_width = glyph_row->x;
-  while (glyph < end)
-    {
-      glyph_row->pixel_width += glyph->pixel_width;
-      ++glyph;
-    }
-
-  /* Increment buffer positions for glyphs following the newly
-     inserted ones.  */
-  for (glyph = glyphs + n; glyph < end; ++glyph)
-    if (glyph->charpos > 0 && BUFFERP (glyph->object))
-      glyph->charpos += delta;
-
-  if (MATRIX_ROW_END_CHARPOS (glyph_row) > 0)
-    {
-      MATRIX_ROW_END_CHARPOS (glyph_row) += delta;
-      MATRIX_ROW_END_BYTEPOS (glyph_row) += delta_bytes;
-    }
-
-  /* Adjust positions in lines following the one we are in.  */
-  increment_matrix_positions (w->current_matrix,
-                             w->cursor.vpos + 1,
-                             w->current_matrix->nrows,
-                             delta, delta_bytes);
-
-  glyph_row->contains_overlapping_glyphs_p
-    |= it.glyph_row->contains_overlapping_glyphs_p;
-
-  glyph_row->displays_text_p = 1;
-  w->window_end_vpos = make_number (max (w->cursor.vpos,
-                                        XFASTINT (w->window_end_vpos)));
-
-  if (!NILP (Vshow_trailing_whitespace))
-    highlight_trailing_whitespace (it.f, glyph_row);
-
-  /* Write glyphs.  If at end of row, we can simply call write_glyphs.
-     In the middle, we have to insert glyphs.  Note that this is now
-     implemented for X frames.  The implementation uses updated_window
-     and updated_row.  */
-  updated_row = glyph_row;
-  updated_area = TEXT_AREA;
-  update_begin (f);
-  if (FRAME_RIF (f))
-    {
-      FRAME_RIF (f)->update_window_begin_hook (w);
-
-      if (glyphs == end - n
-         /* In front of a space added by append_space.  */
-         || (glyphs == end - n - 1
-             && (end - n)->charpos <= 0))
-       FRAME_RIF (f)->write_glyphs (glyphs, n);
-      else
-       FRAME_RIF (f)->insert_glyphs (glyphs, n);
-    }
-  else
-    {
-      if (glyphs == end - n)
-       write_glyphs (f, glyphs, n);
-      else
-       insert_glyphs (f, glyphs, n);
-    }
-
-  w->cursor.hpos += n;
-  w->cursor.x = it.current_x - it.first_visible_x;
-  xassert (w->cursor.hpos >= 0
-          && w->cursor.hpos < w->desired_matrix->matrix_w);
-
-  /* How to set the cursor differs depending on whether we are
-     using a frame matrix or a window matrix.   Note that when
-     a frame matrix is used, cursor_to expects frame coordinates,
-     and the X and Y parameters are not used.  */
-  if (window_redisplay_p)
-    FRAME_RIF (f)->cursor_to (w->cursor.vpos, w->cursor.hpos,
-                              w->cursor.y, w->cursor.x);
-  else
-    {
-      int x, y;
-      x = (WINDOW_TO_FRAME_HPOS (w, w->cursor.hpos)
-          + (INTEGERP (w->left_margin_cols)
-             ? XFASTINT (w->left_margin_cols)
-             : 0));
-      y = WINDOW_TO_FRAME_VPOS (w, w->cursor.vpos);
-      cursor_to (f, y, x);
-    }
-
-#ifdef HAVE_WINDOW_SYSTEM
-  update_window_fringes (w, 0);
-#endif
-
-  if (FRAME_RIF (f))
-    FRAME_RIF (f)->update_window_end_hook (w, 1, 0);
-  update_end (f);
-  updated_row = NULL;
-  if (FRAME_TERMCAP_P (f))
-    fflush (FRAME_TTY (f)->output);
-
-  TRACE ((stderr, "direct output for insert\n"));
-  mark_window_display_accurate (it.window, 1);
-  redisplay_performed_directly_p = 1;
-  return 1;
-}
-
-
-/* Perform a direct display update for moving PT by N positions
-   left or right.  N < 0 means a movement backwards.  This function
-   is currently only called for N == 1 or N == -1.  */
-
-int
-direct_output_forward_char (n)
-     int n;
-{
-  struct frame *f = SELECTED_FRAME ();
-  struct window *w = XWINDOW (selected_window);
-  struct glyph_row *row;
-
-  /* Give up if point moved out of or into a composition.  */
-  if (check_point_in_composition (current_buffer, XINT (w->last_point),
-                                 current_buffer, PT))
-    return 0;
-
-  /* Give up if face attributes have been changed.  */
-  if (face_change_count)
-    return 0;
-
-  /* Give up if current matrix is not up to date or we are
-     displaying a message.  */
-  if (!display_completed || cursor_in_echo_area)
-    return 0;
-
-  /* Give up if the buffer's direction is reversed.  */
-  if (!NILP (XBUFFER (w->buffer)->direction_reversed))
-    return 0;
-
-  /* Can't use direct output if highlighting a region.  */
-  if (!NILP (Vtransient_mark_mode) && !NILP (current_buffer->mark_active))
-    return 0;
-
-  /* Can't use direct output if highlighting trailing whitespace.  */
-  if (!NILP (Vshow_trailing_whitespace))
-    return 0;
-
-  /* Give up if we are showing a message or just cleared the message
-     because we might need to resize the echo area window.  */
-  if (!NILP (echo_area_buffer[0]) || !NILP (echo_area_buffer[1]))
-    return 0;
-
-  /* Give up if currently displaying a message instead of the
-     minibuffer contents.  */
-  if (XWINDOW (minibuf_window) == w
-      && EQ (minibuf_window, echo_area_window))
-    return 0;
-
-  /* Give up if we don't know where the cursor is.  */
-  if (w->cursor.vpos < 0)
-    return 0;
-
-  row = MATRIX_ROW (w->current_matrix, w->cursor.vpos);
-
-  /* Give up if PT is outside of the last known cursor row.  */
-  if (PT <= MATRIX_ROW_START_CHARPOS (row)
-      || PT >= MATRIX_ROW_END_CHARPOS (row))
-    return 0;
-
-  set_cursor_from_row (w, row, w->current_matrix, 0, 0, 0, 0);
-
-  w->last_cursor = w->cursor;
-  XSETFASTINT (w->last_point, PT);
-
-  xassert (w->cursor.hpos >= 0
-          && w->cursor.hpos < w->desired_matrix->matrix_w);
-
-  if (FRAME_WINDOW_P (f))
-    FRAME_RIF (f)->cursor_to (w->cursor.vpos, w->cursor.hpos,
-                              w->cursor.y, w->cursor.x);
-  else
-    {
-      int x, y;
-      x = (WINDOW_TO_FRAME_HPOS (w, w->cursor.hpos)
-          + (INTEGERP (w->left_margin_cols)
-             ? XFASTINT (w->left_margin_cols)
-             : 0));
-      y = WINDOW_TO_FRAME_VPOS (w, w->cursor.vpos);
-      cursor_to (f, y, x);
-    }
-
-  if (FRAME_TERMCAP_P (f))
-    fflush (FRAME_TTY (f)->output);
-  redisplay_performed_directly_p = 1;
-  return 1;
-}
-
-
 \f
 /***********************************************************************
                             Frame Update
@@ -3853,10 +3322,7 @@ direct_output_forward_char (n)
    Value is non-zero if redisplay was stopped due to pending input.  */
 
 int
-update_frame (f, force_p, inhibit_hairy_id_p)
-     struct frame *f;
-     int force_p;
-     int inhibit_hairy_id_p;
+update_frame (struct frame *f, int force_p, int inhibit_hairy_id_p)
 {
   /* 1 means display has been paused because of pending input.  */
   int paused_p;
@@ -3988,9 +3454,7 @@ update_frame (f, force_p, inhibit_hairy_id_p)
    don't stop updating when input is pending.  */
 
 static int
-update_window_tree (w, force_p)
-     struct window *w;
-     int force_p;
+update_window_tree (struct window *w, int force_p)
 {
   int paused_p = 0;
 
@@ -4014,9 +3478,7 @@ update_window_tree (w, force_p)
    FORCE_P is non-zero, don't stop updating if input is pending.  */
 
 void
-update_single_window (w, force_p)
-     struct window *w;
-     int force_p;
+update_single_window (struct window *w, int force_p)
 {
   if (w->must_be_updated_p)
     {
@@ -4061,9 +3523,7 @@ update_single_window (w, force_p)
    overlapped by other rows.  YB is bottom-most y-position in W.  */
 
 static void
-redraw_overlapped_rows (w, yb)
-     struct window *w;
-     int yb;
+redraw_overlapped_rows (struct window *w, int yb)
 {
   int i;
   struct frame *f = XFRAME (WINDOW_FRAME (w));
@@ -4111,9 +3571,7 @@ redraw_overlapped_rows (w, yb)
    others.  YB is bottom-most y-position in W.  */
 
 static void
-redraw_overlapping_rows (w, yb)
-     struct window *w;
-     int yb;
+redraw_overlapping_rows (struct window *w, int yb)
 {
   int i, bottom_y;
   struct glyph_row *row;
@@ -4175,8 +3633,7 @@ redraw_overlapping_rows (w, yb)
    which is below what's displayed in the window.  */
 
 void
-check_current_matrix_flags (w)
-     struct window *w;
+check_current_matrix_flags (struct window *w)
 {
   int last_seen_p = 0;
   int i, yb = window_text_bottom_y (w);
@@ -4198,17 +3655,13 @@ check_current_matrix_flags (w)
    not stop when detecting pending input.  */
 
 static int
-update_window (w, force_p)
-     struct window *w;
-     int force_p;
+update_window (struct window *w, int force_p)
 {
   struct glyph_matrix *desired_matrix = w->desired_matrix;
   int paused_p;
 #if !PERIODIC_PREEMPTION_CHECKING
   int preempt_count = baud_rate / 2400 + 1;
 #endif
-  extern int input_pending;
-  extern Lisp_Object do_mouse_tracking;
   struct redisplay_interface *rif = FRAME_RIF (XFRAME (WINDOW_FRAME (w)));
 #if GLYPH_DEBUG
   /* Check that W's frame doesn't have glyph matrices.  */
@@ -4392,9 +3845,7 @@ update_window (w, force_p)
    AREA can be either LEFT_MARGIN_AREA or RIGHT_MARGIN_AREA.  */
 
 static void
-update_marginal_area (w, area, vpos)
-     struct window *w;
-     int area, vpos;
+update_marginal_area (struct window *w, int area, int vpos)
 {
   struct glyph_row *desired_row = MATRIX_ROW (w->desired_matrix, vpos);
   struct redisplay_interface *rif = FRAME_RIF (XFRAME (WINDOW_FRAME (w)));
@@ -4417,9 +3868,7 @@ update_marginal_area (w, area, vpos)
    Value is non-zero if display has changed.  */
 
 static int
-update_text_area (w, vpos)
-     struct window *w;
-     int vpos;
+update_text_area (struct window *w, int vpos)
 {
   struct glyph_row *current_row = MATRIX_ROW (w->current_matrix, vpos);
   struct glyph_row *desired_row = MATRIX_ROW (w->desired_matrix, vpos);
@@ -4642,7 +4091,9 @@ update_text_area (w, vpos)
             doesn't work with lbearing/rbearing), so we must do it
             this way.  */
          if (vpos == w->phys_cursor.vpos
-             && w->phys_cursor.hpos >= desired_row->used[TEXT_AREA])
+             && (desired_row->reversed_p
+                 ? (w->phys_cursor.hpos < 0)
+                 : (w->phys_cursor.hpos >= desired_row->used[TEXT_AREA])))
            {
              w->phys_cursor_on_p = 0;
              x = -1;
@@ -4662,9 +4113,7 @@ update_text_area (w, vpos)
    changed.  */
 
 static int
-update_window_line (w, vpos, mouse_face_overwritten_p)
-     struct window *w;
-     int vpos, *mouse_face_overwritten_p;
+update_window_line (struct window *w, int vpos, int *mouse_face_overwritten_p)
 {
   struct glyph_row *current_row = MATRIX_ROW (w->current_matrix, vpos);
   struct glyph_row *desired_row = MATRIX_ROW (w->desired_matrix, vpos);
@@ -4733,8 +4182,7 @@ update_window_line (w, vpos, mouse_face_overwritten_p)
    be called from update_window.  */
 
 static void
-set_window_cursor_after_update (w)
-     struct window *w;
+set_window_cursor_after_update (struct window *w)
 {
   struct frame *f = XFRAME (w->frame);
   struct redisplay_interface *rif = FRAME_RIF (f);
@@ -4806,7 +4254,7 @@ set_window_cursor_after_update (w)
     }
 
   /* Window cursor can be out of sync for horizontally split windows.  */
-  hpos = max (0, hpos);
+  hpos = max (-1, hpos); /* -1 is for when cursor is on the left fringe */
   hpos = min (w->current_matrix->matrix_w - 1, hpos);
   vpos = max (0, vpos);
   vpos = min (w->current_matrix->nrows - 1, vpos);
@@ -4818,9 +4266,7 @@ set_window_cursor_after_update (w)
    tree rooted at W.  */
 
 void
-set_window_update_flags (w, on_p)
-     struct window *w;
-     int on_p;
+set_window_update_flags (struct window *w, int on_p)
 {
   while (w)
     {
@@ -4898,9 +4344,7 @@ static struct run **runs;
    of window W.  */
 
 static INLINE struct row_entry *
-add_row_entry (w, row)
-     struct window *w;
-     struct glyph_row *row;
+add_row_entry (struct window *w, struct glyph_row *row)
 {
   struct row_entry *entry;
   int i = row->hash % row_table_size;
@@ -4951,9 +4395,7 @@ add_row_entry (w, row)
    1   if we did scroll.  */
 
 static int
-scrolling_window (w, header_line_p)
-     struct window *w;
-     int header_line_p;
+scrolling_window (struct window *w, int header_line_p)
 {
   struct glyph_matrix *desired_matrix = w->desired_matrix;
   struct glyph_matrix *current_matrix = w->current_matrix;
@@ -5061,7 +4503,7 @@ scrolling_window (w, header_line_p)
       row_table_size = next_almost_prime (3 * n);
       nbytes = row_table_size * sizeof *row_table;
       row_table = (struct row_entry **) xrealloc (row_table, nbytes);
-      bzero (row_table, nbytes);
+      memset (row_table, 0, nbytes);
     }
 
   if (n > row_entry_pool_size)
@@ -5256,10 +4698,7 @@ scrolling_window (w, header_line_p)
    Value is non-zero if update was stopped due to pending input.  */
 
 static int
-update_frame_1 (f, force_p, inhibit_id_p)
-     struct frame *f;
-     int force_p;
-     int inhibit_id_p;
+update_frame_1 (struct frame *f, int force_p, int inhibit_id_p)
 {
   /* Frame matrices to work on.  */
   struct glyph_matrix *current_matrix = f->current_matrix;
@@ -5267,7 +4706,6 @@ update_frame_1 (f, force_p, inhibit_id_p)
   int i;
   int pause;
   int preempt_count = baud_rate / 2400 + 1;
-  extern int input_pending;
 
   xassert (current_matrix && desired_matrix);
 
@@ -5469,8 +4907,7 @@ update_frame_1 (f, force_p, inhibit_id_p)
 /* Do line insertions/deletions on frame F for frame-based redisplay.  */
 
 int
-scrolling (frame)
-     struct frame *frame;
+scrolling (struct frame *frame)
 {
   int unchanged_at_top, unchanged_at_bottom;
   int window_size;
@@ -5564,9 +5001,7 @@ scrolling (frame)
    which is LEN glyphs long.  */
 
 static int
-count_blanks (r, len)
-     struct glyph *r;
-     int len;
+count_blanks (struct glyph *r, int len)
 {
   int i;
 
@@ -5583,8 +5018,7 @@ count_blanks (r, len)
    of STR2.  Value is the number of equal glyphs equal at the start.  */
 
 static int
-count_match (str1, end1, str2, end2)
-     struct glyph *str1, *end1, *str2, *end2;
+count_match (struct glyph *str1, struct glyph *end1, struct glyph *str2, struct glyph *end2)
 {
   struct glyph *p1 = str1;
   struct glyph *p2 = str2;
@@ -5600,16 +5034,13 @@ count_match (str1, end1, str2, end2)
 
 /* Char insertion/deletion cost vector, from term.c */
 
-extern int *char_ins_del_vector;
 #define char_ins_del_cost(f) (&char_ins_del_vector[FRAME_TOTAL_COLS((f))])
 
 
 /* Perform a frame-based update on line VPOS in frame FRAME.  */
 
 static void
-update_frame_line (f, vpos)
-     struct frame *f;
-     int vpos;
+update_frame_line (struct frame *f, int vpos)
 {
   struct glyph *obody, *nbody, *op1, *op2, *np1, *nend;
   int tem;
@@ -5920,18 +5351,18 @@ update_frame_line (f, vpos)
  ***********************************************************************/
 
 /* Determine what's under window-relative pixel position (*X, *Y).
-   Return the object (string or buffer) that's there.
+   Return the OBJECT (string or buffer) that's there.
    Return in *POS the position in that object.
-   Adjust *X and *Y to character positions.  */
+   Adjust *X and *Y to character positions.
+   Return in *DX and *DY the pixel coordinates of the click,
+   relative to the top left corner of OBJECT, or relative to
+   the top left corner of the character glyph at (*X, *Y)
+   if OBJECT is nil.
+   Return WIDTH and HEIGHT of the object at (*X, *Y), or zero
+   if the coordinates point to an empty area of the display.  */
 
 Lisp_Object
-buffer_posn_from_coords (w, x, y, pos, object, dx, dy, width, height)
-     struct window *w;
-     int *x, *y;
-     struct display_pos *pos;
-     Lisp_Object *object;
-     int *dx, *dy;
-     int *width, *height;
+buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *pos, Lisp_Object *object, int *dx, int *dy, int *width, int *height)
 {
   struct it it;
   Lisp_Object old_current_buffer = Fcurrent_buffer ();
@@ -5941,7 +5372,7 @@ buffer_posn_from_coords (w, x, y, pos, object, dx, dy, width, height)
 #ifdef HAVE_WINDOW_SYSTEM
   struct image *img = 0;
 #endif
-  int x0, x1;
+  int x0, x1, to_x;
 
   /* We used to set current_buffer directly here, but that does the
      wrong thing with `face-remapping-alist' (bug#2044).  */
@@ -5952,8 +5383,33 @@ buffer_posn_from_coords (w, x, y, pos, object, dx, dy, width, height)
   start_display (&it, w, startp);
 
   x0 = *x - WINDOW_LEFT_MARGIN_WIDTH (w);
-  move_it_to (&it, -1, x0 + it.first_visible_x, *y, -1,
-             MOVE_TO_X | MOVE_TO_Y);
+
+  /* First, move to the beginning of the row corresponding to *Y.  We
+     need to be in that row to get the correct value of base paragraph
+     direction for the text at (*X, *Y).  */
+  move_it_to (&it, -1, 0, *y, -1, MOVE_TO_X | MOVE_TO_Y);
+
+  /* TO_X is the pixel position that the iterator will compute for the
+     glyph at *X.  We add it.first_visible_x because iterator
+     positions include the hscroll.  */
+  to_x = x0 + it.first_visible_x;
+  if (it.bidi_it.paragraph_dir == R2L)
+    /* For lines in an R2L paragraph, we need to mirror TO_X wrt the
+       text area.  This is because the iterator, even in R2L
+       paragraphs, delivers glyphs as if they started at the left
+       margin of the window.  (When we actually produce glyphs for
+       display, we reverse their order in PRODUCE_GLYPHS, but the
+       iterator doesn't know about that.)  The following line adjusts
+       the pixel position to the iterator geometry, which is what
+       move_it_* routines use.  (The -1 is because in a window whose
+       text-area width is W, the rightmost pixel position is W-1, and
+       it should be mirrored into zero pixel position.)  */
+    to_x = window_box_width (w, TEXT_AREA) - to_x - 1;
+
+  /* Now move horizontally in the row to the glyph under *X.  Second
+     argument is ZV to prevent move_it_in_display_line from matching
+     based on buffer positions.  */
+  move_it_in_display_line (&it, ZV, to_x, MOVE_TO_X);
 
   Fset_buffer (old_current_buffer);
 
@@ -6026,14 +5482,7 @@ buffer_posn_from_coords (w, x, y, pos, object, dx, dy, width, height)
    *CHARPOS is set to the position in the string returned.  */
 
 Lisp_Object
-mode_line_string (w, part, x, y, charpos, object, dx, dy, width, height)
-     struct window *w;
-     enum window_part part;
-     int *x, *y;
-     int *charpos;
-     Lisp_Object *object;
-     int *dx, *dy;
-     int *width, *height;
+mode_line_string (struct window *w, enum window_part part, int *x, int *y, int *charpos, Lisp_Object *object, int *dx, int *dy, int *width, int *height)
 {
   struct glyph_row *row;
   struct glyph *glyph, *end;
@@ -6100,14 +5549,7 @@ mode_line_string (w, part, x, y, charpos, object, dx, dy, width, height)
    the string returned.  */
 
 Lisp_Object
-marginal_area_string (w, part, x, y, charpos, object, dx, dy, width, height)
-     struct window *w;
-     enum window_part part;
-     int *x, *y;
-     int *charpos;
-     Lisp_Object *object;
-     int *dx, *dy;
-     int *width, *height;
+marginal_area_string (struct window *w, enum window_part part, int *x, int *y, int *charpos, Lisp_Object *object, int *dx, int *dy, int *width, int *height)
 {
   struct glyph_row *row = w->current_matrix->rows;
   struct glyph *glyph, *end;
@@ -6196,13 +5638,10 @@ marginal_area_string (w, part, x, y, charpos, object, dx, dy, width, height)
 #ifdef SIGWINCH
 
 SIGTYPE
-window_change_signal (signalnum) /* If we don't have an argument, */
-     int signalnum;            /* some compilers complain in signal calls.  */
+window_change_signal (int signalnum) /* If we don't have an argument, */
+                               /* some compilers complain in signal calls.  */
 {
   int width, height;
-#ifndef USE_CRT_DLL
-  extern int errno;
-#endif
   int old_errno = errno;
 
   struct tty_display_info *tty;
@@ -6248,8 +5687,7 @@ window_change_signal (signalnum) /* If we don't have an argument, */
    safe to change frame sizes  while a redisplay is in progress.  */
 
 void
-do_pending_window_change (safe)
-     int safe;
+do_pending_window_change (int safe)
 {
   /* If window_change_signal should have run before, run it now.  */
   if (redisplaying_p && !safe)
@@ -6285,9 +5723,7 @@ do_pending_window_change (safe)
    safe to change frame sizes while a redisplay is in progress.  */
 
 void
-change_frame_size (f, newheight, newwidth, pretend, delay, safe)
-     register struct frame *f;
-     int newheight, newwidth, pretend, delay, safe;
+change_frame_size (register struct frame *f, int newheight, int newwidth, int pretend, int delay, int safe)
 {
   Lisp_Object tail, frame;
 
@@ -6306,9 +5742,7 @@ change_frame_size (f, newheight, newwidth, pretend, delay, safe)
 }
 
 static void
-change_frame_size_1 (f, newheight, newwidth, pretend, delay, safe)
-     register struct frame *f;
-     int newheight, newwidth, pretend, delay, safe;
+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 ();
@@ -6437,8 +5871,7 @@ DEFUN ("open-termscript", Fopen_termscript, Sopen_termscript,
        1, 1, "FOpen termscript file: ",
        doc: /* Start writing all terminal output to FILE as well as the terminal.
 FILE = nil means just close any termscript file currently open.  */)
-     (file)
-     Lisp_Object file;
+  (Lisp_Object file)
 {
   struct tty_display_info *tty;
 
@@ -6476,9 +5909,7 @@ Optional parameter TERMINAL specifies the tty terminal device to use.
 It may be a terminal object, a frame, or nil for the terminal used by
 the currently selected frame.  In batch mode, STRING is sent to stdout
 when TERMINAL is nil.  */)
-  (string, terminal)
-     Lisp_Object string;
-     Lisp_Object terminal;
+  (Lisp_Object string, Lisp_Object terminal)
 {
   struct terminal *t = get_terminal (terminal, 1);
   FILE *out;
@@ -6519,8 +5950,7 @@ DEFUN ("ding", Fding, Sding, 0, 1, 0,
        doc: /* Beep, or flash the screen.
 Also, unless an argument is given,
 terminate any keyboard macro currently executing.  */)
-     (arg)
-  Lisp_Object arg;
+  (Lisp_Object arg)
 {
   if (!NILP (arg))
     {
@@ -6536,7 +5966,7 @@ terminate any keyboard macro currently executing.  */)
 }
 
 void
-bitch_at_user ()
+bitch_at_user (void)
 {
   if (noninteractive)
     putchar (07);
@@ -6559,8 +5989,7 @@ 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.
 \(Not all operating systems support waiting for a fraction of a second.)  */)
-     (seconds, milliseconds)
-     Lisp_Object seconds, milliseconds;
+  (Lisp_Object seconds, Lisp_Object milliseconds)
 {
   int sec, usec;
 
@@ -6613,9 +6042,7 @@ Emacs was built without floating point support.
 */
 
 Lisp_Object
-sit_for (timeout, reading, do_display)
-     Lisp_Object timeout;
-     int reading, do_display;
+sit_for (Lisp_Object timeout, int reading, int do_display)
 {
   int sec, usec;
 
@@ -6666,8 +6093,7 @@ DEFUN ("redisplay", Fredisplay, Sredisplay, 0, 1, 0,
 If optional arg FORCE is non-nil or `redisplay-dont-pause' is non-nil,
 perform a full redisplay even if input is available.
 Return t if redisplay was performed, nil otherwise.  */)
-     (force)
-  Lisp_Object force;
+  (Lisp_Object force)
 {
   int count;
 
@@ -6711,8 +6137,7 @@ the current state.
 
 If VARIABLE is nil, an internal variable is used.  Users should not
 pass nil for VARIABLE.  */)
-     (variable)
-     Lisp_Object variable;
+  (Lisp_Object variable)
 {
   Lisp_Object state, tail, frame, buf;
   Lisp_Object *vecp, *end;
@@ -6831,14 +6256,10 @@ pass nil for VARIABLE.  */)
    decoding routine to set up variables in the terminal package.  */
 
 void
-init_display ()
+init_display (void)
 {
   char *terminal_type;
 
-#ifdef HAVE_X_WINDOWS
-  extern int display_arg;
-#endif
-
   /* Construct the space glyph.  */
   space_glyph.type = CHAR_GLYPH;
   SET_CHAR_GLYPH (space_glyph, ' ', DEFAULT_FACE_ID, 0);
@@ -7038,8 +6459,7 @@ DEFUN ("internal-show-cursor", Finternal_show_cursor,
 WINDOW nil means use the selected window.  SHOW non-nil means
 show a cursor in WINDOW in the next redisplay.  SHOW nil means
 don't show a cursor.  */)
-     (window, show)
-     Lisp_Object window, show;
+  (Lisp_Object window, Lisp_Object show)
 {
   /* Don't change cursor state while redisplaying.  This could confuse
      output routines.  */
@@ -7061,8 +6481,7 @@ DEFUN ("internal-show-cursor-p", Finternal_show_cursor_p,
        Sinternal_show_cursor_p, 0, 1, 0,
        doc: /* Value is non-nil if next redisplay will display a cursor in WINDOW.
 WINDOW nil or omitted means report on the selected window.  */)
-     (window)
-     Lisp_Object window;
+  (Lisp_Object window)
 {
   struct window *w;
 
@@ -7078,7 +6497,7 @@ WINDOW nil or omitted means report on the selected window.  */)
 DEFUN ("last-nonminibuffer-frame", Flast_nonminibuf_frame,
        Slast_nonminibuf_frame, 0, 0, 0,
        doc: /* Value is last nonminibuffer frame. */)
-     ()
+  (void)
 {
   Lisp_Object frame = Qnil;
 
@@ -7093,7 +6512,7 @@ DEFUN ("last-nonminibuffer-frame", Flast_nonminibuf_frame,
  ***********************************************************************/
 
 void
-syms_of_display ()
+syms_of_display (void)
 {
   defsubr (&Sredraw_frame);
   defsubr (&Sredraw_display);
index e0f603346df242e1c7968e7719646d9c7aa62838..1a7f63050b67f7b1f5ecd2fa267e82f3e9384ece 100644 (file)
@@ -32,7 +32,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #define DISP_INVIS_VECTOR(dp) ((dp)->extras[4])
 #define DISP_BORDER_GLYPH(dp) ((dp)->extras[5])
 
-extern Lisp_Object disp_char_vector P_ ((struct Lisp_Char_Table *, int));
+extern Lisp_Object disp_char_vector (struct Lisp_Char_Table *, int);
 
 #define DISP_CHAR_VECTOR(dp, c)                                \
   (ASCII_CHAR_P(c)                                     \
@@ -44,10 +44,10 @@ extern Lisp_Object disp_char_vector P_ ((struct Lisp_Char_Table *, int));
    : disp_char_vector ((dp), (c)))
 
 /* Defined in window.c.  */
-extern struct Lisp_Char_Table *window_display_table P_ ((struct window *));
+extern struct Lisp_Char_Table *window_display_table (struct window *);
 
 /* Defined in indent.c.  */
-extern struct Lisp_Char_Table *buffer_display_table P_ ((void));
+extern struct Lisp_Char_Table *buffer_display_table (void);
 
 /* Display table to use for vectors that don't specify their own.  */
 extern Lisp_Object Vstandard_display_table;
index d1cc6e48fcf4da0556e32d3f8a0eb37c6aa5b106..f8ab9d081b90829a0590751a7194fd8e34d0f7a6 100644 (file)
--- a/src/doc.c
+++ b/src/doc.c
@@ -45,10 +45,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "keymap.h"
 #include "buildobj.h"
 
-#ifdef HAVE_INDEX
-extern char *index P_ ((const char *, int));
-#endif
-
 Lisp_Object Vdoc_file_name;
 
 Lisp_Object Qfunction_documentation;
@@ -56,23 +52,18 @@ Lisp_Object Qfunction_documentation;
 /* A list of files used to build this Emacs binary.  */
 static Lisp_Object Vbuild_files;
 
-extern Lisp_Object Voverriding_local_map;
-
-extern Lisp_Object Qremap;
-
 /* Buffer used for reading from documentation file.  */
 static char *get_doc_string_buffer;
 static int get_doc_string_buffer_size;
 
 static unsigned char *read_bytecode_pointer;
-Lisp_Object Fsnarf_documentation P_ ((Lisp_Object));
+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.  */
 
 int
-read_bytecode_char (unreadflag)
-     int unreadflag;
+read_bytecode_char (int unreadflag)
 {
   if (unreadflag)
     {
@@ -102,9 +93,7 @@ read_bytecode_char (unreadflag)
    and return a cons cell.  */
 
 Lisp_Object
-get_doc_string (filepos, unibyte, definition)
-     Lisp_Object filepos;
-     int unibyte, definition;
+get_doc_string (Lisp_Object filepos, int unibyte, int definition)
 {
   char *from, *to;
   register int fd;
@@ -221,9 +210,9 @@ get_doc_string (filepos, unibyte, definition)
       if (!nread)
        break;
       if (p == get_doc_string_buffer)
-       p1 = (char *) index (p + offset, '\037');
+       p1 = strchr (p + offset, '\037');
       else
-       p1 = (char *) index (p, '\037');
+       p1 = strchr (p, '\037');
       if (p1)
        {
          *p1 = 0;
@@ -296,8 +285,7 @@ get_doc_string (filepos, unibyte, definition)
                                to - (get_doc_string_buffer + offset));
   else
     {
-      /* Let the data determine whether the string is multibyte,
-        even if Emacs is running in --unibyte mode.  */
+      /* The data determines whether the string is multibyte.  */
       int nchars = multibyte_chars_in_text (get_doc_string_buffer + offset,
                                            to - (get_doc_string_buffer + offset));
       return make_string_from_bytes (get_doc_string_buffer + offset,
@@ -311,15 +299,13 @@ get_doc_string (filepos, unibyte, definition)
    of a compiled function from the .elc file.  */
 
 Lisp_Object
-read_doc_string (filepos)
-     Lisp_Object filepos;
+read_doc_string (Lisp_Object filepos)
 {
   return get_doc_string (filepos, 0, 1);
 }
 
 static int
-reread_doc_file (file)
-     Lisp_Object file;
+reread_doc_file (Lisp_Object file)
 {
 #if 0
   Lisp_Object reply, prompt[3];
@@ -346,8 +332,7 @@ DEFUN ("documentation", Fdocumentation, Sdocumentation, 1, 2, 0,
        doc: /* Return the documentation string of FUNCTION.
 Unless a non-nil second argument RAW is given, the
 string is passed through `substitute-command-keys'.  */)
-     (function, raw)
-     Lisp_Object function, raw;
+  (Lisp_Object function, Lisp_Object raw)
 {
   Lisp_Object fun;
   Lisp_Object funcar;
@@ -474,8 +459,7 @@ Third argument RAW omitted or nil means pass the result through
 This differs from `get' in that it can refer to strings stored in the
 `etc/DOC' file; and that it evaluates documentation properties that
 aren't strings.  */)
-  (symbol, prop, raw)
-     Lisp_Object symbol, prop, raw;
+  (Lisp_Object symbol, Lisp_Object prop, Lisp_Object raw)
 {
   int try_reload = 1;
   Lisp_Object tem;
@@ -515,10 +499,8 @@ aren't strings.  */)
 /* Scanning the DOC files and placing docstring offsets into functions.  */
 
 static void
-store_function_docstring (fun, offset)
-     Lisp_Object fun;
-     /* Use EMACS_INT because we get this from pointer subtraction.  */
-     EMACS_INT offset;
+store_function_docstring (Lisp_Object fun, EMACS_INT offset)
+/* Use EMACS_INT because we get offset from pointer subtraction.  */
 {
   fun = indirect_function (fun);
 
@@ -538,7 +520,7 @@ store_function_docstring (fun, offset)
        {
          tem = Fcdr (Fcdr (fun));
          if (CONSP (tem) && INTEGERP (XCAR (tem)))
-           XSETCARFASTINT (tem, offset);
+           XSETCAR (tem, make_number (offset));
        }
       else if (EQ (tem, Qmacro))
        store_function_docstring (XCDR (fun), offset);
@@ -565,8 +547,7 @@ The function takes one argument, FILENAME, a string;
 it specifies the file name (without a directory) of the DOC file.
 That file is found in `../etc' now; later, when the dumped Emacs is run,
 the same file name is found in the `doc-directory'.  */)
-     (filename)
-     Lisp_Object filename;
+  (Lisp_Object filename)
 {
   int fd;
   char buf[1024 + 1];
@@ -643,7 +624,7 @@ the same file name is found in the `doc-directory'.  */)
       /* p points to ^_Ffunctionname\n or ^_Vvarname\n or ^_Sfilename\n.  */
       if (p != end)
        {
-         end = (char *) index (p, '\n');
+         end = strchr (p, '\n');
 
           /* See if this is a file name, and if it is a file in build-files.  */
           if (p[1] == 'S')
@@ -697,7 +678,7 @@ the same file name is found in the `doc-directory'.  */)
        }
       pos += end - buf;
       filled -= end - buf;
-      bcopy (end, buf, filled);
+      memcpy (buf, end, filled);
     }
   emacs_close (fd);
   return Qnil;
@@ -718,8 +699,7 @@ thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[ int
 
 Returns original STRING if no substitutions were made.  Otherwise,
 a new string, without any text properties, is returned.  */)
-     (string)
-     Lisp_Object string;
+  (Lisp_Object string)
 {
   unsigned char *buf;
   int changed = 0;
@@ -776,7 +756,7 @@ a new string, without any text properties, is returned.  */)
              if (len == 1)
                *bufp = *strp;
              else
-               bcopy (strp, bufp, len);
+               memcpy (bufp, strp, len);
              strp += len;
              bufp += len;
              nchars++;
@@ -828,7 +808,7 @@ a new string, without any text properties, is returned.  */)
              int offset = bufp - buf;
              buf = (unsigned char *) xrealloc (buf, bsize += 4);
              bufp = buf + offset;
-             bcopy ("M-x ", bufp, 4);
+             memcpy (bufp, "M-x ", 4);
              bufp += 4;
              nchars += 4;
              if (multibyte)
@@ -922,7 +902,7 @@ a new string, without any text properties, is returned.  */)
            int offset = bufp - buf;
            buf = (unsigned char *) xrealloc (buf, bsize += length_byte);
            bufp = buf + offset;
-           bcopy (start, bufp, length_byte);
+           memcpy (bufp, start, length_byte);
            bufp += length_byte;
            nchars += length;
            /* Check STRING again in case gc relocated it.  */
@@ -939,7 +919,7 @@ a new string, without any text properties, is returned.  */)
          if (len == 1)
            *bufp = *strp;
          else
-           bcopy (strp, bufp, len);
+           memcpy (bufp, strp, len);
          strp += len;
          bufp += len;
          nchars++;
@@ -955,7 +935,7 @@ a new string, without any text properties, is returned.  */)
 }
 \f
 void
-syms_of_doc ()
+syms_of_doc (void)
 {
   Qfunction_documentation = intern_c_string ("function-documentation");
   staticpro (&Qfunction_documentation);
index cf8a928086320dd1526387e8e5a11c8c572bcb99..1b45b21e36b24ffea88a2383395a685001d6070b 100644 (file)
@@ -48,8 +48,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    another macro.  */
 #include "character.h"
 
-static int doprnt1 ();
-
 /* Generate output from a format-spec FORMAT,
    terminated at position FORMAT_END.
    Output goes in BUFFER, which has room for BUFSIZE chars.
@@ -61,16 +59,10 @@ static int doprnt1 ();
    Integers are passed as C integers.  */
 
 int
-doprnt (buffer, bufsize, format, format_end, nargs, args)
-     char *buffer;
-     register int bufsize;
-     char *format;
-     char *format_end;
-     int nargs;
-     char **args;
+doprnt (char *buffer, register int bufsize, const char *format,
+       const char *format_end, va_list ap)
 {
-  int cnt = 0;                 /* Number of arg to gobble next */
-  register char *fmt = format; /* Pointer into format string */
+  const char *fmt = format;    /* Pointer into format string */
   register char *bufptr = buffer; /* Pointer into output buffer.. */
 
   /* Use this for sprintf unless we need something really big.  */
@@ -169,8 +161,6 @@ doprnt (buffer, bufsize, format, format_end, nargs, args)
            case 'd':
            case 'o':
            case 'x':
-             if (cnt == nargs)
-               error ("Not enough arguments for format string");
              if (sizeof (int) == sizeof (EMACS_INT))
                ;
              else if (sizeof (long) == sizeof (EMACS_INT))
@@ -181,7 +171,7 @@ doprnt (buffer, bufsize, format, format_end, nargs, args)
                string++;
              else
                abort ();
-             sprintf (sprintf_buffer, fmtcpy, args[cnt++]);
+             sprintf (sprintf_buffer, fmtcpy, va_arg(ap, char *));
              /* Now copy into final output, truncating as nec.  */
              string = (unsigned char *) sprintf_buffer;
              goto doit;
@@ -190,12 +180,8 @@ doprnt (buffer, bufsize, format, format_end, nargs, args)
            case 'e':
            case 'g':
              {
-               union { double d; char *half[2]; } u;
-               if (cnt + 1 == nargs)
-                 error ("Not enough arguments for format string");
-               u.half[0] = args[cnt++];
-               u.half[1] = args[cnt++];
-               sprintf (sprintf_buffer, fmtcpy, u.d);
+               double d = va_arg(ap, double);
+               sprintf (sprintf_buffer, fmtcpy, d);
                /* Now copy into final output, truncating as nec.  */
                string = (unsigned char *) sprintf_buffer;
                goto doit;
@@ -204,11 +190,9 @@ doprnt (buffer, bufsize, format, format_end, nargs, args)
            case 'S':
              string[-1] = 's';
            case 's':
-             if (cnt == nargs)
-               error ("Not enough arguments for format string");
              if (fmtcpy[1] != 's')
                minlen = atoi (&fmtcpy[1]);
-             string = (unsigned char *) args[cnt++];
+             string = va_arg(ap, unsigned char *);
              tem = strlen (string);
              width = strwidth (string, tem);
              goto doit1;
@@ -237,12 +221,12 @@ doprnt (buffer, bufsize, format, format_end, nargs, args)
                  /* Truncate the string at character boundary.  */
                  tem = bufsize;
                  while (!CHAR_HEAD_P (string[tem - 1])) tem--;
-                 bcopy (string, bufptr, tem);
+                 memcpy (bufptr, string, tem);
                  /* We must calculate WIDTH again.  */
                  width = strwidth (bufptr, tem);
                }
              else
-               bcopy (string, bufptr, tem);
+               memcpy (bufptr, string, tem);
              bufptr += tem;
              bufsize -= tem;
              if (minlen < 0)
@@ -258,16 +242,21 @@ doprnt (buffer, bufsize, format, format_end, nargs, args)
              continue;
 
            case 'c':
-             if (cnt == nargs)
-               error ("Not enough arguments for format string");
-             tem = CHAR_STRING ((int) (EMACS_INT) args[cnt], charbuf);
-             string = charbuf;
-             cnt++;
-             string[tem] = 0;
-             width = strwidth (string, tem);
-             if (fmtcpy[1] != 'c')
-               minlen = atoi (&fmtcpy[1]);
-             goto doit1;
+             {
+               /* Sometimes for %c we pass a char, which would widen
+                  to int.  Sometimes we pass XFASTINT() or XINT()
+                  values, which would be EMACS_INT.  Let's hope that
+                  both are passed the same way, otherwise we'll need
+                  to rewrite callers.  */
+               EMACS_INT chr = va_arg(ap, EMACS_INT);
+               tem = CHAR_STRING ((int) chr, charbuf);
+               string = charbuf;
+               string[tem] = 0;
+               width = strwidth (string, tem);
+               if (fmtcpy[1] != 'c')
+                 minlen = atoi (&fmtcpy[1]);
+               goto doit1;
+             }
 
            case '%':
              fmt--;    /* Drop thru and this % will be treated as normal */
index d04c28b3156eb001df4ffbba8c20ec880b3b9f65..e66b50ed3ffccca3475f28b4f0e5ed8112e6d682 100644 (file)
@@ -48,10 +48,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <grp.h>
 #include <crt0.h>
 
-#ifndef __DJGPP_MINOR__
-# define __tb _go32_info_block.linear_address_of_transfer_buffer;
-#endif
-
 DEFUN ("int86", Fint86, Sint86, 2, 2, 0,
        doc: /* Call specific MS-DOS interrupt number INTERRUPT with REGISTERS.
 Return the updated REGISTER vector.
@@ -59,13 +55,11 @@ Return the updated REGISTER vector.
 INTERRUPT should be an integer in the range 0 to 255.
 REGISTERS should be a vector produced by `make-register' and
 `set-register-value'.  */)
-     (interrupt, registers)
-     Lisp_Object interrupt, registers;
+  (Lisp_Object interrupt, Lisp_Object registers)
 {
   register int i;
   int no;
   union REGS inregs, outregs;
-  Lisp_Object val;
 
   CHECK_NUMBER (interrupt);
   no = (unsigned long) XINT (interrupt);
@@ -101,13 +95,11 @@ REGISTERS should be a vector produced by `make-register' and
 DEFUN ("msdos-memget", Fdos_memget, Sdos_memget, 2, 2, 0,
        doc: /* Read DOS memory at offset ADDRESS into VECTOR.
 Return the updated VECTOR.  */)
-     (address, vector)
-     Lisp_Object address, vector;
+  (Lisp_Object address, Lisp_Object vector)
 {
   register int i;
   int offs, len;
   char *buf;
-  Lisp_Object val;
 
   CHECK_NUMBER (address);
   offs = (unsigned long) XINT (address);
@@ -126,13 +118,11 @@ Return the updated VECTOR.  */)
 
 DEFUN ("msdos-memput", Fdos_memput, Sdos_memput, 2, 2, 0,
        doc: /* Write DOS memory at offset ADDRESS from VECTOR.  */)
-     (address, vector)
-     Lisp_Object address, vector;
+  (Lisp_Object address, Lisp_Object vector)
 {
   register int i;
   int offs, len;
   char *buf;
-  Lisp_Object val;
 
   CHECK_NUMBER (address);
   offs = (unsigned long) XINT (address);
@@ -157,8 +147,7 @@ DEFUN ("msdos-set-keyboard", Fmsdos_set_keyboard, Smsdos_set_keyboard, 1, 2, 0,
 If the optional argument ALLKEYS is non-nil, the keyboard is mapped for
 all keys; otherwise it is only used when the ALT key is pressed.
 The current keyboard layout is available in dos-keyboard-code.  */)
-     (country_code, allkeys)
-     Lisp_Object country_code, allkeys;
+  (Lisp_Object country_code, Lisp_Object allkeys)
 {
   CHECK_NUMBER (country_code);
   if (!dos_set_keyboard (XINT (country_code), !NILP (allkeys)))
@@ -172,7 +161,7 @@ The current keyboard layout is available in dos-keyboard-code.  */)
 
 DEFUN ("msdos-mouse-p", Fmsdos_mouse_p, Smsdos_mouse_p, 0, 0, 0,
        doc: /* Report whether a mouse is present.  */)
-     ()
+  (void)
 {
   if (have_mouse)
     return Qt;
@@ -183,7 +172,7 @@ DEFUN ("msdos-mouse-p", Fmsdos_mouse_p, Smsdos_mouse_p, 0, 0, 0,
 
 DEFUN ("msdos-mouse-init", Fmsdos_mouse_init, Smsdos_mouse_init, 0, 0, "",
        doc: /* Initialize and enable mouse if available.  */)
-     ()
+  (void)
 {
   if (have_mouse)
     {
@@ -196,7 +185,7 @@ DEFUN ("msdos-mouse-init", Fmsdos_mouse_init, Smsdos_mouse_init, 0, 0, "",
 
 DEFUN ("msdos-mouse-enable", Fmsdos_mouse_enable, Smsdos_mouse_enable, 0, 0, "",
        doc: /* Enable mouse if available.  */)
-     ()
+  (void)
 {
   if (have_mouse)
     {
@@ -208,7 +197,7 @@ DEFUN ("msdos-mouse-enable", Fmsdos_mouse_enable, Smsdos_mouse_enable, 0, 0, "",
 
 DEFUN ("msdos-mouse-disable", Fmsdos_mouse_disable, Smsdos_mouse_disable, 0, 0, "",
        doc: /* Disable mouse if available.  */)
-     ()
+  (void)
 {
   mouse_off ();
   if (have_mouse) have_mouse = -1;
@@ -218,7 +207,7 @@ DEFUN ("msdos-mouse-disable", Fmsdos_mouse_disable, Smsdos_mouse_disable, 0, 0,
 DEFUN ("insert-startup-screen", Finsert_startup_screen, Sinsert_startup_screen, 0, 0, "",
        doc: /* Insert copy of screen contents prior to starting Emacs.
 Return nil if startup screen is not available.  */)
-     ()
+  (void)
 {
   char *s;
   int rows, cols, i, j;
@@ -287,13 +276,15 @@ restore_parent_vm_title (void)
 #endif /* !HAVE_X_WINDOWS */
 
 void
-init_dosfns ()
+init_dosfns (void)
 {
   union REGS regs;
   _go32_dpmi_registers dpmiregs;
   unsigned long xbuf = _go32_info_block.linear_address_of_transfer_buffer;
 
 #ifndef SYSTEM_MALLOC
+  extern void get_lim_data (void);
+
   get_lim_data (); /* why the hell isn't this called elsewhere? */
 #endif
 
@@ -385,8 +376,6 @@ init_dosfns ()
     }
 #endif /* !HAVE_X_WINDOWS */
 
-#if __DJGPP__ >= 2
-
   /* Without this, we never see hidden files.
      Don't OR it with the previous value, so the value recorded at dump
      time, possibly with `preserve-case' flags set, won't get through.  */
@@ -398,7 +387,6 @@ init_dosfns ()
   if (!NILP (Fmsdos_long_file_names ()))
     __opendir_flags |= __OPENDIR_PRESERVE_CASE;
 #endif /* __DJGPP_MINOR__ == 0 */
-#endif /* __DJGPP__ >= 2 */
 }
 \f
 #ifndef HAVE_X_WINDOWS
@@ -488,9 +476,7 @@ w95_set_virtual_machine_title (const char *title_string)
    sets the name in the frame struct, but has no other effects.  */
 
 void
-x_set_title (f, name)
-     struct frame *f;
-     Lisp_Object name;
+x_set_title (struct frame *f, Lisp_Object name)
 {
   /* Don't change the title if it's already NAME.  */
   if (EQ (name, f->title))
@@ -518,8 +504,7 @@ Value is a list of floats (TOTAL FREE AVAIL), where TOTAL is the total
 storage of the file system, FREE is the free storage, and AVAIL is the
 storage available to a non-superuser.  All 3 numbers are in bytes.
 If the underlying system call fails, value is nil.  */)
-     (filename)
-     Lisp_Object filename;
+  (Lisp_Object filename)
 {
   struct statfs stfs;
   Lisp_Object encoded, value;
@@ -543,7 +528,7 @@ If the underlying system call fails, value is nil.  */)
    (There are no other processes on DOS, right?)  */
 
 Lisp_Object
-list_system_processes ()
+list_system_processes (void)
 {
   Lisp_Object proclist = Qnil;
 
@@ -572,6 +557,7 @@ 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
@@ -696,7 +682,8 @@ dos_cleanup (void)
 /*
  *     Define everything
  */
-syms_of_dosfns ()
+void
+syms_of_dosfns (void)
 {
   defsubr (&Sint86);
   defsubr (&Sdos_memget);
index 1759ffd8a90aefdd6637245e21cf5128e28952c0..d31401247b42c0657b359b9683fdaabb6cf4b1fa 100644 (file)
@@ -38,8 +38,9 @@ extern Lisp_Object Vdos_windows_version;
 #ifndef HAVE_X_WINDOWS
 extern Lisp_Object Vdos_display_scancodes;
 
-extern int         msdos_stdcolor_idx  P_ ((const char *));
-extern Lisp_Object msdos_stdcolor_name P_ ((int));
+extern int         msdos_stdcolor_idx  (const char *);
+extern Lisp_Object msdos_stdcolor_name (int);
+extern void        x_set_title (struct frame *, Lisp_Object);
 #endif
 
 /* arch-tag: a83b8c4c-63c8-451e-9e94-bc72e3e2f8bc
diff --git a/src/ecrt0.c b/src/ecrt0.c
deleted file mode 100644 (file)
index 7dbbd6c..0000000
+++ /dev/null
@@ -1,173 +0,0 @@
-/* C code startup routine.
-   Copyright (C) 1985, 1986, 1992, 2001, 2002, 2003, 2004,
-                 2005, 2006, 2007, 2008, 2009, 2010 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 standard Vax 4.2 Unix crt0.c cannot be used for Emacs
-   because it makes `environ' an initialized variable.
-   It is easiest to have a special crt0.c on all machines
-   though I don't know whether other machines actually need it.  */
-
-/* On the vax and 68000, in BSD4.2 and USG5.2,
-   this is the data format on startup:
-  (vax) ap and fp are unpredictable as far as I know; don't use them.
-  sp ->  word containing argc
-         word pointing to first arg string
-        [word pointing to next arg string]... 0 or more times
-        0
-Optionally:
-        [word pointing to environment variable]... 1 or more times
-        ...
-        0
-And always:
-        first arg string
-        [next arg string]... 0 or more times
-*/
-
-#ifdef emacs
-#include <config.h>
-#endif
-
-/*             ********  WARNING ********
-    Do not insert any data definitions before data_start!
-    Since this is the first file linked, the address of the following
-    variable should correspond to the start of initialized data space.
-    On some systems this is a constant that is independent of the text
-    size for shared executables.  On others, it is a function of the
-    text size. In short, this seems to be the most portable way to
-    discover the start of initialized data space dynamically at runtime,
-    for either shared or unshared executables, on either swapping or
-    virtual systems.  It only requires that the linker allocate objects
-    in the order encountered, a reasonable model for most Unix systems.
-    Similarly, note that the address of _start() should be the start
-    of text space.   Fred Fish, UniSoft Systems Inc.  */
-
-int data_start = 0;
-
-#ifdef NEED_ERRNO
-int errno;
-#endif
-
-#ifndef MSDOS
-char **environ;
-#endif
-
-#ifndef static
-/* On systems where the static storage class is usable, this function
-   should be declared as static.  Otherwise, the static keyword has
-   been defined to be something else, and code for those systems must
-   take care of this declaration appropriately.  */
-static start1 ();
-#endif
-
-#ifdef CRT0_DUMMIES
-
-/* Define symbol "start": here; some systems want that symbol.  */
-asm("  .text           ");
-asm("  .globl start    ");
-asm("  start:          ");
-
-_start ()
-{
-/* On vax, nothing is pushed here  */
-  start1 ();
-}
-
-static
-start1 (CRT0_DUMMIES argc, xargv)
-     int argc;
-     char *xargv;
-{
-  register char **argv = &xargv;
-  environ = argv + argc + 1;
-
-  if ((char *)environ == xargv)
-    environ--;
-  exit (main (argc, argv, environ));
-
-  /* Refer to `start1' so GCC will not think it is never called
-     and optimize it out.  */
-  (void) &start1;
-}
-#else /* not CRT0_DUMMIES */
-
-/* This is a kludge.  Now that the CRT0_DUMMIES mechanism above exists,
-   most of these machines could use the vax code above
-   with some suitable definition of CRT0_DUMMIES.
-   Then the symbol m68k could be flushed.
-   But I don't want to risk breaking these machines
-   in a version 17 patch release, so that change is being put off.  */
-
-#ifdef m68k                    /* Can't do it all from C */
-       asm ("  global  _start");
-       asm ("  text");
-       asm ("_start:");
-       asm ("  comm    splimit%,4");
-       asm ("  global  exit");
-       asm ("  text");
-       asm ("  mov.l   %d0,splimit%");
-       asm ("  jsr     start1");
-       asm ("  mov.l   %d0,(%sp)");
-       asm ("  jsr     exit");
-       asm ("  mov.l   &1,%d0");       /* d0 = 1 => exit */
-       asm ("  trap    &0");
-
-/* ignore takes care of skipping the a6 value pushed in start.  */
-static
-start1 (argc, xargv)
-     int argc;
-     char *xargv;
-{
-  register char **argv = &xargv;
-  environ = argv + argc + 1;
-
-  if ((char *)environ == xargv)
-    environ--;
-  exit (main (argc, argv, environ));
-}
-
-#endif /* m68k */
-
-#endif /* not CRT0_DUMMIES */
-
-#ifdef __sparc__
-asm (".global __start");
-asm (".text");
-asm ("__start:");
-asm (" mov     0, %fp");
-asm (" ld      [%sp + 64], %o0");
-asm (" add     %sp, 68, %o1");
-asm (" sll     %o0, 2, %o2");
-asm (" add     %o2, 4, %o2");
-asm (" add     %o1, %o2, %o2");
-asm (" sethi   %hi(_environ), %o3");
-asm (" st      %o2, [%o3+%lo(_environ)]");
-asm (" andn    %sp, 7, %sp");
-asm (" call    _main");
-asm (" sub     %sp, 24, %sp");
-asm (" call    __exit");
-asm (" nop");
-
-#endif /* __sparc__ */
-
-#if __FreeBSD__ == 2
-char *__progname;
-#endif
-
-/* arch-tag: 4025c2fb-d6b1-4d29-b1b6-8100b6bd1e74
-   (do not change this comment) */
index ea279a462f2a9544100e49d9971c9283eae4b0a2..1bd6682c3b605fbb714973f119712f81315375ca 100644 (file)
@@ -86,38 +86,33 @@ extern char **environ;
     (1000 - TM_YEAR_BASE <= (tm_year) && (tm_year) <= 9999 - TM_YEAR_BASE)
 #endif
 
-extern size_t emacs_strftimeu P_ ((char *, size_t, const char *,
-                                  const struct tm *, int));
+extern size_t emacs_strftimeu (char *, size_t, const char *,
+                               const struct tm *, int);
 
 #ifdef WINDOWSNT
-extern Lisp_Object w32_get_internal_run_time ();
+extern Lisp_Object w32_get_internal_run_time (void);
 #endif
 
-static int tm_diff P_ ((struct tm *, struct tm *));
-static void find_field P_ ((Lisp_Object, Lisp_Object, Lisp_Object, int *, Lisp_Object, int *));
-static void update_buffer_properties P_ ((int, int));
-static Lisp_Object region_limit P_ ((int));
-int lisp_time_argument P_ ((Lisp_Object, time_t *, int *));
-static size_t emacs_memftimeu P_ ((char *, size_t, const char *,
-                                  size_t, const struct tm *, int));
+static int tm_diff (struct tm *, struct tm *);
+static void find_field (Lisp_Object, Lisp_Object, Lisp_Object, int *, Lisp_Object, int *);
+static void update_buffer_properties (int, int);
+static Lisp_Object region_limit (int);
+static size_t emacs_memftimeu (char *, size_t, const char *,
+                               size_t, const struct tm *, int);
 static void general_insert_function (void (*) (const unsigned char *, EMACS_INT),
                                     void (*) (Lisp_Object, EMACS_INT,
                                               EMACS_INT, EMACS_INT,
                                               EMACS_INT, int),
                                     int, int, Lisp_Object *);
-static Lisp_Object subst_char_in_region_unwind P_ ((Lisp_Object));
-static Lisp_Object subst_char_in_region_unwind_1 P_ ((Lisp_Object));
-static void transpose_markers P_ ((int, int, int, int, int, int, int, int));
-
-#ifdef HAVE_INDEX
-extern char *index P_ ((const char *, int));
-#endif
+static Lisp_Object subst_char_in_region_unwind (Lisp_Object);
+static Lisp_Object subst_char_in_region_unwind_1 (Lisp_Object);
+static void transpose_markers (int, int, int, int, int, int, int, int);
 
 Lisp_Object Vbuffer_access_fontify_functions;
 Lisp_Object Qbuffer_access_fontify_functions;
 Lisp_Object Vbuffer_access_fontified_property;
 
-Lisp_Object Fuser_full_name P_ ((Lisp_Object));
+Lisp_Object Fuser_full_name (Lisp_Object);
 
 /* Non-nil means don't stop at field boundary in text motion commands.  */
 
@@ -141,7 +136,7 @@ Lisp_Object Qboundary;
 
 
 void
-init_editfns ()
+init_editfns (void)
 {
   char *user_name;
   register unsigned char *p;
@@ -209,8 +204,7 @@ init_editfns ()
 DEFUN ("char-to-string", Fchar_to_string, Schar_to_string, 1, 1, 0,
        doc: /* Convert arg CHAR to a string containing that character.
 usage: (char-to-string CHAR)  */)
-     (character)
-     Lisp_Object character;
+  (Lisp_Object character)
 {
   int len;
   unsigned char str[MAX_MULTIBYTE_LENGTH];
@@ -223,8 +217,7 @@ usage: (char-to-string CHAR)  */)
 
 DEFUN ("byte-to-string", Fbyte_to_string, Sbyte_to_string, 1, 1, 0,
        doc: /* Convert arg BYTE to a string containing that byte.  */)
-     (byte)
-     Lisp_Object byte;
+  (Lisp_Object byte)
 {
   unsigned char b;
   CHECK_NUMBER (byte);
@@ -235,8 +228,7 @@ DEFUN ("byte-to-string", Fbyte_to_string, Sbyte_to_string, 1, 1, 0,
 DEFUN ("string-to-char", Fstring_to_char, Sstring_to_char, 1, 1, 0,
        doc: /* Convert arg STRING to a character, the first character of that string.
 A multibyte character is handled correctly.  */)
-     (string)
-     register Lisp_Object string;
+  (register Lisp_Object string)
 {
   register Lisp_Object val;
   CHECK_STRING (string);
@@ -253,8 +245,7 @@ A multibyte character is handled correctly.  */)
 }
 \f
 static Lisp_Object
-buildmark (charpos, bytepos)
-     int charpos, bytepos;
+buildmark (int charpos, int bytepos)
 {
   register Lisp_Object mark;
   mark = Fmake_marker ();
@@ -265,7 +256,7 @@ buildmark (charpos, bytepos)
 DEFUN ("point", Fpoint, Spoint, 0, 0, 0,
        doc: /* Return value of point, as an integer.
 Beginning of buffer is position (point-min).  */)
-     ()
+  (void)
 {
   Lisp_Object temp;
   XSETFASTINT (temp, PT);
@@ -274,14 +265,13 @@ Beginning of buffer is position (point-min).  */)
 
 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);
 }
 
 int
-clip_to_bounds (lower, num, upper)
-     int lower, num, upper;
+clip_to_bounds (int lower, int num, int upper)
 {
   if (num < lower)
     return lower;
@@ -296,8 +286,7 @@ DEFUN ("goto-char", Fgoto_char, Sgoto_char, 1, 1, "NGoto char: ",
 Beginning of buffer is position (point-min), end is (point-max).
 
 The return value is POSITION.  */)
-     (position)
-     register Lisp_Object position;
+  (register Lisp_Object position)
 {
   int pos;
 
@@ -328,10 +317,8 @@ The return value is POSITION.  */)
    If there is no region active, signal an error. */
 
 static Lisp_Object
-region_limit (beginningp)
-     int beginningp;
+region_limit (int beginningp)
 {
-  extern Lisp_Object Vmark_even_if_inactive; /* Defined in callint.c. */
   Lisp_Object m;
 
   if (!NILP (Vtransient_mark_mode)
@@ -349,15 +336,15 @@ region_limit (beginningp)
 }
 
 DEFUN ("region-beginning", Fregion_beginning, Sregion_beginning, 0, 0, 0,
-       doc: /* Return position of beginning of region, as an integer.  */)
-     ()
+       doc: /* Return the integer value of point or mark, whichever is smaller.  */)
+  (void)
 {
   return region_limit (1);
 }
 
 DEFUN ("region-end", Fregion_end, Sregion_end, 0, 0, 0,
-       doc: /* Return position of end of region, as an integer.  */)
-     ()
+       doc: /* Return the integer value of point or mark, whichever is larger.  */)
+  (void)
 {
   return region_limit (0);
 }
@@ -366,7 +353,7 @@ DEFUN ("mark-marker", Fmark_marker, Smark_marker, 0, 0, 0,
        doc: /* Return this buffer's mark, as a marker object.
 Watch out!  Moving this marker changes the mark position.
 If you set the marker not to point anywhere, the buffer will have no mark.  */)
-     ()
+  (void)
 {
   return current_buffer->mark;
 }
@@ -377,10 +364,7 @@ If you set the marker not to point anywhere, the buffer will have no mark.  */)
    of length LEN.  */
 
 static int
-overlays_around (pos, vec, len)
-     int pos;
-     Lisp_Object *vec;
-     int len;
+overlays_around (int pos, Lisp_Object *vec, int len)
 {
   Lisp_Object overlay, start, end;
   struct Lisp_Overlay *tail;
@@ -436,9 +420,7 @@ overlays_around (pos, vec, len)
    window-specific overlays are considered only if they are associated
    with OBJECT. */
 Lisp_Object
-get_pos_property (position, prop, object)
-     Lisp_Object position, object;
-     register Lisp_Object prop;
+get_pos_property (Lisp_Object position, register Lisp_Object prop, Lisp_Object object)
 {
   CHECK_NUMBER_COERCE_MARKER (position);
 
@@ -533,11 +515,7 @@ get_pos_property (position, prop, object)
    is not stored.  */
 
 static void
-find_field (pos, merge_at_boundary, beg_limit, beg, end_limit, end)
-     Lisp_Object pos;
-     Lisp_Object merge_at_boundary;
-     Lisp_Object beg_limit, end_limit;
-     int *beg, *end;
+find_field (Lisp_Object pos, Lisp_Object merge_at_boundary, Lisp_Object beg_limit, int *beg, Lisp_Object end_limit, int *end)
 {
   /* Fields right before and after the point.  */
   Lisp_Object before_field, after_field;
@@ -651,8 +629,7 @@ DEFUN ("delete-field", Fdelete_field, Sdelete_field, 0, 1, 0,
        doc: /* Delete the field surrounding POS.
 A field is a region of text with the same `field' property.
 If POS is nil, the value of point is used for POS.  */)
-     (pos)
-     Lisp_Object pos;
+  (Lisp_Object pos)
 {
   int beg, end;
   find_field (pos, Qnil, Qnil, &beg, Qnil, &end);
@@ -665,8 +642,7 @@ DEFUN ("field-string", Ffield_string, Sfield_string, 0, 1, 0,
        doc: /* Return the contents of the field surrounding POS as a string.
 A field is a region of text with the same `field' property.
 If POS is nil, the value of point is used for POS.  */)
-     (pos)
-     Lisp_Object pos;
+  (Lisp_Object pos)
 {
   int beg, end;
   find_field (pos, Qnil, Qnil, &beg, Qnil, &end);
@@ -677,8 +653,7 @@ DEFUN ("field-string-no-properties", Ffield_string_no_properties, Sfield_string_
        doc: /* Return the contents of the field around POS, without text properties.
 A field is a region of text with the same `field' property.
 If POS is nil, the value of point is used for POS.  */)
-     (pos)
-     Lisp_Object pos;
+  (Lisp_Object pos)
 {
   int beg, end;
   find_field (pos, Qnil, Qnil, &beg, Qnil, &end);
@@ -693,8 +668,7 @@ If ESCAPE-FROM-EDGE is non-nil and POS is at the beginning of its
 field, then the beginning of the *previous* field is returned.
 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.  */)
-     (pos, escape_from_edge, limit)
-     Lisp_Object pos, escape_from_edge, limit;
+  (Lisp_Object pos, Lisp_Object escape_from_edge, Lisp_Object limit)
 {
   int beg;
   find_field (pos, escape_from_edge, limit, &beg, Qnil, 0);
@@ -709,8 +683,7 @@ If ESCAPE-FROM-EDGE is non-nil and POS is at the end of its field,
 then the end of the *following* field is returned.
 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.  */)
-     (pos, escape_from_edge, limit)
-     Lisp_Object pos, escape_from_edge, limit;
+  (Lisp_Object pos, Lisp_Object escape_from_edge, Lisp_Object limit)
 {
   int end;
   find_field (pos, escape_from_edge, Qnil, 0, limit, &end);
@@ -744,9 +717,7 @@ If the optional argument INHIBIT-CAPTURE-PROPERTY is non-nil, and OLD-POS has
 a non-nil property of that name, then any field boundaries are ignored.
 
 Field boundaries are not noticed if `inhibit-field-text-motion' is non-nil.  */)
-     (new_pos, old_pos, escape_from_edge, only_in_line, inhibit_capture_property)
-     Lisp_Object new_pos, old_pos;
-     Lisp_Object escape_from_edge, only_in_line, inhibit_capture_property;
+  (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.  */
   int orig_point = 0;
@@ -834,6 +805,9 @@ DEFUN ("line-beginning-position",
 With argument N not nil or 1, move forward N - 1 lines first.
 If scan reaches end of buffer, return that position.
 
+The returned position is of the first character in the logical order,
+i.e. the one that has the smallest character position.
+
 This function constrains the returned position to the current field
 unless that would be on a different line than the original,
 unconstrained result.  If N is nil or 1, and a front-sticky field
@@ -841,8 +815,7 @@ starts at point, the scan stops as soon as it starts.  To ignore field
 boundaries bind `inhibit-field-text-motion' to t.
 
 This function does not move point.  */)
-     (n)
-     Lisp_Object n;
+  (Lisp_Object n)
 {
   int orig, orig_byte, end;
   int count = SPECPDL_INDEX ();
@@ -873,6 +846,9 @@ DEFUN ("line-end-position", Fline_end_position, Sline_end_position, 0, 1, 0,
 With argument N not nil or 1, move forward N - 1 lines first.
 If scan reaches end of buffer, return that position.
 
+The returned position is of the last character in the logical order,
+i.e. the character whose buffer position is the largest one.
+
 This function constrains the returned position to the current field
 unless that would be on a different line than the original,
 unconstrained result.  If N is nil or 1, and a rear-sticky field ends
@@ -880,8 +856,7 @@ at point, the scan stops as soon as it starts.  To ignore field
 boundaries bind `inhibit-field-text-motion' to t.
 
 This function does not move point.  */)
-     (n)
-     Lisp_Object n;
+  (Lisp_Object n)
 {
   int end_pos;
   int orig = PT;
@@ -900,7 +875,7 @@ This function does not move point.  */)
 
 \f
 Lisp_Object
-save_excursion_save ()
+save_excursion_save (void)
 {
   int visible = (XBUFFER (XWINDOW (selected_window)->buffer)
                 == current_buffer);
@@ -913,8 +888,7 @@ save_excursion_save ()
 }
 
 Lisp_Object
-save_excursion_restore (info)
-     Lisp_Object info;
+save_excursion_restore (Lisp_Object info)
 {
   Lisp_Object tem, tem1, omark, nmark;
   struct gcpro gcpro1, gcpro2, gcpro3;
@@ -1013,8 +987,7 @@ If you only want to save the current buffer but not point nor mark,
 then just use `save-current-buffer', or even `with-current-buffer'.
 
 usage: (save-excursion &rest BODY)  */)
-     (args)
-     Lisp_Object args;
+  (Lisp_Object args)
 {
   register Lisp_Object val;
   int count = SPECPDL_INDEX ();
@@ -1029,8 +1002,7 @@ DEFUN ("save-current-buffer", Fsave_current_buffer, Ssave_current_buffer, 0, UNE
        doc: /* Save the current buffer; execute BODY; restore the current buffer.
 Executes BODY just like `progn'.
 usage: (save-current-buffer &rest BODY)  */)
-     (args)
-     Lisp_Object args;
+  (Lisp_Object args)
 {
   Lisp_Object val;
   int count = SPECPDL_INDEX ();
@@ -1044,8 +1016,7 @@ usage: (save-current-buffer &rest BODY)  */)
 DEFUN ("buffer-size", Fbufsize, Sbufsize, 0, 1, 0,
        doc: /* Return the number of characters in the current buffer.
 If BUFFER, return the number of characters in that buffer instead.  */)
-     (buffer)
-     Lisp_Object buffer;
+  (Lisp_Object buffer)
 {
   if (NILP (buffer))
     return make_number (Z - BEG);
@@ -1060,7 +1031,7 @@ If BUFFER, return the number of characters in that buffer instead.  */)
 DEFUN ("point-min", Fpoint_min, Spoint_min, 0, 0, 0,
        doc: /* Return the minimum permissible value of point in the current buffer.
 This is 1, unless narrowing (a buffer restriction) is in effect.  */)
-     ()
+  (void)
 {
   Lisp_Object temp;
   XSETFASTINT (temp, BEGV);
@@ -1070,7 +1041,7 @@ This is 1, unless narrowing (a buffer restriction) is in effect.  */)
 DEFUN ("point-min-marker", Fpoint_min_marker, Spoint_min_marker, 0, 0, 0,
        doc: /* Return a marker to the minimum permissible value of point in this buffer.
 This is the beginning, unless narrowing (a buffer restriction) is in effect.  */)
-     ()
+  (void)
 {
   return buildmark (BEGV, BEGV_BYTE);
 }
@@ -1079,7 +1050,7 @@ DEFUN ("point-max", Fpoint_max, Spoint_max, 0, 0, 0,
        doc: /* Return the maximum permissible value of point in the current buffer.
 This is (1+ (buffer-size)), unless narrowing (a buffer restriction)
 is in effect, in which case it is less.  */)
-     ()
+  (void)
 {
   Lisp_Object temp;
   XSETFASTINT (temp, ZV);
@@ -1090,7 +1061,7 @@ DEFUN ("point-max-marker", Fpoint_max_marker, Spoint_max_marker, 0, 0, 0,
        doc: /* Return a marker to the maximum permissible value of point in this buffer.
 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);
 }
@@ -1098,7 +1069,7 @@ is in effect, in which case it is less.  */)
 DEFUN ("gap-position", Fgap_position, Sgap_position, 0, 0, 0,
        doc: /* Return the position of the gap, in the current buffer.
 See also `gap-size'.  */)
-     ()
+  (void)
 {
   Lisp_Object temp;
   XSETFASTINT (temp, GPT);
@@ -1108,7 +1079,7 @@ See also `gap-size'.  */)
 DEFUN ("gap-size", Fgap_size, Sgap_size, 0, 0, 0,
        doc: /* Return the size of the current buffer's gap.
 See also `gap-position'.  */)
-     ()
+  (void)
 {
   Lisp_Object temp;
   XSETFASTINT (temp, GAP_SIZE);
@@ -1118,8 +1089,7 @@ See also `gap-position'.  */)
 DEFUN ("position-bytes", Fposition_bytes, Sposition_bytes, 1, 1, 0,
        doc: /* Return the byte position for character position POSITION.
 If POSITION is out of range, the value is nil.  */)
-     (position)
-     Lisp_Object position;
+  (Lisp_Object position)
 {
   CHECK_NUMBER_COERCE_MARKER (position);
   if (XINT (position) < BEG || XINT (position) > Z)
@@ -1130,8 +1100,7 @@ If POSITION is out of range, the value is nil.  */)
 DEFUN ("byte-to-position", Fbyte_to_position, Sbyte_to_position, 1, 1, 0,
        doc: /* Return the character position for byte position BYTEPOS.
 If BYTEPOS is out of range, the value is nil.  */)
-     (bytepos)
-     Lisp_Object bytepos;
+  (Lisp_Object bytepos)
 {
   CHECK_NUMBER (bytepos);
   if (XINT (bytepos) < BEG_BYTE || XINT (bytepos) > Z_BYTE)
@@ -1142,7 +1111,7 @@ If BYTEPOS is out of range, the value is nil.  */)
 DEFUN ("following-char", Ffollowing_char, Sfollowing_char, 0, 0, 0,
        doc: /* Return the character following point, as a number.
 At the end of the buffer or accessible region, return 0.  */)
-     ()
+  (void)
 {
   Lisp_Object temp;
   if (PT >= ZV)
@@ -1155,7 +1124,7 @@ At the end of the buffer or accessible region, return 0.  */)
 DEFUN ("preceding-char", Fprevious_char, Sprevious_char, 0, 0, 0,
        doc: /* Return the character preceding point, as a number.
 At the beginning of the buffer or accessible region, return 0.  */)
-     ()
+  (void)
 {
   Lisp_Object temp;
   if (PT <= BEGV)
@@ -1174,7 +1143,7 @@ At the beginning of the buffer or accessible region, return 0.  */)
 DEFUN ("bobp", Fbobp, Sbobp, 0, 0, 0,
        doc: /* Return t if point is at the beginning of the buffer.
 If the buffer is narrowed, this means the beginning of the narrowed part.  */)
-     ()
+  (void)
 {
   if (PT == BEGV)
     return Qt;
@@ -1184,7 +1153,7 @@ If the buffer is narrowed, this means the beginning of the narrowed part.  */)
 DEFUN ("eobp", Feobp, Seobp, 0, 0, 0,
        doc: /* Return t if point is at the end of the buffer.
 If the buffer is narrowed, this means the end of the narrowed part.  */)
-     ()
+  (void)
 {
   if (PT == ZV)
     return Qt;
@@ -1193,7 +1162,7 @@ If the buffer is narrowed, this means the end of the narrowed part.  */)
 
 DEFUN ("bolp", Fbolp, Sbolp, 0, 0, 0,
        doc: /* Return t if point is at the beginning of a line.  */)
-     ()
+  (void)
 {
   if (PT == BEGV || FETCH_BYTE (PT_BYTE - 1) == '\n')
     return Qt;
@@ -1203,7 +1172,7 @@ DEFUN ("bolp", Fbolp, Sbolp, 0, 0, 0,
 DEFUN ("eolp", Feolp, Seolp, 0, 0, 0,
        doc: /* Return t if point is at the end of a line.
 `End of a line' includes point being at the end of the buffer.  */)
-     ()
+  (void)
 {
   if (PT == ZV || FETCH_BYTE (PT_BYTE) == '\n')
     return Qt;
@@ -1214,8 +1183,7 @@ DEFUN ("char-after", Fchar_after, Schar_after, 0, 1, 0,
        doc: /* Return character in current buffer at position POS.
 POS is an integer or a marker and defaults to point.
 If POS is out of range, the value is nil.  */)
-     (pos)
-     Lisp_Object pos;
+  (Lisp_Object pos)
 {
   register int pos_byte;
 
@@ -1247,8 +1215,7 @@ DEFUN ("char-before", Fchar_before, Schar_before, 0, 1, 0,
        doc: /* Return character in current buffer preceding position POS.
 POS is an integer or a marker and defaults to point.
 If POS is out of range, the value is nil.  */)
-     (pos)
-     Lisp_Object pos;
+  (Lisp_Object pos)
 {
   register Lisp_Object val;
   register int pos_byte;
@@ -1297,8 +1264,7 @@ that determines the value of this function.
 
 If optional argument UID is an integer or a float, return the login name
 of the user with that uid, or nil if there is no such user.  */)
-     (uid)
-     Lisp_Object uid;
+  (Lisp_Object uid)
 {
   struct passwd *pw;
   uid_t id;
@@ -1324,7 +1290,7 @@ DEFUN ("user-real-login-name", Fuser_real_login_name, Suser_real_login_name,
        doc: /* Return the name of the user's real uid, as a string.
 This ignores the environment variables LOGNAME and USER, so it differs from
 `user-login-name' when running under `su'.  */)
-     ()
+  (void)
 {
   /* Set up the user name info if we didn't do it before.
      (That can happen if Emacs is dumpable
@@ -1337,7 +1303,7 @@ This ignores the environment variables LOGNAME and USER, so it differs from
 DEFUN ("user-uid", Fuser_uid, Suser_uid, 0, 0, 0,
        doc: /* Return the effective uid of Emacs.
 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.  */
@@ -1353,7 +1319,7 @@ Value is an integer or a float, depending on the value.  */)
 DEFUN ("user-real-uid", Fuser_real_uid, Suser_real_uid, 0, 0, 0,
        doc: /* Return the real uid of Emacs.
 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.  */
@@ -1375,8 +1341,7 @@ If optional argument UID is an integer or float, return the full name
 of the user with that uid, or nil if there is no such user.
 If UID is a string, return the full name of the user with that login
 name, or nil if there is no such user.  */)
-     (uid)
-     Lisp_Object uid;
+  (Lisp_Object uid)
 {
   struct passwd *pw;
   register unsigned char *p, *q;
@@ -1404,12 +1369,12 @@ name, or nil if there is no such user.  */)
 
   p = (unsigned char *) USER_FULL_NAME;
   /* Chop off everything after the first comma. */
-  q = (unsigned char *) index (p, ',');
+  q = (unsigned char *) strchr (p, ',');
   full = make_string (p, q ? q - p : strlen (p));
 
 #ifdef AMPERSAND_FULL_NAME
   p = SDATA (full);
-  q = (unsigned char *) index (p, '&');
+  q = (unsigned char *) strchr (p, '&');
   /* Substitute the login name for the &, upcasing the first character.  */
   if (q)
     {
@@ -1418,7 +1383,7 @@ name, or nil if there is no such user.  */)
 
       login = Fuser_login_name (make_number (pw->pw_uid));
       r = (unsigned char *) alloca (strlen (p) + SCHARS (login) + 1);
-      bcopy (p, r, q - p);
+      memcpy (r, p, q - p);
       r[q - p] = 0;
       strcat (r, SDATA (login));
       r[q - p] = UPCASE (r[q - p]);
@@ -1432,24 +1397,24 @@ name, or nil if there is no such user.  */)
 
 DEFUN ("system-name", Fsystem_name, Ssystem_name, 0, 0, 0,
        doc: /* Return the host name of the machine you are running on, as a string.  */)
-     ()
+  (void)
 {
   return Vsystem_name;
 }
 
 /* For the benefit of callers who don't want to include lisp.h */
 
-char *
-get_system_name ()
+const char *
+get_system_name (void)
 {
   if (STRINGP (Vsystem_name))
-    return (char *) SDATA (Vsystem_name);
+    return (const char *) SDATA (Vsystem_name);
   else
     return "";
 }
 
-char *
-get_operating_system_release()
+const char *
+get_operating_system_release (void)
 {
   if (STRINGP (Voperating_system_release))
     return (char *) SDATA (Voperating_system_release);
@@ -1459,7 +1424,7 @@ get_operating_system_release()
 
 DEFUN ("emacs-pid", Femacs_pid, Semacs_pid, 0, 0, 0,
        doc: /* Return the process ID of Emacs, as an integer.  */)
-     ()
+  (void)
 {
   return make_number (getpid ());
 }
@@ -1473,7 +1438,7 @@ count.
 
 The microsecond count is zero on systems that do not provide
 resolution finer than a second.  */)
-     ()
+  (void)
 {
   EMACS_TIME t;
 
@@ -1494,7 +1459,7 @@ count.
 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.  */)
-     ()
+  (void)
 {
 #ifdef HAVE_GETRUSAGE
   struct rusage usage;
@@ -1527,10 +1492,7 @@ on systems that do not provide resolution finer than a second.  */)
 \f
 
 int
-lisp_time_argument (specified_time, result, usec)
-     Lisp_Object specified_time;
-     time_t *result;
-     int *usec;
+lisp_time_argument (Lisp_Object specified_time, time_t *result, int *usec)
 {
   if (NILP (specified_time))
     {
@@ -1588,8 +1550,7 @@ 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'.  */)
-     (specified_time)
-     Lisp_Object specified_time;
+  (Lisp_Object specified_time)
 {
   time_t sec;
   int usec;
@@ -1611,13 +1572,7 @@ or (if you need time as a string) `format-time-string'.  */)
    This function behaves like emacs_strftimeu, except it allows null
    bytes in FORMAT.  */
 static size_t
-emacs_memftimeu (s, maxsize, format, format_len, tp, ut)
-      char *s;
-      size_t maxsize;
-      const char *format;
-      size_t format_len;
-      const struct tm *tp;
-      int ut;
+emacs_memftimeu (char *s, size_t maxsize, const char *format, size_t format_len, const struct tm *tp, int ut)
 {
   size_t total = 0;
 
@@ -1705,8 +1660,7 @@ The modifiers are `E' and `O'.  For certain characters X,
 %OX is like %X, but uses the locale's number symbols.
 
 For example, to produce full ISO 8601 format, use "%Y-%m-%dT%T%z".  */)
-     (format_string, time, universal)
-     Lisp_Object format_string, time, universal;
+  (Lisp_Object format_string, Lisp_Object time, Lisp_Object universal)
 {
   time_t value;
   int size;
@@ -1773,8 +1727,7 @@ where 0 is Sunday.  DST is t if daylight saving time is in effect,
 otherwise nil.  ZONE is an integer indicating the number of seconds
 east of Greenwich.  (Note that Common Lisp has different meanings for
 DOW and ZONE.)  */)
-     (specified_time)
-     Lisp_Object specified_time;
+  (Lisp_Object specified_time)
 {
   time_t time_spec;
   struct tm save_tm;
@@ -1834,9 +1787,7 @@ Years before 1970 are not guaranteed to work.  On some systems,
 year values as low as 1901 do work.
 
 usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE)  */)
-     (nargs, args)
-     int nargs;
-     register Lisp_Object *args;
+  (int nargs, register Lisp_Object *args)
 {
   time_t time;
   struct tm tm;
@@ -1868,7 +1819,7 @@ usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE)  */)
   else
     {
       char tzbuf[100];
-      char *tzstring;
+      const char *tzstring;
       char **oldenv = environ, **newenv;
 
       if (EQ (zone, Qt))
@@ -1922,8 +1873,7 @@ current time.  The argument should have the form (HIGH LOW . IGNORED).
 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.  */)
-     (specified_time)
-     Lisp_Object specified_time;
+  (Lisp_Object specified_time)
 {
   time_t value;
   struct tm *tm;
@@ -1950,8 +1900,7 @@ but this is considered obsolete.  */)
 /* Yield A - B, measured in seconds.
    This function is copied from the GNU C Library.  */
 static int
-tm_diff (a, b)
-     struct tm *a, *b;
+tm_diff (struct tm *a, struct tm *b)
 {
   /* Compute intervening leap days correctly even if year is negative.
      Take care to avoid int overflow in leap day calculations,
@@ -1986,8 +1935,7 @@ have the form (HIGH . LOW), but this is considered obsolete.
 Some operating systems cannot provide all this information to Emacs;
 in this case, `current-time-zone' returns a list containing nil for
 the data it can't find.  */)
-     (specified_time)
-     Lisp_Object specified_time;
+  (Lisp_Object specified_time)
 {
   time_t value;
   struct tm *t;
@@ -2051,10 +1999,9 @@ DEFUN ("set-time-zone-rule", Fset_time_zone_rule, Sset_time_zone_rule, 1, 1, 0,
        doc: /* Set the local time zone using TZ, a string specifying a time zone rule.
 If TZ is nil, use implementation-defined default time zone information.
 If TZ is t, use Universal Time.  */)
-     (tz)
-     Lisp_Object tz;
+  (Lisp_Object tz)
 {
-  char *tzstring;
+  const char *tzstring;
 
   /* When called for the first time, save the original TZ.  */
   if (!environbuf)
@@ -2098,8 +2045,7 @@ static char set_time_zone_rule_tz2[] = "TZ=GMT+1";
    responsibility to free.  */
 
 void
-set_time_zone_rule (tzstring)
-     char *tzstring;
+set_time_zone_rule (const char *tzstring)
 {
   int envptrs;
   char **from, **to, **newenv;
@@ -2221,8 +2167,7 @@ general_insert_function (void (*insert_func)
 }
 
 void
-insert1 (arg)
-     Lisp_Object arg;
+insert1 (Lisp_Object arg)
 {
   Finsert (1, &arg);
 }
@@ -2250,9 +2195,7 @@ buffer; to accomplish this, apply `string-as-multibyte' to the string
 and insert the result.
 
 usage: (insert &rest ARGS)  */)
-     (nargs, args)
-     int nargs;
-     register Lisp_Object *args;
+  (int nargs, register Lisp_Object *args)
 {
   general_insert_function (insert, insert_from_string, 0, nargs, args);
   return Qnil;
@@ -2271,9 +2214,7 @@ If the current buffer is unibyte, multibyte strings are converted
 to unibyte for insertion.
 
 usage: (insert-and-inherit &rest ARGS)  */)
-     (nargs, args)
-     int nargs;
-     register Lisp_Object *args;
+  (int nargs, register Lisp_Object *args)
 {
   general_insert_function (insert_and_inherit, insert_from_string, 1,
                           nargs, args);
@@ -2290,9 +2231,7 @@ If the current buffer is unibyte, multibyte strings are converted
 to unibyte for insertion.
 
 usage: (insert-before-markers &rest ARGS)  */)
-     (nargs, args)
-     int nargs;
-     register Lisp_Object *args;
+  (int nargs, register Lisp_Object *args)
 {
   general_insert_function (insert_before_markers,
                           insert_from_string_before_markers, 0,
@@ -2311,9 +2250,7 @@ If the current buffer is unibyte, multibyte strings are converted
 to unibyte for insertion.
 
 usage: (insert-before-markers-and-inherit &rest ARGS)  */)
-     (nargs, args)
-     int nargs;
-     register Lisp_Object *args;
+  (int nargs, register Lisp_Object *args)
 {
   general_insert_function (insert_before_markers_and_inherit,
                           insert_from_string_before_markers, 1,
@@ -2326,8 +2263,7 @@ DEFUN ("insert-char", Finsert_char, Sinsert_char, 2, 3, 0,
 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.  */)
-     (character, count, inherit)
-       Lisp_Object character, count, inherit;
+  (Lisp_Object character, Lisp_Object count, Lisp_Object inherit)
 {
   register unsigned char *string;
   register int strlen;
@@ -2379,8 +2315,7 @@ corresponding eight-bit character is inserted.
 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.  */)
-     (byte, count, inherit)
-       Lisp_Object byte, count, inherit;
+  (Lisp_Object byte, Lisp_Object count, Lisp_Object inherit)
 {
   CHECK_NUMBER (byte);
   if (XINT (byte) < 0 || XINT (byte) > 255)
@@ -2408,9 +2343,7 @@ from adjoining text, if those properties are sticky.  */)
    buffer substrings.  */
 
 Lisp_Object
-make_buffer_string (start, end, props)
-     int start, end;
-     int props;
+make_buffer_string (int start, int end, int props)
 {
   int start_byte = CHAR_TO_BYTE (start);
   int end_byte = CHAR_TO_BYTE (end);
@@ -2434,9 +2367,7 @@ make_buffer_string (start, end, props)
    buffer substrings.  */
 
 Lisp_Object
-make_buffer_string_both (start, start_byte, end, end_byte, props)
-     int start, start_byte, end, end_byte;
-     int props;
+make_buffer_string_both (int start, int start_byte, int end, int end_byte, int props)
 {
   Lisp_Object result, tem, tem1;
 
@@ -2447,8 +2378,7 @@ make_buffer_string_both (start, start_byte, end, end_byte, props)
     result = make_uninit_multibyte_string (end - start, end_byte - start_byte);
   else
     result = make_uninit_string (end - start);
-  bcopy (BYTE_POS_ADDR (start_byte), SDATA (result),
-        end_byte - start_byte);
+  memcpy (SDATA (result), BYTE_POS_ADDR (start_byte), end_byte - start_byte);
 
   /* If desired, update and copy the text properties.  */
   if (props)
@@ -2470,8 +2400,7 @@ make_buffer_string_both (start, start_byte, end, end_byte, props)
    in the current buffer, if necessary.  */
 
 static void
-update_buffer_properties (start, end)
-     int start, end;
+update_buffer_properties (int start, int end)
 {
   /* If this buffer has some access functions,
      call them, specifying the range of the buffer being accessed.  */
@@ -2508,8 +2437,7 @@ The string returned is multibyte if the buffer is multibyte.
 This function copies the text properties of that part of the buffer
 into the result string; if you don't want the text properties,
 use `buffer-substring-no-properties' instead.  */)
-     (start, end)
-     Lisp_Object start, end;
+  (Lisp_Object start, Lisp_Object end)
 {
   register int b, e;
 
@@ -2525,8 +2453,7 @@ DEFUN ("buffer-substring-no-properties", Fbuffer_substring_no_properties,
        doc: /* Return the characters of part of the buffer, without the text properties.
 The two arguments START and END are character positions;
 they can be in either order.  */)
-     (start, end)
-     Lisp_Object start, end;
+  (Lisp_Object start, Lisp_Object end)
 {
   register int b, e;
 
@@ -2541,7 +2468,7 @@ DEFUN ("buffer-string", Fbuffer_string, Sbuffer_string, 0, 0, 0,
        doc: /* Return the contents of the current buffer as a string.
 If narrowing is in effect, this function returns only the visible part
 of the buffer.  */)
-     ()
+  (void)
 {
   return make_buffer_string (BEGV, ZV, 1);
 }
@@ -2552,8 +2479,7 @@ DEFUN ("insert-buffer-substring", Finsert_buffer_substring, Sinsert_buffer_subst
 BUFFER may be a buffer or a buffer name.
 Arguments START and END are character positions specifying the substring.
 They default to the values of (point-min) and (point-max) in BUFFER.  */)
-     (buffer, start, end)
-     Lisp_Object buffer, start, end;
+  (Lisp_Object buffer, Lisp_Object start, Lisp_Object end)
 {
   register int b, e, temp;
   register struct buffer *bp, *obuf;
@@ -2606,8 +2532,7 @@ That makes six args in all, three for each substring.
 
 The value of `case-fold-search' in the current buffer
 determines whether case is significant or ignored.  */)
-     (buffer1, start1, end1, buffer2, start2, end2)
-     Lisp_Object buffer1, start1, end1, buffer2, start2, end2;
+  (Lisp_Object buffer1, Lisp_Object start1, Lisp_Object end1, Lisp_Object buffer2, Lisp_Object start2, Lisp_Object end2)
 {
   register int begp1, endp1, begp2, endp2, temp;
   register struct buffer *bp1, *bp2;
@@ -2757,15 +2682,13 @@ determines whether case is significant or ignored.  */)
 }
 \f
 static Lisp_Object
-subst_char_in_region_unwind (arg)
-     Lisp_Object arg;
+subst_char_in_region_unwind (Lisp_Object arg)
 {
   return current_buffer->undo_list = arg;
 }
 
 static Lisp_Object
-subst_char_in_region_unwind_1 (arg)
-     Lisp_Object arg;
+subst_char_in_region_unwind_1 (Lisp_Object arg)
 {
   return current_buffer->filename = arg;
 }
@@ -2776,8 +2699,7 @@ DEFUN ("subst-char-in-region", Fsubst_char_in_region,
 If optional arg NOUNDO is non-nil, don't record this change for undo
 and don't mark the buffer as really changed.
 Both characters must have the same length of multi-byte form.  */)
-     (start, end, fromchar, tochar, noundo)
-     Lisp_Object start, end, fromchar, tochar, noundo;
+  (Lisp_Object start, Lisp_Object end, Lisp_Object fromchar, Lisp_Object tochar, Lisp_Object noundo)
 {
   register int pos, pos_byte, stop, i, len, end_byte;
   /* Keep track of the first change in the buffer:
@@ -2953,7 +2875,7 @@ Both characters must have the same length of multi-byte form.  */)
 }
 
 
-static Lisp_Object check_translation P_ ((int, int, int, Lisp_Object));
+static Lisp_Object check_translation (int, int, int, Lisp_Object);
 
 /* Helper function for Ftranslate_region_internal.
 
@@ -2962,9 +2884,7 @@ static Lisp_Object check_translation P_ ((int, int, int, Lisp_Object));
    element is found, return it.  Otherwise return Qnil.  */
 
 static Lisp_Object
-check_translation (pos, pos_byte, end, val)
-     int pos, pos_byte, end;
-     Lisp_Object val;
+check_translation (int pos, int pos_byte, int end, Lisp_Object val)
 {
   int buf_size = 16, buf_used = 0;
   int *buf = alloca (sizeof (int) * buf_size);
@@ -3020,10 +2940,7 @@ From START to END, translate characters according to TABLE.
 TABLE is a string or a char-table; the Nth character in it is the
 mapping for the character with code N.
 It returns the number of characters changed.  */)
-     (start, end, table)
-     Lisp_Object start;
-     Lisp_Object end;
-     register Lisp_Object table;
+  (Lisp_Object start, Lisp_Object end, register Lisp_Object table)
 {
   register unsigned char *tt;  /* Trans table. */
   register int nc;             /* New character. */
@@ -3189,8 +3106,7 @@ DEFUN ("delete-region", Fdelete_region, Sdelete_region, 2, 2, "r",
 
 When called from a program, expects two arguments,
 positions (integers or markers) specifying the stretch to be deleted.  */)
-     (start, end)
-     Lisp_Object start, end;
+  (Lisp_Object start, Lisp_Object end)
 {
   validate_region (&start, &end);
   del_range (XINT (start), XINT (end));
@@ -3200,8 +3116,7 @@ positions (integers or markers) specifying the stretch to be deleted.  */)
 DEFUN ("delete-and-extract-region", Fdelete_and_extract_region,
        Sdelete_and_extract_region, 2, 2, 0,
        doc: /* Delete the text between START and END and return it.  */)
-     (start, end)
-     Lisp_Object start, end;
+  (Lisp_Object start, Lisp_Object end)
 {
   validate_region (&start, &end);
   if (XINT (start) == XINT (end))
@@ -3212,7 +3127,7 @@ DEFUN ("delete-and-extract-region", Fdelete_and_extract_region,
 DEFUN ("widen", Fwiden, Swiden, 0, 0, "",
        doc: /* Remove restrictions (narrowing) from current buffer.
 This allows the buffer's full text to be seen and edited.  */)
-     ()
+  (void)
 {
   if (BEG != BEGV || Z != ZV)
     current_buffer->clip_changed = 1;
@@ -3233,8 +3148,7 @@ See also `save-restriction'.
 
 When calling from a program, pass two arguments; positions (integers
 or markers) bounding the text that should remain visible.  */)
-     (start, end)
-     register Lisp_Object start, end;
+  (register Lisp_Object start, Lisp_Object end)
 {
   CHECK_NUMBER_COERCE_MARKER (start);
   CHECK_NUMBER_COERCE_MARKER (end);
@@ -3263,7 +3177,7 @@ or markers) bounding the text that should remain visible.  */)
 }
 
 Lisp_Object
-save_restriction_save ()
+save_restriction_save (void)
 {
   if (BEGV == BEG && ZV == Z)
     /* The common case that the buffer isn't narrowed.
@@ -3287,8 +3201,7 @@ save_restriction_save ()
 }
 
 Lisp_Object
-save_restriction_restore (data)
-     Lisp_Object data;
+save_restriction_restore (Lisp_Object data)
 {
   struct buffer *cur = NULL;
   struct buffer *buf = (CONSP (data)
@@ -3368,8 +3281,7 @@ use `save-excursion' outermost:
     (save-excursion (save-restriction ...))
 
 usage: (save-restriction &rest BODY)  */)
-     (body)
-     Lisp_Object body;
+  (Lisp_Object body)
 {
   register Lisp_Object val;
   int count = SPECPDL_INDEX ();
@@ -3402,9 +3314,7 @@ any existing message; this lets the minibuffer contents show.  See
 also `current-message'.
 
 usage: (message FORMAT-STRING &rest ARGS)  */)
-     (nargs, args)
-     int nargs;
-     Lisp_Object *args;
+  (int nargs, Lisp_Object *args)
 {
   if (NILP (args[0])
       || (STRINGP (args[0])
@@ -3432,9 +3342,7 @@ If the first argument is nil or the empty string, clear any existing
 message; let the minibuffer contents show.
 
 usage: (message-box FORMAT-STRING &rest ARGS)  */)
-     (nargs, args)
-     int nargs;
-     Lisp_Object *args;
+  (int nargs, Lisp_Object *args)
 {
   if (NILP (args[0]))
     {
@@ -3472,15 +3380,12 @@ usage: (message-box FORMAT-STRING &rest ARGS)  */)
          message_length = SBYTES (val);
          message_text = (char *)xrealloc (message_text, message_length);
        }
-      bcopy (SDATA (val), message_text, SBYTES (val));
+      memcpy (message_text, SDATA (val), SBYTES (val));
       message2 (message_text, SBYTES (val),
                STRING_MULTIBYTE (val));
       return val;
     }
 }
-#ifdef HAVE_MENUS
-extern Lisp_Object last_nonmenu_event;
-#endif
 
 DEFUN ("message-or-box", Fmessage_or_box, Smessage_or_box, 1, MANY, 0,
        doc: /* Display a message in a dialog box or in the echo area.
@@ -3494,9 +3399,7 @@ If the first argument is nil or the empty string, clear any existing
 message; let the minibuffer contents show.
 
 usage: (message-or-box FORMAT-STRING &rest ARGS)  */)
-     (nargs, args)
-     int nargs;
-     Lisp_Object *args;
+  (int nargs, Lisp_Object *args)
 {
 #ifdef HAVE_MENUS
   if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event))
@@ -3508,7 +3411,7 @@ usage: (message-or-box FORMAT-STRING &rest ARGS)  */)
 
 DEFUN ("current-message", Fcurrent_message, Scurrent_message, 0, 0, 0,
        doc: /* Return the string currently displayed in the echo area, or nil if none.  */)
-     ()
+  (void)
 {
   return current_message ();
 }
@@ -3520,9 +3423,7 @@ First argument is the string to copy.
 Remaining arguments form a sequence of PROPERTY VALUE pairs for text
 properties to add to the result.
 usage: (propertize STRING &rest PROPERTIES)  */)
-     (nargs, args)
-     int nargs;
-     Lisp_Object *args;
+  (int nargs, Lisp_Object *args)
 {
   Lisp_Object properties, string;
   struct gcpro gcpro1, gcpro2;
@@ -3604,9 +3505,7 @@ decimal point itself is omitted.  For %s and %S, the precision
 specifier truncates the string to the given width.
 
 usage: (format STRING &rest OBJECTS)  */)
-     (nargs, args)
-     int nargs;
-     register Lisp_Object *args;
+  (int nargs, register Lisp_Object *args)
 {
   register int n;              /* The number of the next arg to substitute */
   register int total;          /* An estimate of the final length */
@@ -3627,7 +3526,7 @@ usage: (format STRING &rest OBJECTS)  */)
      string itself, will not be used.  Element NARGS, corresponding to
      no argument, *will* be assigned to in the case that a `%' and `.'
      occur after the final format specifier.  */
-  int *precision = (int *) (alloca((nargs + 1) * sizeof (int)));
+  int *precision = (int *) (alloca ((nargs + 1) * sizeof (int)));
   int longest_format;
   Lisp_Object val;
   int arg_intervals = 0;
@@ -3689,12 +3588,12 @@ usage: (format STRING &rest OBJECTS)  */)
     int i;
     if (!info)
       info = (struct info *) alloca (nbytes);
-    bzero (info, nbytes);
+    memset (info, 0, nbytes);
     for (i = 0; i <= nargs; i++)
       info[i].start = -1;
     if (!discarded)
       SAFE_ALLOCA (discarded, char *, SBYTES (args[0]));
-    bzero (discarded, SBYTES (args[0]));
+    memset (discarded, 0, SBYTES (args[0]));
   }
 
   /* Add to TOTAL enough space to hold the converted arguments.  */
@@ -3798,7 +3697,7 @@ usage: (format STRING &rest OBJECTS)  */)
               string will finally appear (Bug#5710). */
            actual_width = lisp_string_width (args[n], -1, NULL, NULL);
            if (precision[n] != -1)
-             actual_width = min(actual_width,precision[n]);
+             actual_width = min (actual_width, precision[n]);
          }
        /* Would get MPV otherwise, since Lisp_Int's `point' to low memory.  */
        else if (INTEGERP (args[n]) && *format != 's')
@@ -3911,7 +3810,7 @@ usage: (format STRING &rest OBJECTS)  */)
          discarded[format - format_start] = 1;
          format++;
 
-         while (index("-+0# ", *format))
+         while (strchr ("-+0# ", *format))
            {
              if (*format == '-')
                {
@@ -4008,8 +3907,8 @@ usage: (format STRING &rest OBJECTS)  */)
            {
              int this_nchars;
 
-             bcopy (this_format_start, this_format,
-                    format - this_format_start);
+             memcpy (this_format, this_format_start,
+                     format - this_format_start);
              this_format[format - this_format_start] = 0;
 
              if (format[-1] == 'e' || format[-1] == 'f' || format[-1] == 'g')
@@ -4209,9 +4108,7 @@ usage: (format STRING &rest OBJECTS)  */)
 }
 
 Lisp_Object
-format2 (string1, arg0, arg1)
-     char *string1;
-     Lisp_Object arg0, arg1;
+format2 (const char *string1, Lisp_Object arg0, Lisp_Object arg1)
 {
   Lisp_Object args[3];
   args[0] = build_string (string1);
@@ -4224,8 +4121,7 @@ DEFUN ("char-equal", Fchar_equal, Schar_equal, 2, 2, 0,
        doc: /* Return t if two characters match, optionally ignoring case.
 Both arguments must be characters (i.e. integers).
 Case is ignored if `case-fold-search' is non-nil in the current buffer.  */)
-     (c1, c2)
-     register Lisp_Object c1, c2;
+  (register Lisp_Object c1, Lisp_Object c2)
 {
   int i1, i2;
   /* Check they're chars, not just integers, otherwise we could get array
@@ -4274,10 +4170,9 @@ 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 (start1, end1, start2, end2,
-                  start1_byte, end1_byte, start2_byte, end2_byte)
-     register int start1, end1, start2, end2;
-     register int start1_byte, end1_byte, start2_byte, end2_byte;
+transpose_markers (int start1, int end1, int start2, int end2,
+                  int start1_byte, int end1_byte,
+                  int start2_byte, int end2_byte)
 {
   register int amt1, amt1_byte, amt2, amt2_byte, diff, diff_byte, mpos;
   register struct Lisp_Marker *marker;
@@ -4351,8 +4246,7 @@ Optional fifth arg LEAVE-MARKERS, if non-nil, means don't update
 any markers that happen to be located in the regions.
 
 Transposing beyond buffer boundaries is an error.  */)
-     (startr1, endr1, startr2, endr2, leave_markers)
-     Lisp_Object startr1, endr1, startr2, endr2, leave_markers;
+  (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;
@@ -4488,9 +4382,9 @@ Transposing beyond buffer boundaries is an error.  */)
          start1_addr = BYTE_POS_ADDR (start1_byte);
          start2_addr = BYTE_POS_ADDR (start2_byte);
 
-          bcopy (start2_addr, temp, len2_byte);
-          bcopy (start1_addr, start1_addr + len2_byte, len1_byte);
-          bcopy (temp, start1_addr, len2_byte);
+          memcpy (temp, start2_addr, len2_byte);
+          memcpy (start1_addr + len2_byte, start1_addr, len1_byte);
+          memcpy (start1_addr, temp, len2_byte);
          SAFE_FREE ();
         }
       else
@@ -4501,9 +4395,9 @@ Transposing beyond buffer boundaries is an error.  */)
          SAFE_ALLOCA (temp, unsigned char *, len1_byte);
          start1_addr = BYTE_POS_ADDR (start1_byte);
          start2_addr = BYTE_POS_ADDR (start2_byte);
-          bcopy (start1_addr, temp, len1_byte);
-          bcopy (start2_addr, start1_addr, len2_byte);
-          bcopy (temp, start1_addr + len2_byte, len1_byte);
+          memcpy (temp, start1_addr, len1_byte);
+          memcpy (start1_addr, start2_addr, len2_byte);
+          memcpy (start1_addr + len2_byte, temp, len1_byte);
          SAFE_FREE ();
         }
       graft_intervals_into_buffer (tmp_interval1, start1 + len2,
@@ -4541,9 +4435,9 @@ Transposing beyond buffer boundaries is an error.  */)
          SAFE_ALLOCA (temp, unsigned char *, len1_byte);
          start1_addr = BYTE_POS_ADDR (start1_byte);
          start2_addr = BYTE_POS_ADDR (start2_byte);
-          bcopy (start1_addr, temp, len1_byte);
-          bcopy (start2_addr, start1_addr, len2_byte);
-          bcopy (temp, start2_addr, len1_byte);
+          memcpy (temp, start1_addr, len1_byte);
+          memcpy (start1_addr, start2_addr, len2_byte);
+          memcpy (start2_addr, temp, len1_byte);
          SAFE_FREE ();
 
           graft_intervals_into_buffer (tmp_interval1, start2,
@@ -4571,10 +4465,10 @@ Transposing beyond buffer boundaries is an error.  */)
          SAFE_ALLOCA (temp, unsigned char *, len2_byte);
          start1_addr = BYTE_POS_ADDR (start1_byte);
          start2_addr = BYTE_POS_ADDR (start2_byte);
-          bcopy (start2_addr, temp, len2_byte);
-          bcopy (start1_addr, start1_addr + len_mid + len2_byte, len1_byte);
-          safe_bcopy (start1_addr + len1_byte, start1_addr + len2_byte, len_mid);
-          bcopy (temp, start1_addr, len2_byte);
+          memcpy (temp, start2_addr, len2_byte);
+          memcpy (start1_addr + len_mid + len2_byte, start1_addr, len1_byte);
+          memmove (start1_addr + len2_byte, start1_addr + len1_byte, len_mid);
+          memcpy (start1_addr, temp, len2_byte);
          SAFE_FREE ();
 
           graft_intervals_into_buffer (tmp_interval1, end2 - len1,
@@ -4604,10 +4498,10 @@ Transposing beyond buffer boundaries is an error.  */)
          SAFE_ALLOCA (temp, unsigned char *, len1_byte);
          start1_addr = BYTE_POS_ADDR (start1_byte);
          start2_addr = BYTE_POS_ADDR (start2_byte);
-          bcopy (start1_addr, temp, len1_byte);
-          bcopy (start2_addr, start1_addr, len2_byte);
-          bcopy (start1_addr + len1_byte, start1_addr + len2_byte, len_mid);
-          bcopy (temp, start1_addr + len2_byte + len_mid, len1_byte);
+          memcpy (temp, start1_addr, len1_byte);
+          memcpy (start1_addr, start2_addr, len2_byte);
+          memcpy (start1_addr + len2_byte, start1_addr + len1_byte, len_mid);
+          memcpy (start1_addr + len2_byte + len_mid, temp, len1_byte);
          SAFE_FREE ();
 
           graft_intervals_into_buffer (tmp_interval1, end2 - len1,
@@ -4639,7 +4533,7 @@ Transposing beyond buffer boundaries is an error.  */)
 
 \f
 void
-syms_of_editfns ()
+syms_of_editfns (void)
 {
   environbuf = 0;
   initial_tz = 0;
@@ -4661,7 +4555,6 @@ of the buffer being accessed.  */);
 
   {
     Lisp_Object obuf;
-    extern Lisp_Object Vprin1_to_string_buffer;
     obuf = Fcurrent_buffer ();
     /* Do this here, because init_buffer_once is too early--it won't work.  */
     Fset_buffer (Vprin1_to_string_buffer);
index 42c7d80bbe01145a5fd831abe03e51cc55baa432..82f0a6e701c4543be6a3bfed27c625b28e8ab2e5 100644 (file)
@@ -23,7 +23,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Note that the GTK port uses gdk to display the icon, so Emacs need
    not have XPM support compiled in.  */
 #if (defined (HAVE_XPM) && defined (HAVE_X_WINDOWS)) || defined (USE_GTK)
-static char * gnu_xpm_bits[] = {
+static const char * gnu_xpm_bits[] = {
 /* width height ncolors chars_per_pixel */
 "32 32 255 2",
 /* colors */
index 71ffa998bfe9bc648994f866620bd985fb62e902..397d3d9ad273ad34545bbf26a23a591791649c63 100644 (file)
@@ -32,7 +32,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <unistd.h>
 #endif
 
-#ifdef BSD_SYSTEM
+#ifdef HAVE_SYS_IOCTL_H
 #include <sys/ioctl.h>
 #endif
 
@@ -63,6 +63,10 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "keyboard.h"
 #include "keymap.h"
 
+#ifdef HAVE_NS
+#include "nsterm.h"
+#endif
+
 #ifdef HAVE_SETLOCALE
 #include <locale.h>
 #endif
@@ -81,17 +85,16 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #endif
 
 #ifdef HAVE_SETPGID
-#if !defined (USG) || defined (BSD_PGRPS)
+#if !defined (USG)
 #undef setpgrp
 #define setpgrp setpgid
 #endif
 #endif
 
-extern void malloc_warning P_ ((char *));
-extern void set_time_zone_rule P_ ((char *));
-#ifdef HAVE_INDEX
-extern char *index P_ ((const char *, int));
-#endif
+/* If you change the following line, remember to update
+   msdos/mainmake.v2 which gleans the Emacs version from it!  */
+static const char emacs_copyright[] = "Copyright (C) 2010 Free Software Foundation, Inc.";
+static const char emacs_version[] = "24.0.50";
 
 /* Make these values available in GDB, which doesn't see macros.  */
 
@@ -154,9 +157,9 @@ int initialized;
    static data inside glibc's malloc.  */
 void *malloc_state_ptr;
 /* From glibc, a routine that returns a copy of the malloc internal state.  */
-extern void *malloc_get_state ();
+extern void *malloc_get_state (void);
 /* From glibc, a routine that overwrites the malloc internal state.  */
-extern int malloc_set_state ();
+extern int malloc_set_state (void*);
 /* Non-zero if the MALLOC_CHECK_ environment variable was set while
    dumping.  Used to work around a bug in glibc's malloc.  */
 int malloc_using_checking;
@@ -180,6 +183,10 @@ Lisp_Object Vprevious_system_messages_locale;
 Lisp_Object Vsystem_time_locale;
 Lisp_Object Vprevious_system_time_locale;
 
+/* Copyright and version info.  The version number may be updated by
+   Lisp code.  */
+Lisp_Object Vemacs_copyright, Vemacs_version;
+
 /* If non-zero, emacs should not attempt to use a window-specific code,
    but instead should use the virtual terminal under which it was started.  */
 int inhibit_window_system;
@@ -193,11 +200,6 @@ EMACS_INT emacs_priority;
    data on the first attempt to change it inside asynchronous code.  */
 int running_asynch_code;
 
-#ifdef BSD_PGRPS
-/* See sysdep.c.  */
-extern int inherited_pgroup;
-#endif
-
 #if defined(HAVE_X_WINDOWS) || defined(HAVE_NS)
 /* If non-zero, -d was specified, meaning we're using some window system.  */
 int display_arg;
@@ -217,15 +219,6 @@ static unsigned long heap_bss_diff;
    output a warning in dump-emacs.  */
 #define MAX_HEAP_BSS_DIFF (1024*1024)
 
-
-#ifdef HAVE_WINDOW_SYSTEM
-extern Lisp_Object Vinitial_window_system;
-#endif /* HAVE_WINDOW_SYSTEM */
-
-extern Lisp_Object Vauto_save_list_file_name;
-
-extern Lisp_Object Vinhibit_redisplay;
-
 /* Nonzero means running Emacs without interactive terminal.  */
 
 int noninteractive;
@@ -250,8 +243,8 @@ int daemon_pipe[2];
 char **initial_argv;
 int initial_argc;
 
-static void sort_args ();
-void syms_of_emacs ();
+static void sort_args (int argc, char **argv);
+void syms_of_emacs (void);
 
 /* MSVC needs each string be shorter than 2048 bytes, so the usage
    strings below are split to not overflow this limit.  */
@@ -268,6 +261,7 @@ read the main documentation for these command-line arguments.\n\
 Initialization options:\n\
 \n\
 --batch                     do not do interactive display; implies -q\n\
+--chdir DIR                 change to directory DIR\n\
 --daemon                    start a server in the background\n\
 --debug-init                enable Emacs Lisp debugger for init file\n\
 --display, -d DISPLAY       use X server DISPLAY\n\
@@ -345,7 +339,7 @@ abbreviation for a --option.\n\
 Various environment variables and window system resources also affect\n\
 Emacs' operation.  See the main documentation.\n\
 \n\
-Report bugs to %s.  First, please see the Bugs\n\
+Report bugs to bug-gnu-emacs@gnu.org.  First, please see the Bugs\n\
 section of the Emacs manual or the file BUGS.\n"
 
 \f
@@ -358,7 +352,7 @@ int fatal_error_in_progress;
 /* If non-null, call this function from fatal_error_signal before
    committing suicide.  */
 
-void (*fatal_error_signal_hook) P_ ((void));
+void (*fatal_error_signal_hook) (void);
 
 #ifdef FORWARD_SIGNAL_TO_MAIN_THREAD
 /* When compiled with GTK and running under Gnome,
@@ -371,8 +365,7 @@ pthread_t main_thread;
 
 /* Handle bus errors, invalid instruction, etc.  */
 SIGTYPE
-fatal_error_signal (sig)
-     int sig;
+fatal_error_signal (int sig)
 {
   SIGNAL_THREAD_CHECK (sig);
   fatal_error_code = sig;
@@ -385,6 +378,9 @@ fatal_error_signal (sig)
     {
       fatal_error_in_progress = 1;
 
+      if (sig == SIGTERM || sig == SIGHUP)
+        Fkill_emacs (make_number (sig));
+
       shut_down_emacs (sig, 0, Qnil);
     }
 
@@ -426,7 +422,7 @@ memory_warning_signal (sig)
 #if ! defined (DOS_NT) && ! defined (NO_ABORT)
 
 void
-abort ()
+abort (void)
 {
   kill (getpid (), SIGABRT);
   /* This shouldn't be executed, but it prevents a warning.  */
@@ -438,10 +434,7 @@ abort ()
 /* Code for dealing with Lisp access to the Unix command line.  */
 
 static void
-init_cmdargs (argc, argv, skip_args)
-     int argc;
-     char **argv;
-     int skip_args;
+init_cmdargs (int argc, char **argv, int skip_args)
 {
   register int i;
   Lisp_Object name, dir, tem;
@@ -583,7 +576,7 @@ init_cmdargs (argc, argv, skip_args)
 DEFUN ("invocation-name", Finvocation_name, Sinvocation_name, 0, 0, 0,
        doc: /* Return the program name that was used to run Emacs.
 Any directory names are omitted.  */)
-     ()
+  (void)
 {
   return Fcopy_sequence (Vinvocation_name);
 }
@@ -591,7 +584,7 @@ Any directory names are omitted.  */)
 DEFUN ("invocation-directory", Finvocation_directory, Sinvocation_directory,
        0, 0, 0,
        doc: /* Return the directory name in which the Emacs executable was located.  */)
-     ()
+  (void)
 {
   return Fcopy_sequence (Vinvocation_directory);
 }
@@ -610,11 +603,11 @@ static char dump_tz[] = "UtC0";
    (We don't have any real constructors or destructors.)  */
 #ifdef __GNUC__
 #ifndef GCC_CTORS_IN_LIBC
-void __do_global_ctors ()
+void __do_global_ctors (void)
 {}
-void __do_global_ctors_aux ()
+void __do_global_ctors_aux (void)
 {}
-void __do_global_dtors ()
+void __do_global_dtors (void)
 {}
 /* GNU/Linux has a bug in its library; avoid an error.  */
 #ifndef GNU_LINUX
@@ -622,7 +615,7 @@ char * __CTOR_LIST__[2] = { (char *) (-1), 0 };
 #endif
 char * __DTOR_LIST__[2] = { (char *) (-1), 0 };
 #endif /* GCC_CTORS_IN_LIBC */
-void __main ()
+void __main (void)
 {}
 #endif /* __GNUC__ */
 #endif /* ORDINARY_LINK */
@@ -638,14 +631,7 @@ void __main ()
    enough information to do it right.  */
 
 static int
-argmatch (argv, argc, sstr, lstr, minlen, valptr, skipptr)
-     char **argv;
-     int argc;
-     char *sstr;
-     char *lstr;
-     int minlen;
-     char **valptr;
-     int *skipptr;
+argmatch (char **argv, int argc, const char *sstr, const char *lstr, int minlen, char **valptr, int *skipptr)
 {
   char *p = NULL;
   int arglen;
@@ -669,7 +655,7 @@ argmatch (argv, argc, sstr, lstr, minlen, valptr, skipptr)
        *skipptr += 1;
       return 1;
     }
-  arglen = (valptr != NULL && (p = index (arg, '=')) != NULL
+  arglen = (valptr != NULL && (p = strchr (arg, '=')) != NULL
            ? p - arg : strlen (arg));
   if (lstr == 0 || arglen < minlen || strncmp (arg, lstr, arglen) != 0)
     return 0;
@@ -703,7 +689,7 @@ argmatch (argv, argc, sstr, lstr, minlen, valptr, skipptr)
    possible using this special hook.  */
 
 static void
-malloc_initialize_hook ()
+malloc_initialize_hook (void)
 {
 #ifndef USE_CRT_DLL
   extern char **environ;
@@ -741,46 +727,11 @@ malloc_initialize_hook ()
     }
 }
 
-void (*__malloc_initialize_hook) () = malloc_initialize_hook;
+void (*__malloc_initialize_hook) (void) = malloc_initialize_hook;
 
 #endif /* DOUG_LEA_MALLOC */
 
 
-#define REPORT_EMACS_BUG_ADDRESS "bug-gnu-emacs@gnu.org"
-#define REPORT_EMACS_BUG_PRETEST_ADDRESS "bug-gnu-emacs@gnu.org"
-
-/* This function is used to determine an address to which bug report should
-   be sent.  */
-
-char *
-bug_reporting_address ()
-{
-  int count = 0;
-  Lisp_Object temp;
-  char *string;
-
-  temp = Fsymbol_value (intern ("emacs-version"));
-
-  /* When `emacs-version' is invalid, use normal address.  */
-  if (!STRINGP(temp))
-    return REPORT_EMACS_BUG_ADDRESS;
-
-  string = SDATA (temp);
-
-  /* Count dots in `emacs-version'.  */
-  while (*string)
-    {
-      if (*string == '.')
-       count++;
-      string++;
-    }
-
-  /* When `emacs-version' has at least three dots, it is development or
-     pretest version of Emacs.  */
-  return count >= 3 ? REPORT_EMACS_BUG_PRETEST_ADDRESS : REPORT_EMACS_BUG_ADDRESS;
-}
-
-
 /* ARGSUSED */
 int
 main (int argc, char **argv)
@@ -791,9 +742,6 @@ main (int argc, char **argv)
   char stack_bottom_variable;
   int do_initial_setlocale;
   int skip_args = 0;
-#ifndef USE_CRT_DLL
-  extern int errno;
-#endif
 #ifdef HAVE_SETRLIMIT
   struct rlimit rlim;
 #endif
@@ -803,9 +751,9 @@ main (int argc, char **argv)
 #ifdef NS_IMPL_COCOA
   char dname_arg2[80];
 #endif
+  char *ch_to_dir;
 
 #if GC_MARK_STACK
-  extern Lisp_Object *stack_base;
   stack_base = &dummy;
 #endif
 
@@ -825,11 +773,6 @@ main (int argc, char **argv)
       heap_bss_diff = (char *)my_heap_start - max (my_endbss, my_endbss_static);
     }
 
-#ifdef LINUX_SBRK_BUG
-  /* This is only used GNU/LINUX running on alpha when using libc5 */
-  __sbrk (1);
-#endif
-
 #ifdef RUN_TIME_REMAP
   if (initialized)
     run_time_remap (argv[0]);
@@ -845,36 +788,52 @@ main (int argc, char **argv)
   argc = 0;
   while (argv[argc]) argc++;
 
-  if (argmatch (argv, argc, "-version", "--version", 3, NULL, &skip_args)
-      /* We don't know the version number unless this is a dumped Emacs.
-         So ignore --version otherwise.  */
-      && initialized)
+  if (argmatch (argv, argc, "-version", "--version", 3, NULL, &skip_args))
     {
-      Lisp_Object tem, tem2;
-      tem = Fsymbol_value (intern_c_string ("emacs-version"));
-      tem2 = Fsymbol_value (intern_c_string ("emacs-copyright"));
-      if (!STRINGP (tem))
-       {
-         fprintf (stderr, "Invalid value of `emacs-version'\n");
-         exit (1);
-       }
-      if (!STRINGP (tem2))
+      const char *version, *copyright;
+      if (initialized)
        {
-         fprintf (stderr, "Invalid value of `emacs-copyright'\n");
-         exit (1);
+         Lisp_Object tem, tem2;
+         tem = Fsymbol_value (intern_c_string ("emacs-version"));
+         tem2 = Fsymbol_value (intern_c_string ("emacs-copyright"));
+         if (!STRINGP (tem))
+           {
+             fprintf (stderr, "Invalid value of `emacs-version'\n");
+             exit (1);
+           }
+         if (!STRINGP (tem2))
+           {
+             fprintf (stderr, "Invalid value of `emacs-copyright'\n");
+             exit (1);
+           }
+         else
+           {
+             version = SDATA (tem);
+             copyright = SDATA (tem2);
+           }
        }
       else
        {
-         printf ("GNU Emacs %s\n", SDATA (tem));
-         printf ("%s\n", SDATA(tem2));
-         printf ("GNU Emacs comes with ABSOLUTELY NO WARRANTY.\n");
-         printf ("You may redistribute copies of Emacs\n");
-         printf ("under the terms of the GNU General Public License.\n");
-         printf ("For more information about these matters, ");
-         printf ("see the file named COPYING.\n");
-         exit (0);
+         version = emacs_version;
+         copyright = emacs_copyright;
        }
+      printf ("GNU Emacs %s\n", version);
+      printf ("%s\n", copyright);
+      printf ("GNU Emacs comes with ABSOLUTELY NO WARRANTY.\n");
+      printf ("You may redistribute copies of Emacs\n");
+      printf ("under the terms of the GNU General Public License.\n");
+      printf ("For more information about these matters, ");
+      printf ("see the file named COPYING.\n");
+      exit (0);
     }
+  if (argmatch (argv, argc, "-chdir", "--chdir", 2, &ch_to_dir, &skip_args))
+      if (chdir (ch_to_dir) == -1)
+        {
+          fprintf (stderr, "%s: Can't chdir to %s: %s\n",
+                   argv[0], ch_to_dir, strerror (errno));
+          exit (1);
+        }
+
 
 #ifdef HAVE_PERSONALITY_LINUX32
   if (!initialized
@@ -882,8 +841,9 @@ main (int argc, char **argv)
           || strcmp (argv[argc-1], "bootstrap") == 0)
       && ! getenv ("EMACS_HEAP_EXEC"))
     {
+      static char heapexec[] = "EMACS_HEAP_EXEC=true";
       /* Set this so we only do this once.  */
-      putenv("EMACS_HEAP_EXEC=true");
+      putenv(heapexec);
 
       /* A flag to turn off address randomization which is introduced
          in linux kernel shipped with fedora core 4 */
@@ -898,23 +858,6 @@ main (int argc, char **argv)
     }
 #endif /* HAVE_PERSONALITY_LINUX32 */
 
-
-/* Map in shared memory, if we are using that.  */
-#ifdef HAVE_SHM
-  if (argmatch (argv, argc, "-nl", "--no-shared-memory", 6, NULL, &skip_args))
-    {
-      map_in_data (0);
-      /* The shared memory was just restored, which clobbered this.  */
-      skip_args = 1;
-    }
-  else
-    {
-      map_in_data (1);
-      /* The shared memory was just restored, which clobbered this.  */
-      skip_args = 0;
-    }
-#endif
-
 #if defined (HAVE_SETRLIMIT) && defined (RLIMIT_STACK)
   /* Extend the stack space available.
      Don't do that if dumping, since some systems (e.g. DJGPP)
@@ -985,7 +928,6 @@ main (int argc, char **argv)
 #endif /* MSDOS || WINDOWSNT */
 
 #ifdef MSDOS
-#if __DJGPP__ >= 2
   if (!isatty (fileno (stdin)))
     setmode (fileno (stdin), O_BINARY);
   if (!isatty (fileno (stdout)))
@@ -993,19 +935,8 @@ main (int argc, char **argv)
       fflush (stdout);
       setmode (fileno (stdout), O_BINARY);
     }
-#else  /* not __DJGPP__ >= 2 */
-  (stdin)->_flag &= ~_IOTEXT;
-  (stdout)->_flag &= ~_IOTEXT;
-  (stderr)->_flag &= ~_IOTEXT;
-#endif /* not __DJGPP__ >= 2 */
 #endif /* MSDOS */
 
-#ifdef SET_EMACS_PRIORITY
-  if (emacs_priority)
-    nice (emacs_priority);
-  setuid (getuid ());
-#endif /* SET_EMACS_PRIORITY */
-
   /* Skip initial setlocale if LC_ALL is "C", as it's not needed in that case.
      The build procedure uses this while dumping, to ensure that the
      dumped Emacs does not have its system locale tables initialized,
@@ -1082,7 +1013,7 @@ main (int argc, char **argv)
     {
       printf (USAGE1, argv[0], USAGE2);
       printf (USAGE3);
-      printf (USAGE4, bug_reporting_address ());
+      printf (USAGE4);
       exit (0);
     }
 
@@ -1223,20 +1154,12 @@ main (int argc, char **argv)
 
   if (! noninteractive)
     {
-#ifdef BSD_PGRPS
-      if (initialized)
-       {
-         inherited_pgroup = EMACS_GETPGRP (0);
-         setpgrp (0, getpid ());
-       }
-#else
 #if defined (USG5) && defined (INTERRUPT_INPUT)
       setpgrp ();
 #endif
-#endif
 #if defined (HAVE_GTK_AND_PTHREAD) && !defined (SYSTEM_MALLOC) && !defined (DOUG_LEA_MALLOC)
       {
-       extern void malloc_enable_thread P_ ((void));
+        extern void malloc_enable_thread (void);
 
        malloc_enable_thread ();
       }
@@ -1333,9 +1256,7 @@ main (int argc, char **argv)
 #ifdef AIX
 /* 20 is SIGCHLD, 21 is SIGTTIN, 22 is SIGTTOU.  */
       signal (SIGXCPU, fatal_error_signal);
-#ifndef _I386
       signal (SIGIOINT, fatal_error_signal);
-#endif
       signal (SIGGRANT, fatal_error_signal);
       signal (SIGRETRACT, fatal_error_signal);
       signal (SIGSOUND, fatal_error_signal);
@@ -1411,68 +1332,6 @@ main (int argc, char **argv)
   init_atimer ();
   running_asynch_code = 0;
 
-  /* Handle --unibyte and the EMACS_UNIBYTE envvar,
-     but not while dumping.  */
-  if (1)
-    {
-      int inhibit_unibyte = 0;
-
-      /* --multibyte overrides EMACS_UNIBYTE.  */
-      if (argmatch (argv, argc, "-no-unibyte", "--no-unibyte", 4, NULL, &skip_args)
-         || argmatch (argv, argc, "-multibyte", "--multibyte", 4, NULL, &skip_args)
-         /* Ignore EMACS_UNIBYTE before dumping.  */
-         || (!initialized && noninteractive))
-       inhibit_unibyte = 1;
-
-      /* --unibyte requests that we set up to do everything with single-byte
-        buffers and strings.  We need to handle this before calling
-        init_lread, init_editfns and other places that generate Lisp strings
-        from text in the environment.  */
-      /* Actually this shouldn't be needed as of 20.4 in a generally
-        unibyte environment.  As handa says, environment values
-        aren't now decoded; also existing buffers are now made
-        unibyte during startup if .emacs sets unibyte.  Tested with
-        8-bit data in environment variables and /etc/passwd, setting
-        unibyte and Latin-1 in .emacs. -- Dave Love  */
-      if (argmatch (argv, argc, "-unibyte", "--unibyte", 4, NULL, &skip_args)
-         || argmatch (argv, argc, "-no-multibyte", "--no-multibyte", 4, NULL, &skip_args)
-         || (getenv ("EMACS_UNIBYTE") && !inhibit_unibyte))
-       {
-         Lisp_Object old_log_max;
-         Lisp_Object symbol, tail;
-
-         symbol = intern_c_string ("enable-multibyte-characters");
-         Fset_default (symbol, Qnil);
-
-         if (initialized)
-           {
-             /* Erase pre-dump messages in *Messages* now so no abort.  */
-             old_log_max = Vmessage_log_max;
-             XSETFASTINT (Vmessage_log_max, 0);
-             message_dolog ("", 0, 1, 0);
-             Vmessage_log_max = old_log_max;
-           }
-
-         for (tail = Vbuffer_alist; CONSP (tail);
-              tail = XCDR (tail))
-           {
-             Lisp_Object buffer;
-
-             buffer = Fcdr (XCAR (tail));
-             /* Make a multibyte buffer unibyte.  */
-             if (BUF_Z_BYTE (XBUFFER (buffer)) > BUF_Z (XBUFFER (buffer)))
-               {
-                 struct buffer *current = current_buffer;
-
-                 set_buffer_temp (XBUFFER (buffer));
-                 Fset_buffer_multibyte (Qnil);
-                 set_buffer_temp (current);
-               }
-           }
-         message ("Warning: unibyte sessions are obsolete and will disappear");
-       }
-    }
-
   no_loadup
     = argmatch (argv, argc, "-nl", "--no-loadup", 6, NULL, &skip_args);
 
@@ -1577,6 +1436,11 @@ main (int argc, char **argv)
     ns_init_paths ();
 #endif
 
+  /* Initialize and GC-protect Vinitial_environment and
+     Vprocess_environment before set_initial_environment fills them
+     in.  */
+  if (!initialized)
+    syms_of_callproc ();
   /* egetenv is a pretty low-level facility, which may get called in
      many circumstances; it seems flimsy to put off initializing it
      until calling init_callproc.  */
@@ -1626,14 +1490,11 @@ main (int argc, char **argv)
       syms_of_callint ();
       syms_of_casefiddle ();
       syms_of_casetab ();
-      syms_of_callproc ();
       syms_of_category ();
       syms_of_ccl ();
       syms_of_character ();
       syms_of_cmds ();
-#ifndef NO_DIR_LIBRARY
       syms_of_dired ();
-#endif /* not NO_DIR_LIBRARY */
       syms_of_display ();
       syms_of_doc ();
       syms_of_editfns ();
@@ -1695,6 +1556,9 @@ main (int argc, char **argv)
 
 #ifdef MSDOS
       syms_of_xmenu ();
+      syms_of_dosfns();
+      syms_of_msdos();
+      syms_of_win16select();
 #endif /* MSDOS */
 
 #ifdef HAVE_NS
@@ -1709,13 +1573,9 @@ main (int argc, char **argv)
       syms_of_dbusbind ();
 #endif /* HAVE_DBUS */
 
-#ifdef SYMS_SYSTEM
-      SYMS_SYSTEM;
-#endif
-
-#ifdef SYMS_MACHINE
-      SYMS_MACHINE;
-#endif
+#ifdef WINDOWSNT
+      syms_of_ntterm ();
+#endif /* WINDOWSNT */
 
       keys_of_casefiddle ();
       keys_of_cmds ();
@@ -1755,7 +1615,7 @@ main (int argc, char **argv)
 #endif
   init_window ();
   init_font ();
-  
+
   if (!initialized)
     {
       char *file;
@@ -1803,15 +1663,26 @@ main (int argc, char **argv)
 #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 ();
-      extern void dump_opcode_frequencies ();
+#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
     }
   else
     moncontrol (0);
@@ -1851,9 +1722,7 @@ struct standard_args
 const struct standard_args standard_args[] =
 {
   { "-version", "--version", 150, 0 },
-#ifdef HAVE_SHM
-  { "-nl", "--no-shared-memory", 140, 0 },
-#endif
+  { "-chdir", "--chdir", 130, 1 },
   { "-t", "--terminal", 120, 1 },
   { "-nw", "--no-window-system", 110, 0 },
   { "-nw", "--no-windows", 110, 0 },
@@ -1861,10 +1730,6 @@ const struct standard_args standard_args[] =
   { "-script", "--script", 100, 1 },
   { "-daemon", "--daemon", 99, 0 },
   { "-help", "--help", 90, 0 },
-  { "-no-unibyte", "--no-unibyte", 83, 0 },
-  { "-multibyte", "--multibyte", 82, 0 },
-  { "-unibyte", "--unibyte", 81, 0 },
-  { "-no-multibyte", "--no-multibyte", 80, 0 },
   { "-nl", "--no-loadup", 70, 0 },
   /* -d must come last before the options handled in startup.el.  */
   { "-d", "--display", 60, 1 },
@@ -1962,9 +1827,7 @@ const struct standard_args standard_args[] =
    than once, eliminate all but one copy of it.  */
 
 static void
-sort_args (argc, argv)
-     int argc;
-     char **argv;
+sort_args (int argc, char **argv)
 {
   char **new = (char **) xmalloc (sizeof (char *) * argc);
   /* For each element of argv,
@@ -2022,7 +1885,7 @@ sort_args (argc, argv)
            {
              match = -1;
              thislen = strlen (argv[from]);
-             equals = index (argv[from], '=');
+             equals = strchr (argv[from], '=');
              if (equals != 0)
                thislen = equals - argv[from];
 
@@ -2105,7 +1968,7 @@ sort_args (argc, argv)
   while (to < argc)
     new[to++] = 0;
 
-  bcopy (new, argv, sizeof (char *) * argc);
+  memcpy (argv, new, sizeof (char *) * argc);
 
   xfree (options);
   xfree (new);
@@ -2120,8 +1983,7 @@ If ARG is a string, stuff it as keyboard input.
 The value of `kill-emacs-hook', if not void,
 is a list of functions (of no args),
 all of which are called before Emacs is actually killed.  */)
-     (arg)
-     Lisp_Object arg;
+  (Lisp_Object arg)
 {
   struct gcpro gcpro1;
 
@@ -2144,8 +2006,6 @@ all of which are called before Emacs is actually killed.  */)
     unlink (SDATA (Vauto_save_list_file_name));
 
   exit (INTEGERP (arg) ? XINT (arg) : EXIT_SUCCESS);
-  /* NOTREACHED */
-  return Qnil;
 }
 
 
@@ -2161,9 +2021,7 @@ all of which are called before Emacs is actually killed.  */)
    and Fkill_emacs.  */
 
 void
-shut_down_emacs (sig, no_x, stuff)
-     int sig, no_x;
-     Lisp_Object stuff;
+shut_down_emacs (int sig, int no_x, Lisp_Object stuff)
 {
   /* Prevent running of hooks from now on.  */
   Vrun_hooks = Qnil;
@@ -2172,7 +2030,7 @@ shut_down_emacs (sig, no_x, stuff)
   Vinhibit_redisplay = Qt;
 
   /* If we are controlling the terminal, reset terminal modes.  */
-#ifdef EMACS_HAVE_TTY_PGRP
+#ifndef DOS_NT
   {
     int pgrp = EMACS_GETPGRP (0);
 
@@ -2192,9 +2050,7 @@ shut_down_emacs (sig, no_x, stuff)
 
   stuff_buffered_input (stuff);
 
-#ifdef subprocesses
   inhibit_sentinels = 1;
-#endif
   kill_buffer_processes (Qnil);
   Fdo_auto_save (Qt, Qnil);
 
@@ -2245,47 +2101,13 @@ shut_down_emacs (sig, no_x, stuff)
 \f
 #ifndef CANNOT_DUMP
 
-#ifdef HAVE_SHM
-
-DEFUN ("dump-emacs-data", Fdump_emacs_data, Sdump_emacs_data, 1, 1, 0,
-       doc: /* Dump current state of Emacs into data file FILENAME.
-This function exists on systems that use HAVE_SHM.  */)
-     (filename)
-     Lisp_Object filename;
-{
-  extern char my_edata[];
-  Lisp_Object tem;
-
-  check_pure_size ();
-  CHECK_STRING (filename);
-  filename = Fexpand_file_name (filename, Qnil);
-
-  tem = Vpurify_flag;
-  Vpurify_flag = Qnil;
-
-  fflush (stdout);
-  /* Tell malloc where start of impure now is.  */
-  /* Also arrange for warnings when nearly out of space.  */
-#ifndef SYSTEM_MALLOC
-  memory_warnings (my_edata, malloc_warning);
-#endif
-  map_out_data (SDATA (filename));
-
-  Vpurify_flag = tem;
-
-  return Qnil;
-}
-
-#else /* not HAVE_SHM */
-
 DEFUN ("dump-emacs", Fdump_emacs, Sdump_emacs, 2, 2, 0,
        doc: /* Dump current state of Emacs into executable file FILENAME.
 Take symbols from SYMFILE (presumably the file you executed to run Emacs).
 This is used in the file `loadup.el' when building Emacs.
 
 You must run Emacs in batch mode in order to dump it.  */)
-     (filename, symfile)
-     Lisp_Object filename, symfile;
+  (Lisp_Object filename, Lisp_Object symfile)
 {
   extern char my_edata[];
   Lisp_Object tem;
@@ -2374,14 +2196,12 @@ You must run Emacs in batch mode in order to dump it.  */)
   return unbind_to (count, Qnil);
 }
 
-#endif /* not HAVE_SHM */
-
 #endif /* not CANNOT_DUMP */
 \f
 #if HAVE_SETLOCALE
 /* Recover from setlocale (LC_ALL, "").  */
 void
-fixup_locale ()
+fixup_locale (void)
 {
   /* The Emacs Lisp reader needs LC_NUMERIC to be "C",
      so that numbers are read and printed properly for Emacs Lisp.  */
@@ -2391,10 +2211,7 @@ fixup_locale ()
 /* Set system locale CATEGORY, with previous locale *PLOCALE, to
    DESIRED_LOCALE.  */
 static void
-synchronize_locale (category, plocale, desired_locale)
-     int category;
-     Lisp_Object *plocale;
-     Lisp_Object desired_locale;
+synchronize_locale (int category, Lisp_Object *plocale, Lisp_Object desired_locale)
 {
   if (! EQ (*plocale, desired_locale))
     {
@@ -2407,7 +2224,7 @@ synchronize_locale (category, plocale, desired_locale)
 
 /* Set system time locale to match Vsystem_time_locale, if possible.  */
 void
-synchronize_system_time_locale ()
+synchronize_system_time_locale (void)
 {
   synchronize_locale (LC_TIME, &Vprevious_system_time_locale,
                      Vsystem_time_locale);
@@ -2416,7 +2233,7 @@ synchronize_system_time_locale ()
 /* Set system messages locale to match Vsystem_messages_locale, if
    possible.  */
 void
-synchronize_system_messages_locale ()
+synchronize_system_messages_locale (void)
 {
 #ifdef LC_MESSAGES
   synchronize_locale (LC_MESSAGES, &Vprevious_system_messages_locale,
@@ -2430,17 +2247,16 @@ synchronize_system_messages_locale ()
 #endif
 
 Lisp_Object
-decode_env_path (evarname, defalt)
-     char *evarname, *defalt;
+decode_env_path (const char *evarname, const char *defalt)
 {
-  register char *path, *p;
+  const char *path, *p;
   Lisp_Object lpath, element, tem;
 
   /* It's okay to use getenv here, because this function is only used
      to initialize variables when Emacs starts up, and isn't called
      after that.  */
   if (evarname != 0)
-    path = (char *) getenv (evarname);
+    path = getenv (evarname);
   else
     path = 0;
   if (!path)
@@ -2449,21 +2265,18 @@ decode_env_path (evarname, defalt)
   /* Ensure values from the environment use the proper directory separator.  */
   if (path)
     {
-      p = alloca (strlen (path) + 1);
-      strcpy (p, path);
-      path = p;
-
-      if ('/' == DIRECTORY_SEP)
-       dostounix_filename (path);
-      else
-       unixtodos_filename (path);
+      char *path_copy = alloca (strlen (path) + 1);
+      strcpy (path_copy, path);
+      dostounix_filename (path_copy);
+      path = path_copy;
     }
 #endif
   lpath = Qnil;
   while (1)
     {
-      p = index (path, SEPCHAR);
-      if (!p) p = path + strlen (path);
+      p = strchr (path, SEPCHAR);
+      if (!p)
+       p = path + strlen (path);
       element = (p - path ? make_string (path, p - path)
                 : build_string ("."));
 
@@ -2496,7 +2309,7 @@ decode_env_path (evarname, defalt)
 DEFUN ("daemonp", Fdaemonp, Sdaemonp, 0, 0, 0,
        doc: /* Return non-nil if the current emacs process is a daemon.
 If the daemon was given a name argument, return that name. */)
-  ()
+  (void)
 {
   if (IS_DAEMON)
     if (daemon_name)
@@ -2511,7 +2324,7 @@ DEFUN ("daemon-initialized", Fdaemon_initialized, Sdaemon_initialized, 0, 0, 0,
        doc: /* Mark the Emacs daemon as being initialized.
 This finishes the daemonization process by doing the other half of detaching
 from the parent process and its tty file descriptors.  */)
-  ()
+  (void)
 {
   int nfd;
 
@@ -2546,17 +2359,13 @@ from the parent process and its tty file descriptors.  */)
 }
 
 void
-syms_of_emacs ()
+syms_of_emacs (void)
 {
   Qfile_name_handler_alist = intern_c_string ("file-name-handler-alist");
   staticpro (&Qfile_name_handler_alist);
 
 #ifndef CANNOT_DUMP
-#ifdef HAVE_SHM
-  defsubr (&Sdump_emacs_data);
-#else
   defsubr (&Sdump_emacs);
-#endif
 #endif
 
   defsubr (&Skill_emacs);
@@ -2669,6 +2478,14 @@ This is nil during initialization.  */);
               doc: /* If non-nil, X resources, Windows Registry settings, and NS defaults are not used.  */);
   inhibit_x_resources = 0;
 
+  DEFVAR_LISP ("emacs-copyright", &Vemacs_copyright,
+              doc: /* Short copyright string for this version of Emacs.  */);
+  Vemacs_copyright = build_string (emacs_copyright);
+
+  DEFVAR_LISP ("emacs-version", &Vemacs_version,
+              doc: /* Version numbers of this version of Emacs.  */);
+  Vemacs_version = build_string (emacs_version);
+
   /* Make sure IS_DAEMON starts up as false.  */
   daemon_pipe[1] = 0;
 }
index 6b74f5b884d1772d75aa12b8edc9c52be75e0bf0..89d353cf7cb8e7017c571079731d87dd72b4bb69 100644 (file)
@@ -1,7 +1,7 @@
 /* Evaluator for GNU Emacs Lisp interpreter.
    Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1999, 2000, 2001,
-                 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
-                 Free Software Foundation, Inc.
+                2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+                Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -26,6 +26,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "commands.h"
 #include "keyboard.h"
 #include "dispextern.h"
+#include "frame.h"             /* For XFRAME.  */
 
 #if HAVE_X_WINDOWS
 #include "xterm.h"
@@ -62,7 +63,6 @@ Lisp_Object Qand_rest, Qand_optional;
 Lisp_Object Qdebug_on_error;
 Lisp_Object Qdeclare;
 Lisp_Object Qdebug;
-extern Lisp_Object Qinteractive_form;
 
 /* This holds either the symbol `run-hooks' or nil.
    It is nil at an early stage of startup, and when Emacs
@@ -165,23 +165,11 @@ int handling_signal;
 
 Lisp_Object Vmacro_declaration_function;
 
-extern Lisp_Object Qrisky_local_variable;
-
-extern Lisp_Object Qfunction;
-
-static Lisp_Object funcall_lambda P_ ((Lisp_Object, int, Lisp_Object*));
-static void unwind_to_catch P_ ((struct catchtag *, Lisp_Object)) NO_RETURN;
-
-#if __GNUC__
-/* "gcc -O3" enables automatic function inlining, which optimizes out
-   the arguments for the invocations of these functions, whereas they
-   expect these values on the stack.  */
-Lisp_Object apply1 () __attribute__((noinline));
-Lisp_Object call2 () __attribute__((noinline));
-#endif
+static Lisp_Object funcall_lambda (Lisp_Object, int, Lisp_Object*);
+static void unwind_to_catch (struct catchtag *, Lisp_Object) NO_RETURN;
 \f
 void
-init_eval_once ()
+init_eval_once (void)
 {
   specpdl_size = 50;
   specpdl = (struct specbinding *) xmalloc (specpdl_size * sizeof (struct specbinding));
@@ -194,7 +182,7 @@ init_eval_once ()
 }
 
 void
-init_eval ()
+init_eval (void)
 {
   specpdl_ptr = specpdl;
   catchlist = 0;
@@ -213,8 +201,7 @@ init_eval ()
 /* unwind-protect function used by call_debugger.  */
 
 static Lisp_Object
-restore_stack_limits (data)
-     Lisp_Object data;
+restore_stack_limits (Lisp_Object data)
 {
   max_specpdl_size = XINT (XCAR (data));
   max_lisp_eval_depth = XINT (XCDR (data));
@@ -224,8 +211,7 @@ restore_stack_limits (data)
 /* Call the Lisp debugger, giving it argument ARG.  */
 
 Lisp_Object
-call_debugger (arg)
-     Lisp_Object arg;
+call_debugger (Lisp_Object arg)
 {
   int debug_while_redisplaying;
   int count = SPECPDL_INDEX ();
@@ -281,8 +267,7 @@ call_debugger (arg)
 }
 
 void
-do_debug_on_call (code)
-     Lisp_Object code;
+do_debug_on_call (Lisp_Object code)
 {
   debug_on_next_call = 0;
   backtrace_list->debug_on_exit = 1;
@@ -298,8 +283,7 @@ DEFUN ("or", For, Sor, 0, UNEVALLED, 0,
 The remaining args are not evalled at all.
 If all args return nil, return nil.
 usage: (or CONDITIONS...)  */)
-     (args)
-     Lisp_Object args;
+  (Lisp_Object args)
 {
   register Lisp_Object val = Qnil;
   struct gcpro gcpro1;
@@ -323,8 +307,7 @@ DEFUN ("and", Fand, Sand, 0, UNEVALLED, 0,
 The remaining args are not evalled at all.
 If no arg yields nil, return the last arg's value.
 usage: (and CONDITIONS...)  */)
-     (args)
-     Lisp_Object args;
+  (Lisp_Object args)
 {
   register Lisp_Object val = Qt;
   struct gcpro gcpro1;
@@ -349,8 +332,7 @@ Returns the value of THEN or the value of the last of the ELSE's.
 THEN must be one expression, but ELSE... can be zero or more expressions.
 If COND yields nil, and there are no ELSE's, the value is nil.
 usage: (if COND THEN ELSE...)  */)
-     (args)
-     Lisp_Object args;
+  (Lisp_Object args)
 {
   register Lisp_Object cond;
   struct gcpro gcpro1;
@@ -374,8 +356,7 @@ If no clause succeeds, cond returns nil.
 If a clause has one element, as in (CONDITION),
 CONDITION's value if non-nil is returned from the cond-form.
 usage: (cond CLAUSES...)  */)
-     (args)
-     Lisp_Object args;
+  (Lisp_Object args)
 {
   register Lisp_Object clause, val;
   struct gcpro gcpro1;
@@ -402,8 +383,7 @@ usage: (cond CLAUSES...)  */)
 DEFUN ("progn", Fprogn, Sprogn, 0, UNEVALLED, 0,
        doc: /* Eval BODY forms sequentially and return value of last one.
 usage: (progn BODY...)  */)
-     (args)
-     Lisp_Object args;
+  (Lisp_Object args)
 {
   register Lisp_Object val = Qnil;
   struct gcpro gcpro1;
@@ -425,8 +405,7 @@ DEFUN ("prog1", Fprog1, Sprog1, 1, UNEVALLED, 0,
 The value of FIRST is saved during the evaluation of the remaining args,
 whose values are discarded.
 usage: (prog1 FIRST BODY...)  */)
-     (args)
-     Lisp_Object args;
+  (Lisp_Object args)
 {
   Lisp_Object val;
   register Lisp_Object args_left;
@@ -443,7 +422,7 @@ usage: (prog1 FIRST BODY...)  */)
   do
     {
       if (!(argnum++))
-        val = Feval (Fcar (args_left));
+       val = Feval (Fcar (args_left));
       else
        Feval (Fcar (args_left));
       args_left = Fcdr (args_left);
@@ -459,8 +438,7 @@ DEFUN ("prog2", Fprog2, Sprog2, 2, UNEVALLED, 0,
 The value of FORM2 is saved during the evaluation of the
 remaining args, whose values are discarded.
 usage: (prog2 FORM1 FORM2 BODY...)  */)
-     (args)
-     Lisp_Object args;
+  (Lisp_Object args)
 {
   Lisp_Object val;
   register Lisp_Object args_left;
@@ -479,7 +457,7 @@ usage: (prog2 FORM1 FORM2 BODY...)  */)
   do
     {
       if (!(argnum++))
-        val = Feval (Fcar (args_left));
+       val = Feval (Fcar (args_left));
       else
        Feval (Fcar (args_left));
       args_left = Fcdr (args_left);
@@ -499,8 +477,7 @@ The second VAL is not computed until after the first SYM is set, and so on;
 each VAL can use the new value of variables set earlier in the `setq'.
 The return value of the `setq' form is the value of the last VAL.
 usage: (setq [SYM VAL]...)  */)
-     (args)
-     Lisp_Object args;
+  (Lisp_Object args)
 {
   register Lisp_Object args_left;
   register Lisp_Object val, sym;
@@ -528,8 +505,7 @@ usage: (setq [SYM VAL]...)  */)
 DEFUN ("quote", Fquote, Squote, 1, UNEVALLED, 0,
        doc: /* Return the argument, without evaluating it.  `(quote x)' yields `x'.
 usage: (quote ARG)  */)
-     (args)
-     Lisp_Object args;
+  (Lisp_Object args)
 {
   if (!NILP (Fcdr (args)))
     xsignal2 (Qwrong_number_of_arguments, Qquote, Flength (args));
@@ -541,8 +517,7 @@ DEFUN ("function", Ffunction, Sfunction, 1, UNEVALLED, 0,
 In byte compilation, `function' causes its argument to be compiled.
 `quote' cannot do that.
 usage: (function ARG)  */)
-     (args)
-     Lisp_Object args;
+  (Lisp_Object args)
 {
   if (!NILP (Fcdr (args)))
     xsignal2 (Qwrong_number_of_arguments, Qfunction, Flength (args));
@@ -567,7 +542,7 @@ To test whether your function was called with `call-interactively',
 either (i) add an extra optional argument and give it an `interactive'
 spec that specifies non-nil unconditionally (such as \"p\"); or (ii)
 use `called-interactively-p'.  */)
-     ()
+  (void)
 {
   return (INTERACTIVE && interactive_p (1)) ? Qt : Qnil;
 }
@@ -593,8 +568,7 @@ function-modifying features.  Instead of using this, it is sometimes
 cleaner to give your function an extra optional argument whose
 `interactive' spec specifies non-nil unconditionally (\"p\" is a good
 way to do this), or via (not (or executing-kbd-macro noninteractive)).  */)
-     (kind)
-     Lisp_Object kind;
+  (Lisp_Object kind)
 {
   return ((INTERACTIVE || !EQ (kind, intern ("interactive")))
          && interactive_p (1)) ? Qt : Qnil;
@@ -608,8 +582,7 @@ way to do this), or via (not (or executing-kbd-macro noninteractive)).  */)
     called is a built-in.  */
 
 int
-interactive_p (exclude_subrs_p)
-     int exclude_subrs_p;
+interactive_p (int exclude_subrs_p)
 {
   struct backtrace *btp;
   Lisp_Object fun;
@@ -656,8 +629,7 @@ DEFUN ("defun", Fdefun, Sdefun, 2, UNEVALLED, 0,
 The definition is (lambda ARGLIST [DOCSTRING] BODY...).
 See also the function `interactive'.
 usage: (defun NAME ARGLIST [DOCSTRING] BODY...)  */)
-     (args)
-     Lisp_Object args;
+  (Lisp_Object args)
 {
   register Lisp_Object fn_name;
   register Lisp_Object defn;
@@ -700,8 +672,7 @@ The elements can look like this:
        Set NAME's `doc-string-elt' property to ELT.
 
 usage: (defmacro NAME ARGLIST [DOCSTRING] [DECL] BODY...)  */)
-     (args)
-     Lisp_Object args;
+  (Lisp_Object args)
 {
   register Lisp_Object fn_name;
   register Lisp_Object defn;
@@ -719,8 +690,8 @@ usage: (defmacro NAME ARGLIST [DOCSTRING] [DECL] BODY...)  */)
       tail = XCDR (tail);
     }
 
-  while (CONSP (Fcar (tail))
-        && EQ (Fcar (Fcar (tail)), Qdeclare))
+  if (CONSP (Fcar (tail))
+      && EQ (Fcar (Fcar (tail)), Qdeclare))
     {
       if (!NILP (Vmacro_declaration_function))
        {
@@ -759,32 +730,50 @@ or of the variable at the end of the chain of aliases, if BASE-VARIABLE is
 itself an alias.  If NEW-ALIAS is bound, and BASE-VARIABLE is not,
 then the value of BASE-VARIABLE is set to that of NEW-ALIAS.
 The return value is BASE-VARIABLE.  */)
-     (new_alias, base_variable, docstring)
-     Lisp_Object new_alias, base_variable, docstring;
+  (Lisp_Object new_alias, Lisp_Object base_variable, Lisp_Object docstring)
 {
   struct Lisp_Symbol *sym;
 
   CHECK_SYMBOL (new_alias);
   CHECK_SYMBOL (base_variable);
 
-  if (SYMBOL_CONSTANT_P (new_alias))
+  sym = XSYMBOL (new_alias);
+
+  if (sym->constant)
+    /* Not sure why, but why not?  */
     error ("Cannot make a constant an alias");
 
-  sym = XSYMBOL (new_alias);
+  switch (sym->redirect)
+    {
+    case SYMBOL_FORWARDED:
+      error ("Cannot make an internal variable an alias");
+    case SYMBOL_LOCALIZED:
+      error ("Don't know how to make a localized variable an alias");
+    }
+
   /* http://lists.gnu.org/archive/html/emacs-devel/2008-04/msg00834.html
-     If n_a is bound, but b_v is not, set the value of b_v to n_a.
-     This is for the sake of define-obsolete-variable-alias and user
-     customizations.  */
-  if (NILP (Fboundp (base_variable)) && !NILP (Fboundp (new_alias)))
-    XSYMBOL(base_variable)->value = sym->value;
-  sym->indirect_variable = 1;
-  sym->value = base_variable;
+     If n_a is bound, but b_v is not, set the value of b_v to n_a,
+     so that old-code that affects n_a before the aliasing is setup
+     still works.  */
+  if (NILP (Fboundp (base_variable)))
+    set_internal (base_variable, find_symbol_value (new_alias), Qnil, 1);
+
+  {
+    struct specbinding *p;
+
+    for (p = specpdl_ptr - 1; p >= specpdl; p--)
+      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");
+  }
+
+  sym->redirect = SYMBOL_VARALIAS;
+  SET_SYMBOL_ALIAS (sym, XSYMBOL (base_variable));
   sym->constant = SYMBOL_CONSTANT_P (base_variable);
   LOADHIST_ATTACH (new_alias);
-  if (!NILP (docstring))
-    Fput (new_alias, Qvariable_documentation, docstring);
-  else
-    Fput (new_alias, Qvariable_documentation, Qnil);
+  /* Even if docstring is nil: remove old docstring.  */
+  Fput (new_alias, Qvariable_documentation, docstring);
 
   return base_variable;
 }
@@ -812,8 +801,7 @@ load a file defining variables, with this form or with `defconst' or
 for these variables.  \(`defconst' and `defcustom' behave similarly in
 this respect.)
 usage: (defvar SYMBOL &optional INITVALUE DOCSTRING)  */)
-     (args)
-     Lisp_Object args;
+  (Lisp_Object args)
 {
   register Lisp_Object sym, tem, tail;
 
@@ -885,8 +873,7 @@ If SYMBOL has a local binding, then this form sets the local binding's
 value.  However, you should normally not make local bindings for
 variables defined with this form.
 usage: (defconst SYMBOL INITVALUE [DOCSTRING])  */)
-     (args)
-     Lisp_Object args;
+  (Lisp_Object args)
 {
   register Lisp_Object sym, tem;
 
@@ -912,8 +899,7 @@ usage: (defconst SYMBOL INITVALUE [DOCSTRING])  */)
 
 /* Error handler used in Fuser_variable_p.  */
 static Lisp_Object
-user_variable_p_eh (ignore)
-     Lisp_Object ignore;
+user_variable_p_eh (Lisp_Object ignore)
 {
   return Qnil;
 }
@@ -935,8 +921,7 @@ A variable is a user variable if
 \(3) it is an alias for another user variable.
 Return nil if VARIABLE is an alias and there is a loop in the
 chain of symbols.  */)
-     (variable)
-     Lisp_Object variable;
+  (Lisp_Object variable)
 {
   Lisp_Object documentation;
 
@@ -944,35 +929,35 @@ chain of symbols.  */)
       return Qnil;
 
   /* If indirect and there's an alias loop, don't check anything else.  */
-  if (XSYMBOL (variable)->indirect_variable
+  if (XSYMBOL (variable)->redirect == SYMBOL_VARALIAS
       && NILP (internal_condition_case_1 (lisp_indirect_variable, variable,
-                                          Qt, user_variable_p_eh)))
+                                         Qt, user_variable_p_eh)))
     return Qnil;
 
   while (1)
     {
       documentation = Fget (variable, Qvariable_documentation);
       if (INTEGERP (documentation) && XINT (documentation) < 0)
-        return Qt;
+       return Qt;
       if (STRINGP (documentation)
-          && ((unsigned char) SREF (documentation, 0) == '*'))
-        return Qt;
+         && ((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;
+         && 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;
+         || (!NILP (Fget (variable, intern ("custom-autoload")))))
+       return Qt;
 
-      if (!XSYMBOL (variable)->indirect_variable)
-        return Qnil;
+      if (!(XSYMBOL (variable)->redirect == SYMBOL_VARALIAS))
+       return Qnil;
 
       /* An indirect variable?  Let's follow the chain.  */
-      variable = XSYMBOL (variable)->value;
+      XSETSYMBOL (variable, SYMBOL_ALIAS (XSYMBOL (variable)));
     }
 }
 \f
@@ -983,8 +968,7 @@ Each element of VARLIST is a symbol (which is bound to nil)
 or a list (SYMBOL VALUEFORM) (which binds SYMBOL to the value of VALUEFORM).
 Each VALUEFORM can refer to the symbols already bound by this VARLIST.
 usage: (let* VARLIST BODY...)  */)
-     (args)
-     Lisp_Object args;
+  (Lisp_Object args)
 {
   Lisp_Object varlist, val, elt;
   int count = SPECPDL_INDEX ();
@@ -1020,8 +1004,7 @@ Each element of VARLIST is a symbol (which is bound to nil)
 or a list (SYMBOL VALUEFORM) (which binds SYMBOL to the value of VALUEFORM).
 All the VALUEFORMs are evalled before any symbols are bound.
 usage: (let VARLIST BODY...)  */)
-     (args)
-     Lisp_Object args;
+  (Lisp_Object args)
 {
   Lisp_Object *temps, tem;
   register Lisp_Object elt, varlist;
@@ -1076,8 +1059,7 @@ DEFUN ("while", Fwhile, Swhile, 1, UNEVALLED, 0,
 The order of execution is thus TEST, BODY, TEST, BODY and so on
 until TEST returns nil.
 usage: (while TEST BODY...)  */)
-     (args)
-     Lisp_Object args;
+  (Lisp_Object args)
 {
   Lisp_Object test, body;
   struct gcpro gcpro1, gcpro2;
@@ -1104,9 +1086,7 @@ 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.  */)
-     (form, environment)
-     Lisp_Object form;
-     Lisp_Object environment;
+  (Lisp_Object form, Lisp_Object environment)
 {
   /* With cleanups from Hallvard Furuseth.  */
   register Lisp_Object expander, sym, def, tem;
@@ -1184,8 +1164,7 @@ Within BODY, a call to `throw' with the same TAG exits BODY and this `catch'.
 If no throw happens, `catch' returns the value of the last BODY form.
 If a throw happens, it specifies the value to return from `catch'.
 usage: (catch TAG BODY...)  */)
-     (args)
-     Lisp_Object args;
+  (Lisp_Object args)
 {
   register Lisp_Object tag;
   struct gcpro gcpro1;
@@ -1201,10 +1180,7 @@ usage: (catch TAG BODY...)  */)
    This is how catches are done from within C code. */
 
 Lisp_Object
-internal_catch (tag, func, arg)
-     Lisp_Object tag;
-     Lisp_Object (*func) ();
-     Lisp_Object arg;
+internal_catch (Lisp_Object tag, Lisp_Object (*func) (Lisp_Object), Lisp_Object arg)
 {
   /* This structure is made part of the chain `catchlist'.  */
   struct catchtag c;
@@ -1249,9 +1225,7 @@ internal_catch (tag, func, arg)
    This is used for correct unwinding in Fthrow and Fsignal.  */
 
 static void
-unwind_to_catch (catch, value)
-     struct catchtag *catch;
-     Lisp_Object value;
+unwind_to_catch (struct catchtag *catch, Lisp_Object value)
 {
   register int last_time;
 
@@ -1269,7 +1243,7 @@ unwind_to_catch (catch, value)
       last_time = catchlist == catch;
 
       /* Unwind the specpdl stack, and then restore the proper set of
-         handlers.  */
+        handlers.  */
       unbind_to (catchlist->pdlcount, Qnil);
       handlerlist = catchlist->handlerlist;
       catchlist = catchlist->next;
@@ -1280,8 +1254,8 @@ unwind_to_catch (catch, value)
   /* If x_catch_errors was done, turn it off now.
      (First we give unbind_to a chance to do that.)  */
 #if 0 /* This would disable x_catch_errors after x_connection_closed.
-       * The catch must remain in effect during that delicate
-       * state. --lorentey  */
+        The catch must remain in effect during that delicate
+        state. --lorentey  */
   x_fully_uncatch_errors ();
 #endif
 #endif
@@ -1303,8 +1277,7 @@ unwind_to_catch (catch, value)
 DEFUN ("throw", Fthrow, Sthrow, 2, 2, 0,
        doc: /* Throw to the catch for TAG and return VALUE from it.
 Both TAG and VALUE are evalled.  */)
-     (tag, value)
-     register Lisp_Object tag, value;
+  (register Lisp_Object tag, Lisp_Object value)
 {
   register struct catchtag *c;
 
@@ -1324,8 +1297,7 @@ If BODYFORM completes normally, its value is returned
 after executing the UNWINDFORMS.
 If BODYFORM exits nonlocally, the UNWINDFORMS are executed anyway.
 usage: (unwind-protect BODYFORM UNWINDFORMS...)  */)
-     (args)
-     Lisp_Object args;
+  (Lisp_Object args)
 {
   Lisp_Object val;
   int count = SPECPDL_INDEX ();
@@ -1359,14 +1331,13 @@ instead of a single condition name.  Then it handles all of them.
 When a handler handles an error, control returns to the `condition-case'
 and it executes the handler's BODY...
 with VAR bound to (ERROR-SYMBOL . SIGNAL-DATA) from the error.
-(If VAR is nil, the handler can't access that information.)
+\(If VAR is nil, the handler can't access that information.)
 Then the value of the last BODY form is returned from the `condition-case'
 expression.
 
 See also the function `signal' for more info.
 usage: (condition-case VAR BODYFORM &rest HANDLERS)  */)
-     (args)
-     Lisp_Object args;
+  (Lisp_Object args)
 {
   register Lisp_Object bodyform, handlers;
   volatile Lisp_Object var;
@@ -1382,9 +1353,8 @@ usage: (condition-case VAR BODYFORM &rest HANDLERS)  */)
    rather than passed in a list.  Used by Fbyte_code.  */
 
 Lisp_Object
-internal_lisp_condition_case (var, bodyform, handlers)
-     volatile Lisp_Object var;
-     Lisp_Object bodyform, handlers;
+internal_lisp_condition_case (volatile Lisp_Object var, Lisp_Object bodyform,
+                             Lisp_Object handlers)
 {
   Lisp_Object val;
   struct catchtag c;
@@ -1416,7 +1386,7 @@ internal_lisp_condition_case (var, bodyform, handlers)
   if (_setjmp (c.jmp))
     {
       if (!NILP (h.var))
-        specbind (h.var, c.val);
+       specbind (h.var, c.val);
       val = Fprogn (Fcdr (h.chosen_clause));
 
       /* Note that this just undoes the binding of h.var; whoever
@@ -1451,10 +1421,8 @@ internal_lisp_condition_case (var, bodyform, handlers)
    but allow the debugger to run if that is enabled.  */
 
 Lisp_Object
-internal_condition_case (bfun, handlers, hfun)
-     Lisp_Object (*bfun) ();
-     Lisp_Object handlers;
-     Lisp_Object (*hfun) ();
+internal_condition_case (Lisp_Object (*bfun) (void), Lisp_Object handlers,
+                        Lisp_Object (*hfun) (Lisp_Object))
 {
   Lisp_Object val;
   struct catchtag c;
@@ -1498,11 +1466,8 @@ internal_condition_case (bfun, handlers, hfun)
 /* Like internal_condition_case but call BFUN with ARG as its argument.  */
 
 Lisp_Object
-internal_condition_case_1 (bfun, arg, handlers, hfun)
-     Lisp_Object (*bfun) ();
-     Lisp_Object arg;
-     Lisp_Object handlers;
-     Lisp_Object (*hfun) ();
+internal_condition_case_1 (Lisp_Object (*bfun) (Lisp_Object), Lisp_Object arg,
+                          Lisp_Object handlers, Lisp_Object (*hfun) (Lisp_Object))
 {
   Lisp_Object val;
   struct catchtag c;
@@ -1543,17 +1508,64 @@ internal_condition_case_1 (bfun, arg, handlers, hfun)
   return val;
 }
 
+/* Like internal_condition_case_1 but call BFUN with ARG1 and ARG2 as
+   its arguments.  */
+
+Lisp_Object
+internal_condition_case_2 (Lisp_Object (*bfun) (Lisp_Object, Lisp_Object),
+                          Lisp_Object arg1,
+                          Lisp_Object arg2,
+                          Lisp_Object handlers,
+                          Lisp_Object (*hfun) (Lisp_Object))
+{
+  Lisp_Object val;
+  struct catchtag c;
+  struct handler h;
+
+  /* Since Fsignal will close off all calls to x_catch_errors,
+     we will get the wrong results if some are not closed now.  */
+#if HAVE_X_WINDOWS
+  if (x_catching_errors ())
+    abort ();
+#endif
+
+  c.tag = Qnil;
+  c.val = Qnil;
+  c.backlist = backtrace_list;
+  c.handlerlist = handlerlist;
+  c.lisp_eval_depth = lisp_eval_depth;
+  c.pdlcount = SPECPDL_INDEX ();
+  c.poll_suppress_count = poll_suppress_count;
+  c.interrupt_input_blocked = interrupt_input_blocked;
+  c.gcpro = gcprolist;
+  c.byte_stack = byte_stack_list;
+  if (_setjmp (c.jmp))
+    {
+      return (*hfun) (c.val);
+    }
+  c.next = catchlist;
+  catchlist = &c;
+  h.handler = handlers;
+  h.var = Qnil;
+  h.next = handlerlist;
+  h.tag = &c;
+  handlerlist = &h;
+
+  val = (*bfun) (arg1, arg2);
+  catchlist = c.next;
+  handlerlist = h.next;
+  return val;
+}
 
 /* Like internal_condition_case but call BFUN with NARGS as first,
    and ARGS as second argument.  */
 
 Lisp_Object
-internal_condition_case_2 (bfun, nargs, args, handlers, hfun)
-     Lisp_Object (*bfun) ();
-     int nargs;
-     Lisp_Object *args;
-     Lisp_Object handlers;
-     Lisp_Object (*hfun) ();
+internal_condition_case_n (Lisp_Object (*bfun) (int, Lisp_Object*),
+                          int nargs,
+                          Lisp_Object *args,
+                          Lisp_Object handlers,
+                          Lisp_Object (*hfun) (Lisp_Object))
 {
   Lisp_Object val;
   struct catchtag c;
@@ -1595,8 +1607,8 @@ internal_condition_case_2 (bfun, nargs, args, handlers, hfun)
 }
 
 \f
-static Lisp_Object find_handler_clause P_ ((Lisp_Object, Lisp_Object,
-                                           Lisp_Object, Lisp_Object));
+static Lisp_Object find_handler_clause (Lisp_Object, Lisp_Object,
+                                       Lisp_Object, Lisp_Object);
 
 DEFUN ("signal", Fsignal, Ssignal, 2, 2, 0,
        doc: /* Signal an error.  Args are ERROR-SYMBOL and associated DATA.
@@ -1612,16 +1624,13 @@ See Info anchor `(elisp)Definition of signal' for some details on how this
 error message is constructed.
 If the signal is handled, DATA is made available to the handler.
 See also the function `condition-case'.  */)
-     (error_symbol, data)
-     Lisp_Object error_symbol, data;
+  (Lisp_Object error_symbol, Lisp_Object data)
 {
   /* When memory is full, ERROR-SYMBOL is nil,
      and DATA is (REAL-ERROR-SYMBOL . REAL-DATA).
      That is a special case--don't do this in other situations.  */
   register struct handler *allhandlers = handlerlist;
   Lisp_Object conditions;
-  extern int gc_in_progress;
-  extern int waiting_for_input;
   Lisp_Object string;
   Lisp_Object real_error_symbol;
   struct backtrace *bp;
@@ -1725,8 +1734,7 @@ See also the function `condition-case'.  */)
    Used for anything but Qquit (which can return from Fsignal).  */
 
 void
-xsignal (error_symbol, data)
-     Lisp_Object error_symbol, data;
+xsignal (Lisp_Object error_symbol, Lisp_Object data)
 {
   Fsignal (error_symbol, data);
   abort ();
@@ -1735,29 +1743,25 @@ xsignal (error_symbol, data)
 /* Like xsignal, but takes 0, 1, 2, or 3 args instead of a list.  */
 
 void
-xsignal0 (error_symbol)
-     Lisp_Object error_symbol;
+xsignal0 (Lisp_Object error_symbol)
 {
   xsignal (error_symbol, Qnil);
 }
 
 void
-xsignal1 (error_symbol, arg)
-     Lisp_Object error_symbol, arg;
+xsignal1 (Lisp_Object error_symbol, Lisp_Object arg)
 {
   xsignal (error_symbol, list1 (arg));
 }
 
 void
-xsignal2 (error_symbol, arg1, arg2)
-     Lisp_Object error_symbol, arg1, arg2;
+xsignal2 (Lisp_Object error_symbol, Lisp_Object arg1, Lisp_Object arg2)
 {
   xsignal (error_symbol, list2 (arg1, arg2));
 }
 
 void
-xsignal3 (error_symbol, arg1, arg2, arg3)
-     Lisp_Object error_symbol, arg1, arg2, arg3;
+xsignal3 (Lisp_Object error_symbol, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3)
 {
   xsignal (error_symbol, list3 (arg1, arg2, arg3));
 }
@@ -1766,9 +1770,7 @@ xsignal3 (error_symbol, arg1, arg2, arg3)
    If ARG is not a genuine list, make it a one-element list.  */
 
 void
-signal_error (s, arg)
-     char *s;
-     Lisp_Object arg;
+signal_error (const char *s, Lisp_Object arg)
 {
   Lisp_Object tortoise, hare;
 
@@ -1797,8 +1799,7 @@ signal_error (s, arg)
    a list containing one of CONDITIONS.  */
 
 static int
-wants_debugger (list, conditions)
-     Lisp_Object list, conditions;
+wants_debugger (Lisp_Object list, Lisp_Object conditions)
 {
   if (NILP (list))
     return 0;
@@ -1822,8 +1823,7 @@ wants_debugger (list, conditions)
    according to debugger-ignored-errors.  */
 
 static int
-skip_debugger (conditions, data)
-     Lisp_Object conditions, data;
+skip_debugger (Lisp_Object conditions, Lisp_Object data)
 {
   Lisp_Object tail;
   int first_string = 1;
@@ -1860,8 +1860,7 @@ skip_debugger (conditions, data)
    SIG and DATA describe the signal, as in find_handler_clause.  */
 
 static int
-maybe_call_debugger (conditions, sig, data)
-     Lisp_Object conditions, sig, data;
+maybe_call_debugger (Lisp_Object conditions, Lisp_Object sig, Lisp_Object data)
 {
   Lisp_Object combined_data;
 
@@ -1897,8 +1896,8 @@ maybe_call_debugger (conditions, sig, data)
    a second error here in case we're handling specpdl overflow.  */
 
 static Lisp_Object
-find_handler_clause (handlers, conditions, sig, data)
-     Lisp_Object handlers, conditions, sig, data;
+find_handler_clause (Lisp_Object handlers, Lisp_Object conditions,
+                    Lisp_Object sig, Lisp_Object data)
 {
   register Lisp_Object h;
   register Lisp_Object tem;
@@ -1987,13 +1986,10 @@ find_handler_clause (handlers, conditions, sig, data)
   return Qnil;
 }
 
-/* dump an error message; called like printf */
 
-/* VARARGS 1 */
+/* dump an error message; called like vprintf */
 void
-error (m, a1, a2, a3)
-     char *m;
-     char *a1, *a2, *a3;
+verror (const char *m, va_list ap)
 {
   char buf[200];
   int size = 200;
@@ -2003,15 +1999,12 @@ error (m, a1, a2, a3)
   int allocated = 0;
   Lisp_Object string;
 
-  args[0] = a1;
-  args[1] = a2;
-  args[2] = a3;
-
   mlen = strlen (m);
 
   while (1)
     {
-      int used = doprnt (buffer, size, m, m + mlen, 3, args);
+      int used;
+      used = doprnt (buffer, size, m, m + mlen, ap);
       if (used < size)
        break;
       size *= 2;
@@ -2030,6 +2023,19 @@ error (m, a1, a2, a3)
 
   xsignal1 (Qerror, string);
 }
+
+
+/* dump an error message; called like printf */
+
+/* VARARGS 1 */
+void
+error (const char *m, ...)
+{
+  va_list ap;
+  va_start (ap, m);
+  verror (m, ap);
+  va_end (ap);
+}
 \f
 DEFUN ("commandp", Fcommandp, Scommandp, 1, 2, 0,
        doc: /* Non-nil if FUNCTION makes provisions for interactive calling.
@@ -2046,8 +2052,7 @@ Also, a symbol satisfies `commandp' if its function definition does so.
 
 If the optional argument FOR-CALL-INTERACTIVELY is non-nil,
 then strings and vectors are not accepted.  */)
-     (function, for_call_interactively)
-     Lisp_Object function, for_call_interactively;
+  (Lisp_Object function, Lisp_Object for_call_interactively)
 {
   register Lisp_Object fun;
   register Lisp_Object funcar;
@@ -2111,11 +2116,8 @@ Third through fifth args give info about the real definition.
 They default to nil.
 If FUNCTION is already defined other than as an autoload,
 this does nothing and returns nil.  */)
-     (function, file, docstring, interactive, type)
-     Lisp_Object function, file, docstring, interactive, type;
+  (Lisp_Object function, Lisp_Object file, Lisp_Object docstring, Lisp_Object interactive, Lisp_Object type)
 {
-  Lisp_Object args[4];
-
   CHECK_SYMBOL (function);
   CHECK_STRING (file);
 
@@ -2131,16 +2133,18 @@ this does nothing and returns nil.  */)
     LOADHIST_ATTACH (Fcons (Qautoload, function));
   else
     /* We don't want the docstring in purespace (instead,
-       Snarf-documentation should (hopefully) overwrite it).  */
-    docstring = make_number (0);
+       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 (XHASH (function));
   return Ffset (function,
                Fpurecopy (list5 (Qautoload, file, docstring,
                                  interactive, type)));
 }
 
 Lisp_Object
-un_autoload (oldqueue)
-     Lisp_Object oldqueue;
+un_autoload (Lisp_Object oldqueue)
 {
   register Lisp_Object queue, first, second;
 
@@ -2167,8 +2171,7 @@ un_autoload (oldqueue)
    FUNDEF is the autoload definition (a list).  */
 
 void
-do_autoload (fundef, funname)
-     Lisp_Object fundef, funname;
+do_autoload (Lisp_Object fundef, Lisp_Object funname)
 {
   int count = SPECPDL_INDEX ();
   Lisp_Object fun;
@@ -2193,7 +2196,7 @@ do_autoload (fundef, funname)
      the function.  We do this in the specific case of autoloading
      because autoloading is not an explicit request "load this file",
      but rather a request to "call this function".
-     
+
      The value saved here is to be restored into Vautoload_queue.  */
   record_unwind_protect (un_autoload, Vautoload_queue);
   Vautoload_queue = Qt;
@@ -2214,8 +2217,7 @@ do_autoload (fundef, funname)
 \f
 DEFUN ("eval", Feval, Seval, 1, 1, 0,
        doc: /* Evaluate FORM and return its value.  */)
-     (form)
-     Lisp_Object form;
+  (Lisp_Object form)
 {
   Lisp_Object fun, val, original_fun, original_args;
   Lisp_Object funcar;
@@ -2292,7 +2294,7 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0,
       if (XSUBR (fun)->max_args == UNEVALLED)
        {
          backtrace.evalargs = 0;
-         val = (*XSUBR (fun)->function) (args_left);
+         val = (XSUBR (fun)->function.aUNEVALLED) (args_left);
          goto done;
        }
 
@@ -2319,7 +2321,7 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0,
          backtrace.args = vals;
          backtrace.nargs = XINT (numargs);
 
-         val = (*XSUBR (fun)->function) (XINT (numargs), vals);
+         val = (XSUBR (fun)->function.aMANY) (XINT (numargs), vals);
          UNGCPRO;
          SAFE_FREE ();
          goto done;
@@ -2344,40 +2346,40 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0,
       switch (i)
        {
        case 0:
-         val = (*XSUBR (fun)->function) ();
+         val = (XSUBR (fun)->function.a0) ();
          goto done;
        case 1:
-         val = (*XSUBR (fun)->function) (argvals[0]);
+         val = (XSUBR (fun)->function.a1) (argvals[0]);
          goto done;
        case 2:
-         val = (*XSUBR (fun)->function) (argvals[0], argvals[1]);
+         val = (XSUBR (fun)->function.a2) (argvals[0], argvals[1]);
          goto done;
        case 3:
-         val = (*XSUBR (fun)->function) (argvals[0], argvals[1],
-                                         argvals[2]);
+         val = (XSUBR (fun)->function.a3) (argvals[0], argvals[1],
+                                           argvals[2]);
          goto done;
        case 4:
-         val = (*XSUBR (fun)->function) (argvals[0], argvals[1],
-                                         argvals[2], argvals[3]);
+         val = (XSUBR (fun)->function.a4) (argvals[0], argvals[1],
+                                           argvals[2], argvals[3]);
          goto done;
        case 5:
-         val = (*XSUBR (fun)->function) (argvals[0], argvals[1], argvals[2],
-                                         argvals[3], argvals[4]);
+         val = (XSUBR (fun)->function.a5) (argvals[0], argvals[1], argvals[2],
+                                           argvals[3], argvals[4]);
          goto done;
        case 6:
-         val = (*XSUBR (fun)->function) (argvals[0], argvals[1], argvals[2],
-                                         argvals[3], argvals[4], argvals[5]);
+         val = (XSUBR (fun)->function.a6) (argvals[0], argvals[1], argvals[2],
+                                           argvals[3], argvals[4], argvals[5]);
          goto done;
        case 7:
-         val = (*XSUBR (fun)->function) (argvals[0], argvals[1], argvals[2],
-                                         argvals[3], argvals[4], argvals[5],
-                                         argvals[6]);
+         val = (XSUBR (fun)->function.a7) (argvals[0], argvals[1], argvals[2],
+                                           argvals[3], argvals[4], argvals[5],
+                                           argvals[6]);
          goto done;
 
        case 8:
-         val = (*XSUBR (fun)->function) (argvals[0], argvals[1], argvals[2],
-                                         argvals[3], argvals[4], argvals[5],
-                                         argvals[6], argvals[7]);
+         val = (XSUBR (fun)->function.a8) (argvals[0], argvals[1], argvals[2],
+                                           argvals[3], argvals[4], argvals[5],
+                                           argvals[6], argvals[7]);
          goto done;
 
        default:
@@ -2427,9 +2429,7 @@ DEFUN ("apply", Fapply, Sapply, 2, MANY, 0,
 Then return the value FUNCTION returns.
 Thus, (apply '+ 1 2 '(3 4)) returns 10.
 usage: (apply FUNCTION &rest ARGUMENTS)  */)
-     (nargs, args)
-     int nargs;
-     Lisp_Object *args;
+  (int nargs, Lisp_Object *args)
 {
   register int i, numargs;
   register Lisp_Object spread_arg;
@@ -2492,7 +2492,7 @@ usage: (apply FUNCTION &rest ARGUMENTS)  */)
       gcpro1.nvars = 1 + numargs;
     }
 
-  bcopy (args, funcall_args, nargs * sizeof (Lisp_Object));
+  memcpy (funcall_args, args, nargs * sizeof (Lisp_Object));
   /* Spread the last arg we got.  Its first element goes in
      the slot that it used to occupy, hence this value of I.  */
   i = nargs - 1;
@@ -2513,8 +2513,8 @@ usage: (apply FUNCTION &rest ARGUMENTS)  */)
 /* Run hook variables in various ways.  */
 
 enum run_hooks_condition {to_completion, until_success, until_failure};
-static Lisp_Object run_hook_with_args P_ ((int, Lisp_Object *,
-                                          enum run_hooks_condition));
+static Lisp_Object run_hook_with_args (int, Lisp_Object *,
+                                      enum run_hooks_condition);
 
 DEFUN ("run-hooks", Frun_hooks, Srun_hooks, 0, MANY, 0,
        doc: /* Run each hook in HOOKS.
@@ -2531,9 +2531,7 @@ hook; they should use `run-mode-hooks' instead.
 Do not use `make-local-variable' to make a hook variable buffer-local.
 Instead, use `add-hook' and specify t for the LOCAL argument.
 usage: (run-hooks &rest HOOKS)  */)
-     (nargs, args)
-     int nargs;
-     Lisp_Object *args;
+  (int nargs, Lisp_Object *args)
 {
   Lisp_Object hook[1];
   register int i;
@@ -2562,9 +2560,7 @@ as that may change.
 Do not use `make-local-variable' to make a hook variable buffer-local.
 Instead, use `add-hook' and specify t for the LOCAL argument.
 usage: (run-hook-with-args HOOK &rest ARGS)  */)
-     (nargs, args)
-     int nargs;
-     Lisp_Object *args;
+  (int nargs, Lisp_Object *args)
 {
   return run_hook_with_args (nargs, args, to_completion);
 }
@@ -2584,9 +2580,7 @@ However, if they all return nil, we return nil.
 Do not use `make-local-variable' to make a hook variable buffer-local.
 Instead, use `add-hook' and specify t for the LOCAL argument.
 usage: (run-hook-with-args-until-success HOOK &rest ARGS)  */)
-     (nargs, args)
-     int nargs;
-     Lisp_Object *args;
+  (int nargs, Lisp_Object *args)
 {
   return run_hook_with_args (nargs, args, until_success);
 }
@@ -2605,9 +2599,7 @@ Then we return nil.  However, if they all return non-nil, we return non-nil.
 Do not use `make-local-variable' to make a hook variable buffer-local.
 Instead, use `add-hook' and specify t for the LOCAL argument.
 usage: (run-hook-with-args-until-failure HOOK &rest ARGS)  */)
-     (nargs, args)
-     int nargs;
-     Lisp_Object *args;
+  (int nargs, Lisp_Object *args)
 {
   return run_hook_with_args (nargs, args, until_failure);
 }
@@ -2621,10 +2613,7 @@ usage: (run-hook-with-args-until-failure HOOK &rest ARGS)  */)
    except that it isn't necessary to gcpro ARGS[0].  */
 
 static Lisp_Object
-run_hook_with_args (nargs, args, cond)
-     int nargs;
-     Lisp_Object *args;
-     enum run_hooks_condition cond;
+run_hook_with_args (int nargs, Lisp_Object *args, enum run_hooks_condition cond)
 {
   Lisp_Object sym, val, ret;
   struct gcpro gcpro1, gcpro2, gcpro3;
@@ -2704,10 +2693,7 @@ run_hook_with_args (nargs, args, cond)
    except that it isn't necessary to gcpro ARGS[0].  */
 
 Lisp_Object
-run_hook_list_with_args (funlist, nargs, args)
-     Lisp_Object funlist;
-     int nargs;
-     Lisp_Object *args;
+run_hook_list_with_args (Lisp_Object funlist, int nargs, Lisp_Object *args)
 {
   Lisp_Object sym;
   Lisp_Object val;
@@ -2749,8 +2735,7 @@ run_hook_list_with_args (funlist, nargs, args)
 /* Run the hook HOOK, giving each function the two args ARG1 and ARG2.  */
 
 void
-run_hook_with_args_2 (hook, arg1, arg2)
-     Lisp_Object hook, arg1, arg2;
+run_hook_with_args_2 (Lisp_Object hook, Lisp_Object arg1, Lisp_Object arg2)
 {
   Lisp_Object temp[3];
   temp[0] = hook;
@@ -2762,8 +2747,7 @@ run_hook_with_args_2 (hook, arg1, arg2)
 \f
 /* Apply fn to arg */
 Lisp_Object
-apply1 (fn, arg)
-     Lisp_Object fn, arg;
+apply1 (Lisp_Object fn, Lisp_Object arg)
 {
   struct gcpro gcpro1;
 
@@ -2771,7 +2755,6 @@ apply1 (fn, arg)
   if (NILP (arg))
     RETURN_UNGCPRO (Ffuncall (1, &fn));
   gcpro1.nvars = 2;
-#ifdef NO_ARG_ARRAY
   {
     Lisp_Object args[2];
     args[0] = fn;
@@ -2779,15 +2762,11 @@ apply1 (fn, arg)
     gcpro1.var = args;
     RETURN_UNGCPRO (Fapply (2, args));
   }
-#else /* not NO_ARG_ARRAY */
-  RETURN_UNGCPRO (Fapply (2, &fn));
-#endif /* not NO_ARG_ARRAY */
 }
 
 /* Call function fn on no arguments */
 Lisp_Object
-call0 (fn)
-     Lisp_Object fn;
+call0 (Lisp_Object fn)
 {
   struct gcpro gcpro1;
 
@@ -2798,11 +2777,9 @@ call0 (fn)
 /* Call function fn with 1 argument arg1 */
 /* ARGSUSED */
 Lisp_Object
-call1 (fn, arg1)
-     Lisp_Object fn, arg1;
+call1 (Lisp_Object fn, Lisp_Object arg1)
 {
   struct gcpro gcpro1;
-#ifdef NO_ARG_ARRAY
   Lisp_Object args[2];
 
   args[0] = fn;
@@ -2810,21 +2787,14 @@ call1 (fn, arg1)
   GCPRO1 (args[0]);
   gcpro1.nvars = 2;
   RETURN_UNGCPRO (Ffuncall (2, args));
-#else /* not NO_ARG_ARRAY */
-  GCPRO1 (fn);
-  gcpro1.nvars = 2;
-  RETURN_UNGCPRO (Ffuncall (2, &fn));
-#endif /* not NO_ARG_ARRAY */
 }
 
 /* Call function fn with 2 arguments arg1, arg2 */
 /* ARGSUSED */
 Lisp_Object
-call2 (fn, arg1, arg2)
-     Lisp_Object fn, arg1, arg2;
+call2 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2)
 {
   struct gcpro gcpro1;
-#ifdef NO_ARG_ARRAY
   Lisp_Object args[3];
   args[0] = fn;
   args[1] = arg1;
@@ -2832,21 +2802,14 @@ call2 (fn, arg1, arg2)
   GCPRO1 (args[0]);
   gcpro1.nvars = 3;
   RETURN_UNGCPRO (Ffuncall (3, args));
-#else /* not NO_ARG_ARRAY */
-  GCPRO1 (fn);
-  gcpro1.nvars = 3;
-  RETURN_UNGCPRO (Ffuncall (3, &fn));
-#endif /* not NO_ARG_ARRAY */
 }
 
 /* Call function fn with 3 arguments arg1, arg2, arg3 */
 /* ARGSUSED */
 Lisp_Object
-call3 (fn, arg1, arg2, arg3)
-     Lisp_Object fn, arg1, arg2, arg3;
+call3 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3)
 {
   struct gcpro gcpro1;
-#ifdef NO_ARG_ARRAY
   Lisp_Object args[4];
   args[0] = fn;
   args[1] = arg1;
@@ -2855,21 +2818,15 @@ call3 (fn, arg1, arg2, arg3)
   GCPRO1 (args[0]);
   gcpro1.nvars = 4;
   RETURN_UNGCPRO (Ffuncall (4, args));
-#else /* not NO_ARG_ARRAY */
-  GCPRO1 (fn);
-  gcpro1.nvars = 4;
-  RETURN_UNGCPRO (Ffuncall (4, &fn));
-#endif /* not NO_ARG_ARRAY */
 }
 
 /* Call function fn with 4 arguments arg1, arg2, arg3, arg4 */
 /* ARGSUSED */
 Lisp_Object
-call4 (fn, arg1, arg2, arg3, arg4)
-     Lisp_Object fn, arg1, arg2, arg3, arg4;
+call4 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3,
+       Lisp_Object arg4)
 {
   struct gcpro gcpro1;
-#ifdef NO_ARG_ARRAY
   Lisp_Object args[5];
   args[0] = fn;
   args[1] = arg1;
@@ -2879,21 +2836,15 @@ call4 (fn, arg1, arg2, arg3, arg4)
   GCPRO1 (args[0]);
   gcpro1.nvars = 5;
   RETURN_UNGCPRO (Ffuncall (5, args));
-#else /* not NO_ARG_ARRAY */
-  GCPRO1 (fn);
-  gcpro1.nvars = 5;
-  RETURN_UNGCPRO (Ffuncall (5, &fn));
-#endif /* not NO_ARG_ARRAY */
 }
 
 /* Call function fn with 5 arguments arg1, arg2, arg3, arg4, arg5 */
 /* ARGSUSED */
 Lisp_Object
-call5 (fn, arg1, arg2, arg3, arg4, arg5)
-     Lisp_Object fn, arg1, arg2, arg3, arg4, arg5;
+call5 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3,
+       Lisp_Object arg4, Lisp_Object arg5)
 {
   struct gcpro gcpro1;
-#ifdef NO_ARG_ARRAY
   Lisp_Object args[6];
   args[0] = fn;
   args[1] = arg1;
@@ -2904,21 +2855,15 @@ call5 (fn, arg1, arg2, arg3, arg4, arg5)
   GCPRO1 (args[0]);
   gcpro1.nvars = 6;
   RETURN_UNGCPRO (Ffuncall (6, args));
-#else /* not NO_ARG_ARRAY */
-  GCPRO1 (fn);
-  gcpro1.nvars = 6;
-  RETURN_UNGCPRO (Ffuncall (6, &fn));
-#endif /* not NO_ARG_ARRAY */
 }
 
 /* Call function fn with 6 arguments arg1, arg2, arg3, arg4, arg5, arg6 */
 /* ARGSUSED */
 Lisp_Object
-call6 (fn, arg1, arg2, arg3, arg4, arg5, arg6)
-     Lisp_Object fn, arg1, arg2, arg3, arg4, arg5, arg6;
+call6 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3,
+       Lisp_Object arg4, Lisp_Object arg5, Lisp_Object arg6)
 {
   struct gcpro gcpro1;
-#ifdef NO_ARG_ARRAY
   Lisp_Object args[7];
   args[0] = fn;
   args[1] = arg1;
@@ -2930,11 +2875,27 @@ call6 (fn, arg1, arg2, arg3, arg4, arg5, arg6)
   GCPRO1 (args[0]);
   gcpro1.nvars = 7;
   RETURN_UNGCPRO (Ffuncall (7, args));
-#else /* not NO_ARG_ARRAY */
-  GCPRO1 (fn);
-  gcpro1.nvars = 7;
-  RETURN_UNGCPRO (Ffuncall (7, &fn));
-#endif /* not NO_ARG_ARRAY */
+}
+
+/* Call function fn with 7 arguments arg1, arg2, arg3, arg4, arg5, arg6, arg7 */
+/* ARGSUSED */
+Lisp_Object
+call7 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3,
+       Lisp_Object arg4, Lisp_Object arg5, Lisp_Object arg6, Lisp_Object arg7)
+{
+  struct gcpro gcpro1;
+  Lisp_Object args[8];
+  args[0] = fn;
+  args[1] = arg1;
+  args[2] = arg2;
+  args[3] = arg3;
+  args[4] = arg4;
+  args[5] = arg5;
+  args[6] = arg6;
+  args[7] = arg7;
+  GCPRO1 (args[0]);
+  gcpro1.nvars = 8;
+  RETURN_UNGCPRO (Ffuncall (8, args));
 }
 
 /* The caller should GCPRO all the elements of ARGS.  */
@@ -2944,9 +2905,7 @@ DEFUN ("funcall", Ffuncall, Sfuncall, 1, MANY, 0,
 Return the value that function returns.
 Thus, (funcall 'cons 'x 'y) returns (x . y).
 usage: (funcall FUNCTION &rest ARGUMENTS)  */)
-     (nargs, args)
-     int nargs;
-     Lisp_Object *args;
+  (int nargs, Lisp_Object *args)
 {
   Lisp_Object fun, original_fun;
   Lisp_Object funcar;
@@ -3009,14 +2968,14 @@ usage: (funcall FUNCTION &rest ARGUMENTS)  */)
 
       if (XSUBR (fun)->max_args == MANY)
        {
-         val = (*XSUBR (fun)->function) (numargs, args + 1);
+         val = (XSUBR (fun)->function.aMANY) (numargs, args + 1);
          goto done;
        }
 
       if (XSUBR (fun)->max_args > numargs)
        {
          internal_args = (Lisp_Object *) alloca (XSUBR (fun)->max_args * sizeof (Lisp_Object));
-         bcopy (args + 1, internal_args, numargs * sizeof (Lisp_Object));
+         memcpy (internal_args, args + 1, numargs * sizeof (Lisp_Object));
          for (i = numargs; i < XSUBR (fun)->max_args; i++)
            internal_args[i] = Qnil;
        }
@@ -3025,44 +2984,44 @@ usage: (funcall FUNCTION &rest ARGUMENTS)  */)
       switch (XSUBR (fun)->max_args)
        {
        case 0:
-         val = (*XSUBR (fun)->function) ();
+         val = (XSUBR (fun)->function.a0) ();
          goto done;
        case 1:
-         val = (*XSUBR (fun)->function) (internal_args[0]);
+         val = (XSUBR (fun)->function.a1) (internal_args[0]);
          goto done;
        case 2:
-         val = (*XSUBR (fun)->function) (internal_args[0], internal_args[1]);
+         val = (XSUBR (fun)->function.a2) (internal_args[0], internal_args[1]);
          goto done;
        case 3:
-         val = (*XSUBR (fun)->function) (internal_args[0], internal_args[1],
-                                         internal_args[2]);
+         val = (XSUBR (fun)->function.a3) (internal_args[0], internal_args[1],
+                                           internal_args[2]);
          goto done;
        case 4:
-         val = (*XSUBR (fun)->function) (internal_args[0], internal_args[1],
-                                         internal_args[2], internal_args[3]);
+         val = (XSUBR (fun)->function.a4) (internal_args[0], internal_args[1],
+                                           internal_args[2], internal_args[3]);
          goto done;
        case 5:
-         val = (*XSUBR (fun)->function) (internal_args[0], internal_args[1],
-                                         internal_args[2], internal_args[3],
-                                         internal_args[4]);
+         val = (XSUBR (fun)->function.a5) (internal_args[0], internal_args[1],
+                                           internal_args[2], internal_args[3],
+                                           internal_args[4]);
          goto done;
        case 6:
-         val = (*XSUBR (fun)->function) (internal_args[0], internal_args[1],
-                                         internal_args[2], internal_args[3],
-                                         internal_args[4], internal_args[5]);
+         val = (XSUBR (fun)->function.a6) (internal_args[0], internal_args[1],
+                                           internal_args[2], internal_args[3],
+                                           internal_args[4], internal_args[5]);
          goto done;
        case 7:
-         val = (*XSUBR (fun)->function) (internal_args[0], internal_args[1],
-                                         internal_args[2], internal_args[3],
-                                         internal_args[4], internal_args[5],
-                                         internal_args[6]);
+         val = (XSUBR (fun)->function.a7) (internal_args[0], internal_args[1],
+                                           internal_args[2], internal_args[3],
+                                           internal_args[4], internal_args[5],
+                                           internal_args[6]);
          goto done;
 
        case 8:
-         val = (*XSUBR (fun)->function) (internal_args[0], internal_args[1],
-                                         internal_args[2], internal_args[3],
-                                         internal_args[4], internal_args[5],
-                                         internal_args[6], internal_args[7]);
+         val = (XSUBR (fun)->function.a8) (internal_args[0], internal_args[1],
+                                           internal_args[2], internal_args[3],
+                                           internal_args[4], internal_args[5],
+                                           internal_args[6], internal_args[7]);
          goto done;
 
        default:
@@ -3105,9 +3064,7 @@ usage: (funcall FUNCTION &rest ARGUMENTS)  */)
 }
 \f
 Lisp_Object
-apply_lambda (fun, args, eval_flag)
-     Lisp_Object fun, args;
-     int eval_flag;
+apply_lambda (Lisp_Object fun, Lisp_Object args, int eval_flag)
 {
   Lisp_Object args_left;
   Lisp_Object numargs;
@@ -3156,10 +3113,7 @@ apply_lambda (fun, args, eval_flag)
    FUN must be either a lambda-expression or a compiled-code object.  */
 
 static Lisp_Object
-funcall_lambda (fun, nargs, arg_vector)
-     Lisp_Object fun;
-     int nargs;
-     register Lisp_Object *arg_vector;
+funcall_lambda (Lisp_Object fun, int nargs, register Lisp_Object *arg_vector)
 {
   Lisp_Object val, syms_left, next;
   int count = SPECPDL_INDEX ();
@@ -3228,8 +3182,7 @@ funcall_lambda (fun, nargs, arg_vector)
 DEFUN ("fetch-bytecode", Ffetch_bytecode, Sfetch_bytecode,
        1, 1, 0,
        doc: /* If byte-compiled OBJECT is lazy-loaded, fetch it now.  */)
-     (object)
-     Lisp_Object object;
+  (Lisp_Object object)
 {
   Lisp_Object tem;
 
@@ -3251,7 +3204,7 @@ DEFUN ("fetch-bytecode", Ffetch_bytecode, Sfetch_bytecode,
 }
 \f
 void
-grow_specpdl ()
+grow_specpdl (void)
 {
   register int count = SPECPDL_INDEX ();
   if (specpdl_size >= max_specpdl_size)
@@ -3268,89 +3221,120 @@ grow_specpdl ()
   specpdl_ptr = specpdl + count;
 }
 
+/* specpdl_ptr->symbol is a field which describes which variable is
+   let-bound, so it can be properly undone when we unbind_to.
+   It can have the following two shapes:
+   - SYMBOL : if it's a plain symbol, it means that we have let-bound
+     a symbol that is not buffer-local (at least at the time
+     the let binding started).  Note also that it should not be
+     aliased (i.e. when let-binding V1 that's aliased to V2, we want
+     to record V2 here).
+   - (SYMBOL WHERE . BUFFER) : this means that it is a let-binding for
+     variable SYMBOL which can be buffer-local.  WHERE tells us
+     which buffer is affected (or nil if the let-binding affects the
+     global value of the variable) and BUFFER tells us which buffer was
+     current (i.e. if WHERE is non-nil, then BUFFER==WHERE, otherwise
+     BUFFER did not yet have a buffer-local value).  */
+
 void
-specbind (symbol, value)
-     Lisp_Object symbol, value;
+specbind (Lisp_Object symbol, Lisp_Object value)
 {
-  Lisp_Object valcontents;
+  struct Lisp_Symbol *sym;
+
+  eassert (!handling_signal);
 
   CHECK_SYMBOL (symbol);
+  sym = XSYMBOL (symbol);
   if (specpdl_ptr == specpdl + specpdl_size)
     grow_specpdl ();
 
-  /* The most common case is that of a non-constant symbol with a
-     trivial value.  Make that as fast as we can.  */
-  valcontents = SYMBOL_VALUE (symbol);
-  if (!MISCP (valcontents) && !SYMBOL_CONSTANT_P (symbol))
+ start:
+  switch (sym->redirect)
     {
+    case SYMBOL_VARALIAS:
+      sym = indirect_variable (sym); XSETSYMBOL (symbol, sym); goto start;
+    case SYMBOL_PLAINVAL:
+      /* The most common case is that of a non-constant symbol with a
+        trivial value.  Make that as fast as we can.  */
       specpdl_ptr->symbol = symbol;
-      specpdl_ptr->old_value = valcontents;
+      specpdl_ptr->old_value = SYMBOL_VAL (sym);
       specpdl_ptr->func = NULL;
       ++specpdl_ptr;
-      SET_SYMBOL_VALUE (symbol, value);
-    }
-  else
-    {
-      Lisp_Object ovalue = find_symbol_value (symbol);
-      specpdl_ptr->func = 0;
-      specpdl_ptr->old_value = ovalue;
-
-      valcontents = XSYMBOL (symbol)->value;
-
-      if (BUFFER_LOCAL_VALUEP (valcontents)
-         || BUFFER_OBJFWDP (valcontents))
-       {
-         Lisp_Object where, current_buffer;
-
-         current_buffer = Fcurrent_buffer ();
-
-         /* For a local variable, record both the symbol and which
-            buffer's or frame's value we are saving.  */
-         if (!NILP (Flocal_variable_p (symbol, Qnil)))
-           where = current_buffer;
-         else if (BUFFER_LOCAL_VALUEP (valcontents)
-                  && XBUFFER_LOCAL_VALUE (valcontents)->found_for_frame)
-           where = XBUFFER_LOCAL_VALUE (valcontents)->frame;
-         else
-           where = Qnil;
-
-         /* We're not using the `unused' slot in the specbinding
-            structure because this would mean we have to do more
-            work for simple variables.  */
-         specpdl_ptr->symbol = Fcons (symbol, Fcons (where, current_buffer));
-
-         /* If SYMBOL is a per-buffer variable which doesn't have a
-            buffer-local value here, make the `let' change the global
-            value by changing the value of SYMBOL in all buffers not
-            having their own value.  This is consistent with what
-            happens with other buffer-local variables.  */
-         if (NILP (where)
-             && BUFFER_OBJFWDP (valcontents))
-           {
-             ++specpdl_ptr;
-             Fset_default (symbol, value);
-             return;
-           }
-       }
+      if (!sym->constant)
+       SET_SYMBOL_VAL (sym, value);
       else
-       specpdl_ptr->symbol = symbol;
-
-      specpdl_ptr++;
-      /* We used to do
-            if (BUFFER_OBJFWDP (ovalue) || KBOARD_OBJFWDP (ovalue))
-             store_symval_forwarding (symbol, ovalue, value, NULL);
-            else
-         but ovalue comes from find_symbol_value which should never return
-         such an internal value.  */
-      eassert (!(BUFFER_OBJFWDP (ovalue) || KBOARD_OBJFWDP (ovalue)));
-      set_internal (symbol, value, 0, 1);
+       set_internal (symbol, value, Qnil, 1);
+      break;
+    case SYMBOL_LOCALIZED:
+      if (SYMBOL_BLV (sym)->frame_local)
+       error ("Frame-local vars cannot be let-bound");
+    case SYMBOL_FORWARDED:
+      {
+       Lisp_Object ovalue = find_symbol_value (symbol);
+       specpdl_ptr->func = 0;
+       specpdl_ptr->old_value = ovalue;
+
+       eassert (sym->redirect != SYMBOL_LOCALIZED
+                || (EQ (SYMBOL_BLV (sym)->where,
+                        SYMBOL_BLV (sym)->frame_local ?
+                        Fselected_frame () : Fcurrent_buffer ())));
+
+       if (sym->redirect == SYMBOL_LOCALIZED
+           || BUFFER_OBJFWDP (SYMBOL_FWD (sym)))
+         {
+           Lisp_Object where, cur_buf = Fcurrent_buffer ();
+
+           /* For a local variable, record both the symbol and which
+              buffer's or frame's value we are saving.  */
+           if (!NILP (Flocal_variable_p (symbol, Qnil)))
+             {
+               eassert (sym->redirect != SYMBOL_LOCALIZED
+                        || (BLV_FOUND (SYMBOL_BLV (sym))
+                            && EQ (cur_buf, SYMBOL_BLV (sym)->where)));
+               where = cur_buf;
+             }
+           else if (sym->redirect == SYMBOL_LOCALIZED
+                    && BLV_FOUND (SYMBOL_BLV (sym)))
+             where = SYMBOL_BLV (sym)->where;
+           else
+             where = Qnil;
+
+           /* We're not using the `unused' slot in the specbinding
+              structure because this would mean we have to do more
+              work for simple variables.  */
+           /* FIXME: The third value `current_buffer' is only used in
+              let_shadows_buffer_binding_p which is itself only used
+              in set_internal for local_if_set.  */
+           eassert (NILP (where) || EQ (where, cur_buf));
+           specpdl_ptr->symbol = Fcons (symbol, Fcons (where, cur_buf));
+
+           /* If SYMBOL is a per-buffer variable which doesn't have a
+              buffer-local value here, make the `let' change the global
+              value by changing the value of SYMBOL in all buffers not
+              having their own value.  This is consistent with what
+              happens with other buffer-local variables.  */
+           if (NILP (where)
+               && sym->redirect == SYMBOL_FORWARDED)
+             {
+               eassert (BUFFER_OBJFWDP (SYMBOL_FWD (sym)));
+               ++specpdl_ptr;
+               Fset_default (symbol, value);
+               return;
+             }
+         }
+       else
+         specpdl_ptr->symbol = symbol;
+
+       specpdl_ptr++;
+       set_internal (symbol, value, Qnil, 1);
+       break;
+      }
+    default: abort ();
     }
 }
 
 void
-record_unwind_protect (function, arg)
-     Lisp_Object (*function) P_ ((Lisp_Object));
-     Lisp_Object arg;
+record_unwind_protect (Lisp_Object (*function) (Lisp_Object), Lisp_Object arg)
 {
   eassert (!handling_signal);
 
@@ -3363,9 +3347,7 @@ record_unwind_protect (function, arg)
 }
 
 Lisp_Object
-unbind_to (count, value)
-     int count;
-     Lisp_Object value;
+unbind_to (int count, Lisp_Object value)
 {
   Lisp_Object quitf = Vquit_flag;
   struct gcpro gcpro1, gcpro2;
@@ -3392,7 +3374,7 @@ unbind_to (count, value)
         bound a variable that had a buffer-local or frame-local
         binding.  WHERE nil means that the variable had the default
         value when it was bound.  CURRENT-BUFFER is the buffer that
-         was current when the variable was bound.  */
+        was current when the variable was bound.  */
       else if (CONSP (this_binding.symbol))
        {
          Lisp_Object symbol, where;
@@ -3402,21 +3384,23 @@ unbind_to (count, value)
 
          if (NILP (where))
            Fset_default (symbol, this_binding.old_value);
-         else if (BUFFERP (where))
-           set_internal (symbol, this_binding.old_value, XBUFFER (where), 1);
-         else
-           set_internal (symbol, this_binding.old_value, NULL, 1);
+         /* If `where' is non-nil, reset the value in the appropriate
+            local binding, but only if that binding still exists.  */
+         else if (BUFFERP (where)
+                  ? !NILP (Flocal_variable_p (symbol, where))
+                  : !NILP (Fassq (symbol, XFRAME (where)->param_alist)))
+           set_internal (symbol, this_binding.old_value, where, 1);
        }
+      /* If variable has a trivial value (no forwarding), we can
+        just set it.  No need to check for constant symbols here,
+        since that was already done by specbind.  */
+      else if (XSYMBOL (this_binding.symbol)->redirect == SYMBOL_PLAINVAL)
+       SET_SYMBOL_VAL (XSYMBOL (this_binding.symbol),
+                       this_binding.old_value);
       else
-       {
-         /* If variable has a trivial value (no forwarding), we can
-            just set it.  No need to check for constant symbols here,
-            since that was already done by specbind.  */
-         if (!MISCP (SYMBOL_VALUE (this_binding.symbol)))
-           SET_SYMBOL_VALUE (this_binding.symbol, this_binding.old_value);
-         else
-           set_internal (this_binding.symbol, this_binding.old_value, 0, 1);
-       }
+       /* NOTE: we only ever come here if make_local_foo was used for
+          the first time on this var within this let.  */
+       Fset_default (this_binding.symbol, this_binding.old_value);
     }
 
   if (NILP (Vquit_flag) && !NILP (quitf))
@@ -3429,8 +3413,7 @@ unbind_to (count, value)
 DEFUN ("backtrace-debug", Fbacktrace_debug, Sbacktrace_debug, 2, 2, 0,
        doc: /* Set the debug-on-exit flag of eval frame LEVEL levels down to FLAG.
 The debugger is entered when that frame exits, if the flag is non-nil.  */)
-     (level, flag)
-     Lisp_Object level, flag;
+  (Lisp_Object level, Lisp_Object flag)
 {
   register struct backtrace *backlist = backtrace_list;
   register int i;
@@ -3451,13 +3434,12 @@ The debugger is entered when that frame exits, if the flag is non-nil.  */)
 DEFUN ("backtrace", Fbacktrace, Sbacktrace, 0, 0, "",
        doc: /* Print a trace of Lisp function calls currently active.
 Output stream used is value of `standard-output'.  */)
-     ()
+  (void)
 {
   register struct backtrace *backlist = backtrace_list;
   register int i;
   Lisp_Object tail;
   Lisp_Object tem;
-  extern Lisp_Object Vprint_level;
   struct gcpro gcpro1;
 
   XSETFASTINT (Vprint_level, 3);
@@ -3516,8 +3498,7 @@ A &rest arg is represented as the tail of the list ARG-VALUES.
 FUNCTION is whatever was supplied as car of evaluated list,
 or a lambda expression for macro calls.
 If NFRAMES is more than the number of frames, the value is nil.  */)
-     (nframes)
-     Lisp_Object nframes;
+  (Lisp_Object nframes)
 {
   register struct backtrace *backlist = backtrace_list;
   register int i;
@@ -3546,7 +3527,7 @@ If NFRAMES is more than the number of frames, the value is nil.  */)
 
 \f
 void
-mark_backtrace ()
+mark_backtrace (void)
 {
   register struct backtrace *backlist;
   register int i;
@@ -3565,7 +3546,7 @@ mark_backtrace ()
 }
 
 void
-syms_of_eval ()
+syms_of_eval (void)
 {
   DEFVAR_INT ("max-specpdl-size", &max_specpdl_size,
              doc: /* *Limit on number of Lisp variable bindings and `unwind-protect's.
index 440a726b26b5173dafa9f2d39efd7f9e8613c7ee..a04cd4e76f50af9c0b6cb23902281f4f1c8922eb 100644 (file)
@@ -53,10 +53,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <ctype.h>
 #include <errno.h>
 
-#ifndef vax11c
-#ifndef USE_CRT_DLL
-extern int errno;
-#endif
+#ifdef HAVE_LIBSELINUX
+#include <selinux/selinux.h>
+#include <selinux/context.h>
 #endif
 
 #include "lisp.h"
@@ -79,17 +78,11 @@ extern int errno;
 #ifdef MSDOS
 #include "msdos.h"
 #include <sys/param.h>
-#if __DJGPP__ >= 2
 #include <fcntl.h>
 #include <string.h>
 #endif
-#endif
 
 #ifdef DOS_NT
-#define CORRECT_DIR_SEPS(s) \
-  do { if ('/' == DIRECTORY_SEP) dostounix_filename (s); \
-       else unixtodos_filename (s); \
-  } while (0)
 /* On Windows, drive letters must be alphabetic - on DOS, the Netware
    redirector allows the six letters between 'Z' and 'a' as well. */
 #ifdef MSDOS
@@ -111,8 +104,6 @@ extern int errno;
 #endif
 
 #include "commands.h"
-extern int use_dialog_box;
-extern int use_file_dialog;
 
 #ifndef O_WRONLY
 #define O_WRONLY 1
@@ -221,16 +212,10 @@ Lisp_Object Qcopy_directory;
 /* Lisp function for recursively deleting directories.  */
 Lisp_Object Qdelete_directory;
 
-extern Lisp_Object Vuser_login_name;
-
 #ifdef WINDOWSNT
 extern Lisp_Object Vw32_get_true_file_attributes;
 #endif
 
-extern int minibuf_level;
-
-extern int minibuffer_auto_raise;
-
 /* These variables describe handlers that have "already" had a chance
    to handle the current operation.
 
@@ -247,15 +232,13 @@ Lisp_Object Qfile_name_history;
 
 Lisp_Object Qcar_less_than_car;
 
-static int a_write P_ ((int, Lisp_Object, int, int,
-                       Lisp_Object *, struct coding_system *));
-static int e_write P_ ((int, Lisp_Object, int, int, struct coding_system *));
+static int a_write (int, Lisp_Object, int, int,
+                    Lisp_Object *, struct coding_system *);
+static int e_write (int, Lisp_Object, int, int, struct coding_system *);
 
 \f
 void
-report_file_error (string, data)
-     const char *string;
-     Lisp_Object data;
+report_file_error (const char *string, Lisp_Object data)
 {
   Lisp_Object errstring;
   int errorno = errno;
@@ -293,8 +276,7 @@ report_file_error (string, data)
 }
 
 Lisp_Object
-close_file_unwind (fd)
-     Lisp_Object fd;
+close_file_unwind (Lisp_Object fd)
 {
   emacs_close (XFASTINT (fd));
   return Qnil;
@@ -303,8 +285,7 @@ close_file_unwind (fd)
 /* Restore point, having saved it as a marker.  */
 
 Lisp_Object
-restore_point_unwind (location)
-     Lisp_Object location;
+restore_point_unwind (Lisp_Object location)
 {
   Fgoto_char (location);
   Fset_marker (location, Qnil, Qnil);
@@ -339,6 +320,8 @@ Lisp_Object Qfile_accessible_directory_p;
 Lisp_Object Qfile_modes;
 Lisp_Object Qset_file_modes;
 Lisp_Object Qset_file_times;
+Lisp_Object Qfile_selinux_context;
+Lisp_Object Qset_file_selinux_context;
 Lisp_Object Qfile_newer_than_file_p;
 Lisp_Object Qinsert_file_contents;
 Lisp_Object Qwrite_region;
@@ -355,8 +338,7 @@ If OPERATION equals `inhibit-file-name-operation', then we ignore
 any handlers that are members of `inhibit-file-name-handlers',
 but we still do run any other handlers.  This lets handlers
 use the standard functions without calling themselves recursively.  */)
-     (filename, operation)
-     Lisp_Object filename, operation;
+  (Lisp_Object filename, Lisp_Object operation)
 {
   /* This function must not munge the match data.  */
   Lisp_Object chain, inhibited_handlers, result;
@@ -412,8 +394,7 @@ DEFUN ("file-name-directory", Ffile_name_directory, Sfile_name_directory,
 Return nil if FILENAME does not include a directory.
 Otherwise return a directory name.
 Given a Unix syntax file name, returns a string ending in slash.  */)
-     (filename)
-     Lisp_Object filename;
+  (Lisp_Object filename)
 {
 #ifndef DOS_NT
   register const unsigned char *beg;
@@ -434,7 +415,7 @@ Given a Unix syntax file name, returns a string ending in slash.  */)
   filename = FILE_SYSTEM_CASE (filename);
 #ifdef DOS_NT
   beg = (unsigned char *) alloca (SBYTES (filename) + 1);
-  bcopy (SDATA (filename), beg, SBYTES (filename) + 1);
+  memcpy (beg, SDATA (filename), SBYTES (filename) + 1);
 #else
   beg = SDATA (filename);
 #endif
@@ -475,7 +456,7 @@ Given a Unix syntax file name, returns a string ending in slash.  */)
          p = beg + strlen (beg);
        }
     }
-  CORRECT_DIR_SEPS (beg);
+  dostounix_filename (beg);
 #endif /* DOS_NT */
 
   return make_specified_string (beg, -1, p - beg, STRING_MULTIBYTE (filename));
@@ -487,8 +468,7 @@ DEFUN ("file-name-nondirectory", Ffile_name_nondirectory,
 For example, in a Unix-syntax file name,
 this is everything after the last slash,
 or the entire name if it contains no slash.  */)
-     (filename)
-     Lisp_Object filename;
+  (Lisp_Object filename)
 {
   register const unsigned char *beg, *p, *end;
   Lisp_Object handler;
@@ -528,8 +508,7 @@ If FILENAME refers to a file which is not accessible from a local process,
 then this should return nil.
 The `call-process' and `start-process' functions use this function to
 get a current directory to run processes in.  */)
-     (filename)
-     Lisp_Object filename;
+  (Lisp_Object filename)
 {
   Lisp_Object handler;
 
@@ -544,8 +523,7 @@ get a current directory to run processes in.  */)
 
 \f
 char *
-file_name_as_directory (out, in)
-     char *out, *in;
+file_name_as_directory (char *out, char *in)
 {
   int size = strlen (in) - 1;
 
@@ -562,12 +540,11 @@ file_name_as_directory (out, in)
   /* For Unix syntax, Append a slash if necessary */
   if (!IS_DIRECTORY_SEP (out[size]))
     {
-      /* Cannot use DIRECTORY_SEP, which could have any value */
-      out[size + 1] = '/';
+      out[size + 1] = DIRECTORY_SEP;
       out[size + 2] = '\0';
     }
 #ifdef DOS_NT
-  CORRECT_DIR_SEPS (out);
+  dostounix_filename (out);
 #endif
   return out;
 }
@@ -580,8 +557,7 @@ a directory is different from its name as a file.
 The result can be used as the value of `default-directory'
 or passed as second argument to `expand-file-name'.
 For a Unix-syntax file name, just appends a slash.  */)
-     (file)
-     Lisp_Object file;
+  (Lisp_Object file)
 {
   char *buf;
   Lisp_Object handler;
@@ -610,8 +586,7 @@ For a Unix-syntax file name, just appends a slash.  */)
  */
 
 int
-directory_file_name (src, dst)
-     char *src, *dst;
+directory_file_name (char *src, char *dst)
 {
   long slen;
 
@@ -628,7 +603,7 @@ directory_file_name (src, dst)
       )
     dst[slen - 1] = 0;
 #ifdef DOS_NT
-  CORRECT_DIR_SEPS (dst);
+  dostounix_filename (dst);
 #endif
   return 1;
 }
@@ -640,8 +615,7 @@ This is the name of the file that holds the data for the directory DIRECTORY.
 This operation exists because a directory is also a file, but its name as
 a directory is different from its name as a file.
 In Unix-syntax, this function just removes the final slash.  */)
-     (directory)
-     Lisp_Object directory;
+  (Lisp_Object directory)
 {
   char *buf;
   Lisp_Object handler;
@@ -694,9 +668,7 @@ static unsigned make_temp_name_count, make_temp_name_count_initialized_p;
    generated.  */
 
 Lisp_Object
-make_temp_name (prefix, base64_p)
-     Lisp_Object prefix;
-     int base64_p;
+make_temp_name (Lisp_Object prefix, int base64_p)
 {
   Lisp_Object val;
   int len, clen;
@@ -739,10 +711,10 @@ make_temp_name (prefix, base64_p)
   if (!STRING_MULTIBYTE (prefix))
     STRING_SET_UNIBYTE (val);
   data = SDATA (val);
-  bcopy(SDATA (prefix), data, len);
+  memcpy (data, SDATA (prefix), len);
   p = data + len;
 
-  bcopy (pidbuf, p, pidlen);
+  memcpy (p, pidbuf, pidlen);
   p += pidlen;
 
   /* Here we try to minimize useless stat'ing when this function is
@@ -815,8 +787,7 @@ probably use `make-temp-file' instead, except in three circumstances:
 * If you are creating the file in the user's home directory.
 * If you are creating a directory rather than an ordinary file.
 * If you are taking special precautions as `make-temp-file' does.  */)
-     (prefix)
-     Lisp_Object prefix;
+  (Lisp_Object prefix)
 {
   return make_temp_name (prefix, 0);
 }
@@ -841,8 +812,7 @@ non-intuitive results for the root directory; for instance,
 \(expand-file-name ".." "/") returns "/..".  For this reason, use
 (directory-file-name (file-name-directory dirname)) to traverse a
 filesystem tree, not (expand-file-name ".."  dirname).  */)
-     (name, default_directory)
-     Lisp_Object name, default_directory;
+  (Lisp_Object name, Lisp_Object default_directory)
 {
   /* These point to SDATA and need to be careful with string-relocation
      during GC (via DECODE_FILE).  */
@@ -884,8 +854,6 @@ filesystem tree, not (expand-file-name ".."  dirname).  */)
 
         To avoid this, we set default_directory to the root of the
         current drive.  */
-      extern char *emacs_root_dir (void);
-
       default_directory = build_string (emacs_root_dir ());
 #else
       default_directory = build_string ("/");
@@ -953,7 +921,7 @@ filesystem tree, not (expand-file-name ".."  dirname).  */)
 
   /* Make a local copy of nm[] to protect it from GC in DECODE_FILE below. */
   nm = (unsigned char *) alloca (SBYTES (name) + 1);
-  bcopy (SDATA (name), nm, SBYTES (name) + 1);
+  memcpy (nm, SDATA (name), SBYTES (name) + 1);
 
 #ifdef DOS_NT
   /* Note if special escape prefix is present, but remove for now.  */
@@ -1033,10 +1001,9 @@ filesystem tree, not (expand-file-name ".."  dirname).  */)
       if (!lose)
        {
 #ifdef DOS_NT
-         /* Make sure directories are all separated with / or \ as
-            desired, but avoid allocation of a new string when not
-            required. */
-         CORRECT_DIR_SEPS (nm);
+         /* Make sure directories are all separated with /, but
+            avoid allocation of a new string when not required. */
+         dostounix_filename (nm);
 #ifdef WINDOWSNT
          if (IS_DIRECTORY_SEP (nm[1]))
            {
@@ -1108,7 +1075,7 @@ filesystem tree, not (expand-file-name ".."  dirname).  */)
          unsigned char *o, *p;
          for (p = nm; *p && (!IS_DIRECTORY_SEP (*p)); p++);
          o = alloca (p - nm + 1);
-         bcopy ((char *) nm, o, p - nm);
+         memcpy (o, nm, p - nm);
          o [p - nm] = 0;
 
          BLOCK_INPUT;
@@ -1259,7 +1226,7 @@ filesystem tree, not (expand-file-name ".."  dirname).  */)
          )
        {
          unsigned char *temp = (unsigned char *) alloca (length);
-         bcopy (newdir, temp, length - 1);
+         memcpy (temp, newdir, length - 1);
          temp[length - 1] = 0;
          newdir = temp;
        }
@@ -1382,7 +1349,7 @@ filesystem tree, not (expand-file-name ".."  dirname).  */)
        target[0] = '/';
        target[1] = ':';
       }
-    CORRECT_DIR_SEPS (target);
+    dostounix_filename (target);
 #endif /* DOS_NT */
 
     result = make_specified_string (target, -1, o - target, multibyte);
@@ -1478,11 +1445,11 @@ See also the function `substitute-in-file-name'.")
        /* Get past ~ to user */
        unsigned char *user = nm + 1;
        /* Find end of name. */
-       unsigned char *ptr = (unsigned char *) index (user, '/');
+       unsigned char *ptr = (unsigned char *) strchr (user, '/');
        int len = ptr ? ptr - user : strlen (user);
        /* Copy the user name into temp storage. */
        o = (unsigned char *) alloca (len + 1);
-       bcopy ((char *) user, o, len);
+       memcpy (o, user, len);
        o[len] = 0;
 
        /* Look up the user name. */
@@ -1565,8 +1532,7 @@ See also the function `substitute-in-file-name'.")
 \f
 /* If /~ or // appears, discard everything through first slash.  */
 static int
-file_name_absolute_p (filename)
-     const unsigned char *filename;
+file_name_absolute_p (const unsigned char *filename)
 {
   return
     (IS_DIRECTORY_SEP (*filename) || *filename == '~'
@@ -1578,8 +1544,7 @@ file_name_absolute_p (filename)
 }
 
 static unsigned char *
-search_embedded_absfilename (nm, endp)
-     unsigned char *nm, *endp;
+search_embedded_absfilename (unsigned char *nm, unsigned char *endp)
 {
   unsigned char *p, *s;
 
@@ -1600,7 +1565,7 @@ search_embedded_absfilename (nm, endp)
            {
              unsigned char *o = alloca (s - p + 1);
              struct passwd *pw;
-             bcopy (p, o, s - p);
+             memcpy (o, p, s - p);
              o [s - p] = 0;
 
              /* If we have ~user and `user' exists, discard
@@ -1630,8 +1595,7 @@ the entire variable name in braces.
 If `/~' appears, all of FILENAME through that `/' is discarded.
 If `//' appears, everything up to and including the first of
 those `/' is discarded.  */)
-     (filename)
-     Lisp_Object filename;
+  (Lisp_Object filename)
 {
   unsigned char *nm;
 
@@ -1657,10 +1621,10 @@ those `/' is discarded.  */)
      decode of environment variables, causing the original Lisp_String
      data to be relocated.  */
   nm = (unsigned char *) alloca (SBYTES (filename) + 1);
-  bcopy (SDATA (filename), nm, SBYTES (filename) + 1);
+  memcpy (nm, SDATA (filename), SBYTES (filename) + 1);
 
 #ifdef DOS_NT
-  CORRECT_DIR_SEPS (nm);
+  dostounix_filename (nm);
   substituted = (strcmp (nm, SDATA (filename)) != 0);
 #endif
   endp = nm + SBYTES (filename);
@@ -1830,8 +1794,7 @@ those `/' is discarded.  */)
    (directory-file-name (expand-file-name FOO)).  */
 
 Lisp_Object
-expand_and_dir_to_file (filename, defdir)
-     Lisp_Object filename, defdir;
+expand_and_dir_to_file (Lisp_Object filename, Lisp_Object defdir)
 {
   register Lisp_Object absname;
 
@@ -1860,12 +1823,7 @@ expand_and_dir_to_file (filename, defdir)
    If QUICK is nonzero, we ask for y or n, not yes or no.  */
 
 void
-barf_or_query_if_file_exists (absname, querystring, interactive, statptr, quick)
-     Lisp_Object absname;
-     unsigned char *querystring;
-     int interactive;
-     struct stat *statptr;
-     int quick;
+barf_or_query_if_file_exists (Lisp_Object absname, const unsigned char *querystring, int interactive, struct stat *statptr, int quick)
 {
   register Lisp_Object tem, encoded_filename;
   struct stat statbuf;
@@ -1902,7 +1860,7 @@ barf_or_query_if_file_exists (absname, querystring, interactive, statptr, quick)
   return;
 }
 
-DEFUN ("copy-file", Fcopy_file, Scopy_file, 2, 5,
+DEFUN ("copy-file", Fcopy_file, Scopy_file, 2, 6,
        "fCopy file: \nGCopy %s to file: \np\nP",
        doc: /* Copy FILE to NEWNAME.  Both args must be strings.
 If NEWNAME names a directory, copy FILE there.
@@ -1924,10 +1882,11 @@ last-modified time as the old one.  (This works on only some systems.)
 A prefix arg makes KEEP-TIME non-nil.
 
 If PRESERVE-UID-GID is non-nil, we try to transfer the
-uid and gid of FILE to NEWNAME.  */)
-  (file, newname, ok_if_already_exists, keep_time, preserve_uid_gid)
-     Lisp_Object file, newname, ok_if_already_exists, keep_time;
-     Lisp_Object preserve_uid_gid;
+uid and gid of FILE to NEWNAME.
+
+If PRESERVE-SELINUX-CONTEXT is non-nil and SELinux is enabled
+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, n;
   char buf[16 * 1024];
@@ -1937,6 +1896,10 @@ uid and gid of FILE to NEWNAME.  */)
   int count = SPECPDL_INDEX ();
   int input_file_statable_p;
   Lisp_Object encoded_file, encoded_newname;
+#if HAVE_LIBSELINUX
+  security_context_t con;
+  int fail, conlength = 0;
+#endif
 
   encoded_file = encoded_newname = Qnil;
   GCPRO4 (file, newname, encoded_file, encoded_newname);
@@ -1957,8 +1920,9 @@ uid and gid of FILE to NEWNAME.  */)
   if (NILP (handler))
     handler = Ffind_file_name_handler (newname, Qcopy_file);
   if (!NILP (handler))
-    RETURN_UNGCPRO (call6 (handler, Qcopy_file, file, newname,
-                          ok_if_already_exists, keep_time, preserve_uid_gid));
+    RETURN_UNGCPRO (call7 (handler, Qcopy_file, file, newname,
+                          ok_if_already_exists, keep_time, preserve_uid_gid,
+                          preserve_selinux_context));
 
   encoded_file = ENCODE_FILE (file);
   encoded_newname = ENCODE_FILE (newname);
@@ -2012,7 +1976,15 @@ uid and gid of FILE to NEWNAME.  */)
      copyable by us. */
   input_file_statable_p = (fstat (ifd, &st) >= 0);
 
-#if !defined (MSDOS) || __DJGPP__ > 1
+#if HAVE_LIBSELINUX
+  if (!NILP (preserve_selinux_context) && is_selinux_enabled ())
+    {
+      conlength = fgetfilecon (ifd, &con);
+      if (conlength == -1)
+       report_file_error ("Doing fgetfilecon", Fcons (file, Qnil));
+    }
+#endif
+
   if (out_st.st_mode != 0
       && st.st_dev == out_st.st_dev && st.st_ino == out_st.st_ino)
     {
@@ -2020,7 +1992,6 @@ uid and gid of FILE to NEWNAME.  */)
       report_file_error ("Input and output files are the same",
                         Fcons (file, Fcons (newname, Qnil)));
     }
-#endif
 
 #if defined (S_ISREG) && defined (S_ISLNK)
   if (input_file_statable_p)
@@ -2071,6 +2042,18 @@ uid and gid of FILE to NEWNAME.  */)
     }
 #endif /* not MSDOS */
 
+#if HAVE_LIBSELINUX
+  if (conlength > 0)
+    {
+      /* Set the modified context back to the file. */
+      fail = fsetfilecon (ofd, con);
+      if (fail)
+       report_file_error ("Doing fsetfilecon", Fcons (newname, Qnil));
+
+      freecon (con);
+    }
+#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));
@@ -2091,7 +2074,7 @@ uid and gid of FILE to NEWNAME.  */)
 
   emacs_close (ifd);
 
-#if defined (__DJGPP__) && __DJGPP__ > 1
+#ifdef MSDOS
   if (input_file_statable_p)
     {
       /* In DJGPP v2.0 and later, fstat usually returns true file mode bits,
@@ -2101,7 +2084,7 @@ uid and gid of FILE to NEWNAME.  */)
       if ((_djstat_flags & _STFAIL_WRITEBIT) == 0)
        chmod (SDATA (encoded_newname), st.st_mode & 07777);
     }
-#endif /* DJGPP version 2 or newer */
+#endif /* MSDOS */
 #endif /* not WINDOWSNT */
 
   /* Discard the unwind protects.  */
@@ -2114,8 +2097,7 @@ uid and gid of FILE to NEWNAME.  */)
 DEFUN ("make-directory-internal", Fmake_directory_internal,
        Smake_directory_internal, 1, 1, 0,
        doc: /* Create a new directory named DIRECTORY.  */)
-     (directory)
-     Lisp_Object directory;
+  (Lisp_Object directory)
 {
   const unsigned char *dir;
   Lisp_Object handler;
@@ -2145,8 +2127,7 @@ DEFUN ("make-directory-internal", Fmake_directory_internal,
 DEFUN ("delete-directory-internal", Fdelete_directory_internal,
        Sdelete_directory_internal, 1, 1, 0,
        doc: /* Delete the directory named DIRECTORY.  Does not follow symlinks.  */)
-     (directory)
-     Lisp_Object directory;
+  (Lisp_Object directory)
 {
   const unsigned char *dir;
   Lisp_Object handler;
@@ -2154,12 +2135,7 @@ DEFUN ("delete-directory-internal", Fdelete_directory_internal,
 
   CHECK_STRING (directory);
   directory = Fdirectory_file_name (Fexpand_file_name (directory, Qnil));
-
-  if (delete_by_moving_to_trash)
-    return call1 (Qmove_file_to_trash, directory);
-
   encoded_dir = ENCODE_FILE (directory);
-
   dir = SDATA (encoded_dir);
 
   if (rmdir (dir) != 0)
@@ -2168,11 +2144,20 @@ DEFUN ("delete-directory-internal", Fdelete_directory_internal,
   return Qnil;
 }
 
-DEFUN ("delete-file", Fdelete_file, Sdelete_file, 1, 1, "fDelete file: ",
+DEFUN ("delete-file", Fdelete_file, Sdelete_file, 1, 2,
+       "(list (read-file-name \
+                (if (and delete-by-moving-to-trash (null current-prefix-arg)) \
+                    \"Move file to trash: \" \"Delete file: \") \
+                nil default-directory (confirm-nonexistent-file-or-buffer)) \
+              (null current-prefix-arg))",
        doc: /* Delete file named FILENAME.  If it is a symlink, remove the symlink.
-If file has multiple names, it continues to exist with the other names.  */)
-     (filename)
-     Lisp_Object filename;
+If file has multiple names, it continues to exist with the other names.
+TRASH non-nil means to trash the file instead of deleting, provided
+`delete-by-moving-to-trash' is non-nil.
+
+When called interactively, TRASH is t if no prefix argument is given.
+With a prefix argument, TRASH is nil.  */)
+  (Lisp_Object filename, Lisp_Object trash)
 {
   Lisp_Object handler;
   Lisp_Object encoded_file;
@@ -2189,9 +2174,9 @@ If file has multiple names, it continues to exist with the other names.  */)
 
   handler = Ffind_file_name_handler (filename, Qdelete_file);
   if (!NILP (handler))
-    return call2 (handler, Qdelete_file, filename);
+    return call3 (handler, Qdelete_file, filename, trash);
 
-  if (delete_by_moving_to_trash)
+  if (delete_by_moving_to_trash && !NILP (trash))
     return call1 (Qmove_file_to_trash, filename);
 
   encoded_file = ENCODE_FILE (filename);
@@ -2202,20 +2187,20 @@ If file has multiple names, it continues to exist with the other names.  */)
 }
 
 static Lisp_Object
-internal_delete_file_1 (ignore)
-     Lisp_Object ignore;
+internal_delete_file_1 (Lisp_Object ignore)
 {
   return Qt;
 }
 
-/* Delete file FILENAME, returning 1 if successful and 0 if failed.  */
+/* Delete file FILENAME, returning 1 if successful and 0 if failed.
+   This ignores `delete-by-moving-to-trash'.  */
 
 int
-internal_delete_file (filename)
-     Lisp_Object filename;
+internal_delete_file (Lisp_Object filename)
 {
   Lisp_Object tem;
-  tem = internal_condition_case_1 (Fdelete_file, filename,
+
+  tem = internal_condition_case_2 (Fdelete_file, filename, Qnil,
                                   Qt, internal_delete_file_1);
   return NILP (tem);
 }
@@ -2228,8 +2213,7 @@ Signals a `file-already-exists' error if a file NEWNAME already exists
 unless optional third argument OK-IF-ALREADY-EXISTS is non-nil.
 A number as third arg means request confirmation if NEWNAME already exists.
 This is what happens in interactive use with M-x.  */)
-     (file, newname, ok_if_already_exists)
-     Lisp_Object file, newname, ok_if_already_exists;
+  (Lisp_Object file, Lisp_Object newname, Lisp_Object ok_if_already_exists)
 {
   Lisp_Object handler;
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
@@ -2297,7 +2281,7 @@ This is what happens in interactive use with M-x.  */)
               have copy-file prompt again.  */
            Fcopy_file (file, newname,
                        NILP (ok_if_already_exists) ? Qnil : Qt,
-                       Qt, Qt);
+                       Qt, Qt, Qt);
 
          count = SPECPDL_INDEX ();
          specbind (Qdelete_by_moving_to_trash, Qnil);
@@ -2309,7 +2293,7 @@ This is what happens in interactive use with M-x.  */)
              )
            call2 (Qdelete_directory, file, Qt);
          else
-           Fdelete_file (file);
+           Fdelete_file (file, Qnil);
          unbind_to (count, Qnil);
        }
       else
@@ -2326,8 +2310,7 @@ Signals a `file-already-exists' error if a file NEWNAME already exists
 unless optional third argument OK-IF-ALREADY-EXISTS is non-nil.
 A number as third arg means request confirmation if NEWNAME already exists.
 This is what happens in interactive use with M-x.  */)
-     (file, newname, ok_if_already_exists)
-     Lisp_Object file, newname, ok_if_already_exists;
+  (Lisp_Object file, Lisp_Object newname, Lisp_Object ok_if_already_exists)
 {
   Lisp_Object handler;
   Lisp_Object encoded_file, encoded_newname;
@@ -2382,8 +2365,7 @@ Signals a `file-already-exists' error if a file LINKNAME already exists
 unless optional third argument OK-IF-ALREADY-EXISTS is non-nil.
 A number as third arg means request confirmation if LINKNAME already exists.
 This happens for interactive use with M-x.  */)
-     (filename, linkname, ok_if_already_exists)
-     Lisp_Object filename, linkname, ok_if_already_exists;
+  (Lisp_Object filename, Lisp_Object linkname, Lisp_Object ok_if_already_exists)
 {
   Lisp_Object handler;
   Lisp_Object encoded_filename, encoded_linkname;
@@ -2458,8 +2440,7 @@ DEFUN ("file-name-absolute-p", Ffile_name_absolute_p, Sfile_name_absolute_p,
        1, 1, 0,
        doc: /* Return t if file FILENAME specifies an absolute file name.
 On Unix, this is a name starting with a `/' or a `~'.  */)
-     (filename)
-     Lisp_Object filename;
+  (Lisp_Object filename)
 {
   CHECK_STRING (filename);
   return file_name_absolute_p (SDATA (filename)) ? Qt : Qnil;
@@ -2468,8 +2449,7 @@ On Unix, this is a name starting with a `/' or a `~'.  */)
 /* Return nonzero if file FILENAME exists and can be executed.  */
 
 static int
-check_executable (filename)
-     char *filename;
+check_executable (char *filename)
 {
 #ifdef DOS_NT
   int len = strlen (filename);
@@ -2477,16 +2457,7 @@ check_executable (filename)
   struct stat st;
   if (stat (filename, &st) < 0)
     return 0;
-#if defined (WINDOWSNT) || (defined (MSDOS) && __DJGPP__ > 1)
   return ((st.st_mode & S_IEXEC) != 0);
-#else
-  return (S_ISREG (st.st_mode)
-         && len >= 5
-         && (xstrcasecmp ((suffix = filename + len-4), ".com") == 0
-             || xstrcasecmp (suffix, ".exe") == 0
-             || xstrcasecmp (suffix, ".bat") == 0)
-         || (st.st_mode & S_IFMT) == S_IFDIR);
-#endif /* not WINDOWSNT */
 #else /* not DOS_NT */
 #ifdef HAVE_EUIDACCESS
   return (euidaccess (filename, 1) >= 0);
@@ -2502,8 +2473,7 @@ check_executable (filename)
 /* Return nonzero if file FILENAME exists and can be written.  */
 
 static int
-check_writable (filename)
-     char *filename;
+check_writable (const char *filename)
 {
 #ifdef MSDOS
   struct stat st;
@@ -2529,8 +2499,7 @@ DEFUN ("file-exists-p", Ffile_exists_p, Sfile_exists_p, 1, 1, 0,
 See also `file-readable-p' and `file-attributes'.
 This returns nil for a symlink to a nonexistent file.
 Use `file-symlink-p' to test for such links.  */)
-     (filename)
-     Lisp_Object filename;
+  (Lisp_Object filename)
 {
   Lisp_Object absname;
   Lisp_Object handler;
@@ -2553,8 +2522,7 @@ Use `file-symlink-p' to test for such links.  */)
 DEFUN ("file-executable-p", Ffile_executable_p, Sfile_executable_p, 1, 1, 0,
        doc: /* Return t if FILENAME can be executed by you.
 For a directory, this means you can access files in that directory.  */)
-     (filename)
-     Lisp_Object filename;
+  (Lisp_Object filename)
 {
   Lisp_Object absname;
   Lisp_Object handler;
@@ -2576,8 +2544,7 @@ For a directory, this means you can access files in that directory.  */)
 DEFUN ("file-readable-p", Ffile_readable_p, Sfile_readable_p, 1, 1, 0,
        doc: /* Return t if file FILENAME exists and you can read it.
 See also `file-exists-p' and `file-attributes'.  */)
-     (filename)
-     Lisp_Object filename;
+  (Lisp_Object filename)
 {
   Lisp_Object absname;
   Lisp_Object handler;
@@ -2626,8 +2593,7 @@ See also `file-exists-p' and `file-attributes'.  */)
    on the RT/PC.  */
 DEFUN ("file-writable-p", Ffile_writable_p, Sfile_writable_p, 1, 1, 0,
        doc: /* Return t if file FILENAME can be written or created by you.  */)
-     (filename)
-     Lisp_Object filename;
+  (Lisp_Object filename)
 {
   Lisp_Object absname, dir, encoded;
   Lisp_Object handler;
@@ -2671,8 +2637,7 @@ DEFUN ("access-file", Faccess_file, Saccess_file, 2, 2, 0,
        doc: /* Access file FILENAME, and get an error if that does not work.
 The second argument STRING is used in the error message.
 If there is no error, returns nil.  */)
-     (filename, string)
-     Lisp_Object filename, string;
+  (Lisp_Object filename, Lisp_Object string)
 {
   Lisp_Object handler, encoded_filename, absname;
   int fd;
@@ -2705,8 +2670,7 @@ Otherwise it returns nil.
 
 This function returns t when given the name of a symlink that
 points to a nonexistent file.  */)
-     (filename)
-     Lisp_Object filename;
+  (Lisp_Object filename)
 {
   Lisp_Object handler;
 
@@ -2734,7 +2698,7 @@ points to a nonexistent file.  */)
     {
       bufsize *= 2;
       buf = (char *) xrealloc (buf, bufsize);
-      bzero (buf, bufsize);
+      memset (buf, 0, bufsize);
 
       errno = 0;
       valsize = readlink (SDATA (filename), buf, bufsize);
@@ -2755,7 +2719,7 @@ points to a nonexistent file.  */)
   while (valsize >= bufsize);
 
   val = make_string (buf, valsize);
-  if (buf[0] == '/' && index (buf, ':'))
+  if (buf[0] == '/' && strchr (buf, ':'))
     val = concat2 (build_string ("/:"), val);
   xfree (buf);
   val = DECODE_FILE (val);
@@ -2770,8 +2734,7 @@ DEFUN ("file-directory-p", Ffile_directory_p, Sfile_directory_p, 1, 1, 0,
        doc: /* Return t if FILENAME names an existing directory.
 Symbolic links to directories count as directories.
 See `file-symlink-p' to distinguish symlinks.  */)
-     (filename)
-     Lisp_Object filename;
+  (Lisp_Object filename)
 {
   register Lisp_Object absname;
   struct stat st;
@@ -2800,8 +2763,7 @@ directory as a buffer's current directory, this predicate must return true.
 A directory name spec may be given instead; then the value is t
 if the directory so specified exists and really is a readable and
 searchable directory.  */)
-     (filename)
-     Lisp_Object filename;
+  (Lisp_Object filename)
 {
   Lisp_Object handler;
   int tem;
@@ -2825,8 +2787,7 @@ DEFUN ("file-regular-p", Ffile_regular_p, Sfile_regular_p, 1, 1, 0,
 This is the sort of file that holds an ordinary stream of data bytes.
 Symbolic links to regular files count as regular files.
 See `file-symlink-p' to distinguish symlinks.  */)
-     (filename)
-     Lisp_Object filename;
+  (Lisp_Object filename)
 {
   register Lisp_Object absname;
   struct stat st;
@@ -2863,11 +2824,142 @@ See `file-symlink-p' to distinguish symlinks.  */)
 #endif
 }
 \f
+DEFUN ("file-selinux-context", Ffile_selinux_context,
+       Sfile_selinux_context, 1, 1, 0,
+       doc: /* Return SELinux context of file named FILENAME,
+as a list ("user", "role", "type", "range"). Return (nil, nil, nil, nil)
+if file does not exist, is not accessible, or SELinux is disabled */)
+  (Lisp_Object filename)
+{
+  Lisp_Object absname;
+  Lisp_Object values[4];
+  Lisp_Object handler;
+#if HAVE_LIBSELINUX
+  security_context_t con;
+  int conlength;
+  context_t context;
+#endif
+
+  absname = expand_and_dir_to_file (filename, current_buffer->directory);
+
+  /* If the file name has special constructs in it,
+     call the corresponding file handler.  */
+  handler = Ffind_file_name_handler (absname, Qfile_selinux_context);
+  if (!NILP (handler))
+    return call2 (handler, Qfile_selinux_context, absname);
+
+  absname = ENCODE_FILE (absname);
+
+  values[0] = Qnil;
+  values[1] = Qnil;
+  values[2] = Qnil;
+  values[3] = Qnil;
+#if HAVE_LIBSELINUX
+  if (is_selinux_enabled ())
+    {
+      conlength = lgetfilecon (SDATA (absname), &con);
+      if (conlength > 0)
+       {
+         context = context_new (con);
+         if (context_user_get (context))
+           values[0] = build_string (context_user_get (context));
+         if (context_role_get (context))
+           values[1] = build_string (context_role_get (context));
+         if (context_type_get (context))
+           values[2] = build_string (context_type_get (context));
+         if (context_range_get (context))
+           values[3] = build_string (context_range_get (context));
+         context_free (context);
+       }
+      if (con)
+       freecon (con);
+    }
+#endif
+
+  return Flist (sizeof(values) / sizeof(values[0]), values);
+}
+\f
+DEFUN ("set-file-selinux-context", Fset_file_selinux_context,
+       Sset_file_selinux_context, 2, 2, 0,
+       doc: /* Set SELinux context of file named FILENAME to CONTEXT
+as a list ("user", "role", "type", "range"). Has no effect if SELinux
+is disabled. */)
+  (Lisp_Object filename, Lisp_Object context)
+{
+  Lisp_Object absname, encoded_absname;
+  Lisp_Object handler;
+  Lisp_Object user = CAR_SAFE (context);
+  Lisp_Object role = CAR_SAFE (CDR_SAFE (context));
+  Lisp_Object type = CAR_SAFE (CDR_SAFE (CDR_SAFE (context)));
+  Lisp_Object range = CAR_SAFE (CDR_SAFE (CDR_SAFE (CDR_SAFE (context))));
+#if HAVE_LIBSELINUX
+  security_context_t con;
+  int fail, conlength;
+  context_t parsed_con;
+#endif
+
+  absname = Fexpand_file_name (filename, current_buffer->directory);
+
+  /* If the file name has special constructs in it,
+     call the corresponding file handler.  */
+  handler = Ffind_file_name_handler (absname, Qset_file_selinux_context);
+  if (!NILP (handler))
+    return call3 (handler, Qset_file_selinux_context, absname, context);
+
+  encoded_absname = ENCODE_FILE (absname);
+
+#if HAVE_LIBSELINUX
+  if (is_selinux_enabled ())
+    {
+      /* Get current file context. */
+      conlength = lgetfilecon (SDATA (encoded_absname), &con);
+      if (conlength > 0)
+       {
+         parsed_con = context_new (con);
+         /* Change the parts defined in the parameter.*/
+         if (STRINGP (user))
+           {
+             if (context_user_set (parsed_con, SDATA (user)))
+               error ("Doing context_user_set");
+           }
+         if (STRINGP (role))
+           {
+             if (context_role_set (parsed_con, SDATA (role)))
+               error ("Doing context_role_set");
+           }
+         if (STRINGP (type))
+           {
+             if (context_type_set (parsed_con, SDATA (type)))
+               error ("Doing context_type_set");
+           }
+         if (STRINGP (range))
+           {
+             if (context_range_set (parsed_con, SDATA (range)))
+               error ("Doing context_range_set");
+           }
+
+         /* Set the modified context back to the file. */
+         fail = lsetfilecon (SDATA (encoded_absname), context_str (parsed_con));
+         if (fail)
+           report_file_error ("Doing lsetfilecon", Fcons (absname, Qnil));
+
+         context_free (parsed_con);
+       }
+      else
+       report_file_error("Doing lgetfilecon", Fcons (absname, Qnil));
+
+      if (con)
+       freecon (con);
+    }
+#endif
+
+  return Qnil;
+}
+\f
 DEFUN ("file-modes", Ffile_modes, Sfile_modes, 1, 1, 0,
        doc: /* Return mode bits of file named FILENAME, as an integer.
 Return nil, if file does not exist or is not accessible.  */)
-     (filename)
-     Lisp_Object filename;
+  (Lisp_Object filename)
 {
   Lisp_Object absname;
   struct stat st;
@@ -2885,10 +2977,6 @@ Return nil, if file does not exist or is not accessible.  */)
 
   if (stat (SDATA (absname), &st) < 0)
     return Qnil;
-#if defined (MSDOS) && __DJGPP__ < 2
-  if (check_executable (SDATA (absname)))
-    st.st_mode |= S_IEXEC;
-#endif /* MSDOS && __DJGPP__ < 2 */
 
   return make_number (st.st_mode & 07777);
 }
@@ -2901,8 +2989,7 @@ Only the 12 low bits of MODE are used.
 
 Interactively, mode bits are read by `read-file-modes', which accepts
 symbolic notation, like the `chmod' command from GNU Coreutils.  */)
-  (filename, mode)
-     Lisp_Object filename, mode;
+  (Lisp_Object filename, Lisp_Object mode)
 {
   Lisp_Object absname, encoded_absname;
   Lisp_Object handler;
@@ -2928,8 +3015,7 @@ DEFUN ("set-default-file-modes", Fset_default_file_modes, Sset_default_file_mode
        doc: /* Set the file permission bits for newly created files.
 The argument MODE should be an integer; only the low 9 bits are used.
 This setting is inherited by subprocesses.  */)
-     (mode)
-     Lisp_Object mode;
+  (Lisp_Object mode)
 {
   CHECK_NUMBER (mode);
 
@@ -2941,7 +3027,7 @@ This setting is inherited by subprocesses.  */)
 DEFUN ("default-file-modes", Fdefault_file_modes, Sdefault_file_modes, 0, 0, 0,
        doc: /* Return the default file protection for created files.
 The value is an integer.  */)
-     ()
+  (void)
 {
   int realmask;
   Lisp_Object value;
@@ -2953,7 +3039,6 @@ The value is an integer.  */)
   return value;
 }
 \f
-extern int lisp_time_argument P_ ((Lisp_Object, time_t *, int *));
 
 DEFUN ("set-file-times", Fset_file_times, Sset_file_times, 1, 2, 0,
        doc: /* Set times of file FILENAME to TIME.
@@ -2961,8 +3046,7 @@ Set both access and modification times.
 Return t on success, else nil.
 Use the current time if TIME is nil.  TIME is in the format of
 `current-time'. */)
-  (filename, time)
-     Lisp_Object filename, time;
+  (Lisp_Object filename, Lisp_Object time)
 {
   Lisp_Object absname, encoded_absname;
   Lisp_Object handler;
@@ -3009,7 +3093,7 @@ Use the current time if TIME is nil.  TIME is in the format of
 #ifdef HAVE_SYNC
 DEFUN ("unix-sync", Funix_sync, Sunix_sync, 0, 0, "",
        doc: /* Tell Unix to finish all pending disk updates.  */)
-     ()
+  (void)
 {
   sync ();
   return Qnil;
@@ -3021,8 +3105,7 @@ DEFUN ("file-newer-than-file-p", Ffile_newer_than_file_p, Sfile_newer_than_file_
        doc: /* Return t if file FILE1 is newer than file FILE2.
 If FILE1 does not exist, the answer is nil;
 otherwise, if FILE2 does not exist, the answer is t.  */)
-     (file1, file2)
-     Lisp_Object file1, file2;
+  (Lisp_Object file1, Lisp_Object file2)
 {
   Lisp_Object absname1, absname2;
   struct stat st;
@@ -3087,8 +3170,7 @@ Lisp_Object Qfind_buffer_file_type;
        o set back the buffer multibyteness.  */
 
 static Lisp_Object
-decide_coding_unwind (unwind_data)
-     Lisp_Object unwind_data;
+decide_coding_unwind (Lisp_Object unwind_data)
 {
   Lisp_Object multibyte, undo_list, buffer;
 
@@ -3120,12 +3202,12 @@ static EMACS_INT non_regular_nbytes;
 
 
 /* Read from a non-regular file.
-   Read non_regular_trytry bytes max from non_regular_fd.
+   Read non_regular_nbytes bytes max from non_regular_fd.
    Non_regular_inserted specifies where to put the read bytes.
    Value is the number of bytes read.  */
 
 static Lisp_Object
-read_non_regular ()
+read_non_regular (Lisp_Object ignore)
 {
   EMACS_INT nbytes;
 
@@ -3143,7 +3225,7 @@ read_non_regular ()
    in insert-file-contents.  */
 
 static Lisp_Object
-read_non_regular_quit ()
+read_non_regular_quit (Lisp_Object ignore)
 {
   return Qnil;
 }
@@ -3172,8 +3254,7 @@ the number of characters that replace previous buffer contents.
 This function does code conversion according to the value of
 `coding-system-for-read' or `file-coding-system-alist', and sets the
 variable `last-coding-system-used' to the coding system actually used.  */)
-     (filename, visit, beg, end, replace)
-     Lisp_Object filename, visit, beg, end, replace;
+  (Lisp_Object filename, Lisp_Object visit, Lisp_Object beg, Lisp_Object end, Lisp_Object replace)
 {
   struct stat st;
   register int fd;
@@ -3709,7 +3790,7 @@ variable `last-coding-system-used' to the coding system actually used.  */)
                                  conversion_buffer);
          unprocessed = coding.carryover_bytes;
          if (coding.carryover_bytes > 0)
-           bcopy (coding.carryover, read_buf, unprocessed);
+           memcpy (read_buf, coding.carryover, unprocessed);
        }
       UNGCPRO;
       emacs_close (fd);
@@ -4115,6 +4196,7 @@ variable `last-coding-system-used' to the coding system actually used.  */)
       if (NILP (handler))
        {
          current_buffer->modtime = st.st_mtime;
+         current_buffer->modtime_size = st.st_size;
          current_buffer->filename = orig_filename;
        }
 
@@ -4296,11 +4378,10 @@ variable `last-coding-system-used' to the coding system actually used.  */)
   RETURN_UNGCPRO (unbind_to (count, val));
 }
 \f
-static Lisp_Object build_annotations P_ ((Lisp_Object, Lisp_Object));
+static Lisp_Object build_annotations (Lisp_Object, Lisp_Object);
 
 static Lisp_Object
-build_annotations_unwind (arg)
-     Lisp_Object arg;
+build_annotations_unwind (Lisp_Object arg)
 {
   Vwrite_region_annotation_buffers = arg;
   return Qnil;
@@ -4309,10 +4390,9 @@ build_annotations_unwind (arg)
 /* Decide the coding-system to encode the data with.  */
 
 static Lisp_Object
-choose_write_coding_system (start, end, filename,
-                           append, visit, lockname, coding)
-     Lisp_Object start, end, filename, append, visit, lockname;
-     struct coding_system *coding;
+choose_write_coding_system (Lisp_Object start, Lisp_Object end, Lisp_Object filename,
+                           Lisp_Object append, Lisp_Object visit, Lisp_Object lockname,
+                           struct coding_system *coding)
 {
   Lisp_Object val;
   Lisp_Object eol_parent = Qnil;
@@ -4453,8 +4533,7 @@ This does code conversion according to the value of
 
 This calls `write-region-annotate-functions' at the start, and
 `write-region-post-annotation-function' at the end.  */)
-     (start, end, filename, append, visit, lockname, mustbenew)
-     Lisp_Object start, end, filename, append, visit, lockname, mustbenew;
+  (Lisp_Object start, Lisp_Object end, Lisp_Object filename, Lisp_Object append, Lisp_Object visit, Lisp_Object lockname, Lisp_Object mustbenew)
 {
   register int desc;
   int failure;
@@ -4718,7 +4797,10 @@ This calls `write-region-annotate-functions' at the start, and
      to avoid a "file has changed on disk" warning on
      next attempt to save.  */
   if (visiting)
-    current_buffer->modtime = st.st_mtime;
+    {
+      current_buffer->modtime = st.st_mtime;
+      current_buffer->modtime_size = st.st_size;
+    }
 
   if (failure)
     error ("IO error writing %s: %s", SDATA (filename),
@@ -4752,12 +4834,11 @@ This calls `write-region-annotate-functions' at the start, and
   return Qnil;
 }
 \f
-Lisp_Object merge ();
+Lisp_Object merge (Lisp_Object, Lisp_Object, Lisp_Object);
 
 DEFUN ("car-less-than-car", Fcar_less_than_car, Scar_less_than_car, 2, 2, 0,
        doc: /* Return t if (car A) is numerically less than (car B).  */)
-     (a, b)
-     Lisp_Object a, b;
+  (Lisp_Object a, Lisp_Object b)
 {
   return Flss (Fcar (a), Fcar (b));
 }
@@ -4771,8 +4852,7 @@ DEFUN ("car-less-than-car", Fcar_less_than_car, Scar_less_than_car, 2, 2, 0,
    as save-excursion would do.  */
 
 static Lisp_Object
-build_annotations (start, end)
-     Lisp_Object start, end;
+build_annotations (Lisp_Object start, Lisp_Object end)
 {
   Lisp_Object annotations;
   Lisp_Object p, res;
@@ -4861,13 +4941,7 @@ build_annotations (start, end)
    The return value is negative in case of system call failure.  */
 
 static int
-a_write (desc, string, pos, nchars, annot, coding)
-     int desc;
-     Lisp_Object string;
-     register int nchars;
-     int pos;
-     Lisp_Object *annot;
-     struct coding_system *coding;
+a_write (int desc, Lisp_Object string, int pos, register int nchars, Lisp_Object *annot, struct coding_system *coding)
 {
   Lisp_Object tem;
   int nextpos;
@@ -4911,11 +4985,7 @@ a_write (desc, string, pos, nchars, annot, coding)
    are indexes to the string STRING.  */
 
 static int
-e_write (desc, string, start, end, coding)
-     int desc;
-     Lisp_Object string;
-     int start, end;
-     struct coding_system *coding;
+e_write (int desc, Lisp_Object string, int start, int end, struct coding_system *coding)
 {
   if (STRINGP (string))
     {
@@ -4995,8 +5065,7 @@ DEFUN ("verify-visited-file-modtime", Fverify_visited_file_modtime,
        doc: /* Return t if last mod time of BUF's visited file matches what BUF records.
 This means that the file has not been changed since it was visited or saved.
 See Info node `(elisp)Modification Time' for more details.  */)
-     (buf)
-     Lisp_Object buf;
+  (Lisp_Object buf)
 {
   struct buffer *b;
   struct stat st;
@@ -5027,11 +5096,13 @@ See Info node `(elisp)Modification Time' for more details.  */)
       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 == b->modtime + 1
-             || st.st_mtime == b->modtime - 1)))
+  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 == b->modtime + 1
+              || st.st_mtime == b->modtime - 1)))
+      && (st.st_size == b->modtime_size
+          || b->modtime_size < 0))
     return Qt;
   return Qnil;
 }
@@ -5040,9 +5111,10 @@ DEFUN ("clear-visited-file-modtime", Fclear_visited_file_modtime,
        Sclear_visited_file_modtime, 0, 0, 0,
        doc: /* Clear out records of last mod time of visited file.
 Next attempt to save will certainly not complain of a discrepancy.  */)
-     ()
+  (void)
 {
   current_buffer->modtime = 0;
+  current_buffer->modtime_size = -1;
   return Qnil;
 }
 
@@ -5053,7 +5125,7 @@ The value is a list of the form (HIGH LOW), like the time values
 that `file-attributes' returns.  If the current buffer has no recorded
 file modification time, this function returns 0.
 See Info node `(elisp)Modification Time' for more details.  */)
-     ()
+  (void)
 {
   if (! current_buffer->modtime)
     return make_number (0);
@@ -5068,11 +5140,13 @@ 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).  */)
-     (time_list)
-     Lisp_Object time_list;
+  (Lisp_Object time_list)
 {
   if (!NILP (time_list))
-    current_buffer->modtime = cons_to_long (time_list);
+    {
+      current_buffer->modtime = cons_to_long (time_list);
+      current_buffer->modtime_size = -1;
+    }
   else
     {
       register Lisp_Object filename;
@@ -5091,15 +5165,17 @@ An argument specifies the modification time value to use
       filename = ENCODE_FILE (filename);
 
       if (stat (SDATA (filename), &st) >= 0)
-       current_buffer->modtime = st.st_mtime;
+        {
+         current_buffer->modtime = st.st_mtime;
+          current_buffer->modtime_size = st.st_size;
+        }
     }
 
   return Qnil;
 }
 \f
 Lisp_Object
-auto_save_error (error)
-     Lisp_Object error;
+auto_save_error (Lisp_Object error)
 {
   Lisp_Object args[3], msg;
   int i, nbytes;
@@ -5118,7 +5194,7 @@ auto_save_error (error)
   GCPRO1 (msg);
   nbytes = SBYTES (msg);
   SAFE_ALLOCA (msgbuf, char *, nbytes);
-  bcopy (SDATA (msg), msgbuf, nbytes);
+  memcpy (msgbuf, SDATA (msg), nbytes);
 
   for (i = 0; i < 3; ++i)
     {
@@ -5135,7 +5211,7 @@ auto_save_error (error)
 }
 
 Lisp_Object
-auto_save_1 ()
+auto_save_1 (void)
 {
   struct stat st;
   Lisp_Object modes;
@@ -5161,8 +5237,8 @@ auto_save_1 ()
 }
 
 static Lisp_Object
-do_auto_save_unwind (arg)  /* used as unwind-protect function */
-     Lisp_Object arg;
+do_auto_save_unwind (Lisp_Object arg)  /* used as unwind-protect function */
+                     
 {
   FILE *stream = (FILE *) XSAVE_VALUE (arg)->pointer;
   auto_saving = 0;
@@ -5176,16 +5252,15 @@ do_auto_save_unwind (arg)  /* used as unwind-protect function */
 }
 
 static Lisp_Object
-do_auto_save_unwind_1 (value)  /* used as unwind-protect function */
-     Lisp_Object value;
+do_auto_save_unwind_1 (Lisp_Object value)  /* used as unwind-protect function */
+                       
 {
   minibuffer_auto_raise = XINT (value);
   return Qnil;
 }
 
 static Lisp_Object
-do_auto_save_make_dir (dir)
-     Lisp_Object dir;
+do_auto_save_make_dir (Lisp_Object dir)
 {
   Lisp_Object mode;
 
@@ -5195,8 +5270,7 @@ do_auto_save_make_dir (dir)
 }
 
 static Lisp_Object
-do_auto_save_eh (ignore)
-     Lisp_Object ignore;
+do_auto_save_eh (Lisp_Object ignore)
 {
   return Qnil;
 }
@@ -5212,8 +5286,7 @@ Normally we run the normal hook `auto-save-hook' before saving.
 
 A non-nil NO-MESSAGE argument means do not print any message if successful.
 A non-nil CURRENT-ONLY argument means save only current buffer.  */)
-     (no_message, current_only)
-     Lisp_Object no_message, current_only;
+  (Lisp_Object no_message, Lisp_Object current_only)
 {
   struct buffer *old = current_buffer, *b;
   Lisp_Object tail, buf;
@@ -5414,7 +5487,7 @@ DEFUN ("set-buffer-auto-saved", Fset_buffer_auto_saved,
        Sset_buffer_auto_saved, 0, 0, 0,
        doc: /* Mark current buffer as auto-saved with its current text.
 No auto-save file will be written until the buffer changes again.  */)
-     ()
+  (void)
 {
   /* FIXME: This should not be called in indirect buffers, since
      they're not autosaved.  */
@@ -5427,7 +5500,7 @@ No auto-save file will be written until the buffer changes again.  */)
 DEFUN ("clear-buffer-auto-save-failure", Fclear_buffer_auto_save_failure,
        Sclear_buffer_auto_save_failure, 0, 0, 0,
        doc: /* Clear any record of a recent auto-save failure in the current buffer.  */)
-     ()
+  (void)
 {
   current_buffer->auto_save_failure_time = -1;
   return Qnil;
@@ -5439,7 +5512,7 @@ DEFUN ("recent-auto-save-p", Frecent_auto_save_p, Srecent_auto_save_p,
 More precisely, if it has been auto-saved since last read from or saved
 in the visited file.  If the buffer has no visited file,
 then any auto-save counts as "recent".  */)
-     ()
+  (void)
 {
   /* FIXME: maybe we should return nil for indirect buffers since
      they're never autosaved.  */
@@ -5453,7 +5526,7 @@ DEFUN ("next-read-file-uses-dialog-p", Fnext_read_file_uses_dialog_p,
        doc: /* Return t if a call to `read-file-name' will use a dialog.
 The return value is only relevant for a call to `read-file-name' that happens
 before any other event (mouse or keypress) is handled.  */)
-  ()
+  (void)
 {
 #if defined (USE_MOTIF) || defined (HAVE_NTGUI) || defined (USE_GTK)
   if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event))
@@ -5466,8 +5539,7 @@ before any other event (mouse or keypress) is handled.  */)
 }
 
 Lisp_Object
-Fread_file_name (prompt, dir, default_filename, mustmatch, initial, predicate)
-     Lisp_Object prompt, dir, default_filename, mustmatch, initial, predicate;
+Fread_file_name (Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename, Lisp_Object mustmatch, Lisp_Object initial, Lisp_Object predicate)
 {
   struct gcpro gcpro1, gcpro2;
   Lisp_Object args[7];
@@ -5485,7 +5557,7 @@ Fread_file_name (prompt, dir, default_filename, mustmatch, initial, predicate)
 
 \f
 void
-syms_of_fileio ()
+syms_of_fileio (void)
 {
   Qoperations = intern_c_string ("operations");
   Qexpand_file_name = intern_c_string ("expand-file-name");
@@ -5515,6 +5587,8 @@ syms_of_fileio ()
   Qfile_modes = intern_c_string ("file-modes");
   Qset_file_modes = intern_c_string ("set-file-modes");
   Qset_file_times = intern_c_string ("set-file-times");
+  Qfile_selinux_context = intern_c_string("file-selinux-context");
+  Qset_file_selinux_context = intern_c_string("set-file-selinux-context");
   Qfile_newer_than_file_p = intern_c_string ("file-newer-than-file-p");
   Qinsert_file_contents = intern_c_string ("insert-file-contents");
   Qwrite_region = intern_c_string ("write-region");
@@ -5550,6 +5624,8 @@ syms_of_fileio ()
   staticpro (&Qfile_modes);
   staticpro (&Qset_file_modes);
   staticpro (&Qset_file_times);
+  staticpro (&Qfile_selinux_context);
+  staticpro (&Qset_file_selinux_context);
   staticpro (&Qfile_newer_than_file_p);
   staticpro (&Qinsert_file_contents);
   staticpro (&Qwrite_region);
@@ -5616,11 +5692,6 @@ of file names regardless of the current language environment.  */);
   Fput (Qfile_date_error, Qerror_message,
        make_pure_c_string ("Cannot set file date"));
 
-  DEFVAR_LISP ("directory-sep-char", &Vdirectory_sep_char,
-              doc: /* Directory separator character for built-in functions that return file names.
-The value is always ?/.  Don't use this variable, just use `/'.  */);
-  XSETFASTINT (Vdirectory_sep_char, '/');
-
   DEFVAR_LISP ("file-name-handler-alist", &Vfile_name_handler_alist,
               doc: /* *Alist of elements (REGEXP . HANDLER) for file names handled specially.
 If a file name matches REGEXP, then all I/O on that file is done by calling
@@ -5743,8 +5814,10 @@ A non-nil value may result in data loss!  */);
 
   DEFVAR_BOOL ("delete-by-moving-to-trash", &delete_by_moving_to_trash,
                doc: /* Specifies whether to use the system's trash can.
-When non-nil, the function `move-file-to-trash' will be used by
-`delete-file' and `delete-directory'.  */);
+When non-nil, certain file deletion commands use the function
+`move-file-to-trash' instead of deleting files outright.
+This includes interactive calls to `delete-file' and
+`delete-directory' and the Dired deletion commands.  */);
   delete_by_moving_to_trash = 0;
   Qdelete_by_moving_to_trash = intern_c_string ("delete-by-moving-to-trash");
   Qmove_file_to_trash = intern_c_string ("move-file-to-trash");
@@ -5783,6 +5856,8 @@ When non-nil, the function `move-file-to-trash' will be used by
   defsubr (&Sfile_modes);
   defsubr (&Sset_file_modes);
   defsubr (&Sset_file_times);
+  defsubr (&Sfile_selinux_context);
+  defsubr (&Sset_file_selinux_context);
   defsubr (&Sset_default_file_modes);
   defsubr (&Sdefault_file_modes);
   defsubr (&Sfile_newer_than_file_p);
index 7c69ea954fc60a3f7ce049c7db1ef58df94ef879..15ed546bc506c58bd86f6fa47489fd5b5eed35f5 100644 (file)
@@ -34,9 +34,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #ifdef HAVE_FCNTL_H
 #include <fcntl.h>
 #endif
-#ifdef HAVE_STRING_H
 #include <string.h>
-#endif
 
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
@@ -47,9 +45,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #endif /* __FreeBSD__ */
 
 #include <errno.h>
-#ifndef errno
-extern int errno;
-#endif
 
 #include "lisp.h"
 #include "buffer.h"
@@ -122,14 +117,12 @@ Lisp_Object Vtemporary_file_directory;
 static time_t boot_time;
 static int boot_time_initialized;
 
-extern Lisp_Object Vshell_file_name;
-
 #ifdef BOOT_TIME
-static void get_boot_time_1 P_ ((char *, int));
+static void get_boot_time_1 (const char *, int);
 #endif
 
 static time_t
-get_boot_time ()
+get_boot_time (void)
 {
 #if defined (BOOT_TIME)
   int counter;
@@ -256,9 +249,7 @@ get_boot_time ()
    Success is indicated by setting BOOT_TIME to a larger value.  */
 
 void
-get_boot_time_1 (filename, newest)
-     char *filename;
-     int newest;
+get_boot_time_1 (const char *filename, int newest)
 {
   struct utmp ut, *utp;
   int desc;
@@ -329,9 +320,7 @@ typedef struct
    fill_in_lock_file_name (lock, (file)))
 
 static void
-fill_in_lock_file_name (lockfile, fn)
-     register char *lockfile;
-     register Lisp_Object fn;
+fill_in_lock_file_name (register char *lockfile, register Lisp_Object fn)
 {
   register char *p;
   struct stat st;
@@ -367,14 +356,12 @@ fill_in_lock_file_name (lockfile, fn)
    Return 1 if successful, 0 if not.  */
 
 static int
-lock_file_1 (lfname, force)
-     char *lfname;
-     int force;
+lock_file_1 (char *lfname, int force)
 {
   register int err;
   time_t boot_time;
-  char *user_name;
-  char *host_name;
+  const char *user_name;
+  const char *host_name;
   char *lock_info_str;
 
   /* Call this first because it can GC.  */
@@ -411,8 +398,7 @@ lock_file_1 (lfname, force)
 /* Return 1 if times A and B are no more than one second apart.  */
 
 int
-within_one_second (a, b)
-     time_t a, b;
+within_one_second (time_t a, time_t b)
 {
   return (a - b >= -1 && a - b <= 1);
 }
@@ -423,13 +409,8 @@ within_one_second (a, b)
    or -1 if something is wrong with the locking mechanism.  */
 
 static int
-current_lock_owner (owner, lfname)
-     lock_info_type *owner;
-     char *lfname;
+current_lock_owner (lock_info_type *owner, char *lfname)
 {
-#ifndef index
-  extern char *rindex (), *index ();
-#endif
   int len, ret;
   int local_owner = 0;
   char *at, *dot, *colon;
@@ -471,8 +452,8 @@ current_lock_owner (owner, lfname)
 
   /* Parse USER@HOST.PID:BOOT_TIME.  If can't parse, return -1.  */
   /* The USER is everything before the last @.  */
-  at = rindex (lfinfo, '@');
-  dot = rindex (lfinfo, '.');
+  at = strrchr (lfinfo, '@');
+  dot = strrchr (lfinfo, '.');
   if (!at || !dot)
     {
       xfree (lfinfo);
@@ -543,9 +524,7 @@ current_lock_owner (owner, lfname)
    Return -1 if cannot lock for any other reason.  */
 
 static int
-lock_if_free (clasher, lfname)
-     lock_info_type *clasher;
-     register char *lfname;
+lock_if_free (lock_info_type *clasher, register char *lfname)
 {
   while (lock_file_1 (lfname, 0) == 0)
     {
@@ -588,8 +567,7 @@ lock_if_free (clasher, lfname)
    take away the lock, or return nil meaning ignore the lock.  */
 
 void
-lock_file (fn)
-     Lisp_Object fn;
+lock_file (Lisp_Object fn)
 {
   register Lisp_Object attack, orig_fn, encoded_fn;
   register char *lfname, *locker;
@@ -648,8 +626,7 @@ lock_file (fn)
 }
 
 void
-unlock_file (fn)
-     register Lisp_Object fn;
+unlock_file (register Lisp_Object fn)
 {
   register char *lfname;
 
@@ -663,7 +640,7 @@ unlock_file (fn)
 }
 
 void
-unlock_all_files ()
+unlock_all_files (void)
 {
   register Lisp_Object tail;
   register struct buffer *b;
@@ -683,8 +660,7 @@ DEFUN ("lock-buffer", Flock_buffer, Slock_buffer,
        doc: /* Lock FILE, if current buffer is modified.
 FILE defaults to current buffer's visited file,
 or else nothing is done if current buffer isn't visiting a file.  */)
-     (file)
-     Lisp_Object file;
+  (Lisp_Object file)
 {
   if (NILP (file))
     file = current_buffer->file_truename;
@@ -701,7 +677,7 @@ DEFUN ("unlock-buffer", Funlock_buffer, Sunlock_buffer,
        doc: /* Unlock the file visited in the current buffer.
 If the buffer is not modified, this does nothing because the file
 should not be locked in that case.  */)
-     ()
+  (void)
 {
   if (SAVE_MODIFF < MODIFF
       && STRINGP (current_buffer->file_truename))
@@ -712,8 +688,7 @@ should not be locked in that case.  */)
 /* Unlock the file visited in buffer BUFFER.  */
 
 void
-unlock_buffer (buffer)
-     struct buffer *buffer;
+unlock_buffer (struct buffer *buffer)
 {
   if (BUF_SAVE_MODIFF (buffer) < BUF_MODIFF (buffer)
       && STRINGP (buffer->file_truename))
@@ -724,8 +699,7 @@ DEFUN ("file-locked-p", Ffile_locked_p, Sfile_locked_p, 1, 1, 0,
        doc: /* Return a value indicating whether FILENAME is locked.
 The value is nil if the FILENAME is not locked,
 t if it is locked by you, else a string saying which user has locked it.  */)
-     (filename)
-     Lisp_Object filename;
+  (Lisp_Object filename)
 {
   Lisp_Object ret;
   register char *lfname;
@@ -753,14 +727,14 @@ t if it is locked by you, else a string saying which user has locked it.  */)
 /* Initialization functions.  */
 
 void
-init_filelock ()
+init_filelock (void)
 {
   boot_time = 0;
   boot_time_initialized = 0;
 }
 
 void
-syms_of_filelock ()
+syms_of_filelock (void)
 {
   DEFVAR_LISP ("temporary-file-directory", &Vtemporary_file_directory,
               doc: /* The directory for writing temporary files.  */);
index 4a11d2a311527405eb782bde640c0aa97f63948e..3048077ff52363393728156f27e7224243f34905 100644 (file)
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
    USA.  */
 \f
-#ifdef HAVE_CONFIG_H
 #include <config.h>
-#endif
-
 #include <sys/types.h>
 #include <sys/stat.h>
 
 #define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
 #endif
 
-void mode_string ();
-static char ftypelet ();
-static void rwx ();
-static void setst ();
+void mode_string (short unsigned int mode, char *str);
+static char ftypelet (long int bits);
+static void rwx (short unsigned int bits, char *chars);
+static void setst (short unsigned int bits, char *chars);
 
 /* filemodestring - fill in string STR with an ls-style ASCII
    representation of the st_mode field of file stats block STATP.
@@ -132,9 +129,7 @@ static void setst ();
        'T' if the file is sticky but not executable.  */
 
 void
-filemodestring (statp, str)
-     struct stat *statp;
-     char *str;
+filemodestring (struct stat *statp, char *str)
 {
   mode_string (statp->st_mode, str);
 }
@@ -143,9 +138,7 @@ filemodestring (statp, str)
    is given as an argument.  */
 
 void
-mode_string (mode, str)
-     unsigned short mode;
-     char *str;
+mode_string (short unsigned int mode, char *str)
 {
   str[0] = ftypelet ((long) mode);
   rwx ((mode & 0700) << 0, &str[1]);
@@ -167,8 +160,7 @@ mode_string (mode, str)
    '?' for any other file type.  */
 
 static char
-ftypelet (bits)
-     long bits;
+ftypelet (long int bits)
 {
 #ifdef S_ISBLK
   if (S_ISBLK (bits))
@@ -207,9 +199,7 @@ ftypelet (bits)
    flags in CHARS accordingly.  */
 
 static void
-rwx (bits, chars)
-     unsigned short bits;
-     char *chars;
+rwx (short unsigned int bits, char *chars)
 {
   chars[0] = (bits & S_IRUSR) ? 'r' : '-';
   chars[1] = (bits & S_IWUSR) ? 'w' : '-';
@@ -220,9 +210,7 @@ rwx (bits, chars)
    according to the file mode BITS.  */
 
 static void
-setst (bits, chars)
-     unsigned short bits;
-     char *chars;
+setst (short unsigned int bits, char *chars)
 {
 #ifdef S_ISUID
   if (bits & S_ISUID)
index 97d9ec00aaeed3f4633db282544cd33176597770..29e5c119a1f32897a06343af2ed2ae60785c925a 100644 (file)
@@ -70,7 +70,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* This declaration is omitted on some systems, like Ultrix.  */
 #if !defined (HPUX) && defined (HAVE_LOGB) && !defined (logb)
-extern double logb ();
+extern double logb (double);
 #endif /* not HPUX and HAVE_LOGB and no logb macro */
 
 #if defined(DOMAIN) && defined(SING) && defined(OVERFLOW)
@@ -99,10 +99,6 @@ extern double logb ();
 
 #ifdef FLOAT_CHECK_ERRNO
 # include <errno.h>
-
-#ifndef USE_CRT_DLL
-extern int errno;
-#endif
 #endif
 
 #ifdef FLOAT_CATCH_SIGILL
@@ -121,7 +117,7 @@ static int in_float;
 
 static Lisp_Object float_error_arg, float_error_arg2;
 
-static char *float_error_fn_name;
+static const char *float_error_fn_name;
 
 /* Evaluate the floating point expression D, recording NUM
    as the original argument for error messages.
@@ -196,8 +192,7 @@ static char *float_error_fn_name;
 /* Extract a Lisp number as a `double', or signal an error.  */
 
 double
-extract_float (num)
-     Lisp_Object num;
+extract_float (Lisp_Object num)
 {
   CHECK_NUMBER_OR_FLOAT (num);
 
@@ -210,8 +205,7 @@ extract_float (num)
 
 DEFUN ("acos", Facos, Sacos, 1, 1, 0,
        doc: /* Return the inverse cosine of ARG.  */)
-     (arg)
-     register Lisp_Object arg;
+  (register Lisp_Object arg)
 {
   double d = extract_float (arg);
 #ifdef FLOAT_CHECK_DOMAIN
@@ -224,8 +218,7 @@ DEFUN ("acos", Facos, Sacos, 1, 1, 0,
 
 DEFUN ("asin", Fasin, Sasin, 1, 1, 0,
        doc: /* Return the inverse sine of ARG.  */)
-     (arg)
-     register Lisp_Object arg;
+  (register Lisp_Object arg)
 {
   double d = extract_float (arg);
 #ifdef FLOAT_CHECK_DOMAIN
@@ -242,8 +235,7 @@ If only one argument Y is given, return the inverse tangent of Y.
 If two arguments Y and X are given, return the inverse tangent of Y
 divided by X, i.e. the angle in radians between the vector (X, Y)
 and the x-axis.  */)
-     (y, x)
-     register Lisp_Object y, x;
+  (register Lisp_Object y, Lisp_Object x)
 {
   double d = extract_float (y);
 
@@ -260,8 +252,7 @@ and the x-axis.  */)
 
 DEFUN ("cos", Fcos, Scos, 1, 1, 0,
        doc: /* Return the cosine of ARG.  */)
-     (arg)
-     register Lisp_Object arg;
+  (register Lisp_Object arg)
 {
   double d = extract_float (arg);
   IN_FLOAT (d = cos (d), "cos", arg);
@@ -270,8 +261,7 @@ DEFUN ("cos", Fcos, Scos, 1, 1, 0,
 
 DEFUN ("sin", Fsin, Ssin, 1, 1, 0,
        doc: /* Return the sine of ARG.  */)
-     (arg)
-     register Lisp_Object arg;
+  (register Lisp_Object arg)
 {
   double d = extract_float (arg);
   IN_FLOAT (d = sin (d), "sin", arg);
@@ -280,8 +270,7 @@ DEFUN ("sin", Fsin, Ssin, 1, 1, 0,
 
 DEFUN ("tan", Ftan, Stan, 1, 1, 0,
        doc: /* Return the tangent of ARG.  */)
-     (arg)
-     register Lisp_Object arg;
+  (register Lisp_Object arg)
 {
   double d = extract_float (arg);
   double c = cos (d);
@@ -292,13 +281,72 @@ DEFUN ("tan", Ftan, Stan, 1, 1, 0,
   IN_FLOAT (d = sin (d) / c, "tan", arg);
   return make_float (d);
 }
+
+#if defined HAVE_ISNAN && defined HAVE_COPYSIGN
+DEFUN ("isnan", Fisnan, Sisnan, 1, 1, 0,
+       doc: /* Return non nil iff argument X is a NaN.  */)
+  (Lisp_Object x)
+{
+  CHECK_FLOAT (x);
+  return isnan (XFLOAT_DATA (x)) ? Qt : Qnil;
+}
+
+DEFUN ("copysign", Fcopysign, Scopysign, 1, 2, 0,
+       doc: /* Copy sign of X2 to value of X1, and return the result.
+Cause an error if X1 or X2 is not a float.  */)
+  (Lisp_Object x1, Lisp_Object x2)
+{
+  double f1, f2;
+
+  CHECK_FLOAT (x1);
+  CHECK_FLOAT (x2);
+
+  f1 = XFLOAT_DATA (x1);
+  f2 = XFLOAT_DATA (x2);
+
+  return make_float (copysign (f1, f2));
+}
+
+DEFUN ("frexp", Ffrexp, Sfrexp, 1, 1, 0,
+       doc: /* Get significand and exponent of a floating point number.
+Breaks the floating point number X into its binary significand SGNFCAND
+\(a floating point value between 0.5 (included) and 1.0 (excluded))
+and an integral exponent EXP for 2, such that:
+
+  X = SGNFCAND * 2^EXP
+
+The function returns the cons cell (SGNFCAND . EXP).
+If X is zero, both parts (SGNFCAND and EXP) are zero.  */)
+  (Lisp_Object x)
+{
+  double f = XFLOATINT (x);
+
+  if (f == 0.0)
+    return Fcons (make_float (0.0), make_number (0));
+  else
+    {
+      int    exp;
+      double sgnfcand = frexp (f, &exp);
+      return Fcons (make_float (sgnfcand), make_number (exp));
+    }
+}
+
+DEFUN ("ldexp", Fldexp, Sldexp, 1, 2, 0,
+       doc: /* Construct number X from significand SGNFCAND and exponent EXP.
+Returns the floating point value resulting from multiplying SGNFCAND
+(the significand) by 2 raised to the power of EXP (the exponent).   */)
+  (Lisp_Object sgnfcand, Lisp_Object exp)
+{
+  CHECK_NUMBER (exp);
+  return make_float (ldexp (XFLOATINT (sgnfcand), XINT (exp)));
+}
+#endif
 \f
 #if 0 /* Leave these out unless we find there's a reason for them.  */
 
 DEFUN ("bessel-j0", Fbessel_j0, Sbessel_j0, 1, 1, 0,
        doc: /* Return the bessel function j0 of ARG.  */)
-     (arg)
-     register Lisp_Object arg;
+  (register Lisp_Object arg)
 {
   double d = extract_float (arg);
   IN_FLOAT (d = j0 (d), "bessel-j0", arg);
@@ -307,8 +355,7 @@ DEFUN ("bessel-j0", Fbessel_j0, Sbessel_j0, 1, 1, 0,
 
 DEFUN ("bessel-j1", Fbessel_j1, Sbessel_j1, 1, 1, 0,
        doc: /* Return the bessel function j1 of ARG.  */)
-     (arg)
-     register Lisp_Object arg;
+  (register Lisp_Object arg)
 {
   double d = extract_float (arg);
   IN_FLOAT (d = j1 (d), "bessel-j1", arg);
@@ -318,8 +365,7 @@ DEFUN ("bessel-j1", Fbessel_j1, Sbessel_j1, 1, 1, 0,
 DEFUN ("bessel-jn", Fbessel_jn, Sbessel_jn, 2, 2, 0,
        doc: /* Return the order N bessel function output jn of ARG.
 The first arg (the order) is truncated to an integer.  */)
-     (n, arg)
-     register Lisp_Object n, arg;
+  (register Lisp_Object n, Lisp_Object arg)
 {
   int i1 = extract_float (n);
   double f2 = extract_float (arg);
@@ -330,8 +376,7 @@ The first arg (the order) is truncated to an integer.  */)
 
 DEFUN ("bessel-y0", Fbessel_y0, Sbessel_y0, 1, 1, 0,
        doc: /* Return the bessel function y0 of ARG.  */)
-     (arg)
-     register Lisp_Object arg;
+  (register Lisp_Object arg)
 {
   double d = extract_float (arg);
   IN_FLOAT (d = y0 (d), "bessel-y0", arg);
@@ -340,8 +385,7 @@ DEFUN ("bessel-y0", Fbessel_y0, Sbessel_y0, 1, 1, 0,
 
 DEFUN ("bessel-y1", Fbessel_y1, Sbessel_y1, 1, 1, 0,
        doc: /* Return the bessel function y1 of ARG.  */)
-     (arg)
-     register Lisp_Object arg;
+  (register Lisp_Object arg)
 {
   double d = extract_float (arg);
   IN_FLOAT (d = y1 (d), "bessel-y0", arg);
@@ -351,8 +395,7 @@ DEFUN ("bessel-y1", Fbessel_y1, Sbessel_y1, 1, 1, 0,
 DEFUN ("bessel-yn", Fbessel_yn, Sbessel_yn, 2, 2, 0,
        doc: /* Return the order N bessel function output yn of ARG.
 The first arg (the order) is truncated to an integer.  */)
-     (n, arg)
-     register Lisp_Object n, arg;
+  (register Lisp_Object n, Lisp_Object arg)
 {
   int i1 = extract_float (n);
   double f2 = extract_float (arg);
@@ -367,8 +410,7 @@ The first arg (the order) is truncated to an integer.  */)
 
 DEFUN ("erf", Ferf, Serf, 1, 1, 0,
        doc: /* Return the mathematical error function of ARG.  */)
-     (arg)
-     register Lisp_Object arg;
+  (register Lisp_Object arg)
 {
   double d = extract_float (arg);
   IN_FLOAT (d = erf (d), "erf", arg);
@@ -377,8 +419,7 @@ DEFUN ("erf", Ferf, Serf, 1, 1, 0,
 
 DEFUN ("erfc", Ferfc, Serfc, 1, 1, 0,
        doc: /* Return the complementary error function of ARG.  */)
-     (arg)
-     register Lisp_Object arg;
+  (register Lisp_Object arg)
 {
   double d = extract_float (arg);
   IN_FLOAT (d = erfc (d), "erfc", arg);
@@ -387,8 +428,7 @@ DEFUN ("erfc", Ferfc, Serfc, 1, 1, 0,
 
 DEFUN ("log-gamma", Flog_gamma, Slog_gamma, 1, 1, 0,
        doc: /* Return the log gamma of ARG.  */)
-     (arg)
-     register Lisp_Object arg;
+  (register Lisp_Object arg)
 {
   double d = extract_float (arg);
   IN_FLOAT (d = lgamma (d), "log-gamma", arg);
@@ -397,8 +437,7 @@ DEFUN ("log-gamma", Flog_gamma, Slog_gamma, 1, 1, 0,
 
 DEFUN ("cube-root", Fcube_root, Scube_root, 1, 1, 0,
        doc: /* Return the cube root of ARG.  */)
-     (arg)
-     register Lisp_Object arg;
+  (register Lisp_Object arg)
 {
   double d = extract_float (arg);
 #ifdef HAVE_CBRT
@@ -416,8 +455,7 @@ DEFUN ("cube-root", Fcube_root, Scube_root, 1, 1, 0,
 \f
 DEFUN ("exp", Fexp, Sexp, 1, 1, 0,
        doc: /* Return the exponential base e of ARG.  */)
-     (arg)
-     register Lisp_Object arg;
+  (register Lisp_Object arg)
 {
   double d = extract_float (arg);
 #ifdef FLOAT_CHECK_DOMAIN
@@ -433,8 +471,7 @@ DEFUN ("exp", Fexp, Sexp, 1, 1, 0,
 
 DEFUN ("expt", Fexpt, Sexpt, 2, 2, 0,
        doc: /* Return the exponential ARG1 ** ARG2.  */)
-     (arg1, arg2)
-     register Lisp_Object arg1, arg2;
+  (register Lisp_Object arg1, Lisp_Object arg2)
 {
   double f1, f2, f3;
 
@@ -492,8 +529,7 @@ DEFUN ("expt", Fexpt, Sexpt, 2, 2, 0,
 DEFUN ("log", Flog, Slog, 1, 2, 0,
        doc: /* Return the natural logarithm of ARG.
 If the optional argument BASE is given, return log ARG using that base.  */)
-     (arg, base)
-     register Lisp_Object arg, base;
+  (register Lisp_Object arg, Lisp_Object base)
 {
   double d = extract_float (arg);
 
@@ -521,8 +557,7 @@ If the optional argument BASE is given, return log ARG using that base.  */)
 
 DEFUN ("log10", Flog10, Slog10, 1, 1, 0,
        doc: /* Return the logarithm base 10 of ARG.  */)
-     (arg)
-     register Lisp_Object arg;
+  (register Lisp_Object arg)
 {
   double d = extract_float (arg);
 #ifdef FLOAT_CHECK_DOMAIN
@@ -535,8 +570,7 @@ DEFUN ("log10", Flog10, Slog10, 1, 1, 0,
 
 DEFUN ("sqrt", Fsqrt, Ssqrt, 1, 1, 0,
        doc: /* Return the square root of ARG.  */)
-     (arg)
-     register Lisp_Object arg;
+  (register Lisp_Object arg)
 {
   double d = extract_float (arg);
 #ifdef FLOAT_CHECK_DOMAIN
@@ -551,8 +585,7 @@ DEFUN ("sqrt", Fsqrt, Ssqrt, 1, 1, 0,
 
 DEFUN ("acosh", Facosh, Sacosh, 1, 1, 0,
        doc: /* Return the inverse hyperbolic cosine of ARG.  */)
-     (arg)
-     register Lisp_Object arg;
+  (register Lisp_Object arg)
 {
   double d = extract_float (arg);
 #ifdef FLOAT_CHECK_DOMAIN
@@ -569,8 +602,7 @@ DEFUN ("acosh", Facosh, Sacosh, 1, 1, 0,
 
 DEFUN ("asinh", Fasinh, Sasinh, 1, 1, 0,
        doc: /* Return the inverse hyperbolic sine of ARG.  */)
-     (arg)
-     register Lisp_Object arg;
+  (register Lisp_Object arg)
 {
   double d = extract_float (arg);
 #ifdef HAVE_INVERSE_HYPERBOLIC
@@ -583,8 +615,7 @@ DEFUN ("asinh", Fasinh, Sasinh, 1, 1, 0,
 
 DEFUN ("atanh", Fatanh, Satanh, 1, 1, 0,
        doc: /* Return the inverse hyperbolic tangent of ARG.  */)
-     (arg)
-     register Lisp_Object arg;
+  (register Lisp_Object arg)
 {
   double d = extract_float (arg);
 #ifdef FLOAT_CHECK_DOMAIN
@@ -601,8 +632,7 @@ DEFUN ("atanh", Fatanh, Satanh, 1, 1, 0,
 
 DEFUN ("cosh", Fcosh, Scosh, 1, 1, 0,
        doc: /* Return the hyperbolic cosine of ARG.  */)
-     (arg)
-     register Lisp_Object arg;
+  (register Lisp_Object arg)
 {
   double d = extract_float (arg);
 #ifdef FLOAT_CHECK_DOMAIN
@@ -615,8 +645,7 @@ DEFUN ("cosh", Fcosh, Scosh, 1, 1, 0,
 
 DEFUN ("sinh", Fsinh, Ssinh, 1, 1, 0,
        doc: /* Return the hyperbolic sine of ARG.  */)
-     (arg)
-     register Lisp_Object arg;
+  (register Lisp_Object arg)
 {
   double d = extract_float (arg);
 #ifdef FLOAT_CHECK_DOMAIN
@@ -629,8 +658,7 @@ DEFUN ("sinh", Fsinh, Ssinh, 1, 1, 0,
 
 DEFUN ("tanh", Ftanh, Stanh, 1, 1, 0,
        doc: /* Return the hyperbolic tangent of ARG.  */)
-     (arg)
-     register Lisp_Object arg;
+  (register Lisp_Object arg)
 {
   double d = extract_float (arg);
   IN_FLOAT (d = tanh (d), "tanh", arg);
@@ -640,8 +668,7 @@ DEFUN ("tanh", Ftanh, Stanh, 1, 1, 0,
 \f
 DEFUN ("abs", Fabs, Sabs, 1, 1, 0,
        doc: /* Return the absolute value of ARG.  */)
-     (arg)
-     register Lisp_Object arg;
+  (register Lisp_Object arg)
 {
   CHECK_NUMBER_OR_FLOAT (arg);
 
@@ -655,8 +682,7 @@ DEFUN ("abs", Fabs, Sabs, 1, 1, 0,
 
 DEFUN ("float", Ffloat, Sfloat, 1, 1, 0,
        doc: /* Return the floating point number equal to ARG.  */)
-     (arg)
-     register Lisp_Object arg;
+  (register Lisp_Object arg)
 {
   CHECK_NUMBER_OR_FLOAT (arg);
 
@@ -669,8 +695,7 @@ DEFUN ("float", Ffloat, Sfloat, 1, 1, 0,
 DEFUN ("logb", Flogb, Slogb, 1, 1, 0,
        doc: /* Returns largest integer <= the base 2 log of the magnitude of ARG.
 This is the same as the exponent of a float.  */)
-     (arg)
-     Lisp_Object arg;
+  (Lisp_Object arg)
 {
   Lisp_Object val;
   EMACS_INT value;
@@ -718,11 +743,10 @@ This is the same as the exponent of a float.  */)
 /* the rounding functions  */
 
 static Lisp_Object
-rounding_driver (arg, divisor, double_round, int_round2, name)
-     register Lisp_Object arg, divisor;
-     double (*double_round) ();
-     EMACS_INT (*int_round2) ();
-     char *name;
+rounding_driver (Lisp_Object arg, Lisp_Object divisor,
+                double (*double_round) (double),
+                EMACS_INT (*int_round2) (EMACS_INT, EMACS_INT),
+                const char *name)
 {
   CHECK_NUMBER_OR_FLOAT (arg);
 
@@ -772,8 +796,7 @@ rounding_driver (arg, divisor, double_round, int_round2, name)
    integer functions.  */
 
 static EMACS_INT
-ceiling2 (i1, i2)
-     EMACS_INT i1, i2;
+ceiling2 (EMACS_INT i1, EMACS_INT i2)
 {
   return (i2 < 0
          ? (i1 < 0  ?  ((-1 - i1) / -i2) + 1  :  - (i1 / -i2))
@@ -781,8 +804,7 @@ ceiling2 (i1, i2)
 }
 
 static EMACS_INT
-floor2 (i1, i2)
-     EMACS_INT i1, i2;
+floor2 (EMACS_INT i1, EMACS_INT i2)
 {
   return (i2 < 0
          ? (i1 <= 0  ?  -i1 / -i2  :  -1 - ((i1 - 1) / -i2))
@@ -790,8 +812,7 @@ floor2 (i1, i2)
 }
 
 static EMACS_INT
-truncate2 (i1, i2)
-     EMACS_INT i1, i2;
+truncate2 (EMACS_INT i1, EMACS_INT i2)
 {
   return (i2 < 0
          ? (i1 < 0  ?  -i1 / -i2  :  - (i1 / -i2))
@@ -799,8 +820,7 @@ truncate2 (i1, i2)
 }
 
 static EMACS_INT
-round2 (i1, i2)
-     EMACS_INT i1, i2;
+round2 (EMACS_INT i1, EMACS_INT i2)
 {
   /* The C language's division operator gives us one remainder R, but
      we want the remainder R1 on the other side of 0 if R1 is closer
@@ -820,16 +840,14 @@ round2 (i1, i2)
 #define emacs_rint rint
 #else
 static double
-emacs_rint (d)
-     double d;
+emacs_rint (double d)
 {
   return floor (d + 0.5);
 }
 #endif
 
 static double
-double_identity (d)
-     double d;
+double_identity (double d)
 {
   return d;
 }
@@ -838,8 +856,7 @@ DEFUN ("ceiling", Fceiling, Sceiling, 1, 2, 0,
        doc: /* Return the smallest integer no less than ARG.
 This rounds the value towards +inf.
 With optional DIVISOR, return the smallest integer no less than ARG/DIVISOR.  */)
-     (arg, divisor)
-     Lisp_Object arg, divisor;
+  (Lisp_Object arg, Lisp_Object divisor)
 {
   return rounding_driver (arg, divisor, ceil, ceiling2, "ceiling");
 }
@@ -848,8 +865,7 @@ DEFUN ("floor", Ffloor, Sfloor, 1, 2, 0,
        doc: /* Return the largest integer no greater than ARG.
 This rounds the value towards -inf.
 With optional DIVISOR, return the largest integer no greater than ARG/DIVISOR.  */)
-     (arg, divisor)
-     Lisp_Object arg, divisor;
+  (Lisp_Object arg, Lisp_Object divisor)
 {
   return rounding_driver (arg, divisor, floor, floor2, "floor");
 }
@@ -862,8 +878,7 @@ Rounding a value equidistant between two integers may choose the
 integer closer to zero, or it may prefer an even integer, depending on
 your machine.  For example, \(round 2.5\) can return 3 on some
 systems, but 2 on others.  */)
-     (arg, divisor)
-     Lisp_Object arg, divisor;
+  (Lisp_Object arg, Lisp_Object divisor)
 {
   return rounding_driver (arg, divisor, emacs_rint, round2, "round");
 }
@@ -872,8 +887,7 @@ DEFUN ("truncate", Ftruncate, Struncate, 1, 2, 0,
        doc: /* Truncate a floating point number to an int.
 Rounds ARG toward zero.
 With optional DIVISOR, truncate ARG/DIVISOR.  */)
-     (arg, divisor)
-     Lisp_Object arg, divisor;
+  (Lisp_Object arg, Lisp_Object divisor)
 {
   return rounding_driver (arg, divisor, double_identity, truncate2,
                          "truncate");
@@ -881,8 +895,7 @@ With optional DIVISOR, truncate ARG/DIVISOR.  */)
 
 
 Lisp_Object
-fmod_float (x, y)
-     register Lisp_Object x, y;
+fmod_float (Lisp_Object x, Lisp_Object y)
 {
   double f1, f2;
 
@@ -904,8 +917,7 @@ fmod_float (x, y)
 DEFUN ("fceiling", Ffceiling, Sfceiling, 1, 1, 0,
        doc: /* Return the smallest integer no less than ARG, as a float.
 \(Round toward +inf.\)  */)
-     (arg)
-     register Lisp_Object arg;
+  (register Lisp_Object arg)
 {
   double d = extract_float (arg);
   IN_FLOAT (d = ceil (d), "fceiling", arg);
@@ -915,8 +927,7 @@ DEFUN ("fceiling", Ffceiling, Sfceiling, 1, 1, 0,
 DEFUN ("ffloor", Fffloor, Sffloor, 1, 1, 0,
        doc: /* Return the largest integer no greater than ARG, as a float.
 \(Round towards -inf.\)  */)
-     (arg)
-     register Lisp_Object arg;
+  (register Lisp_Object arg)
 {
   double d = extract_float (arg);
   IN_FLOAT (d = floor (d), "ffloor", arg);
@@ -925,8 +936,7 @@ DEFUN ("ffloor", Fffloor, Sffloor, 1, 1, 0,
 
 DEFUN ("fround", Ffround, Sfround, 1, 1, 0,
        doc: /* Return the nearest integer to ARG, as a float.  */)
-     (arg)
-     register Lisp_Object arg;
+  (register Lisp_Object arg)
 {
   double d = extract_float (arg);
   IN_FLOAT (d = emacs_rint (d), "fround", arg);
@@ -936,8 +946,7 @@ DEFUN ("fround", Ffround, Sfround, 1, 1, 0,
 DEFUN ("ftruncate", Fftruncate, Sftruncate, 1, 1, 0,
        doc: /* Truncate a floating point number to an integral float value.
 Rounds the value toward zero.  */)
-     (arg)
-     register Lisp_Object arg;
+  (register Lisp_Object arg)
 {
   double d = extract_float (arg);
   if (d >= 0.0)
@@ -975,20 +984,21 @@ float_error (signo)
 
 #ifdef HAVE_MATHERR
 int
-matherr (x)
-     struct exception *x;
+matherr (struct exception *x)
 {
   Lisp_Object args;
+  const char *name = x->name;
+
   if (! in_float)
     /* Not called from emacs-lisp float routines; do the default thing. */
     return 0;
   if (!strcmp (x->name, "pow"))
-    x->name = "expt";
+    name = "expt";
 
   args
-    = Fcons (build_string (x->name),
+    = Fcons (build_string (name),
             Fcons (make_float (x->arg1),
-                   ((!strcmp (x->name, "log") || !strcmp (x->name, "pow"))
+                   ((!strcmp (name, "log") || !strcmp (name, "pow"))
                     ? Fcons (make_float (x->arg2), Qnil)
                     : Qnil)));
   switch (x->type)
@@ -1004,7 +1014,7 @@ matherr (x)
 #endif /* HAVE_MATHERR */
 
 void
-init_floatfns ()
+init_floatfns (void)
 {
 #ifdef FLOAT_CATCH_SIGILL
   signal (SIGILL, float_error);
@@ -1013,7 +1023,7 @@ init_floatfns ()
 }
 
 void
-syms_of_floatfns ()
+syms_of_floatfns (void)
 {
   defsubr (&Sacos);
   defsubr (&Sasin);
@@ -1021,6 +1031,12 @@ syms_of_floatfns ()
   defsubr (&Scos);
   defsubr (&Ssin);
   defsubr (&Stan);
+#if defined HAVE_ISNAN && defined HAVE_COPYSIGN
+  defsubr (&Sisnan);
+  defsubr (&Scopysign);
+  defsubr (&Sfrexp);
+  defsubr (&Sldexp);
+#endif 
 #if 0
   defsubr (&Sacosh);
   defsubr (&Sasinh);
index 4e8cd5db9a6ac2827e943c89136313e4df9379c7..12d13186ce7e6abfbbd796a280667332cc382c65 100644 (file)
--- a/src/fns.c
+++ b/src/fns.c
@@ -61,23 +61,16 @@ int use_dialog_box;
    questions asked by mouse commands.  */
 int use_file_dialog;
 
-extern int minibuffer_auto_raise;
-extern Lisp_Object minibuf_window;
-extern Lisp_Object Vlocale_coding_system;
-extern int load_in_progress;
-
 Lisp_Object Qstring_lessp, Qprovide, Qrequire;
 Lisp_Object Qyes_or_no_p_history;
 Lisp_Object Qcursor_in_echo_area;
 Lisp_Object Qwidget_type;
 Lisp_Object Qcodeset, Qdays, Qmonths, Qpaper;
 
-extern Lisp_Object Qinput_method_function;
-
-static int internal_equal P_ ((Lisp_Object , Lisp_Object, int, int));
+static int internal_equal (Lisp_Object , Lisp_Object, int, int);
 
-extern long get_random ();
-extern void seed_random P_ ((long));
+extern long get_random (void);
+extern void seed_random (long);
 
 #ifndef HAVE_UNISTD_H
 extern long time ();
@@ -85,8 +78,7 @@ extern long time ();
 \f
 DEFUN ("identity", Fidentity, Sidentity, 1, 1, 0,
        doc: /* Return the argument unchanged.  */)
-     (arg)
-     Lisp_Object arg;
+  (Lisp_Object arg)
 {
   return arg;
 }
@@ -98,8 +90,7 @@ All integers representable in Lisp are equally likely.
 With positive integer LIMIT, return random number in interval [0,LIMIT).
 With argument t, set the random number seed from the current time and pid.
 Other values of LIMIT are ignored.  */)
-     (limit)
-     Lisp_Object limit;
+  (Lisp_Object limit)
 {
   EMACS_INT val;
   Lisp_Object lispy_val;
@@ -135,8 +126,7 @@ A byte-code function object is also allowed.
 If the string contains multibyte characters, this is not necessarily
 the number of bytes in the string; it is the number of characters.
 To get the number of bytes, use `string-bytes'.  */)
-     (sequence)
-     register Lisp_Object sequence;
+  (register Lisp_Object sequence)
 {
   register Lisp_Object val;
   register int i;
@@ -186,8 +176,7 @@ DEFUN ("safe-length", Fsafe_length, Ssafe_length, 1, 1, 0,
 This function never gets an error.  If LIST is not really a list,
 it returns 0.  If LIST is circular, it returns a finite value
 which is at least the number of distinct elements.  */)
-     (list)
-     Lisp_Object list;
+  (Lisp_Object list)
 {
   Lisp_Object tail, halftail, length;
   int len = 0;
@@ -210,8 +199,7 @@ which is at least the number of distinct elements.  */)
 DEFUN ("string-bytes", Fstring_bytes, Sstring_bytes, 1, 1, 0,
        doc: /* Return the number of bytes in STRING.
 If STRING is multibyte, this may be greater than the length of STRING.  */)
-     (string)
-     Lisp_Object string;
+  (Lisp_Object string)
 {
   CHECK_STRING (string);
   return make_number (SBYTES (string));
@@ -221,8 +209,7 @@ DEFUN ("string-equal", Fstring_equal, Sstring_equal, 2, 2, 0,
        doc: /* Return t if two strings have identical contents.
 Case is significant, but text properties are ignored.
 Symbols are also allowed; their print names are used instead.  */)
-     (s1, s2)
-     register Lisp_Object s1, s2;
+  (register Lisp_Object s1, Lisp_Object s2)
 {
   if (SYMBOLP (s1))
     s1 = SYMBOL_NAME (s1);
@@ -233,7 +220,7 @@ Symbols are also allowed; their print names are used instead.  */)
 
   if (SCHARS (s1) != SCHARS (s2)
       || SBYTES (s1) != SBYTES (s2)
-      || bcmp (SDATA (s1), SDATA (s2), SBYTES (s1)))
+      || memcmp (SDATA (s1), SDATA (s2), SBYTES (s1)))
     return Qnil;
   return Qt;
 }
@@ -252,8 +239,7 @@ If string STR1 is less, the value is a negative number N;
   - 1 - N is the number of characters that match at the beginning.
 If string STR1 is greater, the value is a positive number N;
   N - 1 is the number of characters that match at the beginning.  */)
-     (str1, start1, end1, str2, start2, end2, ignore_case)
-     Lisp_Object str1, start1, end1, start2, str2, end2, ignore_case;
+  (Lisp_Object str1, Lisp_Object start1, Lisp_Object end1, Lisp_Object str2, Lisp_Object start2, Lisp_Object end2, Lisp_Object ignore_case)
 {
   register int end1_char, end2_char;
   register int i1, i1_byte, i2, i2_byte;
@@ -344,8 +330,7 @@ DEFUN ("string-lessp", Fstring_lessp, Sstring_lessp, 2, 2, 0,
        doc: /* Return t if first arg string is less than second in lexicographic order.
 Case is significant.
 Symbols are also allowed; their print names are used instead.  */)
-     (s1, s2)
-     register Lisp_Object s1, s2;
+  (register Lisp_Object s1, Lisp_Object s2)
 {
   register int end;
   register int i1, i1_byte, i2, i2_byte;
@@ -378,44 +363,28 @@ Symbols are also allowed; their print names are used instead.  */)
   return i1 < SCHARS (s2) ? Qt : Qnil;
 }
 \f
-#if __GNUC__
-/* "gcc -O3" enables automatic function inlining, which optimizes out
-   the arguments for the invocations of this function, whereas it
-   expects these values on the stack.  */
-static Lisp_Object concat P_ ((int nargs, Lisp_Object *args, enum Lisp_Type target_type, int last_special)) __attribute__((noinline));
-#else  /* !__GNUC__ */
-static Lisp_Object concat P_ ((int nargs, Lisp_Object *args, enum Lisp_Type target_type, int last_special));
-#endif
+static Lisp_Object concat (int nargs, Lisp_Object *args,
+                          enum Lisp_Type target_type, int last_special);
 
 /* ARGSUSED */
 Lisp_Object
-concat2 (s1, s2)
-     Lisp_Object s1, s2;
+concat2 (Lisp_Object s1, Lisp_Object s2)
 {
-#ifdef NO_ARG_ARRAY
   Lisp_Object args[2];
   args[0] = s1;
   args[1] = s2;
   return concat (2, args, Lisp_String, 0);
-#else
-  return concat (2, &s1, Lisp_String, 0);
-#endif /* NO_ARG_ARRAY */
 }
 
 /* ARGSUSED */
 Lisp_Object
-concat3 (s1, s2, s3)
-     Lisp_Object s1, s2, s3;
+concat3 (Lisp_Object s1, Lisp_Object s2, Lisp_Object s3)
 {
-#ifdef NO_ARG_ARRAY
   Lisp_Object args[3];
   args[0] = s1;
   args[1] = s2;
   args[2] = s3;
   return concat (3, args, Lisp_String, 0);
-#else
-  return concat (3, &s1, Lisp_String, 0);
-#endif /* NO_ARG_ARRAY */
 }
 
 DEFUN ("append", Fappend, Sappend, 0, MANY, 0,
@@ -424,9 +393,7 @@ The result is a list whose elements are the elements of all the arguments.
 Each argument may be a list, vector or string.
 The last argument is not copied, just used as the tail of the new list.
 usage: (append &rest SEQUENCES)  */)
-     (nargs, args)
-     int nargs;
-     Lisp_Object *args;
+  (int nargs, Lisp_Object *args)
 {
   return concat (nargs, args, Lisp_Cons, 1);
 }
@@ -436,9 +403,7 @@ DEFUN ("concat", Fconcat, Sconcat, 0, MANY, 0,
 The result is a string whose elements are the elements of all the arguments.
 Each argument may be a string or a list or vector of characters (integers).
 usage: (concat &rest SEQUENCES)  */)
-     (nargs, args)
-     int nargs;
-     Lisp_Object *args;
+  (int nargs, Lisp_Object *args)
 {
   return concat (nargs, args, Lisp_String, 0);
 }
@@ -448,9 +413,7 @@ DEFUN ("vconcat", Fvconcat, Svconcat, 0, MANY, 0,
 The result is a vector whose elements are the elements of all the arguments.
 Each argument may be a list, vector or string.
 usage: (vconcat &rest SEQUENCES)   */)
-     (nargs, args)
-     int nargs;
-     Lisp_Object *args;
+  (int nargs, Lisp_Object *args)
 {
   return concat (nargs, args, Lisp_Vectorlike, 0);
 }
@@ -460,8 +423,7 @@ DEFUN ("copy-sequence", Fcopy_sequence, Scopy_sequence, 1, 1, 0,
        doc: /* Return a copy of a list, vector, string or char-table.
 The elements of a list or vector are not copied; they are shared
 with the original.  */)
-     (arg)
-     Lisp_Object arg;
+  (Lisp_Object arg)
 {
   if (NILP (arg)) return arg;
 
@@ -478,8 +440,8 @@ with the original.  */)
           / BOOL_VECTOR_BITS_PER_CHAR);
 
       val = Fmake_bool_vector (Flength (arg), Qnil);
-      bcopy (XBOOL_VECTOR (arg)->data, XBOOL_VECTOR (val)->data,
-            size_in_chars);
+      memcpy (XBOOL_VECTOR (val)->data, XBOOL_VECTOR (arg)->data,
+             size_in_chars);
       return val;
     }
 
@@ -499,11 +461,7 @@ struct textprop_rec
 };
 
 static Lisp_Object
-concat (nargs, args, target_type, last_special)
-     int nargs;
-     Lisp_Object *args;
-     enum Lisp_Type target_type;
-     int last_special;
+concat (int nargs, Lisp_Object *args, enum Lisp_Type target_type, int last_special)
 {
   Lisp_Object val;
   register Lisp_Object tail;
@@ -650,8 +608,7 @@ concat (nargs, args, target_type, last_special)
        {
          int thislen_byte = SBYTES (this);
 
-         bcopy (SDATA (this), SDATA (val) + toindex_byte,
-                SBYTES (this));
+         memcpy (SDATA (val) + toindex_byte, SDATA (this), SBYTES (this));
          if (! NULL_INTERVAL_P (STRING_INTERVALS (this)))
            {
              textprops[num_textprops].argnum = argnum;
@@ -784,7 +741,7 @@ static EMACS_INT string_char_byte_cache_charpos;
 static EMACS_INT string_char_byte_cache_bytepos;
 
 void
-clear_string_char_byte_cache ()
+clear_string_char_byte_cache (void)
 {
   string_char_byte_cache_string = Qnil;
 }
@@ -792,9 +749,7 @@ clear_string_char_byte_cache ()
 /* Return the byte index corresponding to CHAR_INDEX in STRING.  */
 
 EMACS_INT
-string_char_to_byte (string, char_index)
-     Lisp_Object string;
-     EMACS_INT char_index;
+string_char_to_byte (Lisp_Object string, EMACS_INT char_index)
 {
   EMACS_INT i_byte;
   EMACS_INT best_below, best_below_byte;
@@ -854,9 +809,7 @@ string_char_to_byte (string, char_index)
 /* Return the character index corresponding to BYTE_INDEX in STRING.  */
 
 EMACS_INT
-string_byte_to_char (string, byte_index)
-     Lisp_Object string;
-     EMACS_INT byte_index;
+string_byte_to_char (Lisp_Object string, EMACS_INT byte_index)
 {
   EMACS_INT i, i_byte;
   EMACS_INT best_below, best_below_byte;
@@ -920,8 +873,7 @@ string_byte_to_char (string, byte_index)
 /* Convert STRING to a multibyte string.  */
 
 Lisp_Object
-string_make_multibyte (string)
-     Lisp_Object string;
+string_make_multibyte (Lisp_Object string)
 {
   unsigned char *buf;
   EMACS_INT nbytes;
@@ -954,8 +906,7 @@ string_make_multibyte (string)
    converted to eight-bit characters. */
 
 Lisp_Object
-string_to_multibyte (string)
-     Lisp_Object string;
+string_to_multibyte (Lisp_Object string)
 {
   unsigned char *buf;
   EMACS_INT nbytes;
@@ -972,7 +923,7 @@ string_to_multibyte (string)
     return make_multibyte_string (SDATA (string), nbytes, nbytes);
 
   SAFE_ALLOCA (buf, unsigned char *, nbytes);
-  bcopy (SDATA (string), buf, SBYTES (string));
+  memcpy (buf, SDATA (string), SBYTES (string));
   str_to_multibyte (buf, nbytes, SBYTES (string));
 
   ret = make_multibyte_string (buf, SCHARS (string), nbytes);
@@ -985,8 +936,7 @@ string_to_multibyte (string)
 /* Convert STRING to a single-byte string.  */
 
 Lisp_Object
-string_make_unibyte (string)
-     Lisp_Object string;
+string_make_unibyte (Lisp_Object string)
 {
   int nchars;
   unsigned char *buf;
@@ -1019,8 +969,7 @@ or entirely ASCII, it is returned unchanged.  In particular, when
 STRING is unibyte and entirely ASCII, the returned string is unibyte.
 \(When the characters are all ASCII, Emacs primitives will treat the
 string the same way whether it is unibyte or multibyte.)  */)
-     (string)
-     Lisp_Object string;
+  (Lisp_Object string)
 {
   CHECK_STRING (string);
 
@@ -1034,8 +983,7 @@ Multibyte character codes are converted to unibyte according to
 `nonascii-translation-table' or, if that is nil, `nonascii-insert-offset'.
 If the lookup in the translation table fails, this function takes just
 the low 8 bits of each character.  */)
-     (string)
-     Lisp_Object string;
+  (Lisp_Object string)
 {
   CHECK_STRING (string);
 
@@ -1049,8 +997,7 @@ If STRING is unibyte, the result is STRING itself.
 Otherwise it is a newly created string, with no text properties.
 If STRING is multibyte and contains a character of charset
 `eight-bit', it is converted to the corresponding single byte.  */)
-     (string)
-     Lisp_Object string;
+  (Lisp_Object string)
 {
   CHECK_STRING (string);
 
@@ -1059,7 +1006,7 @@ If STRING is multibyte and contains a character of charset
       int bytes = SBYTES (string);
       unsigned char *str = (unsigned char *) xmalloc (bytes);
 
-      bcopy (SDATA (string), str, bytes);
+      memcpy (str, SDATA (string), bytes);
       bytes = str_as_unibyte (str, bytes);
       string = make_unibyte_string (str, bytes);
       xfree (str);
@@ -1082,8 +1029,7 @@ Beware, this often doesn't really do what you think it does.
 It is similar to (decode-coding-string STRING 'utf-8-emacs).
 If you're not sure, whether to use `string-as-multibyte' or
 `string-to-multibyte', use `string-to-multibyte'.  */)
-     (string)
-     Lisp_Object string;
+  (Lisp_Object string)
 {
   CHECK_STRING (string);
 
@@ -1096,8 +1042,7 @@ If you're not sure, whether to use `string-as-multibyte' or
                              SBYTES (string),
                              &nchars, &nbytes);
       new_string = make_uninit_multibyte_string (nchars, nbytes);
-      bcopy (SDATA (string), SDATA (new_string),
-            SBYTES (string));
+      memcpy (SDATA (new_string), SDATA (string), SBYTES (string));
       if (nbytes != SBYTES (string))
        str_as_multibyte (SDATA (new_string), nbytes,
                          SBYTES (string), NULL);
@@ -1119,8 +1064,7 @@ the corresponding multibyte character of charset `eight-bit'.
 This differs from `string-as-multibyte' by converting each byte of a correct
 utf-8 sequence to an eight-bit character, not just bytes that don't form a
 correct sequence.  */)
-     (string)
-     Lisp_Object string;
+  (Lisp_Object string)
 {
   CHECK_STRING (string);
 
@@ -1135,8 +1079,7 @@ Otherwise it is a newly created string, with no text properties,
 where each `eight-bit' character is converted to the corresponding byte.
 If STRING contains a non-ASCII, non-`eight-bit' character,
 an error is signaled.  */)
-     (string)
-     Lisp_Object string;
+  (Lisp_Object string)
 {
   CHECK_STRING (string);
 
@@ -1162,8 +1105,7 @@ but does not share the alist structure with ALIST.
 The objects mapped (cars and cdrs of elements of the alist)
 are shared, however.
 Elements of ALIST that are not conses are also shared.  */)
-     (alist)
-     Lisp_Object alist;
+  (Lisp_Object alist)
 {
   register Lisp_Object tem;
 
@@ -1193,9 +1135,7 @@ to the end of STRING.
 The STRING argument may also be a vector.  In that case, the return
 value is a new vector that contains the elements between index FROM
 \(inclusive) and index TO (exclusive) of that vector argument.  */)
-     (string, from, to)
-     Lisp_Object string;
-     register Lisp_Object from, to;
+  (Lisp_Object string, register Lisp_Object from, Lisp_Object to)
 {
   Lisp_Object res;
   int size;
@@ -1264,9 +1204,7 @@ If FROM is nil or omitted, the substring starts at the beginning of STRING.
 If FROM or TO is negative, it counts from the end.
 
 With one argument, just copy STRING without its properties.  */)
-     (string, from, to)
-     Lisp_Object string;
-     register Lisp_Object from, to;
+  (Lisp_Object string, register Lisp_Object from, Lisp_Object to)
 {
   int size, size_byte;
   int from_char, to_char;
@@ -1318,9 +1256,7 @@ With one argument, just copy STRING without its properties.  */)
    both in characters and in bytes.  */
 
 Lisp_Object
-substring_both (string, from, from_byte, to, to_byte)
-     Lisp_Object string;
-     int from, from_byte, to, to_byte;
+substring_both (Lisp_Object string, int from, int from_byte, int to, int to_byte)
 {
   Lisp_Object res;
   int size;
@@ -1355,9 +1291,7 @@ substring_both (string, from, from_byte, to, to_byte)
 \f
 DEFUN ("nthcdr", Fnthcdr, Snthcdr, 2, 2, 0,
        doc: /* Take cdr N times on LIST, return the result.  */)
-     (n, list)
-     Lisp_Object n;
-     register Lisp_Object list;
+  (Lisp_Object n, Lisp_Object list)
 {
   register int i, num;
   CHECK_NUMBER (n);
@@ -1374,16 +1308,14 @@ DEFUN ("nthcdr", Fnthcdr, Snthcdr, 2, 2, 0,
 DEFUN ("nth", Fnth, Snth, 2, 2, 0,
        doc: /* Return the Nth element of LIST.
 N counts from zero.  If LIST is not that long, nil is returned.  */)
-     (n, list)
-     Lisp_Object n, list;
+  (Lisp_Object n, Lisp_Object list)
 {
   return Fcar (Fnthcdr (n, list));
 }
 
 DEFUN ("elt", Felt, Selt, 2, 2, 0,
        doc: /* Return element of SEQUENCE at index N.  */)
-     (sequence, n)
-     register Lisp_Object sequence, n;
+  (register Lisp_Object sequence, Lisp_Object n)
 {
   CHECK_NUMBER (n);
   if (CONSP (sequence) || NILP (sequence))
@@ -1397,9 +1329,7 @@ DEFUN ("elt", Felt, Selt, 2, 2, 0,
 DEFUN ("member", Fmember, Smember, 2, 2, 0,
        doc: /* Return non-nil if ELT is an element of LIST.  Comparison done with `equal'.
 The value is actually the tail of LIST whose car is ELT.  */)
-     (elt, list)
-     register Lisp_Object elt;
-     Lisp_Object list;
+  (register Lisp_Object elt, Lisp_Object list)
 {
   register Lisp_Object tail;
   for (tail = list; CONSP (tail); tail = XCDR (tail))
@@ -1417,8 +1347,7 @@ The value is actually the tail of LIST whose car is ELT.  */)
 DEFUN ("memq", Fmemq, Smemq, 2, 2, 0,
        doc: /* Return non-nil if ELT is an element of LIST.  Comparison done with `eq'.
 The value is actually the tail of LIST whose car is ELT.  */)
-     (elt, list)
-     register Lisp_Object elt, list;
+  (register Lisp_Object elt, Lisp_Object list)
 {
   while (1)
     {
@@ -1444,9 +1373,7 @@ The value is actually the tail of LIST whose car is ELT.  */)
 DEFUN ("memql", Fmemql, Smemql, 2, 2, 0,
        doc: /* Return non-nil if ELT is an element of LIST.  Comparison done with `eql'.
 The value is actually the tail of LIST whose car is ELT.  */)
-     (elt, list)
-     register Lisp_Object elt;
-     Lisp_Object list;
+  (register Lisp_Object elt, Lisp_Object list)
 {
   register Lisp_Object tail;
 
@@ -1469,8 +1396,7 @@ DEFUN ("assq", Fassq, Sassq, 2, 2, 0,
        doc: /* Return non-nil if KEY is `eq' to the car of an element of LIST.
 The value is actually the first element of LIST whose car is KEY.
 Elements of LIST that are not conses are ignored.  */)
-     (key, list)
-     Lisp_Object key, list;
+  (Lisp_Object key, Lisp_Object list)
 {
   while (1)
     {
@@ -1502,8 +1428,7 @@ Elements of LIST that are not conses are ignored.  */)
    Use only on lists known never to be circular.  */
 
 Lisp_Object
-assq_no_quit (key, list)
-     Lisp_Object key, list;
+assq_no_quit (Lisp_Object key, Lisp_Object list)
 {
   while (CONSP (list)
         && (!CONSP (XCAR (list))
@@ -1516,8 +1441,7 @@ assq_no_quit (key, list)
 DEFUN ("assoc", Fassoc, Sassoc, 2, 2, 0,
        doc: /* Return non-nil if KEY is `equal' to the car of an element of LIST.
 The value is actually the first element of LIST whose car equals KEY.  */)
-     (key, list)
-     Lisp_Object key, list;
+  (Lisp_Object key, Lisp_Object list)
 {
   Lisp_Object car;
 
@@ -1554,8 +1478,7 @@ The value is actually the first element of LIST whose car equals KEY.  */)
    Use only on lists known never to be circular.  */
 
 Lisp_Object
-assoc_no_quit (key, list)
-     Lisp_Object key, list;
+assoc_no_quit (Lisp_Object key, Lisp_Object list)
 {
   while (CONSP (list)
         && (!CONSP (XCAR (list))
@@ -1569,9 +1492,7 @@ assoc_no_quit (key, list)
 DEFUN ("rassq", Frassq, Srassq, 2, 2, 0,
        doc: /* Return non-nil if KEY is `eq' to the cdr of an element of LIST.
 The value is actually the first element of LIST whose cdr is KEY.  */)
-     (key, list)
-     register Lisp_Object key;
-     Lisp_Object list;
+  (register Lisp_Object key, Lisp_Object list)
 {
   while (1)
     {
@@ -1602,8 +1523,7 @@ The value is actually the first element of LIST whose cdr is KEY.  */)
 DEFUN ("rassoc", Frassoc, Srassoc, 2, 2, 0,
        doc: /* Return non-nil if KEY is `equal' to the cdr of an element of LIST.
 The value is actually the first element of LIST whose cdr equals KEY.  */)
-     (key, list)
-     Lisp_Object key, list;
+  (Lisp_Object key, Lisp_Object list)
 {
   Lisp_Object cdr;
 
@@ -1642,9 +1562,7 @@ The modified LIST is returned.  Comparison is done with `eq'.
 If the first member of LIST is ELT, there is no way to remove it by side effect;
 therefore, write `(setq foo (delq element foo))'
 to be sure of changing the value of `foo'.  */)
-     (elt, list)
-     register Lisp_Object elt;
-     Lisp_Object list;
+  (register Lisp_Object elt, Lisp_Object list)
 {
   register Lisp_Object tail, prev;
   register Lisp_Object tem;
@@ -1678,8 +1596,7 @@ If SEQ is not a list, or the first member of SEQ is ELT, deleting it
 is not a side effect; it is simply using a different sequence.
 Therefore, write `(setq foo (delete element foo))'
 to be sure of changing the value of `foo'.  */)
-     (elt, seq)
-     Lisp_Object elt, seq;
+  (Lisp_Object elt, Lisp_Object seq)
 {
   if (VECTORP (seq))
     {
@@ -1794,8 +1711,7 @@ to be sure of changing the value of `foo'.  */)
 DEFUN ("nreverse", Fnreverse, Snreverse, 1, 1, 0,
        doc: /* Reverse LIST by modifying cdr pointers.
 Return the reversed list.  */)
-     (list)
-     Lisp_Object list;
+  (Lisp_Object list)
 {
   register Lisp_Object prev, tail, next;
 
@@ -1817,8 +1733,7 @@ Return the reversed list.  */)
 DEFUN ("reverse", Freverse, Sreverse, 1, 1, 0,
        doc: /* Reverse LIST, copying.  Return the reversed list.
 See also the function `nreverse', which is used more often.  */)
-     (list)
-     Lisp_Object list;
+  (Lisp_Object list)
 {
   Lisp_Object new;
 
@@ -1831,15 +1746,14 @@ See also the function `nreverse', which is used more often.  */)
   return new;
 }
 \f
-Lisp_Object merge ();
+Lisp_Object merge (Lisp_Object org_l1, Lisp_Object org_l2, Lisp_Object pred);
 
 DEFUN ("sort", Fsort, Ssort, 2, 2, 0,
        doc: /* Sort LIST, stably, comparing elements using PREDICATE.
 Returns the sorted list.  LIST is modified by side effects.
 PREDICATE is called with two elements of LIST, and should return non-nil
 if the first element should sort before the second.  */)
-     (list, predicate)
-     Lisp_Object list, predicate;
+  (Lisp_Object list, Lisp_Object predicate)
 {
   Lisp_Object front, back;
   register Lisp_Object len, tem;
@@ -1865,9 +1779,7 @@ if the first element should sort before the second.  */)
 }
 
 Lisp_Object
-merge (org_l1, org_l2, pred)
-     Lisp_Object org_l1, org_l2;
-     Lisp_Object pred;
+merge (Lisp_Object org_l1, Lisp_Object org_l2, Lisp_Object pred)
 {
   Lisp_Object value;
   register Lisp_Object tail;
@@ -1933,9 +1845,7 @@ PLIST is a property list, which is a list of the form
 \(PROP1 VALUE1 PROP2 VALUE2...).  This function returns the value
 corresponding to the given PROP, or nil if PROP is not one of the
 properties on the list.  This function never signals an error.  */)
-     (plist, prop)
-     Lisp_Object plist;
-     Lisp_Object prop;
+  (Lisp_Object plist, Lisp_Object prop)
 {
   Lisp_Object tail, halftail;
 
@@ -1965,8 +1875,7 @@ properties on the list.  This function never signals an error.  */)
 DEFUN ("get", Fget, Sget, 2, 2, 0,
        doc: /* Return the value of SYMBOL's PROPNAME property.
 This is the last value stored with `(put SYMBOL PROPNAME VALUE)'.  */)
-     (symbol, propname)
-     Lisp_Object symbol, propname;
+  (Lisp_Object symbol, Lisp_Object propname)
 {
   CHECK_SYMBOL (symbol);
   return Fplist_get (XSYMBOL (symbol)->plist, propname);
@@ -1980,10 +1889,7 @@ If PROP is already a property on the list, its value is set to VAL,
 otherwise the new PROP VAL pair is added.  The new plist is returned;
 use `(setq x (plist-put x prop val))' to be sure to use the new value.
 The PLIST is modified by side effects.  */)
-     (plist, prop, val)
-     Lisp_Object plist;
-     register Lisp_Object prop;
-     Lisp_Object val;
+  (Lisp_Object plist, register Lisp_Object prop, Lisp_Object val)
 {
   register Lisp_Object tail, prev;
   Lisp_Object newcell;
@@ -2011,8 +1917,7 @@ The PLIST is modified by side effects.  */)
 DEFUN ("put", Fput, Sput, 3, 3, 0,
        doc: /* Store SYMBOL's PROPNAME property with value VALUE.
 It can be retrieved with `(get SYMBOL PROPNAME)'.  */)
-     (symbol, propname, value)
-     Lisp_Object symbol, propname, value;
+  (Lisp_Object symbol, Lisp_Object propname, Lisp_Object value)
 {
   CHECK_SYMBOL (symbol);
   XSYMBOL (symbol)->plist
@@ -2026,9 +1931,7 @@ PLIST is a property list, which is a list of the form
 \(PROP1 VALUE1 PROP2 VALUE2...).  This function returns the value
 corresponding to the given PROP, or nil if PROP is not
 one of the properties on the list.  */)
-     (plist, prop)
-     Lisp_Object plist;
-     Lisp_Object prop;
+  (Lisp_Object plist, Lisp_Object prop)
 {
   Lisp_Object tail;
 
@@ -2055,10 +1958,7 @@ If PROP is already a property on the list, its value is set to VAL,
 otherwise the new PROP VAL pair is added.  The new plist is returned;
 use `(setq x (lax-plist-put x prop val))' to be sure to use the new value.
 The PLIST is modified by side effects.  */)
-     (plist, prop, val)
-     Lisp_Object plist;
-     register Lisp_Object prop;
-     Lisp_Object val;
+  (Lisp_Object plist, register Lisp_Object prop, Lisp_Object val)
 {
   register Lisp_Object tail, prev;
   Lisp_Object newcell;
@@ -2086,8 +1986,7 @@ The PLIST is modified by side effects.  */)
 DEFUN ("eql", Feql, Seql, 2, 2, 0,
        doc: /* Return t if the two args are the same Lisp object.
 Floating-point numbers of equal value are `eql', but they may not be `eq'.  */)
-     (obj1, obj2)
-     Lisp_Object obj1, obj2;
+  (Lisp_Object obj1, Lisp_Object obj2)
 {
   if (FLOATP (obj1))
     return internal_equal (obj1, obj2, 0, 0) ? Qt : Qnil;
@@ -2103,8 +2002,7 @@ Vectors and strings are compared element by element.
 Numbers are compared by value, but integers cannot equal floats.
  (Use `=' if you want integers and floats to be able to be equal.)
 Symbols must match exactly.  */)
-     (o1, o2)
-     register Lisp_Object o1, o2;
+  (register Lisp_Object o1, Lisp_Object o2)
 {
   return internal_equal (o1, o2, 0, 0) ? Qt : Qnil;
 }
@@ -2113,8 +2011,7 @@ DEFUN ("equal-including-properties", Fequal_including_properties, Sequal_includi
        doc: /* Return t if two Lisp objects have similar structure and contents.
 This is like `equal' except that it compares the text properties
 of strings.  (`equal' ignores text properties.)  */)
-     (o1, o2)
-     register Lisp_Object o1, o2;
+  (register Lisp_Object o1, Lisp_Object o2)
 {
   return internal_equal (o1, o2, 0, 1) ? Qt : Qnil;
 }
@@ -2124,9 +2021,7 @@ of strings.  (`equal' ignores text properties.)  */)
    PROPS, if non-nil, means compare string text properties too.  */
 
 static int
-internal_equal (o1, o2, depth, props)
-     register Lisp_Object o1, o2;
-     int depth, props;
+internal_equal (register Lisp_Object o1, register Lisp_Object o2, int depth, int props)
 {
   if (depth > 200)
     error ("Stack overflow in equal");
@@ -2198,8 +2093,8 @@ internal_equal (o1, o2, depth, props)
 
            if (XBOOL_VECTOR (o1)->size != XBOOL_VECTOR (o2)->size)
              return 0;
-           if (bcmp (XBOOL_VECTOR (o1)->data, XBOOL_VECTOR (o2)->data,
-                     size_in_chars))
+           if (memcmp (XBOOL_VECTOR (o1)->data, XBOOL_VECTOR (o2)->data,
+                       size_in_chars))
              return 0;
            return 1;
          }
@@ -2233,8 +2128,7 @@ internal_equal (o1, o2, depth, props)
        return 0;
       if (SBYTES (o1) != SBYTES (o2))
        return 0;
-      if (bcmp (SDATA (o1), SDATA (o2),
-               SBYTES (o1)))
+      if (memcmp (SDATA (o1), SDATA (o2), SBYTES (o1)))
        return 0;
       if (props && !compare_string_intervals (o1, o2))
        return 0;
@@ -2247,13 +2141,11 @@ internal_equal (o1, o2, depth, props)
   return 0;
 }
 \f
-extern Lisp_Object Fmake_char_internal ();
 
 DEFUN ("fillarray", Ffillarray, Sfillarray, 2, 2, 0,
        doc: /* Store each element of ARRAY with ITEM.
 ARRAY is a vector, string, char-table, or bool-vector.  */)
-     (array, item)
-     Lisp_Object array, item;
+  (Lisp_Object array, Lisp_Object item)
 {
   register int size, index, charval;
   if (VECTORP (array))
@@ -2288,7 +2180,7 @@ ARRAY is a vector, string, char-table, or bool-vector.  */)
          if (size != size_byte)
            while (p1 < endp)
              {
-               int this_len = MULTIBYTE_FORM_LENGTH (p1, endp - p1);
+               int this_len = BYTES_BY_CHAR_HEAD (*p1);
                if (len != this_len)
                  error ("Attempt to change byte length of a string");
                p1 += this_len;
@@ -2327,13 +2219,12 @@ DEFUN ("clear-string", Fclear_string, Sclear_string,
        1, 1, 0,
        doc: /* Clear the contents of STRING.
 This makes STRING unibyte and may change its length.  */)
-     (string)
-     Lisp_Object string;
+  (Lisp_Object string)
 {
   int len;
   CHECK_STRING (string);
   len = SBYTES (string);
-  bzero (SDATA (string), len);
+  memset (SDATA (string), 0, len);
   STRING_SET_CHARS (string, len);
   STRING_SET_UNIBYTE (string);
   return Qnil;
@@ -2341,26 +2232,19 @@ This makes STRING unibyte and may change its length.  */)
 \f
 /* ARGSUSED */
 Lisp_Object
-nconc2 (s1, s2)
-     Lisp_Object s1, s2;
+nconc2 (Lisp_Object s1, Lisp_Object s2)
 {
-#ifdef NO_ARG_ARRAY
   Lisp_Object args[2];
   args[0] = s1;
   args[1] = s2;
   return Fnconc (2, args);
-#else
-  return Fnconc (2, &s1);
-#endif /* NO_ARG_ARRAY */
 }
 
 DEFUN ("nconc", Fnconc, Snconc, 0, MANY, 0,
        doc: /* Concatenate any number of lists by altering them.
 Only the last argument is not altered, and need not be a list.
 usage: (nconc &rest LISTS)  */)
-     (nargs, args)
-     int nargs;
-     Lisp_Object *args;
+  (int nargs, Lisp_Object *args)
 {
   register int argnum;
   register Lisp_Object tail, tem, val;
@@ -2401,10 +2285,7 @@ usage: (nconc &rest LISTS)  */)
  LENI is the length of VALS, which should also be the length of SEQ.  */
 
 static void
-mapcar1 (leni, vals, fn, seq)
-     int leni;
-     Lisp_Object *vals;
-     Lisp_Object fn, seq;
+mapcar1 (int leni, Lisp_Object *vals, Lisp_Object fn, Lisp_Object seq)
 {
   register Lisp_Object tail;
   Lisp_Object dummy;
@@ -2484,8 +2365,7 @@ DEFUN ("mapconcat", Fmapconcat, Smapconcat, 3, 3, 0,
 In between each pair of results, stick in SEPARATOR.  Thus, " " as
 SEPARATOR results in spaces between the values returned by FUNCTION.
 SEQUENCE may be a list, a vector, a bool-vector, or a string.  */)
-     (function, sequence, separator)
-     Lisp_Object function, sequence, separator;
+  (Lisp_Object function, Lisp_Object sequence, Lisp_Object separator)
 {
   Lisp_Object len;
   register int leni;
@@ -2525,8 +2405,7 @@ DEFUN ("mapcar", Fmapcar, Smapcar, 2, 2, 0,
        doc: /* Apply FUNCTION to each element of SEQUENCE, and make a list of the results.
 The result is a list just as long as SEQUENCE.
 SEQUENCE may be a list, a vector, a bool-vector, or a string.  */)
-     (function, sequence)
-     Lisp_Object function, sequence;
+  (Lisp_Object function, Lisp_Object sequence)
 {
   register Lisp_Object len;
   register int leni;
@@ -2553,8 +2432,7 @@ DEFUN ("mapc", Fmapc, Smapc, 2, 2, 0,
        doc: /* Apply FUNCTION to each element of SEQUENCE for side effects only.
 Unlike `mapcar', don't accumulate the results.  Return SEQUENCE.
 SEQUENCE may be a list, a vector, a bool-vector, or a string.  */)
-     (function, sequence)
-     Lisp_Object function, sequence;
+  (Lisp_Object function, Lisp_Object sequence)
 {
   register int leni;
 
@@ -2580,8 +2458,7 @@ for more information.  In this case, the useful bindings are `act', `skip',
 
 Under a windowing system a dialog box will be used if `last-nonmenu-event'
 is nil and `use-dialog-box' is non-nil.  */)
-     (prompt)
-     Lisp_Object prompt;
+  (Lisp_Object prompt)
 {
   register Lisp_Object obj, key, def, map;
   register int answer;
@@ -2713,8 +2590,7 @@ is nil and `use-dialog-box' is non-nil.  */)
    Anything that calls this function must protect from GC!  */
 
 Lisp_Object
-do_yes_or_no_p (prompt)
-     Lisp_Object prompt;
+do_yes_or_no_p (Lisp_Object prompt)
 {
   return call1 (intern ("yes-or-no-p"), prompt);
 }
@@ -2730,8 +2606,7 @@ and can edit it until it has been confirmed.
 
 Under a windowing system a dialog box will be used if `last-nonmenu-event'
 is nil, and `use-dialog-box' is non-nil.  */)
-     (prompt)
-     Lisp_Object prompt;
+  (Lisp_Object prompt)
 {
   register Lisp_Object ans;
   Lisp_Object args[2];
@@ -2803,8 +2678,7 @@ An error is thrown if the load average can't be obtained.  In some
 cases making it work would require Emacs being installed setuid or
 setgid so that it can read kernel information, and that usually isn't
 advisable.  */)
-     (use_floats)
-     Lisp_Object use_floats;
+  (Lisp_Object use_floats)
 {
   double load_ave[3];
   int loads = getloadavg (load_ave, 3);
@@ -2825,7 +2699,6 @@ advisable.  */)
 }
 \f
 Lisp_Object Vfeatures, Qsubfeatures;
-extern Lisp_Object Vafter_load_alist;
 
 DEFUN ("featurep", Ffeaturep, Sfeaturep, 1, 2, 0,
        doc: /* Return t if FEATURE is present in this Emacs.
@@ -2835,8 +2708,7 @@ presence or absence of Emacs or environment extensions.
 Use `provide' to declare that a feature is available.  This function
 looks at the value of the variable `features'.  The optional argument
 SUBFEATURE can be used to check a specific subfeature of FEATURE.  */)
-     (feature, subfeature)
-     Lisp_Object feature, subfeature;
+  (Lisp_Object feature, Lisp_Object subfeature)
 {
   register Lisp_Object tem;
   CHECK_SYMBOL (feature);
@@ -2850,8 +2722,7 @@ DEFUN ("provide", Fprovide, Sprovide, 1, 2, 0,
        doc: /* Announce that FEATURE is a feature of the current Emacs.
 The optional argument SUBFEATURES should be a list of symbols listing
 particular subfeatures supported in this version of FEATURE.  */)
-     (feature, subfeatures)
-     Lisp_Object feature, subfeatures;
+  (Lisp_Object feature, Lisp_Object subfeatures)
 {
   register Lisp_Object tem;
   CHECK_SYMBOL (feature);
@@ -2881,8 +2752,7 @@ particular subfeatures supported in this version of FEATURE.  */)
 Lisp_Object require_nesting_list;
 
 Lisp_Object
-require_unwind (old_value)
-     Lisp_Object old_value;
+require_unwind (Lisp_Object old_value)
 {
   return require_nesting_list = old_value;
 }
@@ -2898,8 +2768,7 @@ If the optional third argument NOERROR is non-nil,
 then return nil if the file is not found instead of signaling an error.
 Normally the return value is FEATURE.
 The normal messages at start and end of loading FILENAME are suppressed.  */)
-     (feature, filename, noerror)
-     Lisp_Object feature, filename, noerror;
+  (Lisp_Object feature, Lisp_Object filename, Lisp_Object noerror)
 {
   register Lisp_Object tem;
   struct gcpro gcpro1, gcpro2;
@@ -2994,8 +2863,7 @@ PLIST is a property list, which is a list of the form
 Unlike `plist-get', this allows you to distinguish between a missing
 property and a property with the value nil.
 The value is actually the tail of PLIST whose car is PROP.  */)
-     (plist, prop)
-     Lisp_Object plist, prop;
+  (Lisp_Object plist, Lisp_Object prop)
 {
   while (CONSP (plist) && !EQ (XCAR (plist), prop))
     {
@@ -3009,8 +2877,7 @@ The value is actually the tail of PLIST whose car is PROP.  */)
 DEFUN ("widget-put", Fwidget_put, Swidget_put, 3, 3, 0,
        doc: /* In WIDGET, set PROPERTY to VALUE.
 The value can later be retrieved with `widget-get'.  */)
-     (widget, property, value)
-     Lisp_Object widget, property, value;
+  (Lisp_Object widget, Lisp_Object property, Lisp_Object value)
 {
   CHECK_CONS (widget);
   XSETCDR (widget, Fplist_put (XCDR (widget), property, value));
@@ -3021,8 +2888,7 @@ DEFUN ("widget-get", Fwidget_get, Swidget_get, 2, 2, 0,
        doc: /* In WIDGET, get the value of PROPERTY.
 The value could either be specified when the widget was created, or
 later with `widget-put'.  */)
-     (widget, property)
-     Lisp_Object widget, property;
+  (Lisp_Object widget, Lisp_Object property)
 {
   Lisp_Object tmp;
 
@@ -3048,9 +2914,7 @@ DEFUN ("widget-apply", Fwidget_apply, Swidget_apply, 2, MANY, 0,
        doc: /* Apply the value of WIDGET's PROPERTY to the widget itself.
 ARGS are passed as extra arguments to the function.
 usage: (widget-apply WIDGET PROPERTY &rest ARGS)  */)
-     (nargs, args)
-     int nargs;
-     Lisp_Object *args;
+  (int nargs, Lisp_Object *args)
 {
   /* This function can GC. */
   Lisp_Object newargs[3];
@@ -3089,8 +2953,7 @@ If the system can't provide such information through a call to
 See also Info node `(libc)Locales'.
 
 The data read from the system are decoded using `locale-coding-system'.  */)
-     (item)
-     Lisp_Object item;
+  (Lisp_Object item)
 {
   char *str = NULL;
 #ifdef HAVE_LANGINFO_CODESET
@@ -3235,8 +3098,8 @@ static const short base64_char_to_value[128] =
    base64 characters.  */
 
 
-static int base64_encode_1 P_ ((const char *, char *, int, int, int));
-static int base64_decode_1 P_ ((const char *, char *, int, int, int *));
+static int base64_encode_1 (const char *, char *, int, int, int);
+static int base64_decode_1 (const char *, char *, int, int, int *);
 
 DEFUN ("base64-encode-region", Fbase64_encode_region, Sbase64_encode_region,
        2, 3, "r",
@@ -3244,8 +3107,7 @@ DEFUN ("base64-encode-region", Fbase64_encode_region, Sbase64_encode_region,
 Return the length of the encoded text.
 Optional third argument NO-LINE-BREAK means do not break long lines
 into shorter lines.  */)
-     (beg, end, no_line_break)
-     Lisp_Object beg, end, no_line_break;
+  (Lisp_Object beg, Lisp_Object end, Lisp_Object no_line_break)
 {
   char *encoded;
   int allength, length;
@@ -3304,8 +3166,7 @@ DEFUN ("base64-encode-string", Fbase64_encode_string, Sbase64_encode_string,
        doc: /* Base64-encode STRING and return the result.
 Optional second argument NO-LINE-BREAK means do not break long lines
 into shorter lines.  */)
-     (string, no_line_break)
-     Lisp_Object string, no_line_break;
+  (Lisp_Object string, Lisp_Object no_line_break)
 {
   int allength, length, encoded_length;
   char *encoded;
@@ -3344,12 +3205,7 @@ into shorter lines.  */)
 }
 
 static int
-base64_encode_1 (from, to, length, line_break, multibyte)
-     const char *from;
-     char *to;
-     int length;
-     int line_break;
-     int multibyte;
+base64_encode_1 (const char *from, char *to, int length, int line_break, int multibyte)
 {
   int counter = 0, i = 0;
   char *e = to;
@@ -3448,8 +3304,7 @@ DEFUN ("base64-decode-region", Fbase64_decode_region, Sbase64_decode_region,
        doc: /* Base64-decode the region between BEG and END.
 Return the length of the decoded text.
 If the region can't be decoded, signal an error and don't modify the buffer.  */)
-     (beg, end)
-     Lisp_Object beg, end;
+  (Lisp_Object beg, Lisp_Object end)
 {
   int ibeg, iend, length, allength;
   char *decoded;
@@ -3509,8 +3364,7 @@ If the region can't be decoded, signal an error and don't modify the buffer.  */
 DEFUN ("base64-decode-string", Fbase64_decode_string, Sbase64_decode_string,
        1, 1, 0,
        doc: /* Base64-decode STRING and return the result.  */)
-     (string)
-     Lisp_Object string;
+  (Lisp_Object string)
 {
   char *decoded;
   int length, decoded_length;
@@ -3546,12 +3400,7 @@ DEFUN ("base64-decode-string", Fbase64_decode_string, Sbase64_decode_string,
    characters in *NCHARS_RETURN.  */
 
 static int
-base64_decode_1 (from, to, length, multibyte, nchars_return)
-     const char *from;
-     char *to;
-     int length;
-     int multibyte;
-     int *nchars_return;
+base64_decode_1 (const char *from, char *to, int length, int multibyte, int *nchars_return)
 {
   int i = 0;
   char *e = to;
@@ -3663,25 +3512,25 @@ Lisp_Object Qhash_table_test, Qkey_or_value, Qkey_and_value;
 
 /* Function prototypes.  */
 
-static struct Lisp_Hash_Table *check_hash_table P_ ((Lisp_Object));
-static int get_key_arg P_ ((Lisp_Object, int, Lisp_Object *, char *));
-static void maybe_resize_hash_table P_ ((struct Lisp_Hash_Table *));
-static int cmpfn_eql P_ ((struct Lisp_Hash_Table *, Lisp_Object, unsigned,
-                         Lisp_Object, unsigned));
-static int cmpfn_equal P_ ((struct Lisp_Hash_Table *, Lisp_Object, unsigned,
-                           Lisp_Object, unsigned));
-static int cmpfn_user_defined P_ ((struct Lisp_Hash_Table *, Lisp_Object,
-                                  unsigned, Lisp_Object, unsigned));
-static unsigned hashfn_eq P_ ((struct Lisp_Hash_Table *, Lisp_Object));
-static unsigned hashfn_eql P_ ((struct Lisp_Hash_Table *, Lisp_Object));
-static unsigned hashfn_equal P_ ((struct Lisp_Hash_Table *, Lisp_Object));
-static unsigned hashfn_user_defined P_ ((struct Lisp_Hash_Table *,
-                                        Lisp_Object));
-static unsigned sxhash_string P_ ((unsigned char *, int));
-static unsigned sxhash_list P_ ((Lisp_Object, int));
-static unsigned sxhash_vector P_ ((Lisp_Object, int));
-static unsigned sxhash_bool_vector P_ ((Lisp_Object));
-static int sweep_weak_table P_ ((struct Lisp_Hash_Table *, int));
+static struct Lisp_Hash_Table *check_hash_table (Lisp_Object);
+static int get_key_arg (Lisp_Object, int, Lisp_Object *, char *);
+static void maybe_resize_hash_table (struct Lisp_Hash_Table *);
+static int cmpfn_eql (struct Lisp_Hash_Table *, Lisp_Object, unsigned,
+                      Lisp_Object, unsigned);
+static int cmpfn_equal (struct Lisp_Hash_Table *, Lisp_Object, unsigned,
+                        Lisp_Object, unsigned);
+static int cmpfn_user_defined (struct Lisp_Hash_Table *, Lisp_Object,
+                               unsigned, Lisp_Object, unsigned);
+static unsigned hashfn_eq (struct Lisp_Hash_Table *, Lisp_Object);
+static unsigned hashfn_eql (struct Lisp_Hash_Table *, Lisp_Object);
+static unsigned hashfn_equal (struct Lisp_Hash_Table *, Lisp_Object);
+static unsigned hashfn_user_defined (struct Lisp_Hash_Table *,
+                                     Lisp_Object);
+static unsigned sxhash_string (unsigned char *, int);
+static unsigned sxhash_list (Lisp_Object, int);
+static unsigned sxhash_vector (Lisp_Object, int);
+static unsigned sxhash_bool_vector (Lisp_Object);
+static int sweep_weak_table (struct Lisp_Hash_Table *, int);
 
 
 \f
@@ -3693,8 +3542,7 @@ static int sweep_weak_table P_ ((struct Lisp_Hash_Table *, int));
    Lisp_Hash_Table.  Otherwise, signal an error.  */
 
 static struct Lisp_Hash_Table *
-check_hash_table (obj)
-     Lisp_Object obj;
+check_hash_table (Lisp_Object obj)
 {
   CHECK_HASH_TABLE (obj);
   return XHASH_TABLE (obj);
@@ -3705,8 +3553,7 @@ check_hash_table (obj)
    number.  */
 
 int
-next_almost_prime (n)
-     int n;
+next_almost_prime (int n)
 {
   if (n % 2 == 0)
     n += 1;
@@ -3725,11 +3572,7 @@ next_almost_prime (n)
    a DEFUN parameter list.  */
 
 static int
-get_key_arg (key, nargs, args, used)
-     Lisp_Object key;
-     int nargs;
-     Lisp_Object *args;
-     char *used;
+get_key_arg (Lisp_Object key, int nargs, Lisp_Object *args, char *used)
 {
   int i;
 
@@ -3754,10 +3597,7 @@ get_key_arg (key, nargs, args, used)
    vector that are not copied from VEC are set to INIT.  */
 
 Lisp_Object
-larger_vector (vec, new_size, init)
-     Lisp_Object vec;
-     int new_size;
-     Lisp_Object init;
+larger_vector (Lisp_Object vec, int new_size, Lisp_Object init)
 {
   struct Lisp_Vector *v;
   int i, old_size;
@@ -3767,8 +3607,7 @@ larger_vector (vec, new_size, init)
   xassert (new_size >= old_size);
 
   v = allocate_vector (new_size);
-  bcopy (XVECTOR (vec)->contents, v->contents,
-        old_size * sizeof *v->contents);
+  memcpy (v->contents, XVECTOR (vec)->contents, old_size * sizeof *v->contents);
   for (i = old_size; i < new_size; ++i)
     v->contents[i] = init;
   XSETVECTOR (vec, v);
@@ -3785,10 +3624,7 @@ larger_vector (vec, new_size, init)
    KEY2 are the same.  */
 
 static int
-cmpfn_eql (h, key1, hash1, key2, hash2)
-     struct Lisp_Hash_Table *h;
-     Lisp_Object key1, key2;
-     unsigned hash1, hash2;
+cmpfn_eql (struct Lisp_Hash_Table *h, Lisp_Object key1, unsigned int hash1, Lisp_Object key2, unsigned int hash2)
 {
   return (FLOATP (key1)
          && FLOATP (key2)
@@ -3801,10 +3637,7 @@ cmpfn_eql (h, key1, hash1, key2, hash2)
    KEY2 are the same.  */
 
 static int
-cmpfn_equal (h, key1, hash1, key2, hash2)
-     struct Lisp_Hash_Table *h;
-     Lisp_Object key1, key2;
-     unsigned hash1, hash2;
+cmpfn_equal (struct Lisp_Hash_Table *h, Lisp_Object key1, unsigned int hash1, Lisp_Object key2, unsigned int hash2)
 {
   return hash1 == hash2 && !NILP (Fequal (key1, key2));
 }
@@ -3815,10 +3648,7 @@ cmpfn_equal (h, key1, hash1, key2, hash2)
    if KEY1 and KEY2 are the same.  */
 
 static int
-cmpfn_user_defined (h, key1, hash1, key2, hash2)
-     struct Lisp_Hash_Table *h;
-     Lisp_Object key1, key2;
-     unsigned hash1, hash2;
+cmpfn_user_defined (struct Lisp_Hash_Table *h, Lisp_Object key1, unsigned int hash1, Lisp_Object key2, unsigned int hash2)
 {
   if (hash1 == hash2)
     {
@@ -3839,9 +3669,7 @@ cmpfn_user_defined (h, key1, hash1, key2, hash2)
    in a Lisp integer.  */
 
 static unsigned
-hashfn_eq (h, key)
-     struct Lisp_Hash_Table *h;
-     Lisp_Object key;
+hashfn_eq (struct Lisp_Hash_Table *h, Lisp_Object key)
 {
   unsigned hash = XUINT (key) ^ XTYPE (key);
   xassert ((hash & ~INTMASK) == 0);
@@ -3854,9 +3682,7 @@ hashfn_eq (h, key)
    in a Lisp integer.  */
 
 static unsigned
-hashfn_eql (h, key)
-     struct Lisp_Hash_Table *h;
-     Lisp_Object key;
+hashfn_eql (struct Lisp_Hash_Table *h, Lisp_Object key)
 {
   unsigned hash;
   if (FLOATP (key))
@@ -3873,9 +3699,7 @@ hashfn_eql (h, key)
    in a Lisp integer.  */
 
 static unsigned
-hashfn_equal (h, key)
-     struct Lisp_Hash_Table *h;
-     Lisp_Object key;
+hashfn_equal (struct Lisp_Hash_Table *h, Lisp_Object key)
 {
   unsigned hash = sxhash (key, 0);
   xassert ((hash & ~INTMASK) == 0);
@@ -3888,9 +3712,7 @@ hashfn_equal (h, key)
    guaranteed to fit in a Lisp integer.  */
 
 static unsigned
-hashfn_user_defined (h, key)
-     struct Lisp_Hash_Table *h;
-     Lisp_Object key;
+hashfn_user_defined (struct Lisp_Hash_Table *h, Lisp_Object key)
 {
   Lisp_Object args[2], hash;
 
@@ -3926,10 +3748,9 @@ hashfn_user_defined (h, key)
    one of the symbols `key', `value', `key-or-value', or `key-and-value'.  */
 
 Lisp_Object
-make_hash_table (test, size, rehash_size, rehash_threshold, weak,
-                user_test, user_hash)
-     Lisp_Object test, size, rehash_size, rehash_threshold, weak;
-     Lisp_Object user_test, user_hash;
+make_hash_table (Lisp_Object test, Lisp_Object size, Lisp_Object rehash_size,
+                Lisp_Object rehash_threshold, Lisp_Object weak,
+                Lisp_Object user_test, Lisp_Object user_hash)
 {
   struct Lisp_Hash_Table *h;
   Lisp_Object table;
@@ -4014,8 +3835,7 @@ make_hash_table (test, size, rehash_size, rehash_threshold, weak,
    only the table itself is.  */
 
 Lisp_Object
-copy_hash_table (h1)
-     struct Lisp_Hash_Table *h1;
+copy_hash_table (struct Lisp_Hash_Table *h1)
 {
   Lisp_Object table;
   struct Lisp_Hash_Table *h2;
@@ -4023,7 +3843,7 @@ copy_hash_table (h1)
 
   h2 = allocate_hash_table ();
   next = h2->vec_next;
-  bcopy (h1, h2, sizeof *h2);
+  memcpy (h2, h1, sizeof *h2);
   h2->vec_next = next;
   h2->key_and_value = Fcopy_sequence (h1->key_and_value);
   h2->hash = Fcopy_sequence (h1->hash);
@@ -4046,8 +3866,7 @@ copy_hash_table (h1)
    because it's already too large, throw an error.  */
 
 static INLINE void
-maybe_resize_hash_table (h)
-     struct Lisp_Hash_Table *h;
+maybe_resize_hash_table (struct Lisp_Hash_Table *h)
 {
   if (NILP (h->next_free))
     {
@@ -4112,10 +3931,7 @@ maybe_resize_hash_table (h)
    matching KEY, or -1 if not found.  */
 
 int
-hash_lookup (h, key, hash)
-     struct Lisp_Hash_Table *h;
-     Lisp_Object key;
-     unsigned *hash;
+hash_lookup (struct Lisp_Hash_Table *h, Lisp_Object key, unsigned int *hash)
 {
   unsigned hash_code;
   int start_of_bucket;
@@ -4149,10 +3965,7 @@ hash_lookup (h, key, hash)
    Value is the index of the entry in H matching KEY.  */
 
 int
-hash_put (h, key, value, hash)
-     struct Lisp_Hash_Table *h;
-     Lisp_Object key, value;
-     unsigned hash;
+hash_put (struct Lisp_Hash_Table *h, Lisp_Object key, Lisp_Object value, unsigned int hash)
 {
   int start_of_bucket, i;
 
@@ -4182,9 +3995,7 @@ hash_put (h, key, value, hash)
 /* Remove the entry matching KEY from hash table H, if there is one.  */
 
 static void
-hash_remove_from_table (h, key)
-     struct Lisp_Hash_Table *h;
-     Lisp_Object key;
+hash_remove_from_table (struct Lisp_Hash_Table *h, Lisp_Object key)
 {
   unsigned hash_code;
   int start_of_bucket;
@@ -4232,8 +4043,7 @@ hash_remove_from_table (h, key)
 /* Clear hash table H.  */
 
 void
-hash_clear (h)
-     struct Lisp_Hash_Table *h;
+hash_clear (struct Lisp_Hash_Table *h)
 {
   if (h->count > 0)
     {
@@ -4262,7 +4072,7 @@ hash_clear (h)
  ************************************************************************/
 
 void
-init_weak_hash_tables ()
+init_weak_hash_tables (void)
 {
   weak_hash_tables = NULL;
 }
@@ -4273,9 +4083,7 @@ init_weak_hash_tables ()
    non-zero if anything was marked.  */
 
 static int
-sweep_weak_table (h, remove_entries_p)
-     struct Lisp_Hash_Table *h;
-     int remove_entries_p;
+sweep_weak_table (struct Lisp_Hash_Table *h, int remove_entries_p)
 {
   int bucket, n, marked;
 
@@ -4363,7 +4171,7 @@ sweep_weak_table (h, remove_entries_p)
    from Vweak_hash_tables.  Called from gc_sweep.  */
 
 void
-sweep_weak_hash_tables ()
+sweep_weak_hash_tables (void)
 {
   struct Lisp_Hash_Table *h, *used, *next;
   int marked;
@@ -4431,9 +4239,7 @@ sweep_weak_hash_tables ()
    code returned is guaranteed to fit in a Lisp integer.  */
 
 static unsigned
-sxhash_string (ptr, len)
-     unsigned char *ptr;
-     int len;
+sxhash_string (unsigned char *ptr, int len)
 {
   unsigned char *p = ptr;
   unsigned char *end = p + len;
@@ -4456,9 +4262,7 @@ sxhash_string (ptr, len)
    list.  We don't recurse deeper than SXHASH_MAX_DEPTH in it.  */
 
 static unsigned
-sxhash_list (list, depth)
-     Lisp_Object list;
-     int depth;
+sxhash_list (Lisp_Object list, int depth)
 {
   unsigned hash = 0;
   int i;
@@ -4486,9 +4290,7 @@ sxhash_list (list, depth)
    the Lisp structure.  */
 
 static unsigned
-sxhash_vector (vec, depth)
-     Lisp_Object vec;
-     int depth;
+sxhash_vector (Lisp_Object vec, int depth)
 {
   unsigned hash = ASIZE (vec);
   int i, n;
@@ -4507,8 +4309,7 @@ sxhash_vector (vec, depth)
 /* Return a hash for bool-vector VECTOR.  */
 
 static unsigned
-sxhash_bool_vector (vec)
-     Lisp_Object vec;
+sxhash_bool_vector (Lisp_Object vec)
 {
   unsigned hash = XBOOL_VECTOR (vec)->size;
   int i, n;
@@ -4525,9 +4326,7 @@ sxhash_bool_vector (vec)
    structure.  Value is an unsigned integer clipped to INTMASK.  */
 
 unsigned
-sxhash (obj, depth)
-     Lisp_Object obj;
-     int depth;
+sxhash (Lisp_Object obj, int depth)
 {
   unsigned hash;
 
@@ -4598,8 +4397,7 @@ sxhash (obj, depth)
 
 DEFUN ("sxhash", Fsxhash, Ssxhash, 1, 1, 0,
        doc: /* Compute a hash code for OBJ and return it as integer.  */)
-     (obj)
-     Lisp_Object obj;
+  (Lisp_Object obj)
 {
   unsigned hash = sxhash (obj, 0);
   return make_number (hash);
@@ -4621,13 +4419,13 @@ keys.  Default is `eql'.  Predefined are the tests `eq', `eql', and
 Default is 65.
 
 :rehash-size REHASH-SIZE - Indicates how to expand the table when it
-fills up.  If REHASH-SIZE is an integer, add that many space.  If it
-is a float, it must be > 1.0, and the new size is computed by
-multiplying the old size with that factor.  Default is 1.5.
+fills up.  If REHASH-SIZE is an integer, increase the size by that
+amount.  If it is a float, it must be > 1.0, and the new size is the
+old size multiplied by that factor.  Default is 1.5.
 
 :rehash-threshold THRESHOLD -- THRESHOLD must a float > 0, and <= 1.0.
 Resize the hash table when the ratio (number of entries / table size)
-is greater or equal than THRESHOLD.  Default is 0.8.
+is greater than or equal to THRESHOLD.  Default is 0.8.
 
 :weakness WEAK -- WEAK must be one of nil, t, `key', `value',
 `key-or-value', or `key-and-value'.  If WEAK is not nil, the table
@@ -4638,9 +4436,7 @@ WEAK.  WEAK t is equivalent to `key-and-value'.  Default value of WEAK
 is nil.
 
 usage: (make-hash-table &rest KEYWORD-ARGS)  */)
-     (nargs, args)
-     int nargs;
-     Lisp_Object *args;
+  (int nargs, Lisp_Object *args)
 {
   Lisp_Object test, size, rehash_size, rehash_threshold, weak;
   Lisp_Object user_test, user_hash;
@@ -4650,7 +4446,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);
-  bzero (used, nargs * sizeof *used);
+  memset (used, 0, nargs * sizeof *used);
 
   /* See if there's a `:test TEST' among the arguments.  */
   i = get_key_arg (QCtest, nargs, args, used);
@@ -4717,8 +4513,7 @@ usage: (make-hash-table &rest KEYWORD-ARGS)  */)
 
 DEFUN ("copy-hash-table", Fcopy_hash_table, Scopy_hash_table, 1, 1, 0,
        doc: /* Return a copy of hash table TABLE.  */)
-     (table)
-     Lisp_Object table;
+  (Lisp_Object table)
 {
   return copy_hash_table (check_hash_table (table));
 }
@@ -4726,8 +4521,7 @@ DEFUN ("copy-hash-table", Fcopy_hash_table, Scopy_hash_table, 1, 1, 0,
 
 DEFUN ("hash-table-count", Fhash_table_count, Shash_table_count, 1, 1, 0,
        doc: /* Return the number of elements in TABLE.  */)
-     (table)
-     Lisp_Object table;
+  (Lisp_Object table)
 {
   return make_number (check_hash_table (table)->count);
 }
@@ -4736,8 +4530,7 @@ DEFUN ("hash-table-count", Fhash_table_count, Shash_table_count, 1, 1, 0,
 DEFUN ("hash-table-rehash-size", Fhash_table_rehash_size,
        Shash_table_rehash_size, 1, 1, 0,
        doc: /* Return the current rehash size of TABLE.  */)
-     (table)
-     Lisp_Object table;
+  (Lisp_Object table)
 {
   return check_hash_table (table)->rehash_size;
 }
@@ -4746,8 +4539,7 @@ DEFUN ("hash-table-rehash-size", Fhash_table_rehash_size,
 DEFUN ("hash-table-rehash-threshold", Fhash_table_rehash_threshold,
        Shash_table_rehash_threshold, 1, 1, 0,
        doc: /* Return the current rehash threshold of TABLE.  */)
-     (table)
-     Lisp_Object table;
+  (Lisp_Object table)
 {
   return check_hash_table (table)->rehash_threshold;
 }
@@ -4758,8 +4550,7 @@ DEFUN ("hash-table-size", Fhash_table_size, Shash_table_size, 1, 1, 0,
 The size can be used as an argument to `make-hash-table' to create
 a hash table than can hold as many elements as TABLE holds
 without need for resizing.  */)
-     (table)
-       Lisp_Object table;
+  (Lisp_Object table)
 {
   struct Lisp_Hash_Table *h = check_hash_table (table);
   return make_number (HASH_TABLE_SIZE (h));
@@ -4768,8 +4559,7 @@ without need for resizing.  */)
 
 DEFUN ("hash-table-test", Fhash_table_test, Shash_table_test, 1, 1, 0,
        doc: /* Return the test TABLE uses.  */)
-     (table)
-     Lisp_Object table;
+  (Lisp_Object table)
 {
   return check_hash_table (table)->test;
 }
@@ -4778,8 +4568,7 @@ DEFUN ("hash-table-test", Fhash_table_test, Shash_table_test, 1, 1, 0,
 DEFUN ("hash-table-weakness", Fhash_table_weakness, Shash_table_weakness,
        1, 1, 0,
        doc: /* Return the weakness of TABLE.  */)
-     (table)
-     Lisp_Object table;
+  (Lisp_Object table)
 {
   return check_hash_table (table)->weak;
 }
@@ -4787,8 +4576,7 @@ DEFUN ("hash-table-weakness", Fhash_table_weakness, Shash_table_weakness,
 
 DEFUN ("hash-table-p", Fhash_table_p, Shash_table_p, 1, 1, 0,
        doc: /* Return t if OBJ is a Lisp hash table object.  */)
-     (obj)
-     Lisp_Object obj;
+  (Lisp_Object obj)
 {
   return HASH_TABLE_P (obj) ? Qt : Qnil;
 }
@@ -4796,8 +4584,7 @@ DEFUN ("hash-table-p", Fhash_table_p, Shash_table_p, 1, 1, 0,
 
 DEFUN ("clrhash", Fclrhash, Sclrhash, 1, 1, 0,
        doc: /* Clear hash table TABLE and return it.  */)
-     (table)
-     Lisp_Object table;
+  (Lisp_Object table)
 {
   hash_clear (check_hash_table (table));
   /* Be compatible with XEmacs.  */
@@ -4808,8 +4595,7 @@ DEFUN ("clrhash", Fclrhash, Sclrhash, 1, 1, 0,
 DEFUN ("gethash", Fgethash, Sgethash, 2, 3, 0,
        doc: /* Look up KEY in TABLE and return its associated value.
 If KEY is not found, return DFLT which defaults to nil.  */)
-     (key, table, dflt)
-     Lisp_Object key, table, dflt;
+  (Lisp_Object key, Lisp_Object table, Lisp_Object dflt)
 {
   struct Lisp_Hash_Table *h = check_hash_table (table);
   int i = hash_lookup (h, key, NULL);
@@ -4821,8 +4607,7 @@ DEFUN ("puthash", Fputhash, Sputhash, 3, 3, 0,
        doc: /* Associate KEY with VALUE in hash table TABLE.
 If KEY is already present in table, replace its current value with
 VALUE.  */)
-     (key, value, table)
-     Lisp_Object key, value, table;
+  (Lisp_Object key, Lisp_Object value, Lisp_Object table)
 {
   struct Lisp_Hash_Table *h = check_hash_table (table);
   int i;
@@ -4840,8 +4625,7 @@ VALUE.  */)
 
 DEFUN ("remhash", Fremhash, Sremhash, 2, 2, 0,
        doc: /* Remove KEY from TABLE.  */)
-     (key, table)
-     Lisp_Object key, table;
+  (Lisp_Object key, Lisp_Object table)
 {
   struct Lisp_Hash_Table *h = check_hash_table (table);
   hash_remove_from_table (h, key);
@@ -4852,8 +4636,7 @@ DEFUN ("remhash", Fremhash, Sremhash, 2, 2, 0,
 DEFUN ("maphash", Fmaphash, Smaphash, 2, 2, 0,
        doc: /* Call FUNCTION for all entries in hash table TABLE.
 FUNCTION is called with two arguments, KEY and VALUE.  */)
-     (function, table)
-     Lisp_Object function, table;
+  (Lisp_Object function, Lisp_Object table)
 {
   struct Lisp_Hash_Table *h = check_hash_table (table);
   Lisp_Object args[3];
@@ -4884,8 +4667,7 @@ both arguments are the same.  HASH must be a function taking one
 argument and return an integer that is the hash code of the argument.
 Hash code computation should use the whole value range of integers,
 including negative integers.  */)
-     (name, test, hash)
-     Lisp_Object name, test, hash;
+  (Lisp_Object name, Lisp_Object test, Lisp_Object hash)
 {
   return Fput (name, Qhash_table_test, list2 (test, hash));
 }
@@ -4925,8 +4707,7 @@ command `prefer-coding-system') is used.
 
 If NOERROR is non-nil, silently assume the `raw-text' coding if the
 guesswork fails.  Normally, an error is signaled in such case.  */)
-     (object, start, end, coding_system, noerror)
-     Lisp_Object object, start, end, coding_system, noerror;
+  (Lisp_Object object, Lisp_Object start, Lisp_Object end, Lisp_Object coding_system, Lisp_Object noerror)
 {
   unsigned char digest[16];
   unsigned char value[33];
@@ -5121,7 +4902,7 @@ guesswork fails.  Normally, an error is signaled in such case.  */)
 
 \f
 void
-syms_of_fns ()
+syms_of_fns (void)
 {
   /* Hash table stuff.  */
   Qhash_table_p = intern_c_string ("hash-table-p");
@@ -5297,7 +5078,7 @@ this variable.  */);
 
 
 void
-init_fns ()
+init_fns (void)
 {
 }
 
index 765712198fe52ebefb96a4aed2bcf7e60b7be436..ae7211e92fed39f5cd94ac2e8856f19ff1f1a6d6 100644 (file)
@@ -48,10 +48,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "nsterm.h"
 #endif /* HAVE_NS */
 
-#ifdef HAVE_NS
-extern Lisp_Object Qfontsize;
-#endif
-
 Lisp_Object Qopentype;
 
 /* Important character set strings.  */
@@ -127,12 +123,6 @@ static const struct table_entry width_table[] =
   { 200, { "ultra-expanded", "ultraexpanded", "wide" }}
 };
 
-extern Lisp_Object Qnormal;
-
-/* Symbols representing keys of normal font properties.  */
-extern Lisp_Object QCtype, QCfamily, QCweight, QCslant, QCwidth;
-extern Lisp_Object QCheight, QCsize, QCname;
-
 Lisp_Object QCfoundry, QCadstyle, QCregistry;
 /* Symbols representing keys of font extra info.  */
 Lisp_Object QCspacing, QCdpi, QCscalable, QCotf, QClang, QCscript, QCavgwidth;
@@ -175,7 +165,7 @@ static struct font_driver_list *font_driver_list;
 /* Creaters of font-related Lisp object.  */
 
 Lisp_Object
-font_make_spec ()
+font_make_spec (void)
 {
   Lisp_Object font_spec;
   struct font_spec *spec
@@ -187,7 +177,7 @@ font_make_spec ()
 }
 
 Lisp_Object
-font_make_entity ()
+font_make_entity (void)
 {
   Lisp_Object font_entity;
   struct font_entity *entity
@@ -202,10 +192,7 @@ font_make_entity ()
    not nil, copy properties from ENTITY to the font-object.  If
    PIXELSIZE is positive, set the `size' property to PIXELSIZE.  */
 Lisp_Object
-font_make_object (size, entity, pixelsize)
-     int size;
-     Lisp_Object entity;
-     int pixelsize;
+font_make_object (int size, Lisp_Object entity, int pixelsize)
 {
   Lisp_Object font_object;
   struct font *font
@@ -229,10 +216,10 @@ font_make_object (size, entity, pixelsize)
 
 \f
 
-static int font_pixel_size P_ ((FRAME_PTR f, Lisp_Object));
-static Lisp_Object font_open_entity P_ ((FRAME_PTR, Lisp_Object, int));
-static Lisp_Object font_matching_entity P_ ((FRAME_PTR, Lisp_Object *,
-                                            Lisp_Object));
+static int font_pixel_size (FRAME_PTR f, Lisp_Object);
+static Lisp_Object font_open_entity (FRAME_PTR, Lisp_Object, int);
+static Lisp_Object font_matching_entity (FRAME_PTR, Lisp_Object *,
+                                         Lisp_Object);
 
 /* Number of registered font drivers.  */
 static int num_font_drivers;
@@ -245,10 +232,7 @@ static int num_font_drivers;
    STR.  */
 
 Lisp_Object
-font_intern_prop (str, len, force_symbol)
-     char *str;
-     int len;
-     int force_symbol;
+font_intern_prop (const char *str, int len, int force_symbol)
 {
   int i;
   Lisp_Object tem;
@@ -290,9 +274,7 @@ font_intern_prop (str, len, force_symbol)
 /* Return a pixel size of font-spec SPEC on frame F.  */
 
 static int
-font_pixel_size (f, spec)
-     FRAME_PTR f;
-     Lisp_Object spec;
+font_pixel_size (FRAME_PTR f, Lisp_Object spec)
 {
 #ifdef HAVE_WINDOW_SYSTEM
   Lisp_Object size = AREF (spec, FONT_SIZE_INDEX);
@@ -327,10 +309,7 @@ font_pixel_size (f, spec)
    VAL is an integer.  */
 
 int
-font_style_to_value (prop, val, noerror)
-     enum font_property_index prop;
-     Lisp_Object val;
-     int noerror;
+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);
@@ -395,10 +374,7 @@ font_style_to_value (prop, val, noerror)
 }
 
 Lisp_Object
-font_style_symbolic (font, prop, for_face)
-     Lisp_Object font;
-     enum font_property_index prop;
-     int for_face;
+font_style_symbolic (Lisp_Object font, enum font_property_index prop, int for_face)
 {
   Lisp_Object val = AREF (font, prop);
   Lisp_Object table, elt;
@@ -414,18 +390,12 @@ font_style_symbolic (font, prop, for_face)
   return (for_face ? AREF (elt, 1) : AREF (elt, (i & 0xF) + 1));
 }
 
-extern Lisp_Object Vface_alternative_font_family_alist;
-
-extern Lisp_Object find_font_encoding P_ ((Lisp_Object));
-
-
 /* Return ENCODING or a cons of ENCODING and REPERTORY of the font
    FONTNAME.  ENCODING is a charset symbol that specifies the encoding
    of the font.  REPERTORY is a charset symbol or nil.  */
 
 Lisp_Object
-find_font_encoding (fontname)
-     Lisp_Object fontname;
+find_font_encoding (Lisp_Object fontname)
 {
   Lisp_Object tail, elt;
 
@@ -448,9 +418,7 @@ find_font_encoding (fontname)
    REGISTRY is available, return 0.  Otherwise return -1.  */
 
 int
-font_registry_charsets (registry, encoding, repertory)
-     Lisp_Object registry;
-     struct charset **encoding, **repertory;
+font_registry_charsets (Lisp_Object registry, struct charset **encoding, struct charset **repertory)
 {
   Lisp_Object val;
   int encoding_id, repertory_id;
@@ -508,16 +476,15 @@ font_registry_charsets (registry, encoding, repertory)
 /* Font property value validaters.  See the comment of
    font_property_table for the meaning of the arguments.  */
 
-static Lisp_Object font_prop_validate P_ ((int, Lisp_Object, Lisp_Object));
-static Lisp_Object font_prop_validate_symbol P_ ((Lisp_Object, Lisp_Object));
-static Lisp_Object font_prop_validate_style P_ ((Lisp_Object, Lisp_Object));
-static Lisp_Object font_prop_validate_non_neg P_ ((Lisp_Object, Lisp_Object));
-static Lisp_Object font_prop_validate_spacing P_ ((Lisp_Object, Lisp_Object));
-static int get_font_prop_index P_ ((Lisp_Object));
+static Lisp_Object font_prop_validate (int, Lisp_Object, Lisp_Object);
+static Lisp_Object font_prop_validate_symbol (Lisp_Object, Lisp_Object);
+static Lisp_Object font_prop_validate_style (Lisp_Object, Lisp_Object);
+static Lisp_Object font_prop_validate_non_neg (Lisp_Object, Lisp_Object);
+static Lisp_Object font_prop_validate_spacing (Lisp_Object, Lisp_Object);
+static int get_font_prop_index (Lisp_Object);
 
 static Lisp_Object
-font_prop_validate_symbol (prop, val)
-     Lisp_Object prop, val;
+font_prop_validate_symbol (Lisp_Object prop, Lisp_Object val)
 {
   if (STRINGP (val))
     val = Fintern (val, Qnil);
@@ -530,8 +497,7 @@ font_prop_validate_symbol (prop, val)
 
 
 static Lisp_Object
-font_prop_validate_style (style, val)
-     Lisp_Object style, val;
+font_prop_validate_style (Lisp_Object style, Lisp_Object val)
 {
   enum font_property_index prop = (EQ (style, QCweight) ? FONT_WEIGHT_INDEX
                                   : EQ (style, QCslant) ? FONT_SLANT_INDEX
@@ -565,16 +531,14 @@ font_prop_validate_style (style, val)
 }
 
 static Lisp_Object
-font_prop_validate_non_neg (prop, val)
-     Lisp_Object prop, val;
+font_prop_validate_non_neg (Lisp_Object prop, Lisp_Object val)
 {
   return (NATNUMP (val) || (FLOATP (val) && XFLOAT_DATA (val) >= 0)
          ? val : Qerror);
 }
 
 static Lisp_Object
-font_prop_validate_spacing (prop, val)
-     Lisp_Object prop, val;
+font_prop_validate_spacing (Lisp_Object prop, Lisp_Object val)
 {
   if (NILP (val) || (NATNUMP (val) && XINT (val) <= FONT_SPACING_CHARCELL))
     return val;
@@ -595,8 +559,7 @@ font_prop_validate_spacing (prop, val)
 }
 
 static Lisp_Object
-font_prop_validate_otf (prop, val)
-     Lisp_Object prop, val;
+font_prop_validate_otf (Lisp_Object prop, Lisp_Object val)
 {
   Lisp_Object tail, tmp;
   int i;
@@ -631,14 +594,14 @@ font_prop_validate_otf (prop, val)
 
 /* Structure of known font property keys and validater of the
    values.  */
-struct
+static const struct
 {
   /* Pointer to the key symbol.  */
   Lisp_Object *key;
   /* Function to validate PROP's value VAL, or NULL if any value is
      ok.  The value is VAL or its regularized value if VAL is valid,
      and Qerror if not.  */
-  Lisp_Object (*validater) P_ ((Lisp_Object prop, Lisp_Object val));
+  Lisp_Object (*validater) (Lisp_Object prop, Lisp_Object val);
 } font_property_table[] =
   { { &QCtype, font_prop_validate_symbol },
     { &QCfoundry, font_prop_validate_symbol },
@@ -667,8 +630,7 @@ struct
    already known property.  */
 
 static int
-get_font_prop_index (key)
-     Lisp_Object key;
+get_font_prop_index (Lisp_Object key)
 {
   int i;
 
@@ -683,9 +645,7 @@ get_font_prop_index (key)
    signal an error.  The value is VAL or the regularized one.  */
 
 static Lisp_Object
-font_prop_validate (idx, prop, val)
-     int idx;
-     Lisp_Object prop, val;
+font_prop_validate (int idx, Lisp_Object prop, Lisp_Object val)
 {
   Lisp_Object validated;
 
@@ -710,8 +670,7 @@ font_prop_validate (idx, prop, val)
    keeping the sorting order.  Don't check the validity of VAL.  */
 
 Lisp_Object
-font_put_extra (font, prop, val)
-     Lisp_Object font, prop, val;
+font_put_extra (Lisp_Object font, Lisp_Object prop, Lisp_Object val)
 {
   Lisp_Object extra = AREF (font, FONT_EXTRA_INDEX);
   Lisp_Object slot = (NILP (extra) ? Qnil : assq_no_quit (prop, extra));
@@ -740,9 +699,9 @@ font_put_extra (font, prop, val)
 \f
 /* Font name parser and unparser */
 
-static int parse_matrix P_ ((char *));
-static int font_expand_wildcards P_ ((Lisp_Object *, int));
-static int font_parse_name P_ ((char *, Lisp_Object));
+static int parse_matrix (const char *);
+static int font_expand_wildcards (Lisp_Object *, int);
+static int font_parse_name (char *, Lisp_Object);
 
 /* An enumerator for each field of an XLFD font name.  */
 enum xlfd_field_index
@@ -799,8 +758,7 @@ enum xlfd_field_mask
    -1.  */
 
 static int
-parse_matrix (p)
-     char *p;
+parse_matrix (const char *p)
 {
   double matrix[4];
   char *end;
@@ -822,9 +780,7 @@ parse_matrix (p)
    field position by its contents.  */
 
 static int
-font_expand_wildcards (field, n)
-     Lisp_Object field[XLFD_LAST_INDEX];
-     int n;
+font_expand_wildcards (Lisp_Object *field, int n)
 {
   /* Copy of FIELD.  */
   Lisp_Object tmp[XLFD_LAST_INDEX];
@@ -1009,39 +965,6 @@ font_expand_wildcards (field, n)
 }
 
 
-#ifdef ENABLE_CHECKING
-/* Match a 14-field XLFD pattern against a full XLFD font name.  */
-static int
-font_match_xlfd (char *pattern, char *name)
-{
-  while (*pattern && *name)
-    {
-      if (*pattern == *name)
-       pattern++;
-      else if (*pattern == '*')
-       if (*name == pattern[1])
-         pattern += 2;
-       else
-         ;
-      else
-       return 0;
-      name++;
-    }
-  return 1;
-}
-
-/* Make sure the font object matches the XLFD font name.  */
-static int
-font_check_xlfd_parse (Lisp_Object font, char *name)
-{
-  char name_check[256];
-  font_unparse_xlfd (font, 0, name_check, 255);
-  return font_match_xlfd (name_check, name);
-}
-
-#endif
-
-
 /* Parse NAME (null terminated) as XLFD and store information in FONT
    (font-spec or font-entity).  Size property of FONT is set as
    follows:
@@ -1058,9 +981,7 @@ font_check_xlfd_parse (Lisp_Object font, char *name)
    a fully specified XLFD.  */
 
 int
-font_parse_xlfd (name, font)
-     char *name;
-     Lisp_Object font;
+font_parse_xlfd (char *name, Lisp_Object font)
 {
   int len = strlen (name);
   int i, j, n;
@@ -1242,11 +1163,7 @@ font_parse_xlfd (name, font)
    0, use PIXEL_SIZE instead.  */
 
 int
-font_unparse_xlfd (font, pixel_size, name, nbytes)
-     Lisp_Object font;
-     int pixel_size;
-     char *name;
-     int nbytes;
+font_unparse_xlfd (Lisp_Object font, int pixel_size, char *name, int nbytes)
 {
   char *f[XLFD_REGISTRY_INDEX + 1];
   Lisp_Object val;
@@ -1389,9 +1306,7 @@ font_unparse_xlfd (font, pixel_size, name, nbytes)
    This function tries to guess which format it is.  */
 
 int
-font_parse_fcname (name, font)
-     char *name;
-     Lisp_Object font;
+font_parse_fcname (char *name, Lisp_Object font)
 {
   char *p, *q;
   char *size_beg = NULL, *size_end = NULL;
@@ -1544,7 +1459,7 @@ font_parse_fcname (name, font)
              int size_found = 1;
 
              for (q = p + 1; *q && *q != ' '; q++)
-               if (! isdigit (*q))
+               if (! isdigit (*q) && *q != '.')
                  {
                    size_found = 0;
                    break;
@@ -1648,11 +1563,7 @@ font_parse_fcname (name, font)
    FONT_SIZE_INDEX of FONT is 0, use PIXEL_SIZE instead.  */
 
 int
-font_unparse_fcname (font, pixel_size, name, nbytes)
-     Lisp_Object font;
-     int pixel_size;
-     char *name;
-     int nbytes;
+font_unparse_fcname (Lisp_Object font, int pixel_size, char *name, int nbytes)
 {
   Lisp_Object family, foundry;
   Lisp_Object tail, val;
@@ -1660,7 +1571,7 @@ font_unparse_fcname (font, pixel_size, name, nbytes)
   int i, len = 1;
   char *p;
   Lisp_Object styles[3];
-  char *style_names[3] = { "weight", "slant", "width" };
+  const char *style_names[3] = { "weight", "slant", "width" };
   char work[256];
 
   family = AREF (font, FONT_FAMILY_INDEX);
@@ -1771,11 +1682,7 @@ font_unparse_fcname (font, pixel_size, name, nbytes)
    size.  */
 
 int
-font_unparse_gtkname (font, f, name, nbytes)
-     Lisp_Object font;
-     struct frame *f;
-     char *name;
-     int nbytes;
+font_unparse_gtkname (Lisp_Object font, struct frame *f, char *name, int nbytes)
 {
   char *p;
   int len = 1;
@@ -1858,11 +1765,9 @@ font_unparse_gtkname (font, f, name, nbytes)
    0.  Otherwise return -1.  */
 
 static int
-font_parse_name (name, font)
-     char *name;
-     Lisp_Object font;
+font_parse_name (char *name, Lisp_Object font)
 {
-  if (name[0] == '-' || index (name, '*') || index (name, '?'))
+  if (name[0] == '-' || strchr (name, '*') || strchr (name, '?'))
     return font_parse_xlfd (name, font);
   return font_parse_fcname (name, font);
 }
@@ -1873,8 +1778,7 @@ font_parse_name (name, font)
    part.  */
 
 void
-font_parse_family_registry (family, registry, font_spec)
-     Lisp_Object family, registry, font_spec;
+font_parse_family_registry (Lisp_Object family, Lisp_Object registry, Lisp_Object font_spec)
 {
   int len;
   char *p0, *p1;
@@ -1885,7 +1789,7 @@ font_parse_family_registry (family, registry, font_spec)
       CHECK_STRING (family);
       len = SBYTES (family);
       p0 = (char *) SDATA (family);
-      p1 = index (p0, '-');
+      p1 = strchr (p0, '-');
       if (p1)
        {
          if ((*p0 != '*' && p1 - p0 > 0)
@@ -1904,7 +1808,7 @@ font_parse_family_registry (family, registry, font_spec)
       CHECK_STRING (registry);
       len = SBYTES (registry);
       p0 = (char *) SDATA (registry);
-      p1 = index (p0, '-');
+      p1 = strchr (p0, '-');
       if (! p1)
        {
          if (SDATA (registry)[len - 1] == '*')
@@ -2220,17 +2124,13 @@ font_otf_Anchor (anchor)
 \f
 /* Font sorting */
 
-static unsigned font_score P_ ((Lisp_Object, Lisp_Object *));
-static int font_compare P_ ((const void *, const void *));
-static Lisp_Object font_sort_entities P_ ((Lisp_Object, Lisp_Object,
-                                         Lisp_Object, int));
-
-/* Return a rescaling ratio of FONT_ENTITY.  */
-extern Lisp_Object Vface_font_rescale_alist;
+static unsigned font_score (Lisp_Object, Lisp_Object *);
+static int font_compare (const void *, const void *);
+static Lisp_Object font_sort_entities (Lisp_Object, Lisp_Object,
+                                       Lisp_Object, int);
 
 static double
-font_rescale_ratio (font_entity)
-     Lisp_Object font_entity;
+font_rescale_ratio (Lisp_Object font_entity)
 {
   Lisp_Object tail, elt;
   Lisp_Object name = Qnil;
@@ -2277,8 +2177,7 @@ static int sort_shift_bits[FONT_SIZE_INDEX + 1];
    SPEC_PROP.  */
 
 static unsigned
-font_score (entity, spec_prop)
-     Lisp_Object entity, *spec_prop;
+font_score (Lisp_Object entity, Lisp_Object *spec_prop)
 {
   unsigned score = 0;
   int i;
@@ -2352,8 +2251,7 @@ struct font_sort_data
 /* The comparison function for qsort.  */
 
 static int
-font_compare (d1, d2)
-     const void *d1, *d2;
+font_compare (const void *d1, const void *d2)
 {
   const struct font_sort_data *data1 = d1;
   const struct font_sort_data *data2 = d2;
@@ -2381,9 +2279,7 @@ font_compare (d1, d2)
    such a case.  */
 
 static Lisp_Object
-font_sort_entities (list, prefer, frame, best_only)
-     Lisp_Object list, prefer, frame;
-     int best_only;
+font_sort_entities (Lisp_Object list, Lisp_Object prefer, Lisp_Object frame, int best_only)
 {
   Lisp_Object prefer_prop[FONT_SPEC_MAX];
   int len, maxlen, i;
@@ -2488,8 +2384,7 @@ font_sort_entities (list, prefer, frame, best_only)
    function with font_sort_order after setting up it.  */
 
 void
-font_update_sort_order (order)
-     int *order;
+font_update_sort_order (int *order)
 {
   int i, shift_bits;
 
@@ -2509,8 +2404,7 @@ font_update_sort_order (order)
 }
 
 static int
-font_check_otf_features (script, langsys, features, table)
-     Lisp_Object script, langsys, features, table;
+font_check_otf_features (Lisp_Object script, Lisp_Object langsys, Lisp_Object features, Lisp_Object table)
 {
   Lisp_Object val;
   int negative;
@@ -2584,8 +2478,7 @@ font_check_otf (Lisp_Object spec, Lisp_Object otf_capability)
    specification SPEC.  */
 
 int
-font_match_p (spec, font)
-     Lisp_Object spec, font;
+font_match_p (Lisp_Object spec, Lisp_Object font)
 {
   Lisp_Object prop[FONT_SPEC_MAX], *props;
   Lisp_Object extra, font_extra;
@@ -2701,16 +2594,14 @@ font_match_p (spec, font)
    is a number frames sharing this cache, and FONT-CACHE-DATA is a
    cons (FONT-SPEC FONT-ENTITY ...).  */
 
-static void font_prepare_cache P_ ((FRAME_PTR, struct font_driver *));
-static void font_finish_cache P_ ((FRAME_PTR, struct font_driver *));
-static Lisp_Object font_get_cache P_ ((FRAME_PTR, struct font_driver *));
-static void font_clear_cache P_ ((FRAME_PTR, Lisp_Object,
-                                 struct font_driver *));
+static void font_prepare_cache (FRAME_PTR, struct font_driver *);
+static void font_finish_cache (FRAME_PTR, struct font_driver *);
+static Lisp_Object font_get_cache (FRAME_PTR, struct font_driver *);
+static void font_clear_cache (FRAME_PTR, Lisp_Object,
+                              struct font_driver *);
 
 static void
-font_prepare_cache (f, driver)
-     FRAME_PTR f;
-     struct font_driver *driver;
+font_prepare_cache (FRAME_PTR f, struct font_driver *driver)
 {
   Lisp_Object cache, val;
 
@@ -2732,9 +2623,7 @@ font_prepare_cache (f, driver)
 
 
 static void
-font_finish_cache (f, driver)
-     FRAME_PTR f;
-     struct font_driver *driver;
+font_finish_cache (FRAME_PTR f, struct font_driver *driver)
 {
   Lisp_Object cache, val, tmp;
 
@@ -2755,9 +2644,7 @@ font_finish_cache (f, driver)
 
 
 static Lisp_Object
-font_get_cache (f, driver)
-     FRAME_PTR f;
-     struct font_driver *driver;
+font_get_cache (FRAME_PTR f, struct font_driver *driver)
 {
   Lisp_Object val = driver->get_cache (f);
   Lisp_Object type = driver->type;
@@ -2773,10 +2660,7 @@ font_get_cache (f, driver)
 static int num_fonts;
 
 static void
-font_clear_cache (f, cache, driver)
-     FRAME_PTR f;
-     Lisp_Object cache;
-     struct font_driver *driver;
+font_clear_cache (FRAME_PTR f, Lisp_Object cache, struct font_driver *driver)
 {
   Lisp_Object tail, elt;
   Lisp_Object tail2, entity;
@@ -2821,10 +2705,14 @@ font_clear_cache (f, cache, driver)
 
 static Lisp_Object scratch_font_spec, scratch_font_prefer;
 
+/* Check each font-entity in VEC, and return a list of font-entities
+   that satisfy this condition:
+     (1) matches with SPEC and SIZE if SPEC is not nil, and
+     (2) doesn't match with any regexps in Vface_ignored_fonts (if non-nil).
+*/
+
 Lisp_Object
-font_delete_unmatched (vec, spec, size)
-     Lisp_Object vec, spec;
-     int size;
+font_delete_unmatched (Lisp_Object vec, Lisp_Object spec, int size)
 {
   Lisp_Object entity, val;
   enum font_property_index prop;
@@ -2833,6 +2721,29 @@ font_delete_unmatched (vec, spec, size)
   for (val = Qnil, i = ASIZE (vec) - 1; i >= 0; i--)
     {
       entity = AREF (vec, i);
+      if (! NILP (Vface_ignored_fonts))
+       {
+         char name[256];
+         Lisp_Object tail, regexp;
+
+         if (font_unparse_xlfd (entity, 0, name, 256) >= 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)
+                   break;
+               }
+             if (CONSP (tail))
+               continue;
+           }
+       }
+      if (NILP (spec))
+       {
+         val = Fcons (entity, val);
+         continue;
+       }
       for (prop = FONT_WEIGHT_INDEX; prop < FONT_SIZE_INDEX; prop++)
        if (INTEGERP (AREF (spec, prop))
            && ((XINT (AREF (spec, prop)) >> 8)
@@ -2874,8 +2785,7 @@ font_delete_unmatched (vec, spec, size)
    same font-driver.  */
 
 Lisp_Object
-font_list_entities (frame, spec)
-     Lisp_Object frame, spec;
+font_list_entities (Lisp_Object frame, Lisp_Object spec)
 {
   FRAME_PTR f = XFRAME (frame);
   struct font_driver_list *driver_list = f->font_driver_list;
@@ -2932,8 +2842,10 @@ font_list_entities (frame, spec)
            ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type);
            XSETCDR (cache, Fcons (Fcons (copy, val), XCDR (cache)));
          }
-       if (ASIZE (val) > 0 && need_filtering)
-         val = font_delete_unmatched (val, spec, size);
+       if (ASIZE (val) > 0
+           && (need_filtering
+               || ! NILP (Vface_ignored_fonts)))
+         val = font_delete_unmatched (val, need_filtering ? spec : Qnil, size);
        if (ASIZE (val) > 0)
          list = Fcons (val, list);
       }
@@ -2949,9 +2861,7 @@ font_list_entities (frame, spec)
    font-related attributes.  */
 
 static Lisp_Object
-font_matching_entity (f, attrs, spec)
-     FRAME_PTR f;
-     Lisp_Object *attrs, spec;
+font_matching_entity (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec)
 {
   struct font_driver_list *driver_list = f->font_driver_list;
   Lisp_Object ftype, size, entity;
@@ -2999,10 +2909,7 @@ font_matching_entity (f, attrs, spec)
    opened font object.  */
 
 static Lisp_Object
-font_open_entity (f, entity, pixel_size)
-     FRAME_PTR f;
-     Lisp_Object entity;
-     int pixel_size;
+font_open_entity (FRAME_PTR f, Lisp_Object entity, int pixel_size)
 {
   struct font_driver_list *driver_list;
   Lisp_Object objlist, size, val, font_object;
@@ -3045,7 +2952,6 @@ font_open_entity (f, entity, pixel_size)
     return Qnil;
   ASET (entity, FONT_OBJLIST_INDEX,
        Fcons (font_object, AREF (entity, FONT_OBJLIST_INDEX)));
-  ASET (font_object, FONT_OBJLIST_INDEX, Qnil);
   num_fonts++;
 
   font = XFONT_OBJECT (font_object);
@@ -3078,9 +2984,7 @@ font_open_entity (f, entity, pixel_size)
 /* Close FONT_OBJECT that is opened on frame F.  */
 
 void
-font_close_object (f, font_object)
-     FRAME_PTR f;
-     Lisp_Object font_object;
+font_close_object (FRAME_PTR f, Lisp_Object font_object)
 {
   struct font *font = XFONT_OBJECT (font_object);
 
@@ -3101,10 +3005,7 @@ font_close_object (f, font_object)
    FONT is a font-entity and it must be opened to check.  */
 
 int
-font_has_char (f, font, c)
-     FRAME_PTR f;
-     Lisp_Object font;
-     int c;
+font_has_char (FRAME_PTR f, Lisp_Object font, int c)
 {
   struct font *fontp;
 
@@ -3139,9 +3040,7 @@ font_has_char (f, font, c)
 /* Return the glyph ID of FONT_OBJECT for character C.  */
 
 unsigned
-font_encode_char (font_object, c)
-     Lisp_Object font_object;
-     int c;
+font_encode_char (Lisp_Object font_object, int c)
 {
   struct font *font;
 
@@ -3154,8 +3053,7 @@ font_encode_char (font_object, c)
 /* Return the name of FONT_OBJECT.  */
 
 Lisp_Object
-font_get_name (font_object)
-     Lisp_Object font_object;
+font_get_name (Lisp_Object font_object)
 {
   font_assert (FONT_OBJECT_P (font_object));
   return AREF (font_object, FONT_NAME_INDEX);
@@ -3165,8 +3063,7 @@ font_get_name (font_object)
 /* Return the specification of FONT_OBJECT.  */
 
 Lisp_Object
-font_get_spec (font_object)
-     Lisp_Object font_object;
+font_get_spec (Lisp_Object font_object)
 {
   Lisp_Object spec = font_make_spec ();
   int i;
@@ -3183,8 +3080,7 @@ font_get_spec (font_object)
    could not be parsed by font_parse_name, return Qnil.  */
 
 Lisp_Object
-font_spec_from_name (font_name)
-     Lisp_Object font_name;
+font_spec_from_name (Lisp_Object font_name)
 {
   Lisp_Object spec = Ffont_spec (0, NULL);
 
@@ -3198,9 +3094,7 @@ font_spec_from_name (font_name)
 
 
 void
-font_clear_prop (attrs, prop)
-     Lisp_Object *attrs;
-     enum font_property_index prop;
+font_clear_prop (Lisp_Object *attrs, enum font_property_index prop)
 {
   Lisp_Object font = attrs[LFACE_FONT_INDEX];
 
@@ -3251,9 +3145,7 @@ font_clear_prop (attrs, prop)
 }
 
 void
-font_update_lface (f, attrs)
-     FRAME_PTR f;
-     Lisp_Object *attrs;
+font_update_lface (FRAME_PTR f, Lisp_Object *attrs)
 {
   Lisp_Object spec;
 
@@ -3300,9 +3192,7 @@ font_update_lface (f, attrs)
    supports C and matches best with ATTRS and PIXEL_SIZE.  */
 
 static Lisp_Object
-font_select_entity (frame, entities, attrs, pixel_size, c)
-     Lisp_Object frame, entities, *attrs;
-     int pixel_size, c;
+font_select_entity (Lisp_Object frame, Lisp_Object entities, Lisp_Object *attrs, int pixel_size, int c)
 {
   Lisp_Object font_entity;
   Lisp_Object prefer;
@@ -3347,11 +3237,7 @@ font_select_entity (frame, entities, attrs, pixel_size, c)
    character that the entity must support.  */
 
 Lisp_Object
-font_find_for_lface (f, attrs, spec, c)
-     FRAME_PTR f;
-     Lisp_Object *attrs;
-     Lisp_Object spec;
-     int c;
+font_find_for_lface (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec, int c)
 {
   Lisp_Object work;
   Lisp_Object frame, entities, val;
@@ -3501,11 +3387,7 @@ font_find_for_lface (f, attrs, spec, c)
 
 
 Lisp_Object
-font_open_for_lface (f, entity, attrs, spec)
-     FRAME_PTR f;
-     Lisp_Object entity;
-     Lisp_Object *attrs;
-     Lisp_Object spec;
+font_open_for_lface (FRAME_PTR f, Lisp_Object entity, Lisp_Object *attrs, Lisp_Object spec)
 {
   int size;
 
@@ -3548,9 +3430,7 @@ font_open_for_lface (f, entity, attrs, spec)
    font-object.  */
 
 Lisp_Object
-font_load_for_lface (f, attrs, spec)
-     FRAME_PTR f;
-     Lisp_Object *attrs, spec;
+font_load_for_lface (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec)
 {
   Lisp_Object entity, name;
 
@@ -3580,9 +3460,7 @@ font_load_for_lface (f, attrs, spec)
 /* Make FACE on frame F ready to use the font opened for FACE.  */
 
 void
-font_prepare_for_face (f, face)
-     FRAME_PTR f;
-     struct face *face;
+font_prepare_for_face (FRAME_PTR f, struct face *face)
 {
   if (face->font->driver->prepare_face)
     face->font->driver->prepare_face (f, face);
@@ -3592,9 +3470,7 @@ font_prepare_for_face (f, face)
 /* Make FACE on frame F stop using the font opened for FACE.  */
 
 void
-font_done_for_face (f, face)
-     FRAME_PTR f;
-     struct face *face;
+font_done_for_face (FRAME_PTR f, struct face *face)
 {
   if (face->font->driver->done_face)
     face->font->driver->done_face (f, face);
@@ -3606,9 +3482,7 @@ font_done_for_face (f, face)
    font is found, return Qnil.  */
 
 Lisp_Object
-font_open_by_spec (f, spec)
-     FRAME_PTR f;
-     Lisp_Object spec;
+font_open_by_spec (FRAME_PTR f, Lisp_Object spec)
 {
   Lisp_Object attrs[LFACE_VECTOR_SIZE];
 
@@ -3632,9 +3506,7 @@ font_open_by_spec (f, spec)
    found, return Qnil.  */
 
 Lisp_Object
-font_open_by_name (f, name)
-     FRAME_PTR f;
-     char *name;
+font_open_by_name (FRAME_PTR f, const char *name)
 {
   Lisp_Object args[2];
   Lisp_Object spec, ret;
@@ -3664,9 +3536,7 @@ font_open_by_name (f, name)
    (e.g. syms_of_xfont).  */
 
 void
-register_font_driver (driver, f)
-     struct font_driver *driver;
-     FRAME_PTR f;
+register_font_driver (struct font_driver *driver, FRAME_PTR f)
 {
   struct font_driver_list *root = f ? f->font_driver_list : font_driver_list;
   struct font_driver_list *prev, *list;
@@ -3694,8 +3564,7 @@ register_font_driver (driver, f)
 }
 
 void
-free_font_driver_list (f)
-     FRAME_PTR f;
+free_font_driver_list (FRAME_PTR f)
 {
   struct font_driver_list *list, *next;
 
@@ -3717,9 +3586,7 @@ free_font_driver_list (f)
    F.  */
 
 Lisp_Object
-font_update_drivers (f, new_drivers)
-     FRAME_PTR f;
-     Lisp_Object new_drivers;
+font_update_drivers (FRAME_PTR f, Lisp_Object new_drivers)
 {
   Lisp_Object active_drivers = Qnil;
   struct font_driver *driver;
@@ -3810,10 +3677,7 @@ font_update_drivers (f, new_drivers)
 }
 
 int
-font_put_frame_data (f, driver, data)
-     FRAME_PTR f;
-     struct font_driver *driver;
-     void *data;
+font_put_frame_data (FRAME_PTR f, struct font_driver *driver, void *data)
 {
   struct font_data_list *list, *prev;
 
@@ -3847,9 +3711,7 @@ font_put_frame_data (f, driver, data)
 
 
 void *
-font_get_frame_data (f, driver)
-     FRAME_PTR f;
-     struct font_driver *driver;
+font_get_frame_data (FRAME_PTR f, struct font_driver *driver)
 {
   struct font_data_list *list;
 
@@ -3868,12 +3730,7 @@ font_get_frame_data (f, driver)
    STRING.  */
 
 Lisp_Object
-font_at (c, pos, face, w, string)
-     int c;
-     EMACS_INT pos;
-     struct face *face;
-     struct window *w;
-     Lisp_Object string;
+font_at (int c, EMACS_INT pos, struct face *face, struct window *w, Lisp_Object string)
 {
   FRAME_PTR f;
   int multibyte;
@@ -3955,13 +3812,9 @@ font_at (c, pos, face, w, string)
    It is assured that the current buffer (or STRING) is multibyte.  */
 
 Lisp_Object
-font_range (pos, limit, w, face, string)
-     EMACS_INT pos, *limit;
-     struct window *w;
-     struct face *face;
-     Lisp_Object string;
+font_range (EMACS_INT pos, EMACS_INT *limit, struct window *w, struct face *face, Lisp_Object string)
 {
-  EMACS_INT pos_byte, ignore, start, start_byte;
+  EMACS_INT pos_byte, ignore;
   int c;
   Lisp_Object font_object = Qnil;
 
@@ -3983,7 +3836,6 @@ font_range (pos, limit, w, face, string)
       pos_byte = string_char_to_byte (string, pos);
     }
 
-  start = pos, start_byte = pos_byte;
   while (pos < *limit)
     {
       Lisp_Object category;
@@ -3992,6 +3844,10 @@ font_range (pos, limit, w, face, string)
        FETCH_CHAR_ADVANCE_NO_CHECK (c, pos, pos_byte);
       else
        FETCH_STRING_CHAR_ADVANCE_NO_CHECK (c, string, pos, pos_byte);
+      category = CHAR_TABLE_REF (Vunicode_category_table, c);
+      if (EQ (category, QCf)
+         || CHAR_VARIATION_SELECTOR_P (c))
+       continue;
       if (NILP (font_object))
        {
          font_object = font_for_char (face, c, pos - 1, string);
@@ -3999,40 +3855,8 @@ font_range (pos, limit, w, face, string)
            return Qnil;
          continue;
        }
-
-      category = CHAR_TABLE_REF (Vunicode_category_table, c);
-      if (! EQ (category, QCf)
-         && ! CHAR_VARIATION_SELECTOR_P (c)
-         && font_encode_char (font_object, c) == FONT_INVALID_CODE)
-       {
-         Lisp_Object f = font_for_char (face, c, pos - 1, string);
-         EMACS_INT i, i_byte;
-
-
-         if (NILP (f))
-           {
-             *limit = pos - 1;
-             return font_object;
-           }
-         i = start, i_byte = start_byte;
-         while (i < pos - 1)
-           {
-
-             if (NILP (string))
-               FETCH_CHAR_ADVANCE_NO_CHECK (c, i, i_byte);
-             else
-               FETCH_STRING_CHAR_ADVANCE_NO_CHECK (c, string, i, i_byte);
-             category = CHAR_TABLE_REF (Vunicode_category_table, c);
-             if (! EQ (category, QCf)
-                 && ! CHAR_VARIATION_SELECTOR_P (c)
-                 && font_encode_char (f, c) == FONT_INVALID_CODE)
-               {
-                 *limit = pos - 1;
-                 return font_object;
-               }
-           }
-         font_object = f;
-       }
+      if (font_encode_char (font_object, c) == FONT_INVALID_CODE)
+       *limit = pos - 1;
     }
   return font_object;
 }
@@ -4047,8 +3871,7 @@ Return nil otherwise.
 Optional 2nd argument EXTRA-TYPE, if non-nil, specifies to check
 which kind of font it is.  It must be one of `font-spec', `font-entity',
 `font-object'.  */)
-     (object, extra_type)
-     Lisp_Object object, extra_type;
+  (Lisp_Object object, Lisp_Object extra_type)
 {
   if (NILP (extra_type))
     return (FONTP (object) ? Qt : Qnil);
@@ -4126,9 +3949,7 @@ be an OpenType font, and whose GPOS table of `thai' script's default
 language system must contain `mark' feature.
 
 usage: (font-spec ARGS...)  */)
-     (nargs, args)
-     int nargs;
-     Lisp_Object *args;
+  (int nargs, Lisp_Object *args)
 {
   Lisp_Object spec = font_make_spec ();
   int i;
@@ -4169,8 +3990,7 @@ usage: (font-spec ARGS...)  */)
 
 DEFUN ("copy-font-spec", Fcopy_font_spec, Scopy_font_spec, 1, 1, 0,
        doc: /* Return a copy of FONT as a font-spec.  */)
-     (font)
-     Lisp_Object font;
+  (Lisp_Object font)
 {
   Lisp_Object new_spec, tail, prev, extra;
   int i;
@@ -4198,8 +4018,7 @@ DEFUN ("merge-font-spec", Fmerge_font_spec, Smerge_font_spec, 2, 2, 0,
        doc: /* Merge font-specs FROM and TO, and return a new font-spec.
 Every specified properties in FROM override the corresponding
 properties in TO.  */)
-     (from, to)
-     Lisp_Object from, to;
+  (Lisp_Object from, Lisp_Object to)
 {
   Lisp_Object extra, tail;
   int i;
@@ -4227,16 +4046,24 @@ properties in TO.  */)
 DEFUN ("font-get", Ffont_get, Sfont_get, 2, 2, 0,
        doc: /* Return the value of FONT's property KEY.
 FONT is a font-spec, a font-entity, or a font-object.
-KEY must be one of these symbols:
+KEY is any symbol, but these are reserved for specific meanings:
   :family, :weight, :slant, :width, :foundry, :adstyle, :registry,
-  :size, :name, :script
+  :size, :name, :script, :otf
 See the documentation of `font-spec' for their meanings.
-If FONT is a font-entity or font-object, the value of :script may be
-a list of scripts that are supported by the font.  */)
-     (font, key)
-     Lisp_Object font, key;
+In addition, if FONT is a font-entity or a font-object, values of
+:script and :otf are different from those of a font-spec as below:
+
+The value of :script may be a list of scripts that are supported by the font.
+
+The value of :otf is a cons (GSUB . GPOS) where GSUB and GPOS are lists
+representing the OpenType features supported by the font by this form:
+  ((SCRIPT (LANGSYS FEATURE ...) ...) ...)
+SCRIPT, LANGSYS, and FEATURE are all symbols representing OpenType
+Layout tags.  */)
+  (Lisp_Object font, Lisp_Object key)
 {
   int idx;
+  Lisp_Object val;
 
   CHECK_FONT (font);
   CHECK_SYMBOL (key);
@@ -4246,7 +4073,20 @@ a list of scripts that are supported by the font.  */)
     return font_style_symbolic (font, idx, 0);
   if (idx >= 0 && idx < FONT_EXTRA_INDEX)
     return AREF (font, idx);
-  return Fcdr (Fassq (key, AREF (font, FONT_EXTRA_INDEX)));
+  val = Fassq (key, AREF (font, FONT_EXTRA_INDEX));
+  if (NILP (val) && EQ (key, QCotf) && FONT_OBJECT_P (font))
+    {
+      struct font *fontp = XFONT_OBJECT (font);
+
+      if (fontp->driver->otf_capability)
+       val = fontp->driver->otf_capability (fontp);
+      else
+       val = Fcons (Qnil, Qnil);
+      font_put_extra (font, QCotf, val);
+    }
+  else
+    val = Fcdr (val);
+  return val;
 }
 
 #ifdef HAVE_WINDOW_SYSTEM
@@ -4264,8 +4104,7 @@ may be omitted from the list if they are not specified by FONT.
 
 The optional argument FRAME specifies the frame that the face attributes
 are to be displayed on.  If omitted, the selected frame is used.  */)
-     (font, frame)
-     Lisp_Object font, frame;
+  (Lisp_Object font, Lisp_Object frame)
 {
   struct frame *f;
   Lisp_Object plist[10];
@@ -4338,18 +4177,36 @@ are to be displayed on.  If omitted, the selected frame is used.  */)
 #endif
 
 DEFUN ("font-put", Ffont_put, Sfont_put, 3, 3, 0,
-       doc: /* Set one property of FONT-SPEC: give property PROP value VAL.  */)
-     (font_spec, prop, val)
-     Lisp_Object font_spec, prop, val;
+       doc: /* Set one property of FONT: give property KEY value VAL.
+FONT is a font-spec, a font-entity, or a font-object.
+
+If FONT is a font-spec, KEY can be any symbol.  But if KEY is the one
+accepted by the function `font-spec' (which see), VAL must be what
+allowed in `font-spec'.
+
+If FONT is a font-entity or a font-object, KEY must not be the one
+accepted by `font-spec'.  */)
+  (Lisp_Object font, Lisp_Object prop, Lisp_Object val)
 {
   int idx;
 
-  CHECK_FONT_SPEC (font_spec);
   idx = get_font_prop_index (prop);
   if (idx >= 0 && idx < FONT_EXTRA_INDEX)
-    ASET (font_spec, idx, font_prop_validate (idx, Qnil, val));
+    {
+      CHECK_FONT_SPEC (font);
+      ASET (font, idx, font_prop_validate (idx, Qnil, val));
+    }
   else
-    font_put_extra (font_spec, prop, font_prop_validate (0, prop, val));
+    {
+      if (EQ (prop, QCname)
+         || EQ (prop, QCscript)
+         || EQ (prop, QClang)
+         || EQ (prop, QCotf))
+       CHECK_FONT_SPEC (font);
+      else
+       CHECK_FONT (font);
+      font_put_extra (font, prop, font_prop_validate (0, prop, val));
+    }
   return val;
 }
 
@@ -4360,8 +4217,7 @@ Optional 3rd argument NUM, if non-nil, limits the number of returned fonts.
 Optional 4th argument PREFER, if non-nil, is a font-spec to
 control the order of the returned list.  Fonts are sorted by
 how close they are to PREFER.  */)
-     (font_spec, frame, num, prefer)
-     Lisp_Object font_spec, frame, num, prefer;
+  (Lisp_Object font_spec, Lisp_Object frame, Lisp_Object num, Lisp_Object prefer)
 {
   Lisp_Object vec, list;
   int n = 0;
@@ -4410,8 +4266,7 @@ how close they are to PREFER.  */)
 DEFUN ("font-family-list", Ffont_family_list, Sfont_family_list, 0, 1, 0,
        doc: /* List available font families on the current frame.
 Optional argument FRAME, if non-nil, specifies the target frame.  */)
-     (frame)
-     Lisp_Object frame;
+  (Lisp_Object frame)
 {
   FRAME_PTR f;
   struct font_driver_list *driver_list;
@@ -4440,8 +4295,7 @@ Optional argument FRAME, if non-nil, specifies the target frame.  */)
 DEFUN ("find-font", Ffind_font, Sfind_font, 1, 2, 0,
        doc: /* Return a font-entity matching with FONT-SPEC on the current frame.
 Optional 2nd argument FRAME, if non-nil, specifies the target frame.  */)
-     (font_spec, frame)
-     Lisp_Object font_spec, frame;
+  (Lisp_Object font_spec, Lisp_Object frame)
 {
   Lisp_Object val = Flist_fonts (font_spec, frame, make_number (1), Qnil);
 
@@ -4456,8 +4310,7 @@ FONT is a font-spec, font-entity, or font-object.
 If the name is too long for XLFD (maximum 255 chars), return nil.
 If the 2nd optional arg FOLD-WILDCARDS is non-nil,
 the consecutive wildcards are folded to one.  */)
-     (font, fold_wildcards)
-     Lisp_Object font, fold_wildcards;
+  (Lisp_Object font, Lisp_Object fold_wildcards)
 {
   char name[256];
   int pixel_size = 0;
@@ -4497,7 +4350,7 @@ the consecutive wildcards are folded to one.  */)
 
 DEFUN ("clear-font-cache", Fclear_font_cache, Sclear_font_cache, 0, 0, 0,
        doc: /* Clear font cache.  */)
-     ()
+  (void)
 {
   Lisp_Object list, frame;
 
@@ -4531,8 +4384,7 @@ DEFUN ("clear-font-cache", Fclear_font_cache, Sclear_font_cache, 0, 0, 0,
 
 \f
 void
-font_fill_lglyph_metrics (glyph, font_object)
-     Lisp_Object glyph, font_object;
+font_fill_lglyph_metrics (Lisp_Object glyph, Lisp_Object font_object)
 {
   struct font *font = XFONT_OBJECT (font_object);
   unsigned code;
@@ -4559,8 +4411,7 @@ header of the glyph-string.
 
 If the shaping was successful, the value is GSTRING itself or a newly
 created glyph-string.  Otherwise, the value is nil.  */)
-     (gstring)
-     Lisp_Object gstring;
+  (Lisp_Object gstring)
 {
   struct font *font;
   Lisp_Object font_object, n, glyph;
@@ -4588,6 +4439,8 @@ created glyph-string.  Otherwise, the value is nil.  */)
     }
   if (i == 3 || XINT (n) == 0)
     return Qnil;
+  if (XINT (n) < LGSTRING_GLYPH_LEN (gstring))
+    LGSTRING_SET_GLYPH (gstring, XINT (n), Qnil);
 
   glyph = LGSTRING_GLYPH (gstring, 0);
   from = LGLYPH_FROM (glyph);
@@ -4637,8 +4490,7 @@ where
   VARIATION-SELECTOR is a chracter code of variation selection
     (#xFE00..#xFE0F or #xE0100..#xE01EF)
   GLYPH-ID is a glyph code of the corresponding variation glyph.  */)
-     (font_object, character)
-     Lisp_Object font_object, character;
+  (Lisp_Object font_object, Lisp_Object character)
 {
   unsigned variations[256];
   struct font *font;
@@ -4706,8 +4558,7 @@ produced in GSTRING-OUT, and the value is nil.
 
 See the documentation of `font-make-gstring' for the format of
 glyph-string.  */)
-     (otf_features, gstring_in, from, to, gstring_out, index)
-     Lisp_Object otf_features, gstring_in, from, to, gstring_out, index;
+  (Lisp_Object otf_features, Lisp_Object gstring_in, Lisp_Object from, Lisp_Object to, Lisp_Object gstring_out, Lisp_Object index)
 {
   Lisp_Object font_object = LGSTRING_FONT (gstring_in);
   Lisp_Object val;
@@ -4757,8 +4608,7 @@ The value is a list of cons cells of the format (GLYPH-ID . CHARACTER),
 where GLYPH-ID is a glyph index of the font, and CHARACTER is a
 character code corresponding to the glyph or nil if there's no
 corresponding character.  */)
-     (font_object, character, otf_features)
-     Lisp_Object font_object, character, otf_features;
+  (Lisp_Object font_object, Lisp_Object character, Lisp_Object otf_features)
 {
   struct font *font;
   Lisp_Object gstring_in, gstring_out, g;
@@ -4799,10 +4649,7 @@ corresponding character.  */)
 
 DEFUN ("open-font", Fopen_font, Sopen_font, 1, 3, 0,
        doc: /* Open FONT-ENTITY.  */)
-     (font_entity, size, frame)
-     Lisp_Object font_entity;
-     Lisp_Object size;
-     Lisp_Object frame;
+  (Lisp_Object font_entity, Lisp_Object size, Lisp_Object frame)
 {
   int isize;
 
@@ -4828,8 +4675,7 @@ DEFUN ("open-font", Fopen_font, Sopen_font, 1, 3, 0,
 
 DEFUN ("close-font", Fclose_font, Sclose_font, 1, 2, 0,
        doc: /* Close FONT-OBJECT.  */)
-     (font_object, frame)
-     Lisp_Object font_object, frame;
+  (Lisp_Object font_object, Lisp_Object frame)
 {
   CHECK_FONT_OBJECT (font_object);
   if (NILP (frame))
@@ -4880,8 +4726,7 @@ representing the default langsys.
 FEATURE is a symbol representing OpenType feature tag.
 
 If the font is not OpenType font, CAPABILITY is nil.  */)
-     (font_object)
-     Lisp_Object font_object;
+  (Lisp_Object font_object)
 {
   struct font *font;
   Lisp_Object val;
@@ -4902,25 +4747,99 @@ If the font is not OpenType font, CAPABILITY is nil.  */)
   return val;
 }
 
-DEFUN ("get-font-glyphs", Fget_font_glyphs, Sget_font_glyphs, 2, 2, 0,
-       doc: /* Return a vector of glyphs of FONT-OBJECT for drawing STRING.
-Each element is a vector [GLYPH-CODE LBEARING RBEARING WIDTH ASCENT DESCENT].  */)
-     (font_object, string)
-     Lisp_Object font_object, string;
+DEFUN ("font-get-glyphs", Ffont_get_glyphs, Sfont_get_glyphs, 3, 4, 0,
+       doc:
+       /* Return a vector of FONT-OBJECT's glyphs for the specified characters.
+FROM and TO are positions (integers or markers) specifying a region
+of the current buffer.
+If the optional fourth arg OBJECT is not nil, it is a string or a
+vector containing the target characters.
+
+Each element is a vector containing information of a glyph in this format:
+  [FROM-IDX TO-IDX C CODE WIDTH LBEARING RBEARING ASCENT DESCENT ADJUSTMENT]
+where
+  FROM is an index numbers of a character the glyph corresponds to.
+  TO is the same as FROM.
+  C is the character of the glyph.
+  CODE is the glyph-code of C in FONT-OBJECT.
+  WIDTH thru DESCENT are the metrics (in pixels) of the glyph.
+  ADJUSTMENT is always nil.
+If FONT-OBJECT doesn't have a glyph for a character,
+the corresponding element is nil.  */)
+  (Lisp_Object font_object, Lisp_Object from, Lisp_Object to,
+   Lisp_Object object)
 {
   struct font *font;
-  int i, len;
-  Lisp_Object vec;
+  int i, len, c;
+  Lisp_Object *chars, vec;
+  USE_SAFE_ALLOCA;
 
   CHECK_FONT_GET_OBJECT (font_object, font);
-  CHECK_STRING (string);
-  len = SCHARS (string);
+  if (NILP (object))
+    {
+      EMACS_INT charpos, bytepos;
+
+      validate_region (&from, &to);
+      if (EQ (from, to))
+       return Qnil;
+      len = XFASTINT (to) - XFASTINT (from);
+      SAFE_ALLOCA_LISP (chars, len);
+      charpos = XFASTINT (from);
+      bytepos = CHAR_TO_BYTE (charpos);
+      for (i = 0; charpos < XFASTINT (to); i++)
+       {
+         FETCH_CHAR_ADVANCE (c, charpos, bytepos);
+         chars[i] = make_number (c);
+       }
+    }
+  else if (STRINGP (object))
+    {
+      const unsigned char *p;
+
+      CHECK_NUMBER (from);
+      CHECK_NUMBER (to);
+      if (XINT (from) < 0 || XINT (from) > XINT (to)
+         || XINT (to) > SCHARS (object))
+       args_out_of_range_3 (object, from, to);
+      if (EQ (from, to))
+       return Qnil;
+      len = XFASTINT (to) - XFASTINT (from);
+      SAFE_ALLOCA_LISP (chars, len);
+      p = SDATA (object);
+      if (STRING_MULTIBYTE (object))
+       for (i = 0; i < len; i++)
+         {
+           c = STRING_CHAR_ADVANCE (p);
+           chars[i] = make_number (c);
+         }
+      else
+       for (i = 0; i < len; i++)
+         chars[i] = make_number (p[i]);
+    }
+  else
+    {
+      CHECK_VECTOR (object);
+      CHECK_NUMBER (from);
+      CHECK_NUMBER (to);
+      if (XINT (from) < 0 || XINT (from) > XINT (to)
+         || XINT (to) > ASIZE (object))
+       args_out_of_range_3 (object, from, to);
+      if (EQ (from, to))
+       return Qnil;
+      len = XFASTINT (to) - XFASTINT (from);
+      for (i = 0; i < len; i++)
+       {
+         Lisp_Object elt = AREF (object, XFASTINT (from) + i);
+         CHECK_CHARACTER (elt);
+       }
+      chars = &(AREF (object, XFASTINT (from)));
+    }
+
   vec = Fmake_vector (make_number (len), Qnil);
   for (i = 0; i < len; i++)
     {
-      Lisp_Object ch = Faref (string, make_number (i));
-      Lisp_Object val;
-      int c = XINT (ch);
+      Lisp_Object g;
+      int c = XFASTINT (chars[i]);
       unsigned code;
       EMACS_INT cod;
       struct font_metrics metrics;
@@ -4928,28 +4847,28 @@ Each element is a vector [GLYPH-CODE LBEARING RBEARING WIDTH ASCENT DESCENT].  *
       cod = code = font->driver->encode_char (font, c);
       if (code == FONT_INVALID_CODE)
        continue;
-      val = Fmake_vector (make_number (6), Qnil);
-      if (cod <= MOST_POSITIVE_FIXNUM)
-       ASET (val, 0, make_number (code));
-      else
-       ASET (val, 0, Fcons (make_number (code >> 16),
-                            make_number (code & 0xFFFF)));
+      g = Fmake_vector (make_number (LGLYPH_SIZE), Qnil);
+      LGLYPH_SET_FROM (g, i);
+      LGLYPH_SET_TO (g, i);
+      LGLYPH_SET_CHAR (g, c);
+      LGLYPH_SET_CODE (g, code);
       font->driver->text_extents (font, &code, 1, &metrics);
-      ASET (val, 1, make_number (metrics.lbearing));
-      ASET (val, 2, make_number (metrics.rbearing));
-      ASET (val, 3, make_number (metrics.width));
-      ASET (val, 4, make_number (metrics.ascent));
-      ASET (val, 5, make_number (metrics.descent));
-      ASET (vec, i, val);
-    }
+      LGLYPH_SET_WIDTH (g, metrics.width);
+      LGLYPH_SET_LBEARING (g, metrics.lbearing);
+      LGLYPH_SET_RBEARING (g, metrics.rbearing);
+      LGLYPH_SET_ASCENT (g, metrics.ascent);
+      LGLYPH_SET_DESCENT (g, metrics.descent);
+      ASET (vec, i, g);
+    }
+  if (! VECTORP (object))
+    SAFE_FREE ();
   return vec;
 }
 
 DEFUN ("font-match-p", Ffont_match_p, Sfont_match_p, 2, 2, 0,
        doc: /* Return t if and only if font-spec SPEC matches with FONT.
 FONT is a font-spec, font-entity, or font-object. */)
-     (spec, font)
-     Lisp_Object spec, font;
+  (Lisp_Object spec, Lisp_Object font)
 {
   CHECK_FONT_SPEC (spec);
   CHECK_FONT (font);
@@ -4961,8 +4880,7 @@ DEFUN ("font-at", Ffont_at, Sfont_at, 1, 3, 0,
        doc: /* Return a font-object for displaying a character at POSITION.
 Optional second arg WINDOW, if non-nil, is a window displaying
 the current buffer.  It defaults to the currently selected window.  */)
-     (position, window, string)
-     Lisp_Object position, window, string;
+  (Lisp_Object position, Lisp_Object window, Lisp_Object string)
 {
   struct window *w;
   EMACS_INT pos;
@@ -4995,8 +4913,7 @@ DEFUN ("draw-string", Fdraw_string, Sdraw_string, 2, 2, 0,
        doc: /*  Draw STRING by FONT-OBJECT on the top left corner of the current frame.
 The value is a number of glyphs drawn.
 Type C-l to recover what previously shown.  */)
-     (font_object, string)
-     Lisp_Object font_object, string;
+  (Lisp_Object font_object, Lisp_Object string)
 {
   Lisp_Object frame = selected_frame;
   FRAME_PTR f = XFRAME (frame);
@@ -5050,8 +4967,7 @@ where
   RELATIVE-COMPOSE and DEFAULT-ASCENT are the numbers controlling
     how to compose characters.
 If the named font is not yet loaded, return nil.  */)
-     (name, frame)
-     Lisp_Object name, frame;
+  (Lisp_Object name, Lisp_Object frame)
 {
   FRAME_PTR f;
   struct font *font;
@@ -5114,9 +5030,7 @@ If the named font is not yet loaded, return nil.  */)
   build_style_table ((TBL), sizeof TBL / sizeof (struct table_entry))
 
 static Lisp_Object
-build_style_table (entry, nelement)
-     struct table_entry *entry;
-     int nelement;
+build_style_table (const struct table_entry *entry, int nelement)
 {
   int i, j;
   Lisp_Object table, elt;
@@ -5146,9 +5060,7 @@ static Lisp_Object Vfont_log_deferred;
    opening), ARG is the argument for the action, and RESULT is the
    result of the action.  */
 void
-font_add_log (action, arg, result)
-     char *action;
-     Lisp_Object arg, result;
+font_add_log (const char *action, Lisp_Object arg, Lisp_Object result)
 {
   Lisp_Object tail, val;
   int i;
@@ -5234,9 +5146,7 @@ font_add_log (action, arg, result)
    as font_add_log.  */
 
 void
-font_deferred_log (action, arg, result)
-     char *action;
-     Lisp_Object arg, result;
+font_deferred_log (const char *action, Lisp_Object arg, Lisp_Object result)
 {
   if (EQ (Vfont_log, Qt))
     return;
@@ -5245,17 +5155,8 @@ font_deferred_log (action, arg, result)
   ASET (Vfont_log_deferred, 2, result);
 }
 
-extern void syms_of_ftfont P_ (());
-extern void syms_of_xfont P_ (());
-extern void syms_of_xftfont P_ (());
-extern void syms_of_ftxfont P_ (());
-extern void syms_of_bdffont P_ (());
-extern void syms_of_w32font P_ (());
-extern void syms_of_atmfont P_ (());
-extern void syms_of_nsfont P_ (());
-
 void
-syms_of_font ()
+syms_of_font (void)
 {
   sort_shift_bits[FONT_TYPE_INDEX] = 0;
   sort_shift_bits[FONT_SLANT_INDEX] = 2;
@@ -5343,7 +5244,7 @@ syms_of_font ()
   defsubr (&Sopen_font);
   defsubr (&Sclose_font);
   defsubr (&Squery_font);
-  defsubr (&Sget_font_glyphs);
+  defsubr (&Sfont_get_glyphs);
   defsubr (&Sfont_match_p);
   defsubr (&Sfont_at);
 #if 0
@@ -5376,22 +5277,30 @@ non-nil value in the table are supported.  If REPERTORY is nil, Emacs
 gets the repertory information by an opened font and ENCODING.  */);
   Vfont_encoding_alist = Qnil;
 
+  /* FIXME: These 3 vars are not quite what they appear: setq on them
+     won't have any effect other than disconnect them from the style
+     table used by the font display code.  So we make them read-only,
+     to avoid this confusing situation.  */
+
   DEFVAR_LISP_NOPRO ("font-weight-table", &Vfont_weight_table,
               doc: /*  Vector of valid font weight values.
 Each element has the form:
     [NUMERIC-VALUE SYMBOLIC-NAME ALIAS-NAME ...]
 NUMERIC-VALUE is an integer, and SYMBOLIC-NAME and ALIAS-NAME are symbols. */);
   Vfont_weight_table = BUILD_STYLE_TABLE (weight_table);
+  XSYMBOL (intern_c_string ("font-weight-table"))->constant = 1;
 
   DEFVAR_LISP_NOPRO ("font-slant-table", &Vfont_slant_table,
               doc: /*  Vector of font slant symbols vs the corresponding numeric values.
 See `font-weight-table' for the format of the vector. */);
   Vfont_slant_table = BUILD_STYLE_TABLE (slant_table);
+  XSYMBOL (intern_c_string ("font-slant-table"))->constant = 1;
 
   DEFVAR_LISP_NOPRO ("font-width-table", &Vfont_width_table,
               doc: /*  Alist of font width symbols vs the corresponding numeric values.
 See `font-weight-table' for the format of the vector. */);
   Vfont_width_table = BUILD_STYLE_TABLE (width_table);
+  XSYMBOL (intern_c_string ("font-width-table"))->constant = 1;
 
   staticpro (&font_style_table);
   font_style_table = Fmake_vector (make_number (3), Qnil);
@@ -5434,7 +5343,7 @@ EMACS_FONT_LOG is set.  Otherwise, it is set to t.  */);
 }
 
 void
-init_font ()
+init_font (void)
 {
   Vfont_log = egetenv ("EMACS_FONT_LOG") ? Qnil : Qt;
 }
index 952ea2694957dc2e484fc7174113a4ec205f1772..c322b8e590f7be2e1e2bd9fdea7f7794795a1b01 100644 (file)
@@ -159,14 +159,19 @@ enum font_property_index
     /* This value is the length of font-spec vector.  */
     FONT_SPEC_MAX,
 
-    /* The followings are used only for a font-entity.  */
+    /* The followings are used only for a font-entity and a font-object.  */
 
     /* List of font-objects opened from the font-entity.  */
     FONT_OBJLIST_INDEX = FONT_SPEC_MAX,
 
+    /* Font-entity from which the font-object is opened.  */
+    FONT_ENTITY_INDEX = FONT_SPEC_MAX,
+
     /* This value is the length of font-entity vector.  */
     FONT_ENTITY_MAX,
 
+    /* The followings are used only for a font-object.  */
+
     /* XLFD name of the font (string). */
     FONT_NAME_INDEX = FONT_ENTITY_MAX,
 
@@ -234,7 +239,9 @@ enum font_property_index
   ASET ((font), prop, make_number (font_style_to_value (prop, val, 1)))
 
 extern Lisp_Object QCspacing, QCdpi, QCscalable, QCotf, QClang, QCscript;
-extern Lisp_Object QCavgwidth, QCfont_entity, QCfc_unknown_spec;
+extern Lisp_Object QCavgwidth, QCantialias, QCfont_entity, QCfc_unknown_spec;
+extern Lisp_Object Qp;
+
 
 /* Important character set symbols.  */
 extern Lisp_Object Qascii_0;
@@ -507,7 +514,7 @@ struct font_driver
 
   /* Return a cache of font-entities on frame F.  The cache must be a
      cons whose cdr part is the actual cache area.  */
-  Lisp_Object (*get_cache) P_ ((FRAME_PTR F));
+  Lisp_Object (*get_cache) (FRAME_PTR F);
 
   /* List fonts exactly matching with FONT_SPEC on FRAME.  The value
      is a list of font-entities.  The font properties to be considered
@@ -530,7 +537,7 @@ struct font_driver
 
      This and the following `match' are the only APIs that allocate
      font-entities.  */
-  Lisp_Object (*list) P_ ((Lisp_Object frame, Lisp_Object font_spec));
+  Lisp_Object (*list) (Lisp_Object frame, Lisp_Object font_spec);
 
   /* Return a font-entity most closely matching with FONT_SPEC on
      FRAME.  Which font property to consider, and how to calculate the
@@ -539,92 +546,92 @@ struct font_driver
 
      The properties that the font-entity has is the same as `list'
      method.  */
-  Lisp_Object (*match) P_ ((Lisp_Object frame, Lisp_Object font_spec));
+  Lisp_Object (*match) (Lisp_Object frame, Lisp_Object font_spec);
 
   /* Optional.
      List available families.  The value is a list of family names
      (symbols).  */
-  Lisp_Object (*list_family) P_ ((Lisp_Object frame));
+  Lisp_Object (*list_family) (Lisp_Object frame);
 
   /* Optional (if FONT_EXTRA_INDEX is not Lisp_Save_Value).
      Free FONT_EXTRA_INDEX field of FONT_ENTITY.  */
-  void (*free_entity) P_ ((Lisp_Object font_entity));
+  void (*free_entity) (Lisp_Object font_entity);
 
   /* Open a font specified by FONT_ENTITY on frame F.  If the font is
      scalable, open it with PIXEL_SIZE.  */
-  Lisp_Object (*open) P_ ((FRAME_PTR f, Lisp_Object font_entity,
-                          int pixel_size));
+  Lisp_Object (*open) (FRAME_PTR f, Lisp_Object font_entity,
+                       int pixel_size);
 
   /* Close FONT on frame F.  */
-  void (*close) P_ ((FRAME_PTR f, struct font *font));
+  void (*close) (FRAME_PTR f, struct font *font);
 
   /* Optional (if FACE->extra is not used).
      Prepare FACE for displaying characters by FONT on frame F by
      storing some data in FACE->extra.  If successful, return 0.
      Otherwise, return -1.  */
-  int (*prepare_face) P_ ((FRAME_PTR f, struct face *face));
+  int (*prepare_face) (FRAME_PTR f, struct face *face);
 
   /* Optional.
      Done FACE for displaying characters by FACE->font on frame F.  */
-  void (*done_face) P_ ((FRAME_PTR f, struct face *face));
+  void (*done_face) (FRAME_PTR f, struct face *face);
 
   /* Optional.
      If FONT (FONT-ENTITY or FONT-OBJECT) has a glyph for character C
      (Unicode code point), return 1.  If not, return 0.  If FONT is
      FONT-ENTITY and it must be opened to check it, return -1.  */
-  int (*has_char) P_ ((Lisp_Object font, int c));
+  int (*has_char) (Lisp_Object font, int c);
 
   /* Return a glyph code of FONT for characer C (Unicode code point).
      If FONT doesn't have such a glyph, return FONT_INVALID_CODE.  */
-  unsigned (*encode_char) P_ ((struct font *font, int c));
+  unsigned (*encode_char) (struct font *font, int c);
 
   /* Computate the total metrics of the NGLYPHS glyphs specified by
      the font FONT and the sequence of glyph codes CODE, and store the
      result in METRICS.  */
-  int (*text_extents) P_ ((struct font *font,
-                          unsigned *code, int nglyphs,
-                          struct font_metrics *metrics));
+  int (*text_extents) (struct font *font,
+                       unsigned *code, int nglyphs,
+                       struct font_metrics *metrics);
 
   /* Optional.
      Draw glyphs between FROM and TO of S->char2b at (X Y) pixel
      position of frame F with S->FACE and S->GC.  If WITH_BACKGROUND
      is nonzero, fill the background in advance.  It is assured that
      WITH_BACKGROUND is zero when (FROM > 0 || TO < S->nchars).  */
-  int (*draw) P_ ((struct glyph_string *s, int from, int to,
-                  int x, int y, int with_background));
+  int (*draw) (struct glyph_string *s, int from, int to,
+               int x, int y, int with_background);
 
   /* Optional.
      Store bitmap data for glyph-code CODE of FONT in BITMAP.  It is
      intended that this method is callled from the other font-driver
      for actual drawing.  */
-  int (*get_bitmap) P_ ((struct font *font, unsigned code,
-                        struct font_bitmap *bitmap,
-                        int bits_per_pixel));
+  int (*get_bitmap) (struct font *font, unsigned code,
+                     struct font_bitmap *bitmap,
+                     int bits_per_pixel);
 
   /* Optional.
      Free bitmap data in BITMAP.  */
-  void (*free_bitmap) P_ ((struct font *font, struct font_bitmap *bitmap));
+  void (*free_bitmap) (struct font *font, struct font_bitmap *bitmap);
 
   /* Optional.
      Return an outline data for glyph-code CODE of FONT.  The format
      of the outline data depends on the font-driver.  */
-  void *(*get_outline) P_ ((struct font *font, unsigned code));
+  void *(*get_outline) (struct font *font, unsigned code);
 
   /* Optional.
      Free OUTLINE (that is obtained by the above method).  */
-  void (*free_outline) P_ ((struct font *font, void *outline));
+  void (*free_outline) (struct font *font, void *outline);
 
   /* Optional.
      Get coordinates of the INDEXth anchor point of the glyph whose
      code is CODE.  Store the coordinates in *X and *Y.  Return 0 if
      the operations was successfull.  Otherwise return -1.  */
-  int (*anchor_point) P_ ((struct font *font, unsigned code, int index,
-                          int *x, int *y));
+  int (*anchor_point) (struct font *font, unsigned code, int index,
+                       int *x, int *y);
 
   /* Optional.
      Return a list describing which scripts/languages FONT
      supports by which GSUB/GPOS features of OpenType tables.  */
-  Lisp_Object (*otf_capability) P_ ((struct font *font));
+  Lisp_Object (*otf_capability) (struct font *font);
 
   /* Optional.
      Apply FONT's OTF-FEATURES to the glyph string.
@@ -641,20 +648,20 @@ struct font_driver
      Return the number of output codes.  If none of the features are
      applicable to the input data, return 0.  If GSTRING-OUT is too
      short, return -1.  */
-  int (*otf_drive) P_ ((struct font *font, Lisp_Object features,
-                      Lisp_Object gstring_in, int from, int to,
-                      Lisp_Object gstring_out, int idx, int alternate_subst));
+  int (*otf_drive) (struct font *font, Lisp_Object features,
+                    Lisp_Object gstring_in, int from, int to,
+                    Lisp_Object gstring_out, int idx, int alternate_subst);
 
   /* Optional.
      Make the font driver ready for frame F.  Usually this function
      makes some data specific to F and stores it in F by calling
      font_put_frame_data ().  */
-  int (*start_for_frame) P_ ((FRAME_PTR f));
+  int (*start_for_frame) (FRAME_PTR f);
 
   /* Optional.
      End using the driver for frame F.  Usually this function free
      some data stored for F.  */
-  int (*end_for_frame) P_ ((FRAME_PTR f));
+  int (*end_for_frame) (FRAME_PTR f);
 
   /* Optional.
 
@@ -670,14 +677,14 @@ struct font_driver
      a new glyph object and storing it in GSTRING.  If (M) is greater
      than the length of GSTRING, nil should be return.  In that case,
      this function is called again with the larger GSTRING.  */
-  Lisp_Object (*shape) P_ ((Lisp_Object lgstring));
+  Lisp_Object (*shape) (Lisp_Object lgstring);
 
   /* Optional.
 
      If FONT is usable on frame F, return 0.  Otherwise return -1.
      This method is used only for debugging.  If this method is NULL,
      Emacs assumes that the font is usable on any frame.  */
-  int (*check) P_ ((FRAME_PTR F, struct font *font));
+  int (*check) (FRAME_PTR F, struct font *font);
 
   /* Optional.
 
@@ -685,18 +692,18 @@ struct font_driver
      FONT.  VARIATIONS is an array of 256 elements.  If the variation
      selector N (1..256) defines a glyph, that glyph code is stored in
      the (N-1)th element of VARIATIONS.  */
-  int (*get_variation_glyphs) P_ ((struct font *font,
-                                  int c, unsigned variations[256]));
+  int (*get_variation_glyphs) (struct font *font,
+                               int c, unsigned variations[256]);
 
-  void (*filter_properties) P_ ((Lisp_Object font, Lisp_Object properties));
+  void (*filter_properties) (Lisp_Object font, Lisp_Object properties);
 
   /* Optional.
 
      Return non-zero if FONT_OBJECT can be used as a (cached) font
      for ENTITY on frame F.  */
-  int (*cached_font_ok) P_ ((struct frame *f,
-                             Lisp_Object font_object,
-                             Lisp_Object entity));
+  int (*cached_font_ok) (struct frame *f,
+                         Lisp_Object font_object,
+                         Lisp_Object entity);
 };
 
 
@@ -739,106 +746,118 @@ EXFUN (Ffont_family_list, 1);
 EXFUN (Fclear_font_cache, 0);
 EXFUN (Ffont_xlfd_name, 2);
 
-extern Lisp_Object font_make_spec P_ ((void));
-extern Lisp_Object font_make_entity P_ ((void));
-extern Lisp_Object font_make_object P_ ((int, Lisp_Object, int));
-
-extern Lisp_Object find_font_encoding P_ ((Lisp_Object));
-extern int font_registry_charsets P_ ((Lisp_Object, struct charset **,
-                                      struct charset **));
-extern int font_style_to_value P_ ((enum font_property_index prop,
-                                   Lisp_Object name, int noerror));
-extern Lisp_Object font_style_symbolic P_ ((Lisp_Object font,
-                                           enum font_property_index prop,
-                                           int for_face));
-
-extern int font_match_p P_ ((Lisp_Object spec, Lisp_Object font));
-extern Lisp_Object font_list_entities P_ ((Lisp_Object frame,
-                                          Lisp_Object spec));
-
-extern Lisp_Object font_get_name P_ ((Lisp_Object font_object));
-extern Lisp_Object font_spec_from_name P_ ((Lisp_Object font_name));
-extern Lisp_Object font_get_frame P_ ((Lisp_Object font_object));
-extern int font_has_char P_ ((FRAME_PTR, Lisp_Object, int));
-extern unsigned font_encode_char P_ ((Lisp_Object, int));
-
-extern void font_clear_prop P_ ((Lisp_Object *attrs,
-                                enum font_property_index prop));
-extern void font_update_lface P_ ((FRAME_PTR f, Lisp_Object *attrs));
-extern Lisp_Object font_find_for_lface P_ ((FRAME_PTR f, Lisp_Object *lface,
-                                           Lisp_Object spec, int c));
-extern Lisp_Object font_open_for_lface P_ ((FRAME_PTR f, Lisp_Object entity,
-                                           Lisp_Object *lface,
-                                           Lisp_Object spec));
-extern Lisp_Object font_load_for_lface P_ ((FRAME_PTR f, Lisp_Object *lface,
-                                           Lisp_Object spec));
-extern void font_prepare_for_face P_ ((FRAME_PTR f, struct face *face));
-extern void font_done_for_face P_ ((FRAME_PTR f, struct face *face));
-
-extern Lisp_Object font_open_by_spec P_ ((FRAME_PTR f, Lisp_Object spec));
-extern Lisp_Object font_open_by_name P_ ((FRAME_PTR f, char *name));
+extern Lisp_Object font_make_spec (void);
+extern Lisp_Object font_make_entity (void);
+extern Lisp_Object font_make_object (int, Lisp_Object, int);
+
+extern Lisp_Object find_font_encoding (Lisp_Object);
+extern int font_registry_charsets (Lisp_Object, struct charset **,
+                                   struct charset **);
+extern int font_style_to_value (enum font_property_index prop,
+                                Lisp_Object name, int noerror);
+extern Lisp_Object font_style_symbolic (Lisp_Object font,
+                                        enum font_property_index prop,
+                                        int for_face);
+
+extern int font_match_p (Lisp_Object spec, Lisp_Object font);
+extern Lisp_Object font_list_entities (Lisp_Object frame,
+                                       Lisp_Object spec);
+
+extern Lisp_Object font_get_name (Lisp_Object font_object);
+extern Lisp_Object font_spec_from_name (Lisp_Object font_name);
+extern Lisp_Object font_get_frame (Lisp_Object font_object);
+extern int font_has_char (FRAME_PTR, Lisp_Object, int);
+extern unsigned font_encode_char (Lisp_Object, int);
+
+extern void font_clear_prop (Lisp_Object *attrs,
+                             enum font_property_index prop);
+extern void font_update_lface (FRAME_PTR f, Lisp_Object *attrs);
+extern Lisp_Object font_find_for_lface (FRAME_PTR f, Lisp_Object *lface,
+                                        Lisp_Object spec, int c);
+extern Lisp_Object font_open_for_lface (FRAME_PTR f, Lisp_Object entity,
+                                        Lisp_Object *lface,
+                                        Lisp_Object spec);
+extern Lisp_Object font_load_for_lface (FRAME_PTR f, Lisp_Object *lface,
+                                        Lisp_Object spec);
+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 void font_close_object (FRAME_PTR f, Lisp_Object font_object);
 
-extern Lisp_Object font_intern_prop P_ ((char *str, int len, int force_symbol));
-extern void font_update_sort_order P_ ((int *order));
-
-extern void font_parse_family_registry P_ ((Lisp_Object family,
-                                           Lisp_Object registry,
-                                           Lisp_Object spec));
-extern Lisp_Object font_spec_from_family_registry P_ ((Lisp_Object family,
-                                                      Lisp_Object registry));
-
-extern int font_parse_xlfd P_ ((char *name, Lisp_Object font));
-extern int font_unparse_xlfd P_ ((Lisp_Object font, int pixel_size,
-                                 char *name, int bytes));
-extern int font_parse_fcname P_ ((char *name, Lisp_Object font));
-extern int font_unparse_fcname P_ ((Lisp_Object font, int pixel_size,
-                                 char *name, int bytes));
-extern int font_unparse_gtkname P_ ((Lisp_Object, struct frame *, char *, int));
-extern void register_font_driver P_ ((struct font_driver *driver, FRAME_PTR f));
-extern void free_font_driver_list P_ ((FRAME_PTR f));
-extern Lisp_Object font_update_drivers P_ ((FRAME_PTR f, Lisp_Object list));
-extern Lisp_Object font_at P_ ((int c, EMACS_INT pos, struct face *face,
-                               struct window *w, Lisp_Object object));
+extern Lisp_Object font_intern_prop (const char *str, int len, int force_symbol);
+extern void font_update_sort_order (int *order);
+
+extern void font_parse_family_registry (Lisp_Object family,
+                                        Lisp_Object registry,
+                                        Lisp_Object spec);
+extern Lisp_Object font_spec_from_family_registry (Lisp_Object family,
+                                                   Lisp_Object registry);
+
+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_fcname (char *name, Lisp_Object font);
+extern int font_unparse_fcname (Lisp_Object font, int pixel_size,
+                                char *name, int bytes);
+extern int font_unparse_gtkname (Lisp_Object, struct frame *, char *, int);
+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_at (int c, EMACS_INT pos, struct face *face,
+                            struct window *w, Lisp_Object object);
 extern Lisp_Object font_range (EMACS_INT, EMACS_INT *,
                               struct window *, struct face *,
                               Lisp_Object);
-extern void font_fill_lglyph_metrics P_ ((Lisp_Object, Lisp_Object));
+extern void font_fill_lglyph_metrics (Lisp_Object, Lisp_Object);
 
-extern Lisp_Object font_put_extra P_ ((Lisp_Object font, Lisp_Object prop,
-                                       Lisp_Object val));
+extern Lisp_Object font_put_extra (Lisp_Object font, Lisp_Object prop,
+                                   Lisp_Object val);
 
-extern int font_put_frame_data P_ ((FRAME_PTR f,
-                                   struct font_driver *driver,
-                                   void *data));
-extern void *font_get_frame_data P_ ((FRAME_PTR f,
-                                     struct font_driver *driver));
+extern int font_put_frame_data (FRAME_PTR f,
+                                struct font_driver *driver,
+                                void *data);
+extern void *font_get_frame_data (FRAME_PTR f,
+                                  struct font_driver *driver);
 
 #ifdef HAVE_FREETYPE
 extern struct font_driver ftfont_driver;
+extern void syms_of_ftfont (void);
 #endif /* HAVE_FREETYPE */
 #ifdef HAVE_X_WINDOWS
 extern struct font_driver xfont_driver;
 extern struct font_driver ftxfont_driver;
+extern void syms_of_xfont (void);
+extern void syms_of_ftxfont (void);
 #ifdef HAVE_XFT
 extern struct font_driver xftfont_driver;
+extern void syms_of_xftfont (void);
 #endif /* HAVE_XFT */
+#ifdef HAVE_BDFFONT
+extern void syms_of_bdffont (void);
+#endif /* HAVE_BDFFONT */
 #endif /* HAVE_X_WINDOWS */
 #ifdef WINDOWSNT
 extern struct font_driver w32font_driver;
 extern struct font_driver uniscribe_font_driver;
+extern void syms_of_w32font (void);
 #endif /* WINDOWSNT */
 #ifdef HAVE_NS
+extern Lisp_Object Qfontsize;
 extern struct font_driver nsfont_driver;
+extern void syms_of_nsfont (void);
 #endif /* HAVE_NS */
 
 #ifndef FONT_DEBUG
 #define FONT_DEBUG
 #endif
 
+extern Lisp_Object QCfoundry, QCadstyle, QCregistry;
+
 extern Lisp_Object Vfont_log;
-extern void font_add_log P_ ((char *, Lisp_Object, Lisp_Object));
-extern void font_deferred_log P_ ((char *, Lisp_Object, Lisp_Object));
+extern void font_add_log (const char *, Lisp_Object, Lisp_Object);
+extern void font_deferred_log (const char *, Lisp_Object, Lisp_Object);
 
 #define FONT_ADD_LOG(ACTION, ARG, RESULT)      \
   do {                                         \
index e4fd9d72780b786bd3dc639c3ed6a3c2c52c56a4..86b9ceb45db705e7db2c0f9a2e0446bba3b8759a 100644 (file)
@@ -177,7 +177,6 @@ EXFUN (Fclear_face_cache, 1);
 
 /********** VARIABLES and FUNCTION PROTOTYPES **********/
 
-extern Lisp_Object Qfont;
 static Lisp_Object Qfontset;
 static Lisp_Object Qfontset_info;
 static Lisp_Object Qprepend, Qappend;
@@ -203,23 +202,23 @@ Lisp_Object Vvertical_centering_font_regexp;
 Lisp_Object Votf_script_alist;
 
 /* Check if any window system is used now.  */
-void (*check_window_system_func) P_ ((void));
+void (*check_window_system_func) (void);
 
 
 /* Prototype declarations for static functions.  */
-static Lisp_Object fontset_add P_ ((Lisp_Object, Lisp_Object, Lisp_Object,
-                                   Lisp_Object));
-static Lisp_Object fontset_find_font P_ ((Lisp_Object, int, struct face *,
-                                         int, int));
-static void reorder_font_vector P_ ((Lisp_Object, struct font *));
-static Lisp_Object fontset_font P_ ((Lisp_Object, int, struct face *, int));
-static Lisp_Object make_fontset P_ ((Lisp_Object, Lisp_Object, Lisp_Object));
-static Lisp_Object fontset_pattern_regexp P_ ((Lisp_Object));
-static void accumulate_script_ranges P_ ((Lisp_Object, Lisp_Object,
-                                         Lisp_Object));
-Lisp_Object find_font_encoding P_ ((Lisp_Object));
-
-static void set_fontset_font P_ ((Lisp_Object, Lisp_Object));
+static Lisp_Object fontset_add (Lisp_Object, Lisp_Object, Lisp_Object,
+                                Lisp_Object);
+static Lisp_Object fontset_find_font (Lisp_Object, int, struct face *,
+                                      int, int);
+static void reorder_font_vector (Lisp_Object, struct font *);
+static Lisp_Object fontset_font (Lisp_Object, int, struct face *, int);
+static Lisp_Object make_fontset (Lisp_Object, Lisp_Object, Lisp_Object);
+static Lisp_Object fontset_pattern_regexp (Lisp_Object);
+static void accumulate_script_ranges (Lisp_Object, Lisp_Object,
+                                      Lisp_Object);
+Lisp_Object find_font_encoding (Lisp_Object);
+
+static void set_fontset_font (Lisp_Object, Lisp_Object);
 
 #ifdef FONTSET_DEBUG
 
@@ -284,6 +283,10 @@ fontset_id_valid_p (id)
 #define RFONT_DEF_OBJECT(rfont_def) AREF (rfont_def, 2)
 #define RFONT_DEF_SET_OBJECT(rfont_def, object)        \
   ASET ((rfont_def), 2, (object))
+/* Score of RFONT_DEF is an integer value; the lowest 8 bits represent
+   the order of listing by font backends, the higher bits represents
+   the order given by charset priority list.  The smaller value is
+   preferable.  */
 #define RFONT_DEF_SCORE(rfont_def) XINT (AREF (rfont_def, 3))
 #define RFONT_DEF_SET_SCORE(rfont_def, score) \
   ASET ((rfont_def), 3, make_number (score))
@@ -306,9 +309,7 @@ fontset_id_valid_p (id)
    : fontset_ref ((fontset), (c)))
 
 static Lisp_Object
-fontset_ref (fontset, c)
-     Lisp_Object fontset;
-     int c;
+fontset_ref (Lisp_Object fontset, int c)
 {
   Lisp_Object elt;
 
@@ -343,8 +344,7 @@ fontset_ref (fontset, c)
    : fontset_add ((fontset), (range), (elt), (add)))
 
 static Lisp_Object
-fontset_add (fontset, range, elt, add)
-     Lisp_Object fontset, range, elt, add;
+fontset_add (Lisp_Object fontset, Lisp_Object range, Lisp_Object elt, Lisp_Object add)
 {
   Lisp_Object args[2];
   int idx = (EQ (add, Qappend) ? 0 : 1);
@@ -376,8 +376,7 @@ fontset_add (fontset, range, elt, add)
 }
 
 static int
-fontset_compare_rfontdef (val1, val2)
-     const void *val1, *val2;
+fontset_compare_rfontdef (const void *val1, const void *val2)
 {
   return (RFONT_DEF_SCORE (*(Lisp_Object *) val1)
          - RFONT_DEF_SCORE (*(Lisp_Object *) val2));
@@ -392,12 +391,8 @@ fontset_compare_rfontdef (val1, val2)
    If PREFERRED_FAMILY is not nil, that family has the higher priority
    if the encoding charsets or languages in font-specs are the same.  */
 
-extern Lisp_Object Fassoc_string ();
-
 static void
-reorder_font_vector (font_group, font)
-     Lisp_Object font_group;
-     struct font *font;
+reorder_font_vector (Lisp_Object font_group, struct font *font)
 {
   Lisp_Object vec, font_object;
   int size;
@@ -421,8 +416,13 @@ reorder_font_vector (font_group, font)
       Lisp_Object font_def = RFONT_DEF_FONT_DEF (rfont_def);
       Lisp_Object font_spec = FONT_DEF_SPEC (font_def);
       int score = RFONT_DEF_SCORE (rfont_def) & 0xFF;
+      Lisp_Object otf_spec = Ffont_get (font_spec, QCotf);
 
-      if (! font_match_p (font_spec, font_object))
+      if (! NILP (otf_spec))
+       /* A font-spec with :otf is preferable regardless of encoding
+          and language..  */
+       ;
+      else if (! font_match_p (font_spec, font_object))
        {
          Lisp_Object encoding = FONT_DEF_ENCODING (font_def);
 
@@ -525,11 +525,7 @@ fontset_get_font_group (Lisp_Object fontset, int c)
    If FALLBACK is nonzero, search only fallback fonts.  */
 
 static Lisp_Object
-fontset_find_font (fontset, c, face, id, fallback)
-     Lisp_Object fontset;
-     int c;
-     struct face *face;
-     int id, fallback;
+fontset_find_font (Lisp_Object fontset, int c, struct face *face, int id, int fallback)
 {
   Lisp_Object vec, font_group;
   int i, charset_matched = 0, found_index;
@@ -728,11 +724,7 @@ fontset_find_font (fontset, c, face, id, fallback)
 
 
 static Lisp_Object
-fontset_font (fontset, c, face, id)
-     Lisp_Object fontset;
-     int c;
-     struct face *face;
-     int id;
+fontset_font (Lisp_Object fontset, int c, struct face *face, int id)
 {
   Lisp_Object rfont_def, default_rfont_def;
   Lisp_Object base_fontset;
@@ -793,8 +785,7 @@ fontset_font (fontset, c, face, id)
    BASE.  */
 
 static Lisp_Object
-make_fontset (frame, name, base)
-     Lisp_Object frame, name, base;
+make_fontset (Lisp_Object frame, Lisp_Object name, Lisp_Object base)
 {
   Lisp_Object fontset;
   int size = ASIZE (Vfontset_table);
@@ -835,8 +826,7 @@ make_fontset (frame, name, base)
 /* Return the name of the fontset who has ID.  */
 
 Lisp_Object
-fontset_name (id)
-     int id;
+fontset_name (int id)
 {
   Lisp_Object fontset;
 
@@ -848,8 +838,7 @@ fontset_name (id)
 /* Return the ASCII font name of the fontset who has ID.  */
 
 Lisp_Object
-fontset_ascii (id)
-     int id;
+fontset_ascii (int id)
 {
   Lisp_Object fontset, elt;
 
@@ -861,9 +850,7 @@ fontset_ascii (id)
 }
 
 void
-free_realized_fontset (f, fontset)
-     FRAME_PTR f;
-     Lisp_Object fontset;
+free_realized_fontset (FRAME_PTR f, Lisp_Object fontset)
 {
   Lisp_Object tail;
 
@@ -879,9 +866,7 @@ free_realized_fontset (f, fontset)
    free_realized_face.  */
 
 void
-free_face_fontset (f, face)
-     FRAME_PTR f;
-     struct face *face;
+free_face_fontset (FRAME_PTR f, struct face *face)
 {
   Lisp_Object fontset;
 
@@ -915,9 +900,7 @@ free_face_fontset (f, face)
    when C is not an ASCII character.  */
 
 int
-face_suitable_for_char_p (face, c)
-     struct face *face;
-     int c;
+face_suitable_for_char_p (struct face *face, int c)
 {
   Lisp_Object fontset, rfont_def;
 
@@ -934,11 +917,7 @@ face_suitable_for_char_p (face, c)
    the macro FACE_FOR_CHAR.  */
 
 int
-face_for_char (f, face, c, pos, object)
-     FRAME_PTR f;
-     struct face *face;
-     int c, pos;
-     Lisp_Object object;
+face_for_char (FRAME_PTR f, struct face *face, int c, int pos, Lisp_Object object)
 {
   Lisp_Object fontset, rfont_def, charset;
   int face_id;
@@ -1006,10 +985,7 @@ face_for_char (f, face, c, pos, object)
 
 
 Lisp_Object
-font_for_char (face, c, pos, object)
-     struct face *face;
-     int c, pos;
-     Lisp_Object object;
+font_for_char (struct face *face, int c, int pos, Lisp_Object object)
 {
   Lisp_Object fontset, rfont_def, charset;
   int id;
@@ -1059,10 +1035,7 @@ font_for_char (face, c, pos, object)
    Called from realize_x_face.  */
 
 int
-make_fontset_for_ascii_face (f, base_fontset_id, face)
-     FRAME_PTR f;
-     int base_fontset_id;
-     struct face *face;
+make_fontset_for_ascii_face (FRAME_PTR f, int base_fontset_id, struct face *face)
 {
   Lisp_Object base_fontset, fontset, frame;
 
@@ -1096,11 +1069,10 @@ static Lisp_Object Vcached_fontset_data;
    expression corresponding to PATTERN.  */
 
 static Lisp_Object
-fontset_pattern_regexp (pattern)
-     Lisp_Object pattern;
+fontset_pattern_regexp (Lisp_Object pattern)
 {
-  if (!index ((char *) SDATA (pattern), '*')
-      && !index ((char *) SDATA (pattern), '?'))
+  if (!strchr ((char *) SDATA (pattern), '*')
+      && !strchr ((char *) SDATA (pattern), '?'))
     /* PATTERN does not contain any wild cards.  */
     return Qnil;
 
@@ -1171,9 +1143,7 @@ fontset_pattern_regexp (pattern)
 */
 
 int
-fs_query_fontset (name, name_pattern)
-     Lisp_Object name;
-     int name_pattern;
+fs_query_fontset (Lisp_Object name, int name_pattern)
 {
   Lisp_Object tem;
   int i;
@@ -1222,8 +1192,7 @@ The value is nil if there is no matching fontset.
 PATTERN can contain `*' or `?' as a wildcard
 just as X font name matching algorithm allows.
 If REGEXPP is non-nil, PATTERN is a regular expression.  */)
-     (pattern, regexpp)
-     Lisp_Object pattern, regexpp;
+  (Lisp_Object pattern, Lisp_Object regexpp)
 {
   Lisp_Object fontset;
   int id;
@@ -1246,10 +1215,7 @@ If REGEXPP is non-nil, PATTERN is a regular expression.  */)
 /* Return a list of base fontset names matching PATTERN on frame F.  */
 
 Lisp_Object
-list_fontsets (f, pattern, size)
-     FRAME_PTR f;
-     Lisp_Object pattern;
-     int size;
+list_fontsets (FRAME_PTR f, Lisp_Object pattern, int size)
 {
   Lisp_Object frame, regexp, val;
   int id;
@@ -1285,8 +1251,7 @@ list_fontsets (f, pattern, size)
 /* Free all realized fontsets whose base fontset is BASE.  */
 
 static void
-free_realized_fontsets (base)
-     Lisp_Object base;
+free_realized_fontsets (Lisp_Object base)
 {
   int id;
 
@@ -1343,8 +1308,7 @@ free_realized_fontsets (base)
    Set *FRAME to the actual frame.  */
 
 static Lisp_Object
-check_fontset_name (name, frame)
-     Lisp_Object name, *frame;
+check_fontset_name (Lisp_Object name, Lisp_Object *frame)
 {
   int id;
 
@@ -1373,8 +1337,7 @@ check_fontset_name (name, frame)
 }
 
 static void
-accumulate_script_ranges (arg, range, val)
-     Lisp_Object arg, range, val;
+accumulate_script_ranges (Lisp_Object arg, Lisp_Object range, Lisp_Object val)
 {
   if (EQ (XCAR (arg), val))
     {
@@ -1399,8 +1362,7 @@ accumulate_script_ranges (arg, range, val)
    case.  */
 
 static void
-set_fontset_font (arg, range)
-     Lisp_Object arg, range;
+set_fontset_font (Lisp_Object arg, Lisp_Object range)
 {
   Lisp_Object fontset, font_def, add, ascii, script_range_list;
   int from = XINT (XCAR (range)), to = XINT (XCDR (range));
@@ -1439,8 +1401,7 @@ set_fontset_font (arg, range)
   ASET (arg, 4, script_range_list);
 }
 
-extern Lisp_Object QCfamily, QCregistry;
-static void update_auto_fontset_alist P_ ((Lisp_Object, Lisp_Object));
+static void update_auto_fontset_alist (Lisp_Object, Lisp_Object);
 
 
 DEFUN ("set-fontset-font", Fset_fontset_font, Sset_fontset_font, 3, 5, 0,
@@ -1478,8 +1439,7 @@ Optional 5th argument ADD, if non-nil, specifies how to add FONT-SPEC
 to the font specifications for TARGET previously set.  If it is
 `prepend', FONT-SPEC is prepended.  If it is `append', FONT-SPEC is
 appended.  By default, FONT-SPEC overrides the previous settings.  */)
-     (name, target, font_spec, frame, add)
-     Lisp_Object name, target, font_spec, frame, add;
+  (Lisp_Object name, Lisp_Object target, Lisp_Object font_spec, Lisp_Object frame, Lisp_Object add)
 {
   Lisp_Object fontset;
   Lisp_Object font_def, registry, family;
@@ -1502,7 +1462,6 @@ appended.  By default, FONT-SPEC overrides the previous settings.  */)
   else if (STRINGP (font_spec))
     {
       Lisp_Object args[2];
-      extern Lisp_Object QCname;
 
       fontname = font_spec;
       args[0] = QCname;
@@ -1688,8 +1647,7 @@ char-table `char-script-table'.
 
 FONT-SPEC is a vector, a cons, or a string.  See the documentation of
 `set-fontset-font' for the meaning.  */)
-  (name, fontlist)
-     Lisp_Object name, fontlist;
+  (Lisp_Object name, Lisp_Object fontlist)
 {
   Lisp_Object fontset;
   int id;
@@ -1762,8 +1720,7 @@ static int num_auto_fontsets;
    user intends to use FONT-OBJECT for Latin characters.  */
 
 int
-fontset_from_font (font_object)
-     Lisp_Object font_object;
+fontset_from_font (Lisp_Object font_object)
 {
   Lisp_Object font_name = font_get_name (font_object);
   Lisp_Object font_spec = Fcopy_font_spec (font_object);
@@ -1819,8 +1776,7 @@ fontset_from_font (font_object)
    fontset_from_font.  */
 
 static void
-update_auto_fontset_alist (font_object, fontset)
-     Lisp_Object font_object, fontset;
+update_auto_fontset_alist (Lisp_Object font_object, Lisp_Object fontset)
 {
   Lisp_Object prev, tail;
 
@@ -1866,8 +1822,7 @@ update_auto_fontset_alist (font_object, fontset)
 
 DEFUN ("internal-char-font", Finternal_char_font, Sinternal_char_font, 1, 2, 0,
        doc: /* For internal use only.  */)
-     (position, ch)
-     Lisp_Object position, ch;
+  (Lisp_Object position, Lisp_Object ch)
 {
   EMACS_INT pos, pos_byte, dummy;
   int face_id;
@@ -1957,8 +1912,7 @@ The char-table has one extra slot.  If FONTSET is not the default
 fontset, the value the extra slot is a char-table containing the
 information about the derived fonts from the default fontset.  The
 format is the same as above.  */)
-     (fontset, frame)
-     Lisp_Object fontset, frame;
+  (Lisp_Object fontset, Lisp_Object frame)
 {
   FRAME_PTR f;
   Lisp_Object *realized[2], fontsets[2], tables[2];
@@ -2093,8 +2047,7 @@ fontset.
 
 If the 2nd optional arg ALL is non-nil, return a list of all font name
 patterns.  */)
-  (name, ch, all)
-     Lisp_Object name, ch, all;
+  (Lisp_Object name, Lisp_Object ch, Lisp_Object all)
 {
   int c;
   Lisp_Object fontset, elt, list, repertory, val;
@@ -2154,7 +2107,7 @@ patterns.  */)
 
 DEFUN ("fontset-list", Ffontset_list, Sfontset_list, 0, 0, 0,
        doc: /* Return a list of all defined fontset names.  */)
-     ()
+  (void)
 {
   Lisp_Object fontset, list;
   int i;
@@ -2211,7 +2164,7 @@ dump_fontset (fontset)
 
 DEFUN ("fontset-list-all", Ffontset_list_all, Sfontset_list_all, 0, 0, 0,
        doc: /* Return a brief summary of all fontsets for debug use.  */)
-     ()
+  (void)
 {
   Lisp_Object val;
   int i;
@@ -2224,7 +2177,7 @@ DEFUN ("fontset-list-all", Ffontset_list_all, Sfontset_list_all, 0, 0, 0,
 #endif /* FONTSET_DEBUG */
 
 void
-syms_of_fontset ()
+syms_of_fontset (void)
 {
   DEFSYM (Qfontset, "fontset");
   Fput (Qfontset, Qchar_table_extra_slots, make_number (9));
index 78bdfaaaca08b33e71bdf51c429e803f5a2addd7..661638feb39f1ebbcc18a0c81feb75f1e779688e 100644 (file)
@@ -28,23 +28,25 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #define EMACS_FONTSET_H
 
 /* Check if any window system is used now.  */
-extern void (*check_window_system_func) P_ ((void));
+extern void (*check_window_system_func) (void);
 
 struct face;
 
-extern void free_face_fontset P_ ((FRAME_PTR, struct face *));
-extern Lisp_Object fontset_font_pattern P_ ((FRAME_PTR, struct face *, int));
-extern int face_suitable_for_char_p P_ ((struct face *, int));
-extern int face_for_char P_ ((FRAME_PTR, struct face *, int,
-                             int, Lisp_Object));
-extern Lisp_Object font_for_char P_ ((struct face *, int, int, Lisp_Object));
+extern void free_face_fontset (FRAME_PTR, struct face *);
+extern Lisp_Object fontset_font_pattern (FRAME_PTR, struct face *, int);
+extern int face_suitable_for_char_p (struct face *, int);
+extern int face_for_char (FRAME_PTR, struct face *, int,
+                          int, Lisp_Object);
+extern Lisp_Object font_for_char (struct face *, int, int, Lisp_Object);
 
-extern int make_fontset_for_ascii_face P_ ((FRAME_PTR, int, struct face *));
-extern int fontset_from_font P_ ((Lisp_Object));
-extern int fs_query_fontset P_ ((Lisp_Object, int));
+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 P_ ((struct frame *, Lisp_Object, int));
+extern Lisp_Object list_fontsets (struct frame *, Lisp_Object, int);
+extern Lisp_Object find_font_encoding (Lisp_Object);
 
+extern Lisp_Object Qlatin;
 extern Lisp_Object Vuse_default_ascent;
 extern Lisp_Object Vignore_relative_composition;
 extern Lisp_Object Valternate_fontname_alist;
@@ -52,12 +54,12 @@ extern Lisp_Object Vfontset_alias_alist;
 extern Lisp_Object Vvertical_centering_font_regexp;
 extern Lisp_Object Votf_script_alist;
 
-extern Lisp_Object fontset_name P_ ((int));
-extern Lisp_Object fontset_ascii P_ ((int));
-extern int fontset_height P_ ((int));
+extern Lisp_Object fontset_name (int);
+extern Lisp_Object fontset_ascii (int);
+extern int fontset_height (int);
 
 struct font;
-extern int face_for_font P_ ((struct frame *, Lisp_Object, struct face *));
+extern int face_for_font (struct frame *, Lisp_Object, struct face *);
 
 #endif /* EMACS_FONTSET_H */
 
index a30d1e18175a1234c08da6920c39ad22ab1d8619..93a6e898c9b852aebe31e248074bf9de172eaec6 100644 (file)
@@ -119,7 +119,8 @@ Lisp_Object Qparent_id;
 Lisp_Object Qtitle, Qname;
 Lisp_Object Qexplicit_name;
 Lisp_Object Qunsplittable;
-Lisp_Object Qmenu_bar_lines, Qtool_bar_lines;
+Lisp_Object Qmenu_bar_lines, Qtool_bar_lines, Qtool_bar_position;
+Lisp_Object Vmenu_bar_mode, Vtool_bar_mode;
 Lisp_Object Qleft_fringe, Qright_fringe;
 Lisp_Object Qbuffer_predicate, Qbuffer_list, Qburied_buffer_list;
 Lisp_Object Qtty_color_mode;
@@ -142,9 +143,7 @@ static Lisp_Object Vdelete_frame_functions, Qdelete_frame_functions;
 int focus_follows_mouse;
 \f
 static void
-set_menu_bar_lines_1 (window, n)
-     Lisp_Object window;
-     int n;
+set_menu_bar_lines_1 (Lisp_Object window, int n)
 {
   struct window *w = XWINDOW (window);
 
@@ -170,9 +169,7 @@ set_menu_bar_lines_1 (window, n)
 }
 
 void
-set_menu_bar_lines (f, value, oldval)
-     struct frame *f;
-     Lisp_Object value, oldval;
+set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
 {
   int nlines;
   int olines = FRAME_MENU_BAR_LINES (f);
@@ -201,13 +198,6 @@ set_menu_bar_lines (f, value, oldval)
 \f
 Lisp_Object Vframe_list;
 
-extern Lisp_Object Vminibuffer_list;
-extern Lisp_Object get_minibuffer ();
-extern Lisp_Object Fhandle_switch_frame ();
-extern Lisp_Object Fredirect_frame_focus ();
-extern Lisp_Object x_get_focus_frame ();
-extern Lisp_Object QCname, Qfont_param;
-
 \f
 DEFUN ("framep", Fframep, Sframep, 1, 1, 0,
        doc: /* Return non-nil if OBJECT is a frame.
@@ -217,8 +207,7 @@ Value is t for a termcap frame (a character-only terminal),
 `ns' for an Emacs frame on a GNUstep or Macintosh Cocoa display,
 `pc' for a direct-write MS-DOS frame.
 See also `frame-live-p'.  */)
-     (object)
-     Lisp_Object object;
+  (Lisp_Object object)
 {
   if (!FRAMEP (object))
     return Qnil;
@@ -248,8 +237,7 @@ Value is nil if OBJECT is not a live frame.  If object is a live
 frame, the return value indicates what sort of terminal device it is
 displayed on.  See the documentation of `framep' for possible
 return values.  */)
-     (object)
-     Lisp_Object object;
+  (Lisp_Object object)
 {
   return ((FRAMEP (object)
           && FRAME_LIVE_P (XFRAME (object)))
@@ -263,8 +251,7 @@ The value is a symbol---for instance, 'x' for X windows.
 The value is nil if Emacs is using a text-only terminal.
 
 FRAME defaults to the currently selected frame.  */)
-  (frame)
-     Lisp_Object frame;
+  (Lisp_Object frame)
 {
   Lisp_Object type;
   if (NILP (frame))
@@ -282,8 +269,7 @@ FRAME defaults to the currently selected frame.  */)
 }
 
 struct frame *
-make_frame (mini_p)
-     int mini_p;
+make_frame (int mini_p)
 {
   Lisp_Object frame;
   register struct frame *f;
@@ -330,10 +316,13 @@ make_frame (mini_p)
   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;
@@ -433,10 +422,7 @@ make_frame (mini_p)
    default (the global minibuffer).  */
 
 struct frame *
-make_frame_without_minibuffer (mini_window, kb, display)
-     register Lisp_Object mini_window;
-     KBOARD *kb;
-     Lisp_Object display;
+make_frame_without_minibuffer (register Lisp_Object mini_window, KBOARD *kb, Lisp_Object display)
 {
   register struct frame *f;
   struct gcpro gcpro1;
@@ -485,7 +471,7 @@ make_frame_without_minibuffer (mini_window, kb, display)
 /* Make a frame containing only a minibuffer window.  */
 
 struct frame *
-make_minibuffer_frame ()
+make_minibuffer_frame (void)
 {
   /* First make a frame containing just a root window, no minibuffer.  */
 
@@ -562,6 +548,9 @@ make_initial_frame (void)
   FRAME_CAN_HAVE_SCROLL_BARS (f) = 0;
   FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none;
 
+  /* The default value of menu-bar-mode is t.  */
+  set_menu_bar_lines (f, make_number (1), Qnil);
+
 #ifdef CANNOT_DUMP
   if (!noninteractive)
     init_frame_faces (f);
@@ -611,6 +600,7 @@ make_terminal_frame (struct terminal *terminal)
 
   FRAME_CAN_HAVE_SCROLL_BARS (f) = 0;
   FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none;
+  FRAME_MENU_BAR_LINES(f) = NILP (Vmenu_bar_mode) ? 0 : 1;
 
   /* Set the top frame to the newly created frame. */
   if (FRAMEP (FRAME_TTY (f)->top_frame)
@@ -627,8 +617,7 @@ make_terminal_frame (struct terminal *terminal)
 
 /* Get a suitable value for frame parameter PARAMETER for a newly
    created frame, based on (1) the user-supplied frame parameter
-   alist SUPPLIED_PARMS, (2) CURRENT_VALUE, and finally, if all else
-   fails, (3) Vdefault_frame_alist.  */
+   alist SUPPLIED_PARMS, and (2) CURRENT_VALUE.  */
 
 static Lisp_Object
 get_future_frame_param (Lisp_Object parameter,
@@ -642,8 +631,6 @@ get_future_frame_param (Lisp_Object parameter,
     result = Fassq (parameter, XFRAME (selected_frame)->param_alist);
   if (NILP (result) && current_value != NULL)
     result = build_string (current_value);
-  if (NILP (result))
-    result = Fassq (parameter, Vdefault_frame_alist);
   if (!NILP (result) && !STRINGP (result))
     result = XCDR (result);
   if (NILP (result) || !STRINGP (result))
@@ -669,8 +656,7 @@ and the `tty-type' parameter specifies the terminal type.  Example:
 
 Note that changing the size of one terminal frame automatically
 affects all frames on the same terminal device.  */)
-     (parms)
-     Lisp_Object parms;
+  (Lisp_Object parms)
 {
   struct frame *f;
   struct terminal *t = NULL;
@@ -748,7 +734,6 @@ affects all frames on the same terminal device.  */)
   adjust_glyphs (f);
   calculate_costs (f);
   XSETFRAME (frame, f);
-  Fmodify_frame_parameters (frame, Vdefault_frame_alist);
   Fmodify_frame_parameters (frame, parms);
   Fmodify_frame_parameters (frame, Fcons (Fcons (Qtty_type,
                                                  build_string (t->display_info.tty->type)),
@@ -788,9 +773,7 @@ affects all frames on the same terminal device.  */)
    The value of NORECORD is passed as argument to Fselect_window.  */
 
 Lisp_Object
-do_switch_frame (frame, track, for_deletion, norecord)
-     Lisp_Object frame, norecord;
-     int track, for_deletion;
+do_switch_frame (Lisp_Object frame, int track, int for_deletion, Lisp_Object norecord)
 {
   struct frame *sf = SELECTED_FRAME ();
 
@@ -900,8 +883,7 @@ the window system's input focus.  On a text-only terminal, the
 next redisplay will display FRAME.
 
 This function returns FRAME, or nil if FRAME has been deleted.  */)
-     (frame, norecord)
-     Lisp_Object frame, norecord;
+  (Lisp_Object frame, Lisp_Object norecord)
 {
   return do_switch_frame (frame, 1, 0, norecord);
 }
@@ -916,8 +898,7 @@ This function selects the selected window of the frame of EVENT.
 
 If EVENT is frame object, handle it as if it were a switch-frame event
 to that frame.  */)
-     (event)
-     Lisp_Object event;
+  (Lisp_Object event)
 {
   /* Preserve prefix arg that the command loop just cleared.  */
   current_kboard->Vprefix_arg = Vcurrent_prefix_arg;
@@ -927,15 +908,14 @@ to that frame.  */)
 
 DEFUN ("selected-frame", Fselected_frame, Sselected_frame, 0, 0, 0,
        doc: /* Return the frame that is now selected.  */)
-     ()
+  (void)
 {
   return selected_frame;
 }
 \f
 DEFUN ("window-frame", Fwindow_frame, Swindow_frame, 1, 1, 0,
        doc: /* Return the frame object that window WINDOW is on.  */)
-     (window)
-     Lisp_Object window;
+  (Lisp_Object window)
 {
   CHECK_LIVE_WINDOW (window);
   return XWINDOW (window)->frame;
@@ -944,8 +924,7 @@ DEFUN ("window-frame", Fwindow_frame, Swindow_frame, 1, 1, 0,
 DEFUN ("frame-first-window", Fframe_first_window, Sframe_first_window, 0, 1, 0,
        doc: /* Returns the topmost, leftmost window of FRAME.
 If omitted, FRAME defaults to the currently selected frame.  */)
-     (frame)
-     Lisp_Object frame;
+  (Lisp_Object frame)
 {
   Lisp_Object w;
 
@@ -971,7 +950,7 @@ If omitted, FRAME defaults to the currently selected frame.  */)
 DEFUN ("active-minibuffer-window", Factive_minibuffer_window,
        Sactive_minibuffer_window, 0, 0, 0,
        doc: /* Return the currently active minibuffer window, or nil if none.  */)
-     ()
+  (void)
 {
   return minibuf_level ? minibuf_window : Qnil;
 }
@@ -979,8 +958,7 @@ DEFUN ("active-minibuffer-window", Factive_minibuffer_window,
 DEFUN ("frame-root-window", Fframe_root_window, Sframe_root_window, 0, 1, 0,
        doc: /* Returns the root-window of FRAME.
 If omitted, FRAME defaults to the currently selected frame.  */)
-     (frame)
-     Lisp_Object frame;
+  (Lisp_Object frame)
 {
   Lisp_Object window;
 
@@ -999,8 +977,7 @@ DEFUN ("frame-selected-window", Fframe_selected_window,
        Sframe_selected_window, 0, 1, 0,
        doc: /* Return the selected window of FRAME.
 FRAME defaults to the currently selected frame.  */)
-     (frame)
-     Lisp_Object frame;
+  (Lisp_Object frame)
 {
   Lisp_Object window;
 
@@ -1023,8 +1000,7 @@ selected frame, this makes WINDOW the selected window.
 Optional argument NORECORD non-nil means to neither change the
 order of recently selected windows nor the buffer list.
 Return WINDOW.  */)
-     (frame, window, norecord)
-     Lisp_Object frame, window, norecord;
+  (Lisp_Object frame, Lisp_Object window, Lisp_Object norecord)
 {
   if (NILP (frame))
     frame = selected_frame;
@@ -1045,7 +1021,7 @@ Return WINDOW.  */)
 DEFUN ("frame-list", Fframe_list, Sframe_list,
        0, 0, 0,
        doc: /* Return a list of all live frames.  */)
-     ()
+  (void)
 {
   Lisp_Object frames;
   frames = Fcopy_sequence (Vframe_list);
@@ -1065,9 +1041,7 @@ DEFUN ("frame-list", Fframe_list, Sframe_list,
    Otherwise, include all frames.  */
 
 static Lisp_Object
-next_frame (frame, minibuf)
-     Lisp_Object frame;
-     Lisp_Object minibuf;
+next_frame (Lisp_Object frame, Lisp_Object minibuf)
 {
   Lisp_Object tail;
   int passed = 0;
@@ -1145,9 +1119,7 @@ next_frame (frame, minibuf)
    Otherwise, include all frames.  */
 
 static Lisp_Object
-prev_frame (frame, minibuf)
-     Lisp_Object frame;
-     Lisp_Object minibuf;
+prev_frame (Lisp_Object frame, Lisp_Object minibuf)
 {
   Lisp_Object tail;
   Lisp_Object prev;
@@ -1230,8 +1202,7 @@ and any frame now using that window as the minibuffer.
 If MINIFRAME is `visible', include all visible frames.
 If MINIFRAME is 0, include all visible and iconified frames.
 Otherwise, include all frames.  */)
-     (frame, miniframe)
-     Lisp_Object frame, miniframe;
+  (Lisp_Object frame, Lisp_Object miniframe)
 {
   if (NILP (frame))
     frame = selected_frame;
@@ -1251,8 +1222,7 @@ and any frame now using that window as the minibuffer.
 If MINIFRAME is `visible', include all visible frames.
 If MINIFRAME is 0, include all visible and iconified frames.
 Otherwise, include all frames.  */)
-     (frame, miniframe)
-     Lisp_Object frame, miniframe;
+  (Lisp_Object frame, Lisp_Object miniframe)
 {
   if (NILP (frame))
     frame = selected_frame;
@@ -1265,8 +1235,7 @@ Otherwise, include all frames.  */)
    (Exception: if F is the terminal frame, and we are using X, return 1.)  */
 
 int
-other_visible_frames (f)
-     FRAME_PTR f;
+other_visible_frames (FRAME_PTR f)
 {
   /* We know the selected frame is visible,
      so if F is some other frame, it can't be the sole visible one.  */
@@ -1305,26 +1274,16 @@ other_visible_frames (f)
   return 1;
 }
 
-/* Error handler for `delete-frame-functions'. */
-static Lisp_Object
-delete_frame_handler (Lisp_Object arg)
-{
-  add_to_log ("Error during `delete-frame': %s", arg, Qnil);
-  return Qnil;
-}
-
-extern Lisp_Object Qrun_hook_with_args;
-
 /* Delete FRAME.  When FORCE equals Qnoelisp, delete FRAME
   unconditionally.  x_connection_closed and delete_terminal use
   this.  Any other value of FORCE implements the semantics
   described for Fdelete_frame.  */
 Lisp_Object
-delete_frame (frame, force)
+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.  */
-     Lisp_Object frame, force;
+
 {
   struct frame *f;
   struct frame *sf = SELECTED_FRAME ();
@@ -1653,8 +1612,7 @@ but if the second optional argument FORCE is non-nil, you may do so.
 This function runs `delete-frame-functions' before actually
 deleting the frame, unless the frame is a tooltip.
 The functions are run with one argument, the frame to be deleted.  */)
-     (frame, force)
-     Lisp_Object frame, force;
+  (Lisp_Object frame, Lisp_Object force)
 {
   return delete_frame (frame, !NILP (force) ? Qt : Qnil);
 }
@@ -1673,7 +1631,7 @@ and nil for X and Y.
 If `mouse-position-function' is non-nil, `mouse-position' calls it,
 passing the normal return value to that function as an argument,
 and returns whatever that function returns.  */)
-     ()
+  (void)
 {
   FRAME_PTR f;
   Lisp_Object lispy_dummy;
@@ -1719,7 +1677,7 @@ the vertical offset.
 If Emacs is running on a mouseless terminal or hasn't been programmed
 to read the mouse position, it returns the selected frame for FRAME
 and nil for X and Y.  */)
-     ()
+  (void)
 {
   FRAME_PTR f;
   Lisp_Object lispy_dummy;
@@ -1756,8 +1714,7 @@ This function is a no-op for an X frame that is not visible.
 If you have just created a frame, you must wait for it to become visible
 before calling this function on it, like this.
   (while (not (frame-visible-p frame)) (sleep-for .5))  */)
-  (frame, x, y)
-     Lisp_Object frame, x, y;
+  (Lisp_Object frame, Lisp_Object x, Lisp_Object y)
 {
   CHECK_LIVE_FRAME (frame);
   CHECK_NUMBER (x);
@@ -1798,8 +1755,7 @@ Note, this is a no-op for an X frame that is not visible.
 If you have just created a frame, you must wait for it to become visible
 before calling this function on it, like this.
   (while (not (frame-visible-p frame)) (sleep-for .5))  */)
-  (frame, x, y)
-     Lisp_Object frame, x, y;
+  (Lisp_Object frame, Lisp_Object x, Lisp_Object y)
 {
   CHECK_LIVE_FRAME (frame);
   CHECK_NUMBER (x);
@@ -1830,14 +1786,13 @@ before calling this function on it, like this.
   return Qnil;
 }
 \f
-static void make_frame_visible_1 P_ ((Lisp_Object));
+static void make_frame_visible_1 (Lisp_Object);
 
 DEFUN ("make-frame-visible", Fmake_frame_visible, Smake_frame_visible,
        0, 1, "",
        doc: /* Make the frame FRAME visible (assuming it is an X window).
 If omitted, FRAME defaults to the currently selected frame.  */)
-     (frame)
-     Lisp_Object frame;
+  (Lisp_Object frame)
 {
   if (NILP (frame))
     frame = selected_frame;
@@ -1865,8 +1820,7 @@ If omitted, FRAME defaults to the currently selected frame.  */)
    and all its descendents.  */
 
 static void
-make_frame_visible_1 (window)
-     Lisp_Object window;
+make_frame_visible_1 (Lisp_Object window)
 {
   struct window *w;
 
@@ -1897,8 +1851,7 @@ 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
 displayed in the terminal.  */)
-  (frame, force)
-     Lisp_Object frame, force;
+  (Lisp_Object frame, Lisp_Object force)
 {
   if (NILP (frame))
     frame = selected_frame;
@@ -1939,8 +1892,7 @@ DEFUN ("iconify-frame", Ficonify_frame, Siconify_frame,
        0, 1, "",
        doc: /* Make the frame FRAME into an icon.
 If omitted, FRAME defaults to the currently selected frame.  */)
-  (frame)
-     Lisp_Object frame;
+  (Lisp_Object frame)
 {
   if (NILP (frame))
     frame = selected_frame;
@@ -1985,8 +1937,7 @@ usually not displayed at all, even in a window system's \"taskbar\".
 If FRAME is a text-only terminal frame, this always returns t.
 Such frames are always considered visible, whether or not they are
 currently being displayed on the terminal.  */)
-     (frame)
-     Lisp_Object frame;
+  (Lisp_Object frame)
 {
   CHECK_LIVE_FRAME (frame);
 
@@ -2002,7 +1953,7 @@ currently being displayed on the terminal.  */)
 DEFUN ("visible-frame-list", Fvisible_frame_list, Svisible_frame_list,
        0, 0, 0,
        doc: /* Return a list of all frames now \"visible\" (being updated).  */)
-  ()
+  (void)
 {
   Lisp_Object tail, frame;
   struct frame *f;
@@ -2028,8 +1979,7 @@ If FRAME is invisible or iconified, make it visible.
 If you don't specify a frame, the selected frame is used.
 If Emacs is displaying on an ordinary terminal or some other device which
 doesn't support multiple overlapping frames, this function selects FRAME.  */)
-     (frame)
-     Lisp_Object frame;
+  (Lisp_Object frame)
 {
   struct frame *f;
   if (NILP (frame))
@@ -2058,8 +2008,7 @@ DEFUN ("lower-frame", Flower_frame, Slower_frame, 0, 1, "",
 If you don't specify a frame, the selected frame is used.
 If Emacs is displaying on an ordinary terminal or some other device which
 doesn't support multiple overlapping frames, this function does nothing.  */)
-     (frame)
-     Lisp_Object frame;
+  (Lisp_Object frame)
 {
   struct frame *f;
 
@@ -2102,8 +2051,7 @@ differently from a frame whose focus is redirected to nil; the former
 is affected by `select-frame', while the latter is not.
 
 The redirection lasts until `redirect-frame-focus' is called to change it.  */)
-     (frame, focus_frame)
-     Lisp_Object frame, focus_frame;
+  (Lisp_Object frame, Lisp_Object focus_frame)
 {
   struct frame *f;
 
@@ -2130,8 +2078,7 @@ DEFUN ("frame-focus", Fframe_focus, Sframe_focus, 1, 1, 0,
        doc: /* Return the frame to which FRAME's keystrokes are currently being sent.
 This returns nil if FRAME's focus is not redirected.
 See `redirect-frame-focus'.  */)
-     (frame)
-     Lisp_Object frame;
+  (Lisp_Object frame)
 {
   CHECK_LIVE_FRAME (frame);
 
@@ -2143,9 +2090,7 @@ See `redirect-frame-focus'.  */)
 /* Return the value of frame parameter PROP in frame FRAME.  */
 
 Lisp_Object
-get_frame_param (frame, prop)
-     register struct frame *frame;
-     Lisp_Object prop;
+get_frame_param (register struct frame *frame, Lisp_Object prop)
 {
   register Lisp_Object tem;
 
@@ -2158,8 +2103,7 @@ get_frame_param (frame, prop)
 /* Return the buffer-predicate of the selected frame.  */
 
 Lisp_Object
-frame_buffer_predicate (frame)
-     Lisp_Object frame;
+frame_buffer_predicate (Lisp_Object frame)
 {
   return XFRAME (frame)->buffer_predicate;
 }
@@ -2167,8 +2111,7 @@ frame_buffer_predicate (frame)
 /* Return the buffer-list of the selected frame.  */
 
 Lisp_Object
-frame_buffer_list (frame)
-     Lisp_Object frame;
+frame_buffer_list (Lisp_Object frame)
 {
   return XFRAME (frame)->buffer_list;
 }
@@ -2176,8 +2119,7 @@ frame_buffer_list (frame)
 /* Set the buffer-list of the selected frame.  */
 
 void
-set_frame_buffer_list (frame, list)
-     Lisp_Object frame, list;
+set_frame_buffer_list (Lisp_Object frame, Lisp_Object list)
 {
   XFRAME (frame)->buffer_list = list;
 }
@@ -2185,8 +2127,7 @@ set_frame_buffer_list (frame, list)
 /* Discard BUFFER from the buffer-list and buried-buffer-list of each frame.  */
 
 void
-frames_discard_buffer (buffer)
-     Lisp_Object buffer;
+frames_discard_buffer (Lisp_Object buffer)
 {
   Lisp_Object frame, tail;
 
@@ -2203,9 +2144,7 @@ frames_discard_buffer (buffer)
    If the alist already has an element for PROP, we change it.  */
 
 void
-store_in_alist (alistptr, prop, val)
-     Lisp_Object *alistptr, val;
-     Lisp_Object prop;
+store_in_alist (Lisp_Object *alistptr, Lisp_Object prop, Lisp_Object val)
 {
   register Lisp_Object tem;
 
@@ -2217,9 +2156,7 @@ store_in_alist (alistptr, prop, val)
 }
 
 static int
-frame_name_fnn_p (str, len)
-     char *str;
-     EMACS_INT len;
+frame_name_fnn_p (char *str, EMACS_INT len)
 {
   if (len > 1 && str[0] == 'F')
     {
@@ -2237,9 +2174,7 @@ frame_name_fnn_p (str, len)
    Modeled after x_set_name which is used for WINDOW frames.  */
 
 static void
-set_term_frame_name (f, name)
-     struct frame *f;
-     Lisp_Object name;
+set_term_frame_name (struct frame *f, Lisp_Object name)
 {
   f->explicit_name = ! NILP (name);
 
@@ -2277,9 +2212,7 @@ set_term_frame_name (f, name)
 }
 
 void
-store_frame_param (f, prop, val)
-     struct frame *f;
-     Lisp_Object prop, val;
+store_frame_param (struct frame *f, Lisp_Object prop, Lisp_Object val)
 {
   register Lisp_Object old_alist_elt;
 
@@ -2302,13 +2235,20 @@ store_frame_param (f, prop, val)
      without messing up the symbol's status.  */
   if (SYMBOLP (prop))
     {
-      Lisp_Object valcontents;
-      valcontents = SYMBOL_VALUE (prop);
-      if ((BUFFER_LOCAL_VALUEP (valcontents))
-         && XBUFFER_LOCAL_VALUE (valcontents)->check_frame
-         && XBUFFER_LOCAL_VALUE (valcontents)->found_for_frame
-         && XFRAME (XBUFFER_LOCAL_VALUE (valcontents)->frame) == f)
-       swap_in_global_binding (prop);
+      struct Lisp_Symbol *sym = XSYMBOL (prop);
+    start:
+      switch (sym->redirect)
+       {
+       case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start;
+       case SYMBOL_PLAINVAL: case SYMBOL_FORWARDED: break;
+       case SYMBOL_LOCALIZED:
+         { struct Lisp_Buffer_Local_Value *blv = sym->val.blv;
+           if (blv->frame_local && BLV_FOUND (blv) && XFRAME (blv->where) == f)
+             swap_in_global_binding (sym);
+           break;
+         }
+       default: abort ();
+       }
     }
 
   /* The tty color needed to be set before the frame's parameter
@@ -2359,8 +2299,7 @@ DEFUN ("frame-parameters", Fframe_parameters, Sframe_parameters, 0, 1, 0,
 It is a list of elements of the form (PARM . VALUE), where PARM is a symbol.
 The meaningful PARMs depend on the kind of frame.
 If FRAME is omitted, return information on the currently selected frame.  */)
-     (frame)
-     Lisp_Object frame;
+  (Lisp_Object frame)
 {
   Lisp_Object alist;
   FRAME_PTR f;
@@ -2457,8 +2396,7 @@ If FRAME is omitted, return information on the currently selected frame.  */)
 DEFUN ("frame-parameter", Fframe_parameter, Sframe_parameter, 2, 2, 0,
        doc: /* Return FRAME's value for parameter PARAMETER.
 If FRAME is nil, describe the currently selected frame.  */)
-     (frame, parameter)
-     Lisp_Object frame, parameter;
+  (Lisp_Object frame, Lisp_Object parameter)
 {
   struct frame *f;
   Lisp_Object value;
@@ -2524,6 +2462,8 @@ If FRAME is nil, describe the currently selected frame.  */)
               || EQ (parameter, Qbackground_mode))
        value = Fcdr (Fassq (parameter, f->param_alist));
       else
+       /* FIXME: Avoid this code path at all (as well as code duplication)
+          by sharing more code with Fframe_parameters.  */
        value = Fcdr (Fassq (parameter, Fframe_parameters (frame)));
     }
 
@@ -2546,8 +2486,7 @@ as a frame-local binding for the variable FOO, if you have
 enabled such bindings for that variable with `make-variable-frame-local'.
 Note that this functionality is obsolete as of Emacs 22.2, and its
 use is not recommended.  Explicitly check for a frame-parameter instead.  */)
-     (frame, alist)
-     Lisp_Object frame, alist;
+  (Lisp_Object frame, Lisp_Object alist)
 {
   FRAME_PTR f;
   register Lisp_Object tail, prop, val;
@@ -2612,8 +2551,7 @@ DEFUN ("frame-char-height", Fframe_char_height, Sframe_char_height,
        doc: /* Height in pixels of a line in the font in frame FRAME.
 If FRAME is omitted, the selected frame is used.
 For a terminal frame, the value is always 1.  */)
-  (frame)
-     Lisp_Object frame;
+  (Lisp_Object frame)
 {
   struct frame *f;
 
@@ -2637,8 +2575,7 @@ DEFUN ("frame-char-width", Fframe_char_width, Sframe_char_width,
 If FRAME is omitted, the selected frame is used.
 On a graphical screen, the width is the standard width of the default font.
 For a terminal screen, the value is always 1.  */)
-     (frame)
-     Lisp_Object frame;
+  (Lisp_Object frame)
 {
   struct frame *f;
 
@@ -2674,8 +2611,7 @@ and menu bar.
 For a text-only 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'). */)
-     (frame)
-     Lisp_Object frame;
+  (Lisp_Object frame)
 {
   struct frame *f;
 
@@ -2697,8 +2633,7 @@ DEFUN ("frame-pixel-width", Fframe_pixel_width,
        doc: /* Return FRAME's width in pixels.
 For a terminal frame, the result really gives the width in characters.
 If FRAME is omitted, the selected frame is used.  */)
-     (frame)
-     Lisp_Object frame;
+  (Lisp_Object frame)
 {
   struct frame *f;
 
@@ -2719,8 +2654,7 @@ DEFUN ("set-frame-height", Fset_frame_height, Sset_frame_height, 2, 3, 0,
        doc: /* Specify that the frame FRAME has LINES lines.
 Optional third arg non-nil means that redisplay should use LINES lines
 but that the idea of the actual height of the frame should not be changed.  */)
-     (frame, lines, pretend)
-     Lisp_Object frame, lines, pretend;
+  (Lisp_Object frame, Lisp_Object lines, Lisp_Object pretend)
 {
   register struct frame *f;
 
@@ -2748,8 +2682,7 @@ DEFUN ("set-frame-width", Fset_frame_width, Sset_frame_width, 2, 3, 0,
        doc: /* Specify that the frame FRAME has COLS columns.
 Optional third arg non-nil means that redisplay should use COLS columns
 but that the idea of the actual width of the frame should not be changed.  */)
-     (frame, cols, pretend)
-     Lisp_Object frame, cols, pretend;
+  (Lisp_Object frame, Lisp_Object cols, Lisp_Object pretend)
 {
   register struct frame *f;
   CHECK_NUMBER (cols);
@@ -2774,8 +2707,7 @@ but that the idea of the actual width of the frame should not be changed.  */)
 
 DEFUN ("set-frame-size", Fset_frame_size, Sset_frame_size, 3, 3, 0,
        doc: /* Sets size of FRAME to COLS by ROWS, measured in characters.  */)
-     (frame, cols, rows)
-     Lisp_Object frame, cols, rows;
+  (Lisp_Object frame, Lisp_Object cols, Lisp_Object rows)
 {
   register struct frame *f;
 
@@ -2807,8 +2739,7 @@ DEFUN ("set-frame-position", Fset_frame_position,
 This is actually the position of the upper left corner of the frame.
 Negative values for XOFFSET or YOFFSET are interpreted relative to
 the rightmost or bottommost possible position (that stays within the screen).  */)
-     (frame, xoffset, yoffset)
-     Lisp_Object frame, xoffset, yoffset;
+  (Lisp_Object frame, Lisp_Object xoffset, Lisp_Object yoffset)
 {
   register struct frame *f;
 
@@ -2839,11 +2770,11 @@ the rightmost or bottommost possible position (that stays within the screen).  *
    that is an index in this table.  */
 
 struct frame_parm_table {
-  char *name;
+  const char *name;
   Lisp_Object *variable;
 };
 
-static struct frame_parm_table frame_parms[] =
+static const struct frame_parm_table frame_parms[] =
 {
   {"auto-raise",               &Qauto_raise},
   {"auto-lower",               &Qauto_lower},
@@ -2877,13 +2808,11 @@ static struct frame_parm_table frame_parms[] =
   {"font-backend",             &Qfont_backend},
   {"alpha",                    &Qalpha},
   {"sticky",                   &Qsticky},
+  {"tool-bar-position",                &Qtool_bar_position},
 };
 
 #ifdef HAVE_WINDOW_SYSTEM
 
-extern Lisp_Object Qbox;
-extern Lisp_Object Qtop;
-
 /* Calculate fullscreen size.  Return in *TOP_POS and *LEFT_POS the
    wanted positions of the WM window (not Emacs window).
    Return in *WIDTH and *HEIGHT the wanted width and height of Emacs
@@ -2891,12 +2820,7 @@ extern Lisp_Object Qtop;
  */
 
 void
-x_fullscreen_adjust (f, width, height, top_pos, left_pos)
-     struct frame *f;
-     int *width;
-     int *height;
-     int *top_pos;
-     int *left_pos;
+x_fullscreen_adjust (struct frame *f, int *width, int *height, int *top_pos, int *left_pos)
 {
   int newwidth = FRAME_COLS (f);
   int newheight = FRAME_LINES (f);
@@ -2939,9 +2863,7 @@ x_fullscreen_adjust (f, width, height, top_pos, left_pos)
    to store the new value in the parameter alist.  */
 
 void
-x_set_frame_parameters (f, alist)
-     FRAME_PTR f;
-     Lisp_Object alist;
+x_set_frame_parameters (FRAME_PTR f, Lisp_Object alist)
 {
   Lisp_Object tail;
 
@@ -3215,9 +3137,7 @@ x_set_frame_parameters (f, alist)
    param_alist need to be considered here.  */
 
 void
-x_report_frame_params (f, alistptr)
-     struct frame *f;
-     Lisp_Object *alistptr;
+x_report_frame_params (struct frame *f, Lisp_Object *alistptr)
 {
   char buf[16];
   Lisp_Object tem;
@@ -3279,6 +3199,7 @@ x_report_frame_params (f, alistptr)
     XSETFASTINT (tem, FRAME_X_OUTPUT (f)->parent_desc);
   store_in_alist (alistptr, Qexplicit_name, (f->explicit_name ? Qt : Qnil));
   store_in_alist (alistptr, Qparent_id, tem);
+  store_in_alist (alistptr, Qtool_bar_position, f->tool_bar_position);
 }
 
 
@@ -3286,9 +3207,7 @@ x_report_frame_params (f, alistptr)
    the previous value of that parameter, NEW_VALUE is the new value. */
 
 void
-x_set_fullscreen (f, new_value, old_value)
-     struct frame *f;
-     Lisp_Object new_value, old_value;
+x_set_fullscreen (struct frame *f, Lisp_Object new_value, Lisp_Object old_value)
 {
   if (NILP (new_value))
     f->want_fullscreen = FULLSCREEN_NONE;
@@ -3310,9 +3229,7 @@ x_set_fullscreen (f, new_value, old_value)
    the previous value of that parameter, NEW_VALUE is the new value.  */
 
 void
-x_set_line_spacing (f, new_value, old_value)
-     struct frame *f;
-     Lisp_Object new_value, old_value;
+x_set_line_spacing (struct frame *f, Lisp_Object new_value, Lisp_Object old_value)
 {
   if (NILP (new_value))
     f->extra_line_spacing = 0;
@@ -3329,9 +3246,7 @@ x_set_line_spacing (f, new_value, old_value)
    the previous value of that parameter, NEW_VALUE is the new value.  */
 
 void
-x_set_screen_gamma (f, new_value, old_value)
-     struct frame *f;
-     Lisp_Object new_value, old_value;
+x_set_screen_gamma (struct frame *f, Lisp_Object new_value, Lisp_Object old_value)
 {
   Lisp_Object bgcolor;
 
@@ -3361,9 +3276,7 @@ x_set_screen_gamma (f, new_value, old_value)
 
 
 void
-x_set_font (f, arg, oldval)
-     struct frame *f;
-     Lisp_Object arg, oldval;
+x_set_font (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
 {
   Lisp_Object frame, font_object, font_param = Qnil;
   int fontset = -1;
@@ -3460,9 +3373,7 @@ x_set_font (f, arg, oldval)
 
 
 void
-x_set_font_backend (f, new_value, old_value)
-     struct frame *f;
-     Lisp_Object new_value, old_value;
+x_set_font_backend (struct frame *f, Lisp_Object new_value, Lisp_Object old_value)
 {
   if (! NILP (new_value)
       && !CONSP (new_value))
@@ -3518,17 +3429,18 @@ x_set_font_backend (f, new_value, old_value)
 
 
 void
-x_set_fringe_width (f, new_value, old_value)
-     struct frame *f;
-     Lisp_Object new_value, old_value;
+x_set_fringe_width (struct frame *f, Lisp_Object new_value, Lisp_Object old_value)
 {
   compute_fringe_widths (f, 1);
+#ifdef HAVE_X_WINDOWS
+  /* Must adjust this so window managers report correct number of columns.  */
+  if (FRAME_X_WINDOW (f) != 0)
+    x_wm_set_size_hint (f, 0, 0);
+#endif
 }
 
 void
-x_set_border_width (f, arg, oldval)
-     struct frame *f;
-     Lisp_Object arg, oldval;
+x_set_border_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
 {
   CHECK_NUMBER (arg);
 
@@ -3542,9 +3454,7 @@ x_set_border_width (f, arg, oldval)
 }
 
 void
-x_set_internal_border_width (f, arg, oldval)
-     struct frame *f;
-     Lisp_Object arg, oldval;
+x_set_internal_border_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
 {
   int old = FRAME_INTERNAL_BORDER_WIDTH (f);
 
@@ -3572,9 +3482,7 @@ x_set_internal_border_width (f, arg, oldval)
 }
 
 void
-x_set_visibility (f, value, oldval)
-     struct frame *f;
-     Lisp_Object value, oldval;
+x_set_visibility (struct frame *f, Lisp_Object value, Lisp_Object oldval)
 {
   Lisp_Object frame;
   XSETFRAME (frame, f);
@@ -3588,33 +3496,25 @@ x_set_visibility (f, value, oldval)
 }
 
 void
-x_set_autoraise (f, arg, oldval)
-     struct frame *f;
-     Lisp_Object arg, oldval;
+x_set_autoraise (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
 {
   f->auto_raise = !EQ (Qnil, arg);
 }
 
 void
-x_set_autolower (f, arg, oldval)
-     struct frame *f;
-     Lisp_Object arg, oldval;
+x_set_autolower (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
 {
   f->auto_lower = !EQ (Qnil, arg);
 }
 
 void
-x_set_unsplittable (f, arg, oldval)
-     struct frame *f;
-     Lisp_Object arg, oldval;
+x_set_unsplittable (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
 {
   f->no_split = !NILP (arg);
 }
 
 void
-x_set_vertical_scroll_bars (f, arg, oldval)
-     struct frame *f;
-     Lisp_Object arg, oldval;
+x_set_vertical_scroll_bars (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
 {
   if ((EQ (arg, Qleft) && FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f))
       || (EQ (arg, Qright) && FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f))
@@ -3645,9 +3545,7 @@ x_set_vertical_scroll_bars (f, arg, oldval)
 }
 
 void
-x_set_scroll_bar_width (f, arg, oldval)
-     struct frame *f;
-     Lisp_Object arg, oldval;
+x_set_scroll_bar_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
 {
   int wid = FRAME_COLUMN_WIDTH (f);
 
@@ -3682,8 +3580,7 @@ x_set_scroll_bar_width (f, arg, oldval)
 /* Return non-nil if frame F wants a bitmap icon.  */
 
 Lisp_Object
-x_icon_type (f)
-     FRAME_PTR f;
+x_icon_type (FRAME_PTR f)
 {
   Lisp_Object tem;
 
@@ -3695,9 +3592,7 @@ x_icon_type (f)
 }
 
 void
-x_set_alpha (f, arg, oldval)
-     struct frame *f;
-     Lisp_Object arg, oldval;
+x_set_alpha (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
 {
   double alpha = 1.0;
   double newval[2];
@@ -3755,7 +3650,7 @@ x_set_alpha (f, arg, oldval)
    Fix it up, or set it to `emacs' if it is too hopeless.  */
 
 void
-validate_x_resource_name ()
+validate_x_resource_name (void)
 {
   int len = 0;
   /* Number of valid characters in the resource name.  */
@@ -3771,7 +3666,6 @@ validate_x_resource_name ()
   if (STRINGP (Vx_resource_name))
     {
       unsigned char *p = SDATA (Vx_resource_name);
-      int i;
 
       len = SBYTES (Vx_resource_name);
 
@@ -3822,17 +3716,15 @@ validate_x_resource_name ()
 }
 
 
-extern char *x_get_string_resource P_ ((XrmDatabase, char *, char *));
-extern Display_Info *check_x_display_info P_ ((Lisp_Object));
+extern char *x_get_string_resource (XrmDatabase, const char *, const char *);
+extern Display_Info *check_x_display_info (Lisp_Object);
 
 
 /* Get specified attribute from resource database RDB.
    See Fx_get_resource below for other parameters.  */
 
 static Lisp_Object
-xrdb_get_resource (rdb, attribute, class, component, subclass)
-     XrmDatabase rdb;
-     Lisp_Object attribute, class, component, subclass;
+xrdb_get_resource (XrmDatabase rdb, Lisp_Object attribute, Lisp_Object class, Lisp_Object component, Lisp_Object subclass)
 {
   register char *value;
   char *name_key;
@@ -3903,8 +3795,7 @@ The optional arguments COMPONENT and SUBCLASS add to the key and the
 class, respectively.  You must specify both of them or neither.
 If you specify them, the key is `INSTANCE.COMPONENT.ATTRIBUTE'
 and the class is `Emacs.CLASS.SUBCLASS'.  */)
-     (attribute, class, component, subclass)
-     Lisp_Object attribute, class, component, subclass;
+  (Lisp_Object attribute, Lisp_Object class, Lisp_Object component, Lisp_Object subclass)
 {
 #ifdef HAVE_X_WINDOWS
   check_x ();
@@ -3917,9 +3808,7 @@ and the class is `Emacs.CLASS.SUBCLASS'.  */)
 /* Get an X resource, like Fx_get_resource, but for display DPYINFO.  */
 
 Lisp_Object
-display_x_get_resource (dpyinfo, attribute, class, component, subclass)
-     Display_Info *dpyinfo;
-     Lisp_Object attribute, class, component, subclass;
+display_x_get_resource (Display_Info *dpyinfo, Lisp_Object attribute, Lisp_Object class, Lisp_Object component, Lisp_Object subclass)
 {
   return xrdb_get_resource (dpyinfo->xrdb,
                            attribute, class, component, subclass);
@@ -3929,8 +3818,7 @@ display_x_get_resource (dpyinfo, attribute, class, component, subclass)
 /* Used when C code wants a resource value.  */
 /* Called from oldXMenu/Create.c.  */
 char *
-x_get_resource_string (attribute, class)
-     char *attribute, *class;
+x_get_resource_string (const char *attribute, const char *class)
 {
   char *name_key;
   char *class_key;
@@ -3963,12 +3851,8 @@ x_get_resource_string (attribute, class)
    and don't let it get stored in any Lisp-visible variables!  */
 
 Lisp_Object
-x_get_arg (dpyinfo, alist, param, attribute, class, type)
-     Display_Info *dpyinfo;
-     Lisp_Object alist, param;
-     char *attribute;
-     char *class;
-     enum resource_types type;
+x_get_arg (Display_Info *dpyinfo, Lisp_Object alist, Lisp_Object param,
+          const char *attribute, const char *class, enum resource_types type)
 {
   register Lisp_Object tem;
 
@@ -4066,12 +3950,9 @@ x_get_arg (dpyinfo, alist, param, attribute, class, type)
 }
 
 Lisp_Object
-x_frame_get_arg (f, alist, param, attribute, class, type)
-     struct frame *f;
-     Lisp_Object alist, param;
-     char *attribute;
-     char *class;
-     enum resource_types type;
+x_frame_get_arg (struct frame *f, Lisp_Object alist, Lisp_Object param,
+                const char *attribute, const char *class,
+                enum resource_types type)
 {
   return x_get_arg (FRAME_X_DISPLAY_INFO (f),
                    alist, param, attribute, class, type);
@@ -4080,12 +3961,10 @@ x_frame_get_arg (f, alist, param, attribute, class, type)
 /* Like x_frame_get_arg, but also record the value in f->param_alist.  */
 
 Lisp_Object
-x_frame_get_and_record_arg (f, alist, param, attribute, class, type)
-     struct frame *f;
-     Lisp_Object alist, param;
-     char *attribute;
-     char *class;
-     enum resource_types type;
+x_frame_get_and_record_arg (struct frame *f, Lisp_Object alist,
+                           Lisp_Object param,
+                           const char *attribute, const char *class,
+                           enum resource_types type)
 {
   Lisp_Object value;
 
@@ -4105,14 +3984,9 @@ x_frame_get_and_record_arg (f, alist, param, attribute, class, type)
    If that is not found either, use the value DEFLT.  */
 
 Lisp_Object
-x_default_parameter (f, alist, prop, deflt, xprop, xclass, type)
-     struct frame *f;
-     Lisp_Object alist;
-     Lisp_Object prop;
-     Lisp_Object deflt;
-     char *xprop;
-     char *xclass;
-     enum resource_types type;
+x_default_parameter (struct frame *f, Lisp_Object alist, Lisp_Object prop,
+                    Lisp_Object deflt, const char *xprop, const char *xclass,
+                    enum resource_types type)
 {
   Lisp_Object tem;
 
@@ -4142,8 +4016,7 @@ For X, the value of `left' or `top' may be an integer,
 or a list (+ N) meaning N pixels relative to top/left corner,
 or a list (- N) meaning -N pixels relative to bottom/right corner.
 On Nextstep, this just calls `ns-parse-geometry'.  */)
-     (string)
-     Lisp_Object string;
+  (Lisp_Object string)
 {
 #ifdef HAVE_NS
   call1 (Qns_parse_geometry, string);
@@ -4206,10 +4079,7 @@ On Nextstep, this just calls `ns-parse-geometry'.  */)
 #define DEFAULT_COLS 80
 
 int
-x_figure_window_size (f, parms, toolbar_p)
-     struct frame *f;
-     Lisp_Object parms;
-     int toolbar_p;
+x_figure_window_size (struct frame *f, Lisp_Object parms, int toolbar_p)
 {
   register Lisp_Object tem0, tem1, tem2;
   long window_prompting = 0;
@@ -4384,7 +4254,7 @@ x_figure_window_size (f, parms, toolbar_p)
 #endif /* HAVE_WINDOW_SYSTEM */
 
 void
-frame_make_pointer_invisible ()
+frame_make_pointer_invisible (void)
 {
   if (! NILP (Vmake_pointer_invisible))
     {
@@ -4404,7 +4274,7 @@ frame_make_pointer_invisible ()
 }
 
 void
-frame_make_pointer_visible ()
+frame_make_pointer_visible (void)
 {
   /* We don't check Vmake_pointer_invisible here in case the
      pointer was invisible when Vmake_pointer_invisible was set to nil.  */
@@ -4429,7 +4299,7 @@ frame_make_pointer_visible ()
  ***********************************************************************/
 
 void
-syms_of_frame ()
+syms_of_frame (void)
 {
   Qframep = intern_c_string ("framep");
   staticpro (&Qframep);
@@ -4597,8 +4467,9 @@ Setting this variable does not affect existing frames, only new ones.  */);
   DEFVAR_LISP ("default-frame-scroll-bars", &Vdefault_frame_scroll_bars,
               doc: /* Default position of scroll bars on this window-system.  */);
 #ifdef HAVE_WINDOW_SYSTEM
-#if defined(HAVE_NTGUI) || defined(NS_IMPL_COCOA)
-  /* MS-Windows and Mac OS X have scroll bars on the right by default.  */
+#if defined(HAVE_NTGUI) || defined(NS_IMPL_COCOA) || (defined(USE_GTK) && defined(USE_TOOLKIT_SCROLL_BARS))
+  /* MS-Windows, Mac OS X, and GTK have scroll bars on the right by
+     default.  */
   Vdefault_frame_scroll_bars = Qright;
 #else
   Vdefault_frame_scroll_bars = Qleft;
@@ -4644,6 +4515,14 @@ recursively).  */);
   Qdelete_frame_functions = intern_c_string ("delete-frame-functions");
   staticpro (&Qdelete_frame_functions);
 
+  DEFVAR_LISP ("menu-bar-mode", &Vmenu_bar_mode,
+               doc: /* Non-nil if Menu-Bar mode is enabled.  */);
+  Vmenu_bar_mode = Qt;
+
+  DEFVAR_LISP ("tool-bar-mode", &Vtool_bar_mode,
+               doc: /* Non-nil if Tool-Bar mode is enabled.  */);
+  Vtool_bar_mode = Qt;
+
   DEFVAR_KBOARD ("default-minibuffer-frame", Vdefault_minibuffer_frame,
                 doc: /* Minibufferless frames use this frame's minibuffer.
 
index 887d47eff21daec8289d7a4f1ac1dad4a8d487d5..6b307c7c3b149f6d44b833c10458031dbd361039 100644 (file)
@@ -191,6 +191,10 @@ struct frame
   /* Desired and current tool-bar items.  */
   Lisp_Object tool_bar_items;
 
+  /* Where tool bar is, can be left, right, top or bottom.  The native
+     tool bar only supports top.  */
+  Lisp_Object tool_bar_position;
+
   /* Desired and current contents displayed in tool_bar_window.  */
   Lisp_Object desired_tool_bar_string, current_tool_bar_string;
 
@@ -823,24 +827,25 @@ typedef struct frame *FRAME_PTR;
 
 extern Lisp_Object Qframep, Qframe_live_p;
 extern Lisp_Object Qtty, Qtty_type;
+extern Lisp_Object Qtty_color_mode;
 extern Lisp_Object Qterminal, Qterminal_live_p;
 extern Lisp_Object Qnoelisp;
 
 extern struct frame *last_nonminibuf_frame;
 
-extern struct frame *make_initial_frame P_ ((void));
-extern struct frame *make_terminal_frame P_ ((struct terminal *));
-extern struct frame *make_frame P_ ((int));
+extern struct frame *make_initial_frame (void);
+extern struct frame *make_terminal_frame (struct terminal *);
+extern struct frame *make_frame (int);
 #ifdef HAVE_WINDOW_SYSTEM
-extern struct frame *make_minibuffer_frame P_ ((void));
-extern struct frame *make_frame_without_minibuffer P_ ((Lisp_Object,
-                                                       struct kboard *,
-                                                       Lisp_Object));
+extern struct frame *make_minibuffer_frame (void);
+extern struct frame *make_frame_without_minibuffer (Lisp_Object,
+                                                    struct kboard *,
+                                                    Lisp_Object);
 #endif /* HAVE_WINDOW_SYSTEM */
-extern int other_visible_frames P_ ((struct frame *));
-extern void frame_make_pointer_invisible P_ ((void));
-extern void frame_make_pointer_visible P_ ((void));
-extern Lisp_Object delete_frame P_ ((Lisp_Object, Lisp_Object));
+extern int other_visible_frames (struct frame *);
+extern void frame_make_pointer_invisible (void);
+extern void frame_make_pointer_visible (void);
+extern Lisp_Object delete_frame (Lisp_Object, Lisp_Object);
 
 extern Lisp_Object Vframe_list;
 extern Lisp_Object Vdefault_frame_alist;
@@ -1044,7 +1049,8 @@ extern Lisp_Object Qfont;
 extern Lisp_Object Qbackground_color, Qforeground_color;
 extern Lisp_Object Qicon, Qicon_name, Qicon_type, Qicon_left, Qicon_top;
 extern Lisp_Object Qinternal_border_width;
-extern Lisp_Object Qmenu_bar_lines, Qtool_bar_lines;
+extern Lisp_Object Qtooltip;
+extern Lisp_Object Qmenu_bar_lines, Qtool_bar_lines, Qtool_bar_position;
 extern Lisp_Object Qmouse_color;
 extern Lisp_Object Qname, Qtitle;
 extern Lisp_Object Qparent_id;
@@ -1063,7 +1069,6 @@ extern Lisp_Object Qalpha;
 extern Lisp_Object Qleft_fringe, Qright_fringe;
 extern Lisp_Object Qheight, Qwidth;
 extern Lisp_Object Qminibuffer, Qmodeline;
-extern Lisp_Object Qonly;
 extern Lisp_Object Qx, Qw32, Qmac, Qpc, Qns;
 extern Lisp_Object Qvisible;
 extern Lisp_Object Qdisplay_type;
@@ -1071,9 +1076,11 @@ extern Lisp_Object Qbackground_mode;
 
 extern Lisp_Object Qx_resource_name;
 
-extern Lisp_Object Qleft, Qright, Qtop, Qbox;
+extern Lisp_Object Qleft, Qright, Qtop, Qbox, Qbottom;
 extern Lisp_Object Qdisplay;
 
+extern Lisp_Object Qrun_hook_with_args;
+
 #ifdef HAVE_WINDOW_SYSTEM
 
 /* The class of this X application.  */
@@ -1081,52 +1088,53 @@ extern Lisp_Object Qdisplay;
 
 /* These are in xterm.c, w32term.c, etc.  */
 
-extern void x_set_scroll_bar_default_width P_ ((struct frame *));
-extern void x_set_offset P_ ((struct frame *, int, int, int));
-extern void x_wm_set_icon_position P_ ((struct frame *, int, int));
+extern void x_set_scroll_bar_default_width (struct frame *);
+extern void x_set_offset (struct frame *, int, int, int);
+extern void x_wm_set_icon_position (struct frame *, int, int);
 
-extern Lisp_Object x_new_font P_ ((struct frame *, Lisp_Object, int));
+extern Lisp_Object x_new_font (struct frame *, Lisp_Object, int);
 
 /* These are in frame.c  */
 
 extern Lisp_Object Vx_resource_name;
 extern Lisp_Object Vx_resource_class;
+extern Lisp_Object Vmenu_bar_mode, Vtool_bar_mode;
 
 
 extern Lisp_Object Qface_set_after_frame_default;
 
-extern void x_fullscreen_adjust P_ ((struct frame *f, int *, int *,
-                                    int *, int *));
-
-extern void x_set_frame_parameters P_ ((struct frame *, Lisp_Object));
-extern void x_report_frame_params P_ ((struct frame *, Lisp_Object *));
-
-extern void x_set_fullscreen P_ ((struct frame *, Lisp_Object, Lisp_Object));
-extern void x_set_line_spacing P_ ((struct frame *, Lisp_Object, Lisp_Object));
-extern void x_set_screen_gamma P_ ((struct frame *, Lisp_Object, Lisp_Object));
-extern void x_set_font P_ ((struct frame *, Lisp_Object, Lisp_Object));
-extern void x_set_font_backend P_ ((struct frame *, Lisp_Object, Lisp_Object));
-extern void x_set_fringe_width P_ ((struct frame *, Lisp_Object, Lisp_Object));
-extern void x_set_border_width P_ ((struct frame *, Lisp_Object, Lisp_Object));
-extern void x_set_internal_border_width P_ ((struct frame *, Lisp_Object,
-                                            Lisp_Object));
-extern void x_set_visibility P_ ((struct frame *, Lisp_Object, Lisp_Object));
-extern void x_set_autoraise P_ ((struct frame *, Lisp_Object, Lisp_Object));
-extern void x_set_autolower P_ ((struct frame *, Lisp_Object, Lisp_Object));
-extern void x_set_unsplittable P_ ((struct frame *, Lisp_Object, Lisp_Object));
-extern void x_set_vertical_scroll_bars P_ ((struct frame *, Lisp_Object,
-                                           Lisp_Object));
-extern void x_set_scroll_bar_width P_ ((struct frame *, Lisp_Object,
-                                       Lisp_Object));
-
-extern Lisp_Object x_icon_type P_ ((struct frame *));
-
-extern int x_figure_window_size P_ ((struct frame *, Lisp_Object, int));
+extern void x_fullscreen_adjust (struct frame *f, int *, int *,
+                                 int *, int *);
+
+extern void x_set_frame_parameters (struct frame *, Lisp_Object);
+extern void x_report_frame_params (struct frame *, Lisp_Object *);
+
+extern void x_set_fullscreen (struct frame *, Lisp_Object, Lisp_Object);
+extern void x_set_line_spacing (struct frame *, Lisp_Object, Lisp_Object);
+extern void x_set_screen_gamma (struct frame *, Lisp_Object, Lisp_Object);
+extern void x_set_font (struct frame *, Lisp_Object, Lisp_Object);
+extern void x_set_font_backend (struct frame *, Lisp_Object, Lisp_Object);
+extern void x_set_fringe_width (struct frame *, Lisp_Object, Lisp_Object);
+extern void x_set_border_width (struct frame *, Lisp_Object, Lisp_Object);
+extern void x_set_internal_border_width (struct frame *, Lisp_Object,
+                                         Lisp_Object);
+extern void x_set_visibility (struct frame *, Lisp_Object, Lisp_Object);
+extern void x_set_autoraise (struct frame *, Lisp_Object, Lisp_Object);
+extern void x_set_autolower (struct frame *, Lisp_Object, Lisp_Object);
+extern void x_set_unsplittable (struct frame *, Lisp_Object, Lisp_Object);
+extern void x_set_vertical_scroll_bars (struct frame *, Lisp_Object,
+                                        Lisp_Object);
+extern void x_set_scroll_bar_width (struct frame *, Lisp_Object,
+                                    Lisp_Object);
+
+extern Lisp_Object x_icon_type (struct frame *);
+
+extern int x_figure_window_size (struct frame *, Lisp_Object, int);
 
 extern Lisp_Object Vframe_alpha_lower_limit;
-extern void x_set_alpha P_ ((struct frame *, Lisp_Object, Lisp_Object));
+extern void x_set_alpha (struct frame *, Lisp_Object, Lisp_Object);
 
-extern void validate_x_resource_name P_ ((void));
+extern void validate_x_resource_name (void);
                                            
 extern Lisp_Object display_x_get_resource (Display_Info *,
                                           Lisp_Object attribute,
@@ -1134,6 +1142,9 @@ extern Lisp_Object display_x_get_resource (Display_Info *,
                                           Lisp_Object component,
                                           Lisp_Object subclass);
 
+/* In xmenu.c */
+extern void set_frame_menubar (FRAME_PTR, int, int);
+
 #endif /* HAVE_WINDOW_SYSTEM */
 
 #endif /* not EMACS_FRAME_H */
index 2425e236b98f940b30ccf6e454a5645bef01dc96..fce100b1463dee136bb3eb11295007958da153f4 100644 (file)
@@ -32,10 +32,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #ifdef HAVE_WINDOW_SYSTEM
 
-extern Lisp_Object Qfringe;
-extern Lisp_Object Qtop, Qbottom, Qcenter;
-extern Lisp_Object Qup, Qdown, Qleft, Qright;
-
 /* Non-nil means that newline may flow into the right fringe.  */
 
 Lisp_Object Voverflow_newline_into_fringe;
@@ -83,10 +79,8 @@ Lisp_Object Vfringe_bitmaps;
    must specify physical bitmap symbols.
 */
 
-extern Lisp_Object Qunknown;
 Lisp_Object Qtruncation, Qcontinuation, Qoverlay_arrow;
 Lisp_Object Qempty_line, Qtop_bottom;
-extern Lisp_Object Qbar, Qhbar, Qbox, Qhollow;
 Lisp_Object Qhollow_small;
 
 enum fringe_bitmap_align
@@ -490,8 +484,7 @@ int max_used_fringe_bitmap = MAX_STANDARD_FRINGE_BITMAPS;
    Return 0 if not a bitmap.  */
 
 int
-lookup_fringe_bitmap (bitmap)
-     Lisp_Object bitmap;
+lookup_fringe_bitmap (Lisp_Object bitmap)
 {
   int bn;
 
@@ -517,8 +510,7 @@ lookup_fringe_bitmap (bitmap)
    Return BN if not found in Vfringe_bitmaps.  */
 
 static Lisp_Object
-get_fringe_bitmap_name (bn)
-     int bn;
+get_fringe_bitmap_name (int bn)
 {
   Lisp_Object bitmaps;
   Lisp_Object num;
@@ -550,11 +542,7 @@ get_fringe_bitmap_name (bn)
 */
 
 static void
-draw_fringe_bitmap_1 (w, row, left_p, overlay, which)
-     struct window *w;
-     struct glyph_row *row;
-     int left_p, overlay;
-     int which;
+draw_fringe_bitmap_1 (struct window *w, struct glyph_row *row, int left_p, int overlay, int which)
 {
   struct frame *f = XFRAME (WINDOW_FRAME (w));
   struct draw_fringe_bitmap_params p;
@@ -585,11 +573,10 @@ draw_fringe_bitmap_1 (w, row, left_p, overlay, which)
 
   if (face_id == DEFAULT_FACE_ID)
     {
-      Lisp_Object face;
-
-      if ((face = fringe_faces[which], NILP (face))
-         || (face_id = lookup_derived_face (f, face, FRINGE_FACE_ID, 0),
-             face_id < 0))
+      Lisp_Object face = fringe_faces[which];
+      face_id = NILP (face) ? lookup_named_face (f, Qfringe, 0)
+       : lookup_derived_face (f, face, FRINGE_FACE_ID, 0);
+      if (face_id < 0)
        face_id = FRINGE_FACE_ID;
     }
 
@@ -684,9 +671,7 @@ draw_fringe_bitmap_1 (w, row, left_p, overlay, which)
 }
 
 static int
-get_logical_cursor_bitmap (w, cursor)
-     struct window *w;
-     Lisp_Object cursor;
+get_logical_cursor_bitmap (struct window *w, Lisp_Object cursor)
 {
   Lisp_Object cmap, bm = Qnil;
 
@@ -709,10 +694,7 @@ get_logical_cursor_bitmap (w, cursor)
 }
 
 static int
-get_logical_fringe_bitmap (w, bitmap, right_p, partial_p)
-     struct window *w;
-     Lisp_Object bitmap;
-     int right_p, partial_p;
+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;
@@ -812,14 +794,11 @@ get_logical_fringe_bitmap (w, bitmap, right_p, partial_p)
 
 
 void
-draw_fringe_bitmap (w, row, left_p)
-     struct window *w;
-     struct glyph_row *row;
-     int left_p;
+draw_fringe_bitmap (struct window *w, struct glyph_row *row, int left_p)
 {
   int overlay = 0;
 
-  if (!left_p && row->cursor_in_fringe_p)
+  if (left_p == row->reversed_p && row->cursor_in_fringe_p)
     {
       Lisp_Object cursor = Qnil;
 
@@ -851,7 +830,7 @@ draw_fringe_bitmap (w, row, left_p)
          int bm = get_logical_cursor_bitmap (w, cursor);
          if (bm != NO_FRINGE_BITMAP)
            {
-             draw_fringe_bitmap_1 (w, row, 0, 2, bm);
+             draw_fringe_bitmap_1 (w, row, left_p, 2, bm);
              overlay = EQ (cursor, Qbox) ? 3 : 1;
            }
        }
@@ -868,9 +847,7 @@ draw_fringe_bitmap (w, row, left_p)
    function with input blocked.  */
 
 void
-draw_row_fringe_bitmaps (w, row)
-     struct window *w;
-     struct glyph_row *row;
+draw_row_fringe_bitmaps (struct window *w, struct glyph_row *row)
 {
   xassert (interrupt_input_blocked);
 
@@ -898,9 +875,7 @@ draw_row_fringe_bitmaps (w, row)
 */
 
 int
-draw_window_fringes (w, no_fringe)
-     struct window *w;
-     int no_fringe;
+draw_window_fringes (struct window *w, int no_fringe)
 {
   struct glyph_row *row;
   int yb = window_text_bottom_y (w);
@@ -938,9 +913,7 @@ draw_window_fringes (w, no_fringe)
    If KEEP_CURRENT_P is 0, update current_matrix too.  */
 
 int
-update_window_fringes (w, keep_current_p)
-     struct window *w;
-     int keep_current_p;
+update_window_fringes (struct window *w, int keep_current_p)
 {
   struct glyph_row *row, *cur = 0;
   int yb = window_text_bottom_y (w);
@@ -1200,7 +1173,8 @@ update_window_fringes (w, keep_current_p)
          left = row->left_user_fringe_bitmap;
          left_face_id = row->left_user_fringe_face_id;
        }
-      else if (row->truncated_on_left_p)
+      else if ((!row->reversed_p && row->truncated_on_left_p)
+              || (row->reversed_p && row->truncated_on_right_p))
        left = LEFT_FRINGE(0, Qtruncation, 0);
       else if (row->indicate_bob_p && EQ (boundary_top, Qleft))
        {
@@ -1216,7 +1190,8 @@ update_window_fringes (w, keep_current_p)
          if (bot_ind_max_y >= 0)
            left_offset = bot_ind_max_y - (row->y + row->visible_height);
        }
-      else if (MATRIX_ROW_CONTINUATION_LINE_P (row))
+      else if ((!row->reversed_p && MATRIX_ROW_CONTINUATION_LINE_P (row))
+              || (row->reversed_p && row->continued_p))
        left = LEFT_FRINGE (4, Qcontinuation, 0);
       else if (row->indicate_empty_line_p && EQ (empty_pos, Qleft))
        left = LEFT_FRINGE (5, Qempty_line, 0);
@@ -1243,7 +1218,8 @@ update_window_fringes (w, keep_current_p)
          right = row->right_user_fringe_bitmap;
          right_face_id = row->right_user_fringe_face_id;
        }
-      else if (row->truncated_on_right_p)
+      else if ((!row->reversed_p && row->truncated_on_right_p)
+              || (row->reversed_p && row->truncated_on_left_p))
        right = RIGHT_FRINGE (0, Qtruncation, 0);
       else if (row->indicate_bob_p && EQ (boundary_top, Qright))
        {
@@ -1259,7 +1235,8 @@ update_window_fringes (w, keep_current_p)
          if (bot_ind_max_y >= 0)
            right_offset = bot_ind_max_y - (row->y + row->visible_height);
        }
-      else if (row->continued_p)
+      else if ((!row->reversed_p && row->continued_p)
+              || (row->reversed_p && MATRIX_ROW_CONTINUATION_LINE_P (row)))
        right = RIGHT_FRINGE (4, Qcontinuation, 0);
       else if (row->indicate_top_line_p && EQ (arrow_top, Qright))
        {
@@ -1337,9 +1314,7 @@ update_window_fringes (w, keep_current_p)
 */
 
 void
-compute_fringe_widths (f, redraw)
-     struct frame *f;
-     int redraw;
+compute_fringe_widths (struct frame *f, int redraw)
 {
   int o_left = FRAME_LEFT_FRINGE_WIDTH (f);
   int o_right = FRAME_RIGHT_FRINGE_WIDTH (f);
@@ -1421,8 +1396,7 @@ compute_fringe_widths (f, redraw)
 /* Free resources used by a user-defined bitmap.  */
 
 void
-destroy_fringe_bitmap (n)
-     int n;
+destroy_fringe_bitmap (int n)
 {
   struct fringe_bitmap **fbp;
 
@@ -1449,8 +1423,7 @@ DEFUN ("destroy-fringe-bitmap", Fdestroy_fringe_bitmap, Sdestroy_fringe_bitmap,
        1, 1, 0,
        doc: /* Destroy fringe bitmap BITMAP.
 If BITMAP overrides a standard fringe bitmap, the original bitmap is restored.  */)
-  (bitmap)
-     Lisp_Object bitmap;
+  (Lisp_Object bitmap)
 {
   int n;
 
@@ -1491,10 +1464,7 @@ static const unsigned char swap_nibble[16] = {
 #endif                          /* HAVE_X_WINDOWS */
 
 void
-init_fringe_bitmap (which, fb, once_p)
-     int which;
-     struct fringe_bitmap *fb;
-     int once_p;
+init_fringe_bitmap (int which, struct fringe_bitmap *fb, int once_p)
 {
   if (once_p || fb->dynamic)
     {
@@ -1524,7 +1494,7 @@ init_fringe_bitmap (which, fb, once_p)
                                   | (swap_nibble[(b>>8) & 0xf] << 4)
                                   | (swap_nibble[(b>>12) & 0xf]));
              b >>= (16 - fb->width);
-#ifdef WORDS_BIG_ENDIAN
+#ifdef WORDS_BIGENDIAN
              b = ((b >> 8) | (b << 8));
 #endif
              *bits++ = b;
@@ -1564,8 +1534,7 @@ is used; the default is to center the bitmap.  Fifth arg may also be a
 list (ALIGN PERIODIC) where PERIODIC non-nil specifies that the bitmap
 should be repeated.
 If BITMAP already exists, the existing definition is replaced.  */)
-  (bitmap, bits, height, width, align)
-     Lisp_Object bitmap, bits, height, width, align;
+  (Lisp_Object bitmap, Lisp_Object bits, Lisp_Object height, Lisp_Object width, Lisp_Object align)
 {
   int n, h, i, j;
   unsigned short *b;
@@ -1669,7 +1638,7 @@ If BITMAP already exists, the existing definition is replaced.  */)
   xfb = (struct fringe_bitmap *) xmalloc (sizeof fb
                                          + fb.height * BYTES_PER_BITMAP_ROW);
   fb.bits = b = (unsigned short *) (xfb + 1);
-  bzero (b, fb.height);
+  memset (b, 0, fb.height);
 
   j = 0;
   while (j < fb.height)
@@ -1696,8 +1665,7 @@ DEFUN ("set-fringe-bitmap-face", Fset_fringe_bitmap_face, Sset_fringe_bitmap_fac
        1, 2, 0,
        doc: /* Set face for fringe bitmap BITMAP to FACE.
 If FACE is nil, reset face to default fringe face.  */)
-  (bitmap, face)
-     Lisp_Object bitmap, face;
+  (Lisp_Object bitmap, Lisp_Object face)
 {
   int n;
   int face_id;
@@ -1729,8 +1697,7 @@ is the symbol for the bitmap in the left fringe (or nil if no bitmap),
 RIGHT is similar for the right fringe, and OV is non-nil if there is an
 overlay arrow in the left fringe.
 Return nil if POS is not visible in WINDOW.  */)
-  (pos, window)
-     Lisp_Object pos, window;
+  (Lisp_Object pos, Lisp_Object window)
 {
   struct window *w;
   struct glyph_row *row;
@@ -1769,7 +1736,7 @@ Return nil if POS is not visible in WINDOW.  */)
  ***********************************************************************/
 
 void
-syms_of_fringe ()
+syms_of_fringe (void)
 {
   Qtruncation = intern_c_string ("truncation");
   staticpro (&Qtruncation);
@@ -1806,7 +1773,7 @@ If nil, also continue lines which are exactly as wide as the window.  */);
 /* Garbage collection hook */
 
 void
-mark_fringe_data ()
+mark_fringe_data (void)
 {
   int i;
 
@@ -1818,7 +1785,7 @@ mark_fringe_data ()
 /* Initialize this module when Emacs starts.  */
 
 void
-init_fringe_once ()
+init_fringe_once (void)
 {
   int bt;
 
@@ -1827,7 +1794,7 @@ init_fringe_once ()
 }
 
 void
-init_fringe ()
+init_fringe (void)
 {
   int i;
 
@@ -1863,7 +1830,7 @@ w32_init_fringe (struct redisplay_interface *rif)
 }
 
 void
-w32_reset_fringes ()
+w32_reset_fringes (void)
 {
   /* Destroy row bitmaps.  */
   int bt;
index 33a96143fd0b2561e5abe37c951999098dbe2d14..b99e50ca3ff58ea61d36be994d4cf6df54edb257 100644 (file)
@@ -80,27 +80,27 @@ enum ftfont_cache_for
     FTFONT_CACHE_FOR_ENTITY
   };
 
-static Lisp_Object ftfont_pattern_entity P_ ((FcPattern *, Lisp_Object));
+static Lisp_Object ftfont_pattern_entity (FcPattern *, Lisp_Object);
 
-static Lisp_Object ftfont_resolve_generic_family P_ ((Lisp_Object,
-                                                     FcPattern *));
-static Lisp_Object ftfont_lookup_cache P_ ((Lisp_Object,
-                                           enum ftfont_cache_for));
+static Lisp_Object ftfont_resolve_generic_family (Lisp_Object,
+                                                  FcPattern *);
+static Lisp_Object ftfont_lookup_cache (Lisp_Object,
+                                        enum ftfont_cache_for);
 
-static void ftfont_filter_properties P_ ((Lisp_Object font, Lisp_Object alist));
+static void ftfont_filter_properties (Lisp_Object font, Lisp_Object alist);
                                                 
-Lisp_Object ftfont_font_format P_ ((FcPattern *, Lisp_Object));
+Lisp_Object ftfont_font_format (FcPattern *, Lisp_Object);
 
 #define SYMBOL_FcChar8(SYM) (FcChar8 *) SDATA (SYMBOL_NAME (SYM))
 
 static struct
 {
   /* registry name */
-  char *name;
+  const char *name;
   /* characters to distinguish the charset from the others */
   int uniquifier[6];
   /* additional constraint by language */
-  char *lang;
+  const char *lang;
   /* set on demand */
   FcCharSet *fc_charset;
 } fc_charset_table[] =
@@ -144,8 +144,6 @@ static struct
     { NULL }
   };
 
-extern Lisp_Object Qc, Qm, Qp, Qd;
-
 /* Dirty hack for handing ADSTYLE property.
 
    Fontconfig (actually the underlying FreeType) gives such ADSTYLE
@@ -188,9 +186,7 @@ get_adstyle_property (FcPattern *p)
 }
 
 static Lisp_Object
-ftfont_pattern_entity (p, extra)
-     FcPattern *p;
-     Lisp_Object extra;
+ftfont_pattern_entity (FcPattern *p, Lisp_Object extra)
 {
   Lisp_Object key, cache, entity;
   char *file, *str;
@@ -289,9 +285,7 @@ ftfont_pattern_entity (p, extra)
 static Lisp_Object ftfont_generic_family_list;
 
 static Lisp_Object
-ftfont_resolve_generic_family (family, pattern)
-     Lisp_Object family;
-     FcPattern *pattern;
+ftfont_resolve_generic_family (Lisp_Object family, FcPattern *pattern)
 {
   Lisp_Object slot;
   FcPattern *match;
@@ -348,9 +342,7 @@ struct ftfont_cache_data
 };
 
 static Lisp_Object
-ftfont_lookup_cache (key, cache_for)
-     Lisp_Object key;
-     enum ftfont_cache_for cache_for;
+ftfont_lookup_cache (Lisp_Object key, enum ftfont_cache_for cache_for)
 {
   Lisp_Object cache, val, entity;
   struct ftfont_cache_data *cache_data;
@@ -450,8 +442,7 @@ ftfont_lookup_cache (key, cache_for)
 }
 
 FcCharSet *
-ftfont_get_fc_charset (entity)
-     Lisp_Object entity;
+ftfont_get_fc_charset (Lisp_Object entity)
 {
   Lisp_Object val, cache;
   struct ftfont_cache_data *cache_data;
@@ -464,8 +455,7 @@ ftfont_get_fc_charset (entity)
 
 #ifdef HAVE_LIBOTF
 static OTF *
-ftfont_get_otf (ftfont_info)
-     struct ftfont_info *ftfont_info;
+ftfont_get_otf (struct ftfont_info *ftfont_info)
 {
   OTF *otf;
 
@@ -486,26 +476,26 @@ ftfont_get_otf (ftfont_info)
 }
 #endif /* HAVE_LIBOTF */
 
-static Lisp_Object ftfont_get_cache P_ ((FRAME_PTR));
-static Lisp_Object ftfont_list P_ ((Lisp_Object, Lisp_Object));
-static Lisp_Object ftfont_match P_ ((Lisp_Object, Lisp_Object));
-static Lisp_Object ftfont_list_family P_ ((Lisp_Object));
-static Lisp_Object ftfont_open P_ ((FRAME_PTR, Lisp_Object, int));
-static void ftfont_close P_ ((FRAME_PTR, struct font *));
-static int ftfont_has_char P_ ((Lisp_Object, int));
-static unsigned ftfont_encode_char P_ ((struct font *, int));
-static int ftfont_text_extents P_ ((struct font *, unsigned *, int,
-                                   struct font_metrics *));
-static int ftfont_get_bitmap P_ ((struct font *, unsigned,
-                                 struct font_bitmap *, int));
-static int ftfont_anchor_point P_ ((struct font *, unsigned, int,
-                                   int *, int *));
-static Lisp_Object ftfont_otf_capability P_ ((struct font *));
-static Lisp_Object ftfont_shape P_ ((Lisp_Object));
+static Lisp_Object ftfont_get_cache (FRAME_PTR);
+static Lisp_Object ftfont_list (Lisp_Object, Lisp_Object);
+static Lisp_Object ftfont_match (Lisp_Object, Lisp_Object);
+static Lisp_Object ftfont_list_family (Lisp_Object);
+static Lisp_Object ftfont_open (FRAME_PTR, Lisp_Object, int);
+static void ftfont_close (FRAME_PTR, struct font *);
+static int ftfont_has_char (Lisp_Object, int);
+static unsigned ftfont_encode_char (struct font *, int);
+static int ftfont_text_extents (struct font *, unsigned *, int,
+                                struct font_metrics *);
+static int ftfont_get_bitmap (struct font *, unsigned,
+                              struct font_bitmap *, int);
+static int ftfont_anchor_point (struct font *, unsigned, int,
+                                int *, int *);
+static Lisp_Object ftfont_otf_capability (struct font *);
+static Lisp_Object ftfont_shape (Lisp_Object);
 
 #ifdef HAVE_OTF_GET_VARIATION_GLYPHS
-static int ftfont_variation_glyphs P_ ((struct font *, int c,
-                                       unsigned variations[256]));
+static int ftfont_variation_glyphs (struct font *, int c,
+                                    unsigned variations[256]);
 #endif /* HAVE_OTF_GET_VARIATION_GLYPHS */
 
 struct font_driver ftfont_driver =
@@ -556,18 +546,14 @@ struct font_driver ftfont_driver =
     ftfont_filter_properties, /* filter_properties */
   };
 
-extern Lisp_Object QCname;
-
 static Lisp_Object
-ftfont_get_cache (f)
-     FRAME_PTR f;
+ftfont_get_cache (FRAME_PTR f)
 {
   return freetype_font_cache;
 }
 
 static int
-ftfont_get_charset (registry)
-     Lisp_Object registry;
+ftfont_get_charset (Lisp_Object registry)
 {
   char *str = (char *) SDATA (SYMBOL_NAME (registry));
   char *re = alloca (SBYTES (SYMBOL_NAME (registry)) * 2 + 1);
@@ -705,16 +691,8 @@ ftfont_get_open_type_spec (Lisp_Object otf_spec)
   return spec;
 }
 
-static FcPattern *ftfont_spec_pattern P_ ((Lisp_Object, char *,
-                                          struct OpenTypeSpec **,
-                                          char **langname));
-
 static FcPattern *
-ftfont_spec_pattern (spec, otlayout, otspec, langname)
-     Lisp_Object spec;
-     char *otlayout;
-     struct OpenTypeSpec **otspec;
-     char **langname;
+ftfont_spec_pattern (Lisp_Object spec, char *otlayout, struct OpenTypeSpec **otspec, const char **langname)
 {
   Lisp_Object tmp, extra;
   FcPattern *pattern = NULL;
@@ -871,8 +849,7 @@ ftfont_spec_pattern (spec, otlayout, otspec, langname)
 }
 
 static Lisp_Object
-ftfont_list (frame, spec)
-     Lisp_Object frame, spec;
+ftfont_list (Lisp_Object frame, Lisp_Object spec)
 {
   Lisp_Object val = Qnil, family, adstyle;
   int i;
@@ -885,7 +862,7 @@ ftfont_list (frame, spec)
   char otlayout[15];           /* For "otlayout:XXXX" */
   struct OpenTypeSpec *otspec = NULL;
   int spacing = -1;
-  char *langname = NULL;
+  const char *langname = NULL;
 
   if (! fc_initialized)
     {
@@ -1069,15 +1046,14 @@ ftfont_list (frame, spec)
 }
 
 static Lisp_Object
-ftfont_match (frame, spec)
-     Lisp_Object frame, spec;
+ftfont_match (Lisp_Object frame, Lisp_Object spec)
 {
   Lisp_Object entity = Qnil;
   FcPattern *pattern, *match = NULL;
   FcResult result;
   char otlayout[15];           /* For "otlayout:XXXX" */
   struct OpenTypeSpec *otspec = NULL;
-  char *langname = NULL;
+  const char *langname = NULL;
 
   if (! fc_initialized)
     {
@@ -1120,8 +1096,7 @@ ftfont_match (frame, spec)
 }
 
 static Lisp_Object
-ftfont_list_family (frame)
-     Lisp_Object frame;
+ftfont_list_family (Lisp_Object frame)
 {
   Lisp_Object list = Qnil;
   FcPattern *pattern = NULL;
@@ -1164,10 +1139,7 @@ ftfont_list_family (frame)
 
 
 static Lisp_Object
-ftfont_open (f, entity, pixel_size)
-     FRAME_PTR f;
-     Lisp_Object entity;
-     int pixel_size;
+ftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
 {
   struct ftfont_info *ftfont_info;
   struct font *font;
@@ -1307,9 +1279,7 @@ ftfont_open (f, entity, pixel_size)
 }
 
 static void
-ftfont_close (f, font)
-     FRAME_PTR f;
-     struct font *font;
+ftfont_close (FRAME_PTR f, struct font *font)
 {
   struct ftfont_info *ftfont_info = (struct ftfont_info *) font;
   Lisp_Object val, cache;
@@ -1335,9 +1305,7 @@ ftfont_close (f, font)
 }
 
 static int
-ftfont_has_char (font, c)
-     Lisp_Object font;
-     int c;
+ftfont_has_char (Lisp_Object font, int c)
 {
   struct charset *cs = NULL;
 
@@ -1367,9 +1335,7 @@ ftfont_has_char (font, c)
 }
 
 static unsigned
-ftfont_encode_char (font, c)
-     struct font *font;
-     int c;
+ftfont_encode_char (struct font *font, int c)
 {
   struct ftfont_info *ftfont_info = (struct ftfont_info *) font;
   FT_Face ft_face = ftfont_info->ft_size->face;
@@ -1380,11 +1346,7 @@ ftfont_encode_char (font, c)
 }
 
 static int
-ftfont_text_extents (font, code, nglyphs, metrics)
-     struct font *font;
-     unsigned *code;
-     int nglyphs;
-     struct font_metrics *metrics;
+ftfont_text_extents (struct font *font, unsigned int *code, int nglyphs, struct font_metrics *metrics)
 {
   struct ftfont_info *ftfont_info = (struct ftfont_info *) font;
   FT_Face ft_face = ftfont_info->ft_size->face;
@@ -1394,7 +1356,7 @@ ftfont_text_extents (font, code, nglyphs, metrics)
   if (ftfont_info->ft_size != ft_face->size)
     FT_Activate_Size (ftfont_info->ft_size);
   if (metrics)
-    bzero (metrics, sizeof (struct font_metrics));
+    memset (metrics, 0, sizeof (struct font_metrics));
   for (i = 0, first = 1; i < nglyphs; i++)
     {
       if (FT_Load_Glyph (ft_face, code[i], FT_LOAD_DEFAULT) == 0)
@@ -1439,11 +1401,7 @@ ftfont_text_extents (font, code, nglyphs, metrics)
 }
 
 static int
-ftfont_get_bitmap (font, code, bitmap, bits_per_pixel)
-     struct font *font;
-     unsigned code;
-     struct font_bitmap *bitmap;
-     int bits_per_pixel;
+ftfont_get_bitmap (struct font *font, unsigned int code, struct font_bitmap *bitmap, int bits_per_pixel)
 {
   struct ftfont_info *ftfont_info = (struct ftfont_info *) font;
   FT_Face ft_face = ftfont_info->ft_size->face;
@@ -1487,11 +1445,7 @@ ftfont_get_bitmap (font, code, bitmap, bits_per_pixel)
 }
 
 static int
-ftfont_anchor_point (font, code, index, x, y)
-     struct font *font;
-     unsigned code;
-     int index;
-     int *x, *y;
+ftfont_anchor_point (struct font *font, unsigned int code, int index, int *x, int *y)
 {
   struct ftfont_info *ftfont_info = (struct ftfont_info *) font;
   FT_Face ft_face = ftfont_info->ft_size->face;
@@ -1512,8 +1466,7 @@ ftfont_anchor_point (font, code, index, x, y)
 #ifdef HAVE_LIBOTF
 
 static Lisp_Object
-ftfont_otf_features (gsub_gpos)
-     OTF_GSUB_GPOS *gsub_gpos;
+ftfont_otf_features (OTF_GSUB_GPOS *gsub_gpos)
 {
   Lisp_Object scripts, langsyses, features, sym;
   int i, j, k, l;
@@ -1557,8 +1510,7 @@ ftfont_otf_features (gsub_gpos)
 
 
 static Lisp_Object
-ftfont_otf_capability (font)
-     struct font *font;
+ftfont_otf_capability (struct font *font)
 {
   struct ftfont_info *ftfont_info = (struct ftfont_info *) font;
   OTF *otf = ftfont_get_otf (ftfont_info);
@@ -1596,10 +1548,8 @@ struct MFLTFontFT
 };
 
 static int
-ftfont_get_glyph_id (font, gstring, from, to)
-     MFLTFont *font;
-     MFLTGlyphString *gstring;
-     int from, to;
+ftfont_get_glyph_id (MFLTFont *font, MFLTGlyphString *gstring,
+                    int from, int to)
 {
   struct MFLTFontFT *flt_font_ft = (struct MFLTFontFT *) font;
   FT_Face ft_face = flt_font_ft->ft_face;
@@ -1623,10 +1573,8 @@ ftfont_get_glyph_id (font, gstring, from, to)
 #define ROUND(x)    (((x)+32) & -64)
 
 static int
-ftfont_get_metrics (font, gstring, from, to)
-     MFLTFont *font;
-     MFLTGlyphString *gstring;
-     int from, to;
+ftfont_get_metrics (MFLTFont *font, MFLTGlyphString *gstring,
+                   int from, int to)
 {
   struct MFLTFontFT *flt_font_ft = (struct MFLTFontFT *) font;
   FT_Face ft_face = flt_font_ft->ft_face;
@@ -2123,13 +2071,9 @@ ftfont_try_otf (MFLTFont *font, MFLTOtfSpec *spec,
 #else  /* not M17N_FLT_USE_NEW_FEATURE */
 
 static int
-ftfont_drive_otf (font, spec, in, from, to, out, adjustment)
-     MFLTFont *font;
-     MFLTOtfSpec *spec;
-     MFLTGlyphString *in;
-     int from, to;
-     MFLTGlyphString *out;
-     MFLTGlyphAdjustment *adjustment;
+ftfont_drive_otf (MFLTFont *font, MFLTOtfSpec *spec, MFLTGlyphString *in,
+                 int from, int to,
+                 MFLTGlyphString *out, MFLTGlyphAdjustment *adjustment)
 {
   struct MFLTFontFT *flt_font_ft = (struct MFLTFontFT *) font;
   FT_Face ft_face = flt_font_ft->ft_face;
@@ -2381,15 +2325,9 @@ static MFLTGlyphString gstring;
 
 static int m17n_flt_initialized;
 
-extern Lisp_Object QCfamily;
-
 static Lisp_Object
-ftfont_shape_by_flt (lgstring, font, ft_face, otf, matrix)
-     Lisp_Object lgstring;
-     struct font *font;
-     FT_Face ft_face;
-     OTF *otf;
-     FT_Matrix *matrix;
+ftfont_shape_by_flt (Lisp_Object lgstring, struct font *font,
+                    FT_Face ft_face, OTF *otf, FT_Matrix *matrix)
 {
   EMACS_UINT len = LGSTRING_GLYPH_LEN (lgstring);
   EMACS_UINT i;
@@ -2555,8 +2493,7 @@ ftfont_shape_by_flt (lgstring, font, ft_face, otf, matrix)
 }
 
 Lisp_Object
-ftfont_shape (lgstring)
-     Lisp_Object lgstring;
+ftfont_shape (Lisp_Object lgstring)
 {
   struct font *font;
   struct ftfont_info *ftfont_info;
@@ -2576,10 +2513,7 @@ ftfont_shape (lgstring)
 #ifdef HAVE_OTF_GET_VARIATION_GLYPHS
 
 static int
-ftfont_variation_glyphs (font, c, variations)
-     struct font *font;
-     int c;
-     unsigned variations[256];
+ftfont_variation_glyphs (struct font *font, int c, unsigned variations[256])
 {
   struct ftfont_info *ftfont_info = (struct ftfont_info *) font;
   OTF *otf = ftfont_get_otf (ftfont_info);
@@ -2677,9 +2611,7 @@ static const char *ftfont_non_booleans [] = {
 };
 
 static void
-ftfont_filter_properties (font, alist)
-     Lisp_Object font;
-     Lisp_Object alist;
+ftfont_filter_properties (Lisp_Object font, Lisp_Object alist)
 {
   Lisp_Object it;
   int i;
@@ -2694,7 +2626,7 @@ ftfont_filter_properties (font, alist)
 
         if (strcmp (ftfont_booleans[i], keystr) == 0)
           {
-            char *str = SYMBOLP (val) ? SDATA (SYMBOL_NAME (val)) : NULL;
+            const char *str = SYMBOLP (val) ? SDATA (SYMBOL_NAME (val)) : NULL;
             if (INTEGERP (val)) str = XINT (val) != 0 ? "true" : "false";
             if (str == NULL) str = "true";
 
@@ -2721,7 +2653,7 @@ ftfont_filter_properties (font, alist)
 
 
 void
-syms_of_ftfont ()
+syms_of_ftfont (void)
 {
   DEFSYM (Qfreetype, "freetype");
   DEFSYM (Qmonospace, "monospace");
index 7ad9b8a008c974fccb6189fd964a2210cefbc162..9053c9ce81defc1c695b10741600436ae15959d9 100644 (file)
@@ -36,6 +36,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #endif /* HAVE_M17N_FLT */
 #endif /* HAVE_LIBOTF */
 
+extern Lisp_Object ftfont_font_format (FcPattern *, Lisp_Object);
+extern FcCharSet *ftfont_get_fc_charset (Lisp_Object);
+
 #endif /* EMACS_FTFONT_H */
 
 /* arch-tag: cec13d1c-7156-4997-9ebd-e989040c3d78
index 847522a2f9c1ada14f797190252dd17f9034e564..0a9137617b890bff185ae070f069ac7755c57d9f 100644 (file)
@@ -39,12 +39,12 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 static Lisp_Object Qftx;
 
 /* Prototypes for helper function.  */
-static GC *ftxfont_get_gcs P_ ((FRAME_PTR, unsigned long, unsigned long));
-static int ftxfont_draw_bitmap P_ ((FRAME_PTR, GC, GC *, struct font *,
-                                   unsigned, int, int, XPoint *, int, int *,
-                                   int));
-static void ftxfont_draw_backgrond P_ ((FRAME_PTR, struct font *, GC,
-                                       int, int, int));
+static GC *ftxfont_get_gcs (FRAME_PTR, unsigned long, unsigned long);
+static int ftxfont_draw_bitmap (FRAME_PTR, GC, GC *, struct font *,
+                                unsigned, int, int, XPoint *, int, int *,
+                                int);
+static void ftxfont_draw_backgrond (FRAME_PTR, struct font *, GC,
+                                    int, int, int);
 
 struct ftxfont_frame_data
 {
@@ -61,9 +61,7 @@ struct ftxfont_frame_data
 /* Return an array of 6 GCs for antialiasing.  */
 
 static GC *
-ftxfont_get_gcs (f, foreground, background)
-     FRAME_PTR f;
-     unsigned long foreground, background;
+ftxfont_get_gcs (FRAME_PTR f, long unsigned int foreground, long unsigned int background)
 {
   XColor color;
   XGCValues xgcv;
@@ -140,15 +138,7 @@ ftxfont_get_gcs (f, foreground, background)
 }
 
 static int
-ftxfont_draw_bitmap (f, gc_fore, gcs, font, code, x, y, p, size, n, flush)
-     FRAME_PTR f;
-     GC gc_fore, *gcs;
-     struct font *font;
-     unsigned code;
-     int x, y;
-     XPoint *p;
-     int size, *n;
-     int flush;
+ftxfont_draw_bitmap (FRAME_PTR f, GC gc_fore, GC *gcs, struct font *font, unsigned int code, int x, int y, XPoint *p, int size, int *n, int flush)
 {
   struct font_bitmap bitmap;
   unsigned char *b;
@@ -224,11 +214,7 @@ ftxfont_draw_bitmap (f, gc_fore, gcs, font, code, x, y, p, size, n, flush)
 }
 
 static void
-ftxfont_draw_backgrond (f, font, gc, x, y, width)
-     FRAME_PTR f;
-     struct font *font;
-     GC gc;
-     int x, y, width;
+ftxfont_draw_backgrond (FRAME_PTR f, struct font *font, GC gc, int x, int y, int width)
 {
   XGCValues xgcv;
 
@@ -241,18 +227,16 @@ ftxfont_draw_backgrond (f, font, gc, x, y, width)
 }
 
 /* Prototypes for font-driver methods.  */
-static Lisp_Object ftxfont_list P_ ((Lisp_Object, Lisp_Object));
-static Lisp_Object ftxfont_match P_ ((Lisp_Object, Lisp_Object));
-static Lisp_Object ftxfont_open P_ ((FRAME_PTR, Lisp_Object, int));
-static void ftxfont_close P_ ((FRAME_PTR, struct font *));
-static int ftxfont_draw P_ ((struct glyph_string *, int, int, int, int, int));
+static Lisp_Object ftxfont_list (Lisp_Object, Lisp_Object);
+static Lisp_Object ftxfont_match (Lisp_Object, Lisp_Object);
+static Lisp_Object ftxfont_open (FRAME_PTR, Lisp_Object, int);
+static void ftxfont_close (FRAME_PTR, struct font *);
+static int ftxfont_draw (struct glyph_string *, int, int, int, int, int);
 
 struct font_driver ftxfont_driver;
 
 static Lisp_Object
-ftxfont_list (frame, spec)
-     Lisp_Object frame;
-     Lisp_Object spec;
+ftxfont_list (Lisp_Object frame, Lisp_Object spec)
 {
   Lisp_Object list = ftfont_driver.list (frame, spec), tail;
   
@@ -262,9 +246,7 @@ ftxfont_list (frame, spec)
 }
 
 static Lisp_Object
-ftxfont_match (frame, spec)
-     Lisp_Object frame;
-     Lisp_Object spec;
+ftxfont_match (Lisp_Object frame, Lisp_Object spec)
 {
   Lisp_Object entity = ftfont_driver.match (frame, spec);
 
@@ -274,10 +256,7 @@ ftxfont_match (frame, spec)
 }
 
 static Lisp_Object
-ftxfont_open (f, entity, pixel_size)
-     FRAME_PTR f;
-     Lisp_Object entity;
-     int pixel_size;
+ftxfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
 {
   Lisp_Object font_object;
   struct font *font;
@@ -291,17 +270,13 @@ ftxfont_open (f, entity, pixel_size)
 }
 
 static void
-ftxfont_close (f, font)
-     FRAME_PTR f;
-     struct font *font;
+ftxfont_close (FRAME_PTR f, struct font *font)
 {
   ftfont_driver.close (f, font);
 }
 
 static int
-ftxfont_draw (s, from, to, x, y, with_background)
-     struct glyph_string *s;
-     int from, to, x, y, with_background;
+ftxfont_draw (struct glyph_string *s, int from, int to, int x, int y, int with_background)
 {
   FRAME_PTR f = s->f;
   struct face *face = s->face;
@@ -372,8 +347,7 @@ ftxfont_draw (s, from, to, x, y, with_background)
 }
 
 static int
-ftxfont_end_for_frame (f)
-     FRAME_PTR f;
+ftxfont_end_for_frame (FRAME_PTR f)
 {
   struct ftxfont_frame_data *data = font_get_frame_data (f, &ftxfont_driver);
   
@@ -396,7 +370,7 @@ ftxfont_end_for_frame (f)
 \f
 
 void
-syms_of_ftxfont ()
+syms_of_ftxfont (void)
 {
   DEFSYM (Qftx, "ftx");
 
index a174fc07a01b15f4ecf1d0232f8d01b17db0aff2..779a0ef804c5e4dcb4b44787072007571e3dfc78 100644 (file)
@@ -713,7 +713,7 @@ getloadavg (loadavg, nelem)
       for (i = 0; i < conf.config_maxclass; ++i)
        {
          struct class_stats stats;
-         bzero ((char *) &stats, sizeof stats);
+         memset (&stats, 0, sizeof stats);
 
          desc.sd_type = CPUTYPE_CLASS;
          desc.sd_objid = i;
index f1be37ba348d91062128f34dfa67f55081503465..8314798b1710bf2aca4e650145bd9483da1205a6 100644 (file)
@@ -42,8 +42,7 @@ Fifth Floor, Boston, MA 02110-1301, USA.
 #endif
 
 #if ((defined __cplusplus || (defined (__STDC__) && __STDC__) \
-      || defined STDC_HEADERS || defined PROTOTYPES) \
-     && ! defined (BROKEN_PROTOTYPES))
+      || defined STDC_HEADERS || defined PROTOTYPES))
 #undef PP
 #define        PP(args)        args
 #undef __ptr_t
@@ -122,7 +121,7 @@ extern __ptr_t calloc PP ((__malloc_size_t __nmemb, __malloc_size_t __size));
 extern void free PP ((__ptr_t __ptr));
 
 /* Allocate SIZE bytes allocated to ALIGNMENT bytes.  */
-#if ! (defined (_MALLOC_INTERNAL) && __DJGPP__ - 0 == 1) /* Avoid conflict.  */
+#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,
@@ -1763,13 +1762,6 @@ Fifth Floor, Boston, MA 02110-1301, USA.  */
 #include <malloc.h>
 #endif
 
-#if __DJGPP__ - 0 == 1
-
-/* There is some problem with memalign in DJGPP v1 and we are supposed
-   to omit it.  Noone told me why, they just told me to do it.  */
-
-#else
-
 __ptr_t (*__memalign_hook) PP ((__malloc_size_t __size,
                                __malloc_size_t __alignment));
 
@@ -1878,7 +1870,6 @@ posix_memalign (memptr, alignment, size)
   return 0;
 }
 
-#endif /* Not DJGPP v1 */
 /* Allocate memory on a page boundary.
    Copyright (C) 1991, 92, 93, 94, 96 Free Software Foundation, Inc.
 
@@ -1978,12 +1969,12 @@ Fifth Floor, Boston, MA 02110-1301, USA.
 #endif
 
 /* Old hook values.  */
-static void (*old_free_hook) __P ((__ptr_t ptr));
-static __ptr_t (*old_malloc_hook) __P ((__malloc_size_t size));
-static __ptr_t (*old_realloc_hook) __P ((__ptr_t ptr, __malloc_size_t size));
+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);
 
 /* Function to call when something awful happens.  */
-static void (*abortfunc) __P ((enum mcheck_status));
+static void (*abortfunc) (enum mcheck_status);
 
 /* Arbitrary magical numbers.  */
 #define MAGICWORD      0xfedabeeb
@@ -2001,7 +1992,7 @@ struct hdr
 #if    defined(_LIBC) || defined(STDC_HEADERS) || defined(USG)
 #define flood memset
 #else
-static void flood __P ((__ptr_t, int, __malloc_size_t));
+static void flood (__ptr_t, int, __malloc_size_t);
 static void
 flood (ptr, val, size)
      __ptr_t ptr;
@@ -2014,7 +2005,7 @@ flood (ptr, val, size)
 }
 #endif
 
-static enum mcheck_status checkhdr __P ((const struct hdr *));
+static enum mcheck_status checkhdr (const struct hdr *);
 static enum mcheck_status
 checkhdr (hdr)
      const struct hdr *hdr;
@@ -2040,7 +2031,7 @@ checkhdr (hdr)
   return status;
 }
 
-static void freehook __P ((__ptr_t));
+static void freehook (__ptr_t);
 static void
 freehook (ptr)
      __ptr_t ptr;
@@ -2062,7 +2053,7 @@ freehook (ptr)
   __free_hook = freehook;
 }
 
-static __ptr_t mallochook __P ((__malloc_size_t));
+static __ptr_t mallochook (__malloc_size_t);
 static __ptr_t
 mallochook (size)
      __malloc_size_t size;
@@ -2082,7 +2073,7 @@ mallochook (size)
   return (__ptr_t) (hdr + 1);
 }
 
-static __ptr_t reallochook __P ((__ptr_t, __malloc_size_t));
+static __ptr_t reallochook (__ptr_t, __malloc_size_t);
 static __ptr_t
 reallochook (ptr, size)
      __ptr_t ptr;
@@ -2155,7 +2146,7 @@ static int mcheck_used = 0;
 
 int
 mcheck (func)
-     void (*func) __P ((enum mcheck_status));
+     void (*func) (enum mcheck_status);
 {
   abortfunc = (func != NULL) ? func : &mabort;
 
index 1a90aabc1c63b183818545dad0fd7baa3ee7a145..dbd48eb5272903b80cee9a57465f311dd719cff2 100644 (file)
@@ -35,6 +35,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "charset.h"
 #include "coding.h"
 #include <gdk/gdkkeysyms.h>
+#include "xsettings.h"
 
 #ifdef HAVE_XFT
 #include <X11/Xft/Xft.h>
@@ -43,16 +44,40 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #define FRAME_TOTAL_PIXEL_HEIGHT(f) \
   (FRAME_PIXEL_HEIGHT (f) + FRAME_MENUBAR_HEIGHT (f) + FRAME_TOOLBAR_HEIGHT (f))
 
+#define FRAME_TOTAL_PIXEL_WIDTH(f) \
+  (FRAME_PIXEL_WIDTH (f) + FRAME_TOOLBAR_WIDTH (f))
+
 /* Avoid "differ in sign" warnings */
 #define SSDATA(x)  ((char *) SDATA (x))
 
+#ifndef HAVE_GTK_WIDGET_SET_HAS_WINDOW
+#define gtk_widget_set_has_window(w, b) \
+  (gtk_fixed_set_has_window (GTK_FIXED (w), b))
+#endif
+#ifndef HAVE_GTK_DIALOG_GET_ACTION_AREA
+#define gtk_dialog_get_action_area(w) ((w)->action_area)
+#define gtk_dialog_get_content_area(w) ((w)->vbox)
+#endif
+#ifndef HAVE_GTK_WIDGET_GET_SENSITIVE
+#define gtk_widget_get_sensitive(w) (GTK_WIDGET_SENSITIVE (w))
+#endif
+#ifndef HAVE_GTK_ADJUSTMENT_GET_PAGE_SIZE
+#define gtk_adjustment_set_page_size(w, s) ((w)->page_size = (s))
+#define gtk_adjustment_set_page_increment(w, s) ((w)->page_increment = (s))
+#define gtk_adjustment_get_step_increment(w) ((w)->step_increment)
+#define gtk_adjustment_set_step_increment(w, s) ((w)->step_increment = (s))
+#endif
+#if GTK_MAJOR_VERSION > 2 || GTK_MINOR_VERSION > 11
+#define remove_submenu(w) gtk_menu_item_set_submenu ((w), NULL)
+#else
+#define remove_submenu(w) gtk_menu_item_remove_submenu ((w))
+#endif
+
 \f
 /***********************************************************************
                       Display handling functions
  ***********************************************************************/
 
-#ifdef HAVE_GTK_MULTIDISPLAY
-
 /* Keep track of the default display, or NULL if there is none.  Emacs
    may close all its displays.  */
 
@@ -63,9 +88,7 @@ static GdkDisplay *gdpy_def;
    W can be a GtkMenu or a GtkWindow widget.  */
 
 static void
-xg_set_screen (w, f)
-     GtkWidget *w;
-     FRAME_PTR f;
+xg_set_screen (GtkWidget *w, FRAME_PTR f)
 {
   if (FRAME_X_DISPLAY (f) != GDK_DISPLAY ())
     {
@@ -80,20 +103,6 @@ xg_set_screen (w, f)
 }
 
 
-#else /* not HAVE_GTK_MULTIDISPLAY */
-
-/* Make some defines so we can use the GTK 2.2 functions when
-   compiling with GTK 2.0.  */
-
-#define xg_set_screen(w, f)
-#define gdk_xid_table_lookup_for_display(dpy, w)    gdk_xid_table_lookup (w)
-#define gdk_pixmap_foreign_new_for_display(dpy, p)  gdk_pixmap_foreign_new (p)
-#define gdk_cursor_new_for_display(dpy, c)          gdk_cursor_new (c)
-#define gdk_x11_lookup_xdisplay(dpy)                0
-#define GdkDisplay                                  void
-
-#endif /* not HAVE_GTK_MULTIDISPLAY */
-
 /* Open a display named by DISPLAY_NAME.  The display is returned in *DPY.
    *DPY is set to NULL if the display can't be opened.
 
@@ -101,12 +110,9 @@ xg_set_screen (w, f)
    be opened, and less than zero if the GTK version doesn't support
    multipe displays.  */
 
-int
-xg_display_open (display_name, dpy)
-     char *display_name;
-     Display **dpy;
+void
+xg_display_open (char *display_name, Display **dpy)
 {
-#ifdef HAVE_GTK_MULTIDISPLAY
   GdkDisplay *gdpy;
 
   gdpy = gdk_display_open (display_name);
@@ -118,12 +124,6 @@ xg_display_open (display_name, dpy)
     }
 
   *dpy = gdpy ? GDK_DISPLAY_XDISPLAY (gdpy) : NULL;
-  return gdpy != NULL;
-
-#else /* not HAVE_GTK_MULTIDISPLAY */
-
-  return -1;
-#endif /* not HAVE_GTK_MULTIDISPLAY */
 }
 
 
@@ -132,7 +132,6 @@ xg_display_open (display_name, dpy)
 void
 xg_display_close (Display *dpy)
 {
-#ifdef HAVE_GTK_MULTIDISPLAY
   GdkDisplay *gdpy = gdk_x11_lookup_xdisplay (dpy);
 
   /* If this is the default display, try to change it before closing.
@@ -164,7 +163,6 @@ xg_display_close (Display *dpy)
   /* This seems to be fixed in GTK 2.10. */
   gdk_display_close (gdpy);
 #endif
-#endif /* HAVE_GTK_MULTIDISPLAY */
 }
 
 \f
@@ -181,7 +179,7 @@ static int malloc_cpt;
    Return a pointer to the allocated structure.  */
 
 widget_value *
-malloc_widget_value ()
+malloc_widget_value (void)
 {
   widget_value *wv;
   if (widget_value_free_list)
@@ -203,8 +201,7 @@ malloc_widget_value ()
    by malloc_widget_value, and no substructures.  */
 
 void
-free_widget_value (wv)
-     widget_value *wv;
+free_widget_value (widget_value *wv)
 {
   if (wv->free_list)
     abort ();
@@ -228,8 +225,7 @@ free_widget_value (wv)
    scroll bars on display DPY.  */
 
 GdkCursor *
-xg_create_default_cursor (dpy)
-     Display *dpy;
+xg_create_default_cursor (Display *dpy)
 {
   GdkDisplay *gdpy = gdk_x11_lookup_xdisplay (dpy);
   return gdk_cursor_new_for_display (gdpy, GDK_LEFT_PTR);
@@ -238,10 +234,9 @@ xg_create_default_cursor (dpy)
 /* Apply GMASK to GPIX and return a GdkPixbuf with an alpha channel.  */
 
 static GdkPixbuf *
-xg_get_pixbuf_from_pix_and_mask (gpix, gmask, cmap)
-     GdkPixmap *gpix;
-     GdkPixmap *gmask;
-     GdkColormap *cmap;
+xg_get_pixbuf_from_pix_and_mask (GdkPixmap *gpix,
+                                 GdkPixmap *gmask,
+                                 GdkColormap *cmap)
 {
   int width, height;
   GdkPixbuf *icon_buf, *tmp_buf;
@@ -292,12 +287,10 @@ xg_get_pixbuf_from_pix_and_mask (gpix, gmask, cmap)
 }
 
 static Lisp_Object
-file_for_image (image)
-     Lisp_Object image;
+file_for_image (Lisp_Object image)
 {
   Lisp_Object specified_file = Qnil;
   Lisp_Object tail;
-  extern Lisp_Object QCfile;
 
   for (tail = XCDR (image);
        NILP (specified_file) && CONSP (tail) && CONSP (XCDR (tail));
@@ -320,11 +313,10 @@ file_for_image (image)
    If OLD_WIDGET is not NULL, that widget is modified.  */
 
 static GtkWidget *
-xg_get_image_for_pixmap (f, img, widget, old_widget)
-     FRAME_PTR f;
-     struct image *img;
-     GtkWidget *widget;
-     GtkImage *old_widget;
+xg_get_image_for_pixmap (FRAME_PTR f,
+                         struct image *img,
+                         GtkWidget *widget,
+                         GtkImage *old_widget)
 {
   GdkPixmap *gpix;
   GdkPixmap *gmask;
@@ -392,13 +384,12 @@ xg_get_image_for_pixmap (f, img, widget, old_widget)
    and it is those widgets that are visible.  */
 
 static void
-xg_set_cursor (w, cursor)
-     GtkWidget *w;
-     GdkCursor *cursor;
+xg_set_cursor (GtkWidget *w, GdkCursor *cursor)
 {
-  GList *children = gdk_window_peek_children (w->window);
+  GdkWindow *window = gtk_widget_get_window(w);
+  GList *children = gdk_window_peek_children (window);
 
-  gdk_window_set_cursor (w->window, cursor);
+  gdk_window_set_cursor (window, cursor);
 
   /* The scroll bar widget has more than one GDK window (had to look at
      the source to figure this out), and there is no way to set cursor
@@ -441,21 +432,22 @@ xg_list_remove (xg_list_node *list, xg_list_node *node)
 }
 
 /* Allocate and return a utf8 version of STR.  If STR is already
-   utf8 or NULL, just return STR.
-   If not, a new string is allocated and the caller must free the result
+   utf8 or NULL, just return a copy of STR.
+   A new string is allocated and the caller must free the result
    with g_free.  */
 
 static char *
-get_utf8_string (str)
-     char *str;
+get_utf8_string (const char *str)
 {
-  char *utf8_str = str;
+  char *utf8_str;
 
   if (!str) return NULL;
 
   /* If not UTF-8, try current locale.  */
   if (!g_utf8_validate (str, -1, NULL))
     utf8_str = g_locale_to_utf8 (str, -1, 0, 0, 0);
+  else
+    return g_strdup (str);
 
   if (!utf8_str)
     {
@@ -514,6 +506,207 @@ get_utf8_string (str)
   return utf8_str;
 }
 
+/* Check for special colors used in face spec for region face.
+   The colors are fetched from the Gtk+ theme.
+   Return 1 if color was found, 0 if not.  */
+
+int
+xg_check_special_colors (struct frame *f,
+                         const char *color_name,
+                         XColor *color)
+{
+  int success_p = 0;
+  if (FRAME_GTK_WIDGET (f))
+    {
+      if (strcmp ("gtk_selection_bg_color", color_name) == 0)
+        {
+          GtkStyle *gsty = gtk_widget_get_style (FRAME_GTK_WIDGET (f));
+          color->red = gsty->bg[GTK_STATE_SELECTED].red;
+          color->green = gsty->bg[GTK_STATE_SELECTED].green;
+          color->blue = gsty->bg[GTK_STATE_SELECTED].blue;
+          color->pixel = gsty->bg[GTK_STATE_SELECTED].pixel;
+          success_p = 1;
+        }
+      else if (strcmp ("gtk_selection_fg_color", color_name) == 0)
+        {
+          GtkStyle *gsty = gtk_widget_get_style (FRAME_GTK_WIDGET (f));
+          color->red = gsty->fg[GTK_STATE_SELECTED].red;
+          color->green = gsty->fg[GTK_STATE_SELECTED].green;
+          color->blue = gsty->fg[GTK_STATE_SELECTED].blue;
+          color->pixel = gsty->fg[GTK_STATE_SELECTED].pixel;
+          success_p = 1;
+        }
+    }
+
+  return success_p;
+}
+
+
+\f
+/***********************************************************************
+                              Tooltips
+ ***********************************************************************/
+/* Gtk+ calls this callback when the parent of our tooltip dummy changes.
+   We use that to pop down the tooltip.  This happens if Gtk+ for some
+   reason wants to change or hide the tooltip.  */
+
+#ifdef USE_GTK_TOOLTIP
+
+static void
+hierarchy_ch_cb (GtkWidget *widget,
+                 GtkWidget *previous_toplevel,
+                 gpointer   user_data)
+{
+  FRAME_PTR f = (FRAME_PTR) user_data;
+  struct x_output *x = f->output_data.x;
+  GtkWidget *top = gtk_widget_get_toplevel (x->ttip_lbl);
+  
+  if (! top || ! GTK_IS_WINDOW (top))
+      gtk_widget_hide (previous_toplevel);
+}
+
+/* Callback called when Gtk+ thinks a tooltip should be displayed.
+   We use it to get the tooltip window and the tooltip widget so
+   we can manipulate the ourselves.
+
+   Return FALSE ensures that the tooltip is not shown.  */
+
+static gboolean
+qttip_cb (GtkWidget  *widget,
+          gint        xpos,
+          gint        ypos,
+          gboolean    keyboard_mode,
+          GtkTooltip *tooltip,
+          gpointer    user_data)
+{
+  FRAME_PTR f = (FRAME_PTR) user_data;
+  struct x_output *x = f->output_data.x;
+  if (x->ttip_widget == NULL) 
+    {
+      g_object_set (G_OBJECT (widget), "has-tooltip", FALSE, NULL);
+      x->ttip_widget = tooltip;
+      g_object_ref (G_OBJECT (tooltip));
+      x->ttip_lbl = gtk_label_new ("");
+      g_object_ref (G_OBJECT (x->ttip_lbl));
+      gtk_tooltip_set_custom (tooltip, x->ttip_lbl);
+      x->ttip_window = GTK_WINDOW (gtk_widget_get_toplevel (x->ttip_lbl));
+      /* Realize so we can safely get screen later on.  */
+      gtk_widget_realize (GTK_WIDGET (x->ttip_window));
+      gtk_widget_realize (x->ttip_lbl);
+
+      g_signal_connect (x->ttip_lbl, "hierarchy-changed",
+                        G_CALLBACK (hierarchy_ch_cb), f);
+    }
+  return FALSE;
+}
+
+#endif /* USE_GTK_TOOLTIP */
+
+/* Prepare a tooltip to be shown, i.e. calculate WIDTH and HEIGHT.
+   Return zero if no system tooltip available, non-zero otherwise.  */
+
+int
+xg_prepare_tooltip (FRAME_PTR f,
+                      Lisp_Object string,
+                      int *width,
+                    int *height)
+{
+#ifndef USE_GTK_TOOLTIP
+  return 0;
+#else
+  struct x_output *x = f->output_data.x;
+  GtkWidget *widget;
+  GdkWindow *gwin;
+  GdkScreen *screen;
+  GtkSettings *settings;
+  gboolean tt_enabled = TRUE;
+  GtkRequisition req;
+  Lisp_Object encoded_string;
+
+  if (!x->ttip_lbl) return 0;
+
+  BLOCK_INPUT;
+  encoded_string = ENCODE_UTF_8 (string);
+  widget = GTK_WIDGET (x->ttip_lbl);
+  gwin = gtk_widget_get_window (GTK_WIDGET (x->ttip_window));
+  screen = gdk_drawable_get_screen (gwin);
+  settings = gtk_settings_get_for_screen (screen);
+  g_object_get (settings, "gtk-enable-tooltips", &tt_enabled, NULL);
+  if (tt_enabled) 
+    {
+      g_object_set (settings, "gtk-enable-tooltips", FALSE, NULL);
+      /* Record that we disabled it so it can be enabled again.  */
+      g_object_set_data (G_OBJECT (x->ttip_window), "restore-tt",
+                         (gpointer)f);
+    }
+    
+  /* Prevent Gtk+ from hiding tooltip on mouse move and such.  */
+  g_object_set_data (G_OBJECT
+                     (gtk_widget_get_display (GTK_WIDGET (x->ttip_window))),
+                     "gdk-display-current-tooltip", NULL);
+
+  /* Put out dummy widget in so we can get callbacks for unrealize and
+     hierarchy-changed.  */
+  gtk_tooltip_set_custom (x->ttip_widget, widget);
+
+  gtk_tooltip_set_text (x->ttip_widget, SDATA (encoded_string));
+  gtk_widget_size_request (GTK_WIDGET (x->ttip_window), &req);
+  if (width) *width = req.width;
+  if (height) *height = req.height;
+  
+  UNBLOCK_INPUT;
+
+  return 1;
+#endif /* USE_GTK_TOOLTIP */
+}
+
+/* Show the tooltip at ROOT_X and ROOT_Y.
+   xg_prepare_tooltip must have been called before this function.  */
+
+void
+xg_show_tooltip (FRAME_PTR f, int root_x, int root_y)
+{
+#ifdef USE_GTK_TOOLTIP
+  struct x_output *x = f->output_data.x;
+  if (x->ttip_window)
+    {
+      BLOCK_INPUT;
+      gtk_window_move (x->ttip_window, root_x, root_y);
+      gtk_widget_show_all (GTK_WIDGET (x->ttip_window));
+      UNBLOCK_INPUT;
+    }
+#endif
+}
+
+/* Hide tooltip if shown.  Do nothing if not shown.
+   Return non-zero if tip was hidden, non-ero if not (i.e. not using
+   system tooltips).  */
+
+int
+xg_hide_tooltip (FRAME_PTR f)
+{
+  int ret = 0;
+#ifdef USE_GTK_TOOLTIP
+  if (f->output_data.x->ttip_window)
+    {
+      GtkWindow *win = f->output_data.x->ttip_window;
+      BLOCK_INPUT;
+      gtk_widget_hide (GTK_WIDGET (win));
+
+      if (g_object_get_data (G_OBJECT (win), "restore-tt"))
+        {
+          GdkWindow *gwin = gtk_widget_get_window (GTK_WIDGET (win));
+          GdkScreen *screen = gdk_drawable_get_screen (gwin);
+          GtkSettings *settings = gtk_settings_get_for_screen (screen);
+          g_object_set (settings, "gtk-enable-tooltips", TRUE, NULL);
+        }
+      UNBLOCK_INPUT;
+
+      ret = 1;
+    }
+#endif
+  return ret;
+}
 
 \f
 /***********************************************************************
@@ -526,10 +719,9 @@ get_utf8_string (str)
    F is the frame we shall set geometry for.  */
 
 static void
-xg_set_geometry (f)
-     FRAME_PTR f;
+xg_set_geometry (FRAME_PTR f)
 {
-  if (f->size_hint_flags & USPosition)
+  if (f->size_hint_flags & (USPosition | PPosition))
     {
       int left = f->left_pos;
       int xneg = f->size_hint_flags & XNegative;
@@ -544,7 +736,7 @@ xg_set_geometry (f)
 
       sprintf (geom_str, "=%dx%d%c%d%c%d",
                FRAME_PIXEL_WIDTH (f),
-               FRAME_TOTAL_PIXEL_HEIGHT (f),
+               FRAME_PIXEL_HEIGHT (f),
                (xneg ? '-' : '+'), left,
                (yneg ? '-' : '+'), top);
 
@@ -552,17 +744,13 @@ xg_set_geometry (f)
                                       geom_str))
         fprintf (stderr, "Failed to parse: '%s'\n", geom_str);
     }
-  else if (f->size_hint_flags & PPosition)
-    gtk_window_move (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
-                     f->left_pos, f->top_pos);
 }
 
 /* Clear under internal border if any.  As we use a mix of Gtk+ and X calls
    and use a GtkFixed widget, this doesn't happen automatically.  */
 
 static void
-xg_clear_under_internal_border (f)
-     FRAME_PTR f;
+xg_clear_under_internal_border (FRAME_PTR f)
 {
   if (FRAME_INTERNAL_BORDER_WIDTH (f) > 0)
     {
@@ -600,16 +788,15 @@ xg_clear_under_internal_border (f)
    PIXELWIDTH, PIXELHEIGHT is the new size in pixels.  */
 
 void
-xg_frame_resized (f, pixelwidth, pixelheight)
-     FRAME_PTR f;
-     int pixelwidth, pixelheight;
+xg_frame_resized (FRAME_PTR f, int pixelwidth, int pixelheight)
 {
   int rows, columns;
 
   if (pixelwidth == -1 && pixelheight == -1)
     {
-      if (FRAME_GTK_WIDGET (f) && GTK_WIDGET_MAPPED (FRAME_GTK_WIDGET (f)))
-          gdk_window_get_geometry (FRAME_GTK_WIDGET (f)->window, 0, 0,
+      if (FRAME_GTK_WIDGET (f) && gtk_widget_get_mapped (FRAME_GTK_WIDGET (f)))
+          gdk_window_get_geometry (gtk_widget_get_window (FRAME_GTK_WIDGET (f)),
+                                   0, 0,
                                    &pixelwidth, &pixelheight, 0);
       else return;
     }
@@ -637,10 +824,7 @@ xg_frame_resized (f, pixelwidth, pixelheight)
    COLUMNS/ROWS is the size the edit area shall have after the resize.  */
 
 void
-xg_frame_set_char_size (f, cols, rows)
-     FRAME_PTR f;
-     int cols;
-     int rows;
+xg_frame_set_char_size (FRAME_PTR f, int cols, int rows)
 {
   int pixelheight = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows)
     + FRAME_MENUBAR_HEIGHT (f) + FRAME_TOOLBAR_HEIGHT (f);
@@ -661,7 +845,8 @@ xg_frame_set_char_size (f, cols, rows)
 
   /* FRAME_TEXT_COLS_TO_PIXEL_WIDTH uses scroll_bar_actual_width, so call it
      after calculating that value.  */
-  pixelwidth = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, cols);
+  pixelwidth = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, cols)
+    + FRAME_TOOLBAR_WIDTH (f);
 
 
   /* Do this before resize, as we don't know yet if we will be resized.  */
@@ -698,15 +883,15 @@ xg_frame_set_char_size (f, cols, rows)
      }
 }
 
-/* Handle height changes (i.e. add/remove menu/toolbar).
+/* Handle height/width changes (i.e. add/remove/move menu/toolbar).
    The policy is to keep the number of editable lines.  */
 
 static void
-xg_height_changed (f)
-     FRAME_PTR f;
+xg_height_or_width_changed (FRAME_PTR f)
 {
   gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
-                     FRAME_PIXEL_WIDTH (f), FRAME_TOTAL_PIXEL_HEIGHT (f));
+                     FRAME_TOTAL_PIXEL_WIDTH (f),
+                     FRAME_TOTAL_PIXEL_HEIGHT (f));
   f->output_data.x->hint_flags = 0;
   x_wm_set_size_hint (f, 0, 0);
 }
@@ -718,9 +903,7 @@ xg_height_changed (f)
    Return 0 if no widget match WDESC.  */
 
 GtkWidget *
-xg_win_to_widget (dpy, wdesc)
-     Display *dpy;
-     Window wdesc;
+xg_win_to_widget (Display *dpy, Window wdesc)
 {
   gpointer gdkwin;
   GtkWidget *gwdesc = 0;
@@ -744,24 +927,40 @@ xg_win_to_widget (dpy, wdesc)
    W is the widget that color will be used for.  Used to find colormap.  */
 
 static void
-xg_pix_to_gcolor (w, pixel, c)
-     GtkWidget *w;
-     unsigned long pixel;
-     GdkColor *c;
+xg_pix_to_gcolor (GtkWidget *w, long unsigned int pixel, GdkColor *c)
 {
   GdkColormap *map = gtk_widget_get_colormap (w);
   gdk_colormap_query_color (map, pixel, c);
 }
 
+/* Callback called when the gtk theme changes.
+   We notify lisp code so it can fix faces used for region for example.  */
+
+static void
+style_changed_cb (GObject *go,
+                  GParamSpec *spec,
+                  gpointer user_data)
+{
+  struct input_event event;
+  GdkDisplay *gdpy = (GdkDisplay *) user_data;
+  const char *display_name = gdk_display_get_name (gdpy);
+
+  EVENT_INIT (event);
+  event.kind = CONFIG_CHANGED_EVENT;
+  event.frame_or_window = make_string (display_name, strlen (display_name));
+  /* Theme doesn't change often, so intern is called seldom.  */
+  event.arg = intern ("theme-name");
+  kbd_buffer_store_event (&event);
+}
+
 /* Create and set up the GTK widgets for frame F.
    Return 0 if creation failed, non-zero otherwise.  */
 
 int
-xg_create_frame_widgets (f)
-     FRAME_PTR f;
+xg_create_frame_widgets (FRAME_PTR f)
 {
   GtkWidget *wtop;
-  GtkWidget *wvbox;
+  GtkWidget *wvbox, *whbox;
   GtkWidget *wfixed;
   GdkColor bg;
   GtkRcStyle *style;
@@ -777,12 +976,14 @@ xg_create_frame_widgets (f)
   xg_set_screen (wtop, f);
 
   wvbox = gtk_vbox_new (FALSE, 0);
+  whbox = gtk_hbox_new (FALSE, 0);
   wfixed = gtk_fixed_new ();  /* Must have this to place scroll bars  */
 
-  if (! wtop || ! wvbox || ! wfixed)
+  if (! wtop || ! wvbox || ! whbox || ! wfixed)
     {
       if (wtop) gtk_widget_destroy (wtop);
       if (wvbox) gtk_widget_destroy (wvbox);
+      if (whbox) gtk_widget_destroy (whbox);
       if (wfixed) gtk_widget_destroy (wfixed);
 
       UNBLOCK_INPUT;
@@ -803,11 +1004,13 @@ xg_create_frame_widgets (f)
   FRAME_GTK_OUTER_WIDGET (f) = wtop;
   FRAME_GTK_WIDGET (f) = wfixed;
   f->output_data.x->vbox_widget = wvbox;
+  f->output_data.x->hbox_widget = whbox;
 
-  gtk_fixed_set_has_window (GTK_FIXED (wfixed), TRUE);
+  gtk_widget_set_has_window (wfixed, TRUE);
 
   gtk_container_add (GTK_CONTAINER (wtop), wvbox);
-  gtk_box_pack_end (GTK_BOX (wvbox), wfixed, TRUE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (wvbox), whbox, TRUE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (whbox), wfixed, TRUE, TRUE, 0);
 
   if (FRAME_EXTERNAL_TOOL_BAR (f))
     update_frame_tool_bar (f);
@@ -866,17 +1069,54 @@ xg_create_frame_widgets (f)
   style->bg_pixmap_name[GTK_STATE_NORMAL] = g_strdup ("<none>");
   gtk_widget_modify_style (wfixed, style);
 
-  /* GTK does not set any border, and they look bad with GTK.  */
-  /* That they look bad is no excuse for imposing this here.  --Stef
-     It should be done by providing the proper default in Fx_create_Frame.
-  f->border_width = 0;
-  f->internal_border_width = 0; */
+#ifdef USE_GTK_TOOLTIP
+  /* Steal a tool tip window we can move ourselves.  */
+  f->output_data.x->ttip_widget = 0;
+  f->output_data.x->ttip_lbl = 0;
+  f->output_data.x->ttip_window = 0;
+  gtk_widget_set_tooltip_text (wtop, "Dummy text");  
+  g_signal_connect (wtop, "query-tooltip", G_CALLBACK (qttip_cb), f);
+#endif
+
+  {
+    GdkScreen *screen = gtk_widget_get_screen (wtop);
+    GtkSettings *gs = gtk_settings_get_for_screen (screen);
+    /* Only connect this signal once per screen.  */
+    if (! g_signal_handler_find (G_OBJECT (gs),
+                                 G_SIGNAL_MATCH_FUNC,
+                                 0, 0, 0,
+                                 G_CALLBACK (style_changed_cb),
+                                 0))
+      {
+        g_signal_connect (G_OBJECT (gs), "notify::gtk-theme-name",
+                          G_CALLBACK (style_changed_cb),
+                          gdk_screen_get_display (screen));
+      }
+  }
 
   UNBLOCK_INPUT;
 
   return 1;
 }
 
+void
+xg_free_frame_widgets (FRAME_PTR f)
+{
+  if (FRAME_GTK_OUTER_WIDGET (f))
+    {
+      struct x_output *x = f->output_data.x;
+      gtk_widget_destroy (FRAME_GTK_OUTER_WIDGET (f));
+      FRAME_X_WINDOW (f) = 0; /* Set to avoid XDestroyWindow in xterm.c */
+      FRAME_GTK_OUTER_WIDGET (f) = 0;
+#ifdef USE_GTK_TOOLTIP
+      if (x->ttip_lbl)
+        gtk_widget_destroy (x->ttip_lbl);
+      if (x->ttip_widget)
+        g_object_unref (G_OBJECT (x->ttip_widget));
+#endif
+    }
+}
+
 /* Set the normal size hints for the window manager, for frame F.
    FLAGS is the flags word to use--or 0 meaning preserve the flags
    that the window now has.
@@ -884,10 +1124,7 @@ xg_create_frame_widgets (f)
    flag (this is useful when FLAGS is 0).  */
 
 void
-x_wm_set_size_hint (f, flags, user_position)
-     FRAME_PTR f;
-     long flags;
-     int user_position;
+x_wm_set_size_hint (FRAME_PTR f, long int flags, int user_position)
 {
   /* Must use GTK routines here, otherwise GTK resets the size hints
      to its own defaults.  */
@@ -920,7 +1157,7 @@ x_wm_set_size_hint (f, flags, user_position)
   size_hints.height_inc = FRAME_LINE_HEIGHT (f);
 
   hint_flags |= GDK_HINT_BASE_SIZE;
-  base_width = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, 0);
+  base_width = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, 0) + FRAME_TOOLBAR_WIDTH (f);
   base_height = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, 0)
     + FRAME_MENUBAR_HEIGHT (f) + FRAME_TOOLBAR_HEIGHT (f);
 
@@ -956,10 +1193,6 @@ x_wm_set_size_hint (f, flags, user_position)
   else if (win_gravity == StaticGravity)
     size_hints.win_gravity = GDK_GRAVITY_STATIC;
 
-  if (flags & PPosition) hint_flags |= GDK_HINT_POS;
-  if (flags & USPosition) hint_flags |= GDK_HINT_USER_POS;
-  if (flags & USSize) hint_flags |= GDK_HINT_USER_SIZE;
-
   if (user_position)
     {
       hint_flags &= ~GDK_HINT_POS;
@@ -987,9 +1220,7 @@ x_wm_set_size_hint (f, flags, user_position)
    BG is the pixel value to change to.  */
 
 void
-xg_set_background_color (f, bg)
-     FRAME_PTR f;
-     unsigned long bg;
+xg_set_background_color (FRAME_PTR f, long unsigned int bg)
 {
   if (FRAME_GTK_WIDGET (f))
     {
@@ -1007,10 +1238,7 @@ xg_set_background_color (f, bg)
    functions so GTK does not overwrite the icon.  */
 
 void
-xg_set_frame_icon (f, icon_pixmap, icon_mask)
-     FRAME_PTR f;
-     Pixmap icon_pixmap;
-     Pixmap icon_mask;
+xg_set_frame_icon (FRAME_PTR f, Pixmap icon_pixmap, Pixmap icon_mask)
 {
     GdkDisplay *gdpy = gdk_x11_lookup_xdisplay (FRAME_X_DISPLAY (f));
     GdkPixmap *gpix = gdk_pixmap_foreign_new_for_display (gdpy, icon_pixmap);
@@ -1028,10 +1256,10 @@ xg_set_frame_icon (f, icon_pixmap, icon_mask)
 /* Return the dialog title to use for a dialog of type KEY.
    This is the encoding used by lwlib.  We use the same for GTK.  */
 
-static char *
+static const char *
 get_dialog_title (char key)
 {
-  char *title = "";
+  const char *title = "";
 
   switch (key) {
   case 'E': case 'e':
@@ -1070,10 +1298,7 @@ get_dialog_title (char key)
    Returns TRUE to end propagation of event.  */
 
 static gboolean
-dialog_delete_callback (w, event, user_data)
-     GtkWidget *w;
-     GdkEvent *event;
-     gpointer user_data;
+dialog_delete_callback (GtkWidget *w, GdkEvent *event, gpointer user_data)
 {
   gtk_widget_unmap (w);
   return TRUE;
@@ -1087,20 +1312,20 @@ dialog_delete_callback (w, event, user_data)
    Returns the GTK dialog widget.  */
 
 static GtkWidget *
-create_dialog (wv, select_cb, deactivate_cb)
-     widget_value *wv;
-     GCallback select_cb;
-     GCallback deactivate_cb;
+create_dialog (widget_value *wv,
+               GCallback select_cb,
+               GCallback deactivate_cb)
 {
-  char *title = get_dialog_title (wv->name[0]);
+  const char *title = get_dialog_title (wv->name[0]);
   int total_buttons = wv->name[1] - '0';
   int right_buttons = wv->name[4] - '0';
   int left_buttons;
   int button_nr = 0;
   int button_spacing = 10;
   GtkWidget *wdialog = gtk_dialog_new ();
+  GtkDialog *wd = GTK_DIALOG (wdialog);
+  GtkBox *cur_box = GTK_BOX (gtk_dialog_get_action_area (wd));
   widget_value *item;
-  GtkBox *cur_box;
   GtkWidget *wvbox;
   GtkWidget *whbox_up;
   GtkWidget *whbox_down;
@@ -1115,7 +1340,6 @@ create_dialog (wv, select_cb, deactivate_cb)
   gtk_window_set_title (GTK_WINDOW (wdialog), title);
   gtk_widget_set_name (wdialog, "emacs-dialog");
 
-  cur_box = GTK_BOX (GTK_DIALOG (wdialog)->action_area);
 
   if (make_two_rows)
     {
@@ -1147,21 +1371,18 @@ create_dialog (wv, select_cb, deactivate_cb)
 
       if (item->name && strcmp (item->name, "message") == 0)
         {
+          GtkBox *wvbox = GTK_BOX (gtk_dialog_get_content_area (wd));
           /* This is the text part of the dialog.  */
           w = gtk_label_new (utf8_label);
-          gtk_box_pack_start (GTK_BOX (GTK_DIALOG (wdialog)->vbox),
-                              gtk_label_new (""),
-                              FALSE, FALSE, 0);
-          gtk_box_pack_start (GTK_BOX (GTK_DIALOG (wdialog)->vbox), w,
-                              TRUE, TRUE, 0);
+          gtk_box_pack_start (wvbox, gtk_label_new (""), FALSE, FALSE, 0);
+          gtk_box_pack_start (wvbox, w, TRUE, TRUE, 0);
           gtk_misc_set_alignment (GTK_MISC (w), 0.1, 0.5);
 
           /* Try to make dialog look better.  Must realize first so
              the widget can calculate the size it needs.  */
           gtk_widget_realize (w);
           gtk_widget_size_request (w, &req);
-          gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (wdialog)->vbox),
-                               req.height);
+          gtk_box_set_spacing (wvbox, req.height);
          if (item->value && strlen (item->value) > 0)
             button_spacing = 2*req.width/strlen (item->value);
         }
@@ -1188,7 +1409,7 @@ create_dialog (wv, select_cb, deactivate_cb)
             }
         }
 
-     if (utf8_label && utf8_label != item->value)
+     if (utf8_label)
        g_free (utf8_label);
     }
 
@@ -1208,12 +1429,9 @@ struct xg_dialog_data
    USER_DATA is what we passed in to g_signal_connect.  */
 
 static void
-xg_dialog_response_cb (w,
-                       response,
-                       user_data)
-     GtkDialog *w;
-     gint response;
-     gpointer user_data;
+xg_dialog_response_cb (GtkDialog *w,
+                      gint response,
+                      gpointer user_data)
 {
   struct xg_dialog_data *dd = (struct xg_dialog_data *)user_data;
   dd->response = response;
@@ -1224,8 +1442,7 @@ xg_dialog_response_cb (w,
 /*  Destroy the dialog.  This makes it pop down.  */
 
 static Lisp_Object
-pop_down_dialog (arg)
-     Lisp_Object arg;
+pop_down_dialog (Lisp_Object arg)
 {
   struct Lisp_Save_Value *p = XSAVE_VALUE (arg);
   struct xg_dialog_data *dd = (struct xg_dialog_data *) p->pointer;
@@ -1246,8 +1463,7 @@ pop_down_dialog (arg)
     We pass in DATA as gpointer* so we can use this as a callback.  */
 
 static gboolean
-xg_maybe_add_timer (data)
-     gpointer data;
+xg_maybe_add_timer (gpointer data)
 {
   struct xg_dialog_data *dd = (struct xg_dialog_data *) data;
   EMACS_TIME next_time = timer_check (1);
@@ -1271,10 +1487,7 @@ xg_maybe_add_timer (data)
    The dialog W is not destroyed when this function returns.  */
 
 static int
-xg_dialog_run (f, w)
-     FRAME_PTR f;
-     GtkWidget *w;
-
+xg_dialog_run (FRAME_PTR f, GtkWidget *w)
 {
   int count = SPECPDL_INDEX ();
   struct xg_dialog_data dd;
@@ -1317,33 +1530,24 @@ xg_dialog_run (f, w)
    Return zero if not.  */
 
 int
-xg_uses_old_file_dialog ()
+xg_uses_old_file_dialog (void)
 {
-#ifdef HAVE_GTK_FILE_BOTH
+#ifdef HAVE_GTK_FILE_SELECTION_NEW
   extern int x_gtk_use_old_file_dialog;
   return x_gtk_use_old_file_dialog;
-#else /* ! HAVE_GTK_FILE_BOTH */
-
-#ifdef HAVE_GTK_FILE_SELECTION_NEW
-  return 1;
 #else
   return 0;
 #endif
-
-#endif /* ! HAVE_GTK_FILE_BOTH */
 }
 
 
-typedef char * (*xg_get_file_func) P_ ((GtkWidget *));
-
-#ifdef HAVE_GTK_FILE_CHOOSER_DIALOG_NEW
+typedef char * (*xg_get_file_func) (GtkWidget *);
 
 /* Return the selected file for file chooser dialog W.
    The returned string must be free:d.  */
 
 static char *
-xg_get_file_name_from_chooser (w)
-     GtkWidget *w;
+xg_get_file_name_from_chooser (GtkWidget *w)
 {
   return gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (w));
 }
@@ -1352,9 +1556,7 @@ xg_get_file_name_from_chooser (w)
    WIDGET is the toggle widget, DATA is the file chooser dialog.  */
 
 static void
-xg_toggle_visibility_cb (widget, data)
-     GtkWidget *widget;
-     gpointer data;
+xg_toggle_visibility_cb (GtkWidget *widget, gpointer data)
 {
   GtkFileChooser *dialog = GTK_FILE_CHOOSER (data);
   gboolean visible;
@@ -1370,10 +1572,7 @@ xg_toggle_visibility_cb (widget, data)
    changes that property by right clicking in the file list.  */
 
 static void
-xg_toggle_notify_cb (gobject, arg1, user_data)
-     GObject *gobject;
-     GParamSpec *arg1;
-     gpointer user_data;
+xg_toggle_notify_cb (GObject *gobject, GParamSpec *arg1, gpointer user_data)
 {
   extern int x_gtk_show_hidden_files;
 
@@ -1411,13 +1610,11 @@ xg_toggle_notify_cb (gobject, arg1, user_data)
    Returns the created widget.  */
 
 static GtkWidget *
-xg_get_file_with_chooser (f, prompt, default_filename,
-                          mustmatch_p, only_dir_p, func)
-     FRAME_PTR f;
-     char *prompt;
-     char *default_filename;
-     int mustmatch_p, only_dir_p;
-     xg_get_file_func *func;
+xg_get_file_with_chooser (FRAME_PTR f,
+                         char *prompt,
+                         char *default_filename,
+                         int mustmatch_p, int only_dir_p,
+                         xg_get_file_func *func)
 {
   char message[1024];
 
@@ -1513,7 +1710,6 @@ xg_get_file_with_chooser (f, prompt, default_filename,
   *func = xg_get_file_name_from_chooser;
   return filewin;
 }
-#endif /* HAVE_GTK_FILE_CHOOSER_DIALOG_NEW */
 
 #ifdef HAVE_GTK_FILE_SELECTION_NEW
 
@@ -1521,8 +1717,7 @@ xg_get_file_with_chooser (f, prompt, default_filename,
    The returned string must be free:d.  */
 
 static char *
-xg_get_file_name_from_selector (w)
-     GtkWidget *w;
+xg_get_file_name_from_selector (GtkWidget *w)
 {
   GtkFileSelection *filesel = GTK_FILE_SELECTION (w);
   return xstrdup ((char*) gtk_file_selection_get_filename (filesel));
@@ -1539,13 +1734,11 @@ xg_get_file_name_from_selector (w)
    Returns the created widget.  */
 
 static GtkWidget *
-xg_get_file_with_selection (f, prompt, default_filename,
-                            mustmatch_p, only_dir_p, func)
-     FRAME_PTR f;
-     char *prompt;
-     char *default_filename;
-     int mustmatch_p, only_dir_p;
-     xg_get_file_func *func;
+xg_get_file_with_selection (FRAME_PTR f,
+                            char *prompt,
+                            char *default_filename,
+                            int mustmatch_p, int only_dir_p,
+                            xg_get_file_func *func)
 {
   GtkWidget *filewin;
   GtkFileSelection *filesel;
@@ -1583,11 +1776,11 @@ xg_get_file_with_selection (f, prompt, default_filename,
    The returned string must be freed by the caller.  */
 
 char *
-xg_get_file_name (f, prompt, default_filename, mustmatch_p, only_dir_p)
-     FRAME_PTR f;
-     char *prompt;
-     char *default_filename;
-     int mustmatch_p, only_dir_p;
+xg_get_file_name (FRAME_PTR f,
+                  char *prompt,
+                  char *default_filename,
+                  int mustmatch_p,
+                  int only_dir_p)
 {
   GtkWidget *w = 0;
   char *fn = 0;
@@ -1601,7 +1794,7 @@ xg_get_file_name (f, prompt, default_filename, mustmatch_p, only_dir_p)
   sigblock (sigmask (__SIGRTMIN));
 #endif /* HAVE_GTK_AND_PTHREAD */
 
-#ifdef HAVE_GTK_FILE_BOTH
+#ifdef HAVE_GTK_FILE_SELECTION_NEW
 
   if (xg_uses_old_file_dialog ())
     w = xg_get_file_with_selection (f, prompt, default_filename,
@@ -1610,18 +1803,10 @@ xg_get_file_name (f, prompt, default_filename, mustmatch_p, only_dir_p)
     w = xg_get_file_with_chooser (f, prompt, default_filename,
                                   mustmatch_p, only_dir_p, &func);
 
-#else /* not HAVE_GTK_FILE_BOTH */
-
-#ifdef HAVE_GTK_FILE_SELECTION_NEW
-  w = xg_get_file_with_selection (f, prompt, default_filename,
-                                  mustmatch_p, only_dir_p, &func);
-#endif
-#ifdef HAVE_GTK_FILE_CHOOSER_DIALOG_NEW
+#else /* not HAVE_GTK_FILE_SELECTION_NEW */
   w = xg_get_file_with_chooser (f, prompt, default_filename,
                                 mustmatch_p, only_dir_p, &func);
-#endif
-
-#endif /* HAVE_GTK_FILE_BOTH */
+#endif /* not HAVE_GTK_FILE_SELECTION_NEW */
 
   gtk_widget_set_name (w, "emacs-filedialog");
 
@@ -1649,9 +1834,7 @@ xg_get_file_name (f, prompt, default_filename, mustmatch_p, only_dir_p)
    DEFAULT_NAME, if non-zero, is the default font name.  */
 
 char *
-xg_get_font_name (f, default_name)
-     FRAME_PTR f;
-     char *default_name;
+xg_get_font_name (FRAME_PTR f, const char *default_name)
 {
   GtkWidget *w;
   char *fontname = NULL;
@@ -1716,10 +1899,7 @@ static xg_list_node xg_menu_item_cb_list;
    allocated xg_menu_cb_data if CL_DATA is NULL.  */
 
 static xg_menu_cb_data *
-make_cl_data (cl_data, f, highlight_cb)
-     xg_menu_cb_data *cl_data;
-     FRAME_PTR f;
-     GCallback highlight_cb;
+make_cl_data (xg_menu_cb_data *cl_data, FRAME_PTR f, GCallback highlight_cb)
 {
   if (! cl_data)
     {
@@ -1750,10 +1930,9 @@ make_cl_data (cl_data, f, highlight_cb)
    creating the menu bar.  */
 
 static void
-update_cl_data (cl_data, f, highlight_cb)
-     xg_menu_cb_data *cl_data;
-     FRAME_PTR f;
-     GCallback highlight_cb;
+update_cl_data (xg_menu_cb_data *cl_data,
+                FRAME_PTR f,
+                GCallback highlight_cb)
 {
   if (cl_data)
     {
@@ -1768,8 +1947,7 @@ update_cl_data (cl_data, f, highlight_cb)
    If reference count is zero, free CL_DATA.  */
 
 static void
-unref_cl_data (cl_data)
-     xg_menu_cb_data *cl_data;
+unref_cl_data (xg_menu_cb_data *cl_data)
 {
   if (cl_data && cl_data->ref_count > 0)
     {
@@ -1785,7 +1963,7 @@ unref_cl_data (cl_data)
 /* Function that marks all lisp data during GC.  */
 
 void
-xg_mark_data ()
+xg_mark_data (void)
 {
   xg_list_node *iter;
 
@@ -1807,9 +1985,7 @@ xg_mark_data ()
    CLIENT_DATA points to the xg_menu_item_cb_data associated with the W.  */
 
 static void
-menuitem_destroy_callback (w, client_data)
-     GtkWidget *w;
-     gpointer client_data;
+menuitem_destroy_callback (GtkWidget *w, gpointer client_data)
 {
   if (client_data)
     {
@@ -1827,10 +2003,9 @@ menuitem_destroy_callback (w, client_data)
    Returns FALSE to tell GTK to keep processing this event.  */
 
 static gboolean
-menuitem_highlight_callback (w, event, client_data)
-     GtkWidget *w;
-     GdkEventCrossing *event;
-     gpointer client_data;
+menuitem_highlight_callback (GtkWidget *w,
+                             GdkEventCrossing *event,
+                             gpointer client_data)
 {
   GdkEvent ev;
   GtkWidget *subwidget;
@@ -1858,9 +2033,7 @@ menuitem_highlight_callback (w, event, client_data)
    CLIENT_DATA points to the xg_menu_cb_data associated with W.  */
 
 static void
-menu_destroy_callback (w, client_data)
-     GtkWidget *w;
-     gpointer client_data;
+menu_destroy_callback (GtkWidget *w, gpointer client_data)
 {
   unref_cl_data ((xg_menu_cb_data*) client_data);
 }
@@ -1871,9 +2044,7 @@ menu_destroy_callback (w, client_data)
    Returns the GtkHBox.  */
 
 static GtkWidget *
-make_widget_for_menu_item (utf8_label, utf8_key)
-     char *utf8_label;
-     char *utf8_key;
+make_widget_for_menu_item (const char *utf8_label, const char *utf8_key)
 {
   GtkWidget *wlbl;
   GtkWidget *wkey;
@@ -1911,11 +2082,10 @@ make_widget_for_menu_item (utf8_label, utf8_key)
    but the MacOS X version doesn't either, so I guess that is OK.  */
 
 static GtkWidget *
-make_menu_item (utf8_label, utf8_key, item, group)
-     char *utf8_label;
-     char *utf8_key;
-     widget_value *item;
-     GSList **group;
+make_menu_item (const char *utf8_label,
+                const char *utf8_key,
+                widget_value *item,
+                GSList **group)
 {
   GtkWidget *w;
   GtkWidget *wtoadd = 0;
@@ -1979,7 +2149,7 @@ static const char* separator_names[] = {
 };
 
 static int
-xg_separator_p (char *label)
+xg_separator_p (const char *label)
 {
   if (! label) return 0;
   else if (strlen (label) > 3
@@ -2010,7 +2180,7 @@ static int xg_detached_menus;
 /* Returns non-zero if there are detached menus.  */
 
 int
-xg_have_tear_offs ()
+xg_have_tear_offs (void)
 {
   return xg_detached_menus > 0;
 }
@@ -2021,9 +2191,7 @@ xg_have_tear_offs ()
    CLIENT_DATA is not used.  */
 
 static void
-tearoff_remove (widget, client_data)
-     GtkWidget *widget;
-     gpointer client_data;
+tearoff_remove (GtkWidget *widget, gpointer client_data)
 {
   if (xg_detached_menus > 0) --xg_detached_menus;
 }
@@ -2034,9 +2202,7 @@ tearoff_remove (widget, client_data)
    CLIENT_DATA is not used.  */
 
 static void
-tearoff_activate (widget, client_data)
-     GtkWidget *widget;
-     gpointer client_data;
+tearoff_activate (GtkWidget *widget, gpointer client_data)
 {
   GtkWidget *menu = gtk_widget_get_parent (widget);
   if (gtk_menu_get_tearoff_state (GTK_MENU (menu)))
@@ -2064,13 +2230,12 @@ tearoff_activate (widget, client_data)
    Returns the created GtkWidget.  */
 
 static GtkWidget *
-xg_create_one_menuitem (item, f, select_cb, highlight_cb, cl_data, group)
-     widget_value *item;
-     FRAME_PTR f;
-     GCallback select_cb;
-     GCallback highlight_cb;
-     xg_menu_cb_data *cl_data;
-     GSList **group;
+xg_create_one_menuitem (widget_value *item,
+                        FRAME_PTR f,
+                        GCallback select_cb,
+                        GCallback highlight_cb,
+                        xg_menu_cb_data *cl_data,
+                        GSList **group)
 {
   char *utf8_label;
   char *utf8_key;
@@ -2082,8 +2247,8 @@ xg_create_one_menuitem (item, f, select_cb, highlight_cb, cl_data, group)
 
   w = make_menu_item (utf8_label, utf8_key, item, group);
 
-  if (utf8_label && utf8_label != item->name) g_free (utf8_label);
-  if (utf8_key && utf8_key != item->key) g_free (utf8_key);
+  if (utf8_label) g_free (utf8_label);
+  if (utf8_key) g_free (utf8_key);
 
   cb_data = xmalloc (sizeof (xg_menu_item_cb_data));
 
@@ -2113,10 +2278,6 @@ xg_create_one_menuitem (item, f, select_cb, highlight_cb, cl_data, group)
   return w;
 }
 
-static GtkWidget *create_menus P_ ((widget_value *, FRAME_PTR, GCallback,
-                                   GCallback, GCallback, int, int, int,
-                                   GtkWidget *, xg_menu_cb_data *, char *));
-
 /* Create a full menu tree specified by DATA.
    F is the frame the created menu belongs to.
    SELECT_CB is the callback to use when a menu item is selected.
@@ -2140,19 +2301,17 @@ static GtkWidget *create_menus P_ ((widget_value *, FRAME_PTR, GCallback,
    This function calls itself to create submenus.  */
 
 static GtkWidget *
-create_menus (data, f, select_cb, deactivate_cb, highlight_cb,
-              pop_up_p, menu_bar_p, add_tearoff_p, topmenu, cl_data, name)
-     widget_value *data;
-     FRAME_PTR f;
-     GCallback select_cb;
-     GCallback deactivate_cb;
-     GCallback highlight_cb;
-     int pop_up_p;
-     int menu_bar_p;
-     int add_tearoff_p;
-     GtkWidget *topmenu;
-     xg_menu_cb_data *cl_data;
-     char *name;
+create_menus (widget_value *data,
+              FRAME_PTR f,
+              GCallback select_cb,
+              GCallback deactivate_cb,
+              GCallback highlight_cb,
+              int pop_up_p,
+              int menu_bar_p,
+              int add_tearoff_p,
+              GtkWidget *topmenu,
+              xg_menu_cb_data *cl_data,
+              const char *name)
 {
   widget_value *item;
   GtkWidget *wmenu = topmenu;
@@ -2225,7 +2384,7 @@ create_menus (data, f, select_cb, deactivate_cb, highlight_cb,
           gtk_menu_set_title (GTK_MENU (wmenu), utf8_label);
           w = gtk_menu_item_new_with_label (utf8_label);
           gtk_widget_set_sensitive (w, FALSE);
-          if (utf8_label && utf8_label != item->name) g_free (utf8_label);
+          if (utf8_label) g_free (utf8_label);
         }
       else if (xg_separator_p (item->name))
         {
@@ -2284,15 +2443,9 @@ create_menus (data, f, select_cb, deactivate_cb, highlight_cb,
    Returns the widget created.  */
 
 GtkWidget *
-xg_create_widget (type, name, f, val,
-                  select_cb, deactivate_cb, highlight_cb)
-     char *type;
-     char *name;
-     FRAME_PTR f;
-     widget_value *val;
-     GCallback select_cb;
-     GCallback deactivate_cb;
-     GCallback highlight_cb;
+xg_create_widget (const char *type, const char *name, FRAME_PTR f, widget_value *val,
+                  GCallback select_cb, GCallback deactivate_cb,
+                 GCallback highlight_cb)
 {
   GtkWidget *w = 0;
   int menu_bar_p = strcmp (type, "menubar") == 0;
@@ -2343,8 +2496,7 @@ xg_create_widget (type, name, f, val,
 /* Return the label for menu item WITEM.  */
 
 static const char *
-xg_get_menu_item_label (witem)
-     GtkMenuItem *witem;
+xg_get_menu_item_label (GtkMenuItem *witem)
 {
   GtkLabel *wlabel = GTK_LABEL (gtk_bin_get_child (GTK_BIN (witem)));
   return gtk_label_get_label (wlabel);
@@ -2353,9 +2505,7 @@ xg_get_menu_item_label (witem)
 /* Return non-zero if the menu item WITEM has the text LABEL.  */
 
 static int
-xg_item_label_same_p (witem, label)
-     GtkMenuItem *witem;
-     char *label;
+xg_item_label_same_p (GtkMenuItem *witem, const char *label)
 {
   int is_same = 0;
   char *utf8_label = get_utf8_string (label);
@@ -2366,7 +2516,7 @@ xg_item_label_same_p (witem, label)
   else if (old_label && utf8_label)
     is_same = strcmp (utf8_label, old_label) == 0;
 
-  if (utf8_label && utf8_label != label) g_free (utf8_label);
+  if (utf8_label) g_free (utf8_label);
 
   return is_same;
 }
@@ -2374,8 +2524,7 @@ xg_item_label_same_p (witem, label)
 /* Destroy widgets in LIST.  */
 
 static void
-xg_destroy_widgets (list)
-     GList *list;
+xg_destroy_widgets (GList *list)
 {
   GList *iter;
 
@@ -2401,18 +2550,16 @@ xg_destroy_widgets (list)
    This function calls itself to walk through the menu bar names.  */
 
 static void
-xg_update_menubar (menubar, f, list, iter, pos, val,
-                   select_cb, deactivate_cb, highlight_cb, cl_data)
-     GtkWidget *menubar;
-     FRAME_PTR f;
-     GList **list;
-     GList *iter;
-     int pos;
-     widget_value *val;
-     GCallback select_cb;
-     GCallback deactivate_cb;
-     GCallback highlight_cb;
-     xg_menu_cb_data *cl_data;
+xg_update_menubar (GtkWidget *menubar,
+                  FRAME_PTR f,
+                  GList **list,
+                  GList *iter,
+                  int pos,
+                  widget_value *val,
+                  GCallback select_cb,
+                  GCallback deactivate_cb,
+                  GCallback highlight_cb,
+                  xg_menu_cb_data *cl_data)
 {
   if (! iter && ! val)
     return;
@@ -2479,7 +2626,7 @@ xg_update_menubar (menubar, f, list, iter, pos, val,
                 New:      A C
               Remove B.  */
 
-          gtk_widget_ref (GTK_WIDGET (witem));
+          g_object_ref (G_OBJECT (witem));
           gtk_container_remove (GTK_CONTAINER (menubar), GTK_WIDGET (witem));
           gtk_widget_destroy (GTK_WIDGET (witem));
 
@@ -2516,6 +2663,7 @@ xg_update_menubar (menubar, f, list, iter, pos, val,
             /* Set the title of the detached window.  */
             gtk_menu_set_title (GTK_MENU (submenu), utf8_label);
 
+          if (utf8_label) g_free (utf8_label);
           iter = g_list_next (iter);
           val = val->next;
           ++pos;
@@ -2528,7 +2676,7 @@ xg_update_menubar (menubar, f, list, iter, pos, val,
               Insert X.  */
 
           int nr = pos;
-          GList *group = 0;
+          GSList *group = 0;
           GtkWidget *w = xg_create_one_menuitem (val,
                                                  f,
                                                  select_cb,
@@ -2561,11 +2709,11 @@ xg_update_menubar (menubar, f, list, iter, pos, val,
                 New:      A C B
               Move C before B  */
 
-          gtk_widget_ref (GTK_WIDGET (witem2));
+          g_object_ref (G_OBJECT (witem2));
           gtk_container_remove (GTK_CONTAINER (menubar), GTK_WIDGET (witem2));
           gtk_menu_shell_insert (GTK_MENU_SHELL (menubar),
                                  GTK_WIDGET (witem2), pos);
-          gtk_widget_unref (GTK_WIDGET (witem2));
+          g_object_unref (G_OBJECT (witem2));
 
           g_list_free (*list);
           *list = iter = gtk_container_get_children (GTK_CONTAINER (menubar));
@@ -2587,12 +2735,11 @@ xg_update_menubar (menubar, f, list, iter, pos, val,
    CL_DATA is the data to set in the widget for menu invocation.  */
 
 static void
-xg_update_menu_item (val, w, select_cb, highlight_cb, cl_data)
-     widget_value *val;
-     GtkWidget *w;
-     GCallback select_cb;
-     GCallback highlight_cb;
-     xg_menu_cb_data *cl_data;
+xg_update_menu_item (widget_value *val,
+                     GtkWidget *w,
+                     GCallback select_cb,
+                     GCallback highlight_cb,
+                     xg_menu_cb_data *cl_data)
 {
   GtkWidget *wchild;
   GtkLabel *wlbl = 0;
@@ -2619,9 +2766,10 @@ xg_update_menu_item (val, w, select_cb, highlight_cb, cl_data)
       if (! utf8_key)
         {
           /* Remove the key and keep just the label.  */
-          gtk_widget_ref (GTK_WIDGET (wlbl));
+          g_object_ref (G_OBJECT (wlbl));
           gtk_container_remove (GTK_CONTAINER (w), wchild);
           gtk_container_add (GTK_CONTAINER (w), GTK_WIDGET (wlbl));
+          g_object_unref (G_OBJECT (wlbl));
           wkey = 0;
         }
 
@@ -2655,12 +2803,12 @@ xg_update_menu_item (val, w, select_cb, highlight_cb, cl_data)
   if (! old_label || strcmp (utf8_label, old_label) != 0)
     gtk_label_set_text (wlbl, utf8_label);
 
-  if (utf8_key && utf8_key != val->key) g_free (utf8_key);
-  if (utf8_label && utf8_label != val->name) g_free (utf8_label);
+  if (utf8_key) g_free (utf8_key);
+  if (utf8_label) g_free (utf8_label);
 
-  if (! val->enabled && GTK_WIDGET_SENSITIVE (w))
+  if (! val->enabled && gtk_widget_get_sensitive (w))
     gtk_widget_set_sensitive (w, FALSE);
-  else if (val->enabled && ! GTK_WIDGET_SENSITIVE (w))
+  else if (val->enabled && ! gtk_widget_get_sensitive (w))
     gtk_widget_set_sensitive (w, TRUE);
 
   cb_data = (xg_menu_item_cb_data*) g_object_get_data (G_OBJECT (w),
@@ -2691,9 +2839,7 @@ xg_update_menu_item (val, w, select_cb, highlight_cb, cl_data)
 /* Update the toggle menu item W so it corresponds to VAL.  */
 
 static void
-xg_update_toggle_item (val, w)
-     widget_value *val;
-     GtkWidget *w;
+xg_update_toggle_item (widget_value *val, GtkWidget *w)
 {
   gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (w), val->selected);
 }
@@ -2701,9 +2847,7 @@ xg_update_toggle_item (val, w)
 /* Update the radio menu item W so it corresponds to VAL.  */
 
 static void
-xg_update_radio_item (val, w)
-     widget_value *val;
-     GtkWidget *w;
+xg_update_radio_item (widget_value *val, GtkWidget *w)
 {
   gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (w), val->selected);
 }
@@ -2721,15 +2865,13 @@ xg_update_radio_item (val, w)
    was NULL.  */
 
 static GtkWidget *
-xg_update_submenu (submenu, f, val,
-                   select_cb, deactivate_cb, highlight_cb, cl_data)
-     GtkWidget *submenu;
-     FRAME_PTR f;
-     widget_value *val;
-     GCallback select_cb;
-     GCallback deactivate_cb;
-     GCallback highlight_cb;
-     xg_menu_cb_data *cl_data;
+xg_update_submenu (GtkWidget *submenu,
+                  FRAME_PTR f,
+                  widget_value *val,
+                  GCallback select_cb,
+                  GCallback deactivate_cb,
+                  GCallback highlight_cb,
+                  xg_menu_cb_data *cl_data)
 {
   GtkWidget *newsub = submenu;
   GList *list = 0;
@@ -2799,8 +2941,8 @@ xg_update_submenu (submenu, f, val,
         if (sub && ! cur->contents)
           {
             /* Not a submenu anymore.  */
-            gtk_widget_ref (sub);
-            gtk_menu_item_remove_submenu (witem);
+            g_object_ref (G_OBJECT (sub));
+            remove_submenu (witem);
             gtk_widget_destroy (sub);
           }
         else if (cur->contents)
@@ -2864,15 +3006,10 @@ xg_update_submenu (submenu, f, val,
    HIGHLIGHT_CB is the callback to call when entering/leaving menu items.  */
 
 void
-xg_modify_menubar_widgets (menubar, f, val, deep_p,
-                           select_cb, deactivate_cb, highlight_cb)
-     GtkWidget *menubar;
-     FRAME_PTR f;
-     widget_value *val;
-     int deep_p;
-     GCallback select_cb;
-     GCallback deactivate_cb;
-     GCallback highlight_cb;
+xg_modify_menubar_widgets (GtkWidget *menubar, FRAME_PTR f, widget_value *val,
+                          int deep_p,
+                           GCallback select_cb, GCallback deactivate_cb,
+                          GCallback highlight_cb)
 {
   xg_menu_cb_data *cl_data;
   GList *list = gtk_container_get_children (GTK_CONTAINER (menubar));
@@ -2901,7 +3038,7 @@ xg_modify_menubar_widgets (menubar, f, val, deep_p,
           GList *iter;
           GtkWidget *sub = 0;
           GtkWidget *newsub;
-          GtkMenuItem *witem;
+          GtkMenuItem *witem = 0;
 
           /* Find sub menu that corresponds to val and update it.  */
           for (iter = list ; iter; iter = g_list_next (iter))
@@ -2924,7 +3061,7 @@ xg_modify_menubar_widgets (menubar, f, val, deep_p,
           /* sub may still be NULL.  If we just updated non deep and added
              a new menu bar item, it has no sub menu yet.  So we set the
              newly created sub menu under witem.  */
-          if (newsub != sub)
+          if (newsub != sub && witem != 0)
             {
               xg_set_screen (newsub, f);
               gtk_menu_item_set_submenu (witem, newsub);
@@ -2940,13 +3077,12 @@ xg_modify_menubar_widgets (menubar, f, val, deep_p,
    changed.  Value is non-zero if widgets were updated.  */
 
 int
-xg_update_frame_menubar (f)
-     FRAME_PTR f;
+xg_update_frame_menubar (FRAME_PTR f)
 {
   struct x_output *x = f->output_data.x;
   GtkRequisition req;
 
-  if (!x->menubar_widget || GTK_WIDGET_MAPPED (x->menubar_widget))
+  if (!x->menubar_widget || gtk_widget_get_mapped (x->menubar_widget))
     return 0;
 
   if (x->menubar_widget && gtk_widget_get_parent (x->menubar_widget))
@@ -2961,7 +3097,7 @@ xg_update_frame_menubar (f)
   gtk_widget_show_all (x->menubar_widget);
   gtk_widget_size_request (x->menubar_widget, &req);
   FRAME_MENUBAR_HEIGHT (f) = req.height;
-  xg_height_changed (f);
+  xg_height_or_width_changed (f);
   UNBLOCK_INPUT;
 
   return 1;
@@ -2971,8 +3107,7 @@ xg_update_frame_menubar (f)
    This is used when deleting a frame, and when turning off the menu bar.  */
 
 void
-free_frame_menubar (f)
-     FRAME_PTR f;
+free_frame_menubar (FRAME_PTR f)
 {
   struct x_output *x = f->output_data.x;
 
@@ -2985,7 +3120,7 @@ free_frame_menubar (f)
           the container.  */
       x->menubar_widget = 0;
       FRAME_MENUBAR_HEIGHT (f) = 0;
-      xg_height_changed (f);
+      xg_height_or_width_changed (f);
       UNBLOCK_INPUT;
     }
 }
@@ -3032,7 +3167,7 @@ xg_event_is_for_menubar (FRAME_PTR f, XEvent *event)
   for (iter = list ; iter; iter = g_list_next (iter))
     {
       GtkWidget *w = GTK_WIDGET (iter->data);
-      if (GTK_WIDGET_MAPPED (w) && gtk_widget_intersect (w, &rec, NULL))
+      if (gtk_widget_get_mapped (w) && gtk_widget_intersect (w, &rec, NULL))
         break;
     }
   g_list_free (list);
@@ -3069,8 +3204,7 @@ static struct
 /* Store the widget pointer W in id_to_widget and return the integer index.  */
 
 static int
-xg_store_widget_in_map (w)
-     GtkWidget *w;
+xg_store_widget_in_map (GtkWidget *w)
 {
   int i;
 
@@ -3108,8 +3242,7 @@ xg_store_widget_in_map (w)
    Called when scroll bar is destroyed.  */
 
 static void
-xg_remove_widget_from_map (idx)
-     int idx;
+xg_remove_widget_from_map (int idx)
 {
   if (idx < id_to_widget.max_size && id_to_widget.widgets[idx] != 0)
     {
@@ -3121,8 +3254,7 @@ xg_remove_widget_from_map (idx)
 /* Get the widget pointer at IDX from id_to_widget. */
 
 static GtkWidget *
-xg_get_widget_from_map (idx)
-     int idx;
+xg_get_widget_from_map (int idx)
 {
   if (idx < id_to_widget.max_size && id_to_widget.widgets[idx] != 0)
     return id_to_widget.widgets[idx];
@@ -3134,9 +3266,7 @@ xg_get_widget_from_map (idx)
    Return -1 if WID not in id_to_widget.  */
 
 int
-xg_get_scroll_id_for_window (dpy, wid)
-     Display *dpy;
-     Window wid;
+xg_get_scroll_id_for_window (Display *dpy, Window wid)
 {
   int idx;
   GtkWidget *w;
@@ -3158,9 +3288,7 @@ xg_get_scroll_id_for_window (dpy, wid)
    We free pointer to last scroll bar values here and remove the index.  */
 
 static void
-xg_gtk_scroll_destroy (widget, data)
-     GtkWidget *widget;
-     gpointer data;
+xg_gtk_scroll_destroy (GtkWidget *widget, gpointer data)
 {
   int id = (int) (EMACS_INT) data; /* The EMACS_INT cast avoids a warning. */
   xg_remove_widget_from_map (id);
@@ -3175,11 +3303,11 @@ xg_gtk_scroll_destroy (widget, data)
    to set resources for the widget.  */
 
 void
-xg_create_scroll_bar (f, bar, scroll_callback, end_callback, scroll_bar_name)
-     FRAME_PTR f;
-     struct scroll_bar *bar;
-     GCallback scroll_callback, end_callback;
-     char *scroll_bar_name;
+xg_create_scroll_bar (FRAME_PTR f,
+                      struct scroll_bar *bar,
+                      GCallback scroll_callback,
+                      GCallback end_callback,
+                      const char *scroll_bar_name)
 {
   GtkWidget *wscroll;
   GtkWidget *webox;
@@ -3229,23 +3357,10 @@ xg_create_scroll_bar (f, bar, scroll_callback, end_callback, scroll_bar_name)
   bar->x_window = scroll_id;
 }
 
-/* Make the scroll bar represented by SCROLLBAR_ID visible.  */
-
-void
-xg_show_scroll_bar (scrollbar_id)
-     int scrollbar_id;
-{
-  GtkWidget *w = xg_get_widget_from_map (scrollbar_id);
-  if (w)
-    gtk_widget_show_all (gtk_widget_get_parent (w));
-}
-
 /* Remove the scroll bar represented by SCROLLBAR_ID from the frame F.  */
 
 void
-xg_remove_scroll_bar (f, scrollbar_id)
-     FRAME_PTR f;
-     int scrollbar_id;
+xg_remove_scroll_bar (FRAME_PTR f, int scrollbar_id)
 {
   GtkWidget *w = xg_get_widget_from_map (scrollbar_id);
   if (w)
@@ -3263,13 +3378,12 @@ xg_remove_scroll_bar (f, scrollbar_id)
    WIDTH, HEIGHT is the size in pixels the bar shall have.  */
 
 void
-xg_update_scrollbar_pos (f, scrollbar_id, top, left, width, height)
-     FRAME_PTR f;
-     int scrollbar_id;
-     int top;
-     int left;
-     int width;
-     int height;
+xg_update_scrollbar_pos (FRAME_PTR f,
+                         int scrollbar_id,
+                         int top,
+                         int left,
+                         int width,
+                         int height)
 {
 
   GtkWidget *wscroll = xg_get_widget_from_map (scrollbar_id);
@@ -3278,30 +3392,35 @@ xg_update_scrollbar_pos (f, scrollbar_id, top, left, width, height)
     {
       GtkWidget *wfixed = f->output_data.x->edit_widget;
       GtkWidget *wparent = gtk_widget_get_parent (wscroll);
-      GtkFixed *wf = GTK_FIXED (wfixed);
+      gint msl;
 
       /* Clear out old position.  */
-      GList *iter;
       int oldx = -1, oldy = -1, oldw, oldh;
-      for (iter = wf->children; iter; iter = iter->next)
-        if (((GtkFixedChild *)iter->data)->widget == wparent)
-          {
-            GtkFixedChild *ch = (GtkFixedChild *)iter->data;
-            if (ch->x != left || ch->y != top)
-              {
-                oldx = ch->x;
-                oldy = ch->y;
-                gtk_widget_get_size_request (wscroll, &oldw, &oldh);
-              }
-            break;
-          }
+      if (gtk_widget_get_parent (wparent) == wfixed)
+        {
+          gtk_container_child_get (GTK_CONTAINER (wfixed), wparent,
+                                   "x", &oldx, "y", &oldy, NULL);
+          gtk_widget_get_size_request (wscroll, &oldw, &oldh);
+        }
 
       /* Move and resize to new values.  */
       gtk_fixed_move (GTK_FIXED (wfixed), wparent, left, top);
-      gtk_widget_set_size_request (wscroll, width, height);
+      gtk_widget_style_get (wscroll, "min-slider-length", &msl, NULL);
+      if (msl > height)
+        {
+          /* No room.  Hide scroll bar as some themes output a warning if
+             the height is less than the min size.  */
+          gtk_widget_hide (wparent);
+          gtk_widget_hide (wscroll);
+        }
+      else
+        {
+          gtk_widget_show_all (wparent);
+          gtk_widget_set_size_request (wscroll, width, height);
+        }
       gtk_widget_queue_draw (wfixed);
       gdk_window_process_all_updates ();
-      if (oldx != -1
+      if (oldx != -1 && oldw > 0 && oldh > 0)
         {
           /* Clear under old scroll bar position.  This must be done after
              the gtk_widget_queue_draw and gdk_window_process_all_updates
@@ -3325,9 +3444,10 @@ xg_update_scrollbar_pos (f, scrollbar_id, top, left, width, height)
    displaying PORTION out of a whole WHOLE, and our position POSITION.  */
 
 void
-xg_set_toolkit_scroll_bar_thumb (bar, portion, position, whole)
-     struct scroll_bar *bar;
-     int portion, position, whole;
+xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar,
+                                 int portion,
+                                 int position,
+                                 int whole)
 {
   GtkWidget *wscroll = xg_get_widget_from_map (bar->x_window);
 
@@ -3371,13 +3491,13 @@ xg_set_toolkit_scroll_bar_thumb (bar, portion, position, whole)
       /* Assume all lines are of equal size.  */
       new_step = size / max (1, FRAME_LINES (f));
 
-      if ((int) adj->page_size != size
-          || (int) adj->step_increment != new_step)
+      if ((int) gtk_adjustment_get_page_size (adj) != size
+          || (int) gtk_adjustment_get_step_increment (adj) != new_step)
         {
-          adj->page_size = size;
-          adj->step_increment = new_step;
+          gtk_adjustment_set_page_size (adj, size);
+          gtk_adjustment_set_step_increment (adj, new_step);
           /* Assume a page increment is about 95% of the page size  */
-          adj->page_increment = (int) (0.95*adj->page_size);
+          gtk_adjustment_set_page_increment (adj,(int) (0.95*size));
           changed = 1;
         }
 
@@ -3409,9 +3529,7 @@ xg_set_toolkit_scroll_bar_thumb (bar, portion, position, whole)
    Return non-zero if the event is for a scroll bar, zero otherwise.  */
 
 int
-xg_event_is_for_scrollbar (f, event)
-     FRAME_PTR f;
-     XEvent *event;
+xg_event_is_for_scrollbar (FRAME_PTR f, XEvent *event)
 {
   int retval = 0;
 
@@ -3420,15 +3538,15 @@ xg_event_is_for_scrollbar (f, 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)
-        != f->output_data.x->edit_widget->window;
+        != gtk_widget_get_window (f->output_data.x->edit_widget);
     }
   else if (f
            && ((event->type == ButtonRelease && event->xbutton.button < 4)
                || event->type == MotionNotify))
     {
       /* If we are releasing or moving the scroll bar, it has the grab.  */
-      retval = gtk_grab_get_current () != 0
-        && gtk_grab_get_current () != f->output_data.x->edit_widget;
+      GtkWidget *w = gtk_grab_get_current ();
+      retval = w != 0 && GTK_IS_SCROLLBAR (w);
     }
   
   return retval;
@@ -3466,10 +3584,9 @@ xg_event_is_for_scrollbar (f, event)
    tool bar.  0 is the first button.  */
 
 static gboolean
-xg_tool_bar_button_cb (widget, event, user_data)
-    GtkWidget      *widget;
-    GdkEventButton *event;
-    gpointer        user_data;
+xg_tool_bar_button_cb (GtkWidget *widget,
+                       GdkEventButton *event,
+                       gpointer user_data)
 {
   /* Casts to avoid warnings when gpointer is 64 bits and int is 32 bits */
   gpointer ptr = (gpointer) (EMACS_INT) event->state;
@@ -3484,9 +3601,7 @@ xg_tool_bar_button_cb (widget, event, user_data)
    tool bar.  0 is the first button.  */
 
 static void
-xg_tool_bar_callback (w, client_data)
-     GtkWidget *w;
-     gpointer client_data;
+xg_tool_bar_callback (GtkWidget *w, gpointer client_data)
 {
   /* The EMACS_INT cast avoids a warning. */
   int idx = (int) (EMACS_INT) client_data;
@@ -3535,9 +3650,7 @@ xg_tool_bar_callback (w, client_data)
    tool bar.  0 is the first button.  */
 
 static void
-xg_tool_bar_proxy_callback (w, client_data)
-     GtkWidget *w;
-     gpointer client_data;
+xg_tool_bar_proxy_callback (GtkWidget *w, gpointer client_data)
 {
   GtkWidget *wbutton = GTK_WIDGET (g_object_get_data (G_OBJECT (w),
                                                       XG_TOOL_BAR_PROXY_BUTTON));
@@ -3546,18 +3659,17 @@ xg_tool_bar_proxy_callback (w, client_data)
 
 
 static gboolean
-xg_tool_bar_help_callback P_ ((GtkWidget *w,
-                               GdkEventCrossing *event,
-                               gpointer client_data));
+xg_tool_bar_help_callback (GtkWidget *w,
+                           GdkEventCrossing *event,
+                           gpointer client_data);
 
 /* This callback is called when a help is to be shown for an item in
    the detached tool bar when the detached tool bar it is not expanded.  */
 
 static gboolean
-xg_tool_bar_proxy_help_callback (w, event, client_data)
-     GtkWidget *w;
-     GdkEventCrossing *event;
-     gpointer client_data;
+xg_tool_bar_proxy_help_callback (GtkWidget *w,
+                                 GdkEventCrossing *event,
+                                 gpointer client_data)
 {
   GtkWidget *wbutton = GTK_WIDGET (g_object_get_data (G_OBJECT (w),
                                                       XG_TOOL_BAR_PROXY_BUTTON));
@@ -3565,6 +3677,17 @@ xg_tool_bar_proxy_help_callback (w, event, client_data)
   return xg_tool_bar_help_callback (wbutton, event, client_data);
 }
 
+static GtkWidget *
+xg_get_tool_bar_widgets (GtkWidget *vb, GtkWidget **wimage)
+{
+  GList *clist = gtk_container_get_children (GTK_CONTAINER (vb));
+  GtkWidget *c1 = (GtkWidget *) clist->data;
+  GtkWidget *c2 = (GtkWidget *) clist->next->data;
+  *wimage = GTK_IS_IMAGE (c1) ? c1 : c2;
+  g_list_free (clist);
+  return GTK_IS_LABEL (c1) ? c1 : c2;
+}
+
 
 /* This callback is called when a tool item should create a proxy item,
    such as for the overflow menu.  Also called when the tool bar is detached.
@@ -3572,21 +3695,24 @@ xg_tool_bar_proxy_help_callback (w, event, client_data)
    blank.  */
 
 static gboolean
-xg_tool_bar_menu_proxy (toolitem, user_data)
-     GtkToolItem *toolitem;
-     gpointer user_data;
+xg_tool_bar_menu_proxy (GtkToolItem *toolitem, gpointer user_data)
 {
   GtkWidget *weventbox = gtk_bin_get_child (GTK_BIN (toolitem));
   GtkButton *wbutton = GTK_BUTTON (gtk_bin_get_child (GTK_BIN (weventbox)));
-  GtkWidget *wmenuitem = gtk_image_menu_item_new_with_label ("");
+  GtkWidget *vb = gtk_bin_get_child (GTK_BIN (wbutton));
+  GtkWidget *c1;
+  GtkLabel *wlbl = GTK_LABEL (xg_get_tool_bar_widgets (vb, &c1));
+  GtkImage *wimage = GTK_IMAGE (c1);
+  GtkWidget *wmenuitem = gtk_image_menu_item_new_with_label
+    (gtk_label_get_text (wlbl));
   GtkWidget *wmenuimage;
 
+
   if (gtk_button_get_use_stock (wbutton))
     wmenuimage = gtk_image_new_from_stock (gtk_button_get_label (wbutton),
                                            GTK_ICON_SIZE_MENU);
   else
     {
-      GtkImage *wimage = GTK_IMAGE (gtk_bin_get_child (GTK_BIN (wbutton)));
       GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (wbutton));
       GtkImageType store_type = gtk_image_get_storage_type (wimage);
 
@@ -3652,7 +3778,8 @@ xg_tool_bar_menu_proxy (toolitem, user_data)
   g_object_set_data (G_OBJECT (wmenuitem), XG_TOOL_BAR_PROXY_BUTTON,
                      (gpointer) wbutton);
   gtk_tool_item_set_proxy_menu_item (toolitem, "Emacs toolbar item", wmenuitem);
-  gtk_widget_set_sensitive (wmenuitem, GTK_WIDGET_SENSITIVE (wbutton));
+  gtk_widget_set_sensitive (wmenuitem,
+                            gtk_widget_get_sensitive (GTK_WIDGET (wbutton)));
 
   /* Use enter/leave notify to show help.  We use the events
      rather than the GtkButton specific signals "enter" and
@@ -3678,10 +3805,9 @@ xg_tool_bar_menu_proxy (toolitem, user_data)
    CLIENT_DATA is a pointer to the frame the tool bar belongs to.  */
 
 static void
-xg_tool_bar_detach_callback (wbox, w, client_data)
-     GtkHandleBox *wbox;
-     GtkWidget *w;
-     gpointer client_data;
+xg_tool_bar_detach_callback (GtkHandleBox *wbox,
+                             GtkWidget *w,
+                             gpointer client_data)
 {
   FRAME_PTR f = (FRAME_PTR) client_data;
   extern int x_gtk_whole_detached_tool_bar;
@@ -3691,13 +3817,21 @@ xg_tool_bar_detach_callback (wbox, w, client_data)
 
   if (f)
     {
+      GtkRequisition req, req2;
       FRAME_X_OUTPUT (f)->toolbar_detached = 1;
-
-      /* When detaching a tool bar, not everything dissapear.  There are
-         a few pixels left that are used to drop the tool bar back into
-         place.  */
-      FRAME_TOOLBAR_HEIGHT (f) = 4;
-      xg_height_changed (f);
+      gtk_widget_size_request (GTK_WIDGET (wbox), &req);
+      gtk_widget_size_request (w, &req2);
+      req.width -= req2.width;
+      req.height -= req2.height;
+      if (FRAME_TOOLBAR_TOP_HEIGHT (f) != 0)
+        FRAME_TOOLBAR_TOP_HEIGHT (f) = req.height;
+      else if (FRAME_TOOLBAR_BOTTOM_HEIGHT (f) != 0)
+        FRAME_TOOLBAR_BOTTOM_HEIGHT (f) = req.height;
+      else if (FRAME_TOOLBAR_RIGHT_WIDTH (f) != 0)
+        FRAME_TOOLBAR_RIGHT_WIDTH (f) = req.width;
+      else if (FRAME_TOOLBAR_LEFT_WIDTH (f) != 0)
+        FRAME_TOOLBAR_LEFT_WIDTH (f) = req.width;
+      xg_height_or_width_changed (f);
     }
 }
 
@@ -3709,23 +3843,30 @@ xg_tool_bar_detach_callback (wbox, w, client_data)
    CLIENT_DATA is a pointer to the frame the tool bar belongs to.  */
 
 static void
-xg_tool_bar_attach_callback (wbox, w, client_data)
-     GtkHandleBox *wbox;
-     GtkWidget *w;
-     gpointer client_data;
+xg_tool_bar_attach_callback (GtkHandleBox *wbox,
+                             GtkWidget *w,
+                             gpointer client_data)
 {
   FRAME_PTR f = (FRAME_PTR) client_data;
   g_object_set (G_OBJECT (w), "show-arrow", TRUE, NULL);
 
   if (f)
     {
-      GtkRequisition req;
-
+      GtkRequisition req, req2;
       FRAME_X_OUTPUT (f)->toolbar_detached = 0;
-
-      gtk_widget_size_request (w, &req);
-      FRAME_TOOLBAR_HEIGHT (f) = req.height;
-      xg_height_changed (f);
+      gtk_widget_size_request (GTK_WIDGET (wbox), &req);
+      gtk_widget_size_request (w, &req2);
+      req.width += req2.width;
+      req.height += req2.height;
+      if (FRAME_TOOLBAR_TOP_HEIGHT (f) != 0)
+        FRAME_TOOLBAR_TOP_HEIGHT (f) = req.height;
+      else if (FRAME_TOOLBAR_BOTTOM_HEIGHT (f) != 0)
+        FRAME_TOOLBAR_BOTTOM_HEIGHT (f) = req.height;
+      else if (FRAME_TOOLBAR_RIGHT_WIDTH (f) != 0)
+        FRAME_TOOLBAR_RIGHT_WIDTH (f) = req.width;
+      else if (FRAME_TOOLBAR_LEFT_WIDTH (f) != 0)
+        FRAME_TOOLBAR_LEFT_WIDTH (f) = req.width;
+      xg_height_or_width_changed (f);
     }
 }
 
@@ -3739,10 +3880,9 @@ xg_tool_bar_attach_callback (wbox, w, client_data)
    Returns FALSE to tell GTK to keep processing this event.  */
 
 static gboolean
-xg_tool_bar_help_callback (w, event, client_data)
-     GtkWidget *w;
-     GdkEventCrossing *event;
-     gpointer client_data;
+xg_tool_bar_help_callback (GtkWidget *w,
+                           GdkEventCrossing *event,
+                           gpointer client_data)
 {
   /* The EMACS_INT cast avoids a warning. */
   int idx = (int) (EMACS_INT) client_data;
@@ -3781,10 +3921,9 @@ xg_tool_bar_help_callback (w, event, client_data)
    Returns FALSE to tell GTK to keep processing this event.  */
 
 static gboolean
-xg_tool_bar_item_expose_callback (w, event, client_data)
-     GtkWidget *w;
-     GdkEventExpose *event;
-     gpointer client_data;
+xg_tool_bar_item_expose_callback (GtkWidget *w,
+                                  GdkEventExpose *event,
+                                  gpointer client_data)
 {
   gint width, height;
 
@@ -3802,37 +3941,66 @@ xg_tool_bar_item_expose_callback (w, event, client_data)
   return FALSE;
 }
 
+#ifdef HAVE_GTK_ORIENTABLE_SET_ORIENTATION
+#define toolbar_set_orientation(w, o) \
+  gtk_orientable_set_orientation (GTK_ORIENTABLE (w), o)
+#else
+#define toolbar_set_orientation(w, o) \
+  gtk_toolbar_set_orientation (GTK_TOOLBAR (w), o)
+#endif
+
 /* Attach a tool bar to frame F.  */
 
 static void
-xg_pack_tool_bar (f)
-     FRAME_PTR f;
+xg_pack_tool_bar (FRAME_PTR f, Lisp_Object pos)
 {
   struct x_output *x = f->output_data.x;
-  int vbox_pos = x->menubar_widget ? 1 : 0;
-
-  x->handlebox_widget = gtk_handle_box_new ();
-  g_signal_connect (G_OBJECT (x->handlebox_widget), "child-detached",
-                    G_CALLBACK (xg_tool_bar_detach_callback), f);
-  g_signal_connect (G_OBJECT (x->handlebox_widget), "child-attached",
-                    G_CALLBACK (xg_tool_bar_attach_callback), f);
+  int into_hbox = EQ (pos, Qleft) || EQ (pos, Qright);
 
-  gtk_container_add (GTK_CONTAINER (x->handlebox_widget),
-                     x->toolbar_widget);
-
-  gtk_box_pack_start (GTK_BOX (x->vbox_widget), x->handlebox_widget,
-                      FALSE, FALSE, 0);
+  toolbar_set_orientation (x->toolbar_widget,
+                           into_hbox
+                           ? GTK_ORIENTATION_VERTICAL
+                           : GTK_ORIENTATION_HORIZONTAL);
+  if (!x->handlebox_widget)
+    {
+      x->handlebox_widget = gtk_handle_box_new ();
+      g_signal_connect (G_OBJECT (x->handlebox_widget), "child-detached",
+                        G_CALLBACK (xg_tool_bar_detach_callback), f);
+      g_signal_connect (G_OBJECT (x->handlebox_widget), "child-attached",
+                        G_CALLBACK (xg_tool_bar_attach_callback), f);
+      gtk_container_add (GTK_CONTAINER (x->handlebox_widget),
+                         x->toolbar_widget);
+    }
 
-  gtk_box_reorder_child (GTK_BOX (x->vbox_widget), x->handlebox_widget,
-                         vbox_pos);
-  gtk_widget_show_all (x->handlebox_widget);
+  if (into_hbox) 
+    {
+      gtk_box_pack_start (GTK_BOX (x->hbox_widget), x->handlebox_widget,
+                          FALSE, FALSE, 0);
+
+      if (EQ (pos, Qleft))
+        gtk_box_reorder_child (GTK_BOX (x->hbox_widget),
+                               x->handlebox_widget,
+                               0);
+      x->toolbar_in_hbox = 1;
+    }
+  else
+    {
+      int vbox_pos = x->menubar_widget ? 1 : 0;
+      gtk_box_pack_start (GTK_BOX (x->vbox_widget), x->handlebox_widget,
+                          FALSE, FALSE, 0);
+
+      if (EQ (pos, Qtop))
+        gtk_box_reorder_child (GTK_BOX (x->vbox_widget),
+                               x->handlebox_widget,
+                               vbox_pos);
+      x->toolbar_in_hbox = 0;
+    }
 }
 
 /* Create a tool bar for frame F.  */
 
 static void
-xg_create_tool_bar (f)
-     FRAME_PTR f;
+xg_create_tool_bar (FRAME_PTR f)
 {
   struct x_output *x = f->output_data.x;
 
@@ -3841,16 +4009,8 @@ xg_create_tool_bar (f)
 
   gtk_widget_set_name (x->toolbar_widget, "emacs-toolbar");
 
-  /* We only have icons, so override any user setting.  We could
-     use the caption property of the toolbar item (see update_frame_tool_bar
-     below), but some of those strings are long, making the toolbar so
-     long it does not fit on the screen.  The GtkToolbar widget makes every
-     item equal size, so the longest caption determine the size of every
-     tool bar item.  I think the creators of the GtkToolbar widget
-     counted on 4 or 5 character long strings.  */
   gtk_toolbar_set_style (GTK_TOOLBAR (x->toolbar_widget), GTK_TOOLBAR_ICONS);
-  gtk_toolbar_set_orientation (GTK_TOOLBAR (x->toolbar_widget),
-                               GTK_ORIENTATION_HORIZONTAL);
+  toolbar_set_orientation (x->toolbar_widget, GTK_ORIENTATION_HORIZONTAL);
 }
 
 
@@ -3860,10 +4020,7 @@ xg_create_tool_bar (f)
    Returns IMAGE if RTL is not found.  */
 
 static Lisp_Object
-find_rtl_image (f, image, rtl)
-     FRAME_PTR f;
-     Lisp_Object image;
-     Lisp_Object rtl;
+find_rtl_image (FRAME_PTR f, Lisp_Object image, Lisp_Object rtl)
 {
   int i;
   Lisp_Object file, rtl_name;
@@ -3890,16 +4047,192 @@ find_rtl_image (f, image, rtl)
   return image;
 }
 
-/* Update the tool bar for frame F.  Add new buttons and remove old.  */
+static GtkToolItem *
+xg_make_tool_item (FRAME_PTR f,
+                   GtkWidget *wimage,
+                   GtkWidget **wbutton,
+                   const char *label,
+                   int i)
+{
+  GtkToolItem *ti = gtk_tool_item_new ();
+  Lisp_Object style = Ftool_bar_get_system_style ();
+  int both_horiz = EQ (style, Qboth_horiz);
+  int text_image = EQ (style, Qtext_image_horiz);
+  
+  GtkWidget *vb = both_horiz || text_image
+    ? gtk_hbox_new (FALSE, 0) : gtk_vbox_new (FALSE, 0);
+  GtkWidget *wb = gtk_button_new ();
+  GtkWidget *weventbox = gtk_event_box_new ();
+
+  if (wimage && ! text_image)
+    gtk_box_pack_start (GTK_BOX (vb), wimage, TRUE, TRUE, 0);
+
+  gtk_box_pack_start (GTK_BOX (vb), gtk_label_new (label), TRUE, TRUE, 0);
+
+  if (wimage && text_image)
+    gtk_box_pack_start (GTK_BOX (vb), wimage, TRUE, TRUE, 0);
+
+  gtk_button_set_focus_on_click (GTK_BUTTON (wb), FALSE);
+  gtk_button_set_relief (GTK_BUTTON (wb), GTK_RELIEF_NONE);
+  gtk_container_add (GTK_CONTAINER (wb), vb);
+  gtk_container_add (GTK_CONTAINER (weventbox), wb);
+  gtk_container_add (GTK_CONTAINER (ti), weventbox);
+
+  if (wimage)
+    {
+      /* The EMACS_INT cast avoids a warning. */
+      g_signal_connect (G_OBJECT (ti), "create-menu-proxy",
+                        G_CALLBACK (xg_tool_bar_menu_proxy),
+                        (gpointer) (EMACS_INT) i);
+
+      g_signal_connect (G_OBJECT (wb), "clicked",
+                        G_CALLBACK (xg_tool_bar_callback),
+                        (gpointer) (EMACS_INT) i);
+
+      g_object_set_data (G_OBJECT (weventbox), XG_FRAME_DATA, (gpointer)f);
+
+      /* Catch expose events to overcome an annoying redraw bug, see
+         comment for xg_tool_bar_item_expose_callback.  */
+      g_signal_connect (G_OBJECT (ti),
+                        "expose-event",
+                        G_CALLBACK (xg_tool_bar_item_expose_callback),
+                        0);
+
+      gtk_tool_item_set_homogeneous (ti, FALSE);
+
+      /* Callback to save modifyer mask (Shift/Control, etc).  GTK makes
+         no distinction based on modifiers in the activate callback,
+         so we have to do it ourselves.  */
+      g_signal_connect (wb, "button-release-event",
+                        G_CALLBACK (xg_tool_bar_button_cb),
+                        NULL);
+
+      g_object_set_data (G_OBJECT (wb), XG_FRAME_DATA, (gpointer)f);
+          
+      /* Use enter/leave notify to show help.  We use the events
+         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),
+                        (gpointer) (EMACS_INT) i);
+      g_signal_connect (G_OBJECT (weventbox),
+                        "leave-notify-event",
+                        G_CALLBACK (xg_tool_bar_help_callback),
+                        (gpointer) (EMACS_INT) i);
+    }
+  
+  if (wbutton) *wbutton = wb;
 
-extern Lisp_Object Qx_gtk_map_stock;
+  return ti;
+}
+
+static void
+xg_show_toolbar_item (GtkToolItem *ti)
+{
+  Lisp_Object style = Ftool_bar_get_system_style ();
+  int both_horiz = EQ (style, Qboth_horiz);
+  int text_image = EQ (style, Qtext_image_horiz);
+
+  int horiz = both_horiz || text_image;
+  int show_label = ! EQ (style, Qimage);
+  int show_image = ! EQ (style, Qtext);
+
+  GtkWidget *weventbox = gtk_bin_get_child (GTK_BIN (ti));
+  GtkWidget *wbutton = gtk_bin_get_child (GTK_BIN (weventbox));
+  GtkWidget *vb = gtk_bin_get_child (GTK_BIN (wbutton));
+  GtkWidget *wimage;
+  GtkWidget *wlbl = xg_get_tool_bar_widgets (vb, &wimage);
+  GtkWidget *new_box = NULL;
+
+  if (GTK_IS_VBOX (vb) && horiz)
+    new_box = gtk_hbox_new (FALSE, 0);
+  else if (GTK_IS_HBOX (vb) && !horiz && show_label && show_image)
+    new_box = gtk_vbox_new (FALSE, 0);
+
+  if (!new_box && horiz)
+      gtk_box_reorder_child (GTK_BOX (vb), wlbl, text_image ? 0 : 1);
+  else if (new_box)
+    {
+      g_object_ref (G_OBJECT (wimage));
+      g_object_ref (G_OBJECT (wlbl));
+      gtk_container_remove (GTK_CONTAINER (vb), wimage);
+      gtk_container_remove (GTK_CONTAINER (vb), wlbl);
+      gtk_widget_destroy (GTK_WIDGET (vb));
+      if (! text_image)
+        gtk_box_pack_start (GTK_BOX (new_box), wimage, TRUE, TRUE, 0);
+      gtk_box_pack_start (GTK_BOX (new_box), wlbl, TRUE, TRUE, 0);
+      if (text_image)
+        gtk_box_pack_start (GTK_BOX (new_box), wimage, TRUE, TRUE, 0);
+      gtk_container_add (GTK_CONTAINER (wbutton), new_box);
+      g_object_unref (G_OBJECT (wimage));
+      g_object_unref (G_OBJECT (wlbl));
+      vb = new_box;
+    }
+
+  if (show_label) gtk_widget_show (wlbl);
+  else gtk_widget_hide (wlbl);
+  if (show_image) gtk_widget_show (wimage);
+  else gtk_widget_hide (wimage);
+  gtk_widget_show (GTK_WIDGET (weventbox));
+  gtk_widget_show (GTK_WIDGET (vb));
+  gtk_widget_show (GTK_WIDGET (wbutton));
+  gtk_widget_show (GTK_WIDGET (ti));
+}
+
+static int
+xg_update_tool_bar_sizes (FRAME_PTR f)
+{
+  struct x_output *x = f->output_data.x;
+  GtkRequisition req;
+  int nl = 0, nr = 0, nt = 0, nb = 0;
+
+  gtk_widget_size_request (GTK_WIDGET (x->handlebox_widget), &req);
+  if (x->toolbar_in_hbox)
+    {
+      int pos;
+      gtk_container_child_get (GTK_CONTAINER (x->hbox_widget),
+                               x->handlebox_widget,
+                               "position", &pos, NULL);
+      if (pos == 0) nl = req.width;
+      else nr = req.width;
+    }
+  else
+    {
+      int pos;
+      gtk_container_child_get (GTK_CONTAINER (x->vbox_widget),
+                               x->handlebox_widget,
+                               "position", &pos, NULL);
+      if (pos == 0 || (pos == 1 && x->menubar_widget)) nt = req.height;
+      else nb = req.height;
+    }
+  
+  if (nl != FRAME_TOOLBAR_LEFT_WIDTH (f)
+      || nr != FRAME_TOOLBAR_RIGHT_WIDTH (f)
+      || nt != FRAME_TOOLBAR_TOP_HEIGHT (f)
+      || nb != FRAME_TOOLBAR_BOTTOM_HEIGHT (f))
+    {
+      FRAME_TOOLBAR_RIGHT_WIDTH (f) = FRAME_TOOLBAR_LEFT_WIDTH (f)
+        = FRAME_TOOLBAR_TOP_HEIGHT (f) = FRAME_TOOLBAR_BOTTOM_HEIGHT (f) = 0;
+      FRAME_TOOLBAR_LEFT_WIDTH (f) = nl;
+      FRAME_TOOLBAR_RIGHT_WIDTH (f) = nr;
+      FRAME_TOOLBAR_TOP_HEIGHT (f) = nt;
+      FRAME_TOOLBAR_BOTTOM_HEIGHT (f) = nb;
+      return 1;
+    }
+
+  return 0;
+}
+
+
+/* Update the tool bar for frame F.  Add new buttons and remove old.  */
 
 void
-update_frame_tool_bar (f)
-     FRAME_PTR f;
+update_frame_tool_bar (FRAME_PTR f)
 {
   int i;
-  GtkRequisition old_req, new_req;
   struct x_output *x = f->output_data.x;
   int hmargin = 0, vmargin = 0;
   GtkToolbar *wtoolbar;
@@ -3940,9 +4273,8 @@ update_frame_tool_bar (f)
     xg_create_tool_bar (f);
 
   wtoolbar = GTK_TOOLBAR (x->toolbar_widget);
-  gtk_widget_size_request (GTK_WIDGET (wtoolbar), &old_req);
-  dir = gtk_widget_get_direction (x->toolbar_widget);
-
+  dir = gtk_widget_get_direction (GTK_WIDGET (wtoolbar));
+  
   for (i = 0; i < f->n_tool_bar_items; ++i)
     {
       int enabled_p = !NILP (PROP (TOOL_BAR_ITEM_ENABLED_P));
@@ -3960,8 +4292,10 @@ update_frame_tool_bar (f)
       GtkWidget *wbutton = NULL;
       GtkWidget *weventbox;
       Lisp_Object specified_file;
-
-      ti = gtk_toolbar_get_nth_item (GTK_TOOLBAR (x->toolbar_widget), i);
+      const char *label = (STRINGP (PROP (TOOL_BAR_ITEM_LABEL))
+                           ? SSDATA (PROP (TOOL_BAR_ITEM_LABEL)) : "");
+      
+      ti = gtk_toolbar_get_nth_item (GTK_TOOLBAR (wtoolbar), i);
 
       if (ti)
         {
@@ -3969,6 +4303,7 @@ update_frame_tool_bar (f)
           wbutton = gtk_bin_get_child (GTK_BIN (weventbox));
         }
 
+
       image = PROP (TOOL_BAR_ITEM_IMAGES);
 
       /* Ignore invalid image specifications.  */
@@ -4000,7 +4335,7 @@ update_frame_tool_bar (f)
                 icon_size = gtk_toolbar_get_icon_size (wtoolbar);
             }
           else if (gtk_stock_lookup (SSDATA (stock), &stock_item))
-              icon_size = gtk_toolbar_get_icon_size (wtoolbar);
+            icon_size = gtk_toolbar_get_icon_size (wtoolbar);
           else
             {
               stock = Qnil;
@@ -4044,22 +4379,15 @@ update_frame_tool_bar (f)
 
           if (img->load_failed_p || img->pixmap == None)
             {
-                if (ti)
-                    gtk_widget_hide_all (GTK_WIDGET (ti));
-                else
+              if (ti)
+                gtk_widget_hide_all (GTK_WIDGET (ti));
+              else
                 {
-                    /* Insert an empty (non-image) button */
-                    weventbox = gtk_event_box_new ();
-                    wbutton = gtk_button_new ();
-                    gtk_button_set_focus_on_click (GTK_BUTTON (wbutton), FALSE);
-                    gtk_button_set_relief (GTK_BUTTON (wbutton),
-                                           GTK_RELIEF_NONE);
-                    gtk_container_add (GTK_CONTAINER (weventbox), wbutton);
-                    ti = gtk_tool_item_new ();
-                    gtk_container_add (GTK_CONTAINER (ti), weventbox);
-                    gtk_toolbar_insert (GTK_TOOLBAR (x->toolbar_widget), ti, -1);
+                  /* Insert an empty (non-image) button */
+                  ti = xg_make_tool_item (f, NULL, NULL, "", i);
+                  gtk_toolbar_insert (GTK_TOOLBAR (wtoolbar), ti, -1);
                 }
-                continue;
+              continue;
             }
         }
 
@@ -4090,73 +4418,23 @@ update_frame_tool_bar (f)
             }
 
           gtk_misc_set_padding (GTK_MISC (w), hmargin, vmargin);
-          wbutton = gtk_button_new ();
-          gtk_button_set_focus_on_click (GTK_BUTTON (wbutton), FALSE);
-          gtk_button_set_relief (GTK_BUTTON (wbutton), GTK_RELIEF_NONE);
-          gtk_container_add (GTK_CONTAINER (wbutton), w);
-          weventbox = gtk_event_box_new ();
-          gtk_container_add (GTK_CONTAINER (weventbox), wbutton);
-          ti = gtk_tool_item_new ();
-          gtk_container_add (GTK_CONTAINER (ti), weventbox);
-          gtk_toolbar_insert (GTK_TOOLBAR (x->toolbar_widget), ti, -1);
-
-
-          /* The EMACS_INT cast avoids a warning. */
-          g_signal_connect (G_OBJECT (ti), "create-menu-proxy",
-                            G_CALLBACK (xg_tool_bar_menu_proxy),
-                            (gpointer) (EMACS_INT) i);
-
-          g_signal_connect (G_OBJECT (wbutton), "clicked",
-                            G_CALLBACK (xg_tool_bar_callback),
-                            (gpointer) (EMACS_INT) i);
-
-          gtk_widget_show_all (GTK_WIDGET (ti));
-
-
-          g_object_set_data (G_OBJECT (weventbox), XG_FRAME_DATA, (gpointer)f);
-
-          /* Catch expose events to overcome an annoying redraw bug, see
-             comment for xg_tool_bar_item_expose_callback.  */
-          g_signal_connect (G_OBJECT (ti),
-                            "expose-event",
-                            G_CALLBACK (xg_tool_bar_item_expose_callback),
-                            0);
-
+          ti = xg_make_tool_item (f, w, &wbutton, label, i);
+          gtk_toolbar_insert (GTK_TOOLBAR (wtoolbar), ti, -1);
           gtk_widget_set_sensitive (wbutton, enabled_p);
-          gtk_tool_item_set_homogeneous (ti, FALSE);
-
-          /* Callback to save modifyer mask (Shift/Control, etc).  GTK makes
-             no distinction based on modifiers in the activate callback,
-             so we have to do it ourselves.  */
-          g_signal_connect (wbutton, "button-release-event",
-                            G_CALLBACK (xg_tool_bar_button_cb),
-                            NULL);
-
-          g_object_set_data (G_OBJECT (wbutton), XG_FRAME_DATA, (gpointer)f);
-          
-          /* Use enter/leave notify to show help.  We use the events
-             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),
-                            (gpointer) (EMACS_INT) i);
-          g_signal_connect (G_OBJECT (weventbox),
-                            "leave-notify-event",
-                            G_CALLBACK (xg_tool_bar_help_callback),
-                            (gpointer) (EMACS_INT) i);
         }
       else
         {
-          GtkWidget *wimage = gtk_bin_get_child (GTK_BIN (wbutton));
+          GtkWidget *vb = gtk_bin_get_child (GTK_BIN (wbutton));
+          GtkWidget *wimage;
+          GtkWidget *wlbl = xg_get_tool_bar_widgets (vb, &wimage);
+
           Pixmap old_img = (Pixmap)g_object_get_data (G_OBJECT (wimage),
                                                       XG_TOOL_BAR_IMAGE_DATA);
           gpointer old_stock_name = g_object_get_data (G_OBJECT (wimage),
                                                        XG_TOOL_BAR_STOCK_NAME);
           gpointer old_icon_name = g_object_get_data (G_OBJECT (wimage),
                                                       XG_TOOL_BAR_ICON_NAME);
+          gtk_label_set_text (GTK_LABEL (wlbl), label);
           if (stock_name &&
               (! old_stock_name || strcmp (old_stock_name, stock_name) != 0))
             {
@@ -4167,7 +4445,8 @@ update_frame_tool_bar (f)
                                       (GDestroyNotify) xfree);
               g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_IMAGE_DATA,
                                  NULL);
-              g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_ICON_NAME, NULL);
+              g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_ICON_NAME,
+                                 NULL);
             }
           else if (icon_name &&
                    (! old_icon_name || strcmp (old_icon_name, icon_name) != 0))
@@ -4184,20 +4463,22 @@ update_frame_tool_bar (f)
             }
           else if (img && old_img != img->pixmap)
             {
-              (void) xg_get_image_for_pixmap (f, img, x->widget, wimage);
+              (void) xg_get_image_for_pixmap (f, img, x->widget,
+                                              GTK_IMAGE (wimage));
               g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_IMAGE_DATA,
                                  (gpointer)img->pixmap);
 
               g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_STOCK_NAME,
                                  NULL);
-              g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_ICON_NAME, NULL);
+              g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_ICON_NAME,
+                                 NULL);
             }
 
           gtk_misc_set_padding (GTK_MISC (wimage), hmargin, vmargin);
 
           gtk_widget_set_sensitive (wbutton, enabled_p);
-          gtk_widget_show_all (GTK_WIDGET (ti));
-       }
+        }
+      xg_show_toolbar_item (ti);
 
 #undef PROP
     }
@@ -4206,22 +4487,20 @@ update_frame_tool_bar (f)
      can be reused later on.  */
   do
     {
-      ti = gtk_toolbar_get_nth_item (GTK_TOOLBAR (x->toolbar_widget), i++);
+      ti = gtk_toolbar_get_nth_item (GTK_TOOLBAR (wtoolbar), i++);
       if (ti) gtk_widget_hide_all (GTK_WIDGET (ti));
     } while (ti != NULL);
 
-  new_req.height = 0;
-  if (pack_tool_bar && f->n_tool_bar_items != 0)
-      xg_pack_tool_bar (f);
-  
-
-  gtk_widget_size_request (GTK_WIDGET (x->toolbar_widget), &new_req);
-  if (old_req.height != new_req.height
-      && ! FRAME_X_OUTPUT (f)->toolbar_detached)
+  if (f->n_tool_bar_items != 0)
     {
-      FRAME_TOOLBAR_HEIGHT (f) = new_req.height;
-      xg_height_changed (f);
+      if (pack_tool_bar)
+        xg_pack_tool_bar (f, f->tool_bar_position);
+      gtk_widget_show (x->toolbar_widget);
+      gtk_widget_show (x->handlebox_widget);
+      if (xg_update_tool_bar_sizes (f))
+        xg_height_or_width_changed (f);
     }
+
   UNBLOCK_INPUT;
 }
 
@@ -4229,8 +4508,7 @@ update_frame_tool_bar (f)
    Remove the tool bar.  */
 
 void
-free_frame_tool_bar (f)
-     FRAME_PTR f;
+free_frame_tool_bar (FRAME_PTR f)
 {
   struct x_output *x = f->output_data.x;
 
@@ -4240,28 +4518,61 @@ free_frame_tool_bar (f)
       BLOCK_INPUT;
       /* We may have created the toolbar_widget in xg_create_tool_bar, but
          not the x->handlebox_widget which is created in xg_pack_tool_bar.  */
-      if (is_packed)
-        gtk_container_remove (GTK_CONTAINER (x->vbox_widget),
-                              x->handlebox_widget);
+      if (is_packed) 
+        {
+          if (x->toolbar_in_hbox)
+            gtk_container_remove (GTK_CONTAINER (x->hbox_widget),
+                                  x->handlebox_widget);
+          else
+            gtk_container_remove (GTK_CONTAINER (x->vbox_widget),
+                                  x->handlebox_widget);
+        }
       else
         gtk_widget_destroy (x->toolbar_widget);
 
       x->toolbar_widget = 0;
       x->handlebox_widget = 0;
-      FRAME_TOOLBAR_HEIGHT (f) = 0;
-      xg_height_changed (f);
+      FRAME_TOOLBAR_TOP_HEIGHT (f) = FRAME_TOOLBAR_BOTTOM_HEIGHT (f) = 0;
+      FRAME_TOOLBAR_LEFT_WIDTH (f) = FRAME_TOOLBAR_RIGHT_WIDTH (f) = 0;
+
+      xg_height_or_width_changed (f);
 
       UNBLOCK_INPUT;
     }
 }
 
+int
+xg_change_toolbar_position (FRAME_PTR f, Lisp_Object pos)
+{
+  struct x_output *x = f->output_data.x;
+
+  if (! x->toolbar_widget || ! x->handlebox_widget)
+    return 1;
+
+  BLOCK_INPUT;
+  g_object_ref (x->handlebox_widget);
+  if (x->toolbar_in_hbox)
+    gtk_container_remove (GTK_CONTAINER (x->hbox_widget),
+                          x->handlebox_widget);
+  else
+    gtk_container_remove (GTK_CONTAINER (x->vbox_widget),
+                          x->handlebox_widget);
+  xg_pack_tool_bar (f, pos);
+  g_object_unref (x->handlebox_widget);
+  if (xg_update_tool_bar_sizes (f))
+    xg_height_or_width_changed (f);
+
+  UNBLOCK_INPUT;
+  return 1;
+}
+
 
 \f
 /***********************************************************************
                       Initializing
- ***********************************************************************/
+***********************************************************************/
 void
-xg_initialize ()
+xg_initialize (void)
 {
   GtkBindingSet *binding_set;
 
index 7c1e09a1a5e74368a90456ce9ae2210edbcc36af..9b796e1138ceefb035a572b66421aacf71732a4d 100644 (file)
@@ -38,15 +38,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Key for data that menu items hold.  */
 #define XG_ITEM_DATA "emacs_menuitem"
 
-
-/* Button types in menus.  */
-enum button_type
-{
-  BUTTON_TYPE_NONE,
-  BUTTON_TYPE_TOGGLE,
-  BUTTON_TYPE_RADIO
-};
-
 /* This is a list node in a generic list implementation.  */
 typedef struct xg_list_node_
 {
@@ -83,132 +74,109 @@ typedef struct xg_menu_item_cb_data_
 } xg_menu_item_cb_data;
 
 
-/* Used to specify menus and dialogs.
-   This is an adaption from lwlib for Gtk so we can use more of the same
-   code as lwlib in xmenu.c.  */
-typedef struct _widget_value
-{
-  /* name of widget */
-  Lisp_Object   lname;
-  char         *name;
-  /* value (meaning depend on widget type) */
-  char         *value;
-  /* keyboard equivalent. no implications for XtTranslations */
-  Lisp_Object   lkey;
-  char         *key;
-  /* Help string or nil if none.
-     GC finds this string through the frame's menu_bar_vector
-     or through menu_items.  */
-  Lisp_Object  help;
-  /* true if enabled */
-  gint         enabled;
-  /* true if selected */
-  gint selected;
-  /* The type of a button.  */
-  enum button_type button_type;
-  /* Contents of the sub-widgets, also selected slot for checkbox */
-  struct _widget_value *contents;
-  /* data passed to callback */
-  gpointer     call_data;
-  /* next one in the list */
-  struct _widget_value *next;
-
-  /* we resource the widget_value structures; this points to the next
-     one on the free list if this one has been deallocated.
-   */
-  struct _widget_value *free_list;
-} widget_value;
-
-#ifdef HAVE_GTK_FILE_BOTH
+#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 char *xg_get_file_name (FRAME_PTR f,
+                               char *prompt,
+                               char *default_filename,
+                               int mustmatch_p,
+                               int only_dir_p);
+
+extern char *xg_get_font_name (FRAME_PTR f, const char *);
+
+extern GtkWidget *xg_create_widget (const char *type,
+                                    const char *name,
+                                    FRAME_PTR f,
+                                    struct _widget_value *val,
+                                    GCallback select_cb,
+                                    GCallback deactivate_cb,
+                                    GCallback hightlight_cb);
+
+extern void xg_modify_menubar_widgets (GtkWidget *menubar,
+                                       FRAME_PTR f,
+                                       struct _widget_value *val,
+                                       int deep_p,
+                                       GCallback select_cb,
+                                       GCallback deactivate_cb,
+                                       GCallback hightlight_cb);
+
+extern int xg_update_frame_menubar (FRAME_PTR f);
+
+extern int xg_event_is_for_menubar (FRAME_PTR f, XEvent *event);
+
+extern int xg_have_tear_offs (void);
+
+extern int xg_get_scroll_id_for_window (Display *dpy, Window wid);
+
+extern void xg_create_scroll_bar (FRAME_PTR f,
+                                  struct scroll_bar *bar,
+                                  GCallback scroll_callback,
+                                  GCallback end_callback,
+                                  const char *scroll_bar_name);
+extern void xg_remove_scroll_bar (FRAME_PTR f, int scrollbar_id);
+
+extern void xg_update_scrollbar_pos (FRAME_PTR f,
+                                     int scrollbar_id,
+                                     int top,
+                                     int left,
+                                     int width,
+                                     int height);
+
+extern void xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar,
+                                             int portion,
+                                             int position,
+                                             int whole);
+extern int xg_event_is_for_scrollbar (FRAME_PTR f, XEvent *event);
+
+extern void update_frame_tool_bar (FRAME_PTR f);
+extern void free_frame_tool_bar (FRAME_PTR f);
+extern int xg_change_toolbar_position (FRAME_PTR f, Lisp_Object pos);
+
+extern void xg_frame_resized (FRAME_PTR f,
+                              int pixelwidth,
+                              int pixelheight);
+extern void xg_frame_set_char_size (FRAME_PTR f, int cols, int rows);
+extern GtkWidget * xg_win_to_widget (Display *dpy, Window wdesc);
+
+extern void xg_display_open (char *display_name, Display **dpy);
+extern void xg_display_close (Display *dpy);
+extern GdkCursor * xg_create_default_cursor (Display *dpy);
+
+extern int xg_create_frame_widgets (FRAME_PTR f);
+extern void xg_free_frame_widgets (FRAME_PTR f);
+extern void x_wm_set_size_hint (FRAME_PTR f,
+                                long flags,
+                                int user_position);
+extern void xg_set_background_color (FRAME_PTR f, unsigned long bg);
+extern int xg_check_special_colors (struct frame *f,
+                                    const char *color_name,
+                                    XColor *color);
+
+extern void xg_set_frame_icon (FRAME_PTR f,
+                               Pixmap icon_pixmap,
+                               Pixmap icon_mask);
+
+extern int xg_prepare_tooltip (FRAME_PTR f,
+                               Lisp_Object string,
+                               int *width,
+                               int *height);
+extern void xg_show_tooltip (FRAME_PTR f, int root_x, int root_y);
+extern int xg_hide_tooltip (FRAME_PTR f);
 
-extern widget_value *malloc_widget_value P_ ((void));
-extern void free_widget_value P_ ((widget_value *));
-
-extern int xg_uses_old_file_dialog P_ ((void));
-
-extern char *xg_get_file_name P_ ((FRAME_PTR f,
-                                   char *prompt,
-                                   char *default_filename,
-                                   int mustmatch_p,
-                                   int only_dir_p));
-
-extern char *xg_get_font_name P_ ((FRAME_PTR f, char *));
-
-extern GtkWidget *xg_create_widget P_ ((char *type,
-                                        char *name,
-                                        FRAME_PTR f,
-                                        widget_value *val,
-                                        GCallback select_cb,
-                                        GCallback deactivate_cb,
-                                        GCallback hightlight_cb));
-
-extern void xg_modify_menubar_widgets P_ ((GtkWidget *menubar,
-                                           FRAME_PTR f,
-                                           widget_value *val,
-                                           int deep_p,
-                                           GCallback select_cb,
-                                           GCallback deactivate_cb,
-                                           GCallback hightlight_cb));
-
-extern int xg_update_frame_menubar P_ ((FRAME_PTR f));
-
-extern int xg_event_is_for_menubar P_ ((FRAME_PTR f, XEvent *event));
-
-extern int xg_have_tear_offs P_ ((void));
-
-extern int xg_get_scroll_id_for_window P_ ((Display *dpy, Window wid));
-
-extern void xg_create_scroll_bar P_ ((FRAME_PTR f,
-                                      struct scroll_bar *bar,
-                                      GCallback scroll_callback,
-                                      GCallback end_callback,
-                                      char *scroll_bar_name));
-extern void xg_show_scroll_bar P_ ((int scrollbar_id));
-extern void xg_remove_scroll_bar P_ ((FRAME_PTR f, int scrollbar_id));
-
-extern void xg_update_scrollbar_pos P_ ((FRAME_PTR f,
-                                         int scrollbar_id,
-                                         int top,
-                                         int left,
-                                         int width,
-                                         int height));
-
-extern void xg_set_toolkit_scroll_bar_thumb P_ ((struct scroll_bar *bar,
-                                                 int portion,
-                                                 int position,
-                                                 int whole));
-extern int xg_event_is_for_scrollbar P_ ((FRAME_PTR f, XEvent *event));
-
-extern void update_frame_tool_bar P_ ((FRAME_PTR f));
-extern void free_frame_tool_bar P_ ((FRAME_PTR f));
-
-extern void xg_frame_resized P_ ((FRAME_PTR f,
-                                  int pixelwidth,
-                                  int pixelheight));
-extern void xg_frame_set_char_size P_ ((FRAME_PTR f, int cols, int rows));
-extern GtkWidget * xg_win_to_widget P_ ((Display *dpy, Window wdesc));
-
-extern int xg_display_open P_ ((char *display_name, Display **dpy));
-extern void xg_display_close P_ ((Display *dpy));
-extern GdkCursor * xg_create_default_cursor P_ ((Display *dpy));
-
-extern int xg_create_frame_widgets P_ ((FRAME_PTR f));
-extern void x_wm_set_size_hint P_ ((FRAME_PTR f,
-                                    long flags,
-                                    int user_position));
-extern void xg_set_background_color P_ ((FRAME_PTR f, unsigned long bg));
-
-extern void xg_set_frame_icon P_ ((FRAME_PTR f,
-                                   Pixmap icon_pixmap,
-                                   Pixmap icon_mask));
 
 /* Mark all callback data that are Lisp_object:s during GC.  */
-extern void xg_mark_data P_ ((void));
+extern void xg_mark_data (void);
 
 /* Initialize GTK specific parts.  */
-extern void xg_initialize P_ ((void));
+extern void xg_initialize (void);
 
 /* Setting scrollbar values invokes the callback.  Use this variable
    to indicate that the callback should do nothing.  */
index e7db3a7df1b8855fa6ff9b3142a0a62b18ac4dd2..ae4bf2fd937b31f98941126c82fd723c23e3b419 100644 (file)
@@ -126,17 +126,20 @@ typedef struct ns_bitmap_record Bitmap_Record;
 
 Lisp_Object Vx_bitmap_file_path;
 
+/* The symbol `postscript' identifying images of this type.  */
+
+Lisp_Object Qpostscript;
 
-static void x_disable_image P_ ((struct frame *, struct image *));
-static void x_edge_detection P_ ((struct frame *, struct image *, Lisp_Object,
-                                 Lisp_Object));
+static void x_disable_image (struct frame *, struct image *);
+static void x_edge_detection (struct frame *, struct image *, Lisp_Object,
+                              Lisp_Object);
 
-static void init_color_table P_ ((void));
-static unsigned long lookup_rgb_color P_ ((struct frame *f, int r, int g, int b));
+static void init_color_table (void);
+static unsigned long lookup_rgb_color (struct frame *f, int r, int g, int b);
 #ifdef COLOR_TABLE_SUPPORT
-static void free_color_table P_ ((void));
-static unsigned long *colors_in_color_table P_ ((int *n));
-static unsigned long lookup_pixel_color P_ ((struct frame *f, unsigned long p));
+static void free_color_table (void);
+static unsigned long *colors_in_color_table (int *n);
+static unsigned long lookup_pixel_color (struct frame *f, unsigned long p);
 #endif
 
 /* Code to deal with bitmaps.  Bitmaps are referenced by their bitmap
@@ -157,7 +160,7 @@ XGetImage (Display *display, Pixmap pixmap, int x, int y,
            unsigned long plane_mask, int format)
 {
   /* TODO: not sure what this function is supposed to do.. */
-  ns_retain_object(pixmap);
+  ns_retain_object (pixmap);
   return pixmap;
 }
 
@@ -165,7 +168,7 @@ XGetImage (Display *display, Pixmap pixmap, int x, int y,
 unsigned long
 XGetPixel (XImagePtr ximage, int x, int y)
 {
-  return ns_get_pixel(ximage, x, y);
+  return ns_get_pixel (ximage, x, y);
 }
 
 /* use with imgs created by ns_image_for_XPM; alpha set to 1;
@@ -173,7 +176,7 @@ XGetPixel (XImagePtr ximage, int x, int y)
 void
 XPutPixel (XImagePtr ximage, int x, int y, unsigned long pixel)
 {
-  ns_put_pixel(ximage, x, y, pixel);
+  ns_put_pixel (ximage, x, y, pixel);
 }
 #endif /* HAVE_NS */
 
@@ -181,26 +184,20 @@ XPutPixel (XImagePtr ximage, int x, int y, unsigned long pixel)
 /* Functions to access the contents of a bitmap, given an id.  */
 
 int
-x_bitmap_height (f, id)
-     FRAME_PTR f;
-     int id;
+x_bitmap_height (FRAME_PTR f, int id)
 {
   return FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].height;
 }
 
 int
-x_bitmap_width (f, id)
-     FRAME_PTR f;
-     int id;
+x_bitmap_width (FRAME_PTR f, int id)
 {
   return FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].width;
 }
 
 #if defined (HAVE_X_WINDOWS) || defined (HAVE_NTGUI)
 int
-x_bitmap_pixmap (f, id)
-     FRAME_PTR f;
-     int id;
+x_bitmap_pixmap (FRAME_PTR f, int id)
 {
   return (int) FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].pixmap;
 }
@@ -208,9 +205,7 @@ x_bitmap_pixmap (f, id)
 
 #ifdef HAVE_X_WINDOWS
 int
-x_bitmap_mask (f, id)
-     FRAME_PTR f;
-     int id;
+x_bitmap_mask (FRAME_PTR f, int id)
 {
   return FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].mask;
 }
@@ -219,8 +214,7 @@ x_bitmap_mask (f, id)
 /* Allocate a new bitmap record.  Returns index of new record.  */
 
 static int
-x_allocate_bitmap_record (f)
-     FRAME_PTR f;
+x_allocate_bitmap_record (FRAME_PTR f)
 {
   Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
   int i;
@@ -251,9 +245,7 @@ x_allocate_bitmap_record (f)
 /* Add one reference to the reference count of the bitmap with id ID.  */
 
 void
-x_reference_bitmap (f, id)
-     FRAME_PTR f;
-     int id;
+x_reference_bitmap (FRAME_PTR f, int id)
 {
   ++FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].refcount;
 }
@@ -261,10 +253,7 @@ x_reference_bitmap (f, id)
 /* Create a bitmap for frame F from a HEIGHT x WIDTH array of bits at BITS.  */
 
 int
-x_create_bitmap_from_data (f, bits, width, height)
-     struct frame *f;
-     char *bits;
-     unsigned int width, height;
+x_create_bitmap_from_data (struct frame *f, char *bits, unsigned int width, unsigned int height)
 {
   Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
   int id;
@@ -288,7 +277,7 @@ x_create_bitmap_from_data (f, bits, width, height)
 #endif /* HAVE_NTGUI */
 
 #ifdef HAVE_NS
-  void *bitmap = ns_image_from_XBM(bits, width, height);
+  void *bitmap = ns_image_from_XBM (bits, width, height);
   if (!bitmap)
       return -1;
 #endif
@@ -323,9 +312,7 @@ x_create_bitmap_from_data (f, bits, width, height)
 /* Create bitmap from file FILE for frame F.  */
 
 int
-x_create_bitmap_from_file (f, file)
-     struct frame *f;
-     Lisp_Object file;
+x_create_bitmap_from_file (struct frame *f, Lisp_Object file)
 {
   Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
 
@@ -335,7 +322,7 @@ x_create_bitmap_from_file (f, file)
 
 #ifdef HAVE_NS
   int id;
-  void *bitmap = ns_image_from_file(file);
+  void *bitmap = ns_image_from_file (file);
 
   if (!bitmap)
       return -1;
@@ -346,8 +333,8 @@ x_create_bitmap_from_file (f, file)
   dpyinfo->bitmaps[id - 1].refcount = 1;
   dpyinfo->bitmaps[id - 1].file = (char *) 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);
+  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));
   return id;
 #endif
@@ -402,9 +389,7 @@ x_create_bitmap_from_file (f, file)
 /* Free bitmap B.  */
 
 static void
-free_bitmap_record (dpyinfo, bm)
-     Display_Info *dpyinfo;
-     Bitmap_Record *bm;
+free_bitmap_record (Display_Info *dpyinfo, Bitmap_Record *bm)
 {
 #ifdef HAVE_X_WINDOWS
   XFreePixmap (dpyinfo->display, bm->pixmap);
@@ -417,7 +402,7 @@ free_bitmap_record (dpyinfo, bm)
 #endif /* HAVE_NTGUI */
 
 #ifdef HAVE_NS
-  ns_release_object(bm->img);
+  ns_release_object (bm->img);
 #endif
 
   if (bm->file)
@@ -430,9 +415,7 @@ free_bitmap_record (dpyinfo, bm)
 /* Remove reference to bitmap with id number ID.  */
 
 void
-x_destroy_bitmap (f, id)
-     FRAME_PTR f;
-     int id;
+x_destroy_bitmap (FRAME_PTR f, int id)
 {
   Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
 
@@ -452,8 +435,7 @@ x_destroy_bitmap (f, id)
 /* Free all the bitmaps for the display specified by DPYINFO.  */
 
 void
-x_destroy_all_bitmaps (dpyinfo)
-     Display_Info *dpyinfo;
+x_destroy_all_bitmaps (Display_Info *dpyinfo)
 {
   int i;
   Bitmap_Record *bm = dpyinfo->bitmaps;
@@ -471,25 +453,23 @@ x_destroy_all_bitmaps (dpyinfo)
 /* Useful functions defined in the section
    `Image type independent image structures' below. */
 
-static unsigned long four_corners_best P_ ((XImagePtr ximg,
-                                           int *corners,
-                                           unsigned long width,
-                                           unsigned long height));
+static unsigned long four_corners_best (XImagePtr ximg,
+                                        int *corners,
+                                        unsigned long width,
+                                        unsigned long height);
 
-static int x_create_x_image_and_pixmap P_ ((struct frame *f, int width, int height,
-                                           int depth, XImagePtr *ximg,
-                                           Pixmap *pixmap));
+static int x_create_x_image_and_pixmap (struct frame *f, int width, int height,
+                                        int depth, XImagePtr *ximg,
+                                        Pixmap *pixmap);
 
-static void x_destroy_x_image P_ ((XImagePtr ximg));
+static void x_destroy_x_image (XImagePtr ximg);
 
 
 /* Create a mask of a bitmap. Note is this not a perfect mask.
    It's nicer with some borders in this context */
 
 int
-x_create_bitmap_mask (f, id)
-     struct frame *f;
-     int id;
+x_create_bitmap_mask (struct frame *f, int id)
 {
   Pixmap pixmap, mask;
   XImagePtr ximg, mask_img;
@@ -601,12 +581,9 @@ Lisp_Object Qxbm;
 
 /* Keywords.  */
 
-extern Lisp_Object QCwidth, QCheight, QCforeground, QCbackground, QCfile;
-extern Lisp_Object QCdata, QCtype;
-extern Lisp_Object Qcenter;
-Lisp_Object QCascent, QCmargin, QCrelief, Qcount;
+Lisp_Object QCascent, QCmargin, QCrelief, Qcount, Qextension_data;
 Lisp_Object QCconversion, QCcolor_symbols, QCheuristic_mask;
-Lisp_Object QCindex, QCmatrix, QCcolor_adjustment, QCmask;
+Lisp_Object QCindex, QCmatrix, QCcolor_adjustment, QCmask, QCgeometry, QCcrop, QCrotation;
 
 /* Other symbols.  */
 
@@ -619,13 +596,13 @@ Lisp_Object Vimage_cache_eviction_delay;
 
 /* Function prototypes.  */
 
-static Lisp_Object define_image_type P_ ((struct image_type *type, int loaded));
-static struct image_type *lookup_image_type P_ ((Lisp_Object symbol));
-static void image_error P_ ((char *format, Lisp_Object, Lisp_Object));
-static void x_laplace P_ ((struct frame *, struct image *));
-static void x_emboss P_ ((struct frame *, struct image *));
-static int x_build_heuristic_mask P_ ((struct frame *, struct image *,
-                                      Lisp_Object));
+static Lisp_Object define_image_type (struct image_type *type, int loaded);
+static struct image_type *lookup_image_type (Lisp_Object symbol);
+static void image_error (const char *format, Lisp_Object, Lisp_Object);
+static void x_laplace (struct frame *, struct image *);
+static void x_emboss (struct frame *, struct image *);
+static int x_build_heuristic_mask (struct frame *, struct image *,
+                                   Lisp_Object);
 
 #define CACHE_IMAGE_TYPE(type, status) \
   do { Vimage_type_cache = Fcons (Fcons (type, status), Vimage_type_cache); } while (0)
@@ -637,9 +614,7 @@ static int x_build_heuristic_mask P_ ((struct frame *, struct image *,
    image_types and caches the loading status of TYPE.  */
 
 static Lisp_Object
-define_image_type (type, loaded)
-     struct image_type *type;
-     int loaded;
+define_image_type (struct image_type *type, int loaded)
 {
   Lisp_Object success;
 
@@ -650,7 +625,7 @@ define_image_type (type, 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);
-      bcopy (type, p, sizeof *p);
+      memcpy (p, type, sizeof *p);
       p->next = image_types;
       image_types = p;
       success = Qt;
@@ -665,8 +640,7 @@ define_image_type (type, loaded)
    structure.  Value is null if SYMBOL is not a known image type.  */
 
 static INLINE struct image_type *
-lookup_image_type (symbol)
-     Lisp_Object symbol;
+lookup_image_type (Lisp_Object symbol)
 {
   struct image_type *type;
 
@@ -690,8 +664,7 @@ lookup_image_type (symbol)
    image type.  */
 
 int
-valid_image_p (object)
-     Lisp_Object object;
+valid_image_p (Lisp_Object object)
 {
   int valid_p = 0;
 
@@ -726,9 +699,7 @@ valid_image_p (object)
    therefore simply displays a message.  */
 
 static void
-image_error (format, arg1, arg2)
-     char *format;
-     Lisp_Object arg1, arg2;
+image_error (const char *format, Lisp_Object arg1, Lisp_Object arg2)
 {
   add_to_log (format, arg1, arg2);
 }
@@ -760,7 +731,7 @@ enum image_value_type
 struct image_keyword
 {
   /* Name of keyword.  */
-  char *name;
+  const char *name;
 
   /* The type of value allowed.  */
   enum image_value_type type;
@@ -776,9 +747,9 @@ struct image_keyword
 };
 
 
-static int parse_image_spec P_ ((Lisp_Object, struct image_keyword *,
-                                int, Lisp_Object));
-static Lisp_Object image_spec_value P_ ((Lisp_Object, Lisp_Object, int *));
+static int parse_image_spec (Lisp_Object, struct image_keyword *,
+                             int, Lisp_Object);
+static Lisp_Object image_spec_value (Lisp_Object, Lisp_Object, int *);
 
 
 /* Parse image spec SPEC according to KEYWORDS.  A valid image spec
@@ -788,11 +759,8 @@ static Lisp_Object image_spec_value P_ ((Lisp_Object, Lisp_Object, int *));
    allowed keyword/value pairs.  Value is non-zero if SPEC is valid.  */
 
 static int
-parse_image_spec (spec, keywords, nkeywords, type)
-     Lisp_Object spec;
-     struct image_keyword *keywords;
-     int nkeywords;
-     Lisp_Object type;
+parse_image_spec (Lisp_Object spec, struct image_keyword *keywords,
+                 int nkeywords, Lisp_Object type)
 {
   int i;
   Lisp_Object plist;
@@ -928,9 +896,7 @@ parse_image_spec (spec, keywords, nkeywords, type)
    to 1 if KEY was found in SPEC, set it to 0 otherwise.  */
 
 static Lisp_Object
-image_spec_value (spec, key, found)
-     Lisp_Object spec, key;
-     int *found;
+image_spec_value (Lisp_Object spec, Lisp_Object key, int *found)
 {
   Lisp_Object tail;
 
@@ -960,8 +926,7 @@ PIXELS non-nil means return the size in pixels, otherwise return the
 size in canonical character units.
 FRAME is the frame on which the image will be displayed.  FRAME nil
 or omitted means use the selected frame.  */)
-     (spec, pixels, frame)
-     Lisp_Object spec, pixels, frame;
+  (Lisp_Object spec, Lisp_Object pixels, Lisp_Object frame)
 {
   Lisp_Object size;
 
@@ -991,8 +956,7 @@ DEFUN ("image-mask-p", Fimage_mask_p, Simage_mask_p, 1, 2, 0,
        doc: /* Return t if image SPEC has a mask bitmap.
 FRAME is the frame on which the image will be displayed.  FRAME nil
 or omitted means use the selected frame.  */)
-     (spec, frame)
-     Lisp_Object spec, frame;
+  (Lisp_Object spec, Lisp_Object frame)
 {
   Lisp_Object mask;
 
@@ -1011,12 +975,11 @@ or omitted means use the selected frame.  */)
   return mask;
 }
 
-DEFUN ("image-extension-data", Fimage_extension_data, Simage_extension_data, 1, 2, 0,
-       doc: /* Return extension data for image SPEC.
+DEFUN ("image-metadata", Fimage_metadata, Simage_metadata, 1, 2, 0,
+       doc: /* Return metadata for image SPEC.
 FRAME is the frame on which the image will be displayed.  FRAME nil
 or omitted means use the selected frame.  */)
-     (spec, frame)
-     Lisp_Object spec, frame;
+  (Lisp_Object spec, Lisp_Object frame)
 {
   Lisp_Object ext;
 
@@ -1037,9 +1000,9 @@ or omitted means use the selected frame.  */)
                 Image type independent image structures
  ***********************************************************************/
 
-static struct image *make_image P_ ((Lisp_Object spec, unsigned hash));
-static void free_image P_ ((struct frame *f, struct image *img));
-static int check_image_size P_ ((struct frame *f, int width, int height));
+static struct image *make_image (Lisp_Object spec, unsigned hash);
+static void free_image (struct frame *f, struct image *img);
+static int check_image_size (struct frame *f, int width, int height);
 
 #define MAX_IMAGE_SIZE 6.0
 Lisp_Object Vmax_image_size;
@@ -1048,15 +1011,13 @@ Lisp_Object Vmax_image_size;
    SPEC.  SPEC has a hash value of HASH.  */
 
 static struct image *
-make_image (spec, hash)
-     Lisp_Object spec;
-     unsigned hash;
+make_image (Lisp_Object spec, unsigned int hash)
 {
   struct image *img = (struct image *) xmalloc (sizeof *img);
   Lisp_Object file = image_spec_value (spec, QCfile, NULL);
 
   xassert (valid_image_p (spec));
-  bzero (img, sizeof *img);
+  memset (img, 0, sizeof *img);
   img->dependencies = NILP (file) ? Qnil : list1 (file);
   img->type = lookup_image_type (image_spec_value (spec, QCtype, NULL));
   xassert (img->type != NULL);
@@ -1072,9 +1033,7 @@ make_image (spec, hash)
 /* Free image IMG which was used on frame F, including its resources.  */
 
 static void
-free_image (f, img)
-     struct frame *f;
-     struct image *img;
+free_image (struct frame *f, struct image *img)
 {
   if (img)
     {
@@ -1105,10 +1064,7 @@ free_image (f, img)
    otherwise, return 0. */
 
 int
-check_image_size (f, width, height)
-     struct frame *f;
-     int width;
-     int height;
+check_image_size (struct frame *f, int width, int height)
 {
   int w, h;
 
@@ -1139,9 +1095,7 @@ check_image_size (f, width, height)
    drawing an image.  */
 
 void
-prepare_image_for_display (f, img)
-     struct frame *f;
-     struct image *img;
+prepare_image_for_display (struct frame *f, struct image *img)
 {
   EMACS_TIME t;
 
@@ -1161,10 +1115,7 @@ prepare_image_for_display (f, img)
    drawn in face FACE.  */
 
 int
-image_ascent (img, face, slice)
-     struct image *img;
-     struct face *face;
-     struct glyph_slice *slice;
+image_ascent (struct image *img, struct face *face, struct glyph_slice *slice)
 {
   int height;
   int ascent;
@@ -1210,10 +1161,8 @@ image_ascent (img, face, slice)
    On W32, XIMG is assumed to a device context with the bitmap selected.  */
 
 static RGB_PIXEL_COLOR
-four_corners_best (ximg, corners, width, height)
-     XImagePtr_or_DC ximg;
-     int *corners;
-     unsigned long width, height;
+four_corners_best (XImagePtr_or_DC ximg, int *corners,
+                  unsigned long width, unsigned long height)
 {
   RGB_PIXEL_COLOR corner_pixels[4], best;
   int i, best_count;
@@ -1263,10 +1212,10 @@ four_corners_best (ximg, corners, width, height)
 #elif defined (HAVE_NS)
 
 #define Destroy_Image(ximg, dummy) \
-  ns_release_object(ximg)
+  ns_release_object (ximg)
 
 #define Free_Pixmap(display, pixmap) \
-  ns_release_object(pixmap)
+  ns_release_object (pixmap)
 
 #else
 
@@ -1285,10 +1234,7 @@ four_corners_best (ximg, corners, width, height)
    use for the heuristic.  */
 
 RGB_PIXEL_COLOR
-image_background (img, f, ximg)
-     struct image *img;
-     struct frame *f;
-     XImagePtr_or_DC ximg;
+image_background (struct image *img, struct frame *f, XImagePtr_or_DC ximg)
 {
   if (! img->background_valid)
     /* IMG doesn't have a background yet, try to guess a reasonable value.  */
@@ -1327,10 +1273,7 @@ image_background (img, f, ximg)
    existing XImage object to use for the heuristic.  */
 
 int
-image_background_transparent (img, f, mask)
-     struct image *img;
-     struct frame *f;
-     XImagePtr_or_DC mask;
+image_background_transparent (struct image *img, struct frame *f, XImagePtr_or_DC mask)
 {
   if (! img->background_transparent_valid)
     /* IMG doesn't have a background yet, try to guess a reasonable value.  */
@@ -1375,13 +1318,13 @@ image_background_transparent (img, f, mask)
                  Helper functions for X image types
  ***********************************************************************/
 
-static void x_clear_image_1 P_ ((struct frame *, struct image *, int,
-                                int, int));
-static void x_clear_image P_ ((struct frame *f, struct image *img));
-static unsigned long x_alloc_image_color P_ ((struct frame *f,
-                                             struct image *img,
-                                             Lisp_Object color_name,
-                                             unsigned long dflt));
+static void x_clear_image_1 (struct frame *, struct image *, int,
+                             int, int);
+static void x_clear_image (struct frame *f, struct image *img);
+static unsigned long x_alloc_image_color (struct frame *f,
+                                          struct image *img,
+                                          Lisp_Object color_name,
+                                          unsigned long dflt);
 
 
 /* Clear X resources of image IMG on frame F.  PIXMAP_P non-zero means
@@ -1390,10 +1333,8 @@ static unsigned long x_alloc_image_color P_ ((struct frame *f,
    the image, if any.  */
 
 static void
-x_clear_image_1 (f, img, pixmap_p, mask_p, colors_p)
-     struct frame *f;
-     struct image *img;
-     int pixmap_p, mask_p, colors_p;
+x_clear_image_1 (struct frame *f, struct image *img, int pixmap_p, int mask_p,
+                int colors_p)
 {
   if (pixmap_p && img->pixmap)
     {
@@ -1426,9 +1367,7 @@ x_clear_image_1 (f, img, pixmap_p, mask_p, colors_p)
 /* Free X resources of image IMG which is used on frame F.  */
 
 static void
-x_clear_image (f, img)
-     struct frame *f;
-     struct image *img;
+x_clear_image (struct frame *f, struct image *img)
 {
   BLOCK_INPUT;
   x_clear_image_1 (f, img, 1, 1, 1);
@@ -1442,11 +1381,8 @@ x_clear_image (f, img)
    color.  */
 
 static unsigned long
-x_alloc_image_color (f, img, color_name, dflt)
-     struct frame *f;
-     struct image *img;
-     Lisp_Object color_name;
-     unsigned long dflt;
+x_alloc_image_color (struct frame *f, struct image *img, Lisp_Object color_name,
+                    unsigned long dflt)
 {
   XColor color;
   unsigned long result;
@@ -1476,25 +1412,25 @@ x_alloc_image_color (f, img, color_name, dflt)
                             Image Cache
  ***********************************************************************/
 
-static struct image *search_image_cache P_ ((struct frame *, Lisp_Object, unsigned));
-static void cache_image P_ ((struct frame *f, struct image *img));
-static void postprocess_image P_ ((struct frame *, struct image *));
+static struct image *search_image_cache (struct frame *, Lisp_Object, unsigned);
+static void cache_image (struct frame *f, struct image *img);
+static void postprocess_image (struct frame *, struct image *);
 
 /* Return a new, initialized image cache that is allocated from the
    heap.  Call free_image_cache to free an image cache.  */
 
 struct image_cache *
-make_image_cache ()
+make_image_cache (void)
 {
   struct image_cache *c = (struct image_cache *) xmalloc (sizeof *c);
   int size;
 
-  bzero (c, sizeof *c);
+  memset (c, 0, sizeof *c);
   c->size = 50;
   c->images = (struct image **) xmalloc (c->size * sizeof *c->images);
   size = IMAGE_CACHE_BUCKETS_SIZE * sizeof *c->buckets;
   c->buckets = (struct image **) xmalloc (size);
-  bzero (c->buckets, size);
+  memset (c->buckets, 0, size);
   return c;
 }
 
@@ -1502,10 +1438,7 @@ make_image_cache ()
 /* Find an image matching SPEC in the cache, and return it.  If no
    image is found, return NULL.  */
 static struct image *
-search_image_cache (f, spec, hash)
-     struct frame *f;
-     Lisp_Object spec;
-     unsigned hash;
+search_image_cache (struct frame *f, Lisp_Object spec, unsigned int hash)
 {
   struct image *img;
   struct image_cache *c = FRAME_IMAGE_CACHE (f);
@@ -1538,9 +1471,7 @@ search_image_cache (f, spec, hash)
 /* Search frame F for an image with spec SPEC, and free it.  */
 
 static void
-uncache_image (f, spec)
-     struct frame *f;
-     Lisp_Object spec;
+uncache_image (struct frame *f, Lisp_Object spec)
 {
   struct image *img = search_image_cache (f, spec, sxhash (spec, 0));
   if (img)
@@ -1552,8 +1483,7 @@ uncache_image (f, spec)
    caches.  */
 
 void
-free_image_cache (f)
-     struct frame *f;
+free_image_cache (struct frame *f)
 {
   struct image_cache *c = FRAME_IMAGE_CACHE (f);
   if (c)
@@ -1586,29 +1516,56 @@ clear_image_cache (struct frame *f, Lisp_Object filter)
 {
   struct image_cache *c = FRAME_IMAGE_CACHE (f);
 
-  if (c && (!NILP (filter) || INTEGERP (Vimage_cache_eviction_delay)))
+  if (c)
     {
-      EMACS_TIME t;
-      unsigned long old;
-      int i, nfreed;
-
-      EMACS_GET_TIME (t);
-      old = EMACS_SECS (t) - XFASTINT (Vimage_cache_eviction_delay);
+      int i, nfreed = 0;
 
       /* Block input so that we won't be interrupted by a SIGIO
         while being in an inconsistent state.  */
       BLOCK_INPUT;
 
-      for (i = nfreed = 0; i < c->used; ++i)
+      if (!NILP (filter))
        {
-         struct image *img = c->images[i];
-         if (img != NULL
-             && (NILP (filter) ? img->timestamp < old
-                 : (EQ (Qt, filter)
-                    || !NILP (Fmember (filter, img->dependencies)))))
+         /* Filter image cache.  */
+         for (i = 0; i < c->used; ++i)
            {
-             free_image (f, img);
-             ++nfreed;
+             struct image *img = c->images[i];
+             if (img && (EQ (Qt, filter)
+                         || !NILP (Fmember (filter, img->dependencies))))
+               {
+                 free_image (f, img);
+                 ++nfreed;
+               }
+           }
+       }
+      else if (INTEGERP (Vimage_cache_eviction_delay))
+       {
+         /* Free cache based on timestamp.  */
+         EMACS_TIME t;
+         unsigned long old;
+         int delay, nimages = 0;
+
+         for (i = 0; i < c->used; ++i)
+           if (c->images[i])
+             nimages++;
+
+         /* If the number of cached images has grown unusually large,
+            decrease the cache eviction delay (Bug#6230).  */
+         delay = XFASTINT (Vimage_cache_eviction_delay);
+         if (nimages > 40)
+           delay = max (1, 1600 * delay / (nimages*nimages));
+
+         EMACS_GET_TIME (t);
+         old = EMACS_SECS (t) - delay;
+
+         for (i = 0; i < c->used; ++i)
+           {
+             struct image *img = c->images[i];
+             if (img && img->timestamp < old)
+               {
+                 free_image (f, img);
+                 ++nfreed;
+               }
            }
        }
 
@@ -1654,8 +1611,7 @@ FILTER nil or a frame means clear all images in the selected frame.
 FILTER t means clear the image caches of all frames.
 Anything else, means only clear those images which refer to FILTER,
 which is then usually a filename.  */)
-     (filter)
-     Lisp_Object filter;
+  (Lisp_Object filter)
 {
   if (!(EQ (filter, Qnil) || FRAMEP (filter)))
     clear_image_caches (filter);
@@ -1666,15 +1622,16 @@ which is then usually a filename.  */)
 }
 
 
-DEFUN ("image-refresh", Fimage_refresh, Simage_refresh,
+DEFUN ("image-flush", Fimage_flush, Simage_flush,
        1, 2, 0,
-       doc: /* Refresh the image with specification SPEC on frame FRAME.
-If SPEC specifies an image file, the displayed image is updated with
-the current contents of that file.
+       doc: /* Fush the image with specification SPEC on frame FRAME.
+This removes the image from the Emacs image cache.  If SPEC specifies
+an image file, the next redisplay of this image will read from the
+current contents of that file.
+
 FRAME nil or omitted means use the selected frame.
 FRAME t means refresh the image on all frames.  */)
-     (spec, frame)
-     Lisp_Object spec, frame;
+  (Lisp_Object spec, Lisp_Object frame)
 {
   if (!valid_image_p (spec))
     error ("Invalid image specification");
@@ -1700,9 +1657,7 @@ FRAME t means refresh the image on all frames.  */)
    by the image's specification,  */
 
 static void
-postprocess_image (f, img)
-     struct frame *f;
-     struct image *img;
+postprocess_image (struct frame *f, struct image *img)
 {
   /* Manipulation of the image's mask.  */
   if (img->pixmap)
@@ -1775,9 +1730,7 @@ postprocess_image (f, img)
    SPEC must be a valid Lisp image specification (see valid_image_p).  */
 
 int
-lookup_image (f, spec)
-     struct frame *f;
-     Lisp_Object spec;
+lookup_image (struct frame *f, Lisp_Object spec)
 {
   struct image_cache *c;
   struct image *img;
@@ -1806,8 +1759,6 @@ lookup_image (f, spec)
   /* If not found, create a new image and cache it.  */
   if (img == NULL)
     {
-      extern Lisp_Object Qpostscript;
-
       BLOCK_INPUT;
       img = make_image (spec, hash);
       cache_image (f, img);
@@ -1897,9 +1848,7 @@ lookup_image (f, spec)
 /* Cache image IMG in the image cache of frame F.  */
 
 static void
-cache_image (f, img)
-     struct frame *f;
-     struct image *img;
+cache_image (struct frame *f, struct image *img)
 {
   struct image_cache *c = FRAME_IMAGE_CACHE (f);
   int i;
@@ -1939,8 +1888,7 @@ cache_image (f, img)
 /* Mark Lisp objects in image IMG.  */
 
 static void
-mark_image (img)
-     struct image *img;
+mark_image (struct image *img)
 {
   mark_object (img->spec);
   mark_object (img->dependencies);
@@ -2008,10 +1956,10 @@ w32_delayed_load (Lisp_Object libraries, Lisp_Object type)
 
 #endif /* HAVE_NTGUI */
 
-static int x_create_x_image_and_pixmap P_ ((struct frame *, int, int, int,
-                                           XImagePtr *, Pixmap *));
-static void x_destroy_x_image P_ ((XImagePtr));
-static void x_put_x_image P_ ((struct frame *, XImagePtr, Pixmap, int, int));
+static int x_create_x_image_and_pixmap (struct frame *, int, int, int,
+                                        XImagePtr *, Pixmap *);
+static void x_destroy_x_image (XImagePtr);
+static void x_put_x_image (struct frame *, XImagePtr, Pixmap, int, int);
 
 
 /* Create an XImage and a pixmap of size WIDTH x HEIGHT for use on
@@ -2024,11 +1972,8 @@ static void x_put_x_image P_ ((struct frame *, XImagePtr, Pixmap, int, int));
    should indicate the bit depth of the image.  */
 
 static int
-x_create_x_image_and_pixmap (f, width, height, depth, ximg, pixmap)
-     struct frame *f;
-     int width, height, depth;
-     XImagePtr *ximg;
-     Pixmap *pixmap;
+x_create_x_image_and_pixmap (struct frame *f, int width, int height, int depth,
+                            XImagePtr *ximg, Pixmap *pixmap)
 {
 #ifdef HAVE_X_WINDOWS
   Display *display = FRAME_X_DISPLAY (f);
@@ -2100,8 +2045,8 @@ x_create_x_image_and_pixmap (f, width, height, depth, ximg, pixmap)
       return 0;
     }
 
-  header = &((*ximg)->info.bmiHeader);
-  bzero (&((*ximg)->info), sizeof (BITMAPINFO));
+  header = &(*ximg)->info.bmiHeader;
+  memset (&(*ximg)->info, 0, sizeof (BITMAPINFO));
   header->biSize = sizeof (*header);
   header->biWidth = width;
   header->biHeight = -height;  /* negative indicates a top-down bitmap.  */
@@ -2151,7 +2096,7 @@ x_create_x_image_and_pixmap (f, width, height, depth, ximg, pixmap)
 #endif /* HAVE_NTGUI */
 
 #ifdef HAVE_NS
-  *pixmap = ns_image_for_XPM(width, height, depth);
+  *pixmap = ns_image_for_XPM (width, height, depth);
   if (*pixmap == 0)
     {
       *ximg = NULL;
@@ -2167,8 +2112,7 @@ x_create_x_image_and_pixmap (f, width, height, depth, ximg, pixmap)
 /* Destroy XImage XIMG.  Free XIMG->data.  */
 
 static void
-x_destroy_x_image (ximg)
-     XImagePtr ximg;
+x_destroy_x_image (XImagePtr ximg)
 {
   xassert (interrupt_input_blocked);
   if (ximg)
@@ -2184,7 +2128,7 @@ x_destroy_x_image (ximg)
       xfree (ximg);
 #endif /* HAVE_NTGUI */
 #ifdef HAVE_NS
-      ns_release_object(ximg);
+      ns_release_object (ximg);
 #endif /* HAVE_NS */
     }
 }
@@ -2194,11 +2138,7 @@ x_destroy_x_image (ximg)
    are width and height of both the image and pixmap.  */
 
 static void
-x_put_x_image (f, ximg, pixmap, width, height)
-     struct frame *f;
-     XImagePtr ximg;
-     Pixmap pixmap;
-     int width, height;
+x_put_x_image (struct frame *f, XImagePtr ximg, Pixmap pixmap, int width, int height)
 {
 #ifdef HAVE_X_WINDOWS
   GC gc;
@@ -2219,7 +2159,7 @@ x_put_x_image (f, ximg, pixmap, width, height)
 
 #ifdef HAVE_NS
   xassert (ximg == pixmap);
-  ns_retain_object(ximg);
+  ns_retain_object (ximg);
 #endif
 }
 
@@ -2228,7 +2168,7 @@ x_put_x_image (f, ximg, pixmap, width, height)
                              File Handling
  ***********************************************************************/
 
-static unsigned char *slurp_file P_ ((char *, int *));
+static unsigned char *slurp_file (char *, int *);
 
 
 /* Find image file FILE.  Look in data-directory/images, then
@@ -2236,8 +2176,7 @@ static unsigned char *slurp_file P_ ((char *, int *));
    found, or nil if not found.  */
 
 Lisp_Object
-x_find_image_file (file)
-     Lisp_Object file;
+x_find_image_file (Lisp_Object file)
 {
   Lisp_Object file_found, search_path;
   struct gcpro gcpro1, gcpro2;
@@ -2272,9 +2211,7 @@ x_find_image_file (file)
    occurred.  *SIZE is set to the size of the file.  */
 
 static unsigned char *
-slurp_file (file, size)
-     char *file;
-     int *size;
+slurp_file (char *file, int *size)
 {
   FILE *fp = NULL;
   unsigned char *buf = NULL;
@@ -2308,15 +2245,15 @@ slurp_file (file, size)
                              XBM images
  ***********************************************************************/
 
-static int xbm_scan P_ ((unsigned char **, unsigned char *, char *, int *));
-static int xbm_load P_ ((struct frame *f, struct image *img));
-static int xbm_load_image P_ ((struct frame *f, struct image *img,
-                              unsigned char *, unsigned char *));
-static int xbm_image_p P_ ((Lisp_Object object));
-static int xbm_read_bitmap_data P_ ((struct frame *f,
-                                    unsigned char *, unsigned char *,
-                                    int *, int *, unsigned char **, int));
-static int xbm_file_p P_ ((Lisp_Object));
+static int xbm_scan (unsigned char **, unsigned char *, char *, int *);
+static int xbm_load (struct frame *f, struct image *img);
+static int xbm_load_image (struct frame *f, struct image *img,
+                           unsigned char *, unsigned char *);
+static int xbm_image_p (Lisp_Object object);
+static int xbm_read_bitmap_data (struct frame *f,
+                                 unsigned char *, unsigned char *,
+                                 int *, int *, unsigned char **, int);
+static int xbm_file_p (Lisp_Object);
 
 
 /* Indices of image specification fields in xbm_format, below.  */
@@ -2409,12 +2346,11 @@ enum xbm_token
    displayed is used.  */
 
 static int
-xbm_image_p (object)
-     Lisp_Object object;
+xbm_image_p (Lisp_Object object)
 {
   struct image_keyword kw[XBM_LAST];
 
-  bcopy (xbm_format, kw, sizeof kw);
+  memcpy (kw, xbm_format, sizeof kw);
   if (!parse_image_spec (object, kw, XBM_LAST, Qxbm))
     return 0;
 
@@ -2503,10 +2439,7 @@ xbm_image_p (object)
    scanning a number, store its value in *IVAL.  */
 
 static int
-xbm_scan (s, end, sval, ival)
-     unsigned char **s, *end;
-     char *sval;
-     int *ival;
+xbm_scan (unsigned char **s, unsigned char *end, char *sval, int *ival)
 {
   unsigned int c;
 
@@ -2607,7 +2540,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);
-  bzero (bits, height * w2);
+  memset (bits, 0, height * w2);
   for (i = 0; i < height; i++)
     {
       p = bits + i*w2;
@@ -2625,10 +2558,8 @@ w32_create_pixmap_from_bitmap_data (int width, int height, char *data)
 }
 
 static void
-convert_mono_to_color_image (f, img, foreground, background)
-     struct frame *f;
-     struct image *img;
-     COLORREF foreground, background;
+convert_mono_to_color_image (struct frame *f, struct image *img,
+                            COLORREF foreground, COLORREF background)
 {
   HDC hdc, old_img_dc, new_img_dc;
   HGDIOBJ old_prev, new_prev;
@@ -2670,12 +2601,9 @@ convert_mono_to_color_image (f, img, foreground, background)
 
 
 static void
-Create_Pixmap_From_Bitmap_Data (f, img, data, fg, bg, non_default_colors)
-     struct frame *f;
-     struct image *img;
-     char *data;
-     RGB_PIXEL_COLOR fg, bg;
-     int non_default_colors;
+Create_Pixmap_From_Bitmap_Data (struct frame *f, struct image *img, char *data,
+                               RGB_PIXEL_COLOR fg, RGB_PIXEL_COLOR bg,
+                               int non_default_colors)
 {
 #ifdef HAVE_NTGUI
   img->pixmap
@@ -2686,7 +2614,7 @@ Create_Pixmap_From_Bitmap_Data (f, img, data, fg, bg, non_default_colors)
     convert_mono_to_color_image (f, img, fg, bg);
 
 #elif defined (HAVE_NS)
-  img->pixmap = ns_image_from_XBM(data, img->width, img->height);
+  img->pixmap = ns_image_from_XBM (data, img->width, img->height);
 
 #else
   img->pixmap
@@ -2711,12 +2639,9 @@ Create_Pixmap_From_Bitmap_Data (f, img, data, fg, bg, non_default_colors)
    invalid (the bitmap remains unread).  */
 
 static int
-xbm_read_bitmap_data (f, contents, end, width, height, data, inhibit_image_error)
-     struct frame *f;
-     unsigned char *contents, *end;
-     int *width, *height;
-     unsigned char **data;
-     int inhibit_image_error;
+xbm_read_bitmap_data (struct frame *f, unsigned char *contents, unsigned char *end,
+                     int *width, int *height, unsigned char **data,
+                     int inhibit_image_error)
 {
   unsigned char *s = contents;
   char buffer[BUFSIZ];
@@ -2865,10 +2790,8 @@ xbm_read_bitmap_data (f, contents, end, width, height, data, inhibit_image_error
    successful.  */
 
 static int
-xbm_load_image (f, img, contents, end)
-     struct frame *f;
-     struct image *img;
-     unsigned char *contents, *end;
+xbm_load_image (struct frame *f, struct image *img, unsigned char *contents,
+               unsigned char *end)
 {
   int rc;
   unsigned char *data;
@@ -2924,8 +2847,7 @@ xbm_load_image (f, img, contents, end)
 /* Value is non-zero if DATA looks like an in-memory XBM file.  */
 
 static int
-xbm_file_p (data)
-     Lisp_Object data;
+xbm_file_p (Lisp_Object data)
 {
   int w, h;
   return (STRINGP (data)
@@ -2939,9 +2861,7 @@ xbm_file_p (data)
    non-zero if successful.  */
 
 static int
-xbm_load (f, img)
-     struct frame *f;
-     struct image *img;
+xbm_load (struct frame *f, struct image *img)
 {
   int success_p = 0;
   Lisp_Object file_name;
@@ -2993,7 +2913,7 @@ xbm_load (f, img)
       in_memory_file_p = xbm_file_p (data);
 
       /* Parse the image specification.  */
-      bcopy (xbm_format, fmt, sizeof fmt);
+      memcpy (fmt, xbm_format, sizeof fmt);
       parsed_p = parse_image_spec (img->spec, fmt, XBM_LAST, Qxbm);
       xassert (parsed_p);
 
@@ -3039,9 +2959,9 @@ xbm_load (f, img)
                {
                  Lisp_Object line = XVECTOR (data)->contents[i];
                  if (STRINGP (line))
-                   bcopy (SDATA (line), p, nbytes);
+                   memcpy (p, SDATA (line), nbytes);
                  else
-                   bcopy (XBOOL_VECTOR (line)->data, p, nbytes);
+                   memcpy (p, XBOOL_VECTOR (line)->data, nbytes);
                }
            }
          else if (STRINGP (data))
@@ -3057,7 +2977,7 @@ xbm_load (f, img)
             invertedBits = bits;
             nbytes = (img->width + BITS_PER_CHAR - 1) / BITS_PER_CHAR
               * img->height;
-            bits = (char *) alloca(nbytes);
+            bits = (char *) alloca (nbytes);
             for (i = 0; i < nbytes; i++)
               bits[i] = XBM_BIT_SHUFFLE (invertedBits[i]);
           }
@@ -3089,9 +3009,9 @@ xbm_load (f, img)
 
 #if defined (HAVE_XPM) || defined (HAVE_NS)
 
-static int xpm_image_p P_ ((Lisp_Object object));
-static int xpm_load P_ ((struct frame *f, struct image *img));
-static int xpm_valid_color_symbols_p P_ ((Lisp_Object));
+static int xpm_image_p (Lisp_Object object);
+static int xpm_load (struct frame *f, struct image *img);
+static int xpm_valid_color_symbols_p (Lisp_Object);
 
 #endif /* HAVE_XPM || HAVE_NS */
 
@@ -3182,12 +3102,12 @@ static struct image_type xpm_type =
 
 #ifdef ALLOC_XPM_COLORS
 
-static void xpm_init_color_cache P_ ((struct frame *, XpmAttributes *));
-static void xpm_free_color_cache P_ ((void));
-static int xpm_lookup_color P_ ((struct frame *, char *, XColor *));
-static int xpm_color_bucket P_ ((char *));
-static struct xpm_cached_color *xpm_cache_color P_ ((struct frame *, char *,
-                                                    XColor *, int));
+static void xpm_init_color_cache (struct frame *, XpmAttributes *);
+static void xpm_free_color_cache (void);
+static int xpm_lookup_color (struct frame *, char *, XColor *);
+static int xpm_color_bucket (char *);
+static struct xpm_cached_color *xpm_cache_color (struct frame *, char *,
+                                                 XColor *, int);
 
 /* An entry in a hash table used to cache color definitions of named
    colors.  This cache is necessary to speed up XPM image loading in
@@ -3215,9 +3135,7 @@ struct xpm_cached_color **xpm_color_cache;
 /* Initialize the color cache.  */
 
 static void
-xpm_init_color_cache (f, attrs)
-     struct frame *f;
-     XpmAttributes *attrs;
+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);
@@ -3243,7 +3161,7 @@ xpm_init_color_cache (f, attrs)
 /* Free the color cache.  */
 
 static void
-xpm_free_color_cache ()
+xpm_free_color_cache (void)
 {
   struct xpm_cached_color *p, *next;
   int i;
@@ -3264,8 +3182,7 @@ xpm_free_color_cache ()
    cache.  */
 
 static int
-xpm_color_bucket (color_name)
-     char *color_name;
+xpm_color_bucket (char *color_name)
 {
   unsigned h = 0;
   char *s;
@@ -3281,11 +3198,7 @@ xpm_color_bucket (color_name)
    entry added.  */
 
 static struct xpm_cached_color *
-xpm_cache_color (f, color_name, color, bucket)
-     struct frame *f;
-     char *color_name;
-     XColor *color;
-     int bucket;
+xpm_cache_color (struct frame *f, char *color_name, XColor *color, int bucket)
 {
   size_t nbytes;
   struct xpm_cached_color *p;
@@ -3308,10 +3221,7 @@ xpm_cache_color (f, color_name, color, bucket)
    allocation failed.  */
 
 static int
-xpm_lookup_color (f, color_name, color)
-     struct frame *f;
-     char *color_name;
-     XColor *color;
+xpm_lookup_color (struct frame *f, char *color_name, XColor *color)
 {
   struct xpm_cached_color *p;
   int h = xpm_color_bucket (color_name);
@@ -3333,7 +3243,7 @@ xpm_lookup_color (f, color_name, color)
      with transparency, and it's useful.  */
   else if (strcmp ("opaque", color_name) == 0)
     {
-      bzero (color, sizeof (XColor));  /* Is this necessary/correct?  */
+      memset (color, 0, sizeof (XColor));  /* Is this necessary/correct?  */
       color->pixel = FRAME_FOREGROUND_PIXEL (f);
       p = xpm_cache_color (f, color_name, color, h);
     }
@@ -3348,12 +3258,8 @@ xpm_lookup_color (f, color_name, color)
    if successful.  */
 
 static int
-xpm_alloc_color (dpy, cmap, color_name, color, closure)
-     Display *dpy;
-     Colormap cmap;
-     char *color_name;
-     XColor *color;
-     void *closure;
+xpm_alloc_color (Display *dpy, Colormap cmap, char *color_name, XColor *color,
+                void *closure)
 {
   return xpm_lookup_color ((struct frame *) closure, color_name, color);
 }
@@ -3364,12 +3270,7 @@ xpm_alloc_color (dpy, cmap, color_name, color, closure)
    non-zero if successful.  */
 
 static int
-xpm_free_colors (dpy, cmap, pixels, npixels, closure)
-     Display *dpy;
-     Colormap cmap;
-     Pixel *pixels;
-     int npixels;
-     void *closure;
+xpm_free_colors (Display *dpy, Colormap cmap, Pixel *pixels, int npixels, void *closure)
 {
   return 1;
 }
@@ -3409,8 +3310,7 @@ init_xpm_functions (Lisp_Object libraries)
    cdr are strings.  */
 
 static int
-xpm_valid_color_symbols_p (color_symbols)
-     Lisp_Object color_symbols;
+xpm_valid_color_symbols_p (Lisp_Object color_symbols)
 {
   while (CONSP (color_symbols))
     {
@@ -3429,11 +3329,10 @@ xpm_valid_color_symbols_p (color_symbols)
 /* Value is non-zero if OBJECT is a valid XPM image specification.  */
 
 static int
-xpm_image_p (object)
-     Lisp_Object object;
+xpm_image_p (Lisp_Object object)
 {
   struct image_keyword fmt[XPM_LAST];
-  bcopy (xpm_format, fmt, sizeof fmt);
+  memcpy (fmt, xpm_format, sizeof fmt);
   return (parse_image_spec (object, fmt, XPM_LAST, Qxpm)
          /* Either `:file' or `:data' must be present.  */
          && fmt[XPM_FILE].count + fmt[XPM_DATA].count == 1
@@ -3447,16 +3346,14 @@ xpm_image_p (object)
 
 #if defined (HAVE_XPM) && defined (HAVE_X_WINDOWS)
 int
-x_create_bitmap_from_xpm_data (f, bits)
-     struct frame *f;
-     char **bits;
+x_create_bitmap_from_xpm_data (struct frame *f, char **bits)
 {
   Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
   int id, rc;
   XpmAttributes attrs;
   Pixmap bitmap, mask;
 
-  bzero (&attrs, sizeof attrs);
+  memset (&attrs, 0, sizeof attrs);
 
   attrs.visual = FRAME_X_VISUAL (f);
   attrs.colormap = FRAME_X_COLORMAP (f);
@@ -3492,9 +3389,7 @@ x_create_bitmap_from_xpm_data (f, bits)
 #ifdef HAVE_XPM
 
 static int
-xpm_load (f, img)
-     struct frame *f;
-     struct image *img;
+xpm_load (struct frame *f, struct image *img)
 {
   int rc;
   XpmAttributes attrs;
@@ -3506,7 +3401,7 @@ xpm_load (f, img)
 
   /* Configure the XPM lib.  Use the visual of frame F.  Allocate
      close colors.  Return colors allocated.  */
-  bzero (&attrs, sizeof attrs);
+  memset (&attrs, 0, sizeof attrs);
 
 #ifndef HAVE_NTGUI
   attrs.visual = FRAME_X_VISUAL (f);
@@ -3553,7 +3448,7 @@ xpm_load (f, img)
       /* Allocate an XpmColorSymbol array.  */
       size = attrs.numsymbols * sizeof *xpm_syms;
       xpm_syms = (XpmColorSymbol *) alloca (size);
-      bzero (xpm_syms, size);
+      memset (xpm_syms, 0, size);
       attrs.colorsymbols = xpm_syms;
 
       /* Fill the color symbol array.  */
@@ -3727,25 +3622,25 @@ xpm_load (f, img)
 /* XPM support functions for NS where libxpm is not available.
    Only XPM version 3 (without any extensions) is supported.  */
 
-static int xpm_scan P_ ((const unsigned char **, const unsigned char *,
-                        const unsigned char **, int *));
+static int xpm_scan (const unsigned char **, const unsigned char *,
+                     const unsigned char **, int *);
 static Lisp_Object xpm_make_color_table_v
-  P_ ((void (**) (Lisp_Object, const unsigned char *, int, Lisp_Object),
-       Lisp_Object (**) (Lisp_Object, const unsigned char *, int)));
-static void xpm_put_color_table_v P_ ((Lisp_Object, const unsigned char *,
-                                      int, Lisp_Object));
-static Lisp_Object xpm_get_color_table_v P_ ((Lisp_Object,
-                                             const unsigned char *, int));
+  (void (**) (Lisp_Object, const unsigned char *, int, Lisp_Object),
+   Lisp_Object (**) (Lisp_Object, const unsigned char *, int));
+static void xpm_put_color_table_v (Lisp_Object, const unsigned char *,
+                                   int, Lisp_Object);
+static Lisp_Object xpm_get_color_table_v (Lisp_Object,
+                                          const unsigned char *, int);
 static Lisp_Object xpm_make_color_table_h
-  P_ ((void (**) (Lisp_Object, const unsigned char *, int, Lisp_Object),
-       Lisp_Object (**) (Lisp_Object, const unsigned char *, int)));
-static void xpm_put_color_table_h P_ ((Lisp_Object, const unsigned char *,
-                                      int, Lisp_Object));
-static Lisp_Object xpm_get_color_table_h P_ ((Lisp_Object,
-                                             const unsigned char *, int));
-static int xpm_str_to_color_key P_ ((const char *));
-static int xpm_load_image P_ ((struct frame *, struct image *,
-                              const unsigned char *, const unsigned char *));
+  (void (**) (Lisp_Object, const unsigned char *, int, Lisp_Object),
+   Lisp_Object (**) (Lisp_Object, const unsigned char *, int));
+static void xpm_put_color_table_h (Lisp_Object, const unsigned char *,
+                                   int, Lisp_Object);
+static Lisp_Object xpm_get_color_table_h (Lisp_Object,
+                                          const unsigned char *, int);
+static int xpm_str_to_color_key (const char *);
+static int xpm_load_image (struct frame *, struct image *,
+                           const unsigned char *, const unsigned char *);
 
 /* Tokens returned from xpm_scan.  */
 
@@ -3764,9 +3659,10 @@ enum xpm_token
    length of the corresponding token, respectively.  */
 
 static int
-xpm_scan (s, end, beg, len)
-     const unsigned char **s, *end, **beg;
-     int *len;
+xpm_scan (const unsigned char **s,
+          const unsigned char *end,
+          const unsigned char **beg,
+          int *len)
 {
   int c;
 
@@ -3830,9 +3726,13 @@ xpm_scan (s, end, beg, len)
    hash table is used.  */
 
 static Lisp_Object
-xpm_make_color_table_v (put_func, get_func)
-     void (**put_func) (Lisp_Object, const unsigned char *, int, Lisp_Object);
-     Lisp_Object (**get_func) (Lisp_Object, const unsigned char *, int);
+xpm_make_color_table_v (void (**put_func) (Lisp_Object,
+                                           const unsigned char *,
+                                           int,
+                                           Lisp_Object),
+                        Lisp_Object (**get_func) (Lisp_Object,
+                                                  const unsigned char *,
+                                                  int))
 {
   *put_func = xpm_put_color_table_v;
   *get_func = xpm_get_color_table_v;
@@ -3840,28 +3740,30 @@ xpm_make_color_table_v (put_func, get_func)
 }
 
 static void
-xpm_put_color_table_v (color_table, chars_start, chars_len, color)
-     Lisp_Object color_table;
-     const unsigned char *chars_start;
-     int chars_len;
-     Lisp_Object color;
+xpm_put_color_table_v (Lisp_Object color_table,
+                       const unsigned char *chars_start,
+                       int chars_len,
+                       Lisp_Object color)
 {
   XVECTOR (color_table)->contents[*chars_start] = color;
 }
 
 static Lisp_Object
-xpm_get_color_table_v (color_table, chars_start, chars_len)
-     Lisp_Object color_table;
-     const unsigned char *chars_start;
-     int chars_len;
+xpm_get_color_table_v (Lisp_Object color_table,
+                       const unsigned char *chars_start,
+                       int chars_len)
 {
   return XVECTOR (color_table)->contents[*chars_start];
 }
 
 static Lisp_Object
-xpm_make_color_table_h (put_func, get_func)
-     void (**put_func) (Lisp_Object, const unsigned char *, int, Lisp_Object);
-     Lisp_Object (**get_func) (Lisp_Object, const unsigned char *, int);
+xpm_make_color_table_h (void (**put_func) (Lisp_Object,
+                                           const unsigned char *,
+                                           int,
+                                           Lisp_Object),
+                        Lisp_Object (**get_func) (Lisp_Object,
+                                                  const unsigned char *,
+                                                  int))
 {
   *put_func = xpm_put_color_table_h;
   *get_func = xpm_get_color_table_h;
@@ -3872,11 +3774,10 @@ xpm_make_color_table_h (put_func, get_func)
 }
 
 static void
-xpm_put_color_table_h (color_table, chars_start, chars_len, color)
-     Lisp_Object color_table;
-     const unsigned char *chars_start;
-     int chars_len;
-     Lisp_Object color;
+xpm_put_color_table_h (Lisp_Object color_table,
+                       const unsigned char *chars_start,
+                       int chars_len,
+                       Lisp_Object color)
 {
   struct Lisp_Hash_Table *table = XHASH_TABLE (color_table);
   unsigned hash_code;
@@ -3887,10 +3788,9 @@ xpm_put_color_table_h (color_table, chars_start, chars_len, color)
 }
 
 static Lisp_Object
-xpm_get_color_table_h (color_table, chars_start, chars_len)
-     Lisp_Object color_table;
-     const unsigned char *chars_start;
-     int chars_len;
+xpm_get_color_table_h (Lisp_Object color_table,
+                       const unsigned char *chars_start,
+                       int chars_len)
 {
   struct Lisp_Hash_Table *table = XHASH_TABLE (color_table);
   int i = hash_lookup (table, make_unibyte_string (chars_start, chars_len),
@@ -3910,8 +3810,7 @@ enum xpm_color_key {
 static const char xpm_color_key_strings[][4] = {"s", "m", "g4", "g", "c"};
 
 static int
-xpm_str_to_color_key (s)
-     const char *s;
+xpm_str_to_color_key (const char *s)
 {
   int i;
 
@@ -3924,10 +3823,10 @@ xpm_str_to_color_key (s)
 }
 
 static int
-xpm_load_image (f, img, contents, end)
-     struct frame *f;
-     struct image *img;
-     const unsigned char *contents, *end;
+xpm_load_image (struct frame *f,
+                struct image *img,
+                const unsigned char *contents,
+                const unsigned char *end)
 {
   const unsigned char *s = contents, *beg, *str;
   unsigned char buffer[BUFSIZ];
@@ -3959,7 +3858,7 @@ xpm_load_image (f, img, contents, end)
   if (!(end - s >= 9 && memcmp (s, "/* XPM */", 9) == 0))
     goto failure;
   s += 9;
-  match();
+  match ();
   expect_ident ("static");
   expect_ident ("char");
   expect ('*');
@@ -4109,8 +4008,8 @@ xpm_load_image (f, img, contents, end)
                     (!EQ (color_val, Qt) ? PIX_MASK_DRAW
                      : (have_mask = 1, PIX_MASK_RETAIN)));
 #else
-          if (EQ(color_val, Qt))
-            ns_set_alpha(ximg, x, y, 0);
+          if (EQ (color_val, Qt))
+            ns_set_alpha (ximg, x, y, 0);
 #endif
        }
       if (y + 1 < height)
@@ -4159,9 +4058,8 @@ xpm_load_image (f, img, contents, end)
 }
 
 static int
-xpm_load (f, img)
-     struct frame *f;
-     struct image *img;
+xpm_load (struct frame *f,
+          struct image *img)
 {
   int success_p = 0;
   Lisp_Object file_name;
@@ -4248,11 +4146,11 @@ int ct_colors_allocated;
 /* Initialize the color table.  */
 
 static void
-init_color_table ()
+init_color_table (void)
 {
   int size = CT_SIZE * sizeof (*ct_table);
   ct_table = (struct ct_color **) xmalloc (size);
-  bzero (ct_table, size);
+  memset (ct_table, 0, size);
   ct_colors_allocated = 0;
 }
 
@@ -4260,7 +4158,7 @@ init_color_table ()
 /* Free memory associated with the color table.  */
 
 static void
-free_color_table ()
+free_color_table (void)
 {
   int i;
   struct ct_color *p, *next;
@@ -4283,9 +4181,7 @@ free_color_table ()
    G, B, and make an entry in the color table.  */
 
 static unsigned long
-lookup_rgb_color (f, r, g, b)
-     struct frame *f;
-     int r, g, b;
+lookup_rgb_color (struct frame *f, int r, int g, int b)
 {
   unsigned hash = CT_HASH_RGB (r, g, b);
   int i = hash % CT_SIZE;
@@ -4380,9 +4276,7 @@ lookup_rgb_color (f, r, g, b)
    table.  If not already present, allocate it.  Value is PIXEL.  */
 
 static unsigned long
-lookup_pixel_color (f, pixel)
-     struct frame *f;
-     unsigned long pixel;
+lookup_pixel_color (struct frame *f, unsigned long pixel)
 {
   int i = pixel % CT_SIZE;
   struct ct_color *p;
@@ -4434,8 +4328,7 @@ lookup_pixel_color (f, pixel)
    allocated via xmalloc.  Set *N to the number of colors.  */
 
 static unsigned long *
-colors_in_color_table (n)
-     int *n;
+colors_in_color_table (int *n)
 {
   int i, j;
   struct ct_color *p;
@@ -4463,9 +4356,7 @@ colors_in_color_table (n)
 #else /* COLOR_TABLE_SUPPORT */
 
 static unsigned long
-lookup_rgb_color (f, r, g, b)
-     struct frame *f;
-     int r, g, b;
+lookup_rgb_color (struct frame *f, int r, int g, int b)
 {
   unsigned long pixel;
 
@@ -4480,7 +4371,7 @@ lookup_rgb_color (f, r, g, b)
 }
 
 static void
-init_color_table ()
+init_color_table (void)
 {
 }
 #endif /* COLOR_TABLE_SUPPORT */
@@ -4490,9 +4381,9 @@ init_color_table ()
                              Algorithms
  ***********************************************************************/
 
-static XColor *x_to_xcolors P_ ((struct frame *, struct image *, int));
-static void x_from_xcolors P_ ((struct frame *, struct image *, XColor *));
-static void x_detect_edges P_ ((struct frame *, struct image *, int[9], int));
+static XColor *x_to_xcolors (struct frame *, struct image *, int);
+static void x_from_xcolors (struct frame *, struct image *, XColor *);
+static void x_detect_edges (struct frame *, struct image *, int[9], int);
 
 #ifdef HAVE_NTGUI
 static void XPutPixel (XImagePtr , int, int, COLORREF);
@@ -4533,10 +4424,7 @@ static int laplace_matrix[9] = {
    allocated with xmalloc; it must be freed by the caller.  */
 
 static XColor *
-x_to_xcolors (f, img, rgb_p)
-     struct frame *f;
-     struct image *img;
-     int rgb_p;
+x_to_xcolors (struct frame *f, struct image *img, int rgb_p)
 {
   int x, y;
   XColor *colors, *p;
@@ -4601,10 +4489,7 @@ x_to_xcolors (f, img, rgb_p)
    stored in ximg->data.  */
 
 static void
-XPutPixel (ximg, x, y, color)
-     XImagePtr  ximg;
-     int x, y;
-     COLORREF color;
+XPutPixel (XImagePtr ximg, int x, int y, COLORREF color)
 {
   int width = ximg->info.bmiHeader.biWidth;
   int height = ximg->info.bmiHeader.biHeight;
@@ -4649,10 +4534,7 @@ XPutPixel (ximg, x, y, color)
    COLORS will be freed; an existing IMG->pixmap will be freed, too.  */
 
 static void
-x_from_xcolors (f, img, colors)
-     struct frame *f;
-     struct image *img;
-     XColor *colors;
+x_from_xcolors (struct frame *f, struct image *img, XColor *colors)
 {
   int x, y;
   XImagePtr oimg = NULL;
@@ -4694,10 +4576,7 @@ x_from_xcolors (f, img, colors)
    outgoing image.  */
 
 static void
-x_detect_edges (f, img, matrix, color_adjust)
-     struct frame *f;
-     struct image *img;
-     int matrix[9], color_adjust;
+x_detect_edges (struct frame *f, struct image *img, int *matrix, int color_adjust)
 {
   XColor *colors = x_to_xcolors (f, img, 1);
   XColor *new, *p;
@@ -4763,9 +4642,7 @@ x_detect_edges (f, img, matrix, color_adjust)
    on frame F.  */
 
 static void
-x_emboss (f, img)
-     struct frame *f;
-     struct image *img;
+x_emboss (struct frame *f, struct image *img)
 {
   x_detect_edges (f, img, emboss_matrix, 0xffff / 2);
 }
@@ -4776,9 +4653,7 @@ x_emboss (f, img)
    to draw disabled buttons, for example.  */
 
 static void
-x_laplace (f, img)
-     struct frame *f;
-     struct image *img;
+x_laplace (struct frame *f, struct image *img)
 {
   x_detect_edges (f, img, laplace_matrix, 45000);
 }
@@ -4796,10 +4671,8 @@ x_laplace (f, img)
    number.  */
 
 static void
-x_edge_detection (f, img, matrix, color_adjust)
-     struct frame *f;
-     struct image *img;
-     Lisp_Object matrix, color_adjust;
+x_edge_detection (struct frame *f, struct image *img, Lisp_Object matrix,
+                 Lisp_Object color_adjust)
 {
   int i = 0;
   int trans[9];
@@ -4828,9 +4701,7 @@ x_edge_detection (f, img, matrix, color_adjust)
 /* Transform image IMG on frame F so that it looks disabled.  */
 
 static void
-x_disable_image (f, img)
-     struct frame *f;
-     struct image *img;
+x_disable_image (struct frame *f, struct image *img)
 {
   Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
 #ifdef HAVE_NTGUI
@@ -4932,10 +4803,7 @@ x_disable_image (f, img)
    heuristically.  Value is non-zero if successful. */
 
 static int
-x_build_heuristic_mask (f, img, how)
-     struct frame *f;
-     struct image *img;
-     Lisp_Object how;
+x_build_heuristic_mask (struct frame *f, struct image *img, Lisp_Object how)
 {
   XImagePtr_or_DC ximg;
 #ifndef HAVE_NTGUI
@@ -4973,7 +4841,7 @@ x_build_heuristic_mask (f, img, how)
   /* Create the bit array serving as mask.  */
   row_width = (img->width + 7) / 8;
   mask_img = xmalloc (row_width * img->height);
-  bzero (mask_img, row_width * img->height);
+  memset (mask_img, 0, row_width * img->height);
 
   /* Create a memory device context for IMG->pixmap.  */
   frame_dc = get_frame_dc (f);
@@ -5022,7 +4890,7 @@ x_build_heuristic_mask (f, img, how)
                                  ? PIX_MASK_DRAW : PIX_MASK_RETAIN));
 #else
       if (XGetPixel (ximg, x, y) == bg)
-        ns_set_alpha(ximg, x, y, 0);
+        ns_set_alpha (ximg, x, y, 0);
 #endif /* HAVE_NS */
 #ifndef HAVE_NS
   /* Fill in the background_transparent field while we have the mask handy. */
@@ -5062,9 +4930,9 @@ x_build_heuristic_mask (f, img, how)
                       PBM (mono, gray, color)
  ***********************************************************************/
 
-static int pbm_image_p P_ ((Lisp_Object object));
-static int pbm_load P_ ((struct frame *f, struct image *img));
-static int pbm_scan_number P_ ((unsigned char **, unsigned char *));
+static int pbm_image_p (Lisp_Object object);
+static int pbm_load (struct frame *f, struct image *img);
+static int pbm_scan_number (unsigned char **, unsigned char *);
 
 /* The symbol `pbm' identifying images of this type.  */
 
@@ -5121,12 +4989,11 @@ static struct image_type pbm_type =
 /* Return non-zero if OBJECT is a valid PBM image specification.  */
 
 static int
-pbm_image_p (object)
-     Lisp_Object object;
+pbm_image_p (Lisp_Object object)
 {
   struct image_keyword fmt[PBM_LAST];
 
-  bcopy (pbm_format, fmt, sizeof fmt);
+  memcpy (fmt, pbm_format, sizeof fmt);
 
   if (!parse_image_spec (object, fmt, PBM_LAST, Qpbm))
     return 0;
@@ -5141,8 +5008,7 @@ pbm_image_p (object)
    end of input.  */
 
 static int
-pbm_scan_number (s, end)
-     unsigned char **s, *end;
+pbm_scan_number (unsigned char **s, unsigned char *end)
 {
   int c = 0, val = -1;
 
@@ -5217,9 +5083,7 @@ pbm_read_file (file, size)
 /* Load PBM image IMG for use on frame F.  */
 
 static int
-pbm_load (f, img)
-     struct frame *f;
-     struct image *img;
+pbm_load (struct frame *f, struct image *img)
 {
   int raw_p, x, y;
   int width, height, max_color_idx = 0;
@@ -5341,7 +5205,7 @@ pbm_load (f, img)
       unsigned long bg = FRAME_BACKGROUND_PIXEL (f);
 
       /* Parse the image specification.  */
-      bcopy (pbm_format, fmt, sizeof fmt);
+      memcpy (fmt, pbm_format, sizeof fmt);
       parse_image_spec (img->spec, fmt, PBM_LAST, Qpbm);
 
       /* Get foreground and background colors, maybe allocate colors.  */
@@ -5486,8 +5350,8 @@ pbm_load (f, img)
 
 /* Function prototypes.  */
 
-static int png_image_p P_ ((Lisp_Object object));
-static int png_load P_ ((struct frame *f, struct image *img));
+static int png_image_p (Lisp_Object object);
+static int png_load (struct frame *f, struct image *img);
 
 /* The symbol `png' identifying images of this type.  */
 
@@ -5541,11 +5405,10 @@ static struct image_type png_type =
 /* Return non-zero if OBJECT is a valid PNG image specification.  */
 
 static int
-png_image_p (object)
-     Lisp_Object object;
+png_image_p (Lisp_Object object)
 {
   struct image_keyword fmt[PNG_LAST];
-  bcopy (png_format, fmt, sizeof fmt);
+  memcpy (fmt, png_format, sizeof fmt);
 
   if (!parse_image_spec (object, fmt, PNG_LAST, Qpng))
     return 0;
@@ -5646,9 +5509,7 @@ init_png_functions (Lisp_Object libraries)
    is initialized.  */
 
 static void
-my_png_error (png_ptr, msg)
-     png_struct *png_ptr;
-     char *msg;
+my_png_error (png_struct *png_ptr, const char *msg)
 {
   xassert (png_ptr != NULL);
   image_error ("PNG error: %s", build_string (msg), Qnil);
@@ -5657,9 +5518,7 @@ my_png_error (png_ptr, msg)
 
 
 static void
-my_png_warning (png_ptr, msg)
-     png_struct *png_ptr;
-     char *msg;
+my_png_warning (png_struct *png_ptr, const char *msg)
 {
   xassert (png_ptr != NULL);
   image_error ("PNG warning: %s", build_string (msg), Qnil);
@@ -5680,10 +5539,7 @@ struct png_memory_storage
    bytes from the input to DATA.  */
 
 static void
-png_read_from_memory (png_ptr, data, length)
-     png_structp png_ptr;
-     png_bytep data;
-     png_size_t length;
+png_read_from_memory (png_structp png_ptr, png_bytep data, png_size_t length)
 {
   struct png_memory_storage *tbr
     = (struct png_memory_storage *) fn_png_get_io_ptr (png_ptr);
@@ -5691,7 +5547,7 @@ png_read_from_memory (png_ptr, data, length)
   if (length > tbr->len - tbr->index)
     fn_png_error (png_ptr, "Read error");
 
-  bcopy (tbr->bytes + tbr->index, data, length);
+  memcpy (data, tbr->bytes + tbr->index, length);
   tbr->index = tbr->index + length;
 }
 
@@ -5701,10 +5557,7 @@ png_read_from_memory (png_ptr, data, length)
    bytes from the input to DATA.  */
 
 static void
-png_read_from_file (png_ptr, data, length)
-     png_structp png_ptr;
-     png_bytep data;
-     png_size_t length;
+png_read_from_file (png_structp png_ptr, png_bytep data, png_size_t length)
 {
   FILE *fp = (FILE *) fn_png_get_io_ptr (png_ptr);
 
@@ -5717,9 +5570,7 @@ png_read_from_file (png_ptr, data, length)
    successful.  */
 
 static int
-png_load (f, img)
-     struct frame *f;
-     struct image *img;
+png_load (struct frame *f, struct image *img)
 {
   Lisp_Object file, specified_file;
   Lisp_Object specified_data;
@@ -5898,7 +5749,7 @@ png_load (f, img)
            {
              png_color_16 user_bg;
 
-             bzero (&user_bg, sizeof user_bg);
+             memset (&user_bg, 0, sizeof user_bg);
              user_bg.red = color.red >> shift;
              user_bg.green = color.green >> shift;
              user_bg.blue = color.blue >> shift;
@@ -5918,7 +5769,7 @@ png_load (f, img)
          color.pixel = FRAME_BACKGROUND_PIXEL (f);
          x_query_color (f, &color);
 
-         bzero (&frame_background, sizeof frame_background);
+         memset (&frame_background, 0, sizeof frame_background);
          frame_background.red = color.red >> shift;
          frame_background.green = color.green >> shift;
          frame_background.blue = color.blue >> shift;
@@ -6088,8 +5939,8 @@ png_load (struct frame *f, struct image *img)
 
 #if defined (HAVE_JPEG) || defined (HAVE_NS)
 
-static int jpeg_image_p P_ ((Lisp_Object object));
-static int jpeg_load P_ ((struct frame *f, struct image *img));
+static int jpeg_image_p (Lisp_Object object);
+static int jpeg_load (struct frame *f, struct image *img);
 
 /* The symbol `jpeg' identifying images of this type.  */
 
@@ -6143,12 +5994,11 @@ static struct image_type jpeg_type =
 /* Return non-zero if OBJECT is a valid JPEG image specification.  */
 
 static int
-jpeg_image_p (object)
-     Lisp_Object object;
+jpeg_image_p (Lisp_Object object)
 {
   struct image_keyword fmt[JPEG_LAST];
 
-  bcopy (jpeg_format, fmt, sizeof fmt);
+  memcpy (fmt, jpeg_format, sizeof fmt);
 
   if (!parse_image_spec (object, fmt, JPEG_LAST, Qjpeg))
     return 0;
@@ -6215,9 +6065,7 @@ init_jpeg_functions (Lisp_Object libraries)
 /* Wrapper since we can't directly assign the function pointer
    to another function pointer that was declared more completely easily.  */
 static boolean
-jpeg_resync_to_restart_wrapper (cinfo, desired)
-     j_decompress_ptr cinfo;
-     int desired;
+jpeg_resync_to_restart_wrapper (j_decompress_ptr cinfo, int desired)
 {
   return fn_jpeg_resync_to_restart (cinfo, desired);
 }
@@ -6243,8 +6091,7 @@ struct my_jpeg_error_mgr
 
 
 static void
-my_error_exit (cinfo)
-     j_common_ptr cinfo;
+my_error_exit (j_common_ptr cinfo)
 {
   struct my_jpeg_error_mgr *mgr = (struct my_jpeg_error_mgr *) cinfo->err;
   longjmp (mgr->setjmp_buffer, 1);
@@ -6256,8 +6103,7 @@ my_error_exit (cinfo)
    libjpeg.doc from the JPEG lib distribution.  */
 
 static void
-our_common_init_source (cinfo)
-     j_decompress_ptr cinfo;
+our_common_init_source (j_decompress_ptr cinfo)
 {
 }
 
@@ -6266,8 +6112,7 @@ our_common_init_source (cinfo)
    jpeg_finish_decompress() after all data has been processed.  */
 
 static void
-our_common_term_source (cinfo)
-     j_decompress_ptr cinfo;
+our_common_term_source (j_decompress_ptr cinfo)
 {
 }
 
@@ -6279,8 +6124,7 @@ our_common_term_source (cinfo)
 static JOCTET our_memory_buffer[2];
 
 static boolean
-our_memory_fill_input_buffer (cinfo)
-     j_decompress_ptr cinfo;
+our_memory_fill_input_buffer (j_decompress_ptr cinfo)
 {
   /* Insert a fake EOI marker.  */
   struct jpeg_source_mgr *src = cinfo->src;
@@ -6298,9 +6142,7 @@ our_memory_fill_input_buffer (cinfo)
    is the JPEG data source manager.  */
 
 static void
-our_memory_skip_input_data (cinfo, num_bytes)
-     j_decompress_ptr cinfo;
-     long num_bytes;
+our_memory_skip_input_data (j_decompress_ptr cinfo, long int num_bytes)
 {
   struct jpeg_source_mgr *src = (struct jpeg_source_mgr *) cinfo->src;
 
@@ -6320,10 +6162,7 @@ our_memory_skip_input_data (cinfo, num_bytes)
    reading the image.  */
 
 static void
-jpeg_memory_src (cinfo, data, len)
-     j_decompress_ptr cinfo;
-     JOCTET *data;
-     unsigned int len;
+jpeg_memory_src (j_decompress_ptr cinfo, JOCTET *data, unsigned int len)
 {
   struct jpeg_source_mgr *src;
 
@@ -6366,8 +6205,7 @@ struct jpeg_stdio_mgr
    whenever more data is needed.  The data is read from a FILE *.  */
 
 static boolean
-our_stdio_fill_input_buffer (cinfo)
-     j_decompress_ptr cinfo;
+our_stdio_fill_input_buffer (j_decompress_ptr cinfo)
 {
   struct jpeg_stdio_mgr *src;
 
@@ -6398,9 +6236,7 @@ our_stdio_fill_input_buffer (cinfo)
    is the JPEG data source manager.  */
 
 static void
-our_stdio_skip_input_data (cinfo, num_bytes)
-     j_decompress_ptr cinfo;
-     long num_bytes;
+our_stdio_skip_input_data (j_decompress_ptr cinfo, long int num_bytes)
 {
   struct jpeg_stdio_mgr *src;
   src = (struct jpeg_stdio_mgr *) cinfo->src;
@@ -6430,9 +6266,7 @@ our_stdio_skip_input_data (cinfo, num_bytes)
    reading the image.  */
 
 static void
-jpeg_file_src (cinfo, fp)
-     j_decompress_ptr cinfo;
-     FILE *fp;
+jpeg_file_src (j_decompress_ptr cinfo, FILE *fp)
 {
   struct jpeg_stdio_mgr *src;
 
@@ -6466,9 +6300,7 @@ jpeg_file_src (cinfo, fp)
    from the JPEG lib.  */
 
 static int
-jpeg_load (f, img)
-     struct frame *f;
-     struct image *img;
+jpeg_load (struct frame *f, struct image *img)
 {
   struct jpeg_decompress_struct cinfo;
   struct my_jpeg_error_mgr mgr;
@@ -6644,9 +6476,9 @@ jpeg_load (f, img)
 static int
 jpeg_load (struct frame *f, struct image *img)
 {
-  return ns_load_image(f, img,
-                       image_spec_value (img->spec, QCfile, NULL),
-                       image_spec_value (img->spec, QCdata, NULL));
+  return ns_load_image (f, img,
+                       image_spec_value (img->spec, QCfile, NULL),
+                       image_spec_value (img->spec, QCdata, NULL));
 }
 #endif  /* HAVE_NS */
 
@@ -6660,8 +6492,8 @@ jpeg_load (struct frame *f, struct image *img)
 
 #if defined (HAVE_TIFF) || defined (HAVE_NS)
 
-static int tiff_image_p P_ ((Lisp_Object object));
-static int tiff_load P_ ((struct frame *f, struct image *img));
+static int tiff_image_p (Lisp_Object object);
+static int tiff_load (struct frame *f, struct image *img);
 
 /* The symbol `tiff' identifying images of this type.  */
 
@@ -6717,11 +6549,10 @@ static struct image_type tiff_type =
 /* Return non-zero if OBJECT is a valid TIFF image specification.  */
 
 static int
-tiff_image_p (object)
-     Lisp_Object object;
+tiff_image_p (Lisp_Object object)
 {
   struct image_keyword fmt[TIFF_LAST];
-  bcopy (tiff_format, fmt, sizeof fmt);
+  memcpy (fmt, tiff_format, sizeof fmt);
 
   if (!parse_image_spec (object, fmt, TIFF_LAST, Qtiff))
     return 0;
@@ -6798,34 +6629,25 @@ typedef struct
 tiff_memory_source;
 
 static size_t
-tiff_read_from_memory (data, buf, size)
-     thandle_t data;
-     tdata_t buf;
-     tsize_t size;
+tiff_read_from_memory (thandle_t data, tdata_t buf, tsize_t size)
 {
   tiff_memory_source *src = (tiff_memory_source *) data;
 
   if (size > src->len - src->index)
     return (size_t) -1;
-  bcopy (src->bytes + src->index, buf, size);
+  memcpy (buf, src->bytes + src->index, size);
   src->index += size;
   return size;
 }
 
 static size_t
-tiff_write_from_memory (data, buf, size)
-     thandle_t data;
-     tdata_t buf;
-     tsize_t size;
+tiff_write_from_memory (thandle_t data, tdata_t buf, tsize_t size)
 {
   return (size_t) -1;
 }
 
 static toff_t
-tiff_seek_in_memory (data, off, whence)
-     thandle_t data;
-     toff_t off;
-     int whence;
+tiff_seek_in_memory (thandle_t data, toff_t off, int whence)
 {
   tiff_memory_source *src = (tiff_memory_source *) data;
   int idx;
@@ -6856,44 +6678,34 @@ tiff_seek_in_memory (data, off, whence)
 }
 
 static int
-tiff_close_memory (data)
-     thandle_t data;
+tiff_close_memory (thandle_t data)
 {
   /* NOOP */
   return 0;
 }
 
 static int
-tiff_mmap_memory (data, pbase, psize)
-     thandle_t data;
-     tdata_t *pbase;
-     toff_t *psize;
+tiff_mmap_memory (thandle_t data, tdata_t *pbase, toff_t *psize)
 {
   /* It is already _IN_ memory. */
   return 0;
 }
 
 static void
-tiff_unmap_memory (data, base, size)
-     thandle_t data;
-     tdata_t base;
-     toff_t size;
+tiff_unmap_memory (thandle_t data, tdata_t base, toff_t size)
 {
   /* We don't need to do this. */
 }
 
 static toff_t
-tiff_size_of_memory (data)
-     thandle_t data;
+tiff_size_of_memory (thandle_t data)
 {
   return ((tiff_memory_source *) data)->len;
 }
 
 
 static void
-tiff_error_handler (title, format, ap)
-     const char *title, *format;
-     va_list ap;
+tiff_error_handler (const char *title, const char *format, va_list ap)
 {
   char buf[512];
   int len;
@@ -6905,9 +6717,7 @@ tiff_error_handler (title, format, ap)
 
 
 static void
-tiff_warning_handler (title, format, ap)
-     const char *title, *format;
-     va_list ap;
+tiff_warning_handler (const char *title, const char *format, va_list ap)
 {
   char buf[512];
   int len;
@@ -6922,9 +6732,7 @@ tiff_warning_handler (title, format, ap)
    successful.  */
 
 static int
-tiff_load (f, img)
-     struct frame *f;
-     struct image *img;
+tiff_load (struct frame *f, struct image *img)
 {
   Lisp_Object file, specified_file;
   Lisp_Object specified_data;
@@ -7095,9 +6903,9 @@ tiff_load (f, img)
 static int
 tiff_load (struct frame *f, struct image *img)
 {
-  return ns_load_image(f, img,
-                       image_spec_value (img->spec, QCfile, NULL),
-                       image_spec_value (img->spec, QCdata, NULL));
+  return ns_load_image (f, img,
+                        image_spec_value (img->spec, QCfile, NULL),
+                        image_spec_value (img->spec, QCdata, NULL));
 }
 #endif  /* HAVE_NS */
 
@@ -7111,9 +6919,9 @@ tiff_load (struct frame *f, struct image *img)
 
 #if defined (HAVE_GIF) || defined (HAVE_NS)
 
-static int gif_image_p P_ ((Lisp_Object object));
-static int gif_load P_ ((struct frame *f, struct image *img));
-static void gif_clear_image P_ ((struct frame *f, struct image *img));
+static int gif_image_p (Lisp_Object object);
+static int gif_load (struct frame *f, struct image *img);
+static void gif_clear_image (struct frame *f, struct image *img);
 
 /* The symbol `gif' identifying images of this type.  */
 
@@ -7169,11 +6977,9 @@ static struct image_type gif_type =
 /* Free X resources of GIF image IMG which is used on frame F.  */
 
 static void
-gif_clear_image (f, img)
-     struct frame *f;
-     struct image *img;
+gif_clear_image (struct frame *f, struct image *img)
 {
-  /* IMG->data.ptr_val may contain extension data.  */
+  /* IMG->data.ptr_val may contain metadata with extension data.  */
   img->data.lisp_val = Qnil;
   x_clear_image (f, img);
 }
@@ -7181,11 +6987,10 @@ gif_clear_image (f, img)
 /* Return non-zero if OBJECT is a valid GIF image specification.  */
 
 static int
-gif_image_p (object)
-     Lisp_Object object;
+gif_image_p (Lisp_Object object)
 {
   struct image_keyword fmt[GIF_LAST];
-  bcopy (gif_format, fmt, sizeof fmt);
+  memcpy (fmt, gif_format, sizeof fmt);
 
   if (!parse_image_spec (object, fmt, GIF_LAST, Qgif))
     return 0;
@@ -7265,17 +7070,14 @@ gif_memory_source;
 static gif_memory_source *current_gif_memory_src;
 
 static int
-gif_read_from_memory (file, buf, len)
-     GifFileType *file;
-     GifByteType *buf;
-     int len;
+gif_read_from_memory (GifFileType *file, GifByteType *buf, int len)
 {
   gif_memory_source *src = current_gif_memory_src;
 
   if (len > src->len - src->index)
     return -1;
 
-  bcopy (src->bytes + src->index, buf, len);
+  memcpy (buf, src->bytes + src->index, len);
   src->index += len;
   return len;
 }
@@ -7288,9 +7090,7 @@ static const int interlace_start[] = {0, 4, 2, 1};
 static const int interlace_increment[] = {8, 8, 4, 2};
 
 static int
-gif_load (f, img)
-     struct frame *f;
-     struct image *img;
+gif_load (struct frame *f, struct image *img)
 {
   Lisp_Object file, specified_file;
   Lisp_Object specified_data;
@@ -7413,7 +7213,7 @@ gif_load (f, img)
   if (!gif_color_map)
     gif_color_map = gif->SColorMap;
   init_color_table ();
-  bzero (pixel_colors, sizeof pixel_colors);
+  memset (pixel_colors, 0, sizeof pixel_colors);
 
   if (gif_color_map)
     for (i = 0; i < gif_color_map->ColorCount; ++i)
@@ -7492,8 +7292,8 @@ gif_load (f, img)
          }
     }
 
-  /* Save GIF image extension data for `image-extension-data'.
-     Format is (count IMAGES FUNCTION "BYTES" ...).  */
+  /* Save GIF image extension data for `image-metadata'.
+     Format is (count IMAGES extension-data (FUNCTION "BYTES" ...)).  */
   img->data.lisp_val = Qnil;
   if (gif->SavedImages[ino].ExtensionBlockCount > 0)
     {
@@ -7503,7 +7303,9 @@ gif_load (f, img)
        img->data.lisp_val = Fcons (make_unibyte_string (ext->Bytes, ext->ByteCount),
                                    Fcons (make_number (ext->Function),
                                           img->data.lisp_val));
-      img->data.lisp_val = Fnreverse (img->data.lisp_val);
+      img->data.lisp_val = Fcons (Qextension_data,
+                                 Fcons (Fnreverse (img->data.lisp_val),
+                                        Qnil));
     }
   if (gif->ImageCount > 1)
     img->data.lisp_val = Fcons (Qcount,
@@ -7531,15 +7333,519 @@ gif_load (f, img)
 static int
 gif_load (struct frame *f, struct image *img)
 {
-  return ns_load_image(f, img,
-                       image_spec_value (img->spec, QCfile, NULL),
-                       image_spec_value (img->spec, QCdata, NULL));
+  return ns_load_image (f, img,
+                        image_spec_value (img->spec, QCfile, NULL),
+                       image_spec_value (img->spec, QCdata, NULL));
 }
 #endif /* HAVE_NS */
 
 #endif /* HAVE_GIF */
 
 
+/***********************************************************************
+                                imagemagick
+***********************************************************************/
+#if defined (HAVE_IMAGEMAGICK)
+Lisp_Object Vimagemagick_render_type;
+
+/* The symbol `imagemagick' identifying images of this type.  */
+
+Lisp_Object Qimagemagick;
+Lisp_Object Vimagemagick_render_type;
+
+/* Indices of image specification fields in imagemagick_format, below.  */
+
+enum imagemagick_keyword_index
+  {
+    IMAGEMAGICK_TYPE,
+    IMAGEMAGICK_DATA,
+    IMAGEMAGICK_FILE,
+    IMAGEMAGICK_ASCENT,
+    IMAGEMAGICK_MARGIN,
+    IMAGEMAGICK_RELIEF,
+    IMAGEMAGICK_ALGORITHM,
+    IMAGEMAGICK_HEURISTIC_MASK,
+    IMAGEMAGICK_MASK,
+    IMAGEMAGICK_BACKGROUND,
+    IMAGEMAGICK_HEIGHT,
+    IMAGEMAGICK_WIDTH,
+    IMAGEMAGICK_ROTATION,
+    IMAGEMAGICK_CROP,
+    IMAGEMAGICK_LAST
+  };
+
+/* Vector of image_keyword structures describing the format
+   of valid user-defined image specifications.  */
+
+static struct image_keyword imagemagick_format[IMAGEMAGICK_LAST] =
+  {
+    {":type",          IMAGE_SYMBOL_VALUE,                     1},
+    {":data",          IMAGE_STRING_VALUE,                     0},
+    {":file",          IMAGE_STRING_VALUE,                     0},
+    {":ascent",                IMAGE_ASCENT_VALUE,                     0},
+    {":margin",                IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR,   0},
+    {":relief",                IMAGE_INTEGER_VALUE,                    0},
+    {":conversion",    IMAGE_DONT_CHECK_VALUE_TYPE,            0},
+    {":heuristic-mask",        IMAGE_DONT_CHECK_VALUE_TYPE,            0},
+    {":mask",          IMAGE_DONT_CHECK_VALUE_TYPE,            0},
+    {":background",    IMAGE_STRING_OR_NIL_VALUE,              0},
+    {":height",                IMAGE_INTEGER_VALUE,                    0},    
+    {":width",         IMAGE_INTEGER_VALUE,                    0},    
+    {":rotation",      IMAGE_NUMBER_VALUE,                     0},    
+    {":crop",          IMAGE_DONT_CHECK_VALUE_TYPE,            0}
+  };
+/* Free X resources of imagemagick image IMG which is used on frame F.  */
+
+static void
+imagemagick_clear_image (struct frame *f,
+                         struct image *img)
+{
+  x_clear_image (f, img);
+}
+
+
+
+/* Return non-zero if OBJECT is a valid IMAGEMAGICK image specification.  Do
+   this by calling parse_image_spec and supplying the keywords that
+   identify the IMAGEMAGICK format.   */
+
+static int
+imagemagick_image_p (Lisp_Object object)
+{
+  struct image_keyword fmt[IMAGEMAGICK_LAST];
+  bcopy (imagemagick_format, fmt, sizeof fmt);
+
+  if (!parse_image_spec (object, fmt, IMAGEMAGICK_LAST, Qimagemagick))
+    return 0;
+
+  /* Must specify either the :data or :file keyword.  */
+  return fmt[IMAGEMAGICK_FILE].count + fmt[IMAGEMAGICK_DATA].count == 1;
+}
+
+/* The GIF library also defines DrawRectangle, but its never used in Emacs.
+   Therefore rename the function so it doesnt collide with ImageMagick.  */
+#define DrawRectangle DrawRectangleGif
+#include <wand/MagickWand.h>
+
+/* imagemagick_load_image is a helper function for imagemagick_load,
+   which does the actual loading given contents and size, apart from
+   frame and image structures, passed from imagemagick_load.
+
+   Uses librimagemagick to do most of the image processing.
+
+   non-zero when successful.
+*/
+
+static int
+imagemagick_load_image (/* Pointer to emacs frame structure.  */
+                        struct frame *f,
+                        /* Pointer to emacs image structure.  */
+                        struct image *img, 
+                        /* String containing the IMAGEMAGICK data to
+                           be parsed.  */
+                        unsigned char *contents,
+                        /* Size of data in bytes.  */
+                        unsigned int size,
+                        /* Filename, either pass filename or
+                           contents/size.  */
+                        unsigned char *filename)
+{
+  size_t width;
+  size_t height;
+
+  MagickBooleanType
+    status;
+
+  XImagePtr ximg;
+  Lisp_Object specified_bg;
+  XColor background;
+  int x;
+  int y;
+
+  MagickWand  *image_wand;
+  MagickWand  *ping_wand;  
+  PixelIterator *iterator;
+  PixelWand  **pixels;
+  MagickPixelPacket  pixel;
+  Lisp_Object image;
+  Lisp_Object value;  
+  Lisp_Object crop, geometry;
+  long ino;
+  int desired_width, desired_height;
+  double rotation;
+  int imagemagick_rendermethod;
+  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 many sub-images it contains. Pinging is faster
+     than loading the image to find out things about it.  */
+  image = image_spec_value (img->spec, QCindex, NULL);
+  ino = INTEGERP (image) ? XFASTINT (image) : 0;
+  ping_wand=NewMagickWand();
+  MagickSetResolution(ping_wand, 2, 2);
+  if (filename != NULL)
+    {
+      status = MagickPingImage(ping_wand, filename);
+    }
+  else
+    {
+      status = MagickPingImageBlob(ping_wand, contents, size);
+    }
+  
+  if (ino >= MagickGetNumberImages(ping_wand)) 
+    { 
+      image_error ("Invalid image number `%s' in image `%s'", 
+                  image, img->spec); 
+      UNGCPRO; 
+      return 0; 
+    } 
+
+  if (MagickGetNumberImages(ping_wand) > 1)
+    img->data.lisp_val =
+      Fcons (Qcount,
+             Fcons (make_number (MagickGetNumberImages(ping_wand)),
+                    img->data.lisp_val));
+
+  DestroyMagickWand (ping_wand);
+  /* Now, after pinging, we know how many images are inside the
+     file. If its not a bundle, just one.  */
+
+  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); 
+      CatchException(exception);
+
+      image_wand = NewMagickWandFromImage(im_image);
+    }
+  else
+    {
+      image_wand = NewMagickWand();  
+      status = MagickReadImageBlob(image_wand, contents, size);
+    }
+  image_error ("im read failed", Qnil, Qnil);
+  if (status == MagickFalse) goto imagemagick_error;
+
+  /* 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);
+  desired_height = (INTEGERP (value) ? XFASTINT (value) : -1);
+
+  height = MagickGetImageHeight (image_wand);
+  width = MagickGetImageWidth (image_wand);
+
+  if(desired_width != -1 && desired_height == -1)
+    {
+      /* w known, calculate h.  */
+      desired_height = ( (double)desired_width / width  ) * height;
+    }
+  if(desired_width == -1 && desired_height != -1)
+    {
+      /* h known, calculate w.  */
+      desired_width = ( (double)desired_height / height  ) * width;
+    }  
+  if(desired_width != -1 && desired_height != -1)
+    {
+      status = MagickScaleImage(image_wand, desired_width, desired_height);
+      if (status == MagickFalse) {
+        image_error ("Imagemagick scale failed", Qnil, Qnil);
+        goto imagemagick_error;
+      }
+    }
+
+
+  /* crop behaves similar to image slicing in Emacs but is more memory
+     efficient */
+  crop     = image_spec_value (img->spec, QCcrop, NULL);
+  
+  if(CONSP (crop))
+    {
+      /* 
+         after some testing, it seems MagickCropImage is the fastest
+         crop function in ImageMagick. This crop function seems to do
+         less copying than the alternatives, but it still reads the
+         entire image into memory before croping, which is aparently
+         difficult to avoid when using imagemagick. */
+      
+      int w,h,x,y;
+      w=XFASTINT(XCAR(crop));
+      h=XFASTINT(XCAR(XCDR(crop)));
+      x=XFASTINT(XCAR(XCDR(XCDR(crop))));
+      y=XFASTINT(XCAR(XCDR(XCDR(XCDR(crop)))));
+      MagickCropImage(image_wand, w,h, x,y);
+    }
+  
+  /* Furthermore :rotation. we need background color and angle for
+     rotation.  */
+  /*
+    TODO background handling for rotation specified_bg =
+    image_spec_value (img->spec, QCbackground, NULL); if (!STRINGP
+    (specified_bg).  */
+  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);
+      if (status == MagickFalse)
+        {
+          image_error ("Imagemagick image rotate failed", Qnil, Qnil);
+          goto imagemagick_error;
+        }
+    }
+  
+  /* Finaly we are done manipulating the image, figure out resulting
+     width, height, and then transfer ownerwship to Emacs.  */
+  height = MagickGetImageHeight (image_wand);
+  width = MagickGetImageWidth (image_wand);
+  if (status == MagickFalse)
+    {
+      image_error ("Imagemagick image get size failed", Qnil, Qnil);  
+      goto imagemagick_error;
+    }
+    
+  if (! check_image_size (f, width, height))
+    {
+      image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil);
+      goto imagemagick_error;
+    }
+  
+  /* We can now get a valid pixel buffer from the imagemagick file, if all
+     went ok.  */
+
+  init_color_table ();
+  imagemagick_rendermethod = (INTEGERP (Vimagemagick_render_type)
+                              ? XFASTINT (Vimagemagick_render_type) : 0);
+  if (imagemagick_rendermethod == 0)
+    {
+      /* Try to create a x pixmap to hold the imagemagick pixmap.  */
+      if (!x_create_x_image_and_pixmap (f, width, height, 0,
+                                        &ximg, &img->pixmap))
+        {
+          image_error("Imagemagick X bitmap allocation failure", Qnil, Qnil);
+          goto imagemagick_error;
+        }
+    
+      /* Copy imagegmagick image to x with primitive yet robust pixel
+         pusher loop.  This has been tested a lot with many different
+         images.  */
+  
+      /* Copy pixels from the imagemagick image structure to the x image map. */
+      iterator = NewPixelIterator (image_wand);
+      if ((iterator == (PixelIterator *) NULL))
+        {
+          image_error ("Imagemagick pixel iterator creation failed",
+                       Qnil, Qnil);
+          goto imagemagick_error;
+        }
+
+      for (y = 0; y < (long) MagickGetImageHeight(image_wand); y++)
+        {
+          pixels = PixelGetNextIteratorRow (iterator, &width);
+          if ((pixels == (PixelWand **) NULL))
+            break;
+          for (x = 0; x < (long) width; x++)
+            {
+              PixelGetMagickColor (pixels[x], &pixel);
+              XPutPixel (ximg, x, y,
+                         lookup_rgb_color (f,
+                                           pixel.red,
+                                           pixel.green,
+                                           pixel.blue));
+            }
+        }
+      DestroyPixelIterator (iterator);
+    }
+
+  if (imagemagick_rendermethod == 1)
+    {
+      /* Magicexportimage is normaly 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);*/
+      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)){
+        image_error("Imagemagick X bitmap allocation failure", Qnil, Qnil);
+        goto imagemagick_error;
+      }
+
+    
+      /* Oddly, the below code doesnt 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 dont have MagickExportImagePixels, upgrade ImageMagick!",
+                  Qnil, Qnil);
+#endif    
+    }
+  
+
+#ifdef COLOR_TABLE_SUPPORT
+  /* Remember colors allocated for this image.  */
+  img->colors = colors_in_color_table (&img->ncolors);
+  free_color_table ();
+#endif /* COLOR_TABLE_SUPPORT */
+
+
+  img->width  = width;
+  img->height = height;
+
+  /* Put the image into the pixmap, then free the X image and its
+     buffer.  */
+  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);
+
+  return 1;
+
+ imagemagick_error:
+  /* TODO more cleanup.  */
+  image_error ("Error parsing IMAGEMAGICK image `%s'", img->spec, Qnil);
+  return 0;
+}
+
+
+/* Load IMAGEMAGICK image IMG for use on frame F.  Value is non-zero if
+   successful. this function will go into the imagemagick_type structure, and
+   the prototype thus needs to be compatible with that structure.  */
+
+static int
+imagemagick_load (struct frame *f,
+                  struct image *img)
+{
+  int success_p = 0;
+  Lisp_Object file_name;
+
+  /* If IMG->spec specifies a file name, create a non-file spec from it.  */
+  file_name = image_spec_value (img->spec, QCfile, NULL);
+  if (STRINGP (file_name))
+    {
+      Lisp_Object file;
+      unsigned char *contents;
+      int size;
+      struct gcpro gcpro1;
+
+      file = x_find_image_file (file_name);
+      GCPRO1 (file);
+      if (!STRINGP (file))
+       {
+         image_error ("Cannot find image file `%s'", file_name, Qnil);
+         UNGCPRO;
+         return 0;
+       }
+      success_p = imagemagick_load_image (f, img, 0, 0, SDATA(file_name));
+      UNGCPRO;
+    }
+  /* Else its not a file, its a lisp object.  Load the image from a
+     lisp object rather than a file.  */
+  else
+    {
+      Lisp_Object data;
+
+      data = image_spec_value (img->spec, QCdata, NULL);
+      success_p = imagemagick_load_image (f, img, SDATA (data),
+                                          SBYTES (data), NULL);
+    }
+
+  return success_p;
+}
+
+/* Structure describing the image type `imagemagick'.  Its the same
+   type of structure defined for all image formats, handled by Emacs
+   image functions.  See struct image_type in dispextern.h.  */
+
+static struct image_type imagemagick_type =
+  {
+    /* An identifier showing that this is an image structure for the
+       IMAGEMAGICK format.  */
+    &Qimagemagick,
+    /* Handle to a function that can be used to identify a IMAGEMAGICK
+       file.  */
+    imagemagick_image_p,
+    /* Handle to function used to load a IMAGEMAGICK file.  */
+    imagemagick_load,
+    /* Handle to function to free resources for IMAGEMAGICK.  */
+    imagemagick_clear_image,
+    /* An internal field to link to the next image type in a list of
+       image types, will be filled in when registering the format.  */
+    NULL
+  };
+
+
+
+
+DEFUN ("imagemagick-types", Fimagemagick_types, Simagemagick_types, 0, 0, 0, 
+       doc: /* Return image file types supported by ImageMagick.
+               Since ImageMagick recognizes a lot of file-types that clash with Emacs,
+               such as .c, we want to be able to alter the list at the lisp level.  */)
+  (void)
+{
+  Lisp_Object typelist = Qnil;
+  size_t numf;
+  ExceptionInfo ex;
+  char** imtypes = GetMagickList ("*", &numf, &ex);
+  int i;
+  Lisp_Object Qimagemagicktype;
+  for (i = 0; i < numf; i++)
+    {
+      Qimagemagicktype = intern (imtypes[i]);
+      typelist = Fcons (Qimagemagicktype, typelist);
+    }
+  return typelist;
+}
+  
+#endif /* defined (HAVE_IMAGEMAGICK) */
+
+
 \f
 /***********************************************************************
                                 SVG
@@ -7549,11 +7855,11 @@ gif_load (struct frame *f, struct image *img)
 
 /* Function prototypes.  */
 
-static int svg_image_p P_ ((Lisp_Object object));
-static int svg_load P_ ((struct frame *f, struct image *img));
+static int svg_image_p (Lisp_Object object);
+static int svg_load (struct frame *f, struct image *img);
 
-static int svg_load_image P_ ((struct frame *, struct image *,
-                              unsigned char *, unsigned int));
+static int svg_load_image (struct frame *, struct image *,
+                           unsigned char *, unsigned int);
 
 /* The symbol `svg' identifying images of this type. */
 
@@ -7618,11 +7924,10 @@ static struct image_type svg_type =
    identify the SVG format.   */
 
 static int
-svg_image_p (object)
-     Lisp_Object object;
+svg_image_p (Lisp_Object object)
 {
   struct image_keyword fmt[SVG_LAST];
-  bcopy (svg_format, fmt, sizeof fmt);
+  memcpy (fmt, svg_format, sizeof fmt);
 
   if (!parse_image_spec (object, fmt, SVG_LAST, Qsvg))
     return 0;
@@ -7721,9 +8026,7 @@ init_svg_functions (Lisp_Object libraries)
    the prototype thus needs to be compatible with that structure.  */
 
 static int
-svg_load (f, img)
-     struct frame *f;
-     struct image *img;
+svg_load (struct frame *f, struct image *img)
 {
   int success_p = 0;
   Lisp_Object file_name;
@@ -7780,15 +8083,10 @@ svg_load (f, img)
 
    Returns non-zero when successful.  */
 static int
-svg_load_image (f, img, contents, size)
-    /* Pointer to emacs frame structure.  */
-     struct frame *f;
-     /* Pointer to emacs image structure.  */
-     struct image *img;
-     /* String containing the SVG XML data to be parsed.  */
-     unsigned char *contents;
-     /* Size of data in bytes.  */
-     unsigned int size;
+svg_load_image (struct frame *f,         /* Pointer to emacs frame structure.  */
+               struct image *img,       /* Pointer to emacs image structure.  */
+               unsigned char *contents, /* String containing the SVG XML data to be parsed.  */
+               unsigned int size)       /* Size of data in bytes.  */
 {
   RsvgHandle *rsvg_handle;
   RsvgDimensionData dimension_data;
@@ -7863,7 +8161,7 @@ svg_load_image (f, img, contents, size)
       background.pixel = FRAME_BACKGROUND_PIXEL (f);
       x_query_color (f, &background);
 #else
-      ns_query_color(FRAME_BACKGROUND_COLOR (f), &background, 1);
+      ns_query_color (FRAME_BACKGROUND_COLOR (f), &background, 1);
 #endif
     }
 
@@ -7949,15 +8247,11 @@ svg_load_image (f, img, contents, size)
 #define HAVE_GHOSTSCRIPT 1
 #endif /* HAVE_X_WINDOWS */
 
-/* The symbol `postscript' identifying images of this type.  */
-
-Lisp_Object Qpostscript;
-
 #ifdef HAVE_GHOSTSCRIPT
 
-static int gs_image_p P_ ((Lisp_Object object));
-static int gs_load P_ ((struct frame *f, struct image *img));
-static void gs_clear_image P_ ((struct frame *f, struct image *img));
+static int gs_image_p (Lisp_Object object);
+static int gs_load (struct frame *f, struct image *img);
+static void gs_clear_image (struct frame *f, struct image *img);
 
 /* Keyword symbols.  */
 
@@ -8018,9 +8312,7 @@ static struct image_type gs_type =
 /* Free X resources of Ghostscript image IMG which is used on frame F.  */
 
 static void
-gs_clear_image (f, img)
-     struct frame *f;
-     struct image *img;
+gs_clear_image (struct frame *f, struct image *img)
 {
   /* IMG->data.ptr_val may contain a recorded colormap.  */
   xfree (img->data.ptr_val);
@@ -8032,14 +8324,13 @@ gs_clear_image (f, img)
    specification.  */
 
 static int
-gs_image_p (object)
-     Lisp_Object object;
+gs_image_p (Lisp_Object object)
 {
   struct image_keyword fmt[GS_LAST];
   Lisp_Object tem;
   int i;
 
-  bcopy (gs_format, fmt, sizeof fmt);
+  memcpy (fmt, gs_format, sizeof fmt);
 
   if (!parse_image_spec (object, fmt, GS_LAST, Qpostscript))
     return 0;
@@ -8073,9 +8364,7 @@ gs_image_p (object)
    if successful.  */
 
 static int
-gs_load (f, img)
-     struct frame *f;
-     struct image *img;
+gs_load (struct frame *f, struct image *img)
 {
   char buffer[100];
   Lisp_Object window_and_pixmap_id = Qnil, loader, pt_height, pt_width;
@@ -8153,9 +8442,7 @@ gs_load (f, img)
    telling Emacs that Ghostscript has finished drawing.  */
 
 void
-x_kill_gs_process (pixmap, f)
-     Pixmap pixmap;
-     struct frame *f;
+x_kill_gs_process (Pixmap pixmap, struct frame *f)
 {
   struct image_cache *c = FRAME_IMAGE_CACHE (f);
   int class, i;
@@ -8253,16 +8540,14 @@ x_kill_gs_process (pixmap, f)
 
 DEFUN ("imagep", Fimagep, Simagep, 1, 1, 0,
        doc: /* Value is non-nil if SPEC is a valid image specification.  */)
-  (spec)
-     Lisp_Object spec;
+  (Lisp_Object spec)
 {
   return valid_image_p (spec) ? Qt : Qnil;
 }
 
 
 DEFUN ("lookup-image", Flookup_image, Slookup_image, 1, 1, 0, "")
-  (spec)
-     Lisp_Object spec;
+  (Lisp_Object spec)
 {
   int id = -1;
 
@@ -8297,8 +8582,7 @@ Return non-nil if TYPE is a supported image type.
 Image types pbm and xbm are prebuilt; other types are loaded here.
 Libraries to load are specified in alist LIBRARIES (usually, the value
 of `image-library-alist', which see).  */)
-  (type, libraries)
-  Lisp_Object type, libraries;
+  (Lisp_Object type, Lisp_Object libraries)
 {
   Lisp_Object tested;
 
@@ -8337,6 +8621,15 @@ of `image-library-alist', which see).  */)
     return CHECK_LIB_AVAILABLE (&svg_type, init_svg_functions, libraries);
 #endif
 
+#if defined (HAVE_IMAGEMAGICK)
+  if (EQ (type, Qimagemagick)){
+    /* MagickWandGenesis() initalizes the imagemagick library.  */
+    MagickWandGenesis(); 
+    return CHECK_LIB_AVAILABLE (&imagemagick_type, init_imagemagick_functions,
+                                libraries);
+  }
+#endif
+
 #ifdef HAVE_GHOSTSCRIPT
   if (EQ (type, Qpostscript))
     return CHECK_LIB_AVAILABLE (&gs_type, init_gs_functions, libraries);
@@ -8348,10 +8641,8 @@ of `image-library-alist', which see).  */)
 }
 
 void
-syms_of_image ()
+syms_of_image (void)
 {
-  extern Lisp_Object Qrisky_local_variable;   /* Syms_of_xdisp has already run.  */
-
   /* Initialize this only once, since that's what we do with Vimage_types
      and they are supposed to be in sync.  Initializing here gives correct
      operation on GNU/Linux of calling dump-emacs after loading some images.  */
@@ -8407,6 +8698,8 @@ non-numeric, there is no explicit limit on the size of images.  */);
 
   Qcount = intern_c_string ("count");
   staticpro (&Qcount);
+  Qextension_data = intern_c_string ("extension-data");
+  staticpro (&Qextension_data);
 
   QCascent = intern_c_string (":ascent");
   staticpro (&QCascent);
@@ -8422,6 +8715,12 @@ non-numeric, there is no explicit limit on the size of images.  */);
   staticpro (&QCheuristic_mask);
   QCindex = intern_c_string (":index");
   staticpro (&QCindex);
+  QCgeometry = intern (":geometry");
+  staticpro (&QCgeometry);
+  QCcrop = intern (":crop");
+  staticpro (&QCcrop);
+  QCrotation = intern (":rotation");
+  staticpro (&QCrotation);
   QCmatrix = intern_c_string (":matrix");
   staticpro (&QCmatrix);
   QCcolor_adjustment = intern_c_string (":color-adjustment");
@@ -8482,6 +8781,12 @@ non-numeric, there is no explicit limit on the size of images.  */);
   ADD_IMAGE_TYPE (Qpng);
 #endif
 
+#if defined (HAVE_IMAGEMAGICK)
+  Qimagemagick = intern ("imagemagick");
+  staticpro (&Qimagemagick);
+  ADD_IMAGE_TYPE (Qimagemagick);
+#endif
+  
 #if defined (HAVE_RSVG)
   Qsvg = intern_c_string ("svg");
   staticpro (&Qsvg);
@@ -8498,11 +8803,14 @@ non-numeric, there is no explicit limit on the size of images.  */);
 #endif /* HAVE_RSVG  */
 
   defsubr (&Sinit_image_library);
+#ifdef HAVE_IMAGEMAGICK  
+  defsubr (&Simagemagick_types);
+#endif  
   defsubr (&Sclear_image_cache);
-  defsubr (&Simage_refresh);
+  defsubr (&Simage_flush);
   defsubr (&Simage_size);
   defsubr (&Simage_mask_p);
-  defsubr (&Simage_extension_data);
+  defsubr (&Simage_metadata);
 
 #if GLYPH_DEBUG
   defsubr (&Simagep);
@@ -8520,15 +8828,23 @@ A cross is always drawn on black & white displays.  */);
   Vx_bitmap_file_path = decode_env_path ((char *) 0, PATH_BITMAPS);
 
   DEFVAR_LISP ("image-cache-eviction-delay", &Vimage_cache_eviction_delay,
-    doc: /* Time after which cached images are removed from the cache.
-When an image has not been displayed this many seconds, remove it
-from the image cache.  Value must be an integer or nil with nil
-meaning don't clear the cache.  */);
-  Vimage_cache_eviction_delay = make_number (30 * 60);
+    doc: /* Maximum time after which images are removed from the cache.
+When an image has not been displayed this many seconds, Emacs
+automatically removes it from the image cache.  If the cache contains
+a large number of images, the actual eviction time may be shorter.
+The value can also be nil, meaning the cache is never cleared.
+
+The function `clear-image-cache' disregards this variable.  */);
+  Vimage_cache_eviction_delay = make_number (300);
+#ifdef HAVE_IMAGEMAGICK  
+  DEFVAR_LISP ("imagemagick-render-type", &Vimagemagick_render_type,
+               doc: /* Choose between ImageMagick render methods.  */);
+#endif    
+
 }
 
 void
-init_image ()
+init_image (void)
 {
 }
 
index a7f41f7e8e40f450697978fe335fc8040a717d2b..970904cba7b0961bb65cad828549a5de04b2fc8c 100644 (file)
@@ -61,8 +61,8 @@ EMACS_INT last_known_column_point;
 
 static int last_known_column_modified;
 
-static double current_column_1 P_ ((void));
-static double position_indentation P_ ((int));
+static double current_column_1 (void);
+static double position_indentation (int);
 
 /* Cache of beginning of line found by the last call of
    current_column. */
@@ -72,7 +72,7 @@ static EMACS_INT current_column_bol_cache;
 /* Get the display table to use for the current buffer.  */
 
 struct Lisp_Char_Table *
-buffer_display_table ()
+buffer_display_table (void)
 {
   Lisp_Object thisbuf;
 
@@ -89,9 +89,7 @@ buffer_display_table ()
 /* Return the width of character C under display table DP.  */
 
 static int
-character_width (c, dp)
-     int c;
-     struct Lisp_Char_Table *dp;
+character_width (int c, struct Lisp_Char_Table *dp)
 {
   Lisp_Object elt;
 
@@ -125,9 +123,7 @@ character_width (c, dp)
    invalidate the buffer's width_run_cache.  */
 
 int
-disptab_matches_widthtab (disptab, widthtab)
-     struct Lisp_Char_Table *disptab;
-     struct Lisp_Vector *widthtab;
+disptab_matches_widthtab (struct Lisp_Char_Table *disptab, struct Lisp_Vector *widthtab)
 {
   int i;
 
@@ -145,9 +141,7 @@ disptab_matches_widthtab (disptab, widthtab)
 /* Recompute BUF's width table, using the display table DISPTAB.  */
 
 void
-recompute_width_table (buf, disptab)
-     struct buffer *buf;
-     struct Lisp_Char_Table *disptab;
+recompute_width_table (struct buffer *buf, struct Lisp_Char_Table *disptab)
 {
   int i;
   struct Lisp_Vector *widthtab;
@@ -166,7 +160,7 @@ recompute_width_table (buf, disptab)
    state of current_buffer's cache_long_line_scans variable.  */
 
 static void
-width_run_cache_on_off ()
+width_run_cache_on_off (void)
 {
   if (NILP (current_buffer->cache_long_line_scans)
       /* And, for the moment, this feature doesn't work on multibyte
@@ -217,11 +211,7 @@ width_run_cache_on_off ()
    will equal the return value.  */
 
 EMACS_INT
-skip_invisible (pos, next_boundary_p, to, window)
-     EMACS_INT pos;
-     EMACS_INT *next_boundary_p;
-     EMACS_INT to;
-     Lisp_Object window;
+skip_invisible (EMACS_INT pos, EMACS_INT *next_boundary_p, EMACS_INT to, Lisp_Object window)
 {
   Lisp_Object prop, position, overlay_limit, proplimit;
   Lisp_Object buffer, tmp;
@@ -322,7 +312,7 @@ Whether the line is visible (if `selective-display' is t) has no effect;
 however, ^M is treated as end of line when `selective-display' is t.
 Text that has an invisible property is considered as having width 0, unless
 `buffer-invisibility-spec' specifies that it is replaced by an ellipsis.  */)
-     ()
+  (void)
 {
   Lisp_Object temp;
   XSETFASTINT (temp, (int) current_column ()); /* iftc */
@@ -332,13 +322,13 @@ Text that has an invisible property is considered as having width 0, unless
 /* Cancel any recorded value of the horizontal position.  */
 
 void
-invalidate_current_column ()
+invalidate_current_column (void)
 {
   last_known_column_point = 0;
 }
 
 double
-current_column ()
+current_column (void)
 {
   register int col;
   register unsigned char *ptr, *stop;
@@ -479,7 +469,6 @@ current_column ()
   return col;
 }
 \f
-extern Lisp_Object Qspace, QCwidth, QCalign_to;
 
 /* Check the presence of a display property and compute its width.
    If a property was found and its width was found as well, return
@@ -506,7 +495,7 @@ check_display_width (EMACS_INT pos, EMACS_INT col, EMACS_INT *endpos)
        width = XINT (prop) - col;
       else if (FLOATP (prop))
        width = (int)(XFLOAT_DATA (prop) + 0.5) - col;
-           
+
       if (width >= 0)
        {
          EMACS_INT start;
@@ -556,7 +545,7 @@ scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol)
   w = ! NILP (window) ? XWINDOW (window) : NULL;
 
   if (tab_width <= 0 || tab_width > 1000) tab_width = 8;
-  bzero (&cmp_it, sizeof cmp_it);
+  memset (&cmp_it, 0, sizeof cmp_it);
   cmp_it.id = -1;
   composition_compute_stop_pos (&cmp_it, scan, scan_byte, end, Qnil);
 
@@ -628,7 +617,7 @@ scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol)
         to this character.  */
 
       if (dp != 0
-         && ! (multibyte && BASE_LEADING_CODE_P (c))
+         && ! (multibyte && LEADING_CODE_P (c))
          && VECTORP (DISP_CHAR_VECTOR (dp, c)))
        {
          Lisp_Object charvec;
@@ -679,7 +668,7 @@ scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol)
              col += tab_width;
              col = col / tab_width * tab_width;
            }
-         else if (multibyte && BASE_LEADING_CODE_P (c))
+         else if (multibyte && LEADING_CODE_P (c))
            {
              /* Start of multi-byte form.  */
              unsigned char *ptr;
@@ -723,7 +712,7 @@ scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol)
    due to text properties or overlays.  */
 
 static double
-current_column_1 ()
+current_column_1 (void)
 {
   EMACS_INT col = MOST_POSITIVE_FIXNUM;
   EMACS_INT opoint = PT;
@@ -822,8 +811,7 @@ Optional second argument MINIMUM says always do at least MINIMUM spaces
 even if that goes past COLUMN; by default, MINIMUM is zero.
 
 The return value is COLUMN.  */)
-     (column, minimum)
-     Lisp_Object column, minimum;
+  (Lisp_Object column, Lisp_Object minimum)
 {
   int mincol;
   register int fromcol;
@@ -867,14 +855,14 @@ The return value is COLUMN.  */)
 }
 
 \f
-static double position_indentation P_ ((int));
+static double position_indentation (int);
 
 DEFUN ("current-indentation", Fcurrent_indentation, Scurrent_indentation,
        0, 0, 0,
        doc: /* Return the indentation of the current line.
 This is the horizontal position of the character
 following any initial whitespace.  */)
-     ()
+  (void)
 {
   Lisp_Object val;
   int opoint = PT, opoint_byte = PT_BYTE;
@@ -887,8 +875,7 @@ following any initial whitespace.  */)
 }
 
 static double
-position_indentation (pos_byte)
-     register int pos_byte;
+position_indentation (register int pos_byte)
 {
   register EMACS_INT column = 0;
   register EMACS_INT tab_width = XINT (current_buffer->tab_width);
@@ -977,9 +964,7 @@ position_indentation (pos_byte)
    preceding line.  */
 
 int
-indented_beyond_p (pos, pos_byte, column)
-     int pos, pos_byte;
-     double column;
+indented_beyond_p (int pos, int pos_byte, double column)
 {
   double val;
   int opoint = PT, opoint_byte = PT_BYTE;
@@ -1011,8 +996,7 @@ In addition, if FORCE is t, and the line is too short to reach
 COLUMN, add spaces/tabs to get there.
 
 The return value is the current column.  */)
-     (column, force)
-     Lisp_Object column, force;
+  (Lisp_Object column, Lisp_Object force)
 {
   EMACS_INT pos;
   EMACS_INT col, prev_col;
@@ -1137,12 +1121,7 @@ struct position val_compute_motion;
    the scroll bars if they are turned on.  */
 
 struct position *
-compute_motion (from, fromvpos, fromhpos, did_motion, to, tovpos, tohpos, width, hscroll, tab_offset, win)
-     EMACS_INT from, fromvpos, fromhpos, to, tovpos, tohpos;
-     int did_motion;
-     EMACS_INT width;
-     EMACS_INT hscroll, tab_offset;
-     struct window *win;
+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)
 {
   register EMACS_INT hpos = fromhpos;
   register EMACS_INT vpos = fromvpos;
@@ -1232,7 +1211,7 @@ compute_motion (from, fromvpos, fromhpos, did_motion, to, tovpos, tohpos, width,
   pos_byte = prev_pos_byte = CHAR_TO_BYTE (from);
   contin_hpos = 0;
   prev_tab_offset = tab_offset;
-  bzero (&cmp_it, sizeof cmp_it);
+  memset (&cmp_it, 0, sizeof cmp_it);
   cmp_it.id = -1;
   composition_compute_stop_pos (&cmp_it, pos, pos_byte, to, Qnil);
 
@@ -1577,7 +1556,7 @@ compute_motion (from, fromvpos, fromhpos, did_motion, to, tovpos, tohpos, width,
            }
 
          if (dp != 0
-             && ! (multibyte && BASE_LEADING_CODE_P (c))
+             && ! (multibyte && LEADING_CODE_P (c))
              && VECTORP (DISP_CHAR_VECTOR (dp, c)))
            {
              charvec = DISP_CHAR_VECTOR (dp, c);
@@ -1683,7 +1662,7 @@ compute_motion (from, fromvpos, fromhpos, did_motion, to, tovpos, tohpos, width,
                        hpos = width;
                    }
                }
-             else if (multibyte && BASE_LEADING_CODE_P (c))
+             else if (multibyte && LEADING_CODE_P (c))
                {
                  /* Start of multi-byte form.  */
                  unsigned char *ptr;
@@ -1775,9 +1754,7 @@ of a certain window, pass the window's starting location as FROM
 and the window's upper-left coordinates as FROMPOS.
 Pass the buffer's (point-max) as TO, to limit the scan to the end of the
 visible section of the buffer, and pass LINE and COL as TOPOS.  */)
-     (from, frompos, to, topos, width, offsets, window)
-     Lisp_Object from, frompos, to, topos;
-     Lisp_Object width, offsets, window;
+  (Lisp_Object from, Lisp_Object frompos, Lisp_Object to, Lisp_Object topos, Lisp_Object width, Lisp_Object offsets, Lisp_Object window)
 {
   struct window *w;
   Lisp_Object bufpos, hpos, vpos, prevhpos;
@@ -1856,9 +1833,7 @@ visible section of the buffer, and pass LINE and COL as TOPOS.  */)
 struct position val_vmotion;
 
 struct position *
-vmotion (from, vtarget, w)
-     register EMACS_INT from, vtarget;
-     struct window *w;
+vmotion (register EMACS_INT from, register EMACS_INT vtarget, struct window *w)
 {
   EMACS_INT hscroll = XINT (w->hscroll);
   struct position pos;
@@ -2021,8 +1996,7 @@ regardless of which buffer is displayed in WINDOW.
 This is consistent with other cursor motion functions
 and makes it possible to use `vertical-motion' in any buffer,
 whether or not it is currently displayed in some window.  */)
-     (lines, window)
-     Lisp_Object lines, window;
+  (Lisp_Object lines, Lisp_Object window)
 {
   struct it it;
   struct text_pos pt;
@@ -2183,7 +2157,7 @@ whether or not it is currently displayed in some window.  */)
 /* File's initialization.  */
 
 void
-syms_of_indent ()
+syms_of_indent (void)
 {
   DEFVAR_BOOL ("indent-tabs-mode", &indent_tabs_mode,
               doc: /* *Indentation can insert tabs if this is non-nil.  */);
index 4d9dbf2d7ff54de894d80363f881a589bb95618d..394d7216b4f628db91581e8e314342ebbec42ed3 100644 (file)
@@ -49,16 +49,16 @@ struct position
     EMACS_INT tab_offset;
   };
 
-struct position *compute_motion P_ ((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 *));
-struct position *vmotion P_ ((EMACS_INT from, EMACS_INT vtarget,
-                             struct window *));
-EMACS_INT skip_invisible P_ ((EMACS_INT pos, EMACS_INT *next_boundary_p,
-                             EMACS_INT to, Lisp_Object window));
+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 *);
+struct position *vmotion (EMACS_INT from, EMACS_INT vtarget,
+                          struct window *);
+EMACS_INT skip_invisible (EMACS_INT pos, EMACS_INT *next_boundary_p,
+                          EMACS_INT to, Lisp_Object window);
 
 /* Value of point when current_column was called */
 extern EMACS_INT last_known_column_point;
@@ -68,12 +68,12 @@ extern EMACS_INT last_known_column_point;
 /* Return true if the display table DISPTAB specifies the same widths
    for characters as WIDTHTAB.  We use this to decide when to
    invalidate the buffer's column_cache.  */
-int disptab_matches_widthtab P_ ((struct Lisp_Char_Table *disptab,
-                                 struct Lisp_Vector *widthtab));
+int disptab_matches_widthtab (struct Lisp_Char_Table *disptab,
+                              struct Lisp_Vector *widthtab);
 
 /* Recompute BUF's width table, using the display table DISPTAB.  */
-void recompute_width_table P_ ((struct buffer *buf,
-                               struct Lisp_Char_Table *disptab));
+void recompute_width_table (struct buffer *buf,
+                            struct Lisp_Char_Table *disptab);
 
 
 /* arch-tag: f9feb373-5bff-4f4f-9198-94805d00cfd7
index ededd597b0dc183dd9b0310f0843c7953ffae7f1..2ccc0b8eaac6c4e6430ce89335f0940057129146 100644 (file)
@@ -51,10 +51,10 @@ static void adjust_markers_for_replace (EMACS_INT, EMACS_INT, EMACS_INT,
                                        EMACS_INT, EMACS_INT, EMACS_INT);
 static void adjust_point (EMACS_INT nchars, EMACS_INT nbytes);
 
-Lisp_Object Fcombine_after_change_execute ();
+Lisp_Object Fcombine_after_change_execute (void);
 
 /* Non-nil means don't call the after-change-functions right away,
-   just record an element in Vcombine_after_change_calls_list.  */
+   just record an element in combine_after_change_list.  */
 Lisp_Object Vcombine_after_change_calls;
 
 /* List of elements of the form (BEG-UNCHANGED END-UNCHANGED CHANGE-AMOUNT)
@@ -74,6 +74,8 @@ Lisp_Object combine_after_change_buffer;
 
 Lisp_Object Qinhibit_modification_hooks;
 
+extern Lisp_Object Vselect_active_regions, Vsaved_region_selection, Qonly;
+
 \f
 /* Check all markers in the current buffer, looking for something invalid.  */
 
@@ -85,7 +87,7 @@ static int check_markers_debug_flag;
   else
 
 void
-check_markers ()
+check_markers (void)
 {
   register struct Lisp_Marker *tail;
   int multibyte = ! NILP (current_buffer->enable_multibyte_characters);
@@ -164,28 +166,9 @@ gap_left (EMACS_INT charpos, EMACS_INT bytepos, int newgap)
       /* Move at most 32000 chars before checking again for a quit.  */
       if (i > 32000)
        i = 32000;
-#ifdef GAP_USE_BCOPY
-      if (i >= 128
-         /* bcopy is safe if the two areas of memory do not overlap
-            or on systems where bcopy is always safe for moving upward.  */
-         && (BCOPY_UPWARD_SAFE
-             || to - from >= 128))
-       {
-         /* If overlap is not safe, avoid it by not moving too many
-            characters at once.  */
-         if (!BCOPY_UPWARD_SAFE && i > to - from)
-           i = to - from;
-         new_s1 -= i;
-         from -= i, to -= i;
-         bcopy (from, to, i);
-       }
-      else
-#endif
-       {
-         new_s1 -= i;
-         while (--i >= 0)
-           *--to = *--from;
-       }
+      new_s1 -= i;
+      from -= i, to -= i;
+      memmove (to, from, i);
     }
 
   /* Adjust markers, and buffer data structure, to put the gap at BYTEPOS.
@@ -238,28 +221,9 @@ gap_right (EMACS_INT charpos, EMACS_INT bytepos)
       /* Move at most 32000 chars before checking again for a quit.  */
       if (i > 32000)
        i = 32000;
-#ifdef GAP_USE_BCOPY
-      if (i >= 128
-         /* bcopy is safe if the two areas of memory do not overlap
-            or on systems where bcopy is always safe for moving downward.  */
-         && (BCOPY_DOWNWARD_SAFE
-             || from - to >= 128))
-       {
-         /* If overlap is not safe, avoid it by not moving too many
-            characters at once.  */
-         if (!BCOPY_DOWNWARD_SAFE && i > from - to)
-           i = from - to;
-         new_s1 += i;
-         bcopy (from, to, i);
-         from += i, to += i;
-       }
-      else
-#endif
-       {
-         new_s1 += i;
-         while (--i >= 0)
-           *to++ = *from++;
-       }
+      new_s1 += i;
+      memmove (to, from, i);
+      from += i, to += i;
     }
 
   adjust_markers_gap_motion (GPT_BYTE + GAP_SIZE, bytepos + GAP_SIZE,
@@ -437,7 +401,7 @@ adjust_markers_for_insert (EMACS_INT from, EMACS_INT from_byte,
     }
 
   /* Adjusting only markers whose insertion-type is t may result in
-     - disordered start and end in overlays, and 
+     - disordered start and end in overlays, and
      - disordered overlays in the slot `overlays_before' of current_buffer.  */
   if (adjusted)
     {
@@ -585,7 +549,7 @@ make_gap_smaller (EMACS_INT nbytes_removed)
   /* Pretend that the last unwanted part of the gap is the entire gap,
      and that the first desired part of the gap is part of the buffer
      text.  */
-  bzero (GPT_ADDR, new_gap_size);
+  memset (GPT_ADDR, 0, new_gap_size);
   GPT += new_gap_size;
   GPT_BYTE += new_gap_size;
   Z += new_gap_size;
@@ -636,7 +600,7 @@ copy_text (const unsigned char *from_addr, unsigned char *to_addr,
 {
   if (from_multibyte == to_multibyte)
     {
-      bcopy (from_addr, to_addr, nbytes);
+      memcpy (to_addr, from_addr, nbytes);
       return nbytes;
     }
   else if (from_multibyte)
@@ -843,7 +807,7 @@ count_combining_before (const unsigned char *string, EMACS_INT length,
   len = 1;
   p = BYTE_POS_ADDR (pos_byte - 1);
   while (! CHAR_HEAD_P (*p)) p--, len++;
-  if (! BASE_LEADING_CODE_P (*p)) /* case (3) */
+  if (! LEADING_CODE_P (*p)) /* case (3) */
     return 0;
 
   combining_bytes = BYTES_BY_CHAR_HEAD (*p) - len;
@@ -906,7 +870,7 @@ count_combining_after (const unsigned char *string,
       i = pos_byte - 2;
       while (i >= 0 && ! CHAR_HEAD_P (p[i]))
        i--;
-      if (i < 0 || !BASE_LEADING_CODE_P (p[i]))
+      if (i < 0 || !LEADING_CODE_P (p[i]))
        return 0;
 
       bytes = BYTES_BY_CHAR_HEAD (p[i]);
@@ -914,7 +878,7 @@ count_combining_after (const unsigned char *string,
              ? 0
              : bytes - (pos_byte - 1 - i + length));
     }
-  if (!BASE_LEADING_CODE_P (string[i]))
+  if (!LEADING_CODE_P (string[i]))
     return 0;
 
   bytes = BYTES_BY_CHAR_HEAD (string[i]) - (length - i);
@@ -966,7 +930,7 @@ insert_1_both (const unsigned char *string,
   MODIFF++;
   CHARS_MODIFF = MODIFF;
 
-  bcopy (string, GPT_ADDR, nbytes);
+  memcpy (GPT_ADDR, string, nbytes);
 
   GAP_SIZE -= nbytes;
   GPT += nchars;
@@ -1007,7 +971,7 @@ insert_1_both (const unsigned char *string,
    copy them into the buffer.
 
    It does not work to use `insert' for this, because a GC could happen
-   before we bcopy the stuff into the buffer, and relocate the string
+   before we copy the stuff into the buffer, and relocate the string
    without insert noticing.  */
 
 void
@@ -1182,7 +1146,7 @@ insert_from_gap (EMACS_INT nchars, EMACS_INT nbytes)
    into the current buffer.
 
    It does not work to use `insert' for this, because a malloc could happen
-   and relocate BUF's text before the bcopy happens.  */
+   and relocate BUF's text before the copy happens.  */
 
 void
 insert_from_buffer (struct buffer *buf,
@@ -1666,7 +1630,7 @@ replace_range (EMACS_INT from, EMACS_INT to, Lisp_Object new,
 void
 replace_range_2 (EMACS_INT from, EMACS_INT from_byte,
                 EMACS_INT to, EMACS_INT to_byte,
-                char *ins, EMACS_INT inschars, EMACS_INT insbytes,
+                const char *ins, EMACS_INT inschars, EMACS_INT insbytes,
                 int markers)
 {
   EMACS_INT nbytes_del, nchars_del;
@@ -1712,7 +1676,7 @@ replace_range_2 (EMACS_INT from, EMACS_INT from_byte,
     make_gap (insbytes - GAP_SIZE);
 
   /* Copy the replacement text into the buffer.  */
-  bcopy (ins, GPT_ADDR, insbytes);
+  memcpy (GPT_ADDR, ins, insbytes);
 
 #ifdef BYTE_COMBINING_DEBUG
   /* We have copied text into the gap, but we have not marked
@@ -2085,6 +2049,22 @@ prepare_to_modify_buffer (EMACS_INT start, EMACS_INT end,
           base_buffer->filename);
 #endif /* not CLASH_DETECTION */
 
+  /* If `select-active-regions' is non-nil, save the region text.  */
+  if (!NILP (current_buffer->mark_active)
+      && NILP (Vsaved_region_selection)
+      && (EQ (Vselect_active_regions, Qonly)
+         ? EQ (CAR_SAFE (Vtransient_mark_mode), Qonly)
+         : (!NILP (Vselect_active_regions)
+            && !NILP (Vtransient_mark_mode))))
+    {
+      int b = XINT (Fmarker_position (current_buffer->mark));
+      int e = XINT (make_number (PT));
+      if (b < e)
+       Vsaved_region_selection = make_buffer_string (b, e, 0);
+      else if (b > e)
+       Vsaved_region_selection = make_buffer_string (e, b, 0);
+    }
+
   signal_before_change (start, end, preserve_ptr);
 
   if (current_buffer->newline_cache)
@@ -2132,8 +2112,7 @@ prepare_to_modify_buffer (EMACS_INT start, EMACS_INT end,
    NO-ERROR-FLAG is nil if there was an error,
    anything else meaning no error (so this function does nothing).  */
 Lisp_Object
-reset_var_on_error (val)
-     Lisp_Object val;
+reset_var_on_error (Lisp_Object val)
 {
   if (NILP (XCDR (val)))
     Fset (XCAR (val), Qnil);
@@ -2297,8 +2276,7 @@ signal_after_change (EMACS_INT charpos, EMACS_INT lendel, EMACS_INT lenins)
 }
 
 Lisp_Object
-Fcombine_after_change_execute_1 (val)
-     Lisp_Object val;
+Fcombine_after_change_execute_1 (Lisp_Object val)
 {
   Vcombine_after_change_calls = val;
   return val;
@@ -2307,7 +2285,7 @@ Fcombine_after_change_execute_1 (val)
 DEFUN ("combine-after-change-execute", Fcombine_after_change_execute,
        Scombine_after_change_execute, 0, 0, 0,
        doc: /* This function is for use internally in `combine-after-change-calls'.  */)
-     ()
+  (void)
 {
   int count = SPECPDL_INDEX ();
   EMACS_INT beg, end, change;
@@ -2390,7 +2368,7 @@ DEFUN ("combine-after-change-execute", Fcombine_after_change_execute,
 }
 \f
 void
-syms_of_insdel ()
+syms_of_insdel (void)
 {
   staticpro (&combine_after_change_list);
   staticpro (&combine_after_change_buffer);
index 9836f7634897cb58ff2f4f7c0f2198eab5338673..86cbe1effcc5724e2f88fa9a73f70be2c3372991 100644 (file)
@@ -52,9 +52,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #define TMEM(sym, set) (CONSP (set) ? ! NILP (Fmemq (sym, set)) : ! NILP (set))
 
-Lisp_Object merge_properties_sticky ();
-static INTERVAL reproduce_tree P_ ((INTERVAL, INTERVAL));
-static INTERVAL reproduce_tree_obj P_ ((INTERVAL, Lisp_Object));
+Lisp_Object merge_properties_sticky (Lisp_Object pleft, Lisp_Object pright);
+static INTERVAL reproduce_tree (INTERVAL, INTERVAL);
+static INTERVAL reproduce_tree_obj (INTERVAL, Lisp_Object);
 \f
 /* Utility functions for intervals.  */
 
@@ -62,8 +62,7 @@ static INTERVAL reproduce_tree_obj P_ ((INTERVAL, Lisp_Object));
 /* Create the root interval of some object, a buffer or string.  */
 
 INTERVAL
-create_root_interval (parent)
-     Lisp_Object parent;
+create_root_interval (Lisp_Object parent)
 {
   INTERVAL new;
 
@@ -95,8 +94,7 @@ create_root_interval (parent)
 /* Make the interval TARGET have exactly the properties of SOURCE */
 
 void
-copy_properties (source, target)
-     register INTERVAL source, target;
+copy_properties (register INTERVAL source, register INTERVAL target)
 {
   if (DEFAULT_INTERVAL_P (source) && DEFAULT_INTERVAL_P (target))
     return;
@@ -110,8 +108,7 @@ copy_properties (source, target)
    is added to TARGET if TARGET has no such property as yet.  */
 
 static void
-merge_properties (source, target)
-     register INTERVAL source, target;
+merge_properties (register INTERVAL source, register INTERVAL target)
 {
   register Lisp_Object o, sym, val;
 
@@ -149,8 +146,7 @@ merge_properties (source, target)
    0 otherwise.  */
 
 int
-intervals_equal (i0, i1)
-     INTERVAL i0, i1;
+intervals_equal (INTERVAL i0, INTERVAL i1)
 {
   register Lisp_Object i0_cdr, i0_sym;
   register Lisp_Object i1_cdr, i1_val;
@@ -206,10 +202,7 @@ intervals_equal (i0, i1)
    Pass FUNCTION two args: an interval, and ARG.  */
 
 void
-traverse_intervals_noorder (tree, function, arg)
-     INTERVAL tree;
-     void (* function) P_ ((INTERVAL, Lisp_Object));
-     Lisp_Object arg;
+traverse_intervals_noorder (INTERVAL tree, void (*function) (INTERVAL, Lisp_Object), Lisp_Object arg)
 {
   /* Minimize stack usage.  */
   while (!NULL_INTERVAL_P (tree))
@@ -229,11 +222,7 @@ traverse_intervals_noorder (tree, function, arg)
    Pass FUNCTION two args: an interval, and ARG.  */
 
 void
-traverse_intervals (tree, position, function, arg)
-     INTERVAL tree;
-     int position;
-     void (* function) P_ ((INTERVAL, Lisp_Object));
-     Lisp_Object arg;
+traverse_intervals (INTERVAL tree, int position, void (*function) (INTERVAL, Lisp_Object), Lisp_Object arg)
 {
   while (!NULL_INTERVAL_P (tree))
     {
@@ -323,8 +312,7 @@ root_interval (interval)
 */
 
 static INLINE INTERVAL
-rotate_right (interval)
-     INTERVAL interval;
+rotate_right (INTERVAL interval)
 {
   INTERVAL i;
   INTERVAL B = interval->left;
@@ -371,8 +359,7 @@ rotate_right (interval)
 */
 
 static INLINE INTERVAL
-rotate_left (interval)
-     INTERVAL interval;
+rotate_left (INTERVAL interval)
 {
   INTERVAL i;
   INTERVAL B = interval->right;
@@ -413,8 +400,7 @@ rotate_left (interval)
    themselves are already balanced.  */
 
 static INTERVAL
-balance_an_interval (i)
-     INTERVAL i;
+balance_an_interval (INTERVAL i)
 {
   register int old_diff, new_diff;
 
@@ -451,8 +437,7 @@ balance_an_interval (i)
    Lisp Object.  */
 
 static INLINE INTERVAL
-balance_possible_root_interval (interval)
-     register INTERVAL interval;
+balance_possible_root_interval (register INTERVAL interval)
 {
   Lisp_Object parent;
   int have_parent = 0;
@@ -482,8 +467,7 @@ balance_possible_root_interval (interval)
    (the amount of text).  */
 
 static INTERVAL
-balance_intervals_internal (tree)
-     register INTERVAL tree;
+balance_intervals_internal (register INTERVAL tree)
 {
   /* Balance within each side.  */
   if (tree->left)
@@ -496,8 +480,7 @@ balance_intervals_internal (tree)
 /* Advertised interface to balance intervals.  */
 
 INTERVAL
-balance_intervals (tree)
-     INTERVAL tree;
+balance_intervals (INTERVAL tree)
 {
   if (tree == NULL_INTERVAL)
     return NULL_INTERVAL;
@@ -519,9 +502,7 @@ balance_intervals (tree)
    it is still a root after this operation.  */
 
 INTERVAL
-split_interval_right (interval, offset)
-     INTERVAL interval;
-     int offset;
+split_interval_right (INTERVAL interval, int offset)
 {
   INTERVAL new = make_interval ();
   int position = interval->position;
@@ -566,9 +547,7 @@ split_interval_right (interval, offset)
    it is still a root after this operation.  */
 
 INTERVAL
-split_interval_left (interval, offset)
-     INTERVAL interval;
-     int offset;
+split_interval_left (INTERVAL interval, int offset)
 {
   INTERVAL new = make_interval ();
   int new_length = offset;
@@ -608,8 +587,7 @@ split_interval_left (interval, offset)
    of another interval!  */
 
 int
-interval_start_pos (source)
-     INTERVAL source;
+interval_start_pos (INTERVAL source)
 {
   Lisp_Object parent;
 
@@ -635,9 +613,7 @@ interval_start_pos (source)
    will update this cache based on the result of find_interval.  */
 
 INTERVAL
-find_interval (tree, position)
-     register INTERVAL tree;
-     register int position;
+find_interval (register INTERVAL tree, register int position)
 {
   /* The distance from the left edge of the subtree at TREE
                     to POSITION.  */
@@ -691,8 +667,7 @@ find_interval (tree, position)
    find_interval).  */
 
 INTERVAL
-next_interval (interval)
-     register INTERVAL interval;
+next_interval (register INTERVAL interval)
 {
   register INTERVAL i = interval;
   register int next_position;
@@ -731,8 +706,7 @@ next_interval (interval)
    find_interval).  */
 
 INTERVAL
-previous_interval (interval)
-     register INTERVAL interval;
+previous_interval (register INTERVAL interval)
 {
   register INTERVAL i;
 
@@ -771,9 +745,7 @@ previous_interval (interval)
    To speed up the process, we assume that the ->position of
    I and all its parents is already uptodate.  */
 INTERVAL
-update_interval (i, pos)
-     register INTERVAL i;
-     int pos;
+update_interval (register INTERVAL i, int pos)
 {
   if (NULL_INTERVAL_P (i))
     return NULL_INTERVAL;
@@ -892,9 +864,7 @@ adjust_intervals_for_insertion (tree, position, length)
    this text, and make it have the merged properties of both ends.  */
 
 static INTERVAL
-adjust_intervals_for_insertion (tree, position, length)
-     INTERVAL tree;
-     int position, length;
+adjust_intervals_for_insertion (INTERVAL tree, int position, int length)
 {
   register INTERVAL i;
   register INTERVAL temp;
@@ -1119,8 +1089,7 @@ FR     8  9  A  B
 */
 
 Lisp_Object
-merge_properties_sticky (pleft, pright)
-     Lisp_Object pleft, pright;
+merge_properties_sticky (Lisp_Object pleft, Lisp_Object pright)
 {
   register Lisp_Object props, front, rear;
   Lisp_Object lfront, lrear, rfront, rrear;
@@ -1256,8 +1225,7 @@ merge_properties_sticky (pleft, pright)
    storing the resulting subtree into its parent.  */
 
 static INTERVAL
-delete_node (i)
-     register INTERVAL i;
+delete_node (register INTERVAL i)
 {
   register INTERVAL migrate, this;
   register int migrate_amt;
@@ -1290,8 +1258,7 @@ delete_node (i)
    for the length of I.  */
 
 void
-delete_interval (i)
-     register INTERVAL i;
+delete_interval (register INTERVAL i)
 {
   register INTERVAL parent;
   int amt = LENGTH (i);
@@ -1345,9 +1312,7 @@ delete_interval (i)
    deleting the appropriate amount of text.  */
 
 static int
-interval_deletion_adjustment (tree, from, amount)
-     register INTERVAL tree;
-     register int from, amount;
+interval_deletion_adjustment (register INTERVAL tree, register int from, register int amount)
 {
   register int relative_position = from;
 
@@ -1407,9 +1372,7 @@ interval_deletion_adjustment (tree, from, amount)
    buffer position, i.e. origin 1).  */
 
 static void
-adjust_intervals_for_deletion (buffer, start, length)
-     struct buffer *buffer;
-     int start, length;
+adjust_intervals_for_deletion (struct buffer *buffer, int start, int length)
 {
   register int left_to_delete = length;
   register INTERVAL tree = BUF_INTERVALS (buffer);
@@ -1460,9 +1423,7 @@ adjust_intervals_for_deletion (buffer, start, length)
    of LENGTH.  */
 
 INLINE void
-offset_intervals (buffer, start, length)
-     struct buffer *buffer;
-     int start, length;
+offset_intervals (struct buffer *buffer, int start, int length)
 {
   if (NULL_INTERVAL_P (BUF_INTERVALS (buffer)) || length == 0)
     return;
@@ -1483,8 +1444,7 @@ offset_intervals (buffer, start, length)
    interval.  */
 
 INTERVAL
-merge_interval_right (i)
-     register INTERVAL i;
+merge_interval_right (register INTERVAL i)
 {
   register int absorb = LENGTH (i);
   register INTERVAL successor;
@@ -1540,8 +1500,7 @@ merge_interval_right (i)
    The caller must verify that this is not the first (leftmost) interval.  */
 
 INTERVAL
-merge_interval_left (i)
-     register INTERVAL i;
+merge_interval_left (register INTERVAL i)
 {
   register int absorb = LENGTH (i);
   register INTERVAL predecessor;
@@ -1595,12 +1554,11 @@ merge_interval_left (i)
    the pointers of the copy.  */
 
 static INTERVAL
-reproduce_tree (source, parent)
-     INTERVAL source, parent;
+reproduce_tree (INTERVAL source, INTERVAL parent)
 {
   register INTERVAL t = make_interval ();
 
-  bcopy (source, t, INTERVAL_SIZE);
+  memcpy (t, source, INTERVAL_SIZE);
   copy_properties (source, t);
   SET_INTERVAL_PARENT (t, parent);
   if (! NULL_LEFT_CHILD (source))
@@ -1612,13 +1570,11 @@ reproduce_tree (source, parent)
 }
 
 static INTERVAL
-reproduce_tree_obj (source, parent)
-     INTERVAL source;
-     Lisp_Object parent;
+reproduce_tree_obj (INTERVAL source, Lisp_Object parent)
 {
   register INTERVAL t = make_interval ();
 
-  bcopy (source, t, INTERVAL_SIZE);
+  memcpy (t, source, INTERVAL_SIZE);
   copy_properties (source, t);
   SET_INTERVAL_OBJECT (t, parent);
   if (! NULL_LEFT_CHILD (source))
@@ -1714,11 +1670,7 @@ make_new_interval (intervals, start, length)
    text...  */
 
 void
-graft_intervals_into_buffer (source, position, length, buffer, inherit)
-     INTERVAL source;
-     int position, length;
-     struct buffer *buffer;
-     int inherit;
+graft_intervals_into_buffer (INTERVAL source, int position, int length, struct buffer *buffer, int inherit)
 {
   register INTERVAL under, over, this, prev;
   register INTERVAL tree;
@@ -1876,18 +1828,13 @@ graft_intervals_into_buffer (source, position, length, buffer, inherit)
    and for PROP appearing on the default-text-properties list.  */
 
 Lisp_Object
-textget (plist, prop)
-     Lisp_Object plist;
-     register Lisp_Object prop;
+textget (Lisp_Object plist, register Lisp_Object prop)
 {
   return lookup_char_property (plist, prop, 1);
 }
 
 Lisp_Object
-lookup_char_property (plist, prop, textprop)
-     Lisp_Object plist;
-     register Lisp_Object prop;
-     int textprop;
+lookup_char_property (Lisp_Object plist, register Lisp_Object prop, int textprop)
 {
   register Lisp_Object tail, fallback = Qnil;
 
@@ -1974,8 +1921,7 @@ set_point (EMACS_INT charpos)
    if the invisible property comes from an overlay.  */
 
 static int
-adjust_for_invis_intang (pos, test_offs, adj, test_intang)
-     int pos, test_offs, adj, test_intang;
+adjust_for_invis_intang (int pos, int test_offs, int adj, int test_intang)
 {
   Lisp_Object invis_propval, invis_overlay;
   Lisp_Object test_pos;
@@ -2237,8 +2183,7 @@ set_point_both (EMACS_INT charpos, EMACS_INT bytepos)
    segment that reaches all the way to point.  */
 
 void
-move_if_not_intangible (position)
-     int position;
+move_if_not_intangible (int position)
 {
   Lisp_Object pos;
   Lisp_Object intangible_propval;
@@ -2301,11 +2246,7 @@ move_if_not_intangible (position)
    nil means the current buffer. */
 
 int
-get_property_and_range (pos, prop, val, start, end, object)
-     int pos;
-     Lisp_Object prop, *val;
-     EMACS_INT *start, *end;
-     Lisp_Object object;
+get_property_and_range (int pos, Lisp_Object prop, Lisp_Object *val, EMACS_INT *start, EMACS_INT *end, Lisp_Object object)
 {
   INTERVAL i, prev, next;
 
@@ -2348,10 +2289,7 @@ get_property_and_range (pos, prop, val, start, end, object)
    POSITION must be in the accessible part of BUFFER.  */
 
 Lisp_Object
-get_local_map (position, buffer, type)
-     register int position;
-     register struct buffer *buffer;
-     Lisp_Object type;
+get_local_map (register int position, register struct buffer *buffer, Lisp_Object type)
 {
   Lisp_Object prop, lispy_position, lispy_buffer;
   int old_begv, old_zv, old_begv_byte, old_zv_byte;
@@ -2404,9 +2342,7 @@ get_local_map (position, buffer, type)
    The new interval tree has no parent and has a starting-position of 0.  */
 
 INTERVAL
-copy_intervals (tree, start, length)
-     INTERVAL tree;
-     int start, length;
+copy_intervals (INTERVAL tree, int start, int length)
 {
   register INTERVAL i, new, t;
   register int got, prevlen;
@@ -2447,10 +2383,7 @@ copy_intervals (tree, start, length)
 /* Give STRING the properties of BUFFER from POSITION to LENGTH.  */
 
 INLINE void
-copy_intervals_to_string (string, buffer, position, length)
-     Lisp_Object string;
-     struct buffer *buffer;
-     int position, length;
+copy_intervals_to_string (Lisp_Object string, struct buffer *buffer, int position, int length)
 {
   INTERVAL interval_copy = copy_intervals (BUF_INTERVALS (buffer),
                                           position, length);
@@ -2465,8 +2398,7 @@ copy_intervals_to_string (string, buffer, position, length)
    Assume they have identical characters.  */
 
 int
-compare_string_intervals (s1, s2)
-     Lisp_Object s1, s2;
+compare_string_intervals (Lisp_Object s1, Lisp_Object s2)
 {
   INTERVAL i1, i2;
   int pos = 0;
@@ -2504,10 +2436,7 @@ compare_string_intervals (s1, s2)
    START_BYTE ... END_BYTE in bytes.  */
 
 static void
-set_intervals_multibyte_1 (i, multi_flag, start, start_byte, end, end_byte)
-     INTERVAL i;
-     int multi_flag;
-     int start, start_byte, end, end_byte;
+set_intervals_multibyte_1 (INTERVAL i, int multi_flag, int start, int start_byte, int end, int end_byte)
 {
   /* Fix the length of this interval.  */
   if (multi_flag)
@@ -2617,8 +2546,7 @@ set_intervals_multibyte_1 (i, multi_flag, start, start_byte, end, end_byte)
    or to fit them as non-multibyte (if MULTI_FLAG is 0).  */
 
 void
-set_intervals_multibyte (multi_flag)
-     int multi_flag;
+set_intervals_multibyte (int multi_flag)
 {
   if (BUF_INTERVALS (current_buffer))
     set_intervals_multibyte_1 (BUF_INTERVALS (current_buffer), multi_flag,
index 5d1132e11ba56eb02c19c64f80ca1f32190b344c..612c1a9984846f519335a046a11f4a1cf0f86b8e 100644 (file)
@@ -28,8 +28,8 @@ struct interval
 {
   /* The first group of entries deal with the tree structure.  */
 
-  unsigned EMACS_INT total_length; /* Length of myself and both children.  */
-  unsigned EMACS_INT position; /* Cache of interval's character position.  */
+  EMACS_UINT total_length;      /* Length of myself and both children.  */
+  EMACS_UINT position;         /* Cache of interval's character position.  */
                                /* This field is usually updated
                                   simultaneously with an interval
                                   traversal, there is no guarantee
@@ -243,49 +243,49 @@ struct interval
 
 /* Declared in alloc.c */
 
-extern INTERVAL make_interval P_ ((void));
+extern INTERVAL make_interval (void);
 
 /* Declared in intervals.c */
 
-extern INTERVAL create_root_interval P_ ((Lisp_Object));
-extern void copy_properties P_ ((INTERVAL, INTERVAL));
-extern int intervals_equal P_ ((INTERVAL, INTERVAL));
-extern void traverse_intervals P_ ((INTERVAL, int,
-                                   void (*) (INTERVAL, Lisp_Object),
-                                   Lisp_Object));
-extern void traverse_intervals_noorder P_ ((INTERVAL,
-                                   void (*) (INTERVAL, Lisp_Object),
-                                   Lisp_Object));
-extern INTERVAL split_interval_right P_ ((INTERVAL, int));
-extern INTERVAL split_interval_left P_ ((INTERVAL, int));
-extern INTERVAL find_interval P_ ((INTERVAL, int));
-extern INTERVAL next_interval P_ ((INTERVAL));
-extern INTERVAL previous_interval P_ ((INTERVAL));
-extern INTERVAL merge_interval_left P_ ((INTERVAL));
-extern INTERVAL merge_interval_right P_ ((INTERVAL));
-extern void delete_interval P_ ((INTERVAL));
-extern INLINE void offset_intervals P_ ((struct buffer *, int, int));
-extern void graft_intervals_into_buffer P_ ((INTERVAL, int, int,
-                                            struct buffer *, int));
-extern void verify_interval_modification P_ ((struct buffer *, int, int));
-extern INTERVAL balance_intervals P_ ((INTERVAL));
-extern INLINE void copy_intervals_to_string P_ ((Lisp_Object, struct buffer *,
-                                                int, int));
-extern INTERVAL copy_intervals P_ ((INTERVAL, int, int));
-extern int compare_string_intervals P_ ((Lisp_Object, Lisp_Object));
-extern Lisp_Object textget P_ ((Lisp_Object, Lisp_Object));
-extern Lisp_Object lookup_char_property P_ ((Lisp_Object, Lisp_Object, int));
-extern void move_if_not_intangible P_ ((int));
-extern int get_property_and_range P_ ((int, Lisp_Object, Lisp_Object *,
-                                      EMACS_INT *, EMACS_INT *, Lisp_Object));
-extern Lisp_Object get_local_map P_ ((int, struct buffer *, Lisp_Object));
-extern INTERVAL update_interval P_ ((INTERVAL, int));
-extern void set_intervals_multibyte P_ ((int));
-extern INTERVAL validate_interval_range P_ ((Lisp_Object, Lisp_Object *,
-                                            Lisp_Object *, int));
+extern INTERVAL create_root_interval (Lisp_Object);
+extern void copy_properties (INTERVAL, INTERVAL);
+extern int intervals_equal (INTERVAL, INTERVAL);
+extern void traverse_intervals (INTERVAL, int,
+                                void (*) (INTERVAL, Lisp_Object),
+                                Lisp_Object);
+extern void traverse_intervals_noorder (INTERVAL,
+                                        void (*) (INTERVAL, Lisp_Object),
+                                        Lisp_Object);
+extern INTERVAL split_interval_right (INTERVAL, int);
+extern INTERVAL split_interval_left (INTERVAL, int);
+extern INTERVAL find_interval (INTERVAL, int);
+extern INTERVAL next_interval (INTERVAL);
+extern INTERVAL previous_interval (INTERVAL);
+extern INTERVAL merge_interval_left (INTERVAL);
+extern INTERVAL merge_interval_right (INTERVAL);
+extern void delete_interval (INTERVAL);
+extern INLINE void offset_intervals (struct buffer *, int, int);
+extern void graft_intervals_into_buffer (INTERVAL, int, int,
+                                         struct buffer *, int);
+extern void verify_interval_modification (struct buffer *, int, int);
+extern INTERVAL balance_intervals (INTERVAL);
+extern INLINE void copy_intervals_to_string (Lisp_Object, struct buffer *,
+                                             int, int);
+extern INTERVAL copy_intervals (INTERVAL, int, int);
+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 (int);
+extern int get_property_and_range (int, Lisp_Object, Lisp_Object *,
+                                   EMACS_INT *, EMACS_INT *, Lisp_Object);
+extern Lisp_Object get_local_map (int, struct buffer *, Lisp_Object);
+extern INTERVAL update_interval (INTERVAL, int);
+extern void set_intervals_multibyte (int);
+extern INTERVAL validate_interval_range (Lisp_Object, Lisp_Object *,
+                                         Lisp_Object *, int);
 
 /* Defined in xdisp.c */
-extern int invisible_p P_ ((Lisp_Object, Lisp_Object));
+extern int invisible_p (Lisp_Object, Lisp_Object);
 
 /* Declared in textprop.c */
 
@@ -323,27 +323,27 @@ EXFUN (Fremove_text_properties, 4);
 EXFUN (Ftext_property_any, 5);
 EXFUN (Ftext_property_not_all, 5);
 EXFUN (Fprevious_single_char_property_change, 4);
-extern Lisp_Object copy_text_properties P_ ((Lisp_Object, Lisp_Object,
-                                            Lisp_Object, Lisp_Object,
-                                            Lisp_Object, Lisp_Object));
-extern Lisp_Object set_text_properties P_ ((Lisp_Object, Lisp_Object,
-                                           Lisp_Object, Lisp_Object,
-                                           Lisp_Object));
-extern void set_text_properties_1 P_ ((Lisp_Object, Lisp_Object,
-                                      Lisp_Object, Lisp_Object, INTERVAL));
-
-Lisp_Object text_property_list P_ ((Lisp_Object, Lisp_Object, Lisp_Object,
-                                   Lisp_Object));
-int add_text_properties_from_list P_ ((Lisp_Object, Lisp_Object, Lisp_Object));
-Lisp_Object extend_property_ranges P_ ((Lisp_Object, Lisp_Object));
-Lisp_Object get_char_property_and_overlay P_ ((Lisp_Object, Lisp_Object,
-                                              Lisp_Object, Lisp_Object*));
-extern int text_property_stickiness P_ ((Lisp_Object prop, Lisp_Object pos,
-                                        Lisp_Object buffer));
-extern Lisp_Object get_pos_property P_ ((Lisp_Object pos, Lisp_Object prop,
-                                        Lisp_Object object));
-
-extern void syms_of_textprop P_ ((void));
+extern Lisp_Object copy_text_properties (Lisp_Object, Lisp_Object,
+                                         Lisp_Object, Lisp_Object,
+                                         Lisp_Object, Lisp_Object);
+extern Lisp_Object set_text_properties (Lisp_Object, Lisp_Object,
+                                        Lisp_Object, Lisp_Object,
+                                        Lisp_Object);
+extern void set_text_properties_1 (Lisp_Object, Lisp_Object,
+                                   Lisp_Object, Lisp_Object, INTERVAL);
+
+Lisp_Object text_property_list (Lisp_Object, Lisp_Object, Lisp_Object,
+                                Lisp_Object);
+int add_text_properties_from_list (Lisp_Object, Lisp_Object, Lisp_Object);
+Lisp_Object extend_property_ranges (Lisp_Object, Lisp_Object);
+Lisp_Object get_char_property_and_overlay (Lisp_Object, Lisp_Object,
+                                           Lisp_Object, Lisp_Object*);
+extern int text_property_stickiness (Lisp_Object prop, Lisp_Object pos,
+                                     Lisp_Object buffer);
+extern Lisp_Object get_pos_property (Lisp_Object pos, Lisp_Object prop,
+                                     Lisp_Object object);
+
+extern void syms_of_textprop (void);
 
 #include "composite.h"
 
index 056e379a44a96f99547901146d76368772109a4e..7b1a39403f39a5bb81c914761608afed68ba2bad 100644 (file)
@@ -42,6 +42,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "puresize.h"
 #include "systime.h"
 #include "atimer.h"
+#include "process.h"
 #include <errno.h>
 
 #ifdef HAVE_GTK_AND_PTHREAD
@@ -78,10 +79,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "nsterm.h"
 #endif
 
-#ifndef USE_CRT_DLL
-extern int errno;
-#endif
-
 /* Variables for blockinput.h: */
 
 /* Non-zero if interrupt input is blocked right now.  */
@@ -249,9 +246,6 @@ Lisp_Object Vminibuffer_message_timeout;
    ASCII character.  */
 int quit_char;
 
-extern Lisp_Object current_global_map;
-extern int minibuf_level;
-
 /* If non-nil, this is a map that overrides all other local maps.  */
 Lisp_Object Voverriding_local_map;
 
@@ -367,6 +361,15 @@ Lisp_Object Vlast_event_frame;
    X Windows wants this for selection ownership.  */
 unsigned long last_event_timestamp;
 
+/* If non-nil, active regions automatically become the window selection.  */
+Lisp_Object Vselect_active_regions;
+
+/* The text in the active region prior to modifying the buffer.
+   Used by the `select-active-regions' feature.  */
+Lisp_Object Vsaved_region_selection;
+
+Lisp_Object Qx_set_selection, QPRIMARY, Qhandle_switch_frame;
+
 Lisp_Object Qself_insert_command;
 Lisp_Object Qforward_char;
 Lisp_Object Qbackward_char;
@@ -471,8 +474,6 @@ Lisp_Object Qmake_frame_visible;
 Lisp_Object Qselect_window;
 Lisp_Object Qhelp_echo;
 
-extern Lisp_Object Qremap;
-
 #if defined (HAVE_MOUSE) || defined (HAVE_GPM)
 Lisp_Object Qmouse_fixup_help_message;
 #endif
@@ -499,8 +500,7 @@ Lisp_Object Qevent_symbol_elements;
 /* menu item parts */
 Lisp_Object Qmenu_enable;
 Lisp_Object QCenable, QCvisible, QChelp, QCfilter, QCkeys, QCkey_sequence;
-Lisp_Object QCbutton, QCtoggle, QCradio;
-extern Lisp_Object Qmenu_item;
+Lisp_Object QCbutton, QCtoggle, QCradio, QClabel;
 
 /* An event header symbol HEAD may have a property named
    Qevent_symbol_element_mask, which is of the form (BASE MODIFIERS);
@@ -520,21 +520,14 @@ Lisp_Object Qmode_line;
 Lisp_Object Qvertical_line;
 Lisp_Object Qvertical_scroll_bar;
 Lisp_Object Qmenu_bar;
-extern Lisp_Object Qleft_margin, Qright_margin;
-extern Lisp_Object Qleft_fringe, Qright_fringe;
-extern Lisp_Object QCmap;
 
-Lisp_Object recursive_edit_unwind (), command_loop ();
-Lisp_Object Fthis_command_keys ();
+Lisp_Object recursive_edit_unwind (Lisp_Object buffer), command_loop (void);
+Lisp_Object Fthis_command_keys (void);
 Lisp_Object Qextended_command_history;
-EMACS_TIME timer_check ();
-
-extern Lisp_Object Vhistory_length, Vtranslation_table_for_input;
-
-extern char *x_get_keysym_name ();
+EMACS_TIME timer_check (int do_it_now);
 
-static void record_menu_key ();
-static int echo_length ();
+static void record_menu_key (Lisp_Object c);
+static int echo_length (void);
 
 Lisp_Object Qpolling_period;
 
@@ -547,8 +540,6 @@ Lisp_Object Vtimer_idle_list;
 /* Incremented whenever a timer is run.  */
 int timers_run;
 
-extern Lisp_Object Vprint_level, Vprint_length;
-
 /* Address (if not 0) of EMACS_TIME to zero out if a SIGIO interrupt
    happens.  */
 EMACS_TIME *input_available_clear_time;
@@ -614,55 +605,54 @@ Lisp_Object Venable_disabled_menus_and_buttons;
 #define READABLE_EVENTS_IGNORE_SQUEEZABLES     (1 << 2)
 
 /* Function for init_keyboard to call with no args (if nonzero).  */
-void (*keyboard_init_hook) ();
-
-static int read_avail_input P_ ((int));
-static void get_input_pending P_ ((int *, int));
-static int readable_events P_ ((int));
-static Lisp_Object read_char_x_menu_prompt P_ ((int, Lisp_Object *,
-                                               Lisp_Object, int *));
-static Lisp_Object read_char_x_menu_prompt ();
-static Lisp_Object read_char_minibuf_menu_prompt P_ ((int, int,
-                                                     Lisp_Object *));
-static Lisp_Object make_lispy_event P_ ((struct input_event *));
+void (*keyboard_init_hook) (void);
+
+static int read_avail_input (int);
+static void get_input_pending (int *, int);
+static int readable_events (int);
+static Lisp_Object read_char_x_menu_prompt (int, Lisp_Object *,
+                                            Lisp_Object, int *);
+static Lisp_Object read_char_minibuf_menu_prompt (int, int,
+                                                  Lisp_Object *);
+static Lisp_Object make_lispy_event (struct input_event *);
 #if defined (HAVE_MOUSE) || defined (HAVE_GPM)
-static Lisp_Object make_lispy_movement P_ ((struct frame *, Lisp_Object,
-                                           enum scroll_bar_part,
-                                           Lisp_Object, Lisp_Object,
-                                           unsigned long));
-#endif
-static Lisp_Object modify_event_symbol P_ ((int, unsigned, Lisp_Object,
-                                           Lisp_Object, char **,
-                                           Lisp_Object *, unsigned));
-static Lisp_Object make_lispy_switch_frame P_ ((Lisp_Object));
-static void save_getcjmp P_ ((jmp_buf));
-static void save_getcjmp ();
-static void restore_getcjmp P_ ((jmp_buf));
-static Lisp_Object apply_modifiers P_ ((int, Lisp_Object));
-static void clear_event P_ ((struct input_event *));
-static Lisp_Object restore_kboard_configuration P_ ((Lisp_Object));
-static SIGTYPE interrupt_signal P_ ((int signalnum));
-static void handle_interrupt P_ ((void));
-static void timer_start_idle P_ ((void));
-static void timer_stop_idle P_ ((void));
-static void timer_resume_idle P_ ((void));
-static SIGTYPE handle_user_signal P_ ((int));
-static char *find_user_signal_name P_ ((int));
-static int store_user_signal_events P_ ((void));
+static Lisp_Object make_lispy_movement (struct frame *, Lisp_Object,
+                                        enum scroll_bar_part,
+                                        Lisp_Object, Lisp_Object,
+                                        unsigned long);
+#endif
+static Lisp_Object modify_event_symbol (int, unsigned, Lisp_Object,
+                                        Lisp_Object, const char **,
+                                        Lisp_Object *, unsigned);
+static Lisp_Object make_lispy_switch_frame (Lisp_Object);
+static void save_getcjmp (jmp_buf);
+static void restore_getcjmp (jmp_buf);
+static Lisp_Object apply_modifiers (int, Lisp_Object);
+static void clear_event (struct input_event *);
+static Lisp_Object restore_kboard_configuration (Lisp_Object);
+static SIGTYPE interrupt_signal (int signalnum);
+#ifdef SIGIO
+static SIGTYPE input_available_signal (int signo);
+#endif
+static void handle_interrupt (void);
+static void timer_start_idle (void);
+static void timer_stop_idle (void);
+static void timer_resume_idle (void);
+static SIGTYPE handle_user_signal (int);
+static char *find_user_signal_name (int);
+static int store_user_signal_events (void);
 
 /* Nonzero means don't try to suspend even if the operating system seems
    to support it.  */
 static int cannot_suspend;
 
-extern Lisp_Object Qidentity, Qonly;
 \f
 /* Install the string STR as the beginning of the string of echoing,
    so that it serves as a prompt for the next character.
    Also start echoing.  */
 
 void
-echo_prompt (str)
-     Lisp_Object str;
+echo_prompt (Lisp_Object str)
 {
   current_kboard->echo_string = str;
   current_kboard->echo_after_prompt = SCHARS (str);
@@ -674,8 +664,7 @@ echo_prompt (str)
    jazz), or a symbol, whose name is printed.  */
 
 void
-echo_char (c)
-     Lisp_Object c;
+echo_char (Lisp_Object c)
 {
   if (current_kboard->immediate_echo)
     {
@@ -724,7 +713,7 @@ echo_char (c)
              ptr = buffer + offset;
            }
 
-         bcopy (text, ptr, len);
+         memcpy (ptr, text, len);
          ptr += len;
        }
 
@@ -762,7 +751,7 @@ echo_char (c)
    empty, so that it serves as a mini-prompt for the very next character.  */
 
 void
-echo_dash ()
+echo_dash (void)
 {
   /* Do nothing if not echoing at all.  */
   if (NILP (current_kboard->echo_string))
@@ -803,7 +792,7 @@ echo_dash ()
    doing so.  */
 
 void
-echo_now ()
+echo_now (void)
 {
   if (!current_kboard->immediate_echo)
     {
@@ -853,7 +842,7 @@ echo_now ()
 /* Turn off echoing, for the start of a new command.  */
 
 void
-cancel_echoing ()
+cancel_echoing (void)
 {
   current_kboard->immediate_echo = 0;
   current_kboard->echo_after_prompt = -1;
@@ -866,7 +855,7 @@ cancel_echoing ()
 /* Return the length of the current echo string.  */
 
 static int
-echo_length ()
+echo_length (void)
 {
   return (STRINGP (current_kboard->echo_string)
          ? SCHARS (current_kboard->echo_string)
@@ -878,8 +867,7 @@ echo_length ()
    switches frames while entering a key sequence.  */
 
 static void
-echo_truncate (nchars)
-     int nchars;
+echo_truncate (int nchars)
 {
   if (STRINGP (current_kboard->echo_string))
     current_kboard->echo_string
@@ -891,8 +879,7 @@ echo_truncate (nchars)
 \f
 /* Functions for manipulating this_command_keys.  */
 static void
-add_command_key (key)
-     Lisp_Object key;
+add_command_key (Lisp_Object key)
 {
 #if 0 /* Not needed after we made Freset_this_command_lengths
         do the job immediately.  */
@@ -919,7 +906,7 @@ add_command_key (key)
 
 \f
 Lisp_Object
-recursive_edit_1 ()
+recursive_edit_1 (void)
 {
   int count = SPECPDL_INDEX ();
   Lisp_Object val;
@@ -964,7 +951,7 @@ recursive_edit_1 ()
 /* When an auto-save happens, record the "time", and don't do again soon.  */
 
 void
-record_auto_save ()
+record_auto_save (void)
 {
   last_auto_save = num_nonmacro_input_events;
 }
@@ -972,7 +959,7 @@ record_auto_save ()
 /* Make an auto save happen as soon as possible at command level.  */
 
 void
-force_auto_save_soon ()
+force_auto_save_soon (void)
 {
   last_auto_save = - auto_save_interval - 1;
 
@@ -985,7 +972,7 @@ To get out of the recursive edit, a command can do `(throw 'exit nil)';
 that tells this function to return.
 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 ();
   Lisp_Object buffer;
@@ -1017,8 +1004,7 @@ This function is called by the editor initialization to begin editing.  */)
 }
 
 Lisp_Object
-recursive_edit_unwind (buffer)
-     Lisp_Object buffer;
+recursive_edit_unwind (Lisp_Object buffer)
 {
   if (BUFFERP (buffer))
     Fset_buffer (buffer);
@@ -1063,8 +1049,7 @@ single_kboard_state ()
    get out of it.  */
 
 void
-not_single_kboard_state (kboard)
-     KBOARD *kboard;
+not_single_kboard_state (KBOARD *kboard)
 {
   if (kboard == current_kboard)
     single_kboard = 0;
@@ -1083,8 +1068,7 @@ struct kboard_stack
 static struct kboard_stack *kboard_stack;
 
 void
-push_kboard (k)
-     struct kboard *k;
+push_kboard (struct kboard *k)
 {
   struct kboard_stack *p
     = (struct kboard_stack *) xmalloc (sizeof (struct kboard_stack));
@@ -1097,7 +1081,7 @@ push_kboard (k)
 }
 
 void
-pop_kboard ()
+pop_kboard (void)
 {
   struct terminal *t;
   struct kboard_stack *p = kboard_stack;
@@ -1132,8 +1116,7 @@ pop_kboard ()
   locked, then this function will throw an errow.  */
 
 void
-temporarily_switch_to_single_kboard (f)
-     struct frame *f;
+temporarily_switch_to_single_kboard (struct frame *f)
 {
   int was_locked = single_kboard;
   if (was_locked)
@@ -1173,8 +1156,7 @@ record_single_kboard_state ()
 #endif
 
 static Lisp_Object
-restore_kboard_configuration (was_locked)
-     Lisp_Object was_locked;
+restore_kboard_configuration (Lisp_Object was_locked)
 {
   if (NILP (was_locked))
     single_kboard = 0;
@@ -1195,8 +1177,7 @@ restore_kboard_configuration (was_locked)
    by printing an error message and returning to the editor command loop.  */
 
 Lisp_Object
-cmd_error (data)
-     Lisp_Object data;
+cmd_error (Lisp_Object data)
 {
   Lisp_Object old_level, old_length;
   char macroerror[50];
@@ -1254,9 +1235,7 @@ cmd_error (data)
    string.  */
 
 void
-cmd_error_internal (data, context)
-     Lisp_Object data;
-     char *context;
+cmd_error_internal (Lisp_Object data, const char *context)
 {
   struct frame *sf = SELECTED_FRAME ();
 
@@ -1307,16 +1286,16 @@ cmd_error_internal (data, context)
   Vsignaling_function = Qnil;
 }
 \f
-Lisp_Object command_loop_1 ();
-Lisp_Object command_loop_2 ();
-Lisp_Object top_level_1 ();
+Lisp_Object command_loop_1 (void);
+Lisp_Object command_loop_2 (Lisp_Object);
+Lisp_Object top_level_1 (Lisp_Object);
 
 /* Entry to editor-command-loop.
    This level has the catches for exiting/returning to editor command loop.
    It returns nil to exit recursive edit, t to abort it.  */
 
 Lisp_Object
-command_loop ()
+command_loop (void)
 {
   if (command_loop_level > 0 || minibuf_level > 0)
     {
@@ -1351,7 +1330,7 @@ command_loop ()
    returned due to end of file (or end of kbd macro).  */
 
 Lisp_Object
-command_loop_2 ()
+command_loop_2 (Lisp_Object ignore)
 {
   register Lisp_Object val;
 
@@ -1363,13 +1342,13 @@ command_loop_2 ()
 }
 
 Lisp_Object
-top_level_2 ()
+top_level_2 (void)
 {
   return Feval (Vtop_level);
 }
 
 Lisp_Object
-top_level_1 ()
+top_level_1 (Lisp_Object ignore)
 {
   /* On entry to the outer level, run the startup file */
   if (!NILP (Vtop_level))
@@ -1384,7 +1363,7 @@ top_level_1 ()
 DEFUN ("top-level", Ftop_level, Stop_level, 0, 0, "",
        doc: /* Exit all recursive editing levels.
 This also exits all active minibuffers.  */)
-     ()
+  (void)
 {
 #ifdef HAVE_WINDOW_SYSTEM
   if (display_hourglass_p)
@@ -1396,29 +1375,27 @@ This also exits all active minibuffers.  */)
   while (INPUT_BLOCKED_P)
     UNBLOCK_INPUT;
 
-  return Fthrow (Qtop_level, Qnil);
+  Fthrow (Qtop_level, Qnil);
 }
 
 DEFUN ("exit-recursive-edit", Fexit_recursive_edit, Sexit_recursive_edit, 0, 0, "",
        doc: /* Exit from the innermost recursive edit or minibuffer.  */)
-     ()
+  (void)
 {
   if (command_loop_level > 0 || minibuf_level > 0)
     Fthrow (Qexit, Qnil);
 
   error ("No recursive edit is in progress");
-  return Qnil;
 }
 
 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)
 {
   if (command_loop_level > 0 || minibuf_level > 0)
     Fthrow (Qexit, Qt);
 
   error ("No recursive edit is in progress");
-  return Qnil;
 }
 \f
 #if defined (HAVE_MOUSE) || defined (HAVE_GPM)
@@ -1427,8 +1404,7 @@ DEFUN ("abort-recursive-edit", Fabort_recursive_edit, Sabort_recursive_edit, 0,
    of this function.  */
 
 static Lisp_Object
-tracking_off (old_value)
-     Lisp_Object old_value;
+tracking_off (Lisp_Object old_value)
 {
   do_mouse_tracking = old_value;
   if (NILP (old_value))
@@ -1454,8 +1430,7 @@ Within a `track-mouse' form, mouse motion generates input events that
 you can read with `read-event'.
 Normally, mouse motion is ignored.
 usage: (track-mouse BODY...)  */)
-     (args)
-     Lisp_Object args;
+  (Lisp_Object args)
 {
   int count = SPECPDL_INDEX ();
   Lisp_Object val;
@@ -1478,7 +1453,7 @@ usage: (track-mouse BODY...)  */)
 int ignore_mouse_drag_p;
 
 static FRAME_PTR
-some_mouse_moved ()
+some_mouse_moved (void)
 {
   Lisp_Object tail, frame;
 
@@ -1502,30 +1477,31 @@ some_mouse_moved ()
 /* This is the actual command reading loop,
    sans error-handling encapsulation.  */
 
-static int read_key_sequence P_ ((Lisp_Object *, int, Lisp_Object,
-                                 int, int, int));
-void safe_run_hooks P_ ((Lisp_Object));
-static void adjust_point_for_property P_ ((int, int));
+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 (int, int);
 
 /* Cancel hourglass from protect_unwind.
    ARG is not used.  */
 #ifdef HAVE_WINDOW_SYSTEM
 static Lisp_Object
-cancel_hourglass_unwind (arg)
-     Lisp_Object arg;
+cancel_hourglass_unwind (Lisp_Object arg)
 {
   cancel_hourglass ();
   return Qnil;
 }
 #endif
 
-extern int nonundocount;       /* Declared in cmds.c.  */
+/* 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 ()
+command_loop_1 (void)
 {
   Lisp_Object cmd;
-  int lose;
   Lisp_Object keybuf[30];
   int i;
   int prev_modiff = 0;
@@ -1743,149 +1719,8 @@ command_loop_1 ()
        }
       else
        {
-         if (NILP (current_kboard->Vprefix_arg))
-           {
-             /* In case we jump to directly_done.  */
-             Vcurrent_prefix_arg = current_kboard->Vprefix_arg;
-
-             /* Recognize some common commands in common situations and
-                do them directly.  */
-             if (EQ (Vthis_command, Qforward_char) && PT < ZV
-                 && NILP (Vthis_command_keys_shift_translated)
-                 && !CONSP (Vtransient_mark_mode))
-               {
-                  struct Lisp_Char_Table *dp
-                   = window_display_table (XWINDOW (selected_window));
-                 lose = FETCH_CHAR (PT_BYTE);
-                 SET_PT (PT + 1);
-                 if (! NILP (Vpost_command_hook))
-                   /* Put this before calling adjust_point_for_property
-                      so it will only get called once in any case.  */
-                   goto directly_done;
-                 if (current_buffer == prev_buffer
-                     && last_point_position != PT
-                     && NILP (Vdisable_point_adjustment)
-                     && NILP (Vglobal_disable_point_adjustment))
-                   adjust_point_for_property (last_point_position, 0);
-                 already_adjusted = 1;
-                 if (PT == last_point_position + 1
-                     && (dp
-                         ? (VECTORP (DISP_CHAR_VECTOR (dp, lose))
-                            ? XVECTOR (DISP_CHAR_VECTOR (dp, lose))->size == 1
-                            : (NILP (DISP_CHAR_VECTOR (dp, lose))
-                               && (lose >= 0x20 && lose < 0x7f)))
-                         : (lose >= 0x20 && lose < 0x7f))
-                     /* To extract the case of continuation on
-                         wide-column characters.  */
-                     && ASCII_BYTE_P (lose)
-                     && (XFASTINT (XWINDOW (selected_window)->last_modified)
-                         >= MODIFF)
-                     && (XFASTINT (XWINDOW (selected_window)->last_overlay_modified)
-                         >= OVERLAY_MODIFF)
-                     && (XFASTINT (XWINDOW (selected_window)->last_point)
-                         == PT - 1)
-                     && !windows_or_buffers_changed
-                     && EQ (current_buffer->selective_display, Qnil)
-                     && !detect_input_pending ()
-                     && NILP (XWINDOW (selected_window)->column_number_displayed)
-                     && NILP (Vexecuting_kbd_macro))
-                   direct_output_forward_char (1);
-                 goto directly_done;
-               }
-             else if (EQ (Vthis_command, Qbackward_char) && PT > BEGV
-                      && NILP (Vthis_command_keys_shift_translated)
-                      && !CONSP (Vtransient_mark_mode))
-               {
-                  struct Lisp_Char_Table *dp
-                   = window_display_table (XWINDOW (selected_window));
-                 SET_PT (PT - 1);
-                 lose = FETCH_CHAR (PT_BYTE);
-                 if (! NILP (Vpost_command_hook))
-                   goto directly_done;
-                 if (current_buffer == prev_buffer
-                     && last_point_position != PT
-                     && NILP (Vdisable_point_adjustment)
-                     && NILP (Vglobal_disable_point_adjustment))
-                   adjust_point_for_property (last_point_position, 0);
-                 already_adjusted = 1;
-                 if (PT == last_point_position - 1
-                     && (dp
-                         ? (VECTORP (DISP_CHAR_VECTOR (dp, lose))
-                            ? XVECTOR (DISP_CHAR_VECTOR (dp, lose))->size == 1
-                            : (NILP (DISP_CHAR_VECTOR (dp, lose))
-                               && (lose >= 0x20 && lose < 0x7f)))
-                         : (lose >= 0x20 && lose < 0x7f))
-                     && (XFASTINT (XWINDOW (selected_window)->last_modified)
-                         >= MODIFF)
-                     && (XFASTINT (XWINDOW (selected_window)->last_overlay_modified)
-                         >= OVERLAY_MODIFF)
-                     && (XFASTINT (XWINDOW (selected_window)->last_point)
-                         == PT + 1)
-                     && !windows_or_buffers_changed
-                     && EQ (current_buffer->selective_display, Qnil)
-                     && !detect_input_pending ()
-                     && NILP (XWINDOW (selected_window)->column_number_displayed)
-                     && NILP (Vexecuting_kbd_macro))
-                   direct_output_forward_char (-1);
-                 goto directly_done;
-               }
-             else if (EQ (Vthis_command, Qself_insert_command)
-                      /* Try this optimization only on char keystrokes.  */
-                      && NATNUMP (last_command_event)
-                      && CHAR_VALID_P (XFASTINT (last_command_event), 0))
-               {
-                 unsigned int c
-                   = translate_char (Vtranslation_table_for_input,
-                                     XFASTINT (last_command_event));
-                 int value;
-                 if (NILP (Vexecuting_kbd_macro)
-                     && !EQ (minibuf_window, selected_window))
-                   {
-                     if (!nonundocount || nonundocount >= 20)
-                       {
-                         Fundo_boundary ();
-                         nonundocount = 0;
-                       }
-                     nonundocount++;
-                   }
-
-                 lose = ((XFASTINT (XWINDOW (selected_window)->last_modified)
-                          < MODIFF)
-                         || (XFASTINT (XWINDOW (selected_window)->last_overlay_modified)
-                             < OVERLAY_MODIFF)
-                         || (XFASTINT (XWINDOW (selected_window)->last_point)
-                             != PT)
-                         || MODIFF <= SAVE_MODIFF
-                         || windows_or_buffers_changed
-                         || !EQ (current_buffer->selective_display, Qnil)
-                         || detect_input_pending ()
-                         || !NILP (XWINDOW (selected_window)->column_number_displayed)
-                         || !NILP (Vexecuting_kbd_macro));
-
-                 value = internal_self_insert (c, 0);
-
-                 if (value == 2)
-                   nonundocount = 0;
-
-                  frame_make_pointer_invisible ();
-
-                 if (! NILP (Vpost_command_hook))
-                   /* Put this before calling adjust_point_for_property
-                      so it will only get called once in any case.  */
-                   goto directly_done;
-
-                 /* VALUE == 1 when AFTER-CHANGE functions are
-                    installed which is the case most of the time
-                    because FONT-LOCK installs one.  */
-                 if (!lose && !value)
-                   direct_output_for_insert (c);
-                 goto directly_done;
-               }
-           }
-
          /* Here for a command that isn't executed directly */
 
-          {
 #ifdef HAVE_WINDOW_SYSTEM
             int scount = SPECPDL_INDEX ();
 
@@ -1897,7 +1732,6 @@ command_loop_1 ()
               }
 #endif
 
-            nonundocount = 0;
             if (NILP (current_kboard->Vprefix_arg)) /* FIXME: Why?  --Stef  */
               Fundo_boundary ();
             Fcommand_execute (Vthis_command, Qnil, Qnil, Qnil);
@@ -1912,8 +1746,6 @@ command_loop_1 ()
             unbind_to (scount, Qnil);
 #endif
           }
-       }
-    directly_done: ;
       current_kboard->Vlast_prefix_arg = Vcurrent_prefix_arg;
 
       /* Note that the value cell will never directly contain nil
@@ -1965,9 +1797,36 @@ command_loop_1 ()
            Vtransient_mark_mode = Qidentity;
 
          if (!NILP (Vdeactivate_mark))
+           /* If `select-active-regions' is non-nil, this call to
+              `deactivate-mark' also sets the PRIMARY selection.  */
            call0 (Qdeactivate_mark);
-         else if (current_buffer != prev_buffer || MODIFF != prev_modiff)
-           call1 (Vrun_hooks, intern ("activate-mark-hook"));
+         else
+           {
+             /* Even if not deactivating the mark, set PRIMARY if
+                `select-active-regions' is non-nil.  */
+             if (!NILP (Fwindow_system (Qnil))
+                 && (EQ (Vselect_active_regions, Qonly)
+                     ? EQ (CAR_SAFE (Vtransient_mark_mode), Qonly)
+                     : (!NILP (Vselect_active_regions)
+                        && !NILP (Vtransient_mark_mode)))
+                 && !EQ (Vthis_command, Qhandle_switch_frame))
+               {
+                 int beg = XINT (Fmarker_position (current_buffer->mark));
+                 int end = XINT (make_number (PT));
+                 if (beg < end)
+                   call2 (Qx_set_selection, QPRIMARY,
+                          make_buffer_string (beg, end, 0));
+                 else if (beg > end)
+                   call2 (Qx_set_selection, QPRIMARY,
+                          make_buffer_string (end, beg, 0));
+                 /* Don't set empty selections.  */
+               }
+
+             if (current_buffer != prev_buffer || MODIFF != prev_modiff)
+               call1 (Vrun_hooks, intern ("activate-mark-hook"));
+           }
+
+         Vsaved_region_selection = Qnil;
        }
 
     finalize:
@@ -2004,20 +1863,13 @@ command_loop_1 ()
     }
 }
 
-extern Lisp_Object Qcomposition, Qdisplay;
-
 /* Adjust point to a boundary of a region that has such a property
    that should be treated intangible.  For the moment, we check
    `composition', `display' and `invisible' properties.
    LAST_PT is the last position of point.  */
 
-extern Lisp_Object Qafter_string, Qbefore_string;
-extern Lisp_Object get_pos_property P_ ((Lisp_Object, Lisp_Object, Lisp_Object));
-
 static void
-adjust_point_for_property (last_pt, modified)
-     int last_pt;
-     int modified;
+adjust_point_for_property (int last_pt, int modified)
 {
   EMACS_INT beg, end;
   Lisp_Object val, overlay, tmp;
@@ -2167,8 +2019,7 @@ adjust_point_for_property (last_pt, modified)
 /* Subroutine for safe_run_hooks: run the hook HOOK.  */
 
 static Lisp_Object
-safe_run_hooks_1 (hook)
-     Lisp_Object hook;
+safe_run_hooks_1 (void)
 {
   if (NILP (Vrun_hooks))
     return Qnil;
@@ -2178,8 +2029,7 @@ safe_run_hooks_1 (hook)
 /* Subroutine for safe_run_hooks: handle an error by clearing out the hook.  */
 
 static Lisp_Object
-safe_run_hooks_error (data)
-     Lisp_Object data;
+safe_run_hooks_error (Lisp_Object data)
 {
   Lisp_Object args[3];
   args[0] = build_string ("Error in %s: %s");
@@ -2194,8 +2044,7 @@ safe_run_hooks_error (data)
    to mysteriously evaporate.  */
 
 void
-safe_run_hooks (hook)
-     Lisp_Object hook;
+safe_run_hooks (Lisp_Object hook)
 {
   int count = SPECPDL_INDEX ();
   specbind (Qinhibit_quit, hook);
@@ -2227,7 +2076,7 @@ struct atimer *poll_timer;
    there.  */
 
 void
-poll_for_input_1 ()
+poll_for_input_1 (void)
 {
 /* Tell ns_read_socket() it is being called asynchronously so it can avoid
    doing anything dangerous. */
@@ -2246,8 +2095,7 @@ poll_for_input_1 ()
    poll_timer.  */
 
 void
-poll_for_input (timer)
-     struct atimer *timer;
+poll_for_input (struct atimer *timer)
 {
   if (poll_suppress_count == 0)
     {
@@ -2266,7 +2114,7 @@ poll_for_input (timer)
    This function is called unconditionally from various places.  */
 
 void
-start_polling ()
+start_polling (void)
 {
 #ifdef POLL_FOR_INPUT
   /* XXX This condition was (read_socket_hook && !interrupt_input),
@@ -2303,7 +2151,7 @@ start_polling ()
 /* Nonzero if we are using polling to handle input asynchronously.  */
 
 int
-input_polling_used ()
+input_polling_used (void)
 {
 #ifdef POLL_FOR_INPUT
   /* XXX This condition was (read_socket_hook && !interrupt_input),
@@ -2318,7 +2166,7 @@ input_polling_used ()
 /* Turn off polling.  */
 
 void
-stop_polling ()
+stop_polling (void)
 {
 #ifdef POLL_FOR_INPUT
   /* XXX This condition was (read_socket_hook && !interrupt_input),
@@ -2333,8 +2181,7 @@ stop_polling ()
    and start or stop polling accordingly.  */
 
 void
-set_poll_suppress_count (count)
-     int count;
+set_poll_suppress_count (int count)
 {
 #ifdef POLL_FOR_INPUT
   if (count == 0 && poll_suppress_count != 0)
@@ -2354,8 +2201,7 @@ set_poll_suppress_count (count)
    But don't decrease it.  */
 
 void
-bind_polling_period (n)
-     int n;
+bind_polling_period (int n)
 {
 #ifdef POLL_FOR_INPUT
   int new = polling_period;
@@ -2374,8 +2220,7 @@ bind_polling_period (n)
 /* Apply the control modifier to CHARACTER.  */
 
 int
-make_ctrl_char (c)
-     int c;
+make_ctrl_char (int c)
 {
   /* Save the upper bits here.  */
   int upper = c & ~0177;
@@ -2444,9 +2289,8 @@ make_ctrl_char (c)
    from X code running asynchronously.  */
 
 void
-show_help_echo (help, window, object, pos, ok_to_overwrite_keystroke_echo)
-     Lisp_Object help, window, object, pos;
-     int ok_to_overwrite_keystroke_echo;
+show_help_echo (Lisp_Object help, Lisp_Object window, Lisp_Object object,
+               Lisp_Object pos, int ok_to_overwrite_keystroke_echo)
 {
   if (!NILP (help) && !STRINGP (help))
     {
@@ -2493,9 +2337,10 @@ show_help_echo (help, window, object, pos, ok_to_overwrite_keystroke_echo)
 \f
 /* Input of single characters from keyboard */
 
-Lisp_Object print_help ();
-static Lisp_Object kbd_buffer_get_event ();
-static void record_char ();
+Lisp_Object print_help (Lisp_Object object);
+static Lisp_Object kbd_buffer_get_event (KBOARD **kbp, int *used_mouse_menu,
+                                        struct timeval *end_time);
+static void record_char (Lisp_Object c);
 
 static Lisp_Object help_form_saved_window_configs;
 static Lisp_Object
@@ -2544,13 +2389,8 @@ do { if (polling_stopped_here) start_polling (); \
    Value is t if we showed a menu and the user rejected it.  */
 
 Lisp_Object
-read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu, end_time)
-     int commandflag;
-     int nmaps;
-     Lisp_Object *maps;
-     Lisp_Object prev_event;
-     int *used_mouse_menu;
-     EMACS_TIME *end_time;
+read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event,
+          int *used_mouse_menu, struct timeval *end_time)
 {
   volatile Lisp_Object c;
   int count, jmpcount;
@@ -3461,8 +3301,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu, end_time)
    Record it for echoing, for this-command-keys, and so on.  */
 
 static void
-record_menu_key (c)
-     Lisp_Object c;
+record_menu_key (Lisp_Object c)
 {
   /* Wipe the echo area.  */
   clear_message (1, 0);
@@ -3496,8 +3335,7 @@ record_menu_key (c)
 /* Return 1 if should recognize C as "the help character".  */
 
 int
-help_char_p (c)
-     Lisp_Object c;
+help_char_p (Lisp_Object c)
 {
   Lisp_Object tail;
 
@@ -3512,8 +3350,7 @@ help_char_p (c)
 /* Record the input event C in various ways.  */
 
 static void
-record_char (c)
-     Lisp_Object c;
+record_char (Lisp_Object c)
 {
   int recorded = 0;
 
@@ -3647,8 +3484,7 @@ record_char (c)
 }
 
 Lisp_Object
-print_help (object)
-     Lisp_Object object;
+print_help (Lisp_Object object)
 {
   struct buffer *old = current_buffer;
   Fprinc (object, Qnil);
@@ -3664,17 +3500,15 @@ print_help (object)
    See read_process_output.  */
 
 static void
-save_getcjmp (temp)
-     jmp_buf temp;
+save_getcjmp (jmp_buf temp)
 {
-  bcopy (getcjmp, temp, sizeof getcjmp);
+  memcpy (temp, getcjmp, sizeof getcjmp);
 }
 
 static void
-restore_getcjmp (temp)
-     jmp_buf temp;
+restore_getcjmp (jmp_buf temp)
 {
-  bcopy (temp, getcjmp, sizeof getcjmp);
+  memcpy (getcjmp, temp, sizeof getcjmp);
 }
 \f
 /* Low level keyboard/mouse input.
@@ -3684,8 +3518,7 @@ restore_getcjmp (temp)
 /* Return true if there are any events in the queue that read-char
    would return.  If this returns false, a read-char would block.  */
 static int
-readable_events (flags)
-     int flags;
+readable_events (int flags)
 {
 #ifdef HAVE_DBUS
   /* Check whether a D-Bus message has arrived.  */
@@ -3761,8 +3594,7 @@ readable_events (flags)
 int stop_character;
 
 static KBOARD *
-event_to_kboard (event)
-     struct input_event *event;
+event_to_kboard (struct input_event *event)
 {
   Lisp_Object frame;
   frame = event->frame_or_window;
@@ -3780,14 +3612,25 @@ event_to_kboard (event)
     return FRAME_KBOARD (XFRAME (frame));
 }
 
+/* Return the number of slots occupied in kbd_buffer.  */
+
+static int
+kbd_buffer_nr_stored (void)
+{
+  return kbd_fetch_ptr == kbd_store_ptr
+    ? 0
+    : (kbd_fetch_ptr < kbd_store_ptr
+       ? kbd_store_ptr - kbd_fetch_ptr
+       : ((kbd_buffer + KBD_BUFFER_SIZE) - kbd_fetch_ptr
+          + (kbd_store_ptr - kbd_buffer)));
+}
 
 Lisp_Object Vthrow_on_input;
 
 /* Store an event obtained at interrupt level into kbd_buffer, fifo */
 
 void
-kbd_buffer_store_event (event)
-     register struct input_event *event;
+kbd_buffer_store_event (register struct input_event *event)
 {
   kbd_buffer_store_event_hold (event, 0);
 }
@@ -3805,9 +3648,8 @@ kbd_buffer_store_event (event)
  */
 
 void
-kbd_buffer_store_event_hold (event, hold_quit)
-     register struct input_event *event;
-     struct input_event *hold_quit;
+kbd_buffer_store_event_hold (register struct input_event *event,
+                            struct input_event *hold_quit)
 {
   if (event->kind == NO_EVENT)
     abort ();
@@ -3854,7 +3696,7 @@ kbd_buffer_store_event_hold (event, hold_quit)
 
          if (hold_quit)
            {
-             bcopy (event, (char *) hold_quit, sizeof (*event));
+             memcpy (hold_quit, event, sizeof (*event));
              return;
            }
 
@@ -3903,6 +3745,17 @@ kbd_buffer_store_event_hold (event, hold_quit)
     {
       *kbd_store_ptr = *event;
       ++kbd_store_ptr;
+      if (kbd_buffer_nr_stored () > KBD_BUFFER_SIZE/2 && ! kbd_on_hold_p ())
+        {
+          /* Don't read keyboard input until we have processed kbd_buffer.
+             This happens when pasting text longer than KBD_BUFFER_SIZE/2.  */
+          hold_keyboard_input ();
+#ifdef SIGIO
+          if (!noninteractive)
+            signal (SIGIO, SIG_IGN);
+#endif
+          stop_polling ();
+        }
     }
 
   /* If we're inside while-no-input, and this event qualifies
@@ -3928,8 +3781,7 @@ kbd_buffer_store_event_hold (event, hold_quit)
 /* Put an input event back in the head of the event queue.  */
 
 void
-kbd_buffer_unget_event (event)
-     register struct input_event *event;
+kbd_buffer_unget_event (register struct input_event *event)
 {
   if (kbd_fetch_ptr == kbd_buffer)
     kbd_fetch_ptr = kbd_buffer + KBD_BUFFER_SIZE;
@@ -3957,9 +3809,8 @@ kbd_buffer_unget_event (event)
    Value is the number of input_events generated.  */
 
 void
-gen_help_event (help, frame, window, object, pos)
-     Lisp_Object help, frame, object, window;
-     int pos;
+gen_help_event (Lisp_Object help, Lisp_Object frame, Lisp_Object window,
+               Lisp_Object object, int pos)
 {
   struct input_event event;
 
@@ -3978,8 +3829,7 @@ gen_help_event (help, frame, window, object, pos)
 /* Store HELP_EVENTs for HELP on FRAME in the input queue.  */
 
 void
-kbd_buffer_store_help_event (frame, help)
-     Lisp_Object frame, help;
+kbd_buffer_store_help_event (Lisp_Object frame, Lisp_Object help)
 {
   struct input_event event;
 
@@ -3996,7 +3846,7 @@ kbd_buffer_store_help_event (frame, help)
 /* Discard any mouse events in the event buffer by setting them to
    NO_EVENT.  */
 void
-discard_mouse_events ()
+discard_mouse_events (void)
 {
   struct input_event *sp;
   for (sp = kbd_fetch_ptr; sp != kbd_store_ptr; sp++)
@@ -4026,8 +3876,7 @@ discard_mouse_events ()
    are no real input events.  */
 
 int
-kbd_buffer_events_waiting (discard)
-     int discard;
+kbd_buffer_events_waiting (int discard)
 {
   struct input_event *sp;
 
@@ -4049,8 +3898,7 @@ kbd_buffer_events_waiting (discard)
 /* Clear input event EVENT.  */
 
 static INLINE void
-clear_event (event)
-     struct input_event *event;
+clear_event (struct input_event *event)
 {
   event->kind = NO_EVENT;
 }
@@ -4063,14 +3911,25 @@ clear_event (event)
    We always read and discard one event.  */
 
 static Lisp_Object
-kbd_buffer_get_event (kbp, used_mouse_menu, end_time)
-     KBOARD **kbp;
-     int *used_mouse_menu;
-     EMACS_TIME *end_time;
+kbd_buffer_get_event (KBOARD **kbp,
+                      int *used_mouse_menu,
+                      struct timeval *end_time)
 {
   register int c;
   Lisp_Object obj;
 
+  if (kbd_on_hold_p () && kbd_buffer_nr_stored () < KBD_BUFFER_SIZE/4)
+    {
+      /* Start reading input again, we have processed enough so we can
+         accept new events again.  */
+      unhold_keyboard_input ();
+#ifdef SIGIO
+      if (!noninteractive)
+        signal (SIGIO, input_available_signal);
+#endif /* SIGIO */
+      start_polling ();
+    }
+
   if (noninteractive
       /* In case we are running as a daemon, only do this before
         detaching from the terminal.  */
@@ -4433,8 +4292,7 @@ kbd_buffer_get_event (kbp, used_mouse_menu, end_time)
    then return, without reading any user-visible events.  */
 
 void
-swallow_events (do_display)
-     int do_display;
+swallow_events (int do_display)
 {
   int old_timers_run;
 
@@ -4484,7 +4342,7 @@ swallow_events (do_display)
    for the sake of running idle-time timers.  */
 
 static void
-timer_start_idle ()
+timer_start_idle (void)
 {
   Lisp_Object timers;
 
@@ -4512,7 +4370,7 @@ timer_start_idle ()
 /* Record that Emacs is no longer idle, so stop running idle-time timers.  */
 
 static void
-timer_stop_idle ()
+timer_stop_idle (void)
 {
   EMACS_SET_SECS_USECS (timer_idleness_start_time, -1, -1);
 }
@@ -4520,7 +4378,7 @@ timer_stop_idle ()
 /* Resume idle timer from last idle start time.  */
 
 static void
-timer_resume_idle ()
+timer_resume_idle (void)
 {
   if (! EMACS_TIME_NEG_P (timer_idleness_start_time))
     return;
@@ -4536,8 +4394,6 @@ struct input_event last_timer_event;
    ...).  Each element has the form (FUN . ARGS).  */
 Lisp_Object pending_funcalls;
 
-extern Lisp_Object Qapply;
-
 /* 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.
@@ -4551,7 +4407,7 @@ extern Lisp_Object Qapply;
    should be done.  */
 
 static EMACS_TIME
-timer_check_2 ()
+timer_check_2 (void)
 {
   EMACS_TIME nexttime;
   EMACS_TIME now, idleness_now;
@@ -4752,12 +4608,11 @@ timer_check_2 ()
    Now we always run timers directly.  */
 
 EMACS_TIME
-timer_check (do_it_now)
-     int do_it_now;
+timer_check (int do_it_now)
 {
   EMACS_TIME nexttime;
 
-  do 
+  do
     {
       nexttime = timer_check_2 ();
     }
@@ -4776,7 +4631,7 @@ 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.  */)
-  ()
+  (void)
 {
   if (! EMACS_TIME_NEG_P (timer_idleness_start_time))
     {
@@ -4910,7 +4765,7 @@ static const int lispy_accent_codes[] =
 /* This is a list of Lisp names for special "accent" characters.
    It parallels lispy_accent_codes.  */
 
-static char *lispy_accent_keys[] =
+static const char *lispy_accent_keys[] =
 {
   "dead-circumflex",
   "dead-grave",
@@ -4937,7 +4792,7 @@ static char *lispy_accent_keys[] =
 #ifdef HAVE_NTGUI
 #define FUNCTION_KEY_OFFSET 0x0
 
-char *lispy_function_keys[] =
+char const *lispy_function_keys[] =
   {
     0,                /* 0                      */
 
@@ -5100,9 +4955,9 @@ char *lispy_function_keys[] =
     0,               /* VK_OEM_102        0xE2 */
     "ico-help",      /* VK_ICO_HELP       0xE3 */
     "ico-00",        /* VK_ICO_00         0xE4 */
-    0,               /* VK_PROCESSKEY     0xE5 */
+    0,               /* VK_PROCESSKEY     0xE5 - used by IME */
     "ico-clear",     /* VK_ICO_CLEAR      0xE6 */
-    "packet",        /* VK_PACKET         0xE7 */
+    0,               /* VK_PACKET         0xE7  - used to pass unicode chars */
     0,               /*                   0xE8 */
     "reset",         /* VK_OEM_RESET      0xE9 */
     "jump",          /* VK_OEM_JUMP       0xEA */
@@ -5131,7 +4986,7 @@ char *lispy_function_keys[] =
 
 /* Some of these duplicate the "Media keys" on newer keyboards,
    but they are delivered to the application in a different way.  */
-static char *lispy_multimedia_keys[] =
+static const char *lispy_multimedia_keys[] =
   {
     0,
     "browser-back",
@@ -5195,7 +5050,7 @@ static char *lispy_multimedia_keys[] =
    the XK_kana_A case below.  */
 #if 0
 #ifdef XK_kana_A
-static char *lispy_kana_keys[] =
+static const char *lispy_kana_keys[] =
   {
     /* X Keysym value */
     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,   /* 0x400 .. 0x40f */
@@ -5234,7 +5089,7 @@ static char *lispy_kana_keys[] =
 
 /* You'll notice that this table is arranged to be conveniently
    indexed by X Windows keysym values.  */
-static char *lispy_function_keys[] =
+static const char *lispy_function_keys[] =
   {
     /* X Keysym value */
 
@@ -5320,7 +5175,7 @@ static char *lispy_function_keys[] =
 /* ISO 9995 Function and Modifier Keys; the first byte is 0xFE.  */
 #define ISO_FUNCTION_KEY_OFFSET 0xfe00
 
-static char *iso_lispy_function_keys[] =
+static const char *iso_lispy_function_keys[] =
   {
     0, 0, 0, 0, 0, 0, 0, 0,    /* 0xfe00 */
     0, 0, 0, 0, 0, 0, 0, 0,    /* 0xfe08 */
@@ -5343,14 +5198,14 @@ static char *iso_lispy_function_keys[] =
 
 Lisp_Object Vlispy_mouse_stem;
 
-static char *lispy_wheel_names[] =
+static const char *lispy_wheel_names[] =
 {
   "wheel-up", "wheel-down", "wheel-left", "wheel-right"
 };
 
 /* drag-n-drop events are generated when a set of selected files are
    dragged from another application and dropped onto an Emacs window.  */
-static char *lispy_drag_n_drop_names[] =
+static const char *lispy_drag_n_drop_names[] =
 {
   "drag-n-drop"
 };
@@ -5361,7 +5216,7 @@ Lisp_Object Qup, Qdown, Qbottom, Qend_scroll;
 Lisp_Object Qtop, Qratio;
 
 /* An array of scroll bar parts, indexed by an enum scroll_bar_part value.  */
-Lisp_Object *scroll_bar_parts[] = {
+const Lisp_Object *scroll_bar_parts[] = {
   &Qabove_handle, &Qhandle, &Qbelow_handle,
   &Qup, &Qdown, &Qtop, &Qbottom, &Qend_scroll, &Qratio
 };
@@ -5404,10 +5259,8 @@ int double_click_count;
 /* Return position of a mouse click or wheel event */
 
 static Lisp_Object
-make_lispy_position (f, x, y, time)
-     struct frame *f;
-     Lisp_Object *x, *y;
-     unsigned long time;
+make_lispy_position (struct frame *f, Lisp_Object *x, Lisp_Object *y,
+                    unsigned long time)
 {
   Lisp_Object window;
   enum window_part part;
@@ -5594,8 +5447,7 @@ make_lispy_position (f, x, y, time)
    in order to build drag events when the button is released.  */
 
 static Lisp_Object
-make_lispy_event (event)
-     struct input_event *event;
+make_lispy_event (struct input_event *event)
 {
   int i;
 
@@ -6302,12 +6154,8 @@ make_lispy_event (event)
 #if defined(HAVE_MOUSE) || defined(HAVE_GPM)
 
 static Lisp_Object
-make_lispy_movement (frame, bar_window, part, x, y, time)
-     FRAME_PTR frame;
-     Lisp_Object bar_window;
-     enum scroll_bar_part part;
-     Lisp_Object x, y;
-     unsigned long time;
+make_lispy_movement (FRAME_PTR frame, Lisp_Object bar_window, enum scroll_bar_part part,
+                    Lisp_Object x, Lisp_Object y, unsigned long time)
 {
   /* Is it a scroll bar movement?  */
   if (frame && ! NILP (bar_window))
@@ -6342,8 +6190,7 @@ make_lispy_movement (frame, bar_window, part, x, y, time)
 
 /* Construct a switch frame event.  */
 static Lisp_Object
-make_lispy_switch_frame (frame)
-     Lisp_Object frame;
+make_lispy_switch_frame (Lisp_Object frame)
 {
   return Fcons (Qswitch_frame, Fcons (frame, Qnil));
 }
@@ -6359,9 +6206,7 @@ make_lispy_switch_frame (frame)
    This doesn't use any caches.  */
 
 static int
-parse_modifiers_uncached (symbol, modifier_end)
-     Lisp_Object symbol;
-     int *modifier_end;
+parse_modifiers_uncached (Lisp_Object symbol, int *modifier_end)
 {
   Lisp_Object name;
   int i;
@@ -6471,10 +6316,7 @@ parse_modifiers_uncached (symbol, modifier_end)
    prepended to the string BASE[0..BASE_LEN-1].
    This doesn't use any caches.  */
 static Lisp_Object
-apply_modifiers_uncached (modifiers, base, base_len, base_len_byte)
-     int modifiers;
-     char *base;
-     int base_len, base_len_byte;
+apply_modifiers_uncached (int modifiers, char *base, int base_len, int base_len_byte)
 {
   /* 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
@@ -6513,8 +6355,8 @@ apply_modifiers_uncached (modifiers, base, base_len, base_len_byte)
 
     new_name = make_uninit_multibyte_string (mod_len + base_len,
                                             mod_len + base_len_byte);
-    bcopy (new_mods, SDATA (new_name),        mod_len);
-    bcopy (base,     SDATA (new_name) + mod_len, base_len_byte);
+    memcpy (SDATA (new_name), new_mods, mod_len);
+    memcpy (SDATA (new_name) + mod_len, base, base_len_byte);
 
     return Fintern (new_name, Qnil);
   }
@@ -6533,8 +6375,7 @@ static Lisp_Object modifier_symbols;
 
 /* Return the list of modifier symbols corresponding to the mask MODIFIERS.  */
 static Lisp_Object
-lispy_modifier_list (modifiers)
-     int modifiers;
+lispy_modifier_list (int modifiers)
 {
   Lisp_Object modifier_list;
   int i;
@@ -6559,8 +6400,7 @@ lispy_modifier_list (modifiers)
 #define KEY_TO_CHAR(k) (XINT (k) & ((1 << CHARACTERBITS) - 1))
 
 Lisp_Object
-parse_modifiers (symbol)
-     Lisp_Object symbol;
+parse_modifiers (Lisp_Object symbol)
 {
   Lisp_Object elements;
 
@@ -6608,8 +6448,7 @@ parse_modifiers (symbol)
 DEFUN ("internal-event-symbol-parse-modifiers", Fevent_symbol_parse_modifiers,
        Sevent_symbol_parse_modifiers, 1, 1, 0,
        doc: /* Parse the event symbol.  For internal use.  */)
-     (symbol)
-     Lisp_Object symbol;
+  (Lisp_Object symbol)
 {
   /* Fill the cache if needed.  */
   parse_modifiers (symbol);
@@ -6629,9 +6468,7 @@ DEFUN ("internal-event-symbol-parse-modifiers", Fevent_symbol_parse_modifiers,
    apply_modifiers copies the value of BASE's Qevent_kind property to
    the modified symbol.  */
 static Lisp_Object
-apply_modifiers (modifiers, base)
-     int modifiers;
-     Lisp_Object base;
+apply_modifiers (int modifiers, Lisp_Object base)
 {
   Lisp_Object cache, index, entry, new_symbol;
 
@@ -6700,8 +6537,7 @@ apply_modifiers (modifiers, base)
    and M-C-foo end up being equivalent in the keymap.  */
 
 Lisp_Object
-reorder_modifiers (symbol)
-     Lisp_Object symbol;
+reorder_modifiers (Lisp_Object symbol)
 {
   /* It's hopefully okay to write the code this way, since everything
      will soon be in caches, and no consing will be done at all.  */
@@ -6746,15 +6582,9 @@ reorder_modifiers (symbol)
    in the symbol's name.  */
 
 static Lisp_Object
-modify_event_symbol (symbol_num, modifiers, symbol_kind, name_alist_or_stem,
-                     name_table, symbol_table, table_size)
-     int symbol_num;
-     unsigned modifiers;
-     Lisp_Object symbol_kind;
-     Lisp_Object name_alist_or_stem;
-     char **name_table;
-     Lisp_Object *symbol_table;
-     unsigned int table_size;
+modify_event_symbol (int symbol_num, unsigned int modifiers, Lisp_Object symbol_kind,
+                    Lisp_Object name_alist_or_stem, const char **name_table,
+                    Lisp_Object *symbol_table, unsigned int table_size)
 {
   Lisp_Object value;
   Lisp_Object symbol_int;
@@ -6847,8 +6677,7 @@ and zero or more modifier names (control, meta, hyper, super, shift, alt,
 drag, down, double or triple).  The base must be last.
 The return value is an event type (a character or symbol) which
 has the same base event type and all the specified modifiers.  */)
-     (event_desc)
-     Lisp_Object event_desc;
+  (Lisp_Object event_desc)
 {
   Lisp_Object base;
   int modifiers = 0;
@@ -6991,8 +6820,7 @@ parse_solitary_modifier (Lisp_Object symbol)
    but it can be a Lucid-style event type list.  */
 
 int
-lucid_event_type_list_p (object)
-     Lisp_Object object;
+lucid_event_type_list_p (Lisp_Object object)
 {
   Lisp_Object tail;
 
@@ -7029,9 +6857,7 @@ lucid_event_type_list_p (object)
    movements and toolkit scroll bar thumb drags. */
 
 static void
-get_input_pending (addr, flags)
-     int *addr;
-     int flags;
+get_input_pending (int *addr, int flags)
 {
   /* First of all, have we already counted some input?  */
   *addr = (!NILP (Vquit_flag) || readable_events (flags));
@@ -7048,8 +6874,7 @@ get_input_pending (addr, flags)
 /* Interface to read_avail_input, blocking SIGIO or SIGALRM if necessary.  */
 
 void
-gobble_input (expected)
-     int expected;
+gobble_input (int expected)
 {
 #ifdef HAVE_DBUS
   /* Read D-Bus messages.  */
@@ -7086,7 +6911,7 @@ gobble_input (expected)
    so that read_key_sequence will notice the new current buffer.  */
 
 void
-record_asynch_buffer_change ()
+record_asynch_buffer_change (void)
 {
   struct input_event event;
   Lisp_Object tem;
@@ -7096,18 +6921,15 @@ record_asynch_buffer_change ()
   event.frame_or_window = Qnil;
   event.arg = Qnil;
 
-#ifdef subprocesses
   /* We don't need a buffer-switch event unless Emacs is waiting for input.
      The purpose of the event is to make read_key_sequence look up the
      keymaps again.  If we aren't in read_key_sequence, we don't need one,
-     and the event could cause trouble by messing up (input-pending-p).  */
+     and the event could cause trouble by messing up (input-pending-p).
+     Note: Fwaiting_for_user_input_p always returns nil when async
+     subprocesses aren't supported.  */
   tem = Fwaiting_for_user_input_p ();
   if (NILP (tem))
     return;
-#else
-  /* We never need these events if we have no asynchronous subprocesses.  */
-  return;
-#endif
 
   /* Make sure no interrupt happens while storing the event.  */
 #ifdef SIGIO
@@ -7136,8 +6958,7 @@ record_asynch_buffer_change ()
    this is a bad time to try to read input.  */
 
 static int
-read_avail_input (expected)
-     int expected;
+read_avail_input (int expected)
 {
   int nread = 0;
   int err = 0;
@@ -7270,6 +7091,10 @@ tty_read_avail_input (struct terminal *terminal,
   int n_to_read, i;
   struct tty_display_info *tty = terminal->display_info.tty;
   int nread = 0;
+  int buffer_free = KBD_BUFFER_SIZE - kbd_buffer_nr_stored () - 1;
+
+  if (kbd_on_hold_p () || buffer_free <= 0)
+    return 0;
 
   if (!terminal->name)         /* Don't read from a dead terminal. */
     return 0;
@@ -7351,6 +7176,10 @@ tty_read_avail_input (struct terminal *terminal,
 #endif
 #endif
 
+  /* Don't read more than we can store.  */
+  if (n_to_read > buffer_free)
+    n_to_read = buffer_free;
+
   /* Now read; for one reason or another, this will not block.
      NREAD is set to the number of chars read.  */
   do
@@ -7463,7 +7292,7 @@ tty_read_avail_input (struct terminal *terminal,
 }
 \f
 void
-handle_async_input ()
+handle_async_input (void)
 {
   interrupt_input_pending = 0;
 #ifdef SYNC_INPUT
@@ -7490,7 +7319,7 @@ handle_async_input ()
 }
 
 void
-process_pending_signals ()
+process_pending_signals (void)
 {
   if (interrupt_input_pending)
     handle_async_input ();
@@ -7501,17 +7330,10 @@ process_pending_signals ()
 /* Note SIGIO has been undef'd if FIONREAD is missing.  */
 
 static SIGTYPE
-input_available_signal (signo)
-     int signo;
+input_available_signal (int signo)
 {
   /* Must preserve main program's value of errno.  */
   int old_errno = errno;
-#if defined (USG) && !defined (POSIX_SIGNALS)
-  /* USG systems forget handlers when they are used;
-     must reestablish each time */
-  signal (signo, input_available_signal);
-#endif /* USG */
-
   SIGNAL_THREAD_CHECK (signo);
 
 #ifdef SYNC_INPUT
@@ -7537,7 +7359,7 @@ input_available_signal (signo)
    dealing with, without assuming that every file which uses
    UNBLOCK_INPUT also has #included the files necessary to get SIGIO. */
 void
-reinvoke_input_signal ()
+reinvoke_input_signal (void)
 {
 #ifdef SIGIO
   handle_async_input ();
@@ -7566,9 +7388,7 @@ struct user_signal_info
 static struct user_signal_info *user_signals = NULL;
 
 void
-add_user_signal (sig, name)
-     int sig;
-     const char *name;
+add_user_signal (int sig, const char *name)
 {
   struct user_signal_info *p;
 
@@ -7588,18 +7408,11 @@ add_user_signal (sig, name)
 }
 
 static SIGTYPE
-handle_user_signal (sig)
-     int sig;
+handle_user_signal (int sig)
 {
   int old_errno = errno;
   struct user_signal_info *p;
 
-#if defined (USG) && !defined (POSIX_SIGNALS)
-  /* USG systems forget handlers when they are used;
-     must reestablish each time */
-  signal (sig, handle_user_signal);
-#endif
-
   SIGNAL_THREAD_CHECK (sig);
 
   for (p = user_signals; p; p = p->next)
@@ -7624,8 +7437,7 @@ handle_user_signal (sig)
 }
 
 static char *
-find_user_signal_name (sig)
-     int sig;
+find_user_signal_name (int sig)
 {
   struct user_signal_info *p;
 
@@ -7637,7 +7449,7 @@ find_user_signal_name (sig)
 }
 
 static int
-store_user_signal_events ()
+store_user_signal_events (void)
 {
   struct user_signal_info *p;
   struct input_event buf;
@@ -7650,7 +7462,7 @@ store_user_signal_events ()
 
        if (nstored == 0)
          {
-           bzero (&buf, sizeof buf);
+           memset (&buf, 0, sizeof buf);
            buf.kind = USER_SIGNAL_EVENT;
            buf.frame_or_window = selected_frame;
          }
@@ -7671,7 +7483,7 @@ store_user_signal_events ()
 }
 
 \f
-static void menu_bar_item P_ ((Lisp_Object, Lisp_Object, Lisp_Object, void*));
+static void menu_bar_item (Lisp_Object, Lisp_Object, Lisp_Object, void*);
 static Lisp_Object menu_bar_one_keymap_changed_items;
 
 /* These variables hold the vector under construction within
@@ -7687,8 +7499,7 @@ static int menu_bar_items_index;
    OLD is an old vector we can optionally reuse, or nil.  */
 
 Lisp_Object
-menu_bar_items (old)
-     Lisp_Object old;
+menu_bar_items (Lisp_Object old)
 {
   /* The number of keymaps we're scanning right now, and the number of
      keymaps we have allocated space for.  */
@@ -7755,7 +7566,7 @@ menu_bar_items (old)
        nmaps = 0;
        if (tem = get_local_map (PT, current_buffer, Qkeymap), !NILP (tem))
          maps[nmaps++] = tem;
-       bcopy (tmaps, (void *) (maps + nmaps), nminor * sizeof (maps[0]));
+       memcpy (maps + nmaps, tmaps, nminor * sizeof (maps[0]));
        nmaps += nminor;
        maps[nmaps++] = get_local_map (PT, current_buffer, Qlocal_map);
       }
@@ -7796,9 +7607,9 @@ menu_bar_items (old)
            tem2 = XVECTOR (menu_bar_items_vector)->contents[i + 2];
            tem3 = XVECTOR (menu_bar_items_vector)->contents[i + 3];
            if (end > i + 4)
-             bcopy (&XVECTOR (menu_bar_items_vector)->contents[i + 4],
-                    &XVECTOR (menu_bar_items_vector)->contents[i],
-                    (end - i - 4) * sizeof (Lisp_Object));
+             memmove (&XVECTOR (menu_bar_items_vector)->contents[i],
+                      &XVECTOR (menu_bar_items_vector)->contents[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;
@@ -7828,9 +7639,7 @@ menu_bar_items (old)
 Lisp_Object item_properties;
 
 static void
-menu_bar_item (key, item, dummy1, dummy2)
-     Lisp_Object key, item, dummy1;
-     void *dummy2;
+menu_bar_item (Lisp_Object key, Lisp_Object item, Lisp_Object dummy1, void *dummy2)
 {
   struct gcpro gcpro1;
   int i;
@@ -7845,9 +7654,9 @@ menu_bar_item (key, item, dummy1, dummy2)
        if (EQ (key, XVECTOR (menu_bar_items_vector)->contents[i]))
          {
            if (menu_bar_items_index > i + 4)
-             bcopy (&XVECTOR (menu_bar_items_vector)->contents[i + 4],
-                    &XVECTOR (menu_bar_items_vector)->contents[i],
-                    (menu_bar_items_index - i - 4) * sizeof (Lisp_Object));
+             memmove (&XVECTOR (menu_bar_items_vector)->contents[i],
+                      &XVECTOR (menu_bar_items_vector)->contents[i + 4],
+                      (menu_bar_items_index - i - 4) * sizeof (Lisp_Object));
            menu_bar_items_index -= 4;
          }
     }
@@ -7905,8 +7714,7 @@ menu_bar_item (key, item, dummy1, dummy2)
 \f
  /* This is used as the handler when calling menu_item_eval_property.  */
 static Lisp_Object
-menu_item_eval_property_1 (arg)
-     Lisp_Object arg;
+menu_item_eval_property_1 (Lisp_Object arg)
 {
   /* If we got a quit from within the menu computation,
      quit all the way out of it.  This takes care of C-] in the debugger.  */
@@ -7919,8 +7727,7 @@ menu_item_eval_property_1 (arg)
 /* Evaluate an expression and return the result (or nil if something
    went wrong).  Used to evaluate dynamic parts of menu items.  */
 Lisp_Object
-menu_item_eval_property (sexpr)
-     Lisp_Object sexpr;
+menu_item_eval_property (Lisp_Object sexpr)
 {
   int count = SPECPDL_INDEX ();
   Lisp_Object val;
@@ -7940,9 +7747,7 @@ menu_item_eval_property (sexpr)
    otherwise.  */
 
 int
-parse_menu_item (item, inmenubar)
-     Lisp_Object item;
-     int inmenubar;
+parse_menu_item (Lisp_Object item, int inmenubar)
 {
   Lisp_Object def, tem, item_string, start;
   Lisp_Object filter;
@@ -8231,18 +8036,17 @@ static Lisp_Object tool_bar_item_properties;
 
 static int ntool_bar_items;
 
-/* The symbols `tool-bar', `:image' and `:rtl'.  */
+/* The symbols `:image' and `:rtl'.  */
 
-extern Lisp_Object Qtool_bar;
 Lisp_Object QCimage;
 Lisp_Object Qrtl;
 
 /* Function prototypes.  */
 
-static void init_tool_bar_items P_ ((Lisp_Object));
-static void process_tool_bar_item P_ ((Lisp_Object, Lisp_Object, Lisp_Object, void*));
-static int parse_tool_bar_item P_ ((Lisp_Object, Lisp_Object));
-static void append_tool_bar_item P_ ((void));
+static void init_tool_bar_items (Lisp_Object);
+static void process_tool_bar_item (Lisp_Object, Lisp_Object, Lisp_Object, void*);
+static int parse_tool_bar_item (Lisp_Object, Lisp_Object);
+static void append_tool_bar_item (void);
 
 
 /* Return a vector of tool bar items for keymaps currently in effect.
@@ -8250,9 +8054,7 @@ static void append_tool_bar_item P_ ((void));
    tool bar items found.  */
 
 Lisp_Object
-tool_bar_items (reuse, nitems)
-     Lisp_Object reuse;
-     int *nitems;
+tool_bar_items (Lisp_Object reuse, int *nitems)
 {
   Lisp_Object *maps;
   int nmaps, i;
@@ -8301,7 +8103,7 @@ tool_bar_items (reuse, nitems)
       nmaps = 0;
       if (tem = get_local_map (PT, current_buffer, Qkeymap), !NILP (tem))
        maps[nmaps++] = tem;
-      bcopy (tmaps, (void *) (maps + nmaps), nminor * sizeof (maps[0]));
+      memcpy (maps + nmaps, tmaps, nminor * sizeof (maps[0]));
       nmaps += nminor;
       maps[nmaps++] = get_local_map (PT, current_buffer, Qlocal_map);
     }
@@ -8330,12 +8132,9 @@ tool_bar_items (reuse, nitems)
 /* Process the definition of KEY which is DEF.  */
 
 static void
-process_tool_bar_item (key, def, data, args)
-     Lisp_Object key, def, data;
-     void *args;
+process_tool_bar_item (Lisp_Object key, Lisp_Object def, Lisp_Object data, void *args)
 {
   int i;
-  extern Lisp_Object Qundefined;
   struct gcpro gcpro1, gcpro2;
 
   /* Protect KEY and DEF from GC because parse_tool_bar_item may call
@@ -8353,9 +8152,9 @@ process_tool_bar_item (key, def, data, args)
          if (EQ (key, v[TOOL_BAR_ITEM_KEY]))
            {
              if (ntool_bar_items > i + TOOL_BAR_ITEM_NSLOTS)
-               bcopy (v + TOOL_BAR_ITEM_NSLOTS, v,
-                      ((ntool_bar_items - i - TOOL_BAR_ITEM_NSLOTS)
-                       * sizeof (Lisp_Object)));
+               memmove (v, v + TOOL_BAR_ITEM_NSLOTS,
+                        ((ntool_bar_items - i - TOOL_BAR_ITEM_NSLOTS)
+                         * sizeof (Lisp_Object)));
              ntool_bar_items -= TOOL_BAR_ITEM_NSLOTS;
              break;
            }
@@ -8410,18 +8209,21 @@ process_tool_bar_item (key, def, data, args)
 
    - `:help HELP-STRING'.
 
-   Gives a help string to display for the tool bar item.  */
+   Gives a help string to display for the tool bar item.
+
+   - `:label LABEL-STRING'.
+
+   A text label to show with the tool bar button if labels are enabled.  */
 
 static int
-parse_tool_bar_item (key, item)
-     Lisp_Object key, item;
+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]
 
   Lisp_Object filter = Qnil;
   Lisp_Object caption;
-  int i;
+  int i, have_label = 0;
 
   /* Defininition looks like `(menu-item CAPTION BINDING PROPS...)'.
      Rule out items that aren't lists, don't start with
@@ -8497,8 +8299,17 @@ parse_tool_bar_item (key, item)
            return 0;
        }
       else if (EQ (key, QChelp))
-       /* `:help HELP-STRING'.  */
-       PROP (TOOL_BAR_ITEM_HELP) = value;
+        /* `:help HELP-STRING'.  */
+        PROP (TOOL_BAR_ITEM_HELP) = value;
+      else if (EQ (key, QClabel))
+        {
+          const char *bad_label = "!!?GARBLED ITEM?!!";
+          /* `:label LABEL-STRING'.  */
+          PROP (TOOL_BAR_ITEM_HELP) = STRINGP (value)
+            ? value
+            : make_string (bad_label, strlen (bad_label));
+          have_label = 1;
+        }
       else if (EQ (key, QCfilter))
        /* ':filter FORM'.  */
        filter = value;
@@ -8526,6 +8337,51 @@ parse_tool_bar_item (key, item)
        PROP (TOOL_BAR_ITEM_RTL_IMAGE) = value;
     }
 
+
+  if (!have_label)
+    {
+      /* Try to make one from caption and key.  */
+      Lisp_Object key = PROP (TOOL_BAR_ITEM_KEY);
+      Lisp_Object capt = PROP (TOOL_BAR_ITEM_CAPTION);
+      const char *label = SYMBOLP (key) ? (char *) SDATA (SYMBOL_NAME (key)) : "";
+      const char *caption = STRINGP (capt) ? (char *) SDATA (capt) : "";
+      EMACS_INT max_lbl = 2 * tool_bar_max_label_size;
+      char *buf = (char *) xmalloc (max_lbl + 1);
+      Lisp_Object new_lbl;
+      size_t caption_len = strlen (caption);
+
+      if (caption_len <= max_lbl && caption[0] != '\0')
+        {
+          strcpy (buf, caption);
+          while (caption_len > 0 && buf[caption_len - 1] == '.')
+            caption_len--;
+         buf[caption_len] = '\0';
+         label = caption = buf;
+        }
+
+      if (strlen (label) <= max_lbl && label[0] != '\0')
+        {
+          int i;
+          if (label != buf)
+           strcpy (buf, label);
+
+          for (i = 0; buf[i] != '\0'; ++i)
+           if (buf[i] == '-')
+             buf[i] = ' ';
+          label = buf;
+
+        }
+      else
+       label = "";
+
+      new_lbl = Fupcase_initials (make_string (label, strlen (label)));
+      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);
+      free (buf);
+    }
+
   /* If got a filter apply it on binding.  */
   if (!NILP (filter))
     PROP (TOOL_BAR_ITEM_BINDING)
@@ -8557,8 +8413,7 @@ parse_tool_bar_item (key, item)
    that can be reused.  */
 
 static void
-init_tool_bar_items (reuse)
-     Lisp_Object reuse;
+init_tool_bar_items (Lisp_Object reuse)
 {
   if (VECTORP (reuse))
     tool_bar_items_vector = reuse;
@@ -8572,7 +8427,7 @@ init_tool_bar_items (reuse)
    tool_bar_item_properties */
 
 static void
-append_tool_bar_item ()
+append_tool_bar_item (void)
 {
   Lisp_Object *to, *from;
 
@@ -8587,7 +8442,7 @@ append_tool_bar_item ()
      tool_bar_items_vector.  */
   to = XVECTOR (tool_bar_items_vector)->contents + ntool_bar_items;
   from = XVECTOR (tool_bar_item_properties)->contents;
-  bcopy (from, to, TOOL_BAR_ITEM_NSLOTS * sizeof *to);
+  memcpy (to, from, TOOL_BAR_ITEM_NSLOTS * sizeof *to);
   ntool_bar_items += TOOL_BAR_ITEM_NSLOTS;
 }
 
@@ -8616,11 +8471,8 @@ append_tool_bar_item ()
    and do auto-saving in the inner call of read_char. */
 
 static Lisp_Object
-read_char_x_menu_prompt (nmaps, maps, prev_event, used_mouse_menu)
-     int nmaps;
-     Lisp_Object *maps;
-     Lisp_Object prev_event;
-     int *used_mouse_menu;
+read_char_x_menu_prompt (int nmaps, Lisp_Object *maps, Lisp_Object prev_event,
+                        int *used_mouse_menu)
 {
   int mapno;
 
@@ -8704,10 +8556,7 @@ static char *read_char_minibuf_menu_text;
 static int read_char_minibuf_menu_width;
 
 static Lisp_Object
-read_char_minibuf_menu_prompt (commandflag, nmaps, maps)
-     int commandflag ;
-     int nmaps;
-     Lisp_Object *maps;
+read_char_minibuf_menu_prompt (int commandflag, int nmaps, Lisp_Object *maps)
 {
   int mapno;
   register Lisp_Object name;
@@ -8886,7 +8735,7 @@ read_char_minibuf_menu_prompt (commandflag, nmaps, maps)
                          thiswidth = SCHARS (desc);
                          if (thiswidth + i > width)
                            thiswidth = width - i;
-                         bcopy (SDATA (desc), menu + i, thiswidth);
+                         memcpy (menu + i, SDATA (desc), thiswidth);
                          i += thiswidth;
                          strcpy (menu + i, " = ");
                          i += 3;
@@ -8896,7 +8745,7 @@ read_char_minibuf_menu_prompt (commandflag, nmaps, maps)
                      thiswidth = SCHARS (s);
                      if (thiswidth + i > width)
                        thiswidth = width - i;
-                     bcopy (SDATA (s), menu + i, thiswidth);
+                     memcpy (menu + i, SDATA (s), thiswidth);
                      i += thiswidth;
                      menu[i] = 0;
                    }
@@ -8972,10 +8821,8 @@ read_char_minibuf_menu_prompt (commandflag, nmaps, maps)
    NEXT may be the same array as CURRENT.  */
 
 static int
-follow_key (key, nmaps, current, defs, next)
-     Lisp_Object key;
-     Lisp_Object *current, *defs, *next;
-     int nmaps;
+follow_key (Lisp_Object key, int nmaps, Lisp_Object *current, Lisp_Object *defs,
+           Lisp_Object *next)
 {
   int i, first_binding;
 
@@ -9024,9 +8871,8 @@ typedef struct keyremap
    that it is indeed a vector).  */
 
 static Lisp_Object
-access_keymap_keyremap (map, key, prompt, do_funcall)
-     Lisp_Object map, key, prompt;
-     int do_funcall;
+access_keymap_keyremap (Lisp_Object map, Lisp_Object key, Lisp_Object prompt,
+                       int do_funcall)
 {
   Lisp_Object next;
 
@@ -9077,10 +8923,8 @@ access_keymap_keyremap (map, key, prompt, do_funcall)
    The return value is non-zero if the remapping actually took place.  */
 
 static int
-keyremap_step (keybuf, bufsize, fkey, input, doit, diff, prompt)
-     Lisp_Object *keybuf, prompt;
-     keyremap *fkey;
-     int input, doit, *diff, bufsize;
+keyremap_step (Lisp_Object *keybuf, int bufsize, volatile keyremap *fkey,
+              int input, int doit, int *diff, Lisp_Object prompt)
 {
   Lisp_Object next, key;
 
@@ -9172,14 +9016,9 @@ keyremap_step (keybuf, bufsize, fkey, input, doit, diff, prompt)
    from the selected window's buffer.  */
 
 static int
-read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
-                  can_return_switch_frame, fix_current_buffer)
-     Lisp_Object *keybuf;
-     int bufsize;
-     Lisp_Object prompt;
-     int dont_downcase_last;
-     int can_return_switch_frame;
-     int fix_current_buffer;
+read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
+                  int dont_downcase_last, int can_return_switch_frame,
+                  int fix_current_buffer)
 {
   Lisp_Object from_string;
   int count = SPECPDL_INDEX ();
@@ -9390,8 +9229,7 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
       if (!NILP (orig_keymap))
        submaps[nmaps++] = orig_keymap;
 
-      bcopy (maps, (void *) (submaps + nmaps),
-            nminor * sizeof (submaps[0]));
+      memcpy (submaps + nmaps, maps, nminor * sizeof (submaps[0]));
 
       nmaps += nminor;
 
@@ -10306,10 +10144,7 @@ The optional fifth argument COMMAND-LOOP, if non-nil, means
 that this key sequence is being read by something that will
 read commands one after another.  It should be nil if the caller
 will read just one key sequence.  */)
-  (prompt, continue_echo, dont_downcase_last, can_return_switch_frame,
-   command_loop)
-     Lisp_Object prompt, continue_echo, dont_downcase_last;
-     Lisp_Object can_return_switch_frame, command_loop;
+  (Lisp_Object prompt, Lisp_Object continue_echo, Lisp_Object dont_downcase_last, Lisp_Object can_return_switch_frame, Lisp_Object command_loop)
 {
   Lisp_Object keybuf[30];
   register int i;
@@ -10325,7 +10160,7 @@ will read just one key sequence.  */)
   specbind (Qinput_method_use_echo_area,
            (NILP (command_loop) ? Qt : Qnil));
 
-  bzero (keybuf, sizeof keybuf);
+  memset (keybuf, 0, sizeof keybuf);
   GCPRO1 (keybuf[0]);
   gcpro1.nvars = (sizeof keybuf/sizeof (keybuf[0]));
 
@@ -10366,10 +10201,7 @@ will read just one key sequence.  */)
 DEFUN ("read-key-sequence-vector", Fread_key_sequence_vector,
        Sread_key_sequence_vector, 1, 5, 0,
        doc: /* Like `read-key-sequence' but always return a vector.  */)
-     (prompt, continue_echo, dont_downcase_last, can_return_switch_frame,
-      command_loop)
-     Lisp_Object prompt, continue_echo, dont_downcase_last;
-     Lisp_Object can_return_switch_frame, command_loop;
+  (Lisp_Object prompt, Lisp_Object continue_echo, Lisp_Object dont_downcase_last, Lisp_Object can_return_switch_frame, Lisp_Object command_loop)
 {
   Lisp_Object keybuf[30];
   register int i;
@@ -10385,7 +10217,7 @@ DEFUN ("read-key-sequence-vector", Fread_key_sequence_vector,
   specbind (Qinput_method_use_echo_area,
            (NILP (command_loop) ? Qt : Qnil));
 
-  bzero (keybuf, sizeof keybuf);
+  memset (keybuf, 0, sizeof keybuf);
   GCPRO1 (keybuf[0]);
   gcpro1.nvars = (sizeof keybuf/sizeof (keybuf[0]));
 
@@ -10429,13 +10261,11 @@ The argument KEYS specifies the value to use instead of (this-command-keys)
 when reading the arguments; if it is nil, (this-command-keys) is used.
 The argument SPECIAL, if non-nil, means that this command is executing
 a special event, so ignore the prefix argument and don't clear it.  */)
-     (cmd, record_flag, keys, special)
-     Lisp_Object cmd, record_flag, keys, special;
+  (Lisp_Object cmd, Lisp_Object record_flag, Lisp_Object keys, Lisp_Object special)
 {
   register Lisp_Object final;
   register Lisp_Object tem;
   Lisp_Object prefixarg;
-  extern int debug_on_next_call;
 
   debug_on_next_call = 0;
 
@@ -10519,17 +10349,15 @@ 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.  */)
-     (prefixarg)
-     Lisp_Object prefixarg;
+  (Lisp_Object prefixarg)
 {
   Lisp_Object function;
-  char buf[40];
   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 wil start and cancel the hourglass,
+  /* 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
@@ -10542,31 +10370,9 @@ give to the command you invoke, if it asks for an argument.  */)
                        XVECTOR (this_command_keys)->contents);
   saved_last_point_position_buffer = last_point_position_buffer;
   saved_last_point_position = last_point_position;
-  buf[0] = 0;
   GCPRO3 (saved_keys, prefixarg, saved_last_point_position_buffer);
 
-  if (EQ (prefixarg, Qminus))
-    strcpy (buf, "- ");
-  else if (CONSP (prefixarg) && XINT (XCAR (prefixarg)) == 4)
-    strcpy (buf, "C-u ");
-  else if (CONSP (prefixarg) && INTEGERP (XCAR (prefixarg)))
-    sprintf (buf, "%ld ", (long) XINT (XCAR (prefixarg)));
-  else if (INTEGERP (prefixarg))
-    sprintf (buf, "%ld ", (long) XINT (prefixarg));
-
-  /* This isn't strictly correct if execute-extended-command
-     is bound to anything else.  Perhaps it should use
-     this_command_keys?  */
-  strcat (buf, "M-x ");
-
-  /* Prompt with buf, and then read a string, completing from and
-     restricting to the set of all defined commands.  Don't provide
-     any initial input.  Save the command read on the extended-command
-     history list. */
-  function = Fcompleting_read (build_string (buf),
-                              Vobarray, Qcommandp,
-                              Qt, Qnil, Qextended_command_history, Qnil,
-                              Qnil);
+  function = call0 (intern ("read-extended-command"));
 
 #ifdef HAVE_WINDOW_SYSTEM
   if (hstarted) start_hourglass ();
@@ -10674,7 +10480,7 @@ give to the command you invoke, if it asks for an argument.  */)
 /* Return nonzero if input events are pending.  */
 
 int
-detect_input_pending ()
+detect_input_pending (void)
 {
   if (!input_pending)
     get_input_pending (&input_pending, 0);
@@ -10686,7 +10492,7 @@ detect_input_pending ()
    pending.  */
 
 int
-detect_input_pending_ignore_squeezables ()
+detect_input_pending_ignore_squeezables (void)
 {
   if (!input_pending)
     get_input_pending (&input_pending, READABLE_EVENTS_IGNORE_SQUEEZABLES);
@@ -10697,8 +10503,7 @@ detect_input_pending_ignore_squeezables ()
 /* Return nonzero if input events are pending, and run any pending timers.  */
 
 int
-detect_input_pending_run_timers (do_display)
-     int do_display;
+detect_input_pending_run_timers (int do_display)
 {
   int old_timers_run = timers_run;
 
@@ -10729,7 +10534,7 @@ detect_input_pending_run_timers (do_display)
    So calling this function unnecessarily can't do any harm.  */
 
 void
-clear_input_pending ()
+clear_input_pending (void)
 {
   input_pending = 0;
 }
@@ -10741,7 +10546,7 @@ clear_input_pending ()
    to do in that case.  It isn't trivial.  */
 
 int
-requeued_events_pending_p ()
+requeued_events_pending_p (void)
 {
   return (!NILP (Vunread_command_events) || unread_command_char != -1);
 }
@@ -10751,7 +10556,7 @@ DEFUN ("input-pending-p", Finput_pending_p, Sinput_pending_p, 0, 0, 0,
        doc: /* Return t if command input is currently available with no wait.
 Actually, the value is nil only if we can be sure that no input is available;
 if there is a doubt, the value is t.  */)
-     ()
+  (void)
 {
   if (!NILP (Vunread_command_events) || unread_command_char != -1
       || !NILP (Vunread_post_input_method_events)
@@ -10766,7 +10571,7 @@ if there is a doubt, the value is t.  */)
 
 DEFUN ("recent-keys", Frecent_keys, Srecent_keys, 0, 0, 0,
        doc: /* Return vector of last 300 events, not counting those from keyboard macros.  */)
-     ()
+  (void)
 {
   Lisp_Object *keys = XVECTOR (recent_keys)->contents;
   Lisp_Object val;
@@ -10776,12 +10581,10 @@ DEFUN ("recent-keys", Frecent_keys, Srecent_keys, 0, 0, 0,
   else
     {
       val = Fvector (NUM_RECENT_KEYS, keys);
-      bcopy (keys + recent_keys_index,
-            XVECTOR (val)->contents,
-            (NUM_RECENT_KEYS - recent_keys_index) * sizeof (Lisp_Object));
-      bcopy (keys,
-            XVECTOR (val)->contents + NUM_RECENT_KEYS - recent_keys_index,
-            recent_keys_index * sizeof (Lisp_Object));
+      memcpy (XVECTOR (val)->contents, keys + recent_keys_index,
+             (NUM_RECENT_KEYS - recent_keys_index) * sizeof (Lisp_Object));
+      memcpy (XVECTOR (val)->contents + NUM_RECENT_KEYS - recent_keys_index,
+             keys, recent_keys_index * sizeof (Lisp_Object));
       return val;
     }
 }
@@ -10793,7 +10596,7 @@ the last key sequence that has been read.
 The value is a string or a vector.
 
 See also `this-command-keys-vector'.  */)
-     ()
+  (void)
 {
   return make_event_array (this_command_key_count,
                           XVECTOR (this_command_keys)->contents);
@@ -10805,7 +10608,7 @@ However, if the command has called `read-key-sequence', it returns
 the last key sequence that has been read.
 
 See also `this-command-keys'.  */)
-     ()
+  (void)
 {
   return Fvector (this_command_key_count,
                  XVECTOR (this_command_keys)->contents);
@@ -10819,7 +10622,7 @@ the command loop or by `read-key-sequence'.
 Unlike `this-command-keys', this function's value
 does not include prefix arguments.
 The value is always a vector.  */)
-     ()
+  (void)
 {
   return Fvector (this_command_key_count
                  - this_single_command_key_start,
@@ -10835,7 +10638,7 @@ the command loop or by `read-key-sequence'.
 Unlike `this-single-command-keys', this function's value
 shows the events before all translations (except for input methods).
 The value is always a vector.  */)
-     ()
+  (void)
 {
   return Fvector (raw_keybuf_count,
                  (XVECTOR (raw_keybuf)->contents));
@@ -10853,7 +10656,7 @@ both in the value of (this-command-keys) and in echoing.
 To achieve this, `universal-argument-other-key' calls
 `reset-this-command-lengths', which discards the record of reading
 these events the first time.  */)
-     ()
+  (void)
 {
   this_command_key_count = before_command_key_count;
   if (this_command_key_count < this_single_command_key_start)
@@ -10873,8 +10676,7 @@ DEFUN ("clear-this-command-keys", Fclear_this_command_keys,
        doc: /* Clear out the vector that `this-command-keys' returns.
 Also clear the record of the last 100 events, unless optional arg
 KEEP-RECORD is non-nil.  */)
-     (keep_record)
-     Lisp_Object keep_record;
+  (Lisp_Object keep_record)
 {
   int i;
 
@@ -10893,7 +10695,7 @@ KEEP-RECORD is non-nil.  */)
 
 DEFUN ("recursion-depth", Frecursion_depth, Srecursion_depth, 0, 0, 0,
        doc: /* Return the current depth in recursive edits.  */)
-     ()
+  (void)
 {
   Lisp_Object temp;
   XSETFASTINT (temp, command_loop_level + minibuf_level);
@@ -10904,8 +10706,7 @@ DEFUN ("open-dribble-file", Fopen_dribble_file, Sopen_dribble_file, 1, 1,
        "FOpen dribble file: ",
        doc: /* Start writing all keyboard characters to a dribble file called FILE.
 If FILE is nil, close any open dribble file.  */)
-     (file)
-     Lisp_Object file;
+  (Lisp_Object file)
 {
   if (dribble)
     {
@@ -10927,7 +10728,7 @@ If FILE is nil, close any open dribble file.  */)
 DEFUN ("discard-input", Fdiscard_input, Sdiscard_input, 0, 0, 0,
        doc: /* Discard the contents of the terminal input buffer.
 Also end any kbd macro being defined.  */)
-     ()
+  (void)
 {
   if (!NILP (current_kboard->defining_kbd_macro))
     {
@@ -10962,8 +10763,7 @@ After resumption run the normal hook `suspend-resume-hook'.
 
 Some operating systems cannot stop the Emacs process and resume it later.
 On such systems, Emacs starts a subshell instead of suspending.  */)
-     (stuffstring)
-     Lisp_Object stuffstring;
+  (Lisp_Object stuffstring)
 {
   int count = SPECPDL_INDEX ();
   int old_height, old_width;
@@ -10985,7 +10785,7 @@ On such systems, Emacs starts a subshell instead of suspending.  */)
   reset_all_sys_modes ();
   /* sys_suspend can get an error if it tries to fork a subshell
      and the system resources aren't available for that.  */
-  record_unwind_protect ((Lisp_Object (*) P_ ((Lisp_Object))) init_all_sys_modes,
+  record_unwind_protect ((Lisp_Object (*) (Lisp_Object)) init_all_sys_modes,
                         Qnil);
   stuff_buffered_input (stuffstring);
   if (cannot_suspend)
@@ -11013,8 +10813,7 @@ On such systems, Emacs starts a subshell instead of suspending.  */)
    Then in any case stuff anything Emacs has read ahead and not used.  */
 
 void
-stuff_buffered_input (stuffstring)
-     Lisp_Object stuffstring;
+stuff_buffered_input (Lisp_Object stuffstring)
 {
 #ifdef SIGTSTP  /* stuff_char is defined if SIGTSTP.  */
   register unsigned char *p;
@@ -11052,8 +10851,7 @@ stuff_buffered_input (stuffstring)
 }
 \f
 void
-set_waiting_for_input (time_to_clear)
-     EMACS_TIME *time_to_clear;
+set_waiting_for_input (struct timeval *time_to_clear)
 {
   input_available_clear_time = time_to_clear;
 
@@ -11067,7 +10865,7 @@ set_waiting_for_input (time_to_clear)
 }
 
 void
-clear_waiting_for_input ()
+clear_waiting_for_input (void)
 {
   /* Tell handle_interrupt not to throw back to read_char,  */
   waiting_for_input = 0;
@@ -11081,20 +10879,13 @@ clear_waiting_for_input ()
    Otherwise, the handler kills Emacs.  */
 
 static SIGTYPE
-interrupt_signal (signalnum)   /* If we don't have an argument, */
-     int signalnum;            /* some compilers complain in signal calls. */
+interrupt_signal (int signalnum)       /* If we don't have an argument, some */
+                                       /* compilers complain in signal calls. */
 {
   /* Must preserve main program's value of errno.  */
   int old_errno = errno;
   struct terminal *terminal;
 
-#if defined (USG) && !defined (POSIX_SIGNALS)
-  /* USG systems forget handlers when they are used;
-     must reestablish each time */
-  signal (SIGINT, interrupt_signal);
-  signal (SIGQUIT, interrupt_signal);
-#endif /* USG */
-
   SIGNAL_THREAD_CHECK (signalnum);
 
   /* See if we have an active terminal on our controlling tty. */
@@ -11133,7 +10924,7 @@ interrupt_signal (signalnum)    /* If we don't have an argument, */
    non-nil, it stops the job right away. */
 
 static void
-handle_interrupt ()
+handle_interrupt (void)
 {
   char c;
 
@@ -11234,6 +11025,7 @@ handle_interrupt ()
          GCPRO4 (saved.object, saved.global_code,
                  saved.current_syntax_table, saved.old_prop);
          Fsignal (Qquit, Qnil);
+         /* FIXME: AFAIK, `quit' can never return, so this code is dead!  */
          gl_state = saved;
          UNGCPRO;
        }
@@ -11258,7 +11050,7 @@ handle_interrupt ()
 /* Handle a C-g by making read_char return C-g.  */
 
 void
-quit_throw_to_read_char ()
+quit_throw_to_read_char (void)
 {
   sigfree ();
   /* Prevent another signal from doing this before we finish.  */
@@ -11291,8 +11083,7 @@ If INTERRUPT is non-nil, Emacs will use input interrupts;
 otherwise Emacs uses CBREAK mode.
 
 See also `current-input-mode'.  */)
-     (interrupt)
-     Lisp_Object interrupt;
+  (Lisp_Object interrupt)
 {
   int new_interrupt_input;
 #ifdef SIGIO
@@ -11302,11 +11093,7 @@ See also `current-input-mode'.  */)
     {
       /* When using X, don't give the user a real choice,
         because we haven't implemented the mechanisms to support it.  */
-#ifdef NO_SOCK_SIGIO
-      new_interrupt_input = 0;
-#else /* not NO_SOCK_SIGIO */
       new_interrupt_input = 1;
-#endif /* NO_SOCK_SIGIO */
     }
   else
 #endif /* HAVE_X_WINDOWS */
@@ -11346,8 +11133,7 @@ This setting only has an effect on tty terminals and only when
 Emacs reads input in CBREAK mode; see `set-input-interrupt-mode'.
 
 See also `current-input-mode'.  */)
-       (flow, terminal)
-       Lisp_Object flow, terminal;
+  (Lisp_Object flow, Lisp_Object terminal)
 {
   struct terminal *t = get_terminal (terminal, 1);
   struct tty_display_info *tty;
@@ -11389,8 +11175,7 @@ It may be a terminal object, a frame, or nil for the terminal used by
 the currently selected frame.
 
 See also `current-input-mode'.  */)
-       (meta, terminal)
-       Lisp_Object meta, terminal;
+  (Lisp_Object meta, Lisp_Object terminal)
 {
   struct terminal *t = get_terminal (terminal, 1);
   struct tty_display_info *tty;
@@ -11431,8 +11216,7 @@ This function only has an effect on the controlling tty of the Emacs
 process.
 
 See also `current-input-mode'.  */)
-       (quit)
-       Lisp_Object quit;
+  (Lisp_Object quit)
 {
   struct terminal *t = get_named_tty ("/dev/tty");
   struct tty_display_info *tty;
@@ -11469,8 +11253,7 @@ Third arg META t means accept 8-bit input (for a Meta key).
  Otherwise, accept 8-bit input and don't use the top bit for Meta.
 Optional fourth arg QUIT if non-nil specifies character to use for quitting.
 See also `current-input-mode'.  */)
-     (interrupt, flow, meta, quit)
-     Lisp_Object interrupt, flow, meta, quit;
+  (Lisp_Object interrupt, Lisp_Object flow, Lisp_Object meta, Lisp_Object quit)
 {
   Fset_input_interrupt_mode (interrupt);
   Fset_output_flow_control (flow, Qnil);
@@ -11494,7 +11277,7 @@ The value is a list of the form (INTERRUPT FLOW META QUIT), where
   QUIT is the character Emacs currently uses to quit.
 The elements of this list correspond to the arguments of
 `set-input-mode'.  */)
-     ()
+  (void)
 {
   Lisp_Object val[4];
   struct frame *sf = XFRAME (selected_frame);
@@ -11528,8 +11311,7 @@ The return value is similar to a mouse click position:
    (WINDOW AREA-OR-POS (X . Y) TIMESTAMP OBJECT POS (COL . ROW)
     IMAGE (DX . DY) (WIDTH . HEIGHT))
 The `posn-' functions access elements of such lists.  */)
-  (x, y, frame_or_window, whole)
-     Lisp_Object x, y, frame_or_window, whole;
+  (Lisp_Object x, Lisp_Object y, Lisp_Object frame_or_window, Lisp_Object whole)
 {
   CHECK_NATNUM (x);
   CHECK_NATNUM (y);
@@ -11569,8 +11351,7 @@ to the given buffer position:
    (WINDOW AREA-OR-POS (X . Y) TIMESTAMP OBJECT POS (COL . ROW)
     IMAGE (DX . DY) (WIDTH . HEIGHT))
 The `posn-' functions access elements of such lists.  */)
-  (pos, window)
-     Lisp_Object pos, window;
+  (Lisp_Object pos, Lisp_Object window)
 {
   Lisp_Object tem;
 
@@ -11597,8 +11378,7 @@ The `posn-' functions access elements of such lists.  */)
  * Set up a new kboard object with reasonable initial values.
  */
 void
-init_kboard (kb)
-     KBOARD *kb;
+init_kboard (KBOARD *kb)
 {
   kb->Voverriding_terminal_local_map = Qnil;
   kb->Vlast_command = Qnil;
@@ -11632,8 +11412,7 @@ init_kboard (kb)
  * it a second time.
  */
 static void
-wipe_kboard (kb)
-     KBOARD *kb;
+wipe_kboard (KBOARD *kb)
 {
   xfree (kb->kbd_macro_buffer);
 }
@@ -11641,8 +11420,7 @@ wipe_kboard (kb)
 /* Free KB and memory referenced from it.  */
 
 void
-delete_kboard (kb)
-     KBOARD *kb;
+delete_kboard (KBOARD *kb)
 {
   KBOARD **kbp;
 
@@ -11667,7 +11445,7 @@ delete_kboard (kb)
 }
 
 void
-init_keyboard ()
+init_keyboard (void)
 {
   /* This is correct before outermost invocation of the editor loop */
   command_loop_level = -1;
@@ -11712,11 +11490,11 @@ init_keyboard ()
          Emacs on SIGINT when there are no termcap frames on the
          controlling terminal. */
       signal (SIGINT, interrupt_signal);
-#if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS)
+#ifndef DOS_NT
       /* For systems with SysV TERMIO, C-g is set up for both SIGINT and
         SIGQUIT and we can't tell which one it will give us.  */
       signal (SIGQUIT, interrupt_signal);
-#endif /* HAVE_TERMIO */
+#endif /* not DOS_NT */
     }
 /* Note SIGIO has been undef'd if FIONREAD is missing.  */
 #ifdef SIGIO
@@ -11750,11 +11528,11 @@ init_keyboard ()
    event header symbols and put properties on them.  */
 struct event_head {
   Lisp_Object *var;
-  char *name;
+  const char *name;
   Lisp_Object *kind;
 };
 
-struct event_head head_table[] = {
+static const struct event_head head_table[] = {
   {&Qmouse_movement,      "mouse-movement",      &Qmouse_movement},
   {&Qscroll_bar_movement, "scroll-bar-movement", &Qmouse_movement},
   {&Qswitch_frame,        "switch-frame",        &Qswitch_frame},
@@ -11767,7 +11545,7 @@ struct event_head head_table[] = {
 };
 
 void
-syms_of_keyboard ()
+syms_of_keyboard (void)
 {
   pending_funcalls = Qnil;
   staticpro (&pending_funcalls);
@@ -11871,6 +11649,8 @@ syms_of_keyboard ()
   staticpro (&QCtoggle);
   QCradio = intern_c_string (":radio");
   staticpro (&QCradio);
+  QClabel = intern_c_string (":label");
+  staticpro (&QClabel);
 
   Qmode_line = intern_c_string ("mode-line");
   staticpro (&Qmode_line);
@@ -11925,6 +11705,13 @@ syms_of_keyboard ()
   Qinput_method_function = intern_c_string ("input-method-function");
   staticpro (&Qinput_method_function);
 
+  Qx_set_selection = intern_c_string ("x-set-selection");
+  staticpro (&Qx_set_selection);
+  QPRIMARY = intern_c_string ("PRIMARY");
+  staticpro (&QPRIMARY);
+  Qhandle_switch_frame = intern_c_string ("handle-switch-frame");
+  staticpro (&Qhandle_switch_frame);
+
   Qinput_method_exit_on_first_char = intern_c_string ("input-method-exit-on-first-char");
   staticpro (&Qinput_method_exit_on_first_char);
   Qinput_method_use_echo_area = intern_c_string ("input-method-use-echo-area");
@@ -11937,7 +11724,7 @@ syms_of_keyboard ()
   last_point_position_window = Qnil;
 
   {
-    struct event_head *p;
+    const struct event_head *p;
 
     for (p = head_table;
         p < head_table + (sizeof (head_table) / sizeof (head_table[0]));
@@ -12532,6 +12319,23 @@ Help functions bind this to allow help on disabled menu items
 and tool-bar buttons.  */);
   Venable_disabled_menus_and_buttons = Qnil;
 
+  DEFVAR_LISP ("select-active-regions",
+              &Vselect_active_regions,
+              doc: /* If non-nil, an active region automatically becomes the window selection.
+If the value is `only', only temporarily active regions (usually made
+by mouse-dragging or shift-selection) set the window selection.
+
+This takes effect only when Transient Mark mode is enabled.  */);
+  Vselect_active_regions = Qt;
+
+  DEFVAR_LISP ("saved-region-selection",
+              &Vsaved_region_selection,
+              doc: /* Contents of active region prior to buffer modification.
+If `select-active-regions' is non-nil, Emacs sets this to the
+text in the region before modifying the buffer.  The next
+`deactivate-mark' call uses this to set the window selection.  */);
+  Vsaved_region_selection = Qnil;
+
   /* Create the initial keyboard. */
   initial_kboard = (KBOARD *) xmalloc (sizeof (KBOARD));
   init_kboard (initial_kboard);
@@ -12541,7 +12345,7 @@ and tool-bar buttons.  */);
 }
 
 void
-keys_of_keyboard ()
+keys_of_keyboard (void)
 {
   initial_define_key (global_map, Ctl ('Z'), "suspend-emacs");
   initial_define_key (control_x_map, Ctl ('Z'), "suspend-emacs");
@@ -12601,7 +12405,7 @@ keys_of_keyboard ()
 /* Mark the pointers in the kboard objects.
    Called by the Fgarbage_collector.  */
 void
-mark_kboards ()
+mark_kboards (void)
 {
   KBOARD *kb;
   Lisp_Object *p;
index 27fc0e5eb6a7c655b26d447537d920ee03dd5552..a3bb46f4454c5bfb275834594d1e5e421c7c6a46 100644 (file)
@@ -300,7 +300,7 @@ enum menu_item_idx
   MENU_ITEMS_ITEM_LENGTH
 };
 
-extern Lisp_Object unuse_menu_items P_ ((Lisp_Object dummy));
+extern Lisp_Object unuse_menu_items (Lisp_Object dummy);
 
 /* This is how to deal with multibyte text if HAVE_MULTILINGUAL_MENU
    isn't defined.  The use of HAVE_MULTILINGUAL_MENU could probably be
@@ -318,10 +318,7 @@ extern Lisp_Object unuse_menu_items P_ ((Lisp_Object dummy));
 #define ENCODE_MENU_STRING(str) (str)
 #endif
 
-#if defined (HAVE_NS) || defined (HAVE_NTGUI)
-
-typedef void * XtPointer;
-typedef unsigned char Boolean;
+#if defined (HAVE_NS) || defined (HAVE_NTGUI) || defined (USE_GTK)
 
 /* Definitions copied from lwlib.h */
 
@@ -338,36 +335,37 @@ typedef struct _widget_value
 {
   /* name of widget */
   Lisp_Object   lname;
-  char*                name;
+  const char*  name;
   /* value (meaning depend on widget type) */
-  char*                value;
+  const char*  value;
   /* keyboard equivalent. no implications for XtTranslations */
   Lisp_Object   lkey;
-  char*                key;
+  const char*  key;
   /* Help string or nil if none.
      GC finds this string through the frame's menu_bar_vector
      or through menu_items.  */
   Lisp_Object  help;
   /* true if enabled */
-  Boolean      enabled;
+  unsigned char        enabled;
   /* true if selected */
-  Boolean      selected;
+  unsigned char selected;
   /* The type of a button.  */
   enum button_type button_type;
 #if defined (HAVE_NTGUI)
   /* true if menu title */
-  Boolean       title;
+  unsigned char title;
 #endif
   /* Contents of the sub-widgets, also selected slot for checkbox */
   struct _widget_value*        contents;
   /* data passed to callback */
-  XtPointer    call_data;
+  void *call_data;
   /* next one in the list */
   struct _widget_value*        next;
+#ifdef USE_GTK
+  struct _widget_value *free_list;
+#endif
 } widget_value;
 
-extern widget_value *xmalloc_widget_value P_ ((void));
-extern widget_value *digest_single_submenu P_ ((int, int, int));
 #endif /* HAVE_NS || HAVE_NTGUI */
 
 \f
@@ -406,6 +404,8 @@ extern widget_value *digest_single_submenu P_ ((int, int, int));
 #define POSN_INBUFFER_P(posn) (NILP (POSN_STRING (posn)))
 #define POSN_BUFFER_POSN(posn) (Fnth (make_number (5), (posn)))
 
+extern Lisp_Object do_mouse_tracking;
+
 /* Some of the event heads.  */
 extern Lisp_Object Qswitch_frame;
 
@@ -420,6 +420,8 @@ extern Lisp_Object Qevent_kind, Qevent_symbol_elements;
 extern Lisp_Object Qfunction_key, Qmouse_click, Qmouse_movement;
 extern Lisp_Object Qscroll_bar_movement;
 
+extern Lisp_Object Qhelp_echo;
+
 /* Getting the kind of an event head.  */
 #define EVENT_HEAD_KIND(event_head) \
   (Fget ((event_head), Qevent_kind))
@@ -427,13 +429,27 @@ extern Lisp_Object Qscroll_bar_movement;
 /* Symbols to use for non-text mouse positions.  */
 extern Lisp_Object Qmode_line, Qvertical_line, Qheader_line;
 
+/* True while doing kbd input.  */
+extern int waiting_for_input;
+
+/* Address (if not 0) of EMACS_TIME to zero out if a SIGIO interrupt
+   happens.  */
+extern EMACS_TIME *input_available_clear_time;
+
+extern int ignore_mouse_drag_p;
+
+extern Lisp_Object Vdouble_click_time;
+
+/* The primary selection.  */
+extern Lisp_Object QPRIMARY;
+
 /* Forward declaration for prototypes.  */
 struct input_event;
 
-extern Lisp_Object parse_modifiers P_ ((Lisp_Object));
-extern Lisp_Object reorder_modifiers P_ ((Lisp_Object));
-extern Lisp_Object read_char P_ ((int, int, Lisp_Object *, Lisp_Object,
-                                 int *, EMACS_TIME *));
+extern Lisp_Object parse_modifiers (Lisp_Object);
+extern Lisp_Object reorder_modifiers (Lisp_Object);
+extern Lisp_Object read_char (int, int, Lisp_Object *, Lisp_Object,
+                              int *, EMACS_TIME *);
 extern int parse_solitary_modifier (Lisp_Object symbol);
 
 
@@ -443,52 +459,80 @@ extern Lisp_Object Vfunction_key_map;
 /* Keymap of key translations that can override keymaps.  */
 extern Lisp_Object Vkey_translation_map;
 
+/* This is like Vthis_command, except that commands never set it.  */
+extern Lisp_Object real_this_command;
+
+/* If the lookup of the command returns a binding, the original
+   command is stored in this-original-command.  It is nil otherwise.  */
+extern Lisp_Object Vthis_original_command;
+
+/* Non-nil disable property on a command means
+   do not execute it; call disabled-command-function's value instead.  */
+extern Lisp_Object QCbutton, QCtoggle, QCradio, QClabel;
+
+/* A mask of extra modifier bits to put into every keyboard char.  */
+extern EMACS_INT extra_keyboard_modifiers;
+
+/* If non-nil, this implements the current input method.  */
+extern Lisp_Object Vinput_method_function;
+extern Lisp_Object Qinput_method_function;
+
+/* An event header symbol HEAD may have a property named
+   Qevent_symbol_element_mask, which is of the form (BASE MODIFIERS);
+   BASE is the base, unmodified version of HEAD, and MODIFIERS is the
+   mask of modifiers applied to it.  If present, this is used to help
+   speed up parse_modifiers.  */
+extern Lisp_Object Qevent_symbol_element_mask;
+
+/* The timestamp of the last input event we received from the X server.
+   X Windows wants this for selection ownership.  */
+extern unsigned long last_event_timestamp;
+
+extern int quit_char;
+
 extern int parse_menu_item (Lisp_Object, int);
 
-extern void echo_now P_ ((void));
-extern void init_kboard P_ ((KBOARD *));
-extern void delete_kboard P_ ((KBOARD *));
-extern void not_single_kboard_state P_ ((KBOARD *));
-extern void push_kboard P_ ((struct kboard *));
-extern void push_frame_kboard P_ ((struct frame *));
-extern void pop_kboard P_ ((void));
-extern void temporarily_switch_to_single_kboard P_ ((struct frame *));
-extern void record_asynch_buffer_change P_ ((void));
-extern SIGTYPE input_poll_signal P_ ((int));
-extern void start_polling P_ ((void));
-extern void stop_polling P_ ((void));
-extern void set_poll_suppress_count P_ ((int));
-extern void gobble_input P_ ((int));
-extern int input_polling_used P_ ((void));
-extern void clear_input_pending P_ ((void));
-extern int requeued_events_pending_p P_ ((void));
-extern void bind_polling_period P_ ((int));
-extern void stuff_buffered_input P_ ((Lisp_Object));
-extern void clear_waiting_for_input P_ ((void));
-extern void swallow_events P_ ((int));
-extern int help_char_p P_ ((Lisp_Object));
-extern void quit_throw_to_read_char P_ ((void)) NO_RETURN;
-extern void cmd_error_internal P_ ((Lisp_Object, char *));
-extern int lucid_event_type_list_p P_ ((Lisp_Object));
-extern void kbd_buffer_store_event P_ ((struct input_event *));
-extern void kbd_buffer_store_event_hold P_ ((struct input_event *,
-                                            struct input_event *));
-extern void kbd_buffer_unget_event P_ ((struct input_event *));
-#ifdef POLL_FOR_INPUT
-extern void poll_for_input_1 P_ ((void));
-#endif
-extern void show_help_echo P_ ((Lisp_Object, Lisp_Object, Lisp_Object,
-                               Lisp_Object, int));
-extern void gen_help_event P_ ((Lisp_Object, Lisp_Object, Lisp_Object,
-                              Lisp_Object, int));
-extern void kbd_buffer_store_help_event P_ ((Lisp_Object, Lisp_Object));
-extern Lisp_Object menu_item_eval_property P_ ((Lisp_Object));
-extern int  kbd_buffer_events_waiting P_ ((int));
-extern void add_user_signal P_ ((int, const char *));
-
-extern int tty_read_avail_input P_ ((struct terminal *, int,
-                                     struct input_event *));
-extern EMACS_TIME timer_check P_ ((int));
+extern void echo_now (void);
+extern void init_kboard (KBOARD *);
+extern void delete_kboard (KBOARD *);
+extern void not_single_kboard_state (KBOARD *);
+extern void push_kboard (struct kboard *);
+extern void push_frame_kboard (struct frame *);
+extern void pop_kboard (void);
+extern void temporarily_switch_to_single_kboard (struct frame *);
+extern void record_asynch_buffer_change (void);
+extern SIGTYPE input_poll_signal (int);
+extern void start_polling (void);
+extern void stop_polling (void);
+extern void set_poll_suppress_count (int);
+extern void gobble_input (int);
+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 void stuff_buffered_input (Lisp_Object);
+extern void clear_waiting_for_input (void);
+extern void swallow_events (int);
+extern int help_char_p (Lisp_Object);
+extern void quit_throw_to_read_char (void) NO_RETURN;
+extern int lucid_event_type_list_p (Lisp_Object);
+extern void kbd_buffer_store_event (struct input_event *);
+extern void kbd_buffer_store_event_hold (struct input_event *,
+                                         struct input_event *);
+extern void kbd_buffer_unget_event (struct input_event *);
+extern void poll_for_input_1 (void);
+extern void show_help_echo (Lisp_Object, Lisp_Object, Lisp_Object,
+                            Lisp_Object, int);
+extern void gen_help_event (Lisp_Object, Lisp_Object, Lisp_Object,
+                            Lisp_Object, int);
+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);
+extern void add_user_signal (int, const char *);
+
+extern int tty_read_avail_input (struct terminal *, int,
+                                 struct input_event *);
+extern EMACS_TIME timer_check (int);
 
 /* arch-tag: 769cbade-1ba9-4950-b886-db265b061aa3
    (do not change this comment) */
index b5efd12cd6e80feed180bab0ece7937be306865a..cc25d350d44004b34ede6742bf20a102d9cc9c17 100644 (file)
@@ -22,9 +22,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <config.h>
 #include <stdio.h>
 #include <setjmp.h>
-#if HAVE_ALLOCA_H
-# include <alloca.h>
-#endif
 #include "lisp.h"
 #include "commands.h"
 #include "buffer.h"
@@ -106,32 +103,25 @@ static Lisp_Object exclude_keys;
 /* Pre-allocated 2-element vector for Fcommand_remapping to use.  */
 static Lisp_Object command_remapping_vector;
 
-/* A char with the CHAR_META bit set in a vector or the 0200 bit set
-   in a string key sequence is equivalent to prefixing with this
-   character.  */
-extern Lisp_Object meta_prefix_char;
-
-extern Lisp_Object Voverriding_local_map;
-
 /* Hash table used to cache a reverse-map to speed up calls to where-is.  */
 static Lisp_Object where_is_cache;
 /* Which keymaps are reverse-stored in the cache.  */
 static Lisp_Object where_is_cache_keymaps;
 
-static Lisp_Object store_in_keymap P_ ((Lisp_Object, Lisp_Object, Lisp_Object));
-static void fix_submap_inheritance P_ ((Lisp_Object, Lisp_Object, Lisp_Object));
-
-static Lisp_Object define_as_prefix P_ ((Lisp_Object, Lisp_Object));
-static void describe_command P_ ((Lisp_Object, Lisp_Object));
-static void describe_translation P_ ((Lisp_Object, Lisp_Object));
-static void describe_map P_ ((Lisp_Object, Lisp_Object,
-                             void (*) P_ ((Lisp_Object, Lisp_Object)),
-                             int, Lisp_Object, Lisp_Object*, int, int));
-static void describe_vector P_ ((Lisp_Object, Lisp_Object, Lisp_Object,
-                                void (*) (Lisp_Object, Lisp_Object), int,
-                                Lisp_Object, Lisp_Object, int *,
-                                int, int, int));
-static void silly_event_symbol_error P_ ((Lisp_Object));
+static Lisp_Object store_in_keymap (Lisp_Object, Lisp_Object, Lisp_Object);
+static void fix_submap_inheritance (Lisp_Object, Lisp_Object, Lisp_Object);
+
+static Lisp_Object define_as_prefix (Lisp_Object, Lisp_Object);
+static void describe_command (Lisp_Object, Lisp_Object);
+static void describe_translation (Lisp_Object, Lisp_Object);
+static void describe_map (Lisp_Object, Lisp_Object,
+                          void (*) (Lisp_Object, Lisp_Object),
+                         int, Lisp_Object, Lisp_Object*, int, int);
+static void describe_vector (Lisp_Object, Lisp_Object, Lisp_Object,
+                             void (*) (Lisp_Object, Lisp_Object), int,
+                             Lisp_Object, Lisp_Object, int *,
+                             int, int, int);
+static void silly_event_symbol_error (Lisp_Object);
 \f
 /* Keymap object support - constructors and predicates.                        */
 
@@ -145,8 +135,7 @@ input stream.  Initially, ALIST is nil.
 
 The optional arg STRING supplies a menu name for the keymap
 in case you use it as a menu with `x-popup-menu'.  */)
-     (string)
-     Lisp_Object string;
+  (Lisp_Object string)
 {
   Lisp_Object tail;
   if (!NILP (string))
@@ -166,8 +155,7 @@ Initially the alist is nil.
 
 The optional arg STRING supplies a menu name for the keymap
 in case you use it as a menu with `x-popup-menu'.  */)
-     (string)
-     Lisp_Object string;
+  (Lisp_Object string)
 {
   if (!NILP (string))
     {
@@ -186,19 +174,13 @@ in case you use it as a menu with `x-popup-menu'.  */)
    initial_define_key (control_x_map, Ctl('X'), "exchange-point-and-mark");  */
 
 void
-initial_define_key (keymap, key, defname)
-     Lisp_Object keymap;
-     int key;
-     char *defname;
+initial_define_key (Lisp_Object keymap, int key, const char *defname)
 {
   store_in_keymap (keymap, make_number (key), intern_c_string (defname));
 }
 
 void
-initial_define_lispy_key (keymap, keyname, defname)
-     Lisp_Object keymap;
-     char *keyname;
-     char *defname;
+initial_define_lispy_key (Lisp_Object keymap, const char *keyname, const char *defname)
 {
   store_in_keymap (keymap, intern_c_string (keyname), intern_c_string (defname));
 }
@@ -211,8 +193,7 @@ or a symbol whose function definition is itself a keymap.
 ALIST elements look like (CHAR . DEFN) or (SYMBOL . DEFN);
 a vector of densely packed bindings for small character codes
 is also allowed as an element.  */)
-     (object)
-     Lisp_Object object;
+  (Lisp_Object object)
 {
   return (KEYMAPP (object) ? Qt : Qnil);
 }
@@ -221,8 +202,7 @@ DEFUN ("keymap-prompt", Fkeymap_prompt, Skeymap_prompt, 1, 1, 0,
        doc: /* Return the prompt-string of a keymap MAP.
 If non-nil, the prompt is shown in the echo-area
 when reading a key-sequence to be looked-up in this keymap.  */)
-     (map)
-     Lisp_Object map;
+  (Lisp_Object map)
 {
   map = get_keymap (map, 0, 0);
   while (CONSP (map))
@@ -258,9 +238,7 @@ when reading a key-sequence to be looked-up in this keymap.  */)
    do_autoload which can GC.  */
 
 Lisp_Object
-get_keymap (object, error, autoload)
-     Lisp_Object object;
-     int error, autoload;
+get_keymap (Lisp_Object object, int error, int autoload)
 {
   Lisp_Object tem;
 
@@ -312,9 +290,7 @@ get_keymap (object, error, autoload)
    We assume that KEYMAP is a valid keymap.  */
 
 Lisp_Object
-keymap_parent (keymap, autoload)
-     Lisp_Object keymap;
-     int autoload;
+keymap_parent (Lisp_Object keymap, int autoload)
 {
   Lisp_Object list;
 
@@ -335,16 +311,14 @@ keymap_parent (keymap, autoload)
 DEFUN ("keymap-parent", Fkeymap_parent, Skeymap_parent, 1, 1, 0,
        doc: /* Return the parent keymap of KEYMAP.
 If KEYMAP has no parent, return nil.  */)
-     (keymap)
-     Lisp_Object keymap;
+  (Lisp_Object keymap)
 {
   return keymap_parent (keymap, 1);
 }
 
 /* Check whether MAP is one of MAPS parents.  */
 int
-keymap_memberp (map, maps)
-     Lisp_Object map, maps;
+keymap_memberp (Lisp_Object map, Lisp_Object maps)
 {
   if (NILP (map)) return 0;
   while (KEYMAPP (maps) && !EQ (map, maps))
@@ -357,8 +331,7 @@ keymap_memberp (map, maps)
 DEFUN ("set-keymap-parent", Fset_keymap_parent, Sset_keymap_parent, 2, 2, 0,
        doc: /* Modify KEYMAP to set its parent map to PARENT.
 Return PARENT.  PARENT should be nil or another keymap.  */)
-     (keymap, parent)
-     Lisp_Object keymap, parent;
+  (Lisp_Object keymap, Lisp_Object parent)
 {
   Lisp_Object list, prev;
   struct gcpro gcpro1, gcpro2;
@@ -440,8 +413,7 @@ Return PARENT.  PARENT should be nil or another keymap.  */)
    make sure that SUBMAP inherits that definition as its own parent.  */
 
 static void
-fix_submap_inheritance (map, event, submap)
-     Lisp_Object map, event, submap;
+fix_submap_inheritance (Lisp_Object map, Lisp_Object event, Lisp_Object submap)
 {
   Lisp_Object map_parent, parent_entry;
 
@@ -503,12 +475,7 @@ fix_submap_inheritance (map, event, submap)
    If NOINHERIT, don't accept a subkeymap found in an inherited keymap.  */
 
 Lisp_Object
-access_keymap (map, idx, t_ok, noinherit, autoload)
-     Lisp_Object map;
-     Lisp_Object idx;
-     int t_ok;
-     int noinherit;
-     int autoload;
+access_keymap (Lisp_Object map, Lisp_Object idx, int t_ok, int noinherit, int autoload)
 {
   Lisp_Object val;
 
@@ -637,10 +604,7 @@ access_keymap (map, idx, t_ok, noinherit, autoload)
 }
 
 static void
-map_keymap_item (fun, args, key, val, data)
-     map_keymap_function_t fun;
-     Lisp_Object args, key, val;
-     void *data;
+map_keymap_item (map_keymap_function_t fun, Lisp_Object args, Lisp_Object key, Lisp_Object val, void *data)
 {
   /* We should maybe try to detect bindings shadowed by previous
      ones and things like that.  */
@@ -650,8 +614,7 @@ map_keymap_item (fun, args, key, val, data)
 }
 
 static void
-map_keymap_char_table_item (args, key, val)
-     Lisp_Object args, key, val;
+map_keymap_char_table_item (Lisp_Object args, Lisp_Object key, Lisp_Object val)
 {
   if (!NILP (val))
     {
@@ -710,9 +673,7 @@ map_keymap_internal (Lisp_Object map,
 }
 
 static void
-map_keymap_call (key, val, fun, dummy)
-     Lisp_Object key, val, fun;
-     void *dummy;
+map_keymap_call (Lisp_Object key, Lisp_Object val, Lisp_Object fun, void *dummy)
 {
   call2 (fun, key, val);
 }
@@ -720,11 +681,7 @@ map_keymap_call (key, val, fun, dummy)
 /* Same as map_keymap_internal, but doesn't traverses parent keymaps as well.
    A non-zero AUTOLOAD indicates that autoloaded keymaps should be loaded.  */
 void
-map_keymap (map, fun, args, data, autoload)
-     map_keymap_function_t fun;
-     Lisp_Object map, args;
-     void *data;
-     int autoload;
+map_keymap (Lisp_Object map, map_keymap_function_t fun, Lisp_Object args, void *data, int autoload)
 {
   struct gcpro gcpro1;
   GCPRO1 (args);
@@ -742,10 +699,7 @@ Lisp_Object Qkeymap_canonicalize;
 /* Same as map_keymap, but does it right, properly eliminating duplicate
    bindings due to inheritance.   */
 void
-map_keymap_canonical (map, fun, args, data)
-     map_keymap_function_t fun;
-     Lisp_Object map, args;
-     void *data;
+map_keymap_canonical (Lisp_Object map, map_keymap_function_t fun, Lisp_Object args, void *data)
 {
   struct gcpro gcpro1;
   GCPRO1 (args);
@@ -762,8 +716,7 @@ DEFUN ("map-keymap-internal", Fmap_keymap_internal, Smap_keymap_internal, 2, 2,
 FUNCTION is called with two arguments: the event that is bound, and
 the definition it is bound to.  The event may be a character range.
 If KEYMAP has a parent, this function returns it without processing it.  */)
-     (function, keymap)
-     Lisp_Object function, keymap;
+  (Lisp_Object function, Lisp_Object keymap)
 {
   struct gcpro gcpro1;
   GCPRO1 (function);
@@ -782,8 +735,7 @@ If KEYMAP has a parent, the parent's bindings are included as well.
 This works recursively: if the parent has itself a parent, then the
 grandparent's bindings are also included and so on.
 usage: (map-keymap FUNCTION KEYMAP)  */)
-     (function, keymap, sort_first)
-     Lisp_Object function, keymap, sort_first;
+  (Lisp_Object function, Lisp_Object keymap, Lisp_Object sort_first)
 {
   if (! NILP (sort_first))
     return call2 (intern ("map-keymap-sorted"), function, keymap);
@@ -807,9 +759,7 @@ usage: (map-keymap FUNCTION KEYMAP)  */)
    This can GC because menu_item_eval_property calls Feval.  */
 
 Lisp_Object
-get_keyelt (object, autoload)
-     Lisp_Object object;
-     int autoload;
+get_keyelt (Lisp_Object object, int autoload)
 {
   while (1)
     {
@@ -889,10 +839,7 @@ get_keyelt (object, autoload)
 }
 
 static Lisp_Object
-store_in_keymap (keymap, idx, def)
-     Lisp_Object keymap;
-     register Lisp_Object idx;
-     Lisp_Object def;
+store_in_keymap (Lisp_Object keymap, register Lisp_Object idx, Lisp_Object def)
 {
   /* Flush any reverse-map cache.  */
   where_is_cache = Qnil;
@@ -1047,8 +994,7 @@ store_in_keymap (keymap, idx, def)
 EXFUN (Fcopy_keymap, 1);
 
 Lisp_Object
-copy_keymap_item (elt)
-     Lisp_Object elt;
+copy_keymap_item (Lisp_Object elt)
 {
   Lisp_Object res, tem;
 
@@ -1121,8 +1067,7 @@ copy_keymap_item (elt)
 }
 
 static void
-copy_keymap_1 (chartable, idx, elt)
-     Lisp_Object chartable, idx, elt;
+copy_keymap_1 (Lisp_Object chartable, Lisp_Object idx, Lisp_Object elt)
 {
   Fset_char_table_range (chartable, idx, copy_keymap_item (elt));
 }
@@ -1134,8 +1079,7 @@ but changing either the copy or KEYMAP does not affect the other.
 Any key definitions that are subkeymaps are recursively copied.
 However, a key definition which is a symbol whose definition is a keymap
 is not copied.  */)
-     (keymap)
-     Lisp_Object keymap;
+  (Lisp_Object keymap)
 {
   register Lisp_Object copy, tail;
   keymap = get_keymap (keymap, 1, 0);
@@ -1179,7 +1123,7 @@ KEY is a string or a vector of symbols and characters, representing a
 sequence of keystrokes and events.  Non-ASCII characters with codes
 above 127 (such as ISO Latin-1) can be represented by vectors.
 Two types of vector have special meanings:
- [remap COMMAND] remaps any key binding for COMMAND in KEYMAP.
+ [remap COMMAND] remaps any key binding for COMMAND.
  [t] creates a default definition, which applies to any event with no
     other definition in KEYMAP.
 
@@ -1200,10 +1144,7 @@ DEF is anything that can be a key's definition:
 If KEYMAP is a sparse keymap with a binding for KEY, the existing
 binding is altered.  If there is no binding for KEY, the new pair
 binding KEY to DEF is added at the front of KEYMAP.  */)
-     (keymap, key, def)
-     Lisp_Object keymap;
-     Lisp_Object key;
-     Lisp_Object def;
+  (Lisp_Object keymap, Lisp_Object key, Lisp_Object def)
 {
   register int idx;
   register Lisp_Object c;
@@ -1280,7 +1221,7 @@ binding KEY to DEF is added at the front of KEYMAP.  */)
          && (!CONSP (c)
              /* If C is a range, it must be a leaf.  */
              || (INTEGERP (XCAR (c)) && idx != length)))
-       error ("Key sequence contains invalid event");
+       message_with_string ("Key sequence contains invalid event %s", c, 1);
 
       if (idx == length)
        RETURN_UNGCPRO (store_in_keymap (keymap, c, def));
@@ -1319,8 +1260,7 @@ ignored if POSITION is non-nil.
 If the optional argument KEYMAPS is non-nil, it should be a list of
 keymaps to search for command remapping.  Otherwise, search for the
 remapping in all currently active keymaps.  */)
-     (command, position, keymaps)
-     Lisp_Object command, position, keymaps;
+  (Lisp_Object command, Lisp_Object position, Lisp_Object keymaps)
 {
   if (!SYMBOLP (command))
     return Qnil;
@@ -1362,10 +1302,7 @@ bindings, used when nothing else in the keymap applies; this makes it
 usable as a general function for probing keymaps.  However, if the
 third optional argument ACCEPT-DEFAULT is non-nil, `lookup-key' will
 recognize the default bindings, just as `read-key-sequence' does.  */)
-     (keymap, key, accept_default)
-     Lisp_Object keymap;
-     Lisp_Object key;
-     Lisp_Object accept_default;
+  (Lisp_Object keymap, Lisp_Object key, Lisp_Object accept_default)
 {
   register int idx;
   register Lisp_Object cmd;
@@ -1398,7 +1335,7 @@ recognize the default bindings, just as `read-key-sequence' does.  */)
       /* Allow string since binding for `menu-bar-select-buffer'
         includes the buffer name in the key sequence.  */
       if (!INTEGERP (c) && !SYMBOLP (c) && !CONSP (c) && !STRINGP (c))
-       error ("Key sequence contains invalid event");
+       message_with_string ("Key sequence contains invalid event %s", c, 1);
 
       cmd = access_keymap (keymap, c, t_ok, 0, 1);
       if (idx == length)
@@ -1417,8 +1354,7 @@ recognize the default bindings, just as `read-key-sequence' does.  */)
    Return the keymap.  */
 
 static Lisp_Object
-define_as_prefix (keymap, c)
-     Lisp_Object keymap, c;
+define_as_prefix (Lisp_Object keymap, Lisp_Object c)
 {
   Lisp_Object cmd;
 
@@ -1435,8 +1371,7 @@ define_as_prefix (keymap, c)
 /* Append a key to the end of a key sequence.  We always make a vector.  */
 
 Lisp_Object
-append_key (key_sequence, key)
-     Lisp_Object key_sequence, key;
+append_key (Lisp_Object key_sequence, Lisp_Object key)
 {
   Lisp_Object args[2];
 
@@ -1450,8 +1385,7 @@ append_key (key_sequence, key)
    signal an error if is a mistake such as RET or M-RET or C-DEL, etc.  */
 
 static void
-silly_event_symbol_error (c)
-     Lisp_Object c;
+silly_event_symbol_error (Lisp_Object c)
 {
   Lisp_Object parsed, base, name, assoc;
   int modifiers;
@@ -1520,8 +1454,7 @@ static int cmm_size = 0;
    list, let the key sequence be read, and hope some other piece of
    code signals the error.  */
 int
-current_minor_maps (modeptr, mapptr)
-     Lisp_Object **modeptr, **mapptr;
+current_minor_maps (Lisp_Object **modeptr, Lisp_Object **mapptr)
 {
   int i = 0;
   int list_number = 0;
@@ -1580,7 +1513,8 @@ current_minor_maps (modeptr, mapptr)
                  {
                    if (cmm_modes)
                      {
-                       bcopy (cmm_modes, newmodes, cmm_size * sizeof cmm_modes[0]);
+                       memcpy (newmodes, cmm_modes,
+                               cmm_size * sizeof cmm_modes[0]);
                        free (cmm_modes);
                      }
                    cmm_modes = newmodes;
@@ -1591,7 +1525,8 @@ current_minor_maps (modeptr, mapptr)
                  {
                    if (cmm_maps)
                      {
-                       bcopy (cmm_maps, newmaps, cmm_size * sizeof cmm_maps[0]);
+                       memcpy (newmaps, cmm_maps,
+                               cmm_size * sizeof cmm_maps[0]);
                        free (cmm_maps);
                      }
                    cmm_maps = newmaps;
@@ -1625,8 +1560,7 @@ DEFUN ("current-active-maps", Fcurrent_active_maps, Scurrent_active_maps,
 OLP if non-nil indicates that we should obey `overriding-local-map' and
 `overriding-terminal-local-map'.  POSITION can specify a click position
 like in the respective argument of `key-binding'. */)
-    (olp, position)
-    Lisp_Object olp, position;
+  (Lisp_Object olp, Lisp_Object position)
 {
   int count = SPECPDL_INDEX ();
 
@@ -1789,8 +1723,7 @@ occurs in the keymaps associated with it instead of KEY.  It can also
 be a number or marker, in which case the keymap properties at the
 specified buffer position instead of point are used.
   */)
-    (key, accept_default, no_remap, position)
-    Lisp_Object key, accept_default, no_remap, position;
+  (Lisp_Object key, Lisp_Object accept_default, Lisp_Object no_remap, Lisp_Object position)
 {
   Lisp_Object *maps, value;
   int nmaps, i;
@@ -1980,8 +1913,7 @@ The binding is probably a symbol with a function definition.
 
 If optional argument ACCEPT-DEFAULT is non-nil, recognize default
 bindings; see the description of `lookup-key' for more details about this.  */)
-     (keys, accept_default)
-     Lisp_Object keys, accept_default;
+  (Lisp_Object keys, Lisp_Object accept_default)
 {
   register Lisp_Object map;
   map = current_buffer->keymap;
@@ -2001,8 +1933,7 @@ This function's return values are the same as those of `lookup-key'
 
 If optional argument ACCEPT-DEFAULT is non-nil, recognize default
 bindings; see the description of `lookup-key' for more details about this.  */)
-     (keys, accept_default)
-     Lisp_Object keys, accept_default;
+  (Lisp_Object keys, Lisp_Object accept_default)
 {
   return Flookup_key (current_global_map, keys, accept_default);
 }
@@ -2021,8 +1952,7 @@ that come after prefix bindings.
 
 If optional argument ACCEPT-DEFAULT is non-nil, recognize default
 bindings; see the description of `lookup-key' for more details about this.  */)
-     (key, accept_default)
-     Lisp_Object key, accept_default;
+  (Lisp_Object key, Lisp_Object accept_default)
 {
   Lisp_Object *modes, *maps;
   int nmaps;
@@ -2061,8 +1991,7 @@ as a function.
 The third optional argument NAME, if given, supplies a menu name
 string for the map.  This is required to use the keymap as a menu.
 This function returns COMMAND.  */)
-     (command, mapvar, name)
-     Lisp_Object command, mapvar, name;
+  (Lisp_Object command, Lisp_Object mapvar, Lisp_Object name)
 {
   Lisp_Object map;
   map = Fmake_sparse_keymap (name);
@@ -2076,8 +2005,7 @@ This function returns COMMAND.  */)
 
 DEFUN ("use-global-map", Fuse_global_map, Suse_global_map, 1, 1, 0,
        doc: /* Select KEYMAP as the global keymap.  */)
-     (keymap)
-     Lisp_Object keymap;
+  (Lisp_Object keymap)
 {
   keymap = get_keymap (keymap, 1, 1);
   current_global_map = keymap;
@@ -2088,8 +2016,7 @@ DEFUN ("use-global-map", Fuse_global_map, Suse_global_map, 1, 1, 0,
 DEFUN ("use-local-map", Fuse_local_map, Suse_local_map, 1, 1, 0,
        doc: /* Select KEYMAP as the local keymap.
 If KEYMAP is nil, that means no local keymap.  */)
-     (keymap)
-     Lisp_Object keymap;
+  (Lisp_Object keymap)
 {
   if (!NILP (keymap))
     keymap = get_keymap (keymap, 1, 1);
@@ -2102,21 +2029,21 @@ If KEYMAP is nil, that means no local keymap.  */)
 DEFUN ("current-local-map", Fcurrent_local_map, Scurrent_local_map, 0, 0, 0,
        doc: /* Return current buffer's local keymap, or nil if it has none.
 Normally the local keymap is set by the major mode with `use-local-map'.  */)
-     ()
+  (void)
 {
   return current_buffer->keymap;
 }
 
 DEFUN ("current-global-map", Fcurrent_global_map, Scurrent_global_map, 0, 0, 0,
        doc: /* Return the current global keymap.  */)
-     ()
+  (void)
 {
   return current_global_map;
 }
 
 DEFUN ("current-minor-mode-maps", Fcurrent_minor_mode_maps, Scurrent_minor_mode_maps, 0, 0, 0,
        doc: /* Return a list of keymaps for the minor modes of the current buffer.  */)
-     ()
+  (void)
 {
   Lisp_Object *maps;
   int nmaps = current_minor_maps (0, &maps);
@@ -2133,10 +2060,8 @@ struct accessible_keymaps_data {
 };
 
 static void
-accessible_keymaps_1 (key, cmd, args, data)
-     Lisp_Object key, cmd, args;
-     /* Use void* to be compatible with map_keymap_function_t.  */
-     void *data;
+accessible_keymaps_1 (Lisp_Object key, Lisp_Object cmd, Lisp_Object args, void *data)
+/* Use void* data to be compatible with map_keymap_function_t.  */
 {
   struct accessible_keymaps_data *d = data; /* Cast! */
   Lisp_Object maps = d->maps;
@@ -2206,8 +2131,7 @@ KEYS starting from KEYMAP gets you to MAP.  These elements are ordered
 so that the KEYS increase in length.  The first element is ([] . KEYMAP).
 An optional argument PREFIX, if non-nil, should be a key sequence;
 then the value includes only maps for prefixes that start with PREFIX.  */)
-     (keymap, prefix)
-     Lisp_Object keymap, prefix;
+  (Lisp_Object keymap, Lisp_Object prefix)
 {
   Lisp_Object maps, tail;
   int prefixlen = XINT (Flength (prefix));
@@ -2295,8 +2219,7 @@ DEFUN ("key-description", Fkey_description, Skey_description, 1, 2, 0,
 Optional arg PREFIX is the sequence of keys leading up to KEYS.
 Control characters turn into "C-foo" sequences, meta into "M-foo",
 spaces are put between sequence elements, etc.  */)
-  (keys, prefix)
-     Lisp_Object keys, prefix;
+  (Lisp_Object keys, Lisp_Object prefix)
 {
   int len = 0;
   int i, i_byte;
@@ -2394,10 +2317,7 @@ spaces are put between sequence elements, etc.  */)
 
 
 char *
-push_key_description (c, p, force_multibyte)
-     register unsigned int c;
-     register char *p;
-     int force_multibyte;
+push_key_description (register unsigned int c, register char *p, int force_multibyte)
 {
   unsigned c2;
 
@@ -2519,8 +2439,7 @@ DEFUN ("single-key-description", Fsingle_key_description,
 Control characters turn into C-whatever, etc.
 Optional argument NO-ANGLES non-nil means don't put angle brackets
 around function keys and event symbols.  */)
-     (key, no_angles)
-     Lisp_Object key, no_angles;
+  (Lisp_Object key, Lisp_Object no_angles)
 {
   if (CONSP (key) && lucid_event_type_list_p (key))
     key = Fevent_convert_list (key);
@@ -2554,9 +2473,7 @@ around function keys and event symbols.  */)
 }
 
 char *
-push_text_char_description (c, p)
-     register unsigned int c;
-     register char *p;
+push_text_char_description (register unsigned int c, register char *p)
 {
   if (c >= 0200)
     {
@@ -2588,8 +2505,7 @@ Control characters turn into "^char", etc.  This differs from
 Also, this function recognizes the 2**7 bit as the Meta character,
 whereas `single-key-description' uses the 2**27 bit for Meta.
 See Info node `(elisp)Describing Characters' for examples.  */)
-     (character)
-     Lisp_Object character;
+  (Lisp_Object character)
 {
   /* Currently MAX_MULTIBYTE_LENGTH is 4 (< 6).  */
   unsigned char str[6];
@@ -2616,8 +2532,7 @@ static int where_is_preferred_modifier;
    Else, return 2 if SEQ uses the where_is_preferred_modifier,
    and 1 otherwise.  */
 static int
-preferred_sequence_p (seq)
-     Lisp_Object seq;
+preferred_sequence_p (Lisp_Object seq)
 {
   int i;
   int len = XINT (Flength (seq));
@@ -2648,8 +2563,8 @@ preferred_sequence_p (seq)
 \f
 /* where-is - finding a command in a set of keymaps.                   */
 
-static void where_is_internal_1 P_ ((Lisp_Object key, Lisp_Object binding,
-                                    Lisp_Object args, void *data));
+static void where_is_internal_1 (Lisp_Object key, Lisp_Object binding,
+                                 Lisp_Object args, void *data);
 
 /* Like Flookup_key, but uses a list of keymaps SHADOW instead of a single map.
    Returns the first non-nil binding found in any of those maps.
@@ -2819,9 +2734,7 @@ indirect definition itself.
 If optional 5th arg NO-REMAP is non-nil, don't search for key sequences
 that invoke a command which is remapped to DEFINITION, but include the
 remapped command in the returned list.  */)
-     (definition, keymap, firstonly, noindirect, no_remap)
-     Lisp_Object definition, keymap;
-     Lisp_Object firstonly, noindirect, no_remap;
+  (Lisp_Object definition, Lisp_Object keymap, Lisp_Object firstonly, Lisp_Object noindirect, Lisp_Object no_remap)
 {
   /* The keymaps in which to search.  */
   Lisp_Object keymaps;
@@ -2987,9 +2900,7 @@ remapped command in the returned list.  */)
 /* This function can GC because get_keyelt can.  */
 
 static void
-where_is_internal_1 (key, binding, args, data)
-     Lisp_Object key, binding, args;
-     void *data;
+where_is_internal_1 (Lisp_Object key, Lisp_Object binding, Lisp_Object args, void *data)
 {
   struct where_is_internal_data *d = data; /* Cast! */
   Lisp_Object definition = d->definition;
@@ -3044,15 +2955,14 @@ The optional argument PREFIX, if non-nil, should be a key sequence;
 then we display only bindings that start with that prefix.
 The optional argument MENUS, if non-nil, says to mention menu bindings.
 \(Ordinarily these are omitted from the output.)  */)
-     (buffer, prefix, menus)
-     Lisp_Object buffer, prefix, menus;
+  (Lisp_Object buffer, Lisp_Object prefix, Lisp_Object menus)
 {
   Lisp_Object outbuf, shadow;
   int nomenu = NILP (menus);
   register Lisp_Object start1;
   struct gcpro gcpro1;
 
-  char *alternate_heading
+  const char *alternate_heading
     = "\
 Keyboard translations:\n\n\
 You type        Translation\n\
@@ -3156,12 +3066,12 @@ You type        Translation\n\
          *p++ = '\f';
          *p++ = '\n';
          *p++ = '`';
-         bcopy (SDATA (SYMBOL_NAME (modes[i])), p,
-                SCHARS (SYMBOL_NAME (modes[i])));
+         memcpy (p, SDATA (SYMBOL_NAME (modes[i])),
+                 SCHARS (SYMBOL_NAME (modes[i])));
          p += SCHARS (SYMBOL_NAME (modes[i]));
          *p++ = '\'';
-         bcopy (" Minor Mode Bindings", p, sizeof (" Minor Mode Bindings") - 1);
-         p += sizeof (" Minor Mode Bindings") - 1;
+         memcpy (p, " Minor Mode Bindings", strlen (" Minor Mode Bindings"));
+         p += strlen (" Minor Mode Bindings");
          *p = 0;
 
          describe_map_tree (maps[i], 1, shadow, prefix,
@@ -3223,20 +3133,14 @@ You type        Translation\n\
    don't omit it; instead, mention it but say it is shadowed.  */
 
 void
-describe_map_tree (startmap, partial, shadow, prefix, title, nomenu, transl,
-                  always_title, mention_shadow)
-     Lisp_Object startmap, shadow, prefix;
-     int partial;
-     char *title;
-     int nomenu;
-     int transl;
-     int always_title;
-     int mention_shadow;
+describe_map_tree (Lisp_Object startmap, int partial, Lisp_Object shadow,
+                  Lisp_Object prefix, const char *title, int nomenu, int transl,
+                  int always_title, int mention_shadow)
 {
   Lisp_Object maps, orig_maps, seen, sub_shadows;
   struct gcpro gcpro1, gcpro2, gcpro3;
   int something = 0;
-  char *key_heading
+  const char *key_heading
     = "\
 key             binding\n\
 ---             -------\n";
@@ -3347,8 +3251,7 @@ key             binding\n\
 static int previous_description_column;
 
 static void
-describe_command (definition, args)
-     Lisp_Object definition, args;
+describe_command (Lisp_Object definition, Lisp_Object args)
 {
   register Lisp_Object tem1;
   int column = (int) current_column (); /* iftc */
@@ -3384,8 +3287,7 @@ describe_command (definition, args)
 }
 
 static void
-describe_translation (definition, args)
-     Lisp_Object definition, args;
+describe_translation (Lisp_Object definition, Lisp_Object args)
 {
   register Lisp_Object tem1;
 
@@ -3418,8 +3320,7 @@ struct describe_map_elt { Lisp_Object event; Lisp_Object definition; int shadowe
    the event field.  */
 
 static int
-describe_map_compare (aa, bb)
-     const void *aa, *bb;
+describe_map_compare (const void *aa, const void *bb)
 {
   const struct describe_map_elt *a = aa, *b = bb;
   if (INTEGERP (a->event) && INTEGERP (b->event))
@@ -3441,16 +3342,10 @@ describe_map_compare (aa, bb)
    PARTIAL, SHADOW, NOMENU are as in `describe_map_tree' above.  */
 
 static void
-describe_map (map, prefix, elt_describer, partial, shadow,
-             seen, nomenu, mention_shadow)
-     register Lisp_Object map;
-     Lisp_Object prefix;
-     void (*elt_describer) P_ ((Lisp_Object, Lisp_Object));
-     int partial;
-     Lisp_Object shadow;
-     Lisp_Object *seen;
-     int nomenu;
-     int mention_shadow;
+describe_map (Lisp_Object map, Lisp_Object prefix,
+             void (*elt_describer) (Lisp_Object, Lisp_Object),
+             int partial, Lisp_Object shadow,
+             Lisp_Object *seen, int nomenu, int mention_shadow)
 {
   Lisp_Object tail, definition, event;
   Lisp_Object tem;
@@ -3629,8 +3524,7 @@ describe_map (map, prefix, elt_describer, partial, shadow,
 }
 
 static void
-describe_vector_princ (elt, fun)
-     Lisp_Object elt, fun;
+describe_vector_princ (Lisp_Object elt, Lisp_Object fun)
 {
   Findent_to (make_number (16), make_number (1));
   call1 (fun, elt);
@@ -3641,8 +3535,7 @@ DEFUN ("describe-vector", Fdescribe_vector, Sdescribe_vector, 1, 2, 0,
        doc: /* Insert a description of contents of VECTOR.
 This is text showing the elements of vector matched against indices.
 DESCRIBER is the output function used; nil means use `princ'.  */)
-     (vector, describer)
-     Lisp_Object vector, describer;
+  (Lisp_Object vector, Lisp_Object describer)
 {
   int count = SPECPDL_INDEX ();
   if (NILP (describer))
@@ -3691,20 +3584,11 @@ DESCRIBER is the output function used; nil means use `princ'.  */)
    ARGS is simply passed as the second argument to ELT_DESCRIBER.  */
 
 static void
-describe_vector (vector, prefix, args, elt_describer,
-                partial, shadow, entire_map,
-                indices, char_table_depth, keymap_p,
-                mention_shadow)
-     register Lisp_Object vector;
-     Lisp_Object prefix, args;
-     void (*elt_describer) P_ ((Lisp_Object, Lisp_Object));
-     int partial;
-     Lisp_Object shadow;
-     Lisp_Object entire_map;
-     int *indices;
-     int char_table_depth;
-     int keymap_p;
-     int mention_shadow;
+describe_vector (Lisp_Object vector, Lisp_Object prefix, Lisp_Object args,
+                void (*elt_describer) (Lisp_Object, Lisp_Object),
+                int partial, Lisp_Object shadow, Lisp_Object entire_map,
+                int *indices, int char_table_depth, int keymap_p,
+                int mention_shadow)
 {
   Lisp_Object definition;
   Lisp_Object tem2;
@@ -3898,8 +3782,7 @@ static Lisp_Object apropos_predicate;
 static Lisp_Object apropos_accumulate;
 
 static void
-apropos_accum (symbol, string)
-     Lisp_Object symbol, string;
+apropos_accum (Lisp_Object symbol, Lisp_Object string)
 {
   register Lisp_Object tem;
 
@@ -3915,8 +3798,7 @@ DEFUN ("apropos-internal", Fapropos_internal, Sapropos_internal, 1, 2, 0,
 If optional 2nd arg PREDICATE is non-nil, (funcall PREDICATE SYMBOL) is done
 for each symbol and a symbol is mentioned only if that returns non-nil.
 Return list of symbols found.  */)
-     (regexp, predicate)
-     Lisp_Object regexp, predicate;
+  (Lisp_Object regexp, Lisp_Object predicate)
 {
   Lisp_Object tem;
   CHECK_STRING (regexp);
@@ -3930,7 +3812,7 @@ Return list of symbols found.  */)
 }
 \f
 void
-syms_of_keymap ()
+syms_of_keymap (void)
 {
   Qkeymap = intern_c_string ("keymap");
   staticpro (&Qkeymap);
@@ -4124,7 +4006,7 @@ preferred.  */);
 }
 
 void
-keys_of_keymap ()
+keys_of_keymap (void)
 {
   initial_define_key (global_map, 033, "ESC-prefix");
   initial_define_key (global_map, Ctl ('X'), "Control-X-prefix");
index ed9bf7f192cfb5666f9325e668e8622ec567f236..c68d763204db0ad330111f65744e45ce9c34fd0f 100644 (file)
@@ -22,6 +22,11 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #define KEYMAPP(m) (!NILP (get_keymap (m, 0, 0)))
 extern Lisp_Object Qkeymap, Qmenu_bar;
+extern Lisp_Object Qremap;
+extern Lisp_Object Qmenu_item;
+extern Lisp_Object meta_prefix_char;
+extern Lisp_Object Voverriding_local_map;
+extern Lisp_Object Voverriding_local_map_menu_flag;
 extern Lisp_Object current_global_map;
 EXFUN (Fmake_sparse_keymap, 1);
 EXFUN (Fkeymap_prompt, 1);
@@ -33,21 +38,21 @@ EXFUN (Fkey_description, 2);
 EXFUN (Fsingle_key_description, 2);
 EXFUN (Fwhere_is_internal, 5);
 EXFUN (Fcurrent_active_maps, 2);
-extern Lisp_Object access_keymap P_ ((Lisp_Object, Lisp_Object, int, int, int));
-extern Lisp_Object get_keyelt P_ ((Lisp_Object, int));
-extern Lisp_Object get_keymap P_ ((Lisp_Object, int, int));
+extern Lisp_Object access_keymap (Lisp_Object, Lisp_Object, int, int, int);
+extern Lisp_Object get_keyelt (Lisp_Object, int);
+extern Lisp_Object get_keymap (Lisp_Object, int, int);
 EXFUN (Fset_keymap_parent, 2);
-extern void describe_map_tree P_ ((Lisp_Object, int, Lisp_Object, Lisp_Object,
-                                  char *, int, int, int, int));
-extern int current_minor_maps P_ ((Lisp_Object **, Lisp_Object **));
-extern void initial_define_key P_ ((Lisp_Object, int, char *));
-extern void initial_define_lispy_key P_ ((Lisp_Object, char *, char *));
-extern void syms_of_keymap P_ ((void));
-extern void keys_of_keymap P_ ((void));
+extern void describe_map_tree (Lisp_Object, int, Lisp_Object, Lisp_Object,
+                               const char *, int, int, int, int);
+extern int current_minor_maps (Lisp_Object **, Lisp_Object **);
+extern void initial_define_key (Lisp_Object, int, const char *);
+extern void initial_define_lispy_key (Lisp_Object, const char *, const char *);
+extern void syms_of_keymap (void);
+extern void keys_of_keymap (void);
 
 typedef void (*map_keymap_function_t)
-     P_ ((Lisp_Object key, Lisp_Object val, Lisp_Object args, void* data));
-extern void map_keymap P_ ((Lisp_Object map, map_keymap_function_t fun, Lisp_Object largs, void* cargs, int autoload));
+     (Lisp_Object key, Lisp_Object val, Lisp_Object args, void* data);
+extern void map_keymap (Lisp_Object map, map_keymap_function_t fun, Lisp_Object largs, void* cargs, int autoload);
 extern void map_keymap_canonical (Lisp_Object map,
                                  map_keymap_function_t fun,
                                  Lisp_Object args, void *data);
index 5f0b3a700f7584b7db2132a75e2899f1cd1b3d4d..89514bf9ecbc223a485c98827a40369de2f6daf0 100644 (file)
@@ -21,8 +21,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #ifndef EMACS_LISP_H
 #define EMACS_LISP_H
 
-/* Declare the prototype for a general external function.  */
-#define P_(proto) proto
+#include <stdarg.h>
+#include <stddef.h>
 
 /* Use the configure flag --enable-checking[=LIST] to enable various
    types of run time checks for Lisp objects.  */
@@ -54,7 +54,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* Extra internal type checking?  */
 extern int suppress_checking;
-extern void die P_((const char *, const char *, int)) NO_RETURN;
+extern void die (const char *, const char *, int) NO_RETURN;
 
 #ifdef ENABLE_CHECKING
 
@@ -95,10 +95,9 @@ extern void die P_((const char *, const char *, int)) NO_RETURN;
 #endif
 #endif /* ENABLE_CHECKING */
 \f
-/* Define this to make Lisp_Object use a union type instead of the
-   default int.  FIXME: It might be better to add a flag to configure
-   to do this.  */
-/* #define USE_LISP_UNION_TYPE */
+/* 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.  */
 
 /***** Select the tagging scheme.  *****/
 /* There are basically two options that control the tagging scheme:
@@ -223,13 +222,7 @@ enum Lisp_Misc_Type
   {
     Lisp_Misc_Free = 0x5eab,
     Lisp_Misc_Marker,
-    Lisp_Misc_Intfwd,
-    Lisp_Misc_Boolfwd,
-    Lisp_Misc_Objfwd,
-    Lisp_Misc_Buffer_Objfwd,
-    Lisp_Misc_Buffer_Local_Value,
     Lisp_Misc_Overlay,
-    Lisp_Misc_Kboard_Objfwd,
     Lisp_Misc_Save_Value,
     /* Currently floats are not a misc type,
        but let's define this in case we want to change that.  */
@@ -238,6 +231,18 @@ enum Lisp_Misc_Type
     Lisp_Misc_Limit
   };
 
+/* These are the types of forwarding objects used in the value slot
+   of symbols for special built-in variables whose value is stored in
+   C variables.  */
+enum Lisp_Fwd_Type
+  {
+    Lisp_Fwd_Int,              /* Fwd to a C `int' variable.  */
+    Lisp_Fwd_Bool,             /* Fwd to a C boolean var.  */
+    Lisp_Fwd_Obj,              /* Fwd to a C Lisp_Object variable.  */
+    Lisp_Fwd_Buffer_Obj,       /* Fwd to a Lisp_Object field of buffers.  */
+    Lisp_Fwd_Kboard_Obj,       /* Fwd to a Lisp_Object field of kboards.  */
+  };
+
 #ifndef GCTYPEBITS
 #define GCTYPEBITS 3
 #endif
@@ -249,7 +254,7 @@ enum Lisp_Misc_Type
 
 #ifdef USE_LISP_UNION_TYPE
 
-#ifndef WORDS_BIG_ENDIAN
+#ifndef WORDS_BIGENDIAN
 
 /* Definition of Lisp_Object for little-endian machines.  */
 
@@ -273,7 +278,7 @@ union Lisp_Object
   }
 Lisp_Object;
 
-#else /* If WORDS_BIG_ENDIAN */
+#else /* If WORDS_BIGENDIAN */
 
 typedef
 union Lisp_Object
@@ -295,7 +300,7 @@ union Lisp_Object
   }
 Lisp_Object;
 
-#endif /* WORDS_BIG_ENDIAN */
+#endif /* WORDS_BIGENDIAN */
 
 #ifdef __GNUC__
 static __inline__ Lisp_Object
@@ -304,11 +309,10 @@ LISP_MAKE_RVALUE (Lisp_Object o)
     return o;
 }
 #else
-/* This isn't quite right - it keeps the argument as an lvalue.
-   Making it const via casting would help avoid code actually
-   modifying the location in question, but the casting could cover
-   other type-related bugs.  */
-#define LISP_MAKE_RVALUE(o) (o)
+/* 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 */
@@ -488,7 +492,7 @@ enum pvec_type
 #define make_number(N) \
   (__extension__ ({ Lisp_Object _l; _l.s.val = (N); _l.s.type = Lisp_Int; _l; }))
 #else
-extern Lisp_Object make_number P_ ((EMACS_INT));
+extern Lisp_Object make_number (EMACS_INT);
 #endif
 
 #endif /* USE_LISP_UNION_TYPE */
@@ -504,12 +508,6 @@ extern Lisp_Object make_number P_ ((EMACS_INT));
 #define EQ(x, y) (XHASH (x) == XHASH (y))
 
 #ifndef XPNTR
-#ifdef HAVE_SHM
-/* In this representation, data is found in two widely separated segments.  */
-extern size_t pure_size;
-#define XPNTR(a) \
-  (XUINT (a) | (XUINT (a) > pure_size ? DATA_SEG_BITS : PURE_SEG_BITS))
-#else /* not HAVE_SHM */
 #ifdef DATA_SEG_BITS
 /* This case is used for the rt-pc.
    In the diffs I was given, it checked for ptr = 0
@@ -524,7 +522,6 @@ extern size_t pure_size;
    size.  */
 #define XPNTR(a) ((EMACS_INT) XUINT (a))
 #endif
-#endif /* not HAVE_SHM */
 #endif /* no XPNTR */
 
 /* Largest and smallest representable fixnum values.  These are the C
@@ -566,17 +563,19 @@ extern size_t pure_size;
 #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))
-#define XINTFWD(a)     (eassert (INTFWDP (a)), &(XMISC(a)->u_intfwd))
-#define XBOOLFWD(a)    (eassert (BOOLFWDP (a)), &(XMISC(a)->u_boolfwd))
-#define XOBJFWD(a)     (eassert (OBJFWDP (a)), &(XMISC(a)->u_objfwd))
 #define XOVERLAY(a)    (eassert (OVERLAYP (a)), &(XMISC(a)->u_overlay))
 #define XSAVE_VALUE(a) (eassert (SAVE_VALUEP (a)), &(XMISC(a)->u_save_value))
+
+/* Forwarding object types.  */
+
+#define XFWDTYPE(a)     (a->u_intfwd.type)
+#define XINTFWD(a)     (eassert (INTFWDP (a)), &((a)->u_intfwd))
+#define XBOOLFWD(a)    (eassert (BOOLFWDP (a)), &((a)->u_boolfwd))
+#define XOBJFWD(a)     (eassert (OBJFWDP (a)), &((a)->u_objfwd))
 #define XBUFFER_OBJFWD(a) \
-  (eassert (BUFFER_OBJFWDP (a)), &(XMISC(a)->u_buffer_objfwd))
-#define XBUFFER_LOCAL_VALUE(a) \
-  (eassert (BUFFER_LOCAL_VALUEP (a)), &(XMISC(a)->u_buffer_local_value))
+  (eassert (BUFFER_OBJFWDP (a)), &((a)->u_buffer_objfwd))
 #define XKBOARD_OBJFWD(a) \
-  (eassert (KBOARD_OBJFWDP (a)), &(XMISC(a)->u_kboard_objfwd))
+  (eassert (KBOARD_OBJFWDP (a)), &((a)->u_kboard_objfwd))
 
 /* Pseudovector types.  */
 
@@ -644,7 +643,7 @@ extern size_t pure_size;
     (XSTRING (string)->size = (newsize))
 
 #define STRING_COPYIN(string, index, new, count) \
-    bcopy (new, SDATA (string) + index, count)
+    memcpy (SDATA (string) + index, new, count)
 
 /* Type checking.  */
 
@@ -713,11 +712,6 @@ struct Lisp_Cons
 #define XSETCAR(c,n) (XCAR_AS_LVALUE(c) = (n))
 #define XSETCDR(c,n) (XCDR_AS_LVALUE(c) = (n))
 
-/* For performance: Fast storage of positive integers into the
-   fields of a cons cell.  See above caveats.  */
-#define XSETCARFASTINT(c,n)  XSETFASTINT(XCAR_AS_LVALUE(c),(n))
-#define XSETCDRFASTINT(c,n)  XSETFASTINT(XCDR_AS_LVALUE(c),(n))
-
 /* Take the car or cdr of something whose type is not known.  */
 #define CAR(c)                                 \
  (CONSP ((c)) ? XCAR ((c))                     \
@@ -745,7 +739,7 @@ struct Lisp_Cons
 #ifdef GC_CHECK_STRING_BYTES
 
 struct Lisp_String;
-extern int string_bytes P_ ((struct Lisp_String *));
+extern int string_bytes (struct Lisp_String *);
 #define STRING_BYTES(S) string_bytes ((S))
 
 #else /* not GC_CHECK_STRING_BYTES */
@@ -784,13 +778,6 @@ struct Lisp_String
     unsigned char *data;
   };
 
-#ifdef offsetof
-#define OFFSETOF(type,field) offsetof(type,field)
-#else
-#define OFFSETOF(type,field) \
-  ((int)((char*)&((type*)0)->field - (char*)0))
-#endif
-
 struct Lisp_Vector
   {
     EMACS_UINT size;
@@ -801,7 +788,7 @@ struct Lisp_Vector
 /* If a struct is made to look like a vector, this macro returns the length
    of the shortest vector that would hold that struct.  */
 #define VECSIZE(type) ((sizeof (type)                                    \
-                       - OFFSETOF (struct Lisp_Vector, contents[0])      \
+                       - offsetof (struct Lisp_Vector, contents[0])      \
                         + sizeof(Lisp_Object) - 1) /* round up */        \
                       / sizeof (Lisp_Object))
 
@@ -809,7 +796,7 @@ struct Lisp_Vector
    at the end and we need to compute the number of Lisp_Object fields (the
    ones that the GC needs to trace).  */
 #define PSEUDOVECSIZE(type, nonlispfield) \
-  ((OFFSETOF(type, nonlispfield) - OFFSETOF(struct Lisp_Vector, contents[0])) \
+  ((offsetof(type, nonlispfield) - offsetof(struct Lisp_Vector, contents[0])) \
    / sizeof (Lisp_Object))
 
 /* A char-table is a kind of vectorlike, with contents are like a
@@ -967,11 +954,23 @@ struct Lisp_Bool_Vector
 struct Lisp_Subr
   {
     EMACS_UINT size;
-    Lisp_Object (*function) ();
+    union {
+      Lisp_Object (*a0) (void);
+      Lisp_Object (*a1) (Lisp_Object);
+      Lisp_Object (*a2) (Lisp_Object, Lisp_Object);
+      Lisp_Object (*a3) (Lisp_Object, Lisp_Object, Lisp_Object);
+      Lisp_Object (*a4) (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object);
+      Lisp_Object (*a5) (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object);
+      Lisp_Object (*a6) (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object);
+      Lisp_Object (*a7) (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object);
+      Lisp_Object (*a8) (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object);
+      Lisp_Object (*aUNEVALLED) (Lisp_Object args);
+      Lisp_Object (*aMANY) (int, Lisp_Object *);
+    } function;
     short min_args, max_args;
     const char *symbol_name;
-    char *intspec;
-    char *doc;
+    const char *intspec;
+    const char *doc;
   };
 
 \f
@@ -988,19 +987,32 @@ enum symbol_interned
   SYMBOL_INTERNED_IN_INITIAL_OBARRAY = 2
 };
 
+enum symbol_redirect
+{
+  SYMBOL_PLAINVAL  = 4,
+  SYMBOL_VARALIAS  = 1,
+  SYMBOL_LOCALIZED = 2,
+  SYMBOL_FORWARDED   = 3
+};
+
 /* In a symbol, the markbit of the plist is used as the gc mark bit */
 
 struct Lisp_Symbol
 {
   unsigned gcmarkbit : 1;
 
-  /* Non-zero means symbol serves as a variable alias.  The symbol
-     holding the real value is found in the value slot.  */
-  unsigned indirect_variable : 1;
+  /* Indicates where the value can be found:
+     0 : it's a plain var, the value is in the `value' field.
+     1 : it's a varalias, the value is really in the `alias' symbol.
+     2 : it's a localized var, the value is in the `blv' object.
+     3 : it's a forwarding variable, the value is in `forward'.
+   */
+  enum symbol_redirect redirect : 3;
 
   /* Non-zero means symbol is constant, i.e. changing its value
-     should signal an error.  */
-  unsigned constant : 1;
+     should signal an error.  If the value is 3, then the var
+     can be changed, but only by `defconst'.  */
+  unsigned constant : 2;
 
   /* Interned state of the symbol.  This is an enumerator from
      enum symbol_interned.  */
@@ -1013,10 +1025,15 @@ struct Lisp_Symbol
   Lisp_Object xname;
 
   /* Value of the symbol or Qunbound if unbound.  If this symbol is a
-     defvaralias, `value' contains the symbol for which it is an
+     defvaralias, `alias' contains the symbol for which it is an
      alias.  Use the SYMBOL_VALUE and SET_SYMBOL_VALUE macros to get
      and set a symbol's value, to take defvaralias into account.  */
-  Lisp_Object value;
+  union {
+    Lisp_Object value;
+    struct Lisp_Symbol *alias;
+    struct Lisp_Buffer_Local_Value *blv;
+    union Lisp_Fwd *fwd;
+  } val;
 
   /* Function value of the symbol or Qunbound if not fboundp.  */
   Lisp_Object function;
@@ -1030,6 +1047,23 @@ struct Lisp_Symbol
 
 /* Value is name of symbol.  */
 
+#define SYMBOL_VAL(sym)   \
+  (eassert ((sym)->redirect == SYMBOL_PLAINVAL),  (sym)->val.value)
+#define SYMBOL_ALIAS(sym) \
+  (eassert ((sym)->redirect == SYMBOL_VARALIAS),  (sym)->val.alias)
+#define SYMBOL_BLV(sym)   \
+  (eassert ((sym)->redirect == SYMBOL_LOCALIZED), (sym)->val.blv)
+#define SYMBOL_FWD(sym)   \
+  (eassert ((sym)->redirect == SYMBOL_FORWARDED), (sym)->val.fwd)
+#define SET_SYMBOL_VAL(sym, v)     \
+  (eassert ((sym)->redirect == SYMBOL_PLAINVAL),  (sym)->val.value = (v))
+#define SET_SYMBOL_ALIAS(sym, v)   \
+  (eassert ((sym)->redirect == SYMBOL_VARALIAS),  (sym)->val.alias = (v))
+#define SET_SYMBOL_BLV(sym, v)     \
+  (eassert ((sym)->redirect == SYMBOL_LOCALIZED), (sym)->val.blv = (v))
+#define SET_SYMBOL_FWD(sym, v) \
+  (eassert ((sym)->redirect == SYMBOL_FORWARDED), (sym)->val.fwd = (v))
+
 #define SYMBOL_NAME(sym)  \
      LISP_MAKE_RVALUE (XSYMBOL (sym)->xname)
 
@@ -1049,24 +1083,6 @@ struct Lisp_Symbol
 
 #define SYMBOL_CONSTANT_P(sym)   XSYMBOL (sym)->constant
 
-/* Value is the value of SYM, with defvaralias taken into
-   account.  */
-
-#define SYMBOL_VALUE(sym)                      \
-   (XSYMBOL (sym)->indirect_variable           \
-    ? indirect_variable (XSYMBOL (sym))->value \
-    : XSYMBOL (sym)->value)
-
-/* Set SYM's value to VAL, taking defvaralias into account.  */
-
-#define SET_SYMBOL_VALUE(sym, val)                             \
-     do {                                                      \
-       if (XSYMBOL (sym)->indirect_variable)                   \
-        indirect_variable (XSYMBOL (sym))->value = (val);      \
-       else                                                    \
-        XSYMBOL (sym)->value = (val);                          \
-     } while (0)
-
 \f
 /***********************************************************************
                             Hash Tables
@@ -1136,11 +1152,11 @@ struct Lisp_Hash_Table
   struct Lisp_Hash_Table *next_weak;
 
   /* C function to compare two keys.  */
-  int (* cmpfn) P_ ((struct Lisp_Hash_Table *, Lisp_Object,
-                    unsigned, Lisp_Object, unsigned));
+  int (* cmpfn) (struct Lisp_Hash_Table *, Lisp_Object,
+                 unsigned, Lisp_Object, unsigned);
 
   /* C function to compute hash code.  */
-  unsigned (* hashfn) P_ ((struct Lisp_Hash_Table *, Lisp_Object));
+  unsigned (* hashfn) (struct Lisp_Hash_Table *, Lisp_Object);
 };
 
 
@@ -1200,9 +1216,11 @@ struct Lisp_Hash_Table
 
 struct Lisp_Misc_Any           /* Supertype of all Misc types.  */
 {
-  enum Lisp_Misc_Type type : 16;               /* = Lisp_Misc_Marker */
+  enum 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
@@ -1225,7 +1243,7 @@ struct Lisp_Marker
      - Fmarker_buffer
      - Fset_marker: check eq(oldbuf, newbuf) to avoid unchain+rechain.
      - unchain_marker: to find the list from which to unchain.
-     - Fkill_buffer: to unchain the markers of current indirect buffer.
+     - Fkill_buffer: to only unchain the markers of current indirect buffer.
      */
   struct buffer *buffer;
 
@@ -1239,7 +1257,10 @@ struct Lisp_Marker
   struct Lisp_Marker *next;
   /* This is the char position where the marker points.  */
   EMACS_INT charpos;
-  /* This is the byte position.  */
+  /* 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;
 };
 
@@ -1249,9 +1270,7 @@ struct Lisp_Marker
    specified int variable.  */
 struct Lisp_Intfwd
   {
-    int type : 16;     /* = Lisp_Misc_Intfwd */
-    unsigned gcmarkbit : 1;
-    int spacer : 15;
+    enum Lisp_Fwd_Type type;   /* = Lisp_Fwd_Int */
     EMACS_INT *intvar;
   };
 
@@ -1261,9 +1280,7 @@ struct Lisp_Intfwd
    nil if it is zero.  */
 struct Lisp_Boolfwd
   {
-    int type : 16;     /* = Lisp_Misc_Boolfwd */
-    unsigned gcmarkbit : 1;
-    int spacer : 15;
+    enum Lisp_Fwd_Type type;   /* = Lisp_Fwd_Bool */
     int *boolvar;
   };
 
@@ -1273,9 +1290,7 @@ struct Lisp_Boolfwd
    specified variable.  */
 struct Lisp_Objfwd
   {
-    int type : 16;     /* = Lisp_Misc_Objfwd */
-    unsigned gcmarkbit : 1;
-    int spacer : 15;
+    enum Lisp_Fwd_Type type;   /* = Lisp_Fwd_Obj */
     Lisp_Object *objvar;
   };
 
@@ -1283,11 +1298,9 @@ struct Lisp_Objfwd
    current buffer.  Value is byte index of slot within buffer.  */
 struct Lisp_Buffer_Objfwd
   {
-    int type : 16;     /* = Lisp_Misc_Buffer_Objfwd */
-    unsigned gcmarkbit : 1;
-    int spacer : 15;
-    Lisp_Object slottype; /* Qnil, Lisp_Int, Lisp_Symbol, or Lisp_String.  */
+    enum Lisp_Fwd_Type type;   /* = Lisp_Fwd_Buffer_Obj */
     int offset;
+    Lisp_Object slottype; /* Qnil, Lisp_Int, Lisp_Symbol, or Lisp_String.  */
   };
 
 /* struct Lisp_Buffer_Local_Value is used in a symbol value cell when
@@ -1316,48 +1329,51 @@ struct Lisp_Buffer_Objfwd
 
 struct Lisp_Buffer_Local_Value
   {
-    int type : 16;      /* = Lisp_Misc_Buffer_Local_Value  */
-    unsigned gcmarkbit : 1;
-    int spacer : 11;
-
     /* 1 means that merely setting the variable creates a local
        binding for the current buffer */
     unsigned int local_if_set : 1;
-    /* 1 means this variable is allowed to have frame-local bindings,
-       so check for them when looking for the proper binding.  */
-    unsigned int check_frame : 1;
-    /* 1 means that the binding now loaded was found
-       as a local binding for the buffer in the `buffer' slot.  */
-    unsigned int found_for_buffer : 1;
-    /* 1 means that the binding now loaded was found
-       as a local binding for the frame in the `frame' slot.  */
-    unsigned int found_for_frame : 1;
-    Lisp_Object realvalue;
-    /* The buffer and frame for which the loaded binding was found.  */
-    /* Having both is only needed if we want to allow variables that are
-       both buffer local and frame local (in which case, we currently give
-       precedence to the buffer-local binding).  I don't think such
-       a combination is desirable.  --Stef  */
-    Lisp_Object buffer, frame;
-
-    /* A cons cell, (LOADED-BINDING . DEFAULT-VALUE).
-
-       LOADED-BINDING is the binding now loaded.  It is a cons cell
-       whose cdr is the binding's value.  The cons cell may be an
-       element of a buffer's local-variable alist, or an element of a
-       frame's parameter alist, or it may be this cons cell.
-
-       DEFAULT-VALUE is the variable's default value, seen when the
-       current buffer and selected frame do not have their own
-       bindings for the variable.  When the default binding is loaded,
-       LOADED-BINDING is actually this very cons cell; thus, its car
-       points to itself.  */
-    Lisp_Object cdr;
+    /* 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) */
+    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.  */
+    /* The buffer or frame for which the loaded binding was found.  */
+    Lisp_Object where;
+    /* A cons cell that holds the default value.  It has the form
+       (SYMBOL . DEFAULT-VALUE).  */
+    Lisp_Object defcell;
+    /* The cons cell from `where's parameter alist.
+       It always has the form (SYMBOL . VALUE)
+       Note that if `forward' is non-nil, VALUE may be out of date.
+       Also if the currently loaded binding is the default binding, then
+       this is `eq'ual to defcell.  */
+    Lisp_Object valcell;
   };
 
+#define BLV_FOUND(blv) \
+  (eassert ((blv)->found == !EQ ((blv)->defcell, (blv)->valcell)), (blv)->found)
+#define SET_BLV_FOUND(blv, v) \
+  (eassert ((v) == !EQ ((blv)->defcell, (blv)->valcell)), (blv)->found = (v))
+
+#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 Lisp_Misc_Type type : 16;     /* = Lisp_Misc_Overlay */
     unsigned gcmarkbit : 1;
@@ -1370,9 +1386,7 @@ struct Lisp_Overlay
    current kboard.  */
 struct Lisp_Kboard_Objfwd
   {
-    enum Lisp_Misc_Type type : 16;     /* = Lisp_Misc_Kboard_Objfwd */
-    unsigned gcmarkbit : 1;
-    int spacer : 15;
+    enum Lisp_Fwd_Type type;   /* = Lisp_Fwd_Kboard_Obj */
     int offset;
   };
 
@@ -1401,9 +1415,9 @@ struct Lisp_Free
 #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_Intfwd has the same size as "Lisp_Free w/o padding".  */
+       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_Intfwd)];
+                 << GCTYPEBITS) - sizeof (struct Lisp_Misc_Any)];
 #endif
   };
 
@@ -1414,15 +1428,18 @@ 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;
-    struct Lisp_Intfwd u_intfwd;
-    struct Lisp_Boolfwd u_boolfwd;
-    struct Lisp_Objfwd u_objfwd;
-    struct Lisp_Buffer_Objfwd u_buffer_objfwd;
-    struct Lisp_Buffer_Local_Value u_buffer_local_value;
-    struct Lisp_Overlay u_overlay;
-    struct Lisp_Kboard_Objfwd u_kboard_objfwd;
-    struct Lisp_Save_Value u_save_value;
+    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 */
   };
 \f
 /* Lisp floating point type */
@@ -1440,9 +1457,9 @@ struct Lisp_Float
   };
 
 #ifdef HIDE_LISP_IMPLEMENTATION
-#define XFLOAT_DATA(f) (XFLOAT (f)->u.data_ + 0)
+#define XFLOAT_DATA(f) (0 ? XFLOAT (f)->u.data_ : XFLOAT (f)->u.data_)
 #else
-#define XFLOAT_DATA(f) (XFLOAT (f)->u.data + 0)
+#define XFLOAT_DATA(f) (0 ? XFLOAT (f)->u.data :  XFLOAT (f)->u.data)
 /* This should be used only in alloc.c, which always disables
    HIDE_LISP_IMPLEMENTATION.  */
 #define XFLOAT_INIT(f,n) (XFLOAT (f)->u.data = (n))
@@ -1564,15 +1581,13 @@ typedef struct {
 #define VECTORP(x)    (VECTORLIKEP (x) && !(XVECTOR (x)->size & PSEUDOVECTOR_FLAG))
 #define OVERLAYP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Overlay)
 #define MARKERP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Marker)
-#define INTFWDP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Intfwd)
-#define BOOLFWDP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Boolfwd)
-#define OBJFWDP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Objfwd)
-#define BUFFER_OBJFWDP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Buffer_Objfwd)
-#define BUFFER_LOCAL_VALUEP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Buffer_Local_Value)
-#define SOME_BUFFER_LOCAL_VALUEP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Some_Buffer_Local_Value)
-#define KBOARD_OBJFWDP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Kboard_Objfwd)
 #define SAVE_VALUEP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Save_Value)
 
+#define INTFWDP(x) (XFWDTYPE (x) == Lisp_Fwd_Int)
+#define BOOLFWDP(x) (XFWDTYPE (x) == Lisp_Fwd_Bool)
+#define OBJFWDP(x) (XFWDTYPE (x) == Lisp_Fwd_Obj)
+#define BUFFER_OBJFWDP(x) (XFWDTYPE (x) == Lisp_Fwd_Buffer_Obj)
+#define KBOARD_OBJFWDP(x) (XFWDTYPE (x) == Lisp_Fwd_Kboard_Obj)
 
 /* True if object X is a pseudovector whose code is CODE.  */
 #define PSEUDOVECTORP(x, code)                                 \
@@ -1754,7 +1769,8 @@ typedef struct {
   Lisp_Object fnname DEFUN_ARGS_ ## maxargs ;                          \
   DECL_ALIGN (struct Lisp_Subr, sname) =                               \
     { PVEC_SUBR | (sizeof (struct Lisp_Subr) / sizeof (EMACS_INT)),    \
-      fnname, minargs, maxargs, lname, intspec, 0};                    \
+      { .a ## maxargs = fnname },                              \
+      minargs, maxargs, lname, intspec, 0};                            \
   Lisp_Object fnname
 
 /* Note that the weird token-substitution semantics of ANSI C makes
@@ -1784,29 +1800,49 @@ typedef struct {
 
 /* defsubr (Sname);
    is how we define the symbol for function `name' at start-up time.  */
-extern void defsubr P_ ((struct Lisp_Subr *));
+extern void defsubr (struct Lisp_Subr *);
 
 #define MANY -2
 #define UNEVALLED -1
 
-extern void defvar_lisp (const char *, Lisp_Object *);
-extern void defvar_lisp_nopro (const char *, Lisp_Object *);
-extern void defvar_bool (const char *, int *);
-extern void defvar_int (const char *, EMACS_INT *);
-extern void defvar_kboard (const char *, int);
+extern void defvar_lisp (struct Lisp_Objfwd *, const char *, Lisp_Object *);
+extern void defvar_lisp_nopro (struct Lisp_Objfwd *, const char *, Lisp_Object *);
+extern void defvar_bool (struct Lisp_Boolfwd *, const char *, int *);
+extern void defvar_int (struct Lisp_Intfwd *, const char *, EMACS_INT *);
+extern void defvar_kboard (struct Lisp_Kboard_Objfwd *, const char *, int);
 
 /* Macros we use to define forwarded Lisp variables.
    These are used in the syms_of_FILENAME functions.  */
 
-#define DEFVAR_LISP(lname, vname, doc) defvar_lisp (lname, vname)
-#define DEFVAR_LISP_NOPRO(lname, vname, doc) defvar_lisp_nopro (lname, vname)
-#define DEFVAR_BOOL(lname, vname, doc) defvar_bool (lname, vname)
-#define DEFVAR_INT(lname, vname, doc) defvar_int (lname, vname)
+#define DEFVAR_LISP(lname, vname, doc)         \
+  do {                                         \
+    static struct Lisp_Objfwd o_fwd;           \
+    defvar_lisp (&o_fwd, lname, vname);                \
+  } while (0)
+#define DEFVAR_LISP_NOPRO(lname, vname, doc)   \
+  do {                                         \
+    static struct Lisp_Objfwd o_fwd;           \
+    defvar_lisp_nopro (&o_fwd, lname, vname);  \
+  } while (0)
+#define DEFVAR_BOOL(lname, vname, doc)         \
+  do {                                         \
+    static struct Lisp_Boolfwd b_fwd;          \
+    defvar_bool (&b_fwd, lname, vname);                \
+  } while (0)
+#define DEFVAR_INT(lname, vname, doc)          \
+  do {                                         \
+    static struct Lisp_Intfwd i_fwd;           \
+    defvar_int (&i_fwd, lname, vname);         \
+  } while (0)
 
-#define DEFVAR_KBOARD(lname, vname, doc) \
- defvar_kboard (lname, \
-               (int)((char *)(&current_kboard->vname) \
-                     - (char *)current_kboard))
+#define DEFVAR_KBOARD(lname, vname, doc)                       \
+  do {                                                         \
+    static struct Lisp_Kboard_Objfwd ko_fwd;                   \
+    defvar_kboard (&ko_fwd,                                    \
+                  lname,                                       \
+                  (int)((char *)(&current_kboard->vname)       \
+                        - (char *)current_kboard));            \
+  } while (0)
 
 
 \f
@@ -1830,7 +1866,7 @@ extern void defvar_kboard (const char *, int);
    WHERE being a buffer or frame means we saw a buffer-local or frame-local
    value.  Other values of WHERE mean an internal error.  */
 
-typedef Lisp_Object (*specbinding_func) P_ ((Lisp_Object));
+typedef Lisp_Object (*specbinding_func) (Lisp_Object);
 
 struct specbinding
   {
@@ -1930,7 +1966,7 @@ extern char *stack_bottom;
    and (in particular) cannot call arbitrary Lisp code.  */
 
 #ifdef SYNC_INPUT
-extern void process_pending_signals P_ ((void));
+extern void process_pending_signals (void);
 extern int pending_signals;
 #define ELSE_PENDING_SIGNALS                           \
   else if (pending_signals)                            \
@@ -2203,7 +2239,7 @@ while (0)
 
 /* Call staticpro (&var) to protect static variable `var'.  */
 
-void staticpro P_ ((Lisp_Object *));
+void staticpro (Lisp_Object *);
 \f
 /* Declare a Lisp-callable function.  The MAXARGS parameter has the same
    meaning as in the DEFUN macro, and is used to construct a prototype.  */
@@ -2226,7 +2262,8 @@ extern Lisp_Object Qinvalid_function, Qwrong_number_of_arguments, Qno_catch;
 extern Lisp_Object 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;
+extern Lisp_Object Qcircular_list;
 extern Lisp_Object Qintegerp, Qnatnump, Qwholenump, Qsymbolp, Qlistp, Qconsp;
 extern Lisp_Object Qstringp, Qarrayp, Qsequencep, Qbufferp;
 extern Lisp_Object Qchar_or_string_p, Qmarkerp, Qinteger_or_marker_p, Qvectorp;
@@ -2246,7 +2283,7 @@ extern Lisp_Object Qinteger;
 
 extern Lisp_Object Qfont_spec, Qfont_entity, Qfont_object;
 
-extern void circular_list_error P_ ((Lisp_Object)) NO_RETURN;
+extern void circular_list_error (Lisp_Object) NO_RETURN;
 EXFUN (Finteractive_form, 1);
 EXFUN (Fbyteorder, 0);
 
@@ -2289,12 +2326,12 @@ EXFUN (Ffmakunbound, 1);
 EXFUN (Fsymbol_function, 1);
 EXFUN (Fsymbol_plist, 1);
 EXFUN (Fsymbol_name, 1);
-extern Lisp_Object indirect_function P_ ((Lisp_Object));
+extern Lisp_Object indirect_function (Lisp_Object);
 EXFUN (Findirect_function, 2);
 EXFUN (Ffset, 2);
 EXFUN (Fsetplist, 2);
 EXFUN (Fsymbol_value, 1);
-extern Lisp_Object find_symbol_value P_ ((Lisp_Object));
+extern Lisp_Object find_symbol_value (Lisp_Object);
 EXFUN (Fset, 2);
 EXFUN (Fdefault_value, 1);
 EXFUN (Fset_default, 2);
@@ -2334,68 +2371,64 @@ EXFUN (Fsub1, 1);
 EXFUN (Fmake_variable_buffer_local, 1);
 
 extern struct Lisp_Symbol *indirect_variable (struct Lisp_Symbol *);
-extern Lisp_Object long_to_cons P_ ((unsigned long));
-extern unsigned long cons_to_long P_ ((Lisp_Object));
-extern void args_out_of_range P_ ((Lisp_Object, Lisp_Object)) NO_RETURN;
-extern void args_out_of_range_3 P_ ((Lisp_Object, Lisp_Object,
-                                    Lisp_Object)) NO_RETURN;
-extern Lisp_Object wrong_type_argument P_ ((Lisp_Object, Lisp_Object)) NO_RETURN;
-extern void store_symval_forwarding P_ ((Lisp_Object, Lisp_Object,
-                                        Lisp_Object, struct buffer *));
-extern Lisp_Object do_symval_forwarding P_ ((Lisp_Object));
-extern Lisp_Object set_internal P_ ((Lisp_Object, Lisp_Object, struct buffer *, int));
-extern void syms_of_data P_ ((void));
-extern void init_data P_ ((void));
-extern void swap_in_global_binding P_ ((Lisp_Object));
+extern Lisp_Object long_to_cons (unsigned long);
+extern unsigned long cons_to_long (Lisp_Object);
+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 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);
+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 int internal_self_insert P_ ((int, int));
-extern void syms_of_cmds P_ ((void));
-extern void keys_of_cmds P_ ((void));
+extern void syms_of_cmds (void);
+extern void keys_of_cmds (void);
 
 /* Defined in coding.c */
 EXFUN (Fcoding_system_p, 1);
 EXFUN (Fcoding_system_base, 1);
 EXFUN (Fcoding_system_eol_type, 1);
 EXFUN (Fcheck_coding_system, 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 (Fupdate_coding_systems_internal, 0);
 EXFUN (Fencode_coding_string, 4);
 EXFUN (Fdecode_coding_string, 4);
-extern Lisp_Object detect_coding_system P_ ((const unsigned char *, EMACS_INT,
-                                            EMACS_INT, int, int, Lisp_Object));
-extern void init_coding P_ ((void));
-extern void init_coding_once P_ ((void));
-extern void syms_of_coding P_ ((void));
+extern Lisp_Object detect_coding_system (const unsigned char *, EMACS_INT,
+                                         EMACS_INT, 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 */
-extern void init_character_once P_ ((void));
-extern void syms_of_character P_ ((void));
+extern void init_character_once (void);
+extern void syms_of_character (void);
 EXFUN (Funibyte_char_to_multibyte, 1);
 
 /* Defined in charset.c */
 EXFUN (Fchar_bytes, 1);
 EXFUN (Fchar_width, 1);
 EXFUN (Fstring, MANY);
-extern EMACS_INT chars_in_text P_ ((const unsigned char *, EMACS_INT));
-extern EMACS_INT multibyte_chars_in_text P_ ((const unsigned char *, EMACS_INT));
-extern int multibyte_char_to_unibyte P_ ((int, Lisp_Object));
-extern int multibyte_char_to_unibyte_safe P_ ((int));
+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, Lisp_Object);
+extern int multibyte_char_to_unibyte_safe (int);
 extern Lisp_Object Qcharset;
-extern void init_charset P_ ((void));
-extern void init_charset_once P_ ((void));
-extern void syms_of_charset P_ ((void));
+extern void init_charset (void);
+extern void init_charset_once (void);
+extern void syms_of_charset (void);
 /* Structure forward declarations.  */
 struct charset;
 
 /* Defined in composite.c */
-extern void syms_of_composite P_ ((void));
+extern void syms_of_composite (void);
 
 /* Defined in syntax.c */
 EXFUN (Fforward_word, 1);
@@ -2404,28 +2437,31 @@ EXFUN (Fskip_chars_backward, 2);
 EXFUN (Fsyntax_table_p, 1);
 EXFUN (Fsyntax_table, 0);
 EXFUN (Fset_syntax_table, 1);
-extern void init_syntax_once P_ ((void));
-extern void syms_of_syntax P_ ((void));
+extern void init_syntax_once (void);
+extern void syms_of_syntax (void);
 
 /* Defined in fns.c */
+extern Lisp_Object QCrehash_size, QCrehash_threshold;
 extern int use_dialog_box;
-extern int next_almost_prime P_ ((int));
-extern Lisp_Object larger_vector P_ ((Lisp_Object, int, Lisp_Object));
-extern void sweep_weak_hash_tables P_ ((void));
+extern int use_file_dialog;
+extern int next_almost_prime (int);
+extern Lisp_Object larger_vector (Lisp_Object, int, Lisp_Object);
+extern void sweep_weak_hash_tables (void);
+extern Lisp_Object Qcursor_in_echo_area;
 extern Lisp_Object Qstring_lessp;
 extern Lisp_Object Vfeatures;
-extern Lisp_Object QCtest, QCweakness, Qequal, Qeq;
-unsigned sxhash P_ ((Lisp_Object, int));
-Lisp_Object make_hash_table P_ ((Lisp_Object, Lisp_Object, Lisp_Object,
-                                Lisp_Object, Lisp_Object, Lisp_Object,
-                                Lisp_Object));
-Lisp_Object copy_hash_table P_ ((struct Lisp_Hash_Table *));
-int hash_lookup P_ ((struct Lisp_Hash_Table *, Lisp_Object, unsigned *));
-int hash_put P_ ((struct Lisp_Hash_Table *, Lisp_Object, Lisp_Object,
-                 unsigned));
-void hash_clear P_ ((struct Lisp_Hash_Table *));
-void init_weak_hash_tables P_ ((void));
-extern void init_fns P_ ((void));
+extern Lisp_Object QCsize, QCtest, QCweakness, Qequal, Qeq, Qeql;
+unsigned sxhash (Lisp_Object, int);
+Lisp_Object make_hash_table (Lisp_Object, Lisp_Object, Lisp_Object,
+                             Lisp_Object, Lisp_Object, Lisp_Object,
+                             Lisp_Object);
+Lisp_Object copy_hash_table (struct Lisp_Hash_Table *);
+int hash_lookup (struct Lisp_Hash_Table *, Lisp_Object, unsigned *);
+int hash_put (struct Lisp_Hash_Table *, Lisp_Object, Lisp_Object,
+              unsigned);
+void hash_clear (struct Lisp_Hash_Table *);
+void init_weak_hash_tables (void);
+extern void init_fns (void);
 EXFUN (Fsxhash, 1);
 EXFUN (Fmake_hash_table, MANY);
 EXFUN (Fmakehash, 1);
@@ -2459,7 +2495,7 @@ EXFUN (Fstring_as_unibyte, 1);
 EXFUN (Fstring_to_multibyte, 1);
 EXFUN (Fstring_to_unibyte, 1);
 EXFUN (Fsubstring, 3);
-extern Lisp_Object substring_both P_ ((Lisp_Object, int, int, int, int));
+extern Lisp_Object substring_both (Lisp_Object, int, int, int, int);
 EXFUN (Fnth, 2);
 EXFUN (Fnthcdr, 2);
 EXFUN (Fmemq, 2);
@@ -2481,20 +2517,20 @@ EXFUN (Fnconc, MANY);
 EXFUN (Fmapcar, 2);
 EXFUN (Fmapconcat, 3);
 EXFUN (Fy_or_n_p, 1);
-extern Lisp_Object do_yes_or_no_p P_ ((Lisp_Object));
+extern Lisp_Object do_yes_or_no_p (Lisp_Object);
 EXFUN (Frequire, 3);
 EXFUN (Fprovide, 2);
-extern Lisp_Object concat2 P_ ((Lisp_Object, Lisp_Object));
-extern Lisp_Object concat3 P_ ((Lisp_Object, Lisp_Object, Lisp_Object));
-extern Lisp_Object nconc2 P_ ((Lisp_Object, Lisp_Object));
-extern Lisp_Object assq_no_quit P_ ((Lisp_Object, Lisp_Object));
-extern Lisp_Object assoc_no_quit P_ ((Lisp_Object, Lisp_Object));
-extern void clear_string_char_byte_cache P_ ((void));
-extern EMACS_INT string_char_to_byte P_ ((Lisp_Object, EMACS_INT));
-extern EMACS_INT string_byte_to_char P_ ((Lisp_Object, EMACS_INT));
-extern Lisp_Object string_make_multibyte P_ ((Lisp_Object));
-extern Lisp_Object string_to_multibyte P_ ((Lisp_Object));
-extern Lisp_Object string_make_unibyte P_ ((Lisp_Object));
+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 Lisp_Object string_make_multibyte (Lisp_Object);
+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);
@@ -2503,24 +2539,28 @@ EXFUN (Frassoc, 2);
 EXFUN (Fstring_equal, 2);
 EXFUN (Fcompare_strings, 7);
 EXFUN (Fstring_lessp, 2);
-extern void syms_of_fns P_ ((void));
+extern void syms_of_fns (void);
 
 /* Defined in floatfns.c */
-extern double extract_float P_ ((Lisp_Object));
+extern double extract_float (Lisp_Object);
 EXFUN (Ffloat, 1);
 EXFUN (Ftruncate, 2);
-extern void init_floatfns P_ ((void));
-extern void syms_of_floatfns P_ ((void));
+extern void init_floatfns (void);
+extern void syms_of_floatfns (void);
+extern Lisp_Object fmod_float (Lisp_Object x, Lisp_Object y);
 
 /* Defined in fringe.c */
-extern void syms_of_fringe P_ ((void));
-extern void init_fringe P_ ((void));
-extern void init_fringe_once P_ ((void));
+extern void syms_of_fringe (void);
+extern void init_fringe (void);
+extern void init_fringe_once (void);
 
 /* Defined in image.c */
+extern Lisp_Object QCascent, QCmargin, QCrelief, Qcount, Qextension_data;
+extern Lisp_Object QCconversion, QCcolor_symbols, QCheuristic_mask;
+extern Lisp_Object QCindex, QCmatrix, QCcolor_adjustment, QCmask;
 EXFUN (Finit_image_library, 2);
-extern void syms_of_image P_ ((void));
-extern void init_image P_ ((void));
+extern void syms_of_image (void);
+extern void init_image (void);
 
 /* Defined in insdel.c */
 extern Lisp_Object Qinhibit_modification_hooks;
@@ -2571,85 +2611,99 @@ 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,
-                            char *, EMACS_INT, EMACS_INT, int);
+                            const char *, EMACS_INT, EMACS_INT, int);
 extern void syms_of_insdel (void);
 
 /* Defined in dispnew.c */
 extern Lisp_Object selected_frame;
+extern Lisp_Object Vwindow_system_version;
 extern EMACS_INT baud_rate;
 EXFUN (Fding, 1);
 EXFUN (Fredraw_frame, 1);
 EXFUN (Fredraw_display, 0);
 EXFUN (Fsleep_for, 2);
 EXFUN (Fredisplay, 1);
-extern Lisp_Object sit_for P_ ((Lisp_Object, int, int));
-extern void init_display P_ ((void));
-extern void syms_of_display P_ ((void));
-extern void safe_bcopy P_ ((const char *, char *, int));
+extern Lisp_Object sit_for (Lisp_Object, int, int);
+extern void init_display (void);
+extern void syms_of_display (void);
 
 /* Defined in xdisp.c */
 extern Lisp_Object Qinhibit_point_motion_hooks;
 extern Lisp_Object Qinhibit_redisplay, Qdisplay;
 extern Lisp_Object Qinhibit_eval_during_redisplay;
 extern Lisp_Object Qmessage_truncate_lines;
-extern Lisp_Object Qimage;
+extern Lisp_Object Qmenu_bar_update_hook;
+extern Lisp_Object Qwindow_scroll_functions, Vwindow_scroll_functions;
+extern Lisp_Object Qoverriding_local_map, Qoverriding_terminal_local_map;
+extern Lisp_Object Qimage, Qtext, Qboth, Qboth_horiz, Qtext_image_horiz;
+extern Lisp_Object Qspace, Qcenter, QCalign_to;
+extern Lisp_Object Qbar, Qhbar, Qbox, Qhollow;
+extern Lisp_Object Qleft_margin, Qright_margin;
 extern Lisp_Object Vmessage_log_max;
+extern Lisp_Object QCdata, QCfile;
+extern Lisp_Object QCmap;
+extern Lisp_Object Qrisky_local_variable;
+extern Lisp_Object Vinhibit_redisplay;
 extern int message_enable_multibyte;
+extern int noninteractive_need_newline;
+extern EMACS_INT scroll_margin;
 extern Lisp_Object echo_area_buffer[2];
-extern void check_message_stack P_ ((void));
-extern void setup_echo_area_for_printing P_ ((int));
-extern int push_message P_ ((void));
-extern Lisp_Object pop_message_unwind P_ ((Lisp_Object));
-extern Lisp_Object restore_message_unwind P_ ((Lisp_Object));
-extern void pop_message P_ ((void));
-extern void restore_message P_ ((void));
-extern Lisp_Object current_message P_ ((void));
-extern void set_message P_ ((const char *s, Lisp_Object, int, int));
-extern void clear_message P_ ((int, int));
-extern void message P_ ((/* char *, ... */));
-extern void message_nolog P_ ((/* char *, ... */));
-extern void message1 P_ ((char *));
-extern void message1_nolog P_ ((char *));
-extern void message2 P_ ((const char *, int, int));
-extern void message2_nolog P_ ((const char *, int, int));
-extern void message3 P_ ((Lisp_Object, int, int));
-extern void message3_nolog P_ ((Lisp_Object, int, int));
-extern void message_dolog P_ ((const char *, int, int, int));
-extern void message_with_string P_ ((char *, Lisp_Object, int));
-extern void message_log_maybe_newline P_ ((void));
-extern void update_echo_area P_ ((void));
-extern void truncate_echo_area P_ ((int));
-extern void redisplay P_ ((void));
+extern void add_to_log (const char *, Lisp_Object, Lisp_Object);
+extern void check_message_stack (void);
+extern void setup_echo_area_for_printing (int);
+extern int push_message (void);
+extern Lisp_Object pop_message_unwind (Lisp_Object);
+extern Lisp_Object restore_message_unwind (Lisp_Object);
+extern void pop_message (void);
+extern void restore_message (void);
+extern Lisp_Object current_message (void);
+extern void set_message (const char *s, Lisp_Object, int, int);
+extern void clear_message (int, int);
+extern void message (const char *, ...);
+extern void message_nolog (const char *, ...);
+extern void message1 (const char *);
+extern void message1_nolog (const char *);
+extern void message2 (const char *, int, int);
+extern void message2_nolog (const char *, int, int);
+extern void message3 (Lisp_Object, int, int);
+extern void message3_nolog (Lisp_Object, int, int);
+extern void message_dolog (const char *, int, 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 (int);
+extern void redisplay (void);
 extern int check_point_in_composition
-       P_ ((struct buffer *, int, struct buffer *, int));
-extern void redisplay_preserve_echo_area P_ ((int));
-extern void prepare_menu_bars P_ ((void));
+        (struct buffer *, int, struct buffer *, int);
+extern void redisplay_preserve_echo_area (int);
+extern void prepare_menu_bars (void);
 
-void set_frame_cursor_types P_ ((struct frame *, Lisp_Object));
-extern void syms_of_xdisp P_ ((void));
-extern void init_xdisp P_ ((void));
-extern Lisp_Object safe_eval P_ ((Lisp_Object));
-extern int pos_visible_p P_ ((struct window *, int, int *,
-                             int *, int *, int *, int *, int *));
+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 *, int, int *,
+                          int *, int *, int *, int *, int *);
 
 /* Defined in xsettings.c */
-extern void syms_of_xsettings P_ ((void));
+extern void syms_of_xsettings (void);
 
 /* Defined in vm-limit.c.  */
-extern void memory_warnings P_ ((POINTER_TYPE *, void (*warnfun) ()));
+extern void memory_warnings (POINTER_TYPE *, void (*warnfun) (const char *));
 
 /* Defined in alloc.c */
-extern void check_pure_size P_ ((void));
-extern void allocate_string_data P_ ((struct Lisp_String *, int, int));
-extern void reset_malloc_hooks P_ ((void));
-extern void uninterrupt_malloc P_ ((void));
-extern void malloc_warning P_ ((char *));
-extern void memory_full P_ ((void)) NO_RETURN;
-extern void buffer_memory_full P_ ((void)) NO_RETURN;
-extern int survives_gc_p P_ ((Lisp_Object));
-extern void mark_object P_ ((Lisp_Object));
+extern void check_pure_size (void);
+extern void allocate_string_data (struct Lisp_String *, int, int);
+extern void reset_malloc_hooks (void);
+extern void uninterrupt_malloc (void);
+extern void malloc_warning (const char *);
+extern void memory_full (void) NO_RETURN;
+extern void buffer_memory_full (void) NO_RETURN;
+extern int survives_gc_p (Lisp_Object);
+extern void mark_object (Lisp_Object);
 extern Lisp_Object Vpurify_flag;
 extern Lisp_Object Vmemory_full;
+extern Lisp_Object *stack_base;
 EXFUN (Fcons, 2);
 EXFUN (list1, 1);
 EXFUN (list2, 2);
@@ -2658,55 +2712,55 @@ EXFUN (list4, 4);
 EXFUN (list5, 5);
 EXFUN (Flist, MANY);
 EXFUN (Fmake_list, 2);
-extern Lisp_Object allocate_misc P_ ((void));
+extern Lisp_Object allocate_misc (void);
 EXFUN (Fmake_vector, 2);
 EXFUN (Fvector, MANY);
 EXFUN (Fmake_symbol, 1);
 EXFUN (Fmake_marker, 0);
 EXFUN (Fmake_string, 2);
-extern Lisp_Object build_string P_ ((const char *));
-extern Lisp_Object make_string P_ ((const char *, int));
-extern Lisp_Object make_unibyte_string P_ ((const char *, int));
-extern Lisp_Object make_multibyte_string P_ ((const char *, int, int));
-extern Lisp_Object make_event_array P_ ((int, Lisp_Object *));
-extern Lisp_Object make_uninit_string P_ ((int));
-extern Lisp_Object make_uninit_multibyte_string P_ ((int, int));
-extern Lisp_Object make_string_from_bytes P_ ((const char *, int, int));
-extern Lisp_Object make_specified_string P_ ((const char *, int, int, int));
+extern Lisp_Object build_string (const char *);
+extern Lisp_Object make_string (const char *, int);
+extern Lisp_Object make_unibyte_string (const char *, int);
+extern Lisp_Object make_multibyte_string (const char *, int, int);
+extern Lisp_Object make_event_array (int, Lisp_Object *);
+extern Lisp_Object make_uninit_string (int);
+extern Lisp_Object make_uninit_multibyte_string (int, int);
+extern Lisp_Object make_string_from_bytes (const char *, int, int);
+extern Lisp_Object make_specified_string (const char *, int, int, int);
 EXFUN (Fpurecopy, 1);
-extern Lisp_Object make_pure_string P_ ((const char *, int, int, int));
+extern Lisp_Object make_pure_string (const char *, int, int, int);
 extern Lisp_Object make_pure_c_string (const char *data);
-extern Lisp_Object pure_cons P_ ((Lisp_Object, Lisp_Object));
-extern Lisp_Object make_pure_vector P_ ((EMACS_INT));
+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 Lisp_Object Qchar_table_extra_slots;
-extern struct Lisp_Vector *allocate_vector P_ ((EMACS_INT));
-extern struct Lisp_Vector *allocate_pseudovector P_ ((int memlen, int lisplen, EMACS_INT tag));
+extern struct Lisp_Vector *allocate_vector (EMACS_INT);
+extern struct Lisp_Vector *allocate_pseudovector (int memlen, int lisplen, EMACS_INT tag);
 #define ALLOCATE_PSEUDOVECTOR(typ,field,tag)                           \
   ((typ*)                                                              \
    allocate_pseudovector                                               \
        (VECSIZE (typ), PSEUDOVECSIZE (typ, field), tag))
-extern struct Lisp_Hash_Table *allocate_hash_table P_ ((void));
-extern struct window *allocate_window P_ ((void));
-extern struct frame *allocate_frame P_ ((void));
-extern struct Lisp_Process *allocate_process P_ ((void));
-extern struct terminal *allocate_terminal P_ ((void));
+extern struct Lisp_Hash_Table *allocate_hash_table (void);
+extern struct window *allocate_window (void);
+extern struct frame *allocate_frame (void);
+extern struct Lisp_Process *allocate_process (void);
+extern struct terminal *allocate_terminal (void);
 extern int gc_in_progress;
 extern int abort_on_gc;
-extern Lisp_Object make_float P_ ((double));
-extern void display_malloc_warning P_ ((void));
-extern int inhibit_garbage_collection P_ ((void));
-extern Lisp_Object make_save_value P_ ((void *, int));
-extern void free_misc P_ ((Lisp_Object));
-extern void free_marker P_ ((Lisp_Object));
-extern void free_cons P_ ((struct Lisp_Cons *));
-extern void init_alloc_once P_ ((void));
-extern void init_alloc P_ ((void));
-extern void syms_of_alloc P_ ((void));
-extern struct buffer * allocate_buffer P_ ((void));
-extern int valid_lisp_object_p P_ ((Lisp_Object));
+extern Lisp_Object make_float (double);
+extern void display_malloc_warning (void);
+extern int inhibit_garbage_collection (void);
+extern Lisp_Object make_save_value (void *, int);
+extern void free_misc (Lisp_Object);
+extern void free_marker (Lisp_Object);
+extern void free_cons (struct Lisp_Cons *);
+extern void init_alloc_once (void);
+extern void init_alloc (void);
+extern void syms_of_alloc (void);
+extern struct buffer * allocate_buffer (void);
+extern int valid_lisp_object_p (Lisp_Object);
 
 /* Defined in chartab.c */
 EXFUN (Fmake_char_table, 2);
@@ -2719,23 +2773,28 @@ EXFUN (Fset_char_table_range, 3);
 EXFUN (Fset_char_table_default, 3);
 EXFUN (Foptimize_char_table, 2);
 EXFUN (Fmap_char_table, 2);
-extern Lisp_Object copy_char_table P_ ((Lisp_Object));
-extern Lisp_Object sub_char_table_ref P_ ((Lisp_Object, int));
-extern Lisp_Object char_table_ref P_ ((Lisp_Object, int));
-extern Lisp_Object char_table_ref_and_range P_ ((Lisp_Object, int,
-                                                int *, int *));
-extern Lisp_Object char_table_set P_ ((Lisp_Object, int, Lisp_Object));
-extern Lisp_Object char_table_set_range P_ ((Lisp_Object, int, int,
-                                            Lisp_Object));
-extern int char_table_translate P_ ((Lisp_Object, int));
-extern void map_char_table P_ ((void (*) (Lisp_Object, Lisp_Object,
-                                         Lisp_Object),
-                               Lisp_Object, Lisp_Object, Lisp_Object));
-extern void syms_of_chartab P_ ((void));
+extern Lisp_Object copy_char_table (Lisp_Object);
+extern Lisp_Object sub_char_table_ref (Lisp_Object, int);
+extern Lisp_Object char_table_ref (Lisp_Object, int);
+extern Lisp_Object char_table_ref_and_range (Lisp_Object, int,
+                                             int *, int *);
+extern Lisp_Object char_table_set (Lisp_Object, int, Lisp_Object);
+extern Lisp_Object char_table_set_range (Lisp_Object, int, int,
+                                         Lisp_Object);
+extern int char_table_translate (Lisp_Object, int);
+extern void map_char_table (void (*) (Lisp_Object, Lisp_Object,
+                            Lisp_Object),
+                            Lisp_Object, Lisp_Object, Lisp_Object);
+extern void map_char_table_for_charset (void (*c_function) (Lisp_Object, Lisp_Object),
+                                       Lisp_Object, Lisp_Object,
+                                       Lisp_Object, struct charset *,
+                                       unsigned, unsigned);
+extern void syms_of_chartab (void);
 
 /* Defined in print.c */
 extern Lisp_Object Vprin1_to_string_buffer;
-extern void debug_print P_ ((Lisp_Object));
+extern Lisp_Object Vprint_level, Vprint_length;
+extern void debug_print (Lisp_Object);
 EXFUN (Fprin1, 2);
 EXFUN (Fprin1_to_string, 2);
 EXFUN (Fprinc, 2);
@@ -2744,23 +2803,27 @@ EXFUN (Fprint, 2);
 EXFUN (Ferror_message_string, 1);
 extern Lisp_Object Vstandard_output, Qstandard_output;
 extern Lisp_Object Qexternal_debugging_output;
-extern void temp_output_buffer_setup P_ ((const char *));
+extern void temp_output_buffer_setup (const char *);
 extern int print_level, print_escape_newlines;
 extern Lisp_Object Qprint_escape_newlines;
-extern void write_string P_ ((char *, int));
-extern void write_string_1 P_ ((char *, int, Lisp_Object));
-extern void print_error_message P_ ((Lisp_Object, Lisp_Object, char *, Lisp_Object));
+extern void write_string (const char *, int);
+extern void write_string_1 (const char *, int, Lisp_Object);
+extern void print_error_message (Lisp_Object, Lisp_Object, const char *,
+                                Lisp_Object);
 extern Lisp_Object internal_with_output_to_temp_buffer
-       P_ ((const char *, Lisp_Object (*) (Lisp_Object), Lisp_Object));
-extern void float_to_string P_ ((unsigned char *, double));
-extern void syms_of_print P_ ((void));
+        (const char *, Lisp_Object (*) (Lisp_Object), Lisp_Object);
+extern void float_to_string (unsigned char *, double);
+extern void syms_of_print (void);
 
 /* Defined in doprnt.c */
-extern int doprnt P_ ((char *, int, char *, char *, int, char **));
+extern int doprnt (char *, int, const char *, const char *, va_list);
 
 /* Defined in lread.c */
+extern Lisp_Object Vafter_load_alist;
 extern Lisp_Object Qvariable_documentation, Qstandard_input;
+extern Lisp_Object Qbackquote, Qcomma, Qcomma_at, Qcomma_dot, Qfunction;
 extern Lisp_Object Vobarray, initial_obarray, Vstandard_input;
+extern int load_in_progress;
 EXFUN (Fread, 1);
 EXFUN (Fread_from_string, 3);
 EXFUN (Fintern, 2);
@@ -2770,27 +2833,29 @@ EXFUN (Fget_load_suffixes, 0);
 EXFUN (Fget_file_char, 0);
 EXFUN (Fread_char, 3);
 EXFUN (Fread_event, 3);
-extern Lisp_Object read_filtered_event P_ ((int, int, int, int, Lisp_Object));
+extern Lisp_Object read_filtered_event (int, int, int, int, Lisp_Object);
 EXFUN (Feval_region, 4);
-extern Lisp_Object check_obarray P_ ((Lisp_Object));
-extern Lisp_Object intern P_ ((const char *));
+extern Lisp_Object check_obarray (Lisp_Object);
+extern Lisp_Object intern (const char *);
 extern Lisp_Object intern_c_string (const char *);
-extern Lisp_Object make_symbol P_ ((char *));
-extern Lisp_Object oblookup P_ ((Lisp_Object, const char *, int, int));
+extern Lisp_Object make_symbol (const char *);
+extern Lisp_Object oblookup (Lisp_Object, const char *, int, int);
 #define LOADHIST_ATTACH(x) \
- if (initialized) Vcurrent_load_list = Fcons (x, Vcurrent_load_list)
+  do {                                                                 \
+    if (initialized) Vcurrent_load_list = Fcons (x, Vcurrent_load_list); \
+  } while (0)
 extern Lisp_Object Vcurrent_load_list;
 extern Lisp_Object Vload_history, Vload_suffixes, Vload_file_rep_suffixes;
-extern int openp P_ ((Lisp_Object, Lisp_Object, Lisp_Object,
-                     Lisp_Object *, Lisp_Object));
-extern int isfloat_string P_ ((char *, int));
-extern void map_obarray P_ ((Lisp_Object, void (*) (Lisp_Object, Lisp_Object),
-                            Lisp_Object));
-extern void dir_warning P_ ((char *, Lisp_Object));
-extern void close_load_descs P_ ((void));
-extern void init_obarray P_ ((void));
-extern void init_lread P_ ((void));
-extern void syms_of_lread P_ ((void));
+extern int openp (Lisp_Object, Lisp_Object, Lisp_Object,
+                  Lisp_Object *, Lisp_Object);
+extern int isfloat_string (const char *, int);
+extern void map_obarray (Lisp_Object, void (*) (Lisp_Object, Lisp_Object),
+                         Lisp_Object);
+extern void dir_warning (const char *, Lisp_Object);
+extern void close_load_descs (void);
+extern void init_obarray (void);
+extern void init_lread (void);
+extern void syms_of_lread (void);
 
 /* Defined in eval.c */
 extern Lisp_Object Qautoload, Qexit, Qinteractive, Qcommandp, Qdefun, Qmacro;
@@ -2799,7 +2864,8 @@ extern Lisp_Object Vautoload_queue;
 extern Lisp_Object Vdebug_on_error;
 extern Lisp_Object Vsignaling_function;
 extern int handling_signal;
-extern int interactive_p P_ ((int));
+extern int debug_on_next_call;
+extern int interactive_p (int);
 
 /* To run a normal hook, use the appropriate function from the list below.
    The calling convention:
@@ -2813,8 +2879,8 @@ EXFUN (Frun_hooks, MANY);
 EXFUN (Frun_hook_with_args, MANY);
 EXFUN (Frun_hook_with_args_until_success, MANY);
 EXFUN (Frun_hook_with_args_until_failure, MANY);
-extern Lisp_Object run_hook_list_with_args P_ ((Lisp_Object, int, Lisp_Object *));
-extern void run_hook_with_args_2 P_ ((Lisp_Object, Lisp_Object, Lisp_Object));
+extern Lisp_Object run_hook_list_with_args (Lisp_Object, int, Lisp_Object *);
+extern void run_hook_with_args_2 (Lisp_Object, Lisp_Object, Lisp_Object);
 EXFUN (Fand, UNEVALLED);
 EXFUN (For, UNEVALLED);
 EXFUN (Fif, UNEVALLED);
@@ -2834,48 +2900,56 @@ EXFUN (Fthrow, 2) NO_RETURN;
 EXFUN (Funwind_protect, UNEVALLED);
 EXFUN (Fcondition_case, UNEVALLED);
 EXFUN (Fsignal, 2);
-extern void xsignal P_ ((Lisp_Object, Lisp_Object)) NO_RETURN;
-extern void xsignal0 P_ ((Lisp_Object)) NO_RETURN;
-extern void xsignal1 P_ ((Lisp_Object, Lisp_Object)) NO_RETURN;
-extern void xsignal2 P_ ((Lisp_Object, Lisp_Object, Lisp_Object)) NO_RETURN;
-extern void xsignal3 P_ ((Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object)) NO_RETURN;
-extern void signal_error P_ ((char *, Lisp_Object)) NO_RETURN;
+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 (Fautoload, 5);
 EXFUN (Fcommandp, 2);
 EXFUN (Feval, 1);
 EXFUN (Fapply, MANY);
 EXFUN (Ffuncall, MANY);
 EXFUN (Fbacktrace, 0);
-extern Lisp_Object apply1 P_ ((Lisp_Object, Lisp_Object));
-extern Lisp_Object call0 P_ ((Lisp_Object));
-extern Lisp_Object call1 P_ ((Lisp_Object, Lisp_Object));
-extern Lisp_Object call2 P_ ((Lisp_Object, Lisp_Object, Lisp_Object));
-extern Lisp_Object call3 P_ ((Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object));
-extern Lisp_Object call4 P_ ((Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object));
-extern Lisp_Object call5 P_ ((Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object));
-extern Lisp_Object call6 P_ ((Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object));
+extern Lisp_Object apply1 (Lisp_Object, Lisp_Object);
+extern Lisp_Object call0 (Lisp_Object);
+extern Lisp_Object call1 (Lisp_Object, Lisp_Object);
+extern Lisp_Object call2 (Lisp_Object, Lisp_Object, Lisp_Object);
+extern Lisp_Object call3 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object);
+extern Lisp_Object call4 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object);
+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 apply_lambda P_ ((Lisp_Object, Lisp_Object, int));
-extern Lisp_Object internal_catch P_ ((Lisp_Object, Lisp_Object (*) (Lisp_Object), Lisp_Object));
-extern Lisp_Object internal_lisp_condition_case P_ ((Lisp_Object, Lisp_Object, Lisp_Object));
-extern Lisp_Object internal_condition_case P_ ((Lisp_Object (*) (void), Lisp_Object, Lisp_Object (*) (Lisp_Object)));
-extern Lisp_Object internal_condition_case_1 P_ ((Lisp_Object (*) (Lisp_Object), Lisp_Object, Lisp_Object, Lisp_Object (*) (Lisp_Object)));
-extern Lisp_Object internal_condition_case_2 P_ ((Lisp_Object (*) (int, Lisp_Object *), int, Lisp_Object *, Lisp_Object, Lisp_Object (*) (Lisp_Object)));
-extern void specbind P_ ((Lisp_Object, Lisp_Object));
-extern void record_unwind_protect P_ ((Lisp_Object (*) (Lisp_Object), Lisp_Object));
-extern Lisp_Object unbind_to P_ ((int, Lisp_Object));
-extern void error P_ ((/* char *, ... */)) NO_RETURN;
-extern void do_autoload P_ ((Lisp_Object, Lisp_Object));
-extern Lisp_Object un_autoload P_ ((Lisp_Object));
+extern Lisp_Object apply_lambda (Lisp_Object, Lisp_Object, int);
+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));
+extern Lisp_Object internal_condition_case_1 (Lisp_Object (*) (Lisp_Object), Lisp_Object, Lisp_Object, Lisp_Object (*) (Lisp_Object));
+extern Lisp_Object internal_condition_case_2 (Lisp_Object (*) (Lisp_Object, Lisp_Object), Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object (*) (Lisp_Object));
+extern Lisp_Object internal_condition_case_n (Lisp_Object (*) (int, Lisp_Object *), int, 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;
+extern void verror (const char *, va_list) NO_RETURN;
+extern void do_autoload (Lisp_Object, Lisp_Object);
+extern Lisp_Object un_autoload (Lisp_Object);
 EXFUN (Ffetch_bytecode, 1);
-extern void init_eval_once P_ ((void));
-extern Lisp_Object safe_call P_ ((int, Lisp_Object *));
-extern Lisp_Object safe_call1 P_ ((Lisp_Object, Lisp_Object));
+extern void init_eval_once (void);
+extern Lisp_Object safe_call (int, Lisp_Object *);
+extern Lisp_Object safe_call1 (Lisp_Object, Lisp_Object);
 extern Lisp_Object safe_call2 (Lisp_Object, Lisp_Object, Lisp_Object);
-extern void init_eval P_ ((void));
-extern void syms_of_eval P_ ((void));
+extern void init_eval (void);
+extern void syms_of_eval (void);
 
 /* Defined in editfns.c */
+extern Lisp_Object last_nonmenu_event;
+extern Lisp_Object Qfield;
+extern Lisp_Object Vinhibit_field_text_motion;
+extern Lisp_Object Vsystem_name;
+extern Lisp_Object Vuser_login_name;
 EXFUN (Fpropertize, MANY);
 EXFUN (Fcurrent_message, 0);
 EXFUN (Fgoto_char, 1);
@@ -2896,20 +2970,20 @@ EXFUN (Finsert_and_inherit, MANY);
 EXFUN (Finsert_before_markers, MANY);
 EXFUN (Finsert_buffer_substring, 3);
 EXFUN (Finsert_char, 3);
-extern void insert1 P_ ((Lisp_Object));
+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 P_ ((char *, Lisp_Object, Lisp_Object));
+extern Lisp_Object format2 (const char *, Lisp_Object, Lisp_Object);
 EXFUN (Fbuffer_substring, 2);
 EXFUN (Fbuffer_string, 0);
-extern Lisp_Object save_excursion_save P_ ((void));
-extern Lisp_Object save_restriction_save P_ ((void));
-extern Lisp_Object save_excursion_restore P_ ((Lisp_Object));
-extern Lisp_Object save_restriction_restore P_ ((Lisp_Object));
+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);
@@ -2917,33 +2991,32 @@ EXFUN (Fwiden, 0);
 EXFUN (Fuser_login_name, 1);
 EXFUN (Fsystem_name, 0);
 EXFUN (Fcurrent_time, 0);
-extern int clip_to_bounds P_ ((int, int, int));
-extern Lisp_Object make_buffer_string P_ ((int, int, int));
-extern Lisp_Object make_buffer_string_both P_ ((int, int, int, int, int));
-extern void init_editfns P_ ((void));
-extern void syms_of_editfns P_ ((void));
-extern Lisp_Object Vinhibit_field_text_motion;
+extern int clip_to_bounds (int, int, int);
+extern Lisp_Object make_buffer_string (int, int, int);
+extern Lisp_Object make_buffer_string_both (int, int, int, int, int);
+extern void init_editfns (void);
+extern void syms_of_editfns (void);
 EXFUN (Fconstrain_to_field, 5);
 EXFUN (Ffield_string, 1);
 EXFUN (Fdelete_field, 1);
 EXFUN (Ffield_beginning, 3);
 EXFUN (Ffield_end, 3);
 EXFUN (Ffield_string_no_properties, 1);
-extern void set_time_zone_rule P_ ((char *));
+extern void set_time_zone_rule (const char *);
 
 /* Defined in buffer.c */
-extern int mouse_face_overlay_overlaps P_ ((Lisp_Object));
-extern void nsberror P_ ((Lisp_Object)) NO_RETURN;
+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);
 EXFUN (Foverlay_buffer, 1);
-extern void adjust_overlays_for_insert P_ ((EMACS_INT, EMACS_INT));
-extern void adjust_overlays_for_delete P_ ((EMACS_INT, EMACS_INT));
-extern void fix_start_end_in_overlays P_ ((int, int));
-extern void report_overlay_modification P_ ((Lisp_Object, Lisp_Object, int,
-                                            Lisp_Object, Lisp_Object, Lisp_Object));
-extern int overlay_touches_p P_ ((int));
+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 (int, int);
+extern void report_overlay_modification (Lisp_Object, Lisp_Object, int,
+                                         Lisp_Object, Lisp_Object, Lisp_Object);
+extern int overlay_touches_p (int);
 extern Lisp_Object Vbuffer_alist, Vinhibit_read_only;
 EXFUN (Fbuffer_list, 1);
 EXFUN (Fget_buffer, 1);
@@ -2964,15 +3037,15 @@ EXFUN (Fbuffer_disable_undo, 1);
 EXFUN (Fbuffer_enable_undo, 1);
 EXFUN (Ferase_buffer, 0);
 extern Lisp_Object Qoverlayp;
-extern Lisp_Object Qevaporate;
-extern Lisp_Object get_truename_buffer P_ ((Lisp_Object));
+extern Lisp_Object Qpriority, Qwindow, Qevaporate, 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 P_ ((void));
-extern void init_buffer P_ ((void));
-extern void syms_of_buffer P_ ((void));
-extern void keys_of_buffer P_ ((void));
+extern void init_buffer_once (void);
+extern void init_buffer (void);
+extern void syms_of_buffer (void);
+extern void keys_of_buffer (void);
 
 /* Defined in marker.c */
 
@@ -2980,22 +3053,26 @@ EXFUN (Fmarker_position, 1);
 EXFUN (Fmarker_buffer, 1);
 EXFUN (Fcopy_marker, 2);
 EXFUN (Fset_marker, 3);
-extern int marker_position P_ ((Lisp_Object));
-extern int marker_byte_position P_ ((Lisp_Object));
-extern void clear_charpos_cache P_ ((struct buffer *));
-extern int charpos_to_bytepos P_ ((int));
-extern int buf_charpos_to_bytepos P_ ((struct buffer *, int));
-extern int buf_bytepos_to_charpos P_ ((struct buffer *, int));
-extern void unchain_marker P_ ((struct Lisp_Marker *marker));
-extern Lisp_Object set_marker_restricted P_ ((Lisp_Object, Lisp_Object, Lisp_Object));
-extern Lisp_Object set_marker_both P_ ((Lisp_Object, Lisp_Object, int, int));
-extern Lisp_Object set_marker_restricted_both P_ ((Lisp_Object, Lisp_Object,
-                                                  int, int));
-extern void syms_of_marker P_ ((void));
+extern int marker_position (Lisp_Object);
+extern int marker_byte_position (Lisp_Object);
+extern void clear_charpos_cache (struct buffer *);
+extern int charpos_to_bytepos (int);
+extern int buf_charpos_to_bytepos (struct buffer *, int);
+extern int buf_bytepos_to_charpos (struct buffer *, int);
+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, int, int);
+extern Lisp_Object set_marker_restricted_both (Lisp_Object, Lisp_Object,
+                                               int, int);
+extern void syms_of_marker (void);
 
 /* Defined in fileio.c */
 
 extern Lisp_Object Qfile_error;
+extern Lisp_Object Qfile_exists_p;
+extern Lisp_Object Qfile_directory_p;
+extern Lisp_Object Qinsert_file_contents;
+extern Lisp_Object Vauto_save_list_file_name;
 EXFUN (Ffind_file_name_handler, 2);
 EXFUN (Ffile_name_as_directory, 1);
 EXFUN (Fmake_temp_name, 1);
@@ -3008,7 +3085,7 @@ 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 P_ ((Lisp_Object, Lisp_Object));
+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);
@@ -3016,47 +3093,54 @@ EXFUN (Fwrite_region, 7);
 EXFUN (Ffile_readable_p, 1);
 EXFUN (Ffile_executable_p, 1);
 EXFUN (Fread_file_name, 6);
-extern Lisp_Object close_file_unwind P_ ((Lisp_Object));
-extern Lisp_Object restore_point_unwind P_ ((Lisp_Object));
-extern void report_file_error P_ ((const char *, Lisp_Object)) NO_RETURN;
-extern int internal_delete_file P_ ((Lisp_Object));
-extern void syms_of_fileio P_ ((void));
-extern Lisp_Object make_temp_name P_ ((Lisp_Object, int));
+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 int internal_delete_file (Lisp_Object);
+extern void syms_of_fileio (void);
+extern Lisp_Object make_temp_name (Lisp_Object, int);
 EXFUN (Fmake_symbolic_link, 3);
 extern Lisp_Object Qdelete_file;
 
 /* Defined in abbrev.c */
 
-extern void syms_of_abbrev P_ ((void));
+extern void syms_of_abbrev (void);
 
 /* Defined in search.c */
-extern void shrink_regexp_cache P_ ((void));
+extern void shrink_regexp_cache (void);
 EXFUN (Fstring_match, 3);
-extern void restore_search_regs P_ ((void));
+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 P_ ((void));
+extern void record_unwind_save_match_data (void);
 EXFUN (Flooking_at, 1);
-extern int fast_string_match P_ ((Lisp_Object, Lisp_Object));
-extern int fast_c_string_match_ignore_case P_ ((Lisp_Object, const char *));
-extern int fast_string_match_ignore_case P_ ((Lisp_Object, Lisp_Object));
-extern EMACS_INT fast_looking_at P_ ((Lisp_Object, EMACS_INT, EMACS_INT,
-                                     EMACS_INT, EMACS_INT, Lisp_Object));
-extern int scan_buffer P_ ((int, EMACS_INT, EMACS_INT, int, int *, int));
-extern int scan_newline P_ ((EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT,
-                            int, int));
-extern int find_next_newline P_ ((EMACS_INT, int));
-extern int find_next_newline_no_quit P_ ((EMACS_INT, int));
-extern int find_before_next_newline P_ ((EMACS_INT, EMACS_INT, int));
-extern void syms_of_search P_ ((void));
-extern void clear_regexp_cache P_ ((void));
+extern int fast_string_match (Lisp_Object, Lisp_Object);
+extern int fast_c_string_match_ignore_case (Lisp_Object, const char *);
+extern 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 int scan_buffer (int, EMACS_INT, EMACS_INT, int, int *, int);
+extern int scan_newline (EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT,
+                         int, int);
+extern int find_next_newline (EMACS_INT, int);
+extern int find_next_newline_no_quit (EMACS_INT, int);
+extern int find_before_next_newline (EMACS_INT, EMACS_INT, int);
+extern void syms_of_search (void);
+extern void clear_regexp_cache (void);
 
 /* Defined in minibuf.c */
 
+extern Lisp_Object Qcompletion_ignore_case;
+extern Lisp_Object Vcompletion_regexp_list;
+extern Lisp_Object Vhistory_length;
+extern Lisp_Object Vminibuffer_list;
 extern Lisp_Object last_minibuf_string;
-extern void choose_minibuf_frame P_ ((void));
+extern int completion_ignore_case;
+extern int history_delete_duplicates;
+extern int minibuffer_auto_raise;
+extern void choose_minibuf_frame (void);
 EXFUN (Fcompleting_read, 8);
 EXFUN (Fread_from_minibuffer, 7);
 EXFUN (Fread_variable, 2);
@@ -3066,57 +3150,65 @@ EXFUN (Feval_minibuffer, 2);
 EXFUN (Fread_string, 5);
 EXFUN (Fread_no_blanks_input, 3);
 EXFUN (Fassoc_string, 3);
-extern Lisp_Object get_minibuffer P_ ((int));
-extern void temp_echo_area_glyphs P_ ((Lisp_Object));
-extern void init_minibuf_once P_ ((void));
-extern void syms_of_minibuf P_ ((void));
+extern Lisp_Object get_minibuffer (int);
+extern void temp_echo_area_glyphs (Lisp_Object);
+extern void init_minibuf_once (void);
+extern void syms_of_minibuf (void);
 
 /* Defined in callint.c */
 
 extern Lisp_Object Qminus, Qplus, Vcurrent_prefix_arg;
+extern Lisp_Object Qwhen;
 extern Lisp_Object Vcommand_history;
+extern Lisp_Object Vmark_even_if_inactive;
 extern Lisp_Object Qcall_interactively, Qmouse_leave_buffer_hook;
 EXFUN (Fcall_interactively, 3);
 EXFUN (Fprefix_numeric_value, 1);
-extern void syms_of_callint P_ ((void));
+extern void syms_of_callint (void);
 
 /* Defined in casefiddle.c */
 
+extern Lisp_Object Qidentity;
 EXFUN (Fdowncase, 1);
 EXFUN (Fupcase, 1);
 EXFUN (Fcapitalize, 1);
 EXFUN (Fupcase_region, 2);
 EXFUN (Fupcase_initials, 1);
 EXFUN (Fupcase_initials_region, 2);
-extern void syms_of_casefiddle P_ ((void));
-extern void keys_of_casefiddle P_ ((void));
+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 P_ ((void));
-extern void syms_of_casetab P_ ((void));
+extern void init_casetab_once (void);
+extern void syms_of_casetab (void);
 
 /* Defined in keyboard.c */
 
 extern int echoing;
 extern Lisp_Object echo_message_buffer;
 extern struct kboard *echo_kboard;
-extern void cancel_echoing P_ ((void));
+extern void cancel_echoing (void);
 extern Lisp_Object Qdisabled, QCfilter;
+extern Lisp_Object Qabove_handle, Qhandle, Qbelow_handle;
+extern Lisp_Object Qup, Qdown, Qbottom, Qend_scroll;
+extern Lisp_Object Qtop, Qratio;
 extern Lisp_Object Vtty_erase_char, Vhelp_form, Vtop_level;
 extern Lisp_Object Vthrow_on_input;
 extern int input_pending;
 EXFUN (Fdiscard_input, 0);
 EXFUN (Frecursive_edit, 0);
-EXFUN (Ftop_level, 0);
+EXFUN (Ftop_level, 0) NO_RETURN;
+EXFUN (Fexit_recursive_edit, 0) NO_RETURN;
+EXFUN (Fabort_recursive_edit, 0) NO_RETURN;
 EXFUN (Fcommand_execute, 4);
 EXFUN (Finput_pending_p, 0);
-extern Lisp_Object menu_bar_items P_ ((Lisp_Object));
-extern Lisp_Object tool_bar_items P_ ((Lisp_Object, int *));
+extern Lisp_Object menu_bar_items (Lisp_Object);
+extern Lisp_Object tool_bar_items (Lisp_Object, int *);
 extern Lisp_Object Qvertical_scroll_bar;
-extern void discard_mouse_events P_ ((void));
+extern void discard_mouse_events (void);
 EXFUN (Fevent_convert_list, 1);
 EXFUN (Fread_key_sequence, 5);
 EXFUN (Fset_input_interrupt_mode, 1);
@@ -3125,18 +3217,18 @@ EXFUN (Fset_input_meta_mode, 2);
 EXFUN (Fset_quit_char, 1);
 EXFUN (Fset_input_mode, 4);
 extern Lisp_Object pending_funcalls;
-extern int detect_input_pending P_ ((void));
-extern int detect_input_pending_ignore_squeezables P_ ((void));
-extern int detect_input_pending_run_timers P_ ((int));
-extern void safe_run_hooks P_ ((Lisp_Object));
-extern void cmd_error_internal P_ ((Lisp_Object, char *));
-extern Lisp_Object command_loop_1 P_ ((void));
-extern Lisp_Object recursive_edit_1 P_ ((void));
-extern void record_auto_save P_ ((void));
-extern void init_keyboard P_ ((void));
-extern void syms_of_keyboard P_ ((void));
-extern void keys_of_keyboard P_ ((void));
-extern char *push_key_description P_ ((unsigned int, char *, int));
+extern int detect_input_pending (void);
+extern int detect_input_pending_ignore_squeezables (void);
+extern int detect_input_pending_run_timers (int);
+extern void safe_run_hooks (Lisp_Object);
+extern void cmd_error_internal (Lisp_Object, const char *);
+extern Lisp_Object command_loop_1 (void);
+extern Lisp_Object recursive_edit_1 (void);
+extern void record_auto_save (void);
+extern void init_keyboard (void);
+extern void syms_of_keyboard (void);
+extern void keys_of_keyboard (void);
+extern char *push_key_description (unsigned int, char *, int);
 
 
 /* Defined in indent.c */
@@ -3144,22 +3236,23 @@ EXFUN (Fvertical_motion, 2);
 EXFUN (Findent_to, 2);
 EXFUN (Fcurrent_column, 0);
 EXFUN (Fmove_to_column, 2);
-extern double current_column P_ ((void));
-extern void invalidate_current_column P_ ((void));
-extern int indented_beyond_p P_ ((int, int, double));
-extern void syms_of_indent P_ ((void));
+extern double current_column (void);
+extern void invalidate_current_column (void);
+extern int indented_beyond_p (int, int, double);
+extern void syms_of_indent (void);
 
 /* Defined in frame.c */
 #ifdef HAVE_WINDOW_SYSTEM
 extern Lisp_Object Vx_resource_name;
 extern Lisp_Object Vx_resource_class;
 #endif /* HAVE_WINDOW_SYSTEM */
+extern Lisp_Object Qonly;
 extern Lisp_Object Qvisible;
-extern void store_frame_param P_ ((struct frame *, Lisp_Object, Lisp_Object));
-extern void store_in_alist P_ ((Lisp_Object *, Lisp_Object, Lisp_Object));
-extern Lisp_Object do_switch_frame P_ ((Lisp_Object, int, int, Lisp_Object));
-extern Lisp_Object get_frame_param P_ ((struct frame *, Lisp_Object));
-extern Lisp_Object frame_buffer_predicate P_ ((Lisp_Object));
+extern void store_frame_param (struct frame *, Lisp_Object, Lisp_Object);
+extern void store_in_alist (Lisp_Object *, Lisp_Object, Lisp_Object);
+extern Lisp_Object do_switch_frame (Lisp_Object, int, int, Lisp_Object);
+extern Lisp_Object get_frame_param (struct frame *, Lisp_Object);
+extern Lisp_Object frame_buffer_predicate (Lisp_Object);
 EXFUN (Fframep, 1);
 EXFUN (Fselect_frame, 2);
 EXFUN (Fselected_frame, 0);
@@ -3186,30 +3279,37 @@ EXFUN (Fset_frame_position, 3);
 EXFUN (Fraise_frame, 1);
 EXFUN (Fredirect_frame_focus, 2);
 EXFUN (Fset_frame_selected_window, 3);
-extern Lisp_Object frame_buffer_list P_ ((Lisp_Object));
-extern void frames_discard_buffer P_ ((Lisp_Object));
-extern void set_frame_buffer_list P_ ((Lisp_Object, Lisp_Object));
-extern void frames_bury_buffer P_ ((Lisp_Object));
-extern void syms_of_frame P_ ((void));
+extern Lisp_Object frame_buffer_list (Lisp_Object);
+extern void frames_discard_buffer (Lisp_Object);
+extern void set_frame_buffer_list (Lisp_Object, Lisp_Object);
+extern void frames_bury_buffer (Lisp_Object);
+extern void syms_of_frame (void);
 
 /* Defined in emacs.c */
-extern Lisp_Object decode_env_path P_ ((char *, char *));
+extern char **initial_argv;
+extern int initial_argc;
+#if defined(HAVE_X_WINDOWS) || defined(HAVE_NS)
+extern int display_arg;
+#endif
+extern Lisp_Object decode_env_path (const char *, const char *);
 extern Lisp_Object Vinvocation_name, Vinvocation_directory;
 extern Lisp_Object Vbefore_init_time, Vafter_init_time;
 extern Lisp_Object Vinstallation_directory;
 extern Lisp_Object empty_unibyte_string, empty_multibyte_string;
-EXFUN (Fkill_emacs, 1);
+extern Lisp_Object Qfile_name_handler_alist;
+extern void (*fatal_error_signal_hook) (void);
+EXFUN (Fkill_emacs, 1) NO_RETURN;
 #if HAVE_SETLOCALE
-void fixup_locale P_ ((void));
-void synchronize_system_messages_locale P_ ((void));
-void synchronize_system_time_locale P_ ((void));
+void fixup_locale (void);
+void synchronize_system_messages_locale (void);
+void synchronize_system_time_locale (void);
 #else
 #define setlocale(category, locale)
 #define fixup_locale()
 #define synchronize_system_messages_locale()
 #define synchronize_system_time_locale()
 #endif
-void shut_down_emacs P_ ((int, int, Lisp_Object));
+void shut_down_emacs (int, int, Lisp_Object);
 /* Nonzero means don't do interactive redisplay and don't change tty modes.  */
 extern int noninteractive;
 
@@ -3227,6 +3327,7 @@ extern int inhibit_window_system;
 extern int running_asynch_code;
 
 /* Defined in process.c */
+extern Lisp_Object QCtype, Qlocal;
 EXFUN (Fget_process, 1);
 EXFUN (Fget_buffer_process, 1);
 EXFUN (Fprocessp, 1);
@@ -3235,94 +3336,99 @@ EXFUN (Fkill_process, 2);
 EXFUN (Fprocess_send_eof, 1);
 EXFUN (Fwaiting_for_user_input_p, 0);
 extern Lisp_Object Qprocessp;
-extern void kill_buffer_processes P_ ((Lisp_Object));
-extern int wait_reading_process_output P_ ((int, int, int, int,
-                                           Lisp_Object,
-                                           struct Lisp_Process *,
-                                           int));
-extern void add_keyboard_wait_descriptor P_ ((int));
-extern void delete_keyboard_wait_descriptor P_ ((int));
-extern void add_gpm_wait_descriptor P_ ((int));
-extern void delete_gpm_wait_descriptor P_ ((int));
-extern void close_process_descs P_ ((void));
-extern void init_process P_ ((void));
-extern void syms_of_process P_ ((void));
-extern void setup_process_coding_systems P_ ((Lisp_Object));
+extern void kill_buffer_processes (Lisp_Object);
+extern int wait_reading_process_output (int, int, int, int,
+                                        Lisp_Object,
+                                        struct Lisp_Process *,
+                                        int);
+extern void add_keyboard_wait_descriptor (int);
+extern void delete_keyboard_wait_descriptor (int);
+extern void add_gpm_wait_descriptor (int);
+extern void delete_gpm_wait_descriptor (int);
+extern void close_process_descs (void);
+extern void init_process (void);
+extern void syms_of_process (void);
+extern void setup_process_coding_systems (Lisp_Object);
 
 /* Defined in callproc.c */
 extern Lisp_Object Vexec_path, Vexec_suffixes,
                    Vexec_directory, Vdata_directory;
 extern Lisp_Object Vdoc_directory;
+extern Lisp_Object Vshell_file_name;
 EXFUN (Fcall_process, MANY);
-extern int child_setup P_ ((int, int, int, char **, int, Lisp_Object));
-extern void init_callproc_1 P_ ((void));
-extern void init_callproc P_ ((void));
-extern void set_initial_environment P_ ((void));
-extern void syms_of_callproc P_ ((void));
+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);
+extern void syms_of_callproc (void);
 
 /* Defined in doc.c */
+extern Lisp_Object Qfunction_documentation;
 extern Lisp_Object Vdoc_file_name;
 EXFUN (Fsubstitute_command_keys, 1);
 EXFUN (Fdocumentation, 2);
 EXFUN (Fdocumentation_property, 3);
-extern Lisp_Object read_doc_string P_ ((Lisp_Object));
-extern Lisp_Object get_doc_string P_ ((Lisp_Object, int, int));
-extern void syms_of_doc P_ ((void));
-extern int read_bytecode_char P_ ((int));
+extern Lisp_Object read_doc_string (Lisp_Object);
+extern Lisp_Object get_doc_string (Lisp_Object, int, int);
+extern void syms_of_doc (void);
+extern int read_bytecode_char (int);
 
 /* Defined in bytecode.c */
 extern Lisp_Object Qbytecode;
 EXFUN (Fbyte_code, 3);
-extern void syms_of_bytecode P_ ((void));
+extern void syms_of_bytecode (void);
 extern struct byte_stack *byte_stack_list;
-extern void mark_byte_stack P_ ((void));
-extern void unmark_byte_stack P_ ((void));
+extern void mark_byte_stack (void);
+extern void unmark_byte_stack (void);
 
 /* 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 P_ ((void));
-extern void syms_of_macros P_ ((void));
+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 P_ ((struct buffer *));
-extern void record_marker_adjustment P_ ((Lisp_Object, int));
-extern void record_insert P_ ((int, int));
-extern void record_delete P_ ((int, Lisp_Object));
-extern void record_first_change P_ ((void));
-extern void record_change P_ ((int, int));
-extern void record_property_change P_ ((int, int, Lisp_Object, Lisp_Object,
-                                       Lisp_Object));
-extern void syms_of_undo P_ ((void));
+extern void truncate_undo_list (struct buffer *);
+extern void record_marker_adjustment (Lisp_Object, int);
+extern void record_insert (int, int);
+extern void record_delete (int, Lisp_Object);
+extern void record_first_change (void);
+extern void record_change (int, int);
+extern void record_property_change (int, int, Lisp_Object, Lisp_Object,
+                                    Lisp_Object);
+extern void syms_of_undo (void);
 extern Lisp_Object Vundo_outer_limit;
 
 /* Defined in textprop.c */
 extern Lisp_Object Qfont, Qmouse_face;
 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 (Fget_text_property, 3);
 EXFUN (Fprevious_char_property_change, 2);
 EXFUN (Fnext_char_property_change, 2);
-extern void report_interval_modification P_ ((Lisp_Object, Lisp_Object));
-extern Lisp_Object next_single_char_property_change P_ ((Lisp_Object,
-                                                        Lisp_Object,
-                                                        Lisp_Object,
-                                                        Lisp_Object));
+extern void report_interval_modification (Lisp_Object, Lisp_Object);
+extern Lisp_Object next_single_char_property_change (Lisp_Object,
+                                                     Lisp_Object,
+                                                     Lisp_Object,
+                                                     Lisp_Object);
 
 /* Defined in menu.c */
-extern void syms_of_menu P_ ((void));
+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 P_ ((void));
+extern void syms_of_xmenu (void);
 
 /* Defined in termchar.h */
 struct tty_display_info;
@@ -3332,106 +3438,140 @@ struct terminal;
 
 /* Defined in sysdep.c */
 #ifndef HAVE_GET_CURRENT_DIR_NAME
-extern char *get_current_dir_name P_ ((void));
+extern char *get_current_dir_name (void);
+#endif
+extern void stuff_char (char c);
+extern void init_sigio (int);
+extern void sys_subshell (void);
+extern void sys_suspend (void);
+extern void discard_tty_input (void);
+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 flush_pending_output (int);
+extern void child_setup_tty (int);
+extern void setup_pty (int);
+extern int set_window_size (int, int, int);
+extern void create_process (Lisp_Object, char **, Lisp_Object);
+extern int emacs_open (const char *, int, int);
+extern int emacs_close (int);
+extern int emacs_read (int, char *, unsigned int);
+extern int emacs_write (int, const char *, unsigned int);
+#ifndef HAVE_MEMSET
+extern void *memset (void *, int, size_t);
+#endif
+#ifndef HAVE_MEMCPY
+extern void *memcpy (void *, void *, size_t);
+#endif
+#ifndef HAVE_MEMMOVE
+extern void *memmove (void *, void *, size_t);
+#endif
+#ifndef HAVE_MEMCMP
+extern int memcmp (void *, void *, size_t);
 #endif
-extern void stuff_char P_ ((char c));
-extern void init_sigio P_ ((int));
-extern void sys_subshell P_ ((void));
-extern void sys_suspend P_ ((void));
-extern void discard_tty_input P_ ((void));
-extern void init_sys_modes P_ ((struct tty_display_info *));
-extern void reset_sys_modes P_ ((struct tty_display_info *));
-extern void init_all_sys_modes P_ ((void));
-extern void reset_all_sys_modes P_ ((void));
-extern void wait_for_termination P_ ((int));
-extern void flush_pending_output P_ ((int));
-extern void child_setup_tty P_ ((int));
-extern void setup_pty P_ ((int));
-extern int set_window_size P_ ((int, int, int));
-extern void create_process P_ ((Lisp_Object, char **, Lisp_Object));
-extern int emacs_open P_ ((const char *, int, int));
-extern int emacs_close P_ ((int));
-extern int emacs_read P_ ((int, char *, unsigned int));
-extern int emacs_write P_ ((int, const char *, unsigned int));
 
 /* Defined in filelock.c */
+extern Lisp_Object Vtemporary_file_directory;
 EXFUN (Funlock_buffer, 0);
 EXFUN (Ffile_locked_p, 1);
-extern void unlock_all_files P_ ((void));
-extern void lock_file P_ ((Lisp_Object));
-extern void unlock_file P_ ((Lisp_Object));
-extern void unlock_buffer P_ ((struct buffer *));
-extern void syms_of_filelock P_ ((void));
-extern void init_filelock P_ ((void));
+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 P_ ((void));
-extern void init_sound P_ ((void));
+extern void syms_of_sound (void);
+extern void init_sound (void);
 
 /* Defined in category.c */
-extern void init_category_once P_ ((void));
-extern Lisp_Object char_category_set P_ ((int));
-extern void syms_of_category P_ ((void));
+extern void init_category_once (void);
+extern Lisp_Object char_category_set (int);
+extern void syms_of_category (void);
 
 /* Defined in ccl.c */
-extern void syms_of_ccl P_ ((void));
+extern void syms_of_ccl (void);
 
 /* Defined in dired.c */
 EXFUN (Ffile_attributes, 2);
-extern void syms_of_dired P_ ((void));
-extern Lisp_Object directory_files_internal P_ ((Lisp_Object, Lisp_Object,
-                                                Lisp_Object, Lisp_Object,
-                                                int, Lisp_Object));
+extern void syms_of_dired (void);
+extern Lisp_Object directory_files_internal (Lisp_Object, Lisp_Object,
+                                             Lisp_Object, Lisp_Object,
+                                             int, Lisp_Object);
 
 /* Defined in term.c */
-extern void syms_of_term P_ ((void));
-extern void fatal P_ ((const char *msgid, ...)) NO_RETURN;
+extern int *char_ins_del_vector;
+extern void syms_of_term (void);
+extern void fatal (const char *msgid, ...) NO_RETURN;
 
 /* Defined in terminal.c */
+EXFUN (Fframe_terminal, 1);
 EXFUN (Fdelete_terminal, 2);
-extern void syms_of_terminal P_ ((void));
+extern void syms_of_terminal (void);
 
 /* Defined in font.c */
-extern void syms_of_font P_ ((void));
-extern void init_font P_ ((void));
+extern void syms_of_font (void);
+extern void init_font (void);
 
 #ifdef HAVE_WINDOW_SYSTEM
 /* Defined in fontset.c */
-extern void syms_of_fontset P_ ((void));
+extern void syms_of_fontset (void);
 EXFUN (Fset_fontset_font, 5);
 EXFUN (Fnew_fontset, 2);
 
 /* Defined in xfns.c, w32fns.c, or macfns.c */
+extern Lisp_Object Qfont_param;
+extern Lisp_Object Vx_no_window_manager;
 EXFUN (Fxw_display_color_p, 1);
 EXFUN (Fx_file_dialog, 5);
 EXFUN (Fx_focus_frame, 1);
 #endif
 
 /* Defined in xfaces.c */
+extern Lisp_Object Qdefault, Qtool_bar, Qregion, Qfringe;
+extern Lisp_Object Qheader_line, Qscroll_bar, Qcursor, Qborder, Qmouse, Qmenu;
+extern Lisp_Object Qmode_line_inactive, Qvertical_border;
+extern Lisp_Object Qface;
+extern Lisp_Object Qnormal;
+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_font_rescale_alist;
+extern Lisp_Object Vface_ignored_fonts;
+extern Lisp_Object Vface_alternative_font_registry_alist;
+extern Lisp_Object Vscalable_fonts_allowed;
 EXFUN (Fclear_face_cache, 1);
 EXFUN (Fx_load_color_file, 1);
-extern void syms_of_xfaces P_ ((void));
+extern void syms_of_xfaces (void);
 
 #ifndef HAVE_GETLOADAVG
 /* Defined in getloadavg.c */
-extern int getloadavg P_ ((double *, int));
+extern int getloadavg (double *, int);
 #endif
 
 #ifdef HAVE_X_WINDOWS
 /* Defined in xfns.c */
-extern void syms_of_xfns P_ ((void));
+extern void syms_of_xfns (void);
 
 /* Defined in xsmfns.c */
-extern void syms_of_xsmfns P_ ((void));
+extern void syms_of_xsmfns (void);
 
 /* Defined in xselect.c */
 EXFUN (Fx_send_client_event, 6);
-extern void syms_of_xselect P_ ((void));
+extern void syms_of_xselect (void);
 
 /* Defined in xterm.c */
-extern void syms_of_xterm P_ ((void));
+extern void syms_of_xterm (void);
 #endif /* HAVE_X_WINDOWS */
 
+#ifdef HAVE_WINDOW_SYSTEM
+/* Defined in xterm.c, nsterm.m, w32term.c */
+extern char *x_get_keysym_name (int);
+#endif /* HAVE_WINDOW_SYSTEM */
+
 #ifdef MSDOS
 /* Defined in msdos.c */
 EXFUN (Fmsdos_downcase_filename, 1);
@@ -3439,15 +3579,20 @@ EXFUN (Fmsdos_downcase_filename, 1);
 
 #ifdef HAVE_MENUS
 /* Defined in (x|w32)fns.c, nsfns.m...  */
-extern int have_menus_p P_ ((void));
+extern int have_menus_p (void);
 #endif
 
 #ifdef HAVE_DBUS
 /* Defined in dbusbind.c */
-int xd_pending_messages P_ ((void));
-void xd_read_queued_messages P_ ((void));
-void syms_of_dbusbind P_ ((void));
+int xd_pending_messages (void);
+void xd_read_queued_messages (void);
+void syms_of_dbusbind (void);
 #endif
+
+#ifdef DOS_NT
+/* Defined in msdos.c, w32.c */
+extern char *emacs_root_dir (void);
+#endif /* DOS_NT */
 \f
 /* Nonzero means Emacs has already been initialized.
    Used during startup to detect startup of dumped Emacs.  */
@@ -3455,28 +3600,22 @@ extern int initialized;
 
 extern int immediate_quit;         /* Nonzero means ^G can quit instantly */
 
-extern POINTER_TYPE *xmalloc P_ ((size_t));
-extern POINTER_TYPE *xrealloc P_ ((POINTER_TYPE *, size_t));
-extern void xfree P_ ((POINTER_TYPE *));
+extern POINTER_TYPE *xmalloc (size_t);
+extern POINTER_TYPE *xrealloc (POINTER_TYPE *, size_t);
+extern void xfree (POINTER_TYPE *);
 
-extern char *xstrdup P_ ((const char *));
+extern char *xstrdup (const char *);
 
-extern char *egetenv P_ ((char *));
+extern char *egetenv (const char *);
 
 /* Set up the name of the machine we're running on.  */
-extern void init_system_name P_ ((void));
+extern void init_system_name (void);
 
 /* Some systems (e.g., NT) use a different path separator than Unix,
-   in addition to a device separator.  Default the path separator
+   in addition to a device separator.  Set the path separator
    to '/', and don't test for a device separator in IS_ANY_SEP.  */
 
-#ifdef WINDOWSNT
-extern Lisp_Object Vdirectory_sep_char;
-#endif
-
-#ifndef DIRECTORY_SEP
 #define DIRECTORY_SEP '/'
-#endif
 #ifndef IS_DIRECTORY_SEP
 #define IS_DIRECTORY_SEP(_c_) ((_c_) == DIRECTORY_SEP)
 #endif
index c96e391a2d3418eb13a0b48b855c3b9ed73874ca..b616e30c3c659ffa82afb38482dd75900925a8a3 100644 (file)
@@ -41,9 +41,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "blockinput.h"
 
 #ifdef MSDOS
-#if __DJGPP__ < 2
-#include <unistd.h>    /* to get X_OK */
-#endif
 #include "msdos.h"
 #endif
 
@@ -51,10 +48,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <unistd.h>
 #endif
 
-#ifndef X_OK
-#define X_OK 01
-#endif
-
 #include <math.h>
 
 #ifdef HAVE_SETLOCALE
@@ -76,17 +69,12 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #define file_tell ftell
 #endif
 
-#ifndef USE_CRT_DLL
-extern int errno;
-#endif
-
 /* hash table read constants */
 Lisp_Object Qhash_table, Qdata;
 Lisp_Object Qtest, Qsize;
 Lisp_Object Qweakness;
 Lisp_Object Qrehash_size;
 Lisp_Object Qrehash_threshold;
-extern Lisp_Object QCtest, QCsize, QCrehash_size, QCrehash_threshold, QCweakness;
 
 Lisp_Object Qread_char, Qget_file_char, Qstandard_input, Qcurrent_load_list;
 Lisp_Object Qvariable_documentation, Vvalues, Vstandard_input, Vafter_load_alist;
@@ -102,9 +90,6 @@ static Lisp_Object Qget_emacs_mule_file_char;
 
 static Lisp_Object Qload_force_doc_strings;
 
-extern Lisp_Object Qevent_symbol_element_mask;
-extern Lisp_Object Qfile_exists_p;
-
 /* non-zero if inside `load' */
 int load_in_progress;
 static Lisp_Object Qload_in_progress;
@@ -230,18 +215,18 @@ int force_load_messages;
 
 static Lisp_Object Vbytecomp_version_regexp;
 
-static int read_emacs_mule_char P_ ((int, int (*) (int, Lisp_Object),
-                                    Lisp_Object));
+static int read_emacs_mule_char (int, int (*) (int, Lisp_Object),
+                                 Lisp_Object);
 
-static void readevalloop P_ ((Lisp_Object, FILE*, Lisp_Object,
-                             Lisp_Object (*) (), int,
-                             Lisp_Object, Lisp_Object,
-                             Lisp_Object, Lisp_Object));
-static Lisp_Object load_unwind P_ ((Lisp_Object));
-static Lisp_Object load_descriptor_unwind P_ ((Lisp_Object));
+static void readevalloop (Lisp_Object, FILE*, Lisp_Object,
+                          Lisp_Object (*) (Lisp_Object), int,
+                          Lisp_Object, Lisp_Object,
+                          Lisp_Object, Lisp_Object);
+static Lisp_Object load_unwind (Lisp_Object);
+static Lisp_Object load_descriptor_unwind (Lisp_Object);
 
-static void invalid_syntax P_ ((const char *, int)) NO_RETURN;
-static void end_of_file_error P_ (()) NO_RETURN;
+static void invalid_syntax (const char *, int) NO_RETURN;
+static void end_of_file_error (void) NO_RETURN;
 
 \f
 /* Functions that read one byte from the current source READCHARFUN
@@ -250,9 +235,9 @@ static void end_of_file_error P_ (()) NO_RETURN;
    is 0 or positive, it unreads C, and the return value is not
    interesting.  */
 
-static int readbyte_for_lambda P_ ((int, Lisp_Object));
-static int readbyte_from_file P_ ((int, Lisp_Object));
-static int readbyte_from_string P_ ((int, Lisp_Object));
+static int readbyte_for_lambda (int, Lisp_Object);
+static int readbyte_from_file (int, Lisp_Object);
+static int readbyte_from_string (int, Lisp_Object);
 
 /* Handle unreading and rereading of characters.
    Write READCHAR to read a character,
@@ -273,13 +258,11 @@ static int readbyte_from_string P_ ((int, Lisp_Object));
 static int unread_char;
 
 static int
-readchar (readcharfun, multibyte)
-     Lisp_Object readcharfun;
-     int *multibyte;
+readchar (Lisp_Object readcharfun, int *multibyte)
 {
   Lisp_Object tem;
   register int c;
-  int (*readbyte) P_ ((int, Lisp_Object));
+  int (*readbyte) (int, Lisp_Object);
   unsigned char buf[MAX_MULTIBYTE_LENGTH];
   int i, len;
   int emacs_mule_encoding = 0;
@@ -446,9 +429,7 @@ readchar (readcharfun, multibyte)
    If the stream is a user function, call it with the char as argument.  */
 
 static void
-unreadchar (readcharfun, c)
-     Lisp_Object readcharfun;
-     int c;
+unreadchar (Lisp_Object readcharfun, int c)
 {
   readchar_count--;
   if (c == -1)
@@ -512,18 +493,14 @@ unreadchar (readcharfun, c)
 }
 
 static int
-readbyte_for_lambda (c, readcharfun)
-     int c;
-     Lisp_Object readcharfun;
+readbyte_for_lambda (int c, Lisp_Object readcharfun)
 {
   return read_bytecode_char (c >= 0);
 }
 
 
 static int
-readbyte_from_file (c, readcharfun)
-     int c;
-     Lisp_Object readcharfun;
+readbyte_from_file (int c, Lisp_Object readcharfun)
 {
   if (c >= 0)
     {
@@ -554,9 +531,7 @@ readbyte_from_file (c, readcharfun)
 }
 
 static int
-readbyte_from_string (c, readcharfun)
-     int c;
-     Lisp_Object readcharfun;
+readbyte_from_string (int c, Lisp_Object readcharfun)
 {
   Lisp_Object string = XCAR (readcharfun);
 
@@ -584,10 +559,7 @@ readbyte_from_string (c, readcharfun)
 extern char emacs_mule_bytes[256];
 
 static int
-read_emacs_mule_char (c, readbyte, readcharfun)
-     int c;
-     int (*readbyte) P_ ((int, Lisp_Object));
-     Lisp_Object readcharfun;
+read_emacs_mule_char (int c, int (*readbyte) (int, Lisp_Object), Lisp_Object readcharfun)
 {
   /* Emacs-mule coding uses at most 4-byte for one character.  */
   unsigned char buf[4];
@@ -646,19 +618,19 @@ read_emacs_mule_char (c, readbyte, readcharfun)
 }
 
 
-static Lisp_Object read_internal_start P_ ((Lisp_Object, Lisp_Object,
-                                           Lisp_Object));
-static Lisp_Object read0 P_ ((Lisp_Object));
-static Lisp_Object read1 P_ ((Lisp_Object, int *, int));
+static Lisp_Object read_internal_start (Lisp_Object, Lisp_Object,
+                                        Lisp_Object);
+static Lisp_Object read0 (Lisp_Object);
+static Lisp_Object read1 (Lisp_Object, int *, int);
 
-static Lisp_Object read_list P_ ((int, Lisp_Object));
-static Lisp_Object read_vector P_ ((Lisp_Object, int));
+static Lisp_Object read_list (int, Lisp_Object);
+static Lisp_Object read_vector (Lisp_Object, int);
 
-static Lisp_Object substitute_object_recurse P_ ((Lisp_Object, Lisp_Object,
-                                                 Lisp_Object));
-static void substitute_object_in_subtree P_ ((Lisp_Object,
-                                             Lisp_Object));
-static void substitute_in_interval P_ ((INTERVAL, Lisp_Object));
+static Lisp_Object substitute_object_recurse (Lisp_Object, Lisp_Object,
+                                              Lisp_Object);
+static void substitute_object_in_subtree (Lisp_Object,
+                                          Lisp_Object);
+static void substitute_in_interval (INTERVAL, Lisp_Object);
 
 \f
 /* Get a character from the tty.  */
@@ -685,10 +657,8 @@ static void substitute_in_interval P_ ((INTERVAL, Lisp_Object));
    return Qnil if no input arrives within that time.  */
 
 Lisp_Object
-read_filtered_event (no_switch_frame, ascii_required, error_nonascii,
-                    input_method, seconds)
-     int no_switch_frame, ascii_required, error_nonascii, input_method;
-     Lisp_Object seconds;
+read_filtered_event (int no_switch_frame, int ascii_required,
+                    int error_nonascii, int input_method, Lisp_Object seconds)
 {
   Lisp_Object val, delayed_switch_frame;
   EMACS_TIME end_time;
@@ -803,8 +773,7 @@ If the optional argument SECONDS is non-nil, it should be a number
 specifying the maximum number of seconds to wait for input.  If no
 input arrives in that time, return nil.  SECONDS may be a
 floating-point value.  */)
-     (prompt, inherit_input_method, seconds)
-     Lisp_Object prompt, inherit_input_method, seconds;
+  (Lisp_Object prompt, Lisp_Object inherit_input_method, Lisp_Object seconds)
 {
   Lisp_Object val;
 
@@ -826,8 +795,7 @@ If the optional argument SECONDS is non-nil, it should be a number
 specifying the maximum number of seconds to wait for input.  If no
 input arrives in that time, return nil.  SECONDS may be a
 floating-point value.  */)
-     (prompt, inherit_input_method, seconds)
-     Lisp_Object prompt, inherit_input_method, seconds;
+  (Lisp_Object prompt, Lisp_Object inherit_input_method, Lisp_Object seconds)
 {
   if (! NILP (prompt))
     message_with_string ("%s", prompt, 0);
@@ -848,8 +816,7 @@ If the optional argument SECONDS is non-nil, it should be a number
 specifying the maximum number of seconds to wait for input.  If no
 input arrives in that time, return nil.  SECONDS may be a
 floating-point value.  */)
-     (prompt, inherit_input_method, seconds)
-     Lisp_Object prompt, inherit_input_method, seconds;
+  (Lisp_Object prompt, Lisp_Object inherit_input_method, Lisp_Object seconds)
 {
   Lisp_Object val;
 
@@ -864,7 +831,7 @@ floating-point value.  */)
 
 DEFUN ("get-file-char", Fget_file_char, Sget_file_char, 0, 0, 0,
        doc: /* Don't use this yourself.  */)
-     ()
+  (void)
 {
   register Lisp_Object val;
   BLOCK_INPUT;
@@ -882,8 +849,7 @@ DEFUN ("get-file-char", Fget_file_char, Sget_file_char, 0, 0, 0,
    because of an incompatible change in the byte compiler.  */
 
 static int
-safe_to_load_p (fd)
-     int fd;
+safe_to_load_p (int fd)
 {
   char buf[512];
   int nbytes, i;
@@ -920,8 +886,7 @@ safe_to_load_p (fd)
    after loading a file successfully.  */
 
 static Lisp_Object
-record_load_unwind (old)
-     Lisp_Object old;
+record_load_unwind (Lisp_Object old)
 {
   return Vloads_in_progress = old;
 }
@@ -929,15 +894,13 @@ record_load_unwind (old)
 /* This handler function is used via internal_condition_case_1.  */
 
 static Lisp_Object
-load_error_handler (data)
-     Lisp_Object data;
+load_error_handler (Lisp_Object data)
 {
   return Qnil;
 }
 
 static Lisp_Object
-load_warn_old_style_backquotes (file)
-     Lisp_Object file;
+load_warn_old_style_backquotes (Lisp_Object file)
 {
   if (!NILP (Vold_style_backquotes))
     {
@@ -953,7 +916,7 @@ DEFUN ("get-load-suffixes", Fget_load_suffixes, Sget_load_suffixes, 0, 0, 0,
        doc: /* Return the suffixes that `load' should try if a suffix is \
 required.
 This uses the variables `load-suffixes' and `load-file-rep-suffixes'.  */)
-     ()
+  (void)
 {
   Lisp_Object lst = Qnil, suffixes = Vload_suffixes, suffix, ext;
   while (CONSP (suffixes))
@@ -1008,8 +971,7 @@ Loading a file records its definitions, and its `provide' and
 car is the file name loaded.  See `load-history'.
 
 Return t if the file exists and loads successfully.  */)
-     (file, noerror, nomessage, nosuffix, must_suffix)
-     Lisp_Object file, noerror, nomessage, nosuffix, must_suffix;
+  (Lisp_Object file, Lisp_Object noerror, Lisp_Object nomessage, Lisp_Object nosuffix, Lisp_Object must_suffix)
 {
   register FILE *stream;
   register int fd = -1;
@@ -1022,7 +984,7 @@ Return t if the file exists and loads successfully.  */)
   int compiled = 0;
   Lisp_Object handler;
   int safe_p = 1;
-  char *fmode = "r";
+  const char *fmode = "r";
   Lisp_Object tmp[2];
   int version;
 
@@ -1153,8 +1115,7 @@ Return t if the file exists and loads successfully.  */)
   specbind (Qold_style_backquotes, Qnil);
   record_unwind_protect (load_warn_old_style_backquotes, file);
 
-  if (!bcmp (SDATA (found) + SBYTES (found) - 4,
-            ".elc", 4)
+  if (!memcmp (SDATA (found) + SBYTES (found) - 4, ".elc", 4)
       || (fd >= 0 && (version = safe_to_load_p (fd)) > 0))
     /* Load .elc files directly, but not when they are
        remote and have no handler!  */
@@ -1310,8 +1271,7 @@ Return t if the file exists and loads successfully.  */)
 }
 
 static Lisp_Object
-load_unwind (arg)  /* used as unwind-protect function in load */
-     Lisp_Object arg;
+load_unwind (Lisp_Object arg)  /* used as unwind-protect function in load */
 {
   FILE *stream = (FILE *) XSAVE_VALUE (arg)->pointer;
   if (stream != NULL)
@@ -1324,8 +1284,7 @@ load_unwind (arg)  /* used as unwind-protect function in load */
 }
 
 static Lisp_Object
-load_descriptor_unwind (oldlist)
-     Lisp_Object oldlist;
+load_descriptor_unwind (Lisp_Object oldlist)
 {
   load_descriptor_list = oldlist;
   return Qnil;
@@ -1335,7 +1294,7 @@ load_descriptor_unwind (oldlist)
    This is used when starting a subprocess.  */
 
 void
-close_load_descs ()
+close_load_descs (void)
 {
 #ifndef WINDOWSNT
   Lisp_Object tail;
@@ -1345,8 +1304,7 @@ close_load_descs ()
 }
 \f
 static int
-complete_filename_p (pathname)
-     Lisp_Object pathname;
+complete_filename_p (Lisp_Object pathname)
 {
   register const unsigned char *s = SDATA (pathname);
   return (IS_DIRECTORY_SEP (s[0])
@@ -1362,8 +1320,7 @@ file name when searching.
 If non-nil, PREDICATE is used instead of `file-readable-p'.
 PREDICATE can also be an integer to pass to the access(2) function,
 in which case file-name-handlers are ignored.  */)
-     (filename, path, suffixes, predicate)
-     Lisp_Object filename, path, suffixes, predicate;
+  (Lisp_Object filename, Lisp_Object path, Lisp_Object suffixes, Lisp_Object predicate)
 {
   Lisp_Object file;
   int fd = openp (path, filename, suffixes, &file, predicate);
@@ -1394,11 +1351,7 @@ in which case file-name-handlers are ignored.  */)
    but store the found remote file name in *STOREPTR.  */
 
 int
-openp (path, str, suffixes, storeptr, predicate)
-     Lisp_Object path, str;
-     Lisp_Object suffixes;
-     Lisp_Object *storeptr;
-     Lisp_Object predicate;
+openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, Lisp_Object *storeptr, Lisp_Object predicate)
 {
   register int fd;
   int fn_size = 100;
@@ -1550,9 +1503,7 @@ openp (path, str, suffixes, storeptr, predicate)
    ENTIRE is 1 if loading that entire file, 0 if evaluating part of it.  */
 
 static void
-build_load_history (filename, entire)
-     Lisp_Object filename;
-     int entire;
+build_load_history (Lisp_Object filename, int entire)
 {
   register Lisp_Object tail, prev, newelt;
   register Lisp_Object tem, tem2;
@@ -1611,17 +1562,15 @@ build_load_history (filename, entire)
                           Vload_history);
 }
 
-Lisp_Object
-unreadpure (junk) /* Used as unwind-protect function in readevalloop */
-     Lisp_Object junk;
+static Lisp_Object
+unreadpure (Lisp_Object junk) /* Used as unwind-protect function in readevalloop */
 {
   read_pure = 0;
   return Qnil;
 }
 
 static Lisp_Object
-readevalloop_1 (old)
-     Lisp_Object old;
+readevalloop_1 (Lisp_Object old)
 {
   load_convert_to_unibyte = ! NILP (old);
   return Qnil;
@@ -1631,7 +1580,7 @@ readevalloop_1 (old)
    information.  */
 
 static void
-end_of_file_error ()
+end_of_file_error (void)
 {
   if (STRINGP (Vload_file_name))
     xsignal1 (Qend_of_file, Vload_file_name);
@@ -1647,15 +1596,13 @@ end_of_file_error ()
    If the input is not from a buffer, they must be nil.  */
 
 static void
-readevalloop (readcharfun, stream, sourcename, evalfun,
-             printflag, unibyte, readfun, start, end)
-     Lisp_Object readcharfun;
-     FILE *stream;
-     Lisp_Object sourcename;
-     Lisp_Object (*evalfun) ();
-     int printflag;
-     Lisp_Object unibyte, readfun;
-     Lisp_Object start, end;
+readevalloop (Lisp_Object readcharfun,
+             FILE *stream,
+             Lisp_Object sourcename,
+             Lisp_Object (*evalfun) (Lisp_Object),
+             int printflag,
+             Lisp_Object unibyte, Lisp_Object readfun,
+             Lisp_Object start, Lisp_Object end)
 {
   register int c;
   register Lisp_Object val;
@@ -1825,8 +1772,7 @@ DO-ALLOW-PRINT, if non-nil, specifies that `print' and related
  functions should work normally even if PRINTFLAG is nil.
 
 This function preserves the position of point.  */)
-     (buffer, printflag, filename, unibyte, do_allow_print)
-     Lisp_Object buffer, printflag, filename, unibyte, do_allow_print;
+  (Lisp_Object buffer, Lisp_Object printflag, Lisp_Object filename, Lisp_Object unibyte, Lisp_Object do_allow_print)
 {
   int count = SPECPDL_INDEX ();
   Lisp_Object tem, buf;
@@ -1869,8 +1815,7 @@ instead of `read' to read each expression.  It gets one argument
 which is the input stream for reading characters.
 
 This function does not move point.  */)
-     (start, end, printflag, read_function)
-     Lisp_Object start, end, printflag, read_function;
+  (Lisp_Object start, Lisp_Object end, Lisp_Object printflag, Lisp_Object read_function)
 {
   int count = SPECPDL_INDEX ();
   Lisp_Object tem, cbuf;
@@ -1904,8 +1849,7 @@ STREAM or the value of `standard-input' may be:
  a string (takes text from string, starting at the beginning)
  t (read text line using minibuffer and use it, or read from
     standard input in batch mode).  */)
-     (stream)
-     Lisp_Object stream;
+  (Lisp_Object stream)
 {
   if (NILP (stream))
     stream = Vstandard_input;
@@ -1922,8 +1866,7 @@ DEFUN ("read-from-string", Fread_from_string, Sread_from_string, 1, 3, 0,
 Returns a cons: (OBJECT-READ . FINAL-STRING-INDEX).
 START and END optionally delimit a substring of STRING from which to read;
  they default to 0 and (length STRING) respectively.  */)
-     (string, start, end)
-     Lisp_Object string, start, end;
+  (Lisp_Object string, Lisp_Object start, Lisp_Object end)
 {
   Lisp_Object ret;
   CHECK_STRING (string);
@@ -1935,10 +1878,8 @@ START and END optionally delimit a substring of STRING from which to read;
 /* Function to set up the global context we need in toplevel read
    calls. */
 static Lisp_Object
-read_internal_start (stream, start, end)
-     Lisp_Object stream;
-     Lisp_Object start; /* Only used when stream is a string. */
-     Lisp_Object end; /* Only used when stream is a string. */
+read_internal_start (Lisp_Object stream, Lisp_Object start, Lisp_Object end)
+/* start, end only used when stream is a string. */
 {
   Lisp_Object retval;
 
@@ -1996,9 +1937,7 @@ read_internal_start (stream, start, end)
    S is error string of length N (if > 0)  */
 
 static void
-invalid_syntax (s, n)
-     const char *s;
-     int n;
+invalid_syntax (const char *s, int n)
 {
   if (!n)
     n = strlen (s);
@@ -2010,8 +1949,7 @@ invalid_syntax (s, n)
    are not allowed. */
 
 static Lisp_Object
-read0 (readcharfun)
-     Lisp_Object readcharfun;
+read0 (Lisp_Object readcharfun)
 {
   register Lisp_Object val;
   int c;
@@ -2031,9 +1969,7 @@ static char *read_buffer;
    If the escape sequence forces unibyte, return eight-bit char.  */
 
 static int
-read_escape (readcharfun, stringp)
-     Lisp_Object readcharfun;
-     int stringp;
+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
@@ -2247,9 +2183,7 @@ read_escape (readcharfun, stringp)
    range.  */
 
 static Lisp_Object
-read_integer (readcharfun, radix)
-     Lisp_Object readcharfun;
-     int radix;
+read_integer (Lisp_Object readcharfun, int radix)
 {
   int ndigits = 0, invalid_p, c, sign = 0;
   /* We use a floating point number because  */
@@ -2314,10 +2248,7 @@ read_integer (readcharfun, radix)
    FIRST_IN_LIST is nonzero if this is the first element of a list.  */
 
 static Lisp_Object
-read1 (readcharfun, pch, first_in_list)
-     register Lisp_Object readcharfun;
-     int *pch;
-     int first_in_list;
+read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
 {
   register int c;
   int uninterned_symbol = 0;
@@ -2483,8 +2414,7 @@ read1 (readcharfun, pch, first_in_list)
                invalid_syntax ("#&...", 5);
 
              val = Fmake_bool_vector (length, Qnil);
-             bcopy (SDATA (tmp), XBOOL_VECTOR (val)->data,
-                    size_in_chars);
+             memcpy (XBOOL_VECTOR (val)->data, SDATA (tmp), size_in_chars);
              /* Clear the extraneous bits in the last byte.  */
              if (XINT (length) != size_in_chars * BOOL_VECTOR_BITS_PER_CHAR)
                XBOOL_VECTOR (val)->data[size_in_chars - 1]
@@ -2696,22 +2626,35 @@ read1 (readcharfun, pch, first_in_list)
       }
 
     case '`':
-      if (first_in_list)
-       {
-         Vold_style_backquotes = Qt;
-         goto default_label;
-       }
-      else
-       {
-         Lisp_Object value;
-
-         new_backquote_flag++;
-         value = read0 (readcharfun);
-         new_backquote_flag--;
+      {
+       int next_char = READCHAR;
+       UNREAD (next_char);
+       /* Transition from old-style to new-style:
+          If we see "(`" it used to mean old-style, which usually works
+          fine because ` should almost never appear in such a position
+          for new-style.  But occasionally we need "(`" to mean new
+          style, so we try to distinguish the two by the fact that we
+          can either write "( `foo" or "(` foo", where the first
+          intends to use new-style whereas the second intends to use
+          old-style.  For Emacs-25, we should completely remove this
+          first_in_list exception (old-style can still be obtained via
+          "(\`" anyway).  */
+       if (first_in_list && next_char == ' ')
+         {
+           Vold_style_backquotes = Qt;
+           goto default_label;
+         }
+       else
+         {
+           Lisp_Object value;
 
-         return Fcons (Qbackquote, Fcons (value, Qnil));
-       }
+           new_backquote_flag++;
+           value = read0 (readcharfun);
+           new_backquote_flag--;
 
+           return Fcons (Qbackquote, Fcons (value, Qnil));
+         }
+      }
     case ',':
       if (new_backquote_flag)
        {
@@ -2774,7 +2717,7 @@ read1 (readcharfun, pch, first_in_list)
 
            ok = (next_next_char <= 040
                  || (next_next_char < 0200
-                     && (index ("\"';([#?", next_next_char)
+                     && (strchr ("\"';([#?", next_next_char)
                          || (!first_in_list && next_next_char == '`')
                          || (new_backquote_flag && next_next_char == ','))));
          }
@@ -2782,7 +2725,7 @@ read1 (readcharfun, pch, first_in_list)
          {
            ok = (next_char <= 040
                  || (next_char < 0200
-                     && (index ("\"';()[]#?", next_char)
+                     && (strchr ("\"';()[]#?", next_char)
                          || (!first_in_list && next_char == '`')
                          || (new_backquote_flag && next_char == ','))));
          }
@@ -2927,7 +2870,7 @@ read1 (readcharfun, pch, first_in_list)
 
        if (next_char <= 040
            || (next_char < 0200
-               && (index ("\"';([#?", next_char)
+               && (strchr ("\"';([#?", next_char)
                    || (!first_in_list && next_char == '`')
                    || (new_backquote_flag && next_char == ','))))
          {
@@ -2954,7 +2897,7 @@ read1 (readcharfun, pch, first_in_list)
          while (c > 040
                 && c != 0x8a0 /* NBSP */
                 && (c >= 0200
-                    || (!index ("\"';()[]#", c)
+                    || (!strchr ("\"';()[]#", c)
                         && !(!first_in_list && c == '`')
                         && !(new_backquote_flag && c == ','))))
            {
@@ -3113,9 +3056,7 @@ read1 (readcharfun, pch, first_in_list)
 static Lisp_Object seen_list;
 
 static void
-substitute_object_in_subtree (object, placeholder)
-     Lisp_Object object;
-     Lisp_Object placeholder;
+substitute_object_in_subtree (Lisp_Object object, Lisp_Object placeholder)
 {
   Lisp_Object check_object;
 
@@ -3150,10 +3091,7 @@ substitute_object_in_subtree (object, placeholder)
   } while (0)
 
 static Lisp_Object
-substitute_object_recurse (object, placeholder, subtree)
-     Lisp_Object object;
-     Lisp_Object placeholder;
-     Lisp_Object subtree;
+substitute_object_recurse (Lisp_Object object, Lisp_Object placeholder, Lisp_Object subtree)
 {
   /* If we find the placeholder, return the target object. */
   if (EQ (placeholder, subtree))
@@ -3228,9 +3166,7 @@ substitute_object_recurse (object, placeholder, subtree)
 
 /*  Helper function for substitute_object_recurse.  */
 static void
-substitute_in_interval (interval, arg)
-     INTERVAL    interval;
-     Lisp_Object arg;
+substitute_in_interval (INTERVAL interval, Lisp_Object arg)
 {
   Lisp_Object object      = Fcar (arg);
   Lisp_Object placeholder = Fcdr (arg);
@@ -3246,13 +3182,10 @@ substitute_in_interval (interval, arg)
 #define EXP_INT 16
 
 int
-isfloat_string (cp, ignore_trailing)
-     register char *cp;
-     int ignore_trailing;
+isfloat_string (const char *cp, int ignore_trailing)
 {
-  register int state;
-
-  char *start = cp;
+  int state;
+  const char *start = cp;
 
   state = 0;
   if (*cp == '+' || *cp == '-')
@@ -3303,7 +3236,8 @@ isfloat_string (cp, ignore_trailing)
     }
 
   return ((ignore_trailing
-           || (*cp == 0) || (*cp == ' ') || (*cp == '\t') || (*cp == '\n') || (*cp == '\r') || (*cp == '\f'))
+          || *cp == 0 || *cp == ' ' || *cp == '\t' || *cp == '\n'
+          || *cp == '\r' || *cp == '\f')
          && (state == (LEAD_INT|DOT_CHAR|TRAIL_INT)
              || state == (DOT_CHAR|TRAIL_INT)
              || state == (LEAD_INT|E_CHAR|EXP_INT)
@@ -3313,9 +3247,7 @@ isfloat_string (cp, ignore_trailing)
 
 \f
 static Lisp_Object
-read_vector (readcharfun, bytecodeflag)
-     Lisp_Object readcharfun;
-     int bytecodeflag;
+read_vector (Lisp_Object readcharfun, int bytecodeflag)
 {
   register int i;
   register int size;
@@ -3398,9 +3330,7 @@ read_vector (readcharfun, bytecodeflag)
     and make structure pure.  */
 
 static Lisp_Object
-read_list (flag, readcharfun)
-     int flag;
-     register Lisp_Object readcharfun;
+read_list (int flag, register Lisp_Object readcharfun)
 {
   /* -1 means check next element for defun,
      0 means don't check,
@@ -3588,14 +3518,13 @@ Lisp_Object initial_obarray;
 
 int oblookup_last_bucket_number;
 
-static int hash_string ();
+static int hash_string (const unsigned char *ptr, int len);
 
 /* Get an error if OBARRAY is not an obarray.
    If it is one, return it.  */
 
 Lisp_Object
-check_obarray (obarray)
-     Lisp_Object obarray;
+check_obarray (Lisp_Object obarray)
 {
   if (!VECTORP (obarray) || XVECTOR (obarray)->size == 0)
     {
@@ -3610,8 +3539,7 @@ check_obarray (obarray)
    interned in the current obarray.  */
 
 Lisp_Object
-intern (str)
-     const char *str;
+intern (const char *str)
 {
   Lisp_Object tem;
   int len = strlen (str);
@@ -3652,14 +3580,13 @@ intern_c_string (const char *str)
 /* Create an uninterned symbol with name STR.  */
 
 Lisp_Object
-make_symbol (str)
-     char *str;
+make_symbol (const char *str)
 {
   int len = strlen (str);
 
-  return Fmake_symbol ((!NILP (Vpurify_flag)
-                       ? make_pure_string (str, len, len, 0)
-                       : make_string (str, len)));
+  return Fmake_symbol (!NILP (Vpurify_flag)
+                      ? make_pure_string (str, len, len, 0)
+                      : make_string (str, len));
 }
 \f
 DEFUN ("intern", Fintern, Sintern, 1, 2, 0,
@@ -3667,8 +3594,7 @@ DEFUN ("intern", Fintern, Sintern, 1, 2, 0,
 If there is none, one is created by this function and returned.
 A second optional argument specifies the obarray to use;
 it defaults to the value of `obarray'.  */)
-     (string, obarray)
-     Lisp_Object string, obarray;
+  (Lisp_Object string, Lisp_Object obarray)
 {
   register Lisp_Object tem, sym, *ptr;
 
@@ -3696,7 +3622,8 @@ it defaults to the value of `obarray'.  */)
       && EQ (obarray, initial_obarray))
     {
       XSYMBOL (sym)->constant = 1;
-      XSYMBOL (sym)->value = sym;
+      XSYMBOL (sym)->redirect = SYMBOL_PLAINVAL;
+      SET_SYMBOL_VAL (XSYMBOL (sym), sym);
     }
 
   ptr = &XVECTOR (obarray)->contents[XINT (tem)];
@@ -3714,8 +3641,7 @@ NAME may be a string or a symbol.  If it is a symbol, that exact
 symbol is searched for.
 A second optional argument specifies the obarray to use;
 it defaults to the value of `obarray'.  */)
-     (name, obarray)
-     Lisp_Object name, obarray;
+  (Lisp_Object name, Lisp_Object obarray)
 {
   register Lisp_Object tem, string;
 
@@ -3743,8 +3669,7 @@ The value is t if a symbol was found and deleted, nil otherwise.
 NAME may be a string or a symbol.  If it is a symbol, that symbol
 is deleted, if it belongs to OBARRAY--no other symbol is deleted.
 OBARRAY defaults to the value of the variable `obarray'.  */)
-     (name, obarray)
-     Lisp_Object name, obarray;
+  (Lisp_Object name, Lisp_Object obarray)
 {
   register Lisp_Object string, tem;
   int hash;
@@ -3777,8 +3702,6 @@ OBARRAY defaults to the value of the variable `obarray'.  */)
        error ("Attempt to unintern t or nil"); */
 
   XSYMBOL (tem)->interned = SYMBOL_UNINTERNED;
-  XSYMBOL (tem)->constant = 0;
-  XSYMBOL (tem)->indirect_variable = 0;
 
   hash = oblookup_last_bucket_number;
 
@@ -3816,10 +3739,7 @@ OBARRAY defaults to the value of the variable `obarray'.  */)
    Also store the bucket number in oblookup_last_bucket_number.  */
 
 Lisp_Object
-oblookup (obarray, ptr, size, size_byte)
-     Lisp_Object obarray;
-     register const char *ptr;
-     int size, size_byte;
+oblookup (Lisp_Object obarray, register const char *ptr, int size, int size_byte)
 {
   int hash;
   int obsize;
@@ -3846,7 +3766,7 @@ oblookup (obarray, ptr, size, size_byte)
       {
        if (SBYTES (SYMBOL_NAME (tail)) == size_byte
            && SCHARS (SYMBOL_NAME (tail)) == size
-           && !bcmp (SDATA (SYMBOL_NAME (tail)), ptr, size_byte))
+           && !memcmp (SDATA (SYMBOL_NAME (tail)), ptr, size_byte))
          return tail;
        else if (XSYMBOL (tail)->next == 0)
          break;
@@ -3856,9 +3776,7 @@ oblookup (obarray, ptr, size, size_byte)
 }
 
 static int
-hash_string (ptr, len)
-     const unsigned char *ptr;
-     int len;
+hash_string (const unsigned char *ptr, int len)
 {
   register const unsigned char *p = ptr;
   register const unsigned char *end = p + len;
@@ -3875,10 +3793,7 @@ hash_string (ptr, len)
 }
 \f
 void
-map_obarray (obarray, fn, arg)
-     Lisp_Object obarray;
-     void (*fn) P_ ((Lisp_Object, Lisp_Object));
-     Lisp_Object arg;
+map_obarray (Lisp_Object obarray, void (*fn) (Lisp_Object, Lisp_Object), Lisp_Object arg)
 {
   register int i;
   register Lisp_Object tail;
@@ -3897,9 +3812,8 @@ map_obarray (obarray, fn, arg)
     }
 }
 
-void
-mapatoms_1 (sym, function)
-     Lisp_Object sym, function;
+static void
+mapatoms_1 (Lisp_Object sym, Lisp_Object function)
 {
   call1 (function, sym);
 }
@@ -3907,8 +3821,7 @@ mapatoms_1 (sym, function)
 DEFUN ("mapatoms", Fmapatoms, Smapatoms, 1, 2, 0,
        doc: /* Call FUNCTION on every symbol in OBARRAY.
 OBARRAY defaults to the value of `obarray'.  */)
-     (function, obarray)
-     Lisp_Object function, obarray;
+  (Lisp_Object function, Lisp_Object obarray)
 {
   if (NILP (obarray)) obarray = Vobarray;
   obarray = check_obarray (obarray);
@@ -3920,38 +3833,34 @@ OBARRAY defaults to the value of `obarray'.  */)
 #define OBARRAY_SIZE 1511
 
 void
-init_obarray ()
+init_obarray (void)
 {
   Lisp_Object oblength;
-  int hash;
-  Lisp_Object *tem;
 
   XSETFASTINT (oblength, OBARRAY_SIZE);
 
-  Qnil = Fmake_symbol (make_pure_c_string ("nil"));
   Vobarray = Fmake_vector (oblength, make_number (0));
   initial_obarray = Vobarray;
   staticpro (&initial_obarray);
-  /* Intern nil in the obarray */
-  XSYMBOL (Qnil)->interned = SYMBOL_INTERNED_IN_INITIAL_OBARRAY;
-  XSYMBOL (Qnil)->constant = 1;
-
-  /* These locals are to kludge around a pyramid compiler bug. */
-  hash = hash_string ("nil", 3);
-  /* Separate statement here to avoid VAXC bug. */
-  hash %= OBARRAY_SIZE;
-  tem = &XVECTOR (Vobarray)->contents[hash];
-  *tem = Qnil;
 
   Qunbound = Fmake_symbol (make_pure_c_string ("unbound"));
-  XSYMBOL (Qnil)->function = Qunbound;
-  XSYMBOL (Qunbound)->value = Qunbound;
+  /* 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);
+  Qnil = intern_c_string ("nil");
+
+  /* Fmake_symbol inits fields of new symbols with Qunbound and Qnil,
+     so those two need to be fixed manally.  */
+  SET_SYMBOL_VAL (XSYMBOL (Qunbound), Qunbound);
   XSYMBOL (Qunbound)->function = Qunbound;
+  XSYMBOL (Qunbound)->plist = Qnil;
+  /* XSYMBOL (Qnil)->function = Qunbound; */
+  SET_SYMBOL_VAL (XSYMBOL (Qnil), Qnil);
+  XSYMBOL (Qnil)->constant = 1;
+  XSYMBOL (Qnil)->plist = Qnil;
 
   Qt = intern_c_string ("t");
-  XSYMBOL (Qnil)->value = Qnil;
-  XSYMBOL (Qnil)->plist = Qnil;
-  XSYMBOL (Qt)->value = Qt;
+  SET_SYMBOL_VAL (XSYMBOL (Qt), Qt);
   XSYMBOL (Qt)->constant = 1;
 
   /* Qt is correct even if CANNOT_DUMP.  loadup.el will set to nil at end.  */
@@ -3965,8 +3874,7 @@ init_obarray ()
 }
 \f
 void
-defsubr (sname)
-     struct Lisp_Subr *sname;
+defsubr (struct Lisp_Subr *sname)
 {
   Lisp_Object sym;
   sym = intern_c_string (sname->symbol_name);
@@ -3990,27 +3898,29 @@ defalias (sname, string)
    to a C variable of type int.  Sample call:
    DEFVAR_INT ("emacs-priority", &emacs_priority, "Documentation");  */
 void
-defvar_int (const char *namestring, EMACS_INT *address)
+defvar_int (struct Lisp_Intfwd *i_fwd,
+           const char *namestring, EMACS_INT *address)
 {
-  Lisp_Object sym, val;
+  Lisp_Object sym;
   sym = intern_c_string (namestring);
-  val = allocate_misc ();
-  XMISCTYPE (val) = Lisp_Misc_Intfwd;
-  XINTFWD (val)->intvar = address;
-  SET_SYMBOL_VALUE (sym, val);
+  i_fwd->type = Lisp_Fwd_Int;
+  i_fwd->intvar = address;
+  XSYMBOL (sym)->redirect = SYMBOL_FORWARDED;
+  SET_SYMBOL_FWD (XSYMBOL (sym), (union Lisp_Fwd *)i_fwd);
 }
 
 /* Similar but define a variable whose value is t if address contains 1,
    nil if address contains 0.  */
 void
-defvar_bool (const char *namestring, int *address)
+defvar_bool (struct Lisp_Boolfwd *b_fwd,
+            const char *namestring, int *address)
 {
-  Lisp_Object sym, val;
+  Lisp_Object sym;
   sym = intern_c_string (namestring);
-  val = allocate_misc ();
-  XMISCTYPE (val) = Lisp_Misc_Boolfwd;
-  XBOOLFWD (val)->boolvar = address;
-  SET_SYMBOL_VALUE (sym, val);
+  b_fwd->type = Lisp_Fwd_Bool;
+  b_fwd->boolvar = address;
+  XSYMBOL (sym)->redirect = SYMBOL_FORWARDED;
+  SET_SYMBOL_FWD (XSYMBOL (sym), (union Lisp_Fwd *)b_fwd);
   Vbyte_boolean_vars = Fcons (sym, Vbyte_boolean_vars);
 }
 
@@ -4020,20 +3930,22 @@ defvar_bool (const char *namestring, int *address)
    gc-marked for some other reason, since marking the same slot twice
    can cause trouble with strings.  */
 void
-defvar_lisp_nopro (const char *namestring, Lisp_Object *address)
+defvar_lisp_nopro (struct Lisp_Objfwd *o_fwd,
+                  const char *namestring, Lisp_Object *address)
 {
-  Lisp_Object sym, val;
+  Lisp_Object sym;
   sym = intern_c_string (namestring);
-  val = allocate_misc ();
-  XMISCTYPE (val) = Lisp_Misc_Objfwd;
-  XOBJFWD (val)->objvar = address;
-  SET_SYMBOL_VALUE (sym, val);
+  o_fwd->type = Lisp_Fwd_Obj;
+  o_fwd->objvar = address;
+  XSYMBOL (sym)->redirect = SYMBOL_FORWARDED;
+  SET_SYMBOL_FWD (XSYMBOL (sym), (union Lisp_Fwd *)o_fwd);
 }
 
 void
-defvar_lisp (const char *namestring, Lisp_Object *address)
+defvar_lisp (struct Lisp_Objfwd *o_fwd,
+            const char *namestring, Lisp_Object *address)
 {
-  defvar_lisp_nopro (namestring, address);
+  defvar_lisp_nopro (o_fwd, namestring, address);
   staticpro (address);
 }
 
@@ -4041,14 +3953,15 @@ defvar_lisp (const char *namestring, Lisp_Object *address)
    at a particular offset in the current kboard object.  */
 
 void
-defvar_kboard (const char *namestring, int offset)
+defvar_kboard (struct Lisp_Kboard_Objfwd *ko_fwd,
+              const char *namestring, int offset)
 {
-  Lisp_Object sym, val;
+  Lisp_Object sym;
   sym = intern_c_string (namestring);
-  val = allocate_misc ();
-  XMISCTYPE (val) = Lisp_Misc_Kboard_Objfwd;
-  XKBOARD_OBJFWD (val)->offset = offset;
-  SET_SYMBOL_VALUE (sym, val);
+  ko_fwd->type = Lisp_Fwd_Kboard_Obj;
+  ko_fwd->offset = offset;
+  XSYMBOL (sym)->redirect = SYMBOL_FORWARDED;
+  SET_SYMBOL_FWD (XSYMBOL (sym), (union Lisp_Fwd *)ko_fwd);
 }
 \f
 /* Record the value of load-path used at the start of dumping
@@ -4056,9 +3969,9 @@ defvar_kboard (const char *namestring, int offset)
 static Lisp_Object dump_path;
 
 void
-init_lread ()
+init_lread (void)
 {
-  char *normal;
+  const char *normal;
   int turn_off_warning = 0;
 
   /* Compute the default load-path.  */
@@ -4249,9 +4162,7 @@ init_lread ()
    does not exist.  Print it on stderr and put it in *Messages*.  */
 
 void
-dir_warning (format, dirname)
-     char *format;
-     Lisp_Object dirname;
+dir_warning (const char *format, Lisp_Object dirname)
 {
   char *buffer
     = (char *) alloca (SCHARS (dirname) + strlen (format) + 5);
@@ -4264,7 +4175,7 @@ dir_warning (format, dirname)
 }
 
 void
-syms_of_lread ()
+syms_of_lread (void)
 {
   defsubr (&Sread);
   defsubr (&Sread_from_string);
index 5abf8bba7261e67ab5d50de8e56d4a1eaee8f9ed..3b6d7da92df276e534cecd52763590b38a75ca2e 100644 (file)
@@ -1,6 +1,7 @@
 /* Machine description file for the alpha chip.
-   Copyright (C) 1994, 1997, 1999, 2001, 2002, 2003, 2004, 2005, 2006,
-                 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
+
+Copyright (C) 1994, 1997, 1999, 2001, 2002, 2003, 2004, 2005, 2006,
+  2007, 2008, 2009, 2010  Free Software Foundation, Inc.
 
 Author: Rainer Schoepf
 (according to authors.el)
@@ -20,35 +21,12 @@ 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 following line tells the configuration script what sort of
-   operating system this machine is likely to run.
-   USUAL-OPSYS="note"
-
-NOTE-START
-Use -opsystem=osf1
-NOTE-END
-
-*/
-
 #ifndef _LP64
-#define _LP64                  /* This doesn't appear to be necessary
-                                  on OSF 4/5  -- fx.  */
+#define _LP64 /* This doesn't appear to be necessary on OSF 4/5  -- fx.  */
 #endif
 
-/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
-   is the most significant byte.  */
-
-#undef WORDS_BIG_ENDIAN
-
-/* Define NO_ARG_ARRAY if you cannot take the address of the first of a
- * group of arguments and treat it as an array of the arguments.  */
-
-#define NO_ARG_ARRAY
-
 /* Now define a symbol for the cpu type, if your compiler
    does not define it automatically.  */
-
 /* __alpha defined automatically */
 
 
@@ -57,80 +35,31 @@ NOTE-END
    are always unsigned.
 
    This flag only matters if you use USE_LISP_UNION_TYPE.  */
-
 #define EXPLICIT_SIGN_EXTEND
 
 /* Data type of load average, as read out of kmem.  */
-
 #define LOAD_AVE_TYPE long
 
 /* Convert that into an integer that is 100 for a load average of 1.0  */
-
 #define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
 
-/* GNU malloc and the relocating allocator do not work together
-   with X.   [Who wrote that?]  */
-
-/* May 1995: reportedly [Rainer Schoepf <schoepf@uni-mainz.de>] both the
-   system and the gnu malloc system work with "alpha-dec-osf3.0" and
-   "alpha-dec-osf3.2".  */
-
-/* May 1995: it seems to me [Morten Welinder <terra@diku.dk>] that both
-   mallocs work with "alpha-dec-osf2.0", but I daren't break anything
-   right now.  Feel free to play if you want.  */
-
-/* #define SYSTEM_MALLOC */
-
 #ifdef __ELF__
-/* With ELF, make sure that all common symbols get allocated to in the
-   data section.  Otherwise, the dump of temacs may miss variables in
-   the shared library that have been initialized.  For example, with
-   GNU libc, __malloc_initialized would normally be resolved to the
-   shared library's .bss section, which is fatal.  */
-# ifdef __GNUC__
-#  define C_SWITCH_MACHINE     -fno-common
-# else
-#  error What gives?  Fix me if DEC Unix supports ELF now.
-# endif
-
-#undef UNEXEC
-#define UNEXEC unexelf.o
+
 #if !defined(GNU_LINUX) && !defined(__NetBSD__)
 #define DATA_START    0x140000000
 #endif
 
-#if (defined (__NetBSD__) || defined (__OpenBSD__))
-#define HAVE_TEXT_START
-#endif
-
 #else  /* not __ELF__ */
 
 /* Describe layout of the address space in an executing process.  */
-
-#define TEXT_START    0x120000000
 #define DATA_START    0x140000000
 
-/* The program to be used for unexec. */
-
-#define UNEXEC unexalpha.o
-
 #endif /* __ELF__ */
 
-#if defined (GNU_LINUX) && __GNU_LIBRARY__ - 0 < 6
-/* This controls a conditional in main.  */
-#define LINUX_SBRK_BUG
-#endif
-
 /* On the Alpha it's best to avoid including TERMIO since struct
    termio and struct termios are mutually incompatible.  */
 #define NO_TERMIO
 
-#if defined (GNU_LINUX) || defined (__NetBSD__) || defined (__OpenBSD__)
-# ifndef __ELF__
-#  define COFF
-# endif /* notdef __ELF__ */
-#endif
-
 /* 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:
index 4bea30d12de3695b2bf4367819258e7b581133b6..30aa2678717c2fa090124b7ee830582d093c61e7 100644 (file)
@@ -1,6 +1,7 @@
 /* machine description file for AMD x86-64.
-   Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
-     Free Software Foundation, Inc.
+
+Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -17,32 +18,9 @@ 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 i386
-/* 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, then the bug is really ours: we should have
-   guessed better.  */
-#include "m/intel386.h"
-#else
-
-/* The following line tells the configuration script what sort of
-   operating system this machine is likely to run.
-   USUAL-OPSYS="linux"  */
-
 #define BITS_PER_LONG           64
 #define BITS_PER_EMACS_INT      64
 
-/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
-   is the most significant byte.  */
-
-#undef WORDS_BIG_ENDIAN
-
-/* Define NO_ARG_ARRAY if you cannot take the address of the first of a
- * group of arguments and treat it as an array of the arguments.  */
-
-#define NO_ARG_ARRAY
-
 /* 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,
@@ -58,77 +36,16 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    are always unsigned.
 
    This flag only matters if you use USE_LISP_UNION_TYPE.  */
-
 #define EXPLICIT_SIGN_EXTEND
 
 /* Data type of load average, as read out of kmem.  */
-
 #define LOAD_AVE_TYPE long
 
 /* Convert that into an integer that is 100 for a load average of 1.0  */
-
 #define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
 
 /* Define XPNTR to avoid or'ing with DATA_SEG_BITS */
 #undef DATA_SEG_BITS
 
-#ifdef __FreeBSD__
-
-/* The libraries for binaries native to the build host's architecture are
-   installed under /usr/lib in FreeBSD, and the ones that need special paths
-   are 32-bit compatibility libraries (installed under /usr/lib32).  To build
-   a native binary of Emacs on FreeBSD/amd64 we can just point to /usr/lib.  */
-
-#undef START_FILES
-#define START_FILES pre-crt0.o /usr/lib/crt1.o /usr/lib/crti.o
-
-/* The duplicate -lgcc is intentional in the definition of LIB_STANDARD.
-   The reason is that some functions in libgcc.a call functions from libc.a,
-   and some libc.a functions need functions from libgcc.a.  Since most
-   versions of ld are one-pass linkers, we need to mention -lgcc twice,
-   or else we risk getting unresolved externals.  */
-#undef LIB_STANDARD
-#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib/crtn.o
-
-#elif defined(__OpenBSD__)
-
-#undef START_FILES
-#define START_FILES pre-crt0.o /usr/lib/crt0.o /usr/lib/crtbegin.o
-#undef LIB_STANDARD
-#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib/crtend.o
-
-#elif defined(__NetBSD__)
-
-/* LIB_STANDARD and START_FILES set correctly in s/netbsd.h */
-
-#elif defined(SOLARIS2)
-
-#undef START_FILES
-#undef LIB_STANDARD
-
-#elif defined(__APPLE__)
-
-/* LIB_STANDARD and START_FILES set correctly in s/darwin.h */
-
-#else /* !__OpenBSD__ && !__FreeBSD__ && !__NetBSD__ && !SOLARIS2
-         && !__APPLE__ */
-/* The duplicate -lgcc is intentional in the definition of LIB_STANDARD.
-   The reason is that some functions in libgcc.a call functions from libc.a,
-   and some libc.a functions need functions from libgcc.a.  Since most
-   versions of ld are one-pass linkers, we need to mention -lgcc twice,
-   or else we risk getting unresolved externals.  */
-#undef START_FILES
-#undef LIB_STANDARD
-#ifdef HAVE_LIB64_DIR
-#define START_FILES pre-crt0.o /usr/lib64/crt1.o /usr/lib64/crti.o
-#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib64/crtn.o
-#else
-#define START_FILES pre-crt0.o /usr/lib/crt1.o /usr/lib/crti.o
-#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib/crtn.o
-#endif
-
-#endif /* __FreeBSD__ */
-#endif /* !i386 */
-
 /* arch-tag: 8a5e001d-e12e-4692-a3a6-0b15ba271c6e
    (do not change this comment) */
index b04c5ecc1d9d0b4e8b7dafeeb933f73ee21f0ab5..8b659bb5bd0274fe067315c6184f9bed921f1cfa 100644 (file)
@@ -1,6 +1,7 @@
 /* Machine description file for ARM-based non-RISCiX machines.
-   Copyright (C) 1994, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-                 2008, 2009, 2010  Free Software Foundation, Inc.
+
+Copyright (C) 1994, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+  2009, 2010  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -17,30 +18,5 @@ 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 WORDS_BIG_ENDIAN if lowest-numbered byte in a word
-   is the most significant byte.  */
-
-#undef WORDS_BIG_ENDIAN
-
-/* Define NO_ARG_ARRAY if you cannot take the address of the first of a
- * group of arguments and treat it as an array of the arguments.  We can't
- * do this on the arm with gcc, since the first 4 args are in registers.  */
-
-#ifdef __GNUC__
-#define NO_ARG_ARRAY
-#else
-#undef NO_ARG_ARRAY
-#endif
-
-#define NO_REMAP
-
-/* armin76@gentoo.org reported that the lgcc_s flag is necessary to
-   build on ARM EABI under GNU/Linux (Bug#5518).  */
-#ifdef GNU_LINUX
-#define LIB_GCC -lgcc_s
-#endif
-
 /* arch-tag: 07856f0c-f0c8-4bd8-99af-0b7fa1e5ee42
    (do not change this comment) */
index 5614141fe632edcf1f09868d34014c0b8a43ebb0..9998f701a6b90659c766f7ae8cacc45aaa6173ae 100644 (file)
@@ -1,6 +1,7 @@
 /* machine description file for hp9000 series 800 machines.
-   Copyright (C) 1987, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-                 2008, 2009, 2010  Free Software Foundation, Inc.
+
+Copyright (C) 1987, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+  2009, 2010  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -17,119 +18,12 @@ 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 following line tells the configuration script what sort of
-   operating system this machine is likely to run.
-   USUAL-OPSYS="hpux"  */
-
-/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
-   is the most significant byte.  */
-
-#define WORDS_BIG_ENDIAN
-
-/* Define NO_ARG_ARRAY if you cannot take the address of the first of a
- * group of arguments and treat it as an array of the arguments.  */
-
-#define NO_ARG_ARRAY
-
 /* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend
    the bit field into an int.  In other words, if bit fields
    are always unsigned.
 
    This flag only matters if you use USE_LISP_UNION_TYPE.  */
-
 #define EXPLICIT_SIGN_EXTEND
 
-\f
-/* Common definitions for HPUX and GNU/Linux.  */
-
-#if defined (__hpux) || defined (GNU_LINUX)
-
-/* Define NO_REMAP if memory segmentation makes it not work well
-   to change the boundary between the text section and data section
-   when Emacs is dumped.  If you define this, the preloaded Lisp
-   code will not be sharable; but that's better than failing completely.  */
-
-#define NO_REMAP
-
-#endif /* __hpux or GNU_LINUX */
-\f
-/* Stuff for just GNU/Linux.  */
-
-#ifdef GNU_LINUX
-
-/* Data type of load average, as read out of kmem.  */
-
-#define LOAD_AVE_TYPE long
-
-/* Convert that into an integer that is 100 for a load average of 1.0  */
-
-#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
-
-#endif /* GNU_LINUX */
-\f
-/* Stuff for just HPUX.  */
-
-#ifdef __hpux
-
-/* Define VIRT_ADDR_VARIES if the virtual addresses of
-   pure and impure space as loaded can vary, and even their
-   relative order cannot be relied on.
-
-   Otherwise Emacs assumes that text space precedes data space,
-   numerically.  */
-
-#define VIRT_ADDR_VARIES
-\f
-/* the data segment on this machine always starts at address 0x40000000. */
-
-#define DATA_SEG_BITS 0x40000000
-
-#define DATA_START    0x40000000
-#define TEXT_START    0x00000000
-
-/* This machine requires completely different unexec code
-   which lives in a separate file.  Specify the file name.  */
-
-#define UNEXEC unexhp9k800.o
-
-#define LIBS_MACHINE
-#define LIBS_DEBUG
-
-/* Include the file bsdtty.h, since this machine has job control.  */
-#define NEED_BSDTTY
-
-/* Data type of load average, as read out of kmem.  */
-
-#define LOAD_AVE_TYPE double
-
-/* Convert that into an integer that is 100 for a load average of 1.0  */
-
-#define LOAD_AVE_CVT(x) ((int) (x * 100.0))
-
-/* The symbol in the kernel where the load average is found
-   is named _avenrun.  At this time there are two major flavors
-   of hp-ux (there is the s800 and s300 (s200) flavors).  The
-   differences are thusly moved to the corresponding machine description file.
-*/
-
-/* no underscore please */
-#define LDAV_SYMBOL "avenrun"
-
-/* On USG systems these have different names. */
-
-#define index strchr
-#define rindex strrchr
-
-#endif /* __hpux */
-\f
-/* Systems with GCC don't need to lose. */
-#ifdef __NetBSD__
-# ifdef __GNUC__
-#  define alloca __builtin_alloca
-#  define HAVE_ALLOCA
-# endif /* __GNUC__ */
-#endif /* __NetBSD__ */
-
 /* arch-tag: 809436e6-1645-4b92-b40d-2de5d6e7227c
    (do not change this comment) */
index 188697b7e898b8b47e4fba0744dbcd0833ca18e6..bbf09ac878bdfdc9b3aad29f0912dcffa4daa654 100644 (file)
@@ -1,7 +1,9 @@
 /* machine description file for the IA-64 architecture.
-   Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-                 2008, 2009, 2010  Free Software Foundation, Inc.
-     Contributed by David Mosberger <davidm@hpl.hp.com>
+
+Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+  2009, 2010  Free Software Foundation, Inc.
+
+Contributed by David Mosberger <davidm@hpl.hp.com>
 
 This file is part of GNU Emacs.
 
@@ -21,22 +23,10 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #define BITS_PER_LONG          64
 #define BITS_PER_EMACS_INT     64
 
-/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
-   is the most significant byte.  */
-
-#undef WORDS_BIG_ENDIAN
-
-/* Define NO_ARG_ARRAY if you cannot take the address of the first of a
-   group of arguments and treat it as an array of the arguments.  */
-
-#define NO_ARG_ARRAY
-
 /* 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 EMACS_UINT             unsigned long
@@ -46,24 +36,14 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    are always unsigned.
 
    This flag only matters if you use USE_LISP_UNION_TYPE.  */
-
 #define EXPLICIT_SIGN_EXTEND
 
 /* Data type of load average, as read out of kmem.  */
-
 #define LOAD_AVE_TYPE          long
 
 /* Convert that into an integer that is 100 for a load average of 1.0  */
-
 #define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
 
-#ifdef __ELF__
-#undef UNEXEC
-#define UNEXEC unexelf.o
-#endif
-
-#ifndef NOT_C_CODE
-
 #ifdef REL_ALLOC
 #ifndef _MALLOC_INTERNAL
 /* "char *" because ralloc.c defines it that way.  gmalloc.c thinks it
@@ -74,9 +54,5 @@ extern void r_alloc_free ();
 #endif /* not _MALLOC_INTERNAL */
 #endif /* REL_ALLOC */
 
-#endif /* not NOT_C_CODE */
-
-#define HAVE_TEXT_START
-
 /* arch-tag: 9b8e9fb2-2e49-4c22-b68f-11a488e77c66
    (do not change this comment) */
index 757db149ed26d4dcc27ad7bd822bf7c59630a12b..785719e908b7e1c9b3ec34012b846be4ef5af45a 100644 (file)
@@ -1,6 +1,7 @@
 /* R2 AIX machine/system dependent defines
-   Copyright (C) 1988, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-                 2008, 2009, 2010  Free Software Foundation, Inc.
+
+Copyright (C) 1988, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+  2009, 2010  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -18,73 +19,21 @@ 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 following line tells the configuration script what sort of
-   operating system this machine is likely to run.
-   USUAL-OPSYS="aix3-1"  */
-
-/* Define NO_ARG_ARRAY if you cannot take the address of the first of a
- * group of arguments and treat it as an array of the arguments.  */
-
-#define NO_ARG_ARRAY
-
-/* Now define a symbol for the cpu type, if your compiler
-   does not define it automatically.  */
-
-#define IBMR2AIX
-
-#ifndef UNEXEC
-#define UNEXEC unexaix.o
-#endif
-
-/* Define addresses, macros, change some setup for dump */
-
-#define NO_REMAP
-
 /* 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.  */
-
-#ifndef USG5_4
-#define TEXT_START 0x10000000
 #define DATA_START 0x20000000
-#define WORDS_BIG_ENDIAN
 #define DATA_SEG_BITS 0x20000000
 
-/* sfreed@unm.edu says add -bI:/usr/lpp/X11/bin/smt.exp for AIX 3.2.4.  */
-/* marc@sti.com (Marc Pawliger) says ibmrs6000.inp is needed to avoid
-   linker error for updated X11R5 libraries, which references pthread library
-   which most machines don't have.  We use the name .inp instead of .imp
-   because .inp is a better convention to use in make-dist for naming
-   random input files.  */
-#ifdef THIS_IS_MAKEFILE /* Don't use this in configure.  */
-#define LD_SWITCH_MACHINE -Wl,-bnodelcsect
-#endif /* THIS_IS_MAKEFILE */
-
 #ifndef NLIST_STRUCT
 /* AIX supposedly doesn't use this interface, but on the RS/6000
    it apparently does.  */
 #define NLIST_STRUCT
 #endif
 
-/* -lpthreads seems to be necessary for Xlib in X11R6, and should be harmless
-   on older versions of X where it happens to exist.  */
-#ifdef HAVE_LIBPTHREADS
-#define LIBS_MACHINE -lrts -lIM -liconv -lpthreads
-#else
-/* IBM's X11R5 use -lIM and -liconv in AIX 3.2.2.  */
-#define LIBS_MACHINE -lrts -lIM -liconv
-#endif
-
-#else /* USG5_4 */
-#undef WORDS_BIG_ENDIAN
-#define DATA_SEG_BITS 0
-#define LIBS_MACHINE
-#endif /* USG5_4 */
-
 #undef ADDR_CORRECT
 #define ADDR_CORRECT(x) ((int)(x))
 
-#define START_FILES
 /*** BUILD 9008 - FIONREAD problem still exists in X-Windows. ***/
 #define BROKEN_FIONREAD
 /* As we define BROKEN_FIONREAD, SIGIO will be undefined in systty.h.
@@ -96,7 +45,5 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #define BROKEN_SIGPTY
 #define BROKEN_SIGPOLL
 
-#define ORDINARY_LINK
-
 /* arch-tag: 028318ee-a7ae-4a08-804d-cc1e6588d003
    (do not change this comment) */
diff --git a/src/m/ibmrs6000.inp b/src/m/ibmrs6000.inp
deleted file mode 100644 (file)
index d7f3fdd..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-#!
-pthread_yield
-
-# arch-tag: fc6d01ea-c488-4862-bbdb-e8d3e0f6fdb3
index 794ab8695119a99875839ccd5356017928fba05f..0acc826a1eacb40fa1ebeffa79b94a4e4e5030b3 100644 (file)
@@ -1,6 +1,7 @@
-/* machine description file template.
-   Copyright (C) 1985, 1986, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-                 2008, 2009, 2010 Free Software Foundation, Inc.
+/* Machine description file for IBM S390 in 32-bit mode
+
+Copyright (C) 1985, 1986, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+  2008, 2009, 2010  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -18,34 +19,17 @@ 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 following line tells the configuration script what sort of
-   operating system this machine is likely to run.
-   USUAL-OPSYS="<name of system .h file here, without the s- or .h>"  */
-
-/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
-   is the most significant byte.  */
-
-#define WORDS_BIG_ENDIAN
-
-/* Define NO_ARG_ARRAY if you cannot take the address of the first of a
- * group of arguments and treat it as an array of the arguments.  */
-
-#define NO_ARG_ARRAY
-
 /* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend
    the 24-bit bit field into an int.  In other words, if bit fields
    are always unsigned.
 
    This flag only matters if you use USE_LISP_UNION_TYPE.  */
-
 #define EXPLICIT_SIGN_EXTEND
 
 /* Data type of load average, as read out of kmem.  */
-
 #define LOAD_AVE_TYPE long
 
 /* Convert that into an integer that is 100 for a load average of 1.0  */
-
 #define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
 
 /* Define VIRT_ADDR_VARIES if the virtual addresses of
@@ -54,7 +38,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
    Otherwise Emacs assumes that text space precedes data space,
    numerically.  */
-
 #define VIRT_ADDR_VARIES
 
 /* arch-tag: d8a0ffa4-a8f0-4736-90d3-7fd7b21b8314
index 9429e4282bfb6a5d9a5017810fc8f8f3632fd3c9..6cbfbbcdbd4f10750aa93130fde193e8e7afb69e 100644 (file)
@@ -1,6 +1,7 @@
-/* machine description file for IBM S390 in 64-bit mode
-   Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
-     Free Software Foundation, Inc.
+/* Machine description file for IBM S390 in 64-bit mode
+
+Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -17,34 +18,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/>.  */
 
-/* This file was made by copying the significant parts of amdx86-64.h
-   into ibms390.h.  */
-
-
-/* The following line tells the configuration script what sort of
-   operating system this machine is likely to run.
-   USUAL-OPSYS="<name of system .h file here, without the s- or .h>"
-
-NOTE-START
-IBM s390 64 bits (-machine=ibms390x64)
-
-  The possibilities for -opsystem are: gnu-linux.
-
-NOTE-END */
+#include "ibms390.h"
 
 #define BITS_PER_LONG 64
 #define BITS_PER_EMACS_INT 64
 
-/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
-   is the most significant byte.  */
-
-#define WORDS_BIG_ENDIAN
-
-/* Define NO_ARG_ARRAY if you cannot take the address of the first of a
- * group of arguments and treat it as an array of the arguments.  */
-
-#define NO_ARG_ARRAY
-
 /* Define the type to use.  */
 #define EMACS_INT long
 #define EMACS_UINT unsigned long
@@ -54,55 +32,13 @@ NOTE-END */
    are always unsigned.
 
    This flag only matters if you use USE_LISP_UNION_TYPE.  */
-
 #undef EXPLICIT_SIGN_EXTEND
 
-/* Data type of load average, as read out of kmem.  */
-
-#define LOAD_AVE_TYPE long
-
-/* Convert that into an integer that is 100 for a load average of 1.0  */
-
-#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
-
-/* Define VIRT_ADDR_VARIES if the virtual addresses of
-   pure and impure space as loaded can vary, and even their
-   relative order cannot be relied on.
-
-   Otherwise Emacs assumes that text space precedes data space,
-   numerically.  */
-
-#define VIRT_ADDR_VARIES
-
-/* Define HAVE_ALLOCA to say that the system provides a properly
-   working alloca function and it should be used.  Undefine it if an
-   assembler-language alloca in the file alloca.s should be used. */
-
-#define HAVE_ALLOCA
-
 /* On the 64 bit architecture, we can use 60 bits for addresses */
-
 #define VALBITS         60
 
-#define LINKER $(CC) -nostdlib
-
 /* Define XPNTR to avoid or'ing with DATA_SEG_BITS */
-
 #define XPNTR(a) XUINT (a)
 
-#undef START_FILES
-#ifdef HAVE_LIB64_DIR
-#define START_FILES pre-crt0.o /usr/lib64/crt1.o /usr/lib64/crti.o
-#else
-#define START_FILES pre-crt0.o /usr/lib/crt1.o /usr/lib/crti.o
-#endif
-
-#undef LIB_STANDARD
-#ifdef HAVE_LIB64_DIR
-#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib64/crtn.o
-#else
-#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib/crtn.o
-#endif
-
 /* arch-tag: 4b87653c-6add-4663-8691-7d9dc17b5519
    (do not change this comment) */
index 8b3c5fff064de38a215f52fc2de0ed59bce35fd9..15601fae76e42de264fd89733a8cae2362e6fc3e 100644 (file)
@@ -1,6 +1,7 @@
 /* Machine description file for intel 386.
-   Copyright (C) 1987, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-                 2008, 2009, 2010  Free Software Foundation, Inc.
+
+Copyright (C) 1987, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+  2009, 2010  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -18,89 +19,15 @@ 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 following line tells the configuration script what sort of
-   operating system this machine is likely to run.
-   USUAL-OPSYS="note"
-
-NOTE-START
-Intel 386 (-machine=intel386)
-
-  The possibilities for -opsystem are: bsd4-2, usg5-2-2, usg5-3,
-  isc2-2, 386-ix, and linux.
-
-  18.58 should support a wide variety of operating systems.
-  Use linux for Linux.
-  It isn't clear what to do on an SCO system.
-
-NOTE-END */
-
-/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
-   is the most significant byte.  */
-
-#undef WORDS_BIG_ENDIAN
-
-/* Define NO_ARG_ARRAY if you cannot take the address of the first of a
- * group of arguments and treat it as an array of the arguments.  */
-
-/* #define NO_ARG_ARRAY */
-
-/* crt0.c, if it is used, should use the i386-bsd style of entry.
-   with no extra dummy args.  On USG and XENIX,
-   NO_REMAP says this isn't used. */
-
-#define CRT0_DUMMIES bogus_fp,
-
-#ifdef SOLARIS2
-/* Data type of load average, as read out of kmem.  */
-#define LOAD_AVE_TYPE long
-
-/* Convert that into an integer that is 100 for a load average of 1.0  */
-/* This is totally uncalibrated. */
-#define LOAD_AVE_CVT(x) ((int) (((double) (x)) * 100.0 / FSCALE))
-
-/* J.W.Hawtin@lut.ac.uk say Solaris 2.4 as well as Solaris 2.1 on X86
-   requires -lkvm as well.
-   And handa@etl.gov.jp says that -lkvm needs -llelf, at least on 2.5.  */
-#define LIBS_MACHINE -lkvm -lelf
-
-/* configure thinks solaris X86 has gethostname, but it does not work,
-   so undefine it.  */
-#undef HAVE_GETHOSTNAME
-
-#else /* not SOLARIS2 */
-#ifdef USG5_4 /* Older USG systems do not support the load average.  */
-/* Data type of load average, as read out of kmem.  */
-
-#define LOAD_AVE_TYPE long
-
-/* Convert that into an integer that is 100 for a load average of 1.0  */
-/* This is totally uncalibrated. */
-
-#define LOAD_AVE_CVT(x) ((int) (((double) (x)) * 100.0 / FSCALE))
-#define FSCALE 256.0
-#endif /* USG5_4 */
-#endif /* not SOLARIS2 */
-
-#ifdef USG
-#define TEXT_START 0
-#endif /* USG */
-
-#ifdef MSDOS
-#define NO_REMAP
-#endif
-
 #ifdef WINDOWSNT
 #define VIRT_ADDR_VARIES
 #define DATA_START     get_data_start ()
-#define NO_ARG_ARRAY
 #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)
-
-#define SEGMENT_MASK ((SEGMENT_SIZE)-1)
 #endif
 
 /* arch-tag: 746338f0-cb7b-4f49-a98c-cb50817cf2ec
index 7c0ff78a0699cfe1dd06fcb2d23f3346af91c2a6..31f08d05cfcab92c3d9d7df3d9c483f8ecda3b8b 100644 (file)
@@ -1,6 +1,7 @@
 /* machine description file for Iris-4D machines.  Use with s/irix*.h.
-   Copyright (C) 1987, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-                 2008, 2009, 2010  Free Software Foundation, Inc.
+
+Copyright (C) 1987, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+  2009, 2010  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -18,66 +19,18 @@ 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 WORDS_BIG_ENDIAN if lowest-numbered byte in a word
-   is the most significant byte.  */
-
-#define WORDS_BIG_ENDIAN
-
-/* Define NO_ARG_ARRAY if you cannot take the address of the first of a
- * group of arguments and treat it as an array of the arguments.  */
-
-#define NO_ARG_ARRAY
-
 /* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend
    the bit field into an int.  In other words, if bit fields
    are always unsigned.
 
    This flag only matters if you use USE_LISP_UNION_TYPE.  */
-
 #define EXPLICIT_SIGN_EXTEND
 
-/* This machine requires completely different unexec code
-   which lives in a separate file.  Specify the file name.  */
-
-#undef UNEXEC
-#define UNEXEC unexelf.o
-
-#define TEXT_START 0x400000
-
-/*
- * 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).
- */
-
+/* 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
 
-#undef LIBS_MACHINE
-#define LIBS_MACHINE
-#define LIBS_DEBUG
-\f
-/* Use terminfo instead of termcap.  */
-
-#define TERMINFO
-
-/* 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'
-\f
-#if _MIPS_SZLONG != 64
-/* fixme: should there be 64-bit definitions?  (The ones below aren't OK.)  */
-
-/* The standard definitions of these macros would work ok,
-   but these are faster because the constants are short.  */
-
-#define XUINT(a) (((unsigned)(a) << BITS_PER_INT-VALBITS) >> BITS_PER_INT-VALBITS)
-
-#define XSET(var, type, ptr) \
-   ((var) = ((int)(type) << VALBITS) + (((unsigned) (ptr) << BITS_PER_INT-VALBITS) >> BITS_PER_INT-VALBITS))
-#endif /* _LP64 */
-
 /* arch-tag: fff5e139-9ae0-465d-afec-837c41ea0aa6
    (do not change this comment) */
index b844f12fd6fe671c090ec4f0a1021775dede7abe..8d53424ccec5c3cc10a7a7f8c98c201375a2761d 100644 (file)
@@ -1,6 +1,7 @@
 /* Machine description file for generic Motorola 68k.
-   Copyright (C) 1985, 1995, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-                 2008, 2009, 2010  Free Software Foundation, Inc.
+
+Copyright (C) 1985, 1995, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+  2008, 2009, 2010  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -17,14 +18,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/>.  */
 
-/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
-   is the most significant byte.  */
-
-#define WORDS_BIG_ENDIAN
-
 /* Now define a symbol for the cpu type, if your compiler
    does not define it automatically.  */
-
 #ifndef m68k
 #define m68k
 #endif
@@ -34,7 +29,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    are always unsigned.
 
    This flag only matters if you use USE_LISP_UNION_TYPE.  */
-
 #define EXPLICIT_SIGN_EXTEND
 
 #ifdef GNU_LINUX
@@ -42,8 +36,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #define DATA_SEG_BITS 0x80000000
 #endif
 
-#define NO_REMAP
-#define TEXT_START 0
 #endif
 
 /* arch-tag: 4eadd161-b4e8-4b82-82a1-e4ce7f42969d
index 150fc35651827551ee312545d55770173191fe2a..01735790b20ba143f566b75e891f2a9848b49c8a 100644 (file)
@@ -1,6 +1,7 @@
 /* machine description file For the powerpc Macintosh.
-   Copyright (C) 1994, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-                 2008, 2009, 2010  Free Software Foundation, Inc.
+
+Copyright (C) 1994, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+  2009, 2010  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -17,45 +18,12 @@ 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 WORDS_BIG_ENDIAN if lowest-numbered byte in a word
-   is the most significant byte.  */
-
-#define WORDS_BIG_ENDIAN
-
-/* Define NO_ARG_ARRAY if you cannot take the address of the first of a
- * group of arguments and treat it as an array of the arguments.  */
-
-#define NO_ARG_ARRAY
-
 /* Data type of load average, as read out of kmem.  */
-
 #define LOAD_AVE_TYPE long
 
 /* Convert that into an integer that is 100 for a load average of 1.0  */
-
 #define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
 
-#if (defined (__NetBSD__) || defined (__OpenBSD__)) && defined (__ELF__)
-#define HAVE_TEXT_START
-#endif
-
-/* NAKAJI Hiroyuki <nakaji@tutrp.tut.ac.jp> says this is needed
-   For MkLinux/LinuxPPC.  */
-
-#ifdef GNU_LINUX
-#define LINKER $(CC) -nostdlib
-/* s/gnu-linux.h defines this to `-z nocombreloc' which does not work here
-   because prefix-args is not used.  */
-#undef LD_SWITCH_SYSTEM_TEMACS
-#define LD_SWITCH_MACHINE_TEMACS -Xlinker -znocombreloc
-#ifdef _ARCH_PPC64
-#undef START_FILES
-#define START_FILES pre-crt0.o /usr/lib64/crt1.o /usr/lib64/crti.o
-#undef LIB_STANDARD
-#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib64/crtn.o
-#endif
-#endif
-
 #ifdef _ARCH_PPC64
 #ifndef _LP64
 #define _LP64
index 7a84b6596c8a4dbdc1a03de3de1b949b259e954e..b3a754c2b61f4f2e98c1834029a1c4f332cb52d9 100644 (file)
@@ -1,6 +1,7 @@
 /* m- file for Mips machines.
-   Copyright (C) 1987, 1992, 1999, 2001, 2002, 2003, 2004, 2005, 2006,
-                 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
+
+Copyright (C) 1987, 1992, 1999, 2001, 2002, 2003, 2004, 2005, 2006,
+  2007, 2008, 2009, 2010  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -17,57 +18,12 @@ 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 following line tells the configuration script what sort of
-   operating system this machine is likely to run.
-   USUAL-OPSYS="note"
-
-NOTE-START
-This is used on GNU/Linux and netbsd.
-NOTE-END  */
-
-/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
-   is the most significant byte.  */
-
-#if ! (defined (__MIPSEL__) || defined (MIPSEL) || defined (_MIPSEL))
-#define WORDS_BIG_ENDIAN
-#endif
-
-/* Define NO_ARG_ARRAY if you cannot take the address of the first of a
- * group of arguments and treat it as an array of the arguments.  */
-
-#define NO_ARG_ARRAY
-
 /* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend
    the 24-bit bit field into an int.  In other words, if bit fields
    are always unsigned.
 
    This flag only matters if you use USE_LISP_UNION_TYPE.  */
-
 #define EXPLICIT_SIGN_EXTEND
 
-/* Describe layout of the address space in an executing process.  */
-
-#define TEXT_START      0x00400000
-
-\f
-#if 0 /* These definitions were advantageous when not using
-        USE_LSB_TAG.  With that, they get ignored but cause errors.  */
-
-#define DATA_SEG_BITS  0x10000000
-
-/* The standard definitions of these macros would work ok,
-   but these are faster because the constants are short.  */
-
-#define XUINT(a) (((unsigned)(a) << (BITS_PER_INT-VALBITS)) >> (BITS_PER_INT-VALBITS))
-
-#define XSET(var, type, ptr)                                           \
-  ((var) =                                                             \
-   ((int)(type) << VALBITS)                                            \
-   + (((unsigned) (ptr) << (BITS_PER_INT-VALBITS)) >> (BITS_PER_INT-VALBITS)))
-
 /* arch-tag: 8fd020ee-78a7-4d87-96ce-6129f52f7bee
    (do not change this comment) */
-
-#endif /* 0 */
-
index bb8e2937b018db815fb36b50f0b1956d040e9153..ebfdb5b2d6499a12eaf81910184bfd6935e4a516 100644 (file)
@@ -1,10 +1,4 @@
 /* Machine description file for SuperH. */
 
-#ifdef __BIG_ENDIAN__
-# define WORDS_BIG_ENDIAN
-#endif
-
-#define NO_ARG_ARRAY
-
 /* arch-tag: 1b01b84f-f044-4afa-aa4b-caa54ec38966
    (do not change this comment) */
index 3eeb87a2b0e550d8725e4bb1e6e78f9dc42c60cd..26ca3caaebe08780597993c2b2fa1f4e1036d8ca 100644 (file)
@@ -1,6 +1,7 @@
 /* machine description file for Sun 4 SPARC.
-   Copyright (C) 1987, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-                 2008, 2009, 2010  Free Software Foundation, Inc.
+
+Copyright (C) 1987, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+  2009, 2010  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -17,64 +18,27 @@ 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 following line tells the configuration script what sort of
-   operating system this machine is likely to run.
-   USUAL-OPSYS="note"
-
-NOTE-START
-Use -opsystem=sunos4 for operating system version 4, and
--opsystem=bsd4-2 for earlier versions.
-NOTE-END  */
-
-/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
-   is the most significant byte.  */
-
-#define WORDS_BIG_ENDIAN
-
-/* Define NO_ARG_ARRAY if you cannot take the address of the first of a
- * group of arguments and treat it as an array of the arguments.  */
-
-#define NO_ARG_ARRAY
-
 /* __sparc__ is defined by the compiler by default.  */
 
 /* XINT must explicitly sign-extend
    This flag only matters if you use USE_LISP_UNION_TYPE.  */
-
 #define EXPLICIT_SIGN_EXTEND
 
 /* Data type of load average, as read out of kmem.  */
-
 #define LOAD_AVE_TYPE long
 
 /* Convert that into an integer that is 100 for a load average of 1.0  */
-
 #define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
 
-/* Mask for address bits within a memory segment */
-
-#define SEGMENT_MASK (SEGSIZ - 1)
-
 #ifdef __arch64__              /* GCC, 64-bit ABI.  */
-#define BITS_PER_LONG 64
-#ifdef __linux__
-#undef START_FILES
-#define START_FILES pre-crt0.o /usr/lib64/crt1.o /usr/lib64/crti.o
 
-/* The duplicate -lgcc is intentional in the definition of LIB_STANDARD.
-   The reason is that some functions in libgcc.a call functions from libc.a,
-   and some libc.a functions need functions from libgcc.a.  Since most
-   versions of ld are one-pass linkers, we need to mention -lgcc twice,
-   or else we risk getting unresolved externals.  */
-#undef LIB_STANDARD
-#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib64/crtn.o
-#endif
+#define BITS_PER_LONG 64
 
 #ifndef _LP64
-#define _LP64                  /* Done on Alpha -- not sure if it
-                                  should be here.  -- fx */
-#endif
+#define _LP64 /* Done on Alpha -- not sure if it should be here.  -- fx */
 #endif
 
+#endif  /* __arch64__ */
+
 /* arch-tag: 0a6f7882-33fd-4811-9832-7466c51e50f7
    (do not change this comment) */
index 6e0dbb79844d65b94c1bfa0d1622a9be933d7937..4efc9158a45dc95bebeffc21fcc89ca81db2f8bf 100644 (file)
@@ -1,6 +1,7 @@
 /* machine description file template.
-   Copyright (C) 1985, 1986, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-                 2008, 2009, 2010  Free Software Foundation, Inc.
+
+Copyright (C) 1985, 1986, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+  2008, 2009, 2010  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -17,21 +18,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/>.  */
 
-
-/* The following line tells the configuration script what sort of
-   operating system this machine is likely to run.
-   USUAL-OPSYS="<name of system .h file here, without the s- or .h>"  */
-
-/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
-   is the most significant byte.  */
-
-#define WORDS_BIG_ENDIAN
-
-/* Define NO_ARG_ARRAY if you cannot take the address of the first of a
- * group of arguments and treat it as an array of the arguments.  */
-
-#define NO_ARG_ARRAY
-
 /* 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 */
@@ -41,59 +27,30 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    are always unsigned.
 
    This flag only matters if you use USE_LISP_UNION_TYPE.  */
-
 #define EXPLICIT_SIGN_EXTEND
 
 /* Data type of load average, as read out of kmem.  */
-
 #define LOAD_AVE_TYPE long
 
 /* Convert that into an integer that is 100 for a load average of 1.0  */
-
 #define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
 
-/* Define CANNOT_DUMP on machines where unexec does not work.
-   Then the function dump-emacs will not be defined
-   and temacs will do (load "loadup") automatically unless told otherwise.  */
-
-#define CANNOT_DUMP
-
 /* Define VIRT_ADDR_VARIES if the virtual addresses of
    pure and impure space as loaded can vary, and even their
    relative order cannot be relied on.
 
    Otherwise Emacs assumes that text space precedes data space,
    numerically.  */
-
 #define VIRT_ADDR_VARIES
 
-/* Define NO_REMAP if memory segmentation makes it not work well
-   to change the boundary between the text section and data section
-   when Emacs is dumped.  If you define this, the preloaded Lisp
-   code will not be sharable; but that's better than failing completely.  */
-
-#define NO_REMAP
-
-/* Some really obscure 4.2-based systems (like Sequent DYNIX)
- * do not support asynchronous I/O (using SIGIO) on sockets,
- * even though it works fine on tty's.  If you have one of
- * these systems, define the following, and then use it in
- * config.h (or elsewhere) to decide when (not) to use SIGIO.
- *
- * You'd think this would go in an operating-system description file,
- * but since it only occurs on some, but not all, BSD systems, the
- * reasonable place to select for it is in the machine description
- * file.
- */
-
-#define NO_SOCK_SIGIO
-
-
-/* After adding support for a new system, modify the large case
-   statement in the `configure' script to recognize reasonable
+/* 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.  */
index fa6cc1b597754d291f7446571d84f902a61a1c2c..16e790a27695e2c9fb799f829421374dafbc5c40 100644 (file)
@@ -1,6 +1,7 @@
 /* machine description file for vax.
-   Copyright (C) 1985, 1986, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-                 2008, 2009, 2010  Free Software Foundation, Inc.
+
+Copyright (C) 1985, 1986, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+  2008, 2009, 2010  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -18,43 +19,18 @@ 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 following line tells the configuration script what sort of
-   operating system this machine is likely to run.
-   USUAL-OPSYS="note"
-
-NOTE-START
-The vax (-machine=vax) runs zillions of different operating systems.
-
-NOTE-END  */
-
-/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
-   is the most significant byte.  */
-
-#undef WORDS_BIG_ENDIAN
-
 /* #define vax    -- appears to be done automatically  */
 
-/* crt0.c should use the vax-bsd style of entry, with no dummy args.  */
-
-#define CRT0_DUMMIES
-
-#ifdef BSD_SYSTEM
 /* USG systems I know of running on Vaxes do not actually
    support the load average, so disable it for them.  */
 
 /* Data type of load average, as read out of kmem.  */
-
 #define LOAD_AVE_TYPE double
 
 /* Convert that into an integer that is 100 for a load average of 1.0  */
-
 #define LOAD_AVE_CVT(x) ((int) ((x) * 100.0))
 
-#endif /* BSD_SYSTEM */
-
-#ifdef BSD4_2
 #define HAVE_FTIME
-#endif
 
 /* arch-tag: 508bdf7a-01a0-4ce0-8eba-0704d0df55a0
    (do not change this comment) */
index d53686d9401dd6977b38665408d80659310eea07..8e1da54b25b45ad976f07ecc114382ba8fa8a177 100644 (file)
@@ -2,13 +2,5 @@
 
 Add a license notice if this grows to > 10 lines of code.  */
 
-#define NO_ARG_ARRAY
-
-#ifdef __LITTLE_ENDIAN
-#undef WORDS_BIG_ENDIAN
-#else
-#define WORDS_BIG_ENDIAN
-#endif
-
 /* arch-tag: fe5872de-d565-4d81-8fe0-ea19865b3e6a
    (do not change this comment) */
index 62aeb0fa6352ec7a74c867a58e13e2668cddbdc0..c281c89aa3e59280e192df92fdf7591448bd903c 100644 (file)
@@ -51,9 +51,7 @@ int executing_kbd_macro_iterations;
 
 Lisp_Object executing_kbd_macro;
 
-extern Lisp_Object real_this_command;
-
-Lisp_Object Fexecute_kbd_macro ();
+Lisp_Object Fexecute_kbd_macro (Lisp_Object macro, Lisp_Object count, Lisp_Object loopfunc);
 \f
 DEFUN ("start-kbd-macro", Fstart_kbd_macro, Sstart_kbd_macro, 1, 2, "P",
        doc: /* Record subsequent keyboard input, defining a keyboard macro.
@@ -64,8 +62,7 @@ Non-nil arg (prefix arg) means append to last macro defined;
 this begins by re-executing that macro as if you typed it again.
 If optional second arg, NO-EXEC, is non-nil, do not re-execute last
 macro before appending to it. */)
-     (append, no_exec)
-     Lisp_Object append, no_exec;
+  (Lisp_Object append, Lisp_Object no_exec)
 {
   if (!NILP (current_kboard->defining_kbd_macro))
     error ("Already defining kbd macro");
@@ -140,7 +137,7 @@ macro before appending to it. */)
 /* Finish defining the current keyboard macro.  */
 
 void
-end_kbd_macro ()
+end_kbd_macro (void)
 {
   current_kboard->defining_kbd_macro = Qnil;
   update_mode_lines++;
@@ -163,8 +160,7 @@ An argument of zero means repeat until error.
 
 In Lisp, optional second arg LOOPFUNC may be a function that is called prior to
 each iteration of the macro.  Iteration stops if LOOPFUNC returns nil.  */)
-     (repeat, loopfunc)
-     Lisp_Object repeat, loopfunc;
+  (Lisp_Object repeat, Lisp_Object loopfunc)
 {
   if (NILP (current_kboard->defining_kbd_macro))
     error ("Not defining kbd macro");
@@ -194,8 +190,7 @@ each iteration of the macro.  Iteration stops if LOOPFUNC returns nil.  */)
 /* Store character c into kbd macro being defined */
 
 void
-store_kbd_macro_char (c)
-     Lisp_Object c;
+store_kbd_macro_char (Lisp_Object c)
 {
   struct kboard *kb = current_kboard;
 
@@ -223,7 +218,7 @@ store_kbd_macro_char (c)
  really belong to it.  This is done in between editor commands.  */
 
 void
-finalize_kbd_macro_chars ()
+finalize_kbd_macro_chars (void)
 {
   current_kboard->kbd_macro_end = current_kboard->kbd_macro_ptr;
 }
@@ -231,7 +226,7 @@ finalize_kbd_macro_chars ()
 DEFUN ("cancel-kbd-macro-events", Fcancel_kbd_macro_events,
        Scancel_kbd_macro_events, 0, 0, 0,
        doc: /* Cancel the events added to a keyboard macro for this command.  */)
-     ()
+  (void)
 {
   current_kboard->kbd_macro_ptr = current_kboard->kbd_macro_end;
   return Qnil;
@@ -240,8 +235,7 @@ DEFUN ("cancel-kbd-macro-events", Fcancel_kbd_macro_events,
 DEFUN ("store-kbd-macro-event", Fstore_kbd_macro_event,
        Sstore_kbd_macro_event, 1, 1, 0,
        doc: /* Store EVENT into the keyboard macro being defined.  */)
-     (event)
-     Lisp_Object event;
+  (Lisp_Object event)
 {
   store_kbd_macro_char (event);
   return Qnil;
@@ -258,8 +252,7 @@ defining others, use \\[name-last-kbd-macro].
 
 In Lisp, optional second arg LOOPFUNC may be a function that is called prior to
 each iteration of the macro.  Iteration stops if LOOPFUNC returns nil.  */)
-     (prefix, loopfunc)
-     Lisp_Object prefix, loopfunc;
+  (Lisp_Object prefix, Lisp_Object loopfunc)
 {
   /* Don't interfere with recognition of the previous command
      from before this macro started.  */
@@ -286,8 +279,7 @@ each iteration of the macro.  Iteration stops if LOOPFUNC returns nil.  */)
    Called when the unwind-protect in Fexecute_kbd_macro gets invoked.  */
 
 static Lisp_Object
-pop_kbd_macro (info)
-     Lisp_Object info;
+pop_kbd_macro (Lisp_Object info)
 {
   Lisp_Object tem;
   Vexecuting_kbd_macro = XCAR (info);
@@ -305,8 +297,7 @@ COUNT is a repeat count, or nil for once, or 0 for infinite loop.
 
 Optional third arg LOOPFUNC may be a function that is called prior to
 each iteration of the macro.  Iteration stops if LOOPFUNC returns nil.  */)
-     (macro, count, loopfunc)
-     Lisp_Object macro, count, loopfunc;
+  (Lisp_Object macro, Lisp_Object count, Lisp_Object loopfunc)
 {
   Lisp_Object final;
   Lisp_Object tem;
@@ -367,14 +358,14 @@ each iteration of the macro.  Iteration stops if LOOPFUNC returns nil.  */)
 }
 \f
 void
-init_macros ()
+init_macros (void)
 {
   Vexecuting_kbd_macro = Qnil;
   executing_kbd_macro = Qnil;
 }
 
 void
-syms_of_macros ()
+syms_of_macros (void)
 {
   Qexecute_kbd_macro = intern_c_string ("execute-kbd-macro");
   staticpro (&Qexecute_kbd_macro);
index 00b7b5ba421f09056184361fd20f9934713d12b2..761b5fdf51403a26bedf4ab871a5424639c8a0a6 100644 (file)
@@ -41,16 +41,16 @@ extern Lisp_Object executing_kbd_macro;
 
 /* Finish defining the current keyboard macro.  */
 
-extern void end_kbd_macro P_ ((void));
+extern void end_kbd_macro (void);
 
 /* Declare that all chars stored so far in the kbd macro being defined
  really belong to it.  This is done in between editor commands.  */
 
-extern void finalize_kbd_macro_chars P_ ((void));
+extern void finalize_kbd_macro_chars (void);
 
 /* Store a character into kbd macro being defined */
 
-extern void store_kbd_macro_char P_ ((Lisp_Object));
+extern void store_kbd_macro_char (Lisp_Object);
 
 /* arch-tag: 8edb7088-682f-4d1f-a4d9-0fbb7284234e
    (do not change this comment) */
index 591e38fb60dc7c7039c3c73b1c71bd2eb306c6ac..8d99d6cedfe2a92b8c21f72521869b4216466d55 100644 (file)
@@ -62,7 +62,6 @@ OBJ1 =  $(BLD)/alloc.$(O)             \
        $(BLD)/callint.$(O)             \
        $(BLD)/callproc.$(O)            \
        $(BLD)/casefiddle.$(O)          \
-       $(BLD)/cm.$(O)                  \
        $(BLD)/cmds.$(O)                \
        $(BLD)/data.$(O)                \
        $(BLD)/dired.$(O)               \
@@ -98,7 +97,6 @@ OBJ1 =  $(BLD)/alloc.$(O)             \
        $(BLD)/syntax.$(O)              \
        $(BLD)/sysdep.$(O)              \
        $(BLD)/term.$(O)                \
-       $(BLD)/termcap.$(O)             \
        $(BLD)/tparam.$(O)              \
        $(BLD)/undo.$(O)                \
        $(BLD)/unexw32.$(O)             \
@@ -115,6 +113,7 @@ OBJ1 =  $(BLD)/alloc.$(O)           \
        $(BLD)/vm-limit.$(O)            \
        $(BLD)/region-cache.$(O)        \
        $(BLD)/strftime.$(O)            \
+       $(BLD)/bidi.$(O)                \
        $(BLD)/charset.$(O)             \
        $(BLD)/character.$(O)           \
        $(BLD)/chartab.$(O)             \
@@ -338,6 +337,17 @@ $(BLD)/atimer.$(O) : \
        $(SRC)/syssignal.h \
        $(SRC)/systime.h
 
+$(BLD)/bidi.$(O) : \
+       $(SRC)/bidi.c \
+       $(CONFIG_H) \
+       $(SRC)/lisp.h \
+       $(SRC)/bidimirror.h \
+       $(SRC)/biditype.h \
+       $(SRC)/buffer.h \
+       $(SRC)/character.h \
+       $(SRC)/dispextern.h \
+       $(SRC)/w32gui.h
+
 $(BLD)/buffer.$(O) : \
        $(SRC)/buffer.c \
        $(CONFIG_H) \
@@ -484,17 +494,6 @@ $(BLD)/chartab.$(O) : \
        $(SRC)/character.h \
        $(SRC)/charset.h
 
-$(BLD)/cm.$(O) : \
-       $(SRC)/cm.c \
-       $(CONFIG_H) \
-       $(SRC)/lisp.h \
-       $(SRC)/cm.h \
-       $(SRC)/dispextern.h \
-       $(SRC)/frame.h \
-       $(SRC)/termchar.h \
-       $(SRC)/termhooks.h \
-       $(SRC)/w32gui.h
-
 $(BLD)/cmds.$(O) : \
        $(SRC)/cmds.c \
        $(CONFIG_H) \
@@ -700,6 +699,7 @@ $(BLD)/eval.$(O) : \
        $(SRC)/commands.h \
        $(SRC)/composite.h \
        $(SRC)/dispextern.h \
+       $(SRC)/frame.h \
        $(SRC)/keyboard.h \
        $(SRC)/systime.h \
        $(SRC)/w32gui.h
@@ -965,6 +965,7 @@ $(BLD)/keyboard.$(O) : \
        $(SRC)/keyboard.h \
        $(SRC)/keymap.h \
        $(SRC)/macros.h \
+       $(SRC)/process.h \
        $(SRC)/puresize.h \
        $(SRC)/syntax.h \
        $(SRC)/syssignal.h \
@@ -1356,6 +1357,7 @@ $(BLD)/sysdep.$(O) : \
        $(SRC)/frame.h \
        $(SRC)/keyboard.h \
        $(SRC)/process.h \
+       $(SRC)/sysselect.h \
        $(SRC)/syssignal.h \
        $(SRC)/systime.h \
        $(SRC)/systty.h \
@@ -1397,13 +1399,6 @@ $(BLD)/term.$(O) : \
        $(SRC)/w32gui.h \
        $(SRC)/window.h
 
-$(BLD)/termcap.$(O) : \
-       $(SRC)/termcap.c \
-       $(CONFIG_H) \
-       $(EMACS_ROOT)/nt/inc/unistd.h \
-       $(EMACS_ROOT)/nt/inc/sys/file.h \
-       $(SRC)/lisp.h
-
 $(BLD)/terminal.$(O) : \
        $(SRC)/terminal.c \
        $(CONFIG_H) \
@@ -1512,6 +1507,7 @@ $(BLD)/xdisp.$(O) : \
        $(SRC)/systime.h \
        $(SRC)/termchar.h \
        $(SRC)/termhooks.h \
+       $(SRC)/termopts.h \
        $(SRC)/w32gui.h \
        $(SRC)/w32term.h \
        $(SRC)/window.h
index b3381f9c369a5d9dce1d852d1d62da1f874d21db..b5ea80562df19c781cf12fc10c1a8cdcf22b0af8 100644 (file)
@@ -32,15 +32,14 @@ static int cached_bytepos;
 static struct buffer *cached_buffer;
 static int cached_modiff;
 
-static void byte_char_debug_check P_ ((struct buffer *, int, int));
+static void byte_char_debug_check (struct buffer *, int, int);
 
 /* Nonzero means enable debugging checks on byte/char correspondences.  */
 
 static int byte_debug_flag;
 
 void
-clear_charpos_cache (b)
-     struct buffer *b;
+clear_charpos_cache (struct buffer *b)
 {
   if (cached_buffer == b)
     cached_buffer = 0;
@@ -100,9 +99,7 @@ clear_charpos_cache (b)
 }
 
 static void
-byte_char_debug_check (b, charpos, bytepos)
-     struct buffer *b;
-     int charpos, bytepos;
+byte_char_debug_check (struct buffer *b, int charpos, int bytepos)
 {
   int nchars = 0;
 
@@ -122,16 +119,13 @@ byte_char_debug_check (b, charpos, bytepos)
 }
 
 int
-charpos_to_bytepos (charpos)
-     int charpos;
+charpos_to_bytepos (int charpos)
 {
   return buf_charpos_to_bytepos (current_buffer, charpos);
 }
 
 int
-buf_charpos_to_bytepos (b, charpos)
-     struct buffer *b;
-     int charpos;
+buf_charpos_to_bytepos (struct buffer *b, int charpos)
 {
   struct Lisp_Marker *tail;
   int best_above, best_above_byte;
@@ -254,8 +248,7 @@ buf_charpos_to_bytepos (b, charpos)
    in the simplest, most reliable way.  */
 
 int
-verify_bytepos (charpos)
-     int charpos;
+verify_bytepos (int charpos)
 {
   int below = 1;
   int below_byte = 1;
@@ -315,16 +308,13 @@ verify_bytepos (charpos)
 }
 
 int
-bytepos_to_charpos (bytepos)
-     int bytepos;
+bytepos_to_charpos (int bytepos)
 {
   return buf_bytepos_to_charpos (current_buffer, bytepos);
 }
 
 int
-buf_bytepos_to_charpos (b, bytepos)
-     struct buffer *b;
-     int bytepos;
+buf_bytepos_to_charpos (struct buffer *b, int bytepos)
 {
   struct Lisp_Marker *tail;
   int best_above, best_above_byte;
@@ -443,8 +433,7 @@ buf_bytepos_to_charpos (b, bytepos)
 DEFUN ("marker-buffer", Fmarker_buffer, Smarker_buffer, 1, 1, 0,
        doc: /* Return the buffer that MARKER points into, or nil if none.
 Returns nil if MARKER points into a dead buffer.  */)
-     (marker)
-     register Lisp_Object marker;
+  (register Lisp_Object marker)
 {
   register Lisp_Object buf;
   CHECK_MARKER (marker);
@@ -464,8 +453,7 @@ Returns nil if MARKER points into a dead buffer.  */)
 DEFUN ("marker-position", Fmarker_position, Smarker_position, 1, 1, 0,
        doc: /* Return the position MARKER points at, as a character number.
 Returns nil if MARKER points nowhere.  */)
-     (marker)
-     Lisp_Object marker;
+  (Lisp_Object marker)
 {
   CHECK_MARKER (marker);
   if (XMARKER (marker)->buffer)
@@ -480,8 +468,7 @@ BUFFER defaults to the current buffer.
 If POSITION is nil, makes marker point nowhere.
 Then it no longer slows down editing in any buffer.
 Returns MARKER.  */)
-     (marker, position, buffer)
-     Lisp_Object marker, position, buffer;
+  (Lisp_Object marker, Lisp_Object position, Lisp_Object buffer)
 {
   register int charno, bytepos;
   register struct buffer *b;
@@ -556,8 +543,7 @@ Returns MARKER.  */)
    be outside the visible part.  */
 
 Lisp_Object
-set_marker_restricted (marker, pos, buffer)
-     Lisp_Object marker, pos, buffer;
+set_marker_restricted (Lisp_Object marker, Lisp_Object pos, Lisp_Object buffer)
 {
   register int charno, bytepos;
   register struct buffer *b;
@@ -632,9 +618,7 @@ set_marker_restricted (marker, pos, buffer)
    character position and the corresponding byte position.  */
 
 Lisp_Object
-set_marker_both (marker, buffer, charpos, bytepos)
-     Lisp_Object marker, buffer;
-     int charpos, bytepos;
+set_marker_both (Lisp_Object marker, Lisp_Object buffer, int charpos, int bytepos)
 {
   register struct buffer *b;
   register struct Lisp_Marker *m;
@@ -682,9 +666,7 @@ set_marker_both (marker, buffer, charpos, bytepos)
    be outside the visible part.  */
 
 Lisp_Object
-set_marker_restricted_both (marker, buffer, charpos, bytepos)
-     Lisp_Object marker, buffer;
-     int charpos, bytepos;
+set_marker_restricted_both (Lisp_Object marker, Lisp_Object buffer, int charpos, int bytepos)
 {
   register struct buffer *b;
   register struct Lisp_Marker *m;
@@ -745,8 +727,7 @@ set_marker_restricted_both (marker, buffer, charpos, bytepos)
    including those in chain fields of markers.  */
 
 void
-unchain_marker (marker)
-     register struct Lisp_Marker *marker;
+unchain_marker (register struct Lisp_Marker *marker)
 {
   register struct Lisp_Marker *tail, *prev, *next;
   register struct buffer *b;
@@ -796,8 +777,7 @@ unchain_marker (marker)
 /* Return the char position of marker MARKER, as a C integer.  */
 
 int
-marker_position (marker)
-     Lisp_Object marker;
+marker_position (Lisp_Object marker)
 {
   register struct Lisp_Marker *m = XMARKER (marker);
   register struct buffer *buf = m->buffer;
@@ -811,8 +791,7 @@ marker_position (marker)
 /* Return the byte position of marker MARKER, as a C integer.  */
 
 int
-marker_byte_position (marker)
-     Lisp_Object marker;
+marker_byte_position (Lisp_Object marker)
 {
   register struct Lisp_Marker *m = XMARKER (marker);
   register struct buffer *buf = m->buffer;
@@ -827,17 +806,18 @@ marker_byte_position (marker)
   return i;
 }
 \f
-DEFUN ("copy-marker", Fcopy_marker, Scopy_marker, 1, 2, 0,
+DEFUN ("copy-marker", Fcopy_marker, Scopy_marker, 0, 2, 0,
        doc: /* Return a new marker pointing at the same place as MARKER.
 If argument is a number, makes a new marker pointing
 at that position in the current buffer.
+If MARKER is not specified, the new marker does not point anywhere.
 The optional argument TYPE specifies the insertion type of the new marker;
 see `marker-insertion-type'.  */)
-     (marker, type)
-     register Lisp_Object marker, type;
+  (register Lisp_Object marker, Lisp_Object type)
 {
   register Lisp_Object new;
 
+  if (!NILP (marker))
   CHECK_TYPE (INTEGERP (marker) || MARKERP (marker), Qinteger_or_marker_p, marker);
 
   new = Fmake_marker ();
@@ -851,8 +831,7 @@ DEFUN ("marker-insertion-type", Fmarker_insertion_type,
        Smarker_insertion_type, 1, 1, 0,
        doc: /* Return insertion type of MARKER: t if it stays after inserted text.
 The value nil means the marker stays before text inserted there.  */)
-     (marker)
-     register Lisp_Object marker;
+  (register Lisp_Object marker)
 {
   CHECK_MARKER (marker);
   return XMARKER (marker)->insertion_type ? Qt : Qnil;
@@ -863,8 +842,7 @@ DEFUN ("set-marker-insertion-type", Fset_marker_insertion_type,
        doc: /* Set the insertion-type of MARKER to TYPE.
 If TYPE is t, it means the marker advances when you insert text at it.
 If TYPE is nil, it means the marker stays behind when you insert text at it.  */)
-     (marker, type)
-     Lisp_Object marker, type;
+  (Lisp_Object marker, Lisp_Object type)
 {
   CHECK_MARKER (marker);
 
@@ -875,8 +853,7 @@ If TYPE is nil, it means the marker stays behind when you insert text at it.  */
 DEFUN ("buffer-has-markers-at", Fbuffer_has_markers_at, Sbuffer_has_markers_at,
        1, 1, 0,
        doc: /* Return t if there are markers pointing at POSITION in the current buffer.  */)
-     (position)
-     Lisp_Object position;
+  (Lisp_Object position)
 {
   register struct Lisp_Marker *tail;
   register int charno;
@@ -898,8 +875,7 @@ DEFUN ("buffer-has-markers-at", Fbuffer_has_markers_at, Sbuffer_has_markers_at,
 /* For debugging -- count the markers in buffer BUF.  */
 
 int
-count_markers (buf)
-     struct buffer *buf;
+count_markers (struct buffer *buf)
 {
   int total = 0;
   struct Lisp_Marker *tail;
@@ -911,7 +887,7 @@ count_markers (buf)
 }
 \f
 void
-syms_of_marker ()
+syms_of_marker (void)
 {
   defsubr (&Smarker_position);
   defsubr (&Smarker_buffer);
index 37ae2e6acb5c210985ad09b56767bac19a0fd423..6e7f651189e4051b5bbc03d789ce0c5b67c10552 100644 (file)
--- a/src/md5.c
+++ b/src/md5.c
@@ -1,7 +1,7 @@
 /* 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, 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004,
-                 2005, 2006, 2007  Free Software Foundation, Inc.
+                 2005, 2006, 2007, 2010  Free Software Foundation, Inc.
 
    This file is part of the GNU C Library.
 
@@ -40,7 +40,7 @@
 #ifdef _LIBC
 # include <endian.h>
 # if __BYTE_ORDER == __BIG_ENDIAN
-#  define WORDS_BIG_ENDIAN 1
+#  define WORDS_BIGENDIAN 1
 # endif
 /* We need to keep the namespace clean so define the MD5 function
    protected using leading __ .  */
@@ -55,7 +55,7 @@
 
 #include "md5.h"
 
-#ifdef WORDS_BIG_ENDIAN
+#ifdef WORDS_BIGENDIAN
 # define SWAP(n)                                                       \
     (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24))
 #else
@@ -71,8 +71,7 @@ static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ...  */ };
 /* Initialize structure containing state of computation.
    (RFC 1321, 3.3: Step 3)  */
 void
-md5_init_ctx (ctx)
-     struct md5_ctx *ctx;
+md5_init_ctx (struct md5_ctx *ctx)
 {
   ctx->A = 0x67452301;
   ctx->B = 0xefcdab89;
@@ -89,9 +88,7 @@ md5_init_ctx (ctx)
    IMPORTANT: On some systems it is required that RESBUF is correctly
    aligned for a 32 bits value.  */
 void *
-md5_read_ctx (ctx, resbuf)
-     const struct md5_ctx *ctx;
-     void *resbuf;
+md5_read_ctx (const struct md5_ctx *ctx, void *resbuf)
 {
   ((md5_uint32 *) resbuf)[0] = SWAP (ctx->A);
   ((md5_uint32 *) resbuf)[1] = SWAP (ctx->B);
@@ -107,9 +104,7 @@ md5_read_ctx (ctx, resbuf)
    IMPORTANT: On some systems it is required that RESBUF is correctly
    aligned for a 32 bits value.  */
 void *
-md5_finish_ctx (ctx, resbuf)
-     struct md5_ctx *ctx;
-     void *resbuf;
+md5_finish_ctx (struct md5_ctx *ctx, void *resbuf)
 {
   /* Take yet unprocessed bytes into account.  */
   md5_uint32 bytes = ctx->buflen;
@@ -138,9 +133,7 @@ md5_finish_ctx (ctx, resbuf)
    resulting message digest number will be written into the 16 bytes
    beginning at RESBLOCK.  */
 int
-md5_stream (stream, resblock)
-     FILE *stream;
-     void *resblock;
+md5_stream (FILE *stream, void *resblock)
 {
   /* Important: BLOCKSIZE must be a multiple of 64.  */
 #define BLOCKSIZE 4096
@@ -195,10 +188,7 @@ md5_stream (stream, resblock)
    output yields to the wanted ASCII representation of the message
    digest.  */
 void *
-md5_buffer (buffer, len, resblock)
-     const char *buffer;
-     size_t len;
-     void *resblock;
+md5_buffer (const char *buffer, size_t len, void *resblock)
 {
   struct md5_ctx ctx;
 
@@ -214,10 +204,7 @@ md5_buffer (buffer, len, resblock)
 
 
 void
-md5_process_bytes (buffer, len, ctx)
-     const void *buffer;
-     size_t len;
-     struct md5_ctx *ctx;
+md5_process_bytes (const void *buffer, size_t len, struct md5_ctx *ctx)
 {
   /* const void aligned_buffer = buffer; */
 
@@ -287,10 +274,7 @@ md5_process_bytes (buffer, len, ctx)
    It is assumed that LEN % 64 == 0.  */
 
 void
-md5_process_block (buffer, len, ctx)
-     const void *buffer;
-     size_t len;
-     struct md5_ctx *ctx;
+md5_process_block (const void *buffer, size_t len, struct md5_ctx *ctx)
 {
   md5_uint32 correct_words[16];
   const md5_uint32 *words = buffer;
index a23dbd089ba252c7a33663eb2a89d3c0cca97e2f..cf9566b864b4d404a88c7f53e0a3437581e9c006 100644 (file)
--- a/src/md5.h
+++ b/src/md5.h
@@ -97,21 +97,21 @@ struct md5_ctx
 
 /* Initialize structure containing state of computation.
    (RFC 1321, 3.3: Step 3)  */
-extern void md5_init_ctx __P ((struct md5_ctx *ctx));
+extern void md5_init_ctx (struct md5_ctx *ctx);
 
 /* Starting with the result of former calls of this function (or the
    initialization function update the context for the next LEN bytes
    starting at BUFFER.
    It is necessary that LEN is a multiple of 64!!! */
-extern void md5_process_block __P ((const void *buffer, size_t len,
-                                     struct md5_ctx *ctx));
+extern void md5_process_block (const void *buffer, size_t len,
+                               struct md5_ctx *ctx);
 
 /* Starting with the result of former calls of this function (or the
    initialization function update the context for the next LEN bytes
    starting at BUFFER.
    It is NOT required that LEN is a multiple of 64.  */
-extern void md5_process_bytes __P ((const void *buffer, size_t len,
-                                     struct md5_ctx *ctx));
+extern void md5_process_bytes (const void *buffer, size_t len,
+                               struct md5_ctx *ctx);
 
 /* Process the remaining bytes in the buffer and put result from CTX
    in first 16 bytes following RESBUF.  The result is always in little
@@ -120,7 +120,7 @@ extern void md5_process_bytes __P ((const void *buffer, size_t len,
 
    IMPORTANT: On some systems it is required that RESBUF is correctly
    aligned for a 32 bits value.  */
-extern void *md5_finish_ctx __P ((struct md5_ctx *ctx, void *resbuf));
+extern void *md5_finish_ctx (struct md5_ctx *ctx, void *resbuf);
 
 
 /* Put result from CTX in first 16 bytes following RESBUF.  The result is
@@ -129,20 +129,20 @@ extern void *md5_finish_ctx __P ((struct md5_ctx *ctx, void *resbuf));
 
    IMPORTANT: On some systems it is required that RESBUF is correctly
    aligned for a 32 bits value.  */
-extern void *md5_read_ctx __P ((const struct md5_ctx *ctx, void *resbuf));
+extern void *md5_read_ctx (const struct md5_ctx *ctx, void *resbuf);
 
 
 /* Compute MD5 message digest for bytes read from STREAM.  The
    resulting message digest number will be written into the 16 bytes
    beginning at RESBLOCK.  */
-extern int md5_stream __P ((FILE *stream, void *resblock));
+extern int md5_stream (FILE *stream, void *resblock);
 
 /* Compute MD5 message digest for LEN bytes beginning at BUFFER.  The
    result is always in little endian byte order, so that a byte-wise
    output yields to the wanted ASCII representation of the message
    digest.  */
-extern void *md5_buffer __P ((const char *buffer, size_t len,
-                               void *resblock));
+extern void *md5_buffer (const char *buffer, size_t len,
+                         void *resblock);
 
 #endif /* md5.h */
 
index d811968b13f7d36df756545cc86e8042f6468b40..9ec1558527dfa263292f6ed59c6c786c7320b25c 100644 (file)
@@ -25,17 +25,6 @@ extern int etext;
 /* Some systems need this before <sys/resource.h>.  */
 #include <sys/types.h>
 
-#ifdef _LIBC
-
-#include <sys/resource.h>
-#define BSD4_2                 /* Tell code below to use getrlimit.  */
-
-/* Old Linux startup code won't define __data_start.  */
-extern int etext, __data_start; weak_extern (__data_start)
-#define start_of_data()        (&__data_start ?: &etext)
-
-#else /* not _LIBC */
-
 #ifdef HAVE_SYS_RESOURCE_H
 # include <sys/time.h>
 # include <sys/resource.h>
@@ -45,37 +34,9 @@ extern int etext, __data_start; weak_extern (__data_start)
 # endif
 #endif
 
-#ifdef CYGWIN
-#define BSD4_2
-#endif
-
-#ifndef BSD4_2
-#ifndef USG
-#ifndef MSDOS
-#ifndef WINDOWSNT
-#include <sys/vlimit.h>
-#endif /* not WINDOWSNT */
-#endif /* not MSDOS */
-#endif /* not USG */
-#else /* if BSD4_2 */
-#include <sys/time.h>
-#include <sys/resource.h>
-#endif /* BSD4_2 */
-
-#ifdef emacs
-/* The important properties of this type are that 1) it's a pointer, and
-   2) arithmetic on it should work as if the size of the object pointed
-   to has a size of 1.  */
-typedef POINTER_TYPE *POINTER;
-
 typedef unsigned long SIZE;
 
-#ifdef NULL
-#undef NULL
-#endif
-#define NULL ((POINTER) 0)
-
-extern POINTER start_of_data ();
+extern char *start_of_data (void);
 #if defined USE_LSB_TAG
 #define EXCEEDS_LISP_PTR(ptr) 0
 #elif defined DATA_SEG_BITS
@@ -85,26 +46,5 @@ extern POINTER start_of_data ();
 #define EXCEEDS_LISP_PTR(ptr) ((EMACS_UINT) (ptr) >> VALBITS)
 #endif
 
-#ifdef DATA_START
-#define start_of_data() ((char *)DATA_START)
-#endif
-
-#ifdef BSD_SYSTEM
-#ifndef DATA_SEG_BITS
-#ifndef DATA_START
-extern char etext;
-#define start_of_data() &etext
-#endif
-#endif
-#endif
-
-#else  /* not emacs */
-extern char etext;
-#define start_of_data() &etext
-#endif /* not emacs */
-
-#endif /* not _LIBC */
-
-
 /* arch-tag: fe39244e-e54f-4208-b7aa-02556f7841c5
    (do not change this comment) */
index bfe54a53328e4127855cdcad5a922f2f8abbd939..05a296e45fc507842160beb5989543fc1d4bb69a 100644 (file)
@@ -61,12 +61,6 @@ extern HMENU current_popup_menu;
 #define HAVE_BOXES 1
 #endif
 
-/* The timestamp of the last input event Emacs received from the X server.  */
-/* Defined in keyboard.c.  */
-extern unsigned long last_event_timestamp;
-
-extern Lisp_Object QCtoggle, QCradio;
-
 Lisp_Object menu_items;
 
 /* If non-nil, means that the global vars defined here are already in use.
@@ -87,7 +81,7 @@ int menu_items_n_panes;
 static int menu_items_submenu_depth;
 
 void
-init_menu_items ()
+init_menu_items (void)
 {
   if (!NILP (menu_items_inuse))
     error ("Trying to use a menu from within a menu-entry");
@@ -107,13 +101,12 @@ init_menu_items ()
 /* Call at the end of generating the data in menu_items.  */
 
 void
-finish_menu_items ()
+finish_menu_items (void)
 {
 }
 
 Lisp_Object
-unuse_menu_items (dummy)
-     Lisp_Object dummy;
+unuse_menu_items (Lisp_Object dummy)
 {
   return menu_items_inuse = Qnil;
 }
@@ -122,7 +115,7 @@ unuse_menu_items (dummy)
    in menu_items.  */
 
 void
-discard_menu_items ()
+discard_menu_items (void)
 {
   /* Free the structure if it is especially large.
      Otherwise, hold on to it, to save time.  */
@@ -134,19 +127,20 @@ discard_menu_items ()
   xassert (NILP (menu_items_inuse));
 }
 
+#ifdef HAVE_NS
 static Lisp_Object
 cleanup_popup_menu (Lisp_Object arg)
 {
   discard_menu_items ();
   return Qnil;
 }
+#endif
 
 /* This undoes save_menu_items, and it is called by the specpdl unwind
    mechanism.  */
 
 static Lisp_Object
-restore_menu_items (saved)
-     Lisp_Object saved;
+restore_menu_items (Lisp_Object saved)
 {
   menu_items = XCAR (saved);
   menu_items_inuse = (! NILP (menu_items) ? Qt : Qnil);
@@ -164,7 +158,7 @@ restore_menu_items (saved)
    It will be restored when the specpdl is unwound.  */
 
 void
-save_menu_items ()
+save_menu_items (void)
 {
   Lisp_Object saved = list4 (!NILP (menu_items_inuse) ? menu_items : Qnil,
                             make_number (menu_items_used),
@@ -179,7 +173,7 @@ save_menu_items ()
 /* Make the menu_items vector twice as large.  */
 
 static void
-grow_menu_items ()
+grow_menu_items (void)
 {
   menu_items_allocated *= 2;
   menu_items = larger_vector (menu_items, menu_items_allocated, Qnil);
@@ -188,7 +182,7 @@ grow_menu_items ()
 /* Begin a submenu.  */
 
 static void
-push_submenu_start ()
+push_submenu_start (void)
 {
   if (menu_items_used + 1 > menu_items_allocated)
     grow_menu_items ();
@@ -200,7 +194,7 @@ push_submenu_start ()
 /* End a submenu.  */
 
 static void
-push_submenu_end ()
+push_submenu_end (void)
 {
   if (menu_items_used + 1 > menu_items_allocated)
     grow_menu_items ();
@@ -212,7 +206,7 @@ push_submenu_end ()
 /* Indicate boundary between left and right.  */
 
 static void
-push_left_right_boundary ()
+push_left_right_boundary (void)
 {
   if (menu_items_used + 1 > menu_items_allocated)
     grow_menu_items ();
@@ -224,8 +218,7 @@ push_left_right_boundary ()
    NAME is the pane name.  PREFIX_VEC is a prefix key for this pane.  */
 
 static void
-push_menu_pane (name, prefix_vec)
-     Lisp_Object name, prefix_vec;
+push_menu_pane (Lisp_Object name, Lisp_Object prefix_vec)
 {
   if (menu_items_used + MENU_ITEMS_PANE_LENGTH > menu_items_allocated)
     grow_menu_items ();
@@ -246,8 +239,7 @@ push_menu_pane (name, prefix_vec)
    item, one of nil, `toggle' or `radio'. */
 
 static void
-push_menu_item (name, enable, key, def, equiv, type, selected, help)
-     Lisp_Object name, enable, key, def, equiv, type, selected, help;
+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 ();
@@ -272,8 +264,8 @@ struct skp
      int notbuttons;
   };
 
-static void single_menu_item P_ ((Lisp_Object, Lisp_Object, Lisp_Object,
-                                 void *));
+static void single_menu_item (Lisp_Object, Lisp_Object, Lisp_Object,
+                              void *);
 
 /* This is a recursive subroutine of keymap_panes.
    It handles one keymap, KEYMAP.
@@ -332,9 +324,7 @@ single_keymap_panes (Lisp_Object keymap, Lisp_Object pane_name,
    If we encounter submenus deeper than SKP->MAXDEPTH levels, ignore them.  */
 
 static void
-single_menu_item (key, item, dummy, skp_v)
-     Lisp_Object key, item, dummy;
-     void *skp_v;
+single_menu_item (Lisp_Object key, Lisp_Object item, Lisp_Object dummy, void *skp_v)
 {
   Lisp_Object map, item_string, enabled;
   struct gcpro gcpro1, gcpro2;
@@ -456,9 +446,7 @@ single_menu_item (key, item, dummy, skp_v)
    and generate menu panes for them in menu_items.  */
 
 static void
-keymap_panes (keymaps, nmaps)
-     Lisp_Object *keymaps;
-     int nmaps;
+keymap_panes (Lisp_Object *keymaps, int nmaps)
 {
   int mapno;
 
@@ -477,8 +465,7 @@ keymap_panes (keymaps, nmaps)
 
 /* Push the items in a single pane defined by the alist PANE.  */
 static void
-list_of_items (pane)
-     Lisp_Object pane;
+list_of_items (Lisp_Object pane)
 {
   Lisp_Object tail, item, item1;
 
@@ -505,8 +492,7 @@ list_of_items (pane)
    alist-of-alists MENU.
    This handles old-fashioned calls to x-popup-menu.  */
 void
-list_of_panes (menu)
-     Lisp_Object menu;
+list_of_panes (Lisp_Object menu)
 {
   Lisp_Object tail;
 
@@ -531,8 +517,7 @@ list_of_panes (menu)
    whose event type is ITEM_KEY (with string ITEM_NAME)
    and whose contents come from the list of keymaps MAPS.  */
 int
-parse_single_submenu (item_key, item_name, maps)
-     Lisp_Object item_key, item_name, maps;
+parse_single_submenu (Lisp_Object item_key, Lisp_Object item_name, Lisp_Object maps)
 {
   Lisp_Object length;
   int len;
@@ -583,7 +568,7 @@ parse_single_submenu (item_key, item_name, maps)
 /* Allocate a widget_value, blocking input.  */
 
 widget_value *
-xmalloc_widget_value ()
+xmalloc_widget_value (void)
 {
   widget_value *value;
 
@@ -600,8 +585,7 @@ xmalloc_widget_value ()
    must be left alone.  */
 
 void
-free_menubar_widget_value_tree (wv)
-     widget_value *wv;
+free_menubar_widget_value_tree (widget_value *wv)
 {
   if (! wv) return;
 
@@ -627,8 +611,7 @@ free_menubar_widget_value_tree (wv)
    in menu_items starting at index START, up to index END.  */
 
 widget_value *
-digest_single_submenu (start, end, top_level_items)
-     int start, end, top_level_items;
+digest_single_submenu (int start, int end, int top_level_items)
 {
   widget_value *wv, *prev_wv, *save_wv, *first_wv;
   int i;
@@ -679,7 +662,7 @@ digest_single_submenu (start, end, top_level_items)
        {
          /* Create a new pane.  */
          Lisp_Object pane_name, prefix;
-         char *pane_string;
+         const char *pane_string;
 
          panes_seen++;
 
@@ -697,6 +680,12 @@ digest_single_submenu (start, end, top_level_items)
 
              ASET (menu_items, i + MENU_ITEMS_PANE_NAME, pane_name);
            }
+#elif defined (USE_LUCID) && defined (HAVE_XFT)
+         if (STRINGP (pane_name))
+            {
+              pane_name = ENCODE_UTF_8 (pane_name);
+             ASET (menu_items, i + MENU_ITEMS_PANE_NAME, pane_name);
+            }
 #elif !defined (HAVE_MULTILINGUAL_MENU)
          if (STRINGP (pane_name) && STRING_MULTIBYTE (pane_name))
            {
@@ -770,6 +759,18 @@ digest_single_submenu (start, end, top_level_items)
              descrip = ENCODE_SYSTEM (descrip);
              ASET (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY, descrip);
            }
+#elif USE_LUCID
+         if (STRINGP (item_name))
+           {
+              item_name = ENCODE_UTF_8 (item_name);
+             ASET (menu_items, i + MENU_ITEMS_ITEM_NAME, item_name);
+           }
+
+         if (STRINGP (descrip))
+           {
+             descrip = ENCODE_UTF_8 (descrip);
+             ASET (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY, descrip);
+           }
 #elif !defined (HAVE_MULTILINGUAL_MENU)
           if (STRING_MULTIBYTE (item_name))
            {
@@ -838,8 +839,7 @@ digest_single_submenu (start, end, top_level_items)
    tree is constructed, and small strings are relocated.  So we must wait
    until no GC can happen before storing pointers into lisp values.  */
 void
-update_submenu_strings (first_wv)
-     widget_value *first_wv;
+update_submenu_strings (widget_value *first_wv)
 {
   widget_value *wv;
 
@@ -873,11 +873,7 @@ update_submenu_strings (first_wv)
    VECTOR is an array of menu events for the whole menu.  */
 
 void
-find_and_call_menu_selection (f, menu_bar_items_used, vector, client_data)
-     FRAME_PTR f;
-     int menu_bar_items_used;
-     Lisp_Object vector;
-     void *client_data;
+find_and_call_menu_selection (FRAME_PTR f, int menu_bar_items_used, Lisp_Object vector, void *client_data)
 {
   Lisp_Object prefix, entry;
   Lisp_Object *subprefix_stack;
@@ -1064,13 +1060,12 @@ keyboard input, then this normally results in a quit and
 `x-popup-menu' does not return.  But if POSITION is a mouse button
 event (indicating that the user invoked the menu with the mouse) then
 no quit occurs and `x-popup-menu' returns nil.  */)
-  (position, menu)
-     Lisp_Object position, menu;
+  (Lisp_Object position, Lisp_Object menu)
 {
   Lisp_Object keymap, tem;
   int xpos = 0, ypos = 0;
   Lisp_Object title;
-  char *error_name = NULL;
+  const char *error_name = NULL;
   Lisp_Object selection = Qnil;
   FRAME_PTR f = NULL;
   Lisp_Object x, y, window;
@@ -1146,12 +1141,12 @@ no quit occurs and `x-popup-menu' returns nil.  */)
        Lisp_Object bar_window;
        enum scroll_bar_part part;
        unsigned long time;
-       void (*mouse_position_hook) P_ ((struct frame **, int,
-                                        Lisp_Object *,
-                                        enum scroll_bar_part *,
-                                        Lisp_Object *,
-                                        Lisp_Object *,
-                                        unsigned long *)) =
+        void (*mouse_position_hook) (struct frame **, int,
+                                     Lisp_Object *,
+                                     enum scroll_bar_part *,
+                                     Lisp_Object *,
+                                     Lisp_Object *,
+                                     unsigned long *) =
          FRAME_TERMINAL (new_f)->mouse_position_hook;
 
        if (mouse_position_hook)
@@ -1350,7 +1345,7 @@ no quit occurs and `x-popup-menu' returns nil.  */)
 }
 
 void
-syms_of_menu ()
+syms_of_menu (void)
 {
   staticpro (&menu_items);
   menu_items = Qnil;
index 5f3c3d24e2294a9b4957f36c3e5cbc6ad2f04c2c..5e62327da9f6b839add205c3993703e864e365da 100644 (file)
@@ -21,17 +21,24 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 extern Lisp_Object Vmenu_updating_frame;
 
-extern void init_menu_items P_ ((void));
-extern void finish_menu_items P_ ((void));
-extern void discard_menu_items P_ ((void));
-extern void save_menu_items P_ ((void));
-extern int parse_single_submenu P_ ((Lisp_Object, Lisp_Object, Lisp_Object));
-extern void list_of_panes P_ ((Lisp_Object));
-#if defined (USE_X_TOOLKIT) || defined (USE_GTK) || defined (HAVE_NTGUI)
-extern void free_menubar_widget_value_tree P_ ((widget_value *));
-extern void update_submenu_strings P_ ((widget_value *));
-extern void find_and_call_menu_selection P_ ((FRAME_PTR, int,
-                                             Lisp_Object, void *));
+extern void x_set_menu_bar_lines (struct frame *f,
+                                  Lisp_Object value,
+                                  Lisp_Object oldval);
+
+extern void init_menu_items (void);
+extern void finish_menu_items (void);
+extern void discard_menu_items (void);
+extern void save_menu_items (void);
+extern int parse_single_submenu (Lisp_Object, Lisp_Object, Lisp_Object);
+extern void list_of_panes (Lisp_Object);
+#if defined (USE_X_TOOLKIT) || defined (USE_GTK) || defined (HAVE_NTGUI) \
+  || defined (HAVE_NS)
+extern void free_menubar_widget_value_tree (widget_value *);
+extern void update_submenu_strings (widget_value *);
+extern void find_and_call_menu_selection (FRAME_PTR, int,
+                                          Lisp_Object, void *);
+extern widget_value *xmalloc_widget_value (void);
+extern widget_value *digest_single_submenu (int, int, int);
 #endif
 
 #ifdef HAVE_X_WINDOWS
@@ -39,11 +46,11 @@ extern void mouse_position_for_popup (FRAME_PTR f, int *x, int *y);
 #endif
 
 extern Lisp_Object w32_menu_show (FRAME_PTR, int, int, int, int,
-                                 Lisp_Object, char **);
+                                 Lisp_Object, const char **);
 extern Lisp_Object ns_menu_show (FRAME_PTR, int, int, int, int,
-                                Lisp_Object, char **);
+                                Lisp_Object, const char **);
 extern Lisp_Object xmenu_show (FRAME_PTR, int, int, int, int,
-                              Lisp_Object, char **, EMACS_UINT);
+                              Lisp_Object, const char **, EMACS_UINT);
 #endif /* MENU_H */
 
 /* arch-tag: c32b2778-724d-4e85-81d7-45f98530a988
index 564346fd4722c454a591b27e83172eeaf11d39ce..009d94c36a8832055c78242fc9b89f505a8bb917 100644 (file)
@@ -143,18 +143,13 @@ Lisp_Object Qcase_fold_search;
 
 Lisp_Object Qread_expression_history;
 
-extern Lisp_Object Voverriding_local_map;
-
-extern Lisp_Object Qmouse_face;
-
-extern Lisp_Object Qfield;
 \f
 /* Put minibuf on currently selected frame's minibuffer.
    We do this whenever the user starts a new minibuffer
    or when a minibuffer exits.  */
 
 void
-choose_minibuf_frame ()
+choose_minibuf_frame (void)
 {
   if (FRAMEP (selected_frame)
       && FRAME_LIVE_P (XFRAME (selected_frame))
@@ -193,8 +188,7 @@ choose_minibuf_frame ()
 }
 
 Lisp_Object
-choose_minibuf_frame_1 (ignore)
-     Lisp_Object ignore;
+choose_minibuf_frame_1 (Lisp_Object ignore)
 {
   choose_minibuf_frame ();
   return Qnil;
@@ -205,8 +199,7 @@ DEFUN ("set-minibuffer-window", Fset_minibuffer_window,
        doc: /* Specify which minibuffer window to use for the minibuffer.
 This affects where the minibuffer is displayed if you put text in it
 without invoking the usual minibuffer commands.  */)
-     (window)
-     Lisp_Object window;
+  (Lisp_Object window)
 {
   CHECK_WINDOW (window);
   if (! MINI_WINDOW_P (XWINDOW (window)))
@@ -220,27 +213,26 @@ without invoking the usual minibuffer commands.  */)
 \f
 /* Actual minibuffer invocation. */
 
-static Lisp_Object read_minibuf_unwind P_ ((Lisp_Object));
-static Lisp_Object run_exit_minibuf_hook P_ ((Lisp_Object));
-static Lisp_Object read_minibuf P_ ((Lisp_Object, Lisp_Object,
-                                    Lisp_Object, Lisp_Object,
-                                    int, Lisp_Object,
-                                    Lisp_Object, Lisp_Object,
-                                    int, int));
-static Lisp_Object read_minibuf_noninteractive P_ ((Lisp_Object, Lisp_Object,
-                                                   Lisp_Object, Lisp_Object,
-                                                   int, Lisp_Object,
-                                                   Lisp_Object, Lisp_Object,
-                                                   int, int));
-static Lisp_Object string_to_object P_ ((Lisp_Object, Lisp_Object));
+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,
+                                 int, Lisp_Object,
+                                 Lisp_Object, Lisp_Object,
+                                 int, int);
+static Lisp_Object read_minibuf_noninteractive (Lisp_Object, Lisp_Object,
+                                                Lisp_Object, Lisp_Object,
+                                                int, Lisp_Object,
+                                                Lisp_Object, Lisp_Object,
+                                                int, int);
+static Lisp_Object string_to_object (Lisp_Object, Lisp_Object);
 
 
 /* Read a Lisp object from VAL and return it.  If VAL is an empty
    string, and DEFALT is a string, read from DEFALT instead of VAL.  */
 
 static Lisp_Object
-string_to_object (val, defalt)
-     Lisp_Object val, defalt;
+string_to_object (Lisp_Object val, Lisp_Object defalt)
 {
   struct gcpro gcpro1, gcpro2;
   Lisp_Object expr_and_pos;
@@ -281,19 +273,12 @@ string_to_object (val, defalt)
    from read_minibuf to do the job if noninteractive.  */
 
 static Lisp_Object
-read_minibuf_noninteractive (map, initial, prompt, backup_n, expflag,
-                            histvar, histpos, defalt, allow_props,
-                            inherit_input_method)
-     Lisp_Object map;
-     Lisp_Object initial;
-     Lisp_Object prompt;
-     Lisp_Object backup_n;
-     int expflag;
-     Lisp_Object histvar;
-     Lisp_Object histpos;
-     Lisp_Object defalt;
-     int allow_props;
-     int inherit_input_method;
+read_minibuf_noninteractive (Lisp_Object map, Lisp_Object initial,
+                            Lisp_Object prompt, Lisp_Object backup_n,
+                            int expflag,
+                            Lisp_Object histvar, Lisp_Object histpos,
+                            Lisp_Object defalt,
+                            int allow_props, int inherit_input_method)
 {
   int size, len;
   char *line, *s;
@@ -342,8 +327,7 @@ DEFUN ("minibufferp", Fminibufferp,
        doc: /* Return t if BUFFER is a minibuffer.
 No argument or nil as argument means use current buffer as BUFFER.
 BUFFER can be a buffer or a buffer name.  */)
-     (buffer)
-     Lisp_Object buffer;
+  (Lisp_Object buffer)
 {
   Lisp_Object tem;
 
@@ -362,7 +346,7 @@ DEFUN ("minibuffer-prompt-end", Fminibuffer_prompt_end,
        Sminibuffer_prompt_end, 0, 0, 0,
        doc: /* Return the buffer position of the end of the minibuffer prompt.
 Return (point-min) if current buffer is not a minibuffer.  */)
-     ()
+  (void)
 {
   /* This function is written to be most efficient when there's a prompt.  */
   Lisp_Object beg, end, tem;
@@ -384,7 +368,7 @@ DEFUN ("minibuffer-contents", Fminibuffer_contents,
        Sminibuffer_contents, 0, 0, 0,
        doc: /* Return the user input in a minibuffer as a string.
 If the current buffer is not a minibuffer, return its entire contents.  */)
-     ()
+  (void)
 {
   int prompt_end = XINT (Fminibuffer_prompt_end ());
   return make_buffer_string (prompt_end, ZV, 1);
@@ -394,7 +378,7 @@ DEFUN ("minibuffer-contents-no-properties", Fminibuffer_contents_no_properties,
        Sminibuffer_contents_no_properties, 0, 0, 0,
        doc: /* Return the user input in a minibuffer as a string, without text-properties.
 If the current buffer is not a minibuffer, return its entire contents.  */)
-     ()
+  (void)
 {
   int prompt_end = XINT (Fminibuffer_prompt_end ());
   return make_buffer_string (prompt_end, ZV, 0);
@@ -405,7 +389,7 @@ DEFUN ("minibuffer-completion-contents", Fminibuffer_completion_contents,
        doc: /* Return the user input in a minibuffer before point as a string.
 That is what completion commands operate on.
 If the current buffer is not a minibuffer, return its entire contents.  */)
-     ()
+  (void)
 {
   int prompt_end = XINT (Fminibuffer_prompt_end ());
   if (PT < prompt_end)
@@ -438,18 +422,10 @@ If the current buffer is not a minibuffer, return its entire contents.  */)
    current input method.  */
 
 static Lisp_Object
-read_minibuf (map, initial, prompt, backup_n, expflag,
-             histvar, histpos, defalt, allow_props, inherit_input_method)
-     Lisp_Object map;
-     Lisp_Object initial;
-     Lisp_Object prompt;
-     Lisp_Object backup_n;
-     int expflag;
-     Lisp_Object histvar;
-     Lisp_Object histpos;
-     Lisp_Object defalt;
-     int allow_props;
-     int inherit_input_method;
+read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
+             Lisp_Object backup_n, 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 ();
@@ -463,9 +439,6 @@ read_minibuf (map, initial, prompt, backup_n, expflag,
   Lisp_Object empty_minibuf;
   Lisp_Object dummy, frame;
 
-  extern Lisp_Object Qfront_sticky;
-  extern Lisp_Object Qrear_nonsticky;
-
   specbind (Qminibuffer_default, defalt);
 
   /* If Vminibuffer_completing_file_name is `lambda' on entry, it was t
@@ -839,12 +812,10 @@ read_minibuf (map, initial, prompt, backup_n, expflag,
  used for nonrecursive minibuffer invocations */
 
 Lisp_Object
-get_minibuffer (depth)
-     int depth;
+get_minibuffer (int depth)
 {
   Lisp_Object tail, num, buf;
   char name[24];
-  extern Lisp_Object nconc2 ();
 
   XSETFASTINT (num, depth);
   tail = Fnthcdr (num, Vminibuffer_list);
@@ -884,8 +855,7 @@ get_minibuffer (depth)
 }
 
 static Lisp_Object
-run_exit_minibuf_hook (data)
-     Lisp_Object data;
+run_exit_minibuf_hook (Lisp_Object data)
 {
   if (!NILP (Vminibuffer_exit_hook) && !EQ (Vminibuffer_exit_hook, Qunbound)
       && !NILP (Vrun_hooks))
@@ -898,8 +868,7 @@ run_exit_minibuf_hook (data)
    not, and it restores the current window, buffer, etc. */
 
 static Lisp_Object
-read_minibuf_unwind (data)
-     Lisp_Object data;
+read_minibuf_unwind (Lisp_Object data)
 {
   Lisp_Object old_deactivate_mark;
   Lisp_Object window;
@@ -1001,9 +970,7 @@ POSITION in the minibuffer.  Any integer value less than or equal to
 one puts point at the beginning of the string.  *Note* that this
 behavior differs from the way such arguments are used in `completing-read'
 and some related functions, which use zero-indexing for POSITION.  */)
-   (prompt, initial_contents, keymap, read, hist, default_value, inherit_input_method)
-     Lisp_Object prompt, initial_contents, keymap, read, hist, default_value;
-     Lisp_Object inherit_input_method;
+  (Lisp_Object prompt, Lisp_Object initial_contents, Lisp_Object keymap, Lisp_Object read, Lisp_Object hist, Lisp_Object default_value, Lisp_Object inherit_input_method)
 {
   Lisp_Object histvar, histpos, val;
   struct gcpro gcpro1;
@@ -1045,8 +1012,7 @@ Prompt with PROMPT.  If non-nil, optional second arg INITIAL-CONTENTS
 is a string to insert in the minibuffer before reading.
 \(INITIAL-CONTENTS can also be a cons of a string and an integer.
 Such arguments are used as in `read-from-minibuffer'.)  */)
-     (prompt, initial_contents)
-     Lisp_Object prompt, initial_contents;
+  (Lisp_Object prompt, Lisp_Object initial_contents)
 {
   CHECK_STRING (prompt);
   return read_minibuf (Vminibuffer_local_map, initial_contents,
@@ -1060,8 +1026,7 @@ Prompt with PROMPT.  If non-nil, optional second arg INITIAL-CONTENTS
 is a string to insert in the minibuffer before reading.
 \(INITIAL-CONTENTS can also be a cons of a string and an integer.
 Such arguments are used as in `read-from-minibuffer'.)  */)
-     (prompt, initial_contents)
-     Lisp_Object prompt, initial_contents;
+  (Lisp_Object prompt, Lisp_Object initial_contents)
 {
   return Feval (read_minibuf (Vread_expression_map, initial_contents,
                              prompt, Qnil, 1, Qread_expression_history,
@@ -1085,9 +1050,7 @@ Fourth arg DEFAULT-VALUE is the default value or the list of default values.
  empty string.
 Fifth arg INHERIT-INPUT-METHOD, if non-nil, means the minibuffer inherits
  the current input method and the setting of `enable-multibyte-characters'.  */)
-     (prompt, initial_input, history, default_value, inherit_input_method)
-     Lisp_Object prompt, initial_input, history, default_value;
-     Lisp_Object inherit_input_method;
+  (Lisp_Object prompt, Lisp_Object initial_input, Lisp_Object history, Lisp_Object default_value, Lisp_Object inherit_input_method)
 {
   Lisp_Object val;
   val = Fread_from_minibuffer (prompt, initial_input, Qnil,
@@ -1108,8 +1071,7 @@ Such values are treated as in `read-from-minibuffer', but are normally
 not useful in this function.)
 Third arg INHERIT-INPUT-METHOD, if non-nil, means the minibuffer inherits
 the current input method and the setting of`enable-multibyte-characters'.  */)
-     (prompt, initial, inherit_input_method)
-     Lisp_Object prompt, initial, inherit_input_method;
+  (Lisp_Object prompt, Lisp_Object initial, Lisp_Object inherit_input_method)
 {
   CHECK_STRING (prompt);
   return read_minibuf (Vminibuffer_local_ns_map, initial, prompt, Qnil,
@@ -1121,8 +1083,7 @@ DEFUN ("read-command", Fread_command, Sread_command, 1, 2, 0,
        doc: /* Read the name of a command and return as a symbol.
 Prompt with PROMPT.  By default, return DEFAULT-VALUE or its first element
 if it is a list.  */)
-     (prompt, default_value)
-     Lisp_Object prompt, default_value;
+  (Lisp_Object prompt, Lisp_Object default_value)
 {
   Lisp_Object name, default_string;
 
@@ -1144,8 +1105,7 @@ if it is a list.  */)
 DEFUN ("read-function", Fread_function, Sread_function, 1, 1, 0,
        doc: /* One arg PROMPT, a string.  Read the name of a function and return as a symbol.
 Prompt with PROMPT.  */)
-     (prompt)
-     Lisp_Object prompt;
+  (Lisp_Object prompt)
 {
   return Fintern (Fcompleting_read (prompt, Vobarray, Qfboundp, Qt, Qnil, Qnil, Qnil, Qnil),
                  Qnil);
@@ -1157,8 +1117,7 @@ DEFUN ("read-variable", Fread_variable, Sread_variable, 1, 2, 0,
 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.  */)
-     (prompt, default_value)
-     Lisp_Object prompt, default_value;
+  (Lisp_Object prompt, Lisp_Object default_value)
 {
   Lisp_Object name, default_string;
 
@@ -1190,8 +1149,7 @@ If `read-buffer-completion-ignore-case' is non-nil, completion ignores
 case while reading the buffer name.
 If `read-buffer-function' is non-nil, this works by calling it as a
 function, instead of the usual behavior.  */)
-     (prompt, def, require_match)
-     Lisp_Object prompt, def, require_match;
+  (Lisp_Object prompt, Lisp_Object def, Lisp_Object require_match)
 {
   Lisp_Object args[4], result;
   unsigned char *s;
@@ -1249,8 +1207,7 @@ function, instead of the usual behavior.  */)
 }
 \f
 static Lisp_Object
-minibuf_conform_representation (string, basis)
-     Lisp_Object string, basis;
+minibuf_conform_representation (Lisp_Object string, Lisp_Object basis)
 {
   if (STRING_MULTIBYTE (string) == STRING_MULTIBYTE (basis))
     return string;
@@ -1292,8 +1249,7 @@ or the symbol from the obarray.  If COLLECTION is a hash-table,
 predicate is called with two arguments: the key and the value.
 Additionally to this predicate, `completion-regexp-list'
 is used to further constrain the set of candidates.  */)
-     (string, collection, predicate)
-     Lisp_Object string, collection, predicate;
+  (Lisp_Object string, Lisp_Object collection, Lisp_Object predicate)
 {
   Lisp_Object bestmatch, tail, elt, eltstring;
   /* Size in bytes of BESTMATCH.  */
@@ -1564,8 +1520,7 @@ is used to further constrain the set of candidates.
 An obsolete optional fourth argument HIDE-SPACES is still accepted for
 backward compatibility.  If non-nil, strings in COLLECTION that start
 with a space are ignored unless STRING itself starts with a space.  */)
-     (string, collection, predicate, hide_spaces)
-     Lisp_Object string, collection, predicate, hide_spaces;
+  (Lisp_Object string, Lisp_Object collection, Lisp_Object predicate, Lisp_Object hide_spaces)
 {
   Lisp_Object tail, elt, eltstring;
   Lisp_Object allmatches;
@@ -1774,9 +1729,7 @@ If INHERIT-INPUT-METHOD is non-nil, the minibuffer inherits
 
 Completion ignores case if the ambient value of
   `completion-ignore-case' is non-nil.  */)
-     (prompt, collection, predicate, require_match, initial_input, hist, def, inherit_input_method)
-     Lisp_Object prompt, collection, predicate, require_match, initial_input;
-     Lisp_Object hist, def, inherit_input_method;
+  (Lisp_Object prompt, Lisp_Object collection, Lisp_Object predicate, Lisp_Object require_match, Lisp_Object initial_input, Lisp_Object hist, Lisp_Object def, Lisp_Object inherit_input_method)
 {
   Lisp_Object val, histvar, histpos, position;
   Lisp_Object init;
@@ -1843,7 +1796,7 @@ Completion ignores case if the ambient value of
   RETURN_UNGCPRO (unbind_to (count, val));
 }
 \f
-Lisp_Object Fassoc_string ();
+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,
@@ -1851,8 +1804,7 @@ DEFUN ("test-completion", Ftest_completion, Stest_completion, 2, 3, 0,
 Takes the same arguments as `all-completions' and `try-completion'.
 If COLLECTION is a function, it is called with three arguments:
 the values STRING, PREDICATE and `lambda'.  */)
-       (string, collection, predicate)
-     Lisp_Object string, collection, predicate;
+  (Lisp_Object string, Lisp_Object collection, Lisp_Object predicate)
 {
   Lisp_Object regexps, tail, tem = Qnil;
   int i = 0;
@@ -1970,8 +1922,7 @@ If the argument FLAG is nil, invoke `try-completion', if it's t, invoke
 
 The arguments STRING and PREDICATE are as in `try-completion',
 `all-completions', and `test-completion'. */)
-     (string, predicate, flag)
-     Lisp_Object string, predicate, flag;
+  (Lisp_Object string, Lisp_Object predicate, Lisp_Object flag)
 {
   if (NILP (flag))
     return Ftry_completion (string, Vbuffer_alist, predicate);
@@ -2015,9 +1966,7 @@ is ignored.
 
 Unlike `assoc', KEY can also match an entry in LIST consisting of a
 single string, rather than a cons cell whose car is a string.  */)
-       (key, list, case_fold)
-     register Lisp_Object key;
-     Lisp_Object list, case_fold;
+  (register Lisp_Object key, Lisp_Object list, Lisp_Object case_fold)
 {
   register Lisp_Object tail;
 
@@ -2046,7 +1995,7 @@ single string, rather than a cons cell whose car is a string.  */)
 \f
 DEFUN ("minibuffer-depth", Fminibuffer_depth, Sminibuffer_depth, 0, 0, 0,
        doc: /* Return current depth of activations of minibuffer, a nonnegative integer.  */)
-     ()
+  (void)
 {
   return make_number (minibuf_level);
 }
@@ -2054,21 +2003,21 @@ DEFUN ("minibuffer-depth", Fminibuffer_depth, Sminibuffer_depth, 0, 0, 0,
 DEFUN ("minibuffer-prompt", Fminibuffer_prompt, Sminibuffer_prompt, 0, 0, 0,
        doc: /* Return the prompt string of the currently-active minibuffer.
 If no minibuffer is active, return nil.  */)
-     ()
+  (void)
 {
   return Fcopy_sequence (minibuf_prompt);
 }
 
 \f
 void
-init_minibuf_once ()
+init_minibuf_once (void)
 {
   Vminibuffer_list = Qnil;
   staticpro (&Vminibuffer_list);
 }
 
 void
-syms_of_minibuf ()
+syms_of_minibuf (void)
 {
   minibuf_level = 0;
   minibuf_prompt = Qnil;
index 20c1092a62a7bbc8911ff864c717e88d7af064b8..3570cecd451dcb71baebde0acb4ff7cf8459bb59 100644 (file)
 # define mktime my_mktime
 #endif /* DEBUG */
 
-#ifndef __P
-# if defined __GNUC__ || (defined __STDC__ && __STDC__)
-#  define __P(args) args
-# else
-#  define __P(args) ()
-# endif  /* GCC.  */
-#endif  /* Not __P.  */
-
 #ifndef CHAR_BIT
 # define CHAR_BIT 8
 #endif
index a413184f966386db0bda0385c6b74622e42e2fc6..086cad2ff84889db4b2b49e6309bcc70040ba294 100644 (file)
@@ -35,11 +35,10 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <sys/time.h>
 #include <dos.h>
 #include <errno.h>
-#include <string.h>     /* for bzero and string functions */
+#include <string.h>     /* for memset and string functions */
 #include <sys/stat.h>    /* for _fixpath */
 #include <unistd.h>     /* for chdir, dup, dup2, etc. */
 #include <dir.h>        /* for getdisk */
-#if __DJGPP__ >= 2
 #pragma pack(0)                 /* dir.h does a pack(4), which isn't GCC's default */
 #include <fcntl.h>
 #include <io.h>                 /* for setmode */
@@ -47,7 +46,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <sys/farptr.h>         /* for _farsetsel, _farnspokeb */
 #include <libc/dosio.h>  /* for _USE_LFN */
 #include <conio.h>      /* for cputs */
-#endif
 
 #include "msdos.h"
 #include "systime.h"
@@ -70,8 +68,10 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <pc.h>
 #include <ctype.h>
 /* #include <process.h> */
-/* Damn that local process.h!  Instead we can define P_WAIT ourselves.  */
+/* Damn that local process.h!  Instead we can define P_WAIT and
+   spawnve ourselves.  */
 #define P_WAIT 1
+extern int spawnve (int, const char *, char *const [], char *const []);
 
 #ifndef _USE_LFN
 #define _USE_LFN 0
@@ -81,8 +81,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #define _dos_ds _go32_info_block.selector_for_linear_memory
 #endif
 
-#if __DJGPP__ > 1
-
 #include <signal.h>
 #include "syssignal.h"
 
@@ -104,10 +102,9 @@ int _crt0_startup_flags = (_CRT0_FLAG_UNIX_SBRK | _CRT0_FLAG_FILL_SBRK_MEMORY);
 #endif /* GNU_MALLOC */
 
 #endif /* not SYSTEM_MALLOC */
-#endif /* __DJGPP__ > 1 */
 
 static unsigned long
-event_timestamp ()
+event_timestamp (void)
 {
   struct time t;
   unsigned long s;
@@ -143,7 +140,7 @@ static int mouse_button_translate[NUM_MOUSE_BUTTONS];
 static int mouse_button_count;
 
 void
-mouse_on ()
+mouse_on (void)
 {
   union REGS regs;
 
@@ -160,7 +157,7 @@ mouse_on ()
 }
 
 void
-mouse_off ()
+mouse_off (void)
 {
   union REGS regs;
 
@@ -200,8 +197,7 @@ DEFUN ("msdos-set-mouse-buttons", Fmsdos_set_mouse_buttons, Smsdos_set_mouse_but
 This is useful with mice that report the number of buttons inconsistently,
 e.g., if the number of buttons is reported as 3, but Emacs only sees 2 of
 them.  This happens with wheeled mice on Windows 9X, for example.  */)
-     (nbuttons)
-     Lisp_Object nbuttons;
+  (Lisp_Object nbuttons)
 {
   int n;
 
@@ -227,8 +223,7 @@ mouse_get_xy (int *x, int *y)
 }
 
 void
-mouse_moveto (x, y)
-     int x, y;
+mouse_moveto (int x, int y)
 {
   union REGS regs;
   struct tty_display_info *tty = CURTTY ();
@@ -242,8 +237,7 @@ mouse_moveto (x, y)
 }
 
 static int
-mouse_pressed (b, xp, yp)
-     int b, *xp, *yp;
+mouse_pressed (int b, int *xp, int *yp)
 {
   union REGS regs;
 
@@ -258,8 +252,7 @@ mouse_pressed (b, xp, yp)
 }
 
 static int
-mouse_released (b, xp, yp)
-     int b, *xp, *yp;
+mouse_released (int b, int *xp, int *yp)
 {
   union REGS regs;
 
@@ -274,8 +267,7 @@ mouse_released (b, xp, yp)
 }
 
 static int
-mouse_button_depressed (b, xp, yp)
-     int b, *xp, *yp;
+mouse_button_depressed (int b, int *xp, int *yp)
 {
   union REGS regs;
 
@@ -293,12 +285,9 @@ mouse_button_depressed (b, xp, yp)
 }
 
 void
-mouse_get_pos (f, insist, bar_window, part, x, y, time)
-     FRAME_PTR *f;
-     int insist;
-     Lisp_Object *bar_window, *x, *y;
-     enum scroll_bar_part *part;
-     unsigned long *time;
+mouse_get_pos (FRAME_PTR *f, int insist, Lisp_Object *bar_window,
+              enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y,
+              unsigned long *time)
 {
   int ix, iy;
   Lisp_Object frame, tail;
@@ -316,7 +305,7 @@ mouse_get_pos (f, insist, bar_window, part, x, y, time)
 }
 
 static void
-mouse_check_moved ()
+mouse_check_moved (void)
 {
   int x, y;
 
@@ -343,7 +332,7 @@ mouse_clear_clicks (void)
 }
 
 void
-mouse_init ()
+mouse_init (void)
 {
   union REGS regs;
   struct tty_display_info *tty = CURTTY ();
@@ -427,7 +416,6 @@ extern Lisp_Object Qbar, Qhbar;
    colors for newly-created frames.  */
 static int initial_screen_colors[2];
 
-#if __DJGPP__ > 1
 /* Update the screen from a part of relocated DOS/V screen buffer which
    begins at OFFSET and includes COUNT characters.  */
 static void
@@ -444,79 +432,20 @@ dosv_refresh_virtual_screen (int offset, int count)
   regs.x.cx = count;
   __dpmi_int (0x10, &regs);
 }
-#endif
 
 static void
-dos_direct_output (y, x, buf, len)
-     int x, y;
-     char *buf;
-     int len;
+dos_direct_output (int y, int x, char *buf, int len)
 {
   int t0 = 2 * (x + y * screen_size_X);
   int t = t0 + (int) ScreenPrimary;
   int l0 = len;
 
-#if (__DJGPP__ < 2)
-  while (--len >= 0) {
-    dosmemput (buf++, 1, t);
-    t += 2;
-  }
-#else
   /* This is faster.  */
   for (_farsetsel (_dos_ds); --len >= 0; t += 2, buf++)
     _farnspokeb (t, *buf);
 
   if (screen_virtual_segment)
     dosv_refresh_virtual_screen (t0, l0);
-#endif
-}
-#endif
-
-/* Flash the screen as a substitute for BEEPs.  */
-
-#if (__DJGPP__ < 2)
-static void
-do_visible_bell (xorattr)
-     unsigned char xorattr;
-{
-  asm volatile
-    ("  movb   $1,%%dl                         \n\
-visible_bell_0:                                        \n\
-       movl   _ScreenPrimary,%%eax             \n\
-       call   dosmemsetup                      \n\
-       movl   %%eax,%%ebx                      \n\
-       movl   %1,%%ecx                         \n\
-       movb   %0,%%al                          \n\
-       incl   %%ebx                            \n\
-visible_bell_1:                                        \n\
-       xorb   %%al,%%gs:(%%ebx)                \n\
-       addl   $2,%%ebx                         \n\
-       decl   %%ecx                            \n\
-       jne    visible_bell_1                   \n\
-       decb   %%dl                             \n\
-       jne    visible_bell_3                   \n\
-visible_bell_2:                                        \n\
-       movzwl %%ax,%%eax                       \n\
-        movzwl %%ax,%%eax                      \n\
-       movzwl %%ax,%%eax                       \n\
-       movzwl %%ax,%%eax                       \n\
-       decw   %%cx                             \n\
-       jne    visible_bell_2                   \n\
-       jmp    visible_bell_0                   \n\
-visible_bell_3:"
-     : /* no output */
-     : "m" (xorattr), "g" (screen_size)
-     : "%eax", "%ebx", /* "%gs",*/ "%ecx", "%edx");
-}
-
-static void
-ScreenVisualBell (void)
-{
-  /* This creates an xor-mask that will swap the default fore- and
-     background colors.  */
-  do_visible_bell (((FRAME_FOREGROUND_PIXEL (SELECTED_FRAME ())
-                    ^ FRAME_BACKGROUND_PIXEL (SELECTED_FRAME ()))
-                   * 0x11) & 0x7f);
 }
 #endif
 
@@ -572,8 +501,7 @@ vga_installed (void)
    ROWS x COLS frame.  */
 
 void
-dos_set_window_size (rows, cols)
-     int *rows, *cols;
+dos_set_window_size (int *rows, int *cols)
 {
   char video_name[30];
   union REGS regs;
@@ -590,8 +518,7 @@ dos_set_window_size (rows, 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 = XSYMBOL (Fintern_soft (build_string (video_name),
-                                     Qnil))-> value;
+  video_mode = Fsymbol_value (Fintern_soft (build_string (video_name), Qnil));
 
   if (INTEGERP (video_mode)
       && (video_mode_value = XINT (video_mode)) > 0)
@@ -611,9 +538,6 @@ dos_set_window_size (rows, cols)
 
   /* Find one of the dimensions supported by standard EGA/VGA
      which gives us at least the required dimensions.  */
-
-#if __DJGPP__ > 1
-
   else
     {
       static struct {
@@ -642,41 +566,6 @@ dos_set_window_size (rows, cols)
        }
     }
 
-#else /* not __DJGPP__ > 1 */
-
-  else if (*rows <= 25)
-    {
-      if (current_rows != 25 || current_cols != 80)
-       {
-         regs.x.ax = 3;
-         int86 (0x10, &regs, &regs);
-         regs.x.ax = 0x1101;
-         regs.h.bl = 0;
-         int86 (0x10, &regs, &regs);
-         regs.x.ax = 0x1200;
-         regs.h.bl = 32;
-         int86 (0x10, &regs, &regs);
-         regs.x.ax = 3;
-         int86 (0x10, &regs, &regs);
-       }
-    }
-  else if (*rows <= 50)
-    if (have_vga && (current_rows != 50 || current_cols != 80)
-       || *rows <= 43 && (current_rows != 43 || current_cols != 80))
-      {
-       regs.x.ax = 3;
-       int86 (0x10, &regs, &regs);
-       regs.x.ax = 0x1112;
-       regs.h.bl = 0;
-       int86 (0x10, &regs, &regs);
-       regs.x.ax = 0x1200;
-       regs.h.bl = 32;
-       int86 (0x10, &regs, &regs);
-       regs.x.ax = 0x0100;
-       regs.x.cx = 7;
-       int86 (0x10, &regs, &regs);
-      }
-#endif /* not __DJGPP__ > 1 */
 
   if (have_mouse)
     {
@@ -693,7 +582,6 @@ dos_set_window_size (rows, cols)
   screen_size_Y = *rows;
   screen_size = *cols * *rows;
 
-#if __DJGPP__ > 1
   /* If the dimensions changed, the mouse highlight info is invalid.  */
   if (current_rows != *rows || current_cols != *cols)
     {
@@ -708,7 +596,6 @@ dos_set_window_size (rows, cols)
          dpyinfo->mouse_face_window = Qnil;
        }
     }
-#endif
 
   /* Enable bright background colors.  */
   bright_bg ();
@@ -723,7 +610,7 @@ dos_set_window_size (rows, cols)
    the mouse cursor may need to be refreshed.  */
 
 static void
-mouse_off_maybe ()
+mouse_off_maybe (void)
 {
   int x, y;
 
@@ -747,7 +634,6 @@ mouse_off_maybe ()
 static void
 msdos_set_cursor_shape (struct frame *f, int start_line, int width)
 {
-#if __DJGPP__ > 1
   unsigned desired_cursor;
   __dpmi_regs regs;
   int max_line, top_line, bot_line;
@@ -824,7 +710,6 @@ msdos_set_cursor_shape (struct frame *f, int start_line, int width)
   regs.h.ah = 1;
   regs.x.cx = desired_cursor;
   __dpmi_int (0x10, &regs);
-#endif /* __DJGPP__ > 1 */
 }
 
 static void
@@ -944,7 +829,7 @@ IT_set_face (int face)
       bg = tem2;
     }
   if (tty->termscript)
-    fprintf (tty->termscript, "<FACE %d: %d/%d[FG:%d/BG:%d]>", face,
+    fprintf (tty->termscript, "<FACE %d: %lu/%lu[FG:%lu/BG:%lu]>", face,
             fp->foreground, fp->background, fg, bg);
   if (fg >= 0 && fg < 16)
     {
@@ -976,12 +861,6 @@ IT_write_glyphs (struct frame *f, struct glyph *str, int str_len)
   struct frame *sf;
   unsigned char *conversion_buffer;
 
-  /* Do we need to consider conversion of unibyte characters to
-     multibyte?  */
-  int convert_unibyte_characters
-    = (NILP (current_buffer->enable_multibyte_characters)
-       && unibyte_display_via_language_environment);
-
   /* If terminal_coding does any conversion, use it, otherwise use
      safe_terminal_coding.  We can't use CODING_REQUIRE_ENCODING here
      because it always returns 1 if terminal_coding.src_multibyte is 1.  */
@@ -1297,8 +1176,6 @@ fast_find_position (struct window *w, int pos, int *hpos, int *vpos)
 static void
 IT_note_mode_line_highlight (struct window *w, int x, int mode_line_p)
 {
-  struct frame *f = XFRAME (w->frame);
-  struct tty_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
   struct glyph_row *row;
 
   if (mode_line_p)
@@ -1308,9 +1185,8 @@ IT_note_mode_line_highlight (struct window *w, int x, int mode_line_p)
 
   if (row->enabled_p)
     {
-      extern Lisp_Object Qhelp_echo;
       struct glyph *glyph, *end;
-      Lisp_Object help, map;
+      Lisp_Object help;
 
       /* Find the glyph under X.  */
       glyph = (row->glyphs[TEXT_AREA]
@@ -1447,7 +1323,6 @@ IT_note_mouse_highlight (struct frame *f, int x, int y)
 
       /* Check for mouse-face and help-echo.  */
       {
-       extern Lisp_Object Qmouse_face;
        Lisp_Object mouse_face, overlay, position, *overlay_vec;
        int noverlays, obegv, ozv;
        struct buffer *obuf;
@@ -1572,7 +1447,6 @@ IT_note_mouse_highlight (struct frame *f, int x, int y)
        /* Look for a `help-echo' property.  */
        {
          Lisp_Object help;
-         extern Lisp_Object Qhelp_echo;
 
          /* Check overlays first.  */
          help = Qnil;
@@ -1712,14 +1586,16 @@ IT_display_cursor (int on)
       ScreenSetCursor (current_pos_Y, current_pos_X);
       cursor_cleared = 0;
       if (tty->termscript)
-       fprintf (tty->termscript, "\nCURSOR ON");
+       fprintf (tty->termscript, "\nCURSOR ON (%dx%d)",
+                current_pos_Y, current_pos_X);
     }
   else if (!on && !cursor_cleared)
     {
       ScreenSetCursor (-1, -1);
       cursor_cleared = 1;
       if (tty->termscript)
-       fprintf (tty->termscript, "\nCURSOR OFF");
+       fprintf (tty->termscript, "\nCURSOR OFF (%dx%d)",
+                current_pos_Y, current_pos_X);
     }
 }
 
@@ -1969,10 +1845,7 @@ IT_copy_glyphs (int xfrom, int xto, size_t len, int ypos)
 
 /* Insert and delete glyphs.  */
 static void
-IT_insert_glyphs (f, start, len)
-     struct frame *f;
-     register struct glyph *start;
-     register int len;
+IT_insert_glyphs (struct frame *f, struct glyph *start, int len)
 {
   int shift_by_width = screen_size_X - (new_pos_X + len);
 
@@ -1985,19 +1858,17 @@ IT_insert_glyphs (f, start, len)
 }
 
 static void
-IT_delete_glyphs (f, n)
-     struct frame *f;
-     register int n;
+IT_delete_glyphs (struct frame *f, int n)
 {
   abort ();
 }
 
 /* set-window-configuration on window.c needs this.  */
 void
-x_set_menu_bar_lines (f, value, oldval)
-     struct frame *f;
-     Lisp_Object value, oldval;
+x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
 {
+  extern void set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object);
+
   set_menu_bar_lines (f, value, oldval);
 }
 
@@ -2041,7 +1912,6 @@ IT_set_terminal_modes (struct terminal *term)
   startup_screen_size_Y = screen_size_Y;
   startup_screen_attrib = ScreenAttrib;
 
-#if __DJGPP__ > 1
   /* Is DOS/V (or any other RSIS software which relocates
      the screen) installed?  */
   {
@@ -2065,14 +1935,13 @@ IT_set_terminal_modes (struct terminal *term)
           already point to the relocated buffer address returned by
           the Int 10h/AX=FEh call above.  DJGPP v2.02 and later sets
           ScreenPrimary to that address at startup under DOS/V.  */
-       if (regs.x.es != (ScreenPrimary >> 4) & 0xffff)
+       if (regs.x.es != ((ScreenPrimary >> 4) & 0xffff))
          screen_old_address = ScreenPrimary;
        screen_virtual_segment = regs.x.es;
        screen_virtual_offset  = regs.x.di;
        ScreenPrimary = (screen_virtual_segment << 4) + screen_virtual_offset;
       }
   }
-#endif /* __DJGPP__ > 1 */
 
   ScreenGetCursor (&startup_pos_Y, &startup_pos_X);
   ScreenRetrieve (startup_screen_buffer = xmalloc (screen_size * 2));
@@ -2170,8 +2039,7 @@ IT_set_terminal_window (struct frame *f, int foo)
 DEFUN ("msdos-remember-default-colors", Fmsdos_remember_default_colors,
        Smsdos_remember_default_colors, 1, 1, 0,
        doc: /* Remember the screen colors of the current frame.  */)
-     (frame)
-     Lisp_Object frame;
+  (Lisp_Object frame)
 {
   struct frame *f;
 
@@ -2184,12 +2052,12 @@ DEFUN ("msdos-remember-default-colors", Fmsdos_remember_default_colors,
      frame colors are reversed.  */
   initial_screen_colors[0] = FRAME_FOREGROUND_PIXEL (f);
   initial_screen_colors[1] = FRAME_BACKGROUND_PIXEL (f);
+
+  return Qnil;
 }
 
 void
-IT_set_frame_parameters (f, alist)
-     struct frame *f;
-     Lisp_Object alist;
+IT_set_frame_parameters (struct frame *f, Lisp_Object alist)
 {
   Lisp_Object tail;
   int i, j, length = XINT (Flength (alist));
@@ -2199,33 +2067,22 @@ IT_set_frame_parameters (f, alist)
     = (Lisp_Object *) alloca (length * sizeof (Lisp_Object));
   /* Do we have to reverse the foreground and background colors?  */
   int reverse = EQ (Fcdr (Fassq (Qreverse, f->param_alist)), Qt);
-  int need_to_reverse, was_reverse = reverse;
   int redraw = 0, fg_set = 0, bg_set = 0;
   unsigned long orig_fg, orig_bg;
-  Lisp_Object frame_bg, frame_fg;
-  extern Lisp_Object Qdefault, QCforeground, QCbackground;
   struct tty_display_info *tty = FRAME_TTY (f);
 
   /* If we are creating a new frame, begin with the original screen colors
      used for the initial frame.  */
-  if (EQ (alist, Vdefault_frame_alist)
+  if (!f->default_face_done_p
       && initial_screen_colors[0] != -1 && initial_screen_colors[1] != -1)
     {
       FRAME_FOREGROUND_PIXEL (f) = initial_screen_colors[0];
       FRAME_BACKGROUND_PIXEL (f) = initial_screen_colors[1];
       init_frame_faces (f);
+      f->default_face_done_p = 1;
     }
-  orig_fg = FRAME_FOREGROUND_PIXEL (f);
-  orig_bg = FRAME_BACKGROUND_PIXEL (f);
-  frame_fg = Fcdr (Fassq (Qforeground_color, f->param_alist));
-  frame_bg = Fcdr (Fassq (Qbackground_color, f->param_alist));
-  /* frame_fg and frame_bg could be nil if, for example,
-     f->param_alist is nil, e.g. if we are called from
-     Fmake_terminal_frame.  */
-  if (NILP (frame_fg))
-    frame_fg = build_string (unspecified_fg);
-  if (NILP (frame_bg))
-    frame_bg = build_string (unspecified_bg);
+  orig_fg = reverse ? FRAME_BACKGROUND_PIXEL (f) : FRAME_FOREGROUND_PIXEL (f);
+  orig_bg = reverse ? FRAME_FOREGROUND_PIXEL (f) : FRAME_BACKGROUND_PIXEL (f);
 
   /* Extract parm names and values into those vectors.  */
   i = 0;
@@ -2253,58 +2110,75 @@ IT_set_frame_parameters (f, alist)
        reverse = EQ (val, Qt);
     }
 
-  need_to_reverse = reverse && !was_reverse;
-  if (tty->termscript && need_to_reverse)
+  if (tty->termscript && reverse)
     fprintf (tty->termscript, "<INVERSE-VIDEO>\n");
 
   /* Now process the alist elements in reverse of specified order.  */
   for (i--; i >= 0; i--)
     {
-      Lisp_Object prop, val, frame;
+      Lisp_Object prop, val;
 
       prop = parms[i];
       val  = values[i];
 
       if (EQ (prop, Qforeground_color))
        {
-         unsigned long new_color = load_color (f, NULL, val, need_to_reverse
+         unsigned long new_color = load_color (f, NULL, val, reverse
                                                ? LFACE_BACKGROUND_INDEX
                                                : LFACE_FOREGROUND_INDEX);
          if (new_color !=  FACE_TTY_DEFAULT_COLOR
              && new_color != FACE_TTY_DEFAULT_FG_COLOR
              && new_color != FACE_TTY_DEFAULT_BG_COLOR)
            {
-             FRAME_FOREGROUND_PIXEL (f) = new_color;
-             /* Make sure the foreground of the default face for this
-                frame is changed as well.  */
-             XSETFRAME (frame, f);
-             Finternal_set_lisp_face_attribute (Qdefault, QCforeground,
-                                                val, frame);
-             fg_set = 1;
+             if (!reverse)
+               {
+                 FRAME_FOREGROUND_PIXEL (f) = new_color;
+                 /* Make sure the foreground of the default face for
+                    this frame is changed as well.  */
+                 update_face_from_frame_parameter (f, Qforeground_color, val);
+                 fg_set = 1;
+                 if (tty->termscript)
+                   fprintf (tty->termscript, "<FGCOLOR %lu>\n", new_color);
+               }
+             else
+               {
+                 FRAME_BACKGROUND_PIXEL (f) = new_color;
+                 update_face_from_frame_parameter (f, Qbackground_color, val);
+                 bg_set = 1;
+                 if (tty->termscript)
+                   fprintf (tty->termscript, "<BGCOLOR %lu>\n", new_color);
+               }
              redraw = 1;
-             if (tty->termscript)
-               fprintf (tty->termscript, "<FGCOLOR %lu>\n", new_color);
            }
        }
       else if (EQ (prop, Qbackground_color))
        {
-         unsigned long new_color = load_color (f, NULL, val, need_to_reverse
+         unsigned long new_color = load_color (f, NULL, val, reverse
                                                ? LFACE_FOREGROUND_INDEX
                                                : LFACE_BACKGROUND_INDEX);
          if (new_color != FACE_TTY_DEFAULT_COLOR
              && new_color != FACE_TTY_DEFAULT_FG_COLOR
              && new_color != FACE_TTY_DEFAULT_BG_COLOR)
            {
-             FRAME_BACKGROUND_PIXEL (f) = new_color;
-             /* Make sure the background of the default face for this
-                frame is changed as well.  */
-             XSETFRAME (frame, f);
-             Finternal_set_lisp_face_attribute (Qdefault, QCbackground,
-                                                val, frame);
-             bg_set = 1;
+             if (!reverse)
+               {
+                 FRAME_BACKGROUND_PIXEL (f) = new_color;
+                 /* Make sure the background of the default face for
+                    this frame is changed as well.  */
+                 bg_set = 1;
+                 update_face_from_frame_parameter (f, Qbackground_color, val);
+                 if (tty->termscript)
+                   fprintf (tty->termscript, "<BGCOLOR %lu>\n", new_color);
+               }
+             else
+               {
+                 FRAME_FOREGROUND_PIXEL (f) = new_color;
+                 fg_set = 1;
+                 update_face_from_frame_parameter (f, Qforeground_color, val);
+                 if (tty->termscript)
+                   fprintf (tty->termscript, "<FGCOLOR %lu>\n", new_color);
+               }
              redraw = 1;
-             if (tty->termscript)
-               fprintf (tty->termscript, "<BGCOLOR %lu>\n", new_color);
            }
        }
       else if (EQ (prop, Qtitle))
@@ -2318,9 +2192,10 @@ IT_set_frame_parameters (f, alist)
          IT_set_cursor_type (f, val);
          if (tty->termscript)
            fprintf (tty->termscript, "<CTYPE: %s>\n",
-                    EQ (val, Qbar) || EQ (val, Qhbar)
-                    || CONSP (val) && (EQ (XCAR (val), Qbar)
-                                       || EQ (XCAR (val), Qhbar))
+                    EQ (val, Qbar)
+                    || EQ (val, Qhbar)
+                    || (CONSP (val) && (EQ (XCAR (val), Qbar)
+                                        || EQ (XCAR (val), Qhbar)))
                     ? "bar" : "box");
        }
       else if (EQ (prop, Qtty_type))
@@ -2335,24 +2210,20 @@ IT_set_frame_parameters (f, alist)
 
   /* If they specified "reverse", but not the colors, we need to swap
      the current frame colors.  */
-  if (need_to_reverse)
+  if (reverse)
     {
-      Lisp_Object frame;
-
       if (!fg_set)
        {
-         XSETFRAME (frame, f);
-         Finternal_set_lisp_face_attribute (Qdefault, QCforeground,
-                                            tty_color_name (f, orig_bg),
-                                            frame);
+         FRAME_FOREGROUND_PIXEL (f) = orig_bg;
+         update_face_from_frame_parameter (f, Qforeground_color,
+                                           tty_color_name (f, orig_bg));
          redraw = 1;
        }
       if (!bg_set)
        {
-         XSETFRAME (frame, f);
-         Finternal_set_lisp_face_attribute (Qdefault, QCbackground,
-                                            tty_color_name (f, orig_fg),
-                                            frame);
+         FRAME_BACKGROUND_PIXEL (f) = orig_fg;
+         update_face_from_frame_parameter (f, Qbackground_color,
+                                           tty_color_name (f, orig_fg));
          redraw = 1;
        }
     }
@@ -2373,7 +2244,7 @@ extern void init_frame_faces (FRAME_PTR);
 /* Do we need the internal terminal?  */
 
 void
-internal_terminal_init ()
+internal_terminal_init (void)
 {
   static int init_needed = 1;
   char *term = getenv ("TERM"), *colors;
@@ -2509,10 +2380,8 @@ initialize_msdos_display (struct terminal *term)
   term->read_socket_hook = &tty_read_avail_input; /* from keyboard.c */
 }
 
-dos_get_saved_screen (screen, rows, cols)
-     char **screen;
-     int *rows;
-     int *cols;
+int
+dos_get_saved_screen (char **screen, int *rows, int *cols)
 {
 #ifndef HAVE_X_WINDOWS
   *screen = startup_screen_buffer;
@@ -2659,11 +2528,11 @@ static struct keyboard_layout_list
   struct dos_keyboard_map *keyboard_map;
 } keyboard_layout_list[] =
 {
-  1, &us_keyboard,
-  33, &fr_keyboard,
-  39, &it_keyboard,
-  45, &dk_keyboard,
-  81, &jp_keyboard
+  { 1, &us_keyboard },
+  { 33, &fr_keyboard },
+  { 39, &it_keyboard },
+  { 45, &dk_keyboard },
+  { 81, &jp_keyboard }
 };
 
 static struct dos_keyboard_map *keyboard;
@@ -2671,9 +2540,7 @@ static int keyboard_map_all;
 static int international_keyboard;
 
 int
-dos_set_keyboard (code, always)
-     int code;
-     int always;
+dos_set_keyboard (int code, int always)
 {
   int i;
   _go32_dpmi_registers regs;
@@ -2710,17 +2577,17 @@ static struct
   unsigned char keypad_code;   /* keypad code  */
   unsigned char editkey_code;  /* edit key     */
 } keypad_translate_map[] = {
-  '0',  '0',  0xb0, /* kp-0 */         0x63, /* insert */
-  '1',  '1',  0xb1, /* kp-1 */         0x57, /* end */
-  '2',  '2',  0xb2, /* kp-2 */         0x54, /* down */
-  '3',  '3',  0xb3, /* kp-3 */         0x56, /* next */
-  '4',  '4',  0xb4, /* kp-4 */         0x51, /* left */
-  '5',  '5',  0xb5, /* kp-5 */         0xb5, /* kp-5 */
-  '6',  '6',  0xb6, /* kp-6 */         0x53, /* right */
-  '7',  '7',  0xb7, /* kp-7 */         0x50, /* home */
-  '8',  '8',  0xb8, /* kp-8 */         0x52, /* up */
-  '9',  '9',  0xb9, /* kp-9 */         0x55, /* prior */
-  '.',  '-',  0xae, /* kp-decimal */   0xff  /* delete */
+  { '0',  '0',  0xb0, /* kp-0 */               0x63 /* insert */ },
+  { '1',  '1',  0xb1, /* kp-1 */               0x57 /* end */    },
+  { '2',  '2',  0xb2, /* kp-2 */               0x54 /* down */   },
+  { '3',  '3',  0xb3, /* kp-3 */               0x56 /* next */   },
+  { '4',  '4',  0xb4, /* kp-4 */               0x51 /* left */   },
+  { '5',  '5',  0xb5, /* kp-5 */               0xb5 /* kp-5 */   },
+  { '6',  '6',  0xb6, /* kp-6 */               0x53 /* right */  },
+  { '7',  '7',  0xb7, /* kp-7 */               0x50 /* home */   },
+  { '8',  '8',  0xb8, /* kp-8 */               0x52 /* up */     },
+  { '9',  '9',  0xb9, /* kp-9 */               0x55 /* prior */  },
+  { '.',  '-',  0xae, /* kp-decimal */         0xff  /* delete */}
 };
 
 static struct
@@ -2728,11 +2595,11 @@ static struct
   unsigned char char_code;     /* normal code  */
   unsigned char keypad_code;   /* keypad code  */
 } grey_key_translate_map[] = {
-  '/',  0xaf, /* kp-decimal */
-  '*',  0xaa, /* kp-multiply */
-  '-',  0xad, /* kp-subtract */
-  '+',  0xab, /* kp-add */
-  '\r', 0x8d  /* kp-enter */
+  { '/',  0xaf /* kp-decimal */  },
+  { '*',  0xaa /* kp-multiply */ },
+  { '-',  0xad /* kp-subtract */ },
+  { '+',  0xab /* kp-add */      },
+  { '\r', 0x8d  /* kp-enter */   }
 };
 
 static unsigned short
@@ -2940,8 +2807,7 @@ ibmpc_translate_map[] =
 #define HYPER_P                0x8000  /* pseudo */
 
 static int
-dos_get_modifiers (keymask)
-     int *keymask;
+dos_get_modifiers (int *keymask)
 {
   union REGS regs;
   int mask, modifiers = 0;
@@ -3023,13 +2889,13 @@ dos_get_modifiers (keymask)
 #define NUM_RECENT_DOSKEYS (100)
 int recent_doskeys_index;      /* Index for storing next element into recent_doskeys */
 int total_doskeys;             /* Total number of elements stored into recent_doskeys */
-Lisp_Object recent_doskeys; /* A vector, holding the last 100 keystrokes */
+Lisp_Object recent_doskeys;    /* A vector, holding the last 100 keystrokes */
 
 DEFUN ("recent-doskeys", Frecent_doskeys, Srecent_doskeys, 0, 0, 0,
        doc: /* Return vector of last 100 keyboard input values seen in dos_rawgetc.
 Each input key receives two values in this vector: first the ASCII code,
 and then the scan code.  */)
-     ()
+  (void)
 {
   Lisp_Object val, *keys = XVECTOR (recent_doskeys)->contents;
 
@@ -3038,19 +2904,17 @@ and then the scan code.  */)
   else
     {
       val = Fvector (NUM_RECENT_DOSKEYS, keys);
-      bcopy (keys + recent_doskeys_index,
-            XVECTOR (val)->contents,
-            (NUM_RECENT_DOSKEYS - recent_doskeys_index) * sizeof (Lisp_Object));
-      bcopy (keys,
-            XVECTOR (val)->contents + NUM_RECENT_DOSKEYS - recent_doskeys_index,
-            recent_doskeys_index * sizeof (Lisp_Object));
+      memcpy (XVECTOR (val)->contents, keys + recent_doskeys_index,
+             (NUM_RECENT_DOSKEYS - recent_doskeys_index) * sizeof (Lisp_Object));
+      memcpy (XVECTOR (val)->contents + NUM_RECENT_DOSKEYS - recent_doskeys_index,
+             keys, recent_doskeys_index * sizeof (Lisp_Object));
       return val;
     }
 }
 
 /* Get a char from keyboard.  Function keys are put into the event queue.  */
 static int
-dos_rawgetc ()
+dos_rawgetc (void)
 {
   struct input_event event;
   union REGS regs;
@@ -3261,7 +3125,6 @@ dos_rawgetc ()
          break;
        }
 
-    make_event:
       if (code == 0)
        continue;
 
@@ -3369,14 +3232,14 @@ dos_rawgetc ()
                    /* If only one button is pressed, wait 100 msec and
                       check again.  This way, Speedy Gonzales isn't
                       punished, while the slow get their chance.  */
-                   if (press && mouse_pressed (1-but, &x2, &y2)
-                       || !press && mouse_released (1-but, &x2, &y2))
+                   if ((press && mouse_pressed (1-but, &x2, &y2))
+                       || (!press && mouse_released (1-but, &x2, &y2)))
                      button_num = 2;
                    else
                      {
                        delay (100);
-                       if (press && mouse_pressed (1-but, &x2, &y2)
-                           || !press && mouse_released (1-but, &x2, &y2))
+                       if ((press && mouse_pressed (1-but, &x2, &y2))
+                           || (!press && mouse_released (1-but, &x2, &y2)))
                          button_num = 2;
                      }
                  }
@@ -3401,8 +3264,8 @@ dos_rawgetc ()
 static int prev_get_char = -1;
 
 /* Return 1 if a key is ready to be read without suspending execution.  */
-
-dos_keysns ()
+int
+dos_keysns (void)
 {
   if (prev_get_char != -1)
     return 1;
@@ -3411,8 +3274,8 @@ dos_keysns ()
 }
 
 /* Read a key.  Return -1 if no key is ready.  */
-
-dos_keyread ()
+int
+dos_keyread (void)
 {
   if (prev_get_char != -1)
     {
@@ -3441,7 +3304,7 @@ static char *menu_help_message, *prev_menu_help_message;
 static int menu_help_paneno, menu_help_itemno;
 
 static XMenu *
-IT_menu_create ()
+IT_menu_create (void)
 {
   XMenu *menu;
 
@@ -3610,7 +3473,7 @@ IT_menu_display (XMenu *menu, int y, int x, int pn, int *faces, int disp_help)
 /* Report availability of menus.  */
 
 int
-have_menus_p () {  return 1; }
+have_menus_p (void) {  return 1; }
 
 /* Create a brand new menu structure.  */
 
@@ -3812,10 +3675,12 @@ XMenuActivate (Display *foo, XMenu *menu, int *pane, int *selidx,
                if (0 <= dy && dy < state[i].menu->count)
                  {
                    if (!state[i].menu->submenu[dy])
-                     if (state[i].menu->panenumber[dy])
-                       result = XM_SUCCESS;
-                     else
-                       result = XM_IA_SELECT;
+                     {
+                       if (state[i].menu->panenumber[dy])
+                         result = XM_SUCCESS;
+                       else
+                         result = XM_IA_SELECT;
+                     }
                    *pane = state[i].pane - 1;
                    *selidx = dy;
                    /* We hit some part of a menu, so drop extra menus that
@@ -3968,8 +3833,7 @@ void msdos_downcase_filename (unsigned char *);
 /* Destructively turn backslashes into slashes.  */
 
 void
-dostounix_filename (p)
-     register char *p;
+dostounix_filename (char *p)
 {
   msdos_downcase_filename (p);
 
@@ -3984,8 +3848,7 @@ dostounix_filename (p)
 /* Destructively turn slashes into backslashes.  */
 
 void
-unixtodos_filename (p)
-     register char *p;
+unixtodos_filename (char *p)
 {
   if (p[1] == ':' && *p >= 'A' && *p <= 'Z')
     {
@@ -4004,9 +3867,7 @@ unixtodos_filename (p)
 /* Get the default directory for a given drive.  0=def, 1=A, 2=B, ...  */
 
 int
-getdefdir (drive, dst)
-     int drive;
-     char *dst;
+getdefdir (int drive, char *dst)
 {
   char in_path[4], *p = in_path, e = errno;
 
@@ -4045,9 +3906,7 @@ emacs_root_dir (void)
 /* Remove all CR's that are followed by a LF.  */
 
 int
-crlf_to_lf (n, buf)
-     register int n;
-     register unsigned char *buf;
+crlf_to_lf (int n, unsigned char *buf)
 {
   unsigned char *np = buf, *startp = buf, *endp = buf + n;
 
@@ -4068,199 +3927,10 @@ crlf_to_lf (n, buf)
   return np - startp;
 }
 
-#if defined(__DJGPP__) && __DJGPP__ == 2 && __DJGPP_MINOR__ == 0
-
-/* In DJGPP v2.0, library `write' can call `malloc', which might
-   cause relocation of the buffer whose address we get in ADDR.
-   Here is a version of `write' that avoids calling `malloc',
-   to serve us until such time as the library is fixed.
-   Actually, what we define here is called `__write', because
-   `write' is a stub that just jmp's to `__write' (to be
-   POSIXLY-correct with respect to the global name-space).  */
-
-#include <io.h>                      /* for _write */
-#include <libc/dosio.h>       /* for __file_handle_modes[] */
-
-static char xbuf[64 * 1024];  /* DOS cannot write more in one chunk */
-
-#define XBUF_END (xbuf + sizeof (xbuf) - 1)
-
-int
-__write (int handle, const void *buffer, size_t count)
-{
-  if (count == 0)
-    return 0;
-
-  if(__file_handle_modes[handle] & O_BINARY)
-    return _write (handle, buffer, count);
-  else
-    {
-      char *xbp = xbuf;
-      const char *bp = buffer;
-      int total_written = 0;
-      int nmoved = 0, ncr = 0;
-
-      while (count)
-       {
-         /* The next test makes sure there's space for at least 2 more
-            characters in xbuf[], so both CR and LF can be put there.  */
-         if (xbp < XBUF_END)
-           {
-             if (*bp == '\n')
-               {
-                 ncr++;
-                 *xbp++ = '\r';
-               }
-             *xbp++ = *bp++;
-             nmoved++;
-             count--;
-           }
-         if (xbp >= XBUF_END || !count)
-           {
-             size_t to_write = nmoved + ncr;
-             int written = _write (handle, xbuf, to_write);
-
-             if (written == -1)
-               return -1;
-             else
-               total_written += nmoved;  /* CRs aren't counted in ret value */
-
-             /* If some, but not all were written (disk full?), return
-                an estimate of the total written bytes not counting CRs.  */
-             if (written < to_write)
-               return total_written - (to_write - written) * nmoved/to_write;
-
-             nmoved = 0;
-             ncr = 0;
-             xbp = xbuf;
-           }
-       }
-      return total_written;
-    }
-}
-
-/* A low-level file-renaming function which works around Windows 95 bug.
-   This is pulled directly out of DJGPP v2.01 library sources, and only
-   used when you compile with DJGPP v2.0.  */
-
-#include <io.h>
-
-int _rename(const char *old, const char *new)
-{
-  __dpmi_regs r;
-  int olen    = strlen(old) + 1;
-  int i;
-  int use_lfn = _USE_LFN;
-  char tempfile[FILENAME_MAX];
-  const char *orig = old;
-  int lfn_fd = -1;
-
-  r.x.dx = __tb_offset;
-  r.x.di = __tb_offset + olen;
-  r.x.ds = r.x.es = __tb_segment;
-
-  if (use_lfn)
-    {
-      /* Windows 95 bug: for some filenames, when you rename
-        file -> file~ (as in Emacs, to leave a backup), the
-        short 8+3 alias doesn't change, which effectively
-        makes OLD and NEW the same file.  We must rename
-        through a temporary file to work around this.  */
-
-      char *pbase = 0, *p;
-      static char try_char[] = "abcdefghijklmnopqrstuvwxyz012345789";
-      int idx = sizeof(try_char) - 1;
-
-      /* Generate a temporary name.  Can't use `tmpnam', since $TMPDIR
-        might point to another drive, which will fail the DOS call.  */
-      strcpy(tempfile, old);
-      for (p = tempfile; *p; p++) /* ensure temporary is on the same drive */
-       if (*p == '/' || *p == '\\' || *p == ':')
-         pbase = p;
-      if (pbase)
-       pbase++;
-      else
-       pbase = tempfile;
-      strcpy(pbase, "X$$djren$$.$$temp$$");
-
-      do
-       {
-         if (idx <= 0)
-           return -1;
-         *pbase = try_char[--idx];
-       } while (_chmod(tempfile, 0) != -1);
-
-      r.x.ax = 0x7156;
-      _put_path2(tempfile, olen);
-      _put_path(old);
-      __dpmi_int(0x21, &r);
-      if (r.x.flags & 1)
-       {
-         errno = __doserr_to_errno(r.x.ax);
-         return -1;
-       }
-
-      /* Now create a file with the original name.  This will
-        ensure that NEW will always have a 8+3 alias
-        different from that of OLD.  (Seems to be required
-        when NameNumericTail in the Registry is set to 0.)  */
-      lfn_fd = _creat(old, 0);
-
-      olen = strlen(tempfile) + 1;
-      old  = tempfile;
-      r.x.di = __tb_offset + olen;
-    }
-
-  for (i=0; i<2; i++)
-    {
-      if(use_lfn)
-       r.x.ax = 0x7156;
-      else
-       r.h.ah = 0x56;
-      _put_path2(new, olen);
-      _put_path(old);
-      __dpmi_int(0x21, &r);
-      if(r.x.flags & 1)
-       {
-         if (r.x.ax == 5 && i == 0) /* access denied */
-           remove(new);                 /* and try again */
-         else
-           {
-             errno = __doserr_to_errno(r.x.ax);
-
-             /* Restore to original name if we renamed it to temporary.  */
-             if (use_lfn)
-               {
-                 if (lfn_fd != -1)
-                   {
-                     _close (lfn_fd);
-                     remove (orig);
-                   }
-                 _put_path2(orig, olen);
-                 _put_path(tempfile);
-                 r.x.ax = 0x7156;
-                 __dpmi_int(0x21, &r);
-               }
-             return -1;
-           }
-       }
-      else
-       break;
-    }
-
-  /* Success.  Delete the file possibly created to work
-     around the Windows 95 bug.  */
-  if (lfn_fd != -1)
-    return (_close (lfn_fd) == 0) ? remove (orig) : -1;
-  return 0;
-}
-
-#endif /* __DJGPP__ == 2 && __DJGPP_MINOR__ == 0 */
-
 DEFUN ("msdos-long-file-names", Fmsdos_long_file_names, Smsdos_long_file_names,
        0, 0, 0,
        doc: /* Return non-nil if long file names are supported on MS-DOS.  */)
-     ()
+  (void)
 {
   return (_USE_LFN ? Qt : Qnil);
 }
@@ -4268,8 +3938,7 @@ DEFUN ("msdos-long-file-names", Fmsdos_long_file_names, Smsdos_long_file_names,
 /* Convert alphabetic characters in a filename to lower-case.  */
 
 void
-msdos_downcase_filename (p)
-     register unsigned char *p;
+msdos_downcase_filename (unsigned char *p)
 {
   /* Always lower-case drive letters a-z, even if the filesystem
      preserves case in filenames.
@@ -4295,8 +3964,7 @@ DEFUN ("msdos-downcase-filename", Fmsdos_downcase_filename, Smsdos_downcase_file
 When long filenames are supported, doesn't change FILENAME.
 If FILENAME is not a string, returns nil.
 The argument object is never altered--the value is a copy.  */)
-     (filename)
-     Lisp_Object filename;
+  (Lisp_Object filename)
 {
   Lisp_Object tem;
 
@@ -4313,8 +3981,7 @@ The argument object is never altered--the value is a copy.  */)
 static char emacsroot[MAXPATHLEN];
 
 char *
-rootrelativepath (rel)
-     char *rel;
+rootrelativepath (char *rel)
 {
   static char result[MAXPATHLEN + 10];
 
@@ -4329,10 +3996,7 @@ rootrelativepath (rel)
    break if one or more of these are missing.  */
 
 void
-init_environment (argc, argv, skip_args)
-     int argc;
-     char **argv;
-     int skip_args;
+init_environment (int argc, char **argv, int skip_args)
 {
   char *s, *t, *root;
   int len, i;
@@ -4502,39 +4166,6 @@ init_environment (argc, argv, skip_args)
 static int break_stat;  /* BREAK check mode status.    */
 static int stdin_stat;  /* stdin IOCTL status.         */
 
-#if __DJGPP__ < 2
-
-/* These must be global.  */
-static _go32_dpmi_seginfo ctrl_break_vector;
-static _go32_dpmi_registers ctrl_break_regs;
-static int ctrlbreakinstalled = 0;
-
-/* Interrupt level detection of Ctrl-Break.  Don't do anything fancy here!  */
-
-void
-ctrl_break_func (regs)
-     _go32_dpmi_registers *regs;
-{
-  Vquit_flag = Qt;
-}
-
-void
-install_ctrl_break_check ()
-{
-  if (!ctrlbreakinstalled)
-    {
-      /* Don't press Ctrl-Break if you don't have either DPMI or Emacs
-        was compiler with Djgpp 1.11 maintenance level 5 or later!  */
-      ctrlbreakinstalled = 1;
-      ctrl_break_vector.pm_offset = (int) ctrl_break_func;
-      _go32_dpmi_allocate_real_mode_callback_iret (&ctrl_break_vector,
-                                                  &ctrl_break_regs);
-      _go32_dpmi_set_real_mode_interrupt_vector (0x1b, &ctrl_break_vector);
-    }
-}
-
-#endif /* __DJGPP__ < 2 */
-
 /* Turn off Dos' Ctrl-C checking and inhibit interpretation of
    control chars by DOS.   Determine the keyboard type.  */
 
@@ -4547,13 +4178,10 @@ dos_ttraw (struct tty_display_info *tty)
   /* If we are called for the initial terminal, it's too early to do
      anything, and termscript isn't set up.  */
   if (tty->terminal->type == output_initial)
-    return;
+    return 2;
 
   break_stat = getcbrk ();
   setcbrk (0);
-#if __DJGPP__ < 2
-  install_ctrl_break_check ();
-#endif
 
   if (first_time)
     {
@@ -4585,56 +4213,30 @@ dos_ttraw (struct tty_display_info *tty)
            mouse_button_count = outregs.x.bx;
 
 #ifndef HAVE_X_WINDOWS
-#if __DJGPP__ >= 2
          /* Save the cursor shape used outside Emacs.  */
          outside_cursor = _farpeekw (_dos_ds, 0x460);
-#endif
 #endif
        }
 
       first_time = 0;
 
-#if __DJGPP__ >= 2
-
       stdin_stat = setmode (fileno (stdin), O_BINARY);
       return (stdin_stat != -1);
     }
   else
     return (setmode (fileno (stdin), O_BINARY) != -1);
-
-#else /* __DJGPP__ < 2 */
-
-    }
-
-  /* I think it is wrong to overwrite `stdin_stat' every time
-     but the first one this function is called, but I don't
-     want to change the way it used to work in v1.x.--EZ  */
-
-  inregs.x.ax = 0x4400;                /* Get IOCTL status. */
-  inregs.x.bx = 0x00;          /* 0 = stdin. */
-  intdos (&inregs, &outregs);
-  stdin_stat = outregs.h.dl;
-
-  inregs.x.dx = stdin_stat | 0x0020; /* raw mode */
-  inregs.x.ax = 0x4401;                /* Set IOCTL status */
-  intdos (&inregs, &outregs);
-  return !outregs.x.cflag;
-
-#endif /* __DJGPP__ < 2 */
 }
 
 /*  Restore status of standard input and Ctrl-C checking.  */
 
 int
-dos_ttcooked ()
+dos_ttcooked (void)
 {
   union REGS inregs, outregs;
 
   setcbrk (break_stat);
   mouse_off ();
 
-#if __DJGPP__ >= 2
-
 #ifndef HAVE_X_WINDOWS
   /* Restore the cursor shape we found on startup.  */
   if (outside_cursor)
@@ -4646,16 +4248,6 @@ dos_ttcooked ()
 #endif
 
   return (setmode (fileno (stdin), stdin_stat) != -1);
-
-#else  /* not __DJGPP__ >= 2 */
-
-  inregs.x.ax = 0x4401;        /* Set IOCTL status.    */
-  inregs.x.bx = 0x00;  /* 0 = stdin.           */
-  inregs.x.dx = stdin_stat;
-  intdos (&inregs, &outregs);
-  return !outregs.x.cflag;
-
-#endif /* not __DJGPP__ >= 2 */
 }
 
 \f
@@ -4664,11 +4256,8 @@ dos_ttcooked ()
    file TEMPOUT and stderr to TEMPERR.  */
 
 int
-run_msdos_command (argv, working_dir, tempin, tempout, temperr, envv)
-     unsigned char **argv;
-     const char *working_dir;
-     int tempin, tempout, temperr;
-     char **envv;
+run_msdos_command (unsigned char **argv, const char *working_dir,
+                  int tempin, int tempout, int temperr, char **envv)
 {
   char *saveargv1, *saveargv2, *lowcase_argv0, *pa, *pl;
   char oldwd[MAXPATHLEN + 1]; /* Fixed size is safe on MSDOS.  */
@@ -4735,8 +4324,6 @@ run_msdos_command (argv, working_dir, tempin, tempout, temperr, envv)
   dup2 (tempout, 1);
   dup2 (temperr, 2);
 
-#if __DJGPP__ > 1
-
   if (msshell && !argv[3])
     {
       /* MS-DOS native shells are too restrictive.  For starters, they
@@ -4777,10 +4364,7 @@ run_msdos_command (argv, working_dir, tempin, tempout, temperr, envv)
        result = 0;     /* emulate Unixy shell behavior with empty cmd line */
     }
   else
-
-#endif /* __DJGPP__ > 1 */
-
-  result = spawnve (P_WAIT, argv[0], argv, envv);
+    result = spawnve (P_WAIT, argv[0], (char **)argv, envv);
 
   dup2 (inbak, 0);
   dup2 (outbak, 1);
@@ -4814,98 +4398,20 @@ run_msdos_command (argv, working_dir, tempin, tempout, temperr, envv)
 }
 
 void
-croak (badfunc)
-     char *badfunc;
+croak (char *badfunc)
 {
   fprintf (stderr, "%s not yet implemented\r\n", badfunc);
   reset_all_sys_modes ();
   exit (1);
 }
 \f
-#if __DJGPP__ < 2
-
-/* ------------------------- Compatibility functions -------------------
- *     gethostname
- *     gettimeofday
- */
-
-/* Hostnames for a pc are not really funny,
-   but they are used in change log so we emulate the best we can.  */
-
-gethostname (p, size)
-     char *p;
-     int size;
-{
-  char *q = egetenv ("HOSTNAME");
-
-  if (!q) q = "pc";
-  strcpy (p, q);
-  return 0;
-}
-
-/* When time zones are set from Ms-Dos too many C-libraries are playing
-   tricks with time values.  We solve this by defining our own version
-   of `gettimeofday' bypassing GO32.  Our version needs to be initialized
-   once and after each call to `tzset' with TZ changed.  That is
-   accomplished by aliasing tzset to init_gettimeofday. */
-
-static struct tm time_rec;
-
-int
-gettimeofday (struct timeval *tp, struct timezone *tzp)
-{
-  if (tp)
-    {
-      struct time t;
-      struct tm tm;
-
-      gettime (&t);
-      if (t.ti_hour < time_rec.tm_hour) /* midnight wrap */
-       {
-         struct date d;
-         getdate (&d);
-         time_rec.tm_year = d.da_year - 1900;
-         time_rec.tm_mon = d.da_mon - 1;
-         time_rec.tm_mday = d.da_day;
-       }
-
-      time_rec.tm_hour = t.ti_hour;
-      time_rec.tm_min = t.ti_min;
-      time_rec.tm_sec = t.ti_sec;
-
-      tm = time_rec;
-      tm.tm_gmtoff = dos_timezone_offset;
-
-      tp->tv_sec = mktime (&tm);       /* may modify tm */
-      tp->tv_usec = t.ti_hund * (1000000 / 100);
-    }
-  /* Ignore tzp; it's obsolescent.  */
-  return 0;
-}
-
-#endif /* __DJGPP__ < 2 */
-
 /*
- * A list of unimplemented functions that we silently ignore.
+ * A few unimplemented functions that we silently ignore.
  */
-
-#if __DJGPP__ < 2
-unsigned alarm (s) unsigned s; {}
-fork () { return 0; }
-int kill (x, y) int x, y; { return -1; }
-nice (p) int p; {}
-void volatile pause () {}
-sigsetmask (x) int x; { return 0; }
-sigblock (mask) int mask; { return 0; }
-#endif
-
-setpgrp () {return 0; }
-setpriority (x,y,z) int x,y,z; { return 0; }
-
-#if __DJGPP__ > 1
-#if __DJGPP_MINOR__ < 2
-
-#ifdef POSIX_SIGNALS
+int setpgrp (void) {return 0; }
+int setpriority (int x, int y, int z) { return 0; }
+\f
+#if __DJGPP__ == 2 && __DJGPP_MINOR__ < 2
 
 /* Augment DJGPP library POSIX signal functions.  This is needed
    as of DJGPP v2.01, but might be in the library in later releases. */
@@ -4928,17 +4434,13 @@ static sighandler_t prev_handlers[320];
 /* A signal handler which just records that a signal occurred
    (it will be raised later, if and when the signal is unblocked).  */
 static void
-sig_suspender (signo)
-     int signo;
+sig_suspender (int signo)
 {
   sigaddset (&msdos_pending_signals, signo);
 }
 
 int
-sigprocmask (how, new_set, old_set)
-     int how;
-     const sigset_t *new_set;
-     sigset_t *old_set;
+sigprocmask (int how, const sigset_t *new_set, sigset_t *old_set)
 {
   int signo;
   sigset_t new_mask;
@@ -5004,14 +4506,7 @@ sigprocmask (how, new_set, old_set)
   return 0;
 }
 
-#else /* not POSIX_SIGNALS */
-
-sigsetmask (x) int x; { return 0; }
-sigblock (mask) int mask; { return 0; }
-
-#endif /* not POSIX_SIGNALS */
 #endif /* not __DJGPP_MINOR__ < 2 */
-#endif /* __DJGPP__ > 1 */
 
 #ifndef HAVE_SELECT
 #include "sysselect.h"
@@ -5047,10 +4542,8 @@ dos_yield_time_slice (void)
 /* We don't have to call timer_check here
    because wait_reading_process_output takes care of that.  */
 int
-sys_select (nfds, rfds, wfds, efds, timeout)
-     int nfds;
-     SELECT_TYPE *rfds, *wfds, *efds;
-     EMACS_TIME *timeout;
+sys_select (int nfds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
+           EMACS_TIME *timeout)
 {
   int check_input;
   struct time t;
@@ -5120,11 +4613,10 @@ sys_select (nfds, rfds, wfds, efds, timeout)
 
 #ifdef chdir
 #undef chdir
-extern int chdir ();
+extern int chdir (const char *);
 
 int
-sys_chdir (path)
-     const char* path;
+sys_chdir (const char *path)
 {
   int len = strlen (path);
   char *tmp = (char *)path;
@@ -5153,7 +4645,7 @@ sys_chdir (path)
 extern void tzset (void);
 
 void
-init_gettimeofday ()
+init_gettimeofday (void)
 {
   time_t ltm, gtm;
   struct tm *lstm;
@@ -5171,9 +4663,7 @@ init_gettimeofday ()
 #ifdef abort
 #undef abort
 void
-dos_abort (file, line)
-     char *file;
-     int  line;
+dos_abort (char *file, int line)
 {
   char buffer1[200], buffer2[400];
   int i, j;
@@ -5189,12 +4679,11 @@ dos_abort (file, line)
 }
 #else
 void
-abort ()
+abort (void)
 {
   dos_ttcooked ();
   ScreenSetCursor (10, 0);
   cputs ("\r\n\nEmacs aborted!\r\n");
-#if __DJGPP__ > 1
 #if __DJGPP__ == 2 && __DJGPP_MINOR__ < 2
   if (screen_virtual_segment)
     dosv_refresh_virtual_screen (2 * 10 * screen_size_X, 4 * screen_size_X);
@@ -5204,19 +4693,12 @@ abort ()
 #else  /* __DJGPP_MINOR__ >= 2 */
   raise (SIGABRT);
 #endif /* __DJGPP_MINOR__ >= 2 */
-#endif
   exit (2);
 }
 #endif
 
-/* The following variables are required so that cus-start.el won't
-   complain about unbound variables.  */
-#ifndef subprocesses
-/* Nonzero means delete a process right away if it exits (process.c).  */
-static int delete_exited_processes;
-#endif
-
-syms_of_msdos ()
+void
+syms_of_msdos (void)
 {
   recent_doskeys = Fmake_vector (make_number (NUM_RECENT_DOSKEYS), Qnil);
   staticpro (&recent_doskeys);
@@ -5232,12 +4714,6 @@ syms_of_msdos ()
 This variable is used only by MS-DOS terminals.  */);
   Vdos_unsupported_char_glyph = make_number ('\177');
 
-#endif
-#ifndef subprocesses
-  DEFVAR_BOOL ("delete-exited-processes", &delete_exited_processes,
-              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 = 0;
 #endif
 
   defsubr (&Srecent_doskeys);
index bf44d3a9aa4c4a0f658b5e06d0ad31c064621c5f..fe9964af25e9243b608df8168bc42bf7b0b32935 100644 (file)
@@ -23,7 +23,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <dpmi.h>
 
 int dos_ttraw (struct tty_display_info *);
-int dos_ttcooked ();
+int dos_ttcooked (void);
 int dos_get_saved_screen (char **, int *, int *);
 int dos_set_keyboard (int, int);
 void dos_set_window_size (int *, int *);
@@ -32,15 +32,13 @@ int getdefdir (int, char*);
 void unixtodos_filename (char *);
 void dostounix_filename (char *);
 char *rootrelativepath (char *);
-void init_environment ();
-void internal_terminal_init ();
-void ctrl_break_func (_go32_dpmi_registers *);
-void install_ctrl_break_check ();
+void init_environment (int, char **, int);
+void internal_terminal_init (void);
 
 extern int have_mouse;
-void mouse_init ();
-void mouse_on ();
-void mouse_off ();
+void mouse_init (void);
+void mouse_on (void);
+void mouse_off (void);
 void mouse_moveto (int, int);
 \f
 #ifndef HAVE_X_WINDOWS
@@ -70,13 +68,12 @@ struct window;
 
 /* Defined in xfns.c; emulated on msdos.c */
 
-extern void x_set_menu_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object));
-extern int x_pixel_width P_ ((struct frame *));
-extern int x_pixel_height P_ ((struct frame *));
+extern void x_set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object);
+extern int x_pixel_width (struct frame *);
+extern int x_pixel_height (struct frame *);
 
 #define XFreeGC (void)
 #define x_destroy_bitmap(p1,p2)
-#define load_pixmap(p1,p2,p3,p4) (0)
 #define XGetGeometry(p1,p2,p3,p4,p5,p6,p7,p8,p9)
 #define DisplayWidth(p1,p2) (SELECTED_FRAME()->text_cols)
 #define DisplayHeight(p1,p2) (SELECTED_FRAME()->text_lines)
index d7bac9d3fae2d1e436596580c84723d2a7b20f54..92d198334b77d55ccd3238656e69d4d577b47c7e 100644 (file)
@@ -32,11 +32,10 @@ typedef struct
        char    dd_buf[DIRBLKSIZ];      /* directory block */
        }       DIR;                    /* stream data from opendir() */
 
-extern DIR             *opendir();
-extern struct direct   *readdir();
-extern long            telldir();
-extern void            seekdir();
-extern void            closedir();
+extern DIR             *opendir (char *);
+extern struct direct   *readdir (DIR *);
+extern void            seekdir (DIR *, long);
+extern void            closedir (DIR *);
 
 #define rewinddir( dirp )      seekdir( dirp, 0L )
 
diff --git a/src/ns.mk b/src/ns.mk
new file mode 100644 (file)
index 0000000..d674466
--- /dev/null
+++ b/src/ns.mk
@@ -0,0 +1,39 @@
+### autodeps.mk --- src/Makefile fragment for GNU Emacs
+
+## Copyright (C) 2008, 2009, 2010  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/>.
+
+### Commentary:
+
+## This is inserted in src/Makefile if HAVE_NS. 
+
+## The only reason this is in a separate file is because $ns_appdir,
+## which appears as a target, is empty on non-NS builds.  Some makes
+## do not like empty targets, even if they are never used.
+
+${ns_appdir}: ${ns_appsrc}
+       rm -fr ${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-app: ${ns_appdir} ${ns_appbindir}Emacs
+
+### ns.mk ends here
index 7e7fd48caf053a380b22c97fabb2f264654e0cc5..576131e0bdf7654cffe12a6777bc41a52e471ed6 100644 (file)
@@ -27,7 +27,7 @@ GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu)
 
 /* This should be the first include, as it may set up #defines affecting
    interpretation of even the system includes. */
-#include "config.h"
+#include <config.h>
 
 #include <signal.h>
 #include <math.h>
@@ -83,6 +83,10 @@ extern Lisp_Object Qunsplittable, Qmenu_bar_lines, Qbuffer_predicate, Qtitle;
 extern Lisp_Object Qnone;
 extern Lisp_Object Vframe_title_format;
 
+/* The below are defined in frame.c.  */
+
+extern Lisp_Object Vmenu_bar_mode, Vtool_bar_mode;
+
 Lisp_Object Qbuffered;
 Lisp_Object Qfontsize;
 
@@ -121,7 +125,7 @@ check_ns (void)
 
 /* Nonzero if we can use mouse menus. */
 int
-have_menus_p ()
+have_menus_p (void)
 {
   return NSApp != nil;
 }
@@ -224,7 +228,8 @@ ns_get_screen (Lisp_Object screen)
   else
     {
       struct ns_display_info *dpyinfo = terminal->display_info.ns;
-      f = (dpyinfo->x_focus_frame || dpyinfo->x_highlight_frame);
+      f = dpyinfo->x_focus_frame
+        ? dpyinfo->x_focus_frame : dpyinfo->x_highlight_frame;
     }
 
   return ((f && FRAME_NS_P (f)) ? [[FRAME_NS_VIEW (f) window] screen]
@@ -235,8 +240,7 @@ ns_get_screen (Lisp_Object screen)
 /* Return the X display structure for the display named NAME.
    Open a new connection if necessary.  */
 struct ns_display_info *
-ns_display_info_for_name (name)
-     Lisp_Object name;
+ns_display_info_for_name (Lisp_Object name)
 {
   Lisp_Object names;
   struct ns_display_info *dpyinfo;
@@ -920,9 +924,7 @@ ns_cursor_type_to_lisp (int arg)
 
 /* This is the same as the xfns.c definition.  */
 void
-x_set_cursor_type (f, arg, oldval)
-     FRAME_PTR f;
-     Lisp_Object arg, oldval;
+x_set_cursor_type (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval)
 {
   set_frame_cursor_types (f, arg);
 
@@ -944,7 +946,7 @@ x_set_mouse_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
 #define Xstr(x) Str(x)
 
 static Lisp_Object
-ns_appkit_version_str ()
+ns_appkit_version_str (void)
 {
   char tmp[80];
 
@@ -963,7 +965,7 @@ ns_appkit_version_str ()
    have into a single int.  For a better picture of the implementation
    running, use ns_appkit_version_str.*/
 static int
-ns_appkit_version_int ()
+ns_appkit_version_int (void)
 {
 #ifdef NS_IMPL_GNUSTEP
   return GNUSTEP_GUI_MAJOR_VERSION * 100 + GNUSTEP_GUI_MINOR_VERSION;
@@ -1039,6 +1041,7 @@ frame_parm_handler ns_frame_parm_handlers[] =
   x_set_font_backend, /* generic OK */
   x_set_alpha,
   0, /* x_set_sticky */  
+  0, /* x_set_tool_bar_position */  
 };
 
 
@@ -1058,8 +1061,7 @@ If the parameters specify that the frame should not have a minibuffer,
 and do not specify a specific minibuffer window to use,
 then `default-minibuffer-frame' must be a frame whose minibuffer can
 be shared by the new frame.  */)
-     (parms)
-     Lisp_Object parms;
+     (Lisp_Object parms)
 {
   static int desc_ctr = 1;
   struct frame *f;
@@ -1154,7 +1156,7 @@ be shared by the new frame.  */)
 
   f->output_method = output_ns;
   f->output_data.ns = (struct ns_output *)xmalloc (sizeof *(f->output_data.ns));
-  bzero (f->output_data.ns, sizeof (*(f->output_data.ns)));
+  memset (f->output_data.ns, 0, sizeof (*(f->output_data.ns)));
 
   FRAME_FONTSET (f) = -1;
 
@@ -1234,10 +1236,18 @@ be shared by the new frame.  */)
 
   init_frame_faces (f);
 
-  x_default_parameter (f, parms, Qmenu_bar_lines, make_number (0), "menuBar",
-                      "menuBar", RES_TYPE_NUMBER);
-  x_default_parameter (f, parms, Qtool_bar_lines, make_number (0), "toolBar",
-                      "toolBar", RES_TYPE_NUMBER);
+  /* The X resources controlling the menu-bar and tool-bar are
+     processed specially at startup, and reflected in the mode
+     variables; ignore them here.  */
+  x_default_parameter (f, parms, Qmenu_bar_lines,
+                      NILP (Vmenu_bar_mode)
+                      ? make_number (0) : make_number (1),
+                      NULL, NULL, RES_TYPE_NUMBER);
+  x_default_parameter (f, parms, Qtool_bar_lines,
+                      NILP (Vtool_bar_mode)
+                      ? make_number (0) : make_number (1),
+                      NULL, NULL, RES_TYPE_NUMBER);
+
   x_default_parameter (f, parms, Qbuffer_predicate, Qnil, "bufferPredicate",
                        "BufferPredicate", RES_TYPE_SYMBOL);
   x_default_parameter (f, parms, Qtitle, Qnil, "title", "Title",
@@ -1360,8 +1370,7 @@ be shared by the new frame.  */)
 DEFUN ("x-focus-frame", Fx_focus_frame, Sx_focus_frame, 1, 1, 0,
        doc: /* Set the input focus to FRAME.
 FRAME nil means use the selected frame.  */)
-     (frame)
-     Lisp_Object frame;
+     (Lisp_Object frame)
 {
   struct frame *f = check_ns_frame (frame);
   struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (f);
@@ -1382,8 +1391,7 @@ FRAME nil means use the selected frame.  */)
 DEFUN ("ns-popup-font-panel", Fns_popup_font_panel, Sns_popup_font_panel,
        0, 1, "",
        doc: /* Pop up the font panel. */)
-     (frame)
-     Lisp_Object frame;
+     (Lisp_Object frame)
 {
   id fm;
   struct frame *f;
@@ -1408,8 +1416,7 @@ DEFUN ("ns-popup-font-panel", Fns_popup_font_panel, Sns_popup_font_panel,
 DEFUN ("ns-popup-color-panel", Fns_popup_color_panel, Sns_popup_color_panel,
        0, 1, "",
        doc: /* Pop up the color panel.  */)
-     (frame)
-     Lisp_Object frame;
+     (Lisp_Object frame)
 {
   struct frame *f;
 
@@ -1432,8 +1439,7 @@ DEFUN ("ns-read-file-name", Fns_read_file_name, Sns_read_file_name, 1, 4, 0,
 Optional arg DIR, if non-nil, supplies a default directory.
 Optional arg ISLOAD, if non-nil, means read a file name for saving.
 Optional arg INIT, if non-nil, provides a default file name to use.  */)
-     (prompt, dir, isLoad, init)
-     Lisp_Object prompt, dir, isLoad, init;
+     (Lisp_Object prompt, Lisp_Object dir, Lisp_Object isLoad, Lisp_Object init)
 {
   static id fileDelegate = nil;
   int ret;
@@ -1497,8 +1503,7 @@ Optional arg INIT, if non-nil, provides a default file name to use.  */)
 DEFUN ("ns-get-resource", Fns_get_resource, Sns_get_resource, 2, 2, 0,
        doc: /* Return the value of the property NAME of OWNER from the defaults database.
 If OWNER is nil, Emacs is assumed.  */)
-     (owner, name)
-     Lisp_Object owner, name;
+     (Lisp_Object owner, Lisp_Object name)
 {
   const char *value;
 
@@ -1522,8 +1527,7 @@ DEFUN ("ns-set-resource", Fns_set_resource, Sns_set_resource, 3, 3, 0,
        doc: /* Set property NAME of OWNER to VALUE, from the defaults database.
 If OWNER is nil, Emacs is assumed.
 If VALUE is nil, the default is removed.  */)
-     (owner, name, value)
-     Lisp_Object owner, name, value;
+     (Lisp_Object owner, Lisp_Object name, Lisp_Object value)
 {
   check_ns ();
   if (NILP (owner))
@@ -1551,8 +1555,7 @@ DEFUN ("x-server-max-request-size", Fx_server_max_request_size,
        Sx_server_max_request_size,
        0, 1, 0,
        doc: /* This function is a no-op.  It is only present for completeness.  */)
-     (display)
-     Lisp_Object display;
+     (Lisp_Object display)
 {
   check_ns ();
   /* This function has no real equivalent under NeXTstep.  Return nil to
@@ -1565,8 +1568,7 @@ DEFUN ("x-server-vendor", Fx_server_vendor, Sx_server_vendor, 0, 1, 0,
        doc: /* Return the vendor ID string of Nextstep display server DISPLAY.
 DISPLAY should be either a frame or a display name (a string).
 If omitted or nil, the selected frame's display is used.  */)
-     (display)
-     Lisp_Object display;
+     (Lisp_Object display)
 {
 #ifdef NS_IMPL_GNUSTEP
   return build_string ("GNU");
@@ -1585,8 +1587,7 @@ release number.  See also the function `x-server-vendor'.
 The optional argument DISPLAY specifies which display to ask about.
 DISPLAY should be either a frame or a display name (a string).
 If omitted or nil, that stands for the selected frame's display.  */)
-     (display)
-     Lisp_Object display;
+     (Lisp_Object display)
 {
   /*NOTE: it is unclear what would best correspond with "protocol";
           we return 10.3, meaning Panther, since this is roughly the
@@ -1604,8 +1605,7 @@ DEFUN ("x-display-screens", Fx_display_screens, Sx_display_screens, 0, 1, 0,
        doc: /* Return the number of screens on Nextstep display server DISPLAY.
 DISPLAY should be a frame, the display name as a string, or a terminal ID.
 If omitted or nil, the selected frame's display is used.  */)
-     (display)
-     Lisp_Object display;
+     (Lisp_Object display)
 {
   int num;
 
@@ -1621,8 +1621,7 @@ DEFUN ("x-display-mm-height", Fx_display_mm_height, Sx_display_mm_height,
        doc: /* Return the height of Nextstep display server DISPLAY, in millimeters.
 DISPLAY should be a frame, the display name as a string, or a terminal ID.
 If omitted or nil, the selected frame's display is used.  */)
-     (display)
-     Lisp_Object display;
+     (Lisp_Object display)
 {
   check_ns ();
   return make_number ((int)
@@ -1635,8 +1634,7 @@ DEFUN ("x-display-mm-width", Fx_display_mm_width, Sx_display_mm_width,
        doc: /* Return the width of Nextstep display server DISPLAY, in millimeters.
 DISPLAY should be a frame, the display name as a string, or a terminal ID.
 If omitted or nil, the selected frame's display is used.  */)
-     (display)
-     Lisp_Object display;
+     (Lisp_Object display)
 {
   check_ns ();
   return make_number ((int)
@@ -1650,8 +1648,7 @@ DEFUN ("x-display-backing-store", Fx_display_backing_store,
 The value may be `buffered', `retained', or `non-retained'.
 DISPLAY should be a frame, the display name as a string, or a terminal ID.
 If omitted or nil, the selected frame's display is used.  */)
-     (display)
-     Lisp_Object display;
+     (Lisp_Object display)
 {
   check_ns ();
   switch ([ns_get_window (display) backingType])
@@ -1676,8 +1673,7 @@ The value is one of the symbols `static-gray', `gray-scale',
 `static-color', `pseudo-color', `true-color', or `direct-color'.
 DISPLAY should be a frame, the display name as a string, or a terminal ID.
 If omitted or nil, the selected frame's display is used.  */)
-     (display)
-     Lisp_Object display;
+     (Lisp_Object display)
 {
   NSWindowDepth depth;
   check_ns ();
@@ -1705,8 +1701,7 @@ DEFUN ("x-display-save-under", Fx_display_save_under,
 The optional argument DISPLAY specifies which display to ask about.
 DISPLAY should be a frame, the display name as a string, or a terminal ID.
 If omitted or nil, the selected frame's display is used.  */)
-     (display)
-     Lisp_Object display;
+     (Lisp_Object display)
 {
   check_ns ();
   switch ([ns_get_window (display) backingType])
@@ -1730,8 +1725,7 @@ DEFUN ("x-open-connection", Fx_open_connection, Sx_open_connection,
        doc: /* Open a connection to a Nextstep display server.
 DISPLAY is the name of the display to connect to.
 Optional arguments XRM-STRING and MUST-SUCCEED are currently ignored.  */)
-     (display, resource_string, must_succeed)
-     Lisp_Object display, resource_string, must_succeed;
+     (Lisp_Object display, Lisp_Object resource_string, Lisp_Object must_succeed)
 {
   struct ns_display_info *dpyinfo;
 
@@ -1769,8 +1763,7 @@ DEFUN ("x-close-connection", Fx_close_connection, Sx_close_connection,
        1, 1, 0,
        doc: /* Close the connection to the current Nextstep display server.
 The argument DISPLAY is currently ignored.  */)
-     (display)
-     Lisp_Object display;
+     (Lisp_Object display)
 {
   check_ns ();
   /*ns_delete_terminal (dpyinfo->terminal); */
@@ -1781,7 +1774,7 @@ The argument DISPLAY is currently ignored.  */)
 
 DEFUN ("x-display-list", Fx_display_list, Sx_display_list, 0, 0, 0,
        doc: /* Return the list of display names that Emacs has connections to.  */)
-     ()
+     (void)
 {
   Lisp_Object tail, result;
 
@@ -1796,7 +1789,7 @@ DEFUN ("x-display-list", Fx_display_list, Sx_display_list, 0, 0, 0,
 DEFUN ("ns-hide-others", Fns_hide_others, Sns_hide_others,
        0, 0, 0,
        doc: /* Hides all applications other than Emacs.  */)
-     ()
+     (void)
 {
   check_ns ();
   [NSApp hideOtherApplications: NSApp];
@@ -1809,8 +1802,7 @@ DEFUN ("ns-hide-emacs", Fns_hide_emacs, Sns_hide_emacs,
 Otherwise if Emacs is hidden, it is unhidden.
 If ON is equal to `activate', Emacs is unhidden and becomes
 the active application.  */)
-     (on)
-     Lisp_Object on;
+     (Lisp_Object on)
 {
   check_ns ();
   if (EQ (on, intern ("activate")))
@@ -1829,7 +1821,7 @@ the active application.  */)
 DEFUN ("ns-emacs-info-panel", Fns_emacs_info_panel, Sns_emacs_info_panel,
        0, 0, 0,
        doc: /* Shows the 'Info' or 'About' panel for Emacs.  */)
-     ()
+     (void)
 {
   check_ns ();
   [NSApp orderFrontStandardAboutPanel: nil];
@@ -1842,8 +1834,7 @@ DEFUN ("ns-font-name", Fns_font_name, Sns_font_name, 1, 1, 0,
 NAME should be a string containing either the font name or an XLFD
 font descriptor.  If string contains `fontset' and not
 `fontset-startup', it is left alone. */)
-     (name)
-     Lisp_Object name;
+     (Lisp_Object name)
 {
   char *nm;
   CHECK_STRING (name);
@@ -1861,8 +1852,7 @@ font descriptor.  If string contains `fontset' and not
 DEFUN ("ns-list-colors", Fns_list_colors, Sns_list_colors, 0, 1, 0,
        doc: /* Return a list of all available colors.
 The optional argument FRAME is currently ignored.  */)
-     (frame)
-     Lisp_Object frame;
+     (Lisp_Object frame)
 {
   Lisp_Object list = Qnil;
   NSEnumerator *colorlists;
@@ -1901,7 +1891,7 @@ The optional argument FRAME is currently ignored.  */)
 
 DEFUN ("ns-list-services", Fns_list_services, Sns_list_services, 0, 0, 0,
        doc: /* List available Nextstep services by querying NSApp.  */)
-     ()
+     (void)
 {
   Lisp_Object ret = Qnil;
   NSMenu *svcs;
@@ -1955,8 +1945,7 @@ DEFUN ("ns-perform-service", Fns_perform_service, Sns_perform_service,
 SEND should be either a string or nil.
 The return value is the result of the service, as string, or nil if
 there was no result.  */)
-     (service, send)
-     Lisp_Object service, send;
+     (Lisp_Object service, Lisp_Object send)
 {
   id pb;
   NSString *svcName;
@@ -1984,8 +1973,7 @@ there was no result.  */)
 DEFUN ("ns-convert-utf8-nfd-to-nfc", Fns_convert_utf8_nfd_to_nfc,
        Sns_convert_utf8_nfd_to_nfc, 1, 1, 0,
        doc: /* Return an NFC string that matches the UTF-8 NFD string STR.  */)
-    (str)
-    Lisp_Object str;
+     (Lisp_Object str)
 {
 /* TODO: If GNUstep ever implements precomposedStringWithCanonicalMapping,
          remove this. */
@@ -2014,8 +2002,7 @@ DEFUN ("ns-convert-utf8-nfd-to-nfc", Fns_convert_utf8_nfd_to_nfc,
    string or a number containing the resulting script value.  Otherwise,
    1 is returned. */
 static int
-ns_do_applescript (script, result)
-     Lisp_Object script, *result;
+ns_do_applescript (Lisp_Object script, Lisp_Object *result)
 {
   NSAppleEventDescriptor *desc;
   NSDictionary* errorDict;
@@ -2072,8 +2059,7 @@ DEFUN ("ns-do-applescript", Fns_do_applescript, Sns_do_applescript, 1, 1, 0,
 If compilation and execution are successful, the resulting script value
 is returned as a string, a number or, in the case of other constructs, t.
 In case the execution fails, an error is signaled. */)
-    (script)
-    Lisp_Object script;
+     (Lisp_Object script)
 {
   Lisp_Object result;
   long status;
@@ -2119,8 +2105,7 @@ check_x_display_info (Lisp_Object frame)
 
 
 void
-x_set_scroll_bar_default_width (f)
-     struct frame *f;
+x_set_scroll_bar_default_width (struct frame *f)
 {
   int wid = FRAME_COLUMN_WIDTH (f);
   FRAME_CONFIG_SCROLL_BAR_WIDTH (f) = NS_SCROLL_BAR_WIDTH_DEFAULT;
@@ -2200,7 +2185,7 @@ x_screen_planes (struct frame *f)
 
 
 void
-x_sync (Lisp_Object frame)
+x_sync (struct frame *f)
 {
   /* XXX Not implemented XXX */
   return;
@@ -2218,8 +2203,7 @@ x_sync (Lisp_Object frame)
 DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0,
        doc: /* Return t if the current Nextstep display supports the color COLOR.
 The optional argument FRAME is currently ignored.  */)
-     (color, frame)
-     Lisp_Object color, frame;
+     (Lisp_Object color, Lisp_Object frame)
 {
   NSColor * col;
   check_ns ();
@@ -2229,8 +2213,7 @@ The optional argument FRAME is currently ignored.  */)
 
 DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0,
        doc: /* Internal function called by `color-values', which see.  */)
-     (color, frame)
-     Lisp_Object color, frame;
+     (Lisp_Object color, Lisp_Object frame)
 {
   NSColor * col;
   CGFloat red, green, blue, alpha;
@@ -2254,8 +2237,7 @@ DEFUN ("xw-display-color-p", Fxw_display_color_p, Sxw_display_color_p, 0, 1, 0,
 The optional argument DISPLAY specifies which display to ask about.
 DISPLAY should be either a frame, a display name (a string), or terminal ID.
 If omitted or nil, that stands for the selected frame's display.  */)
-     (display)
-     Lisp_Object display;
+     (Lisp_Object display)
 {
   NSWindowDepth depth;
   NSString *colorSpace;
@@ -2276,8 +2258,7 @@ Note that color displays do support shades of gray.
 The optional argument DISPLAY specifies which display to ask about.
 DISPLAY should be either a frame, a display name (a string), or terminal ID.
 If omitted or nil, that stands for the selected frame's display. */)
-     (display)
-     Lisp_Object display;
+     (Lisp_Object display)
 {
   NSWindowDepth depth;
   check_ns ();
@@ -2293,8 +2274,7 @@ DEFUN ("x-display-pixel-width", Fx_display_pixel_width, Sx_display_pixel_width,
 The optional argument DISPLAY specifies which display to ask about.
 DISPLAY should be either a frame, a display name (a string), or terminal ID.
 If omitted or nil, that stands for the selected frame's display.  */)
-     (display)
-     Lisp_Object display;
+     (Lisp_Object display)
 {
   check_ns ();
   return make_number ((int) [ns_get_screen (display) frame].size.width);
@@ -2307,8 +2287,7 @@ DEFUN ("x-display-pixel-height", Fx_display_pixel_height,
 The optional argument DISPLAY specifies which display to ask about.
 DISPLAY should be either a frame, a display name (a string), or terminal ID.
 If omitted or nil, that stands for the selected frame's display.  */)
-     (display)
-     Lisp_Object display;
+     (Lisp_Object display)
 {
   check_ns ();
   return make_number ((int) [ns_get_screen (display) frame].size.height);
@@ -2325,8 +2304,7 @@ reserved for the Mac menu, dock, and so forth.
 The screen queried corresponds to DISPLAY, which should be either a
 frame, a display name (a string), or terminal ID.  If omitted or nil,
 that stands for the selected frame's display. */)
-     (display)
-     Lisp_Object display;
+     (Lisp_Object display)
 {
   int top;
   NSScreen *screen;
@@ -2355,8 +2333,7 @@ DEFUN ("x-display-planes", Fx_display_planes, Sx_display_planes,
 The optional argument DISPLAY specifies which display to ask about.
 DISPLAY should be either a frame, a display name (a string), or terminal ID.
 If omitted or nil, that stands for the selected frame's display.  */)
-     (display)
-     Lisp_Object display;
+     (Lisp_Object display)
 {
   check_ns ();
   return make_number
@@ -2370,12 +2347,12 @@ DEFUN ("x-display-color-cells", Fx_display_color_cells,
 The optional argument DISPLAY specifies which display to ask about.
 DISPLAY should be either a frame, a display name (a string), or terminal ID.
 If omitted or nil, that stands for the selected frame's display.  */)
-     (display)
-     Lisp_Object display;
+     (Lisp_Object display)
 {
+  struct ns_display_info *dpyinfo;
   check_ns ();
-  struct ns_display_info *dpyinfo = check_ns_display_info (display);
-
+  
+  dpyinfo = check_ns_display_info (display);
   /* We force 24+ bit depths to 24-bit to prevent an overflow.  */
   return make_number (1 << min (dpyinfo->n_planes, 24));
 }
@@ -2386,11 +2363,14 @@ Lisp_Object tip_frame;
 
 /* TODO: move to xdisp or similar */
 static void
-compute_tip_xy (f, parms, dx, dy, width, height, root_x, root_y)
-     struct frame *f;
-     Lisp_Object parms, dx, dy;
-     int width, height;
-     int *root_x, *root_y;
+compute_tip_xy (struct frame *f,
+                Lisp_Object parms,
+                Lisp_Object dx,
+                Lisp_Object dy,
+                int width,
+                int height,
+                int *root_x,
+                int *root_y)
 {
   Lisp_Object left, top;
   EmacsView *view = FRAME_NS_VIEW (f);
@@ -2398,22 +2378,27 @@ compute_tip_xy (f, parms, dx, dy, width, height, root_x, root_y)
 
   /* Start with user-specified or mouse position.  */
   left = Fcdr (Fassq (Qleft, parms));
-  if (INTEGERP (left))
-    pt.x = XINT (left);
-  else
-    pt.x = last_mouse_motion_position.x;
   top = Fcdr (Fassq (Qtop, parms));
-  if (INTEGERP (top))
-    pt.y = XINT (top);
-  else
-    pt.y = last_mouse_motion_position.y;
-
-  /* Convert to screen coordinates */
-  pt = [view convertPoint: pt toView: nil];
-  pt = [[view window] convertBaseToScreen: pt];
 
+  if (!INTEGERP (left) || !INTEGERP (top))
+    {
+      pt = last_mouse_motion_position;
+      /* Convert to screen coordinates */
+      pt = [view convertPoint: pt toView: nil];
+      pt = [[view window] convertBaseToScreen: pt];
+    }
+  else
+    {
+      /* Absolute coordinates.  */
+      pt.x = XINT (left);
+      pt.y = x_display_pixel_height (FRAME_NS_DISPLAY_INFO (f)) - XINT (top)
+        - height;
+    }
+  
   /* Ensure in bounds.  (Note, screen origin = lower left.) */
-  if (pt.x + XINT (dx) <= 0)
+  if (INTEGERP (left))
+    *root_x = pt.x;
+  else if (pt.x + XINT (dx) <= 0)
     *root_x = 0; /* Can happen for negative dx */
   else if (pt.x + XINT (dx) + width
           <= x_display_pixel_width (FRAME_NS_DISPLAY_INFO (f)))
@@ -2426,7 +2411,9 @@ compute_tip_xy (f, parms, dx, dy, width, height, root_x, root_y)
     /* Put it left justified on the screen -- it ought to fit that way.  */
     *root_x = 0;
 
-  if (pt.y - XINT (dy) - height >= 0)
+  if (INTEGERP (top))
+    *root_y = pt.y;
+  else if (pt.y - XINT (dy) - height >= 0)
     /* It fits below the pointer.  */
     *root_y = pt.y - height - XINT (dy);
   else if (pt.y + XINT (dy) + height
@@ -2461,8 +2448,7 @@ DY added (default is -10).
 
 A tooltip's maximum size is specified by `x-max-tooltip-size'.
 Text larger than the specified size is clipped.  */)
-     (string, frame, parms, timeout, dx, dy)
-     Lisp_Object string, frame, parms, timeout, dx, dy;
+     (Lisp_Object string, Lisp_Object frame, Lisp_Object parms, Lisp_Object timeout, Lisp_Object dx, Lisp_Object dy)
 {
   int root_x, root_y;
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
@@ -2518,7 +2504,7 @@ Text larger than the specified size is clipped.  */)
 DEFUN ("x-hide-tip", Fx_hide_tip, Sx_hide_tip, 0, 0, 0,
        doc: /* Hide the current tooltip window, if there is any.
 Value is t if tooltip was open, nil otherwise.  */)
-     ()
+     (void)
 {
   if (ns_tooltip == nil || ![ns_tooltip isActive])
     return Qnil;
@@ -2608,7 +2594,7 @@ Value is t if tooltip was open, nil otherwise.  */)
 
 
 void
-syms_of_nsfns ()
+syms_of_nsfns (void)
 {
   int i;
 
index 59d5ee73db1f4c96b37405d1afcfa4db4d04a885..115986774d83f8a6265e27c96636a07762e31e4b 100644 (file)
@@ -22,7 +22,7 @@ Author: Adrian Robert (arobert@cogsci.ucsd.edu)
 
 /* This should be the first include, as it may set up #defines affecting
    interpretation of even the system includes. */
-#include "config.h"
+#include <config.h>
 #include <setjmp.h>
 
 #include "lisp.h"
@@ -161,7 +161,9 @@ static NSFontDescriptor
 
 /* Converts NSFont descriptor to FONT_WEIGHT, FONT_SLANT, FONT_WIDTH, etc.. */
 static Lisp_Object
-ns_descriptor_to_entity (NSFontDescriptor *desc, Lisp_Object extra, char *style)
+ns_descriptor_to_entity (NSFontDescriptor *desc,
+                         Lisp_Object extra,
+                         const char *style)
 {
     Lisp_Object font_entity = font_make_entity ();
     /*   NSString *psName = [desc postscriptName]; */
@@ -223,7 +225,7 @@ ns_descriptor_to_entity (NSFontDescriptor *desc, Lisp_Object extra, char *style)
 
 /* Default font entity. */
 static Lisp_Object
-ns_fallback_entity ()
+ns_fallback_entity (void)
 {
   return ns_descriptor_to_entity ([[NSFont userFixedPitchFontOfSize: 0]
       fontDescriptor], Qnil, NULL);
@@ -776,8 +778,8 @@ nsfont_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size)
     xmalloc (0x100 * sizeof (struct font_metrics *));
   if (!font_info->glyphs || !font_info->metrics)
     return Qnil;
-  bzero (font_info->glyphs, 0x100 * sizeof (unsigned short *));
-  bzero (font_info->metrics, 0x100 * sizeof (struct font_metrics *));
+  memset (font_info->glyphs, 0, 0x100 * sizeof (unsigned short *));
+  memset (font_info->metrics, 0, 0x100 * sizeof (struct font_metrics *));
 
   BLOCK_INPUT;
 
@@ -816,8 +818,8 @@ 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);
-    bcopy (fontName, font_info->name, strlen (fontName) + 1);
+    font_info->name = (char *)xmalloc (strlen (fontName)+1);
+    strcpy (font_info->name, fontName);
     font_info->bold = [fontMgr traitsOfFont: nsfont] & NSBoldFontMask;
     font_info->ital =
       synthItal || ([fontMgr traitsOfFont: nsfont] & NSItalicFontMask);
@@ -972,7 +974,7 @@ nsfont_text_extents (struct font *font, unsigned int *code, int nglyphs,
   int totalWidth = 0;
   int i;
 
-  bzero (metrics, sizeof (struct font_metrics));
+  memset (metrics, 0, sizeof (struct font_metrics));
 
   for (i =0; i<nglyphs; i++)
     {
@@ -1395,7 +1397,7 @@ ns_glyph_metrics (struct nsfont_info *font_info, unsigned char block)
  sfont = [font_info->nsfont screenFont];
 
   font_info->metrics[block] = xmalloc (0x100 * sizeof (struct font_metrics));
-  bzero (font_info->metrics[block], 0x100 * sizeof (struct font_metrics));
+  memset (font_info->metrics[block], 0, 0x100 * sizeof (struct font_metrics));
   if (!(font_info->metrics[block]))
     abort ();
 
@@ -1510,7 +1512,7 @@ ns_dump_glyphstring (struct glyph_string *s)
 
 
 void
-syms_of_nsfont ()
+syms_of_nsfont (void)
 {
   nsfont_driver.type = Qns;
   register_font_driver (&nsfont_driver, NULL);
index 09a78e2080959170abd1996f355c26860c6f7919..13761ba5f71a4fca204b1d1e6420417b759d459a 100644 (file)
@@ -27,7 +27,7 @@ GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu)
 
 /* This should be the first include, as it may set up #defines affecting
    interpretation of even the system includes. */
-#include "config.h"
+#include <config.h>
 #include <setjmp.h>
 
 #include "lisp.h"
@@ -83,11 +83,11 @@ int
 ns_load_image (struct frame *f, struct image *img,
                Lisp_Object spec_file, Lisp_Object spec_data)
 {
-  NSTRACE (ns_load_image);
-
   EmacsImage *eImg;
   NSSize size;
 
+  NSTRACE (ns_load_image);
+
   if (NILP (spec_data))
     {
       eImg = [EmacsImage allocInitFromFile: spec_file];
@@ -315,9 +315,9 @@ static EmacsImage *ImageList = nil;
 
   [self addRepresentation: bmRep];
 
-  bzero (planes[0], w*h);
-  bzero (planes[1], w*h);
-  bzero (planes[2], w*h);
+  memset (planes[0], 0, w*h);
+  memset (planes[1], 0, w*h);
+  memset (planes[2], 0, w*h);
   [self setXBMColor: [NSColor blackColor]];
   return self;
 }
@@ -379,7 +379,7 @@ static EmacsImage *ImageList = nil;
 
   [bmRep getBitmapDataPlanes: pixmapData];
   for (i =0; i<4; i++)
-    bzero (pixmapData[i], width*height);
+    memset (pixmapData[i], 0, width*height);
   [self addRepresentation: bmRep];
   return self;
 }
index f85ebc165af0966c47009f7ff73dc59d181ca1df..9534aec8f2bcbfb3f8c998f2f22a004bda73b754 100644 (file)
@@ -105,7 +105,7 @@ free_frame_menubar (struct frame *f)
 
 
 int
-popup_activated ()
+popup_activated (void)
 {
   return popup_activated_flag;
 }
@@ -219,8 +219,8 @@ ns_update_menubar (struct frame *f, int deep_p, EmacsMenu *submenu)
 
       /* Save the frame's previous menu bar contents data */
       if (previous_menu_items_used)
-       bcopy (XVECTOR (f->menu_bar_vector)->contents, previous_items,
-              previous_menu_items_used * sizeof (Lisp_Object));
+       memcpy (previous_items, XVECTOR (f->menu_bar_vector)->contents,
+               previous_menu_items_used * sizeof (Lisp_Object));
 
       /* parse stage 1: extract from lisp */
       save_menu_items ();
@@ -509,8 +509,7 @@ set_frame_menubar (struct frame *f, int first_time, int deep_p)
 
 /* Utility (from macmenu.c): is this item a separator? */
 static int
-name_is_separator (name)
-     const char *name;
+name_is_separator ( const char *name)
 {
   const char *start = name;
 
@@ -601,9 +600,9 @@ name_is_separator (name)
    NSMenuItem get ignored.  For now we try to display a super-single letter
    combo, and return the others as strings to be appended to the item title.
    (This is signaled by setting keyEquivModMask to 0 for now.) */
--(NSString *)parseKeyEquiv: (char *)key
+-(NSString *)parseKeyEquiv: (const char *)key
 {
-  char *tpos = key;
+  const char *tpos = key;
   keyEquivModMask = NSCommandKeyMask;
 
   if (!key || !strlen (key))
@@ -720,7 +719,7 @@ name_is_separator (name)
 
 
 /* adds an empty submenu and returns it */
-- (EmacsMenu *)addSubmenuWithTitle: (char *)title forFrame: (struct frame *)f
+- (EmacsMenu *)addSubmenuWithTitle: (const char *)title forFrame: (struct frame *)f
 {
   NSString *titleStr = [NSString stringWithUTF8String: title];
   NSMenuItem *item = [self addItemWithTitle: titleStr
@@ -737,19 +736,21 @@ name_is_separator (name)
                  keymaps: (int)keymaps
 {
   EmacsView *view = FRAME_NS_VIEW (f);
+  NSEvent *e, *event;
+  long retVal;
+
 /*   p = [view convertPoint:p fromView: nil]; */
   p.y = NSHeight ([view frame]) - p.y;
-  NSEvent *e = [[view window] currentEvent];
-  NSEvent *event = [NSEvent mouseEventWithType: NSRightMouseDown
-                                      location: p
-                                 modifierFlags: 0
-                                     timestamp: [e timestamp]
-                                  windowNumber: [[view window] windowNumber]
-                                       context: [e context]
-                                   eventNumber: 0/*[e eventNumber] */
-                                    clickCount: 1
-                                      pressure: 0];
-  long retVal;
+  e = [[view window] currentEvent];
+   event = [NSEvent mouseEventWithType: NSRightMouseDown
+                              location: p
+                         modifierFlags: 0
+                             timestamp: [e timestamp]
+                          windowNumber: [[view window] windowNumber]
+                               context: [e context]
+                           eventNumber: 0/*[e eventNumber] */
+                            clickCount: 1
+                              pressure: 0];
 
   context_menu_value = -1;
   [NSMenu popUpContextMenu: self withEvent: event forView: view];
@@ -772,7 +773,7 @@ name_is_separator (name)
 
 Lisp_Object
 ns_menu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
-             Lisp_Object title, char **error)
+             Lisp_Object title, const char **error)
 {
   EmacsMenu *pmenu;
   NSPoint p;
@@ -835,7 +836,7 @@ ns_menu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
        {
          /* Create a new pane.  */
          Lisp_Object pane_name, prefix;
-         char *pane_string;
+         const char *pane_string;
 
          pane_name = AREF (menu_items, i + MENU_ITEMS_PANE_NAME);
          prefix = AREF (menu_items, i + MENU_ITEMS_PANE_PREFIX);
@@ -999,7 +1000,10 @@ free_frame_tool_bar (FRAME_PTR f)
     Under NS we just hide the toolbar until it might be needed again.
    -------------------------------------------------------------------------- */
 {
+  BLOCK_INPUT;
   [[FRAME_NS_VIEW (f) toolbar] setVisible: NO];
+  FRAME_TOOLBAR_HEIGHT (f) = 0;
+  UNBLOCK_INPUT;
 }
 
 void
@@ -1009,8 +1013,11 @@ update_frame_tool_bar (FRAME_PTR f)
    -------------------------------------------------------------------------- */
 {
   int i;
-  EmacsToolbar *toolbar = [FRAME_NS_VIEW (f) toolbar];
+  EmacsView *view = FRAME_NS_VIEW (f);
+  NSWindow *window = [view window];
+  EmacsToolbar *toolbar = [view toolbar];
 
+  BLOCK_INPUT;
   [toolbar clearActive];
 
   /* update EmacsToolbar as in GtkUtils, build items list */
@@ -1026,7 +1033,7 @@ update_frame_tool_bar (FRAME_PTR f)
       struct image *img;
       Lisp_Object image;
       Lisp_Object helpObj;
-      char *helpText;
+      const char *helpText;
 
       /* If image is a vector, choose the image according to the
         button state.  */
@@ -1094,6 +1101,10 @@ update_frame_tool_bar (FRAME_PTR f)
       [newDict release];
     }
 
+  FRAME_TOOLBAR_HEIGHT (f) =
+    NSHeight ([window frameRectForContentRect: NSMakeRect (0, 0, 0, 0)])
+    - FRAME_NS_TITLEBAR_HEIGHT (f);
+  UNBLOCK_INPUT;
 }
 
 
@@ -1142,7 +1153,7 @@ update_frame_tool_bar (FRAME_PTR f)
 }
 
 - (void) addDisplayItemWithImage: (EmacsImage *)img idx: (int)idx
-                        helpText: (char *)help enabled: (BOOL)enabled
+                        helpText: (const char *)help enabled: (BOOL)enabled
 {
   /* 1) come up w/identifier */
   NSString *identifier
@@ -1742,7 +1753,7 @@ void process_dialog (id window, Lisp_Object list)
 
 DEFUN ("ns-reset-menu", Fns_reset_menu, Sns_reset_menu, 0, 0, 0,
        doc: /* Cause the NS menu to be re-calculated.  */)
-     ()
+     (void)
 {
   set_frame_menubar (SELECTED_FRAME (), 1, 0);
   return Qnil;
@@ -1772,15 +1783,14 @@ otherwise it is "Question".
 If the user gets rid of the dialog box without making a valid choice,
 for instance using the window manager, then this produces a quit and
 `x-popup-dialog' does not return.  */)
-     (position, contents, header)
-     Lisp_Object position, contents, header;
+     (Lisp_Object position, Lisp_Object contents, Lisp_Object header)
 {
   return ns_popup_dialog (position, contents, header);
 }
 
 DEFUN ("menu-or-popup-active-p", Fmenu_or_popup_active_p, Smenu_or_popup_active_p, 0, 0, 0,
        doc: /* Return t if a menu or popup dialog is active.  */)
-     ()
+     (void)
 {
   return popup_activated () ? Qt : Qnil;
 }
@@ -1792,7 +1802,7 @@ DEFUN ("menu-or-popup-active-p", Fmenu_or_popup_active_p, Smenu_or_popup_active_
    ========================================================================== */
 
 void
-syms_of_nsmenu ()
+syms_of_nsmenu (void)
 {
   defsubr (&Sx_popup_dialog);
   defsubr (&Sns_reset_menu);
index e4f5f0c613e276423a55c5390359235bcedab960..9e434515edf5f67f7d6da7a431bd845f4dc0a733 100644 (file)
@@ -27,16 +27,17 @@ GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu)
 
 /* This should be the first include, as it may set up #defines affecting
    interpretation of even the system includes. */
-#include "config.h"
+#include <config.h>
 #include <setjmp.h>
 
 #include "lisp.h"
 #include "nsterm.h"
 #include "termhooks.h"
+#include "keyboard.h"
 
 #define CUT_BUFFER_SUPPORT
 
-Lisp_Object QPRIMARY, QSECONDARY, QTEXT, QFILE_NAME;
+Lisp_Object QCLIPBOARD, QSECONDARY, QTEXT, QFILE_NAME;
 
 static Lisp_Object Vns_sent_selection_hooks;
 static Lisp_Object Vns_lost_selection_hooks;
@@ -45,6 +46,8 @@ static Lisp_Object Vselection_converter_alist;
 
 static Lisp_Object Qforeign_selection;
 
+/* NSGeneralPboard is pretty much analogous to X11 CLIPBOARD */
+NSString *NXPrimaryPboard;
 NSString *NXSecondaryPboard;
 
 
@@ -60,7 +63,8 @@ static NSString *
 symbol_to_nsstring (Lisp_Object sym)
 {
   CHECK_SYMBOL (sym);
-  if (EQ (sym, QPRIMARY))     return NSGeneralPboard;
+  if (EQ (sym, QCLIPBOARD))     return NSGeneralPboard;
+  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)];
@@ -71,6 +75,8 @@ static Lisp_Object
 ns_string_to_symbol (NSString *t)
 {
   if ([t isEqualToString: NSGeneralPboard])
+    return QCLIPBOARD;
+  if ([t isEqualToString: NXPrimaryPboard])
     return QPRIMARY;
   if ([t isEqualToString: NXSecondaryPboard])
     return QSECONDARY;
@@ -378,8 +384,7 @@ DEFUN ("x-own-selection-internal", Fx_own_selection_internal,
 SELECTION-NAME is a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD'.
 VALUE is typically a string, or a cons of two markers, but may be
 anything that the functions on `selection-converter-alist' know about.  */)
-     (selection_name, selection_value)
-     Lisp_Object selection_name, selection_value;
+     (Lisp_Object selection_name, Lisp_Object selection_value)
 {
   id pb;
   Lisp_Object old_value, new_value;
@@ -413,8 +418,7 @@ anything that the functions on `selection-converter-alist' know about.  */)
 DEFUN ("x-disown-selection-internal", Fx_disown_selection_internal,
        Sx_disown_selection_internal, 1, 2, 0,
        doc: /* If we own the selection SELECTION, disown it.  */)
-     (selection_name, time)
-     Lisp_Object selection_name, time;
+     (Lisp_Object selection_name, Lisp_Object time)
 {
   id pb;
   check_ns ();
@@ -434,8 +438,7 @@ the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'.
 \(Those are literal upper-case symbol names.)
 For convenience, the symbol nil is the same as `PRIMARY',
 and t is the same as `SECONDARY'.)  */)
-     (selection)
-     Lisp_Object selection;
+     (Lisp_Object selection)
 {
   id pb;
   NSArray *types;
@@ -458,8 +461,7 @@ the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'.
 \(Those are literal upper-case symbol names.)
 For convenience, the symbol nil is the same as `PRIMARY',
 and t is the same as `SECONDARY'.)  */)
-     (selection)
-     Lisp_Object selection;
+     (Lisp_Object selection)
 {
   check_ns ();
   CHECK_SYMBOL (selection);
@@ -475,8 +477,7 @@ DEFUN ("x-get-selection-internal", Fx_get_selection_internal,
 SELECTION is a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD'.
 \(Those are literal upper-case symbol names.)
 TYPE is the type of data desired, typically `STRING'.  */)
-     (selection_name, target_type)
-     Lisp_Object selection_name, target_type;
+     (Lisp_Object selection_name, Lisp_Object target_type)
 {
   Lisp_Object val;
 
@@ -501,8 +502,7 @@ TYPE is the type of data desired, typically `STRING'.  */)
 DEFUN ("ns-get-cut-buffer-internal", Fns_get_cut_buffer_internal,
        Sns_get_cut_buffer_internal, 1, 1, 0,
        doc: /* Returns the value of the named cut buffer.  */)
-     (buffer)
-     Lisp_Object buffer;
+     (Lisp_Object buffer)
 {
   id pb;
   check_ns ();
@@ -516,8 +516,7 @@ DEFUN ("ns-rotate-cut-buffers-internal", Fns_rotate_cut_buffers_internal,
        doc: /* Rotate the values of the cut buffers by N steps.
 Positive N means move values forward, negative means
 backward. CURRENTLY NOT IMPLEMENTED UNDER NEXTSTEP. */ )
-     (n)
-     Lisp_Object n;
+     (Lisp_Object n)
 {
   /* XXX This function is unimplemented under NeXTstep XXX */
   Fsignal (Qquit, Fcons (build_string (
@@ -529,8 +528,7 @@ backward. CURRENTLY NOT IMPLEMENTED UNDER NEXTSTEP. */ )
 DEFUN ("ns-store-cut-buffer-internal", Fns_store_cut_buffer_internal,
        Sns_store_cut_buffer_internal, 2, 2, 0,
        doc: /* Sets the value of the named cut buffer (typically CUT_BUFFER0).  */)
-     (buffer, string)
-     Lisp_Object buffer, string;
+     (Lisp_Object buffer, Lisp_Object string)
 {
   id pb;
   check_ns ();
@@ -544,13 +542,14 @@ DEFUN ("ns-store-cut-buffer-internal", Fns_store_cut_buffer_internal,
 void
 nxatoms_of_nsselect (void)
 {
-  NXSecondaryPboard = @"Selection";
+  NXPrimaryPboard = @"Selection";
+  NXSecondaryPboard = @"Secondary";
 }
 
 void
 syms_of_nsselect (void)
 {
-  QPRIMARY   = intern ("PRIMARY");     staticpro (&QPRIMARY);
+  QCLIPBOARD = intern ("CLIPBOARD");   staticpro (&QCLIPBOARD);
   QSECONDARY = intern ("SECONDARY");   staticpro (&QSECONDARY);
   QTEXT      = intern ("TEXT");        staticpro (&QTEXT);
   QFILE_NAME = intern ("FILE_NAME");   staticpro (&QFILE_NAME);
index 01086e63b698fa9856b45d22f86fca37f8b8f282..21b18f15cae567c711291b6f47ffdf7c7bb55c92 100644 (file)
@@ -21,6 +21,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "frame.h"
 #include "character.h"
 #include "font.h"
+#include "sysselect.h"
 
 #ifdef HAVE_NS
 
@@ -113,10 +114,10 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 - initWithTitle: (NSString *)title frame: (struct frame *)f;
 - (void)setFrame: (struct frame *)f;
 - (void)menuNeedsUpdate: (NSMenu *)menu; /* (delegate method) */
-- (NSString *)parseKeyEquiv: (char *)key;
+- (NSString *)parseKeyEquiv: (const char *)key;
 - (NSMenuItem *)addItemWithWidgetValue: (void *)wvptr;
 - (void)fillWithWidgetValue: (void *)wvptr;
-- (EmacsMenu *)addSubmenuWithTitle: (char *)title forFrame: (struct frame *)f;
+- (EmacsMenu *)addSubmenuWithTitle: (const char *)title forFrame: (struct frame *)f;
 - (void) clear;
 - (Lisp_Object)runMenuAt: (NSPoint)p forFrame: (struct frame *)f
                  keymaps: (int)keymaps;
@@ -143,7 +144,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 - (void) clearActive;
 - (BOOL) changed;
 - (void) addDisplayItemWithImage: (EmacsImage *)img idx: (int)idx
-                        helpText: (char *)help
+                        helpText: (const char *)help
                          enabled: (BOOL)enabled;
 /* delegate methods */
 - (NSToolbarItem *)toolbar: (NSToolbar *)toolbar
@@ -606,7 +607,7 @@ struct x_output
 #define NS_FACE_FOREGROUND(f) ((f)->foreground)
 #define NS_FACE_BACKGROUND(f) ((f)->background)
 #define FRAME_NS_TITLEBAR_HEIGHT(f) ((f)->output_data.ns->titlebar_height)
-#define FRAME_NS_TOOLBAR_HEIGHT(f) ((f)->output_data.ns->toolbar_height)
+#define FRAME_TOOLBAR_HEIGHT(f) ((f)->output_data.ns->toolbar_height)
 
 #define FONT_WIDTH(f)  ((f)->max_width)
 #define FONT_HEIGHT(f) ((f)->height)
@@ -712,7 +713,9 @@ extern void ns_set_name_as_filename (struct frame *f);
 extern void ns_set_doc_edited (struct frame *f, Lisp_Object arg);
 
 extern int
-ns_defined_color (struct frame *f, char *name, XColor *color_def, int alloc,
+ns_defined_color (struct frame *f,
+                  const char *name,
+                  XColor *color_def, int alloc,
                   char makeIndex);
 extern void
 ns_query_color (void *col, XColor *color_def, int setPixel);
@@ -742,10 +745,34 @@ extern Lisp_Object find_and_return_menu_selection (FRAME_PTR f,
 extern Lisp_Object ns_popup_dialog (Lisp_Object position, Lisp_Object contents,
                                     Lisp_Object header);
 
-/* two more prototypes that should be moved to a more general include file */
+/* More prototypes that should be moved to a more general include file */
 extern void set_frame_menubar (struct frame *f, int first_time, int deep_p);
 extern void x_set_window_size (struct frame *f, int change_grav,
                               int cols, int rows);
+extern void x_sync (struct frame *);
+extern Lisp_Object x_get_focus_frame (struct frame *);
+extern void x_set_mouse_position (struct frame *f, int h, int v);
+extern void x_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y);
+extern void x_make_frame_visible (struct frame *f);
+extern void x_make_frame_invisible (struct frame *f);
+extern void x_iconify_frame (struct frame *f);
+extern int x_char_width (struct frame *f);
+extern int x_char_height (struct frame *f);
+extern int x_pixel_width (struct frame *f);
+extern int x_pixel_height (struct frame *f);
+extern void x_set_frame_alpha (struct frame *f);
+extern void x_set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object);
+extern void x_set_tool_bar_lines (struct frame *f,
+                                  Lisp_Object value,
+                                  Lisp_Object oldval);
+extern void x_activate_menubar (struct frame *);
+extern void free_frame_menubar (struct frame *);
+
+extern void ns_init_paths (void);
+extern void syms_of_nsterm (void);
+extern void syms_of_nsfns (void);
+extern void syms_of_nsmenu (void);
+extern void syms_of_nsselect (void);
 
 /* From nsimage.m, needed in image.c */
 struct image;
@@ -760,10 +787,12 @@ extern unsigned long ns_get_pixel (void *img, int x, int y);
 extern void ns_put_pixel (void *img, int x, int y, unsigned long argb);
 extern void ns_set_alpha (void *img, int x, int y, unsigned char a);
 
-extern int x_display_pixel_height P_ ((struct ns_display_info *));
-extern int x_display_pixel_width P_ ((struct ns_display_info *));
+extern int x_display_pixel_height (struct ns_display_info *);
+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);
 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 7c70b2ae69832c727a5bccf840beabbcaf06ec2e..f0efb948ab9a50af580a3e06cec4fcb237dd74a8 100644 (file)
@@ -27,7 +27,7 @@ GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu)
 
 /* This should be the first include, as it may set up #defines affecting
    interpretation of even the system includes. */
-#include "config.h"
+#include <config.h>
 
 #include <math.h>
 #include <sys/types.h>
@@ -296,7 +296,7 @@ append2 (Lisp_Object list, Lisp_Object item)
 
 
 void
-ns_init_paths ()
+ns_init_paths (void)
 /* --------------------------------------------------------------------------
    Used to allow emacs to find its resources under Emacs.app
    Called from emacs.c at startup.
@@ -479,7 +479,7 @@ ns_retain_object (void *obj)
 
 
 void *
-ns_alloc_autorelease_pool ()
+ns_alloc_autorelease_pool (void)
 /* --------------------------------------------------------------------------
      Allocate a pool for temporary objects (callable from C)
    -------------------------------------------------------------------------- */
@@ -790,7 +790,7 @@ ns_clip_to_row (struct window *w, struct glyph_row *row, int area, BOOL gc)
 
 
 static void
-ns_ring_bell ()
+ns_ring_bell (struct frame *f)
 /* --------------------------------------------------------------------------
      "Beep" routine
    -------------------------------------------------------------------------- */
@@ -1138,15 +1138,15 @@ x_set_window_size (struct frame *f, int change_grav, int cols, int rows)
     /* NOTE: previously this would generate wrong result if toolbar not
              yet displayed and fixing toolbar_height=32 helped, but
              now (200903) seems no longer needed */
-    FRAME_NS_TOOLBAR_HEIGHT (f) =
+    FRAME_TOOLBAR_HEIGHT (f) =
       NSHeight ([window frameRectForContentRect: NSMakeRect (0, 0, 0, 0)])
         - FRAME_NS_TITLEBAR_HEIGHT (f);
   else
-    FRAME_NS_TOOLBAR_HEIGHT (f) = 0;
+    FRAME_TOOLBAR_HEIGHT (f) = 0;
 
   wr.size.width = pixelwidth + f->border_width;
   wr.size.height = pixelheight + FRAME_NS_TITLEBAR_HEIGHT (f) 
-                  + FRAME_NS_TOOLBAR_HEIGHT (f);
+                  + FRAME_TOOLBAR_HEIGHT (f);
 
   /* constrain to screen if we can */
   if (screen)
@@ -1186,12 +1186,14 @@ x_set_window_size (struct frame *f, int change_grav, int cols, int rows)
      difference between the real width and Emacs' imagined one.  For
      right-hand bars, don't worry about it since the extra is never used.
      (Obviously doesn't work for vertically split windows tho..) */
-  NSPoint origin = FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f)
-    ? NSMakePoint (FRAME_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f)
-                  - NS_SCROLL_BAR_WIDTH (f), 0)
-    : NSMakePoint (0, 0);
-  [view setFrame: NSMakeRect (0, 0, pixelwidth, pixelheight)];
-  [view setBoundsOrigin: origin];
+  {
+    NSPoint origin = FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f)
+      ? NSMakePoint (FRAME_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f)
+                     - NS_SCROLL_BAR_WIDTH (f), 0)
+      : NSMakePoint (0, 0);
+    [view setFrame: NSMakeRect (0, 0, pixelwidth, pixelheight)];
+    [view setBoundsOrigin: origin];
+  }
 
   change_frame_size (f, rows, cols, 0, 1, 0); /* pretend, delay, safe */
   FRAME_PIXEL_WIDTH (f) = pixelwidth;
@@ -1507,7 +1509,10 @@ ns_query_color(void *col, XColor *color_def, int setPixel)
 
 
 int
-ns_defined_color (struct frame *f, char *name, XColor *color_def, int alloc,
+ns_defined_color (struct frame *f,
+                  const char *name,
+                  XColor *color_def,
+                  int alloc,
                   char makeIndex)
 /* --------------------------------------------------------------------------
          Return 1 if named color found, and set color_def rgb accordingly.
@@ -1787,6 +1792,9 @@ ns_define_frame_cursor (struct frame *f, Cursor cursor)
       EmacsView *view = FRAME_NS_VIEW (f);
       FRAME_POINTER_TYPE (f) = cursor;
       [[view window] invalidateCursorRectsForView: view];
+      /* Redisplay assumes this function also draws the changed frame
+         cursor, but this function doesn't, so do it explicitly.  */
+      x_update_cursor (f, 1);
     }
 }
 
@@ -2163,11 +2171,11 @@ ns_draw_fringe_bitmap (struct window *w, struct glyph_row *row,
     {
       EmacsImage **newBimgs
        = xmalloc (max_used_fringe_bitmap * sizeof (EmacsImage *));
-      bzero (newBimgs, max_used_fringe_bitmap * sizeof (EmacsImage *));
+      memset (newBimgs, 0, max_used_fringe_bitmap * sizeof (EmacsImage *));
 
       if (nBimgs)
         {
-          bcopy (bimgs, newBimgs, nBimgs * sizeof (EmacsImage *));
+          memcpy (newBimgs, bimgs, nBimgs * sizeof (EmacsImage *));
           xfree (bimgs);
         }
 
@@ -2184,9 +2192,8 @@ ns_draw_fringe_bitmap (struct window *w, struct glyph_row *row,
       int yAdjust = rowY - FRAME_INTERNAL_BORDER_WIDTH (f) < 5 ?
         -FRAME_INTERNAL_BORDER_WIDTH (f) : 0;
       int yIncr = FRAME_PIXEL_HEIGHT (f) - (p->by+yAdjust + p->ny) < 5 ?
-        FRAME_INTERNAL_BORDER_WIDTH (f) : 0;
-      if (yAdjust)
-        yIncr += FRAME_INTERNAL_BORDER_WIDTH (f);
+        FRAME_INTERNAL_BORDER_WIDTH (f) : 0
+        + (yAdjust ? FRAME_INTERNAL_BORDER_WIDTH (f) : 0);
       NSRect r = NSMakeRect (p->bx+xAdjust, p->by+yAdjust, p->nx, p->ny+yIncr);
       NSRectClip (r);
       [ns_lookup_indexed_color(face->background, f) set];
@@ -2244,6 +2251,11 @@ ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row,
   struct frame *f = WINDOW_XFRAME (w);
   struct glyph *phys_cursor_glyph;
   int overspill;
+  struct glyph *cursor_glyph;
+
+  /* If cursor is out of bounds, don't draw garbage.  This can happen
+     in mini-buffer windows when switching between echo area glyphs
+     and mini-buffer.  */
 
   NSTRACE (dumpcursor);
 //fprintf(stderr, "drawcursor (%d,%d) activep = %d\tonp = %d\tc_type = %d\twidth = %d\n",x,y, active_p,on_p,cursor_type,cursor_width);
@@ -2321,6 +2333,13 @@ ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row,
     case BAR_CURSOR:
       s = r;
       s.size.width = min (cursor_width, 2); //FIXME(see above)
+
+      /* If the character under cursor is R2L, draw the bar cursor
+         on the right of its glyph, rather than on the left.  */
+      cursor_glyph = get_phys_cursor_glyph (w);
+      if ((cursor_glyph->resolved_level & 1) != 0)
+        s.origin.x += cursor_glyph->pixel_width - s.size.width;
+
       NSRectFill (s);
       break;
     }
@@ -2375,7 +2394,7 @@ show_hourglass (struct atimer *timer)
 
 
 void
-hide_hourglass ()
+hide_hourglass (void)
 {
   if (!hourglass_shown_p)
     return;
@@ -3406,16 +3425,14 @@ x_wm_set_icon_position (struct frame *f, int icon_x, int icon_y)
    ========================================================================== */
 
 int
-x_display_pixel_height (dpyinfo)
-     struct ns_display_info *dpyinfo;
+x_display_pixel_height (struct ns_display_info *dpyinfo)
 {
   NSScreen *screen = [NSScreen mainScreen];
   return [screen frame].size.height;
 }
 
 int
-x_display_pixel_width (dpyinfo)
-     struct ns_display_info *dpyinfo;
+x_display_pixel_width (struct ns_display_info *dpyinfo)
 {
   NSScreen *screen = [NSScreen mainScreen];
   return [screen frame].size.width;
@@ -3694,7 +3711,7 @@ ns_term_init (Lisp_Object display_name)
                                              name: nil object: nil]; */
 
   dpyinfo = (struct ns_display_info *)xmalloc (sizeof (struct ns_display_info));
-  bzero (dpyinfo, sizeof (struct ns_display_info));
+  memset (dpyinfo, 0, sizeof (struct ns_display_info));
 
   ns_initialize_display_info (dpyinfo);
   terminal = ns_create_terminal (dpyinfo);
@@ -4881,16 +4898,16 @@ ns_term_shutdown (int sig)
   rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (emacsframe, frameSize.height
 #ifdef NS_IMPL_GNUSTEP
       - FRAME_NS_TITLEBAR_HEIGHT (emacsframe) + 3
-        - FRAME_NS_TOOLBAR_HEIGHT (emacsframe));
+        - FRAME_TOOLBAR_HEIGHT (emacsframe));
 #else
       - FRAME_NS_TITLEBAR_HEIGHT (emacsframe)
-        - FRAME_NS_TOOLBAR_HEIGHT (emacsframe));
+        - FRAME_TOOLBAR_HEIGHT (emacsframe));
 #endif
   if (rows < MINHEIGHT)
     rows = MINHEIGHT;
   frameSize.height = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (emacsframe, rows)
                        + FRAME_NS_TITLEBAR_HEIGHT (emacsframe)
-                       + FRAME_NS_TOOLBAR_HEIGHT (emacsframe);
+                       + FRAME_TOOLBAR_HEIGHT (emacsframe);
 #ifdef NS_IMPL_COCOA
   {
     /* this sets window title to have size in it; the wm does this under GS */
@@ -5101,7 +5118,7 @@ ns_term_shutdown (int sig)
   [toggleButton setTarget: self];
   [toggleButton setAction: @selector (toggleToolbar: )];
 #endif
-  FRAME_NS_TOOLBAR_HEIGHT (f) = 0;
+  FRAME_TOOLBAR_HEIGHT (f) = 0;
 
   tem = f->icon_name;
   if (!NILP (tem))
@@ -5743,9 +5760,10 @@ ns_term_shutdown (int sig)
   NSTRACE (judge);
   if (condemned)
     {
+      EmacsView *view;
       BLOCK_INPUT;
       /* ensure other scrollbar updates after deletion */
-      EmacsView *view = (EmacsView *)FRAME_NS_VIEW (frame);
+      view = (EmacsView *)FRAME_NS_VIEW (frame);
       if (view != nil)
         view->scrollbarsNeedingUpdate++;
       [self removeFromSuperview];
@@ -6122,7 +6140,7 @@ ns_xlfd_to_fontname (const char *xlfd)
 
 
 void
-syms_of_nsterm ()
+syms_of_nsterm (void)
 {
   NSTRACE (syms_of_nsterm);
 
diff --git a/src/prefix-args.c b/src/prefix-args.c
deleted file mode 100644 (file)
index d29085a..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-/* prefix-args.c - echo each argument, prefixed by a string.
-   Copyright (C) 1992, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-                 2008, 2009, 2010  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/>.  */
-
-/* Jim Blandy <jimb@occs.cs.oberlin.edu> - September 1992
-
-   When using GCC 2 as the linker in the build process, options
-   intended for the linker need to be prefixed with the "-Xlinker"
-   option.  If an option takes an argument, we need to use -Xlinker
-   twice - once for the option and once for its argument.  For
-   example, to run the linker with the options "-Bstatic" "-e"
-   "_start", you'd need to pass the following options to GCC:
-
-   -Xlinker -Bstatic -Xlinker -e -Xlinker _start.
-
-   The Emacs makefile used to use a Bourne Shell `for' loop to prefix
-   each linker option with "-Xlinker", but 1) the for loop was hairier
-   than one might hope because it had to work when there were no
-   arguments to pass to the linker - the shell barfs on a loop like
-   this:
-
-       for arg in ; do echo -Xlinker "$arg"; done
-
-   and 2) the whole compilation command containing this loop seems to
-   exit with a non-zero status and halt the build under Ultrix.
-
-   If I can't write a completely portable program to do this in C,
-   I'm quitting and taking up gardening.  */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#if STDC_HEADERS
-# include <stdlib.h>           /* for proper declaration of `exit' */
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-
-int
-main (argc, argv)
-     int argc;
-     char **argv;
-{
-  char *progname;
-  char *prefix;
-
-  progname = argv[0];
-  argc--, argv++;
-
-  if (argc < 1)
-    {
-      fprintf (stderr, "Usage: %s PREFIX ARGS...\n\
-Echo each ARG preceded by PREFIX and a space.\n", progname);
-      exit (2);
-    }
-
-  prefix = argv[0];
-  argc--, argv++;
-
-  for (; argc > 0; argc--, argv++)
-    printf ("%s %s%c", prefix, argv[0], (argc > 1) ? ' ' : '\n');
-
-  exit (0);
-}
-
-/* arch-tag: 08136d70-e5c0-49c7-bcd8-b4850233977a
-   (do not change this comment) */
index ccbf8d8c0c789ae3451d0954960a9acc9d80dbeb..1df11447d0d2cd93dc250365e1b42255fceda0ab 100644 (file)
@@ -42,7 +42,6 @@ Lisp_Object Vstandard_output, Qstandard_output;
 Lisp_Object Qtemp_buffer_setup_hook;
 
 /* These are used to print like we read.  */
-extern Lisp_Object Qbackquote, Qcomma, Qcomma_at, Qcomma_dot, Qfunction;
 
 Lisp_Object Vfloat_output_format, Qfloat_output_format;
 
@@ -161,14 +160,7 @@ Lisp_Object Vprint_number_table;
 #define PRINT_NUMBER_OBJECT(table,i) XVECTOR ((table))->contents[(i) * 2]
 #define PRINT_NUMBER_STATUS(table,i) XVECTOR ((table))->contents[(i) * 2 + 1]
 
-/* Nonzero means print newline to stdout before next minibuffer message.
-   Defined in xdisp.c */
-
-extern int noninteractive_need_newline;
-
-extern int minibuffer_auto_raise;
-
-void print_interval ();
+void print_interval (INTERVAL interval, Lisp_Object printcharfun);
 
 /* GDB resets this to zero on W32 to disable OutputDebugString calls.  */
 int print_output_debug_flag = 1;
@@ -287,10 +279,9 @@ int print_output_debug_flag = 1;
    when there is a recursive call to print.  */
 
 static Lisp_Object
-print_unwind (saved_text)
-     Lisp_Object saved_text;
+print_unwind (Lisp_Object saved_text)
 {
-  bcopy (SDATA (saved_text), print_buffer, SCHARS (saved_text));
+  memcpy (print_buffer, SDATA (saved_text), SCHARS (saved_text));
   return Qnil;
 }
 
@@ -301,9 +292,7 @@ print_unwind (saved_text)
    argument.  */
 
 static void
-printchar (ch, fun)
-     unsigned int ch;
-     Lisp_Object fun;
+printchar (unsigned int ch, Lisp_Object fun)
 {
   if (!NILP (fun) && !EQ (fun, Qt))
     call1 (fun, make_number (ch));
@@ -319,7 +308,7 @@ printchar (ch, fun)
          if (print_buffer_pos_byte + len >= print_buffer_size)
            print_buffer = (char *) xrealloc (print_buffer,
                                              print_buffer_size *= 2);
-         bcopy (str, print_buffer + print_buffer_pos_byte, len);
+         memcpy (print_buffer + print_buffer_pos_byte, str, len);
          print_buffer_pos += 1;
          print_buffer_pos_byte += len;
        }
@@ -353,11 +342,8 @@ printchar (ch, fun)
    to data in a Lisp string.  Otherwise that is not safe.  */
 
 static void
-strout (ptr, size, size_byte, printcharfun, multibyte)
-     char *ptr;
-     int size, size_byte;
-     Lisp_Object printcharfun;
-     int multibyte;
+strout (const char *ptr, int size, int size_byte, Lisp_Object printcharfun,
+       int multibyte)
 {
   if (size < 0)
     size_byte = size = strlen (ptr);
@@ -370,7 +356,7 @@ strout (ptr, size, size_byte, printcharfun, multibyte)
          print_buffer = (char *) xrealloc (print_buffer,
                                            print_buffer_size);
        }
-      bcopy (ptr, print_buffer + print_buffer_pos_byte, size_byte);
+      memcpy (print_buffer + print_buffer_pos_byte, ptr, size_byte);
       print_buffer_pos += size;
       print_buffer_pos_byte += size_byte;
     }
@@ -440,9 +426,7 @@ strout (ptr, size, size_byte, printcharfun, multibyte)
    because printing one char can relocate.  */
 
 static void
-print_string (string, printcharfun)
-     Lisp_Object string;
-     Lisp_Object printcharfun;
+print_string (Lisp_Object string, Lisp_Object printcharfun)
 {
   if (EQ (printcharfun, Qt) || NILP (printcharfun))
     {
@@ -469,7 +453,7 @@ print_string (string, printcharfun)
          if (chars < bytes)
            {
              newstr = make_uninit_multibyte_string (chars, bytes);
-             bcopy (SDATA (string), SDATA (newstr), chars);
+             memcpy (SDATA (newstr), SDATA (string), chars);
              str_to_multibyte (SDATA (newstr), bytes, chars);
              string = newstr;
            }
@@ -488,7 +472,7 @@ print_string (string, printcharfun)
          USE_SAFE_ALLOCA;
 
          SAFE_ALLOCA (buffer, char *, nbytes);
-         bcopy (SDATA (string), buffer, nbytes);
+         memcpy (buffer, SDATA (string), nbytes);
 
          strout (buffer, chars, SBYTES (string),
                  printcharfun, STRING_MULTIBYTE (string));
@@ -530,8 +514,7 @@ print_string (string, printcharfun)
 DEFUN ("write-char", Fwrite_char, Swrite_char, 1, 2, 0,
        doc: /* Output character CHARACTER to stream PRINTCHARFUN.
 PRINTCHARFUN defaults to the value of `standard-output' (which see).  */)
-     (character, printcharfun)
-     Lisp_Object character, printcharfun;
+  (Lisp_Object character, Lisp_Object printcharfun)
 {
   PRINTDECLARE;
 
@@ -549,9 +532,7 @@ PRINTCHARFUN defaults to the value of `standard-output' (which see).  */)
    Do not use this on the contents of a Lisp string.  */
 
 void
-write_string (data, size)
-     char *data;
-     int size;
+write_string (const char *data, int size)
 {
   PRINTDECLARE;
   Lisp_Object printcharfun;
@@ -568,10 +549,7 @@ write_string (data, size)
    Do not use this on the contents of a Lisp string.  */
 
 void
-write_string_1 (data, size, printcharfun)
-     char *data;
-     int size;
-     Lisp_Object printcharfun;
+write_string_1 (const char *data, int size, Lisp_Object printcharfun)
 {
   PRINTDECLARE;
 
@@ -582,8 +560,7 @@ write_string_1 (data, size, printcharfun)
 
 
 void
-temp_output_buffer_setup (bufname)
-    const char *bufname;
+temp_output_buffer_setup (const char *bufname)
 {
   int count = SPECPDL_INDEX ();
   register struct buffer *old = current_buffer;
@@ -616,10 +593,7 @@ temp_output_buffer_setup (bufname)
 }
 
 Lisp_Object
-internal_with_output_to_temp_buffer (bufname, function, args)
-     const char *bufname;
-     Lisp_Object (*function) P_ ((Lisp_Object));
-     Lisp_Object args;
+internal_with_output_to_temp_buffer (const char *bufname, Lisp_Object (*function) (Lisp_Object), Lisp_Object args)
 {
   int count = SPECPDL_INDEX ();
   Lisp_Object buf, val;
@@ -670,8 +644,7 @@ temporarily selected.  But it doesn't run `temp-buffer-show-hook'
 if it uses `temp-buffer-show-function'.
 
 usage: (with-output-to-temp-buffer BUFNAME BODY...)  */)
-     (args)
-     Lisp_Object args;
+  (Lisp_Object args)
 {
   struct gcpro gcpro1;
   Lisp_Object name;
@@ -695,16 +668,15 @@ usage: (with-output-to-temp-buffer BUFNAME BODY...)  */)
 }
 
 \f
-static void print ();
-static void print_preprocess ();
-static void print_preprocess_string ();
-static void print_object ();
+static void print (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag);
+static void print_preprocess (Lisp_Object obj);
+static void print_preprocess_string (INTERVAL interval, Lisp_Object arg);
+static void print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag);
 
 DEFUN ("terpri", Fterpri, Sterpri, 0, 1, 0,
        doc: /* Output a newline to stream PRINTCHARFUN.
 If PRINTCHARFUN is omitted or nil, the value of `standard-output' is used.  */)
-  (printcharfun)
-     Lisp_Object printcharfun;
+  (Lisp_Object printcharfun)
 {
   PRINTDECLARE;
 
@@ -739,8 +711,7 @@ of these:
 
 If PRINTCHARFUN is omitted, the value of `standard-output' (which see)
 is used instead.  */)
-     (object, printcharfun)
-     Lisp_Object object, printcharfun;
+  (Lisp_Object object, Lisp_Object printcharfun)
 {
   PRINTDECLARE;
 
@@ -766,8 +737,7 @@ OBJECT is any of the Lisp data types: a number, a string, a symbol,
 a list, a buffer, a window, a frame, etc.
 
 A printed representation of an object is text which describes that object.  */)
-     (object, noescape)
-     Lisp_Object object, noescape;
+  (Lisp_Object object, Lisp_Object noescape)
 {
   Lisp_Object printcharfun;
   /* struct gcpro gcpro1, gcpro2; */
@@ -835,8 +805,7 @@ of these:
 
 If PRINTCHARFUN is omitted, the value of `standard-output' (which see)
 is used instead.  */)
-     (object, printcharfun)
-     Lisp_Object object, printcharfun;
+  (Lisp_Object object, Lisp_Object printcharfun)
 {
   PRINTDECLARE;
 
@@ -871,8 +840,7 @@ of these:
 
 If PRINTCHARFUN is omitted, the value of `standard-output' (which see)
 is used instead.  */)
-     (object, printcharfun)
-     Lisp_Object object, printcharfun;
+  (Lisp_Object object, Lisp_Object printcharfun)
 {
   PRINTDECLARE;
   struct gcpro gcpro1;
@@ -897,8 +865,7 @@ DEFUN ("external-debugging-output", Fexternal_debugging_output, Sexternal_debugg
        doc: /* Write CHARACTER to stderr.
 You can call print while debugging emacs, and pass it this function
 to make it write to the debugging output.  */)
-     (character)
-     Lisp_Object character;
+  (Lisp_Object character)
 {
   CHECK_NUMBER (character);
   putc (XINT (character), stderr);
@@ -919,8 +886,7 @@ to make it write to the debugging output.  */)
    print_output_debug_flag from being optimized away.  */
 
 void
-debug_output_compilation_hack (x)
-     int x;
+debug_output_compilation_hack (int x)
 {
   print_output_debug_flag = x;
 }
@@ -941,8 +907,7 @@ DEFUN ("redirect-debugging-output", Fredirect_debugging_output, Sredirect_debugg
 If FILE is nil, reset target to the initial stderr stream.
 Optional arg APPEND non-nil (interactively, with prefix arg) means
 append to existing target file.  */)
-     (file, append)
-     Lisp_Object file, append;
+  (Lisp_Object file, Lisp_Object append)
 {
   if (initial_stderr_stream != NULL)
     {
@@ -974,16 +939,14 @@ append to existing target file.  */)
 /* This is the interface for debugging printing.  */
 
 void
-debug_print (arg)
-     Lisp_Object arg;
+debug_print (Lisp_Object arg)
 {
   Fprin1 (arg, Qexternal_debugging_output);
   fprintf (stderr, "\r\n");
 }
 
 void
-safe_debug_print (arg)
-     Lisp_Object arg;
+safe_debug_print (Lisp_Object arg)
 {
   int valid = valid_lisp_object_p (arg);
 
@@ -1002,8 +965,7 @@ DEFUN ("error-message-string", Ferror_message_string, Serror_message_string,
        doc: /* Convert an error value (ERROR-SYMBOL . DATA) to an error message.
 See Info anchor `(elisp)Definition of signal' for some details on how this
 error message is constructed.  */)
-     (obj)
-     Lisp_Object obj;
+  (Lisp_Object obj)
 {
   struct buffer *old = current_buffer;
   Lisp_Object value;
@@ -1037,10 +999,8 @@ error message is constructed.  */)
    CALLER is the Lisp function inside which the error was signaled.  */
 
 void
-print_error_message (data, stream, context, caller)
-     Lisp_Object data, stream;
-     char *context;
-     Lisp_Object caller;
+print_error_message (Lisp_Object data, Lisp_Object stream, const char *context,
+                    Lisp_Object caller)
 {
   Lisp_Object errname, errmsg, file_error, tail;
   struct gcpro gcpro1;
@@ -1055,7 +1015,7 @@ print_error_message (data, stream, context, caller)
     {
       Lisp_Object cname = SYMBOL_NAME (caller);
       char *name = alloca (SBYTES (cname));
-      bcopy (SDATA (cname), name, SBYTES (cname));
+      memcpy (name, SDATA (cname), SBYTES (cname));
       message_dolog (name, SBYTES (cname), 0, 0);
       message_dolog (": ", 2, 0, 0);
     }
@@ -1125,9 +1085,7 @@ print_error_message (data, stream, context, caller)
  */
 
 void
-float_to_string (buf, data)
-     unsigned char *buf;
-     double data;
+float_to_string (unsigned char *buf, double data)
 {
   unsigned char *cp;
   int width;
@@ -1250,10 +1208,7 @@ float_to_string (buf, data)
 
 \f
 static void
-print (obj, printcharfun, escapeflag)
-     Lisp_Object obj;
-     register Lisp_Object printcharfun;
-     int escapeflag;
+print (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag)
 {
   new_backquote_output = 0;
 
@@ -1312,8 +1267,7 @@ print (obj, printcharfun, escapeflag)
    The status fields of Vprint_number_table mean whether each object appears
    more than once in OBJ: Qnil at the first time, and Qt after that .  */
 static void
-print_preprocess (obj)
-     Lisp_Object obj;
+print_preprocess (Lisp_Object obj)
 {
   int i;
   EMACS_INT size;
@@ -1433,9 +1387,7 @@ print_preprocess (obj)
 }
 
 static void
-print_preprocess_string (interval, arg)
-     INTERVAL interval;
-     Lisp_Object arg;
+print_preprocess_string (INTERVAL interval, Lisp_Object arg)
 {
   print_preprocess (interval->plist);
 }
@@ -1443,9 +1395,8 @@ print_preprocess_string (interval, arg)
 /* A flag to control printing of `charset' text property.
    The default value is Qdefault. */
 Lisp_Object Vprint_charset_text_property;
-extern Lisp_Object Qdefault;
 
-static void print_check_string_charset_prop ();
+static void print_check_string_charset_prop (INTERVAL interval, Lisp_Object string);
 
 #define PRINT_STRING_NON_CHARSET_FOUND 1
 #define PRINT_STRING_UNSAFE_CHARSET_FOUND 2
@@ -1454,9 +1405,7 @@ static void print_check_string_charset_prop ();
 static int print_check_string_result;
 
 static void
-print_check_string_charset_prop (interval, string)
-     INTERVAL interval;
-     Lisp_Object string;
+print_check_string_charset_prop (INTERVAL interval, Lisp_Object string)
 {
   Lisp_Object val;
 
@@ -1503,8 +1452,7 @@ print_check_string_charset_prop (interval, string)
 static Lisp_Object print_prune_charset_plist;
 
 static Lisp_Object
-print_prune_string_charset (string)
-     Lisp_Object string;
+print_prune_string_charset (Lisp_Object string)
 {
   print_check_string_result = 0;
   traverse_intervals (STRING_INTERVALS (string), 0,
@@ -1528,10 +1476,7 @@ print_prune_string_charset (string)
 }
 
 static void
-print_object (obj, printcharfun, escapeflag)
-     Lisp_Object obj;
-     register Lisp_Object printcharfun;
-     int escapeflag;
+print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag)
 {
   char buf[40];
 
@@ -2267,70 +2212,6 @@ print_object (obj, printcharfun, escapeflag)
          strout ("#<misc free cell>", -1, -1, printcharfun, 0);
          break;
 
-       case Lisp_Misc_Intfwd:
-         sprintf (buf, "#<intfwd to %ld>", (long) *XINTFWD (obj)->intvar);
-         strout (buf, -1, -1, printcharfun, 0);
-         break;
-
-       case Lisp_Misc_Boolfwd:
-         sprintf (buf, "#<boolfwd to %s>",
-                  (*XBOOLFWD (obj)->boolvar ? "t" : "nil"));
-         strout (buf, -1, -1, printcharfun, 0);
-         break;
-
-       case Lisp_Misc_Objfwd:
-         strout ("#<objfwd to ", -1, -1, printcharfun, 0);
-         print_object (*XOBJFWD (obj)->objvar, printcharfun, escapeflag);
-         PRINTCHAR ('>');
-         break;
-
-       case Lisp_Misc_Buffer_Objfwd:
-         strout ("#<buffer_objfwd to ", -1, -1, printcharfun, 0);
-         print_object (PER_BUFFER_VALUE (current_buffer,
-                                         XBUFFER_OBJFWD (obj)->offset),
-                       printcharfun, escapeflag);
-         PRINTCHAR ('>');
-         break;
-
-       case Lisp_Misc_Kboard_Objfwd:
-         strout ("#<kboard_objfwd to ", -1, -1, printcharfun, 0);
-         print_object (*(Lisp_Object *) ((char *) current_kboard
-                                         + XKBOARD_OBJFWD (obj)->offset),
-                       printcharfun, escapeflag);
-         PRINTCHAR ('>');
-         break;
-
-       case Lisp_Misc_Buffer_Local_Value:
-         strout ("#<buffer_local_value ", -1, -1, printcharfun, 0);
-         if (XBUFFER_LOCAL_VALUE (obj)->local_if_set)
-           strout ("[local-if-set] ", -1, -1, printcharfun, 0);
-         strout ("[realvalue] ", -1, -1, printcharfun, 0);
-         print_object (XBUFFER_LOCAL_VALUE (obj)->realvalue,
-                       printcharfun, escapeflag);
-         if (XBUFFER_LOCAL_VALUE (obj)->found_for_buffer)
-           strout ("[local in buffer] ", -1, -1, printcharfun, 0);
-         else
-           strout ("[buffer] ", -1, -1, printcharfun, 0);
-         print_object (XBUFFER_LOCAL_VALUE (obj)->buffer,
-                       printcharfun, escapeflag);
-         if (XBUFFER_LOCAL_VALUE (obj)->check_frame)
-           {
-             if (XBUFFER_LOCAL_VALUE (obj)->found_for_frame)
-               strout ("[local in frame] ", -1, -1, printcharfun, 0);
-             else
-               strout ("[frame] ", -1, -1, printcharfun, 0);
-             print_object (XBUFFER_LOCAL_VALUE (obj)->frame,
-                           printcharfun, escapeflag);
-           }
-         strout ("[alist-elt] ", -1, -1, printcharfun, 0);
-         print_object (XCAR (XBUFFER_LOCAL_VALUE (obj)->cdr),
-                       printcharfun, escapeflag);
-         strout ("[default-value] ", -1, -1, printcharfun, 0);
-         print_object (XCDR (XBUFFER_LOCAL_VALUE (obj)->cdr),
-                       printcharfun, escapeflag);
-         PRINTCHAR ('>');
-         break;
-
        case Lisp_Misc_Save_Value:
          strout ("#<save_value ", -1, -1, printcharfun, 0);
          sprintf(buf, "ptr=0x%08lx int=%d",
@@ -2371,9 +2252,7 @@ print_object (obj, printcharfun, escapeflag)
    This is part of printing a string that has text properties.  */
 
 void
-print_interval (interval, printcharfun)
-     INTERVAL interval;
-     Lisp_Object printcharfun;
+print_interval (INTERVAL interval, Lisp_Object printcharfun)
 {
   if (NILP (interval->plist))
     return;
@@ -2388,7 +2267,7 @@ print_interval (interval, printcharfun)
 
 \f
 void
-syms_of_print ()
+syms_of_print (void)
 {
   Qtemp_buffer_setup_hook = intern_c_string ("temp-buffer-setup-hook");
   staticpro (&Qtemp_buffer_setup_hook);
index 7adc114075ecf82afbd7df44dac09a6bd3eb0ceb..f348dca7d3564db9d59330328b8127c25256d3ce 100644 (file)
@@ -21,17 +21,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <config.h>
 #include <signal.h>
-
-/* This file is split into two parts by the following preprocessor
-   conditional.  The 'then' clause contains all of the support for
-   asynchronous subprocesses.  The 'else' clause contains stub
-   versions of some of the asynchronous subprocess routines that are
-   often called elsewhere in Emacs, so we don't have to #ifdef the
-   sections that call them.  */
-
-\f
-#ifdef subprocesses
-
 #include <stdio.h>
 #include <errno.h>
 #include <setjmp.h>
@@ -42,16 +31,16 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #ifdef HAVE_INTTYPES_H
 #include <inttypes.h>
 #endif
-#ifdef STDC_HEADERS
 #include <stdlib.h>
-#endif
 
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 #include <fcntl.h>
 
-#ifdef HAVE_SOCKETS    /* TCP connection support, if kernel can do it */
+/* Only MS-DOS does not define `subprocesses'.  */
+#ifdef subprocesses
+
 #include <sys/socket.h>
 #include <netdb.h>
 #include <netinet/in.h>
@@ -67,30 +56,18 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <sys/un.h>
 #endif
 #endif
-#endif /* HAVE_SOCKETS */
 
-#if defined(BSD_SYSTEM)
+#if defined(HAVE_SYS_IOCTL_H)
 #include <sys/ioctl.h>
-#if !defined (O_NDELAY) && defined (HAVE_PTYS) && !defined(USG5)
-#include <fcntl.h>
-#endif /* HAVE_PTYS and no O_NDELAY */
-#endif /* BSD_SYSTEM */
+#if defined(HAVE_NET_IF_H)
+#include <net/if.h>
+#endif /* HAVE_NET_IF_H */
+#endif /* HAVE_SYS_IOCTL_H */
 
 #ifdef NEED_BSDTTY
 #include <bsdtty.h>
 #endif
 
-/* Can we use SIOCGIFCONF and/or SIOCGIFADDR */
-#ifdef HAVE_SOCKETS
-#if defined(HAVE_SYS_IOCTL_H) && defined(HAVE_NET_IF_H)
-/* sys/ioctl.h may have been included already */
-#ifndef SIOCGIFADDR
-#include <sys/ioctl.h>
-#endif
-#include <net/if.h>
-#endif
-#endif
-
 #ifdef HAVE_SYS_WAIT
 #include <sys/wait.h>
 #endif
@@ -101,6 +78,12 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <resolv.h>
 #endif
 
+#ifdef HAVE_UTIL_H
+#include <util.h>
+#endif
+
+#endif /* subprocesses */
+
 #include "lisp.h"
 #include "systime.h"
 #include "systty.h"
@@ -119,10 +102,36 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "dispextern.h"
 #include "composite.h"
 #include "atimer.h"
+#include "sysselect.h"
+#include "syssignal.h"
+#include "syswait.h"
 
 #if defined (USE_GTK) || defined (HAVE_GCONF)
 #include "xgselect.h"
 #endif /* defined (USE_GTK) || defined (HAVE_GCONF) */
+#ifdef HAVE_NS
+#include "nsterm.h"
+#endif
+extern int timers_run;
+
+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;
+Lisp_Object Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtime, Qctime;
+Lisp_Object QCname, QCtype;
+\f
+/* Non-zero if keyboard input is on hold, zero otherwise.  */
+
+static int kbd_is_on_hold;
+
+/* Nonzero means delete a process right away if it exits.  */
+static int delete_exited_processes;
+
+/* Nonzero means don't run process sentinels.  This is used
+   when exiting.  */
+int inhibit_sentinels;
+
+#ifdef subprocesses
 
 Lisp_Object Qprocessp;
 Lisp_Object Qrun, Qstop, Qsignal;
@@ -135,7 +144,7 @@ Lisp_Object Qipv6;
 Lisp_Object QCport, QCspeed, QCprocess;
 Lisp_Object QCbytesize, QCstopbits, QCparity, Qodd, Qeven;
 Lisp_Object QCflowcontrol, Qhw, Qsw, QCsummary;
-Lisp_Object QCname, QCbuffer, QChost, QCservice, QCtype;
+Lisp_Object QCbuffer, QChost, QCservice;
 Lisp_Object QClocal, QCremote, QCcoding;
 Lisp_Object QCserver, QCnowait, QCnoquery, QCstop;
 Lisp_Object QCsentinel, QClog, QCoptions, QCplist;
@@ -151,22 +160,10 @@ extern Lisp_Object QCfamily;
 /* QCfilter is defined in keyboard.c.  */
 extern Lisp_Object QCfilter;
 
-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;
-Lisp_Object Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtime, Qctime;
-
-#ifdef HAVE_SOCKETS
 #define NETCONN_P(p) (EQ (XPROCESS (p)->type, Qnetwork))
 #define NETCONN1_P(p) (EQ ((p)->type, Qnetwork))
 #define SERIALCONN_P(p) (EQ (XPROCESS (p)->type, Qserial))
 #define SERIALCONN1_P(p) (EQ ((p)->type, Qserial))
-#else
-#define NETCONN_P(p) 0
-#define NETCONN1_P(p) 0
-#define SERIALCONN_P(p) 0
-#define SERIALCONN1_P(p) 0
-#endif /* HAVE_SOCKETS */
 
 /* Define first descriptor number available for subprocesses.  */
 #define FIRST_PROC_DESC 3
@@ -178,26 +175,11 @@ Lisp_Object Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtime, Qctime;
 #define SIGCHLD SIGCLD
 #endif /* SIGCLD */
 
-#include "syssignal.h"
-
-#include "syswait.h"
-
-extern char *get_operating_system_release ();
-
-/* Serial processes require termios or Windows.  */
-#if defined (HAVE_TERMIOS) || defined (WINDOWSNT)
-#define HAVE_SERIAL
-#endif
+extern const char *get_operating_system_release (void);
 
-#ifdef HAVE_SERIAL
 /* From sysdep.c or w32.c  */
 extern int serial_open (char *port);
 extern void serial_configure (struct Lisp_Process *p, Lisp_Object contact);
-#endif
-
-#ifndef USE_CRT_DLL
-extern int errno;
-#endif
 
 #ifndef HAVE_H_ERRNO
 extern int h_errno;
@@ -220,7 +202,6 @@ int update_tick;
 #undef NON_BLOCKING_CONNECT
 #else
 #ifndef NON_BLOCKING_CONNECT
-#ifdef HAVE_SOCKETS
 #ifdef HAVE_SELECT
 #if defined (HAVE_GETPEERNAME) || defined (GNU_LINUX)
 #if defined (O_NONBLOCK) || defined (O_NDELAY)
@@ -230,7 +211,6 @@ int update_tick;
 #endif /* O_NONBLOCK || O_NDELAY */
 #endif /* HAVE_GETPEERNAME || GNU_LINUX */
 #endif /* HAVE_SELECT */
-#endif /* HAVE_SOCKETS */
 #endif /* NON_BLOCKING_CONNECT */
 #endif /* BROKEN_NON_BLOCKING_CONNECT */
 
@@ -243,13 +223,11 @@ int update_tick;
 #undef DATAGRAM_SOCKETS
 #else
 #ifndef DATAGRAM_SOCKETS
-#ifdef HAVE_SOCKETS
 #if defined (HAVE_SELECT) || defined (FIONREAD)
 #if defined (HAVE_SENDTO) && defined (HAVE_RECVFROM) && defined (EMSGSIZE)
 #define DATAGRAM_SOCKETS
 #endif /* HAVE_SENDTO && HAVE_RECVFROM && EMSGSIZE */
 #endif /* HAVE_SELECT || FIONREAD */
-#endif /* HAVE_SOCKETS */
 #endif /* DATAGRAM_SOCKETS */
 #endif /* BROKEN_DATAGRAM_SOCKETS */
 
@@ -286,14 +264,11 @@ static Lisp_Object Vprocess_adaptive_read_buffering;
 #define process_output_delay_count 0
 #endif
 
-
-#include "sysselect.h"
-
-static int keyboard_bit_set P_ ((SELECT_TYPE *));
-static void deactivate_process P_ ((Lisp_Object));
-static void status_notify P_ ((struct Lisp_Process *));
-static int read_process_output P_ ((Lisp_Object, int));
-static void create_pty P_ ((Lisp_Object));
+static int keyboard_bit_set (SELECT_TYPE *);
+static void deactivate_process (Lisp_Object);
+static void status_notify (struct Lisp_Process *);
+static int read_process_output (Lisp_Object, int);
+static void create_pty (Lisp_Object);
 
 /* If we support a window system, turn on the code to poll periodically
    to detect C-g.  It isn't actually used when doing interrupt input.  */
@@ -301,11 +276,9 @@ static void create_pty P_ ((Lisp_Object));
 #define POLL_FOR_INPUT
 #endif
 
-static Lisp_Object get_process ();
-static void exec_sentinel ();
+static Lisp_Object get_process (register Lisp_Object name);
+static void exec_sentinel (Lisp_Object proc, Lisp_Object reason);
 
-extern int timers_run;
-\f
 /* Mask of bits indicating the descriptors that we wait for input on.  */
 
 static SELECT_TYPE input_wait_mask;
@@ -333,9 +306,9 @@ static SELECT_TYPE connect_wait_mask;
 static int num_pending_connects;
 
 #define IF_NON_BLOCKING_CONNECT(s) s
-#else
+#else  /* NON_BLOCKING_CONNECT */
 #define IF_NON_BLOCKING_CONNECT(s)
-#endif
+#endif /* NON_BLOCKING_CONNECT */
 
 /* The largest descriptor currently in use for a process object.  */
 static int max_process_desc;
@@ -346,9 +319,6 @@ static int max_keyboard_desc;
 /* The largest descriptor currently in use for gpm mouse input.  */
 static int max_gpm_desc;
 
-/* Nonzero means delete a process right away if it exits.  */
-static int delete_exited_processes;
-
 /* Indexed by descriptor, gives the process (if any) for that descriptor */
 Lisp_Object chan_process[MAXDESC];
 
@@ -384,10 +354,6 @@ struct sockaddr_and_len {
 /* Maximum number of bytes to send to a pty without an eof.  */
 static int pty_max_bytes;
 
-/* Nonzero means don't run process sentinels.  This is used
-   when exiting.  */
-int inhibit_sentinels;
-
 #ifdef HAVE_PTYS
 #ifdef HAVE_PTY_H
 #include <pty.h>
@@ -403,8 +369,7 @@ static char pty_name[24];
 static Lisp_Object status_convert (int);
 
 static void
-update_status (p)
-     struct Lisp_Process *p;
+update_status (struct Lisp_Process *p)
 {
   eassert (p->raw_status_new);
   p->status = status_convert (p->raw_status);
@@ -433,11 +398,7 @@ status_convert (int w)
    and store them individually through the three pointers.  */
 
 static void
-decode_status (l, symbol, code, coredump)
-     Lisp_Object l;
-     Lisp_Object *symbol;
-     int *code;
-     int *coredump;
+decode_status (Lisp_Object l, Lisp_Object *symbol, int *code, int *coredump)
 {
   Lisp_Object tem;
 
@@ -460,8 +421,7 @@ decode_status (l, symbol, code, coredump)
 /* Return a string describing a process status list.  */
 
 static Lisp_Object
-status_message (p)
-     struct Lisp_Process *p;
+status_message (struct Lisp_Process *p)
 {
   Lisp_Object status = p->status;
   Lisp_Object symbol;
@@ -523,7 +483,7 @@ status_message (p)
    is left in the variable pty_name.  */
 
 static int
-allocate_pty ()
+allocate_pty (void)
 {
   register int c, i;
   int fd;
@@ -597,8 +557,7 @@ allocate_pty ()
 #endif /* HAVE_PTYS */
 \f
 static Lisp_Object
-make_process (name)
-     Lisp_Object name;
+make_process (Lisp_Object name)
 {
   register Lisp_Object val, tem, name1;
   register struct Lisp_Process *p;
@@ -642,8 +601,7 @@ make_process (name)
 }
 
 static void
-remove_process (proc)
-     register Lisp_Object proc;
+remove_process (register Lisp_Object proc)
 {
   register Lisp_Object pair;
 
@@ -653,52 +611,17 @@ remove_process (proc)
   deactivate_process (proc);
 }
 
-/* Setup coding systems of PROCESS.  */
-
-void
-setup_process_coding_systems (process)
-     Lisp_Object process;
-{
-  struct Lisp_Process *p = XPROCESS (process);
-  int inch = p->infd;
-  int outch = p->outfd;
-  Lisp_Object coding_system;
-
-  if (inch < 0 || outch < 0)
-    return;
-
-  if (!proc_decode_coding_system[inch])
-    proc_decode_coding_system[inch]
-      = (struct coding_system *) xmalloc (sizeof (struct coding_system));
-  coding_system = p->decode_coding_system;
-  if (! NILP (p->filter))
-    ;
-  else if (BUFFERP (p->buffer))
-    {
-      if (NILP (XBUFFER (p->buffer)->enable_multibyte_characters))
-       coding_system = raw_text_coding_system (coding_system);
-    }
-  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));
-  setup_coding_system (p->encode_coding_system,
-                      proc_encode_coding_system[outch]);
-}
 \f
 DEFUN ("processp", Fprocessp, Sprocessp, 1, 1, 0,
        doc: /* Return t if OBJECT is a process.  */)
-     (object)
-     Lisp_Object object;
+  (Lisp_Object object)
 {
   return PROCESSP (object) ? Qt : Qnil;
 }
 
 DEFUN ("get-process", Fget_process, Sget_process, 1, 1, 0,
        doc: /* Return the process named NAME, or nil if there is none.  */)
-     (name)
-     register Lisp_Object name;
+  (register Lisp_Object name)
 {
   if (PROCESSP (name))
     return name;
@@ -706,35 +629,13 @@ DEFUN ("get-process", Fget_process, Sget_process, 1, 1, 0,
   return Fcdr (Fassoc (name, Vprocess_alist));
 }
 
-DEFUN ("get-buffer-process", Fget_buffer_process, Sget_buffer_process, 1, 1, 0,
-       doc: /* Return the (or a) process associated with BUFFER.
-BUFFER may be a buffer or the name of one.  */)
-     (buffer)
-     register Lisp_Object buffer;
-{
-  register Lisp_Object buf, tail, proc;
-
-  if (NILP (buffer)) return Qnil;
-  buf = Fget_buffer (buffer);
-  if (NILP (buf)) return Qnil;
-
-  for (tail = Vprocess_alist; CONSP (tail); tail = XCDR (tail))
-    {
-      proc = Fcdr (XCAR (tail));
-      if (PROCESSP (proc) && EQ (XPROCESS (proc)->buffer, buf))
-       return proc;
-    }
-  return Qnil;
-}
-
 /* This is how commands for the user decode process arguments.  It
    accepts a process, a process name, a buffer, a buffer name, or nil.
    Buffers denote the first process in the buffer, and nil denotes the
    current buffer.  */
 
 static Lisp_Object
-get_process (name)
-     register Lisp_Object name;
+get_process (register Lisp_Object name)
 {
   register Lisp_Object proc, obj;
   if (STRINGP (name))
@@ -780,8 +681,7 @@ DEFUN ("delete-process", Fdelete_process, Sdelete_process, 1, 1, 0,
        doc: /* Delete PROCESS: kill it and forget about it immediately.
 PROCESS may be a process, a buffer, the name of a process or buffer, or
 nil, indicating the current buffer's process.  */)
-     (process)
-     register Lisp_Object process;
+  (register Lisp_Object process)
 {
   register struct Lisp_Process *p;
 
@@ -848,8 +748,7 @@ failed -- when a non-blocking connection has failed.
 nil -- if arg is a process name and no such process exists.
 PROCESS may be a process, a buffer, the name of a process, or
 nil, indicating the current buffer's process.  */)
-     (process)
-     register Lisp_Object process;
+  (register Lisp_Object process)
 {
   register struct Lisp_Process *p;
   register Lisp_Object status;
@@ -884,8 +783,7 @@ DEFUN ("process-exit-status", Fprocess_exit_status, Sprocess_exit_status,
        1, 1, 0,
        doc: /* Return the exit status of PROCESS or the signal number that killed it.
 If PROCESS has not yet exited or died, return 0.  */)
-     (process)
-     register Lisp_Object process;
+  (register Lisp_Object process)
 {
   CHECK_PROCESS (process);
   if (XPROCESS (process)->raw_status_new)
@@ -899,8 +797,7 @@ DEFUN ("process-id", Fprocess_id, Sprocess_id, 1, 1, 0,
        doc: /* Return the process id of PROCESS.
 This is the pid of the external process which PROCESS uses or talks to.
 For a network connection, this value is nil.  */)
-     (process)
-     register Lisp_Object process;
+  (register Lisp_Object process)
 {
   /* Assignment to EMACS_INT stops GCC whining about limited range of
      data type.  */
@@ -915,8 +812,7 @@ DEFUN ("process-name", Fprocess_name, Sprocess_name, 1, 1, 0,
        doc: /* Return the name of PROCESS, as a string.
 This is the name of the program invoked in PROCESS,
 possibly modified to make it unique among process names.  */)
-     (process)
-     register Lisp_Object process;
+  (register Lisp_Object process)
 {
   CHECK_PROCESS (process);
   return XPROCESS (process)->name;
@@ -928,8 +824,7 @@ This is a list of strings, the first string being the program executed
 and the rest of the strings being the arguments given to it.
 For a network or serial process, this is nil (process is running) or t
 \(process is stopped).  */)
-     (process)
-     register Lisp_Object process;
+  (register Lisp_Object process)
 {
   CHECK_PROCESS (process);
   return XPROCESS (process)->command;
@@ -939,8 +834,7 @@ DEFUN ("process-tty-name", Fprocess_tty_name, Sprocess_tty_name, 1, 1, 0,
        doc: /* Return the name of the terminal PROCESS uses, or nil if none.
 This is the terminal that the process itself reads and writes on,
 not the name of the pty that Emacs uses to talk with that terminal.  */)
-     (process)
-     register Lisp_Object process;
+  (register Lisp_Object process)
 {
   CHECK_PROCESS (process);
   return XPROCESS (process)->tty_name;
@@ -949,8 +843,7 @@ not the name of the pty that Emacs uses to talk with that terminal.  */)
 DEFUN ("set-process-buffer", Fset_process_buffer, Sset_process_buffer,
        2, 2, 0,
        doc: /* Set buffer associated with PROCESS to BUFFER (a buffer, or nil).  */)
-     (process, buffer)
-     register Lisp_Object process, buffer;
+  (register Lisp_Object process, Lisp_Object buffer)
 {
   struct Lisp_Process *p;
 
@@ -969,8 +862,7 @@ DEFUN ("process-buffer", Fprocess_buffer, Sprocess_buffer,
        1, 1, 0,
        doc: /* Return the buffer PROCESS is associated with.
 Output from PROCESS is inserted in this buffer unless PROCESS has a filter.  */)
-     (process)
-     register Lisp_Object process;
+  (register Lisp_Object process)
 {
   CHECK_PROCESS (process);
   return XPROCESS (process)->buffer;
@@ -979,8 +871,7 @@ Output from PROCESS is inserted in this buffer unless PROCESS has a filter.  */)
 DEFUN ("process-mark", Fprocess_mark, Sprocess_mark,
        1, 1, 0,
        doc: /* Return the marker for the end of the last output from PROCESS.  */)
-     (process)
-     register Lisp_Object process;
+  (register Lisp_Object process)
 {
   CHECK_PROCESS (process);
   return XPROCESS (process)->mark;
@@ -1002,8 +893,7 @@ The string argument is normally a multibyte string, except:
 - if `default-enable-multibyte-characters' is nil, it is a unibyte
   string (the result of converting the decoded input multibyte
   string to unibyte with `string-make-unibyte').  */)
-     (process, filter)
-     register Lisp_Object process, filter;
+  (register Lisp_Object process, Lisp_Object filter)
 {
   struct Lisp_Process *p;
 
@@ -1045,8 +935,7 @@ DEFUN ("process-filter", Fprocess_filter, Sprocess_filter,
        1, 1, 0,
        doc: /* Returns the filter function of PROCESS; nil if none.
 See `set-process-filter' for more info on filter functions.  */)
-     (process)
-     register Lisp_Object process;
+  (register Lisp_Object process)
 {
   CHECK_PROCESS (process);
   return XPROCESS (process)->filter;
@@ -1057,8 +946,7 @@ DEFUN ("set-process-sentinel", Fset_process_sentinel, Sset_process_sentinel,
        doc: /* Give PROCESS the sentinel SENTINEL; nil for none.
 The sentinel is called as a function when the process changes state.
 It gets two arguments: the process, and a string describing the change.  */)
-     (process, sentinel)
-     register Lisp_Object process, sentinel;
+  (register Lisp_Object process, Lisp_Object sentinel)
 {
   struct Lisp_Process *p;
 
@@ -1075,8 +963,7 @@ DEFUN ("process-sentinel", Fprocess_sentinel, Sprocess_sentinel,
        1, 1, 0,
        doc: /* Return the sentinel of PROCESS; nil if none.
 See `set-process-sentinel' for more info on sentinels.  */)
-     (process)
-     register Lisp_Object process;
+  (register Lisp_Object process)
 {
   CHECK_PROCESS (process);
   return XPROCESS (process)->sentinel;
@@ -1085,8 +972,7 @@ See `set-process-sentinel' for more info on sentinels.  */)
 DEFUN ("set-process-window-size", Fset_process_window_size,
        Sset_process_window_size, 3, 3, 0,
        doc: /* Tell PROCESS that it has logical window size HEIGHT and WIDTH.  */)
-     (process, height, width)
-     register Lisp_Object process, height, width;
+  (register Lisp_Object process, Lisp_Object height, Lisp_Object width)
 {
   CHECK_PROCESS (process);
   CHECK_NATNUM (height);
@@ -1117,36 +1003,20 @@ is more appropriate for saving the process buffer.
 Binding the variable `inherit-process-coding-system' to non-nil before
 starting the process is an alternative way of setting the inherit flag
 for the process which will run.  */)
-     (process, flag)
-     register Lisp_Object process, flag;
+  (register Lisp_Object process, Lisp_Object flag)
 {
   CHECK_PROCESS (process);
   XPROCESS (process)->inherit_coding_system_flag = !NILP (flag);
   return flag;
 }
 
-DEFUN ("process-inherit-coding-system-flag",
-       Fprocess_inherit_coding_system_flag, Sprocess_inherit_coding_system_flag,
-       1, 1, 0,
-       doc: /* Return the value of inherit-coding-system flag for PROCESS.
-If this flag is t, `buffer-file-coding-system' of the buffer
-associated with PROCESS will inherit the coding system used to decode
-the process output.  */)
-     (process)
-     register Lisp_Object process;
-{
-  CHECK_PROCESS (process);
-  return XPROCESS (process)->inherit_coding_system_flag ? Qt : Qnil;
-}
-
 DEFUN ("set-process-query-on-exit-flag",
        Fset_process_query_on_exit_flag, Sset_process_query_on_exit_flag,
        2, 2, 0,
        doc: /* Specify if query is needed for PROCESS when Emacs is exited.
 If the second argument FLAG is non-nil, Emacs will query the user before
 exiting or killing a buffer if PROCESS is running.  */)
-     (process, flag)
-     register Lisp_Object process, flag;
+  (register Lisp_Object process, Lisp_Object flag)
 {
   CHECK_PROCESS (process);
   XPROCESS (process)->kill_without_query = NILP (flag);
@@ -1157,15 +1027,14 @@ DEFUN ("process-query-on-exit-flag",
        Fprocess_query_on_exit_flag, Sprocess_query_on_exit_flag,
        1, 1, 0,
        doc: /* Return the current value of query-on-exit flag for PROCESS.  */)
-     (process)
-     register Lisp_Object process;
+  (register Lisp_Object process)
 {
   CHECK_PROCESS (process);
   return (XPROCESS (process)->kill_without_query ? Qnil : Qt);
 }
 
 #ifdef DATAGRAM_SOCKETS
-Lisp_Object Fprocess_datagram_address ();
+Lisp_Object Fprocess_datagram_address (Lisp_Object process);
 #endif
 
 DEFUN ("process-contact", Fprocess_contact, Sprocess_contact,
@@ -1178,8 +1047,7 @@ connection.  If KEY is t, the complete contact information for the
 connection is returned, else the specific value for the keyword KEY is
 returned.  See `make-network-process' or `make-serial-process' for a
 list of keywords.  */)
-     (process, key)
-     register Lisp_Object process, key;
+  (register Lisp_Object process, Lisp_Object key)
 {
   Lisp_Object contact;
 
@@ -1207,8 +1075,7 @@ list of keywords.  */)
 DEFUN ("process-plist", Fprocess_plist, Sprocess_plist,
        1, 1, 0,
        doc: /* Return the plist of PROCESS.  */)
-     (process)
-     register Lisp_Object process;
+  (register Lisp_Object process)
 {
   CHECK_PROCESS (process);
   return XPROCESS (process)->plist;
@@ -1217,8 +1084,7 @@ DEFUN ("process-plist", Fprocess_plist, Sprocess_plist,
 DEFUN ("set-process-plist", Fset_process_plist, Sset_process_plist,
        2, 2, 0,
        doc: /* Replace the plist of PROCESS with PLIST.  Returns PLIST.  */)
-     (process, plist)
-     register Lisp_Object process, plist;
+  (register Lisp_Object process, Lisp_Object plist)
 {
   CHECK_PROCESS (process);
   CHECK_LIST (plist);
@@ -1233,8 +1099,7 @@ DEFUN ("process-connection", Fprocess_connection, Sprocess_connection, 1, 1, 0,
        doc: /* Return the connection type of PROCESS.
 The value is nil for a pipe, t or `pty' for a pty, or `stream' for
 a socket connection.  */)
-     (process)
-     Lisp_Object process;
+  (Lisp_Object process)
 {
   return XPROCESS (process)->type;
 }
@@ -1245,15 +1110,13 @@ DEFUN ("process-type", Fprocess_type, Sprocess_type, 1, 1, 0,
 The value is either the symbol `real', `network', or `serial'.
 PROCESS may be a process, a buffer, the name of a process or buffer, or
 nil, indicating the current buffer's process.  */)
-     (process)
-     Lisp_Object process;
+  (Lisp_Object process)
 {
   Lisp_Object proc;
   proc = get_process (process);
   return XPROCESS (proc)->type;
 }
 
-#ifdef HAVE_SOCKETS
 DEFUN ("format-network-address", Fformat_network_address, Sformat_network_address,
        1, 2, 0,
        doc: /* Convert network ADDRESS from internal format to a string.
@@ -1262,8 +1125,7 @@ An 8 or 9 element vector represents an IPv6 address (with port number).
 If optional second argument OMIT-PORT is non-nil, don't include a port
 number in the string, even when present in ADDRESS.
 Returns nil if format of ADDRESS is invalid.  */)
-     (address, omit_port)
-     Lisp_Object address, omit_port;
+  (Lisp_Object address, Lisp_Object omit_port)
 {
   if (NILP (address))
     return Qnil;
@@ -1328,11 +1190,9 @@ Returns nil if format of ADDRESS is invalid.  */)
 
   return Qnil;
 }
-#endif
 \f
 static Lisp_Object
-list_processes_1 (query_only)
-     Lisp_Object query_only;
+list_processes_1 (Lisp_Object query_only)
 {
   register Lisp_Object tail, tem;
   Lisp_Object proc, minspace, tem1;
@@ -1566,8 +1426,7 @@ If optional argument QUERY-ONLY is non-nil, only processes with
 the query-on-exit flag set will be listed.
 Any process listed as exited or signaled is actually eliminated
 after the listing is made.  */)
-     (query_only)
-     Lisp_Object query_only;
+  (Lisp_Object query_only)
 {
   internal_with_output_to_temp_buffer ("*Process List*",
                                       list_processes_1, query_only);
@@ -1576,14 +1435,14 @@ after the listing is made.  */)
 
 DEFUN ("process-list", Fprocess_list, Sprocess_list, 0, 0, 0,
        doc: /* Return a list of all processes.  */)
-     ()
+  (void)
 {
   return Fmapcar (Qcdr, Vprocess_alist);
 }
 \f
 /* Starting asynchronous inferior processes.  */
 
-static Lisp_Object start_process_unwind ();
+static Lisp_Object start_process_unwind (Lisp_Object proc);
 
 DEFUN ("start-process", Fstart_process, Sstart_process, 3, MANY, 0,
        doc: /* Start a program in a subprocess.  Return the process object for it.
@@ -1604,9 +1463,7 @@ the command through a shell and redirect one of them using the shell
 syntax.
 
 usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS)  */)
-     (nargs, args)
-     int nargs;
-     register Lisp_Object *args;
+  (int nargs, register Lisp_Object *args)
 {
   Lisp_Object buffer, name, program, proc, current_dir, tem;
   register unsigned char **new_argv;
@@ -1818,8 +1675,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS)  */)
    an error and the process wasn't started successfully, so we should
    remove it from the process list.  */
 static Lisp_Object
-start_process_unwind (proc)
-     Lisp_Object proc;
+start_process_unwind (Lisp_Object proc)
 {
   if (!PROCESSP (proc))
     abort ();
@@ -1832,37 +1688,14 @@ start_process_unwind (proc)
 }
 
 static void
-create_process_1 (timer)
-     struct atimer *timer;
+create_process_1 (struct atimer *timer)
 {
   /* Nothing to do.  */
 }
 
 
-#if 0  /* This doesn't work; see the note before sigchld_handler.  */
-#ifdef USG
-#ifdef SIGCHLD
-/* Mimic blocking of signals on system V, which doesn't really have it.  */
-
-/* Nonzero means we got a SIGCHLD when it was supposed to be blocked.  */
-int sigchld_deferred;
-
-SIGTYPE
-create_process_sigchld ()
-{
-  signal (SIGCHLD, create_process_sigchld);
-
-  sigchld_deferred = 1;
-}
-#endif
-#endif
-#endif
-
 void
-create_process (process, new_argv, current_dir)
-     Lisp_Object process;
-     char **new_argv;
-     Lisp_Object current_dir;
+create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
 {
   int inchannel, outchannel;
   pid_t pid;
@@ -1870,7 +1703,6 @@ create_process (process, new_argv, current_dir)
 #if !defined (WINDOWSNT) && defined (FD_CLOEXEC)
   int wait_child_setup[2];
 #endif
-#ifdef POSIX_SIGNALS
   sigset_t procmask;
   sigset_t blocked;
   struct sigaction sigint_action;
@@ -1878,13 +1710,6 @@ create_process (process, new_argv, current_dir)
 #ifdef AIX
   struct sigaction sighup_action;
 #endif
-#else /* !POSIX_SIGNALS */
-#if 0
-#ifdef SIGCHLD
-  SIGTYPE (*sigchld)();
-#endif
-#endif /* 0 */
-#endif /* !POSIX_SIGNALS */
   /* Use volatile to protect variables from being clobbered by longjmp.  */
   volatile int forkin, forkout;
   volatile int pty_flag = 0;
@@ -1989,7 +1814,6 @@ create_process (process, new_argv, current_dir)
 
   /* Delay interrupts until we have a chance to store
      the new fork's pid in its process structure */
-#ifdef POSIX_SIGNALS
   sigemptyset (&blocked);
 #ifdef SIGCHLD
   sigaddset (&blocked, SIGCHLD);
@@ -2006,18 +1830,6 @@ create_process (process, new_argv, current_dir)
 #endif
 #endif /* HAVE_WORKING_VFORK */
   sigprocmask (SIG_BLOCK, &blocked, &procmask);
-#else /* !POSIX_SIGNALS */
-#ifdef SIGCHLD
-#if defined (BSD_SYSTEM) || defined (HPUX)
-  sigsetmask (sigmask (SIGCHLD));
-#else /* ordinary USG */
-#if 0
-  sigchld_deferred = 0;
-  sigchld = signal (SIGCHLD, create_process_sigchld);
-#endif
-#endif /* ordinary USG */
-#endif /* SIGCHLD */
-#endif /* !POSIX_SIGNALS */
 
   FD_SET (inchannel, &input_wait_mask);
   FD_SET (inchannel, &non_keyboard_wait_mask);
@@ -2063,7 +1875,7 @@ create_process (process, new_argv, current_dir)
           process_set_signal to fail on SGI when using a pipe.  */
        setsid ();
        /* Make the pty's terminal the controlling terminal.  */
-       if (pty_flag)
+       if (pty_flag && xforkin >= 0)
          {
 #ifdef TIOCSCTTY
            /* We ignore the return value
@@ -2079,7 +1891,7 @@ create_process (process, new_argv, current_dir)
        setpgrp ();
 #endif /* USG */
 #endif /* not HAVE_SETSID */
-#if defined (HAVE_TERMIOS) && defined (LDISC1)
+#if defined (LDISC1)
        if (pty_flag && xforkin >= 0)
          {
            struct termios t;
@@ -2106,8 +1918,11 @@ create_process (process, new_argv, current_dir)
            /* I wonder: would just ioctl (0, TIOCNOTTY, 0) work here?
               I can't test it since I don't have 4.3.  */
            int j = emacs_open ("/dev/tty", O_RDWR, 0);
-           ioctl (j, TIOCNOTTY, 0);
-           emacs_close (j);
+           if (j >= 0)
+             {
+               ioctl (j, TIOCNOTTY, 0);
+               emacs_close (j);
+             }
 #ifndef USG
            /* In order to get a controlling terminal on some versions
               of BSD, it is necessary to put the process in pgrp 0
@@ -2168,19 +1983,7 @@ create_process (process, new_argv, current_dir)
        signal (SIGQUIT, SIG_DFL);
 
        /* Stop blocking signals in the child.  */
-#ifdef POSIX_SIGNALS
        sigprocmask (SIG_SETMASK, &procmask, 0);
-#else /* !POSIX_SIGNALS */
-#ifdef SIGCHLD
-#if defined (BSD_SYSTEM) || defined (HPUX)
-       sigsetmask (SIGEMPTYMASK);
-#else /* ordinary USG */
-#if 0
-       signal (SIGCHLD, sigchld);
-#endif
-#endif /* ordinary USG */
-#endif /* SIGCHLD */
-#endif /* !POSIX_SIGNALS */
 
        if (pty_flag)
          child_setup_tty (xforkout);
@@ -2262,7 +2065,6 @@ create_process (process, new_argv, current_dir)
 
   /* Restore the signal state whether vfork succeeded or not.
      (We will signal an error, below, if it failed.)  */
-#ifdef POSIX_SIGNALS
 #ifdef HAVE_WORKING_VFORK
   /* Restore the parent's signal handlers.  */
   sigaction (SIGINT, &sigint_action, 0);
@@ -2273,21 +2075,6 @@ create_process (process, new_argv, current_dir)
 #endif /* HAVE_WORKING_VFORK */
   /* Stop blocking signals in the parent.  */
   sigprocmask (SIG_SETMASK, &procmask, 0);
-#else /* !POSIX_SIGNALS */
-#ifdef SIGCHLD
-#if defined (BSD_SYSTEM) || defined (HPUX)
-  sigsetmask (SIGEMPTYMASK);
-#else /* ordinary USG */
-#if 0
-  signal (SIGCHLD, sigchld);
-  /* Now really handle any of these signals
-     that came in during this function.  */
-  if (sigchld_deferred)
-    kill (getpid (), SIGCHLD);
-#endif
-#endif /* ordinary USG */
-#endif /* SIGCHLD */
-#endif /* !POSIX_SIGNALS */
 
   /* Now generate the error if vfork failed.  */
   if (pid < 0)
@@ -2295,8 +2082,7 @@ create_process (process, new_argv, current_dir)
 }
 
 void
-create_pty (process)
-     Lisp_Object process;
+create_pty (Lisp_Object process)
 {
   int inchannel, outchannel;
 
@@ -2377,15 +2163,11 @@ create_pty (process)
 }
 
 \f
-#ifdef HAVE_SOCKETS
-
 /* Convert an internal struct sockaddr to a lisp object (vector or string).
    The address family of sa is not included in the result.  */
 
 static Lisp_Object
-conv_sockaddr_to_lisp (sa, len)
-     struct sockaddr *sa;
-     int len;
+conv_sockaddr_to_lisp (struct sockaddr *sa, int len)
 {
   Lisp_Object address;
   int i;
@@ -2395,7 +2177,7 @@ conv_sockaddr_to_lisp (sa, len)
   /* Workaround for a bug in getsockname on BSD: Names bound to
      sockets in the UNIX domain are inaccessible; getsockname returns
      a zero length name.  */
-  if (len < OFFSETOF (struct sockaddr, sa_family) + sizeof (sa->sa_family))
+  if (len < offsetof (struct sockaddr, sa_family) + sizeof (sa->sa_family))
     return empty_unibyte_string;
 
   switch (sa->sa_family)
@@ -2435,7 +2217,7 @@ conv_sockaddr_to_lisp (sa, len)
       }
 #endif
     default:
-      len -= OFFSETOF (struct sockaddr, sa_family) + sizeof (sa->sa_family);
+      len -= offsetof (struct sockaddr, sa_family) + sizeof (sa->sa_family);
       address = Fcons (make_number (sa->sa_family),
                       Fmake_vector (make_number (len), Qnil));
       p = XVECTOR (XCDR (address));
@@ -2454,9 +2236,7 @@ conv_sockaddr_to_lisp (sa, len)
 /* Get family and required size for sockaddr structure to hold ADDRESS.  */
 
 static int
-get_lisp_to_sockaddr_size (address, familyp)
-     Lisp_Object address;
-     int *familyp;
+get_lisp_to_sockaddr_size (Lisp_Object address, int *familyp)
 {
   register struct Lisp_Vector *p;
 
@@ -2501,17 +2281,13 @@ get_lisp_to_sockaddr_size (address, familyp)
    we return after zeroing *SA.  */
 
 static void
-conv_lisp_to_sockaddr (family, address, sa, len)
-     int family;
-     Lisp_Object address;
-     struct sockaddr *sa;
-     int len;
+conv_lisp_to_sockaddr (int family, Lisp_Object address, struct sockaddr *sa, int len)
 {
   register struct Lisp_Vector *p;
   register unsigned char *cp = NULL;
   register int i;
 
-  bzero (sa, len);
+  memset (sa, 0, len);
 
   if (VECTORP (address))
     {
@@ -2575,8 +2351,7 @@ conv_lisp_to_sockaddr (family, address, sa, len)
 DEFUN ("process-datagram-address", Fprocess_datagram_address, Sprocess_datagram_address,
        1, 1, 0,
        doc: /* Get the current datagram address associated with PROCESS.  */)
-       (process)
-       Lisp_Object process;
+  (Lisp_Object process)
 {
   int channel;
 
@@ -2594,8 +2369,7 @@ DEFUN ("set-process-datagram-address", Fset_process_datagram_address, Sset_proce
        2, 2, 0,
        doc: /* Set the datagram address for PROCESS to ADDRESS.
 Returns nil upon error setting address, ADDRESS otherwise.  */)
-       (process, address)
-       Lisp_Object process, address;
+  (Lisp_Object process, Lisp_Object address)
 {
   int channel;
   int family, len;
@@ -2619,7 +2393,7 @@ Returns nil upon error setting address, ADDRESS otherwise.  */)
 static const struct socket_options {
   /* The name of this option.  Should be lowercase version of option
      name without SO_ prefix. */
-  char *name;
+  const char *name;
   /* Option level SOL_... */
   int optlevel;
   /* Option number SO_... */
@@ -2662,9 +2436,7 @@ static const struct socket_options {
 */
 
 static int
-set_socket_option (s, opt, val)
-     int s;
-     Lisp_Object opt, val;
+set_socket_option (int s, Lisp_Object opt, Lisp_Object val)
 {
   char *name;
   const struct socket_options *sopt;
@@ -2708,12 +2480,12 @@ set_socket_option (s, opt, val)
        /* This is broken, at least in the Linux 2.4 kernel.
           To unbind, the arg must be a zero integer, not the empty string.
           This should work on all systems.   KFS. 2003-09-23.  */
-       bzero (devname, sizeof devname);
+       memset (devname, 0, sizeof devname);
        if (STRINGP (val))
          {
            char *arg = (char *) SDATA (val);
            int len = min (strlen (arg), IFNAMSIZ);
-           bcopy (arg, devname, len);
+           memcpy (devname, arg, len);
          }
        else if (!NILP (val))
          error ("Bad option value for %s", name);
@@ -2758,9 +2530,7 @@ DEFUN ("set-network-process-option",
 See `make-network-process' for a list of options and values.
 If optional fourth arg NO-ERROR is non-nil, don't signal an error if
 OPTION is not a supported option, return nil instead; otherwise return t.  */)
-     (process, option, value, no_error)
-     Lisp_Object process, option, value;
-     Lisp_Object no_error;
+  (Lisp_Object process, Lisp_Object option, Lisp_Object value, Lisp_Object no_error)
 {
   int s;
   struct Lisp_Process *p;
@@ -2787,7 +2557,6 @@ OPTION is not a supported option, return nil instead; otherwise return t.  */)
 }
 
 \f
-#ifdef HAVE_SERIAL
 DEFUN ("serial-process-configure",
        Fserial_process_configure,
        Sserial_process_configure,
@@ -2847,9 +2616,7 @@ Examples:
 \(serial-process-configure :port "\\\\.\\COM13" :bytesize 7)
 
 usage: (serial-process-configure &rest ARGS)  */)
-     (nargs, args)
-     int nargs;
-     Lisp_Object *args;
+  (int nargs, Lisp_Object *args)
 {
   struct Lisp_Process *p;
   Lisp_Object contact = Qnil;
@@ -2966,9 +2733,7 @@ Examples:
 \(make-serial-process :port "/dev/tty.BlueConsole-SPP-1" :speed nil)
 
 usage:  (make-serial-process &rest ARGS)  */)
-     (nargs, args)
-     int nargs;
-     Lisp_Object *args;
+  (int nargs, Lisp_Object *args)
 {
   int fd = -1;
   Lisp_Object proc, contact, port;
@@ -3080,14 +2845,13 @@ usage:  (make-serial-process &rest ARGS)  */)
   p->inherit_coding_system_flag
     = !(!NILP (tem) || NILP (buffer) || !inherit_process_coding_system);
 
-  Fserial_process_configure(nargs, args);
+  Fserial_process_configure (nargs, args);
 
   specpdl_ptr = specpdl + specpdl_count;
 
   UNGCPRO;
   return proc;
 }
-#endif /* HAVE_SERIAL  */
 
 /* Create a network stream/datagram client/server process.  Treated
    exactly like a normal process when reading and writing.  Primary
@@ -3247,9 +3011,7 @@ The original argument list, modified with the actual connection
 information, is available via the `process-contact' function.
 
 usage: (make-network-process &rest ARGS)  */)
-     (nargs, args)
-     int nargs;
-     Lisp_Object *args;
+  (int nargs, Lisp_Object *args)
 {
   Lisp_Object proc;
   Lisp_Object contact;
@@ -3257,7 +3019,8 @@ usage: (make-network-process &rest ARGS)  */)
 #ifdef HAVE_GETADDRINFO
   struct addrinfo ai, *res, *lres;
   struct addrinfo hints;
-  char *portstring, portbuf[128];
+  const char *portstring;
+  char portbuf[128];
 #else /* HAVE_GETADDRINFO */
   struct _emacs_addrinfo
   {
@@ -3402,13 +3165,27 @@ usage: (make-network-process &rest ARGS)  */)
   /* :service SERVICE -- string, integer (port number), or t (random port).  */
   service = Fplist_get (contact, QCservice);
 
+  /* :host HOST -- hostname, ip address, or 'local for localhost.  */
+  host = Fplist_get (contact, QChost);
+  if (!NILP (host))
+    {
+      if (EQ (host, Qlocal))
+       host = build_string ("localhost");
+      CHECK_STRING (host);
+    }
+
 #ifdef HAVE_LOCAL_SOCKETS
   if (family == AF_LOCAL)
     {
-      /* Host is not used.  */
-      host = Qnil;
+      if (!NILP (host))
+       {
+         message (":family local ignores the :host \"%s\" property",
+                  SDATA (host));
+         contact = Fplist_put (contact, QChost, Qnil);
+         host = Qnil;
+       }
       CHECK_STRING (service);
-      bzero (&address_un, sizeof address_un);
+      memset (&address_un, 0, sizeof address_un);
       address_un.sun_family = AF_LOCAL;
       strncpy (address_un.sun_path, SDATA (service), sizeof address_un.sun_path);
       ai.ai_addr = (struct sockaddr *) &address_un;
@@ -3417,15 +3194,6 @@ usage: (make-network-process &rest ARGS)  */)
     }
 #endif
 
-  /* :host HOST -- hostname, ip address, or 'local for localhost.  */
-  host = Fplist_get (contact, QChost);
-  if (!NILP (host))
-    {
-      if (EQ (host, Qlocal))
-       host = build_string ("localhost");
-      CHECK_STRING (host);
-    }
-
   /* Slow down polling to every ten seconds.
      Some kernels have a bug which causes retrying connect to fail
      after a connect.  Polling can interfere with gethostbyname too.  */
@@ -3473,7 +3241,7 @@ usage: (make-network-process &rest ARGS)  */)
       ret = getaddrinfo (SDATA (host), portstring, &hints, &res);
       if (ret)
 #ifdef HAVE_GAI_STRERROR
-       error ("%s/%s %s", SDATA (host), portstring, gai_strerror(ret));
+       error ("%s/%s %s", SDATA (host), portstring, gai_strerror (ret));
 #else
        error ("%s/%s getaddrinfo error %d", SDATA (host), portstring, ret);
 #endif
@@ -3501,7 +3269,7 @@ usage: (make-network-process &rest ARGS)  */)
       port = svc_info->s_port;
     }
 
-  bzero (&address_in, sizeof address_in);
+  memset (&address_in, 0, sizeof address_in);
   address_in.sin_family = family;
   address_in.sin_addr.s_addr = INADDR_ANY;
   address_in.sin_port = port;
@@ -3525,8 +3293,8 @@ usage: (make-network-process &rest ARGS)  */)
 
       if (host_info_ptr)
        {
-         bcopy (host_info_ptr->h_addr, (char *) &address_in.sin_addr,
-                host_info_ptr->h_length);
+         memcpy (&address_in.sin_addr, host_info_ptr->h_addr,
+                 host_info_ptr->h_length);
          family = host_info_ptr->h_addrtype;
          address_in.sin_family = family;
        }
@@ -3538,8 +3306,8 @@ usage: (make-network-process &rest ARGS)  */)
          if (numeric_addr == -1)
            error ("Unknown host \"%s\"", SDATA (host));
 
-         bcopy ((char *)&numeric_addr, (char *) &address_in.sin_addr,
-                sizeof (address_in.sin_addr));
+         memcpy (&address_in.sin_addr, &numeric_addr,
+                 sizeof (address_in.sin_addr));
        }
 
     }
@@ -3642,23 +3410,9 @@ usage: (make-network-process &rest ARGS)  */)
       immediate_quit = 1;
       QUIT;
 
-      /* This turns off all alarm-based interrupts; the
-        bind_polling_period call above doesn't always turn all the
-        short-interval ones off, especially if interrupt_input is
-        set.
-
-        It'd be nice to be able to control the connect timeout
-        though.  Would non-blocking connect calls be portable?
-
-        This used to be conditioned by HAVE_GETADDRINFO.  Why?  */
-
-      turn_on_atimers (0);
-
       ret = connect (s, lres->ai_addr, lres->ai_addrlen);
       xerrno = errno;
 
-      turn_on_atimers (1);
-
       if (ret == 0 || xerrno == EISCONN)
        {
          /* The unwind-protect will be discarded afterwards.
@@ -3678,6 +3432,40 @@ usage: (make-network-process &rest ARGS)  */)
 #endif
 #endif
 
+#ifndef WINDOWSNT
+      if (xerrno == EINTR)
+       {
+         /* Unlike most other syscalls connect() cannot be called
+            again.  (That would return EALREADY.)  The proper way to
+            wait for completion is select(). */
+         int sc, len;
+         SELECT_TYPE fdset;
+       retry_select:
+         FD_ZERO (&fdset);
+         FD_SET (s, &fdset);
+         QUIT;
+         sc = select (s + 1, (SELECT_TYPE *)0, &fdset, (SELECT_TYPE *)0,
+                      (EMACS_TIME *)0);
+         if (sc == -1)
+           {
+             if (errno == EINTR)
+               goto retry_select;
+             else
+               report_file_error ("select failed", Qnil);
+           }
+         eassert (sc > 0);
+
+         len = sizeof xerrno;
+         eassert (FD_ISSET (s, &fdset));
+         if (getsockopt (s, SOL_SOCKET, SO_ERROR, &xerrno, &len) == -1)
+           report_file_error ("getsockopt failed", Qnil);
+         if (xerrno)
+           errno = xerrno, report_file_error ("error during connect", Qnil);
+         else
+           break;
+       }
+#endif /* !WINDOWSNT */
+
       immediate_quit = 0;
 
       /* Discard the unwind protect closing S.  */
@@ -3685,8 +3473,10 @@ usage: (make-network-process &rest ARGS)  */)
       emacs_close (s);
       s = -1;
 
+#ifdef WINDOWSNT
       if (xerrno == EINTR)
        goto retry_connect;
+#endif
     }
 
   if (s >= 0)
@@ -3701,7 +3491,7 @@ usage: (make-network-process &rest ARGS)  */)
          if (is_server)
            {
              Lisp_Object remote;
-             bzero (datagram_address[s].sa, lres->ai_addrlen);
+             memset (datagram_address[s].sa, 0, lres->ai_addrlen);
              if (remote = Fplist_get (contact, QCremote), !NILP (remote))
                {
                  int rfamily, rlen;
@@ -3712,7 +3502,7 @@ usage: (make-network-process &rest ARGS)  */)
                }
            }
          else
-           bcopy (lres->ai_addr, datagram_address[s].sa, lres->ai_addrlen);
+           memcpy (datagram_address[s].sa, lres->ai_addr, lres->ai_addrlen);
        }
 #endif
       contact = Fplist_put (contact, QCaddress,
@@ -3724,7 +3514,7 @@ usage: (make-network-process &rest ARGS)  */)
          int len1 = sizeof (sa1);
          if (getsockname (s, (struct sockaddr *)&sa1, &len1) == 0)
            contact = Fplist_put (contact, QClocal,
-                                 conv_sockaddr_to_lisp (&sa1, len1));
+                                 conv_sockaddr_to_lisp ((struct sockaddr *)&sa1, len1));
        }
 #endif
     }
@@ -3925,10 +3715,9 @@ usage: (make-network-process &rest ARGS)  */)
   UNGCPRO;
   return proc;
 }
-#endif /* HAVE_SOCKETS */
 
 \f
-#if defined(HAVE_SOCKETS) && defined(HAVE_NET_IF_H) && defined(HAVE_SYS_IOCTL_H)
+#if defined(HAVE_NET_IF_H) && defined(HAVE_SYS_IOCTL_H)
 
 #ifdef SIOCGIFCONF
 DEFUN ("network-interface-list", Fnetwork_interface_list, Snetwork_interface_list, 0, 0, 0,
@@ -3936,7 +3725,7 @@ DEFUN ("network-interface-list", Fnetwork_interface_list, Snetwork_interface_lis
 Each element is a cons, the car of which is a string containing the
 interface name, and the cdr is the network address in internal
 format; see the description of ADDRESS in `make-network-process'.  */)
-     ()
+  (void)
 {
   struct ifconf ifconf;
   struct ifreq *ifreqs = NULL;
@@ -3950,7 +3739,7 @@ format; see the description of ADDRESS in `make-network-process'.  */)
 
  again:
   ifaces += 25;
-  buf_size = ifaces * sizeof(ifreqs[0]);
+  buf_size = ifaces * sizeof (ifreqs[0]);
   ifreqs = (struct ifreq *)xrealloc(ifreqs, buf_size);
   if (!ifreqs)
     {
@@ -3979,7 +3768,7 @@ format; see the description of ADDRESS in `make-network-process'.  */)
       char namebuf[sizeof (ifq->ifr_name) + 1];
       if (ifq->ifr_addr.sa_family != AF_INET)
        continue;
-      bcopy (ifq->ifr_name, namebuf, sizeof (ifq->ifr_name));
+      memcpy (namebuf, ifq->ifr_name, sizeof (ifq->ifr_name));
       namebuf[sizeof (ifq->ifr_name)] = 0;
       res = Fcons (Fcons (build_string (namebuf),
                          conv_sockaddr_to_lisp (&ifq->ifr_addr,
@@ -4071,8 +3860,7 @@ The return value is a list (ADDR BCAST NETMASK HWADDR FLAGS),
 where ADDR is the layer 3 address, BCAST is the layer 3 broadcast address,
 NETMASK is the layer 3 network mask, HWADDR is the layer 2 addres, and
 FLAGS is the current flags of the interface.  */)
-     (ifname)
-     Lisp_Object ifname;
+  (Lisp_Object ifname)
 {
   struct ifreq rq;
   Lisp_Object res = Qnil;
@@ -4082,7 +3870,7 @@ FLAGS is the current flags of the interface.  */)
 
   CHECK_STRING (ifname);
 
-  bzero (rq.ifr_name, sizeof rq.ifr_name);
+  memset (rq.ifr_name, 0, sizeof rq.ifr_name);
   strncpy (rq.ifr_name, SDATA (ifname), sizeof (rq.ifr_name));
 
   s = socket (AF_INET, SOCK_STREAM, 0);
@@ -4172,13 +3960,12 @@ FLAGS is the current flags of the interface.  */)
   return any ? res : Qnil;
 }
 #endif
-#endif /* HAVE_SOCKETS */
+#endif /* defined(HAVE_NET_IF_H) && defined(HAVE_SYS_IOCTL_H) */
 
 /* Turn off input and output for process PROC.  */
 
 void
-deactivate_process (proc)
-     Lisp_Object proc;
+deactivate_process (Lisp_Object proc)
 {
   register int inchannel, outchannel;
   register struct Lisp_Process *p = XPROCESS (proc);
@@ -4238,31 +4025,6 @@ deactivate_process (proc)
     }
 }
 
-/* Close all descriptors currently in use for communication
-   with subprocess.  This is used in a newly-forked subprocess
-   to get rid of irrelevant descriptors.  */
-
-void
-close_process_descs ()
-{
-#ifndef WINDOWSNT
-  int i;
-  for (i = 0; i < MAXDESC; i++)
-    {
-      Lisp_Object process;
-      process = chan_process[i];
-      if (!NILP (process))
-       {
-         int in  = XPROCESS (process)->infd;
-         int out = XPROCESS (process)->outfd;
-         if (in >= 0)
-           emacs_close (in);
-         if (out >= 0 && in != out)
-           emacs_close (out);
-       }
-    }
-#endif
-}
 \f
 DEFUN ("accept-process-output", Faccept_process_output, Saccept_process_output,
        0, 4, 0,
@@ -4281,8 +4043,7 @@ If optional fourth arg JUST-THIS-ONE is non-nil, only accept output
 from PROCESS, suspending reading output from other processes.
 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.  */)
-     (process, seconds, millisec, just_this_one)
-     register Lisp_Object process, seconds, millisec, just_this_one;
+  (register Lisp_Object process, Lisp_Object seconds, Lisp_Object millisec, Lisp_Object just_this_one)
 {
   int secs, usecs = 0;
 
@@ -4336,9 +4097,7 @@ Return non-nil if we received any output before the timeout expired.  */)
 static int connect_counter = 0;
 
 static void
-server_accept_connection (server, channel)
-     Lisp_Object server;
-     int channel;
+server_accept_connection (Lisp_Object server, int channel)
 {
   Lisp_Object proc, caller, name, buffer;
   Lisp_Object contact, host, service;
@@ -4415,7 +4174,7 @@ server_accept_connection (server, channel)
        int i;
        args[0] = build_string ("%x:%x:%x:%x:%x:%x:%x:%x");
        for (i = 0; i < 8; i++)
-         args[i+1] = make_number (ntohs(ip6[i]));
+         args[i+1] = make_number (ntohs (ip6[i]));
        host = Fformat (9, args);
        service = make_number (ntohs (saddr.in.sin_port));
 
@@ -4554,8 +4313,7 @@ server_accept_connection (server, channel)
 static int waiting_for_user_input_p;
 
 static Lisp_Object
-wait_reading_process_output_unwind (data)
-     Lisp_Object data;
+wait_reading_process_output_unwind (Lisp_Object data)
 {
   waiting_for_user_input_p = XINT (data);
   return Qnil;
@@ -4563,7 +4321,7 @@ wait_reading_process_output_unwind (data)
 
 /* This is here so breakpoints can be put on it.  */
 static void
-wait_reading_process_output_1 ()
+wait_reading_process_output_1 (void)
 {
 }
 
@@ -4576,10 +4334,7 @@ wait_reading_process_output_1 ()
 
 #ifndef select
 static INLINE int
-select_wrapper (n, rfd, wfd, xfd, tmo)
-  int n;
-  SELECT_TYPE *rfd, *wfd, *xfd;
-  EMACS_TIME *tmo;
+select_wrapper (int n, fd_set *rfd, fd_set *wfd, fd_set *xfd, struct timeval *tmo)
 {
   return select (n, rfd, wfd, xfd, tmo);
 }
@@ -4624,12 +4379,10 @@ select_wrapper (n, rfd, wfd, xfd, tmo)
    Otherwise, return true if we received input from any process.  */
 
 int
-wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
-                            wait_for_cell, wait_proc, just_wait_proc)
-     int time_limit, microsecs, read_kbd, do_display;
-     Lisp_Object wait_for_cell;
-     struct Lisp_Process *wait_proc;
-     int just_wait_proc;
+wait_reading_process_output (int time_limit, int microsecs, int read_kbd,
+                            int do_display,
+                            Lisp_Object wait_for_cell,
+                            struct Lisp_Process *wait_proc, int just_wait_proc)
 {
   register int channel, nfds;
   SELECT_TYPE Available;
@@ -4650,6 +4403,10 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
   FD_ZERO (&Connecting);
 #endif
 
+  if (time_limit == 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!!");
+
   /* If wait_proc is a process to watch, set wait_channel accordingly.  */
   if (wait_proc != NULL)
     wait_channel = wait_proc->infd;
@@ -4784,7 +4541,10 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
          SELECT_TYPE Ctemp;
 #endif
 
-         Atemp = input_wait_mask;
+          if (kbd_on_hold_p ())
+            FD_ZERO (&Atemp);
+          else
+            Atemp = input_wait_mask;
          IF_NON_BLOCKING_CONNECT (Ctemp = connect_wait_mask);
 
          EMACS_SET_SECS_USECS (timeout, 0, 0);
@@ -5217,23 +4977,23 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
              /* getsockopt(,,SO_ERROR,,) is said to hang on some systems.
                 So only use it on systems where it is known to work.  */
              {
-               int xlen = sizeof(xerrno);
-               if (getsockopt(channel, SOL_SOCKET, SO_ERROR, &xerrno, &xlen))
+               int xlen = sizeof (xerrno);
+               if (getsockopt (channel, SOL_SOCKET, SO_ERROR, &xerrno, &xlen))
                  xerrno = errno;
              }
 #else
              {
                struct sockaddr pname;
-               int pnamelen = sizeof(pname);
+               int pnamelen = sizeof (pname);
 
                /* If connection failed, getpeername will fail.  */
                xerrno = 0;
-               if (getpeername(channel, &pname, &pnamelen) < 0)
+               if (getpeername (channel, &pname, &pnamelen) < 0)
                  {
                    /* Obtain connect failure code through error slippage.  */
                    char dummy;
                    xerrno = errno;
-                   if (errno == ENOTCONN && read(channel, &dummy, 1) < 0)
+                   if (errno == ENOTCONN && read (channel, &dummy, 1) < 0)
                      xerrno = errno;
                  }
              }
@@ -5280,15 +5040,13 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
 /* Given a list (FUNCTION ARGS...), apply FUNCTION to the ARGS.  */
 
 static Lisp_Object
-read_process_output_call (fun_and_args)
-     Lisp_Object fun_and_args;
+read_process_output_call (Lisp_Object fun_and_args)
 {
   return apply1 (XCAR (fun_and_args), XCDR (fun_and_args));
 }
 
 static Lisp_Object
-read_process_output_error_handler (error)
-     Lisp_Object error;
+read_process_output_error_handler (Lisp_Object error)
 {
   cmd_error_internal (error, "error in process filter: ");
   Vinhibit_quit = Qt;
@@ -5309,9 +5067,7 @@ read_process_output_error_handler (error)
    for decoding.  */
 
 static int
-read_process_output (proc, channel)
-     Lisp_Object proc;
-     register int channel;
+read_process_output (Lisp_Object proc, register int channel)
 {
   register int nbytes;
   char *chars;
@@ -5321,11 +5077,13 @@ read_process_output (proc, channel)
   struct coding_system *coding = proc_decode_coding_system[channel];
   int carryover = p->decoding_carryover;
   int readmax = 4096;
+  int count = SPECPDL_INDEX ();
+  Lisp_Object odeactivate;
 
   chars = (char *) alloca (carryover + readmax);
   if (carryover)
     /* See the comment above.  */
-    bcopy (SDATA (p->decoding_buf), chars, carryover);
+    memcpy (chars, SDATA (p->decoding_buf), carryover);
 
 #ifdef DATAGRAM_SOCKETS
   /* We have a working select, so proc_buffered_char is always -1.  */
@@ -5393,15 +5151,16 @@ read_process_output (proc, channel)
   /* Now set NBYTES how many bytes we must decode.  */
   nbytes += carryover;
 
+  odeactivate = Vdeactivate_mark;
+  /* There's no good reason to let process filters change the current
+     buffer, and many callers of accept-process-output, sit-for, and
+     friends don't expect current-buffer to be changed from under them.  */
+  record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ());
+
   /* Read and dispose of the process output.  */
   outstream = p->filter;
   if (!NILP (outstream))
     {
-      /* We inhibit quit here instead of just catching it so that
-        hitting ^G when a filter happens to be running won't screw
-        it up.  */
-      int count = SPECPDL_INDEX ();
-      Lisp_Object odeactivate;
       Lisp_Object obuffer, okeymap;
       Lisp_Object text;
       int outer_running_asynch_code = running_asynch_code;
@@ -5409,10 +5168,12 @@ read_process_output (proc, channel)
 
       /* No need to gcpro these, because all we do with them later
         is test them for EQness, and none of them should be a string.  */
-      odeactivate = Vdeactivate_mark;
       XSETBUFFER (obuffer, current_buffer);
       okeymap = current_buffer->keymap;
 
+      /* We inhibit quit here instead of just catching it so that
+        hitting ^G when a filter happens to be running won't screw
+        it up.  */
       specbind (Qinhibit_quit, Qt);
       specbind (Qlast_nonmenu_event, Qt);
 
@@ -5466,8 +5227,8 @@ read_process_output (proc, channel)
        {
          if (SCHARS (p->decoding_buf) < coding->carryover_bytes)
            p->decoding_buf = make_uninit_string (coding->carryover_bytes);
-         bcopy (coding->carryover, SDATA (p->decoding_buf),
-                coding->carryover_bytes);
+         memcpy (SDATA (p->decoding_buf), coding->carryover,
+                 coding->carryover_bytes);
          p->decoding_carryover = coding->carryover_bytes;
        }
       if (SBYTES (text) > 0)
@@ -5481,9 +5242,6 @@ read_process_output (proc, channel)
       restore_search_regs ();
       running_asynch_code = outer_running_asynch_code;
 
-      /* Handling the process output should not deactivate the mark.  */
-      Vdeactivate_mark = odeactivate;
-
       /* Restore waiting_for_user_input_p as it was
         when we were called, in case the filter clobbered it.  */
       waiting_for_user_input_p = waiting;
@@ -5499,27 +5257,19 @@ read_process_output (proc, channel)
           cause trouble (for example it would make sit_for return).  */
        if (waiting_for_user_input_p == -1)
          record_asynch_buffer_change ();
-
-      unbind_to (count, Qnil);
-      return nbytes;
     }
 
   /* If no filter, write into buffer if it isn't dead.  */
-  if (!NILP (p->buffer) && !NILP (XBUFFER (p->buffer)->name))
+  else if (!NILP (p->buffer) && !NILP (XBUFFER (p->buffer)->name))
     {
       Lisp_Object old_read_only;
       int old_begv, old_zv;
       int old_begv_byte, old_zv_byte;
-      Lisp_Object odeactivate;
       int before, before_byte;
       int opoint_byte;
       Lisp_Object text;
       struct buffer *b;
-      int count = SPECPDL_INDEX ();
 
-      odeactivate = Vdeactivate_mark;
-
-      record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
       Fset_buffer (p->buffer);
       opoint = PT;
       opoint_byte = PT_BYTE;
@@ -5569,8 +5319,8 @@ read_process_output (proc, channel)
        {
          if (SCHARS (p->decoding_buf) < coding->carryover_bytes)
            p->decoding_buf = make_uninit_string (coding->carryover_bytes);
-         bcopy (coding->carryover, SDATA (p->decoding_buf),
-                coding->carryover_bytes);
+         memcpy (SDATA (p->decoding_buf), coding->carryover,
+                 coding->carryover_bytes);
          p->decoding_carryover = coding->carryover_bytes;
        }
       /* Adjust the multibyteness of TEXT to that of the buffer.  */
@@ -5617,23 +5367,15 @@ read_process_output (proc, channel)
       if (old_begv != BEGV || old_zv != ZV)
        Fnarrow_to_region (make_number (old_begv), make_number (old_zv));
 
-      /* Handling the process output should not deactivate the mark.  */
-      Vdeactivate_mark = odeactivate;
 
       current_buffer->read_only = old_read_only;
       SET_PT_BOTH (opoint, opoint_byte);
-      unbind_to (count, Qnil);
     }
-  return nbytes;
-}
+  /* Handling the process output should not deactivate the mark.  */
+  Vdeactivate_mark = odeactivate;
 
-DEFUN ("waiting-for-user-input-p", Fwaiting_for_user_input_p, Swaiting_for_user_input_p,
-       0, 0, 0,
-       doc: /* Returns non-nil if Emacs is waiting for input from the user.
-This is intended for use by asynchronous process output filters and sentinels.  */)
-     ()
-{
-  return (waiting_for_user_input_p ? Qt : Qnil);
+  unbind_to (count, Qnil);
+  return nbytes;
 }
 \f
 /* Sending data to subprocess */
@@ -5642,7 +5384,7 @@ jmp_buf send_process_frame;
 Lisp_Object process_sent_to;
 
 SIGTYPE
-send_process_trap ()
+send_process_trap (int ignore)
 {
   SIGNAL_THREAD_CHECK (SIGPIPE);
   sigunblock (sigmask (SIGPIPE));
@@ -5660,18 +5402,15 @@ send_process_trap ()
    This function can evaluate Lisp code and can garbage collect.  */
 
 static void
-send_process (proc, buf, len, object)
-     volatile Lisp_Object proc;
-     unsigned char *volatile buf;
-     volatile int len;
-     volatile Lisp_Object object;
+send_process (volatile Lisp_Object proc, const unsigned char *volatile buf,
+             volatile int len, volatile Lisp_Object object)
 {
   /* Use volatile to protect variables from being clobbered by longjmp.  */
   struct Lisp_Process *p = XPROCESS (proc);
   int rv;
   struct coding_system *coding;
   struct gcpro gcpro1;
-  SIGTYPE (*volatile old_sigpipe) ();
+  SIGTYPE (*volatile old_sigpipe) (int);
 
   GCPRO1 (object);
 
@@ -5780,39 +5519,11 @@ send_process (proc, buf, len, object)
        {
          int this = len;
 
-         /* Decide how much data we can send in one batch.
-            Long lines need to be split into multiple batches.  */
-         if (p->pty_flag)
-           {
-             /* Starting this at zero is always correct when not the first
-                iteration because the previous iteration ended by sending C-d.
-                It may not be correct for the first iteration
-                if a partial line was sent in a separate send_process call.
-                If that proves worth handling, we need to save linepos
-                in the process object.  */
-             int linepos = 0;
-             unsigned char *ptr = (unsigned char *) buf;
-             unsigned char *end = (unsigned char *) buf + len;
-
-             /* Scan through this text for a line that is too long.  */
-             while (ptr != end && linepos < pty_max_bytes)
-               {
-                 if (*ptr == '\n')
-                   linepos = 0;
-                 else
-                   linepos++;
-                 ptr++;
-               }
-             /* If we found one, break the line there
-                and put in a C-d to force the buffer through.  */
-             this = ptr - buf;
-           }
-
-         /* Send this batch, using one or more write calls.  */
-         while (this > 0)
+         /* Send this batch, using one or more write calls.  */
+         while (this > 0)
            {
              int outfd = p->outfd;
-             old_sigpipe = (SIGTYPE (*) ()) signal (SIGPIPE, send_process_trap);
+             old_sigpipe = (SIGTYPE (*) (int)) signal (SIGPIPE, send_process_trap);
 #ifdef DATAGRAM_SOCKETS
              if (DATAGRAM_CHAN_P (outfd))
                {
@@ -5911,11 +5622,6 @@ send_process (proc, buf, len, object)
              len -= rv;
              this -= rv;
            }
-
-         /* If we sent just part of the string, put in an EOF (C-d)
-            to force it through, before we send the rest.  */
-         if (len > 0)
-           Fprocess_send_eof (proc);
        }
     }
   else
@@ -5942,8 +5648,7 @@ Called from program, takes three arguments, PROCESS, START and END.
 If the region is more than 500 characters long,
 it is sent in several bunches.  This may happen even for shorter regions.
 Output from processes can arrive in between bunches.  */)
-     (process, start, end)
-     Lisp_Object process, start, end;
+  (Lisp_Object process, Lisp_Object start, Lisp_Object end)
 {
   Lisp_Object proc;
   int start1, end1;
@@ -5970,8 +5675,7 @@ nil, indicating the current buffer's process.
 If STRING is more than 500 characters long,
 it is sent in several bunches.  This may happen even for shorter strings.
 Output from processes can arrive in between bunches.  */)
-     (process, string)
-     Lisp_Object process, string;
+  (Lisp_Object process, Lisp_Object string)
 {
   Lisp_Object proc;
   CHECK_STRING (string);
@@ -5984,8 +5688,7 @@ Output from processes can arrive in between bunches.  */)
 /* Return the foreground process group for the tty/pty that
    the process P uses.  */
 static int
-emacs_get_tty_pgrp (p)
-     struct Lisp_Process *p;
+emacs_get_tty_pgrp (struct Lisp_Process *p)
 {
   int gid = -1;
 
@@ -6013,8 +5716,7 @@ DEFUN ("process-running-child-p", Fprocess_running_child_p,
        doc: /* Return t if PROCESS has given the terminal to a child.
 If the operating system does not make it possible to find out,
 return t unconditionally.  */)
-     (process)
-     Lisp_Object process;
+  (Lisp_Object process)
 {
   /* Initialize in case ioctl doesn't exist or gives an error,
      in a way that will cause returning t.  */
@@ -6054,11 +5756,8 @@ return t unconditionally.  */)
    their uid, for which killpg would return an EPERM error.  */
 
 static void
-process_send_signal (process, signo, current_group, nomsg)
-     Lisp_Object process;
-     int signo;
-     Lisp_Object current_group;
-     int nomsg;
+process_send_signal (Lisp_Object process, int signo, Lisp_Object current_group,
+                    int nomsg)
 {
   Lisp_Object proc;
   register struct Lisp_Process *p;
@@ -6088,9 +5787,6 @@ process_send_signal (process, signo, current_group, nomsg)
       /* If possible, send signals to the entire pgrp
         by sending an input character to it.  */
 
-      /* TERMIOS is the latest and bestest, and seems most likely to
-        work.  If the system has it, use it.  */
-#ifdef HAVE_TERMIOS
       struct termios t;
       cc_t *sig_char = NULL;
 
@@ -6122,65 +5818,6 @@ process_send_signal (process, signo, current_group, nomsg)
        }
       /* If we can't send the signal with a character,
         fall through and send it another way.  */
-#else /* ! HAVE_TERMIOS */
-
-      /* On Berkeley descendants, the following IOCTL's retrieve the
-        current control characters.  */
-#if defined (TIOCGLTC) && defined (TIOCGETC)
-
-      struct tchars c;
-      struct ltchars lc;
-
-      switch (signo)
-       {
-       case SIGINT:
-         ioctl (p->infd, TIOCGETC, &c);
-         send_process (proc, &c.t_intrc, 1, Qnil);
-         return;
-       case SIGQUIT:
-         ioctl (p->infd, TIOCGETC, &c);
-         send_process (proc, &c.t_quitc, 1, Qnil);
-         return;
-#ifdef SIGTSTP
-       case SIGTSTP:
-         ioctl (p->infd, TIOCGLTC, &lc);
-         send_process (proc, &lc.t_suspc, 1, Qnil);
-         return;
-#endif /* ! defined (SIGTSTP) */
-       }
-
-#else /* ! defined (TIOCGLTC) && defined (TIOCGETC) */
-
-      /* On SYSV descendants, the TCGETA ioctl retrieves the current control
-        characters.  */
-#ifdef TCGETA
-      struct termio t;
-      switch (signo)
-       {
-       case SIGINT:
-         ioctl (p->infd, TCGETA, &t);
-         send_process (proc, &t.c_cc[VINTR], 1, Qnil);
-         return;
-       case SIGQUIT:
-         ioctl (p->infd, TCGETA, &t);
-         send_process (proc, &t.c_cc[VQUIT], 1, Qnil);
-         return;
-#ifdef SIGTSTP
-       case SIGTSTP:
-         ioctl (p->infd, TCGETA, &t);
-         send_process (proc, &t.c_cc[VSWTCH], 1, Qnil);
-         return;
-#endif /* ! defined (SIGTSTP) */
-       }
-#else /* ! defined (TCGETA) */
-      Your configuration files are messed up.
-      /* If your system configuration files define SIGNALS_VIA_CHARACTERS,
-        you'd better be using one of the alternatives above!  */
-#endif /* ! defined (TCGETA) */
-#endif /* ! defined (TIOCGLTC) && defined (TIOCGETC) */
-       /* In this case, the code above should alway return.  */
-       abort ();
-#endif /* ! defined HAVE_TERMIOS */
 
       /* The code above may fall through if it can't
         handle the signal.  */
@@ -6278,8 +5915,7 @@ rather than the shell.
 
 If CURRENT-GROUP is `lambda', and if the shell owns the terminal,
 don't send the signal.  */)
-     (process, current_group)
-     Lisp_Object process, current_group;
+  (Lisp_Object process, Lisp_Object current_group)
 {
   process_send_signal (process, SIGINT, current_group, 0);
   return process;
@@ -6288,8 +5924,7 @@ don't send the signal.  */)
 DEFUN ("kill-process", Fkill_process, Skill_process, 0, 2, 0,
        doc: /* Kill process PROCESS.  May be process or name of one.
 See function `interrupt-process' for more details on usage.  */)
-     (process, current_group)
-     Lisp_Object process, current_group;
+  (Lisp_Object process, Lisp_Object current_group)
 {
   process_send_signal (process, SIGKILL, current_group, 0);
   return process;
@@ -6298,8 +5933,7 @@ See function `interrupt-process' for more details on usage.  */)
 DEFUN ("quit-process", Fquit_process, Squit_process, 0, 2, 0,
        doc: /* Send QUIT signal to process PROCESS.  May be process or name of one.
 See function `interrupt-process' for more details on usage.  */)
-     (process, current_group)
-     Lisp_Object process, current_group;
+  (Lisp_Object process, Lisp_Object current_group)
 {
   process_send_signal (process, SIGQUIT, current_group, 0);
   return process;
@@ -6310,10 +5944,8 @@ DEFUN ("stop-process", Fstop_process, Sstop_process, 0, 2, 0,
 See function `interrupt-process' for more details on usage.
 If PROCESS is a network or serial process, inhibit handling of incoming
 traffic.  */)
-     (process, current_group)
-     Lisp_Object process, current_group;
+  (Lisp_Object process, Lisp_Object current_group)
 {
-#ifdef HAVE_SOCKETS
   if (PROCESSP (process) && (NETCONN_P (process) || SERIALCONN_P (process)))
     {
       struct Lisp_Process *p;
@@ -6328,7 +5960,6 @@ traffic.  */)
       p->command = Qt;
       return process;
     }
-#endif
 #ifndef SIGTSTP
   error ("No SIGTSTP support");
 #else
@@ -6342,10 +5973,8 @@ DEFUN ("continue-process", Fcontinue_process, Scontinue_process, 0, 2, 0,
 See function `interrupt-process' for more details on usage.
 If PROCESS is a network or serial process, resume handling of incoming
 traffic.  */)
-     (process, current_group)
-     Lisp_Object process, current_group;
+  (Lisp_Object process, Lisp_Object current_group)
 {
-#ifdef HAVE_SOCKETS
   if (PROCESSP (process) && (NETCONN_P (process) || SERIALCONN_P (process)))
     {
       struct Lisp_Process *p;
@@ -6360,15 +5989,13 @@ traffic.  */)
 #ifdef WINDOWSNT
          if (fd_info[ p->infd ].flags & FILE_SERIAL)
            PurgeComm (fd_info[ p->infd ].hnd, PURGE_RXABORT | PURGE_RXCLEAR);
-#endif
-#ifdef HAVE_TERMIOS
+#else /* not WINDOWSNT */
          tcflush (p->infd, TCIFLUSH);
-#endif
+#endif /* not WINDOWSNT */
        }
       p->command = Qnil;
       return process;
     }
-#endif
 #ifdef SIGCONT
     process_send_signal (process, SIGCONT, current_group, 0);
 #else
@@ -6384,8 +6011,7 @@ PROCESS may also be a number specifying the process id of the
 process to signal; in this case, the process need not be a child of
 this Emacs.
 SIGCODE may be an integer, or a symbol whose name is a signal name.  */)
-     (process, sigcode)
-     Lisp_Object process, sigcode;
+  (Lisp_Object process, Lisp_Object sigcode)
 {
   pid_t pid;
 
@@ -6438,7 +6064,7 @@ SIGCODE may be an integer, or a symbol whose name is a signal name.  */)
       CHECK_SYMBOL (sigcode);
       name = SDATA (SYMBOL_NAME (sigcode));
 
-      if (!strncmp(name, "SIG", 3) || !strncmp(name, "sig", 3))
+      if (!strncmp (name, "SIG", 3) || !strncmp (name, "sig", 3))
        name += 3;
 
       if (0)
@@ -6552,8 +6178,7 @@ through a pipe (as opposed to a pty), then you cannot send any more
 text to PROCESS after you call this function.
 If PROCESS is a serial process, wait until all output written to the
 process has been transmitted to the serial port.  */)
-     (process)
-     Lisp_Object process;
+  (Lisp_Object process)
 {
   Lisp_Object proc;
   struct coding_system *coding;
@@ -6580,10 +6205,10 @@ process has been transmitted to the serial port.  */)
     send_process (proc, "\004", 1, Qnil);
   else if (EQ (XPROCESS (proc)->type, Qserial))
     {
-#ifdef HAVE_TERMIOS
+#ifndef WINDOWSNT
       if (tcdrain (XPROCESS (proc)->outfd) != 0)
        error ("tcdrain() failed: %s", emacs_strerror (errno));
-#endif
+#endif /* not WINDOWSNT */
       /* Do nothing on Windows because writes are blocking.  */
     }
   else
@@ -6612,39 +6237,16 @@ 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));
-      bcopy (proc_encode_coding_system[old_outfd],
-            proc_encode_coding_system[new_outfd],
-            sizeof (struct coding_system));
-      bzero (proc_encode_coding_system[old_outfd],
-            sizeof (struct coding_system));
+      memcpy (proc_encode_coding_system[new_outfd],
+             proc_encode_coding_system[old_outfd],
+             sizeof (struct coding_system));
+      memset (proc_encode_coding_system[old_outfd], 0,
+             sizeof (struct coding_system));
 
       XPROCESS (proc)->outfd = new_outfd;
     }
   return process;
 }
-
-/* Kill all processes associated with `buffer'.
-   If `buffer' is nil, kill all processes  */
-
-void
-kill_buffer_processes (buffer)
-     Lisp_Object buffer;
-{
-  Lisp_Object tail, proc;
-
-  for (tail = Vprocess_alist; CONSP (tail); tail = XCDR (tail))
-    {
-      proc = XCDR (XCAR (tail));
-      if (PROCESSP (proc)
-         && (NILP (buffer) || EQ (XPROCESS (proc)->buffer, buffer)))
-       {
-         if (NETCONN_P (proc) || SERIALCONN_P (proc))
-           Fdelete_process (proc);
-         else if (XPROCESS (proc)->infd >= 0)
-           process_send_signal (proc, SIGHUP, Qnil, 1);
-       }
-    }
-}
 \f
 /* On receipt of a signal that a child status has changed, loop asking
    about children with changed statuses until the system says there
@@ -6673,13 +6275,11 @@ kill_buffer_processes (buffer)
 
 #ifdef SIGCHLD
 SIGTYPE
-sigchld_handler (signo)
-     int signo;
+sigchld_handler (int signo)
 {
   int old_errno = errno;
   Lisp_Object proc;
-  register struct Lisp_Process *p;
-  extern EMACS_TIME *input_available_clear_time;
+  struct Lisp_Process *p;
 
   SIGNAL_THREAD_CHECK (signo);
 
@@ -6706,11 +6306,6 @@ sigchld_handler (signo)
          /* PID == 0 means no processes found, PID == -1 means a real
             failure.  We have done all our job, so return.  */
 
-         /* USG systems forget handlers when they are used;
-            must reestablish each time */
-#if defined (USG) && !defined (POSIX_SIGNALS)
-         signal (signo, sigchld_handler);   /* WARNING - must come after wait3() */
-#endif
          errno = old_errno;
          return;
        }
@@ -6811,9 +6406,6 @@ sigchld_handler (signo)
 #if (defined WINDOWSNT \
      || (defined USG && !defined GNU_LINUX \
         && !(defined HPUX && defined WNOHANG)))
-#if defined (USG) && ! defined (POSIX_SIGNALS)
-      signal (signo, sigchld_handler);
-#endif
       errno = old_errno;
       return;
 #endif /* USG, but not HPUX with WNOHANG */
@@ -6823,16 +6415,14 @@ sigchld_handler (signo)
 \f
 
 static Lisp_Object
-exec_sentinel_unwind (data)
-     Lisp_Object data;
+exec_sentinel_unwind (Lisp_Object data)
 {
   XPROCESS (XCAR (data))->sentinel = XCDR (data);
   return Qnil;
 }
 
 static Lisp_Object
-exec_sentinel_error_handler (error)
-     Lisp_Object error;
+exec_sentinel_error_handler (Lisp_Object error)
 {
   cmd_error_internal (error, "error in process sentinel: ");
   Vinhibit_quit = Qt;
@@ -6842,8 +6432,7 @@ exec_sentinel_error_handler (error)
 }
 
 static void
-exec_sentinel (proc, reason)
-     Lisp_Object proc, reason;
+exec_sentinel (Lisp_Object proc, Lisp_Object reason)
 {
   Lisp_Object sentinel, obuffer, odeactivate, okeymap;
   register struct Lisp_Process *p = XPROCESS (proc);
@@ -6860,6 +6449,11 @@ exec_sentinel (proc, reason)
   XSETBUFFER (obuffer, current_buffer);
   okeymap = current_buffer->keymap;
 
+  /* There's no good reason to let sentinels change the current
+     buffer, and many callers of accept-process-output, sit-for, and
+     friends don't expect current-buffer to be changed from under them.  */
+  record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ());
+
   sentinel = p->sentinel;
   if (NILP (sentinel))
     return;
@@ -6923,8 +6517,7 @@ exec_sentinel (proc, reason)
    but can be done at other times.  */
 
 static void
-status_notify (deleting_process)
-     struct Lisp_Process *deleting_process;
+status_notify (struct Lisp_Process *deleting_process)
 {
   register Lisp_Object proc, buffer;
   Lisp_Object tail, msg;
@@ -6997,13 +6590,11 @@ status_notify (deleting_process)
             when a process becomes runnable.  */
          else if (!EQ (symbol, Qrun) && !NILP (buffer))
            {
-             Lisp_Object ro, tem;
+             Lisp_Object tem;
              struct buffer *old = current_buffer;
              int opoint, opoint_byte;
              int before, before_byte;
 
-             ro = XBUFFER (buffer)->read_only;
-
              /* Avoid error if buffer is deleted
                 (probably that's why the process is dead, too) */
              if (NILP (XBUFFER (buffer)->name))
@@ -7053,8 +6644,7 @@ DEFUN ("set-process-coding-system", Fset_process_coding_system,
        doc: /* Set coding systems of PROCESS to DECODING and ENCODING.
 DECODING will be used to decode subprocess output and ENCODING to
 encode subprocess input.  */)
-     (process, decoding, encoding)
-     register Lisp_Object process, decoding, encoding;
+  (register Lisp_Object process, Lisp_Object decoding, Lisp_Object encoding)
 {
   register struct Lisp_Process *p;
 
@@ -7077,8 +6667,7 @@ encode subprocess input.  */)
 DEFUN ("process-coding-system",
        Fprocess_coding_system, Sprocess_coding_system, 1, 1, 0,
        doc: /* Return a cons of coding systems for decoding and encoding of PROCESS.  */)
-     (process)
-     register Lisp_Object process;
+  (register Lisp_Object process)
 {
   CHECK_PROCESS (process);
   return Fcons (XPROCESS (process)->decode_coding_system,
@@ -7092,8 +6681,7 @@ If FLAG is non-nil, the filter is given multibyte strings.
 If FLAG is nil, the filter is given unibyte strings.  In this case,
 all character code conversion except for end-of-line conversion is
 suppressed.  */)
-     (process, flag)
-     Lisp_Object process, flag;
+  (Lisp_Object process, Lisp_Object flag)
 {
   register struct Lisp_Process *p;
 
@@ -7109,8 +6697,7 @@ suppressed.  */)
 DEFUN ("process-filter-multibyte-p", Fprocess_filter_multibyte_p,
        Sprocess_filter_multibyte_p, 1, 1, 0,
        doc: /* Return t if a multibyte string is given to PROCESS's filter.*/)
-     (process)
-     Lisp_Object process;
+  (Lisp_Object process)
 {
   register struct Lisp_Process *p;
   struct coding_system *coding;
@@ -7123,23 +6710,11 @@ DEFUN ("process-filter-multibyte-p", Fprocess_filter_multibyte_p,
 
 
 \f
-/* Add DESC to the set of keyboard input descriptors.  */
-
-void
-add_keyboard_wait_descriptor (desc)
-     int desc;
-{
-  FD_SET (desc, &input_wait_mask);
-  FD_SET (desc, &non_process_wait_mask);
-  if (desc > max_keyboard_desc)
-    max_keyboard_desc = desc;
-}
 
 static int add_gpm_wait_descriptor_called_flag;
 
 void
-add_gpm_wait_descriptor (desc)
-     int desc;
+add_gpm_wait_descriptor (int desc)
 {
   if (! add_gpm_wait_descriptor_called_flag)
     FD_CLR (0, &input_wait_mask);
@@ -7150,29 +6725,8 @@ add_gpm_wait_descriptor (desc)
     max_gpm_desc = desc;
 }
 
-/* From now on, do not expect DESC to give keyboard input.  */
-
-void
-delete_keyboard_wait_descriptor (desc)
-     int desc;
-{
-  int fd;
-  int lim = max_keyboard_desc;
-
-  FD_CLR (desc, &input_wait_mask);
-  FD_CLR (desc, &non_process_wait_mask);
-
-  if (desc == max_keyboard_desc)
-    for (fd = 0; fd < lim; fd++)
-      if (FD_ISSET (fd, &input_wait_mask)
-         && !FD_ISSET (fd, &non_keyboard_wait_mask)
-         && !FD_ISSET (fd, &gpm_wait_mask))
-       max_keyboard_desc = fd;
-}
-
 void
-delete_gpm_wait_descriptor (desc)
-     int desc;
+delete_gpm_wait_descriptor (int desc)
 {
   int fd;
   int lim = max_gpm_desc;
@@ -7192,8 +6746,7 @@ delete_gpm_wait_descriptor (desc)
    that corresponds to one of the keyboard input descriptors.  */
 
 static int
-keyboard_bit_set (mask)
-     SELECT_TYPE *mask;
+keyboard_bit_set (fd_set *mask)
 {
   int fd;
 
@@ -7204,574 +6757,97 @@ keyboard_bit_set (mask)
 
   return 0;
 }
-\f
-/* Enumeration of and access to system processes a-la ps(1).  */
 
-DEFUN ("list-system-processes", Flist_system_processes, Slist_system_processes,
-       0, 0, 0,
-       doc: /* Return a list of numerical process IDs of all running processes.
-If this functionality is unsupported, return nil.
+#else  /* not subprocesses */
 
-See `process-attributes' for getting attributes of a process given its ID.  */)
-    ()
-{
-  return list_system_processes ();
-}
+/* Defined on msdos.c.  */
+extern int sys_select (int, SELECT_TYPE *, SELECT_TYPE *, SELECT_TYPE *,
+                      EMACS_TIME *);
 
-DEFUN ("process-attributes", Fprocess_attributes,
-       Sprocess_attributes, 1, 1, 0,
-       doc: /* Return attributes of the process given by its PID, a number.
+/* Implementation of wait_reading_process_output, assuming that there
+   are no subprocesses.  Used only by the MS-DOS build.
 
-Value is an alist where each element is a cons cell of the form
+   Wait for timeout to elapse and/or keyboard input to be available.
 
-    \(KEY . VALUE)
+   time_limit is:
+     timeout in seconds, or
+     zero for no limit, or
+     -1 means gobble data immediately available but don't wait for any.
 
-If this functionality is unsupported, the value is nil.
+   read_kbd is a Lisp_Object:
+     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
+       the quit handler.
 
-See `list-system-processes' for getting a list of all process IDs.
+   see full version for other parameters. We know that wait_proc will
+     always be NULL, since `subprocesses' isn't defined.
 
-The KEYs of the attributes that this function may return are listed
-below, together with the type of the associated VALUE (in parentheses).
-Not all platforms support all of these attributes; unsupported
-attributes will not appear in the returned alist.
-Unless explicitly indicated otherwise, numbers can have either
-integer or floating point values.
+   do_display != 0 means redisplay should be done to show subprocess
+   output that arrives.
 
- euid    -- Effective user User ID of the process (number)
- user    -- User name corresponding to euid (string)
- egid    -- Effective user Group ID of the process (number)
- group   -- Group name corresponding to egid (string)
- comm    -- Command name (executable name only) (string)
- state   -- Process state code, such as "S", "R", or "T" (string)
- ppid    -- Parent process ID (number)
- pgrp    -- Process group ID (number)
- sess    -- Session ID, i.e. process ID of session leader (number)
- ttname  -- Controlling tty name (string)
- tpgid   -- ID of foreground process group on the process's tty (number)
- minflt  -- number of minor page faults (number)
- 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
- 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
- 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
- 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)
- args    -- command line which invoked the process (string).  */)
-    (pid)
+   Return true if we received input from any process.  */
 
-    Lisp_Object pid;
-{
-  return system_process_attributes (pid);
-}
-\f
-void
-init_process ()
+int
+wait_reading_process_output (int time_limit, int microsecs, int read_kbd,
+                            int do_display,
+                            Lisp_Object wait_for_cell,
+                            struct Lisp_Process *wait_proc, int just_wait_proc)
 {
-  register int i;
+  register int nfds;
+  EMACS_TIME end_time, timeout;
+  SELECT_TYPE waitchannels;
+  int xerrno;
 
-  inhibit_sentinels = 0;
+  /* What does time_limit really mean?  */
+  if (time_limit || microsecs)
+    {
+      EMACS_GET_TIME (end_time);
+      EMACS_SET_SECS_USECS (timeout, time_limit, microsecs);
+      EMACS_ADD_TIME (end_time, end_time, timeout);
+    }
 
-#ifdef SIGCHLD
-#ifndef CANNOT_DUMP
-  if (! noninteractive || initialized)
-#endif
-    signal (SIGCHLD, sigchld_handler);
-#endif
+  /* Turn off periodic alarms (in case they are in use)
+     and then turn off any other atimers,
+     because the select emulator uses alarms.  */
+  stop_polling ();
+  turn_on_atimers (0);
 
-  FD_ZERO (&input_wait_mask);
-  FD_ZERO (&non_keyboard_wait_mask);
-  FD_ZERO (&non_process_wait_mask);
-  max_process_desc = 0;
+  while (1)
+    {
+      int timeout_reduced_for_timers = 0;
 
-#ifdef NON_BLOCKING_CONNECT
-  FD_ZERO (&connect_wait_mask);
-  num_pending_connects = 0;
-#endif
+      /* If calling from keyboard input, do not quit
+        since we want to return C-g as an input character.
+        Otherwise, do pending quit if requested.  */
+      if (read_kbd >= 0)
+       QUIT;
 
-#ifdef ADAPTIVE_READ_BUFFERING
-  process_output_delay_count = 0;
-  process_output_skip = 0;
-#endif
+      /* Exit now if the cell we're waiting for became non-nil.  */
+      if (! NILP (wait_for_cell) && ! NILP (XCAR (wait_for_cell)))
+       break;
 
-  /* Don't do this, it caused infinite select loops.  The display
-     method should call add_keyboard_wait_descriptor on stdin if it
-     needs that.  */
-#if 0
-  FD_SET (0, &input_wait_mask);
-#endif
+      /* Compute time from now till when time limit is up */
+      /* Exit if already run out */
+      if (time_limit == -1)
+       {
+         /* -1 specified for timeout means
+            gobble output available now
+            but don't wait at all. */
 
-  Vprocess_alist = Qnil;
-#ifdef SIGCHLD
-  deleted_pid_list = Qnil;
-#endif
-  for (i = 0; i < MAXDESC; i++)
-    {
-      chan_process[i] = Qnil;
-      proc_buffered_char[i] = -1;
-    }
-  bzero (proc_decode_coding_system, sizeof proc_decode_coding_system);
-  bzero (proc_encode_coding_system, sizeof proc_encode_coding_system);
-#ifdef DATAGRAM_SOCKETS
-  bzero (datagram_address, sizeof datagram_address);
-#endif
-
-#ifdef HAVE_SOCKETS
- {
-   Lisp_Object subfeatures = Qnil;
-   const struct socket_options *sopt;
-
-#define ADD_SUBFEATURE(key, val) \
-  subfeatures = pure_cons (pure_cons (key, pure_cons (val, Qnil)), subfeatures)
-
-#ifdef NON_BLOCKING_CONNECT
-   ADD_SUBFEATURE (QCnowait, Qt);
-#endif
-#ifdef DATAGRAM_SOCKETS
-   ADD_SUBFEATURE (QCtype, Qdatagram);
-#endif
-#ifdef HAVE_SEQPACKET
-   ADD_SUBFEATURE (QCtype, Qseqpacket);
-#endif
-#ifdef HAVE_LOCAL_SOCKETS
-   ADD_SUBFEATURE (QCfamily, Qlocal);
-#endif
-   ADD_SUBFEATURE (QCfamily, Qipv4);
-#ifdef AF_INET6
-   ADD_SUBFEATURE (QCfamily, Qipv6);
-#endif
-#ifdef HAVE_GETSOCKNAME
-   ADD_SUBFEATURE (QCservice, Qt);
-#endif
-#if defined(O_NONBLOCK) || defined(O_NDELAY)
-   ADD_SUBFEATURE (QCserver, Qt);
-#endif
-
-   for (sopt = socket_options; sopt->name; sopt++)
-     subfeatures = pure_cons (intern_c_string (sopt->name), subfeatures);
-
-   Fprovide (intern_c_string ("make-network-process"), subfeatures);
- }
-#endif /* HAVE_SOCKETS */
-
-#if defined (DARWIN_OS)
-  /* PTYs are broken on Darwin < 6, but are sometimes useful for interactive
-     processes.  As such, we only change the default value.  */
- if (initialized)
-  {
-    char *release = get_operating_system_release();
-    if (!release || !release[0] || (release[0] < MIN_PTY_KERNEL_VERSION
-                                   && release[1] == '.')) {
-      Vprocess_connection_type = Qnil;
-    }
-  }
-#endif
-}
-
-void
-syms_of_process ()
-{
-  Qprocessp = intern_c_string ("processp");
-  staticpro (&Qprocessp);
-  Qrun = intern_c_string ("run");
-  staticpro (&Qrun);
-  Qstop = intern_c_string ("stop");
-  staticpro (&Qstop);
-  Qsignal = intern_c_string ("signal");
-  staticpro (&Qsignal);
-
-  /* Qexit is already staticpro'd by syms_of_eval; don't staticpro it
-     here again.
-
-     Qexit = intern_c_string ("exit");
-     staticpro (&Qexit); */
-
-  Qopen = intern_c_string ("open");
-  staticpro (&Qopen);
-  Qclosed = intern_c_string ("closed");
-  staticpro (&Qclosed);
-  Qconnect = intern_c_string ("connect");
-  staticpro (&Qconnect);
-  Qfailed = intern_c_string ("failed");
-  staticpro (&Qfailed);
-  Qlisten = intern_c_string ("listen");
-  staticpro (&Qlisten);
-  Qlocal = intern_c_string ("local");
-  staticpro (&Qlocal);
-  Qipv4 = intern_c_string ("ipv4");
-  staticpro (&Qipv4);
-#ifdef AF_INET6
-  Qipv6 = intern_c_string ("ipv6");
-  staticpro (&Qipv6);
-#endif
-  Qdatagram = intern_c_string ("datagram");
-  staticpro (&Qdatagram);
-  Qseqpacket = intern_c_string ("seqpacket");
-  staticpro (&Qseqpacket);
-
-  QCport = intern_c_string (":port");
-  staticpro (&QCport);
-  QCspeed = intern_c_string (":speed");
-  staticpro (&QCspeed);
-  QCprocess = intern_c_string (":process");
-  staticpro (&QCprocess);
-
-  QCbytesize = intern_c_string (":bytesize");
-  staticpro (&QCbytesize);
-  QCstopbits = intern_c_string (":stopbits");
-  staticpro (&QCstopbits);
-  QCparity = intern_c_string (":parity");
-  staticpro (&QCparity);
-  Qodd = intern_c_string ("odd");
-  staticpro (&Qodd);
-  Qeven = intern_c_string ("even");
-  staticpro (&Qeven);
-  QCflowcontrol = intern_c_string (":flowcontrol");
-  staticpro (&QCflowcontrol);
-  Qhw = intern_c_string ("hw");
-  staticpro (&Qhw);
-  Qsw = intern_c_string ("sw");
-  staticpro (&Qsw);
-  QCsummary = intern_c_string (":summary");
-  staticpro (&QCsummary);
-
-  Qreal = intern_c_string ("real");
-  staticpro (&Qreal);
-  Qnetwork = intern_c_string ("network");
-  staticpro (&Qnetwork);
-  Qserial = intern_c_string ("serial");
-  staticpro (&Qserial);
-
-  QCname = intern_c_string (":name");
-  staticpro (&QCname);
-  QCbuffer = intern_c_string (":buffer");
-  staticpro (&QCbuffer);
-  QChost = intern_c_string (":host");
-  staticpro (&QChost);
-  QCservice = intern_c_string (":service");
-  staticpro (&QCservice);
-  QCtype = intern_c_string (":type");
-  staticpro (&QCtype);
-  QClocal = intern_c_string (":local");
-  staticpro (&QClocal);
-  QCremote = intern_c_string (":remote");
-  staticpro (&QCremote);
-  QCcoding = intern_c_string (":coding");
-  staticpro (&QCcoding);
-  QCserver = intern_c_string (":server");
-  staticpro (&QCserver);
-  QCnowait = intern_c_string (":nowait");
-  staticpro (&QCnowait);
-  QCsentinel = intern_c_string (":sentinel");
-  staticpro (&QCsentinel);
-  QClog = intern_c_string (":log");
-  staticpro (&QClog);
-  QCnoquery = intern_c_string (":noquery");
-  staticpro (&QCnoquery);
-  QCstop = intern_c_string (":stop");
-  staticpro (&QCstop);
-  QCoptions = intern_c_string (":options");
-  staticpro (&QCoptions);
-  QCplist = intern_c_string (":plist");
-  staticpro (&QCplist);
-
-  Qlast_nonmenu_event = intern_c_string ("last-nonmenu-event");
-  staticpro (&Qlast_nonmenu_event);
-
-  staticpro (&Vprocess_alist);
-#ifdef SIGCHLD
-  staticpro (&deleted_pid_list);
-#endif
-
-  Qeuid = intern_c_string ("euid");
-  staticpro (&Qeuid);
-  Qegid = intern_c_string ("egid");
-  staticpro (&Qegid);
-  Quser = intern_c_string ("user");
-  staticpro (&Quser);
-  Qgroup = intern_c_string ("group");
-  staticpro (&Qgroup);
-  Qcomm = intern_c_string ("comm");
-  staticpro (&Qcomm);
-  Qstate = intern_c_string ("state");
-  staticpro (&Qstate);
-  Qppid = intern_c_string ("ppid");
-  staticpro (&Qppid);
-  Qpgrp = intern_c_string ("pgrp");
-  staticpro (&Qpgrp);
-  Qsess = intern_c_string ("sess");
-  staticpro (&Qsess);
-  Qttname = intern_c_string ("ttname");
-  staticpro (&Qttname);
-  Qtpgid = intern_c_string ("tpgid");
-  staticpro (&Qtpgid);
-  Qminflt = intern_c_string ("minflt");
-  staticpro (&Qminflt);
-  Qmajflt = intern_c_string ("majflt");
-  staticpro (&Qmajflt);
-  Qcminflt = intern_c_string ("cminflt");
-  staticpro (&Qcminflt);
-  Qcmajflt = intern_c_string ("cmajflt");
-  staticpro (&Qcmajflt);
-  Qutime = intern_c_string ("utime");
-  staticpro (&Qutime);
-  Qstime = intern_c_string ("stime");
-  staticpro (&Qstime);
-  Qtime = intern_c_string ("time");
-  staticpro (&Qtime);
-  Qcutime = intern_c_string ("cutime");
-  staticpro (&Qcutime);
-  Qcstime = intern_c_string ("cstime");
-  staticpro (&Qcstime);
-  Qctime = intern_c_string ("ctime");
-  staticpro (&Qctime);
-  Qpri = intern_c_string ("pri");
-  staticpro (&Qpri);
-  Qnice = intern_c_string ("nice");
-  staticpro (&Qnice);
-  Qthcount = intern_c_string ("thcount");
-  staticpro (&Qthcount);
-  Qstart = intern_c_string ("start");
-  staticpro (&Qstart);
-  Qvsize = intern_c_string ("vsize");
-  staticpro (&Qvsize);
-  Qrss = intern_c_string ("rss");
-  staticpro (&Qrss);
-  Qetime = intern_c_string ("etime");
-  staticpro (&Qetime);
-  Qpcpu = intern_c_string ("pcpu");
-  staticpro (&Qpcpu);
-  Qpmem = intern_c_string ("pmem");
-  staticpro (&Qpmem);
-  Qargs = intern_c_string ("args");
-  staticpro (&Qargs);
-
-  DEFVAR_BOOL ("delete-exited-processes", &delete_exited_processes,
-              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;
-
-  DEFVAR_LISP ("process-connection-type", &Vprocess_connection_type,
-              doc: /* Control 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 system has no ptys or if all ptys are busy:
-then a pipe is used in any case.
-The value takes effect when `start-process' is called.  */);
-  Vprocess_connection_type = Qt;
-
-#ifdef ADAPTIVE_READ_BUFFERING
-  DEFVAR_LISP ("process-adaptive-read-buffering", &Vprocess_adaptive_read_buffering,
-              doc: /* If non-nil, improve receive buffering by delaying after short reads.
-On some systems, when Emacs reads the output from a subprocess, the output data
-is read in very small blocks, potentially resulting in very poor performance.
-This behavior can be remedied to some extent by setting this variable to a
-non-nil value, as it will automatically delay reading from such processes, to
-allow them to produce more output before Emacs tries to read it.
-If the value is t, the delay is reset after each write to the process; any other
-non-nil value means that the delay is not reset on write.
-The variable takes effect when `start-process' is called.  */);
-  Vprocess_adaptive_read_buffering = Qt;
-#endif
-
-  defsubr (&Sprocessp);
-  defsubr (&Sget_process);
-  defsubr (&Sget_buffer_process);
-  defsubr (&Sdelete_process);
-  defsubr (&Sprocess_status);
-  defsubr (&Sprocess_exit_status);
-  defsubr (&Sprocess_id);
-  defsubr (&Sprocess_name);
-  defsubr (&Sprocess_tty_name);
-  defsubr (&Sprocess_command);
-  defsubr (&Sset_process_buffer);
-  defsubr (&Sprocess_buffer);
-  defsubr (&Sprocess_mark);
-  defsubr (&Sset_process_filter);
-  defsubr (&Sprocess_filter);
-  defsubr (&Sset_process_sentinel);
-  defsubr (&Sprocess_sentinel);
-  defsubr (&Sset_process_window_size);
-  defsubr (&Sset_process_inherit_coding_system_flag);
-  defsubr (&Sprocess_inherit_coding_system_flag);
-  defsubr (&Sset_process_query_on_exit_flag);
-  defsubr (&Sprocess_query_on_exit_flag);
-  defsubr (&Sprocess_contact);
-  defsubr (&Sprocess_plist);
-  defsubr (&Sset_process_plist);
-  defsubr (&Slist_processes);
-  defsubr (&Sprocess_list);
-  defsubr (&Sstart_process);
-#ifdef HAVE_SERIAL
-  defsubr (&Sserial_process_configure);
-  defsubr (&Smake_serial_process);
-#endif /* HAVE_SERIAL  */
-#ifdef HAVE_SOCKETS
-  defsubr (&Sset_network_process_option);
-  defsubr (&Smake_network_process);
-  defsubr (&Sformat_network_address);
-#endif /* HAVE_SOCKETS */
-#if defined(HAVE_SOCKETS) && defined(HAVE_NET_IF_H) && defined(HAVE_SYS_IOCTL_H)
-#ifdef SIOCGIFCONF
-  defsubr (&Snetwork_interface_list);
-#endif
-#if defined(SIOCGIFADDR) || defined(SIOCGIFHWADDR) || defined(SIOCGIFFLAGS)
-  defsubr (&Snetwork_interface_info);
-#endif
-#endif /* HAVE_SOCKETS ... */
-#ifdef DATAGRAM_SOCKETS
-  defsubr (&Sprocess_datagram_address);
-  defsubr (&Sset_process_datagram_address);
-#endif
-  defsubr (&Saccept_process_output);
-  defsubr (&Sprocess_send_region);
-  defsubr (&Sprocess_send_string);
-  defsubr (&Sinterrupt_process);
-  defsubr (&Skill_process);
-  defsubr (&Squit_process);
-  defsubr (&Sstop_process);
-  defsubr (&Scontinue_process);
-  defsubr (&Sprocess_running_child_p);
-  defsubr (&Sprocess_send_eof);
-  defsubr (&Ssignal_process);
-  defsubr (&Swaiting_for_user_input_p);
-  defsubr (&Sprocess_type);
-  defsubr (&Sset_process_coding_system);
-  defsubr (&Sprocess_coding_system);
-  defsubr (&Sset_process_filter_multibyte);
-  defsubr (&Sprocess_filter_multibyte_p);
-  defsubr (&Slist_system_processes);
-  defsubr (&Sprocess_attributes);
-}
-
-\f
-#else /* not subprocesses */
-
-#include <sys/types.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <setjmp.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#include "lisp.h"
-#include "systime.h"
-#include "character.h"
-#include "coding.h"
-#include "termopts.h"
-#include "sysselect.h"
-
-extern int frame_garbaged;
-
-extern EMACS_TIME timer_check ();
-extern int timers_run;
-
-Lisp_Object QCtype, QCname;
-
-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;
-Lisp_Object Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtime, Qctime;
-
-/* As described above, except assuming that there are no subprocesses:
-
-   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.
-
-   read_kbd is a Lisp_Object:
-     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
-       the quit handler.
-
-   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
-   output that arrives.
-
-   Return true if we received input from any process.  */
-
-int
-wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
-                            wait_for_cell, wait_proc, just_wait_proc)
-     int time_limit, microsecs, read_kbd, 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;
-
-  /* What does time_limit really mean?  */
-  if (time_limit || microsecs)
-    {
-      EMACS_GET_TIME (end_time);
-      EMACS_SET_SECS_USECS (timeout, time_limit, microsecs);
-      EMACS_ADD_TIME (end_time, end_time, timeout);
-    }
-
-  /* Turn off periodic alarms (in case they are in use)
-     and then turn off any other atimers,
-     because the select emulator uses alarms.  */
-  stop_polling ();
-  turn_on_atimers (0);
-
-  while (1)
-    {
-      int timeout_reduced_for_timers = 0;
-
-      /* If calling from keyboard input, do not quit
-        since we want to return C-g as an input character.
-        Otherwise, do pending quit if requested.  */
-      if (read_kbd >= 0)
-       QUIT;
-
-      /* Exit now if the cell we're waiting for became non-nil.  */
-      if (! NILP (wait_for_cell) && ! NILP (XCAR (wait_for_cell)))
-       break;
-
-      /* Compute time from now till when time limit is up */
-      /* Exit if already run out */
-      if (time_limit == -1)
-       {
-         /* -1 specified for timeout means
-            gobble output available now
-            but don't wait at all. */
-
-         EMACS_SET_SECS_USECS (timeout, 0, 0);
-       }
-      else if (time_limit || microsecs)
-       {
-         EMACS_GET_TIME (timeout);
-         EMACS_SUB_TIME (timeout, end_time, timeout);
-         if (EMACS_TIME_NEG_P (timeout))
-           break;
-       }
-      else
-       {
-         EMACS_SET_SECS_USECS (timeout, 100000, 0);
-       }
+         EMACS_SET_SECS_USECS (timeout, 0, 0);
+       }
+      else if (time_limit || microsecs)
+       {
+         EMACS_GET_TIME (timeout);
+         EMACS_SUB_TIME (timeout, end_time, timeout);
+         if (EMACS_TIME_NEG_P (timeout))
+           break;
+       }
+      else
+       {
+         EMACS_SET_SECS_USECS (timeout, 100000, 0);
+       }
 
       /* If our caller will not immediately handle keyboard events,
         run timer events directly.
@@ -7863,15 +6939,6 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
          else
            error ("select error: %s", emacs_strerror (xerrno));
        }
-#ifdef SOLARIS2
-      else if (nfds > 0 && (waitchannels & 1)  && interrupt_input)
-       /* System sometimes fails to deliver SIGIO.  */
-       kill (getpid (), SIGIO);
-#endif
-#ifdef SIGIO
-      if (read_kbd && interrupt_input && (waitchannels & 1))
-       kill (getpid (), SIGIO);
-#endif
 
       /* Check for keyboard input */
 
@@ -7897,141 +6964,519 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
       if (! NILP (wait_for_cell)
          && detect_input_pending ())
        {
-         swallow_events (do_display);
-         if (detect_input_pending ())
-           break;
+         swallow_events (do_display);
+         if (detect_input_pending ())
+           break;
+       }
+
+      /* Exit now if the cell we're waiting for became non-nil.  */
+      if (! NILP (wait_for_cell) && ! NILP (XCAR (wait_for_cell)))
+       break;
+    }
+
+  start_polling ();
+
+  return 0;
+}
+
+#endif /* not subprocesses */
+
+/* The following functions are needed even if async subprocesses are
+   not supported.  Some of them are no-op stubs in that case.  */
+
+/* Add DESC to the set of keyboard input descriptors.  */
+
+void
+add_keyboard_wait_descriptor (int desc)
+{
+#ifdef subprocesses
+  FD_SET (desc, &input_wait_mask);
+  FD_SET (desc, &non_process_wait_mask);
+  if (desc > max_keyboard_desc)
+    max_keyboard_desc = desc;
+#endif
+}
+
+/* From now on, do not expect DESC to give keyboard input.  */
+
+void
+delete_keyboard_wait_descriptor (int desc)
+{
+#ifdef subprocesses
+  int fd;
+  int lim = max_keyboard_desc;
+
+  FD_CLR (desc, &input_wait_mask);
+  FD_CLR (desc, &non_process_wait_mask);
+
+  if (desc == max_keyboard_desc)
+    for (fd = 0; fd < lim; fd++)
+      if (FD_ISSET (fd, &input_wait_mask)
+         && !FD_ISSET (fd, &non_keyboard_wait_mask)
+         && !FD_ISSET (fd, &gpm_wait_mask))
+       max_keyboard_desc = fd;
+#endif /* subprocesses */
+}
+
+/* Setup coding systems of PROCESS.  */
+
+void
+setup_process_coding_systems (Lisp_Object process)
+{
+#ifdef subprocesses
+  struct Lisp_Process *p = XPROCESS (process);
+  int inch = p->infd;
+  int outch = p->outfd;
+  Lisp_Object coding_system;
+
+  if (inch < 0 || outch < 0)
+    return;
+
+  if (!proc_decode_coding_system[inch])
+    proc_decode_coding_system[inch]
+      = (struct coding_system *) xmalloc (sizeof (struct coding_system));
+  coding_system = p->decode_coding_system;
+  if (! NILP (p->filter))
+    ;
+  else if (BUFFERP (p->buffer))
+    {
+      if (NILP (XBUFFER (p->buffer)->enable_multibyte_characters))
+       coding_system = raw_text_coding_system (coding_system);
+    }
+  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));
+  setup_coding_system (p->encode_coding_system,
+                      proc_encode_coding_system[outch]);
+#endif
+}
+
+/* Close all descriptors currently in use for communication
+   with subprocess.  This is used in a newly-forked subprocess
+   to get rid of irrelevant descriptors.  */
+
+void
+close_process_descs (void)
+{
+#ifndef DOS_NT
+  int i;
+  for (i = 0; i < MAXDESC; i++)
+    {
+      Lisp_Object process;
+      process = chan_process[i];
+      if (!NILP (process))
+       {
+         int in  = XPROCESS (process)->infd;
+         int out = XPROCESS (process)->outfd;
+         if (in >= 0)
+           emacs_close (in);
+         if (out >= 0 && in != out)
+           emacs_close (out);
        }
-
-      /* Exit now if the cell we're waiting for became non-nil.  */
-      if (! NILP (wait_for_cell) && ! NILP (XCAR (wait_for_cell)))
-       break;
     }
-
-  start_polling ();
-
-  return 0;
+#endif
 }
 
-
-/* Don't confuse make-docfile by having two doc strings for this function.
-   make-docfile does not pay attention to #if, for good reason!  */
 DEFUN ("get-buffer-process", Fget_buffer_process, Sget_buffer_process, 1, 1, 0,
-       0)
-     (name)
-     register Lisp_Object name;
+       doc: /* Return the (or a) process associated with BUFFER.
+BUFFER may be a buffer or the name of one.  */)
+  (register Lisp_Object buffer)
 {
+#ifdef subprocesses
+  register Lisp_Object buf, tail, proc;
+
+  if (NILP (buffer)) return Qnil;
+  buf = Fget_buffer (buffer);
+  if (NILP (buf)) return Qnil;
+
+  for (tail = Vprocess_alist; CONSP (tail); tail = XCDR (tail))
+    {
+      proc = Fcdr (XCAR (tail));
+      if (PROCESSP (proc) && EQ (XPROCESS (proc)->buffer, buf))
+       return proc;
+    }
+#endif /* subprocesses */
   return Qnil;
 }
 
-  /* Don't confuse make-docfile by having two doc strings for this function.
-     make-docfile does not pay attention to #if, for good reason!  */
 DEFUN ("process-inherit-coding-system-flag",
        Fprocess_inherit_coding_system_flag, Sprocess_inherit_coding_system_flag,
        1, 1, 0,
-       0)
-     (process)
-     register Lisp_Object process;
+       doc: /* Return the value of inherit-coding-system flag for PROCESS.
+If this flag is t, `buffer-file-coding-system' of the buffer
+associated with PROCESS will inherit the coding system used to decode
+the process output.  */)
+  (register Lisp_Object process)
 {
+#ifdef subprocesses
+  CHECK_PROCESS (process);
+  return XPROCESS (process)->inherit_coding_system_flag ? Qt : Qnil;
+#else
   /* Ignore the argument and return the value of
      inherit-process-coding-system.  */
   return inherit_process_coding_system ? Qt : Qnil;
+#endif
 }
 
 /* Kill all processes associated with `buffer'.
-   If `buffer' is nil, kill all processes.
-   Since we have no subprocesses, this does nothing.  */
+   If `buffer' is nil, kill all processes  */
+
+void
+kill_buffer_processes (Lisp_Object buffer)
+{
+#ifdef subprocesses
+  Lisp_Object tail, proc;
+
+  for (tail = Vprocess_alist; CONSP (tail); tail = XCDR (tail))
+    {
+      proc = XCDR (XCAR (tail));
+      if (PROCESSP (proc)
+         && (NILP (buffer) || EQ (XPROCESS (proc)->buffer, buffer)))
+       {
+         if (NETCONN_P (proc) || SERIALCONN_P (proc))
+           Fdelete_process (proc);
+         else if (XPROCESS (proc)->infd >= 0)
+           process_send_signal (proc, SIGHUP, Qnil, 1);
+       }
+    }
+#else  /* subprocesses */
+  /* Since we have no subprocesses, this does nothing.  */
+#endif /* subprocesses */
+}
+
+DEFUN ("waiting-for-user-input-p", Fwaiting_for_user_input_p, Swaiting_for_user_input_p,
+       0, 0, 0,
+       doc: /* Returns non-nil if Emacs is waiting for input from the user.
+This is intended for use by asynchronous process output filters and sentinels.  */)
+  (void)
+{
+#ifdef subprocesses
+  return (waiting_for_user_input_p ? Qt : Qnil);
+#else
+  return Qnil;
+#endif
+}
+
+/* Stop reading input from keyboard sources.  */
+
+void
+hold_keyboard_input (void)
+{
+  kbd_is_on_hold = 1;
+}
+
+/* Resume reading input from keyboard sources.  */
 
 void
-kill_buffer_processes (buffer)
-     Lisp_Object buffer;
+unhold_keyboard_input (void)
+{
+  kbd_is_on_hold = 0;
+}
+
+/* Return non-zero if keyboard input is on hold, zero otherwise.  */
+
+int
+kbd_on_hold_p (void)
 {
+  return kbd_is_on_hold;
 }
 
+\f
+/* Enumeration of and access to system processes a-la ps(1).  */
+
 DEFUN ("list-system-processes", Flist_system_processes, Slist_system_processes,
        0, 0, 0,
        doc: /* Return a list of numerical process IDs of all running processes.
 If this functionality is unsupported, return nil.
 
-See `process-attributes' for getting attributes of a process given its ID.  */)
-    ()
+See `process-attributes' for getting attributes of a process given its ID.  */)
+  (void)
+{
+  return list_system_processes ();
+}
+
+DEFUN ("process-attributes", Fprocess_attributes,
+       Sprocess_attributes, 1, 1, 0,
+       doc: /* Return attributes of the process given by its PID, a number.
+
+Value is an alist where each element is a cons cell of the form
+
+    \(KEY . VALUE)
+
+If this functionality is unsupported, the value is nil.
+
+See `list-system-processes' for getting a list of all process IDs.
+
+The KEYs of the attributes that this function may return are listed
+below, together with the type of the associated VALUE (in parentheses).
+Not all platforms support all of these attributes; unsupported
+attributes will not appear in the returned alist.
+Unless explicitly indicated otherwise, numbers can have either
+integer or floating point values.
+
+ euid    -- Effective user User ID of the process (number)
+ user    -- User name corresponding to euid (string)
+ egid    -- Effective user Group ID of the process (number)
+ group   -- Group name corresponding to egid (string)
+ comm    -- Command name (executable name only) (string)
+ state   -- Process state code, such as "S", "R", or "T" (string)
+ ppid    -- Parent process ID (number)
+ pgrp    -- Process group ID (number)
+ sess    -- Session ID, i.e. process ID of session leader (number)
+ ttname  -- Controlling tty name (string)
+ tpgid   -- ID of foreground process group on the process's tty (number)
+ minflt  -- number of minor page faults (number)
+ 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
+ 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
+ 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
+ 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)
+ args    -- command line which invoked the process (string).  */)
+  ( Lisp_Object pid)
+{
+  return system_process_attributes (pid);
+}
+
+\f
+void
+init_process (void)
+{
+#ifdef subprocesses
+  register int i;
+
+  inhibit_sentinels = 0;
+
+#ifdef SIGCHLD
+#ifndef CANNOT_DUMP
+  if (! noninteractive || initialized)
+#endif
+    signal (SIGCHLD, sigchld_handler);
+#endif
+
+  FD_ZERO (&input_wait_mask);
+  FD_ZERO (&non_keyboard_wait_mask);
+  FD_ZERO (&non_process_wait_mask);
+  max_process_desc = 0;
+
+#ifdef NON_BLOCKING_CONNECT
+  FD_ZERO (&connect_wait_mask);
+  num_pending_connects = 0;
+#endif
+
+#ifdef ADAPTIVE_READ_BUFFERING
+  process_output_delay_count = 0;
+  process_output_skip = 0;
+#endif
+
+  /* Don't do this, it caused infinite select loops.  The display
+     method should call add_keyboard_wait_descriptor on stdin if it
+     needs that.  */
+#if 0
+  FD_SET (0, &input_wait_mask);
+#endif
+
+  Vprocess_alist = Qnil;
+#ifdef SIGCHLD
+  deleted_pid_list = Qnil;
+#endif
+  for (i = 0; i < MAXDESC; i++)
+    {
+      chan_process[i] = Qnil;
+      proc_buffered_char[i] = -1;
+    }
+  memset (proc_decode_coding_system, 0, sizeof proc_decode_coding_system);
+  memset (proc_encode_coding_system, 0, sizeof proc_encode_coding_system);
+#ifdef DATAGRAM_SOCKETS
+  memset (datagram_address, 0, sizeof datagram_address);
+#endif
+
+ {
+   Lisp_Object subfeatures = Qnil;
+   const struct socket_options *sopt;
+
+#define ADD_SUBFEATURE(key, val) \
+  subfeatures = pure_cons (pure_cons (key, pure_cons (val, Qnil)), subfeatures)
+
+#ifdef NON_BLOCKING_CONNECT
+   ADD_SUBFEATURE (QCnowait, Qt);
+#endif
+#ifdef DATAGRAM_SOCKETS
+   ADD_SUBFEATURE (QCtype, Qdatagram);
+#endif
+#ifdef HAVE_SEQPACKET
+   ADD_SUBFEATURE (QCtype, Qseqpacket);
+#endif
+#ifdef HAVE_LOCAL_SOCKETS
+   ADD_SUBFEATURE (QCfamily, Qlocal);
+#endif
+   ADD_SUBFEATURE (QCfamily, Qipv4);
+#ifdef AF_INET6
+   ADD_SUBFEATURE (QCfamily, Qipv6);
+#endif
+#ifdef HAVE_GETSOCKNAME
+   ADD_SUBFEATURE (QCservice, Qt);
+#endif
+#if defined(O_NONBLOCK) || defined(O_NDELAY)
+   ADD_SUBFEATURE (QCserver, Qt);
+#endif
+
+   for (sopt = socket_options; sopt->name; sopt++)
+     subfeatures = pure_cons (intern_c_string (sopt->name), subfeatures);
+
+   Fprovide (intern_c_string ("make-network-process"), subfeatures);
+ }
+
+#if defined (DARWIN_OS)
+  /* PTYs are broken on Darwin < 6, but are sometimes useful for interactive
+     processes.  As such, we only change the default value.  */
+ if (initialized)
+  {
+    const char *release = get_operating_system_release ();
+    if (!release || !release[0] || (release[0] < MIN_PTY_KERNEL_VERSION
+                                   && release[1] == '.')) {
+      Vprocess_connection_type = Qnil;
+    }
+  }
+#endif
+#endif /* subprocesses */
+  kbd_is_on_hold = 0;
+}
+
+void
+syms_of_process (void)
 {
-  return list_system_processes ();
-}
+#ifdef subprocesses
 
-DEFUN ("process-attributes", Fprocess_attributes,
-       Sprocess_attributes, 1, 1, 0,
-       doc: /* Return attributes of the process given by its PID, a number.
+  Qprocessp = intern_c_string ("processp");
+  staticpro (&Qprocessp);
+  Qrun = intern_c_string ("run");
+  staticpro (&Qrun);
+  Qstop = intern_c_string ("stop");
+  staticpro (&Qstop);
+  Qsignal = intern_c_string ("signal");
+  staticpro (&Qsignal);
 
-Value is an alist where each element is a cons cell of the form
+  /* Qexit is already staticpro'd by syms_of_eval; don't staticpro it
+     here again.
 
-    \(KEY . VALUE)
+     Qexit = intern_c_string ("exit");
+     staticpro (&Qexit); */
 
-If this functionality is unsupported, the value is nil.
+  Qopen = intern_c_string ("open");
+  staticpro (&Qopen);
+  Qclosed = intern_c_string ("closed");
+  staticpro (&Qclosed);
+  Qconnect = intern_c_string ("connect");
+  staticpro (&Qconnect);
+  Qfailed = intern_c_string ("failed");
+  staticpro (&Qfailed);
+  Qlisten = intern_c_string ("listen");
+  staticpro (&Qlisten);
+  Qlocal = intern_c_string ("local");
+  staticpro (&Qlocal);
+  Qipv4 = intern_c_string ("ipv4");
+  staticpro (&Qipv4);
+#ifdef AF_INET6
+  Qipv6 = intern_c_string ("ipv6");
+  staticpro (&Qipv6);
+#endif
+  Qdatagram = intern_c_string ("datagram");
+  staticpro (&Qdatagram);
+  Qseqpacket = intern_c_string ("seqpacket");
+  staticpro (&Qseqpacket);
 
-See `list-system-processes' for getting a list of all process IDs.
+  QCport = intern_c_string (":port");
+  staticpro (&QCport);
+  QCspeed = intern_c_string (":speed");
+  staticpro (&QCspeed);
+  QCprocess = intern_c_string (":process");
+  staticpro (&QCprocess);
 
-The KEYs of the attributes that this function may return are listed
-below, together with the type of the associated VALUE (in parentheses).
-Not all platforms support all of these attributes; unsupported
-attributes will not appear in the returned alist.
-Unless explicitly indicated otherwise, numbers can have either
-integer or floating point values.
+  QCbytesize = intern_c_string (":bytesize");
+  staticpro (&QCbytesize);
+  QCstopbits = intern_c_string (":stopbits");
+  staticpro (&QCstopbits);
+  QCparity = intern_c_string (":parity");
+  staticpro (&QCparity);
+  Qodd = intern_c_string ("odd");
+  staticpro (&Qodd);
+  Qeven = intern_c_string ("even");
+  staticpro (&Qeven);
+  QCflowcontrol = intern_c_string (":flowcontrol");
+  staticpro (&QCflowcontrol);
+  Qhw = intern_c_string ("hw");
+  staticpro (&Qhw);
+  Qsw = intern_c_string ("sw");
+  staticpro (&Qsw);
+  QCsummary = intern_c_string (":summary");
+  staticpro (&QCsummary);
 
- euid    -- Effective user User ID of the process (number)
- user    -- User name corresponding to euid (string)
- egid    -- Effective user Group ID of the process (number)
- group   -- Group name corresponding to egid (string)
- comm    -- Command name (executable name only) (string)
- state   -- Process state code, such as "S", "R", or "T" (string)
- ppid    -- Parent process ID (number)
- pgrp    -- Process group ID (number)
- sess    -- Session ID, i.e. process ID of session leader (number)
- ttname  -- Controlling tty name (string)
- tpgid   -- ID of foreground process group on the process's tty (number)
- minflt  -- number of minor page faults (number)
- 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
- 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
- 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
- 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)
- args    -- command line which invoked the process (string).   */)
-    (pid)
+  Qreal = intern_c_string ("real");
+  staticpro (&Qreal);
+  Qnetwork = intern_c_string ("network");
+  staticpro (&Qnetwork);
+  Qserial = intern_c_string ("serial");
+  staticpro (&Qserial);
+  QCbuffer = intern_c_string (":buffer");
+  staticpro (&QCbuffer);
+  QChost = intern_c_string (":host");
+  staticpro (&QChost);
+  QCservice = intern_c_string (":service");
+  staticpro (&QCservice);
+  QClocal = intern_c_string (":local");
+  staticpro (&QClocal);
+  QCremote = intern_c_string (":remote");
+  staticpro (&QCremote);
+  QCcoding = intern_c_string (":coding");
+  staticpro (&QCcoding);
+  QCserver = intern_c_string (":server");
+  staticpro (&QCserver);
+  QCnowait = intern_c_string (":nowait");
+  staticpro (&QCnowait);
+  QCsentinel = intern_c_string (":sentinel");
+  staticpro (&QCsentinel);
+  QClog = intern_c_string (":log");
+  staticpro (&QClog);
+  QCnoquery = intern_c_string (":noquery");
+  staticpro (&QCnoquery);
+  QCstop = intern_c_string (":stop");
+  staticpro (&QCstop);
+  QCoptions = intern_c_string (":options");
+  staticpro (&QCoptions);
+  QCplist = intern_c_string (":plist");
+  staticpro (&QCplist);
 
-    Lisp_Object pid;
-{
-  return system_process_attributes (pid);
-}
+  Qlast_nonmenu_event = intern_c_string ("last-nonmenu-event");
+  staticpro (&Qlast_nonmenu_event);
 
-void
-init_process ()
-{
-}
+  staticpro (&Vprocess_alist);
+#ifdef SIGCHLD
+  staticpro (&deleted_pid_list);
+#endif
+
+#endif /* subprocesses */
 
-void
-syms_of_process ()
-{
-  QCtype = intern_c_string (":type");
-  staticpro (&QCtype);
   QCname = intern_c_string (":name");
   staticpro (&QCname);
   QCtype = intern_c_string (":type");
   staticpro (&QCtype);
-  QCname = intern_c_string (":name");
-  staticpro (&QCname);
+
   Qeuid = intern_c_string ("euid");
   staticpro (&Qeuid);
   Qegid = intern_c_string ("egid");
@@ -8095,14 +7540,103 @@ syms_of_process ()
   Qargs = intern_c_string ("args");
   staticpro (&Qargs);
 
+  DEFVAR_BOOL ("delete-exited-processes", &delete_exited_processes,
+              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;
+
+#ifdef subprocesses
+  DEFVAR_LISP ("process-connection-type", &Vprocess_connection_type,
+              doc: /* Control 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 system has no ptys or if all ptys are busy:
+then a pipe is used in any case.
+The value takes effect when `start-process' is called.  */);
+  Vprocess_connection_type = Qt;
+
+#ifdef ADAPTIVE_READ_BUFFERING
+  DEFVAR_LISP ("process-adaptive-read-buffering", &Vprocess_adaptive_read_buffering,
+              doc: /* If non-nil, improve receive buffering by delaying after short reads.
+On some systems, when Emacs reads the output from a subprocess, the output data
+is read in very small blocks, potentially resulting in very poor performance.
+This behavior can be remedied to some extent by setting this variable to a
+non-nil value, as it will automatically delay reading from such processes, to
+allow them to produce more output before Emacs tries to read it.
+If the value is t, the delay is reset after each write to the process; any other
+non-nil value means that the delay is not reset on write.
+The variable takes effect when `start-process' is called.  */);
+  Vprocess_adaptive_read_buffering = Qt;
+#endif
+
+  defsubr (&Sprocessp);
+  defsubr (&Sget_process);
+  defsubr (&Sdelete_process);
+  defsubr (&Sprocess_status);
+  defsubr (&Sprocess_exit_status);
+  defsubr (&Sprocess_id);
+  defsubr (&Sprocess_name);
+  defsubr (&Sprocess_tty_name);
+  defsubr (&Sprocess_command);
+  defsubr (&Sset_process_buffer);
+  defsubr (&Sprocess_buffer);
+  defsubr (&Sprocess_mark);
+  defsubr (&Sset_process_filter);
+  defsubr (&Sprocess_filter);
+  defsubr (&Sset_process_sentinel);
+  defsubr (&Sprocess_sentinel);
+  defsubr (&Sset_process_window_size);
+  defsubr (&Sset_process_inherit_coding_system_flag);
+  defsubr (&Sset_process_query_on_exit_flag);
+  defsubr (&Sprocess_query_on_exit_flag);
+  defsubr (&Sprocess_contact);
+  defsubr (&Sprocess_plist);
+  defsubr (&Sset_process_plist);
+  defsubr (&Slist_processes);
+  defsubr (&Sprocess_list);
+  defsubr (&Sstart_process);
+  defsubr (&Sserial_process_configure);
+  defsubr (&Smake_serial_process);
+  defsubr (&Sset_network_process_option);
+  defsubr (&Smake_network_process);
+  defsubr (&Sformat_network_address);
+#if defined(HAVE_NET_IF_H) && defined(HAVE_SYS_IOCTL_H)
+#ifdef SIOCGIFCONF
+  defsubr (&Snetwork_interface_list);
+#endif
+#if defined(SIOCGIFADDR) || defined(SIOCGIFHWADDR) || defined(SIOCGIFFLAGS)
+  defsubr (&Snetwork_interface_info);
+#endif
+#endif /* defined(HAVE_NET_IF_H) && defined(HAVE_SYS_IOCTL_H) */
+#ifdef DATAGRAM_SOCKETS
+  defsubr (&Sprocess_datagram_address);
+  defsubr (&Sset_process_datagram_address);
+#endif
+  defsubr (&Saccept_process_output);
+  defsubr (&Sprocess_send_region);
+  defsubr (&Sprocess_send_string);
+  defsubr (&Sinterrupt_process);
+  defsubr (&Skill_process);
+  defsubr (&Squit_process);
+  defsubr (&Sstop_process);
+  defsubr (&Scontinue_process);
+  defsubr (&Sprocess_running_child_p);
+  defsubr (&Sprocess_send_eof);
+  defsubr (&Ssignal_process);
+  defsubr (&Swaiting_for_user_input_p);
+  defsubr (&Sprocess_type);
+  defsubr (&Sset_process_coding_system);
+  defsubr (&Sprocess_coding_system);
+  defsubr (&Sset_process_filter_multibyte);
+  defsubr (&Sprocess_filter_multibyte_p);
+
+#endif /* subprocesses */
+
   defsubr (&Sget_buffer_process);
   defsubr (&Sprocess_inherit_coding_system_flag);
   defsubr (&Slist_system_processes);
   defsubr (&Sprocess_attributes);
 }
 
-\f
-#endif /* not subprocesses */
-
 /* arch-tag: 3706c011-7b9a-4117-bd4f-59e7f701a4c4
    (do not change this comment) */
index a8cd0a02da68d24e14e4647e931c954b7e045d4e..35b01aba6a474b22aae772a0fcd012b334e40b47 100644 (file)
@@ -142,7 +142,7 @@ extern int synch_process_alive;
    to Fcall_process.  */
 
 /* Nonzero => this is a string explaining death of synchronous subprocess.  */
-extern char *synch_process_death;
+extern const char *synch_process_death;
 
 /* Nonzero => this is the signal number that terminated the subprocess.  */
 extern int synch_process_termsig;
@@ -166,9 +166,16 @@ extern Lisp_Object Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime;
 extern Lisp_Object Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs;
 extern Lisp_Object Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtpgid, Qcstime;
 extern Lisp_Object Qtime, Qctime;
+extern Lisp_Object QCport, QCspeed, QCprocess;
+extern Lisp_Object QCbytesize, QCstopbits, QCparity, Qodd, Qeven;
+extern Lisp_Object QCflowcontrol, Qhw, Qsw, QCsummary;
 
 extern Lisp_Object list_system_processes (void);
 extern Lisp_Object system_process_attributes (Lisp_Object);
 
+extern void hold_keyboard_input (void);
+extern void unhold_keyboard_input (void);
+extern int kbd_on_hold_p (void);
+
 /* arch-tag: dffedfc4-d7bc-4b58-a26f-c16155449c72
    (do not change this comment) */
index 4e97e3731b786b4dc82497f91dac73a058a0be28..3c7f92228a0661e22e0eff9925429691959dadf4 100644 (file)
@@ -72,7 +72,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 P_ ((void)) NO_RETURN;
+extern void pure_write_error (void) NO_RETURN;
 \f
 /* Define PURE_P.  */
 
@@ -87,7 +87,6 @@ extern EMACS_INT pure[];
   && (PNTR_COMPARISON_TYPE) XPNTR (obj) >= (PNTR_COMPARISON_TYPE) pure)
 
 #else /* not VIRT_ADDR_VARIES */
-#ifdef PNTR_COMPARISON_TYPE
 /* When PNTR_COMPARISON_TYPE is not the default (unsigned int).  */
 
 extern char my_edata[];
@@ -95,14 +94,6 @@ extern char my_edata[];
 #define PURE_P(obj) \
   ((PNTR_COMPARISON_TYPE) XPNTR (obj) < (PNTR_COMPARISON_TYPE) my_edata)
 
-#else /* not VIRT_ADDRESS_VARIES, not PNTR_COMPARISON_TYPE */
-
-extern char my_edata[];
-
-#define PURE_P(obj) \
-  (XPNTR (obj) < (unsigned int) my_edata)
-
-#endif /* PNTR_COMPARISON_TYPE */
 #endif /* VIRT_ADDRESS_VARIES */
 
 /* arch-tag: fd9b0a91-a70e-4729-a75a-6bb4ca1ce14f
index 7ccbdc7daf77ae34229f9e689f95a73c344c2d75..5f2b52fcc4be004ea80f1a2154a78cf592c0d970 100644 (file)
@@ -37,14 +37,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 typedef POINTER_TYPE *POINTER;
 typedef size_t SIZE;
 
-/* Declared in dispnew.c, this version doesn't screw up if regions
-   overlap.  */
-
-extern void safe_bcopy ();
-
 #ifdef DOUG_LEA_MALLOC
 #define M_TOP_PAD           -2
-extern int mallopt ();
+extern int mallopt (int, int);
 #else /* not DOUG_LEA_MALLOC */
 #ifndef SYSTEM_MALLOC
 extern size_t __malloc_extra_blocks;
@@ -61,9 +56,6 @@ typedef void *POINTER;
 #include <unistd.h>
 #include <malloc.h>
 
-#define safe_bcopy(x, y, z) memmove (y, x, z)
-#define bzero(x, len) memset (x, 0, len)
-
 #endif /* not emacs */
 
 
@@ -81,13 +73,13 @@ typedef void *POINTER;
 
 static int r_alloc_initialized = 0;
 
-static void r_alloc_init ();
+static void r_alloc_init (void);
 
 \f
 /* Declarations for working with the malloc, ralloc, and system breaks.  */
 
 /* Function to set the real break value.  */
-POINTER (*real_morecore) ();
+POINTER (*real_morecore) (long int);
 
 /* The break value, as seen by malloc.  */
 static POINTER virtual_break_value;
@@ -119,7 +111,7 @@ static int extra_bytes;
    from the system.  */
 
 #ifndef SYSTEM_MALLOC
-extern POINTER (*__morecore) ();
+extern POINTER (*__morecore) (long int);
 #endif
 
 
@@ -210,8 +202,7 @@ static int r_alloc_freeze_level;
 /* Find the heap that ADDRESS falls within.  */
 
 static heap_ptr
-find_heap (address)
-    POINTER address;
+find_heap (POINTER address)
 {
   heap_ptr heap;
 
@@ -243,9 +234,7 @@ find_heap (address)
    allocate the memory.  */
 
 static POINTER
-obtain (address, size)
-    POINTER address;
-    SIZE size;
+obtain (POINTER address, SIZE size)
 {
   heap_ptr heap;
   SIZE already_available;
@@ -326,7 +315,7 @@ obtain (address, size)
    it can also eliminate the last heap entirely.  */
 
 static void
-relinquish ()
+relinquish (void)
 {
   register heap_ptr h;
   long excess = 0;
@@ -385,7 +374,7 @@ relinquish ()
    above where malloc gets space.  */
 
 long
-r_alloc_size_in_use ()
+r_alloc_size_in_use (void)
 {
   return (char *) break_value - (char *) virtual_break_value;
 }
@@ -396,8 +385,7 @@ r_alloc_size_in_use ()
    to that block.  */
 
 static bloc_ptr
-find_bloc (ptr)
-     POINTER *ptr;
+find_bloc (POINTER *ptr)
 {
   register bloc_ptr p = first_bloc;
 
@@ -422,8 +410,7 @@ find_bloc (ptr)
    memory for the new block.  */
 
 static bloc_ptr
-get_bloc (size)
-     SIZE size;
+get_bloc (SIZE size)
 {
   register bloc_ptr new_bloc;
   register heap_ptr heap;
@@ -478,10 +465,7 @@ get_bloc (size)
    Do not touch the contents of blocs or break_value.  */
 
 static int
-relocate_blocs (bloc, heap, address)
-    bloc_ptr bloc;
-    heap_ptr heap;
-    POINTER address;
+relocate_blocs (bloc_ptr bloc, heap_ptr heap, POINTER address)
 {
   register bloc_ptr b = bloc;
 
@@ -535,44 +519,12 @@ relocate_blocs (bloc, heap, address)
 
   return 1;
 }
-
-/* Reorder the bloc BLOC to go before bloc BEFORE in the doubly linked list.
-   This is necessary if we put the memory of space of BLOC
-   before that of BEFORE.  */
-
-static void
-reorder_bloc (bloc, before)
-     bloc_ptr bloc, before;
-{
-  bloc_ptr prev, next;
-
-  /* Splice BLOC out from where it is.  */
-  prev = bloc->prev;
-  next = bloc->next;
-
-  if (prev)
-    prev->next = next;
-  if (next)
-    next->prev = prev;
-
-  /* Splice it in before BEFORE.  */
-  prev = before->prev;
-
-  if (prev)
-    prev->next = bloc;
-  bloc->prev = prev;
-
-  before->prev = bloc;
-  bloc->next = before;
-}
 \f
 /* Update the records of which heaps contain which blocs, starting
    with heap HEAP and bloc BLOC.  */
 
 static void
-update_heap_bloc_correspondence (bloc, heap)
-     bloc_ptr bloc;
-     heap_ptr heap;
+update_heap_bloc_correspondence (bloc_ptr bloc, heap_ptr heap)
 {
   register bloc_ptr b;
 
@@ -634,9 +586,7 @@ update_heap_bloc_correspondence (bloc, heap)
    that come after BLOC in memory.  */
 
 static int
-resize_bloc (bloc, size)
-    bloc_ptr bloc;
-    SIZE size;
+resize_bloc (bloc_ptr bloc, SIZE size)
 {
   register bloc_ptr b;
   heap_ptr heap;
@@ -689,7 +639,7 @@ resize_bloc (bloc, size)
             }
          else
            {
-             safe_bcopy (b->data, b->new_data, b->size);
+             memmove (b->new_data, b->data, b->size);
              *b->variable = b->data = b->new_data;
             }
        }
@@ -700,8 +650,8 @@ resize_bloc (bloc, size)
        }
       else
        {
-         safe_bcopy (bloc->data, bloc->new_data, old_size);
-         bzero ((char *) bloc->new_data + old_size, size - old_size);
+         memmove (bloc->new_data, bloc->data, old_size);
+         memset (bloc->new_data + old_size, 0, size - old_size);
          *bloc->variable = bloc->data = bloc->new_data;
        }
     }
@@ -716,7 +666,7 @@ resize_bloc (bloc, size)
             }
          else
            {
-             safe_bcopy (b->data, b->new_data, b->size);
+             memmove (b->new_data, b->data, b->size);
              *b->variable = b->data = b->new_data;
            }
        }
@@ -733,8 +683,7 @@ resize_bloc (bloc, size)
    This may return space to the system.  */
 
 static void
-free_bloc (bloc)
-     bloc_ptr bloc;
+free_bloc (bloc_ptr bloc)
 {
   heap_ptr heap = bloc->heap;
 
@@ -800,8 +749,7 @@ free_bloc (bloc)
    GNU malloc package.  */
 
 POINTER
-r_alloc_sbrk (size)
-     long size;
+r_alloc_sbrk (long int size)
 {
   register bloc_ptr b;
   POINTER address;
@@ -871,7 +819,7 @@ r_alloc_sbrk (size)
             header.  */
          for (b = last_bloc; b != NIL_BLOC; b = b->prev)
            {
-             safe_bcopy (b->data, b->new_data, b->size);
+             memmove (b->new_data, b->data, b->size);
              *b->variable = b->data = b->new_data;
            }
 
@@ -898,7 +846,7 @@ r_alloc_sbrk (size)
            last_heap = first_heap;
        }
 
-      bzero (address, size);
+      memset (address, 0, size);
     }
   else /* size < 0 */
     {
@@ -917,7 +865,7 @@ r_alloc_sbrk (size)
 
          for (b = first_bloc; b != NIL_BLOC; b = b->next)
            {
-             safe_bcopy (b->data, b->new_data, b->size);
+             memmove (b->new_data, b->data, b->size);
              *b->variable = b->data = b->new_data;
            }
        }
@@ -952,9 +900,7 @@ r_alloc_sbrk (size)
    return zero.  */
 
 POINTER
-r_alloc (ptr, size)
-     POINTER *ptr;
-     SIZE size;
+r_alloc (POINTER *ptr, SIZE size)
 {
   register bloc_ptr new_bloc;
 
@@ -977,8 +923,7 @@ r_alloc (ptr, size)
    Store 0 in *PTR to show there's no block allocated.  */
 
 void
-r_alloc_free (ptr)
-     register POINTER *ptr;
+r_alloc_free (register POINTER *ptr)
 {
   register bloc_ptr dead_bloc;
 
@@ -1012,9 +957,7 @@ r_alloc_free (ptr)
    return zero.  */
 
 POINTER
-r_re_alloc (ptr, size)
-     POINTER *ptr;
-     SIZE size;
+r_re_alloc (POINTER *ptr, SIZE size)
 {
   register bloc_ptr bloc;
 
@@ -1075,8 +1018,7 @@ r_re_alloc (ptr, size)
    malloc must return a null pointer.  */
 
 void
-r_alloc_freeze (size)
-     long size;
+r_alloc_freeze (long int size)
 {
   if (! r_alloc_initialized)
     r_alloc_init ();
@@ -1093,7 +1035,7 @@ r_alloc_freeze (size)
 }
 
 void
-r_alloc_thaw ()
+r_alloc_thaw (void)
 {
 
   if (! r_alloc_initialized)
@@ -1103,7 +1045,7 @@ r_alloc_thaw ()
     abort ();
 
   /* This frees all unused blocs.  It is not too inefficient, as the resize
-     and bcopy is done only once.  Afterwards, all unreferenced blocs are
+     and memcpy is done only once.  Afterwards, all unreferenced blocs are
      already shrunk to zero size.  */
   if (!r_alloc_freeze_level)
     {
@@ -1122,7 +1064,7 @@ r_alloc_thaw ()
 /* Reinitialize the morecore hook variables after restarting a dumped
    Emacs.  This is needed when using Doug Lea's malloc from GNU libc.  */
 void
-r_alloc_reinit ()
+r_alloc_reinit (void)
 {
   /* Only do this if the hook has been reset, so that we don't get an
      infinite loop, in case Emacs was linked statically.  */
@@ -1235,8 +1177,7 @@ r_alloc_check ()
    is checked to ensure that memory corruption does not occur due to
    misuse.  */
 void
-r_alloc_reset_variable (old, new)
-     POINTER *old, *new;
+r_alloc_reset_variable (POINTER *old, POINTER *new)
 {
   bloc_ptr bloc = first_bloc;
 
@@ -1266,7 +1207,7 @@ r_alloc_reset_variable (old, new)
 /* Initialize various things for memory allocation.  */
 
 static void
-r_alloc_init ()
+r_alloc_init (void)
 {
   if (r_alloc_initialized)
     return;
@@ -1314,8 +1255,8 @@ r_alloc_init ()
      even though it is after the sbrk value.  */
   /* Doubly true, with the additional call that explicitly adds the
      rest of that page to the address space.  */
-  bzero (first_heap->start,
-        (char *) first_heap->end - (char *) first_heap->start);
+  memset (first_heap->start, 0,
+         (char *) first_heap->end - (char *) first_heap->start);
   virtual_break_value = break_value = first_heap->bloc_start = first_heap->end;
 #endif
 
index 85ff9b99604465bd4a28d8697508db212eae9b2e..b563d93fe29fd1d6ff295f9ff1a2e4ca5eb0ab5b 100644 (file)
@@ -248,37 +248,16 @@ xrealloc (block, size)
 # endif
 # define realloc xrealloc
 
-/* When used in Emacs's lib-src, we need to get bzero and bcopy somehow.
-   If nothing else has been done, use the method below.  */
-# ifdef INHIBIT_STRING_HEADER
-#  if !(defined HAVE_BZERO && defined HAVE_BCOPY)
-#   if !defined bzero && !defined bcopy
-#    undef INHIBIT_STRING_HEADER
-#   endif
+/* This is the normal way of making sure we have memcpy, memcmp and memset.  */
+# if defined HAVE_STRING_H || defined STDC_HEADERS || defined _LIBC
+#  include <string.h>
+# else
+#  include <strings.h>
+#  ifndef memcmp
+#   define memcmp(s1, s2, n)   bcmp (s1, s2, n)
 #  endif
-# endif
-
-/* This is the normal way of making sure we have memcpy, memcmp and bzero.
-   This is used in most programs--a few other programs avoid this
-   by defining INHIBIT_STRING_HEADER.  */
-# ifndef INHIBIT_STRING_HEADER
-#  if defined HAVE_STRING_H || defined STDC_HEADERS || defined _LIBC
-#   include <string.h>
-#   ifndef bzero
-#    ifndef _LIBC
-#     define bzero(s, n)       (memset (s, '\0', n), (s))
-#    else
-#     define bzero(s, n)       __bzero (s, n)
-#    endif
-#   endif
-#  else
-#   include <strings.h>
-#   ifndef memcmp
-#    define memcmp(s1, s2, n)  bcmp (s1, s2, n)
-#   endif
-#   ifndef memcpy
-#    define memcpy(d, s, n)    (bcopy (s, d, n), (d))
-#   endif
+#  ifndef memcpy
+#   define memcpy(d, s, n)     (bcopy (s, d, n), (d))
 #  endif
 # endif
 
@@ -290,7 +269,6 @@ enum syntaxcode { Swhitespace = 0, Sword = 1, Ssymbol = 2 };
 #  define SWITCH_ENUM_CAST(x) (x)
 
 /* Dummy macros for non-Emacs environments.  */
-# define BASE_LEADING_CODE_P(c) (0)
 # define CHAR_CHARSET(c) 0
 # define CHARSET_LEADING_CODE_BASE(c) 0
 # define MAX_MULTIBYTE_LENGTH 1
@@ -300,7 +278,7 @@ enum syntaxcode { Swhitespace = 0, Sword = 1, Ssymbol = 2 };
 # define CHAR_HEAD_P(p) (1)
 # define SINGLE_BYTE_CHAR_P(c) (1)
 # define SAME_CHARSET_P(c1, c2) (1)
-# define MULTIBYTE_FORM_LENGTH(p, s) (1)
+# define BYTES_BY_CHAR_HEAD(p) (1)
 # define PREV_CHAR_BOUNDARY(p, limit) ((p)--)
 # define STRING_CHAR(p) (*(p))
 # define RE_STRING_CHAR(p, multibyte) STRING_CHAR (p)
@@ -465,7 +443,7 @@ init_syntax_once ()
    if (done)
      return;
 
-   bzero (re_syntax_table, sizeof re_syntax_table);
+   memset (re_syntax_table, 0, sizeof re_syntax_table);
 
    for (c = 0; c < CHAR_SET_SIZE; ++c)
      if (ISALNUM (c))
@@ -1322,8 +1300,7 @@ reg_syntax_t re_syntax_options;
    defined in regex.h.  We return the old syntax.  */
 
 reg_syntax_t
-re_set_syntax (syntax)
-     reg_syntax_t syntax;
+re_set_syntax (reg_syntax_t syntax)
 {
   reg_syntax_t ret = re_syntax_options;
 
@@ -1336,8 +1313,7 @@ WEAK_ALIAS (__re_set_syntax, re_set_syntax)
 static re_char *whitespace_regexp;
 
 void
-re_set_whitespace_regexp (regexp)
-     const char *regexp;
+re_set_whitespace_regexp (const char *regexp)
 {
   whitespace_regexp = (re_char *) regexp;
 }
@@ -2150,8 +2126,7 @@ struct range_table_work_area
 
 /* Map a string to the char class it names (if any).  */
 re_wctype_t
-re_wctype (str)
-     re_char *str;
+re_wctype (const re_char *str)
 {
   const char *string = str;
   if      (STREQ (string, "alnum"))    return RECC_ALNUM;
@@ -2176,9 +2151,7 @@ re_wctype (str)
 
 /* True if CH is in the char class CC.  */
 boolean
-re_iswctype (ch, cc)
-     int ch;
-     re_wctype_t cc;
+re_iswctype (int ch, re_wctype_t cc)
 {
   switch (cc)
     {
@@ -2208,8 +2181,7 @@ re_iswctype (ch, cc)
 /* Return a bit-pattern to use in the range-table bits to match multibyte
    chars of class CC.  */
 static int
-re_wctype_to_bit (cc)
-     re_wctype_t cc;
+re_wctype_to_bit (re_wctype_t cc)
 {
   switch (cc)
     {
@@ -2233,8 +2205,7 @@ re_wctype_to_bit (cc)
 /* Actually extend the space in WORK_AREA.  */
 
 static void
-extend_range_table_work_area (work_area)
-     struct range_table_work_area *work_area;
+extend_range_table_work_area (struct range_table_work_area *work_area)
 {
   work_area->allocated += 16 * sizeof (int);
   if (work_area->table)
@@ -2558,11 +2529,7 @@ do {                                                                     \
   } while (0)
 
 static reg_errcode_t
-regex_compile (pattern, size, syntax, bufp)
-     re_char *pattern;
-     size_t size;
-     reg_syntax_t syntax;
-     struct re_pattern_buffer *bufp;
+regex_compile (const re_char *pattern, size_t size, reg_syntax_t syntax, struct re_pattern_buffer *bufp)
 {
   /* We fetch characters from PATTERN here.  */
   register re_wchar_t c, c1;
@@ -2960,7 +2927,7 @@ regex_compile (pattern, size, syntax, bufp)
            BUF_PUSH ((1 << BYTEWIDTH) / BYTEWIDTH);
 
            /* Clear the whole map.  */
-           bzero (b, (1 << BYTEWIDTH) / BYTEWIDTH);
+           memset (b, 0, (1 << BYTEWIDTH) / BYTEWIDTH);
 
            /* charset_not matches newline according to a syntax bit.  */
            if ((re_opcode_t) b[-2] == charset_not
@@ -3070,7 +3037,7 @@ regex_compile (pattern, size, syntax, bufp)
                           syntax-table for ASCII chars, while the other chars
                           will obey syntax-table properties.  It's not ideal,
                           but it's the way it's been done until now.  */
-                       SETUP_SYNTAX_TABLE (BEGV, 0);
+                       SETUP_BUFFER_SYNTAX_TABLE ();
 
                        for (ch = 0; ch < 256; ++ch)
                          {
@@ -3876,10 +3843,7 @@ regex_compile (pattern, size, syntax, bufp)
 /* Store OP at LOC followed by two-byte integer parameter ARG.  */
 
 static void
-store_op1 (op, loc, arg)
-    re_opcode_t op;
-    unsigned char *loc;
-    int arg;
+store_op1 (re_opcode_t op, unsigned char *loc, int arg)
 {
   *loc = (unsigned char) op;
   STORE_NUMBER (loc + 1, arg);
@@ -3889,10 +3853,7 @@ store_op1 (op, loc, arg)
 /* Like `store_op1', but for two two-byte parameters ARG1 and ARG2.  */
 
 static void
-store_op2 (op, loc, arg1, arg2)
-    re_opcode_t op;
-    unsigned char *loc;
-    int arg1, arg2;
+store_op2 (re_opcode_t op, unsigned char *loc, int arg1, int arg2)
 {
   *loc = (unsigned char) op;
   STORE_NUMBER (loc + 1, arg1);
@@ -3904,11 +3865,7 @@ store_op2 (op, loc, arg1, arg2)
    for OP followed by two-byte integer parameter ARG.  */
 
 static void
-insert_op1 (op, loc, arg, end)
-    re_opcode_t op;
-    unsigned char *loc;
-    int arg;
-    unsigned char *end;
+insert_op1 (re_opcode_t op, unsigned char *loc, int arg, unsigned char *end)
 {
   register unsigned char *pfrom = end;
   register unsigned char *pto = end + 3;
@@ -3923,11 +3880,7 @@ insert_op1 (op, loc, arg, end)
 /* Like `insert_op1', but for two two-byte parameters ARG1 and ARG2.  */
 
 static void
-insert_op2 (op, loc, arg1, arg2, end)
-    re_opcode_t op;
-    unsigned char *loc;
-    int arg1, arg2;
-    unsigned char *end;
+insert_op2 (re_opcode_t op, unsigned char *loc, int arg1, int arg2, unsigned char *end)
 {
   register unsigned char *pfrom = end;
   register unsigned char *pto = end + 5;
@@ -3944,9 +3897,7 @@ insert_op2 (op, loc, arg1, arg2, end)
    least one character before the ^.  */
 
 static boolean
-at_begline_loc_p (pattern, p, syntax)
-    re_char *pattern, *p;
-    reg_syntax_t syntax;
+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] == '\\';
@@ -3968,9 +3919,7 @@ at_begline_loc_p (pattern, p, syntax)
    at least one character after the $, i.e., `P < PEND'.  */
 
 static boolean
-at_endline_loc_p (p, pend, syntax)
-    re_char *p, *pend;
-    reg_syntax_t syntax;
+at_endline_loc_p (const re_char *p, const re_char *pend, reg_syntax_t syntax)
 {
   re_char *next = p;
   boolean next_backslash = *next == '\\';
@@ -3990,9 +3939,7 @@ at_endline_loc_p (p, pend, syntax)
    false if it's not.  */
 
 static boolean
-group_in_compile_stack (compile_stack, regnum)
-    compile_stack_type compile_stack;
-    regnum_t regnum;
+group_in_compile_stack (compile_stack_type compile_stack, regnum_t regnum)
 {
   int this_element;
 
@@ -4016,10 +3963,7 @@ group_in_compile_stack (compile_stack, regnum)
    Return -1 if fastmap was not updated accurately.  */
 
 static int
-analyse_first (p, pend, fastmap, multibyte)
-     re_char *p, *pend;
-     char *fastmap;
-     const int multibyte;
+analyse_first (const re_char *p, const re_char *pend, char *fastmap, const int multibyte)
 {
   int j, k;
   boolean not;
@@ -4331,15 +4275,14 @@ analyse_first (p, pend, fastmap, multibyte)
    Returns 0 if we succeed, -2 if an internal error.   */
 
 int
-re_compile_fastmap (bufp)
-     struct re_pattern_buffer *bufp;
+re_compile_fastmap (struct re_pattern_buffer *bufp)
 {
   char *fastmap = bufp->fastmap;
   int analysis;
 
   assert (fastmap && bufp->buffer);
 
-  bzero (fastmap, 1 << BYTEWIDTH);  /* Assume nothing's valid.  */
+  memset (fastmap, 0, 1 << BYTEWIDTH);  /* Assume nothing's valid.  */
   bufp->fastmap_accurate = 1;      /* It will be when we're done.  */
 
   analysis = analyse_first (bufp->buffer, bufp->buffer + bufp->used,
@@ -4362,11 +4305,7 @@ re_compile_fastmap (bufp)
    freeing the old data.  */
 
 void
-re_set_registers (bufp, regs, num_regs, starts, ends)
-    struct re_pattern_buffer *bufp;
-    struct re_registers *regs;
-    unsigned num_regs;
-    regoff_t *starts, *ends;
+re_set_registers (struct re_pattern_buffer *bufp, struct re_registers *regs, unsigned int num_regs, regoff_t *starts, regoff_t *ends)
 {
   if (num_regs)
     {
@@ -4390,11 +4329,7 @@ WEAK_ALIAS (__re_set_registers, re_set_registers)
    doesn't let you say where to stop matching. */
 
 int
-re_search (bufp, string, size, startpos, range, regs)
-     struct re_pattern_buffer *bufp;
-     const char *string;
-     int size, startpos, range;
-     struct re_registers *regs;
+re_search (struct re_pattern_buffer *bufp, const char *string, int size, int startpos, int range, struct re_registers *regs)
 {
   return re_search_2 (bufp, NULL, 0, string, size, startpos, range,
                      regs, size);
@@ -4435,14 +4370,7 @@ WEAK_ALIAS (__re_search, re_search)
    stack overflow).  */
 
 int
-re_search_2 (bufp, str1, size1, str2, size2, startpos, range, regs, stop)
-     struct re_pattern_buffer *bufp;
-     const char *str1, *str2;
-     int size1, size2;
-     int startpos;
-     int range;
-     struct re_registers *regs;
-     int stop;
+re_search_2 (struct re_pattern_buffer *bufp, const char *str1, int size1, const char *str2, int size2, int startpos, int range, struct re_registers *regs, int stop)
 {
   int val;
   re_char *string1 = (re_char*) str1;
@@ -4496,7 +4424,7 @@ re_search_2 (bufp, str1, size1, str2, size2, startpos, range, regs, stop)
   anchored_start = (bufp->buffer[0] == begline);
 
 #ifdef emacs
-  gl_state.object = re_match_object;
+  gl_state.object = re_match_object; /* Used by SYNTAX_TABLE_BYTE_TO_CHAR. */
   {
     int charpos = SYNTAX_TABLE_BYTE_TO_CHAR (POS_AS_IN_BUFFER (startpos));
 
@@ -4643,7 +4571,7 @@ re_search_2 (bufp, str1, size1, str2, size2, startpos, range, regs, stop)
            {
              re_char *p = POS_ADDR_VSTRING (startpos);
              re_char *pend = STOP_ADDR_VSTRING (startpos);
-             int len = MULTIBYTE_FORM_LENGTH (p, pend - p);
+             int len = BYTES_BY_CHAR_HEAD (*p);
 
              range -= len;
              if (range < 0)
@@ -4776,8 +4704,7 @@ static int bcmp_translate _RE_ARGS((re_char *s1, re_char *s2,
 /* If the operation is a match against one or more chars,
    return a pointer to the next operation, else return NULL.  */
 static re_char *
-skip_one_char (p)
-     re_char *p;
+skip_one_char (const re_char *p)
 {
   switch (SWITCH_ENUM_CAST (*p++))
     {
@@ -4819,8 +4746,7 @@ skip_one_char (p)
 
 /* Jump over non-matching operations.  */
 static re_char *
-skip_noops (p, pend)
-     re_char *p, *pend;
+skip_noops (const re_char *p, const re_char *pend)
 {
   int mcnt;
   while (p < pend)
@@ -4847,9 +4773,7 @@ skip_noops (p, pend)
 
 /* Non-zero if "p1 matches something" implies "p2 fails".  */
 static int
-mutually_exclusive_p (bufp, p1, p2)
-     struct re_pattern_buffer *bufp;
-     re_char *p1, *p2;
+mutually_exclusive_p (struct re_pattern_buffer *bufp, const re_char *p1, const re_char *p2)
 {
   re_opcode_t op2;
   const boolean multibyte = RE_MULTIBYTE_P (bufp);
@@ -5087,19 +5011,13 @@ Lisp_Object re_match_object;
    matched substring.  */
 
 int
-re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
-     struct re_pattern_buffer *bufp;
-     const char *string1, *string2;
-     int size1, size2;
-     int pos;
-     struct re_registers *regs;
-     int stop;
+re_match_2 (struct re_pattern_buffer *bufp, const char *string1, int size1, const char *string2, int size2, int pos, struct re_registers *regs, int stop)
 {
   int result;
 
 #ifdef emacs
   int charpos;
-  gl_state.object = re_match_object;
+  gl_state.object = re_match_object; /* Used by SYNTAX_TABLE_BYTE_TO_CHAR. */
   charpos = SYNTAX_TABLE_BYTE_TO_CHAR (POS_AS_IN_BUFFER (pos));
   SETUP_SYNTAX_TABLE_FOR_OBJECT (re_match_object, charpos, 1);
 #endif
@@ -5115,13 +5033,7 @@ WEAK_ALIAS (__re_match_2, re_match_2)
 /* This is a separate function so that we can force an alloca cleanup
    afterwards.  */
 static int
-re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
-     struct re_pattern_buffer *bufp;
-     re_char *string1, *string2;
-     int size1, size2;
-     int pos;
-     struct re_registers *regs;
-     int stop;
+re_match_2_internal (struct re_pattern_buffer *bufp, const re_char *string1, int size1, const re_char *string2, int size2, int pos, struct re_registers *regs, int stop)
 {
   /* General temporaries.  */
   int mcnt;
@@ -6452,11 +6364,8 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
    bytes; nonzero otherwise.  */
 
 static int
-bcmp_translate (s1, s2, len, translate, target_multibyte)
-     re_char *s1, *s2;
-     register int len;
-     RE_TRANSLATE_TYPE translate;
-     const int target_multibyte;
+bcmp_translate (const re_char *s1, const re_char *s2, register int len,
+               RE_TRANSLATE_TYPE translate, const int target_multibyte)
 {
   register re_char *p1 = s1, *p2 = s2;
   re_char *p1_end = s1 + len;
@@ -6497,17 +6406,10 @@ bcmp_translate (s1, s2, len, translate, target_multibyte)
    We call regex_compile to do the actual compilation.  */
 
 const char *
-re_compile_pattern (pattern, length, bufp)
-     const char *pattern;
-     size_t length;
-     struct re_pattern_buffer *bufp;
+re_compile_pattern (const char *pattern, size_t length, struct re_pattern_buffer *bufp)
 {
   reg_errcode_t ret;
 
-#ifdef emacs
-  gl_state.current_syntax_table = current_buffer->syntax_table;
-#endif
-
   /* GNU code is written to assume at least RE_NREGS registers will be set
      (and at least one extra will be -1).  */
   bufp->regs_allocated = REGS_UNALLOCATED;
index d03d7df0bda78a92836ff766ab08dc1eab8933e6..45eb723c88567e0c89e351ca52a14f774e716e1e 100644 (file)
@@ -122,13 +122,13 @@ struct region_cache {
    preserve that information, instead of throwing it away.  */
 #define PRESERVE_THRESHOLD (500)
 
-static void revalidate_region_cache ();
+static void revalidate_region_cache (struct buffer *buf, struct region_cache *c);
 
 \f
 /* Interface: Allocating, initializing, and disposing of region caches.  */
 
 struct region_cache *
-new_region_cache ()
+new_region_cache (void)
 {
   struct region_cache *c
     = (struct region_cache *) xmalloc (sizeof (struct region_cache));
@@ -156,8 +156,7 @@ new_region_cache ()
 }
 
 void
-free_region_cache (c)
-     struct region_cache *c;
+free_region_cache (struct region_cache *c)
 {
   xfree (c->boundaries);
   xfree (c);
@@ -174,9 +173,7 @@ free_region_cache (c)
    entries.  It would be nice if it took advantage of locality of
    reference, too, by searching entries near the last entry found.  */
 static int
-find_cache_boundary (c, pos)
-     struct region_cache *c;
-     int pos;
+find_cache_boundary (struct region_cache *c, int pos)
 {
   int low = 0, high = c->cache_len;
 
@@ -210,10 +207,7 @@ find_cache_boundary (c, pos)
 /* Move the gap of cache C to index POS, and make sure it has space
    for at least MIN_SIZE boundaries.  */
 static void
-move_cache_gap (c, pos, min_size)
-     struct region_cache *c;
-     int pos;
-     int min_size;
+move_cache_gap (struct region_cache *c, int pos, int min_size)
 {
   /* Copy these out of the cache and into registers.  */
   int gap_start = c->gap_start;
@@ -298,10 +292,7 @@ move_cache_gap (c, pos, min_size)
 /* Insert a new boundary in cache C; it will have cache index INDEX,
    and have the specified POS and VALUE.  */
 static void
-insert_cache_boundary (c, index, pos, value)
-     struct region_cache *c;
-     int index;
-     int pos, value;
+insert_cache_boundary (struct region_cache *c, int index, int pos, int value)
 {
   /* index must be a valid cache index.  */
   if (index < 0 || index > c->cache_len)
@@ -337,9 +328,7 @@ insert_cache_boundary (c, index, pos, value)
 /* Delete the i'th entry from cache C if START <= i < END.  */
 
 static void
-delete_cache_boundaries (c, start, end)
-     struct region_cache *c;
-     int start, end;
+delete_cache_boundaries (struct region_cache *c, int start, int end)
 {
   int len = end - start;
 
@@ -391,10 +380,7 @@ delete_cache_boundaries (c, start, end)
 
 /* Set the value in cache C for the region START..END to VALUE.  */
 static void
-set_cache_region (c, start, end, value)
-     struct region_cache *c;
-     int start, end;
-     int value;
+set_cache_region (struct region_cache *c, int start, int end, int value)
 {
   if (start > end)
     abort ();
@@ -495,10 +481,7 @@ set_cache_region (c, start, end, value)
    buffer positions in the presence of insertions and deletions; the
    args to pass are the same before and after such an operation.)  */
 void
-invalidate_region_cache (buf, c, head, tail)
-     struct buffer *buf;
-     struct region_cache *c;
-     int head, tail;
+invalidate_region_cache (struct buffer *buf, struct region_cache *c, int head, int tail)
 {
   /* Let chead = c->beg_unchanged, and
          ctail = c->end_unchanged.
@@ -576,9 +559,7 @@ invalidate_region_cache (buf, c, head, tail)
    the cache, and causes cache gap motion.  */
 
 static void
-revalidate_region_cache (buf, c)
-     struct buffer *buf;
-     struct region_cache *c;
+revalidate_region_cache (struct buffer *buf, struct region_cache *c)
 {
   /* The boundaries now in the cache are expressed relative to the
      buffer_beg and buffer_end values stored in the cache.  Now,
@@ -706,10 +687,7 @@ revalidate_region_cache (buf, c)
    buffer positions) is "known," for the purposes of CACHE (e.g. "has
    no newlines", in the case of the line cache).  */
 void
-know_region_cache (buf, c, start, end)
-     struct buffer *buf;
-     struct region_cache *c;
-     int start, end;
+know_region_cache (struct buffer *buf, struct region_cache *c, int start, int end)
 {
   revalidate_region_cache (buf, c);
 
@@ -723,11 +701,7 @@ know_region_cache (buf, c, start, end)
    the purposes of CACHE.  If NEXT is non-zero, set *NEXT to the nearest
    position after POS where the knownness changes.  */
 int
-region_cache_forward (buf, c, pos, next)
-     struct buffer *buf;
-     struct region_cache *c;
-     int pos;
-     int *next;
+region_cache_forward (struct buffer *buf, struct region_cache *c, int pos, int *next)
 {
   revalidate_region_cache (buf, c);
 
@@ -762,11 +736,7 @@ region_cache_forward (buf, c, pos, next)
 /* Return true if the text immediately before POS in BUF is known, for
    the purposes of CACHE.  If NEXT is non-zero, set *NEXT to the nearest
    position before POS where the knownness changes.  */
-int region_cache_backward (buf, c, pos, next)
-     struct buffer *buf;
-     struct region_cache *c;
-     int pos;
-     int *next;
+int region_cache_backward (struct buffer *buf, struct region_cache *c, int pos, int *next)
 {
   revalidate_region_cache (buf, c);
 
@@ -804,8 +774,7 @@ int region_cache_backward (buf, c, pos, next)
 /* Debugging: pretty-print a cache to the standard error output.  */
 
 void
-pp_cache (c)
-     struct region_cache *c;
+pp_cache (struct region_cache *c)
 {
   int i;
   int beg_u = c->buffer_beg + c->beg_unchanged;
index 4a717d660818174a31469eb1c7403a3ed6006e0f..e2972f2ea0a17487c6610a8090d4aa3d943fe169 100644 (file)
@@ -61,17 +61,17 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 
 /* Allocate, initialize and return a new, empty region cache.  */
-struct region_cache *new_region_cache P_ ((void));
+struct region_cache *new_region_cache (void);
 
 /* Free a region cache.  */
-void free_region_cache P_ ((struct region_cache *));
+void free_region_cache (struct region_cache *);
 
 /* Assert that the region of BUF between START and END (absolute
    buffer positions) is "known," for the purposes of CACHE (e.g. "has
    no newlines", in the case of the line cache).  */
-extern void know_region_cache P_ ((struct buffer *BUF,
-                                   struct region_cache *CACHE,
-                                   int START, int END));
+extern void know_region_cache (struct buffer *BUF,
+                               struct region_cache *CACHE,
+                               int START, int END);
 
 /* Indicate that a section of BUF has changed, to invalidate CACHE.
    HEAD is the number of chars unchanged at the beginning of the buffer.
@@ -81,9 +81,9 @@ extern void know_region_cache P_ ((struct buffer *BUF,
    (This way of specifying regions makes more sense than absolute
    buffer positions in the presence of insertions and deletions; the
    args to pass are the same before and after such an operation.)  */
-extern void invalidate_region_cache P_ ((struct buffer *BUF,
-                                        struct region_cache *CACHE,
-                                        int HEAD, int TAIL));
+extern void invalidate_region_cache (struct buffer *BUF,
+                                     struct region_cache *CACHE,
+                                     int HEAD, int TAIL);
 
 /* The scanning functions.
 
@@ -97,18 +97,18 @@ extern void invalidate_region_cache P_ ((struct buffer *BUF,
 /* Return true if the text immediately after POS in BUF is known, for
    the purposes of CACHE.  If NEXT is non-zero, set *NEXT to the nearest
    position after POS where the knownness changes.  */
-extern int region_cache_forward P_ ((struct buffer *BUF,
-                                     struct region_cache *CACHE,
-                                     int POS,
-                                     int *NEXT));
+extern int region_cache_forward (struct buffer *BUF,
+                                 struct region_cache *CACHE,
+                                 int POS,
+                                 int *NEXT);
 
 /* Return true if the text immediately before POS in BUF is known, for
    the purposes of CACHE.  If NEXT is non-zero, set *NEXT to the nearest
    position before POS where the knownness changes.  */
-extern int region_cache_backward P_ ((struct buffer *BUF,
-                                      struct region_cache *CACHE,
-                                      int POS,
-                                      int *NEXT));
+extern int region_cache_backward (struct buffer *BUF,
+                                  struct region_cache *CACHE,
+                                  int POS,
+                                  int *NEXT);
 
 /* arch-tag: 70f79125-ef22-4f58-9aec-a48ca2791435
    (do not change this comment) */
index 29a68dbf6e3052f133fe64493e9220d3917222c0..0a3d48db63974a947dcdf85b6c266488943f43b7 100644 (file)
@@ -1,6 +1,6 @@
 /*
-Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
-  Free Software Foundation, Inc.
+Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
+  2010  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -17,135 +17,60 @@ 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 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  ??????? */
+/* 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 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_TERMIO if the system provides sysV-style ioctls
- *     for terminal control.
- */
-
+/* Define HAVE_TERMIO if the system provides sysV-style ioctls
+   for terminal control.  */
 #define HAVE_TERMIOS
 
-/*
- *     Define HAVE_PTYS if the system supports pty devices.
- */
-
+/* 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 SYSV_SYSTEM_DIR to use the V.3 getdents/readir
- *     library functions.  Almost, but not quite the same as
- *     the 4.2 functions
- */
-
-#define SYSV_SYSTEM_DIR
-
-/* Define this symbol if your system has the functions bcopy, etc. */
-
-#define BSTRING
-
 /* The file containing the kernel's symbol table is called /unix.  */
-
 #define KERNEL_FILE "/unix"
 
-/* The symbol in the kernel where the load average is found
-   is named avenrun.  */
-
+/* The kernel symbol where the load average is found is named avenrun.  */
 #define LDAV_SYMBOL "avenrun"
 \f
-/* Special itemss needed to make Emacs run on this system.  */
-
-#ifndef __GNUC__
-#define LINKER cc
-#endif
-
-/* Prevent -lg from being used for debugging.  Not needed.  */
-
-#define LIBS_DEBUG
-
-/* No need to specify -lc when linking.  */
-
-#define LIB_STANDARD
-
-/* Use terminfo instead of termcap.  */
-
-#define TERMINFO
-
-/* The following definition seems to be needed in AIX version 3.1.6.8.
-   It may not have been needed in certain earlier versions.  */
-#define HAVE_TCATTR
-
-/* Include unistd.h, even though we don't define POSIX.  */
-#define NEED_UNISTD_H
+/* Special items needed to make Emacs run on this system.  */
 
 /* AIX doesn't define this.  */
 #define unix 1
 
-#ifndef __GNUC__
-/* Some programs in src produce warnings saying certain subprograms
-   are to comples and need a MAXMEM value greater than 2000 for
-   additional optimization.  --nils@exp-math.uni-essen.de */
-#define C_SWITCH_SYSTEM -ma -qmaxmem=4000
-#endif
-
 /* string.h defines rindex as a macro, at least with native cc, so we
    lose declaring char * rindex without this.
    It is just a guess which versions of AIX need this definition.  */
 #undef HAVE_STRING_H
 
-/* For AIX, it turns out compiling emacs under AIX 3.2.4 REQUIRES "cc -g"
-   because "cc -O" crashes. Under AIX 3.2.5, "cc -O" is required because
-   "cc -g" crashes. Go figure.  --floppy@merlin.mit.edu */
-/* The above isn't generally true.  If it occurs with some compiler
-   release, seek a fixed version, be it XLC or GCC.  The XLC version
-   isn't tied to the OS version on AIX any more than elsewhere.  XLC
-   (the IBM compiler) can use -g with -O.  (-O3 is also a possibility
-   for the optimization level.)  -- fx, after David Edelsohn.  */
-#define C_DEBUG_SWITCH -g -O
-
 /* Perry Smith <pedz@ddivt1.austin.ibm.com> says these are correct.  */
 #define SIGNALS_VIA_CHARACTERS
-#define MAIL_USE_LOCKF
 #define CLASH_DETECTION
 
 /* Perry Smith <pedz@ddivt1.austin.ibm.com> says these are correct.  */
-#define POSIX_SIGNALS
 #undef sigmask
 
-/* olson@mcs.anl.gov says -li18n is needed by -lXm.  */
-#define LIB_MOTIF -lXm -li18n
-
 #ifndef HAVE_LIBXMU
-#define LIBXMU
-
 /* Unfortunately without libXmu we cannot support EditRes.  */
 #define NO_EDITRES
 #endif
@@ -153,19 +78,18 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* 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. 
+   xrealloc on the results of such functions results in a crash.
 
-   One solution for this could be to define SYSTEM_MALLOC here, but
-   that does not currently work on this system.
+   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
-   tha shared library.
-   
+   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.
-*/
+   to avoid a crash just use the Emacs implementation for that function.  */
 #define BROKEN_GET_CURRENT_DIR_NAME 1
 
 /* arch-tag: 38fe75ea-6aef-42bd-8449-bc34d921a562
index 8094f50d3173e88a61f8ffe91e840a1087720993..bf78f4ec3475865c32b87430873af370cb27c894 100644 (file)
@@ -1,6 +1,7 @@
 /* Definitions file for GNU Emacs running on bsd 4.3
-   Copyright (C) 1985, 1986, 2001, 2002, 2003, 2004, 2005, 2006,
-                 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
+
+Copyright (C) 1985, 1986, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+  2008, 2009, 2010  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -18,10 +19,8 @@ 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 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.  */
@@ -33,58 +32,55 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #define BSD_SYSTEM 43
 #endif /* BSD_SYSTEM */
 
+/* For mem-limits.h.  */
+#define BSD4_2
+
+#define TABDLY OXTABS
+#define TAB3 OXTABS
+
+/* These aren't needed, since we have getloadavg.  */
+#undef KERNEL_FILE
+#undef LDAV_SYMBOL
+
+#define HAVE_TERMIOS
+#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 if the system supports pty devices.  */
 #define HAVE_PTYS
 
 /* Define HAVE_SOCKETS if system supports 4.2-compatible sockets.  */
-
 #define HAVE_SOCKETS
 
-/* Define this symbol if your system has the functions bcopy, etc. */
-
-#define BSTRING
-
-/* define MAIL_USE_FLOCK if the mailer uses flock
-   to interlock access to /usr/spool/mail/$USER.
-   The alternative is that a lock file named
-   /usr/spool/mail/$USER.lock.  */
-
-#define MAIL_USE_FLOCK
-
 /* 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
 
 /* The file containing the kernel's symbol table is called /vmunix.  */
-
 #define KERNEL_FILE "/vmunix"
 
-/* The symbol in the kernel where the load average is found
-   is named _avenrun.  */
-
+/* The kernel symbol where the load average is found is named _avenrun.  */
 #define LDAV_SYMBOL "_avenrun"
 
 /* Send signals to subprocesses by "typing" special chars at them.  */
-
 #define SIGNALS_VIA_CHARACTERS
 
 /* arch-tag: 0c367245-bde3-492e-9029-3ff6898beb95
index 9ca5c67ce378b758efd14b523538cf17a00a2c5f..1b78ada53bdbbb2961fd60169169ca557adf9d58 100644 (file)
@@ -1,6 +1,7 @@
 /* System description header file for Cygwin.
-   Copyright (C) 1985, 1986, 1992, 1999, 2002, 2003, 2004, 2005, 2006,
-                 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+
+Copyright (C) 1985, 1986, 1992, 1999, 2002, 2003, 2004, 2005, 2006,
+  2007, 2008, 2009, 2010  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -18,8 +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/>.  */
 
 /* SYSTEM_TYPE should indicate the kind of system you are using.
- It sets the Lisp variable system-type.  */
-
+   It sets the Lisp variable system-type.  */
 #define SYSTEM_TYPE "cygwin"
 
 /* Emacs can read input using SIGIO and buffering characters itself,
@@ -43,26 +43,19 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    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_TERMIOS if the system provides POSIX-style
- *     functions and macros for terminal control.
- *
- *     Define HAVE_TERMIO if the system provides sysV-style ioctls
- *     for terminal control.
- *
- *     Do not define both.  HAVE_TERMIOS is preferred, if it is
- *     supported on your system.
- */
+/* Define HAVE_TERMIOS if the system provides POSIX-style
+   functions and macros for terminal control.
 
-#define HAVE_TERMIOS
+   Define HAVE_TERMIO if the system provides sysV-style ioctls
+   for terminal control.
 
-/*
- *     Define HAVE_PTYS if the system supports pty devices.
- */
+   Do not define both.  HAVE_TERMIOS is preferred, if it is
+   supported on your system.  */
+#define HAVE_TERMIOS
 
+/* Define HAVE_PTYS if the system supports pty devices.  */
 #define HAVE_PTYS
 #define PTY_ITERATION          for (i = 0; i < 1; i++) /* ick */
 #define PTY_NAME_SPRINTF       /* none */
@@ -80,14 +73,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
     }                                                  \
   while (0)
 
-/* Define this symbol if your system has the functions bcopy, etc. */
-
-#define BSTRING
-
 /* 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'
@@ -95,21 +83,12 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    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 */
+/* Used in various places to enable cygwin-specific code changes.  */
 #define CYGWIN 1
 
 #define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base)
-#define SYSV_SYSTEM_DIR 1
-#define UNEXEC unexcw.o
-#define POSIX_SIGNALS 1
-#define LINKER $(CC)
-
-/* Use terminfo instead of termcap.  Fewer environment variables to
-   go wrong, more terminal types. */
-#define TERMINFO
 
 #define HAVE_SOCKETS
 
@@ -132,7 +111,5 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    returns ENOSYS.  A workaround is to set G_SLICE=always-malloc. */
 #define G_SLICE_ALWAYS_MALLOC
 
-/* the end */
-
 /* arch-tag: 5ae7ba00-83b0-4ab3-806a-3e845779191b
    (do not change this comment) */
index ab7c07172876258fef8ee51f88521bab03e02833..146bfd693a2c2936513f779c49f0c884be259d9d 100644 (file)
@@ -1,6 +1,7 @@
 /* System description header file for Darwin (Mac OS X).
-   Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-                 2008, 2009, 2010 Free Software Foundation, Inc.
+
+Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
+  2010  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -18,11 +19,8 @@ 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 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
@@ -30,14 +28,12 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* 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. */
-
+   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.  */
-
+   It sets the Lisp variable system-type.  */
 #define SYSTEM_TYPE "darwin"
 
 /* Emacs can read input using SIGIO and buffering characters itself,
@@ -61,37 +57,27 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    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 HAVE_TERMIOS if the system provides POSIX-style
- *     functions and macros for terminal control.
- *
- *     Define HAVE_TERMIO if the system provides sysV-style ioctls
- *     for terminal control.
- *
- *     Do not define both.  HAVE_TERMIOS is preferred, if it is
- *     supported on your system.
- */
+/* Define HAVE_TERMIOS if the system provides POSIX-style
+   functions and macros for terminal control.
 
-#define HAVE_TERMIOS
+   Define HAVE_TERMIO if the system provides sysV-style ioctls
+   for terminal control.
 
+   Do not define both.  HAVE_TERMIOS is preferred, if it is supported
+   on your system. */
+#define HAVE_TERMIOS
 #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 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'.  */
+/* Run only once.  We need a `for'-loop because the code uses `continue'.  */
 #define PTY_ITERATION  for (i = 0; i < 1; i++)
 #define PTY_NAME_SPRINTF       /* none */
 #define PTY_TTY_NAME_SPRINTF   /* none */
@@ -109,28 +95,13 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
     }                                                          \
   while (0)
 
-/**
- * PTYs only work correctly on Darwin 7 or higher.  So make the
- * default for process-connection-type dependent on the kernel
- * version.
- */
+/* 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 this symbol if your system has the functions bcopy, etc. */
-
-#define BSTRING
-
-/* define MAIL_USE_FLOCK if the mailer uses flock
-   to interlock access to /usr/spool/mail/$USER.
-   The alternative is that a lock file named
-   /usr/spool/mail/$USER.lock.  */
-
-#define MAIL_USE_FLOCK
-
 /* 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
@@ -140,79 +111,30 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* 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.)  */
+/* System uses OXTABS instead of the expected TAB3.  (Copied from bsd386.h.)  */
 #define TAB3 OXTABS
 
-/* Darwin ld insists on the use of malloc routines in the System
-   framework.  */
-#define SYSTEM_MALLOC
-
 /* Define HAVE_SOCKETS if system supports 4.2-compatible sockets.  */
 #define HAVE_SOCKETS
 
-/* Definitions for how to dump.  Copied from nextstep.h.  */
-
-#define UNEXEC unexmacosx.o
-
-#define START_FILES pre-crt0.o
-
-/* start_of_text isn't actually used, so make it compile without error.  */
-#define TEXT_START (0)
-
 /* Definitions for how to compile & link.  */
-
 #ifdef HAVE_NS
-#define LIBS_NSGUI -framework AppKit
 #define SYSTEM_PURESIZE_EXTRA 200000
-#define HEADERPAD_EXTRA 6C8
-#else /* !HAVE_NS */
-#define LIBS_NSGUI
-#define HEADERPAD_EXTRA 690
-#endif /* !HAVE_NS */
+#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
 
-/* The -headerpad option tells ld (see man page) to leave room at the
-   end of the header for adding load commands.  Needed for dumping.
-   0x690 is the total size of 30 segment load commands (at 56
-   each); under Cocoa 31 commands are required.  */
-#define LD_SWITCH_SYSTEM_TEMACS -prebind LIBS_NSGUI -Xlinker -headerpad -Xlinker HEADERPAD_EXTRA
-
-#define C_SWITCH_SYSTEM_TEMACS -Dtemacs
-
-#ifdef temacs
+#ifdef emacs
 #define malloc unexec_malloc
 #define realloc unexec_realloc
 #define free unexec_free
-/* Don't use posix_memalign because it is not compatible with
-   unexmacosx.c.  */
+/* Don't use posix_memalign because it is not compatible with unexmacosx.c.  */
 #undef HAVE_POSIX_MEMALIGN
 #endif
 
-/* 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.  */
-#ifdef HAVE_LIBNCURSES
-#define LIBS_TERMCAP -lncurses
-/* This prevents crashes when running Emacs in Terminal.app under
-   10.2.  */
-#define TERMINFO
-#endif
-
-/* Link this program just by running cc.  */
-#define ORDINARY_LINK
-
-/* We don't have a g library, so override the -lg LIBS_DEBUG switch.  */
-#define LIBS_DEBUG
-
-/* Adding -lm confuses the dynamic linker, so omit it.  */
-#define LIB_MATH
-
 /* Define the following so emacs symbols will not conflict with those
    in the System framework.  Otherwise -prebind will not work.  */
 
@@ -234,12 +156,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    ioctl TIOCSCTTY.  */
 #define DONT_REOPEN_PTY
 
-/* This makes create_process in process.c save and restore signal
-   handlers correctly.  Suggested by Nozomu Ando.*/
-#define POSIX_SIGNALS
-
-/* Use the GC_MAKE_GCPROS_NOOPS (see lisp.h) method for marking the
-   stack.  */
+/* Use the GC_MAKE_GCPROS_NOOPS (see lisp.h) method for marking the stack.  */
 #define GC_MARK_STACK   GC_MAKE_GCPROS_NOOPS
 
 /* arch-tag: 481d443d-4f89-43ea-b5fb-49706d95fa41
index e13941d2dcc9df342d2b154986ee6d8b426fe2a3..cfed343d6c552908898cd0a65b5cf49018320c29 100644 (file)
@@ -1,9 +1,8 @@
 /* System description header for FreeBSD systems.
-   This file describes the parameters that system description files
-   should define or not.
-   Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-                 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
-                 Free Software Foundation, Inc.
+
+Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+  2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+  Free Software Foundation, Inc.
 
 Author: Shawn M. Carey
 (according to authors.el)
@@ -23,86 +22,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/>.  */
 
-/* Get the correct __FreeBSD_version, even if this is before that was
-   defined. */
-#ifndef __FreeBSD_version
-#ifndef __FreeBSD__
-#define __FreeBSD_version 199401
-#elif __FreeBSD__ == 1
-#define __FreeBSD_version 199405
-#else
-#include <osreldate.h>
-#endif
-#endif /* !defined __FreeBSD_version */
-
-/* '__FreeBSD__' is defined by the preprocessor on FreeBSD-1.1 and up.
-   Earlier versions do not have shared libraries, so inhibit them.
-   You can inhibit them on newer systems if you wish
-   by defining NO_SHARED_LIBS.  */
-#ifndef __FreeBSD__
-#define NO_SHARED_LIBS
-#endif
-
 /* Get most of the stuff from bsd-common */
 #include "bsd-common.h"
 
-/* For mem-limits.h. */
-#define BSD4_2
-
-/* These aren't needed, since we have getloadavg.  */
-#undef KERNEL_FILE
-#undef LDAV_SYMBOL
-
 #define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base)
 
-#define LIBS_DEBUG
-#define LIBS_SYSTEM -lutil
-#if __FreeBSD_version < 400000
-#define LIBS_TERMCAP -ltermcap
-#else
-#define TERMINFO
-#define LIBS_TERMCAP -lncurses
-#endif
-
-#define SYSV_SYSTEM_DIR
-
-/* freebsd has POSIX-style pgrp behavior. */
-#undef BSD_PGRPS
-
-#ifdef __ELF__
-
-/* 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.  */
-
-#define LD_SWITCH_SYSTEM  -L/usr/local/lib
-#define START_FILES pre-crt0.o /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtbegin.o
-#define UNEXEC unexelf.o
-#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib/crtend.o /usr/lib/crtn.o
-#undef LIB_GCC
-#define LIB_GCC
-
-#else /* not __ELF__ */
-
-#ifdef NO_SHARED_LIBS
-#ifdef __FreeBSD__  /* shared libs are available, but the user prefers
-                     not to use them.  */
-#define LD_SWITCH_SYSTEM -Bstatic -L/usr/local/lib
-#endif /* __FreeBSD__ */
-#endif /* NO_SHARED_LIBS */
-
-#endif /* not __ELF__ */
-
 #define HAVE_GETLOADAVG 1
-#define HAVE_TERMIOS
-#define NO_TERMIO
-#define DECLARE_GETPWUID_WITH_UID_T
 
-/* freebsd uses OXTABS instead of the expected TAB3. */
-#define TABDLY OXTABS
-#define TAB3 OXTABS
-
-/* this silences a few compilation warnings */
+/* This silences a few compilation warnings.  */
 #undef BSD_SYSTEM
 #if __FreeBSD__ == 1
 #define BSD_SYSTEM 199103
@@ -117,21 +44,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    ioctl TIOCSCTTY.  */
 #define DONT_REOPEN_PTY
 
-/* 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
-
-/* The following is needed to make `configure' find Xpm, Xaw3d and
-   image include and library files if using /usr/bin/gcc.  That
-   compiler seems to be modified to not find headers in
-   /usr/local/include or libs in /usr/local/lib by default.  */
-
-#define C_SWITCH_SYSTEM -I/usr/X11R6/include -I/usr/local/include -L/usr/local/lib
-
 /* Circumvent a bug in FreeBSD.  In the following sequence of
    writes/reads on a PTY, read(2) returns bogus data:
 
@@ -145,37 +57,14 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    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.  */
-
+   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.  */
-
+/* Use the GC_MAKE_GCPROS_NOOPS (see lisp.h) method for marking the stack.  */
 #define GC_MARK_STACK  GC_MAKE_GCPROS_NOOPS
 
-/* Define USE_MMAP_FOR_BUFFERS to let Emacs use mmap(2) to allocate
-   buffer text.  This overrides REL_ALLOC.  */
-
-#define USE_MMAP_FOR_BUFFERS   1
-
-/* Use sigprocmask(2) and friends instead of sigblock(2); the man page
-   of sigblock says it is obsolete.  */
-
-#define POSIX_SIGNALS          1
-
-/* The `combreloc' setting became the default, and it seems to be
-   incompatible with unexec.  Symptom is an immediate SEGV in
-   XtInitializeWidget when starting Emacs under X11.  */
-
-#if defined __FreeBSD_version && __FreeBSD_version >= 500042
-#define LD_SWITCH_SYSTEM_TEMACS -znocombreloc
-#endif
-
 /* arch-tag: 426529ca-b7c4-448f-b10a-d4dcdc9c78eb
    (do not change this comment) */
index ae2eaa43c06946a6e54684f3f8e24d9606790363..cf3b307972650fb272a43368828b18d460a31b52 100644 (file)
@@ -1,6 +1,9 @@
 /* This file is the configuration file for Linux-based GNU systems
-   Copyright (C) 1985, 1986, 1992, 1994, 1996, 1999, 2001, 2002, 2003, 2004,
-                 2005, 2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
+
+Copyright (C) 1985, 1986, 1992, 1994, 1996, 1999, 2001, 2002, 2003, 2004,
+  2005, 2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
+
+This file was put together by Michael K. Johnson and Rik Faith.
 
 This file is part of GNU Emacs.
 
@@ -17,23 +20,15 @@ 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/>.  */
 
-/* This file was put together by Michael K. Johnson and Rik Faith.  */
-
-
-/*
- *     Define symbols to identify the version of Unix this is.
- *     Define all the symbols that apply correctly.
- */
-
+/* 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.  */
-
+   It sets the Lisp variable system-type.  */
 #define SYSTEM_TYPE "gnu/linux"                /* All the best software is free. */
 
-#ifndef NOT_C_CODE
 #ifdef emacs
 #ifdef HAVE_LINUX_VERSION_H
 #include <linux/version.h>
@@ -44,14 +39,11 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #endif /* LINUX_VERSION_CODE >= 0x20400 */
 #endif /* HAVE_LINUX_VERSION_H */
 #endif /* emacs */
-#endif /* NOT_C_CODE */
 
 #if defined HAVE_GRANTPT
 #define UNIX98_PTYS
 
-/* Run only once.  We need a `for'-loop because the code uses
-   `continue'.  */
-
+/* Run only once.  We need a `for'-loop because the code uses `continue'.  */
 #define PTY_ITERATION  for (i = 0; i < 1; i++)
 
 #ifdef HAVE_GETPT
@@ -63,7 +55,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* 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;                                     \
@@ -85,58 +76,25 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* 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_TERMIOS if the system provides POSIX-style
     functions and macros for terminal control.  */
-
 #define HAVE_TERMIOS
 
-/* Define HAVE_PTYS if the system supports pty devices. */
-
+/* Define HAVE_PTYS if the system supports pty devices.  */
 #define HAVE_PTYS
 
 #define HAVE_SOCKETS
 
-/* Define this symbol if your system has the functions bcopy, etc. */
-
-#define BSTRING
-
 /* This is used in list_system_processes.  */
 #define HAVE_PROCFS 1
 
-/* define MAIL_USE_FLOCK if the mailer uses flock
-   to interlock access to /usr/spool/mail/$USER.
-   The alternative is that a lock file named
-   /usr/spool/mail/$USER.lock.  */
-
-/* On GNU/Linux systems, both methods are used by various mail
-   programs.  I assume that 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 */
-
-#if !((defined (HAVE_LIBMAIL) || defined (HAVE_LIBLOCKFILE)) &&        \
-      defined (HAVE_MAILLOCK_H))
-#define MAIL_USE_FLOCK
-#endif
-
 /* 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
@@ -146,84 +104,27 @@ 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).  */
 \f
-/* This is needed for dispnew.c:update_frame */
-
+/* 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 */
+/* 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 */
+/* Using the uClibc library.  */
 #define GNU_LIBRARY_PENDING_OUTPUT_COUNT(FILE) \
   ((FILE)->__bufpos - (FILE)->__bufstart)
 #else /* !_IO_STDIO_H && ! __UCLIBC__ */
-/* old C++ iostream names */
+/* Old C++ iostream names.  */
 #define GNU_LIBRARY_PENDING_OUTPUT_COUNT(FILE) \
   ((FILE)->_pptr - (FILE)->_pbase)
 #endif /* !_IO_STDIO_H && ! __UCLIBC__ */
-#endif /* emacs */
-
-/* Ask GCC where to find libgcc.a.  */
-#define LIB_GCC `$(CC) $(C_SWITCH_X_SITE) -print-libgcc-file-name`
 
-#define START_FILES pre-crt0.o /usr/lib/crt1.o /usr/lib/crti.o
-
-/* Here is how to find X Windows.  LD_SWITCH_X_SITE_AUX gives an -R option
-   says where to find X windows at run time.  */
-
-#ifdef __mips__
-#define LD_SWITCH_SYSTEM -G 0 LD_SWITCH_X_SITE_AUX
-#else
-#define LD_SWITCH_SYSTEM LD_SWITCH_X_SITE_AUX
-#endif /* __mips__ */
-
-/* Link temacs with -z nocombreloc so that unexec works right, whether or
-   not -z combreloc is the default.  GNU ld ignores unknown -z KEYWORD
-   switches, so this also works with older versions that don't implement
-   -z combreloc.  */
-#define LD_SWITCH_SYSTEM_TEMACS -z nocombreloc
-
-#ifdef emacs
 #define INTERRUPT_INPUT
-#endif
-
-#define SYSV_SYSTEM_DIR       /* use dirent.h */
+#endif /* emacs */
 
 #define POSIX                 /* affects getpagesize.h and systty.h */
-#define POSIX_SIGNALS
-
-/* Best not to include -lg, unless it is last on the command line */
-#define LIBS_DEBUG
-#undef LIB_GCC
-#define LIB_GCC
-#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib/crtn.o
-
-/* Don't use -g in test compiles in configure.
-   This is so we will use the same shared libs for that linking
-   that are used when linking temacs.  */
-#ifdef THIS_IS_CONFIGURE
-#define C_DEBUG_SWITCH
-#endif
-
-/* alane@wozzle.linet.org says that -lipc is not a separate library,
-   since libc-4.4.1.  So -lipc was deleted.  */
-#define LIBS_SYSTEM
-/* _BSD_SOURCE is redundant, at least in glibc2, since we define
-   _GNU_SOURCE.  Left in in case it's relevant to libc5 systems and
-   anyone's still using Emacs on those.  --fx 2002-12-14  */
-#define C_SWITCH_SYSTEM -D_BSD_SOURCE
-
-/* Paul Abrahams <abrahams@equinox.shaysnet.com> says this is needed.  */
-#define LIB_MOTIF -lXm -lXpm
-
-#ifdef HAVE_LIBNCURSES
-#define TERMINFO
-#define LIBS_TERMCAP -lncurses
-#endif
-
-#define UNEXEC unexelf.o
 
 /* This is to work around mysterious gcc failures in some system versions.
    It is unlikely that Emacs changes will work around this problem;
@@ -232,21 +133,10 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #define HAVE_XRMSETDATABASE
 #endif
 
-/* Use BSD process groups, but use setpgid() instead of setpgrp() to
-   actually set a process group. */
-/* Interesting: only GNU/Linux defines this,  but the BSDs do not... */
-#define BSD_PGRPS
-
 #define NARROWPROTO 1
 
-/* Use mmap directly for allocating larger buffers.  */
-#ifdef DOUG_LEA_MALLOC
-#undef REL_ALLOC
-#endif
-
 /* Tell that garbage collector that setjmp is known to save all
-   registers relevant for conservative garbage collection in the
-   jmp_buf.  */
+   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
@@ -254,7 +144,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    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__ \
index b43cd65c40af4827a298065c6f7659c4741a0264..95b8017ddc1017b34a5ebd43fd456a8041467b57 100644 (file)
@@ -1,6 +1,7 @@
 /* Definitions file for GNU Emacs running on the GNU Hurd.
-   Copyright (C) 1994, 1995, 1996, 2001, 2002, 2003, 2004, 2005, 2006,
-                 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
+
+Copyright (C) 1994, 1995, 1996, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+  2008, 2009, 2010  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -21,58 +22,19 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Get most of the stuff from bsd-common */
 #include "bsd-common.h"
 
-/* For mem-limits.h.  */
-#define BSD4_2
-
 #undef SYSTEM_TYPE
 #define SYSTEM_TYPE "gnu"
 
 #undef NLIST_STRUCT
-#undef KERNEL_FILE
-#undef LDAV_SYMBOL
 
 #define SIGNALS_VIA_CHARACTERS
 
-#define HAVE_TERMIOS
-#define NO_TERMIO
-
-#define LIBS_DEBUG
-
-/* XXX emacs should not expect TAB3 to be defined.  */
-#define TABDLY OXTABS
-#define TAB3 OXTABS
-
-/* Tell Emacs that we are a terminfo based system; disable the use
-   of local termcap.  (GNU uses ncurses.) */
-#ifdef HAVE_LIBNCURSES
-#define TERMINFO
-#define LIBS_TERMCAP -lncurses
-#endif
-
-#define SYSV_SYSTEM_DIR
-
-/* GNU has POSIX-style pgrp behavior.  */
-#undef BSD_PGRPS
-
-/* Use mmap directly for allocating larger buffers.  */
-#ifdef DOUG_LEA_MALLOC
-#undef REL_ALLOC
-#endif
-
-/* GNU needs its own crt0, and libc defines data_start.  */
-#define ORDINARY_LINK
+/* libc defines data_start.  */
 #define DATA_START ({ extern int data_start; (char *) &data_start; })
 
-/* GNU now always uses the ELF format.  */
-#define UNEXEC unexelf.o
-
 /* Some losing code fails to include this and then assumes
    that because it is braindead that O_RDONLY==0.  */
-#ifndef NOT_C_CODE
 #include <fcntl.h>
-#endif
-
-#define NARROWPROTO 1
 
 #ifdef emacs
 #include <stdio.h>  /* Get the definition of _IO_STDIO_H.  */
index 5d231986010e43645a99b48b9146f9aeb3da10a8..d34ff16104b0ee6c7d940e7417be57c9cecfbbac 100644 (file)
@@ -1,6 +1,7 @@
 /* System description file for hpux version 10.20.
-   Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-     2008, 2009, 2010  Free Software Foundation, Inc.
+
+Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+  2009, 2010  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -20,25 +21,18 @@ 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 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.  */
-
+   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  */
-
+   if system supports pty's.  'p' means it is /dev/ptym/ptyp0  */
 #define FIRST_PTY_LETTER 'p'
 
 #define HAVE_TERMIOS
@@ -46,28 +40,15 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #define ORDINARY_LINK
 
-/*
- *     Define HAVE_PTYS if the system supports pty devices.
- */
-
+/* 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 this symbol if your system has the functions bcopy, etc.
- * s800 and later versions of s300 (s200) kernels have equivalents
- * of the BSTRING functions of BSD.  If your s200 kernel doesn't have
- * em comment out this section.
- */
-
-#define BSTRING
-
 /* 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
 
 /* The symbol in the kernel where the load average is found
@@ -75,16 +56,11 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* Special hacks needed to make Emacs run on this system.  */
 
-/* Use the system provided termcap(3) library */
-#define TERMINFO
-
 /* 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.  */
@@ -98,17 +74,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* This triggers a conditional in xfaces.c.  */
 #define XOS_NEEDS_TIME_H
 
-/* Don't use shared libraries.  unexec doesn't handle them.
-   Note GCC automatically passes -a archive to ld, and it has its own
-   conflicting -a.  */
-#define LD_SWITCH_SYSTEM_TEMACS
-
-#ifndef HAVE_LIBXMU
-/* HP-UX doesn't supply Xmu.  */
-#define LIBXMU
-
-#endif
-
 /* 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
@@ -121,7 +86,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    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. */
+   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
@@ -136,35 +101,45 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* AlainF 20-Jul-1996 says this is right.  */
 #define KERNEL_FILE "/stand/vmunix"
 
-#define LIBS_SYSTEM -l:libdld.sl
 
 /* Rainer Malzbender <rainer@displaytech.com> says definining
-   HAVE_XRMSETDATABASE allows Emacs to compile on HP-UX 10.20
-   using GCC.  */
-
+   HAVE_XRMSETDATABASE allows Emacs to compile on HP-UX 10.20 using GCC.  */
 #ifndef HAVE_XRMSETDATABASE
 #define HAVE_XRMSETDATABASE
 #endif
 
-/* 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.  */
-#define LIBS_TERMCAP -ltermcap
-
-/* However, HPUX 10 puts Xaw and Xmu in a strange place
-   (if you install them at all).  So search that place.  */
-#define C_SWITCH_X_SYSTEM  -I/usr/include/X11R6 -I/usr/include/X11R5 -I/usr/include/Motif1.2 -I/usr/contrib/X11R6/include -I/usr/contrib/X11R5/include
-#define LD_SWITCH_X_DEFAULT -L/usr/lib/X11R6 -L/usr/lib/X11R5 -L/usr/lib/Motif1.2 -L/usr/contrib/X11R5/lib
-
 /* 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
 
-/* otherwise sigunblock wont be defined */
-#define POSIX_SIGNALS
+/* Define VIRT_ADDR_VARIES if the virtual addresses of
+   pure and impure space as loaded can vary, and even their
+   relative order cannot be relied on.
+
+   Otherwise Emacs assumes that text space precedes data space,
+   numerically.  */
+#define VIRT_ADDR_VARIES
+\f
+/* The data segment on this machine always starts at address 0x40000000.  */
+#define DATA_SEG_BITS 0x40000000
+
+#define DATA_START    0x40000000
+
+/* Data type of load average, as read out of kmem.  */
+#define LOAD_AVE_TYPE double
+
+/* Convert that into an integer that is 100 for a load average of 1.0  */
+#define LOAD_AVE_CVT(x) ((int) (x * 100.0))
+
+/* The kernel symbol where the load average is found is named _avenrun.
+   At this time there are two major flavors of hp-ux (there is the s800
+   and s300 (s200) flavors).  The differences are thusly moved to the
+   corresponding machine description file.  */
+
+/* No underscore please.  */
+#define LDAV_SYMBOL "avenrun"
 
 /* arch-tag: 8d8dcbf1-ca9b-48a1-94be-b750de18a5c6
    (do not change this comment) */
index 3382395a90f30a21a99137d0db7b521d4f9b46a7..48f60841047d57437a91c43e18bdbe5abfe4cebd 100644 (file)
@@ -1,10 +1,5 @@
 #include "hpux10-20.h"
 
-#ifdef POSIX_SIGNALS
-#undef POSIX_SIGNALS
-#endif
-#define POSIX_SIGNALS 1
-
 /* SA_RESTART resets the timeout of `select', so don't use it.  */
 #define BROKEN_SA_RESTART
 
index 57429e4166324500a1d3c2687da2f767d2f4ef80..10481f609c32099884f23e9df0f127c046d62f30 100644 (file)
@@ -20,18 +20,13 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 
 #define IRIX6_5                        /* used in m/iris4d */
-#include "usg5-4.h"
+#include "usg5-4-common.h"
 
-#undef sigsetmask  /* use sys_sigsetmask */
 #undef _longjmp /* use system versions, not conservative aliases */
 #undef _setjmp
 
 #define SETPGRP_RELEASES_CTTY
 
-#ifdef LIB_STANDARD
-#undef LIB_STANDARD
-#endif
-
 #ifdef SYSTEM_TYPE
 #undef SYSTEM_TYPE
 #endif
@@ -45,10 +40,12 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* 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.  */
-#ifdef PTY_TTY_NAME_SPRINTF
-#undef PTY_TTY_NAME_SPRINTF
-#endif
 #define PTY_TTY_NAME_SPRINTF
 /* No need to get the pty name at all.  */
 #ifdef PTY_NAME_SPRINTF
@@ -80,55 +77,28 @@ char *_getpty();
   strcpy (pty_name, name);                                 \
 }
 
-/* Since we use POSIX constructs in PTY_OPEN, we must force POSIX
-   throughout. */
-#define POSIX_SIGNALS
-
 /* Ulimit(UL_GMEMLIM) is busted...  */
 #define ULIMIT_BREAK_VALUE 0x14000000
 
 /* Tell process_send_signal to use VSUSP instead of VSWTCH.  */
 #define PREFER_VSUSP
 
-/* define MAIL_USE_FLOCK if the mailer uses flock
-   to interlock access to /usr/spool/mail/$USER.
-   The alternative is that a lock file named
-   /usr/spool/mail/$USER.lock.  */
-
-#define MAIL_USE_FLOCK
-
 #define NARROWPROTO 1
 
-#define USE_MMAP_FOR_BUFFERS 1
-
-/* arch-tag: ad0660e0-acf8-46ae-b866-4f3df5b1101b
-   (do not change this comment) */
-
-
 #if _MIPS_SZLONG == 64         /* -mabi=64 (gcc) or -64 (MIPSpro) */
 #define _LP64                  /* lisp.h takes care of the rest */
 #endif /* _MIPS_SZLONG */
 
-/* The only supported 32-bit configuration of GCC under IRIX6.x produces
-   n32 MIPS ABI binaries and also supports -g. */
-#ifdef __GNUC__
-#define C_DEBUG_SWITCH -g
-#else
-/* Optimize, inaccurate debugging, increase limit on size of what's
-   optimized.
-
-   This should also be applicable other than on Irix 6.5, but I don't
-   know for which compiler versions.  -- fx */
-#define C_DEBUG_SWITCH -g3 -O -OPT:Olimit=3500
-#endif
-
 #undef SA_RESTART
 
-#undef TIOCSIGSEND             /* defined in usg5-4.h */
+#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
 
+/* arch-tag: ad0660e0-acf8-46ae-b866-4f3df5b1101b
+   (do not change this comment) */
+
 /* arch-tag: d7ad9ec2-54ad-4b2f-adf2-0070c5c63e83
    (do not change this comment) */
diff --git a/src/s/lynxos.h b/src/s/lynxos.h
deleted file mode 100644 (file)
index 180b600..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/* Definitions file for GNU Emacs running on LynxOS-3.0.1
-   Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-                 2008, 2009, 2010 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/>.  */
-
-/* LynxOS is almost a bsd 4.2 system */
-#include "s/bsd4-2.h"
-
-/* SYSTEM_TYPE should indicate the kind of system you are using.
- It sets the Lisp variable system-type.  */
-
-/* override the bsd definition */
-#undef SYSTEM_TYPE
-#define SYSTEM_TYPE "lynxos 3.0.1"
-
-/* System stuff redefined from bsd4-2.h */
-#undef KERNEL_FILE
-#define KERNEL_FILE "/lynx.os"
-#undef LDAV_SYMBOL
-#define LDAV_SYMBOL "load_average"
-
-/* misc defines */
-#define LNOFLSH 0
-
-/* COFF related */
-#define COFF
-#define NO_REMAP
-#define SECTION_ALIGNMENT 0x1
-#define COFF_BSD_SYMBOLS
-#define etext __etext
-#define edata __edata
-#define _start __text
-
-/* Compilation options */
-#define LIBS_DEBUG
-#define ORDINARY_LINK
-/* we define following to prevent all the lynxos's stupid compilation */
-/* warning messages */
-#define C_SWITCH_SYSTEM -D__NO_INCLUDE_WARN__
-#define LIBS_SYSTEM -lbsd
-
-/* arch-tag: fbc81ec9-1c45-416b-a368-799ae7c094a1
-   (do not change this comment) */
index 3e5c65eaab534055a452f0d2fb95c409c3769286..4ae5f32e873acc9fbd29126421db578897c6d5ab 100644 (file)
@@ -1,6 +1,7 @@
 /* System description file for Windows NT.
-   Copyright (C) 1993, 1994, 1995, 2001, 2002, 2003, 2004, 2005, 2006,
-                 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
+
+Copyright (C) 1993, 1994, 1995, 2001, 2002, 2003, 2004, 2005, 2006,
+  2007, 2008, 2009, 2010  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -17,10 +18,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/>.  */
 
-/*
- *      Define symbols to identify the version of Unix this is.
- *      Define all the symbols that apply correctly.
- */
+/* Define symbols to identify the version of Unix this is.
+   Define all the symbols that apply correctly.  */
 
 #ifndef WINDOWSNT
 #define WINDOWSNT
@@ -30,71 +29,39 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #endif
 
 /* If you are compiling with a non-C calling convention but need to
-   declare vararg routines differently, put it here */
+   declare vararg routines differently, put it here */
 #define _VARARGS_ __cdecl
 
 /* If you are providing a function to something that will call the
    function back (like a signal handler and signal, or main) its calling
-   convention must be whatever standard the libraries expect */
+   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.  */
-
+   It sets the Lisp variable system-type.  */
 #define SYSTEM_TYPE "windows-nt"
-#define SYMS_SYSTEM syms_of_ntterm ()
 
 #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  */
-
+   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 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) */
-
+/* 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
 
 /* And the select implementation does 1-byte read-ahead waiting
    for received packets, so datagrams are broken too.  */
-
 #define BROKEN_DATAGRAM_SOCKETS 1
 
-/* Define this symbol if your system has the functions bcopy, etc. */
-
-#define BSTRING
-#define bzero(b, l) memset(b, 0, l)
-#define bcopy(s, d, l) memmove(d, s, l)
-#define bcmp(a, b, l) memcmp(a, b, l)
-
-/* bcopy (aka memmove aka memcpy at least on x86) under MSVC is quite safe */
-#define GAP_USE_BCOPY 1
-#define BCOPY_UPWARD_SAFE 1
-#define BCOPY_DOWNWARD_SAFE 1
-
-/* If your system uses COFF (Common Object File Format) then define the
-   preprocessor symbol "COFF". */
-
-#define COFF 1
-
-/* define MAIL_USE_FLOCK if the mailer uses flock
-   to interlock access to /usr/spool/mail/$USER.
-   The alternative is that a lock file named
-   /usr/spool/mail/$USER.lock.  */
-
-/* #define MAIL_USE_FLOCK */
 #define MAIL_USE_POP 1
 #define MAIL_USE_SYSTEM_LOCK 1
 
@@ -106,24 +73,30 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* ============================================================ */
 
-/* Here, 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).  */
-
-/* Define this to be the separator between path elements */
-#define DIRECTORY_SEP XINT (Vdirectory_sep_char)
+/* Here, 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).  */
 
-/* Define this to be the separator between devices and paths */
+/* Define this to be the separator between devices and paths */
 #define DEVICE_SEP ':'
 
 /* We'll support either convention on NT.  */
 #define IS_DIRECTORY_SEP(_c_) ((_c_) == '/' || (_c_) == '\\')
 #define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP (_c_))
 
-/* The null device on Windows NT. */
+#include <sys/types.h>
+struct sigaction {
+  int sa_flags;
+  void (*sa_handler)(int);
+  sigset_t sa_mask;
+};
+#define SIG_BLOCK       1
+#define SIG_SETMASK     2
+#define SIG_UNBLOCK     3
+
+/* The null device on Windows NT.  */
 #define NULL_DEVICE     "NUL:"
 
 #ifndef MAXPATHLEN
@@ -133,7 +106,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #define HAVE_SOUND  1
 #define LISP_FLOAT_TYPE 1
 
-#undef  HAVE_SYS_SELECT_H
 #define HAVE_SYS_TIMEB_H 1
 #define HAVE_SYS_TIME_H 1
 #define HAVE_UNISTD_H 1
@@ -166,8 +138,10 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #define HAVE_RANDOM 1
 #undef  HAVE_SYSINFO
 #undef  HAVE_LRAND48
-#define HAVE_BCOPY 1
-#define HAVE_BCMP 1
+#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
@@ -213,11 +187,11 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #define MODE_LINE_BINARY_TEXT(_b_) (NILP ((_b_)->buffer_file_type) ? "T" : "B")
 
-/* get some redefinitions in place */
+/* Get some redefinitions in place.  */
 
 #ifdef emacs
 
-/* calls that are emulated or shadowed */
+/* Calls that are emulated or shadowed.  */
 #undef access
 #define access  sys_access
 #undef chdir
@@ -254,15 +228,26 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #undef write
 #define write   sys_write
 
-/* subprocess calls that are emulated */
+/* Subprocess calls that are emulated.  */
 #define spawnve sys_spawnve
 #define wait    sys_wait
 #define kill    sys_kill
 #define signal  sys_signal
 
+/* termcap.c calls that are emulated.  */
+#define tputs   sys_tputs
+#define tgetstr sys_tgetstr
+
+/* cm.c calls that are emulated.  */
+#define chcheckmagic sys_chcheckmagic
+#define cmcostinit   sys_cmcostinit
+#define cmgoto       sys_cmgoto
+#define cmputc       sys_cmputc
+#define Wcm_clear    sys_Wcm_clear
+
 #endif /* emacs */
 
-/* map to MSVC names */
+/* Map to MSVC names.  */
 #define execlp    _execlp
 #define execvp    _execvp
 #define fdopen   _fdopen
@@ -283,8 +268,6 @@ typedef int pid_t;
 #define pclose    _pclose
 #define umask    _umask
 #define utimbuf          _utimbuf
-#define index     strchr
-#define rindex    strrchr
 #define strdup    _strdup
 #define strupr    _strupr
 #define strnicmp  _strnicmp
@@ -296,8 +279,8 @@ typedef int pid_t;
 #define utime    _utime
 #endif
 
-/* this is hacky, but is necessary to avoid warnings about macro
-   redefinitions using the SDK compilers */
+/* This is hacky, but is necessary to avoid warnings about macro
+   redefinitions using the SDK compilers */
 #ifndef __STDC__
 #define __STDC__ 1
 #define MUST_UNDEF__STDC__
@@ -310,7 +293,7 @@ typedef int pid_t;
 #undef MUST_UNDEF__STDC__
 #endif
 
-/* Defines that we need that aren't in the standard signal.h  */
+/* Defines that we need that aren't in the standard signal.h.  */
 #define SIGHUP  1               /* Hang up */
 #define SIGQUIT 3               /* Quit process */
 #define SIGTRAP 5               /* Trace trap */
@@ -353,8 +336,7 @@ extern char *get_emacs_configuration_options (void);
 
 #include <sys/stat.h>
 
-/* Define for those source files that do not include enough NT
-   system files.  */
+/* Define for those source files that do not include enough NT system files.  */
 #ifndef NULL
 #ifdef __cplusplus
 #define NULL   0
@@ -389,7 +371,7 @@ extern char *get_emacs_configuration_options (void);
    removed.  Also, obviously, all files that define initialized data
    must include config.h to pick up this pragma.  */
 
-/* Names must be < 8 bytes */
+/* Names must be < 8 bytes */
 #ifdef _MSC_VER
 #pragma data_seg("EMDATA")
 #pragma bss_seg("EMBSS")
index 88771b9f15fc82a3d85da44d1fd082d08f3833f3..8dd8e3cf4906a3c17481519cc40140c8e45fb8dd 100644 (file)
@@ -1,7 +1,7 @@
 /* System description file for MS-DOS
 
-   Copyright (C) 1993, 1996, 1997, 2001, 2002, 2003, 2004, 2005, 2006,
-                 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+Copyright (C) 1993, 1996, 1997, 2001, 2002, 2003, 2004, 2005, 2006,
+  2007, 2008, 2009, 2010  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -21,20 +21,13 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Note: lots of stuff here was taken from s-msdos.h in demacs. */
 
 
-/*
- *     Define symbols to identify the version of Unix this is.
- *     Define all the symbols that apply correctly.
- */
-
+/* Define symbols to identify the version of Unix this is.
+   Define all the symbols that apply correctly.  */
 #ifndef MSDOS
 #define MSDOS
 #endif
 
-#ifdef __GO32__
 #ifndef __DJGPP__
-#define __DJGPP__ 1    /* V2 defines __DJGPP__ == 2 */
-#endif
-#else
 You lose; /* Emacs for DOS must be compiled with DJGPP */
 #endif
 
@@ -42,46 +35,19 @@ You lose; /* Emacs for DOS must be compiled with DJGPP */
 #undef BSD_SYSTEM
 
 /* SYSTEM_TYPE should indicate the kind of system you are using.
- It sets the Lisp variable system-type.  */
-
+   It sets the Lisp variable system-type.  */
 #define SYSTEM_TYPE "ms-dos"
 
-#define SYMS_SYSTEM syms_of_dosfns();syms_of_msdos();syms_of_win16select()
-
-/* NOMULTIPLEJOBS should be defined if your system's shell
- does not have "job control" (the ability to stop a program,
- run some other program, then continue the first one).  */
-
-#define NOMULTIPLEJOBS
-
-#define SYSV_SYSTEM_DIR
-
-/* Define this symbol if your system has the functions bcopy, etc. */
-
-#define BSTRING
-
-/* Define this is the compiler understands `volatile'.  */
-#define HAVE_VOLATILE
-
-
-/* subprocesses should be defined if you want to
-   have code for asynchronous subprocesses
-   (as used in M-x compile and M-x shell).
+/* subprocesses should be defined if you want to have code for
+   asynchronous subprocesses (as used in M-x compile and M-x shell).
    This is the only system that needs this.  */
-
 #undef subprocesses
 
-/* If your system uses COFF (Common Object File Format) then define the
-   preprocessor symbol "COFF". */
-
-#define COFF
-
-/* 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).  */
+/* 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
 /* Avoid incompatibilities between gmalloc.c and system header files
    in how to declare valloc.  */
@@ -93,59 +59,18 @@ You lose; /* Emacs for DOS must be compiled with DJGPP */
 
 /* setjmp and longjmp can safely replace _setjmp and _longjmp,
    but they will run slower.  */
-
 #define _setjmp setjmp
 #define _longjmp longjmp
 
-#if __DJGPP__ < 2
-
-/* New chdir () routine.
-   DJGPP v2.0 and later doesn't need it because its chdir() does
-   set the drive itself. */
-#ifdef chdir
-#undef chdir
-#endif
-#define chdir sys_chdir
-
-#define LIBS_SYSTEM -lpc  /* isn't required in DJGPP v2.0, either */
-
-#endif /* __DJGPP__ < 2 */
-
-#if __DJGPP__ > 1
-
 #define DATA_START  (&etext + 1)
-#define TEXT_START  &start
 
 #define _NAIVE_DOS_REGS
 
-#else /* not __DJGPP__ > 1 */
-
-/* This somehow needs to be defined even though we use COFF.  */
-#define TEXT_START -1
-
-#endif /* not __DJGPP__ > 1 */
-
-#define ORDINARY_LINK
-
 /* command.com does not understand `...` so we define this.  */
-#define LIB_GCC -Lgcc
 #define SEPCHAR ';'
 
 #define NULL_DEVICE "nul"
 
-#if __DJGPP__ < 2
-#define O_RDONLY        0x0001
-#define O_WRONLY        0x0002
-#define O_RDWR          0x0004
-#define O_CREAT         0x0100
-#define O_TRUNC         0x0200
-#define O_EXCL          0x0400
-#define O_APPEND        0x0800
-#define O_TEXT          0x4000
-#define O_BINARY        0x8000
-#define NO_MATHERR
-#endif
-
 #define HAVE_INVERSE_HYPERBOLIC
 #define FLOAT_CHECK_DOMAIN
 
@@ -156,39 +81,24 @@ You lose; /* Emacs for DOS must be compiled with DJGPP */
 :AB=<BG %d>:AF=<FG %d>:op=<DefC>:"
 
 /* Define this to a function (Fdowncase, Fupcase) if your file system
-   likes that */
+   likes that */
 #define FILE_SYSTEM_CASE Fmsdos_downcase_filename
 
-/* Define this to be the separator between devices and paths */
+/* Define this to be the separator between devices and paths */
 #define DEVICE_SEP ':'
 
 /* We'll support either convention on MSDOG.  */
 #define IS_DIRECTORY_SEP(_c_) ((_c_) == '/' || (_c_) == '\\')
 #define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP (_c_))
 
-/* Call init_gettimeofday when TZ changes.  */
-#if __DJGPP__ < 2
-#define LOCALTIME_CACHE
-#define tzset init_gettimeofday
-#endif
-
-/* bcopy under djgpp is quite safe */
-#define GAP_USE_BCOPY
-#define BCOPY_UPWARD_SAFE 1
-#define BCOPY_DOWNWARD_SAFE 1
 
 /* Mode line description of a buffer's type.  */
 #define MODE_LINE_BINARY_TEXT(buf) (NILP(buf->buffer_file_type) ? "T" : "B")
 
-/* Do we have POSIX signals?  */
-#if __DJGPP__ > 1
-#define POSIX_SIGNALS
-#endif
-
 /* We have (the code to control) a mouse.  */
 #define HAVE_MOUSE
 
-/* We canuse mouse menus.  */
+/* We can use mouse menus.  */
 #define HAVE_MENUS
 
 /* Define one of these for easier conditionals.  */
@@ -197,7 +107,6 @@ You lose; /* Emacs for DOS must be compiled with DJGPP */
    commentary below, in the non-X branch.  The 140KB number was
    measured on GNU/Linux and on MS-WIndows.  */
 #define SYSTEM_PURESIZE_EXTRA (-170000+140000)
-#define LIBX11_SYSTEM -lxext -lsys
 #else
 /* We need a little extra space, see ../../lisp/loadup.el.
    As of 20091024, DOS-specific files use up 62KB of pure space.  But
@@ -212,9 +121,7 @@ You lose; /* Emacs for DOS must be compiled with DJGPP */
 #endif
 
 /* Tell the garbage collector that setjmp is known to save all
-   registers relevant for conservative garbage collection in the
-   jmp_buf.  */
-
+   registers relevant for conservative garbage collection in the jmp_buf.  */
 #define GC_SETJMP_WORKS 1
 #define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS
 
index 132fc137e508d4edbf299412f4488a7b4ee3d1ef..6f5b24bcfa63fb8ebb9a649c45d2f3b48d18dbb4 100644 (file)
@@ -1,7 +1,7 @@
 /* s/ file for netbsd system.
 
-   Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-                 2008, 2009, 2010  Free Software Foundation, Inc.
+Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
+  2010  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -19,125 +19,31 @@ 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 */
+/* Get most of the stuff from bsd-common */
 #include "bsd-common.h"
 
-#if defined (__alpha__) && !defined (__ELF__)
-#define NO_SHARED_LIBS
-#endif
-
-/* For mem-limits.h.  */
-#define BSD4_2
-
-#undef KERNEL_FILE
-#undef LDAV_SYMBOL
 #define HAVE_GETLOADAVG 1
 
 #define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base)
 
-/* netbsd uses OXTABS instead of the expected TAB3.  */
-#define TABDLY OXTABS
-#define TAB3 OXTABS
-
-#define HAVE_TERMIOS
-#define NO_TERMIO
-
-#define LIBS_DEBUG
-/* -lutil is not needed for NetBSD >0.9.  */
-/* #define LIBS_SYSTEM -lutil */
-#ifdef HAVE_TERM_H
-#define TERMINFO
-#define LIBS_TERMCAP -lterminfo
-#else
-#define LIBS_TERMCAP -ltermcap
-#endif
-
-#define NEED_ERRNO
-#define SYSV_SYSTEM_DIR
-
-/* Netbsd has POSIX-style pgrp behavior.  */
-#undef BSD_PGRPS
-
-#if !defined (NO_SHARED_LIBS) && defined (__ELF__)
-#define START_FILES pre-crt0.o /usr/lib/crt0.o START_FILES_1 /usr/lib/crtbegin.o
-#define UNEXEC unexelf.o
-#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib/crtend.o END_FILES_1
-#undef LIB_GCC
-#define LIB_GCC
-#endif
-
-#ifdef HAVE_CRTIN
-#define START_FILES_1 /usr/lib/crti.o 
-#define END_FILES_1 /usr/lib/crtn.o
-#else
-#define START_FILES_1
-#define END_FILES_1
-#endif
-
-#define AMPERSAND_FULL_NAME
-
-#ifdef __ELF__
-/* Here is how to find X Windows.  LD_SWITCH_X_SITE_AUX gives an -R option
-   says where to find X windows at run time.  We convert it to a -rpath option
-   which is what OSF1 uses.  */
-#define LD_SWITCH_SYSTEM_tmp `echo LD_SWITCH_X_SITE_AUX | sed -e 's/-R/-Wl,-rpath,/'`
-#define LD_SWITCH_SYSTEM LD_SWITCH_SYSTEM_tmp -Wl,-rpath,/usr/pkg/lib -L/usr/pkg/lib -Wl,-rpath,/usr/local/lib -L/usr/local/lib
-
-/* The following is needed to make `configure' find Xpm, Xaw3d and
-   image include and library files if using /usr/bin/gcc.  That
-   compiler seems to be modified to not find headers in
-   /usr/local/include or libs in /usr/local/lib by default.  */
-
-#define C_SWITCH_SYSTEM -I/usr/X11R6/include -I/usr/pkg/include -I/usr/local/include -L/usr/pkg/lib -L/usr/local/lib
-
-/* Link temacs with -z nocombreloc so that unexec works right, whether or
-   not -z combreloc is the default.  GNU ld ignores unknown -z KEYWORD
-   switches, so this also works with older versions that don't implement
-   -z combreloc.  */
-
-#define LD_SWITCH_SYSTEM_TEMACS -Wl,-z,nocombreloc
-
-#endif /* __ELF__ */
-
-/* On post 1.3 releases of NetBSD, gcc -nostdlib also clears
-   the library search parth, i.e. it won't search /usr/lib
-   for libc and friends. Using -nostartfiles instead avoids
-   this problem, and will also work on earlier NetBSD releases */
-
-#define LINKER $(CC) -nostartfiles
-
-#define NARROWPROTO 1
-
 #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.  */
-
-#ifndef NOT_C_CODE
 #include <signal.h>
-#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
 
 /* Tell that garbage collector that setjmp is known to save all
-   registers relevant for conservative garbage collection in the
-   jmp_buf.  */
-
+   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
 
-/* Use sigprocmask and friends instead of sigblock;
-   sigblock is considered obsolete on NetBSD.  */
-
-#define POSIX_SIGNALS  1
-
 /* arch-tag: e80f364a-04e9-4faf-93cb-f36a0fe95c81
    (do not change this comment) */
index 3b996de70593d6b1b31d3c95024a6696975d542c..d9d60e3b868e23d87e27cc39b35c436fcaf55ca2 100644 (file)
@@ -1,40 +1,7 @@
-/* s/ file for openbsd systems.  */
+/* System file for openbsd.  */
 
-/* Mostly the same as NetBSD.  */
+/* The same as NetBSD.  Note there are differences in configure.  */
 #include "netbsd.h"
 
-/*  This very-badly named symbol is conditionally defined in netbsd.h.
-    Better would be either to not need it in the first place, or to choose
-    a more descriptive name.  */
-#ifndef LD_SWITCH_SYSTEM_tmp
-#define LD_SWITCH_SYSTEM_tmp /* empty */
-#endif
-
-/*  David Mazieres <dm@reeducation-labor.lcs.mit.edu> says this
-    is necessary.  Otherwise Emacs dumps core when run -nw.  */
-#undef LIBS_TERMCAP
-
-#define TERMINFO
-#define LIBS_TERMCAP -lncurses
-
-#undef LD_SWITCH_SYSTEM_TEMACS
-#undef LD_SWITCH_SYSTEM
-#ifdef __ELF__
-
-  /*  Han Boetes <han@mijncomputer.nl> says this
-      is necessary,  otherwise Emacs dumps core on elf systems.  */
-#define LD_SWITCH_SYSTEM LD_SWITCH_SYSTEM_tmp -Z
-
-/* The version of gcc on OpenBSD doesn't search /usr/local/lib by
-   default.  */
-#define LD_SWITCH_X_DEFAULT -L/usr/local/lib
-
-#else
-  
-#define LD_SWITCH_SYSTEM LD_SWITCH_SYSTEM_tmp
-#define LD_SWITCH_X_DEFAULT -L/usr/local/lib
-
-#endif
-
 /* arch-tag: 7e3f65ca-3f48-4237-933f-2b208b21e8e2
    (do not change this comment) */
index 865e17525c4ed5667e7522a935a1c01ac22fb9ec..fd7f30021ea75ee70d94bfffc65c12db031005e6 100644 (file)
@@ -2,25 +2,6 @@
 
 #include "sol2-6.h"
 
-#define SYSTEM_MALLOC
-
-/*
- * Use the Solaris dldump() function, called from unexsol.c, to dump
- * emacs, instead of the generic ELF dump code found in unexelf.c.
- * The resulting binary has a complete symbol table, and is better
- * for debugging and other observabilty tools (debuggers, pstack, etc).
- *
- * If you encounter a problem using dldump(), please consider sending
- * a message to the OpenSolaris tools-linking mailing list:
- *      http://mail.opensolaris.org/mailman/listinfo/tools-linking
- *
- * It is likely that dldump() works with older Solaris too,
- * but this has not been tested, and so, this change is for
- * Solaris 10 and newer only at this time.
- */
-#undef UNEXEC
-#define UNEXEC unexsol.o
-
 /* This is used in list_system_processes.  */
 #define HAVE_PROCFS 1
 
diff --git a/src/s/sol2-3.h b/src/s/sol2-3.h
deleted file mode 100644 (file)
index fa05aa4..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-/* Definitions file for GNU Emacs running on Solaris 2.3.
-
-   Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-                 2008, 2009, 2010  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/>.  */
-
-#include "usg5-4.h"
-
-#define SOLARIS2
-
-/* This triggers a conditional in xfaces.c.  */
-#define XOS_NEEDS_TIME_H
-
-#define POSIX
-
-#define LIBS_SYSTEM -lsocket -lnsl -lkstat
-
-/* 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
-
-/* inoue@ainet.or.jp says Solaris has a bug related to X11R6-style
-   XIM support.  */
-
-#define INHIBIT_X11R6_XIM
-
-/* Must use the system's termcap, if we use any termcap.
-   It does special things.  */
-
-#ifndef TERMINFO
-#define LIBS_TERMCAP -ltermcap
-#endif
-
-#define USE_MMAP_FOR_BUFFERS 1
-
-#ifndef __GNUC__
-#define LD_SWITCH_SYSTEM -L /usr/ccs/lib LD_SWITCH_X_SITE_AUX
-/* eggert thinks all versions of SunPro C allowed this.  */
-#define C_DEBUG_SWITCH -g -O
-#else /* GCC */
-/* We use ./prefix-args because we don't know whether LD_SWITCH_X_SITE_AUX
-   has anything in it.  It can be empty.
-   This works ok in src.  Luckily lib-src does not use LD_SWITCH_SYSTEM.  */
-#define LD_SWITCH_SYSTEM -L /usr/ccs/lib \
- `./prefix-args -Xlinker LD_SWITCH_X_SITE_AUX`
-#endif /* GCC */
-
-/* Info from fnf@cygnus.com suggests this is appropriate.  */
-#define POSIX_SIGNALS
-
-/* We don't need the definition from usg5-4.h with POSIX_SIGNALS.  */
-#undef sigsetmask
-
-/* This is the same definition as in usg5-4.h, but with sigblock/sigunblock
-   rather than sighold/sigrelse, which appear to be BSD4.1 specific and won't
-   work if POSIX_SIGNALS is defined.  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). */
-
-#undef PTY_TTY_NAME_SPRINTF
-#define PTY_TTY_NAME_SPRINTF                   \
-  {                                            \
-    char *ptsname (), *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;       \
-  }
-
-/* arch-tag: a8fe2e15-e517-49cb-a863-f346b80885fe
-   (do not change this comment) */
diff --git a/src/s/sol2-4.h b/src/s/sol2-4.h
deleted file mode 100644 (file)
index df8552e..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Handle Solaris 2.4.  */
-
-#include "sol2-3.h"
-
-#undef LD_SWITCH_SYSTEM
-
-/* `#ifdef USE_MOTIF' won't work here, since USE_MOTIF isn't defined yet.
-   Instead, dynamically check whether USE_MOTIF expands to something.  */
-#define NOT_USING_MOTIF { set x USE_MOTIF; test "$$2" = "USE_MOTIF"; }
-
-#ifndef __GNUC__
-#define LD_SWITCH_SYSTEM_TEMACS -L/usr/ccs/lib LD_SWITCH_X_SITE_AUX \
-  `NOT_USING_MOTIF || echo ' -R/usr/dt/lib'`
-#else /* GCC */
-/* We use ./prefix-args because we don't know whether LD_SWITCH_X_SITE_AUX
-   has anything in it.  It can be empty.
-   This works ok in temacs.  */
-#define LD_SWITCH_SYSTEM_TEMACS -L/usr/ccs/lib \
- `./prefix-args -Xlinker LD_SWITCH_X_SITE_AUX` \
-  `NOT_USING_MOTIF || echo ' -R/usr/dt/lib -L/usr/dt/lib'`
-
-/* Get rid of -traditional and let const really do its thing.  */
-#undef C_SWITCH_SYSTEM
-#undef const
-#endif /* GCC */
-
-/* Gregory Neil Shapiro <gshapiro@hhmi.org> reports the Motif header files
-   are in this directory on Solaris 2.4.  */
-#define C_SWITCH_X_SYSTEM -I/usr/dt/include
-
-/* arch-tag: 6f0de37b-cfda-427a-a5ae-b83ed54aaae7
-   (do not change this comment) */
diff --git a/src/s/sol2-5.h b/src/s/sol2-5.h
deleted file mode 100644 (file)
index 9016398..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Handle Solaris 2.5.  */
-
-#include "sol2-4.h"
-
-/* -lgen is needed for the regex and regcmp functions
-   which are used by Motif.  In the future we can try changing
-   regex.c to provide them in Emacs, but this is safer for now.  */
-#define LIB_MOTIF -lXm -lgen
-
-/* This is the only known way to avoid some crashes
-   that seem to relate to screwed up malloc data
-   after deleting a frame.  */
-/* rms: I think the problems using ralloc had to do with system
-   libraries that called the system malloc even if we linked in the
-   GNU malloc.  I could not see any way to fix the problem except to
-   have just one malloc and that had to be the system one.  */
-/* This is not always necessary.  Turned off at present for testers to
-   identify any problems with gmalloc more accurately.  */
-/* #define SYSTEM_MALLOC */
-
-/* There have problems reported with mmap at least on Solaris 2.6
-   and 2.7.  For simplicity, let's not use mmap for anything >= 2.5.
-   We can optimize this later.  */
-
-#undef USE_MMAP_FOR_BUFFERS
-
-/* Probably OK also on earlier versions.  */
-#define GC_SETJMP_WORKS 1
-#define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS
-
-/* arch-tag: 96d65526-21c9-4547-a797-2bd575c05be7
-   (do not change this comment) */
index a43443e48c2eb4a9bb5ea62a6c7598e5e1bc53aa..3b707aa5c3c119902f6b1bde6e122dba947d7ea0 100644 (file)
@@ -1,11 +1,66 @@
-/* Handle Solaris 2.6.  */
+/* Definitions file for GNU Emacs running on Solaris 2.6.
 
-#include "sol2-5.h"
+Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+  2008, 2009, 2010  Free Software Foundation, Inc.
 
-#if 0 /* dldump does not handle all the extensions used by GNU ld.  */
-#undef UNEXEC
-#define UNEXEC unexsol.o
+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/>.  */
+
+#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 (), *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
+
 /* arch-tag: 71ea3857-89dc-4395-9623-77964e6ed3ca
    (do not change this comment) */
index e5fd2541c7b355edae3a71be4fd5b06074eaced5..dd1e56f85534d5cdcadc5882c97a1850a2dfeb64 100644 (file)
@@ -1,8 +1,9 @@
 /* Template for system description header files.
    This file describes the parameters that system description files
    should define or not.
-   Copyright (C) 1985, 1986, 1992, 1999, 2001, 2002, 2003, 2004, 2005,
-                 2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
+
+Copyright (C) 1985, 1986, 1992, 1999, 2001, 2002, 2003, 2004, 2005,
+  2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -20,10 +21,8 @@ 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 symbols to identify the version of Unix this is.
+   Define all the symbols that apply correctly.  */
 
 /* #define USG5 */
 /* #define USG */
@@ -33,16 +32,10 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* #define BSD_SYSTEM */
 
 /* SYSTEM_TYPE should indicate the kind of system you are using.
- It sets the Lisp variable system-type.  */
  It sets the Lisp variable system-type.  */
 
 #define SYSTEM_TYPE "berkeley-unix"
 
-/* NOMULTIPLEJOBS should be defined if your system's shell
- does not have "job control" (the ability to stop a program,
- run some other program, then continue the first one).  */
-
-/* #define NOMULTIPLEJOBS */
-
 /* 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.
@@ -63,62 +56,38 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    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. */
-
+   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  */
-
+   if system supports pty's.  'a' means it is /dev/ptya0.  */
 #define FIRST_PTY_LETTER 'a'
 
-/*
- *     Define HAVE_TERMIOS if the system provides POSIX-style
- *     functions and macros for terminal control.
- *
- *     Define HAVE_TERMIO if the system provides sysV-style ioctls
- *     for terminal control.
- *
- *     Do not define both.  HAVE_TERMIOS is preferred, if it is
- *     supported on your system.
- */
+/* Define HAVE_TERMIOS if the system provides POSIX-style
+   functions and macros for terminal control.
+
+   Define HAVE_TERMIO if the system provides sysV-style ioctls
+   for terminal control.
+
+   Do not define both.  HAVE_TERMIOS is preferred, if it is
+   supported on your system.  */
 
 #define HAVE_TERMIOS
 /* #define HAVE_TERMIO */
 
-/*
- *     Define HAVE_PTYS if the system supports pty devices.
- */
-
+/* Define HAVE_PTYS if the system supports pty devices.  */
 #define HAVE_PTYS
 
-/* Define this symbol if your system has the functions bcopy, etc. */
-
-#define BSTRING
-
 /* 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).
-   Currently only MSDOS does not support this. */
+   Currently only MSDOS does not support this.  */
 
 /* #undef subprocesses */
 
-/* If your system uses COFF (Common Object File Format) then define the
-   preprocessor symbol "COFF". */
-
-/* #define COFF */
-
-/* define MAIL_USE_FLOCK if the mailer uses flock
-   to interlock access to /usr/spool/mail/$USER.
-   The alternative is that a lock file named
-   /usr/spool/mail/$USER.lock.  */
-
-#define MAIL_USE_FLOCK
-
 /* 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
 
 /* Define this if your operating system declares signal handlers to
@@ -134,17 +103,13 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    is not ':', #define this to be the appropriate character constant.  */
 /* #define SEPCHAR ':' */
 
-/* Define this if the system can use mmap for buffer text allocation.  */
-/* #define USE_MMAP_FOR_BUFFERS 1 */
-
 /* ============================================================ */
 
-/* Here, 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).  */
+/* Here, 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).  */
 
 /* If the system's imake configuration file defines `NeedWidePrototypes'
    as `NO', we must define NARROWPROTO manually.  Such a define is
@@ -157,10 +122,13 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* ============================================================ */
 
 /* After adding support for a new system, modify the large case
-   statement in the `configure' script to recognize reasonable
+   statement in configure.in 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
+   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 934821dd166e131a252714713cbb805e8e3f517b..81b1b3d97fac836849b979f138090a4a13f5c5fb 100644 (file)
@@ -1,4 +1,63 @@
-#include "usg5-4-2.h"
+/* s/ file for Unixware.
+
+Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+  2008, 2009, 2010  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/>.  */
+
+
+#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(), *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;                \
+  }
+
+/* Data type of load average, as read out of kmem.  */
+#define LOAD_AVE_TYPE long
+
+/* Convert that into an integer that is 100 for a load average of 1.0  */
+/* This is totally uncalibrated. */
+#define LOAD_AVE_CVT(x) ((int) (((double) (x)) * 100.0 / FSCALE))
+#define FSCALE 256.0
+
 
 #define        PENDING_OUTPUT_COUNT(FILE) ((FILE)->__ptr - (FILE)->__base)
 
diff --git a/src/s/usg5-4-2.h b/src/s/usg5-4-2.h
deleted file mode 100644 (file)
index d7f2c60..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/* s/ file for System V release 4.2.
-
-   Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-                 2008, 2009, 2010  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/>.  */
-
-
-#include "usg5-4.h"
-
-/* fnf@cygnus.com says these exist.  */
-#define HAVE_TCATTR
-/* #define HAVE_GETWD  (appears to be buggy on SVR4.2) */
-#undef HAVE_GETWD
-
-/* Info from fnf@cygnus.com suggests this is appropriate.  */
-#define POSIX_SIGNALS
-
-/* We don't need the definition from usg5-3.h with POSIX_SIGNALS.  */
-#undef sigsetmask
-#undef HAVE_SYSV_SIGPAUSE
-
-/* Motif needs -lgen.  */
-#define LIBS_SYSTEM -lsocket -lnsl -lelf -lgen
-
-/* This is the same definition as in usg5-4.h, but with sigblock/sigunblock
-   rather than sighold/sigrelse, which appear to be BSD4.1 specific and won't
-   work if POSIX_SIGNALS is defined.  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). */
-
-#undef PTY_TTY_NAME_SPRINTF
-#define PTY_TTY_NAME_SPRINTF                   \
-  {                                            \
-    char *ptsname(), *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;                \
-  }
-
-/* Use libw.a along with X11R6 Xt.  */
-#define NEED_LIBW
-
-/* ryanr@ellingtn.ftc.nrcs.usda.gov (Richard Anthony Ryan) says -lXimp
-   is needed in UNIX_SV ... 4.2 1.1.2.  */
-#define LIB_MOTIF -lXm -lXimp
-
-/* arch-tag: 9bbfcfc1-19be-45a1-9699-af57b87da2c6
-   (do not change this comment) */
diff --git a/src/s/usg5-4-common.h b/src/s/usg5-4-common.h
new file mode 100644 (file)
index 0000000..7ff5c6f
--- /dev/null
@@ -0,0 +1,116 @@
+/* Definitions file for GNU Emacs running on AT&T's System V Release 4
+
+Copyright (C) 1987, 1990, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+  2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
+
+Written by James Van Artsdalen of Dell Computer Corp. james@bigtex.cactus.org.
+Subsequently improved for Dell 2.2 by Eric S. Raymond <esr@snark.thyrsus.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/>.  */
+
+/* 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"
+
+/* Define HAVE_TERMIO if the system provides sysV-style ioctls
+   for terminal control.  */
+#define HAVE_TERMIO
+
+/* The file containing the kernel's symbol table is called /unix.  */
+#define KERNEL_FILE "/unix"
+
+/* The kernel symbol where the load average is found is named avenrun.  */
+#define LDAV_SYMBOL "avenrun"
+
+/* 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
+
+/* On USG systems signal handlers return void.  */
+#define SIGTYPE void
+
+/* 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.  */
+#include <sys/wait.h>
+
+#ifdef emacs
+#include <sys/filio.h>
+#include <termio.h>
+#include <sys/ttold.h>
+#include <signal.h>
+#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
+#define HAVE_TERMIOS
+
+/* 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
+   wait3 instead, which maps to waitpid(2) in SysVr4. */
+#define wait3(status, options, rusage) \
+  waitpid ((pid_t) -1, (status), (options))
+#define WRETCODE(w) (w >> 8)
+
+/* TIOCGPGRP is broken in SysVr4, so we can't send signals to PTY
+   subprocesses the usual way.  But TIOCSIGNAL does work for PTYs, and
+   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", errno);                \
+  if (ioctl (xforkin, I_PUSH, "ldterm") == -1) \
+    fatal ("ioctl I_PUSH ldterm", errno);      \
+  if (ioctl (xforkin, I_PUSH, "ttcompat") == -1) \
+    fatal ("ioctl I_PUSH ttcompat", errno);
+
+/* This definition was suggested for next release.  So give it a try.  */
+#define HAVE_SOCKETS
+
+/* arch-tag: 1a0ed909-5faa-434b-b7c3-9d86c63d53a6
+   (do not change this comment) */
diff --git a/src/s/usg5-4.h b/src/s/usg5-4.h
deleted file mode 100644 (file)
index c611911..0000000
+++ /dev/null
@@ -1,215 +0,0 @@
-/* Definitions file for GNU Emacs running on AT&T's System V Release 4
-   Copyright (C) 1987, 1990, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-                 2006, 2007, 2008, 2009, 2010  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/>.  */
-
-/* This file written by James Van Artsdalen of Dell Computer Corporation.
- * james@bigtex.cactus.org.  Subsequently improved for Dell 2.2 by Eric
- * S. Raymond <esr@snark.thyrsus.com>.
- */
-
-/* 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"
-
-/*
- *     Define HAVE_TERMIO if the system provides sysV-style ioctls
- *     for terminal control.
- */
-
-#define HAVE_TERMIO
-
-/*
- *     Define HAVE_PTYS if the system supports pty devices.
- */
-
-/*
- *     Define SYSV_SYSTEM_DIR to use the V.3 getdents/readir
- *     library functions.  Almost, but not quite the same as
- *     the 4.2 functions
- */
-#define SYSV_SYSTEM_DIR
-
-/* The file containing the kernel's symbol table is called /unix.  */
-
-#define KERNEL_FILE "/unix"
-
-/* The symbol in the kernel where the load average is found
-   is named avenrun.  */
-
-#define LDAV_SYMBOL "avenrun"
-
-/* Special hacks needed to make Emacs run on this system.  */
-
-/*
- *     Make the sigsetmask function go away.  Don't know what the
- *     ramifications of this are, but doesn't seem possible to
- *     emulate it properly anyway at this point.
- */
-
-#define sigsetmask(mask)       /* Null expansion */
-
-/* setjmp and longjmp can safely replace _setjmp and _longjmp,
-   but they will run slower.  */
-
-#define _setjmp setjmp
-#define _longjmp longjmp
-
-/* On USG systems these have different names */
-#ifndef HAVE_INDEX
-#define index strchr
-#endif /* ! defined (HAVE_INDEX) */
-#ifndef HAVE_RINDEX
-#define rindex strrchr
-#endif /* ! defined (HAVE_RINDEX) */
-
-/* Use terminfo instead of termcap.  */
-
-#define TERMINFO
-
-
-/* The docs for system V/386 suggest v.3 has sigpause,
-   so let's give it a try.  */
-#define HAVE_SYSV_SIGPAUSE
-
-
-/* If we're using the System V X port, BSD bstring functions will be handy */
-
-#ifdef HAVE_X_WINDOWS
-#define BSTRING
-#endif /* HAVE_X_WINDOWS */
-
-/* On USG systems signal handlers return void */
-
-#define SIGTYPE void
-
-#define ORDINARY_LINK
-
-#define LIB_STANDARD
-
-/* there are no -lg libraries on this system, and no libPW */
-
-#define LIBS_DEBUG
-
-/* Undump with ELF */
-
-#undef COFF
-
-#define UNEXEC unexelf.o
-
-/* 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.
- */
-
-#ifndef NOT_C_CODE
-#include <sys/wait.h>
-#endif
-
-#ifdef emacs
-#include <sys/filio.h>
-#include <termio.h>
-#include <sys/ttold.h>
-#include <signal.h>
-#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
-#define HAVE_TERMIOS
-
-/* 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
-   wait3 instead, which maps to waitpid(2) in SysVr4. */
-
-#define wait3(status, options, rusage) \
-  waitpid ((pid_t) -1, (status), (options))
-#define WRETCODE(w) (w >> 8)
-
-/* TIOCGPGRP is broken in SysVr4, so we can't send signals to PTY
-   subprocesses the usual way.  But TIOCSIGNAL does work for PTYs, and
-   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");
-
-/* 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 (), *ptyname;                                \
-                                                       \
-    sighold (SIGCLD);                                  \
-    if (grantpt (fd) == -1)                            \
-      { emacs_close (fd); return -1; }                 \
-    sigrelse (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;               \
-  }
-
-/* Push various streams modules onto a PTY channel. */
-
-#define SETUP_SLAVE_PTY \
-  if (ioctl (xforkin, I_PUSH, "ptem") == -1)   \
-    fatal ("ioctl I_PUSH ptem", errno);                \
-  if (ioctl (xforkin, I_PUSH, "ldterm") == -1) \
-    fatal ("ioctl I_PUSH ldterm", errno);      \
-  if (ioctl (xforkin, I_PUSH, "ttcompat") == -1) \
-    fatal ("ioctl I_PUSH ttcompat", errno);
-
-/* This definition was suggested for next release.
-   So give it a try.  */
-#define HAVE_SOCKETS
-
-/* arch-tag: 1a0ed909-5faa-434b-b7c3-9d86c63d53a6
-   (do not change this comment) */
index e2d3656dc439b2c70f516d958af19904e478f7ac..bdb7f691ee7680ea0419309d92583023fe09b0ff 100644 (file)
@@ -58,14 +58,14 @@ struct matrix_elt
     unsigned char writecount;
   };
 
-static void do_direct_scrolling P_ ((struct frame *,
-                                     struct glyph_matrix *,
-                                    struct matrix_elt *,
-                                    int, int));
-static void do_scrolling P_ ((struct frame *,
-                              struct glyph_matrix *,
-                             struct matrix_elt *,
-                             int, int));
+static void do_direct_scrolling (struct frame *,
+                                 struct glyph_matrix *,
+                                 struct matrix_elt *,
+                                 int, int);
+static void do_scrolling (struct frame *,
+                          struct glyph_matrix *,
+                          struct matrix_elt *,
+                          int, int);
 
 \f
 /* Determine, in matrix[i,j], the cost of updating the first j old
@@ -86,17 +86,12 @@ static void do_scrolling P_ ((struct frame *,
    new contents appears.  */
 
 static void
-calculate_scrolling (frame, matrix, window_size, lines_below,
-                    draw_cost, old_hash, new_hash,
-                    free_at_end)
-     FRAME_PTR frame;
-     /* matrix is of size window_size + 1 on each side.  */
-     struct matrix_elt *matrix;
-     int window_size, lines_below;
-     int *draw_cost;
-     int *old_hash;
-     int *new_hash;
-     int free_at_end;
+calculate_scrolling (FRAME_PTR frame,
+                    /* matrix is of size window_size + 1 on each side.  */
+                    struct matrix_elt *matrix,
+                    int window_size, int lines_below,
+                    int *draw_cost, int *old_hash, int *new_hash,
+                    int free_at_end)
 {
   register int i, j;
   int frame_lines = FRAME_LINES (frame);
@@ -244,12 +239,7 @@ calculate_scrolling (frame, matrix, window_size, lines_below,
    of lines.  */
 
 static void
-do_scrolling (frame, current_matrix, matrix, window_size, unchanged_at_top)
-     struct frame *frame;
-     struct glyph_matrix *current_matrix;
-     struct matrix_elt *matrix;
-     int window_size;
-     int unchanged_at_top;
+do_scrolling (struct frame *frame, struct glyph_matrix *current_matrix, struct matrix_elt *matrix, int window_size, int unchanged_at_top)
 {
   struct matrix_elt *p;
   int i, j, k;
@@ -268,7 +258,7 @@ do_scrolling (frame, current_matrix, matrix, window_size, unchanged_at_top)
   int *copy_from = (int *) alloca (window_size * sizeof (int));
 
   /* Zero means line is empty.  */
-  bzero (retained_p, window_size * sizeof (char));
+  memset (retained_p, 0, window_size * sizeof (char));
   for (k = 0; k < window_size; ++k)
     copy_from[k] = -1;
 
@@ -429,18 +419,13 @@ do_scrolling (frame, current_matrix, matrix, window_size, unchanged_at_top)
    is the equivalent of draw_cost for the old line contents */
 
 static void
-calculate_direct_scrolling (frame, matrix, window_size, lines_below,
-                           draw_cost, old_draw_cost, old_hash, new_hash,
-                           free_at_end)
-     FRAME_PTR frame;
-     /* matrix is of size window_size + 1 on each side.  */
-     struct matrix_elt *matrix;
-     int window_size, lines_below;
-     int *draw_cost;
-     int *old_draw_cost;
-     int *old_hash;
-     int *new_hash;
-     int free_at_end;
+calculate_direct_scrolling (FRAME_PTR frame,
+                           /* matrix is of size window_size + 1 on each side.  */
+                           struct matrix_elt *matrix,
+                           int window_size, int lines_below,
+                           int *draw_cost, int *old_draw_cost,
+                           int *old_hash, int *new_hash,
+                           int free_at_end)
 {
   register int i, j;
   int frame_lines = FRAME_LINES (frame);
@@ -655,13 +640,9 @@ calculate_direct_scrolling (frame, matrix, window_size, lines_below,
    the cost matrix for this approach is constructed. */
 
 static void
-do_direct_scrolling (frame, current_matrix, cost_matrix,
-                     window_size, unchanged_at_top)
-     struct frame *frame;
-     struct glyph_matrix *current_matrix;
-     struct matrix_elt *cost_matrix;
-     int window_size;
-     int unchanged_at_top;
+do_direct_scrolling (struct frame *frame, struct glyph_matrix *current_matrix,
+                    struct matrix_elt *cost_matrix, int window_size,
+                    int unchanged_at_top)
 {
   struct matrix_elt *p;
   int i, j;
@@ -692,7 +673,7 @@ do_direct_scrolling (frame, current_matrix, cost_matrix,
      old matrix.  Lines not retained are empty.  */
   char *retained_p = (char *) alloca (window_size * sizeof (char));
 
-  bzero (retained_p, window_size * sizeof (char));
+  memset (retained_p, 0, window_size * sizeof (char));
 
   /* Perform some sanity checks when GLYPH_DEBUG is on.  */
   CHECK_MATRIX (current_matrix);
@@ -811,15 +792,9 @@ do_direct_scrolling (frame, current_matrix, cost_matrix,
 
 \f
 void
-scrolling_1 (frame, window_size, unchanged_at_top, unchanged_at_bottom,
-            draw_cost, old_draw_cost, old_hash, new_hash, free_at_end)
-     FRAME_PTR frame;
-     int window_size, unchanged_at_top, unchanged_at_bottom;
-     int *draw_cost;
-     int *old_draw_cost;
-     int *old_hash;
-     int *new_hash;
-     int free_at_end;
+scrolling_1 (FRAME_PTR frame, int window_size, int unchanged_at_top,
+            int unchanged_at_bottom, int *draw_cost, int *old_draw_cost,
+            int *old_hash, int *new_hash, int free_at_end)
 {
   struct matrix_elt *matrix;
   matrix = ((struct matrix_elt *)
@@ -854,9 +829,7 @@ scrolling_1 (frame, window_size, unchanged_at_top, unchanged_at_bottom,
    such a line will have little weight.  */
 
 int
-scrolling_max_lines_saved (start, end, oldhash, newhash, cost)
-     int start, end;
-     int *oldhash, *newhash, *cost;
+scrolling_max_lines_saved (int start, int end, int *oldhash, int *newhash, int *cost)
 {
   struct { int hash; int count; } lines[01000];
   register int i, h;
@@ -872,7 +845,7 @@ scrolling_max_lines_saved (start, end, oldhash, newhash, cost)
   avg_length /= end - start;
   threshold = avg_length / 4;
 
-  bzero (lines, sizeof lines);
+  memset (lines, 0, sizeof lines);
 
   /* Put new lines' hash codes in hash table.  Ignore lines shorter
      than the threshold.  Thus, if the lines that are in common are
@@ -909,9 +882,7 @@ scrolling_max_lines_saved (start, end, oldhash, newhash, cost)
    to scroll_frame_lines to perform this scrolling.  */
 
 int
-scroll_cost (frame, from, to, amount)
-     FRAME_PTR frame;
-     int from, to, amount;
+scroll_cost (FRAME_PTR frame, int from, int to, int amount)
 {
   /* Compute how many lines, at bottom of frame,
      will not be involved in actual motion.  */
@@ -948,11 +919,7 @@ scroll_cost (frame, from, to, amount)
    overhead and multiply factor values */
 
 static void
-line_ins_del (frame, ov1, pf1, ovn, pfn, ov, mf)
-     FRAME_PTR frame;
-     int ov1, ovn;
-     int pf1, pfn;
-     register int *ov, *mf;
+line_ins_del (FRAME_PTR frame, int ov1, int pf1, int ovn, int pfn, register int *ov, register int *mf)
 {
   register int i;
   register int frame_lines = FRAME_LINES (frame);
@@ -969,15 +936,11 @@ line_ins_del (frame, ov1, pf1, ovn, pfn, ov, mf)
 }
 
 static void
-ins_del_costs (frame,
-              one_line_string, multi_string,
-              setup_string, cleanup_string,
-              costvec, ncostvec, coefficient)
-     FRAME_PTR frame;
-     char *one_line_string, *multi_string;
-     char *setup_string, *cleanup_string;
-     int *costvec, *ncostvec;
-     int coefficient;
+ins_del_costs (FRAME_PTR frame,
+              char *one_line_string, char *multi_string,
+              char *setup_string, char *cleanup_string,
+              int *costvec, int *ncostvec,
+              int coefficient)
 {
   if (multi_string)
     line_ins_del (frame,
@@ -1029,15 +992,11 @@ ins_del_costs (frame,
  */
 
 void
-do_line_insertion_deletion_costs (frame,
-                                 ins_line_string, multi_ins_string,
-                                 del_line_string, multi_del_string,
-                                 setup_string, cleanup_string, coefficient)
-     FRAME_PTR frame;
-     char *ins_line_string, *multi_ins_string;
-     char *del_line_string, *multi_del_string;
-     char *setup_string, *cleanup_string;
-     int coefficient;
+do_line_insertion_deletion_costs (FRAME_PTR frame,
+                                 char *ins_line_string, char *multi_ins_string,
+                                 char *del_line_string, char *multi_del_string,
+                                 char *setup_string, char *cleanup_string,
+                                 int coefficient)
 {
   if (FRAME_INSERT_COST (frame) != 0)
     {
index 736a89258f5e5a721b2038cb7c906e5e3d84cce9..0e9840b2e5f20221a8a12dc9fa120b12e3141707 100644 (file)
@@ -98,22 +98,22 @@ Lisp_Object Vsearch_spaces_regexp;
    only.  */
 Lisp_Object Vinhibit_changing_match_data;
 
-static void set_search_regs P_ ((EMACS_INT, EMACS_INT));
-static void save_search_regs P_ ((void));
-static EMACS_INT simple_search P_ ((int, unsigned char *, int, int,
-                                   Lisp_Object, EMACS_INT, EMACS_INT,
-                                   EMACS_INT, EMACS_INT));
-static EMACS_INT boyer_moore P_ ((int, unsigned char *, int, int,
-                                 Lisp_Object, Lisp_Object,
-                                 EMACS_INT, EMACS_INT,
-                                 EMACS_INT, EMACS_INT, int));
-static EMACS_INT search_buffer P_ ((Lisp_Object, EMACS_INT, EMACS_INT,
-                                   EMACS_INT, EMACS_INT, int, int,
-                                   Lisp_Object, Lisp_Object, int));
-static void matcher_overflow () NO_RETURN;
+static void set_search_regs (EMACS_INT, EMACS_INT);
+static void save_search_regs (void);
+static EMACS_INT simple_search (int, unsigned char *, int, int,
+                                Lisp_Object, EMACS_INT, EMACS_INT,
+                                EMACS_INT, EMACS_INT);
+static EMACS_INT boyer_moore (int, unsigned char *, int, int,
+                              Lisp_Object, Lisp_Object,
+                              EMACS_INT, EMACS_INT,
+                              EMACS_INT, EMACS_INT, int);
+static EMACS_INT search_buffer (Lisp_Object, EMACS_INT, EMACS_INT,
+                                EMACS_INT, EMACS_INT, int, int,
+                                Lisp_Object, Lisp_Object, int);
+static void matcher_overflow (void) NO_RETURN;
 
 static void
-matcher_overflow ()
+matcher_overflow (void)
 {
   error ("Stack overflow in regexp matcher");
 }
@@ -132,12 +132,7 @@ matcher_overflow ()
    The behavior also depends on Vsearch_spaces_regexp.  */
 
 static void
-compile_pattern_1 (cp, pattern, translate, regp, posix)
-     struct regexp_cache *cp;
-     Lisp_Object pattern;
-     Lisp_Object translate;
-     struct re_registers *regp;
-     int posix;
+compile_pattern_1 (struct regexp_cache *cp, Lisp_Object pattern, Lisp_Object translate, struct re_registers *regp, int posix)
 {
   char *val;
   reg_syntax_t old;
@@ -187,7 +182,7 @@ compile_pattern_1 (cp, pattern, translate, regp, posix)
    This is called from garbage collection.  */
 
 void
-shrink_regexp_cache ()
+shrink_regexp_cache (void)
 {
   struct regexp_cache *cp;
 
@@ -205,7 +200,7 @@ shrink_regexp_cache ()
    automagically manages the memory in each re_pattern_buffer struct,
    based on its `allocated' and `buffer' values.  */
 void
-clear_regexp_cache ()
+clear_regexp_cache (void)
 {
   int i;
 
@@ -229,11 +224,7 @@ clear_regexp_cache ()
    for this pattern.  0 means backtrack only enough to get a valid match.  */
 
 struct re_pattern_buffer *
-compile_pattern (pattern, regp, translate, posix, multibyte)
-     Lisp_Object pattern;
-     struct re_registers *regp;
-     Lisp_Object translate;
-     int posix, multibyte;
+compile_pattern (Lisp_Object pattern, struct re_registers *regp, Lisp_Object translate, int posix, int multibyte)
 {
   struct regexp_cache *cp, **cpp;
 
@@ -290,9 +281,7 @@ compile_pattern (pattern, regp, translate, posix, multibyte)
 
 \f
 static Lisp_Object
-looking_at_1 (string, posix)
-     Lisp_Object string;
-     int posix;
+looking_at_1 (Lisp_Object string, int posix)
 {
   Lisp_Object val;
   unsigned char *p1, *p2;
@@ -373,8 +362,7 @@ DEFUN ("looking-at", Flooking_at, Slooking_at, 1, 1, 0,
 This function modifies the match data that `match-beginning',
 `match-end' and `match-data' access; save and restore the match
 data if you want to preserve them.  */)
-     (regexp)
-     Lisp_Object regexp;
+  (Lisp_Object regexp)
 {
   return looking_at_1 (regexp, 0);
 }
@@ -385,16 +373,13 @@ Find the longest match, in accord with Posix regular expression rules.
 This function modifies the match data that `match-beginning',
 `match-end' and `match-data' access; save and restore the match
 data if you want to preserve them.  */)
-     (regexp)
-     Lisp_Object regexp;
+  (Lisp_Object regexp)
 {
   return looking_at_1 (regexp, 1);
 }
 \f
 static Lisp_Object
-string_match_1 (regexp, string, start, posix)
-     Lisp_Object regexp, string, start;
-     int posix;
+string_match_1 (Lisp_Object regexp, Lisp_Object string, Lisp_Object start, int posix)
 {
   int val;
   struct re_pattern_buffer *bufp;
@@ -474,8 +459,7 @@ matched by parenthesis constructs in the pattern.
 
 You can use the function `match-string' to extract the substrings
 matched by the parenthesis constructions in REGEXP. */)
-     (regexp, string, start)
-     Lisp_Object regexp, string, start;
+  (Lisp_Object regexp, Lisp_Object string, Lisp_Object start)
 {
   return string_match_1 (regexp, string, start, 0);
 }
@@ -488,8 +472,7 @@ If third arg START is non-nil, start search at that index in STRING.
 For index of first char beyond the match, do (match-end 0).
 `match-end' and `match-beginning' also give indices of substrings
 matched by parenthesis constructs in the pattern.  */)
-     (regexp, string, start)
-     Lisp_Object regexp, string, start;
+  (Lisp_Object regexp, Lisp_Object string, Lisp_Object start)
 {
   return string_match_1 (regexp, string, start, 1);
 }
@@ -499,8 +482,7 @@ matched by parenthesis constructs in the pattern.  */)
    This does not clobber the match data.  */
 
 int
-fast_string_match (regexp, string)
-     Lisp_Object regexp, string;
+fast_string_match (Lisp_Object regexp, Lisp_Object string)
 {
   int val;
   struct re_pattern_buffer *bufp;
@@ -522,12 +504,8 @@ fast_string_match (regexp, string)
    This does not clobber the match data.
    We assume that STRING contains single-byte characters.  */
 
-extern Lisp_Object Vascii_downcase_table;
-
 int
-fast_c_string_match_ignore_case (regexp, string)
-     Lisp_Object regexp;
-     const char *string;
+fast_c_string_match_ignore_case (Lisp_Object regexp, const char *string)
 {
   int val;
   struct re_pattern_buffer *bufp;
@@ -547,8 +525,7 @@ fast_c_string_match_ignore_case (regexp, string)
 /* Like fast_string_match but ignore case.  */
 
 int
-fast_string_match_ignore_case (regexp, string)
-     Lisp_Object regexp, string;
+fast_string_match_ignore_case (Lisp_Object regexp, Lisp_Object string)
 {
   int val;
   struct re_pattern_buffer *bufp;
@@ -572,10 +549,7 @@ fast_string_match_ignore_case (regexp, string)
    data.  */
 
 EMACS_INT
-fast_looking_at (regexp, pos, pos_byte, limit, limit_byte, string)
-     Lisp_Object regexp;
-     EMACS_INT pos, pos_byte, limit, limit_byte;
-     Lisp_Object string;
+fast_looking_at (Lisp_Object regexp, EMACS_INT pos, EMACS_INT pos_byte, EMACS_INT limit, EMACS_INT limit_byte, Lisp_Object string)
 {
   int multibyte;
   struct re_pattern_buffer *buf;
@@ -640,8 +614,7 @@ fast_looking_at (regexp, pos, pos_byte, limit, limit_byte, string)
    This is our cheezy way of associating an action with the change of
    state of a buffer-local variable.  */
 static void
-newline_cache_on_off (buf)
-     struct buffer *buf;
+newline_cache_on_off (struct buffer *buf)
 {
   if (NILP (buf->cache_long_line_scans))
     {
@@ -682,12 +655,7 @@ newline_cache_on_off (buf)
    except when inside redisplay.  */
 
 int
-scan_buffer (target, start, end, count, shortage, allow_quit)
-     register int target;
-     EMACS_INT start, end;
-     int count;
-     int *shortage;
-     int allow_quit;
+scan_buffer (register int target, EMACS_INT start, EMACS_INT end, int count, int *shortage, int allow_quit)
 {
   struct region_cache *newline_cache;
   int direction;
@@ -879,11 +847,7 @@ scan_buffer (target, start, end, count, shortage, allow_quit)
    except in special cases.  */
 
 int
-scan_newline (start, start_byte, limit, limit_byte, count, allow_quit)
-     EMACS_INT start, start_byte;
-     EMACS_INT limit, limit_byte;
-     register int count;
-     int allow_quit;
+scan_newline (EMACS_INT start, EMACS_INT start_byte, EMACS_INT limit, EMACS_INT limit_byte, register int count, int allow_quit)
 {
   int direction = ((count > 0) ? 1 : -1);
 
@@ -977,9 +941,7 @@ scan_newline (start, start_byte, limit, limit_byte, count, allow_quit)
 }
 
 int
-find_next_newline_no_quit (from, cnt)
-     EMACS_INT from;
-     int cnt;
+find_next_newline_no_quit (EMACS_INT from, int cnt)
 {
   return scan_buffer ('\n', from, 0, cnt, (int *) 0, 0);
 }
@@ -989,9 +951,7 @@ find_next_newline_no_quit (from, cnt)
    find_next_newline (...)-1, because you might hit TO.  */
 
 int
-find_before_next_newline (from, to, cnt)
-     EMACS_INT from, to;
-     int cnt;
+find_before_next_newline (EMACS_INT from, EMACS_INT to, int cnt)
 {
   int shortage;
   int pos = scan_buffer ('\n', from, to, cnt, &shortage, 1);
@@ -1005,11 +965,7 @@ find_before_next_newline (from, to, cnt)
 /* Subroutines of Lisp buffer search functions. */
 
 static Lisp_Object
-search_command (string, bound, noerror, count, direction, RE, posix)
-     Lisp_Object string, bound, noerror, count;
-     int direction;
-     int RE;
-     int posix;
+search_command (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror, Lisp_Object count, int direction, int RE, int posix)
 {
   register int np;
   int lim, lim_byte;
@@ -1086,8 +1042,7 @@ search_command (string, bound, noerror, count, direction, RE, posix)
 /* Return 1 if REGEXP it matches just one constant string.  */
 
 static int
-trivial_regexp_p (regexp)
-     Lisp_Object regexp;
+trivial_regexp_p (Lisp_Object regexp)
 {
   int len = SBYTES (regexp);
   unsigned char *s = SDATA (regexp);
@@ -1153,18 +1108,9 @@ while (0)
 static struct re_registers search_regs_1;
 
 static EMACS_INT
-search_buffer (string, pos, pos_byte, lim, lim_byte, n,
-              RE, trt, inverse_trt, posix)
-     Lisp_Object string;
-     EMACS_INT pos;
-     EMACS_INT pos_byte;
-     EMACS_INT lim;
-     EMACS_INT lim_byte;
-     int n;
-     int RE;
-     Lisp_Object trt;
-     Lisp_Object inverse_trt;
-     int posix;
+search_buffer (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte,
+              EMACS_INT lim, EMACS_INT lim_byte, int n,
+              int RE, Lisp_Object trt, Lisp_Object inverse_trt, int posix)
 {
   int len = SCHARS (string);
   int len_byte = SBYTES (string);
@@ -1443,7 +1389,7 @@ search_buffer (string, pos, pos_byte, lim, lim_byte, n,
                }
 
              /* Store this character into the translated pattern.  */
-             bcopy (str, pat, charlen);
+             memcpy (pat, str, charlen);
              pat += charlen;
              base_pat += in_charlen;
              len_byte -= in_charlen;
@@ -1504,13 +1450,7 @@ search_buffer (string, pos, pos_byte, lim, lim_byte, n,
    boyer_moore cannot work.  */
 
 static EMACS_INT
-simple_search (n, pat, len, len_byte, trt, pos, pos_byte, lim, lim_byte)
-     int n;
-     unsigned char *pat;
-     int len, len_byte;
-     Lisp_Object trt;
-     EMACS_INT pos, pos_byte;
-     EMACS_INT lim, lim_byte;
+simple_search (int n, unsigned char *pat, int len, int len_byte, Lisp_Object trt, EMACS_INT pos, EMACS_INT pos_byte, EMACS_INT lim, EMACS_INT lim_byte)
 {
   int multibyte = ! NILP (current_buffer->enable_multibyte_characters);
   int forward = n > 0;
@@ -1717,16 +1657,10 @@ simple_search (n, pat, len, len_byte, trt, pos, pos_byte, lim, lim_byte)
    If that criterion is not satisfied, do not call this function.  */
 
 static EMACS_INT
-boyer_moore (n, base_pat, len, len_byte, trt, inverse_trt,
-            pos, pos_byte, lim, lim_byte, char_base)
-     int n;
-     unsigned char *base_pat;
-     int len, len_byte;
-     Lisp_Object trt;
-     Lisp_Object inverse_trt;
-     EMACS_INT pos, pos_byte;
-     EMACS_INT lim, lim_byte;
-     int char_base;
+boyer_moore (int n, unsigned char *base_pat, int len, int len_byte,
+            Lisp_Object trt, Lisp_Object inverse_trt,
+            EMACS_INT pos, EMACS_INT pos_byte,
+            EMACS_INT lim, EMACS_INT lim_byte, int char_base)
 {
   int direction = ((n > 0) ? 1 : -1);
   register int dirlen;
@@ -2127,8 +2061,7 @@ boyer_moore (n, base_pat, len, len_byte, trt, inverse_trt,
    Also clear out the match data for registers 1 and up.  */
 
 static void
-set_search_regs (beg_byte, nbytes)
-     EMACS_INT beg_byte, nbytes;
+set_search_regs (EMACS_INT beg_byte, EMACS_INT nbytes)
 {
   int i;
 
@@ -2162,9 +2095,7 @@ set_search_regs (beg_byte, nbytes)
    need not match a word boundary unless it ends in whitespace.  */
 
 static Lisp_Object
-wordify (string, lax)
-     Lisp_Object string;
-     int lax;
+wordify (Lisp_Object string, int lax)
 {
   register unsigned char *p, *o;
   register int i, i_byte, len, punct_count = 0, word_count = 0;
@@ -2226,8 +2157,7 @@ wordify (string, lax)
 
       if (SYNTAX (c) == Sword)
        {
-         bcopy (SDATA (string) + i_byte_orig, o,
-                i_byte - i_byte_orig);
+         memcpy (o, SDATA (string) + i_byte_orig, i_byte - i_byte_orig);
          o += i_byte - i_byte_orig;
        }
       else if (i > 0 && SYNTAX (prev_c) == Sword && --word_count)
@@ -2265,8 +2195,7 @@ Search case-sensitivity is determined by the value of the variable
 `case-fold-search', which see.
 
 See also the functions `match-beginning', `match-end' and `replace-match'.  */)
-     (string, bound, noerror, count)
-     Lisp_Object string, bound, noerror, count;
+  (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror, Lisp_Object count)
 {
   return search_command (string, bound, noerror, count, -1, 0, 0);
 }
@@ -2285,8 +2214,7 @@ Search case-sensitivity is determined by the value of the variable
 `case-fold-search', which see.
 
 See also the functions `match-beginning', `match-end' and `replace-match'.  */)
-     (string, bound, noerror, count)
-     Lisp_Object string, bound, noerror, count;
+  (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror, Lisp_Object count)
 {
   return search_command (string, bound, noerror, count, 1, 0, 0);
 }
@@ -2300,8 +2228,7 @@ 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.  */)
-     (string, bound, noerror, count)
-     Lisp_Object string, bound, noerror, count;
+  (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror, Lisp_Object count)
 {
   return search_command (wordify (string, 0), bound, noerror, count, -1, 1, 0);
 }
@@ -2315,8 +2242,7 @@ 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.  */)
-     (string, bound, noerror, count)
-     Lisp_Object string, bound, noerror, count;
+  (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror, Lisp_Object count)
 {
   return search_command (wordify (string, 0), bound, noerror, count, 1, 1, 0);
 }
@@ -2334,8 +2260,7 @@ 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.  */)
-     (string, bound, noerror, count)
-     Lisp_Object string, bound, noerror, count;
+  (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror, Lisp_Object count)
 {
   return search_command (wordify (string, 1), bound, noerror, count, -1, 1, 0);
 }
@@ -2353,8 +2278,7 @@ 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.  */)
-     (string, bound, noerror, count)
-     Lisp_Object string, bound, noerror, count;
+  (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror, Lisp_Object count)
 {
   return search_command (wordify (string, 1), bound, noerror, count, 1, 1, 0);
 }
@@ -2372,8 +2296,7 @@ Optional third argument, if t, means if fail just return nil (no error).
 Optional fourth argument is repeat count--search for successive occurrences.
 See also the functions `match-beginning', `match-end', `match-string',
 and `replace-match'.  */)
-     (regexp, bound, noerror, count)
-     Lisp_Object regexp, bound, noerror, count;
+  (Lisp_Object regexp, Lisp_Object bound, Lisp_Object noerror, Lisp_Object count)
 {
   return search_command (regexp, bound, noerror, count, -1, 1, 0);
 }
@@ -2389,8 +2312,7 @@ Optional third argument, if t, means if fail just return nil (no error).
 Optional fourth argument is repeat count--search for successive occurrences.
 See also the functions `match-beginning', `match-end', `match-string',
 and `replace-match'.  */)
-     (regexp, bound, noerror, count)
-     Lisp_Object regexp, bound, noerror, count;
+  (Lisp_Object regexp, Lisp_Object bound, Lisp_Object noerror, Lisp_Object count)
 {
   return search_command (regexp, bound, noerror, count, 1, 1, 0);
 }
@@ -2409,8 +2331,7 @@ Optional third argument, if t, means if fail just return nil (no error).
 Optional fourth argument is repeat count--search for successive occurrences.
 See also the functions `match-beginning', `match-end', `match-string',
 and `replace-match'.  */)
-     (regexp, bound, noerror, count)
-     Lisp_Object regexp, bound, noerror, count;
+  (Lisp_Object regexp, Lisp_Object bound, Lisp_Object noerror, Lisp_Object count)
 {
   return search_command (regexp, bound, noerror, count, -1, 1, 1);
 }
@@ -2427,8 +2348,7 @@ Optional third argument, if t, means if fail just return nil (no error).
 Optional fourth argument is repeat count--search for successive occurrences.
 See also the functions `match-beginning', `match-end', `match-string',
 and `replace-match'.  */)
-     (regexp, bound, noerror, count)
-     Lisp_Object regexp, bound, noerror, count;
+  (Lisp_Object regexp, Lisp_Object bound, Lisp_Object noerror, Lisp_Object count)
 {
   return search_command (regexp, bound, noerror, count, 1, 1, 1);
 }
@@ -2469,8 +2389,7 @@ This is, in a vague sense, the inverse of using `\\N' in NEWTEXT;
 NEWTEXT in place of subexp N.
 This is useful only after a regular expression search or match,
 since only regular expressions have distinguished subexpressions.  */)
-     (newtext, fixedcase, literal, string, subexp)
-     Lisp_Object newtext, fixedcase, literal, string, subexp;
+  (Lisp_Object newtext, Lisp_Object fixedcase, Lisp_Object literal, Lisp_Object string, Lisp_Object subexp)
 {
   enum { nochange, all_caps, cap_initial } case_action;
   register int pos, pos_byte;
@@ -2736,7 +2655,7 @@ since only regular expressions have distinguished subexpressions.  */)
       for (pos_byte = 0, pos = 0; pos_byte < length;)
        {
          unsigned char str[MAX_MULTIBYTE_LENGTH];
-         unsigned char *add_stuff = NULL;
+         const unsigned char *add_stuff = NULL;
          int add_len = 0;
          int idx = -1;
 
@@ -2822,7 +2741,7 @@ since only regular expressions have distinguished subexpressions.  */)
          /* Now add to the end of SUBSTED.  */
          if (add_stuff)
            {
-             bcopy (add_stuff, substed + substed_len, add_len);
+             memcpy (substed + substed_len, add_stuff, add_len);
              substed_len += add_len;
            }
        }
@@ -2886,9 +2805,7 @@ since only regular expressions have distinguished subexpressions.  */)
 }
 \f
 static Lisp_Object
-match_limit (num, beginningp)
-     Lisp_Object num;
-     int beginningp;
+match_limit (Lisp_Object num, int beginningp)
 {
   register int n;
 
@@ -2912,8 +2829,7 @@ SUBEXP, a number, specifies which parenthesized expression in the last
 Value is nil if SUBEXPth pair didn't match, or there were less than
   SUBEXP pairs.
 Zero means the entire text matched by the whole regexp or whole string.  */)
-     (subexp)
-     Lisp_Object subexp;
+  (Lisp_Object subexp)
 {
   return match_limit (subexp, 1);
 }
@@ -2925,8 +2841,7 @@ SUBEXP, a number, specifies which parenthesized expression in the last
 Value is nil if SUBEXPth pair didn't match, or there were less than
   SUBEXP pairs.
 Zero means the entire text matched by the whole regexp or whole string.  */)
-     (subexp)
-     Lisp_Object subexp;
+  (Lisp_Object subexp)
 {
   return match_limit (subexp, 0);
 }
@@ -2951,8 +2866,7 @@ If optional third arg RESEAT is non-nil, any previous markers on the
 REUSE list will be modified to point to nowhere.
 
 Return value is undefined if the last search failed.  */)
-  (integers, reuse, reseat)
-     Lisp_Object integers, reuse, reseat;
+  (Lisp_Object integers, Lisp_Object reuse, Lisp_Object reseat)
 {
   Lisp_Object tail, prev;
   Lisp_Object *data;
@@ -3052,8 +2966,7 @@ DEFUN ("set-match-data", Fset_match_data, Sset_match_data, 1, 2, 0,
 LIST should have been created by calling `match-data' previously.
 
 If optional arg RESEAT is non-nil, make markers on LIST point nowhere.  */)
-    (list, reseat)
-     register Lisp_Object list, reseat;
+  (register Lisp_Object list, Lisp_Object reseat)
 {
   register int i;
   register Lisp_Object marker;
@@ -3171,7 +3084,7 @@ static Lisp_Object saved_last_thing_searched;
 /* Called from Flooking_at, Fstring_match, search_buffer, Fstore_match_data
    if asynchronous code (filter or sentinel) is running. */
 static void
-save_search_regs ()
+save_search_regs (void)
 {
   if (!search_regs_saved)
     {
@@ -3190,7 +3103,7 @@ save_search_regs ()
 
 /* Called upon exit from filters and sentinels. */
 void
-restore_search_regs ()
+restore_search_regs (void)
 {
   if (search_regs_saved)
     {
@@ -3209,8 +3122,7 @@ restore_search_regs ()
 }
 
 static Lisp_Object
-unwind_set_match_data (list)
-     Lisp_Object list;
+unwind_set_match_data (Lisp_Object list)
 {
   /* It is NOT ALWAYS safe to free (evaporate) the markers immediately.  */
   return Fset_match_data (list, Qt);
@@ -3218,7 +3130,7 @@ unwind_set_match_data (list)
 
 /* Called to unwind protect the match data.  */
 void
-record_unwind_save_match_data ()
+record_unwind_save_match_data (void)
 {
   record_unwind_protect (unwind_set_match_data,
                         Fmatch_data (Qnil, Qnil, Qnil));
@@ -3228,8 +3140,7 @@ record_unwind_save_match_data ()
 
 DEFUN ("regexp-quote", Fregexp_quote, Sregexp_quote, 1, 1, 0,
        doc: /* Return a regexp string which matches exactly STRING and nothing else.  */)
-     (string)
-     Lisp_Object string;
+  (Lisp_Object string)
 {
   register unsigned char *in, *out, *end;
   register unsigned char *temp;
@@ -3262,7 +3173,7 @@ DEFUN ("regexp-quote", Fregexp_quote, Sregexp_quote, 1, 1, 0,
 }
 \f
 void
-syms_of_search ()
+syms_of_search (void)
 {
   register int i;
 
index af6daf2e26851fb6995bcbdced2231f66de88749..b93099283daea6f244a170d4f1d1fd51f5be14b1 100644 (file)
@@ -99,7 +99,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* Symbols.  */
 
-extern Lisp_Object QCfile, QCdata;
 Lisp_Object QCvolume, QCdevice;
 Lisp_Object Qsound;
 Lisp_Object Qplay_sound_functions;
@@ -115,10 +114,12 @@ enum sound_attr
   SOUND_ATTR_SENTINEL
 };
 
-static void alsa_sound_perror P_ ((char *, int)) NO_RETURN;
-static void sound_perror P_ ((char *)) NO_RETURN;
-static void sound_warning P_ ((char *));
-static int parse_sound P_ ((Lisp_Object, Lisp_Object *));
+#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 */
 
@@ -225,25 +226,25 @@ struct sound_device
   int channels;
 
   /* Open device SD.  */
-  void (* open) P_ ((struct sound_device *sd));
+  void (* open) (struct sound_device *sd);
 
   /* Close device SD.  */
-  void (* close) P_ ((struct sound_device *sd));
+  void (* close) (struct sound_device *sd);
 
   /* Configure SD accoring to device-dependent parameters.  */
-  void (* configure) P_ ((struct sound_device *device));
+  void (* configure) (struct sound_device *device);
 
   /* Choose a device-dependent format for outputting sound S.  */
-  void (* choose_format) P_ ((struct sound_device *sd,
-                             struct sound *s));
+  void (* choose_format) (struct sound_device *sd,
+                          struct sound *s);
 
   /* Return a preferred data size in bytes to be sent to write (below)
      each time.  2048 is used if this is NULL.  */
-  int (* period_size) P_ ((struct sound_device *sd));
+  int (* period_size) (struct sound_device *sd);
 
   /* Write NYBTES bytes from BUFFER to device SD.  */
-  void (* write) P_ ((struct sound_device *sd, const char *buffer,
-                     int nbytes));
+  void (* write) (struct sound_device *sd, const char *buffer,
+                  int nbytes);
 
   /* A place for devices to store additional data.  */
   void *data;
@@ -279,7 +280,7 @@ struct sound
   Lisp_Object data;
 
   /* Play sound file S on device SD.  */
-  void (* play) P_ ((struct sound *s, struct sound_device *sd));
+  void (* play) (struct sound *s, struct sound_device *sd);
 };
 
 /* These are set during `play-sound-internal' so that sound_cleanup has
@@ -290,30 +291,30 @@ struct sound *current_sound;
 
 /* Function prototypes.  */
 
-static void vox_open P_ ((struct sound_device *));
-static void vox_configure P_ ((struct sound_device *));
-static void vox_close P_ ((struct sound_device *sd));
-static void vox_choose_format P_ ((struct sound_device *, struct sound *));
-static int vox_init P_ ((struct sound_device *));
-static void vox_write P_ ((struct sound_device *, const char *, int));
-static void find_sound_type P_ ((struct sound *));
-static u_int32_t le2hl P_ ((u_int32_t));
-static u_int16_t le2hs P_ ((u_int16_t));
-static u_int32_t be2hl P_ ((u_int32_t));
-static int wav_init P_ ((struct sound *));
-static void wav_play P_ ((struct sound *, struct sound_device *));
-static int au_init P_ ((struct sound *));
-static void au_play P_ ((struct sound *, struct sound_device *));
+static void vox_open (struct sound_device *);
+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 *, int);
+static void find_sound_type (struct sound *);
+static u_int32_t le2hl (u_int32_t);
+static u_int16_t le2hs (u_int16_t);
+static u_int32_t be2hl (u_int32_t);
+static int wav_init (struct sound *);
+static void wav_play (struct sound *, struct sound_device *);
+static int au_init (struct sound *);
+static void au_play (struct sound *, struct sound_device *);
 
 #if 0 /* Currently not used.  */
-static u_int16_t be2hs P_ ((u_int16_t));
+static u_int16_t be2hs (u_int16_t);
 #endif
 
 /* END: Non Windows Definitions */
 #else /* WINDOWSNT */
 
 /* BEGIN: Windows Specific Definitions */
-static int do_play_sound P_ ((const char *, unsigned long));
+static int do_play_sound (const char *, unsigned long);
 /*
   END: Windows Specific Definitions */
 #endif /* WINDOWSNT */
@@ -328,8 +329,7 @@ static int do_play_sound P_ ((const char *, unsigned long));
 /* Like perror, but signals an error.  */
 
 static void
-sound_perror (msg)
-     char *msg;
+sound_perror (const char *msg)
 {
   int saved_errno = errno;
 
@@ -347,8 +347,7 @@ sound_perror (msg)
 /* Display a warning message.  */
 
 static void
-sound_warning (msg)
-     char *msg;
+sound_warning (const char *msg)
 {
   message (msg);
 }
@@ -381,9 +380,7 @@ sound_warning (msg)
    range [0, 1].  */
 
 static int
-parse_sound (sound, attrs)
-     Lisp_Object sound;
-     Lisp_Object *attrs;
+parse_sound (Lisp_Object sound, Lisp_Object *attrs)
 {
   /* SOUND must be a list starting with the symbol `sound'.  */
   if (!CONSP (sound) || !EQ (XCAR (sound), Qsound))
@@ -452,8 +449,7 @@ parse_sound (sound, attrs)
    S is the sound file structure to fill in.  */
 
 static void
-find_sound_type (s)
-     struct sound *s;
+find_sound_type (struct sound *s)
 {
   if (!wav_init (s) && !au_init (s))
     error ("Unknown sound format");
@@ -463,8 +459,7 @@ find_sound_type (s)
 /* Function installed by play-sound-internal with record_unwind_protect.  */
 
 static Lisp_Object
-sound_cleanup (arg)
-     Lisp_Object arg;
+sound_cleanup (Lisp_Object arg)
 {
   if (current_sound_device->close)
     current_sound_device->close (current_sound_device);
@@ -484,10 +479,9 @@ sound_cleanup (arg)
    to host byte-order.  */
 
 static u_int32_t
-le2hl (value)
-     u_int32_t value;
+le2hl (u_int32_t value)
 {
-#ifdef WORDS_BIG_ENDIAN
+#ifdef WORDS_BIGENDIAN
   unsigned char *p = (unsigned char *) &value;
   value = p[0] + (p[1] << 8) + (p[2] << 16) + (p[3] << 24);
 #endif
@@ -499,10 +493,9 @@ le2hl (value)
    to host byte-order.  */
 
 static u_int16_t
-le2hs (value)
-     u_int16_t value;
+le2hs (u_int16_t value)
 {
-#ifdef WORDS_BIG_ENDIAN
+#ifdef WORDS_BIGENDIAN
   unsigned char *p = (unsigned char *) &value;
   value = p[0] + (p[1] << 8);
 #endif
@@ -514,10 +507,9 @@ le2hs (value)
    to host byte-order.  */
 
 static u_int32_t
-be2hl (value)
-     u_int32_t value;
+be2hl (u_int32_t value)
 {
-#ifndef WORDS_BIG_ENDIAN
+#ifndef WORDS_BIGENDIAN
   unsigned char *p = (unsigned char *) &value;
   value = p[3] + (p[2] << 8) + (p[1] << 16) + (p[0] << 24);
 #endif
@@ -531,10 +523,9 @@ be2hl (value)
    to host byte-order.  */
 
 static u_int16_t
-be2hs (value)
-     u_int16_t value;
+be2hs (u_int16_t value)
 {
-#ifndef WORDS_BIG_ENDIAN
+#ifndef WORDS_BIGENDIAN
   unsigned char *p = (unsigned char *) &value;
   value = p[1] + (p[0] << 8);
 #endif
@@ -554,13 +545,12 @@ be2hs (value)
    Value is non-zero if the file is a WAV file.  */
 
 static int
-wav_init (s)
-     struct sound *s;
+wav_init (struct sound *s)
 {
   struct wav_header *header = (struct wav_header *) s->header;
 
   if (s->header_size < sizeof *header
-      || bcmp (s->header, "RIFF", 4) != 0)
+      || memcmp (s->header, "RIFF", 4) != 0)
     return 0;
 
   /* WAV files are in little-endian order.  Convert the header
@@ -590,9 +580,7 @@ wav_init (s)
 /* Play RIFF-WAVE audio file S on sound device SD.  */
 
 static void
-wav_play (s, sd)
-     struct sound *s;
-     struct sound_device *sd;
+wav_play (struct sound *s, struct sound_device *sd)
 {
   struct wav_header *header = (struct wav_header *) s->header;
 
@@ -665,13 +653,12 @@ enum au_encoding
    Value is non-zero if the file is an AU file.  */
 
 static int
-au_init (s)
-     struct sound *s;
+au_init (struct sound *s)
 {
   struct au_header *header = (struct au_header *) s->header;
 
   if (s->header_size < sizeof *header
-      || bcmp (s->header, ".snd", 4) != 0)
+      || memcmp (s->header, ".snd", 4) != 0)
     return 0;
 
   header->magic_number = be2hl (header->magic_number);
@@ -692,9 +679,7 @@ au_init (s)
 /* Play Sun audio file S on sound device SD.  */
 
 static void
-au_play (s, sd)
-     struct sound *s;
-     struct sound_device *sd;
+au_play (struct sound *s, struct sound_device *sd)
 {
   struct au_header *header = (struct au_header *) s->header;
 
@@ -740,10 +725,9 @@ au_play (s, sd)
    otherwise use a default device name.  */
 
 static void
-vox_open (sd)
-     struct sound_device *sd;
+vox_open (struct sound_device *sd)
 {
-  char *file;
+  const char *file;
 
   /* Open the sound device.  Default is /dev/dsp.  */
   if (sd->file)
@@ -760,8 +744,7 @@ vox_open (sd)
 /* Configure device SD from parameters in it.  */
 
 static void
-vox_configure (sd)
-     struct sound_device *sd;
+vox_configure (struct sound_device *sd)
 {
   int val;
 
@@ -814,8 +797,7 @@ vox_configure (sd)
 /* Close device SD if it is open.  */
 
 static void
-vox_close (sd)
-     struct sound_device *sd;
+vox_close (struct sound_device *sd)
 {
   if (sd->fd >= 0)
     {
@@ -845,9 +827,7 @@ vox_close (sd)
 /* Choose device-dependent format for device SD from sound file S.  */
 
 static void
-vox_choose_format (sd, s)
-     struct sound_device *sd;
-     struct sound *s;
+vox_choose_format (struct sound_device *sd, struct sound *s)
 {
   if (s->type == RIFF)
     {
@@ -890,10 +870,9 @@ vox_choose_format (sd, s)
    structure.  */
 
 static int
-vox_init (sd)
-     struct sound_device *sd;
+vox_init (struct sound_device *sd)
 {
-  char *file;
+  const char *file;
   int fd;
 
   /* Open the sound device.  Default is /dev/dsp.  */
@@ -921,10 +900,7 @@ vox_init (sd)
 /* Write NBYTES bytes from BUFFER to device SD.  */
 
 static void
-vox_write (sd, buffer, nbytes)
-     struct sound_device *sd;
-     const char *buffer;
-     int nbytes;
+vox_write (struct sound_device *sd, const char *buffer, int nbytes)
 {
   int nwritten = emacs_write (sd->fd, buffer, nbytes);
   if (nwritten < 0)
@@ -939,9 +915,7 @@ vox_write (sd, buffer, nbytes)
 /* This driver is available on GNU/Linux. */
 
 static void
-alsa_sound_perror (msg, err)
-     char *msg;
-     int err;
+alsa_sound_perror (const char *msg, int err)
 {
   error ("%s: %s", msg, snd_strerror (err));
 }
@@ -958,10 +932,9 @@ struct alsa_params
    otherwise use a default device name.  */
 
 static void
-alsa_open (sd)
-     struct sound_device *sd;
+alsa_open (struct sound_device *sd)
 {
-  char *file;
+  const char *file;
   struct alsa_params *p;
   int err;
 
@@ -986,8 +959,7 @@ alsa_open (sd)
 }
 
 static int
-alsa_period_size (sd)
-       struct sound_device *sd;
+alsa_period_size (struct sound_device *sd)
 {
   struct alsa_params *p = (struct alsa_params *) sd->data;
   int fact = snd_pcm_format_size (sd->format, 1) * sd->channels;
@@ -995,8 +967,7 @@ alsa_period_size (sd)
 }
 
 static void
-alsa_configure (sd)
-     struct sound_device *sd;
+alsa_configure (struct sound_device *sd)
 {
   int val, err, dir;
   unsigned uval;
@@ -1085,7 +1056,7 @@ alsa_configure (sd)
       int chn;
       snd_mixer_t *handle;
       snd_mixer_elem_t *e;
-      char *file = sd->file ? sd->file : DEFAULT_ALSA_SOUND_DEVICE;
+      const char *file = sd->file ? sd->file : DEFAULT_ALSA_SOUND_DEVICE;
 
       if (snd_mixer_open (&handle, 0) >= 0)
         {
@@ -1115,8 +1086,7 @@ alsa_configure (sd)
 /* Close device SD if it is open.  */
 
 static void
-alsa_close (sd)
-     struct sound_device *sd;
+alsa_close (struct sound_device *sd)
 {
   struct alsa_params *p = (struct alsa_params *) sd->data;
   if (p)
@@ -1137,9 +1107,7 @@ alsa_close (sd)
 /* Choose device-dependent format for device SD from sound file S.  */
 
 static void
-alsa_choose_format (sd, s)
-     struct sound_device *sd;
-     struct sound *s;
+alsa_choose_format (struct sound_device *sd, struct sound *s)
 {
   struct alsa_params *p = (struct alsa_params *) sd->data;
   if (s->type == RIFF)
@@ -1194,10 +1162,7 @@ alsa_choose_format (sd, s)
 /* Write NBYTES bytes from BUFFER to device SD.  */
 
 static void
-alsa_write (sd, buffer, nbytes)
-     struct sound_device *sd;
-     const char *buffer;
-     int nbytes;
+alsa_write (struct sound_device *sd, const char *buffer, int nbytes)
 {
   struct alsa_params *p = (struct alsa_params *) sd->data;
 
@@ -1244,12 +1209,8 @@ alsa_write (sd, buffer, nbytes)
 }
 
 static void
-snd_error_quiet (file, line, function, err, fmt)
-     const char *file;
-     int line;
-     const char *function;
-     int err;
-     const char *fmt;
+snd_error_quiet (const char *file, int line, const char *function, int err,
+                const char *fmt)
 {
 }
 
@@ -1257,10 +1218,9 @@ snd_error_quiet (file, line, function, err, fmt)
    structure.  */
 
 static int
-alsa_init (sd)
-     struct sound_device *sd;
+alsa_init (struct sound_device *sd)
 {
-  char *file;
+  const char *file;
   snd_pcm_t *handle;
   int err;
 
@@ -1307,9 +1267,7 @@ alsa_init (sd)
   }
 
 static int
-do_play_sound (psz_file, ui_volume)
-     const char *psz_file;
-     unsigned long ui_volume;
+do_play_sound (const char *psz_file, unsigned long ui_volume)
 {
   int i_result = 0;
   MCIERROR mci_error = 0;
@@ -1394,8 +1352,7 @@ DEFUN ("play-sound-internal", Fplay_sound_internal, Splay_sound_internal, 1, 1,
        doc: /* Play sound SOUND.
 
 Internal use only, use `play-sound' instead.  */)
-     (sound)
-     Lisp_Object sound;
+  (Lisp_Object sound)
 {
   Lisp_Object attrs[SOUND_ATTR_SENTINEL];
   int count = SPECPDL_INDEX ();
@@ -1421,9 +1378,9 @@ Internal use only, use `play-sound' instead.  */)
   file = Qnil;
   GCPRO2 (sound, file);
   current_sound_device = (struct sound_device *) xmalloc (sizeof (struct sound_device));
-  bzero (current_sound_device, sizeof (struct sound_device));
+  memset (current_sound_device, 0, sizeof (struct sound_device));
   current_sound = (struct sound *) xmalloc (sizeof (struct sound));
-  bzero (current_sound, sizeof (struct sound));
+  memset (current_sound, 0, sizeof (struct sound));
   record_unwind_protect (sound_cleanup, Qnil);
   current_sound->header = (char *) alloca (MAX_SOUND_HEADER_BYTES);
 
@@ -1446,7 +1403,8 @@ Internal use only, use `play-sound' instead.  */)
     {
       current_sound->data = attrs[SOUND_DATA];
       current_sound->header_size = min (MAX_SOUND_HEADER_BYTES, SBYTES (current_sound->data));
-      bcopy (SDATA (current_sound->data), current_sound->header, current_sound->header_size);
+      memcpy (current_sound->header, SDATA (current_sound->data),
+             current_sound->header_size);
     }
 
   /* Find out the type of sound.  Give up if we can't tell.  */
@@ -1524,7 +1482,7 @@ Internal use only, use `play-sound' instead.  */)
  ***********************************************************************/
 
 void
-syms_of_sound ()
+syms_of_sound (void)
 {
   QCdevice = intern_c_string(":device");
   staticpro (&QCdevice);
@@ -1540,7 +1498,7 @@ syms_of_sound ()
 
 
 void
-init_sound ()
+init_sound (void)
 {
 }
 
index 7a9506e55d3e0125127e0780481396d8e5c2fe47..a7617427793dadfd0528a9e91090827ffba63519 100644 (file)
@@ -131,14 +131,6 @@ extern char *tzname[];
 # endif
 #endif
 
-#ifndef __P
-# if defined __GNUC__ || (defined __STDC__ && __STDC__) || defined (PROTOTYPES)
-#  define __P(args) args
-# else
-#  define __P(args) ()
-# endif  /* GCC.  */
-#endif  /* Not __P.  */
-
 #ifndef PTR
 # ifdef __STDC__
 #  define PTR void *
@@ -187,7 +179,7 @@ extern char *tzname[];
    Similarly for localtime_r.  */
 
 # if ! HAVE_TM_GMTOFF
-static struct tm *my_strftime_gmtime_r __P ((const time_t *, struct tm *));
+static struct tm *my_strftime_gmtime_r (const time_t *, struct tm *);
 static struct tm *
 my_strftime_gmtime_r (t, tp)
      const time_t *t;
@@ -200,7 +192,7 @@ my_strftime_gmtime_r (t, tp)
   return tp;
 }
 
-static struct tm *my_strftime_localtime_r __P ((const time_t *, struct tm *));
+static struct tm *my_strftime_localtime_r (const time_t *, struct tm *);
 static struct tm *
 my_strftime_localtime_r (t, tp)
      const time_t *t;
@@ -371,8 +363,8 @@ static const CHAR_T zeroes[16] = /* "0000000000000000" */
    more reliable way to accept other sets of digits.  */
 #define ISDIGIT(Ch) ((unsigned int) (Ch) - L_('0') <= 9)
 
-static CHAR_T *memcpy_lowcase __P ((CHAR_T *dest, const CHAR_T *src,
-                                   size_t len LOCALE_PARAM_PROTO));
+static CHAR_T *memcpy_lowcase (CHAR_T *dest, const CHAR_T *src,
+                               size_t len LOCALE_PARAM_PROTO);
 
 static CHAR_T *
 memcpy_lowcase (dest, src, len LOCALE_PARAM)
@@ -386,8 +378,8 @@ memcpy_lowcase (dest, src, len LOCALE_PARAM)
   return dest;
 }
 
-static CHAR_T *memcpy_uppcase __P ((CHAR_T *dest, const CHAR_T *src,
-                                   size_t len LOCALE_PARAM_PROTO));
+static CHAR_T *memcpy_uppcase (CHAR_T *dest, const CHAR_T *src,
+                               size_t len LOCALE_PARAM_PROTO);
 
 static CHAR_T *
 memcpy_uppcase (dest, src, len LOCALE_PARAM)
@@ -406,7 +398,7 @@ memcpy_uppcase (dest, src, len LOCALE_PARAM)
 /* Yield the difference between *A and *B,
    measured in seconds, ignoring leap seconds.  */
 # define tm_diff ftime_tm_diff
-static int tm_diff __P ((const struct tm *, const struct tm *));
+static int tm_diff (const struct tm *, const struct tm *);
 static int
 tm_diff (a, b)
      const struct tm *a;
@@ -440,7 +432,7 @@ tm_diff (a, b)
 #define ISO_WEEK_START_WDAY 1 /* Monday */
 #define ISO_WEEK1_WDAY 4 /* Thursday */
 #define YDAY_MINIMUM (-366)
-static int iso_week_days __P ((int, int));
+static int iso_week_days (int, int);
 #ifdef __GNUC__
 __inline__
 #endif
@@ -499,8 +491,8 @@ static CHAR_T const month_name[][10] =
 #if !defined _LIBC && !defined(WINDOWSNT) && HAVE_TZNAME && HAVE_TZSET
   /* Solaris 2.5 tzset sometimes modifies the storage returned by localtime.
      Work around this bug by copying *tp before it might be munged.  */
-  size_t _strftime_copytm __P ((char *, size_t, const char *,
-                               const struct tm * extra_args_spec_iso));
+  size_t _strftime_copytm (char *, size_t, const char *,
+                           const struct tm * extra_args_spec_iso);
   size_t
   my_strftime (s, maxsize, format, tp extra_args)
       CHAR_T *s;
index 47b4caf5ade15c6c619d062218562d6124d5cf2e..f0a7dca42dc40c8bcc3903788c8b6f654896353a 100644 (file)
@@ -34,6 +34,60 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "syntax.h"
 #include "intervals.h"
+#include "category.h"
+
+/* Then there are seven single-bit flags that have the following meanings:
+  1. This character is the first of a two-character comment-start sequence.
+  2. This character is the second of a two-character comment-start sequence.
+  3. This character is the first of a two-character comment-end sequence.
+  4. This character is the second of a two-character comment-end sequence.
+  5. This character is a prefix, for backward-prefix-chars.
+  6. The char is part of a delimiter for comments of style "b".
+  7. This character is part of a nestable comment sequence.
+  8. The char is part of a delimiter for comments of style "c".
+  Note that any two-character sequence whose first character has flag 1
+  and whose second character has flag 2 will be interpreted as a comment start.
+
+  bit 6 and 8 are used to discriminate between different comment styles.
+  Languages such as C++ allow two orthogonal syntax start/end pairs
+  and bit 6 is used to determine whether a comment-end or Scommentend
+  ends style a or b.  Comment markers can start style a, b, c, or bc.
+  Style a is always the default.
+  For 2-char comment markers, the style b flag is only looked up on the second
+  char of the comment marker and on the first char of the comment ender.
+  For style c (like to for the nested flag), the flag can be placed on any
+  one of the chars.
+  */
+
+/* These macros extract specific flags from an integer
+   that holds the syntax code and the flags.  */
+
+#define SYNTAX_FLAGS_COMSTART_FIRST(flags) (((flags) >> 16) & 1)
+
+#define SYNTAX_FLAGS_COMSTART_SECOND(flags) (((flags) >> 17) & 1)
+
+#define SYNTAX_FLAGS_COMEND_FIRST(flags) (((flags) >> 18) & 1)
+
+#define SYNTAX_FLAGS_COMEND_SECOND(flags) (((flags) >> 19) & 1)
+
+#define SYNTAX_FLAGS_PREFIX(flags) (((flags) >> 20) & 1)
+
+#define SYNTAX_FLAGS_COMMENT_STYLEB(flags) (((flags) >> 21) & 1)
+#define SYNTAX_FLAGS_COMMENT_STYLEC(flags) (((flags) >> 22) & 2)
+/* FLAGS should be the flags of the main char of the comment marker, e.g.
+   the second for comstart and the first for comend.  */
+#define SYNTAX_FLAGS_COMMENT_STYLE(flags, other_flags) \
+  (SYNTAX_FLAGS_COMMENT_STYLEB (flags) \
+   | SYNTAX_FLAGS_COMMENT_STYLEC (flags) \
+   | SYNTAX_FLAGS_COMMENT_STYLEC (other_flags))
+
+#define SYNTAX_FLAGS_COMMENT_NESTED(flags) (((flags) >> 22) & 1)
+
+/* These macros extract a particular flag for a given character.  */
+
+#define SYNTAX_COMEND_FIRST(c) \
+  (SYNTAX_FLAGS_COMEND_FIRST (SYNTAX_WITH_FLAGS (c)))
+#define SYNTAX_PREFIX(c) (SYNTAX_FLAGS_PREFIX (SYNTAX_WITH_FLAGS (c)))
 
 /* We use these constants in place for comment-style and
    string-ender-char to distinguish  comments/strings started by
@@ -41,7 +95,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #define ST_COMMENT_STYLE (256 + 1)
 #define ST_STRING_STYLE (256 + 2)
-#include "category.h"
 
 Lisp_Object Qsyntax_table_p, Qsyntax_table, Qscan_error;
 
@@ -98,18 +151,23 @@ static EMACS_INT find_start_begv;
 static int find_start_modiff;
 
 
-static Lisp_Object skip_chars P_ ((int, Lisp_Object, Lisp_Object, int));
-static Lisp_Object skip_syntaxes P_ ((int, Lisp_Object, Lisp_Object));
-static Lisp_Object scan_lists P_ ((EMACS_INT, EMACS_INT, EMACS_INT, int));
-static void scan_sexps_forward P_ ((struct lisp_parse_state *,
-                                   EMACS_INT, EMACS_INT, EMACS_INT, int,
-                                   int, Lisp_Object, int));
-static int in_classes P_ ((int, 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,
+                                int, Lisp_Object, int);
+static int in_classes (int, Lisp_Object);
 \f
+/* Whether the syntax of the character C has the prefix flag set.  */
+int syntax_prefix_flag_p (int c)
+{
+  return SYNTAX_PREFIX (c);
+}
 
 struct gl_state_s gl_state;            /* Global state of syntax parser.  */
 
-INTERVAL interval_of ();
+INTERVAL interval_of (int, Lisp_Object);
 #define INTERVALS_AT_ONCE 10           /* 1 + max-number of intervals
                                           to scan to property-change.  */
 
@@ -127,9 +185,7 @@ INTERVAL interval_of ();
    start/end of OBJECT.  */
 
 void
-update_syntax_table (charpos, count, init, object)
-     int charpos, count, init;
-     Lisp_Object object;
+update_syntax_table (int charpos, int count, int init, Lisp_Object object)
 {
   Lisp_Object tmp_table;
   int cnt = 0, invalidate = 1;
@@ -318,8 +374,7 @@ char_quoted (EMACS_INT charpos, EMACS_INT bytepos)
    We assume that BYTEPOS is not at the end of the buffer.  */
 
 INLINE EMACS_INT
-inc_bytepos (bytepos)
-     EMACS_INT bytepos;
+inc_bytepos (EMACS_INT bytepos)
 {
   if (NILP (current_buffer->enable_multibyte_characters))
     return bytepos + 1;
@@ -332,8 +387,7 @@ inc_bytepos (bytepos)
    We assume that BYTEPOS is not at the start of the buffer.  */
 
 INLINE EMACS_INT
-dec_bytepos (bytepos)
-     EMACS_INT bytepos;
+dec_bytepos (EMACS_INT bytepos)
 {
   if (NILP (current_buffer->enable_multibyte_characters))
     return bytepos - 1;
@@ -357,8 +411,7 @@ dec_bytepos (bytepos)
    update the global data.  */
 
 static EMACS_INT
-find_defun_start (pos, pos_byte)
-     EMACS_INT pos, pos_byte;
+find_defun_start (EMACS_INT pos, EMACS_INT pos_byte)
 {
   EMACS_INT opoint = PT, opoint_byte = PT_BYTE;
 
@@ -385,8 +438,7 @@ find_defun_start (pos, pos_byte)
   /* We optimize syntax-table lookup for rare updates.  Thus we accept
      only those `^\s(' which are good in global _and_ text-property
      syntax-tables.  */
-  gl_state.current_syntax_table = current_buffer->syntax_table;
-  gl_state.use_global = 0;
+  SETUP_BUFFER_SYNTAX_TABLE ();
   while (PT > BEGV)
     {
       int c;
@@ -401,8 +453,7 @@ find_defun_start (pos, pos_byte)
          if (SYNTAX (c) == Sopen)
            break;
          /* Now fallback to the default value.  */
-         gl_state.current_syntax_table = current_buffer->syntax_table;
-         gl_state.use_global = 0;
+         SETUP_BUFFER_SYNTAX_TABLE ();
        }
       /* Move to beg of previous line.  */
       scan_newline (PT, PT_BYTE, BEGV, BEGV_BYTE, -2, 1);
@@ -424,8 +475,7 @@ find_defun_start (pos, pos_byte)
 /* Return the SYNTAX_COMEND_FIRST of the character before POS, POS_BYTE.  */
 
 static int
-prev_char_comend_first (pos, pos_byte)
-     int pos, pos_byte;
+prev_char_comend_first (int pos, int pos_byte)
 {
   int c, val;
 
@@ -467,10 +517,7 @@ prev_char_comend_first (pos, pos_byte)
    the returned value (or at FROM, if the search was not successful).  */
 
 static int
-back_comment (from, from_byte, stop, comnested, comstyle, charpos_ptr, bytepos_ptr)
-     EMACS_INT from, from_byte, stop;
-     int comnested, comstyle;
-     EMACS_INT *charpos_ptr, *bytepos_ptr;
+back_comment (EMACS_INT from, EMACS_INT from_byte, EMACS_INT stop, int comnested, int comstyle, EMACS_INT *charpos_ptr, EMACS_INT *bytepos_ptr)
 {
   /* Look back, counting the parity of string-quotes,
      and recording the comment-starters seen.
@@ -525,7 +572,8 @@ back_comment (from, from_byte, stop, comnested, comstyle, charpos_ptr, bytepos_p
       /* Check for 2-char comment markers.  */
       com2start = (SYNTAX_FLAGS_COMSTART_FIRST (syntax)
                   && SYNTAX_FLAGS_COMSTART_SECOND (prev_syntax)
-                  && comstyle == SYNTAX_FLAGS_COMMENT_STYLE (prev_syntax)
+                  && (comstyle
+                      == SYNTAX_FLAGS_COMMENT_STYLE (prev_syntax, syntax))
                   && (SYNTAX_FLAGS_COMMENT_NESTED (prev_syntax)
                       || SYNTAX_FLAGS_COMMENT_NESTED (syntax)) == comnested);
       com2end = (SYNTAX_FLAGS_COMEND_FIRST (syntax)
@@ -554,7 +602,8 @@ back_comment (from, from_byte, stop, comnested, comstyle, charpos_ptr, bytepos_p
               && SYNTAX_FLAGS_COMEND_FIRST (next_syntax))
              || ((com2end || comnested)
                  && SYNTAX_FLAGS_COMSTART_SECOND (syntax)
-                 && comstyle == SYNTAX_FLAGS_COMMENT_STYLE (syntax)
+                 && (comstyle
+                     == SYNTAX_FLAGS_COMMENT_STYLE (syntax, prev_syntax))
                  && SYNTAX_FLAGS_COMSTART_FIRST (next_syntax)))
            goto lossage;
          /* UPDATE_SYNTAX_TABLE_FORWARD (next + 1); */
@@ -574,7 +623,7 @@ back_comment (from, from_byte, stop, comnested, comstyle, charpos_ptr, bytepos_p
        code = Scomment;
       /* Ignore comment starters of a different style.  */
       else if (code == Scomment
-              && (comstyle != SYNTAX_FLAGS_COMMENT_STYLE (syntax)
+              && (comstyle != SYNTAX_FLAGS_COMMENT_STYLE (syntax, 0)
                   || SYNTAX_FLAGS_COMMENT_NESTED (syntax) != comnested))
        continue;
 
@@ -624,7 +673,7 @@ back_comment (from, from_byte, stop, comnested, comstyle, charpos_ptr, bytepos_p
          break;
 
        case Sendcomment:
-         if (SYNTAX_FLAGS_COMMENT_STYLE (syntax) == comstyle
+         if (SYNTAX_FLAGS_COMMENT_STYLE (syntax, 0) == comstyle
              && ((com2end && SYNTAX_FLAGS_COMMENT_NESTED (prev_syntax))
                  || SYNTAX_FLAGS_COMMENT_NESTED (syntax)) == comnested)
            /* This is the same style of comment ender as ours. */
@@ -732,8 +781,7 @@ back_comment (from, from_byte, stop, comnested, comstyle, charpos_ptr, bytepos_p
 DEFUN ("syntax-table-p", Fsyntax_table_p, Ssyntax_table_p, 1, 1, 0,
        doc: /* Return t if OBJECT is a syntax table.
 Currently, any char-table counts as a syntax table.  */)
-     (object)
-     Lisp_Object object;
+  (Lisp_Object object)
 {
   if (CHAR_TABLE_P (object)
       && EQ (XCHAR_TABLE (object)->purpose, Qsyntax_table))
@@ -742,8 +790,7 @@ Currently, any char-table counts as a syntax table.  */)
 }
 
 static void
-check_syntax_table (obj)
-     Lisp_Object obj;
+check_syntax_table (Lisp_Object obj)
 {
   CHECK_TYPE (CHAR_TABLE_P (obj) && EQ (XCHAR_TABLE (obj)->purpose, Qsyntax_table),
              Qsyntax_table_p, obj);
@@ -752,7 +799,7 @@ check_syntax_table (obj)
 DEFUN ("syntax-table", Fsyntax_table, Ssyntax_table, 0, 0, 0,
        doc: /* Return the current syntax table.
 This is the one specified by the current buffer.  */)
-     ()
+  (void)
 {
   return current_buffer->syntax_table;
 }
@@ -761,7 +808,7 @@ DEFUN ("standard-syntax-table", Fstandard_syntax_table,
    Sstandard_syntax_table, 0, 0, 0,
        doc: /* Return the standard syntax table.
 This is the one used for new buffers.  */)
-     ()
+  (void)
 {
   return Vstandard_syntax_table;
 }
@@ -769,8 +816,7 @@ This is the one used for new buffers.  */)
 DEFUN ("copy-syntax-table", Fcopy_syntax_table, Scopy_syntax_table, 0, 1, 0,
        doc: /* Construct a new syntax table and return it.
 It is a copy of the TABLE, which defaults to the standard syntax table.  */)
-     (table)
-     Lisp_Object table;
+  (Lisp_Object table)
 {
   Lisp_Object copy;
 
@@ -796,8 +842,7 @@ It is a copy of the TABLE, which defaults to the standard syntax table.  */)
 DEFUN ("set-syntax-table", Fset_syntax_table, Sset_syntax_table, 1, 1, 0,
        doc: /* Select a new syntax table for the current buffer.
 One argument, a syntax table.  */)
-     (table)
-     Lisp_Object table;
+  (Lisp_Object table)
 {
   int idx;
   check_syntax_table (table);
@@ -856,28 +901,23 @@ For example, if CHARACTER is a word constituent, the
 character `w' (119) is returned.
 The characters that correspond to various syntax codes
 are listed in the documentation of `modify-syntax-entry'.  */)
-     (character)
-     Lisp_Object character;
+  (Lisp_Object character)
 {
   int char_int;
-  gl_state.current_syntax_table = current_buffer->syntax_table;
-
-  gl_state.use_global = 0;
-  CHECK_NUMBER (character);
+  CHECK_CHARACTER (character);
   char_int = XINT (character);
+  SETUP_BUFFER_SYNTAX_TABLE ();
   return make_number (syntax_code_spec[(int) SYNTAX (char_int)]);
 }
 
 DEFUN ("matching-paren", Fmatching_paren, Smatching_paren, 1, 1, 0,
        doc: /* Return the matching parenthesis of CHARACTER, or nil if none.  */)
-     (character)
-     Lisp_Object character;
+  (Lisp_Object character)
 {
   int char_int, code;
-  gl_state.current_syntax_table = current_buffer->syntax_table;
-  gl_state.use_global = 0;
   CHECK_NUMBER (character);
   char_int = XINT (character);
+  SETUP_BUFFER_SYNTAX_TABLE ();
   code = SYNTAX (char_int);
   if (code == Sopen || code == Sclose)
     return SYNTAX_MATCH (char_int);
@@ -890,8 +930,7 @@ STRING should be a string as it is allowed as argument of
 `modify-syntax-entry'.  Value is the equivalent cons cell
 \(CODE . MATCHING-CHAR) that can be used as value of a `syntax-table'
 text property.  */)
-     (string)
-     Lisp_Object string;
+  (Lisp_Object string)
 {
   register const unsigned char *p;
   register enum syntaxcode code;
@@ -951,6 +990,10 @@ text property.  */)
       case 'n':
        val |= 1 << 22;
        break;
+
+      case 'c':
+       val |= 1 << 23;
+       break;
       }
 
   if (val < XVECTOR (Vsyntax_code_object)->size && NILP (match))
@@ -990,20 +1033,20 @@ Defined flags are the characters 1, 2, 3, 4, b, p, and n.
  3 means CHAR is the start of a two-char comment end sequence.
  4 means CHAR is the second character of such a sequence.
 
-There can be up to two orthogonal comment sequences.  This is to support
+There can be several orthogonal comment sequences.  This is to support
 language modes such as C++.  By default, all comment sequences are of style
 a, but you can set the comment sequence style to b (on the second character
-of a comment-start, or the first character of a comment-end sequence) using
-this flag:
+of a comment-start, and the first character of a comment-end sequence) and/or
+c (on any of its chars) using this flag:
  b means CHAR is part of comment sequence b.
+ c means CHAR is part of comment sequence c.
  n means CHAR is part of a nestable comment sequence.
 
  p means CHAR is a prefix character for `backward-prefix-chars';
    such characters are treated as whitespace when they occur
    between expressions.
 usage: (modify-syntax-entry CHAR NEWENTRY &optional SYNTAX-TABLE)  */)
-     (c, newentry, syntax_table)
-     Lisp_Object c, newentry, syntax_table;
+  (Lisp_Object c, Lisp_Object newentry, Lisp_Object syntax_table)
 {
   if (CONSP (c))
     {
@@ -1036,11 +1079,12 @@ usage: (modify-syntax-entry CHAR NEWENTRY &optional SYNTAX-TABLE)  */)
 DEFUN ("internal-describe-syntax-value", Finternal_describe_syntax_value,
        Sinternal_describe_syntax_value, 1, 1, 0,
        doc: /* Insert a description of the internal syntax description SYNTAX at point.  */)
-     (syntax)
-     Lisp_Object syntax;
+  (Lisp_Object syntax)
 {
   register enum syntaxcode code;
-  char desc, start1, start2, end1, end2, prefix, comstyle, comnested;
+  int syntax_code;
+  char desc, start1, start2, end1, end2, prefix,
+    comstyleb, comstylec, comnested;
   char str[2];
   Lisp_Object first, match_lisp, value = syntax;
 
@@ -1071,14 +1115,16 @@ DEFUN ("internal-describe-syntax-value", Finternal_describe_syntax_value,
       return syntax;
     }
 
-  code = (enum syntaxcode) (XINT (first) & 0377);
-  start1 = (XINT (first) >> 16) & 1;
-  start2 = (XINT (first) >> 17) & 1;
-  end1 = (XINT (first) >> 18) & 1;
-  end2 = (XINT (first) >> 19) & 1;
-  prefix = (XINT (first) >> 20) & 1;
-  comstyle = (XINT (first) >> 21) & 1;
-  comnested = (XINT (first) >> 22) & 1;
+  syntax_code = XINT (first);
+  code = (enum syntaxcode) (syntax_code & 0377);
+  start1 = SYNTAX_FLAGS_COMSTART_FIRST (syntax_code);
+  start2 = SYNTAX_FLAGS_COMSTART_SECOND (syntax_code);;
+  end1 = SYNTAX_FLAGS_COMEND_FIRST (syntax_code);
+  end2 = SYNTAX_FLAGS_COMEND_SECOND (syntax_code);
+  prefix = SYNTAX_FLAGS_PREFIX (syntax_code);
+  comstyleb = SYNTAX_FLAGS_COMMENT_STYLEB (syntax_code);
+  comstylec = SYNTAX_FLAGS_COMMENT_STYLEC (syntax_code);
+  comnested = SYNTAX_FLAGS_COMMENT_NESTED (syntax_code);
 
   if ((int) code < 0 || (int) code >= (int) Smax)
     {
@@ -1107,8 +1153,10 @@ DEFUN ("internal-describe-syntax-value", Finternal_describe_syntax_value,
 
   if (prefix)
     insert ("p", 1);
-  if (comstyle)
+  if (comstyleb)
     insert ("b", 1);
+  if (comstylec)
+    insert ("c", 1);
   if (comnested)
     insert ("n", 1);
 
@@ -1168,8 +1216,10 @@ DEFUN ("internal-describe-syntax-value", Finternal_describe_syntax_value,
     insert_string (",\n\t  is the first character of a comment-end sequence");
   if (end2)
     insert_string (",\n\t  is the second character of a comment-end sequence");
-  if (comstyle)
+  if (comstyleb)
     insert_string (" (comment style b)");
+  if (comstylec)
+    insert_string (" (comment style c)");
   if (comnested)
     insert_string (" (nestable)");
 
@@ -1190,8 +1240,7 @@ Lisp_Object Vfind_word_boundary_function_table;
    COUNT negative means scan backward and stop at word beginning.  */
 
 int
-scan_words (from, count)
-     register int from, count;
+scan_words (register int from, register int count)
 {
   register int beg = BEGV;
   register int end = ZV;
@@ -1323,8 +1372,7 @@ Normally returns t.
 If an edge of the buffer or a field boundary is reached, point is left there
 and the function returns nil.  Field boundaries are not noticed if
 `inhibit-field-text-motion' is non-nil.  */)
-     (arg)
-     Lisp_Object arg;
+  (Lisp_Object arg)
 {
   Lisp_Object tmp;
   int orig_val, val;
@@ -1347,7 +1395,7 @@ and the function returns nil.  Field boundaries are not noticed if
   return val == orig_val ? Qt : Qnil;
 }
 \f
-Lisp_Object skip_chars ();
+Lisp_Object skip_chars (int, Lisp_Object, Lisp_Object, int);
 
 DEFUN ("skip-chars-forward", Fskip_chars_forward, Sskip_chars_forward, 1, 2, 0,
        doc: /* Move point forward, stopping before a char not in STRING, or at pos LIM.
@@ -1359,8 +1407,7 @@ With arg "^a-zA-Z", skips nonletters stopping before first letter.
 Char classes, e.g. `[:alpha:]', are supported.
 
 Returns the distance traveled, either zero or positive.  */)
-     (string, lim)
-     Lisp_Object string, lim;
+  (Lisp_Object string, Lisp_Object lim)
 {
   return skip_chars (1, string, lim, 1);
 }
@@ -1369,8 +1416,7 @@ DEFUN ("skip-chars-backward", Fskip_chars_backward, Sskip_chars_backward, 1, 2,
        doc: /* Move point backward, stopping after a char not in STRING, or at pos LIM.
 See `skip-chars-forward' for details.
 Returns the distance traveled, either zero or negative.  */)
-     (string, lim)
-     Lisp_Object string, lim;
+  (Lisp_Object string, Lisp_Object lim)
 {
   return skip_chars (0, string, lim, 1);
 }
@@ -1381,8 +1427,7 @@ SYNTAX is a string of syntax code characters.
 Stop before a char whose syntax is not in SYNTAX, or at position LIM.
 If SYNTAX starts with ^, skip characters whose syntax is NOT in SYNTAX.
 This function returns the distance traveled, either zero or positive.  */)
-     (syntax, lim)
-     Lisp_Object syntax, lim;
+  (Lisp_Object syntax, Lisp_Object lim)
 {
   return skip_syntaxes (1, syntax, lim);
 }
@@ -1393,17 +1438,13 @@ SYNTAX is a string of syntax code characters.
 Stop on reaching a char whose syntax is not in SYNTAX, or at position LIM.
 If SYNTAX starts with ^, skip characters whose syntax is NOT in SYNTAX.
 This function returns the distance traveled, either zero or negative.  */)
-     (syntax, lim)
-     Lisp_Object syntax, lim;
+  (Lisp_Object syntax, Lisp_Object lim)
 {
   return skip_syntaxes (0, syntax, lim);
 }
 
 static Lisp_Object
-skip_chars (forwardp, string, lim, handle_iso_classes)
-     int forwardp;
-     Lisp_Object string, lim;
-     int handle_iso_classes;
+skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_classes)
 {
   register unsigned int c;
   unsigned char fastmap[0400];
@@ -1441,7 +1482,7 @@ skip_chars (forwardp, string, lim, handle_iso_classes)
               && (XINT (lim) - PT != CHAR_TO_BYTE (XINT (lim)) - PT_BYTE));
   string_multibyte = SBYTES (string) > SCHARS (string);
 
-  bzero (fastmap, sizeof fastmap);
+  memset (fastmap, 0, sizeof fastmap);
 
   str = SDATA (string);
   size_byte = SBYTES (string);
@@ -1490,7 +1531,7 @@ skip_chars (forwardp, string, lim, handle_iso_classes)
                  || *class_end != ':' || class_end[1] != ']')
                goto not_a_class_name;
 
-             bcopy (class_beg, class_name, class_end - class_beg);
+             memcpy (class_name, class_beg, class_end - class_beg);
              class_name[class_end - class_beg] = 0;
 
              cc = re_wctype (class_name);
@@ -1551,8 +1592,8 @@ skip_chars (forwardp, string, lim, handle_iso_classes)
          unsigned char fastmap2[0400];
          int range_start_byte, range_start_char;
 
-         bcopy (fastmap2 + 0200, fastmap + 0200, 0200);
-         bzero (fastmap + 0200, 0200);
+         memcpy (fastmap + 0200, fastmap2 + 0200, 0200);
+         memset (fastmap + 0200, 0, 0200);
          /* We are sure that this loop stops.  */
          for (i = 0200; ! fastmap2[i]; i++);
          c = BYTE8_TO_CHAR (i);
@@ -1612,7 +1653,7 @@ skip_chars (forwardp, string, lim, handle_iso_classes)
                  || *class_end != ':' || class_end[1] != ']')
                goto not_a_class_name_multibyte;
 
-             bcopy (class_beg, class_name, class_end - class_beg);
+             memcpy (class_name, class_beg, class_end - class_beg);
              class_name[class_end - class_beg] = 0;
 
              cc = re_wctype (class_name);
@@ -1697,7 +1738,7 @@ skip_chars (forwardp, string, lim, handle_iso_classes)
 
       if (! multibyte && n_char_ranges > 0)
        {
-         bzero (fastmap + 0200, 0200);
+         memset (fastmap + 0200, 0, 0200);
          for (i = 0; i < n_char_ranges; i += 2)
            {
              int c1 = char_ranges[i];
@@ -1752,7 +1793,7 @@ skip_chars (forwardp, string, lim, handle_iso_classes)
        let's initialize it manually.
        We ignore syntax-table text-properties for now, since that's
        what we've done in the past.  */
-    SETUP_SYNTAX_TABLE (BEGV, 0);
+    SETUP_BUFFER_SYNTAX_TABLE ();
     if (forwardp)
       {
        if (multibyte)
@@ -1897,9 +1938,7 @@ skip_chars (forwardp, string, lim, handle_iso_classes)
 
 
 static Lisp_Object
-skip_syntaxes (forwardp, string, lim)
-     int forwardp;
-     Lisp_Object string, lim;
+skip_syntaxes (int forwardp, Lisp_Object string, Lisp_Object lim)
 {
   register unsigned int c;
   unsigned char fastmap[0400];
@@ -1928,7 +1967,7 @@ skip_syntaxes (forwardp, string, lim)
   multibyte = (!NILP (current_buffer->enable_multibyte_characters)
               && (XINT (lim) - PT != CHAR_TO_BYTE (XINT (lim)) - PT_BYTE));
 
-  bzero (fastmap, sizeof fastmap);
+  memset (fastmap, 0, sizeof fastmap);
 
   if (SBYTES (string) > SCHARS (string))
     /* As this is very rare case (syntax spec is ASCII only), don't
@@ -2072,9 +2111,7 @@ skip_syntaxes (forwardp, string, lim)
    integer which is its type according to re_wctype.  */
 
 static int
-in_classes (c, iso_classes)
-     int c;
-     Lisp_Object iso_classes;
+in_classes (int c, Lisp_Object iso_classes)
 {
   int fits_class = 0;
 
@@ -2096,7 +2133,7 @@ in_classes (c, iso_classes)
    FROM_BYTE is the bytepos corresponding to FROM.
    Do not move past STOP (a charpos).
    The comment over which we have to jump is of style STYLE
-     (either SYNTAX_COMMENT_STYLE(foo) or ST_COMMENT_STYLE).
+     (either SYNTAX_FLAGS_COMMENT_STYLE(foo) or ST_COMMENT_STYLE).
    NESTING should be positive to indicate the nesting at the beginning
      for nested comments and should be zero or negative else.
      ST_COMMENT_STYLE cannot be nested.
@@ -2116,16 +2153,14 @@ in_classes (c, iso_classes)
    remains valid for forward search starting at the returned position. */
 
 static int
-forw_comment (from, from_byte, stop, nesting, style, prev_syntax,
-             charpos_ptr, bytepos_ptr, incomment_ptr)
-     EMACS_INT from, from_byte, stop;
-     int nesting, style, prev_syntax;
-     EMACS_INT *charpos_ptr, *bytepos_ptr;
-     int *incomment_ptr;
+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)
 {
   register int c, c1;
   register enum syntaxcode code;
-  register int syntax;
+  register int syntax, other_syntax;
 
   if (nesting <= 0) nesting = -1;
 
@@ -2147,7 +2182,7 @@ forw_comment (from, from_byte, stop, nesting, style, prev_syntax,
       syntax = SYNTAX_WITH_FLAGS (c);
       code = syntax & 0xff;
       if (code == Sendcomment
-         && SYNTAX_FLAGS_COMMENT_STYLE (syntax) == style
+         && SYNTAX_FLAGS_COMMENT_STYLE (syntax, 0) == style
          && (SYNTAX_FLAGS_COMMENT_NESTED (syntax) ?
              (nesting > 0 && --nesting == 0) : nesting < 0))
        /* we have encountered a comment end of the same style
@@ -2163,7 +2198,7 @@ forw_comment (from, from_byte, stop, nesting, style, prev_syntax,
       if (nesting > 0
          && code == Scomment
          && SYNTAX_FLAGS_COMMENT_NESTED (syntax)
-         && SYNTAX_FLAGS_COMMENT_STYLE (syntax) == style)
+         && SYNTAX_FLAGS_COMMENT_STYLE (syntax, 0) == style)
        /* we have encountered a nested comment of the same style
           as the comment sequence which began this comment section */
        nesting++;
@@ -2172,11 +2207,13 @@ forw_comment (from, from_byte, stop, nesting, style, prev_syntax,
 
     forw_incomment:
       if (from < stop && SYNTAX_FLAGS_COMEND_FIRST (syntax)
-         && SYNTAX_FLAGS_COMMENT_STYLE (syntax) == style
          && (c1 = FETCH_CHAR_AS_MULTIBYTE (from_byte),
-             SYNTAX_COMEND_SECOND (c1))
+             other_syntax = SYNTAX_WITH_FLAGS (c1),
+             SYNTAX_FLAGS_COMEND_SECOND (other_syntax))
+         && SYNTAX_FLAGS_COMMENT_STYLE (syntax, other_syntax) == style
          && ((SYNTAX_FLAGS_COMMENT_NESTED (syntax) ||
-              SYNTAX_COMMENT_NESTED (c1)) ? nesting > 0 : nesting < 0))
+              SYNTAX_FLAGS_COMMENT_NESTED (other_syntax))
+             ? nesting > 0 : nesting < 0))
        {
          if (--nesting <= 0)
            /* we have encountered a comment end of the same style
@@ -2193,10 +2230,11 @@ forw_comment (from, from_byte, stop, nesting, style, prev_syntax,
          && from < stop
          && SYNTAX_FLAGS_COMSTART_FIRST (syntax)
          && (c1 = FETCH_CHAR_AS_MULTIBYTE (from_byte),
-             SYNTAX_COMMENT_STYLE (c1) == style
-             && SYNTAX_COMSTART_SECOND (c1))
+             other_syntax = SYNTAX_WITH_FLAGS (c1),
+             SYNTAX_FLAGS_COMMENT_STYLE (other_syntax, syntax) == style
+             && SYNTAX_FLAGS_COMSTART_SECOND (other_syntax))
          && (SYNTAX_FLAGS_COMMENT_NESTED (syntax) ||
-             SYNTAX_COMMENT_NESTED (c1)))
+             SYNTAX_FLAGS_COMMENT_NESTED (other_syntax)))
        /* we have encountered a nested comment of the same style
           as the comment sequence which began this comment
           section */
@@ -2218,8 +2256,7 @@ Stop scanning if we find something other than a comment or whitespace.
 Set point to where scanning stops.
 If COUNT comments are found as expected, with nothing except whitespace
 between them, return t; otherwise return nil.  */)
-     (count)
-     Lisp_Object count;
+  (Lisp_Object count)
 {
   register EMACS_INT from;
   EMACS_INT from_byte;
@@ -2248,7 +2285,7 @@ between them, return t; otherwise return nil.  */)
     {
       do
        {
-         int comstart_first;
+         int comstart_first, syntax, other_syntax;
 
          if (from == stop)
            {
@@ -2257,15 +2294,17 @@ between them, return t; otherwise return nil.  */)
              return Qnil;
            }
          c = FETCH_CHAR_AS_MULTIBYTE (from_byte);
+         syntax = SYNTAX_WITH_FLAGS (c);
          code = SYNTAX (c);
-         comstart_first = SYNTAX_COMSTART_FIRST (c);
-         comnested = SYNTAX_COMMENT_NESTED (c);
-         comstyle = SYNTAX_COMMENT_STYLE (c);
+         comstart_first = SYNTAX_FLAGS_COMSTART_FIRST (syntax);
+         comnested = SYNTAX_FLAGS_COMMENT_NESTED (syntax);
+         comstyle = SYNTAX_FLAGS_COMMENT_STYLE (syntax, 0);
          INC_BOTH (from, from_byte);
          UPDATE_SYNTAX_TABLE_FORWARD (from);
          if (from < stop && comstart_first
              && (c1 = FETCH_CHAR_AS_MULTIBYTE (from_byte),
-                 SYNTAX_COMSTART_SECOND (c1)))
+                 other_syntax = SYNTAX_WITH_FLAGS (c1),
+                 SYNTAX_FLAGS_COMSTART_SECOND (other_syntax)))
            {
              /* We have encountered a comment start sequence and we
                 are ignoring all text inside comments.  We must record
@@ -2273,8 +2312,9 @@ between them, return t; otherwise return nil.  */)
                 only a comment end of the same style actually ends
                 the comment section.  */
              code = Scomment;
-             comstyle = SYNTAX_COMMENT_STYLE (c1);
-             comnested = comnested || SYNTAX_COMMENT_NESTED (c1);
+             comstyle = SYNTAX_FLAGS_COMMENT_STYLE (other_syntax, syntax);
+             comnested
+               = comnested || SYNTAX_FLAGS_COMMENT_NESTED (other_syntax);
              INC_BOTH (from, from_byte);
              UPDATE_SYNTAX_TABLE_FORWARD (from);
            }
@@ -2310,7 +2350,7 @@ between them, return t; otherwise return nil.  */)
     {
       while (1)
        {
-         int quoted;
+         int quoted, syntax;
 
          if (from <= stop)
            {
@@ -2323,15 +2363,17 @@ between them, return t; otherwise return nil.  */)
          /* char_quoted does UPDATE_SYNTAX_TABLE_BACKWARD (from).  */
          quoted = char_quoted (from, from_byte);
          c = FETCH_CHAR_AS_MULTIBYTE (from_byte);
+         syntax = SYNTAX_WITH_FLAGS (c);
          code = SYNTAX (c);
          comstyle = 0;
-         comnested = SYNTAX_COMMENT_NESTED (c);
+         comnested = SYNTAX_FLAGS_COMMENT_NESTED (syntax);
          if (code == Sendcomment)
-           comstyle = SYNTAX_COMMENT_STYLE (c);
-         if (from > stop && SYNTAX_COMEND_SECOND (c)
+           comstyle = SYNTAX_FLAGS_COMMENT_STYLE (syntax, 0);
+         if (from > stop && SYNTAX_FLAGS_COMEND_SECOND (syntax)
              && prev_char_comend_first (from, from_byte)
              && !char_quoted (from - 1, dec_bytepos (from_byte)))
            {
+             int other_syntax;
              /* We must record the comment style encountered so that
                 later, we can match only the proper comment begin
                 sequence of the same style.  */
@@ -2340,8 +2382,10 @@ between them, return t; otherwise return nil.  */)
              /* Calling char_quoted, above, set up global syntax position
                 at the new value of FROM.  */
              c1 = FETCH_CHAR_AS_MULTIBYTE (from_byte);
-             comstyle = SYNTAX_COMMENT_STYLE (c1);
-             comnested = comnested || SYNTAX_COMMENT_NESTED (c1);
+             other_syntax = SYNTAX_WITH_FLAGS (c1);
+             comstyle = SYNTAX_FLAGS_COMMENT_STYLE (other_syntax, syntax);
+             comnested
+               = comnested || SYNTAX_FLAGS_COMMENT_NESTED (other_syntax);
            }
 
          if (code == Scomment_fence)
@@ -2388,7 +2432,7 @@ between them, return t; otherwise return nil.  */)
                    {
                      /* Failure: we should go back to the end of this
                         not-quite-endcomment.  */
-                     if (SYNTAX(c) != code)
+                     if (SYNTAX (c) != code)
                        /* It was a two-char Sendcomment.  */
                        INC_BOTH (from, from_byte);
                      goto leave;
@@ -2427,10 +2471,7 @@ between them, return t; otherwise return nil.  */)
    ? SYNTAX (c) : Ssymbol)
 
 static Lisp_Object
-scan_lists (from, count, depth, sexpflag)
-     register EMACS_INT from;
-     EMACS_INT count, depth;
-     int sexpflag;
+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;
@@ -2465,21 +2506,23 @@ scan_lists (from, count, depth, sexpflag)
     {
       while (from < stop)
        {
-         int comstart_first, prefix;
+         int comstart_first, prefix, syntax, other_syntax;
          UPDATE_SYNTAX_TABLE_FORWARD (from);
          c = FETCH_CHAR_AS_MULTIBYTE (from_byte);
+         syntax = SYNTAX_WITH_FLAGS (c);
          code = SYNTAX_WITH_MULTIBYTE_CHECK (c);
-         comstart_first = SYNTAX_COMSTART_FIRST (c);
-         comnested = SYNTAX_COMMENT_NESTED (c);
-         comstyle = SYNTAX_COMMENT_STYLE (c);
-         prefix = SYNTAX_PREFIX (c);
+         comstart_first = SYNTAX_FLAGS_COMSTART_FIRST (syntax);
+         comnested = SYNTAX_FLAGS_COMMENT_NESTED (syntax);
+         comstyle = SYNTAX_FLAGS_COMMENT_STYLE (syntax, 0);
+         prefix = SYNTAX_FLAGS_PREFIX (syntax);
          if (depth == min_depth)
            last_good = from;
          INC_BOTH (from, from_byte);
          UPDATE_SYNTAX_TABLE_FORWARD (from);
          if (from < stop && comstart_first
              && (c = FETCH_CHAR_AS_MULTIBYTE (from_byte),
-                 SYNTAX_COMSTART_SECOND (c))
+                 other_syntax = SYNTAX_WITH_FLAGS (c),
+                 SYNTAX_FLAGS_COMSTART_SECOND (other_syntax))
              && parse_sexp_ignore_comments)
            {
              /* we have encountered a comment start sequence and we
@@ -2488,9 +2531,9 @@ scan_lists (from, count, depth, sexpflag)
                 only a comment end of the same style actually ends
                 the comment section */
              code = Scomment;
-             c1 = FETCH_CHAR_AS_MULTIBYTE (from_byte);
-             comstyle = SYNTAX_COMMENT_STYLE (c1);
-             comnested = comnested || SYNTAX_COMMENT_NESTED (c1);
+             comstyle = SYNTAX_FLAGS_COMMENT_STYLE (other_syntax, syntax);
+             comnested
+               = comnested || SYNTAX_FLAGS_COMMENT_NESTED (other_syntax);
              INC_BOTH (from, from_byte);
              UPDATE_SYNTAX_TABLE_FORWARD (from);
            }
@@ -2634,29 +2677,34 @@ scan_lists (from, count, depth, sexpflag)
     {
       while (from > stop)
        {
+         int syntax;
          DEC_BOTH (from, from_byte);
          UPDATE_SYNTAX_TABLE_BACKWARD (from);
          c = FETCH_CHAR_AS_MULTIBYTE (from_byte);
+         syntax= SYNTAX_WITH_FLAGS (c);
          code = SYNTAX_WITH_MULTIBYTE_CHECK (c);
          if (depth == min_depth)
            last_good = from;
          comstyle = 0;
-         comnested = SYNTAX_COMMENT_NESTED (c);
+         comnested = SYNTAX_FLAGS_COMMENT_NESTED (syntax);
          if (code == Sendcomment)
-           comstyle = SYNTAX_COMMENT_STYLE (c);
-         if (from > stop && SYNTAX_COMEND_SECOND (c)
+           comstyle = SYNTAX_FLAGS_COMMENT_STYLE (syntax, 0);
+         if (from > stop && SYNTAX_FLAGS_COMEND_SECOND (syntax)
              && prev_char_comend_first (from, from_byte)
              && parse_sexp_ignore_comments)
            {
              /* We must record the comment style encountered so that
                 later, we can match only the proper comment begin
                 sequence of the same style.  */
+             int c1, other_syntax;
              DEC_BOTH (from, from_byte);
              UPDATE_SYNTAX_TABLE_BACKWARD (from);
              code = Sendcomment;
              c1 = FETCH_CHAR_AS_MULTIBYTE (from_byte);
-             comstyle = SYNTAX_COMMENT_STYLE (c1);
-             comnested = comnested || SYNTAX_COMMENT_NESTED (c1);
+             other_syntax = SYNTAX_WITH_FLAGS (c1);
+             comstyle = SYNTAX_FLAGS_COMMENT_STYLE (other_syntax, syntax);
+             comnested
+               = comnested || SYNTAX_FLAGS_COMMENT_NESTED (other_syntax);
            }
 
          /* Quoting turns anything except a comment-ender
@@ -2667,7 +2715,7 @@ scan_lists (from, count, depth, sexpflag)
              DEC_BOTH (from, from_byte);
              code = Sword;
            }
-         else if (SYNTAX_PREFIX (c))
+         else if (SYNTAX_FLAGS_PREFIX (syntax))
            continue;
 
          switch (SWITCH_ENUM_CAST (code))
@@ -2825,8 +2873,7 @@ Comments are ignored if `parse-sexp-ignore-comments' is non-nil.
 If the beginning or end of (the accessible part of) the buffer is reached
 and the depth is wrong, an error is signaled.
 If the depth is right but the count is not used up, nil is returned.  */)
-     (from, count, depth)
-     Lisp_Object from, count, depth;
+  (Lisp_Object from, Lisp_Object count, Lisp_Object depth)
 {
   CHECK_NUMBER (from);
   CHECK_NUMBER (count);
@@ -2846,8 +2893,7 @@ If the beginning or end of (the accessible part of) the buffer is reached
 in the middle of a parenthetical grouping, an error is signaled.
 If the beginning or end is reached between groupings
 but before count is used up, nil is returned.  */)
-     (from, count)
-     Lisp_Object from, count;
+  (Lisp_Object from, Lisp_Object count)
 {
   CHECK_NUMBER (from);
   CHECK_NUMBER (count);
@@ -2859,7 +2905,7 @@ DEFUN ("backward-prefix-chars", Fbackward_prefix_chars, Sbackward_prefix_chars,
        0, 0, 0,
        doc: /* Move point backward over any number of chars with prefix syntax.
 This includes chars with "quote" or "prefix" syntax (' or p).  */)
-     ()
+  (void)
 {
   int beg = BEGV;
   int opoint = PT;
@@ -2905,14 +2951,10 @@ This includes chars with "quote" or "prefix" syntax (' or p).  */)
    after the beginning of a string, or after the end of a string.  */
 
 static void
-scan_sexps_forward (stateptr, from, from_byte, end, targetdepth,
-                   stopbefore, oldstate, commentstop)
-     struct lisp_parse_state *stateptr;
-     register EMACS_INT from;
-     EMACS_INT from_byte, end;
-     int targetdepth, stopbefore;
-     Lisp_Object oldstate;
-     int commentstop;
+scan_sexps_forward (struct lisp_parse_state *stateptr,
+                   EMACS_INT from, EMACS_INT from_byte, EMACS_INT end,
+                   int targetdepth, int stopbefore,
+                   Lisp_Object oldstate, int commentstop)
 {
   struct lisp_parse_state state;
 
@@ -2997,8 +3039,11 @@ do { prev_from = from;                           \
       oldstate = Fcdr (oldstate);
       oldstate = Fcdr (oldstate);
       tem = Fcar (oldstate);
-      state.comstyle = NILP (tem) ? 0 : (EQ (tem, Qsyntax_table)
-                                        ? ST_COMMENT_STYLE : 1);
+      state.comstyle = (NILP (tem)
+                       ? 0
+                       : (EQ (tem, Qsyntax_table)
+                          ? ST_COMMENT_STYLE
+                          : INTEGERP (tem) ? XINT (tem) : 1));
 
       oldstate = Fcdr (oldstate);
       tem = Fcar (oldstate);
@@ -3043,22 +3088,25 @@ do { prev_from = from;                          \
 
   while (from < end)
     {
+      int syntax;
       INC_FROM;
       code = prev_from_syntax & 0xff;
 
       if (from < end
          && SYNTAX_FLAGS_COMSTART_FIRST (prev_from_syntax)
          && (c1 = FETCH_CHAR (from_byte),
-             SYNTAX_COMSTART_SECOND (c1)))
+             syntax = SYNTAX_WITH_FLAGS (c1),
+             SYNTAX_FLAGS_COMSTART_SECOND (syntax)))
        /* Duplicate code to avoid a complex if-expression
           which causes trouble for the SGI compiler.  */
        {
          /* Record the comment style we have entered so that only
             the comment-end sequence of the same style actually
             terminates the comment section.  */
-         state.comstyle = SYNTAX_COMMENT_STYLE (c1);
+         state.comstyle
+           = SYNTAX_FLAGS_COMMENT_STYLE (syntax, prev_from_syntax);
          comnested = SYNTAX_FLAGS_COMMENT_NESTED (prev_from_syntax);
-         comnested = comnested || SYNTAX_COMMENT_NESTED (c1);
+         comnested = comnested || SYNTAX_FLAGS_COMMENT_NESTED (syntax);
          state.incomment = comnested ? 1 : -1;
          state.comstr_start = prev_from;
          INC_FROM;
@@ -3076,7 +3124,7 @@ do { prev_from = from;                            \
        }
       else if (code == Scomment)
        {
-         state.comstyle = SYNTAX_FLAGS_COMMENT_STYLE (prev_from_syntax);
+         state.comstyle = SYNTAX_FLAGS_COMMENT_STYLE (prev_from_syntax, 0);
          state.incomment = (SYNTAX_FLAGS_COMMENT_NESTED (prev_from_syntax) ?
                             1 : -1);
          state.comstr_start = prev_from;
@@ -3269,8 +3317,7 @@ Value is a list of elements describing final state of parsing:
     else an integer (the current comment nesting).
  5. t if following a quote character.
  6. the minimum paren-depth encountered during this scan.
- 7. t if in a comment of style b; symbol `syntax-table' if the comment
-    should be terminated by a generic comment delimiter.
+ 7. style of comment, if any.
  8. character address of start of comment or string; nil if not in one.
  9. Intermediate data for continuation of parsing (subject to change).
 If third arg TARGETDEPTH is non-nil, parsing stops if the depth
@@ -3283,8 +3330,7 @@ Fifth arg OLDSTATE is a list like what this function returns.
 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.  */)
-     (from, to, targetdepth, stopbefore, oldstate, commentstop)
-     Lisp_Object from, to, targetdepth, stopbefore, oldstate, commentstop;
+  (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;
@@ -3307,8 +3353,10 @@ Sixth arg COMMENTSTOP non-nil means stop at the start of a comment.
   SET_PT (state.location);
 
   return Fcons (make_number (state.depth),
-          Fcons (state.prevlevelstart < 0 ? Qnil : make_number (state.prevlevelstart),
-            Fcons (state.thislevelstart < 0 ? Qnil : make_number (state.thislevelstart),
+          Fcons (state.prevlevelstart < 0
+                 ? Qnil : make_number (state.prevlevelstart),
+            Fcons (state.thislevelstart < 0
+                   ? Qnil : make_number (state.thislevelstart),
               Fcons (state.instring >= 0
                      ? (state.instring == ST_STRING_STYLE
                         ? Qt : make_number (state.instring)) : Qnil,
@@ -3319,8 +3367,9 @@ Sixth arg COMMENTSTOP non-nil means stop at the start of a comment.
                     Fcons (make_number (state.mindepth),
                       Fcons ((state.comstyle
                               ? (state.comstyle == ST_COMMENT_STYLE
-                                 ? Qsyntax_table : Qt) :
-                              Qnil),
+                                 ? Qsyntax_table
+                                 : make_number (state.comstyle))
+                              : Qnil),
                              Fcons (((state.incomment
                                       || (state.instring >= 0))
                                      ? make_number (state.comstr_start)
@@ -3329,7 +3378,7 @@ Sixth arg COMMENTSTOP non-nil means stop at the start of a comment.
 }
 \f
 void
-init_syntax_once ()
+init_syntax_once (void)
 {
   register int i, c;
   Lisp_Object temp;
@@ -3419,7 +3468,7 @@ init_syntax_once ()
 }
 
 void
-syms_of_syntax ()
+syms_of_syntax (void)
 {
   Qsyntax_table_p = intern_c_string ("syntax-table-p");
   staticpro (&Qsyntax_table_p);
index c36b1eb28f6d881507f7a919506c0d947f9c1410..48146572d19f46688821f06ddbcabf3e7451e22e 100644 (file)
@@ -19,7 +19,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 
 extern Lisp_Object Qsyntax_table_p;
-extern void update_syntax_table P_ ((int, int, int, Lisp_Object));
+extern void update_syntax_table (int, int, int, Lisp_Object);
 
 /* The standard syntax table is stored where it will automatically
    be used in all new buffers.  */
@@ -128,56 +128,9 @@ extern Lisp_Object syntax_temp;
     : Qnil))
 #endif
 
-/* Then there are seven single-bit flags that have the following meanings:
-  1. This character is the first of a two-character comment-start sequence.
-  2. This character is the second of a two-character comment-start sequence.
-  3. This character is the first of a two-character comment-end sequence.
-  4. This character is the second of a two-character comment-end sequence.
-  5. This character is a prefix, for backward-prefix-chars.
-  6. see below
-  7. This character is part of a nestable comment sequence.
-  Note that any two-character sequence whose first character has flag 1
-  and whose second character has flag 2 will be interpreted as a comment start.
 
-  bit 6 is used to discriminate between two different comment styles.
-  Languages such as C++ allow two orthogonal syntax start/end pairs
-  and bit 6 is used to determine whether a comment-end or Scommentend
-  ends style a or b.  Comment start sequences can start style a or b.
-  Style a is always the default.
-  */
-
-/* These macros extract a particular flag for a given character.  */
-
-#define SYNTAX_COMSTART_FIRST(c) ((SYNTAX_WITH_FLAGS (c) >> 16) & 1)
-
-#define SYNTAX_COMSTART_SECOND(c) ((SYNTAX_WITH_FLAGS (c) >> 17) & 1)
-
-#define SYNTAX_COMEND_FIRST(c) ((SYNTAX_WITH_FLAGS (c) >> 18) & 1)
-
-#define SYNTAX_COMEND_SECOND(c) ((SYNTAX_WITH_FLAGS (c) >> 19) & 1)
-
-#define SYNTAX_PREFIX(c) ((SYNTAX_WITH_FLAGS (c) >> 20) & 1)
-
-#define SYNTAX_COMMENT_STYLE(c) ((SYNTAX_WITH_FLAGS (c) >> 21) & 1)
-
-#define SYNTAX_COMMENT_NESTED(c) ((SYNTAX_WITH_FLAGS (c) >> 22) & 1)
-
-/* These macros extract specific flags from an integer
-   that holds the syntax code and the flags.  */
-
-#define SYNTAX_FLAGS_COMSTART_FIRST(flags) (((flags) >> 16) & 1)
-
-#define SYNTAX_FLAGS_COMSTART_SECOND(flags) (((flags) >> 17) & 1)
-
-#define SYNTAX_FLAGS_COMEND_FIRST(flags) (((flags) >> 18) & 1)
-
-#define SYNTAX_FLAGS_COMEND_SECOND(flags) (((flags) >> 19) & 1)
-
-#define SYNTAX_FLAGS_PREFIX(flags) (((flags) >> 20) & 1)
-
-#define SYNTAX_FLAGS_COMMENT_STYLE(flags) (((flags) >> 21) & 1)
-
-#define SYNTAX_FLAGS_COMMENT_NESTED(flags) (((flags) >> 22) & 1)
+/* Whether the syntax of the character C has the prefix flag set.  */
+extern int syntax_prefix_flag_p (int c);
 
 /* This array, indexed by a character, contains the syntax code which that
  character signifies (as a char).  For example,
@@ -245,6 +198,14 @@ extern char syntax_code_spec[16];
         1)                                                     \
       : 0))
 
+/* This macro sets up the buffer-global syntax table.  */
+#define SETUP_BUFFER_SYNTAX_TABLE()                                    \
+do                                                                     \
+  {                                                                    \
+    gl_state.use_global = 0;                                           \
+    gl_state.current_syntax_table = current_buffer->syntax_table;      \
+  } while (0)
+
 /* This macro should be called with FROM at the start of forward
    search, or after the last position of the backward search.  It
    makes sure that the first char is picked up with correct table, so
@@ -256,12 +217,11 @@ extern char syntax_code_spec[16];
 #define SETUP_SYNTAX_TABLE(FROM, COUNT)                                        \
 do                                                                     \
   {                                                                    \
+    SETUP_BUFFER_SYNTAX_TABLE ();                                      \
     gl_state.b_property = BEGV;                                                \
     gl_state.e_property = ZV + 1;                                      \
     gl_state.object = Qnil;                                            \
-    gl_state.use_global = 0;                                           \
     gl_state.offset = 0;                                               \
-    gl_state.current_syntax_table = current_buffer->syntax_table;      \
     if (parse_sexp_lookup_properties)                                  \
       if ((COUNT) > 0 || (FROM) > BEGV)                                        \
         update_syntax_table ((COUNT) > 0 ? (FROM) : (FROM) - 1, (COUNT),\
@@ -279,6 +239,7 @@ while (0)
 #define SETUP_SYNTAX_TABLE_FOR_OBJECT(OBJECT, FROM, COUNT)             \
 do                                                                     \
   {                                                                    \
+    SETUP_BUFFER_SYNTAX_TABLE ();                                      \
     gl_state.object = (OBJECT);                                                \
     if (BUFFERP (gl_state.object))                                     \
       {                                                                        \
@@ -305,8 +266,6 @@ do                                                                  \
        gl_state.e_property = 1 + SCHARS (gl_state.object);             \
        gl_state.offset = 0;                                            \
       }                                                                        \
-    gl_state.use_global = 0;                                           \
-    gl_state.current_syntax_table = current_buffer->syntax_table;      \
     if (parse_sexp_lookup_properties)                                  \
       update_syntax_table (((FROM) + gl_state.offset                   \
                            + (COUNT > 0 ? 0 :  -1)),                   \
@@ -340,9 +299,9 @@ struct gl_state_s
 
 extern struct gl_state_s gl_state;
 extern int parse_sexp_lookup_properties;
-extern INTERVAL interval_of P_ ((int, Lisp_Object));
+extern INTERVAL interval_of (int, Lisp_Object);
 
-extern int scan_words P_ ((int, int));
+extern int scan_words (int, int);
 
 /* arch-tag: 28833cca-cd73-4741-8c85-a3111166a0e0
    (do not change this comment) */
index 2f79a711cfd40f298bb330358822fe8c46917e9a..e7d35d46bf704339218ca1f4a5b6ca4aead78706 100644 (file)
@@ -18,10 +18,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/>.  */
 
-#ifdef HAVE_CONFIG_H
 #include <config.h>
-#endif
-
 #include <ctype.h>
 #include <signal.h>
 #include <stdio.h>
@@ -36,20 +33,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif /* HAVE_ALLOCA_H */
 
 #include "lisp.h"
-/* Including stdlib.h isn't necessarily enough to get srandom
-   declared, e.g. without __USE_XOPEN_EXTENDED with glibc 2.  */
-
-/* The w32 build defines select stuff in w32.h, which is included by
-   sys/select.h (included below).   */
-#ifndef WINDOWSNT
 #include "sysselect.h"
-#endif
-
 #include "blockinput.h"
 
 #ifdef WINDOWSNT
@@ -61,19 +47,12 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #endif
 #endif /* not WINDOWSNT */
 
-/* Does anyone other than VMS need this? */
-#ifndef fwrite
-#define sys_fwrite fwrite
-#else
-#undef fwrite
-#endif
-
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <errno.h>
 
 #ifdef HAVE_SETPGID
-#if !defined (USG) || defined (BSD_PGRPS)
+#if !defined (USG)
 #undef setpgrp
 #define setpgrp setpgid
 #endif
@@ -89,17 +68,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "dosfns.h"
 #include "msdos.h"
 #include <sys/param.h>
-
-#if __DJGPP__ > 1
-extern int etext;
-extern unsigned start __asm__ ("start");
-#endif
-#endif
-
-#ifndef USE_CRT_DLL
-#ifndef errno
-extern int errno;
-#endif
 #endif
 
 #include <sys/file.h>
@@ -108,19 +76,13 @@ extern int errno;
 #include <fcntl.h>
 #endif
 
-#ifndef MSDOS
-#include <sys/ioctl.h>
-#endif
-
 #include "systty.h"
 #include "syswait.h"
 
-#if defined (USG)
+#ifdef HAVE_SYS_UTSNAME_H
 #include <sys/utsname.h>
 #include <memory.h>
-#endif /* USG */
-
-extern int quit_char;
+#endif /* HAVE_SYS_UTSNAME_H */
 
 #include "keyboard.h"
 #include "frame.h"
@@ -131,11 +93,12 @@ extern int quit_char;
 #include "dispextern.h"
 #include "process.h"
 #include "cm.h"  /* for reset_sys_modes */
-
-/* For serial_configure and serial_open.  */
-extern Lisp_Object QCport, QCspeed, QCprocess;
-extern Lisp_Object QCbytesize, QCstopbits, QCparity, Qodd, Qeven;
-extern Lisp_Object QCflowcontrol, Qhw, Qsw, QCsummary;
+#ifdef HAVE_TERM_H
+/* Include this last.  If it is ncurses header file, it adds a lot of
+   defines that interfere with stuff in other headers.  Someone responsible
+   for ncurses messed up bigtime.  See bug#6812.  */
+#include <term.h>
+#endif
 
 #ifdef WINDOWSNT
 #include <direct.h>
@@ -174,20 +137,9 @@ static const int baud_convert[] =
     1800, 2400, 4800, 9600, 19200, 38400
   };
 
-#ifdef HAVE_SPEED_T
-#include <termios.h>
-#else
-#if defined (HAVE_LIBNCURSES) && ! defined (NCURSES_OSPEED_T)
-#else
-#if defined (HAVE_TERMIOS_H) && defined (GNU_LINUX)
-#include <termios.h>
-#endif
-#endif
-#endif
-
 int emacs_ospeed;
 
-void croak P_ ((char *)) NO_RETURN;
+void croak (char *) NO_RETURN;
 
 /* Temporary used by `sigblock' when defined in terms of signprocmask.  */
 
@@ -200,7 +152,7 @@ SIGMASKTYPE sigprocmask_set;
    Any other returned value must be freed with free. This is used
    only when get_current_dir_name is not defined on the system.  */
 char*
-get_current_dir_name ()
+get_current_dir_name (void)
 {
   char *buf;
   char *pwd;
@@ -272,7 +224,7 @@ get_current_dir_name ()
 /* Discard pending input on all input descriptors.  */
 
 void
-discard_tty_input ()
+discard_tty_input (void)
 {
 #ifndef WINDOWSNT
   struct emacs_tty buf;
@@ -333,32 +285,11 @@ init_baud_rate (int fd)
 #ifdef DOS_NT
     emacs_ospeed = 15;
 #else  /* not DOS_NT */
-#ifdef HAVE_TERMIOS
       struct termios sg;
 
       sg.c_cflag = B9600;
       tcgetattr (fd, &sg);
       emacs_ospeed = cfgetospeed (&sg);
-#else /* not TERMIOS */
-#ifdef HAVE_TERMIO
-      struct termio sg;
-
-      sg.c_cflag = B9600;
-#ifdef HAVE_TCATTR
-      tcgetattr (fd, &sg);
-#else
-      ioctl (fd, TCGETA, &sg);
-#endif
-      emacs_ospeed = sg.c_cflag & CBAUD;
-#else /* neither TERMIOS nor TERMIO */
-      struct sgttyb sg;
-
-      sg.sg_ospeed = B9600;
-      if (ioctl (fd, TIOCGETP, &sg) < 0)
-       abort ();
-      emacs_ospeed = sg.sg_ospeed;
-#endif /* not HAVE_TERMIO */
-#endif /* not HAVE_TERMIOS */
 #endif /* not DOS_NT */
     }
 
@@ -371,8 +302,7 @@ init_baud_rate (int fd)
 \f
 /*ARGSUSED*/
 void
-set_exclusive_use (fd)
-     int fd;
+set_exclusive_use (int fd)
 {
 #ifdef FIOCLEX
   ioctl (fd, FIOCLEX, 0);
@@ -380,37 +310,23 @@ set_exclusive_use (fd)
   /* Ok to do nothing if this feature does not exist */
 }
 \f
-#ifndef subprocesses
-
-wait_without_blocking ()
-{
-#ifdef BSD_SYSTEM
-  wait3 (0, WNOHANG | WUNTRACED, 0);
-#else
-  croak ("wait_without_blocking");
-#endif
-  synch_process_alive = 0;
-}
-
-#endif /* not subprocesses */
 
 int wait_debugging;   /* Set nonzero to make following function work under dbx
                         (at least for bsd).  */
 
 SIGTYPE
-wait_for_termination_signal ()
+wait_for_termination_signal (void)
 {}
 
+#ifndef MSDOS
 /* Wait for subprocess with process id `pid' to terminate and
    make sure it will get eliminated (not remain forever as a zombie) */
 
 void
-wait_for_termination (pid)
-     int pid;
+wait_for_termination (int pid)
 {
   while (1)
     {
-#ifdef subprocesses
 #if defined (BSD_SYSTEM) || defined (HPUX)
       /* Note that kill returns -1 even if the process is just a zombie now.
         But inevitably a SIGCHLD interrupt should be generated
@@ -431,7 +347,10 @@ wait_for_termination (pid)
       else
        sigpause (SIGEMPTYMASK);
 #else /* not BSD_SYSTEM, and not HPUX version >= 6 */
-#ifdef POSIX_SIGNALS    /* would this work for GNU/Linux as well? */
+#ifdef WINDOWSNT
+      wait (0);
+      break;
+#else /* not WINDOWSNT */
       sigblock (sigmask (SIGCHLD));
       errno = 0;
       if (kill (pid, 0) == -1 && errno == ESRCH)
@@ -441,54 +360,20 @@ wait_for_termination (pid)
        }
 
       sigsuspend (&empty_mask);
-#else /* not POSIX_SIGNALS */
-#ifdef HAVE_SYSV_SIGPAUSE
-      sighold (SIGCHLD);
-      if (0 > kill (pid, 0))
-       {
-         sigrelse (SIGCHLD);
-         break;
-       }
-      sigpause (SIGCHLD);
-#else /* not HAVE_SYSV_SIGPAUSE */
-#ifdef WINDOWSNT
-      wait (0);
-      break;
-#else /* not WINDOWSNT */
-      if (0 > kill (pid, 0))
-       break;
-      /* Using sleep instead of pause avoids timing error.
-        If the inferior dies just before the sleep,
-        we lose just one second.  */
-      sleep (1);
 #endif /* not WINDOWSNT */
-#endif /* not HAVE_SYSV_SIGPAUSE */
-#endif /* not POSIX_SIGNALS */
 #endif /* not BSD_SYSTEM, and not HPUX version >= 6 */
-#else /* not subprocesses */
-#if __DJGPP__ > 1
-      break;
-#else /* not __DJGPP__ > 1 */
-      if (kill (pid, 0) < 0)
-       break;
-      wait (0);
-#endif /* not __DJGPP__ > 1*/
-#endif /* not subprocesses */
     }
 }
 
-#ifdef subprocesses
-
 /*
  *     flush any pending output
  *      (may flush input as well; it does not matter the way we use it)
  */
 
 void
-flush_pending_output (channel)
-     int channel;
+flush_pending_output (int channel)
 {
-#ifdef HAVE_TERMIOS
+#ifndef DOS_NT
   /* If we try this, we get hit with SIGTTIN, because
      the child's tty belongs to the child's pgrp. */
 #else
@@ -512,15 +397,12 @@ flush_pending_output (channel)
     in Emacs.  No padding needed for insertion into an Emacs buffer.  */
 
 void
-child_setup_tty (out)
-     int out;
+child_setup_tty (int out)
 {
-#ifndef DOS_NT
+#ifndef WINDOWSNT
   struct emacs_tty s;
 
   EMACS_GET_TTY (out, &s);
-
-#if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS)
   s.main.c_oflag |= OPOST;     /* Enable output postprocessing */
   s.main.c_oflag &= ~ONLCR;    /* Disable map of NL to CR-NL on output */
 #ifdef NLDLY
@@ -547,8 +429,6 @@ child_setup_tty (out)
 #endif
   s.main.c_oflag &= ~TAB3;     /* Disable tab expansion */
   s.main.c_cflag = (s.main.c_cflag & ~CSIZE) | CS8; /* Don't strip 8th bit */
-  s.main.c_lflag |= ICANON;    /* Enable erase/kill and eof processing */
-  s.main.c_cc[VEOF] = 04;      /* insure that EOF is Control-D */
   s.main.c_cc[VERASE] = CDISABLE;      /* disable erase processing */
   s.main.c_cc[VKILL] = CDISABLE;       /* disable kill processing */
 
@@ -566,11 +446,6 @@ child_setup_tty (out)
 #endif /* not SIGNALS_VIA_CHARACTERS */
 
 #ifdef AIX
-/* AIX enhanced edit loses NULs, so disable it */
-#ifndef IBMR2AIX
-  s.main.c_line = 0;
-  s.main.c_iflag &= ~ASCEDIT;
-#endif
   /* Also, PTY overloads NUL and BREAK.
      don't ignore break, but don't signal either, so it looks like NUL.  */
   s.main.c_iflag &= ~IGNBRK;
@@ -578,42 +453,53 @@ child_setup_tty (out)
   /* rms: Formerly it set s.main.c_cc[VINTR] to 0377 here
      unconditionally.  Then a SIGNALS_VIA_CHARACTERS conditional
      would force it to 0377.  That looks like duplicated code.  */
-  s.main.c_cc[VEOL] = CDISABLE;
   s.main.c_cflag = (s.main.c_cflag & ~CBAUD) | B9600; /* baud rate sanity */
 #endif /* AIX */
 
-#else /* not HAVE_TERMIO */
-
-  s.main.sg_flags &= ~(ECHO | CRMOD | ANYP | ALLDELAY | RAW | LCASE
-                      | CBREAK | TANDEM);
-  s.main.sg_flags |= LPASS8;
-  s.main.sg_erase = 0377;
-  s.main.sg_kill = 0377;
-  s.lmode = LLITOUT | s.lmode;        /* Don't strip 8th bit */
-
-#endif /* not HAVE_TERMIO */
+  /* We originally enabled ICANON (and set VEOF to 04), and then had
+     proces.c send additional EOF chars to flush the output when faced
+     with long lines, but this leads to weird effects when the
+     subprocess has disabled ICANON and ends up seeing those spurious
+     extra EOFs.  So we don't send EOFs any more in
+     process.c:send_process.  First we tried to disable ICANON by
+     default, so if a subsprocess sets up ICANON, it's his problem (or
+     the Elisp package that talks to it) to deal with lines that are
+     too long.  But this disables some features, such as the ability
+     to send EOF signals.  So we re-enabled ICANON but there is no
+     more "send eof to flush" going on (which is wrong and unportable
+     in itself).  The correct way to handle too much output is to
+     buffer what could not be written and then write it again when
+     select returns ok for writing.  This has it own set of
+     problems.  Write is now asynchronous, is that a problem?  How much
+     do we buffer, and what do we do when that limit is reached?  */
+
+  s.main.c_lflag |= ICANON;    /* Enable line editing and eof processing */
+  s.main.c_cc[VEOF] = 'D'&037; /* Control-D */
+#if 0      /* These settings only apply to non-ICANON mode. */
+  s.main.c_cc[VMIN] = 1;
+  s.main.c_cc[VTIME] = 0;
+#endif
 
   EMACS_SET_TTY (out, &s, 0);
-
-#endif /* not DOS_NT */
+#endif /* not WINDOWSNT */
 }
+#endif /* MSDOS */
 
-#endif /* subprocesses */
 \f
 /* Record a signal code and the handler for it.  */
 struct save_signal
 {
   int code;
-  SIGTYPE (*handler) P_ ((int));
+  SIGTYPE (*handler) (int);
 };
 
-static void save_signal_handlers P_ ((struct save_signal *));
-static void restore_signal_handlers P_ ((struct save_signal *));
+static void save_signal_handlers (struct save_signal *);
+static void restore_signal_handlers (struct save_signal *);
 
 /* Suspend the Emacs process; give terminal to its superior.  */
 
 void
-sys_suspend ()
+sys_suspend (void)
 {
 #if defined (SIGTSTP) && !defined (MSDOS)
 
@@ -634,7 +520,7 @@ sys_suspend ()
 /* Fork a subshell.  */
 
 void
-sys_subshell ()
+sys_subshell (void)
 {
 #ifdef DOS_NT  /* Demacs 1.1.2 91/10/20 Manabu Higashida */
   int st;
@@ -669,17 +555,15 @@ sys_subshell ()
   dir = expand_and_dir_to_file (Funhandled_file_name_directory (dir), Qnil);
   str = (unsigned char *) alloca (SCHARS (dir) + 2);
   len = SCHARS (dir);
-  bcopy (SDATA (dir), str, len);
+  memcpy (str, SDATA (dir), len);
   if (str[len - 1] != '/') str[len++] = '/';
   str[len] = 0;
  xyzzy:
 
 #ifdef DOS_NT
   pid = 0;
-#if __DJGPP__ > 1
   save_signal_handlers (saved_handlers);
   synch_process_alive = 1;
-#endif /* __DJGPP__ > 1 */
 #else
   pid = vfork ();
   if (pid == -1)
@@ -688,7 +572,7 @@ sys_subshell ()
 
   if (pid == 0)
     {
-      char *sh = 0;
+      const char *sh = 0;
 
 #ifdef DOS_NT    /* MW, Aug 1993 */
       getwd (oldwd);
@@ -704,9 +588,7 @@ sys_subshell ()
       if (str)
        chdir ((char *) str);
 
-#ifdef subprocesses
       close_process_descs ();  /* Close Emacs's pipes/ptys */
-#endif
 
 #ifdef SET_EMACS_PRIORITY
       {
@@ -751,7 +633,7 @@ sys_subshell ()
     }
 
   /* Do this now if we did not do it before.  */
-#if !defined (MSDOS) || __DJGPP__ == 1
+#ifndef MSDOS
   save_signal_handlers (saved_handlers);
   synch_process_alive = 1;
 #endif
@@ -764,20 +646,18 @@ sys_subshell ()
 }
 
 static void
-save_signal_handlers (saved_handlers)
-     struct save_signal *saved_handlers;
+save_signal_handlers (struct save_signal *saved_handlers)
 {
   while (saved_handlers->code)
     {
       saved_handlers->handler
-       = (SIGTYPE (*) P_ ((int))) signal (saved_handlers->code, SIG_IGN);
+        = (SIGTYPE (*) (int)) signal (saved_handlers->code, SIG_IGN);
       saved_handlers++;
     }
 }
 
 static void
-restore_signal_handlers (saved_handlers)
-     struct save_signal *saved_handlers;
+restore_signal_handlers (struct save_signal *saved_handlers)
 {
   while (saved_handlers->code)
     {
@@ -814,8 +694,7 @@ unrequest_sigio (void)
 int old_fcntl_flags[MAXDESC];
 
 void
-init_sigio (fd)
-     int fd;
+init_sigio (int fd)
 {
 #ifdef FASYNC
   old_fcntl_flags[fd] = fcntl (fd, F_GETFL, 0) & ~FASYNC;
@@ -825,8 +704,7 @@ init_sigio (fd)
 }
 
 void
-reset_sigio (fd)
-     int fd;
+reset_sigio (int fd)
 {
 #ifdef FASYNC
   fcntl (fd, F_SETFL, old_fcntl_flags[fd]);
@@ -838,7 +716,7 @@ reset_sigio (fd)
 /* XXX Yeah, but you need it for SIGIO, don't you? */
 
 void
-request_sigio ()
+request_sigio (void)
 {
   if (noninteractive)
     return;
@@ -853,7 +731,7 @@ request_sigio ()
 
 void
 unrequest_sigio (void)
-{ 
+{
   if (noninteractive)
     return;
 
@@ -873,7 +751,7 @@ unrequest_sigio (void)
 #ifndef MSDOS
 
 void
-request_sigio ()
+request_sigio (void)
 {
   if (noninteractive || read_socket_hook)
     return;
@@ -882,7 +760,7 @@ request_sigio ()
 }
 
 void
-unrequest_sigio ()
+unrequest_sigio (void)
 {
   if (noninteractive || read_socket_hook)
     return;
@@ -894,65 +772,7 @@ unrequest_sigio ()
 #endif /* FASYNC */
 #endif /* F_SETFL */
 #endif /* SIGIO */
-\f
-/* Saving and restoring the process group of Emacs's terminal.  */
-
-#ifdef BSD_PGRPS
-
-/* The process group of which Emacs was a member when it initially
-   started.
-
-   If Emacs was in its own process group (i.e. inherited_pgroup ==
-   getpid ()), then we know we're running under a shell with job
-   control (Emacs would never be run as part of a pipeline).
-   Everything is fine.
-
-   If Emacs was not in its own process group, then we know we're
-   running under a shell (or a caller) that doesn't know how to
-   separate itself from Emacs (like sh).  Emacs must be in its own
-   process group in order to receive SIGIO correctly.  In this
-   situation, we put ourselves in our own pgroup, forcibly set the
-   tty's pgroup to our pgroup, and make sure to restore and reinstate
-   the tty's pgroup just like any other terminal setting.  If
-   inherited_group was not the tty's pgroup, then we'll get a
-   SIGTTmumble when we try to change the tty's pgroup, and a CONT if
-   it goes foreground in the future, which is what should happen.
-
-   This variable is initialized in emacs.c.  */
-int inherited_pgroup;
-
-/* Split off the foreground process group to Emacs alone.  When we are
-   in the foreground, but not started in our own process group,
-   redirect the tty device handle FD to point to our own process
-   group.  We need to be in our own process group to receive SIGIO
-   properly.  */
-static void
-narrow_foreground_group (int fd)
-{
-  int me = getpid ();
-
-  setpgrp (0, inherited_pgroup);
-#if 0
-  /* XXX inherited_pgroup should not be zero here, but GTK seems to
-     mess this up. */
-  if (! inherited_pgroup)
-    abort ();                   /* Should not happen. */
-#endif
-  if (inherited_pgroup != me)
-      EMACS_SET_TTY_PGRP (fd, &me); /* XXX This only works on the controlling tty. */
-  setpgrp (0, me);
-}
-
-/* Set the tty to our original foreground group.  */
-static void
-widen_foreground_group (int fd)
-{
-  if (inherited_pgroup != getpid ())
-    EMACS_SET_TTY_PGRP (fd, &inherited_pgroup);
-  setpgrp (0, inherited_pgroup);
-}
 
-#endif /* BSD_PGRPS */
 \f
 /* Getting and setting emacs_tty structures.  */
 
@@ -960,43 +780,14 @@ widen_foreground_group (int fd)
    Return zero if all's well, or -1 if we ran into an error we
    couldn't deal with.  */
 int
-emacs_get_tty (fd, settings)
-     int fd;
-     struct emacs_tty *settings;
+emacs_get_tty (int fd, struct emacs_tty *settings)
 {
   /* Retrieve the primary parameters - baud rate, character size, etcetera.  */
-#ifdef HAVE_TCATTR
+#ifndef DOS_NT
   /* We have those nifty POSIX tcmumbleattr functions.  */
-  bzero (&settings->main, sizeof (settings->main));
+  memset (&settings->main, 0, sizeof (settings->main));
   if (tcgetattr (fd, &settings->main) < 0)
     return -1;
-
-#else
-#ifdef HAVE_TERMIO
-  /* The SYSV-style interface?  */
-  if (ioctl (fd, TCGETA, &settings->main) < 0)
-    return -1;
-
-#else
-#ifndef DOS_NT
-  /* I give up - I hope you have the BSD ioctls.  */
-  if (ioctl (fd, TIOCGETP, &settings->main) < 0)
-    return -1;
-#endif /* not DOS_NT */
-#endif
-#endif
-
-  /* Suivant - Do we have to get struct ltchars data?  */
-#ifdef HAVE_LTCHARS
-  if (ioctl (fd, TIOCGLTC, &settings->ltchars) < 0)
-    return -1;
-#endif
-
-  /* How about a struct tchars and a wordful of lmode bits?  */
-#ifdef HAVE_TCHARS
-  if (ioctl (fd, TIOCGETC, &settings->tchars) < 0
-      || ioctl (fd, TIOCLGET, &settings->lmode) < 0)
-    return -1;
 #endif
 
   /* We have survived the tempest.  */
@@ -1009,13 +800,10 @@ emacs_get_tty (fd, settings)
    Return 0 if all went well, and -1 if anything failed.  */
 
 int
-emacs_set_tty (fd, settings, flushp)
-     int fd;
-     struct emacs_tty *settings;
-     int flushp;
+emacs_set_tty (int fd, struct emacs_tty *settings, int flushp)
 {
   /* Set the primary parameters - baud rate, character size, etcetera.  */
-#ifdef HAVE_TCATTR
+#ifndef DOS_NT
   int i;
   /* We have those nifty POSIX tcmumbleattr functions.
      William J. Smith <wjs@wiis.wang.com> writes:
@@ -1037,7 +825,7 @@ emacs_set_tty (fd, settings, flushp)
       {
        struct termios new;
 
-       bzero (&new, sizeof (new));
+       memset (&new, 0, sizeof (new));
        /* Get the current settings, and see if they're what we asked for.  */
        tcgetattr (fd, &new);
        /* We cannot use memcmp on the whole structure here because under
@@ -1053,34 +841,6 @@ emacs_set_tty (fd, settings, flushp)
        else
          continue;
       }
-
-#else
-#ifdef HAVE_TERMIO
-  /* The SYSV-style interface?  */
-  if (ioctl (fd, flushp ? TCSETAF : TCSETAW, &settings->main) < 0)
-    return -1;
-
-#else
-#ifndef DOS_NT
-  /* I give up - I hope you have the BSD ioctls.  */
-  if (ioctl (fd, (flushp) ? TIOCSETP : TIOCSETN, &settings->main) < 0)
-    return -1;
-#endif /* not DOS_NT */
-
-#endif
-#endif
-
-  /* Suivant - Do we have to get struct ltchars data?  */
-#ifdef HAVE_LTCHARS
-  if (ioctl (fd, TIOCSLTC, &settings->ltchars) < 0)
-    return -1;
-#endif
-
-  /* How about a struct tchars and a wordful of lmode bits?  */
-#ifdef HAVE_TCHARS
-  if (ioctl (fd, TIOCSETC, &settings->tchars) < 0
-      || ioctl (fd, TIOCLSET, &settings->lmode) < 0)
-    return -1;
 #endif
 
   /* We have survived the tempest.  */
@@ -1103,13 +863,6 @@ unsigned char _sobuf[BUFSIZ+8];
 char _sobuf[BUFSIZ];
 #endif
 
-#ifdef HAVE_LTCHARS
-static struct ltchars new_ltchars = {-1,-1,-1,-1,-1,-1};
-#endif
-#ifdef HAVE_TCHARS
-static struct tchars new_tchars = {-1,-1,-1,-1,-1,-1};
-#endif
-
 /* Initialize the terminal mode on all tty devices that are currently
    open. */
 
@@ -1124,8 +877,7 @@ init_all_sys_modes (void)
 /* Initialize the terminal mode on the given tty device. */
 
 void
-init_sys_modes (tty_out)
-     struct tty_display_info *tty_out;
+init_sys_modes (struct tty_display_info *tty_out)
 {
   struct emacs_tty tty;
 
@@ -1136,24 +888,15 @@ init_sys_modes (tty_out)
 
   if (!tty_out->output)
     return;                     /* The tty is suspended. */
-  
-#ifdef BSD_PGRPS
-#if 0
-  /* read_socket_hook is not global anymore.  I think doing this
-     unconditionally will not cause any problems. */
-  if (! read_socket_hook && EQ (Vinitial_window_system, Qnil))
-#endif
-    narrow_foreground_group (fileno (tty_out->input));
-#endif
 
   if (! tty_out->old_tty)
     tty_out->old_tty = (struct emacs_tty *) xmalloc (sizeof (struct emacs_tty));
-      
+
   EMACS_GET_TTY (fileno (tty_out->input), tty_out->old_tty);
 
   tty = *tty_out->old_tty;
 
-#if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS)
+#if !defined (DOS_NT)
   XSETINT (Vtty_erase_char, tty.main.c_cc[VERASE]);
 
   tty.main.c_iflag |= (IGNBRK);        /* Ignore break condition */
@@ -1206,7 +949,7 @@ init_sys_modes (tty_out)
          means that the interrupt and quit feature must be
          disabled on secondary ttys, or we would not even see the
          keypress.
-         
+
          Note that even though emacsclient could have special code
          to pass SIGINT to Emacs, we should _not_ enable
          interrupt/quit keys for emacsclient frames.  This means
@@ -1224,13 +967,12 @@ init_sys_modes (tty_out)
   tty.main.c_cc[VSWTCH] = CDISABLE;    /* Turn off shell layering use
                                           of C-z */
 #endif /* VSWTCH */
-  
-#if defined (__mips__) || defined (HAVE_TCATTR)
+
 #ifdef VSUSP
-  tty.main.c_cc[VSUSP] = CDISABLE;     /* Turn off mips handling of C-z.  */
+  tty.main.c_cc[VSUSP] = CDISABLE;     /* Turn off handling of C-z.  */
 #endif /* VSUSP */
 #ifdef V_DSUSP
-  tty.main.c_cc[V_DSUSP] = CDISABLE; /* Turn off mips handling of C-y.  */
+  tty.main.c_cc[V_DSUSP] = CDISABLE; /* Turn off handling of C-y.  */
 #endif /* V_DSUSP */
 #ifdef VDSUSP /* Some systems have VDSUSP, some have V_DSUSP.  */
   tty.main.c_cc[VDSUSP] = CDISABLE;
@@ -1266,19 +1008,12 @@ init_sys_modes (tty_out)
       tty.main.c_cc[VSTOP] = CDISABLE;
 #endif /* VSTOP */
     }
-#endif /* mips or HAVE_TCATTR */
 
 #ifdef AIX
-#ifndef IBMR2AIX
-  /* AIX enhanced edit loses NULs, so disable it.  */
-  tty.main.c_line = 0;
-  tty.main.c_iflag &= ~ASCEDIT;
-#else
   tty.main.c_cc[VSTRT] = CDISABLE;
   tty.main.c_cc[VSTOP] = CDISABLE;
   tty.main.c_cc[VSUSP] = CDISABLE;
   tty.main.c_cc[VDSUSP] = CDISABLE;
-#endif /* IBMR2AIX */
   if (tty_out->flow_control)
     {
 #ifdef VSTART
@@ -1295,41 +1030,8 @@ init_sys_modes (tty_out)
   tty.main.c_iflag &= ~IGNBRK;
   tty.main.c_iflag &= ~BRKINT;
 #endif
-#else /* if not HAVE_TERMIO */
-#ifndef DOS_NT
-  XSETINT (Vtty_erase_char, tty.main.sg_erase);
-  tty.main.sg_flags &= ~(ECHO | CRMOD | XTABS);
-  if (meta_key)
-    tty.main.sg_flags |= ANYP;
-  tty.main.sg_flags |= interrupt_input ? RAW : CBREAK;
 #endif /* not DOS_NT */
-#endif /* not HAVE_TERMIO */
-
-  /* If going to use CBREAK mode, we must request C-g to interrupt
-     and turn off start and stop chars, etc.  If not going to use
-     CBREAK mode, do this anyway so as to turn off local flow
-     control for user coming over network on 4.2; in this case,
-     only t_stopc and t_startc really matter.  */
-#ifndef HAVE_TERMIO
-#ifdef HAVE_TCHARS
-  /* Note: if not using CBREAK mode, it makes no difference how we
-     set this */
-  tty.tchars = new_tchars;
-  tty.tchars.t_intrc = quit_char;
-  if (tty_out->flow_control)
-    {
-      tty.tchars.t_startc = '\021';
-      tty.tchars.t_stopc = '\023';
-    }
-  
-  tty.lmode = LDECCTQ | LLITOUT | LPASS8 | LNOFLSH | tty_out->old_tty.lmode;
-  
-#endif /* HAVE_TCHARS */
-#endif /* not HAVE_TERMIO */
-
-#ifdef HAVE_LTCHARS
-  tty.ltchars = new_ltchars;
-#endif /* HAVE_LTCHARS */
+
 #ifdef MSDOS   /* Demacs 1.1.2 91/10/20 Manabu Higashida, MW Aug 1993 */
   if (!tty_out->term_initted)
     internal_terminal_init ();
@@ -1348,7 +1050,7 @@ init_sys_modes (tty_out)
   if (!tty_out->flow_control) ioctl (fileno (tty_out->input), TIOCSTART, 0);
 #endif
 
-#if defined (HAVE_TERMIOS) || defined (HPUX)
+#if !defined (DOS_NT)
 #ifdef TCOON
   if (!tty_out->flow_control) tcflow (fileno (tty_out->input), TCOON);
 #endif
@@ -1401,9 +1103,8 @@ init_sys_modes (tty_out)
 
   if (tty_out->term_initted && no_redraw_on_reenter)
     {
-      /* XXX This seems wrong on multi-tty. */
-      if (display_completed)
-       direct_output_forward_char (0);
+      /* We used to call "direct_output_forward_char(0)" here,
+        but it's not clear why, since it may not do anything anyway.  */
     }
   else
     {
@@ -1484,8 +1185,7 @@ get_tty_size (int fd, int *widthp, int *heightp)
    to HEIGHT and WIDTH.  This is used mainly with ptys.  */
 
 int
-set_window_size (fd, height, width)
-     int fd, height, width;
+set_window_size (int fd, int height, int width)
 {
 #ifdef TIOCSWINSZ
 
@@ -1533,8 +1233,7 @@ reset_all_sys_modes (void)
    bottom of the frame, turn off interrupt-driven I/O, etc.  */
 
 void
-reset_sys_modes (tty_out)
-     struct tty_display_info *tty_out;
+reset_sys_modes (struct tty_display_info *tty_out)
 {
   if (noninteractive)
     {
@@ -1546,11 +1245,11 @@ reset_sys_modes (tty_out)
 
   if (!tty_out->output)
     return;                     /* The tty is suspended. */
-  
+
   /* Go to and clear the last line of the terminal. */
 
   cmgoto (tty_out, FrameRows (tty_out) - 1, 0);
-  
+
   /* Code adapted from tty_clear_end_of_line. */
   if (tty_out->TS_clr_line)
     {
@@ -1560,16 +1259,16 @@ reset_sys_modes (tty_out)
     {                  /* have to do it the hard way */
       int i;
       tty_turn_off_insert (tty_out);
-      
+
       for (i = curX (tty_out); i < FrameCols (tty_out) - 1; i++)
         {
           fputc (' ', tty_out->output);
         }
     }
-  
+
   cmgoto (tty_out, FrameRows (tty_out) - 1, 0);
   fflush (tty_out->output);
-  
+
   if (tty_out->terminal->reset_terminal_modes_hook)
     tty_out->terminal->reset_terminal_modes_hook (tty_out->terminal);
 
@@ -1602,9 +1301,6 @@ reset_sys_modes (tty_out)
   dos_ttcooked ();
 #endif
 
-#ifdef BSD_PGRPS
-  widen_foreground_group (fileno (tty_out->input));
-#endif
 }
 \f
 #ifdef HAVE_PTYS
@@ -1612,8 +1308,7 @@ reset_sys_modes (tty_out)
 /* Set up the proper status flags for use of a pty.  */
 
 void
-setup_pty (fd)
-     int fd;
+setup_pty (int fd)
 {
   /* I'm told that TOICREMOTE does not mean control chars
      "can't be sent" but rather that they don't have
@@ -1649,83 +1344,6 @@ setup_pty (fd)
 }
 #endif /* HAVE_PTYS */
 \f
-#if !defined(CANNOT_DUMP) || !defined(SYSTEM_MALLOC)
-/* Some systems that cannot dump also cannot implement these.  */
-
-/*
- *     Return the address of the start of the text segment prior to
- *     doing an unexec.  After unexec the return value is undefined.
- *     See crt0.c for further explanation and _start.
- *
- */
-
-#if !(defined (__NetBSD__) && defined (__ELF__))
-#ifndef HAVE_TEXT_START
-char *
-start_of_text ()
-{
-#ifdef TEXT_START
-  return ((char *) TEXT_START);
-#else
-  extern int _start ();
-  return ((char *) _start);
-#endif /* TEXT_START */
-}
-#endif /* not HAVE_TEXT_START */
-#endif
-
-/*
- *     Return the address of the start of the data segment prior to
- *     doing an unexec.  After unexec the return value is undefined.
- *     See crt0.c for further information and definition of data_start.
- *
- *     Apparently, on BSD systems this is etext at startup.  On
- *     USG systems (swapping) this is highly mmu dependent and
- *     is also dependent on whether or not the program is running
- *     with shared text.  Generally there is a (possibly large)
- *     gap between end of text and start of data with shared text.
- *
- *     On Uniplus+ systems with shared text, data starts at a
- *     fixed address.  Each port (from a given oem) is generally
- *     different, and the specific value of the start of data can
- *     be obtained via the UniPlus+ specific "uvar" system call,
- *     however the method outlined in crt0.c seems to be more portable.
- *
- *     Probably what will have to happen when a USG unexec is available,
- *     at least on UniPlus, is temacs will have to be made unshared so
- *     that text and data are contiguous.  Then once loadup is complete,
- *     unexec will produce a shared executable where the data can be
- *     at the normal shared text boundary and the startofdata variable
- *     will be patched by unexec to the correct value.
- *
- */
-
-#ifndef start_of_data
-char *
-start_of_data ()
-{
-#ifdef DATA_START
-  return ((char *) DATA_START);
-#else
-#ifdef ORDINARY_LINK
-  /*
-   * This is a hack.  Since we're not linking crt0.c or pre_crt0.c,
-   * data_start isn't defined.  We take the address of environ, which
-   * is known to live at or near the start of the system crt0.c, and
-   * we don't sweat the handful of bytes that might lose.
-   */
-  extern char **environ;
-
-  return ((char *) &environ);
-#else
-  extern int data_start;
-  return ((char *) &data_start);
-#endif /* ORDINARY_LINK */
-#endif /* DATA_START */
-}
-#endif /* start_of_data */
-#endif /* NEED_STARTS (not CANNOT_DUMP or not SYSTEM_MALLOC) */
-\f
 /* init_system_name sets up the string for the Lisp function
    system-name to return. */
 
@@ -1743,7 +1361,7 @@ extern int h_errno;
 #endif /* TRY_AGAIN */
 
 void
-init_system_name ()
+init_system_name (void)
 {
 #ifndef HAVE_GETHOSTNAME
   struct utsname uts;
@@ -1776,7 +1394,7 @@ init_system_name ()
 #ifndef CANNOT_DUMP
   if (initialized)
 #endif /* not CANNOT_DUMP */
-    if (! index (hostname, '.'))
+    if (! strchr (hostname, '.'))
       {
        int count;
 #ifdef HAVE_GETADDRINFO
@@ -1784,7 +1402,7 @@ init_system_name ()
         struct addrinfo hints;
         int ret;
 
-        memset (&hints, 0, sizeof(hints));
+        memset (&hints, 0, sizeof (hints));
         hints.ai_socktype = SOCK_STREAM;
         hints.ai_flags = AI_CANONNAME;
 
@@ -1805,7 +1423,7 @@ init_system_name ()
             while (it)
               {
                 char *fqdn = it->ai_canonname;
-                if (fqdn && index (fqdn, '.')
+                if (fqdn && strchr (fqdn, '.')
                     && strcmp (fqdn, "localhost.localdomain") != 0)
                   break;
                 it = it->ai_next;
@@ -1841,13 +1459,13 @@ init_system_name ()
          {
            char *fqdn = (char *) hp->h_name;
 
-           if (!index (fqdn, '.'))
+           if (!strchr (fqdn, '.'))
              {
                /* We still don't have a fully qualified domain name.
                   Try to find one in the list of alternate names */
                char **alias = hp->h_aliases;
                while (*alias
-                      && (!index (*alias, '.')
+                      && (!strchr (*alias, '.')
                           || !strcmp (*alias, "localhost.localdomain")))
                  alias++;
                if (*alias)
@@ -1896,8 +1514,8 @@ jmp_buf read_alarm_throw;
 
 int read_alarm_should_throw;
 
-SIGTYPE
-select_alarm ()
+void
+select_alarm (int ignore)
 {
   select_alarmed = 1;
   signal (SIGALRM, SIG_IGN);
@@ -1909,23 +1527,18 @@ select_alarm ()
 #ifndef WINDOWSNT
 /* Only rfds are checked.  */
 int
-sys_select (nfds, rfds, wfds, efds, timeout)
-     int nfds;
-     SELECT_TYPE *rfds, *wfds, *efds;
-     EMACS_TIME *timeout;
+sys_select (int nfds,
+           SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
+           EMACS_TIME *timeout)
 {
   /* XXX This needs to be updated for multi-tty support.  Is there
-     anybody who needs to emulate select these days?  */ 
+     anybody who needs to emulate select these days?  */
  int ravail = 0;
   SELECT_TYPE orfds;
   int timeoutval;
   int *local_timeout;
   extern int proc_buffered_char[];
-#ifndef subprocesses
-  int process_tick = 0, update_tick = 0;
-#else
   extern int process_tick, update_tick;
-#endif
   unsigned char buf;
 
 #if defined (HAVE_SELECT) && defined (HAVE_X_WINDOWS)
@@ -2046,12 +1659,11 @@ sys_select (nfds, rfds, wfds, efds, timeout)
    waiting for at least one character.  */
 
 void
-read_input_waiting ()
+read_input_waiting (void)
 {
   /* XXX This needs to be updated for multi-tty support.  Is there
      anybody who needs to emulate select these days?  */
   int nread, i;
-  extern int quit_char;
 
   if (read_socket_hook)
     {
@@ -2113,10 +1725,10 @@ read_input_waiting ()
 /* POSIX signals support - DJB */
 /* Anyone with POSIX signals should have ANSI C declarations */
 
-#ifdef POSIX_SIGNALS
-
 sigset_t empty_mask, full_mask;
 
+#ifndef WINDOWSNT
+
 signal_handler_t
 sys_signal (int signal_number, signal_handler_t action)
 {
@@ -2145,6 +1757,8 @@ sys_signal (int signal_number, signal_handler_t action)
   return (old_action.sa_handler);
 }
 
+#endif /* WINDOWSNT */
+
 #ifndef __GNUC__
 /* If we're compiling with GCC, we don't need this function, since it
    can be written as a macro.  */
@@ -2187,7 +1801,6 @@ sys_sigsetmask (sigset_t new_mask)
   return (old_mask);
 }
 
-#endif /* POSIX_SIGNALS */
 \f
 #if !defined HAVE_STRSIGNAL && !HAVE_DECL_SYS_SIGLIST
 static char *my_sys_siglist[NSIG];
@@ -2198,12 +1811,10 @@ static char *my_sys_siglist[NSIG];
 #endif
 
 void
-init_signals ()
+init_signals (void)
 {
-#ifdef POSIX_SIGNALS
   sigemptyset (&empty_mask);
   sigfillset (&full_mask);
-#endif
 
 #if !defined HAVE_STRSIGNAL && !HAVE_DECL_SYS_SIGLIST
   if (! initialized)
@@ -2406,8 +2017,7 @@ init_signals ()
 #endif /* !RAND_BITS */
 
 void
-seed_random (arg)
-     long arg;
+seed_random (long int arg)
 {
 #ifdef HAVE_RANDOM
   srandom ((unsigned int)arg);
@@ -2425,7 +2035,7 @@ seed_random (arg)
  * This suffices even for a 64-bit architecture with a 15-bit rand.
  */
 long
-get_random ()
+get_random (void)
 {
   long val = random ();
 #if VALBITS > RAND_BITS
@@ -2460,9 +2070,7 @@ strerror (errnum)
 #endif /* ! HAVE_STRERROR */
 \f
 int
-emacs_open (path, oflag, mode)
-     const char *path;
-     int oflag, mode;
+emacs_open (const char *path, int oflag, int mode)
 {
   register int rtnval;
 
@@ -2473,8 +2081,7 @@ emacs_open (path, oflag, mode)
 }
 
 int
-emacs_close (fd)
-     int fd;
+emacs_close (int fd)
 {
   int did_retry = 0;
   register int rtnval;
@@ -2493,10 +2100,7 @@ emacs_close (fd)
 }
 
 int
-emacs_read (fildes, buf, nbyte)
-     int fildes;
-     char *buf;
-     unsigned int nbyte;
+emacs_read (int fildes, char *buf, unsigned int nbyte)
 {
   register int rtnval;
 
@@ -2507,10 +2111,7 @@ emacs_read (fildes, buf, nbyte)
 }
 
 int
-emacs_write (fildes, buf, nbyte)
-     int fildes;
-     const char *buf;
-     unsigned int nbyte;
+emacs_write (int fildes, const char *buf, unsigned int nbyte)
 {
   register int rtnval, bytes_written;
 
@@ -2571,11 +2172,10 @@ emacs_write (fildes, buf, nbyte)
 #ifndef HAVE_GETWD
 
 char *
-getwd (pathname)
-     char *pathname;
+getwd (char *pathname)
 {
   char *npath, *spath;
-  extern char *getcwd ();
+  extern char *getcwd (char *, size_t);
 
   BLOCK_INPUT;                 /* getcwd uses malloc */
   spath = npath = getcwd ((char *) 0, MAXPATHLEN);
@@ -2604,9 +2204,8 @@ getwd (pathname)
 
 #ifndef HAVE_RENAME
 
-rename (from, to)
-     const char *from;
-     const char *to;
+int
+rename (const char *from, const char *to)
 {
   if (access (from, 0) == 0)
     {
@@ -2626,7 +2225,8 @@ rename (from, to)
 /* HPUX curses library references perror, but as far as we know
    it won't be called.  Anyway this definition will do for now.  */
 
-perror ()
+void
+perror (void)
 {
 }
 #endif /* HPUX and not HAVE_PERROR */
@@ -2639,9 +2239,8 @@ perror ()
  *     until we are, then close the unsuccessful ones.
  */
 
-dup2 (oldd, newd)
-     int oldd;
-     int newd;
+int
+dup2 (int oldd, int newd)
 {
   register int fd, ret;
 
@@ -2669,17 +2268,14 @@ dup2 (oldd, newd)
  *     Only needed when subprocesses are defined.
  */
 
-#ifdef subprocesses
 #ifndef HAVE_GETTIMEOFDAY
 #ifdef HAVE_TIMEVAL
 
 /* ARGSUSED */
 int
-gettimeofday (tp, tzp)
-     struct timeval *tp;
-     struct timezone *tzp;
+gettimeofday (struct timeval *tp, struct timezone *tzp)
 {
-  extern long time ();
+  extern long time (long);
 
   tp->tv_sec = time ((long *)0);
   tp->tv_usec = 0;
@@ -2689,16 +2285,14 @@ gettimeofday (tp, tzp)
 }
 
 #endif
-#endif
-#endif /* subprocess && !HAVE_GETTIMEOFDAY && HAVE_TIMEVAL */
+#endif /* !HAVE_GETTIMEOFDAY && HAVE_TIMEVAL */
 
 /*
  *     This function will go away as soon as all the stubs fixed. (fnf)
  */
 
 void
-croak (badfunc)
-     char *badfunc;
+croak (char *badfunc)
 {
   printf ("%s not yet implemented\r\n", badfunc);
   reset_all_sys_modes ();
@@ -2709,7 +2303,7 @@ croak (badfunc)
 \f
 /* Directory routines for systems that don't have them. */
 
-#ifdef SYSV_SYSTEM_DIR
+#ifdef HAVE_DIRENT_H
 
 #include <dirent.h>
 
@@ -2721,25 +2315,16 @@ closedir (DIR *dirp /* stream from opendir */)
   int rtnval;
 
   rtnval = emacs_close (dirp->dd_fd);
-
-  /* Some systems (like Solaris) allocate the buffer and the DIR all
-     in one block.  Why in the world are we freeing this ourselves
-     anyway?  */
-#if ! defined (SOLARIS2)
-  xfree ((char *) dirp->dd_buf); /* directory block defined in <dirent.h> */
-#endif
   xfree ((char *) dirp);
 
   return rtnval;
 }
 #endif /* not HAVE_CLOSEDIR */
-#endif /* SYSV_SYSTEM_DIR */
+#endif /* HAVE_DIRENT_H */
 
 \f
 int
-set_file_times (filename, atime, mtime)
-     const char *filename;
-     EMACS_TIME atime, mtime;
+set_file_times (const char *filename, EMACS_TIME atime, EMACS_TIME mtime)
 {
 #ifdef HAVE_UTIMES
   struct timeval tv[2];
@@ -2776,9 +2361,7 @@ set_file_times (filename, atime, mtime)
  * Make a directory.
  */
 int
-mkdir (dpath, dmode)
-     char *dpath;
-     int dmode;
+mkdir (char *dpath, int dmode)
 {
   int cpid, status, fd;
   struct stat statbuf;
@@ -2836,8 +2419,7 @@ mkdir (dpath, dmode)
 
 #ifndef HAVE_RMDIR
 int
-rmdir (dpath)
-     char *dpath;
+rmdir (char *dpath)
 {
   int cpid, status, fd;
   struct stat statbuf;
@@ -2882,58 +2464,62 @@ rmdir (dpath)
 #endif /* !HAVE_RMDIR */
 
 \f
-#ifndef BSTRING
-
-#ifndef bzero
-
-void
-bzero (b, length)
-     register char *b;
-     register int length;
+#ifndef HAVE_MEMSET
+void *
+memset (void *b, int n, size_t length)
 {
+  unsigned char *p = b;
   while (length-- > 0)
-    *b++ = 0;
+    *p++ = n;
+  return b;
 }
+#endif /* !HAVE_MEMSET */
 
-#endif /* no bzero */
-#endif /* BSTRING */
-
-#if (!defined (BSTRING) && !defined (bcopy)) || defined (NEED_BCOPY)
-#undef bcopy
-
-/* Saying `void' requires a declaration, above, where bcopy is used
-   and that declaration causes pain for systems where bcopy is a macro.  */
-bcopy (b1, b2, length)
-     register char *b1;
-     register char *b2;
-     register int length;
+#ifndef HAVE_MEMCPY
+void *
+memcpy (void *b1, void *b2, size_t length)
 {
+  unsigned char *p1 = b1, *p2 = b2;
   while (length-- > 0)
-    *b2++ = *b1++;
+    *p1++ = *p2++;
+  return b1;
 }
-#endif /* (!defined (BSTRING) && !defined (bcopy)) || defined (NEED_BCOPY) */
+#endif /* !HAVE_MEMCPY */
 
-#ifndef BSTRING
-#ifndef bcmp
+#ifndef HAVE_MEMMOVE
+void *
+memmove (void *b1, void *b2, size_t length)
+{
+  unsigned char *p1 = b1, *p2 = b2;
+  if (p1 < p2 || p1 >= p2 + length)
+    while (length-- > 0)
+      *p1++ = *p2++;
+  else
+    {
+      p1 += length;
+      p2 += length;
+      while (length-- > 0)
+       *--p1 = *--p2;
+    }
+  return b1;
+}
+#endif /* !HAVE_MEMCPY */
+
+#ifndef HAVE_MEMCMP
 int
-bcmp (b1, b2, length)  /* This could be a macro! */
-     register char *b1;
-     register char *b2;
-     register int length;
+memcmp (void *b1, void *b2, size_t length)
 {
+  unsigned char *p1 = b1, *p2 = b2;
   while (length-- > 0)
-    if (*b1++ != *b2++)
-      return 1;
-
+    if (*p1++ != *p2++)
+      return p1[-1] < p2[-1] ? -1 : 1;
   return 0;
 }
-#endif /* no bcmp */
-#endif /* not BSTRING */
+#endif /* !HAVE_MEMCMP */
 \f
 #ifndef HAVE_STRSIGNAL
 char *
-strsignal (code)
-     int code;
+strsignal (int code)
 {
   char *signame = 0;
 
@@ -2947,9 +2533,10 @@ strsignal (code)
 }
 #endif /* HAVE_STRSIGNAL */
 \f
-#ifdef HAVE_TERMIOS
+#ifndef DOS_NT
 /* For make-serial-process  */
-int serial_open (char *port)
+int
+serial_open (char *port)
 {
   int fd = -1;
 
@@ -2975,14 +2562,12 @@ int serial_open (char *port)
 
   return fd;
 }
-#endif /* TERMIOS  */
-
-#ifdef HAVE_TERMIOS
 
 #if !defined (HAVE_CFMAKERAW)
 /* Workaround for targets which are missing cfmakeraw.  */
 /* Pasted from man page.  */
-static void cfmakeraw (struct termios *termios_p)
+static void
+cfmakeraw (struct termios *termios_p)
 {
     termios_p->c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
     termios_p->c_oflag &= ~OPOST;
@@ -2994,7 +2579,8 @@ static void cfmakeraw (struct termios *termios_p)
 
 #if !defined (HAVE_CFSETSPEED)
 /* Workaround for targets which are missing cfsetspeed.  */
-static int cfsetspeed (struct termios *termios_p, speed_t vitesse)
+static int
+cfsetspeed (struct termios *termios_p, speed_t vitesse)
 {
   return (cfsetispeed (termios_p, vitesse)
          + cfsetospeed (termios_p, vitesse));
@@ -3004,7 +2590,7 @@ static int cfsetspeed (struct termios *termios_p, speed_t vitesse)
 /* For serial-process-configure  */
 void
 serial_configure (struct Lisp_Process *p,
-                     Lisp_Object contact)
+                 Lisp_Object contact)
 {
   Lisp_Object childp2 = Qnil;
   Lisp_Object tem = Qnil;
@@ -3047,7 +2633,7 @@ serial_configure (struct Lisp_Process *p,
   CHECK_NUMBER (tem);
   if (XINT (tem) != 7 && XINT (tem) != 8)
     error (":bytesize must be nil (8), 7, or 8");
-  summary[0] = XINT(tem) + '0';
+  summary[0] = XINT (tem) + '0';
 #if defined (CSIZE) && defined (CS7) && defined (CS8)
   attr.c_cflag &= ~CSIZE;
   attr.c_cflag |= ((XINT (tem) == 7) ? CS7 : CS8);
@@ -3162,7 +2748,7 @@ serial_configure (struct Lisp_Process *p,
   p->childp = childp2;
 
 }
-#endif /* TERMIOS  */
+#endif /* not DOS_NT  */
 \f
 /* System depended enumeration of and access to system processes a-la ps(1).  */
 
@@ -3171,7 +2757,7 @@ serial_configure (struct Lisp_Process *p,
 /* Process enumeration and access via /proc.  */
 
 Lisp_Object
-list_system_processes ()
+list_system_processes (void)
 {
   Lisp_Object procdir, match, proclist, next;
   struct gcpro gcpro1, gcpro2;
@@ -3205,7 +2791,7 @@ list_system_processes ()
 #elif !defined (WINDOWSNT) && !defined (MSDOS)
 
 Lisp_Object
-list_system_processes ()
+list_system_processes (void)
 {
   return Qnil;
 }
@@ -3365,7 +2951,7 @@ system_process_attributes (Lisp_Object pid)
   unsigned long minflt, majflt, cminflt, cmajflt, vsize;
   time_t sec;
   unsigned usec;
-  EMACS_TIME tnow, tstart, tboot, telapsed,ttotal;
+  EMACS_TIME tnow, tstart, tboot, telapsed;
   double pcpu, pmem;
   Lisp_Object attrs = Qnil;
   Lisp_Object cmd_str, decoded_cmd, tem;
@@ -3404,7 +2990,7 @@ system_process_attributes (Lisp_Object pid)
   procfn_end = fn + strlen (fn);
   strcpy (procfn_end, "/stat");
   fd = emacs_open (fn, O_RDONLY, 0);
-  if (fd >= 0 && (nread = emacs_read (fd, procbuf, sizeof(procbuf) - 1)) > 0)
+  if (fd >= 0 && (nread = emacs_read (fd, procbuf, sizeof (procbuf) - 1)) > 0)
     {
       procbuf[nread] = '\0';
       p = procbuf;
@@ -3665,7 +3251,7 @@ system_process_attributes (Lisp_Object pid)
   strcpy (procfn_end, "/psinfo");
   fd = emacs_open (fn, O_RDONLY, 0);
   if (fd >= 0
-      && (nread = read (fd, (char*)&pinfo, sizeof(struct psinfo)) > 0))
+      && (nread = read (fd, (char*)&pinfo, sizeof (struct psinfo)) > 0))
     {
           attrs = Fcons (Fcons (Qppid, make_fixnum_or_float (pinfo.pr_ppid)), attrs);
          attrs = Fcons (Fcons (Qpgrp, make_fixnum_or_float (pinfo.pr_pgid)), attrs);
index ddb3e91f2e316d72b1b739330b6bedfff19a4f96..0c90814390ccee37aea7f1b8b0cad510171f7ac3 100644 (file)
@@ -27,6 +27,10 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #endif
 #endif
 
+/* The w32 build defines select stuff in w32.h, which is included
+   where w32 needs it, but not where sysselect.h is included.  The w32
+   definitions in w32.h are incompatible with the below.  */
+#ifndef WINDOWSNT
 #ifdef FD_SET
 #ifdef FD_SETSIZE
 #define MAXDESC FD_SETSIZE
@@ -44,6 +48,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #define FD_ISSET(n, p) (*(p) & (1 << (n)))
 #define FD_ZERO(p) (*(p) = 0)
 #endif /* no FD_SET */
+#endif /* not WINDOWSNT */
 
 #if !defined (HAVE_SELECT)
 #define select sys_select
index 64dacc671ced6c96391ddd95dd654565ce7e63f3..48eb722935335a0740adebaefbeda79cf90bfe34 100644 (file)
@@ -17,7 +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/>.  */
 
-extern void init_signals P_ ((void));
+extern void init_signals (void);
 
 #if defined (HAVE_GTK_AND_PTHREAD) || defined (HAVE_NS)
 #include <pthread.h>
@@ -26,12 +26,6 @@ extern void init_signals P_ ((void));
 #define FORWARD_SIGNAL_TO_MAIN_THREAD
 #endif
 
-#ifdef FORWARD_SIGNAL_TO_MAIN_THREAD
-extern pthread_t main_thread;
-#endif
-
-#ifdef POSIX_SIGNALS
-
 /* Don't #include <signal.h>.  That header should always be #included
    before "config.h", because some configuration files (like s/hpux.h)
    indicate that SIGIO doesn't work by #undef-ing SIGIO.  If this file
@@ -71,78 +65,20 @@ extern sigset_t sys_sigmask ();
 #ifndef sigsetmask
 #define sigsetmask(SIG)  sys_sigsetmask (SIG)
 #endif
-#define sighold(SIG)     ONLY_USED_IN_BSD_4_1
-#define sigrelse(SIG)    ONLY_USED_IN_BSD_4_1
 #undef signal
 #define signal(SIG,ACT)      sys_signal(SIG,ACT)
 
 /* Whether this is what all systems want or not, this is what
    appears to be assumed in the source, for example data.c:arith_error.  */
-typedef RETSIGTYPE (*signal_handler_t) (/*int*/);
+typedef RETSIGTYPE (*signal_handler_t) (int);
 
-signal_handler_t sys_signal P_ ((int signal_number, signal_handler_t action));
-sigset_t sys_sigblock   P_ ((sigset_t new_mask));
-sigset_t sys_sigunblock P_ ((sigset_t new_mask));
-sigset_t sys_sigsetmask P_ ((sigset_t new_mask));
+signal_handler_t sys_signal (int signal_number, signal_handler_t action);
+sigset_t sys_sigblock   (sigset_t new_mask);
+sigset_t sys_sigunblock (sigset_t new_mask);
+sigset_t sys_sigsetmask (sigset_t new_mask);
 
 #define sys_sigdel(MASK,SIG) sigdelset (&MASK,SIG)
 
-#else /* ! defined (POSIX_SIGNALS) */
-#ifdef USG5_4
-
-extern SIGMASKTYPE sigprocmask_set;
-
-#ifndef sigblock
-#define sigblock(sig)                                  \
-     (sigprocmask_set = SIGEMPTYMASK | (sig),          \
-      sigprocmask (SIG_BLOCK, &sigprocmask_set, NULL))
-#endif
-
-#ifndef sigunblock
-#define sigunblock(sig)                                                \
-     (sigprocmask_set = SIGFULLMASK & ~(sig),                  \
-      sigprocmask (SIG_SETMASK, &sigprocmask_set, NULL))
-#endif
-
-#else
-#ifdef USG
-
-#ifndef sigunblock
-#define sigunblock(sig)
-#endif
-
-#else
-
-#ifndef sigunblock
-#define sigunblock(SIG) \
-{ SIGMASKTYPE omask = sigblock (SIGEMPTYMASK); sigsetmask (omask & ~SIG); }
-#endif
-
-#endif /* ! defined (USG) */
-#endif /* ! defined (USG5_4) */
-#endif /* ! defined (POSIX_SIGNALS) */
-
-#ifndef SIGMASKTYPE
-#define SIGMASKTYPE int
-#endif
-
-#ifndef SIGEMPTYMASK
-#define SIGEMPTYMASK (0)
-#endif
-
-#ifndef SIGFULLMASK
-#define SIGFULLMASK (0xffffffff)
-#endif
-
-#ifndef sigmask
-#define sigmask(no) (1L << ((no) - 1))
-#endif
-
-#ifndef sigunblock
-#define sigunblock(SIG) \
-{ SIGMASKTYPE omask = sigblock (SIGFULLMASK); sigsetmask (omask & ~SIG); }
-#endif
-
 #define sigfree() sigsetmask (SIGEMPTYMASK)
 
 #if defined (SIGINFO) && defined (BROKEN_SIGINFO)
@@ -150,9 +86,6 @@ extern SIGMASKTYPE sigprocmask_set;
 #endif
 #if defined (SIGIO) && defined (BROKEN_SIGIO)
 # undef SIGIO
-# if defined (__Lynx__)
-# undef SIGPOLL /* Defined as SIGIO on LynxOS */
-# endif
 #endif
 #if defined (SIGPOLL) && defined (BROKEN_SIGPOLL)
 #undef SIGPOLL
@@ -200,10 +133,11 @@ extern SIGMASKTYPE sigprocmask_set;
 
 #ifndef HAVE_STRSIGNAL
 /* strsignal is in sysdep.c */
-char *strsignal ();
+char *strsignal (int);
 #endif
 
 #ifdef FORWARD_SIGNAL_TO_MAIN_THREAD
+extern pthread_t main_thread;
 #define SIGNAL_THREAD_CHECK(signo)                                      \
   do {                                                                  \
     if (!pthread_equal (pthread_self (), main_thread))                 \
index 2f8d35805a464e65ce62f0cc0fb1d0751bbf3b60..9f6a907a9c21bad82e107586d16817ae2bc763b1 100644 (file)
@@ -136,17 +136,20 @@ extern time_t timezone;
 #define EMACS_SET_SECS_USECS(time, secs, usecs)                \
   (EMACS_SET_SECS (time, secs), EMACS_SET_USECS (time, usecs))
 
-extern int set_file_times __P ((const char *, EMACS_TIME, EMACS_TIME));
+extern int set_file_times (const char *, EMACS_TIME, EMACS_TIME);
 
 /* defined in keyboard.c */
-extern void set_waiting_for_input __P ((EMACS_TIME *));
+extern void set_waiting_for_input (EMACS_TIME *);
 
 /* When lisp.h is not included Lisp_Object is not defined (this can
    happen when this files is used outside the src directory).
    Use GCPRO1 to determine if lisp.h was included.  */
 #ifdef GCPRO1
 /* defined in dired.c */
-extern Lisp_Object make_time __P ((time_t));
+extern Lisp_Object make_time (time_t);
+
+/* defined in editfns.c*/
+extern int lisp_time_argument (Lisp_Object, time_t *, int *);
 #endif
 
 /* Compare times T1 and T2.  Value is 0 if T1 and T2 are the same.
index 057f58f6064b096a59e20c71f5741007aed4c7ce..8c46411cedb3f1ec965f87311fb6940d56ec21b2 100644 (file)
@@ -17,45 +17,21 @@ 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_TERMIOS
-#define HAVE_TCATTR
-#endif
-
-\f
 /* Include the proper files.  */
-#ifdef HAVE_TERMIO
+#ifndef DOS_NT
 #ifndef NO_TERMIO
 #include <termio.h>
 #endif /* not NO_TERMIO */
-#ifndef INCLUDED_FCNTL
-#define INCLUDED_FCNTL
-#include <fcntl.h>
-#endif
-#else /* not HAVE_TERMIO */
-#ifdef HAVE_TERMIOS
-#ifndef NO_TERMIO
-#include <termio.h>
-#endif
 #include <termios.h>
-#define INCLUDED_FCNTL
 #include <fcntl.h>
-#else /* neither HAVE_TERMIO nor HAVE_TERMIOS */
-#ifndef DOS_NT
-#include <sgtty.h>
 #endif /* not DOS_NT */
-#endif /* not HAVE_TERMIOS */
-#endif /* not HAVE_TERMIO */
 
-#ifdef __GNU_LIBRARY__
+#ifdef HAVE_SYS_IOCTL_H
 #include <sys/ioctl.h>
-#include <termios.h>
 #endif
 
-#ifdef NEED_BSDTTY
+#ifdef HPUX
 #include <sys/bsdtty.h>
-#endif
-
-#if defined (HPUX) && defined (HAVE_PTYS)
 #include <sys/ptyio.h>
 #endif
 
@@ -63,7 +39,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <sys/pty.h>
 #endif /* AIX */
 
-#if (defined (POSIX) || defined (NEED_UNISTD_H)) && defined (HAVE_UNISTD_H)
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 
@@ -81,17 +57,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #undef SIGIO
 #endif
 
-/* On TERMIOS systems, the tcmumbleattr calls take care of these
-   parameters, and it's a bad idea to use them (on AIX, it makes the
-   tty hang for a long time).  */
-#if defined (TIOCGLTC) && !defined (HAVE_TERMIOS)
-#define HAVE_LTCHARS
-#endif
-
-#if defined (TIOCGETC) && !defined (HAVE_TERMIOS)
-#define HAVE_TCHARS
-#endif
-
 \f
 /* Try to establish the correct character to disable terminal functions
    in a system-independent manner.  Note that USG (at least) define
@@ -118,60 +83,19 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #define EMACS_OUTQSIZE(fd, size) (ioctl ((fd), TIOCOUTQ, (size)))
 #endif
 
-#ifdef HAVE_TERMIO
-#ifdef TCOUTQ
-#undef EMACS_OUTQSIZE
-#define EMACS_OUTQSIZE(fd, size) (ioctl ((fd), TCOUTQ, (size)))
-#endif
-#endif
-
 \f
 /* Manipulate a terminal's current process group.  */
 
-/* EMACS_HAVE_TTY_PGRP is true if we can get and set the tty's current
-   controlling process group.
-
-   EMACS_GET_TTY_PGRP(int FD, int *PGID) sets *PGID the terminal FD's
+/* EMACS_GET_TTY_PGRP(int FD, int *PGID) sets *PGID the terminal FD's
    current process group.  Return -1 if there is an error.
 
    EMACS_SET_TTY_PGRP(int FD, int *PGID) sets the terminal FD's
    current process group to *PGID.  Return -1 if there is an error.  */
 
-/* HPUX tty process group stuff doesn't work, says the anonymous voice
-   from the past.  */
-#ifndef HPUX
-#ifdef TIOCGPGRP
-#define EMACS_HAVE_TTY_PGRP
-#else
-#ifdef HAVE_TERMIOS
-#define EMACS_HAVE_TTY_PGRP
-#endif /* HAVE_TERMIOS */
-#endif /* TIOCGPGRP */
-#endif /* not HPUX */
-
-#ifdef EMACS_HAVE_TTY_PGRP
-
-#if defined (HAVE_TERMIOS)
-
+#ifndef DOS_NT
 #define EMACS_GET_TTY_PGRP(fd, pgid) (*(pgid) = tcgetpgrp ((fd)))
 #define EMACS_SET_TTY_PGRP(fd, pgid) (tcsetpgrp ((fd), *(pgid)))
-
-#else /* not HAVE_TERMIOS */
-#ifdef TIOCSPGRP
-
-#define EMACS_GET_TTY_PGRP(fd, pgid) (ioctl ((fd), TIOCGPGRP, (pgid)))
-#define EMACS_SET_TTY_PGRP(fd, pgid) (ioctl ((fd), TIOCSPGRP, (pgid)))
-
-#endif /* TIOCSPGRP */
-#endif /* HAVE_TERMIOS */
-
-#else /* not EMACS_SET_TTY_PGRP */
-
-/* Just ignore this for now and hope for the best */
-#define EMACS_GET_TTY_PGRP(fd, pgid) 0
-#define EMACS_SET_TTY_PGRP(fd, pgif) 0
-
-#endif /* not EMACS_SET_TTY_PGRP */
+#endif /* not DOS_NT */
 
 /* EMACS_GETPGRP (arg) returns the process group of the process.  */
 
@@ -214,32 +138,11 @@ struct emacs_tty {
 
 /* There is always one of the following elements, so there is no need
    for dummy get and set definitions.  */
-#ifdef HAVE_TCATTR
+#ifndef DOS_NT
   struct termios main;
-#else /* not HAVE_TCATTR */
-#ifdef HAVE_TERMIO
-  struct termio main;
-#else /* not HAVE_TERMIO */
-#ifdef DOS_NT
+#else /* DOS_NT */
   int main;
-#else  /* not DOS_NT */
-  struct sgttyb main;
-#endif /* not DOS_NT */
-#endif /* not HAVE_TERMIO */
-#endif /* not HAVE_TCATTR */
-
-/* If we have TERMIOS, we don't need to do this - they're taken care of
-   by the tc*attr calls.  */
-#ifndef HAVE_TERMIOS
-#ifdef HAVE_LTCHARS
-  struct ltchars ltchars;
-#endif /* HAVE_LTCHARS */
-
-#ifdef HAVE_TCHARS
-  struct tchars tchars;
-  int lmode;
-#endif /* HAVE_TCHARS */
-#endif /* not defined HAVE_TERMIOS */
+#endif /* DOS_NT */
 };
 \f
 /* Define EMACS_GET_TTY and EMACS_SET_TTY,
@@ -250,15 +153,13 @@ struct emacs_tty {
    expression, so we moved them out to their own functions in sysdep.c.  */
 #define EMACS_GET_TTY(fd, p)        (emacs_get_tty ((fd), (p)))
 #define EMACS_SET_TTY(fd, p, waitp) (emacs_set_tty ((fd), (p), (waitp)))
-#ifdef P_  /* Unfortunately this file is sometimes included before lisp.h */
-extern int emacs_get_tty P_ ((int, struct emacs_tty *));
-extern int emacs_set_tty P_ ((int, struct emacs_tty *, int));
-#endif
+extern int emacs_get_tty (int, struct emacs_tty *);
+extern int emacs_set_tty (int, struct emacs_tty *, int);
 
 \f
 /* Define EMACS_TTY_TABS_OK.  */
 
-#ifdef HAVE_TERMIOS
+#ifndef DOS_NT
 
 #ifdef TABDLY
 #define EMACS_TTY_TABS_OK(p) (((p)->main.c_oflag & TABDLY) != TAB3)
@@ -266,21 +167,9 @@ extern int emacs_set_tty P_ ((int, struct emacs_tty *, int));
 #define EMACS_TTY_TABS_OK(p) 1
 #endif /* not TABDLY */
 
-#else /* not def HAVE_TERMIOS */
-#ifdef HAVE_TERMIO
-
-#define EMACS_TTY_TABS_OK(p) (((p)->main.c_oflag & TABDLY) != TAB3)
-
-#else /* neither HAVE_TERMIO nor HAVE_TERMIOS */
-
-#ifdef DOS_NT
+#else /* DOS_NT */
 #define EMACS_TTY_TABS_OK(p) 0
-#else /* not DOS_NT */
-#define EMACS_TTY_TABS_OK(p) (((p)->main.sg_flags & XTABS) != XTABS)
-#endif /* not DOS_NT */
-
-#endif /* not def HAVE_TERMIO */
-#endif /* not def HAVE_TERMIOS */
+#endif /* DOS_NT */
 
 /* arch-tag: cf4b90bc-be41-401c-be98-40619178a712
    (do not change this comment) */
index b67d93f5b5b2e49c7b7aa6063b1f42845b4c2c4b..f090cdd27923ceb1bda02bf55771a577a99366b0 100644 (file)
@@ -31,8 +31,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <unistd.h>
 #endif
 
-#if HAVE_TERMIOS_H
-#include <termios.h>           /* For TIOCNOTTY. */
+#ifdef HAVE_SYS_IOCTL_H
+#include <sys/ioctl.h>
 #endif
 
 #include <signal.h>
@@ -66,15 +66,10 @@ static int been_here = -1;
 /* For now, don't try to include termcap.h.  On some systems,
    configure finds a non-standard termcap.h that the main build
    won't find.  */
-
-#if defined HAVE_TERMCAP_H && 0
-#include <termcap.h>
-#else
-extern void tputs P_ ((const char *, int, int (*)(int)));
-extern int tgetent P_ ((char *, const char *));
-extern int tgetflag P_ ((char *id));
-extern int tgetnum P_ ((char *id));
-#endif
+extern void tputs (const char *, int, int (*)(int));
+extern int tgetent (char *, const char *);
+extern int tgetflag (char *id);
+extern int tgetnum (char *id);
 
 #include "cm.h"
 #ifdef HAVE_X_WINDOWS
@@ -96,16 +91,20 @@ extern int tgetnum P_ ((char *id));
 #define DEV_TTY  "/dev/tty"
 #endif
 
-static void tty_set_scroll_region P_ ((struct frame *f, int start, int stop));
-static void turn_on_face P_ ((struct frame *, int face_id));
-static void turn_off_face P_ ((struct frame *, int face_id));
-static void tty_show_cursor P_ ((struct tty_display_info *));
-static void tty_hide_cursor P_ ((struct tty_display_info *));
-static void tty_background_highlight P_ ((struct tty_display_info *tty));
-static void clear_tty_hooks P_ ((struct terminal *terminal));
-static void set_tty_hooks P_ ((struct terminal *terminal));
-static void dissociate_if_controlling_tty P_ ((int fd));
-static void delete_tty P_ ((struct terminal *));
+static void tty_set_scroll_region (struct frame *f, int start, int stop);
+static void turn_on_face (struct frame *, int face_id);
+static void turn_off_face (struct frame *, int face_id);
+static void tty_show_cursor (struct tty_display_info *);
+static void tty_hide_cursor (struct tty_display_info *);
+static void tty_background_highlight (struct tty_display_info *tty);
+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;
+static void vfatal (const char *str, va_list ap) NO_RETURN;
+
 
 #define OUTPUT(tty, a)                                          \
   emacs_tputs ((tty), a,                                        \
@@ -133,8 +132,6 @@ static int visible_cursor;
 
 /* Display space properties */
 
-extern Lisp_Object Qspace, QCalign_to, QCwidth;
-
 /* Functions to call after suspending a tty. */
 Lisp_Object Vsuspend_tty_functions;
 
@@ -184,15 +181,15 @@ static int no_controlling_tty;
 
 static int system_uses_terminfo;
 
-char *tparam ();
+char *tparam (char *, char *, int, int, ...);
 
-extern char *tgetstr ();
+extern char *tgetstr (char *, char **);
 \f
 
 #ifdef HAVE_GPM
 #include <sys/fcntl.h>
 
-static void term_clear_mouse_face ();
+static void term_clear_mouse_face (void);
 static void term_mouse_highlight (struct frame *f, int x, int y);
 
 /* The device for which we have enabled gpm support (or NULL).  */
@@ -563,10 +560,7 @@ static int encode_terminal_dst_size;
    sequence, and return a pointer to that byte sequence.  */
 
 unsigned char *
-encode_terminal_code (src, src_len, coding)
-     struct glyph *src;
-     int src_len;
-     struct coding_system *coding;
+encode_terminal_code (struct glyph *src, int src_len, struct coding_system *coding)
 {
   struct glyph *src_end = src + src_len;
   unsigned char *buf;
@@ -717,7 +711,7 @@ encode_terminal_code (src, src_len, coding)
            }
          else
            {
-             unsigned char *p = SDATA (string), *pend = p + SBYTES (string);
+             unsigned char *p = SDATA (string);
 
              if (! STRING_MULTIBYTE (string))
                string = string_to_multibyte (string);
@@ -729,7 +723,7 @@ encode_terminal_code (src, src_len, coding)
                                                  encode_terminal_src_size);
                  buf = encode_terminal_src + nbytes;
                }
-             bcopy (SDATA (string), buf, SBYTES (string));
+             memcpy (buf, SDATA (string), SBYTES (string));
              buf += SBYTES (string);
              nchars += SCHARS (string);
            }
@@ -842,10 +836,8 @@ tty_write_glyphs (struct frame *f, struct glyph *string, int len)
 #ifdef HAVE_GPM                        /* Only used by GPM code.  */
 
 static void
-tty_write_glyphs_with_face (f, string, len, face_id)
-     register struct frame *f;
-     register struct glyph *string;
-     register int len, face_id;
+tty_write_glyphs_with_face (register struct frame *f, register struct glyph *string,
+                           register int len, register int face_id)
 {
   unsigned char *conversion_buffer;
   struct coding_system *coding;
@@ -1093,7 +1085,7 @@ tty_ins_del_lines (struct frame *f, int vpos, int n)
    not counting any line-dependent padding.  */
 
 int
-string_cost (char *str)
+string_cost (const char *str)
 {
   cost = 0;
   if (str)
@@ -1105,7 +1097,7 @@ string_cost (char *str)
    counting any line-dependent padding at one line.  */
 
 static int
-string_cost_one_line (char *str)
+string_cost_one_line (const char *str)
 {
   cost = 0;
   if (str)
@@ -1117,7 +1109,7 @@ string_cost_one_line (char *str)
    in tenths of characters.  */
 
 int
-per_line_cost (char *str)
+per_line_cost (const char *str)
 {
   cost = 0;
   if (str)
@@ -1128,7 +1120,6 @@ per_line_cost (char *str)
   return cost;
 }
 
-#ifndef old
 /* char_ins_del_cost[n] is cost of inserting N characters.
    char_ins_del_cost[-n] is cost of deleting N characters.
    The length of this vector is based on max_frame_cols.  */
@@ -1136,7 +1127,6 @@ per_line_cost (char *str)
 int *char_ins_del_vector;
 
 #define char_ins_del_cost(f) (&char_ins_del_vector[FRAME_COLS ((f))])
-#endif
 
 /* ARGSUSED */
 static void
@@ -1236,8 +1226,8 @@ calculate_costs (struct frame *frame)
           = (int *) xmalloc (sizeof (int)
                              + 2 * max_frame_cols * sizeof (int));
 
-      bzero (char_ins_del_vector, (sizeof (int)
-                                   + 2 * max_frame_cols * sizeof (int)));
+      memset (char_ins_del_vector, 0,
+             (sizeof (int) + 2 * max_frame_cols * sizeof (int)));
 
 
       if (f && (!tty->TS_ins_line && !tty->TS_del_line))
@@ -1274,7 +1264,7 @@ struct fkey_table {
      other keys (as on the IBM PC keyboard) they get overridden.
   */
 
-static struct fkey_table keys[] =
+static const struct fkey_table keys[] =
 {
   {"kh", "home"},      /* termcap */
   {"kl", "left"},      /* termcap */
@@ -1370,18 +1360,17 @@ static struct fkey_table keys[] =
   {"!3", "S-undo"}       /*shifted undo key*/
   };
 
+#ifndef DOS_NT
 static char **term_get_fkeys_address;
 static KBOARD *term_get_fkeys_kboard;
-static Lisp_Object term_get_fkeys_1 ();
+static Lisp_Object term_get_fkeys_1 (void);
 
 /* Find the escape codes sent by the function keys for Vinput_decode_map.
    This function scans the termcap function key sequence entries, and
    adds entries to Vinput_decode_map for each function key it finds.  */
 
 static void
-term_get_fkeys (address, kboard)
-     char **address;
-     KBOARD *kboard;
+term_get_fkeys (char **address, KBOARD *kboard)
 {
   /* We run the body of the function (term_get_fkeys_1) and ignore all Lisp
      errors during the call.  The only errors should be from Fdefine_key
@@ -1391,14 +1380,13 @@ term_get_fkeys (address, kboard)
      function key specification, rather than giving the user an error and
      refusing to run at all on such a terminal.  */
 
-  extern Lisp_Object Fidentity ();
   term_get_fkeys_address = address;
   term_get_fkeys_kboard = kboard;
   internal_condition_case (term_get_fkeys_1, Qerror, Fidentity);
 }
 
 static Lisp_Object
-term_get_fkeys_1 ()
+term_get_fkeys_1 (void)
 {
   int i;
 
@@ -1509,24 +1497,16 @@ term_get_fkeys_1 ()
 
   return Qnil;
 }
+#endif /* not DOS_NT */
 
 \f
 /***********************************************************************
                       Character Display Information
  ***********************************************************************/
-
-/* Avoid name clash with functions defined in xterm.c */
-#ifdef static
-#define append_glyph append_glyph_term
-#define produce_stretch_glyph produce_stretch_glyph_term
-#define append_composite_glyph append_composite_glyph_term
-#define produce_composite_glyph produce_composite_glyph_term
-#endif
-
-static void append_glyph P_ ((struct it *));
-static void produce_stretch_glyph P_ ((struct it *));
-static void append_composite_glyph P_ ((struct it *));
-static void produce_composite_glyph P_ ((struct it *));
+static void append_glyph (struct it *);
+static void produce_stretch_glyph (struct it *);
+static void append_composite_glyph (struct it *);
+static void produce_composite_glyph (struct it *);
 
 /* Append glyphs to IT's glyph_row.  Called from produce_glyphs for
    terminal frames if IT->glyph_row != NULL.  IT->char_to_display is
@@ -1535,8 +1515,7 @@ static void produce_composite_glyph P_ ((struct it *));
    IT->pixel_width > 1.  */
 
 static void
-append_glyph (it)
-     struct it *it;
+append_glyph (struct it *it)
 {
   struct glyph *glyph, *end;
   int i;
@@ -1546,6 +1525,26 @@ append_glyph (it)
           + it->glyph_row->used[it->area]);
   end = it->glyph_row->glyphs[1 + it->area];
 
+  /* If the glyph row is reversed, we need to prepend the glyph rather
+     than append it.  */
+  if (it->glyph_row->reversed_p && it->area == TEXT_AREA)
+    {
+      struct glyph *g;
+      int move_by = it->pixel_width;
+
+      /* Make room for the new glyphs.  */
+      if (move_by > end - glyph) /* don't overstep end of this area */
+       move_by = end - glyph;
+      for (g = glyph - 1; g >= it->glyph_row->glyphs[it->area]; g--)
+       g[move_by] = *g;
+      glyph = it->glyph_row->glyphs[it->area];
+      end = glyph + move_by;
+    }
+
+  /* BIDI Note: we put the glyphs of a "multi-pixel" character left to
+     right, even in the REVERSED_P case, since (a) all of its u.ch are
+     identical, and (b) the PADDING_P flag needs to be set for the
+     leftmost one, because we write to the terminal left-to-right.  */
   for (i = 0;
        i < it->pixel_width && glyph < end;
        ++i)
@@ -1557,13 +1556,24 @@ append_glyph (it)
       glyph->padding_p = i > 0;
       glyph->charpos = CHARPOS (it->position);
       glyph->object = it->object;
+      if (it->bidi_p)
+       {
+         glyph->resolved_level = it->bidi_it.resolved_level;
+         if ((it->bidi_it.type & 7) != it->bidi_it.type)
+           abort ();
+         glyph->bidi_type = it->bidi_it.type;
+       }
+      else
+       {
+         glyph->resolved_level = 0;
+         glyph->bidi_type = UNKNOWN_BT;
+       }
 
       ++it->glyph_row->used[it->area];
       ++glyph;
     }
 }
 
-
 /* Produce glyphs for the display element described by IT.  *IT
    specifies what we want to produce a glyph for (character, image, ...),
    and where in the glyph matrix we currently are (glyph row and hpos).
@@ -1584,8 +1594,7 @@ append_glyph (it)
    instead they use the macro PRODUCE_GLYPHS.  */
 
 void
-produce_glyphs (it)
-     struct it *it;
+produce_glyphs (struct it *it)
 {
   /* If a hook is installed, let it do the work.  */
 
@@ -1687,8 +1696,7 @@ produce_glyphs (it)
    to reach HPOS, a value in canonical character units.  */
 
 static void
-produce_stretch_glyph (it)
-     struct it *it;
+produce_stretch_glyph (struct it *it)
 {
   /* (space :width WIDTH ...)  */
   Lisp_Object prop, plist;
@@ -1757,8 +1765,7 @@ produce_stretch_glyph (it)
    face.  */
 
 static void
-append_composite_glyph (it)
-     struct it *it;
+append_composite_glyph (struct it *it)
 {
   struct glyph *glyph;
 
@@ -1766,6 +1773,17 @@ append_composite_glyph (it)
   glyph = it->glyph_row->glyphs[it->area] + it->glyph_row->used[it->area];
   if (glyph < it->glyph_row->glyphs[1 + it->area])
     {
+      /* If the glyph row is reversed, we need to prepend the glyph
+        rather than append it.  */
+      if (it->glyph_row->reversed_p && it->area == TEXT_AREA)
+       {
+         struct glyph *g;
+
+         /* Make room for the new glyph.  */
+         for (g = glyph - 1; g >= it->glyph_row->glyphs[it->area]; g--)
+           g[1] = *g;
+         glyph = it->glyph_row->glyphs[it->area];
+       }
       glyph->type = COMPOSITE_GLYPH;
       glyph->pixel_width = it->pixel_width;
       glyph->u.cmp.id = it->cmp_it.id;
@@ -1786,6 +1804,18 @@ append_composite_glyph (it)
       glyph->padding_p = 0;
       glyph->charpos = CHARPOS (it->position);
       glyph->object = it->object;
+      if (it->bidi_p)
+       {
+         glyph->resolved_level = it->bidi_it.resolved_level;
+         if ((it->bidi_it.type & 7) != it->bidi_it.type)
+           abort ();
+         glyph->bidi_type = it->bidi_it.type;
+       }
+      else
+       {
+         glyph->resolved_level = 0;
+         glyph->bidi_type = UNKNOWN_BT;
+       }
 
       ++it->glyph_row->used[it->area];
       ++glyph;
@@ -1799,11 +1829,8 @@ append_composite_glyph (it)
    correctly.  */
 
 static void
-produce_composite_glyph (it)
-     struct it *it;
+produce_composite_glyph (struct it *it)
 {
-  int c;
-
   if (it->cmp_it.ch < 0)
     {
       struct composition *cmp = composition_table[it->cmp_it.id];
@@ -1830,9 +1857,7 @@ produce_composite_glyph (it)
    face_id, c, len of IT are left untouched.  */
 
 void
-produce_special_glyphs (it, what)
-     struct it *it;
-     enum display_element_type what;
+produce_special_glyphs (struct it *it, enum display_element_type what)
 {
   struct it temp_it;
   Lisp_Object gc;
@@ -1843,16 +1868,20 @@ produce_special_glyphs (it, what)
   temp_it.what = IT_CHARACTER;
   temp_it.len = 1;
   temp_it.object = make_number (0);
-  bzero (&temp_it.current, sizeof temp_it.current);
+  memset (&temp_it.current, 0, sizeof temp_it.current);
 
   if (what == IT_CONTINUATION)
     {
-      /* Continuation glyph.  */
-      SET_GLYPH_FROM_CHAR (glyph, '\\');
+      /* 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);
        }
@@ -1865,6 +1894,7 @@ produce_special_glyphs (it, what)
          && (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);
        }
@@ -1901,9 +1931,7 @@ produce_special_glyphs (it, what)
    FACE_ID is a realized face ID number, in the face cache.  */
 
 static void
-turn_on_face (f, face_id)
-     struct frame *f;
-     int face_id;
+turn_on_face (struct frame *f, int face_id)
 {
   struct face *face = FACE_FROM_ID (f, face_id);
   long fg = face->foreground;
@@ -2000,9 +2028,7 @@ turn_on_face (f, face_id)
 /* Turn off appearances of face FACE_ID on tty frame F.  */
 
 static void
-turn_off_face (f, face_id)
-     struct frame *f;
-     int face_id;
+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);
@@ -2055,10 +2081,8 @@ turn_off_face (f, face_id)
    colors FG and BG.  */
 
 int
-tty_capable_p (tty, caps, fg, bg)
-     struct tty_display_info *tty;
-     unsigned caps;
-     unsigned long fg, bg;
+tty_capable_p (struct tty_display_info *tty, unsigned int caps,
+              unsigned long fg, unsigned long bg)
 {
 #define TTY_CAPABLE_P_TRY(tty, cap, TS, NC_bit)                                \
   if ((caps & (cap)) && (!(TS) || !MAY_USE_WITH_COLORS_P(tty, NC_bit)))        \
@@ -2084,8 +2108,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)
-     Lisp_Object terminal;
+  (Lisp_Object terminal)
 {
   struct terminal *t = get_tty_terminal (terminal, 0);
   if (!t)
@@ -2102,8 +2125,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)
-     Lisp_Object terminal;
+  (Lisp_Object terminal)
 {
   struct terminal *t = get_tty_terminal (terminal, 0);
   if (!t)
@@ -2198,14 +2220,11 @@ tty_setup_colors (struct tty_display_info *tty, int mode)
 }
 
 void
-set_tty_color_mode (tty, f)
-     struct tty_display_info *tty;
-     struct frame *f;
+set_tty_color_mode (struct tty_display_info *tty, struct frame *f)
 {
-  Lisp_Object tem, val, color_mode_spec;
+  Lisp_Object tem, val;
   Lisp_Object color_mode;
   int mode;
-  extern Lisp_Object Qtty_color_mode;
   Lisp_Object tty_color_mode_alist
     = Fintern_soft (build_string ("tty-color-mode-alist"), Qnil);
 
@@ -2214,12 +2233,13 @@ set_tty_color_mode (tty, f)
 
   if (INTEGERP (val))
     color_mode = val;
-  else
+  else if (SYMBOLP (tty_color_mode_alist))
     {
-      tem = (NILP (tty_color_mode_alist) ? Qnil
-            : Fassq (val, XSYMBOL (tty_color_mode_alist)->value));
+      tem = Fassq (val, Fsymbol_value (tty_color_mode_alist));
       color_mode = CONSP (tem) ? XCDR (tem) : Qnil;
     }
+  else
+    color_mode = Qnil;
 
   mode = INTEGERP (color_mode) ? XINT (color_mode) : 0;
 
@@ -2263,8 +2283,7 @@ get_tty_terminal (Lisp_Object terminal, int throw)
    Returns NULL if the named terminal device is not opened.  */
 
 struct terminal *
-get_named_tty (name)
-     char *name;
+get_named_tty (const char *name)
 {
   struct terminal *t;
 
@@ -2289,8 +2308,7 @@ Returns nil if TERMINAL is not on a tty device.
 
 TERMINAL can be a terminal object, a frame, or nil (meaning the
 selected frame's terminal).  */)
-     (terminal)
-     Lisp_Object terminal;
+  (Lisp_Object terminal)
 {
   struct terminal *t = get_terminal (terminal, 1);
 
@@ -2309,8 +2327,7 @@ DEFUN ("controlling-tty-p", Fcontrolling_tty_p, Scontrolling_tty_p, 0, 1, 0,
 TERMINAL can be a terminal object, a frame, or nil (meaning the
 selected frame's terminal).  This function always returns nil if
 TERMINAL is not on a tty device.  */)
-     (terminal)
-     Lisp_Object terminal;
+  (Lisp_Object terminal)
 {
   struct terminal *t = get_terminal (terminal, 1);
 
@@ -2330,8 +2347,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)
-     Lisp_Object terminal;
+  (Lisp_Object terminal)
 {
   struct terminal *t = get_terminal (terminal, 1);
 
@@ -2361,8 +2377,7 @@ terminal device.
 suspended.
 
 A suspended tty may be resumed by calling `resume-tty' on it.  */)
-     (tty)
-     Lisp_Object tty;
+  (Lisp_Object tty)
 {
   struct terminal *t = get_tty_terminal (tty, 1);
   FILE *f;
@@ -2386,10 +2401,7 @@ A suspended tty may be resumed by calling `resume-tty' on it.  */)
         }
 
       reset_sys_modes (t->display_info.tty);
-
-#ifdef subprocesses
       delete_keyboard_wait_descriptor (fileno (f));
-#endif
 
 #ifndef MSDOS
       fclose (f);
@@ -2428,8 +2440,7 @@ suspended.
 
 TTY may be a terminal object, a frame, or nil (meaning the selected
 frame's terminal). */)
-     (tty)
-     Lisp_Object tty;
+  (Lisp_Object tty)
 {
   struct terminal *t = get_tty_terminal (tty, 1);
   int fd;
@@ -2458,9 +2469,7 @@ frame's terminal). */)
       t->display_info.tty->input = t->display_info.tty->output;
 #endif
 
-#ifdef subprocesses
       add_keyboard_wait_descriptor (fd);
-#endif
 
       if (FRAMEP (t->display_info.tty->top_frame))
        {
@@ -2594,7 +2603,7 @@ term_show_mouse_face (enum draw_glyphs_face draw)
 }
 
 static void
-term_clear_mouse_face ()
+term_clear_mouse_face (void)
 {
   if (!NILP (mouse_face_window))
     term_show_mouse_face (DRAW_NORMAL_TEXT);
@@ -2754,7 +2763,6 @@ term_mouse_highlight (struct frame *f, int x, int y)
 
       /* Check for mouse-face.  */
       {
-       extern Lisp_Object Qmouse_face;
        Lisp_Object mouse_face, overlay, position, *overlay_vec;
        int noverlays, obegv, ozv;
        struct buffer *obuf;
@@ -2880,7 +2888,6 @@ term_mouse_highlight (struct frame *f, int x, int y)
        /* Look for a `help-echo' property.  */
        {
          Lisp_Object help;
-         extern Lisp_Object Qhelp_echo;
 
          /* Check overlays first.  */
          help = Qnil;
@@ -3101,7 +3108,7 @@ DEFUN ("gpm-mouse-start", Fgpm_mouse_start, Sgpm_mouse_start,
        0, 0, 0,
        doc: /* Open a connection to Gpm.
 Gpm-mouse can only be activated for one tty at a time.  */)
-     ()
+  (void)
 {
   struct frame *f = SELECTED_FRAME ();
   struct tty_display_info *tty
@@ -3149,7 +3156,7 @@ close_gpm (int fd)
 DEFUN ("gpm-mouse-stop", Fgpm_mouse_stop, Sgpm_mouse_stop,
        0, 0, 0,
        doc: /* Close a connection to Gpm.  */)
-     ()
+  (void)
 {
   struct frame *f = SELECTED_FRAME ();
   struct tty_display_info *tty
@@ -3182,7 +3189,7 @@ create_tty_output (struct frame *f)
     abort ();
 
   t = xmalloc (sizeof (struct tty_output));
-  bzero (t, sizeof (struct tty_output));
+  memset (t, 0, sizeof (struct tty_output));
 
   t->display_info = FRAME_TERMINAL (f)->display_info.tty;
 
@@ -3309,7 +3316,7 @@ dissociate_if_controlling_tty (int fd)
   EMACS_GET_TTY_PGRP (fd, &pgid); /* If tcgetpgrp succeeds, fd is the ctty. */
   if (pgid != -1)
     {
-#if defined (USG) && !defined (BSD_PGRPS)
+#if defined (USG5)
       setpgrp ();
       no_controlling_tty = 1;
 #elif defined (CYGWIN)
@@ -3335,8 +3342,6 @@ dissociate_if_controlling_tty (int fd)
 #endif /* !DOS_NT */
 }
 
-static void maybe_fatal();
-
 /* Create a termcap display on the tty device with the given name and
    type.
 
@@ -3349,7 +3354,7 @@ static void maybe_fatal();
    If MUST_SUCCEED is true, then all errors are fatal. */
 
 struct terminal *
-init_tty (char *name, char *terminal_type, int must_succeed)
+init_tty (const char *name, const char *terminal_type, int must_succeed)
 {
   char *area = NULL;
   char **address = &area;
@@ -3389,7 +3394,7 @@ init_tty (char *name, char *terminal_type, int must_succeed)
 #else
   tty = (struct tty_display_info *) xmalloc (sizeof (struct tty_display_info));
 #endif
-  bzero (tty, sizeof (struct tty_display_info));
+  memset (tty, 0, sizeof (struct tty_display_info));
   tty->next = tty_list;
   tty_list = tty;
 
@@ -3481,9 +3486,7 @@ init_tty (char *name, char *terminal_type, int must_succeed)
   terminal->name = xstrdup (name);
   tty->type = xstrdup (terminal_type);
 
-#ifdef subprocesses
   add_keyboard_wait_descriptor (0);
-#endif
 
   Wcm_clear (tty);
 
@@ -3551,25 +3554,18 @@ init_tty (char *name, char *terminal_type, int must_succeed)
     }
   if (status == 0)
     {
-#ifdef TERMINFO
       maybe_fatal (must_succeed, terminal,
                    "Terminal type %s is not defined",
                    "Terminal type %s is not defined.\n\
 If that is not the actual type of terminal you have,\n\
 use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
-`setenv TERM ...') to specify the correct type.  It may be necessary\n\
-to do `unset TERMINFO' (C-shell: `unsetenv TERMINFO') as well.",
-                   terminal_type);
+`setenv TERM ...') to specify the correct type.  It may be necessary\n"
+#ifdef TERMINFO
+"to do `unset TERMINFO' (C-shell: `unsetenv TERMINFO') as well.",
 #else
-      maybe_fatal (must_succeed, terminal,
-                   "Terminal type %s is not defined",
-                   "Terminal type %s is not defined.\n\
-If that is not the actual type of terminal you have,\n\
-use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
-`setenv TERM ...') to specify the correct type.  It may be necessary\n\
-to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
-                   terminal_type);
+"to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
 #endif
+                   terminal_type);
     }
 
 #ifndef TERMINFO
@@ -3715,7 +3711,7 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
 
   if (FrameRows (tty) < 3 || FrameCols (tty) < 3)
     maybe_fatal (must_succeed, terminal,
-                 "Screen size %dx%d is too small"
+                 "Screen size %dx%d is too small",
                  "Screen size %dx%d is too small",
                  FrameCols (tty), FrameRows (tty));
 
@@ -3836,20 +3832,15 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
     {
       maybe_fatal (must_succeed, terminal,
                    "Terminal type \"%s\" is not powerful enough to run Emacs",
-# ifdef TERMINFO
                    "Terminal type \"%s\" is not powerful enough to run Emacs.\n\
 It lacks the ability to position the cursor.\n\
 If that is not the actual type of terminal you have,\n\
 use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
-`setenv TERM ...') to specify the correct type.  It may be necessary\n\
-to do `unset TERMINFO' (C-shell: `unsetenv TERMINFO') as well.",
+`setenv TERM ...') to specify the correct type.  It may be necessary\n"
+# ifdef TERMINFO
+"to do `unset TERMINFO' (C-shell: `unsetenv TERMINFO') as well.",
 # else /* TERMCAP */
-                   "Terminal type \"%s\" is not powerful enough to run Emacs.\n\
-It lacks the ability to position the cursor.\n\
-If that is not the actual type of terminal you have,\n\
-use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
-`setenv TERM ...') to specify the correct type.  It may be necessary\n\
-to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
+"to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
 # endif /* TERMINFO */
                    terminal_type);
     }
@@ -3896,24 +3887,39 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
   return terminal;
 }
 
+
+static void
+vfatal (const char *str, va_list ap)
+{
+  fprintf (stderr, "emacs: ");
+  vfprintf (stderr, str, ap);
+  if (!(strlen (str) > 0 && str[strlen (str) - 1] == '\n'))
+    fprintf (stderr, "\n");
+  va_end (ap);
+  fflush (stderr);
+  exit (1);
+}
+
+
 /* Auxiliary error-handling function for init_tty.
    Delete TERMINAL, then call error or fatal with str1 or str2,
    respectively, according to MUST_SUCCEED.  */
 
 static void
-maybe_fatal (must_succeed, terminal, str1, str2, arg1, arg2)
-     int must_succeed;
-     struct terminal *terminal;
-     char *str1, *str2, *arg1, *arg2;
+maybe_fatal (int must_succeed, struct terminal *terminal,
+            const char *str1, const char *str2, ...)
 {
+  va_list ap;
+  va_start (ap, str2);
   if (terminal)
     delete_tty (terminal);
 
   if (must_succeed)
-    fatal (str2, arg1, arg2);
+    vfatal (str2, ap);
   else
-    error (str1, arg1, arg2);
+    verror (str1, ap);
 
+  va_end (ap);
   abort ();
 }
 
@@ -3922,13 +3928,8 @@ fatal (const char *str, ...)
 {
   va_list ap;
   va_start (ap, str);
-  fprintf (stderr, "emacs: ");
-  vfprintf (stderr, str, ap);
-  if (!(strlen (str) > 0 && str[strlen (str) - 1] == '\n'))
-    fprintf (stderr, "\n");
+  vfatal (str, ap);
   va_end (ap);
-  fflush (stderr);
-  exit (1);
 }
 
 \f
@@ -3977,9 +3978,7 @@ delete_tty (struct terminal *terminal)
 
   if (tty->input)
     {
-#ifdef subprocesses
       delete_keyboard_wait_descriptor (fileno (tty->input));
-#endif
       if (tty->input != stdin)
         fclose (tty->input);
     }
@@ -3993,7 +3992,7 @@ delete_tty (struct terminal *terminal)
   xfree (tty->termcap_strings_buffer);
   xfree (tty->termcap_term_buffer);
 
-  bzero (tty, sizeof (struct tty_display_info));
+  memset (tty, 0, sizeof (struct tty_display_info));
   xfree (tty);
 }
 
@@ -4014,7 +4013,7 @@ mark_ttys (void)
 \f
 
 void
-syms_of_term ()
+syms_of_term (void)
 {
   DEFVAR_BOOL ("system-uses-terminfo", &system_uses_terminfo,
     doc: /* Non-nil means the system uses terminfo rather than termcap.
index 9b4a7f657f6f46ca506ea9dd3766135dab41e36b..ea4ef244f641303879beb55c6c08bc9073f2e652 100644 (file)
@@ -18,12 +18,7 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 Boston, MA 02110-1301, USA.  */
 
 /* Emacs config.h may rename various library functions such as malloc.  */
-#ifdef HAVE_CONFIG_H
 #include <config.h>
-#endif
-
-#ifdef emacs
-
 #include <setjmp.h>
 #include <lisp.h>              /* xmalloc is here */
 /* Get the O_* definitions for open et al.  */
@@ -35,31 +30,6 @@ Boston, MA 02110-1301, USA.  */
 #include <unistd.h>
 #endif
 
-#else /* not emacs */
-
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#include <string.h>
-#else
-char *getenv ();
-char *malloc ();
-char *realloc ();
-#endif
-
-/* Do this after the include, in case string.h prototypes bcopy.  */
-#if (defined(HAVE_STRING_H) || defined(STDC_HEADERS)) && !defined(bcopy)
-#define bcopy(s, d, n) memcpy ((d), (s), (n))
-#endif
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
-
-#endif /* not emacs */
-
 #ifndef NULL
 #define NULL (char *) 0
 #endif
@@ -89,37 +59,6 @@ int bufsize = 128;
 #define TERMCAP_FILE "/etc/termcap"
 #endif
 
-#ifndef emacs
-static void
-memory_out ()
-{
-  write (2, "virtual memory exhausted\n", 25);
-  exit (1);
-}
-
-static char *
-xmalloc (size)
-     unsigned size;
-{
-  register char *tem = malloc (size);
-
-  if (!tem)
-    memory_out ();
-  return tem;
-}
-
-static char *
-xrealloc (ptr, size)
-     char *ptr;
-     unsigned size;
-{
-  register char *tem = realloc (ptr, size);
-
-  if (!tem)
-    memory_out ();
-  return tem;
-}
-#endif /* not emacs */
 \f
 /* Looking up capabilities in the entry already found.  */
 
@@ -127,15 +66,14 @@ xrealloc (ptr, size)
    for tgetnum, tgetflag and tgetstr to find.  */
 static char *term_entry;
 
-static char *tgetst1 ();
+static char *tgetst1 (char *ptr, char **area);
 
 /* Search entry BP for capability CAP.
    Return a pointer to the capability (in BP) if found,
    0 if not found.  */
 
 static char *
-find_capability (bp, cap)
-     register char *bp, *cap;
+find_capability (register char *bp, register char *cap)
 {
   for (; *bp; bp++)
     if (bp[0] == ':'
@@ -146,8 +84,7 @@ find_capability (bp, cap)
 }
 
 int
-tgetnum (cap)
-     char *cap;
+tgetnum (char *cap)
 {
   register char *ptr = find_capability (term_entry, cap);
   if (!ptr || ptr[-1] != '#')
@@ -156,8 +93,7 @@ tgetnum (cap)
 }
 
 int
-tgetflag (cap)
-     char *cap;
+tgetflag (char *cap)
 {
   register char *ptr = find_capability (term_entry, cap);
   return ptr && ptr[-1] == ':';
@@ -169,9 +105,7 @@ tgetflag (cap)
    If AREA is null, space is allocated with `malloc'.  */
 
 char *
-tgetstr (cap, area)
-     char *cap;
-     char **area;
+tgetstr (char *cap, char **area)
 {
   register char *ptr = find_capability (term_entry, cap);
   if (!ptr || (ptr[-1] != '=' && ptr[-1] != '~'))
@@ -209,9 +143,7 @@ static const char esctab[]
    or NULL if PTR is NULL.  */
 
 static char *
-tgetst1 (ptr, area)
-     char *ptr;
-     char **area;
+tgetst1 (char *ptr, char **area)
 {
   register char *p, *r;
   register int c;
@@ -322,7 +254,7 @@ tgetst1 (ptr, area)
 
        cut[last_p_param].len = r - cut[last_p_param].beg;
        for (i = 0, wp = ret; i <= last_p_param; wp += cut[i++].len)
-         bcopy (cut[i].beg, wp, cut[i].len);
+         memcpy (wp, cut[i].beg, cut[i].len);
        r = wp;
       }
   }
@@ -357,10 +289,7 @@ static const int speeds[] =
 #endif /* not emacs */
 
 void
-tputs (str, nlines, outfun)
-     register char *str;
-     int nlines;
-     register int (*outfun) ();
+tputs (register char *str, int nlines, register int (*outfun) (/* ??? */))
 {
   register int padcount = 0;
   register int speed;
@@ -432,10 +361,10 @@ struct termcap_buffer
 
 /* Forward declarations of static functions.  */
 
-static int scan_file ();
-static char *gobble_line ();
-static int compare_contin ();
-static int name_match ();
+static int scan_file (char *str, int fd, register struct termcap_buffer *bufp);
+static char *gobble_line (int fd, register struct termcap_buffer *bufp, char *append_end);
+static int compare_contin (register char *str1, register char *str2);
+static int name_match (char *line, char *name);
 
 #ifdef MSDOS /* MW, May 1993 */
 static int
@@ -460,8 +389,7 @@ valid_filename_p (fn)
    in it, and some other value otherwise.  */
 
 int
-tgetent (bp, name)
-     char *bp, *name;
+tgetent (char *bp, char *name)
 {
   register char *termcap_name;
   register int fd;
@@ -625,10 +553,7 @@ tgetent (bp, name)
    or 0 if no entry is found in the file.  */
 
 static int
-scan_file (str, fd, bufp)
-     char *str;
-     int fd;
-     register struct termcap_buffer *bufp;
+scan_file (char *str, int fd, register struct termcap_buffer *bufp)
 {
   register char *end;
 
@@ -665,8 +590,7 @@ scan_file (str, fd, bufp)
    by termcap entry LINE.  */
 
 static int
-name_match (line, name)
-     char *line, *name;
+name_match (char *line, char *name)
 {
   register char *tem;
 
@@ -681,8 +605,7 @@ name_match (line, name)
 }
 
 static int
-compare_contin (str1, str2)
-     register char *str1, *str2;
+compare_contin (register char *str1, register char *str2)
 {
   register int c1, c2;
   while (1)
@@ -722,10 +645,7 @@ compare_contin (str1, str2)
    thing as one line.  The caller decides when a line is continued.  */
 
 static char *
-gobble_line (fd, bufp, append_end)
-     int fd;
-     register struct termcap_buffer *bufp;
-     char *append_end;
+gobble_line (int fd, register struct termcap_buffer *bufp, char *append_end)
 {
   register char *end;
   register int nread;
@@ -758,7 +678,7 @@ gobble_line (fd, bufp, append_end)
       else
        {
          append_end -= bufp->ptr - buf;
-         bcopy (bufp->ptr, buf, bufp->full -= bufp->ptr - buf);
+         memcpy (buf, bufp->ptr, bufp->full -= bufp->ptr - buf);
          bufp->ptr = buf;
        }
       if (!(nread = read (fd, buf + bufp->full, bufp->size - bufp->full)))
index 2b4011627c83fb1f15c5f0863b8d61437a5a6206..7762dd15efe4bc6e7aa7727882a714324a891694 100644 (file)
@@ -39,7 +39,7 @@ enum scroll_bar_part {
 /* If the value of the frame parameter changed, whis hook is called.
    For example, if going from fullscreen to not fullscreen this hook
    may do something OS dependent, like extended window manager hints on X11.  */
-extern void (*fullscreen_hook) P_ ((struct frame *f));
+extern void (*fullscreen_hook) (struct frame *f);
 
 \f
 /* Input queue declarations and hooks.  */
@@ -255,7 +255,7 @@ struct input_event
   Lisp_Object arg;
 };
 
-#define EVENT_INIT(event) bzero (&(event), sizeof (struct input_event))
+#define EVENT_INIT(event) memset (&(event), 0, sizeof (struct input_event))
 
 /* Bits in the modifiers member of the input_event structure.
    Note that reorder_modifiers assumes that the bits are in canonical
@@ -415,28 +415,28 @@ struct terminal
 
   /* Text display hooks.  */
 
-  void (*cursor_to_hook) P_ ((struct frame *f, int vpos, int hpos));
-  void (*raw_cursor_to_hook) P_ ((struct frame *, int, int));
+  void (*cursor_to_hook) (struct frame *f, int vpos, int hpos);
+  void (*raw_cursor_to_hook) (struct frame *, int, int);
 
-  void (*clear_to_end_hook) P_ ((struct frame *));
-  void (*clear_frame_hook) P_ ((struct frame *));
-  void (*clear_end_of_line_hook) P_ ((struct frame *, int));
+  void (*clear_to_end_hook) (struct frame *);
+  void (*clear_frame_hook) (struct frame *);
+  void (*clear_end_of_line_hook) (struct frame *, int);
 
-  void (*ins_del_lines_hook) P_ ((struct frame *f, int, int));
+  void (*ins_del_lines_hook) (struct frame *f, int, int);
 
-  void (*insert_glyphs_hook) P_ ((struct frame *f, struct glyph *s, int n));
-  void (*write_glyphs_hook) P_ ((struct frame *f, struct glyph *s, int n));
-  void (*delete_glyphs_hook) P_ ((struct frame *, int));
+  void (*insert_glyphs_hook) (struct frame *f, struct glyph *s, int n);
+  void (*write_glyphs_hook) (struct frame *f, struct glyph *s, int n);
+  void (*delete_glyphs_hook) (struct frame *, int);
 
-  void (*ring_bell_hook) P_ ((struct frame *f));
-  void (*toggle_invisible_pointer_hook) P_ ((struct frame *f, int invisible));
+  void (*ring_bell_hook) (struct frame *f);
+  void (*toggle_invisible_pointer_hook) (struct frame *f, int invisible);
 
-  void (*reset_terminal_modes_hook) P_ ((struct terminal *));
-  void (*set_terminal_modes_hook) P_ ((struct terminal *));
+  void (*reset_terminal_modes_hook) (struct terminal *);
+  void (*set_terminal_modes_hook) (struct terminal *);
 
-  void (*update_begin_hook) P_ ((struct frame *));
-  void (*update_end_hook) P_ ((struct frame *));
-  void (*set_terminal_window_hook) P_ ((struct frame *, int));
+  void (*update_begin_hook) (struct frame *);
+  void (*update_end_hook) (struct frame *);
+  void (*set_terminal_window_hook) (struct frame *, int);
 
   /* Multi-frame and mouse support hooks.  */
 
@@ -458,12 +458,12 @@ struct terminal
 
      This should clear mouse_moved until the next motion
      event arrives.  */
-  void (*mouse_position_hook) P_ ((struct frame **f, int,
-                                   Lisp_Object *bar_window,
-                                   enum scroll_bar_part *part,
-                                   Lisp_Object *x,
-                                   Lisp_Object *y,
-                                   unsigned long *time));
+  void (*mouse_position_hook) (struct frame **f, int,
+                               Lisp_Object *bar_window,
+                               enum scroll_bar_part *part,
+                               Lisp_Object *x,
+                               Lisp_Object *y,
+                               unsigned long *time);
 
   /* The window system handling code should set this if the mouse has
      moved since the last call to the mouse_position_hook.  Calling that
@@ -473,7 +473,7 @@ struct terminal
   /* When a frame's focus redirection is changed, this hook tells the
      window system code to re-decide where to put the highlight.  Under
      X, this means that Emacs lies about where the focus is.  */
-  void (*frame_rehighlight_hook) P_ ((struct frame *));
+  void (*frame_rehighlight_hook) (struct frame *);
 
   /* If we're displaying frames using a window system that can stack
      frames on top of each other, this hook allows you to bring a frame
@@ -485,12 +485,12 @@ struct terminal
      If RAISE is non-zero, F is brought to the front, before all other
      windows.  If RAISE is zero, F is sent to the back, behind all other
      windows.  */
-  void (*frame_raise_lower_hook) P_ ((struct frame *f, int raise));
+  void (*frame_raise_lower_hook) (struct frame *f, int raise);
 
   /* If the value of the frame parameter changed, whis hook is called.
      For example, if going from fullscreen to not fullscreen this hook
      may do something OS dependent, like extended window manager hints on X11.  */
-  void (*fullscreen_hook) P_ ((struct frame *f));
+  void (*fullscreen_hook) (struct frame *f);
 
   \f
   /* Scroll bar hooks.  */
@@ -520,9 +520,9 @@ struct terminal
      indicate that we are displaying PORTION characters out of a total
      of WHOLE characters, starting at POSITION.  If WINDOW doesn't yet
      have a scroll bar, create one for it.  */
-  void (*set_vertical_scroll_bar_hook) P_ ((struct window *window,
-                                            int portion, int whole,
-                                            int position));
+  void (*set_vertical_scroll_bar_hook) (struct window *window,
+                                        int portion, int whole,
+                                        int position);
 
 
   /* The following three hooks are used when we're doing a thorough
@@ -545,11 +545,11 @@ struct terminal
      If non-zero, this hook should be safe to apply to any frame,
      whether or not it can support scroll bars, and whether or not it is
      currently displaying them.  */
-  void (*condemn_scroll_bars_hook) P_ ((struct frame *frame));
+  void (*condemn_scroll_bars_hook) (struct frame *frame);
 
   /* Unmark WINDOW's scroll bar for deletion in this judgement cycle.
      Note that it's okay to redeem a scroll bar that is not condemned.  */
-  void (*redeem_scroll_bar_hook) P_ ((struct window *window));
+  void (*redeem_scroll_bar_hook) (struct window *window);
 
   /* Remove all scroll bars on FRAME that haven't been saved since the
      last call to `*condemn_scroll_bars_hook'.
@@ -562,7 +562,7 @@ struct terminal
      If non-zero, this hook should be safe to apply to any frame,
      whether or not it can support scroll bars, and whether or not it is
      currently displaying them.  */
-  void (*judge_scroll_bars_hook) P_ ((struct frame *FRAME));
+  void (*judge_scroll_bars_hook) (struct frame *FRAME);
 
 \f
   /* Called to read input events.
@@ -584,17 +584,17 @@ struct terminal
      Therefore, in most cases EXPECTED should be simply ignored.
 
      XXX This documentation needs to be updated.  */
-  int (*read_socket_hook) P_ ((struct terminal *terminal,
-                               int expected,
-                               struct input_event *hold_quit));
+  int (*read_socket_hook) (struct terminal *terminal,
+                           int expected,
+                           struct input_event *hold_quit);
 
   /* Called when a frame's display becomes entirely up to date.  */
-  void (*frame_up_to_date_hook) P_ ((struct frame *));
+  void (*frame_up_to_date_hook) (struct frame *);
 
 \f
   /* Called to delete the device-specific portions of a frame that is
      on this terminal device. */
-  void (*delete_frame_hook) P_ ((struct frame *));
+  void (*delete_frame_hook) (struct frame *);
 
   /* Called after the last frame on this terminal is deleted, or when
      the display device was closed (hangup).
@@ -606,7 +606,7 @@ struct terminal
      on the terminal.  delete_frame ensures that there are no live
      frames on the terminal when it calls this hook, so infinite
      recursion is prevented.  */
-  void (*delete_terminal_hook) P_ ((struct terminal *));
+  void (*delete_terminal_hook) (struct terminal *);
 };
 
 
@@ -647,10 +647,10 @@ extern struct terminal *terminal_list;
 /* Return true if the terminal device is not suspended. */
 #define TERMINAL_ACTIVE_P(d) (((d)->type != output_termcap && (d)->type !=output_msdos_raw) || (d)->display_info.tty->input)
 
-extern Lisp_Object get_terminal_param P_ ((struct terminal *, Lisp_Object));
-extern struct terminal *get_terminal P_ ((Lisp_Object terminal, int));
-extern struct terminal *create_terminal P_ ((void));
-extern void delete_terminal P_ ((struct terminal *));
+extern Lisp_Object get_terminal_param (struct terminal *, Lisp_Object);
+extern struct terminal *get_terminal (Lisp_Object terminal, int);
+extern struct terminal *create_terminal (void);
+extern void delete_terminal (struct terminal *);
 
 /* The initial terminal device, created by initial_term_init. */
 extern struct terminal *initial_terminal;
index 45d918a2bd4baef26c1fcc34e83f5c0fc4263977..bda6c307a1076dc373ddd13da68a6536bc9400e6 100644 (file)
@@ -40,7 +40,7 @@ struct terminal *initial_terminal;
 /* Function to use to ring the bell.  */
 Lisp_Object Vring_bell_function;
 
-static void delete_initial_terminal P_ ((struct terminal *));
+static void delete_initial_terminal (struct terminal *);
 
 \f
 
@@ -300,8 +300,7 @@ selected frame's terminal).
 
 Normally, you may not delete a display if all other displays are suspended,
 but if the second argument FORCE is non-nil, you may do so. */)
-  (terminal, force)
-     Lisp_Object terminal, force;
+  (Lisp_Object terminal, Lisp_Object force)
 {
   struct terminal *t = get_terminal (terminal, 0);
 
@@ -342,8 +341,7 @@ DEFUN ("frame-terminal", Fframe_terminal, Sframe_terminal, 0, 1, 0,
 If FRAME is nil, the selected frame is used.
 
 The terminal device is represented by its integer identifier.  */)
-  (frame)
-     Lisp_Object frame;
+  (Lisp_Object frame)
 {
   struct terminal *t;
 
@@ -370,8 +368,7 @@ Value is nil if OBJECT is not a live display terminal.
 If object is a live display terminal, the return value indicates what
 sort of output terminal it uses.  See the documentation of `framep' for
 possible return values.  */)
-     (object)
-     Lisp_Object object;
+  (Lisp_Object object)
 {
   struct terminal *t;
 
@@ -402,7 +399,7 @@ possible return values.  */)
 
 DEFUN ("terminal-list", Fterminal_list, Sterminal_list, 0, 0, 0,
        doc: /* Return a list of all terminal devices.  */)
-  ()
+  (void)
 {
   Lisp_Object terminal, terminals = Qnil;
   struct terminal *t;
@@ -422,8 +419,7 @@ It is not guaranteed that the returned value is unique among opened devices.
 
 TERMINAL may be a terminal object, a frame, or nil (meaning the
 selected frame's terminal). */)
-  (terminal)
-     Lisp_Object terminal;
+  (Lisp_Object terminal)
 {
   struct terminal *t
     = TERMINALP (terminal) ? XTERMINAL (terminal) : get_terminal (terminal, 1);
@@ -435,9 +431,7 @@ selected frame's terminal). */)
 \f
 /* Return the value of terminal parameter PARAM in terminal T.  */
 Lisp_Object
-get_terminal_param (t, param)
-     struct terminal *t;
-     Lisp_Object param;
+get_terminal_param (struct terminal *t, Lisp_Object param)
 {
   Lisp_Object tem = Fassq (param, t->param_alist);
   if (EQ (tem, Qnil))
@@ -449,10 +443,7 @@ get_terminal_param (t, param)
    Return the previous value.  */
 
 Lisp_Object
-store_terminal_param (t, parameter, value)
-     struct terminal *t;
-     Lisp_Object parameter;
-     Lisp_Object value;
+store_terminal_param (struct terminal *t, Lisp_Object parameter, Lisp_Object value)
 {
   Lisp_Object old_alist_elt = Fassq (parameter, t->param_alist);
   if (EQ (old_alist_elt, Qnil))
@@ -476,8 +467,7 @@ is a symbol.
 
 TERMINAL can be a terminal object, a frame, or nil (meaning the
 selected frame's terminal).  */)
-     (terminal)
-     Lisp_Object terminal;
+  (Lisp_Object terminal)
 {
   struct terminal *t
     = TERMINALP (terminal) ? XTERMINAL (terminal) : get_terminal (terminal, 1);
@@ -488,9 +478,7 @@ DEFUN ("terminal-parameter", Fterminal_parameter, Sterminal_parameter, 2, 2, 0,
        doc: /* Return TERMINAL's value for parameter PARAMETER.
 TERMINAL can be a terminal object, a frame, or nil (meaning the
 selected frame's terminal).  */)
-     (terminal, parameter)
-     Lisp_Object terminal;
-     Lisp_Object parameter;
+  (Lisp_Object terminal, Lisp_Object parameter)
 {
   Lisp_Object value;
   struct terminal *t
@@ -507,10 +495,7 @@ Return the previous value of PARAMETER.
 
 TERMINAL can be a terminal object, a frame or nil (meaning the
 selected frame's terminal).  */)
-     (terminal, parameter, value)
-     Lisp_Object terminal;
-     Lisp_Object parameter;
-     Lisp_Object value;
+  (Lisp_Object terminal, Lisp_Object parameter, Lisp_Object value)
 {
   struct terminal *t
     = TERMINALP (terminal) ? XTERMINAL (terminal) : get_terminal (terminal, 1);
@@ -552,7 +537,7 @@ delete_initial_terminal (struct terminal *terminal)
 }
 
 void
-syms_of_terminal ()
+syms_of_terminal (void)
 {
 
   DEFVAR_LISP ("ring-bell-function", &Vring_bell_function,
index 55508196fae6de85b6c5ec5ea66b505209238b84..50749492cfef6b46dca92d5b7919a92212657f30 100644 (file)
@@ -35,13 +35,12 @@ char *UP, *BC, PC;
 */
 
 char *
-tparam (string, outstring, len, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)
-     char *string;
-     char *outstring;
-     int len, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9;
+tparam (char *string, char *outstring,
+       int len, int arg1, int arg2, int arg3, int arg4,
+       int arg5, int arg6, int arg7, int arg8, int arg9)
 {
   char *temp;
-  extern char *tparm();
+  extern char *tparm (char *str, ...);
 
   temp = tparm (string, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
   if (outstring == 0)
index 83d09cce5584ff4c3348613456ac2d0eed0ca3f9..0e398e41e4ac4fd31197df3abac528fde9987359 100644 (file)
@@ -78,15 +78,14 @@ Lisp_Object Vtext_property_default_nonsticky;
 Lisp_Object interval_insert_behind_hooks;
 Lisp_Object interval_insert_in_front_hooks;
 
-static void text_read_only P_ ((Lisp_Object)) NO_RETURN;
+static void text_read_only (Lisp_Object) NO_RETURN;
 
 
 /* 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
-text_read_only (propval)
-     Lisp_Object propval;
+text_read_only (Lisp_Object propval)
 {
   if (STRINGP (propval))
     xsignal1 (Qtext_read_only, propval);
@@ -123,9 +122,7 @@ text_read_only (propval)
 #define hard 1
 
 INTERVAL
-validate_interval_range (object, begin, end, force)
-     Lisp_Object object, *begin, *end;
-     int force;
+validate_interval_range (Lisp_Object object, Lisp_Object *begin, Lisp_Object *end, int force)
 {
   register INTERVAL i;
   int searchpos;
@@ -191,8 +188,7 @@ validate_interval_range (object, begin, end, force)
    is even numbered and thus suitable as a plist.  */
 
 static Lisp_Object
-validate_plist (list)
-     Lisp_Object list;
+validate_plist (Lisp_Object list)
 {
   if (NILP (list))
     return Qnil;
@@ -218,9 +214,7 @@ validate_plist (list)
    with the same values, of list PLIST.  */
 
 static int
-interval_has_all_properties (plist, i)
-     Lisp_Object plist;
-     INTERVAL i;
+interval_has_all_properties (Lisp_Object plist, INTERVAL i)
 {
   register Lisp_Object tail1, tail2, sym1;
   register int found;
@@ -256,9 +250,7 @@ interval_has_all_properties (plist, i)
    properties of PLIST, regardless of their values.  */
 
 static INLINE int
-interval_has_some_properties (plist, i)
-     Lisp_Object plist;
-     INTERVAL i;
+interval_has_some_properties (Lisp_Object plist, INTERVAL i)
 {
   register Lisp_Object tail1, tail2, sym;
 
@@ -280,9 +272,7 @@ interval_has_some_properties (plist, i)
    property names in LIST, regardless of their values.  */
 
 static INLINE int
-interval_has_some_properties_list (list, i)
-     Lisp_Object list;
-     INTERVAL i;
+interval_has_some_properties_list (Lisp_Object list, INTERVAL i)
 {
   register Lisp_Object tail1, tail2, sym;
 
@@ -305,8 +295,7 @@ interval_has_some_properties_list (list, i)
 /* Return the value of PROP in property-list PLIST, or Qunbound if it
    has none.  */
 static Lisp_Object
-property_value (plist, prop)
-     Lisp_Object plist, prop;
+property_value (Lisp_Object plist, Lisp_Object prop)
 {
   Lisp_Object value;
 
@@ -324,9 +313,7 @@ property_value (plist, prop)
    OBJECT is the string or buffer that INTERVAL belongs to.  */
 
 static void
-set_properties (properties, interval, object)
-     Lisp_Object properties, object;
-     INTERVAL interval;
+set_properties (Lisp_Object properties, INTERVAL interval, Lisp_Object object)
 {
   Lisp_Object sym, value;
 
@@ -372,10 +359,7 @@ set_properties (properties, interval, object)
    are actually added to I's plist) */
 
 static int
-add_properties (plist, i, object)
-     Lisp_Object plist;
-     INTERVAL i;
-     Lisp_Object object;
+add_properties (Lisp_Object plist, INTERVAL i, Lisp_Object object)
 {
   Lisp_Object tail1, tail2, sym1, val1;
   register int changed = 0;
@@ -451,10 +435,7 @@ add_properties (plist, i, object)
    OBJECT is the string or buffer containing I.  */
 
 static int
-remove_properties (plist, list, i, object)
-     Lisp_Object plist, list;
-     INTERVAL i;
-     Lisp_Object object;
+remove_properties (Lisp_Object plist, Lisp_Object list, INTERVAL i, Lisp_Object object)
 {
   register Lisp_Object tail1, tail2, sym, current_plist;
   register int changed = 0;
@@ -535,9 +516,7 @@ erase_properties (i)
    POSITION is BEG-based.  */
 
 INTERVAL
-interval_of (position, object)
-     int position;
-     Lisp_Object object;
+interval_of (int position, Lisp_Object object)
 {
   register INTERVAL i;
   int beg, end;
@@ -579,8 +558,7 @@ If the optional second argument OBJECT is a buffer (or nil, which means
 the current buffer), POSITION is a buffer position (integer or marker).
 If OBJECT is a string, POSITION is a 0-based index into it.
 If POSITION is at the end of OBJECT, the value is nil.  */)
-     (position, object)
-     Lisp_Object position, object;
+  (Lisp_Object position, Lisp_Object object)
 {
   register INTERVAL i;
 
@@ -604,9 +582,7 @@ DEFUN ("get-text-property", Fget_text_property, Sget_text_property, 2, 3, 0,
        doc: /* Return the value of POSITION's property PROP, in OBJECT.
 OBJECT is optional and defaults to the current buffer.
 If POSITION is at the end of OBJECT, the value is nil.  */)
-     (position, prop, object)
-     Lisp_Object position, object;
-     Lisp_Object prop;
+  (Lisp_Object position, Lisp_Object prop, Lisp_Object object)
 {
   return textget (Ftext_properties_at (position, object), prop);
 }
@@ -623,10 +599,7 @@ If POSITION is at the end of OBJECT, the value is nil.  */)
    window-specific overlays are considered only if they are associated
    with OBJECT. */
 Lisp_Object
-get_char_property_and_overlay (position, prop, object, overlay)
-     Lisp_Object position, object;
-     register Lisp_Object prop;
-     Lisp_Object *overlay;
+get_char_property_and_overlay (Lisp_Object position, register Lisp_Object prop, Lisp_Object object, Lisp_Object *overlay)
 {
   struct window *w = 0;
 
@@ -689,9 +662,7 @@ If OBJECT is a buffer, then overlay properties are considered as well as
 text properties.
 If OBJECT is a window, then that window's buffer is used, but window-specific
 overlays are considered only if they are associated with OBJECT.  */)
-     (position, prop, object)
-     Lisp_Object position, object;
-     register Lisp_Object prop;
+  (Lisp_Object position, Lisp_Object prop, Lisp_Object object)
 {
   return get_char_property_and_overlay (position, prop, object, 0);
 }
@@ -710,9 +681,7 @@ value is always nil, since strings do not have overlays.  If OBJECT is
 a window, then that window's buffer is used, but window-specific
 overlays are considered only if they are associated with OBJECT.  If
 POSITION is at the end of OBJECT, both car and cdr are nil.  */)
-     (position, prop, object)
-     Lisp_Object position, object;
-     register Lisp_Object prop;
+  (Lisp_Object position, Lisp_Object prop, Lisp_Object object)
 {
   Lisp_Object overlay;
   Lisp_Object val
@@ -732,8 +701,7 @@ If none is found up to (point-max), the function returns (point-max).
 If the optional second argument LIMIT is non-nil, don't search
 past position LIMIT; return LIMIT if nothing is found before LIMIT.
 LIMIT is a no-op if it is greater than (point-max).  */)
-     (position, limit)
-     Lisp_Object position, limit;
+  (Lisp_Object position, Lisp_Object limit)
 {
   Lisp_Object temp;
 
@@ -758,8 +726,7 @@ If none is found since (point-min), the function returns (point-min).
 If the optional second argument LIMIT is non-nil, don't search
 past position LIMIT; return LIMIT if nothing is found before LIMIT.
 LIMIT is a no-op if it is less than (point-min).  */)
-     (position, limit)
-     Lisp_Object position, limit;
+  (Lisp_Object position, Lisp_Object limit)
 {
   Lisp_Object temp;
 
@@ -791,8 +758,7 @@ If the property is constant all the way to the end of OBJECT, return the
 last valid position in OBJECT.
 If the optional fourth argument LIMIT is non-nil, don't search
 past position LIMIT; return LIMIT if nothing is found before LIMIT.  */)
-     (position, prop, object, limit)
-     Lisp_Object prop, position, object, limit;
+  (Lisp_Object position, Lisp_Object prop, Lisp_Object object, Lisp_Object limit)
 {
   if (STRINGP (object))
     {
@@ -876,8 +842,7 @@ If the property is constant all the way to the start of OBJECT, return the
 first valid position in OBJECT.
 If the optional fourth argument LIMIT is non-nil, don't search
 back past position LIMIT; return LIMIT if nothing is found before LIMIT.  */)
-     (position, prop, object, limit)
-     Lisp_Object prop, position, object, limit;
+  (Lisp_Object position, Lisp_Object prop, Lisp_Object object, Lisp_Object limit)
 {
   if (STRINGP (object))
     {
@@ -965,8 +930,7 @@ If the value is non-nil, it is a position greater than POSITION, never equal.
 
 If the optional third argument LIMIT is non-nil, don't search
 past position LIMIT; return LIMIT if nothing is found before LIMIT.  */)
-     (position, object, limit)
-     Lisp_Object position, object, limit;
+  (Lisp_Object position, Lisp_Object object, Lisp_Object limit)
 {
   register INTERVAL i, next;
 
@@ -1020,8 +984,7 @@ past position LIMIT; return LIMIT if nothing is found before LIMIT.  */)
 /* Return 1 if there's a change in some property between BEG and END.  */
 
 int
-property_change_between_p (beg, end)
-     int beg, end;
+property_change_between_p (int beg, int end)
 {
   register INTERVAL i, next;
   Lisp_Object object, pos;
@@ -1063,8 +1026,7 @@ If the value is non-nil, it is a position greater than POSITION, never equal.
 
 If the optional fourth argument LIMIT is non-nil, don't search
 past position LIMIT; return LIMIT if nothing is found before LIMIT.  */)
-     (position, prop, object, limit)
-     Lisp_Object position, prop, object, limit;
+  (Lisp_Object position, Lisp_Object prop, Lisp_Object object, Lisp_Object limit)
 {
   register INTERVAL i, next;
   register Lisp_Object here_val;
@@ -1111,8 +1073,7 @@ If the value is non-nil, it is a position less than POSITION, never equal.
 
 If the optional third argument LIMIT is non-nil, don't search
 back past position LIMIT; return LIMIT if nothing is found until LIMIT.  */)
-     (position, object, limit)
-     Lisp_Object position, object, limit;
+  (Lisp_Object position, Lisp_Object object, Lisp_Object limit)
 {
   register INTERVAL i, previous;
 
@@ -1160,8 +1121,7 @@ If the value is non-nil, it is a position less than POSITION, never equal.
 
 If the optional fourth argument LIMIT is non-nil, don't search
 back past position LIMIT; return LIMIT if nothing is found until LIMIT.  */)
-     (position, prop, object, limit)
-     Lisp_Object position, prop, object, limit;
+  (Lisp_Object position, Lisp_Object prop, Lisp_Object object, Lisp_Object limit)
 {
   register INTERVAL i, previous;
   register Lisp_Object here_val;
@@ -1210,8 +1170,7 @@ OBJECT is a buffer (or nil, which means the current buffer),
 START and END are buffer positions (integers or markers).
 If OBJECT is a string, START and END are 0-based indices into it.
 Return t if any property value actually changed, nil otherwise.  */)
-     (start, end, properties, object)
-     Lisp_Object start, end, properties, object;
+  (Lisp_Object start, Lisp_Object end, Lisp_Object properties, Lisp_Object object)
 {
   register INTERVAL i, unchanged;
   register int s, len, modified = 0;
@@ -1318,8 +1277,7 @@ specify the property to add.
 If the optional fifth argument OBJECT is a buffer (or nil, which means
 the current buffer), START and END are buffer positions (integers or
 markers).  If OBJECT is a string, START and END are 0-based indices into it.  */)
-     (start, end, property, value, object)
-     Lisp_Object start, end, property, value, object;
+  (Lisp_Object start, Lisp_Object end, Lisp_Object property, Lisp_Object value, Lisp_Object object)
 {
   Fadd_text_properties (start, end,
                        Fcons (property, Fcons (value, Qnil)),
@@ -1336,8 +1294,7 @@ the current buffer), START and END are buffer positions (integers or
 markers).  If OBJECT is a string, START and END are 0-based indices into it.
 If PROPERTIES is nil, the effect is to remove all properties from
 the designated part of OBJECT.  */)
-     (start, end, properties, object)
-     Lisp_Object start, end, properties, object;
+  (Lisp_Object start, Lisp_Object end, Lisp_Object properties, Lisp_Object object)
 {
   return set_text_properties (start, end, properties, object, Qt);
 }
@@ -1353,8 +1310,7 @@ the designated part of OBJECT.  */)
    otherwise.  */
 
 Lisp_Object
-set_text_properties (start, end, properties, object, coherent_change_p)
-     Lisp_Object start, end, properties, object, coherent_change_p;
+set_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object properties, Lisp_Object object, Lisp_Object coherent_change_p)
 {
   register INTERVAL i;
   Lisp_Object ostart, oend;
@@ -1418,9 +1374,7 @@ set_text_properties (start, end, properties, object, coherent_change_p)
    START and END can be in any order.  */
 
 void
-set_text_properties_1 (start, end, properties, buffer, i)
-     Lisp_Object start, end, properties, buffer;
-     INTERVAL i;
+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 int s, len;
@@ -1509,8 +1463,7 @@ markers).  If OBJECT is a string, START and END are 0-based indices into it.
 Return t if any property was actually removed, nil otherwise.
 
 Use `set-text-properties' if you want to remove all text properties.  */)
-     (start, end, properties, object)
-     Lisp_Object start, end, properties, object;
+  (Lisp_Object start, Lisp_Object end, Lisp_Object properties, Lisp_Object object)
 {
   register INTERVAL i, unchanged;
   register int s, len, modified = 0;
@@ -1595,8 +1548,7 @@ If the optional fourth argument OBJECT is a buffer (or nil, which means
 the current buffer), START and END are buffer positions (integers or
 markers).  If OBJECT is a string, START and END are 0-based indices into it.
 Return t if any property was actually removed, nil otherwise.  */)
-     (start, end, list_of_properties, object)
-     Lisp_Object start, end, list_of_properties, object;
+  (Lisp_Object start, Lisp_Object end, Lisp_Object list_of_properties, Lisp_Object object)
 {
   register INTERVAL i, unchanged;
   register int s, len, modified = 0;
@@ -1703,8 +1655,7 @@ is `eq' to VALUE.  Otherwise return nil.
 If the optional fifth argument OBJECT is a buffer (or nil, which means
 the current buffer), START and END are buffer positions (integers or
 markers).  If OBJECT is a string, START and END are 0-based indices into it.  */)
-     (start, end, property, value, object)
-     Lisp_Object start, end, property, value, object;
+  (Lisp_Object start, Lisp_Object end, Lisp_Object property, Lisp_Object value, Lisp_Object object)
 {
   register INTERVAL i;
   register int e, pos;
@@ -1740,8 +1691,7 @@ is not `eq' to VALUE.  Otherwise, return nil.
 If the optional fifth argument OBJECT is a buffer (or nil, which means
 the current buffer), START and END are buffer positions (integers or
 markers).  If OBJECT is a string, START and END are 0-based indices into it.  */)
-     (start, end, property, value, object)
-     Lisp_Object start, end, property, value, object;
+  (Lisp_Object start, Lisp_Object end, Lisp_Object property, Lisp_Object value, Lisp_Object object)
 {
   register INTERVAL i;
   register int s, e;
@@ -1777,8 +1727,7 @@ markers).  If OBJECT is a string, START and END are 0-based indices into it.  */
    BUFFER can be either a buffer or nil (meaning current buffer).  */
 
 int
-text_property_stickiness (prop, pos, buffer)
-     Lisp_Object prop, pos, buffer;
+text_property_stickiness (Lisp_Object prop, Lisp_Object pos, Lisp_Object buffer)
 {
   Lisp_Object prev_pos, front_sticky;
   int is_rear_sticky = 1, is_front_sticky = 0; /* defaults */
@@ -1851,8 +1800,7 @@ text_property_stickiness (prop, pos, buffer)
 /* Note this can GC when DEST is a buffer.  */
 
 Lisp_Object
-copy_text_properties (start, end, src, pos, dest, prop)
-       Lisp_Object start, end, src, pos, dest, prop;
+copy_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object src, Lisp_Object pos, Lisp_Object dest, Lisp_Object prop)
 {
   INTERVAL i;
   Lisp_Object res;
@@ -1944,8 +1892,7 @@ copy_text_properties (start, end, src, pos, dest, prop)
    doesn't contain text properties between START and END.  */
 
 Lisp_Object
-text_property_list (object, start, end, prop)
-     Lisp_Object object, start, end, prop;
+text_property_list (Lisp_Object object, Lisp_Object start, Lisp_Object end, Lisp_Object prop)
 {
   struct interval *i;
   Lisp_Object result;
@@ -2002,8 +1949,7 @@ text_property_list (object, start, end, prop)
    non-zero if OBJECT was modified.  */
 
 int
-add_text_properties_from_list (object, list, delta)
-     Lisp_Object object, list, delta;
+add_text_properties_from_list (Lisp_Object object, Lisp_Object list, Lisp_Object delta)
 {
   struct gcpro gcpro1, gcpro2;
   int modified_p = 0;
@@ -2036,8 +1982,7 @@ add_text_properties_from_list (object, list, delta)
    end-points to NEW_END.  */
 
 Lisp_Object
-extend_property_ranges (list, new_end)
-     Lisp_Object list, new_end;
+extend_property_ranges (Lisp_Object list, Lisp_Object new_end)
 {
   Lisp_Object prev = Qnil, head = list;
   int max = XINT (new_end);
@@ -2072,8 +2017,7 @@ extend_property_ranges (list, new_end)
 /* Call the modification hook functions in LIST, each with START and END.  */
 
 static void
-call_mod_hooks (list, start, end)
-     Lisp_Object list, start, end;
+call_mod_hooks (Lisp_Object list, Lisp_Object start, Lisp_Object end)
 {
   struct gcpro gcpro1;
   GCPRO1 (list);
@@ -2094,9 +2038,7 @@ call_mod_hooks (list, start, end)
    those hooks in order, with START and END - 1 as arguments.  */
 
 void
-verify_interval_modification (buf, start, end)
-     struct buffer *buf;
-     int start, end;
+verify_interval_modification (struct buffer *buf, int start, int end)
 {
   register INTERVAL intervals = BUF_INTERVALS (buf);
   register INTERVAL i;
@@ -2274,8 +2216,7 @@ verify_interval_modification (buf, start, end)
    so it can indicate the range of inserted text.  */
 
 void
-report_interval_modification (start, end)
-     Lisp_Object start, end;
+report_interval_modification (Lisp_Object start, Lisp_Object end)
 {
   if (! NILP (interval_insert_behind_hooks))
     call_mod_hooks (interval_insert_behind_hooks, start, end);
@@ -2286,7 +2227,7 @@ report_interval_modification (start, end)
 }
 \f
 void
-syms_of_textprop ()
+syms_of_textprop (void)
 {
   DEFVAR_LISP ("default-text-properties", &Vdefault_text_properties,
               doc: /* Property-list used as default values.
index dcf79a3b61714f2d7c173bf8851500998c437af2..d8a8f0260f03ac0d8c20a079988c7728ed79e1ee 100644 (file)
@@ -18,66 +18,14 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 Boston, MA 02110-1301, USA.  */
 
 /* Emacs config.h may rename various library functions such as malloc.  */
-#ifdef HAVE_CONFIG_H
 #include <config.h>
-#endif
-
-#ifdef emacs
 #include <setjmp.h>
 #include "lisp.h"              /* for xmalloc */
-#else
-
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#include <string.h>
-#else
-char *malloc ();
-char *realloc ();
-#endif
-
-/* Do this after the include, in case string.h prototypes bcopy.  */
-#if (defined(HAVE_STRING_H) || defined(STDC_HEADERS)) && !defined(bcopy)
-#define bcopy(s, d, n) memcpy ((d), (s), (n))
-#endif
-
-#endif /* not emacs */
 
 #ifndef NULL
 #define NULL (char *) 0
 #endif
 \f
-#ifndef emacs
-static void
-memory_out ()
-{
-  write (2, "virtual memory exhausted\n", 25);
-  exit (1);
-}
-
-static char *
-xmalloc (size)
-     unsigned size;
-{
-  register char *tem = malloc (size);
-
-  if (!tem)
-    memory_out ();
-  return tem;
-}
-
-static char *
-xrealloc (ptr, size)
-     char *ptr;
-     unsigned size;
-{
-  register char *tem = realloc (ptr, size);
-
-  if (!tem)
-    memory_out ();
-  return tem;
-}
-#endif /* not emacs */
-\f
 /* Assuming STRING is the value of a termcap string entry
    containing `%' constructs to expand parameters,
    merge in parameter values and store result in block OUTSTRING points to.
@@ -90,15 +38,11 @@ xrealloc (ptr, size)
 
    The fourth and following args to tparam serve as the parameter values.  */
 
-static char *tparam1 ();
+static char *tparam1 (char *string, char *outstring, int len, char *up, char *left, register int *argp);
 
 /* VARARGS 2 */
 char *
-tparam (string, outstring, len, arg0, arg1, arg2, arg3)
-     char *string;
-     char *outstring;
-     int len;
-     int arg0, arg1, arg2, arg3;
+tparam (char *string, char *outstring, int len, int arg0, int arg1, int arg2, int arg3)
 {
   int arg[4];
 
@@ -115,9 +59,7 @@ char *UP;
 static char tgoto_buf[50];
 
 char *
-tgoto (cm, hpos, vpos)
-     char *cm;
-     int hpos, vpos;
+tgoto (char *cm, int hpos, int vpos)
 {
   int args[2];
   if (!cm)
@@ -128,12 +70,7 @@ tgoto (cm, hpos, vpos)
 }
 
 static char *
-tparam1 (string, outstring, len, up, left, argp)
-     char *string;
-     char *outstring;
-     int len;
-     char *up, *left;
-     register int *argp;
+tparam1 (char *string, char *outstring, int len, char *up, char *left, register int *argp)
 {
   register int c;
   register char *p = string;
@@ -162,7 +99,7 @@ tparam1 (string, outstring, len, up, left, argp)
            {
              outlen = len + 40;
              new = (char *) xmalloc (outlen);
-             bcopy (outstring, new, offset);
+             memcpy (new, outstring, offset);
            }
          else
            {
index b678c5c58ba20dcc10324e10ff6730c0e87c57e2..14a8268394ae242dc791d1ca0ce048ee235a48b0 100644 (file)
@@ -67,8 +67,7 @@ int undo_inhibit_record_point;
    undo record that will be added just after this command terminates.  */
 
 static void
-record_point (pt)
-     int pt;
+record_point (int pt)
 {
   int at_boundary;
 
@@ -130,8 +129,7 @@ record_point (pt)
    because we don't need to record the contents.)  */
 
 void
-record_insert (beg, length)
-     int beg, length;
+record_insert (int beg, int length)
 {
   Lisp_Object lbeg, lend;
 
@@ -166,9 +164,7 @@ record_insert (beg, length)
    of the characters in STRING, at location BEG.  */
 
 void
-record_delete (beg, string)
-     int beg;
-     Lisp_Object string;
+record_delete (int beg, Lisp_Object string)
 {
   Lisp_Object sbeg;
 
@@ -196,9 +192,7 @@ record_delete (beg, string)
    won't be inverted automatically by undoing the buffer modification.  */
 
 void
-record_marker_adjustment (marker, adjustment)
-     Lisp_Object marker;
-     int adjustment;
+record_marker_adjustment (Lisp_Object marker, int adjustment)
 {
   if (EQ (current_buffer->undo_list, Qt))
     return;
@@ -221,8 +215,7 @@ record_marker_adjustment (marker, adjustment)
    The replacement must not change the number of characters.  */
 
 void
-record_change (beg, length)
-     int beg, length;
+record_change (int beg, int length)
 {
   record_delete (beg, make_buffer_string (beg, beg + length, 1));
   record_insert (beg, length);
@@ -233,7 +226,7 @@ record_change (beg, length)
    we can tell whether it is obsolete because the file was saved again.  */
 
 void
-record_first_change ()
+record_first_change (void)
 {
   Lisp_Object high, low;
   struct buffer *base_buffer = current_buffer;
@@ -257,9 +250,7 @@ record_first_change ()
    for LENGTH characters starting at position BEG in BUFFER.  */
 
 void
-record_property_change (beg, length, prop, value, buffer)
-     int beg, length;
-     Lisp_Object prop, value, buffer;
+record_property_change (int beg, int length, Lisp_Object prop, Lisp_Object value, Lisp_Object buffer)
 {
   Lisp_Object lbeg, lend, entry;
   struct buffer *obuf = current_buffer, *buf = XBUFFER (buffer);
@@ -297,7 +288,7 @@ DEFUN ("undo-boundary", Fundo_boundary, Sundo_boundary, 0, 0, 0,
        doc: /* Mark a boundary between units of undo.
 An undo command will stop at this point,
 but another undo command will undo to the previous boundary.  */)
-     ()
+  (void)
 {
   Lisp_Object tem;
   if (EQ (current_buffer->undo_list, Qt))
@@ -328,8 +319,7 @@ but another undo command will undo to the previous boundary.  */)
    In some cases this works by calling undo-outer-limit-function.  */
 
 void
-truncate_undo_list (b)
-     struct buffer *b;
+truncate_undo_list (struct buffer *b)
 {
   Lisp_Object list;
   Lisp_Object prev, next, last_boundary;
@@ -465,8 +455,7 @@ truncate_undo_list (b)
 DEFUN ("primitive-undo", Fprimitive_undo, Sprimitive_undo, 2, 2, 0,
        doc: /* Undo N records from the front of the list LIST.
 Return what remains of the list.  */)
-     (n, list)
-     Lisp_Object n, list;
+  (Lisp_Object n, Lisp_Object list)
 {
   struct gcpro gcpro1, gcpro2;
   Lisp_Object next;
@@ -665,7 +654,7 @@ Return what remains of the list.  */)
 }
 \f
 void
-syms_of_undo ()
+syms_of_undo (void)
 {
   Qinhibit_read_only = intern_c_string ("inhibit-read-only");
   staticpro (&Qinhibit_read_only);
index 97b69d7e5c718dee1bc319de998a9b8a1b35d7b9..949616d5e3157b61ad0ba9c8eb64c5d1747bc1aa 100644 (file)
@@ -71,7 +71,7 @@ what you give them.   Help stamp out software-hoarding!  */
 #include <unistd.h>
 #include <fcntl.h>
 
-extern char *start_of_text (void);             /* Start of text */
+char *start_of_text (void);                    /* Start of text */
 extern char *start_of_data (void);             /* Start of initialized data */
 
 extern int _data;
@@ -435,7 +435,6 @@ write_segment (int new, char *ptr, char *end)
 {
   int i, nwrite, ret;
   char buf[80];
-  extern int errno;
   char zeros[UnexBlockSz];
 
   for (i = 0; ptr < end;)
@@ -670,5 +669,18 @@ unrelocate_symbols (int new, int a_out, char *a_name, char *new_name)
   return 0;
 }
 
+/*
+ *     Return the address of the start of the text segment prior to
+ *     doing an unexec.  After unexec the return value is undefined.
+ *     See crt0.c for further explanation and _start.
+ *
+ */
+
+char *
+start_of_text (void)
+{
+  return ((char *) 0x10000000);
+}
+
 /* arch-tag: 0783857a-7c2d-456f-a426-58b722d69fd0
    (do not change this comment) */
diff --git a/src/unexalpha.c b/src/unexalpha.c
deleted file mode 100644 (file)
index 13c1def..0000000
+++ /dev/null
@@ -1,539 +0,0 @@
-/* Unexec for DEC alpha.
-
-   Copyright (C) 1994, 2000, 2001, 2002, 2003, 2004,
-                 2005, 2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
-
-Author: Rainer Schoepf <schoepf@sc.ZIB-Berlin.DE>
-
-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/>.  */
-
-\f
-#include <config.h>
-#include <sys/types.h>
-#include <sys/file.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-#include <stdio.h>
-#include <errno.h>
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-#if !defined (__NetBSD__) && !defined (__OpenBSD__)
-#include <filehdr.h>
-#include <aouthdr.h>
-#include <scnhdr.h>
-#include <syms.h>
-#ifndef __linux__
-# include <reloc.h>
-# include <elf_abi.h>
-#endif
-#else /* __NetBSD__ or __OpenBSD__ */
-/*
- * NetBSD/Alpha does not have 'normal' user-land ECOFF support because
- * there's no desire to support ECOFF as the executable format in the
- * long term.
- */
-#include <sys/exec_ecoff.h>
-
-/* Structures, constants, etc., that NetBSD defines strangely. */
-#define        filehdr         ecoff_filehdr
-#define        aouthdr         ecoff_aouthdr
-#define        scnhdr          ecoff_scnhdr
-#define        HDRR            struct ecoff_symhdr
-#define        pHDRR           HDRR *
-#define        cbHDRR          sizeof(HDRR)
-#ifdef __OpenBSD__
-#define        ALPHAMAGIC      ECOFF_MAGIC_NATIVE_ALPHA
-#else
-#define        ALPHAMAGIC      ECOFF_MAGIC_NETBSD_ALPHA
-#endif
-#define        ZMAGIC          ECOFF_ZMAGIC
-
-/* Misc. constants that NetBSD doesn't define at all. */
-#define        ALPHAUMAGIC     0617
-#define        _MIPS_NSCNS_MAX 35
-#define        STYP_TEXT       0x00000020
-#define        STYP_DATA       0x00000040
-#define        STYP_BSS        0x00000080
-#define        STYP_RDATA      0x00000100
-#define        STYP_SDATA      0x00000200
-#define        STYP_SBSS       0x00000400
-#define        STYP_INIT       0x80000000
-#define        _TEXT           ".text"
-#define        _DATA           ".data"
-#define        _BSS            ".bss"
-#define        _INIT           ".init"
-#define        _RDATA          ".rdata"
-#define        _SDATA          ".sdata"
-#define        _SBSS           ".sbss"
-#endif /* __NetBSD__ || __OpenBSD__ */
-
-static void fatal_unexec __P ((char *, char *));
-static void mark_x __P ((char *));
-
-static void update_dynamic_symbols __P ((char *, char *, int, struct aouthdr));
-
-#define READ(_fd, _buffer, _size, _error_message, _error_arg) \
-       errno = EEOF; \
-       if (read (_fd, _buffer, _size) != _size) \
-         fatal_unexec (_error_message, _error_arg);
-
-#define WRITE(_fd, _buffer, _size, _error_message, _error_arg) \
-       if (write (_fd, _buffer, _size) != _size) \
-         fatal_unexec (_error_message, _error_arg);
-
-#define SEEK(_fd, _position, _error_message, _error_arg) \
-       errno = EEOF; \
-       if (lseek (_fd, _position, L_SET) != _position) \
-         fatal_unexec (_error_message, _error_arg);
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#else
-void *sbrk ();
-#endif
-
-#define EEOF -1
-
-static struct scnhdr *text_section;
-static struct scnhdr *rel_dyn_section;
-static struct scnhdr *dynstr_section;
-static struct scnhdr *dynsym_section;
-static struct scnhdr *init_section;
-static struct scnhdr *finit_section;
-static struct scnhdr *rdata_section;
-static struct scnhdr *rconst_section;
-static struct scnhdr *data_section;
-static struct scnhdr *pdata_section;
-static struct scnhdr *xdata_section;
-static struct scnhdr *got_section;
-static struct scnhdr *lit8_section;
-static struct scnhdr *lit4_section;
-static struct scnhdr *sdata_section;
-static struct scnhdr *sbss_section;
-static struct scnhdr *bss_section;
-
-static struct scnhdr old_data_scnhdr;
-
-static unsigned long Brk;
-
-struct headers {
-    struct filehdr fhdr;
-    struct aouthdr aout;
-    struct scnhdr section[_MIPS_NSCNS_MAX];
-};
-
-\f
-void
-unexec (new_name, a_name, data_start, bss_start, entry_address)
-     char *new_name, *a_name;
-     unsigned long data_start, bss_start, entry_address;
-{
-  int new, old;
-  char * oldptr;
-  struct headers ohdr, nhdr;
-  struct stat stat;
-  long pagesize, brk;
-  long newsyms, symrel;
-  int nread;
-  int i;
-  long vaddr, scnptr;
-#define BUFSIZE 8192
-  char buffer[BUFSIZE];
-
-  if ((old = open (a_name, O_RDONLY)) < 0)
-    fatal_unexec ("opening %s", a_name);
-
-  new = creat (new_name, 0666);
-  if (new < 0) fatal_unexec ("creating %s", new_name);
-
-  if ((fstat (old, &stat) == -1))
-    fatal_unexec ("fstat %s", a_name);
-
-  oldptr = (char *)mmap (0, stat.st_size, PROT_READ, MAP_FILE|MAP_SHARED, old, 0);
-
-  if (oldptr == (char *)-1)
-    fatal_unexec ("mmap %s", a_name);
-
-  close (old);
-
-  /* This is a copy of the a.out header of the original executable */
-
-  ohdr = (*(struct headers *)oldptr);
-
-  /* This is where we build the new header from the in-memory copy */
-
-  nhdr = *((struct headers *)TEXT_START);
-
-  /* First do some consistency checks */
-
-  if (nhdr.fhdr.f_magic != ALPHAMAGIC
-      && nhdr.fhdr.f_magic != ALPHAUMAGIC)
-    {
-      fprintf (stderr, "unexec: input file magic number is %x, not %x or %x.\n",
-              nhdr.fhdr.f_magic, ALPHAMAGIC, ALPHAUMAGIC);
-      exit (1);
-    }
-
-  if (nhdr.fhdr.f_opthdr != sizeof (nhdr.aout))
-    {
-      fprintf (stderr, "unexec: input a.out header is %d bytes, not %d.\n",
-              nhdr.fhdr.f_opthdr, (int)sizeof (nhdr.aout));
-      exit (1);
-    }
-  if (nhdr.aout.magic != ZMAGIC)
-    {
-      fprintf (stderr, "unexec: input file a.out magic number is %o, not %o.\n",
-              nhdr.aout.magic, ZMAGIC);
-      exit (1);
-    }
-
-
-  /* Now check the existence of certain header section and grab
-     their addresses. */
-
-#define CHECK_SCNHDR(ptr, name, flags)                                 \
-  ptr = NULL;                                                          \
-  for (i = 0; i < nhdr.fhdr.f_nscns && !ptr; i++)                      \
-    if (strncmp (nhdr.section[i].s_name, name, 8) == 0)                        \
-      {                                                                        \
-       if (nhdr.section[i].s_flags != flags)                           \
-         fprintf (stderr, "unexec: %x flags (%x expected) in %s section.\n", \
-                  nhdr.section[i].s_flags, flags, name);               \
-       ptr = nhdr.section + i;                                         \
-      }                                                                        \
-
-  CHECK_SCNHDR (text_section,  _TEXT,  STYP_TEXT);
-  CHECK_SCNHDR (init_section,  _INIT,  STYP_INIT);
-#ifdef _REL_DYN
-  CHECK_SCNHDR (rel_dyn_section, _REL_DYN,  STYP_REL_DYN);
-#endif /* _REL_DYN */
-#ifdef _DYNSYM
-  CHECK_SCNHDR (dynsym_section, _DYNSYM,  STYP_DYNSYM);
-#endif /* _REL_DYN */
-#ifdef _DYNSTR
-  CHECK_SCNHDR (dynstr_section, _DYNSTR,  STYP_DYNSTR);
-#endif /* _REL_DYN */
-#ifdef _FINI
-  CHECK_SCNHDR (finit_section, _FINI,  STYP_FINI);
-#endif /* _FINI */
-  CHECK_SCNHDR (rdata_section, _RDATA, STYP_RDATA);
-#ifdef _RCONST
-  CHECK_SCNHDR (rconst_section, _RCONST, STYP_RCONST);
-#endif
-#ifdef _PDATA
-  CHECK_SCNHDR (pdata_section, _PDATA, STYP_PDATA);
-#endif /* _PDATA */
-#ifdef _GOT
-  CHECK_SCNHDR (got_section,   _GOT,   STYP_GOT);
-#endif /* _GOT */
-  CHECK_SCNHDR (data_section,  _DATA,  STYP_DATA);
-#ifdef _XDATA
-  CHECK_SCNHDR (xdata_section, _XDATA, STYP_XDATA);
-#endif /* _XDATA */
-#ifdef _LIT8
-  CHECK_SCNHDR (lit8_section,  _LIT8,  STYP_LIT8);
-  CHECK_SCNHDR (lit4_section,  _LIT4,  STYP_LIT4);
-#endif /* _LIT8 */
-  CHECK_SCNHDR (sdata_section, _SDATA, STYP_SDATA);
-  CHECK_SCNHDR (sbss_section,  _SBSS,  STYP_SBSS);
-  CHECK_SCNHDR (bss_section,   _BSS,   STYP_BSS);
-
-
-  pagesize = getpagesize ();
-  brk = (((long) (sbrk (0))) + pagesize - 1) & (-pagesize);
-
-  /* Remember the current break */
-
-  Brk = brk;
-
-  bcopy (data_section, &old_data_scnhdr, sizeof (old_data_scnhdr));
-
-  nhdr.aout.dsize = brk - DATA_START;
-  nhdr.aout.bsize = 0;
-  if (entry_address == 0)
-    {
-      extern __start ();
-      nhdr.aout.entry = (unsigned long)__start;
-    }
-  else
-    nhdr.aout.entry = entry_address;
-
-  nhdr.aout.bss_start = nhdr.aout.data_start + nhdr.aout.dsize;
-
-  if (rdata_section != NULL)
-    {
-      rdata_section->s_size = data_start - DATA_START;
-
-      /* Adjust start and virtual addresses of rdata_section, too.  */
-      rdata_section->s_vaddr = DATA_START;
-      rdata_section->s_paddr = DATA_START;
-      rdata_section->s_scnptr = text_section->s_scnptr + nhdr.aout.tsize;
-    }
-
-  data_section->s_vaddr = data_start;
-  data_section->s_paddr = data_start;
-  data_section->s_size = brk - data_start;
-
-  if (rdata_section != NULL)
-    {
-      data_section->s_scnptr = rdata_section->s_scnptr + rdata_section->s_size;
-    }
-
-  vaddr = data_section->s_vaddr + data_section->s_size;
-  scnptr = data_section->s_scnptr + data_section->s_size;
-  if (lit8_section != NULL)
-    {
-      lit8_section->s_vaddr = vaddr;
-      lit8_section->s_paddr = vaddr;
-      lit8_section->s_size = 0;
-      lit8_section->s_scnptr = scnptr;
-    }
-  if (lit4_section != NULL)
-    {
-      lit4_section->s_vaddr = vaddr;
-      lit4_section->s_paddr = vaddr;
-      lit4_section->s_size = 0;
-      lit4_section->s_scnptr = scnptr;
-    }
-  if (sdata_section != NULL)
-    {
-      sdata_section->s_vaddr = vaddr;
-      sdata_section->s_paddr = vaddr;
-      sdata_section->s_size = 0;
-      sdata_section->s_scnptr = scnptr;
-    }
-#ifdef _XDATA
-  if (xdata_section != NULL)
-    {
-      xdata_section->s_vaddr = vaddr;
-      xdata_section->s_paddr = vaddr;
-      xdata_section->s_size = 0;
-      xdata_section->s_scnptr = scnptr;
-    }
-#endif
-#ifdef _GOT
-  if (got_section != NULL)
-    {
-      bcopy (got_section, buffer, sizeof (struct scnhdr));
-
-      got_section->s_vaddr = vaddr;
-      got_section->s_paddr = vaddr;
-      got_section->s_size = 0;
-      got_section->s_scnptr = scnptr;
-    }
-#endif /*_GOT */
-  if (sbss_section != NULL)
-    {
-      sbss_section->s_vaddr = vaddr;
-      sbss_section->s_paddr = vaddr;
-      sbss_section->s_size = 0;
-      sbss_section->s_scnptr = scnptr;
-    }
-  if (bss_section != NULL)
-    {
-      bss_section->s_vaddr = vaddr;
-      bss_section->s_paddr = vaddr;
-      bss_section->s_size = 0;
-      bss_section->s_scnptr = scnptr;
-    }
-
-  WRITE (new, (char *)TEXT_START, nhdr.aout.tsize,
-        "writing text section to %s", new_name);
-  WRITE (new, (char *)DATA_START, nhdr.aout.dsize,
-        "writing data section to %s", new_name);
-
-#ifdef _GOT
-#define old_got_section ((struct scnhdr *)buffer)
-
-  if (got_section != NULL)
-    {
-      SEEK (new, old_got_section->s_scnptr,
-           "seeking to start of got_section in %s", new_name);
-      WRITE (new, oldptr + old_got_section->s_scnptr, old_got_section->s_size,
-            "writing new got_section of %s", new_name);
-      SEEK (new, nhdr.aout.tsize + nhdr.aout.dsize,
-           "seeking to end of data section of %s", new_name);
-    }
-
-#undef old_got_section
-#endif
-
-  /*
-   * Construct new symbol table header
-   */
-
-  bcopy (oldptr + nhdr.fhdr.f_symptr, buffer, cbHDRR);
-
-#define symhdr ((pHDRR)buffer)
-  newsyms = nhdr.aout.tsize + nhdr.aout.dsize;
-  symrel = newsyms - nhdr.fhdr.f_symptr;
-  nhdr.fhdr.f_symptr = newsyms;
-  symhdr->cbLineOffset += symrel;
-  symhdr->cbDnOffset += symrel;
-  symhdr->cbPdOffset += symrel;
-  symhdr->cbSymOffset += symrel;
-  symhdr->cbOptOffset += symrel;
-  symhdr->cbAuxOffset += symrel;
-  symhdr->cbSsOffset += symrel;
-  symhdr->cbSsExtOffset += symrel;
-  symhdr->cbFdOffset += symrel;
-  symhdr->cbRfdOffset += symrel;
-  symhdr->cbExtOffset += symrel;
-
-  WRITE (new, buffer, cbHDRR, "writing symbol table header of %s", new_name);
-
-  /*
-   * Copy the symbol table and line numbers
-   */
-  WRITE (new, oldptr + ohdr.fhdr.f_symptr + cbHDRR,
-        stat.st_size - ohdr.fhdr.f_symptr - cbHDRR,
-        "writing symbol table of %s", new_name);
-
-#ifdef _REL_DYN
-  if (rel_dyn_section)
-    update_dynamic_symbols (oldptr, new_name, new, nhdr.aout);
-#endif
-
-#undef symhdr
-
-  SEEK (new, 0, "seeking to start of header in %s", new_name);
-  WRITE (new, &nhdr, sizeof (nhdr),
-        "writing header of %s", new_name);
-
-  close (old);
-  close (new);
-  mark_x (new_name);
-}
-
-
-static void
-update_dynamic_symbols (old, new_name, new, aout)
-     char *old;                        /* Pointer to old executable */
-     char *new_name;            /* Name of new executable */
-     int new;                  /* File descriptor for new executable */
-     struct aouthdr aout;      /* a.out info from the file header */
-{
-#if !defined (__linux__) && !defined (__NetBSD__) && !defined (__OpenBSD__)
-
-  typedef struct dynrel_info {
-    char * addr;
-    unsigned type:8;
-    unsigned index:24;
-    unsigned info:8;
-    unsigned pad:8;
-  } dr_info;
-
-  int nsyms = rel_dyn_section->s_size / sizeof (struct dynrel_info);
-  int i;
-  dr_info * rd_base = (dr_info *) (old + rel_dyn_section->s_scnptr);
-  Elf32_Sym * ds_base = (Elf32_Sym *) (old + dynsym_section->s_scnptr);
-
-  for (i = 0; i < nsyms; i++) {
-    register Elf32_Sym x;
-
-    if (rd_base[i].index == 0)
-      continue;
-
-    x = ds_base[rd_base[i].index];
-
-#if 0
-      fprintf (stderr, "Object inspected: %s, addr = %lx, shndx = %x",
-              old + dynstr_section->s_scnptr + x.st_name, rd_base[i].addr, x.st_shndx);
-#endif
-
-
-    if ((ELF32_ST_BIND (x.st_info) == STB_GLOBAL)
-       && (x.st_shndx == 0)
-       /* && (x.st_value == NULL) */
-       ) {
-      /* OK, this is probably a reference to an object in a shared
-        library, so copy the old value. This is done in several steps:
-        1. reladdr is the address of the location in question relative to
-            the start of the data section,
-         2. oldref is the addr is the mapped in temacs executable,
-         3. newref is the address of the location in question in the
-            undumped executable,
-         4. len is the size of the object reference in bytes --
-            currently only 4 (long) and 8 (quad) are supported.
-           */
-      register unsigned long reladdr = (long)rd_base[i].addr - old_data_scnhdr.s_vaddr;
-      char * oldref = old + old_data_scnhdr.s_scnptr + reladdr;
-      unsigned long newref = aout.tsize + reladdr;
-      int len;
-
-#if 0
-      fprintf (stderr, "...relocated\n");
-#endif
-
-      if (rd_base[i].type == R_REFLONG)
-       len = 4;
-      else if (rd_base[i].type == R_REFQUAD)
-       len = 8;
-      else
-       fatal_unexec ("unrecognized relocation type in .dyn.rel section (symbol #%d)", (char *) i);
-
-      SEEK (new, newref, "seeking to dynamic symbol in %s", new_name);
-      WRITE (new, oldref, len, "writing old dynrel info in %s", new_name);
-    }
-
-#if 0
-    else
-      fprintf (stderr, "...not relocated\n");
-#endif
-
-  }
-
-#endif /* not __linux__ and not __NetBSD__ and not __OpenBSD__ */
-}
-
-\f
-/*
- * mark_x
- *
- * After successfully building the new a.out, mark it executable
- */
-
-static void
-mark_x (name)
-     char *name;
-{
-  struct stat sbuf;
-  int um = umask (777);
-  umask (um);
-  if (stat (name, &sbuf) < 0)
-    fatal_unexec ("getting protection on %s", name);
-  sbuf.st_mode |= 0111 & ~um;
-  if (chmod (name, sbuf.st_mode) < 0)
-    fatal_unexec ("setting protection on %s", name);
-}
-
-static void
-fatal_unexec (s, arg)
-     char *s;
-     char *arg;
-{
-  if (errno == EEOF)
-    fputs ("unexec: unexpected end of file, ", stderr);
-  else
-    fprintf (stderr, "unexec: %s, ", strerror (errno));
-  fprintf (stderr, s, arg);
-  fputs (".\n", stderr);
-  exit (1);
-}
-
-/* arch-tag: 46316c49-ee08-4aa3-942b-00798902f5bd
-   (do not change this comment) */
similarity index 75%
rename from src/unexec.c
rename to src/unexcoff.c
index d1921069af7b3773ebe0dc1bb2370d9a267e164a..cb4b8d603b523f61cc760997d906cc90073d640f 100644 (file)
@@ -18,12 +18,19 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 
 /*
- * unexec.c - Convert a running program into an a.out file.
+ * unexcoff.c - Convert a running program into an a.out or COFF file.
+ *
+ * ==================================================================
+ * Note: This file is currently used only by the MSDOS (a.k.a. DJGPP)
+ * build of Emacs.  If you are not interested in the MSDOS build, you
+ * are looking at the wrong version of unexec!
+ * ==================================================================
  *
  * Author:     Spencer W. Thomas
  *             Computer Science Dept.
  *             University of Utah
  * Date:       Tue Mar  2 1982
+ * Originally under the name unexec.c.
  * Modified heavily since then.
  *
  * Synopsis:
@@ -48,8 +55,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
  *
  * Specifying zero for data_start means the boundary between text and data
  * should not be the same as when the program was loaded.
- * If NO_REMAP is defined, the argument data_start is ignored and the
- * segment boundaries are never changed.
  *
  * Bss_start indicates how much of the data segment is to be saved in the
  * a.out file and restored when the program is executed.  It gives the lowest
@@ -69,73 +74,18 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
  * of Dell Computer Corporation.  james@bigtex.cactus.org.
  */
 
-/* There are several compilation parameters affecting unexec:
-
-* COFF
-
-Define this if your system uses COFF for executables.
-
-* NO_REMAP
-
-Define this if you do not want to try to save Emacs's pure data areas
-as part of the text segment.
-
-Saving them as text is good because it allows users to share more.
-
-However, on machines that locate the text area far from the data area,
-the boundary cannot feasibly be moved.  Such machines require
-NO_REMAP.
-
-Also, remapping can cause trouble with the built-in startup routine
-/lib/crt0.o, which defines `environ' as an initialized variable.
-Dumping `environ' as pure does not work!  So, to use remapping,
-you must write a startup routine for your machine in Emacs's crt0.c.
-If NO_REMAP is defined, Emacs uses the system's crt0.o.
-
-* SECTION_ALIGNMENT
-
-Some machines that use COFF executables require that each section
-start on a certain boundary *in the COFF file*.  Such machines should
-define SECTION_ALIGNMENT to a mask of the low-order bits that must be
-zero on such a boundary.  This mask is used to control padding between
-segments in the COFF file.
-
-If SECTION_ALIGNMENT is not defined, the segments are written
-consecutively with no attempt at alignment.  This is right for
-unmodified system V.
-
-* SEGMENT_MASK
-
-Some machines require that the beginnings and ends of segments
-*in core* be on certain boundaries.  For most machines, a page
-boundary is sufficient.  That is the default.  When a larger
-boundary is needed, define SEGMENT_MASK to a mask of
-the bits that must be zero on such a boundary.
-
-* ADJUST_EXEC_HEADER
-
-This macro can be used to generate statements to adjust or
-initialize nonstandard fields in the file header
-
-*/
-
-#ifndef emacs
-#define PERROR(arg) perror (arg); return -1
-#else
 #include <config.h>
 #define PERROR(file) report_error (file, new)
-#endif
 
 #ifndef CANNOT_DUMP  /* all rest of file!  */
 
 #ifdef HAVE_COFF_H
 #include <coff.h>
 #ifdef MSDOS
-#if __DJGPP__ > 1
 #include <fcntl.h>  /* for O_RDONLY, O_RDWR */
 #include <crt0.h>   /* for _crt0_startup_flags and its bits */
+#include <sys/exceptn.h>
 static int save_djgpp_startup_flags;
-#endif /* __DJGPP__ > 1 */
 #define filehdr external_filehdr
 #define scnhdr external_scnhdr
 #define syment external_syment
@@ -179,8 +129,7 @@ struct aouthdr
 #endif
 
 
-extern char *start_of_text ();         /* Start of text */
-extern char *start_of_data ();         /* Start of initialized data */
+extern char *start_of_data (void);             /* Start of initialized data */
 
 static long block_copy_start;          /* Old executable start point */
 static struct filehdr f_hdr;           /* File header */
@@ -202,45 +151,33 @@ static int pagemask;
 
 #define ADDR_CORRECT(x) ((char *)(x) - (char*)0)
 
-#ifdef emacs
-
 #include <setjmp.h>
 #include "lisp.h"
 
-static
-report_error (file, fd)
-     char *file;
-     int fd;
+static void
+report_error (const char *file, int fd)
 {
   if (fd)
     close (fd);
   report_file_error ("Cannot unexec", Fcons (build_string (file), Qnil));
 }
-#endif /* emacs */
 
 #define ERROR0(msg) report_error_1 (new, msg, 0, 0); return -1
 #define ERROR1(msg,x) report_error_1 (new, msg, x, 0); return -1
 #define ERROR2(msg,x,y) report_error_1 (new, msg, x, y); return -1
 
-static
-report_error_1 (fd, msg, a1, a2)
-     int fd;
-     char *msg;
-     int a1, a2;
+static void
+report_error_1 (int fd, const char *msg, int a1, int a2)
 {
   close (fd);
-#ifdef emacs
   error (msg, a1, a2);
-#else
-  fprintf (stderr, msg, a1, a2);
-  fprintf (stderr, "\n");
-#endif
 }
 \f
-static int make_hdr ();
-static int copy_text_and_data ();
-static int copy_sym ();
-static void mark_x ();
+static int make_hdr (int, int, unsigned, unsigned, unsigned,
+                    const char *, const char *);
+static int copy_text_and_data (int, int);
+static int copy_sym (int, int, const char *, const char *);
+static void mark_x (const char *);
 
 /* ****************************************************************
  * make_hdr
@@ -249,13 +186,9 @@ static void mark_x ();
  * Modify the text and data sizes.
  */
 static int
-make_hdr (new, a_out, data_start, bss_start, entry_address, a_name, new_name)
-     int new, a_out;
-     unsigned data_start, bss_start, entry_address;
-     char *a_name;
-     char *new_name;
+make_hdr (int new, int a_out, unsigned data_start, unsigned bss_start,
+         unsigned entry_address, const char *a_name, const char *new_name)
 {
-  int tem;
   auto struct scnhdr f_thdr;           /* Text section header */
   auto struct scnhdr f_dhdr;           /* Data section header */
   auto struct scnhdr f_bhdr;           /* Bss section header */
@@ -266,19 +199,9 @@ make_hdr (new, a_out, data_start, bss_start, entry_address, a_name, new_name)
   pagemask = getpagesize () - 1;
 
   /* Adjust text/data boundary. */
-#ifdef NO_REMAP
   data_start = (int) start_of_data ();
-#else /* not NO_REMAP */
-  if (!data_start)
-    data_start = (int) start_of_data ();
-#endif /* not NO_REMAP */
   data_start = ADDR_CORRECT (data_start);
-
-#ifdef SEGMENT_MASK
-  data_start = data_start & ~SEGMENT_MASK; /* (Down) to segment boundary. */
-#else
   data_start = data_start & ~pagemask; /* (Down) to page boundary. */
-#endif
 
   bss_end = ADDR_CORRECT (sbrk (0)) + pagemask;
   bss_end &= ~ pagemask;
@@ -310,7 +233,6 @@ make_hdr (new, a_out, data_start, bss_start, entry_address, a_name, new_name)
   if (a_out >= 0)
     {
 #ifdef MSDOS
-#if __DJGPP__ > 1
       /* Support the coff-go32-exe format with a prepended stub, since
         this is what GCC 2.8.0 and later generates by default in DJGPP.  */
       unsigned short mz_header[3];
@@ -328,7 +250,6 @@ make_hdr (new, a_out, data_start, bss_start, entry_address, a_name, new_name)
        }
       else
        lseek (a_out, 0L, 0);
-#endif /* __DJGPP__ > 1 */
 #endif /* MSDOS */
       if (read (a_out, &f_hdr, sizeof (f_hdr)) != sizeof (f_hdr))
        {
@@ -378,42 +299,17 @@ make_hdr (new, a_out, data_start, bss_start, entry_address, a_name, new_name)
      to correspond to what we want to dump.  */
 
   f_hdr.f_flags |= (F_RELFLG | F_EXEC);
-#ifndef NO_REMAP
-  f_ohdr.text_start = (long) start_of_text ();
-  f_ohdr.tsize = data_start - f_ohdr.text_start;
-  f_ohdr.data_start = data_start;
-#endif /* NO_REMAP */
   f_ohdr.dsize = bss_start - f_ohdr.data_start;
   f_ohdr.bsize = bss_end - bss_start;
-  /* On some machines, the old values are right.
-     ??? Maybe on all machines with NO_REMAP.  */
   f_thdr.s_size = f_ohdr.tsize;
   f_thdr.s_scnptr = sizeof (f_hdr) + sizeof (f_ohdr);
   f_thdr.s_scnptr += (f_hdr.f_nscns) * (sizeof (f_thdr));
   lnnoptr = f_thdr.s_lnnoptr;
-#ifdef SECTION_ALIGNMENT
-  /* Some systems require special alignment
-     of the sections in the file itself.  */
-  f_thdr.s_scnptr
-    = (f_thdr.s_scnptr + SECTION_ALIGNMENT) & ~SECTION_ALIGNMENT;
-#endif /* SECTION_ALIGNMENT */
   text_scnptr = f_thdr.s_scnptr;
   f_dhdr.s_paddr = f_ohdr.data_start;
   f_dhdr.s_vaddr = f_ohdr.data_start;
   f_dhdr.s_size = f_ohdr.dsize;
   f_dhdr.s_scnptr = f_thdr.s_scnptr + f_thdr.s_size;
-#ifdef SECTION_ALIGNMENT
-  /* Some systems require special alignment
-     of the sections in the file itself.  */
-  f_dhdr.s_scnptr
-    = (f_dhdr.s_scnptr + SECTION_ALIGNMENT) & ~SECTION_ALIGNMENT;
-#endif /* SECTION_ALIGNMENT */
-#ifdef DATA_SECTION_ALIGNMENT
-  /* Some systems require special alignment
-     of the data section only.  */
-  f_dhdr.s_scnptr
-    = (f_dhdr.s_scnptr + DATA_SECTION_ALIGNMENT) & ~DATA_SECTION_ALIGNMENT;
-#endif /* DATA_SECTION_ALIGNMENT */
   data_scnptr = f_dhdr.s_scnptr;
   f_bhdr.s_paddr = f_ohdr.data_start + f_ohdr.dsize;
   f_bhdr.s_vaddr = f_ohdr.data_start + f_ohdr.dsize;
@@ -431,10 +327,6 @@ make_hdr (new, a_out, data_start, bss_start, entry_address, a_name, new_name)
       f_thdr.s_lnnoptr += bias;
     }
 
-#ifdef ADJUST_EXEC_HEADER
-  ADJUST_EXEC_HEADER;
-#endif /* ADJUST_EXEC_HEADER */
-
   if (write (new, &f_hdr, sizeof (f_hdr)) != sizeof (f_hdr))
     {
       PERROR (new_name);
@@ -464,22 +356,17 @@ make_hdr (new, a_out, data_start, bss_start, entry_address, a_name, new_name)
 
 }
 \f
-write_segment (new, ptr, end)
-     int new;
-     register char *ptr, *end;
+void
+write_segment (int new, const char *ptr, const char *end)
 {
   register int i, nwrite, ret;
-  char buf[80];
-#ifndef USE_CRT_DLL
-  extern int errno;
-#endif
   /* This is the normal amount to write at once.
      It is the size of block that NFS uses.  */
   int writesize = 1 << 13;
   int pagesize = getpagesize ();
   char zeros[1 << 13];
 
-  bzero (zeros, sizeof (zeros));
+  memset (zeros, 0, sizeof (zeros));
 
   for (i = 0; ptr < end;)
     {
@@ -505,16 +392,6 @@ write_segment (new, ptr, end)
            nwrite = pagesize;
          write (new, zeros, nwrite);
        }
-#if 0 /* Now that we have can ask `write' to write more than a page,
-        it is legit for write do less than the whole amount specified.  */
-      else if (nwrite != ret)
-       {
-         sprintf (buf,
-                  "unexec write failure: addr 0x%x, fileno %d, size 0x%x, wrote 0x%x, errno %d",
-                  ptr, new, nwrite, ret, errno);
-         PERROR (buf);
-       }
-#endif
       i += nwrite;
       ptr += nwrite;
     }
@@ -525,14 +402,12 @@ write_segment (new, ptr, end)
  * Copy the text and data segments from memory to the new a.out
  */
 static int
-copy_text_and_data (new, a_out)
-     int new, a_out;
+copy_text_and_data (int new, int a_out)
 {
   register char *end;
   register char *ptr;
 
 #ifdef MSDOS
-#if __DJGPP__ >= 2
   /* Dump the original table of exception handlers, not the one
      where our exception hooks are registered.  */
   __djgpp_exception_toggle ();
@@ -541,7 +416,6 @@ copy_text_and_data (new, a_out)
      and which might change the way that dumped Emacs works.  */
   save_djgpp_startup_flags = _crt0_startup_flags;
   _crt0_startup_flags &= ~(_CRT0_FLAG_NO_LFN | _CRT0_FLAG_NEARPTR);
-#endif
 #endif
 
   lseek (new, (long) text_scnptr, 0);
@@ -555,14 +429,12 @@ copy_text_and_data (new, a_out)
   write_segment (new, ptr, end);
 
 #ifdef MSDOS
-#if __DJGPP__ >= 2
   /* Restore our exception hooks.  */
   __djgpp_exception_toggle ();
 
   /* Restore the startup flags.  */
   _crt0_startup_flags = save_djgpp_startup_flags;
 #endif
-#endif
 
 
   return 0;
@@ -574,9 +446,7 @@ copy_text_and_data (new, a_out)
  * Copy the relocation information and symbol table from the a.out to the new
  */
 static int
-copy_sym (new, a_out, a_name, new_name)
-     int new, a_out;
-     char *a_name, *new_name;
+copy_sym (int new, int a_out, const char *a_name, const char *new_name)
 {
   char page[1024];
   int n;
@@ -612,8 +482,7 @@ copy_sym (new, a_out, a_name, new_name)
  * After successfully building the new a.out, mark it executable
  */
 static void
-mark_x (name)
-     char *name;
+mark_x (const char *name)
 {
   struct stat sbuf;
   int um;
@@ -630,7 +499,6 @@ mark_x (name)
     PERROR (name);
 }
 \f
-#ifndef COFF_BSD_SYMBOLS
 
 /*
  *     If the COFF file contains a symbol table and a line number section,
@@ -654,10 +522,8 @@ mark_x (name)
    a reasonable size buffer.  But I don't have time to work on such
    things, so I am installing it as submitted to me.  -- RMS.  */
 
-adjust_lnnoptrs (writedesc, readdesc, new_name)
-     int writedesc;
-     int readdesc;
-     char *new_name;
+int
+adjust_lnnoptrs (int writedesc, int readdesc, const char *new_name)
 {
   register int nsyms;
   register int new;
@@ -699,18 +565,16 @@ adjust_lnnoptrs (writedesc, readdesc, new_name)
   return 0;
 }
 
-#endif /* COFF_BSD_SYMBOLS */
-
 /* ****************************************************************
  * unexec
  *
  * driving logic.
  */
-unexec (new_name, a_name, data_start, bss_start, entry_address)
-     char *new_name, *a_name;
-     unsigned data_start, bss_start, entry_address;
+int
+unexec (const char *new_name, const char *a_name,
+       unsigned data_start, unsigned bss_start, unsigned entry_address)
 {
-  int new, a_out = -1;
+  int new = -1, a_out = -1;
 
   if (a_name && (a_out = open (a_name, O_RDONLY)) < 0)
     {
@@ -724,13 +588,10 @@ unexec (new_name, a_name, data_start, bss_start, entry_address)
   if (make_hdr (new, a_out, data_start, bss_start, entry_address, a_name, new_name) < 0
       || copy_text_and_data (new, a_out) < 0
       || copy_sym (new, a_out, a_name, new_name) < 0
-#ifndef COFF_BSD_SYMBOLS
       || adjust_lnnoptrs (new, a_out, new_name) < 0
-#endif
       )
     {
       close (new);
-      /* unlink (new_name);            /* Failed, unlink new a.out */
       return -1;
     }
 
index a91af9458ebcc905973e17f3596b9f713e9513cf..0de69a4cabc6de6dacfeea6772a2e69185f72f00 100644 (file)
@@ -594,8 +594,7 @@ typedef unsigned char byte;
 /* Round X up to a multiple of Y.  */
 
 static ElfW(Addr)
-round_up (x, y)
-     ElfW(Addr) x, y;
+round_up (ElfW(Addr) x, ElfW(Addr) y)
 {
   int rem = x % y;
   if (rem == 0)
@@ -611,13 +610,8 @@ round_up (x, y)
    if NOERROR is 0; we return -1 if NOERROR is nonzero.  */
 
 static int
-find_section (name, section_names, file_name, old_file_h, old_section_h, noerror)
-     char *name;
-     char *section_names;
-     char *file_name;
-     ElfW(Ehdr) *old_file_h;
-     ElfW(Shdr) *old_section_h;
-     int noerror;
+find_section (const char *name, char *section_names, char *file_name,
+             ElfW(Ehdr) *old_file_h, ElfW(Shdr) *old_section_h, int noerror)
 {
   int idx;
 
@@ -652,9 +646,8 @@ find_section (name, section_names, file_name, old_file_h, old_section_h, noerror
  *
  */
 void
-unexec (new_name, old_name, data_start, bss_start, entry_address)
-     char *new_name, *old_name;
-     unsigned data_start, bss_start, entry_address;
+unexec (char *new_name, char *old_name, unsigned int data_start,
+       unsigned int bss_start, unsigned int entry_address)
 {
   int new_file, old_file, new_file_size;
 
index 3949e5f6e00f9593139b26406cf7dd79c1370b0d..5c450e062c631a8c2a4b88114eee7ac0bea3746e 100644 (file)
@@ -218,7 +218,7 @@ unexec_write_zero (off_t dest, size_t count)
   char buf[UNEXEC_COPY_BUFSZ];
   ssize_t bytes;
 
-  bzero (buf, UNEXEC_COPY_BUFSZ);
+  memset (buf, 0, UNEXEC_COPY_BUFSZ);
   if (lseek (outfd, dest, SEEK_SET) != dest)
     return 0;
 
@@ -267,7 +267,7 @@ unexec_copy (off_t dest, off_t src, ssize_t count)
 /* Debugging and informational messages routines.  */
 
 static void
-unexec_error (char *format, ...)
+unexec_error (const char *format, ...)
 {
   va_list ap;
 
@@ -305,7 +305,7 @@ print_region (vm_address_t address, vm_size_t size, vm_prot_t prot,
 }
 
 static void
-print_region_list ()
+print_region_list (void)
 {
   struct region_t *r;
 
@@ -316,7 +316,7 @@ print_region_list ()
 }
 
 static void
-print_regions ()
+print_regions (void)
 {
   task_t target_task = mach_task_self ();
   vm_address_t address = (vm_address_t) 0;
@@ -346,7 +346,7 @@ print_regions ()
    cannot be omitted because they some regions created at run time are
    read-only.  */
 static void
-build_region_list ()
+build_region_list (void)
 {
   task_t target_task = mach_task_self ();
   vm_address_t address = (vm_address_t) 0;
@@ -465,7 +465,7 @@ unexec_reader (task_t task, vm_address_t address, vm_size_t size, void **ptr)
 }
 
 static void
-find_emacs_zone_regions ()
+find_emacs_zone_regions (void)
 {
   num_unexec_regions = 0;
 
@@ -495,7 +495,7 @@ unexec_regions_sort_compare (const void *a, const void *b)
 }
 
 static void
-unexec_regions_merge ()
+unexec_regions_merge (void)
 {
   int i, n;
   unexec_region_info r;
@@ -627,7 +627,7 @@ print_load_command (struct load_command *lc)
    the global array lca.  Store the total number of load commands in
    global variable nlc.  */
 static void
-read_load_commands ()
+read_load_commands (void)
 {
   int i;
 
@@ -684,8 +684,8 @@ read_load_commands ()
        }
     }
 
-  printf ("Highest address of load commands in input file: %#8x\n",
-         infile_lc_highest_addr);
+  printf ("Highest address of load commands in input file: %#8lx\n",
+         (unsigned long)infile_lc_highest_addr);
 
   printf ("Lowest offset of all sections in __TEXT segment: %#8lx\n",
          text_seg_lowest_offset);
@@ -1143,7 +1143,7 @@ copy_other (struct load_command *lc)
 /* Loop through all load commands and dump them.  Then write the Mach
    header.  */
 static void
-dump_it ()
+dump_it (void)
 {
   int i;
   long linkedit_delta = 0;
@@ -1253,7 +1253,7 @@ unexec (char *outfile, char *infile, void *start_data, void *start_bss,
 
 
 void
-unexec_init_emacs_zone ()
+unexec_init_emacs_zone (void)
 {
   emacs_zone = malloc_create_zone (0, 0);
   malloc_set_zone_name (emacs_zone, "EmacsZone");
index a5b07eb50da0229253b266d913f5364bbf17d9cf..63f0f47e2d002f14788d7b17ecf419336500c848 100644 (file)
@@ -23,19 +23,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "lisp.h"
 #endif
 
-#ifndef emacs
-#include <stddef.h>
-typedef size_t SIZE;
-typedef void *POINTER;
-#define EXCEEDS_LISP_PTR(x) 0
-#endif
-
 #include "mem-limits.h"
 
-#ifdef HAVE_GETRLIMIT
-#include <sys/resource.h>
-#endif
-
 /*
   Level number of warnings already issued.
   0 -- no warnings issued.
@@ -44,12 +33,13 @@ typedef void *POINTER;
   3 -- 95% warning issued; keep warning frequently.
 */
 enum warnlevel { not_warned, warned_75, warned_85, warned_95 };
-
 static enum warnlevel warnlevel;
 
+typedef POINTER_TYPE *POINTER;
+
 /* Function to call to issue a warning;
    0 means don't issue them.  */
-static void (*warn_function) ();
+static void (*warn_function) (const char *);
 
 /* Start of data space; can be changed by calling malloc_init.  */
 static POINTER data_space_start;
@@ -58,17 +48,9 @@ static POINTER data_space_start;
 static unsigned long lim_data;
 \f
 
-#ifdef NO_LIM_DATA
-static void
-get_lim_data ()
-{
-  lim_data = -1;
-}
-#else /* not NO_LIM_DATA */
-
 #if defined (HAVE_GETRLIMIT) && defined (RLIMIT_AS)
 static void
-get_lim_data ()
+get_lim_data (void)
 {
   struct rlimit rlimit;
 
@@ -84,7 +66,7 @@ get_lim_data ()
 #ifdef USG
 
 static void
-get_lim_data ()
+get_lim_data (void)
 {
   extern long ulimit ();
 
@@ -108,18 +90,18 @@ get_lim_data ()
 #ifdef WINDOWSNT
 
 static void
-get_lim_data ()
+get_lim_data (void)
 {
   extern unsigned long reserved_heap_size;
   lim_data = reserved_heap_size;
 }
 
 #else
-#if !defined (BSD4_2) && !defined (__osf__)
+#if !defined (BSD4_2) && !defined (CYGWIN)
 
 #ifdef MSDOS
 void
-get_lim_data ()
+get_lim_data (void)
 {
   _go32_dpmi_meminfo info;
   unsigned long lim1, lim2;
@@ -150,23 +132,23 @@ get_lim_data ()
 }
 
 unsigned long
-ret_lim_data ()
+ret_lim_data (void)
 {
   get_lim_data ();
   return lim_data;
 }
 #else /* not MSDOS */
 static void
-get_lim_data ()
+get_lim_data (void)
 {
   lim_data = vlimit (LIM_DATA, -1);
 }
 #endif /* not MSDOS */
 
-#else /* BSD4_2 */
+#else /* BSD4_2 || CYGWIN */
 
 static void
-get_lim_data ()
+get_lim_data (void)
 {
   struct rlimit XXrlimit;
 
@@ -181,17 +163,16 @@ get_lim_data ()
 #endif /* not WINDOWSNT */
 #endif /* not USG */
 #endif /* not HAVE_GETRLIMIT */
-#endif /* not NO_LIM_DATA */
 \f
 /* Verify amount of memory available, complaining if we're near the end. */
 
 static void
-check_memory_limits ()
+check_memory_limits (void)
 {
 #ifdef REL_ALLOC
-  extern POINTER (*real_morecore) ();
+  extern POINTER (*real_morecore) (SIZE);
 #endif
-  extern POINTER (*__morecore) ();
+  extern POINTER (*__morecore) (SIZE);
 
   register POINTER cp;
   unsigned long five_percent;
@@ -260,16 +241,54 @@ check_memory_limits ()
     (*warn_function) ("Warning: memory in use exceeds lisp pointer size");
 }
 \f
+#if !defined(CANNOT_DUMP) || !defined(SYSTEM_MALLOC)
+/* Some systems that cannot dump also cannot implement these.  */
+
+/*
+ *     Return the address of the start of the data segment prior to
+ *     doing an unexec.  After unexec the return value is undefined.
+ *     See crt0.c for further information and definition of data_start.
+ *
+ *     Apparently, on BSD systems this is etext at startup.  On
+ *     USG systems (swapping) this is highly mmu dependent and
+ *     is also dependent on whether or not the program is running
+ *     with shared text.  Generally there is a (possibly large)
+ *     gap between end of text and start of data with shared text.
+ *
+ */
+
+char *
+start_of_data (void)
+{
+#ifdef BSD_SYSTEM
+  extern char etext;
+  return (POINTER)(&etext);
+#elif defined DATA_START
+  return ((POINTER) DATA_START);
+#elif defined ORDINARY_LINK
+  /*
+   * This is a hack.  Since we're not linking crt0.c or pre_crt0.c,
+   * data_start isn't defined.  We take the address of environ, which
+   * is known to live at or near the start of the system crt0.c, and
+   * we don't sweat the handful of bytes that might lose.
+   */
+  extern char **environ;
+  return ((POINTER) &environ);
+#else
+  extern int data_start;
+  return ((POINTER) &data_start);
+#endif
+}
+#endif /* (not CANNOT_DUMP or not SYSTEM_MALLOC) */
+\f
 /* Enable memory usage warnings.
    START says where the end of pure storage is.
    WARNFUN specifies the function to call to issue a warning.  */
 
 void
-memory_warnings (start, warnfun)
-     POINTER start;
-     void (*warnfun) ();
+memory_warnings (POINTER start, void (*warnfun) (const char *))
 {
-  extern void (* __after_morecore_hook) ();     /* From gmalloc.c */
+  extern void (* __after_morecore_hook) (void);     /* From gmalloc.c */
 
   if (start)
     data_space_start = start;
index d6951be4d82a7e970d7961a8d058b454a8891331..ef1b974752bb9859e0aecd59bd8f2258275d1ab7 100644 (file)
@@ -23,7 +23,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    menus, and the Windows clipboard.  */
 
 /* Written by Dale P. Smith <dpsm@en.com>  */
-/* Adapted to DJGPP v1 by Eli Zaretskii <eliz@is.elta.co.il>  */
+/* Adapted to DJGPP by Eli Zaretskii <eliz@gnu.org>  */
 
 #ifdef MSDOS
 
@@ -94,25 +94,6 @@ static unsigned char *last_clipboard_text;
 /* The size of allocated storage for storing the clipboard data.  */
 static size_t clipboard_storage_size;
 \f
-/* Emulation of `__dpmi_int' and friends for DJGPP v1.x  */
-
-#if __DJGPP__ < 2
-
-typedef _go32_dpmi_registers __dpmi_regs;
-#define __tb      _go32_info_block.linear_address_of_transfer_buffer
-#define _dos_ds          _go32_info_block.selector_for_linear_memory
-
-static int
-__dpmi_int (intno, regs)
-     int intno;
-     __dpmi_regs *regs;
-{
-  regs->x.ss = regs->x.sp = regs->x.flags = 0;
-  return _go32_dpmi_simulate_int (intno, regs);
-}
-
-#endif /* __DJGPP__ < 2 */
-\f
 /* C functions to access the Windows 3.1x clipboard from DOS apps.
 
    The information was obtained from the Microsoft Knowledge Base,
@@ -128,7 +109,7 @@ __dpmi_int (intno, regs)
 
 /* Return the WinOldAp support version, or 0x1700 if not supported.  */
 unsigned
-identify_winoldap_version ()
+identify_winoldap_version (void)
 {
   __dpmi_regs regs;
 
@@ -143,7 +124,7 @@ identify_winoldap_version ()
 
 /* Open the clipboard, return non-zero if successfull.  */
 unsigned
-open_clipboard ()
+open_clipboard (void)
 {
   __dpmi_regs regs;
 
@@ -166,7 +147,7 @@ open_clipboard ()
 
 /* Empty clipboard, return non-zero if successfull.  */
 unsigned
-empty_clipboard ()
+empty_clipboard (void)
 {
   __dpmi_regs regs;
 
@@ -181,8 +162,7 @@ empty_clipboard ()
 /* Ensure we have a buffer in low memory with enough memory for data
    of size WANT_SIZE.  Return the linear address of the buffer.  */
 static unsigned long
-alloc_xfer_buf (want_size)
-     unsigned want_size;
+alloc_xfer_buf (unsigned want_size)
 {
   __dpmi_regs regs;
 
@@ -219,7 +199,7 @@ alloc_xfer_buf (want_size)
    The clipboard buffer tends to be large in size, because for small
    clipboard data sizes we use the DJGPP transfer buffer.  */
 static void
-free_xfer_buf ()
+free_xfer_buf (void)
 {
   /* If the size is 0, we used DJGPP transfer buffer, so don't free.  */
   if (clipboard_xfer_buf_info.size)
@@ -237,11 +217,7 @@ free_xfer_buf ()
 
 /* Copy data into the clipboard, return zero if successfull.  */
 unsigned
-set_clipboard_data (Format, Data, Size, Raw)
-     unsigned Format;
-     void *Data;
-     unsigned Size;
-     int Raw;
+set_clipboard_data (unsigned Format, void *Data, unsigned Size, int Raw)
 {
   __dpmi_regs regs;
   unsigned truelen;
@@ -340,8 +316,7 @@ set_clipboard_data (Format, Data, Size, Raw)
 
 /* Return the size of the clipboard data of format FORMAT.  */
 unsigned
-get_clipboard_data_size (Format)
-     unsigned Format;
+get_clipboard_data_size (unsigned Format)
 {
   __dpmi_regs regs;
 
@@ -361,11 +336,7 @@ get_clipboard_data_size (Format)
    Warning: this doesn't check whether DATA has enough space to hold
    SIZE bytes.  */
 unsigned
-get_clipboard_data (Format, Data, Size, Raw)
-     unsigned Format;
-     void *Data;
-     unsigned Size;
-     int Raw;
+get_clipboard_data (unsigned Format, void *Data, unsigned Size, int Raw)
 {
   __dpmi_regs regs;
   unsigned long xbuf_addr;
@@ -444,7 +415,7 @@ get_clipboard_data (Format, Data, Size, Raw)
 
 /* Close clipboard, return non-zero if successfull.  */
 unsigned
-close_clipboard ()
+close_clipboard (void)
 {
   __dpmi_regs regs;
 
@@ -458,8 +429,7 @@ close_clipboard ()
 
 /* Compact clipboard data so that at least SIZE bytes is available.  */
 unsigned
-clipboard_compact (Size)
-     unsigned Size;
+clipboard_compact (unsigned Size)
 {
   __dpmi_regs regs;
 
@@ -483,11 +453,10 @@ static char system_error_msg[] =
 
 DEFUN ("w16-set-clipboard-data", Fw16_set_clipboard_data, Sw16_set_clipboard_data, 1, 2, 0,
        doc: /* This sets the clipboard data to the given text.  */)
-     (string, frame)
-     Lisp_Object string, frame;
+  (Lisp_Object string, Lisp_Object frame)
 {
   unsigned ok = 1, put_status = 0;
-  int nbytes, charset_info, no_crlf_conversion;
+  int nbytes, no_crlf_conversion;
   unsigned char *src, *dst = NULL;
 
   CHECK_STRING (string);
@@ -525,9 +494,7 @@ DEFUN ("w16-set-clipboard-data", Fw16_set_clipboard_data, Sw16_set_clipboard_dat
     {
       /* We must encode contents of STRING according to what
         clipboard-coding-system specifies.  */
-      int bufsize;
       struct coding_system coding;
-      unsigned char *htext2;
       Lisp_Object coding_system =
        NILP (Vnext_selection_coding_system) ?
        Vselection_coding_system : Vnext_selection_coding_system;
@@ -593,13 +560,12 @@ DEFUN ("w16-set-clipboard-data", Fw16_set_clipboard_data, Sw16_set_clipboard_dat
 
 DEFUN ("w16-get-clipboard-data", Fw16_get_clipboard_data, Sw16_get_clipboard_data, 0, 1, 0,
        doc: /* This gets the clipboard data in text format.  */)
-     (frame)
-     Lisp_Object frame;
+  (Lisp_Object frame)
 {
   unsigned data_size, truelen;
   unsigned char *htext = NULL;
   Lisp_Object ret = Qnil;
-  int no_crlf_conversion, require_decoding = 0;
+  int require_decoding = 0;
 
   if (NILP (frame))
     frame = Fselected_frame ();
@@ -640,8 +606,6 @@ DEFUN ("w16-get-clipboard-data", Fw16_get_clipboard_data, Sw16_get_clipboard_dat
   }
   if (require_decoding)
     {
-      int bufsize;
-      unsigned char *buf;
       struct coding_system coding;
       Lisp_Object coding_system = Vnext_selection_coding_system;
 
@@ -688,8 +652,7 @@ the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'.
 \(Those are literal upper-case symbol names, since that's what X expects.)
 For convenience, the symbol nil is the same as `PRIMARY',
 and t is the same as `SECONDARY'.  */)
-     (selection)
-     Lisp_Object selection;
+  (Lisp_Object selection)
 {
   CHECK_SYMBOL (selection);
 
@@ -704,8 +667,8 @@ and t is the same as `SECONDARY'.  */)
      into the clipboard if we run under Windows, so we cannot check
      the clipboard alone.)  */
   if ((EQ (selection, Qnil) || EQ (selection, QPRIMARY))
-      && ! NILP (SYMBOL_VALUE (Fintern_soft (build_string ("kill-ring"),
-                                            Qnil))))
+      && ! NILP (Fsymbol_value (Fintern_soft (build_string ("kill-ring"),
+                                             Qnil))))
     return Qt;
 
   if (EQ (selection, QCLIPBOARD))
@@ -724,7 +687,7 @@ and t is the same as `SECONDARY'.  */)
 }
 
 void
-syms_of_win16select ()
+syms_of_win16select (void)
 {
   defsubr (&Sw16_set_clipboard_data);
   defsubr (&Sw16_get_clipboard_data);
index 2ff344abd654e9de998fa3fe10f9aff08a223d40..f1ed6ae0be9e1cab60b2838367a80f0f73bec7b7 100644 (file)
--- a/src/w32.c
+++ b/src/w32.c
@@ -140,15 +140,11 @@ typedef struct _PROCESS_MEMORY_COUNTERS_EX {
 
 /* For serial_configure and serial_open.  */
 #include "process.h"
-/* From process.c  */
-extern Lisp_Object QCport, QCspeed, QCprocess;
-extern Lisp_Object QCbytesize, QCstopbits, QCparity, Qodd, Qeven;
-extern Lisp_Object QCflowcontrol, Qhw, Qsw, QCsummary;
 
 typedef HRESULT (WINAPI * ShGetFolderPath_fn)
   (IN HWND, IN int, IN HANDLE, IN DWORD, OUT char *);
 
-void globals_of_w32 ();
+void globals_of_w32 (void);
 static DWORD get_rid (PSID);
 
 extern Lisp_Object Vw32_downcase_file_names;
@@ -308,15 +304,15 @@ typedef BOOL (WINAPI * GetSystemTimes_Proc) (
 
   /* ** A utility function ** */
 static BOOL
-is_windows_9x ()
+is_windows_9x (void)
 {
   static BOOL s_b_ret=0;
   OSVERSIONINFO os_ver;
   if (g_b_init_is_windows_9x == 0)
     {
       g_b_init_is_windows_9x = 1;
-      ZeroMemory(&os_ver, sizeof(OSVERSIONINFO));
-      os_ver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+      ZeroMemory (&os_ver, sizeof (OSVERSIONINFO));
+      os_ver.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
       if (GetVersionEx (&os_ver))
         {
           s_b_ret = (os_ver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS);
@@ -329,12 +325,12 @@ is_windows_9x ()
    Returns a list of three 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 ()
+w32_get_internal_run_time (void)
 {
   if (get_process_times_fn)
     {
       FILETIME create, exit, kernel, user;
-      HANDLE proc = GetCurrentProcess();
+      HANDLE proc = GetCurrentProcess ();
       if ((*get_process_times_fn) (proc, &create, &exit, &kernel, &user))
         {
           LARGE_INTEGER user_int, kernel_int, total;
@@ -753,7 +749,7 @@ void WINAPI get_native_system_info (
     lpSystemInfo->dwNumberOfProcessors = -1;
 }
 
-BOOL WINAPI get_system_times(
+BOOL WINAPI get_system_times (
     LPFILETIME lpIdleTime,
     LPFILETIME lpKernelTime,
     LPFILETIME lpUserTime)
@@ -1035,13 +1031,13 @@ static struct group dflt_group =
 };
 
 unsigned
-getuid ()
+getuid (void)
 {
   return dflt_passwd.pw_uid;
 }
 
 unsigned
-geteuid ()
+geteuid (void)
 {
   /* I could imagine arguing for checking to see whether the user is
      in the Administrators group and returning a UID of 0 for that
@@ -1050,13 +1046,13 @@ geteuid ()
 }
 
 unsigned
-getgid ()
+getgid (void)
 {
   return dflt_passwd.pw_gid;
 }
 
 unsigned
-getegid ()
+getegid (void)
 {
   return getgid ();
 }
@@ -1091,7 +1087,7 @@ getpwnam (char *name)
 }
 
 void
-init_user_info ()
+init_user_info (void)
 {
   /* Find the user's real name by opening the process token and
      looking up the name associated with the user-sid in that token.
@@ -1207,7 +1203,7 @@ init_user_info ()
 }
 
 int
-random ()
+random (void)
 {
   /* rand () on NT gives us 15 random bits...hack together 30 bits.  */
   return ((rand () << 15) | rand ());
@@ -1225,9 +1221,7 @@ srandom (int seed)
    case path name components to lower case.  */
 
 static void
-normalize_filename (fp, path_sep)
-     register char *fp;
-     char path_sep;
+normalize_filename (register char *fp, char path_sep)
 {
   char sep;
   char *elem;
@@ -1283,16 +1277,14 @@ normalize_filename (fp, path_sep)
 
 /* Destructively turn backslashes into slashes.  */
 void
-dostounix_filename (p)
-     register char *p;
+dostounix_filename (register char *p)
 {
   normalize_filename (p, '/');
 }
 
 /* Destructively turn slashes into backslashes.  */
 void
-unixtodos_filename (p)
-     register char *p;
+unixtodos_filename (register char *p)
 {
   normalize_filename (p, '\\');
 }
@@ -1301,9 +1293,7 @@ unixtodos_filename (p)
    (From msdos.c...probably should figure out a way to share it,
    although this code isn't going to ever change.)  */
 int
-crlf_to_lf (n, buf)
-     register int n;
-     register unsigned char *buf;
+crlf_to_lf (register int n, register unsigned char *buf)
 {
   unsigned char *np = buf;
   unsigned char *startp = buf;
@@ -1481,6 +1471,30 @@ sigunblock (int sig)
   return 0;
 }
 
+int
+sigemptyset (sigset_t *set)
+{
+  return 0;
+}
+
+int
+sigaddset (sigset_t *set, int signo)
+{
+  return 0;
+}
+
+int
+sigfillset (sigset_t *set)
+{
+  return 0;
+}
+
+int
+sigprocmask (int how, const sigset_t *set, sigset_t *oset)
+{
+  return 0;
+}
+
 int
 setpgrp (int pid, int gid)
 {
@@ -1496,9 +1510,7 @@ alarm (int seconds)
 #define REG_ROOT "SOFTWARE\\GNU\\Emacs"
 
 LPBYTE
-w32_get_resource (key, lpdwtype)
-    char *key;
-    LPDWORD lpdwtype;
+w32_get_resource (char *key, LPDWORD lpdwtype)
 {
   LPBYTE lpvalue;
   HKEY hrootkey = NULL;
@@ -1618,7 +1630,7 @@ init_environment (char ** argv)
       {"LANG", NULL},
     };
 
-#define N_ENV_VARS sizeof(dflt_envvars)/sizeof(dflt_envvars[0])
+#define N_ENV_VARS sizeof (dflt_envvars)/sizeof (dflt_envvars[0])
 
     /* We need to copy dflt_envvars[] and work on the copy because we
        don't want the dumped Emacs to inherit the values of
@@ -1691,7 +1703,7 @@ init_environment (char ** argv)
          for (p = modname; *p; p++)
            if (*p == '\\') *p = '/';
 
-         _snprintf (buf, sizeof(buf)-1, "emacs_dir=%s", modname);
+         _snprintf (buf, sizeof (buf)-1, "emacs_dir=%s", modname);
          _putenv (strdup (buf));
        }
       /* Handle running emacs from the build directory: src/oo-spd/i386/  */
@@ -1715,7 +1727,7 @@ init_environment (char ** argv)
                  for (p = modname; *p; p++)
                    if (*p == '\\') *p = '/';
 
-                 _snprintf (buf, sizeof(buf)-1, "emacs_dir=%s", modname);
+                 _snprintf (buf, sizeof (buf)-1, "emacs_dir=%s", modname);
                  _putenv (strdup (buf));
                }
            }
@@ -1743,12 +1755,12 @@ init_environment (char ** argv)
                char buf1[SET_ENV_BUF_SIZE], buf2[SET_ENV_BUF_SIZE];
 
                if (dwType == REG_EXPAND_SZ)
-                 ExpandEnvironmentStrings ((LPSTR) lpval, buf1, sizeof(buf1));
+                 ExpandEnvironmentStrings ((LPSTR) lpval, buf1, sizeof (buf1));
                else if (dwType == REG_SZ)
                  strcpy (buf1, lpval);
                if (dwType == REG_EXPAND_SZ || dwType == REG_SZ)
                  {
-                   _snprintf (buf2, sizeof(buf2)-1, "%s=%s", env_vars[i].name,
+                   _snprintf (buf2, sizeof (buf2)-1, "%s=%s", env_vars[i].name,
                               buf1);
                    _putenv (strdup (buf2));
                  }
@@ -2091,7 +2103,7 @@ GetCachedVolumeInformation (char * root_dir)
      involve network access, and so is extremely quick).  */
 
   /* Map drive letter to UNC if remote. */
-  if ( isalpha( root_dir[0] ) && !fixed[ DRIVE_INDEX( root_dir[0] ) ] )
+  if (isalpha (root_dir[0]) && !fixed[DRIVE_INDEX (root_dir[0])])
     {
       char remote_name[ 256 ];
       char drive[3] = { root_dir[0], ':' };
@@ -2490,8 +2502,8 @@ open_unc_volume (const char *path)
   nr.lpComment = NULL;
   nr.lpProvider = NULL;
 
-  result = WNetOpenEnum(RESOURCE_GLOBALNET, RESOURCETYPE_DISK,
-                       RESOURCEUSAGE_CONNECTABLE, &nr, &henum);
+  result = WNetOpenEnum (RESOURCE_GLOBALNET, RESOURCETYPE_DISK,
+                        RESOURCEUSAGE_CONNECTABLE, &nr, &henum);
 
   if (result == NO_ERROR)
     return henum;
@@ -2667,7 +2679,7 @@ sys_creat (const char * path, int mode)
 }
 
 FILE *
-sys_fopen(const char * path, const char * mode)
+sys_fopen (const char * path, const char * mode)
 {
   int fd;
   int oflag;
@@ -2754,7 +2766,7 @@ sys_link (const char * old, const char * new)
 
          data.wid.dwStreamId = BACKUP_LINK;
          data.wid.dwStreamAttributes = 0;
-         data.wid.Size.LowPart = wlen * sizeof(WCHAR);
+         data.wid.Size.LowPart = wlen * sizeof (WCHAR);
          data.wid.Size.HighPart = 0;
          data.wid.dwStreamNameSize = 0;
 
@@ -2956,7 +2968,7 @@ static int init = 0;
   } while (0)
 
 static void
-initialize_utc_base ()
+initialize_utc_base (void)
 {
   /* Determine the delta between 1-Jan-1601 and 1-Jan-1970. */
   SYSTEMTIME st;
@@ -3167,7 +3179,7 @@ get_name_and_id (PSECURITY_DESCRIPTOR psd, const char *fname,
   char name[UNLEN+1];
   DWORD name_len = sizeof (name);
   char domain[1024];
-  DWORD domain_len = sizeof(domain);
+  DWORD domain_len = sizeof (domain);
   char *mp = NULL;
   int use_dflt = 0;
   int result;
@@ -3642,7 +3654,7 @@ utime (const char *name, struct utimbuf *times)
 
 /* Helper wrapper functions.  */
 
-HANDLE WINAPI create_toolhelp32_snapshot(
+HANDLE WINAPI create_toolhelp32_snapshot (
     DWORD Flags,
     DWORD Ignored)
 {
@@ -3662,7 +3674,7 @@ HANDLE WINAPI create_toolhelp32_snapshot(
   return (s_pfn_Create_Toolhelp32_Snapshot (Flags, Ignored));
 }
 
-BOOL WINAPI process32_first(
+BOOL WINAPI process32_first (
     HANDLE hSnapshot,
     LPPROCESSENTRY32 lppe)
 {
@@ -3682,7 +3694,7 @@ BOOL WINAPI process32_first(
   return (s_pfn_Process32_First (hSnapshot, lppe));
 }
 
-BOOL WINAPI process32_next(
+BOOL WINAPI process32_next (
     HANDLE hSnapshot,
     LPPROCESSENTRY32 lppe)
 {
@@ -3880,7 +3892,7 @@ BOOL WINAPI global_memory_status_ex (
 }
 
 Lisp_Object
-list_system_processes ()
+list_system_processes (void)
 {
   struct gcpro gcpro1;
   Lisp_Object proclist = Qnil;
@@ -3971,8 +3983,7 @@ restore_privilege (TOKEN_PRIVILEGES *priv)
 }
 
 static Lisp_Object
-ltime (time_sec, time_usec)
-     long time_sec, time_usec;
+ltime (long time_sec, long time_usec)
 {
   return list3 (make_number ((time_sec >> 16) & 0xffff),
                make_number (time_sec & 0xffff),
@@ -3982,18 +3993,17 @@ ltime (time_sec, time_usec)
 #define U64_TO_LISP_TIME(time) ltime ((time) / 1000000L, (time) % 1000000L)
 
 static int
-process_times (h_proc, ctime, etime, stime, utime, ttime, pcpu)
-     HANDLE h_proc;
-     Lisp_Object *ctime, *etime, *stime, *utime, *ttime;
-     double *pcpu;
+process_times (HANDLE h_proc, Lisp_Object *ctime, Lisp_Object *etime,
+              Lisp_Object *stime, Lisp_Object *utime, Lisp_Object *ttime,
+              double *pcpu)
 {
   FILETIME ft_creation, ft_exit, ft_kernel, ft_user, ft_current;
   ULONGLONG tem1, tem2, tem3, tem;
 
   if (!h_proc
       || !get_process_times_fn
-      || !(*get_process_times_fn)(h_proc, &ft_creation, &ft_exit,
-                                 &ft_kernel, &ft_user))
+      || !(*get_process_times_fn) (h_proc, &ft_creation, &ft_exit,
+                                  &ft_kernel, &ft_user))
     return 0;
 
   GetSystemTimeAsFileTime (&ft_current);
@@ -4035,8 +4045,7 @@ process_times (h_proc, ctime, etime, stime, utime, ttime, pcpu)
 }
 
 Lisp_Object
-system_process_attributes (pid)
-     Lisp_Object pid;
+system_process_attributes (Lisp_Object pid)
 {
   struct gcpro gcpro1, gcpro2, gcpro3;
   Lisp_Object attrs = Qnil;
@@ -4435,34 +4444,34 @@ init_winsock (int load_now)
       if ((pfn_##fn = (void *) GetProcAddress (winsock_lib, #fn)) == NULL) \
         goto fail;
 
-      LOAD_PROC( WSAStartup );
-      LOAD_PROC( WSASetLastError );
-      LOAD_PROC( WSAGetLastError );
-      LOAD_PROC( WSAEventSelect );
-      LOAD_PROC( WSACreateEvent );
-      LOAD_PROC( WSACloseEvent );
-      LOAD_PROC( socket );
-      LOAD_PROC( bind );
-      LOAD_PROC( connect );
-      LOAD_PROC( ioctlsocket );
-      LOAD_PROC( recv );
-      LOAD_PROC( send );
-      LOAD_PROC( closesocket );
-      LOAD_PROC( shutdown );
-      LOAD_PROC( htons );
-      LOAD_PROC( ntohs );
-      LOAD_PROC( inet_addr );
-      LOAD_PROC( gethostname );
-      LOAD_PROC( gethostbyname );
-      LOAD_PROC( getservbyname );
-      LOAD_PROC( getpeername );
-      LOAD_PROC( WSACleanup );
-      LOAD_PROC( setsockopt );
-      LOAD_PROC( listen );
-      LOAD_PROC( getsockname );
-      LOAD_PROC( accept );
-      LOAD_PROC( recvfrom );
-      LOAD_PROC( sendto );
+      LOAD_PROC (WSAStartup);
+      LOAD_PROC (WSASetLastError);
+      LOAD_PROC (WSAGetLastError);
+      LOAD_PROC (WSAEventSelect);
+      LOAD_PROC (WSACreateEvent);
+      LOAD_PROC (WSACloseEvent);
+      LOAD_PROC (socket);
+      LOAD_PROC (bind);
+      LOAD_PROC (connect);
+      LOAD_PROC (ioctlsocket);
+      LOAD_PROC (recv);
+      LOAD_PROC (send);
+      LOAD_PROC (closesocket);
+      LOAD_PROC (shutdown);
+      LOAD_PROC (htons);
+      LOAD_PROC (ntohs);
+      LOAD_PROC (inet_addr);
+      LOAD_PROC (gethostname);
+      LOAD_PROC (gethostbyname);
+      LOAD_PROC (getservbyname);
+      LOAD_PROC (getpeername);
+      LOAD_PROC (WSACleanup);
+      LOAD_PROC (setsockopt);
+      LOAD_PROC (listen);
+      LOAD_PROC (getsockname);
+      LOAD_PROC (accept);
+      LOAD_PROC (recvfrom);
+      LOAD_PROC (sendto);
 #undef LOAD_PROC
 
       /* specify version 1.1 of winsock */
@@ -4502,7 +4511,7 @@ int h_errno = 0;
    normal system codes where they overlap (non-overlapping definitions
    are already in <sys/socket.h> */
 static void
-set_errno ()
+set_errno (void)
 {
   if (winsock_lib == NULL)
     h_errno = EINVAL;
@@ -4524,7 +4533,7 @@ set_errno ()
 }
 
 static void
-check_errno ()
+check_errno (void)
 {
   if (h_errno == 0 && winsock_lib != NULL)
     pfn_WSASetLastError (0);
@@ -4607,7 +4616,7 @@ struct {
 };
 
 char *
-sys_strerror(int error_no)
+sys_strerror (int error_no)
 {
   int i;
   static char unknown_msg[40];
@@ -4619,7 +4628,7 @@ sys_strerror(int error_no)
     if (_wsa_errlist[i].errnum == error_no)
       return _wsa_errlist[i].msg;
 
-  sprintf(unknown_msg, "Unidentified error: %d", error_no);
+  sprintf (unknown_msg, "Unidentified error: %d", error_no);
   return unknown_msg;
 }
 
@@ -4638,7 +4647,7 @@ sys_strerror(int error_no)
 int socket_to_fd (SOCKET s);
 
 int
-sys_socket(int af, int type, int protocol)
+sys_socket (int af, int type, int protocol)
 {
   SOCKET s;
 
@@ -4841,7 +4850,7 @@ sys_gethostname (char * name, int namelen)
 }
 
 struct hostent *
-sys_gethostbyname(const char * name)
+sys_gethostbyname (const char * name)
 {
   struct hostent * host;
 
@@ -4859,7 +4868,7 @@ sys_gethostbyname(const char * name)
 }
 
 struct servent *
-sys_getservbyname(const char * name, const char * proto)
+sys_getservbyname (const char * name, const char * proto)
 {
   struct servent * serv;
 
@@ -5014,7 +5023,7 @@ sys_accept (int s, struct sockaddr * addr, int * addrlen)
 
 int
 sys_recvfrom (int s, char * buf, int len, int flags,
-         struct sockaddr * from, int * fromlen)
+             struct sockaddr * from, int * fromlen)
 {
   if (winsock_lib == NULL)
     {
@@ -5512,8 +5521,8 @@ sys_read (int fd, char * buffer, unsigned int count)
                  int res = pfn_recv (SOCK_HANDLE (fd), buffer, count, 0);
                  if (res == SOCKET_ERROR)
                    {
-                     DebPrint(("sys_read.recv failed with error %d on socket %ld\n",
-                               pfn_WSAGetLastError (), SOCK_HANDLE (fd)));
+                     DebPrint (("sys_read.recv failed with error %d on socket %ld\n",
+                                pfn_WSAGetLastError (), SOCK_HANDLE (fd)));
                      set_errno ();
                      return -1;
                    }
@@ -5669,20 +5678,47 @@ sys_write (int fd, const void * buffer, unsigned int count)
 
       if (nchars == SOCKET_ERROR)
         {
-         DebPrint(("sys_write.send failed with error %d on socket %ld\n",
-                   pfn_WSAGetLastError (), SOCK_HANDLE (fd)));
+         DebPrint (("sys_write.send failed with error %d on socket %ld\n",
+                    pfn_WSAGetLastError (), SOCK_HANDLE (fd)));
          set_errno ();
        }
     }
   else
 #endif
-    nchars = _write (fd, buffer, count);
+    {
+      /* Some networked filesystems don't like too large writes, so
+        break them into smaller chunks.  See the Comments section of
+        the MSDN documentation of WriteFile for details behind the
+        choice of the value of CHUNK below.  See also the thread
+        http://thread.gmane.org/gmane.comp.version-control.git/145294
+        in the git mailing list.  */
+      const unsigned char *p = buffer;
+      const unsigned chunk = 30 * 1024 * 1024;
+
+      nchars = 0;
+      while (count > 0)
+       {
+         unsigned this_chunk = count < chunk ? count : chunk;
+         int n = _write (fd, p, this_chunk);
+
+         nchars += n;
+         if (n < 0)
+           {
+             nchars = n;
+             break;
+           }
+         else if (n < this_chunk)
+           break;
+         count -= n;
+         p += n;
+       }
+    }
 
   return nchars;
 }
 
 static void
-check_windows_init_file ()
+check_windows_init_file (void)
 {
   extern int noninteractive, inhibit_window_system;
 
@@ -5738,7 +5774,7 @@ check_windows_init_file ()
 }
 
 void
-term_ntproc ()
+term_ntproc (void)
 {
 #ifdef HAVE_SOCKETS
   /* shutdown the socket interface if necessary */
@@ -5749,7 +5785,7 @@ term_ntproc ()
 }
 
 void
-init_ntproc ()
+init_ntproc (void)
 {
 #ifdef HAVE_SOCKETS
   /* Initialise the socket interface now if available and requested by
@@ -5857,7 +5893,8 @@ init_ntproc ()
         shutdown_handler ensures that buffers' autosave files are
        up to date when the user logs off, or the system shuts down.
 */
-BOOL WINAPI shutdown_handler(DWORD type)
+BOOL WINAPI
+shutdown_handler (DWORD type)
 {
   /* Ctrl-C and Ctrl-Break are already suppressed, so don't handle them.  */
   if (type == CTRL_CLOSE_EVENT        /* User closes console window.  */
@@ -5878,7 +5915,7 @@ BOOL WINAPI shutdown_handler(DWORD type)
        initialized is non zero (see the function main in emacs.c).
 */
 void
-globals_of_w32 ()
+globals_of_w32 (void)
 {
   HMODULE kernel32 = GetModuleHandle ("kernel32.dll");
 
@@ -5916,14 +5953,15 @@ globals_of_w32 ()
      console apps. This actually applies to Emacs in both console and
      GUI modes, since we had to fool windows into thinking emacs is a
      console application to get console mode to work.  */
-  SetConsoleCtrlHandler(shutdown_handler, TRUE);
+  SetConsoleCtrlHandler (shutdown_handler, TRUE);
 
   /* "None" is the default group name on standalone workstations.  */
   strcpy (dflt_group_name, "None");
 }
 
 /* For make-serial-process  */
-int serial_open (char *port)
+int
+serial_open (char *port)
 {
   HANDLE hnd;
   child_process *cp;
@@ -5963,7 +6001,7 @@ int serial_open (char *port)
 /* For serial-process-configure  */
 void
 serial_configure (struct Lisp_Process *p,
-                     Lisp_Object contact)
+                 Lisp_Object contact)
 {
   Lisp_Object childp2 = Qnil;
   Lisp_Object tem = Qnil;
index c10f2181e7d1cff6d85ab0d2c5e37cdb800085b0..26fa544d670817c0f9fbd5cd394f47e578bb7a8c 100644 (file)
@@ -42,13 +42,13 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "w32inevt.h"
 
 /* from window.c */
-extern Lisp_Object Frecenter ();
+extern Lisp_Object Frecenter (Lisp_Object);
 
 /* from keyboard.c */
-extern int detect_input_pending ();
+extern int detect_input_pending (void);
 
 /* from sysdep.c */
-extern int read_input_pending ();
+extern int read_input_pending (void);
 
 static void w32con_move_cursor (struct frame *f, int row, int col);
 static void w32con_clear_to_end (struct frame *f);
@@ -68,7 +68,7 @@ static WORD w32_face_attributes (struct frame *f, int face_id);
 static COORD   cursor_coords;
 static HANDLE  prev_screen, cur_screen;
 static WORD    char_attr_normal;
-static DWORD   prev_console_mode;
+static DWORD   prev_console_mode;
 
 #ifndef USE_SEPARATE_SCREEN
 static CONSOLE_CURSOR_INFO prev_console_cursor;
@@ -268,7 +268,8 @@ scroll_line (struct frame *f, int dist, int direction)
 
 /* If start is zero insert blanks instead of a string at start ?. */
 static void
-w32con_insert_glyphs (struct frame *f, register struct glyph *start, register int len)
+w32con_insert_glyphs (struct frame *f, register struct glyph *start,
+                     register int len)
 {
   scroll_line (f, len, RIGHT);
 
@@ -286,8 +287,8 @@ w32con_insert_glyphs (struct frame *f, register struct glyph *start, register in
     }
 }
 
-extern unsigned char *encode_terminal_code P_ ((struct glyph *, int, 
-                                               struct coding_system *));
+extern unsigned char *encode_terminal_code (struct glyph *, int,
+                                            struct coding_system *);
 
 static void
 w32con_write_glyphs (struct frame *f, register struct glyph *string,
@@ -392,8 +393,7 @@ SOUND is 'asterisk, 'exclamation, 'hand, 'question, 'ok, or 'silent
 to use the corresponding system sound for the bell.  The 'silent sound
 prevents Emacs from making any sound at all.
 SOUND is nil to use the normal beep.  */)
-     (sound)
-     Lisp_Object sound;
+  (Lisp_Object sound)
 {
   CHECK_SYMBOL (sound);
 
@@ -438,7 +438,7 @@ w32con_reset_terminal_modes (struct terminal *t)
   FillConsoleOutputCharacter (cur_screen, ' ', n, dest, &r);
   /* Now that the screen is clear, put the cursor at the top.  */
   SetConsoleCursorPosition (cur_screen, dest);
-  
+
 #ifdef USE_SEPARATE_SCREEN
   SetConsoleActiveScreenBuffer (prev_screen);
 #else
@@ -487,6 +487,62 @@ w32con_set_terminal_window (struct frame *f, int size)
 {
 }
 
+/***********************************************************************
+                       stubs from termcap.c
+ ***********************************************************************/
+
+void
+sys_tputs (char *str, int nlines, int (*outfun) (int))
+{
+}
+
+char *
+sys_tgetstr (char *cap, char **area)
+{
+  return NULL;
+}
+
+
+/***********************************************************************
+                       stubs from cm.c
+ ***********************************************************************/
+
+struct tty_display_info *current_tty = NULL;
+int cost = 0;
+
+int
+evalcost (int c)
+{
+  return c;
+}
+
+int
+cmputc (int c)
+{
+  return c;
+}
+
+void
+cmcheckmagic (struct tty_display_info *tty)
+{
+}
+
+void
+cmcostinit (struct tty_display_info *tty)
+{
+}
+
+void
+cmgoto (struct tty_display_info *tty, int row, int col)
+{
+}
+
+void
+Wcm_clear (struct tty_display_info *tty)
+{
+}
+
+
 /***********************************************************************
                                Faces
  ***********************************************************************/
@@ -495,9 +551,7 @@ w32con_set_terminal_window (struct frame *f, int size)
 /* Turn appearances of face FACE_ID on tty frame F on.  */
 
 static WORD
-w32_face_attributes (f, face_id)
-     struct frame *f;
-     int face_id;
+w32_face_attributes (struct frame *f, int face_id)
 {
   WORD char_attr;
   struct face *face = FACE_FROM_ID (f, face_id);
@@ -553,8 +607,6 @@ vga_stdcolor_name (int idx)
     return Qunspecified;       /* meaning the default */
 }
 
-typedef int (*term_hook) ();
-
 void
 initialize_w32_display (struct terminal *term)
 {
@@ -562,19 +614,19 @@ initialize_w32_display (struct terminal *term)
 
   term->rif = 0; /* No window based redisplay on the console.  */
   term->cursor_to_hook         = w32con_move_cursor;
-  term->raw_cursor_to_hook             = w32con_move_cursor;
-  term->clear_to_end_hook              = w32con_clear_to_end;
-  term->clear_frame_hook               = w32con_clear_frame;
+  term->raw_cursor_to_hook     = w32con_move_cursor;
+  term->clear_to_end_hook      = w32con_clear_to_end;
+  term->clear_frame_hook       = w32con_clear_frame;
   term->clear_end_of_line_hook = w32con_clear_end_of_line;
-  term->ins_del_lines_hook             = w32con_ins_del_lines;
-  term->insert_glyphs_hook             = w32con_insert_glyphs;
-  term->write_glyphs_hook              = w32con_write_glyphs;
-  term->delete_glyphs_hook             = w32con_delete_glyphs;
+  term->ins_del_lines_hook     = w32con_ins_del_lines;
+  term->insert_glyphs_hook     = w32con_insert_glyphs;
+  term->write_glyphs_hook      = w32con_write_glyphs;
+  term->delete_glyphs_hook     = w32con_delete_glyphs;
   term->ring_bell_hook         = w32_sys_ring_bell;
-  term->reset_terminal_modes_hook      = w32con_reset_terminal_modes;
+  term->reset_terminal_modes_hook = w32con_reset_terminal_modes;
   term->set_terminal_modes_hook        = w32con_set_terminal_modes;
-  term->set_terminal_window_hook       = w32con_set_terminal_window;
-  term->update_begin_hook              = w32con_update_begin;
+  term->set_terminal_window_hook = w32con_set_terminal_window;
+  term->update_begin_hook      = w32con_update_begin;
   term->update_end_hook                = w32con_update_end;
 
   term->read_socket_hook = w32_console_read_socket;
@@ -618,8 +670,8 @@ initialize_w32_display (struct terminal *term)
 
   /* Respect setting of LINES and COLUMNS environment variables.  */
   {
-    char * lines = getenv("LINES");
-    char * columns = getenv("COLUMNS");
+    char * lines = getenv ("LINES");
+    char * columns = getenv ("COLUMNS");
 
     if (lines != NULL && columns != NULL)
       {
@@ -695,9 +747,7 @@ initialize_w32_display (struct terminal *term)
 
 DEFUN ("set-screen-color", Fset_screen_color, Sset_screen_color, 2, 2, 0,
        doc: /* Set screen colors.  */)
-    (foreground, background)
-    Lisp_Object foreground;
-    Lisp_Object background;
+  (Lisp_Object foreground, Lisp_Object background)
 {
   char_attr_normal = XFASTINT (foreground) + (XFASTINT (background) << 4);
 
@@ -707,8 +757,7 @@ DEFUN ("set-screen-color", Fset_screen_color, Sset_screen_color, 2, 2, 0,
 
 DEFUN ("set-cursor-size", Fset_cursor_size, Sset_cursor_size, 1, 1, 0,
        doc: /* Set cursor size.  */)
-    (size)
-    Lisp_Object size;
+  (Lisp_Object size)
 {
   CONSOLE_CURSOR_INFO cci;
   cci.dwSize = XFASTINT (size);
@@ -719,7 +768,7 @@ DEFUN ("set-cursor-size", Fset_cursor_size, Sset_cursor_size, 1, 1, 0,
 }
 
 void
-syms_of_ntterm ()
+syms_of_ntterm (void)
 {
   DEFVAR_BOOL ("w32-use-full-screen-buffer",
                &w32_use_full_screen_buffer,
index e27e7fecdc618e17cc518b56d3a4d58a9af05121..f91ad948828758bd45e41a1274a16846991aab3a 100644 (file)
@@ -69,15 +69,15 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #define FOF_NO_CONNECTED_ELEMENTS 0x2000
 #endif
 
-void syms_of_w32fns ();
-void globals_of_w32fns ();
+void syms_of_w32fns (void);
+void globals_of_w32fns (void);
 
-extern void free_frame_menubar ();
-extern double atof ();
-extern int w32_console_toggle_lock_key P_ ((int, Lisp_Object));
-extern void w32_menu_display_help P_ ((HWND, HMENU, UINT, UINT));
-extern void w32_free_menu_strings P_ ((HWND));
-extern const char *map_w32_filename P_ ((const char *, const char **));
+extern void free_frame_menubar (struct frame *);
+extern double atof (const char *);
+extern int w32_console_toggle_lock_key (int, Lisp_Object);
+extern void w32_menu_display_help (HWND, HMENU, UINT, UINT);
+extern void w32_free_menu_strings (HWND);
+extern const char *map_w32_filename (const char *, const char **);
 
 extern int quit_char;
 
@@ -294,6 +294,8 @@ extern Lisp_Object Vwindow_system_version;
 
 /* The below are defined in frame.c.  */
 
+extern Lisp_Object Vmenu_bar_mode, Vtool_bar_mode;
+extern Lisp_Object Vwindow_system_version;
 extern Lisp_Object Qtooltip;
 
 #ifdef GLYPH_DEBUG
@@ -319,18 +321,18 @@ extern HMENU current_popup_menu;
 static int menubar_in_use = 0;
 
 /* From w32uniscribe.c  */
-extern void syms_of_w32uniscribe ();
+extern void syms_of_w32uniscribe (void);
 extern int uniscribe_available;
 
 /* Function prototypes for hourglass support.  */
-static void w32_show_hourglass P_ ((struct frame *));
-static void w32_hide_hourglass P_ ((void));
+static void w32_show_hourglass (struct frame *);
+static void w32_hide_hourglass (void);
 
 
 \f
 /* Error if we are not connected to MS-Windows.  */
 void
-check_w32 ()
+check_w32 (void)
 {
   if (! w32_in_use)
     error ("MS-Windows not in use or not initialized");
@@ -340,7 +342,7 @@ check_w32 ()
    You should not call this unless HAVE_MENUS is defined.  */
 
 int
-have_menus_p ()
+have_menus_p (void)
 {
   return w32_in_use;
 }
@@ -349,8 +351,7 @@ have_menus_p ()
    and checking validity for W32.  */
 
 FRAME_PTR
-check_x_frame (frame)
-     Lisp_Object frame;
+check_x_frame (Lisp_Object frame)
 {
   FRAME_PTR f;
 
@@ -368,8 +369,7 @@ check_x_frame (frame)
    the first display on the list.  */
 
 struct w32_display_info *
-check_x_display_info (frame)
-     Lisp_Object frame;
+check_x_display_info (Lisp_Object frame)
 {
   if (NILP (frame))
     {
@@ -400,9 +400,7 @@ check_x_display_info (frame)
 /* This function can be called during GC, so use GC_xxx type test macros.  */
 
 struct frame *
-x_window_to_frame (dpyinfo, wdesc)
-     struct w32_display_info *dpyinfo;
-     HWND wdesc;
+x_window_to_frame (struct w32_display_info *dpyinfo, HWND wdesc)
 {
   Lisp_Object tail, frame;
   struct frame *f;
@@ -423,26 +421,24 @@ x_window_to_frame (dpyinfo, wdesc)
 }
 
 \f
-static Lisp_Object unwind_create_frame P_ ((Lisp_Object));
-static Lisp_Object unwind_create_tip_frame P_ ((Lisp_Object));
-static void my_create_window P_ ((struct frame *));
-static void my_create_tip_window P_ ((struct frame *));
+static Lisp_Object unwind_create_frame (Lisp_Object);
+static Lisp_Object unwind_create_tip_frame (Lisp_Object);
+static void my_create_window (struct frame *);
+static void my_create_tip_window (struct frame *);
 
 /* TODO: Native Input Method support; see x_create_im.  */
-void x_set_foreground_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
-void x_set_background_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
-void x_set_mouse_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
-void x_set_cursor_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
-void x_set_border_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
-void x_set_cursor_type P_ ((struct frame *, Lisp_Object, Lisp_Object));
-void x_set_icon_type P_ ((struct frame *, Lisp_Object, Lisp_Object));
-void x_set_icon_name P_ ((struct frame *, Lisp_Object, Lisp_Object));
-void x_explicitly_set_name P_ ((struct frame *, Lisp_Object, Lisp_Object));
-void x_set_menu_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object));
-void x_set_title P_ ((struct frame *, Lisp_Object, Lisp_Object));
-void x_set_tool_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object));
-static void x_edge_detection P_ ((struct frame *, struct image *, Lisp_Object,
-                                 Lisp_Object));
+void x_set_foreground_color (struct frame *, Lisp_Object, Lisp_Object);
+void x_set_background_color (struct frame *, Lisp_Object, Lisp_Object);
+void x_set_mouse_color (struct frame *, Lisp_Object, Lisp_Object);
+void x_set_cursor_color (struct frame *, Lisp_Object, Lisp_Object);
+void x_set_border_color (struct frame *, Lisp_Object, Lisp_Object);
+void x_set_cursor_type (struct frame *, Lisp_Object, Lisp_Object);
+void x_set_icon_type (struct frame *, Lisp_Object, Lisp_Object);
+void x_set_icon_name (struct frame *, Lisp_Object, Lisp_Object);
+void x_explicitly_set_name (struct frame *, Lisp_Object, Lisp_Object);
+void x_set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object);
+void x_set_title (struct frame *, Lisp_Object, Lisp_Object);
+void x_set_tool_bar_lines (struct frame *, Lisp_Object, Lisp_Object);
 
 
 \f
@@ -452,9 +448,7 @@ static void x_edge_detection P_ ((struct frame *, struct image *, Lisp_Object,
    not Emacs's own window.  */
 
 void
-x_real_positions (f, xptr, yptr)
-     FRAME_PTR f;
-     int *xptr, *yptr;
+x_real_positions (FRAME_PTR f, int *xptr, int *yptr)
 {
   POINT pt;
   RECT rect;
@@ -484,8 +478,7 @@ DEFUN ("w32-define-rgb-color", Fw32_define_rgb_color,
 This adds or updates a named color to `w32-color-map', making it
 available for use.  The original entry's RGB ref is returned, or nil
 if the entry is new.  */)
-    (red, green, blue, name)
-    Lisp_Object red, green, blue, name;
+  (Lisp_Object red, Lisp_Object green, Lisp_Object blue, Lisp_Object name)
 {
   Lisp_Object rgb;
   Lisp_Object oldrgb = Qnil;
@@ -771,7 +764,7 @@ colormap_t w32_color_map[] =
 
 DEFUN ("w32-default-color-map", Fw32_default_color_map, Sw32_default_color_map,
        0, 0, 0, doc: /* Return the default color map.  */)
-     ()
+  (void)
 {
   int i;
   colormap_t *pc = w32_color_map;
@@ -793,28 +786,7 @@ DEFUN ("w32-default-color-map", Fw32_default_color_map, Sw32_default_color_map,
 }
 
 static Lisp_Object
-w32_to_x_color (rgb)
-     Lisp_Object rgb;
-{
-  Lisp_Object color;
-
-  CHECK_NUMBER (rgb);
-
-  BLOCK_INPUT;
-
-  color = Frassq (rgb, Vw32_color_map);
-
-  UNBLOCK_INPUT;
-
-  if (!NILP (color))
-    return (Fcar (color));
-  else
-    return Qnil;
-}
-
-static Lisp_Object
-w32_color_map_lookup (colorname)
-     char *colorname;
+w32_color_map_lookup (char *colorname)
 {
   Lisp_Object tail, ret = Qnil;
 
@@ -846,8 +818,7 @@ w32_color_map_lookup (colorname)
 
 
 static void
-add_system_logical_colors_to_map (system_colors)
-     Lisp_Object *system_colors;
+add_system_logical_colors_to_map (Lisp_Object *system_colors)
 {
   HKEY colors_key;
 
@@ -895,8 +866,7 @@ add_system_logical_colors_to_map (system_colors)
 
 
 static Lisp_Object
-x_to_w32_color (colorname)
-     char * colorname;
+x_to_w32_color (char * colorname)
 {
   register Lisp_Object ret = Qnil;
 
@@ -1207,9 +1177,7 @@ w32_unmap_color (FRAME_PTR f, COLORREF color)
 /* Gamma-correct COLOR on frame F.  */
 
 void
-gamma_correct (f, color)
-     struct frame *f;
-     COLORREF *color;
+gamma_correct (struct frame *f, COLORREF *color)
 {
   if (f->gamma)
     {
@@ -1226,11 +1194,7 @@ gamma_correct (f, color)
    If ALLOC is nonzero, allocate a new colormap cell.  */
 
 int
-w32_defined_color (f, color, color_def, alloc)
-     FRAME_PTR f;
-     char *color;
-     XColor *color_def;
-     int alloc;
+w32_defined_color (FRAME_PTR f, char *color, XColor *color_def, int alloc)
 {
   register Lisp_Object tem;
   COLORREF w32_color_ref;
@@ -1302,10 +1266,7 @@ w32_defined_color (f, color, color_def, alloc)
    ARG says.  */
 
 int
-x_decode_color (f, arg, def)
-     FRAME_PTR f;
-     Lisp_Object arg;
-     int def;
+x_decode_color (FRAME_PTR f, Lisp_Object arg, int def)
 {
   XColor cdef;
 
@@ -1339,9 +1300,7 @@ x_decode_color (f, arg, def)
    in the standard place; do not attempt to change the window.  */
 
 void
-x_set_foreground_color (f, arg, oldval)
-     struct frame *f;
-     Lisp_Object arg, oldval;
+x_set_foreground_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
 {
   struct w32_output *x = f->output_data.w32;
   PIX_TYPE fg, old_fg;
@@ -1365,9 +1324,7 @@ x_set_foreground_color (f, arg, oldval)
 }
 
 void
-x_set_background_color (f, arg, oldval)
-     struct frame *f;
-     Lisp_Object arg, oldval;
+x_set_background_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
 {
   FRAME_BACKGROUND_PIXEL (f)
     = x_decode_color (f, arg, WHITE_PIX_DEFAULT (f));
@@ -1385,9 +1342,7 @@ x_set_background_color (f, arg, oldval)
 }
 
 void
-x_set_mouse_color (f, arg, oldval)
-     struct frame *f;
-     Lisp_Object arg, oldval;
+x_set_mouse_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
 {
   Cursor cursor, nontext_cursor, mode_cursor, hand_cursor;
   int count;
@@ -1534,9 +1489,7 @@ x_set_mouse_color (f, arg, oldval)
 }
 
 void
-x_set_cursor_color (f, arg, oldval)
-     struct frame *f;
-     Lisp_Object arg, oldval;
+x_set_cursor_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
 {
   unsigned long fore_pixel, pixel;
 
@@ -1583,9 +1536,7 @@ x_set_cursor_color (f, arg, oldval)
    F has a window.  */
 
 void
-x_set_border_pixel (f, pix)
-     struct frame *f;
-     int pix;
+x_set_border_pixel (struct frame *f, int pix)
 {
 
   f->output_data.w32->border_pixel = pix;
@@ -1604,9 +1555,7 @@ x_set_border_pixel (f, pix)
    F has a window; it must be redone when the window is created.  */
 
 void
-x_set_border_color (f, arg, oldval)
-     struct frame *f;
-     Lisp_Object arg, oldval;
+x_set_border_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
 {
   int pix;
 
@@ -1618,9 +1567,7 @@ x_set_border_color (f, arg, oldval)
 
 
 void
-x_set_cursor_type (f, arg, oldval)
-     FRAME_PTR f;
-     Lisp_Object arg, oldval;
+x_set_cursor_type (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval)
 {
   set_frame_cursor_types (f, arg);
 
@@ -1629,9 +1576,7 @@ x_set_cursor_type (f, arg, oldval)
 }
 \f
 void
-x_set_icon_type (f, arg, oldval)
-     struct frame *f;
-     Lisp_Object arg, oldval;
+x_set_icon_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
 {
   int result;
 
@@ -1658,9 +1603,7 @@ x_set_icon_type (f, arg, oldval)
 }
 
 void
-x_set_icon_name (f, arg, oldval)
-     struct frame *f;
-     Lisp_Object arg, oldval;
+x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
 {
   if (STRINGP (arg))
     {
@@ -1708,9 +1651,7 @@ x_set_icon_name (f, arg, oldval)
 
 \f
 void
-x_set_menu_bar_lines (f, value, oldval)
-     struct frame *f;
-     Lisp_Object value, oldval;
+x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
 {
   int nlines;
   int olines = FRAME_MENU_BAR_LINES (f);
@@ -1753,9 +1694,7 @@ x_set_menu_bar_lines (f, value, oldval)
    The frame's height doesn't change.  */
 
 void
-x_set_tool_bar_lines (f, value, oldval)
-     struct frame *f;
-     Lisp_Object value, oldval;
+x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
 {
   int delta, nlines, root_height;
   Lisp_Object root_window;
@@ -1835,10 +1774,7 @@ x_set_tool_bar_lines (f, value, oldval)
        F->explicit_name is set, ignore the new name; otherwise, set it.  */
 
 void
-x_set_name (f, name, explicit)
-     struct frame *f;
-     Lisp_Object name;
-     int explicit;
+x_set_name (struct frame *f, Lisp_Object name, int explicit)
 {
   /* Make sure that requests from lisp code override requests from
      Emacs redisplay code.  */
@@ -1893,9 +1829,7 @@ x_set_name (f, name, explicit)
    specified a name for the frame; the name will override any set by the
    redisplay code.  */
 void
-x_explicitly_set_name (f, arg, oldval)
-     FRAME_PTR f;
-     Lisp_Object arg, oldval;
+x_explicitly_set_name (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval)
 {
   x_set_name (f, arg, 1);
 }
@@ -1904,9 +1838,7 @@ x_explicitly_set_name (f, arg, oldval)
    name; names set this way will never override names set by the user's
    lisp code.  */
 void
-x_implicitly_set_name (f, arg, oldval)
-     FRAME_PTR f;
-     Lisp_Object arg, oldval;
+x_implicitly_set_name (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval)
 {
   x_set_name (f, arg, 0);
 }
@@ -1915,9 +1847,7 @@ x_implicitly_set_name (f, arg, oldval)
    If NAME is nil, use the frame name as the title.  */
 
 void
-x_set_title (f, name, old_name)
-     struct frame *f;
-     Lisp_Object name, old_name;
+x_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name)
 {
   /* Don't change the title if it's already NAME.  */
   if (EQ (name, f->title))
@@ -1942,8 +1872,8 @@ x_set_title (f, name, old_name)
 }
 
 
-void x_set_scroll_bar_default_width (f)
-     struct frame *f;
+void
+x_set_scroll_bar_default_width (struct frame *f)
 {
   int wid = FRAME_COLUMN_WIDTH (f);
 
@@ -1971,11 +1901,10 @@ w32_load_cursor (LPCTSTR name)
   return cursor;
 }
 
-extern LRESULT CALLBACK w32_wnd_proc ();
+extern LRESULT CALLBACK w32_wnd_proc (HWND, UINT, WPARAM, LPARAM);
 
 static BOOL
-w32_init_class (hinst)
-     HINSTANCE hinst;
+w32_init_class (HINSTANCE hinst)
 {
   WNDCLASS wc;
 
@@ -1994,9 +1923,7 @@ w32_init_class (hinst)
 }
 
 static HWND
-w32_createscrollbar (f, bar)
-     struct frame *f;
-     struct scroll_bar * bar;
+w32_createscrollbar (struct frame *f, struct scroll_bar * bar)
 {
   return (CreateWindow ("SCROLLBAR", "", SBS_VERT | WS_CHILD | WS_VISIBLE,
                        /* Position and size of scroll bar.  */
@@ -2011,8 +1938,7 @@ w32_createscrollbar (f, bar)
 }
 
 static void
-w32_createwindow (f)
-     struct frame *f;
+w32_createwindow (struct frame *f)
 {
   HWND hwnd;
   RECT rect;
@@ -2082,12 +2008,7 @@ w32_createwindow (f)
 }
 
 static void
-my_post_msg (wmsg, hwnd, msg, wParam, lParam)
-     W32Msg * wmsg;
-     HWND hwnd;
-     UINT msg;
-     WPARAM wParam;
-     LPARAM lParam;
+my_post_msg (W32Msg * wmsg, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 {
   wmsg->msg.hwnd = hwnd;
   wmsg->msg.message = msg;
@@ -2181,7 +2102,7 @@ record_keyup (unsigned int wparam, unsigned int lparam)
    it regains focus, be conservative and clear all modifiers since
    we cannot reconstruct the left and right modifier state.  */
 static void
-reset_modifiers ()
+reset_modifiers (void)
 {
   SHORT ctrl, alt;
 
@@ -2228,7 +2149,7 @@ reset_modifiers ()
    modifier keys, we know that, if no modifiers are set, then neither
    the left or right modifier should be set.  */
 static void
-sync_modifiers ()
+sync_modifiers (void)
 {
   if (!modifiers_recorded)
     return;
@@ -2314,7 +2235,7 @@ w32_key_to_modifier (int key)
 }
 
 static unsigned int
-w32_get_modifiers ()
+w32_get_modifiers (void)
 {
   return ((modifier_set (VK_SHIFT)   ? shift_modifier : 0) |
          (modifier_set (VK_CONTROL) ? ctrl_modifier  : 0) |
@@ -2331,7 +2252,7 @@ w32_get_modifiers ()
    and window input.  */
 
 static int
-construct_console_modifiers ()
+construct_console_modifiers (void)
 {
   int mods;
 
@@ -2403,8 +2324,7 @@ static Lisp_Object w32_grabbed_keys;
    combinations like Alt-Tab which are used by the system.  */
 
 static void
-register_hot_keys (hwnd)
-     HWND hwnd;
+register_hot_keys (HWND hwnd)
 {
   Lisp_Object keylist;
 
@@ -2423,8 +2343,7 @@ register_hot_keys (hwnd)
 }
 
 static void
-unregister_hot_keys (hwnd)
-     HWND hwnd;
+unregister_hot_keys (HWND hwnd)
 {
   Lisp_Object keylist;
 
@@ -2630,7 +2549,7 @@ complete_deferred_msg (HWND hwnd, UINT msg, LRESULT result)
 }
 
 static void
-cancel_all_deferred_msgs ()
+cancel_all_deferred_msgs (void)
 {
   deferred_msg * item;
 
@@ -2675,7 +2594,7 @@ w32_msg_worker (void *arg)
 }
 
 static void
-signal_user_input ()
+signal_user_input (void)
 {
   /* Interrupt any lisp that wants to be interrupted by input.  */
   if (!NILP (Vthrow_on_input))
@@ -2693,13 +2612,9 @@ signal_user_input ()
 
 
 static void
-post_character_message (hwnd, msg, wParam, lParam, modifiers)
-     HWND hwnd;
-     UINT msg;
-     WPARAM wParam;
-     LPARAM lParam;
-     DWORD  modifiers;
-
+post_character_message (HWND hwnd, UINT msg,
+                       WPARAM wParam, LPARAM lParam,
+                       DWORD modifiers)
 {
   W32Msg wmsg;
 
@@ -2759,11 +2674,7 @@ post_character_message (hwnd, msg, wParam, lParam, modifiers)
 /* Main window procedure */
 
 LRESULT CALLBACK
-w32_wnd_proc (hwnd, msg, wParam, lParam)
-     HWND hwnd;
-     UINT msg;
-     WPARAM wParam;
-     LPARAM lParam;
+w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 {
   struct frame *f;
   struct w32_display_info *dpyinfo = &one_w32_display_info;
@@ -2821,7 +2732,7 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
       {
        PAINTSTRUCT paintStruct;
         RECT update_rect;
-       bzero (&update_rect, sizeof (update_rect));
+       memset (&update_rect, 0, sizeof (update_rect));
 
        f = x_window_to_frame (dpyinfo, hwnd);
        if (f == 0)
@@ -3169,7 +3080,7 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
           wmsg.dwModifiers = w32_get_key_modifiers (wParam, lParam);
           /* Get buffer size.  */
           size = get_composition_string_fn (context, GCS_RESULTSTR, buffer, 0);
-          buffer = alloca(size);
+          buffer = alloca (size);
           size = get_composition_string_fn (context, GCS_RESULTSTR,
                                             buffer, size);
          release_ime_context_fn (hwnd, context);
@@ -3198,9 +3109,6 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
          HIMC context;
          struct window *w;
 
-         if (!context)
-           break;
-
          f = x_window_to_frame (dpyinfo, hwnd);
          w = XWINDOW (FRAME_SELECTED_WINDOW (f));
 
@@ -3218,6 +3126,10 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
                                - WINDOW_MODE_LINE_HEIGHT (w));
 
          context = get_ime_context_fn (hwnd);
+
+         if (!context)
+           break;
+
          set_ime_composition_window_fn (context, &form);
          release_ime_context_fn (hwnd, context);
        }
@@ -4013,8 +3925,7 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
 }
 
 static void
-my_create_window (f)
-     struct frame * f;
+my_create_window (struct frame * f)
 {
   MSG msg;
 
@@ -4029,8 +3940,7 @@ my_create_window (f)
    messages for the tooltip.  Creating tooltips indirectly also creates
    deadlocks when tooltips are created for menu items.  */
 static void
-my_create_tip_window (f)
-     struct frame *f;
+my_create_tip_window (struct frame *f)
 {
   RECT rect;
 
@@ -4073,10 +3983,7 @@ my_create_tip_window (f)
 /* Create and set up the w32 window for frame F.  */
 
 static void
-w32_window (f, window_prompting, minibuffer_only)
-     struct frame *f;
-     long window_prompting;
-     int minibuffer_only;
+w32_window (struct frame *f, long window_prompting, int minibuffer_only)
 {
   BLOCK_INPUT;
 
@@ -4124,9 +4031,7 @@ w32_window (f, window_prompting, minibuffer_only)
    well.  */
 
 static void
-x_icon (f, parms)
-     struct frame *f;
-     Lisp_Object parms;
+x_icon (struct frame *f, Lisp_Object parms)
 {
   Lisp_Object icon_x, icon_y;
   struct w32_display_info *dpyinfo = &one_w32_display_info;
@@ -4165,8 +4070,7 @@ x_icon (f, parms)
 
 
 static void
-x_make_gc (f)
-     struct frame *f;
+x_make_gc (struct frame *f)
 {
   XGCValues gc_values;
 
@@ -4199,8 +4103,7 @@ x_make_gc (f)
    constructed.  */
 
 static Lisp_Object
-unwind_create_frame (frame)
-     Lisp_Object frame;
+unwind_create_frame (Lisp_Object frame)
 {
   struct frame *f = XFRAME (frame);
 
@@ -4225,9 +4128,7 @@ unwind_create_frame (frame)
 }
 
 static void
-x_default_font_parameter (f, parms)
-     struct frame *f;
-     Lisp_Object parms;
+x_default_font_parameter (struct frame *f, Lisp_Object parms)
 {
   struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f);
   Lisp_Object font_param = x_get_arg (dpyinfo, parms, Qfont, NULL, NULL,
@@ -4277,8 +4178,7 @@ then `default-minibuffer-frame' must be a frame whose minibuffer can
 be shared by the new frame.
 
 This function is an internal primitive--use `make-frame' instead.  */)
-  (parameters)
-     Lisp_Object parameters;
+  (Lisp_Object parameters)
 {
   struct frame *f;
   Lisp_Object frame, tem;
@@ -4361,7 +4261,7 @@ This function is an internal primitive--use `make-frame' instead.  */)
   f->output_method = output_w32;
   f->output_data.w32 =
     (struct w32_output *) xmalloc (sizeof (struct w32_output));
-  bzero (f->output_data.w32, sizeof (struct w32_output));
+  memset (f->output_data.w32, 0, sizeof (struct w32_output));
   FRAME_FONTSET (f) = -1;
 
   f->icon_name
@@ -4469,10 +4369,17 @@ This function is an internal primitive--use `make-frame' instead.  */)
      happen.  */
   init_frame_faces (f);
 
-  x_default_parameter (f, parameters, Qmenu_bar_lines, make_number (1),
-                      "menuBar", "MenuBar", RES_TYPE_NUMBER);
-  x_default_parameter (f, parameters, Qtool_bar_lines, make_number (1),
-                       "toolBar", "ToolBar", RES_TYPE_NUMBER);
+  /* The X resources controlling the menu-bar and tool-bar are
+     processed specially at startup, and reflected in the mode
+     variables; ignore them here.  */
+  x_default_parameter (f, parameters, Qmenu_bar_lines,
+                      NILP (Vmenu_bar_mode)
+                      ? make_number (0) : make_number (1),
+                      NULL, NULL, RES_TYPE_NUMBER);
+  x_default_parameter (f, parameters, Qtool_bar_lines,
+                      NILP (Vtool_bar_mode)
+                      ? make_number (0) : make_number (1),
+                      NULL, NULL, RES_TYPE_NUMBER);
 
   x_default_parameter (f, parameters, Qbuffer_predicate, Qnil,
                       "bufferPredicate", "BufferPredicate", RES_TYPE_SYMBOL);
@@ -4586,8 +4493,7 @@ This function is an internal primitive--use `make-frame' instead.  */)
    display info directly because we're called from frame.c, which doesn't
    know about that structure.  */
 Lisp_Object
-x_get_focus_frame (frame)
-     struct frame *frame;
+x_get_focus_frame (struct frame *frame)
 {
   struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (frame);
   Lisp_Object xfocus;
@@ -4600,8 +4506,7 @@ x_get_focus_frame (frame)
 
 DEFUN ("x-focus-frame", Fx_focus_frame, Sx_focus_frame, 1, 1, 0,
        doc: /* Give FRAME input focus, raising to foreground if necessary.  */)
-  (frame)
-     Lisp_Object frame;
+  (Lisp_Object frame)
 {
   x_focus_on_frame (check_x_frame (frame));
   return Qnil;
@@ -4610,8 +4515,7 @@ DEFUN ("x-focus-frame", Fx_focus_frame, Sx_focus_frame, 1, 1, 0,
 \f
 DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0,
        doc: /* Internal function called by `color-defined-p', which see.  */)
-  (color, frame)
-     Lisp_Object color, frame;
+  (Lisp_Object color, Lisp_Object frame)
 {
   XColor foo;
   FRAME_PTR f = check_x_frame (frame);
@@ -4626,8 +4530,7 @@ DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0,
 
 DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0,
        doc: /* Internal function called by `color-values', which see.  */)
-  (color, frame)
-     Lisp_Object color, frame;
+  (Lisp_Object color, Lisp_Object frame)
 {
   XColor foo;
   FRAME_PTR f = check_x_frame (frame);
@@ -4647,8 +4550,7 @@ DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0,
 
 DEFUN ("xw-display-color-p", Fxw_display_color_p, Sxw_display_color_p, 0, 1, 0,
        doc: /* Internal function called by `display-color-p', which see.  */)
-  (display)
-     Lisp_Object display;
+  (Lisp_Object display)
 {
   struct w32_display_info *dpyinfo = check_x_display_info (display);
 
@@ -4665,8 +4567,7 @@ Note that color displays do support shades of gray.
 The optional argument DISPLAY specifies which display to ask about.
 DISPLAY should be either a frame or a display name (a string).
 If omitted or nil, that stands for the selected frame's display.  */)
-  (display)
-     Lisp_Object display;
+  (Lisp_Object display)
 {
   struct w32_display_info *dpyinfo = check_x_display_info (display);
 
@@ -4682,8 +4583,7 @@ DEFUN ("x-display-pixel-width", Fx_display_pixel_width,
 The optional argument DISPLAY specifies which display to ask about.
 DISPLAY should be either a frame or a display name (a string).
 If omitted or nil, that stands for the selected frame's display.  */)
-  (display)
-     Lisp_Object display;
+  (Lisp_Object display)
 {
   struct w32_display_info *dpyinfo = check_x_display_info (display);
 
@@ -4696,8 +4596,7 @@ DEFUN ("x-display-pixel-height", Fx_display_pixel_height,
 The optional argument DISPLAY specifies which display to ask about.
 DISPLAY should be either a frame or a display name (a string).
 If omitted or nil, that stands for the selected frame's display.  */)
-  (display)
-     Lisp_Object display;
+  (Lisp_Object display)
 {
   struct w32_display_info *dpyinfo = check_x_display_info (display);
 
@@ -4710,8 +4609,7 @@ DEFUN ("x-display-planes", Fx_display_planes, Sx_display_planes,
 The optional argument DISPLAY specifies which display to ask about.
 DISPLAY should be either a frame or a display name (a string).
 If omitted or nil, that stands for the selected frame's display.  */)
-  (display)
-     Lisp_Object display;
+  (Lisp_Object display)
 {
   struct w32_display_info *dpyinfo = check_x_display_info (display);
 
@@ -4724,8 +4622,7 @@ DEFUN ("x-display-color-cells", Fx_display_color_cells, Sx_display_color_cells,
 The optional argument DISPLAY specifies which display to ask about.
 DISPLAY should be either a frame or a display name (a string).
 If omitted or nil, that stands for the selected frame's display.  */)
-  (display)
-     Lisp_Object display;
+  (Lisp_Object display)
 {
   struct w32_display_info *dpyinfo = check_x_display_info (display);
   HDC hdc;
@@ -4754,8 +4651,7 @@ DEFUN ("x-server-max-request-size", Fx_server_max_request_size,
 The optional argument DISPLAY specifies which display to ask about.
 DISPLAY should be either a frame or a display name (a string).
 If omitted or nil, that stands for the selected frame's display.  */)
-  (display)
-     Lisp_Object display;
+  (Lisp_Object display)
 {
   struct w32_display_info *dpyinfo = check_x_display_info (display);
 
@@ -4767,8 +4663,7 @@ DEFUN ("x-server-vendor", Fx_server_vendor, Sx_server_vendor, 0, 1, 0,
 The optional argument DISPLAY specifies which display to ask about.
 DISPLAY should be either a frame or a display name (a string).
 If omitted or nil, that stands for the selected frame's display.  */)
-  (display)
-     Lisp_Object display;
+  (Lisp_Object display)
 {
   return build_string ("Microsoft Corp.");
 }
@@ -4782,8 +4677,7 @@ release number.  See also the function `x-server-vendor'.
 The optional argument DISPLAY specifies which display to ask about.
 DISPLAY should be either a frame or a display name (a string).
 If omitted or nil, that stands for the selected frame's display.  */)
-  (display)
-     Lisp_Object display;
+  (Lisp_Object display)
 {
   return Fcons (make_number (w32_major_version),
                Fcons (make_number (w32_minor_version),
@@ -4795,8 +4689,7 @@ DEFUN ("x-display-screens", Fx_display_screens, Sx_display_screens, 0, 1, 0,
 The optional argument DISPLAY specifies which display to ask about.
 DISPLAY should be either a frame or a display name (a string).
 If omitted or nil, that stands for the selected frame's display.  */)
-  (display)
-     Lisp_Object display;
+  (Lisp_Object display)
 {
   return make_number (1);
 }
@@ -4807,8 +4700,7 @@ DEFUN ("x-display-mm-height", Fx_display_mm_height,
 The optional argument DISPLAY specifies which display to ask about.
 DISPLAY should be either a frame or a display name (a string).
 If omitted or nil, that stands for the selected frame's display.  */)
-  (display)
-     Lisp_Object display;
+  (Lisp_Object display)
 {
   struct w32_display_info *dpyinfo = check_x_display_info (display);
   HDC hdc;
@@ -4828,8 +4720,7 @@ DEFUN ("x-display-mm-width", Fx_display_mm_width, Sx_display_mm_width, 0, 1, 0,
 The optional argument DISPLAY specifies which display to ask about.
 DISPLAY should be either a frame or a display name (a string).
 If omitted or nil, that stands for the selected frame's display.  */)
-  (display)
-     Lisp_Object display;
+  (Lisp_Object display)
 {
   struct w32_display_info *dpyinfo = check_x_display_info (display);
 
@@ -4852,8 +4743,7 @@ The value may be `always', `when-mapped', or `not-useful'.
 The optional argument DISPLAY specifies which display to ask about.
 DISPLAY should be either a frame or a display name (a string).
 If omitted or nil, that stands for the selected frame's display.  */)
-  (display)
-     Lisp_Object display;
+  (Lisp_Object display)
 {
   return intern ("not-useful");
 }
@@ -4867,8 +4757,7 @@ The value is one of the symbols `static-gray', `gray-scale',
 The optional argument DISPLAY specifies which display to ask about.
 DISPLAY should be either a frame or a display name (a string).
 If omitted or nil, that stands for the selected frame's display.  */)
-       (display)
-     Lisp_Object display;
+  (Lisp_Object display)
 {
   struct w32_display_info *dpyinfo = check_x_display_info (display);
   Lisp_Object result = Qnil;
@@ -4891,43 +4780,37 @@ DEFUN ("x-display-save-under", Fx_display_save_under,
 The optional argument DISPLAY specifies which display to ask about.
 DISPLAY should be either a frame or a display name (a string).
 If omitted or nil, that stands for the selected frame's display.  */)
-  (display)
-     Lisp_Object display;
+  (Lisp_Object display)
 {
   return Qnil;
 }
 \f
 int
-x_pixel_width (f)
-     register struct frame *f;
+x_pixel_width (register struct frame *f)
 {
   return FRAME_PIXEL_WIDTH (f);
 }
 
 int
-x_pixel_height (f)
-     register struct frame *f;
+x_pixel_height (register struct frame *f)
 {
   return FRAME_PIXEL_HEIGHT (f);
 }
 
 int
-x_char_width (f)
-     register struct frame *f;
+x_char_width (register struct frame *f)
 {
   return FRAME_COLUMN_WIDTH (f);
 }
 
 int
-x_char_height (f)
-     register struct frame *f;
+x_char_height (register struct frame *f)
 {
   return FRAME_LINE_HEIGHT (f);
 }
 
 int
-x_screen_planes (f)
-     register struct frame *f;
+x_screen_planes (register struct frame *f)
 {
   return FRAME_W32_DISPLAY_INFO (f)->n_planes;
 }
@@ -4936,8 +4819,7 @@ x_screen_planes (f)
    Open a new connection if necessary.  */
 
 struct w32_display_info *
-x_display_info_for_name (name)
-     Lisp_Object name;
+x_display_info_for_name (Lisp_Object name)
 {
   Lisp_Object names;
   struct w32_display_info *dpyinfo;
@@ -4977,8 +4859,7 @@ DISPLAY is the name of the display to connect to.
 Optional second arg XRM-STRING is a string of resources in xrdb format.
 If the optional third arg MUST-SUCCEED is non-nil,
 terminate Emacs if we can't open the connection.  */)
-  (display, xrm_string, must_succeed)
-     Lisp_Object display, xrm_string, must_succeed;
+  (Lisp_Object display, Lisp_Object xrm_string, Lisp_Object must_succeed)
 {
   unsigned char *xrm_option;
   struct w32_display_info *dpyinfo;
@@ -5066,8 +4947,7 @@ DEFUN ("x-close-connection", Fx_close_connection,
        doc: /* Close the connection to DISPLAY's server.
 For DISPLAY, specify either a frame or a display name (a string).
 If DISPLAY is nil, that stands for the selected frame's display.  */)
-  (display)
-  Lisp_Object display;
+  (Lisp_Object display)
 {
   struct w32_display_info *dpyinfo = check_x_display_info (display);
   int i;
@@ -5086,7 +4966,7 @@ If DISPLAY is nil, that stands for the selected frame's display.  */)
 
 DEFUN ("x-display-list", Fx_display_list, Sx_display_list, 0, 0, 0,
        doc: /* Return the list of display names that Emacs has connections to.  */)
-  ()
+  (void)
 {
   Lisp_Object tail, result;
 
@@ -5099,8 +4979,7 @@ DEFUN ("x-display-list", Fx_display_list, Sx_display_list, 0, 0, 0,
 
 DEFUN ("x-synchronize", Fx_synchronize, Sx_synchronize, 1, 2, 0,
        doc: /* This is a noop on W32 systems.  */)
-     (on, display)
-     Lisp_Object display, on;
+  (Lisp_Object on, Lisp_Object display)
 {
   return Qnil;
 }
@@ -5129,8 +5008,7 @@ 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.
 
 Value is VALUE.  */)
-     (prop, value, frame, type, format, outer_p)
-     Lisp_Object prop, value, frame, type, format, outer_p;
+  (Lisp_Object prop, Lisp_Object value, Lisp_Object frame, Lisp_Object type, Lisp_Object format, Lisp_Object outer_p)
 {
 #if 0 /* TODO : port window properties to W32 */
   struct frame *f = check_x_frame (frame);
@@ -5159,8 +5037,7 @@ DEFUN ("x-delete-window-property", Fx_delete_window_property,
        Sx_delete_window_property, 1, 2, 0,
        doc: /* Remove window property PROP from X window of FRAME.
 FRAME nil or omitted means use the selected frame.  Value is PROP.  */)
-  (prop, frame)
-     Lisp_Object prop, frame;
+  (Lisp_Object prop, Lisp_Object frame)
 {
 #if 0 /* TODO : port window properties to W32 */
 
@@ -5187,8 +5064,7 @@ DEFUN ("x-window-property", Fx_window_property, Sx_window_property,
 If FRAME is nil or omitted, use the selected frame.  Value is nil
 if FRAME hasn't a property with name PROP or if PROP has no string
 value.  */)
-  (prop, frame)
-     Lisp_Object prop, frame;
+  (Lisp_Object prop, Lisp_Object frame)
 {
 #if 0 /* TODO : port window properties to W32 */
 
@@ -5252,7 +5128,7 @@ extern Lisp_Object Vhourglass_delay;
            xdisp.c could be used. */
 
 int
-hourglass_started ()
+hourglass_started (void)
 {
   return hourglass_shown_p || hourglass_timer;
 }
@@ -5260,7 +5136,7 @@ hourglass_started ()
 /* Cancel a currently active hourglass timer, and start a new one.  */
 
 void
-start_hourglass ()
+start_hourglass (void)
 {
   DWORD delay;
   int secs, msecs = 0;
@@ -5296,7 +5172,7 @@ start_hourglass ()
    cursor if shown.  */
 
 void
-cancel_hourglass ()
+cancel_hourglass (void)
 {
   if (hourglass_timer)
     {
@@ -5315,8 +5191,7 @@ cancel_hourglass ()
    to indicate that an hourglass cursor is shown.  */
 
 static void
-w32_show_hourglass (f)
-     struct frame *f;
+w32_show_hourglass (struct frame *f)
 {
   if (!hourglass_shown_p)
     {
@@ -5331,7 +5206,7 @@ w32_show_hourglass (f)
 /* Hide the hourglass cursor on all frames, if it is currently shown.  */
 
 static void
-w32_hide_hourglass ()
+w32_hide_hourglass (void)
 {
   if (hourglass_shown_p)
     {
@@ -5359,10 +5234,10 @@ w32_hide_hourglass ()
                                Tool tips
  ***********************************************************************/
 
-static Lisp_Object x_create_tip_frame P_ ((struct w32_display_info *,
-                                          Lisp_Object, Lisp_Object));
-static void compute_tip_xy P_ ((struct frame *, Lisp_Object, Lisp_Object,
-                               Lisp_Object, int, int, int *, int *));
+static Lisp_Object x_create_tip_frame (struct w32_display_info *,
+                                       Lisp_Object, Lisp_Object);
+static void compute_tip_xy (struct frame *, Lisp_Object, Lisp_Object,
+                            Lisp_Object, int, int, int *, int *);
 
 /* The frame of a currently visible tooltip.  */
 
@@ -5385,8 +5260,7 @@ Lisp_Object Vx_max_tooltip_size;
 
 
 static Lisp_Object
-unwind_create_tip_frame (frame)
-     Lisp_Object frame;
+unwind_create_tip_frame (Lisp_Object frame)
 {
   Lisp_Object deleted;
 
@@ -5411,9 +5285,8 @@ unwind_create_tip_frame (frame)
    when this happens.  */
 
 static Lisp_Object
-x_create_tip_frame (dpyinfo, parms, text)
-     struct w32_display_info *dpyinfo;
-     Lisp_Object parms, text;
+x_create_tip_frame (struct w32_display_info *dpyinfo,
+                   Lisp_Object parms, Lisp_Object text)
 {
   struct frame *f;
   Lisp_Object frame, tem;
@@ -5477,7 +5350,7 @@ x_create_tip_frame (dpyinfo, parms, text)
   f->output_method = output_w32;
   f->output_data.w32 =
     (struct w32_output *) xmalloc (sizeof (struct w32_output));
-  bzero (f->output_data.w32, sizeof (struct w32_output));
+  memset (f->output_data.w32, 0, sizeof (struct w32_output));
 
   FRAME_FONTSET (f)  = -1;
   f->icon_name = Qnil;
@@ -5652,11 +5525,9 @@ x_create_tip_frame (dpyinfo, parms, text)
    the display in *ROOT_X, and *ROOT_Y.  */
 
 static void
-compute_tip_xy (f, parms, dx, dy, width, height, root_x, root_y)
-     struct frame *f;
-     Lisp_Object parms, dx, dy;
-     int width, height;
-     int *root_x, *root_y;
+compute_tip_xy (struct frame *f,
+               Lisp_Object parms, Lisp_Object dx, Lisp_Object dy,
+               int width, int height, int *root_x, int *root_y)
 {
   Lisp_Object left, top;
   int min_x, min_y, max_x, max_y;
@@ -5760,8 +5631,7 @@ DY added (default is -10).
 
 A tooltip's maximum size is specified by `x-max-tooltip-size'.
 Text larger than the specified size is clipped.  */)
-  (string, frame, parms, timeout, dx, dy)
-     Lisp_Object string, frame, parms, timeout, dx, dy;
+  (Lisp_Object string, Lisp_Object frame, Lisp_Object parms, Lisp_Object timeout, Lisp_Object dx, Lisp_Object dy)
 {
   struct frame *f;
   struct window *w;
@@ -5990,7 +5860,7 @@ Text larger than the specified size is clipped.  */)
 DEFUN ("x-hide-tip", Fx_hide_tip, Sx_hide_tip, 0, 0, 0,
        doc: /* Hide the current tooltip window, if there is any.
 Value is t if tooltip was open, nil otherwise.  */)
-  ()
+  (void)
 {
   int count;
   Lisp_Object deleted, frame, timer;
@@ -6035,11 +5905,7 @@ extern Lisp_Object Qfile_name_history;
    allows us to work around the fact that the standard Open File
    dialog does not support directories.  */
 UINT CALLBACK
-file_dialog_callback (hwnd, msg, wParam, lParam)
-     HWND hwnd;
-     UINT msg;
-     WPARAM wParam;
-     LPARAM lParam;
+file_dialog_callback (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 {
   if (msg == WM_NOTIFY)
     {
@@ -6090,8 +5956,7 @@ Use a file selection dialog.
 Select DEFAULT-FILENAME in the dialog's file selection box, if
 specified.  Ensure that file exists if MUSTMATCH is non-nil.
 If ONLY-DIR-P is non-nil, the user can only select directories.  */)
-  (prompt, dir, default_filename, mustmatch, only_dir_p)
-     Lisp_Object prompt, dir, default_filename, mustmatch, only_dir_p;
+  (Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename, Lisp_Object mustmatch, Lisp_Object only_dir_p)
 {
   struct frame *f = SELECTED_FRAME ();
   Lisp_Object file = Qnil;
@@ -6140,7 +6005,7 @@ If ONLY-DIR-P is non-nil, the user can only select directories.  */)
     specbind (Qinhibit_redisplay, Qt);
     BLOCK_INPUT;
 
-    bzero (&new_file_details, sizeof (new_file_details));
+    memset (&new_file_details, 0, sizeof (new_file_details));
     /* Apparently NT4 crashes if you give it an unexpected size.
        I'm not sure about Windows 9x, so play it safe.  */
     if (w32_major_version > 4 && w32_major_version < 95)
@@ -6219,8 +6084,7 @@ If ONLY-DIR-P is non-nil, the user can only select directories.  */)
 DEFUN ("system-move-file-to-trash", Fsystem_move_file_to_trash,
        Ssystem_move_file_to_trash, 1, 1, 0,
        doc: /* Move file or directory named FILENAME to the recycle bin.  */)
-     (filename)
-     Lisp_Object filename;
+  (Lisp_Object filename)
 {
   Lisp_Object handler;
   Lisp_Object encoded_file;
@@ -6251,10 +6115,10 @@ DEFUN ("system-move-file-to-trash", Fsystem_move_file_to_trash,
     /* On Windows, write permission is required to delete/move files.  */
     _chmod (path, 0666);
 
-    bzero (tmp_path, sizeof (tmp_path));
+    memset (tmp_path, 0, sizeof (tmp_path));
     strcpy (tmp_path, path);
 
-    bzero (&file_op, sizeof (file_op));
+    memset (&file_op, 0, sizeof (file_op));
     file_op.hwnd = HWND_DESKTOP;
     file_op.wFunc = FO_DELETE;
     file_op.pFrom = tmp_path;
@@ -6282,8 +6146,7 @@ to activate the menubar for keyboard access.  #xf140 activates the
 screen saver if defined.
 
 If optional parameter FRAME is not specified, use selected frame.  */)
-  (command, frame)
-     Lisp_Object command, frame;
+  (Lisp_Object command, Lisp_Object frame)
 {
   FRAME_PTR f = check_x_frame (frame);
 
@@ -6336,8 +6199,7 @@ an integer representing a ShowWindow flag:
   1 - start normally
   3 - start maximized
   6 - start minimized  */)
-  (operation, document, parameters, show_flag)
-     Lisp_Object operation, document, parameters, show_flag;
+  (Lisp_Object operation, Lisp_Object document, Lisp_Object parameters, Lisp_Object show_flag)
 {
   Lisp_Object current_dir;
   char *errstr;
@@ -6393,8 +6255,7 @@ lookup_vk_code (char *key)
 /* Convert a one-element vector style key sequence to a hot key
    definition.  */
 static Lisp_Object
-w32_parse_hot_key (key)
-     Lisp_Object key;
+w32_parse_hot_key (Lisp_Object key)
 {
   /* Copied from Fdefine_key and store_in_keymap.  */
   register Lisp_Object c;
@@ -6475,8 +6336,7 @@ modifier is interpreted as Alt if `w32-alt-is-meta' is t, and hyper
 is always interpreted as the Windows modifier keys.
 
 The return value is the hotkey-id if registered, otherwise nil.  */)
-  (key)
-     Lisp_Object key;
+  (Lisp_Object key)
 {
   key = w32_parse_hot_key (key);
 
@@ -6508,8 +6368,7 @@ The return value is the hotkey-id if registered, otherwise nil.  */)
 DEFUN ("w32-unregister-hot-key", Fw32_unregister_hot_key,
        Sw32_unregister_hot_key, 1, 1, 0,
        doc: /* Unregister KEY as a hot-key combination.  */)
-  (key)
-     Lisp_Object key;
+  (Lisp_Object key)
 {
   Lisp_Object item;
 
@@ -6541,7 +6400,7 @@ DEFUN ("w32-unregister-hot-key", Fw32_unregister_hot_key,
 DEFUN ("w32-registered-hot-keys", Fw32_registered_hot_keys,
        Sw32_registered_hot_keys, 0, 0, 0,
        doc: /* Return list of registered hot-key IDs.  */)
-  ()
+  (void)
 {
   return Fdelq (Qnil, Fcopy_sequence (w32_grabbed_keys));
 }
@@ -6550,8 +6409,7 @@ DEFUN ("w32-reconstruct-hot-key", Fw32_reconstruct_hot_key,
        Sw32_reconstruct_hot_key, 1, 1, 0,
        doc: /* Convert hot-key ID to a lisp key combination.
 usage: (w32-reconstruct-hot-key ID)  */)
-  (hotkeyid)
-     Lisp_Object hotkeyid;
+  (Lisp_Object hotkeyid)
 {
   int vk_code, w32_modifiers;
   Lisp_Object key;
@@ -6585,8 +6443,7 @@ DEFUN ("w32-toggle-lock-key", Fw32_toggle_lock_key,
 KEY can be `capslock', `kp-numlock', or `scroll'.
 If the optional parameter NEW-STATE is a number, then the state of KEY
 is set to off if the low bit of NEW-STATE is zero, otherwise on.  */)
-  (key, new_state)
-     Lisp_Object key, new_state;
+  (Lisp_Object key, Lisp_Object new_state)
 {
   int vk_code;
 
@@ -6622,8 +6479,7 @@ DEFUN ("w32-window-exists-p", Fw32_window_exists_p, Sw32_window_exists_p,
        doc: /* Return non-nil if a window exists with the specified CLASS and NAME.
 
 This is a direct interface to the Windows API FindWindow function.  */)
-  (class, name)
-Lisp_Object class, name;
+  (Lisp_Object class, Lisp_Object name)
 {
   HWND hnd;
 
@@ -6652,7 +6508,7 @@ The following %-sequences are provided:
 %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'  */)
-  ()
+  (void)
 {
   Lisp_Object status = Qnil;
 
@@ -6756,8 +6612,7 @@ Value is a list of floats (TOTAL FREE AVAIL), where TOTAL is the total
 storage of the file system, FREE is the free storage, and AVAIL is the
 storage available to a non-superuser.  All 3 numbers are in bytes.
 If the underlying system call fails, value is nil.  */)
-  (filename)
-  Lisp_Object filename;
+  (Lisp_Object filename)
 {
   Lisp_Object encoded, value;
 
@@ -6849,7 +6704,7 @@ If the underlying system call fails, value is nil.  */)
 \f
 DEFUN ("default-printer-name", Fdefault_printer_name, Sdefault_printer_name,
        0, 0, 0, doc: /* Return the name of Windows default printer device.  */)
-     ()
+  (void)
 {
   static char pname_buf[256];
   int err;
@@ -6958,10 +6813,11 @@ frame_parm_handler w32_frame_parm_handlers[] =
   x_set_font_backend,
   x_set_alpha,
   0, /* x_set_sticky */
+  0, /* x_set_tool_bar_position */
 };
 
 void
-syms_of_w32fns ()
+syms_of_w32fns (void)
 {
   globals_of_w32fns ();
   /* This is zero if not using MS-Windows.  */
@@ -7318,7 +7174,7 @@ only be necessary if the default setting causes problems.  */);
        is non zero.
  */
 void
-globals_of_w32fns ()
+globals_of_w32fns (void)
 {
   HMODULE user32_lib = GetModuleHandle ("user32.dll");
   /*
@@ -7361,7 +7217,7 @@ globals_of_w32fns ()
 #undef abort
 
 void
-w32_abort ()
+w32_abort (void)
 {
   int button;
   button = MessageBox (NULL,
@@ -7389,7 +7245,7 @@ w32_abort ()
 
 /* For convenience when debugging.  */
 int
-w32_last_error ()
+w32_last_error (void)
 {
   return GetLastError ();
 }
index e93dbca2ddbf4e2dac0c508e8050e70acd95092e..46fca5d78d5ad4ad3cd4e7966162cc89b9f8407e 100644 (file)
@@ -72,7 +72,7 @@ static Lisp_Object Qstandard, Qsubpixel, Qnatural;
 static Lisp_Object Qzh;
 
 /* scripts */
-static Lisp_Object Qlatin, Qgreek, Qcoptic, Qcyrillic, Qarmenian, Qhebrew;
+static Lisp_Object Qgreek, Qcoptic, Qcyrillic, Qarmenian, Qhebrew;
 static Lisp_Object Qarabic, Qsyriac, Qnko, Qthaana, Qdevanagari, Qbengali;
 static Lisp_Object Qgurmukhi, Qgujarati, Qoriya, Qtamil, Qtelugu;
 static Lisp_Object Qkannada, Qmalayalam, Qsinhala, Qthai, Qlao;
@@ -106,28 +106,28 @@ static Lisp_Object Vw32_charset_info_alist;
 /* Font spacing symbols - defined in font.c.  */
 extern Lisp_Object Qc, Qp, Qm;
 
-static void fill_in_logfont P_ ((FRAME_PTR, LOGFONT *, Lisp_Object));
+static void fill_in_logfont (FRAME_PTR, LOGFONT *, Lisp_Object);
 
-static BYTE w32_antialias_type P_ ((Lisp_Object));
-static Lisp_Object lispy_antialias_type P_ ((BYTE));
+static BYTE w32_antialias_type (Lisp_Object);
+static Lisp_Object lispy_antialias_type (BYTE);
 
-static Lisp_Object font_supported_scripts P_ ((FONTSIGNATURE *));
-static int w32font_full_name P_ ((LOGFONT *, Lisp_Object, int, char *, int));
-static void compute_metrics P_ ((HDC, struct w32font_info *, unsigned int,
-                                struct w32_metric_cache *));
+static Lisp_Object font_supported_scripts (FONTSIGNATURE *);
+static int w32font_full_name (LOGFONT *, Lisp_Object, int, char *, int);
+static void compute_metrics (HDC, struct w32font_info *, unsigned int,
+                             struct w32_metric_cache *);
 
-static Lisp_Object w32_registry P_ ((LONG, DWORD));
+static Lisp_Object w32_registry (LONG, DWORD);
 
 /* EnumFontFamiliesEx callbacks.  */
-static int CALLBACK add_font_entity_to_list P_ ((ENUMLOGFONTEX *,
+static int CALLBACK add_font_entity_to_list (ENUMLOGFONTEX *,
+                                             NEWTEXTMETRICEX *,
+                                             DWORD, LPARAM);
+static int CALLBACK add_one_font_entity_to_list (ENUMLOGFONTEX *,
                                                  NEWTEXTMETRICEX *,
-                                                 DWORD, LPARAM));
-static int CALLBACK add_one_font_entity_to_list P_ ((ENUMLOGFONTEX *,
-                                                     NEWTEXTMETRICEX *,
-                                                     DWORD, LPARAM));
-static int CALLBACK add_font_name_to_list P_ ((ENUMLOGFONTEX *,
-                                               NEWTEXTMETRICEX *,
-                                               DWORD, LPARAM));
+                                                 DWORD, LPARAM);
+static int CALLBACK add_font_name_to_list (ENUMLOGFONTEX *,
+                                           NEWTEXTMETRICEX *,
+                                           DWORD, LPARAM);
 
 /* struct passed in as LPARAM arg to EnumFontFamiliesEx, for keeping track
    of what we really want.  */
@@ -149,12 +149,11 @@ struct font_callback_data
 
 /* Handles the problem that EnumFontFamiliesEx will not return all
    style variations if the font name is not specified.  */
-static void list_all_matching_fonts P_ ((struct font_callback_data *));
+static void list_all_matching_fonts (struct font_callback_data *);
 
 
 static int
-memq_no_quit (elt, list)
-     Lisp_Object elt, list;
+memq_no_quit (Lisp_Object elt, Lisp_Object list)
 {
   while (CONSP (list) && ! EQ (XCAR (list), elt))
     list = XCDR (list);
@@ -162,8 +161,7 @@ memq_no_quit (elt, list)
 }
 
 Lisp_Object
-intern_font_name (string)
-     char * string;
+intern_font_name (char * string)
 {
   Lisp_Object obarray, tem, str;
   int len;
@@ -185,8 +183,7 @@ intern_font_name (string)
    Return a cache of font-entities on FRAME.  The cache must be a
    cons whose cdr part is the actual cache area.  */
 Lisp_Object
-w32font_get_cache (f)
-     FRAME_PTR f;
+w32font_get_cache (FRAME_PTR f)
 {
   struct w32_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
 
@@ -198,8 +195,7 @@ w32font_get_cache (f)
    is a vector of font-entities.  This is the sole API that
    allocates font-entities.  */
 static Lisp_Object
-w32font_list (frame, font_spec)
-     Lisp_Object frame, font_spec;
+w32font_list (Lisp_Object frame, Lisp_Object font_spec)
 {
   Lisp_Object fonts = w32font_list_internal (frame, font_spec, 0);
   FONT_ADD_LOG ("w32font-list", font_spec, fonts);
@@ -211,8 +207,7 @@ w32font_list (frame, font_spec)
    FRAME.  The closeness is detemined by the font backend, thus
    `face-font-selection-order' is ignored here.  */
 static Lisp_Object
-w32font_match (frame, font_spec)
-     Lisp_Object frame, font_spec;
+w32font_match (Lisp_Object frame, Lisp_Object font_spec)
 {
   Lisp_Object entity = w32font_match_internal (frame, font_spec, 0);
   FONT_ADD_LOG ("w32font-match", font_spec, entity);
@@ -223,15 +218,14 @@ w32font_match (frame, font_spec)
    List available families.  The value is a list of family names
    (symbols).  */
 static Lisp_Object
-w32font_list_family (frame)
-     Lisp_Object frame;
+w32font_list_family (Lisp_Object frame)
 {
   Lisp_Object list = Qnil;
   LOGFONT font_match_pattern;
   HDC dc;
   FRAME_PTR f = XFRAME (frame);
 
-  bzero (&font_match_pattern, sizeof (font_match_pattern));
+  memset (&font_match_pattern, 0, sizeof (font_match_pattern));
   font_match_pattern.lfCharSet = DEFAULT_CHARSET;
 
   dc = get_frame_dc (f);
@@ -248,10 +242,7 @@ w32font_list_family (frame)
    Open a font specified by FONT_ENTITY on frame F.
    If the font is scalable, open it with PIXEL_SIZE.  */
 static Lisp_Object
-w32font_open (f, font_entity, pixel_size)
-     FRAME_PTR f;
-     Lisp_Object font_entity;
-     int pixel_size;
+w32font_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size)
 {
   Lisp_Object font_object
     = font_make_object (VECSIZE (struct w32font_info),
@@ -275,9 +266,7 @@ w32font_open (f, font_entity, pixel_size)
 /* w32 implementation of close for font_backend.
    Close FONT on frame F.  */
 void
-w32font_close (f, font)
-     FRAME_PTR f;
-     struct font *font;
+w32font_close (FRAME_PTR f, struct font *font)
 {
   int i;
   struct w32font_info *w32_font = (struct w32font_info *) font;
@@ -303,9 +292,7 @@ w32font_close (f, font)
    return 1.  If not, return 0.  If a font must be opened to check
    it, return -1.  */
 int
-w32font_has_char (entity, c)
-     Lisp_Object entity;
-     int c;
+w32font_has_char (Lisp_Object entity, int c)
 {
   /* We can't be certain about which characters a font will support until
      we open it.  Checking the scripts that the font supports turns out
@@ -354,9 +341,7 @@ w32font_has_char (entity, c)
    which characters are not supported by the font.
   */
 static unsigned
-w32font_encode_char (font, c)
-     struct font *font;
-     int c;
+w32font_encode_char (struct font *font, int c)
 {
   struct w32font_info * w32_font = (struct w32font_info *)font;
 
@@ -373,11 +358,8 @@ w32font_encode_char (font, c)
    CODE (length NGLYPHS).  Apparently metrics can be NULL, in this
    case just return the overall width.  */
 int
-w32font_text_extents (font, code, nglyphs, metrics)
-     struct font *font;
-     unsigned *code;
-     int nglyphs;
-     struct font_metrics *metrics;
+w32font_text_extents (struct font *font, unsigned *code,
+                     int nglyphs, struct font_metrics *metrics)
 {
   int i;
   HFONT old_font = NULL;
@@ -391,7 +373,7 @@ w32font_text_extents (font, code, nglyphs, metrics)
 
   if (metrics)
     {
-      bzero (metrics, sizeof (struct font_metrics));
+      memset (metrics, 0, sizeof (struct font_metrics));
       metrics->ascent = font->ascent;
       metrics->descent = font->descent;
 
@@ -412,9 +394,9 @@ w32font_text_extents (font, code, nglyphs, metrics)
                  = xrealloc (w32_font->cached_metrics,
                              (block + 1)
                              * sizeof (struct w32_metric_cache *));
-             bzero (w32_font->cached_metrics + w32_font->n_cache_blocks,
-                    ((block + 1 - w32_font->n_cache_blocks)
-                     * sizeof (struct w32_metric_cache *)));
+             memset (w32_font->cached_metrics + w32_font->n_cache_blocks, 0,
+                     ((block + 1 - w32_font->n_cache_blocks)
+                      * sizeof (struct w32_metric_cache *)));
              w32_font->n_cache_blocks = block + 1;
            }
 
@@ -422,8 +404,8 @@ w32font_text_extents (font, code, nglyphs, metrics)
            {
              w32_font->cached_metrics[block]
                = xmalloc (CACHE_BLOCKSIZE * sizeof (struct w32_metric_cache));
-             bzero (w32_font->cached_metrics[block],
-                    CACHE_BLOCKSIZE * sizeof (struct w32_metric_cache));
+             memset (w32_font->cached_metrics[block], 0,
+                     CACHE_BLOCKSIZE * sizeof (struct w32_metric_cache));
            }
 
          char_metric = w32_font->cached_metrics[block] + pos_in_block;
@@ -552,9 +534,8 @@ w32font_text_extents (font, code, nglyphs, metrics)
 */
 
 int
-w32font_draw (s, from, to, x, y, with_background)
-     struct glyph_string *s;
-     int from, to, x, y, with_background;
+w32font_draw (struct glyph_string *s, int from, int to,
+             int x, int y, int with_background)
 {
   UINT options;
   HRGN orig_clip = NULL;
@@ -568,7 +549,7 @@ w32font_draw (s, from, to, x, y, with_background)
 
       /* Save clip region for later restoration.  */
       orig_clip = CreateRectRgn (0, 0, 0, 0);
-      if (!GetClipRgn(s->hdc, orig_clip))
+      if (!GetClipRgn (s->hdc, orig_clip))
        {
          DeleteObject (orig_clip);
          orig_clip = NULL;
@@ -715,9 +696,7 @@ w32font_otf_drive (struct font *font, Lisp_Object features,
    Additional parameter opentype_only restricts the returned fonts to
    opentype fonts, which can be used with the Uniscribe backend.  */
 Lisp_Object
-w32font_list_internal (frame, font_spec, opentype_only)
-     Lisp_Object frame, font_spec;
-     int opentype_only;
+w32font_list_internal (Lisp_Object frame, Lisp_Object font_spec, int opentype_only)
 {
   struct font_callback_data match_data;
   HDC dc;
@@ -727,7 +706,7 @@ w32font_list_internal (frame, font_spec, opentype_only)
   match_data.list = Qnil;
   match_data.frame = frame;
 
-  bzero (&match_data.pattern, sizeof (LOGFONT));
+  memset (&match_data.pattern, 0, sizeof (LOGFONT));
   fill_in_logfont (f, &match_data.pattern, font_spec);
 
   /* If the charset is unrecognized, then we won't find a font, so don't
@@ -770,9 +749,7 @@ w32font_list_internal (frame, font_spec, opentype_only)
    Additional parameter opentype_only restricts the returned fonts to
    opentype fonts, which can be used with the Uniscribe backend.  */
 Lisp_Object
-w32font_match_internal (frame, font_spec, opentype_only)
-     Lisp_Object frame, font_spec;
-     int opentype_only;
+w32font_match_internal (Lisp_Object frame, Lisp_Object font_spec, int opentype_only)
 {
   struct font_callback_data match_data;
   HDC dc;
@@ -782,7 +759,7 @@ w32font_match_internal (frame, font_spec, opentype_only)
   match_data.frame = frame;
   match_data.list = Qnil;
 
-  bzero (&match_data.pattern, sizeof (LOGFONT));
+  memset (&match_data.pattern, 0, sizeof (LOGFONT));
   fill_in_logfont (f, &match_data.pattern, font_spec);
 
   match_data.opentype_only = opentype_only;
@@ -800,11 +777,8 @@ w32font_match_internal (frame, font_spec, opentype_only)
 }
 
 int
-w32font_open_internal (f, font_entity, pixel_size, font_object)
-     FRAME_PTR f;
-     Lisp_Object font_entity;
-     int pixel_size;
-     Lisp_Object font_object;
+w32font_open_internal (FRAME_PTR f, Lisp_Object font_entity,
+                      int pixel_size, Lisp_Object font_object)
 {
   int len, size, i;
   LOGFONT logfont;
@@ -821,7 +795,7 @@ w32font_open_internal (f, font_entity, pixel_size, font_object)
   if (!font)
     return 0;
 
-  bzero (&logfont, sizeof (logfont));
+  memset (&logfont, 0, sizeof (logfont));
   fill_in_logfont (f, &logfont, font_entity);
 
   /* Prefer truetype fonts, to avoid known problems with type1 fonts, and
@@ -850,8 +824,8 @@ w32font_open_internal (f, font_entity, pixel_size, font_object)
     {
       metrics = (OUTLINETEXTMETRICW *) alloca (len);
       if (GetOutlineTextMetricsW (dc, len, metrics))
-        bcopy (&metrics->otmTextMetrics, &w32_font->metrics,
-               sizeof (TEXTMETRICW));
+        memcpy (&w32_font->metrics, &metrics->otmTextMetrics,
+               sizeof (TEXTMETRICW));
       else
         metrics = NULL;
     }
@@ -951,11 +925,9 @@ w32font_open_internal (f, font_entity, pixel_size, font_object)
 /* Callback function for EnumFontFamiliesEx.
  * Adds the name of a font to a Lisp list (passed in as the lParam arg).  */
 static int CALLBACK
-add_font_name_to_list (logical_font, physical_font, font_type, list_object)
-     ENUMLOGFONTEX *logical_font;
-     NEWTEXTMETRICEX *physical_font;
-     DWORD font_type;
-     LPARAM list_object;
+add_font_name_to_list (ENUMLOGFONTEX *logical_font,
+                      NEWTEXTMETRICEX *physical_font,
+                      DWORD font_type, LPARAM list_object)
 {
   Lisp_Object* list = (Lisp_Object *) list_object;
   Lisp_Object family;
@@ -971,19 +943,17 @@ add_font_name_to_list (logical_font, physical_font, font_type, list_object)
   return 1;
 }
 
-static int w32_decode_weight P_ ((int));
-static int w32_encode_weight P_ ((int));
+static int w32_decode_weight (int);
+static int w32_encode_weight (int);
 
 /* Convert an enumerated Windows font to an Emacs font entity.  */
 static Lisp_Object
-w32_enumfont_pattern_entity (frame, logical_font, physical_font,
-                             font_type, requested_font, backend)
-     Lisp_Object frame;
-     ENUMLOGFONTEX *logical_font;
-     NEWTEXTMETRICEX *physical_font;
-     DWORD font_type;
-     LOGFONT *requested_font;
-     Lisp_Object backend;
+w32_enumfont_pattern_entity (Lisp_Object frame,
+                            ENUMLOGFONTEX *logical_font,
+                            NEWTEXTMETRICEX *physical_font,
+                            DWORD font_type,
+                            LOGFONT *requested_font,
+                            Lisp_Object backend)
 {
   Lisp_Object entity, tem;
   LOGFONT *lf = (LOGFONT*) logical_font;
@@ -1107,8 +1077,7 @@ w32_generic_family (Lisp_Object name)
 }
 
 static int
-logfonts_match (font, pattern)
-     LOGFONT *font, *pattern;
+logfonts_match (LOGFONT *font, LOGFONT *pattern)
 {
   /* Only check height for raster fonts.  */
   if (pattern->lfHeight && font->lfOutPrecision == OUT_STRING_PRECIS
@@ -1132,12 +1101,9 @@ logfonts_match (font, pattern)
 #define CSB_CHINESE ((1 << 18) | (1 << 20))
 
 static int
-font_matches_spec (type, font, spec, backend, logfont)
-     DWORD type;
-     NEWTEXTMETRICEX *font;
-     Lisp_Object spec;
-     Lisp_Object backend;
-     LOGFONT *logfont;
+font_matches_spec (DWORD type, NEWTEXTMETRICEX *font,
+                  Lisp_Object spec, Lisp_Object backend,
+                  LOGFONT *logfont)
 {
   Lisp_Object extra, val;
 
@@ -1322,9 +1288,7 @@ font_matches_spec (type, font, spec, backend, logfont)
 }
 
 static int
-w32font_coverage_ok (coverage, charset)
-     FONTSIGNATURE * coverage;
-     BYTE charset;
+w32font_coverage_ok (FONTSIGNATURE * coverage, BYTE charset)
 {
   DWORD subrange1 = coverage->fsUsb[1];
 
@@ -1350,9 +1314,7 @@ w32font_coverage_ok (coverage, charset)
 
 
 static int
-check_face_name (font, full_name)
-     LOGFONT *font;
-     char *full_name;
+check_face_name (LOGFONT *font, char *full_name)
 {
   char full_iname[LF_FULLFACESIZE+1];
 
@@ -1397,11 +1359,9 @@ check_face_name (font, full_name)
  * and the list to which the fonts are added are passed in via the
  * lparam argument, in the form of a font_callback_data struct. */
 static int CALLBACK
-add_font_entity_to_list (logical_font, physical_font, font_type, lParam)
-     ENUMLOGFONTEX *logical_font;
-     NEWTEXTMETRICEX *physical_font;
-     DWORD font_type;
-     LPARAM lParam;
+add_font_entity_to_list (ENUMLOGFONTEX *logical_font,
+                        NEWTEXTMETRICEX *physical_font,
+                        DWORD font_type, LPARAM lParam)
 {
   struct font_callback_data *match_data
     = (struct font_callback_data *) lParam;
@@ -1510,11 +1470,9 @@ add_font_entity_to_list (logical_font, physical_font, font_type, lParam)
 /* Callback function for EnumFontFamiliesEx.
  * Terminates the search once we have a match. */
 static int CALLBACK
-add_one_font_entity_to_list (logical_font, physical_font, font_type, lParam)
-     ENUMLOGFONTEX *logical_font;
-     NEWTEXTMETRICEX *physical_font;
-     DWORD font_type;
-     LPARAM lParam;
+add_one_font_entity_to_list (ENUMLOGFONTEX *logical_font,
+                            NEWTEXTMETRICEX *physical_font,
+                            DWORD font_type, LPARAM lParam)
 {
   struct font_callback_data *match_data
     = (struct font_callback_data *) lParam;
@@ -1526,8 +1484,7 @@ add_one_font_entity_to_list (logical_font, physical_font, font_type, lParam)
 
 /* Old function to convert from x to w32 charset, from w32fns.c.  */
 static LONG
-x_to_w32_charset (lpcs)
-    char * lpcs;
+x_to_w32_charset (char * lpcs)
 {
   Lisp_Object this_entry, w32_charset;
   char *charset;
@@ -1609,8 +1566,7 @@ x_to_w32_charset (lpcs)
 
 /* Convert a Lisp font registry (symbol) to a windows charset.  */
 static LONG
-registry_to_w32_charset (charset)
-     Lisp_Object charset;
+registry_to_w32_charset (Lisp_Object charset)
 {
   if (EQ (charset, Qiso10646_1) || EQ (charset, Qunicode_bmp)
       || EQ (charset, Qunicode_sip))
@@ -1625,9 +1581,7 @@ registry_to_w32_charset (charset)
 
 /* Old function to convert from w32 to x charset, from w32fns.c.  */
 static char *
-w32_to_x_charset (fncharset, matching)
-    int fncharset;
-    char *matching;
+w32_to_x_charset (int fncharset, char *matching)
 {
   static char buf[32];
   Lisp_Object charset_type;
@@ -1821,9 +1775,7 @@ w32_to_x_charset (fncharset, matching)
 }
 
 static Lisp_Object
-w32_registry (w32_charset, font_type)
-     LONG w32_charset;
-     DWORD font_type;
+w32_registry (LONG w32_charset, DWORD font_type)
 {
   char *charset;
 
@@ -1833,12 +1785,11 @@ w32_registry (w32_charset, font_type)
     return font_type == TRUETYPE_FONTTYPE ? Qiso10646_1 : Qunknown;
 
   charset = w32_to_x_charset (w32_charset, NULL);
-  return font_intern_prop (charset, strlen(charset), 1);
+  return font_intern_prop (charset, strlen (charset), 1);
 }
 
 static int
-w32_decode_weight (fnweight)
-     int fnweight;
+w32_decode_weight (int fnweight)
 {
   if (fnweight >= FW_HEAVY)      return 210;
   if (fnweight >= FW_EXTRABOLD)  return 205;
@@ -1852,8 +1803,7 @@ w32_decode_weight (fnweight)
 }
 
 static int
-w32_encode_weight (n)
-     int n;
+w32_encode_weight (int n)
 {
   if (n >= 210) return FW_HEAVY;
   if (n >= 205) return FW_EXTRABOLD;
@@ -1869,8 +1819,7 @@ w32_encode_weight (n)
 /* Convert a Windows font weight into one of the weights supported
    by fontconfig (see font.c:font_parse_fcname).  */
 static Lisp_Object
-w32_to_fc_weight (n)
-     int n;
+w32_to_fc_weight (int n)
 {
   if (n >= FW_EXTRABOLD) return intern ("black");
   if (n >= FW_BOLD) return intern ("bold");
@@ -1881,10 +1830,7 @@ w32_to_fc_weight (n)
 
 /* Fill in all the available details of LOGFONT from FONT_SPEC.  */
 static void
-fill_in_logfont (f, logfont, font_spec)
-     FRAME_PTR f;
-     LOGFONT *logfont;
-     Lisp_Object font_spec;
+fill_in_logfont (FRAME_PTR f, LOGFONT *logfont, Lisp_Object font_spec)
 {
   Lisp_Object tmp, extra;
   int dpi = FRAME_W32_DISPLAY_INFO (f)->resy;
@@ -2029,8 +1975,7 @@ fill_in_logfont (f, logfont, font_spec)
 }
 
 static void
-list_all_matching_fonts (match_data)
-     struct font_callback_data *match_data;
+list_all_matching_fonts (struct font_callback_data *match_data)
 {
   HDC dc;
   Lisp_Object families = w32font_list_family (match_data->frame);
@@ -2066,8 +2011,7 @@ list_all_matching_fonts (match_data)
 }
 
 static Lisp_Object
-lispy_antialias_type (type)
-     BYTE type;
+lispy_antialias_type (BYTE type)
 {
   Lisp_Object lispy;
 
@@ -2094,8 +2038,7 @@ lispy_antialias_type (type)
 
 /* Convert antialiasing symbols to lfQuality  */
 static BYTE
-w32_antialias_type (type)
-     Lisp_Object type;
+w32_antialias_type (Lisp_Object type)
 {
   if (EQ (type, Qnone))
     return NONANTIALIASED_QUALITY;
@@ -2241,12 +2184,8 @@ font_supported_scripts (FONTSIGNATURE * sig)
    The full name is in fcname format, with weight, slant and antialiasing
    specified if they are not "normal".  */
 static int
-w32font_full_name (font, font_obj, pixel_size, name, nbytes)
-  LOGFONT * font;
-  Lisp_Object font_obj;
-  int pixel_size;
-  char *name;
-  int nbytes;
+w32font_full_name (LOGFONT * font, Lisp_Object font_obj,
+                  int pixel_size, char *name, int nbytes)
 {
   int len, height, outline;
   char *p;
@@ -2317,11 +2256,8 @@ w32font_full_name (font, font_obj, pixel_size, name, nbytes)
    is written.  If the buffer is not large enough to contain the name,
    the function returns -1, otherwise it returns the number of bytes
    written to FCNAME.  */
-static int logfont_to_fcname(font, pointsize, fcname, size)
-     LOGFONT* font;
-     int pointsize;
-     char *fcname;
-     int size;
+static int
+logfont_to_fcname (LOGFONT* font, int pointsize, char *fcname, int size)
 {
   int len, height;
   char *p = fcname;
@@ -2360,11 +2296,8 @@ static int logfont_to_fcname(font, pointsize, fcname, size)
 }
 
 static void
-compute_metrics (dc, w32_font, code, metrics)
-     HDC dc;
-     struct w32font_info *w32_font;
-     unsigned int code;
-     struct w32_metric_cache *metrics;
+compute_metrics (HDC dc, struct w32font_info *w32_font, unsigned int code,
+                struct w32_metric_cache *metrics)
 {
   GLYPHMETRICS gm;
   MAT2 transform;
@@ -2373,7 +2306,7 @@ compute_metrics (dc, w32_font, code, metrics)
   if (w32_font->glyph_idx)
     options |= GGO_GLYPH_INDEX;
 
-  bzero (&transform, sizeof (transform));
+  memset (&transform, 0, sizeof (transform));
   transform.eM11.value = 1;
   transform.eM22.value = 1;
 
@@ -2396,8 +2329,7 @@ Return fontconfig style font string corresponding to the selection.
 If FRAME is omitted or nil, it defaults to the selected frame.
 If EXCLUDE-PROPORTIONAL is non-nil, exclude proportional fonts
 in the font selection dialog. */)
-  (frame, exclude_proportional)
-     Lisp_Object frame, exclude_proportional;
+  (Lisp_Object frame, Lisp_Object exclude_proportional)
 {
   FRAME_PTR f = check_x_frame (frame);
   CHOOSEFONT cf;
@@ -2407,8 +2339,8 @@ in the font selection dialog. */)
   HANDLE oldobj;
   char buf[100];
 
-  bzero (&cf, sizeof (cf));
-  bzero (&lf, sizeof (lf));
+  memset (&cf, 0, sizeof (cf));
+  memset (&lf, 0, sizeof (lf));
 
   cf.lStructSize = sizeof (cf);
   cf.hwndOwner = FRAME_W32_WINDOW (f);
@@ -2482,7 +2414,7 @@ struct font_driver w32font_driver =
 /* Initialize state that does not change between invocations. This is only
    called when Emacs is dumped.  */
 void
-syms_of_w32font ()
+syms_of_w32font (void)
 {
   DEFSYM (Qgdi, "gdi");
   DEFSYM (Quniscribe, "uniscribe");
index 3e2345589b5b0093151b2af8636f7024542476de..6479f95faf5be9de85f5992e293f78a7cbfde3eb 100644 (file)
@@ -62,26 +62,26 @@ struct w32font_info
 
 #define CACHE_BLOCKSIZE 128
 
-Lisp_Object w32font_get_cache P_ ((FRAME_PTR fe));
-Lisp_Object w32font_list_internal P_ ((Lisp_Object frame,
-                                       Lisp_Object font_spec,
-                                       int opentype_only));
-Lisp_Object w32font_match_internal P_ ((Lisp_Object frame,
-                                        Lisp_Object font_spec,
-                                        int opentype_only));
-int w32font_open_internal P_ ((FRAME_PTR f, Lisp_Object font_entity,
-                               int pixel_size, Lisp_Object font_object));
-void w32font_close P_ ((FRAME_PTR f, struct font *font));
-int w32font_has_char P_ ((Lisp_Object entity, int c));
-int w32font_text_extents P_ ((struct font *font, unsigned *code, int nglyphs,
-                              struct font_metrics *metrics));
-int w32font_draw P_ ((struct glyph_string *s, int from, int to,
-                      int x, int y, int with_background));
-
-
-int uniscribe_check_otf P_ ((LOGFONT *font, Lisp_Object otf_spec));
-
-Lisp_Object intern_font_name P_ ((char *));
+Lisp_Object w32font_get_cache (FRAME_PTR fe);
+Lisp_Object w32font_list_internal (Lisp_Object frame,
+                                   Lisp_Object font_spec,
+                                   int opentype_only);
+Lisp_Object w32font_match_internal (Lisp_Object frame,
+                                    Lisp_Object font_spec,
+                                    int opentype_only);
+int w32font_open_internal (FRAME_PTR f, Lisp_Object font_entity,
+                           int pixel_size, Lisp_Object font_object);
+void w32font_close (FRAME_PTR f, struct font *font);
+int w32font_has_char (Lisp_Object entity, int c);
+int w32font_text_extents (struct font *font, unsigned *code, int nglyphs,
+                          struct font_metrics *metrics);
+int w32font_draw (struct glyph_string *s, int from, int to,
+                  int x, int y, int with_background);
+
+
+int uniscribe_check_otf (LOGFONT *font, Lisp_Object otf_spec);
+
+Lisp_Object intern_font_name (char *);
 
 #endif
 
index 07a6fed0b475e8d21e89a949ba6a049bd07fb373..9cad4f21f21bd69733dfe9226509b2ee07c3e7d7 100644 (file)
@@ -118,7 +118,7 @@ extern int nCmdShow;
 #define PBaseSize      (1L << 8) /* program specified base for incrementing */
 #define PWinGravity    (1L << 9) /* program specified window gravity */
 
-extern int XParseGeometry ();
+extern int XParseGeometry (char *, int *, int *, unsigned *, unsigned *);
 
 
 typedef struct {
index 440388c6eabd794956c8294408d4f60a170f81d1..e307694a563a0671b6582b49cc0984ed034a1b40 100644 (file)
@@ -222,7 +222,7 @@ sbrk (unsigned long increment)
    was allocated by something else; GNU malloc detects when there is a
    jump in the sbrk values, and starts a new heap block.  */
 void
-init_heap ()
+init_heap (void)
 {
   PIMAGE_DOS_HEADER dos_header;
   PIMAGE_NT_HEADERS nt_header;
index cbd7f7ae96df897559470beb9f806e93f65ed9b7..20a49a4e0ac018314d58f66e6c238c5d43edb3bd 100644 (file)
@@ -41,8 +41,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 #define get_w32_major_version()        w32_major_version
 #define get_w32_minor_version()        w32_minor_version
 
-extern unsigned char *get_data_start();
-extern unsigned char *get_data_end();
+extern unsigned char *get_data_start (void);
+extern unsigned char *get_data_end (void);
 extern unsigned long  reserved_heap_size;
 extern SYSTEM_INFO    sysinfo_cache;
 extern OSVERSIONINFO  osinfo_cache;
@@ -62,7 +62,7 @@ extern int os_subtype;
 extern void *sbrk (unsigned long size);
 
 /* Initialize heap structures for sbrk on startup.  */
-extern void init_heap ();
+extern void init_heap (void);
 
 /* Round the heap to this size.  */
 extern void round_heap (unsigned long size);
index 864b3b3f0bbfbbfa675c9498ecc71d7a3b4a4d74..1ab0546d44ff9bb0804ced35cd0b528494963f5e 100644 (file)
@@ -582,8 +582,8 @@ w32_console_mouse_position (FRAME_PTR *f,
   *part = 0;
   SELECTED_FRAME ()->mouse_moved = 0;
 
-  XSETINT(*x, movement_pos.X);
-  XSETINT(*y, movement_pos.Y);
+  XSETINT (*x, movement_pos.X);
+  XSETINT (*y, movement_pos.Y);
   *time = movement_time;
 
   UNBLOCK_INPUT;
@@ -684,7 +684,7 @@ resize_event (WINDOW_BUFFER_SIZE_RECORD *event)
 }
 
 static void
-maybe_generate_resize_event ()
+maybe_generate_resize_event (void)
 {
   CONSOLE_SCREEN_BUFFER_INFO info;
   FRAME_PTR f = get_frame ();
index 73fba8108c63ea1f9a0da698afb31d6f91646bb4..0ed9bffe70c888e1534a8def969fffbfd01f418f 100644 (file)
@@ -59,8 +59,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 HMENU current_popup_menu;
 
-void syms_of_w32menu ();
-void globals_of_w32menu ();
+void syms_of_w32menu (void);
+void globals_of_w32menu (void);
 
 typedef BOOL (WINAPI * GetMenuItemInfoA_Proc) (
     IN HMENU,
@@ -72,10 +72,16 @@ typedef BOOL (WINAPI * SetMenuItemInfoA_Proc) (
     IN UINT,
     IN BOOL,
     IN LPCMENUITEMINFOA);
+typedef int (WINAPI * MessageBoxW_Proc) (
+    IN HWND window,
+    IN WCHAR *text,
+    IN WCHAR *caption,
+    IN UINT type);
 
 GetMenuItemInfoA_Proc get_menu_item_info = NULL;
 SetMenuItemInfoA_Proc set_menu_item_info = NULL;
 AppendMenuW_Proc unicode_append_menu = NULL;
+MessageBoxW_Proc unicode_message_box = NULL;
 
 Lisp_Object Qdebug_on_next_call;
 
@@ -90,16 +96,18 @@ extern Lisp_Object Qoverriding_local_map, Qoverriding_terminal_local_map;
 
 extern Lisp_Object Qmenu_bar_update_hook;
 
-void set_frame_menubar P_ ((FRAME_PTR, int, int));
+void set_frame_menubar (FRAME_PTR, int, int);
 
 #ifdef HAVE_DIALOGS
-static Lisp_Object w32_dialog_show P_ ((FRAME_PTR, int, Lisp_Object, char**));
+static Lisp_Object w32_dialog_show (FRAME_PTR, int, Lisp_Object, char**);
 #else
-static int is_simple_dialog P_ ((Lisp_Object));
-static Lisp_Object simple_dialog_show P_ ((FRAME_PTR, Lisp_Object, Lisp_Object));
+static int is_simple_dialog (Lisp_Object);
+static Lisp_Object simple_dialog_show (FRAME_PTR, Lisp_Object, Lisp_Object);
 #endif
 
-void w32_free_menu_strings P_((HWND));
+static void utf8to16 (unsigned char *, int, WCHAR *);
+
+void w32_free_menu_strings (HWND);
 \f
 
 /* This is set nonzero after the user activates the menu bar, and set
@@ -111,31 +119,6 @@ void w32_free_menu_strings P_((HWND));
 
 int pending_menu_activation;
 \f
-
-/* Return the frame whose ->output_data.w32->menubar_widget equals
-   ID, or 0 if none.  */
-
-static struct frame *
-menubar_id_to_frame (id)
-     HMENU id;
-{
-  Lisp_Object tail, frame;
-  FRAME_PTR f;
-
-  for (tail = Vframe_list; CONSP (tail); tail = XCDR (tail))
-    {
-      frame = XCAR (tail);
-      if (!FRAMEP (frame))
-        continue;
-      f = XFRAME (frame);
-      if (!FRAME_WINDOW_P (f))
-       continue;
-      if (f->output_data.w32->menubar_widget == id)
-       return f;
-    }
-  return 0;
-}
-\f
 #ifdef HAVE_MENUS
 
 DEFUN ("x-popup-dialog", Fx_popup_dialog, Sx_popup_dialog, 2, 3, 0,
@@ -157,8 +140,7 @@ on the left of the dialog box and all following items on the right.
 
 If HEADER is non-nil, the frame title for the box is "Information",
 otherwise it is "Question". */)
-  (position, contents, header)
-     Lisp_Object position, contents, header;
+  (Lisp_Object position, Lisp_Object contents, Lisp_Object header)
 {
   FRAME_PTR f = NULL;
   Lisp_Object window;
@@ -276,8 +258,7 @@ otherwise it is "Question". */)
    This way we can safely execute Lisp code.  */
 
 void
-x_activate_menubar (f)
-     FRAME_PTR f;
+x_activate_menubar (FRAME_PTR f)
 {
   set_frame_menubar (f, 0, 1);
 
@@ -386,10 +367,7 @@ menubar_selection_callback (FRAME_PTR f, void * client_data)
    it is set the first time this is called, from initialize_frame_menubar.  */
 
 void
-set_frame_menubar (f, first_time, deep_p)
-     FRAME_PTR f;
-     int first_time;
-     int deep_p;
+set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
 {
   HMENU menubar_widget = f->output_data.w32->menubar_widget;
   Lisp_Object items;
@@ -442,12 +420,8 @@ set_frame_menubar (f, first_time, deep_p)
 
       set_buffer_internal_1 (XBUFFER (buffer));
 
-      /* Run the Lucid hook.  */
+      /* Run the hooks.  */
       safe_run_hooks (Qactivate_menubar_hook);
-      /* If it has changed current-menubar from previous value,
-        really recompute the menubar from the value.  */
-      if (! NILP (Vlucid_menu_bar_dirty_flag))
-       call0 (Qrecompute_lucid_menubar);
       safe_run_hooks (Qmenu_bar_update_hook);
       FRAME_MENU_BAR_ITEMS (f) = menu_bar_items (FRAME_MENU_BAR_ITEMS (f));
 
@@ -455,8 +429,8 @@ set_frame_menubar (f, first_time, deep_p)
 
       /* Save the frame's previous menu bar contents data.  */
       if (previous_menu_items_used)
-       bcopy (XVECTOR (f->menu_bar_vector)->contents, previous_items,
-              previous_menu_items_used * sizeof (Lisp_Object));
+       memcpy (previous_items, XVECTOR (f->menu_bar_vector)->contents,
+               previous_menu_items_used * sizeof (Lisp_Object));
 
       /* Fill in menu_items with the current menu bar contents.
         This can evaluate Lisp code.  */
@@ -648,8 +622,7 @@ set_frame_menubar (f, first_time, deep_p)
    is visible.  */
 
 void
-initialize_frame_menubar (f)
-     FRAME_PTR f;
+initialize_frame_menubar (FRAME_PTR f)
 {
   /* This function is called before the first chance to redisplay
      the frame.  It has to be, so the frame will have the right size.  */
@@ -661,8 +634,7 @@ initialize_frame_menubar (f)
    This is used when deleting a frame, and when turning off the menu bar.  */
 
 void
-free_frame_menubar (f)
-     FRAME_PTR f;
+free_frame_menubar (FRAME_PTR f)
 {
   BLOCK_INPUT;
 
@@ -694,7 +666,7 @@ free_frame_menubar (f)
 
 Lisp_Object
 w32_menu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
-              Lisp_Object title, char **error)
+              Lisp_Object title, const char **error)
 {
   int i;
   int menu_item_selection;
@@ -1020,11 +992,9 @@ static char * button_names [] = {
   "button6", "button7", "button8", "button9", "button10" };
 
 static Lisp_Object
-w32_dialog_show (f, keymaps, title, header, error)
-     FRAME_PTR f;
-     int keymaps;
-     Lisp_Object title, header;
-     char **error;
+w32_dialog_show (FRAME_PTR f, int keymaps,
+                Lisp_Object title, Lisp_Object header,
+                char **error)
 {
   int i, nb_buttons=0;
   char dialog_name[6];
@@ -1127,7 +1097,7 @@ w32_dialog_show (f, keymaps, title, header, error)
     /*  Frame title: 'Q' = Question, 'I' = Information.
         Can also have 'E' = Error if, one day, we want
         a popup for errors. */
-    if (NILP(header))
+    if (NILP (header))
       dialog_name[0] = 'Q';
     else
       dialog_name[0] = 'I';
@@ -1213,8 +1183,8 @@ w32_dialog_show (f, keymaps, title, header, error)
    anywhere in Emacs that uses the other specific dialog choices that
    MessageBox provides.  */
 
-static int is_simple_dialog (contents)
-  Lisp_Object contents;
+static int
+is_simple_dialog (Lisp_Object contents)
 {
   Lisp_Object options = XCDR (contents);
   Lisp_Object name, yes, no, other;
@@ -1249,36 +1219,78 @@ static int is_simple_dialog (contents)
   return !(CONSP (options));
 }
 
-static Lisp_Object simple_dialog_show (f, contents, header)
-     FRAME_PTR f;
-     Lisp_Object contents, header;
+static Lisp_Object
+simple_dialog_show (FRAME_PTR f, Lisp_Object contents, Lisp_Object header)
 {
   int answer;
   UINT type;
-  char *text, *title;
   Lisp_Object lispy_answer = Qnil, temp = XCAR (contents);
 
-  if (STRINGP (temp))
-    text = SDATA (temp);
-  else
-    text = "";
+  type = MB_YESNO;
 
-  if (NILP (header))
+  /* Since we only handle Yes/No dialogs, and we already checked
+     is_simple_dialog, we don't need to worry about checking contents
+     to see what type of dialog to use.  */
+
+  /* Use unicode if possible, so any language can be displayed.  */
+  if (unicode_message_box)
     {
-      title = "Question";
-      type = MB_ICONQUESTION;
+      WCHAR *text, *title;
+
+      if (STRINGP (temp))
+       {
+         char *utf8_text = SDATA (ENCODE_UTF_8 (temp));
+         /* Be pessimistic about the number of characters needed.
+            Remember characters outside the BMP will take more than
+            one utf16 word, so we cannot simply use the character
+            length of temp.  */
+         int utf8_len = strlen (utf8_text);
+         text = alloca ((utf8_len + 1) * sizeof (WCHAR));
+         utf8to16 (utf8_text, utf8_len, text);
+       }
+      else
+       {
+         text = L"";
+       }
+
+      if (NILP (header))
+       {
+         title = L"Question";
+         type |= MB_ICONQUESTION;
+       }
+      else
+       {
+         title = L"Information";
+         type |= MB_ICONINFORMATION;
+       }
+
+      answer = unicode_message_box (FRAME_W32_WINDOW (f), text, title, type);
     }
   else
     {
-      title = "Information";
-      type = MB_ICONINFORMATION;
-    }
-  type |= MB_YESNO;
+      char *text, *title;
 
-  /* Since we only handle Yes/No dialogs, and we already checked
-     is_simple_dialog, we don't need to worry about checking contents
-     to see what type of dialog to use.  */
-  answer = MessageBox (FRAME_W32_WINDOW (f), text, title, type);
+      /* Fall back on ANSI message box, but at least use system
+        encoding so questions representable by the system codepage
+        are encoded properly.  */
+      if (STRINGP (temp))
+       text = SDATA (ENCODE_SYSTEM (temp));
+      else
+       text = "";
+
+      if (NILP (header))
+       {
+         title = "Question";
+         type |= MB_ICONQUESTION;
+       }
+      else
+       {
+         title = "Information";
+         type |= MB_ICONINFORMATION;
+       }
+
+      answer = MessageBox (FRAME_W32_WINDOW (f), text, title, type);
+    }
 
   if (answer == IDYES)
     lispy_answer = build_string ("Yes");
@@ -1315,10 +1327,9 @@ static Lisp_Object simple_dialog_show (f, contents, header)
 
 /* Is this item a separator? */
 static int
-name_is_separator (name)
-     char *name;
+name_is_separator (const char *name)
 {
-  char *start = name;
+  const char *start = name;
 
   /* Check if name string consists of only dashes ('-').  */
   while (*name == '-') name++;
@@ -1328,14 +1339,6 @@ name_is_separator (name)
   return (*name == '\0' || start + 2 == name);
 }
 
-
-/* Indicate boundary between left and right.  */
-static int
-add_left_right_boundary (HMENU menu)
-{
-  return AppendMenu (menu, MF_MENUBARBREAK, 0, NULL);
-}
-
 /* UTF8: 0xxxxxxx, 110xxxxx 10xxxxxx, 1110xxxx, 10xxxxxx, 10xxxxxx */
 static void
 utf8to16 (unsigned char * src, int len, WCHAR * dest)
@@ -1404,7 +1407,7 @@ add_menu_item (HMENU menu, widget_value *wv, HMENU item)
          strcat (out_string, wv->key);
        }
       else
-       out_string = wv->name;
+       out_string = (char *)wv->name;
 
       /* Quote any special characters within the menu item's text and
         key binding.  */
@@ -1533,7 +1536,7 @@ add_menu_item (HMENU menu, widget_value *wv, HMENU item)
       if (set_menu_item_info)
        {
          MENUITEMINFO info;
-         bzero (&info, sizeof (info));
+         memset (&info, 0, sizeof (info));
          info.cbSize = sizeof (info);
          info.fMask = MIIM_DATA;
 
@@ -1616,7 +1619,7 @@ w32_menu_display_help (HWND owner, HMENU menu, UINT item, UINT flags)
        {
          MENUITEMINFO info;
 
-         bzero (&info, sizeof (info));
+         memset (&info, 0, sizeof (info));
          info.cbSize = sizeof (info);
          info.fMask = MIIM_DATA;
          get_menu_item_info (menu, item, FALSE, &info);
@@ -1647,14 +1650,13 @@ w32_menu_display_help (HWND owner, HMENU menu, UINT item, UINT flags)
 
 /* Free memory used by owner-drawn strings.  */
 static void
-w32_free_submenu_strings (menu)
-     HMENU menu;
+w32_free_submenu_strings (HMENU menu)
 {
   int i, num = GetMenuItemCount (menu);
   for (i = 0; i < num; i++)
     {
       MENUITEMINFO info;
-      bzero (&info, sizeof (info));
+      memset (&info, 0, sizeof (info));
       info.cbSize = sizeof (info);
       info.fMask = MIIM_DATA | MIIM_TYPE | MIIM_SUBMENU;
 
@@ -1676,8 +1678,7 @@ w32_free_submenu_strings (menu)
 }
 
 void
-w32_free_menu_strings (hwnd)
-     HWND hwnd;
+w32_free_menu_strings (HWND hwnd)
 {
   HMENU menu = current_popup_menu;
 
@@ -1701,7 +1702,7 @@ w32_free_menu_strings (hwnd)
 
 DEFUN ("menu-or-popup-active-p", Fmenu_or_popup_active_p, Smenu_or_popup_active_p, 0, 0, 0,
        doc: /* Return t if a menu or popup dialog is active on selected frame.  */)
-     ()
+  (void)
 {
 #ifdef HAVE_MENUS
   FRAME_PTR f;
@@ -1712,7 +1713,8 @@ DEFUN ("menu-or-popup-active-p", Fmenu_or_popup_active_p, Smenu_or_popup_active_
 #endif /* HAVE_MENUS */
 }
 
-void syms_of_w32menu ()
+void
+syms_of_w32menu (void)
 {
   globals_of_w32menu ();
 
@@ -1734,13 +1736,15 @@ void syms_of_w32menu ()
        variable initialized is 0 and directly from main when initialized
        is non zero.
  */
-void globals_of_w32menu ()
+void
+globals_of_w32menu (void)
 {
        /* See if Get/SetMenuItemInfo functions are available.  */
   HMODULE user32 = GetModuleHandle ("user32.dll");
   get_menu_item_info = (GetMenuItemInfoA_Proc) GetProcAddress (user32, "GetMenuItemInfoA");
   set_menu_item_info = (SetMenuItemInfoA_Proc) GetProcAddress (user32, "SetMenuItemInfoA");
   unicode_append_menu = (AppendMenuW_Proc) GetProcAddress (user32, "AppendMenuW");
+  unicode_message_box = (MessageBoxW_Proc) GetProcAddress (user32, "MessageBoxW");
 }
 
 /* arch-tag: 0eaed431-bb4e-4aac-a527-95a1b4f1fed0
index 9d4d58f123035a9b2e729b2f5145fbfdfbad1aa5..af923723709c6183c063603c7521ef5dfd7f3d12 100644 (file)
@@ -46,7 +46,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <windows.h>
 #ifdef __GNUC__
 /* This definition is missing from mingw32 headers. */
-extern BOOL WINAPI IsValidLocale(LCID, DWORD);
+extern BOOL WINAPI IsValidLocale (LCID, DWORD);
 #endif
 
 #ifdef HAVE_LANGINFO_CODESET
@@ -117,7 +117,8 @@ extern Lisp_Object Qlocal;
 Lisp_Object Qhigh, Qlow;
 
 #ifdef EMACSDEBUG
-void _DebPrint (const char *fmt, ...)
+void
+_DebPrint (const char *fmt, ...)
 {
   char buf[1024];
   va_list args;
@@ -129,7 +130,7 @@ void _DebPrint (const char *fmt, ...)
 }
 #endif
 
-typedef void (_CALLBACK_ *signal_handler)(int);
+typedef void (_CALLBACK_ *signal_handler) (int);
 
 /* Signal handlers...SIG_DFL == 0 so this is initialized correctly.  */
 static signal_handler sig_handlers[NSIG];
@@ -175,7 +176,7 @@ new_child (void)
   cp = &child_procs[child_proc_count++];
 
  Initialise:
-  memset (cp, 0, sizeof(*cp));
+  memset (cp, 0, sizeof (*cp));
   cp->fd = -1;
   cp->pid = -1;
   cp->procinfo.hProcess = NULL;
@@ -398,7 +399,7 @@ create_child (char *exe, char *cmdline, char *env, int is_gui_app,
   return TRUE;
 
  EH_Fail:
-  DebPrint (("create_child.CreateProcess failed: %ld\n", GetLastError()););
+  DebPrint (("create_child.CreateProcess failed: %ld\n", GetLastError ()););
   return FALSE;
 }
 
@@ -608,7 +609,10 @@ get_result:
 #endif
 
 void
-w32_executable_type (char * filename, int * is_dos_app, int * is_cygnus_app, int * is_gui_app)
+w32_executable_type (char * filename,
+                    int * is_dos_app,
+                    int * is_cygnus_app,
+                    int * is_gui_app)
 {
   file_data executable;
   char * p;
@@ -1719,8 +1723,7 @@ also loaded immediately if not already loaded.  If winsock is loaded,
 the winsock local hostname is returned (since this may be different from
 the value of `system-name' and should supplant it), otherwise t is
 returned to indicate winsock support is present.  */)
-  (load_now)
-     Lisp_Object load_now;
+  (Lisp_Object load_now)
 {
   int have_winsock;
 
@@ -1751,7 +1754,7 @@ DEFUN ("w32-unload-winsock", Fw32_unload_winsock, Sw32_unload_winsock,
 This is provided to allow dial-up socket connections to be disconnected
 when no longer needed.  Returns nil without unloading winsock if any
 socket connections still exist.  */)
-  ()
+  (void)
 {
   return term_winsock () ? Qt : Qnil;
 }
@@ -1762,18 +1765,11 @@ socket connections still exist.  */)
 /* Some miscellaneous functions that are Windows specific, but not GUI
    specific (ie. are applicable in terminal or batch mode as well).  */
 
-/* lifted from fileio.c  */
-#define CORRECT_DIR_SEPS(s) \
-  do { if ('/' == DIRECTORY_SEP) dostounix_filename (s); \
-       else unixtodos_filename (s); \
-  } while (0)
-
 DEFUN ("w32-short-file-name", Fw32_short_file_name, Sw32_short_file_name, 1, 1, 0,
        doc: /* Return the short file name version (8.3) of the full path of FILENAME.
 If FILENAME does not exist, return nil.
 All path elements in FILENAME are converted to their short names.  */)
-     (filename)
-     Lisp_Object filename;
+  (Lisp_Object filename)
 {
   char shortname[MAX_PATH];
 
@@ -1786,7 +1782,7 @@ All path elements in FILENAME are converted to their short names.  */)
   if (GetShortPathName (SDATA (ENCODE_FILE (filename)), shortname, MAX_PATH) == 0)
     return Qnil;
 
-  CORRECT_DIR_SEPS (shortname);
+  dostounix_filename (shortname);
 
   return build_string (shortname);
 }
@@ -1797,8 +1793,7 @@ DEFUN ("w32-long-file-name", Fw32_long_file_name, Sw32_long_file_name,
        doc: /* Return the long file name version of the full path of FILENAME.
 If FILENAME does not exist, return nil.
 All path elements in FILENAME are converted to their long names.  */)
-  (filename)
-     Lisp_Object filename;
+  (Lisp_Object filename)
 {
   char longname[ MAX_PATH ];
   int drive_only = 0;
@@ -1815,7 +1810,7 @@ All path elements in FILENAME are converted to their long names.  */)
   if (!w32_get_long_filename (SDATA (ENCODE_FILE (filename)), longname, MAX_PATH))
     return Qnil;
 
-  CORRECT_DIR_SEPS (longname);
+  dostounix_filename (longname);
 
   /* If we were passed only a drive, make sure that a slash is not appended
      for consistency with directories.  Allow for drive mapping via SUBST
@@ -1835,8 +1830,7 @@ PRIORITY should be one of the symbols high, normal, or low;
 any other symbol will be interpreted as normal.
 
 If successful, the return value is t, otherwise nil.  */)
-  (process, priority)
-     Lisp_Object process, priority;
+  (Lisp_Object process, Lisp_Object priority)
 {
   HANDLE proc_handle = GetCurrentProcess ();
   DWORD  priority_class = NORMAL_PRIORITY_CLASS;
@@ -1881,7 +1875,8 @@ If successful, the return value is t, otherwise nil.  */)
 
 #ifdef HAVE_LANGINFO_CODESET
 /* Emulation of nl_langinfo.  Used in fns.c:Flocale_info.  */
-char *nl_langinfo (nl_item item)
+char *
+nl_langinfo (nl_item item)
 {
   /* Conversion of Posix item numbers to their Windows equivalents.  */
   static const LCTYPE w32item[] = {
@@ -1957,8 +1952,7 @@ is a number, it is interpreted as an LCTYPE constant and the corresponding
 locale information is returned.
 
 If LCID (a 16-bit number) is not a valid locale, the result is nil.  */)
-     (lcid, longform)
-     Lisp_Object lcid, longform;
+  (Lisp_Object lcid, Lisp_Object longform)
 {
   int got_abbrev;
   int got_full;
@@ -2004,18 +1998,19 @@ DEFUN ("w32-get-current-locale-id", Fw32_get_current_locale_id,
        doc: /* Return Windows locale id for current locale setting.
 This is a numerical value; use `w32-get-locale-info' to convert to a
 human-readable form.  */)
-     ()
+  (void)
 {
   return make_number (GetThreadLocale ());
 }
 
-DWORD int_from_hex (char * s)
+DWORD
+int_from_hex (char * s)
 {
   DWORD val = 0;
   static char hex[] = "0123456789abcdefABCDEF";
   char * p;
 
-  while (*s && (p = strchr(hex, *s)) != NULL)
+  while (*s && (p = strchr (hex, *s)) != NULL)
     {
       unsigned digit = p - hex;
       if (digit > 15)
@@ -2030,7 +2025,8 @@ DWORD int_from_hex (char * s)
    function isn't given a context pointer.  */
 Lisp_Object Vw32_valid_locale_ids;
 
-BOOL CALLBACK enum_locale_fn (LPTSTR localeNum)
+BOOL CALLBACK
+enum_locale_fn (LPTSTR localeNum)
 {
   DWORD id = int_from_hex (localeNum);
   Vw32_valid_locale_ids = Fcons (make_number (id), Vw32_valid_locale_ids);
@@ -2042,7 +2038,7 @@ DEFUN ("w32-get-valid-locale-ids", Fw32_get_valid_locale_ids,
        doc: /* Return list of all valid Windows locale ids.
 Each id is a numerical value; use `w32-get-locale-info' to convert to a
 human-readable form.  */)
-     ()
+  (void)
 {
   Vw32_valid_locale_ids = Qnil;
 
@@ -2059,8 +2055,7 @@ By default, the system default locale setting is returned; if the optional
 parameter USERP is non-nil, the user default locale setting is returned.
 This is a numerical value; use `w32-get-locale-info' to convert to a
 human-readable form.  */)
-     (userp)
-     Lisp_Object userp;
+  (Lisp_Object userp)
 {
   if (NILP (userp))
     return make_number (GetSystemDefaultLCID ());
@@ -2071,8 +2066,7 @@ human-readable form.  */)
 DEFUN ("w32-set-current-locale", Fw32_set_current_locale, Sw32_set_current_locale, 1, 1, 0,
        doc: /* Make Windows locale LCID be the current locale setting for Emacs.
 If successful, the new locale id is returned, otherwise nil.  */)
-     (lcid)
-     Lisp_Object lcid;
+  (Lisp_Object lcid)
 {
   CHECK_NUMBER (lcid);
 
@@ -2095,7 +2089,8 @@ If successful, the new locale id is returned, otherwise nil.  */)
    function isn't given a context pointer.  */
 Lisp_Object Vw32_valid_codepages;
 
-BOOL CALLBACK enum_codepage_fn (LPTSTR codepageNum)
+BOOL CALLBACK
+enum_codepage_fn (LPTSTR codepageNum)
 {
   DWORD id = atoi (codepageNum);
   Vw32_valid_codepages = Fcons (make_number (id), Vw32_valid_codepages);
@@ -2105,7 +2100,7 @@ BOOL CALLBACK enum_codepage_fn (LPTSTR codepageNum)
 DEFUN ("w32-get-valid-codepages", Fw32_get_valid_codepages,
        Sw32_get_valid_codepages, 0, 0, 0,
        doc: /* Return list of all valid Windows codepages.  */)
-     ()
+  (void)
 {
   Vw32_valid_codepages = Qnil;
 
@@ -2119,7 +2114,7 @@ DEFUN ("w32-get-valid-codepages", Fw32_get_valid_codepages,
 DEFUN ("w32-get-console-codepage", Fw32_get_console_codepage,
        Sw32_get_console_codepage, 0, 0, 0,
        doc: /* Return current Windows codepage for console input.  */)
-     ()
+  (void)
 {
   return make_number (GetConsoleCP ());
 }
@@ -2130,8 +2125,7 @@ DEFUN ("w32-set-console-codepage", Fw32_set_console_codepage,
        doc: /* Make Windows codepage CP be the current codepage setting for Emacs.
 The codepage setting affects keyboard input and display in tty mode.
 If successful, the new CP is returned, otherwise nil.  */)
-     (cp)
-     Lisp_Object cp;
+  (Lisp_Object cp)
 {
   CHECK_NUMBER (cp);
 
@@ -2148,7 +2142,7 @@ If successful, the new CP is returned, otherwise nil.  */)
 DEFUN ("w32-get-console-output-codepage", Fw32_get_console_output_codepage,
        Sw32_get_console_output_codepage, 0, 0, 0,
        doc: /* Return current Windows codepage for console output.  */)
-     ()
+  (void)
 {
   return make_number (GetConsoleOutputCP ());
 }
@@ -2159,8 +2153,7 @@ DEFUN ("w32-set-console-output-codepage", Fw32_set_console_output_codepage,
        doc: /* Make Windows codepage CP be the current codepage setting for Emacs.
 The codepage setting affects keyboard input and display in tty mode.
 If successful, the new CP is returned, otherwise nil.  */)
-     (cp)
-     Lisp_Object cp;
+  (Lisp_Object cp)
 {
   CHECK_NUMBER (cp);
 
@@ -2178,8 +2171,7 @@ DEFUN ("w32-get-codepage-charset", Fw32_get_codepage_charset,
        Sw32_get_codepage_charset, 1, 1, 0,
        doc: /* Return charset of codepage CP.
 Returns nil if the codepage is not valid.  */)
-     (cp)
-     Lisp_Object cp;
+  (Lisp_Object cp)
 {
   CHARSETINFO info;
 
@@ -2199,7 +2191,7 @@ DEFUN ("w32-get-valid-keyboard-layouts", Fw32_get_valid_keyboard_layouts,
        Sw32_get_valid_keyboard_layouts, 0, 0, 0,
        doc: /* Return list of Windows keyboard languages and layouts.
 The return value is a list of pairs of language id and layout id.  */)
-     ()
+  (void)
 {
   int num_layouts = GetKeyboardLayoutList (0, NULL);
   HKL * layouts = (HKL *) alloca (num_layouts * sizeof (HKL));
@@ -2225,7 +2217,7 @@ DEFUN ("w32-get-keyboard-layout", Fw32_get_keyboard_layout,
        Sw32_get_keyboard_layout, 0, 0, 0,
        doc: /* Return current Windows keyboard language and layout.
 The return value is the cons of the language id and the layout id.  */)
-     ()
+  (void)
 {
   DWORD kl = (DWORD) GetKeyboardLayout (dwWindowsThreadId);
 
@@ -2239,8 +2231,7 @@ DEFUN ("w32-set-keyboard-layout", Fw32_set_keyboard_layout,
        doc: /* Make LAYOUT be the current keyboard layout for Emacs.
 The keyboard layout setting affects interpretation of keyboard input.
 If successful, the new layout id is returned, otherwise nil.  */)
-     (layout)
-     Lisp_Object layout;
+  (Lisp_Object layout)
 {
   DWORD kl;
 
@@ -2271,7 +2262,8 @@ If successful, the new layout id is returned, otherwise nil.  */)
 }
 
 \f
-syms_of_ntproc ()
+void
+syms_of_ntproc (void)
 {
   DEFSYM (Qhigh, "high");
   DEFSYM (Qlow, "low");
index f9687d1effe6beba768f7f5b22fb37688c012633..77667eb7dc9eabbfb91c1bbd9aff351b729f9d53 100644 (file)
@@ -58,9 +58,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 */
 
 static char *
-w32_get_rdb_resource (rdb, resource)
-     char *rdb;
-     char *resource;
+w32_get_rdb_resource (char *rdb, char *resource)
 {
   char *value = rdb;
   int len = strlen (resource);
@@ -78,9 +76,7 @@ w32_get_rdb_resource (rdb, resource)
 }
 
 static LPBYTE
-w32_get_string_resource (name, class, dwexptype)
-     char *name, *class;
-     DWORD dwexptype;
+w32_get_string_resource (char *name, char *class, DWORD dwexptype)
 {
   LPBYTE lpvalue = NULL;
   HKEY hrootkey = NULL;
@@ -147,9 +143,7 @@ w32_get_string_resource (name, class, dwexptype)
    database RDB. */
 
 char *
-x_get_string_resource (rdb, name, class)
-     XrmDatabase rdb;
-     char *name, *class;
+x_get_string_resource (XrmDatabase rdb, char *name, char *class)
 {
   if (rdb)
     {
index 2da4b333c2a6de0e557cc03afcfafe001cd23253..bd013a5ece93ca77703774c4b28a74fe0bc2fdd7 100644 (file)
@@ -30,7 +30,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
  * (CF_UNICODETEXT), when a well-known console codepage is given, they
  * apply to the console version of the clipboard data (CF_OEMTEXT),
  * else they apply to the normal 8-bit text clipboard (CF_TEXT).
- * 
+ *
  * When pasting (getting data from the OS), the clipboard format that
  * matches the {next-}selection-coding-system is retrieved.  If
  * Unicode is requested, but not available, 8-bit text (CF_TEXT) is
@@ -45,13 +45,13 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
  *
  * Scenarios to use the facilities for customizing the selection
  * coding system are:
- * 
+ *
  *   ;; Generally use KOI8-R instead of the russian MS codepage for
  *   ;; the 8-bit clipboard.
  *   (set-selection-coding-system 'koi8-r-dos)
- * 
+ *
  * Or
- * 
+ *
  *   ;; Create a special clipboard copy function that uses codepage
  *   ;; 1253 (Greek) to copy Greek text to a specific non-Unicode
  *   ;; application.
@@ -71,7 +71,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
  * types should be supported is also moved to Lisp, functionality
  * could be expanded to CF_HTML, CF_RTF and maybe other types.
  */
+
 #include <config.h>
 #include <setjmp.h>
 #include "lisp.h"
@@ -89,8 +89,8 @@ static HGLOBAL convert_to_handle_as_ascii (void);
 static HGLOBAL convert_to_handle_as_coded (Lisp_Object coding_system);
 static Lisp_Object render (Lisp_Object oformat);
 static Lisp_Object render_locale (void);
-static Lisp_Object render_all (void);
-static void run_protected (Lisp_Object (*code) (), Lisp_Object arg);
+static Lisp_Object render_all (Lisp_Object ignore);
+static void run_protected (Lisp_Object (*code) (Lisp_Object), Lisp_Object arg);
 static Lisp_Object lisp_error_handler (Lisp_Object error);
 static LRESULT CALLBACK owner_callback (HWND win, UINT msg,
                                        WPARAM wp, LPARAM lp);
@@ -220,11 +220,11 @@ convert_to_handle_as_coded (Lisp_Object coding_system)
   unsigned char *dst = NULL;
   struct coding_system coding;
 
-  ONTRACE (fprintf (stderr, "convert_to_handle_as_coded: %s\n",        
+  ONTRACE (fprintf (stderr, "convert_to_handle_as_coded: %s\n",
                    SDATA (SYMBOL_NAME (coding_system))));
 
   setup_windows_coding_system (coding_system, &coding);
-  coding.dst_bytes = SBYTES(current_text) * 2;
+  coding.dst_bytes = SBYTES (current_text) * 2;
   coding.destination = (unsigned char *) xmalloc (coding.dst_bytes);
   encode_coding_object (&coding, current_text, 0, 0,
                        SCHARS (current_text), SBYTES (current_text), Qnil);
@@ -290,7 +290,7 @@ render (Lisp_Object oformat)
 
   if (SetClipboardData (format, htext) == NULL)
     {
-      GlobalFree(htext);
+      GlobalFree (htext);
       return Qnil;
     }
 
@@ -314,7 +314,7 @@ render_locale (void)
 
   if ((lcid_ptr = (LCID *) GlobalLock (hlocale)) == NULL)
     {
-      GlobalFree(hlocale);
+      GlobalFree (hlocale);
       return Qnil;
     }
 
@@ -323,7 +323,7 @@ render_locale (void)
 
   if (SetClipboardData (CF_LOCALE, hlocale) == NULL)
     {
-      GlobalFree(hlocale);
+      GlobalFree (hlocale);
       return Qnil;
     }
 
@@ -334,7 +334,7 @@ render_locale (void)
    data survives us.  This code will do that.  */
 
 static Lisp_Object
-render_all (void)
+render_all (Lisp_Object ignore)
 {
   ONTRACE (fprintf (stderr, "render_all\n"));
 
@@ -380,7 +380,7 @@ render_all (void)
        automatic conversions anywhere else, so to get consistent
        results, we probably don't want to rely on it here either.  */
 
-  render_locale();
+  render_locale ();
 
   if (current_clipboard_type == CF_UNICODETEXT)
     render (make_number (CF_TEXT));
@@ -392,13 +392,12 @@ render_all (void)
 }
 
 static void
-run_protected (Lisp_Object (*code) (), Lisp_Object arg)
+run_protected (Lisp_Object (*code) (Lisp_Object), Lisp_Object arg)
 {
   /* FIXME: This works but it doesn't feel right.  Too much fiddling
      with global variables and calling strange looking functions.  Is
      this really the right way to run Lisp callbacks?  */
 
-  extern int waiting_for_input;
   int owfi;
 
   BLOCK_INPUT;
@@ -514,7 +513,7 @@ setup_config (void)
       && EQ (cfg_coding_system, dos_coding_system))
     return;
   cfg_coding_system = dos_coding_system;
-  
+
   /* Set some sensible fallbacks */
   cfg_codepage = ANSICP;
   cfg_lcid = LOCALE_NEUTRAL;
@@ -583,7 +582,7 @@ enum_locale_callback (/*const*/ char* loc_string)
       cfg_clipboard_type = CF_TEXT;
       return FALSE; /* Stop enumeration */
     }
-  
+
   /* Is the wanted codepage the OEM codepage for this locale? */
   codepage = cp_from_locale (lcid, CF_OEMTEXT);
   if (codepage == cfg_codepage)
@@ -681,8 +680,7 @@ setup_windows_coding_system (Lisp_Object coding_system,
 DEFUN ("w32-set-clipboard-data", Fw32_set_clipboard_data,
        Sw32_set_clipboard_data, 1, 2, 0,
        doc: /* This sets the clipboard data to the given text.  */)
-    (string, ignored)
-    Lisp_Object string, ignored;
+  (Lisp_Object string, Lisp_Object ignored)
 {
   BOOL ok = TRUE;
   int nbytes;
@@ -704,7 +702,7 @@ DEFUN ("w32-set-clipboard-data", Fw32_set_clipboard_data,
   current_lcid = cfg_lcid;
   current_num_nls = 0;
   current_requires_encoding = 0;
-  
+
   BLOCK_INPUT;
 
   /* Check for non-ASCII characters.  While we are at it, count the
@@ -744,7 +742,7 @@ DEFUN ("w32-set-clipboard-data", Fw32_set_clipboard_data,
   /* If we have something non-ASCII we may want to set a locale.  We
      do that directly (non-delayed), as it's just a small bit.  */
   if (ok)
-    ok = !NILP(render_locale());
+    ok = !NILP (render_locale ());
 
   if (ok)
     {
@@ -753,7 +751,7 @@ DEFUN ("w32-set-clipboard-data", Fw32_set_clipboard_data,
          /* If for some reason we don't have a clipboard_owner, we
             just set the text format as chosen by the configuration
             and than forget about the whole thing.  */
-         ok = !NILP(render (make_number (current_clipboard_type)));
+         ok = !NILP (render (make_number (current_clipboard_type)));
          current_text = Qnil;
          current_coding_system = Qnil;
        }
@@ -802,8 +800,7 @@ DEFUN ("w32-set-clipboard-data", Fw32_set_clipboard_data,
 DEFUN ("w32-get-clipboard-data", Fw32_get_clipboard_data,
        Sw32_get_clipboard_data, 0, 1, 0,
        doc: /* This gets the clipboard data in text format.  */)
-     (ignored)
-     Lisp_Object ignored;
+  (Lisp_Object ignored)
 {
   HGLOBAL htext;
   Lisp_Object ret = Qnil;
@@ -884,7 +881,7 @@ DEFUN ("w32-get-clipboard-data", Fw32_get_clipboard_data,
        struct coding_system coding;
        Lisp_Object coding_system = Qnil;
        Lisp_Object dos_coding_system;
-       
+
        /* `next-selection-coding-system' should override everything,
           even when the locale passed by the system disagrees.  The
           only exception is when `next-selection-coding-system'
@@ -1027,8 +1024,7 @@ the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'.
 \(Those are literal upper-case symbol names, since that's what X expects.)
 For convenience, the symbol nil is the same as `PRIMARY',
 and t is the same as `SECONDARY'.  */)
-  (selection)
-     Lisp_Object selection;
+  (Lisp_Object selection)
 {
   CHECK_SYMBOL (selection);
 
@@ -1065,7 +1061,7 @@ and t is the same as `SECONDARY'.  */)
    dumped version. */
 
 void
-syms_of_w32select ()
+syms_of_w32select (void)
 {
   defsubr (&Sw32_set_clipboard_data);
   defsubr (&Sw32_get_clipboard_data);
@@ -1076,7 +1072,7 @@ syms_of_w32select ()
 When sending or receiving text via cut_buffer, selection, and
 clipboard, the text is encoded or decoded by this coding system.
 The default value is the current system default encoding on 9x/Me and
-`utf-16le-dos' (Unicode) on NT/W2K/XP. */);  
+`utf-16le-dos' (Unicode) on NT/W2K/XP. */);
   /* The actual value is set dynamically in the dumped Emacs, see
      below. */
   Vselection_coding_system = Qnil;
@@ -1104,7 +1100,7 @@ set to nil.  */);
    un-dumped version. */
 
 void
-globals_of_w32select ()
+globals_of_w32select (void)
 {
   DEFAULT_LCID = GetUserDefaultLCID ();
   /* Drop the sort order from the LCID, so we can compare this with
index 801c56bf994271535e3b7a179a05a703fe61ec6a..992538e0e880c0a978ea0cb2f75e8a3d884320e0 100644 (file)
@@ -96,7 +96,7 @@ int x_underline_at_descent_line;
 
 extern unsigned int msh_mousewheel;
 
-extern void free_frame_menubar ();
+extern void free_frame_menubar (struct frame *);
 
 extern int w32_codepage_for_font (char *fontname);
 extern Cursor w32_load_cursor (LPCTSTR name);
@@ -228,53 +228,51 @@ static int input_signal_count;
 
 extern Lisp_Object Vcommand_line_args, Vsystem_name;
 
-#ifndef USE_CRT_DLL
-extern int errno;
-#endif
-
 /* A mask of extra modifier bits to put into every keyboard char.  */
 extern EMACS_INT extra_keyboard_modifiers;
 
 /* Keyboard code page - may be changed by language-change events.  */
 static int keyboard_codepage;
 
-static void x_update_window_end P_ ((struct window *, int, int));
-static void w32_handle_tool_bar_click P_ ((struct frame *,
-                                          struct input_event *));
-static void w32_define_cursor P_ ((Window, Cursor));
-
-void x_lower_frame P_ ((struct frame *));
-void x_scroll_bar_clear P_ ((struct frame *));
-void x_wm_set_size_hint P_ ((struct frame *, long, int));
-void x_raise_frame P_ ((struct frame *));
-void x_set_window_size P_ ((struct frame *, int, int, int));
-void x_wm_set_window_state P_ ((struct frame *, int));
-void x_wm_set_icon_pixmap P_ ((struct frame *, int));
-static void w32_initialize P_ ((void));
-static void x_update_end P_ ((struct frame *));
-static void w32_frame_up_to_date P_ ((struct frame *));
-static void w32_set_terminal_modes P_ ((struct terminal *));
-static void w32_reset_terminal_modes P_ ((struct terminal *));
-static void x_clear_frame P_ ((struct frame *));
-static void frame_highlight P_ ((struct frame *));
-static void frame_unhighlight P_ ((struct frame *));
-static void x_new_focus_frame P_ ((struct w32_display_info *,
-                                  struct frame *));
-static void x_focus_changed P_ ((int, int, struct w32_display_info *,
-                                 struct frame *, struct input_event *));
-static void w32_detect_focus_change P_ ((struct w32_display_info *,
-                                       W32Msg *, struct input_event *));
-static void w32_frame_rehighlight P_ ((struct frame *));
-static void x_frame_rehighlight P_ ((struct w32_display_info *));
-static void x_draw_hollow_cursor P_ ((struct window *, struct glyph_row *));
-static void x_draw_bar_cursor P_ ((struct window *, struct glyph_row *, int,
-                                  enum text_cursor_kinds));
-static void w32_clip_to_row P_ ((struct window *, struct glyph_row *, int, HDC));
-static BOOL my_show_window P_ ((struct frame *, HWND, int));
-static void my_set_window_pos P_ ((HWND, HWND, int, int, int, int, UINT));
-static void my_set_focus P_ ((struct frame *, HWND));
-static void my_set_foreground_window P_ ((HWND));
-static void my_destroy_window P_ ((struct frame *, HWND));
+static void x_update_window_end (struct window *, int, int);
+static void w32_handle_tool_bar_click (struct frame *,
+                                       struct input_event *);
+static void w32_define_cursor (Window, Cursor);
+
+void x_lower_frame (struct frame *);
+void x_scroll_bar_clear (struct frame *);
+void x_wm_set_size_hint (struct frame *, long, int);
+void x_raise_frame (struct frame *);
+void x_set_window_size (struct frame *, int, int, int);
+void x_wm_set_window_state (struct frame *, int);
+void x_wm_set_icon_pixmap (struct frame *, int);
+static void w32_initialize (void);
+static void x_update_end (struct frame *);
+static void w32_frame_up_to_date (struct frame *);
+static void w32_set_terminal_modes (struct terminal *);
+static void w32_reset_terminal_modes (struct terminal *);
+static void x_clear_frame (struct frame *);
+static void frame_highlight (struct frame *);
+static void frame_unhighlight (struct frame *);
+static void x_new_focus_frame (struct w32_display_info *,
+                               struct frame *);
+static void x_focus_changed (int, int, struct w32_display_info *,
+                             struct frame *, struct input_event *);
+static void w32_detect_focus_change (struct w32_display_info *,
+                                     W32Msg *, struct input_event *);
+static void w32_frame_rehighlight (struct frame *);
+static void x_frame_rehighlight (struct w32_display_info *);
+static void x_draw_hollow_cursor (struct window *, struct glyph_row *);
+static void x_draw_bar_cursor (struct window *, struct glyph_row *, int,
+                               enum text_cursor_kinds);
+static void w32_clip_to_row (struct window *, struct glyph_row *, int, HDC);
+static BOOL my_show_window (struct frame *, HWND, int);
+static void my_set_window_pos (HWND, HWND, int, int, int, int, UINT);
+#if 0
+static void my_set_focus (struct frame *, HWND);
+#endif
+static void my_set_foreground_window (HWND);
+static void my_destroy_window (struct frame *, HWND);
 
 static Lisp_Object Qvendor_specific_keysyms;
 
@@ -298,9 +296,7 @@ struct record event_record[100];
 
 int event_record_index;
 
-record_event (locus, type)
-     char *locus;
-     int type;
+record_event (char *locus, int type)
 {
   if (event_record_index == sizeof (event_record) / sizeof (struct record))
     event_record_index = 0;
@@ -314,7 +310,7 @@ record_event (locus, type)
 \f
 
 void
-XChangeGC (void * ignore, XGCValues* gc, unsigned long mask,
+XChangeGC (void *ignore, XGCValues *gc, unsigned long mask,
           XGCValues *xgcv)
 {
   if (mask & GCForeground)
@@ -325,11 +321,11 @@ XChangeGC (void * ignore, XGCValues* gc, unsigned long mask,
     gc->font = xgcv->font;
 }
 
-XGCValues *XCreateGC (void * ignore, Window window, unsigned long mask,
-                      XGCValues *xgcv)
+XGCValues *
+XCreateGC (void *ignore, Window window, unsigned long mask, XGCValues *xgcv)
 {
   XGCValues *gc = (XGCValues *) xmalloc (sizeof (XGCValues));
-  bzero (gc, sizeof (XGCValues));
+  memset (gc, 0, sizeof (XGCValues));
 
   XChangeGC (ignore, gc, mask, xgcv);
 
@@ -337,8 +333,8 @@ XGCValues *XCreateGC (void * ignore, Window window, unsigned long mask,
 }
 
 void
-XGetGCValues (voidignore, XGCValues *gc,
-                   unsigned long mask, XGCValues *xgcv)
+XGetGCValues (void *ignore, XGCValues *gc,
+             unsigned long mask, XGCValues *xgcv)
 {
   XChangeGC (ignore, xgcv, mask, gc);
 }
@@ -380,11 +376,7 @@ w32_draw_rectangle (HDC hdc, XGCValues *gc, int x, int y,
 
 /* Draw a filled rectangle at the specified position. */
 void
-w32_fill_rect (f, hdc, pix, lprect)
-     FRAME_PTR f;
-     HDC hdc;
-     COLORREF pix;
-     RECT * lprect;
+w32_fill_rect (FRAME_PTR f, HDC hdc, COLORREF pix, RECT *lprect)
 {
   HBRUSH hb;
 
@@ -394,8 +386,7 @@ w32_fill_rect (f, hdc, pix, lprect)
 }
 
 void
-w32_clear_window (f)
-     FRAME_PTR f;
+w32_clear_window (FRAME_PTR f)
 {
   RECT rect;
   HDC hdc = get_frame_dc (f);
@@ -415,8 +406,7 @@ w32_clear_window (f)
 #define OPAQUE_FRAME 255
 
 void
-x_set_frame_alpha (f)
-     struct frame *f;
+x_set_frame_alpha (struct frame *f)
 {
   struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f);
   double alpha = 1.0;
@@ -462,8 +452,7 @@ x_set_frame_alpha (f)
 }
 
 int
-x_display_pixel_height (dpyinfo)
-     struct w32_display_info *dpyinfo;
+x_display_pixel_height (struct w32_display_info *dpyinfo)
 {
   HDC dc = GetDC (NULL);
   int pixels = GetDeviceCaps (dc, VERTRES);
@@ -472,8 +461,7 @@ x_display_pixel_height (dpyinfo)
 }
 
 int
-x_display_pixel_width (dpyinfo)
-     struct w32_display_info *dpyinfo;
+x_display_pixel_width (struct w32_display_info *dpyinfo)
 {
   HDC dc = GetDC (NULL);
   int pixels = GetDeviceCaps (dc, HORZRES);
@@ -492,8 +480,7 @@ x_display_pixel_width (dpyinfo)
    each window being updated.  */
 
 static void
-x_update_begin (f)
-     struct frame *f;
+x_update_begin (struct frame *f)
 {
   struct w32_display_info *display_info = FRAME_W32_DISPLAY_INFO (f);
 
@@ -515,8 +502,7 @@ x_update_begin (f)
    position of W.  */
 
 static void
-x_update_window_begin (w)
-     struct window *w;
+x_update_window_begin (struct window *w)
 {
   struct frame *f = XFRAME (WINDOW_FRAME (w));
   struct w32_display_info *display_info = FRAME_W32_DISPLAY_INFO (f);
@@ -575,9 +561,7 @@ x_update_window_begin (w)
 /* Draw a vertical window border from (x,y0) to (x,y1)  */
 
 static void
-w32_draw_vertical_window_border (w, x, y0, y1)
-     struct window *w;
-     int x, y0, y1;
+w32_draw_vertical_window_border (struct window *w, int x, int y0, int y1)
 {
   struct frame *f = XFRAME (WINDOW_FRAME (w));
   RECT r;
@@ -614,9 +598,8 @@ w32_draw_vertical_window_border (w, x, y0, y1)
    here. */
 
 static void
-x_update_window_end (w, cursor_on_p, mouse_face_overwritten_p)
-     struct window *w;
-     int cursor_on_p, mouse_face_overwritten_p;
+x_update_window_end (struct window *w, int cursor_on_p,
+                    int mouse_face_overwritten_p)
 {
   struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (XFRAME (w->frame));
 
@@ -660,8 +643,7 @@ x_update_window_end (w, cursor_on_p, mouse_face_overwritten_p)
    update_end.  */
 
 static void
-x_update_end (f)
-     struct frame *f;
+x_update_end (struct frame *f)
 {
   if (! FRAME_W32_P (f))
     return;
@@ -676,8 +658,7 @@ x_update_end (f)
    updated_window is not available here.  */
 
 static void
-w32_frame_up_to_date (f)
-     struct frame *f;
+w32_frame_up_to_date (struct frame *f)
 {
   if (FRAME_W32_P (f))
     {
@@ -706,8 +687,7 @@ w32_frame_up_to_date (f)
    between bitmaps to be drawn between current row and DESIRED_ROW.  */
 
 static void
-x_after_update_window_line (desired_row)
-     struct glyph_row *desired_row;
+x_after_update_window_line (struct glyph_row *desired_row)
 {
   struct window *w = updated_window;
   struct frame *f;
@@ -753,10 +733,8 @@ x_after_update_window_line (desired_row)
    drawn.  */
 
 static void
-w32_draw_fringe_bitmap (w, row, p)
-     struct window *w;
-     struct glyph_row *row;
-     struct draw_fringe_bitmap_params *p;
+w32_draw_fringe_bitmap (struct window *w, struct glyph_row *row,
+                       struct draw_fringe_bitmap_params *p)
 {
   struct frame *f = XFRAME (WINDOW_FRAME (w));
   HDC hdc;
@@ -879,10 +857,7 @@ w32_draw_fringe_bitmap (w, row, p)
 }
 
 static void
-w32_define_fringe_bitmap (which, bits, h, wd)
-     int which;
-     unsigned short *bits;
-     int h, wd;
+w32_define_fringe_bitmap (int which, unsigned short *bits, int h, int wd)
 {
   if (which >= max_fringe_bmp)
     {
@@ -897,8 +872,7 @@ w32_define_fringe_bitmap (which, bits, h, wd)
 }
 
 static void
-w32_destroy_fringe_bitmap (which)
-     int which;
+w32_destroy_fringe_bitmap (int which)
 {
   if (which >= max_fringe_bmp)
     return;
@@ -936,40 +910,39 @@ w32_reset_terminal_modes (struct terminal *term)
 
 /* Function prototypes of this page.  */
 
-static void x_set_glyph_string_clipping P_ ((struct glyph_string *));
-static void x_set_glyph_string_gc P_ ((struct glyph_string *));
-static void x_draw_glyph_string_background P_ ((struct glyph_string *,
-                                               int));
-static void x_draw_glyph_string_foreground P_ ((struct glyph_string *));
-static void x_draw_composite_glyph_string_foreground P_ ((struct glyph_string *));
-static void x_draw_glyph_string_box P_ ((struct glyph_string *));
-static void x_draw_glyph_string  P_ ((struct glyph_string *));
-static void x_set_cursor_gc P_ ((struct glyph_string *));
-static void x_set_mode_line_face_gc P_ ((struct glyph_string *));
-static void x_set_mouse_face_gc P_ ((struct glyph_string *));
+static void x_set_glyph_string_clipping (struct glyph_string *);
+static void x_set_glyph_string_gc (struct glyph_string *);
+static void x_draw_glyph_string_background (struct glyph_string *,
+                                            int);
+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_set_cursor_gc (struct glyph_string *);
+static void x_set_mode_line_face_gc (struct glyph_string *);
+static void x_set_mouse_face_gc (struct glyph_string *);
 static int w32_alloc_lighter_color (struct frame *, COLORREF *, double, int);
-static void w32_setup_relief_color P_ ((struct frame *, struct relief *,
-                                        double, int, COLORREF));
-static void x_setup_relief_colors P_ ((struct glyph_string *));
-static void x_draw_image_glyph_string P_ ((struct glyph_string *));
-static void x_draw_image_relief P_ ((struct glyph_string *));
-static void x_draw_image_foreground P_ ((struct glyph_string *));
-static void w32_draw_image_foreground_1 P_ ((struct glyph_string *, HBITMAP));
-static void x_clear_glyph_string_rect P_ ((struct glyph_string *, int,
-                                          int, int, int));
-static void w32_draw_relief_rect P_ ((struct frame *, int, int, int, int,
-                                     int, int, int, int, int, int,
-                                     RECT *));
-static void w32_draw_box_rect P_ ((struct glyph_string *, int, int, int, int,
-                                int, int, int, RECT *));
+static void w32_setup_relief_color (struct frame *, struct relief *,
+                                    double, int, COLORREF);
+static void x_setup_relief_colors (struct glyph_string *);
+static void x_draw_image_glyph_string (struct glyph_string *);
+static void x_draw_image_relief (struct glyph_string *);
+static void x_draw_image_foreground (struct glyph_string *);
+static void w32_draw_image_foreground_1 (struct glyph_string *, HBITMAP);
+static void x_clear_glyph_string_rect (struct glyph_string *, int,
+                                       int, int, int);
+static void w32_draw_relief_rect (struct frame *, int, int, int, int,
+                                  int, int, int, int, int, int,
+                                  RECT *);
+static void w32_draw_box_rect (struct glyph_string *, int, int, int, int,
+                               int, int, int, RECT *);
 
 
 /* Set S->gc to a suitable GC for drawing glyph string S in cursor
    face.  */
 
 static void
-x_set_cursor_gc (s)
-     struct glyph_string *s;
+x_set_cursor_gc (struct glyph_string *s)
 {
   if (s->font == FRAME_FONT (s->f)
       && s->face->background == FRAME_BACKGROUND_PIXEL (s->f)
@@ -1020,8 +993,7 @@ x_set_cursor_gc (s)
 /* Set up S->gc of glyph string S for drawing text in mouse face.  */
 
 static void
-x_set_mouse_face_gc (s)
-     struct glyph_string *s;
+x_set_mouse_face_gc (struct glyph_string *s)
 {
   int face_id;
   struct face *face;
@@ -1074,8 +1046,7 @@ x_set_mouse_face_gc (s)
    matrix was built, so there isn't much to do, here.  */
 
 static INLINE void
-x_set_mode_line_face_gc (s)
-     struct glyph_string *s;
+x_set_mode_line_face_gc (struct glyph_string *s)
 {
   s->gc = s->face->gc;
 }
@@ -1086,8 +1057,7 @@ x_set_mode_line_face_gc (s)
    pattern.  */
 
 static INLINE void
-x_set_glyph_string_gc (s)
-     struct glyph_string *s;
+x_set_glyph_string_gc (struct glyph_string *s)
 {
   PREPARE_FACE_FOR_DISPLAY (s->f, s->face);
 
@@ -1132,8 +1102,7 @@ x_set_glyph_string_gc (s)
    line or menu if we don't have X toolkit support.  */
 
 static INLINE void
-x_set_glyph_string_clipping (s)
-     struct glyph_string *s;
+x_set_glyph_string_clipping (struct glyph_string *s)
 {
   RECT *r = s->clip;
   int n = get_glyph_string_clip_rects (s, r, 2);
@@ -1161,8 +1130,8 @@ x_set_glyph_string_clipping (s)
    the area of SRC.  */
 
 static void
-x_set_glyph_string_clipping_exactly (src, dst)
-     struct glyph_string *src, *dst;
+x_set_glyph_string_clipping_exactly (struct glyph_string *src,
+                                    struct glyph_string *dst)
 {
   RECT r;
 
@@ -1179,8 +1148,7 @@ x_set_glyph_string_clipping_exactly (src, dst)
    Compute left and right overhang of glyph string S.  */
 
 static void
-w32_compute_glyph_string_overhangs (s)
-     struct glyph_string *s;
+w32_compute_glyph_string_overhangs (struct glyph_string *s)
 {
   if (s->cmp == NULL
       && s->first_glyph->type == CHAR_GLYPH
@@ -1208,9 +1176,8 @@ w32_compute_glyph_string_overhangs (s)
 /* Fill rectangle X, Y, W, H with background color of glyph string S.  */
 
 static INLINE void
-x_clear_glyph_string_rect (s, x, y, w, h)
-     struct glyph_string *s;
-     int x, y, w, h;
+x_clear_glyph_string_rect (struct glyph_string *s,
+                          int x, int y, int w, int h)
 {
   int real_x = x;
   int real_y = y;
@@ -1240,9 +1207,7 @@ x_clear_glyph_string_rect (s, x, y, w, h)
    contains the first component of a composition.  */
 
 static void
-x_draw_glyph_string_background (s, force_p)
-     struct glyph_string *s;
-     int force_p;
+x_draw_glyph_string_background (struct glyph_string *s, int force_p)
 {
   /* Nothing to do if background has already been drawn or if it
      shouldn't be drawn in the first place.  */
@@ -1281,8 +1246,7 @@ x_draw_glyph_string_background (s, force_p)
 /* Draw the foreground of glyph string S.  */
 
 static void
-x_draw_glyph_string_foreground (s)
-     struct glyph_string *s;
+x_draw_glyph_string_foreground (struct glyph_string *s)
 {
   int i, x;
 
@@ -1339,8 +1303,7 @@ x_draw_glyph_string_foreground (s)
 /* Draw the foreground of composite glyph string S.  */
 
 static void
-x_draw_composite_glyph_string_foreground (s)
-     struct glyph_string *s;
+x_draw_composite_glyph_string_foreground (struct glyph_string *s)
 {
   int i, j, x;
   struct font *font = s->font;
@@ -1453,11 +1416,8 @@ x_draw_composite_glyph_string_foreground (s)
    Value is non-zero if successful.  */
 
 static int
-w32_alloc_lighter_color (f, color, factor, delta)
-     struct frame *f;
-     COLORREF *color;
-     double factor;
-     int delta;
+w32_alloc_lighter_color (struct frame *f, COLORREF *color,
+                        double factor, int delta)
 {
   COLORREF new;
   long bright;
@@ -1516,10 +1476,7 @@ w32_alloc_lighter_color (f, color, factor, delta)
    colors in COLORS.  On W32, we no longer try to map colors to
    a palette.  */
 void
-x_query_colors (f, colors, ncolors)
-     struct frame *f;
-     XColor *colors;
-     int ncolors;
+x_query_colors (struct frame *f, XColor *colors, int ncolors)
 {
   int i;
 
@@ -1534,9 +1491,7 @@ x_query_colors (f, colors, ncolors)
 }
 
 void
-x_query_color (f, color)
-     struct frame *f;
-     XColor *color;
+x_query_color (struct frame *f, XColor *color)
 {
   x_query_colors (f, color, 1);
 }
@@ -1550,12 +1505,8 @@ x_query_color (f, color)
    be allocated, use DEFAULT_PIXEL, instead.  */
 
 static void
-w32_setup_relief_color (f, relief, factor, delta, default_pixel)
-     struct frame *f;
-     struct relief *relief;
-     double factor;
-     int delta;
-     COLORREF default_pixel;
+w32_setup_relief_color (struct frame *f, struct relief *relief, double factor,
+                       int delta, COLORREF default_pixel)
 {
   XGCValues xgcv;
   struct w32_output *di = f->output_data.w32;
@@ -1591,8 +1542,7 @@ w32_setup_relief_color (f, relief, factor, delta, default_pixel)
 /* Set up colors for the relief lines around glyph string S.  */
 
 static void
-x_setup_relief_colors (s)
-     struct glyph_string *s;
+x_setup_relief_colors (struct glyph_string *s)
 {
   struct w32_output *di = s->f->output_data.w32;
   COLORREF color;
@@ -1627,12 +1577,10 @@ x_setup_relief_colors (s)
    when drawing.  */
 
 static void
-w32_draw_relief_rect (f, left_x, top_y, right_x, bottom_y, width,
-                      raised_p, top_p, bot_p, left_p, right_p, clip_rect)
-     struct frame *f;
-     int left_x, top_y, right_x, bottom_y, width;
-     int top_p, bot_p, left_p, right_p, raised_p;
-     RECT *clip_rect;
+w32_draw_relief_rect (struct frame *f,
+                     int left_x, int top_y, int right_x, int bottom_y, int width,
+                     int raised_p, int top_p, int bot_p, int left_p, int right_p,
+                     RECT *clip_rect)
 {
   int i;
   XGCValues gc;
@@ -1692,11 +1640,9 @@ w32_draw_relief_rect (f, left_x, top_y, right_x, bottom_y, width,
    rectangle to use when drawing.  */
 
 static void
-w32_draw_box_rect (s, left_x, top_y, right_x, bottom_y, width,
-                   left_p, right_p, clip_rect)
-     struct glyph_string *s;
-     int left_x, top_y, right_x, bottom_y, width, left_p, right_p;
-     RECT *clip_rect;
+w32_draw_box_rect (struct glyph_string *s,
+                  int left_x, int top_y, int right_x, int bottom_y, int width,
+                   int left_p, int right_p, RECT *clip_rect)
 {
   w32_set_clip_rectangle (s->hdc, clip_rect);
 
@@ -1729,8 +1675,7 @@ w32_draw_box_rect (s, left_x, top_y, right_x, bottom_y, width,
 /* Draw a box around glyph string S.  */
 
 static void
-x_draw_glyph_string_box (s)
-     struct glyph_string *s;
+x_draw_glyph_string_box (struct glyph_string *s)
 {
   int width, left_x, right_x, top_y, bottom_y, last_x, raised_p;
   int left_p, right_p;
@@ -1781,8 +1726,7 @@ x_draw_glyph_string_box (s)
 /* Draw foreground of image glyph string S.  */
 
 static void
-x_draw_image_foreground (s)
-     struct glyph_string *s;
+x_draw_image_foreground (struct glyph_string *s)
 {
   int x = s->x;
   int y = s->ybase - image_ascent (s->img, s->face, &s->slice);
@@ -1872,8 +1816,7 @@ x_draw_image_foreground (s)
 /* Draw a relief around the image glyph string S.  */
 
 static void
-x_draw_image_relief (s)
-     struct glyph_string *s;
+x_draw_image_relief (struct glyph_string *s)
 {
   int x0, y0, x1, y1, thick, raised_p;
   RECT r;
@@ -1925,9 +1868,7 @@ x_draw_image_relief (s)
 /* Draw the foreground of image glyph string S to PIXMAP.  */
 
 static void
-w32_draw_image_foreground_1 (s, pixmap)
-     struct glyph_string *s;
-     HBITMAP pixmap;
+w32_draw_image_foreground_1 (struct glyph_string *s, HBITMAP pixmap)
 {
   HDC hdc = CreateCompatibleDC (s->hdc);
   HGDIOBJ orig_hdc_obj = SelectObject (hdc, pixmap);
@@ -2014,9 +1955,7 @@ w32_draw_image_foreground_1 (s, pixmap)
    give the rectangle to draw.  */
 
 static void
-x_draw_glyph_string_bg_rect (s, x, y, w, h)
-     struct glyph_string *s;
-     int x, y, w, h;
+x_draw_glyph_string_bg_rect (struct glyph_string *s, int x, int y, int w, int h)
 {
 #if 0 /* TODO: stipple */
   if (s->stippled_p)
@@ -2047,8 +1986,7 @@ x_draw_glyph_string_bg_rect (s, x, y, w, h)
  */
 
 static void
-x_draw_image_glyph_string (s)
-     struct glyph_string *s;
+x_draw_image_glyph_string (struct glyph_string *s)
 {
   int x, y;
   int box_line_hwidth = eabs (s->face->box_line_width);
@@ -2161,25 +2099,41 @@ x_draw_image_glyph_string (s)
 /* Draw stretch glyph string S.  */
 
 static void
-x_draw_stretch_glyph_string (s)
-     struct glyph_string *s;
+x_draw_stretch_glyph_string (struct glyph_string *s)
 {
   xassert (s->first_glyph->type == STRETCH_GLYPH);
 
   if (s->hl == DRAW_CURSOR
       && !x_stretch_cursor_p)
     {
-      /* If `x-stretch-block-cursor' is nil, don't draw a block cursor
-        as wide as the stretch glyph.  */
+      /* If `x-stretch-cursor' is nil, don't draw a block cursor as
+        wide as the stretch glyph.  */
       int width, background_width = s->background_width;
-      int x = s->x, left_x = window_box_left_offset (s->w, TEXT_AREA);
+      int x = s->x;
 
-      if (x < left_x)
+      if (!s->row->reversed_p)
        {
-         background_width -= left_x - x;
-         x = left_x;
+         int left_x = window_box_left_offset (s->w, TEXT_AREA);
+
+         if (x < left_x)
+           {
+             background_width -= left_x - x;
+             x = left_x;
+           }
+       }
+      else
+       {
+         /* In R2L rows, draw the cursor on the right edge of the
+            stretch glyph.  */
+         int right_x = window_box_right_offset (s->w, TEXT_AREA);
+
+         if (x + background_width > right_x)
+           background_width -= x - right_x;
+         x += background_width;
        }
       width = min (FRAME_COLUMN_WIDTH (s->f), background_width);
+      if (s->row->reversed_p)
+       x -= width;
 
       /* Draw cursor.  */
       x_draw_glyph_string_bg_rect (s, x, s->y, width, s->height);
@@ -2193,7 +2147,10 @@ x_draw_stretch_glyph_string (s)
          RECT r;
           HDC hdc = s->hdc;
 
-         x += width;
+         if (!s->row->reversed_p)
+           x += width;
+         else
+           x = s->x;
          if (s->row->mouse_face_p
              && cursor_in_mouse_face_p (s->w))
            {
@@ -2244,8 +2201,7 @@ x_draw_stretch_glyph_string (s)
 /* Draw glyph string S.  */
 
 static void
-x_draw_glyph_string (s)
-     struct glyph_string *s;
+x_draw_glyph_string (struct glyph_string *s)
 {
   int relief_drawn_p = 0;
 
@@ -2410,7 +2366,7 @@ x_draw_glyph_string (s)
 
       /* Draw strike-through.  */
       if (s->face->strike_through_p
-          && !FONT_TEXTMETRIC(s->font).tmStruckOut)
+          && !FONT_TEXTMETRIC (s->font).tmStruckOut)
         {
           unsigned long h = 1;
           unsigned long dy = (s->height - h) / 2;
@@ -2491,9 +2447,8 @@ x_draw_glyph_string (s)
 /* Shift display to make room for inserted glyphs.   */
 
 void
-w32_shift_glyphs_for_insert (f, x, y, width, height, shift_by)
-     struct frame *f;
-     int x, y, width, height, shift_by;
+w32_shift_glyphs_for_insert (struct frame *f, int x, int y,
+                            int width, int height, int shift_by)
 {
   HDC hdc;
 
@@ -2509,9 +2464,7 @@ w32_shift_glyphs_for_insert (f, x, y, width, height, shift_by)
    for X frames.  */
 
 static void
-x_delete_glyphs (f, n)
-     struct frame *f;
-     register int n;
+x_delete_glyphs (struct frame *f, register int n)
 {
   if (! FRAME_W32_P (f))
     return;
@@ -2581,8 +2534,7 @@ w32_ring_bell (struct frame *f)
    that is bounded by calls to x_update_begin and x_update_end.  */
 
 static void
-w32_set_terminal_window (n)
-     register int n;
+w32_set_terminal_window (struct frame *f, int n)
 {
   /* This function intentionally left blank.  */
 }
@@ -2596,9 +2548,7 @@ w32_set_terminal_window (n)
    lines or deleting -N lines at vertical position VPOS.  */
 
 static void
-x_ins_del_lines (f, vpos, n)
-     struct frame *f;
-     int vpos, n;
+x_ins_del_lines (struct frame *f, int vpos, int n)
 {
   if (! FRAME_W32_P (f))
     return;
@@ -2610,9 +2560,7 @@ x_ins_del_lines (f, vpos, n)
 /* Scroll part of the display as described by RUN.  */
 
 static void
-x_scroll_run (w, run)
-     struct window *w;
-     struct run *run;
+x_scroll_run (struct window *w, struct run *run)
 {
   struct frame *f = XFRAME (w->frame);
   int x, y, width, height, from_y, to_y, bottom_y;
@@ -2694,16 +2642,14 @@ x_scroll_run (w, run)
  ***********************************************************************/
 
 static void
-frame_highlight (f)
-     struct frame *f;
+frame_highlight (struct frame *f)
 {
   x_update_cursor (f, 1);
   x_set_frame_alpha (f);
 }
 
 static void
-frame_unhighlight (f)
-     struct frame *f;
+frame_unhighlight (struct frame *f)
 {
   x_update_cursor (f, 1);
   x_set_frame_alpha (f);
@@ -2716,9 +2662,7 @@ frame_unhighlight (f)
    Lisp code can tell when the switch took place by examining the events.  */
 
 static void
-x_new_focus_frame (dpyinfo, frame)
-     struct w32_display_info *dpyinfo;
-     struct frame *frame;
+x_new_focus_frame (struct w32_display_info *dpyinfo, struct frame *frame)
 {
   struct frame *old_focus = dpyinfo->w32_focus_frame;
 
@@ -2746,12 +2690,8 @@ x_new_focus_frame (dpyinfo, frame)
    a FOCUS_IN_EVENT into *BUFP.  */
 
 static void
-x_focus_changed (type, state, dpyinfo, frame, bufp)
-     int type;
-     int state;
-     struct w32_display_info *dpyinfo;
-     struct frame *frame;
-     struct input_event *bufp;
+x_focus_changed (int type, int state, struct w32_display_info *dpyinfo,
+                struct frame *frame, struct input_event *bufp)
 {
   if (type == WM_SETFOCUS)
     {
@@ -2796,10 +2736,8 @@ x_focus_changed (type, state, dpyinfo, frame, bufp)
    Returns FOCUS_IN_EVENT event in *BUFP. */
 
 static void
-w32_detect_focus_change (dpyinfo, event, bufp)
-     struct w32_display_info *dpyinfo;
-     W32Msg *event;
-     struct input_event *bufp;
+w32_detect_focus_change (struct w32_display_info *dpyinfo, W32Msg *event,
+                        struct input_event *bufp)
 {
   struct frame *frame;
 
@@ -2818,8 +2756,7 @@ w32_detect_focus_change (dpyinfo, event, bufp)
 /* Handle an event saying the mouse has moved out of an Emacs frame.  */
 
 void
-x_mouse_leave (dpyinfo)
-     struct w32_display_info *dpyinfo;
+x_mouse_leave (struct w32_display_info *dpyinfo)
 {
   x_new_focus_frame (dpyinfo, dpyinfo->w32_focus_event_frame);
 }
@@ -2833,8 +2770,7 @@ x_mouse_leave (dpyinfo)
    the appropriate X display info.  */
 
 static void
-w32_frame_rehighlight (frame)
-     struct frame *frame;
+w32_frame_rehighlight (struct frame *frame)
 {
   if (! FRAME_W32_P (frame))
     return;
@@ -2842,8 +2778,7 @@ w32_frame_rehighlight (frame)
 }
 
 static void
-x_frame_rehighlight (dpyinfo)
-     struct w32_display_info *dpyinfo;
+x_frame_rehighlight (struct w32_display_info *dpyinfo)
 {
   struct frame *old_highlight = dpyinfo->x_highlight_frame;
 
@@ -2876,8 +2811,7 @@ x_frame_rehighlight (dpyinfo)
 /* Convert a keysym to its name.  */
 
 char *
-x_get_keysym_name (keysym)
-    int keysym;
+x_get_keysym_name (int keysym)
 {
   /* Make static so we can always return it */
   static char value[100];
@@ -2889,7 +2823,8 @@ x_get_keysym_name (keysym)
   return value;
 }
 
-static int codepage_for_locale(LCID locale)
+static int
+codepage_for_locale (LCID locale)
 {
   char cp[20];
 
@@ -2906,11 +2841,7 @@ static int codepage_for_locale(LCID locale)
    the state in PUP. XBUTTON provides extra information for extended mouse
    button messages. Returns FALSE if unable to parse the message.  */
 BOOL
-parse_button (message, xbutton, pbutton, pup)
-     int message;
-     int xbutton;
-     int * pbutton;
-     int * pup;
+parse_button (int message, int xbutton, int * pbutton, int * pup)
 {
   int button = 0;
   int up = 0;
@@ -2978,10 +2909,7 @@ parse_button (message, xbutton, pbutton, pup)
    the mouse.  */
 
 static Lisp_Object
-construct_mouse_click (result, msg, f)
-     struct input_event *result;
-     W32Msg *msg;
-     struct frame *f;
+construct_mouse_click (struct input_event *result, W32Msg *msg, struct frame *f)
 {
   int button;
   int up;
@@ -3007,10 +2935,7 @@ construct_mouse_click (result, msg, f)
 }
 
 static Lisp_Object
-construct_mouse_wheel (result, msg, f)
-     struct input_event *result;
-     W32Msg *msg;
-     struct frame *f;
+construct_mouse_wheel (struct input_event *result, W32Msg *msg, struct frame *f)
 {
   POINT p;
   int delta;
@@ -3043,10 +2968,7 @@ construct_mouse_wheel (result, msg, f)
 }
 
 static Lisp_Object
-construct_drag_n_drop (result, msg, f)
-     struct input_event *result;
-     W32Msg *msg;
-     struct frame *f;
+construct_drag_n_drop (struct input_event *result, W32Msg *msg, struct frame *f)
 {
   Lisp_Object files;
   Lisp_Object frame;
@@ -3107,9 +3029,7 @@ static MSG last_mouse_motion_event;
 static Lisp_Object last_mouse_motion_frame;
 
 static int
-note_mouse_movement (frame, msg)
-     FRAME_PTR frame;
-     MSG *msg;
+note_mouse_movement (FRAME_PTR frame, MSG *msg)
 {
   int mouse_x = LOWORD (msg->lParam);
   int mouse_y = HIWORD (msg->lParam);
@@ -3157,12 +3077,15 @@ note_mouse_movement (frame, msg)
                              Mouse Face
  ************************************************************************/
 
-static struct scroll_bar *x_window_to_scroll_bar ();
-static void x_scroll_bar_report_motion ();
-static void x_check_fullscreen P_ ((struct frame *));
+static struct scroll_bar *x_window_to_scroll_bar (Window);
+static void x_scroll_bar_report_motion (FRAME_PTR *, Lisp_Object *,
+                                       enum scroll_bar_part *,
+                                       Lisp_Object *, Lisp_Object *,
+                                       unsigned long *);
+static void x_check_fullscreen (struct frame *);
 
 static void
-redo_mouse_highlight ()
+redo_mouse_highlight (void)
 {
   if (!NILP (last_mouse_motion_frame)
       && FRAME_LIVE_P (XFRAME (last_mouse_motion_frame)))
@@ -3172,9 +3095,7 @@ redo_mouse_highlight ()
 }
 
 static void
-w32_define_cursor (window, cursor)
-     Window window;
-     Cursor cursor;
+w32_define_cursor (Window window, Cursor cursor)
 {
   PostMessage (window, WM_EMACS_SETCURSOR, (WPARAM) cursor, 0);
 }
@@ -3199,13 +3120,9 @@ w32_define_cursor (window, cursor)
    movement.  */
 
 static void
-w32_mouse_position (fp, insist, bar_window, part, x, y, time)
-     FRAME_PTR *fp;
-     int insist;
-     Lisp_Object *bar_window;
-     enum scroll_bar_part *part;
-     Lisp_Object *x, *y;
-     unsigned long *time;
+w32_mouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window,
+                   enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y,
+                   unsigned long *time)
 {
   FRAME_PTR f1;
 
@@ -3296,9 +3213,7 @@ w32_mouse_position (fp, insist, bar_window, part, x, y, time)
    or ButtonRelase.  */
 
 static void
-w32_handle_tool_bar_click (f, button_event)
-     struct frame *f;
-     struct input_event *button_event;
+w32_handle_tool_bar_click (struct frame *f, struct input_event *button_event)
 {
   int x = XFASTINT (button_event->x);
   int y = XFASTINT (button_event->y);
@@ -3323,8 +3238,7 @@ w32_handle_tool_bar_click (f, button_event)
    bits.  */
 
 static struct scroll_bar *
-x_window_to_scroll_bar (window_id)
-     Window window_id;
+x_window_to_scroll_bar (Window window_id)
 {
   Lisp_Object tail;
 
@@ -3360,9 +3274,8 @@ x_window_to_scroll_bar (window_id)
    displaying PORTION out of a whole WHOLE, and our position POSITION.  */
 
 static void
-w32_set_scroll_bar_thumb (bar, portion, position, whole)
-     struct scroll_bar *bar;
-     int portion, position, whole;
+w32_set_scroll_bar_thumb (struct scroll_bar *bar,
+                         int portion, int position, int whole)
 {
   Window w = SCROLL_BAR_W32_WINDOW (bar);
   /* We use the whole scroll-bar height in the calculations below, to
@@ -3388,7 +3301,7 @@ w32_set_scroll_bar_thumb (bar, portion, position, whole)
       BLOCK_INPUT;
       si.cbSize = sizeof (si);
       si.fMask = SIF_POS | SIF_PAGE;
-      GetScrollInfo(w, SB_CTL, &si);
+      GetScrollInfo (w, SB_CTL, &si);
       near_bottom_p = si.nPos + si.nPage >= range;
       UNBLOCK_INPUT;
       if (!near_bottom_p)
@@ -3437,9 +3350,7 @@ w32_set_scroll_bar_thumb (bar, portion, position, whole)
  ************************************************************************/
 
 static HWND
-my_create_scrollbar (f, bar)
-     struct frame * f;
-     struct scroll_bar * bar;
+my_create_scrollbar (struct frame * f, struct scroll_bar * bar)
 {
   return (HWND) SendMessage (FRAME_W32_WINDOW (f),
                             WM_EMACS_CREATESCROLLBAR, (WPARAM) f,
@@ -3477,27 +3388,24 @@ my_set_window_pos (HWND hwnd, HWND hwndAfter,
 #endif
 }
 
+#if 0
 static void
-my_set_focus (f, hwnd)
-     struct frame * f;
-     HWND hwnd;
+my_set_focus (struct frame * f, HWND hwnd)
 {
   SendMessage (FRAME_W32_WINDOW (f), WM_EMACS_SETFOCUS,
               (WPARAM) hwnd, 0);
 }
+#endif
 
 static void
-my_set_foreground_window (hwnd)
-     HWND hwnd;
+my_set_foreground_window (HWND hwnd)
 {
   SendMessage (hwnd, WM_EMACS_SETFOREGROUND, (WPARAM) hwnd, 0);
 }
 
 
 static void
-my_destroy_window (f, hwnd)
-     struct frame * f;
-     HWND hwnd;
+my_destroy_window (struct frame * f, HWND hwnd)
 {
   SendMessage (FRAME_W32_WINDOW (f), WM_EMACS_DESTROYWINDOW,
               (WPARAM) hwnd, 0);
@@ -3509,9 +3417,7 @@ my_destroy_window (f, hwnd)
    scroll bar. */
 
 static struct scroll_bar *
-x_scroll_bar_create (w, top, left, width, height)
-     struct window *w;
-     int top, left, width, height;
+x_scroll_bar_create (struct window *w, int top, int left, int width, int height)
 {
   struct frame *f = XFRAME (WINDOW_FRAME (w));
   HWND hwnd;
@@ -3564,8 +3470,7 @@ x_scroll_bar_create (w, top, left, width, height)
    nil. */
 
 static void
-x_scroll_bar_remove (bar)
-     struct scroll_bar *bar;
+x_scroll_bar_remove (struct scroll_bar *bar)
 {
   FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window)));
 
@@ -3585,9 +3490,8 @@ x_scroll_bar_remove (bar)
    characters, starting at POSITION.  If WINDOW has no scroll bar,
    create one.  */
 static void
-w32_set_vertical_scroll_bar (w, portion, whole, position)
-     struct window *w;
-     int portion, whole, position;
+w32_set_vertical_scroll_bar (struct window *w,
+                            int portion, int whole, int position)
 {
   struct frame *f = XFRAME (w->frame);
   struct scroll_bar *bar;
@@ -3730,8 +3634,7 @@ w32_set_vertical_scroll_bar (w, portion, whole, position)
    `*redeem_scroll_bar_hook' is applied to its window before the judgment.  */
 
 static void
-w32_condemn_scroll_bars (frame)
-     FRAME_PTR frame;
+w32_condemn_scroll_bars (FRAME_PTR frame)
 {
   /* Transfer all the scroll bars to FRAME_CONDEMNED_SCROLL_BARS.  */
   while (! NILP (FRAME_SCROLL_BARS (frame)))
@@ -3752,8 +3655,7 @@ w32_condemn_scroll_bars (frame)
    Note that WINDOW isn't necessarily condemned at all.  */
 
 static void
-w32_redeem_scroll_bar (window)
-     struct window *window;
+w32_redeem_scroll_bar (struct window *window)
 {
   struct scroll_bar *bar;
   struct frame *f;
@@ -3798,8 +3700,7 @@ w32_redeem_scroll_bar (window)
    last call to `*condemn_scroll_bars_hook'.  */
 
 static void
-w32_judge_scroll_bars (f)
-     FRAME_PTR f;
+w32_judge_scroll_bars (FRAME_PTR f)
 {
   Lisp_Object bar, next;
 
@@ -3830,10 +3731,8 @@ w32_judge_scroll_bars (f)
    mark bits.  */
 
 static int
-w32_scroll_bar_handle_click (bar, msg, emacs_event)
-     struct scroll_bar *bar;
-     W32Msg *msg;
-     struct input_event *emacs_event;
+w32_scroll_bar_handle_click (struct scroll_bar *bar, W32Msg *msg,
+                            struct input_event *emacs_event)
 {
   if (! WINDOWP (bar->window))
     abort ();
@@ -3939,12 +3838,10 @@ w32_scroll_bar_handle_click (bar, msg, emacs_event)
    on the scroll bar.  */
 
 static void
-x_scroll_bar_report_motion (fp, bar_window, part, x, y, time)
-     FRAME_PTR *fp;
-     Lisp_Object *bar_window;
-     enum scroll_bar_part *part;
-     Lisp_Object *x, *y;
-     unsigned long *time;
+x_scroll_bar_report_motion (FRAME_PTR *fp, Lisp_Object *bar_window,
+                           enum scroll_bar_part *part,
+                           Lisp_Object *x, Lisp_Object *y,
+                           unsigned long *time)
 {
   struct scroll_bar *bar = XSCROLL_BAR (last_mouse_scroll_bar);
   Window w = SCROLL_BAR_W32_WINDOW (bar);
@@ -4000,8 +3897,7 @@ x_scroll_bar_report_motion (fp, bar_window, part, x, y, time)
    redraw them.  */
 
 void
-x_scroll_bar_clear (f)
-     FRAME_PTR f;
+x_scroll_bar_clear (FRAME_PTR f)
 {
   Lisp_Object bar;
 
@@ -4060,10 +3956,8 @@ static char dbcs_lead = 0;
 */
 
 int
-w32_read_socket (sd, expected, hold_quit)
-     register int sd;
-     int expected;
-     struct input_event *hold_quit;
+w32_read_socket (struct terminal *terminal, int expected,
+                struct input_event *hold_quit)
 {
   int count = 0;
   int check_visibility = 0;
@@ -4284,7 +4178,7 @@ w32_read_socket (sd, expected, hold_quit)
                temp_index = 0;
              temp_buffer[temp_index++] = msg.msg.wParam;
              inev.kind = MULTIMEDIA_KEY_EVENT;
-             inev.code = GET_APPCOMMAND_LPARAM(msg.msg.lParam);
+             inev.code = GET_APPCOMMAND_LPARAM (msg.msg.lParam);
              inev.modifiers = msg.dwModifiers;
              XSETFRAME (inev.frame_or_window, f);
              inev.timestamp = msg.msg.time;
@@ -4332,7 +4226,7 @@ w32_read_socket (sd, expected, hold_quit)
                     selected now and last mouse movement event was
                     not in it.  Minibuffer window will be selected
                     only when it is active.  */
-                 if (WINDOWP(window)
+                 if (WINDOWP (window)
                      && !EQ (window, last_window)
                      && !EQ (window, selected_window)
                      /* For click-to-focus window managers
@@ -4892,11 +4786,7 @@ w32_read_socket (sd, expected, hold_quit)
    mode lines must be clipped to the whole window.  */
 
 static void
-w32_clip_to_row (w, row, area, hdc)
-     struct window *w;
-     struct glyph_row *row;
-     int area;
-     HDC hdc;
+w32_clip_to_row (struct window *w, struct glyph_row *row, int area, HDC hdc)
 {
   struct frame *f = XFRAME (WINDOW_FRAME (w));
   RECT clip_rect;
@@ -4917,9 +4807,7 @@ w32_clip_to_row (w, row, area, hdc)
 /* Draw a hollow box cursor on window W in glyph row ROW.  */
 
 static void
-x_draw_hollow_cursor (w, row)
-     struct window *w;
-     struct glyph_row *row;
+x_draw_hollow_cursor (struct window *w, struct glyph_row *row)
 {
   struct frame *f = XFRAME (WINDOW_FRAME (w));
   HDC hdc;
@@ -4959,11 +4847,8 @@ x_draw_hollow_cursor (w, row)
    --gerd.  */
 
 static void
-x_draw_bar_cursor (w, row, width, kind)
-     struct window *w;
-     struct glyph_row *row;
-     int width;
-     enum text_cursor_kinds kind;
+x_draw_bar_cursor (struct window *w, struct glyph_row *row,
+                  int width, enum text_cursor_kinds kind)
 {
   struct frame *f = XFRAME (w->frame);
   struct glyph *cursor_glyph;
@@ -5012,6 +4897,11 @@ x_draw_bar_cursor (w, row, width, kind)
 
          w->phys_cursor_width = width;
 
+         /* If the character under cursor is R2L, draw the bar cursor
+            on the right of its glyph, rather than on the left.  */
+         if ((cursor_glyph->resolved_level & 1) != 0)
+           x += cursor_glyph->pixel_width - width;
+
          w32_fill_area (f, hdc, cursor_color, x,
                         WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y),
                         width, row->height);
@@ -5042,9 +4932,7 @@ x_draw_bar_cursor (w, row, width, kind)
 /* RIF: Define cursor CURSOR on frame F.  */
 
 static void
-w32_define_frame_cursor (f, cursor)
-     struct frame *f;
-     Cursor cursor;
+w32_define_frame_cursor (struct frame *f, Cursor cursor)
 {
   w32_define_cursor (FRAME_W32_WINDOW (f), cursor);
 }
@@ -5053,9 +4941,7 @@ w32_define_frame_cursor (f, cursor)
 /* RIF: Clear area on frame F.  */
 
 static void
-w32_clear_frame_area (f, x, y, width, height)
-     struct frame *f;
-     int x, y, width, height;
+w32_clear_frame_area (struct frame *f, int x, int y, int width, int height)
 {
   HDC hdc;
 
@@ -5067,12 +4953,9 @@ w32_clear_frame_area (f, x, y, width, height)
 /* RIF: Draw or clear cursor on window W.  */
 
 static void
-w32_draw_window_cursor (w, glyph_row, x, y, cursor_type, cursor_width, on_p, active_p)
-     struct window *w;
-     struct glyph_row *glyph_row;
-     int x, y;
-     int cursor_type, cursor_width;
-     int on_p, active_p;
+w32_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)
 {
   if (on_p)
     {
@@ -5125,10 +5008,12 @@ w32_draw_window_cursor (w, glyph_row, x, y, cursor_type, cursor_width, on_p, act
        }
 
       if (glyph_row->exact_window_width_line_p
-         && w->phys_cursor.hpos >= glyph_row->used[TEXT_AREA])
+         && (glyph_row->reversed_p
+             ? (w->phys_cursor.hpos < 0)
+             : (w->phys_cursor.hpos >= glyph_row->used[TEXT_AREA])))
        {
          glyph_row->cursor_in_fringe_p = 1;
-         draw_fringe_bitmap (w, glyph_row, 0);
+         draw_fringe_bitmap (w, glyph_row, glyph_row->reversed_p);
          return;
        }
 
@@ -5165,9 +5050,7 @@ w32_draw_window_cursor (w, glyph_row, x, y, cursor_type, cursor_width, on_p, act
 /* Icons.  */
 
 int
-x_bitmap_icon (f, icon)
-     struct frame *f;
-     Lisp_Object icon;
+x_bitmap_icon (struct frame *f, Lisp_Object icon)
 {
   HANDLE main_icon;
   HANDLE small_icon = NULL;
@@ -5256,10 +5139,7 @@ x_io_error_quitter (display)
 /* Changing the font of the frame.  */
 
 Lisp_Object
-x_new_font (f, font_object, fontset)
-     struct frame *f;
-     Lisp_Object font_object;
-     int fontset;
+x_new_font (struct frame *f, Lisp_Object font_object, int fontset)
 {
   struct font *font = XFONT_OBJECT (font_object);
 
@@ -5327,8 +5207,7 @@ xim_close_dpy (dpyinfo)
    from its current recorded position values and gravity.  */
 
 void
-x_calc_absolute_position (f)
-     struct frame *f;
+x_calc_absolute_position (struct frame *f)
 {
   int flags = f->size_hint_flags;
 
@@ -5388,10 +5267,8 @@ x_calc_absolute_position (f)
    which means, do adjust for borders but don't change the gravity.  */
 
 void
-x_set_offset (f, xoff, yoff, change_gravity)
-     struct frame *f;
-     register int xoff, yoff;
-     int change_gravity;
+x_set_offset (struct frame *f, register int xoff, register int yoff,
+             int change_gravity)
 {
   int modified_top, modified_left;
 
@@ -5426,8 +5303,7 @@ x_set_offset (f, xoff, yoff, change_gravity)
 /* Check if we need to resize the frame due to a fullscreen request.
    If so needed, resize the frame. */
 static void
-x_check_fullscreen (f)
-     struct frame *f;
+x_check_fullscreen (struct frame *f)
 {
   if (f->want_fullscreen & FULLSCREEN_BOTH)
     {
@@ -5457,10 +5333,7 @@ x_check_fullscreen (f)
    Otherwise we leave the window gravity unchanged.  */
 
 void
-x_set_window_size (f, change_gravity, cols, rows)
-     struct frame *f;
-     int change_gravity;
-     int cols, rows;
+x_set_window_size (struct frame *f, int change_gravity, int cols, int rows)
 {
   int pixelwidth, pixelheight;
 
@@ -5485,8 +5358,8 @@ x_set_window_size (f, change_gravity, cols, rows)
     rect.right = pixelwidth;
     rect.bottom = pixelheight;
 
-    AdjustWindowRect(&rect, f->output_data.w32->dwStyle,
-                    FRAME_EXTERNAL_MENU_BAR (f));
+    AdjustWindowRect (&rect, f->output_data.w32->dwStyle,
+                     FRAME_EXTERNAL_MENU_BAR (f));
 
     my_set_window_pos (FRAME_W32_WINDOW (f),
                       NULL,
@@ -5552,9 +5425,7 @@ x_set_window_size (f, change_gravity, cols, rows)
 void x_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y);
 
 void
-x_set_mouse_position (f, x, y)
-     struct frame *f;
-     int x, y;
+x_set_mouse_position (struct frame *f, int x, int y)
 {
   int pix_x, pix_y;
 
@@ -5571,9 +5442,7 @@ x_set_mouse_position (f, x, y)
 }
 
 void
-x_set_mouse_pixel_position (f, pix_x, pix_y)
-     struct frame *f;
-     int pix_x, pix_y;
+x_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y)
 {
   RECT rect;
   POINT pt;
@@ -5594,8 +5463,7 @@ x_set_mouse_pixel_position (f, pix_x, pix_y)
 /* focus shifting, raising and lowering.  */
 
 void
-x_focus_on_frame (f)
-     struct frame *f;
+x_focus_on_frame (struct frame *f)
 {
   struct w32_display_info *dpyinfo = &one_w32_display_info;
 
@@ -5612,15 +5480,13 @@ x_focus_on_frame (f)
 }
 
 void
-x_unfocus_frame (f)
-     struct frame *f;
+x_unfocus_frame (struct frame *f)
 {
 }
 
 /* Raise frame F.  */
 void
-x_raise_frame (f)
-     struct frame *f;
+x_raise_frame (struct frame *f)
 {
   BLOCK_INPUT;
 
@@ -5679,8 +5545,7 @@ x_raise_frame (f)
 
 /* Lower frame F.  */
 void
-x_lower_frame (f)
-     struct frame *f;
+x_lower_frame (struct frame *f)
 {
   BLOCK_INPUT;
   my_set_window_pos (FRAME_W32_WINDOW (f),
@@ -5691,9 +5556,7 @@ x_lower_frame (f)
 }
 
 static void
-w32_frame_raise_lower (f, raise_flag)
-     FRAME_PTR f;
-     int raise_flag;
+w32_frame_raise_lower (FRAME_PTR f, int raise_flag)
 {
   if (! FRAME_W32_P (f))
     return;
@@ -5714,8 +5577,7 @@ w32_frame_raise_lower (f, raise_flag)
    finishes with it.  */
 
 void
-x_make_frame_visible (f)
-     struct frame *f;
+x_make_frame_visible (struct frame *f)
 {
   Lisp_Object type;
 
@@ -5739,8 +5601,8 @@ x_make_frame_visible (f)
 
          /* Adjust vertical window position in order to avoid being
             covered by a task bar placed at the bottom of the desktop. */
-         SystemParametersInfo(SPI_GETWORKAREA, 0, &workarea_rect, 0);
-         GetWindowRect(FRAME_W32_WINDOW(f), &window_rect);
+         SystemParametersInfo (SPI_GETWORKAREA, 0, &workarea_rect, 0);
+         GetWindowRect (FRAME_W32_WINDOW(f), &window_rect);
          if (window_rect.bottom > workarea_rect.bottom
              && window_rect.top > workarea_rect.top)
            f->top_pos = max (window_rect.top
@@ -5807,8 +5669,8 @@ x_make_frame_visible (f)
 
 /* Make the frame visible (mapped and not iconified).  */
 
-x_make_frame_invisible (f)
-     struct frame *f;
+void
+x_make_frame_invisible (struct frame *f)
 {
   /* Don't keep the highlight on an invisible frame.  */
   if (FRAME_W32_DISPLAY_INFO (f)->x_highlight_frame == f)
@@ -5834,8 +5696,7 @@ x_make_frame_invisible (f)
 /* Change window state from mapped to iconified. */
 
 void
-x_iconify_frame (f)
-     struct frame *f;
+x_iconify_frame (struct frame *f)
 {
   Lisp_Object type;
 
@@ -5862,8 +5723,7 @@ x_iconify_frame (f)
 /* Free X resources of frame F.  */
 
 void
-x_free_frame_resources (f)
-     struct frame *f;
+x_free_frame_resources (struct frame *f)
 {
   struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f);
 
@@ -5921,8 +5781,7 @@ x_free_frame_resources (f)
 
 /* Destroy the window of frame F.  */
 void
-x_destroy_window (f)
-     struct frame *f;
+x_destroy_window (struct frame *f)
 {
   struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f);
 
@@ -5939,10 +5798,7 @@ x_destroy_window (f)
    If USER_POSITION is nonzero, we set the USPosition
    flag (this is useful when FLAGS is 0).  */
 void
-x_wm_set_size_hint (f, flags, user_position)
-     struct frame *f;
-     long flags;
-     int user_position;
+x_wm_set_size_hint (struct frame *f, long flags, int user_position)
 {
   Window window = FRAME_W32_WINDOW (f);
 
@@ -5958,9 +5814,7 @@ x_wm_set_size_hint (f, flags, user_position)
 
 /* Window manager things */
 void
-x_wm_set_icon_position (f, icon_x, icon_y)
-     struct frame *f;
-     int icon_x, icon_y;
+x_wm_set_icon_position (struct frame *f, int icon_x, int icon_y)
 {
 #if 0
   Window window = FRAME_W32_WINDOW (f);
@@ -5981,12 +5835,11 @@ x_wm_set_icon_position (f, icon_x, icon_y)
 static int w32_initialized = 0;
 
 void
-w32_initialize_display_info (display_name)
-     Lisp_Object display_name;
+w32_initialize_display_info (Lisp_Object display_name)
 {
   struct w32_display_info *dpyinfo = &one_w32_display_info;
 
-  bzero (dpyinfo, sizeof (*dpyinfo));
+  memset (dpyinfo, 0, sizeof (*dpyinfo));
 
   /* Put it on w32_display_name_list.  */
   w32_display_name_list = Fcons (Fcons (display_name, Qnil),
@@ -6035,8 +5888,7 @@ w32_initialize_display_info (display_name)
    but any whitespace following value is not removed.  */
 
 static char *
-w32_make_rdb (xrm_option)
-     char *xrm_option;
+w32_make_rdb (char *xrm_option)
 {
   char *buffer = xmalloc (strlen (xrm_option) + 2);
   char *current = buffer;
@@ -6195,10 +6047,7 @@ x_delete_terminal (struct terminal *terminal)
 }
 
 struct w32_display_info *
-w32_term_init (display_name, xrm_option, resource_name)
-     Lisp_Object display_name;
-     char *xrm_option;
-     char *resource_name;
+w32_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
 {
   struct w32_display_info *dpyinfo;
   struct terminal *terminal;
@@ -6273,8 +6122,7 @@ w32_term_init (display_name, xrm_option, resource_name)
 \f
 /* Get rid of display DPYINFO, assuming all frames are already gone.  */
 void
-x_delete_display (dpyinfo)
-     struct w32_display_info *dpyinfo;
+x_delete_display (struct w32_display_info *dpyinfo)
 {
   /* Discard this display from w32_display_name_list and w32_display_list.
      We can't use Fdelq because that can quit.  */
@@ -6310,7 +6158,7 @@ x_delete_display (dpyinfo)
     }
     dpyinfo->color_list = NULL;
     if (dpyinfo->palette)
-      DeleteObject(dpyinfo->palette);
+      DeleteObject (dpyinfo->palette);
   }
   xfree (dpyinfo->w32_id_name);
 
@@ -6322,7 +6170,7 @@ x_delete_display (dpyinfo)
 DWORD WINAPI w32_msg_worker (void * arg);
 
 static void
-w32_initialize ()
+w32_initialize (void)
 {
   HANDLE shell;
   HRESULT (WINAPI * set_user_model) (wchar_t * id);
@@ -6425,7 +6273,7 @@ w32_initialize ()
 }
 
 void
-syms_of_w32term ()
+syms_of_w32term (void)
 {
   staticpro (&w32_display_name_list);
   w32_display_name_list = Qnil;
index ea5f420a7dc71a4b98112bdcd572b23d5c2fb22a..ea245144ac31b07a37051dfae84d34b8df505c40 100644 (file)
@@ -48,8 +48,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 extern MSG CurMsg;
 extern BOOL bUseDflt;
 
-extern struct frame *x_window_to_frame ();
-
 /* Structure recording bitmaps and reference count.
    If REFCOUNT is 0 then this record is free to be reused.  */
 
@@ -226,16 +224,19 @@ extern Lisp_Object w32_display_name_list;
 /* Regexp matching a font name whose width is the same as `PIXEL_SIZE'.  */
 extern Lisp_Object Vx_pixel_size_width_font_regexp;
 
-struct w32_display_info *x_display_info_for_name ();
+extern struct frame *x_window_to_frame (struct w32_display_info *, HWND);
+
+struct w32_display_info *x_display_info_for_name (Lisp_Object);
 
-Lisp_Object display_x_get_resource P_ ((struct w32_display_info *,
-                                       Lisp_Object, Lisp_Object,
-                                       Lisp_Object, Lisp_Object));
+Lisp_Object display_x_get_resource (struct w32_display_info *,
+                                    Lisp_Object, Lisp_Object,
+                                    Lisp_Object, Lisp_Object);
 
-extern struct w32_display_info *w32_term_init ();
+extern struct w32_display_info *w32_term_init (Lisp_Object,
+                                              char *, char *);
 
-extern int x_display_pixel_height P_ ((struct w32_display_info *));
-extern int x_display_pixel_width P_ ((struct w32_display_info *));
+extern int x_display_pixel_height (struct w32_display_info *);
+extern int x_display_pixel_width (struct w32_display_info *);
 
 \f
 #define PIX_TYPE COLORREF
@@ -544,8 +545,10 @@ struct scroll_bar {
 #define VERTICAL_SCROLL_BAR_WIDTH_TRIM (0)
 
 \f
-extern void w32_fill_rect ();
-extern void w32_clear_window ();
+struct frame;  /* from frame.h */
+
+extern void w32_fill_rect (struct frame *, HDC, COLORREF, RECT *);
+extern void w32_clear_window (struct frame *);
 
 #define w32_fill_area(f,hdc,pix,x,y,nx,ny) \
 do { \
@@ -645,10 +648,10 @@ typedef struct deferred_msg
 
 extern CRITICAL_SECTION critsect;
 
-extern void init_crit ();
-extern void delete_crit ();
+extern void init_crit (void);
+extern void delete_crit (void);
 
-extern void signal_quit ();
+extern void signal_quit (void);
 
 #define enter_crit() EnterCriticalSection (&critsect)
 #define leave_crit() LeaveCriticalSection (&critsect)
@@ -658,14 +661,13 @@ extern void deselect_palette (struct frame * f, HDC hdc);
 extern HDC get_frame_dc (struct frame * f);
 extern int release_frame_dc (struct frame * f, HDC hDC);
 
-extern void drain_message_queue ();
+extern void drain_message_queue (void);
 
-extern BOOL get_next_msg ();
-extern BOOL post_msg ();
+extern BOOL get_next_msg (W32Msg *, BOOL);
+extern BOOL post_msg (W32Msg *);
 extern void complete_deferred_msg (HWND hwnd, UINT msg, LRESULT result);
-extern void wait_for_sync ();
 
-extern BOOL parse_button ();
+extern BOOL parse_button (int, int, int *, int *);
 
 extern void w32_sys_ring_bell (struct frame *f);
 extern void x_delete_display (struct w32_display_info *dpyinfo);
@@ -725,7 +727,7 @@ struct frame * check_x_frame (Lisp_Object);
 EXFUN (Fx_display_color_p, 1);
 EXFUN (Fx_display_grayscale_p, 1);
 
-typedef DWORD (WINAPI * ClipboardSequence_Proc) ();
+typedef DWORD (WINAPI * ClipboardSequence_Proc) (void);
 typedef BOOL (WINAPI * AppendMenuW_Proc) (
     IN HMENU,
     IN UINT,
index cfdf629ceee05e6ea6f12a5fd20e5be061e92f08..9edd6353ba332defd7c2fdb679344ba034cb2915 100644 (file)
@@ -57,15 +57,14 @@ extern int initialized;
 extern struct font_driver uniscribe_font_driver;
 
 /* EnumFontFamiliesEx callback.  */
-static int CALLBACK add_opentype_font_name_to_list P_ ((ENUMLOGFONTEX *,
-                                                        NEWTEXTMETRICEX *,
-                                                        DWORD, LPARAM));
+static int CALLBACK add_opentype_font_name_to_list (ENUMLOGFONTEX *,
+                                                    NEWTEXTMETRICEX *,
+                                                    DWORD, LPARAM);
 /* Used by uniscribe_otf_capability.  */
 static Lisp_Object otf_features (HDC context, char *table);
 
 static int
-memq_no_quit (elt, list)
-     Lisp_Object elt, list;
+memq_no_quit (Lisp_Object elt, Lisp_Object list)
 {
   while (CONSP (list) && ! EQ (XCAR (list), elt))
     list = XCDR (list);
@@ -75,8 +74,7 @@ memq_no_quit (elt, list)
 \f
 /* Font backend interface implementation.  */
 static Lisp_Object
-uniscribe_list (frame, font_spec)
-     Lisp_Object frame, font_spec;
+uniscribe_list (Lisp_Object frame, Lisp_Object font_spec)
 {
   Lisp_Object fonts = w32font_list_internal (frame, font_spec, 1);
   FONT_ADD_LOG ("uniscribe-list", font_spec, fonts);
@@ -84,8 +82,7 @@ uniscribe_list (frame, font_spec)
 }
 
 static Lisp_Object
-uniscribe_match (frame, font_spec)
-     Lisp_Object frame, font_spec;
+uniscribe_match (Lisp_Object frame, Lisp_Object font_spec)
 {
   Lisp_Object entity = w32font_match_internal (frame, font_spec, 1);
   FONT_ADD_LOG ("uniscribe-match", font_spec, entity);
@@ -93,15 +90,14 @@ uniscribe_match (frame, font_spec)
 }
 
 static Lisp_Object
-uniscribe_list_family (frame)
-     Lisp_Object frame;
+uniscribe_list_family (Lisp_Object frame)
 {
   Lisp_Object list = Qnil;
   LOGFONT font_match_pattern;
   HDC dc;
   FRAME_PTR f = XFRAME (frame);
 
-  bzero (&font_match_pattern, sizeof (font_match_pattern));
+  memset (&font_match_pattern, 0, sizeof (font_match_pattern));
   /* Limit enumerated fonts to outline fonts to save time.  */
   font_match_pattern.lfOutPrecision = OUT_OUTLINE_PRECIS;
 
@@ -116,10 +112,7 @@ uniscribe_list_family (frame)
 }
 
 static Lisp_Object
-uniscribe_open (f, font_entity, pixel_size)
-     FRAME_PTR f;
-     Lisp_Object font_entity;
-     int pixel_size;
+uniscribe_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size)
 {
   Lisp_Object font_object
     = font_make_object (VECSIZE (struct uniscribe_font_info),
@@ -148,9 +141,7 @@ uniscribe_open (f, font_entity, pixel_size)
 }
 
 static void
-uniscribe_close (f, font)
-     FRAME_PTR f;
-     struct font *font;
+uniscribe_close (FRAME_PTR f, struct font *font)
 {
   struct uniscribe_font_info *uniscribe_font
     = (struct uniscribe_font_info *) font;
@@ -164,8 +155,7 @@ uniscribe_close (f, font)
 /* Return a list describing which scripts/languages FONT supports by
    which GSUB/GPOS features of OpenType tables.  */
 static Lisp_Object
-uniscribe_otf_capability (font)
-     struct font *font;
+uniscribe_otf_capability (struct font *font)
 {
   HDC context;
   HFONT old_font;
@@ -175,7 +165,7 @@ uniscribe_otf_capability (font)
 
   f = XFRAME (selected_frame);
   context = get_frame_dc (f);
-  old_font = SelectObject (context, FONT_HANDLE(font));
+  old_font = SelectObject (context, FONT_HANDLE (font));
 
   features = otf_features (context, "GSUB");
   XSETCAR (capability, features);
@@ -202,8 +192,7 @@ uniscribe_otf_capability (font)
    than the length of LGSTRING, nil should be return.  In that case,
    this function is called again with the larger LGSTRING.  */
 static Lisp_Object
-uniscribe_shape (lgstring)
-     Lisp_Object lgstring;
+uniscribe_shape (Lisp_Object lgstring)
 {
   struct font * font;
   struct uniscribe_font_info * uniscribe_font;
@@ -287,7 +276,7 @@ uniscribe_shape (lgstring)
             passed in.  */
          f = XFRAME (selected_frame);
          context = get_frame_dc (f);
-         old_font = SelectObject (context, FONT_HANDLE(font));
+         old_font = SelectObject (context, FONT_HANDLE (font));
 
          result = ScriptShape (context, &(uniscribe_font->cache),
                                chars + items[i].iCharPos, nchars_in_run,
@@ -322,7 +311,7 @@ uniscribe_shape (lgstring)
              /* Cache not complete...  */
              f = XFRAME (selected_frame);
              context = get_frame_dc (f);
-             old_font = SelectObject (context, FONT_HANDLE(font));
+             old_font = SelectObject (context, FONT_HANDLE (font));
 
              result = ScriptPlace (context, &(uniscribe_font->cache),
                                    glyphs, nglyphs, attributes, &(items[i].a),
@@ -397,7 +386,7 @@ uniscribe_shape (lgstring)
                      /* Cache incomplete... */
                      f = XFRAME (selected_frame);
                      context = get_frame_dc (f);
-                     old_font = SelectObject (context, FONT_HANDLE(font));
+                     old_font = SelectObject (context, FONT_HANDLE (font));
                      result = ScriptGetGlyphABCWidth (context,
                                                       &(uniscribe_font->cache),
                                                       glyphs[j], &char_metric);
@@ -451,9 +440,7 @@ uniscribe_shape (lgstring)
    Return a glyph code of FONT for characer C (Unicode code point).
    If FONT doesn't have such a glyph, return FONT_INVALID_CODE.  */
 static unsigned
-uniscribe_encode_char (font, c)
-     struct font *font;
-     int c;
+uniscribe_encode_char (struct font *font, int c)
 {
   HDC context = NULL;
   struct frame *f = NULL;
@@ -509,7 +496,7 @@ uniscribe_encode_char (font, c)
                  the frame.  */
               f = XFRAME (selected_frame);
               context = get_frame_dc (f);
-              old_font = SelectObject (context, FONT_HANDLE(font));
+              old_font = SelectObject (context, FONT_HANDLE (font));
               result = ScriptShape (context, &(uniscribe_font->cache),
                                     ch, len, 2, &(items[0].a),
                                     glyphs, clusters, attrs, &nglyphs);
@@ -574,12 +561,9 @@ uniscribe_encode_char (font, c)
    Adds the name of opentype fonts to a Lisp list (passed in as the
    lParam arg). */
 static int CALLBACK
-add_opentype_font_name_to_list (logical_font, physical_font, font_type,
-                                list_object)
-     ENUMLOGFONTEX *logical_font;
-     NEWTEXTMETRICEX *physical_font;
-     DWORD font_type;
-     LPARAM list_object;
+add_opentype_font_name_to_list (ENUMLOGFONTEX *logical_font,
+                               NEWTEXTMETRICEX *physical_font,
+                               DWORD font_type, LPARAM list_object)
 {
   Lisp_Object* list = (Lisp_Object *) list_object;
   Lisp_Object family;
@@ -650,9 +634,8 @@ static char* NOTHING = "    ";
 /* Check if font supports the otf script/language/features specified.
    OTF_SPEC is in the format
      (script lang [(gsub_feature ...)|nil] [(gpos_feature ...)]?) */
-int uniscribe_check_otf (font, otf_spec)
-     LOGFONT *font;
-     Lisp_Object otf_spec;
+int
+uniscribe_check_otf (LOGFONT *font, Lisp_Object otf_spec)
 {
   Lisp_Object script, lang, rest;
   Lisp_Object features[2];
@@ -947,7 +930,7 @@ struct font_driver uniscribe_font_driver =
     NULL, /* get_outline */
     NULL, /* free_outline */
     NULL, /* anchor_point */
-    uniscribe_otf_capability, /* Defined so (font-get FONTOBJ :otf) works.  */ 
+    uniscribe_otf_capability, /* Defined so (font-get FONTOBJ :otf) works.  */
     NULL, /* otf_drive - use shape instead.  */
     NULL, /* start_for_frame */
     NULL, /* end_for_frame */
@@ -957,7 +940,7 @@ struct font_driver uniscribe_font_driver =
 /* Note that this should be called at every startup, not just when dumping,
    as it needs to test for the existence of the Uniscribe library.  */
 void
-syms_of_w32uniscribe ()
+syms_of_w32uniscribe (void)
 {
   HMODULE uniscribe;
 
index d77eb6b68eacc9f1d3e6d503b20604fb134df4b6..8fee42dae4860e1d95dd38509abc99999e055d11 100644 (file)
@@ -39,7 +39,7 @@ HANDLE input_available = NULL;
 HANDLE interrupt_handle = NULL;
 
 void
-init_crit ()
+init_crit (void)
 {
   InitializeCriticalSection (&critsect);
 
@@ -57,7 +57,7 @@ init_crit ()
 }
 
 void
-delete_crit ()
+delete_crit (void)
 {
   DeleteCriticalSection (&critsect);
 
@@ -74,7 +74,7 @@ delete_crit ()
 }
 
 void
-signal_quit ()
+signal_quit (void)
 {
   /* Make sure this event never remains signaled; if the main thread
      isn't in a blocking call, then this should do nothing.  */
@@ -161,9 +161,7 @@ int_msg *lpTail = NULL;
 int nQueue = 0;
 
 BOOL
-get_next_msg (lpmsg, bWait)
-     W32Msg * lpmsg;
-     BOOL bWait;
+get_next_msg (W32Msg * lpmsg, BOOL bWait)
 {
   BOOL bRet = FALSE;
 
@@ -180,7 +178,7 @@ get_next_msg (lpmsg, bWait)
 
   if (nQueue)
     {
-      bcopy (&(lpHead->w32msg), lpmsg, sizeof (W32Msg));
+      memcpy (lpmsg, &lpHead->w32msg, sizeof (W32Msg));
 
       {
        int_msg * lpCur = lpHead;
@@ -216,7 +214,7 @@ get_next_msg (lpmsg, bWait)
                   if (!UnionRect (&(lpmsg->rect), &(lpmsg->rect),
                                   &(lpCur->w32msg.rect)))
                     {
-                      SetRectEmpty(&(lpmsg->rect));
+                      SetRectEmpty (&(lpmsg->rect));
                     }
 
                   myfree (lpCur);
@@ -245,15 +243,14 @@ get_next_msg (lpmsg, bWait)
 }
 
 BOOL
-post_msg (lpmsg)
-     W32Msg * lpmsg;
+post_msg (W32Msg * lpmsg)
 {
   int_msg * lpNew = (int_msg *) myalloc (sizeof (int_msg));
 
   if (!lpNew)
     return (FALSE);
 
-  bcopy (lpmsg, &(lpNew->w32msg), sizeof (W32Msg));
+  memcpy (&lpNew->w32msg, lpmsg, sizeof (W32Msg));
   lpNew->lpNext = NULL;
 
   enter_crit ();
@@ -283,7 +280,7 @@ prepend_msg (W32Msg *lpmsg)
   if (!lpNew)
     return (FALSE);
 
-  bcopy (lpmsg, &(lpNew->w32msg), sizeof (W32Msg));
+  memcpy (&lpNew->w32msg, lpmsg, sizeof (W32Msg));
 
   enter_crit ();
 
@@ -298,7 +295,7 @@ prepend_msg (W32Msg *lpmsg)
 
 /* Process all messages in the current thread's queue.  */
 void
-drain_message_queue ()
+drain_message_queue (void)
 {
   MSG msg;
   while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
@@ -322,9 +319,7 @@ drain_message_queue ()
  */
 
 static int
-read_integer (string, NextString)
-     register char *string;
-     char **NextString;
+read_integer (register char *string, char **NextString)
 {
   register int Result = 0;
   int Sign = 1;
@@ -348,10 +343,9 @@ read_integer (string, NextString)
 }
 
 int
-XParseGeometry (string, x, y, width, height)
-     char *string;
-     int *x, *y;
-     unsigned int *width, *height;    /* RETURN */
+XParseGeometry (char *string,
+               int *x, int *y,
+               unsigned int *width, unsigned int *height)
 {
   int mask = NoValue;
   register char *strind;
@@ -446,8 +440,7 @@ XParseGeometry (string, x, y, width, height)
 
 /* x_sync is a no-op on W32.  */
 void
-x_sync (f)
-     void *f;
+x_sync (void *f)
 {
 }
 
index 0c3aa64a74e2b0baae0ade58fc48ea914cdae118..2301f76c7c9c397c6c019df81b31f5872da7aaa5 100644 (file)
@@ -76,14 +76,12 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #define DEFAULT_FACE_FONT "-*-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-*"
 
 
-static void EmacsFrameInitialize (/*Widget, Widget, ArgList, Cardinal * */);
-static void EmacsFrameDestroy (/* Widget */);
-static void EmacsFrameRealize (/* Widget, XtValueMask*, XSetWindowAttributes* */);
-void EmacsFrameResize (/* Widget widget */);
-static Boolean EmacsFrameSetValues (/* Widget, Widget, Widget,
-                                    ArgList, Cardinal * */);
-static XtGeometryResult EmacsFrameQueryGeometry (/* Widget, XtWidgetGeometry*,
-                                                 XtWidgetGeometry* */);
+static void EmacsFrameInitialize (Widget request, Widget new, ArgList dum1, Cardinal *dum2);
+static void EmacsFrameDestroy (Widget widget);
+static void EmacsFrameRealize (Widget widget, XtValueMask *mask, XSetWindowAttributes *attrs);
+void EmacsFrameResize (Widget widget);
+static Boolean EmacsFrameSetValues (Widget cur_widget, Widget req_widget, Widget new_widget, ArgList dum1, Cardinal *dum2);
+static XtGeometryResult EmacsFrameQueryGeometry (Widget widget, XtWidgetGeometry *request, XtWidgetGeometry *result);
 
 
 #undef XtOffset
@@ -180,10 +178,7 @@ EmacsFrameClassRec emacsFrameClassRec = {
 WidgetClass emacsFrameClass = (WidgetClass) &emacsFrameClassRec;
 
 static void
-get_default_char_pixel_size (ew, pixel_width, pixel_height)
-     EmacsFrame ew;
-     int* pixel_width;
-     int* pixel_height;
+get_default_char_pixel_size (EmacsFrame ew, int *pixel_width, int *pixel_height)
 {
   struct frame* f = ew->emacs_frame.frame;
   *pixel_width = FRAME_COLUMN_WIDTH (f);
@@ -191,12 +186,7 @@ get_default_char_pixel_size (ew, pixel_width, pixel_height)
 }
 
 static void
-pixel_to_char_size (ew, pixel_width, pixel_height, char_width, char_height)
-     EmacsFrame ew;
-     Dimension pixel_width;
-     Dimension pixel_height;
-     int* char_width;
-     int* char_height;
+pixel_to_char_size (EmacsFrame ew, Dimension pixel_width, Dimension pixel_height, int *char_width, int *char_height)
 {
   struct frame* f = ew->emacs_frame.frame;
   *char_width = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, (int) pixel_width);
@@ -204,12 +194,7 @@ pixel_to_char_size (ew, pixel_width, pixel_height, char_width, char_height)
 }
 
 static void
-char_to_pixel_size (ew, char_width, char_height, pixel_width, pixel_height)
-     EmacsFrame ew;
-     int char_width;
-     int char_height;
-     Dimension* pixel_width;
-     Dimension* pixel_height;
+char_to_pixel_size (EmacsFrame ew, int char_width, int char_height, Dimension *pixel_width, Dimension *pixel_height)
 {
   struct frame* f = ew->emacs_frame.frame;
   *pixel_width = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, char_width);
@@ -217,12 +202,7 @@ char_to_pixel_size (ew, char_width, char_height, pixel_width, pixel_height)
 }
 
 static void
-round_size_to_char (ew, in_width, in_height, out_width, out_height)
-     EmacsFrame ew;
-     Dimension in_width;
-     Dimension in_height;
-     Dimension* out_width;
-     Dimension* out_height;
+round_size_to_char (EmacsFrame ew, Dimension in_width, Dimension in_height, Dimension *out_width, Dimension *out_height)
 {
   int char_width;
   int char_height;
@@ -231,8 +211,7 @@ round_size_to_char (ew, in_width, in_height, out_width, out_height)
 }
 
 static Widget
-get_wm_shell (w)
-     Widget w;
+get_wm_shell (Widget w)
 {
   Widget wmshell;
 
@@ -269,8 +248,7 @@ static Boolean first_frame_p = True;
 #endif
 
 static void
-set_frame_size (ew)
-     EmacsFrame ew;
+set_frame_size (EmacsFrame ew)
 {
   /* The widget hierarchy is
 
@@ -491,8 +469,7 @@ set_frame_size (ew)
 int update_hints_inhibit;
 
 static void
-update_wm_hints (ew)
-     EmacsFrame ew;
+update_wm_hints (EmacsFrame ew)
 {
   Widget wmshell = get_wm_shell ((Widget)ew);
   int cw;
@@ -570,8 +547,7 @@ static char setup_frame_cursor_bits[] =
 };
 
 static void
-setup_frame_gcs (ew)
-     EmacsFrame ew;
+setup_frame_gcs (EmacsFrame ew)
 {
   XGCValues gc_values;
   struct frame* s = ew->emacs_frame.frame;
@@ -649,8 +625,7 @@ setup_frame_gcs (ew)
 }
 
 static void
-update_various_frame_slots (ew)
-     EmacsFrame ew;
+update_various_frame_slots (EmacsFrame ew)
 {
   struct frame *f = ew->emacs_frame.frame;
   struct x_output *x = f->output_data.x;
@@ -661,8 +636,7 @@ update_various_frame_slots (ew)
 }
 
 static void
-update_from_various_frame_slots (ew)
-     EmacsFrame ew;
+update_from_various_frame_slots (EmacsFrame ew)
 {
   struct frame *f = ew->emacs_frame.frame;
   struct x_output *x = f->output_data.x;
@@ -677,11 +651,7 @@ update_from_various_frame_slots (ew)
 }
 
 static void
-EmacsFrameInitialize (request, new, dum1, dum2)
-     Widget request;
-     Widget new;
-     ArgList dum1;
-     Cardinal *dum2;
+EmacsFrameInitialize (Widget request, Widget new, ArgList dum1, Cardinal *dum2)
 {
   EmacsFrame ew = (EmacsFrame)new;
 
@@ -698,10 +668,7 @@ EmacsFrameInitialize (request, new, dum1, dum2)
 
 
 static void
-EmacsFrameRealize (widget, mask, attrs)
-     Widget widget;
-     XtValueMask *mask;
-     XSetWindowAttributes *attrs;
+EmacsFrameRealize (Widget widget, XtValueMask *mask, XSetWindowAttributes *attrs)
 {
   EmacsFrame ew = (EmacsFrame)widget;
 
@@ -717,11 +684,10 @@ EmacsFrameRealize (widget, mask, attrs)
   update_wm_hints (ew);
 }
 
-extern void free_frame_faces (/* struct frame * */);
+extern void free_frame_faces (struct frame *);
 
 static void
-EmacsFrameDestroy (widget)
-     Widget widget;
+EmacsFrameDestroy (Widget widget)
 {
   EmacsFrame ew = (EmacsFrame) widget;
   struct frame* s = ew->emacs_frame.frame;
@@ -739,8 +705,7 @@ EmacsFrameDestroy (widget)
 }
 
 void
-EmacsFrameResize (widget)
-     Widget widget;
+EmacsFrameResize (Widget widget)
 {
   EmacsFrame ew = (EmacsFrame)widget;
   struct frame *f = ew->emacs_frame.frame;
@@ -756,12 +721,7 @@ EmacsFrameResize (widget)
 }
 
 static Boolean
-EmacsFrameSetValues (cur_widget, req_widget, new_widget, dum1, dum2)
-     Widget cur_widget;
-     Widget req_widget;
-     Widget new_widget;
-     ArgList dum1;
-     Cardinal *dum2;
+EmacsFrameSetValues (Widget cur_widget, Widget req_widget, Widget new_widget, ArgList dum1, Cardinal *dum2)
 {
   EmacsFrame cur = (EmacsFrame)cur_widget;
   EmacsFrame new = (EmacsFrame)new_widget;
@@ -834,10 +794,7 @@ EmacsFrameSetValues (cur_widget, req_widget, new_widget, dum1, dum2)
 }
 
 static XtGeometryResult
-EmacsFrameQueryGeometry (widget, request, result)
-     Widget widget;
-     XtWidgetGeometry* request;
-     XtWidgetGeometry* result;
+EmacsFrameQueryGeometry (Widget widget, XtWidgetGeometry *request, XtWidgetGeometry *result)
 {
   EmacsFrame ew = (EmacsFrame)widget;
 
@@ -867,10 +824,7 @@ EmacsFrameQueryGeometry (widget, request, result)
 
 /* Special entrypoints */
 void
-EmacsFrameSetCharSize (widget, columns, rows)
-     Widget widget;
-     int columns;
-     int rows;
+EmacsFrameSetCharSize (Widget widget, int columns, int rows)
 {
   EmacsFrame ew = (EmacsFrame) widget;
   struct frame *f = ew->emacs_frame.frame;
@@ -880,8 +834,7 @@ EmacsFrameSetCharSize (widget, columns, rows)
 
 \f
 void
-widget_store_internal_border (widget)
-     Widget widget;
+widget_store_internal_border (Widget widget)
 {
   EmacsFrame ew = (EmacsFrame) widget;
   FRAME_PTR f = ew->emacs_frame.frame;
index 00c08914059fe9e2baed17514b90dedfb7cff3c8..a1ddeb2e94fe311f72187d7e3186c5685627ab62 100644 (file)
@@ -94,8 +94,8 @@ extern WidgetClass emacsFrameClass;
 extern struct _DisplayContext* display_context;
 
 /* Special entrypoints */
-void EmacsFrameSetCharSize P_ ((Widget, int, int));
-void widget_store_internal_border P_ ((Widget widget));
+void EmacsFrameSetCharSize (Widget, int, int);
+void widget_store_internal_border (Widget widget);
 
 #endif /* _EmacsFrame_h */
 
index f9a2d31b4fe3347e5540b59c1b9a9cd3c9b7f03a..1fabe72d72df790892a6d5cfeeb87e6f16cc95b6 100644 (file)
@@ -51,40 +51,37 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "nsterm.h"
 #endif
 
-
 Lisp_Object Qwindowp, Qwindow_live_p, Qwindow_configuration_p;
 Lisp_Object Qdisplay_buffer;
-Lisp_Object Qscroll_up, Qscroll_down;
+Lisp_Object Qscroll_up, Qscroll_down, Qscroll_command;
 Lisp_Object Qwindow_size_fixed;
 
-extern Lisp_Object Qleft_margin, Qright_margin;
-
-static int displayed_window_lines P_ ((struct window *));
-static struct window *decode_window P_ ((Lisp_Object));
-static int count_windows P_ ((struct window *));
-static int get_leaf_windows P_ ((struct window *, struct window **, int));
-static void window_scroll P_ ((Lisp_Object, int, int, int));
-static void window_scroll_pixel_based P_ ((Lisp_Object, int, int, int));
-static void window_scroll_line_based P_ ((Lisp_Object, int, int, int));
-static int window_min_size_1 P_ ((struct window *, int, int));
-static int window_min_size_2 P_ ((struct window *, int, int));
-static int window_min_size P_ ((struct window *, int, int, int, int *));
-static void size_window P_ ((Lisp_Object, int, int, int, int, int));
-static int freeze_window_start P_ ((struct window *, void *));
-static int window_fixed_size_p P_ ((struct window *, int, int));
-static void enlarge_window P_ ((Lisp_Object, int, int));
-static Lisp_Object window_list P_ ((void));
-static int add_window_to_list P_ ((struct window *, void *));
-static int candidate_window_p P_ ((Lisp_Object, Lisp_Object, Lisp_Object,
-                                  Lisp_Object));
-static Lisp_Object next_window P_ ((Lisp_Object, Lisp_Object,
-                                   Lisp_Object, int));
-static void decode_next_window_args P_ ((Lisp_Object *, Lisp_Object *,
-                                        Lisp_Object *));
-static int foreach_window_1 P_ ((struct window *,
-                                int (* fn) (struct window *, void *),
-                                void *));
-static Lisp_Object window_list_1 P_ ((Lisp_Object, Lisp_Object, Lisp_Object));
+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_pixel_based (Lisp_Object, int, int, int);
+static void window_scroll_line_based (Lisp_Object, int, int, int);
+static int window_min_size_1 (struct window *, int, int);
+static int window_min_size_2 (struct window *, int, int);
+static int window_min_size (struct window *, int, int, int, int *);
+static void size_window (Lisp_Object, int, int, int, int, int);
+static int freeze_window_start (struct window *, void *);
+static int window_fixed_size_p (struct window *, int, int);
+static void enlarge_window (Lisp_Object, int, int);
+static Lisp_Object window_list (void);
+static int add_window_to_list (struct window *, void *);
+static int candidate_window_p (Lisp_Object, Lisp_Object, Lisp_Object,
+                               Lisp_Object);
+static Lisp_Object next_window (Lisp_Object, Lisp_Object,
+                                Lisp_Object, int);
+static void decode_next_window_args (Lisp_Object *, Lisp_Object *,
+                                     Lisp_Object *);
+static int foreach_window_1 (struct window *,
+                             int (* fn) (struct window *, void *),
+                             void *);
+static Lisp_Object window_list_1 (Lisp_Object, Lisp_Object, Lisp_Object);
 
 /* This is the window in which the terminal's cursor should
    be left when nothing is being done with it.  This must
@@ -191,36 +188,29 @@ static int window_scroll_preserve_vpos;
 static int inhibit_frame_unsplittable;
 #endif /* 0 */
 
-extern EMACS_INT scroll_margin;
-
-extern Lisp_Object Qwindow_scroll_functions, Vwindow_scroll_functions;
-
 /* If non-nil, then the `recenter' command with a nil argument
    the entire frame to be redrawn; the special value `tty' causes the
    frame to be redrawn only if it is a tty frame.  */
 
 static Lisp_Object Vrecenter_redisplay;
-extern Lisp_Object Qtty;
 
 \f
 DEFUN ("windowp", Fwindowp, Swindowp, 1, 1, 0,
        doc: /* Return t if OBJECT is a window.  */)
-     (object)
-     Lisp_Object object;
+  (Lisp_Object object)
 {
   return WINDOWP (object) ? Qt : Qnil;
 }
 
 DEFUN ("window-live-p", Fwindow_live_p, Swindow_live_p, 1, 1, 0,
        doc: /* Return t if OBJECT is a window which is currently visible.  */)
-     (object)
-     Lisp_Object object;
+  (Lisp_Object object)
 {
   return WINDOW_LIVE_P (object) ? Qt : Qnil;
 }
 
 Lisp_Object
-make_window ()
+make_window (void)
 {
   Lisp_Object val;
   register struct window *p;
@@ -243,9 +233,9 @@ make_window ()
   p->dedicated = Qnil;
   p->window_parameters = Qnil;
   p->pseudo_window_p = 0;
-  bzero (&p->cursor, sizeof (p->cursor));
-  bzero (&p->last_cursor, sizeof (p->last_cursor));
-  bzero (&p->phys_cursor, sizeof (p->phys_cursor));
+  memset (&p->cursor, 0, sizeof (p->cursor));
+  memset (&p->last_cursor, 0, sizeof (p->last_cursor));
+  memset (&p->phys_cursor, 0, sizeof (p->phys_cursor));
   p->desired_matrix = p->current_matrix = 0;
   p->nrows_scale_factor = p->ncols_scale_factor = 1;
   p->phys_cursor_type = -1;
@@ -274,7 +264,7 @@ make_window ()
 
 DEFUN ("selected-window", Fselected_window, Sselected_window, 0, 0, 0,
        doc: /* Return the window that the cursor now appears in and commands apply to.  */)
-     ()
+  (void)
 {
   return selected_window;
 }
@@ -283,8 +273,7 @@ DEFUN ("minibuffer-window", Fminibuffer_window, Sminibuffer_window, 0, 1, 0,
        doc: /* Return the window used now for minibuffers.
 If the optional argument FRAME is specified, return the minibuffer window
 used by that frame.  */)
-     (frame)
-    Lisp_Object frame;
+  (Lisp_Object frame)
 {
   if (NILP (frame))
     frame = selected_frame;
@@ -295,8 +284,7 @@ used by that frame.  */)
 DEFUN ("window-minibuffer-p", Fwindow_minibuffer_p, Swindow_minibuffer_p, 0, 1, 0,
        doc: /* Return non-nil if WINDOW is a minibuffer window.
 WINDOW defaults to the selected window.  */)
-     (window)
-     Lisp_Object window;
+  (Lisp_Object window)
 {
   struct window *w = decode_window (window);
   return MINI_WINDOW_P (w) ? Qt : Qnil;
@@ -320,8 +308,7 @@ of the window.  The remaining elements are omitted if the character after
 POS is fully visible; otherwise, RTOP and RBOT are the number of pixels
 off-window at the top and bottom of the row, ROWH is the height of the
 display row, and VPOS is the row number (0-based) containing POS.  */)
-     (pos, window, partially)
-     Lisp_Object pos, window, partially;
+  (Lisp_Object pos, Lisp_Object window, Lisp_Object partially)
 {
   register struct window *w;
   register int posint;
@@ -389,8 +376,7 @@ of the (first) text line, YPOS is negative.
 
 Return nil if window display is not up-to-date.  In that case, use
 `pos-visible-in-window-p' to obtain the information.  */)
-     (line, window)
-     Lisp_Object line, window;
+  (Lisp_Object line, Lisp_Object window)
 {
   register struct window *w;
   register struct buffer *b;
@@ -483,8 +469,7 @@ Return nil if window display is not up-to-date.  In that case, use
 
 \f
 static struct window *
-decode_window (window)
-     register Lisp_Object window;
+decode_window (register Lisp_Object window)
 {
   if (NILP (window))
     return XWINDOW (selected_window);
@@ -494,8 +479,7 @@ decode_window (window)
 }
 
 static struct window *
-decode_any_window (window)
-     register Lisp_Object window;
+decode_any_window (register Lisp_Object window)
 {
   if (NILP (window))
     return XWINDOW (selected_window);
@@ -507,8 +491,7 @@ decode_any_window (window)
 DEFUN ("window-buffer", Fwindow_buffer, Swindow_buffer, 0, 1, 0,
        doc: /* Return the buffer that WINDOW is displaying.
 WINDOW defaults to the selected window.  */)
-     (window)
-     Lisp_Object window;
+  (Lisp_Object window)
 {
   return decode_window (window)->buffer;
 }
@@ -521,8 +504,7 @@ The return value includes WINDOW's mode line and header line, if any.
 
 Note: The function does not take into account the value of `line-spacing'
 when calculating the number of lines in WINDOW.  */)
-     (window)
-     Lisp_Object window;
+  (Lisp_Object window)
 {
   return decode_any_window (window)->total_lines;
 }
@@ -534,8 +516,7 @@ WINDOW defaults to the selected window.
 Note: The return value is the number of columns available for text in
 WINDOW.  If you want to find out how many columns WINDOW takes up, use
 (let ((edges (window-edges))) (- (nth 2 edges) (nth 0 edges))).  */)
-     (window)
-     Lisp_Object window;
+  (Lisp_Object window)
 {
   return make_number (window_box_text_cols (decode_any_window (window)));
 }
@@ -543,8 +524,7 @@ WINDOW.  If you want to find out how many columns WINDOW takes up, use
 DEFUN ("window-full-width-p", Fwindow_full_width_p, Swindow_full_width_p, 0, 1, 0,
        doc: /* Return t if WINDOW is as wide as its frame.
 WINDOW defaults to the selected window.  */)
-     (window)
-     Lisp_Object window;
+  (Lisp_Object window)
 {
   return WINDOW_FULL_WIDTH_P (decode_any_window (window)) ? Qt : Qnil;
 }
@@ -552,8 +532,7 @@ WINDOW defaults to the selected window.  */)
 DEFUN ("window-hscroll", Fwindow_hscroll, Swindow_hscroll, 0, 1, 0,
        doc: /* Return the number of columns by which WINDOW is scrolled from left margin.
 WINDOW defaults to the selected window.  */)
-     (window)
-     Lisp_Object window;
+  (Lisp_Object window)
 {
   return decode_window (window)->hscroll;
 }
@@ -564,8 +543,7 @@ Return NCOL.  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.  */)
-     (window, ncol)
-     Lisp_Object window, ncol;
+  (Lisp_Object window, Lisp_Object ncol)
 {
   struct window *w = decode_window (window);
   int hscroll;
@@ -586,8 +564,7 @@ DEFUN ("window-redisplay-end-trigger", Fwindow_redisplay_end_trigger,
        doc: /* Return WINDOW's redisplay end trigger value.
 WINDOW defaults to the selected window.
 See `set-window-redisplay-end-trigger' for more information.  */)
-     (window)
-     Lisp_Object window;
+  (Lisp_Object window)
 {
   return decode_window (window)->redisplay_end_trigger;
 }
@@ -600,8 +577,7 @@ If it is a buffer position, then if redisplay in WINDOW reaches a position
 beyond VALUE, the functions in `redisplay-end-trigger-functions' are called
 with two arguments: WINDOW, and the end trigger value.
 Afterwards the end-trigger value is reset to nil.  */)
-     (window, value)
-     register Lisp_Object window, value;
+  (register Lisp_Object window, Lisp_Object value)
 {
   register struct window *w;
 
@@ -621,8 +597,7 @@ BOTTOM is one more than the bottommost row occupied by WINDOW.
 The edges include the space used by WINDOW's scroll bar, display
 margins, fringes, header line, and/or mode line.  For the edges of
 just the text area, use `window-inside-edges'.  */)
-     (window)
-     Lisp_Object window;
+  (Lisp_Object window)
 {
   register struct window *w = decode_any_window (window);
 
@@ -643,8 +618,7 @@ BOTTOM is one more than the bottommost y position occupied by WINDOW.
 The pixel edges include the space used by WINDOW's scroll bar, display
 margins, fringes, header line, and/or mode line.  For the pixel edges
 of just the text area, use `window-inside-pixel-edges'.  */)
-     (window)
-     Lisp_Object window;
+  (Lisp_Object window)
 {
   register struct window *w = decode_any_window (window);
 
@@ -655,6 +629,52 @@ of just the text area, use `window-inside-pixel-edges'.  */)
                Qnil))));
 }
 
+static void
+calc_absolute_offset(struct window *w, int *add_x, int *add_y)
+{
+  struct frame *f = XFRAME (w->frame);
+  *add_y = f->top_pos;
+#ifdef FRAME_MENUBAR_HEIGHT
+  *add_y += FRAME_MENUBAR_HEIGHT (f);
+#endif
+#ifdef FRAME_TOOLBAR_TOP_HEIGHT
+  *add_y += FRAME_TOOLBAR_TOP_HEIGHT (f);
+#elif FRAME_TOOLBAR_HEIGHT
+  *add_y += FRAME_TOOLBAR_HEIGHT (f);
+#endif
+#ifdef FRAME_NS_TITLEBAR_HEIGHT
+  *add_y += FRAME_NS_TITLEBAR_HEIGHT (f);
+#endif
+  *add_x = f->left_pos;
+#ifdef FRAME_TOOLBAR_LEFT_WIDTH
+  *add_x += FRAME_TOOLBAR_LEFT_WIDTH (f);
+#endif
+}
+
+DEFUN ("window-absolute-pixel-edges", Fwindow_absolute_pixel_edges,
+       Swindow_absolute_pixel_edges, 0, 1, 0,
+       doc: /* Return a list of the edge pixel coordinates of WINDOW.
+The list has the form (LEFT TOP RIGHT BOTTOM), all relative to 0, 0 at
+the top left corner of the display.
+
+RIGHT is one more than the rightmost x position occupied by WINDOW.
+BOTTOM is one more than the bottommost y position occupied by WINDOW.
+The pixel edges include the space used by WINDOW's scroll bar, display
+margins, fringes, header line, and/or mode line.  For the pixel edges
+of just the text area, use `window-inside-absolute-pixel-edges'.  */)
+  (Lisp_Object window)
+{
+  register struct window *w = decode_any_window (window);
+  int add_x, add_y;
+  calc_absolute_offset (w, &add_x, &add_y);
+
+  return Fcons (make_number (WINDOW_LEFT_EDGE_X (w) + add_x),
+         Fcons (make_number (WINDOW_TOP_EDGE_Y (w) + add_y),
+        Fcons (make_number (WINDOW_RIGHT_EDGE_X (w) + add_x),
+        Fcons (make_number (WINDOW_BOTTOM_EDGE_Y (w) + add_y),
+               Qnil))));
+}
+
 DEFUN ("window-inside-edges", Fwindow_inside_edges, Swindow_inside_edges, 0, 1, 0,
        doc: /* Return a list of the edge coordinates of WINDOW.
 The list has the form (LEFT TOP RIGHT BOTTOM).
@@ -665,8 +685,7 @@ RIGHT is one more than the rightmost column of WINDOW's text area.
 BOTTOM is one more than the bottommost row of WINDOW's text area.
 The inside edges do not include the space used by the WINDOW's scroll
 bar, display margins, fringes, header line, and/or mode line.  */)
-     (window)
-     Lisp_Object window;
+  (Lisp_Object window)
 {
   register struct window *w = decode_any_window (window);
 
@@ -691,8 +710,7 @@ RIGHT is one more than the rightmost x position of WINDOW's text area.
 BOTTOM is one more than the bottommost y position of WINDOW's text area.
 The inside edges do not include the space used by WINDOW's scroll bar,
 display margins, fringes, header line, and/or mode line.  */)
-     (window)
-     Lisp_Object window;
+  (Lisp_Object window)
 {
   register struct window *w = decode_any_window (window);
 
@@ -708,6 +726,35 @@ display margins, fringes, header line, and/or mode line.  */)
                             - WINDOW_MODE_LINE_HEIGHT (w)));
 }
 
+DEFUN ("window-inside-absolute-pixel-edges",
+       Fwindow_inside_absolute_pixel_edges,
+       Swindow_inside_absolute_pixel_edges, 0, 1, 0,
+       doc: /* Return a list of the edge pixel coordinates of WINDOW.
+The list has the form (LEFT TOP RIGHT BOTTOM), all relative to 0, 0 at
+the top left corner of the display.
+
+RIGHT is one more than the rightmost x position of WINDOW's text area.
+BOTTOM is one more than the bottommost y position of WINDOW's text area.
+The inside edges do not include the space used by WINDOW's scroll bar,
+display margins, fringes, header line, and/or mode line.  */)
+  (Lisp_Object window)
+{
+  register struct window *w = decode_any_window (window);
+  int add_x, add_y;
+  calc_absolute_offset (w, &add_x, &add_y);
+
+  return list4 (make_number (WINDOW_BOX_LEFT_EDGE_X (w)
+                            + WINDOW_LEFT_MARGIN_WIDTH (w)
+                            + WINDOW_LEFT_FRINGE_WIDTH (w) + add_x),
+               make_number (WINDOW_TOP_EDGE_Y (w)
+                            + WINDOW_HEADER_LINE_HEIGHT (w) + add_y),
+               make_number (WINDOW_BOX_RIGHT_EDGE_X (w)
+                            - WINDOW_RIGHT_MARGIN_WIDTH (w)
+                            - WINDOW_RIGHT_FRINGE_WIDTH (w) + add_x),
+               make_number (WINDOW_BOTTOM_EDGE_Y (w)
+                            - WINDOW_MODE_LINE_HEIGHT (w) + add_y));
+}
+
 /* Test if the character at column *X, row *Y is within window W.
    If it is not, return ON_NOTHING;
    if it is in the window's text area,
@@ -730,9 +777,7 @@ display margins, fringes, header line, and/or mode line.  */)
    X and Y are frame relative pixel coordinates.  */
 
 static enum window_part
-coordinates_in_window (w, x, y)
-     register struct window *w;
-     register int *x, *y;
+coordinates_in_window (register struct window *w, register int *x, register int *y)
 {
   struct frame *f = XFRAME (WINDOW_FRAME (w));
   int left_x, right_x, top_y, bottom_y;
@@ -937,8 +982,7 @@ If they are on the border between WINDOW and its right sibling,
   `vertical-line' is returned.
 If they are in the windows's left or right marginal areas, `left-margin'\n\
   or `right-margin' is returned.  */)
-     (coordinates, window)
-     register Lisp_Object coordinates, window;
+  (register Lisp_Object coordinates, Lisp_Object window)
 {
   struct window *w;
   struct frame *f;
@@ -1015,9 +1059,7 @@ struct check_window_data
 };
 
 static int
-check_window_containing (w, user_data)
-     struct window *w;
-     void *user_data;
+check_window_containing (struct window *w, void *user_data)
 {
   struct check_window_data *cw = (struct check_window_data *) user_data;
   enum window_part found;
@@ -1055,12 +1097,7 @@ check_window_containing (w, user_data)
    case.  */
 
 Lisp_Object
-window_from_coordinates (f, x, y, part, wx, wy, tool_bar_p)
-     struct frame *f;
-     int x, y;
-     enum window_part *part;
-     int *wx, *wy;
-     int tool_bar_p;
+window_from_coordinates (struct frame *f, int x, int y, enum window_part *part, int *wx, int *wy, int tool_bar_p)
 {
   Lisp_Object window;
   struct check_window_data cw;
@@ -1097,8 +1134,7 @@ DEFUN ("window-at", Fwindow_at, Swindow_at, 2, 3, 0,
 If omitted, FRAME defaults to the currently selected frame.
 The top left corner of the frame is considered to be row 0,
 column 0.  */)
-     (x, y, frame)
-     Lisp_Object x, y, frame;
+  (Lisp_Object x, Lisp_Object y, Lisp_Object frame)
 {
   struct frame *f;
 
@@ -1131,8 +1167,7 @@ is also currently selected, the value returned is the same as (point).
 It would be more strictly correct to return the `top-level' value
 of point, outside of any save-excursion forms.
 But that is hard to define.  */)
-     (window)
-     Lisp_Object window;
+  (Lisp_Object window)
 {
   register struct window *w = decode_window (window);
 
@@ -1146,8 +1181,7 @@ DEFUN ("window-start", Fwindow_start, Swindow_start, 0, 1, 0,
        doc: /* Return position at which display currently starts in WINDOW.
 WINDOW defaults to the selected window.
 This is updated by redisplay or by calling `set-window-start'.  */)
-     (window)
-     Lisp_Object window;
+  (Lisp_Object window)
 {
   return Fmarker_position (decode_window (window)->start);
 }
@@ -1173,8 +1207,7 @@ Return nil if there is no recorded value.  \(This can happen if the
 last redisplay of WINDOW was preempted, and did not finish.)
 If UPDATE is non-nil, compute the up-to-date position
 if it isn't already recorded.  */)
-     (window, update)
-     Lisp_Object window, update;
+  (Lisp_Object window, Lisp_Object update)
 {
   Lisp_Object value;
   struct window *w = decode_window (window);
@@ -1242,8 +1275,7 @@ if it isn't already recorded.  */)
 DEFUN ("set-window-point", Fset_window_point, Sset_window_point, 2, 2, 0,
        doc: /* Make point value in WINDOW be at position POS in WINDOW's buffer.
 Return POS.  */)
-     (window, pos)
-     Lisp_Object window, pos;
+  (Lisp_Object window, Lisp_Object pos)
 {
   register struct window *w = decode_window (window);
 
@@ -1267,8 +1299,7 @@ DEFUN ("set-window-start", Fset_window_start, Sset_window_start, 2, 3, 0,
 WINDOW defaults to the selected window.  Return POS.
 Optional third arg NOFORCE non-nil inhibits next redisplay from
 overriding motion of point in order to display at this exact start.  */)
-     (window, pos, noforce)
-     Lisp_Object window, pos, noforce;
+  (Lisp_Object window, Lisp_Object pos, Lisp_Object noforce)
 {
   register struct window *w = decode_window (window);
 
@@ -1306,8 +1337,7 @@ from displaying another buffer in it.  `get-lru-window' and
 Functions like `set-window-buffer' may change the buffer displayed by a
 window, unless that window is "strongly" dedicated to its buffer, that
 is the value returned by `window-dedicated-p' is t.  */)
-     (window)
-     Lisp_Object window;
+  (Lisp_Object window)
 {
   return decode_window (window)->dedicated;
 }
@@ -1331,8 +1361,7 @@ its buffer.  Functions like `set-window-buffer' may change the buffer
 displayed by a window, unless that window is strongly dedicated to its
 buffer.  If and when `set-window-buffer' displays another buffer in a
 window, it also makes sure that the window is not marked as dedicated.  */)
-     (window, flag)
-     Lisp_Object window, flag;
+  (Lisp_Object window, Lisp_Object flag)
 {
   register struct window *w = decode_window (window);
 
@@ -1346,8 +1375,7 @@ DEFUN ("window-parameters", Fwindow_parameters, Swindow_parameters,
        doc: /* Return the parameters of WINDOW and their values.
 WINDOW defaults to the selected window.  The return value is a list of
 elements of the form (PARAMETER . VALUE). */)
-     (window)
-     Lisp_Object window;
+  (Lisp_Object window)
 {
   return Fcopy_alist (decode_window (window)->window_parameters);
 }
@@ -1356,8 +1384,7 @@ DEFUN ("window-parameter", Fwindow_parameter, Swindow_parameter,
        2, 2, 0,
        doc:  /* Return WINDOW's value for PARAMETER.
 WINDOW defaults to the selected window.  */)
-     (window, parameter)
-     Lisp_Object window, parameter;
+  (Lisp_Object window, Lisp_Object parameter)
 {
   Lisp_Object result;
 
@@ -1369,8 +1396,7 @@ DEFUN ("set-window-parameter", Fset_window_parameter,
        Sset_window_parameter, 3, 3, 0,
        doc: /* Set WINDOW's value of PARAMETER to VALUE.
 WINDOW defaults to the selected window.  Return VALUE.  */)
-     (window, parameter, value)
-     Lisp_Object window, parameter, value;
+  (Lisp_Object window, Lisp_Object parameter, Lisp_Object value)
 {
   register struct window *w = decode_window (window);
   Lisp_Object old_alist_elt;
@@ -1388,8 +1414,7 @@ DEFUN ("window-display-table", Fwindow_display_table, Swindow_display_table,
        0, 1, 0,
        doc: /* Return the display-table that WINDOW is using.
 WINDOW defaults to the selected window.  */)
-     (window)
-     Lisp_Object window;
+  (Lisp_Object window)
 {
   return decode_window (window)->display_table;
 }
@@ -1400,8 +1425,7 @@ WINDOW defaults to the selected window.  */)
    return 0.  */
 
 struct Lisp_Char_Table *
-window_display_table (w)
-     struct window *w;
+window_display_table (struct window *w)
 {
   struct Lisp_Char_Table *dp = NULL;
 
@@ -1422,8 +1446,7 @@ window_display_table (w)
 
 DEFUN ("set-window-display-table", Fset_window_display_table, Sset_window_display_table, 2, 2, 0,
        doc: /* Set WINDOW's display-table to TABLE.  */)
-     (window, table)
-     register Lisp_Object window, table;
+  (register Lisp_Object window, Lisp_Object table)
 {
   register struct window *w;
 
@@ -1435,8 +1458,7 @@ DEFUN ("set-window-display-table", Fset_window_display_table, Sset_window_displa
 /* Record info on buffer window w is displaying
    when it is about to cease to display that buffer.  */
 static void
-unshow_buffer (w)
-     register struct window *w;
+unshow_buffer (register struct window *w)
 {
   Lisp_Object buf;
   struct buffer *b;
@@ -1484,8 +1506,7 @@ unshow_buffer (w)
 
 /* Put replacement into the window structure in place of old. */
 static void
-replace_window (old, replacement)
-     Lisp_Object old, replacement;
+replace_window (Lisp_Object old, Lisp_Object replacement)
 {
   register Lisp_Object tem;
   register struct window *o = XWINDOW (old), *p = XWINDOW (replacement);
@@ -1502,9 +1523,9 @@ replace_window (old, replacement)
   p->total_lines = o->total_lines;
   p->desired_matrix = p->current_matrix = 0;
   p->vscroll = 0;
-  bzero (&p->cursor, sizeof (p->cursor));
-  bzero (&p->last_cursor, sizeof (p->last_cursor));
-  bzero (&p->phys_cursor, sizeof (p->phys_cursor));
+  memset (&p->cursor, 0, sizeof (p->cursor));
+  memset (&p->last_cursor, 0, sizeof (p->last_cursor));
+  memset (&p->phys_cursor, 0, sizeof (p->phys_cursor));
   p->phys_cursor_type = -1;
   p->phys_cursor_width = -1;
   p->must_be_updated_p = 0;
@@ -1541,8 +1562,7 @@ DEFUN ("delete-window", Fdelete_window, Sdelete_window, 0, 1, "",
        doc: /* Remove WINDOW from its frame.
 WINDOW defaults to the selected window.  Return nil.
 Signal an error when WINDOW is the only window on its frame.  */)
-     (window)
-     register Lisp_Object window;
+  (register Lisp_Object window)
 {
   struct frame *f;
   if (NILP (window))
@@ -1559,8 +1579,7 @@ Signal an error when WINDOW is the only window on its frame.  */)
 }
 
 void
-delete_window (window)
-     register Lisp_Object window;
+delete_window (register Lisp_Object window)
 {
   register Lisp_Object tem, parent, sib;
   register struct window *p;
@@ -1774,9 +1793,7 @@ delete_window (window)
    function window_list.  */
 
 static int
-add_window_to_list (w, user_data)
-     struct window *w;
-     void *user_data;
+add_window_to_list (struct window *w, void *user_data)
 {
   Lisp_Object *list = (Lisp_Object *) user_data;
   Lisp_Object window;
@@ -1791,7 +1808,7 @@ add_window_to_list (w, user_data)
    list, cache it in Vwindow_list, and return that.  */
 
 static Lisp_Object
-window_list ()
+window_list (void)
 {
   if (!CONSP (Vwindow_list))
     {
@@ -1832,8 +1849,7 @@ window_list ()
                a frame means consider windows on that frame, only.  */
 
 static int
-candidate_window_p (window, owindow, minibuf, all_frames)
-     Lisp_Object window, owindow, minibuf, all_frames;
+candidate_window_p (Lisp_Object window, Lisp_Object owindow, Lisp_Object minibuf, Lisp_Object all_frames)
 {
   struct window *w = XWINDOW (window);
   struct frame *f = XFRAME (w->frame);
@@ -1898,8 +1914,7 @@ candidate_window_p (window, owindow, minibuf, all_frames)
    ALL_FRAMES.  */
 
 static void
-decode_next_window_args (window, minibuf, all_frames)
-     Lisp_Object *window, *minibuf, *all_frames;
+decode_next_window_args (Lisp_Object *window, Lisp_Object *minibuf, Lisp_Object *all_frames)
 {
   if (NILP (*window))
     *window = selected_window;
@@ -1945,9 +1960,7 @@ decode_next_window_args (window, minibuf, all_frames)
    ALL_FRAMES.  */
 
 static Lisp_Object
-next_window (window, minibuf, all_frames, next_p)
-     Lisp_Object window, minibuf, all_frames;
-     int next_p;
+next_window (Lisp_Object window, Lisp_Object minibuf, Lisp_Object all_frames, int next_p)
 {
   decode_next_window_args (&window, &minibuf, &all_frames);
 
@@ -2046,8 +2059,7 @@ If you use consistent values for MINIBUF and ALL-FRAMES, you can use
 `next-window' to iterate through the entire cycle of acceptable
 windows, eventually ending up back at the window you started with.
 `previous-window' traverses the same cycle, in the reverse order.  */)
-     (window, minibuf, all_frames)
-     Lisp_Object window, minibuf, all_frames;
+  (Lisp_Object window, Lisp_Object minibuf, Lisp_Object all_frames)
 {
   return next_window (window, minibuf, all_frames, 1);
 }
@@ -2064,8 +2076,7 @@ use `previous-window' to iterate through the entire cycle of
 acceptable windows, eventually ending up back at the window you
 started with.  `next-window' traverses the same cycle, in the
 reverse order.  */)
-     (window, minibuf, all_frames)
-     Lisp_Object window, minibuf, all_frames;
+  (Lisp_Object window, Lisp_Object minibuf, Lisp_Object all_frames)
 {
   return next_window (window, minibuf, all_frames, 0);
 }
@@ -2084,8 +2095,7 @@ This function uses `next-window' for finding the window to select.
 The argument ALL-FRAMES has the same meaning as in `next-window',
 but the MINIBUF argument of `next-window' is always effectively
 nil.  */)
-     (count, all_frames)
-     Lisp_Object count, all_frames;
+  (Lisp_Object count, Lisp_Object all_frames)
 {
   Lisp_Object window;
   int i;
@@ -2111,8 +2121,7 @@ MINIBUF t means include the minibuffer window, even if it isn't active.
 MINIBUF nil or omitted means include the minibuffer window only
 if it's active.
 MINIBUF neither nil nor t means never include the minibuffer window.  */)
-     (frame, minibuf, window)
-     Lisp_Object frame, minibuf, window;
+  (Lisp_Object frame, Lisp_Object minibuf, Lisp_Object window)
 {
   if (NILP (window))
     window = FRAMEP (frame) ? XFRAME (frame)->selected_window : selected_window;
@@ -2131,8 +2140,7 @@ MINIBUF neither nil nor t means never include the minibuffer window.  */)
    for `next-window'.  */
 
 static Lisp_Object
-window_list_1 (window, minibuf, all_frames)
-     Lisp_Object window, minibuf, all_frames;
+window_list_1 (Lisp_Object window, Lisp_Object minibuf, Lisp_Object all_frames)
 {
   Lisp_Object tail, list, rest;
 
@@ -2180,10 +2188,7 @@ enum window_loop
 };
 
 static Lisp_Object
-window_loop (type, obj, mini, frames)
-     enum window_loop type;
-     Lisp_Object obj, frames;
-     int mini;
+window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frames)
 {
   Lisp_Object window, windows, best_window, frame_arg;
   struct frame *f;
@@ -2410,7 +2415,7 @@ window_loop (type, obj, mini, frames)
 /* Used for debugging.  Abort if any window has a dead buffer.  */
 
 void
-check_all_windows ()
+check_all_windows (void)
 {
   window_loop (CHECK_ALL_WINDOWS, Qnil, 1, Qt);
 }
@@ -2428,8 +2433,7 @@ If FRAME is 0, search all visible and iconified frames.
 If FRAME is t, search all frames.
 If FRAME is nil, search only the selected frame.
 If FRAME is a frame, search only that frame.  */)
-  (frame, dedicated)
-     Lisp_Object frame, dedicated;
+  (Lisp_Object frame, Lisp_Object dedicated)
 {
   register Lisp_Object w;
   /* First try for a window that is full-width */
@@ -2454,8 +2458,7 @@ If FRAME is 0, search all visible and iconified frames.
 If FRAME is t, search all frames.
 If FRAME is nil, search only the selected frame.
 If FRAME is a frame, search only that frame.  */)
-    (frame, dedicated)
-     Lisp_Object frame, dedicated;
+  (Lisp_Object frame, Lisp_Object dedicated)
 {
   return window_loop (GET_LARGEST_WINDOW, dedicated, 0,
                      frame);
@@ -2470,8 +2473,7 @@ If optional argument FRAME is 0, search all visible and iconified frames.
 If FRAME is t, search all frames.
 If FRAME is nil, search only the selected frame.
 If FRAME is a frame, search only that frame.  */)
-     (buffer_or_name, frame)
-     Lisp_Object buffer_or_name, frame;
+  (Lisp_Object buffer_or_name, Lisp_Object frame)
 {
   Lisp_Object buffer;
 
@@ -2495,8 +2497,7 @@ previously visible in WINDOW in the same place on the frame.  Doing this
 depends on the value of (window-start WINDOW), so if calling this
 function in a program gives strange scrolling, make sure the
 window-start value is reasonable when this function is called.  */)
-     (window)
-     Lisp_Object window;
+  (Lisp_Object window)
 {
   struct window *w;
   int startpos;
@@ -2563,8 +2564,7 @@ If FRAME is t, search only the selected frame.
 If FRAME is a frame, search only that frame.
 When a window showing BUFFER-OR-NAME is dedicated and the only window of
 its frame, that frame is deleted when there are other frames left.  */)
-     (buffer_or_name, frame)
-     Lisp_Object buffer_or_name, frame;
+  (Lisp_Object buffer_or_name, Lisp_Object frame)
 {
   Lisp_Object buffer;
 
@@ -2599,8 +2599,7 @@ When a window showing BUFFER-OR-NAME is dedicated that window is
 deleted.  If that window is the only window on its frame, that frame is
 deleted too when there are other frames left.  If there are no other
 frames left, some other buffer is displayed in that window.  */)
-     (buffer_or_name)
-     Lisp_Object buffer_or_name;
+  (Lisp_Object buffer_or_name)
 {
   Lisp_Object buffer;
 
@@ -2621,8 +2620,7 @@ frames left, some other buffer is displayed in that window.  */)
    of all frames, even those on other keyboards.  */
 
 void
-replace_buffer_in_all_windows (buffer)
-     Lisp_Object buffer;
+replace_buffer_in_all_windows (Lisp_Object buffer)
 {
   Lisp_Object tail, frame;
 
@@ -2651,9 +2649,7 @@ replace_buffer_in_all_windows (buffer)
    minimum allowable size.  */
 
 void
-check_frame_size (frame, rows, cols)
-     FRAME_PTR frame;
-     int *rows, *cols;
+check_frame_size (FRAME_PTR frame, int *rows, int *cols)
 {
   /* For height, we have to see:
      how many windows the frame has at minimum (one or two),
@@ -2679,9 +2675,7 @@ check_frame_size (frame, rows, cols)
    either.  */
 
 static int
-window_fixed_size_p (w, width_p, check_siblings_p)
-     struct window *w;
-     int width_p, check_siblings_p;
+window_fixed_size_p (struct window *w, int width_p, int check_siblings_p)
 {
   int fixed_p;
   struct window *c;
@@ -2781,9 +2775,7 @@ window_fixed_size_p (w, width_p, check_siblings_p)
    minibuffer window, always return 1.  */
 
 static int
-window_min_size_2 (w, width_p, safe_p)
-     struct window *w;
-     int width_p, safe_p;
+window_min_size_2 (struct window *w, int width_p, int safe_p)
 {
   /* We should consider buffer-local values of window_min_height and
      window_min_width here.  */
@@ -2817,9 +2809,7 @@ window_min_size_2 (w, width_p, safe_p)
    sizes of W's children.  */
 
 static int
-window_min_size_1 (w, width_p, safe_p)
-     struct window *w;
-     int width_p, safe_p;
+window_min_size_1 (struct window *w, int width_p, int safe_p)
 {
   struct window *c;
   int size;
@@ -2894,9 +2884,7 @@ window_min_size_1 (w, width_p, safe_p)
    to 1 if W is fixed-size unless FIXED is null.  */
 
 static int
-window_min_size (w, width_p, safe_p, ignore_fixed_p, fixed)
-     struct window *w;
-     int width_p, safe_p, ignore_fixed_p, *fixed;
+window_min_size (struct window *w, int width_p, int safe_p, int ignore_fixed_p, int *fixed)
 {
   int size, fixed_p;
 
@@ -2922,8 +2910,7 @@ window_min_size (w, width_p, safe_p, ignore_fixed_p, fixed)
    is still too narrow.  */
 
 static int
-adjust_window_margins (w)
-     struct window *w;
+adjust_window_margins (struct window *w)
 {
   int box_cols = (WINDOW_TOTAL_COLS (w)
                  - WINDOW_FRINGE_COLS (w)
@@ -2977,11 +2964,8 @@ adjust_window_margins (w)
    a specific window, it will attempt to strictly resize that window
    proportionally, even at the expense of deleting smaller windows.  */
 static int *
-shrink_windows (total, size, nchildren, shrinkable, resize_fixed_p,
-               forward, width_p, safe_p)
-     int total, size, nchildren, shrinkable;
-     int resize_fixed_p, width_p, safe_p;
-     Lisp_Object forward;
+shrink_windows (int total, int size, int nchildren, int shrinkable,
+               int resize_fixed_p, Lisp_Object forward, int width_p, int safe_p)
 {
   int available_resize = 0;
   int *new_sizes, *min_sizes;
@@ -3121,10 +3105,7 @@ shrink_windows (total, size, nchildren, shrinkable, resize_fixed_p,
    This should give better behavior when resizing frames.  */
 
 static void
-size_window (window, size, width_p, nodelete_p, first_only, last_only)
-     Lisp_Object window;
-     int size, width_p, nodelete_p;
-     int first_only, last_only;
+size_window (Lisp_Object window, int size, int width_p, int nodelete_p, int first_only, int last_only)
 {
   struct window *w = XWINDOW (window);
   struct window *c;
@@ -3315,10 +3296,7 @@ size_window (window, size, width_p, nodelete_p, first_only, last_only)
    displayed correctly.  */
 
 void
-set_window_height (window, height, nodelete)
-     Lisp_Object window;
-     int height;
-     int nodelete;
+set_window_height (Lisp_Object window, int height, int nodelete)
 {
   size_window (window, height, 0, nodelete, 0, 0);
 }
@@ -3332,10 +3310,7 @@ set_window_height (window, height, nodelete)
    displayed correctly.  */
 
 void
-set_window_width (window, width, nodelete)
-     Lisp_Object window;
-     int width;
-     int nodelete;
+set_window_width (Lisp_Object window, int width, int nodelete)
 {
   size_window (window, width, 1, nodelete, 0, 0);
 }
@@ -3343,9 +3318,7 @@ set_window_width (window, width, nodelete)
 /* Change window heights in windows rooted in WINDOW by N lines.  */
 
 void
-change_window_heights (window, n)
-     Lisp_Object window;
-     int n;
+change_window_heights (Lisp_Object window, int n)
 {
   struct window *w = XWINDOW (window);
 
@@ -3441,9 +3414,7 @@ run_window_configuration_change_hook (struct frame *f)
    reset from the buffer's local settings.  */
 
 void
-set_window_buffer (window, buffer, run_hooks_p, keep_margins_p)
-     Lisp_Object window, buffer;
-     int run_hooks_p, keep_margins_p;
+set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int keep_margins_p)
 {
   struct window *w = XWINDOW (window);
   struct buffer *b = XBUFFER (buffer);
@@ -3465,7 +3436,7 @@ set_window_buffer (window, buffer, run_hooks_p, keep_margins_p)
 
   XSETFASTINT (w->window_end_pos, 0);
   XSETFASTINT (w->window_end_vpos, 0);
-  bzero (&w->last_cursor, sizeof w->last_cursor);
+  memset (&w->last_cursor, 0, sizeof w->last_cursor);
   w->window_end_valid = Qnil;
   if (!(keep_margins_p && samebuf))
     { /* If we're not actually changing the buffer, don't reset hscroll and
@@ -3554,8 +3525,7 @@ already display BUFFER-OR-NAME.
 
 This function runs `window-scroll-functions' before running
 `window-configuration-change-hook'.  */)
-     (window, buffer_or_name, keep_margins)
-     register Lisp_Object window, buffer_or_name, keep_margins;
+  (register Lisp_Object window, Lisp_Object buffer_or_name, Lisp_Object keep_margins)
 {
   register Lisp_Object tem, buffer;
   register struct window *w = decode_window (window);
@@ -3598,8 +3568,7 @@ make this window the most recently selected one.
 
 Note that the main editor command loop selects the buffer of the
 selected window before each command.  */)
-     (window, norecord)
-     register Lisp_Object window, norecord;
+  (register Lisp_Object window, Lisp_Object norecord)
 {
   register struct window *w;
   register struct window *ow;
@@ -3614,6 +3583,7 @@ selected window before each command.  */)
     {
       ++window_select_count;
       XSETFASTINT (w->use_time, window_select_count);
+      record_buffer (w->buffer);
     }
 
   if (EQ (window, selected_window))
@@ -3649,8 +3619,6 @@ selected window before each command.  */)
 
   selected_window = window;
 
-  if (NILP (norecord))
-    record_buffer (w->buffer);
   Fset_buffer (w->buffer);
 
   XBUFFER (w->buffer)->last_selected_window = window;
@@ -3675,24 +3643,21 @@ selected window before each command.  */)
 }
 
 static Lisp_Object
-select_window_norecord (window)
-     Lisp_Object window;
+select_window_norecord (Lisp_Object window)
 {
   return WINDOW_LIVE_P (window)
     ? Fselect_window (window, Qt) : selected_window;
 }
 
 static Lisp_Object
-select_frame_norecord (frame)
-     Lisp_Object frame;
+select_frame_norecord (Lisp_Object frame)
 {
   return FRAME_LIVE_P (XFRAME (frame))
     ? Fselect_frame (frame, Qt) : selected_frame;
 }
 \f
 Lisp_Object
-display_buffer (buffer, not_this_window_p, override_frame)
-     Lisp_Object buffer, not_this_window_p, override_frame;
+display_buffer (Lisp_Object buffer, Lisp_Object not_this_window_p, Lisp_Object override_frame)
 {
   return call3 (Qdisplay_buffer, buffer, not_this_window_p, override_frame);
 }
@@ -3703,8 +3668,7 @@ DEFUN ("force-window-update", Fforce_window_update, Sforce_window_update,
 If optional arg OBJECT is a window, force redisplay of that window only.
 If OBJECT is a buffer or buffer name, force redisplay of all windows
 displaying that buffer.  */)
-     (object)
-     Lisp_Object object;
+  (Lisp_Object object)
 {
   if (NILP (object))
     {
@@ -3743,8 +3707,7 @@ displaying that buffer.  */)
 
 
 void
-temp_output_buffer_show (buf)
-     register Lisp_Object buf;
+temp_output_buffer_show (register Lisp_Object buf)
 {
   register struct buffer *old = current_buffer;
   register Lisp_Object window;
@@ -3804,8 +3767,7 @@ temp_output_buffer_show (buf)
 }
 \f
 static void
-make_dummy_parent (window)
-     Lisp_Object window;
+make_dummy_parent (Lisp_Object window)
 {
   Lisp_Object new;
   register struct window *o, *p;
@@ -3847,8 +3809,7 @@ The upper or leftmost window is the original one, and remains selected
 if it was selected before.
 
 See Info node `(elisp)Splitting Windows' for more details and examples.  */)
-     (window, size, horizontal)
-     Lisp_Object window, size, horizontal;
+  (Lisp_Object window, Lisp_Object size, Lisp_Object horizontal)
 {
   register Lisp_Object new;
   register struct window *o, *p;
@@ -3938,7 +3899,7 @@ See Info node `(elisp)Splitting Windows' for more details and examples.  */)
   p->parent = o->parent;
   p->buffer = Qt;
   p->window_end_valid = Qnil;
-  bzero (&p->last_cursor, sizeof p->last_cursor);
+  memset (&p->last_cursor, 0, sizeof p->last_cursor);
 
   /* Duplicate special geometry settings.  */
 
@@ -3987,8 +3948,7 @@ window wider by SIZE columns.  If SIZE is negative, shrink the window by
 
 This function can delete windows if they get too small.  The size of
 fixed size windows is not altered by this function.  */)
-     (size, horizontal)
-     Lisp_Object size, horizontal;
+  (Lisp_Object size, Lisp_Object horizontal)
 {
   CHECK_NUMBER (size);
   enlarge_window (selected_window, XINT (size), !NILP (horizontal));
@@ -4007,8 +3967,7 @@ window by -SIZE lines or columns.  Return nil.
 
 This function can delete windows if they get too small.  The size of
 fixed size windows is not altered by this function. */)
-     (size, horizontal)
-     Lisp_Object size, horizontal;
+  (Lisp_Object size, Lisp_Object horizontal)
 {
   CHECK_NUMBER (size);
   enlarge_window (selected_window, -XINT (size), !NILP (horizontal));
@@ -4019,16 +3978,14 @@ fixed size windows is not altered by this function. */)
 }
 
 int
-window_height (window)
-     Lisp_Object window;
+window_height (Lisp_Object window)
 {
   register struct window *p = XWINDOW (window);
   return WINDOW_TOTAL_LINES (p);
 }
 
 int
-window_width (window)
-     Lisp_Object window;
+window_width (Lisp_Object window)
 {
   register struct window *p = XWINDOW (window);
   return WINDOW_TOTAL_COLS (p);
@@ -4050,17 +4007,15 @@ window_width (window)
    deleted.  */
 
 static void
-enlarge_window (window, delta, horiz_flag)
-     Lisp_Object window;
-     int delta, horiz_flag;
+enlarge_window (Lisp_Object window, int delta, int horiz_flag)
 {
   Lisp_Object parent, next, prev;
   struct window *p;
   Lisp_Object *sizep;
   int maximum;
-  int (*sizefun) P_ ((Lisp_Object))
+  int (*sizefun) (Lisp_Object)
     = horiz_flag ? window_width : window_height;
-  void (*setsizefun) P_ ((Lisp_Object, int, int))
+  void (*setsizefun) (Lisp_Object, int, int)
     = (horiz_flag ? set_window_width : set_window_height);
 
   /* Give up if this window cannot be resized.  */
@@ -4328,9 +4283,7 @@ enlarge_window (window, delta, horiz_flag)
    are not deleted; instead, we signal an error.  */
 
 static void
-adjust_window_trailing_edge (window, delta, horiz_flag)
-     Lisp_Object window;
-     int delta, horiz_flag;
+adjust_window_trailing_edge (Lisp_Object window, int delta, int horiz_flag)
 {
   Lisp_Object parent, child;
   struct window *p;
@@ -4466,8 +4419,7 @@ Otherwise, adjust the height, moving the bottom edge.
 Following siblings of the selected window are resized to fulfill
 the size request.  If they become too small in the process, they
 are not deleted; instead, we signal an error.  */)
-  (window, delta, horizontal)
-  Lisp_Object window, delta, horizontal;
+  (Lisp_Object window, Lisp_Object delta, Lisp_Object horizontal)
 {
   CHECK_NUMBER (delta);
   if (NILP (window))
@@ -4486,7 +4438,7 @@ are not deleted; instead, we signal an error.  */)
                        Resizing Mini-Windows
  ***********************************************************************/
 
-static void shrink_window_lowest_first P_ ((struct window *, int));
+static void shrink_window_lowest_first (struct window *, int);
 
 enum save_restore_action
 {
@@ -4495,16 +4447,14 @@ enum save_restore_action
     RESTORE_ORIG_SIZES
 };
 
-static int save_restore_orig_size P_ ((struct window *,
-                                       enum save_restore_action));
+static int save_restore_orig_size (struct window *,
+                                   enum save_restore_action);
 
 /* Shrink windows rooted in window W to HEIGHT.  Take the space needed
    from lowest windows first.  */
 
 static void
-shrink_window_lowest_first (w, height)
-     struct window *w;
-     int height;
+shrink_window_lowest_first (struct window *w, int height)
 {
   struct window *c;
   Lisp_Object child;
@@ -4586,9 +4536,7 @@ shrink_window_lowest_first (w, height)
    stored in orig_top_line and orig_total_lines for all windows.  */
 
 static int
-save_restore_orig_size (w, action)
-     struct window *w;
-     enum save_restore_action action;
+save_restore_orig_size (struct window *w, enum save_restore_action action)
 {
   int success_p = 1;
 
@@ -4643,9 +4591,7 @@ save_restore_orig_size (w, action)
    without deleting other windows.  */
 
 void
-grow_mini_window (w, delta)
-     struct window *w;
-     int delta;
+grow_mini_window (struct window *w, int delta)
 {
   struct frame *f = XFRAME (w->frame);
   struct window *root;
@@ -4694,8 +4640,7 @@ grow_mini_window (w, delta)
    line.  */
 
 void
-shrink_mini_window (w)
-     struct window *w;
+shrink_mini_window (struct window *w)
 {
   struct frame *f = XFRAME (w->frame);
   struct window *root = XWINDOW (FRAME_ROOT_WINDOW (f));
@@ -4725,8 +4670,7 @@ shrink_mini_window (w)
    the frame are cleared.  */
 
 void
-mark_window_cursors_off (w)
-     struct window *w;
+mark_window_cursors_off (struct window *w)
 {
   while (w)
     {
@@ -4745,8 +4689,7 @@ mark_window_cursors_off (w)
 /* Return number of lines of text (not counting mode lines) in W.  */
 
 int
-window_internal_height (w)
-     struct window *w;
+window_internal_height (struct window *w)
 {
   int ht = XFASTINT (w->total_lines);
 
@@ -4773,8 +4716,7 @@ window_internal_height (w)
    separating W from the sibling to its right.  */
 
 int
-window_box_text_cols (w)
-     struct window *w;
+window_box_text_cols (struct window *w)
 {
   struct frame *f = XFRAME (WINDOW_FRAME (w));
   int width = XINT (w->total_cols);
@@ -4811,11 +4753,7 @@ window_box_text_cols (w)
    respectively.  */
 
 static void
-window_scroll (window, n, whole, noerror)
-     Lisp_Object window;
-     int n;
-     int whole;
-     int noerror;
+window_scroll (Lisp_Object window, int n, int whole, int noerror)
 {
   immediate_quit = 1;
 
@@ -4835,11 +4773,7 @@ window_scroll (window, n, whole, noerror)
    descriptions.  */
 
 static void
-window_scroll_pixel_based (window, n, whole, noerror)
-     Lisp_Object window;
-     int n;
-     int whole;
-     int noerror;
+window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror)
 {
   struct it it;
   struct window *w = XWINDOW (window);
@@ -4945,12 +4879,13 @@ window_scroll_pixel_based (window, n, whole, noerror)
   if (!NILP (Vscroll_preserve_screen_position))
     {
       /* We preserve the goal pixel coordinate across consecutive
-        calls to scroll-up or scroll-down.  This avoids the
+        calls to scroll-up, scroll-down and other commands that
+        have the `scroll-command' property.  This avoids the
         possibility of point becoming "stuck" on a tall line when
         scrolling by one line.  */
       if (window_scroll_pixel_based_preserve_y < 0
-         || (!EQ (current_kboard->Vlast_command, Qscroll_up)
-             && !EQ (current_kboard->Vlast_command, Qscroll_down)))
+         || !SYMBOLP (current_kboard->Vlast_command)
+         || NILP (Fget (current_kboard->Vlast_command, Qscroll_command)))
        {
          start_display (&it, w, start);
          move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS);
@@ -5184,11 +5119,7 @@ window_scroll_pixel_based (window, n, whole, noerror)
    See the comment of window_scroll for parameter descriptions.  */
 
 static void
-window_scroll_line_based (window, n, whole, noerror)
-     Lisp_Object window;
-     int n;
-     int whole;
-     int noerror;
+window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror)
 {
   register struct window *w = XWINDOW (window);
   register int opoint = PT, opoint_byte = PT_BYTE;
@@ -5210,8 +5141,8 @@ window_scroll_line_based (window, n, whole, noerror)
   if (!NILP (Vscroll_preserve_screen_position))
     {
       if (window_scroll_preserve_vpos <= 0
-         || (!EQ (current_kboard->Vlast_command, Qscroll_up)
-             && !EQ (current_kboard->Vlast_command, Qscroll_down)))
+         || !SYMBOLP (current_kboard->Vlast_command)
+         || NILP (Fget (current_kboard->Vlast_command, Qscroll_command)))
        {
          struct position posit
            = *compute_motion (startpos, 0, 0, 0,
@@ -5346,9 +5277,7 @@ window_scroll_line_based (window, n, whole, noerror)
    up.  This is the guts of Fscroll_up and Fscroll_down.  */
 
 static void
-scroll_command (n, direction)
-     Lisp_Object n;
-     int direction;
+scroll_command (Lisp_Object n, int direction)
 {
   int count = SPECPDL_INDEX ();
 
@@ -5385,8 +5314,7 @@ A near full screen is `next-screen-context-lines' less than a full screen.
 Negative ARG means scroll downward.
 If ARG is the atom `-', scroll downward by nearly full screen.
 When calling from a program, supply as argument a number, nil, or `-'.  */)
-     (arg)
-     Lisp_Object arg;
+  (Lisp_Object arg)
 {
   scroll_command (arg, 1);
   return Qnil;
@@ -5399,8 +5327,7 @@ A near full screen is `next-screen-context-lines' less than a full screen.
 Negative ARG means scroll upward.
 If ARG is the atom `-', scroll upward by nearly full screen.
 When calling from a program, supply as argument a number, nil, or `-'.  */)
-     (arg)
-     Lisp_Object arg;
+  (Lisp_Object arg)
 {
   scroll_command (arg, -1);
   return Qnil;
@@ -5413,7 +5340,7 @@ showing that buffer is used.
 If in the minibuffer, `minibuffer-scroll-window' if non-nil
 specifies the window.  This takes precedence over
 `other-window-scroll-buffer'.  */)
-     ()
+  (void)
 {
   Lisp_Object window;
 
@@ -5463,8 +5390,7 @@ showing that buffer, popping the buffer up if necessary.
 If in the minibuffer, `minibuffer-scroll-window' if non-nil
 specifies the window to scroll.  This takes precedence over
 `other-window-scroll-buffer'.  */)
-     (arg)
-     Lisp_Object arg;
+  (Lisp_Object arg)
 {
   Lisp_Object window;
   struct window *w;
@@ -5507,8 +5433,7 @@ If SET-MINIMUM is non-nil, the new scroll amount becomes the
 lower bound for automatic scrolling, i.e. automatic scrolling
 will not scroll a window to a column less than the value returned
 by this function.  This happens in an interactive call.  */)
-     (arg, set_minimum)
-     register Lisp_Object arg, set_minimum;
+  (register Lisp_Object arg, Lisp_Object set_minimum)
 {
   Lisp_Object result;
   int hscroll;
@@ -5537,8 +5462,7 @@ If SET-MINIMUM is non-nil, the new scroll amount becomes the
 lower bound for automatic scrolling, i.e. automatic scrolling
 will not scroll a window to a column less than the value returned
 by this function.  This happens in an interactive call.  */)
-     (arg, set_minimum)
-     register Lisp_Object arg, set_minimum;
+  (register Lisp_Object arg, Lisp_Object set_minimum)
 {
   Lisp_Object result;
   int hscroll;
@@ -5561,7 +5485,7 @@ by this function.  This happens in an interactive call.  */)
 DEFUN ("minibuffer-selected-window", Fminibuffer_selected_window, Sminibuffer_selected_window, 0, 0, 0,
        doc: /* Return the window which was selected when entering the minibuffer.
 Returns nil, if selected window is not a minibuffer window.  */)
-     ()
+  (void)
 {
   if (minibuf_level > 0
       && MINI_WINDOW_P (XWINDOW (selected_window))
@@ -5575,8 +5499,7 @@ Returns nil, if selected window is not a minibuffer window.  */)
    as opposed to its height.  */
 
 static int
-displayed_window_lines (w)
-     struct window *w;
+displayed_window_lines (struct window *w)
 {
   struct it it;
   struct text_pos start;
@@ -5644,8 +5567,7 @@ then only tty frame are redrawn.
 
 Just C-u as prefix means put point in the center of the window
 and redisplay normally--don't erase and redraw the frame.  */)
-     (arg)
-     register Lisp_Object arg;
+  (register Lisp_Object arg)
 {
   struct window *w = XWINDOW (selected_window);
   struct buffer *buf = XBUFFER (w->buffer);
@@ -5829,8 +5751,7 @@ WINDOW defaults to the selected window.
 
 The return value does not include the mode line, any header line, nor
 any partial-height lines in the text display area.  */)
-     (window)
-     Lisp_Object window;
+  (Lisp_Object window)
 {
   struct window *w = decode_window (window);
   int pixel_height = window_box_height (w);
@@ -5846,8 +5767,7 @@ DEFUN ("move-to-window-line", Fmove_to_window_line, Smove_to_window_line,
 With no argument, position point at center of window.
 An argument specifies vertical position within the window;
 zero means top of window, negative means relative to bottom of window.  */)
-     (arg)
-     Lisp_Object arg;
+  (Lisp_Object arg)
 {
   struct window *w = XWINDOW (selected_window);
   int lines, start;
@@ -5960,16 +5880,14 @@ struct saved_window
 
 DEFUN ("window-configuration-p", Fwindow_configuration_p, Swindow_configuration_p, 1, 1, 0,
        doc: /* Return t if OBJECT is a window-configuration object.  */)
-     (object)
-     Lisp_Object object;
+  (Lisp_Object object)
 {
   return WINDOW_CONFIGURATIONP (object) ? Qt : Qnil;
 }
 
 DEFUN ("window-configuration-frame", Fwindow_configuration_frame, Swindow_configuration_frame, 1, 1, 0,
        doc: /* Return the frame that CONFIG, a window-configuration object, is about.  */)
-     (config)
-     Lisp_Object config;
+  (Lisp_Object config)
 {
   register struct save_window_data *data;
   struct Lisp_Vector *saved_windows;
@@ -5989,8 +5907,7 @@ by `current-window-configuration' (which see).
 If CONFIGURATION was made from a frame that is now deleted,
 only frame-independent values can be restored.  In this case,
 the return value is nil.  Otherwise the value is t.  */)
-     (configuration)
-     Lisp_Object configuration;
+  (Lisp_Object configuration)
 {
   register struct save_window_data *data;
   struct Lisp_Vector *saved_windows;
@@ -6321,8 +6238,7 @@ the return value is nil.  Otherwise the value is t.  */)
    by setting their buffers to nil.  */
 
 void
-delete_all_subwindows (w)
-     register struct window *w;
+delete_all_subwindows (register struct window *w)
 {
   if (!NILP (w->next))
     delete_all_subwindows (XWINDOW (w->next));
@@ -6348,8 +6264,7 @@ delete_all_subwindows (w)
 }
 \f
 static int
-count_windows (window)
-     register struct window *window;
+count_windows (register struct window *window)
 {
   register int count = 1;
   if (!NILP (window->next))
@@ -6366,10 +6281,7 @@ count_windows (window)
    Value is last index + 1.  */
 
 static int
-get_leaf_windows (w, flat, i)
-     struct window *w;
-     struct window **flat;
-     int i;
+get_leaf_windows (struct window *w, struct window **flat, int i)
 {
   while (w)
     {
@@ -6392,8 +6304,7 @@ get_leaf_windows (w, flat, i)
    can be returned.  */
 
 struct glyph *
-get_phys_cursor_glyph (w)
-     struct window *w;
+get_phys_cursor_glyph (struct window *w)
 {
   struct glyph_row *row;
   struct glyph *glyph;
@@ -6412,10 +6323,7 @@ get_phys_cursor_glyph (w)
 
 
 static int
-save_window_save (window, vector, i)
-     Lisp_Object window;
-     struct Lisp_Vector *vector;
-     int i;
+save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i)
 {
   register struct saved_window *p;
   register struct window *w;
@@ -6505,8 +6413,7 @@ point and mark.  An exception is made for point in the current buffer:
 its value is -not- saved.
 This also records the currently selected frame, and FRAME's focus
 redirection (see `redirect-frame-focus').  */)
-     (frame)
-     Lisp_Object frame;
+  (Lisp_Object frame)
 {
   register Lisp_Object tem;
   register int n_windows;
@@ -6554,8 +6461,7 @@ Also restore the choice of selected window.
 Also restore which buffer is current.
 Does not restore the value of point in current buffer.
 usage: (save-window-excursion BODY...)  */)
-     (args)
-     Lisp_Object args;
+  (Lisp_Object args)
 {
   register Lisp_Object val;
   register int count = SPECPDL_INDEX ();
@@ -6573,8 +6479,7 @@ usage: (save-window-excursion BODY...)  */)
  ***********************************************************************/
 
 static Lisp_Object
-window_tree (w)
-     struct window *w;
+window_tree (struct window *w)
 {
   Lisp_Object tail = Qnil;
   Lisp_Object result = Qnil;
@@ -6627,8 +6532,7 @@ EDGES is a list \(LEFT TOP RIGHT BOTTOM) as returned by `window-edges'.
 
 If FRAME is nil or omitted, return information on the currently
 selected frame.  */)
-     (frame)
-     Lisp_Object frame;
+  (Lisp_Object frame)
 {
   FRAME_PTR f;
 
@@ -6657,8 +6561,7 @@ Second arg LEFT-WIDTH specifies the number of character cells to
 reserve for the left marginal area.  Optional third arg RIGHT-WIDTH
 does the same for the right marginal area.  A nil width parameter
 means no margin.  */)
-     (window, left_width, right_width)
-     Lisp_Object window, left_width, right_width;
+  (Lisp_Object window, Lisp_Object left_width, Lisp_Object right_width)
 {
   struct window *w = decode_window (window);
 
@@ -6702,8 +6605,7 @@ If WINDOW is omitted or nil, use the currently selected window.
 Value is a cons of the form (LEFT-WIDTH . RIGHT-WIDTH).
 If a marginal area does not exist, its width will be returned
 as nil.  */)
-     (window)
-     Lisp_Object window;
+  (Lisp_Object window)
 {
   struct window *w = decode_window (window);
   return Fcons (w->left_margin_cols, w->right_margin_cols);
@@ -6728,8 +6630,7 @@ the command `set-fringe-style'.
 If optional fourth arg OUTSIDE-MARGINS is non-nil, draw the fringes
 outside of the display margins.  By default, fringes are drawn between
 display marginal areas and the text area.  */)
-     (window, left_width, right_width, outside_margins)
-     Lisp_Object window, left_width, right_width, outside_margins;
+  (Lisp_Object window, Lisp_Object left_width, Lisp_Object right_width, Lisp_Object outside_margins)
 {
   struct window *w = decode_window (window);
 
@@ -6766,8 +6667,7 @@ DEFUN ("window-fringes", Fwindow_fringes, Swindow_fringes,
        doc: /* Get width of fringes of window WINDOW.
 If WINDOW is omitted or nil, use the currently selected window.
 Value is a list of the form (LEFT-WIDTH RIGHT-WIDTH OUTSIDE-MARGINS).  */)
-     (window)
-     Lisp_Object window;
+  (Lisp_Object window)
 {
   struct window *w = decode_window (window);
 
@@ -6794,8 +6694,7 @@ bar: left, right, or nil.
 If WIDTH is nil, use the frame's scroll-bar width.
 If VERTICAL-TYPE is t, use the frame's scroll-bar type.
 Fourth parameter HORIZONTAL-TYPE is currently unused.  */)
-     (window, width, vertical_type, horizontal_type)
-     Lisp_Object window, width, vertical_type, horizontal_type;
+  (Lisp_Object window, Lisp_Object width, Lisp_Object vertical_type, Lisp_Object horizontal_type)
 {
   struct window *w = decode_window (window);
 
@@ -6839,8 +6738,7 @@ If WINDOW is omitted or nil, use the currently selected window.
 Value is a list of the form (WIDTH COLS VERTICAL-TYPE HORIZONTAL-TYPE).
 If WIDTH is nil or TYPE is t, the window is using the frame's corresponding
 value.  */)
-     (window)
-     Lisp_Object window;
+  (Lisp_Object window)
 {
   struct window *w = decode_window (window);
   return Fcons (make_number ((WINDOW_CONFIG_SCROLL_BAR_WIDTH (w)
@@ -6862,8 +6760,7 @@ DEFUN ("window-vscroll", Fwindow_vscroll, Swindow_vscroll, 0, 2, 0,
 Use the selected window if WINDOW is nil or omitted.
 Normally, value is a multiple of the canonical character height of WINDOW;
 optional second arg PIXELS-P means value is measured in pixels.  */)
-  (window, pixels_p)
-     Lisp_Object window, pixels_p;
+  (Lisp_Object window, Lisp_Object pixels_p)
 {
   Lisp_Object result;
   struct frame *f;
@@ -6896,8 +6793,7 @@ If PIXELS-P is nil, VSCROLL may have to be rounded so that it
 corresponds to an integral number of pixels.  The return value is the
 result of this rounding.
 If PIXELS-P is non-nil, the return value is VSCROLL.  */)
-  (window, vscroll, pixels_p)
-     Lisp_Object window, vscroll, pixels_p;
+  (Lisp_Object window, Lisp_Object vscroll, Lisp_Object pixels_p)
 {
   struct window *w;
   struct frame *f;
@@ -6941,10 +6837,7 @@ If PIXELS-P is non-nil, the return value is VSCROLL.  */)
    additional argument USER_DATA.  Stops when FN returns 0.  */
 
 void
-foreach_window (f, fn, user_data)
-     struct frame *f;
-     int (* fn) P_ ((struct window *, void *));
-     void *user_data;
+foreach_window (struct frame *f, int (*fn) (struct window *, void *), void *user_data)
 {
   /* delete_frame may set FRAME_ROOT_WINDOW (f) to Qnil.  */
   if (WINDOWP (FRAME_ROOT_WINDOW (f)))
@@ -6958,10 +6851,7 @@ foreach_window (f, fn, user_data)
    Stop when FN returns 0.  Value is 0 if stopped by FN.  */
 
 static int
-foreach_window_1 (w, fn, user_data)
-     struct window *w;
-     int (* fn) P_ ((struct window *, void *));
-     void *user_data;
+foreach_window_1 (struct window *w, int (*fn) (struct window *, void *), void *user_data)
 {
   int cont;
 
@@ -6986,9 +6876,7 @@ foreach_window_1 (w, fn, user_data)
    the window start.  */
 
 static int
-freeze_window_start (w, freeze_p)
-     struct window *w;
-     void *freeze_p;
+freeze_window_start (struct window *w, void *freeze_p)
 {
   if (MINI_WINDOW_P (w)
       || (WINDOWP (selected_window) /* Can be nil in corner cases.  */
@@ -7008,9 +6896,7 @@ freeze_window_start (w, freeze_p)
    means freeze the window start.  */
 
 void
-freeze_window_starts (f, freeze_p)
-     struct frame *f;
-     int freeze_p;
+freeze_window_starts (struct frame *f, int freeze_p)
 {
   foreach_window (f, freeze_window_start, (void *) (freeze_p ? f : 0));
 }
@@ -7024,9 +6910,7 @@ freeze_window_starts (f, freeze_p)
    describe the same state of affairs.  This is used by Fequal.  */
 
 int
-compare_window_configurations (c1, c2, ignore_positions)
-     Lisp_Object c1, c2;
-     int ignore_positions;
+compare_window_configurations (Lisp_Object c1, Lisp_Object c2, int ignore_positions)
 {
   register struct save_window_data *d1, *d2;
   struct Lisp_Vector *sw1, *sw2;
@@ -7143,8 +7027,7 @@ DEFUN ("compare-window-configurations", Fcompare_window_configurations,
        doc: /* Compare two window configurations as regards the structure of windows.
 This function ignores details such as the values of point and mark
 and scrolling positions.  */)
-     (x, y)
-     Lisp_Object x, y;
+  (Lisp_Object x, Lisp_Object y)
 {
   if (compare_window_configurations (x, y, 1))
     return Qt;
@@ -7152,7 +7035,7 @@ and scrolling positions.  */)
 }
 \f
 void
-init_window_once ()
+init_window_once (void)
 {
   struct frame *f = make_initial_frame ();
   XSETFRAME (selected_frame, f);
@@ -7165,13 +7048,13 @@ init_window_once ()
 }
 
 void
-init_window ()
+init_window (void)
 {
   Vwindow_list = Qnil;
 }
 
 void
-syms_of_window ()
+syms_of_window (void)
 {
   Qscroll_up = intern_c_string ("scroll-up");
   staticpro (&Qscroll_up);
@@ -7179,6 +7062,12 @@ syms_of_window ()
   Qscroll_down = intern_c_string ("scroll-down");
   staticpro (&Qscroll_down);
 
+  Qscroll_command = intern_c_string ("scroll-command");
+  staticpro (&Qscroll_command);
+
+  Fput (Qscroll_up, Qscroll_command, Qt);
+  Fput (Qscroll_down, Qscroll_command, Qt);
+
   Qwindow_size_fixed = intern_c_string ("window-size-fixed");
   staticpro (&Qwindow_size_fixed);
   Fset (Qwindow_size_fixed, Qnil);
@@ -7268,7 +7157,9 @@ at the scroll margin or window boundary respectively.
 A value of t means point keeps its screen position if the scroll
 command moved it vertically out of the window, e.g. when scrolling
 by full screens.
-Any other value means point always keeps its screen position.  */);
+Any other value means point always keeps its screen position.
+Scroll commands should have the `scroll-command' property
+on their symbols to be controlled by this variable.  */);
   Vscroll_preserve_screen_position = Qnil;
 
   DEFVAR_LISP ("window-point-insertion-type", &Vwindow_point_insertion_type,
@@ -7285,7 +7176,7 @@ with the relevant frame selected.  */);
 
   DEFVAR_LISP ("recenter-redisplay", &Vrecenter_redisplay,
               doc: /* If non-nil, then the `recenter' command with a nil argument
-the entire frame to be redrawn; the special value `tty' causes the
+will redraw the entire frame; the special value `tty' causes the
 frame to be redrawn only if it is a tty frame.  */);
   Vrecenter_redisplay = Qtty;
 
@@ -7307,8 +7198,10 @@ frame to be redrawn only if it is a tty frame.  */);
   defsubr (&Sset_window_redisplay_end_trigger);
   defsubr (&Swindow_edges);
   defsubr (&Swindow_pixel_edges);
+  defsubr (&Swindow_absolute_pixel_edges);
   defsubr (&Swindow_inside_edges);
   defsubr (&Swindow_inside_pixel_edges);
+  defsubr (&Swindow_inside_absolute_pixel_edges);
   defsubr (&Scoordinates_in_window_p);
   defsubr (&Swindow_at);
   defsubr (&Swindow_point);
@@ -7370,7 +7263,7 @@ frame to be redrawn only if it is a tty frame.  */);
 }
 
 void
-keys_of_window ()
+keys_of_window (void)
 {
   initial_define_key (control_x_map, '1', "delete-other-windows");
   initial_define_key (control_x_map, '2', "split-window");
@@ -7380,12 +7273,9 @@ keys_of_window ()
   initial_define_key (control_x_map, '<', "scroll-left");
   initial_define_key (control_x_map, '>', "scroll-right");
 
-  initial_define_key (global_map, Ctl ('V'), "scroll-up");
+  initial_define_key (global_map, Ctl ('V'), "scroll-up-command");
   initial_define_key (meta_map, Ctl ('V'), "scroll-other-window");
-  initial_define_key (meta_map, 'v', "scroll-down");
-
-  initial_define_key (global_map, Ctl('L'), "recenter");
-  initial_define_key (meta_map, 'r', "move-to-window-line");
+  initial_define_key (meta_map, 'v', "scroll-down-command");
 }
 
 /* arch-tag: 90a9c576-0590-48f1-a5f1-6c96a0452d9f
index 05c1eb18c89839a7fa3df0b69642032d3f1f9bcc..e9529487b14db363a0b66e3adc6cec299fadae9c 100644 (file)
@@ -117,7 +117,10 @@ struct window
     /* The buffer displayed in this window */
     /* Of the fields vchild, hchild and buffer, only one is non-nil.  */
     Lisp_Object buffer;
-    /* A marker pointing to where in the text to start displaying */
+    /* A marker pointing to where in the text to start displaying.
+       BIDI Note: This is the _logical-order_ start, i.e. the smallest
+       buffer position visible in the window, not necessarily the
+       character displayed in the top left corner of the window.  */
     Lisp_Object start;
     /* A marker pointing to where in the text point is in this window,
        used only when the window is not selected.
@@ -782,25 +785,25 @@ EXFUN (Fwindow_vscroll, 2);
 EXFUN (Fset_window_margins, 3);
 EXFUN (Fwindow_live_p, 1);
 EXFUN (Fset_window_point, 2);
-extern Lisp_Object make_window P_ ((void));
-extern void delete_window P_ ((Lisp_Object));
-extern Lisp_Object window_from_coordinates P_ ((struct frame *, int, int,
-                                               enum window_part *,
-                                               int *, int*, int));
+extern Lisp_Object make_window (void);
+extern void delete_window (Lisp_Object);
+extern Lisp_Object window_from_coordinates (struct frame *, int, int,
+                                            enum window_part *,
+                                            int *, int*, int);
 EXFUN (Fwindow_dedicated_p, 1);
-extern int window_height P_ ((Lisp_Object));
-extern int window_width P_ ((Lisp_Object));
+extern int window_height (Lisp_Object);
+extern int window_width (Lisp_Object);
 EXFUN (Fwindow_full_width_p, 1);
-extern void set_window_height P_ ((Lisp_Object, int, int));
-extern void set_window_width P_ ((Lisp_Object, int, int));
-extern void change_window_heights P_ ((Lisp_Object, int));
-extern void delete_all_subwindows P_ ((struct window *));
-extern void freeze_window_starts P_ ((struct frame *, int));
-extern void foreach_window P_ ((struct frame *,
-                               int (* fn) (struct window *, void *),
-                               void *));
-extern void grow_mini_window P_ ((struct window *, int));
-extern void shrink_mini_window P_ ((struct window *));
+extern void set_window_height (Lisp_Object, int, int);
+extern void set_window_width (Lisp_Object, int, int);
+extern void change_window_heights (Lisp_Object, int);
+extern void delete_all_subwindows (struct window *);
+extern void freeze_window_starts (struct frame *, int);
+extern void foreach_window (struct frame *,
+                            int (* fn) (struct window *, void *),
+                            void *);
+extern void grow_mini_window (struct window *, int);
+extern void shrink_mini_window (struct window *);
 
 void run_window_configuration_change_hook (struct frame *f);
 
@@ -808,8 +811,8 @@ void run_window_configuration_change_hook (struct frame *f);
    means it's allowed to run hooks.  See make_frame for a case where
    it's not allowed.  */
 
-void set_window_buffer P_ ((Lisp_Object window, Lisp_Object buffer,
-                           int run_hooks_p, int keep_margins_p));
+void set_window_buffer (Lisp_Object window, Lisp_Object buffer,
+                        int run_hooks_p, int keep_margins_p);
 
 /* Prompt to display in front of the minibuffer contents.  */
 
@@ -859,13 +862,13 @@ extern int buffer_shared;
 /* If *ROWS or *COLS are too small a size for FRAME, set them to the
    minimum allowable size.  */
 
-extern void check_frame_size P_ ((struct frame *frame, int *rows, int *cols));
+extern void check_frame_size (struct frame *frame, int *rows, int *cols);
 
 /* Return a pointer to the glyph W's physical cursor is on.  Value is
    null if W's current matrix is invalid, so that no meaningfull glyph
    can be returned.  */
 
-struct glyph *get_phys_cursor_glyph P_ ((struct window *w));
+struct glyph *get_phys_cursor_glyph (struct window *w);
 
 /* Value is non-zero if WINDOW is a live window.  */
 
@@ -888,24 +891,24 @@ EXFUN (Fsave_window_excursion, UNEVALLED);
 EXFUN (Fsplit_window, 3);
 EXFUN (Fset_window_configuration, 1);
 EXFUN (Fcurrent_window_configuration, 1);
-extern int compare_window_configurations P_ ((Lisp_Object, Lisp_Object, int));
+extern int compare_window_configurations (Lisp_Object, Lisp_Object, int);
 EXFUN (Fcoordinates_in_window_p, 2);
 EXFUN (Fwindow_at, 3);
 EXFUN (Fpos_visible_in_window_p, 3);
-extern void mark_window_cursors_off P_ ((struct window *));
-extern int window_internal_height P_ ((struct window *));
-extern int window_internal_width P_ ((struct window *));
+extern void mark_window_cursors_off (struct window *);
+extern int window_internal_height (struct window *);
+extern int window_internal_width (struct window *);
 EXFUN (Frecenter, 1);
 EXFUN (Fscroll_other_window, 1);
 EXFUN (Fset_window_start, 3);
-extern void temp_output_buffer_show P_ ((Lisp_Object));
-extern void replace_buffer_in_all_windows P_ ((Lisp_Object));
-extern void init_window_once P_ ((void));
-extern void init_window P_ ((void));
-extern void syms_of_window P_ ((void));
-extern void keys_of_window P_ ((void));
-
-extern int window_box_text_cols P_ ((struct window *w));
+extern void temp_output_buffer_show (Lisp_Object);
+extern void replace_buffer_in_all_windows (Lisp_Object);
+extern void init_window_once (void);
+extern void init_window (void);
+extern void syms_of_window (void);
+extern void keys_of_window (void);
+
+extern int window_box_text_cols (struct window *w);
 
 #endif /* not WINDOW_H_INCLUDED */
 
index 59e38e440e45486baac8d63072fd9150192a61a2..2ec271cdb6b8cbb23a0e38c494dcf864e8ac60d3 100644 (file)
@@ -32,9 +32,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    decides it's time to do it.  This is done either automatically for
    you as part of the interpreter's command loop or as the result of
    calling Lisp functions like `sit-for'.  The C function `redisplay'
-   in xdisp.c is the only entry into the inner redisplay code.  (Or,
-   let's say almost---see the description of direct update
-   operations, below.)
+   in xdisp.c is the only entry into the inner redisplay code.
 
    The following diagram shows how redisplay code is invoked.  As you
    can see, Lisp calls redisplay and vice versa.  Under window systems
@@ -46,12 +44,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    change the interpreter's state.  If you don't follow these rules,
    you will encounter bugs which are very hard to explain.
 
-            (Direct functions, see below)
-             direct_output_for_insert,
-             direct_forward_char (dispnew.c)
-         +---------------------------------+
-          |                                 |
-         |                                 V
    +--------------+   redisplay     +----------------+
    | Lisp machine |---------------->| Redisplay code |<--+
    +--------------+   (xdisp.c)     +----------------+   |
@@ -85,27 +77,42 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    then compared to find a cheap way to update the display, e.g. by
    reusing part of the display by scrolling lines.
 
-
-   Direct operations.
-
    You will find a lot of redisplay optimizations when you start
    looking at the innards of redisplay.  The overall goal of all these
    optimizations is to make redisplay fast because it is done
-   frequently.
+   frequently.  Some of these optimizations are implemented by the
+   following functions:
+
+    . try_cursor_movement
+
+      This function tries to update the display if the text in the
+      window did not change and did not scroll, only point moved, and
+      it did not move off the displayed portion of the text.
+
+    . try_window_reusing_current_matrix
+
+      This function reuses the current matrix of a window when text
+      has not changed, but the window start changed (e.g., due to
+      scrolling).
+
+    . try_window_id
 
-   Two optimizations are not found in xdisp.c.  These are the direct
-   operations mentioned above.  As the name suggests they follow a
-   different principle than the rest of redisplay.  Instead of
-   building a desired matrix and then comparing it with the current
-   display, they perform their actions directly on the display and on
-   the current matrix.
+      This function attempts to redisplay a window by reusing parts of
+      its existing display.  It finds and reuses the part that was not
+      changed, and redraws the rest.
 
-   One direct operation updates the display after one character has
-   been entered.  The other one moves the cursor by one position
-   forward or backward.  You find these functions under the names
-   `direct_output_for_insert' and `direct_output_forward_char' in
-   dispnew.c.
+    . try_window
 
+      This function performs the full redisplay of a single window
+      assuming that its fonts were not changed and that the cursor
+      will not end up in the scroll margins.  (Loading fonts requires
+      re-adjustment of dimensions of glyph matrices, which makes this
+      method impossible to use.)
+
+   These optimizations are tried in sequence (some can be skipped if
+   it is known that they are not applicable).  If none of the
+   optimizations were successful, redisplay calls redisplay_windows,
+   which performs a full redisplay of all windows.
 
    Desired matrices.
 
@@ -137,13 +144,16 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    see in dispextern.h.
 
    Glyphs in a desired matrix are normally constructed in a loop
-   calling get_next_display_element and then produce_glyphs.  The call
-   to produce_glyphs will fill the iterator structure with pixel
+   calling get_next_display_element and then PRODUCE_GLYPHS.  The call
+   to PRODUCE_GLYPHS will fill the iterator structure with pixel
    information about the element being displayed and at the same time
    produce glyphs for it.  If the display element fits on the line
    being displayed, set_iterator_to_next is called next, otherwise the
-   glyphs produced are discarded.
-
+   glyphs produced are discarded.  The function display_line is the
+   workhorse of filling glyph rows in the desired matrix with glyphs.
+   In addition to producing glyphs, it also handles line truncation
+   and continuation, word wrap, and cursor positioning (for the
+   latter, see also set_cursor_from_row).
 
    Frame matrices.
 
@@ -164,7 +174,69 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    wanted to have without having to move many bytes around.  To be
    honest, there is a little bit more done, but not much more.  If you
    plan to extend that code, take a look at dispnew.c.  The function
-   build_frame_matrix is a good starting point.  */
+   build_frame_matrix is a good starting point.
+
+   Bidirectional display.
+
+   Bidirectional display adds quite some hair to this already complex
+   design.  The good news are that a large portion of that hairy stuff
+   is hidden in bidi.c behind only 3 interfaces.  bidi.c implements a
+   reordering engine which is called by set_iterator_to_next and
+   returns the next character to display in the visual order.  See
+   commentary on bidi.c for more details.  As far as redisplay is
+   concerned, the effect of calling bidi_move_to_visually_next, the
+   main interface of the reordering engine, is that the iterator gets
+   magically placed on the buffer or string position that is to be
+   displayed next.  In other words, a linear iteration through the
+   buffer/string is replaced with a non-linear one.  All the rest of
+   the redisplay is oblivious to the bidi reordering.
+
+   Well, almost oblivious---there are still complications, most of
+   them due to the fact that buffer and string positions no longer
+   change monotonously with glyph indices in a glyph row.  Moreover,
+   for continued lines, the buffer positions may not even be
+   monotonously changing with vertical positions.  Also, accounting
+   for face changes, overlays, etc. becomes more complex because
+   non-linear iteration could potentially skip many positions with
+   changes, and then cross them again on the way back...
+
+   One other prominent effect of bidirectional display is that some
+   paragraphs of text need to be displayed starting at the right
+   margin of the window---the so-called right-to-left, or R2L
+   paragraphs.  R2L paragraphs are displayed with R2L glyph rows,
+   which have their reversed_p flag set.  The bidi reordering engine
+   produces characters in such rows starting from the character which
+   should be the rightmost on display.  PRODUCE_GLYPHS then reverses
+   the order, when it fills up the glyph row whose reversed_p flag is
+   set, by prepending each new glyph to what is already there, instead
+   of appending it.  When the glyph row is complete, the function
+   extend_face_to_end_of_line fills the empty space to the left of the
+   leftmost character with special glyphs, which will display as,
+   well, empty.  On text terminals, these special glyphs are simply
+   blank characters.  On graphics terminals, there's a single stretch
+   glyph with suitably computed width.  Both the blanks and the
+   stretch glyph are given the face of the background of the line.
+   This way, the terminal-specific back-end can still draw the glyphs
+   left to right, even for R2L lines.
+
+   Note one important detail mentioned above: that the bidi reordering
+   engine, driven by the iterator, produces characters in R2L rows
+   starting at the character that will be the rightmost on display.
+   As far as the iterator is concerned, the geometry of such rows is
+   still left to right, i.e. the iterator "thinks" the first character
+   is at the leftmost pixel position.  The iterator does not know that
+   PRODUCE_GLYPHS reverses the order of the glyphs that the iterator
+   delivers.  This is important when functions from the the move_it_*
+   family are used to get to certain screen position or to match
+   screen coordinates with buffer coordinates: these functions use the
+   iterator geometry, which is left to right even in R2L paragraphs.
+   This works well with most callers of move_it_*, because they need
+   to get to a specific column, and columns are still numbered in the
+   reading order, i.e. the rightmost character in a R2L paragraph is
+   still column zero.  But some callers do not get well with this; a
+   notable example is mouse clicks that need to find the character
+   that corresponds to certain pixel coordinates.  See
+   buffer_posn_from_coords in dispnew.c for how this is handled.  */
 
 #include <config.h>
 #include <stdio.h>
@@ -186,6 +258,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "macros.h"
 #include "disptab.h"
 #include "termhooks.h"
+#include "termopts.h"
 #include "intervals.h"
 #include "coding.h"
 #include "process.h"
@@ -215,30 +288,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #define INFINITY 10000000
 
-#if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) \
-    || defined(HAVE_NS) || defined (USE_GTK)
-extern void set_frame_menubar P_ ((struct frame *f, int, int));
-extern int pending_menu_activation;
-#endif
-
-extern int interrupt_input;
-extern int command_loop_level;
-
-extern Lisp_Object do_mouse_tracking;
-
-extern int minibuffer_auto_raise;
-extern Lisp_Object Vminibuffer_list;
-
-extern Lisp_Object Qface;
-extern Lisp_Object Qmode_line, Qmode_line_inactive, Qheader_line;
-
-extern Lisp_Object Voverriding_local_map;
-extern Lisp_Object Voverriding_local_map_menu_flag;
-extern Lisp_Object Qmenu_item;
-extern Lisp_Object Qwhen;
-extern Lisp_Object Qhelp_echo;
-extern Lisp_Object Qbefore_string, Qafter_string;
-
 Lisp_Object Qoverriding_local_map, Qoverriding_terminal_local_map;
 Lisp_Object Qwindow_scroll_functions, Vwindow_scroll_functions;
 Lisp_Object Qwindow_text_change_functions, Vwindow_text_change_functions;
@@ -249,6 +298,7 @@ Lisp_Object Qfontified;
 Lisp_Object Qgrow_only;
 Lisp_Object Qinhibit_eval_during_redisplay;
 Lisp_Object Qbuffer_position, Qposition, Qobject;
+Lisp_Object Qright_to_left, Qleft_to_right;
 
 /* Cursor shapes */
 Lisp_Object Qbar, Qhbar, Qbox, Qhollow;
@@ -303,6 +353,14 @@ EMACS_INT tool_bar_button_relief;
 
 Lisp_Object Vauto_resize_tool_bars;
 
+/* Type of tool bar.  Can be symbols image, text, both or both-hroiz.  */
+
+Lisp_Object Vtool_bar_style;
+
+/* Maximum number of characters a label can have to be shown.  */
+
+EMACS_INT tool_bar_max_label_size;
+
 /* Non-zero means draw block and hollow 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.  */
@@ -320,7 +378,6 @@ int inhibit_eval_during_redisplay;
 /* Names of text properties relevant for redisplay.  */
 
 Lisp_Object Qdisplay;
-extern Lisp_Object Qface, Qinvisible, Qwidth;
 
 /* Symbols used in text property values.  */
 
@@ -331,10 +388,6 @@ Lisp_Object Qslice;
 Lisp_Object Qcenter;
 Lisp_Object Qmargin, Qpointer;
 Lisp_Object Qline_height;
-extern Lisp_Object Qheight;
-extern Lisp_Object QCwidth, QCheight, QCascent;
-extern Lisp_Object Qscroll_bar;
-extern Lisp_Object Qcursor;
 
 /* Non-nil means highlight trailing whitespace.  */
 
@@ -345,17 +398,18 @@ Lisp_Object Vshow_trailing_whitespace;
 Lisp_Object Vnobreak_char_display;
 
 #ifdef HAVE_WINDOW_SYSTEM
-extern Lisp_Object Voverflow_newline_into_fringe;
 
 /* Test if overflow newline into fringe.  Called with iterator IT
    at or past right window margin, and with IT->current_x set.  */
 
-#define IT_OVERFLOW_NEWLINE_INTO_FRINGE(it)    \
-  (!NILP (Voverflow_newline_into_fringe)       \
-   && FRAME_WINDOW_P (it->f)                   \
-   && WINDOW_RIGHT_FRINGE_WIDTH (it->w) > 0    \
-   && it->current_x == it->last_visible_x      \
-   && it->line_wrap != WORD_WRAP)
+#define IT_OVERFLOW_NEWLINE_INTO_FRINGE(IT)            \
+  (!NILP (Voverflow_newline_into_fringe)               \
+   && FRAME_WINDOW_P ((IT)->f)                         \
+   && ((IT)->bidi_it.paragraph_dir == R2L              \
+       ? (WINDOW_LEFT_FRINGE_WIDTH ((IT)->w) > 0)      \
+       : (WINDOW_RIGHT_FRINGE_WIDTH ((IT)->w) > 0))    \
+   && (IT)->current_x == (IT)->last_visible_x          \
+   && (IT)->line_wrap != WORD_WRAP)
 
 #else /* !HAVE_WINDOW_SYSTEM */
 #define IT_OVERFLOW_NEWLINE_INTO_FRINGE(it) 0
@@ -386,7 +440,7 @@ Lisp_Object Qescape_glyph;
 Lisp_Object Qnobreak_space;
 
 /* The symbol `image' which is the car of the lists used to represent
-   images in Lisp.  */
+   images in Lisp.  Also a tool bar style.  */
 
 Lisp_Object Qimage;
 
@@ -394,6 +448,9 @@ Lisp_Object Qimage;
 Lisp_Object QCmap, QCpointer;
 Lisp_Object Qrect, Qcircle, Qpoly;
 
+/* Tool bar styles */
+Lisp_Object Qboth, Qboth_horiz, Qtext_image_horiz;
+
 /* Non-zero means print newline to stdout before next mini-buffer
    message.  */
 
@@ -764,15 +821,15 @@ struct props
 
   /* A handler function called to set up iterator IT from the property
      at IT's current position.  Value is used to steer handle_stop.  */
-  enum prop_handled (*handler) P_ ((struct it *it));
+  enum prop_handled (*handler) (struct it *it);
 };
 
-static enum prop_handled handle_face_prop P_ ((struct it *));
-static enum prop_handled handle_invisible_prop P_ ((struct it *));
-static enum prop_handled handle_display_prop P_ ((struct it *));
-static enum prop_handled handle_composition_prop P_ ((struct it *));
-static enum prop_handled handle_overlay_change P_ ((struct it *));
-static enum prop_handled handle_fontified_prop P_ ((struct it *));
+static enum prop_handled handle_face_prop (struct it *);
+static enum prop_handled handle_invisible_prop (struct it *);
+static enum prop_handled handle_display_prop (struct it *);
+static enum prop_handled handle_composition_prop (struct it *);
+static enum prop_handled handle_overlay_change (struct it *);
+static enum prop_handled handle_fontified_prop (struct it *);
 
 /* Properties handled by iterators.  */
 
@@ -882,146 +939,149 @@ Lisp_Object Vhourglass_delay;
 \f
 /* Function prototypes.  */
 
-static void setup_for_ellipsis P_ ((struct it *, int));
-static void mark_window_display_accurate_1 P_ ((struct window *, int));
-static int single_display_spec_string_p P_ ((Lisp_Object, Lisp_Object));
-static int display_prop_string_p P_ ((Lisp_Object, Lisp_Object));
-static int cursor_row_p P_ ((struct window *, struct glyph_row *));
-static int redisplay_mode_lines P_ ((Lisp_Object, int));
-static char *decode_mode_spec_coding P_ ((Lisp_Object, char *, int));
-
-static Lisp_Object get_it_property P_ ((struct it *it, Lisp_Object prop));
-
-static void handle_line_prefix P_ ((struct it *));
-
-static void pint2str P_ ((char *, int, int));
-static void pint2hrstr P_ ((char *, int, int));
-static struct text_pos run_window_scroll_functions P_ ((Lisp_Object,
-                                                       struct text_pos));
-static void reconsider_clip_changes P_ ((struct window *, struct buffer *));
-static int text_outside_line_unchanged_p P_ ((struct window *, int, int));
-static void store_mode_line_noprop_char P_ ((char));
-static int store_mode_line_noprop P_ ((const unsigned char *, int, int));
-static void x_consider_frame_title P_ ((Lisp_Object));
-static void handle_stop P_ ((struct it *));
-static int tool_bar_lines_needed P_ ((struct frame *, int *));
-static int single_display_spec_intangible_p P_ ((Lisp_Object));
-static void ensure_echo_area_buffers P_ ((void));
-static Lisp_Object unwind_with_echo_area_buffer P_ ((Lisp_Object));
-static Lisp_Object with_echo_area_buffer_unwind_data P_ ((struct window *));
-static int with_echo_area_buffer P_ ((struct window *, int,
-                                     int (*) (EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT),
-                                     EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT));
-static void clear_garbaged_frames P_ ((void));
-static int current_message_1 P_ ((EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT));
-static int truncate_message_1 P_ ((EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT));
-static int set_message_1 P_ ((EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT));
-static int display_echo_area P_ ((struct window *));
-static int display_echo_area_1 P_ ((EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT));
-static int resize_mini_window_1 P_ ((EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT));
-static Lisp_Object unwind_redisplay P_ ((Lisp_Object));
-static int string_char_and_length P_ ((const unsigned char *, int *));
-static struct text_pos display_prop_end P_ ((struct it *, Lisp_Object,
-                                            struct text_pos));
-static int compute_window_start_on_continuation_line P_ ((struct window *));
-static Lisp_Object safe_eval_handler P_ ((Lisp_Object));
-static void insert_left_trunc_glyphs P_ ((struct it *));
-static struct glyph_row *get_overlay_arrow_glyph_row P_ ((struct window *,
-                                                         Lisp_Object));
-static void extend_face_to_end_of_line P_ ((struct it *));
-static int append_space_for_newline P_ ((struct it *, int));
-static int cursor_row_fully_visible_p P_ ((struct window *, int, int));
-static int try_scrolling P_ ((Lisp_Object, int, EMACS_INT, EMACS_INT, int, int));
-static int try_cursor_movement P_ ((Lisp_Object, struct text_pos, int *));
-static int trailing_whitespace_p P_ ((int));
-static int message_log_check_duplicate P_ ((int, int, int, int));
-static void push_it P_ ((struct it *));
-static void pop_it P_ ((struct it *));
-static void sync_frame_with_window_matrix_rows P_ ((struct window *));
-static void select_frame_for_redisplay P_ ((Lisp_Object));
-static void redisplay_internal P_ ((int));
-static int echo_area_display P_ ((int));
-static void redisplay_windows P_ ((Lisp_Object));
-static void redisplay_window P_ ((Lisp_Object, int));
-static Lisp_Object redisplay_window_error ();
-static Lisp_Object redisplay_window_0 P_ ((Lisp_Object));
-static Lisp_Object redisplay_window_1 P_ ((Lisp_Object));
-static int update_menu_bar P_ ((struct frame *, int, int));
-static int try_window_reusing_current_matrix P_ ((struct window *));
-static int try_window_id P_ ((struct window *));
-static int display_line P_ ((struct it *));
-static int display_mode_lines P_ ((struct window *));
-static int display_mode_line P_ ((struct window *, enum face_id, Lisp_Object));
-static int display_mode_element P_ ((struct it *, int, int, int, Lisp_Object, Lisp_Object, int));
-static int store_mode_line_string P_ ((char *, Lisp_Object, int, int, int, Lisp_Object));
-static char *decode_mode_spec P_ ((struct window *, int, int, int,
-                                  Lisp_Object *));
-static void display_menu_bar P_ ((struct window *));
-static int display_count_lines P_ ((int, int, int, int, int *));
-static int display_string P_ ((unsigned char *, Lisp_Object, Lisp_Object,
-                              EMACS_INT, EMACS_INT, struct it *, int, int, int, int));
-static void compute_line_metrics P_ ((struct it *));
-static void run_redisplay_end_trigger_hook P_ ((struct it *));
-static int get_overlay_strings P_ ((struct it *, int));
-static int get_overlay_strings_1 P_ ((struct it *, int, int));
-static void next_overlay_string P_ ((struct it *));
-static void reseat P_ ((struct it *, struct text_pos, int));
-static void reseat_1 P_ ((struct it *, struct text_pos, int));
-static void back_to_previous_visible_line_start P_ ((struct it *));
-void reseat_at_previous_visible_line_start P_ ((struct it *));
-static void reseat_at_next_visible_line_start P_ ((struct it *, int));
-static int next_element_from_ellipsis P_ ((struct it *));
-static int next_element_from_display_vector P_ ((struct it *));
-static int next_element_from_string P_ ((struct it *));
-static int next_element_from_c_string P_ ((struct it *));
-static int next_element_from_buffer P_ ((struct it *));
-static int next_element_from_composition P_ ((struct it *));
-static int next_element_from_image P_ ((struct it *));
-static int next_element_from_stretch P_ ((struct it *));
-static void load_overlay_strings P_ ((struct it *, int));
-static int init_from_display_pos P_ ((struct it *, struct window *,
-                                     struct display_pos *));
-static void reseat_to_string P_ ((struct it *, unsigned char *,
-                                 Lisp_Object, int, int, int, int));
+static void setup_for_ellipsis (struct it *, int);
+static void mark_window_display_accurate_1 (struct window *, int);
+static int single_display_spec_string_p (Lisp_Object, Lisp_Object);
+static int display_prop_string_p (Lisp_Object, Lisp_Object);
+static int cursor_row_p (struct window *, struct glyph_row *);
+static int redisplay_mode_lines (Lisp_Object, int);
+static char *decode_mode_spec_coding (Lisp_Object, char *, int);
+
+static Lisp_Object get_it_property (struct it *it, Lisp_Object prop);
+
+static void handle_line_prefix (struct it *);
+
+static void pint2str (char *, int, int);
+static void pint2hrstr (char *, int, int);
+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 *, int, int);
+static void store_mode_line_noprop_char (char);
+static int store_mode_line_noprop (const unsigned char *, int, int);
+static void x_consider_frame_title (Lisp_Object);
+static void handle_stop (struct it *);
+static void handle_stop_backwards (struct it *, EMACS_INT);
+static int tool_bar_lines_needed (struct frame *, int *);
+static int single_display_spec_intangible_p (Lisp_Object);
+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);
+static void clear_garbaged_frames (void);
+static int current_message_1 (EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT);
+static int truncate_message_1 (EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT);
+static int set_message_1 (EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT);
+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 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,
+                                         struct text_pos);
+static int compute_window_start_on_continuation_line (struct window *);
+static Lisp_Object safe_eval_handler (Lisp_Object);
+static void insert_left_trunc_glyphs (struct it *);
+static struct glyph_row *get_overlay_arrow_glyph_row (struct window *,
+                                                      Lisp_Object);
+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_cursor_movement (Lisp_Object, struct text_pos, int *);
+static int trailing_whitespace_p (int);
+static int message_log_check_duplicate (int, int, int, int);
+static void push_it (struct it *);
+static void pop_it (struct it *);
+static void sync_frame_with_window_matrix_rows (struct window *);
+static void select_frame_for_redisplay (Lisp_Object);
+static void redisplay_internal (int);
+static int echo_area_display (int);
+static void redisplay_windows (Lisp_Object);
+static void redisplay_window (Lisp_Object, int);
+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 update_menu_bar (struct frame *, int, int);
+static int try_window_reusing_current_matrix (struct window *);
+static int try_window_id (struct window *);
+static int display_line (struct it *);
+static int display_mode_lines (struct window *);
+static int display_mode_line (struct window *, enum face_id, Lisp_Object);
+static int display_mode_element (struct it *, int, int, int, Lisp_Object, Lisp_Object, int);
+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, int,
+                                    Lisp_Object *);
+static void display_menu_bar (struct window *);
+static int display_count_lines (int, int, int, int, int *);
+static int display_string (const unsigned char *, Lisp_Object, Lisp_Object,
+                           EMACS_INT, EMACS_INT, 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 *, int);
+static int get_overlay_strings_1 (struct it *, int, 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);
+static void back_to_previous_visible_line_start (struct it *);
+void reseat_at_previous_visible_line_start (struct it *);
+static void reseat_at_next_visible_line_start (struct it *, int);
+static int next_element_from_ellipsis (struct it *);
+static int next_element_from_display_vector (struct it *);
+static int next_element_from_string (struct it *);
+static int next_element_from_c_string (struct it *);
+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 *, int);
+static int init_from_display_pos (struct it *, struct window *,
+                                  struct display_pos *);
+static void reseat_to_string (struct it *, const unsigned char *,
+                              Lisp_Object, int, int, int, int);
 static enum move_it_result
        move_it_in_display_line_to (struct it *, EMACS_INT, int,
                                   enum move_operation_enum);
-void move_it_vertically_backward P_ ((struct it *, int));
-static void init_to_row_start P_ ((struct it *, struct window *,
-                                  struct glyph_row *));
-static int init_to_row_end P_ ((struct it *, struct window *,
-                               struct glyph_row *));
-static void back_to_previous_line_start P_ ((struct it *));
-static int forward_to_next_line_start P_ ((struct it *, int *));
-static struct text_pos string_pos_nchars_ahead P_ ((struct text_pos,
-                                                   Lisp_Object, int));
-static struct text_pos string_pos P_ ((int, Lisp_Object));
-static struct text_pos c_string_pos P_ ((int, unsigned char *, int));
-static int number_of_chars P_ ((unsigned char *, int));
-static void compute_stop_pos P_ ((struct it *));
-static void compute_string_pos P_ ((struct text_pos *, struct text_pos,
-                                   Lisp_Object));
-static int face_before_or_after_it_pos P_ ((struct it *, int));
-static EMACS_INT next_overlay_change P_ ((EMACS_INT));
-static int handle_single_display_spec P_ ((struct it *, Lisp_Object,
-                                          Lisp_Object, Lisp_Object,
-                                          struct text_pos *, int));
-static int underlying_face_id P_ ((struct it *));
-static int in_ellipses_for_invisible_text_p P_ ((struct display_pos *,
-                                                struct window *));
+void move_it_vertically_backward (struct it *, int);
+static void init_to_row_start (struct it *, struct window *,
+                               struct glyph_row *);
+static int init_to_row_end (struct it *, struct window *,
+                            struct glyph_row *);
+static void back_to_previous_line_start (struct it *);
+static int forward_to_next_line_start (struct it *, int *);
+static struct text_pos string_pos_nchars_ahead (struct text_pos,
+                                                Lisp_Object, int);
+static struct text_pos string_pos (int, Lisp_Object);
+static struct text_pos c_string_pos (int, const unsigned char *, int);
+static int number_of_chars (const unsigned 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 int handle_single_display_spec (struct it *, Lisp_Object,
+                                       Lisp_Object, Lisp_Object,
+                                       struct text_pos *, int);
+static int underlying_face_id (struct it *);
+static int in_ellipses_for_invisible_text_p (struct display_pos *,
+                                             struct window *);
 
 #define face_before_it_pos(IT) face_before_or_after_it_pos ((IT), 1)
 #define face_after_it_pos(IT)  face_before_or_after_it_pos ((IT), 0)
 
 #ifdef HAVE_WINDOW_SYSTEM
 
-static void update_tool_bar P_ ((struct frame *, int));
-static void build_desired_tool_bar_string P_ ((struct frame *f));
-static int redisplay_tool_bar P_ ((struct frame *));
-static void display_tool_bar_line P_ ((struct it *, int));
-static void notice_overwritten_cursor P_ ((struct window *,
-                                          enum glyph_row_area,
-                                          int, int, int, int));
+static void update_tool_bar (struct frame *, int);
+static void build_desired_tool_bar_string (struct frame *f);
+static int redisplay_tool_bar (struct frame *);
+static void display_tool_bar_line (struct it *, int);
+static void notice_overwritten_cursor (struct window *,
+                                       enum glyph_row_area,
+                                       int, int, int, int);
+static void append_stretch_glyph (struct it *, Lisp_Object,
+                                  int, int, int);
 
 
 
@@ -1039,8 +1099,7 @@ static void notice_overwritten_cursor P_ ((struct window *,
    This is the height of W minus the height of a mode line, if any.  */
 
 INLINE int
-window_text_bottom_y (w)
-     struct window *w;
+window_text_bottom_y (struct window *w)
 {
   int height = WINDOW_TOTAL_HEIGHT (w);
 
@@ -1054,9 +1113,7 @@ window_text_bottom_y (w)
    the left and right of the window.  */
 
 INLINE int
-window_box_width (w, area)
-     struct window *w;
-     int area;
+window_box_width (struct window *w, int area)
 {
   int cols = XFASTINT (w->total_cols);
   int pixels = 0;
@@ -1095,8 +1152,7 @@ window_box_width (w, area)
    including mode lines of W, if any.  */
 
 INLINE int
-window_box_height (w)
-     struct window *w;
+window_box_height (struct window *w)
 {
   struct frame *f = XFRAME (w->frame);
   int height = WINDOW_TOTAL_HEIGHT (w);
@@ -1143,9 +1199,7 @@ window_box_height (w)
    whole window, to the right of the left fringe of W.  */
 
 INLINE int
-window_box_left_offset (w, area)
-     struct window *w;
-     int area;
+window_box_left_offset (struct window *w, int area)
 {
   int x;
 
@@ -1173,13 +1227,11 @@ window_box_left_offset (w, area)
 
 
 /* Return the window-relative coordinate of the right edge of display
-   area AREA of window W.  AREA < 0 means return the left edge of the
+   area AREA of window W.  AREA < 0 means return the right edge of the
    whole window, to the left of the right fringe of W.  */
 
 INLINE int
-window_box_right_offset (w, area)
-     struct window *w;
-     int area;
+window_box_right_offset (struct window *w, int area)
 {
   return window_box_left_offset (w, area) + window_box_width (w, area);
 }
@@ -1189,9 +1241,7 @@ window_box_right_offset (w, area)
    whole window, to the right of the left fringe of W.  */
 
 INLINE int
-window_box_left (w, area)
-     struct window *w;
-     int area;
+window_box_left (struct window *w, int area)
 {
   struct frame *f = XFRAME (w->frame);
   int x;
@@ -1207,13 +1257,11 @@ window_box_left (w, area)
 
 
 /* Return the frame-relative coordinate of the right edge of display
-   area AREA of window W.  AREA < 0 means return the left edge of the
+   area AREA of window W.  AREA < 0 means return the right edge of the
    whole window, to the left of the right fringe of W.  */
 
 INLINE int
-window_box_right (w, area)
-     struct window *w;
-     int area;
+window_box_right (struct window *w, int area)
 {
   return window_box_left (w, area) + window_box_width (w, area);
 }
@@ -1226,10 +1274,8 @@ window_box_right (w, area)
    *BOX_WIDTH, and *BOX_HEIGHT the pixel width and height of the box.  */
 
 INLINE void
-window_box (w, area, box_x, box_y, box_width, box_height)
-     struct window *w;
-     int area;
-     int *box_x, *box_y, *box_width, *box_height;
+window_box (struct window *w, int area, int *box_x, int *box_y,
+           int *box_width, int *box_height)
 {
   if (box_width)
     *box_width = window_box_width (w, area);
@@ -1255,11 +1301,8 @@ window_box (w, area, box_x, box_y, box_width, box_height)
    box.  */
 
 INLINE void
-window_box_edges (w, area, top_left_x, top_left_y,
-                 bottom_right_x, bottom_right_y)
-     struct window *w;
-     int area;
-     int *top_left_x, *top_left_y, *bottom_right_x, *bottom_right_y;
+window_box_edges (struct window *w, int area, int *top_left_x, int *top_left_y,
+                  int *bottom_right_x, int *bottom_right_y)
 {
   window_box (w, area, top_left_x, top_left_y, bottom_right_x,
              bottom_right_y);
@@ -1277,8 +1320,7 @@ window_box_edges (w, area, top_left_x, top_left_y,
    This can modify IT's settings.  */
 
 int
-line_bottom_y (it)
-     struct it *it;
+line_bottom_y (struct it *it)
 {
   int line_height = it->max_ascent + it->max_descent;
   int line_top_y = it->current_y;
@@ -1320,9 +1362,8 @@ line_bottom_y (it)
    Set *ROWH and *VPOS to row's visible height and VPOS (row number).  */
 
 int
-pos_visible_p (w, charpos, x, y, rtop, rbot, rowh, vpos)
-     struct window *w;
-     int charpos, *x, *y, *rtop, *rbot, *rowh, *vpos;
+pos_visible_p (struct window *w, int charpos, int *x, int *y,
+              int *rtop, int *rbot, int *rowh, int *vpos)
 {
   struct it it;
   struct text_pos top;
@@ -1461,9 +1502,7 @@ pos_visible_p (w, charpos, x, y, rtop, rbot, rowh, vpos)
    character.  */
 
 static INLINE int
-string_char_and_length (str, len)
-     const unsigned char *str;
-     int *len;
+string_char_and_length (const unsigned char *str, int *len)
 {
   int c;
 
@@ -1483,10 +1522,7 @@ string_char_and_length (str, len)
    in STRING, return the position NCHARS ahead (NCHARS >= 0).  */
 
 static struct text_pos
-string_pos_nchars_ahead (pos, string, nchars)
-     struct text_pos pos;
-     Lisp_Object string;
-     int nchars;
+string_pos_nchars_ahead (struct text_pos pos, Lisp_Object string, int nchars)
 {
   xassert (STRINGP (string) && nchars >= 0);
 
@@ -1516,9 +1552,7 @@ string_pos_nchars_ahead (pos, string, nchars)
    for character position CHARPOS in STRING.  */
 
 static INLINE struct text_pos
-string_pos (charpos, string)
-     int charpos;
-     Lisp_Object string;
+string_pos (int charpos, Lisp_Object string)
 {
   struct text_pos pos;
   xassert (STRINGP (string));
@@ -1533,10 +1567,7 @@ string_pos (charpos, string)
    means recognize multibyte characters.  */
 
 static struct text_pos
-c_string_pos (charpos, s, multibyte_p)
-     int charpos;
-     unsigned char *s;
-     int multibyte_p;
+c_string_pos (int charpos, const unsigned char *s, int multibyte_p)
 {
   struct text_pos pos;
 
@@ -1568,9 +1599,7 @@ c_string_pos (charpos, s, multibyte_p)
    non-zero means recognize multibyte characters.  */
 
 static int
-number_of_chars (s, multibyte_p)
-     unsigned char *s;
-     int multibyte_p;
+number_of_chars (const unsigned char *s, int multibyte_p)
 {
   int nchars;
 
@@ -1597,9 +1626,7 @@ number_of_chars (s, multibyte_p)
    NEWPOS->charpos must be >= POS.charpos.  */
 
 static void
-compute_string_pos (newpos, pos, string)
-     struct text_pos *newpos, pos;
-     Lisp_Object string;
+compute_string_pos (struct text_pos *newpos, struct text_pos pos, Lisp_Object string)
 {
   xassert (STRINGP (string));
   xassert (CHARPOS (*newpos) >= CHARPOS (pos));
@@ -1616,9 +1643,7 @@ compute_string_pos (newpos, pos, string)
    frame F.  FACE_ID specifies what line's height to estimate.  */
 
 int
-estimate_mode_line_height (f, face_id)
-     struct frame *f;
-     enum face_id face_id;
+estimate_mode_line_height (struct frame *f, enum face_id face_id)
 {
 #ifdef HAVE_WINDOW_SYSTEM
   if (FRAME_WINDOW_P (f))
@@ -1652,12 +1677,8 @@ estimate_mode_line_height (f, face_id)
    not force the value into range.  */
 
 void
-pixel_to_glyph_coords (f, pix_x, pix_y, x, y, bounds, noclip)
-     FRAME_PTR f;
-     register int pix_x, pix_y;
-     int *x, *y;
-     NativeRectangle *bounds;
-     int noclip;
+pixel_to_glyph_coords (FRAME_PTR f, register int pix_x, register int pix_y,
+                      int *x, int *y, NativeRectangle *bounds, int noclip)
 {
 
 #ifdef HAVE_WINDOW_SYSTEM
@@ -1706,10 +1727,8 @@ pixel_to_glyph_coords (f, pix_x, pix_y, x, y, bounds, noclip)
    return 0.  */
 
 int
-glyph_to_pixel_coords (w, hpos, vpos, frame_x, frame_y)
-     struct window *w;
-     int hpos, vpos;
-     int *frame_x, *frame_y;
+glyph_to_pixel_coords (struct window *w, int hpos, int vpos,
+                      int *frame_x, int *frame_y)
 {
 #ifdef HAVE_WINDOW_SYSTEM
   if (FRAME_WINDOW_P (XFRAME (WINDOW_FRAME (w))))
@@ -1769,10 +1788,8 @@ glyph_to_pixel_coords (w, hpos, vpos, frame_x, frame_y)
 
 static
 struct glyph *
-x_y_to_hpos_vpos (w, x, y, hpos, vpos, dx, dy, area)
-     struct window *w;
-     int x, y;
-     int *hpos, *vpos, *dx, *dy, *area;
+x_y_to_hpos_vpos (struct window *w, int x, int y, int *hpos, int *vpos,
+                 int *dx, int *dy, int *area)
 {
   struct glyph *glyph, *end;
   struct glyph_row *row = NULL;
@@ -1849,9 +1866,7 @@ x_y_to_hpos_vpos (w, x, y, hpos, vpos, dx, dy, area)
    Takes pseudo-windows into account.  */
 
 void
-frame_to_window_pixel_xy (w, x, y)
-     struct window *w;
-     int *x, *y;
+frame_to_window_pixel_xy (struct window *w, int *x, int *y)
 {
   if (w->pseudo_window_p)
     {
@@ -1873,10 +1888,7 @@ frame_to_window_pixel_xy (w, x, y)
    Return the number of stored rectangles.  */
 
 int
-get_glyph_string_clip_rects (s, rects, n)
-     struct glyph_string *s;
-     NativeRectangle *rects;
-     int n;
+get_glyph_string_clip_rects (struct glyph_string *s, NativeRectangle *rects, int n)
 {
   XRectangle r;
 
@@ -2070,9 +2082,7 @@ get_glyph_string_clip_rects (s, rects, n)
    Return in *NR the clipping rectangle for glyph string S.  */
 
 void
-get_glyph_string_clip_rect (s, nr)
-     struct glyph_string *s;
-     NativeRectangle *nr;
+get_glyph_string_clip_rect (struct glyph_string *s, NativeRectangle *nr)
 {
   get_glyph_string_clip_rects (s, nr, 1);
 }
@@ -2084,11 +2094,8 @@ get_glyph_string_clip_rect (s, nr)
 */
 
 void
-get_phys_cursor_geometry (w, row, glyph, xp, yp, heightp)
-     struct window *w;
-     struct glyph_row *row;
-     struct glyph *glyph;
-     int *xp, *yp, *heightp;
+get_phys_cursor_geometry (struct window *w, struct glyph_row *row,
+                         struct glyph *glyph, int *xp, int *yp, int *heightp)
 {
   struct frame *f = XFRAME (WINDOW_FRAME (w));
   int x, y, wd, h, h0, y0;
@@ -2148,10 +2155,7 @@ get_phys_cursor_geometry (w, row, glyph, xp, yp, heightp)
  */
 
 void
-remember_mouse_glyph (f, gx, gy, rect)
-     struct frame *f;
-     int gx, gy;
-     NativeRectangle *rect;
+remember_mouse_glyph (struct frame *f, int gx, int gy, NativeRectangle *rect)
 {
   Lisp_Object window;
   struct window *w;
@@ -2347,8 +2351,7 @@ remember_mouse_glyph (f, gx, gy, rect)
 /* Error handler for safe_eval and safe_call.  */
 
 static Lisp_Object
-safe_eval_handler (arg)
-     Lisp_Object arg;
+safe_eval_handler (Lisp_Object arg)
 {
   add_to_log ("Error during redisplay: %s", arg, Qnil);
   return Qnil;
@@ -2363,9 +2366,7 @@ safe_eval_handler (arg)
    redisplay during the evaluation.  */
 
 Lisp_Object
-safe_call (nargs, args)
-     int nargs;
-     Lisp_Object *args;
+safe_call (int nargs, Lisp_Object *args)
 {
   Lisp_Object val;
 
@@ -2381,7 +2382,7 @@ safe_call (nargs, args)
       specbind (Qinhibit_redisplay, Qt);
       /* Use Qt to ensure debugger does not run,
         so there is no possibility of wanting to redisplay.  */
-      val = internal_condition_case_2 (Ffuncall, nargs, args, Qt,
+      val = internal_condition_case_n (Ffuncall, nargs, args, Qt,
                                       safe_eval_handler);
       UNGCPRO;
       val = unbind_to (count, val);
@@ -2395,8 +2396,7 @@ safe_call (nargs, args)
    Return the result, or nil if something went wrong.  */
 
 Lisp_Object
-safe_call1 (fn, arg)
-     Lisp_Object fn, arg;
+safe_call1 (Lisp_Object fn, Lisp_Object arg)
 {
   Lisp_Object args[2];
   args[0] = fn;
@@ -2525,12 +2525,9 @@ check_window_end (w)
    the desired matrix of W.  */
 
 void
-init_iterator (it, w, charpos, bytepos, row, base_face_id)
-     struct it *it;
-     struct window *w;
-     int charpos, bytepos;
-     struct glyph_row *row;
-     enum face_id base_face_id;
+init_iterator (struct it *it, struct window *w,
+              EMACS_INT charpos, EMACS_INT 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;
@@ -2566,7 +2563,7 @@ init_iterator (it, w, charpos, bytepos, row, base_face_id)
     }
 
   /* Clear IT.  */
-  bzero (it, sizeof *it);
+  memset (it, 0, sizeof *it);
   it->current.overlay_string_index = -1;
   it->current.dpvec_index = -1;
   it->base_face_id = remapped_base_face_id;
@@ -2628,6 +2625,13 @@ init_iterator (it, w, charpos, bytepos, row, base_face_id)
   /* Are multibyte characters enabled in current_buffer?  */
   it->multibyte_p = !NILP (current_buffer->enable_multibyte_characters);
 
+  /* Do we need to reorder bidirectional text?  Not if this is a
+     unibyte buffer: by definition, none of the single-byte characters
+     are strong R2L, so no reordering is needed.  And bidi.c doesn't
+     support unibyte buffers anyway.  */
+  it->bidi_p
+    = !NILP (current_buffer->bidi_display_reordering) && it->multibyte_p;
+
   /* Non-zero if we should highlight the region.  */
   highlight_region_p
     = (!NILP (Vtransient_mark_mode)
@@ -2718,6 +2722,10 @@ init_iterator (it, w, charpos, bytepos, row, base_face_id)
   it->glyph_row = row;
   it->area = TEXT_AREA;
 
+  /* Forget any previous info about this row being reversed.  */
+  if (it->glyph_row)
+    it->glyph_row->reversed_p = 0;
+
   /* Get the dimensions of the display area.  The display area
      consists of the visible window area plus a horizontally scrolled
      part to the left of the window.  All x-values are relative to the
@@ -2773,6 +2781,21 @@ init_iterator (it, w, charpos, bytepos, row, base_face_id)
        it->start_of_box_run_p = 1;
     }
 
+  /* If we are to reorder bidirectional text, init the bidi
+     iterator.  */
+  if (it->bidi_p)
+    {
+      /* Note the paragraph direction that this buffer wants to
+        use.  */
+      if (EQ (current_buffer->bidi_paragraph_direction, Qleft_to_right))
+       it->paragraph_embedding = L2R;
+      else if (EQ (current_buffer->bidi_paragraph_direction, Qright_to_left))
+       it->paragraph_embedding = R2L;
+      else
+       it->paragraph_embedding = NEUTRAL_DIR;
+      bidi_init_it (charpos, bytepos, &it->bidi_it);
+    }
+
   /* If a buffer position was specified, set the iterator there,
      getting overlays and face properties from that position.  */
   if (charpos >= BUF_BEG (current_buffer))
@@ -2800,10 +2823,7 @@ init_iterator (it, w, charpos, bytepos, row, base_face_id)
 /* Initialize IT for the display of window W with window start POS.  */
 
 void
-start_display (it, w, pos)
-     struct it *it;
-     struct window *w;
-     struct text_pos pos;
+start_display (struct it *it, struct window *w, struct text_pos pos)
 {
   struct glyph_row *row;
   int first_vpos = WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0;
@@ -2875,9 +2895,7 @@ start_display (it, w, pos)
    text.  W is the window we display, for text property lookup.  */
 
 static int
-in_ellipses_for_invisible_text_p (pos, w)
-     struct display_pos *pos;
-     struct window *w;
+in_ellipses_for_invisible_text_p (struct display_pos *pos, struct window *w)
 {
   Lisp_Object prop, window;
   int ellipses_p = 0;
@@ -2911,12 +2929,9 @@ in_ellipses_for_invisible_text_p (pos, w)
    is zero if there are overlay strings with newlines at POS.  */
 
 static int
-init_from_display_pos (it, w, pos)
-     struct it *it;
-     struct window *w;
-     struct display_pos *pos;
+init_from_display_pos (struct it *it, struct window *w, struct display_pos *pos)
 {
-  int charpos = CHARPOS (pos->pos), bytepos = BYTEPOS (pos->pos);
+  EMACS_INT 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
@@ -3022,10 +3037,7 @@ init_from_display_pos (it, w, pos)
    starting at ROW->start.  */
 
 static void
-init_to_row_start (it, w, row)
-     struct it *it;
-     struct window *w;
-     struct glyph_row *row;
+init_to_row_start (struct it *it, struct window *w, struct glyph_row *row)
 {
   init_from_display_pos (it, w, &row->start);
   it->start = row->start;
@@ -3040,10 +3052,7 @@ init_to_row_start (it, w, row)
    end position.  */
 
 static int
-init_to_row_end (it, w, row)
-     struct it *it;
-     struct window *w;
-     struct glyph_row *row;
+init_to_row_end (struct it *it, struct window *w, struct glyph_row *row)
 {
   int success = 0;
 
@@ -3071,8 +3080,7 @@ init_to_row_end (it, w, row)
    to stop.  */
 
 static void
-handle_stop (it)
-     struct it *it;
+handle_stop (struct it *it)
 {
   enum prop_handled handled;
   int handle_overlay_change_p;
@@ -3165,12 +3173,11 @@ handle_stop (it)
    information for IT's current position.  */
 
 static void
-compute_stop_pos (it)
-     struct it *it;
+compute_stop_pos (struct it *it)
 {
   register INTERVAL iv, next_iv;
   Lisp_Object object, limit, position;
-  EMACS_INT charpos, bytepos;
+  EMACS_INT charpos, bytepos, stoppos;
 
   /* If nowhere else, stop at the end.  */
   it->stop_charpos = it->end_charpos;
@@ -3260,8 +3267,12 @@ compute_stop_pos (it)
        }
     }
 
+  if (it->bidi_p && it->bidi_it.scan_dir < 0)
+    stoppos = -1;
+  else
+    stoppos = it->stop_charpos;
   composition_compute_stop_pos (&it->cmp_it, charpos, bytepos,
-                               it->stop_charpos, it->string);
+                               stoppos, it->string);
 
   xassert (STRINGP (it->string)
           || (it->stop_charpos >= BEGV
@@ -3275,8 +3286,7 @@ compute_stop_pos (it)
    xmalloc.  */
 
 static EMACS_INT
-next_overlay_change (pos)
-     EMACS_INT pos;
+next_overlay_change (EMACS_INT pos)
 {
   int noverlays;
   EMACS_INT endpos;
@@ -3312,8 +3322,7 @@ next_overlay_change (pos)
    regions of text.  */
 
 static enum prop_handled
-handle_fontified_prop (it)
-     struct it *it;
+handle_fontified_prop (struct it *it)
 {
   Lisp_Object prop, pos;
   enum prop_handled handled = HANDLED_NORMALLY;
@@ -3400,8 +3409,7 @@ handle_fontified_prop (it)
    Called from handle_stop.  */
 
 static enum prop_handled
-handle_face_prop (it)
-     struct it *it;
+handle_face_prop (struct it *it)
 {
   int new_face_id;
   EMACS_INT next_stop;
@@ -3539,8 +3547,7 @@ handle_face_prop (it)
    Otherwise, use the iterator's base_face_id.  */
 
 static int
-underlying_face_id (it)
-     struct it *it;
+underlying_face_id (struct it *it)
 {
   int face_id = it->base_face_id, i;
 
@@ -3559,9 +3566,7 @@ underlying_face_id (it)
    position.  Value is the id of the face.  */
 
 static int
-face_before_or_after_it_pos (it, before_p)
-     struct it *it;
-     int before_p;
+face_before_or_after_it_pos (struct it *it, int before_p)
 {
   int face_id, limit;
   EMACS_INT next_check_charpos;
@@ -3675,14 +3680,12 @@ face_before_or_after_it_pos (it, before_p)
    position.  Called from handle_stop.  */
 
 static enum prop_handled
-handle_invisible_prop (it)
-     struct it *it;
+handle_invisible_prop (struct it *it)
 {
   enum prop_handled handled = HANDLED_NORMALLY;
 
   if (STRINGP (it->string))
     {
-      extern Lisp_Object Qinvisible;
       Lisp_Object prop, end_charpos, limit, charpos;
 
       /* Get the value of the invisible text property at the
@@ -3738,18 +3741,18 @@ handle_invisible_prop (it)
   else
     {
       int invis_p;
-      EMACS_INT newpos, next_stop, start_charpos;
+      EMACS_INT newpos, next_stop, start_charpos, tem;
       Lisp_Object pos, prop, overlay;
 
       /* First of all, is there invisible text at this position?  */
-      start_charpos = IT_CHARPOS (*it);
-      pos = make_number (IT_CHARPOS (*it));
+      tem = start_charpos = IT_CHARPOS (*it);
+      pos = make_number (tem);
       prop = get_char_property_and_overlay (pos, Qinvisible, it->window,
                                            &overlay);
       invis_p = TEXT_PROP_MEANS_INVISIBLE (prop);
 
       /* If we are on invisible text, skip over it.  */
-      if (invis_p && IT_CHARPOS (*it) < it->end_charpos)
+      if (invis_p && start_charpos < it->end_charpos)
        {
          /* Record whether we have to display an ellipsis for the
             invisible text.  */
@@ -3762,17 +3765,16 @@ handle_invisible_prop (it)
          do
            {
              /* Try to skip some invisible text.  Return value is the
-                position reached which can be equal to IT's position
-                if there is nothing invisible here.  This skips both
+                position reached which can be equal to where we start
+                if there is nothing invisible there.  This skips both
                 over invisible text properties and overlays with
                 invisible property.  */
-             newpos = skip_invisible (IT_CHARPOS (*it),
-                                      &next_stop, ZV, it->window);
+             newpos = skip_invisible (tem, &next_stop, ZV, it->window);
 
              /* If we skipped nothing at all we weren't at invisible
                 text in the first place.  If everything to the end of
                 the buffer was skipped, end the loop.  */
-             if (newpos == IT_CHARPOS (*it) || newpos >= ZV)
+             if (newpos == tem || newpos >= ZV)
                invis_p = 0;
              else
                {
@@ -3790,7 +3792,7 @@ handle_invisible_prop (it)
              /* If we ended up on invisible text, proceed to
                 skip starting with next_stop.  */
              if (invis_p)
-               IT_CHARPOS (*it) = next_stop;
+               tem = next_stop;
 
               /* If there are adjacent invisible texts, don't lose the
                  second one's ellipsis. */
@@ -3800,8 +3802,47 @@ handle_invisible_prop (it)
          while (invis_p);
 
          /* The position newpos is now either ZV or on visible text.  */
-         IT_CHARPOS (*it) = newpos;
-         IT_BYTEPOS (*it) = CHAR_TO_BYTE (newpos);
+         if (it->bidi_p && newpos < ZV)
+           {
+             /* With bidi iteration, the region of invisible text
+                could start and/or end in the middle of a non-base
+                embedding level.  Therefore, we need to skip
+                invisible text using the bidi iterator, starting at
+                IT's current position, until we find ourselves
+                outside the invisible text.  Skipping invisible text
+                _after_ bidi iteration avoids affecting the visual
+                order of the displayed text when invisible properties
+                are added or removed.  */
+             if (it->bidi_it.first_elt)
+               {
+                 /* If we were `reseat'ed to a new paragraph,
+                    determine the paragraph base direction.  We need
+                    to do it now because next_element_from_buffer may
+                    not have a chance to do it, if we are going to
+                    skip any text at the beginning, which resets the
+                    FIRST_ELT flag.  */
+                 bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it);
+               }
+             do
+               {
+                 bidi_move_to_visually_next (&it->bidi_it);
+               }
+             while (it->stop_charpos <= it->bidi_it.charpos
+                    && it->bidi_it.charpos < newpos);
+             IT_CHARPOS (*it) = it->bidi_it.charpos;
+             IT_BYTEPOS (*it) = it->bidi_it.bytepos;
+             /* If we overstepped NEWPOS, record its position in the
+                iterator, so that we skip invisible text if later the
+                bidi iteration lands us in the invisible region
+                again. */
+             if (IT_CHARPOS (*it) >= newpos)
+               it->prev_stop = newpos;
+           }
+         else
+           {
+             IT_CHARPOS (*it) = newpos;
+             IT_BYTEPOS (*it) = CHAR_TO_BYTE (newpos);
+           }
 
          /* If there are before-strings at the start of invisible
             text, and the text is invisible because of a text
@@ -3810,7 +3851,7 @@ handle_invisible_prop (it)
             overlay property instead of a text property, this is
             already handled in the overlay code.)  */
          if (NILP (overlay)
-             && get_overlay_strings (it, start_charpos))
+             && get_overlay_strings (it, it->stop_charpos))
            {
              handled = HANDLED_RECOMPUTE_PROPS;
              it->stack[it->sp - 1].display_ellipsis_p = display_ellipsis_p;
@@ -3831,7 +3872,7 @@ handle_invisible_prop (it)
                  first invisible character.  */
              if (!STRINGP (it->object))
                {
-                 it->position.charpos = IT_CHARPOS (*it) - 1;
+                 it->position.charpos = newpos - 1;
                  it->position.bytepos = CHAR_TO_BYTE (it->position.charpos);
                }
              it->ellipsis_p = 1;
@@ -3851,9 +3892,7 @@ handle_invisible_prop (it)
    Replaces LEN characters from buffer.  */
 
 static void
-setup_for_ellipsis (it, len)
-     struct it *it;
-     int len;
+setup_for_ellipsis (struct it *it, int len)
 {
   /* Use the display table definition for `...'.  Invalid glyphs
      will be handled by the method returning elements from dpvec.  */
@@ -3897,8 +3936,7 @@ setup_for_ellipsis (it, len)
    Otherwise we return HANDLED_NORMALLY.  */
 
 static enum prop_handled
-handle_display_prop (it)
-     struct it *it;
+handle_display_prop (struct it *it)
 {
   Lisp_Object prop, object, overlay;
   struct text_pos *position;
@@ -3995,10 +4033,7 @@ handle_display_prop (it)
    at START_POS in OBJECT.  */
 
 static struct text_pos
-display_prop_end (it, object, start_pos)
-     struct it *it;
-     Lisp_Object object;
-     struct text_pos start_pos;
+display_prop_end (struct it *it, Lisp_Object object, struct text_pos start_pos)
 {
   Lisp_Object end;
   struct text_pos end_pos;
@@ -4033,14 +4068,9 @@ display_prop_end (it, object, start_pos)
    of buffer or string text.  */
 
 static int
-handle_single_display_spec (it, spec, object, overlay, position,
-                           display_replaced_before_p)
-     struct it *it;
-     Lisp_Object spec;
-     Lisp_Object object;
-     Lisp_Object overlay;
-     struct text_pos *position;
-     int display_replaced_before_p;
+handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
+                           Lisp_Object overlay, struct text_pos *position,
+                           int display_replaced_before_p)
 {
   Lisp_Object form;
   Lisp_Object location, value;
@@ -4405,8 +4435,7 @@ handle_single_display_spec (it, spec, object, overlay, position,
    treated as intangible.  */
 
 static int
-single_display_spec_intangible_p (prop)
-     Lisp_Object prop;
+single_display_spec_intangible_p (Lisp_Object prop)
 {
   /* Skip over `when FORM'.  */
   if (CONSP (prop) && EQ (XCAR (prop), Qwhen))
@@ -4448,8 +4477,7 @@ single_display_spec_intangible_p (prop)
    treated as intangible.  */
 
 int
-display_prop_intangible_p (prop)
-     Lisp_Object prop;
+display_prop_intangible_p (Lisp_Object prop)
 {
   if (CONSP (prop)
       && CONSP (XCAR (prop))
@@ -4481,8 +4509,7 @@ display_prop_intangible_p (prop)
 /* Return 1 if PROP is a display sub-property value containing STRING.  */
 
 static int
-single_display_spec_string_p (prop, string)
-     Lisp_Object prop, string;
+single_display_spec_string_p (Lisp_Object prop, Lisp_Object string)
 {
   if (EQ (string, prop))
     return 1;
@@ -4516,8 +4543,7 @@ single_display_spec_string_p (prop, string)
 /* Return 1 if STRING appears in the `display' property PROP.  */
 
 static int
-display_prop_string_p (prop, string)
-     Lisp_Object prop, string;
+display_prop_string_p (Lisp_Object prop, Lisp_Object string)
 {
   if (CONSP (prop)
       && CONSP (XCAR (prop))
@@ -4545,43 +4571,43 @@ display_prop_string_p (prop, string)
   return 0;
 }
 
-
-/* Determine which buffer position in W's buffer STRING comes from.
-   AROUND_CHARPOS is an approximate position where it could come from.
-   Value is the buffer position or 0 if it couldn't be determined.
+/* Look for STRING in overlays and text properties in W's buffer,
+   between character positions FROM and TO (excluding TO).
+   BACK_P non-zero means look back (in this case, TO is supposed to be
+   less than FROM).
+   Value is the first character position where STRING was found, or
+   zero if it wasn't found before hitting TO.
 
    W's buffer must be current.
 
-   This function is necessary because we don't record buffer positions
-   in glyphs generated from strings (to keep struct glyph small).
    This function may only use code that doesn't eval because it is
    called asynchronously from note_mouse_highlight.  */
 
-int
-string_buffer_position (w, string, around_charpos)
-     struct window *w;
-     Lisp_Object string;
-     int around_charpos;
+static EMACS_INT
+string_buffer_position_lim (struct window *w, Lisp_Object string,
+                           EMACS_INT from, EMACS_INT to, int back_p)
 {
   Lisp_Object limit, prop, pos;
-  const int MAX_DISTANCE = 1000;
   int found = 0;
 
-  pos = make_number (around_charpos);
-  limit = make_number (min (XINT (pos) + MAX_DISTANCE, ZV));
-  while (!found && !EQ (pos, limit))
+  pos = make_number (from);
+
+  if (!back_p) /* looking forward */
     {
-      prop = Fget_char_property (pos, Qdisplay, Qnil);
-      if (!NILP (prop) && display_prop_string_p (prop, string))
-       found = 1;
-      else
-       pos = Fnext_single_char_property_change (pos, Qdisplay, Qnil, limit);
+      limit = make_number (min (to, ZV));
+      while (!found && !EQ (pos, limit))
+       {
+         prop = Fget_char_property (pos, Qdisplay, Qnil);
+         if (!NILP (prop) && display_prop_string_p (prop, string))
+           found = 1;
+         else
+           pos = Fnext_single_char_property_change (pos, Qdisplay, Qnil,
+                                                    limit);
+       }
     }
-
-  if (!found)
+  else         /* looking back */
     {
-      pos = make_number (around_charpos);
-      limit = make_number (max (XINT (pos) - MAX_DISTANCE, BEGV));
+      limit = make_number (max (to, BEGV));
       while (!found && !EQ (pos, limit))
        {
          prop = Fget_char_property (pos, Qdisplay, Qnil);
@@ -4596,6 +4622,32 @@ string_buffer_position (w, string, around_charpos)
   return found ? XINT (pos) : 0;
 }
 
+/* Determine which buffer position in W's buffer STRING comes from.
+   AROUND_CHARPOS is an approximate position where it could come from.
+   Value is the buffer position or 0 if it couldn't be determined.
+
+   W's buffer must be current.
+
+   This function is necessary because we don't record buffer positions
+   in glyphs generated from strings (to keep struct glyph small).
+   This function may only use code that doesn't eval because it is
+   called asynchronously from note_mouse_highlight.  */
+
+EMACS_INT
+string_buffer_position (struct window *w, Lisp_Object string, EMACS_INT around_charpos)
+{
+  Lisp_Object limit, prop, pos;
+  const int MAX_DISTANCE = 1000;
+  EMACS_INT found = string_buffer_position_lim (w, string, around_charpos,
+                                               around_charpos + MAX_DISTANCE,
+                                               0);
+
+  if (!found)
+    found = string_buffer_position_lim (w, string, around_charpos,
+                                       around_charpos - MAX_DISTANCE, 1);
+  return found;
+}
+
 
 \f
 /***********************************************************************
@@ -4606,8 +4658,7 @@ string_buffer_position (w, string, around_charpos)
    position.  Called from handle_stop.  */
 
 static enum prop_handled
-handle_composition_prop (it)
-     struct it *it;
+handle_composition_prop (struct it *it)
 {
   Lisp_Object prop, string;
   EMACS_INT pos, pos_byte, start, end;
@@ -4680,8 +4731,7 @@ struct overlay_entry
    Called from handle_stop.  */
 
 static enum prop_handled
-handle_overlay_change (it)
-     struct it *it;
+handle_overlay_change (struct it *it)
 {
   if (!STRINGP (it->string) && get_overlay_strings (it, 0))
     return HANDLED_RECOMPUTE_PROPS;
@@ -4698,8 +4748,7 @@ handle_overlay_change (it)
    Otherwise IT->string is set to nil.  */
 
 static void
-next_overlay_string (it)
-     struct it *it;
+next_overlay_string (struct it *it)
 {
   ++it->current.overlay_string_index;
   if (it->current.overlay_string_index == it->n_overlay_strings)
@@ -4767,8 +4816,7 @@ next_overlay_string (it)
 
 
 static int
-compare_overlay_entries (e1, e2)
-     void *e1, *e2;
+compare_overlay_entries (const void *e1, const void *e2)
 {
   struct overlay_entry *entry1 = (struct overlay_entry *) e1;
   struct overlay_entry *entry2 = (struct overlay_entry *) e2;
@@ -4819,11 +4867,8 @@ compare_overlay_entries (e1, e2)
    compare_overlay_entries.  */
 
 static void
-load_overlay_strings (it, charpos)
-     struct it *it;
-     int charpos;
+load_overlay_strings (struct it *it, int charpos)
 {
-  extern Lisp_Object Qwindow, Qpriority;
   Lisp_Object overlay, window, str, invisible;
   struct Lisp_Overlay *ov;
   int start, end;
@@ -4851,7 +4896,7 @@ load_overlay_strings (it, charpos)
          entries =                                                     \
             (struct overlay_entry *) alloca (new_size                  \
                                             * sizeof *entries);        \
-         bcopy (old, entries, size * sizeof *entries);                 \
+         memcpy (entries, old, size * sizeof *entries);                \
          size = new_size;                                              \
        }                                                               \
                                                                        \
@@ -4972,10 +5017,7 @@ load_overlay_strings (it, charpos)
    least one overlay string was found.  */
 
 static int
-get_overlay_strings_1 (it, charpos, compute_stop_p)
-     struct it *it;
-     int charpos;
-     int compute_stop_p;
+get_overlay_strings_1 (struct it *it, int 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
@@ -5026,9 +5068,7 @@ get_overlay_strings_1 (it, charpos, compute_stop_p)
 }
 
 static int
-get_overlay_strings (it, charpos)
-     struct it *it;
-     int charpos;
+get_overlay_strings (struct it *it, int charpos)
 {
   it->string = Qnil;
   it->method = GET_FROM_BUFFER;
@@ -5053,8 +5093,7 @@ get_overlay_strings (it, charpos)
    processed.  */
 
 static void
-push_it (it)
-     struct it *it;
+push_it (struct it *it)
 {
   struct iterator_stack_entry *p;
 
@@ -5062,6 +5101,8 @@ push_it (it)
   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);
   p->face_id = it->face_id;
@@ -5095,6 +5136,32 @@ push_it (it)
   ++it->sp;
 }
 
+static void
+iterate_out_of_display_property (struct it *it)
+{
+  /* Maybe initialize paragraph direction.  If we are at the beginning
+     of a new paragraph, next_element_from_buffer may not have a
+     chance to do that.  */
+  if (it->bidi_it.first_elt && it->bidi_it.charpos < ZV)
+    bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it);
+  /* prev_stop can be zero, so check against BEGV as well.  */
+  while (it->bidi_it.charpos >= BEGV
+        && it->prev_stop <= it->bidi_it.charpos
+        && it->bidi_it.charpos < CHARPOS (it->position))
+    bidi_move_to_visually_next (&it->bidi_it);
+  /* Record the stop_pos we just crossed, for when we cross it
+     back, maybe.  */
+  if (it->bidi_it.charpos > CHARPOS (it->position))
+    it->prev_stop = CHARPOS (it->position);
+  /* If we ended up not where pop_it put us, resync IT's
+     positional members with the bidi iterator. */
+  if (it->bidi_it.charpos != CHARPOS (it->position))
+    {
+      SET_TEXT_POS (it->position,
+                   it->bidi_it.charpos, it->bidi_it.bytepos);
+      it->current.pos = it->position;
+    }
+}
 
 /* Restore IT's settings from IT->stack.  Called, for example, when no
    more overlay strings must be processed, and we return to delivering
@@ -5103,8 +5170,7 @@ push_it (it)
    elements from an overlay string, or from a buffer.  */
 
 static void
-pop_it (it)
-     struct it *it;
+pop_it (struct it *it)
 {
   struct iterator_stack_entry *p;
 
@@ -5112,6 +5178,8 @@ pop_it (it)
   --it->sp;
   p = it->stack + it->sp;
   it->stop_charpos = p->stop_charpos;
+  it->prev_stop = p->prev_stop;
+  it->base_level_stop = p->base_level_stop;
   it->cmp_it = p->cmp_it;
   it->face_id = p->face_id;
   it->current = p->current;
@@ -5133,6 +5201,18 @@ pop_it (it)
       break;
     case GET_FROM_BUFFER:
       it->object = it->w->buffer;
+      if (it->bidi_p)
+       {
+         /* Bidi-iterate until we get out of the portion of text, if
+            any, covered by a `display' text property or an overlay
+            with `display' property.  (We cannot just jump there,
+            because the internal coherency of the bidi iterator state
+            can not be preserved across such jumps.)  We also must
+            determine the paragraph base direction if the overlay we
+            just processed is at the beginning of a new
+            paragraph.  */
+         iterate_out_of_display_property (it);
+       }
       break;
     case GET_FROM_STRING:
       it->object = it->string;
@@ -5169,8 +5249,7 @@ pop_it (it)
 /* Set IT's current position to the previous line start.  */
 
 static void
-back_to_previous_line_start (it)
-     struct it *it;
+back_to_previous_line_start (struct it *it)
 {
   IT_CHARPOS (*it) = find_next_newline_no_quit (IT_CHARPOS (*it) - 1, -1);
   IT_BYTEPOS (*it) = CHAR_TO_BYTE (IT_CHARPOS (*it));
@@ -5196,9 +5275,7 @@ back_to_previous_line_start (it)
    leads to wrong cursor motion.  */
 
 static int
-forward_to_next_line_start (it, skipped_p)
-     struct it *it;
-     int *skipped_p;
+forward_to_next_line_start (struct it *it, int *skipped_p)
 {
   int old_selective, newline_found_p, n;
   const int MAX_NEWLINE_DISTANCE = 500;
@@ -5279,8 +5356,7 @@ forward_to_next_line_start (it, skipped_p)
    IT->hpos.  */
 
 static void
-back_to_previous_visible_line_start (it)
-     struct it *it;
+back_to_previous_visible_line_start (struct it *it)
 {
   while (IT_CHARPOS (*it) > BEGV)
     {
@@ -5289,8 +5365,8 @@ back_to_previous_visible_line_start (it)
       if (IT_CHARPOS (*it) <= BEGV)
        break;
 
-      /* If selective > 0, then lines indented more than that values
-        are invisible.  */
+      /* If selective > 0, then lines indented more than its value are
+        invisible.  */
       if (it->selective > 0
          && indented_beyond_p (IT_CHARPOS (*it), IT_BYTEPOS (*it),
                                (double) it->selective)) /* iftc */
@@ -5360,8 +5436,7 @@ back_to_previous_visible_line_start (it)
    face information etc.  */
 
 void
-reseat_at_previous_visible_line_start (it)
-     struct it *it;
+reseat_at_previous_visible_line_start (struct it *it)
 {
   back_to_previous_visible_line_start (it);
   reseat (it, it->current.pos, 1);
@@ -5377,9 +5452,7 @@ reseat_at_previous_visible_line_start (it)
    is invisible because of text properties.  */
 
 static void
-reseat_at_next_visible_line_start (it, on_newline_p)
-     struct it *it;
-     int on_newline_p;
+reseat_at_next_visible_line_start (struct it *it, int on_newline_p)
 {
   int newline_found_p, skipped_p = 0;
 
@@ -5433,10 +5506,7 @@ reseat_at_next_visible_line_start (it, on_newline_p)
    IT->check_charpos of a property.  */
 
 static void
-reseat (it, pos, force_p)
-     struct it *it;
-     struct text_pos pos;
-     int force_p;
+reseat (struct it *it, struct text_pos pos, int force_p)
 {
   int original_pos = IT_CHARPOS (*it);
 
@@ -5447,7 +5517,30 @@ reseat (it, pos, force_p)
   if (force_p
       || CHARPOS (pos) > it->stop_charpos
       || CHARPOS (pos) < original_pos)
-    handle_stop (it);
+    {
+      if (it->bidi_p)
+       {
+         /* For bidi iteration, we need to prime prev_stop and
+            base_level_stop with our best estimations.  */
+         if (CHARPOS (pos) < it->prev_stop)
+           {
+             handle_stop_backwards (it, BEGV);
+             if (CHARPOS (pos) < it->base_level_stop)
+               it->base_level_stop = 0;
+           }
+         else if (CHARPOS (pos) > it->stop_charpos
+                  && it->stop_charpos >= BEGV)
+           handle_stop_backwards (it, it->stop_charpos);
+         else  /* force_p */
+           handle_stop (it);
+       }
+      else
+       {
+         handle_stop (it);
+         it->prev_stop = it->base_level_stop = 0;
+       }
+
+    }
 
   CHECK_IT (it);
 }
@@ -5457,10 +5550,7 @@ reseat (it, pos, force_p)
    IT->stop_pos to POS, also.  */
 
 static void
-reseat_1 (it, pos, set_stop_p)
-     struct it *it;
-     struct text_pos pos;
-     int set_stop_p;
+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);
@@ -5484,9 +5574,14 @@ reseat_1 (it, pos, set_stop_p)
   it->sp = 0;
   it->string_from_display_prop_p = 0;
   it->face_before_selective_p = 0;
+  if (it->bidi_p)
+    it->bidi_it.first_elt = 1;
 
   if (set_stop_p)
-    it->stop_charpos = CHARPOS (pos);
+    {
+      it->stop_charpos = CHARPOS (pos);
+      it->base_level_stop = CHARPOS (pos);
+    }
 }
 
 
@@ -5509,12 +5604,8 @@ reseat_1 (it, pos, set_stop_p)
    calling this function.  */
 
 static void
-reseat_to_string (it, s, string, charpos, precision, field_width, multibyte)
-     struct it *it;
-     unsigned char *s;
-     Lisp_Object string;
-     int charpos;
-     int precision, field_width, multibyte;
+reseat_to_string (struct it *it, const unsigned char *s, Lisp_Object string,
+                 int charpos, int precision, int field_width, int multibyte)
 {
   /* No region in strings.  */
   it->region_beg_charpos = it->region_end_charpos = -1;
@@ -5523,7 +5614,7 @@ reseat_to_string (it, s, string, charpos, precision, field_width, multibyte)
   it->stop_charpos = -1;
 
   /* Set iterator position and end position.  */
-  bzero (&it->current, sizeof it->current);
+  memset (&it->current, 0, sizeof it->current);
   it->current.overlay_string_index = -1;
   it->current.dpvec_index = -1;
   xassert (charpos >= 0);
@@ -5598,11 +5689,11 @@ reseat_to_string (it, s, string, charpos, precision, field_width, multibyte)
 \f
 /***********************************************************************
                              Iteration
- ***********************************************************************/
+***********************************************************************/
 
 /* Map enum it_method value to corresponding next_element_from_* function.  */
 
-static int (* get_next_element[NUM_IT_METHODS]) P_ ((struct it *it)) =
+static int (* get_next_element[NUM_IT_METHODS]) (struct it *it) =
 {
   next_element_from_buffer,
   next_element_from_display_vector,
@@ -5636,8 +5727,7 @@ static unsigned last_escape_glyph_face_id = (1 << FACE_ID_BITS);
 static int last_escape_glyph_merged_face_id = 0;
 
 int
-get_next_display_element (it)
-     struct it *it;
+get_next_display_element (struct it *it)
 {
   /* Non-zero means that we found a display element.  Zero means that
      we hit the end of what we iterate over.  Performance note: the
@@ -5650,6 +5740,13 @@ get_next_display_element (it)
 
   if (it->what == IT_CHARACTER)
     {
+      /* UAX#9, L4: "A character is depicted by a mirrored glyph if
+        and only if (a) the resolved directionality of that character
+        is R..."  */
+      /* FIXME: Do we need an exception for characters from display
+        tables?  */
+      if (it->bidi_p && it->bidi_it.type == STRONG_R)
+       it->c = bidi_mirror_char (it->c);
       /* Map via display table or translate control characters.
         IT->c, IT->len etc. have been set to the next character by
         the function call above.  If we have a display table, and it
@@ -5995,9 +6092,7 @@ get_next_display_element (it)
    decrement position function which would not be easy to write.  */
 
 void
-set_iterator_to_next (it, reseat_p)
-     struct it *it;
-     int reseat_p;
+set_iterator_to_next (struct it *it, int reseat_p)
 {
   /* Reset flags indicating start and end of a sequence of characters
      with box.  Reset them at the start of this function because
@@ -6014,23 +6109,113 @@ set_iterator_to_next (it, reseat_p)
        reseat_at_next_visible_line_start (it, 0);
       else if (it->cmp_it.id >= 0)
        {
-         IT_CHARPOS (*it) += it->cmp_it.nchars;
-         IT_BYTEPOS (*it) += it->cmp_it.nbytes;
-         if (it->cmp_it.to < it->cmp_it.nglyphs)
-           it->cmp_it.from = it->cmp_it.to;
+         /* We are currently getting glyphs from a composition.  */
+         int i;
+
+         if (! it->bidi_p)
+           {
+             IT_CHARPOS (*it) += it->cmp_it.nchars;
+             IT_BYTEPOS (*it) += it->cmp_it.nbytes;
+             if (it->cmp_it.to < it->cmp_it.nglyphs)
+               {
+                 it->cmp_it.from = it->cmp_it.to;
+               }
+             else
+               {
+                 it->cmp_it.id = -1;
+                 composition_compute_stop_pos (&it->cmp_it, IT_CHARPOS (*it),
+                                               IT_BYTEPOS (*it),
+                                               it->stop_charpos, Qnil);
+               }
+           }
+         else if (! it->cmp_it.reversed_p)
+           {
+             /* Composition created while scanning forward.  */
+             /* Update IT's char/byte positions to point to the first
+                character of the next grapheme cluster, or to the
+                character visually after the current composition.  */
+             for (i = 0; i < it->cmp_it.nchars; i++)
+               bidi_move_to_visually_next (&it->bidi_it);
+             IT_BYTEPOS (*it) = it->bidi_it.bytepos;
+             IT_CHARPOS (*it) = it->bidi_it.charpos;
+
+             if (it->cmp_it.to < it->cmp_it.nglyphs)
+               {
+                 /* Proceed to the next grapheme cluster.  */
+                 it->cmp_it.from = it->cmp_it.to;
+               }
+             else
+               {
+                 /* No more grapheme clusters in this composition.
+                    Find the next stop position.  */
+                 EMACS_INT stop = it->stop_charpos;
+                 if (it->bidi_it.scan_dir < 0)
+                   /* Now we are scanning backward and don't know
+                      where to stop.  */
+                   stop = -1;
+                 composition_compute_stop_pos (&it->cmp_it, IT_CHARPOS (*it),
+                                               IT_BYTEPOS (*it), stop, Qnil);
+               }
+           }
          else
            {
-             it->cmp_it.id = -1;
-             composition_compute_stop_pos (&it->cmp_it, IT_CHARPOS (*it),
-                                           IT_BYTEPOS (*it), it->stop_charpos,
-                                           Qnil);
+             /* Composition created while scanning backward.  */
+             /* Update IT's char/byte positions to point to the last
+                character of the previous grapheme cluster, or the
+                character visually after the current composition.  */
+             for (i = 0; i < it->cmp_it.nchars; i++)
+               bidi_move_to_visually_next (&it->bidi_it);
+             IT_BYTEPOS (*it) = it->bidi_it.bytepos;
+             IT_CHARPOS (*it) = it->bidi_it.charpos;
+             if (it->cmp_it.from > 0)
+               {
+                 /* Proceed to the previous grapheme cluster.  */
+                 it->cmp_it.to = it->cmp_it.from;
+               }
+             else
+               {
+                 /* No more grapheme clusters in this composition.
+                    Find the next stop position.  */
+                 EMACS_INT stop = it->stop_charpos;
+                 if (it->bidi_it.scan_dir < 0)
+                   /* Now we are scanning backward and don't know
+                      where to stop.  */
+                   stop = -1;
+                 composition_compute_stop_pos (&it->cmp_it, IT_CHARPOS (*it),
+                                               IT_BYTEPOS (*it), stop, Qnil);
+               }
            }
        }
       else
        {
          xassert (it->len != 0);
-         IT_BYTEPOS (*it) += it->len;
-         IT_CHARPOS (*it) += 1;
+
+         if (!it->bidi_p)
+           {
+             IT_BYTEPOS (*it) += it->len;
+             IT_CHARPOS (*it) += 1;
+           }
+         else
+           {
+             int prev_scan_dir = it->bidi_it.scan_dir;
+             /* If this is a new paragraph, determine its base
+                direction (a.k.a. its base embedding level).  */
+             if (it->bidi_it.new_paragraph)
+               bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it);
+             bidi_move_to_visually_next (&it->bidi_it);
+             IT_BYTEPOS (*it) = it->bidi_it.bytepos;
+             IT_CHARPOS (*it) = it->bidi_it.charpos;
+             if (prev_scan_dir != it->bidi_it.scan_dir)
+               {
+                 /* As the scan direction was changed, we must
+                    re-compute the stop position for composition.  */
+                 EMACS_INT stop = it->stop_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)));
        }
       break;
@@ -6172,8 +6357,7 @@ set_iterator_to_next (it, reseat_p)
    is restored into IT->face_id in set_iterator_to_next.  */
 
 static int
-next_element_from_display_vector (it)
-     struct it *it;
+next_element_from_display_vector (struct it *it)
 {
   Lisp_Object gc;
 
@@ -6183,7 +6367,7 @@ next_element_from_display_vector (it)
   it->face_id = it->saved_face_id;
 
   /* KFS: This code used to check ip->dpvec[0] instead of the current element.
-          That seemed totally bogus - so I changed 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))
@@ -6222,8 +6406,7 @@ next_element_from_display_vector (it)
    overlay string.  */
 
 static int
-next_element_from_string (it)
-     struct it *it;
+next_element_from_string (struct it *it)
 {
   struct text_pos position;
 
@@ -6324,8 +6507,7 @@ next_element_from_string (it)
    reached, including padding spaces.  */
 
 static int
-next_element_from_c_string (it)
-     struct it *it;
+next_element_from_c_string (struct it *it)
 {
   int success_p = 1;
 
@@ -6370,8 +6552,7 @@ next_element_from_c_string (it)
    ellipsis if an ellipsis is to be displayed.  */
 
 static int
-next_element_from_ellipsis (it)
-     struct it *it;
+next_element_from_ellipsis (struct it *it)
 {
   if (it->selective_display_ellipsis_p)
     setup_for_ellipsis (it, it->len);
@@ -6398,8 +6579,7 @@ next_element_from_ellipsis (it)
 
 
 static int
-next_element_from_image (it)
-     struct it *it;
+next_element_from_image (struct it *it)
 {
   it->what = IT_IMAGE;
   it->ignore_overlay_strings_at_pos_p = 0;
@@ -6412,13 +6592,52 @@ next_element_from_image (it)
    always 1.  */
 
 static int
-next_element_from_stretch (it)
-     struct it *it;
+next_element_from_stretch (struct it *it)
 {
   it->what = IT_STRETCH;
   return 1;
 }
 
+/* Scan forward from CHARPOS in the current buffer, until we find a
+   stop position > current IT's position.  Then handle the stop
+   position before that.  This is called when we bump into a stop
+   position while reordering bidirectional text.  CHARPOS should be
+   the last previously processed stop_pos (or BEGV, if none were
+   processed yet) whose position is less that IT's current
+   position.  */
+
+static void
+handle_stop_backwards (struct it *it, EMACS_INT charpos)
+{
+  EMACS_INT where_we_are = IT_CHARPOS (*it);
+  struct display_pos save_current = it->current;
+  struct text_pos save_position = it->position;
+  struct text_pos pos1;
+  EMACS_INT next_stop;
+
+  /* Scan in strict logical order.  */
+  it->bidi_p = 0;
+  do
+    {
+      it->prev_stop = charpos;
+      SET_TEXT_POS (pos1, charpos, CHAR_TO_BYTE (charpos));
+      reseat_1 (it, pos1, 0);
+      compute_stop_pos (it);
+      /* We must advance forward, right?  */
+      if (it->stop_charpos <= it->prev_stop)
+       abort ();
+      charpos = it->stop_charpos;
+    }
+  while (charpos <= where_we_are);
+
+  next_stop = it->stop_charpos;
+  it->stop_charpos = it->prev_stop;
+  it->bidi_p = 1;
+  it->current = save_current;
+  it->position = save_position;
+  handle_stop (it);
+  it->stop_charpos = next_stop;
+}
 
 /* Load IT with the next display element from current_buffer.  Value
    is zero if end of buffer reached.  IT->stop_charpos is the next
@@ -6426,13 +6645,73 @@ next_element_from_stretch (it)
    end.  */
 
 static int
-next_element_from_buffer (it)
-     struct it *it;
+next_element_from_buffer (struct it *it)
 {
   int success_p = 1;
 
   xassert (IT_CHARPOS (*it) >= BEGV);
 
+  /* With bidi reordering, the character to display might not be the
+     character at IT_CHARPOS.  BIDI_IT.FIRST_ELT non-zero means that
+     we were reseat()ed to a new buffer position, which is potentially
+     a different paragraph.  */
+  if (it->bidi_p && it->bidi_it.first_elt)
+    {
+      it->bidi_it.charpos = IT_CHARPOS (*it);
+      it->bidi_it.bytepos = IT_BYTEPOS (*it);
+      if (it->bidi_it.bytepos == ZV_BYTE)
+       {
+         /* Nothing to do, but reset the FIRST_ELT flag, like
+            bidi_paragraph_init does, because we are not going to
+            call it.  */
+         it->bidi_it.first_elt = 0;
+       }
+      else if (it->bidi_it.bytepos == BEGV_BYTE
+         /* FIXME: Should support all Unicode line separators.  */
+         || FETCH_CHAR (it->bidi_it.bytepos - 1) == '\n'
+         || FETCH_CHAR (it->bidi_it.bytepos) == '\n')
+       {
+         /* If we are at the beginning of a line, we can produce the
+            next element right away.  */
+         bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it);
+         bidi_move_to_visually_next (&it->bidi_it);
+       }
+      else
+       {
+         int orig_bytepos = IT_BYTEPOS (*it);
+
+         /* We need to prime the bidi iterator starting at the line's
+            beginning, before we will be able to produce the next
+            element.  */
+         IT_CHARPOS (*it) = find_next_newline_no_quit (IT_CHARPOS (*it), -1);
+         IT_BYTEPOS (*it) = CHAR_TO_BYTE (IT_CHARPOS (*it));
+         it->bidi_it.charpos = IT_CHARPOS (*it);
+         it->bidi_it.bytepos = IT_BYTEPOS (*it);
+         bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it);
+         do
+           {
+             /* Now return to buffer position where we were asked to
+                get the next display element, and produce that.  */
+             bidi_move_to_visually_next (&it->bidi_it);
+           }
+         while (it->bidi_it.bytepos != orig_bytepos
+                && it->bidi_it.bytepos < ZV_BYTE);
+       }
+
+      it->bidi_it.first_elt = 0; /* paranoia: bidi.c does this */
+      /*  Adjust IT's position information to where we ended up.  */
+      IT_CHARPOS (*it) = it->bidi_it.charpos;
+      IT_BYTEPOS (*it) = it->bidi_it.bytepos;
+      SET_TEXT_POS (it->position, IT_CHARPOS (*it), IT_BYTEPOS (*it));
+      {
+       EMACS_INT stop = it->stop_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);
+      }
+    }
+
   if (IT_CHARPOS (*it) >= it->stop_charpos)
     {
       if (IT_CHARPOS (*it) >= it->end_charpos)
@@ -6458,17 +6737,57 @@ next_element_from_buffer (it)
              success_p = 0;
            }
        }
+      else if (!(!it->bidi_p
+                || BIDI_AT_BASE_LEVEL (it->bidi_it)
+                || IT_CHARPOS (*it) == it->stop_charpos))
+       {
+         /* With bidi non-linear iteration, we could find ourselves
+            far beyond the last computed stop_charpos, with several
+            other stop positions in between that we missed.  Scan
+            them all now, in buffer's logical order, until we find
+            and handle the last stop_charpos that precedes our
+            current position.  */
+         handle_stop_backwards (it, it->stop_charpos);
+         return GET_NEXT_DISPLAY_ELEMENT (it);
+       }
       else
        {
+         if (it->bidi_p)
+           {
+             /* Take note of the stop position we just moved across,
+                for when we will move back across it.  */
+             it->prev_stop = it->stop_charpos;
+             /* If we are at base paragraph embedding level, take
+                note of the last stop position seen at this
+                level.  */
+             if (BIDI_AT_BASE_LEVEL (it->bidi_it))
+               it->base_level_stop = it->stop_charpos;
+           }
          handle_stop (it);
          return GET_NEXT_DISPLAY_ELEMENT (it);
        }
     }
+  else if (it->bidi_p
+          /* We can sometimes back up for reasons that have nothing
+             to do with bidi reordering.  E.g., compositions.  The
+             code below is only needed when we are above the base
+             embedding level, so test for that explicitly.  */
+          && !BIDI_AT_BASE_LEVEL (it->bidi_it)
+          && IT_CHARPOS (*it) < it->prev_stop)
+    {
+      if (it->base_level_stop <= 0)
+       it->base_level_stop = BEGV;
+      if (IT_CHARPOS (*it) < it->base_level_stop)
+       abort ();
+      handle_stop_backwards (it, it->base_level_stop);
+      return GET_NEXT_DISPLAY_ELEMENT (it);
+    }
   else
     {
       /* No face changes, overlays etc. in sight, so just return a
         character from current_buffer.  */
       unsigned char *p;
+      EMACS_INT stop;
 
       /* Maybe run the redisplay end trigger hook.  Performance note:
         This doesn't seem to cost measurable time.  */
@@ -6477,8 +6796,9 @@ next_element_from_buffer (it)
          && IT_CHARPOS (*it) >= it->redisplay_end_trigger_charpos)
        run_redisplay_end_trigger_hook (it);
 
+      stop = it->bidi_it.scan_dir < 0 ? -1 : it->end_charpos;
       if (CHAR_COMPOSED_P (it, IT_CHARPOS (*it), IT_BYTEPOS (*it),
-                          it->end_charpos)
+                          stop)
          && next_element_from_composition (it))
        {
          return 1;
@@ -6534,8 +6854,7 @@ next_element_from_buffer (it)
 /* Run the redisplay end trigger hook for IT.  */
 
 static void
-run_redisplay_end_trigger_hook (it)
-     struct it *it;
+run_redisplay_end_trigger_hook (struct it *it)
 {
   Lisp_Object args[3];
 
@@ -6565,8 +6884,7 @@ run_redisplay_end_trigger_hook (it)
    next_element_from_string when necessary.  */
 
 static int
-next_element_from_composition (it)
-     struct it *it;
+next_element_from_composition (struct it *it)
 {
   it->what = IT_COMPOSITION;
   it->len = it->cmp_it.nbytes;
@@ -6589,6 +6907,15 @@ next_element_from_composition (it)
        {
          IT_CHARPOS (*it) += it->cmp_it.nchars;
          IT_BYTEPOS (*it) += it->cmp_it.nbytes;
+         if (it->bidi_p)
+           {
+             if (it->bidi_it.new_paragraph)
+               bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it);
+             /* Resync the bidi iterator with IT's new position.
+                FIXME: this doesn't support bidirectional text.  */
+             while (it->bidi_it.charpos < IT_CHARPOS (*it))
+               bidi_move_to_visually_next (&it->bidi_it);
+           }
          return 0;
        }
       it->position = it->current.pos;
@@ -6618,9 +6945,9 @@ next_element_from_composition (it)
    line on the display without producing glyphs.
 
    OP should be a bit mask including some or all of these bits:
-    MOVE_TO_X: Stop on reaching x-position TO_X.
-    MOVE_TO_POS: Stop on reaching buffer or string position TO_CHARPOS.
-   Regardless of OP's value, stop in reaching the end of the display line.
+    MOVE_TO_X: Stop upon reaching x-position TO_X.
+    MOVE_TO_POS: Stop upon reaching buffer or string position TO_CHARPOS.
+   Regardless of OP's value, stop upon reaching the end of the display line.
 
    TO_X is normally a value 0 <= TO_X <= IT->last_visible_x.
    This means, in particular, that TO_X includes window's horizontal
@@ -6656,6 +6983,8 @@ move_it_in_display_line_to (struct it *it,
   struct glyph_row *saved_glyph_row;
   struct it wrap_it, atpos_it, atx_it;
   int may_wrap = 0;
+  enum it_method prev_method = it->method;
+  EMACS_INT prev_pos = IT_CHARPOS (*it);
 
   /* Don't produce glyphs in produce_glyphs.  */
   saved_glyph_row = it->glyph_row;
@@ -6673,7 +7002,8 @@ move_it_in_display_line_to (struct it *it,
 #define BUFFER_POS_REACHED_P()                                 \
   ((op & MOVE_TO_POS) != 0                                     \
    && BUFFERP (it->object)                                     \
-   && IT_CHARPOS (*it) >= to_charpos                           \
+   && (IT_CHARPOS (*it) == to_charpos                          \
+       || (!it->bidi_p && IT_CHARPOS (*it) > to_charpos))      \
    && (it->method == GET_FROM_BUFFER                           \
        || (it->method == GET_FROM_DISPLAY_VECTOR               \
           && it->dpvec + it->current.dpvec_index + 1 >= it->dpend)))
@@ -6697,7 +7027,16 @@ move_it_in_display_line_to (struct it *it,
       if ((op & MOVE_TO_POS) != 0
          && BUFFERP (it->object)
          && it->method == GET_FROM_BUFFER
-         && IT_CHARPOS (*it) > to_charpos)
+         && ((!it->bidi_p && IT_CHARPOS (*it) > to_charpos)
+             || (it->bidi_p
+                 && (prev_method == GET_FROM_IMAGE
+                     || prev_method == GET_FROM_STRETCH)
+                 /* Passed TO_CHARPOS from left to right.  */
+                 && ((prev_pos < to_charpos
+                      && IT_CHARPOS (*it) > to_charpos)
+                     /* Passed TO_CHARPOS from right to left.  */
+                     || (prev_pos > to_charpos
+                         && IT_CHARPOS (*it) < to_charpos)))))
        {
          if (it->line_wrap != WORD_WRAP || wrap_it.sp < 0)
            {
@@ -6711,6 +7050,9 @@ move_it_in_display_line_to (struct it *it,
            atpos_it = *it;
        }
 
+      prev_method = it->method;
+      if (it->method == GET_FROM_BUFFER)
+       prev_pos = IT_CHARPOS (*it);
       /* Stop when ZV reached.
          We used to stop here when TO_CHARPOS reached as well, but that is
          too soon if this glyph does not fit on this line.  So we handle it
@@ -6976,6 +7318,8 @@ move_it_in_display_line_to (struct it *it,
          break;
        }
 
+      if (it->method == GET_FROM_BUFFER)
+       prev_pos = IT_CHARPOS (*it);
       /* The current display element has been consumed.  Advance
         to the next.  */
       set_iterator_to_next (it, 1);
@@ -7063,10 +7407,7 @@ move_it_in_display_line (struct it *it,
    TO_CHARPOS.  */
 
 void
-move_it_to (it, to_charpos, to_x, to_y, to_vpos, op)
-     struct it *it;
-     int to_charpos, to_x, to_y, to_vpos;
-     int op;
+move_it_to (struct it *it, int 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;
@@ -7317,9 +7658,7 @@ move_it_to (it, to_charpos, to_x, to_y, to_vpos, op)
    set to the top of the line moved to.  */
 
 void
-move_it_vertically_backward (it, dy)
-     struct it *it;
-     int dy;
+move_it_vertically_backward (struct it *it, int dy)
 {
   int nlines, h;
   struct it it2, it3;
@@ -7438,9 +7777,7 @@ move_it_vertically_backward (it, dy)
    end, IT will be on the start of a screen line.  */
 
 void
-move_it_vertically (it, dy)
-    struct it *it;
-    int dy;
+move_it_vertically (struct it *it, int dy)
 {
   if (dy <= 0)
     move_it_vertically_backward (it, -dy);
@@ -7464,8 +7801,7 @@ move_it_vertically (it, dy)
 /* Move iterator IT past the end of the text line it is in.  */
 
 void
-move_it_past_eol (it)
-     struct it *it;
+move_it_past_eol (struct it *it)
 {
   enum move_it_result rc;
 
@@ -7485,9 +7821,7 @@ move_it_past_eol (it)
    truncate-lines nil.  */
 
 void
-move_it_by_lines (it, dvpos, need_y_p)
-     struct it *it;
-     int dvpos, need_y_p;
+move_it_by_lines (struct it *it, int dvpos, int need_y_p)
 {
   struct position pos;
 
@@ -7581,8 +7915,7 @@ move_it_by_lines (it, dvpos, need_y_p)
 /* Return 1 if IT points into the middle of a display vector.  */
 
 int
-in_display_vector_p (it)
-     struct it *it;
+in_display_vector_p (struct it *it)
 {
   return (it->method == GET_FROM_DISPLAY_VECTOR
          && it->current.dpvec_index > 0
@@ -7599,9 +7932,7 @@ in_display_vector_p (it)
    to *Messages*.  */
 
 void
-add_to_log (format, arg1, arg2)
-     char *format;
-     Lisp_Object arg1, arg2;
+add_to_log (const char *format, Lisp_Object arg1, Lisp_Object arg2)
 {
   Lisp_Object args[3];
   Lisp_Object msg, fmt;
@@ -7626,7 +7957,7 @@ add_to_log (format, arg1, arg2)
 
   len = SBYTES (msg) + 1;
   SAFE_ALLOCA (buffer, char *, len);
-  bcopy (SDATA (msg), buffer, len);
+  memcpy (buffer, SDATA (msg), len);
 
   message_dolog (buffer, len - 1, 1, 0);
   SAFE_FREE ();
@@ -7638,7 +7969,7 @@ add_to_log (format, arg1, arg2)
 /* Output a newline in the *Messages* buffer if "needs" one.  */
 
 void
-message_log_maybe_newline ()
+message_log_maybe_newline (void)
 {
   if (message_log_need_newline)
     message_dolog ("", 0, 1, 0);
@@ -7655,9 +7986,7 @@ message_log_maybe_newline ()
    so the buffer M must NOT point to a Lisp string.  */
 
 void
-message_dolog (m, nbytes, nlflag, multibyte)
-     const char *m;
-     int nbytes, nlflag, multibyte;
+message_dolog (const char *m, int nbytes, int nlflag, int multibyte)
 {
   if (!NILP (Vmemory_full))
     return;
@@ -7827,9 +8156,8 @@ message_dolog (m, nbytes, nlflag, multibyte)
    value N > 1 if we should also append " [N times]".  */
 
 static int
-message_log_check_duplicate (prev_bol, prev_bol_byte, this_bol, this_bol_byte)
-     int prev_bol, this_bol;
-     int prev_bol_byte, this_bol_byte;
+message_log_check_duplicate (int prev_bol, int prev_bol_byte,
+                            int this_bol, int this_bol_byte)
 {
   int i;
   int len = Z_BYTE - 1 - this_bol_byte;
@@ -7867,10 +8195,7 @@ message_log_check_duplicate (prev_bol, prev_bol_byte, this_bol, this_bol_byte)
    This may GC, so the buffer M must NOT point to a Lisp string.  */
 
 void
-message2 (m, nbytes, multibyte)
-     const char *m;
-     int nbytes;
-     int multibyte;
+message2 (const char *m, int nbytes, int multibyte)
 {
   /* First flush out any partial line written with print.  */
   message_log_maybe_newline ();
@@ -7883,9 +8208,7 @@ message2 (m, nbytes, multibyte)
 /* The non-logging counterpart of message2.  */
 
 void
-message2_nolog (m, nbytes, multibyte)
-     const char *m;
-     int nbytes, multibyte;
+message2_nolog (const char *m, int nbytes, int multibyte)
 {
   struct frame *sf = SELECTED_FRAME ();
   message_enable_multibyte = multibyte;
@@ -7947,10 +8270,7 @@ message2_nolog (m, nbytes, multibyte)
    This function cancels echoing.  */
 
 void
-message3 (m, nbytes, multibyte)
-     Lisp_Object m;
-     int nbytes;
-     int multibyte;
+message3 (Lisp_Object m, int nbytes, int multibyte)
 {
   struct gcpro gcpro1;
 
@@ -7966,7 +8286,7 @@ message3 (m, nbytes, multibyte)
       USE_SAFE_ALLOCA;
 
       SAFE_ALLOCA (buffer, char *, nbytes);
-      bcopy (SDATA (m), buffer, nbytes);
+      memcpy (buffer, SDATA (m), nbytes);
       message_dolog (buffer, nbytes, 1, multibyte);
       SAFE_FREE ();
     }
@@ -7982,9 +8302,7 @@ message3 (m, nbytes, multibyte)
    and make this cancel echoing.  */
 
 void
-message3_nolog (m, nbytes, multibyte)
-     Lisp_Object m;
-     int nbytes, multibyte;
+message3_nolog (Lisp_Object m, int nbytes, int multibyte)
 {
   struct frame *sf = SELECTED_FRAME ();
   message_enable_multibyte = multibyte;
@@ -8052,8 +8370,7 @@ message3_nolog (m, nbytes, multibyte)
    that was alloca'd.  */
 
 void
-message1 (m)
-     char *m;
+message1 (const char *m)
 {
   message2 (m, (m ? strlen (m) : 0), 0);
 }
@@ -8062,8 +8379,7 @@ message1 (m)
 /* The non-logging counterpart of message1.  */
 
 void
-message1_nolog (m)
-     char *m;
+message1_nolog (const char *m)
 {
   message2_nolog (m, (m ? strlen (m) : 0), 0);
 }
@@ -8072,10 +8388,7 @@ message1_nolog (m)
    which gets replaced with STRING.  */
 
 void
-message_with_string (m, string, log)
-     char *m;
-     Lisp_Object string;
-     int log;
+message_with_string (const char *m, Lisp_Object string, int log)
 {
   CHECK_STRING (string);
 
@@ -8138,11 +8451,8 @@ message_with_string (m, string, log)
 /* Dump an informative message to the minibuf.  If M is 0, clear out
    any existing message, and let the mini-buffer text show through.  */
 
-/* VARARGS 1 */
-void
-message (m, a1, a2, a3)
-     char *m;
-     EMACS_INT a1, a2, a3;
+static void
+vmessage (const char *m, va_list ap)
 {
   if (noninteractive)
     {
@@ -8151,7 +8461,7 @@ message (m, a1, a2, a3)
          if (noninteractive_need_newline)
            putc ('\n', stderr);
          noninteractive_need_newline = 0;
-         fprintf (stderr, m, a1, a2, a3);
+         vfprintf (stderr, m, ap);
          if (cursor_in_echo_area == 0)
            fprintf (stderr, "\n");
          fflush (stderr);
@@ -8179,19 +8489,9 @@ message (m, a1, a2, a3)
          if (m)
            {
              int len;
-#ifdef NO_ARG_ARRAY
-             char *a[3];
-             a[0] = (char *) a1;
-             a[1] = (char *) a2;
-             a[2] = (char *) a3;
 
              len = doprnt (FRAME_MESSAGE_BUF (f),
-                           FRAME_MESSAGE_BUF_SIZE (f), m, (char *)0, 3, a);
-#else
-             len = doprnt (FRAME_MESSAGE_BUF (f),
-                           FRAME_MESSAGE_BUF_SIZE (f), m, (char *)0, 3,
-                           (char **) &a1);
-#endif /* NO_ARG_ARRAY */
+                           FRAME_MESSAGE_BUF_SIZE (f), m, (char *)0, ap);
 
              message2 (FRAME_MESSAGE_BUF (f), len, 0);
            }
@@ -8205,19 +8505,29 @@ message (m, a1, a2, a3)
     }
 }
 
+void
+message (const char *m, ...)
+{
+  va_list ap;
+  va_start (ap, m);
+  vmessage (m, ap);
+  va_end (ap);
+}
+
 
 /* The non-logging version of message.  */
 
 void
-message_nolog (m, a1, a2, a3)
-     char *m;
-     EMACS_INT a1, a2, a3;
+message_nolog (const char *m, ...)
 {
   Lisp_Object old_log_max;
+  va_list ap;
+  va_start (ap, m);
   old_log_max = Vmessage_log_max;
   Vmessage_log_max = Qnil;
-  message (m, a1, a2, a3);
+  vmessage (m, ap);
   Vmessage_log_max = old_log_max;
+  va_end (ap);
 }
 
 
@@ -8226,7 +8536,7 @@ message_nolog (m, a1, a2, a3)
    critical.  */
 
 void
-update_echo_area ()
+update_echo_area (void)
 {
   if (!NILP (echo_area_buffer[0]))
     {
@@ -8242,7 +8552,7 @@ update_echo_area ()
    If they aren't, make new ones.  */
 
 static void
-ensure_echo_area_buffers ()
+ensure_echo_area_buffers (void)
 {
   int i;
 
@@ -8286,13 +8596,9 @@ ensure_echo_area_buffers ()
    Value is what FN returns.  */
 
 static int
-with_echo_area_buffer (w, which, fn, a1, a2, a3, a4)
-     struct window *w;
-     int which;
-     int (*fn) P_ ((EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT));
-     EMACS_INT a1;
-     Lisp_Object a2;
-     EMACS_INT a3, a4;
+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)
 {
   Lisp_Object buffer;
   int this_one, the_other, clear_buffer_p, rc;
@@ -8379,8 +8685,7 @@ with_echo_area_buffer (w, which, fn, a1, a2, a3, a4)
    FN called in with_echo_area_buffer.  */
 
 static Lisp_Object
-with_echo_area_buffer_unwind_data (w)
-     struct window *w;
+with_echo_area_buffer_unwind_data (struct window *w)
 {
   int i = 0;
   Lisp_Object vector, tmp;
@@ -8420,8 +8725,7 @@ with_echo_area_buffer_unwind_data (w)
    with_echo_area_buffer_unwind_data.  */
 
 static Lisp_Object
-unwind_with_echo_area_buffer (vector)
-     Lisp_Object vector;
+unwind_with_echo_area_buffer (Lisp_Object vector)
 {
   set_buffer_internal_1 (XBUFFER (AREF (vector, 0)));
   Vdeactivate_mark = AREF (vector, 1);
@@ -8451,8 +8755,7 @@ unwind_with_echo_area_buffer (vector)
    non-zero means we will print multibyte.  */
 
 void
-setup_echo_area_for_printing (multibyte_p)
-     int multibyte_p;
+setup_echo_area_for_printing (int multibyte_p)
 {
   /* If we can't find an echo area any more, exit.  */
   if (! FRAME_LIVE_P (XFRAME (selected_frame)))
@@ -8526,8 +8829,7 @@ setup_echo_area_for_printing (multibyte_p)
    display the current message.  */
 
 static int
-display_echo_area (w)
-     struct window *w;
+display_echo_area (struct window *w)
 {
   int i, no_message_p, window_height_changed_p, count;
 
@@ -8565,10 +8867,7 @@ display_echo_area (w)
    Value is non-zero if height of W was changed.  */
 
 static int
-display_echo_area_1 (a1, a2, a3, a4)
-     EMACS_INT a1;
-     Lisp_Object a2;
-     EMACS_INT a3, a4;
+display_echo_area_1 (EMACS_INT a1, Lisp_Object a2, EMACS_INT a3, EMACS_INT a4)
 {
   struct window *w = (struct window *) a1;
   Lisp_Object window;
@@ -8597,7 +8896,7 @@ display_echo_area_1 (a1, a2, a3, a4)
    is active, don't shrink it.  */
 
 void
-resize_echo_area_exactly ()
+resize_echo_area_exactly (void)
 {
   if (BUFFERP (echo_area_buffer[0])
       && WINDOWP (echo_area_window))
@@ -8630,10 +8929,7 @@ resize_echo_area_exactly ()
    resize_mini_window returns.  */
 
 static int
-resize_mini_window_1 (a1, exactly, a3, a4)
-     EMACS_INT a1;
-     Lisp_Object exactly;
-     EMACS_INT a3, a4;
+resize_mini_window_1 (EMACS_INT a1, Lisp_Object exactly, EMACS_INT a3, EMACS_INT a4)
 {
   return resize_mini_window ((struct window *) a1, !NILP (exactly));
 }
@@ -8651,9 +8947,7 @@ resize_mini_window_1 (a1, exactly, a3, a4)
    Value is non-zero if the window height has been changed.  */
 
 int
-resize_mini_window (w, exact_p)
-     struct window *w;
-     int exact_p;
+resize_mini_window (struct window *w, int exact_p)
 {
   struct frame *f = XFRAME (w->frame);
   int window_height_changed_p = 0;
@@ -8794,7 +9088,7 @@ resize_mini_window (w, exact_p)
    current message.  */
 
 Lisp_Object
-current_message ()
+current_message (void)
 {
   Lisp_Object msg;
 
@@ -8813,10 +9107,7 @@ current_message ()
 
 
 static int
-current_message_1 (a1, a2, a3, a4)
-     EMACS_INT a1;
-     Lisp_Object a2;
-     EMACS_INT a3, a4;
+current_message_1 (EMACS_INT a1, Lisp_Object a2, EMACS_INT a3, EMACS_INT a4)
 {
   Lisp_Object *msg = (Lisp_Object *) a1;
 
@@ -8834,7 +9125,7 @@ current_message_1 (a1, a2, a3, a4)
    worth optimizing.  */
 
 int
-push_message ()
+push_message (void)
 {
   Lisp_Object msg;
   msg = current_message ();
@@ -8846,7 +9137,7 @@ push_message ()
 /* Restore message display from the top of Vmessage_stack.  */
 
 void
-restore_message ()
+restore_message (void)
 {
   Lisp_Object msg;
 
@@ -8862,8 +9153,7 @@ restore_message ()
 /* Handler for record_unwind_protect calling pop_message.  */
 
 Lisp_Object
-pop_message_unwind (dummy)
-     Lisp_Object dummy;
+pop_message_unwind (Lisp_Object dummy)
 {
   pop_message ();
   return Qnil;
@@ -8872,7 +9162,7 @@ pop_message_unwind (dummy)
 /* Pop the top-most entry off Vmessage_stack.  */
 
 void
-pop_message ()
+pop_message (void)
 {
   xassert (CONSP (Vmessage_stack));
   Vmessage_stack = XCDR (Vmessage_stack);
@@ -8884,7 +9174,7 @@ pop_message ()
    somewhere.  */
 
 void
-check_message_stack ()
+check_message_stack (void)
 {
   if (!NILP (Vmessage_stack))
     abort ();
@@ -8895,8 +9185,7 @@ check_message_stack ()
    time we display it---but don't redisplay it now.  */
 
 void
-truncate_echo_area (nchars)
-     int nchars;
+truncate_echo_area (int nchars)
 {
   if (nchars == 0)
     echo_area_buffer[0] = Qnil;
@@ -8918,10 +9207,7 @@ truncate_echo_area (nchars)
    message to at most NCHARS characters.  */
 
 static int
-truncate_message_1 (nchars, a2, a3, a4)
-     EMACS_INT nchars;
-     Lisp_Object a2;
-     EMACS_INT a3, a4;
+truncate_message_1 (EMACS_INT nchars, Lisp_Object a2, EMACS_INT a3, EMACS_INT a4)
 {
   if (BEG + nchars < Z)
     del_range (BEG + nchars, Z);
@@ -8946,10 +9232,7 @@ truncate_message_1 (nchars, a2, a3, a4)
   */
 
 void
-set_message (s, string, nbytes, multibyte_p)
-     const char *s;
-     Lisp_Object string;
-     int nbytes, multibyte_p;
+set_message (const char *s, Lisp_Object string, int nbytes, int multibyte_p)
 {
   message_enable_multibyte
     = ((s && multibyte_p)
@@ -8968,10 +9251,7 @@ set_message (s, string, nbytes, multibyte_p)
    current.  */
 
 static int
-set_message_1 (a1, a2, nbytes, multibyte_p)
-     EMACS_INT a1;
-     Lisp_Object a2;
-     EMACS_INT nbytes, multibyte_p;
+set_message_1 (EMACS_INT a1, Lisp_Object a2, EMACS_INT nbytes, EMACS_INT multibyte_p)
 {
   const char *s = (const char *) a1;
   Lisp_Object string = a2;
@@ -9050,8 +9330,7 @@ set_message_1 (a1, a2, nbytes, multibyte_p)
    last displayed.  */
 
 void
-clear_message (current_p, last_displayed_p)
-     int current_p, last_displayed_p;
+clear_message (int current_p, int last_displayed_p)
 {
   if (current_p)
     {
@@ -9075,7 +9354,7 @@ clear_message (current_p, last_displayed_p)
    and ensure a complete redisplay of all windows.  */
 
 static void
-clear_garbaged_frames ()
+clear_garbaged_frames (void)
 {
   if (frame_garbaged)
     {
@@ -9112,8 +9391,7 @@ clear_garbaged_frames ()
    mini-windows height has been changed.  */
 
 static int
-echo_area_display (update_frame_p)
-     int update_frame_p;
+echo_area_display (int update_frame_p)
 {
   Lisp_Object mini_window;
   struct window *w;
@@ -9288,8 +9566,7 @@ format_mode_line_unwind_data (struct buffer *obuf,
 }
 
 static Lisp_Object
-unwind_format_mode_line (vector)
-     Lisp_Object vector;
+unwind_format_mode_line (Lisp_Object vector)
 {
   mode_line_target = XINT (AREF (vector, 0));
   mode_line_noprop_ptr = mode_line_noprop_buf + XINT (AREF (vector, 1));
@@ -9318,12 +9595,7 @@ unwind_format_mode_line (vector)
    Re-allocate mode_line_noprop_buf if necessary.  */
 
 static void
-#ifdef PROTOTYPES
 store_mode_line_noprop_char (char c)
-#else
-store_mode_line_noprop_char (c)
-    char c;
-#endif
 {
   /* If output position has reached the end of the allocated buffer,
      double the buffer's size.  */
@@ -9349,9 +9621,7 @@ store_mode_line_noprop_char (c)
    frame title.  */
 
 static int
-store_mode_line_noprop (str, field_width, precision)
-     const unsigned char *str;
-     int field_width, precision;
+store_mode_line_noprop (const unsigned char *str, int field_width, int precision)
 {
   int n = 0;
   int dummy, nbytes;
@@ -9384,8 +9654,7 @@ store_mode_line_noprop (str, field_width, precision)
    frame_title_format.  */
 
 static void
-x_consider_frame_title (frame)
-     Lisp_Object frame;
+x_consider_frame_title (Lisp_Object frame)
 {
   struct frame *f = XFRAME (frame);
 
@@ -9445,7 +9714,7 @@ x_consider_frame_title (frame)
         higher level than this.)  */
       if (! STRINGP (f->name)
          || SBYTES (f->name) != len
-         || bcmp (title, SDATA (f->name), len) != 0)
+         || memcmp (title, SDATA (f->name), len) != 0)
        x_implicitly_set_name (f, make_string (title, len), Qnil);
     }
 }
@@ -9464,7 +9733,7 @@ x_consider_frame_title (frame)
    appropriate.  This can call eval.  */
 
 void
-prepare_menu_bars ()
+prepare_menu_bars (void)
 {
   int all_windows;
   struct gcpro gcpro1, gcpro2;
@@ -9562,12 +9831,6 @@ prepare_menu_bars ()
       update_tool_bar (sf, 1);
 #endif
     }
-
-  /* Motif needs this.  See comment in xmenu.c.  Turn it off when
-     pending_menu_activation is not defined.  */
-#ifdef USE_X_TOOLKIT
-  pending_menu_activation = 0;
-#endif
 }
 
 
@@ -9583,10 +9846,7 @@ prepare_menu_bars ()
    updated value of this flag, to pass to the next call.  */
 
 static int
-update_menu_bar (f, save_match_data, hooks_run)
-     struct frame *f;
-     int save_match_data;
-     int hooks_run;
+update_menu_bar (struct frame *f, int save_match_data, int hooks_run)
 {
   Lisp_Object window;
   register struct window *w;
@@ -9711,8 +9971,7 @@ struct cursor_pos output_cursor;
    positions are relative to updated_window.  */
 
 void
-set_output_cursor (cursor)
-    struct cursor_pos *cursor;
+set_output_cursor (struct cursor_pos *cursor)
 {
   output_cursor.hpos = cursor->hpos;
   output_cursor.vpos = cursor->vpos;
@@ -9733,8 +9992,7 @@ set_output_cursor (cursor)
    selected_window and display the cursor at the given position.  */
 
 void
-x_cursor_to (vpos, hpos, y, x)
-     int vpos, hpos, y, x;
+x_cursor_to (int vpos, int hpos, int y, int x)
 {
   struct window *w;
 
@@ -9782,8 +10040,7 @@ int last_tool_bar_item;
 
 
 static Lisp_Object
-update_tool_bar_unwind (frame)
-     Lisp_Object frame;
+update_tool_bar_unwind (Lisp_Object frame)
 {
   selected_frame = frame;
   return Qnil;
@@ -9795,9 +10052,7 @@ update_tool_bar_unwind (frame)
    and restore it here.  */
 
 static void
-update_tool_bar (f, save_match_data)
-     struct frame *f;
-     int save_match_data;
+update_tool_bar (struct frame *f, int save_match_data)
 {
 #if defined (USE_GTK) || defined (HAVE_NS)
   int do_update = FRAME_EXTERNAL_TOOL_BAR (f);
@@ -9895,8 +10150,7 @@ update_tool_bar (f, save_match_data)
    been set up previously by calling prepare_menu_bars.  */
 
 static void
-build_desired_tool_bar_string (f)
-     struct frame *f;
+build_desired_tool_bar_string (struct frame *f)
 {
   int i, size, size_needed;
   struct gcpro gcpro1, gcpro2, gcpro3;
@@ -9937,7 +10191,6 @@ build_desired_tool_bar_string (f)
       int enabled_p = !NILP (PROP (TOOL_BAR_ITEM_ENABLED_P));
       int selected_p = !NILP (PROP (TOOL_BAR_ITEM_SELECTED_P));
       int hmargin, vmargin, relief, idx, end;
-      extern Lisp_Object QCrelief, QCmargin, QCconversion;
 
       /* If image is a vector, choose the image according to the
         button state.  */
@@ -10067,9 +10320,7 @@ build_desired_tool_bar_string (f)
 */
 
 static void
-display_tool_bar_line (it, height)
-     struct it *it;
-     int height;
+display_tool_bar_line (struct it *it, int height)
 {
   struct glyph_row *row = it->glyph_row;
   int max_x = it->last_visible_x;
@@ -10196,9 +10447,7 @@ display_tool_bar_line (it, height)
    returned in *N_ROWS if non-NULL.  */
 
 static int
-tool_bar_lines_needed (f, n_rows)
-     struct frame *f;
-     int *n_rows;
+tool_bar_lines_needed (struct frame *f, int *n_rows)
 {
   struct window *w = XWINDOW (f->tool_bar_window);
   struct it it;
@@ -10233,8 +10482,7 @@ tool_bar_lines_needed (f, n_rows)
 DEFUN ("tool-bar-lines-needed", Ftool_bar_lines_needed, Stool_bar_lines_needed,
        0, 1, 0,
        doc: /* Return the number of lines occupied by the tool bar of FRAME.  */)
-     (frame)
-     Lisp_Object frame;
+  (Lisp_Object frame)
 {
   struct frame *f;
   struct window *w;
@@ -10266,8 +10514,7 @@ DEFUN ("tool-bar-lines-needed", Ftool_bar_lines_needed, Stool_bar_lines_needed,
    height should be changed.  */
 
 static int
-redisplay_tool_bar (f)
-     struct frame *f;
+redisplay_tool_bar (struct frame *f)
 {
   struct window *w;
   struct it it;
@@ -10305,7 +10552,6 @@ redisplay_tool_bar (f)
       if ((nlines = tool_bar_lines_needed (f, &f->n_tool_bar_rows),
           nlines != WINDOW_TOTAL_LINES (w)))
        {
-         extern Lisp_Object Qtool_bar_lines;
          Lisp_Object frame;
          int old_height = WINDOW_TOTAL_LINES (w);
 
@@ -10397,7 +10643,6 @@ redisplay_tool_bar (f)
         frame parameter.  */
       if (change_height_p)
        {
-         extern Lisp_Object Qtool_bar_lines;
          Lisp_Object frame;
          int old_height = WINDOW_TOTAL_LINES (w);
          int nrows;
@@ -10438,10 +10683,7 @@ redisplay_tool_bar (f)
    GLYPH doesn't display a tool-bar item.  */
 
 static int
-tool_bar_item_info (f, glyph, prop_idx)
-     struct frame *f;
-     struct glyph *glyph;
-     int *prop_idx;
+tool_bar_item_info (struct frame *f, struct glyph *glyph, int *prop_idx)
 {
   Lisp_Object prop;
   int success_p;
@@ -10481,11 +10723,8 @@ tool_bar_item_info (f, glyph, prop_idx)
    1   otherwise.  */
 
 static int
-get_tool_bar_item (f, x, y, glyph, hpos, vpos, prop_idx)
-     struct frame *f;
-     int x, y;
-     struct glyph **glyph;
-     int *hpos, *vpos, *prop_idx;
+get_tool_bar_item (struct frame *f, int x, int y, struct glyph **glyph,
+                  int *hpos, int *vpos, int *prop_idx)
 {
   Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
   struct window *w = XWINDOW (f->tool_bar_window);
@@ -10523,10 +10762,8 @@ get_tool_bar_item (f, x, y, glyph, hpos, vpos, prop_idx)
    release.  */
 
 void
-handle_tool_bar_click (f, x, y, down_p, modifiers)
-     struct frame *f;
-     int x, y, down_p;
-     unsigned int modifiers;
+handle_tool_bar_click (struct frame *f, int x, int y, int down_p,
+                      unsigned int modifiers)
 {
   Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
   struct window *w = XWINDOW (f->tool_bar_window);
@@ -10584,9 +10821,7 @@ handle_tool_bar_click (f, x, y, down_p, modifiers)
    note_mouse_highlight.  */
 
 static void
-note_tool_bar_highlight (f, x, y)
-     struct frame *f;
-     int x, y;
+note_tool_bar_highlight (struct frame *f, int x, int y)
 {
   Lisp_Object window = f->tool_bar_window;
   struct window *w = XWINDOW (window);
@@ -10600,7 +10835,7 @@ note_tool_bar_highlight (f, x, y)
   enum draw_glyphs_face draw = DRAW_IMAGE_RAISED;
   int mouse_down_p, rc;
 
-  /* Function note_mouse_highlight is called with negative x(y
+  /* Function note_mouse_highlight is called with negative X/Y
      values when mouse moves outside of the frame.  */
   if (x <= 0 || y <= 0)
     {
@@ -10680,8 +10915,8 @@ note_tool_bar_highlight (f, x, y)
                         Horizontal scrolling
  ************************************************************************/
 
-static int hscroll_window_tree P_ ((Lisp_Object));
-static int hscroll_windows P_ ((Lisp_Object));
+static int hscroll_window_tree (Lisp_Object);
+static int hscroll_windows (Lisp_Object);
 
 /* For all leaf windows in the window tree rooted at WINDOW, set their
    hscroll value so that PT is (i) visible in the window, and (ii) so
@@ -10690,8 +10925,7 @@ static int hscroll_windows P_ ((Lisp_Object));
    changed.  */
 
 static int
-hscroll_window_tree (window)
-     Lisp_Object window;
+hscroll_window_tree (Lisp_Object window)
 {
   int hscrolled_p = 0;
   int hscroll_relative_p = FLOATP (Vhscroll_step);
@@ -10834,8 +11068,7 @@ hscroll_window_tree (window)
    of WINDOW are cleared.  */
 
 static int
-hscroll_windows (window)
-     Lisp_Object window;
+hscroll_windows (Lisp_Object window)
 {
   int hscrolled_p = hscroll_window_tree (window);
   if (hscrolled_p)
@@ -10918,9 +11151,7 @@ debug_method_add (w, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9)
    redisplay_internal for display optimization.  */
 
 static INLINE int
-text_outside_line_unchanged_p (w, start, end)
-     struct window *w;
-     int start, end;
+text_outside_line_unchanged_p (struct window *w, int start, int end)
 {
   int unchanged_p = 1;
 
@@ -10962,6 +11193,17 @@ text_outside_line_unchanged_p (w, start, end)
              && overlay_touches_p (Z - end))
            unchanged_p = 0;
        }
+
+      /* Under bidi reordering, adding or deleting a character in the
+        beginning of a paragraph, before the first strong directional
+        character, can change the base direction of the paragraph (unless
+        the buffer specifies a fixed paragraph direction), which will
+        require to redisplay the whole paragraph.  It might be worthwhile
+        to find the paragraph limits and widen the range of redisplayed
+        lines to that, but for now just give up this optimization.  */
+      if (!NILP (XBUFFER (w->buffer)->bidi_display_reordering)
+         && NILP (XBUFFER (w->buffer)->bidi_paragraph_direction))
+       unchanged_p = 0;
     }
 
   return unchanged_p;
@@ -10976,15 +11218,14 @@ text_outside_line_unchanged_p (w, start, end)
    mini-buffer if that is in use.  */
 
 void
-redisplay ()
+redisplay (void)
 {
   redisplay_internal (0);
 }
 
 
 static Lisp_Object
-overlay_arrow_string_or_property (var)
-     Lisp_Object var;
+overlay_arrow_string_or_property (Lisp_Object var)
 {
   Lisp_Object val;
 
@@ -10996,7 +11237,7 @@ overlay_arrow_string_or_property (var)
 
 /* Return 1 if there are any overlay-arrows in current_buffer.  */
 static int
-overlay_arrow_in_current_buffer_p ()
+overlay_arrow_in_current_buffer_p (void)
 {
   Lisp_Object vlist;
 
@@ -11022,7 +11263,7 @@ overlay_arrow_in_current_buffer_p ()
    has changed.  */
 
 static int
-overlay_arrows_changed_p ()
+overlay_arrows_changed_p (void)
 {
   Lisp_Object vlist;
 
@@ -11050,8 +11291,7 @@ overlay_arrows_changed_p ()
 /* Mark overlay arrows to be updated on next redisplay.  */
 
 static void
-update_overlay_arrows (up_to_date)
-     int up_to_date;
+update_overlay_arrows (int up_to_date)
 {
   Lisp_Object vlist;
 
@@ -11087,9 +11327,7 @@ update_overlay_arrows (up_to_date)
    Return nil if no overlay arrow.  */
 
 static Lisp_Object
-overlay_arrow_at_row (it, row)
-     struct it *it;
-     struct glyph_row *row;
+overlay_arrow_at_row (struct it *it, struct glyph_row *row)
 {
   Lisp_Object vlist;
 
@@ -11110,6 +11348,8 @@ overlay_arrow_at_row (it, row)
          && (MATRIX_ROW_START_CHARPOS (row) == marker_position (val)))
        {
          if (FRAME_WINDOW_P (it->f)
+             /* FIXME: if ROW->reversed_p is set, this should test
+                the right fringe, not the left one.  */
              && WINDOW_LEFT_FRINGE_WIDTH (it->w) > 0)
            {
 #ifdef HAVE_WINDOW_SYSTEM
@@ -11134,9 +11374,8 @@ overlay_arrow_at_row (it, row)
    position.  BUF and PT are the current point buffer and position.  */
 
 int
-check_point_in_composition (prev_buf, prev_pt, buf, pt)
-     struct buffer *prev_buf, *buf;
-     int prev_pt, pt;
+check_point_in_composition (struct buffer *prev_buf, int prev_pt,
+                           struct buffer *buf, int pt)
 {
   EMACS_INT start, end;
   Lisp_Object prop;
@@ -11172,9 +11411,7 @@ check_point_in_composition (prev_buf, prev_pt, buf, pt)
    in window W.  */
 
 static INLINE void
-reconsider_clip_changes (w, b)
-     struct window *w;
-     struct buffer *b;
+reconsider_clip_changes (struct window *w, struct buffer *b)
 {
   if (b->clip_changed
           && !NILP (w->window_end_valid)
@@ -11213,10 +11450,9 @@ reconsider_clip_changes (w, b)
    directly.  */
 
 static void
-select_frame_for_redisplay (frame)
-     Lisp_Object frame;
+select_frame_for_redisplay (Lisp_Object frame)
 {
-  Lisp_Object tail, symbol, val;
+  Lisp_Object tail, tem;
   Lisp_Object old = selected_frame;
   struct Lisp_Symbol *sym;
 
@@ -11224,20 +11460,18 @@ select_frame_for_redisplay (frame)
 
   selected_frame = frame;
 
-  do
-    {
-      for (tail = XFRAME (frame)->param_alist; CONSP (tail); tail = XCDR (tail))
-       if (CONSP (XCAR (tail))
-           && (symbol = XCAR (XCAR (tail)),
-               SYMBOLP (symbol))
-           && (sym = indirect_variable (XSYMBOL (symbol)),
-               val = sym->value,
-               (BUFFER_LOCAL_VALUEP (val)))
-           && XBUFFER_LOCAL_VALUE (val)->check_frame)
-         /* Use find_symbol_value rather than Fsymbol_value
-            to avoid an error if it is void.  */
-         find_symbol_value (symbol);
-    } while (!EQ (frame, old) && (frame = old, 1));
+  do {
+    for (tail = XFRAME (frame)->param_alist; CONSP (tail); tail = XCDR (tail))
+      if (CONSP (XCAR (tail))
+         && (tem = XCAR (XCAR (tail)),
+             SYMBOLP (tem))
+         && (sym = indirect_variable (XSYMBOL (tem)),
+             sym->redirect == SYMBOL_LOCALIZED)
+         && sym->val.blv->frame_local)
+       /* Use find_symbol_value rather than Fsymbol_value
+          to avoid an error if it is void.  */
+       find_symbol_value (tem);
+  } while (!EQ (frame, old) && (frame = old, 1));
 }
 
 
@@ -11257,8 +11491,7 @@ do { if (polling_stopped_here) start_polling ();        \
    causes some problems.  */
 
 static void
-redisplay_internal (preserve_echo_area)
-     int preserve_echo_area;
+redisplay_internal (int preserve_echo_area)
 {
   struct window *w = XWINDOW (selected_window);
   struct frame *f;
@@ -11293,16 +11526,6 @@ redisplay_internal (preserve_echo_area)
   if (!f->glyphs_initialized_p)
     return;
 
-  /* The flag redisplay_performed_directly_p is set by
-     direct_output_for_insert when it already did the whole screen
-     update necessary.  */
-  if (redisplay_performed_directly_p)
-    {
-      redisplay_performed_directly_p = 0;
-      if (!hscroll_windows (selected_window))
-       return;
-    }
-
 #if defined (USE_X_TOOLKIT) || defined (USE_GTK) || defined (HAVE_NS)
   if (popup_activated ())
     return;
@@ -11963,22 +12186,25 @@ redisplay_internal (preserve_echo_area)
   if (windows_or_buffers_changed && !pause)
     goto retry;
 
-  /* Clear the face cache eventually.  */
-  if (consider_all_windows_p)
+  /* Clear the face and image caches.
+
+     We used to do this only if consider_all_windows_p.  But the cache
+     needs to be cleared if a timer creates images in the current
+     buffer (e.g. the test case in Bug#6230).  */
+
+  if (clear_face_cache_count > CLEAR_FACE_CACHE_COUNT)
     {
-      if (clear_face_cache_count > CLEAR_FACE_CACHE_COUNT)
-       {
-         clear_face_cache (0);
-         clear_face_cache_count = 0;
-       }
+      clear_face_cache (0);
+      clear_face_cache_count = 0;
+    }
+
 #ifdef HAVE_WINDOW_SYSTEM
-      if (clear_image_cache_count > CLEAR_IMAGE_CACHE_COUNT)
-       {
-         clear_image_caches (Qnil);
-         clear_image_cache_count = 0;
-       }
-#endif /* HAVE_WINDOW_SYSTEM */
+  if (clear_image_cache_count > CLEAR_IMAGE_CACHE_COUNT)
+    {
+      clear_image_caches (Qnil);
+      clear_image_cache_count = 0;
     }
+#endif /* HAVE_WINDOW_SYSTEM */
 
  end_of_redisplay:
   unbind_to (count, Qnil);
@@ -11998,8 +12224,7 @@ redisplay_internal (preserve_echo_area)
    called.  This is useful for debugging.  */
 
 void
-redisplay_preserve_echo_area (from_where)
-     int from_where;
+redisplay_preserve_echo_area (int from_where)
 {
   TRACE ((stderr, "redisplay_preserve_echo_area (%d)\n", from_where));
 
@@ -12028,8 +12253,7 @@ redisplay_preserve_echo_area (from_where)
    failure during redisplay, for example).  */
 
 static Lisp_Object
-unwind_redisplay (val)
-     Lisp_Object val;
+unwind_redisplay (Lisp_Object val)
 {
   Lisp_Object old_redisplaying_p, old_frame;
 
@@ -12049,9 +12273,7 @@ unwind_redisplay (val)
    redisplay_internal is called.  */
 
 static void
-mark_window_display_accurate_1 (w, accurate_p)
-     struct window *w;
-     int accurate_p;
+mark_window_display_accurate_1 (struct window *w, int accurate_p)
 {
   if (BUFFERP (w->buffer))
     {
@@ -12102,9 +12324,7 @@ mark_window_display_accurate_1 (w, accurate_p)
    be redisplayed the next time redisplay_internal is called.  */
 
 void
-mark_window_display_accurate (window, accurate_p)
-     Lisp_Object window;
-     int accurate_p;
+mark_window_display_accurate (Lisp_Object window, int accurate_p)
 {
   struct window *w;
 
@@ -12139,9 +12359,7 @@ mark_window_display_accurate (window, accurate_p)
    macro DISP_CHAR_VECTOR.  */
 
 Lisp_Object
-disp_char_vector (dp, c)
-     struct Lisp_Char_Table *dp;
-     int c;
+disp_char_vector (struct Lisp_Char_Table *dp, int c)
 {
   Lisp_Object val;
 
@@ -12172,8 +12390,7 @@ disp_char_vector (dp, c)
 /* Redisplay all leaf windows in the window tree rooted at WINDOW.  */
 
 static void
-redisplay_windows (window)
-     Lisp_Object window;
+redisplay_windows (Lisp_Object window)
 {
   while (!NILP (window))
     {
@@ -12198,15 +12415,14 @@ redisplay_windows (window)
 }
 
 static Lisp_Object
-redisplay_window_error ()
+redisplay_window_error (Lisp_Object ignore)
 {
   displayed_buffer->display_error_modiff = BUF_MODIFF (displayed_buffer);
   return Qnil;
 }
 
 static Lisp_Object
-redisplay_window_0 (window)
-     Lisp_Object window;
+redisplay_window_0 (Lisp_Object window)
 {
   if (displayed_buffer->display_error_modiff < BUF_MODIFF (displayed_buffer))
     redisplay_window (window, 0);
@@ -12214,8 +12430,7 @@ redisplay_window_0 (window)
 }
 
 static Lisp_Object
-redisplay_window_1 (window)
-     Lisp_Object window;
+redisplay_window_1 (Lisp_Object window)
 {
   if (displayed_buffer->display_error_modiff < BUF_MODIFF (displayed_buffer))
     redisplay_window (window, 1);
@@ -12243,171 +12458,452 @@ redisplay_window_1 (window)
    Return 0 if cursor is not on this row, 1 otherwise.  */
 
 int
-set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos)
-     struct window *w;
-     struct glyph_row *row;
-     struct glyph_matrix *matrix;
-     int delta, delta_bytes, dy, dvpos;
+set_cursor_from_row (struct window *w, struct glyph_row *row,
+                    struct glyph_matrix *matrix, int delta, int 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 first glyph that starts a sequence of glyphs from a string
-     that is a value of a display property.  */
-  struct glyph *string_start;
-  /* The X coordinate of string_start.  */
-  int string_start_x;
   /* The last known character position in row.  */
   int last_pos = MATRIX_ROW_START_CHARPOS (row) + delta;
-  /* The last known character position before string_start.  */
-  int string_before_pos;
   int x = row->x;
-  int cursor_x = x;
-  /* Last buffer position covered by an overlay.  */
-  int cursor_from_overlay_pos = 0;
-  int pt_old = PT - delta;
-
-  /* Skip over glyphs not having an object at the start of the row.
-     These are special glyphs like truncation marks on terminal
-     frames.  */
+  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;
+  struct glyph *glyph_before = glyph - 1, *glyph_after = end;
+  /* A glyph beyond the edge of TEXT_AREA which we should never
+     touch.  */
+  struct glyph *glyphs_end = end;
+  /* Non-zero means we've found a match for cursor position, but that
+     glyph has the avoid_cursor_p flag set.  */
+  int match_with_avoid_cursor = 0;
+  /* Non-zero means we've seen at least one glyph that came from a
+     display string.  */
+  int string_seen = 0;
+  /* Largest buffer position seen so far during scan of glyph row.  */
+  EMACS_INT bpos_max = last_pos;
+  /* Last buffer position covered by an overlay string with an integer
+     `cursor' property.  */
+  EMACS_INT bpos_covered = 0;
+
+  /* Skip over glyphs not having an object at the start and the end of
+     the row.  These are special glyphs like truncation marks on
+     terminal frames.  */
   if (row->displays_text_p)
-    while (glyph < end
-          && INTEGERP (glyph->object)
-          && glyph->charpos < 0)
+    {
+      if (!row->reversed_p)
+       {
+         while (glyph < end
+                && INTEGERP (glyph->object)
+                && glyph->charpos < 0)
+           {
+             x += glyph->pixel_width;
+             ++glyph;
+           }
+         while (end > glyph
+                && INTEGERP ((end - 1)->object)
+                /* CHARPOS is zero for blanks and stretch glyphs
+                   inserted by extend_face_to_end_of_line.  */
+                && (end - 1)->charpos <= 0)
+           --end;
+         glyph_before = glyph - 1;
+         glyph_after = end;
+       }
+      else
+       {
+         struct glyph *g;
+
+         /* If the glyph row is reversed, we need to process it from back
+            to front, so swap the edge pointers.  */
+         glyphs_end = end = glyph - 1;
+         glyph += row->used[TEXT_AREA] - 1;
+
+         while (glyph > end + 1
+                && INTEGERP (glyph->object)
+                && glyph->charpos < 0)
+           {
+             --glyph;
+             x -= glyph->pixel_width;
+           }
+         if (INTEGERP (glyph->object) && glyph->charpos < 0)
+           --glyph;
+         /* By default, in reversed rows we put the cursor on the
+            rightmost (first in the reading order) glyph.  */
+         for (g = end + 1; g < glyph; g++)
+           x += g->pixel_width;
+         while (end < glyph
+                && INTEGERP ((end + 1)->object)
+                && (end + 1)->charpos <= 0)
+           ++end;
+         glyph_before = glyph + 1;
+         glyph_after = end;
+       }
+    }
+  else if (row->reversed_p)
+    {
+      /* In R2L rows that don't display text, put the cursor on the
+        rightmost glyph.  Case in point: an empty last line that is
+        part of an R2L paragraph.  */
+      cursor = end - 1;
+      /* Avoid placing the cursor on the last glyph of the row, where
+        on terminal frames we hold the vertical border between
+        adjacent windows.  */
+      if (!FRAME_WINDOW_P (WINDOW_XFRAME (w))
+         && !WINDOW_RIGHTMOST_P (w)
+         && cursor == row->glyphs[LAST_AREA] - 1)
+       cursor--;
+      x = -1;  /* will be computed below, at label compute_x */
+    }
+
+  /* Step 1: Try to find the glyph whose character position
+     corresponds to point.  If that's not possible, find 2 glyphs
+     whose character positions are the closest to point, one before
+     point, the other after it.  */
+  if (!row->reversed_p)
+    while (/* not marched to end of glyph row */
+          glyph < end
+          /* glyph was not inserted by redisplay for internal purposes */
+          && !INTEGERP (glyph->object))
       {
+       if (BUFFERP (glyph->object))
+         {
+           EMACS_INT dpos = glyph->charpos - pt_old;
+
+           if (glyph->charpos > bpos_max)
+             bpos_max = glyph->charpos;
+           if (!glyph->avoid_cursor_p)
+             {
+               /* If we hit point, we've found the glyph on which to
+                  display the cursor.  */
+               if (dpos == 0)
+                 {
+                   match_with_avoid_cursor = 0;
+                   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.  */
+               if (0 > dpos && dpos > pos_before - pt_old)
+                 {
+                   pos_before = glyph->charpos;
+                   glyph_before = glyph;
+                 }
+               else if (0 < dpos && dpos <= pos_after - pt_old)
+                 {
+                   pos_after = glyph->charpos;
+                   glyph_after = glyph;
+                 }
+             }
+           else if (dpos == 0)
+             match_with_avoid_cursor = 1;
+         }
+       else if (STRINGP (glyph->object))
+         {
+           Lisp_Object chprop;
+           int glyph_pos = glyph->charpos;
+
+           chprop = Fget_char_property (make_number (glyph_pos), Qcursor,
+                                        glyph->object);
+           if (INTEGERP (chprop))
+             {
+               bpos_covered = bpos_max + XINT (chprop);
+               /* If the `cursor' property covers buffer positions up
+                  to and including point, we should display cursor on
+                  this glyph.  Note that overlays and text properties
+                  with string values stop bidi reordering, so every
+                  buffer position to the left of the string is always
+                  smaller than any position to the right of the
+                  string.  Therefore, if a `cursor' property on one
+                  of the string's characters has an integer value, we
+                  will break out of the loop below _before_ we get to
+                  the position match above.  IOW, integer values of
+                  the `cursor' property override the "exact match for
+                  point" strategy of positioning the cursor.  */
+               /* Implementation note: bpos_max == pt_old when, e.g.,
+                  we are in an empty line, where bpos_max is set to
+                  MATRIX_ROW_START_CHARPOS, see above.  */
+               if (bpos_max <= pt_old && bpos_covered >= pt_old)
+                 {
+                   cursor = glyph;
+                   break;
+                 }
+             }
+
+           string_seen = 1;
+         }
        x += glyph->pixel_width;
        ++glyph;
       }
+  else if (glyph > end)        /* row is reversed */
+    while (!INTEGERP (glyph->object))
+      {
+       if (BUFFERP (glyph->object))
+         {
+           EMACS_INT dpos = glyph->charpos - pt_old;
 
-  string_start = NULL;
-  while (glyph < end
-        && !INTEGERP (glyph->object)
-        && (!BUFFERP (glyph->object)
-            || (last_pos = glyph->charpos) < pt_old
-            || glyph->avoid_cursor_p))
+           if (glyph->charpos > bpos_max)
+             bpos_max = glyph->charpos;
+           if (!glyph->avoid_cursor_p)
+             {
+               if (dpos == 0)
+                 {
+                   match_with_avoid_cursor = 0;
+                   break;
+                 }
+               if (0 > dpos && dpos > pos_before - pt_old)
+                 {
+                   pos_before = glyph->charpos;
+                   glyph_before = glyph;
+                 }
+               else if (0 < dpos && dpos <= pos_after - pt_old)
+                 {
+                   pos_after = glyph->charpos;
+                   glyph_after = glyph;
+                 }
+             }
+           else if (dpos == 0)
+             match_with_avoid_cursor = 1;
+         }
+       else if (STRINGP (glyph->object))
+         {
+           Lisp_Object chprop;
+           int glyph_pos = glyph->charpos;
+
+           chprop = Fget_char_property (make_number (glyph_pos), Qcursor,
+                                        glyph->object);
+           if (INTEGERP (chprop))
+             {
+               bpos_covered = bpos_max + XINT (chprop);
+               /* If the `cursor' property covers buffer positions up
+                  to and including point, we should display cursor on
+                  this glyph.  */
+               if (bpos_max <= pt_old && bpos_covered >= pt_old)
+                 {
+                   cursor = glyph;
+                   break;
+                 }
+             }
+           string_seen = 1;
+         }
+       --glyph;
+       if (glyph == glyphs_end) /* don't dereference outside TEXT_AREA */
+         {
+           x--;                /* can't use any pixel_width */
+           break;
+         }
+       x -= glyph->pixel_width;
+    }
+
+  /* Step 2: If we didn't find an exact match for point, we need to
+     look for a proper place to put the cursor among glyphs between
+     GLYPH_BEFORE and GLYPH_AFTER.  */
+  if (!((row->reversed_p ? glyph > glyphs_end : glyph < glyphs_end)
+       && BUFFERP (glyph->object) && glyph->charpos == pt_old)
+      && bpos_covered < pt_old)
     {
-      if (! STRINGP (glyph->object))
+      if (row->ends_in_ellipsis_p && pos_after == last_pos)
        {
-         string_start = NULL;
-         x += glyph->pixel_width;
-         ++glyph;
-         /* If we are beyond the cursor position computed from the
-            last overlay seen, that overlay is not in effect for
-            current cursor position.  Reset the cursor information
-            computed from that overlay.  */
-         if (cursor_from_overlay_pos
-             && last_pos >= cursor_from_overlay_pos)
+         EMACS_INT ellipsis_pos;
+
+         /* Scan back over the ellipsis glyphs.  */
+         if (!row->reversed_p)
            {
-             cursor_from_overlay_pos = 0;
-             cursor = NULL;
+             ellipsis_pos = (glyph - 1)->charpos;
+             while (glyph > row->glyphs[TEXT_AREA]
+                    && (glyph - 1)->charpos == ellipsis_pos)
+               glyph--, x -= glyph->pixel_width;
+             /* That loop always goes one position too far, including
+                the glyph before the ellipsis.  So scan forward over
+                that one.  */
+             x += glyph->pixel_width;
+             glyph++;
            }
-       }
-      else
-       {
-         if (string_start == NULL)
+         else  /* row is reversed */
            {
-             string_before_pos = last_pos;
-             string_start = glyph;
-             string_start_x = x;
+             ellipsis_pos = (glyph + 1)->charpos;
+             while (glyph < row->glyphs[TEXT_AREA] + row->used[TEXT_AREA] - 1
+                    && (glyph + 1)->charpos == ellipsis_pos)
+               glyph++, x += glyph->pixel_width;
+             x -= glyph->pixel_width;
+             glyph--;
            }
-         /* Skip all glyphs from a string.  */
-         do
+       }
+      else if (match_with_avoid_cursor
+              /* zero-width characters produce no glyphs */
+              || ((row->reversed_p
+                   ? glyph_after > glyphs_end
+                   : glyph_after < glyphs_end)
+                  && eabs (glyph_after - glyph_before) == 1))
+       {
+         cursor = glyph_after;
+         x = -1;
+       }
+      else if (string_seen)
+       {
+         int incr = row->reversed_p ? -1 : +1;
+
+         /* Need to find the glyph that came out of a string which is
+            present at point.  That glyph is somewhere between
+            GLYPH_BEFORE and GLYPH_AFTER, and it came from a string
+            positioned between POS_BEFORE and POS_AFTER in the
+            buffer.  */
+         struct glyph *stop = glyph_after;
+         EMACS_INT pos = pos_before;
+
+         x = -1;
+         for (glyph = glyph_before + incr;
+              row->reversed_p ? glyph > stop : glyph < stop; )
            {
-             Lisp_Object cprop;
-             int pos;
-             if ((cursor == NULL || glyph > cursor)
-                 && (cprop = Fget_char_property (make_number ((glyph)->charpos),
-                                                 Qcursor, (glyph)->object),
-                     !NILP (cprop))
-                 && (pos = string_buffer_position (w, glyph->object,
-                                                   string_before_pos),
-                     (pos == 0   /* from overlay */
-                      || pos == pt_old)))
+
+             /* Any glyphs that come from the buffer are here because
+                of bidi reordering.  Skip them, and only pay
+                attention to glyphs that came from some string.  */
+             if (STRINGP (glyph->object))
                {
-                 /* Compute the first buffer position after the overlay.
-                    If the `cursor' property tells us how  many positions
-                    are associated with the overlay, use that.  Otherwise,
-                    estimate from the buffer positions of the glyphs
-                    before and after the overlay.  */
-                 cursor_from_overlay_pos = (pos ? 0 : last_pos
-                                            + (INTEGERP (cprop) ? XINT (cprop) : 0));
-                 cursor = glyph;
-                 cursor_x = x;
+                 Lisp_Object str;
+                 EMACS_INT tem;
+
+                 str = glyph->object;
+                 tem = string_buffer_position_lim (w, str, pos, pos_after, 0);
+                 if (tem == 0  /* from overlay */
+                     || 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
+                        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)
+                       {
+                         /* The glyphs from this string could have
+                            been reordered.  Find the one with the
+                            smallest string position.  Or there could
+                            be a character in the string with the
+                            `cursor' property, which means display
+                            cursor on that character's glyph.  */
+                         int strpos = glyph->charpos;
+
+                         cursor = glyph;
+                         for (glyph += incr;
+                              (row->reversed_p ? glyph > stop : glyph < stop)
+                                && EQ (glyph->object, str);
+                              glyph += incr)
+                           {
+                             Lisp_Object cprop;
+                             int gpos = glyph->charpos;
+
+                             cprop = Fget_char_property (make_number (gpos),
+                                                         Qcursor,
+                                                         glyph->object);
+                             if (!NILP (cprop))
+                               {
+                                 cursor = glyph;
+                                 break;
+                               }
+                             if (glyph->charpos < strpos)
+                               {
+                                 strpos = glyph->charpos;
+                                 cursor = glyph;
+                               }
+                           }
+
+                         if (tem == pt_old)
+                           goto compute_x;
+                       }
+                     if (tem)
+                       pos = tem + 1; /* don't find previous instances */
+                   }
+                 /* This string is not what we want; skip all of the
+                    glyphs that came from it.  */
+                 do
+                   glyph += incr;
+                 while ((row->reversed_p ? glyph > stop : glyph < stop)
+                        && EQ (glyph->object, str));
                }
-             x += glyph->pixel_width;
-             ++glyph;
+             else
+               glyph += incr;
            }
-         while (glyph < end && EQ (glyph->object, string_start->object));
+
+         /* If we reached the end of the line, and END was from a string,
+            the cursor is not on this line.  */
+         if (cursor == NULL
+             && (row->reversed_p ? glyph <= end : glyph >= end)
+             && STRINGP (end->object)
+             && row->continued_p)
+           return 0;
        }
     }
 
+ compute_x:
   if (cursor != NULL)
+    glyph = cursor;
+  if (x < 0)
     {
-      glyph = cursor;
-      x = cursor_x;
-    }
-  else if (row->ends_in_ellipsis_p && glyph == end)
-    {
-      /* Scan back over the ellipsis glyphs, decrementing positions.  */
-      while (glyph > row->glyphs[TEXT_AREA]
-            && (glyph - 1)->charpos == last_pos)
-       glyph--, x -= glyph->pixel_width;
-      /* That loop always goes one position too far, including the
-        glyph before the ellipsis.  So scan forward over that one.  */
-      x += glyph->pixel_width;
-      glyph++;
-    }
-  else if (string_start
-          && (glyph == end || !BUFFERP (glyph->object) || last_pos > pt_old))
-    {
-      /* We may have skipped over point because the previous glyphs
-        are from string.  As there's no easy way to know the
-        character position of the current glyph, find the correct
-        glyph on point by scanning from string_start again.  */
-      Lisp_Object limit;
-      Lisp_Object string;
-      struct glyph *stop = glyph;
-      int pos;
-
-      limit = make_number (pt_old + 1);
-      glyph = string_start;
-      x = string_start_x;
-      string = glyph->object;
-      pos = string_buffer_position (w, string, string_before_pos);
-      /* If POS == 0, STRING is from overlay.  We skip such glyphs
-        because we always put the cursor after overlay strings.  */
-      while (pos == 0 && glyph < stop)
-       {
-         string = glyph->object;
-         SKIP_GLYPHS (glyph, stop, x, EQ (glyph->object, string));
-         if (glyph < stop)
-           pos = string_buffer_position (w, glyph->object, string_before_pos);
-       }
+      struct glyph *g;
 
-      while (glyph < stop)
+      /* Need to compute x that corresponds to GLYPH.  */
+      for (g = row->glyphs[TEXT_AREA], x = row->x; g < glyph; g++)
        {
-         pos = XINT (Fnext_single_char_property_change
-                     (make_number (pos), Qdisplay, Qnil, limit));
-         if (pos > pt_old)
-           break;
-         /* Skip glyphs from the same string.  */
-         string = glyph->object;
-         SKIP_GLYPHS (glyph, stop, x, EQ (glyph->object, string));
-         /* Skip glyphs from an overlay.  */
-         while (glyph < stop
-                && ! string_buffer_position (w, glyph->object, pos))
-           {
-             string = glyph->object;
-             SKIP_GLYPHS (glyph, stop, x, EQ (glyph->object, string));
-           }
-       }
-
-      /* If we reached the end of the line, and END was from a string,
-        the cursor is not on this line.  */
-      if (glyph == end && row->continued_p)
+         if (g >= row->glyphs[TEXT_AREA] + row->used[TEXT_AREA])
+           abort ();
+         x += g->pixel_width;
+       }
+    }
+
+  /* ROW could be part of a continued line, which, under bidi
+     reordering, might have other rows whose start and end charpos
+     occlude point.  Only set w->cursor if we found a better
+     approximation to the cursor position than we have from previously
+     examined candidate rows belonging to the same continued line.  */
+  if (/* we already have a candidate row */
+      w->cursor.vpos >= 0
+      /* that candidate is not the row we are processing */
+      && MATRIX_ROW (matrix, w->cursor.vpos) != row
+      /* the row we are processing is part of a continued line */
+      && (row->continued_p || MATRIX_ROW_CONTINUATION_LINE_P (row))
+      /* Make sure cursor.vpos specifies a row whose start and end
+        charpos occlude point.  This is because some callers of this
+        function leave cursor.vpos at the row where the cursor was
+        displayed during the last redisplay cycle.  */
+      && MATRIX_ROW_START_CHARPOS (MATRIX_ROW (matrix, w->cursor.vpos)) <= pt_old
+      && pt_old < MATRIX_ROW_END_CHARPOS (MATRIX_ROW (matrix, w->cursor.vpos)))
+    {
+      struct glyph *g1 =
+       MATRIX_ROW_GLYPH_START (matrix, w->cursor.vpos) + w->cursor.hpos;
+
+      /* Don't consider glyphs that are outside TEXT_AREA.  */
+      if (!(row->reversed_p ? glyph > glyphs_end : glyph < glyphs_end))
+       return 0;
+      /* Keep the candidate whose buffer position is the closest to
+        point.  */
+      if (/* previous candidate is a glyph in TEXT_AREA of that row */
+         w->cursor.hpos >= 0
+         && w->cursor.hpos < MATRIX_ROW_USED (matrix, w->cursor.vpos)
+         && BUFFERP (g1->object)
+         && (g1->charpos == pt_old /* an exact match always wins */
+             || (BUFFERP (glyph->object)
+                 && eabs (g1->charpos - pt_old)
+                  < eabs (glyph->charpos - pt_old))))
+       return 0;
+      /* If this candidate gives an exact match, use that.  */
+      if (!(BUFFERP (glyph->object) && glyph->charpos == pt_old)
+         /* Otherwise, keep the candidate that comes from a row
+            spanning less buffer positions.  This may win when one or
+            both candidate positions are on glyphs that came from
+            display strings, for which we cannot compare buffer
+            positions.  */
+         && MATRIX_ROW_END_CHARPOS (MATRIX_ROW (matrix, w->cursor.vpos))
+            - MATRIX_ROW_START_CHARPOS (MATRIX_ROW (matrix, w->cursor.vpos))
+            < MATRIX_ROW_END_CHARPOS (row) - MATRIX_ROW_START_CHARPOS (row))
        return 0;
     }
-
   w->cursor.hpos = glyph - row->glyphs[TEXT_AREA];
   w->cursor.x = x;
   w->cursor.vpos = MATRIX_ROW_VPOS (row, matrix) + dvpos;
@@ -12450,9 +12946,7 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos)
    We assume that the window's buffer is really current.  */
 
 static INLINE struct text_pos
-run_window_scroll_functions (window, startp)
-     Lisp_Object window;
-     struct text_pos startp;
+run_window_scroll_functions (Lisp_Object window, struct text_pos startp)
 {
   struct window *w = XWINDOW (window);
   SET_MARKER_FROM_TEXT_POS (w->start, startp);
@@ -12486,10 +12980,7 @@ run_window_scroll_functions (window, startp)
    as if point had gone off the screen.  */
 
 static int
-cursor_row_fully_visible_p (w, force_p, current_matrix_p)
-     struct window *w;
-     int force_p;
-     int current_matrix_p;
+cursor_row_fully_visible_p (struct window *w, int force_p, int current_matrix_p)
 {
   struct glyph_matrix *matrix;
   struct glyph_row *row;
@@ -12549,13 +13040,9 @@ enum
 };
 
 static int
-try_scrolling (window, just_this_one_p, scroll_conservatively,
-              scroll_step, temp_scroll_step, last_line_misfit)
-     Lisp_Object window;
-     int just_this_one_p;
-     EMACS_INT scroll_conservatively, scroll_step;
-     int temp_scroll_step;
-     int last_line_misfit;
+try_scrolling (Lisp_Object window, int just_this_one_p,
+              EMACS_INT scroll_conservatively, EMACS_INT scroll_step,
+              int temp_scroll_step, int last_line_misfit)
 {
   struct window *w = XWINDOW (window);
   struct frame *f = XFRAME (w->frame);
@@ -12622,14 +13109,22 @@ try_scrolling (window, just_this_one_p, scroll_conservatively,
       if (PT > CHARPOS (it.current.pos))
        {
          int y0 = line_bottom_y (&it);
-
-         /* Compute the distance from the scroll margin to PT
-            (including the height of the cursor line).  Moving the
-            iterator unconditionally to PT can be slow if PT is far
-            away, so stop 10 lines past the window bottom (is there a
-            way to do the right thing quickly?).  */
-         move_it_to (&it, PT, -1,
-                     it.last_visible_y + 10 * FRAME_LINE_HEIGHT (f),
+         /* Compute how many pixels below window bottom to stop searching
+            for PT.  This avoids costly search for PT that is far away if
+            the user limited scrolling by a small number of lines, but
+            always finds PT if scroll_conservatively is set to a large
+            number, such as most-positive-fixnum.  */
+         int slack = max (scroll_max, 10 * FRAME_LINE_HEIGHT (f));
+         int y_to_move =
+           slack >= INT_MAX - it.last_visible_y
+           ? INT_MAX
+           : it.last_visible_y + slack;
+
+         /* Compute the distance from the scroll margin to PT or to
+            the scroll limit, whichever comes first.  This should
+            include the height of the cursor line, to make that line
+            fully visible.  */
+         move_it_to (&it, PT, -1, y_to_move,
                      -1, MOVE_TO_POS | MOVE_TO_Y);
          dy = line_bottom_y (&it) - y0;
 
@@ -12669,7 +13164,26 @@ try_scrolling (window, just_this_one_p, scroll_conservatively,
        return SCROLLING_FAILED;
 
       start_display (&it, w, startp);
-      move_it_vertically (&it, amount_to_scroll);
+      if (scroll_max < INT_MAX)
+       move_it_vertically (&it, amount_to_scroll);
+      else
+       {
+         /* Extra precision for users who set scroll-conservatively
+            to most-positive-fixnum: make sure the amount we scroll
+            the window start is never less than amount_to_scroll,
+            which was computed as distance from window bottom to
+            point.  This matters when lines at window top and lines
+            below window bottom have different height.  */
+         struct it it1 = it;
+         /* We use a temporary it1 because line_bottom_y can modify
+            its argument, if it moves one line down; see there.  */
+         int start_y = line_bottom_y (&it1);
+
+         do {
+           move_it_by_lines (&it, 1, 1);
+           it1 = it;
+         } while (line_bottom_y (&it1) - start_y < amount_to_scroll);
+       }
 
       /* If STARTP is unchanged, move it down another screen line.  */
       if (CHARPOS (it.current.pos) == CHARPOS (startp))
@@ -12781,8 +13295,7 @@ try_scrolling (window, just_this_one_p, scroll_conservatively,
    screen line with the minimum distance from the old start W->start.  */
 
 static int
-compute_window_start_on_continuation_line (w)
-     struct window *w;
+compute_window_start_on_continuation_line (struct window *w)
 {
   struct text_pos pos, start_pos;
   int window_start_changed_p = 0;
@@ -12868,10 +13381,7 @@ enum
 };
 
 static int
-try_cursor_movement (window, startp, scroll_step)
-     Lisp_Object window;
-     struct text_pos startp;
-     int *scroll_step;
+try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_step)
 {
   struct window *w = XWINDOW (window);
   struct frame *f = XFRAME (w->frame);
@@ -12958,7 +13468,7 @@ try_cursor_movement (window, startp, scroll_step)
 
       if (rc == CURSOR_MOVEMENT_CANNOT_BE_USED)
        {
-         int scroll_p = 0;
+         int scroll_p = 0, must_scroll = 0;
          int last_y = window_text_bottom_y (w) - this_scroll_margin;
 
          if (PT > XFASTINT (w->last_point))
@@ -12971,11 +13481,14 @@ try_cursor_movement (window, startp, scroll_step)
                  ++row;
                }
 
-             /* The end position of a row equals the start position
-                of the next row.  If PT is there, we would rather
-                display it in the next line.  */
+             /* If the end position of a row equals the start
+                position of the next row, and PT is at that position,
+                we would rather display cursor in the next line.  */
              while (MATRIX_ROW_BOTTOM_Y (row) < last_y
                     && MATRIX_ROW_END_CHARPOS (row) == PT
+                    && row < w->current_matrix->rows
+                               + w->current_matrix->nrows - 1
+                    && MATRIX_ROW_START_CHARPOS (row+1) == PT
                     && !cursor_row_p (w, row))
                ++row;
 
@@ -13048,10 +13561,41 @@ try_cursor_movement (window, startp, scroll_step)
            {
              /* if PT is not in the glyph row, give up.  */
              rc = CURSOR_MOVEMENT_MUST_SCROLL;
+             must_scroll = 1;
+           }
+         else if (rc != CURSOR_MOVEMENT_SUCCESS
+                  && !NILP (XBUFFER (w->buffer)->bidi_display_reordering))
+           {
+             /* If rows are bidi-reordered and point moved, back up
+                until we find a row that does not belong to a
+                continuation line.  This is because we must consider
+                all rows of a continued line as candidates for the
+                new cursor positioning, since row start and end
+                positions change non-linearly with vertical position
+                in such rows.  */
+             /* FIXME: Revisit this when glyph ``spilling'' in
+                continuation lines' rows is implemented for
+                bidi-reordered rows.  */
+             while (MATRIX_ROW_CONTINUATION_LINE_P (row))
+               {
+                 xassert (row->enabled_p);
+                 --row;
+                 /* If we hit the beginning of the displayed portion
+                    without finding the first row of a continued
+                    line, give up.  */
+                 if (row <= w->current_matrix->rows)
+                   {
+                     rc = CURSOR_MOVEMENT_MUST_SCROLL;
+                     break;
+                   }
+
+               }
            }
+         if (must_scroll)
+           ;
          else if (rc != CURSOR_MOVEMENT_SUCCESS
-                  && MATRIX_ROW_PARTIALLY_VISIBLE_P (w, row)
-                  && make_cursor_line_fully_visible_p)
+             && MATRIX_ROW_PARTIALLY_VISIBLE_P (w, row)
+             && make_cursor_line_fully_visible_p)
            {
              if (PT == MATRIX_ROW_END_CHARPOS (row)
                  && !row->ends_at_zv_p
@@ -13077,6 +13621,48 @@ try_cursor_movement (window, startp, scroll_step)
            }
          else if (scroll_p)
            rc = CURSOR_MOVEMENT_MUST_SCROLL;
+         else if (rc != CURSOR_MOVEMENT_SUCCESS
+                  && !NILP (XBUFFER (w->buffer)->bidi_display_reordering))
+           {
+             /* With bidi-reordered rows, there could be more than
+                one candidate row whose start and end positions
+                occlude point.  We need to let set_cursor_from_row
+                find the best candidate.  */
+             /* FIXME: Revisit this when glyph ``spilling'' in
+                continuation lines' rows is implemented for
+                bidi-reordered rows.  */
+             int rv = 0;
+
+             do
+               {
+                 if (MATRIX_ROW_START_CHARPOS (row) <= PT
+                     && PT <= MATRIX_ROW_END_CHARPOS (row)
+                     && cursor_row_p (w, row))
+                   rv |= set_cursor_from_row (w, row, w->current_matrix,
+                                              0, 0, 0, 0);
+                 /* As soon as we've found the first suitable row
+                    whose ends_at_zv_p flag is set, we are done.  */
+                 if (rv
+                     && MATRIX_ROW (w->current_matrix, w->cursor.vpos)->ends_at_zv_p)
+                   {
+                     rc = CURSOR_MOVEMENT_SUCCESS;
+                     break;
+                   }
+                 ++row;
+               }
+             while ((MATRIX_ROW_CONTINUATION_LINE_P (row)
+                     && MATRIX_ROW_BOTTOM_Y (row) <= last_y)
+                    || (MATRIX_ROW_START_CHARPOS (row) == PT
+                        && MATRIX_ROW_BOTTOM_Y (row) < last_y));
+             /* If we didn't find any candidate rows, or exited the
+                loop before all the candidates were examined, signal
+                to the caller that this method failed.  */
+             if (rc != CURSOR_MOVEMENT_SUCCESS
+                 && (!rv || MATRIX_ROW_CONTINUATION_LINE_P (row)))
+               rc = CURSOR_MOVEMENT_MUST_SCROLL;
+             else if (rv)
+               rc = CURSOR_MOVEMENT_SUCCESS;
+           }
          else
            {
              do
@@ -13099,8 +13685,7 @@ try_cursor_movement (window, startp, scroll_step)
 }
 
 void
-set_vertical_scroll_bar (w)
-     struct window *w;
+set_vertical_scroll_bar (struct window *w)
 {
   int start, end, whole;
 
@@ -13145,9 +13730,7 @@ set_vertical_scroll_bar (w)
    retry.  */
 
 static void
-redisplay_window (window, just_this_one_p)
-     Lisp_Object window;
-     int just_this_one_p;
+redisplay_window (Lisp_Object window, int just_this_one_p)
 {
   struct window *w = XWINDOW (window);
   struct frame *f = XFRAME (w->frame);
@@ -13577,7 +14160,7 @@ redisplay_window (window, just_this_one_p)
               = try_window_reusing_current_matrix (w)))
        {
          IF_DEBUG (debug_method_add (w, "1"));
-         if (try_window (window, startp, 1) < 0)
+         if (try_window (window, startp, TRY_WINDOW_CHECK_MARGINS) < 0)
            /* -1 means we need to scroll.
               0 means we need new matrices, but fonts_changed_p
               is set in that case, so we will detect it below.  */
@@ -13869,7 +14452,6 @@ redisplay_window (window, just_this_one_p)
 
           if (redisplay_tool_bar_p && redisplay_tool_bar (f))
            {
-             extern int ignore_mouse_drag_p;
              ignore_mouse_drag_p = 1;
            }
         }
@@ -13936,13 +14518,12 @@ redisplay_window (window, just_this_one_p)
    Value is 1 if successful.  It is zero if fonts were loaded during
    redisplay which makes re-adjusting glyph matrices necessary, and -1
    if point would appear in the scroll margins.
-   (We check that only if CHECK_MARGINS is nonzero.  */
+   (We check the former only if TRY_WINDOW_IGNORE_FONTS_CHANGE is
+   unset in FLAGS, and the latter only if TRY_WINDOW_CHECK_MARGINS is
+   set in FLAGS.)  */
 
 int
-try_window (window, pos, check_margins)
-     Lisp_Object window;
-     struct text_pos pos;
-     int check_margins;
+try_window (Lisp_Object window, struct text_pos pos, int flags)
 {
   struct window *w = XWINDOW (window);
   struct it it;
@@ -13964,12 +14545,12 @@ try_window (window, pos, check_margins)
     {
       if (display_line (&it))
        last_text_row = it.glyph_row - 1;
-      if (fonts_changed_p)
+      if (fonts_changed_p && !(flags & TRY_WINDOW_IGNORE_FONTS_CHANGE))
        return 0;
     }
 
   /* Don't let the cursor end in the scroll margins.  */
-  if (check_margins
+  if ((flags & TRY_WINDOW_CHECK_MARGINS)
       && !MINI_WINDOW_P (w))
     {
       int this_scroll_margin;
@@ -14042,8 +14623,7 @@ try_window (window, pos, check_margins)
    W->start is the new window start.  */
 
 static int
-try_window_reusing_current_matrix (w)
-     struct window *w;
+try_window_reusing_current_matrix (struct window *w)
 {
   struct frame *f = XFRAME (w->frame);
   struct glyph_row *row, *bottom_row;
@@ -14090,7 +14670,7 @@ try_window_reusing_current_matrix (w)
   /* The variable new_start now holds the new window start.  The old
      start `start' can be determined from the current matrix.  */
   SET_TEXT_POS_FROM_MARKER (new_start, w->start);
-  start = start_row->start.pos;
+  start = start_row->minpos;
   start_vpos = MATRIX_ROW_VPOS (start_row, w->current_matrix);
 
   /* Clear the desired matrix for the display below.  */
@@ -14129,7 +14709,7 @@ try_window_reusing_current_matrix (w)
            {
              /* Advance to the next row as the "start".  */
              start_row++;
-             start = start_row->start.pos;
+             start = start_row->minpos;
              /* If there are no more rows to try, or just one, give up.  */
              if (start_row == MATRIX_MODE_LINE_ROW (w->current_matrix) - 1
                  || w->vscroll || MATRIX_ROW_PARTIALLY_VISIBLE_P (w, start_row)
@@ -14412,14 +14992,25 @@ try_window_reusing_current_matrix (w)
              struct glyph *glyph = row->glyphs[TEXT_AREA] + w->cursor.hpos;
              struct glyph *end = glyph + row->used[TEXT_AREA];
 
-             for (; glyph < end
-                    && (!BUFFERP (glyph->object)
-                        || glyph->charpos < PT);
-                  glyph++)
+             /* Can't use this optimization with bidi-reordered glyph
+                rows, unless cursor is already at point. */
+             if (!NILP (XBUFFER (w->buffer)->bidi_display_reordering))
                {
-                 w->cursor.hpos++;
-                 w->cursor.x += glyph->pixel_width;
+                 if (!(w->cursor.hpos >= 0
+                       && w->cursor.hpos < row->used[TEXT_AREA]
+                       && BUFFERP (glyph->object)
+                       && glyph->charpos == PT))
+                   return 0;
                }
+             else
+               for (; glyph < end
+                      && (!BUFFERP (glyph->object)
+                          || glyph->charpos < PT);
+                    glyph++)
+                 {
+                   w->cursor.hpos++;
+                   w->cursor.x += glyph->pixel_width;
+                 }
            }
        }
 
@@ -14459,12 +15050,12 @@ try_window_reusing_current_matrix (w)
    Window redisplay reusing current matrix when buffer has changed
  ************************************************************************/
 
-static struct glyph_row *find_last_unchanged_at_beg_row P_ ((struct window *));
-static struct glyph_row *find_first_unchanged_at_end_row P_ ((struct window *,
-                                                            int *, int *));
+static struct glyph_row *find_last_unchanged_at_beg_row (struct window *);
+static struct glyph_row *find_first_unchanged_at_end_row (struct window *,
+                                                          int *, int *);
 static struct glyph_row *
-find_last_row_displaying_text P_ ((struct glyph_matrix *, struct it *,
-                                  struct glyph_row *));
+find_last_row_displaying_text (struct glyph_matrix *, struct it *,
+                               struct glyph_row *);
 
 
 /* Return the last row in MATRIX displaying text.  If row START is
@@ -14473,10 +15064,8 @@ find_last_row_displaying_text P_ ((struct glyph_matrix *, struct it *,
    a pointer to the row found.  */
 
 static struct glyph_row *
-find_last_row_displaying_text (matrix, it, start)
-     struct glyph_matrix *matrix;
-     struct it *it;
-     struct glyph_row *start;
+find_last_row_displaying_text (struct glyph_matrix *matrix, struct it *it,
+                              struct glyph_row *start)
 {
   struct glyph_row *row, *row_found;
 
@@ -14509,8 +15098,7 @@ find_last_row_displaying_text (matrix, it, start)
    when the current matrix was built.  */
 
 static struct glyph_row *
-find_last_unchanged_at_beg_row (w)
-     struct window *w;
+find_last_unchanged_at_beg_row (struct window *w)
 {
   int first_changed_pos = BEG + BEG_UNCHANGED;
   struct glyph_row *row;
@@ -14559,9 +15147,7 @@ find_last_unchanged_at_beg_row (w)
    changes.  */
 
 static struct glyph_row *
-find_first_unchanged_at_end_row (w, delta, delta_bytes)
-     struct window *w;
-     int *delta, *delta_bytes;
+find_first_unchanged_at_end_row (struct window *w, int *delta, int *delta_bytes)
 {
   struct glyph_row *row;
   struct glyph_row *row_found = NULL;
@@ -14634,8 +15220,7 @@ find_first_unchanged_at_end_row (w, delta, delta_bytes)
    try_window_reusing_current_matrix.  */
 
 static void
-sync_frame_with_window_matrix_rows (w)
-     struct window *w;
+sync_frame_with_window_matrix_rows (struct window *w)
 {
   struct frame *f = XFRAME (w->frame);
   struct glyph_row *window_row, *window_row_end, *frame_row;
@@ -14679,13 +15264,12 @@ sync_frame_with_window_matrix_rows (w)
    containing CHARPOS or null.  */
 
 struct glyph_row *
-row_containing_pos (w, charpos, start, end, dy)
-     struct window *w;
-     int charpos;
-     struct glyph_row *start, *end;
-     int dy;
+row_containing_pos (struct window *w, int 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;
   int last_y;
 
   /* If we happen to start on a header-line, skip that.  */
@@ -14718,7 +15302,30 @@ row_containing_pos (w, charpos, start, end, dy)
                 && !row->ends_at_zv_p
                 && !MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (row)))
          && charpos >= MATRIX_ROW_START_CHARPOS (row))
-       return row;
+       {
+         struct glyph *g;
+
+         if (NILP (XBUFFER (w->buffer)->bidi_display_reordering))
+           return row;
+         /* In bidi-reordered rows, there could be several rows
+            occluding point.  We need to find the one which fits
+            CHARPOS the best.  */
+         for (g = row->glyphs[TEXT_AREA];
+              g < row->glyphs[TEXT_AREA] + row->used[TEXT_AREA];
+              g++)
+           {
+             if (!STRINGP (g->object))
+               {
+                 if (g->charpos > 0 && eabs (g->charpos - charpos) < mindif)
+                   {
+                     mindif = eabs (g->charpos - charpos);
+                     best_row = row;
+                   }
+               }
+           }
+       }
+      else if (best_row)
+       return best_row;
       ++row;
     }
 }
@@ -14760,8 +15367,7 @@ row_containing_pos (w, charpos, start, end, dy)
    7. Update W's window end information.  */
 
 static int
-try_window_id (w)
-     struct window *w;
+try_window_id (struct window *w)
 {
   struct frame *f = XFRAME (w->frame);
   struct glyph_matrix *current_matrix = w->current_matrix;
@@ -14863,6 +15469,18 @@ try_window_id (w)
   if (!NILP (XBUFFER (w->buffer)->word_wrap))
     GIVE_UP (21);
 
+  /* Under bidi reordering, adding or deleting a character in the
+     beginning of a paragraph, before the first strong directional
+     character, can change the base direction of the paragraph (unless
+     the buffer specifies a fixed paragraph direction), which will
+     require to redisplay the whole paragraph.  It might be worthwhile
+     to find the paragraph limits and widen the range of redisplayed
+     lines to that, but for now just give up this optimization and
+     redisplay from scratch.  */
+  if (!NILP (XBUFFER (w->buffer)->bidi_display_reordering)
+      && NILP (XBUFFER (w->buffer)->bidi_paragraph_direction))
+    GIVE_UP (22);
+
   /* Make sure beg_unchanged and end_unchanged are up to date.  Do it
      only if buffer has really changed.  The reason is that the gap is
      initially at Z for freshly visited files.  The code below would
@@ -14962,13 +15580,13 @@ try_window_id (w)
         as is, without changing glyph positions since no text has
         been added/removed in front of the window end.  */
       r0 = MATRIX_FIRST_TEXT_ROW (current_matrix);
-      if (TEXT_POS_EQUAL_P (start, r0->start.pos)
+      if (TEXT_POS_EQUAL_P (start, r0->minpos)
          /* PT must not be in a partially visible line.  */
          && !(PT >= MATRIX_ROW_START_CHARPOS (row)
               && MATRIX_ROW_BOTTOM_Y (row) > window_text_bottom_y (w)))
        {
          /* We have to compute the window end anew since text
-            can have been added/removed after it.  */
+            could have been added/removed after it.  */
          w->window_end_pos
            = make_number (Z - MATRIX_ROW_END_CHARPOS (row));
          w->window_end_bytepos
@@ -15000,7 +15618,7 @@ try_window_id (w)
      start is not in changed text, otherwise positions would not be
      comparable.  */
   row = MATRIX_FIRST_TEXT_ROW (current_matrix);
-  if (!TEXT_POS_EQUAL_P (start, row->start.pos))
+  if (!TEXT_POS_EQUAL_P (start, row->minpos))
     GIVE_UP (16);
 
   /* Give up if the window ends in strings.  Overlay strings
@@ -15485,9 +16103,9 @@ try_window_id (w)
 
 #if GLYPH_DEBUG
 
-void dump_glyph_row P_ ((struct glyph_row *, int, int));
-void dump_glyph_matrix P_ ((struct glyph_matrix *, int));
-void dump_glyph P_ ((struct glyph_row *, struct glyph *, int));
+void dump_glyph_row (struct glyph_row *, int, int);
+void dump_glyph_matrix (struct glyph_matrix *, int);
+void dump_glyph (struct glyph_row *, struct glyph *, int);
 
 
 /* Dump the contents of glyph matrix MATRIX on stderr.
@@ -15704,8 +16322,7 @@ DEFUN ("dump-glyph-matrix", Fdump_glyph_matrix,
 Shows contents of glyph row structures.  With non-nil
 parameter GLYPHS, dump glyphs as well.  If GLYPHS is 1 show
 glyphs in short form, otherwise show glyphs in long form.  */)
-     (glyphs)
-     Lisp_Object glyphs;
+  (Lisp_Object glyphs)
 {
   struct window *w = XWINDOW (selected_window);
   struct buffer *buffer = XBUFFER (w->buffer);
@@ -15723,7 +16340,7 @@ glyphs in short form, otherwise show glyphs in long form.  */)
 
 DEFUN ("dump-frame-glyph-matrix", Fdump_frame_glyph_matrix,
        Sdump_frame_glyph_matrix, 0, 0, "", doc: /* */)
-     ()
+  (void)
 {
   struct frame *f = XFRAME (selected_frame);
   dump_glyph_matrix (f->current_matrix, 1);
@@ -15736,8 +16353,7 @@ DEFUN ("dump-glyph-row", Fdump_glyph_row, Sdump_glyph_row, 1, 2, "",
 GLYPH 0 means don't dump glyphs.
 GLYPH 1 means dump glyphs in short form.
 GLYPH > 1 or omitted means dump glyphs in long form.  */)
-     (row, glyphs)
-     Lisp_Object row, glyphs;
+  (Lisp_Object row, Lisp_Object glyphs)
 {
   struct glyph_matrix *matrix;
   int vpos;
@@ -15758,8 +16374,7 @@ DEFUN ("dump-tool-bar-row", Fdump_tool_bar_row, Sdump_tool_bar_row, 1, 2, "",
 GLYPH 0 means don't dump glyphs.
 GLYPH 1 means dump glyphs in short form.
 GLYPH > 1 or omitted means dump glyphs in long form.  */)
-     (row, glyphs)
-     Lisp_Object row, glyphs;
+  (Lisp_Object row, Lisp_Object glyphs)
 {
   struct frame *sf = SELECTED_FRAME ();
   struct glyph_matrix *m = XWINDOW (sf->tool_bar_window)->current_matrix;
@@ -15777,8 +16392,7 @@ GLYPH > 1 or omitted means dump glyphs in long form.  */)
 DEFUN ("trace-redisplay", Ftrace_redisplay, Strace_redisplay, 0, 1, "P",
        doc: /* Toggle tracing of redisplay.
 With ARG, turn tracing on if and only if ARG is positive.  */)
-     (arg)
-     Lisp_Object arg;
+  (Lisp_Object arg)
 {
   if (NILP (arg))
     trace_redisplay_p = !trace_redisplay_p;
@@ -15795,9 +16409,7 @@ With ARG, turn tracing on if and only if ARG is positive.  */)
 DEFUN ("trace-to-stderr", Ftrace_to_stderr, Strace_to_stderr, 1, MANY, "",
        doc: /* Like `format', but print result to stderr.
 usage: (trace-to-stderr STRING &rest OBJECTS)  */)
-     (nargs, args)
-     int nargs;
-     Lisp_Object *args;
+  (int nargs, Lisp_Object *args)
 {
   Lisp_Object s = Fformat (nargs, args);
   fprintf (stderr, "%s", SDATA (s));
@@ -15816,9 +16428,7 @@ usage: (trace-to-stderr STRING &rest OBJECTS)  */)
    Used for non-window-redisplay windows, and for windows w/o left fringe.  */
 
 static struct glyph_row *
-get_overlay_arrow_glyph_row (w, overlay_arrow_string)
-     struct window *w;
-     Lisp_Object overlay_arrow_string;
+get_overlay_arrow_glyph_row (struct window *w, Lisp_Object overlay_arrow_string)
 {
   struct frame *f = XFRAME (WINDOW_FRAME (w));
   struct buffer *buffer = XBUFFER (w->buffer);
@@ -15884,8 +16494,7 @@ get_overlay_arrow_glyph_row (w, overlay_arrow_string)
    produce_special_glyphs.  */
 
 static void
-insert_left_trunc_glyphs (it)
-     struct it *it;
+insert_left_trunc_glyphs (struct it *it)
 {
   struct it truncate_it;
   struct glyph *from, *end, *to, *toend;
@@ -15903,24 +16512,61 @@ insert_left_trunc_glyphs (it)
   produce_special_glyphs (&truncate_it, IT_TRUNCATION);
 
   /* Overwrite glyphs from IT with truncation glyphs.  */
-  from = truncate_it.glyph_row->glyphs[TEXT_AREA];
-  end = from + truncate_it.glyph_row->used[TEXT_AREA];
-  to = it->glyph_row->glyphs[TEXT_AREA];
-  toend = to + it->glyph_row->used[TEXT_AREA];
-
-  while (from < end)
-    *to++ = *from++;
-
-  /* There may be padding glyphs left over.  Overwrite them too.  */
-  while (to < toend && CHAR_GLYPH_PADDING_P (*to))
+  if (!it->glyph_row->reversed_p)
     {
       from = truncate_it.glyph_row->glyphs[TEXT_AREA];
+      end = from + truncate_it.glyph_row->used[TEXT_AREA];
+      to = it->glyph_row->glyphs[TEXT_AREA];
+      toend = to + it->glyph_row->used[TEXT_AREA];
+
       while (from < end)
        *to++ = *from++;
+
+      /* There may be padding glyphs left over.  Overwrite them too.  */
+      while (to < toend && CHAR_GLYPH_PADDING_P (*to))
+       {
+         from = truncate_it.glyph_row->glyphs[TEXT_AREA];
+         while (from < end)
+           *to++ = *from++;
+       }
+
+      if (to > toend)
+       it->glyph_row->used[TEXT_AREA] = to - it->glyph_row->glyphs[TEXT_AREA];
     }
+  else
+    {
+      /* 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;
+
+      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)
+       {
+         /* Need to free some room before prepending additional
+            glyphs.  */
+         int move_by = from - end + 1;
+         struct glyph *g0 = it->glyph_row->glyphs[TEXT_AREA];
+         struct glyph *g = g0 + it->glyph_row->used[TEXT_AREA] - 1;
 
-  if (to > toend)
-    it->glyph_row->used[TEXT_AREA] = to - it->glyph_row->glyphs[TEXT_AREA];
+         for ( ; g >= g0; g--)
+           g[move_by] = *g;
+         while (from >= end)
+           *to-- = *from--;
+         it->glyph_row->used[TEXT_AREA] += move_by;
+       }
+    }
 }
 
 
@@ -15942,8 +16588,7 @@ insert_left_trunc_glyphs (it)
    must not be zero.  */
 
 static void
-compute_line_metrics (it)
-     struct it *it;
+compute_line_metrics (struct it *it)
 {
   struct glyph_row *row = it->glyph_row;
   int area, i;
@@ -16038,9 +16683,7 @@ compute_line_metrics (it)
    end of the line if the row ends in italic text.  */
 
 static int
-append_space_for_newline (it, default_face_p)
-     struct it *it;
-     int default_face_p;
+append_space_for_newline (struct it *it, int default_face_p)
 {
   if (FRAME_WINDOW_P (it->f))
     {
@@ -16066,7 +16709,7 @@ append_space_for_newline (it, default_face_p)
          saved_pos = it->position;
 
          it->what = IT_CHARACTER;
-         bzero (&it->position, sizeof it->position);
+         memset (&it->position, 0, sizeof it->position);
          it->object = make_number (0);
          it->c = it->char_to_display = ' ';
          it->len = 1;
@@ -16099,26 +16742,34 @@ append_space_for_newline (it, default_face_p)
 
 
 /* Extend the face of the last glyph in the text area of IT->glyph_row
-   to the end of the display line.  Called from display_line.
-   If the glyph row is empty, add a space glyph to it so that we
-   know the face to draw.  Set the glyph row flag fill_line_p.  */
+   to the end of the display line.  Called from display_line.  If the
+   glyph row is empty, add a space glyph to it so that we know the
+   face to draw.  Set the glyph row flag fill_line_p.  If the glyph
+   row is R2L, prepend a stretch glyph to cover the empty space to the
+   left of the leftmost glyph.  */
 
 static void
-extend_face_to_end_of_line (it)
-     struct it *it;
+extend_face_to_end_of_line (struct it *it)
 {
   struct face *face;
   struct frame *f = it->f;
 
-  /* If line is already filled, do nothing.  */
-  if (it->current_x >= it->last_visible_x)
+  /* If line is already filled, do nothing.  Non window-system frames
+     get a grace of one more ``pixel'' because their characters are
+     1-``pixel'' wide, so they hit the equality too early.  This grace
+     is needed only for R2L rows that are not continued, to produce
+     one extra blank where we could display the cursor.  */
+  if (it->current_x >= it->last_visible_x
+      + (!FRAME_WINDOW_P (f)
+        && it->glyph_row->reversed_p
+        && !it->glyph_row->continued_p))
     return;
 
   /* Face extension extends the background and box of IT->face_id
      to the end of the line.  If the background equals the background
      of the frame, we don't have to do anything.  */
   if (it->face_before_selective_p)
-    face = FACE_FROM_ID (it->f, it->saved_face_id);
+    face = FACE_FROM_ID (f, it->saved_face_id);
   else
     face = FACE_FROM_ID (f, it->face_id);
 
@@ -16126,7 +16777,8 @@ extend_face_to_end_of_line (it)
       && it->glyph_row->displays_text_p
       && face->box == FACE_NO_BOX
       && face->background == FRAME_BACKGROUND_PIXEL (f)
-      && !face->stipple)
+      && !face->stipple
+      && !it->glyph_row->reversed_p)
     return;
 
   /* Set the glyph row flag indicating that the face of the last glyph
@@ -16153,6 +16805,50 @@ extend_face_to_end_of_line (it)
          it->glyph_row->glyphs[TEXT_AREA][0].face_id = it->face_id;
          it->glyph_row->used[TEXT_AREA] = 1;
        }
+#ifdef HAVE_WINDOW_SYSTEM
+      if (it->glyph_row->reversed_p)
+       {
+         /* Prepend a stretch glyph to the row, such that the
+            rightmost glyph will be drawn flushed all the way to the
+            right margin of the window.  The stretch glyph that will
+            occupy the empty space, if any, to the left of the
+            glyphs.  */
+         struct font *font = face->font ? face->font : FRAME_FONT (f);
+         struct glyph *row_start = it->glyph_row->glyphs[TEXT_AREA];
+         struct glyph *row_end = row_start + it->glyph_row->used[TEXT_AREA];
+         struct glyph *g;
+         int row_width, stretch_ascent, stretch_width;
+         struct text_pos saved_pos;
+         int saved_face_id, saved_avoid_cursor;
+
+         for (row_width = 0, g = row_start; g < row_end; g++)
+           row_width += g->pixel_width;
+         stretch_width = window_box_width (it->w, TEXT_AREA) - row_width;
+         if (stretch_width > 0)
+           {
+             stretch_ascent =
+               (((it->ascent + it->descent)
+                 * FONT_BASE (font)) / FONT_HEIGHT (font));
+             saved_pos = it->position;
+             memset (&it->position, 0, sizeof it->position);
+             saved_avoid_cursor = it->avoid_cursor_p;
+             it->avoid_cursor_p = 1;
+             saved_face_id = it->face_id;
+             /* The last row's stretch glyph should get the default
+                face, to avoid painting the rest of the window with
+                the region face, if the region ends at ZV.  */
+             if (it->glyph_row->ends_at_zv_p)
+               it->face_id = DEFAULT_FACE_ID;
+             else
+               it->face_id = face->id;
+             append_stretch_glyph (it, make_number (0), stretch_width,
+                                   it->ascent + it->descent, stretch_ascent);
+             it->position = saved_pos;
+             it->avoid_cursor_p = saved_avoid_cursor;
+             it->face_id = saved_face_id;
+           }
+       }
+#endif /* HAVE_WINDOW_SYSTEM */
     }
   else
     {
@@ -16167,11 +16863,17 @@ extend_face_to_end_of_line (it)
       saved_pos = it->position;
 
       it->what = IT_CHARACTER;
-      bzero (&it->position, sizeof it->position);
+      memset (&it->position, 0, sizeof it->position);
       it->object = make_number (0);
       it->c = it->char_to_display = ' ';
       it->len = 1;
-      it->face_id = face->id;
+      /* The last row's blank glyphs should get the default face, to
+        avoid painting the rest of the window with the region face,
+        if the region ends at ZV.  */
+      if (it->glyph_row->ends_at_zv_p)
+       it->face_id = DEFAULT_FACE_ID;
+      else
+       it->face_id = face->id;
 
       PRODUCE_GLYPHS (it);
 
@@ -16193,8 +16895,7 @@ extend_face_to_end_of_line (it)
    trailing whitespace.  */
 
 static int
-trailing_whitespace_p (charpos)
-     int charpos;
+trailing_whitespace_p (int charpos)
 {
   int bytepos = CHAR_TO_BYTE (charpos);
   int c = 0;
@@ -16216,9 +16917,7 @@ trailing_whitespace_p (charpos)
 /* Highlight trailing whitespace, if any, in ROW.  */
 
 void
-highlight_trailing_whitespace (f, row)
-     struct frame *f;
-     struct glyph_row *row;
+highlight_trailing_whitespace (struct frame *f, struct glyph_row *row)
 {
   int used = row->used[TEXT_AREA];
 
@@ -16227,19 +16926,37 @@ highlight_trailing_whitespace (f, row)
       struct glyph *start = row->glyphs[TEXT_AREA];
       struct glyph *glyph = start + used - 1;
 
+      if (row->reversed_p)
+       {
+         /* Right-to-left rows need to be processed in the opposite
+            direction, so swap the edge pointers. */
+         glyph = start;
+         start = row->glyphs[TEXT_AREA] + used - 1;
+       }
+
       /* Skip over glyphs inserted to display the cursor at the
         end of a line, for extending the face of the last glyph
         to the end of the line on terminals, and for truncation
         and continuation glyphs.  */
-      while (glyph >= start
-            && glyph->type == CHAR_GLYPH
-            && INTEGERP (glyph->object))
-       --glyph;
+      if (!row->reversed_p)
+       {
+         while (glyph >= start
+                && glyph->type == CHAR_GLYPH
+                && INTEGERP (glyph->object))
+           --glyph;
+       }
+      else
+       {
+         while (glyph <= start
+                && glyph->type == CHAR_GLYPH
+                && INTEGERP (glyph->object))
+           ++glyph;
+       }
 
       /* If last glyph is a space or stretch, and it's trailing
         whitespace, set the face of all trailing whitespace glyphs in
         IT->glyph_row to `trailing-whitespace'.  */
-      if (glyph >= start
+      if ((row->reversed_p ? glyph <= start : glyph >= start)
          && BUFFERP (glyph->object)
          && (glyph->type == STRETCH_GLYPH
              || (glyph->type == CHAR_GLYPH
@@ -16250,12 +16967,24 @@ highlight_trailing_whitespace (f, row)
          if (face_id < 0)
            return;
 
-         while (glyph >= start
-                && BUFFERP (glyph->object)
-                && (glyph->type == STRETCH_GLYPH
-                    || (glyph->type == CHAR_GLYPH
-                        && glyph->u.ch == ' ')))
-           (glyph--)->face_id = face_id;
+         if (!row->reversed_p)
+           {
+             while (glyph >= start
+                    && BUFFERP (glyph->object)
+                    && (glyph->type == STRETCH_GLYPH
+                        || (glyph->type == CHAR_GLYPH
+                            && glyph->u.ch == ' ')))
+               (glyph--)->face_id = face_id;
+           }
+         else
+           {
+             while (glyph <= start
+                    && BUFFERP (glyph->object)
+                    && (glyph->type == STRETCH_GLYPH
+                        || (glyph->type == CHAR_GLYPH
+                            && glyph->u.ch == ' ')))
+               (glyph++)->face_id = face_id;
+           }
        }
     }
 }
@@ -16265,13 +16994,11 @@ highlight_trailing_whitespace (f, row)
    used to hold the cursor.  */
 
 static int
-cursor_row_p (w, row)
-     struct window *w;
-     struct glyph_row *row;
+cursor_row_p (struct window *w, struct glyph_row *row)
 {
   int cursor_row_p = 1;
 
-  if (PT == MATRIX_ROW_END_CHARPOS (row))
+  if (PT == CHARPOS (row->end.pos))
     {
       /* Suppose the row ends on a string.
         Unless the row is continued, that means it ends on a newline
@@ -16308,14 +17035,15 @@ cursor_row_p (w, row)
        {
          /* If the row ends in middle of a real character,
             and the line is continued, we want the cursor here.
-            That's because MATRIX_ROW_END_CHARPOS would equal
+            That's because CHARPOS (ROW->end.pos) would equal
             PT if PT is before the character.  */
          if (!row->ends_in_ellipsis_p)
            cursor_row_p = row->continued_p;
          else
          /* If the row ends in an ellipsis, then
-            MATRIX_ROW_END_CHARPOS will equal point after the invisible text.
-            We want that position to be displayed after the ellipsis.  */
+            CHARPOS (ROW->end.pos) will equal point after the
+            invisible text.  We want that position to be displayed
+            after the ellipsis.  */
            cursor_row_p = 0;
        }
       /* If the row ends at ZV, display the cursor at the end of that
@@ -16381,9 +17109,7 @@ push_display_prop (struct it *it, Lisp_Object prop)
 /* Return the character-property PROP at the current position in IT.  */
 
 static Lisp_Object
-get_it_property (it, prop)
-     struct it *it;
-     Lisp_Object prop;
+get_it_property (struct it *it, Lisp_Object prop)
 {
   Lisp_Object position;
 
@@ -16427,6 +17153,110 @@ handle_line_prefix (struct it *it)
 
 \f
 
+/* Remove N glyphs at the start of a reversed IT->glyph_row.  Called
+   only for R2L lines from display_line, when it decides that too many
+   glyphs were produced by PRODUCE_GLYPHS, and the line needs to be
+   continued.  */
+static void
+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]);
+
+  if (n > it->glyph_row->used[TEXT_AREA])
+    n = it->glyph_row->used[TEXT_AREA];
+  glyph = it->glyph_row->glyphs[TEXT_AREA] + n;
+  end = it->glyph_row->glyphs[TEXT_AREA] + it->glyph_row->used[TEXT_AREA];
+  for ( ; glyph < end; glyph++)
+    glyph[-n] = *glyph;
+}
+
+/* Find the positions in a bidi-reordered ROW to serve as ROW->minpos
+   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)
+{
+  /* FIXME: Revisit this when glyph ``spilling'' in continuation
+     lines' rows is implemented for bidi-reordered rows.  */
+
+  /* ROW->minpos is the value of min_pos, the minimal buffer position
+     we have in ROW.  */
+  if (min_pos <= ZV)
+    SET_TEXT_POS (row->minpos, min_pos, min_bpos);
+  else
+    {
+      /* We didn't find _any_ valid buffer positions in any of the
+        glyphs, so we must trust the iterator's computed
+        positions.  */
+      row->minpos = row->start.pos;
+      max_pos = CHARPOS (it->current.pos);
+      max_bpos = BYTEPOS (it->current.pos);
+    }
+
+  if (!max_pos)
+    abort ();
+
+  /* Here are the various use-cases for ending the row, and the
+     corresponding values for ROW->maxpos:
+
+     Line ends in a newline from buffer       eol_pos + 1
+     Line is continued from buffer            max_pos + 1
+     Line is truncated on right               it->current.pos
+     Line ends in a newline from string       max_pos
+     Line is continued from string            max_pos
+     Line is continued from display vector    max_pos
+     Line is entirely from a string           min_pos == max_pos
+     Line is entirely from a display vector   min_pos == max_pos
+     Line that ends at ZV                     ZV
+
+     If you discover other use-cases, please add them here as
+     appropriate.  */
+  if (row->ends_at_zv_p)
+    row->maxpos = it->current.pos;
+  else if (row->used[TEXT_AREA])
+    {
+      if (row->ends_in_newline_from_string_p)
+       SET_TEXT_POS (row->maxpos, max_pos, max_bpos);
+      else if (CHARPOS (it->eol_pos) > 0)
+       SET_TEXT_POS (row->maxpos,
+                     CHARPOS (it->eol_pos) + 1, BYTEPOS (it->eol_pos) + 1);
+      else if (row->continued_p)
+       {
+         /* If max_pos is different from IT's current position, it
+            means IT->method does not belong to the display element
+            at max_pos.  However, it also means that the display
+            element at max_pos was displayed in its entirety on this
+            line, which is equivalent to saying that the next line
+            starts at the next buffer position.  */
+         if (IT_CHARPOS (*it) == max_pos && it->method != GET_FROM_BUFFER)
+           SET_TEXT_POS (row->maxpos, max_pos, max_bpos);
+         else
+           {
+             INC_BOTH (max_pos, max_bpos);
+             SET_TEXT_POS (row->maxpos, max_pos, max_bpos);
+           }
+       }
+      else if (row->truncated_on_right_p)
+       /* display_line already called reseat_at_next_visible_line_start,
+          which puts the iterator at the beginning of the next line, in
+          the logical order. */
+       row->maxpos = it->current.pos;
+      else if (max_pos == min_pos && it->method != GET_FROM_BUFFER)
+       /* A line that is entirely from a string/image/stretch...  */
+       row->maxpos = row->minpos;
+      else
+       abort ();
+    }
+  else
+    row->maxpos = it->current.pos;
+}
+
 /* Construct the glyph row IT->glyph_row in the desired matrix of
    IT->w from text at the current position of IT.  See dispextern.h
    for an overview of struct it.  Value is non-zero if
@@ -16434,8 +17264,7 @@ handle_line_prefix (struct it *it)
    only.  */
 
 static int
-display_line (it)
-     struct it *it;
+display_line (struct it *it)
 {
   struct glyph_row *row = it->glyph_row;
   Lisp_Object overlay_arrow_string;
@@ -16444,6 +17273,10 @@ display_line (it)
   int wrap_row_used = -1, wrap_row_ascent, wrap_row_height;
   int wrap_row_phys_ascent, wrap_row_phys_height;
   int wrap_row_extra_line_spacing;
+  EMACS_INT wrap_row_min_pos, wrap_row_min_bpos;
+  EMACS_INT wrap_row_max_pos, wrap_row_max_bpos;
+  int cvpos;
+  EMACS_INT min_pos = ZV + 1, min_bpos, max_pos = 0, max_bpos;
 
   /* We always start displaying at hpos zero even if hscrolled.  */
   xassert (it->hpos == 0 && it->current_x == 0);
@@ -16500,6 +17333,23 @@ display_line (it)
   row->phys_height = it->max_phys_ascent + it->max_phys_descent;
   row->extra_line_spacing = it->max_extra_line_spacing;
 
+/* Utility macro to record max and min buffer positions seen until now.  */
+#define RECORD_MAX_MIN_POS(IT)                                 \
+  do                                                           \
+    {                                                          \
+      if (IT_CHARPOS (*(IT)) < min_pos)                                \
+       {                                                       \
+         min_pos = IT_CHARPOS (*(IT));                         \
+         min_bpos = IT_BYTEPOS (*(IT));                        \
+       }                                                       \
+      if (IT_CHARPOS (*(IT)) > max_pos)                                \
+       {                                                       \
+         max_pos = IT_CHARPOS (*(IT));                         \
+         max_bpos = IT_BYTEPOS (*(IT));                        \
+       }                                                       \
+    }                                                          \
+  while (0)
+
   /* Loop generating characters.  The loop is left with IT on the next
      character to display.  */
   while (1)
@@ -16532,6 +17382,12 @@ display_line (it)
 
          it->continuation_lines_width = 0;
          row->ends_at_zv_p = 1;
+         /* A row that displays right-to-left text must always have
+            its last face extended all the way to the end of line,
+            even if this row ends in ZV, because we still write to
+            the screen left to right.  */
+         if (row->reversed_p)
+           extend_face_to_end_of_line (it);
          break;
        }
 
@@ -16563,6 +17419,10 @@ display_line (it)
                  wrap_row_phys_ascent = row->phys_ascent;
                  wrap_row_phys_height = row->phys_height;
                  wrap_row_extra_line_spacing = row->extra_line_spacing;
+                 wrap_row_min_pos = min_pos;
+                 wrap_row_min_bpos = min_bpos;
+                 wrap_row_max_pos = max_pos;
+                 wrap_row_max_bpos = max_bpos;
                  may_wrap = 0;
                }
            }
@@ -16613,6 +17473,10 @@ display_line (it)
                                         it->max_extra_line_spacing);
          if (it->current_x - it->pixel_width < it->first_visible_x)
            row->x = x - it->first_visible_x;
+         /* Record the maximum and minimum buffer positions seen so
+            far in glyphs that will be displayed by this row.  */
+         if (it->bidi_p)
+           RECORD_MAX_MIN_POS (it);
        }
       else
        {
@@ -16646,6 +17510,11 @@ display_line (it)
                      it->current_x = new_x;
                      it->continuation_lines_width += new_x;
                      ++it->hpos;
+                     /* Record the maximum and minimum buffer
+                        positions seen so far in glyphs that will be
+                        displayed by this row.  */
+                     if (it->bidi_p)
+                       RECORD_MAX_MIN_POS (it);
                      if (i == nglyphs - 1)
                        {
                          /* If line-wrap is on, check if a previous
@@ -16684,6 +17553,9 @@ display_line (it)
                      /* A padding glyph that doesn't fit on this line.
                         This means the whole character doesn't fit
                         on the line.  */
+                     if (row->reversed_p)
+                       unproduce_glyphs (it, row->used[TEXT_AREA]
+                                              - n_glyphs_before);
                      row->used[TEXT_AREA] = n_glyphs_before;
 
                      /* Fill the rest of the row with continuation
@@ -16706,6 +17578,9 @@ display_line (it)
                  else if (wrap_row_used > 0)
                    {
                    back_to_wrap:
+                     if (row->reversed_p)
+                       unproduce_glyphs (it,
+                                         row->used[TEXT_AREA] - wrap_row_used);
                      *it = wrap_it;
                      it->continuation_lines_width += wrap_x;
                      row->used[TEXT_AREA] = wrap_row_used;
@@ -16714,6 +17589,10 @@ display_line (it)
                      row->phys_ascent = wrap_row_phys_ascent;
                      row->phys_height = wrap_row_phys_height;
                      row->extra_line_spacing = wrap_row_extra_line_spacing;
+                     min_pos = wrap_row_min_pos;
+                     min_bpos = wrap_row_min_bpos;
+                     max_pos = wrap_row_max_pos;
+                     max_bpos = wrap_row_max_bpos;
                      row->continued_p = 1;
                      row->ends_at_zv_p = 0;
                      row->exact_window_width_line_p = 0;
@@ -16741,6 +17620,9 @@ display_line (it)
                      /* Something other than a TAB that draws past
                         the right edge of the window.  Restore
                         positions to values before the element.  */
+                     if (row->reversed_p)
+                       unproduce_glyphs (it, row->used[TEXT_AREA]
+                                              - (n_glyphs_before + i));
                      row->used[TEXT_AREA] = n_glyphs_before + i;
 
                      /* Display continuation glyphs.  */
@@ -16773,6 +17655,12 @@ display_line (it)
                  /* Increment number of glyphs actually displayed.  */
                  ++it->hpos;
 
+                 /* Record the maximum and minimum buffer positions
+                    seen so far in glyphs that will be displayed by
+                    this row.  */
+                 if (it->bidi_p)
+                   RECORD_MAX_MIN_POS (it);
+
                  if (x < it->first_visible_x)
                    /* Glyph is partially visible, i.e. row starts at
                       negative X position.  */
@@ -16824,6 +17712,10 @@ display_line (it)
          if (used_before == 0)
            row->glyphs[TEXT_AREA]->charpos = CHARPOS (it->position);
 
+         /* Record the position of the newline, for use in
+            find_row_edges.  */
+         it->eol_pos = it->current.pos;
+
          /* Consume the line end.  This skips over invisible lines.  */
          set_iterator_to_next (it, 1);
          it->continuation_lines_width = 0;
@@ -16846,9 +17738,26 @@ display_line (it)
            {
              int i, n;
 
-             for (i = row->used[TEXT_AREA] - 1; i > 0; --i)
-               if (!CHAR_GLYPH_PADDING_P (row->glyphs[TEXT_AREA][i]))
-                 break;
+             if (!row->reversed_p)
+               {
+                 for (i = row->used[TEXT_AREA] - 1; i > 0; --i)
+                   if (!CHAR_GLYPH_PADDING_P (row->glyphs[TEXT_AREA][i]))
+                     break;
+               }
+             else
+               {
+                 for (i = 0; i < row->used[TEXT_AREA]; i++)
+                   if (!CHAR_GLYPH_PADDING_P (row->glyphs[TEXT_AREA][i]))
+                     break;
+                 /* Remove any padding glyphs at the front of ROW, to
+                    make room for the truncation glyphs we will be
+                    adding below.  The loop below always inserts at
+                    least one truncation glyph, so also remove the
+                    last glyph added to ROW.  */
+                 unproduce_glyphs (it, i + 1);
+                 /* Adjust i for the loop below.  */
+                 i = row->used[TEXT_AREA] - (i + 1);
+               }
 
              for (n = row->used[TEXT_AREA]; i < n; ++i)
                {
@@ -16886,13 +17795,33 @@ display_line (it)
   /* If line is not empty and hscrolled, maybe insert truncation glyphs
      at the left window margin.  */
   if (it->first_visible_x
-      && IT_CHARPOS (*it) != MATRIX_ROW_START_CHARPOS (row))
+      && IT_CHARPOS (*it) != CHARPOS (row->start.pos))
     {
       if (!FRAME_WINDOW_P (it->f))
        insert_left_trunc_glyphs (it);
       row->truncated_on_left_p = 1;
     }
 
+  /* Remember the position at which this line ends.
+
+     BIDI Note: any code that needs MATRIX_ROW_START/END_CHARPOS
+     cannot be before the call to find_row_edges below, since that is
+     where these positions are determined. */
+  row->end = it->current;
+  if (!it->bidi_p)
+    {
+      row->minpos = row->start.pos;
+      row->maxpos = row->end.pos;
+    }
+  else
+    {
+      /* ROW->minpos and ROW->maxpos must be the smallest and
+        `1 + the largest' buffer positions in ROW.  But if ROW was
+        bidi-reordered, these two positions can be anywhere in the
+        row, so we must determine them now.  */
+      find_row_edges (it, row, min_pos, min_bpos, max_pos, max_bpos);
+    }
+
   /* If the start of this line is the overlay arrow-position, then
      mark this glyph row as the one containing the overlay arrow.
      This is clearly a mess with variable size fonts.  It would be
@@ -16938,9 +17867,6 @@ display_line (it)
   /* Compute pixel dimensions of this line.  */
   compute_line_metrics (it);
 
-  /* Remember the position at which this line ends.  */
-  row->end = it->current;
-
   /* Record whether this row ends inside an ellipsis.  */
   row->ends_in_ellipsis_p
     = (it->method == GET_FROM_DISPLAY_VECTOR
@@ -16958,7 +17884,18 @@ display_line (it)
   it->right_user_fringe_face_id = 0;
 
   /* Maybe set the cursor.  */
-  if (it->w->cursor.vpos < 0
+  cvpos = it->w->cursor.vpos;
+  if ((cvpos < 0
+       /* In bidi-reordered rows, keep checking for proper cursor
+         position even if one has been found already, because buffer
+         positions in such rows change non-linearly with ROW->VPOS,
+         when a line is continued.  One exception: when we are at ZV,
+         display cursor on the first suitable glyph row, since all
+         the empty rows after that also have their position set to ZV.  */
+       /* FIXME: Revisit this when glyph ``spilling'' in continuation
+         lines' rows is implemented for bidi-reordered rows.  */
+       || (it->bidi_p
+          && !MATRIX_ROW (it->w->desired_matrix, cvpos)->ends_at_zv_p))
       && PT >= MATRIX_ROW_START_CHARPOS (row)
       && PT <= MATRIX_ROW_END_CHARPOS (row)
       && cursor_row_p (it->w, row))
@@ -16974,10 +17911,103 @@ display_line (it)
      row to be used.  */
   it->current_x = it->hpos = 0;
   it->current_y += row->height;
+  SET_TEXT_POS (it->eol_pos, 0, 0);
   ++it->vpos;
   ++it->glyph_row;
-  it->start = it->current;
+  /* The next row should by default use the same value of the
+     reversed_p flag as this one.  set_iterator_to_next decides when
+     it's a new paragraph, and PRODUCE_GLYPHS recomputes the value of
+     the flag accordingly.  */
+  if (it->glyph_row < MATRIX_BOTTOM_TEXT_ROW (it->w->desired_matrix, it->w))
+    it->glyph_row->reversed_p = row->reversed_p;
+  it->start = row->end;
   return row->displays_text_p;
+
+#undef RECORD_MAX_MIN_POS
+}
+
+DEFUN ("current-bidi-paragraph-direction", Fcurrent_bidi_paragraph_direction,
+       Scurrent_bidi_paragraph_direction, 0, 1, 0,
+       doc: /* Return paragraph direction at point in BUFFER.
+Value is either `left-to-right' or `right-to-left'.
+If BUFFER is omitted or nil, it defaults to the current buffer.
+
+Paragraph direction determines how the text in the paragraph is displayed.
+In left-to-right paragraphs, text begins at the left margin of the window
+and the reading direction is generally left to right.  In right-to-left
+paragraphs, text begins at the right margin and is read from right to left.
+
+See also `bidi-paragraph-direction'.  */)
+  (Lisp_Object buffer)
+{
+  struct buffer *buf;
+  struct buffer *old;
+
+  if (NILP (buffer))
+    buf = current_buffer;
+  else
+    {
+      CHECK_BUFFER (buffer);
+      buf = XBUFFER (buffer);
+      old = current_buffer;
+    }
+
+  if (NILP (buf->bidi_display_reordering))
+    return Qleft_to_right;
+  else if (!NILP (buf->bidi_paragraph_direction))
+    return buf->bidi_paragraph_direction;
+  else
+    {
+      /* Determine the direction from buffer text.  We could try to
+        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);
+      int c;
+
+      if (buf != current_buffer)
+       set_buffer_temp (buf);
+      /* bidi_paragraph_init finds the base direction of the paragraph
+        by searching forward from paragraph start.  We need the base
+        direction of the current or _previous_ paragraph, so we need
+        to make sure we are within that paragraph.  To that end, find
+        the previous non-empty line.  */
+      if (pos >= ZV && pos > BEGV)
+       {
+         pos--;
+         bytepos = CHAR_TO_BYTE (pos);
+       }
+      while ((c = FETCH_BYTE (bytepos)) == '\n'
+            || c == ' ' || c == '\t' || c == '\f')
+       {
+         if (bytepos <= BEGV_BYTE)
+           break;
+         bytepos--;
+         pos--;
+       }
+      while (!CHAR_HEAD_P (FETCH_BYTE (bytepos)))
+       bytepos--;
+      itb.charpos = pos;
+      itb.bytepos = bytepos;
+      itb.first_elt = 1;
+      itb.separator_limit = -1;
+
+      bidi_paragraph_init (NEUTRAL_DIR, &itb);
+      if (buf != current_buffer)
+       set_buffer_temp (old);
+      switch (itb.paragraph_dir)
+       {
+       case L2R:
+         return Qleft_to_right;
+         break;
+       case R2L:
+         return Qright_to_left;
+         break;
+       default:
+         abort ();
+       }
+    }
 }
 
 
@@ -16997,8 +18027,7 @@ display_line (it)
    for the menu bar.  */
 
 static void
-display_menu_bar (w)
-     struct window *w;
+display_menu_bar (struct window *w)
 {
   struct frame *f = XFRAME (WINDOW_FRAME (w));
   struct it it;
@@ -17102,9 +18131,7 @@ display_menu_bar (w)
    the number of windows whose mode lines were redisplayed.  */
 
 static int
-redisplay_mode_lines (window, force)
-     Lisp_Object window;
-     int force;
+redisplay_mode_lines (Lisp_Object window, int force)
 {
   int nwindows = 0;
 
@@ -17166,8 +18193,7 @@ redisplay_mode_lines (window, force)
    sum number of mode lines and header lines displayed.  */
 
 static int
-display_mode_lines (w)
-     struct window *w;
+display_mode_lines (struct window *w)
 {
   Lisp_Object old_selected_window, old_selected_frame;
   int n = 0;
@@ -17211,10 +18237,7 @@ display_mode_lines (w)
    displayed.  */
 
 static int
-display_mode_line (w, face_id, format)
-     struct window *w;
-     enum face_id face_id;
-     Lisp_Object format;
+display_mode_line (struct window *w, enum face_id face_id, Lisp_Object format)
 {
   struct it it;
   struct face *face;
@@ -17273,8 +18296,7 @@ display_mode_line (w, face_id, format)
    Return the updated list.  */
 
 static Lisp_Object
-move_elt_to_front (elt, list)
-     Lisp_Object elt, list;
+move_elt_to_front (Lisp_Object elt, Lisp_Object list)
 {
   register Lisp_Object tail, prev;
   register Lisp_Object tem;
@@ -17332,12 +18354,8 @@ move_elt_to_front (elt, list)
    `store_mode_line_string', or `display_string'.  */
 
 static int
-display_mode_element (it, depth, field_width, precision, elt, props, risky)
-     struct it *it;
-     int depth;
-     int field_width, precision;
-     Lisp_Object elt, props;
-     int risky;
+display_mode_element (struct it *it, int depth, int field_width, int precision,
+                     Lisp_Object elt, Lisp_Object props, int risky)
 {
   int n = 0, field, prec;
   int literal = 0;
@@ -17529,7 +18547,7 @@ display_mode_element (it, depth, field_width, precision, elt, props, risky)
                  {
                    int multibyte;
                    int bytepos, charpos;
-                   unsigned char *spec;
+                   const unsigned char *spec;
                    Lisp_Object string;
 
                    bytepos = percent_position;
@@ -17799,13 +18817,8 @@ display_mode_element (it, depth, field_width, precision, elt, props, risky)
  */
 
 static int
-store_mode_line_string (string, lisp_string, copy_string, field_width, precision, props)
-     char *string;
-     Lisp_Object lisp_string;
-     int copy_string;
-     int field_width;
-     int precision;
-     Lisp_Object props;
+store_mode_line_string (const char *string, Lisp_Object lisp_string, int copy_string,
+                       int field_width, int precision, Lisp_Object props)
 {
   int len;
   int n = 0;
@@ -17896,8 +18909,7 @@ If FACE is an integer, the value string has no text properties.
 Optional third and fourth args WINDOW and BUFFER specify the window
 and buffer to use as the context for the formatting (defaults
 are the selected window and the window's buffer).  */)
-     (format, face, window, buffer)
-     Lisp_Object format, face, window, buffer;
+  (Lisp_Object format, Lisp_Object face, Lisp_Object window, Lisp_Object buffer)
 {
   struct it it;
   int len;
@@ -17992,10 +19004,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 (buf, width, d)
-     register char *buf;
-     register int width;
-     register int d;
+pint2str (register char *buf, register int width, register int d)
 {
   register char *p = buf;
 
@@ -18039,10 +19048,7 @@ static const char power_letter[] =
   };
 
 static void
-pint2hrstr (buf, width, d)
-     char *buf;
-     int width;
-     int d;
+pint2hrstr (char *buf, int width, int d)
 {
   /* We aim to represent the nonnegative integer D as
      QUOTIENT.TENTHS * 10 ^ (3 * EXPONENT). */
@@ -18143,10 +19149,7 @@ pint2hrstr (buf, width, d)
 static unsigned char invalid_eol_type[] = "(*invalid*)";
 
 static char *
-decode_mode_spec_coding (coding_system, buf, eol_flag)
-     Lisp_Object coding_system;
-     register char *buf;
-     int eol_flag;
+decode_mode_spec_coding (Lisp_Object coding_system, register char *buf, int eol_flag)
 {
   Lisp_Object val;
   int multibyte = !NILP (current_buffer->enable_multibyte_characters);
@@ -18212,7 +19215,7 @@ decode_mode_spec_coding (coding_system, buf, eol_flag)
          eol_str = invalid_eol_type;
          eol_str_len = sizeof (invalid_eol_type) - 1;
        }
-      bcopy (eol_str, buf, eol_str_len);
+      memcpy (buf, eol_str, eol_str_len);
       buf += eol_str_len;
     }
 
@@ -18230,12 +19233,9 @@ decode_mode_spec_coding (coding_system, buf, eol_flag)
 
 static char lots_of_dashes[] = "--------------------------------------------------------------------------------------------------------------------------------------------";
 
-static char *
-decode_mode_spec (w, c, field_width, precision, string)
-     struct window *w;
-     register int c;
-     int field_width, precision;
-     Lisp_Object *string;
+static const char *
+decode_mode_spec (struct window *w, register int c, int field_width,
+                 int precision, Lisp_Object *string)
 {
   Lisp_Object obj;
   struct frame *f = XFRAME (WINDOW_FRAME (w));
@@ -18571,7 +19571,7 @@ decode_mode_spec (w, c, field_width, precision, string)
       obj = Fget_buffer_process (Fcurrent_buffer ());
       if (NILP (obj))
        return "no process";
-#ifdef subprocesses
+#ifndef MSDOS
       obj = Fsymbol_name (Fprocess_status (obj));
 #endif
       break;
@@ -18652,9 +19652,8 @@ decode_mode_spec (w, c, field_width, precision, string)
    Set *BYTE_POS_PTR to 1 if we found COUNT lines, 0 if we hit LIMIT.  */
 
 static int
-display_count_lines (start, start_byte, limit_byte, count, byte_pos_ptr)
-     int start, start_byte, limit_byte, count;
-     int *byte_pos_ptr;
+display_count_lines (int start, int start_byte, int limit_byte, int count,
+                    int *byte_pos_ptr)
 {
   register unsigned char *cursor;
   unsigned char *base;
@@ -18794,16 +19793,9 @@ display_count_lines (start, start_byte, limit_byte, count, byte_pos_ptr)
    Value is the number of columns displayed.  */
 
 static int
-display_string (string, lisp_string, face_string, face_string_pos,
-               start, it, field_width, precision, max_x, multibyte)
-     unsigned char *string;
-     Lisp_Object lisp_string;
-     Lisp_Object face_string;
-     EMACS_INT face_string_pos;
-     EMACS_INT start;
-     struct it *it;
-     int field_width, precision, max_x;
-     int multibyte;
+display_string (const unsigned char *string, Lisp_Object lisp_string, Lisp_Object face_string,
+               EMACS_INT face_string_pos, EMACS_INT 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;
@@ -18813,7 +19805,7 @@ display_string (string, lisp_string, face_string, face_string_pos,
      with index START.  */
   reseat_to_string (it, NILP (lisp_string) ? string : NULL, lisp_string, start,
                    precision, field_width, multibyte);
-  if (string && STRINGP (lisp_string)) 
+  if (string && STRINGP (lisp_string))
     /* LISP_STRING is the one returned by decode_mode_spec.  We should
        ignore its text properties.  */
     it->stop_charpos = -1;
@@ -18987,9 +19979,7 @@ display_string (string, lisp_string, face_string, face_string_pos,
    and 1 if it's invisible and without an ellipsis.  */
 
 int
-invisible_p (propval, list)
-     register Lisp_Object propval;
-     Lisp_Object list;
+invisible_p (register Lisp_Object propval, Lisp_Object list)
 {
   register Lisp_Object tail, proptail;
 
@@ -19032,8 +20022,7 @@ is checked; or it can be some other value, which is then presumed to be the
 value of the `invisible' property of the text of interest.
 The non-nil value returned can be t for truly invisible text or something
 else if the text is replaced by an ellipsis.  */)
-     (pos_or_prop)
-     Lisp_Object pos_or_prop;
+  (Lisp_Object pos_or_prop)
 {
   Lisp_Object prop
     = (NATNUMP (pos_or_prop) || MARKERP (pos_or_prop)
@@ -19118,12 +20107,8 @@ else if the text is replaced by an ellipsis.  */)
       : - 1)
 
 int
-calc_pixel_width_or_height (res, it, prop, font, width_p, align_to)
-     double *res;
-     struct it *it;
-     Lisp_Object prop;
-     struct font *font;
-     int width_p, *align_to;
+calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop,
+                           struct font *font, int width_p, int *align_to)
 {
   double pixels;
 
@@ -19341,7 +20326,7 @@ dump_glyph_string (s)
    face-override for drawing S.  */
 
 #ifdef HAVE_NTGUI
-#define OPTIONAL_HDC(hdc)  hdc,
+#define OPTIONAL_HDC(hdc)  HDC hdc,
 #define DECLARE_HDC(hdc)   HDC hdc;
 #define ALLOCATE_HDC(hdc, f) hdc = get_frame_dc ((f))
 #define RELEASE_HDC(hdc, f)  release_frame_dc ((f), (hdc))
@@ -19355,17 +20340,12 @@ dump_glyph_string (s)
 #endif
 
 static void
-init_glyph_string (s, OPTIONAL_HDC (hdc) char2b, w, row, area, start, hl)
-     struct glyph_string *s;
-     DECLARE_HDC (hdc)
-     XChar2b *char2b;
-     struct window *w;
-     struct glyph_row *row;
-     enum glyph_row_area area;
-     int start;
-     enum draw_glyphs_face hl;
+init_glyph_string (struct glyph_string *s,
+                  OPTIONAL_HDC (hdc)
+                  XChar2b *char2b, struct window *w, struct glyph_row *row,
+                  enum glyph_row_area area, int start, enum draw_glyphs_face hl)
 {
-  bzero (s, sizeof *s);
+  memset (s, 0, sizeof *s);
   s->w = w;
   s->f = XFRAME (w->frame);
 #ifdef HAVE_NTGUI
@@ -19388,9 +20368,8 @@ init_glyph_string (s, OPTIONAL_HDC (hdc) char2b, w, row, area, start, hl)
    with head *HEAD and tail *TAIL.  Set *HEAD and *TAIL to the result.  */
 
 static INLINE void
-append_glyph_string_lists (head, tail, h, t)
-     struct glyph_string **head, **tail;
-     struct glyph_string *h, *t;
+append_glyph_string_lists (struct glyph_string **head, struct glyph_string **tail,
+                          struct glyph_string *h, struct glyph_string *t)
 {
   if (h)
     {
@@ -19409,9 +20388,8 @@ append_glyph_string_lists (head, tail, h, t)
    result.  */
 
 static INLINE void
-prepend_glyph_string_lists (head, tail, h, t)
-     struct glyph_string **head, **tail;
-     struct glyph_string *h, *t;
+prepend_glyph_string_lists (struct glyph_string **head, struct glyph_string **tail,
+                           struct glyph_string *h, struct glyph_string *t)
 {
   if (h)
     {
@@ -19429,9 +20407,8 @@ prepend_glyph_string_lists (head, tail, h, t)
    Set *HEAD and *TAIL to the resulting list.  */
 
 static INLINE void
-append_glyph_string (head, tail, s)
-     struct glyph_string **head, **tail;
-     struct glyph_string *s;
+append_glyph_string (struct glyph_string **head, struct glyph_string **tail,
+                    struct glyph_string *s)
 {
   s->next = s->prev = NULL;
   append_glyph_string_lists (head, tail, s, s);
@@ -19446,11 +20423,8 @@ append_glyph_string (head, tail, s)
    DISPLAY_P is non-zero.  */
 
 static INLINE struct face *
-get_char_face_and_encoding (f, c, face_id, char2b, multibyte_p, display_p)
-     struct frame *f;
-     int c, face_id;
-     XChar2b *char2b;
-     int multibyte_p, display_p;
+get_char_face_and_encoding (struct frame *f, int c, int face_id,
+                           XChar2b *char2b, int multibyte_p, int display_p)
 {
   struct face *face = FACE_FROM_ID (f, face_id);
 
@@ -19482,11 +20456,8 @@ get_char_face_and_encoding (f, c, face_id, char2b, multibyte_p, display_p)
    a pointer to a realized face that is ready for display.  */
 
 static INLINE struct face *
-get_glyph_face_and_encoding (f, glyph, char2b, two_byte_p)
-     struct frame *f;
-     struct glyph *glyph;
-     XChar2b *char2b;
-     int *two_byte_p;
+get_glyph_face_and_encoding (struct frame *f, struct glyph *glyph,
+                            XChar2b *char2b, int *two_byte_p)
 {
   struct face *face;
 
@@ -19549,10 +20520,8 @@ get_char_glyph_code (int c, struct font *font, XChar2b *char2b)
    Value is the index of a component not in S.  */
 
 static int
-fill_composite_glyph_string (s, base_face, overlaps)
-     struct glyph_string *s;
-     struct face *base_face;
-     int overlaps;
+fill_composite_glyph_string (struct glyph_string *s, struct face *base_face,
+                            int overlaps)
 {
   int i;
   /* For all glyphs of this composition, starting at the offset
@@ -19615,10 +20584,8 @@ fill_composite_glyph_string (s, base_face, overlaps)
 }
 
 static int
-fill_gstring_glyph_string (s, face_id, start, end, overlaps)
-     struct glyph_string *s;
-     int face_id;
-     int start, end, overlaps;
+fill_gstring_glyph_string (struct glyph_string *s, int face_id,
+                          int start, int end, int overlaps)
 {
   struct glyph *glyph, *last;
   Lisp_Object lgstring;
@@ -19662,10 +20629,8 @@ fill_gstring_glyph_string (s, face_id, start, end, overlaps)
    Value is the index of the first glyph not in S.  */
 
 static int
-fill_glyph_string (s, face_id, start, end, overlaps)
-     struct glyph_string *s;
-     int face_id;
-     int start, end, overlaps;
+fill_glyph_string (struct glyph_string *s, int face_id,
+                  int start, int end, int overlaps)
 {
   struct glyph *glyph, *last;
   int voffset;
@@ -19725,8 +20690,7 @@ fill_glyph_string (s, face_id, start, end, overlaps)
 /* Fill glyph string S from image glyph S->first_glyph.  */
 
 static void
-fill_image_glyph_string (s)
-     struct glyph_string *s;
+fill_image_glyph_string (struct glyph_string *s)
 {
   xassert (s->first_glyph->type == IMAGE_GLYPH);
   s->img = IMAGE_FROM_ID (s->f, s->first_glyph->u.img_id);
@@ -19750,11 +20714,8 @@ fill_image_glyph_string (s)
    Value is the index of the first glyph not in S.  */
 
 static int
-fill_stretch_glyph_string (s, row, area, start, end)
-     struct glyph_string *s;
-     struct glyph_row *row;
-     enum glyph_row_area area;
-     int start, end;
+fill_stretch_glyph_string (struct glyph_string *s, struct glyph_row *row,
+                          enum glyph_row_area area, int start, int end)
 {
   struct glyph *glyph, *last;
   int voffset, face_id;
@@ -19788,10 +20749,7 @@ fill_stretch_glyph_string (s, row, area, start, end)
 }
 
 static struct font_metrics *
-get_per_char_metric (f, font, char2b)
-     struct frame *f;
-     struct font *font;
-     XChar2b *char2b;
+get_per_char_metric (struct frame *f, struct font *font, XChar2b *char2b)
 {
   static struct font_metrics metrics;
   unsigned code = (XCHAR2B_BYTE1 (char2b) << 8) | XCHAR2B_BYTE2 (char2b);
@@ -19808,10 +20766,7 @@ get_per_char_metric (f, font, char2b)
    assumed to be zero.  */
 
 void
-x_get_glyph_overhangs (glyph, f, left, right)
-     struct glyph *glyph;
-     struct frame *f;
-     int *left, *right;
+x_get_glyph_overhangs (struct glyph *glyph, struct frame *f, int *left, int *right)
 {
   *left = *right = 0;
 
@@ -19862,8 +20817,7 @@ x_get_glyph_overhangs (glyph, f, left, right)
    if no glyphs are overwritten.  */
 
 static int
-left_overwritten (s)
-     struct glyph_string *s;
+left_overwritten (struct glyph_string *s)
 {
   int k;
 
@@ -19890,8 +20844,7 @@ left_overwritten (s)
    glyph in front of S overwrites S.  */
 
 static int
-left_overwriting (s)
-     struct glyph_string *s;
+left_overwriting (struct glyph_string *s)
 {
   int i, k, x;
   struct glyph *glyphs = s->row->glyphs[s->area];
@@ -19917,8 +20870,7 @@ left_overwriting (s)
    no such glyph is found.  */
 
 static int
-right_overwritten (s)
-     struct glyph_string *s;
+right_overwritten (struct glyph_string *s)
 {
   int k = -1;
 
@@ -19944,8 +20896,7 @@ right_overwritten (s)
    if no such glyph is found.  */
 
 static int
-right_overwriting (s)
-     struct glyph_string *s;
+right_overwriting (struct glyph_string *s)
 {
   int i, k, x;
   int end = s->row->used[s->area];
@@ -19972,10 +20923,7 @@ right_overwriting (s)
    in the drawing area.  */
 
 static INLINE void
-set_glyph_string_background_width (s, start, last_x)
-     struct glyph_string *s;
-     int start;
-     int last_x;
+set_glyph_string_background_width (struct glyph_string *s, int start, int last_x)
 {
   /* If the face of this glyph string has to be drawn to the end of
      the drawing area, set S->extends_to_end_of_line_p.  */
@@ -20004,10 +20952,7 @@ set_glyph_string_background_width (s, start, last_x)
    BACKWARD_P non-zero means process predecessors.  */
 
 static void
-compute_overhangs_and_x (s, x, backward_p)
-     struct glyph_string *s;
-     int x;
-     int backward_p;
+compute_overhangs_and_x (struct glyph_string *s, int x, int backward_p)
 {
   if (backward_p)
     {
@@ -20263,14 +21208,9 @@ compute_overhangs_and_x (s, x, backward_p)
    Value is the x-position reached, relative to AREA of W.  */
 
 static int
-draw_glyphs (w, x, row, area, start, end, hl, overlaps)
-     struct window *w;
-     int x;
-     struct glyph_row *row;
-     enum glyph_row_area area;
-     EMACS_INT start, end;
-     enum draw_glyphs_face hl;
-     int overlaps;
+draw_glyphs (struct window *w, int x, struct glyph_row *row,
+            enum glyph_row_area area, EMACS_INT start, EMACS_INT end,
+            enum draw_glyphs_face hl, int overlaps)
 {
   struct glyph_string *head, *tail;
   struct glyph_string *s;
@@ -20518,8 +21458,7 @@ draw_glyphs (w, x, row, area, start, end, hl, overlaps)
    Called from x_produce_glyphs when IT->glyph_row is non-null.  */
 
 static INLINE void
-append_glyph (it)
-     struct it *it;
+append_glyph (struct it *it)
 {
   struct glyph *glyph;
   enum glyph_row_area area = it->area;
@@ -20530,6 +21469,17 @@ append_glyph (it)
   glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area];
   if (glyph < it->glyph_row->glyphs[area + 1])
     {
+      /* If the glyph row is reversed, we need to prepend the glyph
+        rather than append it.  */
+      if (it->glyph_row->reversed_p && area == TEXT_AREA)
+       {
+         struct glyph *g;
+
+         /* Make room for the additional glyph.  */
+         for (g = glyph - 1; g >= it->glyph_row->glyphs[area]; g--)
+           g[1] = *g;
+         glyph = it->glyph_row->glyphs[area];
+       }
       glyph->charpos = CHARPOS (it->position);
       glyph->object = it->object;
       if (it->pixel_width > 0)
@@ -20559,6 +21509,18 @@ append_glyph (it)
       glyph->u.ch = it->char_to_display;
       glyph->slice = null_glyph_slice;
       glyph->font_type = FONT_TYPE_UNKNOWN;
+      if (it->bidi_p)
+       {
+         glyph->resolved_level = it->bidi_it.resolved_level;
+         if ((it->bidi_it.type & 7) != it->bidi_it.type)
+           abort ();
+         glyph->bidi_type = it->bidi_it.type;
+       }
+      else
+       {
+         glyph->resolved_level = 0;
+         glyph->bidi_type = UNKNOWN_BT;
+       }
       ++it->glyph_row->used[area];
     }
   else
@@ -20570,8 +21532,7 @@ append_glyph (it)
    non-null.  */
 
 static INLINE void
-append_composite_glyph (it)
-     struct it *it;
+append_composite_glyph (struct it *it)
 {
   struct glyph *glyph;
   enum glyph_row_area area = it->area;
@@ -20581,7 +21542,18 @@ append_composite_glyph (it)
   glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area];
   if (glyph < it->glyph_row->glyphs[area + 1])
     {
-      glyph->charpos = CHARPOS (it->position);
+      /* If the glyph row is reversed, we need to prepend the glyph
+        rather than append it.  */
+      if (it->glyph_row->reversed_p && it->area == TEXT_AREA)
+       {
+         struct glyph *g;
+
+         /* Make room for the new glyph.  */
+         for (g = glyph - 1; g >= it->glyph_row->glyphs[it->area]; g--)
+           g[1] = *g;
+         glyph = it->glyph_row->glyphs[it->area];
+       }
+      glyph->charpos = it->cmp_it.charpos;
       glyph->object = it->object;
       glyph->pixel_width = it->pixel_width;
       glyph->ascent = it->ascent;
@@ -20611,6 +21583,13 @@ append_composite_glyph (it)
       glyph->face_id = it->face_id;
       glyph->slice = null_glyph_slice;
       glyph->font_type = FONT_TYPE_UNKNOWN;
+      if (it->bidi_p)
+       {
+         glyph->resolved_level = it->bidi_it.resolved_level;
+         if ((it->bidi_it.type & 7) != it->bidi_it.type)
+           abort ();
+         glyph->bidi_type = it->bidi_it.type;
+       }
       ++it->glyph_row->used[area];
     }
   else
@@ -20622,8 +21601,7 @@ append_composite_glyph (it)
    IT->voffset.  */
 
 static INLINE void
-take_vertical_position_into_account (it)
-     struct it *it;
+take_vertical_position_into_account (struct it *it)
 {
   if (it->voffset)
     {
@@ -20644,8 +21622,7 @@ take_vertical_position_into_account (it)
    an overview of struct display_iterator.  */
 
 static void
-produce_image_glyph (it)
-     struct it *it;
+produce_image_glyph (struct it *it)
 {
   struct image *img;
   struct face *face;
@@ -20785,6 +21762,13 @@ produce_image_glyph (it)
          glyph->u.img_id = img->id;
          glyph->slice = slice;
          glyph->font_type = FONT_TYPE_UNKNOWN;
+         if (it->bidi_p)
+           {
+             glyph->resolved_level = it->bidi_it.resolved_level;
+             if ((it->bidi_it.type & 7) != it->bidi_it.type)
+               abort ();
+             glyph->bidi_type = it->bidi_it.type;
+           }
          ++it->glyph_row->used[area];
        }
       else
@@ -20798,11 +21782,8 @@ produce_image_glyph (it)
    stretch.  ASCENT is the ascent of the glyph (0 <= ASCENT <= HEIGHT).  */
 
 static void
-append_stretch_glyph (it, object, width, height, ascent)
-     struct it *it;
-     Lisp_Object object;
-     int width, height;
-     int ascent;
+append_stretch_glyph (struct it *it, Lisp_Object object,
+                     int width, int height, int ascent)
 {
   struct glyph *glyph;
   enum glyph_row_area area = it->area;
@@ -20812,6 +21793,17 @@ append_stretch_glyph (it, object, width, height, ascent)
   glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area];
   if (glyph < it->glyph_row->glyphs[area + 1])
     {
+      /* If the glyph row is reversed, we need to prepend the glyph
+        rather than append it.  */
+      if (it->glyph_row->reversed_p && area == TEXT_AREA)
+       {
+         struct glyph *g;
+
+         /* Make room for the additional glyph.  */
+         for (g = glyph - 1; g >= it->glyph_row->glyphs[area]; g--)
+           g[1] = *g;
+         glyph = it->glyph_row->glyphs[area];
+       }
       glyph->charpos = CHARPOS (it->position);
       glyph->object = object;
       glyph->pixel_width = width;
@@ -20831,6 +21823,18 @@ append_stretch_glyph (it, object, width, height, ascent)
       glyph->u.stretch.height = height;
       glyph->slice = null_glyph_slice;
       glyph->font_type = FONT_TYPE_UNKNOWN;
+      if (it->bidi_p)
+       {
+         glyph->resolved_level = it->bidi_it.resolved_level;
+         if ((it->bidi_it.type & 7) != it->bidi_it.type)
+           abort ();
+         glyph->bidi_type = it->bidi_it.type;
+       }
+      else
+       {
+         glyph->resolved_level = 0;
+         glyph->bidi_type = UNKNOWN_BT;
+       }
       ++it->glyph_row->used[area];
     }
   else
@@ -20870,8 +21874,7 @@ append_stretch_glyph (it, object, width, height, ascent)
    ASCENT must be in the range 0 <= ASCENT <= 100.  */
 
 static void
-produce_stretch_glyph (it)
-     struct it *it;
+produce_stretch_glyph (struct it *it)
 {
   /* (space :width WIDTH :height HEIGHT ...)  */
   Lisp_Object prop, plist;
@@ -21001,11 +22004,8 @@ produce_stretch_glyph (it)
 
 
 static Lisp_Object
-calc_line_height_property (it, val, font, boff, override)
-     struct it *it;
-     Lisp_Object val;
-     struct font *font;
-     int boff, override;
+calc_line_height_property (struct it *it, Lisp_Object val, struct font *font,
+                          int boff, int override)
 {
   Lisp_Object face_name = Qnil;
   int ascent, descent, height;
@@ -21081,8 +22081,7 @@ calc_line_height_property (it, val, font, boff, override)
    for an overview of struct it.  */
 
 void
-x_produce_glyphs (it)
-     struct it *it;
+x_produce_glyphs (struct it *it)
 {
   int extra_line_spacing = it->extra_line_spacing;
 
@@ -21255,7 +22254,7 @@ x_produce_glyphs (it)
          it->pixel_width = 0;
          it->nglyphs = 0;
 
-         height = get_it_property(it, Qline_height);
+         height = get_it_property (it, Qline_height);
          /* Split (line-height total-height) list */
          if (CONSP (height)
              && CONSP (XCDR (height))
@@ -21264,7 +22263,7 @@ x_produce_glyphs (it)
              total_height = XCAR (XCDR (height));
              height = XCAR (height);
            }
-         height = calc_line_height_property(it, height, font, boff, 1);
+         height = calc_line_height_property (it, height, font, boff, 1);
 
          if (it->override_ascent >= 0)
            {
@@ -21314,11 +22313,11 @@ x_produce_glyphs (it)
                it->ascent = XINT (height) - it->descent;
 
              if (!NILP (total_height))
-               spacing = calc_line_height_property(it, total_height, font, boff, 0);
+               spacing = calc_line_height_property (it, total_height, font, boff, 0);
              else
                {
-                 spacing = get_it_property(it, Qline_spacing);
-                 spacing = calc_line_height_property(it, spacing, font, boff, 0);
+                 spacing = get_it_property (it, Qline_spacing);
+                 spacing = calc_line_height_property (it, spacing, font, boff, 0);
                }
              if (INTEGERP (spacing))
                {
@@ -21757,9 +22756,7 @@ x_produce_glyphs (it)
    row being updated.  */
 
 void
-x_write_glyphs (start, len)
-     struct glyph *start;
-     int len;
+x_write_glyphs (struct glyph *start, int len)
 {
   int x, hpos;
 
@@ -21794,9 +22791,7 @@ x_write_glyphs (start, len)
    Insert LEN glyphs from START at the nominal cursor position.  */
 
 void
-x_insert_glyphs (start, len)
-     struct glyph *start;
-     int len;
+x_insert_glyphs (struct glyph *start, int len)
 {
   struct frame *f;
   struct window *w;
@@ -21854,8 +22849,7 @@ x_insert_glyphs (start, len)
    updated_window.  TO_X == -1 means clear to the end of this area.  */
 
 void
-x_clear_end_of_line (to_x)
-     int to_x;
+x_clear_end_of_line (int to_x)
 {
   struct frame *f;
   struct window *w = updated_window;
@@ -21931,9 +22925,7 @@ x_clear_end_of_line (to_x)
    of the bar cursor.  */
 
 static enum text_cursor_kinds
-get_specified_cursor_type (arg, width)
-     Lisp_Object arg;
-     int *width;
+get_specified_cursor_type (Lisp_Object arg, int *width)
 {
   enum text_cursor_kinds type;
 
@@ -21986,9 +22978,7 @@ get_specified_cursor_type (arg, width)
 
 /* Set the default cursor types for specified frame.  */
 void
-set_frame_cursor_types (f, arg)
-     struct frame *f;
-     Lisp_Object arg;
+set_frame_cursor_types (struct frame *f, Lisp_Object arg)
 {
   int width;
   Lisp_Object tem;
@@ -22022,11 +23012,8 @@ set_frame_cursor_types (f, arg)
    In all other cases, we want a hollow box cursor.  */
 
 static enum text_cursor_kinds
-get_window_cursor_type (w, glyph, width, active_cursor)
-     struct window *w;
-     struct glyph *glyph;
-     int *width;
-     int *active_cursor;
+get_window_cursor_type (struct window *w, struct glyph *glyph, int *width,
+                       int *active_cursor)
 {
   struct frame *f = XFRAME (w->frame);
   struct buffer *b = XBUFFER (w->buffer);
@@ -22182,10 +23169,8 @@ get_window_cursor_type (w, glyph, width, active_cursor)
    are window-relative.  */
 
 static void
-notice_overwritten_cursor (w, area, x0, x1, y0, y1)
-     struct window *w;
-     enum glyph_row_area area;
-     int x0, y0, x1, y1;
+notice_overwritten_cursor (struct window *w, enum glyph_row_area area,
+                          int x0, int x1, int y0, int y1)
 {
   int cx0, cx1, cy0, cy1;
   struct glyph_row *row;
@@ -22204,7 +23189,7 @@ notice_overwritten_cursor (w, area, x0, x1, y0, y1)
   if (row->cursor_in_fringe_p)
     {
       row->cursor_in_fringe_p = 0;
-      draw_fringe_bitmap (w, row, 0);
+      draw_fringe_bitmap (w, row, row->reversed_p);
       w->phys_cursor_on_p = 0;
       return;
     }
@@ -22252,11 +23237,8 @@ notice_overwritten_cursor (w, area, x0, x1, y0, y1)
    with respect to the overlapping part OVERLAPS.  */
 
 void
-x_fix_overlapping_area (w, row, area, overlaps)
-     struct window *w;
-     struct glyph_row *row;
-     enum glyph_row_area area;
-     int overlaps;
+x_fix_overlapping_area (struct window *w, struct glyph_row *row,
+                       enum glyph_row_area area, int overlaps)
 {
   int i, x;
 
@@ -22297,15 +23279,15 @@ x_fix_overlapping_area (w, row, area, overlaps)
    comment of draw_glyphs for the meaning of HL.  */
 
 void
-draw_phys_cursor_glyph (w, row, hl)
-     struct window *w;
-     struct glyph_row *row;
-     enum draw_glyphs_face hl;
+draw_phys_cursor_glyph (struct window *w, struct glyph_row *row,
+                       enum draw_glyphs_face hl)
 {
   /* If cursor hpos is out of bounds, don't draw garbage.  This can
      happen in mini-buffer windows when switching between echo area
      glyphs and mini-buffer.  */
-  if (w->phys_cursor.hpos < row->used[TEXT_AREA])
+  if ((row->reversed_p
+       ? (w->phys_cursor.hpos >= 0)
+       : (w->phys_cursor.hpos < row->used[TEXT_AREA])))
     {
       int on_p = w->phys_cursor_on_p;
       int x1;
@@ -22341,8 +23323,7 @@ draw_phys_cursor_glyph (w, row, hl)
    Erase the image of a cursor of window W from the screen.  */
 
 void
-erase_phys_cursor (w)
-     struct window *w;
+erase_phys_cursor (struct window *w)
 {
   struct frame *f = XFRAME (w->frame);
   Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
@@ -22385,7 +23366,7 @@ erase_phys_cursor (w)
   if (cursor_row->cursor_in_fringe_p)
     {
       cursor_row->cursor_in_fringe_p = 0;
-      draw_fringe_bitmap (w, cursor_row, 0);
+      draw_fringe_bitmap (w, cursor_row, cursor_row->reversed_p);
       goto mark_cursor_off;
     }
 
@@ -22394,7 +23375,9 @@ erase_phys_cursor (w)
      should have cleared the cursor.  Note that we wouldn't be
      able to erase the cursor in this case because we don't have a
      cursor glyph at hand.  */
-  if (w->phys_cursor.hpos >= cursor_row->used[TEXT_AREA])
+  if ((cursor_row->reversed_p
+       ? (w->phys_cursor.hpos < 0)
+       : (w->phys_cursor.hpos >= cursor_row->used[TEXT_AREA])))
     goto mark_cursor_off;
 
   /* If the cursor is in the mouse face area, redisplay that when
@@ -22410,7 +23393,7 @@ erase_phys_cursor (w)
       /* Don't redraw the cursor's spot in mouse face if it is at the
         end of a line (on a newline).  The cursor appears there, but
         mouse highlighting does not.  */
-      && cursor_row->used[TEXT_AREA] > hpos)
+      && cursor_row->used[TEXT_AREA] > hpos && hpos >= 0)
     mouse_face_here_p = 1;
 
   /* Maybe clear the display under the cursor.  */
@@ -22456,9 +23439,8 @@ erase_phys_cursor (w)
    where to put the cursor is specified by HPOS, VPOS, X and Y.  */
 
 void
-display_and_set_cursor (w, on, hpos, vpos, x, y)
-     struct window *w;
-     int on, hpos, vpos, x, y;
+display_and_set_cursor (struct window *w, int on,
+                       int hpos, int vpos, int x, int y)
 {
   struct frame *f = XFRAME (w->frame);
   int new_cursor_type;
@@ -22492,7 +23474,7 @@ display_and_set_cursor (w, on, hpos, vpos, x, y)
 
   glyph = NULL;
   if (!glyph_row->exact_window_width_line_p
-      || hpos < glyph_row->used[TEXT_AREA])
+      || (0 <= hpos && hpos < glyph_row->used[TEXT_AREA]))
     glyph = glyph_row->glyphs[TEXT_AREA] + hpos;
 
   xassert (interrupt_input_blocked);
@@ -22541,9 +23523,7 @@ display_and_set_cursor (w, on, hpos, vpos, x, y)
    of ON.  */
 
 void
-update_window_cursor (w, on)
-     struct window *w;
-     int on;
+update_window_cursor (struct window *w, int on)
 {
   /* Don't update cursor in windows whose frame is in the process
      of being deleted.  */
@@ -22561,9 +23541,7 @@ update_window_cursor (w, on)
    in the window tree rooted at W.  */
 
 static void
-update_cursor_in_window_tree (w, on_p)
-     struct window *w;
-     int on_p;
+update_cursor_in_window_tree (struct window *w, int on_p)
 {
   while (w)
     {
@@ -22584,9 +23562,7 @@ update_cursor_in_window_tree (w, on_p)
    Don't change the cursor's position.  */
 
 void
-x_update_cursor (f, on_p)
-     struct frame *f;
-     int on_p;
+x_update_cursor (struct frame *f, int on_p)
 {
   update_cursor_in_window_tree (XWINDOW (f->root_window), on_p);
 }
@@ -22598,8 +23574,7 @@ x_update_cursor (f, on_p)
    is about to be rewritten.  */
 
 void
-x_clear_cursor (w)
-     struct window *w;
+x_clear_cursor (struct window *w)
 {
   if (FRAME_VISIBLE_P (XFRAME (w->frame)) && w->phys_cursor_on_p)
     update_window_cursor (w, 0);
@@ -22610,9 +23585,7 @@ x_clear_cursor (w)
    Display the active region described by mouse_face_* according to DRAW.  */
 
 void
-show_mouse_face (dpyinfo, draw)
-     Display_Info *dpyinfo;
-     enum draw_glyphs_face draw;
+show_mouse_face (Display_Info *dpyinfo, enum draw_glyphs_face draw)
 {
   struct window *w = XWINDOW (dpyinfo->mouse_face_window);
   struct frame *f = XFRAME (WINDOW_FRAME (w));
@@ -22695,8 +23668,7 @@ show_mouse_face (dpyinfo, draw)
    face was actually drawn unhighlighted.  */
 
 int
-clear_mouse_face (dpyinfo)
-     Display_Info *dpyinfo;
+clear_mouse_face (Display_Info *dpyinfo)
 {
   int cleared = 0;
 
@@ -22718,8 +23690,7 @@ clear_mouse_face (dpyinfo)
    Non-zero if physical cursor of window W is within mouse face.  */
 
 int
-cursor_in_mouse_face_p (w)
-     struct window *w;
+cursor_in_mouse_face_p (struct window *w)
 {
   Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (XFRAME (w->frame));
   int in_mouse_face = 0;
@@ -22898,7 +23869,7 @@ mouse_face_from_buffer_pos (Lisp_Object window,
         associated with the end position, which must not be
         highlighted.  */
       Lisp_Object prev_object;
-      int pos;
+      EMACS_INT pos;
 
       while (glyph > row->glyphs[TEXT_AREA])
        {
@@ -22944,12 +23915,8 @@ mouse_face_from_buffer_pos (Lisp_Object window,
    Value is non-zero if a glyph was found.  */
 
 static int
-fast_find_string_pos (w, pos, object, hpos, vpos, x, y, right_p)
-     struct window *w;
-     EMACS_INT pos;
-     Lisp_Object object;
-     int *hpos, *vpos, *x, *y;
-     int right_p;
+fast_find_string_pos (struct window *w, EMACS_INT pos, Lisp_Object object,
+                     int *hpos, int *vpos, int *x, int *y, int right_p)
 {
   int yb = window_text_bottom_y (w);
   struct glyph_row *r;
@@ -23013,9 +23980,7 @@ fast_find_string_pos (w, pos, object, hpos, vpos, x, y, right_p)
 /* See if position X, Y is within a hot-spot of an image.  */
 
 static int
-on_hot_spot_p (hot_spot, x, y)
-     Lisp_Object hot_spot;
-     int x, y;
+on_hot_spot_p (Lisp_Object hot_spot, int x, int y)
 {
   if (!CONSP (hot_spot))
     return 0;
@@ -23111,9 +24076,7 @@ on_hot_spot_p (hot_spot, x, y)
 }
 
 Lisp_Object
-find_hot_spot (map, x, y)
-     Lisp_Object map;
-     int x, y;
+find_hot_spot (Lisp_Object map, int x, int y)
 {
   while (CONSP (map))
     {
@@ -23138,9 +24101,7 @@ and the radius of the circle; r may be a float or integer.
 A polygon is a cons (poly . [x0 y0 x1 y1 ...]) where each pair in the
 vector describes one corner in the polygon.
 Returns the alist element for the first matching AREA in MAP.  */)
-     (map, x, y)
-     Lisp_Object map;
-     Lisp_Object x, y;
+  (Lisp_Object map, Lisp_Object x, Lisp_Object y)
 {
   if (NILP (map))
     return Qnil;
@@ -23154,10 +24115,7 @@ Returns the alist element for the first matching AREA in MAP.  */)
 
 /* Display frame CURSOR, optionally using shape defined by POINTER.  */
 static void
-define_frame_cursor1 (f, cursor, pointer)
-     struct frame *f;
-     Cursor cursor;
-     Lisp_Object pointer;
+define_frame_cursor1 (struct frame *f, Cursor cursor, Lisp_Object pointer)
 {
   /* Do not change cursor shape while dragging mouse.  */
   if (!NILP (do_mouse_tracking))
@@ -23196,10 +24154,8 @@ define_frame_cursor1 (f, cursor, pointer)
    position relative to the start of the mode line.  */
 
 static void
-note_mode_line_or_margin_highlight (window, x, y, area)
-     Lisp_Object window;
-     int x, y;
-     enum window_part area;
+note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y,
+                                   enum window_part area)
 {
   struct window *w = XWINDOW (window);
   struct frame *f = XFRAME (w->frame);
@@ -23439,9 +24395,7 @@ note_mode_line_or_margin_highlight (window, x, y, area)
    X and Y can be negative or out of range.  */
 
 void
-note_mouse_highlight (f, x, y)
-     struct frame *f;
-     int x, y;
+note_mouse_highlight (struct frame *f, int x, int y)
 {
   Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
   enum window_part part;
@@ -23531,7 +24485,8 @@ note_mouse_highlight (f, x, y)
       && XFASTINT (w->last_modified) == BUF_MODIFF (b)
       && XFASTINT (w->last_overlay_modified) == BUF_OVERLAY_MODIFF (b))
     {
-      int hpos, vpos, pos, i, dx, dy, area;
+      int hpos, vpos, i, dx, dy, area;
+      EMACS_INT pos;
       struct glyph *glyph;
       Lisp_Object object;
       Lisp_Object mouse_face = Qnil, overlay = Qnil, position;
@@ -23819,7 +24774,7 @@ note_mouse_highlight (f, x, y)
                    struct glyph_row *r
                      = MATRIX_ROW (w->current_matrix, vpos);
                    int start = MATRIX_ROW_START_CHARPOS (r);
-                   int pos = string_buffer_position (w, object, start);
+                   EMACS_INT pos = string_buffer_position (w, object, start);
                    if (pos > 0)
                      {
                        help = Fget_char_property (make_number (pos),
@@ -23874,7 +24829,8 @@ note_mouse_highlight (f, x, y)
                      struct glyph_row *r
                        = MATRIX_ROW (w->current_matrix, vpos);
                      int start = MATRIX_ROW_START_CHARPOS (r);
-                     int pos = string_buffer_position (w, object, start);
+                     EMACS_INT pos = string_buffer_position (w, object,
+                                                             start);
                      if (pos > 0)
                        pointer = Fget_char_property (make_number (pos),
                                                      Qpointer, w->buffer);
@@ -23905,8 +24861,7 @@ note_mouse_highlight (f, x, y)
    functions to ensure the mouse-highlight is off.  */
 
 void
-x_clear_window_mouse_face (w)
-     struct window *w;
+x_clear_window_mouse_face (struct window *w)
 {
   Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (XFRAME (w->frame));
   Lisp_Object window;
@@ -23924,8 +24879,7 @@ x_clear_window_mouse_face (w)
    This is used when the size of F is changed.  */
 
 void
-cancel_mouse_face (f)
-     struct frame *f;
+cancel_mouse_face (struct frame *f)
 {
   Lisp_Object window;
   Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
@@ -23953,11 +24907,8 @@ cancel_mouse_face (f)
    which intersects rectangle R.  R is in window-relative coordinates.  */
 
 static void
-expose_area (w, row, r, area)
-     struct window *w;
-     struct glyph_row *row;
-     XRectangle *r;
-     enum glyph_row_area area;
+expose_area (struct window *w, struct glyph_row *row, XRectangle *r,
+            enum glyph_row_area area)
 {
   struct glyph *first = row->glyphs[area];
   struct glyph *end = row->glyphs[area] + row->used[area];
@@ -24011,10 +24962,7 @@ expose_area (w, row, r, area)
    non-zero if mouse-face was overwritten.  */
 
 static int
-expose_line (w, row, r)
-     struct window *w;
-     struct glyph_row *row;
-     XRectangle *r;
+expose_line (struct window *w, struct glyph_row *row, XRectangle *r)
 {
   xassert (row->enabled_p);
 
@@ -24046,11 +24994,10 @@ expose_line (w, row, r)
    LAST_OVERLAPPING_ROW is the last such row.  */
 
 static void
-expose_overlaps (w, first_overlapping_row, last_overlapping_row, r)
-     struct window *w;
-     struct glyph_row *first_overlapping_row;
-     struct glyph_row *last_overlapping_row;
-     XRectangle *r;
+expose_overlaps (struct window *w,
+                struct glyph_row *first_overlapping_row,
+                struct glyph_row *last_overlapping_row,
+                XRectangle *r)
 {
   struct glyph_row *row;
 
@@ -24076,9 +25023,7 @@ expose_overlaps (w, first_overlapping_row, last_overlapping_row, r)
 /* Return non-zero if W's cursor intersects rectangle R.  */
 
 static int
-phys_cursor_in_rect_p (w, r)
-     struct window *w;
-     XRectangle *r;
+phys_cursor_in_rect_p (struct window *w, XRectangle *r)
 {
   XRectangle cr, result;
   struct glyph *cursor_glyph;
@@ -24124,8 +25069,7 @@ phys_cursor_in_rect_p (w, r)
    have vertical scroll bars.  */
 
 void
-x_draw_vertical_border (w)
-     struct window *w;
+x_draw_vertical_border (struct window *w)
 {
   struct frame *f = XFRAME (WINDOW_FRAME (w));
 
@@ -24175,9 +25119,7 @@ x_draw_vertical_border (w)
    mouse-face.  */
 
 static int
-expose_window (w, fr)
-     struct window *w;
-     XRectangle *fr;
+expose_window (struct window *w, XRectangle *fr)
 {
   struct frame *f = XFRAME (w->frame);
   XRectangle wr, r;
@@ -24310,9 +25252,7 @@ expose_window (w, fr)
    non-zero if the exposure overwrites mouse-face.  */
 
 static int
-expose_window_tree (w, r)
-     struct window *w;
-     XRectangle *r;
+expose_window_tree (struct window *w, XRectangle *r)
 {
   struct frame *f = XFRAME (w->frame);
   int mouse_face_overwritten_p = 0;
@@ -24342,9 +25282,7 @@ expose_window_tree (w, r)
    the entire frame.  */
 
 void
-expose_frame (f, x, y, w, h)
-     struct frame *f;
-     int x, y, w, h;
+expose_frame (struct frame *f, int x, int y, int w, int h)
 {
   XRectangle r;
   int mouse_face_overwritten_p = 0;
@@ -24432,8 +25370,7 @@ expose_frame (f, x, y, w, h)
    empty.  */
 
 int
-x_intersect_rectangles (r1, r2, result)
-     XRectangle *r1, *r2, *result;
+x_intersect_rectangles (XRectangle *r1, XRectangle *r2, XRectangle *result)
 {
   XRectangle *left, *right;
   XRectangle *upper, *lower;
@@ -24488,7 +25425,7 @@ x_intersect_rectangles (r1, r2, result)
  ***********************************************************************/
 
 void
-syms_of_xdisp ()
+syms_of_xdisp (void)
 {
   Vwith_echo_area_save_vector = Qnil;
   staticpro (&Vwith_echo_area_save_vector);
@@ -24520,6 +25457,7 @@ syms_of_xdisp ()
 #endif
   defsubr (&Sformat_mode_line);
   defsubr (&Sinvisible_p);
+  defsubr (&Scurrent_bidi_paragraph_direction);
 
   staticpro (&Qmenu_bar_update_hook);
   Qmenu_bar_update_hook = intern_c_string ("menu-bar-update-hook");
@@ -24593,6 +25531,14 @@ syms_of_xdisp ()
   staticpro (&Qnobreak_space);
   Qimage = intern_c_string ("image");
   staticpro (&Qimage);
+  Qtext = intern_c_string ("text");
+  staticpro (&Qtext);
+  Qboth = intern_c_string ("both");
+  staticpro (&Qboth);
+  Qboth_horiz = intern_c_string ("both-horiz");
+  staticpro (&Qboth_horiz);
+  Qtext_image_horiz = intern_c_string ("text-image-horiz");
+  staticpro (&Qtext_image_horiz);
   QCmap = intern_c_string (":map");
   staticpro (&QCmap);
   QCpointer = intern_c_string (":pointer");
@@ -24683,6 +25629,11 @@ syms_of_xdisp ()
   staticpro (&previous_help_echo_string);
   help_echo_pos = -1;
 
+  Qright_to_left = intern_c_string ("right-to-left");
+  staticpro (&Qright_to_left);
+  Qleft_to_right = intern_c_string ("left-to-right");
+  staticpro (&Qleft_to_right);
+
 #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.
@@ -24928,6 +25879,23 @@ vertical margin.  */);
     doc: /* *Relief thickness of tool-bar buttons.  */);
   tool_bar_button_relief = DEFAULT_TOOL_BAR_BUTTON_RELIEF;
 
+  DEFVAR_LISP ("tool-bar-style", &Vtool_bar_style,
+    doc: /* *Tool bar style to use.
+It can be one of
+ image            - show images only
+ text             - show text only
+ 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.  */);
+  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.
+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;
+
   DEFVAR_LISP ("fontification-functions", &Vfontification_functions,
     doc: /* List of functions to call to fontify regions of text.
 Each function is called with one argument POS.  Functions must
@@ -25107,7 +26075,7 @@ Value must be an integer or float.  */);
 /* Initialize this module when Emacs starts.  */
 
 void
-init_xdisp ()
+init_xdisp (void)
 {
   Lisp_Object root_window;
   struct window *mini_w;
@@ -25164,14 +26132,14 @@ init_xdisp ()
 
 /* Return non-zero if houglass timer has been started or hourglass is shown.  */
 int
-hourglass_started ()
+hourglass_started (void)
 {
   return hourglass_shown_p || hourglass_atimer != NULL;
 }
 
 /* Cancel a currently active hourglass timer, and start a new one.  */
 void
-start_hourglass ()
+start_hourglass (void)
 {
 #if defined (HAVE_WINDOW_SYSTEM)
   EMACS_TIME delay;
@@ -25203,7 +26171,7 @@ start_hourglass ()
 /* Cancel the hourglass cursor timer if active, hide a busy cursor if
    shown.  */
 void
-cancel_hourglass ()
+cancel_hourglass (void)
 {
 #if defined (HAVE_WINDOW_SYSTEM)
   if (hourglass_atimer)
index 7dab1a871d1b4b4b85a27aebad2e0488013eed61..21adb948c91495b18c4794576ec11a6f11c1c758 100644 (file)
@@ -321,11 +321,6 @@ Lisp_Object QCreverse_video;
 Lisp_Object QCoverline, QCstrike_through, QCbox, QCinherit;
 Lisp_Object QCfontset;
 
-/* Keywords symbols used for font properties.  */
-extern Lisp_Object QCfoundry, QCadstyle, QCregistry;
-extern Lisp_Object QCspacing, QCsize, QCavgwidth;
-extern Lisp_Object Qp;
-
 /* Symbols used for attribute values.  */
 
 Lisp_Object Qnormal, Qbold, Qultra_light, Qextra_light, Qlight;
@@ -351,7 +346,6 @@ Lisp_Object Qframe_set_background_mode;
 Lisp_Object Qdefault, Qtool_bar, Qregion, Qfringe;
 Lisp_Object Qheader_line, Qscroll_bar, Qcursor, Qborder, Qmouse, Qmenu;
 Lisp_Object Qmode_line_inactive, Qvertical_border;
-extern Lisp_Object Qmode_line;
 
 /* The symbol `face-alias'.  A symbols having that property is an
    alias for another face.  Value of the property is the name of
@@ -359,8 +353,6 @@ extern Lisp_Object Qmode_line;
 
 Lisp_Object Qface_alias;
 
-extern Lisp_Object Qcircular_list;
-
 /* 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
@@ -411,7 +403,6 @@ Lisp_Object Qforeground_color, Qbackground_color;
 /* The symbols `face' and `mouse-face' used as text properties.  */
 
 Lisp_Object Qface;
-extern Lisp_Object Qmouse_face;
 
 /* Property for basic faces which other faces cannot inherit.  */
 
@@ -510,56 +501,55 @@ int menu_face_changed_default;
 struct table_entry;
 struct named_merge_point;
 
-static void map_tty_color P_ ((struct frame *, struct face *,
-                              enum lface_attribute_index, int *));
-static Lisp_Object resolve_face_name P_ ((Lisp_Object, int));
-static int may_use_scalable_font_p P_ ((const char *));
-static void set_font_frame_param P_ ((Lisp_Object, Lisp_Object));
-static int get_lface_attributes P_ ((struct frame *, Lisp_Object, Lisp_Object *,
-                                    int, struct named_merge_point *));
-static int load_pixmap P_ ((struct frame *, Lisp_Object, unsigned *, unsigned *));
-static struct frame *frame_or_selected_frame P_ ((Lisp_Object, int));
-static void load_face_colors P_ ((struct frame *, struct face *, Lisp_Object *));
-static void free_face_colors P_ ((struct frame *, struct face *));
-static int face_color_gray_p P_ ((struct frame *, char *));
-static struct face *realize_face P_ ((struct face_cache *, Lisp_Object *,
-                                     int));
-static struct face *realize_non_ascii_face P_ ((struct frame *, Lisp_Object,
-                                               struct face *));
-static struct face *realize_x_face P_ ((struct face_cache *, Lisp_Object *));
-static struct face *realize_tty_face P_ ((struct face_cache *, Lisp_Object *));
-static int realize_basic_faces P_ ((struct frame *));
-static int realize_default_face P_ ((struct frame *));
-static void realize_named_face P_ ((struct frame *, Lisp_Object, int));
-static int lface_fully_specified_p P_ ((Lisp_Object *));
-static int lface_equal_p P_ ((Lisp_Object *, Lisp_Object *));
-static unsigned hash_string_case_insensitive P_ ((Lisp_Object));
-static unsigned lface_hash P_ ((Lisp_Object *));
-static int lface_same_font_attributes_p P_ ((Lisp_Object *, Lisp_Object *));
-static struct face_cache *make_face_cache P_ ((struct frame *));
-static void clear_face_gcs P_ ((struct face_cache *));
-static void free_face_cache P_ ((struct face_cache *));
-static int face_fontset P_ ((Lisp_Object *));
-static void merge_face_vectors P_ ((struct frame *, Lisp_Object *, Lisp_Object*,
-                                   struct named_merge_point *));
-static int merge_face_ref P_ ((struct frame *, Lisp_Object, Lisp_Object *,
-                              int, struct named_merge_point *));
-static int set_lface_from_font P_ ((struct frame *, Lisp_Object, Lisp_Object,
-                                   int));
-static Lisp_Object lface_from_face_name P_ ((struct frame *, Lisp_Object, int));
-static struct face *make_realized_face P_ ((Lisp_Object *));
-static void cache_face P_ ((struct face_cache *, struct face *, unsigned));
-static void uncache_face P_ ((struct face_cache *, struct face *));
+static void map_tty_color (struct frame *, struct face *,
+                           enum lface_attribute_index, int *);
+static Lisp_Object resolve_face_name (Lisp_Object, int);
+static void set_font_frame_param (Lisp_Object, Lisp_Object);
+static int get_lface_attributes (struct frame *, Lisp_Object, Lisp_Object *,
+                                 int, struct named_merge_point *);
+static int load_pixmap (struct frame *, Lisp_Object, unsigned *, unsigned *);
+static struct frame *frame_or_selected_frame (Lisp_Object, int);
+static void load_face_colors (struct frame *, struct face *, Lisp_Object *);
+static void free_face_colors (struct frame *, struct face *);
+static int face_color_gray_p (struct frame *, const char *);
+static struct face *realize_face (struct face_cache *, Lisp_Object *,
+                                  int);
+static struct face *realize_non_ascii_face (struct frame *, Lisp_Object,
+                                            struct face *);
+static struct face *realize_x_face (struct face_cache *, Lisp_Object *);
+static struct face *realize_tty_face (struct face_cache *, Lisp_Object *);
+static int realize_basic_faces (struct frame *);
+static int realize_default_face (struct frame *);
+static void realize_named_face (struct frame *, Lisp_Object, int);
+static int lface_fully_specified_p (Lisp_Object *);
+static int lface_equal_p (Lisp_Object *, Lisp_Object *);
+static unsigned hash_string_case_insensitive (Lisp_Object);
+static unsigned lface_hash (Lisp_Object *);
+static int lface_same_font_attributes_p (Lisp_Object *, Lisp_Object *);
+static struct face_cache *make_face_cache (struct frame *);
+static void clear_face_gcs (struct face_cache *);
+static void free_face_cache (struct face_cache *);
+static int face_fontset (Lisp_Object *);
+static void merge_face_vectors (struct frame *, Lisp_Object *, Lisp_Object*,
+                                struct named_merge_point *);
+static int merge_face_ref (struct frame *, Lisp_Object, Lisp_Object *,
+                           int, struct named_merge_point *);
+static int set_lface_from_font (struct frame *, Lisp_Object, Lisp_Object,
+                                int);
+static Lisp_Object lface_from_face_name (struct frame *, Lisp_Object, int);
+static struct face *make_realized_face (Lisp_Object *);
+static void cache_face (struct face_cache *, struct face *, unsigned);
+static void uncache_face (struct face_cache *, struct face *);
 
 #ifdef HAVE_WINDOW_SYSTEM
 
-static GC x_create_gc P_ ((struct frame *, unsigned long, XGCValues *));
-static void x_free_gc P_ ((struct frame *, GC));
+static GC x_create_gc (struct frame *, unsigned long, XGCValues *);
+static void x_free_gc (struct frame *, GC);
 
 #ifdef USE_X_TOOLKIT
-static void x_update_menu_appearance P_ ((struct frame *));
+static void x_update_menu_appearance (struct frame *);
 
-extern void free_frame_menubar P_ ((struct frame *));
+extern void free_frame_menubar (struct frame *);
 #endif /* USE_X_TOOLKIT */
 
 #endif /* HAVE_WINDOW_SYSTEM */
@@ -626,7 +616,7 @@ unregister_colors (pixels, n)
 
 DEFUN ("dump-colors", Fdump_colors, Sdump_colors, 0, 0, 0,
        doc: /* Dump currently allocated colors to stderr.  */)
-     ()
+  (void)
 {
   int i, n;
 
@@ -656,10 +646,7 @@ DEFUN ("dump-colors", Fdump_colors, Sdump_colors, 0, 0, 0,
    is called.  */
 
 void
-x_free_colors (f, pixels, npixels)
-     struct frame *f;
-     unsigned long *pixels;
-     int npixels;
+x_free_colors (struct frame *f, long unsigned int *pixels, int npixels)
 {
   int class = FRAME_X_DISPLAY_INFO (f)->visual->class;
 
@@ -681,12 +668,7 @@ x_free_colors (f, pixels, npixels)
    is called.  */
 
 void
-x_free_dpy_colors (dpy, screen, cmap, pixels, npixels)
-     Display *dpy;
-     Screen *screen;
-     Colormap cmap;
-     unsigned long *pixels;
-     int npixels;
+x_free_dpy_colors (Display *dpy, Screen *screen, Colormap cmap, long unsigned int *pixels, int npixels)
 {
   struct x_display_info *dpyinfo = x_display_info_for_display (dpy);
   int class = dpyinfo->visual->class;
@@ -707,10 +689,7 @@ x_free_dpy_colors (dpy, screen, cmap, pixels, npixels)
    are given by XGCV and MASK.  */
 
 static INLINE GC
-x_create_gc (f, mask, xgcv)
-     struct frame *f;
-     unsigned long mask;
-     XGCValues *xgcv;
+x_create_gc (struct frame *f, long unsigned int mask, XGCValues *xgcv)
 {
   GC gc;
   BLOCK_INPUT;
@@ -724,9 +703,7 @@ x_create_gc (f, mask, xgcv)
 /* Free GC which was used on frame F.  */
 
 static INLINE void
-x_free_gc (f, gc)
-     struct frame *f;
-     GC gc;
+x_free_gc (struct frame *f, GC gc)
 {
   eassert (interrupt_input_blocked);
   IF_DEBUG (xassert (--ngcs >= 0));
@@ -739,10 +716,7 @@ x_free_gc (f, gc)
 /* W32 emulation of GCs */
 
 static INLINE GC
-x_create_gc (f, mask, xgcv)
-     struct frame *f;
-     unsigned long mask;
-     XGCValues *xgcv;
+x_create_gc (struct frame *f, unsigned long mask, XGCValues *xgcv)
 {
   GC gc;
   BLOCK_INPUT;
@@ -756,9 +730,7 @@ x_create_gc (f, mask, xgcv)
 /* Free GC which was used on frame F.  */
 
 static INLINE void
-x_free_gc (f, gc)
-     struct frame *f;
-     GC gc;
+x_free_gc (struct frame *f, GC gc)
 {
   IF_DEBUG (xassert (--ngcs >= 0));
   xfree (gc);
@@ -770,21 +742,18 @@ x_free_gc (f, gc)
 /* NS emulation of GCs */
 
 static INLINE GC
-x_create_gc (f, mask, xgcv)
-     struct frame *f;
-     unsigned long mask;
-     XGCValues *xgcv;
+x_create_gc (struct frame *f,
+             unsigned long mask,
+             XGCValues *xgcv)
 {
   GC gc = xmalloc (sizeof (*gc));
   if (gc)
-      bcopy(xgcv, gc, sizeof(XGCValues));
+    memcpy (gc, xgcv, sizeof (XGCValues));
   return gc;
 }
 
 static INLINE void
-x_free_gc (f, gc)
-     struct frame *f;
-     GC gc;
+x_free_gc (struct frame *f, GC gc)
 {
   xfree (gc);
 }
@@ -794,8 +763,7 @@ x_free_gc (f, gc)
    are in ISO8859-1.  */
 
 int
-xstrcasecmp (s1, s2)
-     const unsigned char *s1, *s2;
+xstrcasecmp (const unsigned char *s1, const unsigned char *s2)
 {
   while (*s1 && *s2)
     {
@@ -819,9 +787,7 @@ xstrcasecmp (s1, s2)
    Lisp function definitions.  */
 
 static INLINE struct frame *
-frame_or_selected_frame (frame, nparam)
-     Lisp_Object frame;
-     int nparam;
+frame_or_selected_frame (Lisp_Object frame, int nparam)
 {
   if (NILP (frame))
     frame = selected_frame;
@@ -838,8 +804,7 @@ frame_or_selected_frame (frame, nparam)
 /* Initialize face cache and basic faces for frame F.  */
 
 void
-init_frame_faces (f)
-     struct frame *f;
+init_frame_faces (struct frame *f)
 {
   /* Make a face cache, if F doesn't have one.  */
   if (FRAME_FACE_CACHE (f) == NULL)
@@ -877,8 +842,7 @@ init_frame_faces (f)
 /* Free face cache of frame F.  Called from delete_frame.  */
 
 void
-free_frame_faces (f)
-     struct frame *f;
+free_frame_faces (struct frame *f)
 {
   struct face_cache *face_cache = FRAME_FACE_CACHE (f);
 
@@ -909,8 +873,7 @@ free_frame_faces (f)
    of named faces. */
 
 void
-recompute_basic_faces (f)
-     struct frame *f;
+recompute_basic_faces (struct frame *f)
 {
   if (FRAME_FACE_CACHE (f))
     {
@@ -925,8 +888,7 @@ recompute_basic_faces (f)
    try to free unused fonts, too.  */
 
 void
-clear_face_cache (clear_fonts_p)
-     int clear_fonts_p;
+clear_face_cache (int clear_fonts_p)
 {
 #ifdef HAVE_WINDOW_SYSTEM
   Lisp_Object tail, frame;
@@ -971,8 +933,7 @@ clear_face_cache (clear_fonts_p)
 DEFUN ("clear-face-cache", Fclear_face_cache, Sclear_face_cache, 0, 1, 0,
        doc: /* Clear face caches on all frames.
 Optional THOROUGHLY non-nil means try to free unused fonts, too.  */)
-     (thoroughly)
-     Lisp_Object thoroughly;
+  (Lisp_Object thoroughly)
 {
   clear_face_cache (!NILP (thoroughly));
   ++face_change_count;
@@ -994,8 +955,7 @@ A bitmap specification is either a string, a file name, or a list
 HEIGHT is its height, and DATA is a string containing the bits of
 the pixmap.  Bits are stored row by row, each row occupies
 \(WIDTH + 7)/8 bytes.  */)
-     (object)
-     Lisp_Object object;
+  (Lisp_Object object)
 {
   int pixmap_p = 0;
 
@@ -1045,10 +1005,7 @@ the pixmap.  Bits are stored row by row, each row occupies
    if these pointers are not null.  */
 
 static int
-load_pixmap (f, name, w_ptr, h_ptr)
-     FRAME_PTR f;
-     Lisp_Object name;
-     unsigned int *w_ptr, *h_ptr;
+load_pixmap (FRAME_PTR f, Lisp_Object name, unsigned int *w_ptr, unsigned int *h_ptr)
 {
   int bitmap_id;
 
@@ -1117,9 +1074,7 @@ load_pixmap (f, name, w_ptr, h_ptr)
    Return 0 if there's a problem with RGB_LIST, otherwise return 1.  */
 
 static int
-parse_rgb_list (rgb_list, color)
-     Lisp_Object rgb_list;
-     XColor *color;
+parse_rgb_list (Lisp_Object rgb_list, XColor *color)
 {
 #define PARSE_RGB_LIST_FIELD(field)                                    \
   if (CONSP (rgb_list) && INTEGERP (XCAR (rgb_list)))                  \
@@ -1144,10 +1099,7 @@ parse_rgb_list (rgb_list, color)
    returned in it.  */
 
 static int
-tty_lookup_color (f, color, tty_color, std_color)
-     struct frame *f;
-     Lisp_Object color;
-     XColor *tty_color, *std_color;
+tty_lookup_color (struct frame *f, Lisp_Object color, XColor *tty_color, XColor *std_color)
 {
   Lisp_Object frame, color_desc;
 
@@ -1207,11 +1159,8 @@ tty_lookup_color (f, color, tty_color, std_color)
 /* A version of defined_color for non-X frames.  */
 
 int
-tty_defined_color (f, color_name, color_def, alloc)
-     struct frame *f;
-     char *color_name;
-     XColor *color_def;
-     int alloc;
+tty_defined_color (struct frame *f, const char *color_name,
+                  XColor *color_def, int alloc)
 {
   int status = 1;
 
@@ -1246,11 +1195,7 @@ tty_defined_color (f, color_name, color_def, alloc)
    This does the right thing for any type of frame.  */
 
 int
-defined_color (f, color_name, color_def, alloc)
-     struct frame *f;
-     char *color_name;
-     XColor *color_def;
-     int alloc;
+defined_color (struct frame *f, const char *color_name, XColor *color_def, int alloc)
 {
   if (!FRAME_WINDOW_P (f))
     return tty_defined_color (f, color_name, color_def, alloc);
@@ -1275,9 +1220,7 @@ defined_color (f, color_name, color_def, alloc)
    Lisp string.  */
 
 Lisp_Object
-tty_color_name (f, idx)
-     struct frame *f;
-     int idx;
+tty_color_name (struct frame *f, int idx)
 {
   if (idx >= 0 && !NILP (Ffboundp (Qtty_color_by_index)))
     {
@@ -1312,9 +1255,7 @@ tty_color_name (f, idx)
    The criterion implemented here is not a terribly sophisticated one.  */
 
 static int
-face_color_gray_p (f, color_name)
-     struct frame *f;
-     char *color_name;
+face_color_gray_p (struct frame *f, const char *color_name)
 {
   XColor color;
   int gray_p;
@@ -1341,10 +1282,7 @@ face_color_gray_p (f, color_name)
    color.  */
 
 static int
-face_color_supported_p (f, color_name, background_p)
-     struct frame *f;
-     char *color_name;
-     int background_p;
+face_color_supported_p (struct frame *f, const char *color_name, int background_p)
 {
   Lisp_Object frame;
   XColor not_used;
@@ -1370,8 +1308,7 @@ DEFUN ("color-gray-p", Fcolor_gray_p, Scolor_gray_p, 1, 2, 0,
        doc: /* Return non-nil if COLOR is a shade of gray (or white or black).
 FRAME specifies the frame and thus the display for interpreting COLOR.
 If FRAME is nil or omitted, use the selected frame.  */)
-     (color, frame)
-     Lisp_Object color, frame;
+  (Lisp_Object color, Lisp_Object frame)
 {
   struct frame *f;
 
@@ -1392,8 +1329,7 @@ BACKGROUND-P non-nil means COLOR is used as a background.
 Otherwise, this function tells whether it can be used as a foreground.
 If FRAME is nil or omitted, use the selected frame.
 COLOR must be a valid color name.  */)
-     (color, frame, background_p)
-     Lisp_Object frame, color, background_p;
+  (Lisp_Object color, Lisp_Object frame, Lisp_Object background_p)
 {
   struct frame *f;
 
@@ -1419,11 +1355,7 @@ COLOR must be a valid color name.  */)
    these colors.  */
 
 unsigned long
-load_color (f, face, name, target_index)
-     struct frame *f;
-     struct face *face;
-     Lisp_Object name;
-     enum lface_attribute_index target_index;
+load_color (struct frame *f, struct face *face, Lisp_Object name, enum lface_attribute_index target_index)
 {
   XColor color;
 
@@ -1494,10 +1426,7 @@ load_color (f, face, name, target_index)
    try to emulate gray colors with a stipple from Vface_default_stipple.  */
 
 static void
-load_face_colors (f, face, attrs)
-     struct frame *f;
-     struct face *face;
-     Lisp_Object *attrs;
+load_face_colors (struct frame *f, struct face *face, Lisp_Object *attrs)
 {
   Lisp_Object fg, bg;
 
@@ -1533,9 +1462,7 @@ load_face_colors (f, face, attrs)
 /* Free color PIXEL on frame F.  */
 
 void
-unload_color (f, pixel)
-     struct frame *f;
-     unsigned long pixel;
+unload_color (struct frame *f, long unsigned int pixel)
 {
 #ifdef HAVE_X_WINDOWS
   if (pixel != -1)
@@ -1551,9 +1478,7 @@ unload_color (f, pixel)
 /* Free colors allocated for FACE.  */
 
 static void
-free_face_colors (f, face)
-     struct frame *f;
-     struct face *face;
+free_face_colors (struct frame *f, struct face *face)
 {
 /* PENDING(NS): need to do something here? */
 #ifdef HAVE_X_WINDOWS
@@ -1693,8 +1618,7 @@ static int font_sort_order[4];
 static enum font_property_index font_props_for_sorting[FONT_SIZE_INDEX];
 
 static int
-compare_fonts_by_sort_order (v1, v2)
-     const void *v1, *v2;
+compare_fonts_by_sort_order (const void *v1, const void *v2)
 {
   Lisp_Object font1 = *(Lisp_Object *) v1;
   Lisp_Object font2 = *(Lisp_Object *) v2;
@@ -1742,8 +1666,7 @@ FULL is the full name of the font, and REGISTRY-AND-ENCODING is a string
 giving the registry and encoding of the font.
 The result list is sorted according to the current setting of
 the face font sort order.  */)
-     (family, frame)
-     Lisp_Object family, frame;
+  (Lisp_Object family, Lisp_Object frame)
 {
   Lisp_Object font_spec, list, *drivers, vec;
   int i, nfonts, ndrivers;
@@ -1840,8 +1763,7 @@ fonts to match.  The first MAXIMUM fonts are reported.
 The optional fifth argument WIDTH, if specified, is a number of columns
 occupied by a character of a font.  In that case, return only fonts
 the WIDTH times as wide as FACE on FRAME.  */)
-     (pattern, face, frame, maximum, width)
-    Lisp_Object pattern, face, frame, maximum, width;
+  (Lisp_Object pattern, Lisp_Object face, Lisp_Object frame, Lisp_Object maximum, Lisp_Object width)
 {
   struct frame *f;
   int size, avgwidth;
@@ -2150,9 +2072,7 @@ resolve_face_name_error (ignore)
    Return default face in case of errors.  */
 
 static Lisp_Object
-resolve_face_name (face_name, signal_p)
-     Lisp_Object face_name;
-     int signal_p;
+resolve_face_name (Lisp_Object face_name, int signal_p)
 {
   Lisp_Object orig_face;
   Lisp_Object tortoise, hare;
@@ -2198,10 +2118,7 @@ resolve_face_name (face_name, signal_p)
    signal an error if FACE_NAME is not a valid face name.  If SIGNAL_P
    is zero, value is nil if FACE_NAME is not a valid face name.  */
 static INLINE Lisp_Object
-lface_from_face_name_no_resolve (f, face_name, signal_p)
-     struct frame *f;
-     Lisp_Object face_name;
-     int signal_p;
+lface_from_face_name_no_resolve (struct frame *f, Lisp_Object face_name, int signal_p)
 {
   Lisp_Object lface;
 
@@ -2229,10 +2146,7 @@ lface_from_face_name_no_resolve (f, face_name, signal_p)
    If SIGNAL_P is zero, value is nil if FACE_NAME is not a valid face
    name.  */
 static INLINE Lisp_Object
-lface_from_face_name (f, face_name, signal_p)
-     struct frame *f;
-     Lisp_Object face_name;
-     int signal_p;
+lface_from_face_name (struct frame *f, Lisp_Object face_name, int signal_p)
 {
   face_name = resolve_face_name (face_name, signal_p);
   return lface_from_face_name_no_resolve (f, face_name, signal_p);
@@ -2246,19 +2160,15 @@ lface_from_face_name (f, face_name, signal_p)
    Otherwise, value is zero if FACE_NAME is not a face.  */
 
 static INLINE int
-get_lface_attributes_no_remap (f, face_name, attrs, signal_p)
-     struct frame *f;
-     Lisp_Object face_name;
-     Lisp_Object *attrs;
-     int signal_p;
+get_lface_attributes_no_remap (struct frame *f, Lisp_Object face_name, Lisp_Object *attrs, int signal_p)
 {
   Lisp_Object lface;
 
   lface = lface_from_face_name_no_resolve (f, face_name, signal_p);
 
   if (! NILP (lface))
-    bcopy (XVECTOR (lface)->contents, attrs,
-          LFACE_VECTOR_SIZE * sizeof *attrs);
+    memcpy (attrs, XVECTOR (lface)->contents,
+           LFACE_VECTOR_SIZE * sizeof *attrs);
 
   return !NILP (lface);
 }
@@ -2271,12 +2181,7 @@ get_lface_attributes_no_remap (f, face_name, attrs, signal_p)
    Otherwise, value is zero if FACE_NAME is not a face.  */
 
 static INLINE int
-get_lface_attributes (f, face_name, attrs, signal_p, named_merge_points)
-     struct frame *f;
-     Lisp_Object face_name;
-     Lisp_Object *attrs;
-     int signal_p;
-     struct named_merge_point *named_merge_points;
+get_lface_attributes (struct frame *f, Lisp_Object face_name, Lisp_Object *attrs, int signal_p, struct named_merge_point *named_merge_points)
 {
   Lisp_Object face_remapping;
 
@@ -2312,8 +2217,7 @@ get_lface_attributes (f, face_name, attrs, signal_p, named_merge_points)
    specified, i.e. are non-nil.  */
 
 static int
-lface_fully_specified_p (attrs)
-     Lisp_Object *attrs;
+lface_fully_specified_p (Lisp_Object *attrs)
 {
   int i;
 
@@ -2333,10 +2237,7 @@ lface_fully_specified_p (attrs)
    of FORCE_P.  */
 
 static int
-set_lface_from_font (f, lface, font_object, force_p)
-     struct frame *f;
-     Lisp_Object lface, font_object;
-     int force_p;
+set_lface_from_font (struct frame *f, Lisp_Object lface, Lisp_Object font_object, int force_p)
 {
   Lisp_Object val;
   struct font *font = XFONT_OBJECT (font_object);
@@ -2397,8 +2298,7 @@ set_lface_from_font (f, lface, font_object, force_p)
    unless both FROM and TO are relative.  */
 
 Lisp_Object
-merge_face_heights (from, to, invalid)
-     Lisp_Object from, to, invalid;
+merge_face_heights (Lisp_Object from, Lisp_Object to, Lisp_Object invalid)
 {
   Lisp_Object result = invalid;
 
@@ -2447,10 +2347,7 @@ merge_face_heights (from, to, invalid)
    other places.  */
 
 static INLINE void
-merge_face_vectors (f, from, to, named_merge_points)
-     struct frame *f;
-     Lisp_Object *from, *to;
-     struct named_merge_point *named_merge_points;
+merge_face_vectors (struct frame *f, Lisp_Object *from, Lisp_Object *to, struct named_merge_point *named_merge_points)
 {
   int i;
 
@@ -2517,11 +2414,7 @@ merge_face_vectors (f, from, to, named_merge_points)
    merging succeeded.  */
 
 static int
-merge_named_face (f, face_name, to, named_merge_points)
-     struct frame *f;
-     Lisp_Object face_name;
-     Lisp_Object *to;
-     struct named_merge_point *named_merge_points;
+merge_named_face (struct frame *f, Lisp_Object face_name, Lisp_Object *to, struct named_merge_point *named_merge_points)
 {
   struct named_merge_point named_merge_point;
 
@@ -2571,12 +2464,7 @@ merge_named_face (f, face_name, to, named_merge_points)
    specifications.  */
 
 static int
-merge_face_ref (f, face_ref, to, err_msgs, named_merge_points)
-     struct frame *f;
-     Lisp_Object face_ref;
-     Lisp_Object *to;
-     int err_msgs;
-     struct named_merge_point *named_merge_points;
+merge_face_ref (struct frame *f, Lisp_Object face_ref, Lisp_Object *to, int err_msgs, struct named_merge_point *named_merge_points)
 {
   int ok = 1;                  /* Succeed without an error? */
 
@@ -2806,8 +2694,7 @@ If FACE was not known as a face before, create a new one.
 If optional argument FRAME is specified, make a frame-local face
 for that frame.  Otherwise operate on the global face definition.
 Value is a vector of face attributes.  */)
-     (face, frame)
-     Lisp_Object face, frame;
+  (Lisp_Object face, Lisp_Object frame)
 {
   Lisp_Object global_lface, lface;
   struct frame *f;
@@ -2895,8 +2782,7 @@ FACE should be a symbol or string.
 If optional second argument FRAME is non-nil, check for the
 existence of a frame-local face with name FACE on that frame.
 Otherwise check for the existence of a global face.  */)
-     (face, frame)
-     Lisp_Object face, frame;
+  (Lisp_Object face, Lisp_Object frame)
 {
   Lisp_Object lface;
 
@@ -2924,8 +2810,7 @@ definition of TO on NEW-FRAME.  If NEW-FRAME is nil,
 FRAME controls where the data is copied to.
 
 The value is TO.  */)
-     (from, to, frame, new_frame)
-     Lisp_Object from, to, frame, new_frame;
+  (Lisp_Object from, Lisp_Object to, Lisp_Object frame, Lisp_Object new_frame)
 {
   Lisp_Object lface, copy;
 
@@ -2950,8 +2835,8 @@ The value is TO.  */)
       copy = Finternal_make_lisp_face (to, new_frame);
     }
 
-  bcopy (XVECTOR (lface)->contents, XVECTOR (copy)->contents,
-        LFACE_VECTOR_SIZE * sizeof (Lisp_Object));
+  memcpy (XVECTOR (copy)->contents, XVECTOR (lface)->contents,
+         LFACE_VECTOR_SIZE * sizeof (Lisp_Object));
 
   /* Changing a named face means that all realized faces depending on
      that face are invalid.  Since we cannot tell which realized faces
@@ -2976,8 +2861,7 @@ FRAME nil means change the face of the selected frame.
 FRAME t means change the default for new frames.
 FRAME 0 means change the face on all frames, and change the default
   for new frames.  */)
-     (face, attr, value, frame)
-     Lisp_Object face, attr, value, frame;
+  (Lisp_Object face, Lisp_Object attr, Lisp_Object value, Lisp_Object frame)
 {
   Lisp_Object lface;
   Lisp_Object old_value = Qnil;
@@ -3490,44 +3374,11 @@ FRAME 0 means change the face on all frames, and change the default
 }
 
 
-#ifdef HAVE_WINDOW_SYSTEM
-
-/* Set the `font' frame parameter of FRAME determined from the
-   font-object set in `default' face attributes LFACE.  */
-
-static void
-set_font_frame_param (frame, lface)
-     Lisp_Object frame, lface;
-{
-  struct frame *f = XFRAME (frame);
-  Lisp_Object font;
-
-  if (FRAME_WINDOW_P (f)
-      /* Don't do anything if the font is `unspecified'.  This can
-        happen during frame creation.  */
-      && (font = LFACE_FONT (lface),
-         ! UNSPECIFIEDP (font)))
-    {
-      if (FONT_SPEC_P (font))
-       {
-         font = font_load_for_lface (f, XVECTOR (lface)->contents, font);
-         if (NILP (font))
-           return;
-         LFACE_FONT (lface) = font;
-       }
-      f->default_face_done_p = 0;
-      Fmodify_frame_parameters (frame, Fcons (Fcons (Qfont, font), Qnil));
-    }
-}
-
-
 /* Update the corresponding face when frame parameter PARAM on frame F
    has been assigned the value NEW_VALUE.  */
 
 void
-update_face_from_frame_parameter (f, param, new_value)
-     struct frame *f;
-     Lisp_Object param, new_value;
+update_face_from_frame_parameter (struct frame *f, Lisp_Object param, Lisp_Object new_value)
 {
   Lisp_Object face = Qnil;
   Lisp_Object lface;
@@ -3562,6 +3413,7 @@ update_face_from_frame_parameter (f, param, new_value)
                                  ? new_value : Qunspecified);
       realize_basic_faces (f);
     }
+#ifdef HAVE_WINDOW_SYSTEM
   else if (EQ (param, Qborder_color))
     {
       face = Qborder;
@@ -3583,6 +3435,7 @@ update_face_from_frame_parameter (f, param, new_value)
       LFACE_BACKGROUND (lface) = (STRINGP (new_value)
                                  ? new_value : Qunspecified);
     }
+#endif
 
   /* Changing a named face means that all realized faces depending on
      that face are invalid.  Since we cannot tell which realized faces
@@ -3598,14 +3451,43 @@ update_face_from_frame_parameter (f, param, new_value)
 }
 
 
+#ifdef HAVE_WINDOW_SYSTEM
+
+/* Set the `font' frame parameter of FRAME determined from the
+   font-object set in `default' face attributes LFACE.  */
+
+static void
+set_font_frame_param (Lisp_Object frame, Lisp_Object lface)
+{
+  struct frame *f = XFRAME (frame);
+  Lisp_Object font;
+
+  if (FRAME_WINDOW_P (f)
+      /* Don't do anything if the font is `unspecified'.  This can
+        happen during frame creation.  */
+      && (font = LFACE_FONT (lface),
+         ! UNSPECIFIEDP (font)))
+    {
+      if (FONT_SPEC_P (font))
+       {
+         font = font_load_for_lface (f, XVECTOR (lface)->contents, font);
+         if (NILP (font))
+           return;
+         LFACE_FONT (lface) = font;
+       }
+      f->default_face_done_p = 0;
+      Fmodify_frame_parameters (frame, Fcons (Fcons (Qfont, font), Qnil));
+    }
+}
+
+
 /* Get the value of X resource RESOURCE, class CLASS for the display
    of frame FRAME.  This is here because ordinary `x-get-resource'
    doesn't take a frame argument.  */
 
 DEFUN ("internal-face-x-get-resource", Finternal_face_x_get_resource,
        Sinternal_face_x_get_resource, 3, 3, 0, doc: /* */)
-     (resource, class, frame)
-     Lisp_Object resource, class, frame;
+  (Lisp_Object resource, Lisp_Object class, Lisp_Object frame)
 {
   Lisp_Object value = Qnil;
   CHECK_STRING (resource);
@@ -3625,9 +3507,7 @@ DEFUN ("internal-face-x-get-resource", Finternal_face_x_get_resource,
    error; if SIGNAL_P is zero, return 0.  */
 
 static Lisp_Object
-face_boolean_x_resource_value (value, signal_p)
-     Lisp_Object value;
-     int signal_p;
+face_boolean_x_resource_value (Lisp_Object value, int signal_p)
 {
   Lisp_Object result = make_number (0);
 
@@ -3652,8 +3532,7 @@ DEFUN ("internal-set-lisp-face-attribute-from-resource",
        Finternal_set_lisp_face_attribute_from_resource,
        Sinternal_set_lisp_face_attribute_from_resource,
        3, 4, 0, doc: /* */)
-     (face, attr, value, frame)
-     Lisp_Object face, attr, value, frame;
+  (Lisp_Object face, Lisp_Object attr, Lisp_Object value, Lisp_Object frame)
 {
   CHECK_SYMBOL (face);
   CHECK_SYMBOL (attr);
@@ -3703,8 +3582,7 @@ DEFUN ("internal-set-lisp-face-attribute-from-resource",
 /* Make menus on frame F appear as specified by the `menu' face.  */
 
 static void
-x_update_menu_appearance (f)
-     struct frame *f;
+x_update_menu_appearance (struct frame *f)
 {
   struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
   XrmDatabase rdb;
@@ -3777,8 +3655,6 @@ x_update_menu_appearance (f)
          if (! NILP (xlfd))
            {
 #if defined HAVE_X_I18N
-             extern char *xic_create_fontsetname
-               P_ ((char *base_fontname, Bool motif));
              char *fontsetname = xic_create_fontsetname (SDATA (xlfd), motif);
 #else
              char *fontsetname = (char *) SDATA (xlfd);
@@ -3814,8 +3690,7 @@ A relative value is one that doesn't entirely override whatever is
 inherited from another face.  For most possible attributes,
 the only relative value that users see is `unspecified'.
 However, for :height, floating point values are also relative.  */)
-     (attribute, value)
-     Lisp_Object attribute, value;
+  (Lisp_Object attribute, Lisp_Object value)
 {
   if (EQ (value, Qunspecified) || (EQ (value, Qignore_defface)))
     return Qt;
@@ -3830,8 +3705,7 @@ DEFUN ("merge-face-attribute", Fmerge_face_attribute, Smerge_face_attribute,
        doc: /* Return face ATTRIBUTE VALUE1 merged with VALUE2.
 If VALUE1 or VALUE2 are absolute (see `face-attribute-relative-p'), then
 the result will be absolute, otherwise it will be relative.  */)
-     (attribute, value1, value2)
-     Lisp_Object attribute, value1, value2;
+  (Lisp_Object attribute, Lisp_Object value1, Lisp_Object value2)
 {
   if (EQ (value1, Qunspecified) || EQ (value1, Qignore_defface))
     return value2;
@@ -3851,8 +3725,7 @@ face attribute name, signal an error.
 If the optional argument FRAME is given, report on face SYMBOL in that
 frame.  If FRAME is t, report on the defaults for face SYMBOL (for new
 frames).  If FRAME is omitted or nil, use the selected frame.  */)
-     (symbol, keyword, frame)
-     Lisp_Object symbol, keyword, frame;
+  (Lisp_Object symbol, Lisp_Object keyword, Lisp_Object frame)
 {
   Lisp_Object lface, value = Qnil;
 
@@ -3919,8 +3792,7 @@ DEFUN ("internal-lisp-face-attribute-values",
        Sinternal_lisp_face_attribute_values, 1, 1, 0,
        doc: /* Return a list of valid discrete values for face attribute ATTR.
 Value is nil if ATTR doesn't have a discrete set of valid values.  */)
-     (attr)
-     Lisp_Object attr;
+  (Lisp_Object attr)
 {
   Lisp_Object result = Qnil;
 
@@ -3943,8 +3815,7 @@ DEFUN ("internal-merge-in-global-face", Finternal_merge_in_global_face,
        Sinternal_merge_in_global_face, 2, 2, 0,
        doc: /* Add attributes from frame-default definition of FACE to FACE on FRAME.
 Default face attributes override any local face attributes.  */)
-     (face, frame)
-     Lisp_Object face, frame;
+  (Lisp_Object face, Lisp_Object frame)
 {
   int i;
   Lisp_Object global_lface, local_lface, *gvec, *lvec;
@@ -3982,9 +3853,9 @@ Default face attributes override any local face attributes.  */)
        {
          /* Ensure that the face vector is fully specified by merging
             the previously-cached vector.  */
-         bcopy (oldface->lface, attrs, sizeof attrs);
+         memcpy (attrs, oldface->lface, sizeof attrs);
          merge_face_vectors (f, lvec, attrs, 0);
-         bcopy (attrs, lvec, sizeof attrs);
+         memcpy (lvec, attrs, sizeof attrs);
          newface = realize_face (c, lvec, DEFAULT_FACE_ID);
 
          if ((! UNSPECIFIEDP (gvec[LFACE_FAMILY_INDEX])
@@ -4022,8 +3893,7 @@ If FRAME is t, report on the defaults for face FACE (for new frames).
 If FRAME is omitted or nil, use the selected frame.  And, in this case,
 if the optional third argument CHARACTER is given,
 return the font name used for CHARACTER.  */)
-     (face, frame, character)
-     Lisp_Object face, frame, character;
+  (Lisp_Object face, Lisp_Object frame, Lisp_Object character)
 {
   if (EQ (frame, Qt))
     {
@@ -4073,8 +3943,7 @@ return the font name used for CHARACTER.  */)
    is called quite often.  */
 
 static INLINE int
-face_attr_equal_p (v1, v2)
-     Lisp_Object v1, v2;
+face_attr_equal_p (Lisp_Object v1, Lisp_Object v2)
 {
   /* Type can differ, e.g. when one attribute is unspecified, i.e. nil,
      and the other is specified.  */
@@ -4090,7 +3959,7 @@ face_attr_equal_p (v1, v2)
       if (SBYTES (v1) != SBYTES (v2))
        return 0;
 
-      return bcmp (SDATA (v1), SDATA (v2), SBYTES (v1)) == 0;
+      return memcmp (SDATA (v1), SDATA (v2), SBYTES (v1)) == 0;
 
     case_Lisp_Int:
     case Lisp_Symbol:
@@ -4107,8 +3976,7 @@ face_attr_equal_p (v1, v2)
    is called quite often.  */
 
 static INLINE int
-lface_equal_p (v1, v2)
-     Lisp_Object *v1, *v2;
+lface_equal_p (Lisp_Object *v1, Lisp_Object *v2)
 {
   int i, equal_p = 1;
 
@@ -4125,8 +3993,7 @@ DEFUN ("internal-lisp-face-equal-p", Finternal_lisp_face_equal_p,
 If the optional argument FRAME is given, report on FACE1 and FACE2 in that frame.
 If FRAME is t, report on the defaults for FACE1 and FACE2 (for new frames).
 If FRAME is omitted or nil, use the selected frame.  */)
-     (face1, face2, frame)
-     Lisp_Object face1, face2, frame;
+  (Lisp_Object face1, Lisp_Object face2, Lisp_Object frame)
 {
   int equal_p;
   struct frame *f;
@@ -4155,8 +4022,7 @@ DEFUN ("internal-lisp-face-empty-p", Finternal_lisp_face_empty_p,
 If the optional argument FRAME is given, report on face FACE in that frame.
 If FRAME is t, report on the defaults for face FACE (for new frames).
 If FRAME is omitted or nil, use the selected frame.  */)
-     (face, frame)
-     Lisp_Object face, frame;
+  (Lisp_Object face, Lisp_Object frame)
 {
   struct frame *f;
   Lisp_Object lface;
@@ -4184,8 +4050,7 @@ DEFUN ("frame-face-alist", Fframe_face_alist, Sframe_face_alist,
        0, 1, 0,
        doc: /* Return an alist of frame-local faces defined on FRAME.
 For internal use only.  */)
-     (frame)
-     Lisp_Object frame;
+  (Lisp_Object frame)
 {
   struct frame *f = frame_or_selected_frame (frame, 0);
   return f->face_alist;
@@ -4196,8 +4061,7 @@ For internal use only.  */)
    below in computing a hash value for a Lisp face.  */
 
 static INLINE unsigned
-hash_string_case_insensitive (string)
-     Lisp_Object string;
+hash_string_case_insensitive (Lisp_Object string)
 {
   const unsigned char *s;
   unsigned hash = 0;
@@ -4211,8 +4075,7 @@ hash_string_case_insensitive (string)
 /* Return a hash code for face attribute vector V.  */
 
 static INLINE unsigned
-lface_hash (v)
-     Lisp_Object *v;
+lface_hash (Lisp_Object *v)
 {
   return (hash_string_case_insensitive (v[LFACE_FAMILY_INDEX])
          ^ hash_string_case_insensitive (v[LFACE_FOUNDRY_INDEX])
@@ -4231,8 +4094,7 @@ lface_hash (v)
    LFACE1 and LFACE2 must be fully-specified.  */
 
 static INLINE int
-lface_same_font_attributes_p (lface1, lface2)
-     Lisp_Object *lface1, *lface2;
+lface_same_font_attributes_p (Lisp_Object *lface1, Lisp_Object *lface2)
 {
   xassert (lface_fully_specified_p (lface1)
           && lface_fully_specified_p (lface2));
@@ -4263,13 +4125,12 @@ lface_same_font_attributes_p (lface1, lface2)
    vector ATTR.  */
 
 static struct face *
-make_realized_face (attr)
-     Lisp_Object *attr;
+make_realized_face (Lisp_Object *attr)
 {
   struct face *face = (struct face *) xmalloc (sizeof *face);
-  bzero (face, sizeof *face);
+  memset (face, 0, sizeof *face);
   face->ascii_face = face;
-  bcopy (attr, face->lface, sizeof face->lface);
+  memcpy (face->lface, attr, sizeof face->lface);
   return face;
 }
 
@@ -4278,9 +4139,7 @@ make_realized_face (attr)
    be null.  */
 
 void
-free_realized_face (f, face)
-     struct frame *f;
-     struct face *face;
+free_realized_face (struct frame *f, struct face *face)
 {
   if (face)
     {
@@ -4315,9 +4174,7 @@ free_realized_face (f, face)
    by clearing the face cache.  */
 
 void
-prepare_face_for_display (f, face)
-     struct frame *f;
-     struct face *face;
+prepare_face_for_display (struct frame *f, struct face *face)
 {
 #ifdef HAVE_WINDOW_SYSTEM
   xassert (FRAME_WINDOW_P (f));
@@ -4354,8 +4211,7 @@ prepare_face_for_display (f, face)
 /* Returns the `distance' between the colors X and Y.  */
 
 static int
-color_distance (x, y)
-     XColor *x, *y;
+color_distance (XColor *x, XColor *y)
 {
   /* This formula is from a paper title `Colour metric' by Thiadmer Riemersma.
      Quoting from that paper:
@@ -4384,8 +4240,7 @@ DEFUN ("color-distance", Fcolor_distance, Scolor_distance, 2, 3, 0,
 COLOR1 and COLOR2 may be either strings containing the color name,
 or lists of the form (RED GREEN BLUE).
 If FRAME is unspecified or nil, the current frame is used.  */)
-     (color1, color2, frame)
-     Lisp_Object color1, color2, frame;
+  (Lisp_Object color1, Lisp_Object color2, Lisp_Object frame)
 {
   struct frame *f;
   XColor cdef1, cdef2;
@@ -4413,17 +4268,16 @@ If FRAME is unspecified or nil, the current frame is used.  */)
 /* Return a new face cache for frame F.  */
 
 static struct face_cache *
-make_face_cache (f)
-     struct frame *f;
+make_face_cache (struct frame *f)
 {
   struct face_cache *c;
   int size;
 
   c = (struct face_cache *) xmalloc (sizeof *c);
-  bzero (c, sizeof *c);
+  memset (c, 0, sizeof *c);
   size = FACE_CACHE_BUCKETS_SIZE * sizeof *c->buckets;
   c->buckets = (struct face **) xmalloc (size);
-  bzero (c->buckets, size);
+  memset (c->buckets, 0, size);
   c->size = 50;
   c->faces_by_id = (struct face **) xmalloc (c->size * sizeof *c->faces_by_id);
   c->f = f;
@@ -4437,8 +4291,7 @@ make_face_cache (f)
    keeping too many graphics contexts that are no longer needed.  */
 
 static void
-clear_face_gcs (c)
-     struct face_cache *c;
+clear_face_gcs (struct face_cache *c)
 {
   if (c && FRAME_WINDOW_P (c->f))
     {
@@ -4468,8 +4321,7 @@ clear_face_gcs (c)
    event doesn't try to use faces we destroyed.  */
 
 static void
-free_realized_faces (c)
-     struct face_cache *c;
+free_realized_faces (struct face_cache *c)
 {
   if (c && c->used)
     {
@@ -4489,7 +4341,7 @@ free_realized_faces (c)
 
       c->used = 0;
       size = FACE_CACHE_BUCKETS_SIZE * sizeof *c->buckets;
-      bzero (c->buckets, size);
+      memset (c->buckets, 0, size);
 
       /* Must do a thorough redisplay the next time.  Mark current
         matrices as invalid because they will reference faces freed
@@ -4509,9 +4361,7 @@ free_realized_faces (c)
 /* Free all realized faces that are using FONTSET on frame F.  */
 
 void
-free_realized_faces_for_fontset (f, fontset)
-     struct frame *f;
-     int fontset;
+free_realized_faces_for_fontset (struct frame *f, int fontset)
 {
   struct face_cache *cache = FRAME_FACE_CACHE (f);
   struct face *face;
@@ -4552,8 +4402,7 @@ free_realized_faces_for_fontset (f, fontset)
    because we can't tell which realized faces depend on that face.  */
 
 void
-free_all_realized_faces (frame)
-     Lisp_Object frame;
+free_all_realized_faces (Lisp_Object frame)
 {
   if (NILP (frame))
     {
@@ -4569,8 +4418,7 @@ free_all_realized_faces (frame)
 /* Free face cache C and faces in it, including their X resources.  */
 
 static void
-free_face_cache (c)
-     struct face_cache *c;
+free_face_cache (struct face_cache *c)
 {
   if (c)
     {
@@ -4590,10 +4438,7 @@ free_face_cache (c)
    that a requested face is not cached.  */
 
 static void
-cache_face (c, face, hash)
-     struct face_cache *c;
-     struct face *face;
-     unsigned hash;
+cache_face (struct face_cache *c, struct face *face, unsigned int hash)
 {
   int i = hash % FACE_CACHE_BUCKETS_SIZE;
 
@@ -4670,9 +4515,7 @@ cache_face (c, face, hash)
 /* Remove face FACE from cache C.  */
 
 static void
-uncache_face (c, face)
-     struct face_cache *c;
-     struct face *face;
+uncache_face (struct face_cache *c, struct face *face)
 {
   int i = face->hash % FACE_CACHE_BUCKETS_SIZE;
 
@@ -4696,9 +4539,7 @@ uncache_face (c, face)
    realize a new one.  */
 
 INLINE int
-lookup_face (f, attr)
-     struct frame *f;
-     Lisp_Object *attr;
+lookup_face (struct frame *f, Lisp_Object *attr)
 {
   struct face_cache *cache = FRAME_FACE_CACHE (f);
   unsigned hash;
@@ -4744,10 +4585,7 @@ lookup_face (f, attr)
    suitable face is found, realize a new one.  */
 
 int
-face_for_font (f, font_object, base_face)
-     struct frame *f;
-     Lisp_Object font_object;
-     struct face *base_face;
+face_for_font (struct frame *f, Lisp_Object font_object, struct face *base_face)
 {
   struct face_cache *cache = FRAME_FACE_CACHE (f);
   unsigned hash;
@@ -4782,10 +4620,7 @@ face_for_font (f, font_object, base_face)
    face isn't realized and cannot be realized.  */
 
 int
-lookup_named_face (f, symbol, signal_p)
-     struct frame *f;
-     Lisp_Object symbol;
-     int signal_p;
+lookup_named_face (struct frame *f, Lisp_Object symbol, int signal_p)
 {
   Lisp_Object attrs[LFACE_VECTOR_SIZE];
   Lisp_Object symbol_attrs[LFACE_VECTOR_SIZE];
@@ -4803,7 +4638,7 @@ lookup_named_face (f, symbol, signal_p)
   if (! get_lface_attributes (f, symbol, symbol_attrs, signal_p, 0))
     return -1;
 
-  bcopy (default_face->lface, attrs, sizeof attrs);
+  memcpy (attrs, default_face->lface, sizeof attrs);
   merge_face_vectors (f, symbol_attrs, attrs, 0);
 
   return lookup_face (f, attrs);
@@ -4817,9 +4652,7 @@ lookup_named_face (f, symbol, signal_p)
    rather than signal an error.   */
 
 int
-lookup_basic_face (f, face_id)
-     struct frame *f;
-     int face_id;
+lookup_basic_face (struct frame *f, int face_id)
 {
   Lisp_Object name, mapping;
   int remapped_face_id;
@@ -4866,9 +4699,7 @@ lookup_basic_face (f, face_id)
    LFACE_ID on frame F.  Value is -1 if LFACE_ID isn't valid.  */
 
 int
-ascii_face_of_lisp_face (f, lface_id)
-     struct frame *f;
-     int lface_id;
+ascii_face_of_lisp_face (struct frame *f, int lface_id)
 {
   int face_id;
 
@@ -4889,9 +4720,7 @@ ascii_face_of_lisp_face (f, lface_id)
    STEPS < 0 means larger.  Value is the id of the face.  */
 
 int
-smaller_face (f, face_id, steps)
-     struct frame *f;
-     int face_id, steps;
+smaller_face (struct frame *f, int face_id, int steps)
 {
 #ifdef HAVE_WINDOW_SYSTEM
   struct face *face;
@@ -4910,7 +4739,7 @@ smaller_face (f, face_id, steps)
   steps = eabs (steps);
 
   face = FACE_FROM_ID (f, face_id);
-  bcopy (face->lface, attrs, sizeof attrs);
+  memcpy (attrs, face->lface, sizeof attrs);
   pt = last_pt = XFASTINT (attrs[LFACE_HEIGHT_INDEX]);
   new_face_id = face_id;
   last_height = FONT_HEIGHT (face->font);
@@ -4950,10 +4779,7 @@ smaller_face (f, face_id, steps)
    FACE_ID on frame F, but has height HEIGHT.  */
 
 int
-face_with_height (f, face_id, height)
-     struct frame *f;
-     int face_id;
-     int height;
+face_with_height (struct frame *f, int face_id, int height)
 {
 #ifdef HAVE_WINDOW_SYSTEM
   struct face *face;
@@ -4964,7 +4790,7 @@ face_with_height (f, face_id, height)
     return face_id;
 
   face = FACE_FROM_ID (f, face_id);
-  bcopy (face->lface, attrs, sizeof attrs);
+  memcpy (attrs, face->lface, sizeof attrs);
   attrs[LFACE_HEIGHT_INDEX] = make_number (height);
   font_clear_prop (attrs, FONT_SIZE_INDEX);
   face_id = lookup_face (f, attrs);
@@ -4982,11 +4808,7 @@ face_with_height (f, face_id, height)
    default face.  FACE_ID is assumed to be already realized.  */
 
 int
-lookup_derived_face (f, symbol, face_id, signal_p)
-     struct frame *f;
-     Lisp_Object symbol;
-     int face_id;
-     int signal_p;
+lookup_derived_face (struct frame *f, Lisp_Object symbol, int face_id, int signal_p)
 {
   Lisp_Object attrs[LFACE_VECTOR_SIZE];
   Lisp_Object symbol_attrs[LFACE_VECTOR_SIZE];
@@ -4998,7 +4820,7 @@ lookup_derived_face (f, symbol, face_id, signal_p)
   if (!get_lface_attributes (f, symbol, symbol_attrs, signal_p, 0))
     return -1;
 
-  bcopy (default_face->lface, attrs, sizeof attrs);
+  memcpy (attrs, default_face->lface, sizeof attrs);
   merge_face_vectors (f, symbol_attrs, attrs, 0);
   return lookup_face (f, attrs);
 }
@@ -5006,8 +4828,7 @@ lookup_derived_face (f, symbol, face_id, signal_p)
 DEFUN ("face-attributes-as-vector", Fface_attributes_as_vector,
        Sface_attributes_as_vector, 1, 1, 0,
        doc: /* Return a vector of face attributes corresponding to PLIST.  */)
-     (plist)
-     Lisp_Object plist;
+  (Lisp_Object plist)
 {
   Lisp_Object lface;
   lface = Fmake_vector (make_number (LFACE_VECTOR_SIZE),
@@ -5043,10 +4864,7 @@ DEFUN ("face-attributes-as-vector", Fface_attributes_as_vector,
     \(2) `close in spirit' to what the attributes specify, if not exact.  */
 
 static int
-x_supports_face_attributes_p (f, attrs, def_face)
-     struct frame *f;
-     Lisp_Object *attrs;
-     struct face *def_face;
+x_supports_face_attributes_p (struct frame *f, Lisp_Object *attrs, struct face *def_face)
 {
   Lisp_Object *def_attrs = def_face->lface;
 
@@ -5092,7 +4910,7 @@ x_supports_face_attributes_p (f, attrs, def_face)
       Lisp_Object merged_attrs[LFACE_VECTOR_SIZE];
       int i;
 
-      bcopy (def_attrs, merged_attrs, sizeof merged_attrs);
+      memcpy (merged_attrs, def_attrs, sizeof merged_attrs);
 
       merge_face_vectors (f, attrs, merged_attrs, 0);
 
@@ -5147,10 +4965,7 @@ x_supports_face_attributes_p (f, attrs, def_face)
    substitution of a `dim' face for italic.  */
 
 static int
-tty_supports_face_attributes_p (f, attrs, def_face)
-     struct frame *f;
-     Lisp_Object *attrs;
-     struct face *def_face;
+tty_supports_face_attributes_p (struct frame *f, Lisp_Object *attrs, struct face *def_face)
 {
   int weight;
   Lisp_Object val, fg, bg;
@@ -5330,8 +5145,7 @@ any display that can display bold, and a `:foreground \"yellow\"' as long
 as it can display a yellowish color, but `:slant italic' will _not_ be
 satisfied by the tty display code's automatic substitution of a `dim'
 face for italic.  */)
-  (attributes, display)
-     Lisp_Object attributes, display;
+  (Lisp_Object attributes, Lisp_Object display)
 {
   int supports = 0, i;
   Lisp_Object frame;
@@ -5408,15 +5222,14 @@ first in ORDER are matched first, e.g. if `:height' appears before
 `:weight' in ORDER, font selection first tries to find a font with
 a suitable height, and then tries to match the font weight.
 Value is ORDER.  */)
-     (order)
-     Lisp_Object order;
+  (Lisp_Object order)
 {
   Lisp_Object list;
   int i;
   int indices[DIM (font_sort_order)];
 
   CHECK_LIST (order);
-  bzero (indices, sizeof indices);
+  memset (indices, 0, sizeof indices);
   i = 0;
 
   for (list = order;
@@ -5448,9 +5261,9 @@ Value is ORDER.  */)
     if (indices[i] == 0)
       signal_error ("Invalid font sort order", order);
 
-  if (bcmp (indices, font_sort_order, sizeof indices) != 0)
+  if (memcmp (indices, font_sort_order, sizeof indices) != 0)
     {
-      bcopy (indices, font_sort_order, sizeof font_sort_order);
+      memcpy (font_sort_order, indices, sizeof font_sort_order);
       free_all_realized_faces (Qnil);
     }
 
@@ -5467,8 +5280,7 @@ DEFUN ("internal-set-alternative-font-family-alist",
 ALIST is an alist of (FAMILY ALTERNATIVE1 ALTERNATIVE2 ...) entries.
 Each ALTERNATIVE is tried in order if no fonts of font family FAMILY can
 be found.  Value is ALIST.  */)
-     (alist)
-     Lisp_Object alist;
+  (Lisp_Object alist)
 {
   Lisp_Object entry, tail, tail2;
 
@@ -5497,8 +5309,7 @@ DEFUN ("internal-set-alternative-font-registry-alist",
 ALIST is an alist of (REGISTRY ALTERNATIVE1 ALTERNATIVE2 ...) entries.
 Each ALTERNATIVE is tried in order if no fonts of font registry REGISTRY can
 be found.  Value is ALIST.  */)
-     (alist)
-     Lisp_Object alist;
+  (Lisp_Object alist)
 {
   Lisp_Object entry, tail, tail2;
 
@@ -5530,8 +5341,7 @@ be found.  Value is ALIST.  */)
    attribute of ATTRS doesn't name a fontset.  */
 
 static int
-face_fontset (attrs)
-     Lisp_Object *attrs;
+face_fontset (Lisp_Object *attrs)
 {
   Lisp_Object name;
 
@@ -5554,8 +5364,7 @@ face_fontset (attrs)
    face.  */
 
 static int
-realize_basic_faces (f)
-     struct frame *f;
+realize_basic_faces (struct frame *f)
 {
   int success_p = 0;
   int count = SPECPDL_INDEX ();
@@ -5603,8 +5412,7 @@ realize_basic_faces (f)
    that are not explicitly specified are taken from frame parameters.  */
 
 static int
-realize_default_face (f)
-     struct frame *f;
+realize_default_face (struct frame *f)
 {
   struct face_cache *c = FRAME_FACE_CACHE (f);
   Lisp_Object lface;
@@ -5698,7 +5506,7 @@ realize_default_face (f)
   /* Realize the face; it must be fully-specified now.  */
   xassert (lface_fully_specified_p (XVECTOR (lface)->contents));
   check_lface (lface);
-  bcopy (XVECTOR (lface)->contents, attrs, sizeof attrs);
+  memcpy (attrs, XVECTOR (lface)->contents, sizeof attrs);
   face = realize_face (c, attrs, DEFAULT_FACE_ID);
 
 #ifdef HAVE_WINDOW_SYSTEM
@@ -5727,10 +5535,7 @@ realize_default_face (f)
    have.  The default face must have been realized already.  */
 
 static void
-realize_named_face (f, symbol, id)
-     struct frame *f;
-     Lisp_Object symbol;
-     int id;
+realize_named_face (struct frame *f, Lisp_Object symbol, int id)
 {
   struct face_cache *c = FRAME_FACE_CACHE (f);
   Lisp_Object lface = lface_from_face_name (f, symbol, 0);
@@ -5766,10 +5571,7 @@ realize_named_face (f, symbol, id)
    face.  Value is a pointer to the newly created realized face.  */
 
 static struct face *
-realize_face (cache, attrs, former_face_id)
-     struct face_cache *cache;
-     Lisp_Object *attrs;
-     int former_face_id;
+realize_face (struct face_cache *cache, Lisp_Object *attrs, int former_face_id)
 {
   struct face *face;
 
@@ -5811,10 +5613,7 @@ realize_face (cache, attrs, former_face_id)
    no-font.  */
 
 static struct face *
-realize_non_ascii_face (f, font_object, base_face)
-     struct frame *f;
-     Lisp_Object font_object;
-     struct face *base_face;
+realize_non_ascii_face (struct frame *f, Lisp_Object font_object, struct face *base_face)
 {
   struct face_cache *cache = FRAME_FACE_CACHE (f);
   struct face *face;
@@ -5848,9 +5647,7 @@ realize_non_ascii_face (f, font_object, base_face)
    created realized face.  */
 
 static struct face *
-realize_x_face (cache, attrs)
-     struct face_cache *cache;
-     Lisp_Object *attrs;
+realize_x_face (struct face_cache *cache, Lisp_Object *attrs)
 {
   struct face *face = NULL;
 #ifdef HAVE_WINDOW_SYSTEM
@@ -6057,11 +5854,7 @@ realize_x_face (cache, attrs)
    default foreground/background colors.  */
 
 static void
-map_tty_color (f, face, idx, defaulted)
-     struct frame *f;
-     struct face *face;
-     enum lface_attribute_index idx;
-     int *defaulted;
+map_tty_color (struct frame *f, struct face *face, enum lface_attribute_index idx, int *defaulted)
 {
   Lisp_Object frame, color, def;
   int foreground_p = idx == LFACE_FOREGROUND_INDEX;
@@ -6138,9 +5931,7 @@ map_tty_color (f, face, idx, defaulted)
    Value is a pointer to the newly created realized face.  */
 
 static struct face *
-realize_tty_face (cache, attrs)
-     struct face_cache *cache;
-     Lisp_Object *attrs;
+realize_tty_face (struct face_cache *cache, Lisp_Object *attrs)
 {
   struct face *face;
   int weight, slant;
@@ -6203,8 +5994,7 @@ This affects bold faces on TTYs whose foreground is the default background
 color of the display and whose background is the default foreground color.
 For such faces, the bold face attribute is ignored if this variable
 is non-nil.  */)
-     (suppress)
-     Lisp_Object suppress;
+  (Lisp_Object suppress)
 {
   tty_suppress_bold_inverse_default_colors_p = !NILP (suppress);
   ++face_change_count;
@@ -6221,10 +6011,7 @@ is non-nil.  */)
    property PROP on frame F in current_buffer.  */
 
 int
-compute_char_face (f, ch, prop)
-     struct frame *f;
-     int ch;
-     Lisp_Object prop;
+compute_char_face (struct frame *f, int ch, Lisp_Object prop)
 {
   int face_id;
 
@@ -6240,7 +6027,7 @@ compute_char_face (f, ch, prop)
     {
       Lisp_Object attrs[LFACE_VECTOR_SIZE];
       struct face *default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID);
-      bcopy (default_face->lface, attrs, sizeof attrs);
+      memcpy (attrs, default_face->lface, sizeof attrs);
       merge_face_ref (f, prop, attrs, 1, 0);
       face_id = lookup_face (f, attrs);
     }
@@ -6267,15 +6054,10 @@ compute_char_face (f, ch, prop)
    The face returned is suitable for displaying ASCII characters.  */
 
 int
-face_at_buffer_position (w, pos, region_beg, region_end,
-                        endptr, limit, mouse, base_face_id)
-     struct window *w;
-     EMACS_INT pos;
-     EMACS_INT region_beg, region_end;
-     EMACS_INT *endptr;
-     EMACS_INT limit;
-     int mouse;
-     int base_face_id;
+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 mouse, int base_face_id)
 {
   struct frame *f = XFRAME (w->frame);
   Lisp_Object attrs[LFACE_VECTOR_SIZE];
@@ -6329,7 +6111,7 @@ face_at_buffer_position (w, pos, region_beg, region_end,
     return default_face->id;
 
   /* Begin with attributes from the default face.  */
-  bcopy (default_face->lface, attrs, sizeof attrs);
+  memcpy (attrs, default_face->lface, sizeof attrs);
 
   /* Merge in attributes specified via text properties.  */
   if (!NILP (prop))
@@ -6375,15 +6157,10 @@ face_at_buffer_position (w, pos, region_beg, region_end,
    simply disregards the `face' properties of all overlays.  */
 
 int
-face_for_overlay_string (w, pos, region_beg, region_end,
-                        endptr, limit, mouse, overlay)
-     struct window *w;
-     EMACS_INT pos;
-     EMACS_INT region_beg, region_end;
-     EMACS_INT *endptr;
-     EMACS_INT limit;
-     int mouse;
-     Lisp_Object overlay;
+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 mouse, Lisp_Object overlay)
 {
   struct frame *f = XFRAME (w->frame);
   Lisp_Object attrs[LFACE_VECTOR_SIZE];
@@ -6423,7 +6200,7 @@ face_for_overlay_string (w, pos, region_beg, region_end,
     return DEFAULT_FACE_ID;
 
   /* Begin with attributes from the default face.  */
-  bcopy (default_face->lface, attrs, sizeof attrs);
+  memcpy (attrs, default_face->lface, sizeof attrs);
 
   /* Merge in attributes specified via text properties.  */
   if (!NILP (prop))
@@ -6468,15 +6245,11 @@ face_for_overlay_string (w, pos, region_beg, region_end,
    for displaying ASCII characters.  */
 
 int
-face_at_string_position (w, string, pos, bufpos, region_beg,
-                        region_end, endptr, base_face_id, mouse_p)
-     struct window *w;
-     Lisp_Object string;
-     EMACS_INT pos, bufpos;
-     EMACS_INT region_beg, region_end;
-     EMACS_INT *endptr;
-     enum face_id base_face_id;
-     int mouse_p;
+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,
+                        int mouse_p)
 {
   Lisp_Object prop, position, end, limit;
   struct frame *f = XFRAME (WINDOW_FRAME (w));
@@ -6524,7 +6297,7 @@ face_at_string_position (w, string, pos, bufpos, region_beg,
     return base_face->id;
 
   /* Begin with attributes from the base face.  */
-  bcopy (base_face->lface, attrs, sizeof attrs);
+  memcpy (attrs, base_face->lface, sizeof attrs);
 
   /* Merge in attributes specified via text properties.  */
   if (!NILP (prop))
@@ -6558,10 +6331,7 @@ face_at_string_position (w, string, pos, bufpos, region_beg,
 */
 
 int
-merge_faces (f, face_name, face_id, base_face_id)
-     struct frame *f;
-     Lisp_Object face_name;
-     int face_id, base_face_id;
+merge_faces (struct frame *f, Lisp_Object face_name, int face_id, int base_face_id)
 {
   Lisp_Object attrs[LFACE_VECTOR_SIZE];
   struct face *base_face;
@@ -6582,7 +6352,7 @@ merge_faces (f, face_name, face_id, base_face_id)
     }
 
   /* Begin with attributes from the base face.  */
-  bcopy (base_face->lface, attrs, sizeof attrs);
+  memcpy (attrs, base_face->lface, sizeof attrs);
 
   if (!NILP (face_name))
     {
@@ -6615,8 +6385,7 @@ DEFUN ("x-load-color-file", Fx_load_color_file,
 The file should define one named RGB color per line like so:
   R G B   name
 where R,G,B are numbers between 0 and 255 and name is an arbitrary string.  */)
-    (filename)
-    Lisp_Object filename;
+  (Lisp_Object filename)
 {
   FILE *fp;
   Lisp_Object cmap = Qnil;
@@ -6698,8 +6467,7 @@ dump_realized_face (face)
 
 
 DEFUN ("dump-face", Fdump_face, Sdump_face, 0, 1, 0, doc: /* */)
-     (n)
-     Lisp_Object n;
+  (Lisp_Object n)
 {
   if (NILP (n))
     {
@@ -6733,7 +6501,7 @@ DEFUN ("dump-face", Fdump_face, Sdump_face, 0, 1, 0, doc: /* */)
 
 DEFUN ("show-face-resources", Fshow_face_resources, Sshow_face_resources,
        0, 0, 0, doc: /* */)
-     ()
+  (void)
 {
   fprintf (stderr, "number of colors = %d\n", ncolors_allocated);
   fprintf (stderr, "number of pixmaps = %d\n", npixmaps_allocated);
@@ -6750,7 +6518,7 @@ DEFUN ("show-face-resources", Fshow_face_resources, Sshow_face_resources,
  ***********************************************************************/
 
 void
-syms_of_xfaces ()
+syms_of_xfaces (void)
 {
   Qface = intern_c_string ("face");
   staticpro (&Qface);
@@ -6989,10 +6757,10 @@ Each element is of the form:
    (FACE REPLACEMENT...),
 
 which causes display of the face FACE to use REPLACEMENT... instead.
-REPLACEMENT... is interpreted the same way the value of a `face' text
-property is: it may be (1) A face name, (2) A list of face names, (3) A
-property-list of face attribute/value pairs, or (4) A list of face names
-intermixed with lists containing face attribute/value pairs.
+REPLACEMENT... is interpreted the same way as the value of a `face'
+text property: it may be (1) A face name, (2) A list of face names,
+(3) A property-list of face attribute/value pairs, or (4) A list of
+face names or lists containing face attribute/value pairs.
 
 Multiple entries in REPLACEMENT... are merged together to form the final
 result, with faces or attributes earlier in the list taking precedence
@@ -7016,7 +6784,11 @@ face definitions.  For instance, the mode my-mode could define a face
 `my-mode-default', and then in the mode setup function, do:
 
    (set (make-local-variable 'face-remapping-alist)
-        '((default my-mode-default)))).  */);
+        '((default my-mode-default)))).
+
+Because Emacs normally only redraws screen areas when the underlying
+buffer contents change, you may need to call `redraw-display' after
+changing this variable for it to take effect.  */);
   Vface_remapping_alist = Qnil;
 
   DEFVAR_LISP ("face-font-rescale-alist", &Vface_font_rescale_alist,
index 1d7d3d0358029cafae00f79259c3be1198a6c5b3..cb6733e8fa12603b0fd7e82b64d4012dbdbdabbc 100644 (file)
@@ -101,6 +101,10 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <Xm/FileSB.h>
 #endif
 
+#ifdef USE_LUCID
+#include "../lwlib/xlwmenu.h"
+#endif
+
 #if !defined(NO_EDITRES)
 #define HACK_EDITRES
 extern void _XEditResCheckMessages ();
@@ -110,11 +114,6 @@ extern void _XEditResCheckMessages ();
 
 extern LWLIB_ID widget_id_tick;
 
-#ifdef USE_LUCID
-/* This is part of a kludge--see lwlib/xlwmenu.c.  */
-extern XFontStruct *xlwmenu_default_font;
-#endif
-
 extern void free_frame_menubar ();
 extern double atof ();
 
@@ -162,6 +161,10 @@ int x_gtk_file_dialog_help_text;
 
 int x_gtk_whole_detached_tool_bar;
 
+/* If non-zero, use Gtk+ tooltips.  */
+
+static int x_gtk_use_system_tooltips;
+
 /* The background and shape of the mouse pointer, and shape when not
    over text or in the modeline.  */
 
@@ -199,14 +202,6 @@ Lisp_Object Qundefined_color;
 Lisp_Object Qcompound_text, Qcancel_timer;
 Lisp_Object Qfont_param;
 
-/* In dispnew.c */
-
-extern Lisp_Object Vwindow_system_version;
-
-/* The below are defined in frame.c.  */
-
-extern Lisp_Object Qtooltip;
-
 #if GLYPH_DEBUG
 int image_cache_refcount, dpyinfo_refcount;
 #endif
@@ -219,7 +214,7 @@ char *x_last_font_name;
 /* Error if we are not connected to X.  */
 
 void
-check_x ()
+check_x (void)
 {
   if (! x_in_use)
     error ("X windows are not in use or not initialized");
@@ -229,7 +224,7 @@ check_x ()
    You should not call this unless HAVE_MENUS is defined.  */
 
 int
-have_menus_p ()
+have_menus_p (void)
 {
   return x_in_use;
 }
@@ -238,8 +233,7 @@ have_menus_p ()
    and checking validity for X.  */
 
 FRAME_PTR
-check_x_frame (frame)
-     Lisp_Object frame;
+check_x_frame (Lisp_Object frame)
 {
   FRAME_PTR f;
 
@@ -258,8 +252,7 @@ check_x_frame (frame)
    the first X display on the list.  */
 
 struct x_display_info *
-check_x_display_info (object)
-     Lisp_Object object;
+check_x_display_info (Lisp_Object object)
 {
   struct x_display_info *dpyinfo = NULL;
 
@@ -301,9 +294,7 @@ check_x_display_info (object)
 /* This function can be called during GC, so use GC_xxx type test macros.  */
 
 struct frame *
-x_window_to_frame (dpyinfo, wdesc)
-     struct x_display_info *dpyinfo;
-     int wdesc;
+x_window_to_frame (struct x_display_info *dpyinfo, int wdesc)
 {
   Lisp_Object tail, frame;
   struct frame *f;
@@ -351,9 +342,7 @@ x_window_to_frame (dpyinfo, wdesc)
    windows.  */
 
 struct frame *
-x_any_window_to_frame (dpyinfo, wdesc)
-     struct x_display_info *dpyinfo;
-     int wdesc;
+x_any_window_to_frame (struct x_display_info *dpyinfo, int wdesc)
 {
   Lisp_Object tail, frame;
   struct frame *f, *found;
@@ -404,9 +393,7 @@ x_any_window_to_frame (dpyinfo, wdesc)
 /* Likewise, but consider only the menu bar widget.  */
 
 struct frame *
-x_menubar_window_to_frame (dpyinfo, event)
-     struct x_display_info *dpyinfo;
-     XEvent *event;
+x_menubar_window_to_frame (struct x_display_info *dpyinfo, XEvent *event)
 {
   Window wdesc = event->xany.window;
   Lisp_Object tail, frame;
@@ -441,9 +428,7 @@ x_menubar_window_to_frame (dpyinfo, event)
    If WDESC is some other (smaller) window, we return 0.  */
 
 struct frame *
-x_top_window_to_frame (dpyinfo, wdesc)
-     struct x_display_info *dpyinfo;
-     int wdesc;
+x_top_window_to_frame (struct x_display_info *dpyinfo, int wdesc)
 {
   Lisp_Object tail, frame;
   struct frame *f;
@@ -491,33 +476,33 @@ x_top_window_to_frame (dpyinfo, wdesc)
 
 \f
 
-static void x_default_font_parameter P_ ((struct frame *, Lisp_Object));
-
-static Lisp_Object unwind_create_frame P_ ((Lisp_Object));
-static Lisp_Object unwind_create_tip_frame P_ ((Lisp_Object));
-
-void x_set_foreground_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
-static void x_set_wait_for_wm P_ ((struct frame *, Lisp_Object, Lisp_Object));
-void x_set_background_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
-void x_set_mouse_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
-void x_set_cursor_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
-void x_set_border_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
-void x_set_cursor_type P_ ((struct frame *, Lisp_Object, Lisp_Object));
-void x_set_icon_type P_ ((struct frame *, Lisp_Object, Lisp_Object));
-void x_set_icon_name P_ ((struct frame *, Lisp_Object, Lisp_Object));
-void x_explicitly_set_name P_ ((struct frame *, Lisp_Object, Lisp_Object));
-void x_set_menu_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object));
-void x_set_title P_ ((struct frame *, Lisp_Object, Lisp_Object));
-void x_set_tool_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object));
-void x_set_scroll_bar_foreground P_ ((struct frame *, Lisp_Object,
-                                     Lisp_Object));
-void x_set_scroll_bar_background P_ ((struct frame *, Lisp_Object,
-                                     Lisp_Object));
-static Lisp_Object x_default_scroll_bar_color_parameter P_ ((struct frame *,
-                                                            Lisp_Object,
-                                                            Lisp_Object,
-                                                            char *, char *,
-                                                            int));
+static void x_default_font_parameter (struct frame *, Lisp_Object);
+
+static Lisp_Object unwind_create_frame (Lisp_Object);
+static Lisp_Object unwind_create_tip_frame (Lisp_Object);
+
+void x_set_foreground_color (struct frame *, Lisp_Object, Lisp_Object);
+static void x_set_wait_for_wm (struct frame *, Lisp_Object, Lisp_Object);
+void x_set_background_color (struct frame *, Lisp_Object, Lisp_Object);
+void x_set_mouse_color (struct frame *, Lisp_Object, Lisp_Object);
+void x_set_cursor_color (struct frame *, Lisp_Object, Lisp_Object);
+void x_set_border_color (struct frame *, Lisp_Object, Lisp_Object);
+void x_set_cursor_type (struct frame *, Lisp_Object, Lisp_Object);
+void x_set_icon_type (struct frame *, Lisp_Object, Lisp_Object);
+void x_set_icon_name (struct frame *, Lisp_Object, Lisp_Object);
+void x_explicitly_set_name (struct frame *, Lisp_Object, Lisp_Object);
+void x_set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object);
+void x_set_title (struct frame *, Lisp_Object, Lisp_Object);
+void x_set_tool_bar_lines (struct frame *, Lisp_Object, Lisp_Object);
+void x_set_scroll_bar_foreground (struct frame *, Lisp_Object,
+                                  Lisp_Object);
+void x_set_scroll_bar_background (struct frame *, Lisp_Object,
+                                  Lisp_Object);
+static Lisp_Object x_default_scroll_bar_color_parameter (struct frame *,
+                                                         Lisp_Object,
+                                                         Lisp_Object,
+                                                         const char *, const char *,
+                                                         int);
 \f
 
 /* Store the screen positions of frame F into XPTR and YPTR.
@@ -525,9 +510,7 @@ static Lisp_Object x_default_scroll_bar_color_parameter P_ ((struct frame *,
    not Emacs's own window.  */
 
 void
-x_real_positions (f, xptr, yptr)
-     FRAME_PTR f;
-     int *xptr, *yptr;
+x_real_positions (FRAME_PTR f, int *xptr, int *yptr)
 {
   int win_x, win_y, outer_x, outer_y;
   int real_x = 0, real_y = 0;
@@ -645,9 +628,7 @@ x_real_positions (f, xptr, yptr)
 /* Gamma-correct COLOR on frame F.  */
 
 void
-gamma_correct (f, color)
-     struct frame *f;
-     XColor *color;
+gamma_correct (struct frame *f, XColor *color)
 {
   if (f->gamma)
     {
@@ -664,18 +645,19 @@ gamma_correct (f, color)
    no color could be allocated.  */
 
 int
-x_defined_color (f, color_name, color, alloc_p)
-     struct frame *f;
-     char *color_name;
-     XColor *color;
-     int alloc_p;
+x_defined_color (struct frame *f, const char *color_name,
+                XColor *color, int alloc_p)
 {
-  int success_p;
+  int success_p = 0;
   Display *dpy = FRAME_X_DISPLAY (f);
   Colormap cmap = FRAME_X_COLORMAP (f);
 
   BLOCK_INPUT;
-  success_p = XParseColor (dpy, cmap, color_name, color);
+#ifdef USE_GTK
+  success_p = xg_check_special_colors (f, color_name, color);
+#endif
+  if (!success_p)
+    success_p = XParseColor (dpy, cmap, color_name, color);
   if (success_p && alloc_p)
     success_p = x_alloc_nearest_color (f, cmap, color);
   UNBLOCK_INPUT;
@@ -689,10 +671,7 @@ x_defined_color (f, color_name, color, alloc_p)
    Signal an error if color can't be allocated.  */
 
 int
-x_decode_color (f, color_name, mono_color)
-     FRAME_PTR f;
-     Lisp_Object color_name;
-     int mono_color;
+x_decode_color (FRAME_PTR f, Lisp_Object color_name, int mono_color)
 {
   XColor cdef;
 
@@ -726,22 +705,34 @@ x_decode_color (f, color_name, mono_color)
    See also the comment of wait_for_wm in struct x_output.  */
 
 static void
-x_set_wait_for_wm (f, new_value, old_value)
-     struct frame *f;
-     Lisp_Object new_value, old_value;
+x_set_wait_for_wm (struct frame *f, Lisp_Object new_value, Lisp_Object old_value)
 {
   f->output_data.x->wait_for_wm = !NILP (new_value);
 }
 
+static void
+x_set_tool_bar_position (struct frame *f,
+                         Lisp_Object new_value,
+                         Lisp_Object old_value)
+{
+  if (! EQ (new_value, Qleft) && ! EQ (new_value, Qright)
+      && ! EQ (new_value, Qbottom) && ! EQ (new_value, Qtop))
+    return;
+  if (EQ (new_value, old_value)) return;
+
+#ifdef USE_GTK
+  if (xg_change_toolbar_position (f, new_value)) 
+    f->tool_bar_position = new_value;
+#endif
+}
+
 #ifdef USE_GTK
 
 /* Set icon from FILE for frame F.  By using GTK functions the icon
    may be any format that GdkPixbuf knows about, i.e. not just bitmaps.  */
 
 int
-xg_set_icon (f, file)
-    FRAME_PTR f;
-    Lisp_Object file;
+xg_set_icon (FRAME_PTR f, Lisp_Object file)
 {
   int result = 0;
   Lisp_Object found;
@@ -775,12 +766,10 @@ xg_set_icon (f, file)
 }
 
 int
-xg_set_icon_from_xpm_data (f, data)
-    FRAME_PTR f;
-    char **data;
+xg_set_icon_from_xpm_data (FRAME_PTR f, const char **data)
 {
   int result = 0;
-  GdkPixbuf *pixbuf = gdk_pixbuf_new_from_xpm_data ((const char **) data);
+  GdkPixbuf *pixbuf = gdk_pixbuf_new_from_xpm_data (data);
 
   if (!pixbuf)
     return 0;
@@ -801,9 +790,7 @@ xg_set_icon_from_xpm_data (f, data)
    in the standard place; do not attempt to change the window.  */
 
 void
-x_set_foreground_color (f, arg, oldval)
-     struct frame *f;
-     Lisp_Object arg, oldval;
+x_set_foreground_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
 {
   struct x_output *x = f->output_data.x;
   unsigned long fg, old_fg;
@@ -839,9 +826,7 @@ x_set_foreground_color (f, arg, oldval)
 }
 
 void
-x_set_background_color (f, arg, oldval)
-     struct frame *f;
-     Lisp_Object arg, oldval;
+x_set_background_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
 {
   struct x_output *x = f->output_data.x;
   unsigned long bg;
@@ -887,8 +872,7 @@ x_set_background_color (f, arg, oldval)
 }
 
 static Cursor
-make_invisible_cursor (f)
-     struct frame *f;
+make_invisible_cursor (struct frame *f)
 {
   Display *dpy = FRAME_X_DISPLAY (f);
   static char const no_data[] = { 0 };
@@ -916,9 +900,7 @@ make_invisible_cursor (f)
 }
 
 void
-x_set_mouse_color (f, arg, oldval)
-     struct frame *f;
-     Lisp_Object arg, oldval;
+x_set_mouse_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
 {
   struct x_output *x = f->output_data.x;
   Display *dpy = FRAME_X_DISPLAY (f);
@@ -1063,9 +1045,7 @@ x_set_mouse_color (f, arg, oldval)
 }
 
 void
-x_set_cursor_color (f, arg, oldval)
-     struct frame *f;
-     Lisp_Object arg, oldval;
+x_set_cursor_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
 {
   unsigned long fore_pixel, pixel;
   int fore_pixel_allocated_p = 0, pixel_allocated_p = 0;
@@ -1136,9 +1116,7 @@ x_set_cursor_color (f, arg, oldval)
    F has an x-window.  */
 
 void
-x_set_border_pixel (f, pix)
-     struct frame *f;
-     int pix;
+x_set_border_pixel (struct frame *f, int pix)
 {
   unload_color (f, f->output_data.x->border_pixel);
   f->output_data.x->border_pixel = pix;
@@ -1167,9 +1145,7 @@ x_set_border_pixel (f, pix)
    and so emacs' border colors may be overridden.  */
 
 void
-x_set_border_color (f, arg, oldval)
-     struct frame *f;
-     Lisp_Object arg, oldval;
+x_set_border_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
 {
   int pix;
 
@@ -1181,9 +1157,7 @@ x_set_border_color (f, arg, oldval)
 
 
 void
-x_set_cursor_type (f, arg, oldval)
-     FRAME_PTR f;
-     Lisp_Object arg, oldval;
+x_set_cursor_type (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval)
 {
   set_frame_cursor_types (f, arg);
 
@@ -1192,9 +1166,7 @@ x_set_cursor_type (f, arg, oldval)
 }
 \f
 void
-x_set_icon_type (f, arg, oldval)
-     struct frame *f;
-     Lisp_Object arg, oldval;
+x_set_icon_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
 {
   int result;
 
@@ -1226,9 +1198,7 @@ x_set_icon_type (f, arg, oldval)
 }
 
 void
-x_set_icon_name (f, arg, oldval)
-     struct frame *f;
-     Lisp_Object arg, oldval;
+x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
 {
   int result;
 
@@ -1266,9 +1236,7 @@ x_set_icon_name (f, arg, oldval)
 
 \f
 void
-x_set_menu_bar_lines (f, value, oldval)
-     struct frame *f;
-     Lisp_Object value, oldval;
+x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
 {
   int nlines;
 #if ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK)
@@ -1358,9 +1326,7 @@ x_set_menu_bar_lines (f, value, oldval)
    The frame's height doesn't change.  */
 
 void
-x_set_tool_bar_lines (f, value, oldval)
-     struct frame *f;
-     Lisp_Object value, oldval;
+x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
 {
   int delta, nlines, root_height;
   Lisp_Object root_window;
@@ -1455,9 +1421,7 @@ x_set_tool_bar_lines (f, value, oldval)
    the frame parameter.  */
 
 void
-x_set_scroll_bar_foreground (f, value, oldval)
-     struct frame *f;
-     Lisp_Object value, oldval;
+x_set_scroll_bar_foreground (struct frame *f, Lisp_Object value, Lisp_Object oldval)
 {
   unsigned long pixel;
 
@@ -1490,9 +1454,7 @@ x_set_scroll_bar_foreground (f, value, oldval)
    parameter.  */
 
 void
-x_set_scroll_bar_background (f, value, oldval)
-     struct frame *f;
-     Lisp_Object value, oldval;
+x_set_scroll_bar_background (struct frame *f, Lisp_Object value, Lisp_Object oldval)
 {
   unsigned long pixel;
 
@@ -1555,11 +1517,7 @@ x_set_scroll_bar_background (f, value, oldval)
    the result should be `COMPOUND_TEXT'.  */
 
 static unsigned char *
-x_encode_text (string, coding_system, selectionp, text_bytes, stringp, freep)
-     Lisp_Object string, coding_system;
-     int *text_bytes, *stringp;
-     int selectionp;
-     int *freep;
+x_encode_text (Lisp_Object string, Lisp_Object coding_system, int selectionp, int *text_bytes, int *stringp, int *freep)
 {
   int result = string_xstring_p (string);
   struct coding_system coding;
@@ -1593,9 +1551,7 @@ x_encode_text (string, coding_system, selectionp, text_bytes, stringp, freep)
    icon name to NAME.  */
 
 static void
-x_set_name_internal (f, name)
-     FRAME_PTR f;
-     Lisp_Object name;
+x_set_name_internal (FRAME_PTR f, Lisp_Object name)
 {
   if (FRAME_X_WINDOW (f))
     {
@@ -1605,8 +1561,8 @@ x_set_name_internal (f, name)
        int bytes, stringp;
         int do_free_icon_value = 0, do_free_text_value = 0;
        Lisp_Object coding_system;
-#ifdef USE_GTK
        Lisp_Object encoded_name;
+       Lisp_Object encoded_icon_name;
        struct gcpro gcpro1;
 
        /* As ENCODE_UTF_8 may cause GC and relocation of string data,
@@ -1614,7 +1570,6 @@ x_set_name_internal (f, name)
        GCPRO1 (name);
        encoded_name = ENCODE_UTF_8 (name);
        UNGCPRO;
-#endif
 
        coding_system = Qcompound_text;
        /* Note: Encoding strategy
@@ -1630,7 +1585,12 @@ x_set_name_internal (f, name)
           We may also be able to use "UTF8_STRING" in text.encoding
           in the future which can encode all Unicode characters.
           But, for the moment, there's no way to know that the
-          current window manager supports it or not.  */
+          current window manager supports it or not.
+
+          Either way, we also set the _NET_WM_NAME and _NET_WM_ICON_NAME
+          properties.  Per the EWMH specification, those two properties
+          are always UTF8_STRING.  This matches what gtk_window_set_title()
+          does in the USE_GTK case. */
        text.value = x_encode_text (name, coding_system, 0, &bytes, &stringp,
                                    &do_free_text_value);
        text.encoding = (stringp ? XA_STRING
@@ -1641,6 +1601,7 @@ x_set_name_internal (f, name)
        if (!STRINGP (f->icon_name))
          {
            icon = text;
+           encoded_icon_name = encoded_name;
          }
        else
          {
@@ -1651,6 +1612,8 @@ x_set_name_internal (f, name)
                             : FRAME_X_DISPLAY_INFO (f)->Xatom_COMPOUND_TEXT);
            icon.format = 8;
            icon.nitems = bytes;
+
+           encoded_icon_name = ENCODE_UTF_8 (f->icon_name);
          }
 
 #ifdef USE_GTK
@@ -1658,9 +1621,21 @@ x_set_name_internal (f, name)
                               (char *) SDATA (encoded_name));
 #else /* not USE_GTK */
        XSetWMName (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), &text);
+       XChangeProperty (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
+                        FRAME_X_DISPLAY_INFO (f)->Xatom_net_wm_name,
+                        FRAME_X_DISPLAY_INFO (f)->Xatom_UTF8_STRING,
+                        8, PropModeReplace,
+                        (char *) SDATA (encoded_name),
+                        SBYTES (encoded_name));
 #endif /* not USE_GTK */
 
        XSetWMIconName (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), &icon);
+       XChangeProperty (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
+                        FRAME_X_DISPLAY_INFO (f)->Xatom_net_wm_icon_name,
+                        FRAME_X_DISPLAY_INFO (f)->Xatom_UTF8_STRING,
+                        8, PropModeReplace,
+                        (char *) SDATA (encoded_icon_name),
+                        SBYTES (encoded_icon_name));
 
        if (do_free_icon_value)
          xfree (icon.value);
@@ -1683,10 +1658,7 @@ x_set_name_internal (f, name)
        F->explicit_name is set, ignore the new name; otherwise, set it.  */
 
 void
-x_set_name (f, name, explicit)
-     struct frame *f;
-     Lisp_Object name;
-     int explicit;
+x_set_name (struct frame *f, Lisp_Object name, int explicit)
 {
   /* Make sure that requests from lisp code override requests from
      Emacs redisplay code.  */
@@ -1733,9 +1705,7 @@ x_set_name (f, name, explicit)
    specified a name for the frame; the name will override any set by the
    redisplay code.  */
 void
-x_explicitly_set_name (f, arg, oldval)
-     FRAME_PTR f;
-     Lisp_Object arg, oldval;
+x_explicitly_set_name (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval)
 {
   x_set_name (f, arg, 1);
 }
@@ -1744,9 +1714,7 @@ x_explicitly_set_name (f, arg, oldval)
    name; names set this way will never override names set by the user's
    lisp code.  */
 void
-x_implicitly_set_name (f, arg, oldval)
-     FRAME_PTR f;
-     Lisp_Object arg, oldval;
+x_implicitly_set_name (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval)
 {
   x_set_name (f, arg, 0);
 }
@@ -1755,9 +1723,7 @@ x_implicitly_set_name (f, arg, oldval)
    If NAME is nil, use the frame name as the title.  */
 
 void
-x_set_title (f, name, old_name)
-     struct frame *f;
-     Lisp_Object name, old_name;
+x_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name)
 {
   /* Don't change the title if it's already NAME.  */
   if (EQ (name, f->title))
@@ -1776,8 +1742,7 @@ x_set_title (f, name, old_name)
 }
 
 void
-x_set_scroll_bar_default_width (f)
-     struct frame *f;
+x_set_scroll_bar_default_width (struct frame *f)
 {
   int wid = FRAME_COLUMN_WIDTH (f);
 
@@ -1804,14 +1769,10 @@ x_set_scroll_bar_default_width (f)
    named NAME.  If that is not found either, use the value DEFLT.  */
 
 static Lisp_Object
-x_default_scroll_bar_color_parameter (f, alist, prop, xprop, xclass,
-                                     foreground_p)
-     struct frame *f;
-     Lisp_Object alist;
-     Lisp_Object prop;
-     char *xprop;
-     char *xclass;
-     int foreground_p;
+x_default_scroll_bar_color_parameter (struct frame *f,
+                                     Lisp_Object alist, Lisp_Object prop,
+                                     const char *xprop, const char *xclass,
+                                     int foreground_p)
 {
   struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
   Lisp_Object tem;
@@ -1862,9 +1823,7 @@ x_default_scroll_bar_color_parameter (f, alist, prop, xprop, xclass,
    for example, but Xt doesn't).  */
 
 static void
-hack_wm_protocols (f, widget)
-     FRAME_PTR f;
-     Widget widget;
+hack_wm_protocols (FRAME_PTR f, Widget widget)
 {
   Display *dpy = XtDisplay (widget);
   Window w = XtWindow (widget);
@@ -1930,8 +1889,8 @@ hack_wm_protocols (f, widget)
 
 #ifdef HAVE_X_I18N
 
-static XFontSet xic_create_xfontset P_ ((struct frame *));
-static XIMStyle best_xim_style P_ ((XIMStyles *, XIMStyles *));
+static XFontSet xic_create_xfontset (struct frame *);
+static XIMStyle best_xim_style (XIMStyles *, XIMStyles *);
 
 
 /* Supported XIM styles, ordered by preference.  */
@@ -1953,14 +1912,12 @@ static XIMStyle supported_xim_styles[] =
 
 /* Create an X fontset on frame F with base font name BASE_FONTNAME.  */
 
-char xic_defaut_fontset[] = "-*-*-*-r-normal--14-*-*-*-*-*-*-*";
+const char xic_defaut_fontset[] = "-*-*-*-r-normal--14-*-*-*-*-*-*-*";
 
 /* Create an Xt fontset spec from the name of a base font.
    If `motif' is True use the Motif syntax.  */
 char *
-xic_create_fontsetname (base_fontname, motif)
-     char *base_fontname;
-     Bool motif;
+xic_create_fontsetname (const char *base_fontname, int motif)
 {
   const char *sep = motif ? ";" : ",";
   char *fontsetname;
@@ -1970,7 +1927,7 @@ xic_create_fontsetname (base_fontname, motif)
     { /* There is no base font name, use the default.  */
       int len = strlen (base_fontname) + 2;
       fontsetname = xmalloc (len);
-      bzero (fontsetname, len);
+      memset (fontsetname, 0, len);
       strcpy (fontsetname, base_fontname);
     }
   else
@@ -1980,7 +1937,7 @@ xic_create_fontsetname (base_fontname, motif)
         - the base font.
         - the base font where the charset spec is replaced by -*-*.
         - the same but with the family also replaced with -*-*-.  */
-      char *p = base_fontname;
+      const char *p = base_fontname;
       int i;
 
       for (i = 0; *p; p++)
@@ -1991,7 +1948,7 @@ xic_create_fontsetname (base_fontname, motif)
             Use the specified font plus the default.  */
          int len = strlen (base_fontname) + strlen (xic_defaut_fontset) + 3;
          fontsetname = xmalloc (len);
-         bzero (fontsetname, len);
+         memset (fontsetname, 0, len);
          strcpy (fontsetname, base_fontname);
          strcat (fontsetname, sep);
          strcat (fontsetname, xic_defaut_fontset);
@@ -1999,13 +1956,13 @@ xic_create_fontsetname (base_fontname, motif)
       else
        {
          int len;
-         char *p1 = NULL, *p2 = NULL, *p3 = NULL;
+         const char *p1 = NULL, *p2 = NULL, *p3 = NULL;
          char *font_allcs = NULL;
          char *font_allfamilies = NULL;
          char *font_all = NULL;
-         char *allcs = "*-*-*-*-*-*-*";
-         char *allfamilies = "-*-*-";
-         char *all = "*-*-*-*-";
+         const char *allcs = "*-*-*-*-*-*-*";
+         const char *allfamilies = "-*-*-";
+         const char *all = "*-*-*-*-";
          char *base;
 
          for (i = 0, p = base_fontname; i < 8; p++)
@@ -2028,7 +1985,7 @@ xic_create_fontsetname (base_fontname, motif)
              int diff = (p2 - p3) - 2;
 
              base = alloca (strlen (base_fontname) + 1);
-             bcopy (base_fontname, base, p3 - base_fontname);
+             memcpy (base, base_fontname, p3 - base_fontname);
              base[p3 - base_fontname] = '*';
              base[(p3 - base_fontname) + 1] = '-';
              strcpy (base + (p3 - base_fontname) + 2, p2);
@@ -2041,33 +1998,33 @@ xic_create_fontsetname (base_fontname, motif)
          /* Build the font spec that matches all charsets.  */
          len = p - base_fontname + strlen (allcs) + 1;
          font_allcs = (char *) alloca (len);
-         bzero (font_allcs, len);
-         bcopy (base_fontname, font_allcs, p - base_fontname);
+         memset (font_allcs, 0, 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);
-         bzero (font_allfamilies, len);
+         memset (font_allfamilies, 0, len);
          strcpy (font_allfamilies, allfamilies);
-         bcopy (p1, font_allfamilies + strlen (allfamilies), p - p1);
+         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);
-         bzero (font_all, len);
+         memset (font_all, 0, len);
          strcpy (font_all, allfamilies);
          strcat (font_all, all);
-         bcopy (p2, font_all + strlen (all) + strlen (allfamilies), p - p2);
+         memcpy (font_all + strlen (all) + strlen (allfamilies), p2, p - p2);
          strcat (font_all, allcs);
 
          /* Build the actual font set name.  */
          len = strlen (base_fontname) + strlen (font_allcs)
            + strlen (font_allfamilies) + strlen (font_all) + 5;
          fontsetname = xmalloc (len);
-         bzero (fontsetname, len);
+         memset (fontsetname, 0, len);
          strcpy (fontsetname, base_fontname);
          strcat (fontsetname, sep);
          strcat (fontsetname, font_allcs);
@@ -2106,8 +2063,7 @@ print_fontset_result (xfs, name, missing_list, missing_count)
 #endif
 
 static XFontSet
-xic_create_xfontset (f)
-     struct frame *f;
+xic_create_xfontset (struct frame *f)
 {
   XFontSet xfs = NULL;
   struct font *font = FRAME_FONT (f);
@@ -2135,7 +2091,7 @@ xic_create_xfontset (f)
       char **missing_list;
       int missing_count;
       char *def_string;
-      char *xlfd_format = "-*-*-medium-r-normal--%d-*-*-*-*-*";
+      const char *xlfd_format = "-*-*-medium-r-normal--%d-*-*-*-*-*";
 
       sprintf (buf, xlfd_format, pixel_size);
       missing_list = NULL;
@@ -2186,7 +2142,7 @@ xic_create_xfontset (f)
        }
       if (! xfs)
        {
-         char *last_resort = "-*-*-*-r-normal--*-*-*-*-*-*";
+         const char *last_resort = "-*-*-*-r-normal--*-*-*-*-*-*";
 
          missing_list = NULL;
          xfs = XCreateFontSet (FRAME_X_DISPLAY (f), last_resort,
@@ -2206,8 +2162,7 @@ xic_create_xfontset (f)
 /* Free the X fontset of frame F if it is the last frame using it.  */
 
 void
-xic_free_xfontset (f)
-     struct frame *f;
+xic_free_xfontset (struct frame *f)
 {
   Lisp_Object rest, frame;
   int shared_p = 0;
@@ -2244,9 +2199,7 @@ xic_free_xfontset (f)
    input method XIM.  */
 
 static XIMStyle
-best_xim_style (user, xim)
-     XIMStyles *user;
-     XIMStyles *xim;
+best_xim_style (XIMStyles *user, XIMStyles *xim)
 {
   int i, j;
 
@@ -2264,8 +2217,7 @@ best_xim_style (user, xim)
 static XIMStyle xic_style;
 
 void
-create_frame_xic (f)
-     struct frame *f;
+create_frame_xic (struct frame *f)
 {
   XIM xim;
   XIC xic = NULL;
@@ -2340,8 +2292,7 @@ create_frame_xic (f)
 /* Destroy XIC and free XIC fontset of frame F, if any. */
 
 void
-free_frame_xic (f)
-     struct frame *f;
+free_frame_xic (struct frame *f)
 {
   if (FRAME_XIC (f) == NULL)
     return;
@@ -2357,9 +2308,7 @@ free_frame_xic (f)
    pixel position X/Y.  X and Y are relative to window W.  */
 
 void
-xic_set_preeditarea (w, x, y)
-     struct window *w;
-     int x, y;
+xic_set_preeditarea (struct window *w, int x, int y)
 {
   struct frame *f = XFRAME (w->frame);
   XVaNestedList attr;
@@ -2376,8 +2325,7 @@ xic_set_preeditarea (w, x, y)
 /* Place status area for XIC in bottom right corner of frame F.. */
 
 void
-xic_set_statusarea (f)
-     struct frame *f;
+xic_set_statusarea (struct frame *f)
 {
   XIC xic = FRAME_XIC (f);
   XVaNestedList attr;
@@ -2407,7 +2355,7 @@ xic_set_statusarea (f)
   area.x = FRAME_PIXEL_WIDTH (f) - area.width - FRAME_INTERNAL_BORDER_WIDTH (f);
   area.y = (FRAME_PIXEL_HEIGHT (f) - area.height
            - FRAME_MENUBAR_HEIGHT (f)
-           - FRAME_TOOLBAR_HEIGHT (f)
+           - FRAME_TOOLBAR_TOP_HEIGHT (f)
             - FRAME_INTERNAL_BORDER_WIDTH (f));
   XFree (needed);
 
@@ -2421,9 +2369,7 @@ xic_set_statusarea (f)
    BASE_FONTNAME.  Called when a new Emacs fontset is chosen.  */
 
 void
-xic_set_xfontset (f, base_fontname)
-     struct frame *f;
-     char *base_fontname;
+xic_set_xfontset (struct frame *f, const char *base_fontname)
 {
   XVaNestedList attr;
   XFontSet xfs;
@@ -2451,10 +2397,7 @@ xic_set_xfontset (f, base_fontname)
 /* Create and set up the X widget for frame F.  */
 
 static void
-x_window (f, window_prompting, minibuffer_only)
-     struct frame *f;
-     long window_prompting;
-     int minibuffer_only;
+x_window (struct frame *f, long window_prompting, int minibuffer_only)
 {
   XClassHint class_hints;
   XSetWindowAttributes attributes;
@@ -2506,6 +2449,7 @@ x_window (f, window_prompting, minibuffer_only)
   XtSetArg (al[ac], XtNvisual, FRAME_X_VISUAL (f)); ac++;
   XtSetArg (al[ac], XtNdepth, FRAME_X_DISPLAY_INFO (f)->n_planes); ac++;
   XtSetArg (al[ac], XtNcolormap, FRAME_X_COLORMAP (f)); ac++;
+  XtSetArg (al[ac], XtNborderWidth, 0); ac++;
   XtSetValues (pane_widget, al, ac);
   f->output_data.x->column_widget = pane_widget;
 
@@ -2521,6 +2465,7 @@ x_window (f, window_prompting, minibuffer_only)
   XtSetArg (al[ac], XtNvisual, FRAME_X_VISUAL (f)); ac++;
   XtSetArg (al[ac], XtNdepth, FRAME_X_DISPLAY_INFO (f)->n_planes); ac++;
   XtSetArg (al[ac], XtNcolormap, FRAME_X_COLORMAP (f)); ac++;
+  XtSetArg (al[ac], XtNborderWidth, 0); ac++;
   frame_widget = XtCreateWidget (f->namebuf, emacsFrameClass, pane_widget,
                                 al, ac);
 
@@ -2698,8 +2643,7 @@ x_window (f, window_prompting, minibuffer_only)
 #else /* not USE_X_TOOLKIT */
 #ifdef USE_GTK
 void
-x_window (f)
-     FRAME_PTR f;
+x_window (FRAME_PTR f)
 {
   if (! xg_create_frame_widgets (f))
     error ("Unable to create window");
@@ -2739,9 +2683,7 @@ x_window (f)
 /* Create and set up the X window for frame F.  */
 
 void
-x_window (f)
-     struct frame *f;
-
+x_window (struct frame *f)
 {
   XClassHint class_hints;
   XSetWindowAttributes attributes;
@@ -2846,9 +2788,7 @@ x_window (f)
 /* Verify that the icon position args for this window are valid.  */
 
 static void
-x_icon_verify (f, parms)
-     struct frame *f;
-     Lisp_Object parms;
+x_icon_verify (struct frame *f, Lisp_Object parms)
 {
   Lisp_Object icon_x, icon_y;
 
@@ -2870,9 +2810,7 @@ x_icon_verify (f, parms)
    well.  */
 
 static void
-x_icon (f, parms)
-     struct frame *f;
-     Lisp_Object parms;
+x_icon (struct frame *f, Lisp_Object parms)
 {
   Lisp_Object icon_x, icon_y;
 #if 0
@@ -2918,8 +2856,7 @@ x_icon (f, parms)
    mouse cursor and the gray border tile.  */
 
 static void
-x_make_gc (f)
-     struct frame *f;
+x_make_gc (struct frame *f)
 {
   XGCValues gc_values;
 
@@ -2978,8 +2915,7 @@ x_make_gc (f)
 /* Free what was allocated in x_make_gc.  */
 
 void
-x_free_gcs (f)
-     struct frame *f;
+x_free_gcs (struct frame *f)
 {
   Display *dpy = FRAME_X_DISPLAY (f);
 
@@ -3018,8 +2954,7 @@ x_free_gcs (f)
    constructed.  */
 
 static Lisp_Object
-unwind_create_frame (frame)
-     Lisp_Object frame;
+unwind_create_frame (Lisp_Object frame)
 {
   struct frame *f = XFRAME (frame);
 
@@ -3051,34 +2986,36 @@ unwind_create_frame (frame)
 
 
 static void
-x_default_font_parameter (f, parms)
-     struct frame *f;
-     Lisp_Object parms;
+x_default_font_parameter (struct frame *f, Lisp_Object parms)
 {
   struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
   Lisp_Object font_param = x_get_arg (dpyinfo, parms, Qfont, NULL, NULL,
                                       RES_TYPE_STRING);
-  Lisp_Object font;
-  int got_from_gconf = 0;
+  Lisp_Object font = Qnil;
   if (EQ (font_param, Qunbound))
     font_param = Qnil;
 
   if (NILP (font_param))
     {
-      /* System font takes precedendce over X resources.  We must suggest this
+      /* System font should take precedendce over X resources.  We suggest this
          regardless of font-use-system-font because .emacs may not have been
          read yet.  */
       const char *system_font = xsettings_get_system_font ();
-      if (system_font) font_param = make_string (system_font,
-                                                 strlen (system_font));
+      if (system_font)
+        {
+          char *name = xstrdup (system_font);
+          font = font_open_by_name (f, name);
+          free (name);
+        }
     }
 
-  font = !NILP (font_param) ? font_param
-    : x_get_arg (dpyinfo, parms, Qfont, "font", "Font", RES_TYPE_STRING);
+  if (NILP (font))
+      font = !NILP (font_param) ? font_param
+      : x_get_arg (dpyinfo, parms, Qfont, "font", "Font", RES_TYPE_STRING);
 
-  if (! STRINGP (font))
+  if (! FONTP (font) && ! STRINGP (font))
     {
-      char *names[]
+      const char *names[]
        = {
 #ifdef HAVE_XFT
            /* This will find the normal Xft font.  */
@@ -3113,10 +3050,8 @@ x_default_font_parameter (f, parms)
       x_set_frame_parameters (f, Fcons (Fcons (Qfont_param, font_param), Qnil));
     }
 
-  x_default_parameter (f, parms, Qfont, font,
-                       got_from_gconf ? NULL : "font",
-                       got_from_gconf ? NULL : "Font",
-                       RES_TYPE_STRING);
+  /* This call will make X resources override any system font setting.  */
+  x_default_parameter (f, parms, Qfont, font, "font", "Font", RES_TYPE_STRING);
 }
 
 
@@ -3124,8 +3059,7 @@ DEFUN ("x-wm-set-size-hint", Fx_wm_set_size_hint, Sx_wm_set_size_hint,
        0, 1, 0,
        doc: /* Send the size hints for frame FRAME to the window manager.
 If FRAME is nil, use the selected frame.  */)
-     (frame)
-     Lisp_Object frame;
+  (Lisp_Object frame)
 {
   struct frame *f;
   if (NILP (frame))
@@ -3138,6 +3072,37 @@ If FRAME is nil, use the selected frame.  */)
   return Qnil;
 }
 
+static void
+set_machine_and_pid_properties (struct frame *f)
+{
+  /* See the above comment "Note: Encoding strategy".  */
+  XTextProperty text;
+  int bytes, stringp;
+  int do_free_text_value = 0;
+  long pid = (long) getpid ();
+
+  text.value = x_encode_text (Vsystem_name,
+                              Qcompound_text, 0, &bytes, &stringp,
+                              &do_free_text_value);
+  text.encoding = (stringp ? XA_STRING
+                   : FRAME_X_DISPLAY_INFO (f)->Xatom_COMPOUND_TEXT);
+  text.format = 8;
+  text.nitems = bytes;
+  XSetWMClientMachine (FRAME_X_DISPLAY (f),
+                       FRAME_OUTER_WINDOW (f),
+                       &text);
+  if (do_free_text_value)
+    xfree (text.value);
+
+  XChangeProperty (FRAME_X_DISPLAY (f),
+                   FRAME_OUTER_WINDOW (f),
+                   XInternAtom (FRAME_X_DISPLAY (f),
+                                "_NET_WM_PID",
+                                False),
+                   XA_CARDINAL, 32, PropModeReplace,
+                   (unsigned char *) &pid, 1);
+}
+
 DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
        1, 1, 0,
        doc: /* Make a new X window, which is called a "frame" in Emacs terms.
@@ -3149,8 +3114,7 @@ then `default-minibuffer-frame' must be a frame whose minibuffer can
 be shared by the new frame.
 
 This function is an internal primitive--use `make-frame' instead.  */)
-     (parms)
-     Lisp_Object parms;
+  (Lisp_Object parms)
 {
   struct frame *f;
   Lisp_Object frame, tem;
@@ -3227,7 +3191,7 @@ This function is an internal primitive--use `make-frame' instead.  */)
 
   f->output_method = output_x_window;
   f->output_data.x = (struct x_output *) xmalloc (sizeof (struct x_output));
-  bzero (f->output_data.x, sizeof (struct x_output));
+  memset (f->output_data.x, 0, sizeof (struct x_output));
   f->output_data.x->icon_bitmap = -1;
   FRAME_FONTSET (f) = -1;
   f->output_data.x->scroll_bar_foreground_pixel = -1;
@@ -3337,17 +3301,9 @@ This function is an internal primitive--use `make-frame' instead.  */)
       error ("Invalid frame font");
     }
 
-#ifdef USE_LUCID
-  /* Prevent lwlib/xlwmenu.c from crashing because of a bug
-     whereby it fails to get any font.  */
-  BLOCK_INPUT;
-  xlwmenu_default_font = XLoadQueryFont (FRAME_X_DISPLAY (f), "fixed");
-  UNBLOCK_INPUT;
-#endif
-
   /* Frame contents get displaced if an embedded X window has a border.  */
   if (! FRAME_X_EMBEDDED_P (f))
-    x_default_parameter (f, parms, Qborder_width, make_number (2),
+    x_default_parameter (f, parms, Qborder_width, make_number (0),
                         "borderWidth", "BorderWidth", RES_TYPE_NUMBER);
 
   /* This defaults to 1 in order to match xterm.  We recognize either
@@ -3371,7 +3327,12 @@ This function is an internal primitive--use `make-frame' instead.  */)
 #endif
                       "internalBorderWidth", "internalBorderWidth",
                       RES_TYPE_NUMBER);
-  x_default_parameter (f, parms, Qvertical_scroll_bars, Qleft,
+  x_default_parameter (f, parms, Qvertical_scroll_bars,
+#if defined(USE_GTK) && defined(USE_TOOLKIT_SCROLL_BARS)
+                      Qright,
+#else
+                      Qleft,
+#endif
                       "verticalScrollBars", "ScrollBars",
                       RES_TYPE_SYMBOL);
 
@@ -3410,10 +3371,18 @@ This function is an internal primitive--use `make-frame' instead.  */)
      happen.  */
   init_frame_faces (f);
 
-  x_default_parameter (f, parms, Qmenu_bar_lines, make_number (1),
-                      "menuBar", "MenuBar", RES_TYPE_BOOLEAN_NUMBER);
-  x_default_parameter (f, parms, Qtool_bar_lines, make_number (1),
-                      "toolBar", "ToolBar", RES_TYPE_NUMBER);
+  /* The X resources controlling the menu-bar and tool-bar are
+     processed specially at startup, and reflected in the mode
+     variables; ignore them here.  */
+  x_default_parameter (f, parms, Qmenu_bar_lines,
+                      NILP (Vmenu_bar_mode)
+                      ? make_number (0) : make_number (1),
+                      NULL, NULL, RES_TYPE_NUMBER);
+  x_default_parameter (f, parms, Qtool_bar_lines,
+                      NILP (Vtool_bar_mode)
+                      ? make_number (0) : make_number (1),
+                      NULL, NULL, RES_TYPE_NUMBER);
+
   x_default_parameter (f, parms, Qbuffer_predicate, Qnil,
                       "bufferPredicate", "BufferPredicate",
                       RES_TYPE_SYMBOL);
@@ -3423,6 +3392,8 @@ This function is an internal primitive--use `make-frame' instead.  */)
                       "waitForWM", "WaitForWM", RES_TYPE_BOOLEAN);
   x_default_parameter (f, parms, Qfullscreen, Qnil,
                        "fullscreen", "Fullscreen", RES_TYPE_SYMBOL);
+  x_default_parameter (f, parms, Qtool_bar_position,
+                       f->tool_bar_position, 0, 0, RES_TYPE_SYMBOL);
 
   /* Compute the size of the X window.  */
   window_prompting = x_figure_window_size (f, parms, 1);
@@ -3519,19 +3490,24 @@ This function is an internal primitive--use `make-frame' instead.  */)
        ;
     }
 
+  BLOCK_INPUT;
+                       
+  /* Set machine name and pid for the purpose of window managers.  */
+  set_machine_and_pid_properties(f);
+
   /* Set the WM leader property.  GTK does this itself, so this is not
      needed when using GTK.  */
   if (dpyinfo->client_leader_window != 0)
     {
-      BLOCK_INPUT;
       XChangeProperty (FRAME_X_DISPLAY (f),
                        FRAME_OUTER_WINDOW (f),
                        dpyinfo->Xatom_wm_client_leader,
                        XA_WINDOW, 32, PropModeReplace,
                        (unsigned char *) &dpyinfo->client_leader_window, 1);
-      UNBLOCK_INPUT;
     }
 
+  UNBLOCK_INPUT;
+
   /* Initialize `default-minibuffer-frame' in case this is the first
      frame on this terminal.  */
   if (FRAME_HAS_MINIBUF_P (f)
@@ -3560,8 +3536,7 @@ This function is an internal primitive--use `make-frame' instead.  */)
    know about that structure.  */
 
 Lisp_Object
-x_get_focus_frame (frame)
-     struct frame *frame;
+x_get_focus_frame (struct frame *frame)
 {
   struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (frame);
   Lisp_Object xfocus;
@@ -3585,8 +3560,7 @@ x_get_focus_frame (frame)
 DEFUN ("x-focus-frame", Fx_focus_frame, Sx_focus_frame, 1, 1, 0,
        doc: /* Set the input focus to FRAME.
 FRAME nil means use the selected frame.  */)
-     (frame)
-     Lisp_Object frame;
+  (Lisp_Object frame)
 {
   struct frame *f = check_x_frame (frame);
   Display *dpy = FRAME_X_DISPLAY (f);
@@ -3605,8 +3579,7 @@ FRAME nil means use the selected frame.  */)
 \f
 DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0,
        doc: /* Internal function called by `color-defined-p', which see.  */)
-     (color, frame)
-     Lisp_Object color, frame;
+  (Lisp_Object color, Lisp_Object frame)
 {
   XColor foo;
   FRAME_PTR f = check_x_frame (frame);
@@ -3621,8 +3594,7 @@ DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0,
 
 DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0,
        doc: /* Internal function called by `color-values', which see.  */)
-     (color, frame)
-     Lisp_Object color, frame;
+  (Lisp_Object color, Lisp_Object frame)
 {
   XColor foo;
   FRAME_PTR f = check_x_frame (frame);
@@ -3639,8 +3611,7 @@ DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0,
 
 DEFUN ("xw-display-color-p", Fxw_display_color_p, Sxw_display_color_p, 0, 1, 0,
        doc: /* Internal function called by `display-color-p', which see.  */)
-     (terminal)
-     Lisp_Object terminal;
+  (Lisp_Object terminal)
 {
   struct x_display_info *dpyinfo = check_x_display_info (terminal);
 
@@ -3667,8 +3638,7 @@ Note that color displays do support shades of gray.
 The optional argument TERMINAL specifies which display to ask about.
 TERMINAL should be a terminal object, a frame or a display name (a string).
 If omitted or nil, that stands for the selected frame's display.  */)
-     (terminal)
-     Lisp_Object terminal;
+  (Lisp_Object terminal)
 {
   struct x_display_info *dpyinfo = check_x_display_info (terminal);
 
@@ -3696,8 +3666,7 @@ DEFUN ("x-display-pixel-width", Fx_display_pixel_width, Sx_display_pixel_width,
 The optional argument TERMINAL specifies which display to ask about.
 TERMINAL should be a terminal object, a frame or a display name (a string).
 If omitted or nil, that stands for the selected frame's display.  */)
-     (terminal)
-     Lisp_Object terminal;
+  (Lisp_Object terminal)
 {
   struct x_display_info *dpyinfo = check_x_display_info (terminal);
 
@@ -3710,8 +3679,7 @@ DEFUN ("x-display-pixel-height", Fx_display_pixel_height,
 The optional argument TERMINAL specifies which display to ask about.
 TERMINAL should be a terminal object, a frame or a display name (a string).
 If omitted or nil, that stands for the selected frame's display.  */)
-     (terminal)
-     Lisp_Object terminal;
+  (Lisp_Object terminal)
 {
   struct x_display_info *dpyinfo = check_x_display_info (terminal);
 
@@ -3724,8 +3692,7 @@ DEFUN ("x-display-planes", Fx_display_planes, Sx_display_planes,
 The optional argument TERMINAL specifies which display to ask about.
 TERMINAL should be a terminal object, a frame or a display name (a string).
 If omitted or nil, that stands for the selected frame's display.  */)
-     (terminal)
-     Lisp_Object terminal;
+  (Lisp_Object terminal)
 {
   struct x_display_info *dpyinfo = check_x_display_info (terminal);
 
@@ -3738,8 +3705,7 @@ DEFUN ("x-display-color-cells", Fx_display_color_cells, Sx_display_color_cells,
 The optional argument TERMINAL specifies which display to ask about.
 TERMINAL should be a terminal object, a frame or a display name (a string).
 If omitted or nil, that stands for the selected frame's display.  */)
-     (terminal)
-     Lisp_Object terminal;
+  (Lisp_Object terminal)
 {
   struct x_display_info *dpyinfo = check_x_display_info (terminal);
 
@@ -3763,8 +3729,7 @@ DEFUN ("x-server-max-request-size", Fx_server_max_request_size,
 The optional argument TERMINAL specifies which display to ask about.
 TERMINAL should be a terminal object, a frame or a display name (a string).
 If omitted or nil, that stands for the selected frame's display.  */)
-     (terminal)
-     Lisp_Object terminal;
+  (Lisp_Object terminal)
 {
   struct x_display_info *dpyinfo = check_x_display_info (terminal);
 
@@ -3778,11 +3743,10 @@ that operating systems cannot be developed and distributed noncommercially.)
 The optional argument TERMINAL specifies which display to ask about.
 TERMINAL should be a terminal object, a frame or a display name (a string).
 If omitted or nil, that stands for the selected frame's display.  */)
-     (terminal)
-     Lisp_Object terminal;
+  (Lisp_Object terminal)
 {
   struct x_display_info *dpyinfo = check_x_display_info (terminal);
-  char *vendor = ServerVendor (dpyinfo->display);
+  const char *vendor = ServerVendor (dpyinfo->display);
 
   if (! vendor) vendor = "";
   return build_string (vendor);
@@ -3797,8 +3761,7 @@ number.  See also the function `x-server-vendor'.
 The optional argument TERMINAL specifies which display to ask about.
 TERMINAL should be a terminal object, a frame or a display name (a string).
 If omitted or nil, that stands for the selected frame's display.  */)
-     (terminal)
-     Lisp_Object terminal;
+  (Lisp_Object terminal)
 {
   struct x_display_info *dpyinfo = check_x_display_info (terminal);
   Display *dpy = dpyinfo->display;
@@ -3813,8 +3776,7 @@ DEFUN ("x-display-screens", Fx_display_screens, Sx_display_screens, 0, 1, 0,
 The optional argument TERMINAL specifies which display to ask about.
 TERMINAL should be a terminal object, a frame or a display name (a string).
 If omitted or nil, that stands for the selected frame's display.  */)
-     (terminal)
-     Lisp_Object terminal;
+  (Lisp_Object terminal)
 {
   struct x_display_info *dpyinfo = check_x_display_info (terminal);
 
@@ -3826,8 +3788,7 @@ DEFUN ("x-display-mm-height", Fx_display_mm_height, Sx_display_mm_height, 0, 1,
 The optional argument TERMINAL specifies which display to ask about.
 TERMINAL should be a terminal object, a frame or a display name (a string).
 If omitted or nil, that stands for the selected frame's display.  */)
-     (terminal)
-     Lisp_Object terminal;
+  (Lisp_Object terminal)
 {
   struct x_display_info *dpyinfo = check_x_display_info (terminal);
 
@@ -3839,8 +3800,7 @@ DEFUN ("x-display-mm-width", Fx_display_mm_width, Sx_display_mm_width, 0, 1, 0,
 The optional argument TERMINAL specifies which display to ask about.
 TERMINAL should be a terminal object, a frame or a display name (a string).
 If omitted or nil, that stands for the selected frame's display.  */)
-     (terminal)
-     Lisp_Object terminal;
+  (Lisp_Object terminal)
 {
   struct x_display_info *dpyinfo = check_x_display_info (terminal);
 
@@ -3854,8 +3814,7 @@ The value may be `always', `when-mapped', or `not-useful'.
 The optional argument TERMINAL specifies which display to ask about.
 TERMINAL should be a terminal object, a frame or a display name (a string).
 If omitted or nil, that stands for the selected frame's display.  */)
-     (terminal)
-     Lisp_Object terminal;
+  (Lisp_Object terminal)
 {
   struct x_display_info *dpyinfo = check_x_display_info (terminal);
   Lisp_Object result;
@@ -3891,8 +3850,7 @@ The value is one of the symbols `static-gray', `gray-scale',
 The optional argument TERMINAL specifies which display to ask about.
 TERMINAL should a terminal object, a frame or a display name (a string).
 If omitted or nil, that stands for the selected frame's display.  */)
-     (terminal)
-     Lisp_Object terminal;
+  (Lisp_Object terminal)
 {
   struct x_display_info *dpyinfo = check_x_display_info (terminal);
   Lisp_Object result;
@@ -3931,8 +3889,7 @@ DEFUN ("x-display-save-under", Fx_display_save_under,
 The optional argument TERMINAL specifies which display to ask about.
 TERMINAL should be a terminal object, a frame or a display name (a string).
 If omitted or nil, that stands for the selected frame's display.  */)
-     (terminal)
-     Lisp_Object terminal;
+  (Lisp_Object terminal)
 {
   struct x_display_info *dpyinfo = check_x_display_info (terminal);
 
@@ -3943,36 +3900,31 @@ If omitted or nil, that stands for the selected frame's display.  */)
 }
 \f
 int
-x_pixel_width (f)
-     register struct frame *f;
+x_pixel_width (register struct frame *f)
 {
   return FRAME_PIXEL_WIDTH (f);
 }
 
 int
-x_pixel_height (f)
-     register struct frame *f;
+x_pixel_height (register struct frame *f)
 {
   return FRAME_PIXEL_HEIGHT (f);
 }
 
 int
-x_char_width (f)
-     register struct frame *f;
+x_char_width (register struct frame *f)
 {
   return FRAME_COLUMN_WIDTH (f);
 }
 
 int
-x_char_height (f)
-     register struct frame *f;
+x_char_height (register struct frame *f)
 {
   return FRAME_LINE_HEIGHT (f);
 }
 
 int
-x_screen_planes (f)
-     register struct frame *f;
+x_screen_planes (register struct frame *f)
 {
   return FRAME_X_DISPLAY_INFO (f)->n_planes;
 }
@@ -3988,7 +3940,7 @@ x_screen_planes (f)
 
 static struct visual_class
 {
-  char *name;
+  const char *name;
   int class;
 }
 visual_classes[] =
@@ -4029,8 +3981,7 @@ XScreenNumberOfScreen (scr)
    members of DPYINFO appropriately.  Called from x_term_init.  */
 
 void
-select_visual (dpyinfo)
-     struct x_display_info *dpyinfo;
+select_visual (struct x_display_info *dpyinfo)
 {
   Display *dpy = dpyinfo->display;
   Screen *screen = dpyinfo->screen;
@@ -4052,7 +4003,7 @@ select_visual (dpyinfo)
       XVisualInfo vinfo;
 
       strcpy (s, SDATA (value));
-      dash = index (s, '-');
+      dash = strchr (s, '-');
       if (dash)
        {
          dpyinfo->n_planes = atoi (dash + 1);
@@ -4090,7 +4041,7 @@ select_visual (dpyinfo)
       vinfo_template.screen = XScreenNumberOfScreen (screen);
       vinfo = XGetVisualInfo (dpy, VisualIDMask | VisualScreenMask,
                              &vinfo_template, &n_visuals);
-      if (n_visuals != 1)
+      if (n_visuals <= 0)
        fatal ("Can't get proper X visual info");
 
       dpyinfo->n_planes = vinfo->depth;
@@ -4103,8 +4054,7 @@ select_visual (dpyinfo)
    Open a new connection if necessary.  */
 
 struct x_display_info *
-x_display_info_for_name (name)
-     Lisp_Object name;
+x_display_info_for_name (Lisp_Object name)
 {
   Lisp_Object names;
   struct x_display_info *dpyinfo;
@@ -4151,8 +4101,7 @@ DISPLAY is the name of the display to connect to.
 Optional second arg XRM-STRING is a string of resources in xrdb format.
 If the optional third arg MUST-SUCCEED is non-nil,
 terminate Emacs if we can't open the connection.  */)
-     (display, xrm_string, must_succeed)
-     Lisp_Object display, xrm_string, must_succeed;
+  (Lisp_Object display, Lisp_Object xrm_string, Lisp_Object must_succeed)
 {
   unsigned char *xrm_option;
   struct x_display_info *dpyinfo;
@@ -4203,8 +4152,7 @@ DEFUN ("x-close-connection", Fx_close_connection,
 For TERMINAL, specify a terminal object, a frame or a display name (a
 string).  If TERMINAL is nil, that stands for the selected frame's
 terminal.  */)
-     (terminal)
-     Lisp_Object terminal;
+  (Lisp_Object terminal)
 {
   struct x_display_info *dpyinfo = check_x_display_info (terminal);
 
@@ -4218,7 +4166,7 @@ terminal.  */)
 
 DEFUN ("x-display-list", Fx_display_list, Sx_display_list, 0, 0, 0,
        doc: /* Return the list of display names that Emacs has connections to.  */)
-     ()
+  (void)
 {
   Lisp_Object tail, result;
 
@@ -4238,8 +4186,7 @@ easier.
 The optional second argument TERMINAL specifies which display to act on.
 TERMINAL should be a terminal object, a frame or a display name (a string).
 If TERMINAL is omitted or nil, that stands for the selected frame's display.  */)
-     (on, terminal)
-    Lisp_Object terminal, on;
+  (Lisp_Object on, Lisp_Object terminal)
 {
   struct x_display_info *dpyinfo = check_x_display_info (terminal);
 
@@ -4251,8 +4198,7 @@ If TERMINAL is omitted or nil, that stands for the selected frame's display.  */
 /* Wait for responses to all X commands issued so far for frame F.  */
 
 void
-x_sync (f)
-     FRAME_PTR f;
+x_sync (FRAME_PTR f)
 {
   BLOCK_INPUT;
   XSync (FRAME_X_DISPLAY (f), False);
@@ -4283,8 +4229,7 @@ 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.
 
 Value is VALUE.  */)
-     (prop, value, frame, type, format, outer_p)
-     Lisp_Object prop, value, frame, type, format, 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;
@@ -4362,8 +4307,7 @@ DEFUN ("x-delete-window-property", Fx_delete_window_property,
        Sx_delete_window_property, 1, 2, 0,
        doc: /* Remove window property PROP from X window of FRAME.
 FRAME nil or omitted means use the selected frame.  Value is PROP.  */)
-     (prop, frame)
-     Lisp_Object prop, frame;
+  (Lisp_Object prop, Lisp_Object frame)
 {
   struct frame *f = check_x_frame (frame);
   Atom prop_atom;
@@ -4394,8 +4338,7 @@ If VECTOR_RET_P is non-nil, don't return a string but a vector of values.
 
 Value is nil if FRAME hasn't a property with name PROP or if PROP has
 no value of TYPE.  */)
-     (prop, frame, type, source, delete_p, vector_ret_p)
-     Lisp_Object prop, frame, type, source, delete_p, 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;
@@ -4463,7 +4406,7 @@ no value of TYPE.  */)
              elements."
              This applies even if long is more than 32 bits, the X library
              converts from 32 bit elements received from the X server to long
-             and passes the long array to us.  Thus, for that case bcopy can not
+             and passes the long array to us.  Thus, for that case memcpy can not
              be used.  We convert to a 32 bit type here, because so much code
              assume on that.
 
@@ -4514,8 +4457,7 @@ no value of TYPE.  */)
    shown on the frames.  */
 
 void
-show_hourglass (timer)
-     struct atimer *timer;
+show_hourglass (struct atimer *timer)
 {
   /* The timer implementation will cancel this timer automatically
      after this function has run.  Set hourglass_atimer to null
@@ -4579,7 +4521,7 @@ show_hourglass (timer)
    shown.  */
 
 void
-hide_hourglass ()
+hide_hourglass (void)
 {
   if (hourglass_shown_p)
     {
@@ -4614,10 +4556,10 @@ hide_hourglass ()
                                Tool tips
  ***********************************************************************/
 
-static Lisp_Object x_create_tip_frame P_ ((struct x_display_info *,
-                                          Lisp_Object, Lisp_Object));
-static void compute_tip_xy P_ ((struct frame *, Lisp_Object, Lisp_Object,
-                               Lisp_Object, int, int, int *, int *));
+static Lisp_Object x_create_tip_frame (struct x_display_info *,
+                                       Lisp_Object, Lisp_Object);
+static void compute_tip_xy (struct frame *, Lisp_Object, Lisp_Object,
+                            Lisp_Object, int, int, int *, int *);
 
 /* The frame of a currently visible tooltip.  */
 
@@ -4640,8 +4582,7 @@ Lisp_Object Vx_max_tooltip_size;
 
 
 static Lisp_Object
-unwind_create_tip_frame (frame)
-     Lisp_Object frame;
+unwind_create_tip_frame (Lisp_Object frame)
 {
   Lisp_Object deleted;
 
@@ -4666,9 +4607,9 @@ unwind_create_tip_frame (frame)
    when this happens.  */
 
 static Lisp_Object
-x_create_tip_frame (dpyinfo, parms, text)
-     struct x_display_info *dpyinfo;
-     Lisp_Object parms, text;
+x_create_tip_frame (struct x_display_info *dpyinfo,
+                    Lisp_Object parms,
+                    Lisp_Object text)
 {
   struct frame *f;
   Lisp_Object frame, tem;
@@ -4723,7 +4664,7 @@ x_create_tip_frame (dpyinfo, parms, text)
      counts etc.  */
   f->output_method = output_x_window;
   f->output_data.x = (struct x_output *) xmalloc (sizeof (struct x_output));
-  bzero (f->output_data.x, sizeof (struct x_output));
+  memset (f->output_data.x, 0, sizeof (struct x_output));
   f->output_data.x->icon_bitmap = -1;
   FRAME_FONTSET (f) = -1;
   f->output_data.x->scroll_bar_foreground_pixel = -1;
@@ -4808,7 +4749,7 @@ x_create_tip_frame (dpyinfo, parms, text)
      needed to determine window geometry.  */
   x_default_font_parameter (f, parms);
 
-  x_default_parameter (f, parms, Qborder_width, make_number (2),
+  x_default_parameter (f, parms, Qborder_width, make_number (0),
                       "borderWidth", "BorderWidth", RES_TYPE_NUMBER);
 
   /* This defaults to 2 in order to match xterm.  We recognize either
@@ -4982,11 +4923,7 @@ x_create_tip_frame (dpyinfo, parms, text)
    the display in *ROOT_X, and *ROOT_Y.  */
 
 static void
-compute_tip_xy (f, parms, dx, dy, width, height, root_x, root_y)
-     struct frame *f;
-     Lisp_Object parms, dx, dy;
-     int width, height;
-     int *root_x, *root_y;
+compute_tip_xy (struct frame *f, Lisp_Object parms, Lisp_Object dx, Lisp_Object dy, int width, int height, int *root_x, int *root_y)
 {
   Lisp_Object left, top;
   int win_x, win_y;
@@ -5063,8 +5000,7 @@ DY added (default is -10).
 
 A tooltip's maximum size is specified by `x-max-tooltip-size'.
 Text larger than the specified size is clipped.  */)
-     (string, frame, parms, timeout, dx, dy)
-     Lisp_Object string, frame, parms, timeout, dx, dy;
+  (Lisp_Object string, Lisp_Object frame, Lisp_Object parms, Lisp_Object timeout, Lisp_Object dx, Lisp_Object dy)
 {
   struct frame *f;
   struct window *w;
@@ -5100,6 +5036,27 @@ Text larger than the specified size is clipped.  */)
   else
     CHECK_NUMBER (dy);
 
+#ifdef USE_GTK
+  if (x_gtk_use_system_tooltips)
+    {
+      int ok; 
+
+      /* Hide a previous tip, if any.  */
+      Fx_hide_tip ();
+
+      BLOCK_INPUT;
+      if ((ok = xg_prepare_tooltip (f, string, &width, &height)) != 0)
+        {
+         compute_tip_xy (f, parms, dx, dy, width, height, &root_x, &root_y);
+          xg_show_tooltip (f, root_x, root_y);
+          /* This is used in Fx_hide_tip.  */
+          XSETFRAME (tip_frame, f);
+        }
+      UNBLOCK_INPUT;
+      if (ok) goto start_timer;
+    }
+#endif /* USE_GTK */
+
   if (NILP (last_show_tip_args))
     last_show_tip_args = Fmake_vector (make_number (3), Qnil);
 
@@ -5188,7 +5145,7 @@ Text larger than the specified size is clipped.  */)
   clear_glyph_matrix (w->desired_matrix);
   clear_glyph_matrix (w->current_matrix);
   SET_TEXT_POS (pos, BEGV, BEGV_BYTE);
-  try_window (FRAME_ROOT_WINDOW (f), pos, 0);
+  try_window (FRAME_ROOT_WINDOW (f), pos, TRY_WINDOW_IGNORE_FONTS_CHANGE);
 
   /* Compute width and height of the tooltip.  */
   width = height = 0;
@@ -5205,15 +5162,15 @@ Text larger than the specified size is clipped.  */)
       /* Let the row go over the full width of the frame.  */
       row->full_width_p = 1;
 
+      row_width = row->pixel_width;
       /* There's a glyph at the end of rows that is used to place
         the cursor there.  Don't include the width of this glyph.  */
       if (row->used[TEXT_AREA])
        {
          last = &row->glyphs[TEXT_AREA][row->used[TEXT_AREA] - 1];
-         row_width = row->pixel_width - last->pixel_width;
+         if (INTEGERP (last->object))
+           row_width -= last->pixel_width;
        }
-      else
-       row_width = row->pixel_width;
 
       height += row->height;
       width = max (width, row_width);
@@ -5255,11 +5212,12 @@ Text larger than the specified size is clipped.  */)
 DEFUN ("x-hide-tip", Fx_hide_tip, Sx_hide_tip, 0, 0, 0,
        doc: /* Hide the current tooltip window, if there is any.
 Value is t if tooltip was open, nil otherwise.  */)
-     ()
+  (void)
 {
   int count;
   Lisp_Object deleted, frame, timer;
   struct gcpro gcpro1, gcpro2;
+  struct frame *f;
 
   /* Return quickly if nothing to do.  */
   if (NILP (tip_timer) && NILP (tip_frame))
@@ -5277,6 +5235,14 @@ Value is t if tooltip was open, nil otherwise.  */)
   if (!NILP (timer))
     call1 (Qcancel_timer, timer);
 
+#ifdef USE_GTK
+  /* When using system tooltip, tip_frame is the Emacs frame on which
+     the tip is shown.  */
+  f = XFRAME (frame);
+  if (FRAME_LIVE_P (f) && xg_hide_tooltip (f))
+    frame = Qnil;
+#endif
+
   if (FRAMEP (frame))
     {
       delete_frame (frame, Qnil);
@@ -5287,9 +5253,9 @@ Value is t if tooltip was open, nil otherwise.  */)
         redisplay procedure is not called when a tip frame over menu
         items is unmapped.  Redisplay the menu manually...  */
       {
-       struct frame *f = SELECTED_FRAME ();
-       Widget w = f->output_data.x->menubar_widget;
-       extern void xlwmenu_redisplay P_ ((Widget));
+        Widget w;
+       f = SELECTED_FRAME ();
+       w = f->output_data.x->menubar_widget;
 
        if (!DoesSaveUnders (FRAME_X_DISPLAY_INFO (f)->screen)
            && w != NULL)
@@ -5316,12 +5282,9 @@ DEFUN ("x-uses-old-gtk-dialog", Fx_uses_old_gtk_dialog,
        Sx_uses_old_gtk_dialog,
        0, 0, 0,
        doc: /* Return t if the old Gtk+ file selection dialog is used.  */)
-     ()
+  (void)
 {
 #ifdef USE_GTK
-  extern int use_dialog_box;
-  extern int use_file_dialog;
-
   if (use_dialog_box
       && use_file_dialog
       && have_menus_p ()
@@ -5383,8 +5346,7 @@ DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 5, 0,
 Use a file selection dialog.  Select DEFAULT-FILENAME in the dialog's file
 selection box, if specified.  If MUSTMATCH is non-nil, the returned file
 or directory must exist.  ONLY-DIR-P is ignored."  */)
-  (prompt, dir, default_filename, mustmatch, only_dir_p)
-     Lisp_Object prompt, dir, default_filename, mustmatch, only_dir_p;
+  (Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename, Lisp_Object mustmatch, Lisp_Object only_dir_p)
 {
   int result;
   struct frame *f = SELECTED_FRAME ();
@@ -5393,7 +5355,6 @@ or directory must exist.  ONLY-DIR-P is ignored."  */)
   Widget dialog, text, help;
   Arg al[10];
   int ac = 0;
-  extern XtAppContext Xt_app_con;
   XmString dir_xmstring, pattern_xmstring;
   int count = SPECPDL_INDEX ();
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6;
@@ -5542,8 +5503,7 @@ or directory must exist.  ONLY-DIR-P is ignored."  */)
 #ifdef USE_GTK
 
 static Lisp_Object
-clean_up_dialog (arg)
-     Lisp_Object arg;
+clean_up_dialog (Lisp_Object arg)
 {
   x_menu_set_in_use (0);
 
@@ -5556,8 +5516,7 @@ Use a file selection dialog.  Select DEFAULT-FILENAME in the dialog's file
 selection box, if specified.  If MUSTMATCH is non-nil, the returned file
 or directory must exist.  If ONLY-DIR-P is non-nil, the user can only select
 directories.  */)
-  (prompt, dir, default_filename, mustmatch, only_dir_p)
-     Lisp_Object prompt, dir, default_filename, mustmatch, only_dir_p;
+  (Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename, Lisp_Object mustmatch, Lisp_Object only_dir_p)
 {
   FRAME_PTR f = SELECTED_FRAME ();
   char *fn;
@@ -5618,8 +5577,7 @@ DEFUN ("x-select-font", Fx_select_font, Sx_select_font, 0, 2, 0,
 Return a GTK-style font string corresponding to the selection.
 
 If FRAME is omitted or nil, it defaults to the selected frame. */)
-  (frame, ignored)
-     Lisp_Object frame, ignored;
+  (Lisp_Object frame, Lisp_Object ignored)
 {
   FRAME_PTR f = check_x_frame (frame);
   char *name;
@@ -5707,8 +5665,7 @@ FRAME nil means use the selected frame.
 Value is t if we know that both keys are present, and are mapped to the
 usual X keysyms.  Value is `lambda' if we cannot determine if both keys are
 present and mapped to the usual X keysyms.  */)
-     (frame)
-     Lisp_Object frame;
+  (Lisp_Object frame)
 {
 #ifdef HAVE_XKBGETKEYBOARD
   XkbDescPtr kb;
@@ -5769,9 +5726,9 @@ present and mapped to the usual X keysyms.  */)
              /* The XKB symbolic key names can be seen most easily in
                 the PS file generated by `xkbprint -label name
                 $DISPLAY'.  */
-             if (bcmp ("DELE", kb->names->keys[i].name, 4) == 0)
+             if (memcmp ("DELE", kb->names->keys[i].name, 4) == 0)
                delete_keycode = i;
-             else if (bcmp ("BKSP", kb->names->keys[i].name, 4) == 0)
+             else if (memcmp ("BKSP", kb->names->keys[i].name, 4) == 0)
                backspace_keycode = i;
            }
 
@@ -5836,10 +5793,11 @@ frame_parm_handler x_frame_parm_handlers[] =
   x_set_font_backend,
   x_set_alpha,
   x_set_sticky,
+  x_set_tool_bar_position,
 };
 
 void
-syms_of_xfns ()
+syms_of_xfns (void)
 {
   /* This is zero if not using X windows.  */
   x_in_use = 0;
@@ -5966,6 +5924,12 @@ 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+ toolip is used.
+Otherwise use Emacs own tooltip implementation.
+When using Gtk+ tooltips, the tooltip face is not used.  */);
+  x_gtk_use_system_tooltips = 1;
+
   Fprovide (intern_c_string ("x"), Qnil);
 
 #ifdef USE_X_TOOLKIT
@@ -5986,6 +5950,7 @@ the tool bar buttons.  */);
      accepts --with-x-toolkit=gtk.  */
   Fprovide (intern_c_string ("x-toolkit"), Qnil);
   Fprovide (intern_c_string ("gtk"), Qnil);
+  Fprovide (intern_c_string ("move-toolbar"), Qnil);
 
   DEFVAR_LISP ("gtk-version-string", &Vgtk_version_string,
                doc: /* Version info for GTK+.  */);
index d8fe40eaa93996715460cfdfa8409fa910066f4d..368587de6d8f2b507ef560f9209e772a3b493e9f 100644 (file)
@@ -47,17 +47,15 @@ struct xfont_info
 };
 
 /* Prototypes of support functions.  */
-extern void x_clear_errors P_ ((Display *));
+extern void x_clear_errors (Display *);
 
-static XCharStruct *xfont_get_pcm P_ ((XFontStruct *, XChar2b *));
+static XCharStruct *xfont_get_pcm (XFontStruct *, XChar2b *);
 
 /* Get metrics of character CHAR2B in XFONT.  Value is null if CHAR2B
    is not contained in the font.  */
 
 static XCharStruct *
-xfont_get_pcm (xfont, char2b)
-     XFontStruct *xfont;
-     XChar2b *char2b;
+xfont_get_pcm (XFontStruct *xfont, XChar2b *char2b)
 {
   /* The result metric information.  */
   XCharStruct *pcm = NULL;
@@ -119,19 +117,19 @@ xfont_get_pcm (xfont, char2b)
          ? NULL : pcm);
 }
 
-static Lisp_Object xfont_get_cache P_ ((FRAME_PTR));
-static Lisp_Object xfont_list P_ ((Lisp_Object, Lisp_Object));
-static Lisp_Object xfont_match P_ ((Lisp_Object, Lisp_Object));
-static Lisp_Object xfont_list_family P_ ((Lisp_Object));
-static Lisp_Object xfont_open P_ ((FRAME_PTR, Lisp_Object, int));
-static void xfont_close P_ ((FRAME_PTR, struct font *));
-static int xfont_prepare_face P_ ((FRAME_PTR, struct face *));
-static int xfont_has_char P_ ((Lisp_Object, int));
-static unsigned xfont_encode_char P_ ((struct font *, int));
-static int xfont_text_extents P_ ((struct font *, unsigned *, int,
-                                  struct font_metrics *));
-static int xfont_draw P_ ((struct glyph_string *, int, int, int, int, int));
-static int xfont_check P_ ((FRAME_PTR, struct font *));
+static Lisp_Object xfont_get_cache (FRAME_PTR);
+static Lisp_Object xfont_list (Lisp_Object, Lisp_Object);
+static Lisp_Object xfont_match (Lisp_Object, Lisp_Object);
+static Lisp_Object xfont_list_family (Lisp_Object);
+static Lisp_Object xfont_open (FRAME_PTR, Lisp_Object, int);
+static void xfont_close (FRAME_PTR, struct font *);
+static int xfont_prepare_face (FRAME_PTR, struct face *);
+static int xfont_has_char (Lisp_Object, int);
+static unsigned xfont_encode_char (struct font *, int);
+static int xfont_text_extents (struct font *, unsigned *, int,
+                               struct font_metrics *);
+static int xfont_draw (struct glyph_string *, int, int, int, int, int);
+static int xfont_check (FRAME_PTR, struct font *);
 
 struct font_driver xfont_driver =
   {
@@ -156,19 +154,14 @@ struct font_driver xfont_driver =
     NULL, /* filter_properties */
   };
 
-extern Lisp_Object QCname;
-
 static Lisp_Object
-xfont_get_cache (f)
-     FRAME_PTR f;
+xfont_get_cache (FRAME_PTR f)
 {
   Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
 
   return (dpyinfo->name_list_element);
 }
 
-extern Lisp_Object Vface_alternative_font_registry_alist;
-
 static int
 compare_font_names (const void *name1, const void *name2)
 {
@@ -292,8 +285,6 @@ static Lisp_Object xfont_scripts_cache;
 /* Re-usable vector to store characteristic font properites.   */
 static Lisp_Object xfont_scratch_props;
 
-extern Lisp_Object Qlatin;
-
 /* Return a list of scripts supported by the font of FONTNAME whose
    characteristic properties are in PROPS and whose encoding charset
    is ENCODING.  A caller must call BLOCK_INPUT in advance.  */
@@ -342,10 +333,8 @@ xfont_supported_scripts (Display *display, char *fontname, Lisp_Object props,
   return scripts;
 }
 
-extern Lisp_Object Vscalable_fonts_allowed;
-
 static Lisp_Object
-xfont_list_pattern (Display *display, char *pattern,
+xfont_list_pattern (Display *display, const char *pattern,
                    Lisp_Object registry, Lisp_Object script)
 {
   Lisp_Object list = Qnil;
@@ -497,8 +486,7 @@ xfont_list_pattern (Display *display, char *pattern,
 }
 
 static Lisp_Object
-xfont_list (frame, spec)
-     Lisp_Object frame, spec;
+xfont_list (Lisp_Object frame, Lisp_Object spec)
 {
   FRAME_PTR f = XFRAME (frame);
   Display *display = FRAME_X_DISPLAY_INFO (f)->display;
@@ -566,7 +554,7 @@ xfont_list (frame, spec)
       val = assq_no_quit (QCname, AREF (spec, FONT_EXTRA_INDEX));
       if (CONSP (val) && STRINGP (XCDR (val)) && SBYTES (XCDR (val)) < 512)
        {
-         bcopy (SDATA (XCDR (val)), name, SBYTES (XCDR (val)) + 1);
+         memcpy (name, SDATA (XCDR (val)), SBYTES (XCDR (val)) + 1);
          if (xfont_encode_coding_xlfd (name) < 0)
            return Qnil;
          list = xfont_list_pattern (display, name, registry, script);
@@ -577,8 +565,7 @@ xfont_list (frame, spec)
 }
 
 static Lisp_Object
-xfont_match (frame, spec)
-     Lisp_Object frame, spec;
+xfont_match (Lisp_Object frame, Lisp_Object spec)
 {
   FRAME_PTR f = XFRAME (frame);
   Display *display = FRAME_X_DISPLAY_INFO (f)->display;
@@ -595,7 +582,7 @@ xfont_match (frame, spec)
        return Qnil;
     }
   else if (SBYTES (XCDR (val)) < 512)
-    bcopy (SDATA (XCDR (val)), name, SBYTES (XCDR (val)) + 1);
+    memcpy (name, SDATA (XCDR (val)), SBYTES (XCDR (val)) + 1);
   else
     return Qnil;
   if (xfont_encode_coding_xlfd (name) < 0)
@@ -636,8 +623,7 @@ xfont_match (frame, spec)
 }
 
 static Lisp_Object
-xfont_list_family (frame)
-     Lisp_Object frame;
+xfont_list_family (Lisp_Object frame)
 {
   FRAME_PTR f = XFRAME (frame);
   Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
@@ -675,7 +661,7 @@ xfont_list_family (frame)
       if (! *p1 || p1 == p0)
        continue;
       if (last_len == p1 - p0
-         && bcmp (last_family, p0, last_len) == 0)
+         && memcmp (last_family, p0, last_len) == 0)
        continue;
       last_len = p1 - p0;
       last_family = p0;
@@ -693,13 +679,8 @@ xfont_list_family (frame)
   return list;
 }
 
-extern Lisp_Object QCavgwidth;
-
 static Lisp_Object
-xfont_open (f, entity, pixel_size)
-     FRAME_PTR f;
-     Lisp_Object entity;
-     int pixel_size;
+xfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
 {
   Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
   Display *display = dpyinfo->display;
@@ -911,9 +892,7 @@ xfont_open (f, entity, pixel_size)
 }
 
 static void
-xfont_close (f, font)
-     FRAME_PTR f;
-     struct font *font;
+xfont_close (FRAME_PTR f, struct font *font)
 {
   BLOCK_INPUT;
   XFreeFont (FRAME_X_DISPLAY (f), ((struct xfont_info *) font)->xfont);
@@ -921,9 +900,7 @@ xfont_close (f, font)
 }
 
 static int
-xfont_prepare_face (f, face)
-     FRAME_PTR f;
-     struct face *face;
+xfont_prepare_face (FRAME_PTR f, struct face *face)
 {
   BLOCK_INPUT;
   XSetFont (FRAME_X_DISPLAY (f), face->gc,
@@ -934,9 +911,7 @@ xfont_prepare_face (f, face)
 }
 
 static int
-xfont_has_char (font, c)
-     Lisp_Object font;
-     int c;
+xfont_has_char (Lisp_Object font, int c)
 {
   Lisp_Object registry = AREF (font, FONT_REGISTRY_INDEX);
   struct charset *encoding;
@@ -965,9 +940,7 @@ xfont_has_char (font, c)
 }
 
 static unsigned
-xfont_encode_char (font, c)
-     struct font *font;
-     int c;
+xfont_encode_char (struct font *font, int c)
 {
   XFontStruct *xfont = ((struct xfont_info *) font)->xfont;
   struct charset *charset;
@@ -990,18 +963,14 @@ xfont_encode_char (font, c)
 }
 
 static int
-xfont_text_extents (font, code, nglyphs, metrics)
-     struct font *font;
-     unsigned *code;
-     int nglyphs;
-     struct font_metrics *metrics;
+xfont_text_extents (struct font *font, unsigned int *code, int nglyphs, struct font_metrics *metrics)
 {
   XFontStruct *xfont = ((struct xfont_info *) font)->xfont;
   int width = 0;
   int i, first, x;
 
   if (metrics)
-    bzero (metrics, sizeof (struct font_metrics));
+    memset (metrics, 0, sizeof (struct font_metrics));
   for (i = 0, x = 0, first = 1; i < nglyphs; i++)
     {
       XChar2b char2b;
@@ -1046,9 +1015,7 @@ xfont_text_extents (font, code, nglyphs, metrics)
 }
 
 static int
-xfont_draw (s, from, to, x, y, with_background)
-     struct glyph_string *s;
-     int from, to, x, y, with_background;
+xfont_draw (struct glyph_string *s, int from, int to, int x, int y, int with_background)
 {
   XFontStruct *xfont = ((struct xfont_info *) s->font)->xfont;
   int len = to - from;
@@ -1123,9 +1090,7 @@ xfont_draw (s, from, to, x, y, with_background)
 }
 
 static int
-xfont_check (f, font)
-     FRAME_PTR f;
-     struct font *font;
+xfont_check (FRAME_PTR f, struct font *font)
 {
   struct xfont_info *xfont = (struct xfont_info *) font;
 
@@ -1134,7 +1099,7 @@ xfont_check (f, font)
 
 \f
 void
-syms_of_xfont ()
+syms_of_xfont (void)
 {
   staticpro (&xfont_scripts_cache);
   { /* Here we rely on the fact that syms_of_xfont (via syms_of_font)
index 197cc9c1f5b6e0a22ac2eb7f1b12d39e83f63b8a..dc82c28b215a68934d1f8b86a8f92516b476b39f 100644 (file)
@@ -70,9 +70,9 @@ struct xftface_info
   XftColor xft_bg;             /* color for face->background */
 };
 
-static void xftfont_get_colors P_ ((FRAME_PTR, struct face *, GC gc,
-                                   struct xftface_info *,
-                                   XftColor *fg, XftColor *bg));
+static void xftfont_get_colors (FRAME_PTR, struct face *, GC gc,
+                                struct xftface_info *,
+                                XftColor *fg, XftColor *bg);
 
 
 /* Setup foreground and background colors of GC into FG and BG.  If
@@ -80,12 +80,7 @@ static void xftfont_get_colors P_ ((FRAME_PTR, struct face *, GC gc,
    may be NULL.  */
 
 static void
-xftfont_get_colors (f, face, gc, xftface_info, fg, bg)
-     FRAME_PTR f;
-     struct face *face;
-     GC gc;
-     struct xftface_info *xftface_info;
-     XftColor *fg, *bg;
+xftfont_get_colors (FRAME_PTR f, struct face *face, GC gc, struct xftface_info *xftface_info, XftColor *fg, XftColor *bg)
 {
   if (xftface_info && face->gc == gc)
     {
@@ -141,25 +136,23 @@ xftfont_get_colors (f, face, gc, xftface_info, fg, bg)
 }
 
 
-static Lisp_Object xftfont_list P_ ((Lisp_Object, Lisp_Object));
-static Lisp_Object xftfont_match P_ ((Lisp_Object, Lisp_Object));
-static Lisp_Object xftfont_open P_ ((FRAME_PTR, Lisp_Object, int));
-static void xftfont_close P_ ((FRAME_PTR, struct font *));
-static int xftfont_prepare_face P_ ((FRAME_PTR, struct face *));
-static void xftfont_done_face P_ ((FRAME_PTR, struct face *));
-static int xftfont_has_char P_ ((Lisp_Object, int));
-static unsigned xftfont_encode_char P_ ((struct font *, int));
-static int xftfont_text_extents P_ ((struct font *, unsigned *, int,
-                                    struct font_metrics *));
-static int xftfont_draw P_ ((struct glyph_string *, int, int, int, int, int));
-static int xftfont_end_for_frame P_ ((FRAME_PTR f));
+static Lisp_Object xftfont_list (Lisp_Object, Lisp_Object);
+static Lisp_Object xftfont_match (Lisp_Object, Lisp_Object);
+static Lisp_Object xftfont_open (FRAME_PTR, Lisp_Object, int);
+static void xftfont_close (FRAME_PTR, struct font *);
+static int xftfont_prepare_face (FRAME_PTR, struct face *);
+static void xftfont_done_face (FRAME_PTR, struct face *);
+static int xftfont_has_char (Lisp_Object, int);
+static unsigned xftfont_encode_char (struct font *, int);
+static int xftfont_text_extents (struct font *, unsigned *, int,
+                                 struct font_metrics *);
+static int xftfont_draw (struct glyph_string *, int, int, int, int, int);
+static int xftfont_end_for_frame (FRAME_PTR f);
 
 struct font_driver xftfont_driver;
 
 static Lisp_Object
-xftfont_list (frame, spec)
-     Lisp_Object frame;
-     Lisp_Object spec;
+xftfont_list (Lisp_Object frame, Lisp_Object spec)
 {
   Lisp_Object list = ftfont_driver.list (frame, spec), tail;
 
@@ -169,9 +162,7 @@ xftfont_list (frame, spec)
 }
 
 static Lisp_Object
-xftfont_match (frame, spec)
-     Lisp_Object frame;
-     Lisp_Object spec;
+xftfont_match (Lisp_Object frame, Lisp_Object spec)
 {
   Lisp_Object entity = ftfont_driver.match (frame, spec);
 
@@ -180,15 +171,10 @@ xftfont_match (frame, spec)
   return entity;
 }
 
-extern Lisp_Object ftfont_font_format P_ ((FcPattern *, Lisp_Object));
-extern FcCharSet *ftfont_get_fc_charset P_ ((Lisp_Object));
-extern Lisp_Object QCantialias;
-
 static FcChar8 ascii_printable[95];
 
 static void
-xftfont_fix_match (pat, match)
-     FcPattern *pat, *match;
+xftfont_fix_match (FcPattern *pat, FcPattern *match)
 {
   /*  These values are not used for matching (except antialias), but for
       rendering, so make sure they are carried over to the match.
@@ -238,9 +224,7 @@ xftfont_fix_match (pat, match)
 }
 
 static void
-xftfont_add_rendering_parameters (pat, entity)
-     FcPattern *pat;
-     Lisp_Object entity;
+xftfont_add_rendering_parameters (FcPattern *pat, Lisp_Object entity)
 {
   Lisp_Object tail;
   int ival;
@@ -288,10 +272,7 @@ xftfont_add_rendering_parameters (pat, entity)
 }
 
 static Lisp_Object
-xftfont_open (f, entity, pixel_size)
-     FRAME_PTR f;
-     Lisp_Object entity;
-     int pixel_size;
+xftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
 {
   FcResult result;
   Display *display = FRAME_X_DISPLAY (f);
@@ -510,9 +491,7 @@ xftfont_open (f, entity, pixel_size)
 }
 
 static void
-xftfont_close (f, font)
-     FRAME_PTR f;
-     struct font *font;
+xftfont_close (FRAME_PTR f, struct font *font)
 {
   struct xftfont_info *xftfont_info = (struct xftfont_info *) font;
 
@@ -527,9 +506,7 @@ xftfont_close (f, font)
 }
 
 static int
-xftfont_prepare_face (f, face)
-     FRAME_PTR f;
-     struct face *face;
+xftfont_prepare_face (FRAME_PTR f, struct face *face)
 {
   struct xftface_info *xftface_info;
 
@@ -552,9 +529,7 @@ xftfont_prepare_face (f, face)
 }
 
 static void
-xftfont_done_face (f, face)
-     FRAME_PTR f;
-     struct face *face;
+xftfont_done_face (FRAME_PTR f, struct face *face)
 {
   struct xftface_info *xftface_info;
 
@@ -573,12 +548,8 @@ xftfont_done_face (f, face)
     }
 }
 
-extern Lisp_Object Qja, Qko;
-
 static int
-xftfont_has_char (font, c)
-     Lisp_Object font;
-     int c;
+xftfont_has_char (Lisp_Object font, int c)
 {
   struct xftfont_info *xftfont_info;
   struct charset *cs = NULL;
@@ -600,9 +571,7 @@ xftfont_has_char (font, c)
 }
 
 static unsigned
-xftfont_encode_char (font, c)
-     struct font *font;
-     int c;
+xftfont_encode_char (struct font *font, int c)
 {
   struct xftfont_info *xftfont_info = (struct xftfont_info *) font;
   unsigned code = XftCharIndex (xftfont_info->display, xftfont_info->xftfont,
@@ -612,11 +581,7 @@ xftfont_encode_char (font, c)
 }
 
 static int
-xftfont_text_extents (font, code, nglyphs, metrics)
-     struct font *font;
-     unsigned *code;
-     int nglyphs;
-     struct font_metrics *metrics;
+xftfont_text_extents (struct font *font, unsigned int *code, int nglyphs, struct font_metrics *metrics)
 {
   struct xftfont_info *xftfont_info = (struct xftfont_info *) font;
   XGlyphInfo extents;
@@ -637,8 +602,7 @@ xftfont_text_extents (font, code, nglyphs, metrics)
 }
 
 static XftDraw *
-xftfont_get_xft_draw (f)
-     FRAME_PTR f;
+xftfont_get_xft_draw (FRAME_PTR f)
 {
   XftDraw *xft_draw = font_get_frame_data (f, &xftfont_driver);
 
@@ -658,9 +622,7 @@ xftfont_get_xft_draw (f)
 }
 
 static int
-xftfont_draw (s, from, to, x, y, with_background)
-     struct glyph_string *s;
-     int from, to, x, y, with_background;
+xftfont_draw (struct glyph_string *s, int from, int to, int x, int y, int with_background)
 {
   FRAME_PTR f = s->f;
   struct face *face = s->face;
@@ -703,8 +665,7 @@ xftfont_draw (s, from, to, x, y, with_background)
 }
 
 static int
-xftfont_end_for_frame (f)
-     FRAME_PTR f;
+xftfont_end_for_frame (FRAME_PTR f)
 {
   XftDraw *xft_draw;
 
@@ -724,11 +685,7 @@ xftfont_end_for_frame (f)
 }
 
 static int
-xftfont_cached_font_ok (f, font_object, entity)
-     struct frame *f;
-     Lisp_Object font_object;
-     Lisp_Object entity;
-
+xftfont_cached_font_ok (struct frame *f, Lisp_Object font_object, Lisp_Object entity)
 {
   struct xftfont_info *info = (struct xftfont_info *) XFONT_OBJECT (font_object);
   FcPattern *oldpat = info->xftfont->pattern;
@@ -771,7 +728,7 @@ xftfont_cached_font_ok (f, font_object, entity)
 }
 
 void
-syms_of_xftfont ()
+syms_of_xftfont (void)
 {
   DEFSYM (Qxft, "xft");
   DEFSYM (QChinting, ":hinting");
index d93c1bdf4050cba8181193cd9c0e40892dfa3d07..56e14fe6e142009901fe7c511041e50ed43d4546 100644 (file)
@@ -17,7 +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/>.  */
 
-#include "config.h"
+#include <config.h>
 
 #if defined (USE_GTK) || defined (HAVE_GCONF)
 #include <glib.h>
@@ -29,12 +29,8 @@ static GPollFD *gfds;
 static int gfds_size;
 
 int
-xg_select (max_fds, rfds, wfds, efds, timeout)
-     int max_fds;
-     SELECT_TYPE *rfds;
-     SELECT_TYPE *wfds;
-     SELECT_TYPE *efds;
-     EMACS_TIME *timeout;
+xg_select (int max_fds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
+          EMACS_TIME *timeout)
 {
   SELECT_TYPE all_rfds, all_wfds;
   EMACS_TIME tmo, *tmop = timeout;
@@ -147,7 +143,7 @@ xg_select (max_fds, rfds, wfds, efds, timeout)
 #endif /* defined (USE_GTK) || defined (HAVE_GCONF) */
 
 void
-xgselect_initialize ()
+xgselect_initialize (void)
 {
 #if defined (USE_GTK) || defined (HAVE_GCONF)
   gfds_size = 128;
index bae084f0d5cbc2b0dc510e5982781a928c4f6c5c..f120d8866cf6a12641a5fec9223c29666f997fd9 100644 (file)
@@ -24,13 +24,13 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "systime.h"
 #include "sysselect.h"
 
-extern int xg_select P_ ((int max_fds,
-                          SELECT_TYPE *rfds,
-                          SELECT_TYPE *wfds,
-                          SELECT_TYPE *efds,
-                          EMACS_TIME *timeout));
+extern int xg_select (int max_fds,
+                      SELECT_TYPE *rfds,
+                      SELECT_TYPE *wfds,
+                      SELECT_TYPE *efds,
+                      EMACS_TIME *timeout);
 
-extern void xgselect_initialize P_ ((void));
+extern void xgselect_initialize (void);
 
 #endif /* XGSELECT_H */
 
index 64e55b7413c3a3c45415cdc61dab8da9d6ee4170..68b442388a56b44fa3de4326cec6bc2e3770f743 100644 (file)
@@ -81,13 +81,14 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <X11/StringDefs.h>
 #include <X11/Shell.h>
 #ifdef USE_LUCID
+#include "xsettings.h"
+#include "../lwlib/xlwmenu.h"
 #ifdef HAVE_XAW3D
 #include <X11/Xaw3d/Paned.h>
 #else /* !HAVE_XAW3D */
 #include <X11/Xaw/Paned.h>
 #endif /* HAVE_XAW3D */
 #endif /* USE_LUCID */
-#include "../lwlib/lwlib.h"
 #else /* not USE_X_TOOLKIT */
 #ifndef USE_GTK
 #include "../oldXMenu/XMenu.h"
@@ -108,34 +109,12 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 Lisp_Object Qdebug_on_next_call;
 
-extern Lisp_Object Qmenu_bar;
-
-extern Lisp_Object QCtoggle, QCradio;
-
-extern Lisp_Object Voverriding_local_map;
-extern Lisp_Object Voverriding_local_map_menu_flag;
-
-extern Lisp_Object Qoverriding_local_map, Qoverriding_terminal_local_map;
-
-extern Lisp_Object Qmenu_bar_update_hook;
-
-#ifdef USE_X_TOOLKIT
-extern void set_frame_menubar P_ ((FRAME_PTR, int, int));
-extern XtAppContext Xt_app_con;
-
-static Lisp_Object xdialog_show P_ ((FRAME_PTR, int, Lisp_Object, Lisp_Object,
-                                    char **));
-static void popup_get_selection P_ ((XEvent *, struct x_display_info *,
-                                     LWLIB_ID, int));
-#endif /* USE_X_TOOLKIT */
-
-#ifdef USE_GTK
-extern void set_frame_menubar P_ ((FRAME_PTR, int, int));
-static Lisp_Object xdialog_show P_ ((FRAME_PTR, int, Lisp_Object, Lisp_Object,
-                                    char **));
+#if defined (USE_X_TOOLKIT) || defined (USE_GTK)
+static Lisp_Object xdialog_show (FRAME_PTR, int, Lisp_Object, Lisp_Object,
+                                 const char **);
 #endif
 
-static int update_frame_menubar P_ ((struct frame *));
+static int update_frame_menubar (struct frame *);
 \f
 /* Flag which when set indicates a dialog or menu has been posted by
    Xt on behalf of one of the widget sets.  */
@@ -143,28 +122,13 @@ static int popup_activated_flag;
 
 static int next_menubar_widget_id;
 
-/* For NS and NTGUI, these prototypes are defined in keyboard.h.  */
-#if defined (USE_X_TOOLKIT) || defined (USE_GTK)
-extern widget_value *xmalloc_widget_value P_ ((void));
-extern widget_value *digest_single_submenu P_ ((int, int, int));
-#endif
-
-/* This is set nonzero after the user activates the menu bar, and set
-   to zero again after the menu bars are redisplayed by prepare_menu_bar.
-   While it is nonzero, all calls to set_frame_menubar go deep.
-
-   I don't understand why this is needed, but it does seem to be
-   needed on Motif, according to Marcus Daniels <marcus@sysc.pdx.edu>.  */
-
-int pending_menu_activation;
 \f
 #ifdef USE_X_TOOLKIT
 
 /* Return the frame whose ->output_data.x->id equals ID, or 0 if none.  */
 
 static struct frame *
-menubar_id_to_frame (id)
-     LWLIB_ID id;
+menubar_id_to_frame (LWLIB_ID id)
 {
   Lisp_Object tail, frame;
   FRAME_PTR f;
@@ -194,10 +158,7 @@ menubar_id_to_frame (id)
    the scroll bar or the edit window.  Fx_popup_menu needs to be
    sure it is the edit window.  */
 void
-mouse_position_for_popup (f, x, y)
-     FRAME_PTR f;
-     int *x;
-     int *y;
+mouse_position_for_popup (FRAME_PTR f, int *x, int *y)
 {
   Window root, dummy_window;
   int dummy;
@@ -261,8 +222,7 @@ otherwise it is "Question".
 If the user gets rid of the dialog box without making a valid choice,
 for instance using the window manager, then this produces a quit and
 `x-popup-dialog' does not return.  */)
-     (position, contents, header)
-     Lisp_Object position, contents, header;
+  (Lisp_Object position, Lisp_Object contents, Lisp_Object header)
 {
   FRAME_PTR f = NULL;
   Lisp_Object window;
@@ -352,7 +312,7 @@ for instance using the window manager, then this produces a quit and
 #else
   {
     Lisp_Object title;
-    char *error_name;
+    const char *error_name;
     Lisp_Object selection;
     int specpdl_count = SPECPDL_INDEX ();
 
@@ -389,8 +349,7 @@ for instance using the window manager, then this produces a quit and
 /* Set menu_items_inuse so no other popup menu or dialog is created.  */
 
 void
-x_menu_set_in_use (in_use)
-     int in_use;
+x_menu_set_in_use (int in_use)
 {
   menu_items_inuse = in_use ? Qt : Qnil;
   popup_activated_flag = in_use;
@@ -459,11 +418,7 @@ x_menu_wait_for_event (void *data)
    with BLOCK_INPUT, UNBLOCK_INPUT wrappers.  */
 
 static void
-popup_get_selection (initial_event, dpyinfo, id, do_timers)
-     XEvent *initial_event;
-     struct x_display_info *dpyinfo;
-     LWLIB_ID id;
-     int do_timers;
+popup_get_selection (XEvent *initial_event, struct x_display_info *dpyinfo, LWLIB_ID id, int do_timers)
 {
   XEvent event;
 
@@ -520,8 +475,7 @@ arrow keys, select a menu entry with the return key or cancel with the
 escape key.  If FRAME has no menu bar this function does nothing.
 
 If FRAME is nil or not given, use the selected frame.  */)
-     (frame)
-     Lisp_Object frame;
+  (Lisp_Object frame)
 {
   XEvent ev;
   FRAME_PTR f = check_x_frame (frame);
@@ -599,8 +553,7 @@ arrow keys, select a menu entry with the return key or cancel with the
 escape key.  If FRAME has no menu bar this function does nothing.
 
 If FRAME is nil or not given, use the selected frame.  */)
-     (frame)
-     Lisp_Object frame;
+  (Lisp_Object frame)
 {
   GtkWidget *menubar;
   FRAME_PTR f;
@@ -636,9 +589,7 @@ If FRAME is nil or not given, use the selected frame.  */)
    Used for popup menus and dialogs. */
 
 static void
-popup_widget_loop (do_timers, widget)
-     int do_timers;
-     GtkWidget *widget;
+popup_widget_loop (int do_timers, GtkWidget *widget)
 {
   ++popup_activated_flag;
 
@@ -666,8 +617,7 @@ popup_widget_loop (do_timers, widget)
    execute Lisp code.  */
 
 void
-x_activate_menubar (f)
-     FRAME_PTR f;
+x_activate_menubar (FRAME_PTR f)
 {
   if (! FRAME_X_P (f))
     abort ();
@@ -683,18 +633,14 @@ x_activate_menubar (f)
 
   set_frame_menubar (f, 0, 1);
   BLOCK_INPUT;
+  popup_activated_flag = 1;
 #ifdef USE_GTK
   XPutBackEvent (f->output_data.x->display_info->display,
                  f->output_data.x->saved_menu_event);
-  popup_activated_flag = 1;
 #else
   XtDispatchEvent (f->output_data.x->saved_menu_event);
 #endif
   UNBLOCK_INPUT;
-#ifdef USE_MOTIF
-  if (f->output_data.x->saved_menu_event->type == ButtonRelease)
-    pending_menu_activation = 1;
-#endif
 
   /* Ignore this if we get it a second time.  */
   f->output_data.x->saved_menu_event->type = 0;
@@ -705,10 +651,7 @@ x_activate_menubar (f)
 
 #ifndef USE_GTK
 static void
-popup_activate_callback (widget, id, client_data)
-     Widget widget;
-     LWLIB_ID id;
-     XtPointer client_data;
+popup_activate_callback (Widget widget, LWLIB_ID id, XtPointer client_data)
 {
   popup_activated_flag = 1;
 #ifdef USE_X_TOOLKIT
@@ -722,18 +665,13 @@ popup_activate_callback (widget, id, client_data)
 
 #ifdef USE_GTK
 static void
-popup_deactivate_callback (widget, client_data)
-     GtkWidget *widget;
-     gpointer client_data;
+popup_deactivate_callback (GtkWidget *widget, gpointer client_data)
 {
   popup_activated_flag = 0;
 }
 #else
 static void
-popup_deactivate_callback (widget, id, client_data)
-     Widget widget;
-     LWLIB_ID id;
-     XtPointer client_data;
+popup_deactivate_callback (Widget widget, LWLIB_ID id, XtPointer client_data)
 {
   popup_activated_flag = 0;
 }
@@ -744,10 +682,7 @@ popup_deactivate_callback (widget, id, client_data)
    for that widget.
    F is the frame if known, or NULL if not known.  */
 static void
-show_help_event (f, widget, help)
-     FRAME_PTR f;
-     xt_or_gtk_widget widget;
-     Lisp_Object help;
+show_help_event (FRAME_PTR f, xt_or_gtk_widget widget, Lisp_Object help)
 {
   Lisp_Object frame;
 
@@ -785,9 +720,7 @@ show_help_event (f, widget, help)
 
 #ifdef USE_GTK
 void
-menu_highlight_callback (widget, call_data)
-     GtkWidget *widget;
-     gpointer call_data;
+menu_highlight_callback (GtkWidget *widget, gpointer call_data)
 {
   xg_menu_item_cb_data *cb_data;
   Lisp_Object help;
@@ -806,10 +739,7 @@ menu_highlight_callback (widget, call_data)
 }
 #else
 void
-menu_highlight_callback (widget, id, call_data)
-     Widget widget;
-     LWLIB_ID id;
-     void *call_data;
+menu_highlight_callback (Widget widget, LWLIB_ID id, void *call_data)
 {
   struct frame *f;
   Lisp_Object help;
@@ -837,9 +767,7 @@ static int xg_crazy_callback_abort;
    Figure out what the user chose
    and put the appropriate events into the keyboard buffer.  */
 static void
-menubar_selection_callback (widget, client_data)
-     GtkWidget *widget;
-     gpointer client_data;
+menubar_selection_callback (GtkWidget *widget, gpointer client_data)
 {
   xg_menu_item_cb_data *cb_data = (xg_menu_item_cb_data*) client_data;
 
@@ -882,10 +810,7 @@ menubar_selection_callback (widget, client_data)
    Figure out what the user chose
    and put the appropriate events into the keyboard buffer.  */
 static void
-menubar_selection_callback (widget, id, client_data)
-     Widget widget;
-     LWLIB_ID id;
-     XtPointer client_data;
+menubar_selection_callback (Widget widget, LWLIB_ID id, XtPointer client_data)
 {
   FRAME_PTR f;
 
@@ -901,8 +826,7 @@ menubar_selection_callback (widget, id, client_data)
    changed.  Value is non-zero if widgets were updated.  */
 
 static int
-update_frame_menubar (f)
-     FRAME_PTR f;
+update_frame_menubar (FRAME_PTR f)
 {
 #ifdef USE_GTK
   return xg_update_frame_menubar (f);
@@ -950,15 +874,48 @@ update_frame_menubar (f)
   return 1;
 }
 
+#ifdef USE_LUCID
+static void
+apply_systemfont_to_dialog (Widget w)
+{
+  const char *fn = xsettings_get_system_normal_font ();
+  if (fn) 
+    {
+      XrmDatabase db = XtDatabase (XtDisplay (w));
+      if (db)
+        XrmPutStringResource (&db, "*dialog.faceName", fn);
+    }
+}
+
+static void
+apply_systemfont_to_menu (Widget w)
+{
+  const char *fn = xsettings_get_system_normal_font ();
+  int defflt;
+
+  if (!fn) return;
+
+  if (XtIsShell (w)) /* popup menu */
+    {
+      Widget *childs = NULL;
+
+      XtVaGetValues (w, XtNchildren, &childs, NULL);
+      if (*childs) w = *childs;
+    }
+
+  /* Only use system font if the default is used for the menu.  */
+  XtVaGetValues (w, XtNdefaultFace, &defflt, NULL);
+  if (defflt)
+    XtVaSetValues (w, XtNfaceName, fn, NULL);
+}
+#endif
+
 /* Set the contents of the menubar widgets of frame F.
    The argument FIRST_TIME is currently ignored;
    it is set the first time this is called, from initialize_frame_menubar.  */
 
 void
-set_frame_menubar (f, first_time, deep_p)
-     FRAME_PTR f;
-     int first_time;
-     int deep_p;
+set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
 {
   xt_or_gtk_widget menubar_widget;
 #ifdef USE_X_TOOLKIT
@@ -985,8 +942,6 @@ set_frame_menubar (f, first_time, deep_p)
 
   if (! menubar_widget)
     deep_p = 1;
-  else if (pending_menu_activation && !deep_p)
-    deep_p = 1;
   /* Make the first call for any given frame always go deep.  */
   else if (!f->output_data.x->saved_menu_event && !deep_p)
     {
@@ -1047,8 +1002,8 @@ set_frame_menubar (f, first_time, deep_p)
 
       /* Save the frame's previous menu bar contents data.  */
       if (previous_menu_items_used)
-       bcopy (XVECTOR (f->menu_bar_vector)->contents, previous_items,
-              previous_menu_items_used * sizeof (Lisp_Object));
+       memcpy (previous_items, XVECTOR (f->menu_bar_vector)->contents,
+               previous_menu_items_used * sizeof (Lisp_Object));
 
       /* Fill in menu_items with the current menu bar contents.
         This can evaluate Lisp code.  */
@@ -1262,10 +1217,17 @@ set_frame_menubar (f, first_time, deep_p)
 
       /* Make menu pop down on C-g.  */
       XtOverrideTranslations (menubar_widget, override);
+#ifdef USE_LUCID
+      apply_systemfont_to_menu (menubar_widget);
+#endif
     }
 
   {
-    int menubar_size
+    int menubar_size;
+    if (f->output_data.x->menubar_widget)
+      XtRealizeWidget (f->output_data.x->menubar_widget);
+
+    menubar_size
       = (f->output_data.x->menubar_widget
         ? (f->output_data.x->menubar_widget->core.height
            + f->output_data.x->menubar_widget->core.border_width)
@@ -1274,7 +1236,7 @@ set_frame_menubar (f, first_time, deep_p)
 #if 1 /* Experimentally, we now get the right results
         for -geometry -0-0 without this.  24 Aug 96, rms.
          Maybe so, but the menu bar size is missing the pixels so the
-         WM size hints are off by theses pixel.  Jan D, oct 2009.  */
+         WM size hints are off by these pixels.  Jan D, oct 2009.  */
 #ifdef USE_LUCID
     if (FRAME_EXTERNAL_MENU_BAR (f))
       {
@@ -1306,8 +1268,7 @@ set_frame_menubar (f, first_time, deep_p)
    is visible.  */
 
 void
-initialize_frame_menubar (f)
-     FRAME_PTR f;
+initialize_frame_menubar (FRAME_PTR f)
 {
   /* This function is called before the first chance to redisplay
      the frame.  It has to be, so the frame will have the right size.  */
@@ -1322,8 +1283,7 @@ initialize_frame_menubar (f)
 
 #ifndef USE_GTK
 void
-free_frame_menubar (f)
-     FRAME_PTR f;
+free_frame_menubar (FRAME_PTR f)
 {
   Widget menubar_widget;
 
@@ -1358,15 +1318,15 @@ free_frame_menubar (f)
       lw_destroy_all_widgets ((LWLIB_ID) f->output_data.x->id);
       f->output_data.x->menubar_widget = NULL;
 
-#ifdef USE_MOTIF
       if (f->output_data.x->widget)
        {
+#ifdef USE_MOTIF
          XtVaGetValues (f->output_data.x->widget, XtNx, &x1, XtNy, &y1, NULL);
          if (x1 == 0 && y1 == 0)
            XtVaSetValues (f->output_data.x->widget, XtNx, x0, XtNy, y0, NULL);
-       }
 #endif
-
+          x_set_window_size (f, 0, FRAME_COLS (f), FRAME_LINES (f));
+       }
       UNBLOCK_INPUT;
     }
 }
@@ -1417,12 +1377,7 @@ struct next_popup_x_y
 
    Here only X and Y are used.  */
 static void
-menu_position_func (menu, x, y, push_in, user_data)
-     GtkMenu *menu;
-     gint *x;
-     gint *y;
-     gboolean *push_in;
-     gpointer user_data;
+menu_position_func (GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer user_data)
 {
   struct next_popup_x_y* data = (struct next_popup_x_y*)user_data;
   GtkRequisition req;
@@ -1443,9 +1398,7 @@ menu_position_func (menu, x, y, push_in, user_data)
 }
 
 static void
-popup_selection_callback (widget, client_data)
-     GtkWidget *widget;
-     gpointer client_data;
+popup_selection_callback (GtkWidget *widget, gpointer client_data)
 {
   xg_menu_item_cb_data *cb_data = (xg_menu_item_cb_data*) client_data;
 
@@ -1454,8 +1407,7 @@ popup_selection_callback (widget, client_data)
 }
 
 static Lisp_Object
-pop_down_menu (arg)
-     Lisp_Object arg;
+pop_down_menu (Lisp_Object arg)
 {
   struct Lisp_Save_Value *p = XSAVE_VALUE (arg);
 
@@ -1470,13 +1422,7 @@ pop_down_menu (arg)
    menu pops down.
    menu_item_selection will be set to the selection.  */
 static void
-create_and_show_popup_menu (f, first_wv, x, y, for_click, timestamp)
-     FRAME_PTR f;
-     widget_value *first_wv;
-     int x;
-     int y;
-     int for_click;
-     EMACS_UINT timestamp;
+create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, int x, int y, int for_click, EMACS_UINT timestamp)
 {
   int i;
   GtkWidget *menu;
@@ -1524,7 +1470,7 @@ create_and_show_popup_menu (f, first_wv, x, y, for_click, timestamp)
 
   record_unwind_protect (pop_down_menu, make_save_value (menu, 0));
 
-  if (GTK_WIDGET_MAPPED (menu))
+  if (gtk_widget_get_mapped (menu))
     {
       /* Set this to one.  popup_widget_loop increases it by one, so it becomes
          two.  show_help_echo uses this to detect popup menus.  */
@@ -1553,10 +1499,7 @@ create_and_show_popup_menu (f, first_wv, x, y, for_click, timestamp)
 LWLIB_ID widget_id_tick;
 
 static void
-popup_selection_callback (widget, id, client_data)
-     Widget widget;
-     LWLIB_ID id;
-     XtPointer client_data;
+popup_selection_callback (Widget widget, LWLIB_ID id, XtPointer client_data)
 {
   menu_item_selection = (Lisp_Object *) client_data;
 }
@@ -1565,8 +1508,7 @@ popup_selection_callback (widget, id, client_data)
    as a Lisp object as (HIGHPART . LOWPART).  */
 
 static Lisp_Object
-pop_down_menu (arg)
-     Lisp_Object arg;
+pop_down_menu (Lisp_Object arg)
 {
   LWLIB_ID id = (XINT (XCAR (arg)) << 4 * sizeof (LWLIB_ID)
                  | XINT (XCDR (arg)));
@@ -1583,13 +1525,8 @@ pop_down_menu (arg)
    menu pops down.
    menu_item_selection will be set to the selection.  */
 static void
-create_and_show_popup_menu (f, first_wv, x, y, for_click, timestamp)
-     FRAME_PTR f;
-     widget_value *first_wv;
-     int x;
-     int y;
-     int for_click;
-     EMACS_UINT timestamp;
+create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv,
+                           int x, int y, int for_click, EMACS_UINT timestamp)
 {
   int i;
   Arg av[2];
@@ -1608,6 +1545,10 @@ create_and_show_popup_menu (f, first_wv, x, y, for_click, timestamp)
                            popup_deactivate_callback,
                            menu_highlight_callback);
 
+#ifdef USE_LUCID
+  apply_systemfont_to_menu (menu);
+#endif
+
   dummy.type = ButtonPress;
   dummy.serial = 0;
   dummy.send_event = 0;
@@ -1659,7 +1600,7 @@ create_and_show_popup_menu (f, first_wv, x, y, for_click, timestamp)
 
 Lisp_Object
 xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
-           Lisp_Object title, char **error, EMACS_UINT timestamp)
+           Lisp_Object title, const char **error, EMACS_UINT timestamp)
 {
   int i;
   widget_value *wv, *save_wv = 0, *first_wv = 0, *prev_wv = 0;
@@ -1723,7 +1664,7 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
        {
          /* Create a new pane.  */
          Lisp_Object pane_name, prefix;
-         char *pane_string;
+         const char *pane_string;
 
          pane_name = AREF (menu_items, i + MENU_ITEMS_PANE_NAME);
          prefix = AREF (menu_items, i + MENU_ITEMS_PANE_PREFIX);
@@ -1934,9 +1875,7 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
 \f
 #ifdef USE_GTK
 static void
-dialog_selection_callback (widget, client_data)
-     GtkWidget *widget;
-     gpointer client_data;
+dialog_selection_callback (GtkWidget *widget, gpointer client_data)
 {
   /* The EMACS_INT cast avoids a warning.  There's no problem
      as long as pointers have enough bits to hold small integers.  */
@@ -1950,9 +1889,7 @@ dialog_selection_callback (widget, client_data)
    dialog pops down.
    menu_item_selection will be set to the selection.  */
 static void
-create_and_show_dialog (f, first_wv)
-     FRAME_PTR f;
-     widget_value *first_wv;
+create_and_show_dialog (FRAME_PTR f, widget_value *first_wv)
 {
   GtkWidget *menu;
 
@@ -1981,10 +1918,7 @@ create_and_show_dialog (f, first_wv)
 
 #else /* not USE_GTK */
 static void
-dialog_selection_callback (widget, id, client_data)
-     Widget widget;
-     LWLIB_ID id;
-     XtPointer client_data;
+dialog_selection_callback (Widget widget, LWLIB_ID id, XtPointer client_data)
 {
   /* The EMACS_INT cast avoids a warning.  There's no problem
      as long as pointers have enough bits to hold small integers.  */
@@ -2002,9 +1936,7 @@ dialog_selection_callback (widget, id, client_data)
    dialog pops down.
    menu_item_selection will be set to the selection.  */
 static void
-create_and_show_dialog (f, first_wv)
-     FRAME_PTR f;
-     widget_value *first_wv;
+create_and_show_dialog (FRAME_PTR f, widget_value *first_wv)
 {
   LWLIB_ID dialog_id;
 
@@ -2012,11 +1944,13 @@ create_and_show_dialog (f, first_wv)
     abort();
 
   dialog_id = widget_id_tick++;
+#ifdef USE_LUCID
+  apply_systemfont_to_dialog (f->output_data.x->widget);
+#endif
   lw_create_widget (first_wv->name, "dialog", dialog_id, first_wv,
                     f->output_data.x->widget, 1, 0,
                     dialog_selection_callback, 0, 0);
   lw_modify_all_widgets (dialog_id, first_wv->contents, True);
-
   /* Display the dialog box.  */
   lw_pop_up_all_widgets (dialog_id);
   popup_activated_flag = 1;
@@ -2042,16 +1976,16 @@ create_and_show_dialog (f, first_wv)
 
 #endif /* not USE_GTK */
 
-static char * button_names [] = {
+static const char * button_names [] = {
   "button1", "button2", "button3", "button4", "button5",
   "button6", "button7", "button8", "button9", "button10" };
 
 static Lisp_Object
-xdialog_show (f, keymaps, title, header, error_name)
-     FRAME_PTR f;
-     int keymaps;
-     Lisp_Object title, header;
-     char **error_name;
+xdialog_show (FRAME_PTR f,
+              int keymaps,
+              Lisp_Object title,
+              Lisp_Object header,
+              const char **error_name)
 {
   int i, nb_buttons=0;
   char dialog_name[6];
@@ -2078,7 +2012,7 @@ xdialog_show (f, keymaps, title, header, error_name)
      representing the text label and buttons.  */
   {
     Lisp_Object pane_name, prefix;
-    char *pane_string;
+    const char *pane_string;
     pane_name = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_NAME];
     prefix = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_PREFIX];
     pane_string = (NILP (pane_name)
@@ -2249,11 +2183,8 @@ static struct frame *menu_help_frame;
    keyboard events.  */
 
 static void
-menu_help_callback (help_string, pane, item)
-     char *help_string;
-     int pane, item;
+menu_help_callback (char *help_string, int pane, int item)
 {
-  extern Lisp_Object Qmenu_item;
   Lisp_Object *first_item;
   Lisp_Object pane_name;
   Lisp_Object menu_object;
@@ -2276,8 +2207,7 @@ menu_help_callback (help_string, pane, item)
 }
 
 static Lisp_Object
-pop_down_menu (arg)
-     Lisp_Object arg;
+pop_down_menu (Lisp_Object arg)
 {
   struct Lisp_Save_Value *p1 = XSAVE_VALUE (Fcar (arg));
   struct Lisp_Save_Value *p2 = XSAVE_VALUE (Fcdr (arg));
@@ -2312,14 +2242,8 @@ pop_down_menu (arg)
 
 
 Lisp_Object
-xmenu_show (f, x, y, for_click, keymaps, title, error, timestamp)
-     FRAME_PTR f;
-     int x, y;
-     int for_click;
-     int keymaps;
-     Lisp_Object title;
-     char **error;
-     EMACS_UINT timestamp;
+xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
+           Lisp_Object title, const char **error, EMACS_UINT timestamp)
 {
   Window root;
   XMenu *menu;
@@ -2450,12 +2374,10 @@ xmenu_show (f, x, y, for_click, keymaps, title, error, timestamp)
              item_data
                = (unsigned char *) alloca (maxwidth
                                            + SBYTES (descrip) + 1);
-             bcopy (SDATA (item_name), item_data,
-                    SBYTES (item_name));
+             memcpy (item_data, SDATA (item_name), SBYTES (item_name));
              for (j = SCHARS (item_name); j < maxwidth; j++)
                item_data[j] = ' ';
-             bcopy (SDATA (descrip), item_data + j,
-                    SBYTES (descrip));
+             memcpy (item_data + j, SDATA (descrip), SBYTES (descrip));
              item_data[j + SBYTES (descrip)] = 0;
            }
          else
@@ -2613,7 +2535,7 @@ xmenu_show (f, x, y, for_click, keymaps, title, error, timestamp)
 /* Detect if a dialog or menu has been posted.  */
 
 int
-popup_activated ()
+popup_activated (void)
 {
   return popup_activated_flag;
 }
@@ -2622,7 +2544,7 @@ popup_activated ()
 
 DEFUN ("menu-or-popup-active-p", Fmenu_or_popup_active_p, Smenu_or_popup_active_p, 0, 0, 0,
        doc: /* Return t if a menu or popup dialog is active.  */)
-     ()
+  (void)
 {
 #ifdef HAVE_MENUS
   return (popup_activated ()) ? Qt : Qnil;
@@ -2632,7 +2554,7 @@ DEFUN ("menu-or-popup-active-p", Fmenu_or_popup_active_p, Smenu_or_popup_active_
 }
 \f
 void
-syms_of_xmenu ()
+syms_of_xmenu (void)
 {
   Qdebug_on_next_call = intern_c_string ("debug-on-next-call");
   staticpro (&Qdebug_on_next_call);
index c8cb55cb7b8cf9a2d8a10772dea6a01a42f4bb41..d81f08747ac9585647084b7febc2148adcd65667 100644 (file)
@@ -20,37 +20,20 @@ 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 emacs
 #include <config.h>
-#endif
 
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 
+#include <errno.h>
 #include <epaths.h>
 
 #include <stdio.h>
 #include <setjmp.h>
 
-#if 1 /* I'd really appreciate it if this code could go away...  -JimB */
-/* This avoids lossage in the `dual-universe' headers on AT&T SysV
-   X11.  Don't do it on Solaris, because it breaks compilation with
-   XFree86 4.0.3 (and probably many other X11R6 releases) on Solaris
-   2 */
-#if defined(USG5) && !defined(SOLARIS2)
-#ifndef SYSV
-#define SYSV
-#endif
-#endif /* USG5 && !SOLARIS2 */
-
-#endif /* 1 */
-
 #include <X11/Xlib.h>
 #include <X11/Xatom.h>
-#if 0
-#include <X11/Xos.h>
-#endif
 #include <X11/X.h>
 #include <X11/Xutil.h>
 #include <X11/Xresource.h>
@@ -65,40 +48,16 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "lisp.h"
 
-extern char *getenv ();
-
-/* This does cause trouble on AIX.  I'm going to take the comment at
-   face value.  */
-#if 0
-extern short getuid ();                /* If this causes portability problems,
-                                  I think we should just delete it; it'll
-                                  default to `int' anyway.  */
-#endif
+extern char *getenv (const char *);
 
-#ifdef DECLARE_GETPWUID_WITH_UID_T
 extern struct passwd *getpwuid (uid_t);
 extern struct passwd *getpwnam (const char *);
-#else
-extern struct passwd *getpwuid ();
-extern struct passwd *getpwnam ();
-#endif
 
-extern char *get_system_name ();
-
-/* Make sure not to #include anything after these definitions.  Let's
-   not step on anyone's prototypes.  */
-#ifdef emacs
-/* darwin.h may have already defined these.  */
-#undef malloc
-#undef realloc
-#undef free
-#define malloc xmalloc
-#define realloc xrealloc
-#define free xfree
-#endif
+extern const char *get_system_name (void);
 
-char *x_get_string_resource ();
-static int file_p ();
+char *x_get_string_resource (XrmDatabase rdb, const char *name,
+                            const char *class);
+static int file_p (const char *filename);
 
 \f
 /* X file search path processing.  */
@@ -113,9 +72,7 @@ char *x_customization_string;
    resource, for later use in search path decoding.  If we find no
    such resource, return zero.  */
 char *
-x_get_customization_string (db, name, class)
-     XrmDatabase db;
-     char *name, *class;
+x_get_customization_string (XrmDatabase db, const char *name, const char *class)
 {
   char *full_name
     = (char *) alloca (strlen (name) + sizeof ("customization") + 3);
@@ -130,7 +87,7 @@ x_get_customization_string (db, name, class)
 
   if (result)
     {
-      char *copy = (char *) malloc (strlen (result) + 1);
+      char *copy = (char *) xmalloc (strlen (result) + 1);
       strcpy (copy, result);
       return copy;
     }
@@ -170,23 +127,20 @@ x_get_customization_string (db, name, class)
    Return NULL otherwise.  */
 
 static char *
-magic_file_p (string, string_len, class, escaped_suffix, suffix)
-     char *string;
-     int string_len;
-     char *class, *escaped_suffix, *suffix;
+magic_file_p (const char *string, int string_len, const char *class, const char *escaped_suffix, const char *suffix)
 {
   char *lang = getenv ("LANG");
 
   int path_size = 100;
-  char *path = (char *) malloc (path_size);
+  char *path = (char *) xmalloc (path_size);
   int path_len = 0;
 
-  char *p = string;
+  const char *p = string;
 
   while (p < string + string_len)
     {
       /* The chunk we're about to stick on the end of result.  */
-      char *next = NULL;
+      const char *next = NULL;
       int next_len;
 
       if (*p == '%')
@@ -229,7 +183,7 @@ magic_file_p (string, string_len, class, escaped_suffix, suffix)
              case 'l':
                if (! lang)
                  {
-                   free (path);
+                   xfree (path);
                    return NULL;
                  }
 
@@ -239,7 +193,7 @@ magic_file_p (string, string_len, class, escaped_suffix, suffix)
 
              case 't':
              case 'c':
-               free (path);
+               xfree (path);
                return NULL;
              }
        }
@@ -250,10 +204,10 @@ magic_file_p (string, string_len, class, escaped_suffix, suffix)
       if (path_len + next_len + 1 > path_size)
        {
          path_size = (path_len + next_len + 1) * 2;
-         path = (char *) realloc (path, path_size);
+         path = (char *) xrealloc (path, path_size);
        }
 
-      bcopy (next, path + path_len, next_len);
+      memcpy (path + path_len, next, next_len);
       path_len += next_len;
 
       p++;
@@ -276,10 +230,10 @@ magic_file_p (string, string_len, class, escaped_suffix, suffix)
       if (path_len + suffix_len + 1 > path_size)
        {
          path_size = (path_len + suffix_len + 1);
-         path = (char *) realloc (path, path_size);
+         path = (char *) xrealloc (path, path_size);
        }
 
-      bcopy (suffix, path + path_len, suffix_len);
+      memcpy (path + path_len, suffix, suffix_len);
       path_len += suffix_len;
     }
 
@@ -287,7 +241,7 @@ magic_file_p (string, string_len, class, escaped_suffix, suffix)
 
   if (! file_p (path))
     {
-      free (path);
+      xfree (path);
       return NULL;
     }
 
@@ -296,7 +250,7 @@ magic_file_p (string, string_len, class, escaped_suffix, suffix)
 
 
 static char *
-gethomedir ()
+gethomedir (void)
 {
   struct passwd *pw;
   char *ptr;
@@ -317,7 +271,7 @@ gethomedir ()
   if (ptr == NULL)
     return xstrdup ("/");
 
-  copy = (char *) malloc (strlen (ptr) + 2);
+  copy = (char *) xmalloc (strlen (ptr) + 2);
   strcpy (copy, ptr);
   strcat (copy, "/");
 
@@ -326,8 +280,7 @@ gethomedir ()
 
 
 static int
-file_p (filename)
-     char *filename;
+file_p (const char *filename)
 {
   struct stat status;
 
@@ -342,10 +295,9 @@ file_p (filename)
    the path name of the one we found otherwise.  */
 
 static char *
-search_magic_path (search_path, class, escaped_suffix, suffix)
-     char *search_path, *class, *escaped_suffix, *suffix;
+search_magic_path (const char *search_path, const char *class, const char *escaped_suffix, const char *suffix)
 {
-  register char *s, *p;
+  const char *s, *p;
 
   for (s = search_path; *s; s = p)
     {
@@ -354,7 +306,8 @@ search_magic_path (search_path, class, escaped_suffix, suffix)
 
       if (p > s)
        {
-         char *path = magic_file_p (s, p - s, class, escaped_suffix, suffix);
+         char *path = magic_file_p (s, p - s, class, escaped_suffix,
+                                          suffix);
          if (path)
            return path;
        }
@@ -378,20 +331,20 @@ search_magic_path (search_path, class, escaped_suffix, suffix)
 /* Producing databases for individual sources.  */
 
 static XrmDatabase
-get_system_app (class)
-     char *class;
+get_system_app (const char *class)
 {
   XrmDatabase db = NULL;
-  char *path;
+  const char *path;
+  char *p;
 
   path = getenv ("XFILESEARCHPATH");
   if (! path) path = PATH_X_DEFAULTS;
 
-  path = search_magic_path (path, class, 0, 0);
-  if (path)
+  p = search_magic_path (path, class, 0, 0);
+  if (p)
     {
-      db = XrmGetFileDatabase (path);
-      free (path);
+      db = XrmGetFileDatabase (p);
+      xfree (p);
     }
 
   return db;
@@ -399,18 +352,16 @@ get_system_app (class)
 
 
 static XrmDatabase
-get_fallback (display)
-     Display *display;
+get_fallback (Display *display)
 {
   return NULL;
 }
 
 
 static XrmDatabase
-get_user_app (class)
-     char *class;
+get_user_app (const char *class)
 {
-  char *path;
+  const char *path;
   char *file = 0;
   char *free_it = 0;
 
@@ -432,19 +383,18 @@ get_user_app (class)
           || (file = search_magic_path (free_it, class, "%N", 0)))))
     {
       XrmDatabase db = XrmGetFileDatabase (file);
-      free (file);
-      free (free_it);
+      xfree (file);
+      xfree (free_it);
       return db;
     }
 
-  free (free_it);
+  xfree (free_it);
   return NULL;
 }
 
 
 static XrmDatabase
-get_user_db (display)
-     Display *display;
+get_user_db (Display *display)
 {
   XrmDatabase db;
   char *xdefs;
@@ -463,12 +413,12 @@ get_user_db (display)
       char *xdefault;
 
       home = gethomedir ();
-      xdefault = (char *) malloc (strlen (home) + sizeof (".Xdefaults"));
+      xdefault = (char *) xmalloc (strlen (home) + sizeof (".Xdefaults"));
       strcpy (xdefault, home);
       strcat (xdefault, ".Xdefaults");
       db = XrmGetFileDatabase (xdefault);
-      free (home);
-      free (xdefault);
+      xfree (home);
+      xfree (xdefault);
     }
 
 #ifdef HAVE_XSCREENRESOURCESTRING
@@ -485,17 +435,18 @@ get_user_db (display)
 }
 
 static XrmDatabase
-get_environ_db ()
+get_environ_db (void)
 {
   XrmDatabase db;
   char *p;
-  char *path = 0, *home = 0, *host;
+  char *path = 0, *home = 0;
+  const char *host;
 
   if ((p = getenv ("XENVIRONMENT")) == NULL)
     {
       home = gethomedir ();
       host = get_system_name ();
-      path = (char *) malloc (strlen (home)
+      path = (char *) xmalloc (strlen (home)
                              + sizeof (".Xdefaults-")
                              + strlen (host));
       sprintf (path, "%s%s%s", home, ".Xdefaults-", host);
@@ -504,8 +455,8 @@ get_environ_db ()
 
   db = XrmGetFileDatabase (p);
 
-  free (path);
-  free (home);
+  xfree (path);
+  xfree (home);
 
   return db;
 }
@@ -520,20 +471,18 @@ XrmRepresentation x_rm_string;    /* Quark representation */
 /* Load X resources based on the display and a possible -xrm option. */
 
 XrmDatabase
-x_load_resources (display, xrm_string, myname, myclass)
-     Display *display;
-     char *xrm_string, *myname, *myclass;
+x_load_resources (Display *display, const char *xrm_string,
+                 const char *myname, const char *myclass)
 {
   XrmDatabase user_database;
   XrmDatabase rdb;
   XrmDatabase db;
   char line[256];
 
-  char *helv = "-*-helvetica-medium-r-*--*-120-*-*-*-*-iso8859-1";
+  const char *helv = "-*-helvetica-medium-r-*--*-120-*-*-*-*-iso8859-1";
 
 #ifdef USE_MOTIF
-  char *courier = "-*-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-1";
-  extern Lisp_Object Vdouble_click_time;
+  const char *courier = "-*-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-1";
 #endif
 
   x_rm_string = XrmStringToQuark (XrmStringType);
@@ -612,7 +561,7 @@ x_load_resources (display, xrm_string, myname, myclass)
 
   /* Figure out what the "customization string" is, so we can use it
      to decode paths.  */
-  free (x_customization_string);
+  xfree (x_customization_string);
   x_customization_string
     = x_get_customization_string (user_database, myname, myclass);
 
@@ -656,11 +605,7 @@ x_load_resources (display, xrm_string, myname, myclass)
    and of type TYPE from database RDB.  The value is returned in RET_VALUE. */
 
 int
-x_get_resource (rdb, name, class, expected_type, ret_value)
-     XrmDatabase rdb;
-     char *name, *class;
-     XrmRepresentation expected_type;
-     XrmValue *ret_value;
+x_get_resource (XrmDatabase rdb, const char *name, const char *class, XrmRepresentation expected_type, XrmValue *ret_value)
 {
   XrmValue value;
   XrmName namelist[100];
@@ -676,7 +621,7 @@ x_get_resource (rdb, name, class, expected_type, ret_value)
       if (type == x_rm_string)
        ret_value->addr = (char *) value.addr;
       else
-       bcopy (value.addr, ret_value->addr, ret_value->size);
+       memcpy (ret_value->addr, value.addr, ret_value->size);
 
       return value.size;
     }
@@ -688,9 +633,7 @@ x_get_resource (rdb, name, class, expected_type, ret_value)
    database RDB. */
 
 char *
-x_get_string_resource (rdb, name, class)
-     XrmDatabase rdb;
-     char *name, *class;
+x_get_string_resource (XrmDatabase rdb, const char *name, const char *class)
 {
   XrmValue value;
 
@@ -734,8 +677,6 @@ fatal (msg, prog, x1, x2, x3, x4, x5)
     char *msg, *prog;
     int x1, x2, x3, x4, x5;
 {
-    extern int errno;
-
     if (errno)
       perror (prog);
 
index e2027736855964bff59eb7928870b90bdd66f8ee..21684c83088b84b2af0c0a19f7c7329615e639e2 100644 (file)
@@ -45,44 +45,45 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 struct prop_location;
 
-static Lisp_Object x_atom_to_symbol P_ ((Display *dpy, Atom atom));
-static Atom symbol_to_x_atom P_ ((struct x_display_info *, Display *,
-                                 Lisp_Object));
-static void x_own_selection P_ ((Lisp_Object, Lisp_Object));
-static Lisp_Object x_get_local_selection P_ ((Lisp_Object, Lisp_Object, int));
-static void x_decline_selection_request P_ ((struct input_event *));
-static Lisp_Object x_selection_request_lisp_error P_ ((Lisp_Object));
-static Lisp_Object queue_selection_requests_unwind P_ ((Lisp_Object));
-static Lisp_Object some_frame_on_display P_ ((struct x_display_info *));
-static Lisp_Object x_catch_errors_unwind P_ ((Lisp_Object));
-static void x_reply_selection_request P_ ((struct input_event *, int,
-                                          unsigned char *, int, Atom));
-static int waiting_for_other_props_on_window P_ ((Display *, Window));
-static struct prop_location *expect_property_change P_ ((Display *, Window,
-                                                        Atom, int));
-static void unexpect_property_change P_ ((struct prop_location *));
-static Lisp_Object wait_for_property_change_unwind P_ ((Lisp_Object));
-static void wait_for_property_change P_ ((struct prop_location *));
-static Lisp_Object x_get_foreign_selection P_ ((Lisp_Object,
-                                                Lisp_Object,
-                                                Lisp_Object));
-static void x_get_window_property P_ ((Display *, Window, Atom,
-                                      unsigned char **, int *,
-                                      Atom *, int *, unsigned long *, int));
-static void receive_incremental_selection P_ ((Display *, Window, Atom,
-                                              Lisp_Object, unsigned,
-                                              unsigned char **, int *,
-                                              Atom *, int *, unsigned long *));
-static Lisp_Object x_get_window_property_as_lisp_data P_ ((Display *,
-                                                          Window, Atom,
-                                                          Lisp_Object, Atom));
-static Lisp_Object selection_data_to_lisp_data P_ ((Display *, unsigned char *,
-                                                   int, Atom, int));
-static void lisp_data_to_selection_data P_ ((Display *, Lisp_Object,
-                                            unsigned char **, Atom *,
-                                            unsigned *, int *, int *));
-static Lisp_Object clean_local_selection_data P_ ((Lisp_Object));
-static void initialize_cut_buffers P_ ((Display *, Window));
+static Lisp_Object x_atom_to_symbol (Display *dpy, Atom atom);
+static Atom symbol_to_x_atom (struct x_display_info *, Display *,
+                              Lisp_Object);
+static void x_own_selection (Lisp_Object, Lisp_Object);
+static Lisp_Object x_get_local_selection (Lisp_Object, Lisp_Object, int);
+static void x_decline_selection_request (struct input_event *);
+static Lisp_Object x_selection_request_lisp_error (Lisp_Object);
+static Lisp_Object queue_selection_requests_unwind (Lisp_Object);
+static Lisp_Object some_frame_on_display (struct x_display_info *);
+static Lisp_Object x_catch_errors_unwind (Lisp_Object);
+static void x_reply_selection_request (struct input_event *, int,
+                                       unsigned char *, int, Atom);
+static int waiting_for_other_props_on_window (Display *, Window);
+static struct prop_location *expect_property_change (Display *, Window,
+                                                     Atom, int);
+static void unexpect_property_change (struct prop_location *);
+static Lisp_Object wait_for_property_change_unwind (Lisp_Object);
+static void wait_for_property_change (struct prop_location *);
+static Lisp_Object x_get_foreign_selection (Lisp_Object,
+                                            Lisp_Object,
+                                            Lisp_Object);
+static void x_get_window_property (Display *, Window, Atom,
+                                   unsigned char **, int *,
+                                   Atom *, int *, unsigned long *, int);
+static void receive_incremental_selection (Display *, Window, Atom,
+                                           Lisp_Object, unsigned,
+                                           unsigned char **, int *,
+                                           Atom *, int *, unsigned long *);
+static Lisp_Object x_get_window_property_as_lisp_data (Display *,
+                                                       Window, Atom,
+                                                       Lisp_Object, Atom);
+static Lisp_Object selection_data_to_lisp_data (Display *,
+                                               const unsigned char *,
+                                                int, Atom, int);
+static void lisp_data_to_selection_data (Display *, Lisp_Object,
+                                         unsigned char **, Atom *,
+                                         unsigned *, int *, int *);
+static Lisp_Object clean_local_selection_data (Lisp_Object);
+static void initialize_cut_buffers (Display *, Window);
 
 
 /* Printing traces to stderr.  */
@@ -106,7 +107,7 @@ static void initialize_cut_buffers P_ ((Display *, Window));
 
 #define CUT_BUFFER_SUPPORT
 
-Lisp_Object QPRIMARY, QSECONDARY, QSTRING, QINTEGER, QCLIPBOARD, QTIMESTAMP,
+Lisp_Object QSECONDARY, QSTRING, QINTEGER, QCLIPBOARD, QTIMESTAMP,
   QTEXT, QDELETE, QMULTIPLE, QINCR, QEMACS_TMP, QTARGETS, QATOM, QNULL,
   QATOM_PAIR;
 
@@ -183,8 +184,7 @@ static int x_queue_selection_requests;
 /* Queue up an SELECTION_REQUEST_EVENT *EVENT, to be processed later.  */
 
 static void
-x_queue_event (event)
-     struct input_event *event;
+x_queue_event (struct input_event *event)
 {
   struct selection_event_queue *queue_tmp;
 
@@ -192,7 +192,7 @@ x_queue_event (event)
      This only happens for large requests which uses the incremental protocol.  */
   for (queue_tmp = selection_queue; queue_tmp; queue_tmp = queue_tmp->next)
     {
-      if (!bcmp (&queue_tmp->event, event, sizeof (*event)))
+      if (!memcmp (&queue_tmp->event, event, sizeof (*event)))
        {
          TRACE1 ("DECLINE DUP SELECTION EVENT %08lx", (unsigned long)queue_tmp);
          x_decline_selection_request (event);
@@ -215,7 +215,7 @@ x_queue_event (event)
 /* Start queuing SELECTION_REQUEST_EVENT events.  */
 
 static void
-x_start_queuing_selection_requests ()
+x_start_queuing_selection_requests (void)
 {
   if (x_queue_selection_requests)
     abort ();
@@ -227,7 +227,7 @@ x_start_queuing_selection_requests ()
 /* Stop queuing SELECTION_REQUEST_EVENT events.  */
 
 static void
-x_stop_queuing_selection_requests ()
+x_stop_queuing_selection_requests (void)
 {
   TRACE1 ("x_stop_queuing_selection_requests %d", x_queue_selection_requests);
   --x_queue_selection_requests;
@@ -250,10 +250,7 @@ x_stop_queuing_selection_requests ()
    roundtrip whenever possible.  */
 
 static Atom
-symbol_to_x_atom (dpyinfo, display, sym)
-     struct x_display_info *dpyinfo;
-     Display *display;
-     Lisp_Object sym;
+symbol_to_x_atom (struct x_display_info *dpyinfo, Display *display, Lisp_Object sym)
 {
   Atom val;
   if (NILP (sym))          return 0;
@@ -297,9 +294,7 @@ symbol_to_x_atom (dpyinfo, display, sym)
    and calls to intern whenever possible.  */
 
 static Lisp_Object
-x_atom_to_symbol (dpy, atom)
-     Display *dpy;
-     Atom atom;
+x_atom_to_symbol (Display *dpy, Atom atom)
 {
   struct x_display_info *dpyinfo;
   char *str;
@@ -382,8 +377,7 @@ x_atom_to_symbol (dpy, atom)
    our selection.  */
 
 static void
-x_own_selection (selection_name, selection_value)
-     Lisp_Object selection_name, selection_value;
+x_own_selection (Lisp_Object selection_name, Lisp_Object selection_value)
 {
   struct frame *sf = SELECTED_FRAME ();
   Window selecting_window;
@@ -398,7 +392,7 @@ x_own_selection (selection_name, selection_value)
   selecting_window = FRAME_X_WINDOW (sf);
   display = FRAME_X_DISPLAY (sf);
   dpyinfo = FRAME_X_DISPLAY_INFO (sf);
-  
+
   CHECK_SYMBOL (selection_name);
   selection_atom = symbol_to_x_atom (dpyinfo, display, selection_name);
 
@@ -416,10 +410,8 @@ x_own_selection (selection_name, selection_value)
     Lisp_Object prev_value;
 
     selection_time = long_to_cons ((unsigned long) time);
-    selection_data = Fcons (selection_name,
-                           Fcons (selection_value,
-                                  Fcons (selection_time,
-                                         Fcons (selected_frame, Qnil))));
+    selection_data = list4 (selection_name, selection_value,
+                           selection_time, selected_frame);
     prev_value = assq_no_quit (selection_name, Vselection_alist);
 
     Vselection_alist = Fcons (selection_data, Vselection_alist);
@@ -449,9 +441,7 @@ x_own_selection (selection_name, selection_value)
    This calls random Lisp code, and may signal or gc.  */
 
 static Lisp_Object
-x_get_local_selection (selection_symbol, target_type, local_request)
-     Lisp_Object selection_symbol, target_type;
-     int local_request;
+x_get_local_selection (Lisp_Object selection_symbol, Lisp_Object target_type, int local_request)
 {
   Lisp_Object local_value;
   Lisp_Object handler_fn, value, type, check;
@@ -561,8 +551,7 @@ x_get_local_selection (selection_symbol, target_type, local_request)
    meaning we were unable to do what they wanted.  */
 
 static void
-x_decline_selection_request (event)
-     struct input_event *event;
+x_decline_selection_request (struct input_event *event)
 {
   XSelectionEvent reply;
 
@@ -597,8 +586,7 @@ static struct x_display_info *selection_request_dpyinfo;
    before we throw to top-level or go into the debugger or whatever.  */
 
 static Lisp_Object
-x_selection_request_lisp_error (ignore)
-     Lisp_Object ignore;
+x_selection_request_lisp_error (Lisp_Object ignore)
 {
   if (x_selection_current_request != 0
       && selection_request_dpyinfo->display)
@@ -607,8 +595,7 @@ x_selection_request_lisp_error (ignore)
 }
 
 static Lisp_Object
-x_catch_errors_unwind (dummy)
-     Lisp_Object dummy;
+x_catch_errors_unwind (Lisp_Object dummy)
 {
   BLOCK_INPUT;
   x_uncatch_errors ();
@@ -634,10 +621,10 @@ struct prop_location
   struct prop_location *next;
 };
 
-static struct prop_location *expect_property_change ();
-static void wait_for_property_change ();
-static void unexpect_property_change ();
-static int waiting_for_other_props_on_window ();
+static struct prop_location *expect_property_change (Display *display, Window window, Atom property, int state);
+static void wait_for_property_change (struct prop_location *location);
+static void unexpect_property_change (struct prop_location *location);
+static int waiting_for_other_props_on_window (Display *display, Window window);
 
 static int prop_location_identifier;
 
@@ -648,8 +635,7 @@ static struct prop_location *property_change_reply_object;
 static struct prop_location *property_change_wait_list;
 
 static Lisp_Object
-queue_selection_requests_unwind (tem)
-     Lisp_Object tem;
+queue_selection_requests_unwind (Lisp_Object tem)
 {
   x_stop_queuing_selection_requests ();
   return Qnil;
@@ -659,8 +645,7 @@ queue_selection_requests_unwind (tem)
    Return nil if there is none.  */
 
 static Lisp_Object
-some_frame_on_display (dpyinfo)
-     struct x_display_info *dpyinfo;
+some_frame_on_display (struct x_display_info *dpyinfo)
 {
   Lisp_Object list, frame;
 
@@ -684,11 +669,7 @@ static int x_reply_selection_request_cnt;
 #endif  /* TRACE_SELECTION */
 
 static void
-x_reply_selection_request (event, format, data, size, type)
-     struct input_event *event;
-     int format, size;
-     unsigned char *data;
-     Atom type;
+x_reply_selection_request (struct input_event *event, int format, unsigned char *data, int size, Atom type)
 {
   XSelectionEvent reply;
   Display *display = SELECTION_EVENT_DISPLAY (event);
@@ -881,8 +862,7 @@ x_reply_selection_request (event, format, data, size, type)
    This is called from keyboard.c when such an event is found in the queue.  */
 
 static void
-x_handle_selection_request (event)
-     struct input_event *event;
+x_handle_selection_request (struct input_event *event)
 {
   struct gcpro gcpro1, gcpro2, gcpro3;
   Lisp_Object local_selection_data;
@@ -1002,8 +982,7 @@ x_handle_selection_request (event)
    This is called from keyboard.c when such an event is found in the queue.  */
 
 static void
-x_handle_selection_clear (event)
-     struct input_event *event;
+x_handle_selection_clear (struct input_event *event)
 {
   Display *display = SELECTION_EVENT_DISPLAY (event);
   Atom selection = SELECTION_EVENT_SELECTION (event);
@@ -1034,7 +1013,7 @@ x_handle_selection_clear (event)
          }
       }
   UNBLOCK_INPUT;
-  
+
   selection_symbol = x_atom_to_symbol (display, selection);
 
   local_selection_data = assq_no_quit (selection_symbol, Vselection_alist);
@@ -1085,8 +1064,7 @@ x_handle_selection_clear (event)
 }
 
 void
-x_handle_selection_event (event)
-     struct input_event *event;
+x_handle_selection_event (struct input_event *event)
 {
   TRACE0 ("x_handle_selection_event");
 
@@ -1106,8 +1084,7 @@ x_handle_selection_event (event)
    We do this when about to delete a frame.  */
 
 void
-x_clear_frame_selections (f)
-     FRAME_PTR f;
+x_clear_frame_selections (FRAME_PTR f)
 {
   Lisp_Object frame;
   Lisp_Object rest;
@@ -1168,9 +1145,7 @@ x_clear_frame_selections (f)
    are on the list of what we are waiting for.  */
 
 static int
-waiting_for_other_props_on_window (display, window)
-     Display *display;
-     Window window;
+waiting_for_other_props_on_window (Display *display, Window window)
 {
   struct prop_location *rest = property_change_wait_list;
   while (rest)
@@ -1187,11 +1162,7 @@ waiting_for_other_props_on_window (display, window)
    this awaited property change.  */
 
 static struct prop_location *
-expect_property_change (display, window, property, state)
-     Display *display;
-     Window window;
-     Atom property;
-     int state;
+expect_property_change (Display *display, Window window, Atom property, int state)
 {
   struct prop_location *pl = (struct prop_location *) xmalloc (sizeof *pl);
   pl->identifier = ++prop_location_identifier;
@@ -1209,8 +1180,7 @@ expect_property_change (display, window, property, state)
    IDENTIFIER is the number that uniquely identifies the entry.  */
 
 static void
-unexpect_property_change (location)
-     struct prop_location *location;
+unexpect_property_change (struct prop_location *location)
 {
   struct prop_location *prev = 0, *rest = property_change_wait_list;
   while (rest)
@@ -1232,8 +1202,7 @@ unexpect_property_change (location)
 /* Remove the property change expectation element for IDENTIFIER.  */
 
 static Lisp_Object
-wait_for_property_change_unwind (loc)
-     Lisp_Object loc;
+wait_for_property_change_unwind (Lisp_Object loc)
 {
   struct prop_location *location = XSAVE_VALUE (loc)->pointer;
 
@@ -1247,8 +1216,7 @@ wait_for_property_change_unwind (loc)
    IDENTIFIER should be the value that expect_property_change returned.  */
 
 static void
-wait_for_property_change (location)
-     struct prop_location *location;
+wait_for_property_change (struct prop_location *location)
 {
   int secs, usecs;
   int count = SPECPDL_INDEX ();
@@ -1286,8 +1254,7 @@ wait_for_property_change (location)
 /* Called from XTread_socket in response to a PropertyNotify event.  */
 
 void
-x_handle_property_notify (event)
-     XPropertyEvent *event;
+x_handle_property_notify (XPropertyEvent *event)
 {
   struct prop_location *prev = 0, *rest = property_change_wait_list;
 
@@ -1378,8 +1345,7 @@ static Window reading_selection_window;
    Converts this to Lisp data and returns it.  */
 
 static Lisp_Object
-x_get_foreign_selection (selection_symbol, target_type, time_stamp)
-     Lisp_Object selection_symbol, target_type, time_stamp;
+x_get_foreign_selection (Lisp_Object selection_symbol, Lisp_Object target_type, Lisp_Object time_stamp)
 {
   struct frame *sf = SELECTED_FRAME ();
   Window requestor_window;
@@ -1486,18 +1452,10 @@ x_get_foreign_selection (selection_symbol, target_type, time_stamp)
 /* Use xfree, not XFree, to free the data obtained with this function.  */
 
 static void
-x_get_window_property (display, window, property, data_ret, bytes_ret,
-                      actual_type_ret, actual_format_ret, actual_size_ret,
-                      delete_p)
-     Display *display;
-     Window window;
-     Atom property;
-     unsigned char **data_ret;
-     int *bytes_ret;
-     Atom *actual_type_ret;
-     int *actual_format_ret;
-     unsigned long *actual_size_ret;
-     int delete_p;
+x_get_window_property (Display *display, Window window, Atom property,
+                      unsigned char **data_ret, int *bytes_ret,
+                      Atom *actual_type_ret, int *actual_format_ret,
+                      unsigned long *actual_size_ret, int delete_p)
 {
   int total_size;
   unsigned long bytes_remaining;
@@ -1567,7 +1525,7 @@ x_get_window_property (display, window, property, data_ret, bytes_ret,
           elements."
          This applies even if long is more than 32 bits, the X library
          converts from 32 bit elements received from the X server to long
-         and passes the long array to us.  Thus, for that case bcopy can not
+         and passes the long array to us.  Thus, for that case memcpy can not
          be used.  We convert to a 32 bit type here, because so much code
          assume on that.
 
@@ -1589,7 +1547,7 @@ x_get_window_property (display, window, property, data_ret, bytes_ret,
       else
         {
           *actual_size_ret *= *actual_format_ret / 8;
-          bcopy (tmp_data, (*data_ret) + offset, *actual_size_ret);
+          memcpy ((*data_ret) + offset, tmp_data, *actual_size_ret);
           offset += *actual_size_ret;
         }
 
@@ -1605,19 +1563,12 @@ x_get_window_property (display, window, property, data_ret, bytes_ret,
 /* Use xfree, not XFree, to free the data obtained with this function.  */
 
 static void
-receive_incremental_selection (display, window, property, target_type,
-                              min_size_bytes, data_ret, size_bytes_ret,
-                              type_ret, format_ret, size_ret)
-     Display *display;
-     Window window;
-     Atom property;
-     Lisp_Object target_type; /* for error messages only */
-     unsigned int min_size_bytes;
-     unsigned char **data_ret;
-     int *size_bytes_ret;
-     Atom *type_ret;
-     unsigned long *size_ret;
-     int *format_ret;
+receive_incremental_selection (Display *display, Window window, Atom property,
+                              Lisp_Object target_type,
+                              unsigned int min_size_bytes,
+                              unsigned char **data_ret, int *size_bytes_ret,
+                              Atom *type_ret, int *format_ret,
+                              unsigned long *size_ret)
 {
   int offset = 0;
   struct prop_location *wait_object;
@@ -1691,7 +1642,7 @@ receive_incremental_selection (display, window, property, target_type,
          *data_ret = (unsigned char *) xrealloc (*data_ret, *size_bytes_ret);
        }
 
-      bcopy (tmp_data, (*data_ret) + offset, tmp_size_bytes);
+      memcpy ((*data_ret) + offset, tmp_data, tmp_size_bytes);
       offset += tmp_size_bytes;
 
       /* Use xfree, not XFree, because x_get_window_property
@@ -1706,13 +1657,10 @@ receive_incremental_selection (display, window, property, target_type,
    TARGET_TYPE and SELECTION_ATOM are used in error message if this fails.  */
 
 static Lisp_Object
-x_get_window_property_as_lisp_data (display, window, property, target_type,
-                                   selection_atom)
-     Display *display;
-     Window window;
-     Atom property;
-     Lisp_Object target_type;  /* for error messages only */
-     Atom selection_atom;      /* for error messages only */
+x_get_window_property_as_lisp_data (Display *display, Window window,
+                                   Atom property,
+                                   Lisp_Object target_type,
+                                   Atom selection_atom)
 {
   Atom actual_type;
   int actual_format;
@@ -1809,11 +1757,8 @@ x_get_window_property_as_lisp_data (display, window, property, target_type,
 
 
 static Lisp_Object
-selection_data_to_lisp_data (display, data, size, type, format)
-     Display *display;
-     unsigned char *data;
-     Atom type;
-     int size, format;
+selection_data_to_lisp_data (Display *display, const unsigned char *data,
+                            int size, Atom type, int format)
 {
   struct x_display_info *dpyinfo = x_display_info_for_display (display);
 
@@ -1906,16 +1851,10 @@ selection_data_to_lisp_data (display, data, size, type, format)
 /* Use xfree, not XFree, to free the data obtained with this function.  */
 
 static void
-lisp_data_to_selection_data (display, obj,
-                            data_ret, type_ret, size_ret,
-                            format_ret, nofree_ret)
-     Display *display;
-     Lisp_Object obj;
-     unsigned char **data_ret;
-     Atom *type_ret;
-     unsigned int *size_ret;
-     int *format_ret;
-     int *nofree_ret;
+lisp_data_to_selection_data (Display *display, Lisp_Object obj,
+                            unsigned char **data_ret, Atom *type_ret,
+                            unsigned int *size_ret,
+                            int *format_ret, int *nofree_ret)
 {
   Lisp_Object type = Qnil;
   struct x_display_info *dpyinfo = x_display_info_for_display (display);
@@ -2071,8 +2010,7 @@ lisp_data_to_selection_data (display, obj,
 }
 
 static Lisp_Object
-clean_local_selection_data (obj)
-     Lisp_Object obj;
+clean_local_selection_data (Lisp_Object obj)
 {
   if (CONSP (obj)
       && INTEGERP (XCAR (obj))
@@ -2112,8 +2050,7 @@ clean_local_selection_data (obj)
    We store t there if the reply is successful, lambda if not.  */
 
 void
-x_handle_selection_notify (event)
-     XSelectionEvent *event;
+x_handle_selection_notify (XSelectionEvent *event)
 {
   if (event->requestor != reading_selection_window)
     return;
@@ -2133,8 +2070,7 @@ TYPE is a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD'.
 \(Those are literal upper-case symbol names, since that's what X expects.)
 VALUE is typically a string, or a cons of two markers, but may be
 anything that the functions on `selection-converter-alist' know about.  */)
-     (selection_name, selection_value)
-     Lisp_Object selection_name, selection_value;
+  (Lisp_Object selection_name, Lisp_Object selection_value)
 {
   check_x ();
   CHECK_SYMBOL (selection_name);
@@ -2156,8 +2092,7 @@ SELECTION is a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD'.
 TYPE is the type of data desired, typically `STRING'.
 TIME_STAMP is the time to use in the XConvertSelection call for foreign
 selections.  If omitted, defaults to the time for the last event.  */)
-  (selection_symbol, target_type, time_stamp)
-     Lisp_Object selection_symbol, target_type, time_stamp;
+  (Lisp_Object selection_symbol, Lisp_Object target_type, Lisp_Object time_stamp)
 {
   Lisp_Object val = Qnil;
   struct gcpro gcpro1, gcpro2;
@@ -2202,9 +2137,7 @@ DEFUN ("x-disown-selection-internal", Fx_disown_selection_internal,
        Sx_disown_selection_internal, 1, 2, 0,
        doc: /* If we own the selection SELECTION, disown it.
 Disowning it means there is no such selection.  */)
-     (selection, time)
-     Lisp_Object selection;
-     Lisp_Object time;
+  (Lisp_Object selection, Lisp_Object time)
 {
   Time timestamp;
   Atom selection_atom;
@@ -2254,8 +2187,7 @@ Disowning it means there is no such selection.  */)
    This is used when we kill a buffer.  */
 
 void
-x_disown_buffer_selections (buffer)
-     Lisp_Object buffer;
+x_disown_buffer_selections (Lisp_Object buffer)
 {
   Lisp_Object tail;
   struct buffer *buf = XBUFFER (buffer);
@@ -2279,8 +2211,7 @@ the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'.
 \(Those are literal upper-case symbol names, since that's what X expects.)
 For convenience, the symbol nil is the same as `PRIMARY',
 and t is the same as `SECONDARY'.  */)
-     (selection)
-     Lisp_Object selection;
+  (Lisp_Object selection)
 {
   check_x ();
   CHECK_SYMBOL (selection);
@@ -2300,8 +2231,7 @@ the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'.
 \(Those are literal upper-case symbol names, since that's what X expects.)
 For convenience, the symbol nil is the same as `PRIMARY',
 and t is the same as `SECONDARY'.  */)
-     (selection)
-     Lisp_Object selection;
+  (Lisp_Object selection)
 {
   Window owner;
   Atom atom;
@@ -2332,9 +2262,7 @@ and t is the same as `SECONDARY'.  */)
 
 /* Ensure that all 8 cut buffers exist.  ICCCM says we gotta...  */
 static void
-initialize_cut_buffers (display, window)
-     Display *display;
-     Window window;
+initialize_cut_buffers (Display *display, Window window)
 {
   unsigned char *data = (unsigned char *) "";
   BLOCK_INPUT;
@@ -2365,8 +2293,7 @@ initialize_cut_buffers (display, window)
 DEFUN ("x-get-cut-buffer-internal", Fx_get_cut_buffer_internal,
        Sx_get_cut_buffer_internal, 1, 1, 0,
        doc: /* Returns the value of the named cut buffer (typically CUT_BUFFER0).  */)
-     (buffer)
-     Lisp_Object buffer;
+  (Lisp_Object buffer)
 {
   Window window;
   Atom buffer_atom;
@@ -2416,8 +2343,7 @@ DEFUN ("x-get-cut-buffer-internal", Fx_get_cut_buffer_internal,
 DEFUN ("x-store-cut-buffer-internal", Fx_store_cut_buffer_internal,
        Sx_store_cut_buffer_internal, 2, 2, 0,
        doc: /* Sets the value of the named cut buffer (typically CUT_BUFFER0).  */)
-     (buffer, string)
-     Lisp_Object buffer, string;
+  (Lisp_Object buffer, Lisp_Object string)
 {
   Window window;
   Atom buffer_atom;
@@ -2482,14 +2408,13 @@ DEFUN ("x-rotate-cut-buffers-internal", Fx_rotate_cut_buffers_internal,
        Sx_rotate_cut_buffers_internal, 1, 1, 0,
        doc: /* Rotate the values of the cut buffers by N steps.
 Positive N means shift the values forward, negative means backward.  */)
-     (n)
-     Lisp_Object n;
+  (Lisp_Object n)
 {
   Window window;
   Atom props[8];
   Display *display;
   struct frame *sf = SELECTED_FRAME ();
-  
+
   check_x ();
 
   if (! FRAME_X_P (sf))
@@ -2530,8 +2455,7 @@ Positive N means shift the values forward, negative means backward.  */)
    bit parts of a 32 bit number).  */
 
 int
-x_check_property_data (data)
-     Lisp_Object data;
+x_check_property_data (Lisp_Object data)
 {
   Lisp_Object iter;
   int size = 0;
@@ -2564,11 +2488,7 @@ x_check_property_data (data)
    XClientMessageEvent).  */
 
 void
-x_fill_property_data (dpy, data, ret, format)
-     Display *dpy;
-     Lisp_Object data;
-     void *ret;
-     int format;
+x_fill_property_data (Display *dpy, Lisp_Object data, void *ret, int format)
 {
   long val;
   long  *d32 = (long  *) ret;
@@ -2620,12 +2540,8 @@ x_fill_property_data (dpy, data, ret, format)
    Also see comment for selection_data_to_lisp_data above.  */
 
 Lisp_Object
-x_property_data_to_lisp (f, data, type, format, size)
-     struct frame *f;
-     unsigned char *data;
-     Atom type;
-     int format;
-     unsigned long size;
+x_property_data_to_lisp (struct frame *f, const unsigned char *data,
+                        Atom type, int format, long unsigned int size)
 {
   return selection_data_to_lisp_data (FRAME_X_DISPLAY (f),
                                       data, size*format/8, type, format);
@@ -2634,10 +2550,7 @@ x_property_data_to_lisp (f, data, type, format, size)
 /* Get the mouse position in frame relative coordinates.  */
 
 static void
-mouse_position_for_drop (f, x, y)
-     FRAME_PTR f;
-     int *x;
-     int *y;
+mouse_position_for_drop (FRAME_PTR f, int *x, int *y)
 {
   Window root, dummy_window;
   int dummy;
@@ -2679,11 +2592,11 @@ the cdr is the lower 16 bits of a 32 bit value.
 Use the display for FRAME or the current frame if FRAME is not given or nil.
 
 If the value is 0 or the atom is not known, return the empty string.  */)
-  (value, frame)
-     Lisp_Object value, frame;
+  (Lisp_Object value, Lisp_Object frame)
 {
   struct frame *f = check_x_frame (frame);
   char *name = 0;
+  char empty[] = "";
   Lisp_Object ret = Qnil;
   Display *dpy = FRAME_X_DISPLAY (f);
   Atom atom;
@@ -2700,7 +2613,7 @@ If the value is 0 or the atom is not known, return the empty string.  */)
 
   BLOCK_INPUT;
   x_catch_errors (dpy);
-  name = atom ? XGetAtomName (dpy, atom) : "";
+  name = atom ? XGetAtomName (dpy, atom) : empty;
   had_errors = x_had_errors_p (dpy);
   x_uncatch_errors ();
 
@@ -2720,8 +2633,7 @@ DEFUN ("x-register-dnd-atom", Fx_register_dnd_atom,
        doc: /* Request that dnd events are made for ClientMessages with ATOM.
 ATOM can be a symbol or a string.  The ATOM is interned on the display that
 FRAME is on.  If FRAME is nil, the selected frame is used.  */)
-    (atom, frame)
-    Lisp_Object atom, frame;
+  (Lisp_Object atom, Lisp_Object frame)
 {
   Atom x_atom;
   struct frame *f = check_x_frame (frame);
@@ -2759,11 +2671,7 @@ FRAME is on.  If FRAME is nil, the selected frame is used.  */)
 /* Convert an XClientMessageEvent to a Lisp event of type DRAG_N_DROP_EVENT.  */
 
 int
-x_handle_dnd_message (f, event, dpyinfo, bufp)
-     struct frame *f;
-     XClientMessageEvent *event;
-     struct x_display_info *dpyinfo;
-     struct input_event *bufp;
+x_handle_dnd_message (struct frame *f, XClientMessageEvent *event, struct x_display_info *dpyinfo, struct input_event *bufp)
 {
   Lisp_Object vec;
   Lisp_Object frame;
@@ -2842,8 +2750,7 @@ the Atom is sent.  If a value is a cons, it is converted to a 32 bit number
 with the high 16 bits from the car and the lower 16 bit from the cdr.
 If more values than fits into the event is given, the excessive values
 are ignored.  */)
-     (display, dest, from, message_type, format, values)
-     Lisp_Object display, dest, from, message_type, format, values;
+  (Lisp_Object display, Lisp_Object dest, Lisp_Object from, Lisp_Object message_type, Lisp_Object format, Lisp_Object values)
 {
   struct x_display_info *dpyinfo = check_x_display_info (display);
   Window wdest;
@@ -2935,7 +2842,7 @@ are ignored.  */)
 
 \f
 void
-syms_of_xselect ()
+syms_of_xselect (void)
 {
   defsubr (&Sx_get_selection_internal);
   defsubr (&Sx_own_selection_internal);
@@ -3010,7 +2917,7 @@ A value of 0 means wait as long as necessary.  This is initialized from the
 \"*selectionTimeout\" resource.  */);
   x_selection_timeout = 0;
 
-  QPRIMARY   = intern_c_string ("PRIMARY");    staticpro (&QPRIMARY);
+  /* QPRIMARY is defined in keyboard.c.  */
   QSECONDARY = intern_c_string ("SECONDARY");  staticpro (&QSECONDARY);
   QSTRING    = intern_c_string ("STRING");     staticpro (&QSTRING);
   QINTEGER   = intern_c_string ("INTEGER");    staticpro (&QINTEGER);
index 945007db2f06229fd24d2e379f173c5fd36f9a3e..0d9c9cadb27dbcaca7ab11c7f70c1d3fb1fea0d2 100644 (file)
@@ -1,4 +1,4 @@
-/* Functions for handle font changes dynamically.
+/* Functions for handle font and other changes dynamically.
    Copyright (C) 2009, 2010
                  Free Software Foundation, Inc.
 
@@ -17,7 +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/>.  */
 
-#include "config.h"
+#include <config.h>
+#include <limits.h>
 #include <setjmp.h>
 #include <fcntl.h>
 #include "lisp.h"
@@ -39,11 +40,13 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #endif
 
 static char *current_mono_font;
+static char *current_font;
 static struct x_display_info *first_dpyinfo;
-static Lisp_Object Qfont_name, Qfont_render;
+static Lisp_Object Qmonospace_font_name, Qfont_name, Qfont_render,
+  Qtool_bar_style;
 static int use_system_font;
 static Lisp_Object Vxft_settings;
-
+static Lisp_Object current_tool_bar_style;
 
 #ifdef HAVE_GCONF
 static GConfClient *gconf_client;
@@ -51,9 +54,7 @@ static GConfClient *gconf_client;
 
 
 static void
-store_font_changed_event (arg, display_name)
-     Lisp_Object arg;
-     Lisp_Object display_name;
+store_config_changed_event (Lisp_Object arg, Lisp_Object display_name)
 {
   struct input_event event;
   EVENT_INIT (event);
@@ -63,19 +64,46 @@ store_font_changed_event (arg, display_name)
   kbd_buffer_store_event (&event);
 }
 
+#define XSETTINGS_FONT_NAME       "Gtk/FontName"
+#define XSETTINGS_TOOL_BAR_STYLE  "Gtk/ToolbarStyle"
+
+enum {
+  SEEN_AA         = 0x01,
+  SEEN_HINTING    = 0x02,
+  SEEN_RGBA       = 0x04,
+  SEEN_LCDFILTER  = 0x08,
+  SEEN_HINTSTYLE  = 0x10,
+  SEEN_DPI        = 0x20,
+  SEEN_FONT       = 0x40,
+  SEEN_TB_STYLE   = 0x80,
+};
+struct xsettings 
+{
+#ifdef HAVE_XFT
+  FcBool aa, hinting;
+  int rgba, lcdfilter, hintstyle;
+  double dpi;
+#endif
+
+  char *font;
+  char *tb_style;
+
+  unsigned seen;
+};
+
 #ifdef HAVE_GCONF
 
-#define SYSTEM_MONO_FONT       "/desktop/gnome/interface/monospace_font_name"
+#define SYSTEM_MONO_FONT     "/desktop/gnome/interface/monospace_font_name"
+#define SYSTEM_FONT          "/desktop/gnome/interface/font_name"
 
 /* Callback called when something changed in GConf that we care about,
    that is SYSTEM_MONO_FONT.  */
 
 static void
-something_changedCB (client, cnxn_id, entry, user_data)
-     GConfClient *client;
-     guint cnxn_id;
-     GConfEntry *entry;
-     gpointer user_data;
+something_changedCB (GConfClient *client,
+                     guint cnxn_id,
+                     GConfEntry *entry,
+                     gpointer user_data)
 {
   GConfValue *v = gconf_entry_get_value (entry);
   
@@ -83,7 +111,6 @@ something_changedCB (client, cnxn_id, entry, user_data)
   if (v->type == GCONF_VALUE_STRING)
     {
       const char *value = gconf_value_get_string (v);
-      int i;
       if (current_mono_font != NULL && strcmp (value, current_mono_font) == 0)
         return; /* No change. */
 
@@ -101,8 +128,8 @@ something_changedCB (client, cnxn_id, entry, user_data)
         found = dpyinfo == first_dpyinfo;
 
       if (found && use_system_font)
-        store_font_changed_event (Qfont_name,
-                                  XCAR (first_dpyinfo->name_list_element));
+        store_config_changed_event (Qmonospace_font_name,
+                                    XCAR (first_dpyinfo->name_list_element));
     }
 }
 #endif /* HAVE_GCONF */
@@ -120,11 +147,12 @@ something_changedCB (client, cnxn_id, entry, user_data)
 #define FC_LCD_FILTER "lcdfilter"
 #endif
 
+#endif /* HAVE_XFT */
+
 /* Find the window that contains the XSETTINGS property values.  */
 
 static void
-get_prop_window (dpyinfo)
-     struct x_display_info *dpyinfo;
+get_prop_window (struct x_display_info *dpyinfo)
 {
   Display *dpy = dpyinfo->display;
 
@@ -140,23 +168,6 @@ get_prop_window (dpyinfo)
   XUngrabServer (dpy);
 }
 
-enum {
-  SEEN_AA         = 0x01,
-  SEEN_HINTING    = 0x02,
-  SEEN_RGBA       = 0x04,
-  SEEN_LCDFILTER  = 0x08,
-  SEEN_HINTSTYLE  = 0x10,
-  SEEN_DPI        = 0x20,
-};
-struct xsettings 
-{
-  FcBool aa, hinting;
-  int rgba, lcdfilter, hintstyle;
-  double dpi;
-
-  unsigned seen;
-};
-
 #define SWAP32(nr) (((nr) << 24) | (((nr) << 8) & 0xff0000)     \
                     | (((nr) >> 8) & 0xff00) | ((nr) >> 24))
 #define SWAP16(nr) (((nr) << 8) | ((nr) >> 8))
@@ -213,10 +224,9 @@ struct xsettings
 */
 
 static int
-parse_xft_settings (prop, bytes, settings)
-     unsigned char *prop;
-     unsigned long bytes;
-     struct xsettings *settings;
+parse_settings (unsigned char *prop,
+                long unsigned int bytes,
+                struct xsettings *settings)
 {
   Lisp_Object byteorder = Fbyteorder ();
   int my_bo = XFASTINT (byteorder) == 'B' ? MSBFirst : LSBFirst;
@@ -235,7 +245,7 @@ parse_xft_settings (prop, bytes, settings)
 
   memset (settings, 0, sizeof (*settings));
 
-  while (bytes_parsed+4 < bytes && settings_seen < 6
+  while (bytes_parsed+4 < bytes && settings_seen < 7
          && i < n_settings)
     {
       int type = prop[bytes_parsed++];
@@ -243,7 +253,7 @@ parse_xft_settings (prop, bytes, settings)
       CARD32 vlen, ival = 0;
       char name[128]; /* The names we are looking for are not this long.  */
       char sval[128]; /* The values we are looking for are not this long.  */
-      int is_xft;
+      int want_this;
       int to_cpy;
 
       sval[0] = '\0';
@@ -264,13 +274,19 @@ parse_xft_settings (prop, bytes, settings)
       bytes_parsed += 4; /* Skip serial for this value */
       if (bytes_parsed > bytes) return BadLength;
 
-      is_xft = nlen > 6 && strncmp (name, "Xft/", 4) == 0;
+      want_this =
+#ifdef HAVE_XFT
+        (nlen > 6 && strncmp (name, "Xft/", 4) == 0)
+        ||
+#endif
+        (strcmp (XSETTINGS_FONT_NAME, name) == 0)
+        || (strcmp (XSETTINGS_TOOL_BAR_STYLE, name) == 0);
 
       switch (type) 
         {
         case 0: /* Integer */
           if (bytes_parsed+4 > bytes) return BadLength;
-          if (is_xft)
+          if (want_this)
             {
               memcpy (&ival, prop+bytes_parsed, 4);
               if (my_bo != that_bo) ival = SWAP32 (ival);
@@ -283,7 +299,7 @@ parse_xft_settings (prop, bytes, settings)
           memcpy (&vlen, prop+bytes_parsed, 4);
           bytes_parsed += 4;
           if (my_bo != that_bo) vlen = SWAP32 (vlen);
-          if (is_xft)
+          if (want_this)
             {
               to_cpy = vlen > 127 ? 127 : vlen;
               memcpy (sval, prop+bytes_parsed, to_cpy);
@@ -303,10 +319,21 @@ parse_xft_settings (prop, bytes, settings)
           return BadValue;
         }
 
-      if (is_xft
+      if (want_this
         {
           ++settings_seen;
-          if (strcmp (name, "Xft/Antialias") == 0)
+          if (strcmp (name, XSETTINGS_FONT_NAME) == 0)
+            {
+              settings->font = xstrdup (sval);
+              settings->seen |= SEEN_FONT;
+            }
+          else if (strcmp (name, XSETTINGS_TOOL_BAR_STYLE) == 0)
+            {
+              settings->tb_style = xstrdup (sval);
+              settings->seen |= SEEN_TB_STYLE;
+            }
+#ifdef HAVE_XFT
+          else if (strcmp (name, "Xft/Antialias") == 0)
             {
               settings->seen |= SEEN_AA;
               settings->aa = ival != 0;
@@ -361,6 +388,7 @@ parse_xft_settings (prop, bytes, settings)
               else
                 settings->seen &= ~SEEN_LCDFILTER;
             }
+#endif /* HAVE_XFT */
         }
     }
 
@@ -368,11 +396,8 @@ parse_xft_settings (prop, bytes, settings)
 }
 
 static int
-read_xft_settings (dpyinfo, settings)
-     struct x_display_info *dpyinfo;
-     struct xsettings *settings;
+read_settings (struct x_display_info *dpyinfo, struct xsettings *settings)
 {
-  long long_len;
   Atom act_type;
   int act_form;
   unsigned long nitems, bytes_after;
@@ -390,7 +415,7 @@ read_xft_settings (dpyinfo, settings)
 
   if (rc == Success && prop != NULL && act_form == 8 && nitems > 0
       && act_type == dpyinfo->Xatom_xsettings_prop)
-    rc = parse_xft_settings (prop, nitems, settings);
+    rc = parse_settings (prop, nitems, settings);
 
   XFree (prop);
 
@@ -401,18 +426,16 @@ read_xft_settings (dpyinfo, settings)
 
 
 static void
-apply_xft_settings (dpyinfo, send_event_p)
-     struct x_display_info *dpyinfo;
-     int send_event_p;
+apply_xft_settings (struct x_display_info *dpyinfo,
+                    int send_event_p,
+                    struct xsettings *settings)
 {
+#ifdef HAVE_XFT
   FcPattern *pat;
-  struct xsettings settings, oldsettings;
+  struct xsettings oldsettings;
   int changed = 0;
   char buf[256];
 
-  if (!read_xft_settings (dpyinfo, &settings))
-    return;
-
   memset (&oldsettings, 0, sizeof (oldsettings));
   buf[0] = '\0';
   pat = FcPatternCreate ();
@@ -426,74 +449,74 @@ apply_xft_settings (dpyinfo, send_event_p)
   FcPatternGetInteger (pat, FC_RGBA, 0, &oldsettings.rgba);
   FcPatternGetDouble (pat, FC_DPI, 0, &oldsettings.dpi);
 
-  if ((settings.seen & SEEN_AA) != 0 && oldsettings.aa != settings.aa)
+  if ((settings->seen & SEEN_AA) != 0 && oldsettings.aa != settings->aa)
     {
       FcPatternDel (pat, FC_ANTIALIAS);
-      FcPatternAddBool (pat, FC_ANTIALIAS, settings.aa);
+      FcPatternAddBool (pat, FC_ANTIALIAS, settings->aa);
       ++changed;
-      oldsettings.aa = settings.aa;
+      oldsettings.aa = settings->aa;
     }
   sprintf (buf, "Antialias: %d", oldsettings.aa);
 
-  if ((settings.seen & SEEN_HINTING) != 0
-      && oldsettings.hinting != settings.hinting)
+  if ((settings->seen & SEEN_HINTING) != 0
+      && oldsettings.hinting != settings->hinting)
     {
       FcPatternDel (pat, FC_HINTING);
-      FcPatternAddBool (pat, FC_HINTING, settings.hinting);
+      FcPatternAddBool (pat, FC_HINTING, settings->hinting);
       ++changed;
-      oldsettings.hinting = settings.hinting;
+      oldsettings.hinting = settings->hinting;
     }
   if (strlen (buf) > 0) strcat (buf, ", ");
   sprintf (buf+strlen (buf), "Hinting: %d", oldsettings.hinting);
-  if ((settings.seen & SEEN_RGBA) != 0 && oldsettings.rgba != settings.rgba)
+  if ((settings->seen & SEEN_RGBA) != 0 && oldsettings.rgba != settings->rgba)
     {
       FcPatternDel (pat, FC_RGBA);
-      FcPatternAddInteger (pat, FC_RGBA, settings.rgba);
-      oldsettings.rgba = settings.rgba;
+      FcPatternAddInteger (pat, FC_RGBA, settings->rgba);
+      oldsettings.rgba = settings->rgba;
       ++changed;
     }
   if (strlen (buf) > 0) strcat (buf, ", ");
   sprintf (buf+strlen (buf), "RGBA: %d", oldsettings.rgba);
 
   /* Older fontconfig versions don't have FC_LCD_FILTER. */
-  if ((settings.seen & SEEN_LCDFILTER) != 0
-      && oldsettings.lcdfilter != settings.lcdfilter)
+  if ((settings->seen & SEEN_LCDFILTER) != 0
+      && oldsettings.lcdfilter != settings->lcdfilter)
     {
       FcPatternDel (pat, FC_LCD_FILTER);
-      FcPatternAddInteger (pat, FC_LCD_FILTER, settings.lcdfilter);
+      FcPatternAddInteger (pat, FC_LCD_FILTER, settings->lcdfilter);
       ++changed;
-      oldsettings.lcdfilter = settings.lcdfilter;
+      oldsettings.lcdfilter = settings->lcdfilter;
     }
   if (strlen (buf) > 0) strcat (buf, ", ");
   sprintf (buf+strlen (buf), "LCDFilter: %d", oldsettings.lcdfilter);
 
-  if ((settings.seen & SEEN_HINTSTYLE) != 0
-      && oldsettings.hintstyle != settings.hintstyle)
+  if ((settings->seen & SEEN_HINTSTYLE) != 0
+      && oldsettings.hintstyle != settings->hintstyle)
     {
       FcPatternDel (pat, FC_HINT_STYLE);
-      FcPatternAddInteger (pat, FC_HINT_STYLE, settings.hintstyle);
+      FcPatternAddInteger (pat, FC_HINT_STYLE, settings->hintstyle);
       ++changed;
-      oldsettings.hintstyle = settings.hintstyle;
+      oldsettings.hintstyle = settings->hintstyle;
     }
   if (strlen (buf) > 0) strcat (buf, ", ");
   sprintf (buf+strlen (buf), "Hintstyle: %d", oldsettings.hintstyle);
 
-  if ((settings.seen & SEEN_DPI) != 0 && oldsettings.dpi != settings.dpi
-      && settings.dpi > 0)
+  if ((settings->seen & SEEN_DPI) != 0 && oldsettings.dpi != settings->dpi
+      && settings->dpi > 0)
     {
       Lisp_Object frame, tail;
 
       FcPatternDel (pat, FC_DPI);
-      FcPatternAddDouble (pat, FC_DPI, settings.dpi);
+      FcPatternAddDouble (pat, FC_DPI, settings->dpi);
       ++changed;
-      oldsettings.dpi = settings.dpi;
+      oldsettings.dpi = settings->dpi;
       
       /* Change the DPI on this display and all frames on the display.  */
-      dpyinfo->resy = dpyinfo->resx = settings.dpi;
+      dpyinfo->resy = dpyinfo->resx = settings->dpi;
       FOR_EACH_FRAME (tail, frame)
         if (FRAME_X_P (XFRAME (frame))
             && FRAME_X_DISPLAY_INFO (XFRAME (frame)) == dpyinfo)
-          XFRAME (frame)->resy = XFRAME (frame)->resx = settings.dpi;
+          XFRAME (frame)->resy = XFRAME (frame)->resx = settings->dpi;
     }
 
   if (strlen (buf) > 0) strcat (buf, ", ");
@@ -503,23 +526,64 @@ apply_xft_settings (dpyinfo, send_event_p)
     {
       XftDefaultSet (dpyinfo->display, pat);
       if (send_event_p)
-        store_font_changed_event (Qfont_render,
-                                  XCAR (dpyinfo->name_list_element));
+        store_config_changed_event (Qfont_render,
+                                    XCAR (dpyinfo->name_list_element));
       Vxft_settings = make_string (buf, strlen (buf));
     }
   else
     FcPatternDestroy (pat);
+#endif /* HAVE_XFT */
 }
 
-#endif /* HAVE_XFT */
+static void
+read_and_apply_settings (struct x_display_info *dpyinfo, int send_event_p)
+{
+  struct xsettings settings;
+  Lisp_Object dpyname = XCAR (dpyinfo->name_list_element);
+
+  if (!read_settings (dpyinfo, &settings))
+    return;
+
+  apply_xft_settings (dpyinfo, True, &settings);
+  if (settings.seen & SEEN_TB_STYLE)
+    {
+      Lisp_Object style = Qnil;
+      if (strcmp (settings.tb_style, "both") == 0)
+        style = Qboth;
+      else if (strcmp (settings.tb_style, "both-horiz") == 0)
+        style = Qboth_horiz;
+      else if (strcmp (settings.tb_style, "icons") == 0)
+        style = Qimage;
+      else if (strcmp (settings.tb_style, "text") == 0)
+        style = Qtext;
+      if (!NILP (style) && !EQ (style, current_tool_bar_style))
+        {
+          current_tool_bar_style = style;
+          if (send_event_p)
+            store_config_changed_event (Qtool_bar_style, dpyname);
+        }
+      free (settings.tb_style);
+    }
+
+  if (settings.seen & SEEN_FONT)
+    {
+      if (!current_font || strcmp (current_font, settings.font) != 0) 
+        {
+          free (current_font);
+          current_font = settings.font;
+          if (send_event_p)
+            store_config_changed_event (Qfont_name, dpyname);
+        }
+      else
+        free (settings.font);
+    }
+}
 
 void
-xft_settings_event (dpyinfo, event)
-     struct x_display_info *dpyinfo;
-     XEvent *event;
+xft_settings_event (struct x_display_info *dpyinfo, XEvent *event)
 {
-#ifdef HAVE_XFT
   int check_window_p = 0;
+  int apply_settings = 0;
 
   switch (event->type)
     {
@@ -539,28 +603,28 @@ xft_settings_event (dpyinfo, event)
       if (event->xproperty.window == dpyinfo->xsettings_window
           && event->xproperty.state == PropertyNewValue
           && event->xproperty.atom == dpyinfo->Xatom_xsettings_prop)
-        {
-          apply_xft_settings (dpyinfo, True);
-        }
+        apply_settings = 1;
       break;
     }
 
+
   if (check_window_p)
     {
       dpyinfo->xsettings_window = None;
       get_prop_window (dpyinfo);
       if (dpyinfo->xsettings_window != None)
-        apply_xft_settings (dpyinfo, True);
+        apply_settings = 1;
     }
-#endif /* HAVE_XFT */
+
+  if (apply_settings)
+    read_and_apply_settings (dpyinfo, True);
 }
 
 
 static void
-init_gconf ()
+init_gconf (void)
 {
 #if defined (HAVE_GCONF) && defined (HAVE_XFT)
-  int i;
   char *s;
 
   g_type_init ();
@@ -571,6 +635,12 @@ init_gconf ()
       current_mono_font = xstrdup (s);
       g_free (s);
     }
+  s = gconf_client_get_string (gconf_client, SYSTEM_FONT, NULL);
+  if (s)
+    {
+      current_font = xstrdup (s);
+      g_free (s);
+    }
   gconf_client_set_error_handling (gconf_client, GCONF_CLIENT_HANDLE_NONE);
   gconf_client_add_dir (gconf_client,
                         SYSTEM_MONO_FONT,
@@ -584,10 +654,8 @@ init_gconf ()
 }
 
 static void
-init_xfd_settings (dpyinfo)
-     struct x_display_info *dpyinfo;
+init_xsettings (struct x_display_info *dpyinfo)
 {
-#ifdef HAVE_XFT
   char sel[64];
   Display *dpy = dpyinfo->display;
 
@@ -606,62 +674,94 @@ init_xfd_settings (dpyinfo)
 
   get_prop_window (dpyinfo);
   if (dpyinfo->xsettings_window != None)
-    apply_xft_settings (dpyinfo, False);
+    read_and_apply_settings (dpyinfo, False);
 
   UNBLOCK_INPUT;
-
-#else /* ! HAVE_XFT */
-
-  dpyinfo->Xatom_xsettings_sel = None;
-  dpyinfo->Xatom_xsettings_prop = None;
-  dpyinfo->Xatom_xsettings_mgr = None;
-  dpyinfo->xsettings_window = None;
-
-#endif /* ! HAVE_XFT */
 }
 
 void
-xsettings_initialize (dpyinfo)
-     struct x_display_info *dpyinfo;
+xsettings_initialize (struct x_display_info *dpyinfo)
 {
   if (first_dpyinfo == NULL) first_dpyinfo = dpyinfo;
   init_gconf ();
-  init_xfd_settings (dpyinfo);
+  init_xsettings (dpyinfo);
 }
 
 const char *
-xsettings_get_system_font ()
+xsettings_get_system_font (void)
 {
   return current_mono_font;
 }
 
+const char *
+xsettings_get_system_normal_font (void)
+{
+  return current_font;
+}
+
+DEFUN ("font-get-system-normal-font", Ffont_get_system_normal_font,
+       Sfont_get_system_normal_font,
+       0, 0, 0,
+       doc: /* Get the system default application font. */)
+  (void)
+{
+  return current_font
+    ? make_string (current_font, strlen (current_font))
+    : Qnil;
+}
+
 DEFUN ("font-get-system-font", Ffont_get_system_font, Sfont_get_system_font,
        0, 0, 0,
-       doc: /* Get the system default monospaced font. */)
-  ()
+       doc: /* Get the system default fixed width font. */)
+  (void)
 {
-  return current_mono_font && use_system_font
+  return current_mono_font
     ? make_string (current_mono_font, strlen (current_mono_font))
     : Qnil;
 }
 
+DEFUN ("tool-bar-get-system-style", Ftool_bar_get_system_style, Stool_bar_get_system_style,
+       0, 0, 0,
+       doc: /* Get the system tool bar style.
+If no system tool bar style is known, return `tool-bar-style' if set to a
+known style.  Otherwise return image.  */)
+  (void)
+{
+  if (EQ (Vtool_bar_style, Qimage)
+      || EQ (Vtool_bar_style, Qtext)
+      || EQ (Vtool_bar_style, Qboth)
+      || EQ (Vtool_bar_style, Qboth_horiz)
+      || EQ (Vtool_bar_style, Qtext_image_horiz))
+    return Vtool_bar_style;
+  if (!NILP (current_tool_bar_style))
+    return current_tool_bar_style;
+  return Qimage;
+}
+
 void
-syms_of_xsettings ()
+syms_of_xsettings (void)
 {
   current_mono_font = NULL;
+  current_font = NULL;
   first_dpyinfo = NULL;
 #ifdef HAVE_GCONF
   gconf_client = NULL;
 #endif
 
+  Qmonospace_font_name = intern_c_string ("monospace-font-name");
+  staticpro (&Qmonospace_font_name);
   Qfont_name = intern_c_string ("font-name");
   staticpro (&Qfont_name);
   Qfont_render = intern_c_string ("font-render");
   staticpro (&Qfont_render);
   defsubr (&Sfont_get_system_font);
+  defsubr (&Sfont_get_system_normal_font);
 
   DEFVAR_BOOL ("font-use-system-font", &use_system_font,
-    doc: /* *Non-nil means to use the system defined font.  */);
+    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.  */);
   use_system_font = 0;
 
   DEFVAR_LISP ("xft-settings", &Vxft_settings,
@@ -674,6 +774,13 @@ syms_of_xsettings ()
   Fprovide (intern_c_string ("system-font-setting"), Qnil);
 #endif
 #endif
+
+  current_tool_bar_style = Qnil;
+  Qtool_bar_style = intern_c_string ("tool-bar-style");
+  staticpro (&Qtool_bar_style);
+  defsubr (&Stool_bar_get_system_style);
+
+  Fprovide (intern_c_string ("dynamic-setting"), Qnil);
 }
 
 /* arch-tag: 541716ed-2e6b-42e1-8212-3197e01ea61d
index 6c603e5bbd99ab5fb33488d8478b433b1b4697cd..50819d456c8e59ab5c25ff40a5db78365556d265 100644 (file)
@@ -21,10 +21,14 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #define XSETTINGS_H
 
 EXFUN (Ffont_get_system_font, 0);
-extern void xsettings_initialize P_ ((struct x_display_info *dpyinfo));
-extern void xft_settings_event P_ ((struct x_display_info *dpyinfo,
-                                    XEvent *));
-extern const char *xsettings_get_system_font P_ ((void));
+EXFUN (Ffont_get_system_normal_font, 0);
+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 *);
+extern const char *xsettings_get_system_font (void);
+extern const char *xsettings_get_system_normal_font (void);
 
 
 #endif /* XSETTINGS_H */
index ec5ca3b1a9f22ae0b0ef1b3d8c40f98808f11fc8..79dccfa55e1f7736f2d367da8ac5c3b72dc1ae2f 100644 (file)
@@ -42,9 +42,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "termopts.h"
 #include "xterm.h"
 
-/* The user login name.  */
-
-extern Lisp_Object Vuser_login_name;
+/* Avoid "differ in sign" warnings */
+#define SSDATA(x)  ((char *) SDATA (x))
 
 /* This is the event used when SAVE_SESSION_EVENT occurs.  */
 
@@ -88,10 +87,14 @@ Lisp_Object Vx_session_previous_id;
 /* The option to start Emacs without the splash screen when
    restarting Emacs.  */
 
-#define NOSPLASH_OPT "--no-splash"
+static char NOSPLASH_OPT[] = "--no-splash";
+
+/* The option to make Emacs start in the given directory.  */
+
+#define CHDIR_OPT "--chdir="
 
 static void
-ice_connection_closed ()
+ice_connection_closed (void)
 {
   if (ice_fd >= 0)
     delete_keyboard_wait_descriptor (ice_fd);
@@ -104,8 +107,7 @@ ice_connection_closed ()
    Otherwise returns 1 if SAVE_SESSION_EVENT is stored in buffer BUFP.  */
 
 int
-x_session_check_input (bufp)
-     struct input_event *bufp;
+x_session_check_input (struct input_event *bufp)
 {
   SELECT_TYPE read_fds;
   EMACS_TIME tmout;
@@ -148,7 +150,7 @@ x_session_check_input (bufp)
   /* Check if smc_interact_CB was called and we shall generate a
      SAVE_SESSION_EVENT.  */
   if (emacs_event.kind != NO_EVENT)
-    bcopy (&emacs_event, bufp, sizeof (struct input_event));
+    memcpy (bufp, &emacs_event, sizeof (struct input_event));
 
   return emacs_event.kind != NO_EVENT ? 1 : 0;
 }
@@ -156,7 +158,7 @@ x_session_check_input (bufp)
 /* Return non-zero if we have a connection to a session manager.  */
 
 int
-x_session_have_connection ()
+x_session_have_connection (void)
 {
   return ice_fd != -1;
 }
@@ -166,9 +168,7 @@ x_session_have_connection ()
    Then lisp code can interact with the user.  */
 
 static void
-smc_interact_CB (smcConn, clientData)
-     SmcConn smcConn;
-     SmPointer clientData;
+smc_interact_CB (SmcConn smcConn, SmPointer clientData)
 {
   doing_interact = True;
   emacs_event.kind = SAVE_SESSION_EVENT;
@@ -183,18 +183,12 @@ smc_interact_CB (smcConn, clientData)
    we do so, because we don't know what the lisp code might do.  */
 
 static void
-smc_save_yourself_CB (smcConn,
-                      clientData,
-                      saveType,
-                      shutdown,
-                      interactStyle,
-                      fast)
-     SmcConn smcConn;
-     SmPointer clientData;
-     int saveType;
-     Bool shutdown;
-     int interactStyle;
-     Bool fast;
+smc_save_yourself_CB (SmcConn smcConn,
+                     SmPointer clientData,
+                     int saveType,
+                     Bool shutdown,
+                     int interactStyle,
+                     Bool fast)
 {
 #define NR_PROPS 5
 
@@ -204,14 +198,14 @@ smc_save_yourself_CB (smcConn,
   SmPropValue values[20];
   int val_idx = 0;
   int props_idx = 0;
-
+  int i;
   char *cwd = NULL;
-  char *smid_opt;
+  char *smid_opt, *chdir_opt = NULL;
 
   /* How to start a new instance of Emacs.  */
   props[props_idx] = &prop_ptr[props_idx];
-  props[props_idx]->name = SmCloneCommand;
-  props[props_idx]->type = SmLISTofARRAY8;
+  props[props_idx]->name = xstrdup (SmCloneCommand);
+  props[props_idx]->type = xstrdup (SmLISTofARRAY8);
   props[props_idx]->num_vals = 1;
   props[props_idx]->vals = &values[val_idx++];
   props[props_idx]->vals[0].length = strlen (emacs_program);
@@ -220,19 +214,20 @@ smc_save_yourself_CB (smcConn,
 
   /* The name of the program.  */
   props[props_idx] = &prop_ptr[props_idx];
-  props[props_idx]->name = SmProgram;
-  props[props_idx]->type = SmARRAY8;
+  props[props_idx]->name = xstrdup (SmProgram);
+  props[props_idx]->type = xstrdup (SmARRAY8);
   props[props_idx]->num_vals = 1;
   props[props_idx]->vals = &values[val_idx++];
-  props[props_idx]->vals[0].length = strlen (SDATA (Vinvocation_name));
+  props[props_idx]->vals[0].length = strlen (SSDATA (Vinvocation_name));
   props[props_idx]->vals[0].value = SDATA (Vinvocation_name);
   ++props_idx;
 
-  /* How to restart Emacs (i.e.: /path/to/emacs --smid=xxxx --no-splash).  */
+  /* How to restart Emacs.  */
   props[props_idx] = &prop_ptr[props_idx];
-  props[props_idx]->name = SmRestartCommand;
-  props[props_idx]->type = SmLISTofARRAY8;
-  props[props_idx]->num_vals = 3; /* /path/to/emacs, --smid=xxx --no-splash  */
+  props[props_idx]->name = xstrdup (SmRestartCommand);
+  props[props_idx]->type = xstrdup (SmLISTofARRAY8);
+  /* /path/to/emacs, --smid=xxx --no-splash --chdir=dir */
+  props[props_idx]->num_vals = 4;
   props[props_idx]->vals = &values[val_idx];
   props[props_idx]->vals[0].length = strlen (emacs_program);
   props[props_idx]->vals[0].value = emacs_program;
@@ -246,26 +241,37 @@ smc_save_yourself_CB (smcConn,
 
   props[props_idx]->vals[2].length = strlen (NOSPLASH_OPT);
   props[props_idx]->vals[2].value = NOSPLASH_OPT;
-  val_idx += 3;
+
+  cwd = get_current_dir_name ();
+  if (cwd) 
+    {
+      chdir_opt = xmalloc (strlen (CHDIR_OPT) + strlen (cwd) + 1);
+      strcpy (chdir_opt, CHDIR_OPT);
+      strcat (chdir_opt, cwd);
+
+      props[props_idx]->vals[3].length = strlen (chdir_opt);
+      props[props_idx]->vals[3].value = chdir_opt;
+    }
+
+  val_idx += cwd ? 4 : 3;
   ++props_idx;
 
   /* User id.  */
   props[props_idx] = &prop_ptr[props_idx];
-  props[props_idx]->name = SmUserID;
-  props[props_idx]->type = SmARRAY8;
+  props[props_idx]->name = xstrdup (SmUserID);
+  props[props_idx]->type = xstrdup (SmARRAY8);
   props[props_idx]->num_vals = 1;
   props[props_idx]->vals = &values[val_idx++];
-  props[props_idx]->vals[0].length = strlen (SDATA (Vuser_login_name));
+  props[props_idx]->vals[0].length = strlen (SSDATA (Vuser_login_name));
   props[props_idx]->vals[0].value = SDATA (Vuser_login_name);
   ++props_idx;
 
-  cwd = get_current_dir_name ();
 
   if (cwd)
     {
       props[props_idx] = &prop_ptr[props_idx];
-      props[props_idx]->name = SmCurrentDirectory;
-      props[props_idx]->type = SmARRAY8;
+      props[props_idx]->name = xstrdup (SmCurrentDirectory);
+      props[props_idx]->type = xstrdup (SmARRAY8);
       props[props_idx]->num_vals = 1;
       props[props_idx]->vals = &values[val_idx++];
       props[props_idx]->vals[0].length = strlen (cwd);
@@ -277,8 +283,14 @@ smc_save_yourself_CB (smcConn,
   SmcSetProperties (smcConn, props_idx, props);
 
   xfree (smid_opt);
+  xfree (chdir_opt);
 
   free (cwd);
+  for (i = 0; i < props_idx; ++i)
+    {
+      xfree (props[i]->type);
+      xfree (props[i]->name);
+    }
 
   /* See if we maybe shall interact with the user.  */
   if (interactStyle != SmInteractStyleAny
@@ -294,9 +306,7 @@ smc_save_yourself_CB (smcConn,
 /* According to the SM specification, this shall close the connection.  */
 
 static void
-smc_die_CB (smcConn, clientData)
-     SmcConn smcConn;
-     SmPointer clientData;
+smc_die_CB (SmcConn smcConn, SmPointer clientData)
 {
   SmcCloseConnection (smcConn, 0, 0);
   ice_connection_closed ();
@@ -309,17 +319,13 @@ smc_die_CB (smcConn, clientData)
    even seem necessary.  */
 
 static void
-smc_save_complete_CB (smcConn, clientData)
-     SmcConn smcConn;
-     SmPointer clientData;
+smc_save_complete_CB (SmcConn smcConn, SmPointer clientData)
 {
   /* Empty */
 }
 
 static void
-smc_shutdown_cancelled_CB (smcConn, clientData)
-     SmcConn smcConn;
-     SmPointer clientData;
+smc_shutdown_cancelled_CB (SmcConn smcConn, SmPointer clientData)
 {
   /* Empty */
 }
@@ -328,47 +334,32 @@ smc_shutdown_cancelled_CB (smcConn, clientData)
    because there is some error in the session management.  */
 
 static void
-smc_error_handler (smcConn,
-                   swap,
-                   offendingMinorOpcode,
-                   offendingSequence,
-                   errorClass,
-                   severity,
-                   values)
-     SmcConn smcConn;
-     Bool swap;
-     int offendingMinorOpcode;
-     unsigned long offendingSequence;
-     int errorClass;
-     int severity;
-     SmPointer values;
+smc_error_handler (SmcConn smcConn,
+                  Bool swap,
+                  int offendingMinorOpcode,
+                  unsigned long offendingSequence,
+                  int errorClass,
+                  int severity,
+                  SmPointer values)
 {
   /* Empty  */
 }
 
 static void
-ice_error_handler (iceConn,
-                   swap,
-                   offendingMinorOpcode,
-                   offendingSequence,
-                   errorClass,
-                   severity,
-                   values)
-     IceConn iceConn;
-     Bool swap;
-     int offendingMinorOpcode;
-     unsigned long offendingSequence;
-     int errorClass;
-     int severity;
-     IcePointer values;
+ice_error_handler (IceConn iceConn,
+                  Bool swap,
+                  int offendingMinorOpcode,
+                  unsigned long offendingSequence,
+                  int errorClass,
+                  int severity,
+                  IcePointer values)
 {
   /* Empty  */
 }
 
 
 static void
-ice_io_error_handler (iceConn)
-     IceConn iceConn;
+ice_io_error_handler (IceConn iceConn)
 {
   /* Connection probably gone.  */
   ice_connection_closed ();
@@ -378,11 +369,7 @@ ice_io_error_handler (iceConn)
    uses ICE as it transport protocol.  */
 
 static void
-ice_conn_watch_CB (iceConn, clientData, opening, watchData)
-     IceConn iceConn;
-     IcePointer clientData;
-     Bool opening;
-     IcePointer *watchData;
+ice_conn_watch_CB (IceConn iceConn, IcePointer clientData, int opening, IcePointer *watchData)
 {
   if (! opening)
     {
@@ -405,10 +392,9 @@ ice_conn_watch_CB (iceConn, clientData, opening, watchData)
 
 /* Create the client leader window.  */
 
+#ifndef USE_GTK
 static void
-create_client_leader_window (dpyinfo, client_id)
-     struct x_display_info *dpyinfo;
-     char *client_id;
+create_client_leader_window (struct x_display_info *dpyinfo, char *client_id)
 {
   Window w;
   XClassHint class_hints;
@@ -426,16 +412,17 @@ create_client_leader_window (dpyinfo, client_id)
 
   sm_id = XInternAtom (dpyinfo->display, "SM_CLIENT_ID", False);
   XChangeProperty (dpyinfo->display, w, sm_id, XA_STRING, 8, PropModeReplace,
-                   client_id, strlen (client_id));
+                   (unsigned char *)client_id, strlen (client_id));
 
   dpyinfo->client_leader_window = w;
 }
+#endif /* ! USE_GTK */
+
 
 /* Try to open a connection to the session manager.  */
 
 void
-x_session_initialize (dpyinfo)
-     struct x_display_info *dpyinfo;
+x_session_initialize (struct x_display_info *dpyinfo)
 {
 #define SM_ERRORSTRING_LEN 512
   char errorstring[SM_ERRORSTRING_LEN];
@@ -449,12 +436,12 @@ x_session_initialize (dpyinfo)
   /* Check if we where started by the session manager.  If so, we will
      have a previous id.  */
   if (! EQ (Vx_session_previous_id, Qnil) && STRINGP (Vx_session_previous_id))
-    previous_id = SDATA (Vx_session_previous_id);
+    previous_id = SSDATA (Vx_session_previous_id);
 
   /* Construct the path to the Emacs program.  */
   if (! EQ (Vinvocation_directory, Qnil))
-    name_len += strlen (SDATA (Vinvocation_directory));
-  name_len += strlen (SDATA (Vinvocation_name));
+    name_len += strlen (SSDATA (Vinvocation_directory));
+  name_len += strlen (SSDATA (Vinvocation_name));
 
   /* This malloc will not be freed, but it is only done once, and hopefully
      not very large   */
@@ -462,8 +449,8 @@ x_session_initialize (dpyinfo)
   emacs_program[0] = '\0';
 
   if (! EQ (Vinvocation_directory, Qnil))
-    strcpy (emacs_program, SDATA (Vinvocation_directory));
-  strcat (emacs_program, SDATA (Vinvocation_name));
+    strcpy (emacs_program, SSDATA (Vinvocation_directory));
+  strcat (emacs_program, SSDATA (Vinvocation_name));
 
   /* The SM protocol says all callbacks are mandatory, so set up all
      here and in the mask passed to SmcOpenConnection.  */
@@ -515,7 +502,7 @@ x_session_initialize (dpyinfo)
 /* Ensure that the session manager is not contacted again. */
 
 void
-x_session_close ()
+x_session_close (void)
 {
   ice_connection_closed ();
 }
@@ -533,8 +520,7 @@ from `emacs-session-save'  If the return value is non-nil the session manager
 is told to abort the window system shutdown.
 
 Do not call this function yourself. */)
-     (event)
-     Lisp_Object event;
+  (Lisp_Object event)
 {
   /* Check doing_interact so that we don't do anything if someone called
      this at the wrong time. */
@@ -558,7 +544,7 @@ Do not call this function yourself. */)
                            Initialization
  ***********************************************************************/
 void
-syms_of_xsmfns ()
+syms_of_xsmfns (void)
 {
   DEFVAR_LISP ("x-session-id", &Vx_session_id,
     doc: /* The session id Emacs got from the session manager for this session.
index 0652de165ef7c8630e37720e3c14ce4b378ee0cc..c049ce78913a98176099a7fe43f832ad1277579e 100644 (file)
@@ -22,11 +22,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Xt features made by Fred Pierresteguy.  */
 
 #include <config.h>
-
-/* On 4.3 these lose if they come after xterm.h.  */
-/* Putting these at the beginning seems to be standard for other .c files.  */
 #include <signal.h>
-
 #include <stdio.h>
 #include <setjmp.h>
 
@@ -50,15 +46,13 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <sys/types.h>
 #endif /* makedev */
 
-#ifdef BSD_SYSTEM
+#ifdef HAVE_SYS_IOCTL_H
 #include <sys/ioctl.h>
-#endif /* ! defined (BSD_SYSTEM) */
+#endif /* ! defined (HAVE_SYS_IOCTL_H) */
 
 #include "systime.h"
 
-#ifndef INCLUDED_FCNTL
 #include <fcntl.h>
-#endif
 #include <ctype.h>
 #include <errno.h>
 #include <setjmp.h>
@@ -106,13 +100,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #endif
 
 #ifdef USE_LUCID
-extern int xlwmenu_window_p P_ ((Widget w, Window window));
-extern void xlwmenu_redisplay P_ ((Widget));
-#endif
-
-#if defined (USE_X_TOOLKIT) || defined (USE_GTK)
-
-extern void free_frame_menubar P_ ((struct frame *));
+#include "../lwlib/xlwmenu.h"
 #endif
 
 #ifdef USE_X_TOOLKIT
@@ -296,25 +284,6 @@ static int input_signal_count;
 
 static int x_noop_count;
 
-/* Initial values of argv and argc.  */
-
-extern char **initial_argv;
-extern int initial_argc;
-
-extern Lisp_Object Vcommand_line_args, Vsystem_name;
-
-/* Tells if a window manager is present or not.  */
-
-extern Lisp_Object Vx_no_window_manager;
-
-extern Lisp_Object Qeql;
-
-extern int errno;
-
-/* A mask of extra modifier bits to put into every keyboard char.  */
-
-extern EMACS_INT extra_keyboard_modifiers;
-
 /* The keysyms to use for the various modifiers.  */
 
 Lisp_Object Vx_alt_keysym, Vx_hyper_keysym, Vx_meta_keysym, Vx_super_keysym;
@@ -332,65 +301,66 @@ static Lisp_Object xg_default_icon_file;
 Lisp_Object Qx_gtk_map_stock;
 #endif
 
+/* Some functions take this as char *, not const char *.  */
+static char emacs_class[] = EMACS_CLASS;
+
 /* Used in x_flush.  */
 
-extern Lisp_Object Vinhibit_redisplay;
-
-extern XrmDatabase x_load_resources P_ ((Display *, char *, char *, char *));
-extern int x_bitmap_mask P_ ((FRAME_PTR, int));
-
-static int x_alloc_nearest_color_1 P_ ((Display *, Colormap, XColor *));
-static void x_set_window_size_1 P_ ((struct frame *, int, int, int));
-static const XColor *x_color_cells P_ ((Display *, int *));
-static void x_update_window_end P_ ((struct window *, int, int));
-
-static int x_io_error_quitter P_ ((Display *));
-static struct terminal *x_create_terminal P_ ((struct x_display_info *));
-void x_delete_terminal P_ ((struct terminal *));
-static void x_update_end P_ ((struct frame *));
-static void XTframe_up_to_date P_ ((struct frame *));
-static void XTset_terminal_modes P_ ((struct terminal *));
-static void XTreset_terminal_modes P_ ((struct terminal *));
-static void x_clear_frame P_ ((struct frame *));
-static void frame_highlight P_ ((struct frame *));
-static void frame_unhighlight P_ ((struct frame *));
-static void x_new_focus_frame P_ ((struct x_display_info *, struct frame *));
-static void  x_focus_changed P_ ((int, int, struct x_display_info *,
-                                 struct frame *, struct input_event *));
-static void x_detect_focus_change P_ ((struct x_display_info *,
-                                       XEvent *, struct input_event *));
-static void XTframe_rehighlight P_ ((struct frame *));
-static void x_frame_rehighlight P_ ((struct x_display_info *));
-static void x_draw_hollow_cursor P_ ((struct window *, struct glyph_row *));
-static void x_draw_bar_cursor P_ ((struct window *, struct glyph_row *, int,
-                                  enum text_cursor_kinds));
-
-static void x_clip_to_row P_ ((struct window *, struct glyph_row *, int, GC));
-static void x_flush P_ ((struct frame *f));
-static void x_update_begin P_ ((struct frame *));
-static void x_update_window_begin P_ ((struct window *));
-static void x_after_update_window_line P_ ((struct glyph_row *));
-static struct scroll_bar *x_window_to_scroll_bar P_ ((Display *, Window));
-static void x_scroll_bar_report_motion P_ ((struct frame **, Lisp_Object *,
-                                           enum scroll_bar_part *,
-                                           Lisp_Object *, Lisp_Object *,
-                                           unsigned long *));
-static void x_handle_net_wm_state P_ ((struct frame *, XPropertyEvent *));
-static void x_check_fullscreen P_ ((struct frame *));
-static void x_check_expected_move P_ ((struct frame *, int, int));
-static void x_sync_with_move P_ ((struct frame *, int, int, int));
-static int handle_one_xevent P_ ((struct x_display_info *, XEvent *,
-                                 int *, struct input_event *));
+extern XrmDatabase x_load_resources (Display *, const char *, const char *,
+                                    const char *);
+extern int x_bitmap_mask (FRAME_PTR, int);
+
+static int x_alloc_nearest_color_1 (Display *, Colormap, XColor *);
+static void x_set_window_size_1 (struct frame *, int, int, int);
+static const XColor *x_color_cells (Display *, int *);
+static void x_update_window_end (struct window *, int, int);
+
+static int x_io_error_quitter (Display *);
+static struct terminal *x_create_terminal (struct x_display_info *);
+void x_delete_terminal (struct terminal *);
+static void x_update_end (struct frame *);
+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 frame_highlight (struct frame *);
+static void frame_unhighlight (struct frame *);
+static void x_new_focus_frame (struct x_display_info *, struct frame *);
+static void  x_focus_changed (int, int, struct x_display_info *,
+                              struct frame *, struct input_event *);
+static void x_detect_focus_change (struct x_display_info *,
+                                   XEvent *, struct input_event *);
+static void XTframe_rehighlight (struct frame *);
+static void x_frame_rehighlight (struct x_display_info *);
+static void x_draw_hollow_cursor (struct window *, struct glyph_row *);
+static void x_draw_bar_cursor (struct window *, struct glyph_row *, int,
+                               enum text_cursor_kinds);
+
+static void x_clip_to_row (struct window *, struct glyph_row *, int, GC);
+static void x_flush (struct frame *f);
+static void x_update_begin (struct frame *);
+static void x_update_window_begin (struct window *);
+static void x_after_update_window_line (struct glyph_row *);
+static struct scroll_bar *x_window_to_scroll_bar (Display *, Window);
+static void x_scroll_bar_report_motion (struct frame **, Lisp_Object *,
+                                        enum scroll_bar_part *,
+                                        Lisp_Object *, Lisp_Object *,
+                                        unsigned long *);
+static void x_handle_net_wm_state (struct frame *, XPropertyEvent *);
+static void x_check_fullscreen (struct frame *);
+static void x_check_expected_move (struct frame *, int, int);
+static void x_sync_with_move (struct frame *, int, int, int);
+static int handle_one_xevent (struct x_display_info *, XEvent *,
+                              int *, struct input_event *);
 /* Don't declare this NO_RETURN because we want no
    interference with debugging failing X calls.  */
-static SIGTYPE x_connection_closed P_ ((Display *, char *));
+static SIGTYPE x_connection_closed (Display *, const char *);
 
 
 /* Flush display of frame F, or of all frames if F is null.  */
 
 static void
-x_flush (f)
-     struct frame *f;
+x_flush (struct frame *f)
 {
   /* Don't call XFlush when it is not safe to redisplay; the X
      connection may be broken.  */
@@ -459,8 +429,7 @@ record_event (locus, type)
 /* Return the struct x_display_info corresponding to DPY.  */
 
 struct x_display_info *
-x_display_info_for_display (dpy)
-     Display *dpy;
+x_display_info_for_display (Display *dpy)
 {
   struct x_display_info *dpyinfo;
 
@@ -475,8 +444,7 @@ x_display_info_for_display (dpy)
 #define OPACITY "_NET_WM_WINDOW_OPACITY"
 
 void
-x_set_frame_alpha (f)
-     struct frame *f;
+x_set_frame_alpha (struct frame *f)
 {
   struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
   Display *dpy = FRAME_X_DISPLAY (f);
@@ -488,7 +456,7 @@ x_set_frame_alpha (f)
   if (FRAME_X_DISPLAY_INFO (f)->root_window != FRAME_X_OUTPUT (f)->parent_desc)
     /* Since the WM decoration lies under the FRAME_OUTER_WINDOW,
        we must treat the former instead of the latter. */
-    win = FRAME_X_OUTPUT(f)->parent_desc;
+    win = FRAME_X_OUTPUT (f)->parent_desc;
 
   if (dpyinfo->x_highlight_frame == f)
     alpha = f->alpha[0];
@@ -517,10 +485,10 @@ x_set_frame_alpha (f)
     unsigned long n, left;
 
     x_catch_errors (dpy);
-    rc = XGetWindowProperty(dpy, win, XInternAtom(dpy, OPACITY, False),
-                           0L, 1L, False, XA_CARDINAL,
-                           &actual, &format, &n, &left,
-                           &data);
+    rc = XGetWindowProperty (dpy, win, XInternAtom(dpy, OPACITY, False),
+                            0L, 1L, False, XA_CARDINAL,
+                            &actual, &format, &n, &left,
+                            &data);
 
     if (rc == Success && actual != None)
       if (*(unsigned long *)data == opac)
@@ -542,15 +510,13 @@ x_set_frame_alpha (f)
 }
 
 int
-x_display_pixel_height (dpyinfo)
-     struct x_display_info *dpyinfo;
+x_display_pixel_height (struct x_display_info *dpyinfo)
 {
   return HeightOfScreen (dpyinfo->screen);
 }
 
 int
-x_display_pixel_width (dpyinfo)
-     struct x_display_info *dpyinfo;
+x_display_pixel_width (struct x_display_info *dpyinfo)
 {
   return WidthOfScreen (dpyinfo->screen);
 }
@@ -567,8 +533,7 @@ x_display_pixel_width (dpyinfo)
    because all interesting stuff is done on a window basis.  */
 
 static void
-x_update_begin (f)
-     struct frame *f;
+x_update_begin (struct frame *f)
 {
   /* Nothing to do.  */
 }
@@ -579,8 +544,7 @@ x_update_begin (f)
    position of W.  */
 
 static void
-x_update_window_begin (w)
-     struct window *w;
+x_update_window_begin (struct window *w)
 {
   struct frame *f = XFRAME (WINDOW_FRAME (w));
   struct x_display_info *display_info = FRAME_X_DISPLAY_INFO (f);
@@ -608,9 +572,7 @@ x_update_window_begin (w)
 /* Draw a vertical window border from (x,y0) to (x,y1)  */
 
 static void
-x_draw_vertical_window_border (w, x, y0, y1)
-     struct window *w;
-     int x, y0, y1;
+x_draw_vertical_window_border (struct window *w, int x, int y0, int y1)
 {
   struct frame *f = XFRAME (WINDOW_FRAME (w));
   struct face *face;
@@ -638,9 +600,7 @@ x_draw_vertical_window_border (w, x, y0, y1)
    here.  */
 
 static void
-x_update_window_end (w, cursor_on_p, mouse_face_overwritten_p)
-     struct window *w;
-     int cursor_on_p, mouse_face_overwritten_p;
+x_update_window_end (struct window *w, int cursor_on_p, int mouse_face_overwritten_p)
 {
   struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (XFRAME (w->frame));
 
@@ -676,8 +636,7 @@ x_update_window_end (w, cursor_on_p, mouse_face_overwritten_p)
    update_end.  */
 
 static void
-x_update_end (f)
-     struct frame *f;
+x_update_end (struct frame *f)
 {
   /* Mouse highlight may be displayed again.  */
   FRAME_X_DISPLAY_INFO (f)->mouse_face_defer = 0;
@@ -695,8 +654,7 @@ x_update_end (f)
    updated_window is not available here.  */
 
 static void
-XTframe_up_to_date (f)
-     struct frame *f;
+XTframe_up_to_date (struct frame *f)
 {
   if (FRAME_X_P (f))
     {
@@ -725,8 +683,7 @@ XTframe_up_to_date (f)
    between bitmaps to be drawn between current row and DESIRED_ROW.  */
 
 static void
-x_after_update_window_line (desired_row)
-     struct glyph_row *desired_row;
+x_after_update_window_line (struct glyph_row *desired_row)
 {
   struct window *w = updated_window;
   struct frame *f;
@@ -764,10 +721,7 @@ x_after_update_window_line (desired_row)
 }
 
 static void
-x_draw_fringe_bitmap (w, row, p)
-     struct window *w;
-     struct glyph_row *row;
-     struct draw_fringe_bitmap_params *p;
+x_draw_fringe_bitmap (struct window *w, struct glyph_row *row, struct draw_fringe_bitmap_params *p)
 {
   struct frame *f = XFRAME (WINDOW_FRAME (w));
   Display *display = FRAME_X_DISPLAY (f);
@@ -920,37 +874,37 @@ XTreset_terminal_modes (struct terminal *terminal)
 
 
 
-static void x_set_glyph_string_clipping P_ ((struct glyph_string *));
-static void x_set_glyph_string_gc P_ ((struct glyph_string *));
-static void x_draw_glyph_string_background P_ ((struct glyph_string *,
-                                               int));
-static void x_draw_glyph_string_foreground P_ ((struct glyph_string *));
-static void x_draw_composite_glyph_string_foreground P_ ((struct glyph_string *));
-static void x_draw_glyph_string_box P_ ((struct glyph_string *));
-static void x_draw_glyph_string  P_ ((struct glyph_string *));
-static void x_compute_glyph_string_overhangs P_ ((struct glyph_string *));
-static void x_set_cursor_gc P_ ((struct glyph_string *));
-static void x_set_mode_line_face_gc P_ ((struct glyph_string *));
-static void x_set_mouse_face_gc P_ ((struct glyph_string *));
-static int x_alloc_lighter_color P_ ((struct frame *, Display *, Colormap,
-                                     unsigned long *, double, int));
-static void x_setup_relief_color P_ ((struct frame *, struct relief *,
-                                     double, int, unsigned long));
-static void x_setup_relief_colors P_ ((struct glyph_string *));
-static void x_draw_image_glyph_string P_ ((struct glyph_string *));
-static void x_draw_image_relief P_ ((struct glyph_string *));
-static void x_draw_image_foreground P_ ((struct glyph_string *));
-static void x_draw_image_foreground_1 P_ ((struct glyph_string *, Pixmap));
-static void x_clear_glyph_string_rect P_ ((struct glyph_string *, int,
-                                          int, int, int));
-static void x_draw_relief_rect P_ ((struct frame *, int, int, int, int,
-                                   int, int, int, int, int, int,
-                                   XRectangle *));
-static void x_draw_box_rect P_ ((struct glyph_string *, int, int, int, int,
-                                int, int, int, XRectangle *));
+static void x_set_glyph_string_clipping (struct glyph_string *);
+static void x_set_glyph_string_gc (struct glyph_string *);
+static void x_draw_glyph_string_background (struct glyph_string *,
+                                            int);
+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_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 *);
+static void x_set_mouse_face_gc (struct glyph_string *);
+static int x_alloc_lighter_color (struct frame *, Display *, Colormap,
+                                  unsigned long *, double, int);
+static void x_setup_relief_color (struct frame *, struct relief *,
+                                  double, int, unsigned long);
+static void x_setup_relief_colors (struct glyph_string *);
+static void x_draw_image_glyph_string (struct glyph_string *);
+static void x_draw_image_relief (struct glyph_string *);
+static void x_draw_image_foreground (struct glyph_string *);
+static void x_draw_image_foreground_1 (struct glyph_string *, Pixmap);
+static void x_clear_glyph_string_rect (struct glyph_string *, int,
+                                       int, int, int);
+static void x_draw_relief_rect (struct frame *, int, int, int, int,
+                                int, int, int, int, int, int,
+                                XRectangle *);
+static void x_draw_box_rect (struct glyph_string *, int, int, int, int,
+                             int, int, int, XRectangle *);
 
 #if GLYPH_DEBUG
-static void x_check_font P_ ((struct frame *, struct font *));
+static void x_check_font (struct frame *, struct font *);
 #endif
 
 
@@ -958,8 +912,7 @@ static void x_check_font P_ ((struct frame *, struct font *));
    face.  */
 
 static void
-x_set_cursor_gc (s)
-     struct glyph_string *s;
+x_set_cursor_gc (struct glyph_string *s)
 {
   if (s->font == FRAME_FONT (s->f)
       && s->face->background == FRAME_BACKGROUND_PIXEL (s->f)
@@ -1010,8 +963,7 @@ x_set_cursor_gc (s)
 /* Set up S->gc of glyph string S for drawing text in mouse face.  */
 
 static void
-x_set_mouse_face_gc (s)
-     struct glyph_string *s;
+x_set_mouse_face_gc (struct glyph_string *s)
 {
   int face_id;
   struct face *face;
@@ -1062,8 +1014,7 @@ x_set_mouse_face_gc (s)
    matrix was built, so there isn't much to do, here.  */
 
 static INLINE void
-x_set_mode_line_face_gc (s)
-     struct glyph_string *s;
+x_set_mode_line_face_gc (struct glyph_string *s)
 {
   s->gc = s->face->gc;
 }
@@ -1074,8 +1025,7 @@ x_set_mode_line_face_gc (s)
    pattern.  */
 
 static INLINE void
-x_set_glyph_string_gc (s)
-     struct glyph_string *s;
+x_set_glyph_string_gc (struct glyph_string *s)
 {
   PREPARE_FACE_FOR_DISPLAY (s->f, s->face);
 
@@ -1120,8 +1070,7 @@ x_set_glyph_string_gc (s)
    line or menu if we don't have X toolkit support.  */
 
 static INLINE void
-x_set_glyph_string_clipping (s)
-     struct glyph_string *s;
+x_set_glyph_string_clipping (struct glyph_string *s)
 {
   XRectangle *r = s->clip;
   int n = get_glyph_string_clip_rects (s, r, 2);
@@ -1137,8 +1086,7 @@ x_set_glyph_string_clipping (s)
    the area of SRC.  */
 
 static void
-x_set_glyph_string_clipping_exactly (src, dst)
-     struct glyph_string *src, *dst;
+x_set_glyph_string_clipping_exactly (struct glyph_string *src, struct glyph_string *dst)
 {
   XRectangle r;
 
@@ -1156,8 +1104,7 @@ x_set_glyph_string_clipping_exactly (src, dst)
    Compute left and right overhang of glyph string S.  */
 
 static void
-x_compute_glyph_string_overhangs (s)
-     struct glyph_string *s;
+x_compute_glyph_string_overhangs (struct glyph_string *s)
 {
   if (s->cmp == NULL
       && (s->first_glyph->type == CHAR_GLYPH
@@ -1196,9 +1143,7 @@ x_compute_glyph_string_overhangs (s)
 /* Fill rectangle X, Y, W, H with background color of glyph string S.  */
 
 static INLINE void
-x_clear_glyph_string_rect (s, x, y, w, h)
-     struct glyph_string *s;
-     int x, y, w, h;
+x_clear_glyph_string_rect (struct glyph_string *s, int x, int y, int w, int h)
 {
   XGCValues xgcv;
   XGetGCValues (s->display, s->gc, GCForeground | GCBackground, &xgcv);
@@ -1215,9 +1160,7 @@ x_clear_glyph_string_rect (s, x, y, w, h)
    contains the first component of a composition.  */
 
 static void
-x_draw_glyph_string_background (s, force_p)
-     struct glyph_string *s;
-     int force_p;
+x_draw_glyph_string_background (struct glyph_string *s, int force_p)
 {
   /* Nothing to do if background has already been drawn or if it
      shouldn't be drawn in the first place.  */
@@ -1253,8 +1196,7 @@ x_draw_glyph_string_background (s, force_p)
 /* Draw the foreground of glyph string S.  */
 
 static void
-x_draw_glyph_string_foreground (s)
-     struct glyph_string *s;
+x_draw_glyph_string_foreground (struct glyph_string *s)
 {
   int i, x;
 
@@ -1302,8 +1244,7 @@ x_draw_glyph_string_foreground (s)
 /* Draw the foreground of composite glyph string S.  */
 
 static void
-x_draw_composite_glyph_string_foreground (s)
-     struct glyph_string *s;
+x_draw_composite_glyph_string_foreground (struct glyph_string *s)
 {
   int i, j, x;
   struct font *font = s->font;
@@ -1390,19 +1331,18 @@ x_draw_composite_glyph_string_foreground (s)
 
 #ifdef USE_X_TOOLKIT
 
-static struct frame *x_frame_of_widget P_ ((Widget));
-static Boolean cvt_string_to_pixel P_ ((Display *, XrmValue *, Cardinal *,
-                                       XrmValue *, XrmValue *, XtPointer *));
-static void cvt_pixel_dtor P_ ((XtAppContext, XrmValue *, XtPointer,
-                               XrmValue *, Cardinal *));
+static struct frame *x_frame_of_widget (Widget);
+static Boolean cvt_string_to_pixel (Display *, XrmValue *, Cardinal *,
+                                    XrmValue *, XrmValue *, XtPointer *);
+static void cvt_pixel_dtor (XtAppContext, XrmValue *, XtPointer,
+                            XrmValue *, Cardinal *);
 
 
 /* Return the frame on which widget WIDGET is used.. Abort if frame
    cannot be determined.  */
 
 static struct frame *
-x_frame_of_widget (widget)
-     Widget widget;
+x_frame_of_widget (Widget widget)
 {
   struct x_display_info *dpyinfo;
   Lisp_Object tail;
@@ -1438,10 +1378,7 @@ x_frame_of_widget (widget)
    if successful.  This is called from lwlib.  */
 
 int
-x_alloc_nearest_color_for_widget (widget, cmap, color)
-     Widget widget;
-     Colormap cmap;
-     XColor *color;
+x_alloc_nearest_color_for_widget (Widget widget, Colormap cmap, XColor *color)
 {
   struct frame *f = x_frame_of_widget (widget);
   return x_alloc_nearest_color (f, cmap, color);
@@ -1456,13 +1393,8 @@ x_alloc_nearest_color_for_widget (widget, cmap, color)
    Value is non-zero if successful.  */
 
 int
-x_alloc_lighter_color_for_widget (widget, display, cmap, pixel, factor, delta)
-     Widget widget;
-     Display *display;
-     Colormap cmap;
-     unsigned long *pixel;
-     double factor;
-     int delta;
+x_alloc_lighter_color_for_widget (Widget widget, Display *display, Colormap cmap,
+                                 unsigned long *pixel, double factor, int delta)
 {
   struct frame *f = x_frame_of_widget (widget);
   return x_alloc_lighter_color (f, display, cmap, pixel, factor, delta);
@@ -1505,12 +1437,9 @@ static Pixel cvt_string_to_pixel_value;
    Value is True if successful, False otherwise.  */
 
 static Boolean
-cvt_string_to_pixel (dpy, args, nargs, from, to, closure_ret)
-     Display *dpy;
-     XrmValue *args;
-     Cardinal *nargs;
-     XrmValue *from, *to;
-     XtPointer *closure_ret;
+cvt_string_to_pixel (Display *dpy, XrmValue *args, Cardinal *nargs,
+                    XrmValue *from, XrmValue *to,
+                    XtPointer *closure_ret)
 {
   Screen *screen;
   Colormap cmap;
@@ -1594,12 +1523,8 @@ cvt_string_to_pixel (dpy, args, nargs, from, to, closure_ret)
    ARGS and NARGS are like for cvt_string_to_pixel.  */
 
 static void
-cvt_pixel_dtor (app, to, closure, args, nargs)
-    XtAppContext app;
-    XrmValuePtr to;
-    XtPointer closure;
-    XrmValuePtr args;
-    Cardinal *nargs;
+cvt_pixel_dtor (XtAppContext app, XrmValuePtr to, XtPointer closure, XrmValuePtr args,
+               Cardinal *nargs)
 {
   if (*nargs != 2)
     {
@@ -1628,9 +1553,7 @@ cvt_pixel_dtor (app, to, closure, args, nargs)
    say a 24-bit TrueColor map.  */
 
 static const XColor *
-x_color_cells (dpy, ncells)
-     Display *dpy;
-     int *ncells;
+x_color_cells (Display *dpy, int *ncells)
 {
   struct x_display_info *dpyinfo = x_display_info_for_display (dpy);
 
@@ -1661,10 +1584,7 @@ x_color_cells (dpy, ncells)
    colors in COLORS.  Use cached information, if available.  */
 
 void
-x_query_colors (f, colors, ncolors)
-     struct frame *f;
-     XColor *colors;
-     int ncolors;
+x_query_colors (struct frame *f, XColor *colors, int ncolors)
 {
   struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
 
@@ -1688,9 +1608,7 @@ x_query_colors (f, colors, ncolors)
    COLOR.  Use cached information, if available.  */
 
 void
-x_query_color (f, color)
-     struct frame *f;
-     XColor *color;
+x_query_color (struct frame *f, XColor *color)
 {
   x_query_colors (f, color, 1);
 }
@@ -1702,10 +1620,7 @@ x_query_color (f, color)
    allocated.  */
 
 static int
-x_alloc_nearest_color_1 (dpy, cmap, color)
-     Display *dpy;
-     Colormap cmap;
-     XColor *color;
+x_alloc_nearest_color_1 (Display *dpy, Colormap cmap, XColor *color)
 {
   int rc;
 
@@ -1775,10 +1690,7 @@ x_alloc_nearest_color_1 (dpy, cmap, color)
    allocated.  */
 
 int
-x_alloc_nearest_color (f, cmap, color)
-     struct frame *f;
-     Colormap cmap;
-     XColor *color;
+x_alloc_nearest_color (struct frame *f, Colormap cmap, XColor *color)
 {
   gamma_correct (f, color);
   return x_alloc_nearest_color_1 (FRAME_X_DISPLAY (f), cmap, color);
@@ -1790,9 +1702,7 @@ x_alloc_nearest_color (f, cmap, color)
    get color reference counts right.  */
 
 unsigned long
-x_copy_color (f, pixel)
-     struct frame *f;
-     unsigned long pixel;
+x_copy_color (struct frame *f, long unsigned int pixel)
 {
   XColor color;
 
@@ -1813,10 +1723,7 @@ x_copy_color (f, pixel)
    get color reference counts right.  */
 
 unsigned long
-x_copy_dpy_color (dpy, cmap, pixel)
-     Display *dpy;
-     Colormap cmap;
-     unsigned long pixel;
+x_copy_dpy_color (Display *dpy, Colormap cmap, long unsigned int pixel)
 {
   XColor color;
 
@@ -1854,13 +1761,7 @@ x_copy_dpy_color (dpy, cmap, pixel)
    Value is non-zero if successful.  */
 
 static int
-x_alloc_lighter_color (f, display, cmap, pixel, factor, delta)
-     struct frame *f;
-     Display *display;
-     Colormap cmap;
-     unsigned long *pixel;
-     double factor;
-     int delta;
+x_alloc_lighter_color (struct frame *f, Display *display, Colormap cmap, long unsigned int *pixel, double factor, int delta)
 {
   XColor color, new;
   long bright;
@@ -1936,12 +1837,7 @@ x_alloc_lighter_color (f, display, cmap, pixel, factor, delta)
    be allocated, use DEFAULT_PIXEL, instead.  */
 
 static void
-x_setup_relief_color (f, relief, factor, delta, default_pixel)
-     struct frame *f;
-     struct relief *relief;
-     double factor;
-     int delta;
-     unsigned long default_pixel;
+x_setup_relief_color (struct frame *f, struct relief *relief, double factor, int delta, long unsigned int default_pixel)
 {
   XGCValues xgcv;
   struct x_output *di = f->output_data.x;
@@ -1989,8 +1885,7 @@ x_setup_relief_color (f, relief, factor, delta, default_pixel)
 /* Set up colors for the relief lines around glyph string S.  */
 
 static void
-x_setup_relief_colors (s)
-     struct glyph_string *s;
+x_setup_relief_colors (struct glyph_string *s)
 {
   struct x_output *di = s->f->output_data.x;
   unsigned long color;
@@ -2031,12 +1926,10 @@ x_setup_relief_colors (s)
    when drawing.  */
 
 static void
-x_draw_relief_rect (f, left_x, top_y, right_x, bottom_y, width,
-                   raised_p, top_p, bot_p, left_p, right_p, clip_rect)
-     struct frame *f;
-     int left_x, top_y, right_x, bottom_y, width;
-     int top_p, bot_p, left_p, right_p, raised_p;
-     XRectangle *clip_rect;
+x_draw_relief_rect (struct frame *f,
+                   int left_x, int top_y, int right_x, int bottom_y, int width,
+                   int raised_p, int top_p, int bot_p, int left_p, int right_p,
+                   XRectangle *clip_rect)
 {
   Display *dpy = FRAME_X_DISPLAY (f);
   Window window = FRAME_X_WINDOW (f);
@@ -2094,11 +1987,9 @@ x_draw_relief_rect (f, left_x, top_y, right_x, bottom_y, width,
    rectangle to use when drawing.  */
 
 static void
-x_draw_box_rect (s, left_x, top_y, right_x, bottom_y, width,
-                left_p, right_p, clip_rect)
-     struct glyph_string *s;
-     int left_x, top_y, right_x, bottom_y, width, left_p, right_p;
-     XRectangle *clip_rect;
+x_draw_box_rect (struct glyph_string *s,
+                int left_x, int top_y, int right_x, int bottom_y, int width,
+                int left_p, int right_p, XRectangle *clip_rect)
 {
   XGCValues xgcv;
 
@@ -2132,8 +2023,7 @@ x_draw_box_rect (s, left_x, top_y, right_x, bottom_y, width,
 /* Draw a box around glyph string S.  */
 
 static void
-x_draw_glyph_string_box (s)
-     struct glyph_string *s;
+x_draw_glyph_string_box (struct glyph_string *s)
 {
   int width, left_x, right_x, top_y, bottom_y, last_x, raised_p;
   int left_p, right_p;
@@ -2184,8 +2074,7 @@ x_draw_glyph_string_box (s)
 /* Draw foreground of image glyph string S.  */
 
 static void
-x_draw_image_foreground (s)
-     struct glyph_string *s;
+x_draw_image_foreground (struct glyph_string *s)
 {
   int x = s->x;
   int y = s->ybase - image_ascent (s->img, s->face, &s->slice);
@@ -2275,10 +2164,9 @@ x_draw_image_foreground (s)
 /* Draw a relief around the image glyph string S.  */
 
 static void
-x_draw_image_relief (s)
-     struct glyph_string *s;
+x_draw_image_relief (struct glyph_string *s)
 {
-  int x0, y0, x1, y1, thick, raised_p;
+  int x0, y0, x1, y1, thick, raised_p, extra;
   XRectangle r;
   int x = s->x;
   int y = s->ybase - image_ascent (s->img, s->face, &s->slice);
@@ -2309,10 +2197,13 @@ x_draw_image_relief (s)
       raised_p = s->img->relief > 0;
     }
 
-  x0 = x - thick;
-  y0 = y - thick;
-  x1 = x + s->slice.width + thick - 1;
-  y1 = y + s->slice.height + thick - 1;
+  extra = s->face->id == TOOL_BAR_FACE_ID
+    ? XINT (Vtool_bar_button_margin) : 0;
+
+  x0 = x - thick - extra;
+  y0 = y - thick - extra;
+  x1 = x + s->slice.width + thick - 1 + extra;
+  y1 = y + s->slice.height + thick - 1 + extra;
 
   x_setup_relief_colors (s);
   get_glyph_string_clip_rect (s, &r);
@@ -2328,9 +2219,7 @@ x_draw_image_relief (s)
 /* Draw the foreground of image glyph string S to PIXMAP.  */
 
 static void
-x_draw_image_foreground_1 (s, pixmap)
-     struct glyph_string *s;
-     Pixmap pixmap;
+x_draw_image_foreground_1 (struct glyph_string *s, Pixmap pixmap)
 {
   int x = 0;
   int y = s->ybase - s->y - image_ascent (s->img, s->face, &s->slice);
@@ -2406,9 +2295,7 @@ x_draw_image_foreground_1 (s, pixmap)
    give the rectangle to draw.  */
 
 static void
-x_draw_glyph_string_bg_rect (s, x, y, w, h)
-     struct glyph_string *s;
-     int x, y, w, h;
+x_draw_glyph_string_bg_rect (struct glyph_string *s, int x, int y, int w, int h)
 {
   if (s->stippled_p)
     {
@@ -2437,8 +2324,7 @@ x_draw_glyph_string_bg_rect (s, x, y, w, h)
  */
 
 static void
-x_draw_image_glyph_string (s)
-     struct glyph_string *s;
+x_draw_image_glyph_string (struct glyph_string *s)
 {
   int box_line_hwidth = eabs (s->face->box_line_width);
   int box_line_vwidth = max (s->face->box_line_width, 0);
@@ -2542,25 +2428,41 @@ x_draw_image_glyph_string (s)
 /* Draw stretch glyph string S.  */
 
 static void
-x_draw_stretch_glyph_string (s)
-     struct glyph_string *s;
+x_draw_stretch_glyph_string (struct glyph_string *s)
 {
   xassert (s->first_glyph->type == STRETCH_GLYPH);
 
   if (s->hl == DRAW_CURSOR
       && !x_stretch_cursor_p)
     {
-      /* If `x-stretch-block-cursor' is nil, don't draw a block cursor
-        as wide as the stretch glyph.  */
+      /* If `x-stretch-cursor' is nil, don't draw a block cursor as
+        wide as the stretch glyph.  */
       int width, background_width = s->background_width;
-      int x = s->x, left_x = window_box_left_offset (s->w, TEXT_AREA);
+      int x = s->x;
 
-      if (x < left_x)
+      if (!s->row->reversed_p)
        {
-         background_width -= left_x - x;
-         x = left_x;
+         int left_x = window_box_left_offset (s->w, TEXT_AREA);
+
+         if (x < left_x)
+           {
+             background_width -= left_x - x;
+             x = left_x;
+           }
+       }
+      else
+       {
+         /* In R2L rows, draw the cursor on the right edge of the
+            stretch glyph.  */
+         int right_x = window_box_right_offset (s->w, TEXT_AREA);
+
+         if (x + background_width > right_x)
+           background_width -= x - right_x;
+         x += background_width;
        }
       width = min (FRAME_COLUMN_WIDTH (s->f), background_width);
+      if (s->row->reversed_p)
+       x -= width;
 
       /* Draw cursor.  */
       x_draw_glyph_string_bg_rect (s, x, s->y, width, s->height);
@@ -2573,7 +2475,10 @@ x_draw_stretch_glyph_string (s)
          XRectangle r;
          GC gc;
 
-         x += width;
+         if (!s->row->reversed_p)
+           x += width;
+         else
+           x = s->x;
          if (s->row->mouse_face_p
              && cursor_in_mouse_face_p (s->w))
            {
@@ -2626,8 +2531,7 @@ x_draw_stretch_glyph_string (s)
 /* Draw glyph string S.  */
 
 static void
-x_draw_glyph_string (s)
-     struct glyph_string *s;
+x_draw_glyph_string (struct glyph_string *s)
 {
   int relief_drawn_p = 0;
 
@@ -2881,9 +2785,7 @@ x_draw_glyph_string (s)
 /* Shift display to make room for inserted glyphs.   */
 
 void
-x_shift_glyphs_for_insert (f, x, y, width, height, shift_by)
-     struct frame *f;
-     int x, y, width, height, shift_by;
+x_shift_glyphs_for_insert (struct frame *f, int x, int y, int width, int height, int shift_by)
 {
   XCopyArea (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), FRAME_X_WINDOW (f),
             f->output_data.x->normal_gc,
@@ -2895,9 +2797,7 @@ x_shift_glyphs_for_insert (f, x, y, width, height, shift_by)
    for X frames.  */
 
 static void
-x_delete_glyphs (f, n)
-     struct frame *f;
-     register int n;
+x_delete_glyphs (struct frame *f, register int n)
 {
   abort ();
 }
@@ -2907,12 +2807,7 @@ x_delete_glyphs (f, n)
    If they are <= 0, this is probably an error.  */
 
 void
-x_clear_area (dpy, window, x, y, width, height, exposures)
-     Display *dpy;
-     Window window;
-     int x, y;
-     int width, height;
-     int exposures;
+x_clear_area (Display *dpy, Window window, int x, int y, int width, int height, int exposures)
 {
   xassert (width > 0 && height > 0);
   XClearArea (dpy, window, x, y, width, height, exposures);
@@ -2942,9 +2837,10 @@ x_clear_frame (struct frame *f)
 #if defined (USE_GTK) && defined (USE_TOOLKIT_SCROLL_BARS)
   /* Make sure scroll bars are redrawn.  As they aren't redrawn by
      redisplay, do it here.  */
-  gtk_widget_queue_draw (FRAME_GTK_WIDGET (f));
+  if (FRAME_GTK_WIDGET (f))
+    gtk_widget_queue_draw (FRAME_GTK_WIDGET (f));
 #endif
-  
+
   XFlush (FRAME_X_DISPLAY (f));
 
   UNBLOCK_INPUT;
@@ -2964,8 +2860,7 @@ x_clear_frame (struct frame *f)
    *RESULT.  Return 1 if the difference is negative, otherwise 0.  */
 
 static int
-timeval_subtract (result, x, y)
-     struct timeval *result, x, y;
+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.  */
@@ -2994,8 +2889,7 @@ timeval_subtract (result, x, y)
 }
 
 void
-XTflash (f)
-     struct frame *f;
+XTflash (struct frame *f)
 {
   BLOCK_INPUT;
 
@@ -3003,18 +2897,16 @@ XTflash (f)
 #ifdef USE_GTK
     /* Use Gdk routines to draw.  This way, we won't draw over scroll bars
        when the scroll bars and the edit widget share the same X window.  */
+    GdkWindow *window = gtk_widget_get_window (FRAME_GTK_WIDGET (f));
     GdkGCValues vals;
     GdkGC *gc;
     vals.foreground.pixel = (FRAME_FOREGROUND_PIXEL (f)
                              ^ FRAME_BACKGROUND_PIXEL (f));
     vals.function = GDK_XOR;
-    gc = gdk_gc_new_with_values (FRAME_GTK_WIDGET (f)->window,
-                                 &vals,
-                                 GDK_GC_FUNCTION
-                                 | GDK_GC_FOREGROUND);
+    gc = gdk_gc_new_with_values (window,
+                                 &vals, GDK_GC_FUNCTION | GDK_GC_FOREGROUND);
 #define XFillRectangle(d, win, gc, x, y, w, h) \
-    gdk_draw_rectangle (FRAME_GTK_WIDGET (f)->window, \
-                        gc, TRUE, x, y, w, h)
+    gdk_draw_rectangle (window, gc, TRUE, x, y, w, h)
 #else
     GC gc;
 
@@ -3152,12 +3044,10 @@ XTflash (f)
 
 
 static void
-XTtoggle_invisible_pointer (f, invisible)
-     FRAME_PTR f;
-     int invisible;
+XTtoggle_invisible_pointer (FRAME_PTR f, int invisible)
 {
   BLOCK_INPUT;
-  if (invisible) 
+  if (invisible)
     {
       if (FRAME_X_DISPLAY_INFO (f)->invisible_cursor != 0)
         XDefineCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
@@ -3174,10 +3064,8 @@ XTtoggle_invisible_pointer (f, invisible)
 /* Make audible bell.  */
 
 void
-XTring_bell ()
+XTring_bell (struct frame *f)
 {
-  struct frame *f = SELECTED_FRAME ();
-
   if (FRAME_X_DISPLAY (f))
     {
 #if defined (HAVE_TIMEVAL) && defined (HAVE_SELECT)
@@ -3201,8 +3089,7 @@ XTring_bell ()
    that is bounded by calls to x_update_begin and x_update_end.  */
 
 static void
-XTset_terminal_window (n)
-     register int n;
+XTset_terminal_window (struct frame *f, int n)
 {
   /* This function intentionally left blank.  */
 }
@@ -3217,9 +3104,7 @@ XTset_terminal_window (n)
    lines or deleting -N lines at vertical position VPOS.  */
 
 static void
-x_ins_del_lines (f, vpos, n)
-     struct frame *f;
-     int vpos, n;
+x_ins_del_lines (struct frame *f, int vpos, int n)
 {
   abort ();
 }
@@ -3228,9 +3113,7 @@ x_ins_del_lines (f, vpos, n)
 /* Scroll part of the display as described by RUN.  */
 
 static void
-x_scroll_run (w, run)
-     struct window *w;
-     struct run *run;
+x_scroll_run (struct window *w, struct run *run)
 {
   struct frame *f = XFRAME (w->frame);
   int x, y, width, height, from_y, to_y, bottom_y;
@@ -3287,8 +3170,7 @@ x_scroll_run (w, run)
 
 \f
 static void
-frame_highlight (f)
-     struct frame *f;
+frame_highlight (struct frame *f)
 {
   /* We used to only do this if Vx_no_window_manager was non-nil, but
      the ICCCM (section 4.1.6) says that the window's border pixmap
@@ -3303,8 +3185,7 @@ frame_highlight (f)
 }
 
 static void
-frame_unhighlight (f)
-     struct frame *f;
+frame_unhighlight (struct frame *f)
 {
   /* We used to only do this if Vx_no_window_manager was non-nil, but
      the ICCCM (section 4.1.6) says that the window's border pixmap
@@ -3325,9 +3206,7 @@ frame_unhighlight (f)
    Lisp code can tell when the switch took place by examining the events.  */
 
 static void
-x_new_focus_frame (dpyinfo, frame)
-     struct x_display_info *dpyinfo;
-     struct frame *frame;
+x_new_focus_frame (struct x_display_info *dpyinfo, struct frame *frame)
 {
   struct frame *old_focus = dpyinfo->x_focus_frame;
 
@@ -3354,12 +3233,7 @@ x_new_focus_frame (dpyinfo, frame)
    a FOCUS_IN_EVENT into *BUFP.  */
 
 static void
-x_focus_changed (type, state, dpyinfo, frame, bufp)
-     int type;
-     int state;
-     struct x_display_info *dpyinfo;
-     struct frame *frame;
-     struct input_event *bufp;
+x_focus_changed (int type, int state, struct x_display_info *dpyinfo, struct frame *frame, struct input_event *bufp)
 {
   if (type == FocusIn)
     {
@@ -3411,10 +3285,7 @@ x_focus_changed (type, state, dpyinfo, frame, bufp)
    Returns FOCUS_IN_EVENT event in *BUFP. */
 
 static void
-x_detect_focus_change (dpyinfo, event, bufp)
-     struct x_display_info *dpyinfo;
-     XEvent *event;
-     struct input_event *bufp;
+x_detect_focus_change (struct x_display_info *dpyinfo, XEvent *event, struct input_event *bufp)
 {
   struct frame *frame;
 
@@ -3463,8 +3334,7 @@ x_detect_focus_change (dpyinfo, event, bufp)
 /* Handle an event saying the mouse has moved out of an Emacs frame.  */
 
 void
-x_mouse_leave (dpyinfo)
-     struct x_display_info *dpyinfo;
+x_mouse_leave (struct x_display_info *dpyinfo)
 {
   x_new_focus_frame (dpyinfo, dpyinfo->x_focus_event_frame);
 }
@@ -3478,15 +3348,13 @@ x_mouse_leave (dpyinfo)
    the appropriate X display info.  */
 
 static void
-XTframe_rehighlight (frame)
-     struct frame *frame;
+XTframe_rehighlight (struct frame *frame)
 {
   x_frame_rehighlight (FRAME_X_DISPLAY_INFO (frame));
 }
 
 static void
-x_frame_rehighlight (dpyinfo)
-     struct x_display_info *dpyinfo;
+x_frame_rehighlight (struct x_display_info *dpyinfo)
 {
   struct frame *old_highlight = dpyinfo->x_highlight_frame;
 
@@ -3520,8 +3388,7 @@ x_frame_rehighlight (dpyinfo)
 
 /* Initialize mode_switch_bit and modifier_meaning.  */
 static void
-x_find_modifier_meanings (dpyinfo)
-     struct x_display_info *dpyinfo;
+x_find_modifier_meanings (struct x_display_info *dpyinfo)
 {
   int min_code, max_code;
   KeySym *syms;
@@ -3632,9 +3499,7 @@ x_find_modifier_meanings (dpyinfo)
    Emacs uses.  */
 
 unsigned int
-x_x_to_emacs_modifiers (dpyinfo, state)
-     struct x_display_info *dpyinfo;
-     unsigned int state;
+x_x_to_emacs_modifiers (struct x_display_info *dpyinfo, unsigned int state)
 {
   EMACS_UINT mod_meta = meta_modifier;
   EMACS_UINT mod_alt  = alt_modifier;
@@ -3661,9 +3526,7 @@ x_x_to_emacs_modifiers (dpyinfo, state)
 }
 
 static unsigned int
-x_emacs_to_x_modifiers (dpyinfo, state)
-     struct x_display_info *dpyinfo;
-     unsigned int state;
+x_emacs_to_x_modifiers (struct x_display_info *dpyinfo, unsigned int state)
 {
   EMACS_UINT mod_meta = meta_modifier;
   EMACS_UINT mod_alt  = alt_modifier;
@@ -3693,8 +3556,7 @@ x_emacs_to_x_modifiers (dpyinfo, state)
 /* Convert a keysym to its name.  */
 
 char *
-x_get_keysym_name (keysym)
-     KeySym keysym;
+x_get_keysym_name (int keysym)
 {
   char *value;
 
@@ -3715,10 +3577,7 @@ x_get_keysym_name (keysym)
    the mouse.  */
 
 static Lisp_Object
-construct_mouse_click (result, event, f)
-     struct input_event *result;
-     XButtonEvent *event;
-     struct frame *f;
+construct_mouse_click (struct input_event *result, XButtonEvent *event, struct frame *f)
 {
   /* Make the event type NO_EVENT; we'll change that when we decide
      otherwise.  */
@@ -3751,9 +3610,7 @@ static XMotionEvent last_mouse_motion_event;
 static Lisp_Object last_mouse_motion_frame;
 
 static int
-note_mouse_movement (frame, event)
-     FRAME_PTR frame;
-     XMotionEvent *event;
+note_mouse_movement (FRAME_PTR frame, XMotionEvent *event)
 {
   last_mouse_movement_time = event->time;
   last_mouse_motion_event = *event;
@@ -3797,7 +3654,7 @@ note_mouse_movement (frame, event)
  ************************************************************************/
 
 static void
-redo_mouse_highlight ()
+redo_mouse_highlight (void)
 {
   if (!NILP (last_mouse_motion_frame)
       && FRAME_LIVE_P (XFRAME (last_mouse_motion_frame)))
@@ -3829,13 +3686,7 @@ redo_mouse_highlight ()
    movement.  */
 
 static void
-XTmouse_position (fp, insist, bar_window, part, x, y, time)
-     FRAME_PTR *fp;
-     int insist;
-     Lisp_Object *bar_window;
-     enum scroll_bar_part *part;
-     Lisp_Object *x, *y;
-     unsigned long *time;
+XTmouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window, enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, long unsigned int *time)
 {
   FRAME_PTR f1;
 
@@ -4037,9 +3888,7 @@ XTmouse_position (fp, insist, bar_window, part, x, y, time)
    bits.  */
 
 static struct scroll_bar *
-x_window_to_scroll_bar (display, window_id)
-     Display *display;
-     Window window_id;
+x_window_to_scroll_bar (Display *display, Window window_id)
 {
   Lisp_Object tail;
 
@@ -4084,8 +3933,7 @@ x_window_to_scroll_bar (display, window_id)
    if WINDOW is not part of a menu bar.  */
 
 static Widget
-x_window_to_menu_bar (window)
-     Window window;
+x_window_to_menu_bar (Window window)
 {
   Lisp_Object tail;
 
@@ -4113,12 +3961,12 @@ x_window_to_menu_bar (window)
 
 #ifdef USE_TOOLKIT_SCROLL_BARS
 
-static void x_scroll_bar_to_input_event P_ ((XEvent *, struct input_event *));
-static void x_send_scroll_bar_event P_ ((Lisp_Object, int, int, int));
-static void x_create_toolkit_scroll_bar P_ ((struct frame *,
-                                            struct scroll_bar *));
-static void x_set_toolkit_scroll_bar_thumb P_ ((struct scroll_bar *,
-                                               int, int, int));
+static void x_scroll_bar_to_input_event (XEvent *, struct input_event *);
+static void x_send_scroll_bar_event (Lisp_Object, int, int, int);
+static void x_create_toolkit_scroll_bar (struct frame *,
+                                         struct scroll_bar *);
+static void x_set_toolkit_scroll_bar_thumb (struct scroll_bar *,
+                                            int, int, int);
 
 
 /* Lisp window being scrolled.  Set when starting to interact with
@@ -4152,14 +4000,8 @@ static Boolean xaw3d_pick_top;
    a `end-scroll' SCROLL_BAR_CLICK_EVENT' event if so.  */
 
 static void
-xt_action_hook (widget, client_data, action_name, event, params,
-               num_params)
-     Widget widget;
-     XtPointer client_data;
-     String action_name;
-     XEvent *event;
-     String *params;
-     Cardinal *num_params;
+xt_action_hook (Widget widget, XtPointer client_data, String action_name,
+               XEvent *event, String *params, Cardinal *num_params)
 {
   int scroll_bar_p;
   char *end_action;
@@ -4210,9 +4052,7 @@ static int scroll_bar_windows_size;
    amount to scroll of a whole of WHOLE.  */
 
 static void
-x_send_scroll_bar_event (window, part, portion, whole)
-     Lisp_Object window;
-     int part, portion, whole;
+x_send_scroll_bar_event (Lisp_Object window, int part, int portion, int whole)
 {
   XEvent event;
   XClientMessageEvent *ev = (XClientMessageEvent *) &event;
@@ -4245,7 +4085,7 @@ x_send_scroll_bar_event (window, part, portion, whole)
 
       scroll_bar_windows = (struct window **) xrealloc (scroll_bar_windows,
                                                        nbytes);
-      bzero (&scroll_bar_windows[i], nbytes - old_nbytes);
+      memset (&scroll_bar_windows[i], 0, nbytes - old_nbytes);
       scroll_bar_windows_size = new_size;
     }
 
@@ -4274,9 +4114,7 @@ x_send_scroll_bar_event (window, part, portion, whole)
    in *IEVENT.  */
 
 static void
-x_scroll_bar_to_input_event (event, ievent)
-     XEvent *event;
-     struct input_event *ievent;
+x_scroll_bar_to_input_event (XEvent *event, struct input_event *ievent)
 {
   XClientMessageEvent *ev = (XClientMessageEvent *) event;
   Lisp_Object window;
@@ -4317,9 +4155,7 @@ x_scroll_bar_to_input_event (event, ievent)
    CALL_DATA is a pointer to a XmScrollBarCallbackStruct.  */
 
 static void
-xm_scroll_callback (widget, client_data, call_data)
-     Widget widget;
-     XtPointer client_data, call_data;
+xm_scroll_callback (Widget widget, XtPointer client_data, XtPointer call_data)
 {
   struct scroll_bar *bar = (struct scroll_bar *) client_data;
   XmScrollBarCallbackStruct *cs = (XmScrollBarCallbackStruct *) call_data;
@@ -4414,7 +4250,8 @@ xg_scroll_callback (GtkRange     *range,
           && FRAME_X_DISPLAY_INFO (f)->grabbed < (1 << 4))
         {
           part = scroll_bar_handle;
-          whole = adj->upper - adj->page_size;
+          whole = gtk_adjustment_get_upper (adj) -
+            gtk_adjustment_get_page_size (adj);
           portion = min ((int)position, whole);
           bar->dragging = make_number ((int)portion);
         }
@@ -4475,9 +4312,7 @@ xg_end_scroll_callback (GtkWidget *widget,
    the thumb is.  */
 
 static void
-xaw_jump_callback (widget, client_data, call_data)
-     Widget widget;
-     XtPointer client_data, call_data;
+xaw_jump_callback (Widget widget, XtPointer client_data, XtPointer call_data)
 {
   struct scroll_bar *bar = (struct scroll_bar *) client_data;
   float top = *(float *) call_data;
@@ -4519,9 +4354,7 @@ xaw_jump_callback (widget, client_data, call_data)
    Values < height of scroll bar mean line-wise movement.  */
 
 static void
-xaw_scroll_callback (widget, client_data, call_data)
-     Widget widget;
-     XtPointer client_data, call_data;
+xaw_scroll_callback (Widget widget, XtPointer client_data, XtPointer call_data)
 {
   struct scroll_bar *bar = (struct scroll_bar *) client_data;
   /* The position really is stored cast to a pointer.  */
@@ -4559,11 +4392,9 @@ xaw_scroll_callback (widget, client_data, call_data)
 
 #ifdef USE_GTK
 static void
-x_create_toolkit_scroll_bar (f, bar)
-     struct frame *f;
-     struct scroll_bar *bar;
+x_create_toolkit_scroll_bar (struct frame *f, struct scroll_bar *bar)
 {
-  char *scroll_bar_name = SCROLL_BAR_NAME;
+  const char *scroll_bar_name = SCROLL_BAR_NAME;
 
   BLOCK_INPUT;
   xg_create_scroll_bar (f, bar, G_CALLBACK (xg_scroll_callback),
@@ -4575,9 +4406,7 @@ x_create_toolkit_scroll_bar (f, bar)
 #else /* not USE_GTK */
 
 static void
-x_create_toolkit_scroll_bar (f, bar)
-     struct frame *f;
-     struct scroll_bar *bar;
+x_create_toolkit_scroll_bar (struct frame *f, struct scroll_bar *bar)
 {
   Window xwindow;
   Widget widget;
@@ -4670,7 +4499,7 @@ x_create_toolkit_scroll_bar (f, bar)
   if (f->output_data.x->scroll_bar_top_shadow_pixel == -1)
     {
       pixel = f->output_data.x->scroll_bar_background_pixel;
-      if (pixel != -1) 
+      if (pixel != -1)
         {
           if (!x_alloc_lighter_color (f, FRAME_X_DISPLAY (f),
                                       FRAME_X_COLORMAP (f),
@@ -4682,7 +4511,7 @@ x_create_toolkit_scroll_bar (f, bar)
   if (f->output_data.x->scroll_bar_bottom_shadow_pixel == -1)
     {
       pixel = f->output_data.x->scroll_bar_background_pixel;
-      if (pixel != -1) 
+      if (pixel != -1)
         {
           if (!x_alloc_lighter_color (f, FRAME_X_DISPLAY (f),
                                       FRAME_X_COLORMAP (f),
@@ -4698,8 +4527,11 @@ x_create_toolkit_scroll_bar (f, bar)
       || f->output_data.x->scroll_bar_bottom_shadow_pixel == -1)
     /* We tried to allocate a color for the top/bottom shadow, and
        failed, so tell Xaw3d to use dithering instead.   */
+    /* But only if we have a small colormap.  Xaw3d can allocate nice
+       colors itself.  */
     {
-      XtSetArg (av[ac], XtNbeNiceToColormap, True);
+      XtSetArg (av[ac], XtNbeNiceToColormap,
+                DefaultDepthOfScreen (FRAME_X_SCREEN (f)) < 16);
       ++ac;
     }
   else
@@ -4777,18 +4609,15 @@ x_create_toolkit_scroll_bar (f, bar)
 
 #ifdef USE_GTK
 static void
-x_set_toolkit_scroll_bar_thumb (bar, portion, position, whole)
-     struct scroll_bar *bar;
-     int portion, position, whole;
+x_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar, int portion, int position, int whole)
 {
   xg_set_toolkit_scroll_bar_thumb (bar, portion, position, whole);
 }
 
 #else /* not USE_GTK */
 static void
-x_set_toolkit_scroll_bar_thumb (bar, portion, position, whole)
-     struct scroll_bar *bar;
-     int portion, position, whole;
+x_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar, int portion, int position,
+                               int whole)
 {
   struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window)));
   Widget widget = SCROLL_BAR_X_WIDGET (FRAME_X_DISPLAY (f), bar);
@@ -4903,9 +4732,7 @@ x_set_toolkit_scroll_bar_thumb (bar, portion, position, whole)
    scroll bar. */
 
 static struct scroll_bar *
-x_scroll_bar_create (w, top, left, width, height)
-     struct window *w;
-     int top, left, width, height;
+x_scroll_bar_create (struct window *w, int top, int left, int width, int height)
 {
   struct frame *f = XFRAME (w->frame);
   struct scroll_bar *bar
@@ -4984,7 +4811,6 @@ x_scroll_bar_create (w, top, left, width, height)
                              left + VERTICAL_SCROLL_BAR_WIDTH_TRIM,
                              width - VERTICAL_SCROLL_BAR_WIDTH_TRIM * 2,
                              max (height, 1));
-    xg_show_scroll_bar (bar->x_window);
 #else /* not USE_GTK */
     Widget scroll_bar = SCROLL_BAR_X_WIDGET (FRAME_X_DISPLAY (f), bar);
     XtConfigureWidget (scroll_bar,
@@ -5020,10 +4846,7 @@ x_scroll_bar_create (w, top, left, width, height)
    to move to the very end of the buffer.  */
 
 static void
-x_scroll_bar_set_handle (bar, start, end, rebuild)
-     struct scroll_bar *bar;
-     int start, end;
-     int rebuild;
+x_scroll_bar_set_handle (struct scroll_bar *bar, int start, int end, int rebuild)
 {
   int dragging = ! NILP (bar->dragging);
   Window w = bar->x_window;
@@ -5121,8 +4944,7 @@ x_scroll_bar_set_handle (bar, start, end, rebuild)
    nil.  */
 
 static void
-x_scroll_bar_remove (bar)
-     struct scroll_bar *bar;
+x_scroll_bar_remove (struct scroll_bar *bar)
 {
   struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window)));
   BLOCK_INPUT;
@@ -5150,9 +4972,7 @@ x_scroll_bar_remove (bar)
    create one.  */
 
 static void
-XTset_vertical_scroll_bar (w, portion, whole, position)
-     struct window *w;
-     int portion, whole, position;
+XTset_vertical_scroll_bar (struct window *w, int portion, int whole, int position)
 {
   struct frame *f = XFRAME (w->frame);
   struct scroll_bar *bar;
@@ -5369,8 +5189,7 @@ XTset_vertical_scroll_bar (w, portion, whole, position)
    `*redeem_scroll_bar_hook' is applied to its window before the judgment.  */
 
 static void
-XTcondemn_scroll_bars (frame)
-     FRAME_PTR frame;
+XTcondemn_scroll_bars (FRAME_PTR frame)
 {
   /* Transfer all the scroll bars to FRAME_CONDEMNED_SCROLL_BARS.  */
   while (! NILP (FRAME_SCROLL_BARS (frame)))
@@ -5391,8 +5210,7 @@ XTcondemn_scroll_bars (frame)
    Note that WINDOW isn't necessarily condemned at all.  */
 
 static void
-XTredeem_scroll_bar (window)
-     struct window *window;
+XTredeem_scroll_bar (struct window *window)
 {
   struct scroll_bar *bar;
   struct frame *f;
@@ -5437,8 +5255,7 @@ XTredeem_scroll_bar (window)
    last call to `*condemn_scroll_bars_hook'.  */
 
 static void
-XTjudge_scroll_bars (f)
-     FRAME_PTR f;
+XTjudge_scroll_bars (FRAME_PTR f)
 {
   Lisp_Object bar, next;
 
@@ -5471,9 +5288,7 @@ XTjudge_scroll_bars (f)
    mark bits.  */
 
 static void
-x_scroll_bar_expose (bar, event)
-     struct scroll_bar *bar;
-     XEvent *event;
+x_scroll_bar_expose (struct scroll_bar *bar, XEvent *event)
 {
   Window w = bar->x_window;
   FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window)));
@@ -5515,10 +5330,7 @@ x_scroll_bar_expose (bar, event)
 
 
 static void
-x_scroll_bar_handle_click (bar, event, emacs_event)
-     struct scroll_bar *bar;
-     XEvent *event;
-     struct input_event *emacs_event;
+x_scroll_bar_handle_click (struct scroll_bar *bar, XEvent *event, struct input_event *emacs_event)
 {
   if (! WINDOWP (bar->window))
     abort ();
@@ -5576,9 +5388,7 @@ x_scroll_bar_handle_click (bar, event, emacs_event)
    mark bits.  */
 
 static void
-x_scroll_bar_note_movement (bar, event)
-     struct scroll_bar *bar;
-     XEvent *event;
+x_scroll_bar_note_movement (struct scroll_bar *bar, XEvent *event)
 {
   FRAME_PTR f = XFRAME (XWINDOW (bar->window)->frame);
 
@@ -5608,12 +5418,7 @@ x_scroll_bar_note_movement (bar, event)
    on the scroll bar.  */
 
 static void
-x_scroll_bar_report_motion (fp, bar_window, part, x, y, time)
-     FRAME_PTR *fp;
-     Lisp_Object *bar_window;
-     enum scroll_bar_part *part;
-     Lisp_Object *x, *y;
-     unsigned long *time;
+x_scroll_bar_report_motion (FRAME_PTR *fp, Lisp_Object *bar_window, enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, long unsigned int *time)
 {
   struct scroll_bar *bar = XSCROLL_BAR (last_mouse_scroll_bar);
   Window w = bar->x_window;
@@ -5685,8 +5490,7 @@ x_scroll_bar_report_motion (fp, bar_window, part, x, y, time)
    redraw them.  */
 
 void
-x_scroll_bar_clear (f)
-     FRAME_PTR f;
+x_scroll_bar_clear (FRAME_PTR f)
 {
 #ifndef USE_TOOLKIT_SCROLL_BARS
   Lisp_Object bar;
@@ -5739,22 +5543,18 @@ struct x_display_info *XTread_socket_fake_io_error;
 
 static struct x_display_info *next_noop_dpyinfo;
 
-#define SET_SAVED_MENU_EVENT(size)                                     \
+#define SET_SAVED_BUTTON_EVENT                                          \
      do                                                                        \
        {                                                               \
         if (f->output_data.x->saved_menu_event == 0)                   \
            f->output_data.x->saved_menu_event                          \
             = (XEvent *) xmalloc (sizeof (XEvent));                    \
-         bcopy (&event, f->output_data.x->saved_menu_event, size);     \
+         *f->output_data.x->saved_menu_event = event;                   \
         inev.ie.kind = MENU_BAR_ACTIVATE_EVENT;                        \
         XSETFRAME (inev.ie.frame_or_window, f);                        \
        }                                                               \
      while (0)
 
-#define SET_SAVED_BUTTON_EVENT SET_SAVED_MENU_EVENT (sizeof (XButtonEvent))
-#define SET_SAVED_KEY_EVENT    SET_SAVED_MENU_EVENT (sizeof (XKeyEvent))
-
-
 enum
 {
   X_EVENT_NORMAL,
@@ -5772,9 +5572,7 @@ enum
 
 #ifdef HAVE_X_I18N
 static int
-x_filter_event (dpyinfo, event)
-     struct x_display_info *dpyinfo;
-     XEvent *event;
+x_filter_event (struct x_display_info *dpyinfo, XEvent *event)
 {
   /* XFilterEvent returns non-zero if the input method has
    consumed the event.  We pass the frame's X window to
@@ -5797,10 +5595,7 @@ static struct input_event *current_hold_quit;
    It is invoked before the XEvent is translated to a GdkEvent,
    so we have a chance to act on the event before GTK. */
 static GdkFilterReturn
-event_handler_gdk (gxev, ev, data)
-     GdkXEvent *gxev;
-     GdkEvent *ev;
-     gpointer data;
+event_handler_gdk (GdkXEvent *gxev, GdkEvent *ev, gpointer data)
 {
   XEvent *xev = (XEvent *) gxev;
 
@@ -5853,11 +5648,7 @@ event_handler_gdk (gxev, ev, data)
    We return the number of characters stored into the buffer. */
 
 static int
-handle_one_xevent (dpyinfo, eventp, finish, hold_quit)
-     struct x_display_info *dpyinfo;
-     XEvent *eventp;
-     int *finish;
-     struct input_event *hold_quit;
+handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish, struct input_event *hold_quit)
 {
   union {
     struct input_event ie;
@@ -5875,10 +5666,10 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit)
   EVENT_INIT (inev.ie);
   inev.ie.kind = NO_EVENT;
   inev.ie.arg = Qnil;
-  
+
   if (pending_event_wait.eventtype == event.type)
     pending_event_wait.eventtype = 0; /* Indicates we got it.  */
-  
+
   switch (event.type)
     {
     case ClientMessage:
@@ -6391,7 +6182,7 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit)
              this enables ComposeCharacter to work whether or
              not it is combined with Meta.  */
           if (modifiers & dpyinfo->meta_mod_mask)
-            bzero (&compose_status, sizeof (compose_status));
+            memset (&compose_status, 0, sizeof (compose_status));
 
 #ifdef HAVE_X_I18N
           if (FRAME_XIC (f))
@@ -6439,7 +6230,7 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit)
           if (compose_status.chars_matched > 0 && nbytes == 0)
             break;
 
-          bzero (&compose_status, sizeof (compose_status));
+          memset (&compose_status, 0, sizeof (compose_status));
           orig_keysym = keysym;
 
          /* Common for all keysym input events.  */
@@ -6798,7 +6589,7 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit)
                             event.xconfigure.height);
           f = 0;
         }
-#endif  
+#endif
       if (f)
         {
 #ifndef USE_X_TOOLKIT
@@ -6832,7 +6623,7 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit)
           /* GTK creates windows but doesn't map them.
              Only get real positions when mapped. */
           if (FRAME_GTK_OUTER_WIDGET (f)
-              && GTK_WIDGET_MAPPED (FRAME_GTK_OUTER_WIDGET (f)))
+              && gtk_widget_get_mapped (FRAME_GTK_OUTER_WIDGET (f)))
 #endif
             {
              x_real_positions (f, &f->left_pos, &f->top_pos);
@@ -6853,7 +6644,7 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit)
            by the rest of Emacs, we put it here.  */
         int tool_bar_p = 0;
 
-        bzero (&compose_status, sizeof (compose_status));
+        memset (&compose_status, 0, sizeof (compose_status));
        last_mouse_glyph_frame = 0;
         last_user_time = event.xbutton.time;
 
@@ -6957,14 +6748,12 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit)
            Instead, save it away
            and we will pass it to Xt from kbd_buffer_get_event.
            That way, we can run some Lisp code first.  */
-        if (
+        if (! popup_activated ()
 #ifdef USE_GTK
-            ! popup_activated ()
             /* Gtk+ menus only react to the first three buttons. */
             && event.xbutton.button < 3
-            &&
 #endif
-            f && event.type == ButtonPress
+            && f && event.type == ButtonPress
             /* Verify the event is really within the menu bar
                and not just sent to it due to grabbing.  */
             && event.xbutton.x >= 0
@@ -6975,30 +6764,13 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit)
           {
             SET_SAVED_BUTTON_EVENT;
             XSETFRAME (last_mouse_press_frame, f);
-#ifdef USE_GTK
             *finish = X_EVENT_DROP;
-#endif
           }
         else if (event.type == ButtonPress)
           {
             last_mouse_press_frame = Qnil;
             goto OTHER;
           }
-
-#ifdef USE_MOTIF /* This should do not harm for Lucid,
-                   but I am trying to be cautious.  */
-        else if (event.type == ButtonRelease)
-          {
-            if (!NILP (last_mouse_press_frame))
-              {
-                f = XFRAME (last_mouse_press_frame);
-                if (f->output_data.x)
-                  SET_SAVED_BUTTON_EVENT;
-              }
-            else
-              goto OTHER;
-          }
-#endif /* USE_MOTIF */
         else
           goto OTHER;
 #endif /* USE_X_TOOLKIT || USE_GTK */
@@ -7084,9 +6856,7 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit)
 
    Returns the value handle_one_xevent sets in the finish argument.  */
 int
-x_dispatch_event (event, display)
-     XEvent *event;
-     Display *display;
+x_dispatch_event (XEvent *event, Display *display)
 {
   struct x_display_info *dpyinfo;
   int finish = X_EVENT_NORMAL;
@@ -7112,10 +6882,7 @@ x_dispatch_event (event, display)
    EXPECTED is nonzero if the caller knows input is available.  */
 
 static int
-XTread_socket (terminal, expected, hold_quit)
-     struct terminal *terminal;
-     int expected;
-     struct input_event *hold_quit;
+XTread_socket (struct terminal *terminal, int expected, struct input_event *hold_quit)
 {
   int count = 0;
   XEvent event;
@@ -7266,11 +7033,7 @@ XTread_socket (terminal, expected, hold_quit)
    mode lines must be clipped to the whole window.  */
 
 static void
-x_clip_to_row (w, row, area, gc)
-     struct window *w;
-     struct glyph_row *row;
-     int area;
-     GC gc;
+x_clip_to_row (struct window *w, struct glyph_row *row, int area, GC gc)
 {
   struct frame *f = XFRAME (WINDOW_FRAME (w));
   XRectangle clip_rect;
@@ -7291,9 +7054,7 @@ x_clip_to_row (w, row, area, gc)
 /* Draw a hollow box cursor on window W in glyph row ROW.  */
 
 static void
-x_draw_hollow_cursor (w, row)
-     struct window *w;
-     struct glyph_row *row;
+x_draw_hollow_cursor (struct window *w, struct glyph_row *row)
 {
   struct frame *f = XFRAME (WINDOW_FRAME (w));
   struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
@@ -7338,11 +7099,7 @@ x_draw_hollow_cursor (w, row)
    --gerd.  */
 
 static void
-x_draw_bar_cursor (w, row, width, kind)
-     struct window *w;
-     struct glyph_row *row;
-     int width;
-     enum text_cursor_kinds kind;
+x_draw_bar_cursor (struct window *w, struct glyph_row *row, int width, enum text_cursor_kinds kind)
 {
   struct frame *f = XFRAME (w->frame);
   struct glyph *cursor_glyph;
@@ -7395,14 +7152,20 @@ x_draw_bar_cursor (w, row, width, kind)
 
       if (kind == BAR_CURSOR)
        {
+         int x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x);
+
          if (width < 0)
            width = FRAME_CURSOR_WIDTH (f);
          width = min (cursor_glyph->pixel_width, width);
 
          w->phys_cursor_width = width;
 
-         XFillRectangle (dpy, window, gc,
-                         WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x),
+         /* If the character under cursor is R2L, draw the bar cursor
+            on the right of its glyph, rather than on the left.  */
+         if ((cursor_glyph->resolved_level & 1) != 0)
+           x += cursor_glyph->pixel_width - width;
+
+         XFillRectangle (dpy, window, gc, x,
                          WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y),
                          width, row->height);
        }
@@ -7433,9 +7196,7 @@ x_draw_bar_cursor (w, row, width, kind)
 /* RIF: Define cursor CURSOR on frame F.  */
 
 static void
-x_define_frame_cursor (f, cursor)
-     struct frame *f;
-     Cursor cursor;
+x_define_frame_cursor (struct frame *f, Cursor cursor)
 {
   if (!f->pointer_invisible
       && f->output_data.x->current_cursor != cursor)
@@ -7447,9 +7208,7 @@ x_define_frame_cursor (f, cursor)
 /* RIF: Clear area on frame F.  */
 
 static void
-x_clear_frame_area (f, x, y, width, height)
-     struct frame *f;
-     int x, y, width, height;
+x_clear_frame_area (struct frame *f, int x, int y, int width, int height)
 {
   x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
                x, y, width, height, False);
@@ -7464,12 +7223,7 @@ x_clear_frame_area (f, x, y, width, height)
 /* RIF: Draw cursor on window W.  */
 
 static void
-x_draw_window_cursor (w, glyph_row, x, y, cursor_type, cursor_width, on_p, active_p)
-     struct window *w;
-     struct glyph_row *glyph_row;
-     int x, y;
-     int cursor_type, cursor_width;
-     int on_p, active_p;
+x_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)
 {
   struct frame *f = XFRAME (WINDOW_FRAME (w));
 
@@ -7479,36 +7233,40 @@ x_draw_window_cursor (w, glyph_row, x, y, cursor_type, cursor_width, on_p, activ
       w->phys_cursor_on_p = 1;
 
       if (glyph_row->exact_window_width_line_p
-         && w->phys_cursor.hpos >= glyph_row->used[TEXT_AREA])
+         && (glyph_row->reversed_p
+             ? (w->phys_cursor.hpos < 0)
+             : (w->phys_cursor.hpos >= glyph_row->used[TEXT_AREA])))
        {
          glyph_row->cursor_in_fringe_p = 1;
-         draw_fringe_bitmap (w, glyph_row, 0);
+         draw_fringe_bitmap (w, glyph_row, glyph_row->reversed_p);
        }
       else
-      switch (cursor_type)
        {
-       case HOLLOW_BOX_CURSOR:
-         x_draw_hollow_cursor (w, glyph_row);
-         break;
+         switch (cursor_type)
+           {
+           case HOLLOW_BOX_CURSOR:
+             x_draw_hollow_cursor (w, glyph_row);
+             break;
 
-       case FILLED_BOX_CURSOR:
-         draw_phys_cursor_glyph (w, glyph_row, DRAW_CURSOR);
-         break;
+           case FILLED_BOX_CURSOR:
+             draw_phys_cursor_glyph (w, glyph_row, DRAW_CURSOR);
+             break;
 
-       case BAR_CURSOR:
-         x_draw_bar_cursor (w, glyph_row, cursor_width, BAR_CURSOR);
-         break;
+           case BAR_CURSOR:
+             x_draw_bar_cursor (w, glyph_row, cursor_width, BAR_CURSOR);
+             break;
 
-       case HBAR_CURSOR:
-         x_draw_bar_cursor (w, glyph_row, cursor_width, HBAR_CURSOR);
-         break;
+           case HBAR_CURSOR:
+             x_draw_bar_cursor (w, glyph_row, cursor_width, HBAR_CURSOR);
+             break;
 
-       case NO_CURSOR:
-         w->phys_cursor_width = 0;
-         break;
+           case NO_CURSOR:
+             w->phys_cursor_width = 0;
+             break;
 
-       default:
-         abort ();
+           default:
+             abort ();
+           }
        }
 
 #ifdef HAVE_X_I18N
@@ -7529,9 +7287,7 @@ x_draw_window_cursor (w, glyph_row, x, y, cursor_type, cursor_width, on_p, activ
 /* Make the x-window of frame F use the gnu icon bitmap.  */
 
 int
-x_bitmap_icon (f, file)
-     struct frame *f;
-     Lisp_Object file;
+x_bitmap_icon (struct frame *f, Lisp_Object file)
 {
   int bitmap_id;
 
@@ -7608,9 +7364,7 @@ x_bitmap_icon (f, file)
    Use ICON_NAME as the text.  */
 
 int
-x_text_icon (f, icon_name)
-     struct frame *f;
-     char *icon_name;
+x_text_icon (struct frame *f, const char *icon_name)
 {
   if (FRAME_X_WINDOW (f) == 0)
     return 1;
@@ -7653,9 +7407,7 @@ static struct x_error_message_stack *x_error_message;
    x_catch_errors is in effect.  */
 
 static void
-x_error_catcher (display, error)
-     Display *display;
-     XErrorEvent *error;
+x_error_catcher (Display *display, XErrorEvent *error)
 {
   XGetErrorText (display, error->error_code,
                 x_error_message->string,
@@ -7675,11 +7427,10 @@ x_error_catcher (display, error)
 
    Calling x_uncatch_errors resumes the normal error handling.  */
 
-void x_check_errors ();
+void x_check_errors (Display *dpy, const char *format);
 
 void
-x_catch_errors (dpy)
-     Display *dpy;
+x_catch_errors (Display *dpy)
 {
   struct x_error_message_stack *data = xmalloc (sizeof (*data));
 
@@ -7696,7 +7447,7 @@ x_catch_errors (dpy)
    DPY should be the display that was passed to x_catch_errors.  */
 
 void
-x_uncatch_errors ()
+x_uncatch_errors (void)
 {
   struct x_error_message_stack *tmp;
 
@@ -7718,9 +7469,7 @@ x_uncatch_errors ()
    sprintf (a buffer, FORMAT, the x error message text) as the text.  */
 
 void
-x_check_errors (dpy, format)
-     Display *dpy;
-     char *format;
+x_check_errors (Display *dpy, const char *format)
 {
   /* Make sure to catch any errors incurred so far.  */
   XSync (dpy, False);
@@ -7728,7 +7477,7 @@ x_check_errors (dpy, format)
   if (x_error_message->string[0])
     {
       char string[X_ERROR_MESSAGE_SIZE];
-      bcopy (x_error_message->string, string, X_ERROR_MESSAGE_SIZE);
+      memcpy (string, x_error_message->string, X_ERROR_MESSAGE_SIZE);
       x_uncatch_errors ();
       error (format, string);
     }
@@ -7738,8 +7487,7 @@ x_check_errors (dpy, format)
    since we did x_catch_errors on DPY.  */
 
 int
-x_had_errors_p (dpy)
-     Display *dpy;
+x_had_errors_p (Display *dpy)
 {
   /* Make sure to catch any errors incurred so far.  */
   XSync (dpy, False);
@@ -7750,8 +7498,7 @@ x_had_errors_p (dpy)
 /* Forget about any errors we have had, since we did x_catch_errors on DPY.  */
 
 void
-x_clear_errors (dpy)
-     Display *dpy;
+x_clear_errors (Display *dpy)
 {
   x_error_message->string[0] = 0;
 }
@@ -7761,7 +7508,7 @@ x_clear_errors (dpy)
 /* Close off all unclosed x_catch_errors calls.  */
 
 void
-x_fully_uncatch_errors ()
+x_fully_uncatch_errors (void)
 {
   while (x_error_message)
     x_uncatch_errors ();
@@ -7771,14 +7518,14 @@ x_fully_uncatch_errors ()
 /* Nonzero if x_catch_errors has been done and not yet canceled.  */
 
 int
-x_catching_errors ()
+x_catching_errors (void)
 {
   return x_error_message != 0;
 }
 
 #if 0
 static unsigned int x_wire_count;
-x_trace_wire ()
+x_trace_wire (void)
 {
   fprintf (stderr, "Lib call: %d\n", ++x_wire_count);
 }
@@ -7792,8 +7539,8 @@ x_trace_wire ()
    which will do the appropriate cleanup for us.  */
 
 static SIGTYPE
-x_connection_signal (signalnum)        /* If we don't have an argument, */
-     int signalnum;            /* some compilers complain in signal calls.  */
+x_connection_signal (int signalnum)    /* If we don't have an argument, */
+                               /* some compilers complain in signal calls.  */
 {
 #ifdef USG
   /* USG systems forget handlers when they are used;
@@ -7816,7 +7563,7 @@ static char *error_msg;
    instead of dumping core when XtCloseDisplay fails.  */
 
 static void
-x_fatal_error_signal ()
+x_fatal_error_signal (void)
 {
   fprintf (stderr, "%s\n", error_msg);
   exit (70);
@@ -7826,9 +7573,7 @@ x_fatal_error_signal ()
    the text of an error message that lead to the connection loss.  */
 
 static SIGTYPE
-x_connection_closed (dpy, error_message)
-     Display *dpy;
-     char *error_message;
+x_connection_closed (Display *dpy, const char *error_message)
 {
   struct x_display_info *dpyinfo = x_display_info_for_display (dpy);
   Lisp_Object frame, tail;
@@ -7903,7 +7648,6 @@ x_connection_closed (dpy, error_message)
       /* If DPYINFO is null, this means we didn't open the display
         in the first place, so don't try to close it.  */
       {
-       extern void (*fatal_error_signal_hook) P_ ((void));
        fatal_error_signal_hook = x_fatal_error_signal;
        XtCloseDisplay (dpy);
        fatal_error_signal_hook = NULL;
@@ -7916,8 +7660,8 @@ x_connection_closed (dpy, error_message)
       if (terminal_list->next_terminal == NULL)
         {
           fprintf (stderr, "%s\n", error_msg);
-          shut_down_emacs (0, 0, Qnil);
-          exit (70);
+          Fkill_emacs (make_number (70));
+          /* NOTREACHED */
         }
       xg_display_close (dpyinfo->display);
 #endif
@@ -7943,8 +7687,8 @@ x_connection_closed (dpy, error_message)
   if (terminal_list == 0)
     {
       fprintf (stderr, "%s\n", error_msg);
-      shut_down_emacs (0, 0, Qnil);
-      exit (70);
+      Fkill_emacs (make_number (70));
+      /* NOTREACHED */
     }
 
   /* Ordinary stack unwind doesn't deal with these.  */
@@ -7964,15 +7708,13 @@ x_connection_closed (dpy, error_message)
 
 /* We specifically use it before defining it, so that gcc doesn't inline it,
    otherwise gdb doesn't know how to properly put a breakpoint on it.  */
-static void x_error_quitter P_ ((Display *, XErrorEvent *));
+static void x_error_quitter (Display *, XErrorEvent *);
 
 /* This is the first-level handler for X protocol errors.
    It calls x_error_quitter or x_error_catcher.  */
 
 static int
-x_error_handler (display, error)
-     Display *display;
-     XErrorEvent *error;
+x_error_handler (Display *display, XErrorEvent *error)
 {
   if (x_error_message)
     x_error_catcher (display, error);
@@ -8003,9 +7745,7 @@ x_error_handler (display, error)
    after x_error_handler prevents inlining into the former.  */
 
 static void NO_INLINE
-x_error_quitter (display, error)
-     Display *display;
-     XErrorEvent *error;
+x_error_quitter (Display *display, XErrorEvent *error)
 {
   char buf[256], buf1[356];
 
@@ -8030,8 +7770,7 @@ x_error_quitter (display, error)
    If that was the only one, it prints an error message and kills Emacs.  */
 
 static int
-x_io_error_quitter (display)
-     Display *display;
+x_io_error_quitter (Display *display)
 {
   char buf[256];
 
@@ -8048,10 +7787,7 @@ x_io_error_quitter (display)
    FONT-OBJECT.  */
 
 Lisp_Object
-x_new_font (f, font_object, fontset)
-     struct frame *f;
-     Lisp_Object font_object;
-     int fontset;
+x_new_font (struct frame *f, Lisp_Object font_object, int fontset)
 {
   struct font *font = XFONT_OBJECT (font_object);
 
@@ -8120,10 +7856,7 @@ x_new_font (f, font_object, fontset)
    pointer to the x_display_info structure corresponding to XIM.  */
 
 static void
-xim_destroy_callback (xim, client_data, call_data)
-     XIM xim;
-     XPointer client_data;
-     XPointer call_data;
+xim_destroy_callback (XIM xim, XPointer client_data, XPointer call_data)
 {
   struct x_display_info *dpyinfo = (struct x_display_info *) client_data;
   Lisp_Object frame, tail;
@@ -8151,16 +7884,14 @@ xim_destroy_callback (xim, client_data, call_data)
 
 #ifdef HAVE_X11R6
 /* This isn't prototyped in OSF 5.0 or 5.1a.  */
-extern char *XSetIMValues P_ ((XIM, ...));
+extern char *XSetIMValues (XIM, ...);
 #endif
 
 /* Open the connection to the XIM server on display DPYINFO.
    RESOURCE_NAME is the resource name Emacs uses.  */
 
 static void
-xim_open_dpy (dpyinfo, resource_name)
-     struct x_display_info *dpyinfo;
-     char *resource_name;
+xim_open_dpy (struct x_display_info *dpyinfo, char *resource_name)
 {
   XIM xim;
 
@@ -8170,7 +7901,7 @@ xim_open_dpy (dpyinfo, resource_name)
       if (dpyinfo->xim)
        XCloseIM (dpyinfo->xim);
       xim = XOpenIM (dpyinfo->display, dpyinfo->xrdb, resource_name,
-                    EMACS_CLASS);
+                    emacs_class);
       dpyinfo->xim = xim;
 
       if (xim)
@@ -8204,10 +7935,7 @@ xim_open_dpy (dpyinfo, resource_name)
    when the callback was registered.  */
 
 static void
-xim_instantiate_callback (display, client_data, call_data)
-     Display *display;
-     XPointer client_data;
-     XPointer call_data;
+xim_instantiate_callback (Display *display, XPointer client_data, XPointer call_data)
 {
   struct xim_inst_t *xim_inst = (struct xim_inst_t *) client_data;
   struct x_display_info *dpyinfo = xim_inst->dpyinfo;
@@ -8257,9 +7985,7 @@ xim_instantiate_callback (display, client_data, call_data)
    in the XIM instantiate callback function.  */
 
 static void
-xim_initialize (dpyinfo, resource_name)
-     struct x_display_info *dpyinfo;
-     char *resource_name;
+xim_initialize (struct x_display_info *dpyinfo, char *resource_name)
 {
   dpyinfo->xim = NULL;
 #ifdef HAVE_XIM
@@ -8274,9 +8000,9 @@ xim_initialize (dpyinfo, resource_name)
       xim_inst->dpyinfo = dpyinfo;
       len = strlen (resource_name);
       xim_inst->resource_name = (char *) xmalloc (len + 1);
-      bcopy (resource_name, xim_inst->resource_name, len + 1);
+      memcpy (xim_inst->resource_name, resource_name, len + 1);
       XRegisterIMInstantiateCallback (dpyinfo->display, dpyinfo->xrdb,
-                                     resource_name, EMACS_CLASS,
+                                     resource_name, emacs_class,
                                      xim_instantiate_callback,
                                      /* This is XPointer in XFree86
                                         but (XPointer *) on Tru64, at
@@ -8293,8 +8019,7 @@ xim_initialize (dpyinfo, resource_name)
 /* Close the connection to the XIM server on display DPYINFO. */
 
 static void
-xim_close_dpy (dpyinfo)
-     struct x_display_info *dpyinfo;
+xim_close_dpy (struct x_display_info *dpyinfo)
 {
 #ifdef HAVE_XIM
   if (use_xim)
@@ -8302,7 +8027,7 @@ xim_close_dpy (dpyinfo)
 #ifdef HAVE_X11R6_XIM
       if (dpyinfo->display)
        XUnregisterIMInstantiateCallback (dpyinfo->display, dpyinfo->xrdb,
-                                         NULL, EMACS_CLASS,
+                                         NULL, emacs_class,
                                          xim_instantiate_callback, NULL);
       xfree (dpyinfo->xim_callback_data->resource_name);
       xfree (dpyinfo->xim_callback_data);
@@ -8323,8 +8048,7 @@ xim_close_dpy (dpyinfo)
    from its current recorded position values and gravity.  */
 
 void
-x_calc_absolute_position (f)
-     struct frame *f;
+x_calc_absolute_position (struct frame *f)
 {
   int flags = f->size_hint_flags;
 
@@ -8376,10 +8100,7 @@ x_calc_absolute_position (f)
    which means, do adjust for borders but don't change the gravity.  */
 
 void
-x_set_offset (f, xoff, yoff, change_gravity)
-     struct frame *f;
-     register int xoff, yoff;
-     int change_gravity;
+x_set_offset (struct frame *f, register int xoff, register int yoff, int change_gravity)
 {
   int modified_top, modified_left;
 
@@ -8448,9 +8169,7 @@ x_set_offset (f, xoff, yoff, change_gravity)
    http://freedesktop.org/wiki/Specifications/wm-spec.  */
 
 static int
-wm_supports (f, atomname)
-     struct frame *f;
-     const char *atomname;
+wm_supports (struct frame *f, const char *atomname)
 {
   Atom actual_type;
   unsigned long actual_size, bytes_remaining;
@@ -8539,11 +8258,7 @@ wm_supports (f, atomname)
 }
 
 static void
-set_wm_state (frame, add, what, what2)
-     Lisp_Object frame;
-     int add;
-     const char *what;
-     const char *what2;
+set_wm_state (Lisp_Object frame, int add, const char *what, const char *what2)
 {
   const char *atom = "_NET_WM_STATE";
   Fx_send_client_event (frame, make_number (0), frame,
@@ -8561,9 +8276,7 @@ set_wm_state (frame, add, what, what2)
 }
 
 void
-x_set_sticky (f, new_value, old_value)
-     struct frame *f;
-     Lisp_Object new_value, old_value;
+x_set_sticky (struct frame *f, Lisp_Object new_value, Lisp_Object old_value)
 {
   Lisp_Object frame;
 
@@ -8575,8 +8288,7 @@ x_set_sticky (f, new_value, old_value)
 /* Do fullscreen as specified in extended window manager hints */
 
 static int
-do_ewmh_fullscreen (f)
-     struct frame *f;
+do_ewmh_fullscreen (struct frame *f)
 {
   int have_net_atom = wm_supports (f, "_NET_WM_STATE");
 
@@ -8597,7 +8309,7 @@ do_ewmh_fullscreen (f)
       set_wm_state (frame, 0, fs, NULL);
       set_wm_state (frame, 0, fh, NULL);
       set_wm_state (frame, 0, fw, NULL);
-      
+
       /* If there are _NET_ atoms we assume we have extended window manager
          hints.  */
       switch (f->want_fullscreen)
@@ -8624,8 +8336,7 @@ do_ewmh_fullscreen (f)
 }
 
 static void
-XTfullscreen_hook (f)
-     FRAME_PTR f;
+XTfullscreen_hook (FRAME_PTR f)
 {
   if (f->async_visible)
     {
@@ -8638,9 +8349,7 @@ XTfullscreen_hook (f)
 
 
 static void
-x_handle_net_wm_state (f, event)
-     struct frame *f;
-     XPropertyEvent *event;
+x_handle_net_wm_state (struct frame *f, XPropertyEvent *event)
 {
   Atom actual_type;
   unsigned long actual_size, bytes_remaining;
@@ -8673,7 +8382,7 @@ x_handle_net_wm_state (f, event)
   for (i = 0; i < actual_size; ++i)
     {
       Atom a = ((Atom*)tmp_data)[i];
-      if (a == dpyinfo->Xatom_net_wm_state_maximized_horz) 
+      if (a == dpyinfo->Xatom_net_wm_state_maximized_horz)
         {
           if (value == FULLSCREEN_HEIGHT)
             value = FULLSCREEN_MAXIMIZED;
@@ -8694,7 +8403,7 @@ x_handle_net_wm_state (f, event)
     }
 
   lval = Qnil;
-  switch (value) 
+  switch (value)
     {
     case FULLSCREEN_WIDTH:
       lval = Qfullwidth;
@@ -8709,7 +8418,7 @@ x_handle_net_wm_state (f, event)
       lval = Qmaximized;
       break;
     }
-      
+
   store_frame_param (f, Qfullscreen, lval);
   store_frame_param (f, Qsticky, sticky ? Qt : Qnil);
 
@@ -8720,8 +8429,7 @@ x_handle_net_wm_state (f, event)
 /* Check if we need to resize the frame due to a fullscreen request.
    If so needed, resize the frame. */
 static void
-x_check_fullscreen (f)
-     struct frame *f;
+x_check_fullscreen (struct frame *f)
 {
   if (do_ewmh_fullscreen (f))
     return;
@@ -8748,7 +8456,7 @@ x_check_fullscreen (f)
         case FULLSCREEN_HEIGHT:
           height = x_display_pixel_height (dpyinfo);
         }
-      
+
       if (FRAME_COLS (f) != width || FRAME_LINES (f) != height)
         {
           change_frame_size (f, height, width, 0, 1, 0);
@@ -8767,10 +8475,7 @@ x_check_fullscreen (f)
    compensate by moving the window right and down by the proper amount.  */
 
 static void
-x_check_expected_move (f, expected_left, expected_top)
-     struct frame *f;
-     int expected_left;
-     int expected_top;
+x_check_expected_move (struct frame *f, int expected_left, int expected_top)
 {
   int current_left = 0, current_top = 0;
 
@@ -8815,9 +8520,7 @@ x_check_expected_move (f, expected_left, expected_top)
    of an exact comparison.  */
 
 static void
-x_sync_with_move (f, left, top, fuzzy)
-    struct frame *f;
-    int left, top, fuzzy;
+x_sync_with_move (struct frame *f, int left, int top, int fuzzy)
 {
   int count = 0;
 
@@ -8854,9 +8557,7 @@ x_sync_with_move (f, left, top, fuzzy)
 
 /* Wait for an event on frame F matching EVENTTYPE.  */
 void
-x_wait_for_event (f, eventtype)
-     struct frame *f;
-     int eventtype;
+x_wait_for_event (struct frame *f, int eventtype)
 {
   int level = interrupt_input_blocked;
 
@@ -8883,7 +8584,7 @@ x_wait_for_event (f, eventtype)
 
       FD_ZERO (&fds);
       FD_SET (fd, &fds);
-      
+
       EMACS_GET_TIME (time_now);
       EMACS_SUB_TIME (tmo, tmo_at, time_now);
 
@@ -8901,10 +8602,7 @@ x_wait_for_event (f, eventtype)
    size changes.  Otherwise we leave the window gravity unchanged.  */
 
 static void
-x_set_window_size_1 (f, change_gravity, cols, rows)
-     struct frame *f;
-     int change_gravity;
-     int cols, rows;
+x_set_window_size_1 (struct frame *f, int change_gravity, int cols, int rows)
 {
   int pixelwidth, pixelheight;
 
@@ -8912,13 +8610,12 @@ x_set_window_size_1 (f, change_gravity, cols, rows)
   f->scroll_bar_actual_width
     = (!FRAME_HAS_VERTICAL_SCROLL_BARS (f)
        ? 0
-       : FRAME_CONFIG_SCROLL_BAR_WIDTH (f) > 0
-       ? FRAME_CONFIG_SCROLL_BAR_WIDTH (f)
-       : (FRAME_CONFIG_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f)));
+       : FRAME_CONFIG_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f));
 
   compute_fringe_widths (f, 0);
 
-  pixelwidth = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, cols);
+  pixelwidth = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, cols)
+    + FRAME_TOOLBAR_WIDTH (f);
   pixelheight = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows)
     + FRAME_MENUBAR_HEIGHT (f) + FRAME_TOOLBAR_HEIGHT (f);
 
@@ -8969,17 +8666,14 @@ x_set_window_size_1 (f, change_gravity, cols, rows)
    Otherwise we leave the window gravity unchanged.  */
 
 void
-x_set_window_size (f, change_gravity, cols, rows)
-     struct frame *f;
-     int change_gravity;
-     int cols, rows;
+x_set_window_size (struct frame *f, int change_gravity, int cols, int rows)
 {
   BLOCK_INPUT;
 
   if (NILP (tip_frame) || XFRAME (tip_frame) != f)
     {
       int r, c;
-         
+
       /* When the frame is maximized/fullscreen or running under for
          example Xmonad, x_set_window_size_1 will be a no-op.
          In that case, the right thing to do is extend rows/cols to
@@ -9028,9 +8722,7 @@ x_set_window_size (f, change_gravity, cols, rows)
 /* Mouse warping.  */
 
 void
-x_set_mouse_position (f, x, y)
-     struct frame *f;
-     int x, y;
+x_set_mouse_position (struct frame *f, int x, int y)
 {
   int pix_x, pix_y;
 
@@ -9053,9 +8745,7 @@ x_set_mouse_position (f, x, y)
 /* Move the mouse to position pixel PIX_X, PIX_Y relative to frame F.  */
 
 void
-x_set_mouse_pixel_position (f, pix_x, pix_y)
-     struct frame *f;
-     int pix_x, pix_y;
+x_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y)
 {
   BLOCK_INPUT;
 
@@ -9067,8 +8757,7 @@ x_set_mouse_pixel_position (f, pix_x, pix_y)
 /* focus shifting, raising and lowering.  */
 
 void
-x_focus_on_frame (f)
-     struct frame *f;
+x_focus_on_frame (struct frame *f)
 {
 #if 0
   /* I don't think that the ICCCM allows programs to do things like this
@@ -9080,8 +8769,7 @@ x_focus_on_frame (f)
 }
 
 void
-x_unfocus_frame (f)
-     struct frame *f;
+x_unfocus_frame (struct frame *f)
 {
 #if 0
   /* Look at the remarks in x_focus_on_frame.  */
@@ -9094,8 +8782,7 @@ x_unfocus_frame (f)
 /* Raise frame F.  */
 
 void
-x_raise_frame (f)
-     struct frame *f;
+x_raise_frame (struct frame *f)
 {
   BLOCK_INPUT;
   if (f->async_visible)
@@ -9108,8 +8795,7 @@ x_raise_frame (f)
 /* Lower frame F.  */
 
 void
-x_lower_frame (f)
-     struct frame *f;
+x_lower_frame (struct frame *f)
 {
   if (f->async_visible)
     {
@@ -9123,8 +8809,7 @@ x_lower_frame (f)
 /* Activate frame with Extended Window Manager Hints */
 
 void
-x_ewmh_activate_frame (f)
-     FRAME_PTR f;
+x_ewmh_activate_frame (FRAME_PTR f)
 {
   /* See Window Manager Specification/Extended Window Manager Hints at
      http://freedesktop.org/wiki/Specifications/wm-spec  */
@@ -9144,9 +8829,7 @@ x_ewmh_activate_frame (f)
 }
 
 static void
-XTframe_raise_lower (f, raise_flag)
-     FRAME_PTR f;
-     int raise_flag;
+XTframe_raise_lower (FRAME_PTR f, int raise_flag)
 {
   if (raise_flag)
     x_raise_frame (f);
@@ -9157,9 +8840,7 @@ XTframe_raise_lower (f, raise_flag)
 /* XEmbed implementation.  */
 
 void
-xembed_set_info (f, flags)
-     struct frame *f;
-     enum xembed_info flags;
+xembed_set_info (struct frame *f, enum xembed_info flags)
 {
   Atom atom;
   unsigned long data[2];
@@ -9174,13 +8855,7 @@ xembed_set_info (f, flags)
 }
 
 void
-xembed_send_message (f, time, message, detail, data1, data2)
-     struct frame *f;
-     Time time;
-     enum xembed_message message;
-     long detail;
-     long data1;
-     long data2;
+xembed_send_message (struct frame *f, Time time, enum xembed_message message, long int detail, long int data1, long int data2)
 {
   XEvent event;
 
@@ -9209,8 +8884,7 @@ xembed_send_message (f, time, message, detail, data1, data2)
    finishes with it.  */
 
 void
-x_make_frame_visible (f)
-     struct frame *f;
+x_make_frame_visible (struct frame *f)
 {
   Lisp_Object type;
   int original_top, original_left;
@@ -9341,7 +9015,6 @@ x_make_frame_visible (f)
            /* It could be confusing if a real alarm arrives while
               processing the fake one.  Turn it off and let the
               handler reset it.  */
-           extern void poll_for_input_1 P_ ((void));
            int old_poll_suppress_count = poll_suppress_count;
            poll_suppress_count = 1;
            poll_for_input_1 ();
@@ -9373,8 +9046,7 @@ x_make_frame_visible (f)
 /* Make the frame visible (mapped and not iconified).  */
 
 void
-x_make_frame_invisible (f)
-     struct frame *f;
+x_make_frame_invisible (struct frame *f)
 {
   Window window;
 
@@ -9431,8 +9103,7 @@ x_make_frame_invisible (f)
 /* Change window state from mapped to iconified.  */
 
 void
-x_iconify_frame (f)
-     struct frame *f;
+x_iconify_frame (struct frame *f)
 {
   int result;
   Lisp_Object type;
@@ -9558,8 +9229,7 @@ x_iconify_frame (f)
 /* Free X resources of frame F.  */
 
 void
-x_free_frame_resources (f)
-     struct frame *f;
+x_free_frame_resources (struct frame *f)
 {
   struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
   Lisp_Object bar;
@@ -9612,14 +9282,7 @@ x_free_frame_resources (f)
 #else  /* !USE_X_TOOLKIT */
 
 #ifdef USE_GTK
-      /* In the GTK version, tooltips are normal X
-         frames.  We must check and free both types. */
-      if (FRAME_GTK_OUTER_WIDGET (f))
-        {
-          gtk_widget_destroy (FRAME_GTK_OUTER_WIDGET (f));
-          FRAME_X_WINDOW (f) = 0; /* Set to avoid XDestroyWindow below */
-          FRAME_GTK_OUTER_WIDGET (f) = 0;
-        }
+      xg_free_frame_widgets (f);
 #endif /* USE_GTK */
 
       if (FRAME_X_WINDOW (f))
@@ -9682,8 +9345,7 @@ x_free_frame_resources (f)
 /* Destroy the X window of frame F.  */
 
 void
-x_destroy_window (f)
-     struct frame *f;
+x_destroy_window (struct frame *f)
 {
   struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
 
@@ -9707,10 +9369,7 @@ x_destroy_window (f)
 
 #ifndef USE_GTK
 void
-x_wm_set_size_hint (f, flags, user_position)
-     struct frame *f;
-     long flags;
-     int user_position;
+x_wm_set_size_hint (struct frame *f, long flags, int user_position)
 {
   XSizeHints size_hints;
   Window window = FRAME_OUTER_WINDOW (f);
@@ -9810,9 +9469,7 @@ x_wm_set_size_hint (f, flags, user_position)
 /* Used for IconicState or NormalState */
 
 void
-x_wm_set_window_state (f, state)
-     struct frame *f;
-     int state;
+x_wm_set_window_state (struct frame *f, int state)
 {
 #ifdef USE_X_TOOLKIT
   Arg al[1];
@@ -9830,9 +9487,7 @@ x_wm_set_window_state (f, state)
 }
 
 void
-x_wm_set_icon_pixmap (f, pixmap_id)
-     struct frame *f;
-     int pixmap_id;
+x_wm_set_icon_pixmap (struct frame *f, int pixmap_id)
 {
   Pixmap icon_pixmap, icon_mask;
 
@@ -9880,9 +9535,7 @@ x_wm_set_icon_pixmap (f, pixmap_id)
 }
 
 void
-x_wm_set_icon_position (f, icon_x, icon_y)
-     struct frame *f;
-     int icon_x, icon_y;
+x_wm_set_icon_position (struct frame *f, int icon_x, int icon_y)
 {
   Window window = FRAME_OUTER_WINDOW (f);
 
@@ -9904,9 +9557,7 @@ x_wm_set_icon_position (f, icon_x, icon_y)
    font table.  */
 
 static void
-x_check_font (f, font)
-     struct frame *f;
-     struct font *font;
+x_check_font (struct frame *f, struct font *font)
 {
   Lisp_Object frame;
 
@@ -9955,8 +9606,7 @@ static int x_session_initialized;
 /* Test whether two display-name strings agree up to the dot that separates
    the screen number from the server number.  */
 static int
-same_x_server (name1, name2)
-     const char *name1, *name2;
+same_x_server (const char *name1, const char *name2)
 {
   int seen_colon = 0;
   const unsigned char *system_name = SDATA (Vsystem_name);
@@ -10003,10 +9653,7 @@ same_x_server (name1, name2)
    get to the first bit.  With MASK 0x7e0, *BITS is set to 6, and *OFFSET
    to 5.  */
 static void
-get_bits_and_offset (mask, bits, offset)
-     unsigned long mask;
-     int *bits;
-     int *offset;
+get_bits_and_offset (long unsigned int mask, int *bits, int *offset)
 {
   int nr = 0;
   int off = 0;
@@ -10031,8 +9678,7 @@ get_bits_and_offset (mask, bits, offset)
    But don't permanently open it, just test its availability.  */
 
 int
-x_display_ok (display)
-    const char *display;
+x_display_ok (const char *display)
 {
     int dpy_ok = 1;
     Display *dpy;
@@ -10047,26 +9693,19 @@ x_display_ok (display)
 
 #ifdef USE_GTK
 static void
-my_log_handler (log_domain, log_level, message, user_data)
-     const gchar *log_domain;
-     GLogLevelFlags log_level;
-     const gchar *message;
-     gpointer user_data;
+my_log_handler (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data)
 {
   if (!strstr (message, "g_set_prgname"))
       fprintf (stderr, "%s-WARNING **: %s\n", log_domain, message);
 }
 #endif
-  
+
 /* Open a connection to X display DISPLAY_NAME, and return
    the structure that describes the open display.
    If we cannot contact the display, return null.  */
 
 struct x_display_info *
-x_term_init (display_name, xrm_option, resource_name)
-     Lisp_Object display_name;
-     char *xrm_option;
-     char *resource_name;
+x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
 {
   int connection;
   Display *dpy;
@@ -10092,23 +9731,16 @@ x_term_init (display_name, xrm_option, resource_name)
     char *argv[NUM_ARGV];
     char **argv2 = argv;
     guint id;
-#ifndef HAVE_GTK_MULTIDISPLAY
-    if (!EQ (Vinitial_window_system, Qx))
-      error ("Sorry, you cannot connect to X servers with the GTK toolkit");
-#endif
 
     if (x_initialized++ > 1)
       {
-#ifdef HAVE_GTK_MULTIDISPLAY
-        /* Opening another display.  If xg_display_open returns less
-           than zero, we are probably on GTK 2.0, which can only handle
-           one display.  GTK 2.2 or later can handle more than one.  */
-        if (xg_display_open (SDATA (display_name), &dpy) < 0)
-#endif
-          error ("Sorry, this version of GTK can only handle one display");
+        xg_display_open (SDATA (display_name), &dpy);
       }
     else
       {
+        static char display_opt[] = "--display";
+        static char name_opt[] = "--name";
+        
         for (argc = 0; argc < NUM_ARGV; ++argc)
           argv[argc] = 0;
 
@@ -10117,11 +9749,11 @@ x_term_init (display_name, xrm_option, resource_name)
 
         if (! NILP (display_name))
           {
-            argv[argc++] = "--display";
+            argv[argc++] = display_opt;
             argv[argc++] = SDATA (display_name);
           }
 
-        argv[argc++] = "--name";
+        argv[argc++] = name_opt;
         argv[argc++] = resource_name;
 
         XSetLocaleModifiers ("");
@@ -10144,7 +9776,7 @@ x_term_init (display_name, xrm_option, resource_name)
 
         /* Load our own gtkrc if it exists.  */
         {
-          char *file = "~/.emacs.d/gtkrc";
+          const char *file = "~/.emacs.d/gtkrc";
           Lisp_Object s, abs_file;
 
           s = make_string (file, strlen (file));
@@ -10209,7 +9841,7 @@ x_term_init (display_name, xrm_option, resource_name)
   /* We have definitely succeeded.  Record the new connection.  */
 
   dpyinfo = (struct x_display_info *) xmalloc (sizeof (struct x_display_info));
-  bzero (dpyinfo, sizeof *dpyinfo);
+  memset (dpyinfo, 0, sizeof *dpyinfo);
 
   terminal = x_create_terminal (dpyinfo);
 
@@ -10487,7 +10119,11 @@ x_term_init (display_name, xrm_option, resource_name)
     = XInternAtom (dpyinfo->display, "_NET_WM_WINDOW_TYPE", False);
   dpyinfo->Xatom_net_window_type_tooltip
     = XInternAtom (dpyinfo->display, "_NET_WM_WINDOW_TYPE_TOOLTIP", False);
-  
+  dpyinfo->Xatom_net_wm_icon_name
+    = XInternAtom (dpyinfo->display, "_NET_WM_ICON_NAME", False);
+  dpyinfo->Xatom_net_wm_name
+    = XInternAtom (dpyinfo->display, "_NET_WM_NAME", False);
+
   dpyinfo->cut_buffers_initialized = 0;
 
   dpyinfo->x_dnd_atoms_size = 8;
@@ -10503,8 +10139,6 @@ x_term_init (display_name, xrm_option, resource_name)
   dpyinfo->connection = connection;
 
   {
-    extern int gray_bitmap_width, gray_bitmap_height;
-    extern char *gray_bitmap_bits;
     dpyinfo->gray
       = XCreatePixmapFromBitmapData (dpyinfo->display, dpyinfo->root_window,
                                     gray_bitmap_bits,
@@ -10518,11 +10152,9 @@ x_term_init (display_name, xrm_option, resource_name)
 
   xsettings_initialize (dpyinfo);
 
-#ifdef subprocesses
   /* This is only needed for distinguishing keyboard and process input.  */
   if (connection != 0)
     add_keyboard_wait_descriptor (connection);
-#endif
 
 #ifdef F_SETOWN
   fcntl (connection, F_SETOWN, getpid ());
@@ -10604,8 +10236,7 @@ x_term_init (display_name, xrm_option, resource_name)
    and without sending any more commands to the X server.  */
 
 void
-x_delete_display (dpyinfo)
-     struct x_display_info *dpyinfo;
+x_delete_display (struct x_display_info *dpyinfo)
 {
   struct terminal *t;
 
@@ -10617,7 +10248,7 @@ x_delete_display (dpyinfo)
 #ifdef HAVE_X_SM
         /* Close X session management when we close its display.  */
         if (t->id == 1 && x_session_have_connection ())
-          x_session_close();
+          x_session_close ();
 #endif
         delete_terminal (t);
         break;
@@ -10674,8 +10305,7 @@ x_delete_display (dpyinfo)
    that slows us down.  */
 
 static void
-x_process_timeouts (timer)
-     struct atimer *timer;
+x_process_timeouts (struct atimer *timer)
 {
   BLOCK_INPUT;
   x_timeout_atimer_activated_flag = 0;
@@ -10698,7 +10328,7 @@ x_process_timeouts (timer)
    processed, these widgets don't behave normally.  */
 
 void
-x_activate_timeout_atimer ()
+x_activate_timeout_atimer (void)
 {
   BLOCK_INPUT;
   if (!x_timeout_atimer_activated_flag)
@@ -10874,7 +10504,7 @@ x_create_terminal (struct x_display_info *dpyinfo)
 }
 
 void
-x_initialize ()
+x_initialize (void)
 {
   baud_rate = 19200;
 
@@ -10932,7 +10562,7 @@ x_initialize ()
 
 
 void
-syms_of_xterm ()
+syms_of_xterm (void)
 {
   x_error_message = NULL;
 
index c8601b8c43dc4f6dc53ced82d4c84e5f6732f3e4..972bfb50dc35405c9a6ed73e2bbc1e7cd377de7a 100644 (file)
@@ -51,6 +51,10 @@ typedef GtkWidget *xt_or_gtk_widget;
 #define XSync(d, b) do { gdk_window_process_all_updates (); \
                          XSync (d, b);  } while (0)
 
+/* The GtkTooltip API came in 2.12, but gtk-enable-tooltips in 2.14. */
+#if GTK_MAJOR_VERSION > 2 || GTK_MINOR_VERSION > 13
+#define USE_GTK_TOOLTIP
+#endif
 
 #endif /* USE_GTK */
 
@@ -370,6 +374,9 @@ struct x_display_info
   /* XSettings atoms and windows.  */
   Atom Xatom_xsettings_sel, Xatom_xsettings_prop, Xatom_xsettings_mgr;
   Window xsettings_window;
+
+  /* Frame name and icon name */
+  Atom Xatom_net_wm_name, Xatom_net_wm_icon_name;
 };
 
 #ifdef HAVE_X_I18N
@@ -378,14 +385,16 @@ extern int use_xim;
 #endif
 
 /* This checks to make sure we have a display.  */
-extern void check_x P_ ((void));
 
-extern struct frame *x_window_to_frame P_ ((struct x_display_info *, int));
+extern void check_x (void);
+
+extern struct frame *x_window_to_frame (struct x_display_info *, int);
+
+extern struct frame *x_any_window_to_frame (struct x_display_info *, int);
+extern struct frame *x_menubar_window_to_frame (struct x_display_info *,
+                                               XEvent *);
 
-extern struct frame *x_any_window_to_frame P_ ((struct x_display_info *, int));
-extern struct frame *x_menubar_window_to_frame P_ ((struct x_display_info *,
-                                                    XEvent *));
-extern struct frame *x_top_window_to_frame P_ ((struct x_display_info *, int));
+extern struct frame *x_top_window_to_frame (struct x_display_info *, int);
 
 #if ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK)
 #define x_any_window_to_frame x_window_to_frame
@@ -404,14 +413,14 @@ extern Lisp_Object x_display_name_list;
 /* Regexp matching a font name whose width is the same as `PIXEL_SIZE'.  */
 extern Lisp_Object Vx_pixel_size_width_font_regexp;
 
-extern struct x_display_info *x_display_info_for_display P_ ((Display *));
-extern struct x_display_info *x_display_info_for_name P_ ((Lisp_Object));
-extern void x_set_frame_alpha P_ ((struct frame *));
+extern struct x_display_info *x_display_info_for_display (Display *);
+extern struct x_display_info *x_display_info_for_name (Lisp_Object);
+extern void x_set_frame_alpha (struct frame *);
 
-extern struct x_display_info *x_term_init P_ ((Lisp_Object, char *, char *));
-extern int x_display_ok  P_ ((const char *));
+extern struct x_display_info *x_term_init (Lisp_Object, char *, char *);
+extern int x_display_ok  (const char *);
 
-extern void select_visual P_ ((struct x_display_info *));
+extern void select_visual (struct x_display_info *);
 
 \f
 struct font;
@@ -428,9 +437,15 @@ struct x_output
      if the menubar is turned off.  */
   int menubar_height;
 
-  /* Height of tool bar widget, in pixels.
-     Zero if not using an external tool bar.  */
-  int toolbar_height;
+  /* Height of tool bar widget, in pixels.  top_height is used if tool bar
+     at top, bottom_height if tool bar is at the bottom.
+     Zero if not using an external tool bar or if tool bar is vertical.  */
+  int toolbar_top_height, toolbar_bottom_height;
+
+  /* Width of tool bar widget, in pixels.  left_width is used if tool bar
+     at left, right_width if tool bar is at the right.
+     Zero if not using an external tool bar or if tool bar is horizontal.  */
+  int toolbar_left_width, toolbar_right_width;
 
   /* The tiled border used when the mouse is out of the frame.  */
   Pixmap border_tile;
@@ -475,6 +490,8 @@ struct x_output
   GtkWidget *edit_widget;
   /* The widget used for laying out widgets vertically.  */
   GtkWidget *vbox_widget;
+  /* The widget used for laying out widgets horizontally.  */
+  GtkWidget *hbox_widget;
   /* The menubar in this frame.  */
   GtkWidget *menubar_widget;
   /* The tool bar in this frame  */
@@ -483,11 +500,20 @@ struct x_output
   GtkWidget *handlebox_widget;
   /* Non-zero if the tool bar is detached.  */
   int toolbar_detached;
+  /* Non-zero if tool bar is packed into the hbox widget (i.e. vertical).  */
+  int toolbar_in_hbox;
 
   /* The last size hints set.  */
   GdkGeometry size_hints;
   long hint_flags;
-#endif
+
+#ifdef USE_GTK_TOOLTIP
+  GtkTooltip *ttip_widget;
+  GtkWidget *ttip_lbl;
+  GtkWindow *ttip_window;
+#endif /* USE_GTK_TOOLTIP */
+
+#endif /* USE_GTK */
 
   /* If >=0, a bitmap index.  The indicated bitmap is used for the
      icon. */
@@ -662,8 +688,22 @@ enum
                                FRAME_X_WINDOW (f))
 #else
 #ifdef USE_GTK
+/* Functions not present in older Gtk+ */
+
+#ifndef HAVE_GTK_WIDGET_GET_WINDOW
+#define gtk_widget_get_window(w) ((w)->window)
+#endif
+#ifndef HAVE_GTK_WIDGET_GET_MAPPED
+#define gtk_widget_get_mapped(w) (GTK_WIDGET_MAPPED (w))
+#endif
+#ifndef HAVE_GTK_ADJUSTMENT_GET_PAGE_SIZE
+#define gtk_adjustment_get_page_size(w) ((w)->page_size)
+#define gtk_adjustment_get_upper(w) ((w)->upper)
+#endif
+
 #define GTK_WIDGET_TO_X_WIN(w) \
-  ((w) && (w)->window ? GDK_WINDOW_XWINDOW ((w)->window) : 0)
+  ((w) && gtk_widget_get_window (w) \
+   ? GDK_WINDOW_XWINDOW (gtk_widget_get_window (w)) : 0)
 
 #define FRAME_GTK_OUTER_WIDGET(f) ((f)->output_data.x->widget)
 #define FRAME_GTK_WIDGET(f) ((f)->output_data.x->edit_widget)
@@ -681,7 +721,15 @@ enum
 #define FRAME_FONT(f) ((f)->output_data.x->font)
 #define FRAME_FONTSET(f) ((f)->output_data.x->fontset)
 #define FRAME_MENUBAR_HEIGHT(f) ((f)->output_data.x->menubar_height)
-#define FRAME_TOOLBAR_HEIGHT(f) ((f)->output_data.x->toolbar_height)
+#define FRAME_TOOLBAR_TOP_HEIGHT(f) ((f)->output_data.x->toolbar_top_height)
+#define FRAME_TOOLBAR_BOTTOM_HEIGHT(f) \
+  ((f)->output_data.x->toolbar_bottom_height)
+#define FRAME_TOOLBAR_HEIGHT(f) \
+  (FRAME_TOOLBAR_TOP_HEIGHT (f) + FRAME_TOOLBAR_BOTTOM_HEIGHT (f))
+#define FRAME_TOOLBAR_LEFT_WIDTH(f) ((f)->output_data.x->toolbar_left_width)
+#define FRAME_TOOLBAR_RIGHT_WIDTH(f) ((f)->output_data.x->toolbar_right_width)
+#define FRAME_TOOLBAR_WIDTH(f) \
+  (FRAME_TOOLBAR_LEFT_WIDTH (f) + FRAME_TOOLBAR_RIGHT_WIDTH (f))
 #define FRAME_BASELINE_OFFSET(f) ((f)->output_data.x->baseline_offset)
 
 /* This gives the x_display_info structure for the display F is on.  */
@@ -902,168 +950,173 @@ struct image;
 
 /* From xselect.c.  */
 
-void x_handle_selection_notify P_ ((XSelectionEvent *));
-void x_handle_property_notify P_ ((XPropertyEvent *));
+void x_handle_selection_notify (XSelectionEvent *);
+void x_handle_property_notify (XPropertyEvent *);
 
 /* From xfns.c.  */
 
-Lisp_Object display_x_get_resource P_ ((struct x_display_info *,
-                                       Lisp_Object, Lisp_Object,
-                                       Lisp_Object, Lisp_Object));
-struct frame *check_x_frame P_ ((Lisp_Object));
+Lisp_Object display_x_get_resource (struct x_display_info *,
+                                    Lisp_Object, Lisp_Object,
+                                    Lisp_Object, Lisp_Object);
+struct frame *check_x_frame (Lisp_Object);
 EXFUN (Fx_display_color_p, 1);
 EXFUN (Fx_display_grayscale_p, 1);
-extern void x_free_gcs P_ ((struct frame *));
+extern void x_free_gcs (struct frame *);
+extern int gray_bitmap_width, gray_bitmap_height;
+extern char *gray_bitmap_bits;
 
 /* From xrdb.c.  */
 
-char *x_get_customization_string P_ ((XrmDatabase, char *, char *));
-XrmDatabase x_load_resources P_ ((Display *, char *, char *, char *));
-int x_get_resource P_ ((XrmDatabase, char *, char *,
-                       XrmRepresentation, XrmValue *));
-void x_delete_display P_ ((struct x_display_info *));
-void x_make_frame_visible P_ ((struct frame *));
-void x_iconify_frame P_ ((struct frame *));
-void x_wm_set_size_hint P_ ((struct frame *, long, int));
-int x_text_icon P_ ((struct frame *, char *));
-int x_bitmap_icon P_ ((struct frame *, Lisp_Object));
-void x_set_window_size P_ ((struct frame *, int, int, int));
-void x_wm_set_window_state P_ ((struct frame *, int));
-int x_alloc_nearest_color P_ ((struct frame *, Colormap, XColor *));
+char *x_get_customization_string (XrmDatabase, const char *, const char *);
+XrmDatabase x_load_resources (Display *, const char *, const char *,
+                             const char *);
+int x_get_resource (XrmDatabase, const char *, const char *,
+                    XrmRepresentation, XrmValue *);
+void x_delete_display (struct x_display_info *);
+void x_make_frame_visible (struct frame *);
+void x_iconify_frame (struct frame *);
+void x_wm_set_size_hint (struct frame *, long, int);
+int x_text_icon (struct frame *, const char *);
+int x_bitmap_icon (struct frame *, Lisp_Object);
+void x_set_window_size (struct frame *, int, int, int);
+void x_wm_set_window_state (struct frame *, int);
+int x_alloc_nearest_color (struct frame *, Colormap, XColor *);
 
 /* Defined in xterm.c */
 
-extern void cancel_mouse_face P_ ((struct frame *));
-extern void x_scroll_bar_clear P_ ((struct frame *));
-extern int x_text_icon P_ ((struct frame *, char *));
-extern int x_bitmap_icon P_ ((struct frame *, Lisp_Object));
-extern void x_catch_errors P_ ((Display *));
-extern void x_check_errors P_ ((Display *, char *));
-extern int x_had_errors_p P_ ((Display *));
-extern int x_catching_errors P_ ((void));
-extern void x_uncatch_errors P_ ((void));
-extern void x_clear_errors P_ ((Display *));
-extern void x_set_window_size P_ ((struct frame *, int, int, int));
-extern void x_set_mouse_position P_ ((struct frame *, int, int));
-extern void x_set_mouse_pixel_position P_ ((struct frame *, int, int));
-extern void x_ewmh_activate_frame P_ ((struct frame *));
-extern void x_raise_frame P_ ((struct frame *));
-extern void x_lower_frame P_ ((struct frame *));
-extern void x_make_frame_visible P_ ((struct frame *));
-extern void x_make_frame_invisible P_ ((struct frame *));
-extern void x_iconify_frame P_ ((struct frame *));
-extern void x_free_frame_resources P_ ((struct frame *));
-extern void x_destroy_window P_ ((struct frame *));
-extern void x_wm_set_size_hint P_ ((struct frame *, long, int));
-extern void x_wm_set_window_state P_ ((struct frame *, int));
-extern void x_wm_set_icon_pixmap P_ ((struct frame *, int));
-extern void x_delete_display P_ ((struct x_display_info *));
-extern void x_delete_terminal P_ ((struct terminal *terminal));
-extern void x_initialize P_ ((void));
-extern unsigned long x_copy_color P_ ((struct frame *, unsigned long));
+extern void cancel_mouse_face (struct frame *);
+extern void x_scroll_bar_clear (struct frame *);
+extern int x_text_icon (struct frame *, const char *);
+extern int x_bitmap_icon (struct frame *, Lisp_Object);
+extern void x_catch_errors (Display *);
+extern void x_check_errors (Display *, const char *);
+extern int x_had_errors_p (Display *);
+extern int x_catching_errors (void);
+extern void x_uncatch_errors (void);
+extern void x_clear_errors (Display *);
+extern void x_set_window_size (struct frame *, int, int, int);
+extern void x_set_mouse_position (struct frame *, int, int);
+extern void x_set_mouse_pixel_position (struct frame *, int, int);
+extern void x_ewmh_activate_frame (struct frame *);
+extern void x_raise_frame (struct frame *);
+extern void x_lower_frame (struct frame *);
+extern void x_make_frame_visible (struct frame *);
+extern void x_make_frame_invisible (struct frame *);
+extern void x_iconify_frame (struct frame *);
+extern void x_free_frame_resources (struct frame *);
+extern void x_destroy_window (struct frame *);
+extern void x_wm_set_size_hint (struct frame *, long, int);
+extern void x_wm_set_window_state (struct frame *, int);
+extern void x_wm_set_icon_pixmap (struct frame *, int);
+extern void x_delete_display (struct x_display_info *);
+extern void x_delete_terminal (struct terminal *terminal);
+extern void x_initialize (void);
+extern unsigned long x_copy_color (struct frame *, unsigned long);
 #ifdef USE_X_TOOLKIT
 extern XtAppContext Xt_app_con;
-extern int x_alloc_lighter_color_for_widget __P ((Widget, Display*, Colormap,
-                                                 unsigned long *,
-                                                 double, int));
-extern void x_activate_timeout_atimer P_ ((void));
+extern int x_alloc_lighter_color_for_widget (Widget, Display*, Colormap,
+                                             unsigned long *,
+                                             double, int);
+extern void x_activate_timeout_atimer (void);
 #endif
-extern void x_query_colors P_ ((struct frame *f, XColor *, int));
-extern void x_query_color P_ ((struct frame *f, XColor *));
-extern void x_clear_area P_ ((Display *, Window, int, int, int, int, int));
-extern void set_vertical_scroll_bar P_ ((struct window *));
+extern void x_query_colors (struct frame *f, XColor *, int);
+extern void x_query_color (struct frame *f, XColor *);
+extern void x_clear_area (Display *, Window, int, int, int, int, int);
+extern void set_vertical_scroll_bar (struct window *);
 
-extern int x_dispatch_event P_ ((XEvent *, Display *));
-extern unsigned int x_x_to_emacs_modifiers P_ ((struct x_display_info *,
-                                               unsigned));
-extern int x_display_pixel_height P_ ((struct x_display_info *));
-extern int x_display_pixel_width P_ ((struct x_display_info *));
+extern int x_dispatch_event (XEvent *, Display *);
+extern unsigned int x_x_to_emacs_modifiers (struct x_display_info *,
+                                            unsigned);
+extern int x_display_pixel_height (struct x_display_info *);
+extern int x_display_pixel_width (struct x_display_info *);
 
-extern void x_set_sticky P_ ((struct frame *, Lisp_Object, Lisp_Object));
-extern void x_wait_for_event P_ ((struct frame *, int));
+extern void x_set_sticky (struct frame *, Lisp_Object, Lisp_Object);
+extern void x_wait_for_event (struct frame *, int);
 
 /* Defined in xselect.c */
 
-extern void x_handle_property_notify P_ ((XPropertyEvent *));
-extern void x_handle_selection_notify P_ ((XSelectionEvent *));
-extern void x_handle_selection_event P_ ((struct input_event *));
-extern void x_clear_frame_selections P_ ((struct frame *));
-
-extern int x_handle_dnd_message P_ ((struct frame *,
-                                     XClientMessageEvent *,
-                                     struct x_display_info *,
-                                     struct input_event *bufp));
-extern int x_check_property_data P_ ((Lisp_Object));
-extern void x_fill_property_data P_ ((Display *,
-                                      Lisp_Object,
-                                      void *,
-                                      int));
-extern Lisp_Object x_property_data_to_lisp P_ ((struct frame *,
-                                                unsigned char *,
-                                                Atom,
-                                                int,
-                                                unsigned long));
+extern void x_handle_property_notify (XPropertyEvent *);
+extern void x_handle_selection_notify (XSelectionEvent *);
+extern void x_handle_selection_event (struct input_event *);
+extern void x_clear_frame_selections (struct frame *);
+
+extern int x_handle_dnd_message (struct frame *,
+                                 XClientMessageEvent *,
+                                 struct x_display_info *,
+                                 struct input_event *bufp);
+extern int x_check_property_data (Lisp_Object);
+extern void x_fill_property_data (Display *,
+                                  Lisp_Object,
+                                  void *,
+                                  int);
+extern Lisp_Object x_property_data_to_lisp (struct frame *,
+                                            const unsigned char *,
+                                            Atom,
+                                            int,
+                                            unsigned long);
 
 /* Defined in xfns.c */
 
-extern struct x_display_info * check_x_display_info P_ ((Lisp_Object frame));
+extern struct x_display_info * check_x_display_info (Lisp_Object frame);
+extern Lisp_Object x_get_focus_frame (struct frame *);
 
 #ifdef USE_GTK
-extern int xg_set_icon P_ ((struct frame *, Lisp_Object));
-extern int xg_set_icon_from_xpm_data P_ ((struct frame *, char**));
+extern int xg_set_icon (struct frame *, Lisp_Object);
+extern int xg_set_icon_from_xpm_data (struct frame *, const char**);
 #endif /* USE_GTK */
 
-extern void x_real_positions P_ ((struct frame *, int *, int *));
-extern int defined_color P_ ((struct frame *, char *, XColor *, int));
-extern void x_set_border_pixel P_ ((struct frame *, int));
-extern void x_set_menu_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object));
-extern void x_implicitly_set_name P_ ((struct frame *, Lisp_Object, Lisp_Object));
-extern void xic_free_xfontset P_ ((struct frame *));
-extern void create_frame_xic P_ ((struct frame *));
-extern void destroy_frame_xic P_ ((struct frame *));
-extern void xic_set_preeditarea P_ ((struct window *, int, int));
-extern void xic_set_statusarea P_ ((struct frame *));
-extern void xic_set_xfontset P_ ((struct frame *, char *));
-extern int x_pixel_width P_ ((struct frame *));
-extern int x_pixel_height P_ ((struct frame *));
-extern int x_char_width P_ ((struct frame *));
-extern int x_char_height P_ ((struct frame *));
-extern int x_screen_planes P_ ((struct frame *));
-extern void x_sync P_ ((struct frame *));
-extern int x_defined_color P_ ((struct frame *, char *, XColor *, int));
+extern void x_real_positions (struct frame *, int *, int *);
+extern int defined_color (struct frame *, const char *, XColor *, int);
+extern void x_set_border_pixel (struct frame *, int);
+extern void x_set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object);
+extern void x_implicitly_set_name (struct frame *, Lisp_Object, Lisp_Object);
+extern void xic_free_xfontset (struct frame *);
+extern void create_frame_xic (struct frame *);
+extern void destroy_frame_xic (struct frame *);
+extern void xic_set_preeditarea (struct window *, int, int);
+extern void xic_set_statusarea (struct frame *);
+extern void xic_set_xfontset (struct frame *, const char *);
+extern int x_pixel_width (struct frame *);
+extern int x_pixel_height (struct frame *);
+extern int x_char_width (struct frame *);
+extern int x_char_height (struct frame *);
+extern int x_screen_planes (struct frame *);
+extern void x_sync (struct frame *);
+extern int x_defined_color (struct frame *, const char *, XColor *, int);
 #ifdef HAVE_X_I18N
-extern void free_frame_xic P_ ((struct frame *));
+extern void free_frame_xic (struct frame *);
+extern char * xic_create_fontsetname (const char *base_fontname, int motif);
 #endif
-extern void x_set_tool_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object));
+extern void x_set_tool_bar_lines (struct frame *, Lisp_Object, Lisp_Object);
 
 /* Defined in xfaces.c */
 
-extern int compute_glyph_face P_ ((struct frame *, int, int));
-extern int compute_glyph_face_1 P_ ((struct frame *, Lisp_Object, int));
-extern void x_free_dpy_colors P_ ((Display *, Screen *, Colormap,
-                                  unsigned long *, int));
+extern int compute_glyph_face (struct frame *, int, int);
+extern int compute_glyph_face_1 (struct frame *, Lisp_Object, int);
+extern void x_free_dpy_colors (Display *, Screen *, Colormap,
+                               unsigned long *, int);
 
 /* Defined in xmenu.c */
 
-extern void x_menu_set_in_use P_ ((int));
-extern void x_menu_wait_for_event P_ ((void *data));
-extern void x_activate_menubar P_ ((struct frame *));
-extern int popup_activated P_ ((void));
-extern void initialize_frame_menubar P_ ((struct frame *));
-extern void free_frame_menubar P_ ((struct frame *));
+extern void x_menu_set_in_use (int);
+extern void x_menu_wait_for_event (void *data);
+extern void x_activate_menubar (struct frame *);
+extern int popup_activated (void);
+extern void initialize_frame_menubar (struct frame *);
+extern void free_frame_menubar (struct frame *);
 
 /* Defined in widget.c */
 
 #ifdef USE_X_TOOLKIT
-extern void widget_store_internal_border P_ ((Widget));
+extern void widget_store_internal_border (Widget);
 #endif
 
 /* Defined in xsmfns.c */
 #ifdef HAVE_X_SM
-extern void x_session_initialize P_ ((struct x_display_info *dpyinfo));
-extern int x_session_check_input P_ ((struct input_event *bufp));
-extern int x_session_have_connection P_ ((void));
-extern void x_session_close P_ ((void));
+extern void x_session_initialize (struct x_display_info *dpyinfo);
+extern int x_session_check_input (struct input_event *bufp);
+extern int x_session_have_connection (void);
+extern void x_session_close (void);
 #endif
 
 /* XEmbed implementation.  */
@@ -1116,10 +1169,11 @@ enum xembed_accelerator
 
 /* Defined in xterm.c */
 
-extern void xembed_set_info P_ ((struct frame *f, enum xembed_info flags));
-extern void xembed_send_message P_ ((struct frame *f, Time time,
-                                    enum xembed_message message,
-                                    long detail, long data1, long data2));
+extern Lisp_Object Qx_gtk_map_stock;
+extern void xembed_set_info (struct frame *f, enum xembed_info flags);
+extern void xembed_send_message (struct frame *f, Time time,
+                                 enum xembed_message message,
+                                 long detail, long data1, long data2);
 
 /* Is the frame embedded into another application? */
 
index e030322c83eaeae4d022100ff5e3cb930c7c14c7..cf709f01eec9e988273f3ab2785261c9e3270472 100644 (file)
@@ -1,3 +1,36 @@
+2010-08-30  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * indent/octave.m: New file.
+
+2010-08-08  Ulf Jasper  <ulf.jasper@web.de>
+
+       * icalendar-testsuite.el (icalendar-testsuite-run): Add internal tests.
+       (icalendar-testsuite--trim, icalendar-testsuite--compare-strings)
+       (icalendar-testsuite--run-internal-tests): New.
+       (icalendar-testsuite--test-convert-ordinary-to-ical)
+       (icalendar-testsuite--test-convert-block-to-ical)
+       (icalendar-testsuite--test-convert-anniversary-to-ical)
+       (icalendar-testsuite--test-parse-vtimezone)
+       (icalendar-testsuite--do-test-export): Code formatting.
+       (icalendar-testsuite--test-parse-vtimezone): Doc fix.
+       (icalendar-testsuite--do-test-import)
+       (icalendar-testsuite--do-test-cycle): Use icalendar-testsuite--compare-strings
+       (icalendar-testsuite--run-import-tests): Comment added.
+       (icalendar-testsuite--run-import-tests)
+       (icalendar-testsuite--run-real-world-tests): Fix expected results.
+
+2010-06-25  Chong Yidong  <cyd@stupidchicken.com>
+
+       * redisplay-testsuite.el (test-redisplay-3): New test.
+
+2010-06-11  Chong Yidong  <cyd@stupidchicken.com>
+
+       * comint-testsuite.el: New file.
+
+2010-06-02  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * indent: New dir.
+
 2010-05-07  Chong Yidong  <cyd@stupidchicken.com>
 
        * Version 23.2 released.
        * cedet/tests/testdoublens.cpp:
        * cedet/tests/testdoublens.hpp: Add copyright header.
 
-       * cedet/semantic-tests.el (semanticdb-test-gnu-global): Remove
-       reference to deleted files.
+       * cedet/semantic-tests.el (semanticdb-test-gnu-global):
+       Remove reference to deleted files.
+
+2010-03-30  Juri Linkov  <juri@jurta.org>
+
+       * occur-testsuite.el (occur-tests): Add tests for context lines.
+
+2010-03-23  Juri Linkov  <juri@jurta.org>
+
+       * occur-testsuite.el: New file.
+
+2010-03-10  Chong Yidong  <cyd@stupidchicken.com>
+
+       * Branch for 23.2.
 
 2010-02-19  Ulf Jasper  <ulf.jasper@web.de>
 
diff --git a/test/comint-testsuite.el b/test/comint-testsuite.el
new file mode 100644 (file)
index 0000000..35b946c
--- /dev/null
@@ -0,0 +1,59 @@
+;;; bytecomp-testsuite.el
+
+;; Copyright (C) 2010  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/>.
+
+;;; Commentary:
+
+;; Tests for comint and related modes.
+
+;;; Code:
+
+(require 'comint)
+
+(defun comint-testsuite-run ()
+  (interactive)
+  (with-output-to-temp-buffer "*comint test*"
+    (comint-testsuite--test-comint-password-prompt-regexp)))
+
+(defun comint-testsuite--test-comint-password-prompt-regexp ()
+  (interactive)
+  (let ((password-strings
+        '("foo@example.net's password: " ;ssh
+          "Password for foo@example.org: " ; knit
+          "Kerberos password for devnull/root <at> GNU.ORG: " ; ksu
+          "Enter passphrase: " ; ssh-add
+          "Enter passphrase (empty for no passphrase): " ; ssh-keygen
+          "Enter same passphrase again: "     ; ssh-keygen
+          "Passphrase for key root@GNU.ORG: " ; plink
+          "[sudo] password for user:" ; Ubuntu sudo
+          "Password (again):"
+          "Enter password:"))
+       fail)
+    (dolist (str password-strings)
+      (unless (string-match comint-password-prompt-regexp str)
+       (setq fail t)
+       (princ (format " ERROR: comint-password-prompt-regexp did not match %s\n"
+                      str))))
+    (if fail
+       (princ "FAILED: comint-password-prompt-regexp test\n")
+      (princ "PASSED: comint-password-prompt-regexp test\n"))))
+
+(provide 'comint-testsuite)
+
+;;; comint-testsuite.el ends here
+
index 012f586c342794fd045f3113ca70718eab861ef9..351bd528bcb9d2256f19c9b1284eedda1a24e286 100644 (file)
@@ -33,6 +33,7 @@
 (defun icalendar-testsuite-run ()
   "Run icalendar test suite."
   (interactive)
+  (icalendar-testsuite--run-internal-tests)
   (icalendar-testsuite--run-function-tests)
   (icalendar-testsuite--run-import-tests)
   (icalendar-testsuite--run-export-tests)
   (icalendar-testsuite--run-real-world-tests)
   (message "All icalendar tests finished successfully."))
 
+;; ======================================================================
+;; internal
+;; ======================================================================
+(defun icalendar-testsuite--trim (string)
+  "Remove leading and trailing whitespace from STRING."
+  (replace-regexp-in-string "[ \t\n]+\\'" ""
+                            (replace-regexp-in-string "\\`[ \t\n]+" "" string)))
+
+(defun icalendar-testsuite--compare-strings (str1 str2)
+  "Compare strings STR1 and STR2.
+Return t if strings are equal, else return substring indicating first difference.
+FIXME: make this a little smarter."
+  (let* ((s1 (icalendar-testsuite--trim str1))
+         (s2 (icalendar-testsuite--trim str2))
+         (result (compare-strings s1 0 nil s2 0 nil))
+         (len (length str2)))
+    (if (numberp result)
+        (if (> result 0)
+            (concat "..." (substring str2 (- result 1)
+                                     (min len (+ (- result 1) 3))) "...")
+          (concat "..." (substring str2 (- (+ result 1))
+                                   (min len  (+ (- (+ result 1)) 3))) "..."))
+      t)))
+
+(defun icalendar-testsuite--run-internal-tests ()
+  "Run icalendar-testsuite internal tests."
+  (assert (equal t (icalendar-testsuite--compare-strings " abcde" "abcde ")))
+  (assert
+   (string= "...def..."
+            (icalendar-testsuite--compare-strings "abcxe" "abcdefghijklmn")))
+  (assert (string= "...xe..."
+                   (icalendar-testsuite--compare-strings "abcde" "abcxe")))
+  (assert (string= "...ddd..."
+           (icalendar-testsuite--compare-strings "abc" "abcdddddd")))
+  (assert (string= "......"
+                   (icalendar-testsuite--compare-strings "abcdefghij" "abc"))))
+  
+
 ;; ======================================================================
 ;; Test methods for functions
 ;; ======================================================================
@@ -260,7 +299,7 @@ END:VEVENT
     (assert (string= "subject" (cadr result)))
   
     ;; with time
-    (setq result (icalendar--convert-ordinary-to-ical 
+    (setq result (icalendar--convert-ordinary-to-ical
                   "&?" "&2010 2 15 12:34-23:45 s"))
     (assert (= 2 (length result)))
     (assert (string=  (concat "\nDTSTART;VALUE=DATE-TIME:20100215T123400"
@@ -269,7 +308,7 @@ END:VEVENT
     (assert (string= "s" (cadr result)))
 
     ;; with time, again -- test bug#5549
-    (setq result (icalendar--convert-ordinary-to-ical 
+    (setq result (icalendar--convert-ordinary-to-ical
                   "x?" "x2010 2 15 0:34-1:45 s"))
     (assert (= 2 (length result)))
     (assert (string=  (concat "\nDTSTART;VALUE=DATE-TIME:20100215T003400"
@@ -312,7 +351,7 @@ END:VEVENT
   "Test method for `icalendar--convert-block-to-ical'."
   (let* ((calendar-date-style 'iso)
          result)
-    (setq result (icalendar--convert-block-to-ical 
+    (setq result (icalendar--convert-block-to-ical
                   "" "%%(diary-block 2004 7 19 2004 8 27) Sommerferien"))
     (assert (= 2 (length result)))
     (assert (string= (concat
@@ -325,7 +364,7 @@ END:VEVENT
   "Test method for `icalendar--convert-cyclic-to-ical'."
   (let* ((calendar-date-style 'iso)
          result)
-    (setq result (icalendar--convert-block-to-ical 
+    (setq result (icalendar--convert-block-to-ical
                   "" "%%(diary-block 2004 7 19 2004 8 27) Sommerferien"))
     (assert (= 2 (length result)))
     (assert (string= (concat
@@ -338,7 +377,7 @@ END:VEVENT
   "Test method for `icalendar--convert-anniversary-to-ical'."
   (let* ((calendar-date-style 'iso)
          result)
-    (setq result (icalendar--convert-anniversary-to-ical 
+    (setq result (icalendar--convert-anniversary-to-ical
                   "" "%%(diary-anniversary 1964 6 30) g"))
     (assert (= 2 (length result)))
     (assert (string= (concat
@@ -386,6 +425,7 @@ END:VEVENT
     ))
 
 (defun icalendar-testsuite--test-parse-vtimezone ()
+  "Test method for `icalendar--parse-vtimezone'."
   (let (vtimezone result)
     (setq vtimezone (icalendar-testsuite--get-ical-event "BEGIN:VTIMEZONE
 TZID:thename
@@ -406,7 +446,8 @@ END:VTIMEZONE
     (setq result (icalendar--parse-vtimezone vtimezone))
     (assert (string= "thename" (car result)))
     (message (cdr result))
-    (assert (string= "STD-02:00DST-03:00,M3.5.0/03:00:00,M10.5.0/04:00:00" (cdr result)))
+    (assert (string= "STD-02:00DST-03:00,M3.5.0/03:00:00,M10.5.0/04:00:00"
+                     (cdr result)))
     (setq vtimezone (icalendar-testsuite--get-ical-event "BEGIN:VTIMEZONE
 TZID:anothername
 BEGIN:STANDARD
@@ -457,7 +498,7 @@ and ISO style input data must use english month names."
         (icalendar-testsuite--do-test-export input-iso expected-output)))
     (when input-european
       (let ((calendar-month-name-array
-             ["Januar" "Februar" "März" "April" "Mai" "Juni" "Juli" "August"
+             ["Januar" "Februar" "März" "April" "Mai" "Juni" "Juli" "August"
               "September" "Oktober" "November" "Dezember"])
             (calendar-day-name-array
              ["Sonntag" "Montag" "Dienstag" "Mittwoch" "Donnerstag" "Freitag"
@@ -511,12 +552,18 @@ END:VCALENDAR
 \\s-*$"
                                     nil t)))
         (error
-         "Export test failed! Input: `%s'\nFound:\n\n%s\n\nbut expected\n\n%s"
+         "Export test failed! Input: `%s'\nFound:\n\n%s\n\nbut expected\n\n%s\n%s"
          input
          (or (and (match-beginning 1)
-                  (buffer-substring-no-properties (match-beginning 1) (match-end 1)))
+                  (buffer-substring-no-properties (match-beginning 1)
+                                                  (match-end 1)))
+             "<nil>")
+         (or expected-output "<nil>")
+         (icalendar-testsuite--compare-strings   (or (and (match-beginning 1)
+                  (buffer-substring-no-properties (match-beginning 1)
+                                                  (match-end 1)))
              "<nil>")
-         (or expected-output "<nil>"))))
+         (or expected-output "<nil>")))))
     (kill-buffer (find-buffer-visiting temp-file))
     (delete-file temp-file)))
 
@@ -571,11 +618,13 @@ Argument EXPECTED-OUTPUT expected diary string."
     (icalendar-import-buffer temp-file t t)
     (save-excursion
       (find-file temp-file)
-      (let ((result (buffer-substring-no-properties (point-min) (point-max))))
-        (unless (string-match (concat "^\\s-*" expected-output "\\s-*$")
-                              result)
-          (error "Import test failed! Found `%s'\nbut expected `%s'" result
-                 expected-output)))
+      (let* ((result (buffer-substring-no-properties (point-min) (point-max)))
+             (difference
+              (icalendar-testsuite--compare-strings result
+                                                    expected-output)))
+        (if (stringp difference)
+          (error "Import test failed! Found\n`%s'\nbut expected\n`%s'\n%s'"
+                 result expected-output difference)))
       (kill-buffer (find-buffer-visiting temp-file))
       (delete-file temp-file))))
 
@@ -626,9 +675,12 @@ Argument INPUT icalendar event string."
       (when (re-search-forward "\nUID:.*\n" nil t)
         (replace-match "\n"))
       (let ((cycled (buffer-substring-no-properties (point-min) (point-max))))
-        (unless (string-equal org-input cycled)
-          (error "Import test failed! Found `%s'\nbut expected `%s'" cycled
-                 org-input))))
+        (let ((difference (icalendar-testsuite--compare-strings cycled
+                                                                org-input)))
+          (if (stringp difference)
+              (error "Import test failed! Found\n`%s'\nbut expected\n`%s'\n%s'"
+                     cycled org-input difference)))
+        ))
 
     ;; clean up -- Note this is done only if test is passed
     (kill-buffer (find-buffer-visiting temp-diary))
@@ -660,6 +712,7 @@ DTSTART;VALUE=DATE-TIME:20030919"
    "&9/19/2003 non-recurring allday")
 
   (icalendar-testsuite--test-import
+   ;; do not remove the trailing blank after "long"!
    "SUMMARY:long 
  summary
 DTSTART;VALUE=DATE:20030919"
@@ -678,9 +731,17 @@ DTSTART;VALUE=DATE:20040719
 DTEND;VALUE=DATE:20040828
 DTSTAMP:20031103T011641Z
 "
-   "&%%(and (diary-block 2004 7 19 2004 8 27)) Sommerferien"
-   "&%%(and (diary-block 19 7 2004 27 8 2004)) Sommerferien"
-   "&%%(and (diary-block 7 19 2004 8 27 2004)) Sommerferien")
+   "&%%(and (diary-block 2004 7 19 2004 8 27)) Sommerferien
+ Status: TENTATIVE
+ Class: PRIVATE
+"
+   "&%%(and (diary-block 19 7 2004 27 8 2004)) Sommerferien
+ Status: TENTATIVE
+ Class: PRIVATE
+"
+   "&%%(and (diary-block 7 19 2004 8 27 2004)) Sommerferien
+ Status: TENTATIVE
+ Class: PRIVATE")
 
   (icalendar-testsuite--test-import
    "UID
@@ -702,9 +763,15 @@ DTSTAMP
 LAST-MODIFIED
  :20041118T013640Z
 "
-   "&2004/11/23 14:00-14:30 folded summary"
-   "&23/11/2004 14:00-14:30 folded summary"
-   "&11/23/2004 14:00-14:30 folded summary")
+   "&2004/11/23 14:00-14:30 folded summary
+ Status: TENTATIVE
+ Class: PRIVATE"
+   "&23/11/2004 14:00-14:30 folded summary
+ Status: TENTATIVE
+ Class: PRIVATE"
+   "&11/23/2004 14:00-14:30 folded summary
+ Status: TENTATIVE
+ Class: PRIVATE")
   (icalendar-testsuite--test-import
    "UID
  :6161a312-3902-11d9-b512-f764153bb28b
@@ -723,9 +790,15 @@ DTEND
 DTSTAMP
  :20041118T013641Z
 "
-   "&2004/11/23 14:45-15:45 another example"
-   "&23/11/2004 14:45-15:45 another example"
-   "&11/23/2004 14:45-15:45 another example")
+   "&2004/11/23 14:45-15:45 another example
+ Status: TENTATIVE
+ Class: PRIVATE"
+   "&23/11/2004 14:45-15:45 another example
+ Status: TENTATIVE
+ Class: PRIVATE"
+   "&11/23/2004 14:45-15:45 another example
+ Status: TENTATIVE
+ Class: PRIVATE")
 
   (icalendar-testsuite--test-import
    "SUMMARY:rrule daily
@@ -890,10 +963,55 @@ CLASS:PUBLIC
 SEQUENCE:1
 CREATED:20041127T183329
 "
-   "&%%(and (diary-cyclic 1 2001 12 21) (diary-block 2001 12 21 2001 12 29))  Urlaub"
-   "&%%(and (diary-cyclic 1 21 12 2001) (diary-block 21 12 2001 29 12 2001))  Urlaub"
-   "&%%(and (diary-cyclic 1 12 21 2001) (diary-block 12 21 2001 12 29 2001))  Urlaub")
-  )
+   "&%%(and (diary-cyclic 1 2001 12 21) (diary-block 2001 12 21 2001 12 29))  Urlaub
+ Class: PUBLIC"
+   "&%%(and (diary-cyclic 1 21 12 2001) (diary-block 21 12 2001 29 12 2001))  Urlaub
+ Class: PUBLIC"
+   "&%%(and (diary-cyclic 1 12 21 2001) (diary-block 12 21 2001 12 29 2001))  Urlaub
+ Class: PUBLIC")
+
+  ;;bug#6766 -- multiple byday values in a weekly rrule
+  (icalendar-testsuite--test-import
+"CLASS:PUBLIC
+DTEND;TZID=America/New_York:20100421T120000
+DTSTAMP:20100525T141214Z
+DTSTART;TZID=America/New_York:20100421T113000
+RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,WE,TH,FR
+SEQUENCE:1
+STATUS:CONFIRMED
+SUMMARY:Scrum
+TRANSP:OPAQUE
+UID:8814e3f9-7482-408f-996c-3bfe486a1262
+END:VEVENT
+BEGIN:VEVENT
+CLASS:PUBLIC
+DTSTAMP:20100525T141214Z
+DTSTART;VALUE=DATE:20100422
+DTEND;VALUE=DATE:20100423
+RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=TU,TH
+SEQUENCE:1
+SUMMARY:Tues + Thurs thinking
+TRANSP:OPAQUE
+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
+&%%(and (memq (calendar-day-of-week date) '(2 4)) (diary-cyclic 1 2010 4 22)) Tues + Thurs thinking
+ Class: PUBLIC"
+
+"&%%(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
+&%%(and (memq (calendar-day-of-week date) '(2 4)) (diary-cyclic 1 22 4 2010)) Tues + Thurs thinking
+ Class: PUBLIC"
+
+"&%%(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
+&%%(and (memq (calendar-day-of-week date) '(2 4)) (diary-cyclic 1 4 22 2010)) Tues + Thurs thinking
+ Class: PUBLIC")
+)
 
 ;; ======================================================================
 ;; Export tests
@@ -1104,11 +1222,13 @@ END:VCALENDAR"
    "&9/5/2003 10:30-15:30 On-Site Interview
  Desc: 10:30am - Blah
  Location: Cccc
- Organizer: MAILTO:aaaaaaa@aaaaaaa.com"
+ Organizer: MAILTO:aaaaaaa@aaaaaaa.com
+ Status: CONFIRMED"
    "&5/9/2003 10:30-15:30 On-Site Interview
  Desc: 10:30am - Blah
  Location: Cccc
- Organizer: MAILTO:aaaaaaa@aaaaaaa.com")
+ Organizer: MAILTO:aaaaaaa@aaaaaaa.com
+ Status: CONFIRMED")
 
   ;; 2003-06-18 a
   (icalendar-testsuite--test-import
@@ -1146,11 +1266,13 @@ END:VALARM"
    "&23/6/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"
+ Organizer: MAILTO:xxx@xxxxx.com
+ Status: CONFIRMED"
    "&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")
+ Organizer: MAILTO:xxx@xxxxx.com
+ Status: CONFIRMED")
 
   ;; 2003-06-18 b -- uses timezone
   (icalendar-testsuite--test-import
@@ -1188,7 +1310,7 @@ ORGANIZER;CN=\"ABCD,TECHTRAINING
 \(A-Americas,exgen1)\":MAILTO:bbb@bbbbb.com
 LOCATION:123 or TN 123-1234 ID abcd & SonstWo (see below)
 DTEND;TZID=\"Mountain Time (US & Canada)\":20030623T100000
-DESCRIPTION:Viele Zeichen standen hier früher
+DESCRIPTION:Viele Zeichen standen hier früher
 SEQUENCE:0
 PRIORITY:5
 CLASS:
@@ -1211,12 +1333,12 @@ END:VEVENT
 END:VCALENDAR"
    nil
    "&23/6/2003 17:00-18:00 Updated: Dress Rehearsal for ABC01-15
- Desc: Viele Zeichen standen hier früher
+ 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"
    "&6/23/2003 17:00-18:00 Updated: Dress Rehearsal for ABC01-15
- Desc: Viele Zeichen standen hier früher
+ 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")
@@ -1661,9 +1783,13 @@ DTSTAMP
  :20050128T011209Z"
    nil
    "&%%(and (diary-block 6 2 2005 6 2 2005)) Waitangi Day
- Desc: abcdef"
+ Desc: abcdef
+ Status: CONFIRMED
+ Class: PRIVATE"
    "&%%(and (diary-block 2 6 2005 2 6 2005)) Waitangi Day
- Desc: abcdef")
+ Desc: abcdef
+ Status: CONFIRMED
+ Class: PRIVATE")
 
   ;; 2005-03-01 lt
   (icalendar-testsuite--test-import
diff --git a/test/indent/Makefile b/test/indent/Makefile
new file mode 100644 (file)
index 0000000..9e75f3d
--- /dev/null
@@ -0,0 +1,15 @@
+RM=rm
+EMACS=emacs
+
+clean:
+       -$(RM) *.test
+
+# TODO:
+# - mark the places where the indentation is known to be incorrect,
+#   and allow either ignoring those errors or not.
+%.test: %
+       -$(RM) $<.new
+       $(EMACS) --batch $< \
+           --eval '(indent-region (point-min) (point-max) nil)' \
+           --eval '(write-region (point-min) (point-max) "$<.new")'
+       diff -u -B $< $<.new
diff --git a/test/indent/octave.m b/test/indent/octave.m
new file mode 100644 (file)
index 0000000..830af96
--- /dev/null
@@ -0,0 +1,2318 @@
+## -*- octave -*-
+
+function res = tcomp (fn)
+  %% res = tcomp (fn)
+  %%     imports components and rearranges them.
+        
+  if nargin ~= 1
+    print_usage()
+  endif
+
+  data = dlmread(fn, 3, 0);
+
+  x = data(:,2:end);
+  y = 'hello';
+  z = y';
+
+  cnty = repmat(x(:,1)(:), 10, 1);
+
+  pop = x(:,1:10)(:);
+  bir = x(:,11:20)(:);
+  dth = x(:,21:30)(:);
+  imig = x(:,31:40)(:);
+  dmig = x(:,41:50)(:);
+  gq = x(:,51:60)(:);
+  
+  yrs = repmat(2000:2009, 39, 1)(:);
+
+  res = [yrs, cnty, pop, bir, dth, imig, dmig, gq];
+
+endfunction
+
+## Copyright (C) 2005, 2006, 2007, 2008, 2009 S�ren Hauberg
+## 
+## This file is part of Octave.
+##
+## Octave 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.
+##
+## Octave 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 Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Command} pkg @var{command} @var{pkg_name}
+## @deftypefnx {Command} pkg @var{command} @var{option} @var{pkg_name}
+## This command interacts with the package manager.  Different actions will
+## be taken depending on the value of @var{command}.
+##
+## @table @samp
+## @item install
+## Install named packages.  For example,
+## @example
+## pkg install image-1.0.0.tar.gz
+## @end example
+## @noindent
+## installs the package found in the file @file{image-1.0.0.tar.gz}.
+##
+## The @var{option} variable can contain options that affect the manner
+## in which a package is installed.  These options can be one or more of
+##
+## @table @code
+## @item -nodeps
+## The package manager will disable the dependency checking.  That way it 
+## is possible to install a package even if it depends on another package 
+## that's not installed on the system.  @strong{Use this option with care.}
+##
+## @item -noauto
+## The package manager will not automatically load the installed package 
+## when starting Octave, even if the package requests that it is.
+##
+## @item -auto
+## The package manager will automatically load the installed package when 
+## starting Octave, even if the package requests that it isn't.
+##
+## @item -local
+## A local installation is forced, even if the user has system privileges.
+##
+## @item -global
+## A global installation is forced, even if the user doesn't normally have
+## system privileges
+##
+## @item -verbose
+## The package manager will print the output of all of the commands that are 
+## performed.
+## @end table
+##
+## @item uninstall
+## Uninstall named packages.  For example,
+## @example
+## pkg uninstall image
+## @end example
+## @noindent
+## removes the @code{image} package from the system.  If another installed
+## package depends on the @code{image} package an error will be issued.
+## The package can be uninstalled anyway by using the @code{-nodeps} option.
+## @item load
+## Add named packages to the path.  After loading a package it is
+## possible to use the functions provided by the package.  For example,
+## @example
+## pkg load image
+## @end example
+## @noindent
+## adds the @code{image} package to the path.  It is possible to load all
+## installed packages at once with the command
+## @example
+## pkg load all
+## @end example
+## @item unload
+## Removes named packages from the path.  After unloading a package it is
+## no longer possible to use the functions provided by the package.
+## This command behaves like the @code{load} command.
+## @item list
+## Show a list of the currently installed packages.  By requesting one or two
+## output argument it is possible to get a list of the currently installed
+## packages.  For example,
+## @example
+## installed_packages = pkg list;
+## @end example
+## @noindent
+## returns a cell array containing a structure for each installed package.
+## The command
+## @example
+## [@var{user_packages}, @var{system_packages}] = pkg list
+## @end example
+## @noindent
+## splits the list of installed packages into those who are installed by
+## the current user, and those installed by the system administrator.
+## @item describe
+## Show a short description of the named installed packages, with the option
+## '-verbose' also list functions provided by the package, e.g.:
+## @example
+##  pkg describe -verbose all
+## @end example
+## @noindent
+## will describe all installed packages and the functions they provide.
+## If one output is requested a cell of structure containing the
+## description and list of functions of each package is returned as
+## output rather than printed on screen:
+## @example
+##  desc = pkg ("describe", "secs1d", "image")
+## @end example
+## @noindent
+## If any of the requested packages is not installed, pkg returns an
+## error, unless a second output is requested:
+## @example
+##  [ desc, flag] = pkg ("describe", "secs1d", "image")
+## @end example
+## @noindent
+## @var{flag} will take one of the values "Not installed", "Loaded" or
+## "Not loaded" for each of the named packages.
+## @item prefix
+## Set the installation prefix directory.  For example,
+## @example
+## pkg prefix ~/my_octave_packages
+## @end example
+## @noindent
+## sets the installation prefix to @file{~/my_octave_packages}.
+## Packages will be installed in this directory.
+##
+## It is possible to get the current installation prefix by requesting an
+## output argument.  For example,
+## @example
+## p = pkg prefix
+## @end example
+##
+## The location in which to install the architecture dependent files can be
+## independent specified with an addition argument.  For example
+##
+## @example
+## pkg prefix ~/my_octave_packages ~/my_arch_dep_pkgs
+## @end example
+## @item local_list
+## Set the file in which to look for information on the locally
+## installed packages.  Locally installed packages are those that are
+## typically available only to the current user.  For example
+## @example
+## pkg local_list ~/.octave_packages
+## @end example
+## It is possible to get the current value of local_list with the following
+## @example
+## pkg local_list
+## @end example
+## @item global_list
+## Set the file in which to look for, for information on the globally
+## installed packages.  Globally installed packages are those that are
+## typically available to all users.  For example
+## @example
+## pkg global_list /usr/share/octave/octave_packages
+## @end example
+## It is possible to get the current value of global_list with the following
+## @example
+## pkg global_list
+## @end example
+## @item rebuild
+## Rebuilds the package database from the installed directories.  This can 
+## be used in cases where for some reason the package database is corrupted.
+## It can also take the @code{-auto} and @code{-noauto} options to allow the
+## autoloading state of a package to be changed.  For example
+##
+## @example
+## pkg rebuild -noauto image
+## @end example
+##
+## will remove the autoloading status of the image package.
+## @item build
+## Builds a binary form of a package or packages.  The binary file produced
+## will itself be an Octave package that can be installed normally with
+## @code{pkg}.  The form of the command to build a binary package is
+##
+## @example
+## pkg build builddir image-1.0.0.tar.gz @dots{}
+## @end example
+##
+## @noindent
+## where @code{builddir} is the name of a directory where the temporary
+## installation will be produced and the binary packages will be found.
+## The options @code{-verbose} and @code{-nodeps} are respected, while 
+## the other options are ignored.
+## @end table
+## @end deftypefn
+
+function [local_packages, global_packages] = pkg (varargin)
+  ## Installation prefix (FIXME: what should these be on windows?)
+  persistent user_prefix = false;
+  persistent prefix = -1;
+  persistent archprefix = -1;
+  persistent local_list = tilde_expand (fullfile ("~", ".octave_packages"));
+  persistent global_list = fullfile (OCTAVE_HOME (), "share", "octave",
+                                    "octave_packages");
+  mlock ();
+
+  global_install = issuperuser ();
+
+  if (prefix == -1)
+    if (global_install)
+      prefix = fullfile (OCTAVE_HOME (), "share", "octave", "packages");
+      archprefix = fullfile (octave_config_info ("libexecdir"),
+                            "octave", "packages");
+    else
+      prefix = fullfile ("~", "octave");
+      archprefix = prefix;
+    endif
+    prefix = tilde_expand (prefix);
+    archprefix = tilde_expand (archprefix);
+  endif
+
+  available_actions = {"list", "install", "uninstall", "load", ...
+                      "unload", "prefix", "local_list", ...
+                      "global_list", "rebuild", "build","describe"}; 
+  ## Handle input
+  if (length (varargin) == 0 || ! iscellstr (varargin))
+    print_usage ();
+  endif
+  files = {};
+  deps = true;
+  auto = 0;
+  action = "none";
+  verbose = false;
+  for i = 1:length (varargin)
+    switch (varargin{i})
+      case "-nodeps"
+       deps = false;
+      case "-noauto"
+       auto = -1;
+      case "-auto"
+       auto = 1;
+      case "-verbose"
+       verbose = true;
+      case "-local"
+       global_install = false;
+       if (! user_prefix)
+         prefix = tilde_expand (fullfile ("~", "octave"));
+         archprefix = prefix;
+       endif
+      case "-global"
+       global_install = true;
+       if (! user_prefix)
+         prefix = fullfile (OCTAVE_HOME (), "share", "octave", "packages");
+         archprefix = fullfile (octave_config_info ("libexecdir"),
+                                "octave", "packages");
+       endif
+      case available_actions
+       if (strcmp (action, "none"))
+         action = varargin{i};
+       else
+         error ("more than one action specified");
+       endif
+      otherwise
+       files{end+1} = varargin{i};
+    endswitch
+  endfor
+
+  ## Take action
+  switch (action)
+    case "list"
+      if (nargout == 0)
+       installed_packages (local_list, global_list);
+      elseif (nargout == 1)
+       local_packages = installed_packages (local_list, global_list);
+      elseif (nargout == 2)
+       [local_packages, global_packages] = installed_packages (local_list,
+                                                               global_list);
+      else
+       error ("too many output arguments requested");
+      endif
+
+    case "install"
+      if (length (files) == 0)
+       error ("you must specify at least one filename when calling 'pkg install'");
+      endif
+      install (files, deps, auto, prefix, archprefix, verbose, local_list, 
+              global_list, global_install);
+
+    case "uninstall"
+      if (length (files) == 0)
+       error ("you must specify at least one package when calling 'pkg uninstall'");
+      endif
+      uninstall (files, deps, verbose, local_list, 
+                global_list, global_install);
+
+    case "load"
+      if (length (files) == 0)
+       error ("you must specify at least one package, 'all' or 'auto' when calling 'pkg load'");
+      endif
+      load_packages (files, deps, local_list, global_list);
+
+    case "unload"
+      if (length (files) == 0)
+       error ("you must specify at least one package or 'all' when calling 'pkg unload'");
+      endif
+      unload_packages (files, deps, local_list, global_list);
+
+    case "prefix"
+      if (length (files) == 0 && nargout == 0)
+       printf ("Installation prefix:             %s\n", prefix);
+       printf ("Architecture dependent prefix:   %s\n", archprefix);
+      elseif (length (files) == 0 && nargout >= 1)
+       local_packages = prefix;
+       global_packages = archprefix;
+      elseif (length (files) >= 1 && nargout <= 2 && ischar (files{1}))
+       prefix = files{1};
+       prefix = absolute_pathname (prefix);
+       local_packages = prefix;
+       user_prefix = true;
+       if (length (files) >= 2 && ischar (files{2}))
+         archprefix = files{2};
+         try
+           archprefix = absolute_pathname (archprefix);
+          catch
+           mkdir (archprefix);
+           warning ("creating the directory %s\n", archprefix);
+           archprefix = absolute_pathname (archprefix);
+         end_try_catch
+         global_packages = archprefix;
+       endif
+      else
+       error ("you must specify a prefix directory, or request an output argument");
+      endif
+
+    case "local_list"
+      if (length (files) == 0 && nargout == 0)
+       disp (local_list);
+      elseif (length (files) == 0 && nargout == 1)
+       local_packages = local_list;
+      elseif (length (files) == 1 && nargout == 0 && ischar (files{1}))
+       try
+         local_list = absolute_pathname (files{1});
+       catch
+         ## Force file to be created
+         fclose (fopen (files{1}, "wt"));
+         local_list = absolute_pathname (files{1});
+       end_try_catch
+      else
+       error ("you must specify a local_list file, or request an output argument");
+      endif
+
+    case "global_list"
+      if (length (files) == 0 && nargout == 0)
+       disp(global_list);
+      elseif (length (files) == 0 && nargout == 1)
+       local_packages = global_list;
+      elseif (length (files) == 1 && nargout == 0 && ischar (files{1}))
+       try
+         global_list = absolute_pathname (files{1});
+       catch
+         ## Force file to be created
+         fclose (fopen (files{1}, "wt"));
+         global_list = absolute_pathname (files{1});
+       end_try_catch
+      else
+       error ("you must specify a global_list file, or request an output argument");
+      endif
+
+    case "rebuild"
+      if (global_install)
+       global_packages = rebuild (prefix, archprefix, global_list, files, 
+                                  auto, verbose);
+       global_packages = save_order (global_packages);
+       save (global_list, "global_packages");
+       if (nargout > 0)
+         local_packages = global_packages;
+       endif
+      else
+       local_packages = rebuild (prefix, archprefix, local_list, files, auto, 
+                                 verbose);
+       local_packages = save_order (local_packages);
+       save (local_list, "local_packages");
+       if (nargout == 0)
+         clear ("local_packages");
+       endif
+      endif
+
+    case "build"
+      if (length (files) < 2)
+       error ("you must specify at least the build directory and one filename\nwhen calling 'pkg build'");
+      endif
+      build (files, deps, auto, verbose);
+
+    case "describe"
+      if (length (files) == 0)
+       error ("you must specify at least one package or 'all' when calling 'pkg describe'");
+      endif
+      ## FIXME: the name of the output variables is inconsistent
+      ##            with their content
+      switch (nargout)
+       case 0
+         describe (files, verbose, local_list, global_list);
+       case 1
+         pkg_desc_list = describe (files, verbose, local_list, ...
+                                   global_list);
+         local_packages = pkg_desc_list;
+       case 2
+         [pkg_desc_list, flag] = describe (files, verbose, local_list, ...
+                                           global_list);
+         local_packages  = pkg_desc_list;
+         global_packages = flag;
+       otherwise
+         error ("you can request at most two outputs when calling 'pkg describe'");
+      endswitch
+      
+    otherwise
+      error ("you must specify a valid action for 'pkg'. See 'help pkg' for details");
+  endswitch
+endfunction
+
+function descriptions = rebuild (prefix, archprefix, list, files, auto, verbose)
+  if (isempty (files))
+    [dirlist, err, msg] = readdir (prefix);
+    if (err)
+      error ("couldn't read directory %s: %s", prefix, msg);
+    endif
+    ## the two first entries of dirlist are "." and ".."
+    dirlist([1,2]) = [];
+  else
+    old_descriptions = installed_packages (list, list);
+    wd = pwd ();
+    unwind_protect
+      cd (prefix);
+      dirlist = glob (cellfun(@(x) cstrcat(x, '-*'), files, 'UniformOutput', 0));
+    unwind_protect_cleanup
+      cd (wd);
+    end_unwind_protect
+  endif
+  descriptions = {};
+  for k = 1:length (dirlist)
+    descfile = fullfile (prefix, dirlist{k}, "packinfo", "DESCRIPTION");
+    if (verbose)
+      printf ("recreating package description from %s\n", dirlist{k});
+    endif
+    if (exist (descfile, "file"))
+      desc = get_description (descfile);
+      desc.dir = fullfile (prefix, dirlist{k});
+      desc.archprefix = fullfile (archprefix, cstrcat (desc.name, "-",
+                                                      desc.version));
+      if (auto != 0)
+       if (exist (fullfile (desc.dir, "packinfo", ".autoload"), "file"))
+         unlink (fullfile (desc.dir, "packinfo", ".autoload"));
+       endif
+        if (auto < 0)
+         desc.autoload = 0;
+       elseif (auto > 0)
+         desc.autoload = 1;
+         fclose (fopen (fullfile (desc.dir, "packinfo", ".autoload"), "wt"));
+       endif
+      else
+       if (exist (fullfile (desc.dir, "packinfo", ".autoload"), "file"))
+         desc.autoload = 1;
+       else
+         desc.autoload = 0;
+       endif
+      endif
+      descriptions{end + 1} = desc;
+    elseif (verbose)
+      warning ("directory %s is not a valid package", dirlist{k});
+    endif
+  endfor
+
+  if (! isempty (files))
+    ## We are rebuilding for a particular package(s) so we should take
+    ## care to keep the other untouched packages in the descriptions
+    descriptions = {descriptions{:}, old_descriptions{:}};
+
+    dup = [];
+    for i = 1:length (descriptions)
+      if (find (dup, i))
+       continue;
+      endif
+      for j = (i+1):length (descriptions)
+       if (find (dup, j))
+         continue;
+       endif
+       if (strcmp (descriptions{i}.name, descriptions{j}.name))
+         dup = [dup, j];
+       endif
+      endfor
+    endfor
+    if (! isempty (dup))
+      descriptions (dup) = [];
+    endif  
+  endif
+endfunction
+
+function build (files, handle_deps, autoload, verbose)
+  if (length (files) < 1)
+    error ("insufficient number of files");
+  endif
+  builddir = files{1};
+  if (! exist (builddir, "dir"))
+    warning ("creating build directory %s", builddir);
+    [status, msg] = mkdir (builddir);
+    if (status != 1)
+      error ("could not create installation directory: %s", msg);
+    endif
+  endif
+  builddir = absolute_pathname (builddir);
+  installdir = fullfile (builddir, "install");
+  if (! exist (installdir, "dir"))
+    [status, msg] = mkdir (installdir);
+    if (status != 1)
+      error ("could not create installation directory: %s", msg);
+    endif
+  endif
+  files(1) = [];
+  buildlist = fullfile (builddir, "octave_packages");
+  install (files, handle_deps, autoload, installdir, installdir, verbose, 
+          buildlist, "", false);
+  unwind_protect
+    repackage (builddir, buildlist);
+  unwind_protect_cleanup
+    unload_packages ({"all"}, handle_deps, buildlist, "");
+    if (exist (installdir, "dir"))
+      rm_rf (installdir);
+    endif
+    if (exist (buildlist, "file"))
+      unlink (buildlist);
+    endif
+  end_unwind_protect
+endfunction
+
+function install (files, handle_deps, autoload, prefix, archprefix, verbose, 
+                 local_list, global_list, global_install)
+
+  ## Check that the directory in prefix exist. If it doesn't: create it!
+  if (! exist (prefix, "dir"))
+    warning ("creating installation directory %s", prefix);
+    [status, msg] = mkdir (prefix);
+    if (status != 1)
+      error ("could not create installation directory: %s", msg);
+    endif
+  endif
+
+  ## Get the list of installed packages.
+  [local_packages, global_packages] = installed_packages (local_list, 
+                                                         global_list);
+
+  installed_pkgs_lst = {local_packages{:}, global_packages{:}};        
+
+  if (global_install)
+    packages = global_packages;
+  else
+    packages = local_packages;
+  endif
+
+  ## Uncompress the packages and read the DESCRIPTION files.
+  tmpdirs = packdirs = descriptions = {};
+  try
+    ## Warn about non existent files.
+    for i = 1:length (files)
+      if (isempty (glob(files{i}))) 
+       warning ("file %s does not exist", files{i});
+      endif
+    endfor
+
+    ## Unpack the package files and read the DESCRIPTION files.
+    files = glob (files);
+    packages_to_uninstall = [];
+    for i = 1:length (files)
+      tgz = files{i};
+
+      if (exist (tgz, "file"))
+       ## Create a temporary directory.
+       tmpdir = tmpnam ();
+       tmpdirs{end+1} = tmpdir;
+        if (verbose)
+         printf ("mkdir (%s)\n", tmpdir);
+       endif
+       [status, msg] = mkdir (tmpdir);
+       if (status != 1)
+         error ("couldn't create temporary directory: %s", msg);
+       endif
+
+       ## Uncompress the package.
+       if (verbose)
+         printf ("untar (%s, %s)\n", tgz, tmpdir);
+       endif
+       untar (tgz, tmpdir);
+
+       ## Get the name of the directories produced by tar.
+       [dirlist, err, msg] = readdir (tmpdir);
+       if (err)
+         error ("couldn't read directory produced by tar: %s", msg);
+       endif
+
+       if (length (dirlist) > 3)
+         error ("bundles of packages are not allowed")
+       endif
+      endif
+
+      ## The filename pointed to an uncompressed package to begin with.
+      if (exist (tgz, "dir"))
+       dirlist = {".", "..", tgz};
+      endif
+
+      if (exist (tgz, "file") || exist (tgz, "dir"))
+       ## The two first entries of dirlist are "." and "..".
+       if (exist (tgz, "file"))
+         packdir = fullfile (tmpdir, dirlist{3});
+       else
+         packdir = fullfile (pwd(), dirlist{3});
+       endif
+       packdirs{end+1} = packdir;
+       
+       ## Make sure the package contains necessary files.
+       verify_directory (packdir);
+       
+       ## Read the DESCRIPTION file.
+       filename = fullfile (packdir, "DESCRIPTION");
+       desc = get_description (filename);
+       
+       ## Verify that package name corresponds with filename.
+       [dummy, nm] = fileparts (tgz); 
+       if ((length (nm) >= length (desc.name))
+           && ! strcmp (desc.name, nm(1:length(desc.name))))
+         error ("package name '%s' doesn't correspond to its filename '%s'", 
+                desc.name, nm);
+       endif
+       
+       ## Set default installation directory.
+       desc.dir = fullfile (prefix, cstrcat (desc.name, "-", desc.version));
+       
+       ## Set default architectire dependent installation directory.
+       desc.archprefix = fullfile (archprefix, cstrcat (desc.name, "-",
+                                                        desc.version));
+       
+       ## Save desc.
+       descriptions{end+1} = desc;
+       
+       ## Are any of the new packages already installed?
+       ## If so we'll remove the old version.
+       for j = 1:length (packages)
+         if (strcmp (packages{j}.name, desc.name))
+           packages_to_uninstall(end+1) = j;
+         endif
+       endfor
+      endif
+    endfor
+  catch
+    ## Something went wrong, delete tmpdirs.
+    for i = 1:length (tmpdirs)
+      rm_rf (tmpdirs{i});
+    endfor
+    rethrow (lasterror ());
+  end_try_catch
+
+  ## Check dependencies.
+  if (handle_deps)
+    ok = true;
+    error_text = "";
+    for i = 1:length (descriptions)
+      desc = descriptions{i};
+      idx2 = complement (i, 1:length(descriptions));
+      if (global_install)
+       ## Global installation is not allowed to have dependencies on locally
+       ## installed packages.
+       idx1 = complement (packages_to_uninstall, 
+                          1:length(global_packages));
+       pseudo_installed_packages = {global_packages{idx1}, ...
+                                    descriptions{idx2}};
+      else
+       idx1 = complement (packages_to_uninstall, 
+                          1:length(local_packages));
+       pseudo_installed_packages = {local_packages{idx1}, ... 
+                                    global_packages{:}, ...
+                                    descriptions{idx2}};
+      endif
+      bad_deps = get_unsatisfied_deps (desc, pseudo_installed_packages);
+      ## Are there any unsatisfied dependencies?
+      if (! isempty (bad_deps))
+       ok = false;
+       for i = 1:length (bad_deps)
+         dep = bad_deps{i};
+         error_text = cstrcat (error_text, " ", desc.name, " needs ",
+                               dep.package, " ", dep.operator, " ",
+                               dep.version, "\n");
+       endfor
+      endif
+    endfor
+
+    ## Did we find any unsatisfied dependencies?
+    if (! ok)
+      error ("the following dependencies where unsatisfied:\n  %s", error_text);
+    endif
+  endif
+
+  ## Prepare each package for installation.
+  try
+    for i = 1:length (descriptions)
+      desc = descriptions{i};
+      pdir = packdirs{i};
+      prepare_installation (desc, pdir);
+      configure_make (desc, pdir, verbose);
+    endfor
+  catch
+    ## Something went wrong, delete tmpdirs.
+    for i = 1:length (tmpdirs)
+      rm_rf (tmpdirs{i});
+    endfor
+    rethrow (lasterror ());
+  end_try_catch
+
+  ## Uninstall the packages that will be replaced.
+  try
+    for i = packages_to_uninstall
+      if (global_install)
+       uninstall ({global_packages{i}.name}, false, verbose, local_list, 
+                  global_list, global_install);
+      else
+       uninstall ({local_packages{i}.name}, false, verbose, local_list, 
+                  global_list, global_install);
+      endif
+    endfor
+  catch
+    ## Something went wrong, delete tmpdirs.
+    for i = 1:length (tmpdirs)
+      rm_rf (tmpdirs{i});
+    endfor
+    rethrow (lasterror ());
+  end_try_catch
+
+  ## Install each package.
+  try
+    for i = 1:length (descriptions)
+      desc = descriptions{i};
+      pdir = packdirs{i};
+      copy_files (desc, pdir, global_install);
+      create_pkgadddel (desc, pdir, "PKG_ADD", global_install);
+      create_pkgadddel (desc, pdir, "PKG_DEL", global_install);
+      finish_installation (desc, pdir, global_install);
+      generate_lookfor_cache (desc);
+    endfor
+  catch
+    ## Something went wrong, delete tmpdirs.
+    for i = 1:length (tmpdirs)
+      rm_rf (tmpdirs{i});
+    endfor
+    for i = 1:length (descriptions)
+      rm_rf (descriptions{i}.dir);
+      rm_rf (getarchdir (descriptions{i}));
+    endfor
+    rethrow (lasterror ());
+  end_try_catch
+
+  ## Check if the installed directory is empty. If it is remove it
+  ## from the list.
+  for i = length (descriptions):-1:1
+    if (dirempty (descriptions{i}.dir, {"packinfo", "doc"}) &&
+       dirempty (getarchdir (descriptions{i})))
+      warning ("package %s is empty\n", descriptions{i}.name);
+      rm_rf (descriptions{i}.dir);
+      rm_rf (getarchdir (descriptions{i}));
+      descriptions(i) = [];
+    endif
+  endfor
+
+  ## If the package requested that it is autoloaded, or the installer
+  ## requested that it is, then mark the package as autoloaded.
+  for i = length (descriptions):-1:1
+    if (autoload > 0 || (autoload == 0 && isautoload (descriptions(i))))
+      fclose (fopen (fullfile (descriptions{i}.dir, "packinfo", 
+                              ".autoload"), "wt"));
+      descriptions{i}.autoload = 1;
+    endif
+  endfor
+
+  ## Add the packages to the package list.
+  try
+    if (global_install)
+      idx = complement (packages_to_uninstall, 1:length(global_packages));
+      global_packages = save_order ({global_packages{idx}, descriptions{:}});
+      save (global_list, "global_packages");
+      installed_pkgs_lst = {local_packages{:}, global_packages{:}};
+    else
+      idx = complement (packages_to_uninstall, 1:length(local_packages));
+      local_packages = save_order ({local_packages{idx}, descriptions{:}});
+      save (local_list, "local_packages");
+      installed_pkgs_lst = {local_packages{:}, global_packages{:}};
+    endif
+  catch
+    ## Something went wrong, delete tmpdirs.
+    for i = 1:length (tmpdirs)
+      rm_rf (tmpdirs{i});
+    endfor
+    for i = 1:length (descriptions)
+      rm_rf (descriptions{i}.dir);
+    endfor
+    if (global_install)
+      printf ("error: couldn't append to %s\n", global_list);
+    else
+      printf ("error: couldn't append to %s\n", local_list);
+    endif
+    rethrow (lasterror ());
+  end_try_catch
+
+  ## All is well, let's clean up.
+  for i = 1:length (tmpdirs)
+    [status, msg] = rm_rf (tmpdirs{i});
+    if (status != 1)
+      warning ("couldn't clean up after my self: %s\n", msg);
+    endif
+  endfor
+
+  ## Add the newly installed packages to the path, so the user
+  ## can begin using them. Only load them if they are marked autoload.
+  if (length (descriptions) > 0)
+    idx = [];
+    for i = 1:length (descriptions)
+      if (isautoload (descriptions(i)))
+       nm = descriptions{i}.name;
+       for j = 1:length (installed_pkgs_lst)
+         if (strcmp (nm, installed_pkgs_lst{j}.name))
+           idx (end + 1) = j;
+           break;
+         endif
+       endfor
+      endif
+    endfor
+    load_packages_and_dependencies (idx, handle_deps, installed_pkgs_lst,
+                                   global_install);
+  endif
+endfunction
+
+function uninstall (pkgnames, handle_deps, verbose, local_list, 
+                   global_list, global_install)
+  ## Get the list of installed packages.
+  [local_packages, global_packages] = installed_packages(local_list, 
+                                                        global_list);
+  if (global_install)
+    installed_pkgs_lst = {local_packages{:}, global_packages{:}};
+  else
+    installed_pkgs_lst = local_packages;
+  endif
+
+  num_packages = length (installed_pkgs_lst);
+  delete_idx = [];
+  for i = 1:num_packages
+    cur_name = installed_pkgs_lst{i}.name;
+    if (any (strcmp (cur_name, pkgnames)))
+      delete_idx(end+1) = i;
+    endif
+  endfor
+
+  ## Are all the packages that should be uninstalled already installed?
+  if (length (delete_idx) != length (pkgnames))
+    if (global_install)
+      ## Try again for a locally installed package.
+      installed_pkgs_lst = local_packages;
+
+      num_packages = length (installed_pkgs_lst);
+      delete_idx = [];
+      for i = 1:num_packages
+       cur_name = installed_pkgs_lst{i}.name;
+       if (any (strcmp (cur_name, pkgnames)))
+         delete_idx(end+1) = i;
+       endif
+      endfor
+      if (length (delete_idx) != length (pkgnames))
+       ## FIXME: We should have a better error message.
+       warning ("some of the packages you want to uninstall are not installed");
+      endif
+    else
+      ## FIXME: We should have a better error message.
+      warning ("some of the packages you want to uninstall are not installed");
+    endif
+  endif
+
+  ## Compute the packages that will remain installed.
+  idx = complement (delete_idx, 1:num_packages);
+  remaining_packages = {installed_pkgs_lst{idx}};
+
+  ## Check dependencies.
+  if (handle_deps)
+    error_text = "";
+    for i = 1:length (remaining_packages)
+      desc = remaining_packages{i};
+      bad_deps = get_unsatisfied_deps (desc, remaining_packages);
+
+      ## Will the uninstallation break any dependencies?
+      if (! isempty (bad_deps))
+       for i = 1:length (bad_deps)
+         dep = bad_deps{i};
+         error_text = cstrcat (error_text, " ", desc.name, " needs ",
+                               dep.package, " ", dep.operator, " ",
+                               dep.version, "\n");
+       endfor
+      endif
+    endfor
+
+    if (! isempty (error_text))
+      error ("the following dependencies where unsatisfied:\n  %s", error_text);
+    endif
+  endif
+
+  ## Delete the directories containing the packages.
+  for i = delete_idx
+    desc = installed_pkgs_lst{i};
+    ## If an 'on_uninstall.m' exist, call it!
+    if (exist (fullfile (desc.dir, "packinfo", "on_uninstall.m"), "file"))
+      wd = pwd ();
+      cd (fullfile (desc.dir, "packinfo"));
+      on_uninstall (desc);
+      cd (wd);
+    endif
+    ## Do the actual deletion.
+    if (desc.loaded)
+      rmpath (desc.dir);
+      if (exist (getarchdir (desc)))
+       rmpath (getarchdir (desc));
+      endif
+    endif
+    if (exist (desc.dir, "dir"))
+      [status, msg] = rm_rf (desc.dir);
+      if (status != 1)
+       error ("couldn't delete directory %s: %s", desc.dir, msg);
+      endif
+      [status, msg] = rm_rf (getarchdir (desc));
+      if (status != 1)
+       error ("couldn't delete directory %s: %s", getarchdir (desc), msg);
+      endif
+      if (dirempty (desc.archprefix))
+       rm_rf (desc.archprefix);
+      endif
+    else
+      warning ("directory %s previously lost", desc.dir);
+    endif
+  endfor
+
+  ## Write a new ~/.octave_packages.
+  if (global_install)
+    if (length (remaining_packages) == 0)
+      unlink (global_list);
+    else
+      global_packages = save_order (remaining_packages);
+      save (global_list, "global_packages");
+    endif
+  else
+    if (length (remaining_packages) == 0)
+      unlink (local_list);
+    else
+      local_packages = save_order (remaining_packages);
+      save (local_list, "local_packages");
+    endif
+  endif
+
+endfunction
+
+function [pkg_desc_list, flag] = describe (pkgnames, verbose, 
+                                          local_list, global_list)
+
+  ## Get the list of installed packages.
+  installed_pkgs_lst = installed_packages(local_list, global_list);
+  num_packages = length (installed_pkgs_lst);
+  
+
+  describe_all = false;
+  if (any (strcmp ("all", pkgnames)))
+    describe_all = true;
+    flag(1:num_packages) = {"Not Loaded"};
+    num_pkgnames = num_packages;
+  else
+    num_pkgnames = length (pkgnames);
+    flag(1:num_pkgnames) = {"Not installed"};
+  endif
+
+  for i = 1:num_packages
+    curr_name = installed_pkgs_lst{i}.name;
+    if (describe_all)
+      name_pos = i;
+    else
+      name_pos = find(strcmp (curr_name, pkgnames));
+    endif
+
+    if (! isempty (name_pos))
+      if (installed_pkgs_lst{i}.loaded)
+       flag{name_pos} = "Loaded";
+      else
+       flag{name_pos} = "Not loaded";
+      endif
+
+      pkg_desc_list{name_pos}.name = installed_pkgs_lst{i}.name;
+      pkg_desc_list{name_pos}.version = installed_pkgs_lst{i}.version;
+      pkg_desc_list{name_pos}.description = installed_pkgs_lst{i}.description;
+      pkg_desc_list{name_pos}.provides = parse_pkg_idx (installed_pkgs_lst{i}.dir);
+
+    endif
+  endfor
+
+  non_inst = find (strcmp (flag, "Not installed"));
+  if (! isempty (non_inst))
+    if (nargout < 2)
+      non_inst_str = sprintf (" %s ", pkgnames{non_inst});
+      error ("some packages are not installed: %s", non_inst_str);
+    else
+      pkg_desc_list{non_inst} = struct ("name", {}, "description",  
+                                       {}, "provides", {});
+    endif
+  endif
+
+  if (nargout == 0)
+    for i = 1:num_pkgnames
+      print_package_description (pkg_desc_list{i}.name,
+                                pkg_desc_list{i}.version,
+                                pkg_desc_list{i}.provides,  
+                                pkg_desc_list{i}.description,
+                                flag{i}, verbose);
+    endfor
+  endif
+
+endfunction
+
+## AUXILIARY FUNCTIONS
+
+## Read an INDEX file.
+function [pkg_idx_struct] = parse_pkg_idx (packdir)
+
+  index_file = fullfile (packdir, "packinfo", "INDEX");
+
+  if (! exist (index_file, "file"))
+    error ("could not find any INDEX file in directory %s, try 'pkg rebuild all' to generate missing INDEX files", packdir);
+  endif    
+
+  
+  [fid, msg] = fopen (index_file, "r");
+  if (fid == -1)
+    error ("the INDEX file %s could not be read: %s", 
+          index_file, msg);
+  endif
+
+  cat_num = 1;
+  pkg_idx_struct{1}.category = "Uncategorized";
+  pkg_idx_struct{1}.functions = {};
+
+  line = fgetl (fid);
+  while (isempty (strfind (line, ">>")) && ! feof (fid))
+    line = fgetl (fid);
+  endwhile
+
+  while (! feof (fid) || line != -1)
+    if (! any (! isspace (line)) || line(1) == "#" || any (line == "="))
+    ## Comments,  blank lines or comments about unimplemented 
+    ## functions: do nothing
+    ## FIXME: probably comments and pointers to external functions
+    ## could be treated better when printing to screen?
+    elseif (! isempty (strfind (line, ">>")))
+    ## Skip package name and description as they are in DESCRIPTION
+    ## already.
+    elseif (! isspace (line(1)))
+      ## Category.
+      if (! isempty (pkg_idx_struct{cat_num}.functions))
+       pkg_idx_struct{++cat_num}.functions = {};
+      endif
+      pkg_idx_struct{cat_num}.category = deblank (line);
+    else
+      ## Function names.
+      while (any (! isspace (line)))
+       [fun_name, line] = strtok (line);
+       pkg_idx_struct{cat_num}.functions{end+1} = deblank (fun_name);
+      endwhile
+    endif
+    line = fgetl (fid);
+  endwhile
+  fclose (fid);
+endfunction
+
+function print_package_description (pkg_name, pkg_ver, pkg_idx_struct, 
+                                   pkg_desc, status, verbose)
+
+  printf ("---\nPackage name:\n\t%s\n", pkg_name);
+  printf ("Version:\n\t%s\n", pkg_ver);
+  printf ("Short description:\n\t%s\n", pkg_desc);
+  printf ("Status:\n\t%s\n", status);
+  if (verbose)
+    printf ("---\nProvides:\n");    
+    for i = 1:length(pkg_idx_struct)
+      if (! isempty (pkg_idx_struct{i}.functions))
+       printf ("%s\n", pkg_idx_struct{i}.category);
+       for j = 1:length(pkg_idx_struct{i}.functions)
+         printf ("\t%s\n", pkg_idx_struct{i}.functions{j});
+       endfor
+      endif
+    endfor
+  endif
+
+endfunction
+
+
+function pth = absolute_pathname (pth)
+  [status, msg, msgid] = fileattrib (pth);
+  if (status != 1)
+    error ("could not find the file or path %s", pth);
+  else
+    pth = msg.Name;
+  endif
+endfunction
+
+function repackage (builddir, buildlist)
+  packages = installed_packages (buildlist, buildlist);
+
+  wd = pwd();
+  for i = 1 : length(packages)
+    pack = packages{i};
+    unwind_protect
+      cd (builddir);
+      mkdir (pack.name);
+      mkdir (fullfile (pack.name, "inst"));
+      copyfile (fullfile (pack.dir, "*"), fullfile (pack.name, "inst"));
+      movefile (fullfile (pack.name, "inst","packinfo", "*"), pack.name);
+      if (exist (fullfile (pack.name, "inst","packinfo", ".autoload"), "file"))
+       unlink (fullfile (pack.name, "inst","packinfo", ".autoload"));
+      endif
+      rmdir (fullfile (pack.name, "inst", "packinfo"));
+      if (exist (fullfile (pack.name, "inst", "doc"), "dir"))
+       movefile (fullfile (pack.name, "inst", "doc"), pack.name);
+      endif
+      if (exist (fullfile (pack.name, "inst", "bin"), "dir"))
+       movefile (fullfile (pack.name, "inst", "bin"), pack.name);
+      endif
+      archdir = fullfile (pack.archprefix, cstrcat (pack.name, "-",
+                                                   pack.version), getarch ());
+      if (exist (archdir, "dir"))
+       if (exist (fullfile (pack.name, "inst", "PKG_ADD"), "file"))
+         unlink (fullfile (pack.name, "inst", "PKG_ADD"));
+       endif
+       if (exist (fullfile (pack.name, "inst", "PKG_DEL"), "file"))
+         unlink (fullfile (pack.name, "inst", "PKG_DEL"));
+       endif
+       if (exist (fullfile (archdir, "PKG_ADD"), "file"))
+         movefile (fullfile (archdir, "PKG_ADD"), 
+                   fullfile (pack.name, "PKG_ADD"));
+       endif
+       if (exist (fullfile (archdir, "PKG_DEL"), "file"))
+         movefile (fullfile (archdir, "PKG_DEL"), 
+                   fullfile (pack.name, "PKG_DEL")); 
+       endif
+      else
+       if (exist (fullfile (pack.name, "inst", "PKG_ADD"), "file"))
+         movefile (fullfile (pack.name, "inst", "PKG_ADD"), 
+                   fullfile (pack.name, "PKG_ADD"));
+       endif 
+       if (exist (fullfile (pack.name, "inst", "PKG_DEL"), "file"))
+         movefile (fullfile (pack.name, "inst", "PKG_DEL"), 
+                   fullfile (pack.name, "PKG_DEL")); 
+       endif   
+      endif    
+      tfile = cstrcat (pack.name, "-", pack.version, ".tar");
+      tar (tfile, pack.name);
+      try 
+       gzip (tfile);
+       unlink (tfile);
+      catch
+       warning ("failed to compress %s", tfile);
+      end_try_catch
+    unwind_protect_cleanup
+      if (exist (pack.name, "dir"))
+       rm_rf (pack.name);
+      endif
+      cd (wd);
+    end_unwind_protect
+  endfor
+endfunction
+
+function auto = isautoload (desc)
+  auto = false;
+  if (isfield (desc{1}, "autoload"))
+    a = desc{1}.autoload;
+    if ((isnumeric (a) && a > 0)
+        || (ischar (a) && (strcmpi (a, "true")
+                          || strcmpi (a, "on")
+                          || strcmpi (a, "yes")
+                          || strcmpi (a, "1"))))
+      auto = true;
+    endif
+  endif
+endfunction
+
+function prepare_installation (desc, packdir)
+  ## Is there a pre_install to call?
+  if (exist (fullfile (packdir, "pre_install.m"), "file"))
+    wd = pwd ();
+    try
+      cd (packdir);
+      pre_install (desc); 
+      cd (wd);
+    catch
+      cd (wd);
+      rethrow (lasterror ());
+    end_try_catch
+  endif
+
+  ## If the directory "inst" doesn't exist, we create it.
+  inst_dir = fullfile (packdir, "inst");
+  if (! exist (inst_dir, "dir"))
+    [status, msg] = mkdir (inst_dir);
+    if (status != 1)
+      rm_rf (desc.dir);
+      error ("the 'inst' directory did not exist and could not be created: %s", 
+            msg);
+    endif
+  endif
+endfunction
+
+function configure_make (desc, packdir, verbose)   
+  ## Perform ./configure, make, make install in "src".
+  if (exist (fullfile (packdir, "src"), "dir"))
+    src = fullfile (packdir, "src");
+    ## Configure.
+    if (exist (fullfile (src, "configure"), "file"))
+      flags = "";
+      if (isempty (getenv ("CC")))
+        flags = cstrcat (flags, " CC=\"", octave_config_info ("CC"), "\"");
+      endif
+      if (isempty (getenv ("CXX")))
+        flags = cstrcat (flags, " CXX=\"", octave_config_info ("CXX"), "\"");
+      endif
+      if (isempty (getenv ("AR")))
+        flags = cstrcat (flags, " AR=\"", octave_config_info ("AR"), "\"");
+      endif
+      if (isempty (getenv ("RANLIB")))
+        flags = cstrcat (flags, " RANLIB=\"", octave_config_info ("RANLIB"), "\"");
+      endif
+      [status, output] = shell (strcat ("cd '", src, "'; ./configure --prefix=\"",
+                                        desc.dir, "\"", flags));
+      if (status != 0)
+       rm_rf (desc.dir);
+       error ("the configure script returned the following error: %s", output);
+      elseif (verbose)
+       printf("%s", output);
+      endif
+
+    endif
+
+    ## Make.
+    if (exist (fullfile (src, "Makefile"), "file"))
+      [status, output] = shell (cstrcat ("export INSTALLDIR=\"", desc.dir,
+                                        "\"; make -C '", src, "'"));
+      if (status != 0)
+       rm_rf (desc.dir);
+       error ("'make' returned the following error: %s", output);
+      elseif (verbose)
+       printf("%s", output);
+      endif
+    endif
+
+    ## Copy files to "inst" and "inst/arch" (this is instead of 'make
+    ## install').
+    files = fullfile (src, "FILES");
+    instdir = fullfile (packdir, "inst");
+    archdir = fullfile (packdir, "inst", getarch ());
+
+    ## Get file names.
+    if (exist (files, "file"))
+      [fid, msg] = fopen (files, "r");
+      if (fid < 0)
+       error ("couldn't open %s: %s", files, msg);
+      endif
+      filenames = char (fread (fid))';
+      fclose (fid);
+      if (filenames(end) == "\n")
+       filenames(end) = [];
+      endif
+      filenames = split_by (filenames, "\n");
+      delete_idx =  [];
+      for i = 1:length (filenames)
+       if (! all (isspace (filenames{i})))
+         filenames{i} = fullfile (src, filenames{i});
+       else
+         delete_idx(end+1) = i;
+       endif
+      endfor
+      filenames(delete_idx) = [];
+    else
+      m = dir (fullfile (src, "*.m"));
+      oct = dir (fullfile (src, "*.oct"));
+      mex = dir (fullfile (src, "*.mex"));
+
+      filenames = cellfun (@(x) fullfile (src, x),
+                          {m.name, oct.name, mex.name},
+                          "UniformOutput", false);
+    endif
+
+    ## Split into architecture dependent and independent files.
+    if (isempty (filenames))
+      idx = [];
+    else
+      idx = cellfun (@is_architecture_dependent, filenames);
+    endif
+    archdependent = filenames (idx);
+    archindependent = filenames (!idx);
+
+    ## Copy the files.
+    if (! all (isspace ([filenames{:}])))
+       if (! exist (instdir, "dir")) # fixindent
+         mkdir (instdir);
+       endif
+       if (! all (isspace ([archindependent{:}])))
+         if (verbose)
+           printf ("copyfile");
+           printf (" %s", archindependent{:});
+           printf ("%s\n", instdir);
+         endif
+         [status, output] = copyfile (archindependent, instdir);
+         if (status != 1)
+           rm_rf (desc.dir);
+           error ("Couldn't copy files from 'src' to 'inst': %s", output);
+         endif
+        endif
+       if (! all (isspace ([archdependent{:}])))
+         if (verbose)
+           printf ("copyfile");
+           printf (" %s", archdependent{:});
+           printf (" %s\n", archdir);
+         endif
+         if (! exist (archdir, "dir")) 
+           mkdir (archdir);
+         endif
+         [status, output] = copyfile (archdependent, archdir);
+         if (status != 1)
+           rm_rf (desc.dir);
+           error ("Couldn't copy files from 'src' to 'inst': %s", output);
+         endif
+        endif
+    endif
+  endif
+endfunction
+
+function pkg = extract_pkg (nm, pat)
+  fid = fopen (nm, "rt");
+  pkg = "";
+  if (fid >= 0)
+    while (! feof (fid))
+      ln = fgetl (fid);
+      if (ln > 0)
+       t = regexp (ln, pat, "tokens");
+       if (! isempty (t))
+          pkg = cstrcat (pkg, "\n", t{1}{1});
+       endif
+      endif
+    endwhile
+    if (! isempty (pkg))
+      pkg = cstrcat (pkg, "\n");
+    endif
+    fclose (fid);
+  endif
+endfunction
+
+function create_pkgadddel (desc, packdir, nm, global_install)
+  instpkg = fullfile (desc.dir, nm);
+  instfid = fopen (instpkg, "wt");
+  ## If it is exists, most of the  PKG_* file should go into the 
+  ## architecture dependent directory so that the autoload/mfilename 
+  ## commands work as expected. The only part that doesn't is the
+  ## part in the main directory.
+  archdir = fullfile (getarchprefix (desc), cstrcat (desc.name, "-",
+                                                    desc.version), getarch ());
+  if (exist (getarchdir (desc, global_install), "dir"))
+    archpkg = fullfile (getarchdir (desc, global_install), nm);
+    archfid = fopen (archpkg, "at");
+  else
+    archpkg = instpkg;
+    archfid = instfid;
+  endif
+
+  if (archfid >= 0 && instfid >= 0)
+    ## Search all dot-m files for PKG commands.
+    lst = dir (fullfile (packdir, "inst", "*.m"));
+    for i = 1:length (lst)
+      nam = fullfile (packdir, "inst", lst(i).name);
+      fwrite (instfid, extract_pkg (nam, ['^[#%][#%]* *' nm ': *(.*)$']));
+    endfor                                   # fixindent
+
+    ## Search all C++ source files for PKG commands.
+    lst = dir (fullfile (packdir, "src", "*.cc")); # fixindent
+    for i = 1:length (lst)
+      nam = fullfile (packdir, "src", lst(i).name);
+      fwrite (archfid, extract_pkg (nam, ['^//* *' nm ': *(.*)$']));
+      fwrite (archfid, extract_pkg (nam, ['^/\** *' nm ': *(.*) *\*/$']));
+    endfor
+
+    ## Add developer included PKG commands.
+    packdirnm = fullfile (packdir, nm);
+    if (exist (packdirnm, "file"))
+      fid = fopen (packdirnm, "rt");
+      if (fid >= 0)
+        while (! feof (fid))
+          ln = fgets (fid);
+          if (ln > 0)
+            fwrite (archfid, ln);
+          endif
+        endwhile
+        fclose (fid);
+      endif
+    endif
+
+    ## If the files is empty remove it.
+    fclose (instfid);
+    t = dir (instpkg);
+    if (t.bytes <= 0)
+      unlink (instpkg);
+    endif
+
+    if (instfid != archfid)
+      fclose (archfid);
+      t = dir (archpkg);
+      if (t.bytes <= 0)
+        unlink (archpkg);
+      endif
+    endif
+  endif                         # fixindent
+endfunction                     # fixindent
+
+function copy_files (desc, packdir, global_install) # fixindent
+  ## Create the installation directory.
+  if (! exist (desc.dir, "dir"))
+    [status, output] = mkdir (desc.dir);
+    if (status != 1)
+      error ("couldn't create installation directory %s : %s", 
+            desc.dir, output);
+    endif
+  endif
+
+  octfiledir = getarchdir (desc);
+
+  ## Copy the files from "inst" to installdir.
+  instdir = fullfile (packdir, "inst");
+  if (! dirempty (instdir))
+    [status, output] = copyfile (fullfile (instdir, "*"), desc.dir);
+    if (status != 1)
+      rm_rf (desc.dir);
+      error ("couldn't copy files to the installation directory");
+    endif
+    if (exist (fullfile (desc.dir, getarch ()), "dir") &&
+       ! strcmp (fullfile (desc.dir, getarch ()), octfiledir))
+      if (! exist (octfiledir, "dir"))
+        ## Can be required to create upto three levels of dirs.
+        octm1 = fileparts (octfiledir);
+        if (! exist (octm1, "dir"))
+          octm2 = fileparts (octm1);
+          if (! exist (octm2, "dir"))
+            octm3 = fileparts (octm2);
+            if (! exist (octm3, "dir"))
+              [status, output] = mkdir (octm3);
+              if (status != 1)
+                rm_rf (desc.dir);
+                error ("couldn't create installation directory %s : %s", 
+                       octm3, output);
+              endif
+            endif
+            [status, output] = mkdir (octm2);
+            if (status != 1)
+              rm_rf (desc.dir);
+              error ("couldn't create installation directory %s : %s", 
+                     octm2, output);
+            endif
+          endif
+          [status, output] = mkdir (octm1);
+          if (status != 1)
+            rm_rf (desc.dir);
+            error ("couldn't create installation directory %s : %s", 
+                   octm1, output);
+          endif
+        endif
+        [status, output] = mkdir (octfiledir);
+        if (status != 1)
+          rm_rf (desc.dir);
+          error ("couldn't create installation directory %s : %s", 
+                octfiledir, output);
+        endif
+      endif
+      [status, output] = movefile (fullfile (desc.dir, getarch (), "*"), 
+                                  octfiledir);
+      rm_rf (fullfile (desc.dir, getarch ()));
+
+      if (status != 1)
+        rm_rf (desc.dir);
+        rm_rf (octfiledir);
+        error ("couldn't copy files to the installation directory");
+      endif
+    endif
+
+  endif
+
+  ## Create the "packinfo" directory.
+  packinfo = fullfile (desc.dir, "packinfo");
+  [status, msg] = mkdir (packinfo);
+  if (status != 1)
+    rm_rf (desc.dir);
+    rm_rf (octfiledir);
+    error ("couldn't create packinfo directory: %s", msg);
+  endif
+
+  ## Copy DESCRIPTION.
+  [status, output] = copyfile (fullfile (packdir, "DESCRIPTION"), packinfo);
+  if (status != 1)
+    rm_rf (desc.dir);
+    rm_rf (octfiledir);
+    error ("couldn't copy DESCRIPTION: %s", output);
+  endif
+
+  ## Copy COPYING.
+  [status, output] = copyfile (fullfile (packdir, "COPYING"), packinfo);
+  if (status != 1)
+    rm_rf (desc.dir);
+    rm_rf (octfiledir);
+    error ("couldn't copy COPYING: %s", output);
+  endif
+
+  ## If the file ChangeLog exists, copy it.
+  changelog_file = fullfile (packdir, "ChangeLog");
+  if (exist (changelog_file, "file"))
+    [status, output] = copyfile (changelog_file, packinfo);
+    if (status != 1)
+      rm_rf (desc.dir);
+      rm_rf (octfiledir);
+      error ("couldn't copy ChangeLog file: %s", output);
+    endif
+  endif
+
+  ## Is there an INDEX file to copy or should we generate one?
+  index_file = fullfile (packdir, "INDEX");
+  if (exist(index_file, "file"))
+    [status, output] = copyfile (index_file, packinfo);
+    if (status != 1)
+      rm_rf (desc.dir);
+      rm_rf (octfiledir);
+      error ("couldn't copy INDEX file: %s", output);
+    endif
+  else
+    try
+      write_index (desc, fullfile (packdir, "inst"),
+                  fullfile (packinfo, "INDEX"), global_install);
+    catch
+      rm_rf (desc.dir);
+      rm_rf (octfiledir);
+      rethrow (lasterror ());
+    end_try_catch
+  endif
+
+  ## Is there an 'on_uninstall.m' to install?
+  fon_uninstall = fullfile (packdir, "on_uninstall.m");
+  if (exist (fon_uninstall, "file"))
+    [status, output] = copyfile (fon_uninstall, packinfo);
+    if (status != 1)
+      rm_rf (desc.dir);
+      rm_rf (octfiledir);
+      error ("couldn't copy on_uninstall.m: %s", output);
+    endif
+  endif
+
+  ## Is there a doc/ directory that needs to be installed?
+  docdir = fullfile (packdir, "doc");
+  if (exist (docdir, "dir") && ! dirempty (docdir))
+    [status, output] = copyfile (docdir, desc.dir);
+  endif
+
+  ## Is there a bin/ directory that needs to be installed?
+  ## FIXME: Need to treat architecture dependent files in bin/
+  bindir = fullfile (packdir, "bin");
+  if (exist (bindir, "dir") && ! dirempty (bindir))
+    [status, output] = copyfile (bindir, desc.dir);
+  endif
+endfunction
+
+function finish_installation (desc, packdir, global_install)
+  ## Is there a post-install to call?
+  if (exist (fullfile (packdir, "post_install.m"), "file"))
+    wd = pwd ();
+    try
+      cd (packdir);
+      post_install (desc);
+      cd (wd);
+    catch
+      cd (wd);
+      rm_rf (desc.dir);
+      rm_rf (getarchdir (desc), global_install);
+      rethrow (lasterror ());
+    end_try_catch
+  endif
+endfunction
+
+function generate_lookfor_cache (desc)
+  dirs = split_by (genpath (desc.dir), pathsep ());
+  for i = 1 : length (dirs)
+    gen_doc_cache (fullfile (dirs{i}, "doc-cache"), dirs{i});
+  endfor
+endfunction
+
+## Make sure the package contains the essential files.
+function verify_directory (dir)
+  needed_files = {"COPYING", "DESCRIPTION"};
+  for f = needed_files
+    if (! exist (fullfile (dir, f{1}), "file"))
+      error ("package is missing file: %s", f{1});
+    endif
+  endfor
+endfunction
+
+## Parse the DESCRIPTION file.
+function desc = get_description (filename)
+  [fid, msg] = fopen (filename, "r");
+  if (fid == -1)
+    error ("the DESCRIPTION file %s could not be read: %s", filename, msg);
+  endif
+
+  desc = struct ();
+
+  line = fgetl (fid);
+  while (line != -1)
+    if (line(1) == "#")
+    ## Comments, do nothing.
+    elseif (isspace(line(1)))
+      ## Continuation lines
+      if (exist ("keyword", "var") && isfield (desc, keyword))
+       desc.(keyword) = cstrcat (desc.(keyword), " ", rstrip(line));
+      endif
+    else
+      ## Keyword/value pair
+      colon = find (line == ":");
+      if (length (colon) == 0)
+       disp ("skipping line");
+      else
+       colon = colon(1);
+       keyword = tolower (strip (line(1:colon-1)));
+       value = strip (line (colon+1:end));
+       if (length (value) == 0)
+         fclose (fid);
+         error ("the keyword %s has an empty value", desc.keywords{end});
+       endif
+       desc.(keyword) = value;
+      endif
+    endif
+    line = fgetl (fid);
+  endwhile
+  fclose (fid);
+
+  ## Make sure all is okay.
+  needed_fields = {"name", "version", "date", "title", ...
+                  "author", "maintainer", "description"};
+  for f = needed_fields
+    if (! isfield (desc, f{1}))
+      error ("description is missing needed field %s", f{1});
+    endif
+  endfor
+  desc.version = fix_version (desc.version);
+  if (isfield (desc, "depends"))
+    desc.depends = fix_depends (desc.depends);
+  else
+    desc.depends = "";
+  endif
+  desc.name = tolower (desc.name);
+endfunction
+
+## Make sure the version string v is a valid x.y.z version string
+## Examples: "0.1" => "0.1.0", "monkey" => error(...).
+function out = fix_version (v)
+  dots = find (v == ".");
+  if (length (dots) == 1)
+    major = str2num (v(1:dots-1));
+    minor = str2num (v(dots+1:end));
+    if (length (major) != 0 && length (minor) != 0)
+      out = sprintf ("%d.%d.0", major, minor);
+      return;
+    endif
+  elseif (length (dots) == 2)
+    major = str2num (v(1:dots(1)-1));
+    minor = str2num (v(dots(1)+1:dots(2)-1));
+    rev = str2num (v(dots(2)+1:end));
+    if (length (major) != 0 && length (minor) != 0 && length (rev) != 0)
+      out = sprintf ("%d.%d.%d", major, minor, rev);
+      return;
+    endif
+  endif
+  error ("bad version string: %s", v);
+endfunction
+
+## Make sure the depends field is of the right format.
+## This function returns a cell of structures with the following fields:
+##   package, version, operator
+function deps_cell = fix_depends (depends)
+  deps = split_by (tolower (depends), ",");
+  deps_cell = cell (1, length (deps));
+
+  ## For each dependency.
+  for i = 1:length (deps)
+    dep = deps{i};
+    lpar = find (dep == "(");
+    rpar = find (dep == ")");
+    ## Does the dependency specify a version
+    ## Example: package(>= version).
+    if (length (lpar) == 1 && length (rpar) == 1)
+      package = tolower (strip (dep(1:lpar-1)));
+      sub = dep(lpar(1)+1:rpar(1)-1);
+      parts = strsplit (sub, " ", true);
+      if (length (parts) != 2)
+       error ("incorrect syntax for dependency `%s' in the DESCRIPTION file\n",
+              dep);
+      endif
+      operator = parts{1};
+      if (! any (strcmp (operator, {">", ">=", "<=", "<", "=="})))
+       error ("unsupported operator: %s", operator);
+      endif
+      version  = fix_version (parts{2});
+
+    ## If no version is specified for the dependency
+    ## we say that the version should be greater than 
+    ## or equal to "0.0.0".
+    else
+      package = tolower (strip (dep));
+      operator = ">=";
+      version  = "0.0.0";
+    endif
+    deps_cell{i} = struct ("package", package, "operator", operator,
+                          "version", version);
+  endfor
+endfunction
+
+## Strip the text of spaces from the right
+## Example: "  hello world  " => "  hello world"
+## FIXME -- is this the same as deblank?
+function text = rstrip (text)
+  chars = find (! isspace (text));
+  if (length (chars) > 0)
+    ## FIXME: shouldn't it be text = text(1:chars(end));
+    text = text (chars(1):end);
+  else
+    text = "";
+  endif
+endfunction
+
+## Strip the text of spaces from the left and the right.
+## Example: "  hello world  " => "hello world"
+function text = strip (text)
+  chars = find (! isspace (text));
+  if (length (chars) > 0)
+    text = text(chars(1):chars(end));
+  else
+    text = "";
+  endif
+endfunction
+
+## Split the text into a cell array of strings by sep.
+## Example: "A, B" => {"A", "B"} (with sep = ",")
+function out = split_by (text, sep)
+  out = strtrim (strsplit (text, sep));
+endfunction
+
+## Create an INDEX file for a package that doesn't provide one.
+##   'desc'  describes the package.
+##   'dir'   is the 'inst' directory in temporary directory.
+##   'index_file' is the name (including path) of resulting INDEX file.
+function write_index (desc, dir, index_file, global_install)
+  ## Get names of functions in dir
+  [files, err, msg] = readdir (dir);
+  if (err)
+    error ("couldn't read directory %s: %s", dir, msg);
+  endif
+
+  ## Check for architecture dependent files.
+  tmpdir = getarchdir (desc);
+  if (exist (tmpdir, "dir"))
+    [files2, err, msg] = readdir (tmpdir);
+    if (err)
+      error ("couldn't read directory %s: %s", tmpdir, msg);
+    endif
+    files = [files; files2];    
+  endif
+
+  functions = {};
+  for i = 1:length (files)
+    file = files{i};
+    lf = length (file);
+    if (lf > 2 && strcmp (file(end-1:end), ".m"))
+      functions{end+1} = file(1:end-2);
+    elseif (lf > 4 && strcmp (file(end-3:end), ".oct"))
+      functions{end+1} = file(1:end-4);
+    endif
+  endfor
+
+  ## Does desc have a categories field?
+  if (! isfield (desc, "categories"))
+    error ("the DESCRIPTION file must have a Categories field, when no INDEX file is given");
+  endif
+  categories = split_by (desc.categories, ",");
+  if (length (categories) < 1)
+    error ("the Category field is empty");
+  endif
+
+  ## Write INDEX.
+  fid = fopen (index_file, "w");
+  if (fid == -1)
+    error ("couldn't open %s for writing.", index_file);
+  endif
+  fprintf (fid, "%s >> %s\n", desc.name, desc.title);
+  fprintf (fid, "%s\n", categories{1});
+  fprintf (fid, "  %s\n", functions{:});
+  fclose (fid);
+endfunction
+
+function bad_deps = get_unsatisfied_deps (desc, installed_pkgs_lst)
+  bad_deps = {};
+
+  ## For each dependency.
+  for i = 1:length (desc.depends)
+    dep = desc.depends{i};
+
+    ## Is the current dependency Octave?
+    if (strcmp (dep.package, "octave"))
+      if (! compare_versions (OCTAVE_VERSION, dep.version, dep.operator))
+        bad_deps{end+1} = dep;
+      endif
+    ## Is the current dependency not Octave?
+    else
+      ok = false;
+      for i = 1:length (installed_pkgs_lst)
+       cur_name = installed_pkgs_lst{i}.name;
+       cur_version = installed_pkgs_lst{i}.version;
+       if (strcmp (dep.package, cur_name)
+           && compare_versions (cur_version, dep.version, dep.operator))
+         ok = true;
+         break;
+       endif
+      endfor
+      if (! ok)
+        bad_deps{end+1} = dep;
+      endif
+    endif
+  endfor
+endfunction
+
+function [out1, out2] = installed_packages (local_list, global_list)
+  ## Get the list of installed packages.
+  try
+    local_packages = load (local_list).local_packages;
+  catch
+    local_packages = {};
+  end_try_catch
+  try
+    global_packages = load (global_list).global_packages;
+  catch
+    global_packages = {};
+  end_try_catch
+  installed_pkgs_lst = {local_packages{:}, global_packages{:}};
+
+  ## Eliminate duplicates in the installed package list.
+  ## Locally installed packages take precedence.
+  dup = [];
+  for i = 1:length (installed_pkgs_lst)
+    if (find (dup, i))
+      continue;
+    endif
+    for j = (i+1):length (installed_pkgs_lst)
+      if (find (dup, j))
+       continue;
+      endif
+      if (strcmp (installed_pkgs_lst{i}.name, installed_pkgs_lst{j}.name))
+       dup = [dup, j];
+      endif
+    endfor
+  endfor
+  if (! isempty(dup))
+    installed_pkgs_lst(dup) = [];
+  endif  
+
+  ## Now check if the package is loaded.
+  tmppath = strrep (path(), "\\", "/");
+  for i = 1:length (installed_pkgs_lst)
+    if (findstr (tmppath, strrep (installed_pkgs_lst{i}.dir, "\\", "/")))
+      installed_pkgs_lst{i}.loaded = true;
+    else
+      installed_pkgs_lst{i}.loaded = false;
+    endif
+  endfor
+  for i = 1:length (local_packages)
+    if (findstr (tmppath, strrep (local_packages{i}.dir, "\\", "/")))
+      local_packages{i}.loaded = true;
+    else
+      local_packages{i}.loaded = false;
+    endif
+  endfor
+  for i = 1:length (global_packages)
+    if (findstr (tmppath, strrep (global_packages{i}.dir, "\\", "/")))
+      global_packages{i}.loaded = true;
+    else
+      global_packages{i}.loaded = false;
+    endif
+  endfor
+
+  ## Should we return something?
+  if (nargout == 2)
+    out1 = local_packages;
+    out2 = global_packages;
+    return;
+  elseif (nargout == 1)
+    out1 = installed_pkgs_lst;
+    return;
+  endif
+
+  ## We shouldn't return something, so we'll print something.
+  num_packages = length (installed_pkgs_lst);
+  if (num_packages == 0)
+    printf ("no packages installed.\n");
+    return;
+  endif
+
+  ## Compute the maximal lengths of name, version, and dir.
+  h1 = "Package Name";
+  h2 = "Version";
+  h3 = "Installation directory";
+  max_name_length = length (h1); 
+  max_version_length = length (h2);
+  names = cell (num_packages, 1); 
+  for i = 1:num_packages
+    max_name_length = max (max_name_length,
+                          length (installed_pkgs_lst{i}.name));
+    max_version_length = max (max_version_length,
+                             length (installed_pkgs_lst{i}.version));
+    names{i} = installed_pkgs_lst{i}.name;
+  endfor
+  max_dir_length = terminal_size()(2) - max_name_length - ...
+                  max_version_length - 7;
+  if (max_dir_length < 20)
+    max_dir_length = Inf;
+  endif
+
+  h1 = postpad (h1, max_name_length + 1, " ");
+  h2 = postpad (h2, max_version_length, " ");;
+
+  ## Print a header.
+  header = sprintf("%s | %s | %s\n", h1, h2, h3);
+  printf (header);
+  tmp = sprintf (repmat ("-", 1, length(header)-1));
+  tmp(length(h1)+2) = "+";
+  tmp(length(h1)+length(h2)+5) = "+";
+  printf ("%s\n", tmp);
+
+  ## Print the packages.
+  format = sprintf ("%%%ds %%1s| %%%ds | %%s\n", max_name_length,
+                   max_version_length);
+  [dummy, idx] = sort (names);
+  for i = 1:num_packages
+    cur_name = installed_pkgs_lst{idx(i)}.name;
+    cur_version = installed_pkgs_lst{idx(i)}.version;
+    cur_dir = installed_pkgs_lst{idx(i)}.dir;
+    if (length (cur_dir) > max_dir_length)
+      first_char = length (cur_dir) - max_dir_length + 4;
+      first_filesep = strfind (cur_dir(first_char:end), filesep());
+      if (! isempty (first_filesep))
+        cur_dir = cstrcat ("...", 
+                          cur_dir((first_char + first_filesep(1) - 1):end));
+      else
+        cur_dir = cstrcat ("...", cur_dir(first_char:end));
+      endif
+    endif
+    if (installed_pkgs_lst{idx(i)}.loaded)
+      cur_loaded = "*";
+    else
+      cur_loaded = " ";
+    endif
+    printf (format, cur_name, cur_loaded, cur_version, cur_dir);
+  endfor
+endfunction
+
+function load_packages (files, handle_deps, local_list, global_list)
+  installed_pkgs_lst = installed_packages (local_list, global_list);
+  num_packages = length (installed_pkgs_lst);
+
+  ## Read package names and installdirs into a more convenient format.
+  pnames = pdirs = cell (1, num_packages);
+  for i = 1:num_packages
+    pnames{i} = installed_pkgs_lst{i}.name;
+    pdirs{i} = installed_pkgs_lst{i}.dir;
+  endfor
+
+  ## Load all.
+  if (length (files) == 1 && strcmp (files{1}, "all"))
+    idx = [1:length(installed_pkgs_lst)];
+  ## Load auto.
+  elseif (length (files) == 1 && strcmp (files{1}, "auto")) 
+    idx = [];
+    for i = 1:length (installed_pkgs_lst)
+      if (exist (fullfile (pdirs{i}, "packinfo", ".autoload"), "file"))
+       idx (end + 1) = i;
+      endif
+    endfor
+  ## Load package_name1 ...
+  else
+    idx = [];
+    for i = 1:length (files)
+      idx2 = find (strcmp (pnames, files{i}));
+      if (! any (idx2))
+       error ("package %s is not installed", files{i});
+      endif
+      idx (end + 1) = idx2;
+    endfor
+  endif
+
+  ## Load the packages, but take care of the ordering of dependencies.
+  load_packages_and_dependencies (idx, handle_deps, installed_pkgs_lst, true);
+endfunction
+
+function unload_packages (files, handle_deps, local_list, global_list)
+  installed_pkgs_lst = installed_packages (local_list, global_list);
+  num_packages = length (installed_pkgs_lst);
+
+  ## Read package names and installdirs into a more convenient format.
+  pnames = pdirs = cell (1, num_packages);
+  for i = 1:num_packages
+    pnames{i} = installed_pkgs_lst{i}.name;
+    pdirs{i} = installed_pkgs_lst{i}.dir;
+    pdeps{i} = installed_pkgs_lst{i}.depends;
+  endfor
+
+  ## Get the current octave path.
+  p = split_by (path(), pathsep ());
+
+  if (length (files) == 1 && strcmp (files{1}, "all"))
+    ## Unload all.
+    dirs = pdirs;
+    desc = installed_pkgs_lst;
+  else
+    ## Unload package_name1 ...
+    dirs = {};
+    desc = {};
+    for i = 1:length (files)
+      idx = strcmp (pnames, files{i});
+      if (! any (idx))
+       error ("package %s is not installed", files{i});
+      endif
+      dirs{end+1} = pdirs{idx};
+      desc{end+1} = installed_pkgs_lst{idx};
+    endfor
+  endif
+
+  ## Check for architecture dependent directories.
+  archdirs = {};
+  for i = 1:length (dirs)
+    tmpdir = getarchdir (desc{i});
+    if (exist (tmpdir, "dir"))
+      archdirs{end+1} = dirs{i};
+      archdirs{end+1} = tmpdir;
+    else
+      archdirs{end+1} = dirs{i};
+    endif
+  endfor
+
+  ## Unload the packages.
+  for i = 1:length (archdirs)
+    d = archdirs{i};
+    idx = strcmp (p, d);
+    if (any (idx))
+      rmpath (d);
+    ## FIXME: We should also check if we need to remove items from
+    ## EXEC_PATH.
+    endif
+  endfor
+endfunction
+
+function [status_out, msg_out] = rm_rf (dir)
+  if (exist (dir))
+    crr = confirm_recursive_rmdir ();
+    unwind_protect
+      confirm_recursive_rmdir (false);
+      [status, msg] = rmdir (dir, "s");
+    unwind_protect_cleanup
+      confirm_recursive_rmdir (crr);
+    end_unwind_protect
+  else
+    status = 1;
+    msg = "";
+  endif
+  if (nargout > 0)
+    status_out = status;
+  endif
+  if (nargout > 1)
+    msg_out = msg;
+  endif
+endfunction
+
+function emp = dirempty (nm, ign)
+  if (exist (nm, "dir"))
+    if (nargin < 2)
+      ign = {".", ".."};
+    else
+      ign = [{".", ".."}, ign];
+    endif
+    l = dir (nm);
+    for i = 1:length (l)
+      found = false;
+      for j = 1:length (ign)
+        if (strcmp (l(i).name, ign{j}))
+          found = true;
+          break;
+        endif
+      endfor
+      if (! found)
+        emp = false;
+        return
+      endif
+    endfor
+    emp = true;
+  else
+    emp = true;
+  endif
+endfunction
+
+function arch = getarch ()
+  persistent _arch = cstrcat (octave_config_info("canonical_host_type"), ...
+                             "-", octave_config_info("api_version"));
+  arch = _arch;
+endfunction
+
+function archprefix = getarchprefix (desc, global_install)
+  if ((nargin == 2 && global_install) || (nargin < 2 && issuperuser ()))
+    archprefix = fullfile (octave_config_info ("libexecdir"), "octave", 
+                          "packages", cstrcat(desc.name, "-", desc.version));
+  else
+    archprefix = desc.dir;
+  endif
+endfunction
+
+function archdir = getarchdir (desc)
+  archdir = fullfile (desc.archprefix, getarch());
+endfunction
+
+function s = issuperuser ()
+  if ((ispc () && ! isunix ()) || (geteuid() == 0))
+    s = true;
+  else
+    s = false;
+  endif
+endfunction
+
+function [status, output] = shell (cmd)
+  persistent have_sh;
+
+  cmd = strrep (cmd, "\\", "/");
+  if (ispc () && ! isunix ())
+    if (isempty(have_sh))
+      if (system("sh.exe -c \"exit\""))
+        have_sh = false;
+      else
+        have_sh = true;
+      endif
+    endif
+    if (have_sh)
+      [status, output] = system (cstrcat ("sh.exe -c \"", cmd, "\""));
+    else
+      error ("Can not find the command shell")
+    endif
+  else
+    [status, output] = system (cmd);
+  endif
+endfunction
+
+function newdesc = save_order (desc)
+  newdesc = {};
+  for i = 1 : length(desc)
+    deps = desc{i}.depends;
+    if (isempty (deps) || (length (deps) == 1 && 
+                          strcmp(deps{1}.package, "octave")))
+      newdesc {end + 1} = desc{i};
+    else
+      tmpdesc = {};
+      for k = 1 : length (deps)
+        for j = 1 : length (desc)
+          if (strcmp (desc{j}.name, deps{k}.package))
+            tmpdesc{end+1} = desc{j};
+           break;
+          endif
+        endfor
+      endfor
+      if (! isempty (tmpdesc))                                      
+        newdesc = {newdesc{:}, save_order(tmpdesc){:}, desc{i}};
+      else
+        newdesc{end+1} = desc{i};
+      endif
+    endif
+  endfor
+  ## Eliminate the duplicates.
+  idx = [];
+  for i = 1 : length (newdesc)
+    for j = (i + 1) : length (newdesc)
+      if (strcmp (newdesc{i}.name, newdesc{j}.name))
+        idx (end + 1) = j;
+      endif
+    endfor
+  endfor
+  newdesc(idx) = [];
+endfunction
+
+function load_packages_and_dependencies (idx, handle_deps, installed_pkgs_lst,
+                                        global_install)
+  idx = load_package_dirs (idx, [], handle_deps, installed_pkgs_lst);
+  dirs = {};
+  execpath = EXEC_PATH ();
+  for i = idx;
+    ndir = installed_pkgs_lst{i}.dir;
+    dirs{end+1} = ndir;
+    if (exist (fullfile (dirs{end}, "bin"), "dir"))
+      execpath = cstrcat (fullfile (dirs{end}, "bin"), ":", execpath);
+    endif
+    tmpdir = getarchdir (installed_pkgs_lst{i});
+    if (exist (tmpdir, "dir"))
+      dirs{end + 1} = tmpdir;
+      if (exist (fullfile (dirs{end}, "bin"), "dir"))
+        execpath = cstrcat (fullfile (dirs{end}, "bin"), ":", execpath);
+      endif
+    endif
+  endfor
+
+  ## Load the packages.
+  if (length (dirs) > 0)
+    addpath (dirs{:});
+  endif
+
+  ## Add the binaries to exec_path.
+  if (! strcmp (EXEC_PATH, execpath))
+    EXEC_PATH (execpath);
+  endif
+endfunction
+
+function idx = load_package_dirs (lidx, idx, handle_deps, installed_pkgs_lst)
+  for i = lidx
+    if (isfield (installed_pkgs_lst{i}, "loaded") &&
+       installed_pkgs_lst{i}.loaded)
+      continue;
+    else
+      if (handle_deps)
+        deps = installed_pkgs_lst{i}.depends;
+        if ((length (deps) > 1) || (length (deps) == 1 && 
+                                   ! strcmp(deps{1}.package, "octave")))
+          tmplidx = [];
+          for k = 1 : length (deps)
+            for j = 1 : length (installed_pkgs_lst)
+              if (strcmp (installed_pkgs_lst{j}.name, deps{k}.package))
+                tmplidx (end + 1) = j;
+               break;
+              endif
+            endfor
+          endfor
+          idx = load_package_dirs (tmplidx, idx, handle_deps, 
+                                  installed_pkgs_lst);
+        endif
+      endif
+      if (isempty (find(idx == i)))
+        idx (end + 1) = i;
+      endif
+    endif
+  endfor
+endfunction
+
+function dep = is_architecture_dependent (nm)
+  persistent archdepsuffix = {".oct",".mex",".a",".lib",".so",".so.*",".dll","dylib"};
+
+  dep = false;
+  for i = 1 : length (archdepsuffix)
+    ext = archdepsuffix{i};
+    if (ext(end) == "*")
+      isglob = true;
+      ext(end) = [];
+    else
+      isglob = false;
+    endif
+    pos = findstr (nm, ext);
+    if (pos)
+      if (! isglob && (length(nm) - pos(end) != length(ext) - 1))
+       continue;
+      endif
+      dep = true;
+      break;
+    endif
+  endfor
+endfunction
diff --git a/test/indent/prolog.prolog b/test/indent/prolog.prolog
new file mode 100644 (file)
index 0000000..968cef5
--- /dev/null
@@ -0,0 +1,224 @@
+%% -*- mode: prolog; coding: utf-8 -*-
+
+%% wf(+E)
+%% Vérifie que E est une expression syntaxiquement correcte.
+wf(X) :- atom(X); integer(X); var(X).           %Une variable ou un entier.
+wf(lambda(X, T, B)) :- atom(X), wf(T), wf(B).   %Une fonction.
+wf(app(E1, E2)) :- wf(E1), wf(E2).              %Un appel de fonction.
+wf(pi(X, T, B)) :- atom(X), wf(T), wf(B).       %Le type d'une fonction.
+
+%% Éléments additionnels utilisés dans le langage source.
+wf(lambda(X, B)) :- atom(X), wf(B).
+wf(let(X, E1, E2)) :- atom(X), wf(E1), wf(E2).
+wf(let(X, T, E1, E2)) :- atom(X), wf(T), wf(E1), wf(E2).
+wf((T1 -> T2)) :- wf(T1), wf(T2).
+wf(forall(X, T, B)) :- atom(X), wf(T), wf(B).
+wf(fix(X,T,E1,E2)) :- atom(X), wf(T), wf(E1), wf(E2).
+wf(fix(X,E1,E2)) :- atom(X), wf(E1), wf(E2).
+wf(app(E1,E2,E3)) :- wf(E1), wf(E2), wf(E3).
+wf(app(E1,E2,E3,E4)) :- wf(E1), wf(E2), wf(E3), wf(E4).
+
+%% subst(+X, +V, +FV, +Ei, -Eo)
+%% Remplace X par V dans Ei.  Les variables qui apparaissent libres dans
+%% V et peuvent aussi apparaître dans Ei doivent toutes être inclues
+%% dans l'environnement FV.
+subst(X, V, _, X, E) :- !, E = V.
+subst(_, _, _, Y, Y) :- atom(Y); integer(Y).
+%% Residualize the substitution when applied to an uninstantiated variable.
+%% subst(X, V, _, Y, app(lambda(X,_,Y),V)) :- var(Y).
+%% Rather than residualize and leave us with unifications that fail, let's
+%% rather assume that Y will not refer to X.
+subst(X, V, _, Y, Y) :- var(Y).
+subst(X, V, FV, lambda(Y, Ti, Bi), lambda(Y1, To, Bo)) :-
+    subst(X, V, FV, Ti, To),
+    (X = Y ->
+         %% If X is equal to Y, X is shadowed, so no subst can take place.
+         Y1 = Y, Bo = Bi;
+     (member((Y, _), FV) ->
+          %% If Y appears in FV, it can appear in V, so we need to
+          %% rename it to avoid name capture.
+          new_atom(Y, Y1),
+          subst(Y, Y1, [], Bi, Bi1);
+      Y1 = Y, Bi1 = Bi),
+     %% Perform substitution on the body.
+     subst(X, V, FV, Bi1, Bo)).
+subst(X, V, FV, pi(Y, Ti, Bi), pi(Y1, To, Bo)) :-
+    subst(X, V, FV, lambda(Y, Ti, Bi), lambda(Y1, To, Bo)).
+subst(X, V, FV, forall(Y, Ti, Bi), forall(Y1, To, Bo)) :-
+    subst(X, V, FV, lambda(Y, Ti, Bi), lambda(Y1, To, Bo)).
+subst(X, V, FV, app(E1i, E2i), app(E1o, E2o)) :-
+    subst(X, V, FV, E1i, E1o), subst(X, V, FV, E2i, E2o).
+
+%% apply(+F, +Arg, +Env, -E)
+apply(lambda(X, _, B), Arg, Env, E) :- \+ var(B), subst(X, Arg, Env, B, E).
+apply(app(plus, N1), N2, _, N) :- integer(N1), integer(N2), N is N1 + N2.
+apply(app(minus, N1), N2, _, N) :- integer(N1), integer(N2), N is N1 - N2.
+
+
+%% normalize(+E1, +Env, -E2)
+%% Applique toutes les réductions possibles sur E1.
+normalize(X, _, X) :- integer(X); var(X); atom(X).
+%% normalize(X, Env, E) :- atom(X), member((X, E), Env).
+normalize(lambda(X, T, B), Env, lambda(X, Tn, Bn)) :-
+    normalize(T, [(X,T)|Env], Tn), normalize(B, [(X,T)|Env], Bn).
+normalize(pi(X, T, B), Env, pi(X, Tn, Bn)) :-
+    normalize(T, [(X,T)|Env], Tn), normalize(B, [(X,T)|Env], Bn).
+normalize(forall(X, T, B), Env, forall(X, Tn, Bn)) :-
+    normalize(T, [(X,T)|Env], Tn), normalize(B, [(X,T)|Env], Bn).
+normalize(app(E1, E2), Env, En) :-
+    normalize(E1, Env, E1n),
+    normalize(E2, Env, E2n),
+    (apply(E1n, E2n, Env, E) ->
+         normalize(E, Env, En);
+     En = app(E1n, E2n)).
+
+%% infer(+E, +Env, -T)
+%% Infère le type de E dans Env.  On essaie d'être permissif, dans le sens
+%% que l'on présume que l'expression est typée correctement.
+infer(X, _, int) :- integer(X).
+infer(X, _, _) :- var(X).            %Une expression encore inconnue.
+infer(X, Env, T) :-
+    atom(X),
+    (member((X, T1), Env) ->
+         %% X est déjà dans Env: vérifie que le type est correct.
+         T = T1;
+     %% X est une variable libre.
+     true).
+infer(lambda(X,T,B), Env, pi(Y,T,TB)) :-
+    infer(B, [(X,T)|Env], TBx),
+    (var(Y) ->
+         Y = X, TB = TBx;
+     subst(X, Y, Env, TBx, TB)).
+infer(app(E1, E2), Env, Tn) :-
+    infer(E1, Env, T1),
+    (T1 = pi(X,T2,B); T1 = forall(X,T2,B)),
+    infer(E2, Env, T2),
+    subst(X, E2, Env, B, T),
+    normalize(T, Env, Tn).
+infer(pi(X,T1,T2), Env, type) :-
+    infer(T1, Env, type),
+    infer(T2, [(X,T1)|Env], type).
+infer(forall(X,T1,T2), Env, type) :-
+    infer(T1, Env, type),
+    infer(T2, [(X,T1)|Env], type).
+
+%% freevars(+E, +Env, -Vs)
+%% Renvoie les variables libres de E.  Vs est une liste associative
+%% où chaque élément est de la forme (X,T) où X est une variable et T est
+%% son type.
+freevars(X, _, []) :- integer(X).
+freevars(X, Env, Vs) :-
+    atom(X),
+    (member((X,_), Env) ->
+         %% Variable liée.
+         Vs = [];
+     %% Variable libre.  Type inconnu :-(
+     Vs = [(X,_)]).
+%% Les variables non-instanciées peuvent être remplacées par des paramètres
+%% qui seront liés par `closetype' selon le principe de Hindley-Milner.
+freevars(X, _, [(X, _)]) :- var(X), new_atom(X).
+freevars(app(E1, E2), Env, Vs) :-
+    freevars(E1, Env, Vs1),
+    append(Vs1, Env, Env1),
+    freevars(E2, Env1, Vs2),
+    append(Vs1, Vs2, Vs).
+freevars(lambda(X, T, B), Env, Vs) :-
+    freevars(T, Env, TVs),
+    append(TVs, Env, Env1),
+    freevars(B, [(X,T)|Env1], BVs),
+    append(TVs, BVs, Vs).
+freevars(pi(X, T, B), Env, Vs)     :- freevars(lambda(X, T, B), Env, Vs).
+freevars(forall(X, T, B), Env, Vs) :- freevars(lambda(X, T, B), Env, Vs).
+
+%% close(+Eo, +To, +Vs, -Ec, -Tc)
+%% Ferme un type ouvert To en liant chaque variable libre (listées dans Vs)
+%% avec `forall'.
+closetype(E, T, [], E, T).
+closetype(Eo, To, [(X,T)|Vs], lambda(X, T, Ec), forall(X, T, Tc)) :-
+    closetype(Eo, To, Vs, Ec, Tc).
+
+%% elab_type(+Ee, +Te, +Env, -Eg, -Tg)
+%% Ajoute les arguments implicites de E:T.
+generalize(Ee, Te, Env, Eg, Tg) :-
+    freevars(Te, Env, Vs),
+    append(Vs, Env, EnvX),
+    %% Essaie d'instancier les types des paramètres que `generalize' vient
+    %% d'ajouter.
+    infer(Te, EnvX, type),
+    closetype(Ee, Te, Vs, Eg, Tg).
+
+%% instantiate(+X, +T, -E)
+%% Utilise la variable X de type T.  Le résultat E est X auquel on ajoute
+%% tous les arguments implicites (de valeur inconnue).
+instantiate(X, T, X) :- var(T), ! .
+instantiate(X, forall(_, _, T), app(E, _)) :- !, instantiate(X, T, E).
+instantiate(X, _, X).
+
+%% elaborate(+E1, +Env, -E2)
+%% Transforme E1 en une expression E2 où le sucre syntaxique a été éliminé
+%% et où les arguments implicites ont été rendus explicites.
+elaborate(X, _, X) :- integer(X); var(X).
+elaborate(X, Env, E) :-
+    atom(X),
+    (member((X, T), Env) ->
+         instantiate(X, T, E);
+     %% Si X n'est pas dans l'environnement, c'est une variable libre que
+     %% l'on voudra probablement généraliser.
+     X = E).
+elaborate(lambda(X, T, B), Env, lambda(X, Te, Be)) :-
+    elaborate(T, Env, Te),
+    elaborate(B, [(X,Te)|Env], Be).
+elaborate(pi(X, T, B), Env, pi(X, Te, Be)) :-
+    elaborate(T, Env, Te),
+    elaborate(B, [(X,Te)|Env], Be).
+elaborate(app(E1, E2), Env, app(E1e, E2e)) :-
+    elaborate(E1, Env, E1e),
+    elaborate(E2, Env, E2e).
+elaborate(let(X, T, E1, E2), Env, app(lambda(X, Tg, E2e), E1g)) :-
+    elaborate(E1, Env, E1e),
+    elaborate(T, Env, Te),
+    infer(E1e, Env, Te),
+    generalize(E1e, Te, Env, E1g, Tg),
+    elaborate(E2, [(X,Te)|Env], E2e).
+%% Expansion du sucre syntaxique.
+elaborate((T1 -> T2), Env, Ee) :-
+    new_atom(X), elaborate(pi(X, T1, T2), Env, Ee).
+elaborate(app(E1, E2, E3, E4), Env, Ee) :-
+    elaborate(app(app(E1,E2,E3),E4), Env, Ee).
+elaborate(app(E1, E2, E3), Env, Ee) :- elaborate(app(app(E1,E2),E3), Env, Ee).
+elaborate(lambda(X, B), Env, Ee) :- elaborate(lambda(X, _, B), Env, Ee).
+elaborate(let(X, E1, E2), Env, Ee) :- elaborate(let(X, _, E1, E2), Env, Ee).
+elaborate(fix(F,B,E), Env, Ee) :- elaborate(fix(F,_,B,E), Env, Ee).
+elaborate(fix(F,T,B,E), Env, Ee) :-
+    elaborate(let(F,T,app(fix,lambda(F,T,B)),E), Env, Ee).
+
+%% elab_bindings(+TS, +Env, -TS).
+%% Applique `elaborate' sur l'environnment de type TS.
+elab_tenv([], _, []).
+elab_tenv([(X,T)|TS], Env, [(X, Tg)|TSe]) :-
+    elaborate(T, Env, Te),
+    infer(Te, Env, type),
+    generalize(_, Te, Env, _, Tg),
+    elab_tenv(TS, [(X, Tg)|Env], TSe).
+
+
+%% elaborate(+E1, -E2)
+%% Comme le `elaborate' ci-dessus, mais avec un environnement par défaut.
+elaborate(SRC, E) :-
+    elab_tenv([(int, type),
+               (fix, ((t -> t) -> t)),
+               %% list: type → int → type
+               (list, (type -> int -> type)),
+               %% plus: int → int → int
+               (plus, (int -> int -> int)),
+               %% minus: int → int → int
+               (minus, (int -> int -> int)),
+               %% nil: list t 0
+               (nil, app(app(list,t),0)),
+               %% cons: t -> list t n → list t (n + 1)
+               (cons, (t -> app(app(list,t),n) ->
+                            app(app(list,t), app(app(plus,n),1)))) %fixindent
+              ],
+              [(type,type)],
+              Env),
+    elaborate(SRC, Env, E).
diff --git a/test/occur-testsuite.el b/test/occur-testsuite.el
new file mode 100644 (file)
index 0000000..a4756c4
--- /dev/null
@@ -0,0 +1,347 @@
+;;; occur-testsuite.el --- Test suite for occur.
+
+;; Copyright (C) 2010  Free Software Foundation, Inc.
+
+;; Author: Juri Linkov <juri@jurta.org>
+;; Keywords: matching, 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-occur RET to test the functionality of `occur'.
+
+;;; Code:
+
+(defconst occur-tests
+  '(
+    ;; * Test one-line matches (at bob, eob, bol, eol).
+    ("x" 0 "\
+xa
+b
+cx
+xd
+xex
+fx
+" "\
+5 matches for \"x\" in buffer:  *temp*
+      1:xa
+      3:cx
+      4:xd
+      5:xex
+      6:fx
+")
+    ;; * Test multi-line matches, this is the first test from
+    ;; http://lists.gnu.org/archive/html/emacs-devel/2005-06/msg01008.html
+    ;; where numbers are replaced with letters.
+    ("a\na" 0 "\
+a
+a
+a
+a
+a
+" "\
+2 matches for \"a^Ja\" in buffer:  *temp*
+      1:a
+       :a
+      3:a
+       :a
+")
+    ;; * Test multi-line matches, this is the second test from
+    ;; http://lists.gnu.org/archive/html/emacs-devel/2005-06/msg01008.html
+    ;; where numbers are replaced with letters.
+    ("a\nb" 0 "\
+a
+b
+c
+a
+b
+" "\
+2 matches for \"a^Jb\" in buffer:  *temp*
+      1:a
+       :b
+      4:a
+       :b
+")
+    ;; * Test line numbers for multi-line matches with empty last match line.
+    ("a\n" 0 "\
+a
+
+c
+a
+
+" "\
+2 matches for \"a^J\" in buffer:  *temp*
+      1:a
+       :
+      4:a
+       :
+")
+    ;; * Test multi-line matches with 3 match lines.
+    ("x\n.x\n" 0 "\
+ax
+bx
+c
+d
+ex
+fx
+" "\
+2 matches for \"x^J.x^J\" in buffer:  *temp*
+      1:ax
+       :bx
+       :c
+      5:ex
+       :fx
+       :
+")
+    ;; * Test non-overlapping context lines with matches at bob/eob.
+    ("x" 1 "\
+ax
+b
+c
+d
+ex
+f
+g
+hx
+" "\
+3 matches for \"x\" in buffer:  *temp*
+      1:ax
+       :b
+-------
+       :d
+      5:ex
+       :f
+-------
+       :g
+      8:hx
+")
+    ;; * Test non-overlapping context lines with matches not at bob/eob.
+    ("x" 1 "\
+a
+bx
+c
+d
+ex
+f
+" "\
+2 matches for \"x\" in buffer:  *temp*
+       :a
+      2:bx
+       :c
+-------
+       :d
+      5:ex
+       :f
+")
+    ;; * Test overlapping context lines with matches at bob/eob.
+    ("x" 2 "\
+ax
+bx
+c
+dx
+e
+f
+gx
+h
+i
+j
+kx
+" "\
+5 matches for \"x\" in buffer:  *temp*
+      1:ax
+      2:bx
+       :c
+      4:dx
+       :e
+       :f
+      7:gx
+       :h
+       :i
+       :j
+     11:kx
+")
+    ;; * Test overlapping context lines with matches not at bob/eob.
+    ("x" 2 "\
+a
+b
+cx
+d
+e
+f
+gx
+h
+i
+" "\
+2 matches for \"x\" in buffer:  *temp*
+       :a
+       :b
+      3:cx
+       :d
+       :e
+       :f
+      7:gx
+       :h
+       :i
+")
+    ;; * Test overlapping context lines with empty first and last line..
+    ("x" 2 "\
+
+b
+cx
+d
+e
+f
+gx
+h
+
+" "\
+2 matches for \"x\" in buffer:  *temp*
+       :
+       :b
+      3:cx
+       :d
+       :e
+       :f
+      7:gx
+       :h
+       :
+")
+    ;; * Test multi-line overlapping context lines.
+    ("x\n.x" 2 "\
+ax
+bx
+c
+d
+ex
+fx
+g
+h
+i
+jx
+kx
+" "\
+3 matches for \"x^J.x\" in buffer:  *temp*
+      1:ax
+       :bx
+       :c
+       :d
+      5:ex
+       :fx
+       :g
+       :h
+       :i
+     10:jx
+       :kx
+")
+    ;; * Test multi-line non-overlapping context lines.
+    ("x\n.x" 2 "\
+ax
+bx
+c
+d
+e
+f
+gx
+hx
+" "\
+2 matches for \"x^J.x\" in buffer:  *temp*
+      1:ax
+       :bx
+       :c
+       :d
+-------
+       :e
+       :f
+      7:gx
+       :hx
+")
+    ;; * Test non-overlapping negative (before-context) lines.
+    ("x" -2 "\
+a
+bx
+c
+d
+e
+fx
+g
+h
+ix
+" "\
+3 matches for \"x\" in buffer:  *temp*
+       :a
+      2:bx
+-------
+       :d
+       :e
+      6:fx
+-------
+       :g
+       :h
+      9:ix
+")
+    ;; * Test overlapping negative (before-context) lines.
+    ("x" -3 "\
+a
+bx
+c
+dx
+e
+f
+gx
+h
+" "\
+3 matches for \"x\" in buffer:  *temp*
+       :a
+      2:bx
+       :c
+      4:dx
+       :e
+       :f
+      7:gx
+")
+
+)
+  "List of tests for `occur'.
+Each element has the format:
+\(REGEXP NLINES INPUT-BUFFER-STRING OUTPUT-BUFFER-STRING).")
+
+(defun test-occur ()
+  (interactive)
+  (let ((count 1)
+        failed
+        (occur-hook nil))
+    (dolist (test occur-tests)
+      (let ((regexp (nth 0 test))
+            (nlines (nth 1 test))
+            (input-buffer-string (nth 2 test))
+            (output-buffer-string (nth 3 test)))
+        (save-excursion
+          (with-temp-buffer
+            (insert input-buffer-string)
+            (occur regexp nlines)
+            (unless (equal output-buffer-string
+                           (with-current-buffer "*Occur*"
+                             (buffer-string)))
+              (setq failed (cons count failed))))))
+      (setq count (1+ count)))
+    (if failed
+        (message "FAILED TESTS: %S" (reverse failed))
+      (message "SUCCESS"))))
+
+(provide 'occur-testsuite)
+
+;;; occur-testsuite.el ends here
index 889504c9fa86c5b20a92367898d9ef4c59dfd3c3..c7616fea67d93de8e858dab7d4d86b221fa5109c 100644 (file)
          (propertize "XXX\n" 'face 'highlight)
          "\n  Test:     ")
   (test-insert-overlay "XXX\n" 'mouse-face 'highlight)
-  (insert "\n"))
+  (insert "\n\n"))
+
+(defun test-redisplay-3 ()
+  (insert "Test 3: Overlay with before/after strings and images:\n\n")
+  (let ((img-data "#define x_width 8
+#define x_height 8
+static unsigned char x_bits[] = {0xff, 0x81, 0xbd, 0xa5, 0xa5, 0xbd, 0x81, 0xff };"))
+    ;; Control
+    (insert "  Expected: AB"
+           (propertize "X" 'display `(image :data ,img-data :type xbm))
+           "CD\n")
+
+    ;; Overlay with before, after, and image display string.
+    (insert "  Result 1: ")
+    (let ((opoint (point)))
+      (insert "AXD\n")
+      (let ((ov (make-overlay (1+ opoint) (+ 2 opoint))))
+       (overlay-put ov 'before-string "B")
+       (overlay-put ov 'after-string "C")
+       (overlay-put ov 'display
+                    `(image :data ,img-data :type xbm))))
+
+    ;; Overlay with before and after string, and image text prop.
+    (insert "  Result 2: ")
+    (let ((opoint (point)))
+      (insert "AXD\n")
+      (let ((ov (make-overlay (1+ opoint) (+ 2 opoint))))
+       (overlay-put ov 'before-string "B")
+       (overlay-put ov 'after-string "C")
+       (put-text-property (1+ opoint) (+ 2 opoint) 'display
+                          `(image :data ,img-data :type xbm))))
+
+    ;; Overlays with adjacent before and after strings, and image text
+    ;; prop.
+    (insert "  Result 3: ")
+    (let ((opoint (point)))
+      (insert "AXD\n")
+      (let ((ov1 (make-overlay opoint (1+ opoint)))
+           (ov2 (make-overlay (+ 2 opoint) (+ 3 opoint))))
+       (overlay-put ov1 'after-string "B")
+       (overlay-put ov2 'before-string "C")
+       (put-text-property (1+ opoint) (+ 2 opoint) 'display
+                          `(image :data ,img-data :type xbm))))
+
+    ;; Three overlays.
+    (insert "  Result 4: ")
+    (let ((opoint (point)))
+      (insert "AXD\n\n")
+      (let ((ov1 (make-overlay opoint (1+ opoint)))
+           (ov2 (make-overlay (+ 2 opoint) (+ 3 opoint)))
+           (ov3 (make-overlay (1+ opoint) (+ 2 opoint))))
+       (overlay-put ov1 'after-string "B")
+       (overlay-put ov2 'before-string "C")
+       (overlay-put ov3 'display `(image :data ,img-data :type xbm))))))
+
 
 (defun test-redisplay ()
   (interactive)
-  (pop-to-buffer (generate-new-buffer "*Redisplay Test*"))
-  (test-redisplay-1)
-  (test-redisplay-2)
-  (goto-char (point-min)))
+  (let ((buf (get-buffer "*Redisplay Test*")))
+    (if buf
+       (kill-buffer buf))
+    (pop-to-buffer (get-buffer-create "*Redisplay Test*"))
+    (erase-buffer)
+    (test-redisplay-1)
+    (test-redisplay-2)
+    (test-redisplay-3)
+    (goto-char (point-min))))
 
 ;; arch-tag: fcee53c8-024f-403d-9154-61ae3ce0bfb8